[med-svn] [mira] 01/04: Imported Upstream version 3.4.0

Michael Crusoe misterc-guest at moszumanska.debian.org
Wed May 4 22:22:52 UTC 2016


This is an automated email from the git hooks/post-receive script.

misterc-guest pushed a commit to branch master
in repository mira.

commit 27068012823db3f373b9ca9aa09737ccab8f640e
Author: Michael R. Crusoe <crusoe at ucdavis.edu>
Date:   Tue Feb 2 07:33:47 2016 -0800

    Imported Upstream version 3.4.0
---
 .tarball-version                                   |     1 -
 .version                                           |     1 -
 GETTING_STARTED                                    |    13 +-
 HELP_WANTED                                        |    14 +-
 INSTALL                                            |   706 +-
 Makefile.am                                        |    65 +-
 Makefile.in                                        |   197 +-
 README                                             |    56 +-
 README_build.html                                  |   482 -
 THANKS                                             |     8 +-
 aclocal.m4                                         |  8705 +--------
 build-aux/git-version-gen                          |   181 -
 config.guess                                       |   258 +-
 config.sub                                         |   209 +-
 {m4 => config/m4}/ax_boost_base.m4                 |    25 +-
 {m4 => config/m4}/ax_boost_regex.m4                |    19 +-
 {m4 => config/m4}/ax_boost_thread.m4               |    33 +-
 {m4 => config/m4}/ax_check_zlib.m4                 |    13 +-
 config/m4/ax_cxx_have_std.m4                       |    46 +
 config/m4/ax_cxx_have_stl.m4                       |    44 +
 config/m4/ax_cxx_namespaces.m4                     |    40 +
 {m4 => config/m4}/ax_lib_expat.m4                  |    18 +-
 config/m4/ax_with_perl.m4                          |    35 +
 config/m4/ax_with_prog.m4                          |    70 +
 aclocal.m4 => config/m4/libtool.m4                 |  3881 +---
 config/m4/ltoptions.m4                             |   368 +
 config/m4/ltsugar.m4                               |   123 +
 config/m4/ltversion.m4                             |    23 +
 config/m4/lt~obsolete.m4                           |    92 +
 configure                                          |  9105 ++++-----
 configure.ac => configure.in                       |   943 +-
 depcomp                                            |   563 +-
 distribution/Makefile                              |   170 +-
 distribution/Makefile.am                           |    64 +-
 distribution/Makefile.in                           |   116 +-
 distribution/README                                |    84 +-
 doc/Makefile                                       |   109 +-
 doc/Makefile.in                                    |    55 +-
 doc/docbook/Makefile                               |   179 +-
 doc/docbook/Makefile.am                            |    45 +-
 doc/docbook/Makefile.in                            |   125 +-
 doc/docbook/attic/README.txt                       |   266 -
 doc/docbook/attic/chap_pacbio_part.xml             |   549 -
 doc/docbook/attic/chap_solexa_part.xml             |  1512 --
 doc/docbook/attic/pb_misc.xml                      |   839 -
 doc/docbook/attic/solexa_lenski.xml                |   499 -
 doc/docbook/book.xsl                               |     7 +-
 doc/docbook/book_3rdparty.xml                      |    28 -
 doc/docbook/book_definitiveguide.xml               |    87 +-
 doc/docbook/bookfigures/ion_dh10bcovB13_12kb.png   |   Bin 0 -> 28874 bytes
 doc/docbook/bookfigures/ion_dh10bcovB13_320kb.png  |   Bin 0 -> 40689 bytes
 doc/docbook/bookfigures/results_mira2other.png     |   Bin 80496 -> 0 bytes
 doc/docbook/bookfigures/results_miraconvert.png    |   Bin 60664 -> 0 bytes
 doc/docbook/chap_3p_ghbambus_part.xml              |   409 -
 doc/docbook/{attic => }/chap_454_part.xml          |   433 +-
 doc/docbook/chap_bitsandpieces_part.xml            |    83 -
 doc/docbook/chap_bonus_part.xml                    |     5 +-
 .../{chap_bonus_part.xml => chap_bonus_part.xml~}  |   392 +-
 doc/docbook/chap_dataprep_part.xml                 |   160 -
 doc/docbook/chap_denovo_part.xml                   |   473 -
 doc/docbook/chap_est_part.xml                      |   328 +-
 doc/docbook/chap_faq_part.xml                      |   139 +-
 doc/docbook/chap_hard_part.xml                     |   121 +-
 doc/docbook/chap_installation_part.xml             |   640 +-
 doc/docbook/chap_intro_part.xml                    |   179 +-
 doc/docbook/{attic => }/chap_iontor_part.xml       |   712 +-
 doc/docbook/chap_logfiles_part.xml                 |    28 +-
 doc/docbook/chap_maf_part.xml                      |    55 +-
 doc/docbook/chap_mapping_part.xml                  |   776 -
 doc/docbook/chap_mirautils_part.xml                |   651 +-
 doc/docbook/chap_pacbio_part.xml                   |  1786 ++
 doc/docbook/chap_preface_part.xml                  |    21 +-
 ..._definitiveguide.xml => chap_preface_part.xml~} |    87 +-
 doc/docbook/chap_reference_part.xml                |  5645 +++---
 doc/docbook/chap_results_part.xml                  |   860 +-
 doc/docbook/{attic => }/chap_sanger_part.xml       |    74 +-
 doc/docbook/chap_seqadvice_part.xml                |   820 +-
 doc/docbook/chap_seqtechdesc_part.xml              |   891 -
 doc/docbook/chap_solexa_part.xml                   |  1995 ++
 doc/docbook/chap_specialparams_part.xml            |    79 -
 doc/docbook/chap_sra_part.xml                      |   145 -
 doc/docbook/copyrightfile                          |     4 -
 doc/docbook/doccss/miradocstyle.css                |    10 +-
 doc/docbook/replace_all.sh                         |     9 -
 doc/docbook/{version.stub => versionfile}          |     1 +
 doc/docbook/warning_frontofchapter.xml             |    12 -
 doccss/miradocstyle.css                            |    34 -
 ltmain.sh                                          |  4026 ++--
 m4/ax_boost_filesystem.m4                          |   118 -
 m4/ax_boost_iostreams.m4                           |   116 -
 m4/ax_boost_system.m4                              |   120 -
 minidemo/bbdemo2/runme.sh                          |    14 +-
 minidemo/estdemo2/README                           |     6 +-
 minidemo/solexa1/runme.sh                          |     3 +-
 minidemo/solexa2/runme.sh                          |     3 +-
 missing                                            |    53 +-
 src/EdIt/Makefile.am                               |    10 +
 src/{caf => EdIt}/Makefile.in                      |   141 +-
 src/EdIt/faultRegion.C                             |  1222 ++
 src/EdIt/hypothesen.C                              |  2305 +++
 src/EdIt/hypothesen.H                              |   281 +
 src/EdIt/parameters.C                              |   563 +
 src/EdIt/parameters.H                              |   307 +
 src/EdIt/parameters_flexer.cc                      |  2106 +++
 src/EdIt/parameters_flexer.ll                      |   160 +
 src/EdIt/parameters_tokens.h                       |    74 +
 src/Makefile.am                                    |    38 +-
 src/Makefile.in                                    |   114 +-
 src/caf/Makefile.am                                |     7 +-
 src/caf/Makefile.in                                |    95 +-
 src/caf/caf.C                                      |   974 +-
 src/caf/caf.H                                      |   149 +-
 src/caf/caf_flexer.cc                              |  2250 +--
 src/caf/caf_flexer.ll                              |    55 +-
 src/debuggersupport/Makefile.am                    |     5 -
 src/debuggersupport/dbgsupport.C                   |    59 -
 src/debuggersupport/dbgsupport.H                   |    33 -
 src/errorhandling/Makefile.am                      |     3 +-
 src/errorhandling/Makefile.in                      |    59 +-
 src/errorhandling/errorhandling.C                  |   107 +-
 src/errorhandling/errorhandling.H                  |    49 +-
 src/examine/Makefile.am                            |     7 +
 src/{debuggersupport => examine}/Makefile.in       |   101 +-
 src/examine/afh_info.C                             |   541 +
 src/examine/buffer.C                               |   296 +
 src/examine/buffer.H                               |    84 +
 src/examine/calc.C                                 |   754 +
 src/examine/cfh.C                                  |   420 +
 src/examine/globals.H                              |   239 +
 src/examine/misc.C                                 |   398 +
 src/examine/misc.H                                 |    76 +
 src/examine/prescan.C                              |   261 +
 src/examine/prescan.H                              |   102 +
 src/examine/ranges.C                               |   591 +
 src/examine/scf_look.C                             |  2655 +++
 src/examine/scf_look.H                             |   406 +
 src/examine/scfbuffer.H                            |    70 +
 src/examples_programming/Makefile.am               |    25 +
 src/{modules => examples_programming}/Makefile.in  |   157 +-
 src/examples_programming/README                    |     6 +
 src/examples_programming/mira_101.C                |   114 +
 src/examples_programming/read_101.C                |   155 +
 src/examples_programming/readpool_101.C            |   142 +
 src/io/Makefile.am                                 |    49 +-
 src/io/Makefile.in                                 |   166 +-
 src/io/annotationmappings.C                        |   348 -
 src/io/annotationmappings.H                        |   170 -
 src/io/exp.C                                       |    43 +-
 src/io/exp.H                                       |   160 +-
 src/io/fasta.C                                     |   107 +-
 src/io/fasta.H                                     |    63 +-
 src/io/fastq-lh.H                                  |   164 +-
 src/io/fastq-mira.C                                |   278 +-
 src/io/fastq-mira.H                                |    82 +-
 src/io/gap4_ft_so_map.xxd                          |    99 -
 src/{mira/gbf_parse.C => io/gbf.C}                 |   641 +-
 src/io/gbf.H                                       |   128 +
 src/io/generalio.C                                 |    26 +-
 src/io/generalio.H                                 |    17 +-
 src/io/mira_ft_set.xxd                             |    54 -
 src/io/ncbiinfoxml.C                               |    99 +-
 src/io/ncbiinfoxml.H                               |    36 +-
 src/io/oldso2so.xxd                                |     2 -
 src/io/phd.C                                       |    31 +-
 src/io/phd.H                                       |    38 +-
 src/io/scf.C                                       |   205 +-
 src/io/scf.H                                       |    58 +-
 src/io/so.obo                                      | 18725 -------------------
 src/io/so2xgap4map.xxd                             |  2068 --
 src/knn_abi373/Makefile.am                         |     6 +
 src/{errorhandling => knn_abi373}/Makefile.in      |   159 +-
 src/knn_abi373/add.c                               |   224 +
 src/knn_abi373/add.h                               |    14 +
 src/knn_abi373/missing.c                           |   238 +
 src/knn_abi373/missing.h                           |    14 +
 src/knn_abi373/ncall.c                             |   176 +
 src/knn_abi373/ncall.h                             |    14 +
 src/knn_abi373/nplus.c                             |   159 +
 src/knn_abi373/nplus.h                             |    14 +
 src/knn_abi373/over.c                              |   224 +
 src/knn_abi373/over.h                              |    14 +
 src/knn_abi373/under.c                             |   224 +
 src/knn_abi373/under.h                             |    14 +
 src/knn_abi373/wrong.c                             |   176 +
 src/knn_abi373/wrong.h                             |    14 +
 src/knn_alf/Makefile.am                            |     6 +
 src/{errorhandling => knn_alf}/Makefile.in         |   159 +-
 src/knn_alf/add.c                                  |   224 +
 src/knn_alf/add.h                                  |    14 +
 src/knn_alf/missing.c                              |   238 +
 src/knn_alf/missing.h                              |    14 +
 src/knn_alf/ncall.c                                |   176 +
 src/knn_alf/ncall.h                                |    14 +
 src/knn_alf/nplus.c                                |   159 +
 src/knn_alf/nplus.h                                |    14 +
 src/knn_alf/over.c                                 |   224 +
 src/knn_alf/over.h                                 |    14 +
 src/knn_alf/under.c                                |   224 +
 src/knn_alf/under.h                                |    14 +
 src/knn_alf/wrong.c                                |   176 +
 src/knn_alf/wrong.h                                |    14 +
 src/lec/Makefile.am                                |     6 +
 src/{scripts => lec}/Makefile.in                   |   100 +-
 src/memorc/Makefile.am                             |    23 -
 src/memorc/Makefile.in                             |   535 -
 src/memorc/main.C                                  |   101 -
 src/memorc/memorc.C                                |   566 -
 src/memorc/memorc.H                                |    91 -
 src/mira/CHANGES.txt                               |   737 +-
 src/mira/CHANGES_old.txt                           |    57 -
 src/mira/Makefile.am                               |   112 +-
 src/mira/Makefile.in                               |   285 +-
 src/mira/TODO                                      |   335 +-
 src/mira/adaptorsforclip.454.xxd                   |     6 +-
 src/mira/adaptorsforclip.iontor.xxd                |    13 +-
 src/mira/adaptorsforclip.solexa.xxd                |    93 +-
 src/mira/adaptorsregex.iontor.xxd                  |     8 +-
 src/mira/adaptorsregex.solexa.xxd                  |     5 +-
 src/mira/ads.C                                     |   623 +-
 src/mira/ads.H                                     |   106 +-
 src/mira/adsfacts.C                                |   166 +-
 src/mira/adsfacts.H                                |    93 +-
 src/mira/align.C                                   |   681 +-
 src/mira/align.H                                   |    85 +-
 src/mira/assembly.C                                |  4559 +++--
 src/mira/assembly.H                                |  1539 +-
 src/mira/assembly_buildcontigs.C                   |  2260 ---
 src/mira/assembly_info.C                           |   223 +-
 src/mira/assembly_info.H                           |    51 +-
 src/mira/assembly_io.C                             |  2183 ++-
 src/mira/assembly_misc.C                           |  2373 ---
 src/mira/assembly_output.C                         |  5258 +++---
 src/mira/assembly_output.H                         |   358 +-
 src/mira/assembly_pbcorrect.C                      |  2126 ---
 src/mira/assembly_reduceskimhits.C                 |  1238 +-
 src/mira/assembly_repeatresolve.C                  |   532 +
 src/mira/assembly_swalign.C                        |   828 +-
 src/mira/contig.C                                  |  9225 +++++----
 src/mira/contig.H                                  |  1988 +-
 src/mira/contig_analysis.C                         |  3805 ++--
 src/mira/contig_consensus.C                        |  2774 ---
 src/mira/contig_covanalysis.C                      |   287 -
 src/mira/contig_edit.C                             |  2026 +-
 src/mira/contig_featureinfo.C                      |   623 -
 src/mira/contig_output.C                           |  1924 +-
 src/mira/contig_pairconsistency.C                  |   398 -
 src/mira/dataprocessing.C                          |  4475 +++--
 src/mira/dataprocessing.H                          |   324 -
 src/mira/dynamic.C                                 |   750 +-
 src/mira/dynamic.H                                 |    76 +-
 src/mira/enums.H                                   |    22 +-
 src/mira/estassembly.C                             |    89 +-
 src/mira/gbf_parse.H                               |   138 -
 src/mira/gff_parse.C                               |   620 +-
 src/mira/gff_parse.H                               |    87 +-
 src/mira/gff_save.C                                |   304 -
 src/mira/gff_save.H                                |    79 -
 src/mira/hashstats.C                               |  2894 ---
 src/mira/hashstats.H                               |   616 -
 src/mira/hashstats_sdbg.C                          |   693 -
 src/mira/hdeque.H                                  |   666 -
 src/mira/indexed_deque.H                           |   541 +
 src/mira/maf_parse.C                               |  1578 +-
 src/mira/maf_parse.H                               |   210 +-
 src/mira/manifest.C                                |   590 -
 src/mira/manifest.H                                |    99 -
 src/mira/multitag.C                                |   408 +-
 src/mira/multitag.H                                |   207 +-
 src/mira/newpathfinder.C                           |  5018 +++++
 src/mira/newpathfinder.H                           |   405 +
 src/mira/overlapedges.H                            |   143 -
 src/mira/parameters.C                              |  4543 ++---
 src/mira/parameters.H                              |   486 +-
 src/mira/parameters_flexer.cc                      | 10877 ++++++-----
 src/mira/parameters_flexer.ll                      |   474 +-
 src/mira/parameters_tokens.h                       |   192 +-
 src/mira/pcrcontainer.C                            |   890 -
 src/mira/pcrcontainer.H                            |   435 -
 src/mira/ppathfinder.C                             |  2492 ---
 src/mira/ppathfinder.H                             |   472 -
 src/mira/preventinitfiasco.C                       |   372 -
 src/mira/read.C                                    |  4520 +++--
 src/mira/read.H                                    |   722 +-
 src/mira/readgrouplib.C                            |   824 -
 src/mira/readgrouplib.H                            |   475 -
 src/mira/readlotstat.C                             |    51 -
 src/mira/readlotstat.H                             |    64 -
 src/mira/readpool.C                                |  2421 ++-
 src/mira/readpool.H                                |   296 +-
 src/mira/readpool_io.C                             |  1005 -
 src/mira/readpool_io.H                             |   172 -
 src/mira/readseqtypes.H                            |    47 -
 src/mira/sam_collect.C                             |   542 -
 src/mira/sam_collect.H                             |   136 -
 src/mira/scaffolder.C                              |   183 +-
 src/mira/scaffolder.H                              |    77 +-
 src/mira/seqforfilter_phix174.solexa.xxd           |     2 -
 src/mira/seqtohash.C                               |    46 -
 src/mira/seqtohash.H                               |   102 -
 src/mira/simple_2Dsignalprocessing.H               |    96 -
 src/mira/simplebloomfilter.C                       |    85 -
 src/mira/simplebloomfilter.H                       |   221 -
 src/mira/skim.C                                    |  3558 ++--
 src/mira/skim.H                                    |   729 +-
 src/mira/skim_lowbph.C                             |   621 -
 src/mira/stringcontainer.H                         |   106 +-
 src/mira/structs.H                                 |   378 +-
 src/mira/timerestrict.H                            |    10 +-
 src/mira/types_basic.H                             |    10 -
 src/mira/vhash.H                                   |   133 -
 src/mira/vluint.H                                  |   388 -
 src/mira/warnings.C                                |   171 -
 src/mira/warnings.H                                |   117 -
 src/modules/Makefile.am                            |     5 -
 src/modules/misc.C                                 |   165 -
 src/modules/misc.H                                 |    52 -
 src/modules/mod_bait.C                             |   868 -
 src/modules/mod_bait.H                             |   145 -
 src/modules/mod_convert.C                          |  2130 ---
 src/modules/mod_convert.H                          |   154 -
 src/modules/mod_dbgreplay.C                        |    90 -
 src/modules/mod_diff.C                             |   305 -
 src/modules/mod_diff.H                             |    55 -
 src/modules/mod_memestim.C                         |   438 -
 src/modules/mod_memestim.H                         |    27 -
 src/modules/mod_mer.C                              |   524 -
 src/modules/mod_mer.H                              |    67 -
 src/modules/mod_mira.C                             |   480 -
 src/modules/mod_mira.H                             |    10 -
 src/modules/mod_scaffold.C                         |   101 -
 src/modules/mod_scaffold.H                         |    50 -
 src/modules/mod_sigconex.C                         |   253 -
 src/modules/mod_sigconex.H                         |    51 -
 src/modules/mod_tagsnp.C                           |   254 -
 src/modules/mod_tagsnp.H                           |    54 -
 src/progs/Makefile.am                              |   113 +-
 src/progs/Makefile.in                              |   215 +-
 src/progs/convert_project.C                        |  2518 +++
 src/progs/dbgreplay.C                              |   124 +
 src/progs/fastatool.C                              |   338 +
 src/progs/me_step1.par                             |    27 +
 src/progs/me_step2.par                             |   140 +
 src/progs/me_step3.par                             |   152 +
 src/progs/mira.C                                   |  1716 +-
 src/progs/miratest.C                               |   677 +-
 src/progs/par2c.pl                                 |     7 +
 src/progs/quirks.C                                 |    71 -
 src/progs/quirks.H                                 |    34 -
 src/progs/scftool.C                                |   510 +
 src/progs/sw.C                                     |   140 +
 src/progs/version.H                                |    30 +
 src/scripts/Makefile.am                            |     8 +-
 src/scripts/Makefile.in                            |    63 +-
 src/scripts/fasta2frag.tcl                         |   274 +-
 src/scripts/fastaselect.tcl                        |   125 +
 src/scripts/fastqselect.tcl                        |   170 +
 src/stdinc/Makefile.in                             |    55 +-
 src/stdinc/defines.H                               |    80 +-
 src/stdinc/stlincludes.H                           |    78 +-
 src/stdinc/template.C                              |    22 +-
 src/stdinc/template.H                              |    14 +-
 src/stdinc/types.H                                 |     6 +-
 src/support/GTAGDB                                 |    52 +-
 src/support/Makefile.in                            |    65 +-
 src/test/Makefile.am                               |     3 +
 {doc => src/test}/Makefile.in                      |    63 +-
 src/test/io/Makefile.am                            |     3 +
 {doc => src/test/io}/Makefile.in                   |    63 +-
 src/test/io/fasta/Makefile.am                      |    19 +
 src/{errorhandling => test/io/fasta}/Makefile.in   |   122 +-
 src/test/io/fasta/tstFASTA.C                       |   181 +
 src/test/io/generalio/Makefile.am                  |    18 +
 src/{modules => test/io/generalio}/Makefile.in     |   135 +-
 src/test/io/generalio/tstgeneralio.C               |    67 +
 src/test/io/scf/Makefile.am                        |    19 +
 src/{errorhandling => test/io/scf}/Makefile.in     |   122 +-
 src/test/io/scf/tstSCF.C                           |    30 +
 src/test/mira/Makefile.am                          |     4 +
 {doc => src/test/mira}/Makefile.in                 |    65 +-
 src/test/mira/align/Makefile.am                    |    20 +
 src/{errorhandling => test/mira/align}/Makefile.in |   122 +-
 src/test/mira/align/tstAlign.C                     |    72 +
 src/test/mira/read/Makefile.am                     |    10 +
 src/{errorhandling => test/mira/read}/Makefile.in  |   115 +-
 src/test/mira/read/tstRead.C                       |   117 +
 src/test/mira/readpool/Makefile.am                 |    10 +
 .../mira/readpool}/Makefile.in                     |   115 +-
 src/test/mira/readpool/tstReadPool.C               |   107 +
 src/util/Makefile.am                               |    10 +-
 src/util/Makefile.in                               |    88 +-
 src/util/boostiostrutil.H                          |    81 -
 src/util/dptools.C                                 |   236 +-
 src/util/dptools.H                                 |   111 +-
 src/util/fileanddisk.C                             |  1009 -
 src/util/fileanddisk.H                             |   200 -
 src/util/fmttext.C                                 |   115 -
 src/util/fmttext.H                                 |    49 -
 src/util/machineinfo.C                             |   218 -
 src/util/machineinfo.H                             |    70 -
 src/util/memusage.H                                |   126 +-
 src/util/misc.C                                    |   369 +-
 src/util/misc.H                                    |    70 +-
 src/util/progressindic.H                           |    64 +-
 src/util/stlimprove.H                              |    40 -
 src/util/timer.H                                   |   111 -
 src/version.H                                      |    18 -
 src/version.stub                                   |    15 -
 407 files changed, 91229 insertions(+), 139031 deletions(-)

diff --git a/.tarball-version b/.tarball-version
deleted file mode 100644
index d879185..0000000
--- a/.tarball-version
+++ /dev/null
@@ -1 +0,0 @@
-4.9.5_2
\ No newline at end of file
diff --git a/.version b/.version
deleted file mode 100644
index d879185..0000000
--- a/.version
+++ /dev/null
@@ -1 +0,0 @@
-4.9.5_2
\ No newline at end of file
diff --git a/GETTING_STARTED b/GETTING_STARTED
index e1c73d8..be6b0f2 100644
--- a/GETTING_STARTED
+++ b/GETTING_STARTED
@@ -2,9 +2,13 @@
 
 1. Build and install MIRA and documentation according to the INSTALL file (or
    grab a binary distribution)
-2. From the "Definitive Manual", read the chapter which takes care of the
-   sequencing technology you want to use.
-   Follow the walk-throughs given there as template for your own projects.
+2. Read the "MIRA USAGE" introduction. The html version can be found in the
+   doc/docs/html directory
+3. Read the main MIRA introduction
+4. For 454, Solexa, Ion Torrent assembly, read the corresponding chapters in
+   the documentation.
+5. Copy the minidemo directory to a temporary location (e.g. "cp -r minidemo
+   /tmp/miraminidemo") and play around with the demos provided there.
 
 For viewing/editing assemblies, an assembly editor is recommended. Have a look
 at GAP4 (from the Staden package, see
@@ -12,7 +16,8 @@ http://www.sourceforge.net/projects/staden/), MIRA generates output suited for
 import into gap4 (by using caf2gap)
 
 James Bonfield released a working version of gap5. Import into gap5 is done
-with SAM or CAF files and the "tg_index" tool supplied in the gap5 package.
+with CAF files and the "tg_index" tool supplied in the gap5 package.
 
+ 
 Other people use consed, but I don't know whether it's able to cope with the
 amount of data present in Solexa projects.
diff --git a/HELP_WANTED b/HELP_WANTED
index d5b4682..b541646 100644
--- a/HELP_WANTED
+++ b/HELP_WANTED
@@ -21,14 +21,14 @@ Programming
 - testing compilation and running of MIRA on presently untested platforms
   (see INSTALL for a list of platforms).
 - some helper scripts to automatically download, quickly reformat and then
-  assemble data from the NCBI SRA & trace archive or the ENSEMBL trace server
-  would be nice (perl or  Tcl preferred)
+  assemble data from the NCBI trace archive or the ENSEMBL trace server would
+  be nice (perl or  Tcl preferred)
+- multithreading: the Smith-Waterman alignments could be calculated in
+  parallel (not trivial, but should not be really hard either). Furthermore,
+  the task of building contigs could be distributed on 2 threads or even 2
+  threads per independent contig (harder to realise). I did not find the time
+  to build this in yet.
 - and of course: feedback in any form, be it ideas, bug reports, success
   stories (or failures) etc.
 
 
-Resources:
-==========
-My trusted i940 system at home has 24 GiB RAM which sometimes is a bit
-... small. Anyone who wants to sponsor an Intel Core i7-3960X system with 64
-GiB RAM? Just kidding, I don't really need it atm ;-)
diff --git a/INSTALL b/INSTALL
index 19b8f6d..191c57c 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,5 +1,705 @@
-Information regarding building MIRA is in the "Definitive Guide to MIRA",
-chapter "Installation"
 
-  http://mira-assembler.sourceforge.net/docs/DefinitiveGuideToMIRA.html#chap_installation
+If you have any question, suggestion or bug report regarding compilation of
+the MIRA package, please subscribe to the MIRA talk mailing list (see
+http://www.chevreux.org/mira_mailinglists.html) and send your question to:
+mira_talk at freelists.org
+
+Contents:
+
+I    Prerequisites in short:
+II   Prerequisites for compiling
+III  Compiling & installing
+IV   Building documentation
+V    Example: how to compile on (K)Ubuntu 9.04 / 9.10
+VI   Example: how to compile on NetBSD 5 (i386)
+VII  Example: how to compile on Mac OSX 10.6 (Snow Leopard)
+VIII Basic Installation (from the generic GNU autoconf documentation)
+
+
+IMPORTANT NOTICE for compiling on non Linux systems
+===================================================
+
+Your FEEDBACK is needed!
+
+MIRA started as project in 1997 using an SGI machine (Origin 2000 if memory
+serves well) and the SGI C++ compiler. I regularly built and tested the
+package using GCC (2.95.x at that time) also on SunOS and Linux in those
+days. Infrequent compilation runs on HP-UX and DEC alpha were also successful.
+
+However, between 2000 and 2006, I've had no other system than GCC with
+different Linux kernels on x86 and x86-64 CPUs (and occasionally an older SUN
+Solaris system). I fear that the first compilation attempts now will uncover a
+number of problems, although I expect/hope that these should be quickly and
+easily fixed.
+
+Tested configurations for compiling and running MIRA3 as of May 2010 ([ok]
+means a working binary has been reported):
+
+
+Working out-of-the-box (once needed libraries and programs are installed):
+--------------------------------------------------------------------------
+[ok] Linux: (K)Ubuntu 8.04, 8.10, 9.04 and 10.04 with x86, x86_64 and Atom
+[ok] Linux: OpenSUSE 10.x, 11.1 with x86 and x86_64
+[ok} Linux: Debian 4.0r0, Itanium ia64
+[ok] Linux: Debian lenny with x86_64.
+[ok] Linux: Fedora Redhat 12 with x86
+[ok] MacOS X 10.6.1 and 10.5.8
+
+
+Some care needed:
+-----------------
+[ok] Linux: OpenSUSE 11.0 on x86_64: you might need
+     --with-boost-libdir=/usr/lib64
+[ok] OpenSolaris: must have built BOOST with the GNU toolchain, must give
+     ./configure the "--enable-64" flag
+[ok] Netbsd 5 (i386). See "Example: how to compile on NetBSD 5 (i386)"
+[ok] CentOS: you might need to configure like this:
+     LDFLAGS="$LDFLAGS -L/usr/lib64" LIBS="-lexpat" ./configure
+
+
+Untested, but should be working at least with GNU GCC and GNU make:
+-------------------------------------------------------------------
+[??] Solaris 10 (sparc) (it worked for versions without boost) 
+[??] Solaris 9 (sparc) (it worked for versions without boost)
+[??] HP-UX (it worked in 2000, but not tested lately)
+[??] SGI (last compiled in 2000 on Origin 2000)
+[??] DEC alpha (MIRA last compiled on these in 2000)
+[??] FreeBSD 6.2 (i386)
+     This used to work prior to inclusion of BOOST libraries. Must be
+     re-tested.
+     The "make" utility of FreeBSD doesn't like some rules used. Please use
+     the GNU make. 
+     If you can, please submit a rule patch so that both FreeBSD make and GNU
+     work.
+
+
+Unknown:
+--------
+[??] Linux for PPC processors
+
+
+Known to fail:
+[nok] HP-UX (B.11.31, ia64) with aCC
+      Does not build with aCC and STL delivered with aCC (lacks hash_map and
+      slist). This could perhaps work with an installed version of
+      the STL-Port project, untested.
+
+
+I would be glad to hear back on successes (or failures) on other systems,
+patches in case of failure are even more welcome :-)
+
+
+-------------------------------------------------------------------------------
+
+I) Prerequisites in short:
+==========================
+
+Compiling MIRA: 
+- GCC 4.1.2, but higher version is recommended
+  libstc++6 Or whichever version is current for your system. This should be
+    installed on many system by default, on others installing gcc will
+    automatically trigger the installation of that lib. If not, you have to
+    install it by hand.
+- BOOST library >= 1.35 (lower versions might work, but untested. You would
+    need to change the checking in the configure script for this to run
+    through)
+    DO NOT use a staged library, only a fully installed library will work at
+    the moment
+- zlib library
+- GNU make, 
+- GNU flex >=2.5.33, 
+- perl,
+- Expat library
+- recommended: the TCmalloc library from the Google perftools, version 1.5 or
+  higher (lower might work, but untested)
+
+Compiling MIRA from CVS checkout: as above + GNU autoconf / automake
+Building documentation: DocBook (for HTML: xsltproc + docbook-xsl;
+                                 additionally for PDF: dblatex)
+
+Please read on to see what is used where, there are examples for specific
+systems at the end of this file.
+
+-------------------------------------------------------------------------------
+
+II) Prerequisites for compiling
+===============================
+
+These prerequisites are for compiling only, not for running a compiled program
+version.
+
+1) MIRA uses the excellent Expat library to parse XML files. Should your
+   system not have the Expat library and header files already installed, you
+   will need to download and install a version. Please see
+   http://www.libexpat.org/ and http://sourceforge.net/projects/expat/ for
+   information on how to do this.
+
+2) MIRA needs the GNU 'flex' lexical analyser. Version 2.5.33 (or later) is
+   needed. Please see
+   http://flex.sourceforge.net/ for more information regarding flex.
+
+3) Any GNU C/C++ compiler >= 4.1.2 should work fine. Please note that the GNU
+   2.x and 3.x C/C++ compiler do NOT work for MIRA anymore. Please refer to
+   http://gcc.gnu.org/ for more information on the GNU compiler collection.
+
+4) Since version 2.9.28x6, MIRA uses functions of the BOOST C++ library (at
+   the time of this writing the thread and bind libraries). Currently, only
+   version 1.36 and above have been tested, Versions >= 1.35 should work,
+   versions below ... unsure, must be tested (adapt the version check in the
+   configure.in file if you want to test).  You MUST have a fully installed
+   version (but that can live anywhere in your file system, even your HOME),
+   staged libraries confuse the configure program and apparently won't be
+   recognised correctly.  
+   It's probable that the library must be compiled with the gcc toolchain
+   option, this has been at least reported to be the case for Solaris where a
+   BOOST compiled with CC did not link.
+
+5) A working perl needs to be in your path for compiling.
+   REMARK: it's needed in the src/progs directory to transform 
+   text files into something which is directly includable by a C/C++
+   compiler. Perhaps this could be solved differently?
+
+6) When working from a CVS checkout, you need to have the GNU autoconf and
+   automake on your system. Type "sh ./runme-first" in the top-level of the
+   directory tree (where this file is located), then you can go on with the
+   normal "./configure" routine (see below).
+
+7) It is totally, absolutely, most highly recommended to have MIRA linked to
+   the tcmalloc_minimal library. MIRA will also work without, but memory
+   requirements may then be a *lot* higher (40% and more).
+
+   Installing is easy. Get the current version (1.5 or higher) from 
+     http://code.google.com/p/google-perftools/downloads/list
+   and put it into a temporary directory.
+
+   Unpack it, perform a basic configure of the minimal package, and install
+   that normally with this:
+
+     tar xvzf google-perftools-1.5.tar.gz
+     cd google-perftools-1.5
+     ./configure --enable-minimal
+     make
+     make install
+
+   The last command needs root rights. Use 'sudo' ("sudo make install") or ask
+   a system administrator to do that. You can also install the library
+   somewhere else, but then the MIRA configure will need to know the location
+   (see below).
+
+
+-------------------------------------------------------------------------------
+
+III) Compiling & installing
+===========================
+
+MIRA uses the GNU autoconf/automake tools, please read the section "Basic
+Installation" for more generic information on how to invoke them.
+
+The short version: simply type "./configure"; then "make"; then "make
+install". This should install the following programs: 
+- mira 
+- convert_project
+- fastatool  
+- scftool 
+- uncover_at
+
+Should the "./configure" step fail for some reason or another, you should get
+a message telling you at which step this happens and be able to install
+missing packages.
+
+Although this should not be needed if you are compiling from a source
+distribution, you can rebuild the configure script for your system when having
+GNU autoconf and automake tools installed. Just run "sh runme.first" script
+(may take a while) in the top directory and you should be good to go.
+
+
+Configure switches for MIRA:
+----------------------------
+
+MIRA understands all standard autoconf configure switches like --prefix=
+etc. Please consult the chapter "Basic installation" further below, which is
+taken from configure manual.
+
+
+BOOST configure switches for MIRA:
+----------------------------------
+
+If a simple "./configure" and then "make" fails at the linker stage, you might
+need to perform the "./configure" with additional flags telling it where the
+version of BOOST that you want to use is installed. Those flags would be
+"--with-boost[=DIR]", "--with-boost-libdir=LIB_DIR" or
+"--with-boost-thread[=special-lib]". On how to use these flags, please consult
+the help given by "./configure --help" or the documentation of BOOST
+(http://www.boost.org).
+
+
+TCmalloc configure switches for MIRA:
+-------------------------------------
+
+If you installed ther perftools library in standard locations you won't need
+any special switches, the MIRA-configure will link to it automatically. If you
+installed these libraries at a special location (I do not recommend that), you
+can use
+
+--with-tcmalloc-dir=LIB_DIR
+
+where LIB_DIR is the directory where libtcmalloc.a resides
+
+You can switch off linking MIRA with TCmalloc completely with
+
+--with-tcmalloc=no
+
+but I *strongly* recommend not to do this. MIRA will work, though memory
+requirements will then be much higher (40% and more)
+
+
+EMBOSS configure switches when compiling MIRA:
+----------------------------------------------
+
+MIRA honours the following EMBOSS switches (all others will simply have no
+effect)
+
+--enable-64=yes/no
+
+  MIRA should happily build as 32 bit executable on 32 bit platforms and as 64
+  bit executable on 64 bit platforms. On 64 bit platforms, setting the switch
+  to 'no' forces the compiler to produce 32 bit executables (if possible)
+
+
+--enable-warnings
+
+  Enables compiler warnings, however a lot more switches are used for GCC
+  compared to the EMBOSS defaults.
+
+
+--enable-debug
+--enable-purify
+
+  Both these switches keep the same meaning as for EMBOSS.
+
+
+
+Special configure switches for MIRA:
+------------------------------------
+
+There are currently a number of switches to configure that are specific to
+MIRA:
+
+--enable-mirastatic
+
+  Builds static binaries which are easier to distribute. Some platforms (like
+  OpenSolaris) might not like this, you get an error from the linker.
+
+
+--enable-optimisations
+
+  Instructs the configure script to set optimisation switches for compiling
+  (on by default). Switching optimisations off (warning, high impact on
+  run-time) might be interesting only for, e.g, debugging with valgrind.
+
+
+--enable-publicquietmira=yes/no to have mira assemble quietly; default=yes
+
+  Some parts of MIRA can dump additional debug information during assembly,
+  setting this switch to "no" performs this. Warning: MIRA will be a bit
+  chatty, using this is not recommended for public usage.
+ 
+
+--enable-developmentversion
+
+  Using MIRA with enabled development mode may lead to extra output on stdout
+  as well as some additional data in the results which should not appear in
+  real world data
+
+
+--enable-boundtracking
+--enable-bugtracking
+
+  Both flags above compile in some basic checks into mira that look for sanity
+  within some functions: Leaving this on "yes" (default) is encouraged, impact
+  on run time is minimal
+
+
+--enable-extendedbugtracking
+
+  When set to "yes", this compiles in extra checks into mira that look for
+  sanity within some functions. Contrary to the other checks above, this
+  extended bugtracking *is* costly and impacts runtime noticeably, use only
+  for bughunting on core dumps or similar. Note that I haven't had MIRA core
+  dumping on me in the last 4 years or so ... it really isn't needed in normal
+  production environments.
+
+
+--enable-functrace
+
+  When enabled, traces every function call and function exit on stdout during
+  assembly. Setting function trace to "yes" is *highly* discouraged except for
+  toy projects, you'll quickly get gigabytes of output.
+
+
+
+Issues when doing "make install"
+--------------------------------
+
+- docs are currently not build as I doubt many people have LaTeX2man as
+  tool. I need to find out how to remediate this problem by distributing
+  pre-made help files.
+- I've had a report that on some platforms, a "chmod +x install-sh "prior to
+  make install is needed. To be checked.
+
+
+
+-------------------------------------------------------------------------------
+
+IV) Building documentation
+==========================
+
+DocBook
+
+For building HTML, install:
+
+  sudo apt-get install xsltproc docbook-xsl
+
+For building PDF, install
+
+  sudo apt-get install dblatex
+
+
+-------------------------------------------------------------------------------
+
+Building a precompiled binary distribution package
+==================================================
+
+A package containing precompiled binaries, documentation and some demo
+projects can be built with "make distrib". When built from the top-level
+directory, binaries are compiled (if needed) and documentation is built (also
+if needed) before packaging.
+
+The resulting package can be found in the "distribution" directory.
+
+-------------------------------------------------------------------------------
+
+Building a source package distribution package
+==============================================
+
+To build a slimmed down, self-contained source package (in .tar.gz and
+.tar.bz2 format) that leaves out CVS files/directories as well as a number of
+test files and directories, use the standard automake 'make dist' command from
+the top-level directory.
+
+
+-------------------------------------------------------------------------------
+
+V) Example: how to compile on (K)Ubuntu 9.04 / 9.10
+===================================================
+
+Before compiling, make sure you have everything you need to compile MIRA. The
+following commands will install the needed packages (BOOST, expat and flex)
+for you if they're not yet installed.
+
+For (K)Ubuntu 9.04:
+-------------------
+Install the Google perftools library like explained in section III
+
+Then:
+  sudo apt-get install libboost-doc libboost.*1.37-dev libboost.*1.37.0
+  sudo apt-get install libexpat1-dev flex zlib1g-dev
+
+For (K)Ubuntu 9.10:
+-------------------
+Like 9.04. Just change:
+  sudo apt-get install libboost-doc libboost.*1.37-dev libboost.*1.37.0
+to:
+  sudo apt-get install libboost-doc libboost.*1.38-dev libboost.*1.38.0
+The three remaining sudo lines should be typed without change.
+
+
+Now, this example assumes you donwloaded the source package
+"mira-3.0.6.tar.bz2" (you might have another version, but that's ok), then the
+following steps that are guaranteed to give you a binary (32 bit on 32 bit
+systems, 64 bit on 64 bit systems):
+
+  tar xvjf mira-3.0.6.tar.bz2
+  cd mira-3.0.6
+  ./configure
+  make
+
+The binaries will then be in src/progs. If you want to install them system
+wide, simply type:
+
+  sudo make install
+
+That's all.
+
+
+For CVS checkouts:
+------------------
+In case you are running a CVS checkout, you will need to install a few
+packages in addition to BOOST, expat and flex (see above) to be able to run
+the "runme.first" script:
+
+  sudo apt-get install automake libtool xutils-dev
+
+Now, go into the CVS checkout directory and run the "runme.first" script
+
+  sh runme.first
+
+Then
+
+  ./configure
+  make
+
+That's it.
+
+
+
+
+VI) Example: how to compile on NetBSD 5 (i386)
+==============================================
+
+Install the Google perftools library like explained in section III. Then:
+
+Contributed by Thomas Vaughan
+
+The system flex (/usr/bin/flex) is too old, but the devel/flex package from a
+recent pkgsrc works fine.  BSD make doesn't like one of the lines in
+src/progs/Makefile, so use GNU make instead (available from pkgsrc as
+devel/gmake).  Other relevant pkgsrc packages: devel/boost-libs,
+devel/boost-headers, textproc/expat and lang/perl.  The configure script has
+to be told about these pkgsrc prerequisites (they are usually rooted at
+/usr/pkg but other locations are possible):
+
+  FLEX=/usr/pkg/bin/flex ./configure --with-expat=/usr/pkg --with-boost=/usr/pkg
+
+If attempting to build a pkgsrc package of MIRA, note that the LDFLAGS passed
+by the pkgsrc mk files don't remove the need for the --with-boost option.  The
+configure script complains about flex being too old, but this is harmless
+because it honours the $FLEX variable when writing out makefiles.
+
+
+
+VII) Example: how to compile on Mac OSX 10.6 (Snow Leopard)
+===========================================================
+
+This has been tested on OSX 10.6.4. You will need XCode (from Apple) and some
+packages from MacPorts. Note that I used XCode 3.2.5 and MacPorts 1.9.2
+(downloading BOOST 1.45). Lower versions of all of the above *might* work, but
+not necessarily so.
+
+1. Download and install a current XCode
+   
+2. Install BOOST from MacPorts
+   a) if you haven't already done so, install MacPorts
+      Basically, just a couple of easy steps, see
+        http://www.macports.org/install.php
+   b) Install BOOST: in a terminal, type
+        sudo port install boost
+
+      Note 1: for universal builds (e.g. for distributing MIRA with universal
+      binaries) rather do
+        sudo port install boost +universal
+
+      Note 2: this *will* take a while! It took ~1 hour on my MacAir with a 1.86
+      GHz processor, even without universal. MacPros and server will be
+      somehwat faster I suppose.
+
+3. Download the MIRA source package and unpack it
+
+4. ./configure
+   make
+
+5. Done :-)
+
+
+
+
+VIII) Basic Installation
+========================
+
+-------------------------------------------------------------------------------
+The following is taken straight out of the GNU configure documentation
+-------------------------------------------------------------------------------
+
+Basic Installation
+==================
+
+   These are generic installation instructions.
+
+   The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation.  It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions.  Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, a file
+`config.cache' that saves the results of its tests to speed up
+reconfiguring, and a file `config.log' containing compiler output
+(useful mainly for debugging `configure').
+
+   If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release.  If at some point `config.cache'
+contains results you don't want to keep, you may remove or edit it.
+
+   The file `configure.in' is used to create `configure' by a program
+called `autoconf'.  You only need `configure.in' if you want to change
+it or regenerate `configure' using a newer version of `autoconf'.
+
+The simplest way to compile this package is:
+
+  1. `cd' to the directory containing the package's source code and type
+     `./configure' to configure the package for your system.  If you're
+     using `csh' on an old version of System V, you might need to type
+     `sh ./configure' instead to prevent `csh' from trying to execute
+     `configure' itself.
+
+     Running `configure' takes awhile.  While running, it prints some
+     messages telling which features it is checking for.
+
+  2. Type `make' to compile the package.
+
+  3. Optionally, type `make check' to run any self-tests that come with
+     the package.
+
+  4. Type `make install' to install the programs and any data files and
+     documentation.
+
+  5. You can remove the program binaries and object files from the
+     source code directory by typing `make clean'.  To also remove the
+     files that `configure' created (so you can compile the package for
+     a different kind of computer), type `make distclean'.  There is
+     also a `make maintainer-clean' target, but that is intended mainly
+     for the package's developers.  If you use it, you may have to get
+     all sorts of other programs in order to regenerate files that came
+     with the distribution.
+
+Compilers and Options
+=====================
+
+   Some systems require unusual options for compilation or linking that
+the `configure' script does not know about.  You can give `configure'
+initial values for variables by setting them in the environment.  Using
+a Bourne-compatible shell, you can do that on the command line like
+this:
+     CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
+
+Or on systems that have the `env' program, you can do it like this:
+     env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
+
+Compiling For Multiple Architectures
+====================================
+
+   You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory.  To do this, you must use a version of `make' that
+supports the `VPATH' variable, such as GNU `make'.  `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script.  `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+   If you have to use a `make' that does not supports the `VPATH'
+variable, you have to compile the package for one architecture at a time
+in the source code directory.  After you have installed the package for
+one architecture, use `make distclean' before reconfiguring for another
+architecture.
+
+Installation Names
+==================
+
+   By default, `make install' will install the package's files in
+`/usr/local/bin', `/usr/local/man', etc.  You can specify an
+installation prefix other than `/usr/local' by giving `configure' the
+option `--prefix=PATH'.
+
+   You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files.  If you
+give `configure' the option `--exec-prefix=PATH', the package will use
+PATH as the prefix for installing programs and libraries.
+Documentation and other data files will still use the regular prefix.
+
+   In addition, if you use an unusual directory layout you can give
+options like `--bindir=PATH' to specify different values for particular
+kinds of files.  Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+   If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+   Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System).  The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+   For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+   There may be some features `configure' can not figure out
+automatically, but needs to determine by the type of host the package
+will run on.  Usually `configure' can figure that out, but if it prints
+a message saying it can not guess the host type, give it the
+`--host=TYPE' option.  TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name with three fields:
+     CPU-COMPANY-SYSTEM
+
+See the file `config.sub' for the possible values of each field.  If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the host type.
+
+   If you are building compiler tools for cross-compiling, you can also
+use the `--target=TYPE' option to select the type of system they will
+produce code for and the `--build=TYPE' option to select the type of
+system on which you are compiling the package.
+
+Sharing Defaults
+================
+
+   If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists.  Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Operation Controls
+==================
+
+   `configure' recognizes the following options to control how it
+operates.
+
+`--cache-file=FILE'
+     Use and save the results of the tests in FILE instead of
+     `./config.cache'.  Set FILE to `/dev/null' to disable caching, for
+     debugging `configure'.
+
+`--help'
+     Print a summary of the options to `configure', and exit.
+
+`--quiet'
+`--silent'
+`-q'
+     Do not print messages saying which checks are being made.  To
+     suppress all normal output, redirect it to `/dev/null' (any error
+     messages will still be shown).
+
+`--srcdir=DIR'
+     Look for the package's source code in directory DIR.  Usually
+     `configure' can determine that directory automatically.
+
+`--version'
+     Print the version of Autoconf used to generate the `configure'
+     script, and exit.
+
+`configure' also accepts some other, not widely useful, options.
 
diff --git a/Makefile.am b/Makefile.am
index 7a4be1b..32f871d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,14 +1,8 @@
-ACLOCAL_AMFLAGS = -I m4
-
-BUILT_SOURCES = $(top_srcdir)/.version
-$(top_srcdir)/.version:
-	echo $(VERSION) > $@-t && mv $@-t $@
-
-
 AM_CXXFLAGS = $(BOOST_CPPFLAGS)
 
 SUBDIRS = src
-EXTRA_DIST = GETTING_STARTED HELP_WANTED THANKS build-aux
+EXTRA_DIST = GETTING_STARTED HELP_WANTED THANKS
+
 
 
 binaries: src
@@ -24,43 +18,24 @@ distribin: binaries
 	make -C distribution distribin
 
 bclean:
-	-find . -name "*~" -exec rm -rf {} \;
-	-find . -name ".pure" -exec rm -rf {} \;
-	-find . -name "*.o" -exec rm {} \;
-	-find . -name "*.a" -exec rm {} \;
-	-find . -name "bla_*" -exec rm {} \;
-	-find . -name "bin.*" -exec rm {} \;
-	-find . -name "log.*" -exec rm {} \;
-	-find . -name "*.bak" -exec rm {} \;
-	-find . -name "ttt*" -exec rm {} \;
-	-find . -name "TTT*" -exec rm {} \;
-	-find . -name "core" -exec rm {} \;
-	-find . -name "*.flex.C" -exec rm {} \;
-	-find . -name "*flexer.cc" -exec rm {} \;
-
-distclean-local: bclean
-	-find . -name ".deps" -exec rm -rf {} \;
-	-rm -rf OSXstatlibs OSXstatlibs_bach
-	-rm -rf m4
-	-rm -rf Makefile Makefile.in aclocal.m4 config.status config.h config.h.in config.log configure autom4te.cache config.guess config.sub missing libtool
-	-rm -rf config
-
-clean-local: bclean
-	make -C distribution clean
-	make -C doc clean
-	-rm -rf OSXstatlibs OSXstatlibs_bach
+	find . -name "*~" -exec rm -rf {} \;
+	find . -name ".deps" -exec rm -rf {} \;
+	find . -name ".pure" -exec rm -rf {} \;
+	find . -name "*.o" -exec rm {} \;
+	find . -name "*.a" -exec rm {} \;
+	find . -name "bla_*" -exec rm {} \;
+	find . -name "bin.*" -exec rm {} \;
+	find . -name "log.*" -exec rm {} \;
+	find . -name "*.bak" -exec rm {} \;
+	find . -name "*.out" -exec rm {} \;
+	find . -name "ttt*" -exec rm {} \;
+	find . -name "TTT*" -exec rm {} \;
+	find . -name "core" -exec rm {} \;
+	find . -name "*.flex.C" -exec rm {} \;
 
 cvsclean: bclean
 	find . -name "CVS" -exec rm -rf {} \;
 
-statlibs:
-	-rm -rf OSXstatlibs_bach
-	mkdir OSXstatlibs_bach
-	(cd OSXstatlibs_bach; ln -s /opt/biosw/lib/*a .; cd ..)
-	(cd OSXstatlibs_bach; ln -s /opt/local/lib/gcc49/*a .; cd ..)
-	(cd OSXstatlibs_bach; ln -s /opt/local/lib/libbz2.a .; ln -s /opt/local/lib/libexpat.a .; cd ..)
-
-
 #       -find . -path './arch' -prune -o -perm -a+x -type f -exec rm {} \;
 #	 -rm -rf .deps *.bak *.out *.o *.d *.flex.C core ttt* log.* tca.*
 #	 -rm -rf main main2
@@ -75,17 +50,15 @@ statlibs:
 # DON'T do that in an one-liner (at least it breaks for me)
 
 dist-hook:
-	$(ECHO_N) `build-aux/git-version-gen isshort doesnotexist` > $(distdir)/.tarball-version
-	cp $(distdir)/.tarball-version $(distdir)/.version
 	( cd doc/docbook; make clean; cd ../.. )
 	tar cBf - doc | ( cd $(distdir); tar xBf - )
 	rm -rf $(distdir)/doc/docbook/db_guides
 	rm -rf $(distdir)/doc/docbook/util
 	rm -rf $(distdir)/doc/other
-	( cd doc/docbook; make versionfile; cd ../.. )
-	xsltproc --xinclude --output $(distdir)/README_build.html $(top_srcdir)/doc/docbook/mira.xsl $(top_srcdir)/doc/docbook/chap_installation_part.xml
-	cp -r $(top_srcdir)/doc/docbook/doccss $(distdir)
 	tar cBf - minidemo | ( cd $(distdir); tar xBf - )
 	( cd distribution; make clean; cd .. )
 	tar cBf - distribution | ( cd $(distdir); tar xBf - )
 	find $(distdir) -name ".git*" -exec rm -rf {} \;
+
+
+
diff --git a/Makefile.in b/Makefile.in
index f473227..995ed26 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -39,14 +39,22 @@ DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
 	ChangeLog INSTALL NEWS THANKS config.guess config.sub depcomp \
 	install-sh ltmain.sh missing mkinstalldirs ylwrap
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/ax_boost_base.m4 \
-	$(top_srcdir)/m4/ax_boost_filesystem.m4 \
-	$(top_srcdir)/m4/ax_boost_iostreams.m4 \
-	$(top_srcdir)/m4/ax_boost_regex.m4 \
-	$(top_srcdir)/m4/ax_boost_system.m4 \
-	$(top_srcdir)/m4/ax_boost_thread.m4 \
-	$(top_srcdir)/m4/ax_check_zlib.m4 \
-	$(top_srcdir)/m4/ax_lib_expat.m4 $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/config/m4/ax_boost_base.m4 \
+	$(top_srcdir)/config/m4/ax_boost_regex.m4 \
+	$(top_srcdir)/config/m4/ax_boost_thread.m4 \
+	$(top_srcdir)/config/m4/ax_check_zlib.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_std.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_stl.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_namespaces.m4 \
+	$(top_srcdir)/config/m4/ax_lib_expat.m4 \
+	$(top_srcdir)/config/m4/ax_with_perl.m4 \
+	$(top_srcdir)/config/m4/ax_with_prog.m4 \
+	$(top_srcdir)/config/m4/libtool.m4 \
+	$(top_srcdir)/config/m4/ltoptions.m4 \
+	$(top_srcdir)/config/m4/ltsugar.m4 \
+	$(top_srcdir)/config/m4/ltversion.m4 \
+	$(top_srcdir)/config/m4/lt~obsolete.m4 \
+	$(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
@@ -75,11 +83,9 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 distdir = $(PACKAGE)-$(VERSION)
 top_distdir = $(distdir)
 am__remove_distdir = \
-  if test -d "$(distdir)"; then \
-    find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
-      && rm -rf "$(distdir)" \
-      || { sleep 5 && rm -rf "$(distdir)"; }; \
-  else :; fi
+  { test ! -d "$(distdir)" \
+    || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
+         && rm -fr "$(distdir)"; }; }
 am__relativize = \
   dir0=`pwd`; \
   sed_first='s,^\([^/]*\)/.*$$,\1,'; \
@@ -108,8 +114,6 @@ am__relativize = \
 DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2
 GZIP_ENV = --best
 distuninstallcheck_listfiles = find . -type f -print
-am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
-  | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
 distcleancheck_listfiles = find . -type f -print
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
@@ -121,13 +125,9 @@ AWK = @AWK@
 BITPACKAGE = @BITPACKAGE@
 BLOODYDARWINSTATLIBDIRHACK = @BLOODYDARWINSTATLIBDIRHACK@
 BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
-BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@
-BOOST_IOSTREAMS_LIB = @BOOST_IOSTREAMS_LIB@
 BOOST_LDFLAGS = @BOOST_LDFLAGS@
 BOOST_REGEX_LIB = @BOOST_REGEX_LIB@
-BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@
 BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
-BUNDLETARGET = @BUNDLETARGET@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
@@ -140,7 +140,6 @@ CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -150,13 +149,11 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LDFLAGS = @EXPAT_LDFLAGS@
-EXPAT_LIBS = @EXPAT_LIBS@
 EXPAT_VERSION = @EXPAT_VERSION@
 FGREP = @FGREP@
 FLEX = @FLEX@
 FLEXPP = @FLEXPP@
 GREP = @GREP@
-HAVE_XXD = @HAVE_XXD@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -174,7 +171,6 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
 MIRASTATIC = @MIRASTATIC@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
@@ -191,17 +187,18 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
+SHORTMIRAAUDIENCE = @SHORTMIRAAUDIENCE@
 STRIP = @STRIP@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -235,6 +232,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -250,16 +248,13 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-ACLOCAL_AMFLAGS = -I m4
-BUILT_SOURCES = $(top_srcdir)/.version
 AM_CXXFLAGS = $(BOOST_CPPFLAGS)
 SUBDIRS = src
-EXTRA_DIST = GETTING_STARTED HELP_WANTED THANKS build-aux
-all: $(BUILT_SOURCES)
-	$(MAKE) $(AM_MAKEFLAGS) all-recursive
+EXTRA_DIST = GETTING_STARTED HELP_WANTED THANKS
+all: all-recursive
 
 .SUFFIXES:
-am--refresh: Makefile
+am--refresh:
 	@:
 $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	@for dep in $?; do \
@@ -512,11 +507,7 @@ dist-gzip: distdir
 	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
 	$(am__remove_distdir)
 dist-bzip2: distdir
-	tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
-	$(am__remove_distdir)
-
-dist-lzip: distdir
-	tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
+	tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
 	$(am__remove_distdir)
 
 dist-lzma: distdir
@@ -524,7 +515,7 @@ dist-lzma: distdir
 	$(am__remove_distdir)
 
 dist-xz: distdir
-	tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
+	tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz
 	$(am__remove_distdir)
 
 dist-tarZ: distdir
@@ -542,7 +533,7 @@ dist-zip: distdir
 
 dist dist-all: distdir
 	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
-	tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
+	tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
 	$(am__remove_distdir)
 
 # This target untars the dist file and tries a VPATH configuration.  Then
@@ -556,8 +547,6 @@ distcheck: dist
 	  bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
 	*.tar.lzma*) \
 	  lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
-	*.tar.lz*) \
-	  lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
 	*.tar.xz*) \
 	  xz -dc $(distdir).tar.xz | $(am__untar) ;;\
 	*.tar.Z*) \
@@ -577,7 +566,6 @@ distcheck: dist
 	  && am__cwd=`pwd` \
 	  && $(am__cd) $(distdir)/_build \
 	  && ../configure --srcdir=.. --prefix="$$dc_install_base" \
-	    $(AM_DISTCHECK_CONFIGURE_FLAGS) \
 	    $(DISTCHECK_CONFIGURE_FLAGS) \
 	  && $(MAKE) $(AM_MAKEFLAGS) \
 	  && $(MAKE) $(AM_MAKEFLAGS) dvi \
@@ -606,16 +594,8 @@ distcheck: dist
 	  list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
 	  sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
 distuninstallcheck:
-	@test -n '$(distuninstallcheck_dir)' || { \
-	  echo 'ERROR: trying to run $@ with an empty' \
-	       '$$(distuninstallcheck_dir)' >&2; \
-	  exit 1; \
-	}; \
-	$(am__cd) '$(distuninstallcheck_dir)' || { \
-	  echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
-	  exit 1; \
-	}; \
-	test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
+	@$(am__cd) '$(distuninstallcheck_dir)' \
+	&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
 	   || { echo "ERROR: files left after uninstall:" ; \
 	        if test -n "$(DESTDIR)"; then \
 	          echo "  (check DESTDIR support)"; \
@@ -632,13 +612,11 @@ distcleancheck: distclean
 	       $(distcleancheck_listfiles) ; \
 	       exit 1; } >&2
 check-am: all-am
-check: $(BUILT_SOURCES)
-	$(MAKE) $(AM_MAKEFLAGS) check-recursive
+check: check-recursive
 all-am: Makefile
 installdirs: installdirs-recursive
 installdirs-am:
-install: $(BUILT_SOURCES)
-	$(MAKE) $(AM_MAKEFLAGS) install-recursive
+install: install-recursive
 install-exec: install-exec-recursive
 install-data: install-data-recursive
 uninstall: uninstall-recursive
@@ -648,15 +626,10 @@ install-am: all-am
 
 installcheck: installcheck-recursive
 install-strip:
-	if test -z '$(STRIP)'; then \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	      install; \
-	else \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-	fi
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
 mostlyclean-generic:
 
 clean-generic:
@@ -668,16 +641,15 @@ distclean-generic:
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
 	@echo "it deletes files that may require special tools to rebuild."
-	-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
 clean: clean-recursive
 
-clean-am: clean-generic clean-libtool clean-local mostlyclean-am
+clean-am: clean-generic clean-libtool mostlyclean-am
 
 distclean: distclean-recursive
 	-rm -f $(am__CONFIG_DISTCLEAN_FILES)
 	-rm -f Makefile
 distclean-am: clean-am distclean-generic distclean-libtool \
-	distclean-local distclean-tags
+	distclean-tags
 
 dvi: dvi-recursive
 
@@ -739,29 +711,25 @@ ps-am:
 
 uninstall-am:
 
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all check \
-	ctags-recursive install install-am install-strip \
-	tags-recursive
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
+	install-am install-strip tags-recursive
 
 .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
 	all all-am am--refresh check check-am clean clean-generic \
-	clean-libtool clean-local ctags ctags-recursive dist dist-all \
-	dist-bzip2 dist-gzip dist-hook dist-lzip dist-lzma dist-shar \
-	dist-tarZ dist-xz dist-zip distcheck distclean \
-	distclean-generic distclean-libtool distclean-local \
-	distclean-tags distcleancheck distdir distuninstallcheck dvi \
-	dvi-am html html-am info info-am install install-am \
-	install-data install-data-am install-dvi install-dvi-am \
-	install-exec install-exec-am install-html install-html-am \
-	install-info install-info-am install-man install-pdf \
-	install-pdf-am install-ps install-ps-am install-strip \
-	installcheck installcheck-am installdirs installdirs-am \
-	maintainer-clean maintainer-clean-generic mostlyclean \
-	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
-	tags tags-recursive uninstall uninstall-am
-
-$(top_srcdir)/.version:
-	echo $(VERSION) > $@-t && mv $@-t $@
+	clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \
+	dist-gzip dist-hook dist-lzma dist-shar dist-tarZ dist-xz \
+	dist-zip distcheck distclean distclean-generic \
+	distclean-libtool distclean-tags distcleancheck distdir \
+	distuninstallcheck dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-strip installcheck installcheck-am installdirs \
+	installdirs-am maintainer-clean maintainer-clean-generic \
+	mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
+	ps ps-am tags tags-recursive uninstall uninstall-am
+
 
 binaries: src
 	make -C src all
@@ -776,42 +744,24 @@ distribin: binaries
 	make -C distribution distribin
 
 bclean:
-	-find . -name "*~" -exec rm -rf {} \;
-	-find . -name ".pure" -exec rm -rf {} \;
-	-find . -name "*.o" -exec rm {} \;
-	-find . -name "*.a" -exec rm {} \;
-	-find . -name "bla_*" -exec rm {} \;
-	-find . -name "bin.*" -exec rm {} \;
-	-find . -name "log.*" -exec rm {} \;
-	-find . -name "*.bak" -exec rm {} \;
-	-find . -name "ttt*" -exec rm {} \;
-	-find . -name "TTT*" -exec rm {} \;
-	-find . -name "core" -exec rm {} \;
-	-find . -name "*.flex.C" -exec rm {} \;
-	-find . -name "*flexer.cc" -exec rm {} \;
-
-distclean-local: bclean
-	-find . -name ".deps" -exec rm -rf {} \;
-	-rm -rf OSXstatlibs OSXstatlibs_bach
-	-rm -rf m4
-	-rm -rf Makefile Makefile.in aclocal.m4 config.status config.h config.h.in config.log configure autom4te.cache config.guess config.sub missing libtool
-	-rm -rf config
-
-clean-local: bclean
-	make -C distribution clean
-	make -C doc clean
-	-rm -rf OSXstatlibs OSXstatlibs_bach
+	find . -name "*~" -exec rm -rf {} \;
+	find . -name ".deps" -exec rm -rf {} \;
+	find . -name ".pure" -exec rm -rf {} \;
+	find . -name "*.o" -exec rm {} \;
+	find . -name "*.a" -exec rm {} \;
+	find . -name "bla_*" -exec rm {} \;
+	find . -name "bin.*" -exec rm {} \;
+	find . -name "log.*" -exec rm {} \;
+	find . -name "*.bak" -exec rm {} \;
+	find . -name "*.out" -exec rm {} \;
+	find . -name "ttt*" -exec rm {} \;
+	find . -name "TTT*" -exec rm {} \;
+	find . -name "core" -exec rm {} \;
+	find . -name "*.flex.C" -exec rm {} \;
 
 cvsclean: bclean
 	find . -name "CVS" -exec rm -rf {} \;
 
-statlibs:
-	-rm -rf OSXstatlibs_bach
-	mkdir OSXstatlibs_bach
-	(cd OSXstatlibs_bach; ln -s /opt/biosw/lib/*a .; cd ..)
-	(cd OSXstatlibs_bach; ln -s /opt/local/lib/gcc49/*a .; cd ..)
-	(cd OSXstatlibs_bach; ln -s /opt/local/lib/libbz2.a .; ln -s /opt/local/lib/libexpat.a .; cd ..)
-
 #       -find . -path './arch' -prune -o -perm -a+x -type f -exec rm {} \;
 #	 -rm -rf .deps *.bak *.out *.o *.d *.flex.C core ttt* log.* tca.*
 #	 -rm -rf main main2
@@ -822,16 +772,11 @@ statlibs:
 # DON'T do that in an one-liner (at least it breaks for me)
 
 dist-hook:
-	$(ECHO_N) `build-aux/git-version-gen isshort doesnotexist` > $(distdir)/.tarball-version
-	cp $(distdir)/.tarball-version $(distdir)/.version
 	( cd doc/docbook; make clean; cd ../.. )
 	tar cBf - doc | ( cd $(distdir); tar xBf - )
 	rm -rf $(distdir)/doc/docbook/db_guides
 	rm -rf $(distdir)/doc/docbook/util
 	rm -rf $(distdir)/doc/other
-	( cd doc/docbook; make versionfile; cd ../.. )
-	xsltproc --xinclude --output $(distdir)/README_build.html $(top_srcdir)/doc/docbook/mira.xsl $(top_srcdir)/doc/docbook/chap_installation_part.xml
-	cp -r $(top_srcdir)/doc/docbook/doccss $(distdir)
 	tar cBf - minidemo | ( cd $(distdir); tar xBf - )
 	( cd distribution; make clean; cd .. )
 	tar cBf - distribution | ( cd $(distdir); tar xBf - )
diff --git a/README b/README
index 3eafcb0..51647b0 100644
--- a/README
+++ b/README
@@ -1,13 +1,12 @@
-                                                    Rheinfelden, Spring 2015
+                                                    Rheinfelden, Summer 2011
 
-MIRA version 4.9.x
+MIRA version 3.4.x
 
 
 MIRA - The Genome and EST Sequence Assembly System
+EdIt - An Automatic Assembly Editing Tool
 
 
-This README covers aspects of the source package.
-
 License
 =======
 
@@ -16,25 +15,43 @@ licensed under the open source GPL v2 license. please consult the "COPYING"
 file for more information on the GPL.
 
 
-Building
-========
+Installing
+==========
+
+If you downloaded a precompiled package, just put the binaries somewhere in
+your path. Please read the documentation in the docs directory.
+
+For source code packages, please consult the file INSTALL for more information
+on pre-requisites and available options. There's also a section on building
+documentation in the same file.
+
+Here's a short summary:
+-----------------------
+Note: if you are working on a CVS checkout, you need to have GNU
+autoconf/automake tools and run "sh runme.first" from the top-level directory
+first.
+
+Then, in the best case, building MIRA binaries is done in three steps (but
+please consult the INSTALL file before doing so):
 
-Before trying to build MIRA yourself, please consider using the pre-built
-binaries which are available for Linux and Mac OSX on SourceForge. Consult the
-file "Definitive Guide to MIRA", chapter "Installation," for more information
-on pre-requisites, available options and walkthrough for common
-systems. There's also a section on building documentation in the same file.
+1) ./configure
+2) make
+3) make install
+
+additionally for user documentation as HTML and PDF: 
+
+4) make docs
 
 
 Directory structure of the source package
 =========================================
 
-Top level (this level):
+Top level (this level): 
 - standard files from GNU autoconf and automake as well as README; INSTALL,
   etc.
 - directory "src": the MIRA sources. Type "make" to make the binaries.
-- directory "doc": the MIRA documentation in DocBook format. Use "make docs"
-  to build the documentation in HTML and PDF format.
+- directory "doc": the MIRA documentation in LaTeXMAN format. Use "make docs"
+  to build the documentation in HTML, man and texinfo format.
 - directory "distribution": type "make distrib" and a package is made that
   contains binaries, documentation and some demos
 - directory "minidemo": a few demos for mira and miraEST. Please note that the
@@ -58,13 +75,11 @@ look at the public functions of the classes in the ./src/mira directory.
 
 Need help?
 ==========
-Please consult the extensive online documentation which covers more or less
-all aspects of MIRA. If questions persist, please mail general questions to
-the MIRA talk mailing list:
+Mail general questions to the MIRA talk mailing list:
         mira_talk at freelists.org
 
 To report bugs or ask for new features, please use the new ticketing system at:
-   http://sourceforge.net/p/mira-assembler/tickets/
+   http://sourceforge.net/apps/trac/mira-assembler/
 This ensures that requests do not get lost.
 
 
@@ -76,3 +91,8 @@ Do you want to help improving MIRA? Please consult the HELP_WANTED file.
 Author:
 =======
 MIRA - Bastien Chevreux: bach at chevreux.org
+
+EdIt - mira can use automatic editing routines which were written by Thomas
+       Pfisterer: t.pfisterer at dkfz-heidelberg.de
+
+
diff --git a/README_build.html b/README_build.html
deleted file mode 100644
index 805d20d..0000000
--- a/README_build.html
+++ /dev/null
@@ -1,482 +0,0 @@
-<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Installing MIRA</title><link rel="stylesheet" type="text/css" href="doccss/miradocstyle.css"><meta name="generator" content="DocBook XSL Stylesheets V1.76.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="chapter" title="Installing MIRA"><div class="titlepage"><div><div><h2 class="title"><a name="chap_installation"></a>Installing MIRA</h2></div> [...]
-      Where to fetch MIRA
-    </a></span></dt><dt><span class="sect1"><a href="#sect_install_precompiledbinary">2. 
-      Installing from a precompiled binary package
-    </a></span></dt><dt><span class="sect1"><a href="#sect_install_third_party_integration">3. 
-      Integration with third party programs (gap4, consed)
-    </a></span></dt><dt><span class="sect1"><a href="#sect_install_compiling">4. 
-      Compiling MIRA yourself
-    </a></span></dt><dd><dl><dt><span class="sect2"><a href="#sect_install_comp_prereq">4.1. 
-	Prerequisites
-      </a></span></dt><dt><span class="sect2"><a href="#sect_install_comp_comp">4.2. 
-	Compiling and installing
-      </a></span></dt><dt><span class="sect2"><a href="#sect_install_comp_conf">4.3. 
-	Configure switches for MIRA
-      </a></span></dt><dd><dl><dt><span class="sect3"><a href="#sect_install_comp_conf_boost">4.3.1. 
-	  BOOST configure switches for MIRA
-	</a></span></dt><dt><span class="sect3"><a href="#sect_install_comp_conf_mira">4.3.2. 
-	  MIRA specific configure switches
-	</a></span></dt></dl></dd></dl></dd><dt><span class="sect1"><a href="#sect_install_walkthroughs">5. 
-      Installation walkthroughs
-    </a></span></dt><dd><dl><dt><span class="sect2"><a href="#sect_install_walkthroughs_kubuntu">5.1. 
-	(K)Ubuntu 12.04
-      </a></span></dt><dt><span class="sect2"><a href="#sect_install_walkthroughs_opensuse">5.2. 
-	openSUSE 12.1
-      </a></span></dt><dt><span class="sect2"><a href="#sect_install_walkthroughs_fedora">5.3. 
-	Fedora 17
-      </a></span></dt><dt><span class="sect2"><a href="#sect_install_walkthroughs_allfromscratch">5.4. 
-	Compile everything from scratch
-      </a></span></dt><dt><span class="sect2"><a href="#sect_install_walkthroughs_dynamic">5.5. 
-	Dynamically linked MIRA
-      </a></span></dt></dl></dd><dt><span class="sect1"><a href="#sect_install_hintotherplatforms">6. 
-      Compilation hints for other platforms.
-    </a></span></dt><dd><dl><dt><span class="sect2"><a href="#sect_install_hintosx">6.1. 
-	Mac OS X
-      </a></span></dt><dt><span class="sect2"><a href="#sect_install_hintnetbsd5">6.2. 
-	NetBSD 5 (i386)
-      </a></span></dt></dl></dd></dl></div><div class="blockquote"><table border="0" width="100%" cellspacing="0" cellpadding="0" class="blockquote" summary="Block quote"><tr><td width="10%" valign="top">�</td><td width="80%" valign="top"><p>
-      <span class="emphasis"><em><span class="quote">“<span class="quote">A problem can be found to almost every solution.
-      </span>”</span></em></span>
-    </p></td><td width="10%" valign="top">�</td></tr><tr><td width="10%" valign="top">�</td><td colspan="2" align="right" valign="top">--<span class="attribution">Solomon Short</span></td></tr></table></div><div class="sect1" title="1.� Where to fetch MIRA"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sect_install_wheretofetch"></a>1.�
-      Where to fetch MIRA
-    </h2></div></div></div><p>
-      SourceForge: <a class="ulink" href="http://sourceforge.net/projects/mira-assembler/" target="_top">http://sourceforge.net/projects/mira-assembler/</a>
-    </p><p>
-      There you will normally find a couple of precompiled binaries -- usually
-      for Linux and Mac OSX -- or the source package for compiling yourself.
-    </p><p>
-      Precompiled binary packages are named in the following way:
-    </p><p>
-      <code class="filename">mira_<em class="replaceable"><code>miraversion</code></em>_<em class="replaceable"><code>OS-and-binarytype</code></em>.tar.bz2</code>
-    </p><p>
-      where
-    </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
-	  For <code class="filename"><em class="replaceable"><code>miraversion</code></em></code>, the
-	  stable versions of MIRA with the general public as audience usually
-	  have a version number in three parts, like
-	  <code class="filename">3.0.5</code>, sometimes also followed by some postfix
-	  like in <code class="filename">3.2.0rc1</code> to denote release candidate 1
-	  of the 3.2.0 version of MIRA. On very rare occasions, stable
-	  versions of MIRA can have four part like in, e.g.,
-	  <code class="filename">3.4.0.1</code>: these versions create identical
-	  binaries to their parent version (<code class="filename">3.4.0</code>) and
-	  just contains fixes to the source build machinery.
-	</p><p>
-	  The version string sometimes can have a different format:
-	  <code class="filename"><span class="emphasis"><em>sometext</em></span>-0-g<span class="emphasis"><em>somehexnumber</em></span></code>
-	  like in, e.g.,
-	  <code class="filename">ft_fastercontig-0-g4a27c91</code>. These versions of
-	  MIRA are snapshots from the development tree of MIRA and usually
-	  contain new functionality which may not be as well tested as the
-	  rest of MIRA, hence contains more checks and more debugging output
-	  to catch potential errors
-	</p></li><li class="listitem"><p>
-	  <code class="filename"><em class="replaceable"><code>OS-and-binarytype</code></em></code>
-	  finally defines for which operating system and which processor class
-	  the package is destined. E.g.,
-	  <code class="filename">linux-gnu_x86_64_static</code> contains static
-	  binaries for Linux running a 64 bit processor.
-	</p></li></ul></div><p>
-      Source packages are usually named
-    </p><p>
-      <code class="filename">mira-<em class="replaceable"><code>miraversion</code></em>.tar.bz2</code>
-    </p><p>
-      Examples for packages at SourceForge:
-    </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><code class="filename">mira_3.0.5_prod_linux-gnu_x86_64_static.tar.bz2</code></li><li class="listitem"><code class="filename">mira_3.0.5_prod_linux-gnu_i686_32_static.tar.bz2</code></li><li class="listitem"><code class="filename">mira_3.0.5_prod_OSX_snowleopard_x86_64_static.tar.bz2</code></li><li class="listitem"><code class="filename">mira-3.0.5.tar.bz2</code></li></ul></div></div><div class="se [...]
-      Installing from a precompiled binary package
-    </h2></div></div></div><p>
-      Download the package, unpack it. Inside, there is -- beside other
-      directories -- a <code class="filename">bin</code>. Copy or move the files and
-      soft-links inside this directory to a directory in your $PATH variable.
-    </p><p>
-      Additional scripts for special purposes are in the
-      <code class="filename">scripts</code> directory. You might or might not want to
-      have them in your $PATH.
-    </p><p>
-      Scripts and programs for MIRA from other authors are in the
-      <code class="filename">3rdparty</code> directory. Here too, you may or may not
-      want to have (some of them) in your $PATH.
-    </p></div><div class="sect1" title="3.� Integration with third party programs (gap4, consed)"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sect_install_third_party_integration"></a>3.�
-      Integration with third party programs (gap4, consed)
-    </h2></div></div></div><p>
-      MIRA sets tags in the assemblies that can be read and interpreted by the
-      Staden <span class="command"><strong>gap4</strong></span> package or
-      <span class="command"><strong>consed</strong></span>. These tags are extremely useful to
-      efficiently find places of interest in an assembly (be it de-novo or
-      mapping), but both <span class="command"><strong>gap4</strong></span> and <span class="command"><strong>consed</strong></span>
-      need to be told about these tags.
-    </p><p>
-      Data files for a correct integration are delivered in the
-      <code class="filename">support</code> directory of the distribution. Please
-      consult the README in that directory for more information on how to
-      integrate this information in either of these packages.
-    </p></div><div class="sect1" title="4.� Compiling MIRA yourself"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sect_install_compiling"></a>4.�
-      Compiling MIRA yourself
-    </h2></div></div></div><div class="sect2" title="4.1.� Prerequisites"><div class="titlepage"><div><div><h3 class="title"><a name="sect_install_comp_prereq"></a>4.1.�
-	Prerequisites
-      </h3></div></div></div><p>
-	The MIRA 3.x series works with quite old systems, the upcoming 4.x
-	series will need a C++11 compatible tool chain, i.e., systems starting
-	from the later half of 2011 should be OK. The requisites for
-	<span class="emphasis"><em>compiling</em></span> MIRA are:
-      </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
-	    gcc ≥ 4.8.1, with libstdc++6. You really want to use a simple
-	    installation package pre-configured for your system, but in case you
-	    want or have to install gcc yourself, please refer to <a class="ulink" href="http://gcc.gnu.org/" target="_top">http://gcc.gnu.org/</a> for more information on the GNU compiler
-	    collection.
-	  </p></li><li class="listitem"><p>
-	    BOOST library ≥ 1.48. Lower versions might work, but
-	    untested. You would need to change the checking in the configure
-	    script for this to run through. You really want to use a simple
-	    installation package pre-configured for your system, but in case you
-	    want or have to install BOOST yourself, please refer to <a class="ulink" href="http://www.boost.org/" target="_top">http://www.boost.org/</a> for more information on the BOOST
-	    library.
-	  </p><div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Warning"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="images/warning.png"></td><th align="left">Warning</th></tr><tr><td align="left" valign="top">
-	    Do NOT use a so called <span class="emphasis"><em>staged</em></span> BOOST library,
-	    only a fully installed library will work at the moment
-	  </td></tr></table></div></li><li class="listitem">
-	  zlib. Should your system not have zlib installed or available as
-	  simple installation package, please see <a class="ulink" href="http://www.zlib.net/" target="_top">http://www.zlib.net/</a> for more information regarding zlib.
-	</li><li class="listitem">
-	  GNU make. Should your system not have gmake installed or available
-	  as simple installation package, please see <a class="ulink" href="www.gnu.org/software/make/" target="_top">www.gnu.org/software/make/</a> for more information regarding
-	  GNU make.
-	</li><li class="listitem">
-	  GNU flex ≥ 2.5.33. Should your system not have flex installed or
-	  available as simple installation package, please see <a class="ulink" href="http://flex.sourceforge.net/" target="_top">http://flex.sourceforge.net/</a> for more information regarding
-	  flex.
-	</li><li class="listitem">
-	  Expat library ≥ 2.0.1. Should your system not have the Expat library and
-	  header files already installed or available as simple installation
-	  package, you will need to download and install a yourself. Please see
-	  <a class="ulink" href="http://www.libexpat.org/" target="_top">http://www.libexpat.org/</a> and <a class="ulink" href="http://sourceforge.net/projects/expat/" target="_top">http://sourceforge.net/projects/expat/</a> for information on how
-	  to do this.
-	</li><li class="listitem">
-	  xxd. A small utility from the <span class="command"><strong>vim</strong></span> package.
-	</li></ul></div><p>
-	For <span class="emphasis"><em>building the documentation</em></span>, additional
-	prerequisites are from the DocBook tool chain:
-      </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
-	  xsltproc + docbook-xsl for HTML output
-	</li><li class="listitem">
-	  dblatex for PDF output
-	</li></ul></div><div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Warning"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="images/warning.png"></td><th align="left">Warning</th></tr><tr><td align="left" valign="top"><p>
-	  Previous versions of MIRA had a benefit by using the TCMalloc
-	  library. This is not the case anymore! Indeed, tests showed that when
-	  using TCMalloc, MIRA 4.9.x and above will probably need 20 to
-	  30% <span class="emphasis"><em>more</em></span> max memory and up to 80% more overall
-	  memory than without TCMalloc.
-	</p><p>
-	  In short: do not use at the moment.
-	</p></td></tr></table></div></div><div class="sect2" title="4.2.� Compiling and installing"><div class="titlepage"><div><div><h3 class="title"><a name="sect_install_comp_comp"></a>4.2.�
-	Compiling and installing
-      </h3></div></div></div><p>
-	MIRA uses the GNU autoconf/automake tools, please read the section
-	"Basic Installation" of the <code class="filename">INSTALL</code> file in the
-	source package of MIRA for more generic information on how to invoke
-	them.
-      </p><p>
-	The short version: simply type
-      </p><pre class="screen">
-<code class="prompt">arcadia:/path/to/mira-4.0.0$</code> <strong class="userinput"><code>./configure</code></strong>
-<code class="prompt">arcadia:/path/to/mira-4.0.0$</code> <strong class="userinput"><code>make</code></strong>
-<code class="prompt">arcadia:/path/to/mira-4.0.0$</code> <strong class="userinput"><code>make install</code></strong></pre><p>
-	This should install the following programs:
-      </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><span class="command"><strong>mira</strong></span></li><li class="listitem"><span class="command"><strong>miraconvert</strong></span></li><li class="listitem"><span class="command"><strong>mirabait</strong></span></li><li class="listitem"><span class="command"><strong>miramem</strong></span></li></ul></div><p>
-	Should the <code class="literal">./configure</code> step fail for some reason or
-	another, you should get a message telling you at which step this
-	happens and and either install missing packages or tell
-	<span class="command"><strong>configure</strong></span> where it should search the packages it
-	did not find, see also next section.
-      </p></div><div class="sect2" title="4.3.� Configure switches for MIRA"><div class="titlepage"><div><div><h3 class="title"><a name="sect_install_comp_conf"></a>4.3.�
-	Configure switches for MIRA
-      </h3></div></div></div><p>
-	MIRA understands all standard autoconf configure switches like <code class="literal">--prefix=</code>
-	etc. Please consult the INSTALL file in the MIRA top level directory
-	of the source package and also call <code class="literal">./configure
-	--help</code> to get a full list of currently supported switches.
-      </p><div class="sect3" title="4.3.1.� BOOST configure switches for MIRA"><div class="titlepage"><div><div><h4 class="title"><a name="sect_install_comp_conf_boost"></a>4.3.1.�
-	  BOOST configure switches for MIRA
-	</h4></div></div></div><p>
-	  BOOST is maybe the most tricky library to get right in case it does
-	  not come pre-configured for your system. The two main switches for
-	  helping to locate BOOST are
-	  probably <code class="literal">--with-boost=[ARG]</code>
-	  and <code class="literal">--with-boost-libdir=LIB_DIR</code>. Only if those
-	  two fail, try using the other <code class="literal">--with-boost-*=</code> switches
-	  you will see from the ./configure help text.
-	</p></div><div class="sect3" title="4.3.2.� MIRA specific configure switches"><div class="titlepage"><div><div><h4 class="title"><a name="sect_install_comp_conf_mira"></a>4.3.2.�
-	  MIRA specific configure switches
-	</h4></div></div></div><p>
-	  MIRA honours the following switches:
-	</p><div class="variablelist"><dl><dt><span class="term">
-	      --enable-64=yes/no
-	    </span></dt><dd><p>
-		MIRA should happily build as 32 bit executable on 32 bit
-		platforms and as 64 bit executable on 64 bit platforms. On 64
-		bit platforms, setting the switch to 'no' forces the compiler
-		to produce 32 bit executables (if possible)
-	      </p><div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Warning"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="images/warning.png"></td><th align="left">Warning</th></tr><tr><td align="left" valign="top">
-		As of MIRA 3.9.0, support for 32 bit platforms is being
-		slowly phased out. While MIRA should compile and also run fine
-		on 32 bit platforms, I do not guarantee it anymore as I
-		haven't used 32 bit systems in the last 5 years.
-	      </td></tr></table></div></dd><dt><span class="term">
-	      --enable-warnings
-	    </span></dt><dd>
-	      Enables compiler warnings, useful only for developers, not for users.
-	    </dd><dt><span class="term">
-	      --enable-debug
-	    </span></dt><dd>
-	      Lets the MIRA binary contain C/C++ debug symbols.
-	    </dd><dt><span class="term">
-	      --enable-mirastatic
-	    </span></dt><dd>
-	      Builds static binaries which are easier to distribute. Some
-	      platforms (like OpenSolaris) might not like this and you will
-	      get an error from the linker.
-	    </dd><dt><span class="term">
-	      --enable-optimisations
-	    </span></dt><dd>
-	      Instructs the configure script to set optimisation switches for compiling
-	      (on by default). Switching optimisations off (warning, high impact on
-	      run-time) might be interesting only for, e.g, debugging with valgrind.
-	    </dd><dt><span class="term">
-	      --enable-publicquietmira
-	    </span></dt><dd>
-	      Some parts of MIRA can dump additional debug information during
-	      assembly, setting this switch to "no" performs this. Warning:
-	      MIRA will be a bit chatty, using this is not recommended for
-	      public usage.
-	    </dd><dt><span class="term">
-	      --enable-developmentversion
-	    </span></dt><dd>
-	      Using MIRA with enabled development mode may lead to extra
-	      output on stdout as well as some additional data in the results
-	      which should not appear in real world data
-	    </dd><dt><span class="term">
-	      --enable-boundtracking
-	    </span></dt><dd></dd><dt><span class="term">
-	      --enable-bugtracking
-	    </span></dt><dd>
-	      Both flags above compile in some basic checks into mira that
-	      look for sanity within some functions: Leaving this on "yes"
-	      (default) is encouraged, impact on run time is minimal
-	    </dd><dt><span class="term">
-	    </span></dt><dd></dd><dt><span class="term">
-	    </span></dt><dd></dd><dt><span class="term">
-	    </span></dt><dd></dd></dl></div></div></div></div><div class="sect1" title="5.� Installation walkthroughs"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sect_install_walkthroughs"></a>5.�
-      Installation walkthroughs
-    </h2></div></div></div><div class="sect2" title="5.1.� (K)Ubuntu 12.04"><div class="titlepage"><div><div><h3 class="title"><a name="sect_install_walkthroughs_kubuntu"></a>5.1.�
-	(K)Ubuntu 12.04
-      </h3></div></div></div><p>
-	You will need to install a couple of tools and libraries before
-	compiling MIRA. Here's the recipe:
-      </p><pre class="screen">
-<strong class="userinput"><code>sudo apt-get install make flex
-sudo apt-get install libboost-doc libboost.*1.48-dev libboost.*1.48.0</code></strong></pre><p>
-	Once this is done, you can unpack and compile MIRA. For a dynamically
-	linked version, use:
-      </p><pre class="screen">
-<strong class="userinput"><code>tar xvjf <em class="replaceable"><code>mira-4.0.0.tar.bz2</code></em>
-cd <em class="replaceable"><code>mira-4.0.0</code></em>
-./configure
-make && make install</code></strong></pre><p>
-	For a statically linked version, just change the configure line from
-	above into
-      </p><pre class="screen">
-<strong class="userinput"><code>./configure <em class="replaceable"><code>--enable-mirastatic</code></em></code></strong></pre><p>
-	In case you also want to build documentation yourself, you will need
-	this in addition:
-      </p><pre class="screen"><strong class="userinput"><code>sudo apt-get install xsltproc docbook-xsl dblatex</code></strong></pre><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>
-	  People working on git checkouts of the MIRA source code will
-	  obviously need some more tools. Get them with this:
-	</p><pre class="screen"><strong class="userinput"><code>sudo apt-get install automake libtool xutils-dev</code></strong></pre></td></tr></table></div></div><div class="sect2" title="5.2.� openSUSE 12.1"><div class="titlepage"><div><div><h3 class="title"><a name="sect_install_walkthroughs_opensuse"></a>5.2.�
-	openSUSE 12.1
-      </h3></div></div></div><p>
-	You will need to install a couple of tools and libraries before
-	compiling MIRA. Here's the recipe:
-      </p><pre class="screen">
-<strong class="userinput"><code>sudo zypper install gcc-c++ boost-devel
-sudo zypper install flex libexpat-devel zlib-devel</code></strong></pre><p>
-	Once this is done, you can unpack and compile MIRA. For a dynamically
-	linked version, use:
-      </p><pre class="screen">
-<strong class="userinput"><code>tar xvjf <em class="replaceable"><code>mira-4.0.0.tar.bz2</code></em>
-cd <em class="replaceable"><code>mira-4.0.0</code></em>
-./configure
-make && make install</code></strong></pre><p>
-	In case you also want to build documentation yourself, you will need
-	this in addition:
-      </p><pre class="screen"><strong class="userinput"><code>sudo zypper install docbook-xsl-stylesheets dblatex</code></strong></pre><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>
-	  People working on git checkouts of the MIRA source code will
-	  obviously need some more tools. Get them with this:
-	</p><pre class="screen"><strong class="userinput"><code>sudo zypper install automake libtool xutils-dev</code></strong></pre></td></tr></table></div></div><div class="sect2" title="5.3.� Fedora 17"><div class="titlepage"><div><div><h3 class="title"><a name="sect_install_walkthroughs_fedora"></a>5.3.�
-	Fedora 17
-      </h3></div></div></div><p>
-	You will need to install a couple of tools and libraries before
-	compiling MIRA. Here's the recipe:
-      </p><pre class="screen">
-<strong class="userinput"><code>sudo yum -y install gcc-c++ boost-devel
-sudo yum install flex expat-devel vim-common zlib-devel</code></strong></pre><p>
-	Once this is done, you can unpack and compile MIRA. For a dynamically
-	linked version, use:
-      </p><pre class="screen">
-<strong class="userinput"><code>tar xvjf <em class="replaceable"><code>mira-4.0.0.tar.bz2</code></em>
-cd <em class="replaceable"><code>mira-4.0.0</code></em>
-./configure
-make && make install</code></strong></pre><p>
-	In case you also want to build documentation yourself, you will need
-	this in addition:
-      </p><pre class="screen"><strong class="userinput"><code>sudo yum -y install docbook-xsl dblatex</code></strong></pre><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>
-	  People working on git checkouts of the MIRA source code will
-	  obviously need some more tools. Get them with this:
-	</p><pre class="screen"><strong class="userinput"><code>sudo yum -y install automake libtool xorg-x1-util-devel</code></strong></pre></td></tr></table></div></div><div class="sect2" title="5.4.� Compile everything from scratch"><div class="titlepage"><div><div><h3 class="title"><a name="sect_install_walkthroughs_allfromscratch"></a>5.4.�
-	Compile everything from scratch
-      </h3></div></div></div><p>
-	This lets you build a self-contained static MIRA binary. The only
-	prerequisite here is that you have a working <span class="command"><strong>gcc</strong></span>
-	≥ 4.6.2. Please download all necessary files (expat, flex, etc.pp)
-	and then simply follow the script below. The only things that you will
-	want to change are the path used and, maybe, the name of some packages
-	in case they were bumped up a version or revision.
-      </p><p>
-	Contributed by Sven Klages.
-      </p><pre class="screen">
-## whatever path is appropriate
-<strong class="userinput"><code>cd <em class="replaceable"><code>/home/gls/SvenTemp/install</code></em></code></strong>
-
-## expat
-<strong class="userinput"><code>tar zxvf <em class="replaceable"><code>expat-2.0.1.tar.gz</code></em>
-cd <em class="replaceable"><code>expat-2.0.1</code></em>
-./configure <em class="replaceable"><code>--prefix=/home/gls/SvenTemp/expat</code></em>
-make && make install</code></strong>
-
-## flex
-<strong class="userinput"><code>cd <em class="replaceable"><code>/home/gls/SvenTemp/install</code></em>
-tar zxvf <em class="replaceable"><code>flex-2.5.35.tar.gz</code></em>
-cd <em class="replaceable"><code>flex-2.5.35</code></em>
-./configure <em class="replaceable"><code>--prefix=/home/gls/SvenTemp/flex</code></em>
-make && make install
-cd <em class="replaceable"><code>/home/gls/SvenTemp/flex/bin</code></em>
-ln -s flex flex++
-export PATH=<em class="replaceable"><code>/home/gls/SvenTemp/flex/bin</code></em>:$PATH</code></strong>
-
-## boost
-<strong class="userinput"><code>cd <em class="replaceable"><code>/home/gls/SvenTemp/install</code></em>
-tar zxvf <em class="replaceable"><code>boost_1_48_0.tar.gz</code></em>
-cd <em class="replaceable"><code>boost_1_48_0</code></em>
-./bootstrap.sh --prefix=<em class="replaceable"><code>/home/gls/SvenTemp/boost</code></em>
-./b2 install</code></strong>
-
-## mira itself
-<strong class="userinput"><code>export CXXFLAGS="-I<em class="replaceable"><code>/home/gls/SvenTemp/flex/include</code></em>"
-
-cd <em class="replaceable"><code>/home/gls/SvenTemp/install</code></em>
-tar zxvf <em class="replaceable"><code>mira-3.4.0.1.tar.gz</code></em>
-cd <em class="replaceable"><code>mira-3.4.0.1</code></em>
-./configure --prefix=<em class="replaceable"><code>/home/gls/SvenTemp/mira</code></em> \
---with-boost=<em class="replaceable"><code>/home/gls/SvenTemp/boost</code></em> \
---with-expat=<em class="replaceable"><code>/home/gls/SvenTemp/expat</code></em> \
---enable-mirastatic
-make && make install</code></strong></pre></div><div class="sect2" title="5.5.� Dynamically linked MIRA"><div class="titlepage"><div><div><h3 class="title"><a name="sect_install_walkthroughs_dynamic"></a>5.5.�
-	Dynamically linked MIRA
-      </h3></div></div></div><p>
-	In case you do not want a static binary of MIRA, but a dynamically
-	linked version, the following script by Robert Bruccoleri will give
-	you an idea on how to do this.
-      </p><p>
-	Note that he, having root rights, puts all additional software in
-	/usr/local, and in particular, he keeps updated versions of Boost and
-	Flex there.
-      </p><pre class="screen">
-#!/bin/sh -x
-
-make distclean
-oze=`find . -name "*.o" -print`
-if [[ -n "$oze" ]]
-then
-   echo "Not clean."
-   exit 1
-
-fi
-
-export prefix=${BUILD_PREFIX:-/usr/local}
-export LDFLAGS="-Wl,-rpath,$prefix/lib"
-
-./configure --prefix=$prefix \
-           --enable-debug=yes \
-           --enable-mirastatic=no \
-           --with-boost-libdir=$prefix/lib \
-           --enable-optimisations \
-           --enable-boundtracking=yes \
-           --enable-bugtracking=yes \
-           --enable-extendedbugtracking=no
-make
-make install</pre></div></div><div class="sect1" title="6.� Compilation hints for other platforms."><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sect_install_hintotherplatforms"></a>6.�
-      Compilation hints for other platforms.
-    </h2></div></div></div><div class="sect2" title="6.1.� Mac OS X"><div class="titlepage"><div><div><h3 class="title"><a name="sect_install_hintosx"></a>6.1.�
-	Mac OS X
-      </h3></div></div></div><p>
-	This has been tested on OSX 10.6.4. You will need XCode (from Apple)
-	and some packages from MacPorts.
-      </p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">Download and install a current XCode</li><li class="listitem">Download and compile a current GCC (≥ 4.8.2). Do NOT use a
-	GCC from MacPorts, it lacks a vitally important library
-	(<code class="filename">libstdc++.a</code>)</li><li class="listitem">Download, compile with GCC and install a current BOOST
-	library</li><li class="listitem">Download, compile with GCC and install all libraries MIRA
-	needs (flex, etc.pp). Follow the directions given in <a class="xref" href="#sect_install_walkthroughs_allfromscratch" title="5.4.� Compile everything from scratch">Section�5.4: “
-	Compile everything from scratch
-      ”</a> and <a class="xref" href="#sect_install_walkthroughs_allfromscratch" title="5.4.� Compile everything from scratch">Section�5.4, “
-	Compile everything from scratch
-      ”</a></li><li class="listitem">Download the MIRA source package and unpack it</li><li class="listitem"><p>
-	    In the unpacked MIRA directory, create a directory called
-	    <code class="filename">OSXstatlibs</code>. Into this directory, you need to
-	    softlink all needed static libraries from GCC, BOOST, flex,
-	    etc.pp.
-	  </p><p>
-	    E.g., I have GCC installed in
-	    <code class="filename">/opt/localwgcc48/</code> and therefore I need to use
-	    the following to link GCC static libraries:
-	  </p><pre class="screen">
-<code class="prompt">$</code> <strong class="userinput"><code>ln -s <em class="replaceable"><code>/opt/localwgcc48/lib/*a</code></em> .</code></strong></pre><p>
-	    I have all the other libraries (BOOST, flex, etc.pp) installed in
-	    <code class="filename">/opt/biosw/</code>, therefore I also need to link
-	    these libraries:
-	  </p><pre class="screen">
-<code class="prompt">$</code> <strong class="userinput"><code>ln -s <em class="replaceable"><code>/opt/biosw/lib/*a</code></em> .</code></strong></pre></li><li class="listitem"><p>
-	    Run <code class="literal">./configure --enable-mirastatic ...</code> where
-	    "..." stands for additional configure parameters needed and then
-	    run <code class="literal">make</code>.
-	  </p></li></ol></div><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top">
-	As of now (April 2014), if you are on OSX 10.9 (Mavericks) and are
-	using GCC ≤ 4.8.2, the steps described above
-	may not be enough. If an error occurs at the linking stage very late in
-	the MIRA building process, you need to patch a system file as described
-	in <a class="ulink" href="http://trac.macports.org/ticket/41033" target="_top">http://trac.macports.org/ticket/41033</a></td></tr></table></div><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top">
-	A checkout from git needs some packages from MacPorts:
-	<pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>port install autoconf automake libtool</code></strong></pre></td></tr></table></div><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>
-	  Building documentation needs the packages 'libxslt' and 'dblatex' from MacPorts.
-	</p><pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>port install dblatex libxslt</code></strong></pre><p>
-	  (Feb 2014) The above may fail while installing the one or other
-	  dependency (for me it was while installing 'urw-fonts'). If that is
-	  the case, repeat a couple of times and normally it should work.
-	</p></td></tr></table></div></div><div class="sect2" title="6.2.� NetBSD 5 (i386)"><div class="titlepage"><div><div><h3 class="title"><a name="sect_install_hintnetbsd5"></a>6.2.�
-	NetBSD 5 (i386)
-      </h3></div></div></div><p>
-	Contributed by Thomas Vaughan
-      </p><p>
-	The system flex <span class="emphasis"><em>(/usr/bin/flex)</em></span> is too old, but the
-	devel/flex package from a recent pkgsrc works fine. BSD make doesn't
-	like one of the lines in <span class="emphasis"><em>src/progs/Makefile</em></span>, so use GNU make instead
-	(available from <span class="emphasis"><em>pkgsrc</em></span> as <span class="emphasis"><em>devel/gmake</em></span>). Other relevant pkgsrc packages:
-	<span class="emphasis"><em>devel/boost-libs</em></span>, <span class="emphasis"><em>devel/boost-headers</em></span>
-	and <span class="emphasis"><em>textproc/expat</em></span>. The configure script has to
-	be told about these pkgsrc prerequisites (they are usually rooted
-	at <span class="emphasis"><em>/usr/pkg</em></span> but other locations are possible):
-      </p><pre class="screen"><strong class="userinput"><code>FLEX=/usr/pkg/bin/flex ./configure --with-expat=/usr/pkg --with-boost=/usr/pkg</code></strong></pre><p>
-	If attempting to build a pkgsrc package of MIRA, note that the LDFLAGS
-	passed by the pkgsrc mk files don't remove the need for
-	the <span class="emphasis"><em>--with-boost</em></span> option.  The configure script
-	complains about flex being too old, but this is harmless because it
-	honours the $FLEX variable when writing out makefiles.
-      </p></div></div></div></body></html>
diff --git a/THANKS b/THANKS
index 2bfd3d3..bc346b8 100644
--- a/THANKS
+++ b/THANKS
@@ -28,7 +28,7 @@ Alexander Kuehn    helping out with HP Testdrive to get MIRA compiled there
 Randolf Schulz     finding the Apple linker error and (a solution to it) that
                     prevented compiling MIRA on Darwin / MacOS X
 Jacqueline Weber   for helping in finding out about the 454 adapter
-                    sequences and thoroughly testing the 454 assemblies
+                    sequences and thoroughly testing the 454 assmblies
 Gerrit Schramm     from Roche in helping me out to understand some of the less
                     well known things regarding the 454 sequencing system
 Hern�ndez Alvarez
@@ -55,10 +55,7 @@ Dag Ahren	   making available a test set to track down a rather nasty
                     problem occuring during clipping
 Jan van Haarst	   Running benchmarks over NFS to find poorly performing
                     input/output routines
-Peter Cock         Invaluable feedback for implementing SAM format and
-                    pointing out bugs, small and large
-Debian Med team    For patches and packaging MIRA so that it is available for
-                    Debian and all distributions based on Debian.
+
 
 ... and numerous people on the mira_talk mailing list who reported successes,
 bugs and/or quirks either in the build process or while running mira.
@@ -69,3 +66,4 @@ and numerous other people who either declined being thanked publicly or could
 not respond before I wrote this (just drop me a mail). They all donated time
 and computing power to hunt down a "bug" which turned out to be a RAM defect
 on my development machine.
+
diff --git a/aclocal.m4 b/aclocal.m4
index 4266810..db39e15 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,8 +1,7 @@
-# generated automatically by aclocal 1.11.3 -*- Autoconf -*-
+# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
-# Inc.
+# 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -14,8627 +13,18 @@
 
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
-m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
-[m4_warning([this file was generated for autoconf 2.68.
+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.67],,
+[m4_warning([this file was generated for autoconf 2.67.
 You have another version of autoconf.  It may work, but is not guaranteed to.
 If you have problems, you may need to regenerate the build system entirely.
 To do so, use the procedure documented by the package, typically `autoreconf'.])])
 
-# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
-#
-#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-#                 Foundation, Inc.
-#   Written by Gordon Matzigkeit, 1996
-#
-# This file is free software; the Free Software Foundation gives
-# unlimited permission to copy and/or distribute it, with or without
-# modifications, as long as this notice is preserved.
-
-m4_define([_LT_COPYING], [dnl
-#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-#                 Foundation, Inc.
-#   Written by Gordon Matzigkeit, 1996
-#
-#   This file is part of GNU Libtool.
-#
-# GNU Libtool is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# As a special exception to the GNU General Public License,
-# if you distribute this file as part of a program or library that
-# is built using GNU Libtool, you may include this file under the
-# same distribution terms that you use for the rest of that program.
-#
-# GNU Libtool is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Libtool; see the file COPYING.  If not, a copy
-# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
-# obtained by writing to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-])
-
-# serial 57 LT_INIT
-
-
-# LT_PREREQ(VERSION)
-# ------------------
-# Complain and exit if this libtool version is less that VERSION.
-m4_defun([LT_PREREQ],
-[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1,
-       [m4_default([$3],
-		   [m4_fatal([Libtool version $1 or higher is required],
-		             63)])],
-       [$2])])
-
-
-# _LT_CHECK_BUILDDIR
-# ------------------
-# Complain if the absolute build directory name contains unusual characters
-m4_defun([_LT_CHECK_BUILDDIR],
-[case `pwd` in
-  *\ * | *\	*)
-    AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;;
-esac
-])
-
-
-# LT_INIT([OPTIONS])
-# ------------------
-AC_DEFUN([LT_INIT],
-[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT
-AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
-AC_BEFORE([$0], [LT_LANG])dnl
-AC_BEFORE([$0], [LT_OUTPUT])dnl
-AC_BEFORE([$0], [LTDL_INIT])dnl
-m4_require([_LT_CHECK_BUILDDIR])dnl
-
-dnl Autoconf doesn't catch unexpanded LT_ macros by default:
-m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl
-m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl
-dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4
-dnl unless we require an AC_DEFUNed macro:
-AC_REQUIRE([LTOPTIONS_VERSION])dnl
-AC_REQUIRE([LTSUGAR_VERSION])dnl
-AC_REQUIRE([LTVERSION_VERSION])dnl
-AC_REQUIRE([LTOBSOLETE_VERSION])dnl
-m4_require([_LT_PROG_LTMAIN])dnl
-
-_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}])
-
-dnl Parse OPTIONS
-_LT_SET_OPTIONS([$0], [$1])
-
-# This can be used to rebuild libtool when needed
-LIBTOOL_DEPS="$ltmain"
-
-# Always use our own libtool.
-LIBTOOL='$(SHELL) $(top_builddir)/libtool'
-AC_SUBST(LIBTOOL)dnl
-
-_LT_SETUP
-
-# Only expand once:
-m4_define([LT_INIT])
-])# LT_INIT
-
-# Old names:
-AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT])
-AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_PROG_LIBTOOL], [])
-dnl AC_DEFUN([AM_PROG_LIBTOOL], [])
-
-
-# _LT_CC_BASENAME(CC)
-# -------------------
-# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.
-m4_defun([_LT_CC_BASENAME],
-[for cc_temp in $1""; do
-  case $cc_temp in
-    compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
-    distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
-    \-*) ;;
-    *) break;;
-  esac
-done
-cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
-])
-
-
-# _LT_FILEUTILS_DEFAULTS
-# ----------------------
-# It is okay to use these file commands and assume they have been set
-# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'.
-m4_defun([_LT_FILEUTILS_DEFAULTS],
-[: ${CP="cp -f"}
-: ${MV="mv -f"}
-: ${RM="rm -f"}
-])# _LT_FILEUTILS_DEFAULTS
-
-
-# _LT_SETUP
-# ---------
-m4_defun([_LT_SETUP],
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-AC_REQUIRE([AC_CANONICAL_BUILD])dnl
-AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl
-AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl
-
-_LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl
-dnl
-_LT_DECL([], [host_alias], [0], [The host system])dnl
-_LT_DECL([], [host], [0])dnl
-_LT_DECL([], [host_os], [0])dnl
-dnl
-_LT_DECL([], [build_alias], [0], [The build system])dnl
-_LT_DECL([], [build], [0])dnl
-_LT_DECL([], [build_os], [0])dnl
-dnl
-AC_REQUIRE([AC_PROG_CC])dnl
-AC_REQUIRE([LT_PATH_LD])dnl
-AC_REQUIRE([LT_PATH_NM])dnl
-dnl
-AC_REQUIRE([AC_PROG_LN_S])dnl
-test -z "$LN_S" && LN_S="ln -s"
-_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl
-dnl
-AC_REQUIRE([LT_CMD_MAX_LEN])dnl
-_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl
-_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl
-dnl
-m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-m4_require([_LT_CHECK_SHELL_FEATURES])dnl
-m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl
-m4_require([_LT_CMD_RELOAD])dnl
-m4_require([_LT_CHECK_MAGIC_METHOD])dnl
-m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl
-m4_require([_LT_CMD_OLD_ARCHIVE])dnl
-m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
-m4_require([_LT_WITH_SYSROOT])dnl
-
-_LT_CONFIG_LIBTOOL_INIT([
-# See if we are running on zsh, and set the options which allow our
-# commands through without removal of \ escapes INIT.
-if test -n "\${ZSH_VERSION+set}" ; then
-   setopt NO_GLOB_SUBST
-fi
-])
-if test -n "${ZSH_VERSION+set}" ; then
-   setopt NO_GLOB_SUBST
-fi
-
-_LT_CHECK_OBJDIR
-
-m4_require([_LT_TAG_COMPILER])dnl
-
-case $host_os in
-aix3*)
-  # AIX sometimes has problems with the GCC collect2 program.  For some
-  # reason, if we set the COLLECT_NAMES environment variable, the problems
-  # vanish in a puff of smoke.
-  if test "X${COLLECT_NAMES+set}" != Xset; then
-    COLLECT_NAMES=
-    export COLLECT_NAMES
-  fi
-  ;;
-esac
-
-# Global variables:
-ofile=libtool
-can_build_shared=yes
-
-# All known linkers require a `.a' archive for static linking (except MSVC,
-# which needs '.lib').
-libext=a
-
-with_gnu_ld="$lt_cv_prog_gnu_ld"
-
-old_CC="$CC"
-old_CFLAGS="$CFLAGS"
-
-# Set sane defaults for various variables
-test -z "$CC" && CC=cc
-test -z "$LTCC" && LTCC=$CC
-test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
-test -z "$LD" && LD=ld
-test -z "$ac_objext" && ac_objext=o
-
-_LT_CC_BASENAME([$compiler])
-
-# Only perform the check for file, if the check method requires it
-test -z "$MAGIC_CMD" && MAGIC_CMD=file
-case $deplibs_check_method in
-file_magic*)
-  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
-    _LT_PATH_MAGIC
-  fi
-  ;;
-esac
-
-# Use C for the default configuration in the libtool script
-LT_SUPPORTED_TAG([CC])
-_LT_LANG_C_CONFIG
-_LT_LANG_DEFAULT_CONFIG
-_LT_CONFIG_COMMANDS
-])# _LT_SETUP
-
-
-# _LT_PREPARE_SED_QUOTE_VARS
-# --------------------------
-# Define a few sed substitution that help us do robust quoting.
-m4_defun([_LT_PREPARE_SED_QUOTE_VARS],
-[# Backslashify metacharacters that are still active within
-# double-quoted strings.
-sed_quote_subst='s/\([["`$\\]]\)/\\\1/g'
-
-# Same as above, but do not quote variable references.
-double_quote_subst='s/\([["`\\]]\)/\\\1/g'
-
-# Sed substitution to delay expansion of an escaped shell variable in a
-# double_quote_subst'ed string.
-delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
-
-# Sed substitution to delay expansion of an escaped single quote.
-delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
-
-# Sed substitution to avoid accidental globbing in evaled expressions
-no_glob_subst='s/\*/\\\*/g'
-])
-
-# _LT_PROG_LTMAIN
-# ---------------
-# Note that this code is called both from `configure', and `config.status'
-# now that we use AC_CONFIG_COMMANDS to generate libtool.  Notably,
-# `config.status' has no value for ac_aux_dir unless we are using Automake,
-# so we pass a copy along to make sure it has a sensible value anyway.
-m4_defun([_LT_PROG_LTMAIN],
-[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl
-_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir'])
-ltmain="$ac_aux_dir/ltmain.sh"
-])# _LT_PROG_LTMAIN
-
-
-
-# So that we can recreate a full libtool script including additional
-# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS
-# in macros and then make a single call at the end using the `libtool'
-# label.
-
-
-# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS])
-# ----------------------------------------
-# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later.
-m4_define([_LT_CONFIG_LIBTOOL_INIT],
-[m4_ifval([$1],
-          [m4_append([_LT_OUTPUT_LIBTOOL_INIT],
-                     [$1
-])])])
-
-# Initialize.
-m4_define([_LT_OUTPUT_LIBTOOL_INIT])
-
-
-# _LT_CONFIG_LIBTOOL([COMMANDS])
-# ------------------------------
-# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later.
-m4_define([_LT_CONFIG_LIBTOOL],
-[m4_ifval([$1],
-          [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS],
-                     [$1
-])])])
-
-# Initialize.
-m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS])
-
-
-# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS])
-# -----------------------------------------------------
-m4_defun([_LT_CONFIG_SAVE_COMMANDS],
-[_LT_CONFIG_LIBTOOL([$1])
-_LT_CONFIG_LIBTOOL_INIT([$2])
-])
-
-
-# _LT_FORMAT_COMMENT([COMMENT])
-# -----------------------------
-# Add leading comment marks to the start of each line, and a trailing
-# full-stop to the whole comment if one is not present already.
-m4_define([_LT_FORMAT_COMMENT],
-[m4_ifval([$1], [
-m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])],
-              [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.])
-)])
-
-
-
-
-
-# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?])
-# -------------------------------------------------------------------
-# CONFIGNAME is the name given to the value in the libtool script.
-# VARNAME is the (base) name used in the configure script.
-# VALUE may be 0, 1 or 2 for a computed quote escaped value based on
-# VARNAME.  Any other value will be used directly.
-m4_define([_LT_DECL],
-[lt_if_append_uniq([lt_decl_varnames], [$2], [, ],
-    [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name],
-	[m4_ifval([$1], [$1], [$2])])
-    lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3])
-    m4_ifval([$4],
-	[lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])])
-    lt_dict_add_subkey([lt_decl_dict], [$2],
-	[tagged?], [m4_ifval([$5], [yes], [no])])])
-])
-
-
-# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION])
-# --------------------------------------------------------
-m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])])
-
-
-# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...])
-# ------------------------------------------------
-m4_define([lt_decl_tag_varnames],
-[_lt_decl_filter([tagged?], [yes], $@)])
-
-
-# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..])
-# ---------------------------------------------------------
-m4_define([_lt_decl_filter],
-[m4_case([$#],
-  [0], [m4_fatal([$0: too few arguments: $#])],
-  [1], [m4_fatal([$0: too few arguments: $#: $1])],
-  [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)],
-  [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)],
-  [lt_dict_filter([lt_decl_dict], $@)])[]dnl
-])
-
-
-# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...])
-# --------------------------------------------------
-m4_define([lt_decl_quote_varnames],
-[_lt_decl_filter([value], [1], $@)])
-
-
-# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...])
-# ---------------------------------------------------
-m4_define([lt_decl_dquote_varnames],
-[_lt_decl_filter([value], [2], $@)])
-
-
-# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...])
-# ---------------------------------------------------
-m4_define([lt_decl_varnames_tagged],
-[m4_assert([$# <= 2])dnl
-_$0(m4_quote(m4_default([$1], [[, ]])),
-    m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]),
-    m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))])
-m4_define([_lt_decl_varnames_tagged],
-[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])])
-
-
-# lt_decl_all_varnames([SEPARATOR], [VARNAME1...])
-# ------------------------------------------------
-m4_define([lt_decl_all_varnames],
-[_$0(m4_quote(m4_default([$1], [[, ]])),
-     m4_if([$2], [],
-	   m4_quote(lt_decl_varnames),
-	m4_quote(m4_shift($@))))[]dnl
-])
-m4_define([_lt_decl_all_varnames],
-[lt_join($@, lt_decl_varnames_tagged([$1],
-			lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl
-])
-
-
-# _LT_CONFIG_STATUS_DECLARE([VARNAME])
-# ------------------------------------
-# Quote a variable value, and forward it to `config.status' so that its
-# declaration there will have the same value as in `configure'.  VARNAME
-# must have a single quote delimited value for this to work.
-m4_define([_LT_CONFIG_STATUS_DECLARE],
-[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`'])
-
-
-# _LT_CONFIG_STATUS_DECLARATIONS
-# ------------------------------
-# We delimit libtool config variables with single quotes, so when
-# we write them to config.status, we have to be sure to quote all
-# embedded single quotes properly.  In configure, this macro expands
-# each variable declared with _LT_DECL (and _LT_TAGDECL) into:
-#
-#    <var>='`$ECHO "$<var>" | $SED "$delay_single_quote_subst"`'
-m4_defun([_LT_CONFIG_STATUS_DECLARATIONS],
-[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames),
-    [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])])
-
-
-# _LT_LIBTOOL_TAGS
-# ----------------
-# Output comment and list of tags supported by the script
-m4_defun([_LT_LIBTOOL_TAGS],
-[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl
-available_tags="_LT_TAGS"dnl
-])
-
-
-# _LT_LIBTOOL_DECLARE(VARNAME, [TAG])
-# -----------------------------------
-# Extract the dictionary values for VARNAME (optionally with TAG) and
-# expand to a commented shell variable setting:
-#
-#    # Some comment about what VAR is for.
-#    visible_name=$lt_internal_name
-m4_define([_LT_LIBTOOL_DECLARE],
-[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1],
-					   [description])))[]dnl
-m4_pushdef([_libtool_name],
-    m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl
-m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])),
-    [0], [_libtool_name=[$]$1],
-    [1], [_libtool_name=$lt_[]$1],
-    [2], [_libtool_name=$lt_[]$1],
-    [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl
-m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl
-])
-
-
-# _LT_LIBTOOL_CONFIG_VARS
-# -----------------------
-# Produce commented declarations of non-tagged libtool config variables
-# suitable for insertion in the LIBTOOL CONFIG section of the `libtool'
-# script.  Tagged libtool config variables (even for the LIBTOOL CONFIG
-# section) are produced by _LT_LIBTOOL_TAG_VARS.
-m4_defun([_LT_LIBTOOL_CONFIG_VARS],
-[m4_foreach([_lt_var],
-    m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)),
-    [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])])
-
-
-# _LT_LIBTOOL_TAG_VARS(TAG)
-# -------------------------
-m4_define([_LT_LIBTOOL_TAG_VARS],
-[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames),
-    [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])])
-
-
-# _LT_TAGVAR(VARNAME, [TAGNAME])
-# ------------------------------
-m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])])
-
-
-# _LT_CONFIG_COMMANDS
-# -------------------
-# Send accumulated output to $CONFIG_STATUS.  Thanks to the lists of
-# variables for single and double quote escaping we saved from calls
-# to _LT_DECL, we can put quote escaped variables declarations
-# into `config.status', and then the shell code to quote escape them in
-# for loops in `config.status'.  Finally, any additional code accumulated
-# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded.
-m4_defun([_LT_CONFIG_COMMANDS],
-[AC_PROVIDE_IFELSE([LT_OUTPUT],
-	dnl If the libtool generation code has been placed in $CONFIG_LT,
-	dnl instead of duplicating it all over again into config.status,
-	dnl then we will have config.status run $CONFIG_LT later, so it
-	dnl needs to know what name is stored there:
-        [AC_CONFIG_COMMANDS([libtool],
-            [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])],
-    dnl If the libtool generation code is destined for config.status,
-    dnl expand the accumulated commands and init code now:
-    [AC_CONFIG_COMMANDS([libtool],
-        [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])])
-])#_LT_CONFIG_COMMANDS
-
-
-# Initialize.
-m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT],
-[
-
-# The HP-UX ksh and POSIX shell print the target directory to stdout
-# if CDPATH is set.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
-sed_quote_subst='$sed_quote_subst'
-double_quote_subst='$double_quote_subst'
-delay_variable_subst='$delay_variable_subst'
-_LT_CONFIG_STATUS_DECLARATIONS
-LTCC='$LTCC'
-LTCFLAGS='$LTCFLAGS'
-compiler='$compiler_DEFAULT'
-
-# A function that is used when there is no print builtin or printf.
-func_fallback_echo ()
-{
-  eval 'cat <<_LTECHO_EOF
-\$[]1
-_LTECHO_EOF'
-}
-
-# Quote evaled strings.
-for var in lt_decl_all_varnames([[ \
-]], lt_decl_quote_varnames); do
-    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
-    *[[\\\\\\\`\\"\\\$]]*)
-      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
-      ;;
-    *)
-      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
-      ;;
-    esac
-done
-
-# Double-quote double-evaled strings.
-for var in lt_decl_all_varnames([[ \
-]], lt_decl_dquote_varnames); do
-    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
-    *[[\\\\\\\`\\"\\\$]]*)
-      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
-      ;;
-    *)
-      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
-      ;;
-    esac
-done
-
-_LT_OUTPUT_LIBTOOL_INIT
-])
-
-# _LT_GENERATED_FILE_INIT(FILE, [COMMENT])
-# ------------------------------------
-# Generate a child script FILE with all initialization necessary to
-# reuse the environment learned by the parent script, and make the
-# file executable.  If COMMENT is supplied, it is inserted after the
-# `#!' sequence but before initialization text begins.  After this
-# macro, additional text can be appended to FILE to form the body of
-# the child script.  The macro ends with non-zero status if the
-# file could not be fully written (such as if the disk is full).
-m4_ifdef([AS_INIT_GENERATED],
-[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])],
-[m4_defun([_LT_GENERATED_FILE_INIT],
-[m4_require([AS_PREPARE])]dnl
-[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl
-[lt_write_fail=0
-cat >$1 <<_ASEOF || lt_write_fail=1
-#! $SHELL
-# Generated by $as_me.
-$2
-SHELL=\${CONFIG_SHELL-$SHELL}
-export SHELL
-_ASEOF
-cat >>$1 <<\_ASEOF || lt_write_fail=1
-AS_SHELL_SANITIZE
-_AS_PREPARE
-exec AS_MESSAGE_FD>&1
-_ASEOF
-test $lt_write_fail = 0 && chmod +x $1[]dnl
-m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT
-
-# LT_OUTPUT
-# ---------
-# This macro allows early generation of the libtool script (before
-# AC_OUTPUT is called), incase it is used in configure for compilation
-# tests.
-AC_DEFUN([LT_OUTPUT],
-[: ${CONFIG_LT=./config.lt}
-AC_MSG_NOTICE([creating $CONFIG_LT])
-_LT_GENERATED_FILE_INIT(["$CONFIG_LT"],
-[# Run this file to recreate a libtool stub with the current configuration.])
-
-cat >>"$CONFIG_LT" <<\_LTEOF
-lt_cl_silent=false
-exec AS_MESSAGE_LOG_FD>>config.log
-{
-  echo
-  AS_BOX([Running $as_me.])
-} >&AS_MESSAGE_LOG_FD
-
-lt_cl_help="\
-\`$as_me' creates a local libtool stub from the current configuration,
-for use in further configure time tests before the real libtool is
-generated.
-
-Usage: $[0] [[OPTIONS]]
-
-  -h, --help      print this help, then exit
-  -V, --version   print version number, then exit
-  -q, --quiet     do not print progress messages
-  -d, --debug     don't remove temporary files
-
-Report bugs to <bug-libtool at gnu.org>."
-
-lt_cl_version="\
-m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl
-m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])
-configured by $[0], generated by m4_PACKAGE_STRING.
-
-Copyright (C) 2011 Free Software Foundation, Inc.
-This config.lt script is free software; the Free Software Foundation
-gives unlimited permision to copy, distribute and modify it."
-
-while test $[#] != 0
-do
-  case $[1] in
-    --version | --v* | -V )
-      echo "$lt_cl_version"; exit 0 ;;
-    --help | --h* | -h )
-      echo "$lt_cl_help"; exit 0 ;;
-    --debug | --d* | -d )
-      debug=: ;;
-    --quiet | --q* | --silent | --s* | -q )
-      lt_cl_silent=: ;;
-
-    -*) AC_MSG_ERROR([unrecognized option: $[1]
-Try \`$[0] --help' for more information.]) ;;
-
-    *) AC_MSG_ERROR([unrecognized argument: $[1]
-Try \`$[0] --help' for more information.]) ;;
-  esac
-  shift
-done
-
-if $lt_cl_silent; then
-  exec AS_MESSAGE_FD>/dev/null
-fi
-_LTEOF
-
-cat >>"$CONFIG_LT" <<_LTEOF
-_LT_OUTPUT_LIBTOOL_COMMANDS_INIT
-_LTEOF
-
-cat >>"$CONFIG_LT" <<\_LTEOF
-AC_MSG_NOTICE([creating $ofile])
-_LT_OUTPUT_LIBTOOL_COMMANDS
-AS_EXIT(0)
-_LTEOF
-chmod +x "$CONFIG_LT"
-
-# configure is writing to config.log, but config.lt does its own redirection,
-# appending to config.log, which fails on DOS, as config.log is still kept
-# open by configure.  Here we exec the FD to /dev/null, effectively closing
-# config.log, so it can be properly (re)opened and appended to by config.lt.
-lt_cl_success=:
-test "$silent" = yes &&
-  lt_config_lt_args="$lt_config_lt_args --quiet"
-exec AS_MESSAGE_LOG_FD>/dev/null
-$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
-exec AS_MESSAGE_LOG_FD>>config.log
-$lt_cl_success || AS_EXIT(1)
-])# LT_OUTPUT
-
-
-# _LT_CONFIG(TAG)
-# ---------------
-# If TAG is the built-in tag, create an initial libtool script with a
-# default configuration from the untagged config vars.  Otherwise add code
-# to config.status for appending the configuration named by TAG from the
-# matching tagged config vars.
-m4_defun([_LT_CONFIG],
-[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-_LT_CONFIG_SAVE_COMMANDS([
-  m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl
-  m4_if(_LT_TAG, [C], [
-    # See if we are running on zsh, and set the options which allow our
-    # commands through without removal of \ escapes.
-    if test -n "${ZSH_VERSION+set}" ; then
-      setopt NO_GLOB_SUBST
-    fi
-
-    cfgfile="${ofile}T"
-    trap "$RM \"$cfgfile\"; exit 1" 1 2 15
-    $RM "$cfgfile"
-
-    cat <<_LT_EOF >> "$cfgfile"
-#! $SHELL
-
-# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
-# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
-# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
-# NOTE: Changes made to this file will be lost: look at ltmain.sh.
-#
-_LT_COPYING
-_LT_LIBTOOL_TAGS
-
-# ### BEGIN LIBTOOL CONFIG
-_LT_LIBTOOL_CONFIG_VARS
-_LT_LIBTOOL_TAG_VARS
-# ### END LIBTOOL CONFIG
-
-_LT_EOF
-
-  case $host_os in
-  aix3*)
-    cat <<\_LT_EOF >> "$cfgfile"
-# AIX sometimes has problems with the GCC collect2 program.  For some
-# reason, if we set the COLLECT_NAMES environment variable, the problems
-# vanish in a puff of smoke.
-if test "X${COLLECT_NAMES+set}" != Xset; then
-  COLLECT_NAMES=
-  export COLLECT_NAMES
-fi
-_LT_EOF
-    ;;
-  esac
-
-  _LT_PROG_LTMAIN
-
-  # We use sed instead of cat because bash on DJGPP gets confused if
-  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
-  # text mode, it properly converts lines to CR/LF.  This bash problem
-  # is reportedly fixed, but why not run on old versions too?
-  sed '$q' "$ltmain" >> "$cfgfile" \
-     || (rm -f "$cfgfile"; exit 1)
-
-  _LT_PROG_REPLACE_SHELLFNS
-
-   mv -f "$cfgfile" "$ofile" ||
-    (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
-  chmod +x "$ofile"
-],
-[cat <<_LT_EOF >> "$ofile"
-
-dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded
-dnl in a comment (ie after a #).
-# ### BEGIN LIBTOOL TAG CONFIG: $1
-_LT_LIBTOOL_TAG_VARS(_LT_TAG)
-# ### END LIBTOOL TAG CONFIG: $1
-_LT_EOF
-])dnl /m4_if
-],
-[m4_if([$1], [], [
-    PACKAGE='$PACKAGE'
-    VERSION='$VERSION'
-    TIMESTAMP='$TIMESTAMP'
-    RM='$RM'
-    ofile='$ofile'], [])
-])dnl /_LT_CONFIG_SAVE_COMMANDS
-])# _LT_CONFIG
-
-
-# LT_SUPPORTED_TAG(TAG)
-# ---------------------
-# Trace this macro to discover what tags are supported by the libtool
-# --tag option, using:
-#    autoconf --trace 'LT_SUPPORTED_TAG:$1'
-AC_DEFUN([LT_SUPPORTED_TAG], [])
-
-
-# C support is built-in for now
-m4_define([_LT_LANG_C_enabled], [])
-m4_define([_LT_TAGS], [])
-
-
-# LT_LANG(LANG)
-# -------------
-# Enable libtool support for the given language if not already enabled.
-AC_DEFUN([LT_LANG],
-[AC_BEFORE([$0], [LT_OUTPUT])dnl
-m4_case([$1],
-  [C],			[_LT_LANG(C)],
-  [C++],		[_LT_LANG(CXX)],
-  [Go],			[_LT_LANG(GO)],
-  [Java],		[_LT_LANG(GCJ)],
-  [Fortran 77],		[_LT_LANG(F77)],
-  [Fortran],		[_LT_LANG(FC)],
-  [Windows Resource],	[_LT_LANG(RC)],
-  [m4_ifdef([_LT_LANG_]$1[_CONFIG],
-    [_LT_LANG($1)],
-    [m4_fatal([$0: unsupported language: "$1"])])])dnl
-])# LT_LANG
-
-
-# _LT_LANG(LANGNAME)
-# ------------------
-m4_defun([_LT_LANG],
-[m4_ifdef([_LT_LANG_]$1[_enabled], [],
-  [LT_SUPPORTED_TAG([$1])dnl
-  m4_append([_LT_TAGS], [$1 ])dnl
-  m4_define([_LT_LANG_]$1[_enabled], [])dnl
-  _LT_LANG_$1_CONFIG($1)])dnl
-])# _LT_LANG
-
-
-m4_ifndef([AC_PROG_GO], [
-# NOTE: This macro has been submitted for inclusion into   #
-#  GNU Autoconf as AC_PROG_GO.  When it is available in    #
-#  a released version of Autoconf we should remove this    #
-#  macro and use it instead.                               #
-m4_defun([AC_PROG_GO],
-[AC_LANG_PUSH(Go)dnl
-AC_ARG_VAR([GOC],     [Go compiler command])dnl
-AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl
-_AC_ARG_VAR_LDFLAGS()dnl
-AC_CHECK_TOOL(GOC, gccgo)
-if test -z "$GOC"; then
-  if test -n "$ac_tool_prefix"; then
-    AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo])
-  fi
-fi
-if test -z "$GOC"; then
-  AC_CHECK_PROG(GOC, gccgo, gccgo, false)
-fi
-])#m4_defun
-])#m4_ifndef
-
-
-# _LT_LANG_DEFAULT_CONFIG
-# -----------------------
-m4_defun([_LT_LANG_DEFAULT_CONFIG],
-[AC_PROVIDE_IFELSE([AC_PROG_CXX],
-  [LT_LANG(CXX)],
-  [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])])
-
-AC_PROVIDE_IFELSE([AC_PROG_F77],
-  [LT_LANG(F77)],
-  [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])])
-
-AC_PROVIDE_IFELSE([AC_PROG_FC],
-  [LT_LANG(FC)],
-  [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])])
-
-dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal
-dnl pulling things in needlessly.
-AC_PROVIDE_IFELSE([AC_PROG_GCJ],
-  [LT_LANG(GCJ)],
-  [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
-    [LT_LANG(GCJ)],
-    [AC_PROVIDE_IFELSE([LT_PROG_GCJ],
-      [LT_LANG(GCJ)],
-      [m4_ifdef([AC_PROG_GCJ],
-	[m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])])
-       m4_ifdef([A][M_PROG_GCJ],
-	[m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])])
-       m4_ifdef([LT_PROG_GCJ],
-	[m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])])
-
-AC_PROVIDE_IFELSE([AC_PROG_GO],
-  [LT_LANG(GO)],
-  [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])])
-
-AC_PROVIDE_IFELSE([LT_PROG_RC],
-  [LT_LANG(RC)],
-  [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])])
-])# _LT_LANG_DEFAULT_CONFIG
-
-# Obsolete macros:
-AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)])
-AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)])
-AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)])
-AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)])
-AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_LIBTOOL_CXX], [])
-dnl AC_DEFUN([AC_LIBTOOL_F77], [])
-dnl AC_DEFUN([AC_LIBTOOL_FC], [])
-dnl AC_DEFUN([AC_LIBTOOL_GCJ], [])
-dnl AC_DEFUN([AC_LIBTOOL_RC], [])
-
-
-# _LT_TAG_COMPILER
-# ----------------
-m4_defun([_LT_TAG_COMPILER],
-[AC_REQUIRE([AC_PROG_CC])dnl
-
-_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl
-_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl
-_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl
-_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl
-
-# If no C compiler was specified, use CC.
-LTCC=${LTCC-"$CC"}
-
-# If no C compiler flags were specified, use CFLAGS.
-LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
-
-# Allow CC to be a program name with arguments.
-compiler=$CC
-])# _LT_TAG_COMPILER
-
-
-# _LT_COMPILER_BOILERPLATE
-# ------------------------
-# Check for compiler boilerplate output or warnings with
-# the simple compiler test code.
-m4_defun([_LT_COMPILER_BOILERPLATE],
-[m4_require([_LT_DECL_SED])dnl
-ac_outfile=conftest.$ac_objext
-echo "$lt_simple_compile_test_code" >conftest.$ac_ext
-eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
-_lt_compiler_boilerplate=`cat conftest.err`
-$RM conftest*
-])# _LT_COMPILER_BOILERPLATE
-
-
-# _LT_LINKER_BOILERPLATE
-# ----------------------
-# Check for linker boilerplate output or warnings with
-# the simple link test code.
-m4_defun([_LT_LINKER_BOILERPLATE],
-[m4_require([_LT_DECL_SED])dnl
-ac_outfile=conftest.$ac_objext
-echo "$lt_simple_link_test_code" >conftest.$ac_ext
-eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
-_lt_linker_boilerplate=`cat conftest.err`
-$RM -r conftest*
-])# _LT_LINKER_BOILERPLATE
-
-# _LT_REQUIRED_DARWIN_CHECKS
-# -------------------------
-m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
-  case $host_os in
-    rhapsody* | darwin*)
-    AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:])
-    AC_CHECK_TOOL([NMEDIT], [nmedit], [:])
-    AC_CHECK_TOOL([LIPO], [lipo], [:])
-    AC_CHECK_TOOL([OTOOL], [otool], [:])
-    AC_CHECK_TOOL([OTOOL64], [otool64], [:])
-    _LT_DECL([], [DSYMUTIL], [1],
-      [Tool to manipulate archived DWARF debug symbol files on Mac OS X])
-    _LT_DECL([], [NMEDIT], [1],
-      [Tool to change global to local symbols on Mac OS X])
-    _LT_DECL([], [LIPO], [1],
-      [Tool to manipulate fat objects and archives on Mac OS X])
-    _LT_DECL([], [OTOOL], [1],
-      [ldd/readelf like tool for Mach-O binaries on Mac OS X])
-    _LT_DECL([], [OTOOL64], [1],
-      [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4])
-
-    AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod],
-      [lt_cv_apple_cc_single_mod=no
-      if test -z "${LT_MULTI_MODULE}"; then
-	# By default we will add the -single_module flag. You can override
-	# by either setting the environment variable LT_MULTI_MODULE
-	# non-empty at configure time, or by adding -multi_module to the
-	# link flags.
-	rm -rf libconftest.dylib*
-	echo "int foo(void){return 1;}" > conftest.c
-	echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
--dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD
-	$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
-	  -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
-        _lt_result=$?
-	# If there is a non-empty error log, and "single_module"
-	# appears in it, assume the flag caused a linker warning
-        if test -s conftest.err && $GREP single_module conftest.err; then
-	  cat conftest.err >&AS_MESSAGE_LOG_FD
-	# Otherwise, if the output was created with a 0 exit code from
-	# the compiler, it worked.
-	elif test -f libconftest.dylib && test $_lt_result -eq 0; then
-	  lt_cv_apple_cc_single_mod=yes
-	else
-	  cat conftest.err >&AS_MESSAGE_LOG_FD
-	fi
-	rm -rf libconftest.dylib*
-	rm -f conftest.*
-      fi])
-
-    AC_CACHE_CHECK([for -exported_symbols_list linker flag],
-      [lt_cv_ld_exported_symbols_list],
-      [lt_cv_ld_exported_symbols_list=no
-      save_LDFLAGS=$LDFLAGS
-      echo "_main" > conftest.sym
-      LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
-      AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
-	[lt_cv_ld_exported_symbols_list=yes],
-	[lt_cv_ld_exported_symbols_list=no])
-	LDFLAGS="$save_LDFLAGS"
-    ])
-
-    AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load],
-      [lt_cv_ld_force_load=no
-      cat > conftest.c << _LT_EOF
-int forced_loaded() { return 2;}
-_LT_EOF
-      echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD
-      $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD
-      echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD
-      $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD
-      echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD
-      $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD
-      cat > conftest.c << _LT_EOF
-int main() { return 0;}
-_LT_EOF
-      echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD
-      $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
-      _lt_result=$?
-      if test -s conftest.err && $GREP force_load conftest.err; then
-	cat conftest.err >&AS_MESSAGE_LOG_FD
-      elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then
-	lt_cv_ld_force_load=yes
-      else
-	cat conftest.err >&AS_MESSAGE_LOG_FD
-      fi
-        rm -f conftest.err libconftest.a conftest conftest.c
-        rm -rf conftest.dSYM
-    ])
-    case $host_os in
-    rhapsody* | darwin1.[[012]])
-      _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
-    darwin1.*)
-      _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
-    darwin*) # darwin 5.x on
-      # if running on 10.5 or later, the deployment target defaults
-      # to the OS version, if on x86, and 10.4, the deployment
-      # target defaults to 10.4. Don't you love it?
-      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
-	10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
-	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
-	10.[[012]]*)
-	  _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
-	10.*)
-	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
-      esac
-    ;;
-  esac
-    if test "$lt_cv_apple_cc_single_mod" = "yes"; then
-      _lt_dar_single_mod='$single_module'
-    fi
-    if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
-      _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
-    else
-      _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
-    fi
-    if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
-      _lt_dsymutil='~$DSYMUTIL $lib || :'
-    else
-      _lt_dsymutil=
-    fi
-    ;;
-  esac
-])
-
-
-# _LT_DARWIN_LINKER_FEATURES([TAG])
-# ---------------------------------
-# Checks for linker and compiler features on darwin
-m4_defun([_LT_DARWIN_LINKER_FEATURES],
-[
-  m4_require([_LT_REQUIRED_DARWIN_CHECKS])
-  _LT_TAGVAR(archive_cmds_need_lc, $1)=no
-  _LT_TAGVAR(hardcode_direct, $1)=no
-  _LT_TAGVAR(hardcode_automatic, $1)=yes
-  _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
-  if test "$lt_cv_ld_force_load" = "yes"; then
-    _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
-    m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes],
-                  [FC],  [_LT_TAGVAR(compiler_needs_object, $1)=yes])
-  else
-    _LT_TAGVAR(whole_archive_flag_spec, $1)=''
-  fi
-  _LT_TAGVAR(link_all_deplibs, $1)=yes
-  _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
-  case $cc_basename in
-     ifort*) _lt_dar_can_shared=yes ;;
-     *) _lt_dar_can_shared=$GCC ;;
-  esac
-  if test "$_lt_dar_can_shared" = "yes"; then
-    output_verbose_link_cmd=func_echo_all
-    _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
-    _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
-    _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
-    _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
-    m4_if([$1], [CXX],
-[   if test "$lt_cv_apple_cc_single_mod" != "yes"; then
-      _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
-      _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
-    fi
-],[])
-  else
-  _LT_TAGVAR(ld_shlibs, $1)=no
-  fi
-])
-
-# _LT_SYS_MODULE_PATH_AIX([TAGNAME])
-# ----------------------------------
-# Links a minimal program and checks the executable
-# for the system default hardcoded library path. In most cases,
-# this is /usr/lib:/lib, but when the MPI compilers are used
-# the location of the communication and MPI libs are included too.
-# If we don't find anything, use the default library path according
-# to the aix ld manual.
-# Store the results from the different compilers for each TAGNAME.
-# Allow to override them for all tags through lt_cv_aix_libpath.
-m4_defun([_LT_SYS_MODULE_PATH_AIX],
-[m4_require([_LT_DECL_SED])dnl
-if test "${lt_cv_aix_libpath+set}" = set; then
-  aix_libpath=$lt_cv_aix_libpath
-else
-  AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])],
-  [AC_LINK_IFELSE([AC_LANG_PROGRAM],[
-  lt_aix_libpath_sed='[
-      /Import File Strings/,/^$/ {
-	  /^0/ {
-	      s/^0  *\([^ ]*\) *$/\1/
-	      p
-	  }
-      }]'
-  _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-  # Check for a 64-bit object if we didn't find anything.
-  if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
-    _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-  fi],[])
-  if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
-    _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib"
-  fi
-  ])
-  aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])
-fi
-])# _LT_SYS_MODULE_PATH_AIX
-
-
-# _LT_SHELL_INIT(ARG)
-# -------------------
-m4_define([_LT_SHELL_INIT],
-[m4_divert_text([M4SH-INIT], [$1
-])])# _LT_SHELL_INIT
-
-
-
-# _LT_PROG_ECHO_BACKSLASH
-# -----------------------
-# Find how we can fake an echo command that does not interpret backslash.
-# In particular, with Autoconf 2.60 or later we add some code to the start
-# of the generated configure script which will find a shell with a builtin
-# printf (which we can use as an echo command).
-m4_defun([_LT_PROG_ECHO_BACKSLASH],
-[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
-ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
-ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
-
-AC_MSG_CHECKING([how to print strings])
-# Test print first, because it will be a builtin if present.
-if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
-   test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
-  ECHO='print -r --'
-elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
-  ECHO='printf %s\n'
-else
-  # Use this function as a fallback that always works.
-  func_fallback_echo ()
-  {
-    eval 'cat <<_LTECHO_EOF
-$[]1
-_LTECHO_EOF'
-  }
-  ECHO='func_fallback_echo'
-fi
-
-# func_echo_all arg...
-# Invoke $ECHO with all args, space-separated.
-func_echo_all ()
-{
-    $ECHO "$*" 
-}
-
-case "$ECHO" in
-  printf*) AC_MSG_RESULT([printf]) ;;
-  print*) AC_MSG_RESULT([print -r]) ;;
-  *) AC_MSG_RESULT([cat]) ;;
-esac
-
-m4_ifdef([_AS_DETECT_SUGGESTED],
-[_AS_DETECT_SUGGESTED([
-  test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || (
-    ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
-    ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
-    ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
-    PATH=/empty FPATH=/empty; export PATH FPATH
-    test "X`printf %s $ECHO`" = "X$ECHO" \
-      || test "X`print -r -- $ECHO`" = "X$ECHO" )])])
-
-_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts])
-_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes])
-])# _LT_PROG_ECHO_BACKSLASH
-
-
-# _LT_WITH_SYSROOT
-# ----------------
-AC_DEFUN([_LT_WITH_SYSROOT],
-[AC_MSG_CHECKING([for sysroot])
-AC_ARG_WITH([sysroot],
-[  --with-sysroot[=DIR] Search for dependent libraries within DIR
-                        (or the compiler's sysroot if not specified).],
-[], [with_sysroot=no])
-
-dnl lt_sysroot will always be passed unquoted.  We quote it here
-dnl in case the user passed a directory name.
-lt_sysroot=
-case ${with_sysroot} in #(
- yes)
-   if test "$GCC" = yes; then
-     lt_sysroot=`$CC --print-sysroot 2>/dev/null`
-   fi
-   ;; #(
- /*)
-   lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
-   ;; #(
- no|'')
-   ;; #(
- *)
-   AC_MSG_RESULT([${with_sysroot}])
-   AC_MSG_ERROR([The sysroot must be an absolute path.])
-   ;;
-esac
-
- AC_MSG_RESULT([${lt_sysroot:-no}])
-_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl
-[dependent libraries, and in which our libraries should be installed.])])
-
-# _LT_ENABLE_LOCK
-# ---------------
-m4_defun([_LT_ENABLE_LOCK],
-[AC_ARG_ENABLE([libtool-lock],
-  [AS_HELP_STRING([--disable-libtool-lock],
-    [avoid locking (might break parallel builds)])])
-test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
-
-# Some flags need to be propagated to the compiler or linker for good
-# libtool support.
-case $host in
-ia64-*-hpux*)
-  # Find out which ABI we are using.
-  echo 'int i;' > conftest.$ac_ext
-  if AC_TRY_EVAL(ac_compile); then
-    case `/usr/bin/file conftest.$ac_objext` in
-      *ELF-32*)
-	HPUX_IA64_MODE="32"
-	;;
-      *ELF-64*)
-	HPUX_IA64_MODE="64"
-	;;
-    esac
-  fi
-  rm -rf conftest*
-  ;;
-*-*-irix6*)
-  # Find out which ABI we are using.
-  echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext
-  if AC_TRY_EVAL(ac_compile); then
-    if test "$lt_cv_prog_gnu_ld" = yes; then
-      case `/usr/bin/file conftest.$ac_objext` in
-	*32-bit*)
-	  LD="${LD-ld} -melf32bsmip"
-	  ;;
-	*N32*)
-	  LD="${LD-ld} -melf32bmipn32"
-	  ;;
-	*64-bit*)
-	  LD="${LD-ld} -melf64bmip"
-	;;
-      esac
-    else
-      case `/usr/bin/file conftest.$ac_objext` in
-	*32-bit*)
-	  LD="${LD-ld} -32"
-	  ;;
-	*N32*)
-	  LD="${LD-ld} -n32"
-	  ;;
-	*64-bit*)
-	  LD="${LD-ld} -64"
-	  ;;
-      esac
-    fi
-  fi
-  rm -rf conftest*
-  ;;
-
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
-s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
-  # Find out which ABI we are using.
-  echo 'int i;' > conftest.$ac_ext
-  if AC_TRY_EVAL(ac_compile); then
-    case `/usr/bin/file conftest.o` in
-      *32-bit*)
-	case $host in
-	  x86_64-*kfreebsd*-gnu)
-	    LD="${LD-ld} -m elf_i386_fbsd"
-	    ;;
-	  x86_64-*linux*)
-	    LD="${LD-ld} -m elf_i386"
-	    ;;
-	  ppc64-*linux*|powerpc64-*linux*)
-	    LD="${LD-ld} -m elf32ppclinux"
-	    ;;
-	  s390x-*linux*)
-	    LD="${LD-ld} -m elf_s390"
-	    ;;
-	  sparc64-*linux*)
-	    LD="${LD-ld} -m elf32_sparc"
-	    ;;
-	esac
-	;;
-      *64-bit*)
-	case $host in
-	  x86_64-*kfreebsd*-gnu)
-	    LD="${LD-ld} -m elf_x86_64_fbsd"
-	    ;;
-	  x86_64-*linux*)
-	    LD="${LD-ld} -m elf_x86_64"
-	    ;;
-	  ppc*-*linux*|powerpc*-*linux*)
-	    LD="${LD-ld} -m elf64ppc"
-	    ;;
-	  s390*-*linux*|s390*-*tpf*)
-	    LD="${LD-ld} -m elf64_s390"
-	    ;;
-	  sparc*-*linux*)
-	    LD="${LD-ld} -m elf64_sparc"
-	    ;;
-	esac
-	;;
-    esac
-  fi
-  rm -rf conftest*
-  ;;
-
-*-*-sco3.2v5*)
-  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
-  SAVE_CFLAGS="$CFLAGS"
-  CFLAGS="$CFLAGS -belf"
-  AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
-    [AC_LANG_PUSH(C)
-     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
-     AC_LANG_POP])
-  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
-    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
-    CFLAGS="$SAVE_CFLAGS"
-  fi
-  ;;
-*-*solaris*)
-  # Find out which ABI we are using.
-  echo 'int i;' > conftest.$ac_ext
-  if AC_TRY_EVAL(ac_compile); then
-    case `/usr/bin/file conftest.o` in
-    *64-bit*)
-      case $lt_cv_prog_gnu_ld in
-      yes*)
-        case $host in
-        i?86-*-solaris*)
-          LD="${LD-ld} -m elf_x86_64"
-          ;;
-        sparc*-*-solaris*)
-          LD="${LD-ld} -m elf64_sparc"
-          ;;
-        esac
-        # GNU ld 2.21 introduced _sol2 emulations.  Use them if available.
-        if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
-          LD="${LD-ld}_sol2"
-        fi
-        ;;
-      *)
-	if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
-	  LD="${LD-ld} -64"
-	fi
-	;;
-      esac
-      ;;
-    esac
-  fi
-  rm -rf conftest*
-  ;;
-esac
-
-need_locks="$enable_libtool_lock"
-])# _LT_ENABLE_LOCK
-
-
-# _LT_PROG_AR
-# -----------
-m4_defun([_LT_PROG_AR],
-[AC_CHECK_TOOLS(AR, [ar], false)
-: ${AR=ar}
-: ${AR_FLAGS=cru}
-_LT_DECL([], [AR], [1], [The archiver])
-_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive])
-
-AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file],
-  [lt_cv_ar_at_file=no
-   AC_COMPILE_IFELSE([AC_LANG_PROGRAM],
-     [echo conftest.$ac_objext > conftest.lst
-      lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD'
-      AC_TRY_EVAL([lt_ar_try])
-      if test "$ac_status" -eq 0; then
-	# Ensure the archiver fails upon bogus file names.
-	rm -f conftest.$ac_objext libconftest.a
-	AC_TRY_EVAL([lt_ar_try])
-	if test "$ac_status" -ne 0; then
-          lt_cv_ar_at_file=@
-        fi
-      fi
-      rm -f conftest.* libconftest.a
-     ])
-  ])
-
-if test "x$lt_cv_ar_at_file" = xno; then
-  archiver_list_spec=
-else
-  archiver_list_spec=$lt_cv_ar_at_file
-fi
-_LT_DECL([], [archiver_list_spec], [1],
-  [How to feed a file listing to the archiver])
-])# _LT_PROG_AR
-
-
-# _LT_CMD_OLD_ARCHIVE
-# -------------------
-m4_defun([_LT_CMD_OLD_ARCHIVE],
-[_LT_PROG_AR
-
-AC_CHECK_TOOL(STRIP, strip, :)
-test -z "$STRIP" && STRIP=:
-_LT_DECL([], [STRIP], [1], [A symbol stripping program])
-
-AC_CHECK_TOOL(RANLIB, ranlib, :)
-test -z "$RANLIB" && RANLIB=:
-_LT_DECL([], [RANLIB], [1],
-    [Commands used to install an old-style archive])
-
-# Determine commands to create old-style static archives.
-old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
-old_postinstall_cmds='chmod 644 $oldlib'
-old_postuninstall_cmds=
-
-if test -n "$RANLIB"; then
-  case $host_os in
-  openbsd*)
-    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
-    ;;
-  *)
-    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
-    ;;
-  esac
-  old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib"
-fi
-
-case $host_os in
-  darwin*)
-    lock_old_archive_extraction=yes ;;
-  *)
-    lock_old_archive_extraction=no ;;
-esac
-_LT_DECL([], [old_postinstall_cmds], [2])
-_LT_DECL([], [old_postuninstall_cmds], [2])
-_LT_TAGDECL([], [old_archive_cmds], [2],
-    [Commands used to build an old-style archive])
-_LT_DECL([], [lock_old_archive_extraction], [0],
-    [Whether to use a lock for old archive extraction])
-])# _LT_CMD_OLD_ARCHIVE
-
-
-# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
-#		[OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
-# ----------------------------------------------------------------
-# Check whether the given compiler option works
-AC_DEFUN([_LT_COMPILER_OPTION],
-[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-m4_require([_LT_DECL_SED])dnl
-AC_CACHE_CHECK([$1], [$2],
-  [$2=no
-   m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
-   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-   lt_compiler_flag="$3"
-   # Insert the option either (1) after the last *FLAGS variable, or
-   # (2) before a word containing "conftest.", or (3) at the end.
-   # Note that $ac_compile itself does not contain backslashes and begins
-   # with a dollar sign (not a hyphen), so the echo should work correctly.
-   # The option is referenced via a variable to avoid confusing sed.
-   lt_compile=`echo "$ac_compile" | $SED \
-   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
-   -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
-   (eval "$lt_compile" 2>conftest.err)
-   ac_status=$?
-   cat conftest.err >&AS_MESSAGE_LOG_FD
-   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
-   if (exit $ac_status) && test -s "$ac_outfile"; then
-     # The compiler can only warn and ignore the option if not recognized
-     # So say no if there are warnings other than the usual output.
-     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
-     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
-     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
-       $2=yes
-     fi
-   fi
-   $RM conftest*
-])
-
-if test x"[$]$2" = xyes; then
-    m4_if([$5], , :, [$5])
-else
-    m4_if([$6], , :, [$6])
-fi
-])# _LT_COMPILER_OPTION
-
-# Old name:
-AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [])
-
-
-# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
-#                  [ACTION-SUCCESS], [ACTION-FAILURE])
-# ----------------------------------------------------
-# Check whether the given linker option works
-AC_DEFUN([_LT_LINKER_OPTION],
-[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-m4_require([_LT_DECL_SED])dnl
-AC_CACHE_CHECK([$1], [$2],
-  [$2=no
-   save_LDFLAGS="$LDFLAGS"
-   LDFLAGS="$LDFLAGS $3"
-   echo "$lt_simple_link_test_code" > conftest.$ac_ext
-   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
-     # The linker can only warn and ignore the option if not recognized
-     # So say no if there are warnings
-     if test -s conftest.err; then
-       # Append any errors to the config.log.
-       cat conftest.err 1>&AS_MESSAGE_LOG_FD
-       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
-       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
-       if diff conftest.exp conftest.er2 >/dev/null; then
-         $2=yes
-       fi
-     else
-       $2=yes
-     fi
-   fi
-   $RM -r conftest*
-   LDFLAGS="$save_LDFLAGS"
-])
-
-if test x"[$]$2" = xyes; then
-    m4_if([$4], , :, [$4])
-else
-    m4_if([$5], , :, [$5])
-fi
-])# _LT_LINKER_OPTION
-
-# Old name:
-AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], [])
-
-
-# LT_CMD_MAX_LEN
-#---------------
-AC_DEFUN([LT_CMD_MAX_LEN],
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-# find the maximum length of command line arguments
-AC_MSG_CHECKING([the maximum length of command line arguments])
-AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
-  i=0
-  teststring="ABCD"
-
-  case $build_os in
-  msdosdjgpp*)
-    # On DJGPP, this test can blow up pretty badly due to problems in libc
-    # (any single argument exceeding 2000 bytes causes a buffer overrun
-    # during glob expansion).  Even if it were fixed, the result of this
-    # check would be larger than it should be.
-    lt_cv_sys_max_cmd_len=12288;    # 12K is about right
-    ;;
-
-  gnu*)
-    # Under GNU Hurd, this test is not required because there is
-    # no limit to the length of command line arguments.
-    # Libtool will interpret -1 as no limit whatsoever
-    lt_cv_sys_max_cmd_len=-1;
-    ;;
-
-  cygwin* | mingw* | cegcc*)
-    # On Win9x/ME, this test blows up -- it succeeds, but takes
-    # about 5 minutes as the teststring grows exponentially.
-    # Worse, since 9x/ME are not pre-emptively multitasking,
-    # you end up with a "frozen" computer, even though with patience
-    # the test eventually succeeds (with a max line length of 256k).
-    # Instead, let's just punt: use the minimum linelength reported by
-    # all of the supported platforms: 8192 (on NT/2K/XP).
-    lt_cv_sys_max_cmd_len=8192;
-    ;;
-
-  mint*)
-    # On MiNT this can take a long time and run out of memory.
-    lt_cv_sys_max_cmd_len=8192;
-    ;;
-
-  amigaos*)
-    # On AmigaOS with pdksh, this test takes hours, literally.
-    # So we just punt and use a minimum line length of 8192.
-    lt_cv_sys_max_cmd_len=8192;
-    ;;
-
-  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
-    # This has been around since 386BSD, at least.  Likely further.
-    if test -x /sbin/sysctl; then
-      lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
-    elif test -x /usr/sbin/sysctl; then
-      lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
-    else
-      lt_cv_sys_max_cmd_len=65536	# usable default for all BSDs
-    fi
-    # And add a safety zone
-    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
-    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
-    ;;
-
-  interix*)
-    # We know the value 262144 and hardcode it with a safety zone (like BSD)
-    lt_cv_sys_max_cmd_len=196608
-    ;;
-
-  os2*)
-    # The test takes a long time on OS/2.
-    lt_cv_sys_max_cmd_len=8192
-    ;;
-
-  osf*)
-    # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
-    # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
-    # nice to cause kernel panics so lets avoid the loop below.
-    # First set a reasonable default.
-    lt_cv_sys_max_cmd_len=16384
-    #
-    if test -x /sbin/sysconfig; then
-      case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
-        *1*) lt_cv_sys_max_cmd_len=-1 ;;
-      esac
-    fi
-    ;;
-  sco3.2v5*)
-    lt_cv_sys_max_cmd_len=102400
-    ;;
-  sysv5* | sco5v6* | sysv4.2uw2*)
-    kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
-    if test -n "$kargmax"; then
-      lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[	 ]]//'`
-    else
-      lt_cv_sys_max_cmd_len=32768
-    fi
-    ;;
-  *)
-    lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
-    if test -n "$lt_cv_sys_max_cmd_len"; then
-      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
-      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
-    else
-      # Make teststring a little bigger before we do anything with it.
-      # a 1K string should be a reasonable start.
-      for i in 1 2 3 4 5 6 7 8 ; do
-        teststring=$teststring$teststring
-      done
-      SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
-      # If test is not a shell built-in, we'll probably end up computing a
-      # maximum length that is only half of the actual maximum length, but
-      # we can't tell.
-      while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \
-	         = "X$teststring$teststring"; } >/dev/null 2>&1 &&
-	      test $i != 17 # 1/2 MB should be enough
-      do
-        i=`expr $i + 1`
-        teststring=$teststring$teststring
-      done
-      # Only check the string length outside the loop.
-      lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
-      teststring=
-      # Add a significant safety factor because C++ compilers can tack on
-      # massive amounts of additional arguments before passing them to the
-      # linker.  It appears as though 1/2 is a usable value.
-      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
-    fi
-    ;;
-  esac
-])
-if test -n $lt_cv_sys_max_cmd_len ; then
-  AC_MSG_RESULT($lt_cv_sys_max_cmd_len)
-else
-  AC_MSG_RESULT(none)
-fi
-max_cmd_len=$lt_cv_sys_max_cmd_len
-_LT_DECL([], [max_cmd_len], [0],
-    [What is the maximum length of a command?])
-])# LT_CMD_MAX_LEN
-
-# Old name:
-AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [])
-
-
-# _LT_HEADER_DLFCN
-# ----------------
-m4_defun([_LT_HEADER_DLFCN],
-[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl
-])# _LT_HEADER_DLFCN
-
-
-# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
-#                      ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
-# ----------------------------------------------------------------
-m4_defun([_LT_TRY_DLOPEN_SELF],
-[m4_require([_LT_HEADER_DLFCN])dnl
-if test "$cross_compiling" = yes; then :
-  [$4]
-else
-  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
-  lt_status=$lt_dlunknown
-  cat > conftest.$ac_ext <<_LT_EOF
-[#line $LINENO "configure"
-#include "confdefs.h"
-
-#if HAVE_DLFCN_H
-#include <dlfcn.h>
-#endif
-
-#include <stdio.h>
-
-#ifdef RTLD_GLOBAL
-#  define LT_DLGLOBAL		RTLD_GLOBAL
-#else
-#  ifdef DL_GLOBAL
-#    define LT_DLGLOBAL		DL_GLOBAL
-#  else
-#    define LT_DLGLOBAL		0
-#  endif
-#endif
-
-/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
-   find out it does not work in some platform. */
-#ifndef LT_DLLAZY_OR_NOW
-#  ifdef RTLD_LAZY
-#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
-#  else
-#    ifdef DL_LAZY
-#      define LT_DLLAZY_OR_NOW		DL_LAZY
-#    else
-#      ifdef RTLD_NOW
-#        define LT_DLLAZY_OR_NOW	RTLD_NOW
-#      else
-#        ifdef DL_NOW
-#          define LT_DLLAZY_OR_NOW	DL_NOW
-#        else
-#          define LT_DLLAZY_OR_NOW	0
-#        endif
-#      endif
-#    endif
-#  endif
-#endif
-
-/* When -fvisbility=hidden is used, assume the code has been annotated
-   correspondingly for the symbols needed.  */
-#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
-int fnord () __attribute__((visibility("default")));
-#endif
-
-int fnord () { return 42; }
-int main ()
-{
-  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
-  int status = $lt_dlunknown;
-
-  if (self)
-    {
-      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
-      else
-        {
-	  if (dlsym( self,"_fnord"))  status = $lt_dlneed_uscore;
-          else puts (dlerror ());
-	}
-      /* dlclose (self); */
-    }
-  else
-    puts (dlerror ());
-
-  return status;
-}]
-_LT_EOF
-  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
-    (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null
-    lt_status=$?
-    case x$lt_status in
-      x$lt_dlno_uscore) $1 ;;
-      x$lt_dlneed_uscore) $2 ;;
-      x$lt_dlunknown|x*) $3 ;;
-    esac
-  else :
-    # compilation failed
-    $3
-  fi
-fi
-rm -fr conftest*
-])# _LT_TRY_DLOPEN_SELF
-
-
-# LT_SYS_DLOPEN_SELF
-# ------------------
-AC_DEFUN([LT_SYS_DLOPEN_SELF],
-[m4_require([_LT_HEADER_DLFCN])dnl
-if test "x$enable_dlopen" != xyes; then
-  enable_dlopen=unknown
-  enable_dlopen_self=unknown
-  enable_dlopen_self_static=unknown
-else
-  lt_cv_dlopen=no
-  lt_cv_dlopen_libs=
-
-  case $host_os in
-  beos*)
-    lt_cv_dlopen="load_add_on"
-    lt_cv_dlopen_libs=
-    lt_cv_dlopen_self=yes
-    ;;
-
-  mingw* | pw32* | cegcc*)
-    lt_cv_dlopen="LoadLibrary"
-    lt_cv_dlopen_libs=
-    ;;
-
-  cygwin*)
-    lt_cv_dlopen="dlopen"
-    lt_cv_dlopen_libs=
-    ;;
-
-  darwin*)
-  # if libdl is installed we need to link against it
-    AC_CHECK_LIB([dl], [dlopen],
-		[lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[
-    lt_cv_dlopen="dyld"
-    lt_cv_dlopen_libs=
-    lt_cv_dlopen_self=yes
-    ])
-    ;;
-
-  *)
-    AC_CHECK_FUNC([shl_load],
-	  [lt_cv_dlopen="shl_load"],
-      [AC_CHECK_LIB([dld], [shl_load],
-	    [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"],
-	[AC_CHECK_FUNC([dlopen],
-	      [lt_cv_dlopen="dlopen"],
-	  [AC_CHECK_LIB([dl], [dlopen],
-		[lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
-	    [AC_CHECK_LIB([svld], [dlopen],
-		  [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
-	      [AC_CHECK_LIB([dld], [dld_link],
-		    [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"])
-	      ])
-	    ])
-	  ])
-	])
-      ])
-    ;;
-  esac
-
-  if test "x$lt_cv_dlopen" != xno; then
-    enable_dlopen=yes
-  else
-    enable_dlopen=no
-  fi
-
-  case $lt_cv_dlopen in
-  dlopen)
-    save_CPPFLAGS="$CPPFLAGS"
-    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
-
-    save_LDFLAGS="$LDFLAGS"
-    wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
-
-    save_LIBS="$LIBS"
-    LIBS="$lt_cv_dlopen_libs $LIBS"
-
-    AC_CACHE_CHECK([whether a program can dlopen itself],
-	  lt_cv_dlopen_self, [dnl
-	  _LT_TRY_DLOPEN_SELF(
-	    lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
-	    lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
-    ])
-
-    if test "x$lt_cv_dlopen_self" = xyes; then
-      wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
-      AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
-	  lt_cv_dlopen_self_static, [dnl
-	  _LT_TRY_DLOPEN_SELF(
-	    lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
-	    lt_cv_dlopen_self_static=no,  lt_cv_dlopen_self_static=cross)
-      ])
-    fi
-
-    CPPFLAGS="$save_CPPFLAGS"
-    LDFLAGS="$save_LDFLAGS"
-    LIBS="$save_LIBS"
-    ;;
-  esac
-
-  case $lt_cv_dlopen_self in
-  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
-  *) enable_dlopen_self=unknown ;;
-  esac
-
-  case $lt_cv_dlopen_self_static in
-  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
-  *) enable_dlopen_self_static=unknown ;;
-  esac
-fi
-_LT_DECL([dlopen_support], [enable_dlopen], [0],
-	 [Whether dlopen is supported])
-_LT_DECL([dlopen_self], [enable_dlopen_self], [0],
-	 [Whether dlopen of programs is supported])
-_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0],
-	 [Whether dlopen of statically linked programs is supported])
-])# LT_SYS_DLOPEN_SELF
-
-# Old name:
-AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [])
-
-
-# _LT_COMPILER_C_O([TAGNAME])
-# ---------------------------
-# Check to see if options -c and -o are simultaneously supported by compiler.
-# This macro does not hard code the compiler like AC_PROG_CC_C_O.
-m4_defun([_LT_COMPILER_C_O],
-[m4_require([_LT_DECL_SED])dnl
-m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-m4_require([_LT_TAG_COMPILER])dnl
-AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
-  [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
-  [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
-   $RM -r conftest 2>/dev/null
-   mkdir conftest
-   cd conftest
-   mkdir out
-   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-
-   lt_compiler_flag="-o out/conftest2.$ac_objext"
-   # Insert the option either (1) after the last *FLAGS variable, or
-   # (2) before a word containing "conftest.", or (3) at the end.
-   # Note that $ac_compile itself does not contain backslashes and begins
-   # with a dollar sign (not a hyphen), so the echo should work correctly.
-   lt_compile=`echo "$ac_compile" | $SED \
-   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
-   -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
-   (eval "$lt_compile" 2>out/conftest.err)
-   ac_status=$?
-   cat out/conftest.err >&AS_MESSAGE_LOG_FD
-   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
-   if (exit $ac_status) && test -s out/conftest2.$ac_objext
-   then
-     # The compiler can only warn and ignore the option if not recognized
-     # So say no if there are warnings
-     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
-     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
-     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
-       _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
-     fi
-   fi
-   chmod u+w . 2>&AS_MESSAGE_LOG_FD
-   $RM conftest*
-   # SGI C++ compiler will create directory out/ii_files/ for
-   # template instantiation
-   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
-   $RM out/* && rmdir out
-   cd ..
-   $RM -r conftest
-   $RM conftest*
-])
-_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1],
-	[Does compiler simultaneously support -c and -o options?])
-])# _LT_COMPILER_C_O
-
-
-# _LT_COMPILER_FILE_LOCKS([TAGNAME])
-# ----------------------------------
-# Check to see if we can do hard links to lock some files if needed
-m4_defun([_LT_COMPILER_FILE_LOCKS],
-[m4_require([_LT_ENABLE_LOCK])dnl
-m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-_LT_COMPILER_C_O([$1])
-
-hard_links="nottested"
-if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then
-  # do not overwrite the value of need_locks provided by the user
-  AC_MSG_CHECKING([if we can lock with hard links])
-  hard_links=yes
-  $RM conftest*
-  ln conftest.a conftest.b 2>/dev/null && hard_links=no
-  touch conftest.a
-  ln conftest.a conftest.b 2>&5 || hard_links=no
-  ln conftest.a conftest.b 2>/dev/null && hard_links=no
-  AC_MSG_RESULT([$hard_links])
-  if test "$hard_links" = no; then
-    AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe])
-    need_locks=warn
-  fi
-else
-  need_locks=no
-fi
-_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?])
-])# _LT_COMPILER_FILE_LOCKS
-
-
-# _LT_CHECK_OBJDIR
-# ----------------
-m4_defun([_LT_CHECK_OBJDIR],
-[AC_CACHE_CHECK([for objdir], [lt_cv_objdir],
-[rm -f .libs 2>/dev/null
-mkdir .libs 2>/dev/null
-if test -d .libs; then
-  lt_cv_objdir=.libs
-else
-  # MS-DOS does not allow filenames that begin with a dot.
-  lt_cv_objdir=_libs
-fi
-rmdir .libs 2>/dev/null])
-objdir=$lt_cv_objdir
-_LT_DECL([], [objdir], [0],
-         [The name of the directory that contains temporary libtool files])dnl
-m4_pattern_allow([LT_OBJDIR])dnl
-AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/",
-  [Define to the sub-directory in which libtool stores uninstalled libraries.])
-])# _LT_CHECK_OBJDIR
-
-
-# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME])
-# --------------------------------------
-# Check hardcoding attributes.
-m4_defun([_LT_LINKER_HARDCODE_LIBPATH],
-[AC_MSG_CHECKING([how to hardcode library paths into programs])
-_LT_TAGVAR(hardcode_action, $1)=
-if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" ||
-   test -n "$_LT_TAGVAR(runpath_var, $1)" ||
-   test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
-
-  # We can hardcode non-existent directories.
-  if test "$_LT_TAGVAR(hardcode_direct, $1)" != no &&
-     # If the only mechanism to avoid hardcoding is shlibpath_var, we
-     # have to relink, otherwise we might link with an installed library
-     # when we should be linking with a yet-to-be-installed one
-     ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no &&
-     test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then
-    # Linking always hardcodes the temporary library directory.
-    _LT_TAGVAR(hardcode_action, $1)=relink
-  else
-    # We can link without hardcoding, and we can hardcode nonexisting dirs.
-    _LT_TAGVAR(hardcode_action, $1)=immediate
-  fi
-else
-  # We cannot hardcode anything, or else we can only hardcode existing
-  # directories.
-  _LT_TAGVAR(hardcode_action, $1)=unsupported
-fi
-AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)])
-
-if test "$_LT_TAGVAR(hardcode_action, $1)" = relink ||
-   test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then
-  # Fast installation is not supported
-  enable_fast_install=no
-elif test "$shlibpath_overrides_runpath" = yes ||
-     test "$enable_shared" = no; then
-  # Fast installation is not necessary
-  enable_fast_install=needless
-fi
-_LT_TAGDECL([], [hardcode_action], [0],
-    [How to hardcode a shared library path into an executable])
-])# _LT_LINKER_HARDCODE_LIBPATH
-
-
-# _LT_CMD_STRIPLIB
-# ----------------
-m4_defun([_LT_CMD_STRIPLIB],
-[m4_require([_LT_DECL_EGREP])
-striplib=
-old_striplib=
-AC_MSG_CHECKING([whether stripping libraries is possible])
-if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
-  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
-  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
-  AC_MSG_RESULT([yes])
-else
-# FIXME - insert some real tests, host_os isn't really good enough
-  case $host_os in
-  darwin*)
-    if test -n "$STRIP" ; then
-      striplib="$STRIP -x"
-      old_striplib="$STRIP -S"
-      AC_MSG_RESULT([yes])
-    else
-      AC_MSG_RESULT([no])
-    fi
-    ;;
-  *)
-    AC_MSG_RESULT([no])
-    ;;
-  esac
-fi
-_LT_DECL([], [old_striplib], [1], [Commands to strip libraries])
-_LT_DECL([], [striplib], [1])
-])# _LT_CMD_STRIPLIB
-
-
-# _LT_SYS_DYNAMIC_LINKER([TAG])
-# -----------------------------
-# PORTME Fill in your ld.so characteristics
-m4_defun([_LT_SYS_DYNAMIC_LINKER],
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-m4_require([_LT_DECL_EGREP])dnl
-m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-m4_require([_LT_DECL_OBJDUMP])dnl
-m4_require([_LT_DECL_SED])dnl
-m4_require([_LT_CHECK_SHELL_FEATURES])dnl
-AC_MSG_CHECKING([dynamic linker characteristics])
-m4_if([$1],
-	[], [
-if test "$GCC" = yes; then
-  case $host_os in
-    darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
-    *) lt_awk_arg="/^libraries:/" ;;
-  esac
-  case $host_os in
-    mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;;
-    *) lt_sed_strip_eq="s,=/,/,g" ;;
-  esac
-  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
-  case $lt_search_path_spec in
-  *\;*)
-    # if the path contains ";" then we assume it to be the separator
-    # otherwise default to the standard path separator (i.e. ":") - it is
-    # assumed that no part of a normal pathname contains ";" but that should
-    # okay in the real world where ";" in dirpaths is itself problematic.
-    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
-    ;;
-  *)
-    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
-    ;;
-  esac
-  # Ok, now we have the path, separated by spaces, we can step through it
-  # and add multilib dir if necessary.
-  lt_tmp_lt_search_path_spec=
-  lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
-  for lt_sys_path in $lt_search_path_spec; do
-    if test -d "$lt_sys_path/$lt_multi_os_dir"; then
-      lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
-    else
-      test -d "$lt_sys_path" && \
-	lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
-    fi
-  done
-  lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
-BEGIN {RS=" "; FS="/|\n";} {
-  lt_foo="";
-  lt_count=0;
-  for (lt_i = NF; lt_i > 0; lt_i--) {
-    if ($lt_i != "" && $lt_i != ".") {
-      if ($lt_i == "..") {
-        lt_count++;
-      } else {
-        if (lt_count == 0) {
-          lt_foo="/" $lt_i lt_foo;
-        } else {
-          lt_count--;
-        }
-      }
-    }
-  }
-  if (lt_foo != "") { lt_freq[[lt_foo]]++; }
-  if (lt_freq[[lt_foo]] == 1) { print lt_foo; }
-}'`
-  # AWK program above erroneously prepends '/' to C:/dos/paths
-  # for these hosts.
-  case $host_os in
-    mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
-      $SED 's,/\([[A-Za-z]]:\),\1,g'` ;;
-  esac
-  sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
-else
-  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
-fi])
-library_names_spec=
-libname_spec='lib$name'
-soname_spec=
-shrext_cmds=".so"
-postinstall_cmds=
-postuninstall_cmds=
-finish_cmds=
-finish_eval=
-shlibpath_var=
-shlibpath_overrides_runpath=unknown
-version_type=none
-dynamic_linker="$host_os ld.so"
-sys_lib_dlsearch_path_spec="/lib /usr/lib"
-need_lib_prefix=unknown
-hardcode_into_libs=no
-
-# when you set need_version to no, make sure it does not cause -set_version
-# flags to be left without arguments
-need_version=unknown
-
-case $host_os in
-aix3*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
-  shlibpath_var=LIBPATH
-
-  # AIX 3 has no versioning support, so we append a major version to the name.
-  soname_spec='${libname}${release}${shared_ext}$major'
-  ;;
-
-aix[[4-9]]*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  need_lib_prefix=no
-  need_version=no
-  hardcode_into_libs=yes
-  if test "$host_cpu" = ia64; then
-    # AIX 5 supports IA64
-    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
-    shlibpath_var=LD_LIBRARY_PATH
-  else
-    # With GCC up to 2.95.x, collect2 would create an import file
-    # for dependence libraries.  The import file would start with
-    # the line `#! .'.  This would cause the generated library to
-    # depend on `.', always an invalid library.  This was fixed in
-    # development snapshots of GCC prior to 3.0.
-    case $host_os in
-      aix4 | aix4.[[01]] | aix4.[[01]].*)
-      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
-	   echo ' yes '
-	   echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
-	:
-      else
-	can_build_shared=no
-      fi
-      ;;
-    esac
-    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
-    # soname into executable. Probably we can add versioning support to
-    # collect2, so additional links can be useful in future.
-    if test "$aix_use_runtimelinking" = yes; then
-      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
-      # instead of lib<name>.a to let people know that these are not
-      # typical AIX shared libraries.
-      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    else
-      # We preserve .a as extension for shared libraries through AIX4.2
-      # and later when we are not doing run time linking.
-      library_names_spec='${libname}${release}.a $libname.a'
-      soname_spec='${libname}${release}${shared_ext}$major'
-    fi
-    shlibpath_var=LIBPATH
-  fi
-  ;;
-
-amigaos*)
-  case $host_cpu in
-  powerpc)
-    # Since July 2007 AmigaOS4 officially supports .so libraries.
-    # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    ;;
-  m68k)
-    library_names_spec='$libname.ixlibrary $libname.a'
-    # Create ${libname}_ixlibrary.a entries in /sys/libs.
-    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
-    ;;
-  esac
-  ;;
-
-beos*)
-  library_names_spec='${libname}${shared_ext}'
-  dynamic_linker="$host_os ld.so"
-  shlibpath_var=LIBRARY_PATH
-  ;;
-
-bsdi[[45]]*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
-  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
-  # the default ld.so.conf also contains /usr/contrib/lib and
-  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
-  # libtool to hard-code these into programs
-  ;;
-
-cygwin* | mingw* | pw32* | cegcc*)
-  version_type=windows
-  shrext_cmds=".dll"
-  need_version=no
-  need_lib_prefix=no
-
-  case $GCC,$cc_basename in
-  yes,*)
-    # gcc
-    library_names_spec='$libname.dll.a'
-    # DLL is installed to $(libdir)/../bin by postinstall_cmds
-    postinstall_cmds='base_file=`basename \${file}`~
-      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
-      dldir=$destdir/`dirname \$dlpath`~
-      test -d \$dldir || mkdir -p \$dldir~
-      $install_prog $dir/$dlname \$dldir/$dlname~
-      chmod a+x \$dldir/$dlname~
-      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
-        eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
-      fi'
-    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
-      dlpath=$dir/\$dldll~
-       $RM \$dlpath'
-    shlibpath_overrides_runpath=yes
-
-    case $host_os in
-    cygwin*)
-      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
-      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
-m4_if([$1], [],[
-      sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"])
-      ;;
-    mingw* | cegcc*)
-      # MinGW DLLs use traditional 'lib' prefix
-      soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
-      ;;
-    pw32*)
-      # pw32 DLLs use 'pw' prefix rather than 'lib'
-      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
-      ;;
-    esac
-    dynamic_linker='Win32 ld.exe'
-    ;;
-
-  *,cl*)
-    # Native MSVC
-    libname_spec='$name'
-    soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
-    library_names_spec='${libname}.dll.lib'
-
-    case $build_os in
-    mingw*)
-      sys_lib_search_path_spec=
-      lt_save_ifs=$IFS
-      IFS=';'
-      for lt_path in $LIB
-      do
-        IFS=$lt_save_ifs
-        # Let DOS variable expansion print the short 8.3 style file name.
-        lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
-        sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
-      done
-      IFS=$lt_save_ifs
-      # Convert to MSYS style.
-      sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'`
-      ;;
-    cygwin*)
-      # Convert to unix form, then to dos form, then back to unix form
-      # but this time dos style (no spaces!) so that the unix form looks
-      # like /cygdrive/c/PROGRA~1:/cygdr...
-      sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
-      sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
-      sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
-      ;;
-    *)
-      sys_lib_search_path_spec="$LIB"
-      if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then
-        # It is most probably a Windows format PATH.
-        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
-      else
-        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
-      fi
-      # FIXME: find the short name or the path components, as spaces are
-      # common. (e.g. "Program Files" -> "PROGRA~1")
-      ;;
-    esac
-
-    # DLL is installed to $(libdir)/../bin by postinstall_cmds
-    postinstall_cmds='base_file=`basename \${file}`~
-      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
-      dldir=$destdir/`dirname \$dlpath`~
-      test -d \$dldir || mkdir -p \$dldir~
-      $install_prog $dir/$dlname \$dldir/$dlname'
-    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
-      dlpath=$dir/\$dldll~
-       $RM \$dlpath'
-    shlibpath_overrides_runpath=yes
-    dynamic_linker='Win32 link.exe'
-    ;;
-
-  *)
-    # Assume MSVC wrapper
-    library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
-    dynamic_linker='Win32 ld.exe'
-    ;;
-  esac
-  # FIXME: first we should search . and the directory the executable is in
-  shlibpath_var=PATH
-  ;;
-
-darwin* | rhapsody*)
-  dynamic_linker="$host_os dyld"
-  version_type=darwin
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
-  soname_spec='${libname}${release}${major}$shared_ext'
-  shlibpath_overrides_runpath=yes
-  shlibpath_var=DYLD_LIBRARY_PATH
-  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
-m4_if([$1], [],[
-  sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"])
-  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
-  ;;
-
-dgux*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  ;;
-
-freebsd* | dragonfly*)
-  # DragonFly does not have aout.  When/if they implement a new
-  # versioning mechanism, adjust this.
-  if test -x /usr/bin/objformat; then
-    objformat=`/usr/bin/objformat`
-  else
-    case $host_os in
-    freebsd[[23]].*) objformat=aout ;;
-    *) objformat=elf ;;
-    esac
-  fi
-  version_type=freebsd-$objformat
-  case $version_type in
-    freebsd-elf*)
-      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
-      need_version=no
-      need_lib_prefix=no
-      ;;
-    freebsd-*)
-      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
-      need_version=yes
-      ;;
-  esac
-  shlibpath_var=LD_LIBRARY_PATH
-  case $host_os in
-  freebsd2.*)
-    shlibpath_overrides_runpath=yes
-    ;;
-  freebsd3.[[01]]* | freebsdelf3.[[01]]*)
-    shlibpath_overrides_runpath=yes
-    hardcode_into_libs=yes
-    ;;
-  freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \
-  freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1)
-    shlibpath_overrides_runpath=no
-    hardcode_into_libs=yes
-    ;;
-  *) # from 4.6 on, and DragonFly
-    shlibpath_overrides_runpath=yes
-    hardcode_into_libs=yes
-    ;;
-  esac
-  ;;
-
-gnu*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  ;;
-
-haiku*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  need_lib_prefix=no
-  need_version=no
-  dynamic_linker="$host_os runtime_loader"
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
-  hardcode_into_libs=yes
-  ;;
-
-hpux9* | hpux10* | hpux11*)
-  # Give a soname corresponding to the major version so that dld.sl refuses to
-  # link against other versions.
-  version_type=sunos
-  need_lib_prefix=no
-  need_version=no
-  case $host_cpu in
-  ia64*)
-    shrext_cmds='.so'
-    hardcode_into_libs=yes
-    dynamic_linker="$host_os dld.so"
-    shlibpath_var=LD_LIBRARY_PATH
-    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    if test "X$HPUX_IA64_MODE" = X32; then
-      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
-    else
-      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
-    fi
-    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
-    ;;
-  hppa*64*)
-    shrext_cmds='.sl'
-    hardcode_into_libs=yes
-    dynamic_linker="$host_os dld.sl"
-    shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
-    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
-    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
-    ;;
-  *)
-    shrext_cmds='.sl'
-    dynamic_linker="$host_os dld.sl"
-    shlibpath_var=SHLIB_PATH
-    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    ;;
-  esac
-  # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
-  postinstall_cmds='chmod 555 $lib'
-  # or fails outright, so override atomically:
-  install_override_mode=555
-  ;;
-
-interix[[3-9]]*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  ;;
-
-irix5* | irix6* | nonstopux*)
-  case $host_os in
-    nonstopux*) version_type=nonstopux ;;
-    *)
-	if test "$lt_cv_prog_gnu_ld" = yes; then
-		version_type=linux # correct to gnu/linux during the next big refactor
-	else
-		version_type=irix
-	fi ;;
-  esac
-  need_lib_prefix=no
-  need_version=no
-  soname_spec='${libname}${release}${shared_ext}$major'
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
-  case $host_os in
-  irix5* | nonstopux*)
-    libsuff= shlibsuff=
-    ;;
-  *)
-    case $LD in # libtool.m4 will add one of these switches to LD
-    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
-      libsuff= shlibsuff= libmagic=32-bit;;
-    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
-      libsuff=32 shlibsuff=N32 libmagic=N32;;
-    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
-      libsuff=64 shlibsuff=64 libmagic=64-bit;;
-    *) libsuff= shlibsuff= libmagic=never-match;;
-    esac
-    ;;
-  esac
-  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
-  shlibpath_overrides_runpath=no
-  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
-  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
-  hardcode_into_libs=yes
-  ;;
-
-# No shared lib support for Linux oldld, aout, or coff.
-linux*oldld* | linux*aout* | linux*coff*)
-  dynamic_linker=no
-  ;;
-
-# This must be glibc/ELF.
-linux* | k*bsd*-gnu | kopensolaris*-gnu)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-
-  # Some binutils ld are patched to set DT_RUNPATH
-  AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath],
-    [lt_cv_shlibpath_overrides_runpath=no
-    save_LDFLAGS=$LDFLAGS
-    save_libdir=$libdir
-    eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \
-	 LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\""
-    AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
-      [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null],
-	 [lt_cv_shlibpath_overrides_runpath=yes])])
-    LDFLAGS=$save_LDFLAGS
-    libdir=$save_libdir
-    ])
-  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
-
-  # This implies no fast_install, which is unacceptable.
-  # Some rework will be needed to allow for fast_install
-  # before this can be enabled.
-  hardcode_into_libs=yes
-
-  # Append ld.so.conf contents to the search path
-  if test -f /etc/ld.so.conf; then
-    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
-    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
-  fi
-
-  # We used to test for /lib/ld.so.1 and disable shared libraries on
-  # powerpc, because MkLinux only supported shared libraries with the
-  # GNU dynamic linker.  Since this was broken with cross compilers,
-  # most powerpc-linux boxes support dynamic linking these days and
-  # people can always --disable-shared, the test was removed, and we
-  # assume the GNU/Linux dynamic linker is in use.
-  dynamic_linker='GNU/Linux ld.so'
-  ;;
-
-netbsdelf*-gnu)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  dynamic_linker='NetBSD ld.elf_so'
-  ;;
-
-netbsd*)
-  version_type=sunos
-  need_lib_prefix=no
-  need_version=no
-  if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
-    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
-    dynamic_linker='NetBSD (a.out) ld.so'
-  else
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    dynamic_linker='NetBSD ld.elf_so'
-  fi
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  hardcode_into_libs=yes
-  ;;
-
-newsos6)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  ;;
-
-*nto* | *qnx*)
-  version_type=qnx
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  dynamic_linker='ldqnx.so'
-  ;;
-
-openbsd*)
-  version_type=sunos
-  sys_lib_dlsearch_path_spec="/usr/lib"
-  need_lib_prefix=no
-  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
-  case $host_os in
-    openbsd3.3 | openbsd3.3.*)	need_version=yes ;;
-    *)				need_version=no  ;;
-  esac
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
-  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-    case $host_os in
-      openbsd2.[[89]] | openbsd2.[[89]].*)
-	shlibpath_overrides_runpath=no
-	;;
-      *)
-	shlibpath_overrides_runpath=yes
-	;;
-      esac
-  else
-    shlibpath_overrides_runpath=yes
-  fi
-  ;;
-
-os2*)
-  libname_spec='$name'
-  shrext_cmds=".dll"
-  need_lib_prefix=no
-  library_names_spec='$libname${shared_ext} $libname.a'
-  dynamic_linker='OS/2 ld.exe'
-  shlibpath_var=LIBPATH
-  ;;
-
-osf3* | osf4* | osf5*)
-  version_type=osf
-  need_lib_prefix=no
-  need_version=no
-  soname_spec='${libname}${release}${shared_ext}$major'
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  shlibpath_var=LD_LIBRARY_PATH
-  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
-  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
-  ;;
-
-rdos*)
-  dynamic_linker=no
-  ;;
-
-solaris*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  hardcode_into_libs=yes
-  # ldd complains unless libraries are executable
-  postinstall_cmds='chmod +x $lib'
-  ;;
-
-sunos4*)
-  version_type=sunos
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
-  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  if test "$with_gnu_ld" = yes; then
-    need_lib_prefix=no
-  fi
-  need_version=yes
-  ;;
-
-sysv4 | sysv4.3*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  case $host_vendor in
-    sni)
-      shlibpath_overrides_runpath=no
-      need_lib_prefix=no
-      runpath_var=LD_RUN_PATH
-      ;;
-    siemens)
-      need_lib_prefix=no
-      ;;
-    motorola)
-      need_lib_prefix=no
-      need_version=no
-      shlibpath_overrides_runpath=no
-      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
-      ;;
-  esac
-  ;;
-
-sysv4*MP*)
-  if test -d /usr/nec ;then
-    version_type=linux # correct to gnu/linux during the next big refactor
-    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
-    soname_spec='$libname${shared_ext}.$major'
-    shlibpath_var=LD_LIBRARY_PATH
-  fi
-  ;;
-
-sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
-  version_type=freebsd-elf
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  hardcode_into_libs=yes
-  if test "$with_gnu_ld" = yes; then
-    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
-  else
-    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
-    case $host_os in
-      sco3.2v5*)
-        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
-	;;
-    esac
-  fi
-  sys_lib_dlsearch_path_spec='/usr/lib'
-  ;;
-
-tpf*)
-  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
-  version_type=linux # correct to gnu/linux during the next big refactor
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  ;;
-
-uts4*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  ;;
-
-*)
-  dynamic_linker=no
-  ;;
-esac
-AC_MSG_RESULT([$dynamic_linker])
-test "$dynamic_linker" = no && can_build_shared=no
-
-variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
-if test "$GCC" = yes; then
-  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
-fi
-
-if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
-  sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
-fi
-if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
-  sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
-fi
-
-_LT_DECL([], [variables_saved_for_relink], [1],
-    [Variables whose values should be saved in libtool wrapper scripts and
-    restored at link time])
-_LT_DECL([], [need_lib_prefix], [0],
-    [Do we need the "lib" prefix for modules?])
-_LT_DECL([], [need_version], [0], [Do we need a version for libraries?])
-_LT_DECL([], [version_type], [0], [Library versioning type])
-_LT_DECL([], [runpath_var], [0],  [Shared library runtime path variable])
-_LT_DECL([], [shlibpath_var], [0],[Shared library path variable])
-_LT_DECL([], [shlibpath_overrides_runpath], [0],
-    [Is shlibpath searched before the hard-coded library search path?])
-_LT_DECL([], [libname_spec], [1], [Format of library name prefix])
-_LT_DECL([], [library_names_spec], [1],
-    [[List of archive names.  First name is the real one, the rest are links.
-    The last name is the one that the linker finds with -lNAME]])
-_LT_DECL([], [soname_spec], [1],
-    [[The coded name of the library, if different from the real name]])
-_LT_DECL([], [install_override_mode], [1],
-    [Permission mode override for installation of shared libraries])
-_LT_DECL([], [postinstall_cmds], [2],
-    [Command to use after installation of a shared archive])
-_LT_DECL([], [postuninstall_cmds], [2],
-    [Command to use after uninstallation of a shared archive])
-_LT_DECL([], [finish_cmds], [2],
-    [Commands used to finish a libtool library installation in a directory])
-_LT_DECL([], [finish_eval], [1],
-    [[As "finish_cmds", except a single script fragment to be evaled but
-    not shown]])
-_LT_DECL([], [hardcode_into_libs], [0],
-    [Whether we should hardcode library paths into libraries])
-_LT_DECL([], [sys_lib_search_path_spec], [2],
-    [Compile-time system search path for libraries])
-_LT_DECL([], [sys_lib_dlsearch_path_spec], [2],
-    [Run-time system search path for libraries])
-])# _LT_SYS_DYNAMIC_LINKER
-
-
-# _LT_PATH_TOOL_PREFIX(TOOL)
-# --------------------------
-# find a file program which can recognize shared library
-AC_DEFUN([_LT_PATH_TOOL_PREFIX],
-[m4_require([_LT_DECL_EGREP])dnl
-AC_MSG_CHECKING([for $1])
-AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
-[case $MAGIC_CMD in
-[[\\/*] |  ?:[\\/]*])
-  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
-  ;;
-*)
-  lt_save_MAGIC_CMD="$MAGIC_CMD"
-  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
-dnl $ac_dummy forces splitting on constant user-supplied paths.
-dnl POSIX.2 word splitting is done only on the output of word expansions,
-dnl not every word.  This closes a longstanding sh security hole.
-  ac_dummy="m4_if([$2], , $PATH, [$2])"
-  for ac_dir in $ac_dummy; do
-    IFS="$lt_save_ifs"
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$1; then
-      lt_cv_path_MAGIC_CMD="$ac_dir/$1"
-      if test -n "$file_magic_test_file"; then
-	case $deplibs_check_method in
-	"file_magic "*)
-	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
-	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
-	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
-	    $EGREP "$file_magic_regex" > /dev/null; then
-	    :
-	  else
-	    cat <<_LT_EOF 1>&2
-
-*** Warning: the command libtool uses to detect shared libraries,
-*** $file_magic_cmd, produces output that libtool cannot recognize.
-*** The result is that libtool may fail to recognize shared libraries
-*** as such.  This will affect the creation of libtool libraries that
-*** depend on shared libraries, but programs linked with such libtool
-*** libraries will work regardless of this problem.  Nevertheless, you
-*** may want to report the problem to your system manager and/or to
-*** bug-libtool at gnu.org
-
-_LT_EOF
-	  fi ;;
-	esac
-      fi
-      break
-    fi
-  done
-  IFS="$lt_save_ifs"
-  MAGIC_CMD="$lt_save_MAGIC_CMD"
-  ;;
-esac])
-MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
-if test -n "$MAGIC_CMD"; then
-  AC_MSG_RESULT($MAGIC_CMD)
-else
-  AC_MSG_RESULT(no)
-fi
-_LT_DECL([], [MAGIC_CMD], [0],
-	 [Used to examine libraries when file_magic_cmd begins with "file"])dnl
-])# _LT_PATH_TOOL_PREFIX
-
-# Old name:
-AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], [])
-
-
-# _LT_PATH_MAGIC
-# --------------
-# find a file program which can recognize a shared library
-m4_defun([_LT_PATH_MAGIC],
-[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
-if test -z "$lt_cv_path_MAGIC_CMD"; then
-  if test -n "$ac_tool_prefix"; then
-    _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)
-  else
-    MAGIC_CMD=:
-  fi
-fi
-])# _LT_PATH_MAGIC
-
-
-# LT_PATH_LD
-# ----------
-# find the pathname to the GNU or non-GNU linker
-AC_DEFUN([LT_PATH_LD],
-[AC_REQUIRE([AC_PROG_CC])dnl
-AC_REQUIRE([AC_CANONICAL_HOST])dnl
-AC_REQUIRE([AC_CANONICAL_BUILD])dnl
-m4_require([_LT_DECL_SED])dnl
-m4_require([_LT_DECL_EGREP])dnl
-m4_require([_LT_PROG_ECHO_BACKSLASH])dnl
-
-AC_ARG_WITH([gnu-ld],
-    [AS_HELP_STRING([--with-gnu-ld],
-	[assume the C compiler uses GNU ld @<:@default=no@:>@])],
-    [test "$withval" = no || with_gnu_ld=yes],
-    [with_gnu_ld=no])dnl
-
-ac_prog=ld
-if test "$GCC" = yes; then
-  # Check if gcc -print-prog-name=ld gives a path.
-  AC_MSG_CHECKING([for ld used by $CC])
-  case $host in
-  *-*-mingw*)
-    # gcc leaves a trailing carriage return which upsets mingw
-    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
-  *)
-    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
-  esac
-  case $ac_prog in
-    # Accept absolute paths.
-    [[\\/]]* | ?:[[\\/]]*)
-      re_direlt='/[[^/]][[^/]]*/\.\./'
-      # Canonicalize the pathname of ld
-      ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
-      while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
-	ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
-      done
-      test -z "$LD" && LD="$ac_prog"
-      ;;
-  "")
-    # If it fails, then pretend we aren't using GCC.
-    ac_prog=ld
-    ;;
-  *)
-    # If it is relative, then search for the first ld in PATH.
-    with_gnu_ld=unknown
-    ;;
-  esac
-elif test "$with_gnu_ld" = yes; then
-  AC_MSG_CHECKING([for GNU ld])
-else
-  AC_MSG_CHECKING([for non-GNU ld])
-fi
-AC_CACHE_VAL(lt_cv_path_LD,
-[if test -z "$LD"; then
-  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
-  for ac_dir in $PATH; do
-    IFS="$lt_save_ifs"
-    test -z "$ac_dir" && ac_dir=.
-    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
-      lt_cv_path_LD="$ac_dir/$ac_prog"
-      # Check to see if the program is GNU ld.  I'd rather use --version,
-      # but apparently some variants of GNU ld only accept -v.
-      # Break only if it was the GNU/non-GNU ld that we prefer.
-      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
-      *GNU* | *'with BFD'*)
-	test "$with_gnu_ld" != no && break
-	;;
-      *)
-	test "$with_gnu_ld" != yes && break
-	;;
-      esac
-    fi
-  done
-  IFS="$lt_save_ifs"
-else
-  lt_cv_path_LD="$LD" # Let the user override the test with a path.
-fi])
-LD="$lt_cv_path_LD"
-if test -n "$LD"; then
-  AC_MSG_RESULT($LD)
-else
-  AC_MSG_RESULT(no)
-fi
-test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
-_LT_PATH_LD_GNU
-AC_SUBST([LD])
-
-_LT_TAGDECL([], [LD], [1], [The linker used to build libraries])
-])# LT_PATH_LD
-
-# Old names:
-AU_ALIAS([AM_PROG_LD], [LT_PATH_LD])
-AU_ALIAS([AC_PROG_LD], [LT_PATH_LD])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AM_PROG_LD], [])
-dnl AC_DEFUN([AC_PROG_LD], [])
-
-
-# _LT_PATH_LD_GNU
-#- --------------
-m4_defun([_LT_PATH_LD_GNU],
-[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
-[# I'd rather use --version here, but apparently some GNU lds only accept -v.
-case `$LD -v 2>&1 </dev/null` in
-*GNU* | *'with BFD'*)
-  lt_cv_prog_gnu_ld=yes
-  ;;
-*)
-  lt_cv_prog_gnu_ld=no
-  ;;
-esac])
-with_gnu_ld=$lt_cv_prog_gnu_ld
-])# _LT_PATH_LD_GNU
-
-
-# _LT_CMD_RELOAD
-# --------------
-# find reload flag for linker
-#   -- PORTME Some linkers may need a different reload flag.
-m4_defun([_LT_CMD_RELOAD],
-[AC_CACHE_CHECK([for $LD option to reload object files],
-  lt_cv_ld_reload_flag,
-  [lt_cv_ld_reload_flag='-r'])
-reload_flag=$lt_cv_ld_reload_flag
-case $reload_flag in
-"" | " "*) ;;
-*) reload_flag=" $reload_flag" ;;
-esac
-reload_cmds='$LD$reload_flag -o $output$reload_objs'
-case $host_os in
-  cygwin* | mingw* | pw32* | cegcc*)
-    if test "$GCC" != yes; then
-      reload_cmds=false
-    fi
-    ;;
-  darwin*)
-    if test "$GCC" = yes; then
-      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
-    else
-      reload_cmds='$LD$reload_flag -o $output$reload_objs'
-    fi
-    ;;
-esac
-_LT_TAGDECL([], [reload_flag], [1], [How to create reloadable object files])dnl
-_LT_TAGDECL([], [reload_cmds], [2])dnl
-])# _LT_CMD_RELOAD
-
-
-# _LT_CHECK_MAGIC_METHOD
-# ----------------------
-# how to check for library dependencies
-#  -- PORTME fill in with the dynamic library characteristics
-m4_defun([_LT_CHECK_MAGIC_METHOD],
-[m4_require([_LT_DECL_EGREP])
-m4_require([_LT_DECL_OBJDUMP])
-AC_CACHE_CHECK([how to recognize dependent libraries],
-lt_cv_deplibs_check_method,
-[lt_cv_file_magic_cmd='$MAGIC_CMD'
-lt_cv_file_magic_test_file=
-lt_cv_deplibs_check_method='unknown'
-# Need to set the preceding variable on all platforms that support
-# interlibrary dependencies.
-# 'none' -- dependencies not supported.
-# `unknown' -- same as none, but documents that we really don't know.
-# 'pass_all' -- all dependencies passed with no checks.
-# 'test_compile' -- check by making test program.
-# 'file_magic [[regex]]' -- check by looking for files in library path
-# which responds to the $file_magic_cmd with a given extended regex.
-# If you have `file' or equivalent on your system and you're not sure
-# whether `pass_all' will *always* work, you probably want this one.
-
-case $host_os in
-aix[[4-9]]*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-beos*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-bsdi[[45]]*)
-  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'
-  lt_cv_file_magic_cmd='/usr/bin/file -L'
-  lt_cv_file_magic_test_file=/shlib/libc.so
-  ;;
-
-cygwin*)
-  # func_win32_libid is a shell function defined in ltmain.sh
-  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
-  lt_cv_file_magic_cmd='func_win32_libid'
-  ;;
-
-mingw* | pw32*)
-  # Base MSYS/MinGW do not provide the 'file' command needed by
-  # func_win32_libid shell function, so use a weaker test based on 'objdump',
-  # unless we find 'file', for example because we are cross-compiling.
-  # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
-  if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
-    lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
-    lt_cv_file_magic_cmd='func_win32_libid'
-  else
-    # Keep this pattern in sync with the one in func_win32_libid.
-    lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
-    lt_cv_file_magic_cmd='$OBJDUMP -f'
-  fi
-  ;;
-
-cegcc*)
-  # use the weaker test based on 'objdump'. See mingw*.
-  lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
-  lt_cv_file_magic_cmd='$OBJDUMP -f'
-  ;;
-
-darwin* | rhapsody*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-freebsd* | dragonfly*)
-  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
-    case $host_cpu in
-    i*86 )
-      # Not sure whether the presence of OpenBSD here was a mistake.
-      # Let's accept both of them until this is cleared up.
-      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library'
-      lt_cv_file_magic_cmd=/usr/bin/file
-      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
-      ;;
-    esac
-  else
-    lt_cv_deplibs_check_method=pass_all
-  fi
-  ;;
-
-gnu*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-haiku*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-hpux10.20* | hpux11*)
-  lt_cv_file_magic_cmd=/usr/bin/file
-  case $host_cpu in
-  ia64*)
-    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64'
-    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
-    ;;
-  hppa*64*)
-    [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]']
-    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
-    ;;
-  *)
-    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library'
-    lt_cv_file_magic_test_file=/usr/lib/libc.sl
-    ;;
-  esac
-  ;;
-
-interix[[3-9]]*)
-  # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
-  lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$'
-  ;;
-
-irix5* | irix6* | nonstopux*)
-  case $LD in
-  *-32|*"-32 ") libmagic=32-bit;;
-  *-n32|*"-n32 ") libmagic=N32;;
-  *-64|*"-64 ") libmagic=64-bit;;
-  *) libmagic=never-match;;
-  esac
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-# This must be glibc/ELF.
-linux* | k*bsd*-gnu | kopensolaris*-gnu)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-netbsd* | netbsdelf*-gnu)
-  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
-    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
-  else
-    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$'
-  fi
-  ;;
-
-newos6*)
-  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'
-  lt_cv_file_magic_cmd=/usr/bin/file
-  lt_cv_file_magic_test_file=/usr/lib/libnls.so
-  ;;
-
-*nto* | *qnx*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-openbsd*)
-  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$'
-  else
-    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
-  fi
-  ;;
-
-osf3* | osf4* | osf5*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-rdos*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-solaris*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-sysv4 | sysv4.3*)
-  case $host_vendor in
-  motorola)
-    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'
-    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
-    ;;
-  ncr)
-    lt_cv_deplibs_check_method=pass_all
-    ;;
-  sequent)
-    lt_cv_file_magic_cmd='/bin/file'
-    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'
-    ;;
-  sni)
-    lt_cv_file_magic_cmd='/bin/file'
-    lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib"
-    lt_cv_file_magic_test_file=/lib/libc.so
-    ;;
-  siemens)
-    lt_cv_deplibs_check_method=pass_all
-    ;;
-  pc)
-    lt_cv_deplibs_check_method=pass_all
-    ;;
-  esac
-  ;;
-
-tpf*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-esac
-])
-
-file_magic_glob=
-want_nocaseglob=no
-if test "$build" = "$host"; then
-  case $host_os in
-  mingw* | pw32*)
-    if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
-      want_nocaseglob=yes
-    else
-      file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"`
-    fi
-    ;;
-  esac
-fi
-
-file_magic_cmd=$lt_cv_file_magic_cmd
-deplibs_check_method=$lt_cv_deplibs_check_method
-test -z "$deplibs_check_method" && deplibs_check_method=unknown
-
-_LT_DECL([], [deplibs_check_method], [1],
-    [Method to check whether dependent libraries are shared objects])
-_LT_DECL([], [file_magic_cmd], [1],
-    [Command to use when deplibs_check_method = "file_magic"])
-_LT_DECL([], [file_magic_glob], [1],
-    [How to find potential files when deplibs_check_method = "file_magic"])
-_LT_DECL([], [want_nocaseglob], [1],
-    [Find potential files using nocaseglob when deplibs_check_method = "file_magic"])
-])# _LT_CHECK_MAGIC_METHOD
-
-
-# LT_PATH_NM
-# ----------
-# find the pathname to a BSD- or MS-compatible name lister
-AC_DEFUN([LT_PATH_NM],
-[AC_REQUIRE([AC_PROG_CC])dnl
-AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM,
-[if test -n "$NM"; then
-  # Let the user override the test.
-  lt_cv_path_NM="$NM"
-else
-  lt_nm_to_check="${ac_tool_prefix}nm"
-  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
-    lt_nm_to_check="$lt_nm_to_check nm"
-  fi
-  for lt_tmp_nm in $lt_nm_to_check; do
-    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
-    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
-      IFS="$lt_save_ifs"
-      test -z "$ac_dir" && ac_dir=.
-      tmp_nm="$ac_dir/$lt_tmp_nm"
-      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
-	# Check to see if the nm accepts a BSD-compat flag.
-	# Adding the `sed 1q' prevents false positives on HP-UX, which says:
-	#   nm: unknown option "B" ignored
-	# Tru64's nm complains that /dev/null is an invalid object file
-	case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
-	*/dev/null* | *'Invalid file or object type'*)
-	  lt_cv_path_NM="$tmp_nm -B"
-	  break
-	  ;;
-	*)
-	  case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
-	  */dev/null*)
-	    lt_cv_path_NM="$tmp_nm -p"
-	    break
-	    ;;
-	  *)
-	    lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
-	    continue # so that we can try to find one that supports BSD flags
-	    ;;
-	  esac
-	  ;;
-	esac
-      fi
-    done
-    IFS="$lt_save_ifs"
-  done
-  : ${lt_cv_path_NM=no}
-fi])
-if test "$lt_cv_path_NM" != "no"; then
-  NM="$lt_cv_path_NM"
-else
-  # Didn't find any BSD compatible name lister, look for dumpbin.
-  if test -n "$DUMPBIN"; then :
-    # Let the user override the test.
-  else
-    AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :)
-    case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
-    *COFF*)
-      DUMPBIN="$DUMPBIN -symbols"
-      ;;
-    *)
-      DUMPBIN=:
-      ;;
-    esac
-  fi
-  AC_SUBST([DUMPBIN])
-  if test "$DUMPBIN" != ":"; then
-    NM="$DUMPBIN"
-  fi
-fi
-test -z "$NM" && NM=nm
-AC_SUBST([NM])
-_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl
-
-AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface],
-  [lt_cv_nm_interface="BSD nm"
-  echo "int some_variable = 0;" > conftest.$ac_ext
-  (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
-  (eval "$ac_compile" 2>conftest.err)
-  cat conftest.err >&AS_MESSAGE_LOG_FD
-  (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD)
-  (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
-  cat conftest.err >&AS_MESSAGE_LOG_FD
-  (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD)
-  cat conftest.out >&AS_MESSAGE_LOG_FD
-  if $GREP 'External.*some_variable' conftest.out > /dev/null; then
-    lt_cv_nm_interface="MS dumpbin"
-  fi
-  rm -f conftest*])
-])# LT_PATH_NM
-
-# Old names:
-AU_ALIAS([AM_PROG_NM], [LT_PATH_NM])
-AU_ALIAS([AC_PROG_NM], [LT_PATH_NM])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AM_PROG_NM], [])
-dnl AC_DEFUN([AC_PROG_NM], [])
-
-# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
-# --------------------------------
-# how to determine the name of the shared library
-# associated with a specific link library.
-#  -- PORTME fill in with the dynamic library characteristics
-m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB],
-[m4_require([_LT_DECL_EGREP])
-m4_require([_LT_DECL_OBJDUMP])
-m4_require([_LT_DECL_DLLTOOL])
-AC_CACHE_CHECK([how to associate runtime and link libraries],
-lt_cv_sharedlib_from_linklib_cmd,
-[lt_cv_sharedlib_from_linklib_cmd='unknown'
-
-case $host_os in
-cygwin* | mingw* | pw32* | cegcc*)
-  # two different shell functions defined in ltmain.sh
-  # decide which to use based on capabilities of $DLLTOOL
-  case `$DLLTOOL --help 2>&1` in
-  *--identify-strict*)
-    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
-    ;;
-  *)
-    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
-    ;;
-  esac
-  ;;
-*)
-  # fallback: assume linklib IS sharedlib
-  lt_cv_sharedlib_from_linklib_cmd="$ECHO"
-  ;;
-esac
-])
-sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
-test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
-
-_LT_DECL([], [sharedlib_from_linklib_cmd], [1],
-    [Command to associate shared and link libraries])
-])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
-
-
-# _LT_PATH_MANIFEST_TOOL
-# ----------------------
-# locate the manifest tool
-m4_defun([_LT_PATH_MANIFEST_TOOL],
-[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :)
-test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
-AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool],
-  [lt_cv_path_mainfest_tool=no
-  echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD
-  $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
-  cat conftest.err >&AS_MESSAGE_LOG_FD
-  if $GREP 'Manifest Tool' conftest.out > /dev/null; then
-    lt_cv_path_mainfest_tool=yes
-  fi
-  rm -f conftest*])
-if test "x$lt_cv_path_mainfest_tool" != xyes; then
-  MANIFEST_TOOL=:
-fi
-_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl
-])# _LT_PATH_MANIFEST_TOOL
-
-
-# LT_LIB_M
-# --------
-# check for math library
-AC_DEFUN([LT_LIB_M],
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-LIBM=
-case $host in
-*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*)
-  # These system don't have libm, or don't need it
-  ;;
-*-ncr-sysv4.3*)
-  AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
-  AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")
-  ;;
-*)
-  AC_CHECK_LIB(m, cos, LIBM="-lm")
-  ;;
-esac
-AC_SUBST([LIBM])
-])# LT_LIB_M
-
-# Old name:
-AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_CHECK_LIBM], [])
-
-
-# _LT_COMPILER_NO_RTTI([TAGNAME])
-# -------------------------------
-m4_defun([_LT_COMPILER_NO_RTTI],
-[m4_require([_LT_TAG_COMPILER])dnl
-
-_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
-
-if test "$GCC" = yes; then
-  case $cc_basename in
-  nvcc*)
-    _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;;
-  *)
-    _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;;
-  esac
-
-  _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
-    lt_cv_prog_compiler_rtti_exceptions,
-    [-fno-rtti -fno-exceptions], [],
-    [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"])
-fi
-_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1],
-	[Compiler flag to turn off builtin functions])
-])# _LT_COMPILER_NO_RTTI
-
-
-# _LT_CMD_GLOBAL_SYMBOLS
-# ----------------------
-m4_defun([_LT_CMD_GLOBAL_SYMBOLS],
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-AC_REQUIRE([AC_PROG_CC])dnl
-AC_REQUIRE([AC_PROG_AWK])dnl
-AC_REQUIRE([LT_PATH_NM])dnl
-AC_REQUIRE([LT_PATH_LD])dnl
-m4_require([_LT_DECL_SED])dnl
-m4_require([_LT_DECL_EGREP])dnl
-m4_require([_LT_TAG_COMPILER])dnl
-
-# Check for command to grab the raw symbol name followed by C symbol from nm.
-AC_MSG_CHECKING([command to parse $NM output from $compiler object])
-AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe],
-[
-# These are sane defaults that work on at least a few old systems.
-# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
-
-# Character class describing NM global symbol codes.
-symcode='[[BCDEGRST]]'
-
-# Regexp to match symbols that can be accessed directly from C.
-sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
-
-# Define system-specific variables.
-case $host_os in
-aix*)
-  symcode='[[BCDT]]'
-  ;;
-cygwin* | mingw* | pw32* | cegcc*)
-  symcode='[[ABCDGISTW]]'
-  ;;
-hpux*)
-  if test "$host_cpu" = ia64; then
-    symcode='[[ABCDEGRST]]'
-  fi
-  ;;
-irix* | nonstopux*)
-  symcode='[[BCDEGRST]]'
-  ;;
-osf*)
-  symcode='[[BCDEGQRST]]'
-  ;;
-solaris*)
-  symcode='[[BDRT]]'
-  ;;
-sco3.2v5*)
-  symcode='[[DT]]'
-  ;;
-sysv4.2uw2*)
-  symcode='[[DT]]'
-  ;;
-sysv5* | sco5v6* | unixware* | OpenUNIX*)
-  symcode='[[ABDT]]'
-  ;;
-sysv4)
-  symcode='[[DFNSTU]]'
-  ;;
-esac
-
-# If we're using GNU nm, then use its standard symbol codes.
-case `$NM -V 2>&1` in
-*GNU* | *'with BFD'*)
-  symcode='[[ABCDGIRSTW]]' ;;
-esac
-
-# Transform an extracted symbol line into a proper C declaration.
-# Some systems (esp. on ia64) link data and code symbols differently,
-# so use this general approach.
-lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
-
-# Transform an extracted symbol line into symbol name and symbol address
-lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p'"
-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
-
-# Handle CRLF in mingw tool chain
-opt_cr=
-case $build_os in
-mingw*)
-  opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
-  ;;
-esac
-
-# Try without a prefix underscore, then with it.
-for ac_symprfx in "" "_"; do
-
-  # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
-  symxfrm="\\1 $ac_symprfx\\2 \\2"
-
-  # Write the raw and C identifiers.
-  if test "$lt_cv_nm_interface" = "MS dumpbin"; then
-    # Fake it for dumpbin and say T for any non-static function
-    # and D for any global variable.
-    # Also find C++ and __fastcall symbols from MSVC++,
-    # which start with @ or ?.
-    lt_cv_sys_global_symbol_pipe="$AWK ['"\
-"     {last_section=section; section=\$ 3};"\
-"     /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
-"     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
-"     \$ 0!~/External *\|/{next};"\
-"     / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
-"     {if(hide[section]) next};"\
-"     {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
-"     {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
-"     s[1]~/^[@?]/{print s[1], s[1]; next};"\
-"     s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
-"     ' prfx=^$ac_symprfx]"
-  else
-    lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[	 ]]\($symcode$symcode*\)[[	 ]][[	 ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
-  fi
-  lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
-
-  # Check to see that the pipe works correctly.
-  pipe_works=no
-
-  rm -f conftest*
-  cat > conftest.$ac_ext <<_LT_EOF
-#ifdef __cplusplus
-extern "C" {
-#endif
-char nm_test_var;
-void nm_test_func(void);
-void nm_test_func(void){}
-#ifdef __cplusplus
-}
-#endif
-int main(){nm_test_var='a';nm_test_func();return(0);}
-_LT_EOF
-
-  if AC_TRY_EVAL(ac_compile); then
-    # Now try to grab the symbols.
-    nlist=conftest.nm
-    if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then
-      # Try sorting and uniquifying the output.
-      if sort "$nlist" | uniq > "$nlist"T; then
-	mv -f "$nlist"T "$nlist"
-      else
-	rm -f "$nlist"T
-      fi
-
-      # Make sure that we snagged all the symbols we need.
-      if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
-	if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
-	  cat <<_LT_EOF > conftest.$ac_ext
-/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
-#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
-/* DATA imports from DLLs on WIN32 con't be const, because runtime
-   relocations are performed -- see ld's documentation on pseudo-relocs.  */
-# define LT@&t at _DLSYM_CONST
-#elif defined(__osf__)
-/* This system does not cope well with relocations in const data.  */
-# define LT@&t at _DLSYM_CONST
-#else
-# define LT@&t at _DLSYM_CONST const
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-_LT_EOF
-	  # Now generate the symbol file.
-	  eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
-
-	  cat <<_LT_EOF >> conftest.$ac_ext
-
-/* The mapping between symbol names and symbols.  */
-LT@&t at _DLSYM_CONST struct {
-  const char *name;
-  void       *address;
-}
-lt__PROGRAM__LTX_preloaded_symbols[[]] =
-{
-  { "@PROGRAM@", (void *) 0 },
-_LT_EOF
-	  $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
-	  cat <<\_LT_EOF >> conftest.$ac_ext
-  {0, (void *) 0}
-};
-
-/* This works around a problem in FreeBSD linker */
-#ifdef FREEBSD_WORKAROUND
-static const void *lt_preloaded_setup() {
-  return lt__PROGRAM__LTX_preloaded_symbols;
-}
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-_LT_EOF
-	  # Now try linking the two files.
-	  mv conftest.$ac_objext conftstm.$ac_objext
-	  lt_globsym_save_LIBS=$LIBS
-	  lt_globsym_save_CFLAGS=$CFLAGS
-	  LIBS="conftstm.$ac_objext"
-	  CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
-	  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
-	    pipe_works=yes
-	  fi
-	  LIBS=$lt_globsym_save_LIBS
-	  CFLAGS=$lt_globsym_save_CFLAGS
-	else
-	  echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD
-	fi
-      else
-	echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD
-      fi
-    else
-      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD
-    fi
-  else
-    echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD
-    cat conftest.$ac_ext >&5
-  fi
-  rm -rf conftest* conftst*
-
-  # Do not use the global_symbol_pipe unless it works.
-  if test "$pipe_works" = yes; then
-    break
-  else
-    lt_cv_sys_global_symbol_pipe=
-  fi
-done
-])
-if test -z "$lt_cv_sys_global_symbol_pipe"; then
-  lt_cv_sys_global_symbol_to_cdecl=
-fi
-if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
-  AC_MSG_RESULT(failed)
-else
-  AC_MSG_RESULT(ok)
-fi
-
-# Response file support.
-if test "$lt_cv_nm_interface" = "MS dumpbin"; then
-  nm_file_list_spec='@'
-elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then
-  nm_file_list_spec='@'
-fi
-
-_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1],
-    [Take the output of nm and produce a listing of raw symbols and C names])
-_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1],
-    [Transform the output of nm in a proper C declaration])
-_LT_DECL([global_symbol_to_c_name_address],
-    [lt_cv_sys_global_symbol_to_c_name_address], [1],
-    [Transform the output of nm in a C name address pair])
-_LT_DECL([global_symbol_to_c_name_address_lib_prefix],
-    [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1],
-    [Transform the output of nm in a C name address pair when lib prefix is needed])
-_LT_DECL([], [nm_file_list_spec], [1],
-    [Specify filename containing input files for $NM])
-]) # _LT_CMD_GLOBAL_SYMBOLS
-
-
-# _LT_COMPILER_PIC([TAGNAME])
-# ---------------------------
-m4_defun([_LT_COMPILER_PIC],
-[m4_require([_LT_TAG_COMPILER])dnl
-_LT_TAGVAR(lt_prog_compiler_wl, $1)=
-_LT_TAGVAR(lt_prog_compiler_pic, $1)=
-_LT_TAGVAR(lt_prog_compiler_static, $1)=
-
-m4_if([$1], [CXX], [
-  # C++ specific cases for pic, static, wl, etc.
-  if test "$GXX" = yes; then
-    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
-
-    case $host_os in
-    aix*)
-      # All AIX code is PIC.
-      if test "$host_cpu" = ia64; then
-	# AIX 5 now supports IA64 processor
-	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      fi
-      ;;
-
-    amigaos*)
-      case $host_cpu in
-      powerpc)
-            # see comment about AmigaOS4 .so support
-            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-        ;;
-      m68k)
-            # FIXME: we need at least 68020 code to build shared libraries, but
-            # adding the `-m68020' flag to GCC prevents building anything better,
-            # like `-m68040'.
-            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
-        ;;
-      esac
-      ;;
-
-    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
-      # PIC is the default for these OSes.
-      ;;
-    mingw* | cygwin* | os2* | pw32* | cegcc*)
-      # This hack is so that the source file can tell whether it is being
-      # built for inclusion in a dll (and should export symbols for example).
-      # Although the cygwin gcc ignores -fPIC, still need this for old-style
-      # (--disable-auto-import) libraries
-      m4_if([$1], [GCJ], [],
-	[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
-      ;;
-    darwin* | rhapsody*)
-      # PIC is the default on this platform
-      # Common symbols not allowed in MH_DYLIB files
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
-      ;;
-    *djgpp*)
-      # DJGPP does not support shared libraries at all
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)=
-      ;;
-    haiku*)
-      # PIC is the default for Haiku.
-      # The "-static" flag exists, but is broken.
-      _LT_TAGVAR(lt_prog_compiler_static, $1)=
-      ;;
-    interix[[3-9]]*)
-      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
-      # Instead, we relocate shared libraries at runtime.
-      ;;
-    sysv4*MP*)
-      if test -d /usr/nec; then
-	_LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
-      fi
-      ;;
-    hpux*)
-      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
-      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
-      # sets the default TLS model and affects inlining.
-      case $host_cpu in
-      hppa*64*)
-	;;
-      *)
-	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-	;;
-      esac
-      ;;
-    *qnx* | *nto*)
-      # QNX uses GNU C++, but need to define -shared option too, otherwise
-      # it will coredump.
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
-      ;;
-    *)
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-      ;;
-    esac
-  else
-    case $host_os in
-      aix[[4-9]]*)
-	# All AIX code is PIC.
-	if test "$host_cpu" = ia64; then
-	  # AIX 5 now supports IA64 processor
-	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	else
-	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
-	fi
-	;;
-      chorus*)
-	case $cc_basename in
-	cxch68*)
-	  # Green Hills C++ Compiler
-	  # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
-	  ;;
-	esac
-	;;
-      mingw* | cygwin* | os2* | pw32* | cegcc*)
-	# This hack is so that the source file can tell whether it is being
-	# built for inclusion in a dll (and should export symbols for example).
-	m4_if([$1], [GCJ], [],
-	  [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
-	;;
-      dgux*)
-	case $cc_basename in
-	  ec++*)
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	    ;;
-	  ghcx*)
-	    # Green Hills C++ Compiler
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      freebsd* | dragonfly*)
-	# FreeBSD uses GNU C++
-	;;
-      hpux9* | hpux10* | hpux11*)
-	case $cc_basename in
-	  CC*)
-	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
-	    if test "$host_cpu" != ia64; then
-	      _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
-	    fi
-	    ;;
-	  aCC*)
-	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
-	    case $host_cpu in
-	    hppa*64*|ia64*)
-	      # +Z the default
-	      ;;
-	    *)
-	      _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
-	      ;;
-	    esac
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      interix*)
-	# This is c89, which is MS Visual C++ (no shared libs)
-	# Anyone wants to do a port?
-	;;
-      irix5* | irix6* | nonstopux*)
-	case $cc_basename in
-	  CC*)
-	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
-	    # CC pic flag -KPIC is the default.
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      linux* | k*bsd*-gnu | kopensolaris*-gnu)
-	case $cc_basename in
-	  KCC*)
-	    # KAI C++ Compiler
-	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-	    ;;
-	  ecpc* )
-	    # old Intel C++ for x86_64 which still supported -KPIC.
-	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
-	    ;;
-	  icpc* )
-	    # Intel C++, used to be incompatible with GCC.
-	    # ICC 10 doesn't accept -KPIC any more.
-	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
-	    ;;
-	  pgCC* | pgcpp*)
-	    # Portland Group C++ compiler
-	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	    ;;
-	  cxx*)
-	    # Compaq C++
-	    # Make sure the PIC flag is empty.  It appears that all Alpha
-	    # Linux and Compaq Tru64 Unix objects are PIC.
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)=
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
-	    ;;
-	  xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*)
-	    # IBM XL 8.0, 9.0 on PPC and BlueGene
-	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
-	    ;;
-	  *)
-	    case `$CC -V 2>&1 | sed 5q` in
-	    *Sun\ C*)
-	      # Sun C++ 5.9
-	      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
-	      ;;
-	    esac
-	    ;;
-	esac
-	;;
-      lynxos*)
-	;;
-      m88k*)
-	;;
-      mvs*)
-	case $cc_basename in
-	  cxx*)
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      netbsd* | netbsdelf*-gnu)
-	;;
-      *qnx* | *nto*)
-        # QNX uses GNU C++, but need to define -shared option too, otherwise
-        # it will coredump.
-        _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
-        ;;
-      osf3* | osf4* | osf5*)
-	case $cc_basename in
-	  KCC*)
-	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
-	    ;;
-	  RCC*)
-	    # Rational C++ 2.4.1
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
-	    ;;
-	  cxx*)
-	    # Digital/Compaq C++
-	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    # Make sure the PIC flag is empty.  It appears that all Alpha
-	    # Linux and Compaq Tru64 Unix objects are PIC.
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)=
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      psos*)
-	;;
-      solaris*)
-	case $cc_basename in
-	  CC* | sunCC*)
-	    # Sun C++ 4.2, 5.x and Centerline C++
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
-	    ;;
-	  gcx*)
-	    # Green Hills C++ Compiler
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      sunos4*)
-	case $cc_basename in
-	  CC*)
-	    # Sun C++ 4.x
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	    ;;
-	  lcc*)
-	    # Lucid
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
-	case $cc_basename in
-	  CC*)
-	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	    ;;
-	esac
-	;;
-      tandem*)
-	case $cc_basename in
-	  NCC*)
-	    # NonStop-UX NCC 3.20
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      vxworks*)
-	;;
-      *)
-	_LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
-	;;
-    esac
-  fi
-],
-[
-  if test "$GCC" = yes; then
-    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
-
-    case $host_os in
-      aix*)
-      # All AIX code is PIC.
-      if test "$host_cpu" = ia64; then
-	# AIX 5 now supports IA64 processor
-	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      fi
-      ;;
-
-    amigaos*)
-      case $host_cpu in
-      powerpc)
-            # see comment about AmigaOS4 .so support
-            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-        ;;
-      m68k)
-            # FIXME: we need at least 68020 code to build shared libraries, but
-            # adding the `-m68020' flag to GCC prevents building anything better,
-            # like `-m68040'.
-            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
-        ;;
-      esac
-      ;;
-
-    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
-      # PIC is the default for these OSes.
-      ;;
-
-    mingw* | cygwin* | pw32* | os2* | cegcc*)
-      # This hack is so that the source file can tell whether it is being
-      # built for inclusion in a dll (and should export symbols for example).
-      # Although the cygwin gcc ignores -fPIC, still need this for old-style
-      # (--disable-auto-import) libraries
-      m4_if([$1], [GCJ], [],
-	[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
-      ;;
-
-    darwin* | rhapsody*)
-      # PIC is the default on this platform
-      # Common symbols not allowed in MH_DYLIB files
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
-      ;;
-
-    haiku*)
-      # PIC is the default for Haiku.
-      # The "-static" flag exists, but is broken.
-      _LT_TAGVAR(lt_prog_compiler_static, $1)=
-      ;;
-
-    hpux*)
-      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
-      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
-      # sets the default TLS model and affects inlining.
-      case $host_cpu in
-      hppa*64*)
-	# +Z the default
-	;;
-      *)
-	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-	;;
-      esac
-      ;;
-
-    interix[[3-9]]*)
-      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
-      # Instead, we relocate shared libraries at runtime.
-      ;;
-
-    msdosdjgpp*)
-      # Just because we use GCC doesn't mean we suddenly get shared libraries
-      # on systems that don't support them.
-      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
-      enable_shared=no
-      ;;
-
-    *nto* | *qnx*)
-      # QNX uses GNU C++, but need to define -shared option too, otherwise
-      # it will coredump.
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
-      ;;
-
-    sysv4*MP*)
-      if test -d /usr/nec; then
-	_LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
-      fi
-      ;;
-
-    *)
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-      ;;
-    esac
-
-    case $cc_basename in
-    nvcc*) # Cuda Compiler Driver 2.2
-      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker '
-      if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
-        _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)"
-      fi
-      ;;
-    esac
-  else
-    # PORTME Check for flag to pass linker flags through the system compiler.
-    case $host_os in
-    aix*)
-      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-      if test "$host_cpu" = ia64; then
-	# AIX 5 now supports IA64 processor
-	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      else
-	_LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
-      fi
-      ;;
-
-    mingw* | cygwin* | pw32* | os2* | cegcc*)
-      # This hack is so that the source file can tell whether it is being
-      # built for inclusion in a dll (and should export symbols for example).
-      m4_if([$1], [GCJ], [],
-	[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
-      ;;
-
-    hpux9* | hpux10* | hpux11*)
-      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
-      # not for PA HP-UX.
-      case $host_cpu in
-      hppa*64*|ia64*)
-	# +Z the default
-	;;
-      *)
-	_LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
-	;;
-      esac
-      # Is there a better lt_prog_compiler_static that works with the bundled CC?
-      _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
-      ;;
-
-    irix5* | irix6* | nonstopux*)
-      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-      # PIC (with -KPIC) is the default.
-      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
-      ;;
-
-    linux* | k*bsd*-gnu | kopensolaris*-gnu)
-      case $cc_basename in
-      # old Intel for x86_64 which still supported -KPIC.
-      ecc*)
-	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
-        ;;
-      # icc used to be incompatible with GCC.
-      # ICC 10 doesn't accept -KPIC any more.
-      icc* | ifort*)
-	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-	_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
-        ;;
-      # Lahey Fortran 8.1.
-      lf95*)
-	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	_LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared'
-	_LT_TAGVAR(lt_prog_compiler_static, $1)='--static'
-	;;
-      nagfor*)
-	# NAG Fortran compiler
-	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,'
-	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
-	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	;;
-      pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
-        # Portland Group compilers (*not* the Pentium gcc compiler,
-	# which looks to be a dead project)
-	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
-	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-        ;;
-      ccc*)
-        _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-        # All Alpha code is PIC.
-        _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
-        ;;
-      xl* | bgxl* | bgf* | mpixl*)
-	# IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
-	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
-	_LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
-	;;
-      *)
-	case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*)
-	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
-	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	  _LT_TAGVAR(lt_prog_compiler_wl, $1)=''
-	  ;;
-	*Sun\ F* | *Sun*Fortran*)
-	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
-	  ;;
-	*Sun\ C*)
-	  # Sun C 5.9
-	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	  ;;
-        *Intel*\ [[CF]]*Compiler*)
-	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
-	  ;;
-	*Portland\ Group*)
-	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
-	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	  ;;
-	esac
-	;;
-      esac
-      ;;
-
-    newsos6)
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      ;;
-
-    *nto* | *qnx*)
-      # QNX uses GNU C++, but need to define -shared option too, otherwise
-      # it will coredump.
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
-      ;;
-
-    osf3* | osf4* | osf5*)
-      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-      # All OSF/1 code is PIC.
-      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
-      ;;
-
-    rdos*)
-      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
-      ;;
-
-    solaris*)
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      case $cc_basename in
-      f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
-	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
-      *)
-	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
-      esac
-      ;;
-
-    sunos4*)
-      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
-      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      ;;
-
-    sysv4 | sysv4.2uw2* | sysv4.3*)
-      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      ;;
-
-    sysv4*MP*)
-      if test -d /usr/nec ;then
-	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
-	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      fi
-      ;;
-
-    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
-      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      ;;
-
-    unicos*)
-      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
-      ;;
-
-    uts4*)
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
-      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      ;;
-
-    *)
-      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
-      ;;
-    esac
-  fi
-])
-case $host_os in
-  # For platforms which do not support PIC, -DPIC is meaningless:
-  *djgpp*)
-    _LT_TAGVAR(lt_prog_compiler_pic, $1)=
-    ;;
-  *)
-    _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t at m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])"
-    ;;
-esac
-
-AC_CACHE_CHECK([for $compiler option to produce PIC],
-  [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)],
-  [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)])
-_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)
-
-#
-# Check to make sure the PIC flag actually works.
-#
-if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
-  _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works],
-    [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)],
-    [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t at m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [],
-    [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in
-     "" | " "*) ;;
-     *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;;
-     esac],
-    [_LT_TAGVAR(lt_prog_compiler_pic, $1)=
-     _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])
-fi
-_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1],
-	[Additional compiler flags for building library objects])
-
-_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1],
-	[How to pass a linker flag through the compiler])
-#
-# Check to make sure the static flag actually works.
-#
-wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\"
-_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
-  _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1),
-  $lt_tmp_static_flag,
-  [],
-  [_LT_TAGVAR(lt_prog_compiler_static, $1)=])
-_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1],
-	[Compiler flag to prevent dynamic linking])
-])# _LT_COMPILER_PIC
-
-
-# _LT_LINKER_SHLIBS([TAGNAME])
-# ----------------------------
-# See if the linker supports building shared libraries.
-m4_defun([_LT_LINKER_SHLIBS],
-[AC_REQUIRE([LT_PATH_LD])dnl
-AC_REQUIRE([LT_PATH_NM])dnl
-m4_require([_LT_PATH_MANIFEST_TOOL])dnl
-m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-m4_require([_LT_DECL_EGREP])dnl
-m4_require([_LT_DECL_SED])dnl
-m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
-m4_require([_LT_TAG_COMPILER])dnl
-AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
-m4_if([$1], [CXX], [
-  _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
-  _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
-  case $host_os in
-  aix[[4-9]]*)
-    # If we're using GNU nm, then we don't want the "-C" option.
-    # -C means demangle to AIX nm, but means don't demangle with GNU nm
-    # Also, AIX nm treats weak defined symbols like other global defined
-    # symbols, whereas GNU nm marks them as "W".
-    if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
-      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
-    else
-      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
-    fi
-    ;;
-  pw32*)
-    _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
-    ;;
-  cygwin* | mingw* | cegcc*)
-    case $cc_basename in
-    cl*)
-      _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
-      ;;
-    *)
-      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
-      _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
-      ;;
-    esac
-    ;;
-  linux* | k*bsd*-gnu | gnu*)
-    _LT_TAGVAR(link_all_deplibs, $1)=no
-    ;;
-  *)
-    _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
-    ;;
-  esac
-], [
-  runpath_var=
-  _LT_TAGVAR(allow_undefined_flag, $1)=
-  _LT_TAGVAR(always_export_symbols, $1)=no
-  _LT_TAGVAR(archive_cmds, $1)=
-  _LT_TAGVAR(archive_expsym_cmds, $1)=
-  _LT_TAGVAR(compiler_needs_object, $1)=no
-  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
-  _LT_TAGVAR(export_dynamic_flag_spec, $1)=
-  _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
-  _LT_TAGVAR(hardcode_automatic, $1)=no
-  _LT_TAGVAR(hardcode_direct, $1)=no
-  _LT_TAGVAR(hardcode_direct_absolute, $1)=no
-  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
-  _LT_TAGVAR(hardcode_libdir_separator, $1)=
-  _LT_TAGVAR(hardcode_minus_L, $1)=no
-  _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
-  _LT_TAGVAR(inherit_rpath, $1)=no
-  _LT_TAGVAR(link_all_deplibs, $1)=unknown
-  _LT_TAGVAR(module_cmds, $1)=
-  _LT_TAGVAR(module_expsym_cmds, $1)=
-  _LT_TAGVAR(old_archive_from_new_cmds, $1)=
-  _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)=
-  _LT_TAGVAR(thread_safe_flag_spec, $1)=
-  _LT_TAGVAR(whole_archive_flag_spec, $1)=
-  # include_expsyms should be a list of space-separated symbols to be *always*
-  # included in the symbol list
-  _LT_TAGVAR(include_expsyms, $1)=
-  # exclude_expsyms can be an extended regexp of symbols to exclude
-  # it will be wrapped by ` (' and `)$', so one must not match beginning or
-  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
-  # as well as any symbol that contains `d'.
-  _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
-  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
-  # platforms (ab)use it in PIC code, but their linkers get confused if
-  # the symbol is explicitly referenced.  Since portable code cannot
-  # rely on this symbol name, it's probably fine to never include it in
-  # preloaded symbol tables.
-  # Exclude shared library initialization/finalization symbols.
-dnl Note also adjust exclude_expsyms for C++ above.
-  extract_expsyms_cmds=
-
-  case $host_os in
-  cygwin* | mingw* | pw32* | cegcc*)
-    # FIXME: the MSVC++ port hasn't been tested in a loooong time
-    # When not using gcc, we currently assume that we are using
-    # Microsoft Visual C++.
-    if test "$GCC" != yes; then
-      with_gnu_ld=no
-    fi
-    ;;
-  interix*)
-    # we just hope/assume this is gcc and not c89 (= MSVC++)
-    with_gnu_ld=yes
-    ;;
-  openbsd*)
-    with_gnu_ld=no
-    ;;
-  linux* | k*bsd*-gnu | gnu*)
-    _LT_TAGVAR(link_all_deplibs, $1)=no
-    ;;
-  esac
-
-  _LT_TAGVAR(ld_shlibs, $1)=yes
-
-  # On some targets, GNU ld is compatible enough with the native linker
-  # that we're better off using the native interface for both.
-  lt_use_gnu_ld_interface=no
-  if test "$with_gnu_ld" = yes; then
-    case $host_os in
-      aix*)
-	# The AIX port of GNU ld has always aspired to compatibility
-	# with the native linker.  However, as the warning in the GNU ld
-	# block says, versions before 2.19.5* couldn't really create working
-	# shared libraries, regardless of the interface used.
-	case `$LD -v 2>&1` in
-	  *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
-	  *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;;
-	  *\ \(GNU\ Binutils\)\ [[3-9]]*) ;;
-	  *)
-	    lt_use_gnu_ld_interface=yes
-	    ;;
-	esac
-	;;
-      *)
-	lt_use_gnu_ld_interface=yes
-	;;
-    esac
-  fi
-
-  if test "$lt_use_gnu_ld_interface" = yes; then
-    # If archive_cmds runs LD, not CC, wlarc should be empty
-    wlarc='${wl}'
-
-    # Set some defaults for GNU ld with shared library support. These
-    # are reset later if shared libraries are not supported. Putting them
-    # here allows them to be overridden if necessary.
-    runpath_var=LD_RUN_PATH
-    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
-    # ancient GNU ld didn't support --whole-archive et. al.
-    if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
-      _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
-    else
-      _LT_TAGVAR(whole_archive_flag_spec, $1)=
-    fi
-    supports_anon_versioning=no
-    case `$LD -v 2>&1` in
-      *GNU\ gold*) supports_anon_versioning=yes ;;
-      *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
-      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
-      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
-      *\ 2.11.*) ;; # other 2.11 versions
-      *) supports_anon_versioning=yes ;;
-    esac
-
-    # See if GNU ld supports shared libraries.
-    case $host_os in
-    aix[[3-9]]*)
-      # On AIX/PPC, the GNU linker is very broken
-      if test "$host_cpu" != ia64; then
-	_LT_TAGVAR(ld_shlibs, $1)=no
-	cat <<_LT_EOF 1>&2
-
-*** Warning: the GNU linker, at least up to release 2.19, is reported
-*** to be unable to reliably create shared libraries on AIX.
-*** Therefore, libtool is disabling shared libraries support.  If you
-*** really care for shared libraries, you may want to install binutils
-*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
-*** You will then need to restart the configuration process.
-
-_LT_EOF
-      fi
-      ;;
-
-    amigaos*)
-      case $host_cpu in
-      powerpc)
-            # see comment about AmigaOS4 .so support
-            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-            _LT_TAGVAR(archive_expsym_cmds, $1)=''
-        ;;
-      m68k)
-            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
-            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-            _LT_TAGVAR(hardcode_minus_L, $1)=yes
-        ;;
-      esac
-      ;;
-
-    beos*)
-      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-	# Joseph Beckenbach <jrb3 at best.com> says some releases of gcc
-	# support --undefined.  This deserves some investigation.  FIXME
-	_LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-      else
-	_LT_TAGVAR(ld_shlibs, $1)=no
-      fi
-      ;;
-
-    cygwin* | mingw* | pw32* | cegcc*)
-      # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
-      # as there is no search path for DLLs.
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
-      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-      _LT_TAGVAR(always_export_symbols, $1)=no
-      _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
-      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
-      _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
-
-      if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
-        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-	# If the export-symbols file already is a .def file (1st line
-	# is EXPORTS), use it as is; otherwise, prepend...
-	_LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-	  cp $export_symbols $output_objdir/$soname.def;
-	else
-	  echo EXPORTS > $output_objdir/$soname.def;
-	  cat $export_symbols >> $output_objdir/$soname.def;
-	fi~
-	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-      else
-	_LT_TAGVAR(ld_shlibs, $1)=no
-      fi
-      ;;
-
-    haiku*)
-      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-      _LT_TAGVAR(link_all_deplibs, $1)=yes
-      ;;
-
-    interix[[3-9]]*)
-      _LT_TAGVAR(hardcode_direct, $1)=no
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
-      # Instead, shared libraries are loaded at an image base (0x10000000 by
-      # default) and relocated if they conflict, which is a slow very memory
-      # consuming and fragmenting process.  To avoid this, we pick a random,
-      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
-      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
-      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
-      _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
-      ;;
-
-    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
-      tmp_diet=no
-      if test "$host_os" = linux-dietlibc; then
-	case $cc_basename in
-	  diet\ *) tmp_diet=yes;;	# linux-dietlibc with static linking (!diet-dyn)
-	esac
-      fi
-      if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
-	 && test "$tmp_diet" = no
-      then
-	tmp_addflag=' $pic_flag'
-	tmp_sharedflag='-shared'
-	case $cc_basename,$host_cpu in
-        pgcc*)				# Portland Group C compiler
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
-	  tmp_addflag=' $pic_flag'
-	  ;;
-	pgf77* | pgf90* | pgf95* | pgfortran*)
-					# Portland Group f77 and f90 compilers
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
-	  tmp_addflag=' $pic_flag -Mnomain' ;;
-	ecc*,ia64* | icc*,ia64*)	# Intel C compiler on ia64
-	  tmp_addflag=' -i_dynamic' ;;
-	efc*,ia64* | ifort*,ia64*)	# Intel Fortran compiler on ia64
-	  tmp_addflag=' -i_dynamic -nofor_main' ;;
-	ifc* | ifort*)			# Intel Fortran compiler
-	  tmp_addflag=' -nofor_main' ;;
-	lf95*)				# Lahey Fortran 8.1
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)=
-	  tmp_sharedflag='--shared' ;;
-	xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below)
-	  tmp_sharedflag='-qmkshrobj'
-	  tmp_addflag= ;;
-	nvcc*)	# Cuda Compiler Driver 2.2
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
-	  _LT_TAGVAR(compiler_needs_object, $1)=yes
-	  ;;
-	esac
-	case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ C*)			# Sun C 5.9
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
-	  _LT_TAGVAR(compiler_needs_object, $1)=yes
-	  tmp_sharedflag='-G' ;;
-	*Sun\ F*)			# Sun Fortran 8.3
-	  tmp_sharedflag='-G' ;;
-	esac
-	_LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-
-        if test "x$supports_anon_versioning" = xyes; then
-          _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
-	    cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
-	    echo "local: *; };" >> $output_objdir/$libname.ver~
-	    $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
-        fi
-
-	case $cc_basename in
-	xlf* | bgf* | bgxlf* | mpixlf*)
-	  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive'
-	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-	  _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
-	  if test "x$supports_anon_versioning" = xyes; then
-	    _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
-	      cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
-	      echo "local: *; };" >> $output_objdir/$libname.ver~
-	      $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
-	  fi
-	  ;;
-	esac
-      else
-        _LT_TAGVAR(ld_shlibs, $1)=no
-      fi
-      ;;
-
-    netbsd* | netbsdelf*-gnu)
-      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
-	_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
-	wlarc=
-      else
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-      fi
-      ;;
-
-    solaris*)
-      if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
-	_LT_TAGVAR(ld_shlibs, $1)=no
-	cat <<_LT_EOF 1>&2
-
-*** Warning: The releases 2.8.* of the GNU linker cannot reliably
-*** create shared libraries on Solaris systems.  Therefore, libtool
-*** is disabling shared libraries support.  We urge you to upgrade GNU
-*** binutils to release 2.9.1 or newer.  Another option is to modify
-*** your PATH or compiler configuration so that the native linker is
-*** used, and then restart.
-
-_LT_EOF
-      elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-      else
-	_LT_TAGVAR(ld_shlibs, $1)=no
-      fi
-      ;;
-
-    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
-      case `$LD -v 2>&1` in
-        *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*)
-	_LT_TAGVAR(ld_shlibs, $1)=no
-	cat <<_LT_EOF 1>&2
-
-*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
-*** reliably create shared libraries on SCO systems.  Therefore, libtool
-*** is disabling shared libraries support.  We urge you to upgrade GNU
-*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
-*** your PATH or compiler configuration so that the native linker is
-*** used, and then restart.
-
-_LT_EOF
-	;;
-	*)
-	  # For security reasons, it is highly recommended that you always
-	  # use absolute paths for naming shared libraries, and exclude the
-	  # DT_RUNPATH tag from executables and libraries.  But doing so
-	  # requires that you compile everything twice, which is a pain.
-	  if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-	  else
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	  fi
-	;;
-      esac
-      ;;
-
-    sunos4*)
-      _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-      wlarc=
-      _LT_TAGVAR(hardcode_direct, $1)=yes
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    *)
-      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-      else
-	_LT_TAGVAR(ld_shlibs, $1)=no
-      fi
-      ;;
-    esac
-
-    if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then
-      runpath_var=
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
-      _LT_TAGVAR(export_dynamic_flag_spec, $1)=
-      _LT_TAGVAR(whole_archive_flag_spec, $1)=
-    fi
-  else
-    # PORTME fill in a description of your system's linker (not GNU ld)
-    case $host_os in
-    aix3*)
-      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-      _LT_TAGVAR(always_export_symbols, $1)=yes
-      _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
-      # Note: this linker hardcodes the directories in LIBPATH if there
-      # are no directories specified by -L.
-      _LT_TAGVAR(hardcode_minus_L, $1)=yes
-      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
-	# Neither direct hardcoding nor static linking is supported with a
-	# broken collect2.
-	_LT_TAGVAR(hardcode_direct, $1)=unsupported
-      fi
-      ;;
-
-    aix[[4-9]]*)
-      if test "$host_cpu" = ia64; then
-	# On IA64, the linker does run time linking by default, so we don't
-	# have to do anything special.
-	aix_use_runtimelinking=no
-	exp_sym_flag='-Bexport'
-	no_entry_flag=""
-      else
-	# If we're using GNU nm, then we don't want the "-C" option.
-	# -C means demangle to AIX nm, but means don't demangle with GNU nm
-	# Also, AIX nm treats weak defined symbols like other global
-	# defined symbols, whereas GNU nm marks them as "W".
-	if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
-	  _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
-	else
-	  _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
-	fi
-	aix_use_runtimelinking=no
-
-	# Test if we are trying to use run time linking or normal
-	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
-	# need to do runtime linking.
-	case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
-	  for ld_flag in $LDFLAGS; do
-	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
-	    aix_use_runtimelinking=yes
-	    break
-	  fi
-	  done
-	  ;;
-	esac
-
-	exp_sym_flag='-bexport'
-	no_entry_flag='-bnoentry'
-      fi
-
-      # When large executables or shared objects are built, AIX ld can
-      # have problems creating the table of contents.  If linking a library
-      # or program results in "error TOC overflow" add -mminimal-toc to
-      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
-      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
-
-      _LT_TAGVAR(archive_cmds, $1)=''
-      _LT_TAGVAR(hardcode_direct, $1)=yes
-      _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
-      _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
-      _LT_TAGVAR(link_all_deplibs, $1)=yes
-      _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
-
-      if test "$GCC" = yes; then
-	case $host_os in aix4.[[012]]|aix4.[[012]].*)
-	# We only want to do this on AIX 4.2 and lower, the check
-	# below for broken collect2 doesn't work under 4.3+
-	  collect2name=`${CC} -print-prog-name=collect2`
-	  if test -f "$collect2name" &&
-	   strings "$collect2name" | $GREP resolve_lib_name >/dev/null
-	  then
-	  # We have reworked collect2
-	  :
-	  else
-	  # We have old collect2
-	  _LT_TAGVAR(hardcode_direct, $1)=unsupported
-	  # It fails to find uninstalled libraries when the uninstalled
-	  # path is not listed in the libpath.  Setting hardcode_minus_L
-	  # to unsupported forces relinking
-	  _LT_TAGVAR(hardcode_minus_L, $1)=yes
-	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-	  _LT_TAGVAR(hardcode_libdir_separator, $1)=
-	  fi
-	  ;;
-	esac
-	shared_flag='-shared'
-	if test "$aix_use_runtimelinking" = yes; then
-	  shared_flag="$shared_flag "'${wl}-G'
-	fi
-	_LT_TAGVAR(link_all_deplibs, $1)=no
-      else
-	# not using gcc
-	if test "$host_cpu" = ia64; then
-	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
-	# chokes on -Wl,-G. The following line is correct:
-	  shared_flag='-G'
-	else
-	  if test "$aix_use_runtimelinking" = yes; then
-	    shared_flag='${wl}-G'
-	  else
-	    shared_flag='${wl}-bM:SRE'
-	  fi
-	fi
-      fi
-
-      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
-      # It seems that -bexpall does not export symbols beginning with
-      # underscore (_), so it is better to generate a list of symbols to export.
-      _LT_TAGVAR(always_export_symbols, $1)=yes
-      if test "$aix_use_runtimelinking" = yes; then
-	# Warning - without using the other runtime loading flags (-brtl),
-	# -berok will link without error, but may produce a broken library.
-	_LT_TAGVAR(allow_undefined_flag, $1)='-berok'
-        # Determine the default libpath from the value encoded in an
-        # empty executable.
-        _LT_SYS_MODULE_PATH_AIX([$1])
-        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
-        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
-      else
-	if test "$host_cpu" = ia64; then
-	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
-	  _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
-	  _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
-	else
-	 # Determine the default libpath from the value encoded in an
-	 # empty executable.
-	 _LT_SYS_MODULE_PATH_AIX([$1])
-	 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
-	  # Warning - without using the other run time loading flags,
-	  # -berok will link without error, but may produce a broken library.
-	  _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
-	  _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
-	  if test "$with_gnu_ld" = yes; then
-	    # We only use this code for GNU lds that support --whole-archive.
-	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
-	  else
-	    # Exported symbols can be pulled into shared objects from archives
-	    _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
-	  fi
-	  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
-	  # This is similar to how AIX traditionally builds its shared libraries.
-	  _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
-	fi
-      fi
-      ;;
-
-    amigaos*)
-      case $host_cpu in
-      powerpc)
-            # see comment about AmigaOS4 .so support
-            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-            _LT_TAGVAR(archive_expsym_cmds, $1)=''
-        ;;
-      m68k)
-            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
-            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-            _LT_TAGVAR(hardcode_minus_L, $1)=yes
-        ;;
-      esac
-      ;;
-
-    bsdi[[45]]*)
-      _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
-      ;;
-
-    cygwin* | mingw* | pw32* | cegcc*)
-      # When not using gcc, we currently assume that we are using
-      # Microsoft Visual C++.
-      # hardcode_libdir_flag_spec is actually meaningless, as there is
-      # no search path for DLLs.
-      case $cc_basename in
-      cl*)
-	# Native MSVC
-	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
-	_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-	_LT_TAGVAR(always_export_symbols, $1)=yes
-	_LT_TAGVAR(file_list_spec, $1)='@'
-	# Tell ltmain to make .lib files, not .a files.
-	libext=lib
-	# Tell ltmain to make .dll files, not .so files.
-	shrext_cmds=".dll"
-	# FIXME: Setting linknames here is a bad hack.
-	_LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
-	_LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-	    sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
-	  else
-	    sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
-	  fi~
-	  $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
-	  linknames='
-	# The linker will not automatically build a static lib if we build a DLL.
-	# _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
-	_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
-	_LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
-	_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
-	# Don't use ranlib
-	_LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
-	_LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
-	  lt_tool_outputfile="@TOOL_OUTPUT@"~
-	  case $lt_outputfile in
-	    *.exe|*.EXE) ;;
-	    *)
-	      lt_outputfile="$lt_outputfile.exe"
-	      lt_tool_outputfile="$lt_tool_outputfile.exe"
-	      ;;
-	  esac~
-	  if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
-	    $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
-	    $RM "$lt_outputfile.manifest";
-	  fi'
-	;;
-      *)
-	# Assume MSVC wrapper
-	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
-	_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-	# Tell ltmain to make .lib files, not .a files.
-	libext=lib
-	# Tell ltmain to make .dll files, not .so files.
-	shrext_cmds=".dll"
-	# FIXME: Setting linknames here is a bad hack.
-	_LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
-	# The linker will automatically build a .lib file if we build a DLL.
-	_LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
-	# FIXME: Should let the user specify the lib program.
-	_LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
-	_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
-	;;
-      esac
-      ;;
-
-    darwin* | rhapsody*)
-      _LT_DARWIN_LINKER_FEATURES($1)
-      ;;
-
-    dgux*)
-      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
-    # support.  Future versions do this automatically, but an explicit c++rt0.o
-    # does not break anything, and helps significantly (at the cost of a little
-    # extra space).
-    freebsd2.2*)
-      _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-      _LT_TAGVAR(hardcode_direct, $1)=yes
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
-    freebsd2.*)
-      _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-      _LT_TAGVAR(hardcode_direct, $1)=yes
-      _LT_TAGVAR(hardcode_minus_L, $1)=yes
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
-    freebsd* | dragonfly*)
-      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-      _LT_TAGVAR(hardcode_direct, $1)=yes
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    hpux9*)
-      if test "$GCC" = yes; then
-	_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
-      else
-	_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
-      fi
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
-      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-      _LT_TAGVAR(hardcode_direct, $1)=yes
-
-      # hardcode_minus_L: Not really in the search PATH,
-      # but as the default location of the library.
-      _LT_TAGVAR(hardcode_minus_L, $1)=yes
-      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-      ;;
-
-    hpux10*)
-      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-      else
-	_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
-      fi
-      if test "$with_gnu_ld" = no; then
-	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
-	_LT_TAGVAR(hardcode_libdir_separator, $1)=:
-	_LT_TAGVAR(hardcode_direct, $1)=yes
-	_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
-	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-	# hardcode_minus_L: Not really in the search PATH,
-	# but as the default location of the library.
-	_LT_TAGVAR(hardcode_minus_L, $1)=yes
-      fi
-      ;;
-
-    hpux11*)
-      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
-	case $host_cpu in
-	hppa*64*)
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	ia64*)
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	*)
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	esac
-      else
-	case $host_cpu in
-	hppa*64*)
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	ia64*)
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	*)
-	m4_if($1, [], [
-	  # Older versions of the 11.00 compiler do not understand -b yet
-	  # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
-	  _LT_LINKER_OPTION([if $CC understands -b],
-	    _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b],
-	    [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'],
-	    [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])],
-	  [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'])
-	  ;;
-	esac
-      fi
-      if test "$with_gnu_ld" = no; then
-	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
-	_LT_TAGVAR(hardcode_libdir_separator, $1)=:
-
-	case $host_cpu in
-	hppa*64*|ia64*)
-	  _LT_TAGVAR(hardcode_direct, $1)=no
-	  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-	  ;;
-	*)
-	  _LT_TAGVAR(hardcode_direct, $1)=yes
-	  _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
-	  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-
-	  # hardcode_minus_L: Not really in the search PATH,
-	  # but as the default location of the library.
-	  _LT_TAGVAR(hardcode_minus_L, $1)=yes
-	  ;;
-	esac
-      fi
-      ;;
-
-    irix5* | irix6* | nonstopux*)
-      if test "$GCC" = yes; then
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-	# Try to use the -exported_symbol ld option, if it does not
-	# work, assume that -exports_file does not work either and
-	# implicitly export all symbols.
-	# This should be the same for all languages, so no per-tag cache variable.
-	AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol],
-	  [lt_cv_irix_exported_symbol],
-	  [save_LDFLAGS="$LDFLAGS"
-	   LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
-	   AC_LINK_IFELSE(
-	     [AC_LANG_SOURCE(
-	        [AC_LANG_CASE([C], [[int foo (void) { return 0; }]],
-			      [C++], [[int foo (void) { return 0; }]],
-			      [Fortran 77], [[
-      subroutine foo
-      end]],
-			      [Fortran], [[
-      subroutine foo
-      end]])])],
-	      [lt_cv_irix_exported_symbol=yes],
-	      [lt_cv_irix_exported_symbol=no])
-           LDFLAGS="$save_LDFLAGS"])
-	if test "$lt_cv_irix_exported_symbol" = yes; then
-          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
-	fi
-      else
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
-      fi
-      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-      _LT_TAGVAR(inherit_rpath, $1)=yes
-      _LT_TAGVAR(link_all_deplibs, $1)=yes
-      ;;
-
-    netbsd* | netbsdelf*-gnu)
-      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
-	_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
-      else
-	_LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
-      fi
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-      _LT_TAGVAR(hardcode_direct, $1)=yes
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    newsos6)
-      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      _LT_TAGVAR(hardcode_direct, $1)=yes
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    *nto* | *qnx*)
-      ;;
-
-    openbsd*)
-      if test -f /usr/libexec/ld.so; then
-	_LT_TAGVAR(hardcode_direct, $1)=yes
-	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-	_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
-	if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-	  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
-	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-	  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-	else
-	  case $host_os in
-	   openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
-	     _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-	     _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-	     ;;
-	   *)
-	     _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-	     _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-	     ;;
-	  esac
-	fi
-      else
-	_LT_TAGVAR(ld_shlibs, $1)=no
-      fi
-      ;;
-
-    os2*)
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-      _LT_TAGVAR(hardcode_minus_L, $1)=yes
-      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-      _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
-      _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
-      ;;
-
-    osf3*)
-      if test "$GCC" = yes; then
-	_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-      else
-	_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
-      fi
-      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-      ;;
-
-    osf4* | osf5*)	# as osf3* with the addition of -msym flag
-      if test "$GCC" = yes; then
-	_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-      else
-	_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
-	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
-
-	# Both c and cxx compiler support -rpath directly
-	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
-      fi
-      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
-      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-      ;;
-
-    solaris*)
-      _LT_TAGVAR(no_undefined_flag, $1)=' -z defs'
-      if test "$GCC" = yes; then
-	wlarc='${wl}'
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-	  $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
-      else
-	case `$CC -V 2>&1` in
-	*"Compilers 5.0"*)
-	  wlarc=''
-	  _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	  _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-	  $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
-	  ;;
-	*)
-	  wlarc='${wl}'
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
-	  _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-	  $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
-	  ;;
-	esac
-      fi
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      case $host_os in
-      solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
-      *)
-	# The compiler driver will combine and reorder linker options,
-	# but understands `-z linker_flag'.  GCC discards it without `$wl',
-	# but is careful enough not to reorder.
-	# Supported since Solaris 2.6 (maybe 2.5.1?)
-	if test "$GCC" = yes; then
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
-	else
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
-	fi
-	;;
-      esac
-      _LT_TAGVAR(link_all_deplibs, $1)=yes
-      ;;
-
-    sunos4*)
-      if test "x$host_vendor" = xsequent; then
-	# Use $CC to link under sequent, because it throws in some extra .o
-	# files that make .init and .fini sections work.
-	_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
-      else
-	_LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
-      fi
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-      _LT_TAGVAR(hardcode_direct, $1)=yes
-      _LT_TAGVAR(hardcode_minus_L, $1)=yes
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    sysv4)
-      case $host_vendor in
-	sni)
-	  _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	  _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true???
-	;;
-	siemens)
-	  ## LD is ld it makes a PLAMLIB
-	  ## CC just makes a GrossModule.
-	  _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
-	  _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'
-	  _LT_TAGVAR(hardcode_direct, $1)=no
-        ;;
-	motorola)
-	  _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	  _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie
-	;;
-      esac
-      runpath_var='LD_RUN_PATH'
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    sysv4.3*)
-      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'
-      ;;
-
-    sysv4*MP*)
-      if test -d /usr/nec; then
-	_LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-	runpath_var=LD_RUN_PATH
-	hardcode_runpath_var=yes
-	_LT_TAGVAR(ld_shlibs, $1)=yes
-      fi
-      ;;
-
-    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
-      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
-      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      runpath_var='LD_RUN_PATH'
-
-      if test "$GCC" = yes; then
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-      else
-	_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-      fi
-      ;;
-
-    sysv5* | sco3.2v5* | sco5v6*)
-      # Note: We can NOT use -z defs as we might desire, because we do not
-      # link with -lc, and that would cause any symbols used from libc to
-      # always be unresolved, which means just about no library would
-      # ever link correctly.  If we're not using GNU ld we use -z text
-      # though, which does catch some bad symbols but isn't as heavy-handed
-      # as -z defs.
-      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
-      _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
-      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
-      _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
-      _LT_TAGVAR(link_all_deplibs, $1)=yes
-      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
-      runpath_var='LD_RUN_PATH'
-
-      if test "$GCC" = yes; then
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-      else
-	_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-      fi
-      ;;
-
-    uts4*)
-      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    *)
-      _LT_TAGVAR(ld_shlibs, $1)=no
-      ;;
-    esac
-
-    if test x$host_vendor = xsni; then
-      case $host in
-      sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
-	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym'
-	;;
-      esac
-    fi
-  fi
-])
-AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
-test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
-
-_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld
-
-_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl
-_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl
-_LT_DECL([], [extract_expsyms_cmds], [2],
-    [The commands to extract the exported symbol list from a shared archive])
-
-#
-# Do we need to explicitly link libc?
-#
-case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in
-x|xyes)
-  # Assume -lc should be added
-  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
-
-  if test "$enable_shared" = yes && test "$GCC" = yes; then
-    case $_LT_TAGVAR(archive_cmds, $1) in
-    *'~'*)
-      # FIXME: we may have to deal with multi-command sequences.
-      ;;
-    '$CC '*)
-      # Test whether the compiler implicitly links with -lc since on some
-      # systems, -lgcc has to come before -lc. If gcc already passes -lc
-      # to ld, don't add -lc before -lgcc.
-      AC_CACHE_CHECK([whether -lc should be explicitly linked in],
-	[lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1),
-	[$RM conftest*
-	echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-
-	if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
-	  soname=conftest
-	  lib=conftest
-	  libobjs=conftest.$ac_objext
-	  deplibs=
-	  wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1)
-	  pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)
-	  compiler_flags=-v
-	  linker_flags=-v
-	  verstring=
-	  output_objdir=.
-	  libname=conftest
-	  lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)
-	  _LT_TAGVAR(allow_undefined_flag, $1)=
-	  if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1)
-	  then
-	    lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no
-	  else
-	    lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes
-	  fi
-	  _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
-	else
-	  cat conftest.err 1>&5
-	fi
-	$RM conftest*
-	])
-      _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)
-      ;;
-    esac
-  fi
-  ;;
-esac
-
-_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0],
-    [Whether or not to add -lc for building shared libraries])
-_LT_TAGDECL([allow_libtool_libs_with_static_runtimes],
-    [enable_shared_with_static_runtimes], [0],
-    [Whether or not to disallow shared libs when runtime libs are static])
-_LT_TAGDECL([], [export_dynamic_flag_spec], [1],
-    [Compiler flag to allow reflexive dlopens])
-_LT_TAGDECL([], [whole_archive_flag_spec], [1],
-    [Compiler flag to generate shared objects directly from archives])
-_LT_TAGDECL([], [compiler_needs_object], [1],
-    [Whether the compiler copes with passing no objects directly])
-_LT_TAGDECL([], [old_archive_from_new_cmds], [2],
-    [Create an old-style archive from a shared archive])
-_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2],
-    [Create a temporary old-style archive to link instead of a shared archive])
-_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive])
-_LT_TAGDECL([], [archive_expsym_cmds], [2])
-_LT_TAGDECL([], [module_cmds], [2],
-    [Commands used to build a loadable module if different from building
-    a shared archive.])
-_LT_TAGDECL([], [module_expsym_cmds], [2])
-_LT_TAGDECL([], [with_gnu_ld], [1],
-    [Whether we are building with GNU ld or not])
-_LT_TAGDECL([], [allow_undefined_flag], [1],
-    [Flag that allows shared libraries with undefined symbols to be built])
-_LT_TAGDECL([], [no_undefined_flag], [1],
-    [Flag that enforces no undefined symbols])
-_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1],
-    [Flag to hardcode $libdir into a binary during linking.
-    This must work even if $libdir does not exist])
-_LT_TAGDECL([], [hardcode_libdir_separator], [1],
-    [Whether we need a single "-rpath" flag with a separated argument])
-_LT_TAGDECL([], [hardcode_direct], [0],
-    [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
-    DIR into the resulting binary])
-_LT_TAGDECL([], [hardcode_direct_absolute], [0],
-    [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
-    DIR into the resulting binary and the resulting library dependency is
-    "absolute", i.e impossible to change by setting ${shlibpath_var} if the
-    library is relocated])
-_LT_TAGDECL([], [hardcode_minus_L], [0],
-    [Set to "yes" if using the -LDIR flag during linking hardcodes DIR
-    into the resulting binary])
-_LT_TAGDECL([], [hardcode_shlibpath_var], [0],
-    [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
-    into the resulting binary])
-_LT_TAGDECL([], [hardcode_automatic], [0],
-    [Set to "yes" if building a shared library automatically hardcodes DIR
-    into the library and all subsequent libraries and executables linked
-    against it])
-_LT_TAGDECL([], [inherit_rpath], [0],
-    [Set to yes if linker adds runtime paths of dependent libraries
-    to runtime path list])
-_LT_TAGDECL([], [link_all_deplibs], [0],
-    [Whether libtool must link a program against all its dependency libraries])
-_LT_TAGDECL([], [always_export_symbols], [0],
-    [Set to "yes" if exported symbols are required])
-_LT_TAGDECL([], [export_symbols_cmds], [2],
-    [The commands to list exported symbols])
-_LT_TAGDECL([], [exclude_expsyms], [1],
-    [Symbols that should not be listed in the preloaded symbols])
-_LT_TAGDECL([], [include_expsyms], [1],
-    [Symbols that must always be exported])
-_LT_TAGDECL([], [prelink_cmds], [2],
-    [Commands necessary for linking programs (against libraries) with templates])
-_LT_TAGDECL([], [postlink_cmds], [2],
-    [Commands necessary for finishing linking programs])
-_LT_TAGDECL([], [file_list_spec], [1],
-    [Specify filename containing input files])
-dnl FIXME: Not yet implemented
-dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1],
-dnl    [Compiler flag to generate thread safe objects])
-])# _LT_LINKER_SHLIBS
-
-
-# _LT_LANG_C_CONFIG([TAG])
-# ------------------------
-# Ensure that the configuration variables for a C compiler are suitably
-# defined.  These variables are subsequently used by _LT_CONFIG to write
-# the compiler configuration to `libtool'.
-m4_defun([_LT_LANG_C_CONFIG],
-[m4_require([_LT_DECL_EGREP])dnl
-lt_save_CC="$CC"
-AC_LANG_PUSH(C)
-
-# Source file extension for C test sources.
-ac_ext=c
-
-# Object file extension for compiled C test sources.
-objext=o
-_LT_TAGVAR(objext, $1)=$objext
-
-# Code to be used in simple compile tests
-lt_simple_compile_test_code="int some_variable = 0;"
-
-# Code to be used in simple link tests
-lt_simple_link_test_code='int main(){return(0);}'
-
-_LT_TAG_COMPILER
-# Save the default compiler, since it gets overwritten when the other
-# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
-compiler_DEFAULT=$CC
-
-# save warnings/boilerplate of simple test code
-_LT_COMPILER_BOILERPLATE
-_LT_LINKER_BOILERPLATE
-
-if test -n "$compiler"; then
-  _LT_COMPILER_NO_RTTI($1)
-  _LT_COMPILER_PIC($1)
-  _LT_COMPILER_C_O($1)
-  _LT_COMPILER_FILE_LOCKS($1)
-  _LT_LINKER_SHLIBS($1)
-  _LT_SYS_DYNAMIC_LINKER($1)
-  _LT_LINKER_HARDCODE_LIBPATH($1)
-  LT_SYS_DLOPEN_SELF
-  _LT_CMD_STRIPLIB
-
-  # Report which library types will actually be built
-  AC_MSG_CHECKING([if libtool supports shared libraries])
-  AC_MSG_RESULT([$can_build_shared])
-
-  AC_MSG_CHECKING([whether to build shared libraries])
-  test "$can_build_shared" = "no" && enable_shared=no
-
-  # On AIX, shared libraries and static libraries use the same namespace, and
-  # are all built from PIC.
-  case $host_os in
-  aix3*)
-    test "$enable_shared" = yes && enable_static=no
-    if test -n "$RANLIB"; then
-      archive_cmds="$archive_cmds~\$RANLIB \$lib"
-      postinstall_cmds='$RANLIB $lib'
-    fi
-    ;;
-
-  aix[[4-9]]*)
-    if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
-      test "$enable_shared" = yes && enable_static=no
-    fi
-    ;;
-  esac
-  AC_MSG_RESULT([$enable_shared])
-
-  AC_MSG_CHECKING([whether to build static libraries])
-  # Make sure either enable_shared or enable_static is yes.
-  test "$enable_shared" = yes || enable_static=yes
-  AC_MSG_RESULT([$enable_static])
-
-  _LT_CONFIG($1)
-fi
-AC_LANG_POP
-CC="$lt_save_CC"
-])# _LT_LANG_C_CONFIG
-
-
-# _LT_LANG_CXX_CONFIG([TAG])
-# --------------------------
-# Ensure that the configuration variables for a C++ compiler are suitably
-# defined.  These variables are subsequently used by _LT_CONFIG to write
-# the compiler configuration to `libtool'.
-m4_defun([_LT_LANG_CXX_CONFIG],
-[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-m4_require([_LT_DECL_EGREP])dnl
-m4_require([_LT_PATH_MANIFEST_TOOL])dnl
-if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
-    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
-    (test "X$CXX" != "Xg++"))) ; then
-  AC_PROG_CXXCPP
-else
-  _lt_caught_CXX_error=yes
-fi
-
-AC_LANG_PUSH(C++)
-_LT_TAGVAR(archive_cmds_need_lc, $1)=no
-_LT_TAGVAR(allow_undefined_flag, $1)=
-_LT_TAGVAR(always_export_symbols, $1)=no
-_LT_TAGVAR(archive_expsym_cmds, $1)=
-_LT_TAGVAR(compiler_needs_object, $1)=no
-_LT_TAGVAR(export_dynamic_flag_spec, $1)=
-_LT_TAGVAR(hardcode_direct, $1)=no
-_LT_TAGVAR(hardcode_direct_absolute, $1)=no
-_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
-_LT_TAGVAR(hardcode_libdir_separator, $1)=
-_LT_TAGVAR(hardcode_minus_L, $1)=no
-_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
-_LT_TAGVAR(hardcode_automatic, $1)=no
-_LT_TAGVAR(inherit_rpath, $1)=no
-_LT_TAGVAR(module_cmds, $1)=
-_LT_TAGVAR(module_expsym_cmds, $1)=
-_LT_TAGVAR(link_all_deplibs, $1)=unknown
-_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
-_LT_TAGVAR(reload_flag, $1)=$reload_flag
-_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
-_LT_TAGVAR(no_undefined_flag, $1)=
-_LT_TAGVAR(whole_archive_flag_spec, $1)=
-_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
-
-# Source file extension for C++ test sources.
-ac_ext=cpp
-
-# Object file extension for compiled C++ test sources.
-objext=o
-_LT_TAGVAR(objext, $1)=$objext
-
-# No sense in running all these tests if we already determined that
-# the CXX compiler isn't working.  Some variables (like enable_shared)
-# are currently assumed to apply to all compilers on this platform,
-# and will be corrupted by setting them based on a non-working compiler.
-if test "$_lt_caught_CXX_error" != yes; then
-  # Code to be used in simple compile tests
-  lt_simple_compile_test_code="int some_variable = 0;"
-
-  # Code to be used in simple link tests
-  lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }'
-
-  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
-  _LT_TAG_COMPILER
-
-  # save warnings/boilerplate of simple test code
-  _LT_COMPILER_BOILERPLATE
-  _LT_LINKER_BOILERPLATE
-
-  # Allow CC to be a program name with arguments.
-  lt_save_CC=$CC
-  lt_save_CFLAGS=$CFLAGS
-  lt_save_LD=$LD
-  lt_save_GCC=$GCC
-  GCC=$GXX
-  lt_save_with_gnu_ld=$with_gnu_ld
-  lt_save_path_LD=$lt_cv_path_LD
-  if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
-    lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
-  else
-    $as_unset lt_cv_prog_gnu_ld
-  fi
-  if test -n "${lt_cv_path_LDCXX+set}"; then
-    lt_cv_path_LD=$lt_cv_path_LDCXX
-  else
-    $as_unset lt_cv_path_LD
-  fi
-  test -z "${LDCXX+set}" || LD=$LDCXX
-  CC=${CXX-"c++"}
-  CFLAGS=$CXXFLAGS
-  compiler=$CC
-  _LT_TAGVAR(compiler, $1)=$CC
-  _LT_CC_BASENAME([$compiler])
-
-  if test -n "$compiler"; then
-    # We don't want -fno-exception when compiling C++ code, so set the
-    # no_builtin_flag separately
-    if test "$GXX" = yes; then
-      _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
-    else
-      _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
-    fi
-
-    if test "$GXX" = yes; then
-      # Set up default GNU C++ configuration
-
-      LT_PATH_LD
-
-      # Check if GNU C++ uses GNU ld as the underlying linker, since the
-      # archiving commands below assume that GNU ld is being used.
-      if test "$with_gnu_ld" = yes; then
-        _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
-        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-
-        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
-
-        # If archive_cmds runs LD, not CC, wlarc should be empty
-        # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
-        #     investigate it a little bit more. (MM)
-        wlarc='${wl}'
-
-        # ancient GNU ld didn't support --whole-archive et. al.
-        if eval "`$CC -print-prog-name=ld` --help 2>&1" |
-	  $GREP 'no-whole-archive' > /dev/null; then
-          _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
-        else
-          _LT_TAGVAR(whole_archive_flag_spec, $1)=
-        fi
-      else
-        with_gnu_ld=no
-        wlarc=
-
-        # A generic and very simple default shared library creation
-        # command for GNU C++ for the case where it uses the native
-        # linker, instead of GNU ld.  If possible, this setting should
-        # overridden to take advantage of the native linker features on
-        # the platform it is being used on.
-        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
-      fi
-
-      # Commands to make compiler produce verbose output that lists
-      # what "hidden" libraries, object files and flags are used when
-      # linking a shared library.
-      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
-
-    else
-      GXX=no
-      with_gnu_ld=no
-      wlarc=
-    fi
-
-    # PORTME: fill in a description of your system's C++ link characteristics
-    AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
-    _LT_TAGVAR(ld_shlibs, $1)=yes
-    case $host_os in
-      aix3*)
-        # FIXME: insert proper C++ library support
-        _LT_TAGVAR(ld_shlibs, $1)=no
-        ;;
-      aix[[4-9]]*)
-        if test "$host_cpu" = ia64; then
-          # On IA64, the linker does run time linking by default, so we don't
-          # have to do anything special.
-          aix_use_runtimelinking=no
-          exp_sym_flag='-Bexport'
-          no_entry_flag=""
-        else
-          aix_use_runtimelinking=no
-
-          # Test if we are trying to use run time linking or normal
-          # AIX style linking. If -brtl is somewhere in LDFLAGS, we
-          # need to do runtime linking.
-          case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
-	    for ld_flag in $LDFLAGS; do
-	      case $ld_flag in
-	      *-brtl*)
-	        aix_use_runtimelinking=yes
-	        break
-	        ;;
-	      esac
-	    done
-	    ;;
-          esac
-
-          exp_sym_flag='-bexport'
-          no_entry_flag='-bnoentry'
-        fi
-
-        # When large executables or shared objects are built, AIX ld can
-        # have problems creating the table of contents.  If linking a library
-        # or program results in "error TOC overflow" add -mminimal-toc to
-        # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
-        # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
-
-        _LT_TAGVAR(archive_cmds, $1)=''
-        _LT_TAGVAR(hardcode_direct, $1)=yes
-        _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
-        _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
-        _LT_TAGVAR(link_all_deplibs, $1)=yes
-        _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
-
-        if test "$GXX" = yes; then
-          case $host_os in aix4.[[012]]|aix4.[[012]].*)
-          # We only want to do this on AIX 4.2 and lower, the check
-          # below for broken collect2 doesn't work under 4.3+
-	  collect2name=`${CC} -print-prog-name=collect2`
-	  if test -f "$collect2name" &&
-	     strings "$collect2name" | $GREP resolve_lib_name >/dev/null
-	  then
-	    # We have reworked collect2
-	    :
-	  else
-	    # We have old collect2
-	    _LT_TAGVAR(hardcode_direct, $1)=unsupported
-	    # It fails to find uninstalled libraries when the uninstalled
-	    # path is not listed in the libpath.  Setting hardcode_minus_L
-	    # to unsupported forces relinking
-	    _LT_TAGVAR(hardcode_minus_L, $1)=yes
-	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-	    _LT_TAGVAR(hardcode_libdir_separator, $1)=
-	  fi
-          esac
-          shared_flag='-shared'
-	  if test "$aix_use_runtimelinking" = yes; then
-	    shared_flag="$shared_flag "'${wl}-G'
-	  fi
-        else
-          # not using gcc
-          if test "$host_cpu" = ia64; then
-	  # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
-	  # chokes on -Wl,-G. The following line is correct:
-	  shared_flag='-G'
-          else
-	    if test "$aix_use_runtimelinking" = yes; then
-	      shared_flag='${wl}-G'
-	    else
-	      shared_flag='${wl}-bM:SRE'
-	    fi
-          fi
-        fi
-
-        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
-        # It seems that -bexpall does not export symbols beginning with
-        # underscore (_), so it is better to generate a list of symbols to
-	# export.
-        _LT_TAGVAR(always_export_symbols, $1)=yes
-        if test "$aix_use_runtimelinking" = yes; then
-          # Warning - without using the other runtime loading flags (-brtl),
-          # -berok will link without error, but may produce a broken library.
-          _LT_TAGVAR(allow_undefined_flag, $1)='-berok'
-          # Determine the default libpath from the value encoded in an empty
-          # executable.
-          _LT_SYS_MODULE_PATH_AIX([$1])
-          _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
-
-          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
-        else
-          if test "$host_cpu" = ia64; then
-	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
-	    _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
-	    _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
-          else
-	    # Determine the default libpath from the value encoded in an
-	    # empty executable.
-	    _LT_SYS_MODULE_PATH_AIX([$1])
-	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
-	    # Warning - without using the other run time loading flags,
-	    # -berok will link without error, but may produce a broken library.
-	    _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
-	    _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
-	    if test "$with_gnu_ld" = yes; then
-	      # We only use this code for GNU lds that support --whole-archive.
-	      _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
-	    else
-	      # Exported symbols can be pulled into shared objects from archives
-	      _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
-	    fi
-	    _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
-	    # This is similar to how AIX traditionally builds its shared
-	    # libraries.
-	    _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
-          fi
-        fi
-        ;;
-
-      beos*)
-	if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-	  # Joseph Beckenbach <jrb3 at best.com> says some releases of gcc
-	  # support --undefined.  This deserves some investigation.  FIXME
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	else
-	  _LT_TAGVAR(ld_shlibs, $1)=no
-	fi
-	;;
-
-      chorus*)
-        case $cc_basename in
-          *)
-	  # FIXME: insert proper C++ library support
-	  _LT_TAGVAR(ld_shlibs, $1)=no
-	  ;;
-        esac
-        ;;
-
-      cygwin* | mingw* | pw32* | cegcc*)
-	case $GXX,$cc_basename in
-	,cl* | no,cl*)
-	  # Native MSVC
-	  # hardcode_libdir_flag_spec is actually meaningless, as there is
-	  # no search path for DLLs.
-	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
-	  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-	  _LT_TAGVAR(always_export_symbols, $1)=yes
-	  _LT_TAGVAR(file_list_spec, $1)='@'
-	  # Tell ltmain to make .lib files, not .a files.
-	  libext=lib
-	  # Tell ltmain to make .dll files, not .so files.
-	  shrext_cmds=".dll"
-	  # FIXME: Setting linknames here is a bad hack.
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
-	  _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-	      $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
-	    else
-	      $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
-	    fi~
-	    $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
-	    linknames='
-	  # The linker will not automatically build a static lib if we build a DLL.
-	  # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
-	  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
-	  # Don't use ranlib
-	  _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
-	  _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
-	    lt_tool_outputfile="@TOOL_OUTPUT@"~
-	    case $lt_outputfile in
-	      *.exe|*.EXE) ;;
-	      *)
-		lt_outputfile="$lt_outputfile.exe"
-		lt_tool_outputfile="$lt_tool_outputfile.exe"
-		;;
-	    esac~
-	    func_to_tool_file "$lt_outputfile"~
-	    if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
-	      $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
-	      $RM "$lt_outputfile.manifest";
-	    fi'
-	  ;;
-	*)
-	  # g++
-	  # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
-	  # as there is no search path for DLLs.
-	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-	  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
-	  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-	  _LT_TAGVAR(always_export_symbols, $1)=no
-	  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
-
-	  if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
-	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-	    # If the export-symbols file already is a .def file (1st line
-	    # is EXPORTS), use it as is; otherwise, prepend...
-	    _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-	      cp $export_symbols $output_objdir/$soname.def;
-	    else
-	      echo EXPORTS > $output_objdir/$soname.def;
-	      cat $export_symbols >> $output_objdir/$soname.def;
-	    fi~
-	    $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-	  else
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	  fi
-	  ;;
-	esac
-	;;
-      darwin* | rhapsody*)
-        _LT_DARWIN_LINKER_FEATURES($1)
-	;;
-
-      dgux*)
-        case $cc_basename in
-          ec++*)
-	    # FIXME: insert proper C++ library support
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	    ;;
-          ghcx*)
-	    # Green Hills C++ Compiler
-	    # FIXME: insert proper C++ library support
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	    ;;
-          *)
-	    # FIXME: insert proper C++ library support
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	    ;;
-        esac
-        ;;
-
-      freebsd2.*)
-        # C++ shared libraries reported to be fairly broken before
-	# switch to ELF
-        _LT_TAGVAR(ld_shlibs, $1)=no
-        ;;
-
-      freebsd-elf*)
-        _LT_TAGVAR(archive_cmds_need_lc, $1)=no
-        ;;
-
-      freebsd* | dragonfly*)
-        # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
-        # conventions
-        _LT_TAGVAR(ld_shlibs, $1)=yes
-        ;;
-
-      gnu*)
-        ;;
-
-      haiku*)
-        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-        _LT_TAGVAR(link_all_deplibs, $1)=yes
-        ;;
-
-      hpux9*)
-        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
-        _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-        _LT_TAGVAR(hardcode_direct, $1)=yes
-        _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
-				             # but as the default
-				             # location of the library.
-
-        case $cc_basename in
-          CC*)
-            # FIXME: insert proper C++ library support
-            _LT_TAGVAR(ld_shlibs, $1)=no
-            ;;
-          aCC*)
-            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
-            # Commands to make compiler produce verbose output that lists
-            # what "hidden" libraries, object files and flags are used when
-            # linking a shared library.
-            #
-            # There doesn't appear to be a way to prevent this compiler from
-            # explicitly linking system object files so we need to strip them
-            # from the output so that they don't get included in the library
-            # dependencies.
-            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
-            ;;
-          *)
-            if test "$GXX" = yes; then
-              _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
-            else
-              # FIXME: insert proper C++ library support
-              _LT_TAGVAR(ld_shlibs, $1)=no
-            fi
-            ;;
-        esac
-        ;;
-
-      hpux10*|hpux11*)
-        if test $with_gnu_ld = no; then
-	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
-	  _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-
-          case $host_cpu in
-            hppa*64*|ia64*)
-              ;;
-            *)
-	      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-              ;;
-          esac
-        fi
-        case $host_cpu in
-          hppa*64*|ia64*)
-            _LT_TAGVAR(hardcode_direct, $1)=no
-            _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-            ;;
-          *)
-            _LT_TAGVAR(hardcode_direct, $1)=yes
-            _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
-            _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
-					         # but as the default
-					         # location of the library.
-            ;;
-        esac
-
-        case $cc_basename in
-          CC*)
-	    # FIXME: insert proper C++ library support
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	    ;;
-          aCC*)
-	    case $host_cpu in
-	      hppa*64*)
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	        ;;
-	      ia64*)
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	        ;;
-	      *)
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	        ;;
-	    esac
-	    # Commands to make compiler produce verbose output that lists
-	    # what "hidden" libraries, object files and flags are used when
-	    # linking a shared library.
-	    #
-	    # There doesn't appear to be a way to prevent this compiler from
-	    # explicitly linking system object files so we need to strip them
-	    # from the output so that they don't get included in the library
-	    # dependencies.
-	    output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
-	    ;;
-          *)
-	    if test "$GXX" = yes; then
-	      if test $with_gnu_ld = no; then
-	        case $host_cpu in
-	          hppa*64*)
-	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	            ;;
-	          ia64*)
-	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	            ;;
-	          *)
-	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	            ;;
-	        esac
-	      fi
-	    else
-	      # FIXME: insert proper C++ library support
-	      _LT_TAGVAR(ld_shlibs, $1)=no
-	    fi
-	    ;;
-        esac
-        ;;
-
-      interix[[3-9]]*)
-	_LT_TAGVAR(hardcode_direct, $1)=no
-	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-	# Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
-	# Instead, shared libraries are loaded at an image base (0x10000000 by
-	# default) and relocated if they conflict, which is a slow very memory
-	# consuming and fragmenting process.  To avoid this, we pick a random,
-	# 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
-	# time.  Moving up from 0x10000000 also allows more sbrk(2) space.
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
-	;;
-      irix5* | irix6*)
-        case $cc_basename in
-          CC*)
-	    # SGI C++
-	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
-
-	    # Archives containing C++ object files must be created using
-	    # "CC -ar", where "CC" is the IRIX C++ compiler.  This is
-	    # necessary to make sure instantiated templates are included
-	    # in the archive.
-	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'
-	    ;;
-          *)
-	    if test "$GXX" = yes; then
-	      if test "$with_gnu_ld" = no; then
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-	      else
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib'
-	      fi
-	    fi
-	    _LT_TAGVAR(link_all_deplibs, $1)=yes
-	    ;;
-        esac
-        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-        _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-        _LT_TAGVAR(inherit_rpath, $1)=yes
-        ;;
-
-      linux* | k*bsd*-gnu | kopensolaris*-gnu)
-        case $cc_basename in
-          KCC*)
-	    # Kuck and Associates, Inc. (KAI) C++ Compiler
-
-	    # KCC will only create a shared library if the output file
-	    # ends with ".so" (or ".sl" for HP-UX), so rename the library
-	    # to its proper name (with version) after linking.
-	    _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
-	    _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
-	    # Commands to make compiler produce verbose output that lists
-	    # what "hidden" libraries, object files and flags are used when
-	    # linking a shared library.
-	    #
-	    # There doesn't appear to be a way to prevent this compiler from
-	    # explicitly linking system object files so we need to strip them
-	    # from the output so that they don't get included in the library
-	    # dependencies.
-	    output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
-
-	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
-
-	    # Archives containing C++ object files must be created using
-	    # "CC -Bstatic", where "CC" is the KAI C++ compiler.
-	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
-	    ;;
-	  icpc* | ecpc* )
-	    # Intel C++
-	    with_gnu_ld=yes
-	    # version 8.0 and above of icpc choke on multiply defined symbols
-	    # if we add $predep_objects and $postdep_objects, however 7.1 and
-	    # earlier do not add the objects themselves.
-	    case `$CC -V 2>&1` in
-	      *"Version 7."*)
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
-		_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-		;;
-	      *)  # Version 8.0 or newer
-	        tmp_idyn=
-	        case $host_cpu in
-		  ia64*) tmp_idyn=' -i_dynamic';;
-		esac
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-		_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-		;;
-	    esac
-	    _LT_TAGVAR(archive_cmds_need_lc, $1)=no
-	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
-	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
-	    ;;
-          pgCC* | pgcpp*)
-            # Portland Group C++ compiler
-	    case `$CC -V` in
-	    *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*)
-	      _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~
-		rm -rf $tpldir~
-		$CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
-		compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
-	      _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~
-		rm -rf $tpldir~
-		$CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
-		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
-		$RANLIB $oldlib'
-	      _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~
-		rm -rf $tpldir~
-		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
-		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
-	      _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~
-		rm -rf $tpldir~
-		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
-		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
-	      ;;
-	    *) # Version 6 and above use weak symbols
-	      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
-	      _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
-	      ;;
-	    esac
-
-	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
-	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
-	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
-            ;;
-	  cxx*)
-	    # Compaq C++
-	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
-
-	    runpath_var=LD_RUN_PATH
-	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
-	    _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-
-	    # Commands to make compiler produce verbose output that lists
-	    # what "hidden" libraries, object files and flags are used when
-	    # linking a shared library.
-	    #
-	    # There doesn't appear to be a way to prevent this compiler from
-	    # explicitly linking system object files so we need to strip them
-	    # from the output so that they don't get included in the library
-	    # dependencies.
-	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed'
-	    ;;
-	  xl* | mpixl* | bgxl*)
-	    # IBM XL 8.0 on PPC, with GNU ld
-	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
-	    _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	    if test "x$supports_anon_versioning" = xyes; then
-	      _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
-		cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
-		echo "local: *; };" >> $output_objdir/$libname.ver~
-		$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
-	    fi
-	    ;;
-	  *)
-	    case `$CC -V 2>&1 | sed 5q` in
-	    *Sun\ C*)
-	      # Sun C++ 5.9
-	      _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
-	      _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	      _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
-	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-	      _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
-	      _LT_TAGVAR(compiler_needs_object, $1)=yes
-
-	      # Not sure whether something based on
-	      # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
-	      # would be better.
-	      output_verbose_link_cmd='func_echo_all'
-
-	      # Archives containing C++ object files must be created using
-	      # "CC -xar", where "CC" is the Sun C++ compiler.  This is
-	      # necessary to make sure instantiated templates are included
-	      # in the archive.
-	      _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
-	      ;;
-	    esac
-	    ;;
-	esac
-	;;
-
-      lynxos*)
-        # FIXME: insert proper C++ library support
-	_LT_TAGVAR(ld_shlibs, $1)=no
-	;;
-
-      m88k*)
-        # FIXME: insert proper C++ library support
-        _LT_TAGVAR(ld_shlibs, $1)=no
-	;;
-
-      mvs*)
-        case $cc_basename in
-          cxx*)
-	    # FIXME: insert proper C++ library support
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	    ;;
-	  *)
-	    # FIXME: insert proper C++ library support
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	    ;;
-	esac
-	;;
-
-      netbsd*)
-        if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
-	  _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
-	  wlarc=
-	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-	  _LT_TAGVAR(hardcode_direct, $1)=yes
-	  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-	fi
-	# Workaround some broken pre-1.5 toolchains
-	output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
-	;;
-
-      *nto* | *qnx*)
-        _LT_TAGVAR(ld_shlibs, $1)=yes
-	;;
-
-      openbsd2*)
-        # C++ shared libraries are fairly broken
-	_LT_TAGVAR(ld_shlibs, $1)=no
-	;;
-
-      openbsd*)
-	if test -f /usr/libexec/ld.so; then
-	  _LT_TAGVAR(hardcode_direct, $1)=yes
-	  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-	  _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
-	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-	  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
-	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-	    _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
-	  fi
-	  output_verbose_link_cmd=func_echo_all
-	else
-	  _LT_TAGVAR(ld_shlibs, $1)=no
-	fi
-	;;
-
-      osf3* | osf4* | osf5*)
-        case $cc_basename in
-          KCC*)
-	    # Kuck and Associates, Inc. (KAI) C++ Compiler
-
-	    # KCC will only create a shared library if the output file
-	    # ends with ".so" (or ".sl" for HP-UX), so rename the library
-	    # to its proper name (with version) after linking.
-	    _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
-
-	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-	    _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-
-	    # Archives containing C++ object files must be created using
-	    # the KAI C++ compiler.
-	    case $host in
-	      osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;;
-	      *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;;
-	    esac
-	    ;;
-          RCC*)
-	    # Rational C++ 2.4.1
-	    # FIXME: insert proper C++ library support
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	    ;;
-          cxx*)
-	    case $host in
-	      osf3*)
-	        _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
-	        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-		;;
-	      *)
-	        _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
-	        _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
-	          echo "-hidden">> $lib.exp~
-	          $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp  `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~
-	          $RM $lib.exp'
-	        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
-		;;
-	    esac
-
-	    _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-
-	    # Commands to make compiler produce verbose output that lists
-	    # what "hidden" libraries, object files and flags are used when
-	    # linking a shared library.
-	    #
-	    # There doesn't appear to be a way to prevent this compiler from
-	    # explicitly linking system object files so we need to strip them
-	    # from the output so that they don't get included in the library
-	    # dependencies.
-	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
-	    ;;
-	  *)
-	    if test "$GXX" = yes && test "$with_gnu_ld" = no; then
-	      _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
-	      case $host in
-	        osf3*)
-	          _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-		  ;;
-	        *)
-	          _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-		  ;;
-	      esac
-
-	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-	      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-
-	      # Commands to make compiler produce verbose output that lists
-	      # what "hidden" libraries, object files and flags are used when
-	      # linking a shared library.
-	      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
-
-	    else
-	      # FIXME: insert proper C++ library support
-	      _LT_TAGVAR(ld_shlibs, $1)=no
-	    fi
-	    ;;
-        esac
-        ;;
-
-      psos*)
-        # FIXME: insert proper C++ library support
-        _LT_TAGVAR(ld_shlibs, $1)=no
-        ;;
-
-      sunos4*)
-        case $cc_basename in
-          CC*)
-	    # Sun C++ 4.x
-	    # FIXME: insert proper C++ library support
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	    ;;
-          lcc*)
-	    # Lucid
-	    # FIXME: insert proper C++ library support
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	    ;;
-          *)
-	    # FIXME: insert proper C++ library support
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	    ;;
-        esac
-        ;;
-
-      solaris*)
-        case $cc_basename in
-          CC* | sunCC*)
-	    # Sun C++ 4.2, 5.x and Centerline C++
-            _LT_TAGVAR(archive_cmds_need_lc,$1)=yes
-	    _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
-	    _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag}  -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	    _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-	      $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
-
-	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-	    _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-	    case $host_os in
-	      solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
-	      *)
-		# The compiler driver will combine and reorder linker options,
-		# but understands `-z linker_flag'.
-	        # Supported since Solaris 2.6 (maybe 2.5.1?)
-		_LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
-	        ;;
-	    esac
-	    _LT_TAGVAR(link_all_deplibs, $1)=yes
-
-	    output_verbose_link_cmd='func_echo_all'
-
-	    # Archives containing C++ object files must be created using
-	    # "CC -xar", where "CC" is the Sun C++ compiler.  This is
-	    # necessary to make sure instantiated templates are included
-	    # in the archive.
-	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
-	    ;;
-          gcx*)
-	    # Green Hills C++ Compiler
-	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
-
-	    # The C++ compiler must be used to create the archive.
-	    _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
-	    ;;
-          *)
-	    # GNU C++ compiler with Solaris linker
-	    if test "$GXX" = yes && test "$with_gnu_ld" = no; then
-	      _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
-	      if $CC --version | $GREP -v '^2\.7' > /dev/null; then
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
-	        _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-		  $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
-
-	        # Commands to make compiler produce verbose output that lists
-	        # what "hidden" libraries, object files and flags are used when
-	        # linking a shared library.
-	        output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
-	      else
-	        # g++ 2.7 appears to require `-G' NOT `-shared' on this
-	        # platform.
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
-	        _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-		  $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
-
-	        # Commands to make compiler produce verbose output that lists
-	        # what "hidden" libraries, object files and flags are used when
-	        # linking a shared library.
-	        output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
-	      fi
-
-	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
-	      case $host_os in
-		solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
-		*)
-		  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
-		  ;;
-	      esac
-	    fi
-	    ;;
-        esac
-        ;;
-
-    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
-      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
-      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      runpath_var='LD_RUN_PATH'
-
-      case $cc_basename in
-        CC*)
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	*)
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-      esac
-      ;;
-
-      sysv5* | sco3.2v5* | sco5v6*)
-	# Note: We can NOT use -z defs as we might desire, because we do not
-	# link with -lc, and that would cause any symbols used from libc to
-	# always be unresolved, which means just about no library would
-	# ever link correctly.  If we're not using GNU ld we use -z text
-	# though, which does catch some bad symbols but isn't as heavy-handed
-	# as -z defs.
-	_LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
-	_LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
-	_LT_TAGVAR(archive_cmds_need_lc, $1)=no
-	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
-	_LT_TAGVAR(hardcode_libdir_separator, $1)=':'
-	_LT_TAGVAR(link_all_deplibs, $1)=yes
-	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
-	runpath_var='LD_RUN_PATH'
-
-	case $cc_basename in
-          CC*)
-	    _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~
-	      '"$_LT_TAGVAR(old_archive_cmds, $1)"
-	    _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~
-	      '"$_LT_TAGVAR(reload_cmds, $1)"
-	    ;;
-	  *)
-	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	    ;;
-	esac
-      ;;
-
-      tandem*)
-        case $cc_basename in
-          NCC*)
-	    # NonStop-UX NCC 3.20
-	    # FIXME: insert proper C++ library support
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	    ;;
-          *)
-	    # FIXME: insert proper C++ library support
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	    ;;
-        esac
-        ;;
-
-      vxworks*)
-        # FIXME: insert proper C++ library support
-        _LT_TAGVAR(ld_shlibs, $1)=no
-        ;;
-
-      *)
-        # FIXME: insert proper C++ library support
-        _LT_TAGVAR(ld_shlibs, $1)=no
-        ;;
-    esac
-
-    AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
-    test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
-
-    _LT_TAGVAR(GCC, $1)="$GXX"
-    _LT_TAGVAR(LD, $1)="$LD"
-
-    ## CAVEAT EMPTOR:
-    ## There is no encapsulation within the following macros, do not change
-    ## the running order or otherwise move them around unless you know exactly
-    ## what you are doing...
-    _LT_SYS_HIDDEN_LIBDEPS($1)
-    _LT_COMPILER_PIC($1)
-    _LT_COMPILER_C_O($1)
-    _LT_COMPILER_FILE_LOCKS($1)
-    _LT_LINKER_SHLIBS($1)
-    _LT_SYS_DYNAMIC_LINKER($1)
-    _LT_LINKER_HARDCODE_LIBPATH($1)
-
-    _LT_CONFIG($1)
-  fi # test -n "$compiler"
-
-  CC=$lt_save_CC
-  CFLAGS=$lt_save_CFLAGS
-  LDCXX=$LD
-  LD=$lt_save_LD
-  GCC=$lt_save_GCC
-  with_gnu_ld=$lt_save_with_gnu_ld
-  lt_cv_path_LDCXX=$lt_cv_path_LD
-  lt_cv_path_LD=$lt_save_path_LD
-  lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
-  lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
-fi # test "$_lt_caught_CXX_error" != yes
-
-AC_LANG_POP
-])# _LT_LANG_CXX_CONFIG
-
-
-# _LT_FUNC_STRIPNAME_CNF
-# ----------------------
-# func_stripname_cnf prefix suffix name
-# strip PREFIX and SUFFIX off of NAME.
-# PREFIX and SUFFIX must not contain globbing or regex special
-# characters, hashes, percent signs, but SUFFIX may contain a leading
-# dot (in which case that matches only a dot).
-#
-# This function is identical to the (non-XSI) version of func_stripname,
-# except this one can be used by m4 code that may be executed by configure,
-# rather than the libtool script.
-m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl
-AC_REQUIRE([_LT_DECL_SED])
-AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])
-func_stripname_cnf ()
-{
-  case ${2} in
-  .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
-  *)  func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
-  esac
-} # func_stripname_cnf
-])# _LT_FUNC_STRIPNAME_CNF
-
-# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])
-# ---------------------------------
-# Figure out "hidden" library dependencies from verbose
-# compiler output when linking a shared library.
-# Parse the compiler output and extract the necessary
-# objects, libraries and library flags.
-m4_defun([_LT_SYS_HIDDEN_LIBDEPS],
-[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl
-# Dependencies to place before and after the object being linked:
-_LT_TAGVAR(predep_objects, $1)=
-_LT_TAGVAR(postdep_objects, $1)=
-_LT_TAGVAR(predeps, $1)=
-_LT_TAGVAR(postdeps, $1)=
-_LT_TAGVAR(compiler_lib_search_path, $1)=
-
-dnl we can't use the lt_simple_compile_test_code here,
-dnl because it contains code intended for an executable,
-dnl not a library.  It's possible we should let each
-dnl tag define a new lt_????_link_test_code variable,
-dnl but it's only used here...
-m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF
-int a;
-void foo (void) { a = 0; }
-_LT_EOF
-], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF
-class Foo
-{
-public:
-  Foo (void) { a = 0; }
-private:
-  int a;
-};
-_LT_EOF
-], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF
-      subroutine foo
-      implicit none
-      integer*4 a
-      a=0
-      return
-      end
-_LT_EOF
-], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF
-      subroutine foo
-      implicit none
-      integer a
-      a=0
-      return
-      end
-_LT_EOF
-], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF
-public class foo {
-  private int a;
-  public void bar (void) {
-    a = 0;
-  }
-};
-_LT_EOF
-], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF
-package foo
-func foo() {
-}
-_LT_EOF
-])
-
-_lt_libdeps_save_CFLAGS=$CFLAGS
-case "$CC $CFLAGS " in #(
-*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
-*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
-*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;;
-esac
-
-dnl Parse the compiler output and extract the necessary
-dnl objects, libraries and library flags.
-if AC_TRY_EVAL(ac_compile); then
-  # Parse the compiler output and extract the necessary
-  # objects, libraries and library flags.
-
-  # Sentinel used to keep track of whether or not we are before
-  # the conftest object file.
-  pre_test_object_deps_done=no
-
-  for p in `eval "$output_verbose_link_cmd"`; do
-    case ${prev}${p} in
-
-    -L* | -R* | -l*)
-       # Some compilers place space between "-{L,R}" and the path.
-       # Remove the space.
-       if test $p = "-L" ||
-          test $p = "-R"; then
-	 prev=$p
-	 continue
-       fi
-
-       # Expand the sysroot to ease extracting the directories later.
-       if test -z "$prev"; then
-         case $p in
-         -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;;
-         -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;;
-         -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;;
-         esac
-       fi
-       case $p in
-       =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;;
-       esac
-       if test "$pre_test_object_deps_done" = no; then
-	 case ${prev} in
-	 -L | -R)
-	   # Internal compiler library paths should come after those
-	   # provided the user.  The postdeps already come after the
-	   # user supplied libs so there is no need to process them.
-	   if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then
-	     _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}"
-	   else
-	     _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}"
-	   fi
-	   ;;
-	 # The "-l" case would never come before the object being
-	 # linked, so don't bother handling this case.
-	 esac
-       else
-	 if test -z "$_LT_TAGVAR(postdeps, $1)"; then
-	   _LT_TAGVAR(postdeps, $1)="${prev}${p}"
-	 else
-	   _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}"
-	 fi
-       fi
-       prev=
-       ;;
-
-    *.lto.$objext) ;; # Ignore GCC LTO objects
-    *.$objext)
-       # This assumes that the test object file only shows up
-       # once in the compiler output.
-       if test "$p" = "conftest.$objext"; then
-	 pre_test_object_deps_done=yes
-	 continue
-       fi
-
-       if test "$pre_test_object_deps_done" = no; then
-	 if test -z "$_LT_TAGVAR(predep_objects, $1)"; then
-	   _LT_TAGVAR(predep_objects, $1)="$p"
-	 else
-	   _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p"
-	 fi
-       else
-	 if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then
-	   _LT_TAGVAR(postdep_objects, $1)="$p"
-	 else
-	   _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p"
-	 fi
-       fi
-       ;;
-
-    *) ;; # Ignore the rest.
-
-    esac
-  done
-
-  # Clean up.
-  rm -f a.out a.exe
-else
-  echo "libtool.m4: error: problem compiling $1 test program"
-fi
-
-$RM -f confest.$objext
-CFLAGS=$_lt_libdeps_save_CFLAGS
-
-# PORTME: override above test on systems where it is broken
-m4_if([$1], [CXX],
-[case $host_os in
-interix[[3-9]]*)
-  # Interix 3.5 installs completely hosed .la files for C++, so rather than
-  # hack all around it, let's just trust "g++" to DTRT.
-  _LT_TAGVAR(predep_objects,$1)=
-  _LT_TAGVAR(postdep_objects,$1)=
-  _LT_TAGVAR(postdeps,$1)=
-  ;;
-
-linux*)
-  case `$CC -V 2>&1 | sed 5q` in
-  *Sun\ C*)
-    # Sun C++ 5.9
-
-    # The more standards-conforming stlport4 library is
-    # incompatible with the Cstd library. Avoid specifying
-    # it if it's in CXXFLAGS. Ignore libCrun as
-    # -library=stlport4 depends on it.
-    case " $CXX $CXXFLAGS " in
-    *" -library=stlport4 "*)
-      solaris_use_stlport4=yes
-      ;;
-    esac
-
-    if test "$solaris_use_stlport4" != yes; then
-      _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
-    fi
-    ;;
-  esac
-  ;;
-
-solaris*)
-  case $cc_basename in
-  CC* | sunCC*)
-    # The more standards-conforming stlport4 library is
-    # incompatible with the Cstd library. Avoid specifying
-    # it if it's in CXXFLAGS. Ignore libCrun as
-    # -library=stlport4 depends on it.
-    case " $CXX $CXXFLAGS " in
-    *" -library=stlport4 "*)
-      solaris_use_stlport4=yes
-      ;;
-    esac
-
-    # Adding this requires a known-good setup of shared libraries for
-    # Sun compiler versions before 5.6, else PIC objects from an old
-    # archive will be linked into the output, leading to subtle bugs.
-    if test "$solaris_use_stlport4" != yes; then
-      _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
-    fi
-    ;;
-  esac
-  ;;
-esac
-])
-
-case " $_LT_TAGVAR(postdeps, $1) " in
-*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;;
-esac
- _LT_TAGVAR(compiler_lib_search_dirs, $1)=
-if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then
- _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
-fi
-_LT_TAGDECL([], [compiler_lib_search_dirs], [1],
-    [The directories searched by this compiler when creating a shared library])
-_LT_TAGDECL([], [predep_objects], [1],
-    [Dependencies to place before and after the objects being linked to
-    create a shared library])
-_LT_TAGDECL([], [postdep_objects], [1])
-_LT_TAGDECL([], [predeps], [1])
-_LT_TAGDECL([], [postdeps], [1])
-_LT_TAGDECL([], [compiler_lib_search_path], [1],
-    [The library search path used internally by the compiler when linking
-    a shared library])
-])# _LT_SYS_HIDDEN_LIBDEPS
-
-
-# _LT_LANG_F77_CONFIG([TAG])
-# --------------------------
-# Ensure that the configuration variables for a Fortran 77 compiler are
-# suitably defined.  These variables are subsequently used by _LT_CONFIG
-# to write the compiler configuration to `libtool'.
-m4_defun([_LT_LANG_F77_CONFIG],
-[AC_LANG_PUSH(Fortran 77)
-if test -z "$F77" || test "X$F77" = "Xno"; then
-  _lt_disable_F77=yes
-fi
-
-_LT_TAGVAR(archive_cmds_need_lc, $1)=no
-_LT_TAGVAR(allow_undefined_flag, $1)=
-_LT_TAGVAR(always_export_symbols, $1)=no
-_LT_TAGVAR(archive_expsym_cmds, $1)=
-_LT_TAGVAR(export_dynamic_flag_spec, $1)=
-_LT_TAGVAR(hardcode_direct, $1)=no
-_LT_TAGVAR(hardcode_direct_absolute, $1)=no
-_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
-_LT_TAGVAR(hardcode_libdir_separator, $1)=
-_LT_TAGVAR(hardcode_minus_L, $1)=no
-_LT_TAGVAR(hardcode_automatic, $1)=no
-_LT_TAGVAR(inherit_rpath, $1)=no
-_LT_TAGVAR(module_cmds, $1)=
-_LT_TAGVAR(module_expsym_cmds, $1)=
-_LT_TAGVAR(link_all_deplibs, $1)=unknown
-_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
-_LT_TAGVAR(reload_flag, $1)=$reload_flag
-_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
-_LT_TAGVAR(no_undefined_flag, $1)=
-_LT_TAGVAR(whole_archive_flag_spec, $1)=
-_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
-
-# Source file extension for f77 test sources.
-ac_ext=f
-
-# Object file extension for compiled f77 test sources.
-objext=o
-_LT_TAGVAR(objext, $1)=$objext
-
-# No sense in running all these tests if we already determined that
-# the F77 compiler isn't working.  Some variables (like enable_shared)
-# are currently assumed to apply to all compilers on this platform,
-# and will be corrupted by setting them based on a non-working compiler.
-if test "$_lt_disable_F77" != yes; then
-  # Code to be used in simple compile tests
-  lt_simple_compile_test_code="\
-      subroutine t
-      return
-      end
-"
-
-  # Code to be used in simple link tests
-  lt_simple_link_test_code="\
-      program t
-      end
-"
-
-  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
-  _LT_TAG_COMPILER
-
-  # save warnings/boilerplate of simple test code
-  _LT_COMPILER_BOILERPLATE
-  _LT_LINKER_BOILERPLATE
-
-  # Allow CC to be a program name with arguments.
-  lt_save_CC="$CC"
-  lt_save_GCC=$GCC
-  lt_save_CFLAGS=$CFLAGS
-  CC=${F77-"f77"}
-  CFLAGS=$FFLAGS
-  compiler=$CC
-  _LT_TAGVAR(compiler, $1)=$CC
-  _LT_CC_BASENAME([$compiler])
-  GCC=$G77
-  if test -n "$compiler"; then
-    AC_MSG_CHECKING([if libtool supports shared libraries])
-    AC_MSG_RESULT([$can_build_shared])
-
-    AC_MSG_CHECKING([whether to build shared libraries])
-    test "$can_build_shared" = "no" && enable_shared=no
-
-    # On AIX, shared libraries and static libraries use the same namespace, and
-    # are all built from PIC.
-    case $host_os in
-      aix3*)
-        test "$enable_shared" = yes && enable_static=no
-        if test -n "$RANLIB"; then
-          archive_cmds="$archive_cmds~\$RANLIB \$lib"
-          postinstall_cmds='$RANLIB $lib'
-        fi
-        ;;
-      aix[[4-9]]*)
-	if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
-	  test "$enable_shared" = yes && enable_static=no
-	fi
-        ;;
-    esac
-    AC_MSG_RESULT([$enable_shared])
-
-    AC_MSG_CHECKING([whether to build static libraries])
-    # Make sure either enable_shared or enable_static is yes.
-    test "$enable_shared" = yes || enable_static=yes
-    AC_MSG_RESULT([$enable_static])
-
-    _LT_TAGVAR(GCC, $1)="$G77"
-    _LT_TAGVAR(LD, $1)="$LD"
-
-    ## CAVEAT EMPTOR:
-    ## There is no encapsulation within the following macros, do not change
-    ## the running order or otherwise move them around unless you know exactly
-    ## what you are doing...
-    _LT_COMPILER_PIC($1)
-    _LT_COMPILER_C_O($1)
-    _LT_COMPILER_FILE_LOCKS($1)
-    _LT_LINKER_SHLIBS($1)
-    _LT_SYS_DYNAMIC_LINKER($1)
-    _LT_LINKER_HARDCODE_LIBPATH($1)
-
-    _LT_CONFIG($1)
-  fi # test -n "$compiler"
-
-  GCC=$lt_save_GCC
-  CC="$lt_save_CC"
-  CFLAGS="$lt_save_CFLAGS"
-fi # test "$_lt_disable_F77" != yes
-
-AC_LANG_POP
-])# _LT_LANG_F77_CONFIG
-
-
-# _LT_LANG_FC_CONFIG([TAG])
-# -------------------------
-# Ensure that the configuration variables for a Fortran compiler are
-# suitably defined.  These variables are subsequently used by _LT_CONFIG
-# to write the compiler configuration to `libtool'.
-m4_defun([_LT_LANG_FC_CONFIG],
-[AC_LANG_PUSH(Fortran)
-
-if test -z "$FC" || test "X$FC" = "Xno"; then
-  _lt_disable_FC=yes
-fi
-
-_LT_TAGVAR(archive_cmds_need_lc, $1)=no
-_LT_TAGVAR(allow_undefined_flag, $1)=
-_LT_TAGVAR(always_export_symbols, $1)=no
-_LT_TAGVAR(archive_expsym_cmds, $1)=
-_LT_TAGVAR(export_dynamic_flag_spec, $1)=
-_LT_TAGVAR(hardcode_direct, $1)=no
-_LT_TAGVAR(hardcode_direct_absolute, $1)=no
-_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
-_LT_TAGVAR(hardcode_libdir_separator, $1)=
-_LT_TAGVAR(hardcode_minus_L, $1)=no
-_LT_TAGVAR(hardcode_automatic, $1)=no
-_LT_TAGVAR(inherit_rpath, $1)=no
-_LT_TAGVAR(module_cmds, $1)=
-_LT_TAGVAR(module_expsym_cmds, $1)=
-_LT_TAGVAR(link_all_deplibs, $1)=unknown
-_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
-_LT_TAGVAR(reload_flag, $1)=$reload_flag
-_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
-_LT_TAGVAR(no_undefined_flag, $1)=
-_LT_TAGVAR(whole_archive_flag_spec, $1)=
-_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
-
-# Source file extension for fc test sources.
-ac_ext=${ac_fc_srcext-f}
-
-# Object file extension for compiled fc test sources.
-objext=o
-_LT_TAGVAR(objext, $1)=$objext
-
-# No sense in running all these tests if we already determined that
-# the FC compiler isn't working.  Some variables (like enable_shared)
-# are currently assumed to apply to all compilers on this platform,
-# and will be corrupted by setting them based on a non-working compiler.
-if test "$_lt_disable_FC" != yes; then
-  # Code to be used in simple compile tests
-  lt_simple_compile_test_code="\
-      subroutine t
-      return
-      end
-"
-
-  # Code to be used in simple link tests
-  lt_simple_link_test_code="\
-      program t
-      end
-"
-
-  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
-  _LT_TAG_COMPILER
-
-  # save warnings/boilerplate of simple test code
-  _LT_COMPILER_BOILERPLATE
-  _LT_LINKER_BOILERPLATE
-
-  # Allow CC to be a program name with arguments.
-  lt_save_CC="$CC"
-  lt_save_GCC=$GCC
-  lt_save_CFLAGS=$CFLAGS
-  CC=${FC-"f95"}
-  CFLAGS=$FCFLAGS
-  compiler=$CC
-  GCC=$ac_cv_fc_compiler_gnu
-
-  _LT_TAGVAR(compiler, $1)=$CC
-  _LT_CC_BASENAME([$compiler])
-
-  if test -n "$compiler"; then
-    AC_MSG_CHECKING([if libtool supports shared libraries])
-    AC_MSG_RESULT([$can_build_shared])
-
-    AC_MSG_CHECKING([whether to build shared libraries])
-    test "$can_build_shared" = "no" && enable_shared=no
-
-    # On AIX, shared libraries and static libraries use the same namespace, and
-    # are all built from PIC.
-    case $host_os in
-      aix3*)
-        test "$enable_shared" = yes && enable_static=no
-        if test -n "$RANLIB"; then
-          archive_cmds="$archive_cmds~\$RANLIB \$lib"
-          postinstall_cmds='$RANLIB $lib'
-        fi
-        ;;
-      aix[[4-9]]*)
-	if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
-	  test "$enable_shared" = yes && enable_static=no
-	fi
-        ;;
-    esac
-    AC_MSG_RESULT([$enable_shared])
-
-    AC_MSG_CHECKING([whether to build static libraries])
-    # Make sure either enable_shared or enable_static is yes.
-    test "$enable_shared" = yes || enable_static=yes
-    AC_MSG_RESULT([$enable_static])
-
-    _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu"
-    _LT_TAGVAR(LD, $1)="$LD"
-
-    ## CAVEAT EMPTOR:
-    ## There is no encapsulation within the following macros, do not change
-    ## the running order or otherwise move them around unless you know exactly
-    ## what you are doing...
-    _LT_SYS_HIDDEN_LIBDEPS($1)
-    _LT_COMPILER_PIC($1)
-    _LT_COMPILER_C_O($1)
-    _LT_COMPILER_FILE_LOCKS($1)
-    _LT_LINKER_SHLIBS($1)
-    _LT_SYS_DYNAMIC_LINKER($1)
-    _LT_LINKER_HARDCODE_LIBPATH($1)
-
-    _LT_CONFIG($1)
-  fi # test -n "$compiler"
-
-  GCC=$lt_save_GCC
-  CC=$lt_save_CC
-  CFLAGS=$lt_save_CFLAGS
-fi # test "$_lt_disable_FC" != yes
-
-AC_LANG_POP
-])# _LT_LANG_FC_CONFIG
-
-
-# _LT_LANG_GCJ_CONFIG([TAG])
-# --------------------------
-# Ensure that the configuration variables for the GNU Java Compiler compiler
-# are suitably defined.  These variables are subsequently used by _LT_CONFIG
-# to write the compiler configuration to `libtool'.
-m4_defun([_LT_LANG_GCJ_CONFIG],
-[AC_REQUIRE([LT_PROG_GCJ])dnl
-AC_LANG_SAVE
-
-# Source file extension for Java test sources.
-ac_ext=java
-
-# Object file extension for compiled Java test sources.
-objext=o
-_LT_TAGVAR(objext, $1)=$objext
-
-# Code to be used in simple compile tests
-lt_simple_compile_test_code="class foo {}"
-
-# Code to be used in simple link tests
-lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }'
-
-# ltmain only uses $CC for tagged configurations so make sure $CC is set.
-_LT_TAG_COMPILER
-
-# save warnings/boilerplate of simple test code
-_LT_COMPILER_BOILERPLATE
-_LT_LINKER_BOILERPLATE
-
-# Allow CC to be a program name with arguments.
-lt_save_CC=$CC
-lt_save_CFLAGS=$CFLAGS
-lt_save_GCC=$GCC
-GCC=yes
-CC=${GCJ-"gcj"}
-CFLAGS=$GCJFLAGS
-compiler=$CC
-_LT_TAGVAR(compiler, $1)=$CC
-_LT_TAGVAR(LD, $1)="$LD"
-_LT_CC_BASENAME([$compiler])
-
-# GCJ did not exist at the time GCC didn't implicitly link libc in.
-_LT_TAGVAR(archive_cmds_need_lc, $1)=no
-
-_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
-_LT_TAGVAR(reload_flag, $1)=$reload_flag
-_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
-
-if test -n "$compiler"; then
-  _LT_COMPILER_NO_RTTI($1)
-  _LT_COMPILER_PIC($1)
-  _LT_COMPILER_C_O($1)
-  _LT_COMPILER_FILE_LOCKS($1)
-  _LT_LINKER_SHLIBS($1)
-  _LT_LINKER_HARDCODE_LIBPATH($1)
-
-  _LT_CONFIG($1)
-fi
-
-AC_LANG_RESTORE
-
-GCC=$lt_save_GCC
-CC=$lt_save_CC
-CFLAGS=$lt_save_CFLAGS
-])# _LT_LANG_GCJ_CONFIG
-
-
-# _LT_LANG_GO_CONFIG([TAG])
-# --------------------------
-# Ensure that the configuration variables for the GNU Go compiler
-# are suitably defined.  These variables are subsequently used by _LT_CONFIG
-# to write the compiler configuration to `libtool'.
-m4_defun([_LT_LANG_GO_CONFIG],
-[AC_REQUIRE([LT_PROG_GO])dnl
-AC_LANG_SAVE
-
-# Source file extension for Go test sources.
-ac_ext=go
-
-# Object file extension for compiled Go test sources.
-objext=o
-_LT_TAGVAR(objext, $1)=$objext
-
-# Code to be used in simple compile tests
-lt_simple_compile_test_code="package main; func main() { }"
-
-# Code to be used in simple link tests
-lt_simple_link_test_code='package main; func main() { }'
-
-# ltmain only uses $CC for tagged configurations so make sure $CC is set.
-_LT_TAG_COMPILER
-
-# save warnings/boilerplate of simple test code
-_LT_COMPILER_BOILERPLATE
-_LT_LINKER_BOILERPLATE
-
-# Allow CC to be a program name with arguments.
-lt_save_CC=$CC
-lt_save_CFLAGS=$CFLAGS
-lt_save_GCC=$GCC
-GCC=yes
-CC=${GOC-"gccgo"}
-CFLAGS=$GOFLAGS
-compiler=$CC
-_LT_TAGVAR(compiler, $1)=$CC
-_LT_TAGVAR(LD, $1)="$LD"
-_LT_CC_BASENAME([$compiler])
-
-# Go did not exist at the time GCC didn't implicitly link libc in.
-_LT_TAGVAR(archive_cmds_need_lc, $1)=no
-
-_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
-_LT_TAGVAR(reload_flag, $1)=$reload_flag
-_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
-
-if test -n "$compiler"; then
-  _LT_COMPILER_NO_RTTI($1)
-  _LT_COMPILER_PIC($1)
-  _LT_COMPILER_C_O($1)
-  _LT_COMPILER_FILE_LOCKS($1)
-  _LT_LINKER_SHLIBS($1)
-  _LT_LINKER_HARDCODE_LIBPATH($1)
-
-  _LT_CONFIG($1)
-fi
-
-AC_LANG_RESTORE
-
-GCC=$lt_save_GCC
-CC=$lt_save_CC
-CFLAGS=$lt_save_CFLAGS
-])# _LT_LANG_GO_CONFIG
-
-
-# _LT_LANG_RC_CONFIG([TAG])
-# -------------------------
-# Ensure that the configuration variables for the Windows resource compiler
-# are suitably defined.  These variables are subsequently used by _LT_CONFIG
-# to write the compiler configuration to `libtool'.
-m4_defun([_LT_LANG_RC_CONFIG],
-[AC_REQUIRE([LT_PROG_RC])dnl
-AC_LANG_SAVE
-
-# Source file extension for RC test sources.
-ac_ext=rc
-
-# Object file extension for compiled RC test sources.
-objext=o
-_LT_TAGVAR(objext, $1)=$objext
-
-# Code to be used in simple compile tests
-lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
-
-# Code to be used in simple link tests
-lt_simple_link_test_code="$lt_simple_compile_test_code"
-
-# ltmain only uses $CC for tagged configurations so make sure $CC is set.
-_LT_TAG_COMPILER
-
-# save warnings/boilerplate of simple test code
-_LT_COMPILER_BOILERPLATE
-_LT_LINKER_BOILERPLATE
-
-# Allow CC to be a program name with arguments.
-lt_save_CC="$CC"
-lt_save_CFLAGS=$CFLAGS
-lt_save_GCC=$GCC
-GCC=
-CC=${RC-"windres"}
-CFLAGS=
-compiler=$CC
-_LT_TAGVAR(compiler, $1)=$CC
-_LT_CC_BASENAME([$compiler])
-_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
-
-if test -n "$compiler"; then
-  :
-  _LT_CONFIG($1)
-fi
-
-GCC=$lt_save_GCC
-AC_LANG_RESTORE
-CC=$lt_save_CC
-CFLAGS=$lt_save_CFLAGS
-])# _LT_LANG_RC_CONFIG
-
-
-# LT_PROG_GCJ
-# -----------
-AC_DEFUN([LT_PROG_GCJ],
-[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ],
-  [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ],
-    [AC_CHECK_TOOL(GCJ, gcj,)
-      test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
-      AC_SUBST(GCJFLAGS)])])[]dnl
-])
-
-# Old name:
-AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([LT_AC_PROG_GCJ], [])
-
-
-# LT_PROG_GO
-# ----------
-AC_DEFUN([LT_PROG_GO],
-[AC_CHECK_TOOL(GOC, gccgo,)
-])
-
-
-# LT_PROG_RC
-# ----------
-AC_DEFUN([LT_PROG_RC],
-[AC_CHECK_TOOL(RC, windres,)
-])
-
-# Old name:
-AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([LT_AC_PROG_RC], [])
-
-
-# _LT_DECL_EGREP
-# --------------
-# If we don't have a new enough Autoconf to choose the best grep
-# available, choose the one first in the user's PATH.
-m4_defun([_LT_DECL_EGREP],
-[AC_REQUIRE([AC_PROG_EGREP])dnl
-AC_REQUIRE([AC_PROG_FGREP])dnl
-test -z "$GREP" && GREP=grep
-_LT_DECL([], [GREP], [1], [A grep program that handles long lines])
-_LT_DECL([], [EGREP], [1], [An ERE matcher])
-_LT_DECL([], [FGREP], [1], [A literal string matcher])
-dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too
-AC_SUBST([GREP])
-])
-
-
-# _LT_DECL_OBJDUMP
-# --------------
-# If we don't have a new enough Autoconf to choose the best objdump
-# available, choose the one first in the user's PATH.
-m4_defun([_LT_DECL_OBJDUMP],
-[AC_CHECK_TOOL(OBJDUMP, objdump, false)
-test -z "$OBJDUMP" && OBJDUMP=objdump
-_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper])
-AC_SUBST([OBJDUMP])
-])
-
-# _LT_DECL_DLLTOOL
-# ----------------
-# Ensure DLLTOOL variable is set.
-m4_defun([_LT_DECL_DLLTOOL],
-[AC_CHECK_TOOL(DLLTOOL, dlltool, false)
-test -z "$DLLTOOL" && DLLTOOL=dlltool
-_LT_DECL([], [DLLTOOL], [1], [DLL creation program])
-AC_SUBST([DLLTOOL])
-])
-
-# _LT_DECL_SED
-# ------------
-# Check for a fully-functional sed program, that truncates
-# as few characters as possible.  Prefer GNU sed if found.
-m4_defun([_LT_DECL_SED],
-[AC_PROG_SED
-test -z "$SED" && SED=sed
-Xsed="$SED -e 1s/^X//"
-_LT_DECL([], [SED], [1], [A sed program that does not truncate output])
-_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"],
-    [Sed that helps us avoid accidentally triggering echo(1) options like -n])
-])# _LT_DECL_SED
-
-m4_ifndef([AC_PROG_SED], [
-# NOTE: This macro has been submitted for inclusion into   #
-#  GNU Autoconf as AC_PROG_SED.  When it is available in   #
-#  a released version of Autoconf we should remove this    #
-#  macro and use it instead.                               #
-
-m4_defun([AC_PROG_SED],
-[AC_MSG_CHECKING([for a sed that does not truncate output])
-AC_CACHE_VAL(lt_cv_path_SED,
-[# Loop through the user's path and test for sed and gsed.
-# Then use that list of sed's as ones to test for truncation.
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for lt_ac_prog in sed gsed; do
-    for ac_exec_ext in '' $ac_executable_extensions; do
-      if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
-        lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
-      fi
-    done
-  done
-done
-IFS=$as_save_IFS
-lt_ac_max=0
-lt_ac_count=0
-# Add /usr/xpg4/bin/sed as it is typically found on Solaris
-# along with /bin/sed that truncates output.
-for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
-  test ! -f $lt_ac_sed && continue
-  cat /dev/null > conftest.in
-  lt_ac_count=0
-  echo $ECHO_N "0123456789$ECHO_C" >conftest.in
-  # Check for GNU sed and select it if it is found.
-  if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
-    lt_cv_path_SED=$lt_ac_sed
-    break
-  fi
-  while true; do
-    cat conftest.in conftest.in >conftest.tmp
-    mv conftest.tmp conftest.in
-    cp conftest.in conftest.nl
-    echo >>conftest.nl
-    $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
-    cmp -s conftest.out conftest.nl || break
-    # 10000 chars as input seems more than enough
-    test $lt_ac_count -gt 10 && break
-    lt_ac_count=`expr $lt_ac_count + 1`
-    if test $lt_ac_count -gt $lt_ac_max; then
-      lt_ac_max=$lt_ac_count
-      lt_cv_path_SED=$lt_ac_sed
-    fi
-  done
-done
-])
-SED=$lt_cv_path_SED
-AC_SUBST([SED])
-AC_MSG_RESULT([$SED])
-])#AC_PROG_SED
-])#m4_ifndef
-
-# Old name:
-AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([LT_AC_PROG_SED], [])
-
-
-# _LT_CHECK_SHELL_FEATURES
-# ------------------------
-# Find out whether the shell is Bourne or XSI compatible,
-# or has some other useful features.
-m4_defun([_LT_CHECK_SHELL_FEATURES],
-[AC_MSG_CHECKING([whether the shell understands some XSI constructs])
-# Try some XSI features
-xsi_shell=no
-( _lt_dummy="a/b/c"
-  test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
-      = c,a/b,b/c, \
-    && eval 'test $(( 1 + 1 )) -eq 2 \
-    && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
-  && xsi_shell=yes
-AC_MSG_RESULT([$xsi_shell])
-_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell'])
-
-AC_MSG_CHECKING([whether the shell understands "+="])
-lt_shell_append=no
-( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \
-    >/dev/null 2>&1 \
-  && lt_shell_append=yes
-AC_MSG_RESULT([$lt_shell_append])
-_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append'])
-
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
-  lt_unset=unset
-else
-  lt_unset=false
-fi
-_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl
-
-# test EBCDIC or ASCII
-case `echo X|tr X '\101'` in
- A) # ASCII based system
-    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
-  lt_SP2NL='tr \040 \012'
-  lt_NL2SP='tr \015\012 \040\040'
-  ;;
- *) # EBCDIC based system
-  lt_SP2NL='tr \100 \n'
-  lt_NL2SP='tr \r\n \100\100'
-  ;;
-esac
-_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl
-_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl
-])# _LT_CHECK_SHELL_FEATURES
-
-
-# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY)
-# ------------------------------------------------------
-# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and
-# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY.
-m4_defun([_LT_PROG_FUNCTION_REPLACE],
-[dnl {
-sed -e '/^$1 ()$/,/^} # $1 /c\
-$1 ()\
-{\
-m4_bpatsubsts([$2], [$], [\\], [^\([	 ]\)], [\\\1])
-} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-])
-
-
-# _LT_PROG_REPLACE_SHELLFNS
-# -------------------------
-# Replace existing portable implementations of several shell functions with
-# equivalent extended shell implementations where those features are available..
-m4_defun([_LT_PROG_REPLACE_SHELLFNS],
-[if test x"$xsi_shell" = xyes; then
-  _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl
-    case ${1} in
-      */*) func_dirname_result="${1%/*}${2}" ;;
-      *  ) func_dirname_result="${3}" ;;
-    esac])
-
-  _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl
-    func_basename_result="${1##*/}"])
-
-  _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl
-    case ${1} in
-      */*) func_dirname_result="${1%/*}${2}" ;;
-      *  ) func_dirname_result="${3}" ;;
-    esac
-    func_basename_result="${1##*/}"])
-
-  _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl
-    # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
-    # positional parameters, so assign one to ordinary parameter first.
-    func_stripname_result=${3}
-    func_stripname_result=${func_stripname_result#"${1}"}
-    func_stripname_result=${func_stripname_result%"${2}"}])
-
-  _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl
-    func_split_long_opt_name=${1%%=*}
-    func_split_long_opt_arg=${1#*=}])
-
-  _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl
-    func_split_short_opt_arg=${1#??}
-    func_split_short_opt_name=${1%"$func_split_short_opt_arg"}])
-
-  _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl
-    case ${1} in
-      *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
-      *)    func_lo2o_result=${1} ;;
-    esac])
-
-  _LT_PROG_FUNCTION_REPLACE([func_xform], [    func_xform_result=${1%.*}.lo])
-
-  _LT_PROG_FUNCTION_REPLACE([func_arith], [    func_arith_result=$(( $[*] ))])
-
-  _LT_PROG_FUNCTION_REPLACE([func_len], [    func_len_result=${#1}])
-fi
-
-if test x"$lt_shell_append" = xyes; then
-  _LT_PROG_FUNCTION_REPLACE([func_append], [    eval "${1}+=\\${2}"])
-
-  _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl
-    func_quote_for_eval "${2}"
-dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \
-    eval "${1}+=\\\\ \\$func_quote_for_eval_result"])
-
-  # Save a `func_append' function call where possible by direct use of '+='
-  sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
-    && mv -f "$cfgfile.tmp" "$cfgfile" \
-      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-  test 0 -eq $? || _lt_function_replace_fail=:
-else
-  # Save a `func_append' function call even when '+=' is not available
-  sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
-    && mv -f "$cfgfile.tmp" "$cfgfile" \
-      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-  test 0 -eq $? || _lt_function_replace_fail=:
-fi
-
-if test x"$_lt_function_replace_fail" = x":"; then
-  AC_MSG_WARN([Unable to substitute extended shell functions in $ofile])
-fi
-])
-
-# _LT_PATH_CONVERSION_FUNCTIONS
-# -----------------------------
-# Determine which file name conversion functions should be used by
-# func_to_host_file (and, implicitly, by func_to_host_path).  These are needed
-# for certain cross-compile configurations and native mingw.
-m4_defun([_LT_PATH_CONVERSION_FUNCTIONS],
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-AC_REQUIRE([AC_CANONICAL_BUILD])dnl
-AC_MSG_CHECKING([how to convert $build file names to $host format])
-AC_CACHE_VAL(lt_cv_to_host_file_cmd,
-[case $host in
-  *-*-mingw* )
-    case $build in
-      *-*-mingw* ) # actually msys
-        lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
-        ;;
-      *-*-cygwin* )
-        lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
-        ;;
-      * ) # otherwise, assume *nix
-        lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
-        ;;
-    esac
-    ;;
-  *-*-cygwin* )
-    case $build in
-      *-*-mingw* ) # actually msys
-        lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
-        ;;
-      *-*-cygwin* )
-        lt_cv_to_host_file_cmd=func_convert_file_noop
-        ;;
-      * ) # otherwise, assume *nix
-        lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
-        ;;
-    esac
-    ;;
-  * ) # unhandled hosts (and "normal" native builds)
-    lt_cv_to_host_file_cmd=func_convert_file_noop
-    ;;
-esac
-])
-to_host_file_cmd=$lt_cv_to_host_file_cmd
-AC_MSG_RESULT([$lt_cv_to_host_file_cmd])
-_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd],
-         [0], [convert $build file names to $host format])dnl
-
-AC_MSG_CHECKING([how to convert $build file names to toolchain format])
-AC_CACHE_VAL(lt_cv_to_tool_file_cmd,
-[#assume ordinary cross tools, or native build.
-lt_cv_to_tool_file_cmd=func_convert_file_noop
-case $host in
-  *-*-mingw* )
-    case $build in
-      *-*-mingw* ) # actually msys
-        lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
-        ;;
-    esac
-    ;;
-esac
-])
-to_tool_file_cmd=$lt_cv_to_tool_file_cmd
-AC_MSG_RESULT([$lt_cv_to_tool_file_cmd])
-_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd],
-         [0], [convert $build files to toolchain format])dnl
-])# _LT_PATH_CONVERSION_FUNCTIONS
-
-# Helper functions for option handling.                    -*- Autoconf -*-
-#
-#   Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation,
-#   Inc.
-#   Written by Gary V. Vaughan, 2004
-#
-# This file is free software; the Free Software Foundation gives
-# unlimited permission to copy and/or distribute it, with or without
-# modifications, as long as this notice is preserved.
-
-# serial 7 ltoptions.m4
-
-# This is to help aclocal find these macros, as it can't see m4_define.
-AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
-
-
-# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
-# ------------------------------------------
-m4_define([_LT_MANGLE_OPTION],
-[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
-
-
-# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
-# ---------------------------------------
-# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
-# matching handler defined, dispatch to it.  Other OPTION-NAMEs are
-# saved as a flag.
-m4_define([_LT_SET_OPTION],
-[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
-m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
-        _LT_MANGLE_DEFUN([$1], [$2]),
-    [m4_warning([Unknown $1 option `$2'])])[]dnl
-])
-
-
-# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
-# ------------------------------------------------------------
-# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
-m4_define([_LT_IF_OPTION],
-[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
-
-
-# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
-# -------------------------------------------------------
-# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
-# are set.
-m4_define([_LT_UNLESS_OPTIONS],
-[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
-	    [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
-		      [m4_define([$0_found])])])[]dnl
-m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
-])[]dnl
-])
-
-
-# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
-# ----------------------------------------
-# OPTION-LIST is a space-separated list of Libtool options associated
-# with MACRO-NAME.  If any OPTION has a matching handler declared with
-# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
-# the unknown option and exit.
-m4_defun([_LT_SET_OPTIONS],
-[# Set options
-m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
-    [_LT_SET_OPTION([$1], _LT_Option)])
-
-m4_if([$1],[LT_INIT],[
-  dnl
-  dnl Simply set some default values (i.e off) if boolean options were not
-  dnl specified:
-  _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
-  ])
-  _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
-  ])
-  dnl
-  dnl If no reference was made to various pairs of opposing options, then
-  dnl we run the default mode handler for the pair.  For example, if neither
-  dnl `shared' nor `disable-shared' was passed, we enable building of shared
-  dnl archives by default:
-  _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
-  _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
-  _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
-  _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
-  		   [_LT_ENABLE_FAST_INSTALL])
-  ])
-])# _LT_SET_OPTIONS
-
-
-
-# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
-# -----------------------------------------
-m4_define([_LT_MANGLE_DEFUN],
-[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
-
-
-# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
-# -----------------------------------------------
-m4_define([LT_OPTION_DEFINE],
-[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
-])# LT_OPTION_DEFINE
-
-
-# dlopen
-# ------
-LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
-])
-
-AU_DEFUN([AC_LIBTOOL_DLOPEN],
-[_LT_SET_OPTION([LT_INIT], [dlopen])
-AC_DIAGNOSE([obsolete],
-[$0: Remove this warning and the call to _LT_SET_OPTION when you
-put the `dlopen' option into LT_INIT's first parameter.])
-])
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
-
-
-# win32-dll
-# ---------
-# Declare package support for building win32 dll's.
-LT_OPTION_DEFINE([LT_INIT], [win32-dll],
-[enable_win32_dll=yes
-
-case $host in
-*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
-  AC_CHECK_TOOL(AS, as, false)
-  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
-  AC_CHECK_TOOL(OBJDUMP, objdump, false)
-  ;;
-esac
-
-test -z "$AS" && AS=as
-_LT_DECL([], [AS],      [1], [Assembler program])dnl
-
-test -z "$DLLTOOL" && DLLTOOL=dlltool
-_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl
-
-test -z "$OBJDUMP" && OBJDUMP=objdump
-_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl
-])# win32-dll
-
-AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-_LT_SET_OPTION([LT_INIT], [win32-dll])
-AC_DIAGNOSE([obsolete],
-[$0: Remove this warning and the call to _LT_SET_OPTION when you
-put the `win32-dll' option into LT_INIT's first parameter.])
-])
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
-
-
-# _LT_ENABLE_SHARED([DEFAULT])
-# ----------------------------
-# implement the --enable-shared flag, and supports the `shared' and
-# `disable-shared' LT_INIT options.
-# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
-m4_define([_LT_ENABLE_SHARED],
-[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
-AC_ARG_ENABLE([shared],
-    [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
-	[build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
-    [p=${PACKAGE-default}
-    case $enableval in
-    yes) enable_shared=yes ;;
-    no) enable_shared=no ;;
-    *)
-      enable_shared=no
-      # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
-      for pkg in $enableval; do
-	IFS="$lt_save_ifs"
-	if test "X$pkg" = "X$p"; then
-	  enable_shared=yes
-	fi
-      done
-      IFS="$lt_save_ifs"
-      ;;
-    esac],
-    [enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
-
-    _LT_DECL([build_libtool_libs], [enable_shared], [0],
-	[Whether or not to build shared libraries])
-])# _LT_ENABLE_SHARED
-
-LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
-LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
-
-# Old names:
-AC_DEFUN([AC_ENABLE_SHARED],
-[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
-])
-
-AC_DEFUN([AC_DISABLE_SHARED],
-[_LT_SET_OPTION([LT_INIT], [disable-shared])
-])
-
-AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
-AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AM_ENABLE_SHARED], [])
-dnl AC_DEFUN([AM_DISABLE_SHARED], [])
-
-
-
-# _LT_ENABLE_STATIC([DEFAULT])
-# ----------------------------
-# implement the --enable-static flag, and support the `static' and
-# `disable-static' LT_INIT options.
-# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
-m4_define([_LT_ENABLE_STATIC],
-[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
-AC_ARG_ENABLE([static],
-    [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
-	[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
-    [p=${PACKAGE-default}
-    case $enableval in
-    yes) enable_static=yes ;;
-    no) enable_static=no ;;
-    *)
-     enable_static=no
-      # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
-      for pkg in $enableval; do
-	IFS="$lt_save_ifs"
-	if test "X$pkg" = "X$p"; then
-	  enable_static=yes
-	fi
-      done
-      IFS="$lt_save_ifs"
-      ;;
-    esac],
-    [enable_static=]_LT_ENABLE_STATIC_DEFAULT)
-
-    _LT_DECL([build_old_libs], [enable_static], [0],
-	[Whether or not to build static libraries])
-])# _LT_ENABLE_STATIC
-
-LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
-LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
-
-# Old names:
-AC_DEFUN([AC_ENABLE_STATIC],
-[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
-])
-
-AC_DEFUN([AC_DISABLE_STATIC],
-[_LT_SET_OPTION([LT_INIT], [disable-static])
-])
-
-AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
-AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AM_ENABLE_STATIC], [])
-dnl AC_DEFUN([AM_DISABLE_STATIC], [])
-
-
-
-# _LT_ENABLE_FAST_INSTALL([DEFAULT])
-# ----------------------------------
-# implement the --enable-fast-install flag, and support the `fast-install'
-# and `disable-fast-install' LT_INIT options.
-# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
-m4_define([_LT_ENABLE_FAST_INSTALL],
-[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
-AC_ARG_ENABLE([fast-install],
-    [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
-    [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
-    [p=${PACKAGE-default}
-    case $enableval in
-    yes) enable_fast_install=yes ;;
-    no) enable_fast_install=no ;;
-    *)
-      enable_fast_install=no
-      # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
-      for pkg in $enableval; do
-	IFS="$lt_save_ifs"
-	if test "X$pkg" = "X$p"; then
-	  enable_fast_install=yes
-	fi
-      done
-      IFS="$lt_save_ifs"
-      ;;
-    esac],
-    [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
-
-_LT_DECL([fast_install], [enable_fast_install], [0],
-	 [Whether or not to optimize for fast installation])dnl
-])# _LT_ENABLE_FAST_INSTALL
-
-LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
-LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
-
-# Old names:
-AU_DEFUN([AC_ENABLE_FAST_INSTALL],
-[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
-AC_DIAGNOSE([obsolete],
-[$0: Remove this warning and the call to _LT_SET_OPTION when you put
-the `fast-install' option into LT_INIT's first parameter.])
-])
-
-AU_DEFUN([AC_DISABLE_FAST_INSTALL],
-[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
-AC_DIAGNOSE([obsolete],
-[$0: Remove this warning and the call to _LT_SET_OPTION when you put
-the `disable-fast-install' option into LT_INIT's first parameter.])
-])
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
-dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
-
-
-# _LT_WITH_PIC([MODE])
-# --------------------
-# implement the --with-pic flag, and support the `pic-only' and `no-pic'
-# LT_INIT options.
-# MODE is either `yes' or `no'.  If omitted, it defaults to `both'.
-m4_define([_LT_WITH_PIC],
-[AC_ARG_WITH([pic],
-    [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
-	[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
-    [lt_p=${PACKAGE-default}
-    case $withval in
-    yes|no) pic_mode=$withval ;;
-    *)
-      pic_mode=default
-      # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
-      for lt_pkg in $withval; do
-	IFS="$lt_save_ifs"
-	if test "X$lt_pkg" = "X$lt_p"; then
-	  pic_mode=yes
-	fi
-      done
-      IFS="$lt_save_ifs"
-      ;;
-    esac],
-    [pic_mode=default])
-
-test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
-
-_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
-])# _LT_WITH_PIC
-
-LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
-LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
-
-# Old name:
-AU_DEFUN([AC_LIBTOOL_PICMODE],
-[_LT_SET_OPTION([LT_INIT], [pic-only])
-AC_DIAGNOSE([obsolete],
-[$0: Remove this warning and the call to _LT_SET_OPTION when you
-put the `pic-only' option into LT_INIT's first parameter.])
-])
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
-
-
-m4_define([_LTDL_MODE], [])
-LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
-		 [m4_define([_LTDL_MODE], [nonrecursive])])
-LT_OPTION_DEFINE([LTDL_INIT], [recursive],
-		 [m4_define([_LTDL_MODE], [recursive])])
-LT_OPTION_DEFINE([LTDL_INIT], [subproject],
-		 [m4_define([_LTDL_MODE], [subproject])])
-
-m4_define([_LTDL_TYPE], [])
-LT_OPTION_DEFINE([LTDL_INIT], [installable],
-		 [m4_define([_LTDL_TYPE], [installable])])
-LT_OPTION_DEFINE([LTDL_INIT], [convenience],
-		 [m4_define([_LTDL_TYPE], [convenience])])
-
-# ltsugar.m4 -- libtool m4 base layer.                         -*-Autoconf-*-
-#
-# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
-# Written by Gary V. Vaughan, 2004
-#
-# This file is free software; the Free Software Foundation gives
-# unlimited permission to copy and/or distribute it, with or without
-# modifications, as long as this notice is preserved.
-
-# serial 6 ltsugar.m4
-
-# This is to help aclocal find these macros, as it can't see m4_define.
-AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
-
-
-# lt_join(SEP, ARG1, [ARG2...])
-# -----------------------------
-# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
-# associated separator.
-# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
-# versions in m4sugar had bugs.
-m4_define([lt_join],
-[m4_if([$#], [1], [],
-       [$#], [2], [[$2]],
-       [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
-m4_define([_lt_join],
-[m4_if([$#$2], [2], [],
-       [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
-
-
-# lt_car(LIST)
-# lt_cdr(LIST)
-# ------------
-# Manipulate m4 lists.
-# These macros are necessary as long as will still need to support
-# Autoconf-2.59 which quotes differently.
-m4_define([lt_car], [[$1]])
-m4_define([lt_cdr],
-[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
-       [$#], 1, [],
-       [m4_dquote(m4_shift($@))])])
-m4_define([lt_unquote], $1)
-
-
-# lt_append(MACRO-NAME, STRING, [SEPARATOR])
-# ------------------------------------------
-# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
-# Note that neither SEPARATOR nor STRING are expanded; they are appended
-# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
-# No SEPARATOR is output if MACRO-NAME was previously undefined (different
-# than defined and empty).
-#
-# This macro is needed until we can rely on Autoconf 2.62, since earlier
-# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
-m4_define([lt_append],
-[m4_define([$1],
-	   m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
-
-
-
-# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
-# ----------------------------------------------------------
-# Produce a SEP delimited list of all paired combinations of elements of
-# PREFIX-LIST with SUFFIX1 through SUFFIXn.  Each element of the list
-# has the form PREFIXmINFIXSUFFIXn.
-# Needed until we can rely on m4_combine added in Autoconf 2.62.
-m4_define([lt_combine],
-[m4_if(m4_eval([$# > 3]), [1],
-       [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
-[[m4_foreach([_Lt_prefix], [$2],
-	     [m4_foreach([_Lt_suffix],
-		]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
-	[_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
-
-
-# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
-# -----------------------------------------------------------------------
-# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
-# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
-m4_define([lt_if_append_uniq],
-[m4_ifdef([$1],
-	  [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
-		 [lt_append([$1], [$2], [$3])$4],
-		 [$5])],
-	  [lt_append([$1], [$2], [$3])$4])])
-
-
-# lt_dict_add(DICT, KEY, VALUE)
-# -----------------------------
-m4_define([lt_dict_add],
-[m4_define([$1($2)], [$3])])
-
-
-# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
-# --------------------------------------------
-m4_define([lt_dict_add_subkey],
-[m4_define([$1($2:$3)], [$4])])
-
-
-# lt_dict_fetch(DICT, KEY, [SUBKEY])
-# ----------------------------------
-m4_define([lt_dict_fetch],
-[m4_ifval([$3],
-	m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
-    m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
-
-
-# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
-# -----------------------------------------------------------------
-m4_define([lt_if_dict_fetch],
-[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
-	[$5],
-    [$6])])
-
-
-# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
-# --------------------------------------------------------------
-m4_define([lt_dict_filter],
-[m4_if([$5], [], [],
-  [lt_join(m4_quote(m4_default([$4], [[, ]])),
-           lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
-		      [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
-])
-
-# ltversion.m4 -- version numbers			-*- Autoconf -*-
-#
-#   Copyright (C) 2004 Free Software Foundation, Inc.
-#   Written by Scott James Remnant, 2004
-#
-# This file is free software; the Free Software Foundation gives
-# unlimited permission to copy and/or distribute it, with or without
-# modifications, as long as this notice is preserved.
-
-# @configure_input@
-
-# serial 3337 ltversion.m4
-# This file is part of GNU Libtool
-
-m4_define([LT_PACKAGE_VERSION], [2.4.2])
-m4_define([LT_PACKAGE_REVISION], [1.3337])
-
-AC_DEFUN([LTVERSION_VERSION],
-[macro_version='2.4.2'
-macro_revision='1.3337'
-_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
-_LT_DECL(, macro_revision, 0)
-])
-
-# lt~obsolete.m4 -- aclocal satisfying obsolete definitions.    -*-Autoconf-*-
-#
-#   Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
-#   Written by Scott James Remnant, 2004.
-#
-# This file is free software; the Free Software Foundation gives
-# unlimited permission to copy and/or distribute it, with or without
-# modifications, as long as this notice is preserved.
-
-# serial 5 lt~obsolete.m4
-
-# These exist entirely to fool aclocal when bootstrapping libtool.
-#
-# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
-# which have later been changed to m4_define as they aren't part of the
-# exported API, or moved to Autoconf or Automake where they belong.
-#
-# The trouble is, aclocal is a bit thick.  It'll see the old AC_DEFUN
-# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
-# using a macro with the same name in our local m4/libtool.m4 it'll
-# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
-# and doesn't know about Autoconf macros at all.)
-#
-# So we provide this file, which has a silly filename so it's always
-# included after everything else.  This provides aclocal with the
-# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
-# because those macros already exist, or will be overwritten later.
-# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. 
-#
-# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
-# Yes, that means every name once taken will need to remain here until
-# we give up compatibility with versions before 1.7, at which point
-# we need to keep only those names which we still refer to.
-
-# This is to help aclocal find these macros, as it can't see m4_define.
-AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
-
-m4_ifndef([AC_LIBTOOL_LINKER_OPTION],	[AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
-m4_ifndef([AC_PROG_EGREP],		[AC_DEFUN([AC_PROG_EGREP])])
-m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH],	[AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
-m4_ifndef([_LT_AC_SHELL_INIT],		[AC_DEFUN([_LT_AC_SHELL_INIT])])
-m4_ifndef([_LT_AC_SYS_LIBPATH_AIX],	[AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
-m4_ifndef([_LT_PROG_LTMAIN],		[AC_DEFUN([_LT_PROG_LTMAIN])])
-m4_ifndef([_LT_AC_TAGVAR],		[AC_DEFUN([_LT_AC_TAGVAR])])
-m4_ifndef([AC_LTDL_ENABLE_INSTALL],	[AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
-m4_ifndef([AC_LTDL_PREOPEN],		[AC_DEFUN([AC_LTDL_PREOPEN])])
-m4_ifndef([_LT_AC_SYS_COMPILER],	[AC_DEFUN([_LT_AC_SYS_COMPILER])])
-m4_ifndef([_LT_AC_LOCK],		[AC_DEFUN([_LT_AC_LOCK])])
-m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE],	[AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
-m4_ifndef([_LT_AC_TRY_DLOPEN_SELF],	[AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
-m4_ifndef([AC_LIBTOOL_PROG_CC_C_O],	[AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
-m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
-m4_ifndef([AC_LIBTOOL_OBJDIR],		[AC_DEFUN([AC_LIBTOOL_OBJDIR])])
-m4_ifndef([AC_LTDL_OBJDIR],		[AC_DEFUN([AC_LTDL_OBJDIR])])
-m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
-m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP],	[AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
-m4_ifndef([AC_PATH_MAGIC],		[AC_DEFUN([AC_PATH_MAGIC])])
-m4_ifndef([AC_PROG_LD_GNU],		[AC_DEFUN([AC_PROG_LD_GNU])])
-m4_ifndef([AC_PROG_LD_RELOAD_FLAG],	[AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
-m4_ifndef([AC_DEPLIBS_CHECK_METHOD],	[AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
-m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
-m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
-m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
-m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS],	[AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
-m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP],	[AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
-m4_ifndef([LT_AC_PROG_EGREP],		[AC_DEFUN([LT_AC_PROG_EGREP])])
-m4_ifndef([LT_AC_PROG_SED],		[AC_DEFUN([LT_AC_PROG_SED])])
-m4_ifndef([_LT_CC_BASENAME],		[AC_DEFUN([_LT_CC_BASENAME])])
-m4_ifndef([_LT_COMPILER_BOILERPLATE],	[AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
-m4_ifndef([_LT_LINKER_BOILERPLATE],	[AC_DEFUN([_LT_LINKER_BOILERPLATE])])
-m4_ifndef([_AC_PROG_LIBTOOL],		[AC_DEFUN([_AC_PROG_LIBTOOL])])
-m4_ifndef([AC_LIBTOOL_SETUP],		[AC_DEFUN([AC_LIBTOOL_SETUP])])
-m4_ifndef([_LT_AC_CHECK_DLFCN],		[AC_DEFUN([_LT_AC_CHECK_DLFCN])])
-m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER],	[AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
-m4_ifndef([_LT_AC_TAGCONFIG],		[AC_DEFUN([_LT_AC_TAGCONFIG])])
-m4_ifndef([AC_DISABLE_FAST_INSTALL],	[AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
-m4_ifndef([_LT_AC_LANG_CXX],		[AC_DEFUN([_LT_AC_LANG_CXX])])
-m4_ifndef([_LT_AC_LANG_F77],		[AC_DEFUN([_LT_AC_LANG_F77])])
-m4_ifndef([_LT_AC_LANG_GCJ],		[AC_DEFUN([_LT_AC_LANG_GCJ])])
-m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
-m4_ifndef([_LT_AC_LANG_C_CONFIG],	[AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
-m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
-m4_ifndef([_LT_AC_LANG_CXX_CONFIG],	[AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
-m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
-m4_ifndef([_LT_AC_LANG_F77_CONFIG],	[AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
-m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
-m4_ifndef([_LT_AC_LANG_GCJ_CONFIG],	[AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
-m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
-m4_ifndef([_LT_AC_LANG_RC_CONFIG],	[AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
-m4_ifndef([AC_LIBTOOL_CONFIG],		[AC_DEFUN([AC_LIBTOOL_CONFIG])])
-m4_ifndef([_LT_AC_FILE_LTDLL_C],	[AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
-m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS],	[AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])
-m4_ifndef([_LT_AC_PROG_CXXCPP],		[AC_DEFUN([_LT_AC_PROG_CXXCPP])])
-m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS],	[AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])
-m4_ifndef([_LT_PROG_ECHO_BACKSLASH],	[AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])
-m4_ifndef([_LT_PROG_F77],		[AC_DEFUN([_LT_PROG_F77])])
-m4_ifndef([_LT_PROG_FC],		[AC_DEFUN([_LT_PROG_FC])])
-m4_ifndef([_LT_PROG_CXX],		[AC_DEFUN([_LT_PROG_CXX])])
-
-# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 1
-
 # AM_AUTOMAKE_VERSION(VERSION)
 # ----------------------------
 # Automake X.Y traces this macro to ensure aclocal.m4 has been
@@ -8644,7 +34,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
 [am__api_version='1.11'
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
 dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.11.3], [],
+m4_if([$1], [1.11.1], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 
@@ -8660,21 +50,19 @@ m4_define([_AM_AUTOCONF_VERSION], [])
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.11.3])dnl
+[AM_AUTOMAKE_VERSION([1.11.1])dnl
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
 
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 
-# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 1
-
 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
 # $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
 # `$srcdir', `$srcdir/..', or `$srcdir/../..'.
@@ -8756,14 +144,14 @@ AC_CONFIG_COMMANDS_PRE(
 Usually this means the macro was only invoked conditionally.]])
 fi])])
 
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009,
-# 2010, 2011 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
+# Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 12
+# serial 10
 
 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
 # written in clear, in which case automake, when reading aclocal.m4,
@@ -8803,7 +191,6 @@ AC_CACHE_CHECK([dependency style of $depcc],
   # instance it was reported that on HP-UX the gcc test will end up
   # making a dummy file named `D' -- because `-MD' means `put the output
   # in D'.
-  rm -rf conftest.dir
   mkdir conftest.dir
   # Copy depcomp to subdir because otherwise we won't find it if we're
   # using a relative directory.
@@ -8868,7 +255,7 @@ AC_CACHE_CHECK([dependency style of $depcc],
 	break
       fi
       ;;
-    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+    msvisualcpp | msvcmsys)
       # This compiler won't grok `-c -o', but also, the minuso test has
       # not run yet.  These depmodes are late enough in the game, and
       # so weak that their functioning should not be impacted.
@@ -8933,13 +320,10 @@ AC_DEFUN([AM_DEP_TRACK],
 if test "x$enable_dependency_tracking" != xno; then
   am_depcomp="$ac_aux_dir/depcomp"
   AMDEPBACKSLASH='\'
-  am__nodep='_no'
 fi
 AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
 AC_SUBST([AMDEPBACKSLASH])dnl
 _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
-AC_SUBST([am__nodep])dnl
-_AM_SUBST_NOTMAKE([am__nodep])dnl
 ])
 
 # Generate code to set up dependency tracking.              -*- Autoconf -*-
@@ -9161,15 +545,12 @@ for _am_header in $config_headers :; do
 done
 echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
 
-# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation,
-# Inc.
+# Copyright (C) 2001, 2003, 2005, 2008  Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 1
-
 # AM_PROG_INSTALL_SH
 # ------------------
 # Define $install_sh.
@@ -9301,15 +682,12 @@ else
 fi
 ])
 
-# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation,
-# Inc.
+# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 1
-
 # AM_PROG_MKDIR_P
 # ---------------
 # Check for `mkdir -p'.
@@ -9332,14 +710,13 @@ esac
 
 # Helper functions for option handling.                     -*- Autoconf -*-
 
-# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software
-# Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 2005, 2008  Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 5
+# serial 4
 
 # _AM_MANGLE_OPTION(NAME)
 # -----------------------
@@ -9347,13 +724,13 @@ AC_DEFUN([_AM_MANGLE_OPTION],
 [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
 
 # _AM_SET_OPTION(NAME)
-# --------------------
+# ------------------------------
 # Set option NAME.  Presently that only means defining a flag for this option.
 AC_DEFUN([_AM_SET_OPTION],
 [m4_define(_AM_MANGLE_OPTION([$1]), 1)])
 
 # _AM_SET_OPTIONS(OPTIONS)
-# ------------------------
+# ----------------------------------
 # OPTIONS is a space-separated list of Automake options.
 AC_DEFUN([_AM_SET_OPTIONS],
 [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
@@ -9364,14 +741,12 @@ AC_DEFUN([_AM_SET_OPTIONS],
 AC_DEFUN([_AM_IF_OPTION],
 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
 
-# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 1
-
 # AM_RUN_LOG(COMMAND)
 # -------------------
 # Run COMMAND, save the exit status in ac_status, and log it.
@@ -9448,14 +823,12 @@ Check your system clock])
 fi
 AC_MSG_RESULT(yes)])
 
-# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 1
-
 # AM_PROG_INSTALL_STRIP
 # ---------------------
 # One issue with vendor `install' (even GNU) is that you can't
@@ -9478,13 +851,13 @@ fi
 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 AC_SUBST([INSTALL_STRIP_PROGRAM])])
 
-# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2006, 2008  Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 3
+# serial 2
 
 # _AM_SUBST_NOTMAKE(VARIABLE)
 # ---------------------------
@@ -9493,13 +866,13 @@ AC_SUBST([INSTALL_STRIP_PROGRAM])])
 AC_DEFUN([_AM_SUBST_NOTMAKE])
 
 # AM_SUBST_NOTMAKE(VARIABLE)
-# --------------------------
+# ---------------------------
 # Public sister of _AM_SUBST_NOTMAKE.
 AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 
 # Check how to create a tarball.                            -*- Autoconf -*-
 
-# Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc.
+# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9521,11 +894,10 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 # a tarball read from stdin.
 #     $(am__untar) < result.tar
 AC_DEFUN([_AM_PROG_TAR],
-[# Always define AMTAR for backward compatibility.  Yes, it's still used
-# in the wild :-(  We should find a proper way to deprecate it ...
-AC_SUBST([AMTAR], ['$${TAR-tar}'])
+[# Always define AMTAR for backward compatibility.
+AM_MISSING_PROG([AMTAR], [tar])
 m4_if([$1], [v7],
-     [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
+     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
      [m4_case([$1], [ustar],, [pax],,
               [m4_fatal([Unknown tar format])])
 AC_MSG_CHECKING([how to create a $1 tar archive])
@@ -9594,11 +966,18 @@ AC_SUBST([am__tar])
 AC_SUBST([am__untar])
 ]) # _AM_PROG_TAR
 
-m4_include([m4/ax_boost_base.m4])
-m4_include([m4/ax_boost_filesystem.m4])
-m4_include([m4/ax_boost_iostreams.m4])
-m4_include([m4/ax_boost_regex.m4])
-m4_include([m4/ax_boost_system.m4])
-m4_include([m4/ax_boost_thread.m4])
-m4_include([m4/ax_check_zlib.m4])
-m4_include([m4/ax_lib_expat.m4])
+m4_include([config/m4/ax_boost_base.m4])
+m4_include([config/m4/ax_boost_regex.m4])
+m4_include([config/m4/ax_boost_thread.m4])
+m4_include([config/m4/ax_check_zlib.m4])
+m4_include([config/m4/ax_cxx_have_std.m4])
+m4_include([config/m4/ax_cxx_have_stl.m4])
+m4_include([config/m4/ax_cxx_namespaces.m4])
+m4_include([config/m4/ax_lib_expat.m4])
+m4_include([config/m4/ax_with_perl.m4])
+m4_include([config/m4/ax_with_prog.m4])
+m4_include([config/m4/libtool.m4])
+m4_include([config/m4/ltoptions.m4])
+m4_include([config/m4/ltsugar.m4])
+m4_include([config/m4/ltversion.m4])
+m4_include([config/m4/lt~obsolete.m4])
diff --git a/build-aux/git-version-gen b/build-aux/git-version-gen
deleted file mode 100755
index ca05dfe..0000000
--- a/build-aux/git-version-gen
+++ /dev/null
@@ -1,181 +0,0 @@
-#!/bin/sh
-
-# adapted from the GIT-VERSION-GEN from GIT: http://git.or.cz/
-
-# MIRA
-# On MASTER branch or branches called "rel_*"
-#
-# Take the last available tag as base, add "-dirty" if dirty,
-#  then the rest of the git string where the number of commits
-#  is separated via "_" and the SHA string with "+"
-#   3.9.0-2-g86793f6  --->  3.9.0_2+g86793f6
-#
-# When "isshort" is given, then the part after the "+" is cut
-#  away (for e.g. tarball package names), _0 is also cut away
-#  if present at the end
-#
-#
-# All other branches: pure git describe string from "git --all --long"
-#  develop-2-g86793f6
-#
-# That is, as there is no "+", the short name is exactly the same
-
-# Copyright (C) 2007-2009 Free Software Foundation
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# This script is derived from GIT-VERSION-GEN from GIT: http://git.or.cz/.
-# It may be run two ways:
-# - from a git repository in which the "git describe" command below
-#   produces useful output (thus requiring at least one signed tag)
-# - from a non-git-repo directory containing a .tarball-version file, which
-#   presumes this script is invoked like "./git-version-gen .tarball-version".
-
-# In order to use intra-version strings in your project, you will need two
-# separate generated version string files:
-#
-# .tarball-version - present only in a distribution tarball, and not in
-#   a checked-out repository.  Created with contents that were learned at
-#   the last time autoconf was run, and used by git-version-gen.  Must not
-#   be present in either $(srcdir) or $(builddir) for git-version-gen to
-#   give accurate answers during normal development with a checked out tree,
-#   but must be present in a tarball when there is no version control system.
-#   Therefore, it cannot be used in any dependencies.  GNUmakefile has
-#   hooks to force a reconfigure at distribution time to get the value
-#   correct, without penalizing normal development with extra reconfigures.
-#
-# .version - present in a checked-out repository and in a distribution
-#   tarball.  Usable in dependencies, particularly for files that don't
-#   want to depend on config.h but do want to track version changes.
-#   Delete this file prior to any autoconf run where you want to rebuild
-#   files to pick up a version string change; and leave it stale to
-#   minimize rebuild time after unrelated changes to configure sources.
-#
-# It is probably wise to add these two files to .gitignore, so that you
-# don't accidentally commit either generated file.
-#
-# Use the following line in your configure.ac, so that $(VERSION) will
-# automatically be up-to-date each time configure is run (and note that
-# since configure.ac no longer includes a version string, Makefile rules
-# should not depend on configure.ac for version updates).
-#
-# AC_INIT([GNU project],
-#         m4_esyscmd([build-aux/git-version-gen .tarball-version]),
-#         [bug-project at example])
-#
-# Then use the following lines in your Makefile.am, so that .version
-# will be present for dependencies, and so that .tarball-version will
-# exist in distribution tarballs.
-#
-# BUILT_SOURCES = $(top_srcdir)/.version
-# $(top_srcdir)/.version:
-#	echo $(VERSION) > $@-t && mv $@-t $@
-# dist-hook:
-#	echo $(VERSION) > $(distdir)/.tarball-version
-
-case $# in
-    1) tarball_version_file=$1; isshort=0;;
-    2) tarball_version_file=$2; isshort=1;;
-    *) echo 1>&2 "Usage: $0 [isshort] \$srcdir/.tarball-version"; exit 1;;
-esac
-
-nl='
-'
-
-# First see if there is a tarball-only version file.
-# then try "git describe", then default.
-if test -f $tarball_version_file
-then
-    v=`cat $tarball_version_file` || exit 1
-    case $v in
-	*$nl*) v= ;; # reject multi-line output
-	[0-9a-zA-Z\-\.]*) ;; # accept only this
-	*) v= ;; # reject all else
-    esac
-    test -z "$v" \
-	&& echo "$0: WARNING: $tarball_version_file seems to be damaged" 1>&2
-
-    case "$isshort" in
-	0) ;;
-	1) v=`echo "$v" | sed -e 's/\+.*$//' -e 's/_0$//'` ;;
-    esac
-fi
-
-if test -n "$v"
-then
-    : # use $v
-#elif test -d .git \
-#    && v=`git describe --all --long 2>/dev/null`
-elif v=`git describe --all --long 2>/dev/null`
-then
-    # remove heads/ etc.
-    v=`echo "$v" | sed 's/.*\///'`
-
-    # Is this a new git that lists number of commits since the last
-    # tag or the previous older version that did not?
-    #   Newer: v6.10-77-g0f8faeb
-    #   Older: v6.10-g0f8faeb
-    case $v in
-	*-*-*) : git describe is okay three part flavor ;;
-	*-*)
-	    : git describe is older two part flavor
-	    # Recreate the number of commits and rewrite such that the
-	    # result is the same as if we were using the newer version
-	    # of git describe.
-	    vtag=`echo "$v" | sed 's/-.*//'`
-	    numcommits=`git rev-list "$vtag"..HEAD | wc -l`
-	    v=`echo "$v" | sed "s/\(.*\)-\(.*\)/\1-$numcommits-\2/"`;
-	    ;;
-    esac
-
-    b=`git status -s -b | head -1 | cut -f 2 -d ' ' 2>/dev/null`
-
-    # on master?
-    case $b in
-	master* | rel_*)
-	    : we are on master or release branch
-	    # then use version taken from tag version of git describe.
-	    v=`git describe --long --tags 2>/dev/null`
-	    # transform V340-1-g80816de to V340_1+...
-	    v=`echo "$v" | sed -e 's/-/_/' | sed -e 's/-/+/'`
-	    ;;
-    esac
-
-else
-    v=UNKNOWN
-fi
-
-v=`echo "$v" |sed 's/^v//'`
-
-case "$isshort" in
-    0) ;;
-    1) v=`echo "$v" | sed -e 's/\+.*$//' -e 's/_0$//'` ;;
-esac
-
-
-# Don't declare a version "dirty" merely because a time stamp has changed.
-git status > /dev/null 2>&1
-
-dirty=`sh -c 'git diff-index --name-only HEAD' 2>/dev/null` || dirty=
-case "$dirty" in
-    '') ;;
-    *) # Append the suffix only if there isn't one already.
-	case $v in
-	  *-dirty) ;;
-	  *) v="$v-dirty" ;;
-	esac ;;
-esac
-
-# Omit the trailing newline, so that m4_esyscmd can use the result directly.
-echo "$v" | tr -d '\012'
diff --git a/config.guess b/config.guess
index d622a44..c2246a4 100755
--- a/config.guess
+++ b/config.guess
@@ -1,10 +1,10 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-#   2011, 2012 Free Software Foundation, Inc.
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+#   Free Software Foundation, Inc.
 
-timestamp='2012-02-10'
+timestamp='2009-12-30'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -17,7 +17,9 @@ timestamp='2012-02-10'
 # General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
 #
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
@@ -55,8 +57,8 @@ GNU config.guess ($timestamp)
 
 Originally written by Per Bothner.
 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
-Free Software Foundation, Inc.
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
+Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -143,7 +145,7 @@ UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
     *:NetBSD:*:*)
 	# NetBSD (nbsd) targets should (where applicable) match one or
-	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
+	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
 	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
 	# switched to ELF, *-*-netbsd* would select the old
 	# object file format.  This provides both forward
@@ -179,7 +181,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 		fi
 		;;
 	    *)
-		os=netbsd
+	        os=netbsd
 		;;
 	esac
 	# The OS release
@@ -222,7 +224,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
 		;;
 	*5.*)
-		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
 		;;
 	esac
 	# According to Compaq, /usr/sbin/psrinfo has been available on
@@ -268,10 +270,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	# A Xn.n version is an unreleased experimental baselevel.
 	# 1.2 uses "1.2" for uname -r.
 	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
-	exitcode=$?
-	trap '' 0
-	exit $exitcode ;;
+	exit ;;
     Alpha\ *:Windows_NT*:*)
 	# How do we know it's Interix rather than the generic POSIX subsystem?
 	# Should we change UNAME_MACHINE based on the output of uname instead
@@ -297,7 +296,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	echo s390-ibm-zvmoe
 	exit ;;
     *:OS400:*:*)
-	echo powerpc-ibm-os400
+        echo powerpc-ibm-os400
 	exit ;;
     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
 	echo arm-acorn-riscix${UNAME_RELEASE}
@@ -396,23 +395,23 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
     # MiNT.  But MiNT is downward compatible to TOS, so this should
     # be no problem.
     atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
-	echo m68k-atari-mint${UNAME_RELEASE}
+        echo m68k-atari-mint${UNAME_RELEASE}
 	exit ;;
     atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
 	echo m68k-atari-mint${UNAME_RELEASE}
-	exit ;;
+        exit ;;
     *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
-	echo m68k-atari-mint${UNAME_RELEASE}
+        echo m68k-atari-mint${UNAME_RELEASE}
 	exit ;;
     milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
-	echo m68k-milan-mint${UNAME_RELEASE}
-	exit ;;
+        echo m68k-milan-mint${UNAME_RELEASE}
+        exit ;;
     hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
-	echo m68k-hades-mint${UNAME_RELEASE}
-	exit ;;
+        echo m68k-hades-mint${UNAME_RELEASE}
+        exit ;;
     *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
-	echo m68k-unknown-mint${UNAME_RELEASE}
-	exit ;;
+        echo m68k-unknown-mint${UNAME_RELEASE}
+        exit ;;
     m68k:machten:*:*)
 	echo m68k-apple-machten${UNAME_RELEASE}
 	exit ;;
@@ -482,8 +481,8 @@ EOF
 	echo m88k-motorola-sysv3
 	exit ;;
     AViiON:dgux:*:*)
-	# DG/UX returns AViiON for all architectures
-	UNAME_PROCESSOR=`/usr/bin/uname -p`
+        # DG/UX returns AViiON for all architectures
+        UNAME_PROCESSOR=`/usr/bin/uname -p`
 	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
 	then
 	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
@@ -496,7 +495,7 @@ EOF
 	else
 	    echo i586-dg-dgux${UNAME_RELEASE}
 	fi
-	exit ;;
+ 	exit ;;
     M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
 	echo m88k-dolphin-sysv3
 	exit ;;
@@ -553,7 +552,7 @@ EOF
 		echo rs6000-ibm-aix3.2
 	fi
 	exit ;;
-    *:AIX:*:[4567])
+    *:AIX:*:[456])
 	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
 	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
 		IBM_ARCH=rs6000
@@ -596,52 +595,52 @@ EOF
 	    9000/[678][0-9][0-9])
 		if [ -x /usr/bin/getconf ]; then
 		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
-		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
-		    case "${sc_cpu_version}" in
-		      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
-		      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
-		      532)                      # CPU_PA_RISC2_0
-			case "${sc_kernel_bits}" in
-			  32) HP_ARCH="hppa2.0n" ;;
-			  64) HP_ARCH="hppa2.0w" ;;
+                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+                    case "${sc_cpu_version}" in
+                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+                      532)                      # CPU_PA_RISC2_0
+                        case "${sc_kernel_bits}" in
+                          32) HP_ARCH="hppa2.0n" ;;
+                          64) HP_ARCH="hppa2.0w" ;;
 			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
-			esac ;;
-		    esac
+                        esac ;;
+                    esac
 		fi
 		if [ "${HP_ARCH}" = "" ]; then
 		    eval $set_cc_for_build
-		    sed 's/^		//' << EOF >$dummy.c
+		    sed 's/^              //' << EOF >$dummy.c
 
-		#define _HPUX_SOURCE
-		#include <stdlib.h>
-		#include <unistd.h>
+              #define _HPUX_SOURCE
+              #include <stdlib.h>
+              #include <unistd.h>
 
-		int main ()
-		{
-		#if defined(_SC_KERNEL_BITS)
-		    long bits = sysconf(_SC_KERNEL_BITS);
-		#endif
-		    long cpu  = sysconf (_SC_CPU_VERSION);
+              int main ()
+              {
+              #if defined(_SC_KERNEL_BITS)
+                  long bits = sysconf(_SC_KERNEL_BITS);
+              #endif
+                  long cpu  = sysconf (_SC_CPU_VERSION);
 
-		    switch (cpu)
-			{
-			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
-			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
-			case CPU_PA_RISC2_0:
-		#if defined(_SC_KERNEL_BITS)
-			    switch (bits)
-				{
-				case 64: puts ("hppa2.0w"); break;
-				case 32: puts ("hppa2.0n"); break;
-				default: puts ("hppa2.0"); break;
-				} break;
-		#else  /* !defined(_SC_KERNEL_BITS) */
-			    puts ("hppa2.0"); break;
-		#endif
-			default: puts ("hppa1.0"); break;
-			}
-		    exit (0);
-		}
+                  switch (cpu)
+              	{
+              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+              	case CPU_PA_RISC2_0:
+              #if defined(_SC_KERNEL_BITS)
+              	    switch (bits)
+              		{
+              		case 64: puts ("hppa2.0w"); break;
+              		case 32: puts ("hppa2.0n"); break;
+              		default: puts ("hppa2.0"); break;
+              		} break;
+              #else  /* !defined(_SC_KERNEL_BITS) */
+              	    puts ("hppa2.0"); break;
+              #endif
+              	default: puts ("hppa1.0"); break;
+              	}
+                  exit (0);
+              }
 EOF
 		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
 		    test -z "$HP_ARCH" && HP_ARCH=hppa
@@ -732,22 +731,22 @@ EOF
 	exit ;;
     C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
 	echo c1-convex-bsd
-	exit ;;
+        exit ;;
     C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
 	if getsysinfo -f scalar_acc
 	then echo c32-convex-bsd
 	else echo c2-convex-bsd
 	fi
-	exit ;;
+        exit ;;
     C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
 	echo c34-convex-bsd
-	exit ;;
+        exit ;;
     C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
 	echo c38-convex-bsd
-	exit ;;
+        exit ;;
     C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
 	echo c4-convex-bsd
-	exit ;;
+        exit ;;
     CRAY*Y-MP:*:*:*)
 	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
 	exit ;;
@@ -771,14 +770,14 @@ EOF
 	exit ;;
     F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
 	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
-	FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
-	echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
-	exit ;;
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+        exit ;;
     5000:UNIX_System_V:4.*:*)
-	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
-	FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
-	echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
 	exit ;;
     i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
 	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
@@ -790,12 +789,13 @@ EOF
 	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
 	exit ;;
     *:FreeBSD:*:*)
-	UNAME_PROCESSOR=`/usr/bin/uname -p`
-	case ${UNAME_PROCESSOR} in
+	case ${UNAME_MACHINE} in
+	    pc98)
+		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
 	    amd64)
 		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
 	    *)
-		echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
 	esac
 	exit ;;
     i*:CYGWIN*:*)
@@ -804,18 +804,15 @@ EOF
     *:MINGW*:*)
 	echo ${UNAME_MACHINE}-pc-mingw32
 	exit ;;
-    i*:MSYS*:*)
-	echo ${UNAME_MACHINE}-pc-msys
-	exit ;;
     i*:windows32*:*)
-	# uname -m includes "-pc" on this system.
-	echo ${UNAME_MACHINE}-mingw32
+    	# uname -m includes "-pc" on this system.
+    	echo ${UNAME_MACHINE}-mingw32
 	exit ;;
     i*:PW*:*)
 	echo ${UNAME_MACHINE}-pc-pw32
 	exit ;;
     *:Interix*:*)
-	case ${UNAME_MACHINE} in
+    	case ${UNAME_MACHINE} in
 	    x86)
 		echo i586-pc-interix${UNAME_RELEASE}
 		exit ;;
@@ -861,13 +858,6 @@ EOF
     i*86:Minix:*:*)
 	echo ${UNAME_MACHINE}-pc-minix
 	exit ;;
-    aarch64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
-	exit ;;
-    aarch64_be:Linux:*:*)
-	UNAME_MACHINE=aarch64_be
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
-	exit ;;
     alpha:Linux:*:*)
 	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
 	  EV5)   UNAME_MACHINE=alphaev5 ;;
@@ -877,7 +867,7 @@ EOF
 	  EV6)   UNAME_MACHINE=alphaev6 ;;
 	  EV67)  UNAME_MACHINE=alphaev67 ;;
 	  EV68*) UNAME_MACHINE=alphaev68 ;;
-	esac
+        esac
 	objdump --private-headers /bin/sh | grep -q ld.so.1
 	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
 	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
@@ -889,29 +879,20 @@ EOF
 	then
 	    echo ${UNAME_MACHINE}-unknown-linux-gnu
 	else
-	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
-		| grep -q __ARM_PCS_VFP
-	    then
-		echo ${UNAME_MACHINE}-unknown-linux-gnueabi
-	    else
-		echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
-	    fi
+	    echo ${UNAME_MACHINE}-unknown-linux-gnueabi
 	fi
 	exit ;;
     avr32*:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
     cris:Linux:*:*)
-	echo ${UNAME_MACHINE}-axis-linux-gnu
+	echo cris-axis-linux-gnu
 	exit ;;
     crisv32:Linux:*:*)
-	echo ${UNAME_MACHINE}-axis-linux-gnu
+	echo crisv32-axis-linux-gnu
 	exit ;;
     frv:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
-	exit ;;
-    hexagon:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+    	echo frv-unknown-linux-gnu
 	exit ;;
     i*86:Linux:*:*)
 	LIBC=gnu
@@ -953,7 +934,7 @@ EOF
 	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
 	;;
     or32:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo or32-unknown-linux-gnu
 	exit ;;
     padre:Linux:*:*)
 	echo sparc-unknown-linux-gnu
@@ -979,7 +960,7 @@ EOF
 	echo ${UNAME_MACHINE}-ibm-linux
 	exit ;;
     sh64*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+    	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
     sh*:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
@@ -987,17 +968,14 @@ EOF
     sparc:Linux:*:* | sparc64:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
-    tile*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
-	exit ;;
     vax:Linux:*:*)
 	echo ${UNAME_MACHINE}-dec-linux-gnu
 	exit ;;
     x86_64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo x86_64-unknown-linux-gnu
 	exit ;;
     xtensa*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+    	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
     i*86:DYNIX/ptx:4*:*)
 	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
@@ -1006,11 +984,11 @@ EOF
 	echo i386-sequent-sysv4
 	exit ;;
     i*86:UNIX_SV:4.2MP:2.*)
-	# Unixware is an offshoot of SVR4, but it has its own version
-	# number series starting with 2...
-	# I am not positive that other SVR4 systems won't match this,
+        # Unixware is an offshoot of SVR4, but it has its own version
+        # number series starting with 2...
+        # I am not positive that other SVR4 systems won't match this,
 	# I just have to hope.  -- rms.
-	# Use sysv4.2uw... so that sysv4* matches it.
+        # Use sysv4.2uw... so that sysv4* matches it.
 	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
 	exit ;;
     i*86:OS/2:*:*)
@@ -1042,7 +1020,7 @@ EOF
 	fi
 	exit ;;
     i*86:*:5:[678]*)
-	# UnixWare 7.x, OpenUNIX and OpenServer 6.
+    	# UnixWare 7.x, OpenUNIX and OpenServer 6.
 	case `/bin/uname -X | grep "^Machine"` in
 	    *486*)	     UNAME_MACHINE=i486 ;;
 	    *Pentium)	     UNAME_MACHINE=i586 ;;
@@ -1070,13 +1048,13 @@ EOF
 	exit ;;
     pc:*:*:*)
 	# Left here for compatibility:
-	# uname -m prints for DJGPP always 'pc', but it prints nothing about
-	# the processor, so we play safe by assuming i586.
+        # uname -m prints for DJGPP always 'pc', but it prints nothing about
+        # the processor, so we play safe by assuming i586.
 	# Note: whatever this is, it MUST be the same as what config.sub
 	# prints for the "djgpp" host, or else GDB configury will decide that
 	# this is a cross-build.
 	echo i586-pc-msdosdjgpp
-	exit ;;
+        exit ;;
     Intel:Mach:3*:*)
 	echo i386-pc-mach3
 	exit ;;
@@ -1111,8 +1089,8 @@ EOF
 	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
 	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
     3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
-	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
-	  && { echo i486-ncr-sysv4; exit; } ;;
+        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+          && { echo i486-ncr-sysv4; exit; } ;;
     NCR*:*:4.2:* | MPRAS*:*:4.2:*)
 	OS_REL='.3'
 	test -r /etc/.relid \
@@ -1155,10 +1133,10 @@ EOF
 		echo ns32k-sni-sysv
 	fi
 	exit ;;
-    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
-			# says <Richard.M.Bartel at ccMail.Census.GOV>
-	echo i586-unisys-sysv4
-	exit ;;
+    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+                      # says <Richard.M.Bartel at ccMail.Census.GOV>
+        echo i586-unisys-sysv4
+        exit ;;
     *:UNIX_System_V:4*:FTX*)
 	# From Gerald Hewes <hewes at openmarket.com>.
 	# How about differentiating between stratus architectures? -djm
@@ -1184,11 +1162,11 @@ EOF
 	exit ;;
     R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
 	if [ -d /usr/nec ]; then
-		echo mips-nec-sysv${UNAME_RELEASE}
+	        echo mips-nec-sysv${UNAME_RELEASE}
 	else
-		echo mips-unknown-sysv${UNAME_RELEASE}
+	        echo mips-unknown-sysv${UNAME_RELEASE}
 	fi
-	exit ;;
+        exit ;;
     BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
 	echo powerpc-be-beos
 	exit ;;
@@ -1253,9 +1231,6 @@ EOF
     *:QNX:*:4*)
 	echo i386-pc-qnx
 	exit ;;
-    NEO-?:NONSTOP_KERNEL:*:*)
-	echo neo-tandem-nsk${UNAME_RELEASE}
-	exit ;;
     NSE-?:NONSTOP_KERNEL:*:*)
 	echo nse-tandem-nsk${UNAME_RELEASE}
 	exit ;;
@@ -1301,13 +1276,13 @@ EOF
 	echo pdp10-unknown-its
 	exit ;;
     SEI:*:*:SEIUX)
-	echo mips-sei-seiux${UNAME_RELEASE}
+        echo mips-sei-seiux${UNAME_RELEASE}
 	exit ;;
     *:DragonFly:*:*)
 	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
 	exit ;;
     *:*VMS:*:*)
-	UNAME_MACHINE=`(uname -p) 2>/dev/null`
+    	UNAME_MACHINE=`(uname -p) 2>/dev/null`
 	case "${UNAME_MACHINE}" in
 	    A*) echo alpha-dec-vms ; exit ;;
 	    I*) echo ia64-dec-vms ; exit ;;
@@ -1325,9 +1300,6 @@ EOF
     i*86:AROS:*:*)
 	echo ${UNAME_MACHINE}-pc-aros
 	exit ;;
-    x86_64:VMkernel:*:*)
-	echo ${UNAME_MACHINE}-unknown-esx
-	exit ;;
 esac
 
 #echo '(No uname command or uname output not recognized.)' 1>&2
@@ -1350,11 +1322,11 @@ main ()
 #include <sys/param.h>
   printf ("m68k-sony-newsos%s\n",
 #ifdef NEWSOS4
-	"4"
+          "4"
 #else
-	""
+	  ""
 #endif
-	); exit (0);
+         ); exit (0);
 #endif
 #endif
 
diff --git a/config.sub b/config.sub
index c894da4..c2d1257 100755
--- a/config.sub
+++ b/config.sub
@@ -1,10 +1,10 @@
 #! /bin/sh
 # Configuration validation subroutine script.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-#   2011, 2012 Free Software Foundation, Inc.
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+#   Free Software Foundation, Inc.
 
-timestamp='2012-02-10'
+timestamp='2010-01-22'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -21,7 +21,9 @@ timestamp='2012-02-10'
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
 #
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
@@ -74,8 +76,8 @@ version="\
 GNU config.sub ($timestamp)
 
 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
-Free Software Foundation, Inc.
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
+Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -122,18 +124,13 @@ esac
 # Here we must recognize all the valid KERNEL-OS combinations.
 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
 case $maybe_os in
-  nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
-  linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
-  knetbsd*-gnu* | netbsd*-gnu* | \
+  nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
+  uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
   kopensolaris*-gnu* | \
   storm-chaos* | os2-emx* | rtmk-nova*)
     os=-$maybe_os
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
     ;;
-  android-linux)
-    os=-linux-android
-    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
-    ;;
   *)
     basic_machine=`echo $1 | sed 's/-[^-]*$//'`
     if [ $basic_machine != $1 ]
@@ -160,8 +157,8 @@ case $os in
 		os=
 		basic_machine=$1
 		;;
-	-bluegene*)
-		os=-cnk
+        -bluegene*)
+	        os=-cnk
 		;;
 	-sim | -cisco | -oki | -wec | -winbond)
 		os=
@@ -177,10 +174,10 @@ case $os in
 		os=-chorusos
 		basic_machine=$1
 		;;
-	-chorusrdb)
-		os=-chorusrdb
+ 	-chorusrdb)
+ 		os=-chorusrdb
 		basic_machine=$1
-		;;
+ 		;;
 	-hiux*)
 		os=-hiuxwe2
 		;;
@@ -249,22 +246,17 @@ case $basic_machine in
 	# Some are omitted here because they have special meanings below.
 	1750a | 580 \
 	| a29k \
-	| aarch64 | aarch64_be \
 	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
 	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
 	| am33_2.0 \
 	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
-        | be32 | be64 \
 	| bfin \
 	| c4x | clipper \
 	| d10v | d30v | dlx | dsp16xx \
-	| epiphany \
 	| fido | fr30 | frv \
 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
-	| hexagon \
 	| i370 | i860 | i960 | ia64 \
 	| ip2k | iq2000 \
-	| le32 | le64 \
 	| lm32 \
 	| m32c | m32r | m32rle | m68000 | m68k | m88k \
 	| maxq | mb | microblaze | mcore | mep | metag \
@@ -290,39 +282,29 @@ case $basic_machine in
 	| moxie \
 	| mt \
 	| msp430 \
-	| nds32 | nds32le | nds32be \
 	| nios | nios2 \
 	| ns16k | ns32k \
-	| open8 \
 	| or32 \
 	| pdp10 | pdp11 | pj | pjl \
-	| powerpc | powerpc64 | powerpc64le | powerpcle \
+	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
 	| pyramid \
-	| rl78 | rx \
+	| rx \
 	| score \
 	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
 	| sh64 | sh64le \
 	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
 	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
-	| spu \
-	| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
+	| spu | strongarm \
+	| tahoe | thumb | tic4x | tic80 | tron \
 	| ubicom32 \
-	| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
+	| v850 | v850e \
 	| we32k \
-	| x86 | xc16x | xstormy16 | xtensa \
+	| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
 	| z8k | z80)
 		basic_machine=$basic_machine-unknown
 		;;
-	c54x)
-		basic_machine=tic54x-unknown
-		;;
-	c55x)
-		basic_machine=tic55x-unknown
-		;;
-	c6x)
-		basic_machine=tic6x-unknown
-		;;
-	m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
+	m6811 | m68hc11 | m6812 | m68hc12 | picochip)
+		# Motorola 68HC11/12.
 		basic_machine=$basic_machine-unknown
 		os=-none
 		;;
@@ -332,21 +314,6 @@ case $basic_machine in
 		basic_machine=mt-unknown
 		;;
 
-	strongarm | thumb | xscale)
-		basic_machine=arm-unknown
-		;;
-	xgate)
-		basic_machine=$basic_machine-unknown
-		os=-none
-		;;
-	xscaleeb)
-		basic_machine=armeb-unknown
-		;;
-
-	xscaleel)
-		basic_machine=armel-unknown
-		;;
-
 	# We use `pc' rather than `unknown'
 	# because (1) that's what they normally are, and
 	# (2) the word "unknown" tends to confuse beginning users.
@@ -361,25 +328,21 @@ case $basic_machine in
 	# Recognize the basic CPU types with company name.
 	580-* \
 	| a29k-* \
-	| aarch64-* | aarch64_be-* \
 	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
 	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
 	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
 	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
 	| avr-* | avr32-* \
-	| be32-* | be64-* \
 	| bfin-* | bs2000-* \
-	| c[123]* | c30-* | [cjt]90-* | c4x-* \
+	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
 	| clipper-* | craynv-* | cydra-* \
 	| d10v-* | d30v-* | dlx-* \
 	| elxsi-* \
 	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
 	| h8300-* | h8500-* \
 	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
-	| hexagon-* \
 	| i*86-* | i860-* | i960-* | ia64-* \
 	| ip2k-* | iq2000-* \
-	| le32-* | le64-* \
 	| lm32-* \
 	| m32c-* | m32r-* | m32rle-* \
 	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
@@ -405,29 +368,26 @@ case $basic_machine in
 	| mmix-* \
 	| mt-* \
 	| msp430-* \
-	| nds32-* | nds32le-* | nds32be-* \
 	| nios-* | nios2-* \
 	| none-* | np1-* | ns16k-* | ns32k-* \
-	| open8-* \
 	| orion-* \
 	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
-	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
+	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
 	| pyramid-* \
-	| rl78-* | romp-* | rs6000-* | rx-* \
+	| romp-* | rs6000-* | rx-* \
 	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
 	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
 	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
 	| sparclite-* \
-	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
-	| tahoe-* \
+	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
+	| tahoe-* | thumb-* \
 	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
-	| tile*-* \
+	| tile-* | tilegx-* \
 	| tron-* \
 	| ubicom32-* \
-	| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
-	| vax-* \
+	| v850-* | v850e-* | vax-* \
 	| we32k-* \
-	| x86-* | x86_64-* | xc16x-* | xps100-* \
+	| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
 	| xstormy16-* | xtensa*-* \
 	| ymp-* \
 	| z8k-* | z80-*)
@@ -452,7 +412,7 @@ case $basic_machine in
 		basic_machine=a29k-amd
 		os=-udi
 		;;
-	abacus)
+    	abacus)
 		basic_machine=abacus-unknown
 		;;
 	adobe68k)
@@ -522,20 +482,11 @@ case $basic_machine in
 		basic_machine=powerpc-ibm
 		os=-cnk
 		;;
-	c54x-*)
-		basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
-	c55x-*)
-		basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
-	c6x-*)
-		basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
 	c90)
 		basic_machine=c90-cray
 		os=-unicos
 		;;
-	cegcc)
+        cegcc)
 		basic_machine=arm-unknown
 		os=-cegcc
 		;;
@@ -567,7 +518,7 @@ case $basic_machine in
 		basic_machine=craynv-cray
 		os=-unicosmp
 		;;
-	cr16 | cr16-*)
+	cr16)
 		basic_machine=cr16-unknown
 		os=-elf
 		;;
@@ -725,6 +676,7 @@ case $basic_machine in
 	i370-ibm* | ibm*)
 		basic_machine=i370-ibm
 		;;
+# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
 	i*86v32)
 		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
 		os=-sysv32
@@ -782,7 +734,7 @@ case $basic_machine in
 		basic_machine=ns32k-utek
 		os=-sysv
 		;;
-	microblaze)
+        microblaze)
 		basic_machine=microblaze-xilinx
 		;;
 	mingw32)
@@ -821,18 +773,10 @@ case $basic_machine in
 	ms1-*)
 		basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
 		;;
-	msys)
-		basic_machine=i386-pc
-		os=-msys
-		;;
 	mvs)
 		basic_machine=i370-ibm
 		os=-mvs
 		;;
-	nacl)
-		basic_machine=le32-unknown
-		os=-nacl
-		;;
 	ncr3000)
 		basic_machine=i486-ncr
 		os=-sysv4
@@ -897,12 +841,6 @@ case $basic_machine in
 	np1)
 		basic_machine=np1-gould
 		;;
-	neo-tandem)
-		basic_machine=neo-tandem
-		;;
-	nse-tandem)
-		basic_machine=nse-tandem
-		;;
 	nsr-tandem)
 		basic_machine=nsr-tandem
 		;;
@@ -985,10 +923,9 @@ case $basic_machine in
 		;;
 	power)	basic_machine=power-ibm
 		;;
-	ppc | ppcbe)	basic_machine=powerpc-unknown
+	ppc)	basic_machine=powerpc-unknown
 		;;
-	ppc-* | ppcbe-*)
-		basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+	ppc-*)	basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
 	ppcle | powerpclittle | ppc-le | powerpc-little)
 		basic_machine=powerpcle-unknown
@@ -1082,9 +1019,6 @@ case $basic_machine in
 		basic_machine=i860-stratus
 		os=-sysv4
 		;;
-	strongarm-* | thumb-*)
-		basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
 	sun2)
 		basic_machine=m68000-sun
 		;;
@@ -1141,8 +1075,25 @@ case $basic_machine in
 		basic_machine=t90-cray
 		os=-unicos
 		;;
+	tic54x | c54x*)
+		basic_machine=tic54x-unknown
+		os=-coff
+		;;
+	tic55x | c55x*)
+		basic_machine=tic55x-unknown
+		os=-coff
+		;;
+	tic6x | c6x*)
+		basic_machine=tic6x-unknown
+		os=-coff
+		;;
+        # This must be matched before tile*.
+        tilegx*)
+		basic_machine=tilegx-unknown
+		os=-linux-gnu
+		;;
 	tile*)
-		basic_machine=$basic_machine-unknown
+		basic_machine=tile-unknown
 		os=-linux-gnu
 		;;
 	tx39)
@@ -1212,9 +1163,6 @@ case $basic_machine in
 	xps | xps100)
 		basic_machine=xps100-honeywell
 		;;
-	xscale-* | xscalee[bl]-*)
-		basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
-		;;
 	ymp)
 		basic_machine=ymp-cray
 		os=-unicos
@@ -1312,11 +1260,11 @@ esac
 if [ x"$os" != x"" ]
 then
 case $os in
-	# First match some system type aliases
-	# that might get confused with valid system types.
+        # First match some system type aliases
+        # that might get confused with valid system types.
 	# -solaris* is a basic system type, with this one exception.
-	-auroraux)
-		os=-auroraux
+        -auroraux)
+	        os=-auroraux
 		;;
 	-solaris1 | -solaris1.*)
 		os=`echo $os | sed -e 's|solaris1|sunos4|'`
@@ -1352,9 +1300,8 @@ case $os in
 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
 	      | -chorusos* | -chorusrdb* | -cegcc* \
-	      | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-	      | -mingw32* | -linux-gnu* | -linux-android* \
-	      | -linux-newlib* | -linux-uclibc* \
+	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+	      | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
 	      | -uxpv* | -beos* | -mpeix* | -udk* \
 	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
 	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
@@ -1401,7 +1348,7 @@ case $os in
 	-opened*)
 		os=-openedition
 		;;
-	-os400*)
+        -os400*)
 		os=-os400
 		;;
 	-wince*)
@@ -1450,7 +1397,7 @@ case $os in
 	-sinix*)
 		os=-sysv4
 		;;
-	-tpf*)
+        -tpf*)
 		os=-tpf
 		;;
 	-triton*)
@@ -1495,8 +1442,8 @@ case $os in
 	-dicos*)
 		os=-dicos
 		;;
-	-nacl*)
-		;;
+        -nacl*)
+	        ;;
 	-none)
 		;;
 	*)
@@ -1519,10 +1466,10 @@ else
 # system, and we'll never get to this point.
 
 case $basic_machine in
-	score-*)
+        score-*)
 		os=-elf
 		;;
-	spu-*)
+        spu-*)
 		os=-elf
 		;;
 	*-acorn)
@@ -1534,17 +1481,8 @@ case $basic_machine in
 	arm*-semi)
 		os=-aout
 		;;
-	c4x-* | tic4x-*)
-		os=-coff
-		;;
-	tic54x-*)
-		os=-coff
-		;;
-	tic55x-*)
-		os=-coff
-		;;
-	tic6x-*)
-		os=-coff
+        c4x-* | tic4x-*)
+        	os=-coff
 		;;
 	# This must come before the *-dec entry.
 	pdp10-*)
@@ -1564,11 +1502,14 @@ case $basic_machine in
 		;;
 	m68000-sun)
 		os=-sunos3
+		# This also exists in the configure program, but was not the
+		# default.
+		# os=-sunos4
 		;;
 	m68*-cisco)
 		os=-aout
 		;;
-	mep-*)
+        mep-*)
 		os=-elf
 		;;
 	mips*-cisco)
@@ -1595,7 +1536,7 @@ case $basic_machine in
 	*-ibm)
 		os=-aix
 		;;
-	*-knuth)
+    	*-knuth)
 		os=-mmixware
 		;;
 	*-wec)
diff --git a/m4/ax_boost_base.m4 b/config/m4/ax_boost_base.m4
similarity index 92%
rename from m4/ax_boost_base.m4
rename to config/m4/ax_boost_base.m4
index 8e6ee9a..ec23a0a 100644
--- a/m4/ax_boost_base.m4
+++ b/config/m4/ax_boost_base.m4
@@ -33,7 +33,7 @@
 #   and this notice are preserved. This file is offered as-is, without any
 #   warranty.
 
-#serial 23
+#serial 18
 
 AC_DEFUN([AX_BOOST_BASE],
 [
@@ -59,7 +59,7 @@ AC_ARG_WITH([boost],
 
 AC_ARG_WITH([boost-libdir],
         AS_HELP_STRING([--with-boost-libdir=LIB_DIR],
-        [Force given directory for boost libraries. Note that this will override library path detection, so use this parameter only if default library detection fails and you know exactly where your boost libraries are located.]),
+        [Force given directory for boost libraries. Note that this will overwrite library path detection, so use this parameter only if default library detection fails and you know exactly where your boost libraries are located.]),
         [
         if test -d "$withval"
         then
@@ -84,30 +84,15 @@ if test "x$want_boost" = "xyes"; then
     AC_MSG_CHECKING(for boostlib >= $boost_lib_version_req)
     succeeded=no
 
-    dnl On 64-bit systems check for system libraries in both lib64 and lib.
+    dnl On x86_64 systems check for system libraries in both lib64 and lib.
     dnl The former is specified by FHS, but e.g. Debian does not adhere to
     dnl this (as it rises problems for generic multi-arch support).
     dnl The last entry in the list is chosen by default when no libraries
     dnl are found, e.g. when only header-only libraries are installed!
     libsubdirs="lib"
-    ax_arch=`uname -m`
-    case $ax_arch in
-      x86_64|ppc64|s390x|sparc64|aarch64)
+    if test `uname -m` = x86_64; then
         libsubdirs="lib64 lib lib64"
-        ;;
-    esac
-
-    dnl allow for real multi-arch paths e.g. /usr/lib/x86_64-linux-gnu. Give
-    dnl them priority over the other paths since, if libs are found there, they
-    dnl are almost assuredly the ones desired.
-    AC_REQUIRE([AC_CANONICAL_HOST])
-    libsubdirs="lib/${host_cpu}-${host_os} $libsubdirs"
-
-    case ${host_cpu} in
-      i?86)
-        libsubdirs="lib/i386-${host_os} $libsubdirs"
-        ;;
-    esac
+    fi
 
     dnl first we check the system location for boost libraries
     dnl this location ist chosen if boost libraries are installed with the --layout=system option
diff --git a/m4/ax_boost_regex.m4 b/config/m4/ax_boost_regex.m4
similarity index 88%
rename from m4/ax_boost_regex.m4
rename to config/m4/ax_boost_regex.m4
index 1ac06af..3c4a999 100644
--- a/m4/ax_boost_regex.m4
+++ b/config/m4/ax_boost_regex.m4
@@ -30,7 +30,7 @@
 #   and this notice are preserved. This file is offered as-is, without any
 #   warranty.
 
-#serial 20
+#serial 12
 
 AC_DEFUN([AX_BOOST_REGEX],
 [
@@ -46,7 +46,7 @@ AC_DEFUN([AX_BOOST_REGEX],
             ax_boost_user_regex_lib=""
         else
 		    want_boost="yes"
-		ax_boost_user_regex_lib="$withval"
+        	ax_boost_user_regex_lib="$withval"
 		fi
         ],
         [want_boost="yes"]
@@ -65,9 +65,9 @@ AC_DEFUN([AX_BOOST_REGEX],
         AC_CACHE_CHECK(whether the Boost::Regex library is available,
 					   ax_cv_boost_regex,
         [AC_LANG_PUSH([C++])
-			 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <boost/regex.hpp>
+			 AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[@%:@include <boost/regex.hpp>
 												]],
-                                   [[boost::regex r(); return 0;]])],
+                                   [[boost::regex r(); return 0;]]),
                    ax_cv_boost_regex=yes, ax_cv_boost_regex=no)
          AC_LANG_POP([C++])
 		])
@@ -75,19 +75,19 @@ AC_DEFUN([AX_BOOST_REGEX],
 			AC_DEFINE(HAVE_BOOST_REGEX,,[define if the Boost::Regex library is available])
             BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
             if test "x$ax_boost_user_regex_lib" = "x"; then
-                for libextension in `ls $BOOSTLIBDIR/libboost_regex*.so* $BOOSTLIBDIR/libboost_regex*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_regex.*\)\.so.*$;\1;' -e 's;^lib\(boost_regex.*\)\.a*$;\1;'` ; do
+                for libextension in `ls $BOOSTLIBDIR/libboost_regex*.{so,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_regex.*\)\.so.*$;\1;' -e 's;^lib\(boost_regex.*\)\.a*$;\1;'` ; do
                      ax_lib=${libextension}
 				    AC_CHECK_LIB($ax_lib, exit,
                                  [BOOST_REGEX_LIB="-l$ax_lib"; AC_SUBST(BOOST_REGEX_LIB) link_regex="yes"; break],
                                  [link_regex="no"])
-				done
+  				done
                 if test "x$link_regex" != "xyes"; then
                 for libextension in `ls $BOOSTLIBDIR/boost_regex*.{dll,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_regex.*\)\.dll.*$;\1;' -e 's;^\(boost_regex.*\)\.a*$;\1;'` ; do
                      ax_lib=${libextension}
 				    AC_CHECK_LIB($ax_lib, exit,
                                  [BOOST_REGEX_LIB="-l$ax_lib"; AC_SUBST(BOOST_REGEX_LIB) link_regex="yes"; break],
                                  [link_regex="no"])
-				done
+  				done
                 fi
 
             else
@@ -97,15 +97,12 @@ AC_DEFUN([AX_BOOST_REGEX],
                                    [link_regex="no"])
                done
             fi
-            if test "x$ax_lib" = "x"; then
-                AC_MSG_ERROR(Could not find a version of the Boost::Regex library!)
-            fi
 			if test "x$link_regex" != "xyes"; then
 				AC_MSG_ERROR(Could not link against $ax_lib !)
 			fi
 		fi
 
 		CPPFLAGS="$CPPFLAGS_SAVED"
-	LDFLAGS="$LDFLAGS_SAVED"
+    	LDFLAGS="$LDFLAGS_SAVED"
 	fi
 ])
diff --git a/m4/ax_boost_thread.m4 b/config/m4/ax_boost_thread.m4
similarity index 86%
rename from m4/ax_boost_thread.m4
rename to config/m4/ax_boost_thread.m4
index 6ac10bb..ef3a68e 100644
--- a/m4/ax_boost_thread.m4
+++ b/config/m4/ax_boost_thread.m4
@@ -30,7 +30,7 @@
 #   and this notice are preserved. This file is offered as-is, without any
 #   warranty.
 
-#serial 23
+#serial 15
 
 AC_DEFUN([AX_BOOST_THREAD],
 [
@@ -46,7 +46,7 @@ AC_DEFUN([AX_BOOST_THREAD],
             ax_boost_user_thread_lib=""
         else
 		    want_boost="yes"
-		ax_boost_user_thread_lib="$withval"
+        	ax_boost_user_thread_lib="$withval"
 		fi
         ],
         [want_boost="yes"]
@@ -68,24 +68,24 @@ AC_DEFUN([AX_BOOST_THREAD],
         [AC_LANG_PUSH([C++])
 			 CXXFLAGS_SAVE=$CXXFLAGS
 
-			 if test "x$host_os" = "xsolaris" ; then
-				 CXXFLAGS="-pthreads $CXXFLAGS"
-			 elif test "x$host_os" = "xmingw32" ; then
+			 if test "x$build_os" = "xsolaris" ; then
+  				 CXXFLAGS="-pthreads $CXXFLAGS"
+			 elif test "x$build_os" = "xming32" ; then
 				 CXXFLAGS="-mthreads $CXXFLAGS"
 			 else
 				CXXFLAGS="-pthread $CXXFLAGS"
 			 fi
-			 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <boost/thread/thread.hpp>]],
+			 AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[@%:@include <boost/thread/thread.hpp>]],
                                    [[boost::thread_group thrds;
-                                   return 0;]])],
+                                   return 0;]]),
                    ax_cv_boost_thread=yes, ax_cv_boost_thread=no)
 			 CXXFLAGS=$CXXFLAGS_SAVE
              AC_LANG_POP([C++])
 		])
 		if test "x$ax_cv_boost_thread" = "xyes"; then
-           if test "x$host_os" = "xsolaris" ; then
+           if test "x$build_os" = "xsolaris" ; then
 			  BOOST_CPPFLAGS="-pthreads $BOOST_CPPFLAGS"
-		   elif test "x$host_os" = "xmingw32" ; then
+		   elif test "x$build_os" = "xming32" ; then
 			  BOOST_CPPFLAGS="-mthreads $BOOST_CPPFLAGS"
 		   else
 			  BOOST_CPPFLAGS="-pthread $BOOST_CPPFLAGS"
@@ -97,7 +97,7 @@ AC_DEFUN([AX_BOOST_THREAD],
             BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
 
 			LDFLAGS_SAVE=$LDFLAGS
-                        case "x$host_os" in
+                        case "x$build_os" in
                           *bsd* )
                                LDFLAGS="-pthread $LDFLAGS"
                           break;
@@ -109,14 +109,14 @@ AC_DEFUN([AX_BOOST_THREAD],
 				    AC_CHECK_LIB($ax_lib, exit,
                                  [BOOST_THREAD_LIB="-l$ax_lib"; AC_SUBST(BOOST_THREAD_LIB) link_thread="yes"; break],
                                  [link_thread="no"])
-				done
+  				done
                 if test "x$link_thread" != "xyes"; then
                 for libextension in `ls $BOOSTLIBDIR/boost_thread*.dll* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_thread.*\)\.dll.*$;\1;'` `ls $BOOSTLIBDIR/boost_thread*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_thread.*\)\.a*$;\1;'` ; do
                      ax_lib=${libextension}
 				    AC_CHECK_LIB($ax_lib, exit,
                                  [BOOST_THREAD_LIB="-l$ax_lib"; AC_SUBST(BOOST_THREAD_LIB) link_thread="yes"; break],
                                  [link_thread="no"])
-				done
+  				done
                 fi
 
             else
@@ -127,15 +127,12 @@ AC_DEFUN([AX_BOOST_THREAD],
                   done
 
             fi
-            if test "x$ax_lib" = "x"; then
-                AC_MSG_ERROR(Could not find a version of the library!)
-            fi
 			if test "x$link_thread" = "xno"; then
 				AC_MSG_ERROR(Could not link against $ax_lib !)
                         else
-                           case "x$host_os" in
+                           case "x$build_os" in
                               *bsd* )
-				BOOST_LDFLAGS="-pthread $BOOST_LDFLAGS"
+			        BOOST_LDFLAGS="-pthread $BOOST_LDFLAGS"
                               break;
                               ;;
                            esac
@@ -144,6 +141,6 @@ AC_DEFUN([AX_BOOST_THREAD],
 		fi
 
 		CPPFLAGS="$CPPFLAGS_SAVED"
-	LDFLAGS="$LDFLAGS_SAVED"
+    	LDFLAGS="$LDFLAGS_SAVED"
 	fi
 ])
diff --git a/m4/ax_check_zlib.m4 b/config/m4/ax_check_zlib.m4
similarity index 93%
rename from m4/ax_check_zlib.m4
rename to config/m4/ax_check_zlib.m4
index d308183..48fa3a6 100644
--- a/m4/ax_check_zlib.m4
+++ b/config/m4/ax_check_zlib.m4
@@ -9,10 +9,10 @@
 # DESCRIPTION
 #
 #   This macro searches for an installed zlib library. If nothing was
-#   specified when calling configure, it searches first in /usr/local and
-#   then in /usr, /opt/local and /sw. If the --with-zlib=DIR is specified,
-#   it will try to find it in DIR/include/zlib.h and DIR/lib/libz.a. If
-#   --without-zlib is specified, the library is not searched at all.
+#   specified when calling configure, it searches first in /usr/local and then
+#   in /usr, /opt/local and /sw. If the --with-zlib=DIR is specified, it will
+#   try to find it in DIR/include/zlib.h and DIR/lib/libz.a. If --without-zlib
+#   is specified, the library is not searched at all.
 #
 #   If either the header file (zlib.h) or the library (libz) is not found,
 #   the configuration exits on error, asking for a valid zlib installation
@@ -29,7 +29,8 @@
 # LICENSE
 #
 #   Copyright (c) 2008 Loic Dachary <loic at senga.org>
-#   Copyright (c) 2010 Bastien Chevreux <bach at chevreux.org>
+#   Additions for MacPorts / Fink support on OSX by 
+#     Bastien Chevreux <bach at chevreux.org>
 #
 #   This program is free software; you can redistribute it and/or modify it
 #   under the terms of the GNU General Public License as published by the
@@ -57,7 +58,7 @@
 #   modified version of the Autoconf Macro, you may extend this special
 #   exception to the GPL to apply to your modified version as well.
 
-#serial 8
+#serial 7
 
 AU_ALIAS([CHECK_ZLIB], [AX_CHECK_ZLIB])
 AC_DEFUN([AX_CHECK_ZLIB],
diff --git a/config/m4/ax_cxx_have_std.m4 b/config/m4/ax_cxx_have_std.m4
new file mode 100644
index 0000000..d146b34
--- /dev/null
+++ b/config/m4/ax_cxx_have_std.m4
@@ -0,0 +1,46 @@
+# ===========================================================================
+#      http://www.gnu.org/software/autoconf-archive/ax_cxx_have_std.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_CXX_HAVE_STD
+#
+# DESCRIPTION
+#
+#   If the compiler supports ISO C++ standard library (i.e., can include the
+#   files iostream, map, iomanip and cmath), define HAVE_STD.
+#
+# LICENSE
+#
+#   Copyright (c) 2008 Todd Veldhuizen
+#   Copyright (c) 2008 Luc Maisonobe <luc at spaceroots.org>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved. This file is offered as-is, without any
+#   warranty.
+
+#serial 6
+
+AU_ALIAS([AC_CXX_HAVE_STD], [AX_CXX_HAVE_STD])
+AC_DEFUN([AX_CXX_HAVE_STD],
+[AC_CACHE_CHECK(whether the compiler supports ISO C++ standard library,
+ax_cv_cxx_have_std,
+[AC_REQUIRE([AX_CXX_NAMESPACES])
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ AC_TRY_COMPILE([#include <iostream>
+#include <map>
+#include <iomanip>
+#include <cmath>
+#ifdef HAVE_NAMESPACES
+using namespace std;
+#endif],[return 0;],
+ ax_cv_cxx_have_std=yes, ax_cv_cxx_have_std=no)
+ AC_LANG_RESTORE
+])
+if test "$ax_cv_cxx_have_std" = yes; then
+  AC_DEFINE(HAVE_STD,,[define if the compiler supports ISO C++ standard library])
+fi
+])
diff --git a/config/m4/ax_cxx_have_stl.m4 b/config/m4/ax_cxx_have_stl.m4
new file mode 100644
index 0000000..35a6be5
--- /dev/null
+++ b/config/m4/ax_cxx_have_stl.m4
@@ -0,0 +1,44 @@
+# ===========================================================================
+#      http://www.gnu.org/software/autoconf-archive/ax_cxx_have_stl.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_CXX_HAVE_STL
+#
+# DESCRIPTION
+#
+#   If the compiler supports the Standard Template Library, define HAVE_STL.
+#
+# LICENSE
+#
+#   Copyright (c) 2008 Todd Veldhuizen
+#   Copyright (c) 2008 Luc Maisonobe <luc at spaceroots.org>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved. This file is offered as-is, without any
+#   warranty.
+
+#serial 6
+
+AU_ALIAS([AC_CXX_HAVE_STL], [AX_CXX_HAVE_STL])
+AC_DEFUN([AX_CXX_HAVE_STL],
+[AC_CACHE_CHECK(whether the compiler supports Standard Template Library,
+ax_cv_cxx_have_stl,
+[AC_REQUIRE([AX_CXX_NAMESPACES])
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ AC_TRY_COMPILE([#include <list>
+#include <deque>
+#ifdef HAVE_NAMESPACES
+using namespace std;
+#endif],[list<int> x; x.push_back(5);
+list<int>::iterator iter = x.begin(); if (iter != x.end()) ++iter; return 0;],
+ ax_cv_cxx_have_stl=yes, ax_cv_cxx_have_stl=no)
+ AC_LANG_RESTORE
+])
+if test "$ax_cv_cxx_have_stl" = yes; then
+  AC_DEFINE(HAVE_STL,,[define if the compiler supports Standard Template Library])
+fi
+])
diff --git a/config/m4/ax_cxx_namespaces.m4 b/config/m4/ax_cxx_namespaces.m4
new file mode 100644
index 0000000..9fdc374
--- /dev/null
+++ b/config/m4/ax_cxx_namespaces.m4
@@ -0,0 +1,40 @@
+# ===========================================================================
+#     http://www.gnu.org/software/autoconf-archive/ax_cxx_namespaces.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_CXX_NAMESPACES
+#
+# DESCRIPTION
+#
+#   If the compiler can prevent names clashes using namespaces, define
+#   HAVE_NAMESPACES.
+#
+# LICENSE
+#
+#   Copyright (c) 2008 Todd Veldhuizen
+#   Copyright (c) 2008 Luc Maisonobe <luc at spaceroots.org>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved. This file is offered as-is, without any
+#   warranty.
+
+#serial 6
+
+AU_ALIAS([AC_CXX_NAMESPACES], [AX_CXX_NAMESPACES])
+AC_DEFUN([AX_CXX_NAMESPACES],
+[AC_CACHE_CHECK(whether the compiler implements namespaces,
+ax_cv_cxx_namespaces,
+[AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ AC_TRY_COMPILE([namespace Outer { namespace Inner { int i = 0; }}],
+                [using namespace Outer::Inner; return i;],
+ ax_cv_cxx_namespaces=yes, ax_cv_cxx_namespaces=no)
+ AC_LANG_RESTORE
+])
+if test "$ax_cv_cxx_namespaces" = yes; then
+  AC_DEFINE(HAVE_NAMESPACES,,[define if the compiler implements namespaces])
+fi
+])
diff --git a/m4/ax_lib_expat.m4 b/config/m4/ax_lib_expat.m4
similarity index 95%
rename from m4/ax_lib_expat.m4
rename to config/m4/ax_lib_expat.m4
index 20b95a9..31d11b9 100644
--- a/m4/ax_lib_expat.m4
+++ b/config/m4/ax_lib_expat.m4
@@ -28,7 +28,6 @@
 #   This macro calls:
 #
 #     AC_SUBST(EXPAT_CFLAGS)
-#     AC_SUBST(EXPAT_LIBS)
 #     AC_SUBST(EXPAT_LDFLAGS)
 #     AC_SUBST(EXPAT_VERSION)  -- only if version requirement is used
 #
@@ -45,7 +44,7 @@
 #   and this notice are preserved. This file is offered as-is, without any
 #   warranty.
 
-#serial 10
+#serial 8
 
 AC_DEFUN([AX_LIB_EXPAT],
 [
@@ -99,7 +98,7 @@ AC_DEFUN([AX_LIB_EXPAT],
     )
 
     EXPAT_CFLAGS=""
-    EXPAT_LIBS=""
+    EXPAT_LDFLAGS=""
     EXPAT_VERSION=""
 
     dnl
@@ -109,8 +108,7 @@ AC_DEFUN([AX_LIB_EXPAT],
 
     if test -n "$expat_prefix"; then
         expat_include_dir="$expat_prefix/include"
-        expat_ld_flags="-L$expat_prefix/lib"
-        expat_lib_flags="-lexpat"
+        expat_lib_flags="-L$expat_prefix/lib -lexpat"
         run_expat_test="yes"
     elif test "$expat_requested" = "yes"; then
         if test -n "$expat_include_dir" -a -n "$expat_lib_flags"; then
@@ -128,11 +126,8 @@ AC_DEFUN([AX_LIB_EXPAT],
         saved_CPPFLAGS="$CPPFLAGS"
         CPPFLAGS="$CPPFLAGS -I$expat_include_dir"
 
-        saved_LIBS="$LIBS"
-        LIBS="$LIBS $expat_lib_flags"
-
         saved_LDFLAGS="$LDFLAGS"
-        LDFLAGS="$LDFLAGS $expat_ld_flags"
+        LDFLAGS="$LDFLAGS $expat_lib_flags"
 
         dnl
         dnl Check Expat headers
@@ -179,8 +174,7 @@ p = NULL;
                     ]]
                 )],
                 [
-                EXPAT_LIBS="$expat_lib_flags"
-                EXPAT_LDFLAGS="$expat_ld_flags"
+                EXPAT_LDFLAGS="$expat_lib_flags"
                 expat_lib_found="yes"
                 AC_MSG_RESULT([found])
                 ],
@@ -194,7 +188,6 @@ p = NULL;
 
         CPPFLAGS="$saved_CPPFLAGS"
         LDFLAGS="$saved_LDFLAGS"
-        LIBS="$saved_LIBS"
     fi
 
     AC_MSG_CHECKING([for Expat XML Parser])
@@ -204,7 +197,6 @@ p = NULL;
 
             AC_SUBST([EXPAT_CFLAGS])
             AC_SUBST([EXPAT_LDFLAGS])
-            AC_SUBST([EXPAT_LIBS])
 
             HAVE_EXPAT="yes"
         else
diff --git a/config/m4/ax_with_perl.m4 b/config/m4/ax_with_perl.m4
new file mode 100644
index 0000000..6167a38
--- /dev/null
+++ b/config/m4/ax_with_perl.m4
@@ -0,0 +1,35 @@
+# ===========================================================================
+#       http://www.gnu.org/software/autoconf-archive/ax_with_perl.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_WITH_PERL([VALUE-IF-NOT-FOUND],[PATH])
+#
+# DESCRIPTION
+#
+#   Locates an installed Perl binary, placing the result in the precious
+#   variable $PERL. Accepts a present $PERL, then --with-perl, and failing
+#   that searches for perl in the given path (which defaults to the system
+#   path). If perl is found, $PERL is set to the full path of the binary; if
+#   it is not found $PERL is set to VALUE-IF-NOT-FOUND if provided,
+#   unchanged otherwise.
+#
+#   A typical use could be the following one:
+#
+#     AX_WITH_PERL
+#
+# LICENSE
+#
+#   Copyright (c) 2009 Francesco Salvestrini <salvestrini at users.sourceforge.net>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved. This file is offered as-is, without any
+#   warranty.
+
+#serial 12
+
+AC_DEFUN([AX_WITH_PERL],[
+    AX_WITH_PROG(PERL,perl,$1,$2)
+])
diff --git a/config/m4/ax_with_prog.m4 b/config/m4/ax_with_prog.m4
new file mode 100644
index 0000000..aa08794
--- /dev/null
+++ b/config/m4/ax_with_prog.m4
@@ -0,0 +1,70 @@
+# ===========================================================================
+#       http://www.gnu.org/software/autoconf-archive/ax_with_prog.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_WITH_PROG([VARIABLE],[program],[VALUE-IF-NOT-FOUND],[PATH])
+#
+# DESCRIPTION
+#
+#   Locates an installed program binary, placing the result in the precious
+#   variable VARIABLE. Accepts a present VARIABLE, then --with-program, and
+#   failing that searches for program in the given path (which defaults to
+#   the system path). If program is found, VARIABLE is set to the full path
+#   of the binary; if it is not found VARIABLE is set to VALUE-IF-NOT-FOUND
+#   if provided, unchanged otherwise.
+#
+#   A typical example could be the following one:
+#
+#     AX_WITH_PROG(PERL,perl)
+#
+#   NOTE: This macro is based upon the original AX_WITH_PYTHON macro from
+#   Dustin J. Mitchell <dustin at cs.uchicago.edu>.
+#
+# LICENSE
+#
+#   Copyright (c) 2008 Francesco Salvestrini <salvestrini at users.sourceforge.net>
+#   Copyright (c) 2008 Dustin J. Mitchell <dustin at cs.uchicago.edu>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved. This file is offered as-is, without any
+#   warranty.
+
+#serial 13
+
+AC_DEFUN([AX_WITH_PROG],[
+    AC_PREREQ([2.61])
+
+    pushdef([VARIABLE],$1)
+    pushdef([EXECUTABLE],$2)
+    pushdef([VALUE_IF_NOT_FOUND],$3)
+    pushdef([PATH_PROG],$4)
+
+    AC_ARG_VAR(VARIABLE,Absolute path to EXECUTABLE executable)
+
+    AS_IF(test -z "$VARIABLE",[
+        AC_MSG_CHECKING(whether EXECUTABLE executable path has been provided)
+        AC_ARG_WITH(EXECUTABLE,AS_HELP_STRING([--with-EXECUTABLE=[[[PATH]]]],absolute path to EXECUTABLE executable), [
+            AS_IF([test "$withval" != yes -a "$withval" != no],[
+                VARIABLE="$withval"
+                AC_MSG_RESULT($VARIABLE)
+            ],[
+                VARIABLE=""
+                AC_MSG_RESULT([no])
+                AS_IF([test "$withval" != no], [
+                  AC_PATH_PROG([]VARIABLE[],[]EXECUTABLE[],[]VALUE_IF_NOT_FOUND[],[]PATH_PROG[])
+                ])
+            ])
+        ],[
+            AC_MSG_RESULT([no])
+            AC_PATH_PROG([]VARIABLE[],[]EXECUTABLE[],[]VALUE_IF_NOT_FOUND[],[]PATH_PROG[])
+        ])
+    ])
+
+    popdef([PATH_PROG])
+    popdef([VALUE_IF_NOT_FOUND])
+    popdef([EXECUTABLE])
+    popdef([VARIABLE])
+])
diff --git a/aclocal.m4 b/config/m4/libtool.m4
similarity index 65%
copy from aclocal.m4
copy to config/m4/libtool.m4
index 4266810..a3fee53 100644
--- a/aclocal.m4
+++ b/config/m4/libtool.m4
@@ -1,30 +1,7 @@
-# generated automatically by aclocal 1.11.3 -*- Autoconf -*-
-
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
-# Inc.
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-m4_ifndef([AC_AUTOCONF_VERSION],
-  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
-m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
-[m4_warning([this file was generated for autoconf 2.68.
-You have another version of autoconf.  It may work, but is not guaranteed to.
-If you have problems, you may need to regenerate the build system entirely.
-To do so, use the procedure documented by the package, typically `autoreconf'.])])
-
 # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
 #
 #   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-#                 Foundation, Inc.
+#                 2006, 2007, 2008 Free Software Foundation, Inc.
 #   Written by Gordon Matzigkeit, 1996
 #
 # This file is free software; the Free Software Foundation gives
@@ -33,8 +10,7 @@ To do so, use the procedure documented by the package, typically `autoreconf'.])
 
 m4_define([_LT_COPYING], [dnl
 #   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-#                 Foundation, Inc.
+#                 2006, 2007, 2008 Free Software Foundation, Inc.
 #   Written by Gordon Matzigkeit, 1996
 #
 #   This file is part of GNU Libtool.
@@ -61,7 +37,7 @@ m4_define([_LT_COPYING], [dnl
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 ])
 
-# serial 57 LT_INIT
+# serial 56 LT_INIT
 
 
 # LT_PREREQ(VERSION)
@@ -90,7 +66,6 @@ esac
 # ------------------
 AC_DEFUN([LT_INIT],
 [AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT
-AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
 AC_BEFORE([$0], [LT_LANG])dnl
 AC_BEFORE([$0], [LT_OUTPUT])dnl
 AC_BEFORE([$0], [LTDL_INIT])dnl
@@ -107,8 +82,6 @@ AC_REQUIRE([LTVERSION_VERSION])dnl
 AC_REQUIRE([LTOBSOLETE_VERSION])dnl
 m4_require([_LT_PROG_LTMAIN])dnl
 
-_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}])
-
 dnl Parse OPTIONS
 _LT_SET_OPTIONS([$0], [$1])
 
@@ -145,7 +118,7 @@ m4_defun([_LT_CC_BASENAME],
     *) break;;
   esac
 done
-cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
 ])
 
 
@@ -165,11 +138,6 @@ m4_defun([_LT_FILEUTILS_DEFAULTS],
 m4_defun([_LT_SETUP],
 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
-AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl
-AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl
-
-_LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl
-dnl
 _LT_DECL([], [host_alias], [0], [The host system])dnl
 _LT_DECL([], [host], [0])dnl
 _LT_DECL([], [host_os], [0])dnl
@@ -192,13 +160,10 @@ _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl
 dnl
 m4_require([_LT_FILEUTILS_DEFAULTS])dnl
 m4_require([_LT_CHECK_SHELL_FEATURES])dnl
-m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl
 m4_require([_LT_CMD_RELOAD])dnl
 m4_require([_LT_CHECK_MAGIC_METHOD])dnl
-m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl
 m4_require([_LT_CMD_OLD_ARCHIVE])dnl
 m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
-m4_require([_LT_WITH_SYSROOT])dnl
 
 _LT_CONFIG_LIBTOOL_INIT([
 # See if we are running on zsh, and set the options which allow our
@@ -214,6 +179,7 @@ fi
 _LT_CHECK_OBJDIR
 
 m4_require([_LT_TAG_COMPILER])dnl
+_LT_PROG_ECHO_BACKSLASH
 
 case $host_os in
 aix3*)
@@ -227,6 +193,23 @@ aix3*)
   ;;
 esac
 
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+sed_quote_subst='s/\([["`$\\]]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([["`\\]]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
 # Global variables:
 ofile=libtool
 can_build_shared=yes
@@ -267,28 +250,6 @@ _LT_CONFIG_COMMANDS
 ])# _LT_SETUP
 
 
-# _LT_PREPARE_SED_QUOTE_VARS
-# --------------------------
-# Define a few sed substitution that help us do robust quoting.
-m4_defun([_LT_PREPARE_SED_QUOTE_VARS],
-[# Backslashify metacharacters that are still active within
-# double-quoted strings.
-sed_quote_subst='s/\([["`$\\]]\)/\\\1/g'
-
-# Same as above, but do not quote variable references.
-double_quote_subst='s/\([["`\\]]\)/\\\1/g'
-
-# Sed substitution to delay expansion of an escaped shell variable in a
-# double_quote_subst'ed string.
-delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
-
-# Sed substitution to delay expansion of an escaped single quote.
-delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
-
-# Sed substitution to avoid accidental globbing in evaled expressions
-no_glob_subst='s/\*/\\\*/g'
-])
-
 # _LT_PROG_LTMAIN
 # ---------------
 # Note that this code is called both from `configure', and `config.status'
@@ -302,6 +263,9 @@ ltmain="$ac_aux_dir/ltmain.sh"
 ])# _LT_PROG_LTMAIN
 
 
+## ------------------------------------- ##
+## Accumulate code for creating libtool. ##
+## ------------------------------------- ##
 
 # So that we can recreate a full libtool script including additional
 # tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS
@@ -355,6 +319,9 @@ m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])],
 
 
 
+## ------------------------ ##
+## FIXME: Eliminate VARNAME ##
+## ------------------------ ##
 
 
 # _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?])
@@ -441,7 +408,7 @@ m4_define([_lt_decl_all_varnames],
 # declaration there will have the same value as in `configure'.  VARNAME
 # must have a single quote delimited value for this to work.
 m4_define([_LT_CONFIG_STATUS_DECLARE],
-[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`'])
+[$1='`$ECHO "X$][$1" | $Xsed -e "$delay_single_quote_subst"`'])
 
 
 # _LT_CONFIG_STATUS_DECLARATIONS
@@ -451,7 +418,7 @@ m4_define([_LT_CONFIG_STATUS_DECLARE],
 # embedded single quotes properly.  In configure, this macro expands
 # each variable declared with _LT_DECL (and _LT_TAGDECL) into:
 #
-#    <var>='`$ECHO "$<var>" | $SED "$delay_single_quote_subst"`'
+#    <var>='`$ECHO "X$<var>" | $Xsed -e "$delay_single_quote_subst"`'
 m4_defun([_LT_CONFIG_STATUS_DECLARATIONS],
 [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames),
     [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])])
@@ -550,20 +517,12 @@ LTCC='$LTCC'
 LTCFLAGS='$LTCFLAGS'
 compiler='$compiler_DEFAULT'
 
-# A function that is used when there is no print builtin or printf.
-func_fallback_echo ()
-{
-  eval 'cat <<_LTECHO_EOF
-\$[]1
-_LTECHO_EOF'
-}
-
 # Quote evaled strings.
 for var in lt_decl_all_varnames([[ \
 ]], lt_decl_quote_varnames); do
-    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+    case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
     *[[\\\\\\\`\\"\\\$]]*)
-      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
       ;;
     *)
       eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
@@ -574,9 +533,9 @@ done
 # Double-quote double-evaled strings.
 for var in lt_decl_all_varnames([[ \
 ]], lt_decl_dquote_varnames); do
-    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+    case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
     *[[\\\\\\\`\\"\\\$]]*)
-      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
       ;;
     *)
       eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
@@ -584,38 +543,16 @@ for var in lt_decl_all_varnames([[ \
     esac
 done
 
+# Fix-up fallback echo if it was mangled by the above quoting rules.
+case \$lt_ECHO in
+*'\\\[$]0 --fallback-echo"')dnl "
+  lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\[$]0 --fallback-echo"\[$]/\[$]0 --fallback-echo"/'\`
+  ;;
+esac
+
 _LT_OUTPUT_LIBTOOL_INIT
 ])
 
-# _LT_GENERATED_FILE_INIT(FILE, [COMMENT])
-# ------------------------------------
-# Generate a child script FILE with all initialization necessary to
-# reuse the environment learned by the parent script, and make the
-# file executable.  If COMMENT is supplied, it is inserted after the
-# `#!' sequence but before initialization text begins.  After this
-# macro, additional text can be appended to FILE to form the body of
-# the child script.  The macro ends with non-zero status if the
-# file could not be fully written (such as if the disk is full).
-m4_ifdef([AS_INIT_GENERATED],
-[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])],
-[m4_defun([_LT_GENERATED_FILE_INIT],
-[m4_require([AS_PREPARE])]dnl
-[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl
-[lt_write_fail=0
-cat >$1 <<_ASEOF || lt_write_fail=1
-#! $SHELL
-# Generated by $as_me.
-$2
-SHELL=\${CONFIG_SHELL-$SHELL}
-export SHELL
-_ASEOF
-cat >>$1 <<\_ASEOF || lt_write_fail=1
-AS_SHELL_SANITIZE
-_AS_PREPARE
-exec AS_MESSAGE_FD>&1
-_ASEOF
-test $lt_write_fail = 0 && chmod +x $1[]dnl
-m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT
 
 # LT_OUTPUT
 # ---------
@@ -625,11 +562,20 @@ m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT
 AC_DEFUN([LT_OUTPUT],
 [: ${CONFIG_LT=./config.lt}
 AC_MSG_NOTICE([creating $CONFIG_LT])
-_LT_GENERATED_FILE_INIT(["$CONFIG_LT"],
-[# Run this file to recreate a libtool stub with the current configuration.])
+cat >"$CONFIG_LT" <<_LTEOF
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate a libtool stub with the current configuration.
 
-cat >>"$CONFIG_LT" <<\_LTEOF
 lt_cl_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_LTEOF
+
+cat >>"$CONFIG_LT" <<\_LTEOF
+AS_SHELL_SANITIZE
+_AS_PREPARE
+
+exec AS_MESSAGE_FD>&1
 exec AS_MESSAGE_LOG_FD>>config.log
 {
   echo
@@ -655,7 +601,7 @@ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl
 m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])
 configured by $[0], generated by m4_PACKAGE_STRING.
 
-Copyright (C) 2011 Free Software Foundation, Inc.
+Copyright (C) 2008 Free Software Foundation, Inc.
 This config.lt script is free software; the Free Software Foundation
 gives unlimited permision to copy, distribute and modify it."
 
@@ -700,13 +646,15 @@ chmod +x "$CONFIG_LT"
 # appending to config.log, which fails on DOS, as config.log is still kept
 # open by configure.  Here we exec the FD to /dev/null, effectively closing
 # config.log, so it can be properly (re)opened and appended to by config.lt.
-lt_cl_success=:
-test "$silent" = yes &&
-  lt_config_lt_args="$lt_config_lt_args --quiet"
-exec AS_MESSAGE_LOG_FD>/dev/null
-$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
-exec AS_MESSAGE_LOG_FD>>config.log
-$lt_cl_success || AS_EXIT(1)
+if test "$no_create" != yes; then
+  lt_cl_success=:
+  test "$silent" = yes &&
+    lt_config_lt_args="$lt_config_lt_args --quiet"
+  exec AS_MESSAGE_LOG_FD>/dev/null
+  $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
+  exec AS_MESSAGE_LOG_FD>>config.log
+  $lt_cl_success || AS_EXIT(1)
+fi
 ])# LT_OUTPUT
 
 
@@ -769,12 +717,15 @@ _LT_EOF
   # if finds mixed CR/LF and LF-only lines.  Since sed operates in
   # text mode, it properly converts lines to CR/LF.  This bash problem
   # is reportedly fixed, but why not run on old versions too?
-  sed '$q' "$ltmain" >> "$cfgfile" \
-     || (rm -f "$cfgfile"; exit 1)
+  sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \
+    || (rm -f "$cfgfile"; exit 1)
 
-  _LT_PROG_REPLACE_SHELLFNS
+  _LT_PROG_XSI_SHELLFNS
 
-   mv -f "$cfgfile" "$ofile" ||
+  sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \
+    || (rm -f "$cfgfile"; exit 1)
+
+  mv -f "$cfgfile" "$ofile" ||
     (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
   chmod +x "$ofile"
 ],
@@ -819,7 +770,6 @@ AC_DEFUN([LT_LANG],
 m4_case([$1],
   [C],			[_LT_LANG(C)],
   [C++],		[_LT_LANG(CXX)],
-  [Go],			[_LT_LANG(GO)],
   [Java],		[_LT_LANG(GCJ)],
   [Fortran 77],		[_LT_LANG(F77)],
   [Fortran],		[_LT_LANG(FC)],
@@ -841,29 +791,6 @@ m4_defun([_LT_LANG],
 ])# _LT_LANG
 
 
-m4_ifndef([AC_PROG_GO], [
-# NOTE: This macro has been submitted for inclusion into   #
-#  GNU Autoconf as AC_PROG_GO.  When it is available in    #
-#  a released version of Autoconf we should remove this    #
-#  macro and use it instead.                               #
-m4_defun([AC_PROG_GO],
-[AC_LANG_PUSH(Go)dnl
-AC_ARG_VAR([GOC],     [Go compiler command])dnl
-AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl
-_AC_ARG_VAR_LDFLAGS()dnl
-AC_CHECK_TOOL(GOC, gccgo)
-if test -z "$GOC"; then
-  if test -n "$ac_tool_prefix"; then
-    AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo])
-  fi
-fi
-if test -z "$GOC"; then
-  AC_CHECK_PROG(GOC, gccgo, gccgo, false)
-fi
-])#m4_defun
-])#m4_ifndef
-
-
 # _LT_LANG_DEFAULT_CONFIG
 # -----------------------
 m4_defun([_LT_LANG_DEFAULT_CONFIG],
@@ -894,10 +821,6 @@ AC_PROVIDE_IFELSE([AC_PROG_GCJ],
        m4_ifdef([LT_PROG_GCJ],
 	[m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])])
 
-AC_PROVIDE_IFELSE([AC_PROG_GO],
-  [LT_LANG(GO)],
-  [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])])
-
 AC_PROVIDE_IFELSE([LT_PROG_RC],
   [LT_LANG(RC)],
   [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])])
@@ -908,13 +831,11 @@ AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)])
 AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)])
 AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)])
 AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)])
-AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)])
 dnl aclocal-1.4 backwards compatibility:
 dnl AC_DEFUN([AC_LIBTOOL_CXX], [])
 dnl AC_DEFUN([AC_LIBTOOL_F77], [])
 dnl AC_DEFUN([AC_LIBTOOL_FC], [])
 dnl AC_DEFUN([AC_LIBTOOL_GCJ], [])
-dnl AC_DEFUN([AC_LIBTOOL_RC], [])
 
 
 # _LT_TAG_COMPILER
@@ -1000,13 +921,7 @@ m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
 	$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
 	  -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
         _lt_result=$?
-	# If there is a non-empty error log, and "single_module"
-	# appears in it, assume the flag caused a linker warning
-        if test -s conftest.err && $GREP single_module conftest.err; then
-	  cat conftest.err >&AS_MESSAGE_LOG_FD
-	# Otherwise, if the output was created with a 0 exit code from
-	# the compiler, it worked.
-	elif test -f libconftest.dylib && test $_lt_result -eq 0; then
+	if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then
 	  lt_cv_apple_cc_single_mod=yes
 	else
 	  cat conftest.err >&AS_MESSAGE_LOG_FD
@@ -1014,7 +929,6 @@ m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
 	rm -rf libconftest.dylib*
 	rm -f conftest.*
       fi])
-
     AC_CACHE_CHECK([for -exported_symbols_list linker flag],
       [lt_cv_ld_exported_symbols_list],
       [lt_cv_ld_exported_symbols_list=no
@@ -1026,34 +940,6 @@ m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
 	[lt_cv_ld_exported_symbols_list=no])
 	LDFLAGS="$save_LDFLAGS"
     ])
-
-    AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load],
-      [lt_cv_ld_force_load=no
-      cat > conftest.c << _LT_EOF
-int forced_loaded() { return 2;}
-_LT_EOF
-      echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD
-      $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD
-      echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD
-      $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD
-      echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD
-      $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD
-      cat > conftest.c << _LT_EOF
-int main() { return 0;}
-_LT_EOF
-      echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD
-      $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
-      _lt_result=$?
-      if test -s conftest.err && $GREP force_load conftest.err; then
-	cat conftest.err >&AS_MESSAGE_LOG_FD
-      elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then
-	lt_cv_ld_force_load=yes
-      else
-	cat conftest.err >&AS_MESSAGE_LOG_FD
-      fi
-        rm -f conftest.err libconftest.a conftest conftest.c
-        rm -rf conftest.dSYM
-    ])
     case $host_os in
     rhapsody* | darwin1.[[012]])
       _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
@@ -1081,7 +967,7 @@ _LT_EOF
     else
       _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
     fi
-    if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
+    if test "$DSYMUTIL" != ":"; then
       _lt_dsymutil='~$DSYMUTIL $lib || :'
     else
       _lt_dsymutil=
@@ -1091,8 +977,8 @@ _LT_EOF
 ])
 
 
-# _LT_DARWIN_LINKER_FEATURES([TAG])
-# ---------------------------------
+# _LT_DARWIN_LINKER_FEATURES
+# --------------------------
 # Checks for linker and compiler features on darwin
 m4_defun([_LT_DARWIN_LINKER_FEATURES],
 [
@@ -1101,13 +987,7 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES],
   _LT_TAGVAR(hardcode_direct, $1)=no
   _LT_TAGVAR(hardcode_automatic, $1)=yes
   _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
-  if test "$lt_cv_ld_force_load" = "yes"; then
-    _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
-    m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes],
-                  [FC],  [_LT_TAGVAR(compiler_needs_object, $1)=yes])
-  else
-    _LT_TAGVAR(whole_archive_flag_spec, $1)=''
-  fi
+  _LT_TAGVAR(whole_archive_flag_spec, $1)=''
   _LT_TAGVAR(link_all_deplibs, $1)=yes
   _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
   case $cc_basename in
@@ -1115,7 +995,7 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES],
      *) _lt_dar_can_shared=$GCC ;;
   esac
   if test "$_lt_dar_can_shared" = "yes"; then
-    output_verbose_link_cmd=func_echo_all
+    output_verbose_link_cmd=echo
     _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
     _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
     _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
@@ -1131,141 +1011,202 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES],
   fi
 ])
 
-# _LT_SYS_MODULE_PATH_AIX([TAGNAME])
-# ----------------------------------
+# _LT_SYS_MODULE_PATH_AIX
+# -----------------------
 # Links a minimal program and checks the executable
 # for the system default hardcoded library path. In most cases,
 # this is /usr/lib:/lib, but when the MPI compilers are used
 # the location of the communication and MPI libs are included too.
 # If we don't find anything, use the default library path according
 # to the aix ld manual.
-# Store the results from the different compilers for each TAGNAME.
-# Allow to override them for all tags through lt_cv_aix_libpath.
 m4_defun([_LT_SYS_MODULE_PATH_AIX],
 [m4_require([_LT_DECL_SED])dnl
-if test "${lt_cv_aix_libpath+set}" = set; then
-  aix_libpath=$lt_cv_aix_libpath
-else
-  AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])],
-  [AC_LINK_IFELSE([AC_LANG_PROGRAM],[
-  lt_aix_libpath_sed='[
-      /Import File Strings/,/^$/ {
-	  /^0/ {
-	      s/^0  *\([^ ]*\) *$/\1/
-	      p
-	  }
-      }]'
-  _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-  # Check for a 64-bit object if we didn't find anything.
-  if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
-    _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-  fi],[])
-  if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
-    _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib"
-  fi
-  ])
-  aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])
-fi
+AC_LINK_IFELSE(AC_LANG_PROGRAM,[
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi],[])
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 ])# _LT_SYS_MODULE_PATH_AIX
 
 
 # _LT_SHELL_INIT(ARG)
 # -------------------
 m4_define([_LT_SHELL_INIT],
-[m4_divert_text([M4SH-INIT], [$1
-])])# _LT_SHELL_INIT
-
+[ifdef([AC_DIVERSION_NOTICE],
+	     [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)],
+	 [AC_DIVERT_PUSH(NOTICE)])
+$1
+AC_DIVERT_POP
+])# _LT_SHELL_INIT
 
 
 # _LT_PROG_ECHO_BACKSLASH
 # -----------------------
-# Find how we can fake an echo command that does not interpret backslash.
-# In particular, with Autoconf 2.60 or later we add some code to the start
-# of the generated configure script which will find a shell with a builtin
-# printf (which we can use as an echo command).
+# Add some code to the start of the generated configure script which
+# will find an echo command which doesn't interpret backslashes.
 m4_defun([_LT_PROG_ECHO_BACKSLASH],
-[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
-ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
-ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
-
-AC_MSG_CHECKING([how to print strings])
-# Test print first, because it will be a builtin if present.
-if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
-   test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
-  ECHO='print -r --'
-elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
-  ECHO='printf %s\n'
+[_LT_SHELL_INIT([
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+case X$lt_ECHO in
+X*--fallback-echo)
+  # Remove one level of quotation (which was required for Make).
+  ECHO=`echo "$lt_ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','`
+  ;;
+esac
+
+ECHO=${lt_ECHO-echo}
+if test "X[$]1" = X--no-reexec; then
+  # Discard the --no-reexec flag, and continue.
+  shift
+elif test "X[$]1" = X--fallback-echo; then
+  # Avoid inline document here, it may be left over
+  :
+elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then
+  # Yippee, $ECHO works!
+  :
 else
-  # Use this function as a fallback that always works.
-  func_fallback_echo ()
-  {
-    eval 'cat <<_LTECHO_EOF
-$[]1
-_LTECHO_EOF'
-  }
-  ECHO='func_fallback_echo'
+  # Restart under the correct shell.
+  exec $SHELL "[$]0" --no-reexec ${1+"[$]@"}
 fi
 
-# func_echo_all arg...
-# Invoke $ECHO with all args, space-separated.
-func_echo_all ()
-{
-    $ECHO "$*" 
-}
+if test "X[$]1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat <<_LT_EOF
+[$]*
+_LT_EOF
+  exit 0
+fi
 
-case "$ECHO" in
-  printf*) AC_MSG_RESULT([printf]) ;;
-  print*) AC_MSG_RESULT([print -r]) ;;
-  *) AC_MSG_RESULT([cat]) ;;
-esac
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
 
-m4_ifdef([_AS_DETECT_SUGGESTED],
-[_AS_DETECT_SUGGESTED([
-  test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || (
-    ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
-    ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
-    ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
-    PATH=/empty FPATH=/empty; export PATH FPATH
-    test "X`printf %s $ECHO`" = "X$ECHO" \
-      || test "X`print -r -- $ECHO`" = "X$ECHO" )])])
+if test -z "$lt_ECHO"; then
+  if test "X${echo_test_string+set}" != Xset; then
+    # find a string as large as possible, as long as the shell can cope with it
+    for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do
+      # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+      if { echo_test_string=`eval $cmd`; } 2>/dev/null &&
+	 { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null
+      then
+        break
+      fi
+    done
+  fi
 
-_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts])
-_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes])
-])# _LT_PROG_ECHO_BACKSLASH
+  if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
+     echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
+     test "X$echo_testing_string" = "X$echo_test_string"; then
+    :
+  else
+    # The Solaris, AIX, and Digital Unix default echo programs unquote
+    # backslashes.  This makes it impossible to quote backslashes using
+    #   echo "$something" | sed 's/\\/\\\\/g'
+    #
+    # So, first we look for a working echo in the user's PATH.
 
+    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+    for dir in $PATH /usr/ucb; do
+      IFS="$lt_save_ifs"
+      if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+         test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+         echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+         test "X$echo_testing_string" = "X$echo_test_string"; then
+        ECHO="$dir/echo"
+        break
+      fi
+    done
+    IFS="$lt_save_ifs"
 
-# _LT_WITH_SYSROOT
-# ----------------
-AC_DEFUN([_LT_WITH_SYSROOT],
-[AC_MSG_CHECKING([for sysroot])
-AC_ARG_WITH([sysroot],
-[  --with-sysroot[=DIR] Search for dependent libraries within DIR
-                        (or the compiler's sysroot if not specified).],
-[], [with_sysroot=no])
-
-dnl lt_sysroot will always be passed unquoted.  We quote it here
-dnl in case the user passed a directory name.
-lt_sysroot=
-case ${with_sysroot} in #(
- yes)
-   if test "$GCC" = yes; then
-     lt_sysroot=`$CC --print-sysroot 2>/dev/null`
-   fi
-   ;; #(
- /*)
-   lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
-   ;; #(
- no|'')
-   ;; #(
- *)
-   AC_MSG_RESULT([${with_sysroot}])
-   AC_MSG_ERROR([The sysroot must be an absolute path.])
-   ;;
-esac
+    if test "X$ECHO" = Xecho; then
+      # We didn't find a better echo, so look for alternatives.
+      if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' &&
+         echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` &&
+         test "X$echo_testing_string" = "X$echo_test_string"; then
+        # This shell has a builtin print -r that does the trick.
+        ECHO='print -r'
+      elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } &&
+	   test "X$CONFIG_SHELL" != X/bin/ksh; then
+        # If we have ksh, try running configure again with it.
+        ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+        export ORIGINAL_CONFIG_SHELL
+        CONFIG_SHELL=/bin/ksh
+        export CONFIG_SHELL
+        exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"}
+      else
+        # Try using printf.
+        ECHO='printf %s\n'
+        if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
+	   echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
+	   test "X$echo_testing_string" = "X$echo_test_string"; then
+	  # Cool, printf works
+	  :
+        elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+	     test "X$echo_testing_string" = 'X\t' &&
+	     echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	     test "X$echo_testing_string" = "X$echo_test_string"; then
+	  CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+	  export CONFIG_SHELL
+	  SHELL="$CONFIG_SHELL"
+	  export SHELL
+	  ECHO="$CONFIG_SHELL [$]0 --fallback-echo"
+        elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+	     test "X$echo_testing_string" = 'X\t' &&
+	     echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	     test "X$echo_testing_string" = "X$echo_test_string"; then
+	  ECHO="$CONFIG_SHELL [$]0 --fallback-echo"
+        else
+	  # maybe with a smaller string...
+	  prev=:
+
+	  for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do
+	    if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null
+	    then
+	      break
+	    fi
+	    prev="$cmd"
+	  done
+
+	  if test "$prev" != 'sed 50q "[$]0"'; then
+	    echo_test_string=`eval $prev`
+	    export echo_test_string
+	    exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"}
+	  else
+	    # Oops.  We lost completely, so just stick with echo.
+	    ECHO=echo
+	  fi
+        fi
+      fi
+    fi
+  fi
+fi
+
+# Copy echo and quote the copy suitably for passing to libtool from
+# the Makefile, instead of quoting the original, which is used later.
+lt_ECHO=$ECHO
+if test "X$lt_ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then
+   lt_ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo"
+fi
+
+AC_SUBST(lt_ECHO)
+])
+_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts])
+_LT_DECL([], [ECHO], [1],
+    [An echo program that does not interpret backslashes])
+])# _LT_PROG_ECHO_BACKSLASH
 
- AC_MSG_RESULT([${lt_sysroot:-no}])
-_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl
-[dependent libraries, and in which our libraries should be installed.])])
 
 # _LT_ENABLE_LOCK
 # ---------------
@@ -1295,7 +1236,7 @@ ia64-*-hpux*)
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext
+  echo '[#]line __oline__ "configure"' > conftest.$ac_ext
   if AC_TRY_EVAL(ac_compile); then
     if test "$lt_cv_prog_gnu_ld" = yes; then
       case `/usr/bin/file conftest.$ac_objext` in
@@ -1388,27 +1329,14 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
     CFLAGS="$SAVE_CFLAGS"
   fi
   ;;
-*-*solaris*)
+sparc*-*solaris*)
   # Find out which ABI we are using.
   echo 'int i;' > conftest.$ac_ext
   if AC_TRY_EVAL(ac_compile); then
     case `/usr/bin/file conftest.o` in
     *64-bit*)
       case $lt_cv_prog_gnu_ld in
-      yes*)
-        case $host in
-        i?86-*-solaris*)
-          LD="${LD-ld} -m elf_x86_64"
-          ;;
-        sparc*-*-solaris*)
-          LD="${LD-ld} -m elf64_sparc"
-          ;;
-        esac
-        # GNU ld 2.21 introduced _sol2 emulations.  Use them if available.
-        if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
-          LD="${LD-ld}_sol2"
-        fi
-        ;;
+      yes*) LD="${LD-ld} -m elf64_sparc" ;;
       *)
 	if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
 	  LD="${LD-ld} -64"
@@ -1426,47 +1354,14 @@ need_locks="$enable_libtool_lock"
 ])# _LT_ENABLE_LOCK
 
 
-# _LT_PROG_AR
-# -----------
-m4_defun([_LT_PROG_AR],
-[AC_CHECK_TOOLS(AR, [ar], false)
-: ${AR=ar}
-: ${AR_FLAGS=cru}
-_LT_DECL([], [AR], [1], [The archiver])
-_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive])
-
-AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file],
-  [lt_cv_ar_at_file=no
-   AC_COMPILE_IFELSE([AC_LANG_PROGRAM],
-     [echo conftest.$ac_objext > conftest.lst
-      lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD'
-      AC_TRY_EVAL([lt_ar_try])
-      if test "$ac_status" -eq 0; then
-	# Ensure the archiver fails upon bogus file names.
-	rm -f conftest.$ac_objext libconftest.a
-	AC_TRY_EVAL([lt_ar_try])
-	if test "$ac_status" -ne 0; then
-          lt_cv_ar_at_file=@
-        fi
-      fi
-      rm -f conftest.* libconftest.a
-     ])
-  ])
-
-if test "x$lt_cv_ar_at_file" = xno; then
-  archiver_list_spec=
-else
-  archiver_list_spec=$lt_cv_ar_at_file
-fi
-_LT_DECL([], [archiver_list_spec], [1],
-  [How to feed a file listing to the archiver])
-])# _LT_PROG_AR
-
-
 # _LT_CMD_OLD_ARCHIVE
 # -------------------
 m4_defun([_LT_CMD_OLD_ARCHIVE],
-[_LT_PROG_AR
+[AC_CHECK_TOOL(AR, ar, false)
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+_LT_DECL([], [AR], [1], [The archiver])
+_LT_DECL([], [AR_FLAGS], [1])
 
 AC_CHECK_TOOL(STRIP, strip, :)
 test -z "$STRIP" && STRIP=:
@@ -1485,27 +1380,18 @@ old_postuninstall_cmds=
 if test -n "$RANLIB"; then
   case $host_os in
   openbsd*)
-    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
     ;;
   *)
-    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
     ;;
   esac
-  old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib"
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
 fi
-
-case $host_os in
-  darwin*)
-    lock_old_archive_extraction=yes ;;
-  *)
-    lock_old_archive_extraction=no ;;
-esac
 _LT_DECL([], [old_postinstall_cmds], [2])
 _LT_DECL([], [old_postuninstall_cmds], [2])
 _LT_TAGDECL([], [old_archive_cmds], [2],
     [Commands used to build an old-style archive])
-_LT_DECL([], [lock_old_archive_extraction], [0],
-    [Whether to use a lock for old archive extraction])
 ])# _LT_CMD_OLD_ARCHIVE
 
 
@@ -1530,15 +1416,15 @@ AC_CACHE_CHECK([$1], [$2],
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&AS_MESSAGE_LOG_FD
-   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
-     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
      $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
      if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
        $2=yes
@@ -1578,7 +1464,7 @@ AC_CACHE_CHECK([$1], [$2],
      if test -s conftest.err; then
        # Append any errors to the config.log.
        cat conftest.err 1>&AS_MESSAGE_LOG_FD
-       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+       $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
        $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
        if diff conftest.exp conftest.er2 >/dev/null; then
          $2=yes
@@ -1641,11 +1527,6 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
     lt_cv_sys_max_cmd_len=8192;
     ;;
 
-  mint*)
-    # On MiNT this can take a long time and run out of memory.
-    lt_cv_sys_max_cmd_len=8192;
-    ;;
-
   amigaos*)
     # On AmigaOS with pdksh, this test takes hours, literally.
     # So we just punt and use a minimum line length of 8192.
@@ -1671,11 +1552,6 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
     lt_cv_sys_max_cmd_len=196608
     ;;
 
-  os2*)
-    # The test takes a long time on OS/2.
-    lt_cv_sys_max_cmd_len=8192
-    ;;
-
   osf*)
     # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
     # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
@@ -1715,8 +1591,8 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
       # If test is not a shell built-in, we'll probably end up computing a
       # maximum length that is only half of the actual maximum length, but
       # we can't tell.
-      while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \
-	         = "X$teststring$teststring"; } >/dev/null 2>&1 &&
+      while { test "X"`$SHELL [$]0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \
+	         = "XX$teststring$teststring"; } >/dev/null 2>&1 &&
 	      test $i != 17 # 1/2 MB should be enough
       do
         i=`expr $i + 1`
@@ -1767,7 +1643,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-[#line $LINENO "configure"
+[#line __oline__ "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -1808,13 +1684,7 @@ else
 #  endif
 #endif
 
-/* When -fvisbility=hidden is used, assume the code has been annotated
-   correspondingly for the symbols needed.  */
-#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
-int fnord () __attribute__((visibility("default")));
-#endif
-
-int fnord () { return 42; }
+void fnord() { int i=42;}
 int main ()
 {
   void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
@@ -1823,11 +1693,7 @@ int main ()
   if (self)
     {
       if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
-      else
-        {
-	  if (dlsym( self,"_fnord"))  status = $lt_dlneed_uscore;
-          else puts (dlerror ());
-	}
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
       /* dlclose (self); */
     }
   else
@@ -2003,16 +1869,16 @@ AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&AS_MESSAGE_LOG_FD
-   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
-     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
      $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
      if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
        _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
@@ -2171,7 +2037,6 @@ m4_require([_LT_DECL_EGREP])dnl
 m4_require([_LT_FILEUTILS_DEFAULTS])dnl
 m4_require([_LT_DECL_OBJDUMP])dnl
 m4_require([_LT_DECL_SED])dnl
-m4_require([_LT_CHECK_SHELL_FEATURES])dnl
 AC_MSG_CHECKING([dynamic linker characteristics])
 m4_if([$1],
 	[], [
@@ -2180,23 +2045,16 @@ if test "$GCC" = yes; then
     darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
     *) lt_awk_arg="/^libraries:/" ;;
   esac
-  case $host_os in
-    mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;;
-    *) lt_sed_strip_eq="s,=/,/,g" ;;
-  esac
-  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
-  case $lt_search_path_spec in
-  *\;*)
+  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+  if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then
     # if the path contains ";" then we assume it to be the separator
     # otherwise default to the standard path separator (i.e. ":") - it is
     # assumed that no part of a normal pathname contains ";" but that should
     # okay in the real world where ";" in dirpaths is itself problematic.
-    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
-    ;;
-  *)
-    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
-    ;;
-  esac
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'`
+  else
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+  fi
   # Ok, now we have the path, separated by spaces, we can step through it
   # and add multilib dir if necessary.
   lt_tmp_lt_search_path_spec=
@@ -2209,7 +2067,7 @@ if test "$GCC" = yes; then
 	lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
     fi
   done
-  lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
+  lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk '
 BEGIN {RS=" "; FS="/|\n";} {
   lt_foo="";
   lt_count=0;
@@ -2229,13 +2087,7 @@ BEGIN {RS=" "; FS="/|\n";} {
   if (lt_foo != "") { lt_freq[[lt_foo]]++; }
   if (lt_freq[[lt_foo]] == 1) { print lt_foo; }
 }'`
-  # AWK program above erroneously prepends '/' to C:/dos/paths
-  # for these hosts.
-  case $host_os in
-    mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
-      $SED 's,/\([[A-Za-z]]:\),\1,g'` ;;
-  esac
-  sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
+  sys_lib_search_path_spec=`$ECHO $lt_search_path_spec`
 else
   sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
 fi])
@@ -2261,7 +2113,7 @@ need_version=unknown
 
 case $host_os in
 aix3*)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
   shlibpath_var=LIBPATH
 
@@ -2270,7 +2122,7 @@ aix3*)
   ;;
 
 aix[[4-9]]*)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   need_lib_prefix=no
   need_version=no
   hardcode_into_libs=yes
@@ -2323,7 +2175,7 @@ amigaos*)
   m68k)
     library_names_spec='$libname.ixlibrary $libname.a'
     # Create ${libname}_ixlibrary.a entries in /sys/libs.
-    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
     ;;
   esac
   ;;
@@ -2335,7 +2187,7 @@ beos*)
   ;;
 
 bsdi[[45]]*)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
@@ -2354,9 +2206,8 @@ cygwin* | mingw* | pw32* | cegcc*)
   need_version=no
   need_lib_prefix=no
 
-  case $GCC,$cc_basename in
-  yes,*)
-    # gcc
+  case $GCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
     postinstall_cmds='base_file=`basename \${file}`~
@@ -2377,83 +2228,36 @@ cygwin* | mingw* | pw32* | cegcc*)
     cygwin*)
       # Cygwin DLLs use 'cyg' prefix rather than 'lib'
       soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
-m4_if([$1], [],[
-      sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"])
+      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
       ;;
     mingw* | cegcc*)
       # MinGW DLLs use traditional 'lib' prefix
       soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
-      ;;
-    pw32*)
-      # pw32 DLLs use 'pw' prefix rather than 'lib'
-      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
-      ;;
-    esac
-    dynamic_linker='Win32 ld.exe'
-    ;;
-
-  *,cl*)
-    # Native MSVC
-    libname_spec='$name'
-    soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
-    library_names_spec='${libname}.dll.lib'
-
-    case $build_os in
-    mingw*)
-      sys_lib_search_path_spec=
-      lt_save_ifs=$IFS
-      IFS=';'
-      for lt_path in $LIB
-      do
-        IFS=$lt_save_ifs
-        # Let DOS variable expansion print the short 8.3 style file name.
-        lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
-        sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
-      done
-      IFS=$lt_save_ifs
-      # Convert to MSYS style.
-      sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'`
-      ;;
-    cygwin*)
-      # Convert to unix form, then to dos form, then back to unix form
-      # but this time dos style (no spaces!) so that the unix form looks
-      # like /cygdrive/c/PROGRA~1:/cygdr...
-      sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
-      sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
-      sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
-      ;;
-    *)
-      sys_lib_search_path_spec="$LIB"
+      sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
       if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then
-        # It is most probably a Windows format PATH.
+        # It is most probably a Windows format PATH printed by
+        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+        # path with ; separators, and with drive letters. We can handle the
+        # drive letters (cygwin fileutils understands them), so leave them,
+        # especially as we might pass files found there to a mingw objdump,
+        # which wouldn't understand a cygwinified path. Ahh.
         sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
       else
-        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
       fi
-      # FIXME: find the short name or the path components, as spaces are
-      # common. (e.g. "Program Files" -> "PROGRA~1")
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
       ;;
     esac
-
-    # DLL is installed to $(libdir)/../bin by postinstall_cmds
-    postinstall_cmds='base_file=`basename \${file}`~
-      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
-      dldir=$destdir/`dirname \$dlpath`~
-      test -d \$dldir || mkdir -p \$dldir~
-      $install_prog $dir/$dlname \$dldir/$dlname'
-    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
-      dlpath=$dir/\$dldll~
-       $RM \$dlpath'
-    shlibpath_overrides_runpath=yes
-    dynamic_linker='Win32 link.exe'
     ;;
 
   *)
-    # Assume MSVC wrapper
     library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
-    dynamic_linker='Win32 ld.exe'
     ;;
   esac
+  dynamic_linker='Win32 ld.exe'
   # FIXME: first we should search . and the directory the executable is in
   shlibpath_var=PATH
   ;;
@@ -2474,7 +2278,7 @@ m4_if([$1], [],[
   ;;
 
 dgux*)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
@@ -2482,6 +2286,10 @@ dgux*)
   shlibpath_var=LD_LIBRARY_PATH
   ;;
 
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
 freebsd* | dragonfly*)
   # DragonFly does not have aout.  When/if they implement a new
   # versioning mechanism, adjust this.
@@ -2489,7 +2297,7 @@ freebsd* | dragonfly*)
     objformat=`/usr/bin/objformat`
   else
     case $host_os in
-    freebsd[[23]].*) objformat=aout ;;
+    freebsd[[123]]*) objformat=aout ;;
     *) objformat=elf ;;
     esac
   fi
@@ -2507,7 +2315,7 @@ freebsd* | dragonfly*)
   esac
   shlibpath_var=LD_LIBRARY_PATH
   case $host_os in
-  freebsd2.*)
+  freebsd2*)
     shlibpath_overrides_runpath=yes
     ;;
   freebsd3.[[01]]* | freebsdelf3.[[01]]*)
@@ -2527,26 +2335,12 @@ freebsd* | dragonfly*)
   ;;
 
 gnu*)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  ;;
-
-haiku*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  need_lib_prefix=no
-  need_version=no
-  dynamic_linker="$host_os runtime_loader"
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
   hardcode_into_libs=yes
   ;;
 
@@ -2592,14 +2386,12 @@ hpux9* | hpux10* | hpux11*)
     soname_spec='${libname}${release}${shared_ext}$major'
     ;;
   esac
-  # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
   postinstall_cmds='chmod 555 $lib'
-  # or fails outright, so override atomically:
-  install_override_mode=555
   ;;
 
 interix[[3-9]]*)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
@@ -2615,7 +2407,7 @@ irix5* | irix6* | nonstopux*)
     nonstopux*) version_type=nonstopux ;;
     *)
 	if test "$lt_cv_prog_gnu_ld" = yes; then
-		version_type=linux # correct to gnu/linux during the next big refactor
+		version_type=linux
 	else
 		version_type=irix
 	fi ;;
@@ -2652,9 +2444,9 @@ linux*oldld* | linux*aout* | linux*coff*)
   dynamic_linker=no
   ;;
 
-# This must be glibc/ELF.
+# This must be Linux ELF.
 linux* | k*bsd*-gnu | kopensolaris*-gnu)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -2662,21 +2454,16 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu)
   finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=no
-
   # Some binutils ld are patched to set DT_RUNPATH
-  AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath],
-    [lt_cv_shlibpath_overrides_runpath=no
-    save_LDFLAGS=$LDFLAGS
-    save_libdir=$libdir
-    eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \
-	 LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\""
-    AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
-      [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null],
-	 [lt_cv_shlibpath_overrides_runpath=yes])])
-    LDFLAGS=$save_LDFLAGS
-    libdir=$save_libdir
-    ])
-  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
+  save_LDFLAGS=$LDFLAGS
+  save_libdir=$libdir
+  eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \
+       LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\""
+  AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
+    [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null],
+       [shlibpath_overrides_runpath=yes])])
+  LDFLAGS=$save_LDFLAGS
+  libdir=$save_libdir
 
   # This implies no fast_install, which is unacceptable.
   # Some rework will be needed to allow for fast_install
@@ -2685,7 +2472,7 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu)
 
   # Append ld.so.conf contents to the search path
   if test -f /etc/ld.so.conf; then
-    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
     sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
   fi
 
@@ -2729,7 +2516,7 @@ netbsd*)
   ;;
 
 newsos6)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=yes
@@ -2798,7 +2585,7 @@ rdos*)
   ;;
 
 solaris*)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -2823,7 +2610,7 @@ sunos4*)
   ;;
 
 sysv4 | sysv4.3*)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
@@ -2847,7 +2634,7 @@ sysv4 | sysv4.3*)
 
 sysv4*MP*)
   if test -d /usr/nec ;then
-    version_type=linux # correct to gnu/linux during the next big refactor
+    version_type=linux
     library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
     soname_spec='$libname${shared_ext}.$major'
     shlibpath_var=LD_LIBRARY_PATH
@@ -2878,7 +2665,7 @@ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
 
 tpf*)
   # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -2888,7 +2675,7 @@ tpf*)
   ;;
 
 uts4*)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
@@ -2930,8 +2717,6 @@ _LT_DECL([], [library_names_spec], [1],
     The last name is the one that the linker finds with -lNAME]])
 _LT_DECL([], [soname_spec], [1],
     [[The coded name of the library, if different from the real name]])
-_LT_DECL([], [install_override_mode], [1],
-    [Permission mode override for installation of shared libraries])
 _LT_DECL([], [postinstall_cmds], [2],
     [Command to use after installation of a shared archive])
 _LT_DECL([], [postuninstall_cmds], [2],
@@ -3044,7 +2829,6 @@ AC_REQUIRE([AC_CANONICAL_HOST])dnl
 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
 m4_require([_LT_DECL_SED])dnl
 m4_require([_LT_DECL_EGREP])dnl
-m4_require([_LT_PROG_ECHO_BACKSLASH])dnl
 
 AC_ARG_WITH([gnu-ld],
     [AS_HELP_STRING([--with-gnu-ld],
@@ -3166,11 +2950,6 @@ case $reload_flag in
 esac
 reload_cmds='$LD$reload_flag -o $output$reload_objs'
 case $host_os in
-  cygwin* | mingw* | pw32* | cegcc*)
-    if test "$GCC" != yes; then
-      reload_cmds=false
-    fi
-    ;;
   darwin*)
     if test "$GCC" = yes; then
       reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
@@ -3179,8 +2958,8 @@ case $host_os in
     fi
     ;;
 esac
-_LT_TAGDECL([], [reload_flag], [1], [How to create reloadable object files])dnl
-_LT_TAGDECL([], [reload_cmds], [2])dnl
+_LT_DECL([], [reload_flag], [1], [How to create reloadable object files])dnl
+_LT_DECL([], [reload_cmds], [2])dnl
 ])# _LT_CMD_RELOAD
 
 
@@ -3232,18 +3011,16 @@ mingw* | pw32*)
   # Base MSYS/MinGW do not provide the 'file' command needed by
   # func_win32_libid shell function, so use a weaker test based on 'objdump',
   # unless we find 'file', for example because we are cross-compiling.
-  # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
-  if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
+  if ( file / ) >/dev/null 2>&1; then
     lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
     lt_cv_file_magic_cmd='func_win32_libid'
   else
-    # Keep this pattern in sync with the one in func_win32_libid.
-    lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
+    lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
     lt_cv_file_magic_cmd='$OBJDUMP -f'
   fi
   ;;
 
-cegcc*)
+cegcc)
   # use the weaker test based on 'objdump'. See mingw*.
   lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
   lt_cv_file_magic_cmd='$OBJDUMP -f'
@@ -3273,10 +3050,6 @@ gnu*)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
-haiku*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
 hpux10.20* | hpux11*)
   lt_cv_file_magic_cmd=/usr/bin/file
   case $host_cpu in
@@ -3285,11 +3058,11 @@ hpux10.20* | hpux11*)
     lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
     ;;
   hppa*64*)
-    [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]']
+    [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]']
     lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
     ;;
   *)
-    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library'
+    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library'
     lt_cv_file_magic_test_file=/usr/lib/libc.sl
     ;;
   esac
@@ -3310,7 +3083,7 @@ irix5* | irix6* | nonstopux*)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
-# This must be glibc/ELF.
+# This must be Linux ELF.
 linux* | k*bsd*-gnu | kopensolaris*-gnu)
   lt_cv_deplibs_check_method=pass_all
   ;;
@@ -3389,21 +3162,6 @@ tpf*)
   ;;
 esac
 ])
-
-file_magic_glob=
-want_nocaseglob=no
-if test "$build" = "$host"; then
-  case $host_os in
-  mingw* | pw32*)
-    if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
-      want_nocaseglob=yes
-    else
-      file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"`
-    fi
-    ;;
-  esac
-fi
-
 file_magic_cmd=$lt_cv_file_magic_cmd
 deplibs_check_method=$lt_cv_deplibs_check_method
 test -z "$deplibs_check_method" && deplibs_check_method=unknown
@@ -3411,11 +3169,7 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown
 _LT_DECL([], [deplibs_check_method], [1],
     [Method to check whether dependent libraries are shared objects])
 _LT_DECL([], [file_magic_cmd], [1],
-    [Command to use when deplibs_check_method = "file_magic"])
-_LT_DECL([], [file_magic_glob], [1],
-    [How to find potential files when deplibs_check_method = "file_magic"])
-_LT_DECL([], [want_nocaseglob], [1],
-    [Find potential files using nocaseglob when deplibs_check_method = "file_magic"])
+    [Command to use when deplibs_check_method == "file_magic"])
 ])# _LT_CHECK_MAGIC_METHOD
 
 
@@ -3472,19 +3226,7 @@ if test "$lt_cv_path_NM" != "no"; then
   NM="$lt_cv_path_NM"
 else
   # Didn't find any BSD compatible name lister, look for dumpbin.
-  if test -n "$DUMPBIN"; then :
-    # Let the user override the test.
-  else
-    AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :)
-    case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
-    *COFF*)
-      DUMPBIN="$DUMPBIN -symbols"
-      ;;
-    *)
-      DUMPBIN=:
-      ;;
-    esac
-  fi
+  AC_CHECK_TOOLS(DUMPBIN, ["dumpbin -symbols" "link -dump -symbols"], :)
   AC_SUBST([DUMPBIN])
   if test "$DUMPBIN" != ":"; then
     NM="$DUMPBIN"
@@ -3497,13 +3239,13 @@ _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl
 AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface],
   [lt_cv_nm_interface="BSD nm"
   echo "int some_variable = 0;" > conftest.$ac_ext
-  (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
+  (eval echo "\"\$as_me:__oline__: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
   (eval "$ac_compile" 2>conftest.err)
   cat conftest.err >&AS_MESSAGE_LOG_FD
-  (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD)
+  (eval echo "\"\$as_me:__oline__: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD)
   (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
   cat conftest.err >&AS_MESSAGE_LOG_FD
-  (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD)
+  (eval echo "\"\$as_me:__oline__: output\"" >&AS_MESSAGE_LOG_FD)
   cat conftest.out >&AS_MESSAGE_LOG_FD
   if $GREP 'External.*some_variable' conftest.out > /dev/null; then
     lt_cv_nm_interface="MS dumpbin"
@@ -3518,67 +3260,6 @@ dnl aclocal-1.4 backwards compatibility:
 dnl AC_DEFUN([AM_PROG_NM], [])
 dnl AC_DEFUN([AC_PROG_NM], [])
 
-# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
-# --------------------------------
-# how to determine the name of the shared library
-# associated with a specific link library.
-#  -- PORTME fill in with the dynamic library characteristics
-m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB],
-[m4_require([_LT_DECL_EGREP])
-m4_require([_LT_DECL_OBJDUMP])
-m4_require([_LT_DECL_DLLTOOL])
-AC_CACHE_CHECK([how to associate runtime and link libraries],
-lt_cv_sharedlib_from_linklib_cmd,
-[lt_cv_sharedlib_from_linklib_cmd='unknown'
-
-case $host_os in
-cygwin* | mingw* | pw32* | cegcc*)
-  # two different shell functions defined in ltmain.sh
-  # decide which to use based on capabilities of $DLLTOOL
-  case `$DLLTOOL --help 2>&1` in
-  *--identify-strict*)
-    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
-    ;;
-  *)
-    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
-    ;;
-  esac
-  ;;
-*)
-  # fallback: assume linklib IS sharedlib
-  lt_cv_sharedlib_from_linklib_cmd="$ECHO"
-  ;;
-esac
-])
-sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
-test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
-
-_LT_DECL([], [sharedlib_from_linklib_cmd], [1],
-    [Command to associate shared and link libraries])
-])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
-
-
-# _LT_PATH_MANIFEST_TOOL
-# ----------------------
-# locate the manifest tool
-m4_defun([_LT_PATH_MANIFEST_TOOL],
-[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :)
-test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
-AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool],
-  [lt_cv_path_mainfest_tool=no
-  echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD
-  $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
-  cat conftest.err >&AS_MESSAGE_LOG_FD
-  if $GREP 'Manifest Tool' conftest.out > /dev/null; then
-    lt_cv_path_mainfest_tool=yes
-  fi
-  rm -f conftest*])
-if test "x$lt_cv_path_mainfest_tool" != xyes; then
-  MANIFEST_TOOL=:
-fi
-_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl
-])# _LT_PATH_MANIFEST_TOOL
-
 
 # LT_LIB_M
 # --------
@@ -3587,7 +3268,7 @@ AC_DEFUN([LT_LIB_M],
 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
 LIBM=
 case $host in
-*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*)
+*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*)
   # These system don't have libm, or don't need it
   ;;
 *-ncr-sysv4.3*)
@@ -3615,12 +3296,7 @@ m4_defun([_LT_COMPILER_NO_RTTI],
 _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
 
 if test "$GCC" = yes; then
-  case $cc_basename in
-  nvcc*)
-    _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;;
-  *)
-    _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;;
-  esac
+  _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
 
   _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
     lt_cv_prog_compiler_rtti_exceptions,
@@ -3637,7 +3313,6 @@ _LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1],
 m4_defun([_LT_CMD_GLOBAL_SYMBOLS],
 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
 AC_REQUIRE([AC_PROG_CC])dnl
-AC_REQUIRE([AC_PROG_AWK])dnl
 AC_REQUIRE([LT_PATH_NM])dnl
 AC_REQUIRE([LT_PATH_LD])dnl
 m4_require([_LT_DECL_SED])dnl
@@ -3705,8 +3380,8 @@ esac
 lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
 
 # Transform an extracted symbol line into symbol name and symbol address
-lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p'"
-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
 
 # Handle CRLF in mingw tool chain
 opt_cr=
@@ -3730,7 +3405,6 @@ for ac_symprfx in "" "_"; do
     # which start with @ or ?.
     lt_cv_sys_global_symbol_pipe="$AWK ['"\
 "     {last_section=section; section=\$ 3};"\
-"     /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
 "     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
 "     \$ 0!~/External *\|/{next};"\
 "     / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
@@ -3743,7 +3417,6 @@ for ac_symprfx in "" "_"; do
   else
     lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[	 ]]\($symcode$symcode*\)[[	 ]][[	 ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
   fi
-  lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
 
   # Check to see that the pipe works correctly.
   pipe_works=no
@@ -3765,7 +3438,7 @@ _LT_EOF
   if AC_TRY_EVAL(ac_compile); then
     # Now try to grab the symbols.
     nlist=conftest.nm
-    if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then
+    if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then
       # Try sorting and uniquifying the output.
       if sort "$nlist" | uniq > "$nlist"T; then
 	mv -f "$nlist"T "$nlist"
@@ -3777,18 +3450,6 @@ _LT_EOF
       if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
 	if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
 	  cat <<_LT_EOF > conftest.$ac_ext
-/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
-#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
-/* DATA imports from DLLs on WIN32 con't be const, because runtime
-   relocations are performed -- see ld's documentation on pseudo-relocs.  */
-# define LT@&t at _DLSYM_CONST
-#elif defined(__osf__)
-/* This system does not cope well with relocations in const data.  */
-# define LT@&t at _DLSYM_CONST
-#else
-# define LT@&t at _DLSYM_CONST const
-#endif
-
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -3800,7 +3461,7 @@ _LT_EOF
 	  cat <<_LT_EOF >> conftest.$ac_ext
 
 /* The mapping between symbol names and symbols.  */
-LT@&t at _DLSYM_CONST struct {
+const struct {
   const char *name;
   void       *address;
 }
@@ -3826,15 +3487,15 @@ static const void *lt_preloaded_setup() {
 _LT_EOF
 	  # Now try linking the two files.
 	  mv conftest.$ac_objext conftstm.$ac_objext
-	  lt_globsym_save_LIBS=$LIBS
-	  lt_globsym_save_CFLAGS=$CFLAGS
+	  lt_save_LIBS="$LIBS"
+	  lt_save_CFLAGS="$CFLAGS"
 	  LIBS="conftstm.$ac_objext"
 	  CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
 	  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
 	    pipe_works=yes
 	  fi
-	  LIBS=$lt_globsym_save_LIBS
-	  CFLAGS=$lt_globsym_save_CFLAGS
+	  LIBS="$lt_save_LIBS"
+	  CFLAGS="$lt_save_CFLAGS"
 	else
 	  echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD
 	fi
@@ -3867,13 +3528,6 @@ else
   AC_MSG_RESULT(ok)
 fi
 
-# Response file support.
-if test "$lt_cv_nm_interface" = "MS dumpbin"; then
-  nm_file_list_spec='@'
-elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then
-  nm_file_list_spec='@'
-fi
-
 _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1],
     [Take the output of nm and produce a listing of raw symbols and C names])
 _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1],
@@ -3884,8 +3538,6 @@ _LT_DECL([global_symbol_to_c_name_address],
 _LT_DECL([global_symbol_to_c_name_address_lib_prefix],
     [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1],
     [Transform the output of nm in a C name address pair when lib prefix is needed])
-_LT_DECL([], [nm_file_list_spec], [1],
-    [Specify filename containing input files for $NM])
 ]) # _LT_CMD_GLOBAL_SYMBOLS
 
 
@@ -3897,6 +3549,7 @@ _LT_TAGVAR(lt_prog_compiler_wl, $1)=
 _LT_TAGVAR(lt_prog_compiler_pic, $1)=
 _LT_TAGVAR(lt_prog_compiler_static, $1)=
 
+AC_MSG_CHECKING([for $compiler option to produce PIC])
 m4_if([$1], [CXX], [
   # C++ specific cases for pic, static, wl, etc.
   if test "$GXX" = yes; then
@@ -3947,11 +3600,6 @@ m4_if([$1], [CXX], [
       # DJGPP does not support shared libraries at all
       _LT_TAGVAR(lt_prog_compiler_pic, $1)=
       ;;
-    haiku*)
-      # PIC is the default for Haiku.
-      # The "-static" flag exists, but is broken.
-      _LT_TAGVAR(lt_prog_compiler_static, $1)=
-      ;;
     interix[[3-9]]*)
       # Interix 3.x gcc -fpic/-fPIC options generate broken code.
       # Instead, we relocate shared libraries at runtime.
@@ -4001,12 +3649,6 @@ m4_if([$1], [CXX], [
 	  ;;
 	esac
 	;;
-      mingw* | cygwin* | os2* | pw32* | cegcc*)
-	# This hack is so that the source file can tell whether it is being
-	# built for inclusion in a dll (and should export symbols for example).
-	m4_if([$1], [GCJ], [],
-	  [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
-	;;
       dgux*)
 	case $cc_basename in
 	  ec++*)
@@ -4096,8 +3738,8 @@ m4_if([$1], [CXX], [
 	    _LT_TAGVAR(lt_prog_compiler_pic, $1)=
 	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
 	    ;;
-	  xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*)
-	    # IBM XL 8.0, 9.0 on PPC and BlueGene
+	  xlc* | xlC*)
+	    # IBM XL 8.0 on PPC
 	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
 	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
 	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
@@ -4159,7 +3801,7 @@ m4_if([$1], [CXX], [
 	;;
       solaris*)
 	case $cc_basename in
-	  CC* | sunCC*)
+	  CC*)
 	    # Sun C++ 4.2, 5.x and Centerline C++
 	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
 	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
@@ -4263,12 +3905,6 @@ m4_if([$1], [CXX], [
       _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
       ;;
 
-    haiku*)
-      # PIC is the default for Haiku.
-      # The "-static" flag exists, but is broken.
-      _LT_TAGVAR(lt_prog_compiler_static, $1)=
-      ;;
-
     hpux*)
       # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
       # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
@@ -4311,15 +3947,6 @@ m4_if([$1], [CXX], [
       _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
       ;;
     esac
-
-    case $cc_basename in
-    nvcc*) # Cuda Compiler Driver 2.2
-      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker '
-      if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
-        _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)"
-      fi
-      ;;
-    esac
   else
     # PORTME Check for flag to pass linker flags through the system compiler.
     case $host_os in
@@ -4383,13 +4010,7 @@ m4_if([$1], [CXX], [
 	_LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared'
 	_LT_TAGVAR(lt_prog_compiler_static, $1)='--static'
 	;;
-      nagfor*)
-	# NAG Fortran compiler
-	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,'
-	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
-	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	;;
-      pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
+      pgcc* | pgf77* | pgf90* | pgf95*)
         # Portland Group compilers (*not* the Pentium gcc compiler,
 	# which looks to be a dead project)
 	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
@@ -4401,40 +4022,25 @@ m4_if([$1], [CXX], [
         # All Alpha code is PIC.
         _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
         ;;
-      xl* | bgxl* | bgf* | mpixl*)
-	# IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
+      xl*)
+	# IBM XL C 8.0/Fortran 10.1 on PPC
 	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
 	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
 	_LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
 	;;
       *)
 	case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*)
-	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
-	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	  _LT_TAGVAR(lt_prog_compiler_wl, $1)=''
-	  ;;
-	*Sun\ F* | *Sun*Fortran*)
-	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
-	  ;;
 	*Sun\ C*)
 	  # Sun C 5.9
 	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
 	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
 	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
 	  ;;
-        *Intel*\ [[CF]]*Compiler*)
-	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
-	  ;;
-	*Portland\ Group*)
-	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+	*Sun\ F*)
+	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
+	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
 	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	  _LT_TAGVAR(lt_prog_compiler_wl, $1)=''
 	  ;;
 	esac
 	;;
@@ -4466,7 +4072,7 @@ m4_if([$1], [CXX], [
       _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
       _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
       case $cc_basename in
-      f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
+      f77* | f90* | f95*)
 	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
       *)
 	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
@@ -4523,11 +4129,9 @@ case $host_os in
     _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t at m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])"
     ;;
 esac
-
-AC_CACHE_CHECK([for $compiler option to produce PIC],
-  [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)],
-  [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)])
-_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)
+AC_MSG_RESULT([$_LT_TAGVAR(lt_prog_compiler_pic, $1)])
+_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1],
+	[How to pass a linker flag through the compiler])
 
 #
 # Check to make sure the PIC flag actually works.
@@ -4546,8 +4150,6 @@ fi
 _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1],
 	[Additional compiler flags for building library objects])
 
-_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1],
-	[How to pass a linker flag through the compiler])
 #
 # Check to make sure the static flag actually works.
 #
@@ -4568,7 +4170,6 @@ _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1],
 m4_defun([_LT_LINKER_SHLIBS],
 [AC_REQUIRE([LT_PATH_LD])dnl
 AC_REQUIRE([LT_PATH_NM])dnl
-m4_require([_LT_PATH_MANIFEST_TOOL])dnl
 m4_require([_LT_FILEUTILS_DEFAULTS])dnl
 m4_require([_LT_DECL_EGREP])dnl
 m4_require([_LT_DECL_SED])dnl
@@ -4577,40 +4178,30 @@ m4_require([_LT_TAG_COMPILER])dnl
 AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
 m4_if([$1], [CXX], [
   _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
-  _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
   case $host_os in
   aix[[4-9]]*)
     # If we're using GNU nm, then we don't want the "-C" option.
     # -C means demangle to AIX nm, but means don't demangle with GNU nm
-    # Also, AIX nm treats weak defined symbols like other global defined
-    # symbols, whereas GNU nm marks them as "W".
     if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
-      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
     else
       _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
     fi
     ;;
   pw32*)
     _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
-    ;;
+  ;;
   cygwin* | mingw* | cegcc*)
-    case $cc_basename in
-    cl*)
-      _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
-      ;;
-    *)
-      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
-      _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
-      ;;
-    esac
-    ;;
-  linux* | k*bsd*-gnu | gnu*)
+    _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
+  ;;
+  linux* | k*bsd*-gnu)
     _LT_TAGVAR(link_all_deplibs, $1)=no
-    ;;
+  ;;
   *)
     _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
-    ;;
+  ;;
   esac
+  _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
 ], [
   runpath_var=
   _LT_TAGVAR(allow_undefined_flag, $1)=
@@ -4625,6 +4216,7 @@ m4_if([$1], [CXX], [
   _LT_TAGVAR(hardcode_direct, $1)=no
   _LT_TAGVAR(hardcode_direct_absolute, $1)=no
   _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+  _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
   _LT_TAGVAR(hardcode_libdir_separator, $1)=
   _LT_TAGVAR(hardcode_minus_L, $1)=no
   _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
@@ -4669,39 +4261,13 @@ dnl Note also adjust exclude_expsyms for C++ above.
   openbsd*)
     with_gnu_ld=no
     ;;
-  linux* | k*bsd*-gnu | gnu*)
+  linux* | k*bsd*-gnu)
     _LT_TAGVAR(link_all_deplibs, $1)=no
     ;;
   esac
 
   _LT_TAGVAR(ld_shlibs, $1)=yes
-
-  # On some targets, GNU ld is compatible enough with the native linker
-  # that we're better off using the native interface for both.
-  lt_use_gnu_ld_interface=no
   if test "$with_gnu_ld" = yes; then
-    case $host_os in
-      aix*)
-	# The AIX port of GNU ld has always aspired to compatibility
-	# with the native linker.  However, as the warning in the GNU ld
-	# block says, versions before 2.19.5* couldn't really create working
-	# shared libraries, regardless of the interface used.
-	case `$LD -v 2>&1` in
-	  *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
-	  *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;;
-	  *\ \(GNU\ Binutils\)\ [[3-9]]*) ;;
-	  *)
-	    lt_use_gnu_ld_interface=yes
-	    ;;
-	esac
-	;;
-      *)
-	lt_use_gnu_ld_interface=yes
-	;;
-    esac
-  fi
-
-  if test "$lt_use_gnu_ld_interface" = yes; then
     # If archive_cmds runs LD, not CC, wlarc should be empty
     wlarc='${wl}'
 
@@ -4735,12 +4301,11 @@ dnl Note also adjust exclude_expsyms for C++ above.
 	_LT_TAGVAR(ld_shlibs, $1)=no
 	cat <<_LT_EOF 1>&2
 
-*** Warning: the GNU linker, at least up to release 2.19, is reported
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
 *** to be unable to reliably create shared libraries on AIX.
 *** Therefore, libtool is disabling shared libraries support.  If you
-*** really care for shared libraries, you may want to install binutils
-*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
-*** You will then need to restart the configuration process.
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
 
 _LT_EOF
       fi
@@ -4776,12 +4341,10 @@ _LT_EOF
       # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
       # as there is no search path for DLLs.
       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
       _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
       _LT_TAGVAR(always_export_symbols, $1)=no
       _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
-      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
-      _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
 
       if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
         _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
@@ -4799,11 +4362,6 @@ _LT_EOF
       fi
       ;;
 
-    haiku*)
-      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-      _LT_TAGVAR(link_all_deplibs, $1)=yes
-      ;;
-
     interix[[3-9]]*)
       _LT_TAGVAR(hardcode_direct, $1)=no
       _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
@@ -4829,16 +4387,15 @@ _LT_EOF
       if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
 	 && test "$tmp_diet" = no
       then
-	tmp_addflag=' $pic_flag'
+	tmp_addflag=
 	tmp_sharedflag='-shared'
 	case $cc_basename,$host_cpu in
         pgcc*)				# Portland Group C compiler
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
 	  tmp_addflag=' $pic_flag'
 	  ;;
-	pgf77* | pgf90* | pgf95* | pgfortran*)
-					# Portland Group f77 and f90 compilers
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	pgf77* | pgf90* | pgf95*)	# Portland Group f77 and f90 compilers
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
 	  tmp_addflag=' $pic_flag -Mnomain' ;;
 	ecc*,ia64* | icc*,ia64*)	# Intel C compiler on ia64
 	  tmp_addflag=' -i_dynamic' ;;
@@ -4849,17 +4406,13 @@ _LT_EOF
 	lf95*)				# Lahey Fortran 8.1
 	  _LT_TAGVAR(whole_archive_flag_spec, $1)=
 	  tmp_sharedflag='--shared' ;;
-	xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below)
+	xl[[cC]]*)			# IBM XL C 8.0 on PPC (deal with xlf below)
 	  tmp_sharedflag='-qmkshrobj'
 	  tmp_addflag= ;;
-	nvcc*)	# Cuda Compiler Driver 2.2
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
-	  _LT_TAGVAR(compiler_needs_object, $1)=yes
-	  ;;
 	esac
 	case `$CC -V 2>&1 | sed 5q` in
 	*Sun\ C*)			# Sun C 5.9
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
 	  _LT_TAGVAR(compiler_needs_object, $1)=yes
 	  tmp_sharedflag='-G' ;;
 	*Sun\ F*)			# Sun Fortran 8.3
@@ -4875,16 +4428,17 @@ _LT_EOF
         fi
 
 	case $cc_basename in
-	xlf* | bgf* | bgxlf* | mpixlf*)
+	xlf*)
 	  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
 	  _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive'
-	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-	  _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+	  _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir'
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib'
 	  if test "x$supports_anon_versioning" = xyes; then
 	    _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
 	      cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
 	      echo "local: *; };" >> $output_objdir/$libname.ver~
-	      $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+	      $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
 	  fi
 	  ;;
 	esac
@@ -4898,8 +4452,8 @@ _LT_EOF
 	_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
 	wlarc=
       else
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
       fi
       ;;
 
@@ -4917,8 +4471,8 @@ _LT_EOF
 
 _LT_EOF
       elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
       else
 	_LT_TAGVAR(ld_shlibs, $1)=no
       fi
@@ -4964,8 +4518,8 @@ _LT_EOF
 
     *)
       if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
       else
 	_LT_TAGVAR(ld_shlibs, $1)=no
       fi
@@ -5005,10 +4559,8 @@ _LT_EOF
       else
 	# If we're using GNU nm, then we don't want the "-C" option.
 	# -C means demangle to AIX nm, but means don't demangle with GNU nm
-	# Also, AIX nm treats weak defined symbols like other global
-	# defined symbols, whereas GNU nm marks them as "W".
 	if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
-	  _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	  _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
 	else
 	  _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
 	fi
@@ -5096,9 +4648,9 @@ _LT_EOF
 	_LT_TAGVAR(allow_undefined_flag, $1)='-berok'
         # Determine the default libpath from the value encoded in an
         # empty executable.
-        _LT_SYS_MODULE_PATH_AIX([$1])
+        _LT_SYS_MODULE_PATH_AIX
         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
-        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
       else
 	if test "$host_cpu" = ia64; then
 	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
@@ -5107,19 +4659,14 @@ _LT_EOF
 	else
 	 # Determine the default libpath from the value encoded in an
 	 # empty executable.
-	 _LT_SYS_MODULE_PATH_AIX([$1])
+	 _LT_SYS_MODULE_PATH_AIX
 	 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
 	  # Warning - without using the other run time loading flags,
 	  # -berok will link without error, but may produce a broken library.
 	  _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
 	  _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
-	  if test "$with_gnu_ld" = yes; then
-	    # We only use this code for GNU lds that support --whole-archive.
-	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
-	  else
-	    # Exported symbols can be pulled into shared objects from archives
-	    _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
-	  fi
+	  # Exported symbols can be pulled into shared objects from archives
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
 	  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
 	  # This is similar to how AIX traditionally builds its shared libraries.
 	  _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
@@ -5151,64 +4698,20 @@ _LT_EOF
       # Microsoft Visual C++.
       # hardcode_libdir_flag_spec is actually meaningless, as there is
       # no search path for DLLs.
-      case $cc_basename in
-      cl*)
-	# Native MSVC
-	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
-	_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-	_LT_TAGVAR(always_export_symbols, $1)=yes
-	_LT_TAGVAR(file_list_spec, $1)='@'
-	# Tell ltmain to make .lib files, not .a files.
-	libext=lib
-	# Tell ltmain to make .dll files, not .so files.
-	shrext_cmds=".dll"
-	# FIXME: Setting linknames here is a bad hack.
-	_LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
-	_LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-	    sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
-	  else
-	    sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
-	  fi~
-	  $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
-	  linknames='
-	# The linker will not automatically build a static lib if we build a DLL.
-	# _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
-	_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
-	_LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
-	_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
-	# Don't use ranlib
-	_LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
-	_LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
-	  lt_tool_outputfile="@TOOL_OUTPUT@"~
-	  case $lt_outputfile in
-	    *.exe|*.EXE) ;;
-	    *)
-	      lt_outputfile="$lt_outputfile.exe"
-	      lt_tool_outputfile="$lt_tool_outputfile.exe"
-	      ;;
-	  esac~
-	  if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
-	    $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
-	    $RM "$lt_outputfile.manifest";
-	  fi'
-	;;
-      *)
-	# Assume MSVC wrapper
-	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
-	_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-	# Tell ltmain to make .lib files, not .a files.
-	libext=lib
-	# Tell ltmain to make .dll files, not .so files.
-	shrext_cmds=".dll"
-	# FIXME: Setting linknames here is a bad hack.
-	_LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
-	# The linker will automatically build a .lib file if we build a DLL.
-	_LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
-	# FIXME: Should let the user specify the lib program.
-	_LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
-	_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
-	;;
-      esac
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+      # Tell ltmain to make .lib files, not .a files.
+      libext=lib
+      # Tell ltmain to make .dll files, not .so files.
+      shrext_cmds=".dll"
+      # FIXME: Setting linknames here is a bad hack.
+      _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames='
+      # The linker will automatically build a .lib file if we build a DLL.
+      _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+      # FIXME: Should let the user specify the lib program.
+      _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
+      _LT_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`'
+      _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
       ;;
 
     darwin* | rhapsody*)
@@ -5221,6 +4724,10 @@ _LT_EOF
       _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
       ;;
 
+    freebsd1*)
+      _LT_TAGVAR(ld_shlibs, $1)=no
+      ;;
+
     # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
     # support.  Future versions do this automatically, but an explicit c++rt0.o
     # does not break anything, and helps significantly (at the cost of a little
@@ -5233,7 +4740,7 @@ _LT_EOF
       ;;
 
     # Unfortunately, older versions of FreeBSD 2 do not have this feature.
-    freebsd2.*)
+    freebsd2*)
       _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
       _LT_TAGVAR(hardcode_direct, $1)=yes
       _LT_TAGVAR(hardcode_minus_L, $1)=yes
@@ -5242,7 +4749,7 @@ _LT_EOF
 
     # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
     freebsd* | dragonfly*)
-      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+      _LT_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
       _LT_TAGVAR(hardcode_direct, $1)=yes
       _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
@@ -5250,7 +4757,7 @@ _LT_EOF
 
     hpux9*)
       if test "$GCC" = yes; then
-	_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
       else
 	_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
       fi
@@ -5265,13 +4772,14 @@ _LT_EOF
       ;;
 
     hpux10*)
-      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
       else
 	_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
       fi
       if test "$with_gnu_ld" = no; then
 	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+	_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
 	_LT_TAGVAR(hardcode_libdir_separator, $1)=:
 	_LT_TAGVAR(hardcode_direct, $1)=yes
 	_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
@@ -5283,16 +4791,16 @@ _LT_EOF
       ;;
 
     hpux11*)
-      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
 	case $host_cpu in
 	hppa*64*)
 	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	ia64*)
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	*)
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	esac
       else
@@ -5304,14 +4812,7 @@ _LT_EOF
 	  _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	*)
-	m4_if($1, [], [
-	  # Older versions of the 11.00 compiler do not understand -b yet
-	  # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
-	  _LT_LINKER_OPTION([if $CC understands -b],
-	    _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b],
-	    [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'],
-	    [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])],
-	  [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'])
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	esac
       fi
@@ -5339,34 +4840,19 @@ _LT_EOF
 
     irix5* | irix6* | nonstopux*)
       if test "$GCC" = yes; then
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
 	# Try to use the -exported_symbol ld option, if it does not
 	# work, assume that -exports_file does not work either and
 	# implicitly export all symbols.
-	# This should be the same for all languages, so no per-tag cache variable.
-	AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol],
-	  [lt_cv_irix_exported_symbol],
-	  [save_LDFLAGS="$LDFLAGS"
-	   LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
-	   AC_LINK_IFELSE(
-	     [AC_LANG_SOURCE(
-	        [AC_LANG_CASE([C], [[int foo (void) { return 0; }]],
-			      [C++], [[int foo (void) { return 0; }]],
-			      [Fortran 77], [[
-      subroutine foo
-      end]],
-			      [Fortran], [[
-      subroutine foo
-      end]])])],
-	      [lt_cv_irix_exported_symbol=yes],
-	      [lt_cv_irix_exported_symbol=no])
-           LDFLAGS="$save_LDFLAGS"])
-	if test "$lt_cv_irix_exported_symbol" = yes; then
-          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
-	fi
+        save_LDFLAGS="$LDFLAGS"
+        LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+        AC_LINK_IFELSE(int foo(void) {},
+          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+        )
+        LDFLAGS="$save_LDFLAGS"
       else
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
       fi
       _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
@@ -5428,17 +4914,17 @@ _LT_EOF
       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
       _LT_TAGVAR(hardcode_minus_L, $1)=yes
       _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-      _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
       _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
       ;;
 
     osf3*)
       if test "$GCC" = yes; then
 	_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
       else
 	_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
       fi
       _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
@@ -5448,13 +4934,13 @@ _LT_EOF
     osf4* | osf5*)	# as osf3* with the addition of -msym flag
       if test "$GCC" = yes; then
 	_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
 	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
       else
 	_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
 	_LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
-	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
 
 	# Both c and cxx compiler support -rpath directly
 	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
@@ -5467,9 +4953,9 @@ _LT_EOF
       _LT_TAGVAR(no_undefined_flag, $1)=' -z defs'
       if test "$GCC" = yes; then
 	wlarc='${wl}'
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
 	_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-	  $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+	  $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
       else
 	case `$CC -V 2>&1` in
 	*"Compilers 5.0"*)
@@ -5645,38 +5131,36 @@ x|xyes)
       # Test whether the compiler implicitly links with -lc since on some
       # systems, -lgcc has to come before -lc. If gcc already passes -lc
       # to ld, don't add -lc before -lgcc.
-      AC_CACHE_CHECK([whether -lc should be explicitly linked in],
-	[lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1),
-	[$RM conftest*
-	echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-
-	if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
-	  soname=conftest
-	  lib=conftest
-	  libobjs=conftest.$ac_objext
-	  deplibs=
-	  wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1)
-	  pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)
-	  compiler_flags=-v
-	  linker_flags=-v
-	  verstring=
-	  output_objdir=.
-	  libname=conftest
-	  lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)
-	  _LT_TAGVAR(allow_undefined_flag, $1)=
-	  if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1)
-	  then
-	    lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no
-	  else
-	    lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes
-	  fi
-	  _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
-	else
-	  cat conftest.err 1>&5
-	fi
-	$RM conftest*
-	])
-      _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)
+      AC_MSG_CHECKING([whether -lc should be explicitly linked in])
+      $RM conftest*
+      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+      if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1)
+	pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)
+        _LT_TAGVAR(allow_undefined_flag, $1)=
+        if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1)
+        then
+	  _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+        else
+	  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+        fi
+        _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $RM conftest*
+      AC_MSG_RESULT([$_LT_TAGVAR(archive_cmds_need_lc, $1)])
       ;;
     esac
   fi
@@ -5713,6 +5197,9 @@ _LT_TAGDECL([], [no_undefined_flag], [1],
 _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1],
     [Flag to hardcode $libdir into a binary during linking.
     This must work even if $libdir does not exist])
+_LT_TAGDECL([], [hardcode_libdir_flag_spec_ld], [1],
+    [[If ld is used when linking, flag to hardcode $libdir into a binary
+    during linking.  This must work even if $libdir does not exist]])
 _LT_TAGDECL([], [hardcode_libdir_separator], [1],
     [Whether we need a single "-rpath" flag with a separated argument])
 _LT_TAGDECL([], [hardcode_direct], [0],
@@ -5738,6 +5225,8 @@ _LT_TAGDECL([], [inherit_rpath], [0],
     to runtime path list])
 _LT_TAGDECL([], [link_all_deplibs], [0],
     [Whether libtool must link a program against all its dependency libraries])
+_LT_TAGDECL([], [fix_srcfile_path], [1],
+    [Fix the shell variable $srcfile for the compiler])
 _LT_TAGDECL([], [always_export_symbols], [0],
     [Set to "yes" if exported symbols are required])
 _LT_TAGDECL([], [export_symbols_cmds], [2],
@@ -5748,8 +5237,6 @@ _LT_TAGDECL([], [include_expsyms], [1],
     [Symbols that must always be exported])
 _LT_TAGDECL([], [prelink_cmds], [2],
     [Commands necessary for linking programs (against libraries) with templates])
-_LT_TAGDECL([], [postlink_cmds], [2],
-    [Commands necessary for finishing linking programs])
 _LT_TAGDECL([], [file_list_spec], [1],
     [Specify filename containing input files])
 dnl FIXME: Not yet implemented
@@ -5790,6 +5277,10 @@ compiler_DEFAULT=$CC
 _LT_COMPILER_BOILERPLATE
 _LT_LINKER_BOILERPLATE
 
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
 if test -n "$compiler"; then
   _LT_COMPILER_NO_RTTI($1)
   _LT_COMPILER_PIC($1)
@@ -5839,15 +5330,14 @@ CC="$lt_save_CC"
 ])# _LT_LANG_C_CONFIG
 
 
-# _LT_LANG_CXX_CONFIG([TAG])
-# --------------------------
-# Ensure that the configuration variables for a C++ compiler are suitably
-# defined.  These variables are subsequently used by _LT_CONFIG to write
-# the compiler configuration to `libtool'.
-m4_defun([_LT_LANG_CXX_CONFIG],
-[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-m4_require([_LT_DECL_EGREP])dnl
-m4_require([_LT_PATH_MANIFEST_TOOL])dnl
+# _LT_PROG_CXX
+# ------------
+# Since AC_PROG_CXX is broken, in that it returns g++ if there is no c++
+# compiler, we have our own version here.
+m4_defun([_LT_PROG_CXX],
+[
+pushdef([AC_MSG_ERROR], [_lt_caught_CXX_error=yes])
+AC_PROG_CXX
 if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
     ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
     (test "X$CXX" != "Xg++"))) ; then
@@ -5855,6 +5345,22 @@ if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
 else
   _lt_caught_CXX_error=yes
 fi
+popdef([AC_MSG_ERROR])
+])# _LT_PROG_CXX
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([_LT_PROG_CXX], [])
+
+
+# _LT_LANG_CXX_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for a C++ compiler are suitably
+# defined.  These variables are subsequently used by _LT_CONFIG to write
+# the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_CXX_CONFIG],
+[AC_REQUIRE([_LT_PROG_CXX])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_EGREP])dnl
 
 AC_LANG_PUSH(C++)
 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
@@ -5866,6 +5372,7 @@ _LT_TAGVAR(export_dynamic_flag_spec, $1)=
 _LT_TAGVAR(hardcode_direct, $1)=no
 _LT_TAGVAR(hardcode_direct_absolute, $1)=no
 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
 _LT_TAGVAR(hardcode_libdir_separator, $1)=
 _LT_TAGVAR(hardcode_minus_L, $1)=no
 _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
@@ -5875,8 +5382,6 @@ _LT_TAGVAR(module_cmds, $1)=
 _LT_TAGVAR(module_expsym_cmds, $1)=
 _LT_TAGVAR(link_all_deplibs, $1)=unknown
 _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
-_LT_TAGVAR(reload_flag, $1)=$reload_flag
-_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
 _LT_TAGVAR(no_undefined_flag, $1)=
 _LT_TAGVAR(whole_archive_flag_spec, $1)=
 _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
@@ -5908,7 +5413,6 @@ if test "$_lt_caught_CXX_error" != yes; then
 
   # Allow CC to be a program name with arguments.
   lt_save_CC=$CC
-  lt_save_CFLAGS=$CFLAGS
   lt_save_LD=$LD
   lt_save_GCC=$GCC
   GCC=$GXX
@@ -5926,7 +5430,6 @@ if test "$_lt_caught_CXX_error" != yes; then
   fi
   test -z "${LDCXX+set}" || LD=$LDCXX
   CC=${CXX-"c++"}
-  CFLAGS=$CXXFLAGS
   compiler=$CC
   _LT_TAGVAR(compiler, $1)=$CC
   _LT_CC_BASENAME([$compiler])
@@ -5948,8 +5451,8 @@ if test "$_lt_caught_CXX_error" != yes; then
       # Check if GNU C++ uses GNU ld as the underlying linker, since the
       # archiving commands below assume that GNU ld is being used.
       if test "$with_gnu_ld" = yes; then
-        _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
-        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
 
         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
         _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
@@ -5981,7 +5484,7 @@ if test "$_lt_caught_CXX_error" != yes; then
       # Commands to make compiler produce verbose output that lists
       # what "hidden" libraries, object files and flags are used when
       # linking a shared library.
-      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
 
     else
       GXX=no
@@ -6090,10 +5593,10 @@ if test "$_lt_caught_CXX_error" != yes; then
           _LT_TAGVAR(allow_undefined_flag, $1)='-berok'
           # Determine the default libpath from the value encoded in an empty
           # executable.
-          _LT_SYS_MODULE_PATH_AIX([$1])
+          _LT_SYS_MODULE_PATH_AIX
           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
 
-          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
         else
           if test "$host_cpu" = ia64; then
 	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
@@ -6102,19 +5605,14 @@ if test "$_lt_caught_CXX_error" != yes; then
           else
 	    # Determine the default libpath from the value encoded in an
 	    # empty executable.
-	    _LT_SYS_MODULE_PATH_AIX([$1])
+	    _LT_SYS_MODULE_PATH_AIX
 	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
 	    # Warning - without using the other run time loading flags,
 	    # -berok will link without error, but may produce a broken library.
 	    _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
 	    _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
-	    if test "$with_gnu_ld" = yes; then
-	      # We only use this code for GNU lds that support --whole-archive.
-	      _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
-	    else
-	      # Exported symbols can be pulled into shared objects from archives
-	      _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
-	    fi
+	    # Exported symbols can be pulled into shared objects from archives
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
 	    _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
 	    # This is similar to how AIX traditionally builds its shared
 	    # libraries.
@@ -6144,75 +5642,28 @@ if test "$_lt_caught_CXX_error" != yes; then
         ;;
 
       cygwin* | mingw* | pw32* | cegcc*)
-	case $GXX,$cc_basename in
-	,cl* | no,cl*)
-	  # Native MSVC
-	  # hardcode_libdir_flag_spec is actually meaningless, as there is
-	  # no search path for DLLs.
-	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
-	  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-	  _LT_TAGVAR(always_export_symbols, $1)=yes
-	  _LT_TAGVAR(file_list_spec, $1)='@'
-	  # Tell ltmain to make .lib files, not .a files.
-	  libext=lib
-	  # Tell ltmain to make .dll files, not .so files.
-	  shrext_cmds=".dll"
-	  # FIXME: Setting linknames here is a bad hack.
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
-	  _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-	      $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
-	    else
-	      $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
-	    fi~
-	    $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
-	    linknames='
-	  # The linker will not automatically build a static lib if we build a DLL.
-	  # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
-	  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
-	  # Don't use ranlib
-	  _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
-	  _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
-	    lt_tool_outputfile="@TOOL_OUTPUT@"~
-	    case $lt_outputfile in
-	      *.exe|*.EXE) ;;
-	      *)
-		lt_outputfile="$lt_outputfile.exe"
-		lt_tool_outputfile="$lt_tool_outputfile.exe"
-		;;
-	    esac~
-	    func_to_tool_file "$lt_outputfile"~
-	    if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
-	      $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
-	      $RM "$lt_outputfile.manifest";
-	    fi'
-	  ;;
-	*)
-	  # g++
-	  # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
-	  # as there is no search path for DLLs.
-	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-	  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
-	  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-	  _LT_TAGVAR(always_export_symbols, $1)=no
-	  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
-
-	  if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
-	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-	    # If the export-symbols file already is a .def file (1st line
-	    # is EXPORTS), use it as is; otherwise, prepend...
-	    _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-	      cp $export_symbols $output_objdir/$soname.def;
-	    else
-	      echo EXPORTS > $output_objdir/$soname.def;
-	      cat $export_symbols >> $output_objdir/$soname.def;
-	    fi~
-	    $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-	  else
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	  fi
-	  ;;
-	esac
-	;;
+        # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+        # as there is no search path for DLLs.
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+        _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+        _LT_TAGVAR(always_export_symbols, $1)=no
+        _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+
+        if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+          _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+          # If the export-symbols file already is a .def file (1st line
+          # is EXPORTS), use it as is; otherwise, prepend...
+          _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	    cp $export_symbols $output_objdir/$soname.def;
+          else
+	    echo EXPORTS > $output_objdir/$soname.def;
+	    cat $export_symbols >> $output_objdir/$soname.def;
+          fi~
+          $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+        else
+          _LT_TAGVAR(ld_shlibs, $1)=no
+        fi
+        ;;
       darwin* | rhapsody*)
         _LT_DARWIN_LINKER_FEATURES($1)
 	;;
@@ -6235,7 +5686,7 @@ if test "$_lt_caught_CXX_error" != yes; then
         esac
         ;;
 
-      freebsd2.*)
+      freebsd[[12]]*)
         # C++ shared libraries reported to be fairly broken before
 	# switch to ELF
         _LT_TAGVAR(ld_shlibs, $1)=no
@@ -6254,11 +5705,6 @@ if test "$_lt_caught_CXX_error" != yes; then
       gnu*)
         ;;
 
-      haiku*)
-        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-        _LT_TAGVAR(link_all_deplibs, $1)=yes
-        ;;
-
       hpux9*)
         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
         _LT_TAGVAR(hardcode_libdir_separator, $1)=:
@@ -6283,11 +5729,11 @@ if test "$_lt_caught_CXX_error" != yes; then
             # explicitly linking system object files so we need to strip them
             # from the output so that they don't get included in the library
             # dependencies.
-            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
             ;;
           *)
             if test "$GXX" = yes; then
-              _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+              _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
             else
               # FIXME: insert proper C++ library support
               _LT_TAGVAR(ld_shlibs, $1)=no
@@ -6348,7 +5794,7 @@ if test "$_lt_caught_CXX_error" != yes; then
 	    # explicitly linking system object files so we need to strip them
 	    # from the output so that they don't get included in the library
 	    # dependencies.
-	    output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+	    output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
 	    ;;
           *)
 	    if test "$GXX" = yes; then
@@ -6358,10 +5804,10 @@ if test "$_lt_caught_CXX_error" != yes; then
 	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
 	            ;;
 	          ia64*)
-	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
 	            ;;
 	          *)
-	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
 	            ;;
 	        esac
 	      fi
@@ -6391,7 +5837,7 @@ if test "$_lt_caught_CXX_error" != yes; then
         case $cc_basename in
           CC*)
 	    # SGI C++
-	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
 
 	    # Archives containing C++ object files must be created using
 	    # "CC -ar", where "CC" is the IRIX C++ compiler.  This is
@@ -6402,9 +5848,9 @@ if test "$_lt_caught_CXX_error" != yes; then
           *)
 	    if test "$GXX" = yes; then
 	      if test "$with_gnu_ld" = no; then
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
 	      else
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib'
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` -o $lib'
 	      fi
 	    fi
 	    _LT_TAGVAR(link_all_deplibs, $1)=yes
@@ -6433,7 +5879,7 @@ if test "$_lt_caught_CXX_error" != yes; then
 	    # explicitly linking system object files so we need to strip them
 	    # from the output so that they don't get included in the library
 	    # dependencies.
-	    output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+	    output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
 
 	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
 	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
@@ -6470,26 +5916,26 @@ if test "$_lt_caught_CXX_error" != yes; then
           pgCC* | pgcpp*)
             # Portland Group C++ compiler
 	    case `$CC -V` in
-	    *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*)
+	    *pgCC\ [[1-5]]* | *pgcpp\ [[1-5]]*)
 	      _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~
 		rm -rf $tpldir~
 		$CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
-		compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
+		compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"'
 	      _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~
 		rm -rf $tpldir~
 		$CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
-		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
+		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~
 		$RANLIB $oldlib'
 	      _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~
 		rm -rf $tpldir~
 		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
-		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
 	      _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~
 		rm -rf $tpldir~
 		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
-		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
 	      ;;
-	    *) # Version 6 and above use weak symbols
+	    *) # Version 6 will use weak symbols
 	      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
 	      _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
 	      ;;
@@ -6497,7 +5943,7 @@ if test "$_lt_caught_CXX_error" != yes; then
 
 	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
 	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
-	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
             ;;
 	  cxx*)
 	    # Compaq C++
@@ -6516,9 +5962,9 @@ if test "$_lt_caught_CXX_error" != yes; then
 	    # explicitly linking system object files so we need to strip them
 	    # from the output so that they don't get included in the library
 	    # dependencies.
-	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed'
+	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
 	    ;;
-	  xl* | mpixl* | bgxl*)
+	  xl*)
 	    # IBM XL 8.0 on PPC, with GNU ld
 	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
 	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
@@ -6538,13 +5984,13 @@ if test "$_lt_caught_CXX_error" != yes; then
 	      _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
 	      _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
 	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-	      _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	      _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
 	      _LT_TAGVAR(compiler_needs_object, $1)=yes
 
 	      # Not sure whether something based on
 	      # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
 	      # would be better.
-	      output_verbose_link_cmd='func_echo_all'
+	      output_verbose_link_cmd='echo'
 
 	      # Archives containing C++ object files must be created using
 	      # "CC -xar", where "CC" is the Sun C++ compiler.  This is
@@ -6613,7 +6059,7 @@ if test "$_lt_caught_CXX_error" != yes; then
 	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
 	    _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
 	  fi
-	  output_verbose_link_cmd=func_echo_all
+	  output_verbose_link_cmd=echo
 	else
 	  _LT_TAGVAR(ld_shlibs, $1)=no
 	fi
@@ -6648,15 +6094,15 @@ if test "$_lt_caught_CXX_error" != yes; then
 	    case $host in
 	      osf3*)
 	        _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && $ECHO "X${wl}-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
 	        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
 		;;
 	      *)
 	        _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
 	        _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
 	          echo "-hidden">> $lib.exp~
-	          $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp  `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~
+	          $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp  `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~
 	          $RM $lib.exp'
 	        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
 		;;
@@ -6672,17 +6118,17 @@ if test "$_lt_caught_CXX_error" != yes; then
 	    # explicitly linking system object files so we need to strip them
 	    # from the output so that they don't get included in the library
 	    # dependencies.
-	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
 	    ;;
 	  *)
 	    if test "$GXX" = yes && test "$with_gnu_ld" = no; then
 	      _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
 	      case $host in
 	        osf3*)
-	          _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	          _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
 		  ;;
 	        *)
-	          _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	          _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
 		  ;;
 	      esac
 
@@ -6692,7 +6138,7 @@ if test "$_lt_caught_CXX_error" != yes; then
 	      # Commands to make compiler produce verbose output that lists
 	      # what "hidden" libraries, object files and flags are used when
 	      # linking a shared library.
-	      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+	      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
 
 	    else
 	      # FIXME: insert proper C++ library support
@@ -6728,7 +6174,7 @@ if test "$_lt_caught_CXX_error" != yes; then
 
       solaris*)
         case $cc_basename in
-          CC* | sunCC*)
+          CC*)
 	    # Sun C++ 4.2, 5.x and Centerline C++
             _LT_TAGVAR(archive_cmds_need_lc,$1)=yes
 	    _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
@@ -6749,7 +6195,7 @@ if test "$_lt_caught_CXX_error" != yes; then
 	    esac
 	    _LT_TAGVAR(link_all_deplibs, $1)=yes
 
-	    output_verbose_link_cmd='func_echo_all'
+	    output_verbose_link_cmd='echo'
 
 	    # Archives containing C++ object files must be created using
 	    # "CC -xar", where "CC" is the Sun C++ compiler.  This is
@@ -6769,14 +6215,14 @@ if test "$_lt_caught_CXX_error" != yes; then
 	    if test "$GXX" = yes && test "$with_gnu_ld" = no; then
 	      _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
 	      if $CC --version | $GREP -v '^2\.7' > /dev/null; then
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
 	        _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-		  $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+		  $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
 
 	        # Commands to make compiler produce verbose output that lists
 	        # what "hidden" libraries, object files and flags are used when
 	        # linking a shared library.
-	        output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+	        output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
 	      else
 	        # g++ 2.7 appears to require `-G' NOT `-shared' on this
 	        # platform.
@@ -6787,7 +6233,7 @@ if test "$_lt_caught_CXX_error" != yes; then
 	        # Commands to make compiler produce verbose output that lists
 	        # what "hidden" libraries, object files and flags are used when
 	        # linking a shared library.
-	        output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+	        output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
 	      fi
 
 	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
@@ -6841,10 +6287,6 @@ if test "$_lt_caught_CXX_error" != yes; then
           CC*)
 	    _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
 	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~
-	      '"$_LT_TAGVAR(old_archive_cmds, $1)"
-	    _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~
-	      '"$_LT_TAGVAR(reload_cmds, $1)"
 	    ;;
 	  *)
 	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
@@ -6900,7 +6342,6 @@ if test "$_lt_caught_CXX_error" != yes; then
   fi # test -n "$compiler"
 
   CC=$lt_save_CC
-  CFLAGS=$lt_save_CFLAGS
   LDCXX=$LD
   LD=$lt_save_LD
   GCC=$lt_save_GCC
@@ -6915,29 +6356,6 @@ AC_LANG_POP
 ])# _LT_LANG_CXX_CONFIG
 
 
-# _LT_FUNC_STRIPNAME_CNF
-# ----------------------
-# func_stripname_cnf prefix suffix name
-# strip PREFIX and SUFFIX off of NAME.
-# PREFIX and SUFFIX must not contain globbing or regex special
-# characters, hashes, percent signs, but SUFFIX may contain a leading
-# dot (in which case that matches only a dot).
-#
-# This function is identical to the (non-XSI) version of func_stripname,
-# except this one can be used by m4 code that may be executed by configure,
-# rather than the libtool script.
-m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl
-AC_REQUIRE([_LT_DECL_SED])
-AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])
-func_stripname_cnf ()
-{
-  case ${2} in
-  .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
-  *)  func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
-  esac
-} # func_stripname_cnf
-])# _LT_FUNC_STRIPNAME_CNF
-
 # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])
 # ---------------------------------
 # Figure out "hidden" library dependencies from verbose
@@ -6946,7 +6364,6 @@ func_stripname_cnf ()
 # objects, libraries and library flags.
 m4_defun([_LT_SYS_HIDDEN_LIBDEPS],
 [m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl
 # Dependencies to place before and after the object being linked:
 _LT_TAGVAR(predep_objects, $1)=
 _LT_TAGVAR(postdep_objects, $1)=
@@ -6996,20 +6413,7 @@ public class foo {
   }
 };
 _LT_EOF
-], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF
-package foo
-func foo() {
-}
-_LT_EOF
 ])
-
-_lt_libdeps_save_CFLAGS=$CFLAGS
-case "$CC $CFLAGS " in #(
-*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
-*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
-*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;;
-esac
-
 dnl Parse the compiler output and extract the necessary
 dnl objects, libraries and library flags.
 if AC_TRY_EVAL(ac_compile); then
@@ -7021,7 +6425,7 @@ if AC_TRY_EVAL(ac_compile); then
   pre_test_object_deps_done=no
 
   for p in `eval "$output_verbose_link_cmd"`; do
-    case ${prev}${p} in
+    case $p in
 
     -L* | -R* | -l*)
        # Some compilers place space between "-{L,R}" and the path.
@@ -7030,22 +6434,13 @@ if AC_TRY_EVAL(ac_compile); then
           test $p = "-R"; then
 	 prev=$p
 	 continue
+       else
+	 prev=
        fi
 
-       # Expand the sysroot to ease extracting the directories later.
-       if test -z "$prev"; then
-         case $p in
-         -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;;
-         -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;;
-         -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;;
-         esac
-       fi
-       case $p in
-       =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;;
-       esac
        if test "$pre_test_object_deps_done" = no; then
-	 case ${prev} in
-	 -L | -R)
+	 case $p in
+	 -L* | -R*)
 	   # Internal compiler library paths should come after those
 	   # provided the user.  The postdeps already come after the
 	   # user supplied libs so there is no need to process them.
@@ -7065,10 +6460,8 @@ if AC_TRY_EVAL(ac_compile); then
 	   _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}"
 	 fi
        fi
-       prev=
        ;;
 
-    *.lto.$objext) ;; # Ignore GCC LTO objects
     *.$objext)
        # This assumes that the test object file only shows up
        # once in the compiler output.
@@ -7104,7 +6497,6 @@ else
 fi
 
 $RM -f confest.$objext
-CFLAGS=$_lt_libdeps_save_CFLAGS
 
 # PORTME: override above test on systems where it is broken
 m4_if([$1], [CXX],
@@ -7141,7 +6533,7 @@ linux*)
 
 solaris*)
   case $cc_basename in
-  CC* | sunCC*)
+  CC*)
     # The more standards-conforming stlport4 library is
     # incompatible with the Cstd library. Avoid specifying
     # it if it's in CXXFLAGS. Ignore libCrun as
@@ -7185,16 +6577,32 @@ _LT_TAGDECL([], [compiler_lib_search_path], [1],
 ])# _LT_SYS_HIDDEN_LIBDEPS
 
 
+# _LT_PROG_F77
+# ------------
+# Since AC_PROG_F77 is broken, in that it returns the empty string
+# if there is no fortran compiler, we have our own version here.
+m4_defun([_LT_PROG_F77],
+[
+pushdef([AC_MSG_ERROR], [_lt_disable_F77=yes])
+AC_PROG_F77
+if test -z "$F77" || test "X$F77" = "Xno"; then
+  _lt_disable_F77=yes
+fi
+popdef([AC_MSG_ERROR])
+])# _LT_PROG_F77
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([_LT_PROG_F77], [])
+
+
 # _LT_LANG_F77_CONFIG([TAG])
 # --------------------------
 # Ensure that the configuration variables for a Fortran 77 compiler are
 # suitably defined.  These variables are subsequently used by _LT_CONFIG
 # to write the compiler configuration to `libtool'.
 m4_defun([_LT_LANG_F77_CONFIG],
-[AC_LANG_PUSH(Fortran 77)
-if test -z "$F77" || test "X$F77" = "Xno"; then
-  _lt_disable_F77=yes
-fi
+[AC_REQUIRE([_LT_PROG_F77])dnl
+AC_LANG_PUSH(Fortran 77)
 
 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
 _LT_TAGVAR(allow_undefined_flag, $1)=
@@ -7204,6 +6612,7 @@ _LT_TAGVAR(export_dynamic_flag_spec, $1)=
 _LT_TAGVAR(hardcode_direct, $1)=no
 _LT_TAGVAR(hardcode_direct_absolute, $1)=no
 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
 _LT_TAGVAR(hardcode_libdir_separator, $1)=
 _LT_TAGVAR(hardcode_minus_L, $1)=no
 _LT_TAGVAR(hardcode_automatic, $1)=no
@@ -7212,8 +6621,6 @@ _LT_TAGVAR(module_cmds, $1)=
 _LT_TAGVAR(module_expsym_cmds, $1)=
 _LT_TAGVAR(link_all_deplibs, $1)=unknown
 _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
-_LT_TAGVAR(reload_flag, $1)=$reload_flag
-_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
 _LT_TAGVAR(no_undefined_flag, $1)=
 _LT_TAGVAR(whole_archive_flag_spec, $1)=
 _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
@@ -7253,9 +6660,7 @@ if test "$_lt_disable_F77" != yes; then
   # Allow CC to be a program name with arguments.
   lt_save_CC="$CC"
   lt_save_GCC=$GCC
-  lt_save_CFLAGS=$CFLAGS
   CC=${F77-"f77"}
-  CFLAGS=$FFLAGS
   compiler=$CC
   _LT_TAGVAR(compiler, $1)=$CC
   _LT_CC_BASENAME([$compiler])
@@ -7309,24 +6714,38 @@ if test "$_lt_disable_F77" != yes; then
 
   GCC=$lt_save_GCC
   CC="$lt_save_CC"
-  CFLAGS="$lt_save_CFLAGS"
 fi # test "$_lt_disable_F77" != yes
 
 AC_LANG_POP
 ])# _LT_LANG_F77_CONFIG
 
 
+# _LT_PROG_FC
+# -----------
+# Since AC_PROG_FC is broken, in that it returns the empty string
+# if there is no fortran compiler, we have our own version here.
+m4_defun([_LT_PROG_FC],
+[
+pushdef([AC_MSG_ERROR], [_lt_disable_FC=yes])
+AC_PROG_FC
+if test -z "$FC" || test "X$FC" = "Xno"; then
+  _lt_disable_FC=yes
+fi
+popdef([AC_MSG_ERROR])
+])# _LT_PROG_FC
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([_LT_PROG_FC], [])
+
+
 # _LT_LANG_FC_CONFIG([TAG])
 # -------------------------
 # Ensure that the configuration variables for a Fortran compiler are
 # suitably defined.  These variables are subsequently used by _LT_CONFIG
 # to write the compiler configuration to `libtool'.
 m4_defun([_LT_LANG_FC_CONFIG],
-[AC_LANG_PUSH(Fortran)
-
-if test -z "$FC" || test "X$FC" = "Xno"; then
-  _lt_disable_FC=yes
-fi
+[AC_REQUIRE([_LT_PROG_FC])dnl
+AC_LANG_PUSH(Fortran)
 
 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
 _LT_TAGVAR(allow_undefined_flag, $1)=
@@ -7336,6 +6755,7 @@ _LT_TAGVAR(export_dynamic_flag_spec, $1)=
 _LT_TAGVAR(hardcode_direct, $1)=no
 _LT_TAGVAR(hardcode_direct_absolute, $1)=no
 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
 _LT_TAGVAR(hardcode_libdir_separator, $1)=
 _LT_TAGVAR(hardcode_minus_L, $1)=no
 _LT_TAGVAR(hardcode_automatic, $1)=no
@@ -7344,8 +6764,6 @@ _LT_TAGVAR(module_cmds, $1)=
 _LT_TAGVAR(module_expsym_cmds, $1)=
 _LT_TAGVAR(link_all_deplibs, $1)=unknown
 _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
-_LT_TAGVAR(reload_flag, $1)=$reload_flag
-_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
 _LT_TAGVAR(no_undefined_flag, $1)=
 _LT_TAGVAR(whole_archive_flag_spec, $1)=
 _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
@@ -7385,9 +6803,7 @@ if test "$_lt_disable_FC" != yes; then
   # Allow CC to be a program name with arguments.
   lt_save_CC="$CC"
   lt_save_GCC=$GCC
-  lt_save_CFLAGS=$CFLAGS
   CC=${FC-"f95"}
-  CFLAGS=$FCFLAGS
   compiler=$CC
   GCC=$ac_cv_fc_compiler_gnu
 
@@ -7443,8 +6859,7 @@ if test "$_lt_disable_FC" != yes; then
   fi # test -n "$compiler"
 
   GCC=$lt_save_GCC
-  CC=$lt_save_CC
-  CFLAGS=$lt_save_CFLAGS
+  CC="$lt_save_CC"
 fi # test "$_lt_disable_FC" != yes
 
 AC_LANG_POP
@@ -7481,12 +6896,10 @@ _LT_COMPILER_BOILERPLATE
 _LT_LINKER_BOILERPLATE
 
 # Allow CC to be a program name with arguments.
-lt_save_CC=$CC
-lt_save_CFLAGS=$CFLAGS
+lt_save_CC="$CC"
 lt_save_GCC=$GCC
 GCC=yes
 CC=${GCJ-"gcj"}
-CFLAGS=$GCJFLAGS
 compiler=$CC
 _LT_TAGVAR(compiler, $1)=$CC
 _LT_TAGVAR(LD, $1)="$LD"
@@ -7496,9 +6909,11 @@ _LT_CC_BASENAME([$compiler])
 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
 
 _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
-_LT_TAGVAR(reload_flag, $1)=$reload_flag
-_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
 
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
 if test -n "$compiler"; then
   _LT_COMPILER_NO_RTTI($1)
   _LT_COMPILER_PIC($1)
@@ -7513,32 +6928,31 @@ fi
 AC_LANG_RESTORE
 
 GCC=$lt_save_GCC
-CC=$lt_save_CC
-CFLAGS=$lt_save_CFLAGS
+CC="$lt_save_CC"
 ])# _LT_LANG_GCJ_CONFIG
 
 
-# _LT_LANG_GO_CONFIG([TAG])
-# --------------------------
-# Ensure that the configuration variables for the GNU Go compiler
+# _LT_LANG_RC_CONFIG([TAG])
+# -------------------------
+# Ensure that the configuration variables for the Windows resource compiler
 # are suitably defined.  These variables are subsequently used by _LT_CONFIG
 # to write the compiler configuration to `libtool'.
-m4_defun([_LT_LANG_GO_CONFIG],
-[AC_REQUIRE([LT_PROG_GO])dnl
+m4_defun([_LT_LANG_RC_CONFIG],
+[AC_REQUIRE([LT_PROG_RC])dnl
 AC_LANG_SAVE
 
-# Source file extension for Go test sources.
-ac_ext=go
+# Source file extension for RC test sources.
+ac_ext=rc
 
-# Object file extension for compiled Go test sources.
+# Object file extension for compiled RC test sources.
 objext=o
 _LT_TAGVAR(objext, $1)=$objext
 
 # Code to be used in simple compile tests
-lt_simple_compile_test_code="package main; func main() { }"
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
 
 # Code to be used in simple link tests
-lt_simple_link_test_code='package main; func main() { }'
+lt_simple_link_test_code="$lt_simple_compile_test_code"
 
 # ltmain only uses $CC for tagged configurations so make sure $CC is set.
 _LT_TAG_COMPILER
@@ -7548,94 +6962,24 @@ _LT_COMPILER_BOILERPLATE
 _LT_LINKER_BOILERPLATE
 
 # Allow CC to be a program name with arguments.
-lt_save_CC=$CC
-lt_save_CFLAGS=$CFLAGS
+lt_save_CC="$CC"
 lt_save_GCC=$GCC
-GCC=yes
-CC=${GOC-"gccgo"}
-CFLAGS=$GOFLAGS
+GCC=
+CC=${RC-"windres"}
 compiler=$CC
 _LT_TAGVAR(compiler, $1)=$CC
-_LT_TAGVAR(LD, $1)="$LD"
 _LT_CC_BASENAME([$compiler])
+_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
 
-# Go did not exist at the time GCC didn't implicitly link libc in.
-_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+if test -n "$compiler"; then
+  :
+  _LT_CONFIG($1)
+fi
 
-_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
-_LT_TAGVAR(reload_flag, $1)=$reload_flag
-_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
-
-if test -n "$compiler"; then
-  _LT_COMPILER_NO_RTTI($1)
-  _LT_COMPILER_PIC($1)
-  _LT_COMPILER_C_O($1)
-  _LT_COMPILER_FILE_LOCKS($1)
-  _LT_LINKER_SHLIBS($1)
-  _LT_LINKER_HARDCODE_LIBPATH($1)
-
-  _LT_CONFIG($1)
-fi
-
-AC_LANG_RESTORE
-
-GCC=$lt_save_GCC
-CC=$lt_save_CC
-CFLAGS=$lt_save_CFLAGS
-])# _LT_LANG_GO_CONFIG
-
-
-# _LT_LANG_RC_CONFIG([TAG])
-# -------------------------
-# Ensure that the configuration variables for the Windows resource compiler
-# are suitably defined.  These variables are subsequently used by _LT_CONFIG
-# to write the compiler configuration to `libtool'.
-m4_defun([_LT_LANG_RC_CONFIG],
-[AC_REQUIRE([LT_PROG_RC])dnl
-AC_LANG_SAVE
-
-# Source file extension for RC test sources.
-ac_ext=rc
-
-# Object file extension for compiled RC test sources.
-objext=o
-_LT_TAGVAR(objext, $1)=$objext
-
-# Code to be used in simple compile tests
-lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
-
-# Code to be used in simple link tests
-lt_simple_link_test_code="$lt_simple_compile_test_code"
-
-# ltmain only uses $CC for tagged configurations so make sure $CC is set.
-_LT_TAG_COMPILER
-
-# save warnings/boilerplate of simple test code
-_LT_COMPILER_BOILERPLATE
-_LT_LINKER_BOILERPLATE
-
-# Allow CC to be a program name with arguments.
-lt_save_CC="$CC"
-lt_save_CFLAGS=$CFLAGS
-lt_save_GCC=$GCC
-GCC=
-CC=${RC-"windres"}
-CFLAGS=
-compiler=$CC
-_LT_TAGVAR(compiler, $1)=$CC
-_LT_CC_BASENAME([$compiler])
-_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
-
-if test -n "$compiler"; then
-  :
-  _LT_CONFIG($1)
-fi
-
-GCC=$lt_save_GCC
-AC_LANG_RESTORE
-CC=$lt_save_CC
-CFLAGS=$lt_save_CFLAGS
-])# _LT_LANG_RC_CONFIG
+GCC=$lt_save_GCC
+AC_LANG_RESTORE
+CC="$lt_save_CC"
+])# _LT_LANG_RC_CONFIG
 
 
 # LT_PROG_GCJ
@@ -7654,13 +6998,6 @@ dnl aclocal-1.4 backwards compatibility:
 dnl AC_DEFUN([LT_AC_PROG_GCJ], [])
 
 
-# LT_PROG_GO
-# ----------
-AC_DEFUN([LT_PROG_GO],
-[AC_CHECK_TOOL(GOC, gccgo,)
-])
-
-
 # LT_PROG_RC
 # ----------
 AC_DEFUN([LT_PROG_RC],
@@ -7700,15 +7037,6 @@ _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper])
 AC_SUBST([OBJDUMP])
 ])
 
-# _LT_DECL_DLLTOOL
-# ----------------
-# Ensure DLLTOOL variable is set.
-m4_defun([_LT_DECL_DLLTOOL],
-[AC_CHECK_TOOL(DLLTOOL, dlltool, false)
-test -z "$DLLTOOL" && DLLTOOL=dlltool
-_LT_DECL([], [DLLTOOL], [1], [DLL creation program])
-AC_SUBST([DLLTOOL])
-])
 
 # _LT_DECL_SED
 # ------------
@@ -7724,10 +7052,12 @@ _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"],
 ])# _LT_DECL_SED
 
 m4_ifndef([AC_PROG_SED], [
+############################################################
 # NOTE: This macro has been submitted for inclusion into   #
 #  GNU Autoconf as AC_PROG_SED.  When it is available in   #
 #  a released version of Autoconf we should remove this    #
 #  macro and use it instead.                               #
+############################################################
 
 m4_defun([AC_PROG_SED],
 [AC_MSG_CHECKING([for a sed that does not truncate output])
@@ -7800,8 +7130,8 @@ m4_defun([_LT_CHECK_SHELL_FEATURES],
 # Try some XSI features
 xsi_shell=no
 ( _lt_dummy="a/b/c"
-  test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
-      = c,a/b,b/c, \
+  test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \
+      = c,a/b,, \
     && eval 'test $(( 1 + 1 )) -eq 2 \
     && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
   && xsi_shell=yes
@@ -7840,1765 +7170,208 @@ _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl
 ])# _LT_CHECK_SHELL_FEATURES
 
 
-# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY)
-# ------------------------------------------------------
-# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and
-# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY.
-m4_defun([_LT_PROG_FUNCTION_REPLACE],
-[dnl {
-sed -e '/^$1 ()$/,/^} # $1 /c\
-$1 ()\
-{\
-m4_bpatsubsts([$2], [$], [\\], [^\([	 ]\)], [\\\1])
-} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-])
-
-
-# _LT_PROG_REPLACE_SHELLFNS
-# -------------------------
-# Replace existing portable implementations of several shell functions with
-# equivalent extended shell implementations where those features are available..
-m4_defun([_LT_PROG_REPLACE_SHELLFNS],
-[if test x"$xsi_shell" = xyes; then
-  _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl
-    case ${1} in
-      */*) func_dirname_result="${1%/*}${2}" ;;
-      *  ) func_dirname_result="${3}" ;;
-    esac])
-
-  _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl
-    func_basename_result="${1##*/}"])
-
-  _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl
-    case ${1} in
-      */*) func_dirname_result="${1%/*}${2}" ;;
-      *  ) func_dirname_result="${3}" ;;
-    esac
-    func_basename_result="${1##*/}"])
-
-  _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl
-    # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
-    # positional parameters, so assign one to ordinary parameter first.
-    func_stripname_result=${3}
-    func_stripname_result=${func_stripname_result#"${1}"}
-    func_stripname_result=${func_stripname_result%"${2}"}])
-
-  _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl
-    func_split_long_opt_name=${1%%=*}
-    func_split_long_opt_arg=${1#*=}])
-
-  _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl
-    func_split_short_opt_arg=${1#??}
-    func_split_short_opt_name=${1%"$func_split_short_opt_arg"}])
-
-  _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl
-    case ${1} in
-      *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
-      *)    func_lo2o_result=${1} ;;
-    esac])
-
-  _LT_PROG_FUNCTION_REPLACE([func_xform], [    func_xform_result=${1%.*}.lo])
-
-  _LT_PROG_FUNCTION_REPLACE([func_arith], [    func_arith_result=$(( $[*] ))])
-
-  _LT_PROG_FUNCTION_REPLACE([func_len], [    func_len_result=${#1}])
-fi
-
-if test x"$lt_shell_append" = xyes; then
-  _LT_PROG_FUNCTION_REPLACE([func_append], [    eval "${1}+=\\${2}"])
-
-  _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl
-    func_quote_for_eval "${2}"
-dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \
-    eval "${1}+=\\\\ \\$func_quote_for_eval_result"])
-
-  # Save a `func_append' function call where possible by direct use of '+='
-  sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
-    && mv -f "$cfgfile.tmp" "$cfgfile" \
-      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-  test 0 -eq $? || _lt_function_replace_fail=:
-else
-  # Save a `func_append' function call even when '+=' is not available
-  sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
-    && mv -f "$cfgfile.tmp" "$cfgfile" \
-      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-  test 0 -eq $? || _lt_function_replace_fail=:
-fi
-
-if test x"$_lt_function_replace_fail" = x":"; then
-  AC_MSG_WARN([Unable to substitute extended shell functions in $ofile])
-fi
-])
-
-# _LT_PATH_CONVERSION_FUNCTIONS
-# -----------------------------
-# Determine which file name conversion functions should be used by
-# func_to_host_file (and, implicitly, by func_to_host_path).  These are needed
-# for certain cross-compile configurations and native mingw.
-m4_defun([_LT_PATH_CONVERSION_FUNCTIONS],
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-AC_REQUIRE([AC_CANONICAL_BUILD])dnl
-AC_MSG_CHECKING([how to convert $build file names to $host format])
-AC_CACHE_VAL(lt_cv_to_host_file_cmd,
-[case $host in
-  *-*-mingw* )
-    case $build in
-      *-*-mingw* ) # actually msys
-        lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
-        ;;
-      *-*-cygwin* )
-        lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
-        ;;
-      * ) # otherwise, assume *nix
-        lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
-        ;;
-    esac
-    ;;
-  *-*-cygwin* )
-    case $build in
-      *-*-mingw* ) # actually msys
-        lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
-        ;;
-      *-*-cygwin* )
-        lt_cv_to_host_file_cmd=func_convert_file_noop
-        ;;
-      * ) # otherwise, assume *nix
-        lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
-        ;;
-    esac
-    ;;
-  * ) # unhandled hosts (and "normal" native builds)
-    lt_cv_to_host_file_cmd=func_convert_file_noop
-    ;;
-esac
-])
-to_host_file_cmd=$lt_cv_to_host_file_cmd
-AC_MSG_RESULT([$lt_cv_to_host_file_cmd])
-_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd],
-         [0], [convert $build file names to $host format])dnl
-
-AC_MSG_CHECKING([how to convert $build file names to toolchain format])
-AC_CACHE_VAL(lt_cv_to_tool_file_cmd,
-[#assume ordinary cross tools, or native build.
-lt_cv_to_tool_file_cmd=func_convert_file_noop
-case $host in
-  *-*-mingw* )
-    case $build in
-      *-*-mingw* ) # actually msys
-        lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
-        ;;
-    esac
-    ;;
-esac
-])
-to_tool_file_cmd=$lt_cv_to_tool_file_cmd
-AC_MSG_RESULT([$lt_cv_to_tool_file_cmd])
-_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd],
-         [0], [convert $build files to toolchain format])dnl
-])# _LT_PATH_CONVERSION_FUNCTIONS
-
-# Helper functions for option handling.                    -*- Autoconf -*-
-#
-#   Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation,
-#   Inc.
-#   Written by Gary V. Vaughan, 2004
-#
-# This file is free software; the Free Software Foundation gives
-# unlimited permission to copy and/or distribute it, with or without
-# modifications, as long as this notice is preserved.
-
-# serial 7 ltoptions.m4
-
-# This is to help aclocal find these macros, as it can't see m4_define.
-AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
-
-
-# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
-# ------------------------------------------
-m4_define([_LT_MANGLE_OPTION],
-[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
-
-
-# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
-# ---------------------------------------
-# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
-# matching handler defined, dispatch to it.  Other OPTION-NAMEs are
-# saved as a flag.
-m4_define([_LT_SET_OPTION],
-[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
-m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
-        _LT_MANGLE_DEFUN([$1], [$2]),
-    [m4_warning([Unknown $1 option `$2'])])[]dnl
-])
-
-
-# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
-# ------------------------------------------------------------
-# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
-m4_define([_LT_IF_OPTION],
-[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
-
-
-# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
-# -------------------------------------------------------
-# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
-# are set.
-m4_define([_LT_UNLESS_OPTIONS],
-[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
-	    [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
-		      [m4_define([$0_found])])])[]dnl
-m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
-])[]dnl
-])
-
-
-# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
-# ----------------------------------------
-# OPTION-LIST is a space-separated list of Libtool options associated
-# with MACRO-NAME.  If any OPTION has a matching handler declared with
-# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
-# the unknown option and exit.
-m4_defun([_LT_SET_OPTIONS],
-[# Set options
-m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
-    [_LT_SET_OPTION([$1], _LT_Option)])
-
-m4_if([$1],[LT_INIT],[
-  dnl
-  dnl Simply set some default values (i.e off) if boolean options were not
-  dnl specified:
-  _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
-  ])
-  _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
-  ])
-  dnl
-  dnl If no reference was made to various pairs of opposing options, then
-  dnl we run the default mode handler for the pair.  For example, if neither
-  dnl `shared' nor `disable-shared' was passed, we enable building of shared
-  dnl archives by default:
-  _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
-  _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
-  _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
-  _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
-  		   [_LT_ENABLE_FAST_INSTALL])
-  ])
-])# _LT_SET_OPTIONS
-
-
-
-# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
-# -----------------------------------------
-m4_define([_LT_MANGLE_DEFUN],
-[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
-
-
-# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
-# -----------------------------------------------
-m4_define([LT_OPTION_DEFINE],
-[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
-])# LT_OPTION_DEFINE
-
-
-# dlopen
-# ------
-LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
-])
-
-AU_DEFUN([AC_LIBTOOL_DLOPEN],
-[_LT_SET_OPTION([LT_INIT], [dlopen])
-AC_DIAGNOSE([obsolete],
-[$0: Remove this warning and the call to _LT_SET_OPTION when you
-put the `dlopen' option into LT_INIT's first parameter.])
-])
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
-
-
-# win32-dll
-# ---------
-# Declare package support for building win32 dll's.
-LT_OPTION_DEFINE([LT_INIT], [win32-dll],
-[enable_win32_dll=yes
-
-case $host in
-*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
-  AC_CHECK_TOOL(AS, as, false)
-  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
-  AC_CHECK_TOOL(OBJDUMP, objdump, false)
-  ;;
-esac
-
-test -z "$AS" && AS=as
-_LT_DECL([], [AS],      [1], [Assembler program])dnl
-
-test -z "$DLLTOOL" && DLLTOOL=dlltool
-_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl
-
-test -z "$OBJDUMP" && OBJDUMP=objdump
-_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl
-])# win32-dll
-
-AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-_LT_SET_OPTION([LT_INIT], [win32-dll])
-AC_DIAGNOSE([obsolete],
-[$0: Remove this warning and the call to _LT_SET_OPTION when you
-put the `win32-dll' option into LT_INIT's first parameter.])
-])
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
-
-
-# _LT_ENABLE_SHARED([DEFAULT])
-# ----------------------------
-# implement the --enable-shared flag, and supports the `shared' and
-# `disable-shared' LT_INIT options.
-# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
-m4_define([_LT_ENABLE_SHARED],
-[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
-AC_ARG_ENABLE([shared],
-    [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
-	[build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
-    [p=${PACKAGE-default}
-    case $enableval in
-    yes) enable_shared=yes ;;
-    no) enable_shared=no ;;
-    *)
-      enable_shared=no
-      # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
-      for pkg in $enableval; do
-	IFS="$lt_save_ifs"
-	if test "X$pkg" = "X$p"; then
-	  enable_shared=yes
-	fi
-      done
-      IFS="$lt_save_ifs"
-      ;;
-    esac],
-    [enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
-
-    _LT_DECL([build_libtool_libs], [enable_shared], [0],
-	[Whether or not to build shared libraries])
-])# _LT_ENABLE_SHARED
-
-LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
-LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
-
-# Old names:
-AC_DEFUN([AC_ENABLE_SHARED],
-[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
-])
-
-AC_DEFUN([AC_DISABLE_SHARED],
-[_LT_SET_OPTION([LT_INIT], [disable-shared])
-])
-
-AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
-AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AM_ENABLE_SHARED], [])
-dnl AC_DEFUN([AM_DISABLE_SHARED], [])
-
-
-
-# _LT_ENABLE_STATIC([DEFAULT])
-# ----------------------------
-# implement the --enable-static flag, and support the `static' and
-# `disable-static' LT_INIT options.
-# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
-m4_define([_LT_ENABLE_STATIC],
-[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
-AC_ARG_ENABLE([static],
-    [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
-	[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
-    [p=${PACKAGE-default}
-    case $enableval in
-    yes) enable_static=yes ;;
-    no) enable_static=no ;;
-    *)
-     enable_static=no
-      # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
-      for pkg in $enableval; do
-	IFS="$lt_save_ifs"
-	if test "X$pkg" = "X$p"; then
-	  enable_static=yes
-	fi
-      done
-      IFS="$lt_save_ifs"
-      ;;
-    esac],
-    [enable_static=]_LT_ENABLE_STATIC_DEFAULT)
-
-    _LT_DECL([build_old_libs], [enable_static], [0],
-	[Whether or not to build static libraries])
-])# _LT_ENABLE_STATIC
-
-LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
-LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
-
-# Old names:
-AC_DEFUN([AC_ENABLE_STATIC],
-[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
-])
-
-AC_DEFUN([AC_DISABLE_STATIC],
-[_LT_SET_OPTION([LT_INIT], [disable-static])
-])
-
-AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
-AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AM_ENABLE_STATIC], [])
-dnl AC_DEFUN([AM_DISABLE_STATIC], [])
-
-
-
-# _LT_ENABLE_FAST_INSTALL([DEFAULT])
-# ----------------------------------
-# implement the --enable-fast-install flag, and support the `fast-install'
-# and `disable-fast-install' LT_INIT options.
-# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
-m4_define([_LT_ENABLE_FAST_INSTALL],
-[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
-AC_ARG_ENABLE([fast-install],
-    [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
-    [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
-    [p=${PACKAGE-default}
-    case $enableval in
-    yes) enable_fast_install=yes ;;
-    no) enable_fast_install=no ;;
-    *)
-      enable_fast_install=no
-      # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
-      for pkg in $enableval; do
-	IFS="$lt_save_ifs"
-	if test "X$pkg" = "X$p"; then
-	  enable_fast_install=yes
-	fi
-      done
-      IFS="$lt_save_ifs"
-      ;;
-    esac],
-    [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
-
-_LT_DECL([fast_install], [enable_fast_install], [0],
-	 [Whether or not to optimize for fast installation])dnl
-])# _LT_ENABLE_FAST_INSTALL
-
-LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
-LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
-
-# Old names:
-AU_DEFUN([AC_ENABLE_FAST_INSTALL],
-[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
-AC_DIAGNOSE([obsolete],
-[$0: Remove this warning and the call to _LT_SET_OPTION when you put
-the `fast-install' option into LT_INIT's first parameter.])
-])
-
-AU_DEFUN([AC_DISABLE_FAST_INSTALL],
-[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
-AC_DIAGNOSE([obsolete],
-[$0: Remove this warning and the call to _LT_SET_OPTION when you put
-the `disable-fast-install' option into LT_INIT's first parameter.])
-])
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
-dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
-
-
-# _LT_WITH_PIC([MODE])
-# --------------------
-# implement the --with-pic flag, and support the `pic-only' and `no-pic'
-# LT_INIT options.
-# MODE is either `yes' or `no'.  If omitted, it defaults to `both'.
-m4_define([_LT_WITH_PIC],
-[AC_ARG_WITH([pic],
-    [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
-	[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
-    [lt_p=${PACKAGE-default}
-    case $withval in
-    yes|no) pic_mode=$withval ;;
-    *)
-      pic_mode=default
-      # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
-      for lt_pkg in $withval; do
-	IFS="$lt_save_ifs"
-	if test "X$lt_pkg" = "X$lt_p"; then
-	  pic_mode=yes
-	fi
-      done
-      IFS="$lt_save_ifs"
-      ;;
-    esac],
-    [pic_mode=default])
-
-test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
-
-_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
-])# _LT_WITH_PIC
-
-LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
-LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
-
-# Old name:
-AU_DEFUN([AC_LIBTOOL_PICMODE],
-[_LT_SET_OPTION([LT_INIT], [pic-only])
-AC_DIAGNOSE([obsolete],
-[$0: Remove this warning and the call to _LT_SET_OPTION when you
-put the `pic-only' option into LT_INIT's first parameter.])
-])
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
-
-
-m4_define([_LTDL_MODE], [])
-LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
-		 [m4_define([_LTDL_MODE], [nonrecursive])])
-LT_OPTION_DEFINE([LTDL_INIT], [recursive],
-		 [m4_define([_LTDL_MODE], [recursive])])
-LT_OPTION_DEFINE([LTDL_INIT], [subproject],
-		 [m4_define([_LTDL_MODE], [subproject])])
-
-m4_define([_LTDL_TYPE], [])
-LT_OPTION_DEFINE([LTDL_INIT], [installable],
-		 [m4_define([_LTDL_TYPE], [installable])])
-LT_OPTION_DEFINE([LTDL_INIT], [convenience],
-		 [m4_define([_LTDL_TYPE], [convenience])])
-
-# ltsugar.m4 -- libtool m4 base layer.                         -*-Autoconf-*-
-#
-# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
-# Written by Gary V. Vaughan, 2004
-#
-# This file is free software; the Free Software Foundation gives
-# unlimited permission to copy and/or distribute it, with or without
-# modifications, as long as this notice is preserved.
-
-# serial 6 ltsugar.m4
-
-# This is to help aclocal find these macros, as it can't see m4_define.
-AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
-
-
-# lt_join(SEP, ARG1, [ARG2...])
-# -----------------------------
-# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
-# associated separator.
-# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
-# versions in m4sugar had bugs.
-m4_define([lt_join],
-[m4_if([$#], [1], [],
-       [$#], [2], [[$2]],
-       [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
-m4_define([_lt_join],
-[m4_if([$#$2], [2], [],
-       [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
-
-
-# lt_car(LIST)
-# lt_cdr(LIST)
-# ------------
-# Manipulate m4 lists.
-# These macros are necessary as long as will still need to support
-# Autoconf-2.59 which quotes differently.
-m4_define([lt_car], [[$1]])
-m4_define([lt_cdr],
-[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
-       [$#], 1, [],
-       [m4_dquote(m4_shift($@))])])
-m4_define([lt_unquote], $1)
-
-
-# lt_append(MACRO-NAME, STRING, [SEPARATOR])
-# ------------------------------------------
-# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
-# Note that neither SEPARATOR nor STRING are expanded; they are appended
-# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
-# No SEPARATOR is output if MACRO-NAME was previously undefined (different
-# than defined and empty).
-#
-# This macro is needed until we can rely on Autoconf 2.62, since earlier
-# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
-m4_define([lt_append],
-[m4_define([$1],
-	   m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
-
-
-
-# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
-# ----------------------------------------------------------
-# Produce a SEP delimited list of all paired combinations of elements of
-# PREFIX-LIST with SUFFIX1 through SUFFIXn.  Each element of the list
-# has the form PREFIXmINFIXSUFFIXn.
-# Needed until we can rely on m4_combine added in Autoconf 2.62.
-m4_define([lt_combine],
-[m4_if(m4_eval([$# > 3]), [1],
-       [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
-[[m4_foreach([_Lt_prefix], [$2],
-	     [m4_foreach([_Lt_suffix],
-		]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
-	[_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
-
-
-# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
-# -----------------------------------------------------------------------
-# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
-# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
-m4_define([lt_if_append_uniq],
-[m4_ifdef([$1],
-	  [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
-		 [lt_append([$1], [$2], [$3])$4],
-		 [$5])],
-	  [lt_append([$1], [$2], [$3])$4])])
-
-
-# lt_dict_add(DICT, KEY, VALUE)
-# -----------------------------
-m4_define([lt_dict_add],
-[m4_define([$1($2)], [$3])])
-
-
-# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
-# --------------------------------------------
-m4_define([lt_dict_add_subkey],
-[m4_define([$1($2:$3)], [$4])])
-
-
-# lt_dict_fetch(DICT, KEY, [SUBKEY])
-# ----------------------------------
-m4_define([lt_dict_fetch],
-[m4_ifval([$3],
-	m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
-    m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
-
-
-# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
-# -----------------------------------------------------------------
-m4_define([lt_if_dict_fetch],
-[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
-	[$5],
-    [$6])])
-
-
-# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
-# --------------------------------------------------------------
-m4_define([lt_dict_filter],
-[m4_if([$5], [], [],
-  [lt_join(m4_quote(m4_default([$4], [[, ]])),
-           lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
-		      [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
-])
-
-# ltversion.m4 -- version numbers			-*- Autoconf -*-
-#
-#   Copyright (C) 2004 Free Software Foundation, Inc.
-#   Written by Scott James Remnant, 2004
-#
-# This file is free software; the Free Software Foundation gives
-# unlimited permission to copy and/or distribute it, with or without
-# modifications, as long as this notice is preserved.
-
-# @configure_input@
-
-# serial 3337 ltversion.m4
-# This file is part of GNU Libtool
-
-m4_define([LT_PACKAGE_VERSION], [2.4.2])
-m4_define([LT_PACKAGE_REVISION], [1.3337])
-
-AC_DEFUN([LTVERSION_VERSION],
-[macro_version='2.4.2'
-macro_revision='1.3337'
-_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
-_LT_DECL(, macro_revision, 0)
-])
-
-# lt~obsolete.m4 -- aclocal satisfying obsolete definitions.    -*-Autoconf-*-
-#
-#   Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
-#   Written by Scott James Remnant, 2004.
-#
-# This file is free software; the Free Software Foundation gives
-# unlimited permission to copy and/or distribute it, with or without
-# modifications, as long as this notice is preserved.
-
-# serial 5 lt~obsolete.m4
-
-# These exist entirely to fool aclocal when bootstrapping libtool.
-#
-# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
-# which have later been changed to m4_define as they aren't part of the
-# exported API, or moved to Autoconf or Automake where they belong.
-#
-# The trouble is, aclocal is a bit thick.  It'll see the old AC_DEFUN
-# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
-# using a macro with the same name in our local m4/libtool.m4 it'll
-# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
-# and doesn't know about Autoconf macros at all.)
-#
-# So we provide this file, which has a silly filename so it's always
-# included after everything else.  This provides aclocal with the
-# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
-# because those macros already exist, or will be overwritten later.
-# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. 
-#
-# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
-# Yes, that means every name once taken will need to remain here until
-# we give up compatibility with versions before 1.7, at which point
-# we need to keep only those names which we still refer to.
-
-# This is to help aclocal find these macros, as it can't see m4_define.
-AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
-
-m4_ifndef([AC_LIBTOOL_LINKER_OPTION],	[AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
-m4_ifndef([AC_PROG_EGREP],		[AC_DEFUN([AC_PROG_EGREP])])
-m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH],	[AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
-m4_ifndef([_LT_AC_SHELL_INIT],		[AC_DEFUN([_LT_AC_SHELL_INIT])])
-m4_ifndef([_LT_AC_SYS_LIBPATH_AIX],	[AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
-m4_ifndef([_LT_PROG_LTMAIN],		[AC_DEFUN([_LT_PROG_LTMAIN])])
-m4_ifndef([_LT_AC_TAGVAR],		[AC_DEFUN([_LT_AC_TAGVAR])])
-m4_ifndef([AC_LTDL_ENABLE_INSTALL],	[AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
-m4_ifndef([AC_LTDL_PREOPEN],		[AC_DEFUN([AC_LTDL_PREOPEN])])
-m4_ifndef([_LT_AC_SYS_COMPILER],	[AC_DEFUN([_LT_AC_SYS_COMPILER])])
-m4_ifndef([_LT_AC_LOCK],		[AC_DEFUN([_LT_AC_LOCK])])
-m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE],	[AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
-m4_ifndef([_LT_AC_TRY_DLOPEN_SELF],	[AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
-m4_ifndef([AC_LIBTOOL_PROG_CC_C_O],	[AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
-m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
-m4_ifndef([AC_LIBTOOL_OBJDIR],		[AC_DEFUN([AC_LIBTOOL_OBJDIR])])
-m4_ifndef([AC_LTDL_OBJDIR],		[AC_DEFUN([AC_LTDL_OBJDIR])])
-m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
-m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP],	[AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
-m4_ifndef([AC_PATH_MAGIC],		[AC_DEFUN([AC_PATH_MAGIC])])
-m4_ifndef([AC_PROG_LD_GNU],		[AC_DEFUN([AC_PROG_LD_GNU])])
-m4_ifndef([AC_PROG_LD_RELOAD_FLAG],	[AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
-m4_ifndef([AC_DEPLIBS_CHECK_METHOD],	[AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
-m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
-m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
-m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
-m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS],	[AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
-m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP],	[AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
-m4_ifndef([LT_AC_PROG_EGREP],		[AC_DEFUN([LT_AC_PROG_EGREP])])
-m4_ifndef([LT_AC_PROG_SED],		[AC_DEFUN([LT_AC_PROG_SED])])
-m4_ifndef([_LT_CC_BASENAME],		[AC_DEFUN([_LT_CC_BASENAME])])
-m4_ifndef([_LT_COMPILER_BOILERPLATE],	[AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
-m4_ifndef([_LT_LINKER_BOILERPLATE],	[AC_DEFUN([_LT_LINKER_BOILERPLATE])])
-m4_ifndef([_AC_PROG_LIBTOOL],		[AC_DEFUN([_AC_PROG_LIBTOOL])])
-m4_ifndef([AC_LIBTOOL_SETUP],		[AC_DEFUN([AC_LIBTOOL_SETUP])])
-m4_ifndef([_LT_AC_CHECK_DLFCN],		[AC_DEFUN([_LT_AC_CHECK_DLFCN])])
-m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER],	[AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
-m4_ifndef([_LT_AC_TAGCONFIG],		[AC_DEFUN([_LT_AC_TAGCONFIG])])
-m4_ifndef([AC_DISABLE_FAST_INSTALL],	[AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
-m4_ifndef([_LT_AC_LANG_CXX],		[AC_DEFUN([_LT_AC_LANG_CXX])])
-m4_ifndef([_LT_AC_LANG_F77],		[AC_DEFUN([_LT_AC_LANG_F77])])
-m4_ifndef([_LT_AC_LANG_GCJ],		[AC_DEFUN([_LT_AC_LANG_GCJ])])
-m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
-m4_ifndef([_LT_AC_LANG_C_CONFIG],	[AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
-m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
-m4_ifndef([_LT_AC_LANG_CXX_CONFIG],	[AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
-m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
-m4_ifndef([_LT_AC_LANG_F77_CONFIG],	[AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
-m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
-m4_ifndef([_LT_AC_LANG_GCJ_CONFIG],	[AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
-m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
-m4_ifndef([_LT_AC_LANG_RC_CONFIG],	[AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
-m4_ifndef([AC_LIBTOOL_CONFIG],		[AC_DEFUN([AC_LIBTOOL_CONFIG])])
-m4_ifndef([_LT_AC_FILE_LTDLL_C],	[AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
-m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS],	[AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])
-m4_ifndef([_LT_AC_PROG_CXXCPP],		[AC_DEFUN([_LT_AC_PROG_CXXCPP])])
-m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS],	[AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])
-m4_ifndef([_LT_PROG_ECHO_BACKSLASH],	[AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])
-m4_ifndef([_LT_PROG_F77],		[AC_DEFUN([_LT_PROG_F77])])
-m4_ifndef([_LT_PROG_FC],		[AC_DEFUN([_LT_PROG_FC])])
-m4_ifndef([_LT_PROG_CXX],		[AC_DEFUN([_LT_PROG_CXX])])
-
-# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software
-# Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 1
-
-# AM_AUTOMAKE_VERSION(VERSION)
-# ----------------------------
-# Automake X.Y traces this macro to ensure aclocal.m4 has been
-# generated from the m4 files accompanying Automake X.Y.
-# (This private macro should not be called outside this file.)
-AC_DEFUN([AM_AUTOMAKE_VERSION],
-[am__api_version='1.11'
-dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
-dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.11.3], [],
-      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
-])
-
-# _AM_AUTOCONF_VERSION(VERSION)
-# -----------------------------
-# aclocal traces this macro to find the Autoconf version.
-# This is a private macro too.  Using m4_define simplifies
-# the logic in aclocal, which can simply ignore this definition.
-m4_define([_AM_AUTOCONF_VERSION], [])
-
-# AM_SET_CURRENT_AUTOMAKE_VERSION
-# -------------------------------
-# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
-# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
-AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.11.3])dnl
-m4_ifndef([AC_AUTOCONF_VERSION],
-  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
-_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
-
-# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
-
-# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 1
-
-# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
-# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
-# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
-#
-# Of course, Automake must honor this variable whenever it calls a
-# tool from the auxiliary directory.  The problem is that $srcdir (and
-# therefore $ac_aux_dir as well) can be either absolute or relative,
-# depending on how configure is run.  This is pretty annoying, since
-# it makes $ac_aux_dir quite unusable in subdirectories: in the top
-# source directory, any form will work fine, but in subdirectories a
-# relative path needs to be adjusted first.
-#
-# $ac_aux_dir/missing
-#    fails when called from a subdirectory if $ac_aux_dir is relative
-# $top_srcdir/$ac_aux_dir/missing
-#    fails if $ac_aux_dir is absolute,
-#    fails when called from a subdirectory in a VPATH build with
-#          a relative $ac_aux_dir
-#
-# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
-# are both prefixed by $srcdir.  In an in-source build this is usually
-# harmless because $srcdir is `.', but things will broke when you
-# start a VPATH build or use an absolute $srcdir.
-#
-# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
-# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
-#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
-# and then we would define $MISSING as
-#   MISSING="\${SHELL} $am_aux_dir/missing"
-# This will work as long as MISSING is not called from configure, because
-# unfortunately $(top_srcdir) has no meaning in configure.
-# However there are other variables, like CC, which are often used in
-# configure, and could therefore not use this "fixed" $ac_aux_dir.
-#
-# Another solution, used here, is to always expand $ac_aux_dir to an
-# absolute PATH.  The drawback is that using absolute paths prevent a
-# configured tree to be moved without reconfiguration.
-
-AC_DEFUN([AM_AUX_DIR_EXPAND],
-[dnl Rely on autoconf to set up CDPATH properly.
-AC_PREREQ([2.50])dnl
-# expand $ac_aux_dir to an absolute path
-am_aux_dir=`cd $ac_aux_dir && pwd`
-])
-
-# AM_CONDITIONAL                                            -*- Autoconf -*-
-
-# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
-# Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 9
-
-# AM_CONDITIONAL(NAME, SHELL-CONDITION)
-# -------------------------------------
-# Define a conditional.
-AC_DEFUN([AM_CONDITIONAL],
-[AC_PREREQ(2.52)dnl
- ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
-	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
-AC_SUBST([$1_TRUE])dnl
-AC_SUBST([$1_FALSE])dnl
-_AM_SUBST_NOTMAKE([$1_TRUE])dnl
-_AM_SUBST_NOTMAKE([$1_FALSE])dnl
-m4_define([_AM_COND_VALUE_$1], [$2])dnl
-if $2; then
-  $1_TRUE=
-  $1_FALSE='#'
-else
-  $1_TRUE='#'
-  $1_FALSE=
-fi
-AC_CONFIG_COMMANDS_PRE(
-[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
-  AC_MSG_ERROR([[conditional "$1" was never defined.
-Usually this means the macro was only invoked conditionally.]])
-fi])])
-
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009,
-# 2010, 2011 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 12
-
-# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
-# written in clear, in which case automake, when reading aclocal.m4,
-# will think it sees a *use*, and therefore will trigger all it's
-# C support machinery.  Also note that it means that autoscan, seeing
-# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
-
-
-# _AM_DEPENDENCIES(NAME)
-# ----------------------
-# See how the compiler implements dependency checking.
-# NAME is "CC", "CXX", "GCJ", or "OBJC".
-# We try a few techniques and use that to set a single cache variable.
-#
-# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
-# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
-# dependency, and given that the user is not expected to run this macro,
-# just rely on AC_PROG_CC.
-AC_DEFUN([_AM_DEPENDENCIES],
-[AC_REQUIRE([AM_SET_DEPDIR])dnl
-AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
-AC_REQUIRE([AM_MAKE_INCLUDE])dnl
-AC_REQUIRE([AM_DEP_TRACK])dnl
-
-ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
-       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
-       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
-       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
-       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
-                   [depcc="$$1"   am_compiler_list=])
-
-AC_CACHE_CHECK([dependency style of $depcc],
-               [am_cv_$1_dependencies_compiler_type],
-[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
-  # We make a subdir and do the tests there.  Otherwise we can end up
-  # making bogus files that we don't know about and never remove.  For
-  # instance it was reported that on HP-UX the gcc test will end up
-  # making a dummy file named `D' -- because `-MD' means `put the output
-  # in D'.
-  rm -rf conftest.dir
-  mkdir conftest.dir
-  # Copy depcomp to subdir because otherwise we won't find it if we're
-  # using a relative directory.
-  cp "$am_depcomp" conftest.dir
-  cd conftest.dir
-  # We will build objects and dependencies in a subdirectory because
-  # it helps to detect inapplicable dependency modes.  For instance
-  # both Tru64's cc and ICC support -MD to output dependencies as a
-  # side effect of compilation, but ICC will put the dependencies in
-  # the current directory while Tru64 will put them in the object
-  # directory.
-  mkdir sub
-
-  am_cv_$1_dependencies_compiler_type=none
-  if test "$am_compiler_list" = ""; then
-     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
-  fi
-  am__universal=false
-  m4_case([$1], [CC],
-    [case " $depcc " in #(
-     *\ -arch\ *\ -arch\ *) am__universal=true ;;
-     esac],
-    [CXX],
-    [case " $depcc " in #(
-     *\ -arch\ *\ -arch\ *) am__universal=true ;;
-     esac])
-
-  for depmode in $am_compiler_list; do
-    # Setup a source with many dependencies, because some compilers
-    # like to wrap large dependency lists on column 80 (with \), and
-    # we should not choose a depcomp mode which is confused by this.
-    #
-    # We need to recreate these files for each test, as the compiler may
-    # overwrite some of them when testing with obscure command lines.
-    # This happens at least with the AIX C compiler.
-    : > sub/conftest.c
-    for i in 1 2 3 4 5 6; do
-      echo '#include "conftst'$i'.h"' >> sub/conftest.c
-      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
-      # Solaris 8's {/usr,}/bin/sh.
-      touch sub/conftst$i.h
-    done
-    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
-
-    # We check with `-c' and `-o' for the sake of the "dashmstdout"
-    # mode.  It turns out that the SunPro C++ compiler does not properly
-    # handle `-M -o', and we need to detect this.  Also, some Intel
-    # versions had trouble with output in subdirs
-    am__obj=sub/conftest.${OBJEXT-o}
-    am__minus_obj="-o $am__obj"
-    case $depmode in
-    gcc)
-      # This depmode causes a compiler race in universal mode.
-      test "$am__universal" = false || continue
-      ;;
-    nosideeffect)
-      # after this tag, mechanisms are not by side-effect, so they'll
-      # only be used when explicitly requested
-      if test "x$enable_dependency_tracking" = xyes; then
-	continue
-      else
-	break
-      fi
-      ;;
-    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
-      # This compiler won't grok `-c -o', but also, the minuso test has
-      # not run yet.  These depmodes are late enough in the game, and
-      # so weak that their functioning should not be impacted.
-      am__obj=conftest.${OBJEXT-o}
-      am__minus_obj=
-      ;;
-    none) break ;;
-    esac
-    if depmode=$depmode \
-       source=sub/conftest.c object=$am__obj \
-       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
-       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
-         >/dev/null 2>conftest.err &&
-       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
-       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
-       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
-       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
-      # icc doesn't choke on unknown options, it will just issue warnings
-      # or remarks (even with -Werror).  So we grep stderr for any message
-      # that says an option was ignored or not supported.
-      # When given -MP, icc 7.0 and 7.1 complain thusly:
-      #   icc: Command line warning: ignoring option '-M'; no argument required
-      # The diagnosis changed in icc 8.0:
-      #   icc: Command line remark: option '-MP' not supported
-      if (grep 'ignoring option' conftest.err ||
-          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
-        am_cv_$1_dependencies_compiler_type=$depmode
-        break
-      fi
-    fi
-  done
-
-  cd ..
-  rm -rf conftest.dir
-else
-  am_cv_$1_dependencies_compiler_type=none
-fi
-])
-AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
-AM_CONDITIONAL([am__fastdep$1], [
-  test "x$enable_dependency_tracking" != xno \
-  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
-])
-
-
-# AM_SET_DEPDIR
-# -------------
-# Choose a directory name for dependency files.
-# This macro is AC_REQUIREd in _AM_DEPENDENCIES
-AC_DEFUN([AM_SET_DEPDIR],
-[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
-AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
-])
-
-
-# AM_DEP_TRACK
-# ------------
-AC_DEFUN([AM_DEP_TRACK],
-[AC_ARG_ENABLE(dependency-tracking,
-[  --disable-dependency-tracking  speeds up one-time build
-  --enable-dependency-tracking   do not reject slow dependency extractors])
-if test "x$enable_dependency_tracking" != xno; then
-  am_depcomp="$ac_aux_dir/depcomp"
-  AMDEPBACKSLASH='\'
-  am__nodep='_no'
-fi
-AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
-AC_SUBST([AMDEPBACKSLASH])dnl
-_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
-AC_SUBST([am__nodep])dnl
-_AM_SUBST_NOTMAKE([am__nodep])dnl
-])
-
-# Generate code to set up dependency tracking.              -*- Autoconf -*-
-
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
-# Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-#serial 5
-
-# _AM_OUTPUT_DEPENDENCY_COMMANDS
-# ------------------------------
-AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
-[{
-  # Autoconf 2.62 quotes --file arguments for eval, but not when files
-  # are listed without --file.  Let's play safe and only enable the eval
-  # if we detect the quoting.
-  case $CONFIG_FILES in
-  *\'*) eval set x "$CONFIG_FILES" ;;
-  *)   set x $CONFIG_FILES ;;
+# _LT_PROG_XSI_SHELLFNS
+# ---------------------
+# Bourne and XSI compatible variants of some useful shell functions.
+m4_defun([_LT_PROG_XSI_SHELLFNS],
+[case $xsi_shell in
+  yes)
+    cat << \_LT_EOF >> "$cfgfile"
+
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+  case ${1} in
+    */*) func_dirname_result="${1%/*}${2}" ;;
+    *  ) func_dirname_result="${3}" ;;
   esac
-  shift
-  for mf
-  do
-    # Strip MF so we end up with the name of the file.
-    mf=`echo "$mf" | sed -e 's/:.*$//'`
-    # Check whether this is an Automake generated Makefile or not.
-    # We used to match only the files named `Makefile.in', but
-    # some people rename them; so instead we look at the file content.
-    # Grep'ing the first line is not enough: some people post-process
-    # each Makefile.in and add a new line on top of each file to say so.
-    # Grep'ing the whole file is not good either: AIX grep has a line
-    # limit of 2048, but all sed's we know have understand at least 4000.
-    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
-      dirpart=`AS_DIRNAME("$mf")`
-    else
-      continue
-    fi
-    # Extract the definition of DEPDIR, am__include, and am__quote
-    # from the Makefile without running `make'.
-    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
-    test -z "$DEPDIR" && continue
-    am__include=`sed -n 's/^am__include = //p' < "$mf"`
-    test -z "am__include" && continue
-    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
-    # When using ansi2knr, U may be empty or an underscore; expand it
-    U=`sed -n 's/^U = //p' < "$mf"`
-    # Find all dependency output files, they are included files with
-    # $(DEPDIR) in their names.  We invoke sed twice because it is the
-    # simplest approach to changing $(DEPDIR) to its actual value in the
-    # expansion.
-    for file in `sed -n "
-      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
-	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
-      # Make sure the directory exists.
-      test -f "$dirpart/$file" && continue
-      fdir=`AS_DIRNAME(["$file"])`
-      AS_MKDIR_P([$dirpart/$fdir])
-      # echo "creating $dirpart/$file"
-      echo '# dummy' > "$dirpart/$file"
-    done
-  done
 }
-])# _AM_OUTPUT_DEPENDENCY_COMMANDS
-
-
-# AM_OUTPUT_DEPENDENCY_COMMANDS
-# -----------------------------
-# This macro should only be invoked once -- use via AC_REQUIRE.
-#
-# This code is only required when automatic dependency tracking
-# is enabled.  FIXME.  This creates each `.P' file that we will
-# need in order to bootstrap the dependency handling code.
-AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
-[AC_CONFIG_COMMANDS([depfiles],
-     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
-     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
-])
-
-# Do all the work for Automake.                             -*- Autoconf -*-
-
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 16
-
-# This macro actually does too much.  Some checks are only needed if
-# your package does certain things.  But this isn't really a big deal.
-
-# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
-# AM_INIT_AUTOMAKE([OPTIONS])
-# -----------------------------------------------
-# The call with PACKAGE and VERSION arguments is the old style
-# call (pre autoconf-2.50), which is being phased out.  PACKAGE
-# and VERSION should now be passed to AC_INIT and removed from
-# the call to AM_INIT_AUTOMAKE.
-# We support both call styles for the transition.  After
-# the next Automake release, Autoconf can make the AC_INIT
-# arguments mandatory, and then we can depend on a new Autoconf
-# release and drop the old call support.
-AC_DEFUN([AM_INIT_AUTOMAKE],
-[AC_PREREQ([2.62])dnl
-dnl Autoconf wants to disallow AM_ names.  We explicitly allow
-dnl the ones we care about.
-m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
-AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
-AC_REQUIRE([AC_PROG_INSTALL])dnl
-if test "`cd $srcdir && pwd`" != "`pwd`"; then
-  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
-  # is not polluted with repeated "-I."
-  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
-  # test to see if srcdir already configured
-  if test -f $srcdir/config.status; then
-    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
-  fi
-fi
 
-# test whether we have cygpath
-if test -z "$CYGPATH_W"; then
-  if (cygpath --version) >/dev/null 2>/dev/null; then
-    CYGPATH_W='cygpath -w'
-  else
-    CYGPATH_W=echo
-  fi
-fi
-AC_SUBST([CYGPATH_W])
-
-# Define the identity of the package.
-dnl Distinguish between old-style and new-style calls.
-m4_ifval([$2],
-[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
- AC_SUBST([PACKAGE], [$1])dnl
- AC_SUBST([VERSION], [$2])],
-[_AM_SET_OPTIONS([$1])dnl
-dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
-m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
-  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
- AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
- AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
-
-_AM_IF_OPTION([no-define],,
-[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
- AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
-
-# Some tools Automake needs.
-AC_REQUIRE([AM_SANITY_CHECK])dnl
-AC_REQUIRE([AC_ARG_PROGRAM])dnl
-AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
-AM_MISSING_PROG(AUTOCONF, autoconf)
-AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
-AM_MISSING_PROG(AUTOHEADER, autoheader)
-AM_MISSING_PROG(MAKEINFO, makeinfo)
-AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
-AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
-AC_REQUIRE([AM_PROG_MKDIR_P])dnl
-# We need awk for the "check" target.  The system "awk" is bad on
-# some platforms.
-AC_REQUIRE([AC_PROG_AWK])dnl
-AC_REQUIRE([AC_PROG_MAKE_SET])dnl
-AC_REQUIRE([AM_SET_LEADING_DOT])dnl
-_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
-	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
-			     [_AM_PROG_TAR([v7])])])
-_AM_IF_OPTION([no-dependencies],,
-[AC_PROVIDE_IFELSE([AC_PROG_CC],
-		  [_AM_DEPENDENCIES(CC)],
-		  [define([AC_PROG_CC],
-			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
-AC_PROVIDE_IFELSE([AC_PROG_CXX],
-		  [_AM_DEPENDENCIES(CXX)],
-		  [define([AC_PROG_CXX],
-			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
-AC_PROVIDE_IFELSE([AC_PROG_OBJC],
-		  [_AM_DEPENDENCIES(OBJC)],
-		  [define([AC_PROG_OBJC],
-			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
-])
-_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
-dnl The `parallel-tests' driver may need to know about EXEEXT, so add the
-dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
-dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
-AC_CONFIG_COMMANDS_PRE(dnl
-[m4_provide_if([_AM_COMPILER_EXEEXT],
-  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
-])
+# func_basename file
+func_basename ()
+{
+  func_basename_result="${1##*/}"
+}
 
-dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
-dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
-dnl mangled by Autoconf and run in a shell conditional statement.
-m4_define([_AC_COMPILER_EXEEXT],
-m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
-
-
-# When config.status generates a header, we must update the stamp-h file.
-# This file resides in the same directory as the config header
-# that is generated.  The stamp files are numbered to have different names.
-
-# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
-# loop where config.status creates the headers, so we can generate
-# our stamp files there.
-AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
-[# Compute $1's index in $config_headers.
-_am_arg=$1
-_am_stamp_count=1
-for _am_header in $config_headers :; do
-  case $_am_header in
-    $_am_arg | $_am_arg:* )
-      break ;;
-    * )
-      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+# func_dirname_and_basename file append nondir_replacement
+# perform func_basename and func_dirname in a single function
+# call:
+#   dirname:  Compute the dirname of FILE.  If nonempty,
+#             add APPEND to the result, otherwise set result
+#             to NONDIR_REPLACEMENT.
+#             value returned in "$func_dirname_result"
+#   basename: Compute filename of FILE.
+#             value retuned in "$func_basename_result"
+# Implementation must be kept synchronized with func_dirname
+# and func_basename. For efficiency, we do not delegate to
+# those functions but instead duplicate the functionality here.
+func_dirname_and_basename ()
+{
+  case ${1} in
+    */*) func_dirname_result="${1%/*}${2}" ;;
+    *  ) func_dirname_result="${3}" ;;
   esac
-done
-echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
+  func_basename_result="${1##*/}"
+}
 
-# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation,
-# Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+func_stripname ()
+{
+  # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
+  # positional parameters, so assign one to ordinary parameter first.
+  func_stripname_result=${3}
+  func_stripname_result=${func_stripname_result#"${1}"}
+  func_stripname_result=${func_stripname_result%"${2}"}
+}
 
-# serial 1
+# func_opt_split
+func_opt_split ()
+{
+  func_opt_split_opt=${1%%=*}
+  func_opt_split_arg=${1#*=}
+}
 
-# AM_PROG_INSTALL_SH
-# ------------------
-# Define $install_sh.
-AC_DEFUN([AM_PROG_INSTALL_SH],
-[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
-if test x"${install_sh}" != xset; then
-  case $am_aux_dir in
-  *\ * | *\	*)
-    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
-  *)
-    install_sh="\${SHELL} $am_aux_dir/install-sh"
+# func_lo2o object
+func_lo2o ()
+{
+  case ${1} in
+    *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
+    *)    func_lo2o_result=${1} ;;
   esac
-fi
-AC_SUBST(install_sh)])
-
-# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 2
-
-# Check whether the underlying file-system supports filenames
-# with a leading dot.  For instance MS-DOS doesn't.
-AC_DEFUN([AM_SET_LEADING_DOT],
-[rm -rf .tst 2>/dev/null
-mkdir .tst 2>/dev/null
-if test -d .tst; then
-  am__leading_dot=.
-else
-  am__leading_dot=_
-fi
-rmdir .tst 2>/dev/null
-AC_SUBST([am__leading_dot])])
+}
 
-# Check to see how 'make' treats includes.	            -*- Autoconf -*-
+# func_xform libobj-or-source
+func_xform ()
+{
+  func_xform_result=${1%.*}.lo
+}
 
-# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 4
-
-# AM_MAKE_INCLUDE()
-# -----------------
-# Check to see how make treats includes.
-AC_DEFUN([AM_MAKE_INCLUDE],
-[am_make=${MAKE-make}
-cat > confinc << 'END'
-am__doit:
-	@echo this is the am__doit target
-.PHONY: am__doit
-END
-# If we don't find an include directive, just comment out the code.
-AC_MSG_CHECKING([for style of include used by $am_make])
-am__include="#"
-am__quote=
-_am_result=none
-# First try GNU make style include.
-echo "include confinc" > confmf
-# Ignore all kinds of additional output from `make'.
-case `$am_make -s -f confmf 2> /dev/null` in #(
-*the\ am__doit\ target*)
-  am__include=include
-  am__quote=
-  _am_result=GNU
-  ;;
-esac
-# Now try BSD make style include.
-if test "$am__include" = "#"; then
-   echo '.include "confinc"' > confmf
-   case `$am_make -s -f confmf 2> /dev/null` in #(
-   *the\ am__doit\ target*)
-     am__include=.include
-     am__quote="\""
-     _am_result=BSD
-     ;;
-   esac
-fi
-AC_SUBST([am__include])
-AC_SUBST([am__quote])
-AC_MSG_RESULT([$_am_result])
-rm -f confinc confmf
-])
+# func_arith arithmetic-term...
+func_arith ()
+{
+  func_arith_result=$(( $[*] ))
+}
 
-# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
+# func_len string
+# STRING may not start with a hyphen.
+func_len ()
+{
+  func_len_result=${#1}
+}
 
-# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
-# Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
+_LT_EOF
+    ;;
+  *) # Bourne compatible functions.
+    cat << \_LT_EOF >> "$cfgfile"
 
-# serial 6
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+  # Extract subdirectory from the argument.
+  func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
+  if test "X$func_dirname_result" = "X${1}"; then
+    func_dirname_result="${3}"
+  else
+    func_dirname_result="$func_dirname_result${2}"
+  fi
+}
 
-# AM_MISSING_PROG(NAME, PROGRAM)
-# ------------------------------
-AC_DEFUN([AM_MISSING_PROG],
-[AC_REQUIRE([AM_MISSING_HAS_RUN])
-$1=${$1-"${am_missing_run}$2"}
-AC_SUBST($1)])
+# func_basename file
+func_basename ()
+{
+  func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
+}
 
+dnl func_dirname_and_basename
+dnl A portable version of this function is already defined in general.m4sh
+dnl so there is no need for it here.
 
-# AM_MISSING_HAS_RUN
-# ------------------
-# Define MISSING if not defined so far and test if it supports --run.
-# If it does, set am_missing_run to use it, otherwise, to nothing.
-AC_DEFUN([AM_MISSING_HAS_RUN],
-[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
-AC_REQUIRE_AUX_FILE([missing])dnl
-if test x"${MISSING+set}" != xset; then
-  case $am_aux_dir in
-  *\ * | *\	*)
-    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
-  *)
-    MISSING="\${SHELL} $am_aux_dir/missing" ;;
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+# func_strip_suffix prefix name
+func_stripname ()
+{
+  case ${2} in
+    .*) func_stripname_result=`$ECHO "X${3}" \
+           | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;;
+    *)  func_stripname_result=`$ECHO "X${3}" \
+           | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;;
   esac
-fi
-# Use eval to expand $SHELL
-if eval "$MISSING --run true"; then
-  am_missing_run="$MISSING --run "
-else
-  am_missing_run=
-  AC_MSG_WARN([`missing' script is too old or missing])
-fi
-])
-
-# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation,
-# Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 1
-
-# AM_PROG_MKDIR_P
-# ---------------
-# Check for `mkdir -p'.
-AC_DEFUN([AM_PROG_MKDIR_P],
-[AC_PREREQ([2.60])dnl
-AC_REQUIRE([AC_PROG_MKDIR_P])dnl
-dnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
-dnl while keeping a definition of mkdir_p for backward compatibility.
-dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
-dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
-dnl Makefile.ins that do not define MKDIR_P, so we do our own
-dnl adjustment using top_builddir (which is defined more often than
-dnl MKDIR_P).
-AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
-case $mkdir_p in
-  [[\\/$]]* | ?:[[\\/]]*) ;;
-  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
-esac
-])
-
-# Helper functions for option handling.                     -*- Autoconf -*-
-
-# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software
-# Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 5
-
-# _AM_MANGLE_OPTION(NAME)
-# -----------------------
-AC_DEFUN([_AM_MANGLE_OPTION],
-[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
-
-# _AM_SET_OPTION(NAME)
-# --------------------
-# Set option NAME.  Presently that only means defining a flag for this option.
-AC_DEFUN([_AM_SET_OPTION],
-[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
-
-# _AM_SET_OPTIONS(OPTIONS)
-# ------------------------
-# OPTIONS is a space-separated list of Automake options.
-AC_DEFUN([_AM_SET_OPTIONS],
-[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
-
-# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
-# -------------------------------------------
-# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
-AC_DEFUN([_AM_IF_OPTION],
-[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+}
 
-# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
+# sed scripts:
+my_sed_long_opt='1s/^\(-[[^=]]*\)=.*/\1/;q'
+my_sed_long_arg='1s/^-[[^=]]*=//'
 
-# serial 1
+# func_opt_split
+func_opt_split ()
+{
+  func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"`
+  func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"`
+}
 
-# AM_RUN_LOG(COMMAND)
-# -------------------
-# Run COMMAND, save the exit status in ac_status, and log it.
-# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
-AC_DEFUN([AM_RUN_LOG],
-[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
-   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
-   ac_status=$?
-   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
-   (exit $ac_status); }])
+# func_lo2o object
+func_lo2o ()
+{
+  func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"`
+}
 
-# Check to make sure that the build environment is sane.    -*- Autoconf -*-
+# func_xform libobj-or-source
+func_xform ()
+{
+  func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[[^.]]*$/.lo/'`
+}
 
-# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
-# Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
+# func_arith arithmetic-term...
+func_arith ()
+{
+  func_arith_result=`expr "$[@]"`
+}
 
-# serial 5
+# func_len string
+# STRING may not start with a hyphen.
+func_len ()
+{
+  func_len_result=`expr "$[1]" : ".*" 2>/dev/null || echo $max_cmd_len`
+}
 
-# AM_SANITY_CHECK
-# ---------------
-AC_DEFUN([AM_SANITY_CHECK],
-[AC_MSG_CHECKING([whether build environment is sane])
-# Just in case
-sleep 1
-echo timestamp > conftest.file
-# Reject unsafe characters in $srcdir or the absolute working directory
-# name.  Accept space and tab only in the latter.
-am_lf='
-'
-case `pwd` in
-  *[[\\\"\#\$\&\'\`$am_lf]]*)
-    AC_MSG_ERROR([unsafe absolute working directory name]);;
-esac
-case $srcdir in
-  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
-    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
+_LT_EOF
 esac
 
-# Do `set' in a subshell so we don't clobber the current shell's
-# arguments.  Must try -L first in case configure is actually a
-# symlink; some systems play weird games with the mod time of symlinks
-# (eg FreeBSD returns the mod time of the symlink's containing
-# directory).
-if (
-   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
-   if test "$[*]" = "X"; then
-      # -L didn't work.
-      set X `ls -t "$srcdir/configure" conftest.file`
-   fi
-   rm -f conftest.file
-   if test "$[*]" != "X $srcdir/configure conftest.file" \
-      && test "$[*]" != "X conftest.file $srcdir/configure"; then
-
-      # If neither matched, then we have a broken ls.  This can happen
-      # if, for instance, CONFIG_SHELL is bash and it inherits a
-      # broken ls alias from the environment.  This has actually
-      # happened.  Such a system could not be considered "sane".
-      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
-alias in your environment])
-   fi
+case $lt_shell_append in
+  yes)
+    cat << \_LT_EOF >> "$cfgfile"
 
-   test "$[2]" = conftest.file
-   )
-then
-   # Ok.
-   :
-else
-   AC_MSG_ERROR([newly created file is older than distributed files!
-Check your system clock])
-fi
-AC_MSG_RESULT(yes)])
-
-# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 1
-
-# AM_PROG_INSTALL_STRIP
-# ---------------------
-# One issue with vendor `install' (even GNU) is that you can't
-# specify the program used to strip binaries.  This is especially
-# annoying in cross-compiling environments, where the build's strip
-# is unlikely to handle the host's binaries.
-# Fortunately install-sh will honor a STRIPPROG variable, so we
-# always use install-sh in `make install-strip', and initialize
-# STRIPPROG with the value of the STRIP variable (set by the user).
-AC_DEFUN([AM_PROG_INSTALL_STRIP],
-[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
-# Installed binaries are usually stripped using `strip' when the user
-# run `make install-strip'.  However `strip' might not be the right
-# tool to use in cross-compilation environments, therefore Automake
-# will honor the `STRIP' environment variable to overrule this program.
-dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
-if test "$cross_compiling" != no; then
-  AC_CHECK_TOOL([STRIP], [strip], :)
-fi
-INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
-AC_SUBST([INSTALL_STRIP_PROGRAM])])
-
-# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 3
-
-# _AM_SUBST_NOTMAKE(VARIABLE)
-# ---------------------------
-# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
-# This macro is traced by Automake.
-AC_DEFUN([_AM_SUBST_NOTMAKE])
-
-# AM_SUBST_NOTMAKE(VARIABLE)
-# --------------------------
-# Public sister of _AM_SUBST_NOTMAKE.
-AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
-
-# Check how to create a tarball.                            -*- Autoconf -*-
-
-# Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+  eval "$[1]+=\$[2]"
+}
+_LT_EOF
+    ;;
+  *)
+    cat << \_LT_EOF >> "$cfgfile"
 
-# serial 2
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+  eval "$[1]=\$$[1]\$[2]"
+}
 
-# _AM_PROG_TAR(FORMAT)
-# --------------------
-# Check how to create a tarball in format FORMAT.
-# FORMAT should be one of `v7', `ustar', or `pax'.
-#
-# Substitute a variable $(am__tar) that is a command
-# writing to stdout a FORMAT-tarball containing the directory
-# $tardir.
-#     tardir=directory && $(am__tar) > result.tar
-#
-# Substitute a variable $(am__untar) that extract such
-# a tarball read from stdin.
-#     $(am__untar) < result.tar
-AC_DEFUN([_AM_PROG_TAR],
-[# Always define AMTAR for backward compatibility.  Yes, it's still used
-# in the wild :-(  We should find a proper way to deprecate it ...
-AC_SUBST([AMTAR], ['$${TAR-tar}'])
-m4_if([$1], [v7],
-     [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
-     [m4_case([$1], [ustar],, [pax],,
-              [m4_fatal([Unknown tar format])])
-AC_MSG_CHECKING([how to create a $1 tar archive])
-# Loop over all known methods to create a tar archive until one works.
-_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
-_am_tools=${am_cv_prog_tar_$1-$_am_tools}
-# Do not fold the above two line into one, because Tru64 sh and
-# Solaris sh will not grok spaces in the rhs of `-'.
-for _am_tool in $_am_tools
-do
-  case $_am_tool in
-  gnutar)
-    for _am_tar in tar gnutar gtar;
-    do
-      AM_RUN_LOG([$_am_tar --version]) && break
-    done
-    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
-    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
-    am__untar="$_am_tar -xf -"
-    ;;
-  plaintar)
-    # Must skip GNU tar: if it does not support --format= it doesn't create
-    # ustar tarball either.
-    (tar --version) >/dev/null 2>&1 && continue
-    am__tar='tar chf - "$$tardir"'
-    am__tar_='tar chf - "$tardir"'
-    am__untar='tar xf -'
-    ;;
-  pax)
-    am__tar='pax -L -x $1 -w "$$tardir"'
-    am__tar_='pax -L -x $1 -w "$tardir"'
-    am__untar='pax -r'
-    ;;
-  cpio)
-    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
-    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
-    am__untar='cpio -i -H $1 -d'
-    ;;
-  none)
-    am__tar=false
-    am__tar_=false
-    am__untar=false
+_LT_EOF
     ;;
   esac
-
-  # If the value was cached, stop now.  We just wanted to have am__tar
-  # and am__untar set.
-  test -n "${am_cv_prog_tar_$1}" && break
-
-  # tar/untar a dummy directory, and stop if the command works
-  rm -rf conftest.dir
-  mkdir conftest.dir
-  echo GrepMe > conftest.dir/file
-  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
-  rm -rf conftest.dir
-  if test -s conftest.tar; then
-    AM_RUN_LOG([$am__untar <conftest.tar])
-    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
-  fi
-done
-rm -rf conftest.dir
-
-AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
-AC_MSG_RESULT([$am_cv_prog_tar_$1])])
-AC_SUBST([am__tar])
-AC_SUBST([am__untar])
-]) # _AM_PROG_TAR
-
-m4_include([m4/ax_boost_base.m4])
-m4_include([m4/ax_boost_filesystem.m4])
-m4_include([m4/ax_boost_iostreams.m4])
-m4_include([m4/ax_boost_regex.m4])
-m4_include([m4/ax_boost_system.m4])
-m4_include([m4/ax_boost_thread.m4])
-m4_include([m4/ax_check_zlib.m4])
-m4_include([m4/ax_lib_expat.m4])
+])
diff --git a/config/m4/ltoptions.m4 b/config/m4/ltoptions.m4
new file mode 100644
index 0000000..34151a3
--- /dev/null
+++ b/config/m4/ltoptions.m4
@@ -0,0 +1,368 @@
+# Helper functions for option handling.                    -*- Autoconf -*-
+#
+#   Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+#   Written by Gary V. Vaughan, 2004
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 6 ltoptions.m4
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
+
+
+# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
+# ------------------------------------------
+m4_define([_LT_MANGLE_OPTION],
+[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
+
+
+# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
+# ---------------------------------------
+# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
+# matching handler defined, dispatch to it.  Other OPTION-NAMEs are
+# saved as a flag.
+m4_define([_LT_SET_OPTION],
+[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
+m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
+        _LT_MANGLE_DEFUN([$1], [$2]),
+    [m4_warning([Unknown $1 option `$2'])])[]dnl
+])
+
+
+# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
+# ------------------------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+m4_define([_LT_IF_OPTION],
+[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
+
+
+# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
+# -------------------------------------------------------
+# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
+# are set.
+m4_define([_LT_UNLESS_OPTIONS],
+[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
+	    [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
+		      [m4_define([$0_found])])])[]dnl
+m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
+])[]dnl
+])
+
+
+# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
+# ----------------------------------------
+# OPTION-LIST is a space-separated list of Libtool options associated
+# with MACRO-NAME.  If any OPTION has a matching handler declared with
+# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
+# the unknown option and exit.
+m4_defun([_LT_SET_OPTIONS],
+[# Set options
+m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
+    [_LT_SET_OPTION([$1], _LT_Option)])
+
+m4_if([$1],[LT_INIT],[
+  dnl
+  dnl Simply set some default values (i.e off) if boolean options were not
+  dnl specified:
+  _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
+  ])
+  _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
+  ])
+  dnl
+  dnl If no reference was made to various pairs of opposing options, then
+  dnl we run the default mode handler for the pair.  For example, if neither
+  dnl `shared' nor `disable-shared' was passed, we enable building of shared
+  dnl archives by default:
+  _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
+  _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
+  _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
+  _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
+  		   [_LT_ENABLE_FAST_INSTALL])
+  ])
+])# _LT_SET_OPTIONS
+
+
+## --------------------------------- ##
+## Macros to handle LT_INIT options. ##
+## --------------------------------- ##
+
+# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
+# -----------------------------------------
+m4_define([_LT_MANGLE_DEFUN],
+[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
+
+
+# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
+# -----------------------------------------------
+m4_define([LT_OPTION_DEFINE],
+[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
+])# LT_OPTION_DEFINE
+
+
+# dlopen
+# ------
+LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
+])
+
+AU_DEFUN([AC_LIBTOOL_DLOPEN],
+[_LT_SET_OPTION([LT_INIT], [dlopen])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `dlopen' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
+
+
+# win32-dll
+# ---------
+# Declare package support for building win32 dll's.
+LT_OPTION_DEFINE([LT_INIT], [win32-dll],
+[enable_win32_dll=yes
+
+case $host in
+*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*)
+  AC_CHECK_TOOL(AS, as, false)
+  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+  AC_CHECK_TOOL(OBJDUMP, objdump, false)
+  ;;
+esac
+
+test -z "$AS" && AS=as
+_LT_DECL([], [AS],      [0], [Assembler program])dnl
+
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+_LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl
+
+test -z "$OBJDUMP" && OBJDUMP=objdump
+_LT_DECL([], [OBJDUMP], [0], [Object dumper program])dnl
+])# win32-dll
+
+AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+_LT_SET_OPTION([LT_INIT], [win32-dll])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `win32-dll' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
+
+
+# _LT_ENABLE_SHARED([DEFAULT])
+# ----------------------------
+# implement the --enable-shared flag, and supports the `shared' and
+# `disable-shared' LT_INIT options.
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_SHARED],
+[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([shared],
+    [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
+	[build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_shared=yes ;;
+    no) enable_shared=no ;;
+    *)
+      enable_shared=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_shared=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
+
+    _LT_DECL([build_libtool_libs], [enable_shared], [0],
+	[Whether or not to build shared libraries])
+])# _LT_ENABLE_SHARED
+
+LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
+
+# Old names:
+AC_DEFUN([AC_ENABLE_SHARED],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
+])
+
+AC_DEFUN([AC_DISABLE_SHARED],
+[_LT_SET_OPTION([LT_INIT], [disable-shared])
+])
+
+AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
+AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_ENABLE_SHARED], [])
+dnl AC_DEFUN([AM_DISABLE_SHARED], [])
+
+
+
+# _LT_ENABLE_STATIC([DEFAULT])
+# ----------------------------
+# implement the --enable-static flag, and support the `static' and
+# `disable-static' LT_INIT options.
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_STATIC],
+[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([static],
+    [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
+	[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_static=yes ;;
+    no) enable_static=no ;;
+    *)
+     enable_static=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_static=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_static=]_LT_ENABLE_STATIC_DEFAULT)
+
+    _LT_DECL([build_old_libs], [enable_static], [0],
+	[Whether or not to build static libraries])
+])# _LT_ENABLE_STATIC
+
+LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
+
+# Old names:
+AC_DEFUN([AC_ENABLE_STATIC],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
+])
+
+AC_DEFUN([AC_DISABLE_STATIC],
+[_LT_SET_OPTION([LT_INIT], [disable-static])
+])
+
+AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
+AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_ENABLE_STATIC], [])
+dnl AC_DEFUN([AM_DISABLE_STATIC], [])
+
+
+
+# _LT_ENABLE_FAST_INSTALL([DEFAULT])
+# ----------------------------------
+# implement the --enable-fast-install flag, and support the `fast-install'
+# and `disable-fast-install' LT_INIT options.
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_FAST_INSTALL],
+[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([fast-install],
+    [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
+    [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_fast_install=yes ;;
+    no) enable_fast_install=no ;;
+    *)
+      enable_fast_install=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_fast_install=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
+
+_LT_DECL([fast_install], [enable_fast_install], [0],
+	 [Whether or not to optimize for fast installation])dnl
+])# _LT_ENABLE_FAST_INSTALL
+
+LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
+
+# Old names:
+AU_DEFUN([AC_ENABLE_FAST_INSTALL],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the `fast-install' option into LT_INIT's first parameter.])
+])
+
+AU_DEFUN([AC_DISABLE_FAST_INSTALL],
+[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the `disable-fast-install' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
+dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
+
+
+# _LT_WITH_PIC([MODE])
+# --------------------
+# implement the --with-pic flag, and support the `pic-only' and `no-pic'
+# LT_INIT options.
+# MODE is either `yes' or `no'.  If omitted, it defaults to `both'.
+m4_define([_LT_WITH_PIC],
+[AC_ARG_WITH([pic],
+    [AS_HELP_STRING([--with-pic],
+	[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
+    [pic_mode="$withval"],
+    [pic_mode=default])
+
+test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
+
+_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
+])# _LT_WITH_PIC
+
+LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
+LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
+
+# Old name:
+AU_DEFUN([AC_LIBTOOL_PICMODE],
+[_LT_SET_OPTION([LT_INIT], [pic-only])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `pic-only' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
+
+## ----------------- ##
+## LTDL_INIT Options ##
+## ----------------- ##
+
+m4_define([_LTDL_MODE], [])
+LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
+		 [m4_define([_LTDL_MODE], [nonrecursive])])
+LT_OPTION_DEFINE([LTDL_INIT], [recursive],
+		 [m4_define([_LTDL_MODE], [recursive])])
+LT_OPTION_DEFINE([LTDL_INIT], [subproject],
+		 [m4_define([_LTDL_MODE], [subproject])])
+
+m4_define([_LTDL_TYPE], [])
+LT_OPTION_DEFINE([LTDL_INIT], [installable],
+		 [m4_define([_LTDL_TYPE], [installable])])
+LT_OPTION_DEFINE([LTDL_INIT], [convenience],
+		 [m4_define([_LTDL_TYPE], [convenience])])
diff --git a/config/m4/ltsugar.m4 b/config/m4/ltsugar.m4
new file mode 100644
index 0000000..9000a05
--- /dev/null
+++ b/config/m4/ltsugar.m4
@@ -0,0 +1,123 @@
+# ltsugar.m4 -- libtool m4 base layer.                         -*-Autoconf-*-
+#
+# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+# Written by Gary V. Vaughan, 2004
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 6 ltsugar.m4
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
+
+
+# lt_join(SEP, ARG1, [ARG2...])
+# -----------------------------
+# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
+# associated separator.
+# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
+# versions in m4sugar had bugs.
+m4_define([lt_join],
+[m4_if([$#], [1], [],
+       [$#], [2], [[$2]],
+       [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
+m4_define([_lt_join],
+[m4_if([$#$2], [2], [],
+       [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
+
+
+# lt_car(LIST)
+# lt_cdr(LIST)
+# ------------
+# Manipulate m4 lists.
+# These macros are necessary as long as will still need to support
+# Autoconf-2.59 which quotes differently.
+m4_define([lt_car], [[$1]])
+m4_define([lt_cdr],
+[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
+       [$#], 1, [],
+       [m4_dquote(m4_shift($@))])])
+m4_define([lt_unquote], $1)
+
+
+# lt_append(MACRO-NAME, STRING, [SEPARATOR])
+# ------------------------------------------
+# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
+# Note that neither SEPARATOR nor STRING are expanded; they are appended
+# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
+# No SEPARATOR is output if MACRO-NAME was previously undefined (different
+# than defined and empty).
+#
+# This macro is needed until we can rely on Autoconf 2.62, since earlier
+# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
+m4_define([lt_append],
+[m4_define([$1],
+	   m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
+
+
+
+# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
+# ----------------------------------------------------------
+# Produce a SEP delimited list of all paired combinations of elements of
+# PREFIX-LIST with SUFFIX1 through SUFFIXn.  Each element of the list
+# has the form PREFIXmINFIXSUFFIXn.
+# Needed until we can rely on m4_combine added in Autoconf 2.62.
+m4_define([lt_combine],
+[m4_if(m4_eval([$# > 3]), [1],
+       [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
+[[m4_foreach([_Lt_prefix], [$2],
+	     [m4_foreach([_Lt_suffix],
+		]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
+	[_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
+
+
+# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
+# -----------------------------------------------------------------------
+# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
+# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
+m4_define([lt_if_append_uniq],
+[m4_ifdef([$1],
+	  [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
+		 [lt_append([$1], [$2], [$3])$4],
+		 [$5])],
+	  [lt_append([$1], [$2], [$3])$4])])
+
+
+# lt_dict_add(DICT, KEY, VALUE)
+# -----------------------------
+m4_define([lt_dict_add],
+[m4_define([$1($2)], [$3])])
+
+
+# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
+# --------------------------------------------
+m4_define([lt_dict_add_subkey],
+[m4_define([$1($2:$3)], [$4])])
+
+
+# lt_dict_fetch(DICT, KEY, [SUBKEY])
+# ----------------------------------
+m4_define([lt_dict_fetch],
+[m4_ifval([$3],
+	m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
+    m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
+
+
+# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
+# -----------------------------------------------------------------
+m4_define([lt_if_dict_fetch],
+[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
+	[$5],
+    [$6])])
+
+
+# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
+# --------------------------------------------------------------
+m4_define([lt_dict_filter],
+[m4_if([$5], [], [],
+  [lt_join(m4_quote(m4_default([$4], [[, ]])),
+           lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
+		      [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
+])
diff --git a/config/m4/ltversion.m4 b/config/m4/ltversion.m4
new file mode 100644
index 0000000..f3c5309
--- /dev/null
+++ b/config/m4/ltversion.m4
@@ -0,0 +1,23 @@
+# ltversion.m4 -- version numbers			-*- Autoconf -*-
+#
+#   Copyright (C) 2004 Free Software Foundation, Inc.
+#   Written by Scott James Remnant, 2004
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# Generated from ltversion.in.
+
+# serial 3017 ltversion.m4
+# This file is part of GNU Libtool
+
+m4_define([LT_PACKAGE_VERSION], [2.2.6b])
+m4_define([LT_PACKAGE_REVISION], [1.3017])
+
+AC_DEFUN([LTVERSION_VERSION],
+[macro_version='2.2.6b'
+macro_revision='1.3017'
+_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
+_LT_DECL(, macro_revision, 0)
+])
diff --git a/config/m4/lt~obsolete.m4 b/config/m4/lt~obsolete.m4
new file mode 100644
index 0000000..637bb20
--- /dev/null
+++ b/config/m4/lt~obsolete.m4
@@ -0,0 +1,92 @@
+# lt~obsolete.m4 -- aclocal satisfying obsolete definitions.    -*-Autoconf-*-
+#
+#   Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
+#   Written by Scott James Remnant, 2004.
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 4 lt~obsolete.m4
+
+# These exist entirely to fool aclocal when bootstrapping libtool.
+#
+# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
+# which have later been changed to m4_define as they aren't part of the
+# exported API, or moved to Autoconf or Automake where they belong.
+#
+# The trouble is, aclocal is a bit thick.  It'll see the old AC_DEFUN
+# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
+# using a macro with the same name in our local m4/libtool.m4 it'll
+# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
+# and doesn't know about Autoconf macros at all.)
+#
+# So we provide this file, which has a silly filename so it's always
+# included after everything else.  This provides aclocal with the
+# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
+# because those macros already exist, or will be overwritten later.
+# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. 
+#
+# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
+# Yes, that means every name once taken will need to remain here until
+# we give up compatibility with versions before 1.7, at which point
+# we need to keep only those names which we still refer to.
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
+
+m4_ifndef([AC_LIBTOOL_LINKER_OPTION],	[AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
+m4_ifndef([AC_PROG_EGREP],		[AC_DEFUN([AC_PROG_EGREP])])
+m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH],	[AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
+m4_ifndef([_LT_AC_SHELL_INIT],		[AC_DEFUN([_LT_AC_SHELL_INIT])])
+m4_ifndef([_LT_AC_SYS_LIBPATH_AIX],	[AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
+m4_ifndef([_LT_PROG_LTMAIN],		[AC_DEFUN([_LT_PROG_LTMAIN])])
+m4_ifndef([_LT_AC_TAGVAR],		[AC_DEFUN([_LT_AC_TAGVAR])])
+m4_ifndef([AC_LTDL_ENABLE_INSTALL],	[AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
+m4_ifndef([AC_LTDL_PREOPEN],		[AC_DEFUN([AC_LTDL_PREOPEN])])
+m4_ifndef([_LT_AC_SYS_COMPILER],	[AC_DEFUN([_LT_AC_SYS_COMPILER])])
+m4_ifndef([_LT_AC_LOCK],		[AC_DEFUN([_LT_AC_LOCK])])
+m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE],	[AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
+m4_ifndef([_LT_AC_TRY_DLOPEN_SELF],	[AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
+m4_ifndef([AC_LIBTOOL_PROG_CC_C_O],	[AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
+m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
+m4_ifndef([AC_LIBTOOL_OBJDIR],		[AC_DEFUN([AC_LIBTOOL_OBJDIR])])
+m4_ifndef([AC_LTDL_OBJDIR],		[AC_DEFUN([AC_LTDL_OBJDIR])])
+m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
+m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP],	[AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
+m4_ifndef([AC_PATH_MAGIC],		[AC_DEFUN([AC_PATH_MAGIC])])
+m4_ifndef([AC_PROG_LD_GNU],		[AC_DEFUN([AC_PROG_LD_GNU])])
+m4_ifndef([AC_PROG_LD_RELOAD_FLAG],	[AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
+m4_ifndef([AC_DEPLIBS_CHECK_METHOD],	[AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
+m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
+m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
+m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
+m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS],	[AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
+m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP],	[AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
+m4_ifndef([LT_AC_PROG_EGREP],		[AC_DEFUN([LT_AC_PROG_EGREP])])
+m4_ifndef([LT_AC_PROG_SED],		[AC_DEFUN([LT_AC_PROG_SED])])
+m4_ifndef([_LT_CC_BASENAME],		[AC_DEFUN([_LT_CC_BASENAME])])
+m4_ifndef([_LT_COMPILER_BOILERPLATE],	[AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
+m4_ifndef([_LT_LINKER_BOILERPLATE],	[AC_DEFUN([_LT_LINKER_BOILERPLATE])])
+m4_ifndef([_AC_PROG_LIBTOOL],		[AC_DEFUN([_AC_PROG_LIBTOOL])])
+m4_ifndef([AC_LIBTOOL_SETUP],		[AC_DEFUN([AC_LIBTOOL_SETUP])])
+m4_ifndef([_LT_AC_CHECK_DLFCN],		[AC_DEFUN([_LT_AC_CHECK_DLFCN])])
+m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER],	[AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
+m4_ifndef([_LT_AC_TAGCONFIG],		[AC_DEFUN([_LT_AC_TAGCONFIG])])
+m4_ifndef([AC_DISABLE_FAST_INSTALL],	[AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
+m4_ifndef([_LT_AC_LANG_CXX],		[AC_DEFUN([_LT_AC_LANG_CXX])])
+m4_ifndef([_LT_AC_LANG_F77],		[AC_DEFUN([_LT_AC_LANG_F77])])
+m4_ifndef([_LT_AC_LANG_GCJ],		[AC_DEFUN([_LT_AC_LANG_GCJ])])
+m4_ifndef([AC_LIBTOOL_RC],		[AC_DEFUN([AC_LIBTOOL_RC])])
+m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
+m4_ifndef([_LT_AC_LANG_C_CONFIG],	[AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
+m4_ifndef([_LT_AC_LANG_CXX_CONFIG],	[AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
+m4_ifndef([_LT_AC_LANG_F77_CONFIG],	[AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
+m4_ifndef([_LT_AC_LANG_GCJ_CONFIG],	[AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
+m4_ifndef([_LT_AC_LANG_RC_CONFIG],	[AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
+m4_ifndef([AC_LIBTOOL_CONFIG],		[AC_DEFUN([AC_LIBTOOL_CONFIG])])
+m4_ifndef([_LT_AC_FILE_LTDLL_C],	[AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
diff --git a/configure b/configure
index 99bc74a..7f23f42 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68 for mira 4.9.5.
+# Generated by GNU Autoconf 2.67 for mira 3.4.0.
 #
 #
 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -89,7 +89,6 @@ fi
 IFS=" ""	$as_nl"
 
 # Find who we are.  Look in the path if we contain no directory separator.
-as_myself=
 case $0 in #((
   *[\\/]* ) as_myself=$0 ;;
   *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -172,15 +171,7 @@ test x\$exitcode = x0 || exit 1"
   as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
   eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
   test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
-test \$(( 1 + 1 )) = 2 || exit 1
-
-  test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || (
-    ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
-    ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
-    ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
-    PATH=/empty FPATH=/empty; export PATH FPATH
-    test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\
-      || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1"
+test \$(( 1 + 1 )) = 2 || exit 1"
   if (eval "$as_required") 2>/dev/null; then :
   as_have_required=yes
 else
@@ -223,18 +214,11 @@ IFS=$as_save_IFS
   # We cannot yet assume a decent shell, so we have to provide a
 	# neutralization value for shells without unset; and this also
 	# works around shells that cannot unset nonexistent variables.
-	# Preserve -v and -x to the replacement shell.
 	BASH_ENV=/dev/null
 	ENV=/dev/null
 	(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
 	export CONFIG_SHELL
-	case $- in # ((((
-	  *v*x* | *x*v* ) as_opts=-vx ;;
-	  *v* ) as_opts=-v ;;
-	  *x* ) as_opts=-x ;;
-	  * ) as_opts= ;;
-	esac
-	exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
+	exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
 fi
 
     if test x$as_have_required = xno; then :
@@ -541,8 +525,155 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
 # Sed expression to map a string onto a valid variable name.
 as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
 
+
+
+# Check that we are running under the correct shell.
 SHELL=${CONFIG_SHELL-/bin/sh}
 
+case X$lt_ECHO in
+X*--fallback-echo)
+  # Remove one level of quotation (which was required for Make).
+  ECHO=`echo "$lt_ECHO" | sed 's,\\\\\$\\$0,'$0','`
+  ;;
+esac
+
+ECHO=${lt_ECHO-echo}
+if test "X$1" = X--no-reexec; then
+  # Discard the --no-reexec flag, and continue.
+  shift
+elif test "X$1" = X--fallback-echo; then
+  # Avoid inline document here, it may be left over
+  :
+elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then
+  # Yippee, $ECHO works!
+  :
+else
+  # Restart under the correct shell.
+  exec $SHELL "$0" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat <<_LT_EOF
+$*
+_LT_EOF
+  exit 0
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+if test -z "$lt_ECHO"; then
+  if test "X${echo_test_string+set}" != Xset; then
+    # find a string as large as possible, as long as the shell can cope with it
+    for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do
+      # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+      if { echo_test_string=`eval $cmd`; } 2>/dev/null &&
+	 { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null
+      then
+        break
+      fi
+    done
+  fi
+
+  if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
+     echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
+     test "X$echo_testing_string" = "X$echo_test_string"; then
+    :
+  else
+    # The Solaris, AIX, and Digital Unix default echo programs unquote
+    # backslashes.  This makes it impossible to quote backslashes using
+    #   echo "$something" | sed 's/\\/\\\\/g'
+    #
+    # So, first we look for a working echo in the user's PATH.
+
+    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+    for dir in $PATH /usr/ucb; do
+      IFS="$lt_save_ifs"
+      if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+         test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+         echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+         test "X$echo_testing_string" = "X$echo_test_string"; then
+        ECHO="$dir/echo"
+        break
+      fi
+    done
+    IFS="$lt_save_ifs"
+
+    if test "X$ECHO" = Xecho; then
+      # We didn't find a better echo, so look for alternatives.
+      if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' &&
+         echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` &&
+         test "X$echo_testing_string" = "X$echo_test_string"; then
+        # This shell has a builtin print -r that does the trick.
+        ECHO='print -r'
+      elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } &&
+	   test "X$CONFIG_SHELL" != X/bin/ksh; then
+        # If we have ksh, try running configure again with it.
+        ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+        export ORIGINAL_CONFIG_SHELL
+        CONFIG_SHELL=/bin/ksh
+        export CONFIG_SHELL
+        exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"}
+      else
+        # Try using printf.
+        ECHO='printf %s\n'
+        if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
+	   echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
+	   test "X$echo_testing_string" = "X$echo_test_string"; then
+	  # Cool, printf works
+	  :
+        elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
+	     test "X$echo_testing_string" = 'X\t' &&
+	     echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	     test "X$echo_testing_string" = "X$echo_test_string"; then
+	  CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+	  export CONFIG_SHELL
+	  SHELL="$CONFIG_SHELL"
+	  export SHELL
+	  ECHO="$CONFIG_SHELL $0 --fallback-echo"
+        elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
+	     test "X$echo_testing_string" = 'X\t' &&
+	     echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	     test "X$echo_testing_string" = "X$echo_test_string"; then
+	  ECHO="$CONFIG_SHELL $0 --fallback-echo"
+        else
+	  # maybe with a smaller string...
+	  prev=:
+
+	  for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do
+	    if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null
+	    then
+	      break
+	    fi
+	    prev="$cmd"
+	  done
+
+	  if test "$prev" != 'sed 50q "$0"'; then
+	    echo_test_string=`eval $prev`
+	    export echo_test_string
+	    exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"}
+	  else
+	    # Oops.  We lost completely, so just stick with echo.
+	    ECHO=echo
+	  fi
+        fi
+      fi
+    fi
+  fi
+fi
+
+# Copy echo and quote the copy suitably for passing to libtool from
+# the Makefile, instead of quoting the original, which is used later.
+lt_ECHO=$ECHO
+if test "X$lt_ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then
+   lt_ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo"
+fi
+
+
+
 
 test -n "$DJDIR" || exec 7<&0 </dev/null
 exec 6>&1
@@ -567,8 +698,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='mira'
 PACKAGE_TARNAME='mira'
-PACKAGE_VERSION='4.9.5'
-PACKAGE_STRING='mira 4.9.5'
+PACKAGE_VERSION='3.4.0'
+PACKAGE_STRING='mira 3.4.0'
 PACKAGE_BUGREPORT=''
 PACKAGE_URL=''
 
@@ -612,23 +743,18 @@ ac_includes_default="\
 ac_subst_vars='am__EXEEXT_FALSE
 am__EXEEXT_TRUE
 LTLIBOBJS
-BUILDMIRAMEMORC_FALSE
-BUILDMIRAMEMORC_TRUE
+SHORTMIRAAUDIENCE
 PURIFY_FALSE
 PURIFY_TRUE
-EXPAT_VERSION
-EXPAT_LIBS
-EXPAT_LDFLAGS
-EXPAT_CFLAGS
-BOOST_IOSTREAMS_LIB
-BOOST_FILESYSTEM_LIB
-BOOST_SYSTEM_LIB
 BOOST_REGEX_LIB
 BOOST_THREAD_LIB
 BOOST_LDFLAGS
 BOOST_CPPFLAGS
+EXPAT_VERSION
+EXPAT_LDFLAGS
+EXPAT_CFLAGS
+PERL
 LIBOBJS
-HAVE_XXD
 FLEXPP
 LEXLIB
 LEX_OUTPUT_ROOT
@@ -640,11 +766,9 @@ OTOOL
 LIPO
 NMEDIT
 DSYMUTIL
-MANIFEST_TOOL
+lt_ECHO
 RANLIB
-ac_ct_AR
 AR
-DLLTOOL
 OBJDUMP
 LN_S
 NM
@@ -652,12 +776,12 @@ ac_ct_DUMPBIN
 DUMPBIN
 LD
 FGREP
+SED
 host_os
 host_vendor
 host_cpu
 host
 LIBTOOL
-BUNDLETARGET
 BLOODYDARWINSTATLIBDIRHACK
 build_os
 build_vendor
@@ -676,7 +800,6 @@ CXX
 am__fastdepCC_FALSE
 am__fastdepCC_TRUE
 CCDEPMODE
-am__nodep
 AMDEPBACKSLASH
 AMDEP_FALSE
 AMDEP_TRUE
@@ -693,7 +816,6 @@ CC
 MIRASTATIC
 BUILDMIRASTATIC_FALSE
 BUILDMIRASTATIC_TRUE
-SED
 am__untar
 am__tar
 AMTAR
@@ -758,42 +880,39 @@ SHELL'
 ac_subst_files=''
 ac_user_opts='
 enable_option_checking
-enable_clang
 enable_mirastatic
 enable_dependency_tracking
 enable_64
 enable_optimisations
-enable_native
 enable_shared
 enable_static
 with_pic
 enable_fast_install
 with_gnu_ld
-with_sysroot
 enable_libtool_lock
 enable_largefile
-with_boost
-with_boost_libdir
-with_boost_thread
-with_boost_regex
-with_boost_system
-with_boost_filesystem
-with_boost_iostreams
+with_perl
 with_expat
 with_expat_inc
 with_expat_lib
 with_zlib
+with_boost
+with_boost_libdir
+with_boost_thread
+with_boost_regex
 enable_debug
 enable_cxxdebug
 enable_profile
 enable_warnings
 enable_purify
+with_tcmalloc
+with_tcmalloc_dir
 enable_publicquietmira
+enable_developmentversion
 enable_boundtracking
 enable_bugtracking
 enable_extendedbugtracking
 enable_functrace
-enable_miramemorc
 '
       ac_precious_vars='build_alias
 host_alias
@@ -807,7 +926,8 @@ CXX
 CXXFLAGS
 CCC
 CPP
-CXXCPP'
+CXXCPP
+PERL'
 
 
 # Initialize some variables set by options.
@@ -1212,7 +1332,7 @@ Try \`$0 --help' for more information"
     $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
     expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
       $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
-    : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
+    : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
     ;;
 
   esac
@@ -1350,7 +1470,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures mira 4.9.5 to adapt to many kinds of systems.
+\`configure' configures mira 3.4.0 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1420,7 +1540,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of mira 4.9.5:";;
+     short | recursive ) echo "Configuration of mira 3.4.0:";;
    esac
   cat <<\_ACEOF
 
@@ -1428,7 +1548,6 @@ Optional Features:
   --disable-option-checking  ignore unrecognized --enable/--with options
   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
-  --enable-clang          use clang instead of gcc
   --enable-mirastatic     enables building of static binaries, default is no
   --disable-dependency-tracking  speeds up one-time build
   --enable-dependency-tracking   do not reject slow dependency extractors
@@ -1436,8 +1555,6 @@ Optional Features:
                           bit machines, default is dependend of your compiler
                           defaults
   --enable-optimisations  enables compiler optimisations, default is yes
-  --enable-native         compile only for your specific processor, default is
-                          no
   --enable-shared[=PKGS]  build shared libraries [default=yes]
   --enable-static[=PKGS]  build static libraries [default=yes]
   --enable-fast-install[=PKGS]
@@ -1458,6 +1575,9 @@ Optional Features:
   --enable-publicquietmira=yes/no
                           use 'no' for a chatty version of MIRA, default is
                           yes
+  --enable-developmentversion=no/yes
+                          use 'yes' for a development version of MIRA, default
+                          is no
   --enable-boundtracking=yes/no
                           use 'yes' for some additional value bound tracking
                           in MIRA, default is yes
@@ -1470,23 +1590,27 @@ Optional Features:
   --enable-functrace=no/yes
                           use 'yes' for a function trace in MIRA, default is
                           no
-  --enable-miramemorc     enables building with memory overrun checks, default
-                          is no
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
-  --with-pic[=PKGS]       try to use only PIC/non-PIC objects [default=use
+  --with-pic              try to use only PIC/non-PIC objects [default=use
                           both]
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
-  --with-sysroot=DIR Search for dependent libraries within DIR
-                        (or the compiler's sysroot if not specified).
+  --with-perl=[PATH]    absolute path to perl executable
+  --with-expat=[ARG]      use Expat XML Parser from given prefix (ARG=path);
+                          check standard prefixes (ARG=yes); disable (ARG=no)
+  --with-expat-inc=[DIR]  path to Expat XML Parser headers
+  --with-expat-lib=[ARG]  link options for Expat XML Parser libraries
+  --with-zlib=DIR root directory path of zlib installation defaults to
+                    /usr/local or /usr if not found in /usr/local
+  --without-zlib to disable zlib usage completely
   --with-boost[=ARG]      use Boost library from a standard location
                           (ARG=yes), from the specified location (ARG=<path>),
                           or disable it (ARG=no) [ARG=yes]
   --with-boost-libdir=LIB_DIR
                           Force given directory for boost libraries. Note that
-                          this will override library path detection, so use
+                          this will overwrite library path detection, so use
                           this parameter only if default library detection
                           fails and you know exactly where your boost
                           libraries are located.
@@ -1498,26 +1622,8 @@ Optional Packages:
                           use the Regex library from boost - it is possible to
                           specify a certain library for the linker e.g.
                           --with-boost-regex=boost_regex-gcc-mt-d-1_33_1
-  --with-boost-system[=special-lib]
-                          use the System library from boost - it is possible
-                          to specify a certain library for the linker e.g.
-                          --with-boost-system=boost_system-gcc-mt
-  --with-boost-filesystem[=special-lib]
-                          use the Filesystem library from boost - it is
-                          possible to specify a certain library for the linker
-                          e.g. --with-boost-filesystem=boost_filesystem-gcc-mt
-  --with-boost-iostreams[=special-lib]
-                          use the IOStreams library from boost - it is
-                          possible to specify a certain library for the linker
-                          e.g.
-                          --with-boost-iostreams=boost_iostreams-gcc-mt-d-1_33_1
-  --with-expat=[ARG]      use Expat XML Parser from given prefix (ARG=path);
-                          check standard prefixes (ARG=yes); disable (ARG=no)
-  --with-expat-inc=[DIR]  path to Expat XML Parser headers
-  --with-expat-lib=[ARG]  link options for Expat XML Parser libraries
-  --with-zlib=DIR root directory path of zlib installation defaults to
-                    /usr/local or /usr if not found in /usr/local
-  --without-zlib to disable zlib usage completely
+  --with-tcmalloc         Use tcmalloc memory allocation library.
+  --with-tcmalloc-dir=LIB_DIR     search static tcmalloc library there.
 
 Some influential environment variables:
   CC          C compiler command
@@ -1531,6 +1637,7 @@ Some influential environment variables:
   CXXFLAGS    C++ compiler flags
   CPP         C preprocessor
   CXXCPP      C++ preprocessor
+  PERL        Absolute path to perl executable
 
 Use these variables to override the choices made by `configure' or to help
 it to find libraries and programs with nonstandard names/locations.
@@ -1598,8 +1705,8 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-mira configure 4.9.5
-generated by GNU Autoconf 2.68
+mira configure 3.4.0
+generated by GNU Autoconf 2.67
 
 Copyright (C) 2010 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
@@ -1645,7 +1752,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
 	ac_retval=1
 fi
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
   as_fn_set_status $ac_retval
 
 } # ac_fn_c_try_compile
@@ -1683,7 +1790,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
 	ac_retval=1
 fi
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
   as_fn_set_status $ac_retval
 
 } # ac_fn_cxx_try_compile
@@ -1697,7 +1804,7 @@ ac_fn_c_check_type ()
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
+if eval "test \"\${$3+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   eval "$3=no"
@@ -1738,7 +1845,7 @@ fi
 eval ac_res=\$$3
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
 
 } # ac_fn_c_check_type
 
@@ -1774,7 +1881,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
     ac_retval=1
 fi
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
   as_fn_set_status $ac_retval
 
 } # ac_fn_c_try_cpp
@@ -1816,7 +1923,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
        ac_retval=$ac_status
 fi
   rm -rf conftest.dSYM conftest_ipa8_conftest.oo
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
   as_fn_set_status $ac_retval
 
 } # ac_fn_c_try_run
@@ -1830,7 +1937,7 @@ ac_fn_c_check_header_compile ()
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
+if eval "test \"\${$3+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -1848,7 +1955,7 @@ fi
 eval ac_res=\$$3
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
 
 } # ac_fn_c_check_header_compile
 
@@ -1893,7 +2000,7 @@ fi
   # interfere with the next link command; also delete a directory that is
   # left behind by Apple's compiler.  We do this before executing the actions.
   rm -rf conftest.dSYM conftest_ipa8_conftest.oo
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
   as_fn_set_status $ac_retval
 
 } # ac_fn_c_try_link
@@ -1906,7 +2013,7 @@ ac_fn_c_check_func ()
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
+if eval "test \"\${$3+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -1961,7 +2068,7 @@ fi
 eval ac_res=\$$3
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
 
 } # ac_fn_c_check_func
 
@@ -1997,7 +2104,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
     ac_retval=1
 fi
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
   as_fn_set_status $ac_retval
 
 } # ac_fn_cxx_try_cpp
@@ -2043,7 +2150,7 @@ fi
   # interfere with the next link command; also delete a directory that is
   # left behind by Apple's compiler.  We do this before executing the actions.
   rm -rf conftest.dSYM conftest_ipa8_conftest.oo
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
   as_fn_set_status $ac_retval
 
 } # ac_fn_cxx_try_link
@@ -2056,10 +2163,10 @@ fi
 ac_fn_c_check_header_mongrel ()
 {
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  if eval \${$3+:} false; then :
+  if eval "test \"\${$3+set}\"" = set; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
+if eval "test \"\${$3+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 fi
 eval ac_res=\$$3
@@ -2122,7 +2229,7 @@ $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
 esac
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
+if eval "test \"\${$3+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   eval "$3=\$ac_header_compiler"
@@ -2131,15 +2238,15 @@ eval ac_res=\$$3
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
 fi
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
 
 } # ac_fn_c_check_header_mongrel
 cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by mira $as_me 4.9.5, which was
-generated by GNU Autoconf 2.68.  Invocation command line was
+It was created by mira $as_me 3.4.0, which was
+generated by GNU Autoconf 2.67.  Invocation command line was
 
   $ $0 $@
 
@@ -2397,7 +2504,7 @@ $as_echo "$as_me: loading site script $ac_site_file" >&6;}
       || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "failed to load site script $ac_site_file
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
   fi
 done
 
@@ -2537,7 +2644,7 @@ ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
 $as_echo_n "checking for a BSD-compatible install... " >&6; }
 if test -z "$INSTALL"; then
-if ${ac_cv_path_install+:} false; then :
+if test "${ac_cv_path_install+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -2624,11 +2731,11 @@ am_lf='
 '
 case `pwd` in
   *[\\\"\#\$\&\'\`$am_lf]*)
-    as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;;
+    as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5 ;;
 esac
 case $srcdir in
   *[\\\"\#\$\&\'\`$am_lf\ \	]*)
-    as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;;
+    as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5 ;;
 esac
 
 # Do `set' in a subshell so we don't clobber the current shell's
@@ -2714,7 +2821,7 @@ if test "$cross_compiling" != no; then
 set dummy ${ac_tool_prefix}strip; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_STRIP+:} false; then :
+if test "${ac_cv_prog_STRIP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$STRIP"; then
@@ -2754,7 +2861,7 @@ if test -z "$ac_cv_prog_STRIP"; then
 set dummy strip; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_STRIP"; then
@@ -2807,7 +2914,7 @@ INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5
 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
 if test -z "$MKDIR_P"; then
-  if ${ac_cv_path_mkdir+:} false; then :
+  if test "${ac_cv_path_mkdir+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -2858,7 +2965,7 @@ do
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_AWK+:} false; then :
+if test "${ac_cv_prog_AWK+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$AWK"; then
@@ -2898,7 +3005,7 @@ done
 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
 set x ${MAKE-make}
 ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
-if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then :
+if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat >conftest.make <<\_ACEOF
@@ -2956,7 +3063,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='mira'
- VERSION='4.9.5'
+ VERSION='3.4.0'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -2986,9 +3093,9 @@ MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
 
 # We need awk for the "check" target.  The system "awk" is bad on
 # some platforms.
-# Always define AMTAR for backward compatibility.  Yes, it's still used
-# in the wild :-(  We should find a proper way to deprecate it ...
-AMTAR='$${TAR-tar}'
+# Always define AMTAR for backward compatibility.
+
+AMTAR=${AMTAR-"${am_missing_run}tar"}
 
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to create a ustar tar archive" >&5
@@ -3064,7 +3171,7 @@ do
 done
 rm -rf conftest.dir
 
-if ${am_cv_prog_tar_ustar+:} false; then :
+if test "${am_cv_prog_tar_ustar+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   am_cv_prog_tar_ustar=$_am_tool
@@ -3089,77 +3196,11 @@ CXXFLAGS="${CXXFLAGS} "
 
 AMCXXFLAGS=""
 
-# we'll need that quite soon
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
-$as_echo_n "checking for a sed that does not truncate output... " >&6; }
-if ${ac_cv_path_SED+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-            ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
-     for ac_i in 1 2 3 4 5 6 7; do
-       ac_script="$ac_script$as_nl$ac_script"
-     done
-     echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
-     { ac_script=; unset ac_script;}
-     if test -z "$SED"; then
-  ac_path_SED_found=false
-  # Loop through the user's path and test for each of PROGNAME-LIST
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_prog in sed gsed; do
-    for ac_exec_ext in '' $ac_executable_extensions; do
-      ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
-      { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue
-# Check for GNU ac_path_SED and select it if it is found.
-  # Check for GNU $ac_path_SED
-case `"$ac_path_SED" --version 2>&1` in
-*GNU*)
-  ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;;
-*)
-  ac_count=0
-  $as_echo_n 0123456789 >"conftest.in"
-  while :
-  do
-    cat "conftest.in" "conftest.in" >"conftest.tmp"
-    mv "conftest.tmp" "conftest.in"
-    cp "conftest.in" "conftest.nl"
-    $as_echo '' >> "conftest.nl"
-    "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
-    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-    as_fn_arith $ac_count + 1 && ac_count=$as_val
-    if test $ac_count -gt ${ac_path_SED_max-0}; then
-      # Best one so far, save it but keep looking for a better one
-      ac_cv_path_SED="$ac_path_SED"
-      ac_path_SED_max=$ac_count
-    fi
-    # 10*(2^10) chars as input seems more than enough
-    test $ac_count -gt 10 && break
-  done
-  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
-      $ac_path_SED_found && break 3
-    done
-  done
-  done
-IFS=$as_save_IFS
-  if test -z "$ac_cv_path_SED"; then
-    as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5
-  fi
-else
-  ac_cv_path_SED=$SED
-fi
-
+# having this before AC_CANONICAL_BUILD sets the correct CPU info in ${build_os}
+if test "${systemuname}" = "Darwin"; then
+  CFLAGS="-mmacosx-version-min=10.5 ${CFLAGS}"
+  CXXFLAGS="-mmacosx-version-min=10.5 ${CXXFLAGS}"
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5
-$as_echo "$ac_cv_path_SED" >&6; }
- SED="$ac_cv_path_SED"
-  rm -f conftest.sed
-
-
 
 # The internal echo for /bin/sh on darwin doesn't support -n
 # therefore we have to use /bin/echo.
@@ -3172,16 +3213,6 @@ fi
 
 
 
-# Check whether --enable-clang was given.
-if test "${enable_clang+set}" = set; then :
-  enableval=$enable_clang;
-fi
-
-
-if test "${enable_clang}" = "yes" ; then
-  CC=clang
-fi
-
 # Check whether --enable-mirastatic was given.
 if test "${enable_mirastatic+set}" = set; then :
   enableval=$enable_mirastatic;
@@ -3197,7 +3228,6 @@ else
 fi
 
 
-
 #
 # Seen on systems where third party programs/libs were installed in a
 #  separate non-standard directory like "/home/foo/public":
@@ -3238,19 +3268,8 @@ else
 
 fi
 
-bccheck1="gcc"
-bccheck2="g++"
 
-case "${CC}" in
-*gcc*)
-  bccheck1="gcc"
-  bccheck2="g++"
-;;
-*clang*)
-  bccheck1="clang"
-  bccheck2="clang++"
-;;
-esac
+
 
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
@@ -3258,13 +3277,11 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 if test -n "$ac_tool_prefix"; then
-  for ac_prog in $bccheck1
-  do
-    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
-set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
+if test "${ac_cv_prog_CC+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -3277,7 +3294,7 @@ do
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+    ac_cv_prog_CC="${ac_tool_prefix}gcc"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -3297,18 +3314,14 @@ $as_echo "no" >&6; }
 fi
 
 
-    test -n "$CC" && break
-  done
 fi
-if test -z "$CC"; then
+if test -z "$ac_cv_prog_CC"; then
   ac_ct_CC=$CC
-  for ac_prog in $bccheck1
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
+  # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_CC+:} false; then :
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_CC"; then
@@ -3321,7 +3334,7 @@ do
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_CC="$ac_prog"
+    ac_cv_prog_ac_ct_CC="gcc"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -3340,10 +3353,6 @@ else
 $as_echo "no" >&6; }
 fi
 
-
-  test -n "$ac_ct_CC" && break
-done
-
   if test "x$ac_ct_CC" = x; then
     CC=""
   else
@@ -3355,52 +3364,254 @@ ac_tool_warned=yes ;;
 esac
     CC=$ac_ct_CC
   fi
+else
+  CC="$ac_cv_prog_CC"
 fi
 
-
-test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "no acceptable C compiler found in \$PATH
-See \`config.log' for more details" "$LINENO" 5; }
-
-# Provide some information about the compiler.
-$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
-set X $ac_compile
-ac_compiler=$2
-for ac_option in --version -v -V -qversion; do
-  { { ac_try="$ac_compiler $ac_option >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
-  ac_status=$?
-  if test -s conftest.err; then
-    sed '10a\
-... rest of stderr output deleted ...
-         10q' conftest.err >conftest.er1
-    cat conftest.er1 >&5
+if test -z "$CC"; then
+          if test -n "$ac_tool_prefix"; then
+    # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="${ac_tool_prefix}cc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
   fi
-  rm -f conftest.er1 conftest.err
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }
 done
+  done
+IFS=$as_save_IFS
 
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
-int
-main ()
-{
 
-  ;
-  return 0;
-}
-_ACEOF
-ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
+  fi
+fi
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+       ac_prog_rejected=yes
+       continue
+     fi
+    ac_cv_prog_CC="cc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# != 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+  fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in cl.exe
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    test -n "$CC" && break
+  done
+fi
+if test -z "$CC"; then
+  ac_ct_CC=$CC
+  for ac_prog in cl.exe
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CC="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CC" && break
+done
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+fi
+
+fi
+
+
+test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "no acceptable C compiler found in \$PATH
+See \`config.log' for more details" "$LINENO" 5 ; }
+
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+  { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    sed '10a\
+... rest of stderr output deleted ...
+         10q' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+  fi
+  rm -f conftest.er1 conftest.err
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+done
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
 # Try to create an executable without -o first, disregard a.out.
 # It will help us diagnose broken compilers, and finding out an intuition
 # of exeext.
@@ -3476,7 +3687,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error 77 "C compiler cannot create executables
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
@@ -3519,7 +3730,7 @@ else
   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
 fi
 rm -f conftest conftest$ac_cv_exeext
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
@@ -3578,7 +3789,7 @@ $as_echo "$ac_try_echo"; } >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "cannot run C compiled programs.
 If you meant to cross compile, use \`--host'.
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
     fi
   fi
 fi
@@ -3589,7 +3800,7 @@ rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
 ac_clean_files=$ac_clean_files_save
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
 $as_echo_n "checking for suffix of object files... " >&6; }
-if ${ac_cv_objext+:} false; then :
+if test "${ac_cv_objext+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -3630,7 +3841,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "cannot compute suffix of object files: cannot compile
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
 fi
 rm -f conftest.$ac_cv_objext conftest.$ac_ext
 fi
@@ -3640,7 +3851,7 @@ OBJEXT=$ac_cv_objext
 ac_objext=$OBJEXT
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
-if ${ac_cv_c_compiler_gnu+:} false; then :
+if test "${ac_cv_c_compiler_gnu+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -3677,7 +3888,7 @@ ac_test_CFLAGS=${CFLAGS+set}
 ac_save_CFLAGS=$CFLAGS
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
 $as_echo_n "checking whether $CC accepts -g... " >&6; }
-if ${ac_cv_prog_cc_g+:} false; then :
+if test "${ac_cv_prog_cc_g+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_save_c_werror_flag=$ac_c_werror_flag
@@ -3755,7 +3966,7 @@ else
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
-if ${ac_cv_prog_cc_c89+:} false; then :
+if test "${ac_cv_prog_cc_c89+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_cv_prog_cc_c89=no
@@ -3901,7 +4112,6 @@ fi
 if test "x$enable_dependency_tracking" != xno; then
   am_depcomp="$ac_aux_dir/depcomp"
   AMDEPBACKSLASH='\'
-  am__nodep='_no'
 fi
  if test "x$enable_dependency_tracking" != xno; then
   AMDEP_TRUE=
@@ -3917,7 +4127,7 @@ depcc="$CC"   am_compiler_list=
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
 $as_echo_n "checking dependency style of $depcc... " >&6; }
-if ${am_cv_CC_dependencies_compiler_type+:} false; then :
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
@@ -3926,7 +4136,6 @@ else
   # instance it was reported that on HP-UX the gcc test will end up
   # making a dummy file named `D' -- because `-MD' means `put the output
   # in D'.
-  rm -rf conftest.dir
   mkdir conftest.dir
   # Copy depcomp to subdir because otherwise we won't find it if we're
   # using a relative directory.
@@ -3986,7 +4195,7 @@ else
 	break
       fi
       ;;
-    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+    msvisualcpp | msvcmsys)
       # This compiler won't grok `-c -o', but also, the minuso test has
       # not run yet.  These depmodes are late enough in the game, and
       # so weak that their functioning should not be impacted.
@@ -4051,13 +4260,13 @@ if test -z "$CXX"; then
     CXX=$CCC
   else
     if test -n "$ac_tool_prefix"; then
-  for ac_prog in $bccheck2
+  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
   do
     # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CXX+:} false; then :
+if test "${ac_cv_prog_CXX+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CXX"; then
@@ -4095,13 +4304,13 @@ fi
 fi
 if test -z "$CXX"; then
   ac_ct_CXX=$CXX
-  for ac_prog in $bccheck2
+  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_CXX+:} false; then :
+if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_CXX"; then
@@ -4179,7 +4388,7 @@ done
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5
 $as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; }
-if ${ac_cv_cxx_compiler_gnu+:} false; then :
+if test "${ac_cv_cxx_compiler_gnu+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -4216,7 +4425,7 @@ ac_test_CXXFLAGS=${CXXFLAGS+set}
 ac_save_CXXFLAGS=$CXXFLAGS
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5
 $as_echo_n "checking whether $CXX accepts -g... " >&6; }
-if ${ac_cv_prog_cxx_g+:} false; then :
+if test "${ac_cv_prog_cxx_g+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_save_cxx_werror_flag=$ac_cxx_werror_flag
@@ -4302,7 +4511,7 @@ depcc="$CXX"  am_compiler_list=
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
 $as_echo_n "checking dependency style of $depcc... " >&6; }
-if ${am_cv_CXX_dependencies_compiler_type+:} false; then :
+if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
@@ -4311,7 +4520,6 @@ else
   # instance it was reported that on HP-UX the gcc test will end up
   # making a dummy file named `D' -- because `-MD' means `put the output
   # in D'.
-  rm -rf conftest.dir
   mkdir conftest.dir
   # Copy depcomp to subdir because otherwise we won't find it if we're
   # using a relative directory.
@@ -4371,7 +4579,7 @@ else
 	break
       fi
       ;;
-    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+    msvisualcpp | msvcmsys)
       # This compiler won't grok `-c -o', but also, the minuso test has
       # not run yet.  These depmodes are late enough in the game, and
       # so weak that their functioning should not be impacted.
@@ -4427,53 +4635,7 @@ fi
 
 
 
-bachCCOMPILER=""
-case "${CC}" in
-*gcc*)
-  bachCCOMPILER=gcc
-;;
-*clang*)
-  bachCCOMPILER=clang
-;;
-*)
-  bachCCOMPILER=unknown
-;;
-esac
-
-if test "$bachCCOMPILER" != "gcc" ; then
-  # No, autoconf, no! Bad autoconf!
-  # We do not have GCC! I'm telling you!
-  # (though, to be fair, it's not entirely your fault)
-  GCC="no"
-fi
-
 
-# check for gcc version if using gcc
-if test $bachCCOMPILER = gcc; then
-  gccversion=`$CC -dumpversion`
-  gxxversion=`$CXX -dumpversion`
-  if test "x${gccversion}" != "x${gxxversion}"; then
-    echo "gcc is version ${gccversion} while g++ is version ${gxxversion}"
-    echo "This is not a sane environment, both versions should be the same (>=4.9.1). Stopping here."
-    exit 10
-  fi
-  GCC_VERSION_MAJOR=$(echo $gccversion | cut -d'.' -f1)
-  GCC_VERSION_MINOR=$(echo $gccversion | cut -d'.' -f2)
-  gccgoodversion="no"
-  gccgoodversion="yes"
-  if test ${GCC_VERSION_MAJOR} -ge 4; then
-    if test ${GCC_VERSION_MAJOR} -ge 5; then
-      gccgoodversion="yes"
-    elif test ${GCC_VERSION_MINOR} -ge 9; then
-      gccgoodversion="yes"
-    fi
-  fi
-  if test "${gccgoodversion}" = "no"; then
-    echo
-    echo "When using gcc, you need to have gcc >= 4.9.x. You have only" $gccversion", aborting."
-    exit 10
-  fi
-fi
 
 
 
@@ -4485,6 +4647,12 @@ fi
 # adapted from EMBOSS configure.in
 # ---------------------------------------------------------------------------
 
+if test "${systemuname}" = "IRIX" || test "${systemuname}" = "IRIX64" ; then
+  if test "$CC" != "gcc"; then
+    CHECK_SGI
+  fi
+fi
+
 echo
 echo "+++++++++++++++++++++++++++++++++++++"
 echo "systemuname: ${systemuname}"
@@ -4513,7 +4681,7 @@ if test -n "$CPP" && test -d "$CPP"; then
   CPP=
 fi
 if test -z "$CPP"; then
-  if ${ac_cv_prog_CPP+:} false; then :
+  if test "${ac_cv_prog_CPP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
       # Double quotes because CPP needs to be expanded
@@ -4629,7 +4797,7 @@ else
   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
 fi
 
 ac_ext=c
@@ -4641,7 +4809,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
 $as_echo_n "checking for grep that handles long lines and -e... " >&6; }
-if ${ac_cv_path_GREP+:} false; then :
+if test "${ac_cv_path_GREP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -z "$GREP"; then
@@ -4704,7 +4872,7 @@ $as_echo "$ac_cv_path_GREP" >&6; }
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
 $as_echo_n "checking for egrep... " >&6; }
-if ${ac_cv_path_EGREP+:} false; then :
+if test "${ac_cv_path_EGREP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
@@ -4771,7 +4939,7 @@ $as_echo "$ac_cv_path_EGREP" >&6; }
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
 $as_echo_n "checking for ANSI C header files... " >&6; }
-if ${ac_cv_header_stdc+:} false; then :
+if test "${ac_cv_header_stdc+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -4899,7 +5067,7 @@ done
 
 
 ac_fn_c_check_type "$LINENO" "int64_t" "ac_cv_type_int64_t" "$ac_includes_default"
-if test "x$ac_cv_type_int64_t" = xyes; then :
+if test "x$ac_cv_type_int64_t" = x""yes; then :
   has_int64_t="yes"
 else
   has_int64_t="no"
@@ -4939,47 +5107,40 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 # if 64 bit was not forbidden or silent check for 64 succeeded
 if test "${enable_64}" != "no" || test "${silenthas_int64_t}" = "yes" ; then
 
-  # Test for Linux 64 bit
-  if test "${systemuname}" = "Linux"; then
+    if test "${systemuname}" = "Linux"; then
     CXXFLAGS="-DAJ_Linux64 $CXXFLAGS"
   fi
 
-  # Test for FreeBSD 64 bit
-  if test "${systemuname}" = "FreeBSD"; then
+    if test "${systemuname}" = "FreeBSD"; then
     CXXFLAGS="-DAJ_FreeBSD64 $CXXFLAGS"
   fi
 
-  # Test for OSF1 64 bit (its always this anyway)
-  if test "${systemuname}" = "OSF1"; then
+    if test "${systemuname}" = "OSF1"; then
     CXXFLAGS="-DAJ_OSF164 $CXXFLAGS"
   fi
 
-  # Test for SGI 64 bit
-  if test "${systemuname}" = "IRIX" || test "${systemuname}" = "IRIX64"; then
+    if test "${systemuname}" = "IRIX" || test "${systemuname}" = "IRIX64"; then
     CXXFLAGS="-DAJ_IRIX64 $CXXFLAGS"
   fi
 
-  # Test for AIX 64 bit
-  if test "${systemuname}" = "AIX"; then
+    if test "${systemuname}" = "AIX"; then
     CXXFLAGS="-DAJ_AIX64 $CXXFLAGS"
-    if test $bachCCOMPILER != gcc; then
+    if test "$CC" != "gcc"; then
       CC="$CC -q64"
     fi
     NM="nm -B -X 64"
     AR="ar -X 64"
   fi
 
-  # Test for HP-UX 64 bit
-  if test "${systemuname}" = "HP-UX"; then
-    if test $bachCCOMPILER != gcc; then
+    if test "${systemuname}" = "HP-UX"; then
+    if test "$CC" != "gcc"; then
       CC="$CC +DD64"
     fi
     CXXFLAGS="-DAJ_HPUX64 $CXXFLAGS"
   fi
 
-  # Test for Solaris 64 bit
-  if test "${systemuname}" = "SunOS"; then
-    if test $bachCCOMPILER = gcc; then
+    if test "${systemuname}" = "SunOS"; then
+    if test "$CC" = "gcc"; then
       CFLAGS="$CFLAGS -m64"
       CXXFLAGS="$CXXFLAGS -m64"
       LDFLAGS="$LDFLAGS -m64"
@@ -5069,7 +5230,7 @@ else
     if test "${has_int64_t}" = "yes"; then
       # well, we are on 64 bit, but 64 bit support should be switched off
       # let's see whether we can do it with gcc (with others I don't know)
-      if test $bachCCOMPILER = gcc; then
+      if test "$CC" = "gcc"; then
 	 oldCFLAGS=${CFLAGS}
 	 if test "${systemuname}" = "Darwin"; then
 	   C32FLAGS="-arch i386"
@@ -5111,48 +5272,13 @@ $as_echo "$m32compile" >&6; }
      # on Apple, the test above behaves a bit differently and in
      #  64 bit environment compiling for 32 bits we may land here
      #  just add the -arch flag if gcc is used
-     if test $bachCCOMPILER = gcc; then
+     if test "$CC" = "gcc"; then
        CFLAGS="${CFLAGS} -arch i386"
        CXXFLAGS="${CXXFLAGS} -arch i386"
      fi
    fi
 fi
 
-# circumvent the botch linker with explicit template instantiation on OSX gcc
-if test $bachCCOMPILER = gcc; then
-  if test "${systemuname}" = "Darwin"; then
-    cat >>confdefs.h <<_ACEOF
-#define BOTCHEDEXPLICITINSTANTIATIONLINKER 1
-_ACEOF
-
-  fi
-fi
-
-
-# having this before AC_CANONICAL_BUILD sets the correct CPU info in ${build_os}
-#
-# and we need 10.6 instead of 10.5 as for 10.5, the linker creates a binary like
-# this
-#  /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1669.0.0)
-#  /opt/localwgcc48/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
-#  /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)
-#
-# which does not run on a couple of other OSX installations
-#
-# with clang as compiler, we even need 10.7
-
-if test "${systemuname}" = "Darwin"; then
-  case "${CC}" in
-    *clang*)
-      CFLAGS="-mmacosx-version-min=10.7 ${CFLAGS}"
-      CXXFLAGS="-mmacosx-version-min=10.7 ${CXXFLAGS}"
-    ;;
-    *)
-      CFLAGS="-mmacosx-version-min=10.6 ${CFLAGS}"
-      CXXFLAGS="-mmacosx-version-min=10.6 ${CXXFLAGS}"
-    ;;
-  esac
-fi
 
 # Make sure we can run config.sub.
 $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
@@ -5160,7 +5286,7 @@ $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
 $as_echo_n "checking build system type... " >&6; }
-if ${ac_cv_build+:} false; then :
+if test "${ac_cv_build+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_build_alias=$build_alias
@@ -5176,7 +5302,7 @@ fi
 $as_echo "$ac_cv_build" >&6; }
 case $ac_cv_build in
 *-*-*) ;;
-*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5 ;;
 esac
 build=$ac_cv_build
 ac_save_IFS=$IFS; IFS='-'
@@ -5205,12 +5331,12 @@ else
   # first, set the BITPACKAGE to something which is hopefully correct
   case "${build_cpu}" in
   *x86_64*)
-	mirabp=`echo ${build_cpu} | ${SED} -e 's/x86_64/i386/'`
+	mirabp=`echo ${build_cpu} | sed -e 's/x86_64/i386/'`
 	BITPACKAGE=${mirabp}
 
   ;;
   *64*)
-	mirabp=`echo ${build_cpu} | ${SED} -e 's/64/32/'`
+	mirabp=`echo ${build_cpu} | sed -e 's/64/32/'`
 	BITPACKAGE=${mirabp}
 
   ;;
@@ -5224,7 +5350,6 @@ fi
 
 
 # ---------------------------------------------------------------------------
-# Set optimisation flags
 # ---------------------------------------------------------------------------
 if test "${enable_optimisations+set}" != "set"; then
   enable_optimisations="yes"
@@ -5235,22 +5360,11 @@ if test "${enable_optimisations+set}" = set; then :
 fi
 
 
-# Check whether --enable-native was given.
-if test "${enable_native+set}" = set; then :
-  enableval=$enable_native;
-fi
-
-
-if test "${enable_native+set}" != "set"; then
-  enable_native="no"
-fi
-
-
 if test "${enable_optimisations}" = "yes" ; then
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler optimisation settings" >&5
 $as_echo_n "checking for compiler optimisation settings... " >&6; }
 
-  if test $bachCCOMPILER = gcc; then
+  if test "$CC" = "gcc"; then
     # For GCC, be conservative for all plattforms except the ones where
     #  -O3 is known to work
 
@@ -5263,62 +5377,45 @@ $as_echo_n "checking for compiler optimisation settings... " >&6; }
       OPTFLAGS="-O3 -funroll-loops"
     fi
 
-    # native?
-    if test "${enable_native}" = "yes" ; then
-      OPTFLAGS+=" -march=native -mtune=native"
-#    else
-#      # tuning for the compiler we currently build on is not a too bad idea
-#      # or is it?
-#      OPTFLAGS+=" -mtune=native"
-    fi
 
   else
 
     # default
     OPTFLAGS="-O2"
 
-    # Test for AIX optimisation
-    if test "${systemuname}" = "AIX"; then
+        if test "${systemuname}" = "AIX"; then
       OPTFLAGS="-O3 -qstrict -qarch=auto -qtune=auto"
     fi
 
-    # test for SGI optimisation
-    if test "${systemuname}" = "IRIX" || test "${systemuname}" = "IRIX64" ; then
+        if test "${systemuname}" = "IRIX" || test "${systemuname}" = "IRIX64" ; then
       LD="/usr/bin/ld -IPA"
       OPTFLAGS="-O3"
     fi
 
-    # Test for HP-UX optimisation
-    if test "${systemuname}" = "HP-UX"; then
+        if test "${systemuname}" = "HP-UX"; then
       OPTFLAGS="-fast"
     fi
 
-    # Test for OSF1 optimisation
-    if test "${systemuname}" = "OSF1"; then
+        if test "${systemuname}" = "OSF1"; then
     OPTFLAGS="-fast -U_FASTMATH"
     fi
 
-    # test for Solaris optimisation
-    if test "${systemuname}" = "SunOS"; then
+        if test "${systemuname}" = "SunOS"; then
       OPTFLAGS="-O"
-    # test for 64 bit ptr here (see Solaris 64bit above)
-      if test "${enable_64}" = "yes" ; then
+          if test "${enable_64}" = "yes" ; then
         OPTFLAGS="-xtarget=ultra -xarch=v9"
       fi
     fi
 
-    # Test for Linux optimisation
-    if test "${systemuname}" = "Linux"; then
+        if test "${systemuname}" = "Linux"; then
       OPTFLAGS="-O2"
     fi
 
-    # Test for FreeBSD optimisation
-    if test "${systemuname}" = "FreeBSD"; then
+        if test "${systemuname}" = "FreeBSD"; then
       OPTFLAGS="-O2"
     fi
 
-    # Intel MacOSX requires reduced optimisation for PCRE code
-    if test "${systemuname}" = "Darwin"; then
+        if test "${systemuname}" = "Darwin"; then
       if test "`uname -a | grep i386`"; then
         OPTFLAGS="-O1"
       else
@@ -5333,54 +5430,44 @@ $as_echo_n "checking for compiler optimisation settings... " >&6; }
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${OPTFLAGS}" >&5
 $as_echo "${OPTFLAGS}" >&6; }
 fi
-# End of optimisation tests
 # ---------------------------------------------------------------------------
 
 
 # ---------------------------------------------------------------------------
-# Set special system/compiler combo flags
 # ---------------------------------------------------------------------------
 
-if test $bachCCOMPILER != gcc; then
+if test "$CC" != "gcc"; then
    COMBOFLAGS=""
 
-  # Test for AIX optimisation
-  if test "${systemuname}" = "AIX"; then
+    if test "${systemuname}" = "AIX"; then
    COMBOFLAGS=""
   fi
 
-  # test for SGI optimisation
-  if test "${systemuname}" = "IRIX" || test "${systemuname}" = "IRIX64" ; then
+    if test "${systemuname}" = "IRIX" || test "${systemuname}" = "IRIX64" ; then
    COMBOFLAGS=""
   fi
 
-  # Test for HP-UX optimisation
-  if test "${systemuname}" = "HP-UX"; then
+    if test "${systemuname}" = "HP-UX"; then
     COMBOFLAGS="-Aa +nostl"
   fi
 
-  # Test for OSF1 optimisation
-  if test "${systemuname}" = "OSF1"; then
+    if test "${systemuname}" = "OSF1"; then
    COMBOFLAGS=""
   fi
 
-  # test for Solaris optimisation
-  if test "${systemuname}" = "SunOS"; then
+    if test "${systemuname}" = "SunOS"; then
    COMBOFLAGS=""
   fi
 
-  # Test for Linux optimisation
-  if test "${systemuname}" = "Linux"; then
+    if test "${systemuname}" = "Linux"; then
    COMBOFLAGS=""
   fi
 
-  # Test for FreeBSD optimisation
-  if test "${systemuname}" = "FreeBSD"; then
+    if test "${systemuname}" = "FreeBSD"; then
    COMBOFLAGS=""
   fi
 
-  # Intel MacOSX requires reduced optimisation for PCRE code
-  if test "${systemuname}" = "Darwin"; then
+    if test "${systemuname}" = "Darwin"; then
     COMBOFLAGS=""
   fi
 
@@ -5388,18 +5475,15 @@ if test $bachCCOMPILER != gcc; then
   CXXFLAGS="${CXXFLAGS} ${COMBOFLAGS}"
 fi
 
-# End of special combo flags
 # ---------------------------------------------------------------------------
 
 
 
-# Add extensions to Solaris for some reentrant functions
 if test "${systemuname}" = "SunOS"; then
   CFLAGS="$CFLAGS -D__EXTENSIONS__"
 fi
 
-# Building on OSX is ... difficult.
-# Static building in OSX is ... even more difficult.
+# Static building in OSX is ... difficult.
 #  - Apple has taken out "-static" from allowed linker flags
 #  - ld on OSX does not understand -Wl,-Bstatic or -Bdynamic
 #  - the only way to statically link BOOST and zlib is to have the linker
@@ -5412,51 +5496,28 @@ fi
 #    will be searched *before* all other system libraries
 
 if test "${systemuname}" = "Darwin"; then
-  # this is a solution from http://hackage.haskell.org/trac/ghc/ticket/5019
-  # to the exception handling problem of gcc and the changed OSX functionality
-  if test $bachCCOMPILER = gcc; then
-    LDFLAGS="-Wl,-no_compact_unwind ${LDFLAGS}"
-  fi
-
   if test "${enable_mirastatic}" = "yes" ; then
-    # two hack dirs used. The OSXstatlibs_bach is for my personal setup and building SourceForge releases
-    # the dir without _bach is for users
     echo
     echo "OSX system detected, and we want static build."
     osxstatlibdirhack="`pwd`/OSXstatlibs"
-    osxstatlibdirhack_bach="`pwd`/OSXstatlibs_bach"
-    rm -rf ${osxstatlibdirhack_bach}
-    mkdir ${osxstatlibdirhack_bach}
-    (cd ${osxstatlibdirhack_bach}; ln -s /opt/biosw/lib/*a .; cd ..)
-    (cd ${osxstatlibdirhack_bach}; ln -s /opt/local/lib/gcc49/*a .; cd ..)
-    (cd ${osxstatlibdirhack_bach}; ln -s /opt/local/lib/libbz2.a .; ln -s /opt/local/lib/libexpat.a .; cd ..)
-    LDFLAGS="-L${osxstatlibdirhack} -L${osxstatlibdirhack_bach} -Wl,-search_paths_first ${LDFLAGS}"
+    rm -rf ${osxstatlibdirhack}
+    mkdir ${osxstatlibdirhack}
+    (cd ${osxstatlibdirhack}; ln -s /opt/local/lib/*a .; cd ..)
+    LDFLAGS="-L${osxstatlibdirhack} -Wl,-search_paths_first ${LDFLAGS}"
 
     # note: putting osxstatlibdirhack in LDFLAGS here is pretty futile
     #  as that idiotic libtool will reorder LDFLAGS and insert the standard
     #  path *before* it, negating our wish to link to static libs
     # Solution: BLOODYDARWINSTATLIBDIRHACK is set in src/progs/Makefile.am
     #  via AM_LDFLAGS, so it will appear still before the standard path *phew*
-    #
-    # And we need to tell gcc/ld our explicit wish to link the C and C++ std lib
-    #  statically ... why it does not do that when seeing -static is a mystery to
-    #  me
-    # Note 08.09.2013:
-    # static linking of libgcc and libstdc++ is a bad idea, leads to abort trap 6
-    # We're going the bundle way now.
-    #
     # But we must export BLOODYDARWINSTATLIBDIRHACK for that
-    BLOODYDARWINSTATLIBDIRHACK=" -L${osxstatlibdirhack_bach} -L${osxstatlibdirhack}"
+    BLOODYDARWINSTATLIBDIRHACK="-L${osxstatlibdirhack}"
   fi
-  BUNDLETARGET=darwin
 else
   BLOODYDARWINSTATLIBDIRHACK=""
-  BUNDLETARGET=nobundle
 fi
 BLOODYDARWINSTATLIBDIRHACK=${BLOODYDARWINSTATLIBDIRHACK}
 
-BUNDLETARGET=${BUNDLETARGET}
-
 
 
 echo
@@ -5480,8 +5541,8 @@ esac
 
 
 
-macro_version='2.4.2'
-macro_revision='1.3337'
+macro_version='2.2.6b'
+macro_revision='1.3017'
 
 
 
@@ -5499,7 +5560,7 @@ ltmain="$ac_aux_dir/ltmain.sh"
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
 $as_echo_n "checking host system type... " >&6; }
-if ${ac_cv_host+:} false; then :
+if test "${ac_cv_host+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test "x$host_alias" = x; then
@@ -5514,7 +5575,7 @@ fi
 $as_echo "$ac_cv_host" >&6; }
 case $ac_cv_host in
 *-*-*) ;;
-*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5 ;;
 esac
 host=$ac_cv_host
 ac_save_IFS=$IFS; IFS='-'
@@ -5530,78 +5591,9 @@ IFS=$ac_save_IFS
 case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
 
 
-# Backslashify metacharacters that are still active within
-# double-quoted strings.
-sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
-
-# Same as above, but do not quote variable references.
-double_quote_subst='s/\(["`\\]\)/\\\1/g'
-
-# Sed substitution to delay expansion of an escaped shell variable in a
-# double_quote_subst'ed string.
-delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
-
-# Sed substitution to delay expansion of an escaped single quote.
-delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
-
-# Sed substitution to avoid accidental globbing in evaled expressions
-no_glob_subst='s/\*/\\\*/g'
-
-ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
-ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
-ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5
-$as_echo_n "checking how to print strings... " >&6; }
-# Test print first, because it will be a builtin if present.
-if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
-   test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
-  ECHO='print -r --'
-elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
-  ECHO='printf %s\n'
-else
-  # Use this function as a fallback that always works.
-  func_fallback_echo ()
-  {
-    eval 'cat <<_LTECHO_EOF
-$1
-_LTECHO_EOF'
-  }
-  ECHO='func_fallback_echo'
-fi
-
-# func_echo_all arg...
-# Invoke $ECHO with all args, space-separated.
-func_echo_all ()
-{
-    $ECHO ""
-}
-
-case "$ECHO" in
-  printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5
-$as_echo "printf" >&6; } ;;
-  print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5
-$as_echo "print -r" >&6; } ;;
-  *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5
-$as_echo "cat" >&6; } ;;
-esac
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
 $as_echo_n "checking for a sed that does not truncate output... " >&6; }
-if ${ac_cv_path_SED+:} false; then :
+if test "${ac_cv_path_SED+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
             ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
@@ -5683,7 +5675,7 @@ Xsed="$SED -e 1s/^X//"
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5
 $as_echo_n "checking for fgrep... " >&6; }
-if ${ac_cv_path_FGREP+:} false; then :
+if test "${ac_cv_path_FGREP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1
@@ -5814,7 +5806,7 @@ else
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
 $as_echo_n "checking for non-GNU ld... " >&6; }
 fi
-if ${lt_cv_path_LD+:} false; then :
+if test "${lt_cv_path_LD+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -z "$LD"; then
@@ -5854,7 +5846,7 @@ fi
 test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
-if ${lt_cv_prog_gnu_ld+:} false; then :
+if test "${lt_cv_prog_gnu_ld+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   # I'd rather use --version here, but apparently some GNU lds only accept -v.
@@ -5881,7 +5873,7 @@ with_gnu_ld=$lt_cv_prog_gnu_ld
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5
 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; }
-if ${lt_cv_path_NM+:} false; then :
+if test "${lt_cv_path_NM+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$NM"; then
@@ -5934,17 +5926,14 @@ if test "$lt_cv_path_NM" != "no"; then
   NM="$lt_cv_path_NM"
 else
   # Didn't find any BSD compatible name lister, look for dumpbin.
-  if test -n "$DUMPBIN"; then :
-    # Let the user override the test.
-  else
-    if test -n "$ac_tool_prefix"; then
-  for ac_prog in dumpbin "link -dump"
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in "dumpbin -symbols" "link -dump -symbols"
   do
     # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_DUMPBIN+:} false; then :
+if test "${ac_cv_prog_DUMPBIN+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$DUMPBIN"; then
@@ -5982,13 +5971,13 @@ fi
 fi
 if test -z "$DUMPBIN"; then
   ac_ct_DUMPBIN=$DUMPBIN
-  for ac_prog in dumpbin "link -dump"
+  for ac_prog in "dumpbin -symbols" "link -dump -symbols"
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then :
+if test "${ac_cv_prog_ac_ct_DUMPBIN+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_DUMPBIN"; then
@@ -6037,15 +6026,6 @@ esac
   fi
 fi
 
-    case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
-    *COFF*)
-      DUMPBIN="$DUMPBIN -symbols"
-      ;;
-    *)
-      DUMPBIN=:
-      ;;
-    esac
-  fi
 
   if test "$DUMPBIN" != ":"; then
     NM="$DUMPBIN"
@@ -6060,18 +6040,18 @@ test -z "$NM" && NM=nm
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5
 $as_echo_n "checking the name lister ($NM) interface... " >&6; }
-if ${lt_cv_nm_interface+:} false; then :
+if test "${lt_cv_nm_interface+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_nm_interface="BSD nm"
   echo "int some_variable = 0;" > conftest.$ac_ext
-  (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5)
+  (eval echo "\"\$as_me:6048: $ac_compile\"" >&5)
   (eval "$ac_compile" 2>conftest.err)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+  (eval echo "\"\$as_me:6051: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
   (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:$LINENO: output\"" >&5)
+  (eval echo "\"\$as_me:6054: output\"" >&5)
   cat conftest.out >&5
   if $GREP 'External.*some_variable' conftest.out > /dev/null; then
     lt_cv_nm_interface="MS dumpbin"
@@ -6095,7 +6075,7 @@ fi
 # find the maximum length of command line arguments
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5
 $as_echo_n "checking the maximum length of command line arguments... " >&6; }
-if ${lt_cv_sys_max_cmd_len+:} false; then :
+if test "${lt_cv_sys_max_cmd_len+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
     i=0
@@ -6128,11 +6108,6 @@ else
     lt_cv_sys_max_cmd_len=8192;
     ;;
 
-  mint*)
-    # On MiNT this can take a long time and run out of memory.
-    lt_cv_sys_max_cmd_len=8192;
-    ;;
-
   amigaos*)
     # On AmigaOS with pdksh, this test takes hours, literally.
     # So we just punt and use a minimum line length of 8192.
@@ -6158,11 +6133,6 @@ else
     lt_cv_sys_max_cmd_len=196608
     ;;
 
-  os2*)
-    # The test takes a long time on OS/2.
-    lt_cv_sys_max_cmd_len=8192
-    ;;
-
   osf*)
     # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
     # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
@@ -6202,8 +6172,8 @@ else
       # If test is not a shell built-in, we'll probably end up computing a
       # maximum length that is only half of the actual maximum length, but
       # we can't tell.
-      while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \
-	         = "X$teststring$teststring"; } >/dev/null 2>&1 &&
+      while { test "X"`$SHELL $0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \
+	         = "XX$teststring$teststring"; } >/dev/null 2>&1 &&
 	      test $i != 17 # 1/2 MB should be enough
       do
         i=`expr $i + 1`
@@ -6245,8 +6215,8 @@ $as_echo_n "checking whether the shell understands some XSI constructs... " >&6;
 # Try some XSI features
 xsi_shell=no
 ( _lt_dummy="a/b/c"
-  test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
-      = c,a/b,b/c, \
+  test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \
+      = c,a/b,, \
     && eval 'test $(( 1 + 1 )) -eq 2 \
     && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
   && xsi_shell=yes
@@ -6295,83 +6265,9 @@ esac
 
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5
-$as_echo_n "checking how to convert $build file names to $host format... " >&6; }
-if ${lt_cv_to_host_file_cmd+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $host in
-  *-*-mingw* )
-    case $build in
-      *-*-mingw* ) # actually msys
-        lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
-        ;;
-      *-*-cygwin* )
-        lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
-        ;;
-      * ) # otherwise, assume *nix
-        lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
-        ;;
-    esac
-    ;;
-  *-*-cygwin* )
-    case $build in
-      *-*-mingw* ) # actually msys
-        lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
-        ;;
-      *-*-cygwin* )
-        lt_cv_to_host_file_cmd=func_convert_file_noop
-        ;;
-      * ) # otherwise, assume *nix
-        lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
-        ;;
-    esac
-    ;;
-  * ) # unhandled hosts (and "normal" native builds)
-    lt_cv_to_host_file_cmd=func_convert_file_noop
-    ;;
-esac
-
-fi
-
-to_host_file_cmd=$lt_cv_to_host_file_cmd
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5
-$as_echo "$lt_cv_to_host_file_cmd" >&6; }
-
-
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5
-$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; }
-if ${lt_cv_to_tool_file_cmd+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  #assume ordinary cross tools, or native build.
-lt_cv_to_tool_file_cmd=func_convert_file_noop
-case $host in
-  *-*-mingw* )
-    case $build in
-      *-*-mingw* ) # actually msys
-        lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
-        ;;
-    esac
-    ;;
-esac
-
-fi
-
-to_tool_file_cmd=$lt_cv_to_tool_file_cmd
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5
-$as_echo "$lt_cv_to_tool_file_cmd" >&6; }
-
-
-
-
-
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5
 $as_echo_n "checking for $LD option to reload object files... " >&6; }
-if ${lt_cv_ld_reload_flag+:} false; then :
+if test "${lt_cv_ld_reload_flag+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_ld_reload_flag='-r'
@@ -6385,11 +6281,6 @@ case $reload_flag in
 esac
 reload_cmds='$LD$reload_flag -o $output$reload_objs'
 case $host_os in
-  cygwin* | mingw* | pw32* | cegcc*)
-    if test "$GCC" != yes; then
-      reload_cmds=false
-    fi
-    ;;
   darwin*)
     if test "$GCC" = yes; then
       reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
@@ -6412,7 +6303,7 @@ if test -n "$ac_tool_prefix"; then
 set dummy ${ac_tool_prefix}objdump; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_OBJDUMP+:} false; then :
+if test "${ac_cv_prog_OBJDUMP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$OBJDUMP"; then
@@ -6452,7 +6343,7 @@ if test -z "$ac_cv_prog_OBJDUMP"; then
 set dummy objdump; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then :
+if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_OBJDUMP"; then
@@ -6511,7 +6402,7 @@ test -z "$OBJDUMP" && OBJDUMP=objdump
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5
 $as_echo_n "checking how to recognize dependent libraries... " >&6; }
-if ${lt_cv_deplibs_check_method+:} false; then :
+if test "${lt_cv_deplibs_check_method+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_file_magic_cmd='$MAGIC_CMD'
@@ -6553,18 +6444,16 @@ mingw* | pw32*)
   # Base MSYS/MinGW do not provide the 'file' command needed by
   # func_win32_libid shell function, so use a weaker test based on 'objdump',
   # unless we find 'file', for example because we are cross-compiling.
-  # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
-  if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
+  if ( file / ) >/dev/null 2>&1; then
     lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
     lt_cv_file_magic_cmd='func_win32_libid'
   else
-    # Keep this pattern in sync with the one in func_win32_libid.
-    lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
+    lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
     lt_cv_file_magic_cmd='$OBJDUMP -f'
   fi
   ;;
 
-cegcc*)
+cegcc)
   # use the weaker test based on 'objdump'. See mingw*.
   lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
   lt_cv_file_magic_cmd='$OBJDUMP -f'
@@ -6594,10 +6483,6 @@ gnu*)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
-haiku*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
 hpux10.20* | hpux11*)
   lt_cv_file_magic_cmd=/usr/bin/file
   case $host_cpu in
@@ -6606,11 +6491,11 @@ hpux10.20* | hpux11*)
     lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
     ;;
   hppa*64*)
-    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'
     lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
     ;;
   *)
-    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library'
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
     lt_cv_file_magic_test_file=/usr/lib/libc.sl
     ;;
   esac
@@ -6631,7 +6516,7 @@ irix5* | irix6* | nonstopux*)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
-# This must be glibc/ELF.
+# This must be Linux ELF.
 linux* | k*bsd*-gnu | kopensolaris*-gnu)
   lt_cv_deplibs_check_method=pass_all
   ;;
@@ -6713,21 +6598,6 @@ esac
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5
 $as_echo "$lt_cv_deplibs_check_method" >&6; }
-
-file_magic_glob=
-want_nocaseglob=no
-if test "$build" = "$host"; then
-  case $host_os in
-  mingw* | pw32*)
-    if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
-      want_nocaseglob=yes
-    else
-      file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"`
-    fi
-    ;;
-  esac
-fi
-
 file_magic_cmd=$lt_cv_file_magic_cmd
 deplibs_check_method=$lt_cv_deplibs_check_method
 test -z "$deplibs_check_method" && deplibs_check_method=unknown
@@ -6743,26 +6613,16 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown
 
 
 
-
-
-
-
-
-
-
-
-
-
 if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
-set dummy ${ac_tool_prefix}dlltool; ac_word=$2
+  # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ar; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_DLLTOOL+:} false; then :
+if test "${ac_cv_prog_AR+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -n "$DLLTOOL"; then
-  ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
+  if test -n "$AR"; then
+  ac_cv_prog_AR="$AR" # Let the user override the test.
 else
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
@@ -6771,7 +6631,7 @@ do
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
+    ac_cv_prog_AR="${ac_tool_prefix}ar"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -6781,10 +6641,10 @@ IFS=$as_save_IFS
 
 fi
 fi
-DLLTOOL=$ac_cv_prog_DLLTOOL
-if test -n "$DLLTOOL"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5
-$as_echo "$DLLTOOL" >&6; }
+AR=$ac_cv_prog_AR
+if test -n "$AR"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
+$as_echo "$AR" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
@@ -6792,17 +6652,17 @@ fi
 
 
 fi
-if test -z "$ac_cv_prog_DLLTOOL"; then
-  ac_ct_DLLTOOL=$DLLTOOL
-  # Extract the first word of "dlltool", so it can be a program name with args.
-set dummy dlltool; ac_word=$2
+if test -z "$ac_cv_prog_AR"; then
+  ac_ct_AR=$AR
+  # Extract the first word of "ar", so it can be a program name with args.
+set dummy ar; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then :
+if test "${ac_cv_prog_ac_ct_AR+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -n "$ac_ct_DLLTOOL"; then
-  ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test.
+  if test -n "$ac_ct_AR"; then
+  ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
 else
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
@@ -6811,7 +6671,7 @@ do
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_DLLTOOL="dlltool"
+    ac_cv_prog_ac_ct_AR="ar"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -6821,17 +6681,17 @@ IFS=$as_save_IFS
 
 fi
 fi
-ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL
-if test -n "$ac_ct_DLLTOOL"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5
-$as_echo "$ac_ct_DLLTOOL" >&6; }
+ac_ct_AR=$ac_cv_prog_ac_ct_AR
+if test -n "$ac_ct_AR"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
+$as_echo "$ac_ct_AR" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
-  if test "x$ac_ct_DLLTOOL" = x; then
-    DLLTOOL="false"
+  if test "x$ac_ct_AR" = x; then
+    AR="false"
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
@@ -6839,13 +6699,14 @@ yes:)
 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
-    DLLTOOL=$ac_ct_DLLTOOL
+    AR=$ac_ct_AR
   fi
 else
-  DLLTOOL="$ac_cv_prog_DLLTOOL"
+  AR="$ac_cv_prog_AR"
 fi
 
-test -z "$DLLTOOL" && DLLTOOL=dlltool
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
 
 
 
@@ -6856,56 +6717,17 @@ test -z "$DLLTOOL" && DLLTOOL=dlltool
 
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5
-$as_echo_n "checking how to associate runtime and link libraries... " >&6; }
-if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_sharedlib_from_linklib_cmd='unknown'
-
-case $host_os in
-cygwin* | mingw* | pw32* | cegcc*)
-  # two different shell functions defined in ltmain.sh
-  # decide which to use based on capabilities of $DLLTOOL
-  case `$DLLTOOL --help 2>&1` in
-  *--identify-strict*)
-    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
-    ;;
-  *)
-    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
-    ;;
-  esac
-  ;;
-*)
-  # fallback: assume linklib IS sharedlib
-  lt_cv_sharedlib_from_linklib_cmd="$ECHO"
-  ;;
-esac
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5
-$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; }
-sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
-test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
-
-
-
-
-
-
 
 if test -n "$ac_tool_prefix"; then
-  for ac_prog in ar
-  do
-    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
-set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_AR+:} false; then :
+if test "${ac_cv_prog_STRIP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -n "$AR"; then
-  ac_cv_prog_AR="$AR" # Let the user override the test.
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
 else
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
@@ -6914,7 +6736,7 @@ do
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_AR="$ac_tool_prefix$ac_prog"
+    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -6924,32 +6746,28 @@ IFS=$as_save_IFS
 
 fi
 fi
-AR=$ac_cv_prog_AR
-if test -n "$AR"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
-$as_echo "$AR" >&6; }
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
-    test -n "$AR" && break
-  done
 fi
-if test -z "$AR"; then
-  ac_ct_AR=$AR
-  for ac_prog in ar
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
+if test -z "$ac_cv_prog_STRIP"; then
+  ac_ct_STRIP=$STRIP
+  # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_AR+:} false; then :
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -n "$ac_ct_AR"; then
-  ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
+  if test -n "$ac_ct_STRIP"; then
+  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
 else
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
@@ -6958,7 +6776,7 @@ do
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_AR="$ac_prog"
+    ac_cv_prog_ac_ct_STRIP="strip"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -6968,21 +6786,17 @@ IFS=$as_save_IFS
 
 fi
 fi
-ac_ct_AR=$ac_cv_prog_ac_ct_AR
-if test -n "$ac_ct_AR"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
-$as_echo "$ac_ct_AR" >&6; }
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
-
-  test -n "$ac_ct_AR" && break
-done
-
-  if test "x$ac_ct_AR" = x; then
-    AR="false"
+  if test "x$ac_ct_STRIP" = x; then
+    STRIP=":"
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
@@ -6990,75 +6804,13 @@ yes:)
 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
-    AR=$ac_ct_AR
+    STRIP=$ac_ct_STRIP
   fi
-fi
-
-: ${AR=ar}
-: ${AR_FLAGS=cru}
-
-
-
-
-
-
-
-
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5
-$as_echo_n "checking for archiver @FILE support... " >&6; }
-if ${lt_cv_ar_at_file+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_ar_at_file=no
-   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  echo conftest.$ac_objext > conftest.lst
-      lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5'
-      { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
-  (eval $lt_ar_try) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }
-      if test "$ac_status" -eq 0; then
-	# Ensure the archiver fails upon bogus file names.
-	rm -f conftest.$ac_objext libconftest.a
-	{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
-  (eval $lt_ar_try) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }
-	if test "$ac_status" -ne 0; then
-          lt_cv_ar_at_file=@
-        fi
-      fi
-      rm -f conftest.* libconftest.a
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5
-$as_echo "$lt_cv_ar_at_file" >&6; }
-
-if test "x$lt_cv_ar_at_file" = xno; then
-  archiver_list_spec=
 else
-  archiver_list_spec=$lt_cv_ar_at_file
+  STRIP="$ac_cv_prog_STRIP"
 fi
 
+test -z "$STRIP" && STRIP=:
 
 
 
@@ -7066,15 +6818,15 @@ fi
 
 
 if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
-set dummy ${ac_tool_prefix}strip; ac_word=$2
+  # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_STRIP+:} false; then :
+if test "${ac_cv_prog_RANLIB+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -n "$STRIP"; then
-  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
 else
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
@@ -7083,106 +6835,7 @@ do
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-STRIP=$ac_cv_prog_STRIP
-if test -n "$STRIP"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
-$as_echo "$STRIP" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_STRIP"; then
-  ac_ct_STRIP=$STRIP
-  # Extract the first word of "strip", so it can be a program name with args.
-set dummy strip; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_STRIP"; then
-  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_STRIP="strip"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
-if test -n "$ac_ct_STRIP"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
-$as_echo "$ac_ct_STRIP" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-  if test "x$ac_ct_STRIP" = x; then
-    STRIP=":"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    STRIP=$ac_ct_STRIP
-  fi
-else
-  STRIP="$ac_cv_prog_STRIP"
-fi
-
-test -z "$STRIP" && STRIP=:
-
-
-
-
-
-
-if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
-set dummy ${ac_tool_prefix}ranlib; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_RANLIB+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$RANLIB"; then
-  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+    ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -7209,7 +6862,7 @@ if test -z "$ac_cv_prog_RANLIB"; then
 set dummy ranlib; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_RANLIB+:} false; then :
+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_RANLIB"; then
@@ -7271,27 +6924,15 @@ old_postuninstall_cmds=
 if test -n "$RANLIB"; then
   case $host_os in
   openbsd*)
-    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
     ;;
   *)
-    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
     ;;
   esac
-  old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib"
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
 fi
 
-case $host_os in
-  darwin*)
-    lock_old_archive_extraction=yes ;;
-  *)
-    lock_old_archive_extraction=no ;;
-esac
-
-
-
-
-
-
 
 
 
@@ -7338,7 +6979,7 @@ compiler=$CC
 # Check for command to grab the raw symbol name followed by C symbol from nm.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5
 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; }
-if ${lt_cv_sys_global_symbol_pipe+:} false; then :
+if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
 
@@ -7399,8 +7040,8 @@ esac
 lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
 
 # Transform an extracted symbol line into symbol name and symbol address
-lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (void *) \&\2},/p'"
-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
 
 # Handle CRLF in mingw tool chain
 opt_cr=
@@ -7424,7 +7065,6 @@ for ac_symprfx in "" "_"; do
     # which start with @ or ?.
     lt_cv_sys_global_symbol_pipe="$AWK '"\
 "     {last_section=section; section=\$ 3};"\
-"     /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
 "     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
 "     \$ 0!~/External *\|/{next};"\
 "     / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
@@ -7437,7 +7077,6 @@ for ac_symprfx in "" "_"; do
   else
     lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[	 ]\($symcode$symcode*\)[	 ][	 ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
   fi
-  lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
 
   # Check to see that the pipe works correctly.
   pipe_works=no
@@ -7463,8 +7102,8 @@ _LT_EOF
   test $ac_status = 0; }; then
     # Now try to grab the symbols.
     nlist=conftest.nm
-    if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5
-  (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5
+    if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\""; } >&5
+  (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; } && test -s "$nlist"; then
@@ -7479,18 +7118,6 @@ _LT_EOF
       if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
 	if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
 	  cat <<_LT_EOF > conftest.$ac_ext
-/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
-#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
-/* DATA imports from DLLs on WIN32 con't be const, because runtime
-   relocations are performed -- see ld's documentation on pseudo-relocs.  */
-# define LT_DLSYM_CONST
-#elif defined(__osf__)
-/* This system does not cope well with relocations in const data.  */
-# define LT_DLSYM_CONST
-#else
-# define LT_DLSYM_CONST const
-#endif
-
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -7502,7 +7129,7 @@ _LT_EOF
 	  cat <<_LT_EOF >> conftest.$ac_ext
 
 /* The mapping between symbol names and symbols.  */
-LT_DLSYM_CONST struct {
+const struct {
   const char *name;
   void       *address;
 }
@@ -7528,8 +7155,8 @@ static const void *lt_preloaded_setup() {
 _LT_EOF
 	  # Now try linking the two files.
 	  mv conftest.$ac_objext conftstm.$ac_objext
-	  lt_globsym_save_LIBS=$LIBS
-	  lt_globsym_save_CFLAGS=$CFLAGS
+	  lt_save_LIBS="$LIBS"
+	  lt_save_CFLAGS="$CFLAGS"
 	  LIBS="conftstm.$ac_objext"
 	  CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
 	  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
@@ -7539,8 +7166,8 @@ _LT_EOF
   test $ac_status = 0; } && test -s conftest${ac_exeext}; then
 	    pipe_works=yes
 	  fi
-	  LIBS=$lt_globsym_save_LIBS
-	  CFLAGS=$lt_globsym_save_CFLAGS
+	  LIBS="$lt_save_LIBS"
+	  CFLAGS="$lt_save_CFLAGS"
 	else
 	  echo "cannot find nm_test_func in $nlist" >&5
 	fi
@@ -7577,18 +7204,6 @@ else
 $as_echo "ok" >&6; }
 fi
 
-# Response file support.
-if test "$lt_cv_nm_interface" = "MS dumpbin"; then
-  nm_file_list_spec='@'
-elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then
-  nm_file_list_spec='@'
-fi
-
-
-
-
-
-
 
 
 
@@ -7610,43 +7225,6 @@ fi
 
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5
-$as_echo_n "checking for sysroot... " >&6; }
-
-# Check whether --with-sysroot was given.
-if test "${with_sysroot+set}" = set; then :
-  withval=$with_sysroot;
-else
-  with_sysroot=no
-fi
-
-
-lt_sysroot=
-case ${with_sysroot} in #(
- yes)
-   if test "$GCC" = yes; then
-     lt_sysroot=`$CC --print-sysroot 2>/dev/null`
-   fi
-   ;; #(
- /*)
-   lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
-   ;; #(
- no|'')
-   ;; #(
- *)
-   { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5
-$as_echo "${with_sysroot}" >&6; }
-   as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5
-   ;;
-esac
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5
-$as_echo "${lt_sysroot:-no}" >&6; }
-
-
-
-
-
 # Check whether --enable-libtool-lock was given.
 if test "${enable_libtool_lock+set}" = set; then :
   enableval=$enable_libtool_lock;
@@ -7678,7 +7256,7 @@ ia64-*-hpux*)
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line '$LINENO' "configure"' > conftest.$ac_ext
+  echo '#line 7259 "configure"' > conftest.$ac_ext
   if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -7772,7 +7350,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
   CFLAGS="$CFLAGS -belf"
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5
 $as_echo_n "checking whether the C compiler needs -belf... " >&6; }
-if ${lt_cv_cc_needs_belf+:} false; then :
+if test "${lt_cv_cc_needs_belf+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_ext=c
@@ -7813,7 +7391,7 @@ $as_echo "$lt_cv_cc_needs_belf" >&6; }
     CFLAGS="$SAVE_CFLAGS"
   fi
   ;;
-*-*solaris*)
+sparc*-*solaris*)
   # Find out which ABI we are using.
   echo 'int i;' > conftest.$ac_ext
   if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
@@ -7824,20 +7402,7 @@ $as_echo "$lt_cv_cc_needs_belf" >&6; }
     case `/usr/bin/file conftest.o` in
     *64-bit*)
       case $lt_cv_prog_gnu_ld in
-      yes*)
-        case $host in
-        i?86-*-solaris*)
-          LD="${LD-ld} -m elf_x86_64"
-          ;;
-        sparc*-*-solaris*)
-          LD="${LD-ld} -m elf64_sparc"
-          ;;
-        esac
-        # GNU ld 2.21 introduced _sol2 emulations.  Use them if available.
-        if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
-          LD="${LD-ld}_sol2"
-        fi
-        ;;
+      yes*) LD="${LD-ld} -m elf64_sparc" ;;
       *)
 	if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
 	  LD="${LD-ld} -64"
@@ -7853,123 +7418,6 @@ esac
 
 need_locks="$enable_libtool_lock"
 
-if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args.
-set dummy ${ac_tool_prefix}mt; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_MANIFEST_TOOL+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$MANIFEST_TOOL"; then
-  ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL
-if test -n "$MANIFEST_TOOL"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5
-$as_echo "$MANIFEST_TOOL" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_MANIFEST_TOOL"; then
-  ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL
-  # Extract the first word of "mt", so it can be a program name with args.
-set dummy mt; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_MANIFEST_TOOL"; then
-  ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_MANIFEST_TOOL="mt"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL
-if test -n "$ac_ct_MANIFEST_TOOL"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5
-$as_echo "$ac_ct_MANIFEST_TOOL" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-  if test "x$ac_ct_MANIFEST_TOOL" = x; then
-    MANIFEST_TOOL=":"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL
-  fi
-else
-  MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL"
-fi
-
-test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5
-$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; }
-if ${lt_cv_path_mainfest_tool+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_path_mainfest_tool=no
-  echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5
-  $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
-  cat conftest.err >&5
-  if $GREP 'Manifest Tool' conftest.out > /dev/null; then
-    lt_cv_path_mainfest_tool=yes
-  fi
-  rm -f conftest*
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5
-$as_echo "$lt_cv_path_mainfest_tool" >&6; }
-if test "x$lt_cv_path_mainfest_tool" != xyes; then
-  MANIFEST_TOOL=:
-fi
-
-
-
-
-
 
   case $host_os in
     rhapsody* | darwin*)
@@ -7978,7 +7426,7 @@ fi
 set dummy ${ac_tool_prefix}dsymutil; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_DSYMUTIL+:} false; then :
+if test "${ac_cv_prog_DSYMUTIL+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$DSYMUTIL"; then
@@ -8018,7 +7466,7 @@ if test -z "$ac_cv_prog_DSYMUTIL"; then
 set dummy dsymutil; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then :
+if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_DSYMUTIL"; then
@@ -8070,7 +7518,7 @@ fi
 set dummy ${ac_tool_prefix}nmedit; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_NMEDIT+:} false; then :
+if test "${ac_cv_prog_NMEDIT+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$NMEDIT"; then
@@ -8110,7 +7558,7 @@ if test -z "$ac_cv_prog_NMEDIT"; then
 set dummy nmedit; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then :
+if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_NMEDIT"; then
@@ -8162,7 +7610,7 @@ fi
 set dummy ${ac_tool_prefix}lipo; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_LIPO+:} false; then :
+if test "${ac_cv_prog_LIPO+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$LIPO"; then
@@ -8202,7 +7650,7 @@ if test -z "$ac_cv_prog_LIPO"; then
 set dummy lipo; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_LIPO+:} false; then :
+if test "${ac_cv_prog_ac_ct_LIPO+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_LIPO"; then
@@ -8254,7 +7702,7 @@ fi
 set dummy ${ac_tool_prefix}otool; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_OTOOL+:} false; then :
+if test "${ac_cv_prog_OTOOL+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$OTOOL"; then
@@ -8294,7 +7742,7 @@ if test -z "$ac_cv_prog_OTOOL"; then
 set dummy otool; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_OTOOL+:} false; then :
+if test "${ac_cv_prog_ac_ct_OTOOL+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_OTOOL"; then
@@ -8346,7 +7794,7 @@ fi
 set dummy ${ac_tool_prefix}otool64; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_OTOOL64+:} false; then :
+if test "${ac_cv_prog_OTOOL64+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$OTOOL64"; then
@@ -8386,7 +7834,7 @@ if test -z "$ac_cv_prog_OTOOL64"; then
 set dummy otool64; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then :
+if test "${ac_cv_prog_ac_ct_OTOOL64+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_OTOOL64"; then
@@ -8461,7 +7909,7 @@ fi
 
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5
 $as_echo_n "checking for -single_module linker flag... " >&6; }
-if ${lt_cv_apple_cc_single_mod+:} false; then :
+if test "${lt_cv_apple_cc_single_mod+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_apple_cc_single_mod=no
@@ -8477,13 +7925,7 @@ else
 	$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
 	  -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
         _lt_result=$?
-	# If there is a non-empty error log, and "single_module"
-	# appears in it, assume the flag caused a linker warning
-        if test -s conftest.err && $GREP single_module conftest.err; then
-	  cat conftest.err >&5
-	# Otherwise, if the output was created with a 0 exit code from
-	# the compiler, it worked.
-	elif test -f libconftest.dylib && test $_lt_result -eq 0; then
+	if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then
 	  lt_cv_apple_cc_single_mod=yes
 	else
 	  cat conftest.err >&5
@@ -8494,10 +7936,9 @@ else
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5
 $as_echo "$lt_cv_apple_cc_single_mod" >&6; }
-
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5
 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; }
-if ${lt_cv_ld_exported_symbols_list+:} false; then :
+if test "${lt_cv_ld_exported_symbols_list+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_ld_exported_symbols_list=no
@@ -8527,41 +7968,6 @@ rm -f core conftest.err conftest.$ac_objext \
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5
 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; }
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5
-$as_echo_n "checking for -force_load linker flag... " >&6; }
-if ${lt_cv_ld_force_load+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_ld_force_load=no
-      cat > conftest.c << _LT_EOF
-int forced_loaded() { return 2;}
-_LT_EOF
-      echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5
-      $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5
-      echo "$AR cru libconftest.a conftest.o" >&5
-      $AR cru libconftest.a conftest.o 2>&5
-      echo "$RANLIB libconftest.a" >&5
-      $RANLIB libconftest.a 2>&5
-      cat > conftest.c << _LT_EOF
-int main() { return 0;}
-_LT_EOF
-      echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5
-      $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
-      _lt_result=$?
-      if test -s conftest.err && $GREP force_load conftest.err; then
-	cat conftest.err >&5
-      elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then
-	lt_cv_ld_force_load=yes
-      else
-	cat conftest.err >&5
-      fi
-        rm -f conftest.err libconftest.a conftest conftest.c
-        rm -rf conftest.dSYM
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5
-$as_echo "$lt_cv_ld_force_load" >&6; }
     case $host_os in
     rhapsody* | darwin1.[012])
       _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
@@ -8589,7 +7995,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
     else
       _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
     fi
-    if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
+    if test "$DSYMUTIL" != ":"; then
       _lt_dsymutil='~$DSYMUTIL $lib || :'
     else
       _lt_dsymutil=
@@ -8601,7 +8007,7 @@ for ac_header in dlfcn.h
 do :
   ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default
 "
-if test "x$ac_cv_header_dlfcn_h" = xyes; then :
+if test "x$ac_cv_header_dlfcn_h" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
 #define HAVE_DLFCN_H 1
 _ACEOF
@@ -8612,166 +8018,660 @@ done
 
 
 
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+if test -z "$CXX"; then
+  if test -n "$CCC"; then
+    CXX=$CCC
+  else
+    if test -n "$ac_tool_prefix"; then
+  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CXX+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CXX"; then
+  ac_cv_prog_CXX="$CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
 
-func_stripname_cnf ()
-{
-  case ${2} in
-  .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
-  *)  func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
-  esac
-} # func_stripname_cnf
-
-
-
-
-
-# Set options
-
-
-
-        enable_dlopen=no
-
-
-  enable_win32_dll=no
-
-
-            # Check whether --enable-shared was given.
-if test "${enable_shared+set}" = set; then :
-  enableval=$enable_shared; p=${PACKAGE-default}
-    case $enableval in
-    yes) enable_shared=yes ;;
-    no) enable_shared=no ;;
-    *)
-      enable_shared=no
-      # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
-      for pkg in $enableval; do
-	IFS="$lt_save_ifs"
-	if test "X$pkg" = "X$p"; then
-	  enable_shared=yes
-	fi
-      done
-      IFS="$lt_save_ifs"
-      ;;
-    esac
+fi
+fi
+CXX=$ac_cv_prog_CXX
+if test -n "$CXX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5
+$as_echo "$CXX" >&6; }
 else
-  enable_shared=yes
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
+    test -n "$CXX" && break
+  done
+fi
+if test -z "$CXX"; then
+  ac_ct_CXX=$CXX
+  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CXX"; then
+  ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CXX="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
 
-
-
-
-
-
-
-  # Check whether --enable-static was given.
-if test "${enable_static+set}" = set; then :
-  enableval=$enable_static; p=${PACKAGE-default}
-    case $enableval in
-    yes) enable_static=yes ;;
-    no) enable_static=no ;;
-    *)
-     enable_static=no
-      # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
-      for pkg in $enableval; do
-	IFS="$lt_save_ifs"
-	if test "X$pkg" = "X$p"; then
-	  enable_static=yes
-	fi
-      done
-      IFS="$lt_save_ifs"
-      ;;
-    esac
+fi
+fi
+ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
+if test -n "$ac_ct_CXX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5
+$as_echo "$ac_ct_CXX" >&6; }
 else
-  enable_static=yes
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
+  test -n "$ac_ct_CXX" && break
+done
 
+  if test "x$ac_ct_CXX" = x; then
+    CXX="g++"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CXX=$ac_ct_CXX
+  fi
+fi
 
+  fi
+fi
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+  { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    sed '10a\
+... rest of stderr output deleted ...
+         10q' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+  fi
+  rm -f conftest.er1 conftest.err
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+done
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5
+$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; }
+if test "${ac_cv_cxx_compiler_gnu+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
 
-
-
-
-# Check whether --with-pic was given.
-if test "${with_pic+set}" = set; then :
-  withval=$with_pic; lt_p=${PACKAGE-default}
-    case $withval in
-    yes|no) pic_mode=$withval ;;
-    *)
-      pic_mode=default
-      # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
-      for lt_pkg in $withval; do
-	IFS="$lt_save_ifs"
-	if test "X$lt_pkg" = "X$lt_p"; then
-	  pic_mode=yes
-	fi
-      done
-      IFS="$lt_save_ifs"
-      ;;
-    esac
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_compiler_gnu=yes
 else
-  pic_mode=default
+  ac_compiler_gnu=no
 fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
 
-
-test -z "$pic_mode" && pic_mode=default
-
-
-
-
-
-
-
-  # Check whether --enable-fast-install was given.
-if test "${enable_fast_install+set}" = set; then :
-  enableval=$enable_fast_install; p=${PACKAGE-default}
-    case $enableval in
-    yes) enable_fast_install=yes ;;
-    no) enable_fast_install=no ;;
-    *)
-      enable_fast_install=no
-      # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
-      for pkg in $enableval; do
-	IFS="$lt_save_ifs"
-	if test "X$pkg" = "X$p"; then
-	  enable_fast_install=yes
-	fi
-      done
-      IFS="$lt_save_ifs"
-      ;;
-    esac
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5
+$as_echo "$ac_cv_cxx_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+  GXX=yes
 else
-  enable_fast_install=yes
+  GXX=
 fi
+ac_test_CXXFLAGS=${CXXFLAGS+set}
+ac_save_CXXFLAGS=$CXXFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5
+$as_echo_n "checking whether $CXX accepts -g... " >&6; }
+if test "${ac_cv_prog_cxx_g+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_save_cxx_werror_flag=$ac_cxx_werror_flag
+   ac_cxx_werror_flag=yes
+   ac_cv_prog_cxx_g=no
+   CXXFLAGS="-g"
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
+int
+main ()
+{
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_cv_prog_cxx_g=yes
+else
+  CXXFLAGS=""
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
+int
+main ()
+{
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
 
+else
+  ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+	 CXXFLAGS="-g"
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_cv_prog_cxx_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5
+$as_echo "$ac_cv_prog_cxx_g" >&6; }
+if test "$ac_test_CXXFLAGS" = set; then
+  CXXFLAGS=$ac_save_CXXFLAGS
+elif test $ac_cv_prog_cxx_g = yes; then
+  if test "$GXX" = yes; then
+    CXXFLAGS="-g -O2"
+  else
+    CXXFLAGS="-g"
+  fi
+else
+  if test "$GXX" = yes; then
+    CXXFLAGS="-O2"
+  else
+    CXXFLAGS=
+  fi
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+depcc="$CXX"  am_compiler_list=
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_CXX_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  am__universal=false
+  case " $depcc " in #(
+     *\ -arch\ *\ -arch\ *) am__universal=true ;;
+     esac
+
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.  Also, some Intel
+    # versions had trouble with output in subdirs
+    am__obj=sub/conftest.${OBJEXT-o}
+    am__minus_obj="-o $am__obj"
+    case $depmode in
+    gcc)
+      # This depmode causes a compiler race in universal mode.
+      test "$am__universal" = false || continue
+      ;;
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+	continue
+      else
+	break
+      fi
+      ;;
+    msvisualcpp | msvcmsys)
+      # This compiler won't grok `-c -o', but also, the minuso test has
+      # not run yet.  These depmodes are late enough in the game, and
+      # so weak that their functioning should not be impacted.
+      am__obj=conftest.${OBJEXT-o}
+      am__minus_obj=
+      ;;
+    none) break ;;
+    esac
+    if depmode=$depmode \
+       source=sub/conftest.c object=$am__obj \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_CXX_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_CXX_dependencies_compiler_type=none
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; }
+CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type
+
+ if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then
+  am__fastdepCXX_TRUE=
+  am__fastdepCXX_FALSE='#'
+else
+  am__fastdepCXX_TRUE='#'
+  am__fastdepCXX_FALSE=
+fi
+
+
+if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+    (test "X$CXX" != "Xg++"))) ; then
+  ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5
+$as_echo_n "checking how to run the C++ preprocessor... " >&6; }
+if test -z "$CXXCPP"; then
+  if test "${ac_cv_prog_CXXCPP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+      # Double quotes because CXXCPP needs to be expanded
+    for CXXCPP in "$CXX -E" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
+
+else
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
+else
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+  break
+fi
+
+    done
+    ac_cv_prog_CXXCPP=$CXXCPP
+
+fi
+  CXXCPP=$ac_cv_prog_CXXCPP
+else
+  ac_cv_prog_CXXCPP=$CXXCPP
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5
+$as_echo "$CXXCPP" >&6; }
+ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
+
+else
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
+else
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+
+else
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+_lt_caught_CXX_error=yes; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+else
+  _lt_caught_CXX_error=yes
+fi
+
+
+
+
+
+# Set options
+
+
+
+        enable_dlopen=no
+
+
+  enable_win32_dll=no
+
+
+            # Check whether --enable-shared was given.
+if test "${enable_shared+set}" = set; then :
+  enableval=$enable_shared; p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_shared=yes ;;
+    no) enable_shared=no ;;
+    *)
+      enable_shared=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_shared=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_shared=yes
+fi
+
+
+
+
+
+
+
+
+
+  # Check whether --enable-static was given.
+if test "${enable_static+set}" = set; then :
+  enableval=$enable_static; p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_static=yes ;;
+    no) enable_static=no ;;
+    *)
+     enable_static=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_static=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_static=yes
+fi
+
+
+
+
+
+
+
+
+
+
+# Check whether --with-pic was given.
+if test "${with_pic+set}" = set; then :
+  withval=$with_pic; pic_mode="$withval"
+else
+  pic_mode=default
+fi
+
+
+test -z "$pic_mode" && pic_mode=default
+
+
+
+
+
+
+
+  # Check whether --enable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then :
+  enableval=$enable_fast_install; p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_fast_install=yes ;;
+    no) enable_fast_install=no ;;
+    *)
+      enable_fast_install=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_fast_install=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_fast_install=yes
+fi
 
 
 
 
 
 
-# This can be used to rebuild libtool when needed
-LIBTOOL_DEPS="$ltmain"
 
-# Always use our own libtool.
-LIBTOOL='$(SHELL) $(top_builddir)/libtool'
 
 
 
 
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ltmain"
 
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
 
 
 
@@ -8818,7 +8718,7 @@ fi
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5
 $as_echo_n "checking for objdir... " >&6; }
-if ${lt_cv_objdir+:} false; then :
+if test "${lt_cv_objdir+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   rm -f .libs 2>/dev/null
@@ -8846,6 +8746,19 @@ _ACEOF
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
 case $host_os in
 aix3*)
   # AIX sometimes has problems with the GCC collect2 program.  For some
@@ -8858,6 +8771,23 @@ aix3*)
   ;;
 esac
 
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\(["`\\]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
 # Global variables:
 ofile=libtool
 can_build_shared=yes
@@ -8886,7 +8816,7 @@ for cc_temp in $compiler""; do
     *) break;;
   esac
 done
-cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
 
 
 # Only perform the check for file, if the check method requires it
@@ -8896,7 +8826,7 @@ file_magic*)
   if test "$file_magic_cmd" = '$MAGIC_CMD'; then
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5
 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; }
-if ${lt_cv_path_MAGIC_CMD+:} false; then :
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $MAGIC_CMD in
@@ -8962,7 +8892,7 @@ if test -z "$lt_cv_path_MAGIC_CMD"; then
   if test -n "$ac_tool_prefix"; then
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5
 $as_echo_n "checking for file... " >&6; }
-if ${lt_cv_path_MAGIC_CMD+:} false; then :
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $MAGIC_CMD in
@@ -9086,21 +9016,20 @@ _lt_linker_boilerplate=`cat conftest.err`
 $RM -r conftest*
 
 
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
 if test -n "$compiler"; then
 
 lt_prog_compiler_no_builtin_flag=
 
 if test "$GCC" = yes; then
-  case $cc_basename in
-  nvcc*)
-    lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;;
-  *)
-    lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;;
-  esac
+  lt_prog_compiler_no_builtin_flag=' -fno-builtin'
 
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; }
-if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then :
+if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler_rtti_exceptions=no
@@ -9116,15 +9045,15 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:9048: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   echo "$as_me:9052: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
-     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
      $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
      if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
        lt_cv_prog_compiler_rtti_exceptions=yes
@@ -9153,6 +9082,8 @@ fi
 lt_prog_compiler_pic=
 lt_prog_compiler_static=
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
 
   if test "$GCC" = yes; then
     lt_prog_compiler_wl='-Wl,'
@@ -9200,12 +9131,6 @@ lt_prog_compiler_static=
       lt_prog_compiler_pic='-fno-common'
       ;;
 
-    haiku*)
-      # PIC is the default for Haiku.
-      # The "-static" flag exists, but is broken.
-      lt_prog_compiler_static=
-      ;;
-
     hpux*)
       # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
       # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
@@ -9248,15 +9173,6 @@ lt_prog_compiler_static=
       lt_prog_compiler_pic='-fPIC'
       ;;
     esac
-
-    case $cc_basename in
-    nvcc*) # Cuda Compiler Driver 2.2
-      lt_prog_compiler_wl='-Xlinker '
-      if test -n "$lt_prog_compiler_pic"; then
-        lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic"
-      fi
-      ;;
-    esac
   else
     # PORTME Check for flag to pass linker flags through the system compiler.
     case $host_os in
@@ -9319,13 +9235,7 @@ lt_prog_compiler_static=
 	lt_prog_compiler_pic='--shared'
 	lt_prog_compiler_static='--static'
 	;;
-      nagfor*)
-	# NAG Fortran compiler
-	lt_prog_compiler_wl='-Wl,-Wl,,'
-	lt_prog_compiler_pic='-PIC'
-	lt_prog_compiler_static='-Bstatic'
-	;;
-      pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
+      pgcc* | pgf77* | pgf90* | pgf95*)
         # Portland Group compilers (*not* the Pentium gcc compiler,
 	# which looks to be a dead project)
 	lt_prog_compiler_wl='-Wl,'
@@ -9337,40 +9247,25 @@ lt_prog_compiler_static=
         # All Alpha code is PIC.
         lt_prog_compiler_static='-non_shared'
         ;;
-      xl* | bgxl* | bgf* | mpixl*)
-	# IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
+      xl*)
+	# IBM XL C 8.0/Fortran 10.1 on PPC
 	lt_prog_compiler_wl='-Wl,'
 	lt_prog_compiler_pic='-qpic'
 	lt_prog_compiler_static='-qstaticlink'
 	;;
       *)
 	case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*)
-	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
-	  lt_prog_compiler_pic='-KPIC'
-	  lt_prog_compiler_static='-Bstatic'
-	  lt_prog_compiler_wl=''
-	  ;;
-	*Sun\ F* | *Sun*Fortran*)
-	  lt_prog_compiler_pic='-KPIC'
-	  lt_prog_compiler_static='-Bstatic'
-	  lt_prog_compiler_wl='-Qoption ld '
-	  ;;
 	*Sun\ C*)
 	  # Sun C 5.9
 	  lt_prog_compiler_pic='-KPIC'
 	  lt_prog_compiler_static='-Bstatic'
 	  lt_prog_compiler_wl='-Wl,'
 	  ;;
-        *Intel*\ [CF]*Compiler*)
-	  lt_prog_compiler_wl='-Wl,'
-	  lt_prog_compiler_pic='-fPIC'
-	  lt_prog_compiler_static='-static'
-	  ;;
-	*Portland\ Group*)
-	  lt_prog_compiler_wl='-Wl,'
-	  lt_prog_compiler_pic='-fpic'
+	*Sun\ F*)
+	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
+	  lt_prog_compiler_pic='-KPIC'
 	  lt_prog_compiler_static='-Bstatic'
+	  lt_prog_compiler_wl=''
 	  ;;
 	esac
 	;;
@@ -9402,7 +9297,7 @@ lt_prog_compiler_static=
       lt_prog_compiler_pic='-KPIC'
       lt_prog_compiler_static='-Bstatic'
       case $cc_basename in
-      f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
+      f77* | f90* | f95*)
 	lt_prog_compiler_wl='-Qoption ld ';;
       *)
 	lt_prog_compiler_wl='-Wl,';;
@@ -9459,17 +9354,13 @@ case $host_os in
     lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
     ;;
 esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic" >&5
+$as_echo "$lt_prog_compiler_pic" >&6; }
+
+
+
+
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
-$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
-if ${lt_cv_prog_compiler_pic+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_prog_compiler_pic=$lt_prog_compiler_pic
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5
-$as_echo "$lt_cv_prog_compiler_pic" >&6; }
-lt_prog_compiler_pic=$lt_cv_prog_compiler_pic
 
 #
 # Check to make sure the PIC flag actually works.
@@ -9477,7 +9368,7 @@ lt_prog_compiler_pic=$lt_cv_prog_compiler_pic
 if test -n "$lt_prog_compiler_pic"; then
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; }
-if ${lt_cv_prog_compiler_pic_works+:} false; then :
+if test "${lt_cv_prog_compiler_pic_works+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler_pic_works=no
@@ -9493,15 +9384,15 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:9387: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   echo "$as_me:9391: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
-     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
      $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
      if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
        lt_cv_prog_compiler_pic_works=yes
@@ -9530,18 +9421,13 @@ fi
 
 
 
-
-
-
-
-
 #
 # Check to make sure the static flag actually works.
 #
 wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5
 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
-if ${lt_cv_prog_compiler_static_works+:} false; then :
+if test "${lt_cv_prog_compiler_static_works+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler_static_works=no
@@ -9554,7 +9440,7 @@ else
      if test -s conftest.err; then
        # Append any errors to the config.log.
        cat conftest.err 1>&5
-       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+       $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
        $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
        if diff conftest.exp conftest.er2 >/dev/null; then
          lt_cv_prog_compiler_static_works=yes
@@ -9584,7 +9470,7 @@ fi
 
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
-if ${lt_cv_prog_compiler_c_o+:} false; then :
+if test "${lt_cv_prog_compiler_c_o+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler_c_o=no
@@ -9603,16 +9489,16 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:9492: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   echo "$as_me:9496: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
-     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
      $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
      if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
        lt_cv_prog_compiler_c_o=yes
@@ -9639,7 +9525,7 @@ $as_echo "$lt_cv_prog_compiler_c_o" >&6; }
 
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
-if ${lt_cv_prog_compiler_c_o+:} false; then :
+if test "${lt_cv_prog_compiler_c_o+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler_c_o=no
@@ -9658,16 +9544,16 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:9547: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   echo "$as_me:9551: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
-     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
      $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
      if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
        lt_cv_prog_compiler_c_o=yes
@@ -9733,6 +9619,7 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
   hardcode_direct=no
   hardcode_direct_absolute=no
   hardcode_libdir_flag_spec=
+  hardcode_libdir_flag_spec_ld=
   hardcode_libdir_separator=
   hardcode_minus_L=no
   hardcode_shlibpath_var=unsupported
@@ -9776,39 +9663,13 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
   openbsd*)
     with_gnu_ld=no
     ;;
-  linux* | k*bsd*-gnu | gnu*)
+  linux* | k*bsd*-gnu)
     link_all_deplibs=no
     ;;
   esac
 
   ld_shlibs=yes
-
-  # On some targets, GNU ld is compatible enough with the native linker
-  # that we're better off using the native interface for both.
-  lt_use_gnu_ld_interface=no
   if test "$with_gnu_ld" = yes; then
-    case $host_os in
-      aix*)
-	# The AIX port of GNU ld has always aspired to compatibility
-	# with the native linker.  However, as the warning in the GNU ld
-	# block says, versions before 2.19.5* couldn't really create working
-	# shared libraries, regardless of the interface used.
-	case `$LD -v 2>&1` in
-	  *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
-	  *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;;
-	  *\ \(GNU\ Binutils\)\ [3-9]*) ;;
-	  *)
-	    lt_use_gnu_ld_interface=yes
-	    ;;
-	esac
-	;;
-      *)
-	lt_use_gnu_ld_interface=yes
-	;;
-    esac
-  fi
-
-  if test "$lt_use_gnu_ld_interface" = yes; then
     # If archive_cmds runs LD, not CC, wlarc should be empty
     wlarc='${wl}'
 
@@ -9842,12 +9703,11 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
 	ld_shlibs=no
 	cat <<_LT_EOF 1>&2
 
-*** Warning: the GNU linker, at least up to release 2.19, is reported
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
 *** to be unable to reliably create shared libraries on AIX.
 *** Therefore, libtool is disabling shared libraries support.  If you
-*** really care for shared libraries, you may want to install binutils
-*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
-*** You will then need to restart the configuration process.
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
 
 _LT_EOF
       fi
@@ -9883,12 +9743,10 @@ _LT_EOF
       # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
       # as there is no search path for DLLs.
       hardcode_libdir_flag_spec='-L$libdir'
-      export_dynamic_flag_spec='${wl}--export-all-symbols'
       allow_undefined_flag=unsupported
       always_export_symbols=no
       enable_shared_with_static_runtimes=yes
-      export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
-      exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
+      export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
 
       if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
         archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
@@ -9906,11 +9764,6 @@ _LT_EOF
       fi
       ;;
 
-    haiku*)
-      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-      link_all_deplibs=yes
-      ;;
-
     interix[3-9]*)
       hardcode_direct=no
       hardcode_shlibpath_var=no
@@ -9936,16 +9789,15 @@ _LT_EOF
       if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
 	 && test "$tmp_diet" = no
       then
-	tmp_addflag=' $pic_flag'
+	tmp_addflag=
 	tmp_sharedflag='-shared'
 	case $cc_basename,$host_cpu in
         pgcc*)				# Portland Group C compiler
-	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
 	  tmp_addflag=' $pic_flag'
 	  ;;
-	pgf77* | pgf90* | pgf95* | pgfortran*)
-					# Portland Group f77 and f90 compilers
-	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	pgf77* | pgf90* | pgf95*)	# Portland Group f77 and f90 compilers
+	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
 	  tmp_addflag=' $pic_flag -Mnomain' ;;
 	ecc*,ia64* | icc*,ia64*)	# Intel C compiler on ia64
 	  tmp_addflag=' -i_dynamic' ;;
@@ -9956,17 +9808,13 @@ _LT_EOF
 	lf95*)				# Lahey Fortran 8.1
 	  whole_archive_flag_spec=
 	  tmp_sharedflag='--shared' ;;
-	xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below)
+	xl[cC]*)			# IBM XL C 8.0 on PPC (deal with xlf below)
 	  tmp_sharedflag='-qmkshrobj'
 	  tmp_addflag= ;;
-	nvcc*)	# Cuda Compiler Driver 2.2
-	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
-	  compiler_needs_object=yes
-	  ;;
 	esac
 	case `$CC -V 2>&1 | sed 5q` in
 	*Sun\ C*)			# Sun C 5.9
-	  whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
 	  compiler_needs_object=yes
 	  tmp_sharedflag='-G' ;;
 	*Sun\ F*)			# Sun Fortran 8.3
@@ -9982,16 +9830,17 @@ _LT_EOF
         fi
 
 	case $cc_basename in
-	xlf* | bgf* | bgxlf* | mpixlf*)
+	xlf*)
 	  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
 	  whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive'
-	  hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
-	  archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
+	  hardcode_libdir_flag_spec=
+	  hardcode_libdir_flag_spec_ld='-rpath $libdir'
+	  archive_cmds='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib'
 	  if test "x$supports_anon_versioning" = xyes; then
 	    archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
 	      cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
 	      echo "local: *; };" >> $output_objdir/$libname.ver~
-	      $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+	      $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
 	  fi
 	  ;;
 	esac
@@ -10005,8 +9854,8 @@ _LT_EOF
 	archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
 	wlarc=
       else
-	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
       fi
       ;;
 
@@ -10024,8 +9873,8 @@ _LT_EOF
 
 _LT_EOF
       elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
       else
 	ld_shlibs=no
       fi
@@ -10071,8 +9920,8 @@ _LT_EOF
 
     *)
       if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
       else
 	ld_shlibs=no
       fi
@@ -10112,10 +9961,8 @@ _LT_EOF
       else
 	# If we're using GNU nm, then we don't want the "-C" option.
 	# -C means demangle to AIX nm, but means don't demangle with GNU nm
-	# Also, AIX nm treats weak defined symbols like other global
-	# defined symbols, whereas GNU nm marks them as "W".
 	if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
-	  export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	  export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
 	else
 	  export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
 	fi
@@ -10203,13 +10050,7 @@ _LT_EOF
 	allow_undefined_flag='-berok'
         # Determine the default libpath from the value encoded in an
         # empty executable.
-        if test "${lt_cv_aix_libpath+set}" = set; then
-  aix_libpath=$lt_cv_aix_libpath
-else
-  if ${lt_cv_aix_libpath_+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -10222,32 +10063,25 @@ main ()
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
 
-  lt_aix_libpath_sed='
-      /Import File Strings/,/^$/ {
-	  /^0/ {
-	      s/^0  *\([^ ]*\) *$/\1/
-	      p
-	  }
-      }'
-  lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-  # Check for a 64-bit object if we didn't find anything.
-  if test -z "$lt_cv_aix_libpath_"; then
-    lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-  fi
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-  if test -z "$lt_cv_aix_libpath_"; then
-    lt_cv_aix_libpath_="/usr/lib:/lib"
-  fi
-
-fi
-
-  aix_libpath=$lt_cv_aix_libpath_
-fi
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
         hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
-        archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+        archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
       else
 	if test "$host_cpu" = ia64; then
 	  hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
@@ -10256,13 +10090,7 @@ fi
 	else
 	 # Determine the default libpath from the value encoded in an
 	 # empty executable.
-	 if test "${lt_cv_aix_libpath+set}" = set; then
-  aix_libpath=$lt_cv_aix_libpath
-else
-  if ${lt_cv_aix_libpath_+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -10275,42 +10103,30 @@ main ()
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
 
-  lt_aix_libpath_sed='
-      /Import File Strings/,/^$/ {
-	  /^0/ {
-	      s/^0  *\([^ ]*\) *$/\1/
-	      p
-	  }
-      }'
-  lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-  # Check for a 64-bit object if we didn't find anything.
-  if test -z "$lt_cv_aix_libpath_"; then
-    lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-  fi
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-  if test -z "$lt_cv_aix_libpath_"; then
-    lt_cv_aix_libpath_="/usr/lib:/lib"
-  fi
-
-fi
-
-  aix_libpath=$lt_cv_aix_libpath_
-fi
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
 	 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
 	  # Warning - without using the other run time loading flags,
 	  # -berok will link without error, but may produce a broken library.
 	  no_undefined_flag=' ${wl}-bernotok'
 	  allow_undefined_flag=' ${wl}-berok'
-	  if test "$with_gnu_ld" = yes; then
-	    # We only use this code for GNU lds that support --whole-archive.
-	    whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
-	  else
-	    # Exported symbols can be pulled into shared objects from archives
-	    whole_archive_flag_spec='$convenience'
-	  fi
+	  # Exported symbols can be pulled into shared objects from archives
+	  whole_archive_flag_spec='$convenience'
 	  archive_cmds_need_lc=yes
 	  # This is similar to how AIX traditionally builds its shared libraries.
 	  archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
@@ -10342,64 +10158,20 @@ fi
       # Microsoft Visual C++.
       # hardcode_libdir_flag_spec is actually meaningless, as there is
       # no search path for DLLs.
-      case $cc_basename in
-      cl*)
-	# Native MSVC
-	hardcode_libdir_flag_spec=' '
-	allow_undefined_flag=unsupported
-	always_export_symbols=yes
-	file_list_spec='@'
-	# Tell ltmain to make .lib files, not .a files.
-	libext=lib
-	# Tell ltmain to make .dll files, not .so files.
-	shrext_cmds=".dll"
-	# FIXME: Setting linknames here is a bad hack.
-	archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
-	archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-	    sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
-	  else
-	    sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
-	  fi~
-	  $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
-	  linknames='
-	# The linker will not automatically build a static lib if we build a DLL.
-	# _LT_TAGVAR(old_archive_from_new_cmds, )='true'
-	enable_shared_with_static_runtimes=yes
-	exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
-	export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
-	# Don't use ranlib
-	old_postinstall_cmds='chmod 644 $oldlib'
-	postlink_cmds='lt_outputfile="@OUTPUT@"~
-	  lt_tool_outputfile="@TOOL_OUTPUT@"~
-	  case $lt_outputfile in
-	    *.exe|*.EXE) ;;
-	    *)
-	      lt_outputfile="$lt_outputfile.exe"
-	      lt_tool_outputfile="$lt_tool_outputfile.exe"
-	      ;;
-	  esac~
-	  if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
-	    $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
-	    $RM "$lt_outputfile.manifest";
-	  fi'
-	;;
-      *)
-	# Assume MSVC wrapper
-	hardcode_libdir_flag_spec=' '
-	allow_undefined_flag=unsupported
-	# Tell ltmain to make .lib files, not .a files.
-	libext=lib
-	# Tell ltmain to make .dll files, not .so files.
-	shrext_cmds=".dll"
-	# FIXME: Setting linknames here is a bad hack.
-	archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
-	# The linker will automatically build a .lib file if we build a DLL.
-	old_archive_from_new_cmds='true'
-	# FIXME: Should let the user specify the lib program.
-	old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
-	enable_shared_with_static_runtimes=yes
-	;;
-      esac
+      hardcode_libdir_flag_spec=' '
+      allow_undefined_flag=unsupported
+      # Tell ltmain to make .lib files, not .a files.
+      libext=lib
+      # Tell ltmain to make .dll files, not .so files.
+      shrext_cmds=".dll"
+      # FIXME: Setting linknames here is a bad hack.
+      archive_cmds='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames='
+      # The linker will automatically build a .lib file if we build a DLL.
+      old_archive_from_new_cmds='true'
+      # FIXME: Should let the user specify the lib program.
+      old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
+      fix_srcfile_path='`cygpath -w "$srcfile"`'
+      enable_shared_with_static_runtimes=yes
       ;;
 
     darwin* | rhapsody*)
@@ -10409,12 +10181,7 @@ fi
   hardcode_direct=no
   hardcode_automatic=yes
   hardcode_shlibpath_var=unsupported
-  if test "$lt_cv_ld_force_load" = "yes"; then
-    whole_archive_flag_spec='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
-
-  else
-    whole_archive_flag_spec=''
-  fi
+  whole_archive_flag_spec=''
   link_all_deplibs=yes
   allow_undefined_flag="$_lt_dar_allow_undefined"
   case $cc_basename in
@@ -10422,7 +10189,7 @@ fi
      *) _lt_dar_can_shared=$GCC ;;
   esac
   if test "$_lt_dar_can_shared" = "yes"; then
-    output_verbose_link_cmd=func_echo_all
+    output_verbose_link_cmd=echo
     archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
     module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
     archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
@@ -10440,6 +10207,10 @@ fi
       hardcode_shlibpath_var=no
       ;;
 
+    freebsd1*)
+      ld_shlibs=no
+      ;;
+
     # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
     # support.  Future versions do this automatically, but an explicit c++rt0.o
     # does not break anything, and helps significantly (at the cost of a little
@@ -10452,7 +10223,7 @@ fi
       ;;
 
     # Unfortunately, older versions of FreeBSD 2 do not have this feature.
-    freebsd2.*)
+    freebsd2*)
       archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
       hardcode_direct=yes
       hardcode_minus_L=yes
@@ -10461,7 +10232,7 @@ fi
 
     # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
     freebsd* | dragonfly*)
-      archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+      archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
       hardcode_libdir_flag_spec='-R$libdir'
       hardcode_direct=yes
       hardcode_shlibpath_var=no
@@ -10469,7 +10240,7 @@ fi
 
     hpux9*)
       if test "$GCC" = yes; then
-	archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+	archive_cmds='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
       else
 	archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
       fi
@@ -10484,13 +10255,14 @@ fi
       ;;
 
     hpux10*)
-      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
-	archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+	archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
       else
 	archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
       fi
       if test "$with_gnu_ld" = no; then
 	hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+	hardcode_libdir_flag_spec_ld='+b $libdir'
 	hardcode_libdir_separator=:
 	hardcode_direct=yes
 	hardcode_direct_absolute=yes
@@ -10502,16 +10274,16 @@ fi
       ;;
 
     hpux11*)
-      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
 	case $host_cpu in
 	hppa*64*)
 	  archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	ia64*)
-	  archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	*)
-	  archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	esac
       else
@@ -10523,46 +10295,7 @@ fi
 	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	*)
-
-	  # Older versions of the 11.00 compiler do not understand -b yet
-	  # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
-	  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5
-$as_echo_n "checking if $CC understands -b... " >&6; }
-if ${lt_cv_prog_compiler__b+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_prog_compiler__b=no
-   save_LDFLAGS="$LDFLAGS"
-   LDFLAGS="$LDFLAGS -b"
-   echo "$lt_simple_link_test_code" > conftest.$ac_ext
-   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
-     # The linker can only warn and ignore the option if not recognized
-     # So say no if there are warnings
-     if test -s conftest.err; then
-       # Append any errors to the config.log.
-       cat conftest.err 1>&5
-       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
-       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
-       if diff conftest.exp conftest.er2 >/dev/null; then
-         lt_cv_prog_compiler__b=yes
-       fi
-     else
-       lt_cv_prog_compiler__b=yes
-     fi
-   fi
-   $RM -r conftest*
-   LDFLAGS="$save_LDFLAGS"
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5
-$as_echo "$lt_cv_prog_compiler__b" >&6; }
-
-if test x"$lt_cv_prog_compiler__b" = xyes; then
-    archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-else
-    archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
-fi
-
+	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	esac
       fi
@@ -10590,39 +10323,26 @@ fi
 
     irix5* | irix6* | nonstopux*)
       if test "$GCC" = yes; then
-	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
 	# Try to use the -exported_symbol ld option, if it does not
 	# work, assume that -exports_file does not work either and
 	# implicitly export all symbols.
-	# This should be the same for all languages, so no per-tag cache variable.
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5
-$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; }
-if ${lt_cv_irix_exported_symbol+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  save_LDFLAGS="$LDFLAGS"
-	   LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
-	   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+        save_LDFLAGS="$LDFLAGS"
+        LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-int foo (void) { return 0; }
+int foo(void) {}
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  lt_cv_irix_exported_symbol=yes
-else
-  lt_cv_irix_exported_symbol=no
+  archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-           LDFLAGS="$save_LDFLAGS"
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5
-$as_echo "$lt_cv_irix_exported_symbol" >&6; }
-	if test "$lt_cv_irix_exported_symbol" = yes; then
-          archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
-	fi
+        LDFLAGS="$save_LDFLAGS"
       else
-	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
-	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
       fi
       archive_cmds_need_lc='no'
       hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
@@ -10684,17 +10404,17 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; }
       hardcode_libdir_flag_spec='-L$libdir'
       hardcode_minus_L=yes
       allow_undefined_flag=unsupported
-      archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
       old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
       ;;
 
     osf3*)
       if test "$GCC" = yes; then
 	allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
-	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
       else
 	allow_undefined_flag=' -expect_unresolved \*'
-	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
       fi
       archive_cmds_need_lc='no'
       hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
@@ -10704,13 +10424,13 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; }
     osf4* | osf5*)	# as osf3* with the addition of -msym flag
       if test "$GCC" = yes; then
 	allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
-	archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
 	hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
       else
 	allow_undefined_flag=' -expect_unresolved \*'
-	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
 	archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
-	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
 
 	# Both c and cxx compiler support -rpath directly
 	hardcode_libdir_flag_spec='-rpath $libdir'
@@ -10723,9 +10443,9 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; }
       no_undefined_flag=' -z defs'
       if test "$GCC" = yes; then
 	wlarc='${wl}'
-	archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_cmds='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
 	archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-	  $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+	  $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
       else
 	case `$CC -V 2>&1` in
 	*"Compilers 5.0"*)
@@ -10913,50 +10633,44 @@ x|xyes)
       # to ld, don't add -lc before -lgcc.
       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5
 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
-if ${lt_cv_archive_cmds_need_lc+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  $RM conftest*
-	echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+      $RM conftest*
+      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
 
-	if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+      if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; } 2>conftest.err; then
-	  soname=conftest
-	  lib=conftest
-	  libobjs=conftest.$ac_objext
-	  deplibs=
-	  wl=$lt_prog_compiler_wl
-	  pic_flag=$lt_prog_compiler_pic
-	  compiler_flags=-v
-	  linker_flags=-v
-	  verstring=
-	  output_objdir=.
-	  libname=conftest
-	  lt_save_allow_undefined_flag=$allow_undefined_flag
-	  allow_undefined_flag=
-	  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$lt_prog_compiler_wl
+	pic_flag=$lt_prog_compiler_pic
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$allow_undefined_flag
+        allow_undefined_flag=
+        if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
   (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }
-	  then
-	    lt_cv_archive_cmds_need_lc=no
-	  else
-	    lt_cv_archive_cmds_need_lc=yes
-	  fi
-	  allow_undefined_flag=$lt_save_allow_undefined_flag
-	else
-	  cat conftest.err 1>&5
-	fi
-	$RM conftest*
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5
-$as_echo "$lt_cv_archive_cmds_need_lc" >&6; }
-      archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc
+        then
+	  archive_cmds_need_lc=no
+        else
+	  archive_cmds_need_lc=yes
+        fi
+        allow_undefined_flag=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $RM conftest*
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $archive_cmds_need_lc" >&5
+$as_echo "$archive_cmds_need_lc" >&6; }
       ;;
     esac
   fi
@@ -11114,6 +10828,11 @@ esac
 
 
 
+
+
+
+
+
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
 $as_echo_n "checking dynamic linker characteristics... " >&6; }
 
@@ -11122,23 +10841,16 @@ if test "$GCC" = yes; then
     darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
     *) lt_awk_arg="/^libraries:/" ;;
   esac
-  case $host_os in
-    mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;;
-    *) lt_sed_strip_eq="s,=/,/,g" ;;
-  esac
-  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
-  case $lt_search_path_spec in
-  *\;*)
+  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+  if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then
     # if the path contains ";" then we assume it to be the separator
     # otherwise default to the standard path separator (i.e. ":") - it is
     # assumed that no part of a normal pathname contains ";" but that should
     # okay in the real world where ";" in dirpaths is itself problematic.
-    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
-    ;;
-  *)
-    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
-    ;;
-  esac
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'`
+  else
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+  fi
   # Ok, now we have the path, separated by spaces, we can step through it
   # and add multilib dir if necessary.
   lt_tmp_lt_search_path_spec=
@@ -11151,7 +10863,7 @@ if test "$GCC" = yes; then
 	lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
     fi
   done
-  lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
+  lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk '
 BEGIN {RS=" "; FS="/|\n";} {
   lt_foo="";
   lt_count=0;
@@ -11171,13 +10883,7 @@ BEGIN {RS=" "; FS="/|\n";} {
   if (lt_foo != "") { lt_freq[lt_foo]++; }
   if (lt_freq[lt_foo] == 1) { print lt_foo; }
 }'`
-  # AWK program above erroneously prepends '/' to C:/dos/paths
-  # for these hosts.
-  case $host_os in
-    mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
-      $SED 's,/\([A-Za-z]:\),\1,g'` ;;
-  esac
-  sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
+  sys_lib_search_path_spec=`$ECHO $lt_search_path_spec`
 else
   sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
 fi
@@ -11203,7 +10909,7 @@ need_version=unknown
 
 case $host_os in
 aix3*)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
   shlibpath_var=LIBPATH
 
@@ -11212,7 +10918,7 @@ aix3*)
   ;;
 
 aix[4-9]*)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   need_lib_prefix=no
   need_version=no
   hardcode_into_libs=yes
@@ -11265,7 +10971,7 @@ amigaos*)
   m68k)
     library_names_spec='$libname.ixlibrary $libname.a'
     # Create ${libname}_ixlibrary.a entries in /sys/libs.
-    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
     ;;
   esac
   ;;
@@ -11277,7 +10983,7 @@ beos*)
   ;;
 
 bsdi[45]*)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
@@ -11296,9 +11002,8 @@ cygwin* | mingw* | pw32* | cegcc*)
   need_version=no
   need_lib_prefix=no
 
-  case $GCC,$cc_basename in
-  yes,*)
-    # gcc
+  case $GCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
     postinstall_cmds='base_file=`basename \${file}`~
@@ -11319,83 +11024,36 @@ cygwin* | mingw* | pw32* | cegcc*)
     cygwin*)
       # Cygwin DLLs use 'cyg' prefix rather than 'lib'
       soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-
-      sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"
+      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
       ;;
     mingw* | cegcc*)
       # MinGW DLLs use traditional 'lib' prefix
       soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-      ;;
-    pw32*)
-      # pw32 DLLs use 'pw' prefix rather than 'lib'
-      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-      ;;
-    esac
-    dynamic_linker='Win32 ld.exe'
-    ;;
-
-  *,cl*)
-    # Native MSVC
-    libname_spec='$name'
-    soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-    library_names_spec='${libname}.dll.lib'
-
-    case $build_os in
-    mingw*)
-      sys_lib_search_path_spec=
-      lt_save_ifs=$IFS
-      IFS=';'
-      for lt_path in $LIB
-      do
-        IFS=$lt_save_ifs
-        # Let DOS variable expansion print the short 8.3 style file name.
-        lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
-        sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
-      done
-      IFS=$lt_save_ifs
-      # Convert to MSYS style.
-      sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'`
-      ;;
-    cygwin*)
-      # Convert to unix form, then to dos form, then back to unix form
-      # but this time dos style (no spaces!) so that the unix form looks
-      # like /cygdrive/c/PROGRA~1:/cygdr...
-      sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
-      sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
-      sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
-      ;;
-    *)
-      sys_lib_search_path_spec="$LIB"
+      sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
       if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
-        # It is most probably a Windows format PATH.
+        # It is most probably a Windows format PATH printed by
+        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+        # path with ; separators, and with drive letters. We can handle the
+        # drive letters (cygwin fileutils understands them), so leave them,
+        # especially as we might pass files found there to a mingw objdump,
+        # which wouldn't understand a cygwinified path. Ahh.
         sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
       else
-        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
       fi
-      # FIXME: find the short name or the path components, as spaces are
-      # common. (e.g. "Program Files" -> "PROGRA~1")
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
       ;;
     esac
-
-    # DLL is installed to $(libdir)/../bin by postinstall_cmds
-    postinstall_cmds='base_file=`basename \${file}`~
-      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
-      dldir=$destdir/`dirname \$dlpath`~
-      test -d \$dldir || mkdir -p \$dldir~
-      $install_prog $dir/$dlname \$dldir/$dlname'
-    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
-      dlpath=$dir/\$dldll~
-       $RM \$dlpath'
-    shlibpath_overrides_runpath=yes
-    dynamic_linker='Win32 link.exe'
     ;;
 
   *)
-    # Assume MSVC wrapper
     library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
-    dynamic_linker='Win32 ld.exe'
     ;;
   esac
+  dynamic_linker='Win32 ld.exe'
   # FIXME: first we should search . and the directory the executable is in
   shlibpath_var=PATH
   ;;
@@ -11416,7 +11074,7 @@ darwin* | rhapsody*)
   ;;
 
 dgux*)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
@@ -11424,6 +11082,10 @@ dgux*)
   shlibpath_var=LD_LIBRARY_PATH
   ;;
 
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
 freebsd* | dragonfly*)
   # DragonFly does not have aout.  When/if they implement a new
   # versioning mechanism, adjust this.
@@ -11431,7 +11093,7 @@ freebsd* | dragonfly*)
     objformat=`/usr/bin/objformat`
   else
     case $host_os in
-    freebsd[23].*) objformat=aout ;;
+    freebsd[123]*) objformat=aout ;;
     *) objformat=elf ;;
     esac
   fi
@@ -11449,7 +11111,7 @@ freebsd* | dragonfly*)
   esac
   shlibpath_var=LD_LIBRARY_PATH
   case $host_os in
-  freebsd2.*)
+  freebsd2*)
     shlibpath_overrides_runpath=yes
     ;;
   freebsd3.[01]* | freebsdelf3.[01]*)
@@ -11469,26 +11131,12 @@ freebsd* | dragonfly*)
   ;;
 
 gnu*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  ;;
-
-haiku*)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   need_lib_prefix=no
   need_version=no
-  dynamic_linker="$host_os runtime_loader"
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
+  shlibpath_var=LD_LIBRARY_PATH
   hardcode_into_libs=yes
   ;;
 
@@ -11534,14 +11182,12 @@ hpux9* | hpux10* | hpux11*)
     soname_spec='${libname}${release}${shared_ext}$major'
     ;;
   esac
-  # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
   postinstall_cmds='chmod 555 $lib'
-  # or fails outright, so override atomically:
-  install_override_mode=555
   ;;
 
 interix[3-9]*)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
@@ -11557,7 +11203,7 @@ irix5* | irix6* | nonstopux*)
     nonstopux*) version_type=nonstopux ;;
     *)
 	if test "$lt_cv_prog_gnu_ld" = yes; then
-		version_type=linux # correct to gnu/linux during the next big refactor
+		version_type=linux
 	else
 		version_type=irix
 	fi ;;
@@ -11594,9 +11240,9 @@ linux*oldld* | linux*aout* | linux*coff*)
   dynamic_linker=no
   ;;
 
-# This must be glibc/ELF.
+# This must be Linux ELF.
 linux* | k*bsd*-gnu | kopensolaris*-gnu)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -11604,17 +11250,12 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu)
   finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=no
-
   # Some binutils ld are patched to set DT_RUNPATH
-  if ${lt_cv_shlibpath_overrides_runpath+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_shlibpath_overrides_runpath=no
-    save_LDFLAGS=$LDFLAGS
-    save_libdir=$libdir
-    eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \
-	 LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\""
-    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  save_LDFLAGS=$LDFLAGS
+  save_libdir=$libdir
+  eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \
+       LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\""
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -11627,17 +11268,13 @@ main ()
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
   if  ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then :
-  lt_cv_shlibpath_overrides_runpath=yes
+  shlibpath_overrides_runpath=yes
 fi
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-    LDFLAGS=$save_LDFLAGS
-    libdir=$save_libdir
-
-fi
-
-  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
+  LDFLAGS=$save_LDFLAGS
+  libdir=$save_libdir
 
   # This implies no fast_install, which is unacceptable.
   # Some rework will be needed to allow for fast_install
@@ -11646,7 +11283,7 @@ fi
 
   # Append ld.so.conf contents to the search path
   if test -f /etc/ld.so.conf; then
-    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
     sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
   fi
 
@@ -11690,7 +11327,7 @@ netbsd*)
   ;;
 
 newsos6)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=yes
@@ -11759,7 +11396,7 @@ rdos*)
   ;;
 
 solaris*)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -11784,7 +11421,7 @@ sunos4*)
   ;;
 
 sysv4 | sysv4.3*)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
@@ -11808,7 +11445,7 @@ sysv4 | sysv4.3*)
 
 sysv4*MP*)
   if test -d /usr/nec ;then
-    version_type=linux # correct to gnu/linux during the next big refactor
+    version_type=linux
     library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
     soname_spec='$libname${shared_ext}.$major'
     shlibpath_var=LD_LIBRARY_PATH
@@ -11839,7 +11476,7 @@ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
 
 tpf*)
   # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -11849,7 +11486,7 @@ tpf*)
   ;;
 
 uts4*)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
@@ -11961,11 +11598,6 @@ fi
 
 
 
-
-
-
-
-
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5
 $as_echo_n "checking how to hardcode library paths into programs... " >&6; }
 hardcode_action=
@@ -12038,7 +11670,7 @@ else
   # if libdl is installed we need to link against it
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
 $as_echo_n "checking for dlopen in -ldl... " >&6; }
-if ${ac_cv_lib_dl_dlopen+:} false; then :
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -12072,7 +11704,7 @@ LIBS=$ac_check_lib_save_LIBS
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
 $as_echo "$ac_cv_lib_dl_dlopen" >&6; }
-if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
+if test "x$ac_cv_lib_dl_dlopen" = x""yes; then :
   lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
 else
 
@@ -12086,12 +11718,12 @@ fi
 
   *)
     ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load"
-if test "x$ac_cv_func_shl_load" = xyes; then :
+if test "x$ac_cv_func_shl_load" = x""yes; then :
   lt_cv_dlopen="shl_load"
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5
 $as_echo_n "checking for shl_load in -ldld... " >&6; }
-if ${ac_cv_lib_dld_shl_load+:} false; then :
+if test "${ac_cv_lib_dld_shl_load+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -12125,16 +11757,16 @@ LIBS=$ac_check_lib_save_LIBS
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5
 $as_echo "$ac_cv_lib_dld_shl_load" >&6; }
-if test "x$ac_cv_lib_dld_shl_load" = xyes; then :
+if test "x$ac_cv_lib_dld_shl_load" = x""yes; then :
   lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
 else
   ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen"
-if test "x$ac_cv_func_dlopen" = xyes; then :
+if test "x$ac_cv_func_dlopen" = x""yes; then :
   lt_cv_dlopen="dlopen"
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
 $as_echo_n "checking for dlopen in -ldl... " >&6; }
-if ${ac_cv_lib_dl_dlopen+:} false; then :
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -12168,12 +11800,12 @@ LIBS=$ac_check_lib_save_LIBS
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
 $as_echo "$ac_cv_lib_dl_dlopen" >&6; }
-if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
+if test "x$ac_cv_lib_dl_dlopen" = x""yes; then :
   lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5
 $as_echo_n "checking for dlopen in -lsvld... " >&6; }
-if ${ac_cv_lib_svld_dlopen+:} false; then :
+if test "${ac_cv_lib_svld_dlopen+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -12207,12 +11839,12 @@ LIBS=$ac_check_lib_save_LIBS
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5
 $as_echo "$ac_cv_lib_svld_dlopen" >&6; }
-if test "x$ac_cv_lib_svld_dlopen" = xyes; then :
+if test "x$ac_cv_lib_svld_dlopen" = x""yes; then :
   lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5
 $as_echo_n "checking for dld_link in -ldld... " >&6; }
-if ${ac_cv_lib_dld_dld_link+:} false; then :
+if test "${ac_cv_lib_dld_dld_link+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -12246,7 +11878,7 @@ LIBS=$ac_check_lib_save_LIBS
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5
 $as_echo "$ac_cv_lib_dld_dld_link" >&6; }
-if test "x$ac_cv_lib_dld_dld_link" = xyes; then :
+if test "x$ac_cv_lib_dld_dld_link" = x""yes; then :
   lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
 fi
 
@@ -12287,7 +11919,7 @@ fi
 
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5
 $as_echo_n "checking whether a program can dlopen itself... " >&6; }
-if ${lt_cv_dlopen_self+:} false; then :
+if test "${lt_cv_dlopen_self+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   	  if test "$cross_compiling" = yes; then :
@@ -12296,7 +11928,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line $LINENO "configure"
+#line 11931 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12337,13 +11969,7 @@ else
 #  endif
 #endif
 
-/* When -fvisbility=hidden is used, assume the code has been annotated
-   correspondingly for the symbols needed.  */
-#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
-int fnord () __attribute__((visibility("default")));
-#endif
-
-int fnord () { return 42; }
+void fnord() { int i=42;}
 int main ()
 {
   void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
@@ -12352,11 +11978,7 @@ int main ()
   if (self)
     {
       if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
-      else
-        {
-	  if (dlsym( self,"_fnord"))  status = $lt_dlneed_uscore;
-          else puts (dlerror ());
-	}
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
       /* dlclose (self); */
     }
   else
@@ -12393,7 +12015,7 @@ $as_echo "$lt_cv_dlopen_self" >&6; }
       wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5
 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; }
-if ${lt_cv_dlopen_self_static+:} false; then :
+if test "${lt_cv_dlopen_self_static+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   	  if test "$cross_compiling" = yes; then :
@@ -12402,7 +12024,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line $LINENO "configure"
+#line 12027 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12443,13 +12065,7 @@ else
 #  endif
 #endif
 
-/* When -fvisbility=hidden is used, assume the code has been annotated
-   correspondingly for the symbols needed.  */
-#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
-int fnord () __attribute__((visibility("default")));
-#endif
-
-int fnord () { return 42; }
+void fnord() { int i=42;}
 int main ()
 {
   void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
@@ -12458,11 +12074,7 @@ int main ()
   if (self)
     {
       if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
-      else
-        {
-	  if (dlsym( self,"_fnord"))  status = $lt_dlneed_uscore;
-          else puts (dlerror ());
-	}
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
       /* dlclose (self); */
     }
   else
@@ -12619,145 +12231,6 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 CC="$lt_save_CC"
 
-      if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
-    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
-    (test "X$CXX" != "Xg++"))) ; then
-  ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5
-$as_echo_n "checking how to run the C++ preprocessor... " >&6; }
-if test -z "$CXXCPP"; then
-  if ${ac_cv_prog_CXXCPP+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-      # Double quotes because CXXCPP needs to be expanded
-    for CXXCPP in "$CXX -E" "/lib/cpp"
-    do
-      ac_preproc_ok=false
-for ac_cxx_preproc_warn_flag in '' yes
-do
-  # Use a header file that comes with gcc, so configuring glibc
-  # with a fresh cross-compiler works.
-  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-  # <limits.h> exists even on freestanding compilers.
-  # On the NeXT, cc -E runs the code through the compiler's parser,
-  # not just through cpp. "Syntax error" is here to catch this case.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-		     Syntax error
-_ACEOF
-if ac_fn_cxx_try_cpp "$LINENO"; then :
-
-else
-  # Broken: fails on valid input.
-continue
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-
-  # OK, works on sane cases.  Now check whether nonexistent headers
-  # can be detected and how.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <ac_nonexistent.h>
-_ACEOF
-if ac_fn_cxx_try_cpp "$LINENO"; then :
-  # Broken: success on invalid input.
-continue
-else
-  # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.i conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then :
-  break
-fi
-
-    done
-    ac_cv_prog_CXXCPP=$CXXCPP
-
-fi
-  CXXCPP=$ac_cv_prog_CXXCPP
-else
-  ac_cv_prog_CXXCPP=$CXXCPP
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5
-$as_echo "$CXXCPP" >&6; }
-ac_preproc_ok=false
-for ac_cxx_preproc_warn_flag in '' yes
-do
-  # Use a header file that comes with gcc, so configuring glibc
-  # with a fresh cross-compiler works.
-  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-  # <limits.h> exists even on freestanding compilers.
-  # On the NeXT, cc -E runs the code through the compiler's parser,
-  # not just through cpp. "Syntax error" is here to catch this case.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-		     Syntax error
-_ACEOF
-if ac_fn_cxx_try_cpp "$LINENO"; then :
-
-else
-  # Broken: fails on valid input.
-continue
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-
-  # OK, works on sane cases.  Now check whether nonexistent headers
-  # can be detected and how.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <ac_nonexistent.h>
-_ACEOF
-if ac_fn_cxx_try_cpp "$LINENO"; then :
-  # Broken: success on invalid input.
-continue
-else
-  # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.i conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then :
-
-else
-  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check
-See \`config.log' for more details" "$LINENO" 5; }
-fi
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-else
-  _lt_caught_CXX_error=yes
-fi
 
 ac_ext=cpp
 ac_cpp='$CXXCPP $CPPFLAGS'
@@ -12774,6 +12247,7 @@ export_dynamic_flag_spec_CXX=
 hardcode_direct_CXX=no
 hardcode_direct_absolute_CXX=no
 hardcode_libdir_flag_spec_CXX=
+hardcode_libdir_flag_spec_ld_CXX=
 hardcode_libdir_separator_CXX=
 hardcode_minus_L_CXX=no
 hardcode_shlibpath_var_CXX=unsupported
@@ -12783,8 +12257,6 @@ module_cmds_CXX=
 module_expsym_cmds_CXX=
 link_all_deplibs_CXX=unknown
 old_archive_cmds_CXX=$old_archive_cmds
-reload_flag_CXX=$reload_flag
-reload_cmds_CXX=$reload_cmds
 no_undefined_flag_CXX=
 whole_archive_flag_spec_CXX=
 enable_shared_with_static_runtimes_CXX=no
@@ -12840,7 +12312,6 @@ $RM -r conftest*
 
   # Allow CC to be a program name with arguments.
   lt_save_CC=$CC
-  lt_save_CFLAGS=$CFLAGS
   lt_save_LD=$LD
   lt_save_GCC=$GCC
   GCC=$GXX
@@ -12858,7 +12329,6 @@ $RM -r conftest*
   fi
   test -z "${LDCXX+set}" || LD=$LDCXX
   CC=${CXX-"c++"}
-  CFLAGS=$CXXFLAGS
   compiler=$CC
   compiler_CXX=$CC
   for cc_temp in $compiler""; do
@@ -12869,7 +12339,7 @@ $RM -r conftest*
     *) break;;
   esac
 done
-cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
 
 
   if test -n "$compiler"; then
@@ -12932,7 +12402,7 @@ else
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
 $as_echo_n "checking for non-GNU ld... " >&6; }
 fi
-if ${lt_cv_path_LD+:} false; then :
+if test "${lt_cv_path_LD+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -z "$LD"; then
@@ -12972,7 +12442,7 @@ fi
 test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
-if ${lt_cv_prog_gnu_ld+:} false; then :
+if test "${lt_cv_prog_gnu_ld+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   # I'd rather use --version here, but apparently some GNU lds only accept -v.
@@ -12998,8 +12468,8 @@ with_gnu_ld=$lt_cv_prog_gnu_ld
       # Check if GNU C++ uses GNU ld as the underlying linker, since the
       # archiving commands below assume that GNU ld is being used.
       if test "$with_gnu_ld" = yes; then
-        archive_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
-        archive_expsym_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+        archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+        archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
 
         hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
         export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
@@ -13031,7 +12501,7 @@ with_gnu_ld=$lt_cv_prog_gnu_ld
       # Commands to make compiler produce verbose output that lists
       # what "hidden" libraries, object files and flags are used when
       # linking a shared library.
-      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
 
     else
       GXX=no
@@ -13141,13 +12611,7 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
           allow_undefined_flag_CXX='-berok'
           # Determine the default libpath from the value encoded in an empty
           # executable.
-          if test "${lt_cv_aix_libpath+set}" = set; then
-  aix_libpath=$lt_cv_aix_libpath
-else
-  if ${lt_cv_aix_libpath__CXX+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+          cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -13160,33 +12624,26 @@ main ()
 _ACEOF
 if ac_fn_cxx_try_link "$LINENO"; then :
 
-  lt_aix_libpath_sed='
-      /Import File Strings/,/^$/ {
-	  /^0/ {
-	      s/^0  *\([^ ]*\) *$/\1/
-	      p
-	  }
-      }'
-  lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-  # Check for a 64-bit object if we didn't find anything.
-  if test -z "$lt_cv_aix_libpath__CXX"; then
-    lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-  fi
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-  if test -z "$lt_cv_aix_libpath__CXX"; then
-    lt_cv_aix_libpath__CXX="/usr/lib:/lib"
-  fi
-
-fi
-
-  aix_libpath=$lt_cv_aix_libpath__CXX
-fi
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
           hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
 
-          archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+          archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
         else
           if test "$host_cpu" = ia64; then
 	    hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib'
@@ -13195,13 +12652,7 @@ fi
           else
 	    # Determine the default libpath from the value encoded in an
 	    # empty executable.
-	    if test "${lt_cv_aix_libpath+set}" = set; then
-  aix_libpath=$lt_cv_aix_libpath
-else
-  if ${lt_cv_aix_libpath__CXX+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+	    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -13214,42 +12665,30 @@ main ()
 _ACEOF
 if ac_fn_cxx_try_link "$LINENO"; then :
 
-  lt_aix_libpath_sed='
-      /Import File Strings/,/^$/ {
-	  /^0/ {
-	      s/^0  *\([^ ]*\) *$/\1/
-	      p
-	  }
-      }'
-  lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-  # Check for a 64-bit object if we didn't find anything.
-  if test -z "$lt_cv_aix_libpath__CXX"; then
-    lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-  fi
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-  if test -z "$lt_cv_aix_libpath__CXX"; then
-    lt_cv_aix_libpath__CXX="/usr/lib:/lib"
-  fi
-
-fi
-
-  aix_libpath=$lt_cv_aix_libpath__CXX
-fi
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
 	    hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
 	    # Warning - without using the other run time loading flags,
 	    # -berok will link without error, but may produce a broken library.
 	    no_undefined_flag_CXX=' ${wl}-bernotok'
 	    allow_undefined_flag_CXX=' ${wl}-berok'
-	    if test "$with_gnu_ld" = yes; then
-	      # We only use this code for GNU lds that support --whole-archive.
-	      whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
-	    else
-	      # Exported symbols can be pulled into shared objects from archives
-	      whole_archive_flag_spec_CXX='$convenience'
-	    fi
+	    # Exported symbols can be pulled into shared objects from archives
+	    whole_archive_flag_spec_CXX='$convenience'
 	    archive_cmds_need_lc_CXX=yes
 	    # This is similar to how AIX traditionally builds its shared
 	    # libraries.
@@ -13279,75 +12718,28 @@ fi
         ;;
 
       cygwin* | mingw* | pw32* | cegcc*)
-	case $GXX,$cc_basename in
-	,cl* | no,cl*)
-	  # Native MSVC
-	  # hardcode_libdir_flag_spec is actually meaningless, as there is
-	  # no search path for DLLs.
-	  hardcode_libdir_flag_spec_CXX=' '
-	  allow_undefined_flag_CXX=unsupported
-	  always_export_symbols_CXX=yes
-	  file_list_spec_CXX='@'
-	  # Tell ltmain to make .lib files, not .a files.
-	  libext=lib
-	  # Tell ltmain to make .dll files, not .so files.
-	  shrext_cmds=".dll"
-	  # FIXME: Setting linknames here is a bad hack.
-	  archive_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
-	  archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-	      $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
-	    else
-	      $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
-	    fi~
-	    $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
-	    linknames='
-	  # The linker will not automatically build a static lib if we build a DLL.
-	  # _LT_TAGVAR(old_archive_from_new_cmds, CXX)='true'
-	  enable_shared_with_static_runtimes_CXX=yes
-	  # Don't use ranlib
-	  old_postinstall_cmds_CXX='chmod 644 $oldlib'
-	  postlink_cmds_CXX='lt_outputfile="@OUTPUT@"~
-	    lt_tool_outputfile="@TOOL_OUTPUT@"~
-	    case $lt_outputfile in
-	      *.exe|*.EXE) ;;
-	      *)
-		lt_outputfile="$lt_outputfile.exe"
-		lt_tool_outputfile="$lt_tool_outputfile.exe"
-		;;
-	    esac~
-	    func_to_tool_file "$lt_outputfile"~
-	    if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
-	      $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
-	      $RM "$lt_outputfile.manifest";
-	    fi'
-	  ;;
-	*)
-	  # g++
-	  # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless,
-	  # as there is no search path for DLLs.
-	  hardcode_libdir_flag_spec_CXX='-L$libdir'
-	  export_dynamic_flag_spec_CXX='${wl}--export-all-symbols'
-	  allow_undefined_flag_CXX=unsupported
-	  always_export_symbols_CXX=no
-	  enable_shared_with_static_runtimes_CXX=yes
-
-	  if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
-	    archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-	    # If the export-symbols file already is a .def file (1st line
-	    # is EXPORTS), use it as is; otherwise, prepend...
-	    archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-	      cp $export_symbols $output_objdir/$soname.def;
-	    else
-	      echo EXPORTS > $output_objdir/$soname.def;
-	      cat $export_symbols >> $output_objdir/$soname.def;
-	    fi~
-	    $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-	  else
-	    ld_shlibs_CXX=no
-	  fi
-	  ;;
-	esac
-	;;
+        # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless,
+        # as there is no search path for DLLs.
+        hardcode_libdir_flag_spec_CXX='-L$libdir'
+        allow_undefined_flag_CXX=unsupported
+        always_export_symbols_CXX=no
+        enable_shared_with_static_runtimes_CXX=yes
+
+        if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+          archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+          # If the export-symbols file already is a .def file (1st line
+          # is EXPORTS), use it as is; otherwise, prepend...
+          archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	    cp $export_symbols $output_objdir/$soname.def;
+          else
+	    echo EXPORTS > $output_objdir/$soname.def;
+	    cat $export_symbols >> $output_objdir/$soname.def;
+          fi~
+          $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+        else
+          ld_shlibs_CXX=no
+        fi
+        ;;
       darwin* | rhapsody*)
 
 
@@ -13355,12 +12747,7 @@ fi
   hardcode_direct_CXX=no
   hardcode_automatic_CXX=yes
   hardcode_shlibpath_var_CXX=unsupported
-  if test "$lt_cv_ld_force_load" = "yes"; then
-    whole_archive_flag_spec_CXX='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
-
-  else
-    whole_archive_flag_spec_CXX=''
-  fi
+  whole_archive_flag_spec_CXX=''
   link_all_deplibs_CXX=yes
   allow_undefined_flag_CXX="$_lt_dar_allow_undefined"
   case $cc_basename in
@@ -13368,7 +12755,7 @@ fi
      *) _lt_dar_can_shared=$GCC ;;
   esac
   if test "$_lt_dar_can_shared" = "yes"; then
-    output_verbose_link_cmd=func_echo_all
+    output_verbose_link_cmd=echo
     archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
     module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
     archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
@@ -13402,7 +12789,7 @@ fi
         esac
         ;;
 
-      freebsd2.*)
+      freebsd[12]*)
         # C++ shared libraries reported to be fairly broken before
 	# switch to ELF
         ld_shlibs_CXX=no
@@ -13421,11 +12808,6 @@ fi
       gnu*)
         ;;
 
-      haiku*)
-        archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-        link_all_deplibs_CXX=yes
-        ;;
-
       hpux9*)
         hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
         hardcode_libdir_separator_CXX=:
@@ -13450,11 +12832,11 @@ fi
             # explicitly linking system object files so we need to strip them
             # from the output so that they don't get included in the library
             # dependencies.
-            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
             ;;
           *)
             if test "$GXX" = yes; then
-              archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+              archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
             else
               # FIXME: insert proper C++ library support
               ld_shlibs_CXX=no
@@ -13515,7 +12897,7 @@ fi
 	    # explicitly linking system object files so we need to strip them
 	    # from the output so that they don't get included in the library
 	    # dependencies.
-	    output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+	    output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
 	    ;;
           *)
 	    if test "$GXX" = yes; then
@@ -13525,10 +12907,10 @@ fi
 	            archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
 	            ;;
 	          ia64*)
-	            archive_cmds_CXX='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	            archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
 	            ;;
 	          *)
-	            archive_cmds_CXX='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	            archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
 	            ;;
 	        esac
 	      fi
@@ -13558,7 +12940,7 @@ fi
         case $cc_basename in
           CC*)
 	    # SGI C++
-	    archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	    archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
 
 	    # Archives containing C++ object files must be created using
 	    # "CC -ar", where "CC" is the IRIX C++ compiler.  This is
@@ -13569,9 +12951,9 @@ fi
           *)
 	    if test "$GXX" = yes; then
 	      if test "$with_gnu_ld" = no; then
-	        archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	        archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
 	      else
-	        archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib'
+	        archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` -o $lib'
 	      fi
 	    fi
 	    link_all_deplibs_CXX=yes
@@ -13600,7 +12982,7 @@ fi
 	    # explicitly linking system object files so we need to strip them
 	    # from the output so that they don't get included in the library
 	    # dependencies.
-	    output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+	    output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
 
 	    hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
 	    export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
@@ -13637,26 +13019,26 @@ fi
           pgCC* | pgcpp*)
             # Portland Group C++ compiler
 	    case `$CC -V` in
-	    *pgCC\ [1-5].* | *pgcpp\ [1-5].*)
+	    *pgCC\ [1-5]* | *pgcpp\ [1-5]*)
 	      prelink_cmds_CXX='tpldir=Template.dir~
 		rm -rf $tpldir~
 		$CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
-		compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
+		compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"'
 	      old_archive_cmds_CXX='tpldir=Template.dir~
 		rm -rf $tpldir~
 		$CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
-		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
+		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~
 		$RANLIB $oldlib'
 	      archive_cmds_CXX='tpldir=Template.dir~
 		rm -rf $tpldir~
 		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
-		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
 	      archive_expsym_cmds_CXX='tpldir=Template.dir~
 		rm -rf $tpldir~
 		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
-		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
 	      ;;
-	    *) # Version 6 and above use weak symbols
+	    *) # Version 6 will use weak symbols
 	      archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
 	      archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
 	      ;;
@@ -13664,7 +13046,7 @@ fi
 
 	    hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir'
 	    export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
-	    whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	    whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
             ;;
 	  cxx*)
 	    # Compaq C++
@@ -13683,9 +13065,9 @@ fi
 	    # explicitly linking system object files so we need to strip them
 	    # from the output so that they don't get included in the library
 	    # dependencies.
-	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed'
+	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
 	    ;;
-	  xl* | mpixl* | bgxl*)
+	  xl*)
 	    # IBM XL 8.0 on PPC, with GNU ld
 	    hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
 	    export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
@@ -13705,13 +13087,13 @@ fi
 	      archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
 	      archive_expsym_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
 	      hardcode_libdir_flag_spec_CXX='-R$libdir'
-	      whole_archive_flag_spec_CXX='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	      whole_archive_flag_spec_CXX='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
 	      compiler_needs_object_CXX=yes
 
 	      # Not sure whether something based on
 	      # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
 	      # would be better.
-	      output_verbose_link_cmd='func_echo_all'
+	      output_verbose_link_cmd='echo'
 
 	      # Archives containing C++ object files must be created using
 	      # "CC -xar", where "CC" is the Sun C++ compiler.  This is
@@ -13780,7 +13162,7 @@ fi
 	    export_dynamic_flag_spec_CXX='${wl}-E'
 	    whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
 	  fi
-	  output_verbose_link_cmd=func_echo_all
+	  output_verbose_link_cmd=echo
 	else
 	  ld_shlibs_CXX=no
 	fi
@@ -13815,15 +13197,15 @@ fi
 	    case $host in
 	      osf3*)
 	        allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
-	        archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	        archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && $ECHO "X${wl}-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
 	        hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
 		;;
 	      *)
 	        allow_undefined_flag_CXX=' -expect_unresolved \*'
-	        archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	        archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
 	        archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
 	          echo "-hidden">> $lib.exp~
-	          $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp  `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~
+	          $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp  `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~
 	          $RM $lib.exp'
 	        hardcode_libdir_flag_spec_CXX='-rpath $libdir'
 		;;
@@ -13839,17 +13221,17 @@ fi
 	    # explicitly linking system object files so we need to strip them
 	    # from the output so that they don't get included in the library
 	    # dependencies.
-	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
 	    ;;
 	  *)
 	    if test "$GXX" = yes && test "$with_gnu_ld" = no; then
 	      allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
 	      case $host in
 	        osf3*)
-	          archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	          archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
 		  ;;
 	        *)
-	          archive_cmds_CXX='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	          archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
 		  ;;
 	      esac
 
@@ -13859,7 +13241,7 @@ fi
 	      # Commands to make compiler produce verbose output that lists
 	      # what "hidden" libraries, object files and flags are used when
 	      # linking a shared library.
-	      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+	      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
 
 	    else
 	      # FIXME: insert proper C++ library support
@@ -13895,7 +13277,7 @@ fi
 
       solaris*)
         case $cc_basename in
-          CC* | sunCC*)
+          CC*)
 	    # Sun C++ 4.2, 5.x and Centerline C++
             archive_cmds_need_lc_CXX=yes
 	    no_undefined_flag_CXX=' -zdefs'
@@ -13916,7 +13298,7 @@ fi
 	    esac
 	    link_all_deplibs_CXX=yes
 
-	    output_verbose_link_cmd='func_echo_all'
+	    output_verbose_link_cmd='echo'
 
 	    # Archives containing C++ object files must be created using
 	    # "CC -xar", where "CC" is the Sun C++ compiler.  This is
@@ -13936,14 +13318,14 @@ fi
 	    if test "$GXX" = yes && test "$with_gnu_ld" = no; then
 	      no_undefined_flag_CXX=' ${wl}-z ${wl}defs'
 	      if $CC --version | $GREP -v '^2\.7' > /dev/null; then
-	        archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+	        archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
 	        archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-		  $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+		  $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
 
 	        # Commands to make compiler produce verbose output that lists
 	        # what "hidden" libraries, object files and flags are used when
 	        # linking a shared library.
-	        output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+	        output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
 	      else
 	        # g++ 2.7 appears to require `-G' NOT `-shared' on this
 	        # platform.
@@ -13954,7 +13336,7 @@ fi
 	        # Commands to make compiler produce verbose output that lists
 	        # what "hidden" libraries, object files and flags are used when
 	        # linking a shared library.
-	        output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+	        output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
 	      fi
 
 	      hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir'
@@ -14008,10 +13390,6 @@ fi
           CC*)
 	    archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
 	    archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	    old_archive_cmds_CXX='$CC -Tprelink_objects $oldobjs~
-	      '"$old_archive_cmds_CXX"
-	    reload_cmds_CXX='$CC -Tprelink_objects $reload_objs~
-	      '"$reload_cmds_CXX"
 	    ;;
 	  *)
 	    archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
@@ -14073,14 +13451,6 @@ private:
 };
 _LT_EOF
 
-
-_lt_libdeps_save_CFLAGS=$CFLAGS
-case "$CC $CFLAGS " in #(
-*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
-*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
-*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;;
-esac
-
 if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -14094,7 +13464,7 @@ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   pre_test_object_deps_done=no
 
   for p in `eval "$output_verbose_link_cmd"`; do
-    case ${prev}${p} in
+    case $p in
 
     -L* | -R* | -l*)
        # Some compilers place space between "-{L,R}" and the path.
@@ -14103,22 +13473,13 @@ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
           test $p = "-R"; then
 	 prev=$p
 	 continue
+       else
+	 prev=
        fi
 
-       # Expand the sysroot to ease extracting the directories later.
-       if test -z "$prev"; then
-         case $p in
-         -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;;
-         -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;;
-         -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;;
-         esac
-       fi
-       case $p in
-       =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;;
-       esac
        if test "$pre_test_object_deps_done" = no; then
-	 case ${prev} in
-	 -L | -R)
+	 case $p in
+	 -L* | -R*)
 	   # Internal compiler library paths should come after those
 	   # provided the user.  The postdeps already come after the
 	   # user supplied libs so there is no need to process them.
@@ -14138,10 +13499,8 @@ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
 	   postdeps_CXX="${postdeps_CXX} ${prev}${p}"
 	 fi
        fi
-       prev=
        ;;
 
-    *.lto.$objext) ;; # Ignore GCC LTO objects
     *.$objext)
        # This assumes that the test object file only shows up
        # once in the compiler output.
@@ -14177,7 +13536,6 @@ else
 fi
 
 $RM -f confest.$objext
-CFLAGS=$_lt_libdeps_save_CFLAGS
 
 # PORTME: override above test on systems where it is broken
 case $host_os in
@@ -14213,7 +13571,7 @@ linux*)
 
 solaris*)
   case $cc_basename in
-  CC* | sunCC*)
+  CC*)
     # The more standards-conforming stlport4 library is
     # incompatible with the Cstd library. Avoid specifying
     # it if it's in CXXFLAGS. Ignore libCrun as
@@ -14278,6 +13636,8 @@ fi
 lt_prog_compiler_pic_CXX=
 lt_prog_compiler_static_CXX=
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
 
   # C++ specific cases for pic, static, wl, etc.
   if test "$GXX" = yes; then
@@ -14327,11 +13687,6 @@ lt_prog_compiler_static_CXX=
       # DJGPP does not support shared libraries at all
       lt_prog_compiler_pic_CXX=
       ;;
-    haiku*)
-      # PIC is the default for Haiku.
-      # The "-static" flag exists, but is broken.
-      lt_prog_compiler_static_CXX=
-      ;;
     interix[3-9]*)
       # Interix 3.x gcc -fpic/-fPIC options generate broken code.
       # Instead, we relocate shared libraries at runtime.
@@ -14381,11 +13736,6 @@ lt_prog_compiler_static_CXX=
 	  ;;
 	esac
 	;;
-      mingw* | cygwin* | os2* | pw32* | cegcc*)
-	# This hack is so that the source file can tell whether it is being
-	# built for inclusion in a dll (and should export symbols for example).
-	lt_prog_compiler_pic_CXX='-DDLL_EXPORT'
-	;;
       dgux*)
 	case $cc_basename in
 	  ec++*)
@@ -14475,8 +13825,8 @@ lt_prog_compiler_static_CXX=
 	    lt_prog_compiler_pic_CXX=
 	    lt_prog_compiler_static_CXX='-non_shared'
 	    ;;
-	  xlc* | xlC* | bgxl[cC]* | mpixl[cC]*)
-	    # IBM XL 8.0, 9.0 on PPC and BlueGene
+	  xlc* | xlC*)
+	    # IBM XL 8.0 on PPC
 	    lt_prog_compiler_wl_CXX='-Wl,'
 	    lt_prog_compiler_pic_CXX='-qpic'
 	    lt_prog_compiler_static_CXX='-qstaticlink'
@@ -14538,7 +13888,7 @@ lt_prog_compiler_static_CXX=
 	;;
       solaris*)
 	case $cc_basename in
-	  CC* | sunCC*)
+	  CC*)
 	    # Sun C++ 4.2, 5.x and Centerline C++
 	    lt_prog_compiler_pic_CXX='-KPIC'
 	    lt_prog_compiler_static_CXX='-Bstatic'
@@ -14603,17 +13953,10 @@ case $host_os in
     lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC"
     ;;
 esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic_CXX" >&5
+$as_echo "$lt_prog_compiler_pic_CXX" >&6; }
+
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
-$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
-if ${lt_cv_prog_compiler_pic_CXX+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_prog_compiler_pic_CXX=$lt_prog_compiler_pic_CXX
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_CXX" >&5
-$as_echo "$lt_cv_prog_compiler_pic_CXX" >&6; }
-lt_prog_compiler_pic_CXX=$lt_cv_prog_compiler_pic_CXX
 
 #
 # Check to make sure the PIC flag actually works.
@@ -14621,7 +13964,7 @@ lt_prog_compiler_pic_CXX=$lt_cv_prog_compiler_pic_CXX
 if test -n "$lt_prog_compiler_pic_CXX"; then
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5
 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; }
-if ${lt_cv_prog_compiler_pic_works_CXX+:} false; then :
+if test "${lt_cv_prog_compiler_pic_works_CXX+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler_pic_works_CXX=no
@@ -14637,15 +13980,15 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:13983: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   echo "$as_me:13987: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
-     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
      $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
      if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
        lt_cv_prog_compiler_pic_works_CXX=yes
@@ -14671,15 +14014,13 @@ fi
 
 
 
-
-
 #
 # Check to make sure the static flag actually works.
 #
 wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\"
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5
 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
-if ${lt_cv_prog_compiler_static_works_CXX+:} false; then :
+if test "${lt_cv_prog_compiler_static_works_CXX+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler_static_works_CXX=no
@@ -14692,7 +14033,7 @@ else
      if test -s conftest.err; then
        # Append any errors to the config.log.
        cat conftest.err 1>&5
-       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+       $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
        $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
        if diff conftest.exp conftest.er2 >/dev/null; then
          lt_cv_prog_compiler_static_works_CXX=yes
@@ -14719,7 +14060,7 @@ fi
 
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
-if ${lt_cv_prog_compiler_c_o_CXX+:} false; then :
+if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler_c_o_CXX=no
@@ -14738,16 +14079,16 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:14082: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   echo "$as_me:14086: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
-     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
      $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
      if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
        lt_cv_prog_compiler_c_o_CXX=yes
@@ -14771,7 +14112,7 @@ $as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; }
 
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
-if ${lt_cv_prog_compiler_c_o_CXX+:} false; then :
+if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler_c_o_CXX=no
@@ -14790,16 +14131,16 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:14134: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   echo "$as_me:14138: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
-     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
      $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
      if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
        lt_cv_prog_compiler_c_o_CXX=yes
@@ -14850,40 +14191,30 @@ fi
 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
 
   export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
-  exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
   case $host_os in
   aix[4-9]*)
     # If we're using GNU nm, then we don't want the "-C" option.
     # -C means demangle to AIX nm, but means don't demangle with GNU nm
-    # Also, AIX nm treats weak defined symbols like other global defined
-    # symbols, whereas GNU nm marks them as "W".
     if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
-      export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+      export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
     else
       export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
     fi
     ;;
   pw32*)
     export_symbols_cmds_CXX="$ltdll_cmds"
-    ;;
+  ;;
   cygwin* | mingw* | cegcc*)
-    case $cc_basename in
-    cl*)
-      exclude_expsyms_CXX='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
-      ;;
-    *)
-      export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
-      exclude_expsyms_CXX='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
-      ;;
-    esac
-    ;;
-  linux* | k*bsd*-gnu | gnu*)
+    export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;/^.*[ ]__nm__/s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
+  ;;
+  linux* | k*bsd*-gnu)
     link_all_deplibs_CXX=no
-    ;;
+  ;;
   *)
     export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
-    ;;
+  ;;
   esac
+  exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5
 $as_echo "$ld_shlibs_CXX" >&6; }
@@ -14915,50 +14246,44 @@ x|xyes)
       # to ld, don't add -lc before -lgcc.
       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5
 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
-if ${lt_cv_archive_cmds_need_lc_CXX+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  $RM conftest*
-	echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+      $RM conftest*
+      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
 
-	if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+      if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; } 2>conftest.err; then
-	  soname=conftest
-	  lib=conftest
-	  libobjs=conftest.$ac_objext
-	  deplibs=
-	  wl=$lt_prog_compiler_wl_CXX
-	  pic_flag=$lt_prog_compiler_pic_CXX
-	  compiler_flags=-v
-	  linker_flags=-v
-	  verstring=
-	  output_objdir=.
-	  libname=conftest
-	  lt_save_allow_undefined_flag=$allow_undefined_flag_CXX
-	  allow_undefined_flag_CXX=
-	  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$lt_prog_compiler_wl_CXX
+	pic_flag=$lt_prog_compiler_pic_CXX
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$allow_undefined_flag_CXX
+        allow_undefined_flag_CXX=
+        if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
   (eval $archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }
-	  then
-	    lt_cv_archive_cmds_need_lc_CXX=no
-	  else
-	    lt_cv_archive_cmds_need_lc_CXX=yes
-	  fi
-	  allow_undefined_flag_CXX=$lt_save_allow_undefined_flag
-	else
-	  cat conftest.err 1>&5
-	fi
-	$RM conftest*
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_CXX" >&5
-$as_echo "$lt_cv_archive_cmds_need_lc_CXX" >&6; }
-      archive_cmds_need_lc_CXX=$lt_cv_archive_cmds_need_lc_CXX
+        then
+	  archive_cmds_need_lc_CXX=no
+        else
+	  archive_cmds_need_lc_CXX=yes
+        fi
+        allow_undefined_flag_CXX=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $RM conftest*
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $archive_cmds_need_lc_CXX" >&5
+$as_echo "$archive_cmds_need_lc_CXX" >&6; }
       ;;
     esac
   fi
@@ -15026,6 +14351,8 @@ esac
 
 
 
+
+
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
 $as_echo_n "checking dynamic linker characteristics... " >&6; }
 
@@ -15051,7 +14378,7 @@ need_version=unknown
 
 case $host_os in
 aix3*)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
   shlibpath_var=LIBPATH
 
@@ -15060,7 +14387,7 @@ aix3*)
   ;;
 
 aix[4-9]*)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   need_lib_prefix=no
   need_version=no
   hardcode_into_libs=yes
@@ -15113,7 +14440,7 @@ amigaos*)
   m68k)
     library_names_spec='$libname.ixlibrary $libname.a'
     # Create ${libname}_ixlibrary.a entries in /sys/libs.
-    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
     ;;
   esac
   ;;
@@ -15125,7 +14452,7 @@ beos*)
   ;;
 
 bsdi[45]*)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
@@ -15144,9 +14471,8 @@ cygwin* | mingw* | pw32* | cegcc*)
   need_version=no
   need_lib_prefix=no
 
-  case $GCC,$cc_basename in
-  yes,*)
-    # gcc
+  case $GCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
     postinstall_cmds='base_file=`basename \${file}`~
@@ -15167,82 +14493,36 @@ cygwin* | mingw* | pw32* | cegcc*)
     cygwin*)
       # Cygwin DLLs use 'cyg' prefix rather than 'lib'
       soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-
+      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
       ;;
     mingw* | cegcc*)
       # MinGW DLLs use traditional 'lib' prefix
       soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-      ;;
-    pw32*)
-      # pw32 DLLs use 'pw' prefix rather than 'lib'
-      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-      ;;
-    esac
-    dynamic_linker='Win32 ld.exe'
-    ;;
-
-  *,cl*)
-    # Native MSVC
-    libname_spec='$name'
-    soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-    library_names_spec='${libname}.dll.lib'
-
-    case $build_os in
-    mingw*)
-      sys_lib_search_path_spec=
-      lt_save_ifs=$IFS
-      IFS=';'
-      for lt_path in $LIB
-      do
-        IFS=$lt_save_ifs
-        # Let DOS variable expansion print the short 8.3 style file name.
-        lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
-        sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
-      done
-      IFS=$lt_save_ifs
-      # Convert to MSYS style.
-      sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'`
-      ;;
-    cygwin*)
-      # Convert to unix form, then to dos form, then back to unix form
-      # but this time dos style (no spaces!) so that the unix form looks
-      # like /cygdrive/c/PROGRA~1:/cygdr...
-      sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
-      sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
-      sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
-      ;;
-    *)
-      sys_lib_search_path_spec="$LIB"
+      sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
       if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
-        # It is most probably a Windows format PATH.
+        # It is most probably a Windows format PATH printed by
+        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+        # path with ; separators, and with drive letters. We can handle the
+        # drive letters (cygwin fileutils understands them), so leave them,
+        # especially as we might pass files found there to a mingw objdump,
+        # which wouldn't understand a cygwinified path. Ahh.
         sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
       else
-        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
       fi
-      # FIXME: find the short name or the path components, as spaces are
-      # common. (e.g. "Program Files" -> "PROGRA~1")
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
       ;;
     esac
-
-    # DLL is installed to $(libdir)/../bin by postinstall_cmds
-    postinstall_cmds='base_file=`basename \${file}`~
-      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
-      dldir=$destdir/`dirname \$dlpath`~
-      test -d \$dldir || mkdir -p \$dldir~
-      $install_prog $dir/$dlname \$dldir/$dlname'
-    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
-      dlpath=$dir/\$dldll~
-       $RM \$dlpath'
-    shlibpath_overrides_runpath=yes
-    dynamic_linker='Win32 link.exe'
     ;;
 
   *)
-    # Assume MSVC wrapper
     library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
-    dynamic_linker='Win32 ld.exe'
     ;;
   esac
+  dynamic_linker='Win32 ld.exe'
   # FIXME: first we should search . and the directory the executable is in
   shlibpath_var=PATH
   ;;
@@ -15262,7 +14542,7 @@ darwin* | rhapsody*)
   ;;
 
 dgux*)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
@@ -15270,6 +14550,10 @@ dgux*)
   shlibpath_var=LD_LIBRARY_PATH
   ;;
 
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
 freebsd* | dragonfly*)
   # DragonFly does not have aout.  When/if they implement a new
   # versioning mechanism, adjust this.
@@ -15277,7 +14561,7 @@ freebsd* | dragonfly*)
     objformat=`/usr/bin/objformat`
   else
     case $host_os in
-    freebsd[23].*) objformat=aout ;;
+    freebsd[123]*) objformat=aout ;;
     *) objformat=elf ;;
     esac
   fi
@@ -15295,7 +14579,7 @@ freebsd* | dragonfly*)
   esac
   shlibpath_var=LD_LIBRARY_PATH
   case $host_os in
-  freebsd2.*)
+  freebsd2*)
     shlibpath_overrides_runpath=yes
     ;;
   freebsd3.[01]* | freebsdelf3.[01]*)
@@ -15315,26 +14599,12 @@ freebsd* | dragonfly*)
   ;;
 
 gnu*)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  ;;
-
-haiku*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  need_lib_prefix=no
-  need_version=no
-  dynamic_linker="$host_os runtime_loader"
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
   hardcode_into_libs=yes
   ;;
 
@@ -15380,14 +14650,12 @@ hpux9* | hpux10* | hpux11*)
     soname_spec='${libname}${release}${shared_ext}$major'
     ;;
   esac
-  # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
   postinstall_cmds='chmod 555 $lib'
-  # or fails outright, so override atomically:
-  install_override_mode=555
   ;;
 
 interix[3-9]*)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
@@ -15403,7 +14671,7 @@ irix5* | irix6* | nonstopux*)
     nonstopux*) version_type=nonstopux ;;
     *)
 	if test "$lt_cv_prog_gnu_ld" = yes; then
-		version_type=linux # correct to gnu/linux during the next big refactor
+		version_type=linux
 	else
 		version_type=irix
 	fi ;;
@@ -15440,9 +14708,9 @@ linux*oldld* | linux*aout* | linux*coff*)
   dynamic_linker=no
   ;;
 
-# This must be glibc/ELF.
+# This must be Linux ELF.
 linux* | k*bsd*-gnu | kopensolaris*-gnu)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -15450,17 +14718,12 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu)
   finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=no
-
   # Some binutils ld are patched to set DT_RUNPATH
-  if ${lt_cv_shlibpath_overrides_runpath+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_shlibpath_overrides_runpath=no
-    save_LDFLAGS=$LDFLAGS
-    save_libdir=$libdir
-    eval "libdir=/foo; wl=\"$lt_prog_compiler_wl_CXX\"; \
-	 LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_CXX\""
-    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  save_LDFLAGS=$LDFLAGS
+  save_libdir=$libdir
+  eval "libdir=/foo; wl=\"$lt_prog_compiler_wl_CXX\"; \
+       LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_CXX\""
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -15473,17 +14736,13 @@ main ()
 _ACEOF
 if ac_fn_cxx_try_link "$LINENO"; then :
   if  ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then :
-  lt_cv_shlibpath_overrides_runpath=yes
+  shlibpath_overrides_runpath=yes
 fi
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-    LDFLAGS=$save_LDFLAGS
-    libdir=$save_libdir
-
-fi
-
-  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
+  LDFLAGS=$save_LDFLAGS
+  libdir=$save_libdir
 
   # This implies no fast_install, which is unacceptable.
   # Some rework will be needed to allow for fast_install
@@ -15492,7 +14751,7 @@ fi
 
   # Append ld.so.conf contents to the search path
   if test -f /etc/ld.so.conf; then
-    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
     sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
   fi
 
@@ -15536,7 +14795,7 @@ netbsd*)
   ;;
 
 newsos6)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=yes
@@ -15605,7 +14864,7 @@ rdos*)
   ;;
 
 solaris*)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -15630,7 +14889,7 @@ sunos4*)
   ;;
 
 sysv4 | sysv4.3*)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
@@ -15654,7 +14913,7 @@ sysv4 | sysv4.3*)
 
 sysv4*MP*)
   if test -d /usr/nec ;then
-    version_type=linux # correct to gnu/linux during the next big refactor
+    version_type=linux
     library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
     soname_spec='$libname${shared_ext}.$major'
     shlibpath_var=LD_LIBRARY_PATH
@@ -15685,7 +14944,7 @@ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
 
 tpf*)
   # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -15695,7 +14954,7 @@ tpf*)
   ;;
 
 uts4*)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
@@ -15756,8 +15015,6 @@ fi
 
 
 
-
-
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5
 $as_echo_n "checking how to hardcode library paths into programs... " >&6; }
 hardcode_action_CXX=
@@ -15805,7 +15062,6 @@ fi
   fi # test -n "$compiler"
 
   CC=$lt_save_CC
-  CFLAGS=$lt_save_CFLAGS
   LDCXX=$LD
   LD=$lt_save_LD
   GCC=$lt_save_GCC
@@ -15834,8 +15090,6 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
-
-
         ac_config_commands="$ac_config_commands libtool"
 
 
@@ -15845,13 +15099,13 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
-# Checks for other programs.
+# Checks for programs.
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
 set x ${MAKE-make}
 ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
-if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then :
+if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat >conftest.make <<\_ACEOF
@@ -15889,12 +15143,81 @@ else
 $as_echo "no, using $LN_S" >&6; }
 fi
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
+$as_echo_n "checking for a sed that does not truncate output... " >&6; }
+if test "${ac_cv_path_SED+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+            ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
+     for ac_i in 1 2 3 4 5 6 7; do
+       ac_script="$ac_script$as_nl$ac_script"
+     done
+     echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
+     { ac_script=; unset ac_script;}
+     if test -z "$SED"; then
+  ac_path_SED_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
+      { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue
+# Check for GNU ac_path_SED and select it if it is found.
+  # Check for GNU $ac_path_SED
+case `"$ac_path_SED" --version 2>&1` in
+*GNU*)
+  ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo '' >> "conftest.nl"
+    "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_SED_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_SED="$ac_path_SED"
+      ac_path_SED_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_SED_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_SED"; then
+    as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5
+  fi
+else
+  ac_cv_path_SED=$SED
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5
+$as_echo "$ac_cv_path_SED" >&6; }
+ SED="$ac_cv_path_SED"
+  rm -f conftest.sed
+
 # we want flex, and not only lex
 # Extract the first word of "flex", so it can be a program name with args.
 set dummy flex; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_FLEX+:} false; then :
+if test "${ac_cv_prog_FLEX+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$FLEX"; then
@@ -15907,7 +15230,7 @@ do
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_FLEX="yes"
+    ac_cv_prog_FLEX=""
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -15915,7 +15238,6 @@ done
   done
 IFS=$as_save_IFS
 
-  test -z "$ac_cv_prog_FLEX" && ac_cv_prog_FLEX="no"
 fi
 fi
 FLEX=$ac_cv_prog_FLEX
@@ -15936,7 +15258,7 @@ do
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_LEX+:} false; then :
+if test "${ac_cv_prog_LEX+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$LEX"; then
@@ -16006,7 +15328,7 @@ $as_echo "$ac_try_echo"; } >&5
   test $ac_status = 0; }
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking lex output file root" >&5
 $as_echo_n "checking lex output file root... " >&6; }
-if ${ac_cv_prog_lex_root+:} false; then :
+if test "${ac_cv_prog_lex_root+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
 
@@ -16025,7 +15347,7 @@ LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root
 if test -z "${LEXLIB+set}"; then
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking lex library" >&5
 $as_echo_n "checking lex library... " >&6; }
-if ${ac_cv_lib_lex+:} false; then :
+if test "${ac_cv_lib_lex+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
 
@@ -16055,7 +15377,7 @@ fi
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether yytext is a pointer" >&5
 $as_echo_n "checking whether yytext is a pointer... " >&6; }
-if ${ac_cv_prog_lex_yytext_pointer+:} false; then :
+if test "${ac_cv_prog_lex_yytext_pointer+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   # POSIX says lex can declare yytext either as a pointer or an array; the
@@ -16066,8 +15388,7 @@ ac_save_LIBS=$LIBS
 LIBS="$LEXLIB $ac_save_LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-
-  #define YYTEXT_POINTER 1
+#define YYTEXT_POINTER 1
 `cat $LEX_OUTPUT_ROOT.c`
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
@@ -16093,7 +15414,7 @@ fi
 set dummy flex++; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_FLEXPP+:} false; then :
+if test "${ac_cv_prog_FLEXPP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$FLEXPP"; then
@@ -16127,50 +15448,11 @@ $as_echo "no" >&6; }
 fi
 
 
-# and xxd
-# Extract the first word of "xxd", so it can be a program name with args.
-set dummy xxd; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_HAVE_XXD+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$HAVE_XXD"; then
-  ac_cv_prog_HAVE_XXD="$HAVE_XXD" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_HAVE_XXD="yes"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  test -z "$ac_cv_prog_HAVE_XXD" && ac_cv_prog_HAVE_XXD="no"
-fi
-fi
-HAVE_XXD=$ac_cv_prog_HAVE_XXD
-if test -n "$HAVE_XXD"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAVE_XXD" >&5
-$as_echo "$HAVE_XXD" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
 
 # Checks for header files.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
 $as_echo_n "checking for ANSI C header files... " >&6; }
-if ${ac_cv_header_stdc+:} false; then :
+if test "${ac_cv_header_stdc+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -16285,7 +15567,7 @@ fi
 # Checks for typedefs, structures, and compiler characteristics.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5
 $as_echo_n "checking for stdbool.h that conforms to C99... " >&6; }
-if ${ac_cv_header_stdbool_h+:} false; then :
+if test "${ac_cv_header_stdbool_h+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -16317,7 +15599,7 @@ else
 	char b[false == 0 ? 1 : -1];
 	char c[__bool_true_false_are_defined == 1 ? 1 : -1];
 	char d[(bool) 0.5 == true ? 1 : -1];
-	/* See body of main program for 'e'.  */
+	bool e = &s;
 	char f[(_Bool) 0.0 == false ? 1 : -1];
 	char g[true];
 	char h[sizeof (_Bool)];
@@ -16328,6 +15610,25 @@ else
 	_Bool n[m];
 	char o[sizeof n == m * sizeof n[0] ? 1 : -1];
 	char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
+#	if defined __xlc__ || defined __GNUC__
+	 /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0
+	    reported by James Lemley on 2005-10-05; see
+	    http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
+	    This test is not quite right, since xlc is allowed to
+	    reject this program, as the initializer for xlcbug is
+	    not one of the forms that C requires support for.
+	    However, doing the test right would require a runtime
+	    test, and that would make cross-compilation harder.
+	    Let us hope that IBM fixes the xlc bug, and also adds
+	    support for this kind of constant expression.  In the
+	    meantime, this test will reject xlc, which is OK, since
+	    our stdbool.h substitute should suffice.  We also test
+	    this with GCC, where it should work, to detect more
+	    quickly whether someone messes up the test in the
+	    future.  */
+	 char digs[] = "0123456789";
+	 int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1);
+#	endif
 	/* Catch a bug in an HP-UX C compiler.  See
 	   http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
 	   http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
@@ -16339,7 +15640,6 @@ int
 main ()
 {
 
-	bool e = &s;
 	*pq |= q;
 	*pq |= ! q;
 	/* Refer to every declared value, to avoid compiler optimizations.  */
@@ -16360,7 +15660,7 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5
 $as_echo "$ac_cv_header_stdbool_h" >&6; }
 ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default"
-if test "x$ac_cv_type__Bool" = xyes; then :
+if test "x$ac_cv_type__Bool" = x""yes; then :
 
 cat >>confdefs.h <<_ACEOF
 #define HAVE__BOOL 1
@@ -16377,7 +15677,7 @@ fi
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5
 $as_echo_n "checking for an ANSI C-conforming const... " >&6; }
-if ${ac_cv_c_const+:} false; then :
+if test "${ac_cv_c_const+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -16457,7 +15757,7 @@ fi
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5
 $as_echo_n "checking for inline... " >&6; }
-if ${ac_cv_c_inline+:} false; then :
+if test "${ac_cv_c_inline+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_cv_c_inline=no
@@ -16499,7 +15799,7 @@ esac
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C/C++ restrict keyword" >&5
 $as_echo_n "checking for C/C++ restrict keyword... " >&6; }
-if ${ac_cv_c_restrict+:} false; then :
+if test "${ac_cv_c_restrict+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_cv_c_restrict=no
@@ -16545,7 +15845,7 @@ _ACEOF
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h" >&5
 $as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; }
-if ${ac_cv_struct_tm+:} false; then :
+if test "${ac_cv_struct_tm+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -16583,7 +15883,7 @@ fi
 for ac_header in stdlib.h
 do :
   ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default"
-if test "x$ac_cv_header_stdlib_h" = xyes; then :
+if test "x$ac_cv_header_stdlib_h" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
 #define HAVE_STDLIB_H 1
 _ACEOF
@@ -16594,7 +15894,7 @@ done
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5
 $as_echo_n "checking for GNU libc compatible malloc... " >&6; }
-if ${ac_cv_func_malloc_0_nonnull+:} false; then :
+if test "${ac_cv_func_malloc_0_nonnull+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test "$cross_compiling" = yes; then :
@@ -16650,7 +15950,7 @@ fi
 for ac_header in stdlib.h
 do :
   ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default"
-if test "x$ac_cv_header_stdlib_h" = xyes; then :
+if test "x$ac_cv_header_stdlib_h" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
 #define HAVE_STDLIB_H 1
 _ACEOF
@@ -16661,7 +15961,7 @@ done
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible realloc" >&5
 $as_echo_n "checking for GNU libc compatible realloc... " >&6; }
-if ${ac_cv_func_realloc_0_nonnull+:} false; then :
+if test "${ac_cv_func_realloc_0_nonnull+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test "$cross_compiling" = yes; then :
@@ -16716,7 +16016,7 @@ fi
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat correctly handles trailing slash" >&5
 $as_echo_n "checking whether lstat correctly handles trailing slash... " >&6; }
-if ${ac_cv_func_lstat_dereferences_slashed_symlink+:} false; then :
+if test "${ac_cv_func_lstat_dereferences_slashed_symlink+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   rm -f conftest.sym conftest.file
@@ -16778,7 +16078,7 @@ fi
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat accepts an empty string" >&5
 $as_echo_n "checking whether stat accepts an empty string... " >&6; }
-if ${ac_cv_func_stat_empty_string_bug+:} false; then :
+if test "${ac_cv_func_stat_empty_string_bug+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test "$cross_compiling" = yes; then :
@@ -16825,7 +16125,7 @@ fi
 for ac_func in strftime
 do :
   ac_fn_c_check_func "$LINENO" "strftime" "ac_cv_func_strftime"
-if test "x$ac_cv_func_strftime" = xyes; then :
+if test "x$ac_cv_func_strftime" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
 #define HAVE_STRFTIME 1
 _ACEOF
@@ -16834,7 +16134,7 @@ else
   # strftime is in -lintl on SCO UNIX.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for strftime in -lintl" >&5
 $as_echo_n "checking for strftime in -lintl... " >&6; }
-if ${ac_cv_lib_intl_strftime+:} false; then :
+if test "${ac_cv_lib_intl_strftime+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -16868,7 +16168,7 @@ LIBS=$ac_check_lib_save_LIBS
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_strftime" >&5
 $as_echo "$ac_cv_lib_intl_strftime" >&6; }
-if test "x$ac_cv_lib_intl_strftime" = xyes; then :
+if test "x$ac_cv_lib_intl_strftime" = x""yes; then :
   $as_echo "#define HAVE_STRFTIME 1" >>confdefs.h
 
 LIBS="-lintl $LIBS"
@@ -16900,7 +16200,7 @@ if test "$enable_largefile" != no; then
 
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5
 $as_echo_n "checking for special C compiler options needed for large files... " >&6; }
-if ${ac_cv_sys_largefile_CC+:} false; then :
+if test "${ac_cv_sys_largefile_CC+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_cv_sys_largefile_CC=no
@@ -16945,82 +16245,13 @@ rm -f core conftest.err conftest.$ac_objext
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5
 $as_echo "$ac_cv_sys_largefile_CC" >&6; }
-  if test "$ac_cv_sys_largefile_CC" != no; then
-    CC=$CC$ac_cv_sys_largefile_CC
-  fi
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5
-$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; }
-if ${ac_cv_sys_file_offset_bits+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  while :; do
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <sys/types.h>
- /* Check that off_t can represent 2**63 - 1 correctly.
-    We can't simply define LARGE_OFF_T to be 9223372036854775807,
-    since some C++ compilers masquerading as C compilers
-    incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
-  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
-		       && LARGE_OFF_T % 2147483647 == 1)
-		      ? 1 : -1];
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_sys_file_offset_bits=no; break
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#define _FILE_OFFSET_BITS 64
-#include <sys/types.h>
- /* Check that off_t can represent 2**63 - 1 correctly.
-    We can't simply define LARGE_OFF_T to be 9223372036854775807,
-    since some C++ compilers masquerading as C compilers
-    incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
-  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
-		       && LARGE_OFF_T % 2147483647 == 1)
-		      ? 1 : -1];
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_sys_file_offset_bits=64; break
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  ac_cv_sys_file_offset_bits=unknown
-  break
-done
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5
-$as_echo "$ac_cv_sys_file_offset_bits" >&6; }
-case $ac_cv_sys_file_offset_bits in #(
-  no | unknown) ;;
-  *)
-cat >>confdefs.h <<_ACEOF
-#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits
-_ACEOF
-;;
-esac
-rm -rf conftest*
-  if test $ac_cv_sys_file_offset_bits = unknown; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5
-$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; }
-if ${ac_cv_sys_large_files+:} false; then :
+  if test "$ac_cv_sys_largefile_CC" != no; then
+    CC=$CC$ac_cv_sys_largefile_CC
+  fi
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5
+$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; }
+if test "${ac_cv_sys_file_offset_bits+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   while :; do
@@ -17044,12 +16275,12 @@ main ()
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_sys_large_files=no; break
+  ac_cv_sys_file_offset_bits=no; break
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#define _LARGE_FILES 1
+#define _FILE_OFFSET_BITS 64
 #include <sys/types.h>
  /* Check that off_t can represent 2**63 - 1 correctly.
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
@@ -17068,610 +16299,252 @@ main ()
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_sys_large_files=1; break
+  ac_cv_sys_file_offset_bits=64; break
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  ac_cv_sys_large_files=unknown
-  break
-done
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5
-$as_echo "$ac_cv_sys_large_files" >&6; }
-case $ac_cv_sys_large_files in #(
-  no | unknown) ;;
-  *)
-cat >>confdefs.h <<_ACEOF
-#define _LARGE_FILES $ac_cv_sys_large_files
-_ACEOF
-;;
-esac
-rm -rf conftest*
-  fi
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGEFILE_SOURCE value needed for large files" >&5
-$as_echo_n "checking for _LARGEFILE_SOURCE value needed for large files... " >&6; }
-if ${ac_cv_sys_largefile_source+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  while :; do
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <sys/types.h> /* for off_t */
-     #include <stdio.h>
-int
-main ()
-{
-int (*fp) (FILE *, off_t, int) = fseeko;
-     return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_sys_largefile_source=no; break
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#define _LARGEFILE_SOURCE 1
-#include <sys/types.h> /* for off_t */
-     #include <stdio.h>
-int
-main ()
-{
-int (*fp) (FILE *, off_t, int) = fseeko;
-     return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_sys_largefile_source=1; break
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-  ac_cv_sys_largefile_source=unknown
+  ac_cv_sys_file_offset_bits=unknown
   break
 done
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_source" >&5
-$as_echo "$ac_cv_sys_largefile_source" >&6; }
-case $ac_cv_sys_largefile_source in #(
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5
+$as_echo "$ac_cv_sys_file_offset_bits" >&6; }
+case $ac_cv_sys_file_offset_bits in #(
   no | unknown) ;;
   *)
 cat >>confdefs.h <<_ACEOF
-#define _LARGEFILE_SOURCE $ac_cv_sys_largefile_source
-_ACEOF
-;;
-esac
-rm -rf conftest*
-
-# We used to try defining _XOPEN_SOURCE=500 too, to work around a bug
-# in glibc 2.1.3, but that breaks too many other things.
-# If you want fseeko and ftello with glibc, upgrade to a fixed glibc.
-if test $ac_cv_sys_largefile_source != unknown; then
-
-$as_echo "#define HAVE_FSEEKO 1" >>confdefs.h
-
-fi
-
-
-# -----------------------------------------------------------------------------
-# check for isblank(3)
-# copied from aclocal.m4 file for sudo
-#
-# Copyright (c) 1994-1996, 1998-2008
-#         Todd C. Miller <Todd.Miller at courtesan.com>
-#
-#    Permission to use, copy, modify, and distribute this software for any
-#    purpose with or without fee is hereby granted, provided that the above
-#    copyright notice and this permission notice appear in all copies.
-
-
-
-# end of copied block
-# -----------------------------------------------------------------------------
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for isblank" >&5
-$as_echo_n "checking for isblank... " >&6; }
-if ${sudo_cv_func_isblank+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <ctype.h>
-int
-main ()
-{
-(void)isblank(1);
-  ;
-  return 0;
-}
+#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  sudo_cv_func_isblank=yes
-else
-  sudo_cv_func_isblank=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $sudo_cv_func_isblank" >&5
-$as_echo "$sudo_cv_func_isblank" >&6; }
-
-  if test "$sudo_cv_func_isblank" = "yes"; then
-
-$as_echo "#define HAVE_ISBLANK 1" >>confdefs.h
-
-  fi
-
-
-echo
-echo "+++++++++++++++++++++++++++++++++++++"
-echo "CFLAGS now: ${CFLAGS}"
-echo "CXXFLAGS now: ${CXXFLAGS}"
-echo "LDFLAGS now: ${LDFLAGS}"
-echo "+++++++++++++++++++++++++++++++++++++"
-
-
-# check BOOST before anything else, it's a prime candidate
-#  for being installed by the system (/usr/...) but as well
-#  in another (newer?) version somewhere else.
-# so make sure the include flags from boost come first
-
-
-
-# Check whether --with-boost was given.
-if test "${with_boost+set}" = set; then :
-  withval=$with_boost;
-    if test "$withval" = "no"; then
-        want_boost="no"
-    elif test "$withval" = "yes"; then
-        want_boost="yes"
-        ac_boost_path=""
-    else
-        want_boost="yes"
-        ac_boost_path="$withval"
-    fi
-
-else
-  want_boost="yes"
-fi
-
-
-
-
-# Check whether --with-boost-libdir was given.
-if test "${with_boost_libdir+set}" = set; then :
-  withval=$with_boost_libdir;
-        if test -d "$withval"
-        then
-                ac_boost_lib_path="$withval"
-        else
-                as_fn_error $? "--with-boost-libdir expected directory name" "$LINENO" 5
-        fi
-
-else
-  ac_boost_lib_path=""
-
-fi
-
-
-if test "x$want_boost" = "xyes"; then
-    boost_lib_version_req=1.48.0
-    boost_lib_version_req_shorten=`expr $boost_lib_version_req : '\([0-9]*\.[0-9]*\)'`
-    boost_lib_version_req_major=`expr $boost_lib_version_req : '\([0-9]*\)'`
-    boost_lib_version_req_minor=`expr $boost_lib_version_req : '[0-9]*\.\([0-9]*\)'`
-    boost_lib_version_req_sub_minor=`expr $boost_lib_version_req : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
-    if test "x$boost_lib_version_req_sub_minor" = "x" ; then
-        boost_lib_version_req_sub_minor="0"
-        fi
-    WANT_BOOST_VERSION=`expr $boost_lib_version_req_major \* 100000 \+  $boost_lib_version_req_minor \* 100 \+ $boost_lib_version_req_sub_minor`
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for boostlib >= $boost_lib_version_req" >&5
-$as_echo_n "checking for boostlib >= $boost_lib_version_req... " >&6; }
-    succeeded=no
-
-                        libsubdirs="lib"
-    ax_arch=`uname -m`
-    case $ax_arch in
-      x86_64|ppc64|s390x|sparc64|aarch64)
-        libsubdirs="lib64 lib lib64"
-        ;;
-    esac
-
-
-    libsubdirs="lib/${host_cpu}-${host_os} $libsubdirs"
-
-    case ${host_cpu} in
-      i?86)
-        libsubdirs="lib/i386-${host_os} $libsubdirs"
-        ;;
-    esac
-
-                if test "$ac_boost_path" != ""; then
-        BOOST_CPPFLAGS="-I$ac_boost_path/include"
-        for ac_boost_path_tmp in $libsubdirs; do
-                if test -d "$ac_boost_path"/"$ac_boost_path_tmp" ; then
-                        BOOST_LDFLAGS="-L$ac_boost_path/$ac_boost_path_tmp"
-                        break
-                fi
-        done
-    elif test "$cross_compiling" != yes; then
-        for ac_boost_path_tmp in /usr /usr/local /opt /opt/local ; do
-            if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then
-                for libsubdir in $libsubdirs ; do
-                    if ls "$ac_boost_path_tmp/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
-                done
-                BOOST_LDFLAGS="-L$ac_boost_path_tmp/$libsubdir"
-                BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include"
-                break;
-            fi
-        done
-    fi
-
-            if test "$ac_boost_lib_path" != ""; then
-       BOOST_LDFLAGS="-L$ac_boost_lib_path"
-    fi
-
-    CPPFLAGS_SAVED="$CPPFLAGS"
-    CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
-    export CPPFLAGS
-
-    LDFLAGS_SAVED="$LDFLAGS"
-    LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
-    export LDFLAGS
-
-
-    ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
-        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+;;
+esac
+rm -rf conftest*
+  if test $ac_cv_sys_file_offset_bits = unknown; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5
+$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; }
+if test "${ac_cv_sys_large_files+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  while :; do
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-
-    #include <boost/version.hpp>
-
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+		       && LARGE_OFF_T % 2147483647 == 1)
+		      ? 1 : -1];
 int
 main ()
 {
 
-    #if BOOST_VERSION >= $WANT_BOOST_VERSION
-    // Everything is okay
-    #else
-    #  error Boost version is too old
-    #endif
-
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_cxx_try_compile "$LINENO"; then :
-
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-    succeeded=yes
-    found_system=yes
-
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_sys_large_files=no; break
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-    ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-
-
-            if test "x$succeeded" != "xyes"; then
-        _version=0
-        if test "$ac_boost_path" != ""; then
-            if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
-                for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
-                    _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
-                    V_CHECK=`expr $_version_tmp \> $_version`
-                    if test "$V_CHECK" = "1" ; then
-                        _version=$_version_tmp
-                    fi
-                    VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
-                    BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE"
-                done
-            fi
-        else
-            if test "$cross_compiling" != yes; then
-                for ac_boost_path in /usr /usr/local /opt /opt/local ; do
-                    if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
-                        for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
-                            _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
-                            V_CHECK=`expr $_version_tmp \> $_version`
-                            if test "$V_CHECK" = "1" ; then
-                                _version=$_version_tmp
-                                best_path=$ac_boost_path
-                            fi
-                        done
-                    fi
-                done
-
-                VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
-                BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE"
-                if test "$ac_boost_lib_path" = ""; then
-                    for libsubdir in $libsubdirs ; do
-                        if ls "$best_path/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
-                    done
-                    BOOST_LDFLAGS="-L$best_path/$libsubdir"
-                fi
-            fi
-
-            if test "x$BOOST_ROOT" != "x"; then
-                for libsubdir in $libsubdirs ; do
-                    if ls "$BOOST_ROOT/stage/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
-                done
-                if test -d "$BOOST_ROOT" && test -r "$BOOST_ROOT" && test -d "$BOOST_ROOT/stage/$libsubdir" && test -r "$BOOST_ROOT/stage/$libsubdir"; then
-                    version_dir=`expr //$BOOST_ROOT : '.*/\(.*\)'`
-                    stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'`
-                        stage_version_shorten=`expr $stage_version : '\([0-9]*\.[0-9]*\)'`
-                    V_CHECK=`expr $stage_version_shorten \>\= $_version`
-                    if test "$V_CHECK" = "1" -a "$ac_boost_lib_path" = "" ; then
-                        { $as_echo "$as_me:${as_lineno-$LINENO}: We will use a staged boost library from $BOOST_ROOT" >&5
-$as_echo "$as_me: We will use a staged boost library from $BOOST_ROOT" >&6;}
-                        BOOST_CPPFLAGS="-I$BOOST_ROOT"
-                        BOOST_LDFLAGS="-L$BOOST_ROOT/stage/$libsubdir"
-                    fi
-                fi
-            fi
-        fi
-
-        CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
-        export CPPFLAGS
-        LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
-        export LDFLAGS
-
-        ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
-            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-
-        #include <boost/version.hpp>
-
+#define _LARGE_FILES 1
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+		       && LARGE_OFF_T % 2147483647 == 1)
+		      ? 1 : -1];
 int
 main ()
 {
 
-        #if BOOST_VERSION >= $WANT_BOOST_VERSION
-        // Everything is okay
-        #else
-        #  error Boost version is too old
-        #endif
-
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_cxx_try_compile "$LINENO"; then :
-
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-        succeeded=yes
-        found_system=yes
-
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_sys_large_files=1; break
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-        ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-    fi
-
-    if test "$succeeded" != "yes" ; then
-        if test "$_version" = "0" ; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: We could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option.  If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation." >&5
-$as_echo "$as_me: We could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option.  If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation." >&6;}
-        else
-            { $as_echo "$as_me:${as_lineno-$LINENO}: Your boost libraries seems to old (version $_version)." >&5
-$as_echo "$as_me: Your boost libraries seems to old (version $_version)." >&6;}
-        fi
-        # execute ACTION-IF-NOT-FOUND (if present):
-        :
-    else
-
-
-
-$as_echo "#define HAVE_BOOST /**/" >>confdefs.h
-
-        # execute ACTION-IF-FOUND (if present):
-        :
-    fi
-
-    CPPFLAGS="$CPPFLAGS_SAVED"
-    LDFLAGS="$LDFLAGS_SAVED"
+  ac_cv_sys_large_files=unknown
+  break
+done
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5
+$as_echo "$ac_cv_sys_large_files" >&6; }
+case $ac_cv_sys_large_files in #(
+  no | unknown) ;;
+  *)
+cat >>confdefs.h <<_ACEOF
+#define _LARGE_FILES $ac_cv_sys_large_files
+_ACEOF
+;;
+esac
+rm -rf conftest*
+  fi
 fi
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGEFILE_SOURCE value needed for large files" >&5
+$as_echo_n "checking for _LARGEFILE_SOURCE value needed for large files... " >&6; }
+if test "${ac_cv_sys_largefile_source+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  while :; do
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h> /* for off_t */
+     #include <stdio.h>
+int
+main ()
+{
+int (*fp) (FILE *, off_t, int) = fseeko;
+     return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_sys_largefile_source=no; break
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#define _LARGEFILE_SOURCE 1
+#include <sys/types.h> /* for off_t */
+     #include <stdio.h>
+int
+main ()
+{
+int (*fp) (FILE *, off_t, int) = fseeko;
+     return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_sys_largefile_source=1; break
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  ac_cv_sys_largefile_source=unknown
+  break
+done
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_source" >&5
+$as_echo "$ac_cv_sys_largefile_source" >&6; }
+case $ac_cv_sys_largefile_source in #(
+  no | unknown) ;;
+  *)
+cat >>confdefs.h <<_ACEOF
+#define _LARGEFILE_SOURCE $ac_cv_sys_largefile_source
+_ACEOF
+;;
+esac
+rm -rf conftest*
 
+# We used to try defining _XOPEN_SOURCE=500 too, to work around a bug
+# in glibc 2.1.3, but that breaks too many other things.
+# If you want fseeko and ftello with glibc, upgrade to a fixed glibc.
+if test $ac_cv_sys_largefile_source != unknown; then
 
-echo
-echo "+++++++++++++++++++++++++++++++++++++"
-echo " BOOST_CPPFLAGS:    ${BOOST_CPPFLAGS}"
-echo " BOOST LDFLAGS:     ${BOOST_LDFLAGS}"
-echo " ac_boost_path:     ${ac_boost_path}"
-echo " ac_boost_lib_path: ${ac_boost_lib_path}"
-echo "CFLAGS now: ${CFLAGS}"
-echo "CXXFLAGS now: ${CXXFLAGS}"
-echo "LDFLAGS now: ${LDFLAGS}"
-echo "+++++++++++++++++++++++++++++++++++++"
-
-# if the user gave --with-boost but no --with-boost-libdir, set it automatically
-# because if not, the checks which need to link further down might fail
-if test "${ac_boost_path}" != "" ; then
-  if test "${ac_boost_lib_path}" = "" ; then
-    ac_boost_lib_path=${ac_boost_path}/lib
-    echo "Setting rescue value for ac_boost_lib_path: ${ac_boost_lib_path}"
-    echo "If the rescue value is wrong, use --with-boost-libdir=/path/to/dir/with/boostlibs"
-    # replace or append? atm replace
-    BOOST_LDFLAGS="-L${ac_boost_lib_path}"
-  fi
-fi
-
-# I have no idea why I need this ... but looks like
-#  the autoconf macros have problems in automatically finding
-#  the best paths on some systems
-#
-# So ... if we want boost (we do) and something went wrong with
-#  automatic configuration, try setting rescue values which might work
+$as_echo "#define HAVE_FSEEKO 1" >>confdefs.h
 
-possibleboostproblem="no"
+fi
 
-if test "${BOOST_CPPFLAGS}" = "" ; then
 
-  possibleboostproblem="yes"
+# -----------------------------------------------------------------------------
+# check for isblank(3)
+# copied from aclocal.m4 file for sudo
+#
+# Copyright (c) 1994-1996, 1998-2008
+#         Todd C. Miller <Todd.Miller at courtesan.com>
+#
+#    Permission to use, copy, modify, and distribute this software for any
+#    purpose with or without fee is hereby granted, provided that the above
+#    copyright notice and this permission notice appear in all copies.
 
-  echo "Automatic recognition of Boost CPP flags failed? I have"
-  echo "////// BOOST_CPPFLAGS:   ${BOOST_CPPFLAGS}"
-  echo "////// ac_boost_path:    ${ac_boost_path}"
-  echo "Setting rescue values!"
 
-  if test "${systemuname}" = "SunOS" ; then
-    BOOST_CPPFLAGS="-pthreads"
-  elif test "x$build_os" = "xming32" ; then
-    BOOST_CPPFLAGS="-mthreads"
-  else
-    BOOST_CPPFLAGS="-pthread"
-  fi
 
-  if test "${ac_boost_path}" = "" ; then
-    BOOST_CPPFLAGS="${BOOST_CPPFLAGS} -I $/usr/include"
-    echo "If the rescue below is wrong, use --with-boost=/path/to/boost"
-  else
-    BOOST_CPPFLAGS="${BOOST_CPPFLAGS} -I ${ac_boost_path}/include"
-  fi
+# end of copied block
+# -----------------------------------------------------------------------------
 
-  echo "Choosen: ${BOOST_CPPFLAGS}"
-  #LDFLAGS="${LDFLAGS} ${BOOST_THREAD_LIB}"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for isblank" >&5
+$as_echo_n "checking for isblank... " >&6; }
+if test "${sudo_cv_func_isblank+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ctype.h>
+int
+main ()
+{
+(void)isblank(1);
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  sudo_cv_func_isblank=yes
+else
+  sudo_cv_func_isblank=no
 fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $sudo_cv_func_isblank" >&5
+$as_echo "$sudo_cv_func_isblank" >&6; }
 
-if test "${BOOST_LDFLAGS}" = "" ; then
-  possibleboostproblem="yes"
-  echo "Automatic recognition of Boost LD failed? I have"
-  echo "////// BOOST_CPPFLAGS:    ${BOOST_CPPFLAGS}"
-  echo "////// BOOST LDFLAGS:     ${BOOST_LDFLAGS}"
-  echo "////// ac_boost_path:     ${ac_boost_path}"
-  echo "////// ac_boost_lib_path: ${ac_boost_lib_path}"
-
-  if test "${ac_boost_lib_path}" = "" ; then
-    if test "${enable_64}" = "yes"; then
-      BOOST_LDFLAGS="-L/usr/lib64"
-    else
-      BOOST_LDFLAGS="-L/usr/lib"
-    fi
-    echo "If the rescue value below is wrong, use --with-boost-libdir=/path/to/dir/with/boostlibs"
-  else
-    BOOST_LDFLAGS="-L${ac_boost_lib_path}"
-  fi
+  if test "$sudo_cv_func_isblank" = "yes"; then
 
-  echo "Setting rescue value: ${BOOST_LDFLAGS}"
-fi
+$as_echo "#define HAVE_ISBLANK 1" >>confdefs.h
 
+  fi
 
-# some of the BOOST checks below break on older systems with newer BOOSTs
-# e.g., boost_thread implicitly needs boost_clock and boost_system,
-#  but the linker on KUbuntu 9.10 somehow does not find them automatically
-# Way out: for the boost checks, set the linker rpath to include boost lib path
-#  (only valid for gcc)
-oldCFLAGS=${CFLAGS}
-if test $bachCCOMPILER = gcc; then
-  CFLAGS="${CFLAGS} -Wl,-rpath,${ac_boost_lib_path}"
-fi
 
 echo
 echo "+++++++++++++++++++++++++++++++++++++"
-echo " BOOST_CPPFLAGS:    ${BOOST_CPPFLAGS}"
-echo " BOOST LDFLAGS:     ${BOOST_LDFLAGS}"
 echo "CFLAGS now: ${CFLAGS}"
 echo "CXXFLAGS now: ${CXXFLAGS}"
 echo "LDFLAGS now: ${LDFLAGS}"
 echo "+++++++++++++++++++++++++++++++++++++"
 
-
-
-# Check whether --with-boost-thread was given.
-if test "${with_boost_thread+set}" = set; then :
-  withval=$with_boost_thread;
-        if test "$withval" = "no"; then
-			want_boost="no"
-        elif test "$withval" = "yes"; then
-            want_boost="yes"
-            ax_boost_user_thread_lib=""
-        else
-		    want_boost="yes"
-		ax_boost_user_thread_lib="$withval"
-		fi
-
-else
-  want_boost="yes"
-
-fi
-
-
-	if test "x$want_boost" = "xyes"; then
-
-
-		CPPFLAGS_SAVED="$CPPFLAGS"
-		CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
-		export CPPFLAGS
-
-		LDFLAGS_SAVED="$LDFLAGS"
-		LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
-		export LDFLAGS
-
-        { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the Boost::Thread library is available" >&5
-$as_echo_n "checking whether the Boost::Thread library is available... " >&6; }
-if ${ax_cv_boost_thread+:} false; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler implements namespaces" >&5
+$as_echo_n "checking whether the compiler implements namespaces... " >&6; }
+if test "${ax_cv_cxx_namespaces+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_ext=cpp
+
+ ac_ext=cpp
 ac_cpp='$CXXCPP $CPPFLAGS'
 ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
-			 CXXFLAGS_SAVE=$CXXFLAGS
-
-			 if test "x$host_os" = "xsolaris" ; then
-				 CXXFLAGS="-pthreads $CXXFLAGS"
-			 elif test "x$host_os" = "xmingw32" ; then
-				 CXXFLAGS="-mthreads $CXXFLAGS"
-			 else
-				CXXFLAGS="-pthread $CXXFLAGS"
-			 fi
-			 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <boost/thread/thread.hpp>
+namespace Outer { namespace Inner { int i = 0; }}
 int
 main ()
 {
-boost::thread_group thrds;
-                                   return 0;
+using namespace Outer::Inner; return i;
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_cxx_try_compile "$LINENO"; then :
-  ax_cv_boost_thread=yes
+  ax_cv_cxx_namespaces=yes
 else
-  ax_cv_boost_thread=no
+  ax_cv_cxx_namespaces=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-			 CXXFLAGS=$CXXFLAGS_SAVE
-             ac_ext=c
+ ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
@@ -17679,610 +16552,615 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_boost_thread" >&5
-$as_echo "$ax_cv_boost_thread" >&6; }
-		if test "x$ax_cv_boost_thread" = "xyes"; then
-           if test "x$host_os" = "xsolaris" ; then
-			  BOOST_CPPFLAGS="-pthreads $BOOST_CPPFLAGS"
-		   elif test "x$host_os" = "xmingw32" ; then
-			  BOOST_CPPFLAGS="-mthreads $BOOST_CPPFLAGS"
-		   else
-			  BOOST_CPPFLAGS="-pthread $BOOST_CPPFLAGS"
-		   fi
-
-
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_cxx_namespaces" >&5
+$as_echo "$ax_cv_cxx_namespaces" >&6; }
+if test "$ax_cv_cxx_namespaces" = yes; then
 
-$as_echo "#define HAVE_BOOST_THREAD /**/" >>confdefs.h
+$as_echo "#define HAVE_NAMESPACES /**/" >>confdefs.h
 
-            BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/[^\/]*//'`
+fi
 
-			LDFLAGS_SAVE=$LDFLAGS
-                        case "x$host_os" in
-                          *bsd* )
-                               LDFLAGS="-pthread $LDFLAGS"
-                          break;
-                          ;;
-                        esac
-            if test "x$ax_boost_user_thread_lib" = "x"; then
-                for libextension in `ls $BOOSTLIBDIR/libboost_thread*.so* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_thread.*\)\.so.*$;\1;'` `ls $BOOSTLIBDIR/libboost_thread*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_thread.*\)\.a*$;\1;'`; do
-                     ax_lib=${libextension}
-				    as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5
-$as_echo_n "checking for exit in -l$ax_lib... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports ISO C++ standard library" >&5
+$as_echo_n "checking whether the compiler supports ISO C++ standard library... " >&6; }
+if test "${ax_cv_cxx_have_std+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-l$ax_lib  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char exit ();
-int
-main ()
-{
-return exit ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
-else
-  eval "$as_ac_Lib=no"
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-eval ac_res=\$$as_ac_Lib
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
-  BOOST_THREAD_LIB="-l$ax_lib";  link_thread="yes"; break
-else
-  link_thread="no"
-fi
 
-				done
-                if test "x$link_thread" != "xyes"; then
-                for libextension in `ls $BOOSTLIBDIR/boost_thread*.dll* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_thread.*\)\.dll.*$;\1;'` `ls $BOOSTLIBDIR/boost_thread*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_thread.*\)\.a*$;\1;'` ; do
-                     ax_lib=${libextension}
-				    as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5
-$as_echo_n "checking for exit in -l$ax_lib... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-l$ax_lib  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
+ ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <iostream>
+#include <map>
+#include <iomanip>
+#include <cmath>
+#ifdef HAVE_NAMESPACES
+using namespace std;
 #endif
-char exit ();
 int
 main ()
 {
-return exit ();
+return 0;
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ax_cv_cxx_have_std=yes
 else
-  eval "$as_ac_Lib=no"
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+  ax_cv_cxx_have_std=no
 fi
-eval ac_res=\$$as_ac_Lib
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
-  BOOST_THREAD_LIB="-l$ax_lib";  link_thread="yes"; break
-else
-  link_thread="no"
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_cxx_have_std" >&5
+$as_echo "$ax_cv_cxx_have_std" >&6; }
+if test "$ax_cv_cxx_have_std" = yes; then
 
-				done
-                fi
+$as_echo "#define HAVE_STD /**/" >>confdefs.h
 
-            else
-               for ax_lib in $ax_boost_user_thread_lib boost_thread-$ax_boost_user_thread_lib; do
-				      as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5
-$as_echo_n "checking for exit in -l$ax_lib... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports Standard Template Library" >&5
+$as_echo_n "checking whether the compiler supports Standard Template Library... " >&6; }
+if test "${ax_cv_cxx_have_stl+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-l$ax_lib  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
+
+ ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <list>
+#include <deque>
+#ifdef HAVE_NAMESPACES
+using namespace std;
 #endif
-char exit ();
 int
 main ()
 {
-return exit ();
+list<int> x; x.push_back(5);
+list<int>::iterator iter = x.begin(); if (iter != x.end()) ++iter; return 0;
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
-else
-  eval "$as_ac_Lib=no"
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-eval ac_res=\$$as_ac_Lib
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
-  BOOST_THREAD_LIB="-l$ax_lib";  link_thread="yes"; break
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ax_cv_cxx_have_stl=yes
 else
-  link_thread="no"
+  ax_cv_cxx_have_stl=no
 fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-                  done
 
-            fi
-            if test "x$ax_lib" = "x"; then
-                as_fn_error $? "Could not find a version of the library!" "$LINENO" 5
-            fi
-			if test "x$link_thread" = "xno"; then
-				as_fn_error $? "Could not link against $ax_lib !" "$LINENO" 5
-                        else
-                           case "x$host_os" in
-                              *bsd* )
-				BOOST_LDFLAGS="-pthread $BOOST_LDFLAGS"
-                              break;
-                              ;;
-                           esac
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_cxx_have_stl" >&5
+$as_echo "$ax_cv_cxx_have_stl" >&6; }
+if test "$ax_cv_cxx_have_stl" = yes; then
 
-			fi
-		fi
+$as_echo "#define HAVE_STL /**/" >>confdefs.h
+
+fi
 
-		CPPFLAGS="$CPPFLAGS_SAVED"
-	LDFLAGS="$LDFLAGS_SAVED"
-	fi
 
 
 echo
 echo "+++++++++++++++++++++++++++++++++++++"
-echo " BOOST_CPPFLAGS:    ${BOOST_CPPFLAGS}"
-echo " BOOST LDFLAGS:     ${BOOST_LDFLAGS}"
-echo " ac_boost_path:     ${ac_boost_path}"
-echo " ac_boost_lib_path: ${ac_boost_lib_path}"
-echo " BOOST_THREAD_LIB:  ${BOOST_THREAD_LIB}"
 echo "CFLAGS now: ${CFLAGS}"
 echo "CXXFLAGS now: ${CXXFLAGS}"
 echo "LDFLAGS now: ${LDFLAGS}"
 echo "+++++++++++++++++++++++++++++++++++++"
 
-if test "${BOOST_THREAD_LIB}" = "" ; then
-  echo "Automatic recognition of Boost thread lib failed? I have"
-  echo "////// BOOST_CPPFLAGS:    ${BOOST_CPPFLAGS}"
-  echo "////// BOOST LDFLAGS:     ${BOOST_LDFLAGS}"
-  echo "////// ac_boost_path:     ${ac_boost_path}"
-  echo "////// ac_boost_lib_path: ${ac_boost_lib_path}"
-  echo "////// BOOST_THREAD_LIB:  ${BOOST_THREAD_LIB}"
-  echo "////// BOOST_ROOT:        ${BOOST_ROOT}"
 
-  case "${BOOST_LDFLAGS}" in
-    *stage* )
-    	 isstaged="yes"
-    break;
-    ;;
-  esac
 
-  if test "${isstaged}" = "yes" ; then
-      echo
-      echo
-      echo "You seem to have a staged BOOST."
-      echo
-      if test "${BOOST_ROOT}" = "" ; then
-	  echo "Please set \$BOOST_ROOT in your environment (via export or setenv, depending"
-	  echo "on your shell) to the directory with the staged boost."
-	  echo "E.g.: export BOOST_ROOT=\"/path/to/boost_1_39_0\""
-      else
-	  echo "You set \$BOOST_ROOT to: ${BOOST_ROOT}"
-	  echo "Maybe this is not correct?"
-	  echo
-	  echo "If it is correct, please do not use a staged BOOST but a fully"
-  	  echo "installed one. Apparently, using a staged BOOST does not work"
-	  echo "on your system (sorry)."
-      fi
-  else
-      echo "Please give the configure script the location of your BOOST"
-      echo " libraries. Or, if needed, the name of your thread library (without"
-      echo " 'lib' in front):"
-      echo "   --with-boost=DIR"
-      echo "or --with-boost-libdir=LIB_DIR"
-      echo "or --with-boost-thread=special-lib"
+
+
+
+
+
+
+
+
+
+    if test -z "$PERL"; then :
+
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether perl executable path has been provided" >&5
+$as_echo_n "checking whether perl executable path has been provided... " >&6; }
+
+# Check whether --with-perl was given.
+if test "${with_perl+set}" = set; then :
+  withval=$with_perl;
+            if test "$withval" != yes -a "$withval" != no; then :
+
+                PERL="$withval"
+                { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5
+$as_echo "$PERL" >&6; }
+
+else
+
+                PERL=""
+                { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+                if test "$withval" != no; then :
+
+                  # Extract the first word of "perl", so it can be a program name with args.
+set dummy perl; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_PERL+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $PERL in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PERL="$PERL" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
   fi
-  echo
-  as_fn_error $? "Stopping here as BOOST thread lib must be available at this stage. Sorry." "$LINENO" 5
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_PERL" && ac_cv_path_PERL="no"
+  ;;
+esac
+fi
+PERL=$ac_cv_path_PERL
+if test -n "$PERL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5
+$as_echo "$PERL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
-CXXFLAGS="${CXXFLAGS} ${BOOST_CPPFLAGS}"
-LDFLAGS="${LDFLAGS} ${BOOST_LDFLAGS}"
-LIBS="${LIBS} ${BOOST_THREAD_LIB}"
 
-echo "+++++++++++++++++++++++++++++++++++++"
-echo " BOOST_CPPFLAGS:    ${BOOST_CPPFLAGS}"
-echo " BOOST LDFLAGS:     ${BOOST_LDFLAGS}"
-echo " ac_boost_path:     ${ac_boost_path}"
-echo " ac_boost_lib_path: ${ac_boost_lib_path}"
-echo " BOOST_THREAD_LIB:  ${BOOST_THREAD_LIB}"
-echo
-echo "CFLAGS now: ${CFLAGS}"
-echo "CXXFLAGS now: ${CXXFLAGS}"
-echo "LDFLAGS now: ${LDFLAGS}"
-echo "LIBS now: ${LIBS}"
-echo "+++++++++++++++++++++++++++++++++++++"
 
+fi
+
+fi
+
+else
+
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+            # Extract the first word of "perl", so it can be a program name with args.
+set dummy perl; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_PERL+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $PERL in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PERL="$PERL" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_PERL" && ac_cv_path_PERL="no"
+  ;;
+esac
+fi
+PERL=$ac_cv_path_PERL
+if test -n "$PERL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5
+$as_echo "$PERL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+fi
+
+
+fi
+
+
+
+
+
+
+
+
+
+
+# Check whether --with-expat was given.
+if test "${with_expat+set}" = set; then :
+  withval=$with_expat;
+        if test "$withval" = "yes"; then
+            if test -f /usr/local/include/expat.h ; then
+                expat_prefix=/usr/local
+            elif test -f /usr/include/expat.h ; then
+                expat_prefix=/usr
+            else
+                expat_prefix=""
+            fi
+            expat_requested="yes"
+        elif test -d "$withval"; then
+            expat_prefix="$withval"
+            expat_requested="yes"
+        else
+            expat_prefix=""
+            expat_requested="no"
+        fi
+
+else
+
+                if test -f /usr/local/include/expat.h ; then
+            expat_prefix=/usr/local
+        elif test -f /usr/include/expat.h ; then
+            expat_prefix=/usr
+        else
+            expat_prefix=""
+        fi
+
+
+fi
+
+
+
+# Check whether --with-expat-inc was given.
+if test "${with_expat_inc+set}" = set; then :
+  withval=$with_expat_inc; expat_include_dir="$withval"
+else
+  expat_include_dir=""
 
+fi
 
-# Check whether --with-boost-regex was given.
-if test "${with_boost_regex+set}" = set; then :
-  withval=$with_boost_regex;
-        if test "$withval" = "no"; then
-			want_boost="no"
-        elif test "$withval" = "yes"; then
-            want_boost="yes"
-            ax_boost_user_regex_lib=""
-        else
-		    want_boost="yes"
-		ax_boost_user_regex_lib="$withval"
-		fi
 
+# Check whether --with-expat-lib was given.
+if test "${with_expat_lib+set}" = set; then :
+  withval=$with_expat_lib; expat_lib_flags="$withval"
 else
-  want_boost="yes"
+  expat_lib_flags=""
 
 fi
 
 
-	if test "x$want_boost" = "xyes"; then
+    EXPAT_CFLAGS=""
+    EXPAT_LDFLAGS=""
+    EXPAT_VERSION=""
 
-		CPPFLAGS_SAVED="$CPPFLAGS"
-		CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
-		export CPPFLAGS
+                run_expat_test="no"
 
-		LDFLAGS_SAVED="$LDFLAGS"
-		LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
-		export LDFLAGS
+    if test -n "$expat_prefix"; then
+        expat_include_dir="$expat_prefix/include"
+        expat_lib_flags="-L$expat_prefix/lib -lexpat"
+        run_expat_test="yes"
+    elif test "$expat_requested" = "yes"; then
+        if test -n "$expat_include_dir" -a -n "$expat_lib_flags"; then
+            run_expat_test="yes"
+        fi
+    else
+        run_expat_test="no"
+    fi
 
-        { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the Boost::Regex library is available" >&5
-$as_echo_n "checking whether the Boost::Regex library is available... " >&6; }
-if ${ax_cv_boost_regex+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_ext=cpp
+                if test "$run_expat_test" = "yes"; then
+
+        saved_CPPFLAGS="$CPPFLAGS"
+        CPPFLAGS="$CPPFLAGS -I$expat_include_dir"
+
+        saved_LDFLAGS="$LDFLAGS"
+        LDFLAGS="$LDFLAGS $expat_lib_flags"
+
+                                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Expat XML Parser headers in $expat_include_dir" >&5
+$as_echo_n "checking for Expat XML Parser headers in $expat_include_dir... " >&6; }
+
+        ac_ext=cpp
 ac_cpp='$CXXCPP $CPPFLAGS'
 ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
-			 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <boost/regex.hpp>
+
+
+#include <expat.h>
 
 int
 main ()
 {
-boost::regex r(); return 0;
+
+
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_cxx_try_compile "$LINENO"; then :
-  ax_cv_boost_regex=yes
+
+            EXPAT_CFLAGS="-I$expat_include_dir"
+            expat_header_found="yes"
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5
+$as_echo "found" >&6; }
+
 else
-  ax_cv_boost_regex=no
+
+            expat_header_found="no"
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+
+
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-         ac_ext=c
+        ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_boost_regex" >&5
-$as_echo "$ax_cv_boost_regex" >&6; }
-		if test "x$ax_cv_boost_regex" = "xyes"; then
+                                if test "$expat_header_found" = "yes"; then
 
-$as_echo "#define HAVE_BOOST_REGEX /**/" >>confdefs.h
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Expat XML Parser libraries" >&5
+$as_echo_n "checking for Expat XML Parser libraries... " >&6; }
 
-            BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/[^\/]*//'`
-            if test "x$ax_boost_user_regex_lib" = "x"; then
-                for libextension in `ls $BOOSTLIBDIR/libboost_regex*.so* $BOOSTLIBDIR/libboost_regex*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_regex.*\)\.so.*$;\1;' -e 's;^lib\(boost_regex.*\)\.a*$;\1;'` ; do
-                     ax_lib=${libextension}
-				    as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5
-$as_echo_n "checking for exit in -l$ax_lib... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-l$ax_lib  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+            ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char exit ();
-int
-main ()
-{
-return exit ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
-else
-  eval "$as_ac_Lib=no"
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-eval ac_res=\$$as_ac_Lib
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
-  BOOST_REGEX_LIB="-l$ax_lib";  link_regex="yes"; break
-else
-  link_regex="no"
-fi
 
-				done
-                if test "x$link_regex" != "xyes"; then
-                for libextension in `ls $BOOSTLIBDIR/boost_regex*.{dll,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_regex.*\)\.dll.*$;\1;' -e 's;^\(boost_regex.*\)\.a*$;\1;'` ; do
-                     ax_lib=${libextension}
-				    as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5
-$as_echo_n "checking for exit in -l$ax_lib... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-l$ax_lib  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
+#include <expat.h>
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char exit ();
 int
 main ()
 {
-return exit ();
+
+XML_Parser p = XML_ParserCreate(NULL);
+XML_ParserFree(p);
+p = NULL;
+
+
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
-else
-  eval "$as_ac_Lib=no"
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-eval ac_res=\$$as_ac_Lib
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
-  BOOST_REGEX_LIB="-l$ax_lib";  link_regex="yes"; break
-else
-  link_regex="no"
-fi
+if ac_fn_cxx_try_link "$LINENO"; then :
 
-				done
-                fi
+                EXPAT_LDFLAGS="$expat_lib_flags"
+                expat_lib_found="yes"
+                { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5
+$as_echo "found" >&6; }
 
-            else
-               for ax_lib in $ax_boost_user_regex_lib boost_regex-$ax_boost_user_regex_lib; do
-				      as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_main" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -l$ax_lib" >&5
-$as_echo_n "checking for main in -l$ax_lib... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
-  $as_echo_n "(cached) " >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-l$ax_lib  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
+
+                expat_lib_found="no"
+                { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
 
 
-int
-main ()
-{
-return main ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
-else
-  eval "$as_ac_Lib=no"
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-eval ac_res=\$$as_ac_Lib
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
-  BOOST_REGEX_LIB="-l$ax_lib";  link_regex="yes"; break
-else
-  link_regex="no"
-fi
+            ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-               done
-            fi
-            if test "x$ax_lib" = "x"; then
-                as_fn_error $? "Could not find a version of the Boost::Regex library!" "$LINENO" 5
-            fi
-			if test "x$link_regex" != "xyes"; then
-				as_fn_error $? "Could not link against $ax_lib !" "$LINENO" 5
-			fi
-		fi
+        fi
+
+        CPPFLAGS="$saved_CPPFLAGS"
+        LDFLAGS="$saved_LDFLAGS"
+    fi
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Expat XML Parser" >&5
+$as_echo_n "checking for Expat XML Parser... " >&6; }
+
+    if test "$run_expat_test" = "yes"; then
+        if test "$expat_header_found" = "yes" -a "$expat_lib_found" = "yes"; then
+
+
+
+
+            HAVE_EXPAT="yes"
+        else
+            HAVE_EXPAT="no"
+        fi
 
-		CPPFLAGS="$CPPFLAGS_SAVED"
-	LDFLAGS="$LDFLAGS_SAVED"
-	fi
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAVE_EXPAT" >&5
+$as_echo "$HAVE_EXPAT" >&6; }
 
+                                if test "$HAVE_EXPAT" = "yes"; then
 
-echo "+++++++++++++++++++++++++++++++++++++"
-echo " BOOST_CPPFLAGS:    ${BOOST_CPPFLAGS}"
-echo " BOOST LDFLAGS:     ${BOOST_LDFLAGS}"
-echo " ac_boost_path:     ${ac_boost_path}"
-echo " ac_boost_lib_path: ${ac_boost_lib_path}"
-echo " BOOST_REGEX_LIB:   ${BOOST_REGEX_LIB}"
-echo
+            expat_version_req=
 
-LIBS="${LIBS} ${BOOST_REGEX_LIB}"
+            if test  -n "$expat_version_req"; then
 
-echo "CFLAGS now: ${CFLAGS}"
-echo "CXXFLAGS now: ${CXXFLAGS}"
-echo "LIBS now: ${LIBS}"
-echo "+++++++++++++++++++++++++++++++++++++"
+                { $as_echo "$as_me:${as_lineno-$LINENO}: checking if Expat XML Parser version is >= $expat_version_req" >&5
+$as_echo_n "checking if Expat XML Parser version is >= $expat_version_req... " >&6; }
 
-# BOOST_FILESYSTEM will need BOOST_SYSTEM on Macs
+                if test -f "$expat_include_dir/expat.h"; then
 
+                    expat_major=`cat $expat_include_dir/expat.h | \
+                                    grep '^#define.*XML_MAJOR_VERSION.*[0-9]$' | \
+                                    sed -e 's/#define XML_MAJOR_VERSION.//'`
 
-# Check whether --with-boost-system was given.
-if test "${with_boost_system+set}" = set; then :
-  withval=$with_boost_system;
-        if test "$withval" = "no"; then
-			want_boost="no"
-        elif test "$withval" = "yes"; then
-            want_boost="yes"
-            ax_boost_user_system_lib=""
-        else
-		    want_boost="yes"
-		ax_boost_user_system_lib="$withval"
-		fi
+                    expat_minor=`cat $expat_include_dir/expat.h | \
+                                    grep '^#define.*XML_MINOR_VERSION.*[0-9]$' | \
+                                    sed -e 's/#define XML_MINOR_VERSION.//'`
 
-else
-  want_boost="yes"
+                    expat_revision=`cat $expat_include_dir/expat.h | \
+                                    grep '^#define.*XML_MICRO_VERSION.*[0-9]$' | \
+                                    sed -e 's/#define XML_MICRO_VERSION.//'`
 
-fi
+                    EXPAT_VERSION="$expat_major.$expat_minor.$expat_revision"
 
 
-	if test "x$want_boost" = "xyes"; then
+                                        expat_version_req_major=`expr $expat_version_req : '\([0-9]*\)'`
+                    expat_version_req_minor=`expr $expat_version_req : '[0-9]*\.\([0-9]*\)'`
+                    expat_version_req_revision=`expr $expat_version_req : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
+                    if test "x$expat_version_req_revision" = "x"; then
+                        expat_version_req_revision="0"
+                    fi
 
+                    expat_version_req_number=`expr $expat_version_req_major \* 10000 \
+                                               \+ $expat_version_req_minor \* 100 \
+                                               \+ $expat_version_req_revision`
 
-		CPPFLAGS_SAVED="$CPPFLAGS"
-		CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
-		export CPPFLAGS
+                                        expat_version_number=`expr $expat_major \* 10000 \
+                                          \+ $expat_minor \* 100 \
+                                           \+ $expat_revision`
 
-		LDFLAGS_SAVED="$LDFLAGS"
-		LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
-		export LDFLAGS
+                    expat_version_check=`expr $expat_version_number \>\= $expat_version_req_number`
+                    if test "$expat_version_check" = "1"; then
+                        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+                    else
+                        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+                        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Found Expat XML Parser $EXPAT_VERSION, which is older than required. Possible compilation failure." >&5
+$as_echo "$as_me: WARNING: Found Expat XML Parser $EXPAT_VERSION, which is older than required. Possible compilation failure." >&2;}
+                    fi
+                else
+                    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+                    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Missing expat.h header. Unable to determine Expat version." >&5
+$as_echo "$as_me: WARNING: Missing expat.h header. Unable to determine Expat version." >&2;}
+                fi
+            fi
+        fi
 
-        { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the Boost::System library is available" >&5
-$as_echo_n "checking whether the Boost::System library is available... " >&6; }
-if ${ax_cv_boost_system+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+    else
+        HAVE_EXPAT="no"
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAVE_EXPAT" >&5
+$as_echo "$HAVE_EXPAT" >&6; }
 
-			 CXXFLAGS_SAVE=$CXXFLAGS
+        if test "$expat_requested" = "yes"; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Expat XML Parser support requested but headers or library not found. Specify valid prefix of Expat using --with-expat=[DIR] or provide include directory and linker flags using --with-expat-inc and --with-expat-lib" >&5
+$as_echo "$as_me: WARNING: Expat XML Parser support requested but headers or library not found. Specify valid prefix of Expat using --with-expat=[DIR] or provide include directory and linker flags using --with-expat-inc and --with-expat-lib" >&2;}
+        fi
+    fi
 
-			 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <boost/system/error_code.hpp>
-int
-main ()
-{
-boost::system::system_category
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_cxx_try_compile "$LINENO"; then :
-  ax_cv_boost_system=yes
-else
-  ax_cv_boost_system=no
+if test "${HAVE_EXPAT}" = "yes"; then
+  CFLAGS="$CFLAGS ${EXPAT_CFLAGS}"
+  CXXFLAGS="$CXXFLAGS ${EXPAT_CFLAGS}"
+  LDFLAGS="${LDFLAGS} ${EXPAT_LDFLAGS}"
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-			 CXXFLAGS=$CXXFLAGS_SAVE
-             ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
+echo
+echo "+++++++++++++++++++++++++++++++++++++"
+echo "CFLAGS now: ${CFLAGS}"
+echo "CXXFLAGS now: ${CXXFLAGS}"
+echo "LDFLAGS now: ${LDFLAGS}"
+echo "+++++++++++++++++++++++++++++++++++++"
+
+#
+# Handle user hints
+#
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if zlib is wanted" >&5
+$as_echo_n "checking if zlib is wanted... " >&6; }
 
+# Check whether --with-zlib was given.
+if test "${with_zlib+set}" = set; then :
+  withval=$with_zlib; if test "$withval" != no ; then
+  zlib_places="/usr/local /usr /opt/local /sw"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+  if test -d "$withval"
+  then
+    zlib_places="$withval $zlib_places"
+  else
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Sorry, $withval does not exist, checking usual places" >&5
+$as_echo "$as_me: WARNING: Sorry, $withval does not exist, checking usual places" >&2;}
+  fi
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_boost_system" >&5
-$as_echo "$ax_cv_boost_system" >&6; }
-		if test "x$ax_cv_boost_system" = "xyes"; then
 
 
+#
+# Locate zlib, if wanted
+#
+if test -n "${zlib_places}"
+then
+	# check the user supplied or any other more or less 'standard' place:
+	#   Most UNIX systems      : /usr/local and /usr
+	#   MacPorts / Fink on OSX : /opt/local respectively /sw
+	for ZLIB_HOME in ${zlib_places} ; do
+	  if test -f "${ZLIB_HOME}/include/zlib.h"; then break; fi
+	  ZLIB_HOME=""
+	done
+
+	# if zlib.h was nowhere to be found, give a notice and bail out
+	if test ! -n "${ZLIB_HOME}"; then
+          as_fn_error $? "No zlib.h in any include directory of ${zlib_places}: either specify a valid zlib installation with --with-zlib=DIR or disable zlib usage with --without-zlib" "$LINENO" 5
+	fi
 
-$as_echo "#define HAVE_BOOST_SYSTEM /**/" >>confdefs.h
+        ZLIB_OLD_LDFLAGS=$LDFLAGS
+        ZLIB_OLD_CPPFLAGS=$LDFLAGS
+        LDFLAGS="$LDFLAGS -L${ZLIB_HOME}/lib"
+        CPPFLAGS="$CPPFLAGS -I${ZLIB_HOME}/include"
 
-            BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/[^\/]*//'`
+        ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-			LDFLAGS_SAVE=$LDFLAGS
-            if test "x$ax_boost_user_system_lib" = "x"; then
-                for libextension in `ls $BOOSTLIBDIR/libboost_system*.so* $BOOSTLIBDIR/libboost_system*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_system.*\)\.so.*$;\1;' -e 's;^lib\(boost_system.*\)\.a*$;\1;'` ; do
-                     ax_lib=${libextension}
-				    as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5
-$as_echo_n "checking for exit in -l$ax_lib... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inflateEnd in -lz" >&5
+$as_echo_n "checking for inflateEnd in -lz... " >&6; }
+if test "${ac_cv_lib_z_inflateEnd+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-l$ax_lib  $LIBS"
+LIBS="-lz  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -18292,94 +17170,58 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char exit ();
+char inflateEnd ();
 int
 main ()
 {
-return exit ();
+return inflateEnd ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
+  ac_cv_lib_z_inflateEnd=yes
 else
-  eval "$as_ac_Lib=no"
+  ac_cv_lib_z_inflateEnd=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-eval ac_res=\$$as_ac_Lib
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
-  BOOST_SYSTEM_LIB="-l$ax_lib";  link_system="yes"; break
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_inflateEnd" >&5
+$as_echo "$ac_cv_lib_z_inflateEnd" >&6; }
+if test "x$ac_cv_lib_z_inflateEnd" = x""yes; then :
+  zlib_cv_libz=yes
 else
-  link_system="no"
+  zlib_cv_libz=no
 fi
 
-				done
-                if test "x$link_system" != "xyes"; then
-                for libextension in `ls $BOOSTLIBDIR/boost_system*.{dll,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_system.*\)\.dll.*$;\1;' -e 's;^\(boost_system.*\)\.a*$;\1;'` ; do
-                     ax_lib=${libextension}
-				    as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5
-$as_echo_n "checking for exit in -l$ax_lib... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-l$ax_lib  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char exit ();
-int
-main ()
-{
-return exit ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
-else
-  eval "$as_ac_Lib=no"
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-eval ac_res=\$$as_ac_Lib
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
-  BOOST_SYSTEM_LIB="-l$ax_lib";  link_system="yes"; break
+        ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default"
+if test "x$ac_cv_header_zlib_h" = x""yes; then :
+  zlib_cv_zlib_h=yes
 else
-  link_system="no"
+  zlib_cv_zlib_h=no
 fi
 
-				done
-                fi
 
-            else
-               for ax_lib in $ax_boost_user_system_lib boost_system-$ax_boost_user_system_lib; do
-				      as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5
-$as_echo_n "checking for exit in -l$ax_lib... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
+        ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+        if test "$zlib_cv_libz" = "yes" -a "$zlib_cv_zlib_h" = "yes"
+        then
+                #
+                # If both library and header were found, use them
+                #
+                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inflateEnd in -lz" >&5
+$as_echo_n "checking for inflateEnd in -lz... " >&6; }
+if test "${ac_cv_lib_z_inflateEnd+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-l$ax_lib  $LIBS"
+LIBS="-lz  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -18389,333 +17231,417 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char exit ();
+char inflateEnd ();
 int
 main ()
 {
-return exit ();
+return inflateEnd ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
+  ac_cv_lib_z_inflateEnd=yes
 else
-  eval "$as_ac_Lib=no"
+  ac_cv_lib_z_inflateEnd=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-eval ac_res=\$$as_ac_Lib
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
-  BOOST_SYSTEM_LIB="-l$ax_lib";  link_system="yes"; break
-else
-  link_system="no"
-fi
-
-                  done
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_inflateEnd" >&5
+$as_echo "$ac_cv_lib_z_inflateEnd" >&6; }
+if test "x$ac_cv_lib_z_inflateEnd" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBZ 1
+_ACEOF
 
-            fi
-            if test "x$ax_lib" = "x"; then
-                as_fn_error $? "Could not find a version of the library!" "$LINENO" 5
-            fi
-			if test "x$link_system" = "xno"; then
-				as_fn_error $? "Could not link against $ax_lib !" "$LINENO" 5
-			fi
-		fi
+  LIBS="-lz $LIBS"
 
-		CPPFLAGS="$CPPFLAGS_SAVED"
-	LDFLAGS="$LDFLAGS_SAVED"
-	fi
+fi
 
+                { $as_echo "$as_me:${as_lineno-$LINENO}: checking zlib in ${ZLIB_HOME}" >&5
+$as_echo_n "checking zlib in ${ZLIB_HOME}... " >&6; }
+                { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; }
+        else
+                #
+                # If either header or library was not found, revert and bomb
+                #
+                { $as_echo "$as_me:${as_lineno-$LINENO}: checking zlib in ${ZLIB_HOME}" >&5
+$as_echo_n "checking zlib in ${ZLIB_HOME}... " >&6; }
+                LDFLAGS="$ZLIB_OLD_LDFLAGS"
+                CPPFLAGS="$ZLIB_OLD_CPPFLAGS"
+                { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
+$as_echo "failed" >&6; }
+                as_fn_error $? "either specify a valid zlib installation with --with-zlib=DIR or disable zlib usage with --without-zlib" "$LINENO" 5
+        fi
+fi
 
-echo "+++++++++++++++++++++++++++++++++++++"
-echo " BOOST_CPPFLAGS:    ${BOOST_CPPFLAGS}"
-echo " BOOST LDFLAGS:     ${BOOST_LDFLAGS}"
-echo " ac_boost_path:     ${ac_boost_path}"
-echo " ac_boost_lib_path: ${ac_boost_lib_path}"
-echo " BOOST_SYSTEM_LIB:   ${BOOST_SYSTEM_LIB}"
-echo
 
-LIBS="${LIBS} ${BOOST_SYSTEM_LIB}"
 
+echo
+echo "+++++++++++++++++++++++++++++++++++++"
 echo "CFLAGS now: ${CFLAGS}"
 echo "CXXFLAGS now: ${CXXFLAGS}"
-echo "LIBS now: ${LIBS}"
+echo "LDFLAGS now: ${LDFLAGS}"
 echo "+++++++++++++++++++++++++++++++++++++"
 
 
 
-# Check whether --with-boost-filesystem was given.
-if test "${with_boost_filesystem+set}" = set; then :
-  withval=$with_boost_filesystem;
-        if test "$withval" = "no"; then
-			want_boost="no"
-        elif test "$withval" = "yes"; then
-            want_boost="yes"
-            ax_boost_user_filesystem_lib=""
-        else
-		    want_boost="yes"
-		ax_boost_user_filesystem_lib="$withval"
-		fi
+# Check whether --with-boost was given.
+if test "${with_boost+set}" = set; then :
+  withval=$with_boost;
+    if test "$withval" = "no"; then
+        want_boost="no"
+    elif test "$withval" = "yes"; then
+        want_boost="yes"
+        ac_boost_path=""
+    else
+        want_boost="yes"
+        ac_boost_path="$withval"
+    fi
 
 else
   want_boost="yes"
+fi
+
+
+
+
+# Check whether --with-boost-libdir was given.
+if test "${with_boost_libdir+set}" = set; then :
+  withval=$with_boost_libdir;
+        if test -d "$withval"
+        then
+                ac_boost_lib_path="$withval"
+        else
+                as_fn_error $? "--with-boost-libdir expected directory name" "$LINENO" 5
+        fi
+
+else
+  ac_boost_lib_path=""
 
 fi
 
 
-	if test "x$want_boost" = "xyes"; then
+if test "x$want_boost" = "xyes"; then
+    boost_lib_version_req=1.35.0
+    boost_lib_version_req_shorten=`expr $boost_lib_version_req : '\([0-9]*\.[0-9]*\)'`
+    boost_lib_version_req_major=`expr $boost_lib_version_req : '\([0-9]*\)'`
+    boost_lib_version_req_minor=`expr $boost_lib_version_req : '[0-9]*\.\([0-9]*\)'`
+    boost_lib_version_req_sub_minor=`expr $boost_lib_version_req : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
+    if test "x$boost_lib_version_req_sub_minor" = "x" ; then
+        boost_lib_version_req_sub_minor="0"
+        fi
+    WANT_BOOST_VERSION=`expr $boost_lib_version_req_major \* 100000 \+  $boost_lib_version_req_minor \* 100 \+ $boost_lib_version_req_sub_minor`
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for boostlib >= $boost_lib_version_req" >&5
+$as_echo_n "checking for boostlib >= $boost_lib_version_req... " >&6; }
+    succeeded=no
 
-		CPPFLAGS_SAVED="$CPPFLAGS"
-		CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
-		export CPPFLAGS
+                        libsubdirs="lib"
+    if test `uname -m` = x86_64; then
+        libsubdirs="lib64 lib lib64"
+    fi
 
-		LDFLAGS_SAVED="$LDFLAGS"
-		LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
-		export LDFLAGS
+                if test "$ac_boost_path" != ""; then
+        BOOST_CPPFLAGS="-I$ac_boost_path/include"
+        for ac_boost_path_tmp in $libsubdirs; do
+                if test -d "$ac_boost_path"/"$ac_boost_path_tmp" ; then
+                        BOOST_LDFLAGS="-L$ac_boost_path/$ac_boost_path_tmp"
+                        break
+                fi
+        done
+    elif test "$cross_compiling" != yes; then
+        for ac_boost_path_tmp in /usr /usr/local /opt /opt/local ; do
+            if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then
+                for libsubdir in $libsubdirs ; do
+                    if ls "$ac_boost_path_tmp/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
+                done
+                BOOST_LDFLAGS="-L$ac_boost_path_tmp/$libsubdir"
+                BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include"
+                break;
+            fi
+        done
+    fi
+
+            if test "$ac_boost_lib_path" != ""; then
+       BOOST_LDFLAGS="-L$ac_boost_lib_path"
+    fi
+
+    CPPFLAGS_SAVED="$CPPFLAGS"
+    CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
+    export CPPFLAGS
+
+    LDFLAGS_SAVED="$LDFLAGS"
+    LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
+    export LDFLAGS
+
+
+    ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+    #include <boost/version.hpp>
+
+int
+main ()
+{
+
+    #if BOOST_VERSION >= $WANT_BOOST_VERSION
+    // Everything is okay
+    #else
+    #  error Boost version is too old
+    #endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+    succeeded=yes
+    found_system=yes
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+    ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
+            if test "x$succeeded" != "xyes"; then
+        _version=0
+        if test "$ac_boost_path" != ""; then
+            if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
+                for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
+                    _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
+                    V_CHECK=`expr $_version_tmp \> $_version`
+                    if test "$V_CHECK" = "1" ; then
+                        _version=$_version_tmp
+                    fi
+                    VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
+                    BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE"
+                done
+            fi
+        else
+            if test "$cross_compiling" != yes; then
+                for ac_boost_path in /usr /usr/local /opt /opt/local ; do
+                    if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
+                        for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
+                            _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
+                            V_CHECK=`expr $_version_tmp \> $_version`
+                            if test "$V_CHECK" = "1" ; then
+                                _version=$_version_tmp
+                                best_path=$ac_boost_path
+                            fi
+                        done
+                    fi
+                done
+
+                VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
+                BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE"
+                if test "$ac_boost_lib_path" = ""; then
+                    for libsubdir in $libsubdirs ; do
+                        if ls "$best_path/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
+                    done
+                    BOOST_LDFLAGS="-L$best_path/$libsubdir"
+                fi
+            fi
+
+            if test "x$BOOST_ROOT" != "x"; then
+                for libsubdir in $libsubdirs ; do
+                    if ls "$BOOST_ROOT/stage/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
+                done
+                if test -d "$BOOST_ROOT" && test -r "$BOOST_ROOT" && test -d "$BOOST_ROOT/stage/$libsubdir" && test -r "$BOOST_ROOT/stage/$libsubdir"; then
+                    version_dir=`expr //$BOOST_ROOT : '.*/\(.*\)'`
+                    stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'`
+                        stage_version_shorten=`expr $stage_version : '\([0-9]*\.[0-9]*\)'`
+                    V_CHECK=`expr $stage_version_shorten \>\= $_version`
+                    if test "$V_CHECK" = "1" -a "$ac_boost_lib_path" = "" ; then
+                        { $as_echo "$as_me:${as_lineno-$LINENO}: We will use a staged boost library from $BOOST_ROOT" >&5
+$as_echo "$as_me: We will use a staged boost library from $BOOST_ROOT" >&6;}
+                        BOOST_CPPFLAGS="-I$BOOST_ROOT"
+                        BOOST_LDFLAGS="-L$BOOST_ROOT/stage/$libsubdir"
+                    fi
+                fi
+            fi
+        fi
 
-		LIBS_SAVED=$LIBS
-		LIBS="$LIBS $BOOST_SYSTEM_LIB"
-		export LIBS
+        CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
+        export CPPFLAGS
+        LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
+        export LDFLAGS
 
-        { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the Boost::Filesystem library is available" >&5
-$as_echo_n "checking whether the Boost::Filesystem library is available... " >&6; }
-if ${ax_cv_boost_filesystem+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_ext=cpp
+        ac_ext=cpp
 ac_cpp='$CXXCPP $CPPFLAGS'
 ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
-         cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <boost/filesystem/path.hpp>
+
+        #include <boost/version.hpp>
+
 int
 main ()
 {
-using namespace boost::filesystem;
-                                   path my_path( "foo/bar/data.txt" );
-                                   return 0;
+
+        #if BOOST_VERSION >= $WANT_BOOST_VERSION
+        // Everything is okay
+        #else
+        #  error Boost version is too old
+        #endif
+
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_cxx_try_compile "$LINENO"; then :
-  ax_cv_boost_filesystem=yes
-else
-  ax_cv_boost_filesystem=no
+
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+        succeeded=yes
+        found_system=yes
+
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-         ac_ext=c
+        ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
+    fi
 
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_boost_filesystem" >&5
-$as_echo "$ax_cv_boost_filesystem" >&6; }
-		if test "x$ax_cv_boost_filesystem" = "xyes"; then
+    if test "$succeeded" != "yes" ; then
+        if test "$_version" = "0" ; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: We could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option.  If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation." >&5
+$as_echo "$as_me: We could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option.  If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation." >&6;}
+        else
+            { $as_echo "$as_me:${as_lineno-$LINENO}: Your boost libraries seems to old (version $_version)." >&5
+$as_echo "$as_me: Your boost libraries seems to old (version $_version)." >&6;}
+        fi
+        # execute ACTION-IF-NOT-FOUND (if present):
+        :
+    else
 
-$as_echo "#define HAVE_BOOST_FILESYSTEM /**/" >>confdefs.h
 
-            BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/[^\/]*//'`
-            if test "x$ax_boost_user_filesystem_lib" = "x"; then
-                for libextension in `ls $BOOSTLIBDIR/libboost_filesystem*.so* $BOOSTLIBDIR/libboost_filesystem*.dylib* $BOOSTLIBDIR/libboost_filesystem*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_filesystem.*\)\.so.*$;\1;' -e 's;^lib\(boost_filesystem.*\)\.a*$;\1;' -e 's;^lib\(boost_filesystem.*\)\.dylib$;\1;'` ; do
-                     ax_lib=${libextension}
-				    as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5
-$as_echo_n "checking for exit in -l$ax_lib... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-l$ax_lib  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char exit ();
-int
-main ()
-{
-return exit ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
-else
-  eval "$as_ac_Lib=no"
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-eval ac_res=\$$as_ac_Lib
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
-  BOOST_FILESYSTEM_LIB="-l$ax_lib";  link_filesystem="yes"; break
-else
-  link_filesystem="no"
-fi
+$as_echo "#define HAVE_BOOST /**/" >>confdefs.h
 
-				done
-                if test "x$link_filesystem" != "xyes"; then
-                for libextension in `ls $BOOSTLIBDIR/boost_filesystem*.{dll,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_filesystem.*\)\.dll.*$;\1;' -e 's;^\(boost_filesystem.*\)\.a*$;\1;'` ; do
-                     ax_lib=${libextension}
-				    as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5
-$as_echo_n "checking for exit in -l$ax_lib... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-l$ax_lib  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
+        # execute ACTION-IF-FOUND (if present):
+        :
+    fi
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char exit ();
-int
-main ()
-{
-return exit ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
-else
-  eval "$as_ac_Lib=no"
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-eval ac_res=\$$as_ac_Lib
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
-  BOOST_FILESYSTEM_LIB="-l$ax_lib";  link_filesystem="yes"; break
-else
-  link_filesystem="no"
+    CPPFLAGS="$CPPFLAGS_SAVED"
+    LDFLAGS="$LDFLAGS_SAVED"
 fi
 
-				done
-		    fi
-            else
-               for ax_lib in $ax_boost_user_filesystem_lib boost_filesystem-$ax_boost_user_filesystem_lib; do
-				      as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5
-$as_echo_n "checking for exit in -l$ax_lib... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-l$ax_lib  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char exit ();
-int
-main ()
-{
-return exit ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
-else
-  eval "$as_ac_Lib=no"
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-eval ac_res=\$$as_ac_Lib
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
-  BOOST_FILESYSTEM_LIB="-l$ax_lib";  link_filesystem="yes"; break
-else
-  link_filesystem="no"
-fi
 
-                  done
+echo
+echo "+++++++++++++++++++++++++++++++++++++"
+echo " BOOST_CPPFLAGS:    ${BOOST_CPPFLAGS}"
+echo " BOOST LDFLAGS:     ${BOOST_LDFLAGS}"
+echo "CFLAGS now: ${CFLAGS}"
+echo "CXXFLAGS now: ${CXXFLAGS}"
+echo "LDFLAGS now: ${LDFLAGS}"
+echo "+++++++++++++++++++++++++++++++++++++"
 
-            fi
-            if test "x$ax_lib" = "x"; then
-                as_fn_error $? "Could not find a version of the library!" "$LINENO" 5
-            fi
-			if test "x$link_filesystem" != "xyes"; then
-				as_fn_error $? "Could not link against $ax_lib !" "$LINENO" 5
-			fi
-		fi
+# I have no idea why I need this ... but looks like
+#  the autoconf macros have problems in automatically finding
+#  the best paths on some systems
+#
+# So ... if we want boost (we do) and something went wrong with
+#  automatic configuration, try setting rescue values which might work
 
-		CPPFLAGS="$CPPFLAGS_SAVED"
-		LDFLAGS="$LDFLAGS_SAVED"
-		LIBS="$LIBS_SAVED"
-	fi
+possibleboostproblem="no"
+
+if test "${BOOST_CPPFLAGS}" = "" ; then
+
+  possibleboostproblem="yes"
+
+  echo "Automatic recognition of Boost CPP flags failed? I have"
+  echo "////// BOOST_CPPFLAGS:   ${BOOST_CPPFLAGS}"
+  echo "////// ac_boost_path:    ${ac_boost_path}"
+  echo "Setting rescue values!"
+
+  if test "${systemuname}" = "SunOS" ; then
+    BOOST_CPPFLAGS="-pthreads"
+  elif test "x$build_os" = "xming32" ; then
+    BOOST_CPPFLAGS="-mthreads"
+  else
+    BOOST_CPPFLAGS="-pthread"
+  fi
+
+  if test "${ac_boost_path}" = "" ; then
+    BOOST_CPPFLAGS="${BOOST_CPPFLAGS} -I $/usr/include"
+    echo "If the rescue below is wrong, use --with-boost=/path/to/boost"
+  else
+    BOOST_CPPFLAGS="${BOOST_CPPFLAGS} -I ${ac_boost_path}/include"
+  fi
+
+  echo "Choosen: ${BOOST_CPPFLAGS}"
+  #LDFLAGS="${LDFLAGS} ${BOOST_THREAD_LIB}"
+fi
+
+if test "${BOOST_LDFLAGS}" = "" ; then
+  possibleboostproblem="yes"
+  echo "Automatic recognition of Boost LD failed? I have"
+  echo "////// BOOST_CPPFLAGS:    ${BOOST_CPPFLAGS}"
+  echo "////// BOOST LDFLAGS:     ${BOOST_LDFLAGS}"
+  echo "////// ac_boost_path:     ${ac_boost_path}"
+  echo "////// ac_boost_lib_path: ${ac_boost_lib_path}"
+
+  if test "${ac_boost_lib_path}" = "" ; then
+    if test "${enable_64}" = "yes"; then
+      BOOST_LDFLAGS="-L/usr/lib64"
+    else
+      BOOST_LDFLAGS="-L/usr/lib"
+    fi
+    echo "If the rescue value below is wrong, use --with-boost-libdir=/path/to/dir/with/boostlibs"
+  else
+    BOOST_LDFLAGS="-L${ac_boost_lib_path}"
+  fi
 
+  echo "Setting rescue value: ${BOOST_LDFLAGS}"
+fi
 
+echo
 echo "+++++++++++++++++++++++++++++++++++++"
 echo " BOOST_CPPFLAGS:    ${BOOST_CPPFLAGS}"
 echo " BOOST LDFLAGS:     ${BOOST_LDFLAGS}"
-echo " ac_boost_path:     ${ac_boost_path}"
-echo " ac_boost_lib_path: ${ac_boost_lib_path}"
-echo " BOOST_FILESYSTEM_LIB:   ${BOOST_FILESYSTEM_LIB}"
-echo
-
-LIBS="${LIBS} ${BOOST_FILESYSTEM_LIB}"
-
 echo "CFLAGS now: ${CFLAGS}"
 echo "CXXFLAGS now: ${CXXFLAGS}"
-echo "LIBS now: ${LIBS}"
+echo "LDFLAGS now: ${LDFLAGS}"
 echo "+++++++++++++++++++++++++++++++++++++"
 
 
 
-
-# Check whether --with-boost-iostreams was given.
-if test "${with_boost_iostreams+set}" = set; then :
-  withval=$with_boost_iostreams;
+# Check whether --with-boost-thread was given.
+if test "${with_boost_thread+set}" = set; then :
+  withval=$with_boost_thread;
         if test "$withval" = "no"; then
 			want_boost="no"
         elif test "$withval" = "yes"; then
             want_boost="yes"
-            ax_boost_user_iostreams_lib=""
+            ax_boost_user_thread_lib=""
         else
 		    want_boost="yes"
-		ax_boost_user_iostreams_lib="$withval"
+        	ax_boost_user_thread_lib="$withval"
 		fi
 
 else
@@ -18726,6 +17652,7 @@ fi
 
 	if test "x$want_boost" = "xyes"; then
 
+
 		CPPFLAGS_SAVED="$CPPFLAGS"
 		CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
 		export CPPFLAGS
@@ -18734,9 +17661,9 @@ fi
 		LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
 		export LDFLAGS
 
-        { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the Boost::IOStreams library is available" >&5
-$as_echo_n "checking whether the Boost::IOStreams library is available... " >&6; }
-if ${ax_cv_boost_iostreams+:} false; then :
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the Boost::Thread library is available" >&5
+$as_echo_n "checking whether the Boost::Thread library is available... " >&6; }
+if test "${ax_cv_boost_thread+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_ext=cpp
@@ -18745,30 +17672,35 @@ ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
-		 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+			 CXXFLAGS_SAVE=$CXXFLAGS
+
+			 if test "x$build_os" = "xsolaris" ; then
+  				 CXXFLAGS="-pthreads $CXXFLAGS"
+			 elif test "x$build_os" = "xming32" ; then
+				 CXXFLAGS="-mthreads $CXXFLAGS"
+			 else
+				CXXFLAGS="-pthread $CXXFLAGS"
+			 fi
+			 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <boost/iostreams/filtering_stream.hpp>
-											 #include <boost/range/iterator_range.hpp>
-
+#include <boost/thread/thread.hpp>
 int
 main ()
 {
-std::string  input = "Hello World!";
-								 namespace io = boost::iostreams;
-									 io::filtering_istream  in(boost::make_iterator_range(input));
-									 return 0;
-
+boost::thread_group thrds;
+                                   return 0;
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_cxx_try_compile "$LINENO"; then :
-  ax_cv_boost_iostreams=yes
+  ax_cv_boost_thread=yes
 else
-  ax_cv_boost_iostreams=no
+  ax_cv_boost_thread=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-         ac_ext=c
+			 CXXFLAGS=$CXXFLAGS_SAVE
+             ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
@@ -18776,20 +17708,38 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_boost_iostreams" >&5
-$as_echo "$ax_cv_boost_iostreams" >&6; }
-		if test "x$ax_cv_boost_iostreams" = "xyes"; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_boost_thread" >&5
+$as_echo "$ax_cv_boost_thread" >&6; }
+		if test "x$ax_cv_boost_thread" = "xyes"; then
+           if test "x$build_os" = "xsolaris" ; then
+			  BOOST_CPPFLAGS="-pthreads $BOOST_CPPFLAGS"
+		   elif test "x$build_os" = "xming32" ; then
+			  BOOST_CPPFLAGS="-mthreads $BOOST_CPPFLAGS"
+		   else
+			  BOOST_CPPFLAGS="-pthread $BOOST_CPPFLAGS"
+		   fi
+
+
 
-$as_echo "#define HAVE_BOOST_IOSTREAMS /**/" >>confdefs.h
+
+$as_echo "#define HAVE_BOOST_THREAD /**/" >>confdefs.h
 
             BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/[^\/]*//'`
-            if test "x$ax_boost_user_iostreams_lib" = "x"; then
-                for libextension in `ls $BOOSTLIBDIR/libboost_iostreams*.so* $BOOSTLIBDIR/libboost_iostreams*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_iostreams.*\)\.so.*$;\1;' -e 's;^lib\(boost_iostreams.*\)\.a*$;\1;'` ; do
+
+			LDFLAGS_SAVE=$LDFLAGS
+                        case "x$build_os" in
+                          *bsd* )
+                               LDFLAGS="-pthread $LDFLAGS"
+                          break;
+                          ;;
+                        esac
+            if test "x$ax_boost_user_thread_lib" = "x"; then
+                for libextension in `ls $BOOSTLIBDIR/libboost_thread*.so* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_thread.*\)\.so.*$;\1;'` `ls $BOOSTLIBDIR/libboost_thread*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_thread.*\)\.a*$;\1;'`; do
                      ax_lib=${libextension}
 				    as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5
 $as_echo_n "checking for exit in -l$ax_lib... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
+if eval "test \"\${$as_ac_Lib+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -18825,19 +17775,19 @@ eval ac_res=\$$as_ac_Lib
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
 if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
-  BOOST_IOSTREAMS_LIB="-l$ax_lib";  link_iostreams="yes"; break
+  BOOST_THREAD_LIB="-l$ax_lib";  link_thread="yes"; break
 else
-  link_iostreams="no"
+  link_thread="no"
 fi
 
-				done
-                if test "x$link_iostreams" != "xyes"; then
-                for libextension in `ls $BOOSTLIBDIR/boost_iostreams*.{dll,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_iostreams.*\)\.dll.*$;\1;' -e 's;^\(boost_iostreams.*\)\.a*$;\1;'` ; do
+  				done
+                if test "x$link_thread" != "xyes"; then
+                for libextension in `ls $BOOSTLIBDIR/boost_thread*.dll* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_thread.*\)\.dll.*$;\1;'` `ls $BOOSTLIBDIR/boost_thread*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_thread.*\)\.a*$;\1;'` ; do
                      ax_lib=${libextension}
 				    as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5
 $as_echo_n "checking for exit in -l$ax_lib... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
+if eval "test \"\${$as_ac_Lib+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -18873,581 +17823,240 @@ eval ac_res=\$$as_ac_Lib
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
 if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
-  BOOST_IOSTREAMS_LIB="-l$ax_lib";  link_iostreams="yes"; break
-else
-  link_iostreams="no"
-fi
-
-				done
-                fi
-
-            else
-               for ax_lib in $ax_boost_user_iostreams_lib boost_iostreams-$ax_boost_user_iostreams_lib; do
-				      as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_main" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -l$ax_lib" >&5
-$as_echo_n "checking for main in -l$ax_lib... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-l$ax_lib  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-
-int
-main ()
-{
-return main ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
-else
-  eval "$as_ac_Lib=no"
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-eval ac_res=\$$as_ac_Lib
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
-  BOOST_IOSTREAMS_LIB="-l$ax_lib";  link_iostreams="yes"; break
-else
-  link_iostreams="no"
-fi
-
-                  done
-
-            fi
-            if test "x$ax_lib" = "x"; then
-                as_fn_error $? "Could not find a version of the library!" "$LINENO" 5
-            fi
-			if test "x$link_iostreams" != "xyes"; then
-				as_fn_error $? "Could not link against $ax_lib !" "$LINENO" 5
-			fi
-		fi
-
-		CPPFLAGS="$CPPFLAGS_SAVED"
-	LDFLAGS="$LDFLAGS_SAVED"
-	fi
-
-
-echo "+++++++++++++++++++++++++++++++++++++"
-echo " BOOST_CPPFLAGS:    ${BOOST_CPPFLAGS}"
-echo " BOOST LDFLAGS:     ${BOOST_LDFLAGS}"
-echo " ac_boost_path:     ${ac_boost_path}"
-echo " ac_boost_lib_path: ${ac_boost_lib_path}"
-echo " BOOST_IOSTREAMS_LIB:   ${BOOST_IOSTREAMS_LIB}"
-echo
-
-# The "-lz" here is no error: else it does not link on Trinity, no matter where I put -lz
-#  in the Makefile-am of src/progs :-(
-
-LIBS="${LIBS} ${BOOST_IOSTREAMS_LIB}"
-
-echo "CFLAGS now: ${CFLAGS}"
-echo "CXXFLAGS now: ${CXXFLAGS}"
-echo "LIBS now: ${LIBS}"
-echo "+++++++++++++++++++++++++++++++++++++"
-
-
-
-# check whether rt library is needed. BOOST thread needs
-#  clock_gettime, on some systems it's in rt lib which is
-#  NOT automatically used
-# problem: AC_CHECK_LIB prepends -lrt to LIBS, we need
-# to have it *after* the boost libs
-oldLIBS=$LIBS
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lrt" >&5
-$as_echo_n "checking for clock_gettime in -lrt... " >&6; }
-if ${ac_cv_lib_rt_clock_gettime+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lrt  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char clock_gettime ();
-int
-main ()
-{
-return clock_gettime ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_rt_clock_gettime=yes
-else
-  ac_cv_lib_rt_clock_gettime=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_clock_gettime" >&5
-$as_echo "$ac_cv_lib_rt_clock_gettime" >&6; }
-if test "x$ac_cv_lib_rt_clock_gettime" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBRT 1
-_ACEOF
-
-  LIBS="-lrt $LIBS"
-
-fi
-
-if test "${LIBS}" != "${oldLIBS}"; then
-  LIBS="$oldLIBS -lrt"
-  echo "+++++++++++++++++++++++++++++++++++++"
-  echo "Need to specifically use rt library"
-  echo "LIBS now: ${LIBS}"
-  echo "+++++++++++++++++++++++++++++++++++++"
-fi
-
-
-CFLAGS=${oldCFLAGS}
-
-# check for expat and zlib
-
-# BaCh 2013-03-08: AX_LIB_EXPAT serial 9 overwrites $LIBS! Make sure to use at least serial 10
-
-
-
-# Check whether --with-expat was given.
-if test "${with_expat+set}" = set; then :
-  withval=$with_expat;
-        if test "$withval" = "yes"; then
-            if test -f /usr/local/include/expat.h ; then
-                expat_prefix=/usr/local
-            elif test -f /usr/include/expat.h ; then
-                expat_prefix=/usr
-            else
-                expat_prefix=""
-            fi
-            expat_requested="yes"
-        elif test -d "$withval"; then
-            expat_prefix="$withval"
-            expat_requested="yes"
-        else
-            expat_prefix=""
-            expat_requested="no"
-        fi
-
-else
-
-                if test -f /usr/local/include/expat.h ; then
-            expat_prefix=/usr/local
-        elif test -f /usr/include/expat.h ; then
-            expat_prefix=/usr
-        else
-            expat_prefix=""
-        fi
-
-
-fi
-
-
-
-# Check whether --with-expat-inc was given.
-if test "${with_expat_inc+set}" = set; then :
-  withval=$with_expat_inc; expat_include_dir="$withval"
-else
-  expat_include_dir=""
-
-fi
-
-
-# Check whether --with-expat-lib was given.
-if test "${with_expat_lib+set}" = set; then :
-  withval=$with_expat_lib; expat_lib_flags="$withval"
-else
-  expat_lib_flags=""
-
-fi
-
-
-    EXPAT_CFLAGS=""
-    EXPAT_LIBS=""
-    EXPAT_VERSION=""
-
-                run_expat_test="no"
-
-    if test -n "$expat_prefix"; then
-        expat_include_dir="$expat_prefix/include"
-        expat_ld_flags="-L$expat_prefix/lib"
-        expat_lib_flags="-lexpat"
-        run_expat_test="yes"
-    elif test "$expat_requested" = "yes"; then
-        if test -n "$expat_include_dir" -a -n "$expat_lib_flags"; then
-            run_expat_test="yes"
-        fi
-    else
-        run_expat_test="no"
-    fi
-
-                if test "$run_expat_test" = "yes"; then
-
-        saved_CPPFLAGS="$CPPFLAGS"
-        CPPFLAGS="$CPPFLAGS -I$expat_include_dir"
-
-        saved_LIBS="$LIBS"
-        LIBS="$LIBS $expat_lib_flags"
-
-        saved_LDFLAGS="$LDFLAGS"
-        LDFLAGS="$LDFLAGS $expat_ld_flags"
-
-                                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Expat XML Parser headers in $expat_include_dir" >&5
-$as_echo_n "checking for Expat XML Parser headers in $expat_include_dir... " >&6; }
-
-        ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
-        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-
-#include <expat.h>
-
-int
-main ()
-{
-
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_cxx_try_compile "$LINENO"; then :
-
-            EXPAT_CFLAGS="-I$expat_include_dir"
-            expat_header_found="yes"
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5
-$as_echo "found" >&6; }
-
+  BOOST_THREAD_LIB="-l$ax_lib";  link_thread="yes"; break
 else
-
-            expat_header_found="no"
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
-$as_echo "not found" >&6; }
-
-
+  link_thread="no"
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-        ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-                                if test "$expat_header_found" = "yes"; then
 
-            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Expat XML Parser libraries" >&5
-$as_echo_n "checking for Expat XML Parser libraries... " >&6; }
-
-            ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+  				done
+                fi
 
-            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+            else
+               for ax_lib in $ax_boost_user_thread_lib boost_thread-$ax_boost_user_thread_lib; do
+				      as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5
+$as_echo_n "checking for exit in -l$ax_lib... " >&6; }
+if eval "test \"\${$as_ac_Lib+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$ax_lib  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-
-#include <expat.h>
-
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char exit ();
 int
 main ()
 {
-
-XML_Parser p = XML_ParserCreate(NULL);
-XML_ParserFree(p);
-p = NULL;
-
-
+return exit ();
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_cxx_try_link "$LINENO"; then :
-
-                EXPAT_LIBS="$expat_lib_flags"
-                EXPAT_LDFLAGS="$expat_ld_flags"
-                expat_lib_found="yes"
-                { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5
-$as_echo "found" >&6; }
-
+if ac_fn_c_try_link "$LINENO"; then :
+  eval "$as_ac_Lib=yes"
 else
-
-                expat_lib_found="no"
-                { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
-$as_echo "not found" >&6; }
-
-
+  eval "$as_ac_Lib=no"
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-            ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-        fi
-
-        CPPFLAGS="$saved_CPPFLAGS"
-        LDFLAGS="$saved_LDFLAGS"
-        LIBS="$saved_LIBS"
-    fi
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Expat XML Parser" >&5
-$as_echo_n "checking for Expat XML Parser... " >&6; }
-
-    if test "$run_expat_test" = "yes"; then
-        if test "$expat_header_found" = "yes" -a "$expat_lib_found" = "yes"; then
-
-
-
-
-
-            HAVE_EXPAT="yes"
-        else
-            HAVE_EXPAT="no"
-        fi
-
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAVE_EXPAT" >&5
-$as_echo "$HAVE_EXPAT" >&6; }
-
-                                if test "$HAVE_EXPAT" = "yes"; then
-
-            expat_version_req=
-
-            if test  -n "$expat_version_req"; then
-
-                { $as_echo "$as_me:${as_lineno-$LINENO}: checking if Expat XML Parser version is >= $expat_version_req" >&5
-$as_echo_n "checking if Expat XML Parser version is >= $expat_version_req... " >&6; }
-
-                if test -f "$expat_include_dir/expat.h"; then
-
-                    expat_major=`cat $expat_include_dir/expat.h | \
-                                    grep '^#define.*XML_MAJOR_VERSION.*[0-9]$' | \
-                                    sed -e 's/#define XML_MAJOR_VERSION.//'`
-
-                    expat_minor=`cat $expat_include_dir/expat.h | \
-                                    grep '^#define.*XML_MINOR_VERSION.*[0-9]$' | \
-                                    sed -e 's/#define XML_MINOR_VERSION.//'`
-
-                    expat_revision=`cat $expat_include_dir/expat.h | \
-                                    grep '^#define.*XML_MICRO_VERSION.*[0-9]$' | \
-                                    sed -e 's/#define XML_MICRO_VERSION.//'`
+LIBS=$ac_check_lib_save_LIBS
+fi
+eval ac_res=\$$as_ac_Lib
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+  BOOST_THREAD_LIB="-l$ax_lib";  link_thread="yes"; break
+else
+  link_thread="no"
+fi
 
-                    EXPAT_VERSION="$expat_major.$expat_minor.$expat_revision"
+                  done
 
+            fi
+			if test "x$link_thread" = "xno"; then
+				as_fn_error $? "Could not link against $ax_lib !" "$LINENO" 5
+                        else
+                           case "x$build_os" in
+                              *bsd* )
+			        BOOST_LDFLAGS="-pthread $BOOST_LDFLAGS"
+                              break;
+                              ;;
+                           esac
 
-                                        expat_version_req_major=`expr $expat_version_req : '\([0-9]*\)'`
-                    expat_version_req_minor=`expr $expat_version_req : '[0-9]*\.\([0-9]*\)'`
-                    expat_version_req_revision=`expr $expat_version_req : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
-                    if test "x$expat_version_req_revision" = "x"; then
-                        expat_version_req_revision="0"
-                    fi
+			fi
+		fi
 
-                    expat_version_req_number=`expr $expat_version_req_major \* 10000 \
-                                               \+ $expat_version_req_minor \* 100 \
-                                               \+ $expat_version_req_revision`
+		CPPFLAGS="$CPPFLAGS_SAVED"
+    	LDFLAGS="$LDFLAGS_SAVED"
+	fi
 
-                                        expat_version_number=`expr $expat_major \* 10000 \
-                                          \+ $expat_minor \* 100 \
-                                           \+ $expat_revision`
 
-                    expat_version_check=`expr $expat_version_number \>\= $expat_version_req_number`
-                    if test "$expat_version_check" = "1"; then
-                        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-                    else
-                        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-                        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Found Expat XML Parser $EXPAT_VERSION, which is older than required. Possible compilation failure." >&5
-$as_echo "$as_me: WARNING: Found Expat XML Parser $EXPAT_VERSION, which is older than required. Possible compilation failure." >&2;}
-                    fi
-                else
-                    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-                    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Missing expat.h header. Unable to determine Expat version." >&5
-$as_echo "$as_me: WARNING: Missing expat.h header. Unable to determine Expat version." >&2;}
-                fi
-            fi
-        fi
+echo
+echo "+++++++++++++++++++++++++++++++++++++"
+echo " BOOST_CPPFLAGS:    ${BOOST_CPPFLAGS}"
+echo " BOOST LDFLAGS:     ${BOOST_LDFLAGS}"
+echo " ac_boost_path:     ${ac_boost_path}"
+echo " ac_boost_lib_path: ${ac_boost_lib_path}"
+echo " BOOST_THREAD_LIB:  ${BOOST_THREAD_LIB}"
+echo "CFLAGS now: ${CFLAGS}"
+echo "CXXFLAGS now: ${CXXFLAGS}"
+echo "LDFLAGS now: ${LDFLAGS}"
+echo "+++++++++++++++++++++++++++++++++++++"
 
-    else
-        HAVE_EXPAT="no"
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAVE_EXPAT" >&5
-$as_echo "$HAVE_EXPAT" >&6; }
+if test "${BOOST_THREAD_LIB}" = "" ; then
+  echo "Automatic recognition of Boost thread lib failed? I have"
+  echo "////// BOOST_CPPFLAGS:    ${BOOST_CPPFLAGS}"
+  echo "////// BOOST LDFLAGS:     ${BOOST_LDFLAGS}"
+  echo "////// ac_boost_path:     ${ac_boost_path}"
+  echo "////// ac_boost_lib_path: ${ac_boost_lib_path}"
+  echo "////// BOOST_THREAD_LIB:  ${BOOST_THREAD_LIB}"
+  echo "////// BOOST_ROOT:        ${BOOST_ROOT}"
 
-        if test "$expat_requested" = "yes"; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Expat XML Parser support requested but headers or library not found. Specify valid prefix of Expat using --with-expat=[DIR] or provide include directory and linker flags using --with-expat-inc and --with-expat-lib" >&5
-$as_echo "$as_me: WARNING: Expat XML Parser support requested but headers or library not found. Specify valid prefix of Expat using --with-expat=[DIR] or provide include directory and linker flags using --with-expat-inc and --with-expat-lib" >&2;}
-        fi
-    fi
+  case "${BOOST_LDFLAGS}" in
+    *stage* )
+    	 isstaged="yes"
+    break;
+    ;;
+  esac
 
-if test "${HAVE_EXPAT}" = "yes"; then
-  CFLAGS="$CFLAGS ${EXPAT_CFLAGS}"
-  CXXFLAGS="$CXXFLAGS ${EXPAT_CFLAGS}"
-  LDFLAGS="${LDFLAGS} ${EXPAT_LDFLAGS}"
-  LIBS="${LIBS} ${EXPAT_LIBS}"
+  if test "${isstaged}" = "yes" ; then
+      echo
+      echo
+      echo "You seem to have a staged BOOST."
+      echo
+      if test "${BOOST_ROOT}" = "" ; then
+	  echo "Please set \$BOOST_ROOT in your environment (via export or setenv, depending"
+	  echo "on your shell) to the directory with the staged boost."
+	  echo "E.g.: export BOOST_ROOT=\"/path/to/boost_1_39_0\""
+      else
+	  echo "You set \$BOOST_ROOT to: ${BOOST_ROOT}"
+	  echo "Maybe this is not correct?"
+	  echo
+	  echo "If it is correct, please do not use a staged BOOST but a fully"
+  	  echo "installed one. Apparently, using a staged BOOST does not work"
+	  echo "on your system (sorry)."
+      fi
+  else
+      echo "Please give the configure script the location of your BOOST"
+      echo " libraries. Or, if needed, the name of your thread library (without"
+      echo " 'lib' in front):"
+      echo "   --with-boost=DIR"
+      echo "or --with-boost-libdir=LIB_DIR"
+      echo "or --with-boost-thread=special-lib"
+  fi
+  echo
+  as_fn_error $? "Stopping here as BOOST thread lib must be available at this stage. Sorry." "$LINENO" 5
 fi
 
+CXXFLAGS="${CXXFLAGS} ${BOOST_CPPFLAGS}"
+LDFLAGS="${LDFLAGS} ${BOOST_LDFLAGS} ${BOOST_THREAD_LIB}"
 
-echo
 echo "+++++++++++++++++++++++++++++++++++++"
+echo " BOOST_CPPFLAGS:    ${BOOST_CPPFLAGS}"
+echo " BOOST LDFLAGS:     ${BOOST_LDFLAGS}"
+echo " ac_boost_path:     ${ac_boost_path}"
+echo " ac_boost_lib_path: ${ac_boost_lib_path}"
+echo " BOOST_THREAD_LIB:  ${BOOST_THREAD_LIB}"
+echo
 echo "CFLAGS now: ${CFLAGS}"
 echo "CXXFLAGS now: ${CXXFLAGS}"
 echo "LDFLAGS now: ${LDFLAGS}"
-echo "LIBS now: ${LIBS}"
 echo "+++++++++++++++++++++++++++++++++++++"
 
-# check for zlib
-#
-# Handle user hints
-#
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if zlib is wanted" >&5
-$as_echo_n "checking if zlib is wanted... " >&6; }
 
-# Check whether --with-zlib was given.
-if test "${with_zlib+set}" = set; then :
-  withval=$with_zlib; if test "$withval" != no ; then
-  zlib_places="/usr/local /usr /opt/local /sw"
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-  if test -d "$withval"
-  then
-    zlib_places="$withval $zlib_places"
-  else
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Sorry, $withval does not exist, checking usual places" >&5
-$as_echo "$as_me: WARNING: Sorry, $withval does not exist, checking usual places" >&2;}
-  fi
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
+
+
+# Check whether --with-boost-regex was given.
+if test "${with_boost_regex+set}" = set; then :
+  withval=$with_boost_regex;
+        if test "$withval" = "no"; then
+			want_boost="no"
+        elif test "$withval" = "yes"; then
+            want_boost="yes"
+            ax_boost_user_regex_lib=""
+        else
+		    want_boost="yes"
+        	ax_boost_user_regex_lib="$withval"
+		fi
+
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-fi
+  want_boost="yes"
 
+fi
 
-#
-# Locate zlib, if wanted
-#
-if test -n "${zlib_places}"
-then
-	# check the user supplied or any other more or less 'standard' place:
-	#   Most UNIX systems      : /usr/local and /usr
-	#   MacPorts / Fink on OSX : /opt/local respectively /sw
-	for ZLIB_HOME in ${zlib_places} ; do
-	  if test -f "${ZLIB_HOME}/include/zlib.h"; then break; fi
-	  ZLIB_HOME=""
-	done
 
-	# if zlib.h was nowhere to be found, give a notice and bail out
-	if test ! -n "${ZLIB_HOME}"; then
-          as_fn_error $? "No zlib.h in any include directory of ${zlib_places}: either specify a valid zlib installation with --with-zlib=DIR or disable zlib usage with --without-zlib" "$LINENO" 5
-	fi
+	if test "x$want_boost" = "xyes"; then
 
-        ZLIB_OLD_LDFLAGS=$LDFLAGS
-        ZLIB_OLD_CPPFLAGS=$LDFLAGS
-        LDFLAGS="$LDFLAGS -L${ZLIB_HOME}/lib"
-        CPPFLAGS="$CPPFLAGS -I${ZLIB_HOME}/include"
+		CPPFLAGS_SAVED="$CPPFLAGS"
+		CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
+		export CPPFLAGS
 
-        ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
+		LDFLAGS_SAVED="$LDFLAGS"
+		LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
+		export LDFLAGS
 
-        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inflateEnd in -lz" >&5
-$as_echo_n "checking for inflateEnd in -lz... " >&6; }
-if ${ac_cv_lib_z_inflateEnd+:} false; then :
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the Boost::Regex library is available" >&5
+$as_echo_n "checking whether the Boost::Regex library is available... " >&6; }
+if test "${ax_cv_boost_regex+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lz  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+			 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
+#include <boost/regex.hpp>
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char inflateEnd ();
 int
 main ()
 {
-return inflateEnd ();
+boost::regex r(); return 0;
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_z_inflateEnd=yes
-else
-  ac_cv_lib_z_inflateEnd=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_inflateEnd" >&5
-$as_echo "$ac_cv_lib_z_inflateEnd" >&6; }
-if test "x$ac_cv_lib_z_inflateEnd" = xyes; then :
-  zlib_cv_libz=yes
-else
-  zlib_cv_libz=no
-fi
-
-        ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default"
-if test "x$ac_cv_header_zlib_h" = xyes; then :
-  zlib_cv_zlib_h=yes
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ax_cv_boost_regex=yes
 else
-  zlib_cv_zlib_h=no
+  ax_cv_boost_regex=no
 fi
-
-
-        ac_ext=c
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+         ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-        if test "$zlib_cv_libz" = "yes" -a "$zlib_cv_zlib_h" = "yes"
-        then
-                #
-                # If both library and header were found, use them
-                #
-                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inflateEnd in -lz" >&5
-$as_echo_n "checking for inflateEnd in -lz... " >&6; }
-if ${ac_cv_lib_z_inflateEnd+:} false; then :
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_boost_regex" >&5
+$as_echo "$ax_cv_boost_regex" >&6; }
+		if test "x$ax_cv_boost_regex" = "xyes"; then
+
+$as_echo "#define HAVE_BOOST_REGEX /**/" >>confdefs.h
+
+            BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/[^\/]*//'`
+            if test "x$ax_boost_user_regex_lib" = "x"; then
+                for libextension in `ls $BOOSTLIBDIR/libboost_regex*.{so,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_regex.*\)\.so.*$;\1;' -e 's;^lib\(boost_regex.*\)\.a*$;\1;'` ; do
+                     ax_lib=${libextension}
+				    as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5
+$as_echo_n "checking for exit in -l$ax_lib... " >&6; }
+if eval "test \"\${$as_ac_Lib+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lz  $LIBS"
+LIBS="-l$ax_lib  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -19457,78 +18066,45 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char inflateEnd ();
+char exit ();
 int
 main ()
 {
-return inflateEnd ();
+return exit ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_z_inflateEnd=yes
+  eval "$as_ac_Lib=yes"
 else
-  ac_cv_lib_z_inflateEnd=no
+  eval "$as_ac_Lib=no"
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_inflateEnd" >&5
-$as_echo "$ac_cv_lib_z_inflateEnd" >&6; }
-if test "x$ac_cv_lib_z_inflateEnd" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBZ 1
-_ACEOF
-
-  LIBS="-lz $LIBS"
-
-fi
-
-                { $as_echo "$as_me:${as_lineno-$LINENO}: checking zlib in ${ZLIB_HOME}" >&5
-$as_echo_n "checking zlib in ${ZLIB_HOME}... " >&6; }
-                { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
-$as_echo "ok" >&6; }
-        else
-                #
-                # If either header or library was not found, revert and bomb
-                #
-                { $as_echo "$as_me:${as_lineno-$LINENO}: checking zlib in ${ZLIB_HOME}" >&5
-$as_echo_n "checking zlib in ${ZLIB_HOME}... " >&6; }
-                LDFLAGS="$ZLIB_OLD_LDFLAGS"
-                CPPFLAGS="$ZLIB_OLD_CPPFLAGS"
-                { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
-$as_echo "failed" >&6; }
-                as_fn_error $? "either specify a valid zlib installation with --with-zlib=DIR or disable zlib usage with --without-zlib" "$LINENO" 5
-        fi
+eval ac_res=\$$as_ac_Lib
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+  BOOST_REGEX_LIB="-l$ax_lib";  link_regex="yes"; break
+else
+  link_regex="no"
 fi
 
-
-LIBS="${LIBS} -lm -lz"
-
-echo
-echo "+++++++++++++++++++++++++++++++++++++"
-echo "CFLAGS now: ${CFLAGS}"
-echo "CXXFLAGS now: ${CXXFLAGS}"
-echo "LDFLAGS now: ${LDFLAGS}"
-echo "LIBS now: ${LIBS}"
-echo "+++++++++++++++++++++++++++++++++++++"
-
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gzoffset in -lz" >&5
-$as_echo_n "checking for gzoffset in -lz... " >&6; }
-if ${ac_cv_lib_z_gzoffset+:} false; then :
+  				done
+                if test "x$link_regex" != "xyes"; then
+                for libextension in `ls $BOOSTLIBDIR/boost_regex*.{dll,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_regex.*\)\.dll.*$;\1;' -e 's;^\(boost_regex.*\)\.a*$;\1;'` ; do
+                     ax_lib=${libextension}
+				    as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5
+$as_echo_n "checking for exit in -l$ax_lib... " >&6; }
+if eval "test \"\${$as_ac_Lib+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lz  $LIBS"
+LIBS="-l$ax_lib  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -19538,96 +18114,105 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char gzoffset ();
+char exit ();
 int
 main ()
 {
-return gzoffset ();
+return exit ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_z_gzoffset=yes
+  eval "$as_ac_Lib=yes"
 else
-  ac_cv_lib_z_gzoffset=no
+  eval "$as_ac_Lib=no"
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_gzoffset" >&5
-$as_echo "$ac_cv_lib_z_gzoffset" >&6; }
-if test "x$ac_cv_lib_z_gzoffset" = xyes; then :
-  zlib_havegzoffset=yes
+eval ac_res=\$$as_ac_Lib
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+  BOOST_REGEX_LIB="-l$ax_lib";  link_regex="yes"; break
 else
-  zlib_havegzoffset=no
+  link_regex="no"
 fi
 
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-if test "$zlib_havegzoffset" = "yes"; then
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_GZOFFSET 1
-_ACEOF
-
-fi
+  				done
+                fi
 
-have_bz2="no"
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BZ2_bzRead in -lbz2" >&5
-$as_echo_n "checking for BZ2_bzRead in -lbz2... " >&6; }
-if ${ac_cv_lib_bz2_BZ2_bzRead+:} false; then :
+            else
+               for ax_lib in $ax_boost_user_regex_lib boost_regex-$ax_boost_user_regex_lib; do
+				      as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_main" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -l$ax_lib" >&5
+$as_echo_n "checking for main in -l$ax_lib... " >&6; }
+if eval "test \"\${$as_ac_Lib+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lbz2  $LIBS"
+LIBS="-l$ax_lib  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char BZ2_bzRead ();
+
 int
 main ()
 {
-return BZ2_bzRead ();
+return main ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_bz2_BZ2_bzRead=yes
+  eval "$as_ac_Lib=yes"
 else
-  ac_cv_lib_bz2_BZ2_bzRead=no
+  eval "$as_ac_Lib=no"
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bz2_BZ2_bzRead" >&5
-$as_echo "$ac_cv_lib_bz2_BZ2_bzRead" >&6; }
-if test "x$ac_cv_lib_bz2_BZ2_bzRead" = xyes; then :
-  have_bz2="yes"
+eval ac_res=\$$as_ac_Lib
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+  BOOST_REGEX_LIB="-l$ax_lib";  link_regex="yes"; break
+else
+  link_regex="no"
 fi
 
+               done
+            fi
+			if test "x$link_regex" != "xyes"; then
+				as_fn_error $? "Could not link against $ax_lib !" "$LINENO" 5
+			fi
+		fi
+
+		CPPFLAGS="$CPPFLAGS_SAVED"
+    	LDFLAGS="$LDFLAGS_SAVED"
+	fi
+
 
-if test "${have_bz2}" = "yes"; then
-  LIBS="${LIBS} -lbz2"
-fi
+echo "+++++++++++++++++++++++++++++++++++++"
+echo " BOOST_CPPFLAGS:    ${BOOST_CPPFLAGS}"
+echo " BOOST LDFLAGS:     ${BOOST_LDFLAGS}"
+echo " ac_boost_path:     ${ac_boost_path}"
+echo " ac_boost_lib_path: ${ac_boost_lib_path}"
+echo " BOOST_REGEX_LIB:   ${BOOST_REGEX_LIB}"
+echo
+
+LDFLAGS="${LDFLAGS} ${BOOST_REGEX_LIB}"
+
+echo "CFLAGS now: ${CFLAGS}"
+echo "CXXFLAGS now: ${CXXFLAGS}"
+echo "LDFLAGS now: ${LDFLAGS}"
+echo "+++++++++++++++++++++++++++++++++++++"
 
-#ZLIB_VERSION=`$EGREP "define ZLIB_VERSION" $ZLIB_HOME/include/zlib.h | $SED -e 's/[[^0-9\.]]//g'`
-#AC_MSG_RESULT([$ZLIB_VERSION])
 
 # ---------------------------------------------------------------------------
-# check for lex/flex version
 # ---------------------------------------------------------------------------
 flexgoodversion="unknown"
 if test "${LEX}" = "flex"; then
@@ -19678,8 +18263,6 @@ fi
 
 
 # ---------------------------------------------------------------------------
-# Set flag whether building environment is known to work
-# Additionally, if special things are needed, set them here.
 # ---------------------------------------------------------------------------
 buildenvworks="unknown"
 if test "${systemuname}" = "Darwin"; then
@@ -19698,7 +18281,6 @@ fi
 
 
 
-# Test if --enable-debug given
 # Check whether --enable-debug was given.
 if test "${enable_debug+set}" = set; then :
   enableval=$enable_debug;
@@ -19709,7 +18291,6 @@ if test "${enable_debug}" = "yes" ; then
   CXXFLAGS="$CXXFLAGS -g"
 fi
 
-# Test if --enable-cxxdebug given
 # Check whether --enable-cxxdebug was given.
 if test "${enable_cxxdebug+set}" = set; then :
   enableval=$enable_cxxdebug;
@@ -19720,109 +18301,40 @@ if test "${enable_cxxdebug}" = "yes" ; then
   # CXXFLAGS="$CXXFLAGS -D_GLIBCXX_DEBUG"
 fi
 
-
-
-# Test if --enable-profile given
 # Check whether --enable-profile was given.
 if test "${enable_profile+set}" = set; then :
   enableval=$enable_profile;
 fi
 
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for profiling settings" >&5
-$as_echo_n "checking for profiling settings... " >&6; }
 if test "${enable_profile}" = "yes" ; then
   CFLAGS="$CFLAGS -pg"
   CXXFLAGS="$CXXFLAGS -pg"
   LDFLAGS="${LDFLAGS} -pg"
-else
-  enable_profile="no"
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${enable_profile}" >&5
-$as_echo "${enable_profile}" >&6; }
-
-## -flto (link-time-optimiser) for gcc
-## not always supported yet, does not work well will -pg
-## therefore enable it only if -pg not used
-#if test $bachCCOMPILER = gcc; then
-#  if test "${enable_profile}" != "yes" ; then
-#    AC_MSG_CHECKING(for using gcc -flto)
-#    canuseflto="no";
-#    oldCFLAGS="$CFLAGS"
-#    CFLAGS="$CFLAGS -flto"
-#    AC_TRY_COMPILE(, [return 0;], [canuseflto="yes"],)
-#    CFLAGS="$oldCFLAGS"
-#    AC_MSG_RESULT(${canuseflto})
-#    if test "${canuseflto}" = "yes" ; then
-#      CFLAGS="$CFLAGS -flto"
-#      CXXFLAGS="$CXXFLAGS -flto"
-#    fi
-#  fi
-#fi
-
-
-
-# Turn off irritating linker warnings in IRIX
+fi
+
 if test "${systemuname}" = "IRIX" || test "${systemuname}" = "IRIX64"; then
   CFLAGS="-Wl,-LD_MSG:off=85:off=84:off=16:off=134 $CFLAGS"
   CXXFLAGS="-Wl,-LD_MSG:off=85:off=84:off=16:off=134 $CXXFLAGS"
 fi
 
 
-# Test if --enable-warnings given
 # Check whether --enable-warnings was given.
 if test "${enable_warnings+set}" = set; then :
   enableval=$enable_warnings;
 fi
 
 if test "${enable_warnings}" = "yes" ; then
-  if test $bachCCOMPILER = gcc; then
-
-# that one pukes way too often with boost 1.50
-# -Wold-style-cast
-
-    CXXFLAGS="${CXXFLAGS} -W -Wstrict-prototypes -fdiagnostics-show-option -Wextra -Wshadow -fno-strict-aliasing -ansi -Wcast-align -Wcast-qual -Wchar-subscripts -Wpointer-arith -Wredundant-decls -Wwrite-strings -Woverloaded-virtual -Wsign-promo -Wformat -Wimplicit -Wmissing-braces -Wparentheses -Wswitch -Wswitch-default -Wswitch-enum -Wunused -Wfloat-equal -Wendif-labels -Wconversion -Wdisabled-optimization -Wsequence-point -Werror=unused-value"
-    CFLAGS="${CFLAGS} -W -Wstrict-prototypes -fno-strict-aliasing -Wextra -ansi -Wbad-function-cast -Wcast-align -Wcast-qual -Wchar-subscripts -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-prototypes -Wwrite-strings -Wformat -Wimplicit -Wmissing-braces -Wparentheses -Wswitch -Wswitch-default -Wswitch-enum -Wunused -Wfloat-equal -Wendif-labels -Wconversion -Wdisabled-optimization -Wsequence-point -Werror=unused-value"
-
-  fi
-fi
-
-
-if test $bachCCOMPILER = gcc; then
-  CXXFLAGS="${CXXFLAGS} -Werror=uninitialized -Werror=return-type -Werror=parentheses"
-  CFLAGS="${CFLAGS} -Werror=uninitialized -Werror=return-type "
-fi
-
-# unused values may be a problem (e.g. using == in an assignment)
-if test $bachCCOMPILER = gcc; then
-  CXXFLAGS="${CXXFLAGS} -Werror=unused-value"
-fi
-
-# OK, we're using C++11/14, makes life a whole lot easier
-case "${bachCCOMPILER=unknown}" in
-*gcc*)
-  CXXFLAGS="${CXXFLAGS} -std=c++14"
-;;
-*clang*)
-  CXXFLAGS="${CXXFLAGS} -std=c++14 -stdlib=libc++"
-;;
-*)
-  echo "The compiler is not GCC nor clang and I need a flag to enable at least C++11 standard, please contact the author!"
-  exit 100;
-;;
-esac
+  if test "$CC" = "gcc"; then
+    CXXFLAGS="${CXXFLAGS} -W -Wstrict-prototypes -fdiagnostics-show-option -Wextra -Wshadow -fno-strict-aliasing -ansi -Wcast-align -Wcast-qual -Wchar-subscripts -Wpointer-arith -Wredundant-decls -Wwrite-strings -Wold-style-cast -Woverloaded-virtual -Wsign-promo -Wformat -Wimplicit -Wmissing-braces -Wparentheses -Wreturn-type -Wswitch -Wswitch-default -Wswitch-enum -Wunused -Wfloat-equal -Wendif-labels -Wconversion -Wdisabled-optimization -Wsequence-point -Werror=unused-value"
+    CFLAGS="${CFLAGS} -W -Wstrict-prototypes -fno-strict-aliasing -Wextra -ansi -Wbad-function-cast -Wcast-align -Wcast-qual -Wchar-subscripts -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-prototypes -Wwrite-strings -Wformat -Wimplicit -Wmissing-braces -Wparentheses -Wreturn-type -Wswitch -Wswitch-default -Wswitch-enum -Wunused -Wfloat-equal -Wendif-labels -Wconversion -Wdisabled-optimization -Wsequence-point -Werror=unused-value"
 
-# hack for CygWin/gcc where mktmpnam and a couple of others are not impolemented in strict ansi
-# and -std=c++11 implies strict ansi
-if test $bachCCOMPILER = gcc; then
-  if test $build_os = cygwin ; then
-    CFLAGS="${CFLAGS} -U__STRICT_ANSI__"
-    CXXFLAGS="${CXXFLAGS} -U__STRICT_ANSI__"
+    if test "${enable_optimisations}" = "yes" ; then
+      CXXFLAGS="${CXXFLAGS} -Werror=uninitialized"
+      CFLAGS="${CFLAGS} -Werror=uninitialized"
+    fi
   fi
 fi
 
-# Test if purify exists and if --enable-purify given if so
-# set "-g"
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for purify" >&5
 $as_echo_n "checking for purify... " >&6; }
 # Check whether --enable-purify was given.
@@ -19839,9 +18351,7 @@ else
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
-# end of test for purify
 
-# Set extra needed compiler flags
 if test "$CC" = "cc"; then
   case "$host" in
     alpha*-dec-osf*) CFLAGS="$CFLAGS -ieee";
@@ -19863,19 +18373,29 @@ fi
 # TCMalloc check from Google perftools package
 # ---------------------------------------------------------------------------
 
-tcmdefault="no"
+
+tcmdefault="yes"
 if test "${systemuname}" = "Darwin"; then
   tcmdefault="no"
 fi
 
-# make old calls using tcmalloc fail
-#AC_ARG_WITH(tcmalloc,
-#	[  --with-tcmalloc         Use tcmalloc memory allocation library. ],
-#	[ ], [ with_tcmalloc=${tcmdefault} ])
-#
-#AC_ARG_WITH(tcmalloc-dir,
-#	[  --with-tcmalloc-dir=LIB_DIR     search static tcmalloc library there. ],
-#	[ tcmalloc_dir=$withval], [ tcmalloc_dir=""])
+
+# Check whether --with-tcmalloc was given.
+if test "${with_tcmalloc+set}" = set; then :
+  withval=$with_tcmalloc;
+else
+   with_tcmalloc=${tcmdefault}
+fi
+
+
+
+# Check whether --with-tcmalloc-dir was given.
+if test "${with_tcmalloc_dir+set}" = set; then :
+  withval=$with_tcmalloc_dir;  tcmalloc_dir=$withval
+else
+   tcmalloc_dir=""
+fi
+
 
 linkwith_tcmalloc="no"
 
@@ -19932,8 +18452,7 @@ $as_echo "yes" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
-          LIBS=$OLD_LIBS; # reset to old value since XXX was not found
-          HAVE_TCMALLOC="no";
+          LIBS=$OLD_LIBS;           HAVE_TCMALLOC="no";
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
@@ -19952,6 +18471,9 @@ fi
 
 
 
+
+
+
 # ---------------------------------------------------------------------------
 # MIRA specific flags and settings
 # ---------------------------------------------------------------------------
@@ -19978,6 +18500,38 @@ fi
 $as_echo "$publicquietmira" >&6; }
 
 
+# development mode may have extra output on stdout
+#  as well as some additional data in the results which should not appear
+#  in real world data
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mira should compile a development version" >&5
+$as_echo_n "checking whether mira should compile a development version... " >&6; }
+#def_developmentversion="yes"
+def_developmentversion="no"
+# Check whether --enable-developmentversion was given.
+if test "${enable_developmentversion+set}" = set; then :
+  enableval=$enable_developmentversion; developmentversion=$enableval
+else
+  developmentversion=$def_developmentversion
+fi
+
+if test "$developmentversion" = "no"; then
+   cat >>confdefs.h <<_ACEOF
+#define DEVELOPMENTVERSION 0
+_ACEOF
+
+   SHORTMIRAAUDIENCE="prod"
+
+else
+   cat >>confdefs.h <<_ACEOF
+#define DEVELOPMENTVERSION 1
+_ACEOF
+
+   SHORTMIRAAUDIENCE="dev"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $developmentversion" >&5
+$as_echo "$developmentversion" >&6; }
+
 
 # compiles in some basic checks into mira that look for sanity within
 #  some functions
@@ -20074,23 +18628,6 @@ fi
 $as_echo "$functrace" >&6; }
 
 
-# Check whether --enable-miramemorc was given.
-if test "${enable_miramemorc+set}" = set; then :
-  enableval=$enable_miramemorc;
-fi
-
- if test x$enable_miramemorc = xyes; then
-  BUILDMIRAMEMORC_TRUE=
-  BUILDMIRAMEMORC_FALSE='#'
-else
-  BUILDMIRAMEMORC_TRUE='#'
-  BUILDMIRAMEMORC_FALSE=
-fi
-
-
-if test "$enable_miramemorc" = "yes"; then
-   CXXFLAGS="-DMIRAMEMORC ${CXXFLAGS}"
-fi
 
 
 # -Winline -Wmissing-noreturn???
@@ -20118,7 +18655,7 @@ fi
 #AC_CONFIG_FILES([Makefile])
 
 
-ac_config_files="$ac_config_files Makefile src/Makefile src/stdinc/Makefile src/debuggersupport/Makefile src/memorc/Makefile src/errorhandling/Makefile src/util/Makefile src/io/Makefile src/mira/Makefile src/caf/Makefile src/support/Makefile src/scripts/Makefile src/modules/Makefile src/progs/Makefile doc/Makefile doc/docbook/Makefile distribution/Makefile"
+ac_config_files="$ac_config_files Makefile src/Makefile src/stdinc/Makefile src/lec/Makefile src/errorhandling/Makefile src/util/Makefile src/io/Makefile src/mira/Makefile src/EdIt/Makefile src/caf/Makefile src/examine/Makefile src/knn_abi373/Makefile src/knn_alf/Makefile src/support/Makefile src/scripts/Makefile src/test/Makefile src/test/io/Makefile src/test/io/scf/Makefile src/test/io/fasta/Makefile src/test/io/generalio/Makefile src/test/mira/Makefile src/test/mira/align/Makefile src [...]
 
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -20184,21 +18721,10 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
      :end' >>confcache
 if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
   if test -w "$cache_file"; then
-    if test "x$cache_file" != "x/dev/null"; then
+    test "x$cache_file" != "x/dev/null" &&
       { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
 $as_echo "$as_me: updating cache $cache_file" >&6;}
-      if test ! -f "$cache_file" || test -h "$cache_file"; then
-	cat confcache >"$cache_file"
-      else
-        case $cache_file in #(
-        */* | ?:*)
-	  mv -f confcache "$cache_file"$$ &&
-	  mv -f "$cache_file"$$ "$cache_file" ;; #(
-        *)
-	  mv -f confcache "$cache_file" ;;
-	esac
-      fi
-    fi
+    cat confcache >$cache_file
   else
     { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
@@ -20289,16 +18815,16 @@ if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
   as_fn_error $? "conditional \"am__fastdepCXX\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-if test -z "${PURIFY_TRUE}" && test -z "${PURIFY_FALSE}"; then
-  as_fn_error $? "conditional \"PURIFY\" was never defined.
+if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
+  as_fn_error $? "conditional \"am__fastdepCXX\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-if test -z "${BUILDMIRAMEMORC_TRUE}" && test -z "${BUILDMIRAMEMORC_FALSE}"; then
-  as_fn_error $? "conditional \"BUILDMIRAMEMORC\" was never defined.
+if test -z "${PURIFY_TRUE}" && test -z "${PURIFY_FALSE}"; then
+  as_fn_error $? "conditional \"PURIFY\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 
-: "${CONFIG_STATUS=./config.status}"
+: ${CONFIG_STATUS=./config.status}
 ac_write_fail=0
 ac_clean_files_save=$ac_clean_files
 ac_clean_files="$ac_clean_files $CONFIG_STATUS"
@@ -20399,7 +18925,6 @@ fi
 IFS=" ""	$as_nl"
 
 # Find who we are.  Look in the path if we contain no directory separator.
-as_myself=
 case $0 in #((
   *[\\/]* ) as_myself=$0 ;;
   *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -20706,8 +19231,8 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by mira $as_me 4.9.5, which was
-generated by GNU Autoconf 2.68.  Invocation command line was
+This file was extended by mira $as_me 3.4.0, which was
+generated by GNU Autoconf 2.67.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
@@ -20763,8 +19288,8 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-mira config.status 4.9.5
-configured by $0, generated by GNU Autoconf 2.68,
+mira config.status 3.4.0
+configured by $0, generated by GNU Autoconf 2.67,
   with options \\"\$ac_cs_config\\"
 
 Copyright (C) 2010 Free Software Foundation, Inc.
@@ -20881,208 +19406,184 @@ AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
 sed_quote_subst='$sed_quote_subst'
 double_quote_subst='$double_quote_subst'
 delay_variable_subst='$delay_variable_subst'
-macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`'
-macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`'
-enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`'
-enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`'
-pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`'
-enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`'
-SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`'
-ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`'
-PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`'
-host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`'
-host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`'
-host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`'
-build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`'
-build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`'
-build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`'
-SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`'
-Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`'
-GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`'
-EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`'
-FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`'
-LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`'
-NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`'
-LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`'
-max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`'
-ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`'
-exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`'
-lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`'
-lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`'
-lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`'
-lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`'
-lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`'
-reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`'
-reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`'
-OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`'
-deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`'
-file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`'
-file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`'
-want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`'
-DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`'
-sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`'
-AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`'
-AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`'
-archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`'
-STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`'
-RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`'
-old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`'
-old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
-old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`'
-lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`'
-CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`'
-CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`'
-compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`'
-GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`'
-lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`'
-lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`'
-lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`'
-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`'
-nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`'
-lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`'
-objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`'
-MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`'
-lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`'
-lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`'
-lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`'
-lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`'
-lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`'
-need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`'
-MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`'
-DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`'
-NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`'
-LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`'
-OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`'
-OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`'
-libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`'
-shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`'
-extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
-archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`'
-enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`'
-export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`'
-whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`'
-compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`'
-old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`'
-old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
-archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`'
-archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`'
-module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`'
-module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`'
-with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`'
-allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`'
-no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`'
-hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`'
-hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`'
-hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`'
-hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`'
-hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`'
-hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`'
-hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`'
-inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`'
-link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`'
-always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`'
-export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`'
-exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`'
-include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`'
-prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`'
-postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`'
-file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`'
-variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`'
-need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`'
-need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`'
-version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`'
-runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`'
-shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`'
-shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`'
-libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`'
-library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`'
-soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`'
-install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`'
-postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`'
-postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
-finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`'
-finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`'
-hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`'
-sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`'
-sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`'
-hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`'
-enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`'
-enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`'
-enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`'
-old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`'
-striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`'
-compiler_lib_search_dirs='`$ECHO "$compiler_lib_search_dirs" | $SED "$delay_single_quote_subst"`'
-predep_objects='`$ECHO "$predep_objects" | $SED "$delay_single_quote_subst"`'
-postdep_objects='`$ECHO "$postdep_objects" | $SED "$delay_single_quote_subst"`'
-predeps='`$ECHO "$predeps" | $SED "$delay_single_quote_subst"`'
-postdeps='`$ECHO "$postdeps" | $SED "$delay_single_quote_subst"`'
-compiler_lib_search_path='`$ECHO "$compiler_lib_search_path" | $SED "$delay_single_quote_subst"`'
-LD_CXX='`$ECHO "$LD_CXX" | $SED "$delay_single_quote_subst"`'
-reload_flag_CXX='`$ECHO "$reload_flag_CXX" | $SED "$delay_single_quote_subst"`'
-reload_cmds_CXX='`$ECHO "$reload_cmds_CXX" | $SED "$delay_single_quote_subst"`'
-old_archive_cmds_CXX='`$ECHO "$old_archive_cmds_CXX" | $SED "$delay_single_quote_subst"`'
-compiler_CXX='`$ECHO "$compiler_CXX" | $SED "$delay_single_quote_subst"`'
-GCC_CXX='`$ECHO "$GCC_CXX" | $SED "$delay_single_quote_subst"`'
-lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "$lt_prog_compiler_no_builtin_flag_CXX" | $SED "$delay_single_quote_subst"`'
-lt_prog_compiler_pic_CXX='`$ECHO "$lt_prog_compiler_pic_CXX" | $SED "$delay_single_quote_subst"`'
-lt_prog_compiler_wl_CXX='`$ECHO "$lt_prog_compiler_wl_CXX" | $SED "$delay_single_quote_subst"`'
-lt_prog_compiler_static_CXX='`$ECHO "$lt_prog_compiler_static_CXX" | $SED "$delay_single_quote_subst"`'
-lt_cv_prog_compiler_c_o_CXX='`$ECHO "$lt_cv_prog_compiler_c_o_CXX" | $SED "$delay_single_quote_subst"`'
-archive_cmds_need_lc_CXX='`$ECHO "$archive_cmds_need_lc_CXX" | $SED "$delay_single_quote_subst"`'
-enable_shared_with_static_runtimes_CXX='`$ECHO "$enable_shared_with_static_runtimes_CXX" | $SED "$delay_single_quote_subst"`'
-export_dynamic_flag_spec_CXX='`$ECHO "$export_dynamic_flag_spec_CXX" | $SED "$delay_single_quote_subst"`'
-whole_archive_flag_spec_CXX='`$ECHO "$whole_archive_flag_spec_CXX" | $SED "$delay_single_quote_subst"`'
-compiler_needs_object_CXX='`$ECHO "$compiler_needs_object_CXX" | $SED "$delay_single_quote_subst"`'
-old_archive_from_new_cmds_CXX='`$ECHO "$old_archive_from_new_cmds_CXX" | $SED "$delay_single_quote_subst"`'
-old_archive_from_expsyms_cmds_CXX='`$ECHO "$old_archive_from_expsyms_cmds_CXX" | $SED "$delay_single_quote_subst"`'
-archive_cmds_CXX='`$ECHO "$archive_cmds_CXX" | $SED "$delay_single_quote_subst"`'
-archive_expsym_cmds_CXX='`$ECHO "$archive_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`'
-module_cmds_CXX='`$ECHO "$module_cmds_CXX" | $SED "$delay_single_quote_subst"`'
-module_expsym_cmds_CXX='`$ECHO "$module_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`'
-with_gnu_ld_CXX='`$ECHO "$with_gnu_ld_CXX" | $SED "$delay_single_quote_subst"`'
-allow_undefined_flag_CXX='`$ECHO "$allow_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`'
-no_undefined_flag_CXX='`$ECHO "$no_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`'
-hardcode_libdir_flag_spec_CXX='`$ECHO "$hardcode_libdir_flag_spec_CXX" | $SED "$delay_single_quote_subst"`'
-hardcode_libdir_separator_CXX='`$ECHO "$hardcode_libdir_separator_CXX" | $SED "$delay_single_quote_subst"`'
-hardcode_direct_CXX='`$ECHO "$hardcode_direct_CXX" | $SED "$delay_single_quote_subst"`'
-hardcode_direct_absolute_CXX='`$ECHO "$hardcode_direct_absolute_CXX" | $SED "$delay_single_quote_subst"`'
-hardcode_minus_L_CXX='`$ECHO "$hardcode_minus_L_CXX" | $SED "$delay_single_quote_subst"`'
-hardcode_shlibpath_var_CXX='`$ECHO "$hardcode_shlibpath_var_CXX" | $SED "$delay_single_quote_subst"`'
-hardcode_automatic_CXX='`$ECHO "$hardcode_automatic_CXX" | $SED "$delay_single_quote_subst"`'
-inherit_rpath_CXX='`$ECHO "$inherit_rpath_CXX" | $SED "$delay_single_quote_subst"`'
-link_all_deplibs_CXX='`$ECHO "$link_all_deplibs_CXX" | $SED "$delay_single_quote_subst"`'
-always_export_symbols_CXX='`$ECHO "$always_export_symbols_CXX" | $SED "$delay_single_quote_subst"`'
-export_symbols_cmds_CXX='`$ECHO "$export_symbols_cmds_CXX" | $SED "$delay_single_quote_subst"`'
-exclude_expsyms_CXX='`$ECHO "$exclude_expsyms_CXX" | $SED "$delay_single_quote_subst"`'
-include_expsyms_CXX='`$ECHO "$include_expsyms_CXX" | $SED "$delay_single_quote_subst"`'
-prelink_cmds_CXX='`$ECHO "$prelink_cmds_CXX" | $SED "$delay_single_quote_subst"`'
-postlink_cmds_CXX='`$ECHO "$postlink_cmds_CXX" | $SED "$delay_single_quote_subst"`'
-file_list_spec_CXX='`$ECHO "$file_list_spec_CXX" | $SED "$delay_single_quote_subst"`'
-hardcode_action_CXX='`$ECHO "$hardcode_action_CXX" | $SED "$delay_single_quote_subst"`'
-compiler_lib_search_dirs_CXX='`$ECHO "$compiler_lib_search_dirs_CXX" | $SED "$delay_single_quote_subst"`'
-predep_objects_CXX='`$ECHO "$predep_objects_CXX" | $SED "$delay_single_quote_subst"`'
-postdep_objects_CXX='`$ECHO "$postdep_objects_CXX" | $SED "$delay_single_quote_subst"`'
-predeps_CXX='`$ECHO "$predeps_CXX" | $SED "$delay_single_quote_subst"`'
-postdeps_CXX='`$ECHO "$postdeps_CXX" | $SED "$delay_single_quote_subst"`'
-compiler_lib_search_path_CXX='`$ECHO "$compiler_lib_search_path_CXX" | $SED "$delay_single_quote_subst"`'
+macro_version='`$ECHO "X$macro_version" | $Xsed -e "$delay_single_quote_subst"`'
+macro_revision='`$ECHO "X$macro_revision" | $Xsed -e "$delay_single_quote_subst"`'
+enable_shared='`$ECHO "X$enable_shared" | $Xsed -e "$delay_single_quote_subst"`'
+enable_static='`$ECHO "X$enable_static" | $Xsed -e "$delay_single_quote_subst"`'
+pic_mode='`$ECHO "X$pic_mode" | $Xsed -e "$delay_single_quote_subst"`'
+enable_fast_install='`$ECHO "X$enable_fast_install" | $Xsed -e "$delay_single_quote_subst"`'
+host_alias='`$ECHO "X$host_alias" | $Xsed -e "$delay_single_quote_subst"`'
+host='`$ECHO "X$host" | $Xsed -e "$delay_single_quote_subst"`'
+host_os='`$ECHO "X$host_os" | $Xsed -e "$delay_single_quote_subst"`'
+build_alias='`$ECHO "X$build_alias" | $Xsed -e "$delay_single_quote_subst"`'
+build='`$ECHO "X$build" | $Xsed -e "$delay_single_quote_subst"`'
+build_os='`$ECHO "X$build_os" | $Xsed -e "$delay_single_quote_subst"`'
+SED='`$ECHO "X$SED" | $Xsed -e "$delay_single_quote_subst"`'
+Xsed='`$ECHO "X$Xsed" | $Xsed -e "$delay_single_quote_subst"`'
+GREP='`$ECHO "X$GREP" | $Xsed -e "$delay_single_quote_subst"`'
+EGREP='`$ECHO "X$EGREP" | $Xsed -e "$delay_single_quote_subst"`'
+FGREP='`$ECHO "X$FGREP" | $Xsed -e "$delay_single_quote_subst"`'
+LD='`$ECHO "X$LD" | $Xsed -e "$delay_single_quote_subst"`'
+NM='`$ECHO "X$NM" | $Xsed -e "$delay_single_quote_subst"`'
+LN_S='`$ECHO "X$LN_S" | $Xsed -e "$delay_single_quote_subst"`'
+max_cmd_len='`$ECHO "X$max_cmd_len" | $Xsed -e "$delay_single_quote_subst"`'
+ac_objext='`$ECHO "X$ac_objext" | $Xsed -e "$delay_single_quote_subst"`'
+exeext='`$ECHO "X$exeext" | $Xsed -e "$delay_single_quote_subst"`'
+lt_unset='`$ECHO "X$lt_unset" | $Xsed -e "$delay_single_quote_subst"`'
+lt_SP2NL='`$ECHO "X$lt_SP2NL" | $Xsed -e "$delay_single_quote_subst"`'
+lt_NL2SP='`$ECHO "X$lt_NL2SP" | $Xsed -e "$delay_single_quote_subst"`'
+reload_flag='`$ECHO "X$reload_flag" | $Xsed -e "$delay_single_quote_subst"`'
+reload_cmds='`$ECHO "X$reload_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+OBJDUMP='`$ECHO "X$OBJDUMP" | $Xsed -e "$delay_single_quote_subst"`'
+deplibs_check_method='`$ECHO "X$deplibs_check_method" | $Xsed -e "$delay_single_quote_subst"`'
+file_magic_cmd='`$ECHO "X$file_magic_cmd" | $Xsed -e "$delay_single_quote_subst"`'
+AR='`$ECHO "X$AR" | $Xsed -e "$delay_single_quote_subst"`'
+AR_FLAGS='`$ECHO "X$AR_FLAGS" | $Xsed -e "$delay_single_quote_subst"`'
+STRIP='`$ECHO "X$STRIP" | $Xsed -e "$delay_single_quote_subst"`'
+RANLIB='`$ECHO "X$RANLIB" | $Xsed -e "$delay_single_quote_subst"`'
+old_postinstall_cmds='`$ECHO "X$old_postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+old_postuninstall_cmds='`$ECHO "X$old_postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+old_archive_cmds='`$ECHO "X$old_archive_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+CC='`$ECHO "X$CC" | $Xsed -e "$delay_single_quote_subst"`'
+CFLAGS='`$ECHO "X$CFLAGS" | $Xsed -e "$delay_single_quote_subst"`'
+compiler='`$ECHO "X$compiler" | $Xsed -e "$delay_single_quote_subst"`'
+GCC='`$ECHO "X$GCC" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_pipe='`$ECHO "X$lt_cv_sys_global_symbol_pipe" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_cdecl='`$ECHO "X$lt_cv_sys_global_symbol_to_cdecl" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`'
+objdir='`$ECHO "X$objdir" | $Xsed -e "$delay_single_quote_subst"`'
+SHELL='`$ECHO "X$SHELL" | $Xsed -e "$delay_single_quote_subst"`'
+ECHO='`$ECHO "X$ECHO" | $Xsed -e "$delay_single_quote_subst"`'
+MAGIC_CMD='`$ECHO "X$MAGIC_CMD" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_no_builtin_flag='`$ECHO "X$lt_prog_compiler_no_builtin_flag" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_wl='`$ECHO "X$lt_prog_compiler_wl" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_pic='`$ECHO "X$lt_prog_compiler_pic" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_static='`$ECHO "X$lt_prog_compiler_static" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_prog_compiler_c_o='`$ECHO "X$lt_cv_prog_compiler_c_o" | $Xsed -e "$delay_single_quote_subst"`'
+need_locks='`$ECHO "X$need_locks" | $Xsed -e "$delay_single_quote_subst"`'
+DSYMUTIL='`$ECHO "X$DSYMUTIL" | $Xsed -e "$delay_single_quote_subst"`'
+NMEDIT='`$ECHO "X$NMEDIT" | $Xsed -e "$delay_single_quote_subst"`'
+LIPO='`$ECHO "X$LIPO" | $Xsed -e "$delay_single_quote_subst"`'
+OTOOL='`$ECHO "X$OTOOL" | $Xsed -e "$delay_single_quote_subst"`'
+OTOOL64='`$ECHO "X$OTOOL64" | $Xsed -e "$delay_single_quote_subst"`'
+libext='`$ECHO "X$libext" | $Xsed -e "$delay_single_quote_subst"`'
+shrext_cmds='`$ECHO "X$shrext_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+extract_expsyms_cmds='`$ECHO "X$extract_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+archive_cmds_need_lc='`$ECHO "X$archive_cmds_need_lc" | $Xsed -e "$delay_single_quote_subst"`'
+enable_shared_with_static_runtimes='`$ECHO "X$enable_shared_with_static_runtimes" | $Xsed -e "$delay_single_quote_subst"`'
+export_dynamic_flag_spec='`$ECHO "X$export_dynamic_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
+whole_archive_flag_spec='`$ECHO "X$whole_archive_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
+compiler_needs_object='`$ECHO "X$compiler_needs_object" | $Xsed -e "$delay_single_quote_subst"`'
+old_archive_from_new_cmds='`$ECHO "X$old_archive_from_new_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+old_archive_from_expsyms_cmds='`$ECHO "X$old_archive_from_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+archive_cmds='`$ECHO "X$archive_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+archive_expsym_cmds='`$ECHO "X$archive_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+module_cmds='`$ECHO "X$module_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+module_expsym_cmds='`$ECHO "X$module_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+with_gnu_ld='`$ECHO "X$with_gnu_ld" | $Xsed -e "$delay_single_quote_subst"`'
+allow_undefined_flag='`$ECHO "X$allow_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`'
+no_undefined_flag='`$ECHO "X$no_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec='`$ECHO "X$hardcode_libdir_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec_ld='`$ECHO "X$hardcode_libdir_flag_spec_ld" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_libdir_separator='`$ECHO "X$hardcode_libdir_separator" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_direct='`$ECHO "X$hardcode_direct" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_direct_absolute='`$ECHO "X$hardcode_direct_absolute" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_minus_L='`$ECHO "X$hardcode_minus_L" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_shlibpath_var='`$ECHO "X$hardcode_shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_automatic='`$ECHO "X$hardcode_automatic" | $Xsed -e "$delay_single_quote_subst"`'
+inherit_rpath='`$ECHO "X$inherit_rpath" | $Xsed -e "$delay_single_quote_subst"`'
+link_all_deplibs='`$ECHO "X$link_all_deplibs" | $Xsed -e "$delay_single_quote_subst"`'
+fix_srcfile_path='`$ECHO "X$fix_srcfile_path" | $Xsed -e "$delay_single_quote_subst"`'
+always_export_symbols='`$ECHO "X$always_export_symbols" | $Xsed -e "$delay_single_quote_subst"`'
+export_symbols_cmds='`$ECHO "X$export_symbols_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+exclude_expsyms='`$ECHO "X$exclude_expsyms" | $Xsed -e "$delay_single_quote_subst"`'
+include_expsyms='`$ECHO "X$include_expsyms" | $Xsed -e "$delay_single_quote_subst"`'
+prelink_cmds='`$ECHO "X$prelink_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+file_list_spec='`$ECHO "X$file_list_spec" | $Xsed -e "$delay_single_quote_subst"`'
+variables_saved_for_relink='`$ECHO "X$variables_saved_for_relink" | $Xsed -e "$delay_single_quote_subst"`'
+need_lib_prefix='`$ECHO "X$need_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`'
+need_version='`$ECHO "X$need_version" | $Xsed -e "$delay_single_quote_subst"`'
+version_type='`$ECHO "X$version_type" | $Xsed -e "$delay_single_quote_subst"`'
+runpath_var='`$ECHO "X$runpath_var" | $Xsed -e "$delay_single_quote_subst"`'
+shlibpath_var='`$ECHO "X$shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`'
+shlibpath_overrides_runpath='`$ECHO "X$shlibpath_overrides_runpath" | $Xsed -e "$delay_single_quote_subst"`'
+libname_spec='`$ECHO "X$libname_spec" | $Xsed -e "$delay_single_quote_subst"`'
+library_names_spec='`$ECHO "X$library_names_spec" | $Xsed -e "$delay_single_quote_subst"`'
+soname_spec='`$ECHO "X$soname_spec" | $Xsed -e "$delay_single_quote_subst"`'
+postinstall_cmds='`$ECHO "X$postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+postuninstall_cmds='`$ECHO "X$postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+finish_cmds='`$ECHO "X$finish_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+finish_eval='`$ECHO "X$finish_eval" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_into_libs='`$ECHO "X$hardcode_into_libs" | $Xsed -e "$delay_single_quote_subst"`'
+sys_lib_search_path_spec='`$ECHO "X$sys_lib_search_path_spec" | $Xsed -e "$delay_single_quote_subst"`'
+sys_lib_dlsearch_path_spec='`$ECHO "X$sys_lib_dlsearch_path_spec" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_action='`$ECHO "X$hardcode_action" | $Xsed -e "$delay_single_quote_subst"`'
+enable_dlopen='`$ECHO "X$enable_dlopen" | $Xsed -e "$delay_single_quote_subst"`'
+enable_dlopen_self='`$ECHO "X$enable_dlopen_self" | $Xsed -e "$delay_single_quote_subst"`'
+enable_dlopen_self_static='`$ECHO "X$enable_dlopen_self_static" | $Xsed -e "$delay_single_quote_subst"`'
+old_striplib='`$ECHO "X$old_striplib" | $Xsed -e "$delay_single_quote_subst"`'
+striplib='`$ECHO "X$striplib" | $Xsed -e "$delay_single_quote_subst"`'
+compiler_lib_search_dirs='`$ECHO "X$compiler_lib_search_dirs" | $Xsed -e "$delay_single_quote_subst"`'
+predep_objects='`$ECHO "X$predep_objects" | $Xsed -e "$delay_single_quote_subst"`'
+postdep_objects='`$ECHO "X$postdep_objects" | $Xsed -e "$delay_single_quote_subst"`'
+predeps='`$ECHO "X$predeps" | $Xsed -e "$delay_single_quote_subst"`'
+postdeps='`$ECHO "X$postdeps" | $Xsed -e "$delay_single_quote_subst"`'
+compiler_lib_search_path='`$ECHO "X$compiler_lib_search_path" | $Xsed -e "$delay_single_quote_subst"`'
+LD_CXX='`$ECHO "X$LD_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+old_archive_cmds_CXX='`$ECHO "X$old_archive_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+compiler_CXX='`$ECHO "X$compiler_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+GCC_CXX='`$ECHO "X$GCC_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "X$lt_prog_compiler_no_builtin_flag_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_wl_CXX='`$ECHO "X$lt_prog_compiler_wl_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_pic_CXX='`$ECHO "X$lt_prog_compiler_pic_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_static_CXX='`$ECHO "X$lt_prog_compiler_static_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_prog_compiler_c_o_CXX='`$ECHO "X$lt_cv_prog_compiler_c_o_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+archive_cmds_need_lc_CXX='`$ECHO "X$archive_cmds_need_lc_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+enable_shared_with_static_runtimes_CXX='`$ECHO "X$enable_shared_with_static_runtimes_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+export_dynamic_flag_spec_CXX='`$ECHO "X$export_dynamic_flag_spec_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+whole_archive_flag_spec_CXX='`$ECHO "X$whole_archive_flag_spec_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+compiler_needs_object_CXX='`$ECHO "X$compiler_needs_object_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+old_archive_from_new_cmds_CXX='`$ECHO "X$old_archive_from_new_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+old_archive_from_expsyms_cmds_CXX='`$ECHO "X$old_archive_from_expsyms_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+archive_cmds_CXX='`$ECHO "X$archive_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+archive_expsym_cmds_CXX='`$ECHO "X$archive_expsym_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+module_cmds_CXX='`$ECHO "X$module_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+module_expsym_cmds_CXX='`$ECHO "X$module_expsym_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+with_gnu_ld_CXX='`$ECHO "X$with_gnu_ld_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+allow_undefined_flag_CXX='`$ECHO "X$allow_undefined_flag_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+no_undefined_flag_CXX='`$ECHO "X$no_undefined_flag_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec_CXX='`$ECHO "X$hardcode_libdir_flag_spec_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec_ld_CXX='`$ECHO "X$hardcode_libdir_flag_spec_ld_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_libdir_separator_CXX='`$ECHO "X$hardcode_libdir_separator_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_direct_CXX='`$ECHO "X$hardcode_direct_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_direct_absolute_CXX='`$ECHO "X$hardcode_direct_absolute_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_minus_L_CXX='`$ECHO "X$hardcode_minus_L_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_shlibpath_var_CXX='`$ECHO "X$hardcode_shlibpath_var_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_automatic_CXX='`$ECHO "X$hardcode_automatic_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+inherit_rpath_CXX='`$ECHO "X$inherit_rpath_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+link_all_deplibs_CXX='`$ECHO "X$link_all_deplibs_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+fix_srcfile_path_CXX='`$ECHO "X$fix_srcfile_path_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+always_export_symbols_CXX='`$ECHO "X$always_export_symbols_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+export_symbols_cmds_CXX='`$ECHO "X$export_symbols_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+exclude_expsyms_CXX='`$ECHO "X$exclude_expsyms_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+include_expsyms_CXX='`$ECHO "X$include_expsyms_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+prelink_cmds_CXX='`$ECHO "X$prelink_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+file_list_spec_CXX='`$ECHO "X$file_list_spec_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_action_CXX='`$ECHO "X$hardcode_action_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+compiler_lib_search_dirs_CXX='`$ECHO "X$compiler_lib_search_dirs_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+predep_objects_CXX='`$ECHO "X$predep_objects_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+postdep_objects_CXX='`$ECHO "X$postdep_objects_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+predeps_CXX='`$ECHO "X$predeps_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+postdeps_CXX='`$ECHO "X$postdeps_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+compiler_lib_search_path_CXX='`$ECHO "X$compiler_lib_search_path_CXX" | $Xsed -e "$delay_single_quote_subst"`'
 
 LTCC='$LTCC'
 LTCFLAGS='$LTCFLAGS'
 compiler='$compiler_DEFAULT'
 
-# A function that is used when there is no print builtin or printf.
-func_fallback_echo ()
-{
-  eval 'cat <<_LTECHO_EOF
-\$1
-_LTECHO_EOF'
-}
-
 # Quote evaled strings.
-for var in SHELL \
-ECHO \
-PATH_SEPARATOR \
-SED \
+for var in SED \
 GREP \
 EGREP \
 FGREP \
@@ -21095,13 +19596,8 @@ reload_flag \
 OBJDUMP \
 deplibs_check_method \
 file_magic_cmd \
-file_magic_glob \
-want_nocaseglob \
-DLLTOOL \
-sharedlib_from_linklib_cmd \
 AR \
 AR_FLAGS \
-archiver_list_spec \
 STRIP \
 RANLIB \
 CC \
@@ -21111,14 +19607,14 @@ lt_cv_sys_global_symbol_pipe \
 lt_cv_sys_global_symbol_to_cdecl \
 lt_cv_sys_global_symbol_to_c_name_address \
 lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \
-nm_file_list_spec \
+SHELL \
+ECHO \
 lt_prog_compiler_no_builtin_flag \
-lt_prog_compiler_pic \
 lt_prog_compiler_wl \
+lt_prog_compiler_pic \
 lt_prog_compiler_static \
 lt_cv_prog_compiler_c_o \
 need_locks \
-MANIFEST_TOOL \
 DSYMUTIL \
 NMEDIT \
 LIPO \
@@ -21132,7 +19628,9 @@ with_gnu_ld \
 allow_undefined_flag \
 no_undefined_flag \
 hardcode_libdir_flag_spec \
+hardcode_libdir_flag_spec_ld \
 hardcode_libdir_separator \
+fix_srcfile_path \
 exclude_expsyms \
 include_expsyms \
 file_list_spec \
@@ -21140,7 +19638,6 @@ variables_saved_for_relink \
 libname_spec \
 library_names_spec \
 soname_spec \
-install_override_mode \
 finish_eval \
 old_striplib \
 striplib \
@@ -21151,11 +19648,10 @@ predeps \
 postdeps \
 compiler_lib_search_path \
 LD_CXX \
-reload_flag_CXX \
 compiler_CXX \
 lt_prog_compiler_no_builtin_flag_CXX \
-lt_prog_compiler_pic_CXX \
 lt_prog_compiler_wl_CXX \
+lt_prog_compiler_pic_CXX \
 lt_prog_compiler_static_CXX \
 lt_cv_prog_compiler_c_o_CXX \
 export_dynamic_flag_spec_CXX \
@@ -21165,7 +19661,9 @@ with_gnu_ld_CXX \
 allow_undefined_flag_CXX \
 no_undefined_flag_CXX \
 hardcode_libdir_flag_spec_CXX \
+hardcode_libdir_flag_spec_ld_CXX \
 hardcode_libdir_separator_CXX \
+fix_srcfile_path_CXX \
 exclude_expsyms_CXX \
 include_expsyms_CXX \
 file_list_spec_CXX \
@@ -21175,9 +19673,9 @@ postdep_objects_CXX \
 predeps_CXX \
 postdeps_CXX \
 compiler_lib_search_path_CXX; do
-    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+    case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
     *[\\\\\\\`\\"\\\$]*)
-      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
       ;;
     *)
       eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
@@ -21199,13 +19697,11 @@ module_cmds \
 module_expsym_cmds \
 export_symbols_cmds \
 prelink_cmds \
-postlink_cmds \
 postinstall_cmds \
 postuninstall_cmds \
 finish_cmds \
 sys_lib_search_path_spec \
 sys_lib_dlsearch_path_spec \
-reload_cmds_CXX \
 old_archive_cmds_CXX \
 old_archive_from_new_cmds_CXX \
 old_archive_from_expsyms_cmds_CXX \
@@ -21214,11 +19710,10 @@ archive_expsym_cmds_CXX \
 module_cmds_CXX \
 module_expsym_cmds_CXX \
 export_symbols_cmds_CXX \
-prelink_cmds_CXX \
-postlink_cmds_CXX; do
-    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+prelink_cmds_CXX; do
+    case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
     *[\\\\\\\`\\"\\\$]*)
-      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
       ;;
     *)
       eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
@@ -21226,6 +19721,12 @@ postlink_cmds_CXX; do
     esac
 done
 
+# Fix-up fallback echo if it was mangled by the above quoting rules.
+case \$lt_ECHO in
+*'\\\$0 --fallback-echo"')  lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\$0 --fallback-echo"\$/\$0 --fallback-echo"/'\`
+  ;;
+esac
+
 ac_aux_dir='$ac_aux_dir'
 xsi_shell='$xsi_shell'
 lt_shell_append='$lt_shell_append'
@@ -21261,22 +19762,34 @@ do
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
     "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
     "src/stdinc/Makefile") CONFIG_FILES="$CONFIG_FILES src/stdinc/Makefile" ;;
-    "src/debuggersupport/Makefile") CONFIG_FILES="$CONFIG_FILES src/debuggersupport/Makefile" ;;
-    "src/memorc/Makefile") CONFIG_FILES="$CONFIG_FILES src/memorc/Makefile" ;;
+    "src/lec/Makefile") CONFIG_FILES="$CONFIG_FILES src/lec/Makefile" ;;
     "src/errorhandling/Makefile") CONFIG_FILES="$CONFIG_FILES src/errorhandling/Makefile" ;;
     "src/util/Makefile") CONFIG_FILES="$CONFIG_FILES src/util/Makefile" ;;
     "src/io/Makefile") CONFIG_FILES="$CONFIG_FILES src/io/Makefile" ;;
     "src/mira/Makefile") CONFIG_FILES="$CONFIG_FILES src/mira/Makefile" ;;
+    "src/EdIt/Makefile") CONFIG_FILES="$CONFIG_FILES src/EdIt/Makefile" ;;
     "src/caf/Makefile") CONFIG_FILES="$CONFIG_FILES src/caf/Makefile" ;;
+    "src/examine/Makefile") CONFIG_FILES="$CONFIG_FILES src/examine/Makefile" ;;
+    "src/knn_abi373/Makefile") CONFIG_FILES="$CONFIG_FILES src/knn_abi373/Makefile" ;;
+    "src/knn_alf/Makefile") CONFIG_FILES="$CONFIG_FILES src/knn_alf/Makefile" ;;
     "src/support/Makefile") CONFIG_FILES="$CONFIG_FILES src/support/Makefile" ;;
     "src/scripts/Makefile") CONFIG_FILES="$CONFIG_FILES src/scripts/Makefile" ;;
-    "src/modules/Makefile") CONFIG_FILES="$CONFIG_FILES src/modules/Makefile" ;;
+    "src/test/Makefile") CONFIG_FILES="$CONFIG_FILES src/test/Makefile" ;;
+    "src/test/io/Makefile") CONFIG_FILES="$CONFIG_FILES src/test/io/Makefile" ;;
+    "src/test/io/scf/Makefile") CONFIG_FILES="$CONFIG_FILES src/test/io/scf/Makefile" ;;
+    "src/test/io/fasta/Makefile") CONFIG_FILES="$CONFIG_FILES src/test/io/fasta/Makefile" ;;
+    "src/test/io/generalio/Makefile") CONFIG_FILES="$CONFIG_FILES src/test/io/generalio/Makefile" ;;
+    "src/test/mira/Makefile") CONFIG_FILES="$CONFIG_FILES src/test/mira/Makefile" ;;
+    "src/test/mira/align/Makefile") CONFIG_FILES="$CONFIG_FILES src/test/mira/align/Makefile" ;;
+    "src/test/mira/read/Makefile") CONFIG_FILES="$CONFIG_FILES src/test/mira/read/Makefile" ;;
+    "src/test/mira/readpool/Makefile") CONFIG_FILES="$CONFIG_FILES src/test/mira/readpool/Makefile" ;;
+    "src/examples_programming/Makefile") CONFIG_FILES="$CONFIG_FILES src/examples_programming/Makefile" ;;
     "src/progs/Makefile") CONFIG_FILES="$CONFIG_FILES src/progs/Makefile" ;;
     "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
     "doc/docbook/Makefile") CONFIG_FILES="$CONFIG_FILES doc/docbook/Makefile" ;;
     "distribution/Makefile") CONFIG_FILES="$CONFIG_FILES distribution/Makefile" ;;
 
-  *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
+  *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;;
   esac
 done
 
@@ -21298,10 +19811,9 @@ fi
 # after its creation but before its name has been assigned to `$tmp'.
 $debug ||
 {
-  tmp= ac_tmp=
+  tmp=
   trap 'exit_status=$?
-  : "${ac_tmp:=$tmp}"
-  { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
+  { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
 ' 0
   trap 'as_fn_exit 1' 1 2 13 15
 }
@@ -21309,13 +19821,12 @@ $debug ||
 
 {
   tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
-  test -d "$tmp"
+  test -n "$tmp" && test -d "$tmp"
 }  ||
 {
   tmp=./conf$$-$RANDOM
   (umask 077 && mkdir "$tmp")
 } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
-ac_tmp=$tmp
 
 # Set up the scripts for CONFIG_FILES section.
 # No need to generate them if there are no CONFIG_FILES.
@@ -21337,7 +19848,7 @@ else
   ac_cs_awk_cr=$ac_cr
 fi
 
-echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
+echo 'BEGIN {' >"$tmp/subs1.awk" &&
 _ACEOF
 
 
@@ -21365,7 +19876,7 @@ done
 rm -f conf$$subs.sh
 
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
+cat >>"\$tmp/subs1.awk" <<\\_ACAWK &&
 _ACEOF
 sed -n '
 h
@@ -21413,7 +19924,7 @@ t delim
 rm -f conf$$subs.awk
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 _ACAWK
-cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
+cat >>"\$tmp/subs1.awk" <<_ACAWK &&
   for (key in S) S_is_set[key] = 1
   FS = ""
 
@@ -21445,7 +19956,7 @@ if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
   sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
 else
   cat
-fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
+fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \
   || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
 _ACEOF
 
@@ -21485,7 +19996,7 @@ do
   esac
   case $ac_mode$ac_tag in
   :[FHL]*:*);;
-  :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
+  :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;;
   :[FH]-) ac_tag=-:-;;
   :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
   esac
@@ -21504,7 +20015,7 @@ do
     for ac_f
     do
       case $ac_f in
-      -) ac_f="$ac_tmp/stdin";;
+      -) ac_f="$tmp/stdin";;
       *) # Look for the file first in the build tree, then in the source tree
 	 # (if the path is not absolute).  The absolute path cannot be DOS-style,
 	 # because $ac_f cannot contain `:'.
@@ -21513,7 +20024,7 @@ do
 	   [\\/$]*) false;;
 	   *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
 	   esac ||
-	   as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
+	   as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;;
       esac
       case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
       as_fn_append ac_file_inputs " '$ac_f'"
@@ -21539,8 +20050,8 @@ $as_echo "$as_me: creating $ac_file" >&6;}
     esac
 
     case $ac_tag in
-    *:-:* | *:-) cat >"$ac_tmp/stdin" \
-      || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
+    *:-:* | *:-) cat >"$tmp/stdin" \
+      || as_fn_error $? "could not create $ac_file" "$LINENO" 5  ;;
     esac
     ;;
   esac
@@ -21676,22 +20187,21 @@ s&@INSTALL@&$ac_INSTALL&;t t
 s&@MKDIR_P@&$ac_MKDIR_P&;t t
 $ac_datarootdir_hack
 "
-eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
-  >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
+  || as_fn_error $? "could not create $ac_file" "$LINENO" 5
 
 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
-  { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
-  { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' \
-      "$ac_tmp/out"`; test -z "$ac_out"; } &&
+  { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
+  { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
   { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
 which seems to be undefined.  Please make sure it is defined" >&5
 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
 which seems to be undefined.  Please make sure it is defined" >&2;}
 
-  rm -f "$ac_tmp/stdin"
+  rm -f "$tmp/stdin"
   case $ac_file in
-  -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
-  *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
+  -) cat "$tmp/out" && rm -f "$tmp/out";;
+  *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
   esac \
   || as_fn_error $? "could not create $ac_file" "$LINENO" 5
  ;;
@@ -21820,8 +20330,7 @@ $as_echo X"$file" |
 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
 #
 #   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-#                 Foundation, Inc.
+#                 2006, 2007, 2008 Free Software Foundation, Inc.
 #   Written by Gordon Matzigkeit, 1996
 #
 #   This file is part of GNU Libtool.
@@ -21869,15 +20378,6 @@ pic_mode=$pic_mode
 # Whether or not to optimize for fast installation.
 fast_install=$enable_fast_install
 
-# Shell to use when invoking shell scripts.
-SHELL=$lt_SHELL
-
-# An echo program that protects backslashes.
-ECHO=$lt_ECHO
-
-# The PATH separator for the build system.
-PATH_SEPARATOR=$lt_PATH_SEPARATOR
-
 # The host system.
 host_alias=$host_alias
 host=$host
@@ -21927,11 +20427,9 @@ SP2NL=$lt_lt_SP2NL
 # turn newlines into spaces.
 NL2SP=$lt_lt_NL2SP
 
-# convert \$build file names to \$host format.
-to_host_file_cmd=$lt_cv_to_host_file_cmd
-
-# convert \$build files to toolchain format.
-to_tool_file_cmd=$lt_cv_to_tool_file_cmd
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
 
 # An object symbol dumper.
 OBJDUMP=$lt_OBJDUMP
@@ -21939,30 +20437,13 @@ OBJDUMP=$lt_OBJDUMP
 # Method to check whether dependent libraries are shared objects.
 deplibs_check_method=$lt_deplibs_check_method
 
-# Command to use when deplibs_check_method = "file_magic".
+# Command to use when deplibs_check_method == "file_magic".
 file_magic_cmd=$lt_file_magic_cmd
 
-# How to find potential files when deplibs_check_method = "file_magic".
-file_magic_glob=$lt_file_magic_glob
-
-# Find potential files using nocaseglob when deplibs_check_method = "file_magic".
-want_nocaseglob=$lt_want_nocaseglob
-
-# DLL creation program.
-DLLTOOL=$lt_DLLTOOL
-
-# Command to associate shared and link libraries.
-sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd
-
 # The archiver.
 AR=$lt_AR
-
-# Flags to create an archive.
 AR_FLAGS=$lt_AR_FLAGS
 
-# How to feed a file listing to the archiver.
-archiver_list_spec=$lt_archiver_list_spec
-
 # A symbol stripping program.
 STRIP=$lt_STRIP
 
@@ -21971,9 +20452,6 @@ RANLIB=$lt_RANLIB
 old_postinstall_cmds=$lt_old_postinstall_cmds
 old_postuninstall_cmds=$lt_old_postuninstall_cmds
 
-# Whether to use a lock for old archive extraction.
-lock_old_archive_extraction=$lock_old_archive_extraction
-
 # A C compiler.
 LTCC=$lt_CC
 
@@ -21992,24 +20470,21 @@ global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
 # Transform the output of nm in a C name address pair when lib prefix is needed.
 global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix
 
-# Specify filename containing input files for \$NM.
-nm_file_list_spec=$lt_nm_file_list_spec
-
-# The root where to search for dependent libraries,and in which our libraries should be installed.
-lt_sysroot=$lt_sysroot
-
 # The name of the directory that contains temporary libtool files.
 objdir=$objdir
 
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# An echo program that does not interpret backslashes.
+ECHO=$lt_ECHO
+
 # Used to examine libraries when file_magic_cmd begins with "file".
 MAGIC_CMD=$MAGIC_CMD
 
 # Must we lock files when doing compilation?
 need_locks=$lt_need_locks
 
-# Manifest tool.
-MANIFEST_TOOL=$lt_MANIFEST_TOOL
-
 # Tool to manipulate archived DWARF debug symbol files on Mac OS X.
 DSYMUTIL=$lt_DSYMUTIL
 
@@ -22066,9 +20541,6 @@ library_names_spec=$lt_library_names_spec
 # The coded name of the library, if different from the real name.
 soname_spec=$lt_soname_spec
 
-# Permission mode override for installation of shared libraries.
-install_override_mode=$lt_install_override_mode
-
 # Command to use after installation of a shared archive.
 postinstall_cmds=$lt_postinstall_cmds
 
@@ -22108,10 +20580,6 @@ striplib=$lt_striplib
 # The linker used to build libraries.
 LD=$lt_LD
 
-# How to create reloadable object files.
-reload_flag=$lt_reload_flag
-reload_cmds=$lt_reload_cmds
-
 # Commands used to build an old-style archive.
 old_archive_cmds=$lt_old_archive_cmds
 
@@ -22124,12 +20592,12 @@ with_gcc=$GCC
 # Compiler flag to turn off builtin functions.
 no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
 
-# Additional compiler flags for building library objects.
-pic_flag=$lt_lt_prog_compiler_pic
-
 # How to pass a linker flag through the compiler.
 wl=$lt_lt_prog_compiler_wl
 
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic
+
 # Compiler flag to prevent dynamic linking.
 link_static_flag=$lt_lt_prog_compiler_static
 
@@ -22179,6 +20647,10 @@ no_undefined_flag=$lt_no_undefined_flag
 # This must work even if \$libdir does not exist
 hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
 
+# If ld is used when linking, flag to hardcode \$libdir into a binary
+# during linking.  This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld
+
 # Whether we need a single "-rpath" flag with a separated argument.
 hardcode_libdir_separator=$lt_hardcode_libdir_separator
 
@@ -22212,6 +20684,9 @@ inherit_rpath=$inherit_rpath
 # Whether libtool must link a program against all its dependency libraries.
 link_all_deplibs=$link_all_deplibs
 
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_fix_srcfile_path
+
 # Set to "yes" if exported symbols are required.
 always_export_symbols=$always_export_symbols
 
@@ -22227,9 +20702,6 @@ include_expsyms=$lt_include_expsyms
 # Commands necessary for linking programs (against libraries) with templates.
 prelink_cmds=$lt_prelink_cmds
 
-# Commands necessary for finishing linking programs.
-postlink_cmds=$lt_postlink_cmds
-
 # Specify filename containing input files.
 file_list_spec=$lt_file_list_spec
 
@@ -22276,169 +20748,212 @@ ltmain="$ac_aux_dir/ltmain.sh"
   # if finds mixed CR/LF and LF-only lines.  Since sed operates in
   # text mode, it properly converts lines to CR/LF.  This bash problem
   # is reportedly fixed, but why not run on old versions too?
-  sed '$q' "$ltmain" >> "$cfgfile" \
-     || (rm -f "$cfgfile"; exit 1)
-
-  if test x"$xsi_shell" = xyes; then
-  sed -e '/^func_dirname ()$/,/^} # func_dirname /c\
-func_dirname ()\
-{\
-\    case ${1} in\
-\      */*) func_dirname_result="${1%/*}${2}" ;;\
-\      *  ) func_dirname_result="${3}" ;;\
-\    esac\
-} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_basename ()$/,/^} # func_basename /c\
-func_basename ()\
-{\
-\    func_basename_result="${1##*/}"\
-} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\
-func_dirname_and_basename ()\
-{\
-\    case ${1} in\
-\      */*) func_dirname_result="${1%/*}${2}" ;;\
-\      *  ) func_dirname_result="${3}" ;;\
-\    esac\
-\    func_basename_result="${1##*/}"\
-} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_stripname ()$/,/^} # func_stripname /c\
-func_stripname ()\
-{\
-\    # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\
-\    # positional parameters, so assign one to ordinary parameter first.\
-\    func_stripname_result=${3}\
-\    func_stripname_result=${func_stripname_result#"${1}"}\
-\    func_stripname_result=${func_stripname_result%"${2}"}\
-} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\
-func_split_long_opt ()\
-{\
-\    func_split_long_opt_name=${1%%=*}\
-\    func_split_long_opt_arg=${1#*=}\
-} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\
-func_split_short_opt ()\
-{\
-\    func_split_short_opt_arg=${1#??}\
-\    func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\
-} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\
-func_lo2o ()\
-{\
-\    case ${1} in\
-\      *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\
-\      *)    func_lo2o_result=${1} ;;\
-\    esac\
-} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_xform ()$/,/^} # func_xform /c\
-func_xform ()\
-{\
-    func_xform_result=${1%.*}.lo\
-} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_arith ()$/,/^} # func_arith /c\
-func_arith ()\
-{\
-    func_arith_result=$(( $* ))\
-} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_len ()$/,/^} # func_len /c\
-func_len ()\
-{\
-    func_len_result=${#1}\
-} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-fi
-
-if test x"$lt_shell_append" = xyes; then
-  sed -e '/^func_append ()$/,/^} # func_append /c\
-func_append ()\
-{\
-    eval "${1}+=\\${2}"\
-} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\
-func_append_quoted ()\
-{\
-\    func_quote_for_eval "${2}"\
-\    eval "${1}+=\\\\ \\$func_quote_for_eval_result"\
-} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  # Save a `func_append' function call where possible by direct use of '+='
-  sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
-    && mv -f "$cfgfile.tmp" "$cfgfile" \
-      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-  test 0 -eq $? || _lt_function_replace_fail=:
-else
-  # Save a `func_append' function call even when '+=' is not available
-  sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
-    && mv -f "$cfgfile.tmp" "$cfgfile" \
-      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-  test 0 -eq $? || _lt_function_replace_fail=:
-fi
-
-if test x"$_lt_function_replace_fail" = x":"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5
-$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;}
-fi
-
-
-   mv -f "$cfgfile" "$ofile" ||
+  sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \
+    || (rm -f "$cfgfile"; exit 1)
+
+  case $xsi_shell in
+  yes)
+    cat << \_LT_EOF >> "$cfgfile"
+
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+  case ${1} in
+    */*) func_dirname_result="${1%/*}${2}" ;;
+    *  ) func_dirname_result="${3}" ;;
+  esac
+}
+
+# func_basename file
+func_basename ()
+{
+  func_basename_result="${1##*/}"
+}
+
+# func_dirname_and_basename file append nondir_replacement
+# perform func_basename and func_dirname in a single function
+# call:
+#   dirname:  Compute the dirname of FILE.  If nonempty,
+#             add APPEND to the result, otherwise set result
+#             to NONDIR_REPLACEMENT.
+#             value returned in "$func_dirname_result"
+#   basename: Compute filename of FILE.
+#             value retuned in "$func_basename_result"
+# Implementation must be kept synchronized with func_dirname
+# and func_basename. For efficiency, we do not delegate to
+# those functions but instead duplicate the functionality here.
+func_dirname_and_basename ()
+{
+  case ${1} in
+    */*) func_dirname_result="${1%/*}${2}" ;;
+    *  ) func_dirname_result="${3}" ;;
+  esac
+  func_basename_result="${1##*/}"
+}
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+func_stripname ()
+{
+  # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
+  # positional parameters, so assign one to ordinary parameter first.
+  func_stripname_result=${3}
+  func_stripname_result=${func_stripname_result#"${1}"}
+  func_stripname_result=${func_stripname_result%"${2}"}
+}
+
+# func_opt_split
+func_opt_split ()
+{
+  func_opt_split_opt=${1%%=*}
+  func_opt_split_arg=${1#*=}
+}
+
+# func_lo2o object
+func_lo2o ()
+{
+  case ${1} in
+    *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
+    *)    func_lo2o_result=${1} ;;
+  esac
+}
+
+# func_xform libobj-or-source
+func_xform ()
+{
+  func_xform_result=${1%.*}.lo
+}
+
+# func_arith arithmetic-term...
+func_arith ()
+{
+  func_arith_result=$(( $* ))
+}
+
+# func_len string
+# STRING may not start with a hyphen.
+func_len ()
+{
+  func_len_result=${#1}
+}
+
+_LT_EOF
+    ;;
+  *) # Bourne compatible functions.
+    cat << \_LT_EOF >> "$cfgfile"
+
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+  # Extract subdirectory from the argument.
+  func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
+  if test "X$func_dirname_result" = "X${1}"; then
+    func_dirname_result="${3}"
+  else
+    func_dirname_result="$func_dirname_result${2}"
+  fi
+}
+
+# func_basename file
+func_basename ()
+{
+  func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
+}
+
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+# func_strip_suffix prefix name
+func_stripname ()
+{
+  case ${2} in
+    .*) func_stripname_result=`$ECHO "X${3}" \
+           | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;;
+    *)  func_stripname_result=`$ECHO "X${3}" \
+           | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;;
+  esac
+}
+
+# sed scripts:
+my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q'
+my_sed_long_arg='1s/^-[^=]*=//'
+
+# func_opt_split
+func_opt_split ()
+{
+  func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"`
+  func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"`
+}
+
+# func_lo2o object
+func_lo2o ()
+{
+  func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"`
+}
+
+# func_xform libobj-or-source
+func_xform ()
+{
+  func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[^.]*$/.lo/'`
+}
+
+# func_arith arithmetic-term...
+func_arith ()
+{
+  func_arith_result=`expr "$@"`
+}
+
+# func_len string
+# STRING may not start with a hyphen.
+func_len ()
+{
+  func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
+}
+
+_LT_EOF
+esac
+
+case $lt_shell_append in
+  yes)
+    cat << \_LT_EOF >> "$cfgfile"
+
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+  eval "$1+=\$2"
+}
+_LT_EOF
+    ;;
+  *)
+    cat << \_LT_EOF >> "$cfgfile"
+
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+  eval "$1=\$$1\$2"
+}
+
+_LT_EOF
+    ;;
+  esac
+
+
+  sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \
+    || (rm -f "$cfgfile"; exit 1)
+
+  mv -f "$cfgfile" "$ofile" ||
     (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
   chmod +x "$ofile"
 
@@ -22450,10 +20965,6 @@ fi
 # The linker used to build libraries.
 LD=$lt_LD_CXX
 
-# How to create reloadable object files.
-reload_flag=$lt_reload_flag_CXX
-reload_cmds=$lt_reload_cmds_CXX
-
 # Commands used to build an old-style archive.
 old_archive_cmds=$lt_old_archive_cmds_CXX
 
@@ -22466,12 +20977,12 @@ with_gcc=$GCC_CXX
 # Compiler flag to turn off builtin functions.
 no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX
 
-# Additional compiler flags for building library objects.
-pic_flag=$lt_lt_prog_compiler_pic_CXX
-
 # How to pass a linker flag through the compiler.
 wl=$lt_lt_prog_compiler_wl_CXX
 
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_CXX
+
 # Compiler flag to prevent dynamic linking.
 link_static_flag=$lt_lt_prog_compiler_static_CXX
 
@@ -22521,6 +21032,10 @@ no_undefined_flag=$lt_no_undefined_flag_CXX
 # This must work even if \$libdir does not exist
 hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX
 
+# If ld is used when linking, flag to hardcode \$libdir into a binary
+# during linking.  This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX
+
 # Whether we need a single "-rpath" flag with a separated argument.
 hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX
 
@@ -22554,6 +21069,9 @@ inherit_rpath=$inherit_rpath_CXX
 # Whether libtool must link a program against all its dependency libraries.
 link_all_deplibs=$link_all_deplibs_CXX
 
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_fix_srcfile_path_CXX
+
 # Set to "yes" if exported symbols are required.
 always_export_symbols=$always_export_symbols_CXX
 
@@ -22569,9 +21087,6 @@ include_expsyms=$lt_include_expsyms_CXX
 # Commands necessary for linking programs (against libraries) with templates.
 prelink_cmds=$lt_prelink_cmds_CXX
 
-# Commands necessary for finishing linking programs.
-postlink_cmds=$lt_postlink_cmds_CXX
-
 # Specify filename containing input files.
 file_list_spec=$lt_file_list_spec_CXX
 
@@ -22635,21 +21150,6 @@ $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
 fi
 
 
-#		    src/test/Makefile \
-#		    src/test/mira/Makefile \
-#		    src/test/mira/align/Makefile \
-
-#		    src/EdIt/Makefile \
-#		    src/examine/Makefile \
-#		    src/knn_abi373/Makefile \
-#		    src/knn_alf/Makefile \
-#		    src/test/io/Makefile \
-#		    src/test/io/scf/Makefile \
-#		    src/test/io/fasta/Makefile \
-#		    src/test/io/generalio/Makefile \
-#		    src/test/mira/read/Makefile \
-#		    src/test/mira/readpool/Makefile \
-#		    src/examples_programming/Makefile \
 
 #		    miratest/Makefile \
 #		    miratest/template/Makefile \
@@ -22667,10 +21167,7 @@ EOF
 
 # give summary of the most important settings
 
-#MIRAVERSION=${VERSION}_${build_os}_${BITPACKAGE}_${MIRASTATIC}
-MIRAVERSION=`build-aux/git-version-gen .tarball-version`_${build_os}_${BITPACKAGE}_${MIRASTATIC}
-
-echo ${VERSION} >.version
+MIRAVERSION=${VERSION}_${SHORTMIRAAUDIENCE}_${build_os}_${BITPACKAGE}_${MIRASTATIC}
 
 echo
 echo "--------------------------------------------------------------------------------"
@@ -22679,12 +21176,6 @@ echo "--------------------------------------------------------------------------
 echo
 
 possibleproblems="no"
-if test "${HAVE_XXD}" = "no"; then
-  echo
-  echo "Could not find the program 'xxd'. It is usually part of 'vim', please"
-  echo "install it."
-  possibleproblems="yes"
-fi
 if test "${HAVE_EXPAT}" = "no"; then
   echo
   echo "Could not find expat. Please install the Expat library."
@@ -22727,20 +21218,27 @@ fi
 if test "${HAVE_BOOST_THREAD}" = "yes"; then
   echo
   echo "I couldn't find the C++ Boost libraries. They're really needed."
-  echo "Install at least 1.44 from the package repository of your"
+  echo "Install at least 1.35 from the package repository of your"
   echo " distribution/vendor or download and install manually from"
   echo " http://www.boost.org/"
   possibleproblems="yes"
 fi
 
+if test "${PERL}" = "no"; then
+  echo
+  echo "I couldn't find the a 'perl' binary. If it is installed on your"
+  echo "system, provide the path with '--with-perl=...'"
+  echo "Else please install perl."
+  possibleproblems="yes"
+fi
+
 if test "${possibleproblems}" = "yes"; then
   echo
   echo "Packages/programs needed for the compilation were not found."
   echo "Please install these first and then try again."
   echo
-  echo "If you installed them, perhaps the programs are not in your PATH?"
-  echo "Or you forgot to give the configure script options to tell where"
-  echo "the packages are?"
+  echo "If you installed them, perhaps you forgot to give the configure script"
+  echo "options to tell where they are?"
   echo
   exit 10
 fi
@@ -22781,53 +21279,48 @@ if test "${LEX}" = "flex"; then
   fi
 fi
 
-#if test "${linkwith_tcmalloc}" = "no"; then
-#  if test "${with_tcmalloc}" = "no" ; then
-#    echo "Linking against tcmalloc is disabled!"
-#    if test "${systemuname}" = "Darwin"; then
-#      echo "Note that this is the default for OS X, but you might want to try switching"
-#      echo "it on like this: --with-tcmalloc"
-#      echo
-#    fi
-#  elif test "${HAVE_TCMALLOC}" = "no"; then
-#    echo "Could not find the tcmalloc library. It is part of the Google perftools library at"
-#    echo "  http://code.google.com/p/google-perftools/downloads/list"
-#    echo "Please consult the INSTALL file of MIRA for more help on installing it."
-#    echo
-#  fi
-#  if test "${systemuname}" != "Darwin"; then
-#    echo
-#    echo "Linking to this library is *HIGHLY* recommended as without this library the"
-#    echo "memory requirements for MIRA may be 100% higher!"
-#    echo
-#    possibleproblems="yes"
-#    if test "${with_tcmalloc}" = "no" ; then
-#      possibleproblems="no"
-#    fi
-#  fi
-#fi
-
-
-if test "${zlib_havegzoffset}" = "no"; then
-  possibleproblems="yes"
-  echo
-  echo "While zlib has been found, the version which is used is apparently"
-  echo "lower than 1.2.4. Progress bars for FASTQ loading will not work."
-  echo "Please make sure you have a good version of zlib."
+if test "${linkwith_tcmalloc}" = "no"; then
+  if test "${with_tcmalloc}" = "no" ; then
+    echo "Linking against tcmalloc is disabled!"
+    if test "${systemuname}" = "Darwin"; then
+      echo "Note that is the default for OS X, but you might want to try switching"
+      echo "it on like this: --with-tcmalloc"
+      echo
+    fi
+  elif test "${HAVE_TCMALLOC}" = "no"; then
+    echo "Could not find the tcmalloc library. It is part of the Google perftools library at"
+    echo "  http://code.google.com/p/google-perftools/downloads/list"
+    echo "Please consult the INSTALL file of MIRA for more help on installing it."
+    echo
+  fi
+  if test "${systemuname}" != "Darwin"; then
+    echo
+    echo "Linking to this library is *HIGHLY* recommended as without this library the"
+    echo "memory requirements for MIRA may be 100% higher!"
+    echo
+    possibleproblems="yes"
+  fi
 fi
 
+
 echo "Building version ................................. ${MIRAVERSION}"
+$ECHO_N "Production or development version?................ "
+if test "${developmentversion}" = "yes"; then
+  echo "development"
+else
+  echo "production"
+fi
 
 echo
 echo "We are building on ............................... ${systemuname}"
 
-echo "CPU supports 64 bit? ............................. ${has_int64_t}"
-echo "Compiler family .................................. ${bachCCOMPILER}"
-if test $bachCCOMPILER != gcc; then
+echo "CPU supports 64 bit? ......... ................... ${has_int64_t}"
+echo "Compiler ......................................... ${CC}"
+if test "${CC}" != "gcc"; then
   possibleproblems="yes"
   echo
   echo "Compiler is not GCC. This *MIGHT* be a problem! (more compilation tests"
-  echo "needed, please report success or failure)"
+  echo "needed, please report succes or failure)"
   echo
 fi
 
@@ -22843,18 +21336,13 @@ if test "${enable_debug}" = "yes"; then
   echo "${enable_debug}"
 fi
 
-if test "${enable_miramemorc}" = "yes"; then
-  $ECHO_N "Memory overrun checks in executable? ............. "
-  echo "${enable_debug}"
-fi
-
 if test "${enable_cxxdebug}" = "yes"; then
-  $ECHO_N "Debug version of C++ STL library? ................ "
+  $ECHO_N "Debug version of C++ STL library?................. "
   echo "${enable_debug}"
 fi
 
 if test "${enable_profile}" = "yes"; then
-  $ECHO_N "Profile information in executable? ............... "
+  $ECHO_N "Profile information in executable?................ "
   echo "${enable_profile}"
 fi
 if test "${has_int64_t}" = "yes"; then
@@ -22871,15 +21359,14 @@ fi
 echo "Building completely static? ...................... ${enable_mirastatic}"
 
 
-$ECHO_N "BOOST expected to compile and link? .............. "
+$ECHO_N "BOOST expected to compile and link?............... "
 if test "${possibleboostproblem}" = "yes"; then
   echo "maybe"
   possibleproblems="yes"
 else
   echo "yes"
 fi
-echo "Linking with TCmalloc library? ................... ${linkwith_tcmalloc}"
-echo "Have complete zlib support? ...................... ${zlib_havegzoffset}"
+echo "Linking with TCmalloc library?.................... ${linkwith_tcmalloc}"
 
 echo
 echo "Can MIRA be built on this system? ................ ${buildenvworks}"
@@ -22902,7 +21389,6 @@ echo
 echo "Using CFLAGS   : ${CFLAGS}"
 echo "Using CXXFLAGS : ${CXXFLAGS}"
 echo "Using LDFLAGS  : ${LDFLAGS}"
-echo "Using LIBS     : ${LIBS}"
 echo
 
 if test "${possibleproblems}" = "no"; then
@@ -22929,9 +21415,8 @@ if test "${possibleproblems}" = "no"; then
   echo "Type 'make' to make the binaries"
   echo "and then 'make install' to install them."
 else
-  echo "Ooops, some functionality might be missing or we might encounter some"
-  echo "problems in compilation/linking. Please give it a try and report success"
-  echo "or failure."
+  echo "Ooops, we might encounter some problems in compilation/linking. Please give "
+  echo "it a try and report success or failure."
   echo
   echo "Type 'make' to make the binaries and if no error occured,"
   echo "then 'make install' to install them."
diff --git a/configure.ac b/configure.in
similarity index 65%
rename from configure.ac
rename to configure.in
index 9d378ea..4ee8bd2 100644
--- a/configure.ac
+++ b/configure.in
@@ -1,8 +1,6 @@
 # Process this file with autoconf to produce a configure script.
 
-#LT_PREREQ([2.4.2])
-
-AC_INIT(mira, m4_esyscmd([build-aux/git-version-gen isshort .tarball-version]))
+AC_INIT(mira, 3.4.0)
 AC_CONFIG_MACRO_DIR([m4])
 #AC_CONFIG_AUX_DIR(config)
 AC_CONFIG_SRCDIR(src/stdinc/defines.H)
@@ -19,9 +17,11 @@ CXXFLAGS="${CXXFLAGS} "
 
 AMCXXFLAGS=""
 
-# we'll need that quite soon
-AC_PROG_SED
-
+# having this before AC_CANONICAL_BUILD sets the correct CPU info in ${build_os}
+if test "${systemuname}" = "Darwin"; then
+  CFLAGS="-mmacosx-version-min=10.5 ${CFLAGS}"
+  CXXFLAGS="-mmacosx-version-min=10.5 ${CXXFLAGS}"
+fi
 
 # The internal echo for /bin/sh on darwin doesn't support -n
 # therefore we have to use /bin/echo.
@@ -34,22 +34,13 @@ fi
 
 
 
-AC_ARG_ENABLE(clang,
-	AC_HELP_STRING([--enable-clang],
-	[use clang instead of gcc]))
-
-if test "${enable_clang}" = "yes" ; then
-  CC=clang
-fi
-
 AC_ARG_ENABLE(mirastatic,
-	AC_HELP_STRING([--enable-mirastatic],
+	AC_HELP_STRING([--enable-mirastatic], 
 	[enables building of static binaries, default is no]))
 
 AM_CONDITIONAL([BUILDMIRASTATIC], [test x$enable_mirastatic = xyes])
 
-
-#
+# 
 # Seen on systems where third party programs/libs were installed in a
 #  separate non-standard directory like "/home/foo/public":
 #
@@ -70,7 +61,7 @@ if test "x${prefix}" != "xNONE" ; then
 fi
 AC_MSG_RESULT(${haveuserprefix})
 
-echo
+echo 
 echo "+++++++++++++++++++++++++++++++++++++"
 echo "systemuname: ${systemuname}"
 echo "CFLAGS now: ${CFLAGS}"
@@ -79,80 +70,23 @@ echo "LDFLAGS now: ${LDFLAGS}"
 echo "+++++++++++++++++++++++++++++++++++++"
 
 if test "${enable_mirastatic}" = "yes" ; then
-  AC_SUBST(MIRASTATIC,"static")
+  AC_SUBST(MIRASTATIC,"static")  
 else
   enable_mirastatic="no"
   AC_SUBST(MIRASTATIC,"dynamic")
 fi
 
-bccheck1="[gcc]"
-bccheck2="[g++]"
-
-case "${CC}" in
-*gcc*)
-  bccheck1="[gcc]"
-  bccheck2="[g++]"
-;;
-*clang*)
-  bccheck1="[clang]"
-  bccheck2="[clang++]"
-;;
-esac
-
-AC_PROG_CC($bccheck1)
-AC_PROG_CXX($bccheck2)
-
-bachCCOMPILER=""
-case "${CC}" in
-*gcc*)
-  bachCCOMPILER=gcc
-;;
-*clang*)
-  bachCCOMPILER=clang
-;;
-*)
-  bachCCOMPILER=unknown
-;;
-esac
-
-if test "$bachCCOMPILER" != "gcc" ; then
-  # No, autoconf, no! Bad autoconf!
-  # We do not have GCC! I'm telling you!
-  # (though, to be fair, it's not entirely your fault)
-  GCC="no"
-fi
 
 
-# check for gcc version if using gcc
-if test $bachCCOMPILER = gcc; then
-  gccversion=`$CC -dumpversion`
-  gxxversion=`$CXX -dumpversion`
-  if test "x${gccversion}" != "x${gxxversion}"; then
-    echo "gcc is version ${gccversion} while g++ is version ${gxxversion}"
-    echo "This is not a sane environment, both versions should be the same (>=4.9.1). Stopping here."
-    exit 10
-  fi
-  GCC_VERSION_MAJOR=$(echo $gccversion | cut -d'.' -f1)
-  GCC_VERSION_MINOR=$(echo $gccversion | cut -d'.' -f2)
-  gccgoodversion="no"
-  gccgoodversion="yes"
-  if test ${GCC_VERSION_MAJOR} -ge 4; then
-    if test ${GCC_VERSION_MAJOR} -ge 5; then
-      gccgoodversion="yes"
-    elif test ${GCC_VERSION_MINOR} -ge 9; then
-      gccgoodversion="yes"
-    fi
-  fi
-  if test "${gccgoodversion}" = "no"; then
-    echo
-    echo "When using gcc, you need to have gcc >= 4.9.x. You have only" $gccversion", aborting."
-    exit 10
-  fi
-fi
+
+AC_PROG_CC
+AC_PROG_CXX
+
 
 
 
-# checks for BOOST and libraries behind the checks for 64 bit as some
+
+# checks for BOOST and libraries behind the checks for 64 bit as some 
 #  rescue values and compiler flags depend on the 64 bit enabled/not
 #  enabled result
 
@@ -160,7 +94,14 @@ fi
 # adapted from EMBOSS configure.in
 # ---------------------------------------------------------------------------
 
-echo
+dnl Test whether --with-sgiabi given for IRIX (n32m3 n32m4 64m3 64m4)
+if test "${systemuname}" = "IRIX" || test "${systemuname}" = "IRIX64" ; then
+  if test "$CC" != "gcc"; then
+    CHECK_SGI
+  fi
+fi
+
+echo 
 echo "+++++++++++++++++++++++++++++++++++++"
 echo "systemuname: ${systemuname}"
 echo "CFLAGS now: ${CFLAGS}"
@@ -169,7 +110,7 @@ echo "LDFLAGS now: ${LDFLAGS}"
 echo "+++++++++++++++++++++++++++++++++++++"
 
 AC_ARG_ENABLE(64,
-	AC_HELP_STRING([--enable-64],
+	AC_HELP_STRING([--enable-64], 
 	[enables 64 bit compiling, use 'no' for 32 bit on 64 bit machines, default is dependend of your compiler defaults]))
 
 # check whether compiler handles 64 bit types
@@ -179,60 +120,60 @@ AC_CHECK_TYPE(int64_t,has_int64_t="yes",has_int64_t="no")
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
      #include <sys/types.h>
      #include <limits.h>
-]], [[
+]], [[  
      #if LONG_MAX!=0x7fffffffffffffff
      #error The long definition is other than 8 byte. Try setting right compiler options.
      #endif
 ]])],[
   silenthas_int64_t="yes"
-],[
+],[ 
   silenthas_int64_t="no"
 ])
 
 # if 64 bit was not forbidden or silent check for 64 succeeded
 if test "${enable_64}" != "no" || test "${silenthas_int64_t}" = "yes" ; then
 
-  # Test for Linux 64 bit
+  dnl Test for Linux 64 bit
   if test "${systemuname}" = "Linux"; then
     CXXFLAGS="-DAJ_Linux64 $CXXFLAGS"
   fi
-
-  # Test for FreeBSD 64 bit
+  
+  dnl Test for FreeBSD 64 bit
   if test "${systemuname}" = "FreeBSD"; then
     CXXFLAGS="-DAJ_FreeBSD64 $CXXFLAGS"
   fi
-
-  # Test for OSF1 64 bit (its always this anyway)
+  
+  dnl Test for OSF1 64 bit (its always this anyway)
   if test "${systemuname}" = "OSF1"; then
     CXXFLAGS="-DAJ_OSF164 $CXXFLAGS"
   fi
-
-  # Test for SGI 64 bit
+  
+  dnl Test for SGI 64 bit
   if test "${systemuname}" = "IRIX" || test "${systemuname}" = "IRIX64"; then
     CXXFLAGS="-DAJ_IRIX64 $CXXFLAGS"
   fi
-
-  # Test for AIX 64 bit
+  
+  dnl Test for AIX 64 bit
   if test "${systemuname}" = "AIX"; then
     CXXFLAGS="-DAJ_AIX64 $CXXFLAGS"
-    if test $bachCCOMPILER != gcc; then
+    if test "$CC" != "gcc"; then
       CC="$CC -q64"
     fi
     NM="nm -B -X 64"
     AR="ar -X 64"
   fi
-
-  # Test for HP-UX 64 bit
+  
+  dnl Test for HP-UX 64 bit
   if test "${systemuname}" = "HP-UX"; then
-    if test $bachCCOMPILER != gcc; then
+    if test "$CC" != "gcc"; then
       CC="$CC +DD64"
     fi
     CXXFLAGS="-DAJ_HPUX64 $CXXFLAGS"
   fi
 
-  # Test for Solaris 64 bit
+  dnl Test for Solaris 64 bit
   if test "${systemuname}" = "SunOS"; then
-    if test $bachCCOMPILER = gcc; then
+    if test "$CC" = "gcc"; then
       CFLAGS="$CFLAGS -m64"
       CXXFLAGS="$CXXFLAGS -m64"
       LDFLAGS="$LDFLAGS -m64"
@@ -241,7 +182,7 @@ if test "${enable_64}" != "no" || test "${silenthas_int64_t}" = "yes" ; then
 
 fi
 
-echo
+echo 
 echo "+++++++++++++++++++++++++++++++++++++"
 echo "CFLAGS now: ${CFLAGS}"
 echo "CXXFLAGS now: ${CXXFLAGS}"
@@ -253,14 +194,14 @@ AC_MSG_CHECKING(whether long has 64bit)
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
      #include <sys/types.h>
      #include <limits.h>
-]], [[
+]], [[  
      #if LONG_MAX!=0x7fffffffffffffffL
      #error The long definition is other than 8 byte. Try setting right compiler options.
      #endif
 ]])],[
   has_int64_t="yes"
   AC_MSG_RESULT(yes)
-],[
+],[ 
   has_int64_t="no"
   AC_MSG_RESULT(no)
 ])
@@ -297,7 +238,7 @@ else
     if test "${has_int64_t}" = "yes"; then
       # well, we are on 64 bit, but 64 bit support should be switched off
       # let's see whether we can do it with gcc (with others I don't know)
-      if test $bachCCOMPILER = gcc; then
+      if test "$CC" = "gcc"; then
 	 oldCFLAGS=${CFLAGS}
 	 if test "${systemuname}" = "Darwin"; then
 	   C32FLAGS="-arch i386"
@@ -323,45 +264,13 @@ else
      # on Apple, the test above behaves a bit differently and in
      #  64 bit environment compiling for 32 bits we may land here
      #  just add the -arch flag if gcc is used
-     if test $bachCCOMPILER = gcc; then
+     if test "$CC" = "gcc"; then
        CFLAGS="${CFLAGS} -arch i386"
        CXXFLAGS="${CXXFLAGS} -arch i386"
      fi
    fi
 fi
 
-# circumvent the botch linker with explicit template instantiation on OSX gcc
-if test $bachCCOMPILER = gcc; then
-  if test "${systemuname}" = "Darwin"; then
-    AC_DEFINE_UNQUOTED(BOTCHEDEXPLICITINSTANTIATIONLINKER)
-  fi
-fi
-
-
-# having this before AC_CANONICAL_BUILD sets the correct CPU info in ${build_os}
-#
-# and we need 10.6 instead of 10.5 as for 10.5, the linker creates a binary like
-# this
-#  /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1669.0.0)
-#  /opt/localwgcc48/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
-#  /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)
-#
-# which does not run on a couple of other OSX installations
-#
-# with clang as compiler, we even need 10.7
-
-if test "${systemuname}" = "Darwin"; then
-  case "${CC}" in
-    *clang*)
-      CFLAGS="-mmacosx-version-min=10.7 ${CFLAGS}"
-      CXXFLAGS="-mmacosx-version-min=10.7 ${CXXFLAGS}"
-    ;;
-    *)
-      CFLAGS="-mmacosx-version-min=10.6 ${CFLAGS}"
-      CXXFLAGS="-mmacosx-version-min=10.6 ${CXXFLAGS}"
-    ;;
-  esac
-fi
 
 AC_CANONICAL_BUILD
 #AC_CANONICAL_TARGET
@@ -376,11 +285,11 @@ else
   # first, set the BITPACKAGE to something which is hopefully correct
   case "${build_cpu}" in
   *x86_64*)
-	mirabp=`echo ${build_cpu} | ${SED} -e 's/x86_64/i386/'`
+	mirabp=`echo ${build_cpu} | sed -e 's/x86_64/i386/'`
 	AC_SUBST(BITPACKAGE,${mirabp})
   ;;
   *64*)
-	mirabp=`echo ${build_cpu} | ${SED} -e 's/64/32/'`
+	mirabp=`echo ${build_cpu} | sed -e 's/64/32/'`
 	AC_SUBST(BITPACKAGE,${mirabp})
   ;;
   *)
@@ -392,28 +301,19 @@ fi
 
 
 # ---------------------------------------------------------------------------
-# Set optimisation flags
+dnl Set optimisation flags
 # ---------------------------------------------------------------------------
 if test "${enable_optimisations+set}" != "set"; then
   enable_optimisations="yes"
 fi
 AC_ARG_ENABLE(optimisations,
-	AC_HELP_STRING([--enable-optimisations],
+	AC_HELP_STRING([--enable-optimisations], 
 	[enables compiler optimisations, default is yes]))
 
-AC_ARG_ENABLE(native,
-	AC_HELP_STRING([--enable-native],
-	[compile only for your specific processor, default is no]))
-
-if test "${enable_native+set}" != "set"; then
-  enable_native="no"
-fi
-
-
 if test "${enable_optimisations}" = "yes" ; then
   AC_MSG_CHECKING(for compiler optimisation settings)
-
-  if test $bachCCOMPILER = gcc; then
+  
+  if test "$CC" = "gcc"; then
     # For GCC, be conservative for all plattforms except the ones where
     #  -O3 is known to work
 
@@ -426,61 +326,53 @@ if test "${enable_optimisations}" = "yes" ; then
       OPTFLAGS="-O3 -funroll-loops"
     fi
 
-    # native?
-    if test "${enable_native}" = "yes" ; then
-      OPTFLAGS+=" -march=native -mtune=native"
-#    else
-#      # tuning for the compiler we currently build on is not a too bad idea
-#      # or is it?
-#      OPTFLAGS+=" -mtune=native"
-    fi
-
+  
   else
-
+  
     # default
     OPTFLAGS="-O2"
-
-    # Test for AIX optimisation
+    
+    dnl Test for AIX optimisation
     if test "${systemuname}" = "AIX"; then
       OPTFLAGS="-O3 -qstrict -qarch=auto -qtune=auto"
     fi
-
-    # test for SGI optimisation
+    
+    dnl test for SGI optimisation
     if test "${systemuname}" = "IRIX" || test "${systemuname}" = "IRIX64" ; then
       LD="/usr/bin/ld -IPA"
       OPTFLAGS="-O3"
     fi
-
-    # Test for HP-UX optimisation
+    
+    dnl Test for HP-UX optimisation
     if test "${systemuname}" = "HP-UX"; then
       OPTFLAGS="-fast"
     fi
-
-    # Test for OSF1 optimisation
+    
+    dnl Test for OSF1 optimisation
     if test "${systemuname}" = "OSF1"; then
     OPTFLAGS="-fast -U_FASTMATH"
     fi
-
-    # test for Solaris optimisation
+    
+    dnl test for Solaris optimisation
     if test "${systemuname}" = "SunOS"; then
       OPTFLAGS="-O"
-    # test for 64 bit ptr here (see Solaris 64bit above)
+    dnl test for 64 bit ptr here (see Solaris 64bit above)
       if test "${enable_64}" = "yes" ; then
         OPTFLAGS="-xtarget=ultra -xarch=v9"
       fi
     fi
-
-    # Test for Linux optimisation
+    
+    dnl Test for Linux optimisation
     if test "${systemuname}" = "Linux"; then
       OPTFLAGS="-O2"
     fi
-
-    # Test for FreeBSD optimisation
+    
+    dnl Test for FreeBSD optimisation
     if test "${systemuname}" = "FreeBSD"; then
       OPTFLAGS="-O2"
     fi
-
-    # Intel MacOSX requires reduced optimisation for PCRE code
+    
+    dnl Intel MacOSX requires reduced optimisation for PCRE code
     if test "${systemuname}" = "Darwin"; then
       if test "`uname -a | grep i386`"; then
         OPTFLAGS="-O1"
@@ -489,59 +381,59 @@ if test "${enable_optimisations}" = "yes" ; then
       fi
     fi
   fi
-
+  
   CFLAGS="${CFLAGS} ${OPTFLAGS}"
   CXXFLAGS="${CXXFLAGS} ${OPTFLAGS}"
 
   AC_MSG_RESULT(${OPTFLAGS})
 fi
-# End of optimisation tests
+dnl End of optimisation tests
 # ---------------------------------------------------------------------------
 
 
 # ---------------------------------------------------------------------------
-# Set special system/compiler combo flags
+dnl Set special system/compiler combo flags
 # ---------------------------------------------------------------------------
-
-if test $bachCCOMPILER != gcc; then
+  
+if test "$CC" != "gcc"; then
    COMBOFLAGS=""
 
-  # Test for AIX optimisation
+  dnl Test for AIX optimisation
   if test "${systemuname}" = "AIX"; then
    COMBOFLAGS=""
   fi
-
-  # test for SGI optimisation
+  
+  dnl test for SGI optimisation
   if test "${systemuname}" = "IRIX" || test "${systemuname}" = "IRIX64" ; then
    COMBOFLAGS=""
   fi
-
-  # Test for HP-UX optimisation
+  
+  dnl Test for HP-UX optimisation
   if test "${systemuname}" = "HP-UX"; then
     COMBOFLAGS="-Aa +nostl"
   fi
-
-  # Test for OSF1 optimisation
+  
+  dnl Test for OSF1 optimisation
   if test "${systemuname}" = "OSF1"; then
    COMBOFLAGS=""
   fi
-
-  # test for Solaris optimisation
+  
+  dnl test for Solaris optimisation
   if test "${systemuname}" = "SunOS"; then
    COMBOFLAGS=""
   fi
-
-  # Test for Linux optimisation
+  
+  dnl Test for Linux optimisation
   if test "${systemuname}" = "Linux"; then
    COMBOFLAGS=""
   fi
-
-  # Test for FreeBSD optimisation
+  
+  dnl Test for FreeBSD optimisation
   if test "${systemuname}" = "FreeBSD"; then
    COMBOFLAGS=""
   fi
-
-  # Intel MacOSX requires reduced optimisation for PCRE code
+  
+  dnl Intel MacOSX requires reduced optimisation for PCRE code
   if test "${systemuname}" = "Darwin"; then
     COMBOFLAGS=""
   fi
@@ -549,19 +441,18 @@ if test $bachCCOMPILER != gcc; then
   CFLAGS="${CFLAGS} ${COMBOFLAGS}"
   CXXFLAGS="${CXXFLAGS} ${COMBOFLAGS}"
 fi
-
-# End of special combo flags
+  
+dnl End of special combo flags
 # ---------------------------------------------------------------------------
 
 
 
-# Add extensions to Solaris for some reentrant functions
+dnl Add extensions to Solaris for some reentrant functions
 if test "${systemuname}" = "SunOS"; then
   CFLAGS="$CFLAGS -D__EXTENSIONS__"
 fi
 
-# Building on OSX is ... difficult.
-# Static building in OSX is ... even more difficult.
+# Static building in OSX is ... difficult.
 #  - Apple has taken out "-static" from allowed linker flags
 #  - ld on OSX does not understand -Wl,-Bstatic or -Bdynamic
 #  - the only way to statically link BOOST and zlib is to have the linker
@@ -574,52 +465,30 @@ fi
 #    will be searched *before* all other system libraries
 
 if test "${systemuname}" = "Darwin"; then
-  # this is a solution from http://hackage.haskell.org/trac/ghc/ticket/5019
-  # to the exception handling problem of gcc and the changed OSX functionality
-  if test $bachCCOMPILER = gcc; then
-    LDFLAGS="-Wl,-no_compact_unwind ${LDFLAGS}"
-  fi
-
   if test "${enable_mirastatic}" = "yes" ; then
-    # two hack dirs used. The OSXstatlibs_bach is for my personal setup and building SourceForge releases
-    # the dir without _bach is for users
     echo
     echo "OSX system detected, and we want static build."
     osxstatlibdirhack="`pwd`/OSXstatlibs"
-    osxstatlibdirhack_bach="`pwd`/OSXstatlibs_bach"
-    rm -rf ${osxstatlibdirhack_bach}
-    mkdir ${osxstatlibdirhack_bach}
-    (cd ${osxstatlibdirhack_bach}; ln -s /opt/biosw/lib/*a .; cd ..)
-    (cd ${osxstatlibdirhack_bach}; ln -s /opt/local/lib/gcc49/*a .; cd ..)
-    (cd ${osxstatlibdirhack_bach}; ln -s /opt/local/lib/libbz2.a .; ln -s /opt/local/lib/libexpat.a .; cd ..)
-    LDFLAGS="-L${osxstatlibdirhack} -L${osxstatlibdirhack_bach} -Wl,-search_paths_first ${LDFLAGS}"
+    rm -rf ${osxstatlibdirhack}
+    mkdir ${osxstatlibdirhack}
+    (cd ${osxstatlibdirhack}; ln -s /opt/local/lib/*a .; cd ..)
+    LDFLAGS="-L${osxstatlibdirhack} -Wl,-search_paths_first ${LDFLAGS}"
 
     # note: putting osxstatlibdirhack in LDFLAGS here is pretty futile
     #  as that idiotic libtool will reorder LDFLAGS and insert the standard
     #  path *before* it, negating our wish to link to static libs
     # Solution: BLOODYDARWINSTATLIBDIRHACK is set in src/progs/Makefile.am
     #  via AM_LDFLAGS, so it will appear still before the standard path *phew*
-    #
-    # And we need to tell gcc/ld our explicit wish to link the C and C++ std lib
-    #  statically ... why it does not do that when seeing -static is a mystery to
-    #  me
-    # Note 08.09.2013:
-    # static linking of libgcc and libstdc++ is a bad idea, leads to abort trap 6
-    # We're going the bundle way now.
-    #
     # But we must export BLOODYDARWINSTATLIBDIRHACK for that
-    BLOODYDARWINSTATLIBDIRHACK=" -L${osxstatlibdirhack_bach} -L${osxstatlibdirhack}"
+    BLOODYDARWINSTATLIBDIRHACK="-L${osxstatlibdirhack}"
   fi
-  BUNDLETARGET=darwin
 else
   BLOODYDARWINSTATLIBDIRHACK=""
-  BUNDLETARGET=nobundle
 fi
 AC_SUBST(BLOODYDARWINSTATLIBDIRHACK,${BLOODYDARWINSTATLIBDIRHACK})
-AC_SUBST(BUNDLETARGET,${BUNDLETARGET})
 
 
-echo
+echo 
 echo "+++++++++++++++++++++++++++++++++++++"
 echo "CFLAGS now: ${CFLAGS}"
 echo "CXXFLAGS now: ${CXXFLAGS}"
@@ -634,19 +503,18 @@ echo "+++++++++++++++++++++++++++++++++++++"
 # Libtool
 LT_INIT
 
-# Checks for other programs.
+# Checks for programs.
 
 AC_PROG_MAKE_SET
 AC_PROG_LN_S
+AC_PROG_SED
 # we want flex, and not only lex
-AC_CHECK_PROG([FLEX], [flex],[yes],[no])
+AC_CHECK_PROG([FLEX], [flex])
 # but this seems to be needed as well to set some include file correctly
 # (seen on SuSE SLES 9)
 AC_PROG_LEX
 # and we need flex++
 AC_CHECK_PROG([FLEXPP],[flex++],[yes],[no])
-# and xxd
-AC_CHECK_PROG([HAVE_XXD], [xxd],[yes],[no])
 
 # Checks for header files.
 AC_HEADER_STDC
@@ -676,7 +544,7 @@ AC_FUNC_FSEEKO
 #
 # Copyright (c) 1994-1996, 1998-2008
 #         Todd C. Miller <Todd.Miller at courtesan.com>
-#
+# 
 #    Permission to use, copy, modify, and distribute this software for any
 #    purpose with or without fee is hereby granted, provided that the above
 #    copyright notice and this permission notice appear in all copies.
@@ -696,44 +564,60 @@ AC_DEFUN([SUDO_FUNC_ISBLANK],
 
 SUDO_FUNC_ISBLANK
 
-echo
+echo 
 echo "+++++++++++++++++++++++++++++++++++++"
 echo "CFLAGS now: ${CFLAGS}"
 echo "CXXFLAGS now: ${CXXFLAGS}"
 echo "LDFLAGS now: ${LDFLAGS}"
 echo "+++++++++++++++++++++++++++++++++++++"
 
+AC_CXX_HAVE_STD
+AC_CXX_HAVE_STL
 
-# check BOOST before anything else, it's a prime candidate
-#  for being installed by the system (/usr/...) but as well
-#  in another (newer?) version somewhere else.
-# so make sure the include flags from boost come first
 
-AX_BOOST_BASE([1.48.0])
+echo 
+echo "+++++++++++++++++++++++++++++++++++++"
+echo "CFLAGS now: ${CFLAGS}"
+echo "CXXFLAGS now: ${CXXFLAGS}"
+echo "LDFLAGS now: ${LDFLAGS}"
+echo "+++++++++++++++++++++++++++++++++++++"
 
-echo
+AX_WITH_PERL([no])
+
+AX_LIB_EXPAT
+if test "${HAVE_EXPAT}" = "yes"; then
+  CFLAGS="$CFLAGS ${EXPAT_CFLAGS}"
+  CXXFLAGS="$CXXFLAGS ${EXPAT_CFLAGS}"
+  LDFLAGS="${LDFLAGS} ${EXPAT_LDFLAGS}"
+fi
+
+echo 
+echo "+++++++++++++++++++++++++++++++++++++"
+echo "CFLAGS now: ${CFLAGS}"
+echo "CXXFLAGS now: ${CXXFLAGS}"
+echo "LDFLAGS now: ${LDFLAGS}"
+echo "+++++++++++++++++++++++++++++++++++++"
+
+AX_CHECK_ZLIB()
+
+echo 
+echo "+++++++++++++++++++++++++++++++++++++"
+echo "CFLAGS now: ${CFLAGS}"
+echo "CXXFLAGS now: ${CXXFLAGS}"
+echo "LDFLAGS now: ${LDFLAGS}"
+echo "+++++++++++++++++++++++++++++++++++++"
+
+AX_BOOST_BASE([1.35.0])
+
+echo 
 echo "+++++++++++++++++++++++++++++++++++++"
 echo " BOOST_CPPFLAGS:    ${BOOST_CPPFLAGS}"
 echo " BOOST LDFLAGS:     ${BOOST_LDFLAGS}"
-echo " ac_boost_path:     ${ac_boost_path}"
-echo " ac_boost_lib_path: ${ac_boost_lib_path}"
 echo "CFLAGS now: ${CFLAGS}"
 echo "CXXFLAGS now: ${CXXFLAGS}"
 echo "LDFLAGS now: ${LDFLAGS}"
 echo "+++++++++++++++++++++++++++++++++++++"
 
-# if the user gave --with-boost but no --with-boost-libdir, set it automatically
-# because if not, the checks which need to link further down might fail
-if test "${ac_boost_path}" != "" ; then
-  if test "${ac_boost_lib_path}" = "" ; then
-    ac_boost_lib_path=${ac_boost_path}/lib
-    echo "Setting rescue value for ac_boost_lib_path: ${ac_boost_lib_path}"
-    echo "If the rescue value is wrong, use --with-boost-libdir=/path/to/dir/with/boostlibs"
-    # replace or append? atm replace
-    BOOST_LDFLAGS="-L${ac_boost_lib_path}"
-  fi
-fi
-
 # I have no idea why I need this ... but looks like
 #  the autoconf macros have problems in automatically finding
 #  the best paths on some systems
@@ -793,18 +677,7 @@ if test "${BOOST_LDFLAGS}" = "" ; then
   echo "Setting rescue value: ${BOOST_LDFLAGS}"
 fi
 
-
-# some of the BOOST checks below break on older systems with newer BOOSTs
-# e.g., boost_thread implicitly needs boost_clock and boost_system,
-#  but the linker on KUbuntu 9.10 somehow does not find them automatically
-# Way out: for the boost checks, set the linker rpath to include boost lib path
-#  (only valid for gcc)
-oldCFLAGS=${CFLAGS}
-if test $bachCCOMPILER = gcc; then
-  CFLAGS="${CFLAGS} -Wl,-rpath,${ac_boost_lib_path}"
-fi
-
-echo
+echo 
 echo "+++++++++++++++++++++++++++++++++++++"
 echo " BOOST_CPPFLAGS:    ${BOOST_CPPFLAGS}"
 echo " BOOST LDFLAGS:     ${BOOST_LDFLAGS}"
@@ -815,7 +688,7 @@ echo "+++++++++++++++++++++++++++++++++++++"
 
 AX_BOOST_THREAD
 
-echo
+echo 
 echo "+++++++++++++++++++++++++++++++++++++"
 echo " BOOST_CPPFLAGS:    ${BOOST_CPPFLAGS}"
 echo " BOOST LDFLAGS:     ${BOOST_LDFLAGS}"
@@ -868,13 +741,12 @@ if test "${BOOST_THREAD_LIB}" = "" ; then
       echo "or --with-boost-libdir=LIB_DIR"
       echo "or --with-boost-thread[=special-lib]"
   fi
-  echo
+  echo 
   AC_MSG_ERROR([[Stopping here as BOOST thread lib must be available at this stage. Sorry.]])
 fi
 
 CXXFLAGS="${CXXFLAGS} ${BOOST_CPPFLAGS}"
-LDFLAGS="${LDFLAGS} ${BOOST_LDFLAGS}"
-LIBS="${LIBS} ${BOOST_THREAD_LIB}"
+LDFLAGS="${LDFLAGS} ${BOOST_LDFLAGS} ${BOOST_THREAD_LIB}"
 
 echo "+++++++++++++++++++++++++++++++++++++"
 echo " BOOST_CPPFLAGS:    ${BOOST_CPPFLAGS}"
@@ -882,13 +754,13 @@ echo " BOOST LDFLAGS:     ${BOOST_LDFLAGS}"
 echo " ac_boost_path:     ${ac_boost_path}"
 echo " ac_boost_lib_path: ${ac_boost_lib_path}"
 echo " BOOST_THREAD_LIB:  ${BOOST_THREAD_LIB}"
-echo
+echo 
 echo "CFLAGS now: ${CFLAGS}"
 echo "CXXFLAGS now: ${CXXFLAGS}"
 echo "LDFLAGS now: ${LDFLAGS}"
-echo "LIBS now: ${LIBS}"
 echo "+++++++++++++++++++++++++++++++++++++"
 
+
 AX_BOOST_REGEX
 
 echo "+++++++++++++++++++++++++++++++++++++"
@@ -899,142 +771,16 @@ echo " ac_boost_lib_path: ${ac_boost_lib_path}"
 echo " BOOST_REGEX_LIB:   ${BOOST_REGEX_LIB}"
 echo
 
-LIBS="${LIBS} ${BOOST_REGEX_LIB}"
-
-echo "CFLAGS now: ${CFLAGS}"
-echo "CXXFLAGS now: ${CXXFLAGS}"
-echo "LIBS now: ${LIBS}"
-echo "+++++++++++++++++++++++++++++++++++++"
-
-# BOOST_FILESYSTEM will need BOOST_SYSTEM on Macs
-AX_BOOST_SYSTEM
-
-echo "+++++++++++++++++++++++++++++++++++++"
-echo " BOOST_CPPFLAGS:    ${BOOST_CPPFLAGS}"
-echo " BOOST LDFLAGS:     ${BOOST_LDFLAGS}"
-echo " ac_boost_path:     ${ac_boost_path}"
-echo " ac_boost_lib_path: ${ac_boost_lib_path}"
-echo " BOOST_SYSTEM_LIB:   ${BOOST_SYSTEM_LIB}"
-echo
-
-LIBS="${LIBS} ${BOOST_SYSTEM_LIB}"
-
-echo "CFLAGS now: ${CFLAGS}"
-echo "CXXFLAGS now: ${CXXFLAGS}"
-echo "LIBS now: ${LIBS}"
-echo "+++++++++++++++++++++++++++++++++++++"
-
-AX_BOOST_FILESYSTEM
-
-echo "+++++++++++++++++++++++++++++++++++++"
-echo " BOOST_CPPFLAGS:    ${BOOST_CPPFLAGS}"
-echo " BOOST LDFLAGS:     ${BOOST_LDFLAGS}"
-echo " ac_boost_path:     ${ac_boost_path}"
-echo " ac_boost_lib_path: ${ac_boost_lib_path}"
-echo " BOOST_FILESYSTEM_LIB:   ${BOOST_FILESYSTEM_LIB}"
-echo
-
-LIBS="${LIBS} ${BOOST_FILESYSTEM_LIB}"
-
-echo "CFLAGS now: ${CFLAGS}"
-echo "CXXFLAGS now: ${CXXFLAGS}"
-echo "LIBS now: ${LIBS}"
-echo "+++++++++++++++++++++++++++++++++++++"
-
-
-AX_BOOST_IOSTREAMS
-
-echo "+++++++++++++++++++++++++++++++++++++"
-echo " BOOST_CPPFLAGS:    ${BOOST_CPPFLAGS}"
-echo " BOOST LDFLAGS:     ${BOOST_LDFLAGS}"
-echo " ac_boost_path:     ${ac_boost_path}"
-echo " ac_boost_lib_path: ${ac_boost_lib_path}"
-echo " BOOST_IOSTREAMS_LIB:   ${BOOST_IOSTREAMS_LIB}"
-echo
-
-# The "-lz" here is no error: else it does not link on Trinity, no matter where I put -lz
-#  in the Makefile-am of src/progs :-(
-
-LIBS="${LIBS} ${BOOST_IOSTREAMS_LIB}"
-
-echo "CFLAGS now: ${CFLAGS}"
-echo "CXXFLAGS now: ${CXXFLAGS}"
-echo "LIBS now: ${LIBS}"
-echo "+++++++++++++++++++++++++++++++++++++"
-
-
-
-# check whether rt library is needed. BOOST thread needs
-#  clock_gettime, on some systems it's in rt lib which is
-#  NOT automatically used
-# problem: AC_CHECK_LIB prepends -lrt to LIBS, we need
-# to have it *after* the boost libs
-oldLIBS=$LIBS
-AC_CHECK_LIB(rt, clock_gettime)
-if test "${LIBS}" != "${oldLIBS}"; then
-  LIBS="$oldLIBS -lrt"
-  echo "+++++++++++++++++++++++++++++++++++++"
-  echo "Need to specifically use rt library"
-  echo "LIBS now: ${LIBS}"
-  echo "+++++++++++++++++++++++++++++++++++++"
-fi
-
-
-CFLAGS=${oldCFLAGS}
-
-# check for expat and zlib
-
-# BaCh 2013-03-08: AX_LIB_EXPAT serial 9 overwrites $LIBS! Make sure to use at least serial 10
-
-AX_LIB_EXPAT
-if test "${HAVE_EXPAT}" = "yes"; then
-  CFLAGS="$CFLAGS ${EXPAT_CFLAGS}"
-  CXXFLAGS="$CXXFLAGS ${EXPAT_CFLAGS}"
-  LDFLAGS="${LDFLAGS} ${EXPAT_LDFLAGS}"
-  LIBS="${LIBS} ${EXPAT_LIBS}"
-fi
-
-
-echo
-echo "+++++++++++++++++++++++++++++++++++++"
-echo "CFLAGS now: ${CFLAGS}"
-echo "CXXFLAGS now: ${CXXFLAGS}"
-echo "LDFLAGS now: ${LDFLAGS}"
-echo "LIBS now: ${LIBS}"
-echo "+++++++++++++++++++++++++++++++++++++"
-
-# check for zlib
-AX_CHECK_ZLIB()
-LIBS="${LIBS} -lm -lz"
-
-echo
-echo "+++++++++++++++++++++++++++++++++++++"
+LDFLAGS="${LDFLAGS} ${BOOST_REGEX_LIB}"
+ 
 echo "CFLAGS now: ${CFLAGS}"
 echo "CXXFLAGS now: ${CXXFLAGS}"
 echo "LDFLAGS now: ${LDFLAGS}"
-echo "LIBS now: ${LIBS}"
 echo "+++++++++++++++++++++++++++++++++++++"
 
-AC_LANG_SAVE
-AC_LANG_C
-AC_CHECK_LIB([z], [gzoffset], [zlib_havegzoffset=yes], [zlib_havegzoffset=no])
-AC_LANG_RESTORE
-if test "$zlib_havegzoffset" = "yes"; then
-  AC_DEFINE_UNQUOTED(HAVE_GZOFFSET)
-fi
-
-have_bz2="no"
-AC_CHECK_LIB([bz2], [BZ2_bzRead], [have_bz2="yes"], [])
-
-if test "${have_bz2}" = "yes"; then
-  LIBS="${LIBS} -lbz2"
-fi
-
-#ZLIB_VERSION=`$EGREP "define ZLIB_VERSION" $ZLIB_HOME/include/zlib.h | $SED -e 's/[[^0-9\.]]//g'`
-#AC_MSG_RESULT([$ZLIB_VERSION])
 
 # ---------------------------------------------------------------------------
-# check for lex/flex version
+dnl check for lex/flex version
 # ---------------------------------------------------------------------------
 flexgoodversion="unknown"
 if test "${LEX}" = "flex"; then
@@ -1083,8 +829,8 @@ fi
 
 
 # ---------------------------------------------------------------------------
-# Set flag whether building environment is known to work
-# Additionally, if special things are needed, set them here.
+dnl Set flag whether building environment is known to work
+dnl Additionally, if special things are needed, set them here.
 # ---------------------------------------------------------------------------
 buildenvworks="unknown"
 if test "${systemuname}" = "Darwin"; then
@@ -1103,7 +849,7 @@ fi
 
 
 
-# Test if --enable-debug given
+dnl Test if --enable-debug given
 AC_ARG_ENABLE(debug,
 	      AC_HELP_STRING([--enable-debug=no/yes],
               [use 'yes' to enable debugging information in the executable)]))
@@ -1112,7 +858,7 @@ if test "${enable_debug}" = "yes" ; then
   CXXFLAGS="$CXXFLAGS -g"
 fi
 
-# Test if --enable-cxxdebug given
+dnl Test if --enable-cxxdebug given
 AC_ARG_ENABLE(cxxdebug,
 	      AC_HELP_STRING([--enable-cxxdebug=no/yes],
               [use 'yes' to enable debugging version of STL objects)]))
@@ -1121,103 +867,41 @@ if test "${enable_cxxdebug}" = "yes" ; then
   # CXXFLAGS="$CXXFLAGS -D_GLIBCXX_DEBUG"
 fi
 
-
-
-# Test if --enable-profile given
+dnl Test if --enable-profile given
 AC_ARG_ENABLE(profile,
 	      AC_HELP_STRING([--enable-profile=no/yes],
               [use 'yes' to have profile information in the executable)]))
-
-AC_MSG_CHECKING(for profiling settings)
 if test "${enable_profile}" = "yes" ; then
   CFLAGS="$CFLAGS -pg"
   CXXFLAGS="$CXXFLAGS -pg"
   LDFLAGS="${LDFLAGS} -pg"
-else
-  enable_profile="no"
 fi
-AC_MSG_RESULT(${enable_profile})
-
-## -flto (link-time-optimiser) for gcc
-## not always supported yet, does not work well will -pg
-## therefore enable it only if -pg not used
-#if test $bachCCOMPILER = gcc; then
-#  if test "${enable_profile}" != "yes" ; then
-#    AC_MSG_CHECKING(for using gcc -flto)
-#    canuseflto="no";
-#    oldCFLAGS="$CFLAGS"
-#    CFLAGS="$CFLAGS -flto"
-#    AC_TRY_COMPILE(, [return 0;], [canuseflto="yes"],)
-#    CFLAGS="$oldCFLAGS"
-#    AC_MSG_RESULT(${canuseflto})
-#    if test "${canuseflto}" = "yes" ; then
-#      CFLAGS="$CFLAGS -flto"
-#      CXXFLAGS="$CXXFLAGS -flto"
-#    fi
-#  fi
-#fi
-
-
-
-# Turn off irritating linker warnings in IRIX
+
+dnl Turn off irritating linker warnings in IRIX
 if test "${systemuname}" = "IRIX" || test "${systemuname}" = "IRIX64"; then
   CFLAGS="-Wl,-LD_MSG:off=85:off=84:off=16:off=134 $CFLAGS"
   CXXFLAGS="-Wl,-LD_MSG:off=85:off=84:off=16:off=134 $CXXFLAGS"
 fi
 
 
-# Test if --enable-warnings given
+dnl Test if --enable-warnings given
 AC_ARG_ENABLE(warnings,
 	      AC_HELP_STRING([--enable-warnings=no/yes],
               [use 'yes' to enable warnings (-W and other options on gcc compiler)]))
 if test "${enable_warnings}" = "yes" ; then
-  if test $bachCCOMPILER = gcc; then
-
-# that one pukes way too often with boost 1.50
-# -Wold-style-cast
+  if test "$CC" = "gcc"; then
+    CXXFLAGS="${CXXFLAGS} -W -Wstrict-prototypes -fdiagnostics-show-option -Wextra -Wshadow -fno-strict-aliasing -ansi -Wcast-align -Wcast-qual -Wchar-subscripts -Wpointer-arith -Wredundant-decls -Wwrite-strings -Wold-style-cast -Woverloaded-virtual -Wsign-promo -Wformat -Wimplicit -Wmissing-braces -Wparentheses -Wreturn-type -Wswitch -Wswitch-default -Wswitch-enum -Wunused -Wfloat-equal -Wendif-labels -Wconversion -Wdisabled-optimization -Wsequence-point -Werror=unused-value"
+    CFLAGS="${CFLAGS} -W -Wstrict-prototypes -fno-strict-aliasing -Wextra -ansi -Wbad-function-cast -Wcast-align -Wcast-qual -Wchar-subscripts -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-prototypes -Wwrite-strings -Wformat -Wimplicit -Wmissing-braces -Wparentheses -Wreturn-type -Wswitch -Wswitch-default -Wswitch-enum -Wunused -Wfloat-equal -Wendif-labels -Wconversion -Wdisabled-optimization -Wsequence-point -Werror=unused-value"
 
-    CXXFLAGS="${CXXFLAGS} -W -Wstrict-prototypes -fdiagnostics-show-option -Wextra -Wshadow -fno-strict-aliasing -ansi -Wcast-align -Wcast-qual -Wchar-subscripts -Wpointer-arith -Wredundant-decls -Wwrite-strings -Woverloaded-virtual -Wsign-promo -Wformat -Wimplicit -Wmissing-braces -Wparentheses -Wswitch -Wswitch-default -Wswitch-enum -Wunused -Wfloat-equal -Wendif-labels -Wconversion -Wdisabled-optimization -Wsequence-point -Werror=unused-value"
-    CFLAGS="${CFLAGS} -W -Wstrict-prototypes -fno-strict-aliasing -Wextra -ansi -Wbad-function-cast -Wcast-align -Wcast-qual -Wchar-subscripts -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-prototypes -Wwrite-strings -Wformat -Wimplicit -Wmissing-braces -Wparentheses -Wswitch -Wswitch-default -Wswitch-enum -Wunused -Wfloat-equal -Wendif-labels -Wconversion -Wdisabled-optimization -Wsequence-point -Werror=unused-value"
-
-  fi
-fi
-
-
-if test $bachCCOMPILER = gcc; then
-  CXXFLAGS="${CXXFLAGS} -Werror=uninitialized -Werror=return-type -Werror=parentheses"
-  CFLAGS="${CFLAGS} -Werror=uninitialized -Werror=return-type "
-fi
-
-# unused values may be a problem (e.g. using == in an assignment)
-if test $bachCCOMPILER = gcc; then
-  CXXFLAGS="${CXXFLAGS} -Werror=unused-value"
-fi
-
-# OK, we're using C++11/14, makes life a whole lot easier
-case "${bachCCOMPILER=unknown}" in
-*gcc*)
-  CXXFLAGS="${CXXFLAGS} -std=c++14"
-;;
-*clang*)
-  CXXFLAGS="${CXXFLAGS} -std=c++14 -stdlib=libc++"
-;;
-*)
-  echo "The compiler is not GCC nor clang and I need a flag to enable at least C++11 standard, please contact the author!"
-  exit 100;
-;;
-esac
-
-# hack for CygWin/gcc where mktmpnam and a couple of others are not impolemented in strict ansi
-# and -std=c++11 implies strict ansi
-if test $bachCCOMPILER = gcc; then
-  if test $build_os = cygwin ; then
-    CFLAGS="${CFLAGS} -U__STRICT_ANSI__"
-    CXXFLAGS="${CXXFLAGS} -U__STRICT_ANSI__"
+    if test "${enable_optimisations}" = "yes" ; then
+      CXXFLAGS="${CXXFLAGS} -Werror=uninitialized"
+      CFLAGS="${CFLAGS} -Werror=uninitialized"
+    fi
   fi
 fi
 
-# Test if purify exists and if --enable-purify given if so
-# set "-g"
+dnl Test if purify exists and if --enable-purify given if so
+dnl set "-g"
 AC_MSG_CHECKING(for purify)
 AC_ARG_ENABLE(purify,
 	      AC_HELP_STRING([--enable-purify=no/yes],
@@ -1229,9 +913,9 @@ if test "${enable_purify}" = "yes" ; then
 else
    AC_MSG_RESULT(no)
 fi
-# end of test for purify
+dnl end of test for purify
 
-# Set extra needed compiler flags
+dnl Set extra needed compiler flags
 if test "$CC" = "cc"; then
   case "$host" in
     alpha*-dec-osf*) CFLAGS="$CFLAGS -ieee";
@@ -1246,24 +930,24 @@ AM_CONDITIONAL(PURIFY, test "${enable_purify}" = "yes")
 # TCMalloc check from Google perftools package
 # ---------------------------------------------------------------------------
 
-tcmdefault="no"
+
+tcmdefault="yes"
 if test "${systemuname}" = "Darwin"; then
   tcmdefault="no"
 fi
 
-# make old calls using tcmalloc fail
-#AC_ARG_WITH(tcmalloc,
-#	[  --with-tcmalloc         Use tcmalloc memory allocation library. ],
-#	[ ], [ with_tcmalloc=${tcmdefault} ])
-#
-#AC_ARG_WITH(tcmalloc-dir,
-#	[  --with-tcmalloc-dir=LIB_DIR     search static tcmalloc library there. ],
-#	[ tcmalloc_dir=$withval], [ tcmalloc_dir=""])
+AC_ARG_WITH(tcmalloc,
+	[  --with-tcmalloc         Use tcmalloc memory allocation library. ],
+	[ ], [ with_tcmalloc=${tcmdefault} ])
+
+AC_ARG_WITH(tcmalloc-dir,
+	[  --with-tcmalloc-dir=LIB_DIR     search static tcmalloc library there. ],
+	[ tcmalloc_dir=$withval], [ tcmalloc_dir=""])
 
 linkwith_tcmalloc="no"
 
 if test "${with_tcmalloc}" = "yes"; then
-# store current *FLAGS and merge with AM_*FLAGS for compilation and linker check
+# store current *FLAGS and merge with AM_*FLAGS for compilation and linker check   
   OLD_CXXFLAGS=$CXXFLAGS;
   OLD_LDFLAGS=$LDFLAGS;
   CXXFLAGS="$AM_CXXFLAGS $CXXFLAGS"
@@ -1275,7 +959,7 @@ if test "${with_tcmalloc}" = "yes"; then
 
   # ensure the library to check for is covered by the LIBS variable
   OLD_LIBS=$LIBS
-
+  
   if test "x${tcmalloc_dir}" = "x" ; then
     LIBS="$LIBS -ltcmalloc_minimal"
   else
@@ -1286,7 +970,7 @@ if test "${with_tcmalloc}" = "yes"; then
     # there one must hope that LD_LIBRARY_PATH is set correctly
   fi
 
-
+  
   AC_LANG_PUSH([C++])
   # try to link the function 'XXX_functionName' out of library XXX
   AC_MSG_CHECKING([whether linking with tcmalloc works])
@@ -1297,9 +981,9 @@ if test "${with_tcmalloc}" = "yes"; then
           linkwith_tcmalloc="yes"
           HAVE_TCMALLOC="yes";],
       [AC_MSG_RESULT([no])
-          LIBS=$OLD_LIBS; # reset to old value since XXX was not found
+          LIBS=$OLD_LIBS; dnl reset to old value since XXX was not found
           HAVE_TCMALLOC="no";])
-
+  
   # reset original *FLAGS
   AC_LANG_POP([C++])
   CXXFLAGS=$OLD_CXXFLAGS
@@ -1309,6 +993,9 @@ fi
 
 
 
+
+
+
 # ---------------------------------------------------------------------------
 # MIRA specific flags and settings
 # ---------------------------------------------------------------------------
@@ -1317,51 +1004,71 @@ fi
 # Non-quiet mode has some extra output on stdout during assembly
 
 AC_MSG_CHECKING(whether mira should compile in public quiet mode)
-def_publicquietmira="yes"
-AC_ARG_ENABLE([publicquietmira],
-	AC_HELP_STRING([--enable-publicquietmira=yes/no],
+def_publicquietmira="yes" 
+AC_ARG_ENABLE([publicquietmira], 
+	AC_HELP_STRING([--enable-publicquietmira=yes/no], 
 	[use 'no' for a chatty version of MIRA, default is yes]),
 	[publicquietmira=$enableval],
-	[publicquietmira=$def_publicquietmira])
-if test "$publicquietmira" = "no"; then
+	[publicquietmira=$def_publicquietmira]) 
+if test "$publicquietmira" = "no"; then 
    CXXFLAGS="-DBE_AWARE_THAT_THIS_VERSION_OF_MIRA_MIGHT_BE_A_BIT_CHATTY ${CXXFLAGS}"
 else
    CXXFLAGS="-DPUBLICQUIET ${CXXFLAGS}"
-fi
+fi 
 AC_MSG_RESULT($publicquietmira)
 
 
+# development mode may have extra output on stdout
+#  as well as some additional data in the results which should not appear
+#  in real world data
+AC_MSG_CHECKING(whether mira should compile a development version)
+#def_developmentversion="yes" 
+def_developmentversion="no" 
+AC_ARG_ENABLE([developmentversion], 
+	AC_HELP_STRING([--enable-developmentversion=no/yes], 
+	[use 'yes' for a development version of MIRA, default is no]),
+	[developmentversion=$enableval],
+	[developmentversion=$def_developmentversion]) 
+if test "$developmentversion" = "no"; then 
+   AC_DEFINE_UNQUOTED(DEVELOPMENTVERSION, 0)
+   AC_SUBST(SHORTMIRAAUDIENCE,"prod")
+else
+   AC_DEFINE_UNQUOTED(DEVELOPMENTVERSION, 1)
+   AC_SUBST(SHORTMIRAAUDIENCE,"dev")
+fi 
+AC_MSG_RESULT($developmentversion)
+
 
 # compiles in some basic checks into mira that look for sanity within
 #  some functions
-# leaving this on "yes" is encouraged, impact on run time is minimal
+# leaving this on "yes" is encouraged, impact on run time is minimal 
 AC_MSG_CHECKING(whether mira should compile with bound tracking)
-def_boundtracking="yes"
-AC_ARG_ENABLE([boundtracking],
-	AC_HELP_STRING([--enable-boundtracking=yes/no],
+def_boundtracking="yes" 
+AC_ARG_ENABLE([boundtracking], 
+	AC_HELP_STRING([--enable-boundtracking=yes/no], 
 	[use 'yes' for some additional value bound tracking in MIRA, default is yes]),
 	[boundtracking=$enableval],
-	[boundtracking=$def_boundtracking])
-if test "$boundtracking" = "yes"; then
+	[boundtracking=$def_boundtracking]) 
+if test "$boundtracking" = "yes"; then 
    AC_DEFINE_UNQUOTED(BOUNDTRACKFLAG)
-fi
+fi 
 AC_MSG_RESULT($boundtracking)
 
 
 # compiles in some basic checks into mira that look for sanity within
 #  some functions
-# as with boundchecking, leaving this on "yes" is encouraged,
-#  impact on run time is minimal
+# as with boundchecking, leaving this on "yes" is encouraged, 
+#  impact on run time is minimal 
 AC_MSG_CHECKING(whether mira should compile with bug tracking)
-def_bugtracking="yes"
-AC_ARG_ENABLE([bugtracking],
-	AC_HELP_STRING([--enable-bugtracking=yes/no],
+def_bugtracking="yes" 
+AC_ARG_ENABLE([bugtracking], 
+	AC_HELP_STRING([--enable-bugtracking=yes/no], 
 	[use 'yes' for some additional bug tracking in MIRA, default is yes]),
 	[bugtracking=$enableval],
-	[bugtracking=$def_bugtracking])
-if test "$bugtracking" = "yes"; then
+	[bugtracking=$def_bugtracking]) 
+if test "$bugtracking" = "yes"; then 
    AC_DEFINE_UNQUOTED(BUGTRACKFLAG)
-fi
+fi 
 AC_MSG_RESULT($bugtracking)
 
 
@@ -1371,15 +1078,15 @@ AC_MSG_RESULT($bugtracking)
 #  costly and impacts runtime noticeably, use only for bughunting on
 #  core dumps or similar
 AC_MSG_CHECKING(whether mira should compile with extended bug tracking)
-def_extendedbugtracking="no"
-AC_ARG_ENABLE([extendedbugtracking],
-	AC_HELP_STRING([--enable-extendedbugtracking=no/yes],
+def_extendedbugtracking="no" 
+AC_ARG_ENABLE([extendedbugtracking], 
+	AC_HELP_STRING([--enable-extendedbugtracking=no/yes], 
 	[use 'yes' for some additional bug tracking in MIRA, default is no]),
 	[extendedbugtracking=$enableval],
-	[extendedbugtracking=$def_extendedbugtracking])
-if test "$extendedbugtracking" = "yes"; then
+	[extendedbugtracking=$def_extendedbugtracking]) 
+if test "$extendedbugtracking" = "yes"; then 
    AC_DEFINE_UNQUOTED(PARANOIABUGTRACKFLAG)
-fi
+fi 
 AC_MSG_RESULT($extendedbugtracking)
 
 
@@ -1387,26 +1094,18 @@ AC_MSG_RESULT($extendedbugtracking)
 # setting function trace to "yes" is *highly* discouraged except for
 #  toy projects
 AC_MSG_CHECKING(whether mira should compile with function trace)
-def_functrace="no"
-AC_ARG_ENABLE([functrace],
-	AC_HELP_STRING([--enable-functrace=no/yes],
+def_functrace="no" 
+AC_ARG_ENABLE([functrace], 
+	AC_HELP_STRING([--enable-functrace=no/yes], 
 	[use 'yes' for a function trace in MIRA, default is no]),
 	[functrace=$enableval],
-	[functrace=$def_functrace])
-if test "$functrace" = "yes"; then
+	[functrace=$def_functrace]) 
+if test "$functrace" = "yes"; then 
    AC_DEFINE_UNQUOTED(TRACEFLAG)
-fi
+fi 
 AC_MSG_RESULT($functrace)
 
 
-AC_ARG_ENABLE(miramemorc,
-	AC_HELP_STRING([--enable-miramemorc],
-	[enables building with memory overrun checks, default is no]))
-AM_CONDITIONAL([BUILDMIRAMEMORC], [test x$enable_miramemorc = xyes])
-
-if test "$enable_miramemorc" = "yes"; then
-   CXXFLAGS="-DMIRAMEMORC ${CXXFLAGS}"
-fi
 
 
 # -Winline -Wmissing-noreturn???
@@ -1437,37 +1136,34 @@ fi
 AC_OUTPUT(Makefile \
 		    src/Makefile \
 		    src/stdinc/Makefile \
-		    src/debuggersupport/Makefile \
-		    src/memorc/Makefile \
+		    src/lec/Makefile \
 		    src/errorhandling/Makefile \
 		    src/util/Makefile \
 		    src/io/Makefile \
 		    src/mira/Makefile \
+		    src/EdIt/Makefile \
 		    src/caf/Makefile \
+		    src/examine/Makefile \
+		    src/knn_abi373/Makefile \
+		    src/knn_alf/Makefile \
 		    src/support/Makefile \
 		    src/scripts/Makefile \
-		    src/modules/Makefile \
+		    src/test/Makefile \
+		    src/test/io/Makefile \
+		    src/test/io/scf/Makefile \
+		    src/test/io/fasta/Makefile \
+		    src/test/io/generalio/Makefile \
+		    src/test/mira/Makefile \
+		    src/test/mira/align/Makefile \
+		    src/test/mira/read/Makefile \
+		    src/test/mira/readpool/Makefile \
+		    src/examples_programming/Makefile \
 		    src/progs/Makefile \
 		    doc/Makefile \
 		    doc/docbook/Makefile \
 		    distribution/Makefile
-         )
-
-#		    src/test/Makefile \
-#		    src/test/mira/Makefile \
-#		    src/test/mira/align/Makefile \
-
-#		    src/EdIt/Makefile \
-#		    src/examine/Makefile \
-#		    src/knn_abi373/Makefile \
-#		    src/knn_alf/Makefile \
-#		    src/test/io/Makefile \
-#		    src/test/io/scf/Makefile \
-#		    src/test/io/fasta/Makefile \
-#		    src/test/io/generalio/Makefile \
-#		    src/test/mira/read/Makefile \
-#		    src/test/mira/readpool/Makefile \
-#		    src/examples_programming/Makefile \
+         ) 
+
 
 #		    miratest/Makefile \
 #		    miratest/template/Makefile \
@@ -1477,7 +1173,7 @@ AC_OUTPUT(Makefile \
 # write docbook version
 
 cat <<EOF >doc/docbook/versionfile
-<?xml version="1.0" ?>
+<?xml version="1.0" ?> 
 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.docbook.org/xml/4.5/docbookx.dtd">
  <releaseinfo>MIRA Version ${VERSION}</releaseinfo>
 EOF
@@ -1485,10 +1181,7 @@ EOF
 
 # give summary of the most important settings
 
-#MIRAVERSION=${VERSION}_${build_os}_${BITPACKAGE}_${MIRASTATIC}
-MIRAVERSION=`build-aux/git-version-gen .tarball-version`_${build_os}_${BITPACKAGE}_${MIRASTATIC}
-
-echo ${VERSION} >.version
+MIRAVERSION=${VERSION}_${SHORTMIRAAUDIENCE}_${build_os}_${BITPACKAGE}_${MIRASTATIC}
 
 echo
 echo "--------------------------------------------------------------------------------"
@@ -1497,19 +1190,13 @@ echo "--------------------------------------------------------------------------
 echo
 
 possibleproblems="no"
-if test "${HAVE_XXD}" = "no"; then
-  echo
-  echo "Could not find the program 'xxd'. It is usually part of 'vim', please"
-  echo "install it."
-  possibleproblems="yes"
-fi
 if test "${HAVE_EXPAT}" = "no"; then
   echo
   echo "Could not find expat. Please install the Expat library."
   echo "Have a look at your distribution which should already have"
   echo " an already prepackaged version for you to install."
   echo "If not, have a look at http://sourceforge.net/projects/expat/"
-  echo
+  echo 
   echo "If you have expat installed at a non-standard location, please tell"
   echo " this to the configure script with the '--with-expat*' options."
   possibleproblems="yes"
@@ -1545,20 +1232,27 @@ fi
 if test "${HAVE_BOOST_THREAD}" = "yes"; then
   echo
   echo "I couldn't find the C++ Boost libraries. They're really needed."
-  echo "Install at least 1.44 from the package repository of your"
+  echo "Install at least 1.35 from the package repository of your"
   echo " distribution/vendor or download and install manually from"
   echo " http://www.boost.org/"
   possibleproblems="yes"
 fi
 
+if test "${PERL}" = "no"; then
+  echo
+  echo "I couldn't find the a 'perl' binary. If it is installed on your"
+  echo "system, provide the path with '--with-perl=...'"
+  echo "Else please install perl."
+  possibleproblems="yes"
+fi
+
 if test "${possibleproblems}" = "yes"; then
   echo
   echo "Packages/programs needed for the compilation were not found."
   echo "Please install these first and then try again."
   echo
-  echo "If you installed them, perhaps the programs are not in your PATH?"
-  echo "Or you forgot to give the configure script options to tell where"
-  echo "the packages are?"
+  echo "If you installed them, perhaps you forgot to give the configure script"
+  echo "options to tell where they are?"
   echo
   exit 10
 fi
@@ -1599,53 +1293,48 @@ if test "${LEX}" = "flex"; then
   fi
 fi
 
-#if test "${linkwith_tcmalloc}" = "no"; then
-#  if test "${with_tcmalloc}" = "no" ; then
-#    echo "Linking against tcmalloc is disabled!"
-#    if test "${systemuname}" = "Darwin"; then
-#      echo "Note that this is the default for OS X, but you might want to try switching"
-#      echo "it on like this: --with-tcmalloc"
-#      echo
-#    fi
-#  elif test "${HAVE_TCMALLOC}" = "no"; then
-#    echo "Could not find the tcmalloc library. It is part of the Google perftools library at"
-#    echo "  http://code.google.com/p/google-perftools/downloads/list"
-#    echo "Please consult the INSTALL file of MIRA for more help on installing it."
-#    echo
-#  fi
-#  if test "${systemuname}" != "Darwin"; then
-#    echo
-#    echo "Linking to this library is *HIGHLY* recommended as without this library the"
-#    echo "memory requirements for MIRA may be 100% higher!"
-#    echo
-#    possibleproblems="yes"
-#    if test "${with_tcmalloc}" = "no" ; then
-#      possibleproblems="no"
-#    fi
-#  fi
-#fi
-
-
-if test "${zlib_havegzoffset}" = "no"; then
-  possibleproblems="yes"
-  echo
-  echo "While zlib has been found, the version which is used is apparently"
-  echo "lower than 1.2.4. Progress bars for FASTQ loading will not work."
-  echo "Please make sure you have a good version of zlib."
+if test "${linkwith_tcmalloc}" = "no"; then
+  if test "${with_tcmalloc}" = "no" ; then
+    echo "Linking against tcmalloc is disabled!"
+    if test "${systemuname}" = "Darwin"; then
+      echo "Note that is the default for OS X, but you might want to try switching"
+      echo "it on like this: --with-tcmalloc"
+      echo
+    fi
+  elif test "${HAVE_TCMALLOC}" = "no"; then
+    echo "Could not find the tcmalloc library. It is part of the Google perftools library at"
+    echo "  http://code.google.com/p/google-perftools/downloads/list"
+    echo "Please consult the INSTALL file of MIRA for more help on installing it."
+    echo
+  fi
+  if test "${systemuname}" != "Darwin"; then
+    echo 
+    echo "Linking to this library is *HIGHLY* recommended as without this library the"
+    echo "memory requirements for MIRA may be 100% higher!"
+    echo
+    possibleproblems="yes"
+  fi
 fi
 
+
 echo "Building version ................................. ${MIRAVERSION}"
+$ECHO_N "Production or development version?................ "
+if test "${developmentversion}" = "yes"; then
+  echo "development"
+else
+  echo "production"
+fi
 
 echo
 echo "We are building on ............................... ${systemuname}"
 
-echo "CPU supports 64 bit? ............................. ${has_int64_t}"
-echo "Compiler family .................................. ${bachCCOMPILER}"
-if test $bachCCOMPILER != gcc; then
+echo "CPU supports 64 bit? ......... ................... ${has_int64_t}"
+echo "Compiler ......................................... ${CC}"
+if test "${CC}" != "gcc"; then
   possibleproblems="yes"
   echo
   echo "Compiler is not GCC. This *MIGHT* be a problem! (more compilation tests"
-  echo "needed, please report success or failure)"
+  echo "needed, please report succes or failure)"
   echo
 fi
 
@@ -1661,18 +1350,13 @@ if test "${enable_debug}" = "yes"; then
   echo "${enable_debug}"
 fi
 
-if test "${enable_miramemorc}" = "yes"; then
-  $ECHO_N "Memory overrun checks in executable? ............. "
-  echo "${enable_debug}"
-fi
-
 if test "${enable_cxxdebug}" = "yes"; then
-  $ECHO_N "Debug version of C++ STL library? ................ "
+  $ECHO_N "Debug version of C++ STL library?................. "
   echo "${enable_debug}"
 fi
 
 if test "${enable_profile}" = "yes"; then
-  $ECHO_N "Profile information in executable? ............... "
+  $ECHO_N "Profile information in executable?................ "
   echo "${enable_profile}"
 fi
 if test "${has_int64_t}" = "yes"; then
@@ -1689,15 +1373,14 @@ fi
 echo "Building completely static? ...................... ${enable_mirastatic}"
 
 
-$ECHO_N "BOOST expected to compile and link? .............. "
+$ECHO_N "BOOST expected to compile and link?............... "
 if test "${possibleboostproblem}" = "yes"; then
   echo "maybe"
   possibleproblems="yes"
 else
   echo "yes"
 fi
-echo "Linking with TCmalloc library? ................... ${linkwith_tcmalloc}"
-echo "Have complete zlib support? ...................... ${zlib_havegzoffset}"
+echo "Linking with TCmalloc library?.................... ${linkwith_tcmalloc}"
 
 echo
 echo "Can MIRA be built on this system? ................ ${buildenvworks}"
@@ -1707,7 +1390,7 @@ if test "${buildenvworks}" != "yes"; then
     echo
     echo "No information regarding builds in this environment available. Please report"
     echo "success or failure."
-    echo
+    echo 
   else
     echo
     echo "This system has been reported as having problems."
@@ -1720,7 +1403,6 @@ echo
 echo "Using CFLAGS   : ${CFLAGS}"
 echo "Using CXXFLAGS : ${CXXFLAGS}"
 echo "Using LDFLAGS  : ${LDFLAGS}"
-echo "Using LIBS     : ${LIBS}"
 echo
 
 if test "${possibleproblems}" = "no"; then
@@ -1747,10 +1429,9 @@ if test "${possibleproblems}" = "no"; then
   echo "Type 'make' to make the binaries"
   echo "and then 'make install' to install them."
 else
-  echo "Ooops, some functionality might be missing or we might encounter some"
-  echo "problems in compilation/linking. Please give it a try and report success"
-  echo "or failure."
-  echo
+  echo "Ooops, we might encounter some problems in compilation/linking. Please give "
+  echo "it a try and report success or failure."
+  echo 
   echo "Type 'make' to make the binaries and if no error occured,"
   echo "then 'make install' to install them."
   echo
diff --git a/depcomp b/depcomp
old mode 100755
new mode 100644
index bd0ac08..6589965
--- a/depcomp
+++ b/depcomp
@@ -1,10 +1,7 @@
 #! /bin/sh
-# depcomp - compile a program generating dependencies as side-effects
-
-scriptversion=2011-12-04.11; # UTC
 
-# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010,
-# 2011 Free Software Foundation, Inc.
+# depcomp - compile a program generating dependencies as side-effects
+# Copyright 1999, 2000 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -17,7 +14,9 @@ scriptversion=2011-12-04.11; # UTC
 # GNU General Public License for more details.
 
 # You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
 
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
@@ -26,45 +25,13 @@ scriptversion=2011-12-04.11; # UTC
 
 # Originally written by Alexandre Oliva <oliva at dcc.unicamp.br>.
 
-case $1 in
-  '')
-     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
-     exit 1;
-     ;;
-  -h | --h*)
-    cat <<\EOF
-Usage: depcomp [--help] [--version] PROGRAM [ARGS]
-
-Run PROGRAMS ARGS to compile a file, generating dependencies
-as side-effects.
-
-Environment variables:
-  depmode     Dependency tracking mode.
-  source      Source file read by `PROGRAMS ARGS'.
-  object      Object file output by `PROGRAMS ARGS'.
-  DEPDIR      directory where to store dependencies.
-  depfile     Dependency file to output.
-  tmpdepfile  Temporary file to use when outputting dependencies.
-  libtool     Whether libtool is used (yes/no).
-
-Report bugs to <bug-automake at gnu.org>.
-EOF
-    exit $?
-    ;;
-  -v | --v*)
-    echo "depcomp $scriptversion"
-    exit $?
-    ;;
-esac
-
 if test -z "$depmode" || test -z "$source" || test -z "$object"; then
   echo "depcomp: Variables source, object and depmode must be set" 1>&2
   exit 1
 fi
+# `libtool' can also be set to `yes' or `no'.
 
-# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
-depfile=${depfile-`echo "$object" |
-  sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
+depfile=${depfile-`echo "$object" | sed 's,\([^/]*\)$,.deps/\1,;s/\.\([^.]*\)$/.P\1/'`}
 tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
 
 rm -f "$tmpdepfile"
@@ -85,42 +52,12 @@ if test "$depmode" = dashXmstdout; then
    depmode=dashmstdout
 fi
 
-cygpath_u="cygpath -u -f -"
-if test "$depmode" = msvcmsys; then
-   # This is just like msvisualcpp but w/o cygpath translation.
-   # Just convert the backslash-escaped backslashes to single forward
-   # slashes to satisfy depend.m4
-   cygpath_u='sed s,\\\\,/,g'
-   depmode=msvisualcpp
-fi
-
-if test "$depmode" = msvc7msys; then
-   # This is just like msvc7 but w/o cygpath translation.
-   # Just convert the backslash-escaped backslashes to single forward
-   # slashes to satisfy depend.m4
-   cygpath_u='sed s,\\\\,/,g'
-   depmode=msvc7
-fi
-
 case "$depmode" in
 gcc3)
 ## gcc 3 implements dependency tracking that does exactly what
 ## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
 ## it if -MD -MP comes after the -MF stuff.  Hmm.
-## Unfortunately, FreeBSD c89 acceptance of flags depends upon
-## the command line argument order; so add the flags where they
-## appear in depend2.am.  Note that the slowdown incurred here
-## affects only configure: in makefiles, %FASTDEP% shortcuts this.
-  for arg
-  do
-    case $arg in
-    -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
-    *)  set fnord "$@" "$arg" ;;
-    esac
-    shift # fnord
-    shift # $arg
-  done
-  "$@"
+  "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
   stat=$?
   if test $stat -eq 0; then :
   else
@@ -166,12 +103,10 @@ gcc)
 ' < "$tmpdepfile" |
 ## Some versions of gcc put a space before the `:'.  On the theory
 ## that the space means something, we add a space to the output as
-## well.  hp depmode also adds that space, but also prefixes the VPATH
-## to the object.  Take care to not repeat it in the output.
+## well.
 ## Some versions of the HPUX 10.20 sed can't process this invocation
 ## correctly.  Breaking it into two sed invocations is a workaround.
-    sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
-      | sed -e 's/$/ :/' >> "$depfile"
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
   rm -f "$tmpdepfile"
   ;;
 
@@ -209,14 +144,14 @@ sgi)
 ' < "$tmpdepfile" \
     | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
     tr '
-' ' ' >> "$depfile"
-    echo >> "$depfile"
+' ' ' >> $depfile
+    echo >> $depfile
 
     # The second pass generates a dummy entry for each header file.
     tr ' ' '
 ' < "$tmpdepfile" \
    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
-   >> "$depfile"
+   >> $depfile
   else
     # The sourcefile does not contain any dependencies, so just
     # store a dummy comment line, to avoid errors with the Makefile
@@ -228,43 +163,31 @@ sgi)
 
 aix)
   # The C for AIX Compiler uses -M and outputs the dependencies
-  # in a .u file.  In older versions, this file always lives in the
-  # current directory.  Also, the AIX compiler puts `$object:' at the
-  # start of each line; $object doesn't have directory information.
-  # Version 6 uses the directory in both cases.
-  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
-  test "x$dir" = "x$object" && dir=
-  base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+  # in a .u file.  This file always lives in the current directory.
+  # Also, the AIX compiler puts `$object:' at the start of each line;
+  # $object doesn't have directory information.
+  stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'`
+  tmpdepfile="$stripped.u"
+  outname="$stripped.o"
   if test "$libtool" = yes; then
-    tmpdepfile1=$dir$base.u
-    tmpdepfile2=$base.u
-    tmpdepfile3=$dir.libs/$base.u
     "$@" -Wc,-M
   else
-    tmpdepfile1=$dir$base.u
-    tmpdepfile2=$dir$base.u
-    tmpdepfile3=$dir$base.u
     "$@" -M
   fi
-  stat=$?
 
+  stat=$?
   if test $stat -eq 0; then :
   else
-    rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+    rm -f "$tmpdepfile"
     exit $stat
   fi
 
-  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
-  do
-    test -f "$tmpdepfile" && break
-  done
   if test -f "$tmpdepfile"; then
     # Each line is of the form `foo.o: dependent.h'.
     # Do two passes, one to just change these to
     # `$object: dependent.h' and one to simply `dependent.h:'.
-    sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
-    # That's a tab and a space in the [].
-    sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+    sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
+    sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
   else
     # The sourcefile does not contain any dependencies, so just
     # store a dummy comment line, to avoid errors with the Makefile
@@ -274,235 +197,77 @@ aix)
   rm -f "$tmpdepfile"
   ;;
 
-icc)
-  # Intel's C compiler understands `-MD -MF file'.  However on
-  #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
-  # ICC 7.0 will fill foo.d with something like
-  #    foo.o: sub/foo.c
-  #    foo.o: sub/foo.h
-  # which is wrong.  We want:
-  #    sub/foo.o: sub/foo.c
-  #    sub/foo.o: sub/foo.h
-  #    sub/foo.c:
-  #    sub/foo.h:
-  # ICC 7.1 will output
-  #    foo.o: sub/foo.c sub/foo.h
-  # and will wrap long lines using \ :
-  #    foo.o: sub/foo.c ... \
-  #     sub/foo.h ... \
-  #     ...
-
-  "$@" -MD -MF "$tmpdepfile"
-  stat=$?
-  if test $stat -eq 0; then :
-  else
-    rm -f "$tmpdepfile"
-    exit $stat
-  fi
-  rm -f "$depfile"
-  # Each line is of the form `foo.o: dependent.h',
-  # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
-  # Do two passes, one to just change these to
-  # `$object: dependent.h' and one to simply `dependent.h:'.
-  sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
-  # Some versions of the HPUX 10.20 sed can't process this invocation
-  # correctly.  Breaking it into two sed invocations is a workaround.
-  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
-    sed -e 's/$/ :/' >> "$depfile"
-  rm -f "$tmpdepfile"
-  ;;
-
-hp2)
-  # The "hp" stanza above does not work with aCC (C++) and HP's ia64
-  # compilers, which have integrated preprocessors.  The correct option
-  # to use with these is +Maked; it writes dependencies to a file named
-  # 'foo.d', which lands next to the object file, wherever that
-  # happens to be.
-  # Much of this is similar to the tru64 case; see comments there.
-  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
-  test "x$dir" = "x$object" && dir=
-  base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
-  if test "$libtool" = yes; then
-    tmpdepfile1=$dir$base.d
-    tmpdepfile2=$dir.libs/$base.d
-    "$@" -Wc,+Maked
-  else
-    tmpdepfile1=$dir$base.d
-    tmpdepfile2=$dir$base.d
-    "$@" +Maked
-  fi
-  stat=$?
-  if test $stat -eq 0; then :
-  else
-     rm -f "$tmpdepfile1" "$tmpdepfile2"
-     exit $stat
-  fi
-
-  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
-  do
-    test -f "$tmpdepfile" && break
-  done
-  if test -f "$tmpdepfile"; then
-    sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
-    # Add `dependent.h:' lines.
-    sed -ne '2,${
-	       s/^ *//
-	       s/ \\*$//
-	       s/$/:/
-	       p
-	     }' "$tmpdepfile" >> "$depfile"
-  else
-    echo "#dummy" > "$depfile"
-  fi
-  rm -f "$tmpdepfile" "$tmpdepfile2"
-  ;;
-
 tru64)
-   # The Tru64 compiler uses -MD to generate dependencies as a side
+   # The Tru64 AIX compiler uses -MD to generate dependencies as a side
    # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
-   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put 
    # dependencies in `foo.d' instead, so we check for that too.
    # Subdirectories are respected.
-   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
-   test "x$dir" = "x$object" && dir=
-   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
 
+   tmpdepfile1="$object.d"
+   tmpdepfile2=`echo "$object" | sed -e 's/.o$/.d/'` 
    if test "$libtool" = yes; then
-      # With Tru64 cc, shared objects can also be used to make a
-      # static library.  This mechanism is used in libtool 1.4 series to
-      # handle both shared and static libraries in a single compilation.
-      # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
-      #
-      # With libtool 1.5 this exception was removed, and libtool now
-      # generates 2 separate objects for the 2 libraries.  These two
-      # compilations output dependencies in $dir.libs/$base.o.d and
-      # in $dir$base.o.d.  We have to check for both files, because
-      # one of the two compilations can be disabled.  We should prefer
-      # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
-      # automatically cleaned when .libs/ is deleted, while ignoring
-      # the former would cause a distcleancheck panic.
-      tmpdepfile1=$dir.libs/$base.lo.d   # libtool 1.4
-      tmpdepfile2=$dir$base.o.d          # libtool 1.5
-      tmpdepfile3=$dir.libs/$base.o.d    # libtool 1.5
-      tmpdepfile4=$dir.libs/$base.d      # Compaq CCC V6.2-504
       "$@" -Wc,-MD
    else
-      tmpdepfile1=$dir$base.o.d
-      tmpdepfile2=$dir$base.d
-      tmpdepfile3=$dir$base.d
-      tmpdepfile4=$dir$base.d
       "$@" -MD
    fi
 
    stat=$?
    if test $stat -eq 0; then :
    else
-      rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+      rm -f "$tmpdepfile1" "$tmpdepfile2"
       exit $stat
    fi
 
-   for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
-   do
-     test -f "$tmpdepfile" && break
-   done
+   if test -f "$tmpdepfile1"; then
+      tmpdepfile="$tmpdepfile1"
+   else
+      tmpdepfile="$tmpdepfile2"
+   fi
    if test -f "$tmpdepfile"; then
       sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
-      # That's a tab and a space in the [].
-      sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+      # That's a space and a tab in the [].
+      sed -e 's,^.*\.[a-z]*:[ 	]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
    else
       echo "#dummy" > "$depfile"
    fi
    rm -f "$tmpdepfile"
    ;;
 
-msvc7)
-  if test "$libtool" = yes; then
-    showIncludes=-Wc,-showIncludes
-  else
-    showIncludes=-showIncludes
-  fi
-  "$@" $showIncludes > "$tmpdepfile"
-  stat=$?
-  grep -v '^Note: including file: ' "$tmpdepfile"
-  if test "$stat" = 0; then :
-  else
-    rm -f "$tmpdepfile"
-    exit $stat
-  fi
-  rm -f "$depfile"
-  echo "$object : \\" > "$depfile"
-  # The first sed program below extracts the file names and escapes
-  # backslashes for cygpath.  The second sed program outputs the file
-  # name when reading, but also accumulates all include files in the
-  # hold buffer in order to output them again at the end.  This only
-  # works with sed implementations that can handle large buffers.
-  sed < "$tmpdepfile" -n '
-/^Note: including file:  *\(.*\)/ {
-  s//\1/
-  s/\\/\\\\/g
-  p
-}' | $cygpath_u | sort -u | sed -n '
-s/ /\\ /g
-s/\(.*\)/	\1 \\/p
-s/.\(.*\) \\/\1:/
-H
-$ {
-  s/.*/	/
-  G
-  p
-}' >> "$depfile"
-  rm -f "$tmpdepfile"
-  ;;
-
-msvc7msys)
-  # This case exists only to let depend.m4 do its work.  It works by
-  # looking at the text of this script.  This case will never be run,
-  # since it is checked for above.
-  exit 1
-  ;;
-
 #nosideeffect)
   # This comment above is used by automake to tell side-effect
   # dependency tracking mechanisms from slower ones.
 
 dashmstdout)
   # Important note: in order to support this mode, a compiler *must*
-  # always write the preprocessed file to stdout, regardless of -o.
-  "$@" || exit $?
-
-  # Remove the call to Libtool.
-  if test "$libtool" = yes; then
-    while test "X$1" != 'X--mode=compile'; do
-      shift
-    done
-    shift
-  fi
-
-  # Remove `-o $object'.
-  IFS=" "
-  for arg
-  do
-    case $arg in
-    -o)
-      shift
-      ;;
-    $object)
-      shift
-      ;;
-    *)
-      set fnord "$@" "$arg"
-      shift # fnord
-      shift # $arg
+  # always write the proprocessed file to stdout, regardless of -o,
+  # because we must use -o when running libtool.
+  test -z "$dashmflag" && dashmflag=-M
+  ( IFS=" "
+    case " $* " in
+    *" --mode=compile "*) # this is libtool, let us make it quiet
+      for arg
+      do # cycle over the arguments
+        case "$arg" in
+	"--mode=compile")
+	  # insert --quiet before "--mode=compile"
+	  set fnord "$@" --quiet
+	  shift # fnord
+	  ;;
+	esac
+	set fnord "$@" "$arg"
+	shift # fnord
+	shift # "$arg"
+      done
       ;;
     esac
-  done
-
-  test -z "$dashmflag" && dashmflag=-M
-  # Require at least two characters before searching for `:'
-  # in the target name.  This is to cope with DOS-style filenames:
-  # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
-  "$@" $dashmflag |
-    sed 's:^[  ]*[^: ][^:][^:]*\:[    ]*:'"$object"'\: :' > "$tmpdepfile"
+    "$@" $dashmflag | sed 's:^[^:]*\:[ 	]*:'"$object"'\: :' > "$tmpdepfile"
+  ) &
+  proc=$!
+  "$@"
+  stat=$?
+  wait "$proc"
+  if test "$stat" != 0; then exit $stat; fi
   rm -f "$depfile"
   cat < "$tmpdepfile" > "$depfile"
   tr ' ' '
@@ -520,49 +285,36 @@ dashXmstdout)
   ;;
 
 makedepend)
-  "$@" || exit $?
-  # Remove any Libtool call
-  if test "$libtool" = yes; then
-    while test "X$1" != 'X--mode=compile'; do
-      shift
-    done
-    shift
-  fi
   # X makedepend
-  shift
-  cleared=no eat=no
-  for arg
-  do
-    case $cleared in
-    no)
-      set ""; shift
-      cleared=yes ;;
-    esac
-    if test $eat = yes; then
-      eat=no
-      continue
-    fi
-    case "$arg" in
-    -D*|-I*)
-      set fnord "$@" "$arg"; shift ;;
-    # Strip any option that makedepend may not understand.  Remove
-    # the object too, otherwise makedepend will parse it as a source file.
-    -arch)
-      eat=yes ;;
-    -*|$object)
-      ;;
-    *)
-      set fnord "$@" "$arg"; shift ;;
-    esac
-  done
-  obj_suffix=`echo "$object" | sed 's/^.*\././'`
-  touch "$tmpdepfile"
-  ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
+  (
+    shift
+    cleared=no
+    for arg in "$@"; do
+      case $cleared in no)
+        set ""; shift
+	cleared=yes
+      esac
+      case "$arg" in
+        -D*|-I*)
+	  set fnord "$@" "$arg"; shift;;
+	-*)
+	  ;;
+	*)
+	  set fnord "$@" "$arg"; shift;;
+      esac
+    done
+    obj_suffix="`echo $object | sed 's/^.*\././'`"
+    touch "$tmpdepfile"
+    ${MAKEDEPEND-makedepend} 2>/dev/null -o"$obj_suffix" -f"$tmpdepfile" "$@"
+  ) &
+  proc=$!
+  "$@"
+  stat=$?
+  wait "$proc"
+  if test "$stat" != 0; then exit $stat; fi
   rm -f "$depfile"
-  # makedepend may prepend the VPATH from the source file name to the object.
-  # No need to regex-escape $object, excess matching of '.' is harmless.
-  sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
-  sed '1,2d' "$tmpdepfile" | tr ' ' '
+  cat < "$tmpdepfile" > "$depfile"
+  tail +3 "$tmpdepfile" | tr ' ' '
 ' | \
 ## Some versions of the HPUX 10.20 sed can't process this invocation
 ## correctly.  Breaking it into two sed invocations is a workaround.
@@ -572,40 +324,35 @@ makedepend)
 
 cpp)
   # Important note: in order to support this mode, a compiler *must*
-  # always write the preprocessed file to stdout.
-  "$@" || exit $?
-
-  # Remove the call to Libtool.
-  if test "$libtool" = yes; then
-    while test "X$1" != 'X--mode=compile'; do
-      shift
-    done
-    shift
-  fi
-
-  # Remove `-o $object'.
-  IFS=" "
-  for arg
-  do
-    case $arg in
-    -o)
-      shift
-      ;;
-    $object)
-      shift
-      ;;
-    *)
-      set fnord "$@" "$arg"
-      shift # fnord
-      shift # $arg
+  # always write the proprocessed file to stdout, regardless of -o,
+  # because we must use -o when running libtool.
+  ( IFS=" "
+    case " $* " in
+    *" --mode=compile "*)
+      for arg
+      do # cycle over the arguments
+        case $arg in
+	"--mode=compile")
+	  # insert --quiet before "--mode=compile"
+	  set fnord "$@" --quiet
+	  shift # fnord
+	  ;;
+	esac
+	set fnord "$@" "$arg"
+	shift # fnord
+	shift # "$arg"
+      done
       ;;
     esac
-  done
-
-  "$@" -E |
-    sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-       -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
+    "$@" -E |
+    sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
     sed '$ s: \\$::' > "$tmpdepfile"
+  ) &
+  proc=$!
+  "$@"
+  stat=$?
+  wait "$proc"
+  if test "$stat" != 0; then exit $stat; fi
   rm -f "$depfile"
   echo "$object : \\" > "$depfile"
   cat < "$tmpdepfile" >> "$depfile"
@@ -615,56 +362,42 @@ cpp)
 
 msvisualcpp)
   # Important note: in order to support this mode, a compiler *must*
-  # always write the preprocessed file to stdout.
-  "$@" || exit $?
-
-  # Remove the call to Libtool.
-  if test "$libtool" = yes; then
-    while test "X$1" != 'X--mode=compile'; do
-      shift
-    done
-    shift
-  fi
-
-  IFS=" "
-  for arg
-  do
-    case "$arg" in
-    -o)
-      shift
-      ;;
-    $object)
-      shift
-      ;;
-    "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
-	set fnord "$@"
-	shift
-	shift
-	;;
-    *)
+  # always write the proprocessed file to stdout, regardless of -o,
+  # because we must use -o when running libtool.
+  ( IFS=" "
+    case " $* " in
+    *" --mode=compile "*)
+      for arg
+      do # cycle over the arguments
+        case $arg in
+	"--mode=compile")
+	  # insert --quiet before "--mode=compile"
+	  set fnord "$@" --quiet
+	  shift # fnord
+	  ;;
+	esac
 	set fnord "$@" "$arg"
-	shift
-	shift
-	;;
+	shift # fnord
+	shift # "$arg"
+      done
+      ;;
     esac
-  done
-  "$@" -E 2>/dev/null |
-  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
+    "$@" -E |
+    sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
+  ) &
+  proc=$!
+  "$@"
+  stat=$?
+  wait "$proc"
+  if test "$stat" != 0; then exit $stat; fi
   rm -f "$depfile"
   echo "$object : \\" > "$depfile"
-  sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::	\1 \\:p' >> "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::	\1 \\:p' >> "$depfile"
   echo "	" >> "$depfile"
-  sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
   rm -f "$tmpdepfile"
   ;;
 
-msvcmsys)
-  # This case exists only to let depend.m4 do its work.  It works by
-  # looking at the text of this script.  This case will never be run,
-  # since it is checked for above.
-  exit 1
-  ;;
-
 none)
   exec "$@"
   ;;
@@ -676,13 +409,3 @@ none)
 esac
 
 exit 0
-
-# Local Variables:
-# mode: shell-script
-# sh-indentation: 2
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "scriptversion="
-# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-time-zone: "UTC"
-# time-stamp-end: "; # UTC"
-# End:
diff --git a/distribution/Makefile b/distribution/Makefile
index 65a042d..bcdeaed 100644
--- a/distribution/Makefile
+++ b/distribution/Makefile
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # distribution/Makefile.  Generated from Makefile.in by configure.
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -36,14 +36,22 @@ host_triplet = x86_64-unknown-linux-gnu
 subdir = distribution
 DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/ax_boost_base.m4 \
-	$(top_srcdir)/m4/ax_boost_filesystem.m4 \
-	$(top_srcdir)/m4/ax_boost_iostreams.m4 \
-	$(top_srcdir)/m4/ax_boost_regex.m4 \
-	$(top_srcdir)/m4/ax_boost_system.m4 \
-	$(top_srcdir)/m4/ax_boost_thread.m4 \
-	$(top_srcdir)/m4/ax_check_zlib.m4 \
-	$(top_srcdir)/m4/ax_lib_expat.m4 $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/config/m4/ax_boost_base.m4 \
+	$(top_srcdir)/config/m4/ax_boost_regex.m4 \
+	$(top_srcdir)/config/m4/ax_boost_thread.m4 \
+	$(top_srcdir)/config/m4/ax_check_zlib.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_std.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_stl.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_namespaces.m4 \
+	$(top_srcdir)/config/m4/ax_lib_expat.m4 \
+	$(top_srcdir)/config/m4/ax_with_perl.m4 \
+	$(top_srcdir)/config/m4/ax_with_prog.m4 \
+	$(top_srcdir)/config/m4/libtool.m4 \
+	$(top_srcdir)/config/m4/ltoptions.m4 \
+	$(top_srcdir)/config/m4/ltsugar.m4 \
+	$(top_srcdir)/config/m4/ltversion.m4 \
+	$(top_srcdir)/config/m4/lt~obsolete.m4 \
+	$(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -52,36 +60,31 @@ CONFIG_CLEAN_VPATH_FILES =
 SOURCES =
 DIST_SOURCES =
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = ${SHELL} /home/bach/work/assembly/mira.git/missing --run aclocal-1.11
-AMTAR = $${TAR-tar}
+ACLOCAL = ${SHELL} /home/bach/work/assembly/dev33/mira.git/missing --run aclocal-1.11
+AMTAR = ${SHELL} /home/bach/work/assembly/dev33/mira.git/missing --run tar
 AR = ar
-AUTOCONF = ${SHELL} /home/bach/work/assembly/mira.git/missing --run autoconf
-AUTOHEADER = ${SHELL} /home/bach/work/assembly/mira.git/missing --run autoheader
-AUTOMAKE = ${SHELL} /home/bach/work/assembly/mira.git/missing --run automake-1.11
+AUTOCONF = ${SHELL} /home/bach/work/assembly/dev33/mira.git/missing --run autoconf
+AUTOHEADER = ${SHELL} /home/bach/work/assembly/dev33/mira.git/missing --run autoheader
+AUTOMAKE = ${SHELL} /home/bach/work/assembly/dev33/mira.git/missing --run automake-1.11
 AWK = mawk
 BITPACKAGE = x86_64
 BLOODYDARWINSTATLIBDIRHACK = 
-BOOST_CPPFLAGS = -pthread -I/opt/biosw/include
-BOOST_FILESYSTEM_LIB = -lboost_filesystem
-BOOST_IOSTREAMS_LIB = -lboost_iostreams
-BOOST_LDFLAGS = -L/opt/biosw/lib
-BOOST_REGEX_LIB = -lboost_regex
-BOOST_SYSTEM_LIB = -lboost_system
-BOOST_THREAD_LIB = -lboost_thread
-BUNDLETARGET = darwin
+BOOST_CPPFLAGS = -pthread -I/usr/include
+BOOST_LDFLAGS = -L/usr/lib64
+BOOST_REGEX_LIB = -lboost_regex-mt
+BOOST_THREAD_LIB = -lboost_thread-mt
 CC = gcc
 CCDEPMODE = depmode=gcc3
-CFLAGS =   -I/opt/biosw/include -g -W -Wstrict-prototypes -fno-strict-aliasing -Wextra -ansi -Wbad-function-cast -Wcast-align -Wcast-qual -Wchar-subscripts -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-prototypes -Wwrite-strings -Wformat -Wimplicit -Wmissing-braces -Wparentheses -Wswitch -Wswitch-default -Wswitch-enum -Wunused -Wfloat-equal -Wendif-labels -Wconversion -Wdisabled-optimization -Wsequence-point -Werror=unused-value -Werror=uniniti [...]
+CFLAGS =   -O3 -funroll-loops -I/usr/include -g
 CPP = gcc -E
 CPPFLAGS = 
 CXX = g++
 CXXCPP = g++ -E
 CXXDEPMODE = depmode=gcc3
-CXXFLAGS = -DPUBLICQUIET -DAJ_Linux64   -pthread -I/opt/biosw/include -I/opt/biosw/include -g -W -Wstrict-prototypes -fdiagnostics-show-option -Wextra -Wshadow -fno-strict-aliasing -ansi -Wcast-align -Wcast-qual -Wchar-subscripts -Wpointer-arith -Wredundant-decls -Wwrite-strings -Woverloaded-virtual -Wsign-promo -Wformat -Wimplicit -Wmissing-braces -Wparentheses -Wswitch -Wswitch-default -Wswitch-enum -Wunused -Wfloat-equal -Wendif-labels -Wconversion -Wdisabled-optimization -Wsequence-p [...]
+CXXFLAGS = -DPUBLICQUIET -DAJ_Linux64   -O3 -funroll-loops -I/usr/include -pthread -I/usr/include -g
 CYGPATH_W = echo
-DEFS = -DPACKAGE_NAME=\"mira\" -DPACKAGE_TARNAME=\"mira\" -DPACKAGE_VERSION=\"4.9.5\" -DPACKAGE_STRING=\"mira\ 4.9.5\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"mira\" -DVERSION=\"4.9.5\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DENABLE64=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DYYTEXT_POINTER=1 -DSTDC_HEADERS=1 -DHAVE__BOOL=1 [...]
+DEFS = -DPACKAGE_NAME=\"mira\" -DPACKAGE_TARNAME=\"mira\" -DPACKAGE_VERSION=\"3.4.0\" -DPACKAGE_STRING=\"mira\ 3.4.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"mira\" -DVERSION=\"3.4.0\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DENABLE64=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DYYTEXT_POINTER=1 -DSTDC_HEADERS=1 -DHAVE__BOOL=1 [...]
 DEPDIR = .deps
-DLLTOOL = false
 DSYMUTIL = 
 DUMPBIN = 
 ECHO_C = 
@@ -89,33 +92,30 @@ ECHO_N = echo -n
 ECHO_T = 
 EGREP = /bin/grep -E
 EXEEXT = 
-EXPAT_CFLAGS = -I/opt/biosw/include
-EXPAT_LDFLAGS = -L/opt/biosw/lib
-EXPAT_LIBS = -lexpat
+EXPAT_CFLAGS = -I/usr/include
+EXPAT_LDFLAGS = -L/usr/lib -lexpat
 EXPAT_VERSION = 
 FGREP = /bin/grep -F
-FLEX = yes
+FLEX = 
 FLEXPP = yes
 GREP = /bin/grep
-HAVE_XXD = yes
 INSTALL = /usr/bin/install -c
 INSTALL_DATA = ${INSTALL} -m 644
 INSTALL_PROGRAM = ${INSTALL}
 INSTALL_SCRIPT = ${INSTALL}
 INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
 LD = /usr/bin/ld -m elf_x86_64
-LDFLAGS =  -L/opt/biosw/lib -L/opt/biosw/lib
+LDFLAGS =  -L/usr/lib -lexpat -L/usr/lib64 -lboost_thread-mt -lboost_regex-mt
 LEX = flex
 LEXLIB = -lfl
 LEX_OUTPUT_ROOT = lex.yy
 LIBOBJS = 
-LIBS =  -lboost_thread -lboost_regex -lboost_system -lboost_filesystem -lboost_iostreams -lrt -lexpat -lm -lz
+LIBS =  -ltcmalloc_minimal
 LIBTOOL = $(SHELL) $(top_builddir)/libtool
 LIPO = 
 LN_S = ln -s
 LTLIBOBJS = 
-MAKEINFO = ${SHELL} /home/bach/work/assembly/mira.git/missing --run makeinfo
-MANIFEST_TOOL = :
+MAKEINFO = ${SHELL} /home/bach/work/assembly/dev33/mira.git/missing --run makeinfo
 MIRASTATIC = static
 MKDIR_P = /bin/mkdir -p
 NM = /usr/bin/nm -B
@@ -127,23 +127,24 @@ OTOOL64 =
 PACKAGE = mira
 PACKAGE_BUGREPORT = 
 PACKAGE_NAME = mira
-PACKAGE_STRING = mira 4.9.5
+PACKAGE_STRING = mira 3.4.0
 PACKAGE_TARNAME = mira
 PACKAGE_URL = 
-PACKAGE_VERSION = 4.9.5
+PACKAGE_VERSION = 3.4.0
 PATH_SEPARATOR = :
+PERL = /usr/bin/perl
 RANLIB = ranlib
 SED = /bin/sed
 SET_MAKE = 
 SHELL = /bin/bash
+SHORTMIRAAUDIENCE = prod
 STRIP = strip
-VERSION = 4.9.5
-abs_builddir = /home/bach/work/assembly/mira.git/distribution
-abs_srcdir = /home/bach/work/assembly/mira.git/distribution
-abs_top_builddir = /home/bach/work/assembly/mira.git
-abs_top_srcdir = /home/bach/work/assembly/mira.git
-ac_ct_AR = ar
-ac_ct_CC = 
+VERSION = 3.4.0
+abs_builddir = /home/bach/work/assembly/dev33/mira.git/distribution
+abs_srcdir = /home/bach/work/assembly/dev33/mira.git/distribution
+abs_top_builddir = /home/bach/work/assembly/dev33/mira.git
+abs_top_srcdir = /home/bach/work/assembly/dev33/mira.git
+ac_ct_CC = gcc
 ac_ct_CXX = g++
 ac_ct_DUMPBIN = 
 am__include = include
@@ -171,11 +172,12 @@ host_vendor = unknown
 htmldir = ${docdir}
 includedir = ${prefix}/include
 infodir = ${datarootdir}/info
-install_sh = ${SHELL} /home/bach/work/assembly/mira.git/install-sh
+install_sh = ${SHELL} /home/bach/work/assembly/dev33/mira.git/install-sh
 libdir = ${exec_prefix}/lib
 libexecdir = ${exec_prefix}/libexec
 localedir = ${datarootdir}/locale
 localstatedir = ${prefix}/var
+lt_ECHO = echo
 mandir = ${datarootdir}/man
 mkdir_p = /bin/mkdir -p
 oldincludedir = /usr/include
@@ -191,8 +193,7 @@ target_alias =
 top_build_prefix = ../
 top_builddir = ..
 top_srcdir = ..
-GITSHORT = `$(top_srcdir)/build-aux/git-version-gen isshort $(top_srcdir)/.tarball-version`
-MIRAVERSION = ${GITSHORT}_${build_os}_${BITPACKAGE}_${MIRASTATIC}
+MIRAVERSION = ${VERSION}_${SHORTMIRAAUDIENCE}_${build_os}_${BITPACKAGE}_${MIRASTATIC}
 MIRADIR = ${PACKAGE_TARNAME}_${MIRAVERSION}
 all: all-am
 
@@ -284,15 +285,10 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	if test -z '$(STRIP)'; then \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	      install; \
-	else \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-	fi
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
 mostlyclean-generic:
 
 clean-generic:
@@ -387,56 +383,58 @@ uninstall-am:
 	cp -R -L ../src/3rdparty .
 	tar cvjf mira_3rdparty_`date +%d-%m-%Y`.tar.bz2 3rdparty
 
-libbundle-nobundle:
-	@echo "Do not need to bundle on this platform"
-
-libbundle-darwin:
-	@echo "Using Macdylibbundler to create OSX compatible dylib references"
-	(cd ${MIRADIR}; dylibbundler -b -od -d lib -p @executable_path/../lib/ -x bin/mira; cd ..)
-
 copybin:
 	@echo "Making distribution for ${BITPACKAGE}"
 	-rm -rf ${MIRADIR} *.tar *.gz
 	mkdir ${MIRADIR}
 	mkdir ${MIRADIR}/bin
 	cp ../src/progs/mira ${MIRADIR}/bin
-	ln -s -f mira ${MIRADIR}/bin/mirabait
-	ln -s -f mira ${MIRADIR}/bin/miraconvert
+	cp ../src/progs/convert_project ${MIRADIR}/bin
+	cp ../src/progs/scftool ${MIRADIR}/bin
+	cp ../src/progs/fastatool ${MIRADIR}/bin
+#	cp ../src/progs/uncover_at ${MIRADIR}/bin
+#	cp ../src/progs/clipSCFbyQual ${MIRADIR}/bin
+	ln -s -f mira ${MIRADIR}/bin/miraSearchESTSNPs
+	ln -s -f mira ${MIRADIR}/bin/miraclip
 	ln -s -f mira ${MIRADIR}/bin/miramem
-#	ln -s -f mira ${MIRADIR}/bin/miraSearchESTSNPs
-#	ln -s -f mira ${MIRADIR}/bin/miraclip
+	ln -s -f convert_project ${MIRADIR}/bin/mirabait
+	ln -s -f convert_project ${MIRADIR}/bin/caf2fasta
+	ln -s -f convert_project ${MIRADIR}/bin/caf2gbf
+	ln -s -f convert_project ${MIRADIR}/bin/caf2text
+	ln -s -f convert_project ${MIRADIR}/bin/caf2html
+	ln -s -f convert_project ${MIRADIR}/bin/caf2tcs
+	ln -s -f convert_project ${MIRADIR}/bin/gbf2caf
+	ln -s -f convert_project ${MIRADIR}/bin/caf2caf
+	ln -s -f convert_project ${MIRADIR}/bin/gbf2fasta
 	mkdir ${MIRADIR}/scripts
 	cp ../src/scripts/fixACE4consed.tcl ${MIRADIR}/scripts
+	cp ../src/scripts/fastaselect.tcl ${MIRADIR}/scripts
+	cp ../src/scripts/fastqselect.tcl ${MIRADIR}/scripts
 	cp ../src/scripts/fasta2frag.tcl ${MIRADIR}/scripts
 
-copydocs:
-	mkdir ${MIRADIR}/docs
-	cp -R -L ../doc/docbook/Defi*.html ${MIRADIR}/docs
-	( cd ${MIRADIR}/docs; ln -s DefinitiveGuideToMIRA.html index.html)
-	cp -R -L ../doc/docbook/*.pdf ${MIRADIR}/docs
-	cp -R -L ../doc/docbook/bookfigures ${MIRADIR}/docs
-	cp -R -L ../doc/docbook/images ${MIRADIR}/docs
-	cp -R -L ../doc/docbook/doccss ${MIRADIR}/docs
-
-distribin: copybin libbundle-${BUNDLETARGET}
+distribin: copybin
 	strip ${MIRADIR}/bin/*
 	tar cvjf ${PACKAGE_TARNAME}_binonly_${MIRAVERSION}.tar.bz2 ${MIRADIR}
 
-distridbg: copybin libbundle-${BUNDLETARGET}
-	rm -rf ${MIRADIR}/scripts
-	tar cvjf ${PACKAGE_TARNAME}_dbgonly_${MIRAVERSION}.tar.bz2 ${MIRADIR}
-
-distrib: copybin libbundle-${BUNDLETARGET} copydocs
+distrib: copybin
 	cp ../THANKS ${MIRADIR}
 	cp README ${MIRADIR}
 	cp LICENCE ${MIRADIR}
+	mkdir ${MIRADIR}/docs
+	cp -R -L ../doc/docbook/*.html ${MIRADIR}/docs
+	( cd ${MIRADIR}/docs; ln -s DefinitiveGuideToMIRA.html index.html)
+	cp -R -L ../doc/docbook/*.pdf ${MIRADIR}/docs
+	cp -R -L ../doc/docbook/bookfigures ${MIRADIR}/docs
+	cp -R -L ../doc/docbook/images ${MIRADIR}/docs
+	cp -R -L ../doc/docbook/doccss ${MIRADIR}/docs
+	cp -R -L ../doc/3rdparty ${MIRADIR}/docs_3rdparty
 	cp -R -L ../src/support ${MIRADIR}
 	rm -rf ${MIRADIR}/support/Makefile*
 #	cp ../src/mira/demoparam.prm ${MIRADIR}/paramtemplates.par
 	cp ../src/mira/CHANGES.txt ${MIRADIR}
 	cp ../src/mira/CHANGES_old.txt ${MIRADIR}
-#	cp -R -L ../minidemo ${MIRADIR}
-#	( cd ${MIRADIR}/minidemo/demo1; lndir ../data/scf; lndir ../data/exp_set1; ls -1 *exp >mira_in.fofn; rm fofn)
+	cp -R -L ../minidemo ${MIRADIR}
+	( cd ${MIRADIR}/minidemo/demo1; lndir ../data/scf; lndir ../data/exp_set1; ls -1 *exp >mira_in.fofn; rm fofn)
 	tar cvjf ${PACKAGE_TARNAME}_${MIRAVERSION}_fullsymbols.tar.bz2 ${MIRADIR}
 	strip ${MIRADIR}/bin/*
 	tar cvjf ${PACKAGE_TARNAME}_${MIRAVERSION}.tar.bz2 ${MIRADIR}
diff --git a/distribution/Makefile.am b/distribution/Makefile.am
index 85ada71..9037a9c 100644
--- a/distribution/Makefile.am
+++ b/distribution/Makefile.am
@@ -1,64 +1,63 @@
-GITSHORT=`$(top_srcdir)/build-aux/git-version-gen isshort $(top_srcdir)/.tarball-version`
-MIRAVERSION=${GITSHORT}_${build_os}_${BITPACKAGE}_${MIRASTATIC}
+MIRAVERSION=${VERSION}_${SHORTMIRAAUDIENCE}_${build_os}_${BITPACKAGE}_${MIRASTATIC}
 MIRADIR=${PACKAGE_TARNAME}_${MIRAVERSION}
 
-BUNDLETARGET=darwin
-
 3rdparty:
 	rm -rf 3rdparty
 	cp -R -L ../src/3rdparty .
 	tar cvjf mira_3rdparty_`date +%d-%m-%Y`.tar.bz2 3rdparty
 
-libbundle-nobundle:
-	@echo "Do not need to bundle on this platform"
-
-libbundle-darwin:
-	@echo "Using Macdylibbundler to create OSX compatible dylib references"
-	(cd ${MIRADIR}; dylibbundler -b -od -d lib -p @executable_path/../lib/ -x bin/mira; cd ..)
-
 copybin:
 	@echo "Making distribution for ${BITPACKAGE}"
 	-rm -rf ${MIRADIR} *.tar *.gz
 	mkdir ${MIRADIR}
 	mkdir ${MIRADIR}/bin
 	cp ../src/progs/mira ${MIRADIR}/bin
-	ln -s -f mira ${MIRADIR}/bin/mirabait
-	ln -s -f mira ${MIRADIR}/bin/miraconvert
+	cp ../src/progs/convert_project ${MIRADIR}/bin
+	cp ../src/progs/scftool ${MIRADIR}/bin
+	cp ../src/progs/fastatool ${MIRADIR}/bin
+#	cp ../src/progs/uncover_at ${MIRADIR}/bin
+#	cp ../src/progs/clipSCFbyQual ${MIRADIR}/bin
+	ln -s -f mira ${MIRADIR}/bin/miraSearchESTSNPs
+	ln -s -f mira ${MIRADIR}/bin/miraclip
 	ln -s -f mira ${MIRADIR}/bin/miramem
-#	ln -s -f mira ${MIRADIR}/bin/miraSearchESTSNPs
-#	ln -s -f mira ${MIRADIR}/bin/miraclip
+	ln -s -f convert_project ${MIRADIR}/bin/mirabait
+	ln -s -f convert_project ${MIRADIR}/bin/caf2fasta
+	ln -s -f convert_project ${MIRADIR}/bin/caf2gbf
+	ln -s -f convert_project ${MIRADIR}/bin/caf2text
+	ln -s -f convert_project ${MIRADIR}/bin/caf2html
+	ln -s -f convert_project ${MIRADIR}/bin/caf2tcs
+	ln -s -f convert_project ${MIRADIR}/bin/gbf2caf
+	ln -s -f convert_project ${MIRADIR}/bin/caf2caf
+	ln -s -f convert_project ${MIRADIR}/bin/gbf2fasta
 	mkdir ${MIRADIR}/scripts
 	cp ../src/scripts/fixACE4consed.tcl ${MIRADIR}/scripts
+	cp ../src/scripts/fastaselect.tcl ${MIRADIR}/scripts
+	cp ../src/scripts/fastqselect.tcl ${MIRADIR}/scripts
 	cp ../src/scripts/fasta2frag.tcl ${MIRADIR}/scripts
 
-copydocs:
-	mkdir ${MIRADIR}/docs
-	cp -R -L ../doc/docbook/Defi*.html ${MIRADIR}/docs
-	( cd ${MIRADIR}/docs; ln -s DefinitiveGuideToMIRA.html index.html)
-	cp -R -L ../doc/docbook/*.pdf ${MIRADIR}/docs
-	cp -R -L ../doc/docbook/bookfigures ${MIRADIR}/docs
-	cp -R -L ../doc/docbook/images ${MIRADIR}/docs
-	cp -R -L ../doc/docbook/doccss ${MIRADIR}/docs
-
-distribin: copybin libbundle-${BUNDLETARGET}
+distribin: copybin
 	strip ${MIRADIR}/bin/*
 	tar cvjf ${PACKAGE_TARNAME}_binonly_${MIRAVERSION}.tar.bz2 ${MIRADIR}
 
-distridbg: copybin libbundle-${BUNDLETARGET}
-	rm -rf ${MIRADIR}/scripts
-	tar cvjf ${PACKAGE_TARNAME}_dbgonly_${MIRAVERSION}.tar.bz2 ${MIRADIR}
-
-distrib: copybin libbundle-${BUNDLETARGET} copydocs
+distrib: copybin
 	cp ../THANKS ${MIRADIR}
 	cp README ${MIRADIR}
 	cp LICENCE ${MIRADIR}
+	mkdir ${MIRADIR}/docs
+	cp -R -L ../doc/docbook/*.html ${MIRADIR}/docs
+	( cd ${MIRADIR}/docs; ln -s DefinitiveGuideToMIRA.html index.html)
+	cp -R -L ../doc/docbook/*.pdf ${MIRADIR}/docs
+	cp -R -L ../doc/docbook/bookfigures ${MIRADIR}/docs
+	cp -R -L ../doc/docbook/images ${MIRADIR}/docs
+	cp -R -L ../doc/docbook/doccss ${MIRADIR}/docs
+	cp -R -L ../doc/3rdparty ${MIRADIR}/docs_3rdparty
 	cp -R -L ../src/support ${MIRADIR}
 	rm -rf ${MIRADIR}/support/Makefile*
 #	cp ../src/mira/demoparam.prm ${MIRADIR}/paramtemplates.par
 	cp ../src/mira/CHANGES.txt ${MIRADIR}
 	cp ../src/mira/CHANGES_old.txt ${MIRADIR}
-#	cp -R -L ../minidemo ${MIRADIR}
-#	( cd ${MIRADIR}/minidemo/demo1; lndir ../data/scf; lndir ../data/exp_set1; ls -1 *exp >mira_in.fofn; rm fofn)
+	cp -R -L ../minidemo ${MIRADIR}
+	( cd ${MIRADIR}/minidemo/demo1; lndir ../data/scf; lndir ../data/exp_set1; ls -1 *exp >mira_in.fofn; rm fofn)
 	tar cvjf ${PACKAGE_TARNAME}_${MIRAVERSION}_fullsymbols.tar.bz2 ${MIRADIR}
 	strip ${MIRADIR}/bin/*
 	tar cvjf ${PACKAGE_TARNAME}_${MIRAVERSION}.tar.bz2 ${MIRADIR}
@@ -67,3 +66,4 @@ distrib: copybin libbundle-${BUNDLETARGET} copydocs
 clean:
 	rm -rf mira_*
 	rm -rf 3rdparty*
+
diff --git a/distribution/Makefile.in b/distribution/Makefile.in
index 973413d..2d2ed85 100644
--- a/distribution/Makefile.in
+++ b/distribution/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -36,14 +36,22 @@ host_triplet = @host@
 subdir = distribution
 DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/ax_boost_base.m4 \
-	$(top_srcdir)/m4/ax_boost_filesystem.m4 \
-	$(top_srcdir)/m4/ax_boost_iostreams.m4 \
-	$(top_srcdir)/m4/ax_boost_regex.m4 \
-	$(top_srcdir)/m4/ax_boost_system.m4 \
-	$(top_srcdir)/m4/ax_boost_thread.m4 \
-	$(top_srcdir)/m4/ax_check_zlib.m4 \
-	$(top_srcdir)/m4/ax_lib_expat.m4 $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/config/m4/ax_boost_base.m4 \
+	$(top_srcdir)/config/m4/ax_boost_regex.m4 \
+	$(top_srcdir)/config/m4/ax_boost_thread.m4 \
+	$(top_srcdir)/config/m4/ax_check_zlib.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_std.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_stl.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_namespaces.m4 \
+	$(top_srcdir)/config/m4/ax_lib_expat.m4 \
+	$(top_srcdir)/config/m4/ax_with_perl.m4 \
+	$(top_srcdir)/config/m4/ax_with_prog.m4 \
+	$(top_srcdir)/config/m4/libtool.m4 \
+	$(top_srcdir)/config/m4/ltoptions.m4 \
+	$(top_srcdir)/config/m4/ltsugar.m4 \
+	$(top_srcdir)/config/m4/ltversion.m4 \
+	$(top_srcdir)/config/m4/lt~obsolete.m4 \
+	$(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -62,13 +70,9 @@ AWK = @AWK@
 BITPACKAGE = @BITPACKAGE@
 BLOODYDARWINSTATLIBDIRHACK = @BLOODYDARWINSTATLIBDIRHACK@
 BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
-BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@
-BOOST_IOSTREAMS_LIB = @BOOST_IOSTREAMS_LIB@
 BOOST_LDFLAGS = @BOOST_LDFLAGS@
 BOOST_REGEX_LIB = @BOOST_REGEX_LIB@
-BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@
 BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
-BUNDLETARGET = darwin
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
@@ -81,7 +85,6 @@ CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -91,13 +94,11 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LDFLAGS = @EXPAT_LDFLAGS@
-EXPAT_LIBS = @EXPAT_LIBS@
 EXPAT_VERSION = @EXPAT_VERSION@
 FGREP = @FGREP@
 FLEX = @FLEX@
 FLEXPP = @FLEXPP@
 GREP = @GREP@
-HAVE_XXD = @HAVE_XXD@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -115,7 +116,6 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
 MIRASTATIC = @MIRASTATIC@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
@@ -132,17 +132,18 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
+SHORTMIRAAUDIENCE = @SHORTMIRAAUDIENCE@
 STRIP = @STRIP@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -176,6 +177,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -191,8 +193,7 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-GITSHORT = `$(top_srcdir)/build-aux/git-version-gen isshort $(top_srcdir)/.tarball-version`
-MIRAVERSION = ${GITSHORT}_${build_os}_${BITPACKAGE}_${MIRASTATIC}
+MIRAVERSION = ${VERSION}_${SHORTMIRAAUDIENCE}_${build_os}_${BITPACKAGE}_${MIRASTATIC}
 MIRADIR = ${PACKAGE_TARNAME}_${MIRAVERSION}
 all: all-am
 
@@ -284,15 +285,10 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	if test -z '$(STRIP)'; then \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	      install; \
-	else \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-	fi
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
 mostlyclean-generic:
 
 clean-generic:
@@ -387,56 +383,58 @@ uninstall-am:
 	cp -R -L ../src/3rdparty .
 	tar cvjf mira_3rdparty_`date +%d-%m-%Y`.tar.bz2 3rdparty
 
-libbundle-nobundle:
-	@echo "Do not need to bundle on this platform"
-
-libbundle-darwin:
-	@echo "Using Macdylibbundler to create OSX compatible dylib references"
-	(cd ${MIRADIR}; dylibbundler -b -od -d lib -p @executable_path/../lib/ -x bin/mira; cd ..)
-
 copybin:
 	@echo "Making distribution for ${BITPACKAGE}"
 	-rm -rf ${MIRADIR} *.tar *.gz
 	mkdir ${MIRADIR}
 	mkdir ${MIRADIR}/bin
 	cp ../src/progs/mira ${MIRADIR}/bin
-	ln -s -f mira ${MIRADIR}/bin/mirabait
-	ln -s -f mira ${MIRADIR}/bin/miraconvert
+	cp ../src/progs/convert_project ${MIRADIR}/bin
+	cp ../src/progs/scftool ${MIRADIR}/bin
+	cp ../src/progs/fastatool ${MIRADIR}/bin
+#	cp ../src/progs/uncover_at ${MIRADIR}/bin
+#	cp ../src/progs/clipSCFbyQual ${MIRADIR}/bin
+	ln -s -f mira ${MIRADIR}/bin/miraSearchESTSNPs
+	ln -s -f mira ${MIRADIR}/bin/miraclip
 	ln -s -f mira ${MIRADIR}/bin/miramem
-#	ln -s -f mira ${MIRADIR}/bin/miraSearchESTSNPs
-#	ln -s -f mira ${MIRADIR}/bin/miraclip
+	ln -s -f convert_project ${MIRADIR}/bin/mirabait
+	ln -s -f convert_project ${MIRADIR}/bin/caf2fasta
+	ln -s -f convert_project ${MIRADIR}/bin/caf2gbf
+	ln -s -f convert_project ${MIRADIR}/bin/caf2text
+	ln -s -f convert_project ${MIRADIR}/bin/caf2html
+	ln -s -f convert_project ${MIRADIR}/bin/caf2tcs
+	ln -s -f convert_project ${MIRADIR}/bin/gbf2caf
+	ln -s -f convert_project ${MIRADIR}/bin/caf2caf
+	ln -s -f convert_project ${MIRADIR}/bin/gbf2fasta
 	mkdir ${MIRADIR}/scripts
 	cp ../src/scripts/fixACE4consed.tcl ${MIRADIR}/scripts
+	cp ../src/scripts/fastaselect.tcl ${MIRADIR}/scripts
+	cp ../src/scripts/fastqselect.tcl ${MIRADIR}/scripts
 	cp ../src/scripts/fasta2frag.tcl ${MIRADIR}/scripts
 
-copydocs:
-	mkdir ${MIRADIR}/docs
-	cp -R -L ../doc/docbook/Defi*.html ${MIRADIR}/docs
-	( cd ${MIRADIR}/docs; ln -s DefinitiveGuideToMIRA.html index.html)
-	cp -R -L ../doc/docbook/*.pdf ${MIRADIR}/docs
-	cp -R -L ../doc/docbook/bookfigures ${MIRADIR}/docs
-	cp -R -L ../doc/docbook/images ${MIRADIR}/docs
-	cp -R -L ../doc/docbook/doccss ${MIRADIR}/docs
-
-distribin: copybin libbundle-${BUNDLETARGET}
+distribin: copybin
 	strip ${MIRADIR}/bin/*
 	tar cvjf ${PACKAGE_TARNAME}_binonly_${MIRAVERSION}.tar.bz2 ${MIRADIR}
 
-distridbg: copybin libbundle-${BUNDLETARGET}
-	rm -rf ${MIRADIR}/scripts
-	tar cvjf ${PACKAGE_TARNAME}_dbgonly_${MIRAVERSION}.tar.bz2 ${MIRADIR}
-
-distrib: copybin libbundle-${BUNDLETARGET} copydocs
+distrib: copybin
 	cp ../THANKS ${MIRADIR}
 	cp README ${MIRADIR}
 	cp LICENCE ${MIRADIR}
+	mkdir ${MIRADIR}/docs
+	cp -R -L ../doc/docbook/*.html ${MIRADIR}/docs
+	( cd ${MIRADIR}/docs; ln -s DefinitiveGuideToMIRA.html index.html)
+	cp -R -L ../doc/docbook/*.pdf ${MIRADIR}/docs
+	cp -R -L ../doc/docbook/bookfigures ${MIRADIR}/docs
+	cp -R -L ../doc/docbook/images ${MIRADIR}/docs
+	cp -R -L ../doc/docbook/doccss ${MIRADIR}/docs
+	cp -R -L ../doc/3rdparty ${MIRADIR}/docs_3rdparty
 	cp -R -L ../src/support ${MIRADIR}
 	rm -rf ${MIRADIR}/support/Makefile*
 #	cp ../src/mira/demoparam.prm ${MIRADIR}/paramtemplates.par
 	cp ../src/mira/CHANGES.txt ${MIRADIR}
 	cp ../src/mira/CHANGES_old.txt ${MIRADIR}
-#	cp -R -L ../minidemo ${MIRADIR}
-#	( cd ${MIRADIR}/minidemo/demo1; lndir ../data/scf; lndir ../data/exp_set1; ls -1 *exp >mira_in.fofn; rm fofn)
+	cp -R -L ../minidemo ${MIRADIR}
+	( cd ${MIRADIR}/minidemo/demo1; lndir ../data/scf; lndir ../data/exp_set1; ls -1 *exp >mira_in.fofn; rm fofn)
 	tar cvjf ${PACKAGE_TARNAME}_${MIRAVERSION}_fullsymbols.tar.bz2 ${MIRADIR}
 	strip ${MIRADIR}/bin/*
 	tar cvjf ${PACKAGE_TARNAME}_${MIRAVERSION}.tar.bz2 ${MIRADIR}
diff --git a/distribution/README b/distribution/README
index b4644f2..1ca1b0d 100644
--- a/distribution/README
+++ b/distribution/README
@@ -1,13 +1,13 @@
-                                                    Rheinfelden, Spring 2015
+                                                    Rheinfelden, Summer 2011
 
-README for the binary package of MIRA 4.9.x
+README for the binary package of MIRA 3.4.x
 ===========================================
 
 Table of contents
 -----------------
 
 1. What's new?
-2. What's provided?
+2. What's provided? 
 3. Installation
 4. Documentation
 5. Demos
@@ -22,32 +22,37 @@ For a complete list of changes since a specific version, please consult
 CHANGES.txt, or for older updates, src/mira/CHANGES_old.txt of the source
 package distributions.
 
-Current stable versions will have major.minor.sub-version of 4.0.x while
-development version will have a branch identifier of 4.9.x.
+Stable versions will have major.minor.sub-version (e.g. 3.4.0 or 3.4.1) while
+development version will have major.minor.sub-version.patchlevel
+(e.g. 3.4.1.0 or 3.4.1.2).
 
 
 2. What's provided?
 ===================
 
 You have downloaded the binary package of MIRA. It consists of binaries,
-documentation and support files.
+documentation, a directory with small demos and a directory with some support
+files.
 
-Binaries provided:
- - mira: for assembly or mapping of sequences
+Binaries provided: 
+ - mira: for assembly of genome sequences
  - miramem: estimating memory needed to assemble projects. Realised through
-   link to the mira binary.
- - miraconvert: for converting sequencing related file types into other
-   types. Includes various options for processing, filtering etc.pp. Realised
-   through link to the mira binary.
- - mirabait: quickly bait sequences from a large set.Realised through link to
-   the mira binary.
-Note: the above is just only one binary ("mira"), the others are just soft
-links pointing to mira.
+   link to mira.
+ - convert_project: for converting project file types into other types
+ . mirabait: quickly bait sequences from a large set
+ - caf2fasta, caf2gbf, caf2text, caf2html, gbf2caf and gbf2fasta are some
+   frequently used file converters (realised through links to convert_project)
+ - scftool: set of tools useful when working with SCF trace files
+ - fastatool: set of tools useful when working with FASTA trace files
 
 Scripts provided:
  - fasta2frag.tcl: fragmenting sequences into smaller, overlapping
    subsequences. Useful for simulating shotgun sequences. Can create
    subsequences in both directions (/default) and also paired-end sequences.
+ - fastaselect.tcl: given a FASTA file (and possibly a FASTA quality file) and
+   a file with names of reads, select the sequences from the input FASTA (and
+   quality file) and writes them to an output FASTA
+ - fastqselect.tcl: like fastaselect.tcl, only for FASTQ
  - fixACE4consed.tcl: Consed has a bug which incapacitates it from reading
    consensus tags in ACE files written by the MIRA assembler (and possibly
    other programs). This script massages an ACE file so that consed can read
@@ -56,13 +61,6 @@ Scripts provided:
 Documentation provided:
 See section 4 "Documentation"
 
-Support files provided:
-The support directory contains files for the Staden gap4/gap5 assembly viewer
-and finishing tool which teaches the viewer about the tags MIRA uses. These
-files are up-to-date and ready to use. The same files for "consed" should be
-seen as "pointer to how things could be done" as I do not own consed to test
-these files.
-
 
 3. Installation
 ===============
@@ -71,9 +69,9 @@ The binaries (in directory "bin") are statically linked and self
 contained, they should work with any Linux kernel >=2.6. On Mac OSX, they
 may work on version 10.5 and should work on all versions >= 10.6.
 
-Copy the the distributed package somewhere to your disk (either to one of the
-"standard" places or somewhere in your home directory) and then soft link the
-binaries into a directory which is in your shell PATH. Done.
+Copy the binaries (and scripts if you want) into a directory in your path
+environment (or add the extraction directory to your path variable) and you
+are ready to go.
 
 Support files for the Staden GAP4 (GAP5) assembly finishing tool and consed
 are in the "support" directory. Please refer to the documentation of the
@@ -90,32 +88,42 @@ Provided files:
    Full documentation in HTML format
  - DefinitiveGuideToMIRA.pdf
    Full documentation in PDF format
+ - chap_*.html
+   Single chapters from the full documentation in HTML fomrat
 
 If you are new to MIRA, I suggest you start reading the following chapters in
 the full documentation:
 
  - Introduction (always)
  - Installation (eventually)
- - Preparing data
+ - Short usage introduction to MIRA3 (always, although that chapter is geared
+   a bit towards Sanger)
  - Then
-    - De-novo assemblies
-    - Mapping assemblies
-    - EST / RNASeq assemblies
+    - Assembly of 454 data with MIRA3 (when working with 454 sequences)
+    - Assembly of Ion Torrent data with MIRA3 (when working with Ion Torrent
+      sequences)
+    - Solexa sequence assembly with MIRA3 (when working with Solexa sequences)
+    - Assembly of EST data with MIRA3 (when working with EST data)
  - Working with the results of MIRA (always)
  - Utilities in the MIRA package (eventually)
  - Assembly of hard genome or EST projects (always)
  - Some advice when going into a sequencing project (eventually)
 
-Vut it wouldn't hurt if you quickly looked at the tableof content of all the
-other chapters to determine whether there might be something interesting for
-you in it.
-
 
 5. Demos
 ========
 
-At the moment no demos are provided. However, the step by step documentation
-and example configuration in the manual should get you going in no time.
+A few small usage examples for genomic and EST assembly are in the 'minidemo'
+directory. As the demos rely on file links, this directory will have to be
+unpacked under a Unix operating system. Unpacking it with WinZip/WinRAR/other
+Windows applications and then transferring the directory to Linux will NOT
+work.
+
+Simply go into the directory and execute the runme.sh scripts (and have a look
+at them if you wish).
+
+However, these demos can be rather simplistic, so please do read the
+documentation.
 
 
 6. Licenses and Disclaimer
@@ -151,13 +159,13 @@ talk mailing list
 
   http://www.freelists.org/list/mira_talk
 
-and then send your question to:
+and send your question to:
 
   mira_talk at freelists.org
 
 To report bugs or ask for features, please use the ticketing system at:
 
-  http://sourceforge.net/p/mira-assembler/tickets/
+    http://sourceforge.net/apps/trac/mira-assembler/
 
 This ensures that requests don't get lost.
 
diff --git a/doc/Makefile b/doc/Makefile
index 0ab41f7..96fde64 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # doc/Makefile.  Generated from Makefile.in by configure.
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -36,14 +36,22 @@ host_triplet = x86_64-unknown-linux-gnu
 subdir = doc
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/ax_boost_base.m4 \
-	$(top_srcdir)/m4/ax_boost_filesystem.m4 \
-	$(top_srcdir)/m4/ax_boost_iostreams.m4 \
-	$(top_srcdir)/m4/ax_boost_regex.m4 \
-	$(top_srcdir)/m4/ax_boost_system.m4 \
-	$(top_srcdir)/m4/ax_boost_thread.m4 \
-	$(top_srcdir)/m4/ax_check_zlib.m4 \
-	$(top_srcdir)/m4/ax_lib_expat.m4 $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/config/m4/ax_boost_base.m4 \
+	$(top_srcdir)/config/m4/ax_boost_regex.m4 \
+	$(top_srcdir)/config/m4/ax_boost_thread.m4 \
+	$(top_srcdir)/config/m4/ax_check_zlib.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_std.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_stl.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_namespaces.m4 \
+	$(top_srcdir)/config/m4/ax_lib_expat.m4 \
+	$(top_srcdir)/config/m4/ax_with_perl.m4 \
+	$(top_srcdir)/config/m4/ax_with_prog.m4 \
+	$(top_srcdir)/config/m4/libtool.m4 \
+	$(top_srcdir)/config/m4/ltoptions.m4 \
+	$(top_srcdir)/config/m4/ltsugar.m4 \
+	$(top_srcdir)/config/m4/ltversion.m4 \
+	$(top_srcdir)/config/m4/lt~obsolete.m4 \
+	$(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -92,36 +100,31 @@ am__relativize = \
     dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
   done; \
   reldir="$$dir2"
-ACLOCAL = ${SHELL} /home/bach/work/assembly/mira.git/missing --run aclocal-1.11
-AMTAR = $${TAR-tar}
+ACLOCAL = ${SHELL} /home/bach/work/assembly/dev33/mira.git/missing --run aclocal-1.11
+AMTAR = ${SHELL} /home/bach/work/assembly/dev33/mira.git/missing --run tar
 AR = ar
-AUTOCONF = ${SHELL} /home/bach/work/assembly/mira.git/missing --run autoconf
-AUTOHEADER = ${SHELL} /home/bach/work/assembly/mira.git/missing --run autoheader
-AUTOMAKE = ${SHELL} /home/bach/work/assembly/mira.git/missing --run automake-1.11
+AUTOCONF = ${SHELL} /home/bach/work/assembly/dev33/mira.git/missing --run autoconf
+AUTOHEADER = ${SHELL} /home/bach/work/assembly/dev33/mira.git/missing --run autoheader
+AUTOMAKE = ${SHELL} /home/bach/work/assembly/dev33/mira.git/missing --run automake-1.11
 AWK = mawk
 BITPACKAGE = x86_64
 BLOODYDARWINSTATLIBDIRHACK = 
-BOOST_CPPFLAGS = -pthread -I/opt/biosw/include
-BOOST_FILESYSTEM_LIB = -lboost_filesystem
-BOOST_IOSTREAMS_LIB = -lboost_iostreams
-BOOST_LDFLAGS = -L/opt/biosw/lib
-BOOST_REGEX_LIB = -lboost_regex
-BOOST_SYSTEM_LIB = -lboost_system
-BOOST_THREAD_LIB = -lboost_thread
-BUNDLETARGET = nobundle
+BOOST_CPPFLAGS = -pthread -I/usr/include
+BOOST_LDFLAGS = -L/usr/lib64
+BOOST_REGEX_LIB = -lboost_regex-mt
+BOOST_THREAD_LIB = -lboost_thread-mt
 CC = gcc
 CCDEPMODE = depmode=gcc3
-CFLAGS =   -I/opt/biosw/include -g -W -Wstrict-prototypes -fno-strict-aliasing -Wextra -ansi -Wbad-function-cast -Wcast-align -Wcast-qual -Wchar-subscripts -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-prototypes -Wwrite-strings -Wformat -Wimplicit -Wmissing-braces -Wparentheses -Wswitch -Wswitch-default -Wswitch-enum -Wunused -Wfloat-equal -Wendif-labels -Wconversion -Wdisabled-optimization -Wsequence-point -Werror=unused-value -Werror=uniniti [...]
+CFLAGS =   -O3 -funroll-loops -I/usr/include -g
 CPP = gcc -E
 CPPFLAGS = 
 CXX = g++
 CXXCPP = g++ -E
 CXXDEPMODE = depmode=gcc3
-CXXFLAGS = -DPUBLICQUIET -DAJ_Linux64   -pthread -I/opt/biosw/include -I/opt/biosw/include -g -W -Wstrict-prototypes -fdiagnostics-show-option -Wextra -Wshadow -fno-strict-aliasing -ansi -Wcast-align -Wcast-qual -Wchar-subscripts -Wpointer-arith -Wredundant-decls -Wwrite-strings -Woverloaded-virtual -Wsign-promo -Wformat -Wimplicit -Wmissing-braces -Wparentheses -Wswitch -Wswitch-default -Wswitch-enum -Wunused -Wfloat-equal -Wendif-labels -Wconversion -Wdisabled-optimization -Wsequence-p [...]
+CXXFLAGS = -DPUBLICQUIET -DAJ_Linux64   -O3 -funroll-loops -I/usr/include -pthread -I/usr/include -g
 CYGPATH_W = echo
-DEFS = -DPACKAGE_NAME=\"mira\" -DPACKAGE_TARNAME=\"mira\" -DPACKAGE_VERSION=\"4.9.5\" -DPACKAGE_STRING=\"mira\ 4.9.5\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"mira\" -DVERSION=\"4.9.5\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DENABLE64=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DYYTEXT_POINTER=1 -DSTDC_HEADERS=1 -DHAVE__BOOL=1 [...]
+DEFS = -DPACKAGE_NAME=\"mira\" -DPACKAGE_TARNAME=\"mira\" -DPACKAGE_VERSION=\"3.4.0\" -DPACKAGE_STRING=\"mira\ 3.4.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"mira\" -DVERSION=\"3.4.0\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DENABLE64=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DYYTEXT_POINTER=1 -DSTDC_HEADERS=1 -DHAVE__BOOL=1 [...]
 DEPDIR = .deps
-DLLTOOL = false
 DSYMUTIL = 
 DUMPBIN = 
 ECHO_C = 
@@ -129,33 +132,30 @@ ECHO_N = echo -n
 ECHO_T = 
 EGREP = /bin/grep -E
 EXEEXT = 
-EXPAT_CFLAGS = -I/opt/biosw/include
-EXPAT_LDFLAGS = -L/opt/biosw/lib
-EXPAT_LIBS = -lexpat
+EXPAT_CFLAGS = -I/usr/include
+EXPAT_LDFLAGS = -L/usr/lib -lexpat
 EXPAT_VERSION = 
 FGREP = /bin/grep -F
-FLEX = yes
+FLEX = 
 FLEXPP = yes
 GREP = /bin/grep
-HAVE_XXD = yes
 INSTALL = /usr/bin/install -c
 INSTALL_DATA = ${INSTALL} -m 644
 INSTALL_PROGRAM = ${INSTALL}
 INSTALL_SCRIPT = ${INSTALL}
 INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
 LD = /usr/bin/ld -m elf_x86_64
-LDFLAGS =  -L/opt/biosw/lib -L/opt/biosw/lib
+LDFLAGS =  -L/usr/lib -lexpat -L/usr/lib64 -lboost_thread-mt -lboost_regex-mt
 LEX = flex
 LEXLIB = -lfl
 LEX_OUTPUT_ROOT = lex.yy
 LIBOBJS = 
-LIBS =  -lboost_thread -lboost_regex -lboost_system -lboost_filesystem -lboost_iostreams -lrt -lexpat -lm -lz
+LIBS =  -ltcmalloc_minimal
 LIBTOOL = $(SHELL) $(top_builddir)/libtool
 LIPO = 
 LN_S = ln -s
 LTLIBOBJS = 
-MAKEINFO = ${SHELL} /home/bach/work/assembly/mira.git/missing --run makeinfo
-MANIFEST_TOOL = :
+MAKEINFO = ${SHELL} /home/bach/work/assembly/dev33/mira.git/missing --run makeinfo
 MIRASTATIC = static
 MKDIR_P = /bin/mkdir -p
 NM = /usr/bin/nm -B
@@ -167,23 +167,24 @@ OTOOL64 =
 PACKAGE = mira
 PACKAGE_BUGREPORT = 
 PACKAGE_NAME = mira
-PACKAGE_STRING = mira 4.9.5
+PACKAGE_STRING = mira 3.4.0
 PACKAGE_TARNAME = mira
 PACKAGE_URL = 
-PACKAGE_VERSION = 4.9.5
+PACKAGE_VERSION = 3.4.0
 PATH_SEPARATOR = :
+PERL = /usr/bin/perl
 RANLIB = ranlib
 SED = /bin/sed
 SET_MAKE = 
 SHELL = /bin/bash
+SHORTMIRAAUDIENCE = prod
 STRIP = strip
-VERSION = 4.9.5
-abs_builddir = /home/bach/work/assembly/mira.git/doc
-abs_srcdir = /home/bach/work/assembly/mira.git/doc
-abs_top_builddir = /home/bach/work/assembly/mira.git
-abs_top_srcdir = /home/bach/work/assembly/mira.git
-ac_ct_AR = ar
-ac_ct_CC = 
+VERSION = 3.4.0
+abs_builddir = /home/bach/work/assembly/dev33/mira.git/doc
+abs_srcdir = /home/bach/work/assembly/dev33/mira.git/doc
+abs_top_builddir = /home/bach/work/assembly/dev33/mira.git
+abs_top_srcdir = /home/bach/work/assembly/dev33/mira.git
+ac_ct_CC = gcc
 ac_ct_CXX = g++
 ac_ct_DUMPBIN = 
 am__include = include
@@ -211,11 +212,12 @@ host_vendor = unknown
 htmldir = ${docdir}
 includedir = ${prefix}/include
 infodir = ${datarootdir}/info
-install_sh = ${SHELL} /home/bach/work/assembly/mira.git/install-sh
+install_sh = ${SHELL} /home/bach/work/assembly/dev33/mira.git/install-sh
 libdir = ${exec_prefix}/lib
 libexecdir = ${exec_prefix}/libexec
 localedir = ${datarootdir}/locale
 localstatedir = ${prefix}/var
+lt_ECHO = echo
 mandir = ${datarootdir}/man
 mkdir_p = /bin/mkdir -p
 oldincludedir = /usr/include
@@ -480,15 +482,10 @@ install-am: all-am
 
 installcheck: installcheck-recursive
 install-strip:
-	if test -z '$(STRIP)'; then \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	      install; \
-	else \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-	fi
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
 mostlyclean-generic:
 
 clean-generic:
diff --git a/doc/Makefile.in b/doc/Makefile.in
index e6f4121..c909880 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -36,14 +36,22 @@ host_triplet = @host@
 subdir = doc
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/ax_boost_base.m4 \
-	$(top_srcdir)/m4/ax_boost_filesystem.m4 \
-	$(top_srcdir)/m4/ax_boost_iostreams.m4 \
-	$(top_srcdir)/m4/ax_boost_regex.m4 \
-	$(top_srcdir)/m4/ax_boost_system.m4 \
-	$(top_srcdir)/m4/ax_boost_thread.m4 \
-	$(top_srcdir)/m4/ax_check_zlib.m4 \
-	$(top_srcdir)/m4/ax_lib_expat.m4 $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/config/m4/ax_boost_base.m4 \
+	$(top_srcdir)/config/m4/ax_boost_regex.m4 \
+	$(top_srcdir)/config/m4/ax_boost_thread.m4 \
+	$(top_srcdir)/config/m4/ax_check_zlib.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_std.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_stl.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_namespaces.m4 \
+	$(top_srcdir)/config/m4/ax_lib_expat.m4 \
+	$(top_srcdir)/config/m4/ax_with_perl.m4 \
+	$(top_srcdir)/config/m4/ax_with_prog.m4 \
+	$(top_srcdir)/config/m4/libtool.m4 \
+	$(top_srcdir)/config/m4/ltoptions.m4 \
+	$(top_srcdir)/config/m4/ltsugar.m4 \
+	$(top_srcdir)/config/m4/ltversion.m4 \
+	$(top_srcdir)/config/m4/lt~obsolete.m4 \
+	$(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -102,13 +110,9 @@ AWK = @AWK@
 BITPACKAGE = @BITPACKAGE@
 BLOODYDARWINSTATLIBDIRHACK = @BLOODYDARWINSTATLIBDIRHACK@
 BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
-BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@
-BOOST_IOSTREAMS_LIB = @BOOST_IOSTREAMS_LIB@
 BOOST_LDFLAGS = @BOOST_LDFLAGS@
 BOOST_REGEX_LIB = @BOOST_REGEX_LIB@
-BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@
 BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
-BUNDLETARGET = @BUNDLETARGET@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
@@ -121,7 +125,6 @@ CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -131,13 +134,11 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LDFLAGS = @EXPAT_LDFLAGS@
-EXPAT_LIBS = @EXPAT_LIBS@
 EXPAT_VERSION = @EXPAT_VERSION@
 FGREP = @FGREP@
 FLEX = @FLEX@
 FLEXPP = @FLEXPP@
 GREP = @GREP@
-HAVE_XXD = @HAVE_XXD@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -155,7 +156,6 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
 MIRASTATIC = @MIRASTATIC@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
@@ -172,17 +172,18 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
+SHORTMIRAAUDIENCE = @SHORTMIRAAUDIENCE@
 STRIP = @STRIP@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -216,6 +217,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -480,15 +482,10 @@ install-am: all-am
 
 installcheck: installcheck-recursive
 install-strip:
-	if test -z '$(STRIP)'; then \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	      install; \
-	else \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-	fi
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
 mostlyclean-generic:
 
 clean-generic:
diff --git a/doc/docbook/Makefile b/doc/docbook/Makefile
index da42a81..6d65787 100644
--- a/doc/docbook/Makefile
+++ b/doc/docbook/Makefile
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # doc/docbook/Makefile.  Generated from Makefile.in by configure.
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -36,14 +36,22 @@ host_triplet = x86_64-unknown-linux-gnu
 subdir = doc/docbook
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/ax_boost_base.m4 \
-	$(top_srcdir)/m4/ax_boost_filesystem.m4 \
-	$(top_srcdir)/m4/ax_boost_iostreams.m4 \
-	$(top_srcdir)/m4/ax_boost_regex.m4 \
-	$(top_srcdir)/m4/ax_boost_system.m4 \
-	$(top_srcdir)/m4/ax_boost_thread.m4 \
-	$(top_srcdir)/m4/ax_check_zlib.m4 \
-	$(top_srcdir)/m4/ax_lib_expat.m4 $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/config/m4/ax_boost_base.m4 \
+	$(top_srcdir)/config/m4/ax_boost_regex.m4 \
+	$(top_srcdir)/config/m4/ax_boost_thread.m4 \
+	$(top_srcdir)/config/m4/ax_check_zlib.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_std.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_stl.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_namespaces.m4 \
+	$(top_srcdir)/config/m4/ax_lib_expat.m4 \
+	$(top_srcdir)/config/m4/ax_with_perl.m4 \
+	$(top_srcdir)/config/m4/ax_with_prog.m4 \
+	$(top_srcdir)/config/m4/libtool.m4 \
+	$(top_srcdir)/config/m4/ltoptions.m4 \
+	$(top_srcdir)/config/m4/ltsugar.m4 \
+	$(top_srcdir)/config/m4/ltversion.m4 \
+	$(top_srcdir)/config/m4/lt~obsolete.m4 \
+	$(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -52,36 +60,31 @@ CONFIG_CLEAN_VPATH_FILES =
 SOURCES =
 DIST_SOURCES =
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = ${SHELL} /home/bach/work/assembly/mira.git/missing --run aclocal-1.11
-AMTAR = $${TAR-tar}
+ACLOCAL = ${SHELL} /home/bach/work/assembly/dev33/mira.git/missing --run aclocal-1.11
+AMTAR = ${SHELL} /home/bach/work/assembly/dev33/mira.git/missing --run tar
 AR = ar
-AUTOCONF = ${SHELL} /home/bach/work/assembly/mira.git/missing --run autoconf
-AUTOHEADER = ${SHELL} /home/bach/work/assembly/mira.git/missing --run autoheader
-AUTOMAKE = ${SHELL} /home/bach/work/assembly/mira.git/missing --run automake-1.11
+AUTOCONF = ${SHELL} /home/bach/work/assembly/dev33/mira.git/missing --run autoconf
+AUTOHEADER = ${SHELL} /home/bach/work/assembly/dev33/mira.git/missing --run autoheader
+AUTOMAKE = ${SHELL} /home/bach/work/assembly/dev33/mira.git/missing --run automake-1.11
 AWK = mawk
 BITPACKAGE = x86_64
 BLOODYDARWINSTATLIBDIRHACK = 
-BOOST_CPPFLAGS = -pthread -I/opt/biosw/include
-BOOST_FILESYSTEM_LIB = -lboost_filesystem
-BOOST_IOSTREAMS_LIB = -lboost_iostreams
-BOOST_LDFLAGS = -L/opt/biosw/lib
-BOOST_REGEX_LIB = -lboost_regex
-BOOST_SYSTEM_LIB = -lboost_system
-BOOST_THREAD_LIB = -lboost_thread
-BUNDLETARGET = nobundle
+BOOST_CPPFLAGS = -pthread -I/usr/include
+BOOST_LDFLAGS = -L/usr/lib64
+BOOST_REGEX_LIB = -lboost_regex-mt
+BOOST_THREAD_LIB = -lboost_thread-mt
 CC = gcc
 CCDEPMODE = depmode=gcc3
-CFLAGS =   -I/opt/biosw/include -g -W -Wstrict-prototypes -fno-strict-aliasing -Wextra -ansi -Wbad-function-cast -Wcast-align -Wcast-qual -Wchar-subscripts -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-prototypes -Wwrite-strings -Wformat -Wimplicit -Wmissing-braces -Wparentheses -Wswitch -Wswitch-default -Wswitch-enum -Wunused -Wfloat-equal -Wendif-labels -Wconversion -Wdisabled-optimization -Wsequence-point -Werror=unused-value -Werror=uniniti [...]
+CFLAGS =   -O3 -funroll-loops -I/usr/include -g
 CPP = gcc -E
 CPPFLAGS = 
 CXX = g++
 CXXCPP = g++ -E
 CXXDEPMODE = depmode=gcc3
-CXXFLAGS = -DPUBLICQUIET -DAJ_Linux64   -pthread -I/opt/biosw/include -I/opt/biosw/include -g -W -Wstrict-prototypes -fdiagnostics-show-option -Wextra -Wshadow -fno-strict-aliasing -ansi -Wcast-align -Wcast-qual -Wchar-subscripts -Wpointer-arith -Wredundant-decls -Wwrite-strings -Woverloaded-virtual -Wsign-promo -Wformat -Wimplicit -Wmissing-braces -Wparentheses -Wswitch -Wswitch-default -Wswitch-enum -Wunused -Wfloat-equal -Wendif-labels -Wconversion -Wdisabled-optimization -Wsequence-p [...]
+CXXFLAGS = -DPUBLICQUIET -DAJ_Linux64   -O3 -funroll-loops -I/usr/include -pthread -I/usr/include -g
 CYGPATH_W = echo
-DEFS = -DPACKAGE_NAME=\"mira\" -DPACKAGE_TARNAME=\"mira\" -DPACKAGE_VERSION=\"4.9.5\" -DPACKAGE_STRING=\"mira\ 4.9.5\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"mira\" -DVERSION=\"4.9.5\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DENABLE64=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DYYTEXT_POINTER=1 -DSTDC_HEADERS=1 -DHAVE__BOOL=1 [...]
+DEFS = -DPACKAGE_NAME=\"mira\" -DPACKAGE_TARNAME=\"mira\" -DPACKAGE_VERSION=\"3.4.0\" -DPACKAGE_STRING=\"mira\ 3.4.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"mira\" -DVERSION=\"3.4.0\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DENABLE64=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DYYTEXT_POINTER=1 -DSTDC_HEADERS=1 -DHAVE__BOOL=1 [...]
 DEPDIR = .deps
-DLLTOOL = false
 DSYMUTIL = 
 DUMPBIN = 
 ECHO_C = 
@@ -89,33 +92,30 @@ ECHO_N = echo -n
 ECHO_T = 
 EGREP = /bin/grep -E
 EXEEXT = 
-EXPAT_CFLAGS = -I/opt/biosw/include
-EXPAT_LDFLAGS = -L/opt/biosw/lib
-EXPAT_LIBS = -lexpat
+EXPAT_CFLAGS = -I/usr/include
+EXPAT_LDFLAGS = -L/usr/lib -lexpat
 EXPAT_VERSION = 
 FGREP = /bin/grep -F
-FLEX = yes
+FLEX = 
 FLEXPP = yes
 GREP = /bin/grep
-HAVE_XXD = yes
 INSTALL = /usr/bin/install -c
 INSTALL_DATA = ${INSTALL} -m 644
 INSTALL_PROGRAM = ${INSTALL}
 INSTALL_SCRIPT = ${INSTALL}
 INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
 LD = /usr/bin/ld -m elf_x86_64
-LDFLAGS =  -L/opt/biosw/lib -L/opt/biosw/lib
+LDFLAGS =  -L/usr/lib -lexpat -L/usr/lib64 -lboost_thread-mt -lboost_regex-mt
 LEX = flex
 LEXLIB = -lfl
 LEX_OUTPUT_ROOT = lex.yy
 LIBOBJS = 
-LIBS =  -lboost_thread -lboost_regex -lboost_system -lboost_filesystem -lboost_iostreams -lrt -lexpat -lm -lz
+LIBS =  -ltcmalloc_minimal
 LIBTOOL = $(SHELL) $(top_builddir)/libtool
 LIPO = 
 LN_S = ln -s
 LTLIBOBJS = 
-MAKEINFO = ${SHELL} /home/bach/work/assembly/mira.git/missing --run makeinfo
-MANIFEST_TOOL = :
+MAKEINFO = ${SHELL} /home/bach/work/assembly/dev33/mira.git/missing --run makeinfo
 MIRASTATIC = static
 MKDIR_P = /bin/mkdir -p
 NM = /usr/bin/nm -B
@@ -127,23 +127,24 @@ OTOOL64 =
 PACKAGE = mira
 PACKAGE_BUGREPORT = 
 PACKAGE_NAME = mira
-PACKAGE_STRING = mira 4.9.5
+PACKAGE_STRING = mira 3.4.0
 PACKAGE_TARNAME = mira
 PACKAGE_URL = 
-PACKAGE_VERSION = 4.9.5
+PACKAGE_VERSION = 3.4.0
 PATH_SEPARATOR = :
+PERL = /usr/bin/perl
 RANLIB = ranlib
 SED = /bin/sed
 SET_MAKE = 
 SHELL = /bin/bash
+SHORTMIRAAUDIENCE = prod
 STRIP = strip
-VERSION = 4.9.5
-abs_builddir = /home/bach/work/assembly/mira.git/doc/docbook
-abs_srcdir = /home/bach/work/assembly/mira.git/doc/docbook
-abs_top_builddir = /home/bach/work/assembly/mira.git
-abs_top_srcdir = /home/bach/work/assembly/mira.git
-ac_ct_AR = ar
-ac_ct_CC = 
+VERSION = 3.4.0
+abs_builddir = /home/bach/work/assembly/dev33/mira.git/doc/docbook
+abs_srcdir = /home/bach/work/assembly/dev33/mira.git/doc/docbook
+abs_top_builddir = /home/bach/work/assembly/dev33/mira.git
+abs_top_srcdir = /home/bach/work/assembly/dev33/mira.git
+ac_ct_CC = gcc
 ac_ct_CXX = g++
 ac_ct_DUMPBIN = 
 am__include = include
@@ -171,11 +172,12 @@ host_vendor = unknown
 htmldir = ${docdir}
 includedir = ${prefix}/include
 infodir = ${datarootdir}/info
-install_sh = ${SHELL} /home/bach/work/assembly/mira.git/install-sh
+install_sh = ${SHELL} /home/bach/work/assembly/dev33/mira.git/install-sh
 libdir = ${exec_prefix}/lib
 libexecdir = ${exec_prefix}/libexec
 localedir = ${datarootdir}/locale
 localstatedir = ${prefix}/var
+lt_ECHO = echo
 mandir = ${datarootdir}/man
 mkdir_p = /bin/mkdir -p
 oldincludedir = /usr/include
@@ -191,10 +193,9 @@ target_alias =
 top_build_prefix = ../../
 top_builddir = ../..
 top_srcdir = ../..
-GITBUILD = `$(top_srcdir)/build-aux/git-version-gen isshort $(top_srcdir)/.tarball-version`
-CHAPTERS = chap_specialparams_part.xml chap_denovo_part.xml chap_mapping_part.xml chap_seqtechdesc_part.xml chap_bitsandpieces_part chap_mirautils_part chap_est_part chap_faq_part chap_hard_part chap_logfiles_part chap_maf_part chap_reference_part  chap_installation_part chap_intro_part chap_results_part chap_sra_part chap_seqadvice_part chap_bonus_part chap_preface_part chap_3p_ghbambus_part.xml
-CHAP_XML = $(CHAPTERS:%_part=%_part.xml)
-CHAP_HTML = $(CHAPTERS:%_part=%_part.html)
+CHAPTERS = chap_mirautils_part chap_454_part chap_iontor_part chap_est_part chap_faq_part chap_hard_part chap_logfiles_part chap_maf_part chap_pacbio_part chap_reference_part chap_sanger_part chap_solexa_part chap_installation_part chap_intro_part chap_results_part chap_seqadvice_part chap_bonus_part chap_preface_part
+CHAP_XML := $(CHAPTERS:%_part=%_part.xml)
+CHAP_HTML := $(CHAPTERS:%_part=%_part.html)
 EXTRA_DIST = ${CHAP_XML} book_definitiveguide.xml bookfigures book.xsl doccss images mira.xsl versionfile
 all: all-am
 
@@ -286,15 +287,10 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	if test -z '$(STRIP)'; then \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	      install; \
-	else \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-	fi
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
 mostlyclean-generic:
 
 clean-generic:
@@ -306,9 +302,7 @@ distclean-generic:
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
 	@echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
-
-clean-am: clean-generic clean-libtool clean-local mostlyclean-am
+clean-am: clean-generic clean-libtool mostlyclean-am
 
 distclean: distclean-am
 	-rm -f Makefile
@@ -375,54 +369,33 @@ uninstall-am:
 .MAKE: install-am install-strip
 
 .PHONY: all all-am check check-am clean clean-generic clean-libtool \
-	clean-local distclean distclean-generic distclean-libtool \
-	distdir dvi dvi-am html html-am info info-am install \
-	install-am install-data install-data-am install-dvi \
-	install-dvi-am install-exec install-exec-am install-html \
-	install-html-am install-info install-info-am install-man \
-	install-pdf install-pdf-am install-ps install-ps-am \
-	install-strip installcheck installcheck-am installdirs \
-	maintainer-clean maintainer-clean-generic mostlyclean \
-	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
-	uninstall uninstall-am
-
-
-versionfile: $(top_srcdir)/.version
-	@echo "Making versionfile"
-	@cp version.stub versionfile
-	@echo \<releaseinfo\>MIRA Version ${GITBUILD}\</releaseinfo\> >>versionfile
-
-clean-local:
-	rm -rf *html *pdf versionfile
+	distclean distclean-generic distclean-libtool distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
 
-%_part.html: %_part.xml
-	@echo "Making .html out of _part.xml" $@
-	@$(SHELL) -ec 'xsltproc --nonet --xinclude --output $@  $(top_srcdir)/doc/docbook/mira.xsl $<'
 
-chapters: ${CHAP_HTML} versionfile
+clean:
+	rm -rf *html *pdf
 
-book_3rdparty_html: versionfile ${CHAP_XML} book_3rdparty.xml
-	xsltproc --nonet --xinclude --output 3rdparty_MIRA.html $(top_srcdir)/doc/docbook/book.xsl $(top_srcdir)/doc/docbook/book_3rdparty.xml
+%_part.html: %_part.xml
+	@echo "Making .html out of _part.xml" $@
+	@$(SHELL) -ec 'xsltproc --xinclude --output $@  $(top_srcdir)/doc/docbook/mira.xsl $<'
 
-book_3rdparty_pdf: versionfile ${CHAP_XML} book_3rdparty.xml
-	dblatex --xslt-opts=--nonet --output=3rdparty_MIRA.pdf $(top_srcdir)/doc/docbook/book_3rdparty.xml
+chapters: ${CHAP_HTML}
 
-book_definitive_html: versionfile ${CHAP_XML} book_definitiveguide.xml
-	xsltproc --nonet --xinclude --output DefinitiveGuideToMIRA.html $(top_srcdir)/doc/docbook/book.xsl $(top_srcdir)/doc/docbook/book_definitiveguide.xml
-book_definitive_pdf: versionfile ${CHAP_XML} book_definitiveguide.xml
+books: ${CHAP_XML} book_definitiveguide.xml
+	xsltproc --xinclude --output DefinitiveGuideToMIRA.html $(top_srcdir)/doc/docbook/book.xsl $(top_srcdir)/doc/docbook/book_definitiveguide.xml
 	dblatex --xslt-opts=--nonet --output=DefinitiveGuideToMIRA.pdf $(top_srcdir)/doc/docbook/book_definitiveguide.xml
 
-book_definitive: versionfile ${CHAP_XML} book_definitive_html book_definitive_pdf
-
-books_html: versionfile book_definitive_html book_3rdparty_html
-
-books_pdf: versionfile book_definitive_pdf book_3rdparty_pdf
-
-books: versionfile books_html books_pdf
-
-all: versionfile books chapters
+all: chapters books
 
-docs: versionfile all
+docs: all
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/doc/docbook/Makefile.am b/doc/docbook/Makefile.am
index 20acfae..d94b89d 100644
--- a/doc/docbook/Makefile.am
+++ b/doc/docbook/Makefile.am
@@ -1,51 +1,28 @@
 
-GITBUILD=`$(top_srcdir)/build-aux/git-version-gen isshort $(top_srcdir)/.tarball-version`
 
-versionfile: $(top_srcdir)/.version
-	@echo "Making versionfile"
-	@cp version.stub versionfile
-	@echo \<releaseinfo\>MIRA Version ${GITBUILD}\</releaseinfo\> >>versionfile
+CHAPTERS = chap_mirautils_part chap_454_part chap_iontor_part chap_est_part chap_faq_part chap_hard_part chap_logfiles_part chap_maf_part chap_pacbio_part chap_reference_part chap_sanger_part chap_solexa_part chap_installation_part chap_intro_part chap_results_part chap_seqadvice_part chap_bonus_part chap_preface_part
 
-
-CHAPTERS = chap_specialparams_part.xml chap_denovo_part.xml chap_mapping_part.xml chap_seqtechdesc_part.xml chap_bitsandpieces_part chap_mirautils_part chap_est_part chap_faq_part chap_hard_part chap_logfiles_part chap_maf_part chap_reference_part  chap_installation_part chap_intro_part chap_results_part chap_sra_part chap_seqadvice_part chap_bonus_part chap_preface_part chap_3p_ghbambus_part.xml
-
-CHAP_XML = $(CHAPTERS:%_part=%_part.xml)
-CHAP_HTML = $(CHAPTERS:%_part=%_part.html)
+CHAP_XML := $(CHAPTERS:%_part=%_part.xml)
+CHAP_HTML := $(CHAPTERS:%_part=%_part.html)
 
 EXTRA_DIST = ${CHAP_XML} book_definitiveguide.xml bookfigures book.xsl doccss images mira.xsl versionfile
 
 
 
-clean-local:
-	rm -rf *html *pdf versionfile
+clean:
+	rm -rf *html *pdf
 
 %_part.html: %_part.xml
 	@echo "Making .html out of _part.xml" $@
-	@$(SHELL) -ec 'xsltproc --nonet --xinclude --output $@  $(top_srcdir)/doc/docbook/mira.xsl $<'
-
+	@$(SHELL) -ec 'xsltproc --xinclude --output $@  $(top_srcdir)/doc/docbook/mira.xsl $<'
 
-chapters: ${CHAP_HTML} versionfile
 
-book_3rdparty_html: versionfile ${CHAP_XML} book_3rdparty.xml
-	xsltproc --nonet --xinclude --output 3rdparty_MIRA.html $(top_srcdir)/doc/docbook/book.xsl $(top_srcdir)/doc/docbook/book_3rdparty.xml
+chapters: ${CHAP_HTML}
 
-book_3rdparty_pdf: versionfile ${CHAP_XML} book_3rdparty.xml
-	dblatex --xslt-opts=--nonet --output=3rdparty_MIRA.pdf $(top_srcdir)/doc/docbook/book_3rdparty.xml
-
-book_definitive_html: versionfile ${CHAP_XML} book_definitiveguide.xml
-	xsltproc --nonet --xinclude --output DefinitiveGuideToMIRA.html $(top_srcdir)/doc/docbook/book.xsl $(top_srcdir)/doc/docbook/book_definitiveguide.xml
-book_definitive_pdf: versionfile ${CHAP_XML} book_definitiveguide.xml
+books: ${CHAP_XML} book_definitiveguide.xml
+	xsltproc --xinclude --output DefinitiveGuideToMIRA.html $(top_srcdir)/doc/docbook/book.xsl $(top_srcdir)/doc/docbook/book_definitiveguide.xml
 	dblatex --xslt-opts=--nonet --output=DefinitiveGuideToMIRA.pdf $(top_srcdir)/doc/docbook/book_definitiveguide.xml
 
-book_definitive: versionfile ${CHAP_XML} book_definitive_html book_definitive_pdf
-
-
-books_html: versionfile book_definitive_html book_3rdparty_html
-
-books_pdf: versionfile book_definitive_pdf book_3rdparty_pdf
-
-books: versionfile books_html books_pdf
-
-all: versionfile books chapters
+all: chapters books
 
-docs: versionfile all
+docs: all
diff --git a/doc/docbook/Makefile.in b/doc/docbook/Makefile.in
index 13acae0..f94bfc4 100644
--- a/doc/docbook/Makefile.in
+++ b/doc/docbook/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -36,14 +36,22 @@ host_triplet = @host@
 subdir = doc/docbook
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/ax_boost_base.m4 \
-	$(top_srcdir)/m4/ax_boost_filesystem.m4 \
-	$(top_srcdir)/m4/ax_boost_iostreams.m4 \
-	$(top_srcdir)/m4/ax_boost_regex.m4 \
-	$(top_srcdir)/m4/ax_boost_system.m4 \
-	$(top_srcdir)/m4/ax_boost_thread.m4 \
-	$(top_srcdir)/m4/ax_check_zlib.m4 \
-	$(top_srcdir)/m4/ax_lib_expat.m4 $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/config/m4/ax_boost_base.m4 \
+	$(top_srcdir)/config/m4/ax_boost_regex.m4 \
+	$(top_srcdir)/config/m4/ax_boost_thread.m4 \
+	$(top_srcdir)/config/m4/ax_check_zlib.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_std.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_stl.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_namespaces.m4 \
+	$(top_srcdir)/config/m4/ax_lib_expat.m4 \
+	$(top_srcdir)/config/m4/ax_with_perl.m4 \
+	$(top_srcdir)/config/m4/ax_with_prog.m4 \
+	$(top_srcdir)/config/m4/libtool.m4 \
+	$(top_srcdir)/config/m4/ltoptions.m4 \
+	$(top_srcdir)/config/m4/ltsugar.m4 \
+	$(top_srcdir)/config/m4/ltversion.m4 \
+	$(top_srcdir)/config/m4/lt~obsolete.m4 \
+	$(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -62,13 +70,9 @@ AWK = @AWK@
 BITPACKAGE = @BITPACKAGE@
 BLOODYDARWINSTATLIBDIRHACK = @BLOODYDARWINSTATLIBDIRHACK@
 BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
-BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@
-BOOST_IOSTREAMS_LIB = @BOOST_IOSTREAMS_LIB@
 BOOST_LDFLAGS = @BOOST_LDFLAGS@
 BOOST_REGEX_LIB = @BOOST_REGEX_LIB@
-BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@
 BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
-BUNDLETARGET = @BUNDLETARGET@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
@@ -81,7 +85,6 @@ CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -91,13 +94,11 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LDFLAGS = @EXPAT_LDFLAGS@
-EXPAT_LIBS = @EXPAT_LIBS@
 EXPAT_VERSION = @EXPAT_VERSION@
 FGREP = @FGREP@
 FLEX = @FLEX@
 FLEXPP = @FLEXPP@
 GREP = @GREP@
-HAVE_XXD = @HAVE_XXD@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -115,7 +116,6 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
 MIRASTATIC = @MIRASTATIC@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
@@ -132,17 +132,18 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
+SHORTMIRAAUDIENCE = @SHORTMIRAAUDIENCE@
 STRIP = @STRIP@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -176,6 +177,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -191,10 +193,9 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-GITBUILD = `$(top_srcdir)/build-aux/git-version-gen isshort $(top_srcdir)/.tarball-version`
-CHAPTERS = chap_specialparams_part.xml chap_denovo_part.xml chap_mapping_part.xml chap_seqtechdesc_part.xml chap_bitsandpieces_part chap_mirautils_part chap_est_part chap_faq_part chap_hard_part chap_logfiles_part chap_maf_part chap_reference_part  chap_installation_part chap_intro_part chap_results_part chap_sra_part chap_seqadvice_part chap_bonus_part chap_preface_part chap_3p_ghbambus_part.xml
-CHAP_XML = $(CHAPTERS:%_part=%_part.xml)
-CHAP_HTML = $(CHAPTERS:%_part=%_part.html)
+CHAPTERS = chap_mirautils_part chap_454_part chap_iontor_part chap_est_part chap_faq_part chap_hard_part chap_logfiles_part chap_maf_part chap_pacbio_part chap_reference_part chap_sanger_part chap_solexa_part chap_installation_part chap_intro_part chap_results_part chap_seqadvice_part chap_bonus_part chap_preface_part
+CHAP_XML := $(CHAPTERS:%_part=%_part.xml)
+CHAP_HTML := $(CHAPTERS:%_part=%_part.html)
 EXTRA_DIST = ${CHAP_XML} book_definitiveguide.xml bookfigures book.xsl doccss images mira.xsl versionfile
 all: all-am
 
@@ -286,15 +287,10 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	if test -z '$(STRIP)'; then \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	      install; \
-	else \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-	fi
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
 mostlyclean-generic:
 
 clean-generic:
@@ -306,9 +302,7 @@ distclean-generic:
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
 	@echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
-
-clean-am: clean-generic clean-libtool clean-local mostlyclean-am
+clean-am: clean-generic clean-libtool mostlyclean-am
 
 distclean: distclean-am
 	-rm -f Makefile
@@ -375,54 +369,33 @@ uninstall-am:
 .MAKE: install-am install-strip
 
 .PHONY: all all-am check check-am clean clean-generic clean-libtool \
-	clean-local distclean distclean-generic distclean-libtool \
-	distdir dvi dvi-am html html-am info info-am install \
-	install-am install-data install-data-am install-dvi \
-	install-dvi-am install-exec install-exec-am install-html \
-	install-html-am install-info install-info-am install-man \
-	install-pdf install-pdf-am install-ps install-ps-am \
-	install-strip installcheck installcheck-am installdirs \
-	maintainer-clean maintainer-clean-generic mostlyclean \
-	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
-	uninstall uninstall-am
-
-
-versionfile: $(top_srcdir)/.version
-	@echo "Making versionfile"
-	@cp version.stub versionfile
-	@echo \<releaseinfo\>MIRA Version ${GITBUILD}\</releaseinfo\> >>versionfile
-
-clean-local:
-	rm -rf *html *pdf versionfile
+	distclean distclean-generic distclean-libtool distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
 
-%_part.html: %_part.xml
-	@echo "Making .html out of _part.xml" $@
-	@$(SHELL) -ec 'xsltproc --nonet --xinclude --output $@  $(top_srcdir)/doc/docbook/mira.xsl $<'
 
-chapters: ${CHAP_HTML} versionfile
+clean:
+	rm -rf *html *pdf
 
-book_3rdparty_html: versionfile ${CHAP_XML} book_3rdparty.xml
-	xsltproc --nonet --xinclude --output 3rdparty_MIRA.html $(top_srcdir)/doc/docbook/book.xsl $(top_srcdir)/doc/docbook/book_3rdparty.xml
+%_part.html: %_part.xml
+	@echo "Making .html out of _part.xml" $@
+	@$(SHELL) -ec 'xsltproc --xinclude --output $@  $(top_srcdir)/doc/docbook/mira.xsl $<'
 
-book_3rdparty_pdf: versionfile ${CHAP_XML} book_3rdparty.xml
-	dblatex --xslt-opts=--nonet --output=3rdparty_MIRA.pdf $(top_srcdir)/doc/docbook/book_3rdparty.xml
+chapters: ${CHAP_HTML}
 
-book_definitive_html: versionfile ${CHAP_XML} book_definitiveguide.xml
-	xsltproc --nonet --xinclude --output DefinitiveGuideToMIRA.html $(top_srcdir)/doc/docbook/book.xsl $(top_srcdir)/doc/docbook/book_definitiveguide.xml
-book_definitive_pdf: versionfile ${CHAP_XML} book_definitiveguide.xml
+books: ${CHAP_XML} book_definitiveguide.xml
+	xsltproc --xinclude --output DefinitiveGuideToMIRA.html $(top_srcdir)/doc/docbook/book.xsl $(top_srcdir)/doc/docbook/book_definitiveguide.xml
 	dblatex --xslt-opts=--nonet --output=DefinitiveGuideToMIRA.pdf $(top_srcdir)/doc/docbook/book_definitiveguide.xml
 
-book_definitive: versionfile ${CHAP_XML} book_definitive_html book_definitive_pdf
-
-books_html: versionfile book_definitive_html book_3rdparty_html
-
-books_pdf: versionfile book_definitive_pdf book_3rdparty_pdf
-
-books: versionfile books_html books_pdf
-
-all: versionfile books chapters
+all: chapters books
 
-docs: versionfile all
+docs: all
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/doc/docbook/attic/README.txt b/doc/docbook/attic/README.txt
deleted file mode 100644
index 96d8497..0000000
--- a/doc/docbook/attic/README.txt
+++ /dev/null
@@ -1,266 +0,0 @@
-Bah, xslt has problems with comments. It will bail out with
-
-   file.xml:1602: parser error : Comment not terminated
-
-when finding things like this:
-
-<!--
-
-bla bla bla
--rw-r--r-- 1 bach bach     954473 2010-01-27 20:48 rel8593a_info_featuresummary.
-
--->
-
-
-Therefore, instead of commenting out, things go to attic *sigh*
-
-
-
-
-  <sect1 id="sect1_est_walkthroughs">
-    <title>
-      Walkthroughs
-    </title>
-    <para>
-    </para>
-    <para>
-      These walkthroughs use "msd" as project name (acronym for My Simple Dataset),
-      please replace that with your own project name according to the MIRA naming
-      convention.
-    </para>
-    <sect2 id="sect2_mira_with_jobest">
-      <title>
-	mira with "--job=est"
-      </title>
-      <para>
-      </para>
-      <sect3 id="sect3_input:_one_strain_sanger_without_adaptors_and_no_xml">
-	<title>
-	  Example: One strain, Sanger without vectors and no XML
-	</title>
-	<para>
-	  Given is just a FASTA and FASTA quality file, where the Sanger
-	  sequencing vector sequences and problematic things (like bad
-	  quality) have been either completely removed from the data or were
-	  masked with "X". Apart from that, no further processing (poly-A
-	  removal etc.) was done. Your directory looks like this:
-	</para>
-	<screen>
-<prompt>bach at arcadia:$</prompt> <userinput>ls -l</userinput>
--rwxr--r-- 1 bach bach 15486163 2009-02-22 21:01 msd_in.sanger.fasta
--rwxr--r-- 1 bach bach 38017687 2009-02-22 21:01 msd_in.sanger.fasta.qual</screen>
-	<para>
-	</para>
-	<para>
-	  Then, use this command:
-	</para>
-	<screen>
-<prompt>$</prompt> <userinput>mira --project=msd
-  --job=denovo,est,accurate,sanger
-  SANGER_SETTINGS
-  -CL:qc=no
-  >& log_assembly.txt</userinput></screen>
-	<para>
-	</para>
-	<para>
-	  We switch off the Sanger quality clips because bad quality is
-	  already trimmed away by your pipeline.
-	</para>
-      </sect3>
-      <sect3 id="sect3_input:_one_strain_454_with_xml_ancillary_data">
-	<title>
-	  Example: One strain, 454 with XML ancillary data
-	</title>
-	<para>
-	  Like above, but this time 454 sequencing and the FASTA files contain
-	  everything (including remaining adaptors and bad quality), but
-	  there's a XML with ancillary data which contains all necessary clips
-	  (like generated by, e.g., <command>sff_extract</command>):
-	</para>
-	<screen>
-<prompt>bach at arcadia:$</prompt> <userinput>ls -l</userinput>
--rwxr--r-- 1 bach bach 15486163 2009-02-22 21:01 msd_in.454.fasta
--rwxr--r-- 1 bach bach 38017687 2009-02-22 21:01 msd_in.454.fasta.qual
--rwxr--r-- 1 bach bach 10433244 2009-02-22 21:01 msd_traceinfo_in.454.xml</screen>
-	<para>
-	  Then, use this command:
-	</para>
-	<screen>
-<prompt>bach at arcadia:$</prompt> <userinput> mira --project=msd
-  --job=denovo,est,accurate,454
-  454_SETTINGS
-  -CL:qc=no
-  >& log_assembly.txt</userinput></screen>
-	<para>
-	</para>
-	<para>
-	  We just switch off our quality clip for 454 (and load the quality
-	  clips from the XML), poly-A removal is performed by MIRA. Loading of
-	  TRACEINFO XML data must not be switched on as it's the default for
-	  454 data.
-	</para>
-      </sect3>
-      <sect3 id="sect3_input:_one_strain_454_with_xml_ancillary_data_polya_already_removed">
-	<title>
-	  Example: One strain, 454 with XML ancillary data, poly-A already removed.
-	</title>
-	<para>
-	  Like above, but this time the data was pre-processed by another program
-	  to mask the poly-A stretches with X:
-	</para>
-	<screen>
-<prompt>bach at arcadia:</prompt>$ <userinput>ls -l</userinput>
--rwxr--r-- 1 bach bach 15486163 2009-02-22 21:01 msd_in.454.fasta
--rwxr--r-- 1 bach bach 38017687 2009-02-22 21:01 msd_in.454.fasta.qual
--rwxr--r-- 1 bach bach 10433244 2009-02-22 21:01 msd_traceinfo_in.454.xml</screen>
-	<para>
-	  Then, use this command:
-	</para>
-	<screen>
-<prompt>bach at arcadia:$</prompt> <userinput>mira --project=msd
-  --job=denovo,est,accurate,454
-  454_SETTINGS
-  -CL:qc=no:cpat=no
-  >& log_assembly.txt</userinput>
-	</screen>
-	<para>
-	</para>
-	<para>
-	  We just switch off our quality clip (and load the quality clips from
-	  the XML) and also switch off poly-A clipping. Remember, never
-	  perform poly-A/T clipping twice on a data set.
-	</para>
-      </sect3>
-      <sect3 id="sect3_input:_two_strains_454_with_xml_ancillary_data_polya_already_removed">
-	<title>
-	  Example: Two strains, 454 with XML ancillary data, poly-A already
-	  removed.
-	</title>
-	<para>
-	  Like above, but this time we assign reads to different
-	  strains. This can happen either by putting the strain information
-	  into the XML file (using the <literal>strain</literal> field of the
-	  NCBI TRACEINFO format definition) or by using a two column,
-	  tab-delimited file which mira loads on request.
-	</para>
-	<para>
-	  As written. when using XML no change to the command line from the
-	  last example would be needed. This example uses the extra file with
-	  strain information. The file
-	  <filename>msd_straindata_in.txt</filename> contains key value pair
-	  information on the relationship of reads to strains and looks like
-	  this (gnlti* are name of reads):
-	</para>
-	<screen>
-<prompt>bach at arcadia:$</prompt> <userinput>cat msd_straindata_in.454.txt</userinput>
-gnlti136478626 tom
-gnlti136479357 tom
-gnlti136479063 tom
-gnlti136478624 jerry
-gnlti136479522 jerry
-gnlti136477918 jerry</screen>
-	<para>
-	  Then, use this command (note the additional <arg>-LR:lsd</arg>
-	  option):
-	</para>
-	<screen>
-<prompt>bach at arcadia:$</prompt> <userinput>mira --project=msd
-  --job=denovo,est,accurate,454
-  454_SETTINGS
-  -LR:lsd=yes
-  -CL:qc=no:cpat=no
-  >& log_assembly.txt</userinput>
-	</screen>
-      </sect3>
-    </sect2>
-    <sect2 id="sect2_mirasearchestsnps">
-      <title>
-	miraSearchESTSNPs
-      </title>
-      <para>
-      </para>
-      <sect3 id="sect3_input:_two_strains_sanger_with_masked_sequences_no_xml">
-	<title>
-	  Example: Two strains, Sanger with masked sequences, no XML
-	</title>
-	<para>
-	  Given just a FASTA and FASTA quality file, where the Sanger
-	  sequencing vectors and all sequencing related things (like bad
-	  quality) have been either completely removed from the data or were
-	  masked with "X". Apart from that, no further processing (poly-A
-	  removal etc.) was done.
-	</para>
-	<para>
-	  You have <emphasis>n</emphasis> strains (in this
-	  example <emphasis>n</emphasis>=2) called "tom" and "jerry"
-	</para>
-	<para>
-	  Your directory looks like this:
-	</para>
-	<screen>
-<prompt>bach at arcadia:$</prompt> <userinput>ls -l</userinput>
--rw-r--r-- 1 bach bach  5276 2009-02-22 21:23 msd_in.sanger.fasta
--rw-r--r-- 1 bach bach 13827 2009-02-22 21:23 msd_in.sanger.fasta.qual
--rw-r--r-- 1 bach bach   120 2009-02-22 21:27 msd_straindata_in.txt</screen>
-	<para>
-	  The file <filename>msd_straindata_in.txt</filename> contains key
-	  value pair information on the relationship of reads to strains and
-	  looks like this (gnlti* are name of reads):
-	</para>
-	<screen>
-<prompt>bach at arcadia:$</prompt> <userinput>cat msd_straindata_in.txt</userinput>
-gnlti136478626 tom
-gnlti136479357 tom
-gnlti136479063 tom
-gnlti136478624 jerry
-gnlti136479522 jerry
-gnlti136477918 jerry</screen>
-	<para>
-	  To assemble, use this:
-	</para>
-	<screen>
-<prompt>bach at arcadia:$</prompt> <userinput>miraSearchESTSNPs
-  --project=msd
-  --job=denovo,accurate,sanger,esps1
-  >&log_assembly_esps1.txt</userinput></screen>
-	<para>
-	  Note that the results of this first step are in sub-directories
-	  prefixed with "step1".
-	</para>
-	<para>
-	  When the first step finished, continue with this (note that no
-	  "--project" is given here):
-	</para>
-	<screen>
-<prompt>bach at arcadia:$</prompt> <userinput>miraSearchESTSNPs
-  --job=denovo,accurate,esps2
-  >&log_assembly_esps2.txt</userinput>
-	</screen>
-	<para>
-	  Note that the results of this second step are in sub-directories
-	  prefixed with "tom", "jerry" and "remain". You will find in each
-	  directory the clean transcripts from every strain/organism.
-	</para>
-	<para>
-	  To see which SNPs exist between both "tom" and "jerry", launch the
-	  third step:
-	</para>
-	<screen>
-<prompt>bach at arcadia:$</prompt> <userinput>miraSearchESTSNPs
-  --job=denovo,accurate,esps3
-  >&log_assembly_esps3.txt</userinput>
-	</screen>
-	<para>
-	</para>
-	<para>
-	  Note that the results of this third step are in sub-directories
-	  prefixed with "step3".
-	</para>
-	<para>
-	  In the <filename>step3_d_results</filename> directory for example,
-	  you can transform the CAF file into a gap4 database and then look at
-	  the SNPs searching for the tags SROr, SIOr and SAOr.
-	</para>
-      </sect3>
-    </sect2>
-  </sect1>
diff --git a/doc/docbook/attic/chap_pacbio_part.xml b/doc/docbook/attic/chap_pacbio_part.xml
deleted file mode 100644
index 302e1d3..0000000
--- a/doc/docbook/attic/chap_pacbio_part.xml
+++ /dev/null
@@ -1,549 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
-"http://www.docbook.org/xml/4.5/docbookx.dtd">
-<chapter id="chap_pacbio">
-  <chapterinfo>
-    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="versionfile"/>
-    <author>
-      <firstname>Bastien</firstname>
-      <surname>Chevreux</surname>
-      <email>bach at chevreux.org</email>
-    </author>
-    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="copyrightfile"/>
-  </chapterinfo>
-  <blockquote>
-    <attribution>Solomon Short</attribution>
-    <para>
-      <emphasis><quote>New problems demand new solutions. New solutions create new problems.
-      </quote></emphasis>
-    </para>
-  </blockquote>
-  <title>
-    Assembly of Pacific Biosciences data with MIRA3
-  </title>
-  <sect1 id="sect_pb_only_ccs_for_now">
-    <title>MIRA 4.0 officially supports only CCS or error-corrected-CLR</title>
-    <para>
-      This is here to set the stage: at the moment, MIRA can only make good
-      use of PacBio reads which have an error rate of roundabout 5%. This
-      means you will have to use either:
-    </para>
-    <orderedlist>
-      <listitem>
-	<para>
-	  CCS (Circular Consensus Sequence) reads with at least 3 to 4 passes.
-	</para>
-      </listitem>
-      <listitem>
-	<para>
-	  CLR (Continuous Long Reads) which were error corrected either with
-	  PacBio CCS reads, self-corrected with itself, or some other
-	  high-quality sequencing technology (Illumina comes to mind)
-	</para>
-      </listitem>
-    </orderedlist>
-    <para>
-      Impatient people can directly jump to
-      <xref linkend="sect_pb_walkthrough_realdata"/> which contains
-      walkthroughs using data made publicly available by PacBio.
-    </para>
-    <para>
-      Unofficially, MIRA also supports uncorrected reads. However, the
-      assemblies are currently (as of 4.0) not good enough and using MIRA with
-      this kind of data is not recommended for general use.
-    </para>
-  </sect1>
-  <sect1 id="sect_pb_warninto">
-    <title>WARNING</title>
-    <para>
-      During the course of 2011, PacBio has made available on
-      their <ulink url="http://www.pacbiodevnet.com/">DevNet</ulink> site
-      quite a number of documents and introductory videos. A must read for
-      everyone working with this sequencing technology.
-    </para>
-  </sect1>
-
-  <sect1 id="sect_pb_introduction">
-    <title>Introduction</title>
-    <para>
-      As of January 2014, Pacific Biosciences looks like the new undisputed
-      star in the de-novo sequencing arena. Illumina may try to counter it via
-      Moleculo, but first reports point at a few shortcomings of Moleculo
-      which Pacific Biosciences does not have.
-    </para>
-    <sect2 id="sect_pb_some_reading_requirements">
-      <title>Some reading requirements</title>
-      <para>
-	This guide assumes that you have basic working knowledge of Unix
-	systems, know the basic principles of sequencing (and sequence
-	assembly) and what assemblers do.
-      </para>
-      <para>
-	While there are step by step walk-throughs on how to setup your
-	data for Sanger, 454 and Solexa in other MIRA guides, this guide is
-	(currently) a bit more terse. You are expected to read at some point in
-	time:
-      </para>
-      <itemizedlist>
-        <listitem>
-          <para>the <emphasis>mira_reference</emphasis> help file to look up
-          some command line options.</para>
-        </listitem>
-        <listitem>
-          <para> for hybrid assemblies of PacBio data with Sanger, 454, Solexa
-          the corresponding <emphasis>mira_usage</emphasis>,
-          <emphasis>mira_454</emphasis> or <emphasis>mira_solexa</emphasis>
-          help files to look up how to prepare the different data sets.</para>
-        </listitem>
-      </itemizedlist>
-    </sect2>
-  </sect1>
-  <sect1 id="sect_pb_pacbiowithmira">
-    <title>Assembly of PacBio data with MIRA</title>
-    <para>
-    </para>
-    <sect2 id="sect_pb_prepdata">
-      <title>Preparing data</title>
-      <para>
-	MIRA will happily read data in several different formats (FASTA,
-	FASTQ, etc.). For the sake of simplicity, this guide will use FASTQ as
-	demonstration format.
-      </para>
-      <sect3 id="sect_pb_as_prepdata_simple">
-	<title>Unpaired reads</title>
-	<para>
-	  This is actually quite simple. Just put your reads as FASTQ in a
-	  file and you are done. No need to bother about read naming
-	  conventions or similar things. Like so:
-	  <screen>
- at readname_001
-ACGTTGCAGGGTCATGCAGT...
- at readname_002
-...</screen>
-	</para>
-      </sect3>
-    </sect2>
-    <sect2 id="sect_pb_as_setting_up_files">
-      <title>Setting up files and directories</title>
-    </sect2>
-    <sect2 id="sect_pb_as_launching_mira">
-      <title>Launching MIRA</title>
-      <para>
-	In the most basic incantation, you will need to tell MIRA just five things:
-      </para>
-      <orderedlist>
-	<listitem>
-	  <para>
-	    the name of your project.
-	  </para>
-	</listitem>
-	<listitem>
-	  <para>
-	    whether you want a "genome" or "EST" assembly
-	  </para>
-	</listitem>
-	<listitem>
-	  <para>
-	    whether it is a denovo or mapping assembly
-	  </para>
-	</listitem>
-	<listitem>
-	  <para>
-	    which quality level (draft, normal or accurate)
-	  </para>
-	</listitem>
-	<listitem>
-	  <para>
-	    the data you want to use
-	  </para>
-	</listitem>
-      </orderedlist>
-      <para>
-	The above needs to be written together in a manifest file, which is a
-	file listing the MIRA configuration and the data it should use. Have a
-	look at the walkthrough below and at the MIRA reference to get an idea
-	on how to write such a file (it's simple, really). Then start MIRA
-	like this:
-      </para>
-      <screen>
-<command>mira</command> <replaceable>manifest.conf >&log_assembly.txt</replaceable></screen>
-      <note>
-	MIRA has -- at the last count -- more than 150 parameters one can use
-	to fine tune almost every aspect of an assembly, from data loading
-	options to results saving, from data preprocessing to results
-	interpretation, from simple alignment parameters to parametrisation of
-	internal misassembly decision rules ... and much more. Many of these
-	parameters can be even set individually for each sequencing technology
-	they apply to. Example given: in an assembly with Solexa, Sanger, 454
-	and PacBio data, the minimum read length for Solexa could be set to
-	30, while for 454 it could be 80, Sanger 100 and PacBio 150. Please
-	refer to the reference manual for a full overview on how to use
-	<emphasis>quick switches</emphasis> and <firstterm>extended
-	switches</firstterm> in manifest files.
-      </note>
-    </sect2>
-  </sect1>
-  <sect1 id="sect_pb_walkthrough_realdata">
-    <title>Walkthroughs: real data sets from PacBio</title>
-    <para>
-      We'll use some data provided by PacBio for the
-      <emphasis>E. coli</emphasis> O104:H4 outbreak in 2011, see <ulink
-      url="http://www.pacbiodevnet.com/Share/Datasets/E-coli-Outbreak"/> for
-      more info.
-    </para>
-    <sect2 id="sect_pb_wtrd_clrc">
-      <title>
-	Error corrected CLR for E. coli C227-11$
-      </title>
-      <para>
-	That data set is quite interesting: PacBio took CLR reads (the reads
-	with only ~85% accuracy) and mapped CCS reads (presumably >90%
-	accuracy) to them to correct errors of the CLR reads. The resulting
-	<emphasis>error corrected CLR</emphasis> data is of pretty good
-	quality, not only from the quality values but when assembled, the
-	number of sequencing errors in the reads which can be spotted in the
-	alignments is obviously quite low.
-      </para>
-      <sect3 id="sect_pb_wtrd_clrc_prep_filesystem">
-	<title>
-	  Preparing a directory structure
-	</title>
-	<para>
-	  Note: this is how I set up a project, feel free to implement whatever
-	  structure suits your needs.
-	</para>
-	<screen>
-<prompt>$</prompt> <userinput>mkdir c227-11-clrc</userinput>
-<prompt>$</prompt> <userinput>cd c227-11-clrc</userinput>
-<prompt>arcadia:c227-11-clrc$</prompt> <userinput>mkdir origdata data assemblies</userinput></screen>
-	<para>
-	  Your directory should now look like this:
-	</para>
-	<screen>
-<prompt>arcadia:c227-11-clrc$</prompt> <userinput>ls -l</userinput>
-drwxr-xr-x 2 bach users 48 2011-08-19 20:21 assemblies
-drwxr-xr-x 2 bach users 48 2011-08-19 20:21 data
-drwxr-xr-x 2 bach users 48 2011-08-19 20:21 origdata</screen>
-        <para>
-	  "c227-11-clrc" is an arbitrary name I just chose by concatenating
-	  the name of the bug and "-clrc" to indicate that this project has
-	  <emphasis role="bold">CLR</emphasis> sequences which were <emphasis
-	  role="bold">C</emphasis>orected. But you can name this whatever you
-	  want: foobar, blafurbsel, ...
-	</para>
-        <para>
-	  Explanation of the structure:
-	</para>
-	<itemizedlist>
-	  <listitem>
-	    <para>
-	      the <filename>origdata</filename> directory will contain the 'raw'
-	      result files that one might get from sequencing. In our case it
-	      will be the <filename>.tar.gz</filename> file with the data in
-	      FASTQ format from the DevNet site.
-	    </para>
-	  </listitem>
-	  <listitem>
-	    <para>
-	      the <filename>data</filename> directory will contain the
-	      preprocessed sequences for the assembly, ready to be used by MIRA
-	    </para>
-	  </listitem>
-	  <listitem>
-	    <para>
-	      the <filename>assemblies</filename> directory will contain
-	      assemblies we make with our data (we might want to make more than
-	      one).
-	    </para>
-	  </listitem>
-	</itemizedlist>
-      </sect3>
-      <sect3 id="sect_pb_wtrd_clrc_getdata">
-	<title>
-	  Getting the data and preparing it
-	</title>
-	<para>
-	  Head over to PacBio DevNet and fetch the data set for the <ulink
-	  url="http://www.pacbiodevnet.com/Share/Datasets/e-coli-c227-11-corrected-fastq-1.2.2beta.tgz">E. coli
-	  C227-11 CLR corrected</ulink> data set. Put it into the
-	  <filename>origdata</filename> directory created a few moments ago.
-	</para>
-	<para>
-	  Now, let's extract the data to the <filename>data</filename> directory:
-	</para>
-	<screen>
-<prompt>arcadia:c227-11-clrc$</prompt> <userinput>cd data</userinput>
-<prompt>arcadia:data$</prompt> <userinput>tar xvzf ../origdata/e-coli-c227-11-corrected-fastq-1.2.2beta.tgz</userinput>
-e-coli-c227-11-corrected-fastq-1.2.2beta/
-e-coli-c227-11-corrected-fastq-1.2.2beta/e-coli-c227-11-corrected.fastq</screen>
-        <para>
-	  One thing you would quickly find out but which I tell now to save
-	  time: at the moment, PacBio seems to love ultra long read
-	  names. Here are the first 10 from the current data set:
-        </para>
-	<screen>
-<prompt>arcadia:data$</prompt> <userinput>grep ^@m e-coli-c227-11-corrected-fastq-1.2.2beta/e-coli-c227-11-corrected.fastq | head -10</userinput>
- at m110618_035655_42142_c100158802555500000315044108071130_s1_p0/10040/0_5174/c0
- at m110618_035655_42142_c100158802555500000315044108071130_s1_p0/10040/0_5174/c1
- at m110618_035655_42142_c100158802555500000315044108071130_s1_p0/1017/0_1636/c0
- at m110618_035655_42142_c100158802555500000315044108071130_s1_p0/1054/0_4073/c0
- at m110618_035655_42142_c100158802555500000315044108071130_s1_p0/1054/0_4073/c1
- at m110618_035655_42142_c100158802555500000315044108071130_s1_p0/1054/4121_4891/c0
- at m110618_035655_42142_c100158802555500000315044108071130_s1_p0/10548/0_5766/c0
- at m110618_035655_42142_c100158802555500000315044108071130_s1_p0/10548/0_5766/c1
- at m110618_035655_42142_c100158802555500000315044108071130_s1_p0/10640/0_2393/c0
- at m110618_035655_42142_c100158802555500000315044108071130_s1_p0/11000/0_3285/c0</screen>
-        <para>
-	  How sweet! Read names with 80 and more characters AND having the "/"
-	  character as component, the later being a recipe for disaster sooner
-	  or later in some post-processing pipelines.
-        </para>
-	<note>
-	  MIRA has absolutely no problem with the above: neither with long read
-	  names nor with the "/" character in the name. However, long read names
-	  are a problem for example for <command>gap4</command> (an assembly
-	  viewer) and the "/" character might lead to confusion with the
-	  standard UNIX directory separator, many programs which can be used
-	  to post-process assemblies simply disallow that character.
-	</note>
-        <para>
-	  For the sake of simplicity and compatibility, let's rename all
-	  sequences. For this we'll use <command>miraconvert</command>,
-	  which is a binary of the MIRA program package:
-        </para>
-	<screen>
-<prompt>arcadia:data$</prompt> <userinput>miraconvert
-  -R c227-11-clrc
-  e-coli-c227-11-corrected-fastq-1.2.2beta/e-coli-c227-11-corrected.fastq
-  c227-11-clrc.fastq</userinput>
-Loading from fastq, saving to: fastq
-Loading data from FASTQ ...
-Counting sequences in FASTQ file: found 73496 sequences.
-Localtime: Sat Aug 20 20:36:26 2011
-Unusual offset of 34, guessing this file to be a Sanger-type FASTQ format.
-Using calculated FASTQ quality offset: 33
-Localtime: Sat Aug 20 20:36:26 2011
-Loading data from FASTQ file:
- [0%] ....|.... [10%] ....|.... [20%] ....|.... [30%] ....|.... [40%] ....|....
-[50%] ....|.... [60%] ....|.... [70%] ....|.... [80%] ....|.... [90%] ....|.... [100%]
-
-Done.
-Loaded 73496 reads, Localtime: Sat Aug 20 20:36:35 2011
- done.
-Data conversion process finished, no obvious errors encountered.</screen>
-      <note>
-	The above command has been split in multiple lines for better overview
-	but should be entered in one line.
-      </note>
-      <para>
-	The parameters to <command>miraconvert</command> say
-      </para>
-	<itemizedlist>
-	  <listitem>
-	    <para>
-	      <emphasis role="bold">-R c227-11-clrc</emphasis>: sequences
-	      should be renamed, all starting with "c227-11-clrc" and to which
-	      <command>miraconvert</command> will append an underscore and
-	      a counter.
-	    </para>
-	  </listitem>
-	  <listitem>
-	    <para>
-	      <emphasis
-	      role="bold">e-coli-c227-11-corrected-fastq-1.2.2beta/e-coli-c227-11-corrected.fastq</emphasis>:
-	      that's the full name of our input file.
-	    </para>
-	  </listitem>
-	  <listitem>
-	    <para>
-	      <emphasis role="bold">c227-11-clrc.fastq</emphasis>: that's
-	      the name of our output file.
-	    </para>
-	  </listitem>
-	</itemizedlist>
-	<para>
-	  Your directory should now look like this ...
-	</para>
-	<screen>
-<prompt>arcadia:data$</prompt> <userinput>ls -l</userinput>
--rw-r--r-- 1 bach bach 257844076 2011-08-20 21:04 c227-11-clrc.fastq
-drwxr-x--- 2 bach bach      4096 2011-07-22 04:49 e-coli-c227-11-corrected-fastq-1.2.2beta</screen>
-	<para>
-	  ... and as we do not need the subdirectory with the extracted data from PacBio anymore, let's get rid of it:
-	</para>
-	<screen>
-<prompt>arcadia:data$</prompt> <userinput>rm -rf e-coli-c227-11-corrected-fastq-1.2.2beta</userinput>
-<prompt>arcadia:data$</prompt> <userinput>ls -l</userinput>
--rw-r--r-- 1 bach bach 257844076 2011-08-20 21:04 c227-11-clrc.fastq</screen>
-	<para>
-	  Perfect, we're done here.
-	</para>
-      </sect3>
-      <sect3 id="sect_pb_wtrd_clrc_starting_assembly">
-	<title>
-	  Starting the assembly
-	</title>
-	<para>
-	  Good, we're almost there. Let's switch to the
-	  <filename>assembly</filename> directory and create a subdirectory for our
-	  first assembly test.
-	</para>
-	<screen>
-<prompt>arcadia:data$</prompt> <userinput>cd ../assemblies/</userinput>
-<prompt>arcadia:assemblies$</prompt> <userinput>mkdir 1sttest</userinput>
-<prompt>arcadia:assemblies$</prompt> <userinput>cd 1sttest</userinput></screen>
-        <para>
-	  This directory is quite empty and the PacBio data is not
-	  present. And it does not need to be as we'll tell MIRA in the manifest
-	  configuration file where to find the data and what to do with it.
-	</para>
-	<screen>
-# A manifest file can contain comment lines, these start with the #-character
-
-# First part of a manifest: defining some basic things
-
-# In this example, we just give a name to the assembly
-#  and tell MIRA it should assemble a genome de-novo in accurate mode
-
-<userinput>project = <replaceable>c227-11-clrc</replaceable>
-job = <replaceable>genome,denovo,accurate</replaceable>
-parameters = <replaceable>-CO:mrpg=5</replaceable></userinput>
-
-# The second part defines the sequencing data MIRA should load and assemble
-# The data is logically divided into "readgroups", for more information
-#  please consult the MIRA manual, chapter "Reference"
-
-<userinput>readgroup = <replaceable>MyPacBioCLRCReads</replaceable>
-technology = <replaceable>pcbiohq</replaceable>
-data = <replaceable>../../data/c227-11-clrc.fastq</replaceable></userinput></screen>
-        <para>
-	  Starting the assembly is now just a matter of one line:
-	</para>
-	<screen>
-<prompt>arcadia:1sttest$</prompt> <userinput>mira <replaceable>manifest.conf >&log_assembly.txt</replaceable></userinput></screen>
-	<para>
-	  Some 3 to 4 hours later, you should have a nice and shiny assembly of
-	  your data.
-	</para>
-	<para>
-	  Now, that was easy, wasn't it? In the above example - for assemblies
-	  having only PacBio data and if you followed the walkthrough on how to
-	  prepare the data - everything you might want to adapt in the first
-	  time are the following options:
-	</para>
-	<itemizedlist>
-	  <listitem>
-	    <para>
-	      project= (for naming your assembly project)
-	    </para>
-	  </listitem>
-	  <listitem>
-	    <para>
-	      job= (perhaps to change the quality of the assembly to 'draft'
-	    </para>
-	  </listitem>
-	  <listitem>
-	    <para>
-	      parameters= -CO:mrpg= X
-	    </para>
-	    <para>
-	      At the moment, this parameter needs to be adjusted by YOU
-	      regarding the expected average coverage of error corrected reads
-	      in your project. The value <emphasis>X</emphasis> should be set
-	      as in <emphasis>X = AvgCov / 5</emphasis> (alternatively divide
-	      by 4 or 6).
-	    </para>
-	  </listitem>
-	</itemizedlist>
-	<para>
-	  Of course, you are free to change any of the > 150 options via
-	  the extended parameters MIRA has ... but this is covered in the MIRA
-	  main reference manual.
-	</para>
-      </sect3>
-      <sect3 id="sect_pb_wtrd_clrc_working_with_results">
-	<title>
-	  Working with the results of the assembly
-	</title>
-	<para>
-	  There is a whole chapter in the manual dedicated to this, you are expected to read it :-)
-	</para>
-	<para>
-	  However, for the impatient, here's a quick rundown on what I am
-	  going to show as example in this section: loading results into an
-	  assembly viewer.
-	</para>
-      </sect3>
-      <sect3 id="sect_pb_wtrd_clrc_wwr_gap4">
-	<title>
-	  Looking at the assembly in gap4
-	</title>
-	<para>
-	  I'm very fond of gap4, so I'll use it to show ho the assembly looks like:
-	</para>
-	<screen><prompt>arcadia:c227-11-clrc_results$</prompt> <userinput>caf2gap -project c227-11 -ace c227-11-clrc_LargeContigs_out.caf >&/dev/null</userinput>
-<prompt>arcadia:c227-11-clrc_results$</prompt> <userinput>ls -l C*</userinput>
--rw-r--r-- 1 bach bach 543539856 2011-08-20 22:35 C227-11.0
--rw-r--r-- 1 bach bach  39512896 2011-08-20 22:35 C227-11.0.aux
-<prompt>arcadia:c227-11-clrc_results$</prompt> <userinput>gap4 C227-11.0</userinput></screen>
-	<para>
-	  And while it's difficult to judge an assembly only from a
-	  screen shot, I made one: 22 contigs, none smaller than 4kb and
-	  pretty good certainty your bases are correct. Pray tell, isn't that
-	  beautiful?
-	</para>
-	<figure id="chap_pacbio::pb_elasticdarkinserts04">
-	  <title>
-	    Result of the assembly of <emphasis>E. coli</emphasis> C227-11 with
-	    error corrected CLR reads.
-	  </title>
-	  <mediaobject>
-	    <imageobject>
-	      <imagedata fileref="bookfigures/pb_c227-11-clcr_res.png" width="90%"/>
-	    </imageobject>
-	  </mediaobject>
-	</figure>
-      </sect3>
-    </sect2>
-    <sect2>
-      <title>CCS reads for E. coli C227-11</title>
-      <para>
-	Head over to PacBio DevNet and fetch the data set for the <ulink
-	url="http://www.pacbiodevnet.com/Share/Datasets/e-coli-c227-11-ccs-fastq-1.2.2beta.tgz">E. coli
-	C227-11 CCS</ulink> data set.
-      </para>
-      <para>
-	For the rest ... well, it's pretty much the same as for the CLR data
-	set. Just one little difference: in the <filename>.tgz</filename> you
-	downloaded, PacBio has split the data set into multiple FASTQ files
-	(for whatever reason). You will need to give those names in the
-	manifest file before starting to work with that. Yep, and that's it.
-      </para>
-    </sect2>
-  </sect1>
-  <sect1 id="sect_pb_exsd_hybrids">
-    <title>Hybrid assemblies: PacBio plus Sanger/454/Solexa/IonTorrent</title>
-    <para>
-      TO BE EXPANDED: no real walkthrough yest, just a few hints.
-    </para>
-    <itemizedlist>
-      <listitem>
-	<para>
-	  Prepare your PacBio data like explained in this guide. I.e.: get it
-	  error corrected into FASTQ files.
-	</para>
-      </listitem>
-      <listitem>
-	<para>
-	  Prepare your other data (Sanger, 454, Solexa, IonTorrent or any combination of
-	  it) like explained in the respective MIRA guides.
-	</para>
-      </listitem>
-      <listitem>
-	<para>
-	  Write a manifest which includes all data files as readgroups and start MIRA.
-	</para>
-      </listitem>
-    </itemizedlist>
-  </sect1>
-</chapter>
diff --git a/doc/docbook/attic/chap_solexa_part.xml b/doc/docbook/attic/chap_solexa_part.xml
deleted file mode 100644
index 5c3fc41..0000000
--- a/doc/docbook/attic/chap_solexa_part.xml
+++ /dev/null
@@ -1,1512 +0,0 @@
-<?xml version="1.0" ?>
-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.docbook.org/xml/4.5/docbookx.dtd">
-<chapter id="chap_solexa">
-  <chapterinfo>
-    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="versionfile"/>
-    <author>
-      <firstname>Bastien</firstname>
-      <surname>Chevreux</surname>
-      <email>bach at chevreux.org</email>
-    </author>
-    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="copyrightfile"/>
-  </chapterinfo>
-  <blockquote>
-    <attribution>Solomon Short</attribution>
-    <para>
-      <emphasis><quote>There is no such thing like overkill.
-      </quote></emphasis>
-    </para>
-  </blockquote>
-  <title>Assembly of Illumina data with MIRA3</title>
-  <sect1 id="sect_sxa_introduction">
-    <title>
-      Introduction
-    </title>
-    <para>
-      This guide assumes that you have basic working knowledge of Unix systems, know
-      the basic principles of sequencing (and sequence assembly) and what assemblers
-      do.
-    </para>
-    <para>
-      While there are step by step instructions on how to setup your Solexa data and
-      then perform an assembly, this guide expects you to read at some point in time
-    </para>
-    <itemizedlist>
-      <listitem>
-	<para>
-	  the <emphasis>MIRA reference manual</emphasis> file to look up some
-	  command line options as well as general information on what tags
-	  MIRA uses in assemblies, files it generates etc.pp
-	</para>
-      </listitem>
-      <listitem>
-	<para>
-	  the <emphasis>short usage introduction</emphasis> to MIRA3 so that
-	  you have a basic knowledge on how to set up projects in mira for
-	  Sanger sequencing projects.
-	</para>
-      </listitem>
-    </itemizedlist>
-    <para>
-    </para>
-  </sect1>
-  <sect1 id="sect_sxa_caveats_when_assembling_solexa_data">
-    <title>
-      Caveats when assembling Solexa data
-    </title>
-    <para>
-      Even very short Solexa reads (< 50bp) are great for mapping assemblies. I
-      simply love them as you can easily spot differences in mutant organisms
-      ... or boost the quality of a newly sequenced genome to Q60.
-    </para>
-    <para>
-      Regarding de-novo assemblies ... well, from an assembler's point of
-      view, very short reads are a catastrophe, regardless of the sequencing
-      technology.
-    </para>
-    <orderedlist>
-      <listitem>
-	<para>
-	  Repeats. The problem of repetitive sequences (e.g. rRNA stretches in
-	  bacteria) gets worse the shorter the read lengths get.
-	</para>
-      </listitem>
-      <listitem>
-	<para>
-	  Amount of data. As MIRA is by heart an assembler to resolve
-	  difficult repetitive problems as they occur in Sanger and 454 reads, it
-	  drags along quite a lot of ancillary information which is useless in
-	  Solexa assemblies ... but still eats away memory.
-	</para>
-      </listitem>
-    </orderedlist>
-    <para>
-    </para>
-    <para>
-      Things look better for the now available 'longer' Solexa reads. Starting
-      with a length of 75bp and paired-end data, de-novo for bacteria is not
-      that bad at all. The first Solexas with a length of ~110 bases are
-      appearing in public, and from a contig building these are about as good
-      for de-novo as the first 454 GS20 reads were (from a quality perspective
-      they are even way better).
-    </para>
-    <note>
-      <title>
-	Rule of thumb: in genome sequencing, the longer, the better.
-      </title>
-      <para>
-	If you have to pay a bit more to get longer reads (e.g. Solexa 100mers
-	instead of 75mers), go get the longer reads. With these, the results
-	you generate are way(!) better than with 36, 50 or even 75mers
-	... both in mapping and de-novo. Don't try to save a couple of hundred
-	bucks in sequencing, you'll pay dearly afterwards in assembly.
-      </para>
-      <para>
-	For RNASeq, things are a bit more complicated
-      </para>
-    </note>
-    <note>
-      <title>
-	Rule of thumb: in RNASeq de-novo sequencing, the longer, the better.
-      </title>
-      <para>
-	Like for genome sequencing, go get longer reads. Your assemblies will
-	be definitively be better.
-      </para>
-    </note>
-    <note>
-      <para>
-	Even if you can get bacteria sequenced with ridiculously high coverage
-	like 500x or 1000x, this amount of data is simply not needed. Even
-	more important - though counterintuitive - is the fact that due to
-	non-random sequence dependent sequencing errors, a too high coverage
-	may even make the assembly worse.
-      </para>
-      <para>
-	Another rule of thumb: when having more than enough data, reduce the
-	data set so as to have an average coverage of approximately 100x. In
-	some rare cases (high GC content), perhaps 120x to 150x, but certainly
-	not more.
-      </para>
-    </note>
-    <warning>
-      When reducing a data set, do <emphasis role="bold">NOT</emphasis>, under
-      no circumstances not, try fancying selection of reads by some arbitrary
-      quality or length criteria. This will introduce a terrible bias in your
-      assembly due to non-random sequence-dependent sequencing errors and
-      non-random sequence dependent base quality assignment. More on this in
-      the next section.
-    </warning>
-  </sect1>
-  <sect1 id="sect_sxa_typical_highlights_and_lowlights_of_solexa_sequencing_data">
-    <title>
-      Typical highlights and lowlights of Solexa sequencing data
-    </title>
-    <para>
-      <emphasis role="bold">Note:</emphasis> This section contains things I've
-      seen in the past and simply jotted down. You may have different
-      observations.
-    </para>
-    <sect2 id="sect_sxa_highlights">
-      <title>
-	Highlights
-      </title>
-      <para>
-      </para>
-      <sect3 id="sect_sxa_highlights_quality">
-	<title>
-	  Quality
-	</title>
-	<para>
-	  For 36mers and the MIRA proposed-end-clipping, even in the old
-	  pipeline I get about 90 to 95% reads matching to a reference without
-	  a single error. For 72mers, the number is approximately 5% lower,
-	  100mers another 5% less. Still, these are great numbers.
-	</para>
-      </sect3>
-      <sect3 id="sect_sxa_highlights_pipeline">
-	<title>
-	  Improved base calling pipeline of Illumina
-	</title>
-	<para>
-	  The new base calling pipeline (1.4 or 2.4?) rolled out by Illumina
-	  in Q1/Q2 2009 typically yields 20-50% more data from the very same
-	  images. Furthermore, the base calling is way better than in the old
-	  pipeline. For Solexa 76 mers, after trimming I get only 1% real
-	  junk, between 85 and 90% of the reads are matching to a reference
-	  without a single error. Of the remaining reads, roughly 50% have one
-	  error, 25% have two errors, 12.5% have three errors etc.
-	</para>
-	<para>
-	  It is worthwhile to re-analyse your old data if the images are
-	  still around.
-	</para>
-      </sect3>
-    </sect2>
-    <sect2 id="sect_sxa_lowlights">
-      <title>
-	Lowlights
-      </title>
-      <para>
-      </para>
-      <sect3 id="sect_sxa_lowlights_longhomopolymers">
-	<title>
-	  Long homopolymers
-	</title>
-	<para>
-	  Long homopolymers (stretches of identical bases in reads) can be a
-	  slight problem for Solexa. However, it must be noted that this is a
-	  problem of all sequencing technologies on the market so far (Sanger,
-	  Solexa, 454). Furthermore, the problem in much less pronounced in
-	  Solexa than in 454 data: in Solexa, first problem appear may appear
-	  in stretches of 9 to 10 bases, in 454 a stretch of 3 to 4 bases may
-	  already start being problematic in some reads.
-	</para>
-      </sect3>
-      <sect3 id="sect_sxa_lowlights_GGCxG_motif">
-	<title>
-	  The GGCxG and GGC motifs
-	</title>
-	<para>
-	  <literal>GGCxG</literal> or even <literal>GGC</literal> motif in the
-	  5' to 3' direction of reads. This one is particularly annoying and
-	  it took me quite a while to circumvent in MIRA the problems it
-	  causes.
-	</para>
-	<para>
-	  Simply put: at some places in a genome, base calling after a
-	  <literal>GGCxG</literal> or <literal>GGC</literal> motif is
-	  particularly error prone, the number of reads without errors
-	  declines markedly. Repeated <literal>GGC</literal> motifs worsen
-	  the situation. The following screen shots of a mapping assembly
-	  illustrate this.
-	</para>
-	<para>
-	  The first example is a the <literal>GGCxG</literal> motif (in form
-	  of a <literal>GGCTG</literal>) occurring in approximately one third
-	  of the reads at the shown position. Note that all but one read
-	  with this problem are in the same (plus) direction.
-	</para>
-	<figure id="sxa_unsc_ggcxg2_lenski.png">
-	  <title>
-	    The Solexa GGCxG problem.
-	  </title>
-	  <mediaobject>
-	    <imageobject>
-	      <imagedata fileref="bookfigures/sxa_unsc_ggcxg2_lenski.png" width="90%"/>
-	    </imageobject>
-	  </mediaobject>
-	</figure>
-	<para>
-	  The next two screen shots show the <literal>GGC</literal>, once for
-	  forward direction and one with reverse direction reads:
-	</para>
-	<figure id="sxa_unsc_ggc1_lenski.png">
-	  <title>
-	    The Solexa GGC problem, forward example
-	  </title>
-	  <mediaobject>
-	    <imageobject>
-	      <imagedata fileref="bookfigures/sxa_unsc_ggc1_lenski.png" width="90%"/>
-	    </imageobject>
-	  </mediaobject>
-	</figure>
-	<figure id="sxa_unsc_ggc4_lenski.png">
-	  <title>
-	    The Solexa GGC problem, reverse example
-	  </title>
-	  <mediaobject>
-	    <imageobject>
-	      <imagedata fileref="bookfigures/sxa_unsc_ggc4_lenski.png" width="90%"/>
-	    </imageobject>
-	  </mediaobject>
-	</figure>
-	<para>
-	  Places in the genome that have <literal>GGCGGC.....GCCGCC</literal>
-	  (a motif, perhaps even repeated, then some bases and then an
-	  inverted motif) almost always have very, very low number of good
-	  reads. Especially when the motif is <literal>GGCxG</literal>.
-	</para>
-	<para>
-	  Things get especially difficult when these motifs occur at sites
-	  where users may have a genuine interest. The following example is a
-	  screen shot from the Lenski data (see walk-through below) where a
-	  simple mapping reveals an anomaly which -- in reality -- is an IS
-	  insertion (see <ulink
-	  url="http://www.nature.com/nature/journal/v461/n7268/fig_tab/nature08480_F1.html"/>)
-	  but could also look like a <literal>GGCxG</literal> motif in forward
-	  direction (<literal>GGCCG</literal>) and at the same time a
-	  <literal>GGC</literal> motif in reverse direction:
-	</para>
-	<figure id="sxa_xmastree_lenski2.png">
-	  <title>
-	    A genuine place of interest almost masked by the
-	    <literal>GGCxG</literal> problem.
-	  </title>
-	  <mediaobject>
-	    <imageobject>
-	      <imagedata fileref="bookfigures/sxa_xmastree_lenski2.png" width="90%"/>
-	    </imageobject>
-	  </mediaobject>
-	</figure>
-      </sect3>
-      <sect3 id="sect_sxa_lowlights_gcbias">
-	<title>
-	  Strong GC bias in some Solexa data (2nd half 2009 until advent of TruSeq kit at end of 2010)
-	</title>
-      </sect3>
-      <para>
-	Here I'm recycling a few slides from a couple of talks I held in 2010.
-      </para>
-      <para>
-	Things used to be so nice and easy with the early Solexa data I worked
-	with (36 and 44mers) in late 2007 / early 2008. When sample taking was
-	done right -- e.g. for bacteria: in stationary phase -- and the
-	sequencing lab did a good job, the read coverage of the genome was
-	almost even. I did see a few papers claiming to see non-trivial GC
-	bias back then, but after having analysed the data I worked with I
-	dismissed them as "not relevant for my use cases." Have a look at the
-	following figure showing exemplarily the coverage of a 45% GC
-	bacterium in 2008:
-      </para>
-      <figure id="sxa_gcbias_nobias2008.png">
-	<titleabbrev>
-	  Example for no GC coverage bias in 2008 Solexa data.
-	</titleabbrev>
-	<title>
-	  Example for no GC coverage bias in 2008 Solexa data. Apart from a
-	  slight <emphasis>smile shape</emphasis> of the coverage --
-	  indicating the sample taking was not 100% in stationary phase of the
-	  bacterial culture -- everything looks pretty nice: the average
-	  coverage is at 27x, and when looking at potential genome
-	  duplications at twice the coverage (54x), there's nothing apart a
-	  single peak (which turned out to be a problem in a rRNA region).
-	</title>
-	<mediaobject>
-	  <imageobject>
-	    <imagedata fileref="bookfigures/sxa_gcbias_nobias2008.png" width="90%"/>
-	  </imageobject>
-	</mediaobject>
-      </figure>
-      <para>
-	Things changed starting sometime in Q3 2009, at least that's when I
-	got some data which made me notice a problem. Have a look at the
-	following figure which shows exactly the same organism as in the
-	figure above (bacterium, 45% GC):
-      </para>
-      <figure id="sxa_gcbias_bias2009.png">
-	<titleabbrev>
-	  Example for GC coverage bias starting Q3 2009 in Solexa data.
-	</titleabbrev>
-	<title>
-	  Example for GC coverage bias starting Q3 2009 in Solexa
-	  data. There's no <emphasis>smile shape</emphasis> anymore -- the
-	  people in the lab learned to pay attention to sample in 100%
-	  stationary phase -- but something else is extremely disconcerting:
-	  the average coverage is at 33x, and when looking at potential genome
-	  duplications at twice the coverage (66x), there are several dozen
-	  peaks crossing the 66x threshold over a several kilobases (in one
-	  case over 200 Kb) all over the genome. As if several small genome
-	  duplications happened.
-	</title>
-	<mediaobject>
-	  <imageobject>
-	    <imagedata fileref="bookfigures/sxa_gcbias_bias2009.png" width="90%"/>
-	  </imageobject>
-	</mediaobject>
-      </figure>
-      <para>
-	By the way, the figures above are just examples: I saw over a dozen
-	sequencing projects in 2008 without GC bias and several dozen in 2009
-	/ 2010 with GC bias.
-      </para>
-      <para>
-	Checking the potential genome duplication sites, they all looked
-	"clean", i.e., the typical genome insertion markers are
-	missing. Poking around at possible explanations, I looked at GC
-	content of those parts in the genome ... and there was the
-	explanation:
-      </para>
-      <figure id="sxa_gcbias_comp20082009.png">
-	<titleabbrev>
-	  Example for GC coverage bias, direct comparison 2008 / 2010 data.
-	</titleabbrev>
-	<title>
-	  Example for GC coverage bias, direct comparison 2008 / 2010
-	  data. The bug has 45% average GC, areas with above average read
-	  coverage in 2010 data turn out to be lower GC: around 33 to 36%. The
-	  effect is also noticeable in the 2008 data, but barely so.
-	</title>
-	<mediaobject>
-	  <imageobject>
-	    <imagedata fileref="bookfigures/sxa_gcbias_comp20082009.png" width="90%"/>
-	  </imageobject>
-	</mediaobject>
-      </figure>
-      <para>
-	Now as to actually <emphasis>why</emphasis> the GC bias suddenly
-	became so strong is unknown to me. The people in the lab use the same
-	protocol since several years to extract the DNA and the sequencing
-	providers claim to always use the Illumina standard protocols.
-      </para>
-      <para>
-	But obviously something must have changed. Current ideas about possible reasons include
-      </para>
-      <itemizedlist>
-	<listitem>
-	  changed chemistries from Illumina leading perhaps to bias during DNA amplification
-	</listitem>
-	<listitem>
-	  changed "standard" protocols
-	</listitem>
-	<listitem>
-	  other ...
-	</listitem>
-      </itemizedlist>
-      <para>
-	It took Illumina some 18 months to resolve that problem for the
-	broader public: since data I work on were done with the TruSeq kit,
-	this problem has vanished.
-      </para>
-      <para>
-	However, if you based some conclusions or wrote a paper with Illumina
-	data which might be affected by the GC bias (Q3 2009 to Q4 2010), I
-	suggest you rethink all the conclusion drawn. This should be
-	especially the case for transcriptomics experiments where a difference
-	in expression of 2x to 3x starts to get highly significant!
-      </para>
-    </sect2>
-  </sect1>
-  <sect1 id="sect_sxa_mapping_assemblies">
-    <title>
-      Mapping assemblies
-    </title>
-    <para>
-      This part will introduce you step by step how to get your data together for a
-      simple mapping assembly.
-    </para>
-    <para>
-      I'll make up an example using an imaginary bacterium: <emphasis>Bacillus chocorafoliensis</emphasis> (or short: <emphasis>Bchoc</emphasis>).
-    </para>
-    <para>
-      In this example, we assume you have two strains: a wild type strain of
-      <emphasis>Bchoc_wt</emphasis> and a mutant which you perhaps got from mutagenesis or other
-      means. Let's imagine that this mutant needs more time to eliminate a given
-      amount of chocolate, so we call the mutant <emphasis>Bchoc_se</emphasis> ... SE for
-      <emphasis role="bold">s</emphasis>low <emphasis role="bold">e</emphasis>ater
-    </para>
-    <para>
-      You wanted to know which mutations might be responsible for the observed
-      behaviour. Assume the genome of <emphasis>Bchoc_wt</emphasis> is available to you as it was
-      published (or you previously sequenced it), so you resequenced <emphasis>Bchoc_se</emphasis>
-      with Solexa to examine mutations.
-    </para>
-    <sect2 id="sect_sxa_ma_copying_and_naming_the_sequence_data">
-      <title>
-	Copying and naming the sequence data
-      </title>
-      <para>
-	You need to create (or get from your sequencing provider) the sequencing data
-	in either FASTQ or FASTA + FASTA quality format. The following walkthrough
-	uses what most people nowadays get: FASTQ.
-      </para>
-      <para>
-	Create a new project directory (e.g. <filename>myProject</filename>) and a subdirectory of this which will hold the sequencing data (e.g. <filename>data</filename>).
-      </para>
-      <screen><prompt>arcadia:/path/to</prompt> <userinput>mkdir myProject</userinput>
-<prompt>arcadia:/path/to</prompt> <userinput>cd myProject</userinput>
-<prompt>arcadia:/path/to/myProject$</prompt> <userinput>mkdir data</userinput></screen>
-      <para>
-	Put the FASTQ data into that <filename>data</filename> directory so that it now looks perhaps like this:
-      </para>
-      <screen><prompt>arcadia:/path/to/myProject$</prompt> <userinput>ls -l data</userinput>
--rw-r--r-- 1 bach users 263985896 2008-03-28 21:49 bchocse_lane6.solexa.fastq
--rw-r--r-- 1 bach users 264823645 2008-03-28 21:51 bchocse_lane7.solexa.fastq</screen>
-    </sect2>
-    <sect2 id="sect_sxa_ma_copying_and_naming_the_reference_sequence">
-      <title>
-	Copying and naming the reference sequence
-      </title>
-      <para>
-	The reference sequence (the backbone) can be in a number of different
-	formats: GFF3, GenBank, FASTA, CAF. The first three have the advantage
-	of being able to carry additional information like, e.g.,
-	annotation. In this example, we will use a GenBank file like the ones
-	one can download from the NCBI. So, let's assume that our wild type
-	strain is in the following file:
-	<filename>NC_someNCBInumber.gbk</filename>.
-      </para>
-      <para>
-	You do not need to copy the reference sequence to your directory, but
-	I normally copy also the reference file into the directory with my
-	data as I want to have, at the end of my work, a nice little
-	self-sufficient directory which I can archive away and still be sure
-	that in 10 years time I have all data I need together.
-      </para>
-      <screen><prompt>arcadia:/path/to/myProject$</prompt> <userinput>cp /somewhere/NC_someNCBInumber.gbk data</userinput>
-<prompt>arcadia:/path/to/myProject$</prompt> <userinput>ls -l data</userinput>
--rw-r--r-- 1 bach users   6543511 2008-04-08 23:53 NC_someNCBInumber.gbk
--rw-r--r-- 1 bach users 263985896 2008-03-28 21:49 bchocse_lane6.solexa.fastq
--rw-r--r-- 1 bach users 264823645 2008-03-28 21:51 bchocse_lane7.solexa.fastq</screen>
-    <para>
-      We're almost finished with the setup. As I like to have things neatly separated, I always create a directory called <filename>assemblies</filename> which will hold my assemblies (or different trials) together. Let's quickly do that:
-    </para>
-    <screen><prompt>arcadia:/path/to/myProject$</prompt> <userinput>mkdir assemblies</userinput>
-<prompt>arcadia:/path/to/myProject$</prompt> <userinput>mkdir assemblies/1sttrial</userinput>
-<prompt>arcadia:/path/to/myProject$</prompt> <userinput>cd assemblies/1sttrial</userinput></screen>
-    </sect2>
-    <sect2 id="sect_sxa_ma_writing_a_simple_manifest_file">
-      <title>
-	Writing a simple manifest file
-      </title>
-      <para>
-	A manifest file is a configuration file for MIRA which tells it what type of assembly it should do and which data it should load. In this case we have unpaired sequencing data which we want to map to a reference sequence, the manifest file for that is pretty simple:
-      </para>
-      <screen># Example for a manifest describing a mapping assembly with
-# unpaired Illumina data
-
-# First part: defining some basic things
-# In this example, we just give a name to the assembly
-#  and tell MIRA it should map a genome in accurate mode
-# As special parameter, we want to use 4 threads in parallel (where possible)
-
-<userinput>project = <replaceable>MyFirstAssembly</replaceable>
-job = <replaceable>genome,mapping,accurate</replaceable>
-parameters = <replaceable>-GE:not=4</replaceable></userinput>
-
-# The second part defines the sequencing data MIRA should load and assemble
-# The data is logically divided into "readgroups"
-
-# first, the reference sequence
-<userinput>readgroup
-is_reference
-data = <replaceable>../../data/NC_someNCBInumber.gbk</replaceable>
-technology = <replaceable>text</replaceable>
-strain = <replaceable>bchoc_wt</replaceable></userinput>
-
-# now the Illumina data
-
-<userinput>readgroup = <replaceable>SomeUnpairedIlluminaReadsIGotFromTheLab</replaceable>
-data = <replaceable>../../data/*fastq</replaceable>
-technology = <replaceable>solexa</replaceable>
-strain = <replaceable>bchoc_se</replaceable></userinput></screen>
-      <note>
-	<para>
-	  Please look up the parameters of the manifest file in the main manual. The ones
-	  above basically say: make an accurate mapping of Solexa reads
-	  against a genome; in one pass; the name of the backbone strain is
-	  'bchoc_wt'; the
-	  base qualities for the backbone are to be assumed Q30; for Solexa
-	  data: assign default strain names for reads which have not loaded
-	  ancillary data with strain info and that default strain name should
-	  be 'bchoc_se'.
-	</para>
-      </note>
-    </sect2>
-    <sect2 id="sect_sxa_ma_starting_assembly">
-      <title>Starting the assembly</title>
-      <para>
-	Starting the assembly is now just a matter of a simple command line:
-      </para>
-      <screen><prompt>arcadia:/path/to/myProject/assemblies/1sttrial$</prompt> <userinput>mira <replaceable>manifest.conf >&log_assembly.txt</replaceable></userinput></screen>
-      <note>
-	<para>
-	  For a bacterial project having a backbone of ~4 megabases and with
-	  ~4.5 million Solexa 36mers, MIRA needs some ~21 minutes on my
-	  development machine.
-	</para>
-	<para>
-	  A yeast project with a genome of ~20 megabases and ~20 million 36mers
-	  needs 3.5 hours and 28 GiB RAM.
-	</para>
-      </note>
-      <para>
-	For this example - if you followed the walk-through on how to prepare the data
-	- everything you might want to adapt in the first time are the following thing in the manifest file:
-	options:
-      </para>
-      <itemizedlist>
-	<listitem>
-	  <para>
-	    project= (for naming your assembly project)
-	  </para>
-	</listitem>
-	<listitem>
-	  <para>
-	    strain_name= to give the names of your reference and mapping strain
-	  </para>
-	</listitem>
-	<listitem>
-	  <para>
-	    -GE:not= to tell MIRA how many processors it should use
-	  </para>
-	</listitem>
-      </itemizedlist>
-      <para>
-	Of course, you are free to change any option via the extended parameters, but
-	this will be the topic of another FAQ.
-      </para>
-    </sect2>
-    <sect2 id="sect_sxa_ma_mapping_with_multiple_strains">
-      <title>
-	Mapping with multiple strains
-      </title>
-      <para>
-	MIRA will make use of ancillary information present in the manifest
-	file. One of these is the information to which strain (or organism or
-	cell line etc.pp) the generated data belongs.
-      </para>
-      <para>
-	You just need to tell in the manifest file which data comes from which
-	strain. Let's assume that in the example from above, the "lane6" data
-	were from a first mutant named <emphasis>bchoc_se1</emphasis> and the
-	"lane7" data were from a second mutant
-	named <emphasis>bchoc_se2</emphasis>. Here's the manifest file you
-	would write then:
-      </para>
-      <screen># Example for a manifest describing a mapping assembly with
-# unpaired Illumina data
-
-# First part: defining some basic things
-# In this example, we just give a name to the assembly
-#  and tell MIRA it should map a genome in accurate mode
-# As special parameter, we want to use 4 threads in parallel (where possible)
-
-<userinput>project = <replaceable>MyFirstAssembly</replaceable>
-job = <replaceable>genome,mapping,accurate</replaceable>
-parameters = <replaceable>-GE:not=4</replaceable></userinput>
-
-# The second part defines the sequencing data MIRA should load and assemble
-# The data is logically divided into "readgroups"
-
-# first, the reference sequence
-<userinput>readgroup
-is_reference
-data = <replaceable>../../data/NC_someNCBInumber.gbk</replaceable>
-technology = <replaceable>text</replaceable>
-strain = <replaceable>bchoc_wt</replaceable></userinput>
-
-# now the Illumina data
-
-<userinput>readgroup = <replaceable>DataForSE1</replaceable>
-data = <replaceable>../../data/bchocse_lane6.solexa.fastq</replaceable>
-technology = <replaceable>solexa</replaceable>
-strain = <replaceable>bchoc_se1</replaceable></userinput>
-
-<userinput>readgroup = <replaceable>DataForSE2</replaceable>
-data = <replaceable>../../data/bchocse_lane7.solexa.fastq</replaceable>
-technology = <replaceable>solexa</replaceable>
-strain = <replaceable>bchoc_se2</replaceable></userinput></screen>
-      <note>
-	While mapping (or even assembling de-novo) with multiple strains is
-	possible, the interpretation of results may become a bit daunting in
-	some cases. For many scenarios it might therefore be preferable to
-	successively use the data sets in own mappings or assemblies.
-      </note>
-    </sect2>
-    <para>
-      This is really the only change you need to do for this example.
-    </para>
-    <sect2 id="sect_sxa_ma_manifest_for_pairedend_data">
-      <title>
-	Manifest for paired-end data sets
-      </title>
-      <para>
-	When using paired-end data in mapping, you must decide whether you want
-      </para>
-      <orderedlist>
-	<listitem>
-	  <para>
-	    use the MIRA feature to create long 'coverage equivalent reads'
-	    (CERs) which saves a lot of memory (both in the assembler and
-	    later on in an assembly editor). However, you then
-	    <emphasis>loose</emphasis> <emphasis>paired-end</emphasis>
-	    <emphasis>information!</emphasis>
-	  </para>
-	</listitem>
-	<listitem>
-	  <para>
-	    or whether you want to <emphasis>keep</emphasis> <emphasis>paired-end</emphasis>
-	    <emphasis>information!</emphasis> at the expense of larger memory requirements both in MIRA
-	    and in assembly editors afterwards.
-	  </para>
-	</listitem>
-	<listitem>
-	  <para>
-	    or a mix of the two above
-	  </para>
-	</listitem>
-      </orderedlist>
-      <para>
-	The Illumina pipeline generally gives you two files for paired-end
-	data: a <filename>project-1.fastq</filename> and
-	<filename>project-2.fastq</filename>. The first file containing the
-	first read of a read-pair, the second file the second read. Depending
-	on the preprocessing pipeline of your sequencing provider, the names
-	of the reads are either the very same in both files or already have
-	a <literal>/1</literal> or <literal>/2</literal> appended.
-      </para>
-      <note>
-	<para>
-	  MIRA can read all FASTQ variants produced by various Illumina
-	  pipelines, be they with or without the /1 and /2 already appended to
-	  the names. You generally do not need to do any name mangling before
-	  feeding the data to MIRA.
-	</para>
-      </note>
-      <para>
-	The following manifest file is an example for mapping a 500 bp
-	paired-end and a 3kb mate-pair library of a strain
-	called <emphasis>bchoc_se1</emphasis> against a GenBank reference
-	file containing a strain called <emphasis>bchoc_wt</emphasis>:
-      </para>
-      <screen># Example for a manifest describing a mapping assembly with
-# paired Illumina data, not merging reads and therefore keeping
-# all pair information
-
-# First part: defining some basic things
-# In this example, we just give a name to the assembly
-#  and tell MIRA it should map a genome in accurate mode
-# As special parameter, we want to use 4 threads in parallel (where possible)
-#  and switch off merging of Solexa reads
-
-<userinput>project = <replaceable>MyFirstAssembly</replaceable>
-job = <replaceable>genome,mapping,accurate</replaceable>
-parameters = <replaceable>-GE:not=4 SOLEXA_SETTINGS -CO:msr=no</replaceable></userinput>
-
-# The second part defines the sequencing data MIRA should load and assemble
-# The data is logically divided into "readgroups"
-
-# first, the reference sequence
-<userinput>readgroup
-is_reference
-data = <replaceable>../../data/NC_someNCBInumber.gbk</replaceable>
-technology = <replaceable>text</replaceable>
-strain = <replaceable>bchoc_wt</replaceable></userinput>
-
-# now the Illumina data
-
-<userinput>readgroup = <replaceable>DataForPairedEnd500bpLib</replaceable>
-data = <replaceable>../../data/project500bp-1.fastq ../../data/project500bp-2.fastq</replaceable>
-technology = <replaceable>solexa</replaceable>
-strain = <replaceable>bchoc_se1</replaceable>
-template_size = <replaceable>250 750 infoonly</replaceable>
-segment_placement = <replaceable>---> <--- infoonly</replaceable></userinput>
-
-<userinput>readgroup = <replaceable>DataForMatePair3kbLib</replaceable>
-data = <replaceable>../../data/project3kb-1.fastq ../../data/project3kb-2.fastq</replaceable>
-technology = <replaceable>solexa</replaceable>
-strain = <replaceable>bchoc_se1</replaceable>
-template_size = <replaceable>2500 3500 infoonly</replaceable>
-segment_placement = <replaceable><--- ---> infoonly</replaceable></userinput></screen>
-      <para>
-	Please look up the parameters used in the main manual. The ones
-	above basically say: make an accurate mapping of Solexa reads
-	against a genome. Additionally do not merge short short Solexa
-	reads to the contig.
-      </para>
-      <para>
-	For the paired-end library, assume a DNA template template size of
-	250 to 750 bp and the segment orientation of the read pairs follows
-	the forward / reverse scheme. That information should be treated as
-	"information only" by MIRA, i.e., it is not used for deciding whether
-	a pair is well mapped.
-      </para>
-      <para>
-	For the mate-pair library, assume a DNA template template size of
-	2500 to 3500 bp and the segment orientation of the read pairs follows
-	the reverse / forward scheme. That information should be treated as
-	"information only" by MIRA, i.e., it is not used for deciding whether
-	a pair is well mapped.
-      </para>
-      <para>
-	Comparing this command line with a command line for unpaired-data, two
-	parameters were added in the section for Solexa data:
-      </para>
-      <orderedlist>
-	<listitem>
-	  <para>
-	    <literal>-CO:msr=no</literal> tells MIRA not to merge reads that
-	    are 100% identical to the backbone. This also allows to keep the
-	    template information for the reads.
-	  </para>
-	</listitem>
-	<listitem>
-	  <para>
-	    <literal>infoonly</literal> attribute actually switches
-	    <emphasis>off</emphasis> checking of template sizes and segment
-	    placement when inserting reads into the backbone. At first glance
-	    this might seem counter-intuitive, but it's absolutely necessary
-	    to spot, e.g., genome re-arrangements or indels in data analysis
-	    after the assembly.
-	  </para>
-	  <para>
-	    The reason is that if template size and segment placement checking
-	    were on, the following would happen at, e.g. sites of
-	    re-arrangement: MIRA would map the first read of a read-pair
-	    without problem. However, it would very probably reject the second
-	    read because it would not map at the specified distance or
-	    orientation from its partner. Therefore, in mapping assemblies
-	    with paired-end data, checking of the template size must be
-	    switched off to give post-processing programs a chance to spot
-	    re-arrangements.
-	  </para>
-	</listitem>
-      </orderedlist>
-      <para>
-      </para>
-      <para>
-	<emphasis role="bold">Note:</emphasis> for other influencing factors
-	you might want to change depending on size of Solexa reads, see
-	section above on mapping of unpaired data.
-      </para>
-    </sect2>
-    <sect2 id="sect_sxa_places_of_interest_in_a_mapping_assembly">
-      <title>
-	Places of interest in a mapping assembly
-      </title>
-      <para>
-	This section just give a short overview on the tags you might find
-	interesting. For more information, especially on how to configure gap4
-	or consed, please consult the <emphasis>mira usage</emphasis> document
-	and the <emphasis>mira</emphasis> manual.
-      </para>
-      <para>
-	In file types that allow tags (CAF, MAF, ACE), SNPs and other
-	interesting features will be marked by MIRA with a number of tags. The
-	following sections give a brief overview. For a description of what
-	the tags are (SROc, WRMc etc.), please read up the section "Tags used
-	in the assembly by MIRA and EdIt" in the main manual.
-      </para>
-      <note>
-	Screen shots in this section are taken from the walk-through with
-	Lenski data (see below).
-      </note>
-      <sect3 id="sect_sxa_where_are_snps?">
-	<title>
-	  Where are SNPs?
-	</title>
-	<itemizedlist>
-	  <listitem>
-	    <para>
-	      the <emphasis role="bold">SROc</emphasis> tag will point to most
-	      SNPs. Should you assemble sequences of more than one strain (I
-	      cannot really recommend such a strategy), you also might
-	      encounter <emphasis role="bold">SIOc</emphasis> and <emphasis
-	      role="bold">SAOc</emphasis> tags.
-	    </para>
-	    <figure id="chap_sol::sxa_sroc_lenski1.png">
-	      <title>
-		"SROc" tag showing a SNP position in a Solexa mapping
-		assembly.
-	      </title>
-	      <mediaobject>
-		<imageobject>
-		  <imagedata fileref="bookfigures/sxa_sroc_lenski1.png" width="90%"/>
-		</imageobject>
-	      </mediaobject>
-	    </figure>
-	    <figure id="chap_sol::sxa_sroc_lenski2.png">
-	      <title>
-		"SROc" tag showing a SNP/indel position in a Solexa mapping
-		assembly.
-	      </title>
-	      <mediaobject>
-		<imageobject>
-		  <imagedata fileref="bookfigures/sxa_sroc_lenski2.png" width="90%"/>
-		</imageobject>
-	      </mediaobject>
-	    </figure>
-	  </listitem>
-	  <listitem>
-	    <para>
-	      the <emphasis role="bold">WRMc</emphasis> tags might sometimes
-	      point SNPs to indels of one or two bases.
-	    </para>
-	  </listitem>
-	</itemizedlist>
-	<para>
-	</para>
-      </sect3>
-      <sect3 id="sect_sxa_where_are_insertions_deletions_or_genome_rearrangements?">
-	<title>
-	  Where are insertions, deletions or genome re-arrangements?
-	</title>
-	<itemizedlist>
-	  <listitem>
-	    <para>
-	      Large deletions: the <emphasis role="bold">MCVc</emphasis> tags
-	      point to deletions in the resequenced data, where no read is
-	      covering the reference genome.
-	    </para>
-	    <figure id="chap_sol::sxa_mcvc_lenski.png">
-	      <title>
-		"MCVc" tag (dark red stretch in figure) showing a genome
-		deletion in Solexa mapping assembly.
-	      </title>
-	      <mediaobject>
-		<imageobject>
-		  <imagedata fileref="bookfigures/sxa_mcvc_lenski.png" width="90%"/>
-		</imageobject>
-	      </mediaobject>
-	    </figure>
-	  </listitem>
-	  <listitem>
-	    <para>
-	      Insertions, small deletions and re-arrangements: these are
-	      harder to spot. In unpaired data sets they can be found looking
-	      at clusters of <emphasis role="bold">SROc</emphasis>, <emphasis
-	      role="bold">SRMc</emphasis>, <emphasis
-	      role="bold">WRMc</emphasis>, and / or <emphasis
-	      role="bold">UNSc</emphasis> tags.
-	    </para>
-	    <figure id="chap_sol::sxa_wrmcsrmc_hiding_lenski1.png">
-	      <title>
-		An IS150 insertion hiding behind a WRMc and a SRMc tags
-	      </title>
-	      <mediaobject>
-		<imageobject>
-		  <imagedata fileref="bookfigures/sxa_wrmcsrmc_hiding_lenski1.png" width="90%"/>
-		</imageobject>
-	      </mediaobject>
-	    </figure>
-	    <para>
-	      more massive occurrences of these tags lead to a rather colourful
-	      display in finishing programs, which is why these clusters are
-	      also sometimes called Xmas-trees.
-	    </para>
-	    <figure id="chap_sol::sxa_xmastree_lenski1.png">
-	      <title>
-		A 16 base pair deletion leading to a SROc/UNsC xmas-tree
-	      </title>
-	      <mediaobject>
-		<imageobject>
-		  <imagedata fileref="bookfigures/sxa_xmastree_lenski1.png" width="90%"/>
-		</imageobject>
-	      </mediaobject>
-	    </figure>
-	    <figure id="chap_sol::sxa_xmastree_lenski2.png">
-	      <title>
-		An IS186 insertion leading to a SROc/UNsC xmas-tree
-	      </title>
-	      <mediaobject>
-		<imageobject>
-		  <imagedata fileref="bookfigures/sxa_xmastree_lenski2.png" width="90%"/>
-		</imageobject>
-	      </mediaobject>
-	    </figure>
-	    <para>
-	      In sets with paired-end data, post-processing software (or
-	      alignment viewers) can use the read-pair information to guide
-	      you to these sites (MIRA doesn't set tags at the moment).
-	    </para>
-	  </listitem>
-	</itemizedlist>
-	<para>
-	</para>
-      </sect3>
-      <sect3 id="sect_sxa_other_tags_of_interest">
-	<title>
-	  Other tags of interest
-	</title>
-	<itemizedlist>
-	  <listitem>
-	    <para>
-	      the <emphasis role="bold">UNSc</emphasis> tag points to areas
-	      where the consensus algorithm had troubles choosing a base. This
-	      happens in low coverage areas, at places of insertions (compared
-	      to the reference genome) or sometimes also in places where
-	      repeats with a few bases difference are present. Often enough,
-	      these tags are in areas with problematic sequences for the
-	      Solexa sequencing technology like, e.g., a
-	      <literal>GGCxG</literal> or even <literal>GGC</literal> motif in
-	      the reads.
-	    </para>
-	  </listitem>
-	  <listitem>
-	    <para>
-	      the <emphasis role="bold">SRMc</emphasis> tag points to places
-	      where repeats with a few bases difference are present. Here too,
-	      sequence problematic for the Solexa technology are likely to
-	      have cause base calling errors and subsequently setting of this
-	      tag.
-	    </para>
-	  </listitem>
-	</itemizedlist>
-	<para>
-	</para>
-      </sect3>
-      <sect3 id="sect_sxa_comprehensive_spreadsheet_tables_for_excel_or_oocalc">
-	<title>
-	  Comprehensive spreadsheet tables (for Excel or OOcalc)
-	</title>
-	<para>
-	  Biologists are not really interested in SNPs coordinates, and why
-	  should they? They're more interested where SNPs are, how good they
-	  are, which genes or other elements they hit, whether they have an
-	  effect on a protein sequence, whether they may be important etc. For
-	  organisms without intron/exon structure or splice variants, MIRA can
-	  generate pretty comprehensive tables and files if an annotated
-	  GenBank file was used as reference and strain information was given
-	  to MIRA during the assembly.
-	</para>
-	<para>
-	  Well, MIRA does all that automatically for you if the reference
-	  sequence you gave was annotated.
-	</para>
-	<para>
-	  For this, <command>miraconvert</command> should be used with the
-	  <emphasis>asnp</emphasis> format as target and a CAF file as input:
-	</para>
-	<screen>
-<prompt>$</prompt> <userinput>miraconvert -t asnp <replaceable>input.caf output</replaceable></userinput></screen>
-	<para>
-	  Note that it is strongly suggested to perform a quick manual cleanup
-	  of the assembly prior to this: for rare cases (mainly at site of
-	  small indels of one or two bases), mira will not tag SNPs with a SNP
-	  tag (SROc, SAOc or SIOc) but will be fooled into a tag denoting
-	  unsure positions (UNSc). This can be quickly corrected manually. See
-	  further down in this manual in the section on post-processing.
-	</para>
-	<para>
-	  After conversion, you will have four files in the directory which
-	  you can all drag-and-drop into spreadsheet applications like
-	  OpenOffice Calc or Excel.
-	</para>
-	<para>
-	  The files should be pretty self-explanatory, here's just a short overview:
-	</para>
-	<orderedlist>
-	  <listitem>
-	    <para>
-	      <filename>output_info_snplist.txt</filename> is a simple list of
-	      the SNPs, with their positions compared to the reference
-	      sequence (in bases and map degrees on the genome) as well as the
-	      GenBank features they hit.
-	    </para>
-	  </listitem>
-	  <listitem>
-	    <para>
-	      <filename>output_info_featureanalysis.txt</filename> is a much
-	      extended version of the list above. It puts the SNPs into
-	      context of the features (proteins, genes, RNAs etc.) and gives a
-	      nice list, SNP by SNP, what might cause bigger changes in
-	      proteins.
-	    </para>
-	  </listitem>
-	  <listitem>
-	    <para>
-	      <filename>output_info_featuresummary.txt</filename> looks at the
-	      changes (SNPs, indels) from the other way round. It gives an
-	      excellent overview which features (genes, proteins, RNAs,
-	      intergenic regions) you should investigate.
-	    </para>
-	    <para>
-	      There's one column (named 'interesting') which pretty much
-	      summarises up everything you need into three categories: yes,
-	      no, and perhaps. 'Yes' is set if indels were detected, an amino
-	      acid changed, start or stop codon changed or for SNPs in
-	      intergenic regions and RNAs. 'Perhaps' is set for SNPs in
-	      proteins that change a codon, but not an amino acid (silent
-	      SNPs). 'No' is set if no SNP is hitting a feature.
-	    </para>
-	  </listitem>
-	  <listitem>
-	    <para>
-	      <filename>output_info_featuresequences.txt</filename> simply
-	      gives the sequences of each feature of the reference sequence
-	      and the resequenced strain.
-	    </para>
-	  </listitem>
-	</orderedlist>
-	<para>
-	</para>
-      </sect3>
-      <sect3 id="sect_sxa_html_files_depicting_snp_positions_and_deletions">
-	<title>
-	  HTML files depicting SNP positions and deletions
-	</title>
-	<para>
-	  I've come to realise that people who don't handle data from NextGen
-	  sequencing technologies on a regular basis (e.g., many biologists)
-	  don't want to be bothered with learning to handle specialised
-	  programs to have a look at their resequenced strains. Be it because
-	  they don't have time to learn how to use a new program or because
-	  their desktop is not strong enough (CPU, memory) to handle the data
-	  sets.
-	</para>
-	<para>
-	  Something even biologist know to operate are browsers. Therefore,
-	  miraconvert has the option to load a CAF file of a mapping
-	  assembly at output to HTML those areas which are interesting to
-	  biologists. It uses the tags SROc, SAOc, SIOc and MCVc and outputs
-	  the surrounding alignment of these areas together with a nice
-	  overview and links to jump from one position to the previous or
-	  next.
-	</para>
-	<para>
-	  This is done with the '-t hsnp' option of miraconvert:
-	</para>
-	<screen>
-<prompt>$</prompt> <userinput>miraconvert -t hsnp <replaceable>input.caf output</replaceable></userinput></screen>
-	<para>
-	  <emphasis role="bold">Note:</emphasis> I recommend doing this only
-	  if the resequenced strain is a very close relative to the reference
-	  genome, else the HTML gets pretty big. But for a couple of hundred
-	  SNPs it works great.
-	</para>
-      </sect3>
-      <sect3 id="sect_sxa_wig_files_depicting_contig_coverage">
-	<title>
-	  WIG files depicting contig coverage
-	</title>
-	<para>
-	  <command>miraconvert</command> can also dump a coverage file in
-	  WIG format (using '-t wig'). This comes pretty handy for searching
-	  genome deletions or duplications in programs like the Affymetrix
-	  Integrated Genome Browser (IGB, see <ulink
-	  url="http://igb.bioviz.org/"/>).
-	</para>
-      </sect3>
-      <sect3 id="sect_sxa_tables_for_feature_coverage">
-	<title>
-	  Tables for gene expression values / genome deletions & duplications
-	</title>
-	<para>
-	  When having data mapped against a reference with annotations (either from GenBank formats or GFF3 formats), <command>miraconvert</command> can generate tables depicting either expression values (in RNASeq/EST data mappings) or probable genome multiplication and deletion factors (in genome mappings). For this to work, you must use a MAF or CAF file as input, specify <emphasis>fcov</emphasis> as output format and the reference sequence must have had annotations during the mapping with MIRA.
-	</para>
-	<para>TODO: add example</para>
-	<screen>
-<userinput>miraconvert -t fcov <replaceable>mira_out.maf myfeaturetable</replaceable></userinput></screen>
-      </sect3>
-    </sect2>
-    <sect2 id="sect_sxa_walkthrough:_mapping_of_ecoli_from_lenski_lab_against_ecoli_b_rel606">
-      <title>
-	Walkthrough: mapping of E.coli from Lenski lab against E.coli B REL606
-      </title>
-      <para>
-	Sorry, needs to be re-written for the relatively new SRR format
-	distributed at the NCBI ... and changes in MIRA 3.9.x. Please come
-	back later.
-      </para>
-    </sect2>
-  </sect1>
-  <sect1 id="sect_sxa_denovo_solexa_only_assemblies">
-    <title>
-      De-novo Solexa only assemblies
-    </title>
-    <para>
-      This is actually quite straightforward and not much different from
-      mapping assemblies: you need to tell MIRA were the data files are,
-      whether or not there are special conditions which apply (paired-end info
-      etc.) and that it is a de-novo assembly that you want and off you go.
-    </para>
-      <screen># Example for a manifest describing a de-novo assembly with
-# paired Illumina data
-
-# First part: defining some basic things
-# In this example, we just give a name to the assembly
-#  and tell MIRA it should assemble a genome in accurate mode
-# As special parameter, we want to use 4 threads in parallel (where possible)
-
-<userinput>project = <replaceable>MyFirstAssembly</replaceable>
-job = <replaceable>genome,denovo,accurate</replaceable>
-parameters = <replaceable>-GE:not=4</replaceable></userinput>
-
-# The second part defines the sequencing data MIRA should load and assemble
-# The data is logically divided into "readgroups". This example uses a
-#  paired-end library with 500bp and a mate-pair library with 3.5kb
-
-<userinput>readgroup = <replaceable>MyPairedEnd500bpLib</replaceable>
-data = <replaceable>../../data/project500bp-1.fastq ../../data/project500bp-2.fastq</replaceable>
-technology = <replaceable>solexa</replaceable>
-strain = <replaceable>bchoc_se1</replaceable>
-template_size = <replaceable>250 750</replaceable>
-segment_placement = <replaceable>---> <---</replaceable></userinput>
-
-<userinput>readgroup = <replaceable>MyMatePair3kbLib</replaceable>
-data = <replaceable>../../data/project3kb-1.fastq ../../data/project3kb-2.fastq</replaceable>
-technology = <replaceable>solexa</replaceable>
-strain = <replaceable>bchoc_se1</replaceable>
-template_size = <replaceable>2500 3500</replaceable>
-segment_placement = <replaceable><--- ---></replaceable></userinput></screen>
-    <para>
-      Then you start the assembly:
-    </para>
-    <screen>
-<prompt>arcadia:/path/to/myProject$</prompt> <userinput>mira <replaceable>manifest.conf >&log_assembly.txt</replaceable></userinput></screen>
-    <para>
-      Of course, you can add any other switch you want like, e.g., changing
-      the number of processors used, adding default strain names etc.pp
-    </para>
-  </sect1>
-  <sect1 id="sect_sxa_denovo_hybrid_assemblies_solexa_+_">
-    <title>
-      De-novo hybrid assemblies (Solexa + ...)
-    </title>
-    <para>
-    </para>
-    <para>
-      Two strategies can be thought of to assemble genomes using a combination
-      of Solexa and other (longer) reads: either using all reads for a full
-      de-novo assembly or first assembling the longer reads and use the
-      resulting assembly as backbone to map Solexa reads. Both strategies have
-      their pro and cons.
-    </para>
-    <sect2 id="sect_sxa_all_reads_denovo">
-      <title>
-	All reads de-novo
-      </title>
-      <para>
-	Throwing all reads into a de-novo assembly is the most straightforward
-	way to get 'good' assemblies. This strategy is also the one which - in
-	most cases - yields the longest contigs as, in many projects, parts of
-	a genome not covered by one sequencing technology will probably be
-	covered by another sequencing technology. Furthermore, having the
-	consensus covered by more than one sequencing technology make base
-	calling a pretty robust thing: if MIRA finds disagreements it cannot
-	resolve easily, the assembler at least leaves a tag in the assembly to
-	point human finishers to these positions of interest.
-      </para>
-      <para>
-	The downside of this approach however is the fact that the sheer
-	amount of data in Solexa sequencing projects makes life difficult for
-	de-novo assemblers, especially for MIRA which is keeping quite some
-	additional information in memory in de-novo assemblies and tries to
-	use algorithms as exact as possible during contig
-	construction. Therefore, MIRA sometimes still runs into data sets
-	which make it behave quite badly with respect to assembly time and
-	memory consumption (but this is being constantly improved).
-      </para>
-      <para>
-	Full de-novo hybrid assemblies can be recommended only for bacteria at
-	the moment, although lower eukaryotes should also be feasible on
-	larger machines.
-      </para>
-      <para>
-	This is actually quite straightforward and not much different from
-	mapping assemblies: you need to tell MIRA were the data files are,
-	whether or not there are special conditions which apply (paired-end
-	info etc.) and that it is a de-novo assembly that you want and off you
-	go.
-      </para>
-      <screen># Example for a manifest describing a de-novo assembly with
-# shotgun 454 data and paired Illumina data
-
-# First part: defining some basic things
-# In this example, we just give a name to the assembly
-#  and tell MIRA it should assemble a genome in accurate mode
-# As special parameter, we want to use 4 threads in parallel (where possible)
-
-<userinput>project = <replaceable>MyFirstAssembly</replaceable>
-job = <replaceable>genome,denovo,accurate</replaceable>
-parameters = <replaceable>-GE:not=4</replaceable></userinput>
-
-# The second part defines the sequencing data MIRA should load and assemble
-# The data is logically divided into "readgroups". This example uses a
-#  454 shotgun library; a Solexa paired-end library with 500bp and a Solexa
-#  mate-pair library with 3.5kb
-
-# First the 454 data. Note that, in this example, no XML data is loaded for
-#  454 (showing that this is less critical for shotgun 454 data)
-
-<userinput>readgroup = <replaceable>MyShotgun454Lib</replaceable>
-data = <replaceable>../../data/project_454data.fastq</replaceable>
-technology = <replaceable>454</replaceable>
-strain = <replaceable>bchoc_se1</replaceable></userinput>
-
-# Now Illumina data
-
-<userinput>readgroup = <replaceable>MyPairedEnd500bpLib</replaceable>
-data = <replaceable>../../data/project500bp-1.fastq ../../data/project500bp-2.fastq</replaceable>
-technology = <replaceable>solexa</replaceable>
-strain = <replaceable>bchoc_se1</replaceable>
-template_size = <replaceable>250 750</replaceable>
-segment_placement = <replaceable>---> <---</replaceable></userinput>
-
-<userinput>readgroup = <replaceable>MyMatePair3kbLib</replaceable>
-data = <replaceable>../../data/project3kb-1.fastq ../../data/project3kb-2.fastq</replaceable>
-technology = <replaceable>solexa</replaceable>
-strain = <replaceable>bchoc_se1</replaceable>
-template_size = <replaceable>2500 3500</replaceable>
-segment_placement = <replaceable><--- ---></replaceable></userinput></screen>
-    <para>
-      Then you start the assembly:
-    </para>
-    <screen>
-<prompt>arcadia:/path/to/myProject$</prompt> <userinput>mira <replaceable>manifest.conf >&log_assembly.txt</replaceable></userinput></screen>
-    </sect2>
-    <sect2 id="sect_sxa_long_reads_first_then_solexa">
-      <title>
-	Long reads first, then Solexa
-      </title>
-      <para>
-	This strategy works in two steps: first assembling long reads, then
-	mapping short reads to the full alignment (not just a consensus
-	sequence). The result will be an assembly containing 454 (or Sanger)
-	and Solexa reads.
-      </para>
-      <orderedlist>
-	<listitem>
-	  Step 1: assemble the 'long' reads (454 or Sanger or both) just as
-	  you would when assembling 454 or Sanger data.
-	</listitem>
-	<listitem>
-	  <para>
-	    Step 2: filter the results. Fetch 'long' contigs from the assembly
-	    before which are larger than 500 bases and have a given minimum
-	    coverage. The Idea is to get more or less all contigs which
-	    represent valid genome sequence of your project.
-	  </para>
-	  <screen>
-<prompt>$</prompt> <userinput>miraconvert -x 500 mira_out.maf hybrid_backbone.maf</userinput></screen>
-	  <para>
-	    You might eventually want to add an additional filter for minimum
-	    average coverage. If your project has an average coverage of 24,
-	    you should filter for a minimum average coverage of 33% (coverage
-	    8, you might want to try out higher coverages) like this:
-	  </para>
-	  <screen>
-<prompt>$</prompt> <userinput>miraconvert -x 500 -y 8 mira_out.maf hybrid_backbone.maf</userinput></screen>
-	</listitem>
-	<listitem>
-	  <para>
-	    Step 3: map the Solexa data. Copy the hybrid backbone to a new
-	    empty directory, add in the Solexa data, start a mapping assembly
-	    using the MAF as input for the backbone / reference. If you
-	    assembled the 454 / Sanger data with strain info, the Solexa data
-	    should also get those (as described above).
-	  </para>
-	  <para>
-	    The readgroup section of your manifest file would then look like this: (need to write)
-	  </para>
-	</listitem>
-      </orderedlist>
-   </sect2>
-  </sect1>
-  <sect1 id="sect_sxa_postprocessing_of_assemblies">
-    <title>
-      Post-processing of assemblies
-    </title>
-    <para>
-      This section is a bit terse, you should also read the chapter on
-      <emphasis>working with results</emphasis> of MIRA3.
-    </para>
-    <sect2 id="sect_sxa_postprocessing_mapping_assemblies">
-      <title>
-	Post-processing mapping assemblies
-      </title>
-      <para>
-	When working with resequencing data and a mapping assembly, I always
-	load finished projects into an assembly editor and perform a quick
-	cleanup of the results.
-      </para>
-      <para>
-	For close relatives of the reference strain this doesn't take long as
-	MIRA will have set tags (see section earlier in this document) at all
-	sites you should have a look at. For example, very close mutant
-	bacteria with just SNPs or simple deletions and no genome
-	reorganisation, I usually clean up in 10 to 15 minutes. That gives the
-	last boost to data quality and your users (biologists etc.) will thank
-	you for that as it reduces their work in analysing the data (be it
-	looking at data or performing wet-lab experiments).
-      </para>
-      <para>
-	Assume you have the following result files in the result directory of
-	a MIRA assembly:
-      </para>
-      <screen>
-<prompt>arcadia:/path/to/myProject/newstrain_d_results$</prompt> <userinput>ls -l</userinput>
--rw-r--r-- 1 bach bach 655176303 2009-06-08 14:56 newstrain_out.caf
-...</screen>
-      <para>
-	The general workflow I use is to convert the CAF file to a gap4 database
-	and start the gap4 editor:
-      </para>
-      <screen>
-<prompt>arcadia:newstrain_d_results$</prompt> <userinput>caf2gap -project NEWSTRAIN -ace newstrain_out.caf >& /dev/null</userinput>
-<prompt>arcadia:newstrain_d_results$</prompt> <userinput>gap4 NEWSTRAIN.0</userinput></screen>
-      <para>
-	Then, in gap4 or gap5, I
-      </para>
-      <orderedlist>
-	<listitem>
-	  <para>
-	    quickly search for the UNSc and WRMc tags and check whether they
-	    could be real SNPs that were overseen by MIRA. In that case, I
-	    manually set a SROc (or SIOc) tag in gap4 via hot-keys that were
-	    defined to set these tags.
-	  </para>
-	</listitem>
-	<listitem>
-	  <para>
-	    sometimes also quickly clean up reads that are causing trouble in
-	    alignments and lead to wrong base calling. These can be found at
-	    sites with UNSc tags, most of the time they have the 5' to 3'
-	    <literal>GGCxG</literal> motif which can cause trouble to Solexa.
-	  </para>
-	</listitem>
-	<listitem>
-	  <para>
-	    look at sites with deletions (tagged with MCVc) and look whether I
-	    should clean up the borders of the deletion.
-	  </para>
-	</listitem>
-      </orderedlist>
-      <para>
-	After this, I convert the gap4 database back to CAF format:
-      </para>
-      <screen>
-<prompt>$</prompt> <userinput>gap2caf -project NEWSTRAIN >newstrain_edited.caf</userinput></screen>
-      <para>
-	But beware: gap4 does not have the same consensus calling routines as
-	MIRA and will have saved it's own consensus in the new CAF. In fact,
-	gap4 performs rather badly in projects with multiple sequencing
-	technologies. So I use miraconvert from the MIRA package to recall
-	a good consensus (and save it in MAF as it's more compact and a lot
-	faster in handling than CAF):
-      </para>
-      <screen>
-<prompt>$</prompt> <userinput>miraconvert -r c newstrain_edited.caf newstrain_edited_recalled.maf</userinput></screen>
-      <para>
-	And from this file I can then convert with miraconvert to any
-	other format I or my users need: CAF, FASTA, ACE, WIG (for coverage
-	analysis) etc.pp.
-      </para>
-      <para>
-	I can also also generate tables and HTML files with SNP analysis
-	results (with the "<literal>-t asnp</literal>" and "<literal>-t
-	hsnp</literal>" options of <command>miraconvert</command>)
-      </para>
-    </sect2>
-    <sect2 id="sect_sxa_postprocessing_denovo_assemblies">
-      <title>
-	Post-processing de-novo assemblies
-      </title>
-      <para>
-	As the result file of MIRA de-novo assemblies contains everything down
-	to 'contigs' with just two reads, it is advised to first filter out
-	all contigs which are smaller than a given size or have a coverage
-	lower than 1/3 to 1/2 of the overall coverage.
-      </para>
-      <para>
-	Filtering is performed by miraconvert using CAF file as
-	input. Assume you have the following file:
-      </para>
-      <screen>
-<prompt>arcadia:/path/to/myProject/newstrain_d_results$</prompt> <userinput>ls -l</userinput>
-...
--rw-r--r-- 1 bach bach 655176303 2009-06-08 14:56 newstrain_out.maf
-...</screen>
-      <para>
-	Let's say you have a hybrid assembly with an average coverage of
-	50x. I normally filter out all contigs which have an average coverage
-	less than 1/3 and are smaller than 500 bases. These are mostly junk
-	contiglets remaining from the assembly and can be more or less safely
-	ignored. This is done the following way:
-      </para>
-      <screen>
-<prompt>arcadia:newstrain_d_results$</prompt> <userinput>miraconvert -x 500 -y 17 newstrain_out.maf newstrain_filterx500y17.caf</userinput></screen>
-      <para>
-	From there on, convert the filtered CAF file to anything you need to
-	continue finishing of the genome (gap4 database, ACE, etc.pp).
-      </para>
-    </sect2>
-  </sect1>
-  <sect1 id="sect_sxa_walkthrough_data_from_ncbi_SRA">
-    <title>
-      Using SRA data from the Short Read Archive at the NCBI
-    </title>
-    <para>
-      Make sure you have the SRA toolkit installed, see <ulink url="http://www.ncbi.nlm.nih.gov/Traces/sra/sra.cgi?view=software"/>
-    </para>
-    <para>
-      The SRA format needs to be converted into something MIRA understands,
-      FASTQ being an ideal candidate. Therefore the program used for this will
-      be <command>fastq-dump</command>, which unfortunately will not output
-      names as needed by default, but fortunately has useful options to define
-      your own names via the <arg>--defline-seq</arg>
-      and <arg>--defline-qual</arg> command line options.
-    </para>
-    <para>
-      When using paired-end or mate-pair data, one disconcerting thing about
-      the SRA tools is that they will always concatenate by default the two
-      reads into a single sequence, which is of course not what any sane
-      person would expect. Here too, there's a command line option to get
-      around this: <arg>--split-spot</arg>
-    </para>
-    <para>
-      The following shows how I would recommend extracting (and naming) reads
-      from the SRA:
-    </para>
-    <screen>
-<prompt>$</prompt> <userinput>ls -l</userinput>
-...
-<prompt>$</prompt> <userinput>fastq-dump --split-spot --defline-seq '@<replaceable>$ac_$si/$ri</replaceable>' --defline-qual '+' SRR012345.sra</userinput>
-</screen>
-
-  </sect1>
-  <sect1 id="sect_sxa_known_bugs___problems">
-    <title>
-      Known bugs / problems
-    </title>
-    <para>
-      These are actual for version 3 of MIRA and might or might not have been
-      addressed in later version.
-    </para>
-    <para>
-      Bugs:
-    </para>
-    <orderedlist>
-      <listitem>
-	<para>
-	  mapping of paired-end reads with one read being in non-repetitive
-	  area and the other in a repeat is not as effective as it should
-	  be. The optimal strategy to use would be to map first the
-	  non-repetitive read and then the read in the repeat. Unfortunately,
-	  this is not yet implemented in MIRA.
-	</para>
-      </listitem>
-    </orderedlist>
-  </sect1>
-</chapter>
diff --git a/doc/docbook/attic/pb_misc.xml b/doc/docbook/attic/pb_misc.xml
deleted file mode 100644
index f1544f9..0000000
--- a/doc/docbook/attic/pb_misc.xml
+++ /dev/null
@@ -1,839 +0,0 @@
-      <para>
-	With introduction of PacBio strobed reads, MIRA also got an editor to
-	handle "elastic dark inserts" (stretches of unread bases where the
-	length is known only approximately). How this editor works is
-	explained in the chapter on PacBio data, but in essence it allows to
-	transform this:
-      </para>
-      <figure id="chap_intro::pb_elasticdarkinserts01.png">
-	<title>
-	  Multiple alignmen of PacBio elastic dark inserts without automatic editing
-	</title>
-	<mediaobject>
-	  <imageobject>
-	    <imagedata fileref="bookfigures/pb_elasticdarkinserts01.png" width="90%"/>
-	  </imageobject>
-	</mediaobject>
-      </figure>
-      <para>
-	into this:
-      </para>
-      <figure id="chap_intro::pb_elasticdarkinserts02.png">
-	<title>
-	  Multiple alignment of PacBio elastic dark inserts with automatic editing
-	</title>
-	<mediaobject>
-	  <imageobject>
-	    <imagedata fileref="bookfigures/pb_elasticdarkinserts02.png" width="90%"/>
-	  </imageobject>
-	</mediaobject>
-      </figure>
-
-
-
-
-
-    <sect2 id="sect_pb_terminology">
-      <title>Terminology</title>
-    </sect2>
-
-    <sect2 id="sect_pb_strobed_sequencing">
-      <title>What is strobed sequencing?</title>
-
-      <para>Let's first have a look at what sequencing (either paired or
-      unpaired) meant until now. I won't go into the details of conventional
-      sequencing as this is covered elsewhere in the MIRA manuals (and in the
-      Web).</para>
-
-      <sect3 id="sect_pb_normal_sequencing">
-        <title>Conventional way of sequencing a DNA template with Sanger, 454,
-        Solexa, ...</title>
-
-        <para>In conventional, unpaired sequencing, you have a piece of DNA (a
-        DNA <emphasis>template</emphasis>) which a machine reads out and then
-        gives you the sequence back. Assume your piece of DNA to be 10
-        kilo-bases long, but your machine can read only 1000 bases. Then what
-        you get back (<literal>DNA</literal> below is the DNA template,
-        <literal>R1</literal> is a read) is this:</para>
-
-        <screen>
-DNA: actgttg...gtgcatgctgatgactgact.........gactgtgacgtactgcttga...actggatctg
-
-R1 : actgttg...gtgcatgct
-     \_________________/
-              |
-         ~1000 bases</screen>
-
-        <para>In conventional paired-end sequencing, you still can read only
-        1000 bases, but you can do it at the beginning and at the end of a DNA
-        template. This looks like that:</para>
-
-        <screen>
-DNA: actgttg...gtgcatgctgatgactgact.........gactgtgacgtactgcttga...actggatctg
-
-R1 : actgttg...gtgcatgct
-     \_________________/                             R2 : gcttga...actggatctg
-              |                                           \_________________/
-         ~1000 bases                                               |
-                                                              ~1000 bases</screen>
-
-        <para>While you still have just two reads of approximately 1000 bases,
-        you know one additional thing: these two reads are approximately 10000
-        bases apart. This additional information is very useful in assembly as
-        it helps to resolve problematic areas.</para>
-      </sect3>
-
-      <sect3 id="sect_pb_bp_sequencing">
-        <title>Sequencing a DNA template with Pacific Biosciences</title>
-
-        <para>Enter Pacific Biosciences with their strobed sequencing. With
-        this approach, you can sequence also a given number of bases (they
-        claim between 1000 and 3000), but you can sort of "distribute" the
-        bases you want to read across the DNA template.</para>
-
-        <warning>
-           Overly simplified and probably totally inaccurate description
-           ahead! Furthermore, the extremely short read and gap lengths in
-           these examples serve only for demonstration purposes.
-        </warning>
-
-        <para>Here's a simple example: assume you could read around 40 bases
-        with your machinery, but that the DNA template is some ~80 bases. And
-        assume you could tell your machine to read between 6 and 8 bases at a
-        time, then leave out the next 6 to 8 bases, then read again etc. Like
-        so:</para>
-
-        <screen>
-DNA: actgttggtgcatgctgatgactgactgactgtgacgtacttgactgactggatctgtgactgactgtgactgactg
-
-R1a: actgttg
-R1b:                 gatgactgac
-R1c:                                    cgtacttga
-R1d:                                                     atctgtgac
-R1e:                                                                     gactgactg</screen>
-
-        <para>While in the example above we still read only 44 bases, these 44
-        bases span 77 bases on the DNA template. Furthermore, we have the
-        additional information that the sequence of reads is R1a, R1b, R1c,
-        R1d and R1e and, because we asked the machine to read in such a
-        pattern, we expect the gaps between the reads to be between 6 and 8
-        bases wide.</para>
-
-        <para>This is actually possible with the system of PacBio. It streams
-        the DNA template through a detection system which reads out the bases
-        only, and only if, a light source (a laser) is switched on. Therefore,
-        while streaming the template through the system, you read the DNA
-        while the laser is on and you don't read anything while it's off ...
-        meanwhile the template is still streamed through.</para>
-
-        <para>Now, why would one want to turn the laser off?</para>
-
-        <para>It seems as if the light source is actually also the major
-        limitation factor, as it has as nasty side-effect the degradation of
-        DNA it should still read. A real bummer: after 1000 to 3000 bases
-        (sometimes more, sometimes less), the DNA you read is probably so
-        degraded and error ridden (eventually even physically broken) that it
-        makes no sense to continue reading.</para>
-
-        <para>Here comes the trick: instead of reading, say, 1000 bases in a
-        row, you can read them in <emphasis>strobes</emphasis>: you switch the
-        light on and start reading a couple of bases (say: 100), switch the
-        light off, wait a bit until some bases (again, let's say approximately
-        100) have passed by, switch the light back on and read again ~100
-        bases, then switch off ... etc.pp until you have read your 1000 bases,
-        or, more likely, as long as you can. But, as shown in the example
-        above, these 1000 bases will be distributed across a much larger span
-        on the original DNA template: in a pattern of ~100 bases read and ~100
-        bases not read, the smaller read-fragments span ~1800 to ~2000
-        bases.</para>
-
-        <para>Cool ... this is actually something an assembler can make real
-        use of.</para>
-
-        <para>A more conventional approach could be: you switch the light on
-        and start reading a couple of bases (say: 500), switch the light off,
-        wait a bit until some bases (again, let's say approximately 10000)
-        have passed by, switch the light back on and read again ~500 bases.
-        This would be equivalent to a "normal" paired-end read with an insert
-        size of 11Kb. But assemblers also can make good use of that.</para>
-      </sect3>
-    </sect2>
-
-
-
-
-  <sect1 id="sect_pb_howmirahandlesstrobes">
-    <title>How MIRA handles strobes with "elastic dark inserts"</title>
-    <para>MIRA currently knows two ways to handle strobed reads:
-    </para>
-    <orderedlist>
-      <listitem>
-	<para>
-	  a more traditional approach by using two strobes at a time as read pair
-	</para>
-      </listitem>
-      <listitem>
-	<para>
-	  the "elastic dark insert" approach where all strobes are put in one
-	  read and connected by stretches of <literal>N</literal> representing
-	  the dark inserts. "Elastic" means that -- the initial lengths of the
-	  dark inserts being a rough estimate -- the length of the inserts are
-	  then corrected in the iterative assembly passes of MIRA.
-	</para>
-      </listitem>
-    </orderedlist>
-    <para>
-      The elastic dark insert approach has an invaluable advantage: it keeps
-      the small strobes connected in order in a read. This considerably
-      reduces sources of errors when highly repetitive data is to be
-      assembled where paired-end approaches also have limits.
-    </para>
-    <para>
-      Keeping the dark inserts as integral part of the reads however also
-      poses a couple of problems. Traditional Smith-Waterman alignments are
-      likely to give some of these alignments a bad score as there will
-      invariably be a number of overlaps where the true length of the dark
-      stretch is so different from the real length that an alignment algorithm
-      needs to counterbalance this with a considerable number of inserted
-      gaps. Which in turn can lower Smith-Waterman score to a level where
-      needed identity thresholds are not met. The following example shows an
-      excerpt of a case where a read with dark insert which length was
-      estimated too low aligning against a read without dark insert:
-    </para>
-    <screen>
-...TGACTGA****************nnnnnnnnnnnnnnnnnnnnnTCAGTTGAT...
-...TGACTGATGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...</screen>
-    <para>
-      While MIRA algorithms have methods to counterbalance this kind of
-      scoring malus (e.g., by simply not counting gap scores in dark strobe
-      inserts), another effect then appears: multiple alignment
-      disorders. Like in many other assemblers the construction of multiple
-      alignments is done iteratively by aggregating new reads to an existing
-      contig by aligning it against a temporary consensus. As the
-      misestimation of dark insert lengths can reach comparatively high
-      numbers like 20 to 100 bases or more, problems can arise if several
-      misestimated dark inserts in reads come together at one place. A simple
-      example: assume the following scenario, where reads 1, 2, 3 and 4 get to
-      form a contig by being assembled in exactly this order (1,2,3,4):
-    </para>
-    <screen>
-Read1  ...TGACTGAnnnnnnnnnnnnnnnnnnnnnTCAGTTGAT...</screen>
-     <para>then</para>
-    <screen>
-Read1  ...TGACTGA****************nnnnnnnnnnnnnnnnnnnnnTCAGTTGAT...
-Read2  ...TGACTGATGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...</screen>
-    <para>then</para>
-    <screen>
-Read1  ...TGACTGA****************nnnnnnnnnnnnnnnnnnnnnTCAGTTGAT...
-Read2  ...TGACTGATGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...
-Read3  ...TGACTGATGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...</screen>
-    <para>then</para>
-    <screen>
-Read1  ...TGACT*****GA****************nnnnnnnnnnnnnnnnnnnnnTCAGTTGAT...
-Read2  ...TGACT*****GATGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...
-Read3  ...TGACT*****GATGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...
-Read4  ...TGACTnnnnnnnnnnnnnnnnnnnnnnnnnnnnnATGCGTCGAGCTTGGTCAGTTGAT...</screen>
-    <sidebar><title>Why multiple alignments sometimes look funny</title>
-    <para>
-      You will note that the above alignment does not seem optimal as the
-      following would certainly look better:
-    </para>
-    <screen>
-Read1  ...TGACTGA*********************nnnnnnnnnnnnnnnnnnnnnTCAGTTGAT...
-Read2  ...TGACTGA*****TGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...
-Read3  ...TGACTGA*****TGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...
-Read4  ...TGACTnnnnnnnnnnnnnnnnnnnnnnnnnnnnnATGCGTCGAGCTTGGTCAGTTGAT...</screen>
-    <para>
-      However, remember that assembler add reads sequentially to a contig
-      without prior knowledge of the complete multiple alignment. This leads
-      to the necessity of using temporary consensus sequences as target for a
-      new read to align.
-    </para>
-    <para>
-      MIRA knows a lot of tricks to mitigate the detrimental effects of
-      iteratively building multiple alignments, one of which is to use an
-      extended genetic code with weights hinting at potential gaps. This
-      however does not always suffice to resolve every problem.
-    </para>
-    <para>
-      Here's what happens step by step in for this example. First, read 1
-      forms the contig, then read 2 is aligned and both form a new contig with
-      a new temporary consensus (named TCONS2 below) like this:
-    </para>
-    <screen>
-Read1  ...TGACTGA****************nnnnnnnnnnnnnnnnnnnnnTCAGTTGAT...
-Read2  ...TGACTGATGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...
-
-TCONS2 ...TGACTGATGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...</screen>
-    <para>
-      Read 3 is then added and as it is equal to read 3 (at least in this part
-      of the sequence), things go smoothly as the alignment of TCONS2 and read
-      3 is without difference and the alignment of
-    </para>
-    <screen>
-TCONS2 ...TGACTGATGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...
-Read3  ...TGACTGATGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...</screen>
-    <para>
-      leads to the multiple alignment of the three reads like this:
-    </para>
-    <screen>
-Read1  ...TGACTGA****************nnnnnnnnnnnnnnnnnnnnnTCAGTTGAT...
-Read2  ...TGACTGATGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...
-Read3  ...TGACTGATGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...
-
-TCONS3 ...TGACTGATGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...</screen>
-    <para>
-      Note that a new temporary consensus TCONS3 is formed against which the
-      next read (read 4) will have to align:
-    </para>
-    <screen>
-TCONS3 ...TGACT*****GATGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...
-Read4  ...TGACTnnnnnnnnnnnnnnnnnnnnnnnnnnnnnATGCGTCGAGCTTGGTCAGTTGAT...</screen>
-    <para>
-      which then leads to the sub-optimal multiple alignment seen in the beginning:
-    </para>
-    <screen>
-Read1  ...TGACT*****GA****************nnnnnnnnnnnnnnnnnnnnnTCAGTTGAT...
-Read2  ...TGACT*****GATGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...
-Read3  ...TGACT*****GATGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...
-Read4  ...TGACTnnnnnnnnnnnnnnnnnnnnnnnnnnnnnATGCGTCGAGCTTGGTCAGTTGAT...</screen>
-    <para>
-      It would have been totally illogical for a Smith-Waterman alignment to
-      align the temporary consensus TCONS3 with read 4 like this:
-    </para>
-    <screen>
-TCONS3 ...TGACTGA*****TGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...
-Read4  ...TGACTnnnnnnnnnnnnnnnnnnnnnnnnnnnnnATGCGTCGAGCTTGGTCAGTTGAT...</screen>
-    <para>
-      as from purely mathematical point of view, the score of this alignment is
-      lower than for the previous alignment.
-    </para>
-    </sidebar>
-    <para>
-      This can lead to severe misaligns in multiple alignments with several
-      reads as the following screenshot shows exemplarily.
-    </para>
-    <figure id="pb_elasticdarkinserts01">
-      <title>Multiple alignment with PacBio elastic dark inserts, initial
-      status with severe misalignments</title>
-      <mediaobject>
-	<imageobject>
-<!--
-	  <imagedata fileref="bookfigures/pb_elasticdarkinserts01.png" width="4.8in"/>
--->
-	  <imagedata fileref="bookfigures/pb_elasticdarkinserts01.png" width="90%"/>
-	</imageobject>
-      </mediaobject>
-    </figure>
-    <para>
-      However, MIRA is an iterative assembler working in multiple passes and
-      iterations within a pass. This allows for a strategy of iterative
-      correction of the estimation of dark length inserts. Like with every
-      sequencing technology it knows, MIRA analyses the multiple alignment of
-      a contig in several ways and searches for, e.g., misassembled repeats
-      (for more information on this, please refer to the MIRA manual). When
-      having reads with the technology from Pacific Biosciences, MIRA also
-      analyses the elastic dark inserts whether or not their length as
-      measured in the multiple alignment fits the estimated length. If not,
-      the length of the dark insert will be corrected up or down for the next
-      pass, the correction factor being of two thirds of the estimated
-      difference between true and measured length of the dark insert.
-    </para>
-    <para>
-      Coming back to the example used previously:
-    </para>
-    <screen>
-Read1  ...TGACT*****GA****************nnnnnnnnnnnnnnnnnnnnnTCAGTTGAT...
-Read2  ...TGACT*****GATGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...
-Read3  ...TGACT*****GATGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...
-Read4  ...TGACTnnnnnnnnnnnnnnnnnnnnnnnnnnnnnATGCGTCGAGCTTGGTCAGTTGAT...</screen>
-    <para>
-      You will note that there are basically two elastic dark insert
-      stretches. The first in read 1 has an underestimation of of the dark
-      insert size of 16 bases, the second has an overestimation of five
-      bases.
-    </para>
-    <sidebar>
-      <para>
-	While it is not depicted in this simple example, the calculation of how
-	many bases away the estimated length of a dark insert is from the real
-	value is not always simple as multiple misaligns can make this task
-	challenging. If taken without precautions, errors in this calculation
-	can lead to even more false estimation of dark insert lengths and
-	self-enhancing errors. During experimentation with simulated strobed
-	projects, MIRA built the best contigs and needed the least iterations
-	when applying a factor of two thirds to the calculated estimation of
-	dark insert length error.
-      </para>
-    </sidebar>
-    <para>
-	Accordingly, MIRA will add two thirds of 16 =
-	10 <literal>N</literal>s to the estimated dark insert in read 1 and
-	remove 3 <literal>N</literal>s (two thirds of 5) from read 4:
-    </para>
-    <screen>
-Read1 old  ...TGACTGAnnnnnnnnnnnnnnnnnnnnnTCAGTTGAT...
-Read1 new  ...TGACTGANNNNNNNNNNnnnnnnnnnnnnnnnnnnnnnTCAGTTGAT...
-
-Read4 old  ...TGACTnnnnnnnnnnnnnnnnnnnnnnnnnnnnnATGCGTCGAGCTTGGTCAGTTGAT...
-Read4 new  ...TGACTnnnnnnnnnnnnnnnnnnnnnnnnnnATGCGTCGAGCTTGGTCAGTTGAT...</screen>
-    <para>
-      These new reads will be used in the next (sub-)passes of MIRA. Continuing the example from above, the next multiple alignment of all four reads would look like this:
-    </para>
-    <screen>
-Read1  ...TGACT**GA******NNNNNNNNNNnnnnnnnnnnnnnnnnnnnnnTCAGTTGAT...
-Read2  ...TGACT**GATGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...
-Read3  ...TGACT**GATGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...
-Read4  ...TGACTnnnnnnnnnnnnnnnnnnnnnnnnnnATGCGTCGAGCTTGGTCAGTTGAT...</screen>
-    <para>
-      Again, the dark inserts would be corrected by MIRA, this time adding 4
-      <literal>N</literal>s to read 1 and removing one <literal>N</literal>
-      from read 4., so that the next multiple alignment is this:
-    </para>
-    <screen>
-Read1  ...TGACT*GA**NNNNNNNNNNNNNNnnnnnnnnnnnnnnnnnnnnnTCAGTTGAT...
-Read2  ...TGACT*GATGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...
-Read3  ...TGACT*GATGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...
-Read4  ...TGACTnnnnnnnnnnnnnnnnnnnnnnnnnATGCGTCGAGCTTGGTCAGTTGAT...</screen>
-    <para>
-      From there it is trivial to see one just needs two more iterations to
-      replace the initial estimated length of the dark insert by the true
-      length of it. The next screenshot continues the live example shown
-      previously after the second pass of MIRA (remember that each pass can
-      have multiple sub-passes):
-    </para>
-    <figure id="pb_elasticdarkinserts02">
-      <title>Assembly with PacBio dark inserts, status after second pass of MIRA</title>
-      <mediaobject>
-	<imageobject>
-	  <imagedata fileref="bookfigures/pb_elasticdarkinserts02.png" width="90%"/>
-	</imageobject>
-      </mediaobject>
-    </figure>
-    <para>
-      One pass (and multiple sub-passes) later, the elastic dark inserts in
-      this example have reached their true lengths. The multiple alignment is
-      as good as it can get as the following figure shows:
-    </para>
-    <figure id="pb_elasticdarkinserts03">
-      <title>Assembly with PacBio dark inserts, status after third pass of MIRA</title>
-      <mediaobject>
-	<imageobject>
-	  <imagedata fileref="bookfigures/pb_elasticdarkinserts03.png" width="90%"/>
-	</imageobject>
-      </mediaobject>
-    </figure>
-    <para>
-      The elastic dark insert strategy is quite successful for resolving most
-      problems but sometimes also fails to find a perfect solution. However,
-      the remaining multiple alignment is -- in most cases -- good enough for
-      a consensus algorithm to find the correct consensus as the next
-      screenshot shows:
-    </para>
-    <figure id="pb_elasticdarkinserts04">
-      <title>Assembly with PacBio dark inserts, example where elastic correction failed partially</title>
-      <mediaobject>
-	<imageobject>
-	  <imagedata fileref="bookfigures/pb_elasticdarkinserts04.png" width="90%"/>
-	</imageobject>
-      </mediaobject>
-    </figure>
-  </sect1>
-
-
-  <sect1 id="sect_pb_walkthrough_simulated">
-    <title>Walkthroughs: assembly examples with simulated PacBio data</title>
-    <para>
-      Whole genome sequencing of bacteria will probably be amongst the first
-      for which the long PacBio reads will have an impact. Simply put: the
-      repeat structure -- like rRNA stretches, (pro)phages and or duplicated
-      genes/operons -- of bacteria is such that most genomes known so far can
-      be assembled and or scaffolded with paired-end libraries between 6Kb and
-      10Kb.  <emphasis role="bold">Cite paper ...!</emphasis>
-    </para>
-    <para>
-      Well, using strobed reads where a DNA template is sequenced in several
-      strobes and the dark inserts have approximately the same length as a
-      strobe, the initial PacBio data should be capable to generate strobed
-      data from DNA templates a total span between 2000 and 6000 bases.
-    </para>
-    <para>
-      Furthermore, strobed reads can be used to generate traditional
-      paired-end sequence with large insert sizes like 10Kb or more.
-    </para>
-    <para>
-      In the first few examples showing assembly with only PacBio data, we
-      will use the genome of the <emphasis>Bacillus subtilis</emphasis> 168,
-      which is a long standing model organism for systems biology and also
-      used in biotechnology. From a complexity point of view, the genome has
-      some interesting things in. As example, there are 11 rRNA stretches,
-      some of them clustered together, which probably comes from the fact that
-      <emphasis>Bsub</emphasis> evolved under laboratory conditions to become
-      a fast grower. The most awful multiple rRNA cluster is the one starting
-      at ...Kb and is ... Kb long.
-    </para>
-    <para>
-      The examples afterwards we will work with <emphasis>Escherichia
-      coli</emphasis> ... (Eco), another model organism in the bacterial
-      community. That time we will mix simulated low coverage PacBio data with
-      real data from Solexa deposited at the NCBI Short read Archive (SRA).
-    </para>
-    <note>
-      <para>
-	Currently this section contains examples with real Solexa reads but
-	only simulated PacBio reads as I do not have early access to real
-	PacBio data. However, I think that these examples show the
-	possibilities such a technology could have.
-      </para>
-    </note>
-  <sect2 id="sect_pb_exsd_generalnotes">
-    <title>Some general notes on how directories and data are set-up in these examples</title>
-    <para>
-      Everyone (or every sequencing group / center) has more or less an own
-      standard on how to organise directories and data prior to an
-      assembly. Here's how I normally do it and how the following examples
-      will be -- more or less -- set up: one top directory with the name of
-      the project containing three specific sub-directories; one for original
-      data, one for eventually reformated data and one for assemblies. That
-      looks a bit like this:
-    </para>
-<screen>
-<prompt>$</prompt> <userinput>mkdir myproject</userinput>
-<prompt>$</prompt> <userinput>cd myproject</userinput>
-<prompt>myproject$</prompt> <userinput>mkdir origdata data assemblies</userinput>
-</screen>
-    <para>
-      The <emphasis>origdata</emphasis> directory contains whatever data file
-      (or links to those) I have for that project: sequencing files from the
-      provider, reference genomes from databases etc.pp. The general rule: no
-      other files, and these files are generally write protected and unchanged
-      from the state of delivery.
-    </para>
-    <para>
-      The <emphasis>data</emphasis> directory contains the files as MIRA will
-      want to use them, eventually reformatted or reworked or bundled together
-      with other data. E.g.: if your provider delivered several data files
-      with sequence data for PacBio, you currently need to combine them into
-      one file as MIRA currently reads only one input file per sequencing
-      technology.
-    </para>
-    <para>
-      The <emphasis>assemblies</emphasis> directory finally contains
-      sub-directories with different assembly trials I make. Every sub-directory
-      is quickly set-up by creating it, linking data files from the
-      <filename>data</filename> directory to it and then start
-      MIRA. Continuing the example from above:
-    </para>
-<screen>
-<prompt>myproject$</prompt> <userinput>cd assemblies</userinput>
-<prompt>myproject/assemblies$</prompt> <userinput>mkdir firstassembly</userinput>
-<prompt>myproject/assemblies$</prompt> <userinput>cd firstassembly</userinput>
-<prompt>myproject/assemblies/firstassembly$</prompt> <userinput>lndir ../../data</userinput>
-<prompt>myproject/assemblies/firstassembly$</prompt> <userinput>mira --project=...</userinput></screen>
-    <para>
-      That strategy keeps things nice and tidy in place and allows for a
-      maximum flexibility while testing out a couple of settings.
-    </para>
-  </sect2>
-  <sect2 id="sect_pb_exsd_pe">
-    <title>PacBio only: Bacterial whole genome, 1Kb "paired-end", 10Kb insert size</title>
-    <para>
-      Set up directories and fetch genome of Bacillus subtilis 168 from GenBank
-    </para>
-    <screen>
-<prompt>$</prompt> <userinput>mkdir bsubdemo1</userinput>
-<prompt>$</prompt> <userinput>cd bsubdemo1</userinput>
-<prompt>bsubdemo1$</prompt> <userinput>mkdir origdata data assemblies</userinput>
-<prompt>bsubdemo1$</prompt> <userinput>cd origdata</userinput>
-<prompt>bsubdemo1/origdata$</prompt> <userinput>wget ftp://ftp.ncbi.nih.gov/genbank/genomes/Bacteria/Bacillus_subtilis/AL009126.fna</userinput>
-<prompt>bsubdemo1/origdata$</prompt> <userinput>ls -l</userinput>
--rw-r--r-- 1 bach bach 4275918 2010-06-06 00:34 AL009126.fna</screen>
-    <para>
-      After that, we'll prepare the the simulated PacBio data by running a
-      script which creates paired reads like we would expect from a sequencing
-      with PacBio with the following properties: DNA templates have 10k bases
-      or more, we sequence the first 1000 bases in a strobe, let approximately
-      8000 bases pass, then sequence another 1000 bases.
-    </para>
-    <screen>
-<prompt>bsubdemo1/origdata$</prompt> <userinput>cd ../data</userinput>
-<prompt>bsubdemo1/data$</prompt> <userinput>fasta2frag.tcl  -l 1000 -i 230 -p 1 -insert_size 10000 -pairednaming 454 -P 0 -r 2 -infile ../origdata/AL009126.fna -outfile bs168pe1k_10k_in.pacbio.fasta</userinput>
-no ../origdata/AL009126.fna.qual
-fragging gi|225184640|emb|AL009126.3|
-<prompt>bsubdemo1/data$</prompt> <userinput>ls -l</userinput>
--rw-r--r-- 1 bach bach  38971051 2010-06-06 18:27 bs168pe1k_10k_in.pacbio.fasta
--rw-r--r-- 1 bach bach   1642208 2010-06-06 18:27 bs168pe1k_10k_in.pacbio.fasta.bambus
--rw-r--r-- 1 bach bach   1440988 2010-06-06 18:27 bs168pe1k_10k_in.pacbio.fasta.pairs
--rw-r--r-- 1 bach bach 111214374 2010-06-06 18:27 bs168pe1k_10k_in.pacbio.fasta.qual</screen>
-    <para>
-      The command line given above will create an artificial data set with
-      equally distributed PacBio "paired-end" reads with an average coverage
-      of 8.6 across the genome. Note that the <filename>*.bambus</filename>
-      and <filename>*.pairs</filename> files are not needed for MIRA, but the
-      Tcl script generates these for some other use cases.
-    </para>
-    <para>
-      Next, we move to the assembly directory, make a new one to run a first
-      assembly and link all the needed input files for MIRA into this new
-      directory:
-    </para>
-    <screen>
-<prompt>bsubdemo1/data$</prompt> <userinput>cd ../assemblies</userinput>
-<prompt>bsubdemo1/assemblies$</prompt> <userinput>mkdir firsttest</userinput>
-<prompt>bsubdemo1/assemblies$</prompt> <userinput>cd firsttest</userinput>
-<prompt>bsubdemo1/assemblies/firsttest$</prompt> <userinput>ln -s ../../data/bs168pe1k_10k_in.pacbio.fasta .</userinput>
-<prompt>bsubdemo1/assemblies/firsttest$</prompt> <userinput>ln -s ../../data/bs168pe1k_10k_in.pacbio.fasta.qual .</userinput>
-<prompt>bsubdemo1/assemblies/firsttest$</prompt> <userinput>ls -l</userinput>
-lrwxrwxrwx 1 bach bach 39 2010-06-06 01:01 bs168pe1k_10k_in.pacbio.fasta -> ../../data/bs168pe1k_10k_in.pacbio.fasta
-lrwxrwxrwx 1 bach bach 44 2010-06-06 01:01 bs168pe1k_10k_in.pacbio.fasta.qual -> ../../data/bs168pe1k_10k_in.pacbio.fasta.qual</screen>
-    <para>
-      We're all set up now, just need to start the assembly:
-    </para>
-    <screen>
-<prompt>bsubdemo1/assemblies/firsttest$</prompt> <userinput>mira
-  --project=bs168pe1k_10k --job=genome,denovo,accurate,pacbio
-  --notraceinfo -GE:not=4
-  PACBIO_SETTINGS
-  -GE:tpbd=1:tismin=9000:tismax=11000 -LR:rns=fr
-  >&log_assembly.txt</userinput></screen>
-    <para>
-      The command above told MIRA
-    </para>
-    <itemizedlist>
-      <listitem>
-	<para>the <emphasis>name</emphasis> (<literal>bs168pe1k_10k</literal>)
-	you chose for your project. MIRA will search input files with this
-	prefix as well as write output files and directories with that prefix.
-	</para>
-      </listitem>
-      <listitem>
-	<para>the <emphasis>assembly job</emphasis> MIRA should perform. In this
-	case a de-novo genome assembly at accurate level with PacBio data.
-	</para>
-      </listitem>
-      <listitem>
-	<para>some additional information that MIRA should not search for
-	additional ancillary information in NCBI TRACEINFO XML files
-	</para>
-      </listitem>
-      <listitem>
-	<para>the <emphasis>number of threads</emphasis> which MIRA should run at most in parallel.
-	</para>
-      </listitem>
-      <listitem>
-	<para>then tell MIRA that the following switches apply to reads in the
-	assembly which are from Pacific Biosciences
-	</para>
-      </listitem>
-      <listitem>
-	<para> both reads of a PacBio read-pair should assemble in the same direction in a contig.. the minimum distance between the outer read ends should be at minimum 9000 bases and at maximum 11000 bases.
-	</para>
-      </listitem>
-      <listitem>
-	<para>the <emphasis>read naming scheme</emphasis> for a PacBio read-pair is "forward/reverse", i.e., the first read has ".f" appended to its name, the second read ".r".
-	</para>
-      </listitem>
-      <listitem>
-	<para>the standard output of MIRA should be <emphasis>redirected</emphasis> to a file name <filename>log_assembly.txt</filename>
-	</para>
-      </listitem>
-    </itemizedlist>
-    <para>
-      Some 12 to 13 minutes later, the data set will be assembled. Though you
-      should note that in real life projects with sequencing errors, MIRA will
-      take perhaps 3 to 4 times longer. Have a look at the information files
-      in directory <filename>bs168pe1k_10k_assembly /
-      bs168pe1k_10k_d_info/</filename>, there especially to the files
-      <filename>bs168pe1k_10k_info_assembly.txt</filename> and
-      <filename>bs168pe1k_10k_info_contigstats.txt</filename> which give a
-      first overview on how the assembly went.
-    </para>
-    <para>
-      In short: this assembly went -- unsurprisingly -- quite well: the
-      complete chromosome of <emphasis>Bacillus subtilis</emphasis> 168 has
-      been reconstructed into one complete contig. There are just two minor
-      flaws disturbing just a little bit. First, a few (twelve) repetitive
-      reads could not be placed and form a second small contig of 2Kb. Second,
-      the reconstructed chromosome contains 4 single-base differences with
-      respect to the original Bsub chromosome. It is an exercise left to the
-      reader to find out that this is due to almost identical rRNA repeats
-      where two almost adjacent elements lie within the expected template
-      insert size of the simulated PacBio Reads and therefore troubled the
-      assembler a bit.
-    </para>
-    <para>
-      Your next stop would then be the directory
-      <filename>bs168pe1k_10k_assembly / bs168pe1k_10k_d_results/</filename>
-      which contains the assembly results in all kind of formats. If a format
-      you need is missing, have a look at <command>convert_project</command>
-      from the MIRA package, it may be that the format you need can be
-      generated with it.
-    </para>
-  </sect2>
-  <sect2 id="sect_pb_exsd_3kstrobes">
-    <title>PacBio only: Bacterial whole genome, 3Kb strobed bases (6Kb with
-    elastic dark inserts)</title>
-
-    <para>
-      Set up directories and fetch genome of Bacillus subtilis 168 from GenBank
-    </para>
-    <screen>
-<prompt>$</prompt> <userinput>mkdir bsubdemo2</userinput>
-<prompt>$</prompt> <userinput>cd bsubdemo2</userinput>
-<prompt>bsubdemo2$</prompt> <userinput>mkdir origdata data assemblies</userinput>
-<prompt>bsubdemo2$</prompt> <userinput>cd origdata</userinput>
-<prompt>bsubdemo2/origdata$</prompt> <userinput>wget ftp://ftp.ncbi.nih.gov/genbank/genomes/Bacteria/Bacillus_subtilis/AL009126.fna</userinput>
-<prompt>bsubdemo2/origdata$</prompt> <userinput>ls -l</userinput>
--rw-r--r-- 1 bach bach 4275918 2010-06-06 00:34 AL009126.fna</screen>
-    <para>
-      After that, we'll prepare the the simulated PacBio data by running a
-      script which creates strobed reads like we would expect from a sequencing
-      with PacBio with the following properties: DNA templates are 6k bases
-      or more, we sequence the first ~100 bases in a strobe, let approximately
-      100 bases pass, and repeat until we have 3000 bases in strobes.
-    </para>
-    <screen>
-<prompt>bsubdemo2/origdata$</prompt> <userinput>cd ../data</userinput>
-<prompt>bsubdemo2/data$</prompt> <userinput>fasta2frag.tcl -l 3000 -i 150 -r 2 -s 1 -strobeon 100 -strobeoff 100 -infile ../origdata/AL009126.fna -outfile bs168_3ks_100_100_in.pacbio.fasta</userinput>
-no ../origdata/AL009126.fna.qual
-fragging gi|225184640|emb|AL009126.3|
-<prompt>bsubdemo2/data$</prompt> <userinput>ls -l</userinput>
--rw-r--r-- 1 bach bach 166909136 2010-06-06 19:18 bs168_3ks_100_100_in.pacbio.fasta
--rw-r--r-- 1 bach bach 416614472 2010-06-06 19:18 bs168_3ks_100_100_in.pacbio.fasta.qual</screen>
-    <para>
-      The command line given above will create an artificial data set with
-      equally distributed PacBio strobed reads with an average coverage of ~20
-      across the genome, of which only half is filled with sequence data so
-      that the "real" coverage is ~10.
-    </para>
-    <para>
-      Next, we move to the assembly directory, make a new one to run a first
-      assembly and link all the needed input files for MIRA into this new
-      directory:
-    </para>
-    <screen>
-<prompt>bsubdemo2/data$</prompt> <userinput>cd ../assemblies</userinput>
-<prompt>bsubdemo2/assemblies$</prompt> <userinput>mkdir firsttest</userinput>
-<prompt>bsubdemo2/assemblies$</prompt> <userinput>cd firsttest</userinput>
-<prompt>bsubdemo2/assemblies/firsttest$</prompt> <userinput>ln -s ../../data/bs168_3ks_100_100_in.pacbio.fasta .</userinput>
-<prompt>bsubdemo2/assemblies/firsttest$</prompt> <userinput>ln -s ../../data/bs168_3ks_100_100_in.pacbio.fasta.qual .</userinput>
-<prompt>bsubdemo2/assemblies/firsttest$</prompt> <userinput>ls -l</userinput>
-lrwxrwxrwx 1 bach bach 39 2010-06-06 01:01 bs168_3ks_100_100_in.pacbio.fasta -> ../../data/bs168_3ks_100_100_in.pacbio.fasta
-lrwxrwxrwx 1 bach bach 44 2010-06-06 01:01 bs168_3ks_100_100_in.pacbio.fasta -> ../../data/bs168_3ks_100_100_in.pacbio.fasta</screen>
-    <para>
-      We're all set up now, just need to start the assembly:
-    </para>
-    <screen>
-<prompt>bsubdemo1/assemblies/firsttest$</prompt> <userinput>mira
-  --project=bs168_3ks_100_100 --job=genome,denovo,accurate,pacbio
-  --notraceinfo --noclipping
-  -GE:not=4
-  -GO:mr=no
-  PACBIO_SETTINGS
-  -AL:egp=no
-  >&log_assembly.txt</userinput></screen>
-    <para>
-      The command above told MIRA
-    </para>
-    <itemizedlist>
-      <listitem>
-	<para>the <emphasis>name</emphasis> (<literal>bs168_3ks_100_100</literal>)
-	you chose for your project. MIRA will search input files with this
-	prefix as well as write output files and directories with that prefix.
-	</para>
-      </listitem>
-      <listitem>
-	<para>the <emphasis>assembly job</emphasis> MIRA should perform. In this
-	case a de-novo genome assembly at accurate level with PacBio data.
-	</para>
-      </listitem>
-      <listitem>
-	<para>some additional information that MIRA should not search for
-	additional ancillary information in NCBI TRACEINFO XML files
-	</para>
-      </listitem>
-      <listitem>
-	<para>the <emphasis>number of threads</emphasis> which MIRA should run
-	at most in parallel.
-	</para>
-      </listitem>
-      <listitem>
-	<para>a MIRA parameter called <emphasis>mark repeats</emphasis> should
-	be switched off for PacBio reads. This is absolutely necessary when
-	you have strobed reads with elastic dark inserts as MIRA otherwise
-	gets somewhat confused due to alignment problems shown earlier in this
-	guide.
-	</para>
-      </listitem>
-      <listitem>
-	<para>then tell MIRA that the following switches apply to reads in the
-	assembly which are from Pacific Biosciences
-	</para>
-      </listitem>
-      <listitem>
-	<para>a MIRA parameter called <emphasis>extra gap penalty</emphasis>
-	should be switched off for PacBio reads. This is necessary when you
-	have strobed reads with elastic dark inserts as otherwise alignment
-	problems with larger gaps lead to unnecessary rejection of alignments.
-	</para>
-      </listitem>
-      <listitem>
-	<para>the standard output of MIRA should be
-	<emphasis>redirected</emphasis> to a file name
-	<filename>log_assembly.txt</filename>
-	</para>
-      </listitem>
-    </itemizedlist>
-    <para>
-      Wait for approximately 4.5hrs for MIRA to complete. Using elastic dark
-      inserts is a pretty expensive feature from a computation perspective:
-      all the passes and sub-passes of MIRA to move from an estimated length to
-      an actually correct value means to build and break apart all the contigs
-      and start from anew.
-    </para>
-    <para>
-      Bad news first: looking at the results and info directories, you will
-      see that one single contig with a length of 4199898 bases was
-      created. The original B. subtilis genome we used for this walkthrough is
-      4215426 bases, so it looks like some 15.5Kb are "missing." But, and this
-      is the good news, the contig which was created represents the
-      B. subtilis genome pretty faithfully: a check with MUMMER confirms that
-      no misassemblies respectively re-ordering event of genome elements
-      occurred.
-    </para>
-    <note>
-      <para>
-	The following will need MUMMER3 installed on your system. Fetch it here:
-	<ulink url="http://mummer.sourceforge.net/"/>
-      </para>
-    </note>
-    <screen>
-<prompt>bsubdemo2/assemblies/firsttest$</prompt> <userinput>cd bs168_3ks_100_100_assembly/bs168_3ks_100_100_d_results</userinput>
-<prompt>../bs168_3ks_100_100_d_results$</prompt> <userinput>ls -l</userinput>
--rw-r--r-- 1 bach bach 280894715 2010-06-08 04:53 bs168_3ks_100_100_out.ace
--rw-r--r-- 1 bach bach 776536315 2010-06-08 04:52 bs168_3ks_100_100_out.caf
--rw-r--r-- 1 bach bach 461365272 2010-06-08 04:52 bs168_3ks_100_100_out.maf
--rw-r--r-- 1 bach bach   4347658 2010-06-08 04:52 bs168_3ks_100_100_out.padded.fasta
--rw-r--r-- 1 bach bach  13040564 2010-06-08 04:52 bs168_3ks_100_100_out.padded.fasta.qual
--rw-r--r-- 1 bach bach 436189259 2010-06-08 04:53 bs168_3ks_100_100_out.tcs
--rw-r--r-- 1 bach bach   4269919 2010-06-08 04:52 bs168_3ks_100_100_out.unpadded.fasta
--rw-r--r-- 1 bach bach  12808422 2010-06-08 04:52 bs168_3ks_100_100_out.unpadded.fasta.qual
--rw-r--r-- 1 bach bach   3203036 2010-06-08 04:53 bs168_3ks_100_100_out.wig
-<prompt>../bs168_3ks_100_100_d_results$</prompt> <userinput>nucmer -maxmatch -c 100 -p nucmer ../../../../origdata/AL009126.fna bs168_3ks_100_100_out.unpadded.fasta</userinput>
-1: PREPARING DATA
-2,3: RUNNING mummer AND CREATING CLUSTERS
-[... some lines left out ...]
-4: FINISHING DATA
-<prompt>../bs168_3ks_100_100_d_results$</prompt> <userinput>delta-filter -q -l 1000 nucmer.delta > nucmer.delta.q</userinput>
-<prompt>../bs168_3ks_100_100_d_results$</prompt> <userinput>show-coords -r -c -l nucmer.delta.q > nucmer.coords</userinput>
-<prompt>../bs168_3ks_100_100_d_results$</prompt> <userinput>cat nucmer.coords</userinput>
-NUCMER
-    [S1]     [E1]  |     [S2]     [E2]  |  [LEN 1]  [LEN 2]  |  [% IDY]  |  [LEN R]  [LEN Q]  |  [COV R]  [COV Q]  | [TAGS]
-===============================================================================================================================
-     181  4215606  |  4199698        1  |  4215426  4199698  |    99.62  |  4215606  4199898  |   100.00   100.00  | gi|225184640|emb|AL009126.3|      bs168_3ks_100_100_c1</screen>
-    <para>
-      As already said: not 100% perfect on a base by base basis, but good
-      enough for a using as reference sequence in subsequent mapping
-      assemblies to get all the bases right.
-    </para>
-  </sect2>
diff --git a/doc/docbook/attic/solexa_lenski.xml b/doc/docbook/attic/solexa_lenski.xml
deleted file mode 100644
index 634dfb2..0000000
--- a/doc/docbook/attic/solexa_lenski.xml
+++ /dev/null
@@ -1,499 +0,0 @@
-      <para>
-	We're going to use data published by Richard Lenski in his great paper
-	<emphasis>"Genome evolution and adaptation in a long-term experiment
-	with Escherichia coli"</emphasis>. This shows how MIRA finds all
-	mutations between two strains and how one would need just a few
-	minutes to know which genes are affected.
-      </para>
-      <note>
-	All steps described in this walkthrough are present in ready-to-be-run
-	scripts in the <literal>solexa3_lenski</literal> demo directory of the
-	MIRA package.
-      </note>
-      <note>
-	This walkthrough takes a few detours which are not really necessary,
-	but show how things can be done: it reduces the number of reads, it
-	creates a strain data file etc. Actually, the whole demo could be
-	reduced to two steps: downloading the data (naming it correctly) and
-	starting the assembly with a couple of parameters.
-      </note>
-      <sect3 id="sect_sxa_getting_the_data">
-	<title>
-	  Getting the data
-	</title>
-	<para>
-	  We'll use the reference genome E.coli B REL606 to map one of the
-	  strains from the paper. For mapping, I picked strain REL8593A more
-	  or less at random. All the data needed is fortunately at the NCBI,
-	  let's go and grab it:
-	</para>
-	<orderedlist>
-	  <listitem>
-	    <para>
-	      the NCBI has REL606 named <emphasis>NC_012967</emphasis>. We'll
-	      use the RefSeq version and the GenBank formatted file you can
-	      download from
-	      <ulink url="ftp://ftp.ncbi.nih.gov/genomes/Bacteria/Escherichia_coli_B_REL606/NC_012967.gbk"/>
-	    </para>
-	  </listitem>
-	  <listitem>
-	    <para>
-	      the Solexa re-sequencing data you can get from <ulink
-	      url="ftp://ftp.ncbi.nlm.nih.gov/sra/static/SRX012/SRX012992/"/>. Download
-	      both FASTQ files, <filename>SRR030257_1.fastq.gz</filename> and
-	      <filename>SRR030257_2.fastq.gz</filename>.
-	    </para>
-	    <para>
-	      If you want more info regarding these data sets, have a look at
-	    <ulink url="http://www.ncbi.nlm.nih.gov/sra/?db=sra&term=SRX012992&report=full"/>
-	    </para>
-	  </listitem>
-	</orderedlist>
-      </sect3>
-      <sect3 id="sect_sxa_preparing_the_data_for_an_assembly">
-	<title>
-	  Preparing the data for an assembly
-	</title>
-	<para>
-	  In this section we will setup the directory structure for the
-	  assembly and pre-process the data so that MIRA can start right away.
-	</para>
-	<para>
-	  Let's start with setting up a directory structure. Remember: you can
-	  setup the data almost any way you like, this is just how I do
-	  things.
-	</para>
-	<para>
-	  I normally create a project directory with three sub-directories:
-	  <filename>origdata</filename>, <filename>data</filename>, and
-	  <filename>assemblies</filename>. In <filename>origdata</filename> I
-	  put the files exactly as I got them from the sequencing or data
-	  provider, without touching them and even remowing write permissions
-	  to these files so that they cannot be tampered with. After that, I
-	  pre-process them and put the pre-processed files into
-	  <filename>data</filename>. Pre-processing can be a lot of things,
-	  starting from having to re-format the sequences, or renaming them,
-	  perhaps also doing clips etc. Finally, I use these pre-processed
-	  data in one or more assembly runs in the
-	  <filename>assemblies</filename> directory, perhaps trying out
-	  different assembly options.
-	</para>
-	<screen>
-<prompt>arcadia:/some/path/$</prompt> <userinput>mkdir lenskitest</userinput>
-<prompt>arcadia:/some/path/$</prompt> <userinput>cd lenskitest</userinput>
-<prompt>arcadia:/some/path/lenskitest$</prompt> <userinput>mkdir data origdata assemblies</userinput>
-<prompt>arcadia:/some/path/lenskitest$</prompt> <userinput>ls -l</userinput>
-drwxr-xr-x 2 bach bach 4096 2009-12-06 16:06 assemblies
-drwxr-xr-x 2 bach bach 4096 2009-12-06 16:06 data
-drwxr-xr-x 2 bach bach 4096 2009-12-06 16:06 origdata</screen>
-	<para>
-	  Now copy the files you just downloaded into the directory
-	  <filename>origdata</filename>.
-	</para>
-	<screen>
-<prompt>arcadia:/some/path/lenskitest$</prompt> <userinput>cp /wherever/the/files/are/SRR030257_1.fastq.gz origdata</userinput>
-<prompt>arcadia:/some/path/lenskitest$</prompt> <userinput>cp /wherever/the/files/are/SRR030257_2.fastq.gz origdata</userinput>
-<prompt>arcadia:/some/path/lenskitest$</prompt> <userinput>cp /wherever/the/files/are/NC_012967.gbk origdata</userinput>
-<prompt>arcadia:/some/path/lenskitest$</prompt> <userinput>ls -l origdata</userinput>
--rw-r--r-- 1 bach bach  10543139 2009-12-06 16:38 NC_012967.gbk
--rw-r--r-- 1 bach bach 158807975 2009-12-06 15:15 SRR030257_1.fastq.gz
--rw-r--r-- 1 bach bach 157595587 2009-12-06 15:21 SRR030257_2.fastq.gz
-	</screen>
-	<para>
-	  Great, let's preprocess the data. For this you must know a few things:
-	</para>
-	<itemizedlist>
-	  <listitem>
-	    <para>
-	      the standard Illumina naming scheme for Solexa paired-end reads
-	      is to append forward read names with <literal>/1</literal> and
-	      reverse read names with <literal>/2</literal>. The reads are
-	      normally put into at least two different files (one for forward,
-	      one for reverse). Now, the Solexa data stored in the Short Read
-	      Archive at the NCBI also has forward and reverse files for
-	      paired-end Solexas. That's OK. What's a bit less good is that
-	      the read names there DO NOT have /1 appended to names of forward
-	      read, or /2 to names of reverse reads. The forward and reverse
-	      reads in both files are just named exactly the same.  We'll need
-	      to fix that.
-	    </para>
-	  </listitem>
-	  <listitem>
-	    <para>
-	      while Sanger and 454 reads should be preprocessed (clipping
-	      sequencing vectors, perhaps quality clipping etc.), reads from
-	      Solexa present do not. Some people perform quality clipping or
-	      clipping of reads with too many 'N's in the sequence, but this
-	      is not needed when using MIRA. In fact, MIRA will perform
-	      everything needed for Solexa reads itself and will generally do
-	      a much better job as the clipping performed is independent of
-	      Solexa quality values (which are not always the most trustworthy
-	      ones).
-	    </para>
-	  </listitem>
-	  <listitem>
-	    <para>
-	      for a mapping assembly, it's good to give the strain name of the
-	      backbone and the strain name for the reads mapped against. The
-	      former can be done via command line, the later is done for each
-	      read individually in a key-value file (the
-	      <emphasis>straindata</emphasis> file).
-	    </para>
-	  </listitem>
-	</itemizedlist>
-	<para>
-	</para>
-	<para>
-	  So, to pre-process the data, we will need to
-	</para>
-	<itemizedlist>
-	  <listitem>
-	    <para>
-	      put the reads of the NCBI forward and reverse pairs into one
-	      file
-	    </para>
-	  </listitem>
-	  <listitem>
-	    <para>
-	      append <literal>/1</literal> to the names of forward reads, and
-	      <literal>/2</literal> for reverse reads.
-	    </para>
-	  </listitem>
-	  <listitem>
-	    <para>
-	      create a straindata file for MIRA
-	    </para>
-	  </listitem>
-	</itemizedlist>
-	<para>
-	</para>
-	<para>
-	  To ease things for you, I've prepared a small script which will do
-	  everything for you: copy and rename the reads as well as creating
-	  strain names. Note that it's a small part of a more general script
-	  which I use to sometimes sample subsets of large data sets, but for
-	  the Lenski data set is small enough so that everything is taken.
-	</para>
-	<para>
-	  Create a file <filename>prepdata.sh</filename> in directory
-	  <filename>data</filename> and copy paste the following into it:
-	</para>
-	<screen>
-######################################################################
-#######
-####### Prepare paired-end Solexa downloaded from NCBI
-#######
-######################################################################
-
-# srrname:    is the SRR name as downloaded form NCBI SRA
-# numreads:   maximum number of forward (and reverse) reads to take from
-#              each file. Just to avoid bacterial projects with a coverage
-#              of 200 or so.
-# strainname: name of the strain which was re-sequenced
-
-srrname="SRR030257"
-numreads=5000000
-strainname="REL8593A"
-
-################################
-
-numlines=$((4*${numreads}))
-
-# put "/1" Solexa reads into file
-echo "Copying ${numreads} reads from _1 (forward reads)"
-zcat ../origdata/${srrname}_1.fastq.gz | head -${numlines} | sed -e 's/SRR[0-9.]*/&\/1/' >${strainname}-${numreads}_in.solexa.fastq
-
-# put "/2" Solexa reads into file
-echo "Copying ${numreads} reads from _2 (reverse reads)"
-zcat ../origdata/${srrname}_2.fastq.gz | head -${numlines} | sed -e 's/SRR[0-9.]*/&\/2/' >>${strainname}-${numreads}_in.solexa.fastq
-
-# make file with strainnames
-echo "Creating file with strain names for copied reads (this may take a while)."
-grep "@SRR" ${strainname}-${numreads}_in.solexa.fastq | cut -f 1 -d ' ' | sed -e 's/@//' -e "s/$/ ${strainname}/" >>${strainname}-${numreads}_straindata_in.txt</screen>
-	<para>
-	  Now, let's create the needed data:
-	</para>
-	<screen>
-arcadia:/some/path/lenskitest$ <userinput>cd data</userinput>
-arcadia:/some/path/lenskitest/data$ <userinput>ls -l</userinput>
--rw-r--r-- 1 bach bach       1349 2009-12-06 17:05 prepdata.sh
-arcadia:/some/path/lenskitest/data$ <userinput>sh prepdata.sh</userinput>
-Copying 5000000 reads from _1 (forward reads)
-Copying 5000000 reads from _2 (reverse reads)
-Creating file with strain names for copied reads (this may take a while).
-arcadia:/some/path/lenskitest/data$ <userinput>ls -l</userinput>
--rw-r--r-- 1 bach bach       1349 2009-12-06 17:05 prepdata.sh
--rw-r--r-- 1 bach bach 1553532192 2009-12-06 15:36 REL8593A-5000000_in.solexa.fastq
--rw-r--r-- 1 bach bach  218188232 2009-12-06 15:36 REL8593A-5000000_straindata_in.txt</screen>
-	<para>
-	  Last step, just for the sake of completeness, link in the GenBank formatted
-	  file of the reference strain, giving it the same base name so that everything
-	  is nicely set up for MIRA.
-	</para>
-	<screen>
-<prompt>arcadia:/some/path/lenskitest/data$</prompt> <userinput>ln -s ../origdata/NC_012967.gbk REL8593A-5000000_backbone_in.gbf</userinput>
-<prompt>arcadia:/some/path/lenskitest/data$</prompt> <userinput>ls -l</userinput>
--rw-r--r-- 1 bach bach       1349 2009-12-06 17:05 prepdata.sh
-lrwxrwxrwx 1 bach bach         25 2009-12-06 16:39 REL8593A-5000000_backbone_in.gbf -> ../origdata/NC_012967.gbk
--rw-r--r-- 1 bach bach 1553532192 2009-12-06 15:36 REL8593A-5000000_in.solexa.fastq
--rw-r--r-- 1 bach bach  218188232 2009-12-06 15:36 REL8593A-5000000_straindata_in.txt
-<prompt>arcadia:/some/path/lenskitest/data$</prompt> <userinput>cd ..</userinput>
-<prompt>arcadia:/some/path/lenskitest$</prompt></screen>
-	<para>
-	  Perfect, we're ready to start assemblies.
-	</para>
-      </sect3>
-      <sect3 id="sect_sxa_starting_the_mapping_assembly">
-	<title>
-	  Starting the mapping assembly
-	</title>
-	<screen>
-<prompt>arcadia:/some/path/lenskitest$</prompt> <userinput>cd assemblies</userinput>
-<prompt>arcadia:/some/path/lenskitest/assemblies$</prompt> <userinput>mkdir 1sttest</userinput>
-<prompt>arcadia:/some/path/lenskitest/assemblies/1sttest$</prompt> <userinput>lndir ../../data</userinput>
-<prompt>arcadia:/some/path/lenskitest/assemblies/1sttest$</prompt> <userinput>ls -l</userinput>
-lrwxrwxrwx 1 bach bach         22 2009-12-06 17:18 prepdata.sh -> ../../data/prepdata.sh
-lrwxrwxrwx 1 bach bach         43 2009-12-06 16:40 REL8593A-5000000_backbone_in.gbf -> ../../data/REL8593A-5000000_backbone_in.gbf
-lrwxrwxrwx 1 bach bach         43 2009-12-06 15:39 REL8593A-5000000_in.solexa.fastq -> ../../data/REL8593A-5000000_in.solexa.fastq
-lrwxrwxrwx 1 bach bach         45 2009-12-06 15:39 REL8593A-5000000_straindata_in.txt -> ../../data/REL8593A-5000000_straindata_in.txt</screen>
-	<para>
-	  Oooops, we don't need the link <filename>prepdata.sh</filename>
-	  here, just delete it.
-	</para>
-	<screen>
-<prompt>arcadia:/some/path/lenskitest/assemblies/1sttest$</prompt> <userinput>rm prepdata.sh</userinput></screen>
-	<para>
-	  Perfect. Now then, start a simple mapping assembly:
-	</para>
-	<screen>
-<prompt>arcadia:/some/path/lenskitest/assemblies/1sttest$</prompt> <userinput>mira
-  --fastq
-  --project=REL8593A-5000000
-  --job=mapping,genome,accurate,solexa
-  -SB:lsd=yes:bsn=ECO_B_REL606:bft=gbf
-  >&log_assembly.txt</userinput></screen>
-	<note>
-	  <title>Note 1</title>
-	  <para>
-	    The above command has been split in multiple lines for better
-	    overview but should be entered in one line. It basically says:
-	    load all data in FASTQ format; the project name is
-	    <emphasis>REL8593A-5000000</emphasis> (and therefore all input and
-	    output files will have this prefix by default if not chosen
-	    otherwise); we want an accurate mapping of Solexa reads against a
-	    genome; load strain data of a separate strain file
-	    (<arg>-SB:lsd=yes</arg>); the strain name of the reference
-	    sequence is 'ECO_B_REL606' (<arg>-SB:bsn=ECO_B_REL606</arg>) and
-	    the file type containing the reference sequence in a GenBank
-	    format (<arg>-SB:bft=gbf</arg>). Last but not least, redirect the
-	    progress output of the assembler to a file named
-	    <filename>log_assembly.txt</filename>.
-	  </para>
-	</note>
-	<note>
-	  <title>Note 2</title>
-	  <para>
-	    The above assembly takes approximately 35 minutes on my computer
-	    (i7 940 with 12 GB RAM) when using 4 threads (I have '-GE:not=4'
-	    additionally). It may be faster or slower on your computer.
-	  </para>
-	</note>
-	<note>
-	  <title>Note 3</title>
-	  <para>
-	    You will need some 10.5 GB RAM to get through this. You might get
-	    away with a bit less RAM and using swap, but less than 8 GB RAM is
-	    not recommended.
-	  </para>
-	</note>
-	<para>
-	  Let's have a look at the directory now:
-	</para>
-	<screen>
-<prompt>arcadia:/some/path/lenskitest/assemblies/1sttest$</prompt> <userinput>ls -l</userinput>
--rw-r--r-- 1 bach bach 1463331186 2010-01-27 20:41 log_assembly.txt
-drwxr-xr-x 6 bach bach       4096 2010-01-27 20:04 REL8593A-5000000_assembly
-lrwxrwxrwx 1 bach bach         43 2009-12-06 16:40 REL8593A-5000000_backbone_in.gbf -> ../../data/REL8593A-5000000_backbone_in.gbf
-lrwxrwxrwx 1 bach bach         43 2009-12-06 15:39 REL8593A-5000000_in.solexa.fastq -> ../../data/REL8593A-5000000_in.solexa.fastq
-lrwxrwxrwx 1 bach bach         45 2009-12-06 15:39 REL8593A-5000000_straindata_in.txt -> ../../data/REL8593A-5000000_straindata_in.txt</screen>
-	<para>
-	  Not much which changed. All files created by MIRA will be in the
-	  REL8593A-5000000_assembly directory. Going one level down, you'll see 4
-	  sub-directories:
-	</para>
-	<screen>
-<prompt>arcadia:/some/path/lenskitest/assemblies/1sttest$</prompt> <userinput>cd REL8593A-5000000_assembly</userinput>
-<prompt>arcadia:.../1sttest/REL8593A-5000000_assembly$</prompt> <userinput>ls -l</userinput>
-drwxr-xr-x 2 bach bach 4096 2010-01-27 20:29 REL8593A-5000000_d_chkpt
-drwxr-xr-x 2 bach bach 4096 2010-01-27 20:40 REL8593A-5000000_d_info
-drwxr-xr-x 2 bach bach 4096 2010-01-27 20:30 REL8593A-5000000_d_tmp
-drwxr-xr-x 2 bach bach 4096 2010-01-27 21:19 REL8593A-5000000_d_results</screen>
-	<para>
-	  You can safely delete the tmp and the chkpt directories, in this
-	  walkthrough they are not needed anymore.
-	</para>
-      </sect3>
-      <sect3 id="sect_sxa_looking_at_results">
-	<title>
-	  Looking at results
-	</title>
-	<para>
-	  Results will be in a sub-directories created by MIRA. Let's go there
-	  and have a look.
-	</para>
-	<screen>
-<prompt>arcadia:/some/path/lenskitest/assemblies/1sttest$</prompt> <userinput>cd REL8593A-5000000_assembly</userinput>
-<prompt>arcadia:.../1sttest/REL8593A-5000000_assembly$</prompt> <userinput>cd REL8593A-5000000_d_results</userinput>
-<prompt>arcadia:.../REL8593A-5000000_d_results$</prompt> <userinput>ls -l</userinput>
--rw-r--r-- 1 bach bach  455087340 2010-01-27 20:40 REL8593A-5000000_out.ace
--rw-r--r-- 1 bach bach  972479972 2010-01-27 20:38 REL8593A-5000000_out.caf
--rw-r--r-- 1 bach bach  569619434 2010-01-27 20:38 REL8593A-5000000_out.maf
--rw-r--r-- 1 bach bach    4708371 2010-01-27 20:39 REL8593A-5000000_out.padded.fasta
--rw-r--r-- 1 bach bach   14125036 2010-01-27 20:39 REL8593A-5000000_out.padded.fasta.qual
--rw-r--r-- 1 bach bach  472618709 2010-01-27 20:39 REL8593A-5000000_out.tcs
--rw-r--r-- 1 bach bach    4707025 2010-01-27 20:39 REL8593A-5000000_out.unpadded.fasta
--rw-r--r-- 1 bach bach   14120999 2010-01-27 20:39 REL8593A-5000000_out.unpadded.fasta.qual
--rw-r--r-- 1 bach bach   13862715 2010-01-27 20:39 REL8593A-5000000_out.wig</screen>
-	<para>
-	  You can see that MIRA has created output in many different formats
-	  suited for a number of different applications. Most commonly known
-	  will be ACE and CAF for their use in finishing programs (e.g. gap4
-	  and consed).
-	</para>
-	<para>
-	  In a different directory (the info directory) there are also files
-	  containing all sorts of statistics and useful information.
-	</para>
-	<screen>
-<prompt>arcadia:.../REL8593A-5000000_d_results$</prompt> <userinput>cd ../REL8593A-5000000_d_info/</userinput>
-<prompt>arcadia:.../REL8593A-5000000_d_info$</prompt> <userinput>ls -l</userinput>
--rw-r--r-- 1 bach bach     2256 2010-01-27 20:40 REL8593A-5000000_info_assembly.txt
--rw-r--r-- 1 bach bach      124 2010-01-27 20:04 REL8593A-5000000_info_callparameters.txt
--rw-r--r-- 1 bach bach    37513 2010-01-27 20:37 REL8593A-5000000_info_consensustaglist.txt
--rw-r--r-- 1 bach bach 28522692 2010-01-27 20:37 REL8593A-5000000_info_contigreadlist.txt
--rw-r--r-- 1 bach bach      176 2010-01-27 20:37 REL8593A-5000000_info_contigstats.txt
--rw-r--r-- 1 bach bach 15359354 2010-01-27 20:40 REL8593A-5000000_info_debrislist.txt
--rw-r--r-- 1 bach bach 45802751 2010-01-27 20:37 REL8593A-5000000_info_readtaglist.txt</screen>
-	<para>
-	  Just have a look at them to get a feeling what they show. You'll
-	  find more information regarding these files in that main manual of
-	  MIRA. At the moment, let's just have a quick assessment of the
-	  differences between the Lenski reference strain and the REL8593A
-	  train by counting how many SNPs MIRA thinks there are (marked with
-	  <emphasis>SROc</emphasis> tags in the consensus):
-	</para>
-	<screen>
-<prompt>arcadia:.../REL8593A-5000000_d_info$</prompt> <userinput>grep -c SROc REL8593A-5000000_info_consensustaglist.txt</userinput>
-102</screen>
-	<para>
-	</para>
-	<para>
-	  102 bases are marked with such a tag. You will later see that this
-	  is an overestimation due to several insert sites and deletions, but
-	  it's a good first approximation.
-	</para>
-	<para>
-	  Let's count how many potential deletion sites REL8593A has in
-	  comparison to the reference strain:
-	</para>
-	<screen>
-<prompt>arcadia:.../REL8593A-5000000_d_info$</prompt> <userinput>grep -c MCVc REL8593A-5000000_info_consensustaglist.txt</userinput>
-48</screen>
-	<para>
-	  This number too is a slight overestimation due to
-	  cross-contamination with sequenced strain which did not have these
-	  deletions, but it's also a first approximate.
-	</para>
-      </sect3>
-      <sect3 id="sect_sxa_postprocessing_with_gap4_and_reexporting_to_mira">
-	<title>
-	  Post-processing with gap4 and re-exporting to MIRA
-	</title>
-	<para>
-	  To have a look at your project in gap4, use the caf2gap program (you
-	  can get it at the Sanger Centre), and then gap4:
-	</para>
-	<screen>
-<prompt>arcadia:.../REL8593A-5000000_d_results$</prompt> <userinput>ls -l</userinput>
--rw-r--r-- 1 bach bach  455087340 2010-01-27 20:40 REL8593A-5000000_out.ace
--rw-r--r-- 1 bach bach  972479972 2010-01-27 20:38 REL8593A-5000000_out.caf
--rw-r--r-- 1 bach bach  569619434 2010-01-27 20:38 REL8593A-5000000_out.maf
--rw-r--r-- 1 bach bach    4708371 2010-01-27 20:39 REL8593A-5000000_out.padded.fasta
--rw-r--r-- 1 bach bach   14125036 2010-01-27 20:39 REL8593A-5000000_out.padded.fasta.qual
--rw-r--r-- 1 bach bach  472618709 2010-01-27 20:39 REL8593A-5000000_out.tcs
--rw-r--r-- 1 bach bach    4707025 2010-01-27 20:39 REL8593A-5000000_out.unpadded.fasta
--rw-r--r-- 1 bach bach   14120999 2010-01-27 20:39 REL8593A-5000000_out.unpadded.fasta.qual
--rw-r--r-- 1 bach bach   13862715 2010-01-27 20:39 REL8593A-5000000_out.wig
-<prompt>arcadia:.../REL8593A-5000000_d_results$</prompt> <userinput>caf2gap -project REL8593A -ace REL8593A-5000000_out.caf >&/dev/null</userinput>
-<prompt>arcadia:.../REL8593A-5000000_d_results$</prompt> <userinput>ls -l</userinput>
--rw-r--r-- 1 bach bach 1233494048 2010-01-27 20:43 REL8593A.0
--rw-r--r-- 1 bach bach  233589448 2010-01-27 20:43 REL8593A.0.aux
--rw-r--r-- 1 bach bach  455087340 2010-01-27 20:40 REL8593A-5000000_out.ace
--rw-r--r-- 1 bach bach  972479972 2010-01-27 20:38 REL8593A-5000000_out.caf
--rw-r--r-- 1 bach bach  569619434 2010-01-27 20:38 REL8593A-5000000_out.maf
--rw-r--r-- 1 bach bach    4708371 2010-01-27 20:39 REL8593A-5000000_out.padded.fasta
--rw-r--r-- 1 bach bach   14125036 2010-01-27 20:39 REL8593A-5000000_out.padded.fasta.qual
--rw-r--r-- 1 bach bach  472618709 2010-01-27 20:39 REL8593A-5000000_out.tcs
--rw-r--r-- 1 bach bach    4707025 2010-01-27 20:39 REL8593A-5000000_out.unpadded.fasta
--rw-r--r-- 1 bach bach   14120999 2010-01-27 20:39 REL8593A-5000000_out.unpadded.fasta.qual
--rw-r--r-- 1 bach bach   13862715 2010-01-27 20:39 REL8593A-5000000_out.wig
-
-<prompt>arcadia:.../REL8593A-5000000_d_results$</prompt> <userinput>gap4 REL8593A.0</userinput></screen>
-	<para>
-	  Search for the tags set by MIRA which denoted features or problems (SROc,
-	  WRMc, MCVc, UNSc, IUPc. See main manual for full list) in the assembly, and
-	  edit accordingly. Save your gap4 database as a new version (e.g. REL8593A.1),
-	  then exit gap4.
-	</para>
-	<para>
-	  Then use the gap2caf command (also from the Sanger Centre) to convert
-	  the gap4 database back to CAF.
-	</para>
-	<screen>
-<prompt>arcadia:.../REL8593A-5000000_d_results$</prompt> <userinput>gap2caf -project REL8593A.1 >rel8593a_edited.caf</userinput></screen>
-	<para>
-	  As gap4 jumbled the consensus (it does not know different sequencing
-	  technologies), having convert_project recalculate the consensus
-	  (with the "<literal>-r c</literal>" option) is generally a good
-	  idea.
-	</para>
-	<screen>
-<prompt>arcadia:.../REL8593A-5000000_d_results$</prompt> <userinput>convert_project -f caf -t caf -r c rel8593a_edited.caf rel8593a_edited_recalled</userinput></screen>
-      </sect3>
-      <sect3 id="sect_sxa_converting_mapping_results_into_html_and_simple_spreadsheet_tables_for_biologists">
-	<title>
-	  Converting mapping results into HTML and simple spreadsheet tables
-	  for biologists
-	</title>
-	<para>
-	  You will have to use either CAF or MAF as input, either of which can
-	  be the direct result from the MIRA assembly or an already cleaned
-	  and edited file. For the sake of simplicity, we'll use the file
-	  created by MIRA in the steps above.
-	</para>
-	<para>
-	  Let's start with a HTML file showing all positions of interest:
-	</para>
-	<screen>
-<prompt>arcadia:.../REL8593A-5000000_d_results$</prompt> <userinput>convert_project -f caf -t hsnp REL8593A-5000000_out.caf rel8593a</userinput>
-<prompt>arcadia:.../REL8593A-5000000_d_results$</prompt> <userinput>ls -l *html</userinput>
--rw-r--r-- 1 bach bach 5198791 2010-01-27 20:49 rel8593a_info_snpenvironment.html</screen>
-	<para>
-	  But MIRA can do even better: create tables ready to be imported in spreadsheet
-	  programs.
-	</para>
-	<screen>
-<prompt>arcadia:.../REL8593A-5000000_d_results$</prompt> <userinput>convert_project -f caf -t asnp REL8593A-5000000_out.caf rel8593a</userinput>
-<prompt>arcadia:.../REL8593A-5000000_d_results$</prompt> <userinput>ls -l rel8593a*</userinput>
--rw-r--r-- 1 bach bach      25864 2010-01-27 20:48 rel8593a_info_featureanalysis.txt
--rw-r--r-- 1 bach bach   12402905 2010-01-27 20:48 rel8593a_info_featuresequences.txt
--rw-r--r-- 1 bach bach     954473 2010-01-27 20:48 rel8593a_info_featuresummary.txt
--rw-r--r-- 1 bach bach    5198791 2010-01-27 20:49 rel8593a_info_snpenvironment.html
--rw-r--r-- 1 bach bach      13810 2010-01-27 20:47 rel8593a_info_snplist.txt</screen>
-	<para>
-	  Have a look at all file, perhaps starting with the SNP list, then the feature
-	  analysis, then the feature summary (your biologists will love that one,
-	  especially when combined with filters in the spreadsheet program) and
-	  then the feature sequences.
-	</para>
-      </sect3>
diff --git a/doc/docbook/book.xsl b/doc/docbook/book.xsl
index 6c4777c..64b2381 100644
--- a/doc/docbook/book.xsl
+++ b/doc/docbook/book.xsl
@@ -6,9 +6,6 @@
 <xsl:param name="html.stylesheet" select="'doccss/miradocstyle.css'"/>
 <xsl:param name="admon.graphics" select="1"/>
 
-<!-- no separate page for revision history -->
-<xsl:param name="doc.collab.show" select="0"/>
-
 <!-- chapter and section numbering, section numbering includes chapter number
 -->
 <xsl:param name="chapter.autolabel" select="1"/>
@@ -41,7 +38,7 @@ set       toc,title
 </xsl:param>
 
 
-<!-- book: only book toc -->
+<!-- book: only book toc
 <xsl:template match="preface|chapter|appendix|article" mode="toc">
   <xsl:param name="toc-context" select="."/>
 
@@ -62,7 +59,7 @@ set       toc,title
     </xsl:otherwise>
   </xsl:choose>
 </xsl:template>
-<!-- -->
+-->
 
 
 
diff --git a/doc/docbook/book_3rdparty.xml b/doc/docbook/book_3rdparty.xml
deleted file mode 100644
index 78e2f97..0000000
--- a/doc/docbook/book_3rdparty.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" ?>
-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.docbook.org/xml/4.5/docbookx.dtd">
-<book>
- 
-<bookinfo>
-<title>3rd party documentation to MIRA 4</title>
-<subtitle>
-  Things "The Definitive Guide" missed and other people kindly contributed
-</subtitle>
-<titleabbrev>3rd party</titleabbrev>
-<legalnotice>
-<para>
-This documentation is licensed under the Creative Commons
-Attribution-NonCommercial-ShareAlike 3.0 Unported License. To view a copy of
-this license, visit <ulink
-url="http://creativecommons.org/licenses/by-nc-sa/3.0/"/> or send a letter to
-Creative Commons, 171 Second Street, Suite 300, San Francisco, California,
-94105, USA.
-</para>
-</legalnotice>
-
-</bookinfo>
-
-
-<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_3p_ghbambus_part.xml"/>
-
-</book>
-
diff --git a/doc/docbook/book_definitiveguide.xml b/doc/docbook/book_definitiveguide.xml
index b46f378..71e0ca5 100644
--- a/doc/docbook/book_definitiveguide.xml
+++ b/doc/docbook/book_definitiveguide.xml
@@ -3,11 +3,11 @@
 <book>
  
 <bookinfo>
-<title>Sequence assembly with MIRA 4</title>
+<title>Sequence assembly with MIRA3</title>
 <subtitle>
   The Definitive Guide
 </subtitle>
-<titleabbrev>MIRA 4</titleabbrev>
+<titleabbrev>MIRA3</titleabbrev>
 <legalnotice>
 <para>
 This documentation is licensed under the Creative Commons
@@ -20,6 +20,9 @@ Creative Commons, 171 Second Street, Suite 300, San Francisco, California,
 </legalnotice>
 
 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="versionfile"/>
+<releaseinfo>
+  <emphasis role="light">Document revision $Id$</emphasis>
+</releaseinfo>
 
 <author>
   <firstname>Bastien</firstname>
@@ -45,7 +48,10 @@ Creative Commons, 171 Second Street, Suite 300, San Francisco, California,
   <contrib>Draft for section on preprocessing of ESTs in EST manual
   </contrib>
 </othercredit>
-<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="copyrightfile"/>
+<copyright><year>2010</year><holder>Bastien Chevreux</holder></copyright>
+<!--
+<releaseinfo>This book is alpha, MIRA3 is stable :-)</releaseinfo>
+-->
 </bookinfo>
 
 
@@ -54,37 +60,76 @@ Creative Commons, 171 Second Street, Suite 300, San Francisco, California,
 </dedication>
 -->
 
+<preface><title>Preface</title>
+<blockquote>
+  <attribution>Solomon Short</attribution>
+  <para>
+    <emphasis><quote>How much intelligence does one need to sneak upon lettuce?
+    </quote></emphasis>
+  </para>
+</blockquote>
+<para>
+  This "book" is actually the result of an exercise in self-defense. It
+  contains texts from several years of help files, mails, postings, questions,
+  anwers etc.pp concerning MIRA and assembly projects one can do with it.
+</para>
+<para>
+  I never really intended to push MIRA. It started out as a PhD thesis and I
+  subsequently continued development when I needed something to be done which
+  other programs couldn't do at the time. But MIRA has always been available
+  as binary on the Internet since 1999 ... and as Open Source since
+  2007. Somehow, MIRA seems to have caught the attention of more than just a
+  few specialised sequencing labs and over the years I've seen an ever growing
+  number of mails in my inbox and on the MIRA mailing list. Both from people
+  having been "since ever" in the sequencing business as well as from labs or
+  people just getting their feet wet in the area.
+</para>
+<para>
+  The help files -- and through them this book -- sort of reflect this
+  development. Most of the chapters<footnote><para>Avid readers of David
+  Gerrold will certainly recognise the quotes from his books at the beginning
+  of each chapter</para></footnote> contain both very specialised
+  topics as well as step-by-step walk-throughs intended to help people to get
+  their assembly projects going. Some parts of the documentation are written
+  in a decidedly non-scientific way. Please excuse, time for rewriting mails
+  somewhat lacking, some texts were re-used almost verbatim.
+</para>
+<para>
+  Nothing is perfect, and both MIRA and this documentation are far from it. If
+  you spot an error either in MIRA or the docs, feel free to report it. Or,
+  even better, correct it if you can. At least with the help files it should
+  be easy, they're just text files.
+</para>
+<para>
+  I hope that MIRA will be as useful to you as it has been to me. Have a lot
+  of fun with it.
+</para>
+<para>
+  Rheinfelden, Summer 2011
+</para>
+<para>
+  Bastien Chevreux
+</para>
+</preface>
 
 
-<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_preface_part.xml"/>
 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_intro_part.xml"/>
 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_installation_part.xml"/>
 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_reference_part.xml"/>
-<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_dataprep_part.xml"/>
-<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_denovo_part.xml"/>
-<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_mapping_part.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_sanger_part.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_454_part.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_iontor_part.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_solexa_part.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_pacbio_part.xml"/>
 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_est_part.xml"/>
-<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_specialparams_part.xml"/>
 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_results_part.xml"/>
 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_mirautils_part.xml"/>
 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_hard_part.xml"/>
-<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_seqtechdesc_part.xml"/>
 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_seqadvice_part.xml"/>
-<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_bitsandpieces_part.xml"/>
 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_faq_part.xml"/>
 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_maf_part.xml"/>
 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_logfiles_part.xml"/>
-
-<!--
-<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_sanger_part.xml"/>
 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_bonus_part.xml"/>
 
-<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_454_part.xml"/>
-<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_iontor_part.xml"/>
-<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_solexa_part.xml"/>
-<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_pacbio_part.xml"/>
-<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_sra_part.xml"/>
-
--->
-
 </book>
+
diff --git a/doc/docbook/bookfigures/ion_dh10bcovB13_12kb.png b/doc/docbook/bookfigures/ion_dh10bcovB13_12kb.png
new file mode 100644
index 0000000..24d6346
Binary files /dev/null and b/doc/docbook/bookfigures/ion_dh10bcovB13_12kb.png differ
diff --git a/doc/docbook/bookfigures/ion_dh10bcovB13_320kb.png b/doc/docbook/bookfigures/ion_dh10bcovB13_320kb.png
new file mode 100644
index 0000000..6bb0807
Binary files /dev/null and b/doc/docbook/bookfigures/ion_dh10bcovB13_320kb.png differ
diff --git a/doc/docbook/bookfigures/results_mira2other.png b/doc/docbook/bookfigures/results_mira2other.png
deleted file mode 100644
index 73eaf8c..0000000
Binary files a/doc/docbook/bookfigures/results_mira2other.png and /dev/null differ
diff --git a/doc/docbook/bookfigures/results_miraconvert.png b/doc/docbook/bookfigures/results_miraconvert.png
deleted file mode 100644
index 0d461b4..0000000
Binary files a/doc/docbook/bookfigures/results_miraconvert.png and /dev/null differ
diff --git a/doc/docbook/chap_3p_ghbambus_part.xml b/doc/docbook/chap_3p_ghbambus_part.xml
deleted file mode 100644
index 8129a91..0000000
--- a/doc/docbook/chap_3p_ghbambus_part.xml
+++ /dev/null
@@ -1,409 +0,0 @@
-<?xml version="1.0" ?>
-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.docbook.org/xml/4.5/docbookx.dtd">
-<chapter id="chap_3p_ghbambus">
-  <chapterinfo>
-    <author>
-      <personname>
-	<firstname>Gregory</firstname>
-	<surname>Harhay</surname>
-      </personname>
-      <email>gregory.harhay at ars.usda.gov</email>
-      <affiliation>
-	<orgdiv>
-	  Animal Health Research Unit
-	</orgdiv>
-	<orgname>
-	  USDA-ARS-Meat Animal Research Center
-	</orgname>
-	<street>
-	  Clay Center, NE 6890
-	</street>
-      </affiliation>
-    </author>
-    <copyright><year>2010</year><holder>Gregory Harhay</holder></copyright>
-  </chapterinfo>
-
-  <title>Scaffolding MIRA 454 contigs using 454 paired-end data and BAMBUS</title>
-  <sect1 id="sect_3p_installbambus">
-    <title>Installing BAMBUS</title>
-    <para>
-      Note that you'll have to do this only once.
-    </para>
-    <sect2 id="sect_3p_ibinstallamos">
-    <title>Installing AMOS</title>
-    <note>
-      Download and use <ulink
-      url="http://sourceforge.net/projects/amos/files/amos/2.0.8/">amos-2.0.8</ulink>,
-      because the <command>ace2contig</command> script created by the
-      installer is necessary to convert MIRA <filename>.ace</filename> file
-      into a contig file that can be used by BAMBUS; later AMOS-short-tgz
-      versions of AMOS don’t create this script.
-    </note>
-    <para>
-      Follow directions for installing amos 2.0.8. I am installing on a 64-bit
-      Redhat Enterprise Linux 5. The configure script complains that Qt
-      doesn’t work correctly and GUI apps won’t run properly. I ignore this
-      because I’m really only interested in the ace2contig script. For BAMBUS
-      to run correctly, the BAMBUS team recommends you should pre-install:
-    </para>
-    <itemizedlist>
-      <listitem>XML::Parser perl module from <ulink url="http://www.cpan.org/"/></listitem>
-      <listitem>Config::IniFiles perl module from <ulink url="http://www.cpan.org/"/></listitem>
-      <listitem>GraphViz package from <ulink url="http://www.graphviz.org/"/></listitem>
-    </itemizedlist>
-    <para>
-      Just to be safe I also pre-installed
-    </para>
-    <itemizedlist>
-      <listitem>GraphViz perl module from <ulink url="http://www.graphviz.org/"/></listitem>
-    </itemizedlist>
-    </sect2>
-    <sect2 id="sect_3p_ibinstallbabmbus">
-    <title>Installing BAMBUS</title>
-    <para>
-      Download bambus-2.33 and decompress. Edit Makefile file to set
-      environment variables (within script) for BASEDIR & PERL.
-    </para>
-    <warning>
-      <para>
-	There is a bug in the installation source scripts goBabmus.pl
-      </para>
-      <literal>
-	bambus-2.33/src/goBabmus.pl line 22 $ENV{PERLLIB} .= ":$BAMBUS_BASE/lib";
-      </literal>
-      <para>
-	should change PERLLIB to PERL5LIB
-      </para>
-      <literal>
-	$ENV{PERL5LIB} = ":$BAMBUS_BASE/lib";
-      </literal>
-    </warning>
-    <para>
-      Follow the directions for BAMBUS installation, don’t forget to edit the
-      Makefile BASEDIR variable and to set the environmental variable PERL as
-      directed in <ulink url="http://sourceforge.net/apps/mediawiki/amos/index.php?title=Bambus_Manual"/>.
-    </para>
-    <para>
-      Run the test case as directed in the manual to make sure BAMBUS is
-      installed properly.
-    </para>
-    </sect2>
-    <sect2 id="sect_3p_ibtroubleshooting">
-      <title>Troubleshooting</title>
-      <sect3 id="sect_3p_ibtsubuntu9">
-	<title>For Ubuntu 9 users</title>
-	<para>(anonymous user contribution, added 3/10)</para>
-	<para>
-	  There are problems making the grommit executable. They are remedied by
-	  the following procedure: in the <filename>bambus-2.33/src/TIGR_Foundation_CC</filename>
-	  directory apply the following changes
-	</para>
-	<variablelist>
-	  <varlistentry>
-	    <term>
-	      ConfigFile.hh
-	    </term>
-	    <listitem>
-	      add the line: <literal>#include <string.h></literal>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term>
-	      Logger.hh
-	    </term>
-	    <listitem>
-	      add the line: <literal>#include <stdlib.h></literal>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term>
-	      OptionResult.hh
-	    </term>
-	    <listitem>
-	      add the line: <literal>#include <stdlib.h></literal>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term>
-	      Options.hh
-	    </term>
-	    <listitem>
-	      add the line: <literal>#include <string.h></literal>
-	    </listitem>
-	  </varlistentry>
-	</variablelist>
-	<para>
-	  After changes, remake bambus from the the
-	  bambus-2.33 directory run
-	</para>
-	<screen>make clean
-make all
-make install</screen>
-      </sect3>
-      <sect3 id="sect_3p_ibtssuse11.2">
-	<title>For SUSE 11.2 users</title>
-	<para>(from Lionel Guy <email>guy.lionel at gmail.com</email>, added 7/27/10)</para>
-	<para>
-	  To be able to compile, had to further modify the following files in
-	  the <filename>bambus-2.33/src/TIGR_Foundation_CC</filename> directory:
-	</para>
-	<variablelist>
-	  <varlistentry>
-	    <term>
-	      FileSystem.cc
-	    </term>
-	    <listitem>
-	      <para>
-		in function FileSystem::isCreatableFile (line 58), changed
-	      </para>
-	      <literal>
-		char * end_of_path = strrchr(filename, PATH_DELIMINATOR);
-	      </literal>
-	      <para>to</para>
-	      <literal>
-		const char * end_of_path = strrchr(filename, PATH_DELIMINATOR);
-	      </literal>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term>
-	      Options.cc
-	    </term>
-	    <listitem>
-	      add the line: <literal>#include <cstdio></literal>
-	    </listitem>
-	  </varlistentry>
-	</variablelist>
-      </sect3>
-      <sect3 id="sect_3p_ibtsuntangle">
-	<title>Problem with untangle.pl</title>
-	<para>
-	  It has been reported that in some installations that the untangle
-	  script doesn’t run properly and generates the following error:
-	</para>
-	<literal>
-	  Can't locate TIGR/Foundation.pm in @INC
-	</literal>
-	<para>
-	  to locate Foundation.pm type:
-	</para>
-	<screen><userinput>locate Foundation.pm</userinput></screen>
-       <para>
-	 the output of which will be the path to your Foundation.pm. In my
-	 case, it is
-       </para>
-       <screen>/usr/local/share/apps/bambus-2.33/lib/TIGR/Foundation.pm</screen>
-       <para>
-	 Include this path at the beginning of the <filename>untangle.pl</filename> script as in
-       </para>
-       <screen>use lib “/usr/local/share/apps/bambus-2.33/lib/TIGR/Foundation.pm”;</screen>
-      </sect3>
-    </sect2>
-  </sect1>
-  <sect1 id="sect_3p_miraassembly">
-    <title>Assemble with MIRA</title>
-    <para>
-      Before you begin you should have a fasta file of the paired-end (PE)
-      adaptor sequence, the PE and shotgun SFF files, and know the mean and
-      standard deviation of PE construct (get from lab, likely a sizing
-      gel). Then follow the <ulink url="http://mira-assembler.sourceforge.net/docs/DefinitiveGuideToMIRA.html#sect_454_walkthrough:_combined_unpaired_and_pairedend_assembly_of_brucella_ceti">instructions</ulink> of the MIRA manual for combined
-      paired-end /shotgun MIRA assembly, of which a simplified version is
-      summarized below.
-    </para>
-    <sect2 id="sect_3p_mapreppe">
-      <title>Prepare paired-end data for assembly</title>
-      <para>
-	Issue something the something like the following command:
-      </para>
-      <screen><userinput>sff_extract  -l ../paired_end_adaptor.fasta  F04Y2AI01.sff -i "insert_size:25000,insert_stdev:9000" -o non_0157</userinput></screen>
-      <para>
-	to create the following files:
-      </para>
-      <screen>-rw-rw-r-- 1 greg greg 125438250 Aug 24 16:59 non_0157.xml
--rw-rw-r-- 1 greg greg 136943770 Aug 24 16:59 non_0157.fastq</screen>
-      <para>
-	To check if everything went well, type
-      </para>
-      <screen>><userinput>less non_0157.xml</userinput></screen>
-      <para>
-	to get something like:
-      </para>
-      <screen><?xml version="1.0"?>
-<trace_volume>
-    <trace>
-        <trace_name>F04Y2AI01AIS9Z.fn</trace_name>
-        <insert_stdev>9000</insert_stdev>
-        <insert_size>25000</insert_size>
-        <clip_vector_left>5</clip_vector_left>
-        <clip_vector_right>58</clip_vector_right>
-    </trace>
-    <trace>
-        <trace_name>F04Y2AI01AJLJM.r</trace_name>
-        <insert_stdev>9000</insert_stdev>
-        <insert_size>25000</insert_size>
-        <clip_vector_right>2</clip_vector_right>
-        <template_id>F04Y2AI01AJLJM</template_id>
-        <trace_end>r</trace_end>
-    </trace>
-    <trace>
-        <trace_name>F04Y2AI01AJLJM.f</trace_name>
-        <insert_stdev>9000</insert_stdev>
-        <insert_size>25000</insert_size>
-        <clip_vector_right>130</clip_vector_right>
-        <template_id>F04Y2AI01AJLJM</template_id>
-        <trace_end>f</trace_end>
-    </trace></screen>
-      <para>
-	Looks good, PE data in the XML file.
-      </para>
-    </sect2>
-    <sect2 id="sect_3p_maprepshotgun">
-      <title>Prepare shotgun data for assembly</title>
-      <para>
-	Now, work on shotgun SFF files and append (use -a) to PE data in fasta, qual, xml files:
-      </para>
-      <screen><userinput>sff_extract -Q -a  FAPPU2401.sff FA79DFG01.sff E95K6EU01.sff  -o non_0157</userinput></screen>
-      <para>
-	to get something like
-      </para>
-      <screen>-rw-rw-r-- 1 greg greg 230827474 Aug 24 17:06 non_0157.xml
--rw-rw-r-- 1 greg greg 322941190 Aug 24 17:06 non_0157.fastq</screen>
-      <para>
-	Notice how the file sizes have changed to accommodate the shotgun
-	seqs? Now change file names to make them MIRA friendly:
-      </para>
-      <screen>><userinput>mv non_0157.xml   non_0157_traceinfo_in.454.xml</userinput>
-><userinput>mv non_0157.fastq non_0157_in.454.fastq</userinput></screen>
-    </sect2>
-    <sect2 id="sect_3p_maassemble">
-      <title>Assemble</title>
-      <para>
-	Fire off MIRA with something like this:
-      </para>
-      <screen><userinput>mira --project=non_0157 --job=denovo,genome,accurate,454 >&log_assembly &</userinput></screen>
-      <para>
-	which generates - amongst others - result files like these:
-      </para>
-      <screen>-rw-rw-r-- 1 greg greg 1612330844 Aug 25 04:49 non_0157_out.caf
--rw-rw-r-- 1 greg greg   19702684 Aug 25 04:49 non_0157_out.wig
--rw-rw-r-- 1 greg greg   20298482 Aug 25 04:49 non_0157_out.unpadded.fasta.qual
--rw-rw-r-- 1 greg greg    6820644 Aug 25 04:49 non_0157_out.unpadded.fasta
--rw-rw-r-- 1 greg greg   20342658 Aug 25 04:49 non_0157_out.padded.fasta.qual
--rw-rw-r-- 1 greg greg    6841175 Aug 25 04:49 non_0157_out.padded.fasta
--rw-rw-r-- 1 greg greg  708184237 Aug 25 04:50 non_0157_out.ace</screen>
-      <para>
-	You'll be using the <filename>.ace</filename> file with BAMBUS.
-      </para>
-    </sect2>
-  </sect1>
-  <sect1 id="sect_3p_runbambus">
-    <title>Scaffolding MIRA results with BAMBUS</title>
-    <sect2 id="sect_3p_rbgenerateamoscontigs">
-      <title>Generate AMOS contigs</title>
-      <para>
-	Convert MIRA <filename>.ace</filename> file to contig file for BAMBUS
-	using AMOS’s ace2contig:
-      </para>
-      <screen><userinput>ace2contig -i non_0157_out.ace -o non_0157_out.contig</userinput></screen>
-      <para>
-	to produce contig file <filename>non_0157_out.contig</filename>
-      </para>
-    </sect2>
-    <sect2 id="sect_3p_rbsetupbambusconfig">
-      <title>Setup BAMBUS configuration file</title>
-      <para>
-	Read the BAMBUS <ulink
-	url="http://sourceforge.net/apps/mediawiki/amos/index.php?title=Bambus_Manual#The_configuration_file">configuration
-	file help</ulink>.
-      </para>
-      <note>
-	The mingroupsize switch/parameter doesn’t
-	appear to work. This switch is supposed to control the minimum size
-	scaffold the application returns. Currently, it returns all scaffolds
-	with lots of cruft. Bug report is in about this.
-      </note>
-      <para>
-	The configuration file is <filename>non_O157_out.conf</filename>, contents
-	below:
-      </para>
-      <screen># Priorities
-priority ALL 1
-
-# The following lines can be un-commented to specify certain
-# per-library settings
-
-# Redundancies
-# redundancy lib_some 1
-
-# allowed error
-# error MUMmer 0.5
-
-# min group size
-mingroupsize 50000
-
-# Global redundancy
-redundancy 2
-
-# overlaps allowed
-# overlaps MUMmer Y</screen>
-    </sect2>
-    <sect2 id="sect_3p_rbsetupmatesfile">
-      <title>Setup mates file</title>
-      <para>
-	Follow <ulink
-	url="http://sourceforge.net/apps/mediawiki/amos/index.php?title=Bambus_Manual#Mate-pair_Information">directions</ulink>
-	for generating mates file. Mates file is non_0157_out.mates (tab
-	delimited!), contents below
-      </para>
-      <screen>library twentyfiveKB    9000    40000   (.........).*
-pair    (.*)\.f$</screen>
-    </sect2>
-    <sect2 id="sect_3p_rbrunbambus">
-      <title>Run BAMBUS</title>
-<screen><userinput>goBambus -c non_0157_out.contig -m non_0157_out.mates -C non_O157_out.conf -o non_O157_bambus</userinput></screen>
-      <para>
-	Once this has completed, BAMBUS will have produce a bunch of files
-	looking similar to this:
-      </para>
-<screen>-rw-rw-r-- 1 greg greg  91717540 Aug 26 18:18 non_O157_bambus.detective.xml
--rw-rw-r-- 1 greg greg 103560781 Aug 26 18:19 non_O157_bambus.evidence.xml
--rw-rw-r-- 1 greg greg        19 Aug 26 18:19 non_O157_bambus.lib
--rw-rw-r-- 1 greg greg   4036295 Aug 26 18:19 non_O157_bambus.inp
--rw-rw-r-- 1 greg greg        47 Aug 26 18:19 non_O157_bambus.grommit.conf
--rw-rw-r-- 1 greg greg       315 Aug 26 18:19 non_O157_bambus.default.conf
--rw-rw-r-- 1 greg greg   3570691 Aug 26 18:20 non_O157_bambus.out.xml
--rw-rw-r-- 1 greg greg     79516 Aug 26 18:20 non_O157_bambus.sum
--rw-rw-r-- 1 greg greg       633 Aug 26 18:20 non_O157_bambus.stats
--rw-rw-r-- 1 greg greg    197215 Aug 26 18:20 non_O157_bambus.oo
--rw-rw-r-- 1 greg greg   1217009 Aug 26 18:20 non_O157_bambus.dot
--rw-rw-r-- 1 greg greg   4213072 Aug 26 18:20 non_O157_bambus.details
--rw-rw-r-- 1 greg greg      3221 Aug 26 18:20 goBambus.log</screen>
-      <para>
-	If you want a fasta file produced of the scaffolds, read <ulink
-	url="http://sourceforge.net/apps/mediawiki/amos/index.php?title=Bambus_Manual#Getting_more_.28or_less.29_information_from_the_output"/>. A
-	fasta file of the contig sequences (unpadded) generated by MIRA is
-	required. This file is <filename>non_0157_out.unpadded.fasta</filename>, and is used in the
-	command below:
-      </para>
-    <screen><userinput>printScaff
-  -e non_O157_bambus.evidence.xml
-  -s non_O157_bambus.out.xml
-  -l non_O157_bambus.lib
-  -f non_0157_out.unpadded.fasta
-  -merge -o non_O157_bambus_scaffold -page -dot</userinput></screen>
-      <para>
-	which gives you this
-      </para>
-      <screen>-rw-rw-r-- 1 greg greg       633 Aug 27 08:31 non_O157_bambus_scaffold.stats
--rw-rw-r-- 1 greg greg   6837159 Aug 27 08:31 non_O157_bambus_scaffold.fasta
--rw-rw-r-- 1 greg greg   1217042 Aug 27 08:31 non_O157_bambus_scaffold.dot</screen>
-      <para>
-	You can edit the fasta and dot files to keep the desired scaffolds and
-	get rid of the cruft. In this case, 1 giant 5.4 MB scaffold was
-	produced (this is what we want ) and hundreds sub-1 KB less desirable
-	shorter scaffolds of little interest. You can use GraphVis’s dot and
-	dotty to visualize the scaffolding dot plots.
-      </para>
-    </sect2>
-  </sect1>
-</chapter>
diff --git a/doc/docbook/attic/chap_454_part.xml b/doc/docbook/chap_454_part.xml
similarity index 72%
rename from doc/docbook/attic/chap_454_part.xml
rename to doc/docbook/chap_454_part.xml
index 3105505..a62aa69 100644
--- a/doc/docbook/attic/chap_454_part.xml
+++ b/doc/docbook/chap_454_part.xml
@@ -3,12 +3,15 @@
 <chapter id="chap_454">
   <chapterinfo>
     <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="versionfile"/>
+    <releaseinfo>
+      <emphasis role="light">Document revision	$Id$</emphasis>
+    </releaseinfo>
     <author>
       <firstname>Bastien</firstname>
       <surname>Chevreux</surname>
       <email>bach at chevreux.org</email>
     </author>
-    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="copyrightfile"/>
+    <copyright><year>2011</year><holder>Bastien Chevreux</holder></copyright>
   </chapterinfo>
   <blockquote>
     <attribution>Solomon Short</attribution>
@@ -16,16 +19,18 @@
       <emphasis><quote>Upset causes changes. Change causes upset.</quote></emphasis>
     </para>
   </blockquote>
+
   <title>Assembly of 454 data with MIRA3</title>
+
   <sect1 id="sect_454_introduction">
     <title>
       Introduction
     </title>
     <para>
-      MIRA can assemble 454 type data either on its own or together with any
-      other technology MIRA know to handle (Illumina, Sanger,
-      etc.). Paired-end sequences coming from genomic projects can also be
-      used if you take care to prepare your data the way MIRA needs it.
+      MIRA can assemble 454 type data either on its own or together with
+      Sanger or Solexa type sequencing data (true hybrid assembly). Paired-end
+      sequences coming from genomic projects can also be used if you
+      take care to prepare your data the way MIRA needs it.
     </para>
     <para>
       MIRA goes a long way to assemble sequence in the best possible way: it
@@ -33,13 +38,6 @@
       the previous passes. There are routines specialised in handling oddities
       that occur in different sequencing technologies
     </para>
-    <note>
-      <title>Tip</title> Use the MIRA version of
-      the <command>sff_extract</command> script which is provided as
-      download in the MIRA 3rd party software package. This script knows
-      about adaptor information and all the little important details when
-      extracting data from SFF into FASTQ (or FASTA) format.
-    </note>
     <sect2 id="sect_454_some_reading_requirements">
       <title>
 	Some reading requirements
@@ -104,29 +102,6 @@
 	depths of high throughput sequencing.
       </para>
     </sect2>
-    <sect2 id="sect_454_estimating_memory_needs">
-      <title>
-	Estimating memory needs
-      </title>
-      <para>
-	<emphasis>"Do I have enough memory?"</emphasis> has been one of the
-	most often asked question in former times. To answer this question,
-	please use miramem which will give you an estimate. Basically, you
-	just need to start the program and answer the questions, for more
-	information please refer to the corresponding section in the main MIRA
-	documentation.
-      </para>
-      <para>
-	Take this estimate with a grain of salt, depending on the sequences
-	properties, variations in the estimate can be +/- 30%.
-      </para>
-      <para>
-	Take these estimates even with a larger grain of salt for
-	eukaryotes. Some of them are incredibly repetitive and this leads
-	currently to the explosion of some secondary tables in MIRA. I'm
-	working on it.
-      </para>
-    </sect2>
   </sect1>
   <sect1 id="sect_454_caveats_when_using_454_data">
     <title>
@@ -165,6 +140,14 @@
 	project I have seen so far, both for public data (sequences available
 	at the NCBI trace archive) and non-public data.
       </para>
+      <note>
+	<title>Tip</title> 
+	Use the sff_extract script from Jose Blanca at the
+	University of Valencia. The home of sff_extract is:
+	<ulink url="http://bioinf.comav.upv.es/sff_extract/index.html"/> but I
+	am thankful to Jose for giving permission to distribute the script in
+	the MIRA 3rd party package (separate download).
+      </note>
     </sect2>
     <sect2 id="sect_454_screen_your_sequences!_optional_part_2">
       <title>
@@ -183,7 +166,8 @@
 	<title>Tip</title> Put your FASTAs through SSAHA2 or better, SMALT
 	with the sequence of your tags as masking target. MIRA can read the
 	SSAHA2 output (or SMALT when using "-f ssaha" output) and mask
-	internally using the MIRA <arg>-CL:msvs*</arg> parameters.
+	internally using the MIRA <arg>-CL:msvs</arg> parameter and the
+	options pertaining to it.
       </note>
     </sect2>
     <sect2 id="sect_454_to_right_clip_or_not_to_right_clip?">
@@ -226,10 +210,36 @@
       </para>
     </sect2>
   </sect1>
-  <sect1 id="sect_454_walkthrough_a_454_assembly_unpaired_reads">
+  <sect1 id="sect_454_a_454_assembly_walkthrough">
     <title>
-      Walkthrough: a 454 assembly with unpaired reads
+      A 454 assembly walkthrough
     </title>
+    <para>
+      <!--%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%-->
+    </para>
+    <sect2 id="sect_454_estimating_memory_needs">
+      <title>
+	Estimating memory needs
+      </title>
+      <para>
+	<emphasis>"Do I have enough memory?"</emphasis> has been one of the
+	most often asked question in former times. To answer this question,
+	please use miramem which will give you an estimate. Basically, you
+	just need to start the program and answer the questions, for more
+	information please refer to the corresponding section in the main MIRA
+	documentation.
+      </para>
+      <para>
+	Take this estimate with a grain of salt, depending on the sequences
+	properties, variations in the estimate can be +/- 30%.
+      </para>
+      <para>
+	Take these estimates even with a larger grain of salt for
+	eukaryotes. Some of them are incredibly repetitive and this leads
+	currently to the explosion of some secondary tables in MIRA. I'm
+	working on it.
+      </para>
+    </sect2>
     <sect2 id="sect_454_preparing_the_454_data_for_mira">
       <title>
 	Preparing the 454 data for MIRA
@@ -261,27 +271,66 @@
 -rw-rw-rw- 1 bach users 436489612 2007-09-21 08:39 EVX95GF02.sff
       </screen>
       <para>
+      </para>
+      <para>
 	As you can see, this sequencing project has 3 <filename>SFF</filename>
 	files.
       </para>
+    </sect2>
+    <sect2 id="sect_454_extracting_sequence_quality_and_clipping_info_from_sff">
+      <title>
+	Extracting sequence, quality and clipping info from SFF
+      </title>
+      <para>
+	The basic data type you will get from the 454 sequencing instruments
+	will be SFF files. Those files contain almost all information needed
+	for an assembly, but SFFs need to be converted into more standard
+	files before MIRA can use this information.
+      </para>
+      <para>
+	In former times this was done using 3 files (FASTA, FASTA quality and
+	XML), but nowadays the FASTQ format is used almost everywhere, so we
+	will need only two files: FASTQ for sequence + quality and XML for
+	clipping information.
+      </para>
+      <para>
+	We'll use the sff_extract script to do that. We'll name the output
+	files in a way that makes them immediately suitable for MIRA input.
+      </para>
+      <para>
+	<emphasis role="bold">Note 1:</emphasis> make sure you have Python installed on your system
+      </para>
       <para>
-	We'll use <command>sff_extract</command>:
+	<emphasis role="bold">Note 2:</emphasis> make sure you have the sff_extract script in your
+	path (or use absolute path names)
       </para>
       <screen>
-<prompt>arcadia:/path/to/myProject$</prompt> <userinput>sff_extract -o bchoc EV10YMP01.sff EV5RTWS01.sff EVX95GF02.sff</userinput></screen>
+<prompt>arcadia:/path/to/myProject$</prompt> <userinput>sff_extract
+  -Q
+  -s bchoc_in.454.fastq
+  -x bchoc_traceinfo_in.454.xml
+  EV10YMP01.sff EV5RTWS01.sff EVX95GF02.sff</userinput></screen>
       <note>
-	For more information on how to use <command>sff_extract</command>,
-	please refer to the chapter in the NCBI Trace and Short Read archive.
+	The above command has been split in multiple lines for better overview
+	but should be entered in one line.
       </note>
       <para>
+	The parameters to <command>sff_extract</command> tell it to extract to
+	FASTQ (via -Q), give the FASTQ file a name we chose (via -s), give the
+	XML file with clipping information a name we chose (via -x) and
+	convert the SFFs named <filename>EV10YMP01.sff</filename>,
+	<filename>EV5RTWS01.sff</filename> and
+	<filename>EVX95GF02.sff</filename>.
+      </para>
+      <para>
 	This can take some time, the 1.2 million FLX reads from this
 	example need approximately 9 minutes for conversion. Your directory
 	should now look something like this:
       </para>
       <screen>
 <prompt>arcadia:/path/to/myProject$</prompt> <userinput>ls -l</userinput>
--rw-r--r-- 1 bach users  231698898 2007-10-21 15:16 bchoc.fastq
--rw-r--r-- 1 bach users  193962260 2007-10-21 15:16 bchoc.xml
+-rw-r--r-- 1 bach users  231698898 2007-10-21 15:16 bchoc_in.454.fastq
+-rw-r--r-- 1 bach users  193962260 2007-10-21 15:16 bchoc_traceinfo_in.454.xml
 -rw-rw-rw- 1 bach users  475849664 2007-09-23 10:10 EV10YMP01.sff
 -rw-rw-rw- 1 bach users  452630172 2007-09-25 08:59 EV5RTWS01.sff
 -rw-rw-rw- 1 bach users  436489612 2007-09-21 08:39 EVX95GF02.sff</screen>
@@ -290,86 +339,52 @@
 	from this directory if you want.
       </para>
     </sect2>
-    <sect2 id="sect_454_writing_a_manifest">
-      <title>
-	Writing a manifest
-      </title>
-      <para>
-	The manifest is a configuration file for an assembly: it controls what
-	type of assembly you want to do and which data should go into the
-	assembly. For this first example, we just need a very simple manifest:
-      </para>
-      <screen>
-# A manifest file can contain comment lines, these start with the #-character
-
-# First part of a manifest: defining some basic things
-
-# In this example, we just give a name to the assembly
-#  and tell MIRA it should assemble a genome de-novo in accurate mode
-# As special parameter, we want to use 4 threads in parallel (where possible)
-
-<userinput>project = <replaceable>MyFirstAssembly</replaceable>
-job = <replaceable>genome,denovo,accurate</replaceable>
-parameters = <replaceable>-GE:not=4</replaceable></userinput>
-
-# The second part defines the sequencing data MIRA should load and assemble
-# The data is logically divided into "readgroups", for more information
-#  please consult the MIRA manual, chapter "Reference"
-
-<userinput>readgroup = <replaceable>SomeUnpaired454ReadsIGotFromTheLab</replaceable>
-technology = <replaceable>454</replaceable>
-data = <replaceable>bchoc.fastq</replaceable> <replaceable>bchoc.xml</replaceable></userinput></screen>
-    <para>
-      Save the above lines into a file, we'll use
-      <filename>bchoc_1st_manifest.conf</filename> in this example.
-    </para>
-      <screen>
-<prompt>arcadia:/path/to/myProject$</prompt> <userinput>ls -l</userinput>
--rw-r--r-- 1 bach users  231698898 2007-10-21 15:16 bchoc.fastq
--rw-r--r-- 1 bach users  193962260 2007-10-21 15:16 bchoc.xml
--rw-r--r-- 1 bach users        756 2011-11-05 17:57 bchoc_1st_manifest.conf</screen>
-    </sect2>
     <sect2 id="sect_454_starting_the_assembly">
       <title>
 	Starting the assembly
       </title>
       <para>
-	Starting the assembly is now just a matter of one line:
+	Starting the assembly is now just a matter of one line with some
+	parameters set correctly:
       </para>
       <screen>
-<prompt>arcadia:/path/to/myProject$</prompt> <userinput>mira <replaceable>bchoc_1st_manifest.conf >&log_assembly.txt</replaceable></userinput></screen>
+<prompt>arcadia:/path/to/myProject$</prompt> <userinput>mira 
+--project=bchoc 
+--job=denovo,genome,accurate,454
+>&log_assembly.txt </userinput></screen>
+      <note>
+	The above command has been split in multiple lines for better
+	overview but should be entered in one line.
+      </note>
       <para>
 	Now, that was easy, wasn't it? In the above example - for assemblies
 	having only 454 data and if you followed the walkthrough on how to
 	prepare the data - everything you might want to adapt in the first
-	time are the following line in the manifest file:
+	time are the following options:
       </para>
       <itemizedlist>
 	<listitem>
 	  <para>
-	    project= (for naming your assembly project)
+	    --project (for naming your assembly project)
 	  </para>
 	</listitem>
 	<listitem>
 	  <para>
-	    job= (perhaps to change the quality of the assembly to 'draft')
-	  </para>
-	</listitem>
-	<listitem>
-	  <para>
-	    parameters= -GE:not=xxx (perhaps to change the number of processors)
+	    --job (perhaps to change the quality of the assembly to 'draft'
 	  </para>
 	</listitem>
       </itemizedlist>
       <para>
+      </para>
+      <para>
 	Of course, you are free to change any option via the extended
 	parameters, but this is covered in the MIRA main reference manual.
       </para>
     </sect2>
   </sect1>
-  <sect1 id="sect_454_walkthrough_a_sanger_454_hybrid_assembly">
+  <sect1 id="sect_454_a_sanger___454_hybrid_assembly_walkthrough">
     <title>
-      Walkthrough: a paired-end Sanger / unpaired 454 hybrid assembly
+      A Sanger / 454 hybrid assembly walkthrough
     </title>
     <para>
       Preparing the data for a Sanger / 454 hybrid assembly takes some more steps
@@ -377,22 +392,23 @@ data = <replaceable>bchoc.fastq</replaceable> <replaceable>bchoc.xml</replaceabl
       assembly.
     </para>
     <para>
-      In the following sections, the files with 454 input data will have
-      <filename>.454.</filename> in the name, files with Sanger have
-      <filename>.sanger.</filename>. That's just a convention I use, you do
-      not need to do that, but it helps to keep things nicely organised.
+      In the following sections, the example project is
+      named <emphasis>bchoc_hyb</emphasis>, simply for us to remember that we
+      did a hybrid assembly there.
+    </para>
+    <para>
+      Files with 454 input data will have <filename>.454.</filename> in the
+      name, files with Sanger have <filename>.sanger.</filename>.
     </para>
     <sect2 id="sect_454_preparing_the_454_data">
       <title>
 	Preparing the 454 data
       </title>
       <para>
-	Please proceed exactly in the same way as described for the assembly
-	of unpaired 454-only data in the section above, that is, without
-	writing a manifest and starting the actual assembly. The only difference: in the <command>sff_extract</command> part, use "-o" with the parameter "bchoc.454" to get the files named accordingly.
+	Please proceed exactly in the same way as described for the assembly of
+	454-only data in the section above, that is, without starting the actual
+	assembly.
       </para>
-      <screen>
-<prompt>arcadia:/path/to/myProject$</prompt> <userinput>sff_extract -o bchoc.454 EV10YMP01.sff EV5RTWS01.sff EVX95GF02.sff</userinput></screen>
       <para>
 	In the end you should have two files (FASTQ and TRACEINFO) for the 454
 	data ready.
@@ -430,11 +446,14 @@ data = <replaceable>bchoc.fastq</replaceable> <replaceable>bchoc.xml</replaceabl
 	</listitem>
 	<listitem>
 	  <para>
-	    (secondary option) EXP files as the Staden pregap4 package writes.
+	    (secondary option, not recommended) EXP files as the Staden
+	    pregap4 package writes.
 	  </para>
 	</listitem>
       </orderedlist>
       <para>
+      </para>
+      <para>
 	Your sequencing provider MUST have performed at least a sequencing
 	vector clip on this data. A quality clip might also be good to do by
 	the provider as they usually know best what quality they can expect
@@ -445,7 +464,7 @@ data = <replaceable>bchoc.fastq</replaceable> <replaceable>bchoc.xml</replaceabl
 	all bases from the input (this is
 	called <emphasis>trimming</emphasis>), or you can keep the clipped
 	bases in the input file and provided clipping information in ancillary
-	data files. These clipping information then MUST be present in the
+	data files.  These clipping information then MUST be present in the
 	ancillary data (either the TRACEINFO XML, or in the combined CAF, or
 	in the EXP files), together with other standard data like, e.g.,
 	mate-pair information when using a paired-ends approach.
@@ -460,76 +479,43 @@ data = <replaceable>bchoc.fastq</replaceable> <replaceable>bchoc.xml</replaceabl
       </para>
       <para>
 	Here's how the directory with the preprocessed data should now look
-	approximately like:
+	like (note that we changed the <emphasis>bchoc</emphasis> mnemonic
+	to <emphasis>bchoc_hyb</emphasis> just for fun ... and to make a
+	distinction to the 454 only assembly above):
       </para>
       <screen>
 <prompt>arcadia:/path/to/myProject$</prompt> <userinput>ls -l</userinput>
--rwxrwxrwx 1 bach  2007-10-13 22:44 bchoc.454.fastq
--rwxrwxrwx 1 bach  2007-10-13 22:44 bchoc.454.xml
+-rwxrwxrwx 1 bach  2007-10-13 22:44 bchoc_hyb_in.454.fastq
+-rwxrwxrwx 1 bach  2007-10-13 22:44 bchoc_hyb_traceinfo_in.454.xml 
 
--rwxrwxrwx 1 bach  2007-10-13 22:44 bchoc.sanger.fastq
--rwxrwxrwx 1 bach  2007-10-13 22:44 bchoc.sanger.xml</screen>
-    </sect2>
-    <sect2 id="sect_454_manifest_for_hybrid_assembly">
-      <title>
-	Writing a manifest
-      </title>
-      <para>
-	This assembly contains unpaired 454 data and paired-end Sanger
-	data. Let's assume the 454 data to be exactly the same as for the
-	previous walkthrough. For the Sanger data, let's assume the template
-	DNA size for the Sanger library to be between 2500 and 3500 bases and
-	the read naming to follow the TIGR naming scheme:
-      </para>
-      <screen>
-# A manifest file can contain comment lines, these start with the #-character
-
-# First part of a manifest: defining some basic things
-
-# In this example, we just give a name to the assembly
-#  and tell MIRA it should assemble a genome de-novo in accurate mode
-# As special parameter, we want to use 4 threads in parallel (where possible)
-
-<userinput>project = <replaceable>MyFirstHybridAssembly</replaceable>
-job = <replaceable>genome,denovo,accurate</replaceable>
-parameters = <replaceable>-GE:not=4</replaceable></userinput>
-
-# The second part defines the sequencing data MIRA should load and assemble
-# The data is logically divided into "readgroups", for more information
-#  please consult the MIRA manual, chapter "Reference"
-
-<userinput>readgroup = <replaceable>SomeUnpaired454ReadsIGotFromTheLab</replaceable>
-technology = <replaceable>454</replaceable>
-data = <replaceable>bchoc.454.*</replaceable></userinput>
-
-# Note the wildcard "bchoc.454.*" in the data line above: this
-#  will load both the FASTQ and XML data
-
-<userinput>readgroup = <replaceable>SomePairedSangerReadsIGotFromTheLab</replaceable>
-technology = <replaceable>sanger</replaceable>
-template_size = <replaceable>2500 3500</replaceable>
-segment_placement = <replaceable>---> <---</replaceable>
-segment_naming = <replaceable>TIGR</replaceable>
-data = <replaceable>bchoc.sanger.*</replaceable></userinput></screen>
-    <para>
-      If you compare the manifest above with the manifest in the walkthrough
-      for using only unpaired 454 data, you will see that large parts, i.e.,
-      the definition of the job, parameter and the 454 read group is
-      <emphasis>exactly</emphasis> the same. The only differences are in the
-      naming of the assembly project (in <literal>project =</literal>), and
-      the definition of a second readgroup containing the Sanger sequencing
-      data.
-    </para>
+-rwxrwxrwx 1 bach  2007-10-13 22:44 bchoc_hyb_in.sanger.fasta
+-rwxrwxrwx 1 bach  2007-10-13 22:44 bchoc_hyb_in.sanger.fasta.qual 
+-rwxrwxrwx 1 bach  2007-10-13 22:44 bchoc_hyb_traceinfo_in.sanger.xml</screen>
     </sect2>
     <sect2 id="sect_454_starting_the_hybrid_assembly">
       <title>
 	Starting the hybrid assembly
       </title>
       <para>
-	Quite unsurprisingly, the command to start the assembly is exactly the same as always:
+	The following command line starts a basic, but normally quite
+	respectable hybrid 454 and Sanger assembly of a genome where the 454
+	data has FASTQ + XML TRACEINFO and the Sanger data has FASTA, FASTA
+	quality + XML traceinfo is input type:
       </para>
       <screen>
-<prompt>arcadia:/path/to/myProject$</prompt> <userinput>mira <replaceable>myassebly_manifest.conf</replaceable> >&log_assembly.txt</userinput></screen>
+<prompt>arcadia:/path/to/myProject$</prompt> <userinput>mira 
+  --project=bchoc_hyb 
+  --job=denovo,genome,accurate,sanger,454
+  SANGER_SETTINGS -LR:ft=fasta:mxti=yes
+  >& log_assembly.txt</userinput></screen>
+      <para>
+      </para>
+      <para>
+	The only change to starting an assembly with only 454 data was adding
+	"sanger" to the "-job=" command and telling MIRA that the Sanger data
+	needs to be loaded from FASTA (+ quality) and merge ancillary
+	information form the TRACEINFO file.
+      </para>
     </sect2>
   </sect1>
   <sect1 id="sect_454_walkthrough:_combined_unpaired_and_pairedend_assembly_of_brucella_ceti">
@@ -828,6 +814,115 @@ Converted 311201 reads into 311201 sequences.
 	  clips.
 	</para>
       </sect3>
+      <sect3 id="sect_454_extracting_pairedend_data_from_sff">
+	<title>
+	  Extracting paired-end data from SFF
+	</title>
+	<para>
+	</para>
+	<para>
+	  Let's move on to the paired-end data. While I would recommend that,
+	  when working on your own data, you should do some kind of data
+	  checking, I'll spare you that step for this walkthrough, just
+	  believe me that I did it and I found nothing really too suspicious.
+	</para>
+	<para>
+	  The paired-end protocol of 454 will generate reads which contain the
+	  forward and reverse direction in one read, separated by a
+	  linker. You have to know the linker sequence! Ask your sequencing
+	  provider to give it to you. If standard protocols were used, then
+	  the linker sequence for GS20 and FLX will be
+	</para>
+	<screen>
+>flxlinker
+GTTGGAACCGAAAGGGTTTGAATTCAAACCCTTTCGGTTCCAAC</screen>
+	<para>
+	  while for Titanium data, you need to use two linker sequences
+	</para>
+	<screen>
+>titlinker1
+TCGTATAACTTCGTATAATGTATGCTATACGAAGTTATTACG
+>titlinker2
+CGTAATAACTTCGTATAGCATACATTATACGAAGTTATACGA</screen>
+	<para>
+	  In this case, the center apparently used the standard unmodified 454
+	  FLX linker.  Put that linker sequence into a FASTA file and copy to
+	  wherever you like ...  in this walkthrough I put it into
+	  the <filename>origdata</filename> directory (not the
+	  <filename>data</filename> directory where we currently are.
+	</para>
+	<screen>
+<prompt>arcadia:bceti_assembly/data$</prompt> <userinput>cp /from/whereever/your/file/is/linker.fasta ../origdata</userinput>
+<prompt>arcadia:bceti_assembly/data$</prompt> <userinput>ls -l ../origdata</userinput>
+-rw-r--r-- 1 bach users        53 2008-11-08 17:32 linker.fasta
+-rw-r--r-- 1 bach users 544623256 2008-11-08 16:49 SRR005481.sff
+-rw-r--r-- 1 bach users 476632488 2008-11-08 16:55 SRR005482.sff
+<prompt>arcadia:bceti_assembly/data$</prompt> <userinput>cat ../origdata/linker.fasta</userinput>
+>flxlinker
+GTTGGAACCGAAAGGGTTTGAATTCAAACCCTTTCGGTTCCAAC</screen>
+	<para>
+	  There's one thing that must be found out yet: what was the size of
+	  the paired-end library which was constructed, and what is the
+	  estimated standard deviation of the sizes? Normally, you will get
+	  this information from your sequence provider (if you didn't decide
+	  it for yourself). As we're working from a data set deposited at the
+	  NCBI, this information should also be available in the accompanying
+	  documentation there. But it isn't.
+	</para>
+	<para>
+	  For this walkthrough, we'll simply take a library size of 4500 and an
+	  estimated standard deviation of 900.
+	</para>
+	<para>
+	  Now let's extract the paired end sequences, and this may take eight
+	  to ten minutes.
+	</para>
+	<screen>
+<prompt>arcadia:bceti_assembly/data$</prompt> <userinput>sff_extract -o bceti 
+  -a -l ../origdata/linker.fasta 
+  -i "insert_size:3000,insert_stdev:900" 
+  ../origdata/SRR005482.sff</userinput>
+
+Testing whether SSAHA2 is installed and can be launched ...  ok.
+Working on '../origdata/SRR005482.sff':
+Creating temporary file from sequences in '../origdata/SRR005482.sff' ... done.
+Searching linker sequences with SSAHA2 (this may take a while) ...  ok.
+Parsing SSAHA2 result file ...  done.
+Converting '../origdata/SRR005482.sff' ...  done.
+Converted 268084 reads into 415327 sequences.</screen>
+	<para>
+	  The above text tells you that the conversion process saw 268084
+	  reads in the SFF. Searching for the paired-end linker and removing
+	  it, 415327 sequences were created. Obviously, some sequences had
+	  either no linker or the linker was on the far edges of the read so
+	  that the 'split' resulted into just one sequences.
+	</para>
+	<para>
+	  The directory will now look like this:
+	</para>
+	<screen>
+<prompt>arcadia:bceti_assembly/data$</prompt> <userinput>ls -l</userinput>
+-rw-r--r-- 1 bach users 170346423 2008-11-08 17:55 bceti.fasta
+-rw-r--r-- 1 bach users 483048864 2008-11-08 17:55 bceti.fasta.qual
+-rw-r--r-- 1 bach users 165413112 2008-11-08 17:55 bceti.xml</screen>
+	<para>
+	  We're almost done. As last step, we will rename the files into a
+	  scheme that suits MIRA (we could have used the -s, -q and -x options
+	  of sff_extract directly, but I wanted to keep the example
+	  straightforward.
+	</para>
+	<screen>
+<prompt>arcadia:bceti_assembly/data$</prompt> <userinput>mv bceti.fasta bceti_in.454.fasta</userinput>
+<prompt>arcadia:bceti_assembly/data$</prompt> <userinput>mv bceti.fasta.qual bceti_in.454.fasta.qual</userinput>
+<prompt>arcadia:bceti_assembly/data$</prompt> <userinput>mv bceti.xml bceti_traceinfo_in.454.xml</userinput>
+<prompt>arcadia:bceti_assembly/data$</prompt> <userinput>ls -l</userinput>
+-rw-r--r-- 1 bach users 170346423 2008-11-08 17:55 bceti_in.454.fasta
+-rw-r--r-- 1 bach users 483048864 2008-11-08 17:55 bceti_in.454.fasta.qual
+-rw-r--r-- 1 bach users 165413112 2008-11-08 17:55 bceti_traceinfo_in.454.xml</screen>
+	<para>
+	  That's it.
+	</para>
+      </sect3>
     </sect2>
     <sect2 id="sect_454_preparing_an_assembly">
       <title>
@@ -843,9 +938,9 @@ Converted 311201 reads into 311201 sequences.
 <prompt>arcadia:bceti_assembly/assemblies$</prompt> <userinput>cd arun_08112008</userinput>
 <prompt>arcadia:assemblies/arun_08112008$</prompt> <userinput>ln -s ../../data/* .</userinput>
 <prompt>arcadia:bceti_assembly/assemblies/arun_08112008$</prompt> <userinput>ls -l</userinput>
-lrwxrwxrwx 1 bach users 29 2008-11-08 18:17 bceti.454.fasta -> ../../data/bceti.454.fasta
-lrwxrwxrwx 1 bach users 34 2008-11-08 18:17 bceti.454.fasta.qual -> ../../data/bceti.454.fasta.qual
-lrwxrwxrwx 1 bach users 33 2008-11-08 18:17 bceti.454.xml -> ../../data/bceti.454.xml</screen>
+lrwxrwxrwx 1 bach users 29 2008-11-08 18:17 bceti_in.454.fasta -> ../../data/bceti_in.454.fasta
+lrwxrwxrwx 1 bach users 34 2008-11-08 18:17 bceti_in.454.fasta.qual -> ../../data/bceti_in.454.fasta.qual
+lrwxrwxrwx 1 bach users 33 2008-11-08 18:17 bceti_traceinfo_in.454.xml -> ../../data/bceti_traceinfo_in.454.xml</screen>
     </sect2>
     <sect2 id="sect_454_starting_the_assembly_2">
       <title>
@@ -855,7 +950,7 @@ lrwxrwxrwx 1 bach users 33 2008-11-08 18:17 bceti.454.xml -> ../../data/bceti
 	Start an assembly with the options you like, for example like this:
       </para>
       <screen>
-<prompt>$</prompt> <userinput>NONONONONONONO   ---- MAKE IT WITH MANIFEST !!!!mira --project=bceti --job=denovo,genome,accurate,454 >&log_assembly</userinput></screen>
+<prompt>$</prompt> <userinput>mira --project=bceti --job=denovo,genome,accurate,454 >&log_assembly</userinput></screen>
     </sect2>
   </sect1>
   <sect1 id="sect_454_what_to_do_with_the_mira_result_files?">
@@ -886,7 +981,7 @@ lrwxrwxrwx 1 bach users 33 2008-11-08 18:17 bceti.454.xml -> ../../data/bceti
       If you used the uniform read distribution option, you will inevitably
       need to filter your results as this option produces larger and better
       alignments, but also more ``debris contigs''. For this, use the
-      miraconvert which is distributed together with the MIRA package.
+      convert_project which is distributed together with the MIRA package.
     </para>
     <para>
       Also very important when analysing 454 assemblies: screen the small
diff --git a/doc/docbook/chap_bitsandpieces_part.xml b/doc/docbook/chap_bitsandpieces_part.xml
deleted file mode 100644
index e7f1035..0000000
--- a/doc/docbook/chap_bitsandpieces_part.xml
+++ /dev/null
@@ -1,83 +0,0 @@
-<?xml version="1.0" ?>
-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.docbook.org/xml/4.5/docbookx.dtd">
-<chapter id="chap_bitsandpieces">
-  <chapterinfo>
-    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="versionfile"/>
-    <author>
-      <firstname>Bastien</firstname>
-      <surname>Chevreux</surname>
-      <email>bach at chevreux.org</email>
-    </author>
-    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="copyrightfile"/>
-  </chapterinfo>
-  <blockquote>
-    <attribution>Solomon Short</attribution>
-    <para>
-      <emphasis><quote>Just when you think it's finally settled, it isn't.
-      </quote></emphasis>
-    </para>
-  </blockquote>
-
-  <title>Bits and pieces</title>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="warning_frontofchapter.xml"/>
-  <sect1 id="sect_bap_using_ssaha2_smalt_to_screen_for_vector_sequence">
-    <title>
-      Using SSAHA2 / SMALT to screen for vector sequence
-    </title>
-    <para>
-      If your sequencing provider gave you data which was NOT pre-clipped for
-      vector sequence, you can do this yourself in a pretty robust manner
-      using SSAHA2 -- or the successor, SMALT -- from the Sanger Centre. You
-      just need to know which sequencing vector the provider used and have its
-      sequence in FASTA format (ask your provider).
-    </para>
-    <note>
-      This screening is a valid method for any type of Sanger sequencing
-      vectors, 454 adaptors, Illumina adaptors and paired-end adaptors
-      etc. However, you probably want to use it only for Sanger type data as
-      MIRA already knows all standard 454, Ion Torrent and Illumina adaptors.
-    </note>
-    <note>
-      SSAHA2 and SMALT need their input data to be in FASTA format, so for
-      these to run you will need them also in FASTA format. For MIRA however
-      you can load your original data in whatever format it was present.
-    </note>
-    <para>
-      For SSAHA2 follow these steps (most are the same as in the example
-      above):
-    </para>
-    <screen>
-<prompt>$</prompt> <userinput>ssaha2 -output ssaha2
-  -kmer 8 -skip 1 -seeds 1 -score 12 -cmatch 9 -ckmer 6
-  /path/where/the/vector/data/resides/vector.fasta
-  <replaceable>yourinputsequences.fasta</replaceable> > <replaceable>screendataforyoursequences.ssaha2</replaceable></userinput></screen>
-    <para>
-      Then, in your manifest file, add the following line in the readgroup
-      which contains the sequences you screened:
-    </para>
-<screen>
-<userinput>readgroup
-...
-data = <replaceable>yourinputsequences_inwhateverformat_thisexamplehasfastq.fastq</replaceable>
-data = <replaceable>screendataforyoursequences.ssaha2</replaceable>
-...</userinput></screen>
-    <para>
-      For SMALT, the only difference is that you use SMALT for generating the
-      vector-screen file and ask SMALT to generate it in SSAHA2 format. As
-      SMALT works in two steps (indexing and then mapping), you also need to
-      perform it in two steps and then call MIRA. E.g.:
-    </para>
-    <screen>
-<prompt>$</prompt> <userinput>smalt index -k 7 -s 1 smaltidxdb /path/where/the/vector/data/resides/vector.fasta</userinput>
-<prompt>$</prompt> <userinput>smalt map -f ssaha -d -1 -m 7 smaltidxdb <replaceable>yourinputsequences.fasta</replaceable> > <replaceable>screendataforyoursequences.smalt</replaceable></userinput></screen>
-    <note>
-      Please note that, due to subtle differences between output of SSAHA2 (in
-      ssaha2 format) and SMALT (in ssaha2 format), MIRA identifies the source
-      of the screening (and the parsing method it needs) by the name of the
-      screen file. Therefore, screens done with SSAHA2 need to have the
-      postfix <filename>.ssaha2</filename> in the file name and screens done
-      with SMALT need
-      <filename>*.smalt</filename>.
-    </note>
-  </sect1>
-</chapter>
diff --git a/doc/docbook/chap_bonus_part.xml b/doc/docbook/chap_bonus_part.xml
index fec0898..0fad82a 100644
--- a/doc/docbook/chap_bonus_part.xml
+++ b/doc/docbook/chap_bonus_part.xml
@@ -3,12 +3,15 @@
 <chapter id="chap_bonus">
   <chapterinfo>
     <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="versionfile"/>
+    <releaseinfo>
+      <emphasis role="light">Document revision	$Id$</emphasis>
+    </releaseinfo>
     <author>
       <firstname>Bastien</firstname>
       <surname>Chevreux</surname>
       <email>bach at chevreux.org</email>
     </author>
-    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="copyrightfile"/>
+    <copyright><year>2011</year><holder>Bastien Chevreux</holder></copyright>
   </chapterinfo>
 
   <blockquote>
diff --git a/doc/docbook/chap_bonus_part.xml b/doc/docbook/chap_bonus_part.xml~
similarity index 54%
copy from doc/docbook/chap_bonus_part.xml
copy to doc/docbook/chap_bonus_part.xml~
index fec0898..7bf56b2 100644
--- a/doc/docbook/chap_bonus_part.xml
+++ b/doc/docbook/chap_bonus_part.xml~
@@ -3,23 +3,16 @@
 <chapter id="chap_bonus">
   <chapterinfo>
     <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="versionfile"/>
+    <releaseinfo>
+      <emphasis role="light">Document revision	$Id$</emphasis>
+    </releaseinfo>
     <author>
       <firstname>Bastien</firstname>
       <surname>Chevreux</surname>
       <email>bach at chevreux.org</email>
     </author>
-    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="copyrightfile"/>
+    <copyright><year>2011</year><holder>Bastien Chevreux</holder></copyright>
   </chapterinfo>
-
-  <blockquote>
-    <attribution>Solomon Short</attribution>
-    <para>
-      <emphasis><quote>I'm all in favour of keeping dangerous weapons out of the hand of fools. Let's
-      start with typewriters.</quote></emphasis>
-    </para>
-  </blockquote>
-
-
   <title>Bonus material</title>
   <subtitle>The ups and downs of writing an Open Source sequence assembler</subtitle>
 
@@ -29,22 +22,18 @@
     </title>
     <sidebar>
       <para>
-	My warmest thanks to Bob Bruccoleri, Lionel Guy, Arun Rawat, Nestor
-	Zaburannyi and numerous other people - who either declined being
-	thanked publicly or could not respond before I wrote this (you still
-	can, just drop me a mail) - who all donated time and computing power
-	to hunt down a "bug" (see <ulink
-	url="http://www.freelists.org/post/mira_talk/Call-for-help-bughunting"/>)
-	which, in the end, turned out to be a RAM defect on my development
+	My warmest thanks to the numerous people who all donated time and
+	computing power to hunt down a "bug" (see
+	http://www.freelists.org/post/mira_talk/Call-for-help-bughunting)
+	which. in the end, turned out to be a RAM defect on my development
 	machine.
       </para>
       <para>
-	Because I haven't much apart some words to thank them, and because I
-	felt like it ... this is the story on how the problem got nailed. It
-	involves lots of hot electrons, a lot less electrons without spin
-	which keel over, the end of a hunt for invisibugs of the imaginary
-	sort, 454, mutants (but no zombies), Illumina, some spider monkeys,
-	PacBio, a chat with Sherlock and, of course, an anthropomorphed star.
+	This is the story on how the problem got nailed. It involves lots of hot
+	electrons, a lot less electrons without spin which keel over, the end of
+	a hunt for invisibugs of the imaginary sort, 454, mutants (but no
+	zombies), Illumina, some spider monkeys, PacBio, a chat with Sherlock
+	and, of course, an anthropomorphed star.
       </para>
       <para>
 	In short: don't read if you've got more interesting things to do on a
@@ -52,9 +41,6 @@
       </para>
     </sidebar>
     <para>
-      ...
-    </para>
-    <para>
       Life's a rollercoaster and there are days - or weeks - where moral is on
       a pretty hefty ride: ups and downs in fast succession ... and the
       occasional looping here and there.
@@ -63,7 +49,7 @@
       Today was a day where I had - the first time ever - ups and downs
       occuring absolutely simultaneously. Something which is physically
       impossible, I know, but don't tell any physicist or astronomist about
-      that or else they'll embark you on a lengthy discussion on how
+      that or else they'll embark you in a lengthy discussion on how
       isochronicity is a myth by telling you stories on lightning, thunder and
       two poor sobs at the ends of a 300,000 km long train. But I digress ...
     </para>
@@ -91,9 +77,9 @@
     <para>
       As a side note: she then just gave me back <emphasis>that
       look</emphasis>, you know, the one with those big open eyes almost
-      hidden behind by long, dark lashes ... and slightly flushed cheeks
-      accompanied by pointed lips. As if she wanted to say <emphasis><quote>I
-      *am* innocent and *I* did no nothing wrong, you
+      behind by long, dark lashes ... and slightly flushed cheeks accompanied
+      by pointed lips. As if she wanted to say <emphasis><quote>I *am*
+      innocent and *I* did no nothing wrong, you
       disbeliever!</quote></emphasis> (<ulink
       url="http://24.media.tumblr.com/tumblr_lj3efmmDL01qasfhmo1_400.png"/>). This
       usually announces a major pouting round of hers, something which I'm not
@@ -118,12 +104,11 @@
       *hackedyhack* 
     </para>
     <para>
-      <emphasis><quote>Base position 239, 240 ... now: <literal>C G G G T C F
-      A A</literal> ... wait! What? 'F' ... <emphasis>'F'</emphasis>?!? That's
-      not even an IUPAC code. What's a frakking 'F' doing in the FASTQ input
-      file?!</quote></emphasis> (see <ulink
-      url="http://www.youtube.com/watch?v=r7KcpgQKo2I"/>, conditionally safe
-      for work).
+      <emphasis><quote>Base position 239, 240 ... now: <literal>C G G G T C F A A</literal>
+      ... wait! What? 'F' ... 'F'?!? It's not even an IUPAC code. What's a
+      frakking 'F' doing in the FASTQ input file?!</quote></emphasis> (see
+      <ulink url="http://www.youtube.com/watch?v=r7KcpgQKo2I"/>, conditionally
+      safe for work).
     </para>
     <para>
       Indeed, 'F' is not IUPAC. Even more mysterious to me was the fact that
@@ -150,9 +135,8 @@
     <para>
       First thing to check: the log files of the successful runs the previous
       night. MIRA's very chatty at times and tidying up after her has always
-      been a chore (there, I'm feeling <emphasis>that look</emphasis> again in
-      my back), but now was one of those occasions where not gagging her paid
-      out as poking around the files she left behind proved to be
+      been a chore, but now was one of those occasions where not gagging her
+      paid out as poking around the files she left behind proved to be
       interesting. Read 317301 showed the following at the position in doubt:
       "C G G G T C ___G___ A A" Without question: a 'G', and no 'F' in sight!
     </para>
@@ -245,129 +229,71 @@
       the truth.
     </para>
     <para>
-      Suspects:
-    </para>
-    <itemizedlist>
-      <listitem>
-	the problem is caused either by MIRA or one of the components of the
-	comeputer: CPU, disk, disk/dma controller, RAM.
-      </listitem>
-    </itemizedlist>
-    <para>
-      Facts:
-    </para>
-    <itemizedlist>
-      <listitem>
-	an artefact was very sporadically observed during MIRA runs where sequences
-	(containing lot's of 'A') suddenly contained at least one '@'. This occured
-	after several passes, i.e., not on loading.
-      </listitem>
-      <listitem>
-	an artefact was observed in the Linux filesystem where a 'G' mutated
-	suddenly and overnight to a 'F'.
-      </listitem>
-      <listitem>
-	both artefacts are based on one bit flipping, perhaps even to the same
-	direction all the time.
-      </listitem>
-      <listitem>
-	when loading data, MIRA does not use mmap() to mirror data from disk, but
-	physically creates a copy of that data.
-      </listitem>
-      <listitem>
-	MIRA loaded the data twice flawlessly before the artefact in the filesystem
-	occured.
-      </listitem>
-    </itemizedlist>
-    <para>
-      Deduction 1:
-    </para>
-    <itemizedlist>
-      <listitem>
-	MIRA is innocent. The artefact in the filesystem happened outside of the
-	address space of MIRA and therefore outside her control. MIRA cannot be
-	responsible as the Linux kernel would have prevented her from writing to
-	some memory she was not allowed to.
-      </listitem>
-    </itemizedlist>
-    <para>
-      Further facts:
-    </para>
-    <itemizedlist>
-      <listitem>
-	the system MIRA ran on had 24 GiB RAM
-      </listitem>
-      <listitem>
-	even with a KDE desktop, KMail, Firefox, Emacs and a bunch of terminals
-	open, there is still a lot of free RAM (some 22 to 23 GiB).
-      </listitem>
-      <listitem>
-	Linux uses free RAM to cache files
-      </listitem>
-    </itemizedlist>
-    <para>
-      Deduction 2:
-    </para>
-    <itemizedlist>
-      <listitem>
-	when loading the small FASTQ input file in the morning, Linux put it into
-	the file cache in RAM. As MIRA almost immediately stopped without taking
-	much memory, the file stayed in cache.
-      </listitem>
-    </itemizedlist>
-    <para>
-      Further facts:
-    </para>
-    <itemizedlist>
-      <listitem>
-	the drive with the FASTQ file is run in udma6 mode. That is, when loading
-	data the controller moves the data directly from disk to RAM without going
-	via the processor
-      </listitem>
-      <listitem>
-	subsequent "loading" of the same FASTQ into MIRA or text viewer like 'less'
-	showed the 'F' character always appearing at the same place.
-      </listitem>
-    </itemizedlist>
-    <para>
-      Deduction 3:
-    </para>
-    <itemizedlist>
-      <listitem>
-	the CPU is innocent! It did not touch the data while it was transferred from
-	disk to RAM and it afterwards shows always the same data.
-      </listitem>
-      <listitem>
-	the disk controllers and UDMA controller are innocent! Some of the glitches observed in
-	previous weeks occured during runs of MIRA, inside the MIRA address space,
-	long after initial loading, when UDMA had already finished their job.
-      </listitem>
-    </itemizedlist>
-    <para>
-      From deductions 1, 2 & 3 follows:
-    </para>
-    <itemizedlist>
-      <listitem>
-	it's not MIRA, not the CPU, nor the disk & UDMA controller
-      </listitem>
-    </itemizedlist>
-    <para>
-      Suspects left:
-    </para>
-    <itemizedlist>
-      <listitem>
-	RAM
-      </listitem>
-      <listitem>
-	Disk
-      </listitem>
-    </itemizedlist>
-    <para>
-      Well, that can be easily tested: shut down the computer, restart it and
-      subsequently look at the file again. No file cache in RAM can survive
-      that procedure. Yes, I know, there are some magic incantations one can
-      chant to force Linux to flush all buffers and clear all caches, but in
-      that situation I was somehow feeling conservative.
+Suspects:
+- the problem is caused either by MIRA or one of the components of the
+  comeputer: CPU, disk, disk/dma controller, RAM.
+    </para>
+    <para>
+Facts:
+- an artefact was very sporadically observed during MIRA runs where sequences
+  (containing lot's of 'A') suddenly contained at least one '@'. This occured
+  after several passes, i.e., not on loading.
+- an artefact was observed in the Linux filesystem where a 'G' mutated
+  suddenly and overnight to a 'F'.
+- both artefacts are based on one bit flipping, perhaps even to the same
+  direction all the time.
+- when loading data, MIRA does not use mmap() to mirror data from disk, but
+  physically creates a copy of that data.
+- MIRA loaded the data twice flawlessly before the artefact in the filesystem
+  occured.
+    </para>
+    <para>
+Deduction 1:
+- MIRA is innocent. The artefact in the filesystem happened outside of the
+  address space of MIRA and therefore outside her control. MIRA cannot be
+  responsible as the Linux kernel would have prevented her from writing to
+  some memory she was not allowed to.
+    </para>
+    <para>
+Further facts:
+- the system MIRA ran on had 24 GiB RAM
+- even with a KDE desktop, KMail, Firefox, Emacs and a bunch of terminals
+  open, there is still a lot of free RAM (some 22 to 23).
+- Linux uses free RAM to cache files
+    </para>
+    <para>
+Deduction 2:
+- when loading the small FASTQ input file in the morning, Linux put it into
+  the file cache in RAM. As MIRA almost immediately stopped without taking
+  much memory, the file stayed in cache.
+    </para>
+    <para>
+Further facts:
+- the drive with the FASTQ file is run in udma6 mode. That is, when loading
+  data the controller moves the data directly from disk to RAM without going
+  via the processor
+- subsequent "loading" of the same FASTQ into MIRA or text viewer like 'less'
+  showed the 'F' character always appearing at the same place.
+    </para>
+    <para>
+Deduction 3:
+- the CPU is innocent! It did not touch the data while it was transferred from
+  disk to RAM and it afterwards shows always the same data.
+- the disk and UDMA controllers are innocent! Some of the glitches observed in
+  previous weeks occured during runs of MIRA, inside the MIRA address space,
+  long after initial loading, when UDMA had already finished their job.
+    </para>
+    <para>
+From deductions 1, 2 & 3 follows:
+- it's not MIRA, not the CPU, nor the disk & UDMA controller
+    </para>
+    <para>
+Suspects left:
+- RAM
+- Disk
+    </para>
+    <para>
+      Well, that can be easily tested: shut down the computer, restart it and subsequently look at the file again. No file cache in RAM can survive that procedure. Yes, I know, there are some magic incantations one can chant to force Linux to flush all buffers and clear all caches, but in that situation I was somehow feeling conservative.
     </para>
     <para>
       Lo and behold, after the above procedure the FASTQ file showed an all
@@ -375,105 +301,49 @@
       anywhere.
     </para>
     <para>
-      Deduction 4:
-    </para>
-    <itemizedlist>
-      <listitem>
-	the disk is innocent.
-      </listitem>
-    </itemizedlist>
-    <para>
-      Deduction 5:
-    </para>
-    <itemizedlist>
-      <listitem>
-	as all other components have been ruled out, the RAM is faulty.
-      </listitem>
-    </itemizedlist>
-    <para>
-      As I wrote: life's a rollercoaster.
-    </para>
-    <variablelist>
-      <varlistentry>
-	<term>
-	  Up:
-	</term>
-	<listitem>
-	  MIRA is innocent! There, she's giving me "that look" again and one would
-	  have to be blind to oversee the "told you so" she's sending over with
-	  it.
-	</listitem>
-      </varlistentry>
-      <varlistentry>
-	<term>
-	  Down:
-	</term>
-	<listitem>
-	  My RAM's broken and I need to replace it. Bought it only last March,
-	  should still be under guarantee, but still ... time and effort.
-	</listitem>
-      </varlistentry>
-      <varlistentry>
-	<term>
-	  Up:
-	</term>
-	<listitem>
-	  I did not sell my old RAMs, so I can continue to work
-	</listitem>
-      </varlistentry>
-      <varlistentry>
-	<term>
-	  Down:
-	</term>
-	<listitem>
-	  12 GiB feels soooooo tight after having had 24.
-	</listitem>
-      </varlistentry>
-      <varlistentry>
-	<term>
-	  Up:
-	</term>
-	<listitem>
-	  I can wrap up 3.4.0 end of this week with good conscience!
-	</listitem>
-      </varlistentry>
-      <varlistentry>
-	<term>
-	  Down:
-	</term>
-	<listitem>
-	  How the hell am I gonna tie all loose bits and pieces in the
-	  documentation in the next 24 to 48 hours?
-	</listitem>
-      </varlistentry>
-      <varlistentry>
-	<term>
-	  Looping:
-	</term>
-	<listitem>
-	  later that morning MIRA again helped me at work to locate in a
-	  couple of minutes a mutation in an eukaryotic strain important for
-	  one of our Biotech groups. Oh boy, do I love sequencing and MIRA.
-	</listitem>
-      </varlistentry>
-    </variablelist>
-    <para>
-      Have a nice Friday and a good week-end,
-    </para>
-    <para>
-      Bastien
-    </para>
-    <para>
-      <emphasis role="bold">PS:</emphasis> while celebrating with MIRA
-      tonight, I expressed my fear that some people might find it strange that
-      I anthropomorphise her. They could think I went totally nuts or that I
-      needed an extended vacation (which I do btw). She assured me that no
-      one would dare thinking I were insane ... and if so, she would come over
-      to their place and give them <emphasis>that look</emphasis>.
-    </para>
-    <para>
-      How utterly reassuring.
+Deduction 4:
+- the disk is innocent.
+    </para>
+    <para>
+Deduction 5:
+- as all other components have been ruled out, the RAM is faulty.
+    </para>
+
+----------------------------------------------------------------------------
+
+    <para>
+As I wrote: life's a rollercoaster.
     </para>
+    <para>
+
+Up:   MIRA is innocent! There, she's giving me "that look" again and one would
+      have to be blind to oversee the "told you so" she's sending over with
+      it.
+Down: My RAM's broken and I need to replace it. Bought it only last May,
+      should still be under guarantee, but still ... time and effort.
+Up:   I did not sell my old RAMs, so I can continue to work
+Down: 12 GiB feels soooooo tight after having had 24.
+Up:   I can wrap up 3.4.0 end of this week with good conscience!
+Down: How the hell am I gonna tie all loose bits and pieces in the
+      documentation in the next 24 to 48 hours?
+Looping: today MIRA again helped me at work to locate a mutation important for
+         one of our Biotech groups. Boy, do I love sequencing and MIRA.
+
+Have a nice Friday and a good week-end,
+  Bastien
+
+
+PS: while celebrating with MIRA tonight, I expressed my fear that some people
+    might find it strange that I anthropomorphise her. They could think I went
+    totally nuts or that I needed an extended vacation (which I do btw). She
+    reassured me that no one would dare thinking I were insane ... and if so,
+    she would come over to their place and give them "that look."
+
+    How utterly reassuring.
+
+  </para>
+
   </sect1>
+
 </chapter>
 
diff --git a/doc/docbook/chap_dataprep_part.xml b/doc/docbook/chap_dataprep_part.xml
deleted file mode 100644
index 33f9190..0000000
--- a/doc/docbook/chap_dataprep_part.xml
+++ /dev/null
@@ -1,160 +0,0 @@
-<?xml version="1.0" ?>
-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.docbook.org/xml/4.5/docbookx.dtd">
-<chapter id="chap_dataprep">
-  <chapterinfo>
-    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="versionfile"/>
-    <author>
-      <firstname>Bastien</firstname>
-      <surname>Chevreux</surname>
-      <email>bach at chevreux.org</email>
-    </author>
-    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="copyrightfile"/>
-  </chapterinfo>
-  <blockquote>
-    <attribution>Solomon Short</attribution>
-    <para>
-      <emphasis><quote>Rome didn't fall in a day either.</quote></emphasis>
-    </para>
-  </blockquote>
-  <title>Preparing data</title>
-  <sect1 id="sect_pd_introduction">
-    <title>
-      Introduction
-    </title>
-    <para>
-      Most of this chapter and many sections are just stubs at the moment.
-    </para>
-  </sect1>
-  <sect1 id="sect_pd_sanger">
-    <title>
-      Sanger
-    </title>
-    <para>
-      Outside MIRA: transform .ab1 to .scf, perform sequencing vector clip
-      (and cloning vector clip if used), basic quality clips.
-    </para>
-    <para>
-      Recommended program: <command>gap4</command> (or
-      rather <command>pregap4</command>) from the Staden 4 package.
-    </para>
-  </sect1>
-  <sect1 id="sect_pd_454">
-    <title>
-      Roche / 454
-    </title>
-    <para>
-      Outside MIRA: convert SFF instrument from Roche to FASTQ,
-      use <command>sff_extract</command> for that. In case you used
-      "non-standard" sequencing procedures: clip away MIDs, clip away
-      non-standard sequencing adaptors used in that project.
-    </para>
-  </sect1>
-  <sect1 id="sect_pd_illumina">
-    <title>
-      Illumina
-    </title>
-    <para>
-      Outside MIRA: for heavens' sake: do NOT try to clip or trim by quality
-      yourself. Do NOT try to remove standard sequencing adaptors
-      yourself. Just leave Illumina data alone! (really, I mean it).
-    </para>
-    <para>
-      MIRA is much, much better at that job than you will probably ever be
-      ... and I dare to say that MIRA is better at that job than 99% of all
-      clipping/trimming software existing out there. Just make sure you use
-      the <arg>-CL:pec</arg> (proposed_end_clip) option of MIRA.
-    </para>
-    <note>
-      The <emphasis>only</emphasis> exception to the above is if you (or your
-      sequencing provider) used decidedly non-standard sequencing
-      adaptors. Then it might be worthwhile to perform own adaptor
-      clipping. But this will not be the case for 99% of all sequencing
-      projects out there.
-    </note>
-    <para>
-      Joining paired-ends: if you want to do this, feel free to use any tool
-      which is out there (TODO: quick list). Just make sure they do not join
-      on very short overlaps. For me, the minimum overlap is at least 17
-      bases, but I more commonly use at least 30.
-    </para>
-  </sect1>
-  <sect1 id="sect_pd_pacbio">
-    <title>
-      Pacific Biosciences
-    </title>
-    <para>
-      Outside MIRA: MIRA needs error corrected reads, either
-    </para>
-    <itemizedlist>
-      <listitem>
-	PacBio CCS reads (circular consensus sequence) which you get from the
-	PacBio SMRTAnalysis pipeline
-      </listitem>
-      <listitem>
-	or self-corrected or reads corrected with other sequencing
-	technologies which you will get either from the PacBio HGAP pipeline
-	or the pacbioToCA pipeline
-      </listitem>
-    </itemizedlist>
-    <para>
-      Assembly of uncorrected PacBio reads (CLR) is currently not supported
-      officially as of MIRA 4.0.
-    </para>
-  </sect1>
-  <sect1 id="sect_pd_iontor">
-    <title>
-      Ion Torrent
-    </title>
-    <para>
-      Outside MIRA: need to convert BAM to FASTQ. Need to clip away
-      non-standard sequencing adaptors if used in that project. Apart from
-      that: leave the data alone.
-    </para>
-  </sect1>
-  <sect1 id="sect_pd_sra">
-    <title>
-      Short Read Archive (SRA)
-    </title>
-    <para>
-      Outside MIRA: you need to convert SRA format to FASTQ format. This is done
-      using <command>fastq-dump</command> from the SRA toolkit from the
-      NCBI. Make sure to have at least version 2.4.x of the toolkit. Last time
-      I looked (March 2015), the software was at
-      <ulink url="http://www.ncbi.nlm.nih.gov/Traces/sra/?view=software"/>, the
-      documentation for the whole toolkit was at
-      <ulink url="http://www.ncbi.nlm.nih.gov/Traces/sra/?view=toolkit_doc"/>,
-      and for <command>fastq-dump</command> it was
-      <ulink url="http://www.ncbi.nlm.nih.gov/Traces/sra/?view=toolkit_doc&f=fastq-dump"/>
-    </para>
-    <para>
-      After extraction, proceed with preprocessing as described above,
-      depending on the sequencing technology used.
-    </para>
-    <para>
-      For extracting Illumina data, use something like this:
-    </para>
-    <screen><prompt>arcadia:/some/path$</prompt> <userinput>fastq-dump -I --split-files <replaceable>somefile.sra</replaceable></userinput></screen>
-    <note>
-      <para>
-	As <command>fastq-dump</command> unfortunately uses a pretty wasteful
-	variant of the FASTQ format, you might want to reduce the file size
-	for each FASTQ it produces by doing this:
-      </para>
-      <screen><userinput>sed -i '3~4 s/^+.*$/+/' <replaceable>file.fastq</replaceable></userinput></screen>
-      <para>
-	The above command performs an in-file replacement of unnecessary name
-	and comments on the quality divider lines of the FASTQ. The exact
-	translation of the <command>sed</command> is: do an in-file
-	replacement (-i); starting on the third line, then every fourth line
-	(3~4); substitute (s/); a line which starts (^); with a plus (+); and
-	then can have any character (.); repeated any number of times
-	including zero (*); until the end of the line ($); by just a single
-	plus character (/+/).
-      </para>
-      <para>
-	This alone reduces the file size of a typical Illumina data set with
-	100mers extracted from the SRA by about 15 to 20%.
-      </para>
-    </note>
-  </sect1>
-</chapter>
diff --git a/doc/docbook/chap_denovo_part.xml b/doc/docbook/chap_denovo_part.xml
deleted file mode 100644
index 08e5833..0000000
--- a/doc/docbook/chap_denovo_part.xml
+++ /dev/null
@@ -1,473 +0,0 @@
-<?xml version="1.0" ?>
-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.docbook.org/xml/4.5/docbookx.dtd">
-<chapter id="chap_denovo">
-  <chapterinfo>
-    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="versionfile"/>
-    <author>
-      <firstname>Bastien</firstname>
-      <surname>Chevreux</surname>
-      <email>bach at chevreux.org</email>
-    </author>
-    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="copyrightfile"/>
-  </chapterinfo>
-  <blockquote>
-    <attribution>Solomon Short</attribution>
-    <para>
-      <emphasis><quote>The universe is full of surprises - most of them nasty.</quote></emphasis>
-    </para>
-  </blockquote>
-  <title>De-novo assemblies</title>
-  <sect1 id="sect_dn_introduction">
-    <title>
-      Introduction
-    </title>
-    <para>
-      This guide assumes that you have basic working knowledge of Unix systems, know
-      the basic principles of sequencing (and sequence assembly) and what assemblers
-      do.
-    </para>
-    <para>
-      While there are step by step instructions on how to setup your data and
-      then perform an assembly, this guide expects you to read at some point in time
-    </para>
-    <itemizedlist>
-      <listitem>
-	<para>
-	  Before the assembly, <xref xrefstyle="select: label quotedtitle
-	  pageabbrev" linkend="chap_dataprep"/> to know what to do (or not to
-	  do) with the sequencing data before giving it to MIRA.
-	</para>
-      </listitem>
-      <listitem>
-	<para>
-	  For users with PacBio reads, <xref xrefstyle="select: label
-	  quotedtitle pageabbrev" linkend="sect_sp_pacbio_ccs"/> has important
-	  information regarding special parameters needed.
-	</para>
-      </listitem>
-      <listitem>
-	<para>
-	  After the assembly, <xref xrefstyle="select: label quotedtitle
-	  pageabbrev" linkend="chap_results"/> to know what to do with the
-	  results of the assembly. More specifically, <xref xrefstyle="select: label quotedtitle
-	  pageabbrev" linkend="sect_res_looking_at_results"/>, <xref xrefstyle="select: label quotedtitle
-	  pageabbrev" linkend="sect_res_first_look:the_assembly_info"/>, <xref xrefstyle="select: label quotedtitle
-	  pageabbrev" linkend="sect_res_converting_results"/>, <xref xrefstyle="select: label quotedtitle
-	  pageabbrev" linkend="sect_res_filtering_of_results"/> and <xref xrefstyle="select: label quotedtitle
-	  pageabbrev" linkend="sect_res_places_of_importance_in_a_de_novo_assembly"/>.
-	</para>
-      </listitem>
-      <listitem>
-	<para>
-	  And also <xref xrefstyle="select: label quotedtitle pageabbrev"
-	  linkend="chap_reference"/> to look up how manifest files should be
-	  written (<xref xrefstyle="select: label quotedtitle pageabbrev"
-	  linkend="sect_ref_manifest_basics"/> and <xref xrefstyle="select: label quotedtitle pageabbrev"
-	  linkend="sect_ref_manifest_readgroups"/> and <xref xrefstyle="select: label quotedtitle pageabbrev"
-	  linkend="sect_ref_manifest_parameters"/>), some command line options as well as general information on
-	  what tags MIRA uses in assemblies, files it generates etc.pp
-	</para>
-      </listitem>
-      <listitem>
-	<para>
-	  Last but not least, you may be interested in some observations about
-	  the different sequencing technologies and the traps they may
-	  contain, see <xref xrefstyle="select: label quotedtitle pageabbrev"
-	  linkend="chap_seqtechdesc"/> for that. For advice on what to pay
-	  attention to <emphasis>before</emphasis> going into a sequencing
-	  project, have a look at <xref xrefstyle="select: label quotedtitle
-	  pageabbrev" linkend="chap_seqadvice"/>.
-	</para>
-      </listitem>
-    </itemizedlist>
-  </sect1>
-  <sect1 id="sect_dn_general">
-    <title>
-      General steps
-    </title>
-    <para>
-      This part will introduce you step by step how to get your data together
-      for a simple mapping assembly. I'll make up an example using an
-      imaginary bacterium: <emphasis>Bacillus chocorafoliensis</emphasis> (or
-      short: <emphasis>Bchoc</emphasis>). You collected the strain you want to
-      assemble somewhere in the wild, so you gave the strain the name
-      <emphasis>Bchoc_wt</emphasis>.
-    </para>
-    <para>
-      Just for laughs, let's assume you sequenced that bug with lots of more
-      or less current sequencing technologies: Sanger, 454, Illumina, Ion
-      Torrent and Pacific Biosciences.
-    </para>
-    <sect2 id="sect_dn_ge_copying_and_naming_the_sequence_data">
-      <title>
-	Copying and naming the sequence data
-      </title>
-      <para>
-	You need to create (or get from your sequencing provider) the
-	sequencing data in any supported file format. Amongst these, FASTQ and
-	FASTA + FASTA-quality will be the most common, although the latter is
-	well on the way out nowadays. The following walkthrough uses what most
-	people nowadays get: FASTQ.
-      </para>
-      <para>
-	Create a new project directory (e.g. <filename>myProject</filename>)
-	and a subdirectory of this which will hold the sequencing data
-	(e.g. <filename>data</filename>).
-      </para>
-      <screen><prompt>arcadia:/path/to</prompt> <userinput>mkdir myProject</userinput>
-<prompt>arcadia:/path/to</prompt> <userinput>cd myProject</userinput>
-<prompt>arcadia:/path/to/myProject$</prompt> <userinput>mkdir data</userinput></screen>
-      <para>
-	Put the FASTQ data into that <filename>data</filename> directory so
-	that it now looks perhaps like this:
-      </para>
-      <screen><prompt>arcadia:/path/to/myProject$</prompt> <userinput>ls -l data</userinput>
--rw-r--r-- 1 bach users 263985896 2008-03-28 21:49 bchocwt_lane6.solexa.fastq</screen>
-    <note>
-      I completely made up the file names above. You can name them anyway you
-      want. And you can have them live anywhere on the hard-disk, you do not
-      need to put them in this <filename>data</filename> directory. It's just
-      the way I do it ... and it's where the example manifest files a bit
-      further down in this chapter will look for the data files.
-    </note>
-    <para>
-      We're almost finished with the setup. As I like to have things neatly separated, I always create a directory called <filename>assemblies</filename> which will hold my assemblies (or different trials) together. Let's quickly do that:
-    </para>
-    <screen><prompt>arcadia:/path/to/myProject$</prompt> <userinput>mkdir assemblies</userinput>
-<prompt>arcadia:/path/to/myProject$</prompt> <userinput>mkdir assemblies/1sttrial</userinput>
-<prompt>arcadia:/path/to/myProject$</prompt> <userinput>cd assemblies/1sttrial</userinput></screen>
-    </sect2>
-    <sect2 id="sect_dn_ge_writing_a_simple_manifest_file">
-      <title>
-	Writing a simple manifest file
-      </title>
-      <para>
-	A manifest file is a configuration file for MIRA which tells it what
-	type of assembly it should do and which data it should load. In this
-	case we'll make a simple assembly of a genome with unpaired Illumina
-	data
-      </para>
-      <screen># Example for a manifest describing a genome de-novo assembly with
-# unpaired Illumina data
-
-# First part: defining some basic things
-# In this example, we just give a name to the assembly
-#  and tell MIRA it should map a genome in accurate mode
-
-<userinput>project = <replaceable>MyFirstAssembly</replaceable>
-job = <replaceable>genome,denovo,accurate</replaceable></userinput>
-
-# The second part defines the sequencing data MIRA should load and assemble
-# The data is logically divided into "readgroups"
-
-# here comes the unpaired Illumina data
-
-<userinput>readgroup = <replaceable>SomeUnpairedIlluminaReadsIGotFromTheLab</replaceable>
-data = <replaceable>../../data/bchocwt_lane6.solexa.fastq</replaceable>
-technology = <replaceable>solexa</replaceable></userinput></screen>
-      <note>
-	<para>
-	  Please look up the parameters of the manifest file in the main
-	  manual or the example manifest files in the following section.
-	</para>
-	<para>
-	  The ones above basically say: make an accurate denovo assembly of
-	  unpaired Illumina reads.
-	</para>
-      </note>
-    </sect2>
-    <sect2 id="sect_dn_ge_starting_assembly">
-      <title>Starting the assembly</title>
-      <para>
-	Starting the assembly is now just a matter of a simple command line:
-      </para>
-      <screen><prompt>arcadia:/path/to/myProject/assemblies/1sttrial$</prompt> <userinput>mira <replaceable>manifest.conf >&log_assembly.txt</replaceable></userinput></screen>
-      <para>
-	For this example - if you followed the walk-through on how to prepare the data
-	- everything you might want to adapt in the first time are the following thing in the manifest file:
-	options:
-      </para>
-      <itemizedlist>
-	<listitem>
-	  <para>
-	    project= (for naming your assembly project)
-	  </para>
-	</listitem>
-      </itemizedlist>
-      <para>
-	Of course, you are free to change any option via the extended parameters, but
-	this is the topic of another part of this manual.
-      </para>
-    </sect2>
-  </sect1>
-  <sect1 id="sect_dn_manifest_files_use_cases">
-    <title>
-      Manifest files for different use cases
-    </title>
-    <para>
-      This section will introduce you to manifest files for different use
-      cases. It should cover the most important uses, but as always you are
-      free to mix and match the parameters and readgroup definitions to suit
-      your specific needs.
-    </para>
-    <para>
-      Taking into account that there may be <emphasis>a lot</emphasis> of
-      combinations of sequencing technologies, sequencing libraries (shotgun,
-      paired-end, mate-pair, etc.) and input file types (FASTQ, FASTA,
-      GenBank, GFF3, etc.pp), the example manifest files just use Illumina and
-      454 as technologies, GFF3 as input file type for the reference sequence,
-      FASTQ as input type for sequencing data ... and they do not show the
-      multitude of more advanced features like, e.g., using ancillary clipping
-      information in XML files, ancillary masking information in SSAHA2 or
-      SMALT files etc.pp.
-    </para>
-    <para>
-      I'm sure you will be able to find your way by scanning through the
-      corresponding section on manifest files in the reference chapter :-)
-    </para>
-    <sect2 id="sect_dn_mf_denovo_with_shotgun_data">
-      <title>
-	Manifest for shotgun data
-      </title>
-      <para>
-	Well, we've seen that already in the section above, but here it is
-	again ... but this time with 454 data.
-      </para>
-      <screen># Example for a manifest describing a denovo assembly with
-# unpaired 454 data
-
-# First part: defining some basic things
-# In this example, we just give a name to the assembly
-#  and tell MIRA it should map a genome in accurate mode
-
-<userinput>project = <replaceable>MyFirstAssembly</replaceable>
-job = <replaceable>genome,denovo,accurate</replaceable></userinput>
-
-# The second part defines the sequencing data MIRA should load and assemble
-# The data is logically divided into "readgroups"
-
-# here's the 454 data
-
-<userinput>readgroup = <replaceable>SomeUnpaired454ReadsIGotFromTheLab</replaceable>
-data = <replaceable>../../data/some454data.fastq</replaceable>
-technology = <replaceable>454</replaceable></userinput></screen>
-    </sect2>
-    <sect2 id="sect_dn_mf_assembling_with_multiple_technologies">
-      <title>
-	Assembling with multiple sequencing technologies (hybrid assemblies)
-      </title>
-      <para>
-	Hybrid mapping assemblies follow the general manifest scheme: tell
-	what you want in the first part, then simply add as separate readgroup
-	the information MIRA needs to know to find the data and off you
-	go. Just for laughs, here's a manifest for 454 shotgun with Illumina
-	shotgun
-      </para>
-      <screen># Example for a manifest describing a denovo assembly with
-# shotgun 454 and shotgun Illumina data
-
-# First part: defining some basic things
-# In this example, we just give a name to the assembly
-#  and tell MIRA it should map a genome in accurate mode
-
-<userinput>project = <replaceable>MyFirstAssembly</replaceable>
-job = <replaceable>genome,mapping,accurate</replaceable></userinput>
-
-# The second part defines the sequencing data MIRA should load and assemble
-# The data is logically divided into "readgroups"
-
-# now the shotgun 454 data
-<userinput>readgroup = <replaceable>DataForShotgun454</replaceable>
-data = <replaceable>../../data/project454data.fastq</replaceable>
-technology = <replaceable>454</replaceable></userinput>
-
-# now the shotgun Illumina data
-
-<userinput>readgroup = <replaceable>DataForShotgunIllumina</replaceable>
-data = <replaceable>../../data/someillumina.fastq</replaceable>
-technology = <replaceable>solexa</replaceable></userinput></screen>
-    </sect2>
-    <sect2 id="sect_dn_mf_manifest_for_pairedend_data">
-      <title>
-	Manifest for data sets with paired reads
-      </title>
-      <para>
-	When using paired-end data, you should know
-      </para>
-      <orderedlist>
-	<listitem>
-	  <para>
-	    the orientation of the reads toward each other. This is specific
-	    to sequencing technologies and / or the sequencing library preparation.
-	  </para>
-	</listitem>
-	<listitem>
-	  <para>
-	    at which distance these reads should be. This is specific to the
-	    sequencing library preparation and the sequencing lab should tell
-	    you this.
-	  </para>
-	</listitem>
-      </orderedlist>
-      <para>
-	In case you do not know one (or any) of the above, don't panic! MIRA
-	is able to estimate the needed values during the assembly if you tell
-	it to.
-      </para>
-      <para>
-	The following manifest shows you the most laziest way to define a
-	paired data set by simply adding <emphasis>autopairing</emphasis> as keyword to a
-	readgroup (using Illumina just as example):
-      </para>
-      <screen># Example for a lazy manifest describing a denovo assembly with
-# one library of paired reads
-
-# First part: defining some basic things
-# In this example, we just give a name to the assembly
-#  and tell MIRA it should map a genome in accurate mode
-
-<userinput>project = <replaceable>MyFirstAssembly</replaceable>
-job = <replaceable>genome,denovo,accurate</replaceable></userinput>
-
-# The second part defines the sequencing data MIRA should load and assemble
-# The data is logically divided into "readgroups"
-
-# now the Illumina paired-end data
-
-<userinput>readgroup = <replaceable>DataIlluminaPairedLib</replaceable>
-<replaceable>autopairing</replaceable>
-data = <replaceable>../../data/project_1.fastq ../../data/project_2.fastq</replaceable>
-technology = <replaceable>solexa</replaceable></userinput></screen>
-      <para>
-	If you know the orientation of the reads and/or the library size, you
-	can tell this MIRA the following way (just showing the readgroup
-	definition here):
-      </para>
-      <screen><userinput>readgroup = <replaceable>DataIlluminaPairedEnd500Lib</replaceable>
-data = <replaceable>../../data/project_1.fastq ../../data/project_2.fastq</replaceable>
-technology = <replaceable>solexa</replaceable>
-template_size = <replaceable>250 750</replaceable>
-segment_placement = <replaceable>---> <---</replaceable></userinput></screen>
-      <para>
-	In cases you are not 100% sure about, e.g., the size of the DNA
-	template, you can also give a (generous) expected range and then tell
-	MIRA to automatically refine this range during the assembly based on
-	real, observed distances of read pairs. Do this with <emphasis>autorefine</emphasis>
-	modifier like this:
-      </para>
-      <screen><userinput>template_size = <replaceable>50 1000 autorefine</replaceable></userinput></screen>
-      <para>
-	The following manifest file is an example for assembling with several
-	different libraries from different technologies. Do not forget you
-	can use <emphasis>autopairing</emphasis> or <emphasis>autorefine</emphasis> :-)
-      </para>
-      <screen># Example for a manifest describing a denovo assembly with
-# several kinds of sequencing libraries
-
-# First part: defining some basic things
-# In this example, we just give a name to the assembly
-#  and tell MIRA it should map a genome in accurate mode
-
-<userinput>project = <replaceable>MyFirstAssembly</replaceable>
-job = <replaceable>genome,denovo,accurate</replaceable></userinput>
-
-# The second part defines the sequencing data MIRA should load and assemble
-# The data is logically divided into "readgroups"
-
-# now the Illumina paired-end data
-
-<userinput>readgroup = <replaceable>DataIlluminaForPairedEnd500bpLib</replaceable>
-data = <replaceable>../../data/project500bp-1.fastq ../../data/project500bp-2.fastq</replaceable>
-technology = <replaceable>solexa</replaceable>
-strain = <replaceable>bchoc_se1</replaceable>
-template_size = <replaceable>250 750</replaceable>
-segment_placement = <replaceable>---> <---</replaceable></userinput>
-
-# now the Illumina mate-pair data
-
-<userinput>readgroup = <replaceable>DataIlluminaForMatePair3kbLib</replaceable>
-data = <replaceable>../../data/project3kb-1.fastq ../../data/project3kb-2.fastq</replaceable>
-technology = <replaceable>solexa</replaceable>
-strain = <replaceable>bchoc_se1</replaceable>
-template_size = <replaceable>2500 3500</replaceable>
-segment_placement = <replaceable><--- ---></replaceable></userinput>
-
-# some Sanger data (6kb library)
-
-<userinput>readgroup = <replaceable>DataForSanger6kbLib</replaceable>
-data = <replaceable>../../data/sangerdata.fastq</replaceable>
-technology = <replaceable>sanger</replaceable>
-template_size = <replaceable>5500 6500</replaceable>
-segment_placement = <replaceable>---> <---</replaceable></userinput>
-
-# some 454 data
-
-<userinput>readgroup = <replaceable>DataFo454Pairs</replaceable>
-data = <replaceable>../../data/454data.fastq</replaceable>
-technology = <replaceable>454</replaceable>
-template_size = <replaceable>8000 1200</replaceable>
-segment_placement = <replaceable>2---> 1---></replaceable></userinput>
-
-# some Ion Torrent data
-
-<userinput>readgroup = <replaceable>DataFoIonPairs</replaceable>
-data = <replaceable>../../data/iondata.fastq</replaceable>
-technology = <replaceable>iontor</replaceable>
-template_size = <replaceable>1000 300</replaceable>
-segment_placement = <replaceable>2---> 1---></replaceable></userinput></screen>
-    </sect2>
-    <sect2 id="sect_dn_mf_denovo_with_multiple_strains">
-      <title>
-	De-novo with multiple strains
-      </title>
-      <para>
-	MIRA will make use of ancillary information present in the manifest
-	file. One of these is the information to which strain (or organism or
-	cell line etc.pp) the generated data belongs.
-      </para>
-      <para>
-	You just need to tell in the manifest file which data comes from which
-	strain. Let's assume that in the example from above, the "lane6" data
-	were from a first mutant named <emphasis>bchoc_se1</emphasis> and the
-	"lane7" data were from a second mutant
-	named <emphasis>bchoc_se2</emphasis>. Here's the manifest file you
-	would write then:
-      </para>
-      <screen># Example for a manifest describing a de-novo assembly with
-# unpaired Illumina data, but from multiple strains
-
-# First part: defining some basic things
-# In this example, we just give a name to the assembly
-#  and tell MIRA it should map a genome in accurate mode
-
-<userinput>project = <replaceable>MyFirstAssembly</replaceable>
-job = <replaceable>genome,denovo,accurate</replaceable></userinput>
-
-# The second part defines the sequencing data MIRA should load and assemble
-# The data is logically divided into "readgroups"
-
-# now the Illumina data
-
-<userinput>readgroup = <replaceable>DataForSE1</replaceable>
-data = <replaceable>../../data/bchocse_lane6.solexa.fastq</replaceable>
-technology = <replaceable>solexa</replaceable>
-strain = <replaceable>bchoc_se1</replaceable></userinput>
-
-<userinput>readgroup = <replaceable>DataForSE2</replaceable>
-data = <replaceable>../../data/bchocse_lane7.solexa.fastq</replaceable>
-technology = <replaceable>solexa</replaceable>
-strain = <replaceable>bchoc_se2</replaceable></userinput></screen>
-      <note>
-	While assembling de-novo (pr mapping) with multiple strains is
-	possible, the interpretation of results may become a bit daunting in
-	some cases. For many scenarios it might therefore be preferable to
-	successively use the data sets in own assemblies or mappings.
-      </note>
-      <para>
-	This <emphasis>strain</emphasis> information for each readgroup is
-	really the only change you need to perform to tell MIRA everything it
-	needs for handling strains.
-      </para>
-    </sect2>
-  </sect1>
-</chapter>
diff --git a/doc/docbook/chap_est_part.xml b/doc/docbook/chap_est_part.xml
index 9f59fa7..00aa479 100644
--- a/doc/docbook/chap_est_part.xml
+++ b/doc/docbook/chap_est_part.xml
@@ -3,12 +3,15 @@
 <chapter id="chap_est">
   <chapterinfo>
     <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="versionfile"/>
+    <releaseinfo>
+      <emphasis role="light">Document revision	$Id$</emphasis>
+    </releaseinfo>
     <author>
       <firstname>Bastien</firstname>
       <surname>Chevreux</surname>
       <email>bach at chevreux.org</email>
     </author>
-    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="copyrightfile"/>
+    <copyright><year>2011</year><holder>Bastien Chevreux</holder></copyright>
   </chapterinfo>
   <blockquote>
     <attribution>Solomon Short</attribution>
@@ -17,8 +20,8 @@
       </quote></emphasis>
     </para>
   </blockquote>
-  <title>EST / RNASeq assemblies</title>
-  <sect1 id="sect1_est_introduction">
+  <title>Assembly of EST data with MIRA3</title>
+  <sect1 id="sect1_introduction">
     <title>
       Introduction
     </title>
@@ -40,52 +43,35 @@
 	present.
       </para>
       <para>
-	Please read at some point in time
+	While there are step by step walkthroughs on how to setup your EST data and
+	then perform assemblies regarding different requirements, this guide expects
+	you to read at some point in time
       </para>
       <itemizedlist>
 	<listitem>
 	  <para>
-	    Before the assembly, <xref xrefstyle="select: label quotedtitle
-	    pageabbrev" linkend="chap_dataprep"/> to know what to do (or not to
-	    do) with the sequencing data before giving it to MIRA.
+	    the <emphasis>mira_usage</emphasis> introductory help file so that
+	    you have a basic knowledge on how to set up projects in mira for
+	    Sanger sequencing projects.
 	  </para>
 	</listitem>
 	<listitem>
 	  <para>
-	    For setting up the assembly, <xref xrefstyle="select: label
-	    quotedtitle pageabbrev" linkend="chap_denovo"/> to know how to
-	    start a denovo assembly (except you obviously will need to change
-	    the --job setting from <emphasis>genome</emphasis> to
-	    <emphasis>est</emphasis>).
+	    the <emphasis>mira_454</emphasis> introductory help file so that
+	    you have a basic knowledge on how to set up projects in mira for
+	    454 sequencing projects.
 	  </para>
 	</listitem>
 	<listitem>
 	  <para>
-	    After the assembly, <xref xrefstyle="select: label quotedtitle
-	    pageabbrev" linkend="chap_results"/> to know what to do with the
-	    results of the assembly. More specifically, <xref xrefstyle="select: label quotedtitle
-	    pageabbrev" linkend="sect_res_looking_at_results"/>, <xref xrefstyle="select: label quotedtitle
-	    pageabbrev" linkend="sect_res_first_look:the_assembly_info"/>, <xref xrefstyle="select: label quotedtitle
-	    pageabbrev" linkend="sect_res_converting_results"/>, <xref xrefstyle="select: label quotedtitle
-	    pageabbrev" linkend="sect_res_filtering_of_results"/> and <xref xrefstyle="select: label quotedtitle
-	    pageabbrev" linkend="sect_res_places_of_importance_in_a_de_novo_assembly"/>.
-	  </para>
-	</listitem>
-	<listitem>
-	  <para>
-	    And also <xref xrefstyle="select: label quotedtitle pageabbrev"
-	    linkend="chap_reference"/> to look up how manifest files should be
-	    written (<xref xrefstyle="select: label quotedtitle pageabbrev"
-	    linkend="sect_ref_manifest_basics"/> and <xref xrefstyle="select: label quotedtitle pageabbrev"
-	    linkend="sect_ref_manifest_readgroups"/> and <xref xrefstyle="select: label quotedtitle pageabbrev"
-	    linkend="sect_ref_manifest_parameters"/>), some command line options as well as general information on
-	    what tags MIRA uses in assemblies, files it generates etc.pp
+	    and last but not least the <emphasis>mira_reference</emphasis>
+	    help file to look up some command line options.
 	  </para>
 	</listitem>
       </itemizedlist>
     </note>
   </sect1>
-  <sect1 id="sect1_est_preliminaries:on_the_difficulties_of_assembling_ests">
+  <sect1 id="sect1_preliminaries:on_the_difficulties_of_assembling_ests">
     <title>
       Preliminaries: on the difficulties of assembling ESTs
     </title>
@@ -203,7 +189,7 @@ s3                          xxxxxxxxxxxxxxx
 	possible to switch on the SKIM chimera detection afterwards via
 	<arg>-CL:ascdc</arg>. However, this will have exactly the effects
 	described above: chimeras in higher coverage contigs will be detected,
-	but perfectly valid low coverage contigs will be torn apart.
+	but perfectly valid low coverage contigs will be torn apart. 
       </para>
       <para>
 	It is up to you to decide what you want or need.
@@ -248,7 +234,7 @@ s3                          xxxxxxxxxxxxxxx
       </note>
     </sect2>
   </sect1>
-  <sect1 id="est_sect1_est_preprocessing">
+  <sect1 id="est_sect1_preprocessing">
     <title>
       Preprocessing of ESTs
     </title>
@@ -341,7 +327,7 @@ Appears in HTML, but not in PDF :-(
       getting confused, be it sequencing artefacts or highly expressed genes.
     </note>
   </sect1>
-  <sect1 id="sect1_est_est_difference_assembly_clustering">
+  <sect1 id="sect1_est_difference_assembly_clustering">
     <title>
       The difference between <emphasis>assembly</emphasis> and
       <emphasis>clustering</emphasis>
@@ -358,7 +344,7 @@ Appears in HTML, but not in PDF :-(
 	Splitting transcripts into contigs based on SNPs
       </title>
       <para>
-	Imagine this simple case: a gene has two slightly different alleles and you've
+	Imagine this simple case: a gene has two slightly different alleles and you've 
 	sequenced this:
       </para>
       <screen>
@@ -475,11 +461,11 @@ B2-2  ..........<emphasis role="bold">***</emphasis>..........
 	this can be changed using the <arg>-AL:egp:egpl</arg> parameters of
 	MIRA if wanted.
       </para>
-      <warning>
+      <warning> 
 	<title>
 	  Problems with homopolymers, especially in 454 sequencing
 	</title>
-	<para>
+	<para> 
 	  As 454 sequencing has a general problem with homopolymers, this rule
 	  of MIRA will sometimes lead formation of more contigs than expected
 	  due to sequencing errors at "long" homopolymer sites ... where long
@@ -490,15 +476,15 @@ B2-2  ..........<emphasis role="bold">***</emphasis>..........
       </warning>
     </sect2>
   </sect1>
-  <sect1 id="sect1_est_mira_and_mirasearchestsnps">
+  <sect1 id="sect1_mira_and_mirasearchestsnps">
     <title>
       mira and miraSearchESTSNPs
     </title>
     <para>
     </para>
     <para>
-      The assembly of ESTS can be done in two ways when using the MIRA 4 system: by
-      using mira or miraSearchESTSNPs.
+      The assembly of ESTS can be done in two ways when using the MIRA3 system: by
+      using mira or miraSearchESTSNPs. 
     </para>
     <para>
       If one has data from only one strain, mira using the "--job=est"
@@ -630,7 +616,7 @@ B2-2  ..........<emphasis role="bold">***</emphasis>..........
 	  </term>
 	  <listitem>
 	    <para>
-	      Like <arg>-AL:mrs</arg> above, <arg>-CO:rodirs</arg> is a fall-back
+	      Like <arg>-AL:mrs</arg> above, <arg>-CO:rodirs</arg> is a fallback
 	      mechanism to disallow building of completely nonsensical contigs
 	      when <arg>-CO:asir=no</arg> and <arg>-AL:egp=no</arg>. You should decrease <arg>-CO:rodirs</arg> to anywhere between 10 and 0.
 	    </para>
@@ -652,14 +638,14 @@ B2-2  ..........<emphasis role="bold">***</emphasis>..........
       homopolymer problem), but to disallow Sanger sequences from having
       them. The parameters would need be set like this:
       <screen>
-<prompt>$</prompt> <userinput>mira [...] --job=est,... [...]
+<prompt>$</prompt> <userinput>mira [...] --job=est,... [...] 
   SANGER_SETTINGS -AL:egp=yes:egpl=split_on_codongaps
   454_SETTINGS -AL:egp=no</userinput></screen>
       or in shorter form (as <literal>--job=est</literal> already presets
       <literal>-AL:egp=yes:egpl=split_on_codongaps</literal> for all
       technologies):
       <screen>
-<prompt>$</prompt> <userinput>mira [...] --job=est,... [...]
+<prompt>$</prompt> <userinput>mira [...] --job=est,... [...] 
   454_SETTINGS -AL:egp=no</userinput>
       </screen>
     </note>
@@ -699,11 +685,11 @@ B2-2  ..........<emphasis role="bold">***</emphasis>..........
 	    possible repeat marker bases and are tagged as such (temporarily)
 	    to catch each and every possible sequence alignment which might be
 	    important later. As a result of this stage, the following
-	    information is written out:
+	    information is written out: 
 	    <orderedlist>
 	      <listitem>
 		<para>
-		  Into <filename>step1_snpsinSTRAIN_<strain_name>.caf</filename>
+		  Into <filename>step1_snpsinSTRAIN_<strainname>.caf</filename>
 		  all the sequences of a given strain that are in contigs (can
 		  be aligned with at least one other sequence) - also, all
 		  sequences that are singlets BUT have been tagged previously
@@ -773,7 +759,7 @@ B2-2  ..........<emphasis role="bold">***</emphasis>..........
 	and writes out quite a lot of additional information files after each
 	step.  Results and and additional information of step 1 are stored in
 	<filename>step1_*</filename> directories. Results and information of
-	step 2 are in <filename><strain_name>_*</filename>
+	step 2 are in <filename><strainname>_*</filename>
 	directories. For step 3, it's <filename>step3_*</filename> again.
       </para>
       <para>
@@ -806,6 +792,253 @@ B2-2  ..........<emphasis role="bold">***</emphasis>..........
       </para>
     </sect2>
   </sect1>
+  <sect1 id="sect1_walkthroughs">
+    <title>
+      Walkthroughs
+    </title>
+    <para>
+    </para>
+    <para>
+      These walkthroughs use "msd" as project name (acronym for My Simple Dataset),
+      please replace that with your own project name according to the MIRA naming
+      convention.
+    </para>
+    <sect2 id="sect2_mira_with_jobest">
+      <title>
+	mira with "--job=est"
+      </title>
+      <para>
+      </para>
+      <sect3 id="sect3_input:_one_strain_sanger_without_adaptors_and_no_xml">
+	<title>
+	  Example: One strain, Sanger without vectors and no XML
+	</title>
+	<para>
+	  Given is just a FASTA and FASTA quality file, where the Sanger
+	  sequencing vector sequences and problematic things (like bad
+	  quality) have been either completely removed from the data or were
+	  masked with "X". Apart from that, no further processing (poly-A
+	  removal etc.) was done. Your directory looks like this:
+	</para>
+	<screen>
+<prompt>bach at arcadia:$</prompt> <userinput>ls -l</userinput>
+-rwxr--r-- 1 bach bach 15486163 2009-02-22 21:01 msd_in.sanger.fasta
+-rwxr--r-- 1 bach bach 38017687 2009-02-22 21:01 msd_in.sanger.fasta.qual</screen>
+	<para>
+	</para>
+	<para>
+	  Then, use this command:
+	</para>
+	<screen>
+<prompt>$</prompt> <userinput>mira --project=msd 
+  --job=denovo,est,accurate,sanger
+  SANGER_SETTINGS 
+  -CL:qc=no 
+  >& log_assembly.txt</userinput></screen>
+	<para>
+	</para>
+	<para>
+	  We switch off the Sanger quality clips because bad quality is
+	  already trimmed away by your pipeline.
+	</para>
+      </sect3>
+      <sect3 id="sect3_input:_one_strain_454_with_xml_ancillary_data">
+	<title>
+	  Example: One strain, 454 with XML ancillary data
+	</title>
+	<para>
+	  Like above, but this time 454 sequencing and the FASTA files contain
+	  everything (including remaining adaptors and bad quality), but
+	  there's a XML with ancillary data which contains all necessary clips
+	  (like generated by, e.g., <command>sff_extract</command>):
+	</para>
+	<screen>
+<prompt>bach at arcadia:$</prompt> <userinput>ls -l</userinput>
+-rwxr--r-- 1 bach bach 15486163 2009-02-22 21:01 msd_in.454.fasta
+-rwxr--r-- 1 bach bach 38017687 2009-02-22 21:01 msd_in.454.fasta.qual
+-rwxr--r-- 1 bach bach 10433244 2009-02-22 21:01 msd_traceinfo_in.454.xml</screen>
+	<para>
+	  Then, use this command:
+	</para>
+	<screen>
+<prompt>bach at arcadia:$</prompt> <userinput> mira --project=msd 
+  --job=denovo,est,accurate,454 
+  454_SETTINGS 
+  -CL:qc=no 
+  >& log_assembly.txt</userinput></screen>
+	<para>
+	</para>
+	<para>
+	  We just switch off our quality clip for 454 (and load the quality
+	  clips from the XML), poly-A removal is performed by MIRA. Loading of
+	  TRACEINFO XML data must not be switched on as it's the default for
+	  454 data.
+	</para>
+      </sect3>
+      <sect3 id="sect3_input:_one_strain_454_with_xml_ancillary_data_polya_already_removed">
+	<title>
+	  Example: One strain, 454 with XML ancillary data, poly-A already removed.
+	</title>
+	<para>
+	  Like above, but this time the data was pre-processed by another program
+	  to mask the poly-A stretches with X:
+	</para>
+	<screen>
+<prompt>bach at arcadia:</prompt>$ <userinput>ls -l</userinput>
+-rwxr--r-- 1 bach bach 15486163 2009-02-22 21:01 msd_in.454.fasta
+-rwxr--r-- 1 bach bach 38017687 2009-02-22 21:01 msd_in.454.fasta.qual
+-rwxr--r-- 1 bach bach 10433244 2009-02-22 21:01 msd_traceinfo_in.454.xml</screen>
+	<para>
+	  Then, use this command:
+	</para>
+	<screen>
+<prompt>bach at arcadia:$</prompt> <userinput>mira --project=msd  
+  --job=denovo,est,accurate,454 
+  454_SETTINGS 
+  -CL:qc=no:cpat=no 
+  >& log_assembly.txt</userinput>
+	</screen>
+	<para>
+	</para>
+	<para>
+	  We just switch off our quality clip (and load the quality clips from
+	  the XML) and also switch off poly-A clipping. Remember, never
+	  perform poly-A/T clipping twice on a data set.
+	</para>
+      </sect3>
+      <sect3 id="sect3_input:_two_strains_454_with_xml_ancillary_data_polya_already_removed">
+	<title>
+	  Example: Two strains, 454 with XML ancillary data, poly-A already
+	  removed.
+	</title>
+	<para>
+	  Like above, but this time we assign reads to different
+	  strains. This can happen either by putting the strain information
+	  into the XML file (using the <literal>strain</literal> field of the
+	  NCBI TRACEINFO format definition) or by using a two column,
+	  tab-delimited file which mira loads on request.
+	</para>
+	<para>
+	  As written. when using XML no change to the command line from the
+	  last example would be needed. This example uses the extra file with
+	  strain information. The file
+	  <filename>msd_straindata_in.txt</filename> contains key value pair
+	  information on the relationship of reads to strains and looks like
+	  this (gnlti* are name of reads):
+	</para>
+	<screen>
+<prompt>bach at arcadia:$</prompt> <userinput>cat msd_straindata_in.454.txt</userinput>
+gnlti136478626 tom
+gnlti136479357 tom
+gnlti136479063 tom
+gnlti136478624 jerry
+gnlti136479522 jerry
+gnlti136477918 jerry</screen>
+	<para>
+	  Then, use this command (note the additional <arg>-LR:lsd</arg>
+	  option):
+	</para>
+	<screen>
+<prompt>bach at arcadia:$</prompt> <userinput>mira --project=msd  
+  --job=denovo,est,accurate,454 
+  454_SETTINGS 
+  -LR:lsd=yes 
+  -CL:qc=no:cpat=no 
+  >& log_assembly.txt</userinput>
+	</screen>
+      </sect3>
+    </sect2>
+    <sect2 id="sect2_mirasearchestsnps">
+      <title>
+	miraSearchESTSNPs
+      </title>
+      <para>
+      </para>
+      <sect3 id="sect3_input:_two_strains_sanger_with_masked_sequences_no_xml">
+	<title>
+	  Example: Two strains, Sanger with masked sequences, no XML
+	</title>
+	<para>
+	  Given just a FASTA and FASTA quality file, where the Sanger
+	  sequencing vectors and all sequencing related things (like bad
+	  quality) have been either completely removed from the data or were
+	  masked with "X". Apart from that, no further processing (poly-A
+	  removal etc.) was done.
+	</para>
+	<para>
+	  You have <emphasis>n</emphasis> strains (in this
+	  example <emphasis>n</emphasis>=2) called "tom" and "jerry"
+	</para>
+	<para>
+	  Your directory looks like this:
+	</para>
+	<screen>
+<prompt>bach at arcadia:$</prompt> <userinput>ls -l</userinput>
+-rw-r--r-- 1 bach bach  5276 2009-02-22 21:23 msd_in.sanger.fasta
+-rw-r--r-- 1 bach bach 13827 2009-02-22 21:23 msd_in.sanger.fasta.qual
+-rw-r--r-- 1 bach bach   120 2009-02-22 21:27 msd_straindata_in.txt</screen>
+	<para>
+	  The file <filename>msd_straindata_in.txt</filename> contains key
+	  value pair information on the relationship of reads to strains and
+	  looks like this (gnlti* are name of reads):
+	</para>
+	<screen>
+<prompt>bach at arcadia:$</prompt> <userinput>cat msd_straindata_in.txt</userinput>
+gnlti136478626 tom
+gnlti136479357 tom
+gnlti136479063 tom
+gnlti136478624 jerry
+gnlti136479522 jerry
+gnlti136477918 jerry</screen>
+	<para>
+	  To assemble, use this:
+	</para>
+	<screen>
+<prompt>bach at arcadia:$</prompt> <userinput>miraSearchESTSNPs 
+  --project=msd 
+  --job=denovo,accurate,sanger,esps1 
+  >&log_assembly_esps1.txt</userinput></screen>
+	<para>
+	  Note that the results of this first step are in sub-directories
+	  prefixed with "step1".
+	</para>
+	<para>
+	  When the first step finished, continue with this (note that no
+	  "--project" is given here):
+	</para>
+	<screen>
+<prompt>bach at arcadia:$</prompt> <userinput>miraSearchESTSNPs 
+  --job=denovo,accurate,esps2 
+  >&log_assembly_esps2.txt</userinput>
+	</screen>
+	<para>
+	  Note that the results of this second step are in sub-directories
+	  prefixed with "tom", "jerry" and "remain". You will find in each
+	  directory the clean transcripts from every strain/organism.
+	</para>
+	<para>
+	  To see which SNPs exist between both "tom" and "jerry", launch the
+	  third step:
+	</para>
+	<screen>
+<prompt>bach at arcadia:$</prompt> <userinput>miraSearchESTSNPs 
+  --job=denovo,accurate,esps3 
+  >&log_assembly_esps3.txt</userinput>
+	</screen>
+	<para>
+	</para>
+	<para>
+	  Note that the results of this third step are in sub-directories
+	  prefixed with "step3".
+	</para>
+	<para>
+	  In the <filename>step3_d_results</filename> directory for example,
+	  you can transform the CAF file into a gap4 database and then look at
+	  the SNPs searching for the tags SROr, SIOr and SAOr.
+	</para>
+      </sect3>
+    </sect2>
+  </sect1>
   <sect1>
     <title>
       Solving common problems of EST assemblies
@@ -819,3 +1052,4 @@ B2-2  ..........<emphasis role="bold">***</emphasis>..........
     </para>
   </sect1>
 </chapter>
+
diff --git a/doc/docbook/chap_faq_part.xml b/doc/docbook/chap_faq_part.xml
index 9d2c1ae..3673f07 100644
--- a/doc/docbook/chap_faq_part.xml
+++ b/doc/docbook/chap_faq_part.xml
@@ -3,12 +3,15 @@
 <chapter id="chap_faq">
   <chapterinfo>
     <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="versionfile"/>
+    <releaseinfo>
+      <emphasis role="light">Document revision	$Id$</emphasis>
+    </releaseinfo>
     <author>
       <firstname>Bastien</firstname>
       <surname>Chevreux</surname>
       <email>bach at chevreux.org</email>
     </author>
-    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="copyrightfile"/>
+    <copyright><year>2011</year><holder>Bastien Chevreux</holder></copyright>
   </chapterinfo>
   <blockquote>
     <attribution>Solomon Short</attribution>
@@ -19,7 +22,6 @@
   </blockquote>
 
   <title>Frequently asked questions</title>
-    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="warning_frontofchapter.xml"/>
   <para>
     This list is a collection of frequently asked questions and answers
     regarding different aspects of the MIRA assembler.
@@ -49,7 +51,7 @@
 	  <para>Test answer 2</para>
 	</answer>
       </qandaentry>
-    </qandaset>
+    </qandaset> 
 
     <para>
     </para>
@@ -60,7 +62,7 @@
       <para>
       </para>
       <screen>
-	I have a project which I once started quite normally via
+	I have a project which I once started quite normally via 
 	"--job=denovo,genome,accurate,454"
 	and once with explicitly switching off the uniform read distribution
 	"--job=denovo,genome,accurate,454 -AS:urd=no"
@@ -71,7 +73,7 @@
       </para>
       <para>
 	Since 2.9.24x1, MIRA has a feature called "uniform read distribution" which is
-	normally switched on. This feature reduces over-compression of repeats during
+	normally switched on. This feature reduces overcompression of repeats during
 	the contig building phase and makes sure that, e.g., a rRNA stretch which is
 	present 10 times in a bacterium will also be present approximately 10 times in
 	your result files.
@@ -83,40 +85,40 @@
 	multiplied by a safety factor is reached at a given site.
       </para>
       <para>
-	It's generally a very useful tool disentangle repeats, but has some slight
-	secondary effects: rejection of otherwise perfectly good reads. The
-	assumption of read distribution uniformity is the big problem we have here:
-	of course it's not really valid. You sometimes have less, and sometimes more
-	than "the average" coverage. Furthermore, the new sequencing technologies -
-	454 perhaps but especially the microreads from Solexa & probably also SOLiD -
+	It's generally a very useful tool disentangle repeats, but has some slight 
+	secondary effects: rejection of otherwise perfectly good reads. The 
+	assumption of read distribution uniformity is the big problem we have here: 
+	of course it's not really valid. You sometimes have less, and sometimes more 
+	than "the average" coverage. Furthermore, the new sequencing technologies - 
+	454 perhaps but especially the microreads from Solexa & probably also SOLiD - 
 	show that you also have a skew towards the site of replication origin.
       </para>
       <para>
-	One example: let's assume the average coverage of your project is 8 and by
-	chance at one place you have 17 (non-repetitive) reads, then the following
+	One example: let's assume the average coverage of your project is 8 and by 
+	chance at one place you have 17 (non-repetitive) reads, then the following 
 	happens:
       </para>
       <para>
 	$p$= parameter of -AS:urdsip
       </para>
       <para>
-	Pass 1 to $p-1$: MIRA happily assembles everything together and calculates a
-	number of different things, amongst them an average coverage of ~8. At the
-	end of pass '$p-1$', it will announce this average coverage as first estimate
+	Pass 1 to $p-1$: MIRA happily assembles everything together and calculates a 
+	number of different things, amongst them an average coverage of ~8. At the 
+	end of pass '$p-1$', it will announce this average coverage as first estimate 
 	to the assembly process.
       </para>
       <para>
-	Pass $p$: MIRA has still assembled everything together, but at the end of each
-	pass the contig self-checking algorithms now include an "average coverage
-	check". They'll invariably find the 17 reads stacked and decide (looking at
-	the -AS:urdct parameter which I now assume to be 2) that 17 is larger than
-	2*8 and that this very well may be a repeat. The reads get flagged as
+	Pass $p$: MIRA has still assembled everything together, but at the end of each 
+	pass the contig self-checking algorithms now include an "average coverage 
+	check". They'll invariably find the 17 reads stacked and decide (looking at 
+	the -AS:urdct parameter which I now assume to be 2) that 17 is larger than 
+	2*8 and that this very well may be a repeat. The reads get flagged as 
 	possible repeats.
       </para>
       <para>
 	Pass $p+1$ to end: the "possibly repetitive" reads get a much tougher
 	treatment in MIRA. Amongst other things, when building the contig, the contig
-	now looks that "possibly repetitive" reads do not over-stack by an average
+	now looks that "possibly repetitive" reads do not overstack by an average
 	coverage multiplied by a safety value (-AS:urdcm) which I'll assume in this
 	example to be 1.5. So, at a certain point, say when read 14 or 15 of
 	that possible repeat want to be aligned to the contig at this given place, the
@@ -127,11 +129,11 @@
 	got rejected like this, it will end up as singlet or in the debris file.
       </para>
       <para>
-	Tough luck. I do have ideas on how to re-integrate those reads at the and of an
-	assembly, but I had deferred doing this as in every case I had looked up,
-	adding those reads to the contigs wouldn't have changed anything ... there's
-	already enough coverage. What I do in those cases is simply filter away the
-	contiglets (defined as being of small size and having an average coverage
+	Tough luck. I do have ideas on how to reintegrate those reads at the and of an 
+	assembly, but I had deferred doing this as in every case I had looked up, 
+	adding those reads to the contigs wouldn't have changed anything ... there's 
+	already enough coverage. What I do in those cases is simply filter away the 
+	contiglets (defined as being of small size and having an average coverage 
 	below the average coverage of the project / 3 (or 2.5)) from a project.
       </para>
     </sect2>
@@ -225,7 +227,7 @@
 	</listitem>
 	<listitem>
 	  <para>
-	    454 GS20: 500
+	    454 GS20: 500 
 	  </para>
 	</listitem>
 	<listitem>
@@ -243,10 +245,10 @@
       </para>
       <para>
 	Let's assume we decide for an average coverage of 11 and a minimum length of
-	1000 bases. Now you can filter your project with miraconvert
+	1000 bases. Now you can filter your project with convert_project
       </para>
       <screen>
-	miraconvert -x 1000 -y 11 sourcefile.caf filtered.caf
+	convert_project -f caf -t caf -x 1000 -y 14 sourcefile.caf filtered.caf
       </screen>
       <para>
       </para>
@@ -270,17 +272,17 @@
       <itemizedlist>
 	<listitem>
 	  <para>
-	    IUPc
+	    IUPc 
 	  </para>
 	</listitem>
 	<listitem>
 	  <para>
-	    UNSc
+	    UNSc 
 	  </para>
 	</listitem>
 	<listitem>
 	  <para>
-	    SRMc
+	    SRMc 
 	  </para>
 	</listitem>
 	<listitem>
@@ -325,7 +327,7 @@
 	  <para>Sugar and spice and everything nice.</para>
 	</answer>
       </qandaentry>
-    </qandaset>
+    </qandaset> 
 
     <para>
     </para>
@@ -380,7 +382,7 @@
       </title>
       <para>
 	No, not anymore. Use the <command>sff_extract</command> script to
-	extract your reads. Though the Roche sfftools package contains a few
+	extract your reads. Though the Roche sfftools package containes a few
 	additional utilities which could be useful.
       </para>
     </sect2>
@@ -429,8 +431,8 @@
       <para>
       </para>
       <para>
-	However, looking through some earlier project data I had, I also retrieved the
-	following (by simply making a consensus of sequences that did not match the
+	However, looking through some earlier project data I had, I also retrieved the 
+	following (by simply making a consensus of sequences that did not match the 
 	target genome anymore):
       </para>
       <screen>
@@ -442,7 +444,7 @@
       <para>
       </para>
       <para>
-	Go figure, I have absolutely no idea where these come from as they also do not
+	Go figure, I have absolutely no idea where these come from as they also do not 
 	comply to the "tcag" ending the adaptors should have.
       </para>
       <para>
@@ -493,7 +495,7 @@
 	A-Adaptor - DNA1 - Linker - DNA2 - B-Adaptor.
       </para>
       <para>
-	It's possible that one of the two DNA fragments is *very* short or is missing
+	It's possible that one of the two DNA fragments is *very* short or is missing 
 	completely, then one has something like this:
       </para>
       <para>
@@ -518,7 +520,7 @@
 	will <emphasis role="bold">NOT</emphasis> have the direction
       </para>
       <screen>
-	---> Linker <---
+	---> Linker <--- 
       </screen>
       <para>
 	as one might expect when being used to Sanger Sequencing, but rather in this
@@ -548,10 +550,10 @@
 	If this is - for whatever reason - not possible, this list might help.
       </para>
       <para>
-	Are the sequences ~100-110 bases long? It's GS20.
+	Are the sequences ~100-110 bases long? It's GS20. 
       </para>
       <para>
-	Are the sequences ~220-250 bases long? It's FLX.
+	Are the sequences ~220-250 bases long? It's FLX. 
       </para>
       <para>
 	Are the sequences ~350-450 bases long? It's Titanium.
@@ -575,7 +577,7 @@ I have two datasets of ~500K sequences each and the sequencing company
 already did an assembly (using MIRA) on the basecalled and fully processed
 reads (using of course the accompanying *qual file). Do you suggest that I
 should redo the assembly after filtering out sequences being shorter than a
-certain length (e.g. those that are <200bp)? In other words, am I taking into
+certain length (eg those that are <200bp)? In other words, am I taking into
 account low quality sequences if I do the assembly the way the sequencing
 company did it (fully processed reads + quality files)?
       </screen>
@@ -635,7 +637,7 @@ company did it (fully processed reads + quality files)?
       <para>
 	Long deletions (longer than read length): they'll be tagged with MCVc tag by
 	MIRA ins the consensus. Additionally, when looking at the FASTA files when
-	running the CAF result through miraconvert: long stretches of
+	running the CAF result through convert_project: long stretches of
 	sequences without coverage (the @ sign in the FASTAs) of <emphasis>X</emphasis> show missing
 	genomic DNA.
       </para>
@@ -771,7 +773,7 @@ company did it (fully processed reads + quality files)?
       <para>
       </para>
       <para>
-	For eukaryotes, yes. Please also consult the <arg>-KS:mnr</arg> option.
+	For eukaryotes, yes. Please also consult the -SK:mnr option.
       </para>
       <para>
 	Remember: you still <emphasis role="bold">MUST</emphasis> have sequencing vectors and adaptors
@@ -824,7 +826,7 @@ company did it (fully processed reads + quality files)?
       <para>
       </para>
       <para>
-	(spaces inserted just as visual helper in the example sequence, they would not
+	(spaces inserted just as visual helper in the example sequence, they would not 
 	occur in the real stuff)
       </para>
       <para>
@@ -847,12 +849,12 @@ company did it (fully processed reads + quality files)?
       <para>
       </para>
       <para>
-	The part with the Xs was masked away by your repeat masker. Now, when MIRA
-	loads the FASTA, it will first apply the clippings from the XML file (they're
-	still the same). Then, if the option to clip away masked areas of a read
-	(-CL:mbc, which is normally on for EST projects), it will search for the
-	stretches of X and internally also put clips to the sequence. In the example
-	above, only the following sequence would remain as "working sequence" (the
+	The part with the Xs was masked away by your repeat masker. Now, when MIRA 
+	loads the FASTA, it will first apply the clippings from the XML file (they're 
+	still the same). Then, if the option to clip away masked areas of a read 
+	(-CL:mbc, which is normally on for EST projects), it will search for the 
+	stretches of X and internally also put clips to the sequence. In the example 
+	above, only the following sequence would remain as "working sequence" (the 
 	clipped parts would still be present, but not used for any computation.
       </para>
       <screen>
@@ -877,8 +879,8 @@ company did it (fully processed reads + quality files)?
 	boundaries and gap sizes.
       </para>
       <para>
-	Now, if you look at the sequence above, you will see two possible poly-A
-	tails ... at least the real poly-A tail should be masked else you will get
+	Now, if you look at the sequence above, you will see two possible poly-A 
+	tails ... at least the real poly-A tail should be masked else you will get 
 	megahubs with all the other reads having the poly-A tail.
       </para>
       <para>
@@ -957,7 +959,7 @@ company did it (fully processed reads + quality files)?
 	same).
       </para>
       <para>
-	Countermeasures to take are:
+	Countermeasures to take are: 
       </para>
       <itemizedlist>
 	<listitem>
@@ -974,9 +976,9 @@ company did it (fully processed reads + quality files)?
 	</listitem>
 	<listitem>
 	  <para>
-	    only after the above steps have been made, use
-	    the <arg>-KS:mnr</arg> switch to let mira automatically mask nasty
-	    repeats, adjust the threshold with <arg>-SK:rt</arg>.
+	    only after the above steps have been made, use the -SK:mnr switch to let
+	    mira automatically mask nasty repeats, adjust the threshold with
+	    -SK:rt
 	  </para>
 	</listitem>
 	<listitem>
@@ -1003,21 +1005,21 @@ company did it (fully processed reads + quality files)?
       <para>
       </para>
       <para>
-	That's quite normal in the first few passes of an assembly. During each pass
-	(-AS:nop), contigs get built one by one. After a contig has been finished, it
-	checks itself whether it can find misassemblies due to repeats (and marks
-	these internally). If no misassembly, perfect, build next contig. But if yes,
+	That's quite normal in the first few passes of an assembly. During each pass 
+	(-AS:nop), contigs get built one by one. After a contig has been finished, it 
+	checks itself whether it can find misassemblies due to repeats (and marks 
+	these internally). If no misassembly, perfect, build next contig. But if yes, 
 	the contig requests immediate re-assembly of itself.
       </para>
       <para>
-	But this can happen only a limited number of times (governed by -AS:rbl). If
-	there are still misassemblies, the contig is stored away anyway ... chances
-	are good that in the next full pass of the assembler, enough knowledge has
+	But this can happen only a limited number of times (governed by -AS:rbl). If 
+	there are still misassemblies, the contig is stored away anyway ... chances 
+	are good that in the next full pass of the assembler, enough knowledge has 
 	been gained top correctly place the reads.
       </para>
       <para>
-	So, you need to worry only if these messages still appear during the last
-	pass. The positions that cause this are marked with "SRMc" tags in the
+	So, you need to worry only if these messages still appear during the last 
+	pass. The positions that cause this are marked with "SRMc" tags in the 
 	assemblies (CAF, ACE in the result dir; and some files in the info dir).
       </para>
     </sect2>
@@ -1046,7 +1048,7 @@ company did it (fully processed reads + quality files)?
 	<listitem>
 	  <para>
 	    sequences almost completely masked by the nasty repeat masker
-	    (<arg>-KS:mnr</arg>)
+	    (<arg>-SK:mnr</arg>)
 	  </para>
 	</listitem>
 	<listitem>
@@ -1148,3 +1150,4 @@ company did it (fully processed reads + quality files)?
     </sect2>
   </sect1>
 </chapter>
+
diff --git a/doc/docbook/chap_hard_part.xml b/doc/docbook/chap_hard_part.xml
index 8ff1bc4..abaed31 100644
--- a/doc/docbook/chap_hard_part.xml
+++ b/doc/docbook/chap_hard_part.xml
@@ -3,12 +3,15 @@
 <chapter id="chap_hard">
   <chapterinfo>
     <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="versionfile"/>
+    <releaseinfo>
+      <emphasis role="light">Document revision	$Id$</emphasis>
+    </releaseinfo>
     <author>
       <firstname>Bastien</firstname>
       <surname>Chevreux</surname>
       <email>bach at chevreux.org</email>
     </author>
-    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="copyrightfile"/>
+    <copyright><year>2011</year><holder>Bastien Chevreux</holder></copyright>
   </chapterinfo>
   <blockquote>
     <attribution>Solomon Short</attribution>
@@ -17,8 +20,9 @@
       </quote></emphasis>
     </para>
   </blockquote>
+
   <title>Assembly of <emphasis>hard</emphasis> genome or EST / RNASeq projects</title>
-  <sect1 id="sect_hard_getting_mean_data_assembled">
+  <sect1 id="sect_hard_getting_mean_genomes_assembled">
     <title>
       Getting 'mean' genomes or EST / RNASeq data sets assembled
     </title>
@@ -40,15 +44,14 @@
 	For the impatient
       </title>
       <para>
-	For bacteria with nasty repeats, try first
-	<arg>--hirep_something</arg>. This will increase runtime and memory
-	requirements, but helps to get this sorted out. If the data for lower
-	eukaryotes leads to runtime and memory explosion, try either
-	<arg>--hirep_good</arg> or, for desperate cases,
-	<arg>--hirep_something</arg>.
+	Use <arg>-SK:mnr=yes:nrr=10</arg> and give it a try. If that does not
+	work, decrease <arg>-SK:nrr</arg> to anywhere between 5 and 9. If it
+	worked well enough increase the <arg>-SK:nrr</arg> parameter up to 15
+	or 20. But please also read on to see how to choose the "nrr"
+	threshold.
       </para>
     </sect2>
-    <sect2 id="sect_hard_introduction_to_masking">
+    <sect2 id="sect_hard_introduction_to_'masking'">
       <title>
 	Introduction to 'masking'
       </title>
@@ -69,20 +72,20 @@
 	choose a threshold from where on MIRA won't care about repetitive matches.
       </para>
       <para>
-	The key to this are the three fail-safe command line parameters which will mask
-	"nasty" repeats from the quick overlap finder (SKIM): <arg>-KS:mnr</arg> and
-	<arg>-KS:nrr</arg> respectively <arg>-KS:nrc</arg>. I'll come back
-	to <arg>-SK:kms</arg> later as it also plays a role in this.
+	The key to this are the two fail-safe command line parameters which will mask
+	"nasty" repeats from the quick overlap finder (SKIM): <arg>-SK:mnr</arg> and
+	<arg>-SK:nrr=10</arg>. <arg>-SK:bph</arg> also plays a role in this, but I'll
+	come back to this later).
       </para>
     </sect2>
-    <sect2 id="sect_hard_how_does_nasty_repeat_masking_work">
+    <sect2 id="sect_hard_how_does_nasty_repeat_masking_work?">
       <title>
-	How does 'nasty repeat' masking work?
+	How does "nasty repeat" masking work?
       </title>
       <para>
       </para>
       <para>
-	If switched on <arg>-KS:mnr=yes</arg>, MIRA will use k-mer statistics to
+	If switched on <arg>-SK:mnr=yes</arg>, MIRA will use SKIM3 k-mer statistics to
 	find repetitive stretches. K-mers are nucleotide stretches of length k. In a
 	perfectly sequenced genome without any sequencing error and without sequencing
 	bias, the k-mer frequency can be used to assess how many times a given
@@ -115,14 +118,13 @@
 	not be used as seed.
       </para>
       <para>
-	Some reads will invariably end up being completely repetitive. These
-	will not be assembled into contigs as MIRA will not see overlaps as
-	they'll be completely masked away. These reads will end up as
-	debris. However, note that MIRA is pretty good at discerning 100%
-	matching repeats from repeats which are not 100% matching: if there's
-	a single base with which repeats can be discerned from each other,
-	MIRA will find this base and use the k-mers covering that base to find
-	overlaps.
+	Some reads will invariably end up being completely repetitive. These will not
+	be assembled into contigs as MIRA will not see overlaps as they'll be
+	completely masked away. These reads will end up as debris. However, note that
+	MIRA is pretty good at discerning 100% matching repeats from repeats which
+	are not 100% matching: if there's a single base with which repeats can be
+	discerned from each other, MIRA will find this base and use the k-mers
+	covering that base to find overlaps.
       </para>
     </sect2>
     <sect2 id="sect_hard_selecting_a_nasty_repeat_ratio">
@@ -132,10 +134,10 @@
       <para>
       </para>
       <para>
-	The ratio from which on the MIRA kmer statistics algorithm won't
-	report matches is set via <arg>-KS:nrr</arg>. E.g.,
-	using <arg>-KS:nrr=10</arg> will hide all k-mers which occur at a
-	frequency 10 times (or more) higher than the median of all k-mers.
+	The ratio from which on the MIRA SKIM algorithm won't report matches is set
+	via <arg>-SK:nrr</arg>. E.g., using <arg>-SK:nrr=10</arg> will hide all k-mers
+	which occur at a frequency 10 times (or more) higher than the median of all
+	k-mers.
       </para>
       <para>
 	The nastiness of a repeat is difficult to judge, but starting with 10 copies
@@ -143,12 +145,11 @@
 	troubles for sure.
       </para>
       <para>
-	The standard values of <emphasis>10</emphasis> for
-	the <arg>-KS:nrr</arg> parameter is a pretty good 'standard' value
-	which can be tried for an assembly before trying to optimise it via
-	studying the kmer statistics calculated by MIRA. For the later, please
-	read the section 'Examples for kmer statistics' further down in this
-	guide.
+	The standard values of <emphasis>10</emphasis> for the <arg>-SK:nrr</arg> parameter is a
+	pretty good 'standard' value which can be tried for an assembly before trying
+	to optimise it via studying the hash statistics calculated by MIRA. For the
+	later, please read the section 'Examples for hash statistics' further down in
+	this guide.
       </para>
     </sect2>
   </sect1>
@@ -161,7 +162,7 @@
       k-mer in all reads of a sequencing project, giving them different
       status. Additionally, tags are set in the reads so that one can
       assess reads in assembly editors that understand tags (like gap4,
-      gap5, consed etc.). The following tags are used:
+      gap5, consed etc.). The following tags are used: 
     </para>
     <variablelist>
       <varlistentry>
@@ -187,7 +188,7 @@
 	  HAF4
 	</term>
 	<listitem>
-	  <para> coverage above average ( default: > 1.5 times average and < 2 times average)
+	  <para> coverage above average ( default: > 1.5 times average and < 2 times average) 
 	  </para>
 	</listitem>
       </varlistentry>
@@ -196,7 +197,7 @@
 	  HAF5
 	</term>
 	<listitem>
-	  <para> probably repeat ( default: ≥ 2 times average and < 5 times average)
+	  <para> probably repeat ( default: ≥ 2 times average and < 5 times average) 
 	  </para>
 	</listitem>
       </varlistentry>
@@ -214,9 +215,8 @@
 	  MNRr
 	</term>
 	<listitem>
-	  <para> stretches which were masked away by <arg>-KS:<replaceable>mnr=yes</replaceable></arg>
-	  being more repetitive than deduced
-	  by <arg>-KS:<replaceable>nrr=...</replaceable></arg> or given via <arg>-KS:<replaceable>nrc=...</replaceable></arg>.
+	  <para> stretches which were masked away by <arg>-SK:<replaceable>mnr=yes</replaceable></arg> 
+	  being more that <arg>-SK:<replaceable>nnr=...</replaceable></arg> repetitive.
 	  </para>
 	</listitem>
       </varlistentry>
@@ -229,7 +229,7 @@
       The readrepeats info file
     </title>
     <para>
-      If <arg>-KS:mnr=yes</arg> is used, MIRA will write an additional file into the
+      If <arg>-SK:mnr=yes</arg> is used, MIRA will write an additional file into the
       info directory:
       <filename><projectname>_info_readrepeats.lst</filename>
     </para>
@@ -239,7 +239,7 @@
       sequence as "key" and then the type of repeat (HAF2 - HAF7 and MNRr) and
       the repeat sequence as "values". "Nasty" in this case means
       <emphasis>everything which was masked via
-      <arg>-KS:mnr=yes</arg></emphasis>.
+      <arg>-SK:mnr=yes</arg></emphasis>.
     </para>
     <para>
       The file looks like this:
@@ -259,7 +259,7 @@ etc.
       seen to be repetitive.
     </para>
     <para>
-      Note that reads can have several disjunct repeat stretches in a single
+      Note that reads can have several disjunct repeat stetches in a single
       read, hence they can occur more than one time in the file as shown with
       <emphasis>read2</emphasis> in the example above.
     </para>
@@ -291,7 +291,7 @@ etc.
     <para>
       There's one very simple trick to find out whether your data contains
       some kind of sequencing vector or adaptor contamination which I use. it
-      makes use of the read repeat file discussed above.
+      makes use of the read repat file discussed above.
     </para>
     <para>
       The following example shows this exemplarily on a 454 data where the
@@ -318,7 +318,7 @@ etc.
     324 GGTACTCGTATAGTGACACGCAACAGGGGATAGACAAGGCAC</screen>
     <para>
       You probably see a sequence pattern
-      CTCGTATAGTGACACGCAACAGGGGATAGACAAGGCAC in the above screens hot. Before
+      CTCGTATAGTGACACGCAACAGGGGATAGACAAGGCAC in the above screenshot. Before
       going into details of what you are actually seeing, here's the
       explanation how this pipeline works:
     </para>
@@ -417,7 +417,7 @@ AAACTCGTATAGTGACACGCAACAGGGGATA
 	    output consists of a tab delimited format in two columns: the
 	    first column contains the number of times a given line (sequence
 	    in our case) was seen, the second column contains the line
-	    (sequence) itself. An exemplarily output looks like this (only first 15 lines shown):
+	    (sequence) itself. An exemplariy output looks like this (only first 15 lines shown):
 	  </para>
 	  <screen>      1 AAACTCGTATAGTGACACGCA
       1 AAACTCGTATAGTGACACGCAACAGG
@@ -468,7 +468,7 @@ AAACTCGTATAGTGACACGCAACAGGGGATA
 ...</screen>
 	</listitem>
       </varlistentry>
-    </variablelist>
+    </variablelist> 
     <para>
       So, what is this ominous CTCGTATAGTGACACGCAACAGGGGATAGACAAGGCAC you are
       seeing? To make it short: a modified 454 B-adaptor with an additional MID sequence.
@@ -490,24 +490,24 @@ AAACTCGTATAGTGACACGCAACAGGGGATA
       </para>
     </note>
   </sect1>
-  <sect1 id="sect_hard_examples_for_kmer_statistics">
+  <sect1 id="sect_hard_examples_for_hash_statistics">
     <title>
-      Examples for kmer statistics
+      Examples for hash statistics
     </title>
     <para>
       Selecting the right ratio so that an assembly fits into your memory is not
       straight forward. But MIRA can help you a bit: during assembly, some frequency
       statistics are printed out (they'll probably end up in some info file in later
-      releases). Search for the term "Kmer statistics" in the information printed
+      releases). Search for the term "Hash statistics" in the information printed
       out by MIRA (this happens quite early in the process)
     </para>
-    <sect2 id="sect_hard_caveat:_sk:kms">
+    <sect2 id="sect_hard_caveat:_sk:bph">
       <title>
-	Caveat: -SK:kmer_size
+	Caveat: -SK:bph
       </title>
       <para>
-	Some explanation how kmer size affects the statistics and why it
-	should be chosen >=16 for <arg>-KS:mnr</arg>
+	Some explanation how bph affects the statistics and why it should be chosen
+	>=16 for <arg>-SK:mnr</arg>
       </para>
     </sect2>
     <sect2 id="sect_hard_sanger_sequencing_a_simple_bacterium">
@@ -519,7 +519,7 @@ AAACTCGTATAGTGACACGCAACAGGGGATA
 	sequencing was used:
       </para>
       <screen>
-Kmer statistics:
+Hash statistics:
 =========================================================
 Measured avg. coverage: 15
 
@@ -547,7 +547,7 @@ Repeat ratio histogram:
       </screen>
       <para>
 	The above can be interpreted like this: the expected coverage of the genome is
-	15x. Starting with an estimated kmer frequency of 29, MIRA will treat a k-mer
+	15x. Starting with an estimated hash frequency of 29, MIRA will treat a k-mer
 	as 'repetitive'. As shown in the histogram, the overall picture of this
 	project is pretty healthy:
       </para>
@@ -567,7 +567,7 @@ Repeat ratio histogram:
 	</listitem>
 	<listitem>
 	  <para>
-	    there is a small fraction of k-mers with repeat level of 2-10
+	    there is a small fraction of k-mers with repeat level of 2-10 
 	  </para>
 	</listitem>
 	<listitem>
@@ -588,7 +588,7 @@ Repeat ratio histogram:
 	sequencing):
       </para>
       <screen>
-Kmer statistics:
+Hash statistics:
 =========================================================
 Measured avg. coverage: 20
 
@@ -707,7 +707,7 @@ Repeat ratio histogram:
       <para>
       </para>
       <screen>
-Kmer statistics:
+Hash statistics:
 =========================================================
 Measured avg. coverage: 23
 
@@ -773,7 +773,7 @@ Repeat ratio histogram:
 =========================================================
       </screen>
       <para>
-	This kmer statistics shows that MG1655 is pretty boring (from a
+	This hash statistics shows that MG1655 is pretty boring (from a
 	repetitive point of view). One might expect a few repeats but nothing
 	fancy: The repeats are actually the rRNA and sRNA stretches in the
 	genome plus some intergenic regions.
@@ -817,3 +817,4 @@ Repeat ratio histogram:
     </sect2>
   </sect1>
 </chapter>
+
diff --git a/doc/docbook/chap_installation_part.xml b/doc/docbook/chap_installation_part.xml
index db61505..70d5699 100644
--- a/doc/docbook/chap_installation_part.xml
+++ b/doc/docbook/chap_installation_part.xml
@@ -3,12 +3,15 @@
 <chapter id="chap_installation">
   <chapterinfo>
     <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="versionfile"/>
+    <releaseinfo>
+      <emphasis role="light">Document revision	$Id$</emphasis>
+    </releaseinfo>
     <author>
       <firstname>Bastien</firstname>
       <surname>Chevreux</surname>
       <email>bach at chevreux.org</email>
     </author>
-    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="copyrightfile"/>
+    <copyright><year>2011</year><holder>Bastien Chevreux</holder></copyright>
   </chapterinfo>
   <blockquote>
     <attribution>Solomon Short</attribution>
@@ -28,13 +31,14 @@
     </para>
     <para>
       There you will normally find a couple of precompiled binaries -- usually
-      for Linux and Mac OSX -- or the source package for compiling yourself.
+      for Linux, sometimes also for Mac OSX -- or the source package for
+      compiling yourself.
     </para>
     <para>
       Precompiled binary packages are named in the following way:
     </para>
     <para>
-      <filename>mira_<replaceable>miraversion</replaceable>_<replaceable>OS-and-binarytype</replaceable>.tar.bz2</filename>
+      <filename>mira_<replaceable>miraversion</replaceable>_<replaceable>audience</replaceable>_<replaceable>OS-and-binarytype</replaceable>.tar.bz2</filename>
     </para>
     <para>
       where
@@ -42,32 +46,31 @@
     <itemizedlist>
       <listitem>
 	<para>
-	  For <filename><replaceable>miraversion</replaceable></filename>, the
-	  stable versions of MIRA with the general public as audience usually
-	  have a version number in three parts, like
-	  <filename>3.0.5</filename>, sometimes also followed by some postfix
-	  like in <filename>3.2.0rc1</filename> to denote release candidate 1
-	  of the 3.2.0 version of MIRA. On very rare occasions, stable
-	  versions of MIRA can have four part like in, e.g.,
-	  <filename>3.4.0.1</filename>: these versions create identical
-	  binaries to their parent version (<filename>3.4.0</filename>) and
-	  just contains fixes to the source build machinery.
+	  <filename><replaceable>miraversion</replaceable></filename> is usually
+	  a version number in three parts, like <filename>3.0.5</filename>,
+	  sometimes also followed by some postfix like in
+	  <filename>3.2.0rc1</filename> to denote release candidate 1 of the
+	  3.2.0 version of MIRA.
+	</para>
+      </listitem>
+      <listitem>
+	<para>
+	  <filename><replaceable>audience</replaceable></filename> is either
+	  <filename>prod</filename> or <filename>dev</filename>; denoting
+	  either a <emphasis>production</emphasis> or a
+	  <emphasis>development</emphasis> version.
 	</para>
 	<para>
-	  The version string sometimes can have a different format:
-	  <filename><emphasis>sometext</emphasis>-0-g<emphasis>somehexnumber</emphasis></filename>
-	  like in, e.g.,
-	  <filename>ft_fastercontig-0-g4a27c91</filename>. These versions of
-	  MIRA are snapshots from the development tree of MIRA and usually
-	  contain new functionality which may not be as well tested as the
-	  rest of MIRA, hence contains more checks and more debugging output
-	  to catch potential errors
+	  The development version usually contains more checks and more
+	  debugging output to catch potential errors, hence it might run
+	  slower. Furthermore, development versions may contain some new code
+	  which did not get as extensive testing as usual.
 	</para>
       </listitem>
       <listitem>
 	<para>
 	  <filename><replaceable>OS-and-binarytype</replaceable></filename>
-	  finally defines for which operating system and which processor class
+	  finally define for which operating system and which processor class
 	  the package is destined. E.g.,
 	  <filename>linux-gnu_x86_64_static</filename> contains static
 	  binaries for Linux running a 64 bit processor.
@@ -141,590 +144,13 @@
     <title>
       Compiling MIRA yourself
     </title>
-    <sect2 id="sect_install_comp_prereq">
-      <title>
-	Prerequisites
-      </title>
-      <para>
-	The MIRA 3.x series works with quite old systems, the upcoming 4.x
-	series will need a C++11 compatible tool chain, i.e., systems starting
-	from the later half of 2011 should be OK. The requisites for
-	<emphasis>compiling</emphasis> MIRA are:
-      </para>
-      <itemizedlist>
-	<listitem>
-	  <para>
-	    gcc ≥ 4.8.1, with libstdc++6. You really want to use a simple
-	    installation package pre-configured for your system, but in case you
-	    want or have to install gcc yourself, please refer to <ulink
-	    url="http://gcc.gnu.org/"/> for more information on the GNU compiler
-	    collection.
-	  </para>
-	</listitem>
-	<listitem>
-	  <para>
-	    BOOST library ≥ 1.48. Lower versions might work, but
-	    untested. You would need to change the checking in the configure
-	    script for this to run through. You really want to use a simple
-	    installation package pre-configured for your system, but in case you
-	    want or have to install BOOST yourself, please refer to <ulink
-	    url="http://www.boost.org/"/> for more information on the BOOST
-	    library.
-	  </para>
-	  <warning>
-	    Do NOT use a so called <emphasis>staged</emphasis> BOOST library,
-	    only a fully installed library will work at the moment
-	  </warning>
-	</listitem>
-	<listitem>
-	  zlib. Should your system not have zlib installed or available as
-	  simple installation package, please see <ulink
-	  url="http://www.zlib.net/"/> for more information regarding zlib.
-	</listitem>
-	<listitem>
-	  GNU make. Should your system not have gmake installed or available
-	  as simple installation package, please see <ulink
-	  url="www.gnu.org/software/make/"/> for more information regarding
-	  GNU make.
-	</listitem>
-	<listitem>
-	  GNU flex ≥ 2.5.33. Should your system not have flex installed or
-	  available as simple installation package, please see <ulink
-	  url="http://flex.sourceforge.net/"/> for more information regarding
-	  flex.
-	</listitem>
-	<listitem>
-	  Expat library ≥ 2.0.1. Should your system not have the Expat library and
-	  header files already installed or available as simple installation
-	  package, you will need to download and install a yourself. Please see
-	  <ulink url="http://www.libexpat.org/"/> and <ulink
-	  url="http://sourceforge.net/projects/expat/"/> for information on how
-	  to do this.
-	</listitem>
-	<listitem>
-	  xxd. A small utility from the <command>vim</command> package.
-	</listitem>
-      </itemizedlist>
-      <para>
-	For <emphasis>building the documentation</emphasis>, additional
-	prerequisites are from the DocBook tool chain:
-      </para>
-      <itemizedlist>
-	<listitem>
-	  xsltproc + docbook-xsl for HTML output
-	</listitem>
-	<listitem>
-	  dblatex for PDF output
-	</listitem>
-      </itemizedlist>
-      <warning>
-	<para>
-	  Previous versions of MIRA had a benefit by using the TCMalloc
-	  library. This is not the case anymore! Indeed, tests showed that when
-	  using TCMalloc, MIRA 4.9.x and above will probably need 20 to
-	  30% <emphasis>more</emphasis> max memory and up to 80% more overall
-	  memory than without TCMalloc.
-	</para>
-	<para>
-	  In short: do not use at the moment.
-	</para>
-      </warning>
-    </sect2>
-    <sect2 id="sect_install_comp_comp">
-      <title>
-	Compiling and installing
-      </title>
-      <para>
-	MIRA uses the GNU autoconf/automake tools, please read the section
-	"Basic Installation" of the <filename>INSTALL</filename> file in the
-	source package of MIRA for more generic information on how to invoke
-	them.
-      </para>
-      <para>
-	The short version: simply type
-      </para>
-      <screen>
-<prompt>arcadia:/path/to/mira-4.0.0$</prompt> <userinput>./configure</userinput>
-<prompt>arcadia:/path/to/mira-4.0.0$</prompt> <userinput>make</userinput>
-<prompt>arcadia:/path/to/mira-4.0.0$</prompt> <userinput>make install</userinput></screen>
-      <para>
-	This should install the following programs:
-      </para>
-      <itemizedlist>
-	<listitem>
-	  <command>mira</command>
-	</listitem>
-	<listitem>
-	  <command>miraconvert</command>
-	</listitem>
-	<listitem>
-	  <command>mirabait</command>
-	</listitem>
-	<listitem>
-	  <command>miramem</command>
-	</listitem>
-      </itemizedlist>
-      <para>
-	Should the <literal>./configure</literal> step fail for some reason or
-	another, you should get a message telling you at which step this
-	happens and and either install missing packages or tell
-	<command>configure</command> where it should search the packages it
-	did not find, see also next section.
-      </para>
-    </sect2>
-    <sect2 id="sect_install_comp_conf">
-      <title>
-	Configure switches for MIRA
-      </title>
-      <para>
-	MIRA understands all standard autoconf configure switches like <literal>--prefix=</literal>
-	etc. Please consult the INSTALL file in the MIRA top level directory
-	of the source package and also call <literal>./configure
-	--help</literal> to get a full list of currently supported switches.
-      </para>
-      <sect3 id="sect_install_comp_conf_boost">
-	<title>
-	  BOOST configure switches for MIRA
-	</title>
-	<para>
-	  BOOST is maybe the most tricky library to get right in case it does
-	  not come pre-configured for your system. The two main switches for
-	  helping to locate BOOST are
-	  probably <literal>--with-boost=[ARG]</literal>
-	  and <literal>--with-boost-libdir=LIB_DIR</literal>. Only if those
-	  two fail, try using the other <literal>--with-boost-*=</literal> switches
-	  you will see from the ./configure help text.
-	</para>
-      </sect3>
-      <sect3 id="sect_install_comp_conf_mira">
-	<title>
-	  MIRA specific configure switches
-	</title>
-	<para>
-	  MIRA honours the following switches:
-	</para>
-	<variablelist>
-	  <varlistentry>
-	    <term>
-	      --enable-64=yes/no
-	    </term>
-	    <listitem>
-	      <para>
-		MIRA should happily build as 32 bit executable on 32 bit
-		platforms and as 64 bit executable on 64 bit platforms. On 64
-		bit platforms, setting the switch to 'no' forces the compiler
-		to produce 32 bit executables (if possible)
-	      </para>
-	      <warning>
-		As of MIRA 3.9.0, support for 32 bit platforms is being
-		slowly phased out. While MIRA should compile and also run fine
-		on 32 bit platforms, I do not guarantee it anymore as I
-		haven't used 32 bit systems in the last 5 years.
-	      </warning>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term>
-	      --enable-warnings
-	    </term>
-	    <listitem>
-	      Enables compiler warnings, useful only for developers, not for users.
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term>
-	      --enable-debug
-	    </term>
-	    <listitem>
-	      Lets the MIRA binary contain C/C++ debug symbols.
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term>
-	      --enable-mirastatic
-	    </term>
-	    <listitem>
-	      Builds static binaries which are easier to distribute. Some
-	      platforms (like OpenSolaris) might not like this and you will
-	      get an error from the linker.
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term>
-	      --enable-optimisations
-	    </term>
-	    <listitem>
-	      Instructs the configure script to set optimisation switches for compiling
-	      (on by default). Switching optimisations off (warning, high impact on
-	      run-time) might be interesting only for, e.g, debugging with valgrind.
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term>
-	      --enable-publicquietmira
-	    </term>
-	    <listitem>
-	      Some parts of MIRA can dump additional debug information during
-	      assembly, setting this switch to "no" performs this. Warning:
-	      MIRA will be a bit chatty, using this is not recommended for
-	      public usage.
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term>
-	      --enable-developmentversion
-	    </term>
-	    <listitem>
-	      Using MIRA with enabled development mode may lead to extra
-	      output on stdout as well as some additional data in the results
-	      which should not appear in real world data
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term>
-	      --enable-boundtracking
-	    </term>
-	  </varlistentry>
-	  <varlistentry>
-	    <term>
-	      --enable-bugtracking
-	    </term>
-	    <listitem>
-	      Both flags above compile in some basic checks into mira that
-	      look for sanity within some functions: Leaving this on "yes"
-	      (default) is encouraged, impact on run time is minimal
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term>
-	    </term>
-	    <listitem>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term>
-	    </term>
-	    <listitem>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term>
-	    </term>
-	    <listitem>
-	    </listitem>
-	  </varlistentry>
-	</variablelist>
-      </sect3>
-    </sect2>
-  </sect1>
-  <sect1 id="sect_install_walkthroughs">
-    <title>
-      Installation walkthroughs
-    </title>
-    <sect2 id="sect_install_walkthroughs_kubuntu">
-      <title>
-	(K)Ubuntu 12.04
-      </title>
-      <para>
-	You will need to install a couple of tools and libraries before
-	compiling MIRA. Here's the recipe:
-      </para>
-      <screen>
-<userinput>sudo apt-get install make flex
-sudo apt-get install libboost-doc libboost.*1.48-dev libboost.*1.48.0</userinput></screen>
-<!--libexpat1-dev zlib1g-dev-->
-      <para>
-	Once this is done, you can unpack and compile MIRA. For a dynamically
-	linked version, use:
-      </para>
-      <screen>
-<userinput>tar xvjf <replaceable>mira-4.0.0.tar.bz2</replaceable>
-cd <replaceable>mira-4.0.0</replaceable>
-./configure
-make && make install</userinput></screen>
-      <para>
-	For a statically linked version, just change the configure line from
-	above into
-      </para>
-      <screen>
-<userinput>./configure <replaceable>--enable-mirastatic</replaceable></userinput></screen>
-      <para>
-	In case you also want to build documentation yourself, you will need
-	this in addition:
-      </para>
-      <screen><userinput>sudo apt-get install xsltproc docbook-xsl dblatex</userinput></screen>
-      <note>
-	<para>
-	  People working on git checkouts of the MIRA source code will
-	  obviously need some more tools. Get them with this:
-	</para>
-	<screen><userinput>sudo apt-get install automake libtool xutils-dev</userinput></screen>
-      </note>
-    </sect2>
-    <sect2 id="sect_install_walkthroughs_opensuse">
-      <title>
-	openSUSE 12.1
-      </title>
-      <para>
-	You will need to install a couple of tools and libraries before
-	compiling MIRA. Here's the recipe:
-      </para>
-      <screen>
-<userinput>sudo zypper install gcc-c++ boost-devel
-sudo zypper install flex libexpat-devel zlib-devel</userinput></screen>
-<!--libexpat1-dev zlib1g-dev-->
-      <para>
-	Once this is done, you can unpack and compile MIRA. For a dynamically
-	linked version, use:
-      </para>
-      <screen>
-<userinput>tar xvjf <replaceable>mira-4.0.0.tar.bz2</replaceable>
-cd <replaceable>mira-4.0.0</replaceable>
-./configure
-make && make install</userinput></screen>
-      <para>
-	In case you also want to build documentation yourself, you will need
-	this in addition:
-      </para>
-      <screen><userinput>sudo zypper install docbook-xsl-stylesheets dblatex</userinput></screen>
-      <note>
-	<para>
-	  People working on git checkouts of the MIRA source code will
-	  obviously need some more tools. Get them with this:
-	</para>
-	<screen><userinput>sudo zypper install automake libtool xutils-dev</userinput></screen>
-      </note>
-    </sect2>
-    <sect2 id="sect_install_walkthroughs_fedora">
-      <title>
-	Fedora 17
-      </title>
-      <para>
-	You will need to install a couple of tools and libraries before
-	compiling MIRA. Here's the recipe:
-      </para>
-      <screen>
-<userinput>sudo yum -y install gcc-c++ boost-devel
-sudo yum install flex expat-devel vim-common zlib-devel</userinput></screen>
-<!--libexpat1-dev zlib1g-dev-->
-      <para>
-	Once this is done, you can unpack and compile MIRA. For a dynamically
-	linked version, use:
-      </para>
-      <screen>
-<userinput>tar xvjf <replaceable>mira-4.0.0.tar.bz2</replaceable>
-cd <replaceable>mira-4.0.0</replaceable>
-./configure
-make && make install</userinput></screen>
-      <para>
-	In case you also want to build documentation yourself, you will need
-	this in addition:
-      </para>
-      <screen><userinput>sudo yum -y install docbook-xsl dblatex</userinput></screen>
-      <note>
-	<para>
-	  People working on git checkouts of the MIRA source code will
-	  obviously need some more tools. Get them with this:
-	</para>
-	<screen><userinput>sudo yum -y install automake libtool xorg-x1-util-devel</userinput></screen>
-      </note>
-    </sect2>
-    <sect2 id="sect_install_walkthroughs_allfromscratch">
-      <title>
-	Compile everything from scratch
-      </title>
-      <para>
-	This lets you build a self-contained static MIRA binary. The only
-	prerequisite here is that you have a working <command>gcc</command>
-	≥ 4.6.2. Please download all necessary files (expat, flex, etc.pp)
-	and then simply follow the script below. The only things that you will
-	want to change are the path used and, maybe, the name of some packages
-	in case they were bumped up a version or revision.
-      </para>
-      <para>
-	Contributed by Sven Klages.
-      </para>
-      <screen>
-## whatever path is appropriate
-<userinput>cd <replaceable>/home/gls/SvenTemp/install</replaceable></userinput>
-
-## expat
-<userinput>tar zxvf <replaceable>expat-2.0.1.tar.gz</replaceable>
-cd <replaceable>expat-2.0.1</replaceable>
-./configure <replaceable>--prefix=/home/gls/SvenTemp/expat</replaceable>
-make && make install</userinput>
-
-## flex
-<userinput>cd <replaceable>/home/gls/SvenTemp/install</replaceable>
-tar zxvf <replaceable>flex-2.5.35.tar.gz</replaceable>
-cd <replaceable>flex-2.5.35</replaceable>
-./configure <replaceable>--prefix=/home/gls/SvenTemp/flex</replaceable>
-make && make install
-cd <replaceable>/home/gls/SvenTemp/flex/bin</replaceable>
-ln -s flex flex++
-export PATH=<replaceable>/home/gls/SvenTemp/flex/bin</replaceable>:$PATH</userinput>
-
-## boost
-<userinput>cd <replaceable>/home/gls/SvenTemp/install</replaceable>
-tar zxvf <replaceable>boost_1_48_0.tar.gz</replaceable>
-cd <replaceable>boost_1_48_0</replaceable>
-./bootstrap.sh --prefix=<replaceable>/home/gls/SvenTemp/boost</replaceable>
-./b2 install</userinput>
-
-## mira itself
-<userinput>export CXXFLAGS="-I<replaceable>/home/gls/SvenTemp/flex/include</replaceable>"
-
-cd <replaceable>/home/gls/SvenTemp/install</replaceable>
-tar zxvf <replaceable>mira-3.4.0.1.tar.gz</replaceable>
-cd <replaceable>mira-3.4.0.1</replaceable>
-./configure --prefix=<replaceable>/home/gls/SvenTemp/mira</replaceable> \
---with-boost=<replaceable>/home/gls/SvenTemp/boost</replaceable> \
---with-expat=<replaceable>/home/gls/SvenTemp/expat</replaceable> \
---enable-mirastatic
-make && make install</userinput></screen>
-    </sect2>
-    <sect2 id="sect_install_walkthroughs_dynamic">
-      <title>
-	Dynamically linked MIRA
-      </title>
-      <para>
-	In case you do not want a static binary of MIRA, but a dynamically
-	linked version, the following script by Robert Bruccoleri will give
-	you an idea on how to do this.
-      </para>
-      <para>
-	Note that he, having root rights, puts all additional software in
-	/usr/local, and in particular, he keeps updated versions of Boost and
-	Flex there.
-      </para>
-      <screen>
-#!/bin/sh -x
-
-make distclean
-oze=`find . -name "*.o" -print`
-if [[ -n "$oze" ]]
-then
-   echo "Not clean."
-   exit 1
-
-fi
-
-export prefix=${BUILD_PREFIX:-/usr/local}
-export LDFLAGS="-Wl,-rpath,$prefix/lib"
-
-./configure --prefix=$prefix \
-           --enable-debug=yes \
-           --enable-mirastatic=no \
-           --with-boost-libdir=$prefix/lib \
-           --enable-optimisations \
-           --enable-boundtracking=yes \
-           --enable-bugtracking=yes \
-           --enable-extendedbugtracking=no
-make
-make install</screen>
-    </sect2>
-  </sect1>
-  <sect1 id="sect_install_hintotherplatforms">
-    <title>
-      Compilation hints for other platforms.
-    </title>
-    <sect2 id="sect_install_hintosx">
-      <title>
-	Mac OS X
-      </title>
-      <para>
-	This has been tested on OSX 10.6.4. You will need XCode (from Apple)
-	and some packages from MacPorts.
-      </para>
-      <orderedlist>
-	<listitem>Download and install a current XCode</listitem>
-	<listitem>Download and compile a current GCC (≥ 4.8.2). Do NOT use a
-	GCC from MacPorts, it lacks a vitally important library
-	(<filename>libstdc++.a</filename>)</listitem>
-	<listitem>Download, compile with GCC and install a current BOOST
-	library</listitem>
-	<listitem>Download, compile with GCC and install all libraries MIRA
-	needs (flex, etc.pp). Follow the directions given in <xref linkend="sect_install_walkthroughs_allfromscratch" xrefstyle="select: label quotedtitle pageabbrev"/> and <xref linkend="sect_install_walkthroughs_allfromscratch"/>
-	</listitem>
-	<listitem>Download the MIRA source package and unpack it</listitem>
-	<listitem>
-	  <para>
-	    In the unpacked MIRA directory, create a directory called
-	    <filename>OSXstatlibs</filename>. Into this directory, you need to
-	    softlink all needed static libraries from GCC, BOOST, flex,
-	    etc.pp.
-	  </para>
-	  <para>
-	    E.g., I have GCC installed in
-	    <filename>/opt/localwgcc48/</filename> and therefore I need to use
-	    the following to link GCC static libraries:
-	  </para>
-	  <screen>
-<prompt>$</prompt> <userinput>ln -s <replaceable>/opt/localwgcc48/lib/*a</replaceable> .</userinput></screen>
-	  <para>
-	    I have all the other libraries (BOOST, flex, etc.pp) installed in
-	    <filename>/opt/biosw/</filename>, therefore I also need to link
-	    these libraries:
-	  </para>
-	  <screen>
-<prompt>$</prompt> <userinput>ln -s <replaceable>/opt/biosw/lib/*a</replaceable> .</userinput></screen>
-	</listitem>
-	<listitem>
-	  <para>
-	    Run <literal>./configure --enable-mirastatic ...</literal> where
-	    "..." stands for additional configure parameters needed and then
-	    run <literal>make</literal>.
-	  </para>
-	</listitem>
-      </orderedlist>
-      <note>
-	As of now (April 2014), if you are on OSX 10.9 (Mavericks) and are
-	using GCC ≤ 4.8.2, the steps described above
-	may not be enough. If an error occurs at the linking stage very late in
-	the MIRA building process, you need to patch a system file as described
-	in <ulink url="http://trac.macports.org/ticket/41033"/>
-      </note>
-      <note>
-	A checkout from git needs some packages from MacPorts:
-	<screen><prompt>$</prompt> <userinput>port install autoconf automake libtool</userinput></screen>
-      </note>
-      <note>
-	<para>
-	  Building documentation needs the packages 'libxslt' and 'dblatex' from MacPorts.
-	</para>
-	<screen><prompt>$</prompt> <userinput>port install dblatex libxslt</userinput></screen>
-	<para>
-	  (Feb 2014) The above may fail while installing the one or other
-	  dependency (for me it was while installing 'urw-fonts'). If that is
-	  the case, repeat a couple of times and normally it should work.
-	</para>
-      </note>
-    </sect2>
-    <sect2 id="sect_install_hintnetbsd5">
-      <title>
-	NetBSD 5 (i386)
-      </title>
-      <para>
-	Contributed by Thomas Vaughan
-      </para>
-      <para>
-	The system flex <emphasis>(/usr/bin/flex)</emphasis> is too old, but the
-	devel/flex package from a recent pkgsrc works fine. BSD make doesn't
-	like one of the lines in <emphasis>src/progs/Makefile</emphasis>, so use GNU make instead
-	(available from <emphasis>pkgsrc</emphasis> as <emphasis>devel/gmake</emphasis>). Other relevant pkgsrc packages:
-	<emphasis>devel/boost-libs</emphasis>, <emphasis>devel/boost-headers</emphasis>
-	and <emphasis>textproc/expat</emphasis>. The configure script has to
-	be told about these pkgsrc prerequisites (they are usually rooted
-	at <emphasis>/usr/pkg</emphasis> but other locations are possible):
-      </para>
-      <screen><userinput>FLEX=/usr/pkg/bin/flex ./configure --with-expat=/usr/pkg --with-boost=/usr/pkg</userinput></screen>
-      <para>
-	If attempting to build a pkgsrc package of MIRA, note that the LDFLAGS
-	passed by the pkgsrc mk files don't remove the need for
-	the <emphasis>--with-boost</emphasis> option.  The configure script
-	complains about flex being too old, but this is harmless because it
-	honours the $FLEX variable when writing out makefiles.
-      </para>
-    </sect2>
+    <para>
+      Please follow the instructions in the <filename>INSTALL</filename> file
+      on the top level of the source package.
+    </para>
+    <para>
+      Over time, things will be transferred to this help file.
+    </para>
   </sect1>
 </chapter>
+
diff --git a/doc/docbook/chap_intro_part.xml b/doc/docbook/chap_intro_part.xml
index 0c39d29..8a1af4f 100644
--- a/doc/docbook/chap_intro_part.xml
+++ b/doc/docbook/chap_intro_part.xml
@@ -3,12 +3,15 @@
 <chapter id="chap_intro">
   <chapterinfo>
     <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="versionfile"/>
+    <releaseinfo>
+      <emphasis role="light">Document revision	$Id$</emphasis>
+    </releaseinfo>
     <author>
       <firstname>Bastien</firstname>
       <surname>Chevreux</surname>
       <email>bach at chevreux.org</email>
     </author>
-    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="copyrightfile"/>
+    <copyright><year>2011</year><holder>Bastien Chevreux</holder></copyright>
   </chapterinfo>
   <blockquote>
     <attribution>Solomon Short</attribution>
@@ -18,14 +21,14 @@
     </para>
   </blockquote>
 
-  <title>Introduction to MIRA</title>
+  <title>Introduction to MIRA3</title>
   <sect1 id="sect_intro_whatismira">
     <title>
       What is MIRA?
     </title>
     <para>
       MIRA is a multi-pass DNA sequence data assembler/mapper for whole
-      genome and EST/RNASeq projects. MIRA assembles/maps reads gained by
+      genome and EST projects. MIRA assembles reads gained by
     </para>
     <itemizedlist>
       <listitem>
@@ -35,7 +38,7 @@
       </listitem>
       <listitem>
 	<para>
-	  454 pyro-sequencing (GS20, FLX or Titanium)
+	  454 pyrosequencing (GS20, FLX or Titanium)
 	</para>
       </listitem>
       <listitem>
@@ -88,7 +91,7 @@
       However, you very probably do not need to read everything.
     </para>
     <para>
-      You should read most of this introductional chapter though: e.g.,
+      You should read most of this introductionary chapter though: e.g.,
     </para>
       <itemizedlist>
 	<listitem>
@@ -103,7 +106,7 @@
 	</listitem>
 	<listitem>
 	  <para>
-	    the part which showcases different features of MIRA (lots of screen shots!)
+	    the part which showcases different features of MIRA (lots of screenshots!)
 	  </para>
 	</listitem>
 	<listitem>
@@ -114,18 +117,17 @@
       </itemizedlist>
     <para>
       After that, reading should depend on the type of data you intend to work
-      with: there are specific chapters for assembly of de-novo, of mapping and
-      of EST / RNASeq projects. They all contain an overview on how to
-      define your data and how to launch MIRA for these data sets. There is
-      also chapter on how to prepare data sets from specific sequencing
-      technologies.
+      with: there are specific chapters for Sanger, 454, Solexa, IonTorrent
+      and PacBio data, all of which containing an overview on how to prepare
+      your data and how to launch MIRA for these data sets. There are also
+      complete walkthroughs which exemplarily show from start to end one way
+      of doing an assembly for a specific data set and what to do with the
+      results of the assembly.
     </para>
     <para>
-      The chapter on working with results of MIRA should again be of general
-      interest to everyone. It describes the structure of output directories
-      and files and gives first pointers on what to find where. Also,
-      converting results into different formats -- with and without filtering
-      for specific needs -- is covered there.
+      As the former named chapters are geared toward genome assemblies, there
+      is also a chapter going into details on how to use MIRA for EST / RNASeq
+      assemblies. Read that if you're into this kind of data.
     </para>
     <para>
       As the previously cited chapters are more introductory in their nature,
@@ -138,27 +140,24 @@
       be found in the reference chapter.
     </para>
     <para>
+      The chapter on working with results of MIRA should again be of general interest to everyone. It
+      describes the structure of output directories and files and gives first pointers on what to
+      find where. Also, converting results into different formats -- with and without filtering for
+      specific needs -- is covered there.
+    </para>
+    <para>
       As not every assembly project is simple, there is also a chapter with
-      tips on how to deal with projects which turn out to be "hard." It
+      tipps on how to deal with projects which turn out to be "hard." It
       certainly helps if you at least skim through it even if you do not
       expect to have problems with your data ... it contains a couple of
       tricks on what one can see in result files as well as in temporary and
       log files which are not explained elsewhere.
     </para>
     <para>
-      MIRA comes with a number of additional utilities which are described in
-      an own chapter. While the purpose of <command>miraconvert</command>
-      should be quite clear quite quickly, the versatility of use cases for
-      <command>mirabait</command> might surprise more than one. Be sure to
-      check it out.
-    </para>
-    <para>
-      As from time to time some general questions on sequencing are popping up
-      on the MIRA talk mailing list, I have added a chapter with some general
-      musings on what to consider when going into sequencing projects. This
-      should be in no way a replacement for an exhaustive talk with a
-      sequencing provider, but it can give a couple of hints on what to take
-      care of.
+      As from time to time some general questions on sequencing are popping up on the MIRA
+      talk mailing list, I have added a chapter with some general musings on what to consider when
+      going into sequencing projects. This should be in no way a replacement for an exhaustive talk
+      with a sequencing provider, but it can give a couple of hints on what to take care of.
     </para>
     <para>
       There is also a FAQ chapter with some of the more frequently asked questions
@@ -168,14 +167,6 @@
       Finally, there are also chapters covering some more technical aspects of MIRA: the MAF format
       and structure / content of the tmp directory have own chapters.
     </para>
-    <para>
-      Complete walkthroughs ... are lacking at the moment for MIRA 4. In the
-      MIRA 3 manual I had them, but so many things have changed (at all
-      levels: MIRA, the sequencing technologies, data repositories) that I did
-      not have time to update them. I probably will need quite some time to
-      write new ones. Feel free to send me some if you are inclined to help
-      fellow scientists.
-    </para>
   </sect1>
   <sect1 id="sect_intro_miraquicktour">
     <title>
@@ -398,15 +389,15 @@
     </para>
     <note>
       <para>
-	The screen shots in this section show data from assemblies produced
+	The screenshots in this section show data from assemblies produced
 	with MIRA, but the visualisation itself is done in a finishing program
 	named <command>gap4</command>.
       </para>
       <para>
-	Some of the screen shots were edited for showing a special feature of
-	MIRA. E.g., in the screen shots with Solexa data, quite some reads were
+	Some of the screenshots were edited for showing a special feature of
+	MIRA. E.g., in the screenshots with Solexa data, quite some reads were
 	left out of the view pane as else -- due to the amount of data --
-	these screen shots would need several pages for a complete printout.
+	these screenshots would need several pages for a complete printout.
       </para>
     </note>
     <sect2 id="sect_intro_miradiscernsrepeats">
@@ -416,7 +407,7 @@
       <para>
 	MIRA is an iterative assembler (it works in several passes) and acts a
 	bit like a child when exploring the world: it explores the assembly
-	space and is specifically parameterised to allow a couple of assembly
+	space and is specifically parametrised to allow a couple of assembly
 	errors during the first passes. But after each pass some routines (the
 	"parents", if you like) check the result, searching for assembly
 	errors and deduce knowledge about specific assemblies MIRA should not
@@ -432,14 +423,14 @@
 	columns discrepancies. Two slightly different repeats were assembled
 	together.</title>
 	<titleabbrev>
-	  How MIRA learns from misassemblies (1)
+	  How MIRA learns from misassemblies (1) 
 	</titleabbrev>
 	<mediaobject>
 	  <imageobject>
 	    <imagedata fileref="bookfigures/srmc_in_454sxahyb_1stpass.png" width="90%"/>
 	  </imageobject>
 	</mediaobject>
-      </figure>
+      </figure>  
       <para>
 	These kind of errors can be easily spotted by a human, but are hard to
 	prevent by normal alignment algorithms as sometimes there's only one
@@ -458,21 +449,21 @@
 	  previous passes have been resolved (1st repeat site)
 	</title>
 	<titleabbrev>
-	  How MIRA learns from misassemblies (2)
+	  How MIRA learns from misassemblies (2) 
 	</titleabbrev>
 	<mediaobject>
 	  <imageobject>
 	    <imagedata fileref="bookfigures/srmc_in_454sxahyb_lastpass1.png" width="90%"/>
 	  </imageobject>
 	</mediaobject>
-      </figure>
+      </figure>  
       <figure id="chap_intro::srmc_in_454sxahyb_lastpass2.png">
 	<title>
 	  Multiple alignment after last pass where assembly errors from
 	  previous passes have been resolved (2nd repeat site)
 	</title>
 	<titleabbrev>
-	  How MIRA learns from misassemblies (3)
+	  How MIRA learns from misassemblies (3) 
 	</titleabbrev>
 	<mediaobject>
 	  <imageobject>
@@ -490,7 +481,7 @@
       <para>
 	I'm sure you'll recognise the basic principle in figures 8 and 9. The
 	slides from the corresponding talk also look very similar to the
-	screen shots above:
+	screenshots above:
       </para>
       <figure id="chap_intro::gcb99_replocator.png">
 	<title>
@@ -547,7 +538,7 @@
 	    <imagedata fileref="bookfigures/san_autoedit1.png" width="90%"/>
 	  </imageobject>
 	</mediaobject>
-      </figure>
+      </figure>  
       <figure id="chap_intro::san_autoedit2.png">
 	<titleabbrev>
 	  Sanger assembly with EdIt automatic editing routines
@@ -564,7 +555,7 @@
 	    <imagedata fileref="bookfigures/san_autoedit2.png" width="90%"/>
 	  </imageobject>
 	</mediaobject>
-      </figure>
+      </figure>  
       <para>
 	With the introduction of 454 reads, MIRA also got in 2007 specialised
 	editors to search and correct for typical 454 sequencing problems like
@@ -589,7 +580,7 @@
 	    <imagedata fileref="bookfigures/454_autoedit1.png" width="90%"/>
 	  </imageobject>
 	</mediaobject>
-      </figure>
+      </figure>  
       <figure id="chap_intro::454_autoedit2.png">
 	<title>
 	  454 assembly with 454 automatic editing routines
@@ -600,21 +591,50 @@
 	  </imageobject>
 	</mediaobject>
       </figure>
+      <para>
+	With introduction of PacBio strobed reads, MIRA also got an editor to
+	handle "elastic dark inserts" (stretches of unread bases where the
+	length is known only approximately). How this editor works is
+	explained in the chapter on PacBio data, but in essence it allows to
+	transform this:
+      </para>
+      <figure id="chap_intro::pb_elasticdarkinserts01.png">
+	<title>
+	  Multiple alignmen of PacBio elastic dark inserts without automatic editing
+	</title>
+	<mediaobject>
+	  <imageobject>
+	    <imagedata fileref="bookfigures/pb_elasticdarkinserts01.png" width="90%"/>
+	  </imageobject>
+	</mediaobject>
+      </figure>
+      <para>
+	into this:
+      </para>
+      <figure id="chap_intro::pb_elasticdarkinserts02.png">
+	<title>
+	  Multiple alignment of PacBio elastic dark inserts with automatic editing
+	</title>
+	<mediaobject>
+	  <imageobject>
+	    <imagedata fileref="bookfigures/pb_elasticdarkinserts02.png" width="90%"/>
+	  </imageobject>
+	</mediaobject>
+      </figure>
     </sect2>
     <sect2 id="sect_intro_whycontigsend">
       <title>
 	MIRA lets you see why contigs end where they end
       </title>
       <para>
-	A very useful feature for finishing are kmer (hash) frequency tags
+	A very useful feature for finishing are hash frequency (HAF) tags
 	which MIRA sets in the assembly. Provided your finishing editor
-	understands those tags
-	(<command>gap4</command>, <command>gap5</command>
+	understands those tags (<command>gap4</command>, <command>gap5</command>
 	and <command>consed</command> are fine but there may be others),
 	they'll give you precious insight where you might want to be cautious
 	when joining to contigs or where you would need to perform some primer
-	walking. MIRA colourises the assembly with the hash frequency (HAF)
-	tags to show repetitiveness.
+	walking. MIRA colourises the assembly with the HAF tags to show
+	repetitiveness.
       </para>
       <para>
 	You will need to read about the HAF tags in the reference manual, but
@@ -635,7 +655,7 @@
 	    <imagedata fileref="bookfigures/haf5_haf2_contigcoverage_ovals.png" width="90%"/>
 	  </imageobject>
 	</mediaobject>
-      </figure>
+      </figure>  
       <para>
 	The question is now: why did MIRA stop building this contig on the
 	left end (left oval) and why on the right end (right oval).
@@ -662,7 +682,7 @@
 	    <imagedata fileref="bookfigures/haf5_repend_rrna.png" width="90%"/>
 	  </imageobject>
 	</mediaobject>
-      </figure>
+      </figure>  
       <para>
 	The right end of the same contig however ends in HAF3 tags (normal
 	coverage, bright green in the next figure) and even HAF2 tags (below
@@ -684,7 +704,7 @@
 	    <imagedata fileref="bookfigures/haf2_end_nomoredata.png" width="90%"/>
 	  </imageobject>
 	</mediaobject>
-      </figure>
+      </figure>  
     </sect2>
     <sect2 id="sect_intro_stmshybrid_tags">
       <title>
@@ -706,7 +726,7 @@
 	decision as all Solexa reads at the same spot (the reads which are not
 	highlighted) show only one "G" for the given position. While MIRA
 	chose to believe Solexa in this case, it tagged the position anyway in
-	case someone chooses to check these kind of things.
+	case someone choses to check these kind of things.
       </para>
       <figure id="chap_intro::454sxa_stms_hybdenovo.png">
 	<title>
@@ -722,7 +742,7 @@
 	    <imagedata fileref="bookfigures/454sxa_stms_hybdenovo.png" width="90%"/>
 	  </imageobject>
 	</mediaobject>
-      </figure>
+      </figure>  
       <para>
 	This works also for other sequencing technology combinations or in
 	mapping assemblies. The following is an example in a hybrid Sanger /
@@ -745,11 +765,11 @@
 	    <imagedata fileref="bookfigures/454san_stmu_hybdenovo.png" width="90%"/>
 	  </imageobject>
 	</mediaobject>
-      </figure>
+      </figure>  
     </sect2>
     <sect2 id="sect_intro_cer_reads">
       <title>
-	MIRA allows older finishing programs to cope with amount data in Solexa
+	MIRA allows older finshing programs to cope with amount data in Solexa
 	mapping projects
       </title>
       <para>
@@ -773,7 +793,7 @@
       </para>
       <para>
 	So, MIRA reduces the number of reads in Solexa mapping projects
-	without sacrificing information on coverage. The principle is pretty
+	without sacrificing information on coverage. The princible is pretty
 	simple: for 100% matching reads, MIRA tracks coverage of every
 	reference base and creates long synthetic, coverage equivalent reads
 	(CERs) in exchange for the Solexa reads. Reads that do not match 100%
@@ -796,7 +816,7 @@
 	    equivalent reads (CERs). Note that there are less reads, but no
 	    information is lost: the coverage of each reference base is
 	    equivalent to the left side of the figure and reads with
-	    differences to the reference are still present.
+	    differences to the reference are stil present.
 	  </para>
 	</title>
 	<mediaobject>
@@ -804,7 +824,7 @@
 	    <imagedata fileref="bookfigures/sxa_cer_reads1.png" width="90%"/>
 	  </imageobject>
 	</mediaobject>
-      </figure>
+      </figure>  
       <para>
 	This strategy is very effective in reducing the size of a project. As
 	an example, in a mapping project with 9 million Solexa 36mers, MIRA
@@ -820,14 +840,14 @@
       </para>
       <figure id="chap_intro::sxa_cer_reads2.png">
 	<title>
-	  Coverage equivalent reads let SNPs become very visible in assembly viewers
+	  Coverage equivalent reads let SNPs become very visible in assembly viewers 
 	</title>
 	<mediaobject>
 	  <imageobject>
 	    <imagedata fileref="bookfigures/sxa_cer_reads2.png" width="90%"/>
 	  </imageobject>
 	</mediaobject>
-      </figure>
+      </figure>  
     </sect2>
     <sect2 id="sect_intro_mapping_tags">
       <title>
@@ -867,7 +887,7 @@
 	    <imagedata fileref="bookfigures/sxa_sroc_lenski2.png" width="90%"/>
 	  </imageobject>
 	</mediaobject>
-      </figure>
+      </figure>  
       <para>
 	Other interesting places like deletions of whole genome parts are also
 	directly tagged by MIRA and noted in diverse result files (and
@@ -875,7 +895,7 @@
       </para>
       <figure id="chap_intro::sxa_mcvc_lenski.png">
 	<title>
-	  "MCVc" tag (Missing CoVerage in Consensus, dark red stretch in figure)
+	  "MCVc" tag (Missing CoVerage in Consenus, dark red stretch in figure)
 	  showing a genome deletion in Solexa mapping assembly.
 	</title>
 	<titleabbrev>
@@ -886,7 +906,7 @@
 	    <imagedata fileref="bookfigures/sxa_mcvc_lenski.png" width="90%"/>
 	  </imageobject>
 	</mediaobject>
-      </figure>
+      </figure>  
       <note>
 	For bacteria -- and if you use annotated GenBank files as reference
 	sequence -- MIRA will also output some nice lists directly usable (in
@@ -1037,7 +1057,7 @@
 	Pfisterer (for EdIt)
       </para>
       <para>
-	© 2001-2014 Bastien Chevreux.
+	© 2001-2011 Bastien Chevreux.
       </para>
       <para>
 	All rights reserved.
@@ -1050,7 +1070,7 @@
       <para>
 	MIRA uses the excellent Expat library to parse XML files. Expat is Copyright
 	©  1998, 1999, 2000 Thai Open Source Software Center Ltd and Clark
-	Cooper as well as Copyright ©
+	Cooper as well as Copyright © 
 	2001, 2002 Expat maintainers.
       </para>
       <para>
@@ -1103,13 +1123,13 @@
       system to keep the spam level low.
     </note>
     <para>
-      To report bugs or ask for new features, please use the SourceForge
-      ticketing system at: <ulink
-      url="http://sourceforge.net/p/mira-assembler/tickets/"/>. This ensures
+      To report bugs or ask for new features, please use the new ticketing
+      system at: <ulink
+      url="http://sourceforge.net/apps/trac/mira-assembler/"/>. This ensures
       that requests do not get lost <emphasis role="bold">and</emphasis> you
       get the additional benefit to automatically know when a bug has been
-      fixed as I will not send separate emails, that's what bug trackers are
-      there for.
+      fixed (there won't be separate emails sent, that's what bug trackers are
+      there for).
     </para>
     <para>
       Finally, new or intermediate versions of MIRA will be announced on the
@@ -1189,3 +1209,4 @@
   </sect1>
 
 </chapter>
+
diff --git a/doc/docbook/attic/chap_iontor_part.xml b/doc/docbook/chap_iontor_part.xml
similarity index 51%
rename from doc/docbook/attic/chap_iontor_part.xml
rename to doc/docbook/chap_iontor_part.xml
index fe332b8..793b445 100644
--- a/doc/docbook/attic/chap_iontor_part.xml
+++ b/doc/docbook/chap_iontor_part.xml
@@ -3,12 +3,15 @@
 <chapter id="chap_iontor">
   <chapterinfo>
     <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="versionfile"/>
+    <releaseinfo>
+      <emphasis role="light">Document revision	$Id$</emphasis>
+    </releaseinfo>
     <author>
       <firstname>Bastien</firstname>
       <surname>Chevreux</surname>
       <email>bach at chevreux.org</email>
     </author>
-    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="copyrightfile"/>
+    <copyright><year>2011</year><holder>Bastien Chevreux</holder></copyright>
   </chapterinfo>
   <blockquote>
     <attribution>Solomon Short (modified)</attribution>
@@ -36,12 +39,15 @@
     </para>
     <warning>
       <para>
-	IonTorrent is - as of January 2014 - still a moving target: there are
-	new protocols every few months and they've come a long way since their
-	very first data sets. The data quality is now more or less comparable
-	to better 454 data sets, at least from what I have seen. It might be
-	that you need to fetch the latest MIRA version available to get the
-	best possible assembly.
+	Ion Torrent is pretty new and I did not have as much data to analyse as
+	I had with Sanger, 454 or Solexa. MIRA has been configured to
+	automatically work well with data currently available on the market and
+	with data which is to be expected during the course of 2011 / 2012.
+      </para>
+      <para>
+	However, IonTorrent is - at the moment - a moving target: there are new
+	protocols every few months and it might be that you need to fetch the
+	latest MIRA version available to get the best possible assembly.
       </para>
     </warning>
     <sect2 id="sect_iontor_some_reading_requirements">
@@ -75,16 +81,339 @@
       </itemizedlist>
     </sect2>
   </sect1>
-  <sect1 id="sect_iontor_walkthrough_unpaired_data">
+  <sect1 id="sect_iontor_data_characteristics">
     <title>
-      Walkthrough: unpaired data
+      Characteristics of Ion Torrent data
+    </title>
+    <para>
+      What I can say at the moment is that Ion Torrent reads behave very
+      much like the early data from the 454 technology (454 GS20): reads are
+      mostly between 90 and 110 bases long, with Ion Torrent having a
+      showcase with reads of ~220 to 230 bases. The following figure shows
+      what you can get out of 100bp reads if you're lucky:
+    </para>
+    <figure id="chap_iontor::ion_dh10bgoodB13.png">
+      <title>
+	Example for good IonTorrent data (100bp reads). Note that only a
+	single sequencing error - shown by blue background - can be
+	seen. Except this, all homopolymers of size 3 and 4 in the area
+	shown are good.
+      </title>
+      <titleabbrev>
+	Example for good IonTorrent data (100bp reads)
+      </titleabbrev>
+      <mediaobject>
+	<imageobject>
+	  <imagedata fileref="bookfigures/ion_dh10bgoodB13.png" width="90%"/>
+	</imageobject>
+      </mediaobject>
+    </figure>
+    <para>
+      The "if you're lucky" part in the preceding sentence is not there by
+      accident: having so many clean reads is more of an exception rather a
+      rule. On the other hand, most sequencing errors in current IonTorrent
+      data are unproblematic ... if it were not for indels, which is going to
+      be explained on the next sections.
+    </para>
+    <sect2 id="sect_iontor_data_characteristics_hpindels">
+      <title>
+	Homopolymer insertions / deletions
+      </title>
+      <para>
+	The main source of error in your data will be insertions / deletions
+	(indels) especially in homopolymer regions (but not only there, see
+	also next section). Starting with a base run of 4 to 6 bases, there
+	is a distinct tendency to have an increased occurence of indel
+	errors.
+      </para>
+      <figure id="chap_iontor::iontor_indelhpexample.png">
+	<title>
+	  Example for problematic IonTorrent data (100bp reads).
+	</title>
+	<titleabbrev>
+	  Example for problematic IonTorrent data (100bp reads)
+	</titleabbrev>
+	<mediaobject>
+	  <imageobject>
+	    <imagedata fileref="bookfigures/iontor_indelhpexample.png" width="90%"/>
+	  </imageobject>
+	</mediaobject>
+      </figure>
+    </sect2>
+    <para>
+      The above figure contains a couple of particularly nasty indel
+      problems. While areas 2 (C-homopolymer length 3), 5 (A-homopolymer
+      length 4) and 6 (T-homopolymer length 3) are not a big problem as most
+      of the reads got the length right, the areas 1, 3 and 4 are nasty.
+    </para>
+    <para>
+      Area 1 is an A-homopolymer of length 7 and while many reads geth that
+      length right (enough to tell MIRA what the true length is), it also
+      contains reads with a length of 6 and and others with a lengh of 8.
+    </para>
+    <para>
+      Area 2 is a "A-homopolymer" of length 2 where approximately half of the
+      reads get the length right, the other half not. See also the following
+      section.
+    </para>
+    <para>
+      Area 4 is a T-homopolymer of length 5 which also has approximately half
+      the reads with a wrong length of 4.
+    </para>
+    <sect2 id="sect_iontor_data_characteristics_seqdirdepindels">
+      <title>
+	Sequencing direction dependend insertions / deletions
+      </title>
+      <para>
+	In the previous section, the screenshot showing indels had an indel
+	at a homopolymer of 2, which is something quite curious. Upon closer
+	investigation, one might notice a pattern in the gap/nogap
+	distribution: it is almost identical to the orientation of build
+	direction of reads!
+      </para>
+      <para>
+	I looked for other examples of this behaviour and found quite a
+	number of them, the following figure shows a very clear case of that
+	error behaviour:
+      </para>
+      <figure id="chap_iontor::ion_dh10bdirdepindel.png.png">
+	<title>
+	  Example for a sequencing direction dependend indel. Note how all
+	  but one of the reads in '+' direction miss a base while all reads
+	  built in in '-' direction have the correct number of bases.
+	</title>
+	<titleabbrev>
+	  Example for a sequencing direction dependend indel
+	</titleabbrev>
+	<mediaobject>
+	  <imageobject>
+	    <imagedata fileref="bookfigures/ion_dh10bdirdepindel.png" width="90%"/>
+	  </imageobject>
+	</mediaobject>
+      </figure>  
+      <para>
+	This is quite astonishing: the problem occurs at a site without real
+	homopolymer (calling a 2-bases run a 'homopolymer' starts stretching
+	the definition a bit) and there are no major problematic homopolymer
+	sites near. In fact, this was more or less the case for all sites I
+	had a look at.
+      </para>
+      <para>
+	Neither did the cases which were investigated show common base
+	patterns, so unlike the Solexa GGCxG motif it does not look like
+	that error of IonTorrent is bound to a particular motif.
+      </para>
+      <para>
+	While I cannot prove the following statement, I somehow suspect that
+	there must be some kind of secondary structure forming which leads to
+	that kind of sequencing error. If anyone has a good explanation I'd be
+	happy to hear it: feel free to contact me at
+	<email>bach at chevreux.org</email>.
+      </para>
+    </sect2>
+    <sect2 id="sect_iontor_data_characteristics_covvariance">
+      <title>
+	Coverage variance
+      </title>
+      <para>
+	The coverage variance with the current ~100bp reads is a bit on the
+	bad side for low coverage projects (10x to 15x): it varies wildly,
+	sometimes dropping to nearly zero, sometimes reaching approximately
+	double the coverage.
+      </para>
+      <para>
+	While showing the same up and down, the effect on an assembly will
+	be less pronounced with higher coverages (25x and more) as the
+	chance increases that some reads are sequenced that span a gap. The
+	following two figures show typical coverage plots for the
+	<emphasis>E. coli</emphasis> data (100bp reads, ~33x coverage)
+	published by Ion Torrent.
+      </para>
+      <figure id="chap_iontor::ion_dh10bcovB13_320kb.png">
+	<title>
+	  IonTorrent coverage (1) 320kb contig 
+	</title>
+	<titleabbrev>
+	  IonTorrent coverage (1) 320kb contig 
+	</titleabbrev>
+	<mediaobject>
+	  <imageobject>
+	    <imagedata fileref="bookfigures/ion_dh10bcovB13_320kb.png" width="90%"/>
+	  </imageobject>
+	</mediaobject>
+      </figure>  
+      <figure id="chap_iontor::ion_dh10bcovB13_12kb.png">
+	<title>
+	  IonTorrent coverage (1) zoom of a 12kb stretch
+	</title>
+	<titleabbrev>
+	  IonTorrent coverage (1) zoom of a 12kb stretch
+	</titleabbrev>
+	<mediaobject>
+	  <imageobject>
+	    <imagedata fileref="bookfigures/ion_dh10bcovB13_12kb.png" width="90%"/>
+	  </imageobject>
+	</mediaobject>
+      </figure>  
+      <para>
+	From these figures (and some other data I have) I expect that one would need a coverage of
+      </para>
+      <variablelist>
+	<varlistentry>
+	  <term>
+	    ≤1x
+	  </term>
+	  <listitem>
+	    <para>
+	      for rough bug identification, i.e. answering what it is.
+	    </para>
+	  </listitem>
+	</varlistentry>
+	<varlistentry>
+	  <term>
+	    ~ 5x
+	  </term>
+	  <listitem>
+	    <para>
+	      for rough pathway exploration, i.e., answering the question
+	      which pathways are more or less present (even if one misses a
+	      gene or two in different pathways).
+	    </para>
+	  </listitem>
+	</varlistentry>
+	<varlistentry>
+	  <term>
+	    ~ 12x to 15x
+	  </term>
+	  <listitem>
+	    <para>
+	      for gene fishing expeditions, i.e., get enough sequence to have
+	      almost all genes of an organism somehow present, even if some
+	      are fragmented into different contigs or contain sequencing
+	      errors.
+	    </para>
+	  </listitem>
+	</varlistentry>
+	<varlistentry>
+	  <term>
+	    ≥ 25x
+	  </term>
+	  <listitem>
+	    <para>
+	      for assemblies which are not too bad
+	    </para>
+	  </listitem>
+	</varlistentry>
+	<varlistentry>
+	  <term>
+	    ≥ 40x
+	  </term>
+	  <listitem>
+	    <para>
+	      for assemblies which represent the best possible thing you can
+	      get with IonTorrent nowadays.
+	    </para>
+	  </listitem>
+	</varlistentry>
+      </variablelist>
+    </sect2>
+    <sect2 id="sect_iontor_data_characteristics_gcbias">
+      <title>
+	GC bias
+      </title>
+      <para>
+	The GC bias seems to be small to non-existent, at least I could not
+	immediately make a correlation between GC content and
+	coverage. However, the only data sets I've seen so far are for
+	<emphasis>E. coli</emphasis> which has a GC content of rough 50%
+	... I'd like to check GC bias with a couple of other organisms
+	before giving a final statement.
+      </para>
+    </sect2>
+    <sect2 id="sect_iontor_data_other_sources_of_error">
+      <title>
+	Other sources of error
+      </title>
+      <para>
+	You will want to keep an eye on the clipping of the data in the SFF
+	files from IonTorrent: while it is generally good enough, some data
+	sets of IonTorrent show that - for some error patterns - the clipping
+	is too lax and strange artefacts appear. MIRA will take care of these
+	- or at least of those it knows - but you should be aware of this
+	potential problem.
+      </para>
+    </sect2>
+    <sect2 id="sect_iontor_data_where_to_find_further_information">
+      <title>
+	Where to find further information
+      </title>
+      <para>
+	IonTorrent being pretty new, getting as much information on that technology is quite important. So here are a couple of links I found to be helpful:
+      </para>
+      <itemizedlist>
+	<listitem>
+	  <para>
+	    There is, of course, the TorrentDev site (<ulink
+	    url="http://lifetech-it.hosted.jivesoftware.com/community/torrent_dev"/>)
+	    at Life Technologies which will be helpful to get a couple of
+	    questions answered.
+	  </para>
+	  <para>
+	    Just be aware that some of the documents over there are sometimes
+	    painting an - how should I say it diplomatically? - overly
+	    optimistic view on the performance of the technology. On the
+	    other hand, so do documents released by the main competitors
+	    like 454/Roche, Illumina, PacBio etc. ... so no harm done there.
+	  </para>
+	</listitem>
+	<listitem>
+	  <para>
+	    I found Nick Loman's blog <ulink
+	    url="http://pathogenomics.bham.ac.uk/blog/">Pathogens: Genes and
+	    Genomes</ulink> to be my currently most valuable source of
+	    information on IonTorrent. While the group he works for won a
+	    sequencer from IonTorrent, he makes that fact very clear and still
+	    unsparingly dissects the data he gets from that machine.
+	  </para>
+	  <para>
+	    His posts got me going in getting MIRA grok IonTorrent.
+	  </para>
+	</listitem>
+	<listitem>
+	  <para>
+	    The blog of Lex Nederbragt <ulink
+	    url="http://flxlexblog.wordpress.com/">In between lines of
+	    code</ulink> is playing in the same league: very down to earth and
+	    he knows a bluff when he sees it ... and is not afraid to call it
+	    (be it from IonTorrent, PacBio or 454).
+	  </para>
+	  <para>
+	    The analysis he did on a couple of Ion data sets have saved me
+	    quite some time.
+	  </para>
+	</listitem>
+	<listitem>
+	  <para>
+	    Last, but not least, the board with <ulink
+	    url="http://seqanswers.com/forums/forumdisplay.php?f=40">IonTorrent-related-stuff</ulink>
+	    over at <ulink url="http://seqanswers.com/">SeqAnswers</ulink>,
+	    the first and foremost one-stop-shop ... erm ... discussion board
+	    for everything related to sequencing nowadays.
+	  </para>
+	</listitem>
+      </itemizedlist>
+    </sect2>
+  </sect1>
+  <sect1 id="sect_iontor_an_iontor_assembly_walkthrough">
+    <title>
+      An Ion Torrent assembly walkthrough
     </title>
     <para>
       This walkthrough will use two data sets for <emphasis>E. coli</emphasis>
       strain DH10B made available by IonTorrent and will show you the main steps you need
       to perform to get assemblies going.
     </para>
-    <sect2 id="sect_iontor_walkthrough_unpaired_prepfilesystem">
+    <sect2 id="sect_454_preparing_your_filesystem">
       <title>
 	Preparing your file system
       </title>
@@ -130,7 +459,7 @@ drwxr-xr-x 2 bach users 48 2011-08-12 22:43 origdata</userinput></screen>
 	</listitem>
       </itemizedlist>
     </sect2>
-    <sect2 id="sect_iontor_walkthrough_unpaired_gettingdata">
+    <sect2 id="sect_iontor_getting_walkthrough_data">
       <title>
 	Getting the data for this walkthrough
       </title>
@@ -177,9 +506,9 @@ drwxr-xr-x 2 bach users 48 2011-08-12 22:43 origdata</userinput></screen>
 <prompt>arcadia:dh10b$</prompt> <userinput>cd data</userinput>
 <prompt>arcadia:data$</prompt> <userinput>unzip ../origdata/B13_328.sff.zip</userinput>
 Archive:  ../origdata/B13_328.sff.zip
-  inflating: B13_328.sff
+  inflating: B13_328.sff             
    creating: __MACOSX/
-  inflating: __MACOSX/._B13_328.sff
+  inflating: __MACOSX/._B13_328.sff  
 <prompt>arcadia:data$</prompt> <userinput>unzip ../origdata/B14_387_CR_0.05.sff.zip</userinput>
 Archive:  ../origdata/B14_387_CR_0.05.sff.zip
   inflating: R_2011_07_19_20_05_38_user_B14-387-r121336-314_pool30-ms_B14-387_cafie_0.05.sff
@@ -203,7 +532,7 @@ drwxrwxr-x 2 bach bach       4096 2011-06-21 16:16 __MACOSX
 	There, much nicer.
       </para>
     </sect2>
-    <sect2 id="sect_iontor_walkthrough_unpaired_prepdata">
+    <sect2 id="sect_iontor_preparing_the_iontor_data_for_mira">
       <title>
 	Preparing the Ion Torrent data for MIRA
       </title>
@@ -225,7 +554,7 @@ drwxrwxr-x 2 bach bach       4096 2011-06-21 16:16 __MACOSX
 	clipping information.
       </para>
       <note>
-	<title>Tip</title>
+	<title>Tip</title> 
 	Use the sff_extract script from Jose Blanca at the
 	University of Valencia. The home of sff_extract is:
 	<ulink url="http://bioinf.comav.upv.es/sff_extract/index.html"/> but I
@@ -234,32 +563,40 @@ drwxrwxr-x 2 bach bach       4096 2011-06-21 16:16 __MACOSX
       </note>
       <para>
 	The data sets B13 and B14 have short and long IonTorrent reads and we
-	will want to assemble them together. For the sake of clarity, I want
-	to name the file with a prefix: <emphasis>dh10b_b13b14</emphasis>.
+	will want to assemble them together, so let's put them together into
+	the input files MIRA needs. For the sake of clarity, I want to name
+	that assembly project <emphasis>dh10b_b13b14</emphasis>.
       </para>
       <screen>
-<prompt>arcadia:data$</prompt> <userinput>sff_extract -o dh10b_b13b14 B13.sff B14.sff</userinput>
+<prompt>arcadia:data$</prompt> <userinput>sff_extract 
+  -Q
+  -s dh10b_b13b14_in.iontor.fastq
+  -x dh10b_b13b14_traceinfo_in.iontor.xml
+  B13.sff B14.sff</userinput>
 Working on 'B13.sff':
 Converting 'B13.sff' ...  done.
 Converted 1687490 reads into 1687490 sequences.
 Working on 'B14.sff':
 Converting 'B14.sff' ...  done.
 Converted 350109 reads into 350109 sequences.</screen>
+      <note>
+	The above command has been split in multiple lines for better overview
+	but should be entered in one line.
+      </note>
       <para>
-	The parameters to <command>sff_extract</command> tell it to convert
-	the SFFs named <filename>B13.sff</filename> and
-	<filename>B14.sff</filename> into files where the names start with
-	<filename>dh10b_b13b14</filename>. By default, a FASTQ file and a XML
-	file in NCBI traceinfo will be created.
+	The parameters to <command>sff_extract</command> tell it to extract to
+	FASTQ (via -Q), give the FASTQ file a name we chose (via -s), give the
+	XML file with clipping information a name we chose (via -x) and
+	convert the SFFs named <filename>B13.sff</filename> and
+	<filename>B14.sff</filename>.
       </para>
       <warning>
-	<title>Do not hard clip sequences!</title>
 	<para>
-	  People "in the know" might want to tell
-	  <command>sff_extract</command> to simply dump hard-clip sequences
-	  into the FASTQ file via the <arg>-c</arg> argument. Hard-clipped
-	  means: the clipped sequence parts of a read are physically trimmed
-	  away, never to be seen again.
+	  People "in the know" might want to get rid of the XML TRACEINFO file
+	  and tell <command>sff_extract</command> to simply dump hard-clip
+	  sequences into the FASTQ file via the <arg>-c</arg>
+	  argument. Hard-clipped means: the clipped sequence parts of a
+	  read are physically trimmed away, never to be seen again.
 	</para>
 	<para>
 	  This is <emphasis><emphasis role="bold"><emphasis role="underline">D
@@ -274,9 +611,6 @@ Converted 350109 reads into 350109 sequences.</screen>
 	  clip was performed on the sequences, these algorithms are not as
 	  effective anymore.
 	</para>
-      </warning>
-      <note>
-	<title>The XML TRACEINFO file</title>
 	<para>
 	  For the die hards out there who really do not want the XML TRACEINFO
 	  files: if MIRA gets only the sequence, it will use the usual
@@ -287,7 +621,7 @@ Converted 350109 reads into 350109 sequences.</screen>
 	  TRACEINFO XML, they're still better than with hard clipped
 	  sequences.
 	</para>
-      </note>
+      </warning>
       <para>
 	The conversion can take some time, the ~2 million IonTorrent reads
 	from this example need approximately 2.5 minutes for conversion. Go
@@ -298,28 +632,27 @@ Converted 350109 reads into 350109 sequences.</screen>
       </para>
       <screen>
 <prompt>arcadia:data$</prompt> <userinput>ls -l</userinput>
--rw-r--r-- 1 bach bach  771462745 2011-08-19 22:24 dh10b_b13b14.fastq
--rw-r--r-- 1 bach bach  441331004 2011-08-19 22:24 dh10b_b13b14.xml
+-rw-r--r-- 1 bach bach  771462745 2011-08-19 22:24 dh10b_b13b14_in.iontor.fastq
+-rw-r--r-- 1 bach bach  441331004 2011-08-19 22:24 dh10b_b13b14_traceinfo_in.iontor.xml
 -rw-r--r-- 1 bach bach 1721658336 2011-06-17 01:29 B13.sff
 -rw-rw-r-- 1 bach bach  688207032 2011-07-28 23:31 B14.sff</screen>
       <para>
-	Cool. Last step: we do not need the SFF files here anymore (we still
-	have them as ZIP in the <filename>origdata</filename> folder), let's
-	get rid of them:
+	Cool. Last step: we do not need the SFF files anymore, let's get rid
+	of them:
       </para>
       <screen>
 <prompt>arcadia:data$</prompt> <userinput>rm *sff</userinput>
 <prompt>arcadia:data$</prompt> <userinput>ls -l</userinput>
--rw-r--r-- 1 bach bach  771462745 2011-08-19 22:24 dh10b_b13b14.fastq
--rw-r--r-- 1 bach bach  441331004 2011-08-19 22:24 dh10b_b13b14.xml</screen>
+-rw-r--r-- 1 bach bach  771462745 2011-08-19 22:24 dh10b_b13b14_in.iontor.fastq
+-rw-r--r-- 1 bach bach  441331004 2011-08-19 22:24 dh10b_b13b14_traceinfo_in.iontor.xml</screen>
     </sect2>
-    <sect2 id="sect_iontor_walkthrough_unpaired_manifest">
+    <sect2 id="sect_iontor_starting_the_assembly_from_fastq">
       <title>
-	Writing a manifest configuration file
+	Starting the assembly
       </title>
       <para>
 	Good, we're almost there. Let's switch to the
-	<filename>assemblies</filename> directory and create a subdirectory for our
+	<filename>assembly</filename> directory and create a subdirectory for our
 	first assembly test.
       </para>
       <screen>
@@ -328,54 +661,32 @@ Converted 350109 reads into 350109 sequences.</screen>
 <prompt>arcadia:assemblies$</prompt> <userinput>cd 1sttest</userinput></screen>
       <para>
 	This directory is quite empty and the IonTorrent data is not
-	present. And it does not need to be as we'll tell MIRA in the manifest
-	configuration file where to find the data and what to do with it.
+	present. Let's put some links to the files created in the previous
+	step:
       </para>
       <screen>
-# A manifest file can contain comment lines, these start with the #-character
-
-# First part of a manifest: defining some basic things
-
-# In this example, we just give a name to the assembly
-#  and tell MIRA it should assemble a genome de-novo in accurate mode
-# As special parameter, we want to use 4 threads in parallel (where possible)
-
-<userinput>project = <replaceable>dh10b</replaceable>
-job = <replaceable>genome,denovo,accurate</replaceable>
-parameters = <replaceable>-GE:not=4</replaceable></userinput>
-
-# The second part defines the sequencing data MIRA should load and assemble
-# The data is logically divided into "readgroups", for more information
-#  please consult the MIRA manual, chapter "Reference"
-
-<userinput>readgroup = <replaceable>SomeUnpairedIonTorrentReadsIGotFromTheLab</replaceable>
-technology = <replaceable>iontor</replaceable>
-data = <replaceable>../../data/dh10b*</replaceable></userinput>
-
-# note the wildcard "dh10b*" part in the 'data' line above:
-#  if you followed the walkthrough and have the FASTQ and XML file,
-#  this will automatically load both files (which is what we want)</screen>
-    <para>
-      Save the above lines into a file, we'll use <filename>manifest.conf</filename> in this example.
-    </para>
-    <screen>
-<prompt>arcadia:/path/to/myProject$</prompt> <userinput>ls -l</userinput>
--rw-r--r-- 1 bach users        756 2011-11-05 17:57 manifest.conf</screen>
-    </sect2>
-    <sect2 id="sect_iontor_walkthrough_unpaired_starting">
-      <title>
-	Starting the assembly
-      </title>
+<prompt>arcadia:1sttest$</prompt> <userinput>ln -s ../../data/* .</userinput>
+<prompt>arcadia:1sttest$</prompt> <userinput>ls -l</userinput>
+lrwxrwxrwx 1 bach bach 42 2011-08-19 22:44 dh10b_b13b14_in.iontor.fastq -> ../../data/dh10b_b13b14_in.iontor.fastq
+lrwxrwxrwx 1 bach bach 40 2011-08-19 22:44 dh10b_b13b14_in.iontor.xml -> ../../data/dh10b_b13b14_traceinfo_in.iontor.xml</screen>
       <para>
-	Starting the assembly is now just a matter of one line:
+	Starting the assembly is now just a matter of one line with some
+	parameters set correctly:
       </para>
       <screen>
-<prompt>arcadia:1sttest$</prompt> <userinput>mira manifest.conf >&log_assembly.txt </userinput></screen>
+<prompt>arcadia:1sttest$</prompt> <userinput>mira 
+--project=dh10b_b13b14
+--job=denovo,genome,accurate,iontor
+>&log_assembly.txt </userinput></screen>
+      <note>
+	The above command has been split in multiple lines for better
+	overview but should be entered in one line.
+      </note>
       <para>
 	Now, that was easy, wasn't it? In the above example - for assemblies
 	having only Ion Torrent data and if you followed the walkthrough on
 	how to prepare the data - everything you might want to adapt in the
-	first time are the following entries in the manifest file:
+	first time are the following options:
       </para>
       <itemizedlist>
 	<listitem>
@@ -390,244 +701,14 @@ data = <replaceable>../../data/dh10b*</replaceable></userinput>
 	</listitem>
       </itemizedlist>
       <para>
+      </para>
+      <para>
 	Of course, you are free to change any option via the extended
 	parameters, perhaps change the default number of processors to use
 	from 2 to 4 via <arg>-GE:not=4</arg> or any other of the > 150
 	parameters MIRA has ... but this is covered in the MIRA main reference
 	manual.
       </para>
-      <warning>
-	<title>Low coverage</title>
-	<para>
-	  MIRA default parameters are optimised for assemblies with decent
-	  coverages. In the case of Ion Torrent, this means an average
-	  coverage of ≥ 20 to 25. If you are working on projects with lower
-	  coverage, please adapt a couple of parameters for low coverage data.
-	</para>
-      </warning>
-      <warning>
-	<title>Do not use too high coverage</title>
-	<para>
-	  As with every sequencing technology, you should not use too much
-	  data as this is detrimental to assembly quality. Long story short:
-	  non-random sequencing errors will, at high coverage, occur
-	  frequently enough to look like valid repeat pattern, leading MIRA to
-	  create more contigs than necessary ... some of them with the
-	  sequencing errors looking like genuine sequence.
-	</para>
-	<para>
-	  As a simple rule of thumb, coverage numbers between 50x and 80x are
-	  OK, coverage above can (and will) lead to problems.
-	</para>
-      </warning>
-    </sect2>
-  </sect1>
-  <sect1 id="sect_iontor_walkthrough_paired">
-    <title>
-      Walkthrough: paired data
-    </title>
-    <sect2 id="sect_iontor_walkthrough_paired_gettingdata">
-      <title>
-	Getting the data
-      </title>
-    <para>
-      This walkthrough will use three data sets to assemble
-      <emphasis>E.coli</emphasis> MG1655: one shotgun/fragment set and two
-      paired-end data sets with different template sizes. Life has put the
-      full data sets for download, but as using the full sets for a bacteria
-      is absolute overkill (and also detrimental to assembly quality), they
-      were also kind enough to prepare sub-sampled data sets which we will use.
-    </para>
-    <para>
-      You will find all files at <ulink
-      url="http://lifetech-it.hosted.jivesoftware.com/docs/DOC-2265"/>
-    </para>
-    <orderedlist>
-      <listitem>
-	<para>
-	  Set with single fragments (unpaired data), down-sampled to 40x
-	  coverage: <ulink
-	  url="http://iontorrent.s3.amazonaws.com/datasets/C11-127/40X_subsample/C11-127_40X.sff.zip">C11-127_40X.sff.zip</ulink>
-	  This data set, subsequently nicknamed C11, contains data from the
-	  316 chip with reads of an average usable size of ~200bp.
-	</para>
-      </listitem>
-      <listitem>
-	<para>
-	  Set with paired data from a long paired-end library with an average
-	  size of 3.5kb, down-sampled to 20x coverage: <ulink
-	  url="http://iontorrent.s3.amazonaws.com/datasets/FRA-257/20X_subsample/FRA-257_20X.sff.zip">FRA-257_20X.sff.zip</ulink>
-	  This data set, subsequently nicknamed FRA-257, contains data from the
-	  316 chip with reads of an average usable size of ~xxxxxxxbp.
-	</para>
-      </listitem>
-      <listitem>
-	<para>
-	  Set with paired data from a long paired-end library with an average
-	  size of 8.9kb, down-sampled to 20x coverage: <ulink
-	  url="http://iontorrent.s3.amazonaws.com/datasets/C28-140/20X_subsample/C28-140_20X.sff.zip">C28-140_20X.sff.zip</ulink>
-	  This data set, subsequently nicknamed C28, contains data from the
-	  316 chip with reads of an average usable size of ~xxxxxxxbp.
-	</para>
-      </listitem>
-      <listitem>
-	<para>
-	  File with the linker sequences used for the paired-end sequencing. This will be needed by <command>sff_extract</command>: <ulink
-	  url="http://iontorrent.s3.amazonaws.com/datasets/reference/LMP_Linkers.fasta.gz">LMP_Linkers.fasta.gz</ulink>
-	</para>
-      </listitem>
-    </orderedlist>
-    <para>
-      Save all files into the <filename>origdata</filename> directory should now look like this:
-    </para>
-    <screen><prompt>arcadia:origdata$</prompt> <userinput>ls -l</userinput>
--r--r--r-- 1 bach bach 1826508536 Jun 14 00:04 C11-127_40X.sff.zip
--r--r--r-- 1 bach bach  681739117 Jun 14 00:05 C28-140_20X.sff.zip
--r--r--r-- 1 bach bach  537186774 Jun 14 00:06 FRA-257_20X.sff.zip
--r--r--r-- 1 bach bach         91 Mar  7 20:05 LMP_Linkers.fasta.gz</screen>
-    <para>
-      Quickly unpack the tiny linkers file:
-    </para>
-    <screen>
-<prompt>arcadia:origdata$</prompt> <userinput>gunzip LMP_Linkers.fasta.gz</userinput>
-<prompt>arcadia:origdata$</prompt> <userinput>ls -l</userinput>
--r--r--r-- 1 bach bach 1826508536 Jun 14 00:04 C11-127_40X.sff.zip
--r--r--r-- 1 bach bach  681739117 Jun 14 00:05 C28-140_20X.sff.zip
--r--r--r-- 1 bach bach  537186774 Jun 14 00:06 FRA-257_20X.sff.zip
--r--r--r-- 1 bach bach         89 Mar  7 20:05 LMP_Linkers.fasta</screen>
-    </sect2>
-    <sect2 id="sect_iontor_walkthrough_paired_prepdata">
-      <title>
-	Preparing the Ion Torrent data for MIRA
-      </title>
-      <para>
-	We will unzip all three sets with <command>unzip</command> and then
-	extract with <command>sff_extract</command> into different data files,
-	for the paired-end sets we will ask <command>sff_extract</command> to
-	split the paired sequences in the SFF into single, but paired reads:
-      </para>
-      <para>
-	Unzip the data:
-      </para>
-      <screen><prompt>arcadia:origdata$</prompt> <userinput>cd ../data</userinput>
-<prompt>arcadia:data$</prompt> <userinput>cd ../data</userinput>
-<prompt>arcadia:data$</prompt> <userinput>unzip '../origdata/*zip'</userinput>
-Archive:  ../origdata/C11-127_40X.sff.zip
-  inflating: C11-127_40X.sff
-
-Archive:  ../origdata/C28-140_20X.sff.zip
-  inflating: C28-140_20X.sff
-
-Archive:  ../origdata/FRA-257_20X.sff.zip
-  inflating: FRA-257_20X.sff
-
-3 archives were successfully processed.
-<prompt>arcadia:data$</prompt> <userinput>ls -l</userinput>
--rw-r--r-- 1 bach bach 3617626646 Feb 10 00:32 C11-127_40X.sff
--rw-rw-r-- 1 bach bach 1320383792 Dec 21 18:21 C28-140_20X.sff
--rw-rw-r-- 1 bach bach 1159612116 Dec 16 20:48 FRA-257_20X.sff</screen>
-      <para>
-	Extract unpaired reads (will take ~2.5 minutes):
-      </para>
-      <screen><prompt>arcadia:data$</prompt> <userinput>sff_extract C11-127_40X.sff</userinput>
-Working on 'C11-127_40X.sff':
-Converting 'C11-127_40X.sff' ... date
- done.
-Converted 1111060 reads into 1111060 sequences.</screen>
-      <para>
-	Extract 3.5kb paired reads (will take ~8 minutes):
-      </para>
-      <screen><prompt>arcadia:data$</prompt> <userinput>sff_extract C28-140_20X.sff</userinput>
-Testing whether SSAHA2 is installed and can be launched ...  ok.
-Working on 'C28-140_20X.sff':
-Creating temporary sequences from reads in 'C28-140_20X.sff' ...  done.
-Searching linker sequences with SSAHA2 (this may take a while) ...  ok.
-Parsing SSAHA2 result file ...  done.
-Converting 'C28-140_20X.sff' ...  done.
-Converted 792280 reads into 1567302 sequences.</screen>
-      <para>
-	Extract 8.9kb paired reads (will take ~6.5 minutes):
-      </para>
-      <screen><prompt>arcadia:data$</prompt> <userinput>sff_extract C28-140_20X.sff</userinput>
-Testing whether SSAHA2 is installed and can be launched ...  ok.
-Working on 'FRA-257_20X.sff':
-Creating temporary sequences from reads in 'FRA-257_20X.sff' ...  done.
-Searching linker sequences with SSAHA2 (this may take a while) ...  ok.
-Parsing SSAHA2 result file ...  done.
-Converting 'FRA-257_20X.sff' ...  done.
-Converted 618621 reads into 1224056 sequences.</screen>
-      <para>
-	Remove SFF files which are not needed anymore:
-      </para>
-      <screen><prompt>arcadia:data$</prompt> <userinput>rm *.sff</userinput>
-<prompt>arcadia:data$</prompt> <userinput>ls -l</userinput>
--rw-rw-r-- 1 bach bach 1000477444 Jun 14 00:35 C11-127_40X.fastq
--rw-rw-r-- 1 bach bach  246427864 Jun 14 00:35 C11-127_40X.xml
--rw-rw-r-- 1 bach bach  355981807 Jun 14 00:44 C28-140_20X.fastq
--rw-rw-r-- 1 bach bach  354995399 Jun 14 00:44 C28-140_20X.xml
--rw-rw-r-- 1 bach bach  300577380 Jun 14 00:51 FRA-257_20X.fastq
--rw-rw-r-- 1 bach bach  281069580 Jun 14 00:51 FRA-257_20X.xml</screen>
-      <para>
-	We're done here.
-      </para>
-    </sect2>
-    <sect2 id="sect_iontor_walkthrough_paired_manifest">
-      <title>
-	Writing a manifest configuration file
-      </title>
-      <para>
-	Switch to the <filename>assemblies</filename> directory and create a
-	subdirectory for our first assembly test.
-      </para>
-      <screen>
-<prompt>arcadia:data$</prompt> <userinput>cd ../assemblies/</userinput>
-<prompt>arcadia:assemblies$</prompt> <userinput>mkdir 1sttest</userinput>
-<prompt>arcadia:assemblies$</prompt> <userinput>cd 1sttest</userinput></screen>
-      <para>
-	The manifest file itself should be pretty much self-explanatory,
-	except perhaps the segment placement line, please look that up in the
-	MIRA reference manual.
-      </para>
-      <screen><userinput>project = <replaceable>mg1655</replaceable>
-job = <replaceable>genome,denovo,accurate</replaceable>
-parameters = <replaceable>-GE:not=4</replaceable></userinput>
-
-<userinput>readgroup = <replaceable>TheShotgunReads</replaceable>
-technology = <replaceable>iontor</replaceable>
-data = <replaceable>../../data/C11-127_40X.*</replaceable>
-
-readgroup = <replaceable>ThePE3.5kbLib</replaceable>
-technology = <replaceable>iontor</replaceable>
-data = <replaceable>../../data/FRA-257_20X.*</replaceable>
-template_size = <replaceable>2600 4400</replaceable>
-segment_placement = <replaceable>samedir backward</replaceable>
-
-readgroup = <replaceable>ThePE8.9kbLib</replaceable>
-technology = <replaceable>iontor</replaceable>
-data = <replaceable>../../data/C28-140_20X.*</replaceable>
-template_size = <replaceable>7800 10300</replaceable>
-segment_placement = <replaceable>samedir backward</replaceable></userinput>
-
-# note the wildcard "*" in the 'data' lines above:
-#  if you followed the walkthrough and have the FASTQ and XML files,
-#  this will automatically load both files for each data set
-#  (which is what we want)</screen>
-    <para>
-      Save the above lines into a file, we'll use <filename>manifest.conf</filename> in this example.
-    </para>
-    <screen>
-<prompt>arcadia:/path/to/myProject$</prompt> <userinput>ls -l</userinput>
--rw-r--r-- 1 bach users        756 2011-11-05 17:57 manifest.conf</screen>
-    </sect2>
-    <sect2 id="sect_iontor_walkthrough_paired_starting">
-      <title>
-	Starting the assembly
-      </title>
-      <para>
-	Starting the assembly is now just a matter of one line:
-      </para>
-      <screen>
-<prompt>arcadia:1sttest$</prompt> <userinput>mira manifest.conf >&log_assembly.txt </userinput></screen>
     </sect2>
   </sect1>
   <sect1 id="sect_iontor_what_to_do_with_the_mira_result_files?">
@@ -658,7 +739,7 @@ segment_placement = <replaceable>samedir backward</replaceable></userinput>
       If you used the uniform read distribution option, you will inevitably
       need to filter your results as this option produces larger and better
       alignments, but also more "debris contigs". For this, use the
-      miraconvert which is distributed together with the MIRA package.
+      convert_project which is distributed together with the MIRA package.
     </para>
     <para>
       Also very important when analysing Ion Torrent assemblies: screen the
@@ -686,3 +767,4 @@ segment_placement = <replaceable>samedir backward</replaceable></userinput>
     </itemizedlist>
   </sect1>
 </chapter>
+
diff --git a/doc/docbook/chap_logfiles_part.xml b/doc/docbook/chap_logfiles_part.xml
index 75ab00b..b0a13d1 100644
--- a/doc/docbook/chap_logfiles_part.xml
+++ b/doc/docbook/chap_logfiles_part.xml
@@ -1,14 +1,17 @@
 <?xml version="1.0" ?>
 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.docbook.org/xml/4.5/docbookx.dtd">
-<chapter id="chap_logfiles">
+<chapter id="chap_tmpfiles">
   <chapterinfo>
     <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="versionfile"/>
+    <releaseinfo>
+      <emphasis role="light">Document revision	$Id$</emphasis>
+    </releaseinfo>
     <author>
       <firstname>Bastien</firstname>
       <surname>Chevreux</surname>
       <email>bach at chevreux.org</email>
     </author>
-    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="copyrightfile"/>
+    <copyright><year>2011</year><holder>Bastien Chevreux</holder></copyright>
   </chapterinfo>
   <blockquote>
     <attribution>Solomon Short</attribution>
@@ -17,8 +20,7 @@
       </quote></emphasis>
     </para>
   </blockquote>
-  <title>Log and temporary files used by MIRA</title>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="warning_frontofchapter.xml"/>
+  <title>Log and temporary files used by MIRA 3</title>
   <sect1 id="sect1_logf_introduction">
     <title>
       Introduction
@@ -107,7 +109,7 @@
       <para>
 	After the initial all-against-all search (SKIM3), this file tells you to how
 	many other reads each read has overlaps. Furthermore, reads that have more
-	overlaps than expected are tagged with ``mc'' (multicopy).
+	overlaps than expected are tagged with ``mc'' (multycopy).
       </para>
     </sect2>
     <sect2 id="sect2_logf_mira_int_posmatch_rawhashhits_passxlst">
@@ -117,7 +119,7 @@
       <para>
 	Note: replace the <emphasis>X</emphasis> by the pass of mira. Similar to
 	<filename>mira_int_posmatch_multicopystat_preassembly.0.txt</filename>, this counts the
-	kmer hits of each read to other reads. This time however per pass.
+	hash hits of each read to other reads. This time however per pass.
       </para>
     </sect2>
     <sect2 id="sect2_logf_mira_int_skimmarknastyrepeats_hist_passxlst">
@@ -126,8 +128,8 @@
       </title>
       <para>
 	Note: replace the <emphasis>X</emphasis> by the pass of mira. Only written if
-	<arg>-KS:mnr</arg> is set to <emphasis role="underline">yes</emphasis>. This file contains a
-	histogram of kmer occurrences encountered by SKIM3.
+	<arg>-SK:mnr</arg> is set to <emphasis role="underline">yes</emphasis>. This file contains a
+	histogram of hash occurrences encountered by SKIM3.
       </para>
     </sect2>
     <sect2 id="sect2_logf_mira_int_skimmarknastyrepeats_nastyseq_passxlst">
@@ -136,7 +138,7 @@
       </title>
       <para>
 	Note: replace the <emphasis>X</emphasis> by the pass of mira.  Only written if
-	<arg>-KS:mnr</arg> is set to <emphasis role="underline">yes</emphasis>. One of the more interesting
+	<arg>-SK:mnr</arg> is set to <emphasis role="underline">yes</emphasis>. One of the more interesting
 	files if you want to know the repetitive sequences cause the assembly to be
 	really difficult: for each masked part of a read, the masked sequences is
 	shown here.
@@ -151,9 +153,10 @@
 	U13a05e12.t1    CTCTCTCTCTCTCTCTCTCTCTCTCTCTC
       </screen>
       <para>
-	Simple repeats like the ones shown above will certainly pop-up there,
-	but a few other sequences (like e.g. rDNA/rRNA or SINEs, LINEs in
-	eukaryotes) will also appear.
+      </para>
+      <para>
+	Simple repeats like the ones shown above will certainly pop-up there, but a
+	few other sequences (like e.g. SINEs, LINEs in eukaryotes) will also appear.
       </para>
       <para>
 	Nifty thing to try out if you want to have a more compressed overview: sort
@@ -218,3 +221,4 @@
     </sect2>
   </sect1>
 </chapter>
+
diff --git a/doc/docbook/chap_maf_part.xml b/doc/docbook/chap_maf_part.xml
index 9488fc4..eb2de3c 100644
--- a/doc/docbook/chap_maf_part.xml
+++ b/doc/docbook/chap_maf_part.xml
@@ -3,12 +3,15 @@
 <chapter id="chap_maf">
   <chapterinfo>
     <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="versionfile"/>
+    <releaseinfo>
+      <emphasis role="light">Document revision	$Id$</emphasis>
+    </releaseinfo>
     <author>
       <firstname>Bastien</firstname>
       <surname>Chevreux</surname>
       <email>bach at chevreux.org</email>
     </author>
-    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="copyrightfile"/>
+    <copyright><year>2011</year><holder>Bastien Chevreux</holder></copyright>
   </chapterinfo>
   <blockquote>
     <attribution>Solomon Short</attribution>
@@ -18,13 +21,8 @@
     </para>
   </blockquote>
   <title>The MAF format</title>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="warning_frontofchapter.xml"/>
   <para>
-    This documents describes purpose and format of the MAF format, version
-    1. Which has been superceeded by version 2 but is not described here
-    (yet). But as v1 and v2 are very similar only the notion of readgroups is
-    a big change, I'll let this description live until I have time to update
-    this section.
+    This documents describes purpose and format of the MAF format, version 1.
   </para>
   <sect1 id="sect1_introduction:_why_an_own_assembly_format?">
     <title>
@@ -81,7 +79,7 @@
     </title>
     <para>
       This describes version 1 of the MAF format. If the need arises, enhancements
-      like meta-data about total number of contigs and reads will be implemented in the
+      like metadata about total number of contigs and reads will be implemented in the
       next version.
     </para>
     <sect2 id="sect2_basics">
@@ -233,7 +231,7 @@
 	  </listitem>
 	  <listitem>
 	    <para>
-	      DI <emphasis>character: F or R</emphasis>
+	      DI <emphasis>character: F or R</emphasis> 
 	    </para>
 	    <para> Direction of the read with respect to the
 	    template. F for forward, R for reverse.
@@ -241,18 +239,18 @@
 	  </listitem>
 	  <listitem>
 	    <para>
-	      TF <emphasis>integer: template size from</emphasis>
+	      TF <emphasis>integer: template size from</emphasis> 
 	    </para>
-	    <para> Minimum estimated
+	    <para> Minimum estimated 
 	    size of a sequencing template. In paired-end sequencing, this is the minimum
 	    distance of the read pair.
 	    </para>
 	  </listitem>
 	  <listitem>
 	    <para>
-	      TT <emphasis>integer: template size to</emphasis>
+	      TT <emphasis>integer: template size to</emphasis> 
 	    </para>
-	    <para> Maximum estimated
+	    <para> Maximum estimated 
 	    size of a sequencing template. In paired-end sequencing, this is the maximum
 	    distance of the read pair.
 	    </para>
@@ -267,9 +265,9 @@
 	  </listitem>
 	  <listitem>
 	    <para>
-	      SL <emphasis>integer: seqvec left</emphasis>
+	      SL <emphasis>integer: seqvec left</emphasis> 
 	    </para>
-	    <para>
+	    <para> 
 	      Clip left due to sequencing vector. Assumed to be 1 if not
 	      present. Note that left clip values are excluding, e.g.: a value
 	      of '7' clips off the left 6 bases.
@@ -277,9 +275,9 @@
 	  </listitem>
 	  <listitem>
 	    <para>
-	      QL <emphasis>integer: qual left</emphasis>
+	      QL <emphasis>integer: qual left</emphasis> 
 	    </para>
-	    <para>
+	    <para> 
 	      Clip left due to low quality. Assumed to be 1 if not
 	      present. Note that left clip values are excluding, e.g.: a value
 	      off '7' clips of the left 6 bases.
@@ -287,7 +285,7 @@
 	  </listitem>
 	  <listitem>
 	    <para>
-	      CL <emphasis>integer: clip left</emphasis>
+	      CL <emphasis>integer: clip left</emphasis> 
 	    </para>
 	    <para>
 	      Clip left (any reason). Assumed to be 1 if not present. Note
@@ -297,7 +295,7 @@
 	  </listitem>
 	  <listitem>
 	    <para>
-	      SR <emphasis>integer: seqvec right</emphasis>
+	      SR <emphasis>integer: seqvec right</emphasis> 
 	    </para>
 	    <para> Clip right due to sequencing
 	    vector. Assumed to be the length of the sequence if not present. Note that
@@ -307,7 +305,7 @@
 	  </listitem>
 	  <listitem>
 	    <para>
-	      QR <emphasis>integer: qual right</emphasis>
+	      QR <emphasis>integer: qual right</emphasis> 
 	    </para>
 	    <para> Clip right due to low quality. Assumed
 	    to be the length of the sequence if not present. Note that right clip values
@@ -317,7 +315,7 @@
 	  </listitem>
 	  <listitem>
 	    <para>
-	      CR <emphasis>integer: clip right</emphasis>
+	      CR <emphasis>integer: clip right</emphasis> 
 	    </para>
 	    <para> Clip right (any reason). Assumed to be
 	    the length of the sequence if not present. Note that
@@ -327,7 +325,7 @@
 	  </listitem>
 	  <listitem>
 	    <para>
-	      AO <emphasis>four integers: x1 y1 x2 y2</emphasis>
+	      AO <emphasis>four integers: x1 y1 x2 y2</emphasis> 
 	    </para>
 	    <para> AO stands for "Align to
 	    Original". The interval [x1 y1] in the read as stored in the MAF file aligns
@@ -372,7 +370,7 @@
 	  </listitem>
 	  <listitem>
 	    <para>
-	      SN <emphasis>string: strain name</emphasis>
+	      SN <emphasis>string: strain name</emphasis> 
 	    </para>
 	    <para> Strain name of the sample that was
 	    sequenced, this is a free form string.
@@ -380,7 +378,7 @@
 	  </listitem>
 	  <listitem>
 	    <para>
-	      MT <emphasis>string: machine type</emphasis>
+	      MT <emphasis>string: machine type</emphasis> 
 	    </para>
 	    <para> Machine type which generated the data,
 	    this is a free form string.
@@ -388,7 +386,7 @@
 	  </listitem>
 	  <listitem>
 	    <para>
-	      BC <emphasis>string: base caller</emphasis>
+	      BC <emphasis>string: base caller</emphasis> 
 	    </para>
 	    <para>
 	      Base calling program used to call bases
@@ -396,7 +394,7 @@
 	  </listitem>
 	  <listitem>
 	    <para>
-	      IB <emphasis>boolean (0 or 1): is backbone</emphasis>
+	      IB <emphasis>boolean (0 or 1): is backbone</emphasis> 
 	    </para>
 	    <para> Whether the read is a backbone. Reads used as reference
 	    (backbones) in mapping assemblies get this attribute.
@@ -576,7 +574,7 @@
 	    so that parsers do not need to perform time consuming string
 	    lookups. Every read in a contig has exactly one AT line.
 	    </para>
-	    <para> The interval
+	    <para> The interval 
 	    [x2 y2] of the read (i.e., the unclipped data, also called the 'clear range')
 	    aligns with the interval [x1 y1] of the contig. If x1 > y1 (the contig
 	    positions), then the reverse complement of the read is aligned to the
@@ -592,7 +590,7 @@
 	  </listitem>
 	  <listitem>
 	    <para>
-	      EC
+	      EC 
 	    </para>
 	    <para> This ends a contig and is mandatory
 	    </para>
@@ -602,3 +600,4 @@
     </sect2>
   </sect1>
 </chapter>
+
diff --git a/doc/docbook/chap_mapping_part.xml b/doc/docbook/chap_mapping_part.xml
deleted file mode 100644
index 4295304..0000000
--- a/doc/docbook/chap_mapping_part.xml
+++ /dev/null
@@ -1,776 +0,0 @@
-<?xml version="1.0" ?>
-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.docbook.org/xml/4.5/docbookx.dtd">
-<chapter id="chap_mapping">
-  <chapterinfo>
-    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="versionfile"/>
-    <author>
-      <firstname>Bastien</firstname>
-      <surname>Chevreux</surname>
-      <email>bach at chevreux.org</email>
-    </author>
-    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="copyrightfile"/>
-  </chapterinfo>
-  <blockquote>
-    <attribution>Solomon Short</attribution>
-    <para>
-      <emphasis><quote>You have to know what you're looking for before you can find it.</quote></emphasis>
-    </para>
-  </blockquote>
-  <title>Mapping assemblies</title>
-  <sect1 id="sect_map_introduction">
-    <title>
-      Introduction
-    </title>
-    <para>
-      This guide assumes that you have basic working knowledge of Unix systems, know
-      the basic principles of sequencing (and sequence assembly) and what assemblers
-      do.
-    </para>
-    <para>
-      While there are step by step instructions on how to setup your data and
-      then perform an assembly, this guide expects you to read at some point in time
-    </para>
-    <itemizedlist>
-      <listitem>
-	<para>
-	  Before the mapping, <xref xrefstyle="select: label quotedtitle
-	  pageabbrev" linkend="chap_dataprep"/> to know what to do (or not to
-	  do) with the sequencing data before giving it to MIRA.
-	</para>
-      </listitem>
-      <listitem>
-	<para>
-	  Generally, the <xref xrefstyle="select: label quotedtitle
-	  pageabbrev" linkend="chap_results"/> to know what to do with the
-	  results of the assembly. More specifically, <xref xrefstyle="select: label quotedtitle
-	  pageabbrev" linkend="sect_res_converting_results"/> <xref xrefstyle="select: label quotedtitle
-	  pageabbrev" linkend="sect_res_places_of_interest_in_a_mapping_assembly"/> <xref xrefstyle="select: label quotedtitle
-	  pageabbrev" linkend="sect_res_postprocessing_mapping_assemblies"/>
-	</para>
-      </listitem>
-      <listitem>
-	<para>
-	  And also <xref xrefstyle="select: label quotedtitle pageabbrev"
-	  linkend="chap_reference"/> to look up how manifest files should be
-	  written (<xref xrefstyle="select: label quotedtitle pageabbrev"
-	  linkend="sect_ref_manifest_basics"/> and <xref xrefstyle="select: label quotedtitle pageabbrev"
-	  linkend="sect_ref_manifest_readgroups"/> and <xref xrefstyle="select: label quotedtitle pageabbrev"
-	  linkend="sect_ref_manifest_parameters"/>), some command line options as well as general information on
-	  what tags MIRA uses in assemblies, files it generates etc.pp
-	</para>
-      </listitem>
-      <listitem>
-	<para>
-	  Last but not least, you may be interested in some observations about
-	  the different sequencing technologies and the traps they may
-	  contain, see <xref xrefstyle="select: label quotedtitle pageabbrev"
-	  linkend="chap_seqtechdesc"/> for that. For advice on what to pay
-	  attention to <emphasis>before</emphasis> going into a sequencing
-	  project, have a look at <xref xrefstyle="select: label quotedtitle
-	  pageabbrev" linkend="chap_seqadvice"/>.
-	</para>
-      </listitem>
-    </itemizedlist>
-  </sect1>
-  <sect1 id="sect_map_general">
-    <title>
-      General steps
-    </title>
-    <para>
-      This part will introduce you step by step how to get your data together for a
-      simple mapping assembly.
-    </para>
-    <para>
-      I'll make up an example using an imaginary bacterium: <emphasis>Bacillus chocorafoliensis</emphasis> (or short: <emphasis>Bchoc</emphasis>).
-    </para>
-    <para>
-      In this example, we assume you have two strains: a wild type strain of
-      <emphasis>Bchoc_wt</emphasis> and a mutant which you perhaps got from mutagenesis or other
-      means. Let's imagine that this mutant needs more time to eliminate a given
-      amount of chocolate, so we call the mutant <emphasis>Bchoc_se</emphasis> ... SE for
-      <emphasis role="bold">s</emphasis>low <emphasis role="bold">e</emphasis>ater
-    </para>
-    <para>
-      You wanted to know which mutations might be responsible for the observed
-      behaviour. Assume the genome of <emphasis>Bchoc_wt</emphasis> is available to you as it was
-      published (or you previously sequenced it), so you resequenced <emphasis>Bchoc_se</emphasis>
-      with Solexa to examine mutations.
-    </para>
-    <sect2 id="sect_map_ge_copying_and_naming_the_sequence_data">
-      <title>
-	Copying and naming the sequence data
-      </title>
-      <para>
-	You need to create (or get from your sequencing provider) the sequencing data
-	in either FASTQ or FASTA + FASTA quality format. The following walkthrough
-	uses what most people nowadays get: FASTQ.
-      </para>
-      <para>
-	Create a new project directory (e.g. <filename>myProject</filename>) and a subdirectory of this which will hold the sequencing data (e.g. <filename>data</filename>).
-      </para>
-      <screen><prompt>arcadia:/path/to</prompt> <userinput>mkdir myProject</userinput>
-<prompt>arcadia:/path/to</prompt> <userinput>cd myProject</userinput>
-<prompt>arcadia:/path/to/myProject$</prompt> <userinput>mkdir data</userinput></screen>
-      <para>
-	Put the FASTQ data into that <filename>data</filename> directory so that it now looks perhaps like this:
-      </para>
-      <screen><prompt>arcadia:/path/to/myProject$</prompt> <userinput>ls -l data</userinput>
--rw-r--r-- 1 bach users 263985896 2008-03-28 21:49 bchocse_lane6.solexa.fastq
--rw-r--r-- 1 bach users 264823645 2008-03-28 21:51 bchocse_lane7.solexa.fastq</screen>
-    </sect2>
-    <note>
-      I completely made up the file names above. You can name them anyway you
-      want. And you can have them live anywhere on the hard disk, you do not
-      need to put them in this <filename>data</filename> directory. It's just
-      the way I do it ... and it's where the example manifest files a bit further down
-      in this chapter will look for the data files.
-    </note>
-    <sect2 id="sect_map_ma_copying_and_naming_the_reference_sequence">
-      <title>
-	Copying and naming the reference sequence
-      </title>
-      <para>
-	The reference sequence (the backbone) can be in a number of different
-	formats: GFF3, GenBank, MAF, CAF, FASTA. The first three have the advantage
-	of being able to carry additional information like, e.g.,
-	annotation. In this example, we will use a GFF3 file like the ones
-	one can download from the NCBI.
-      </para>
-      <note>
-	TODO: Write why GFF3 is better and where to get them at the NCBI.
-      </note>
-      <para>
-	So, let's assume that our wild type
-	strain is in the following file:
-	<filename>NC_someNCBInumber.gff3</filename>.
-      </para>
-      <para>
-	You do not need to copy the reference sequence to your directory, but
-	I normally copy also the reference file into the directory with my
-	data as I want to have, at the end of my work, a nice little
-	self-sufficient directory which I can archive away and still be sure
-	that in 10 years time I have all data I need together.
-      </para>
-      <screen><prompt>arcadia:/path/to/myProject$</prompt> <userinput>cp /somewhere/NC_someNCBInumber.gff3 data</userinput>
-<prompt>arcadia:/path/to/myProject$</prompt> <userinput>ls -l data</userinput>
--rw-r--r-- 1 bach users   6543511 2008-04-08 23:53 NC_someNCBInumber.gff3
--rw-r--r-- 1 bach users 263985896 2008-03-28 21:49 bchocse_lane6.solexa.fastq
--rw-r--r-- 1 bach users 264823645 2008-03-28 21:51 bchocse_lane7.solexa.fastq</screen>
-    <para>
-      We're almost finished with the setup. As I like to have things neatly separated, I always create a directory called <filename>assemblies</filename> which will hold my assemblies (or different trials) together. Let's quickly do that:
-    </para>
-    <screen><prompt>arcadia:/path/to/myProject$</prompt> <userinput>mkdir assemblies</userinput>
-<prompt>arcadia:/path/to/myProject$</prompt> <userinput>mkdir assemblies/1sttrial</userinput>
-<prompt>arcadia:/path/to/myProject$</prompt> <userinput>cd assemblies/1sttrial</userinput></screen>
-    </sect2>
-    <sect2 id="sect_map_ge_writing_a_simple_manifest_file">
-      <title>
-	Writing a simple manifest file
-      </title>
-      <para>
-	A manifest file is a configuration file for MIRA which tells it what
-	type of assembly it should do and which data it should load. In this
-	case we have unpaired sequencing data which we want to map to a
-	reference sequence, the manifest file for that is pretty simple:
-      </para>
-      <screen># Example for a manifest describing a mapping assembly with
-# unpaired Illumina data
-
-# First part: defining some basic things
-# In this example, we just give a name to the assembly
-#  and tell MIRA it should map a genome in accurate mode
-
-<userinput>project = <replaceable>MyFirstAssembly</replaceable>
-job = <replaceable>genome,mapping,accurate</replaceable></userinput>
-
-# The second part defines the sequencing data MIRA should load and assemble
-# The data is logically divided into "readgroups"
-
-# first, the reference sequence
-<userinput>readgroup
-is_reference
-data = <replaceable>../../data/NC_someNCBInumber.gff3</replaceable>
-strain = <replaceable>bchoc_wt</replaceable></userinput>
-
-# now the Illumina data
-
-<userinput>readgroup = <replaceable>SomeUnpairedIlluminaReadsIGotFromTheLab</replaceable>
-data = <replaceable>../../data/*fastq</replaceable>
-technology = <replaceable>solexa</replaceable>
-strain = <replaceable>bchoc_se</replaceable></userinput></screen>
-      <note>
-	<para>
-	  Please look up the parameters of the manifest file in the main
-	  manual or the example manifest files in the following section.
-	</para>
-	<para>
-	  The ones above basically say: make an accurate mapping of Solexa
-	  reads against a genome; in one pass; the name of the backbone strain
-	  is 'bchoc_wt'; the data with the backbone sequence (and maybe
-	  annotations) is in a specified GFF3 file; for Solexa data: assign
-	  default strain names for reads which have not loaded ancillary data
-	  with strain info and that default strain name should be 'bchoc_se'.
-	</para>
-      </note>
-    </sect2>
-    <sect2 id="sect_map_ge_starting_assembly">
-      <title>Starting the assembly</title>
-      <para>
-	Starting the assembly is now just a matter of a simple command line:
-      </para>
-      <screen><prompt>arcadia:/path/to/myProject/assemblies/1sttrial$</prompt> <userinput>mira <replaceable>manifest.conf >&log_assembly.txt</replaceable></userinput></screen>
-      <para>
-	For this example - if you followed the walk-through on how to prepare the data
-	- everything you might want to adapt in the first time are the following thing in the manifest file:
-	options:
-      </para>
-      <itemizedlist>
-	<listitem>
-	  <para>
-	    project= (for naming your assembly project)
-	  </para>
-	</listitem>
-	<listitem>
-	  <para>
-	    strain_name= to give the names of your reference and mapping strain
-	  </para>
-	</listitem>
-      </itemizedlist>
-      <para>
-	Of course, you are free to change any option via the extended parameters, but
-	this is the topic of another part of this manual.
-      </para>
-    </sect2>
-  </sect1>
-  <sect1 id="sect_map_manifest_files_use_cases">
-    <title>
-      Manifest files for different use cases
-    </title>
-    <para>
-      This section will introduce you to manifest files for different use
-      cases. It should cover the most important uses, but as always you are
-      free to mix and match the parameters and readgroup definitions to suit
-      your specific needs.
-    </para>
-    <para>
-      Taking into account that there may be <emphasis>a lot</emphasis> of
-      combinations of sequencing technologies, sequencing libraries (shotgun,
-      paired-end, mate-pair, etc.) and input file types (FASTQ, FASTA,
-      GenBank, GFF3, etc.pp), the example manifest files just use Illumina and
-      454 as technologies, GFF3 as input file type for the reference sequence,
-      FASTQ as input type for sequencing data ... and they do not show the
-      multitude of more advanced features like, e.g., using ancillary clipping
-      information in XML files, ancillary masking information in SSAHA2 or
-      SMALT files etc.pp.
-    </para>
-    <para>
-      I'm sure you will be able to find your way by scanning through the
-      corresponding section on manifest files in the reference chapter :-)
-    </para>
-    <sect2 id="sect_map_mf_mapping_with_shotgun_data">
-      <title>
-	Mapping with shotgun data
-      </title>
-      <para>
-	Well, we've seen that already in the section above, but here it is
-	again ... this time with Ion Torrent data though.
-      </para>
-      <screen># Example for a manifest describing a mapping assembly with
-# unpaired Ion data
-
-# First part: defining some basic things
-# In this example, we just give a name to the assembly
-#  and tell MIRA it should map a genome in accurate mode
-
-<userinput>project = <replaceable>MyFirstAssembly</replaceable>
-job = <replaceable>genome,mapping,accurate</replaceable></userinput>
-
-# The second part defines the sequencing data MIRA should load and assemble
-# The data is logically divided into "readgroups"
-
-# first, the reference sequence
-<userinput>readgroup
-is_reference
-data = <replaceable>../../data/NC_someNCBInumber.gff3</replaceable>
-strain = <replaceable>bchoc_wt</replaceable></userinput>
-
-# now the Ion Torrent data
-
-<userinput>readgroup = <replaceable>SomeUnpairedIonReadsIGotFromTheLab</replaceable>
-data = <replaceable>../../data/someiondata.fastq</replaceable>
-technology = <replaceable>iontor</replaceable>
-strain = <replaceable>bchoc_se</replaceable></userinput></screen>
-    </sect2>
-    <sect2 id="sect_map_mf_manifest_for_pairedend_data">
-      <title>
-	Manifest for data sets with paired reads
-      </title>
-      <para>
-      </para>
-      <para>
-	When using paired-end data in mapping, you must decide whether you want
-      </para>
-      <orderedlist>
-	<listitem>
-	  <para>
-	    use the MIRA feature to create long 'coverage equivalent reads'
-	    (CERs) which saves a lot of memory (both in the assembler and
-	    later on in an assembly editor). However, you then
-	    <emphasis>loose information about read pairs!</emphasis>
-	  </para>
-	</listitem>
-	<listitem>
-	  <para>
-	    or whether you want to <emphasis>keep information about read
-	    pairs</emphasis> at the expense of larger memory requirements both
-	    in MIRA and in assembly finishing tools or viewers afterwards.
-	  </para>
-	</listitem>
-	<listitem>
-	  <para>
-	    or a mix of the two above
-	  </para>
-	</listitem>
-      </orderedlist>
-      <para>
-	The Illumina pipeline generally normally gives you two files for paired-end
-	data: a <filename>project-1.fastq</filename> and
-	<filename>project-2.fastq</filename>. The first file containing the
-	first read of a read-pair, the second file the second read. Depending
-	on the preprocessing pipeline of your sequencing provider, the names
-	of the reads are either the very same in both files or already have
-	a <literal>/1</literal> or <literal>/2</literal> appended. Also, your
-	sequencing provider may give you one big file where the reads from
-	both ends are present.
-      </para>
-      <note>
-	<para>
-	  MIRA can read all FASTQ variants produced by various Illumina
-	  pipelines, be they with or without the /1 and /2 already appended to
-	  the names. You generally do not need to do any name mangling before
-	  feeding the data to MIRA. However, MIRA will shell out a warning if read names are longer than 40 characters.
-	</para>
-      </note>
-
-      <para>
-	When using paired-end data, you should know
-      </para>
-      <orderedlist>
-	<listitem>
-	  <para>
-	    the orientation of the reads toward each other. This is specific
-	    to sequencing technologies and / or the sequencing library preparation.
-	  </para>
-	</listitem>
-	<listitem>
-	  <para>
-	    at which distance these reads should be. This is specific to the
-	    sequencing library preparation and the sequencing lab should tell
-	    you this.
-	  </para>
-	</listitem>
-      </orderedlist>
-      <para>
-	In case you do not know one (or any) of the above, don't panic! MIRA
-	is able to estimate the needed values during the assembly if you tell
-	it to.
-      </para>
-      <para>
-	The following manifest shows you the most laziest way to define a
-	paired data set by simply adding <emphasis>autopairing</emphasis> as keyword to a
-	readgroup (using Illumina just as example):
-      </para>
-      <screen># Example for a lazy manifest describing a denovo assembly with
-# one library of paired reads
-
-# First part: defining some basic things
-# In this example, we just give a name to the assembly
-#  and tell MIRA it should map a genome in accurate mode
-
-<userinput>project = <replaceable>MyFirstAssembly</replaceable>
-job = <replaceable>genome,mapping,accurate</replaceable></userinput>
-
-# The second part defines the sequencing data MIRA should load and assemble
-# The data is logically divided into "readgroups"
-
-# first the reference sequence
-<userinput>readgroup
-is_reference
-data = <replaceable>../../data/NC_someNCBInumber.gff3</replaceable>
-technology = <replaceable>text</replaceable>
-strain = <replaceable>bchoc_wt</replaceable></userinput>
-
-# now the Illumina paired-end data
-
-<userinput>readgroup = <replaceable>DataIlluminaPairedLib</replaceable>
-<replaceable>autopairing</replaceable>
-data = <replaceable>../../data/project_1.fastq ../../data/project_2.fastq</replaceable>
-technology = <replaceable>solexa</replaceable>
-strain = <replaceable>bchoc_se1</replaceable>
-</userinput></screen>
-      <para>
-	See? Wasn't hard and it did not hurt, did it? One just needs to tell
-	MIRA it should expect paired reads via
-	the <emphasis>autopairing</emphasis> keyword and that is everything you
-	need.
-      </para>
-      <para>
-	If you know the orientation of the reads and/or the library size, you
-	can tell this MIRA the following way (just showing the readgroup
-	definition here):
-      </para>
-      <screen><userinput>readgroup = <replaceable>DataIlluminaPairedEnd500Lib</replaceable>
-data = <replaceable>../../data/project_1.fastq ../../data/project_2.fastq</replaceable>
-technology = <replaceable>solexa</replaceable>
-template_size = <replaceable>250 750</replaceable>
-segment_placement = <replaceable>---> <---</replaceable></userinput></screen>
-      <para>
-	In cases you are not 100% sure about, e.g., the size of the DNA
-	template, you can also give a (generous) expected range and then tell
-	MIRA to automatically refine this range during the assembly based on
-	real, observed distances of read pairs. Do this with <emphasis>autorefine</emphasis>
-	modifier like this:
-      </para>
-      <screen><userinput>template_size = <replaceable>50 1000 autorefine</replaceable></userinput></screen>
-      <para>
-	The following manifest file is an example for mapping a 500 bp
-	paired-end and a 3kb mate-pair library of a strain
-	called <emphasis>bchoc_se1</emphasis> against a GenBank reference
-	file containing a strain called <emphasis>bchoc_wt</emphasis>:
-      </para>
-      <screen># Example for a manifest describing a mapping assembly with
-# paired Illumina data, not merging reads and therefore keeping
-# all pair information
-
-# First part: defining some basic things
-# In this example, we just give a name to the assembly
-#  and tell MIRA it should map a genome in accurate mode
-# As special parameter, we want to switch off merging of Solexa reads
-
-<userinput>project = <replaceable>MyFirstAssembly</replaceable>
-job = <replaceable>genome,mapping,accurate</replaceable>
-parameters = <replaceable>SOLEXA_SETTINGS -CO:msr=no</replaceable></userinput>
-
-# The second part defines the sequencing data MIRA should load and assemble
-# The data is logically divided into "readgroups"
-
-# first, the reference sequence
-<userinput>readgroup
-is_reference
-data = <replaceable>../../data/NC_someNCBInumber.gff3</replaceable>
-technology = <replaceable>text</replaceable>
-strain = <replaceable>bchoc_wt</replaceable></userinput>
-
-# now the Illumina data
-
-<userinput>readgroup = <replaceable>DataForPairedEnd500bpLib</replaceable>
-<replaceable>autopairing</replaceable>
-data = <replaceable>../../data/project500bp-1.fastq ../../data/project500bp-2.fastq</replaceable>
-technology = <replaceable>solexa</replaceable>
-strain = <replaceable>bchoc_se1</replaceable></userinput>
-
-<userinput>readgroup = <replaceable>DataForMatePair3kbLib</replaceable>
-data = <replaceable>../../data/project3kb-1.fastq ../../data/project3kb-2.fastq</replaceable>
-technology = <replaceable>solexa</replaceable>
-strain = <replaceable>bchoc_se1</replaceable>
-template_size = <replaceable>2000 4000 autorefine</replaceable>
-segment_placement = <replaceable><--- ---></replaceable></userinput></screen>
-      <para>
-	Please look up the parameters used in the main manual. The ones
-	above basically say: make an accurate mapping of Solexa reads
-	against a genome. Additionally do not merge short short Solexa
-	reads to the contig.
-      </para>
-      <para>
-	For the paired-end library, be lazy and let MIRA find out everything
-	it needs. However, that information should be treated as
-	"information only" by MIRA, i.e., it is not used for deciding whether
-	a pair is well mapped.
-      </para>
-      <para>
-	For the mate-pair library, assume a DNA template template size of
-	2000 to 4000 bp (but let MIRA automatically refine this using observed
-	distances) and the segment orientation of the read pairs follows
-	the reverse / forward scheme. That information should be treated as
-	"information only" by MIRA, i.e., it is not used for deciding whether
-	a pair is well mapped.
-      </para>
-      <para>
-	Comparing this manifest with a manifest for unpaired-data, two
-	parameters were added in the section for Solexa data:
-      </para>
-      <orderedlist>
-	<listitem>
-	  <para>
-	    <literal>-CO:msr=no</literal> tells MIRA not to merge reads that
-	    are 100% identical to the backbone. This also allows to keep the
-	    template information (distance and orientation) for the reads.
-	  </para>
-	</listitem>
-	<listitem>
-	  <para>
-	    <literal>template_size</literal> tells MIRA at which distance the
-	    two reads should normally be placed from each other.
-	  </para>
-	</listitem>
-	<listitem>
-	  <para>
-	    <literal>segment_placement</literal> tells MIRA how the different
-	    segments (reads) of a DNA template have to be ordered to form a
-	    valid representation of the sequenced DNA.
-	  </para>
-	</listitem>
-      </orderedlist>
-      <note>
-	<para>
-	  Note that in mapping assemblies, these
-	  <literal>template_distance</literal> and
-	  <literal>segment_placement</literal> parameters are normally treated
-	  as <emphasis>information only</emphasis>, i.e., MIRA will map the
-	  reads regardless whether the distance and orientation criterions are
-	  met or not. This enables post-mapping analysis programs to hunt for
-	  genome rearrangements or larger insertions/deletion.
-	</para>
-      </note>
-      <warning>
-	<para>
-	  If template size and segment placement checking were on, the
-	  following would happen at, e.g. sites of re-arrangement: MIRA would
-	  map the first read of a read-pair without problem. However, it would
-	  very probably reject the second read because it would not map at the
-	  specified distance or orientation from its partner. Therefore, in
-	  mapping assemblies with paired-end data, checking of the template
-	  size must be switched off to give post-processing programs a chance
-	  to spot re-arrangements.
-	</para>
-      </warning>
-    </sect2>
-    <sect2 id="sect_map_mf_mapping_with_multiple_technologies">
-      <title>
-	Mapping with multiple sequencing technologies (hybrid mapping)
-      </title>
-      <para>
-	I'm sure you'll have picked up the general scheme of manifest files by
-	now. Hybrid mapping assemblies follow the general scheme: simply add
-	as separate readgroup the information MIRA needs to know to find the
-	data and off you go. Just for laughs, here's a manifest for 454
-	shotgun with Illumina paired-end
-      </para>
-      <screen># Example for a manifest describing a mapping assembly with
-# shotgun 454 and paired-end Illumina data, not merging reads and therefore keeping
-# all pair information
-
-# First part: defining some basic things
-# In this example, we just give a name to the assembly
-#  and tell MIRA it should map a genome in accurate mode
-# As special parameter, we want to switch off merging of Solexa reads
-
-<userinput>project = <replaceable>MyFirstAssembly</replaceable>
-job = <replaceable>genome,mapping,accurate</replaceable>
-parameters = <replaceable>SOLEXA_SETTINGS -CO:msr=no</replaceable></userinput>
-
-# The second part defines the sequencing data MIRA should load and assemble
-# The data is logically divided into "readgroups"
-
-# first, the reference sequence
-<userinput>readgroup
-is_reference
-data = <replaceable>../../data/NC_someNCBInumber.gff3</replaceable>
-strain = <replaceable>bchoc_wt</replaceable></userinput>
-
-# now the shotgun 454 data
-<userinput>readgroup = <replaceable>DataForShotgun454</replaceable>
-data = <replaceable>../../data/project454data.fastq</replaceable>
-technology = <replaceable>454</replaceable>
-strain = <replaceable>bchoc_se1</replaceable></userinput>
-
-# now the paired-end Illumina data
-
-<userinput>readgroup = <replaceable>DataForPairedEnd500bpLib</replaceable>
-data = <replaceable>../../data/project500bp-1.fastq ../../data/project500bp-2.fastq</replaceable>
-technology = <replaceable>solexa</replaceable>
-strain = <replaceable>bchoc_se1</replaceable>
-template_size = <replaceable>250 750</replaceable>
-segment_placement = <replaceable>---> <---</replaceable></userinput></screen>
-    </sect2>
-    <sect2 id="sect_map_mf_mapping_with_multiple_strains">
-      <title>
-	Mapping with multiple strains
-      </title>
-      <para>
-	MIRA will make use of ancillary information present in the manifest
-	file. One of these is the information to which strain (or organism or
-	cell line etc.pp) the generated data belongs.
-      </para>
-      <para>
-	You just need to tell in the manifest file which data comes from which
-	strain. Let's assume that in the example from above, the "lane6" data
-	were from a first mutant named <emphasis>bchoc_se1</emphasis> and the
-	"lane7" data were from a second mutant
-	named <emphasis>bchoc_se2</emphasis>. Here's the manifest file you
-	would write then:
-      </para>
-      <screen># Example for a manifest describing a mapping assembly with
-# unpaired Illumina data
-
-# First part: defining some basic things
-# In this example, we just give a name to the assembly
-#  and tell MIRA it should map a genome in accurate mode
-
-<userinput>project = <replaceable>MyFirstAssembly</replaceable>
-job = <replaceable>genome,mapping,accurate</replaceable></userinput>
-
-# The second part defines the sequencing data MIRA should load and assemble
-# The data is logically divided into "readgroups"
-
-# first, the reference sequence
-<userinput>readgroup
-is_reference
-data = <replaceable>../../data/NC_someNCBInumber.gff3</replaceable>
-technology = <replaceable>text</replaceable>
-strain = <replaceable>bchoc_wt</replaceable></userinput>
-
-# now the Illumina data
-
-<userinput>readgroup = <replaceable>DataForSE1</replaceable>
-data = <replaceable>../../data/bchocse_lane6.solexa.fastq</replaceable>
-technology = <replaceable>solexa</replaceable>
-strain = <replaceable>bchoc_se1</replaceable></userinput>
-
-<userinput>readgroup = <replaceable>DataForSE2</replaceable>
-data = <replaceable>../../data/bchocse_lane7.solexa.fastq</replaceable>
-technology = <replaceable>solexa</replaceable>
-strain = <replaceable>bchoc_se2</replaceable></userinput></screen>
-      <note>
-	While mapping (or even assembling de-novo) with multiple strains is
-	possible, the interpretation of results may become a bit daunting in
-	some cases. For many scenarios it might therefore be preferable to
-	successively use the data sets in own mappings or assemblies.
-      </note>
-      <para>
-	This <emphasis>strain</emphasis> information for each readgroup is really the only change you need to perform to tell MIRA everything it needs for handling strains.
-      </para>
-    </sect2>
-  </sect1>
-  <sect1 id="sect_map_walkthroughs">
-    <title>
-      Walkthroughs
-    </title>
-    <sect2 id="sect_map_walkthrough:_mapping_of_ecoli_from_lenski_lab_against_ecoli_b_rel606">
-      <title>
-	Walkthrough: mapping of E.coli from Lenski lab against E.coli B REL606
-      </title>
-      <para>
-	TODO: Sorry, needs to be re-written for the relatively new SRR format
-	distributed at the NCBI ... and changes in MIRA 3.9.x. Please come
-	back later.
-      </para>
-    </sect2>
-  </sect1>
-  <sect1 id="sect_map_useful_about_reference_sequences">
-    <title>
-      Useful things to know about reference sequences
-    </title>
-    <para>
-      There are a few things to consider when using reference sequences:
-    </para>
-    <orderedlist>
-      <listitem>
-	<para>
-	  MIRA is not really made to handle a big amount of reference
-	  sequences as they currently need inane amounts of memory. Use other
-	  programs for mapping against more than, say, 200 megabases.
-	</para>
-      </listitem>
-      <listitem>
-	<para>
-	  Reference sequences can be as long as needed! They are not subject
-	  to normal read length constraints of a maximum of 32k bases. That
-	  is, if one wants to load one or several entire chromosomes of a
-	  bacterium or lower eukaryote as backbone sequence(s), this is just
-	  fine.
-	</para>
-      </listitem>
-      <listitem>
-	<para>
-	  Reference sequences can be single sequences like provided in, e.g.,
-	  FASTA, FASTQ, GFF or GenBank files. But reference sequences also can
-	  be whole assemblies when they are provided as, e.g., MAF or CAF
-	  format. This opens the possibility to perform semi-hybrid assemblies
-	  by assembling first reads from one sequencing technology de-novo
-	  (e.g. PacBio) and then map reads from another sequencing technology
-	  (e.g. Solexa) to the whole PacBio alignment instead of mapping it to
-	  the PacBio consensus.
-	</para>
-	<para>
-	  A semi-hybrid assembly will therefore contain, like a hybrid
-	  assembly, the reads of both sequencing technologies.
-	</para>
-      </listitem>
-      <listitem>
-	<para>
-	  Reference sequences will not be reversed! They will always appear in
-	  forward direction in the output of the assembly. Please note: if the
-	  backbone sequence consists of a MAF or CAF file that contain contigs
-	  which contain reversed reads, then the contigs themselves will be in
-	  forward direction. But the reads they contain that are in reverse
-	  complement direction will of course also stay reverse complement
-	  direction.
-	</para>
-      </listitem>
-      <listitem>
-	<para>
-	  Reference sequences will not not be assembled together! That is,
-	  even if a reference sequence has a perfect overlap with another
-	  reference sequence, they will still not be merged.
-	</para>
-      </listitem>
-      <listitem>
-	<para>
-	  Reads are assembled to reference sequences in a first come, first
-	  served scattering strategy.
-	</para>
-	<para>
-	  Suppose you have two identical reference sequences and a read which
-	  would match both, then the read would be mapped to the first
-	  backbone. If you had two identical reads, the first read would go to
-	  the first backbone, the second read to the second backbone. With
-	  three identical reads, the first backbone would get two reads, the
-	  second backbone one read. Etc.pp.
-	</para>
-      </listitem>
-      <listitem>
-	<para>
-	  Only in references loaded from MAF or CAF files: contigs made out of
-	  single reads (singlets) loose their status as reference sequence and
-	  will be returned to the normal read pool for the assembly
-	  process. That is, these sequences will be assembled to other
-	  reference sequences or with each other.
-	</para>
-      </listitem>
-    </orderedlist>
-  </sect1>
-  <sect1 id="sect_map_known_bugs_problems">
-    <title>
-      Known bugs / problems
-    </title>
-    <para>
-      These are actual for version 4.0 of MIRA and might or might not have been
-      addressed in later version.
-    </para>
-    <para>
-      Bugs:
-    </para>
-    <orderedlist>
-      <listitem>
-	<para>
-	  mapping of paired-end reads with one read being in non-repetitive
-	  area and the other in a repeat is not as effective as it should
-	  be. The optimal strategy to use would be to map first the
-	  non-repetitive read and then the read in the repeat. Unfortunately,
-	  this is not yet implemented in MIRA.
-	</para>
-      </listitem>
-    </orderedlist>
-  </sect1>
-</chapter>
diff --git a/doc/docbook/chap_mirautils_part.xml b/doc/docbook/chap_mirautils_part.xml
index d589413..efed763 100644
--- a/doc/docbook/chap_mirautils_part.xml
+++ b/doc/docbook/chap_mirautils_part.xml
@@ -4,12 +4,15 @@
 <chapter id="chap_mutils">
   <chapterinfo>
     <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="versionfile"/>
+    <releaseinfo>
+      <emphasis role="light">Document revision	$Id$</emphasis>
+    </releaseinfo>
     <author>
       <firstname>Bastien</firstname>
       <surname>Chevreux</surname>
       <email>bach at chevreux.org</email>
     </author>
-    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="copyrightfile"/>
+    <copyright><year>2011</year><holder>Bastien Chevreux</holder></copyright>
   </chapterinfo>
   <blockquote>
     <attribution>Solomon Short</attribution>
@@ -20,13 +23,13 @@
   </blockquote>
   <title>Utilities in the MIRA package</title>
   <sect1 id="sect_mutils_convpro">
-    <title>miraconvert</title>
+    <title>convert_project</title>
     <sect2 id="sect_mutils_cp_synopsis">
       <title>
 	Synopsis
       </title>
       <cmdsynopsis>
-	<command>miraconvert</command>
+	<command>convert_project</command>
 	<arg>options</arg>
 	<arg choice="req"><replaceable>input_file</replaceable></arg>
 	<arg choice="req"><replaceable>output_basename</replaceable></arg>
@@ -36,12 +39,12 @@
     <sect2 id="sect_mutils_cp_description">
       <title>Description</title>
       <para>
-	<command>miraconvert</command> is a tool to convert, extract and
+	<command>convert_project</command> is a tool to convert, extract and
 	sometimes recalculate all kinds of data related to sequence assembly
 	files.
       </para>
       <para>
-	More specifically, <command>miraconvert</command> can
+	More specifically, <command>convert_project</command> can
 	<orderedlist>
 	  <listitem>
 	    <para>
@@ -52,7 +55,7 @@
 	  </listitem>
 	  <listitem>
 	    <para>
-	      extract the consensus from multiple alignments in CAF and MAF format,
+	      extract the consenus from multiple alignments in CAF and MAF format,
 	      writing it to any supported output format (FASTA, FASTQ, plain text,
 	      HTML, etc.) and -- if wished -- recalculating the consensus using
 	      the MIRA consensus engine with MIRA parameters
@@ -121,15 +124,11 @@
 		  <arg choice="plain"><option>exp</option></arg>
 		  <arg choice="plain"><option>fasta</option></arg>
 		  <arg choice="plain"><option>fastq</option></arg>
-		  <arg choice="plain"><option>fcov</option></arg>
 		  <arg choice="plain"><option>gbf</option></arg>
-		  <arg choice="plain"><option>gff3</option></arg>
 		  <arg choice="plain"><option>hsnp</option></arg>
 		  <arg choice="plain"><option>html</option></arg>
 		  <arg choice="plain"><option>maf</option></arg>
 		  <arg choice="plain"><option>phd</option></arg>
-		  <arg choice="plain"><option>sam</option></arg>
-		  <arg choice="plain"><option>samnbb</option></arg>
 		  <arg choice="plain"><option>text</option></arg>
 		  <arg choice="plain"><option>tcs</option></arg>
 		  <arg choice="plain"><option>wig</option></arg>
@@ -142,7 +141,7 @@
 	      <para>
 		<quote>To-type</quote>, the format of the output file. Multiple
 		mentions of <arg>-t</arg> are allowed, in which case
-		<command>miraconvert</command> will convert to multiple types.
+		<command>convert_project</command> will convert to multiple types.
 	      </para>
 	    </listitem>
 	  </varlistentry>
@@ -155,29 +154,19 @@
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
-	    <term><option>-A</option></term>
+	    <term><option>-A <replaceable class="parameter">MIRA-PARAMETERSTRING</replaceable></option></term>
 	    <listitem>
 	      <para>
-		Do not adjust sequence case.
+		Additional MIRA parameters. Allows to initialise the underlying MIRA
+		routines with specific parameters. A use case can be, e.g., to
+		recalculate a consensus of an assembly in a slightly different way
+		(see also <arg>-r</arg>) than the one which is stored in assembly
+		files. Example: to tell the consensus algorithm to use a minimum
+		number of reads per group, use: "454_SETTINGS -CO:mrpg=4".
 	      </para>
 	      <para>
-		When reading formats which define clipping points (like CAF,
-		MAF or EXP), and saving to formats which do not have clipping
-		information, miraconvert normally adjusts the case of read
-		sequences: lower case for clipped parts, upper case for
-		unclipped parts of reads.  Use -A if you do not want this. See
-		also -C.
-	      </para>
-	      <note>
-		Applies only to files/formats which do not contain contigs.
-	      </note>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term><option>-b</option></term>
-	    <listitem>
-	      <para>
-		Blind data. Replace all bases in all reads / contigs with a 'c'.
+		Consult the MIRA reference manual for a full list of MIRA
+		parameters.
 	      </para>
 	    </listitem>
 	  </varlistentry>
@@ -193,29 +182,6 @@
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
-	    <term><option>-d</option></term>
-	    <listitem>
-	      <para>
-		Delete gap only columns. When output is contigs: delete
-		columns that are entirely gaps (can occur after having deleted
-		reads during editing in gap4, consed or other). When output is
-		reads: delete gaps in reads.
-	      </para>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term><option>-F</option></term>
-	    <listitem>
-	      <para>
-		Filter read groups to different files. Works only for input
-		files containing readgroups, i.e., CAF or MAF. 3 (or 4) files
-		are generated: one or two for paired, one for unpaired and one
-		for debris reads. Reads in paired file are interlaced by
-		default, use -F twice to create separate files.
-	      </para>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
 	    <term><option>-m</option></term>
 	    <listitem>
 	      <para>
@@ -236,14 +202,6 @@
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
-	    <term><option>-i</option></term>
-	    <listitem>
-	      <para>
-		When -n is used, inverts the selection.
-	      </para>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
 	    <term><option>-o <replaceable>offset</replaceable></option></term>
 	    <listitem>
 	      <para>
@@ -252,34 +210,6 @@
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
-	    <term><option>-P <replaceable class="parameter">MIRA-PARAMETERSTRING</replaceable></option></term>
-	    <listitem>
-	      <para>
-		Additional MIRA parameters. Allows to initialise the underlying MIRA
-		routines with specific parameters. A use case can be, e.g., to
-		recalculate a consensus of an assembly in a slightly different way
-		(see also <arg>-r</arg>) than the one which is stored in assembly
-		files. Example: to tell the consensus algorithm to use a minimum
-		number of reads per group for 454 reads, use: "454_SETTINGS -CO:mrpg=4".
-	      </para>
-	      <para>
-		Consult the MIRA reference manual for a full list of MIRA
-		parameters.
-	      </para>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term><option>-q quality_value</option></term>
-	    <listitem>
-	      <para>
-		When loading read data from files where sequence and quality
-		are split in several files (e.g. FASTA with .fasta and
-		.fasta.qual files), do not stop if the quality values for a
-		read are missing but set them to be the quality_value given.
-	      </para>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
 	    <term><option>-R <replaceable>namestring</replaceable></option></term>
 	    <listitem>
 	      <para>
@@ -288,32 +218,11 @@
 	      </para>
 	      <para>
 		Known bug: will create duplicate names if input (CAF or
-		MAF) contains contigs/singlets as well as free reads, i.e.
+		MAF)contains contigs/singlets as well as free reads, i.e.
 		reads not in contigs nor singlets.
 	      </para>
 	    </listitem>
 	  </varlistentry>
-	  <varlistentry>
-	    <term><option>-S <replaceable class="file">namescheme</replaceable></option></term>
-	    <listitem>
-	      <para>
-		Naming scheme for renaming reads, important for
-		paired-ends. Only 'solexa' is supported at the moment.
-	      </para>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term><option>-Y <replaceable>integer</replaceable></option></term>
-	    <listitem>
-	      <para>
-		Yield. Defines the maximum number of (clipped/padded) bases to
-		convert. When used on reads: output will contain first reads
-		of file where length of clipped bases totals at least -Y.
-		When used on contigs: output will contain first contigs of
-		file where length of padded contigs totals at least -Y.
-	      </para>
-	    </listitem>
-	  </varlistentry>
 	</variablelist>
       </sect3>
 
@@ -322,15 +231,15 @@
 	<para>
 	  The following switches will work only if the input file contains
 	  contigs (i.e., CAF or MAF with contig data). Though infrequent, note
-	  that both CAF and MAF can contain single reads only.
+	  that both CAF and MAf can contain single reads only.
 	</para>
 	<variablelist>
 	  <varlistentry>
 	    <term><option>-M</option></term>
 	    <listitem>
 	      <para>
-		Do not extract contigs (or their consensus), but the reads
-		they are composed of.
+		Do not extract contigs (or their consensus), but the sequence of
+		the reads they are composed of.
 	      </para>
 	    </listitem>
 	  </varlistentry>
@@ -338,17 +247,16 @@
 	    <term><option>-N <replaceable class="file">namefile</replaceable></option></term>
 	    <listitem>
 	      <para>
-		Name select, sorted. Only contigs/reads are selected for
-		output which name appears in
-		<filename>namefile</filename>. Regardless of the order of
-		contigs/reads in the input, the output is sorted according to
-		the appearance of names in
-		<filename>namefile</filename>. <filename>namefile</filename>
-		is a simple text file having one name entry per line.
+		Name select, sorted. Only contigs are selected for output which
+		name appears in <filename>namefile</filename>. Regardless of the
+		order of contigs in the input, the output is sorted according to the
+		appearance of names in
+		<filename>namefile</filename>. <filename>namefile</filename> is
+		a simple text file having one name entry per line.
 	      </para>
 	      <para>
-		Note that for this function to work, all contigs/reads are
-		loaded into memory which may be straining your RAM for larger
+		Note that for this function to work, all contigs are loaded
+		into memory which may be straining your RAM for larger
 		projects.
 	      </para>
 	    </listitem>
@@ -419,7 +327,7 @@
 	    <term><option>-s</option></term>
 	    <listitem>
 	      <para>
-		Split. Split output into single files, one file per
+		Split. Split outpout into single files, one file per
 		contig. Files are named according to name of contig.
 	      </para>
 	    </listitem>
@@ -436,7 +344,7 @@
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
-	    <term><option>-Q <replaceable>quality_value</replaceable></option></term>
+	    <term><option>-q <replaceable>quality_value</replaceable></option></term>
 	    <listitem>
 	      <para>
 		Defines minimum quality a consensus base of a strain
@@ -446,24 +354,16 @@
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
-	    <term><option>-V <replaceable>coverage_value</replaceable></option></term>
+	    <term><option>-v <replaceable>coverage_value</replaceable></option></term>
 	    <listitem>
 	      <para>
-		Defines minimum coverage a consensus base of a strain must
-		have, consensus bases below this coverage will be set to 'N'.
+		Defines minimum coverage a consensus base of a strain must have,
+		consensus bases with a coverage below this will be set to 'N'.
 		Only used when -r is active.
 	      </para>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
-	    <term><option>-v</option></term>
-	    <listitem>
-	      <para>
-		Print version number and exit.
-	      </para>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
 	    <term><option>-x <replaceable>length</replaceable></option></term>
 	    <listitem>
 	      <para>
@@ -474,7 +374,7 @@
 	      </para>
 	      <para>
 		Note: this is of course not applied to reads in contigs! Contigs passing
-		the <arg>-x</arg> length criterion and stored as complete
+		the <arg>-x</arg> length criterium and stored as complete
 		assembly (CAF, MAF, ACE, etc.) still contain all their reads.
 	      </para>
 	    </listitem>
@@ -544,38 +444,13 @@
 	     control the term elements. -->
 	<varlistentry>
 	  <term>
-	    Simple conversion: a MIRA MAF file to a SAM file
-	  </term>
-	  <listitem>
-	    <screen>
-<userinput>miraconvert source.maf destination.sam</userinput></screen>
-            <note>
-	      <para>
-		Previous versions of miraconvert had a slightly different
-		syntax, which however is still supported:
-	      </para>
-	      <screen>
-<userinput>miraconvert source.maf destination.sam</userinput></screen>
-            </note>
-	  </listitem>
-	</varlistentry>
-	<varlistentry>
-	  <term>
 	    Simple conversion: the consensus of an assembly to FASTA, at the
 	    same time coverage data for contigs to WIG and furthermore
 	    translate the CAF to ACE:
 	  </term>
 	  <listitem>
 	    <screen>
-<userinput>miraconvert source.caf destination.fasta wig ace</userinput></screen>
-            <note>
-	      <para>
-		Previous versions of miraconvert had a slightly different
-		syntax, which however is still supported:
-	      </para>
-	      <screen>
-<userinput>miraconvert -f caf -t fasta -t wig -t ace source.caf destination</userinput></screen>
-            </note>
+<userinput>convert_project -f caf -t fasta -t wig -t ace source.caf dest</userinput></screen>
 	  </listitem>
 	</varlistentry>
 	<varlistentry>
@@ -585,25 +460,25 @@
 	  </term>
 	  <listitem>
 	    <screen>
-<userinput>miraconvert -x 2000 -y 10 source.caf destination.caf</userinput></screen>
+<userinput>convert_project -f maf -t caf -x 2000 -y 10 source.caf dest</userinput></screen>
 	  </listitem>
 	</varlistentry>
 	<varlistentry>
 	  <term>
-	    Filtering a FASTQ file for reads ≥ 55 base pairs, rename the
+	    Filtering a FASTQ file for reads ≥ 55 basepairs, rename the
 	    selected reads with a string starting <quote>newname</quote> and
 	    save them back to FASTQ. Note how <arg>-t fastq</arg> was left out
-	    as the default behaviour of <command>miraconvert</command> is
+	    as the default behaviour of <command>convert_project</command> is
 	    to use the same "to" type as the input type (<arg>-f</arg>).
 	  </term>
 	  <listitem>
 	    <screen>
-<userinput>miraconvert -x 55 -R newname source.fastq destination.fastq</userinput></screen>
+<userinput>convert_project -f fastq -x 55 -R newname source.fastq dest</userinput></screen>
 	  </listitem>
 	</varlistentry>
 	<varlistentry>
 	  <term>
-	    Filtering and reordering contigs of an assembly according to external contig name list.
+	    Filtering and sortig contigs of an assembly according to external contig name list.
 	  </term>
 	  <listitem>
 	    <para>
@@ -620,7 +495,7 @@ bchoc_c14
 bchoc_c3
 bchoc_c5
 bchoc_c13
-<prompt>arcadia:/path/to/myProject$</prompt> <userinput>miraconvert -N contigs.lst bchoc_out.caf myfilteredresult.caf</userinput>
+<prompt>arcadia:/path/to/myProject$</prompt> <userinput>convert_project -f caf -N contigs.lst bchoc_out.caf myfilteredresult</userinput>
 [...]
 <prompt>arcadia:/path/to/myProject$</prompt> <userinput>ls -l</userinput>
 -rw-r--r-- 1 bach users  231698898 2007-10-21 15:16 bchoc_out.caf
@@ -631,8 +506,10 @@ bchoc_c13
       </variablelist>
     </sect2>
   </sect1>
+
+
   <sect1 id="sect_mutils_bait">
-    <title>mirabait - a "grep" for kmers</title>
+    <title>mirabait</title>
     <sect2 id="sect_mutils_bait_synopsis">
       <title>
 	Synopsis
@@ -640,13 +517,14 @@ bchoc_c13
       <cmdsynopsis>
 	<command>mirabait</command>
 	<arg>options</arg>
-	<arg choice="req">-b <replaceable>baitfile</replaceable><arg>-b ...</arg> | -L <replaceable>file</replaceable></arg>
-	<arg>-p <replaceable>file1 file2</replaceable> | -P <replaceable>file3</replaceable></arg>*
-	<arg choice="opt"><replaceable>file4 ...</replaceable></arg>
+	<arg choice="req"><replaceable>bait_file</replaceable></arg>
+	<arg choice="req"><replaceable>input_file</replaceable></arg>
+	<arg choice="req"><replaceable>output_basename</replaceable></arg>
       </cmdsynopsis>
-      <note>
-	The above command line format appeared only in MIRA 4.9.0!
-      </note>
+      <para>
+	While input and output file can have any of the supported formats (see
+	-f and -t options), the bait file needs to be in FASTA format.
+      </para>
     </sect2>
     <sect2 id="sect_mutils_bait_description">
       <title>Description</title>
@@ -659,340 +537,101 @@ bchoc_c13
 	or reverse complement direction.
       </para>
       <para>
-	When used on paired files (-p or -P), selects read pairs where at least
-	one read matches.
-      </para>
-      <para>
-	One can use <command>mirabait</command> to do targeted assembly by
-	fishing out reads belonging to a gene and just assemble these; or to
-	clean out rRNA sequences from data sets; or to fish out and
-	iteratively reconstruct mitochondria from metagenomic data; or, or, or
-	... whenever one has to take in or take out subsets of reads, this
-	tool should come in quite handy.
-      </para>
-      <note>
 	The search performed is exact, that is, sequences selected are
-	guaranteed to have the required number of matching k-mers to the bait
+	guaranteed to have the required number of k-mers equal to the bait
 	sequences while sequences not selected are guaranteed not have these.
-      </note>
+      </para>
     </sect2>
+
     <sect2 id="sect_mutils_bait_options">
       <title>Options</title>
-      <sect3 id="sect_mutils_bait_mainoptions">
-	<title>Main options</title>
-	<variablelist>
-	  <!-- Use the variablelist.term.separator and the
-	       variablelist.term.break.after parameters to
-	       control the term elements. -->
-	  <varlistentry>
-	    <term><option>-b <replaceable>file</replaceable></option></term>
-	    <listitem>
-	      <para>
-		A file containing sequences to be used as bait. The file can
-		be in any of the following types: FASTQ, FASTA, GenBank (.gbf,
-		.gbk, .gbff), CAF, MAF or Staden EXP. Should the file
-		extension not be any of the previously recognised types,
-		mirabait will try to load a bait file as FASTA file, use -F to
-		override this.
-	      </para>
-	      <para>
-		Using multiple -b for loading bait sequences from multiple
-		files is allowed.
-	      </para>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term><option>-p <replaceable>file_1 file_2</replaceable></option></term>
-	    <listitem>
-	      <para>
-		Instructs to load sequences to be baited from files
-		<filename>file_1</filename> and
-		<filename>file_2</filename>. The sequences are treated as
-		pairs, where a read in one file is paired with a read in the
-		second file. The files can be in any of the following types:
-		FASTQ, FASTA, GenBank (.gbf, .gbk, .gbff), CAF, MAF or Staden
-		EXP. Should the file extension not be any of the previously
-		recognised types, mirabait will try to load files as FASTQ
-		files, use -f to override this.
-	      </para>
-	      <para>
-		Using multiple -p for baiting sequences from multiple files is
-		allowed.
-	      </para>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term><option>-P <replaceable>file</replaceable></option></term>
-	    <listitem>
-	      <para>
-		Instructs to load sequences to be baited from file
-		<filename>file</filename>. The sequences are treated as pairs,
-		where a read in the file is immediately followed by its paired
-		read. The file can be in any of the following types: FASTQ,
-		FASTA, GenBank (.gbf, .gbk, .gbff), CAF, MAF or Staden
-		EXP. Should the file extension not be any of the previously
-		recognised types, mirabait will try to load it as FASTQ file,
-		use -f to override this.
-	      </para>
-	      <para>
-		Using multiple -P for baiting sequences from multiple files is
-		allowed.
-	      </para>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term><option>-L</option></term>
-	    <listitem>
-	      <para>
-		Do not load bait sequences from a file with sequences, but
-		instead treat the baitfilename as file name of a valid
-		<command>mirabait</command> hash statistics file and load it
-		from disk.
-	      </para>
-	      <para>
-		This feature enables one to reuse baits from earlier runs
-		without having to wait for the recomputation of hash
-		statistics.
-	      </para>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term><option>-k <replaceable>kmer-length</replaceable></option></term>
-	    <listitem>
-	      <para>
-		k-mer, length of bait in bases (≤256, default=31)
-	      </para>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term><option>-n <replaceable>integer</replaceable></option></term>
-	    <listitem>
-	      <para>
-		Default value: 1.
-	      </para>
-	      <para>
-		If the integer given is > 0: minimum number of kmers needed
-		for a sequence to be selected.
-	      </para>
-	      <para>
-		If the integer given is ≤ 0: maximum number of missed kmers
-		allowed over sequence length for a sequence to be selected.
-	      </para>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term><option>-i</option></term>
-	    <listitem>
-	      <para>
-		Inverse selection: selects only sequence that do not meet the
-		-k and -n criteria.
-	      </para>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term><option>-I</option></term>
-	    <listitem>
-	      <para>
-		Filters and writes sequences which hit to one file and
-		sequences which do not hit to a second file.
-	      </para>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term><option>-r</option></term>
-	    <listitem>
-	      <para>
-		Does not check for hits in reverse complement direction.
-	      </para>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term><option>-c</option></term>
-	    <listitem>
-	      <para>
-		Normally, mirabait will change the case of the sequences it
-		loads to denote kmers which hit a bait in upper case and kmers
-		which did not hit a bait in lower case. Using -c switches off
-		this behaviour.
-	      </para>
-	    </listitem>
-	  </varlistentry>
-	</variablelist>
-      </sect3>
-      <sect3 id="sect_mutils_bait_filetypeoptions">
-	<title>File type options</title>
-	<para>
-	  Normally, mirabait recognises the file types according to the file
-	  extension. In cases you need to force a certain file type because
-	  the file extension is non-standard, use the following options:
-	</para>
-	<variablelist>
-	  <!-- Use the variablelist.term.separator and the
-	       variablelist.term.break.after parameters to
-	       control the term elements. -->
-	  <varlistentry>
-	    <term>
-	      <option>-f
-	      <replaceable class="parameter">
-		<group choice="req">
-		  <arg choice="plain"><option>caf</option></arg>
-		  <arg choice="plain"><option>maf</option></arg>
-		  <arg choice="plain"><option>fasta</option></arg>
-		  <arg choice="plain"><option>fastq</option></arg>
-		  <arg choice="plain"><option>gbf</option></arg>
-		  <arg choice="plain"><option>phd</option></arg>
-		</group>
-	      </replaceable>
-	      </option>
-	    </term>
-	    <listitem>
-	      <para>
-		<quote>From-type</quote>, the format of the input
-		file. Default: fastq.
-	      </para>
-	      <para>
-		Normally, mirabait will determine the format of an input file
-		by looking at the postfix of the file name. The -f option can
-		be used to override this mechanism or to load data from files
-		where no filename postfix is available.
-	      </para>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term>
-	      <option>-F
-	      <replaceable class="parameter">
-		<group choice="req">
-		  <arg choice="plain"><option>caf</option></arg>
-		  <arg choice="plain"><option>maf</option></arg>
-		  <arg choice="plain"><option>fasta</option></arg>
-		  <arg choice="plain"><option>fastq</option></arg>
-		  <arg choice="plain"><option>gbf</option></arg>
-		  <arg choice="plain"><option>phd</option></arg>
-		</group>
-	      </replaceable>
-	      </option>
-	    </term>
-	    <listitem>
-	      <para>
-		Like -f, but for the bait sequences.
-	      </para>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term>
-	      <option>-t
-	      <replaceable class="parameter">
-		<group choice="req">
-		  <arg choice="plain"><option>caf</option></arg>
-		  <arg choice="plain"><option>maf</option></arg>
-		  <arg choice="plain"><option>fasta</option></arg>
-		  <arg choice="plain"><option>fastq</option></arg>
-		  <arg choice="plain"><option>txt</option></arg>
-		</group>
-	      </replaceable>
-	      </option>
-	    </term>
-	    <listitem>
-	      <para>
-		<quote>To-type</quote>, the format of the output
-		file. Default: format of the input.
-	      </para>
-	      <para>
-		Normally, mirabait will an output file in the format defined
-		by the input file(s). The -t option can be used to change the
-		output to a desired format.
-	      </para>
-	    </listitem>
-	  </varlistentry>
-	</variablelist>
-      </sect3>
-      <sect3 id="sect_mutils_bait_outputdef">
-	<title>Output definition</title>
-	<para>
-	  Normally, mirabait writes separate result files (named
-	  <filename>bait_match_*</filename> and
-	  <filename>bait_miss_*</filename>) for each input to the current
-	  directory. For changing this behaviour, use these options:
-	</para>
-	<variablelist>
-	  <!-- Use the variablelist.term.separator and the
-	       variablelist.term.break.after parameters to
-	       control the term elements. -->
-	  <varlistentry>
-	    <term><option>-N <replaceable>name</replaceable></option></term>
-	    <listitem>
-	      <para>
-		Change the file prefix <filename>bait</filename> to
-		<filename>name</filename>. Has no effect if -o/-O is used and
-		targets are not directories.
-	      </para>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term><option>-o <replaceable>path</replaceable></option></term>
-	    <listitem>
-	      <para>
-		Save sequences matching a bait to
-		<filename>path</filename>. If <filename>path</filename> is a
-		directory, write separate files into this directory. If not,
-		combine all matching sequences from the input file(s) into a
-		single file specified by the path.
-	      </para>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term><option>-O <replaceable>path</replaceable></option></term>
-	    <listitem>
-	      <para>
-		Like -o, but for sequences not matching.
-	      </para>
-	    </listitem>
-	  </varlistentry>
-	</variablelist>
-      </sect3>
-    </sect2>
-    <sect2 id="sect_mutils_bait_examples">
-      <title>Usage examples</title>
-      <note>
-	The examples below, together with the manual above, should be enough to get
-	you going. If there's a typical use case you are missing, feel free to
-	suggest it on the MIRA talk mailing list.
-      </note>
-      <para>Baiting unpaired sequences, bait sequences in FASTA, sequences in FASTQ:</para>
-      <screen><userinput>mirabait -b b.fasta file.fastq</userinput></screen>
-      <para>Same as above, but baits in two files (FASTA and GenBank):</para>
-      <screen><userinput>mirabait -b b1.fasta -b b2.gbk file.fastq</userinput></screen>
-      <para>Baiting paired sequences, read pairs are in two files:</para>
-      <screen><userinput>mirabait -b b.fasta -p file_1.fastq file_2.fastq</userinput></screen>
-      <para>Baiting paired sequences, pairs are interleaved in one file:</para>
-      <screen><userinput>mirabait -b b.fasta -P file.fastq</userinput></screen>
-      <para>Like above, but selecting sequences which do not match the baits:</para>
-      <screen><userinput>mirabait -i -b b.fasta -P file.fastq</userinput></screen>
-      <para>Baiting paired sequences (<filename>file_1.fastq</filename>, <filename>file_2.fastq</filename> and <filename>file3.fastq</filename>) and unpaired sequences (<filename>file4.fastq</filename>), all at once and different file types:</para>
-      <screen><userinput>mirabait -b b.fasta -p file_1.fastq file_2.fastq -P file3.fasta file4.caf</userinput></screen>
-      <para>Like above, but writing sequences matching baits and sequences not matching baits to different files:</para>
-      <screen><userinput>mirabait -I -b b.fasta -p file_1.fastq file_2.fastq -P file3.fasta file4.caf</userinput></screen>
-      <para>Change bait criterion to need 10 kmers of size 27:</para>
-      <screen><userinput>mirabait -k 27 -n 10 -b b.fasta file.fastq</userinput></screen>
-      <para>
-	Change bait criterion to baiting only reads which have all kmers
-	present in the bait:
-      </para>
-      <screen><userinput>mirabait -n 0 -b b.fasta file.fastq</userinput></screen>
-      <para>
-	Change bait criterion to baiting all reads having almost all kmers present in the
-	bait, but allowing for up to 40 kmers not in the bait:
-      </para>
-      <screen><userinput>mirabait -n -40 -b b.fasta file.fastq</userinput></screen>
-      <para>Force bait sequences to load as FASTA, force sequences to be baited to be loaded as FASTQ:</para>
-      <screen><userinput>mirabait -F fasta -f fastq -b b.dat file.dat</userinput></screen>
-      <para>Write result files to directory <filename>/dev/shm/</filename>:</para>
-      <screen><userinput>mirabait -o /dev/shm/ -b b.fasta -p file_1.fastq file_2.fastq</userinput></screen>
-      <para>Merge all result files containing sequences hitting baits to file <filename>/dev/shm/match</filename>:</para>
-      <screen><userinput>mirabait -o /dev/shm/match -b b.fasta -p file_1.fastq file_2.fastq</userinput></screen>
-      <para>Like above, but also merge all result files containing sequences not hitting baits to file <filename>/dev/shm/nomatch</filename>:</para>
-      <screen><userinput>mirabait -o /dev/shm/match -O /dev/shm/nomatch -b b.fasta -p file_1.fastq file_2.fastq</userinput></screen>
+      <variablelist>
+	<!-- Use the variablelist.term.separator and the
+	     variablelist.term.break.after parameters to
+	     control the term elements. -->
+	<varlistentry>
+	  <term>
+	    <option>-f
+	    <replaceable class="parameter">
+	      <group choice="req">
+		<arg choice="plain"><option>caf</option></arg>
+		<arg choice="plain"><option>maf</option></arg>
+		<arg choice="plain"><option>fasta</option></arg>
+		<arg choice="plain"><option>fastq</option></arg>
+		<arg choice="plain"><option>gbf</option></arg>
+		<arg choice="plain"><option>phd</option></arg>
+	      </group>
+	    </replaceable>
+	    </option>
+	  </term>
+	  <listitem>
+	    <para>
+	      <quote>From-type</quote>, the format of the input
+	      file. Default: fastq.
+	    </para>
+	  </listitem>
+	</varlistentry>
+	<varlistentry>
+	  <term>
+	    <option>-t
+	    <replaceable class="parameter">
+	      <group choice="req">
+		<arg choice="plain"><option>caf</option></arg>
+		<arg choice="plain"><option>maf</option></arg>
+		<arg choice="plain"><option>fasta</option></arg>
+		<arg choice="plain"><option>fastq</option></arg>
+	      </group>
+	    </replaceable>
+	    </option>
+	  </term>
+	  <listitem>
+	    <para>
+	      <quote>To-type</quote>, the format of the output
+	      file. Default: format of the input.
+	    </para>
+	    <para>
+	      Multiple mentions of -t are allowed, in which case the
+	      selected sequences are written to all file formats chosen.
+	    </para>
+	  </listitem>
+	</varlistentry>
+
+
+	<varlistentry>
+	  <term><option>-k <replaceable>k-mer-length</replaceable></option></term>
+	  <listitem>
+	    <para>
+	      k-mer, length of bait in bases (≤32, default=31)
+	    </para>
+	  </listitem>
+	</varlistentry>
+	<varlistentry>
+	  <term><option>-n <replaceable>minoccurence</replaceable></option></term>
+	  <listitem>
+	    <para>
+	      Minimum number of k-mers needed for a sequence to be selected. Default: 1.
+	    </para>
+	  </listitem>
+	</varlistentry>
+	<varlistentry>
+	  <term><option>-i</option></term>
+	  <listitem>
+	    <para>
+	      Inverse hit: selects only sequence that do not meet the -k and -n criteria.
+	    </para>
+	  </listitem>
+	</varlistentry>
+	<varlistentry>
+	  <term><option>-r</option></term>
+	  <listitem>
+	    <para>
+	      Does not check for hits in reverse complement direction.
+	    </para>
+	  </listitem>
+	</varlistentry>
+      </variablelist>
     </sect2>
   </sect1>
-</chapter>
+
+
+</chapter>
\ No newline at end of file
diff --git a/doc/docbook/chap_pacbio_part.xml b/doc/docbook/chap_pacbio_part.xml
new file mode 100644
index 0000000..84e51cb
--- /dev/null
+++ b/doc/docbook/chap_pacbio_part.xml
@@ -0,0 +1,1786 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+"http://www.docbook.org/xml/4.5/docbookx.dtd">
+<chapter id="chap_pacbio">
+  <chapterinfo>
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="versionfile"/>
+    <releaseinfo>
+      <emphasis role="light">Document revision	$Id$</emphasis>
+    </releaseinfo>
+    <author>
+      <firstname>Bastien</firstname>
+      <surname>Chevreux</surname>
+      <email>bach at chevreux.org</email>
+    </author>
+    <copyright><year>2011</year><holder>Bastien Chevreux</holder></copyright>
+  </chapterinfo>
+  <blockquote>
+    <attribution>Solomon Short</attribution>
+    <para>
+      <emphasis><quote>New problems demand new solutions. New solutions create new problems.
+      </quote></emphasis>
+    </para>
+  </blockquote>
+  <title>
+    Assembling sequences from Pacific Biosciences with MIRA3
+  </title>
+  <sect1 id="sect_pb_only_ccs_for_now">
+    <title>MIRA 3.4.0: currently only CCS or error-corrected-CLR supported</title>
+    <para>
+      This is here to set the stage: at the moment, MIRA can only make use of
+      PacBio reads which have an error rate of roundabout 5%. This means you
+      will have to use either:
+    </para>
+    <orderedlist>
+      <listitem>
+	<para>
+	  CCS (Circular Consensus Sequence) reads with at least 3 to 4 passes.
+	</para>
+      </listitem>
+      <listitem>
+	<para>
+	  CLR (Continuous Long Reads) which were error corrected either with
+	  PacBio CCS reads or some other high-quality sequencing technology
+	  (Illumina comes to mind)
+	</para>
+      </listitem>
+    </orderedlist>
+    <para>
+      Impatients can directly jump to <xref linkend="sect_pb_walkthrough_realdata"/> which
+      contains walkthroughs using data made publicly available by PacBio.
+    </para>
+  </sect1>
+  <sect1 id="sect_pb_warninto">
+    <title>WARNING</title>
+    <para>
+      When I developed the routines for PacBio, I had no access to their data
+      and it shows. Now that first numbers regarding their reads get published
+      and the first data sets available publicly, I realise a couple of
+      preconditions were not met. Especially the fact that raw PacBio CLR reads
+      seem to have an error rate between 1-in-5 (80% correct) and 1-in-7 (85%
+      correct) means that MIRA will probably not operate very well with
+      those. One should have something between 1-in-12 to 1-in-20 as error
+      rate (92% to 95% correct) to get MIRA working happily.
+    </para>
+    <para>
+      During the course of 2011, PacBio has made available on their <ulink
+      url="http://www.pacbiodevnet.com/">DevNet</ulink> site quite a number
+      of documents and introductory videos. A must read for everyone
+      interested in this sequencing technology.
+    </para>
+    <note>
+      As of MIRA 3.4.0, large parts of this documentation are still from a
+      time where things like terminology, sequencing specifics etc.pp were not
+      available publicly. It'll take same time for me to convert the guide.
+    </note>
+  </sect1>
+
+  <sect1 id="sect_pb_introduction">
+    <title>Introduction</title>
+
+    <para>Pacific Biosciences looks like the new kid on the block of
+    sequencing technologies. They seem to have, for the first time since
+    Sanger sequencing, something which is able to produce sequences which are
+    actually longer than Sanger. They also have something new:
+    <emphasis>strobed sequencing</emphasis>. That technique alone was reason
+    enough for me to see whether it could be of any use. After a couple of
+    modifications to the MIRA assembly engine, I think I can say that "yes, it
+    very well can be."</para>
+
+    <para>One could feed strobed PacBio sequences to MIRA 3.0.0 and the 2.9.x
+    line before and get some results out of it by faking them to be Sanger,
+    though the results were not always pretty.</para>
+
+    <para>The first version of MIRA to officially support sequences from
+    Pacific Biosciences is MIRA 3.2. Versions in the 3.0.1 to 3.0.5 range and
+    3.1.x had different degrees of support, but were never advertised having
+    it.</para>
+
+    <sect2 id="sect_pb_disclaimer">
+      <title>Disclaimer</title>
+
+      <para>I am not affiliated with Pacific Biosciences nor do I --
+      unfortunately -- have early access to their data. Due to extreme secrecy,
+      almost no one outside the company has actually seen their sequencing
+      data. So some of what this guide contains is a bit of guesswork,
+      reading through dozens and dozens of conference reports, blogs, press
+      releases, tweets and whatever not.</para>
+
+      <para>But maybe I got some things right.</para>
+    </sect2>
+
+    <sect2 id="sect_pb_some_reading_requirements">
+      <title>Some reading requirements</title>
+
+      <para>This guide assumes that you have basic working knowledge of Unix
+      systems, know the basic principles of sequencing (and sequence assembly)
+      and what assemblers do.</para>
+
+      <para>While there are step by step walk-throughs on how to setup your
+      data for Sanger, 454 and Solexa in other MIRA guides, this guide is
+      (currently) a bit more terse. You are expected to read at some point in
+      time</para>
+
+      <itemizedlist>
+        <listitem>
+          <para>the <emphasis>mira_reference</emphasis> help file to look up
+          some command line options.</para>
+        </listitem>
+        <listitem>
+          <para> for hybrid assemblies of PacBio data with Sanger, 454, Solexa
+          the corresponding <emphasis>mira_usage</emphasis>,
+          <emphasis>mira_454</emphasis> or <emphasis>mira_solexa</emphasis>
+          help files to look up how to prepare the different data sets.</para>
+        </listitem>
+      </itemizedlist>
+    </sect2>
+
+    <sect2 id="sect_pb_terminology">
+      <title>Terminology</title>
+    </sect2>
+
+    <sect2 id="sect_pb_strobed_sequencing">
+      <title>What is strobed sequencing?</title>
+
+      <para>Let's first have a look at what sequencing (either paired or
+      unpaired) meant until now. I won't go into the details of conventional
+      sequencing as this is covered elsewhere in the MIRA manuals (and in the
+      Web).</para>
+
+      <sect3 id="sect_pb_normal_sequencing">
+        <title>Conventional way of sequencing a DNA template with Sanger, 454,
+        Solexa, ...</title>
+
+        <para>In conventional, unpaired sequencing, you have a piece of DNA (a
+        DNA <emphasis>template</emphasis>) which a machine reads out and then
+        gives you the sequence back. Assume your piece of DNA to be 10
+        kilo-bases long, but your machine can read only 1000 bases. Then what
+        you get back (<literal>DNA</literal> below is the DNA template,
+        <literal>R1</literal> is a read) is this:</para>
+
+        <screen>
+DNA: actgttg...gtgcatgctgatgactgact.........gactgtgacgtactgcttga...actggatctg
+
+R1 : actgttg...gtgcatgct
+     \_________________/
+              |
+         ~1000 bases</screen>
+
+        <para>In conventional paired-end sequencing, you still can read only
+        1000 bases, but you can do it at the beginning and at the end of a DNA
+        template. This looks like that:</para>
+
+        <screen>
+DNA: actgttg...gtgcatgctgatgactgact.........gactgtgacgtactgcttga...actggatctg
+
+R1 : actgttg...gtgcatgct
+     \_________________/                             R2 : gcttga...actggatctg
+              |                                           \_________________/
+         ~1000 bases                                               |
+                                                              ~1000 bases</screen>
+
+        <para>While you still have just two reads of approximately 1000 bases,
+        you know one additional thing: these two reads are approximately 10000
+        bases apart. This additional information is very useful in assembly as
+        it helps to resolve problematic areas.</para>
+      </sect3>
+
+      <sect3 id="sect_pb_bp_sequencing">
+        <title>Sequencing a DNA template with Pacific Biosciences</title>
+
+        <para>Enter Pacific Biosciences with their strobed sequencing. With
+        this approach, you can sequence also a given number of bases (they
+        claim between 1000 and 3000), but you can sort of "distribute" the
+        bases you want to read across the DNA template.</para>
+
+        <warning>
+           Overly simplified and probably totally inaccurate description
+           ahead! Furthermore, the extremely short read and gap lengths in
+           these examples serve only for demonstration purposes.
+        </warning>
+
+        <para>Here's a simple example: assume you could read around 40 bases
+        with your machinery, but that the DNA template is some ~80 bases. And
+        assume you could tell your machine to read between 6 and 8 bases at a
+        time, then leave out the next 6 to 8 bases, then read again etc. Like
+        so:</para>
+
+        <screen>
+DNA: actgttggtgcatgctgatgactgactgactgtgacgtacttgactgactggatctgtgactgactgtgactgactg
+
+R1a: actgttg
+R1b:                 gatgactgac
+R1c:                                    cgtacttga
+R1d:                                                     atctgtgac
+R1e:                                                                     gactgactg</screen>
+
+        <para>While in the example above we still read only 44 bases, these 44
+        bases span 77 bases on the DNA template. Furthermore, we have the
+        additional information that the sequence of reads is R1a, R1b, R1c,
+        R1d and R1e and, because we asked the machine to read in such a
+        pattern, we expect the gaps between the reads to be between 6 and 8
+        bases wide.</para>
+
+        <para>This is actually possible with the system of PacBio. It streams
+        the DNA template through a detection system which reads out the bases
+        only, and only if, a light source (a laser) is switched on. Therefore,
+        while streaming the template through the system, you read the DNA
+        while the laser is on and you don't read anything while it's off ...
+        meanwhile the template is still streamed through.</para>
+
+        <para>Now, why would one want to turn the laser off?</para>
+
+        <para>It seems as if the light source is actually also the major
+        limitation factor, as it has as nasty side-effect the degradation of
+        DNA it should still read. A real bummer: after 1000 to 3000 bases
+        (sometimes more, sometimes less), the DNA you read is probably so
+        degraded and error ridden (eventually even physically broken) that it
+        makes no sense to continue reading.</para>
+
+        <para>Here comes the trick: instead of reading, say, 1000 bases in a
+        row, you can read them in <emphasis>strobes</emphasis>: you switch the
+        light on and start reading a couple of bases (say: 100), switch the
+        light off, wait a bit until some bases (again, let's say approximately
+        100) have passed by, switch the light back on and read again ~100
+        bases, then switch off ... etc.pp until you have read your 1000 bases,
+        or, more likely, as long as you can. But, as shown in the example
+        above, these 1000 bases will be distributed across a much larger span
+        on the original DNA template: in a pattern of ~100 bases read and ~100
+        bases not read, the smaller read-fragments span ~1800 to ~2000
+        bases.</para>
+
+        <para>Cool ... this is actually something an assembler can make real
+        use of.</para>
+
+        <para>A more conventional approach could be: you switch the light on
+        and start reading a couple of bases (say: 500), switch the light off,
+        wait a bit until some bases (again, let's say approximately 10000)
+        have passed by, switch the light back on and read again ~500 bases.
+        This would be equivalent to a "normal" paired-end read with an insert
+        size of 11Kb. But assemblers also can make good use of that.</para>
+      </sect3>
+    </sect2>
+
+    <sect2 id="sect_pb_highlights_lowlights">
+      <title>Probable highlights and lowlights of PacBio sequencing
+      data</title>
+
+      <sect3 id="sect_pb_lowlights">
+        <title>Lowlights</title>
+
+        <para></para>
+
+        <sect4 id="sect_pb_indelproblems">
+          <title>Indel problems</title>
+
+          <para>Although Pacific Biosciences keeps pretty quiet on this topic,
+          missed bases seem to be quite a problematic point. A bit like the
+          454 homopolymer problem but without homopolymers. From <ulink
+          url="http://scienceblogs.com/geneticfuture/2010/02/pacific_biosciences_session_at.php"></ulink></para>
+
+          <blockquote>
+            <quote>Turner [the presenter from PacBio] said nothing concrete
+            about error rates during his presentation, but this issue
+            dominated the questions from the audience. Turner skilfully
+            equivocated, steering clear of providing any hard numbers on the
+            raw error rates and focusing on the system's ability to generate
+            accurate consensus sequences through circular reads. Still, it's
+            clear that deletion errors due to missing bases will pose a
+            non-trivial problem for the system: Turner referred to algorithms
+            for assembling sequence dominated by insertion/deletion errors
+            currently in development.</quote>
+          </blockquote>
+
+          <para>Someone else made a nice comment on this (from <ulink
+          url="http://omicsomics.blogspot.com/2010/02/pacbios-big-splash.html"></ulink>):</para>
+
+          <blockquote>
+            <quote>Well, not much on error rates from PacBio (apparently in
+            the Q&A their presenter executed a jig, tango, waltz &
+            rumba when asked).</quote>
+          </blockquote>
+        </sect4>
+
+        <sect4 id="sect_pb_darkstrobelength">
+          <title>Variation in "dark insert" lengths</title>
+
+          <para>Astute readers will have noted that in the section on
+          sequencing a DNA template with PacBio, I wrote
+          <quote>approximately</quote> when defining the length of the stretch
+          of non-read bases in strobed sequencing. According to conference
+          reports, the length can only be estimated with a variance of 10-20%.
+          From <ulink
+          url="http://www.genomeweb.com/sequencing/pacbio-says-strobe-sequencing-increases-effective-read-length-single-molecule-se"></ulink>:</para>
+
+          <blockquote>
+            <quote>There is uncertainty regarding the size of the "dark"
+            inserts, owing to "subtle fluctuations" in the DNA synthesis
+            speed, he said, but it becomes smaller with longer inserts. For
+            example, with 400-base inserts, the coefficient of variation of
+            its size is 20 percent, but it decreases to 10 percent with 1,600
+            bases.</quote>
+          </blockquote>
+        </sect4>
+      </sect3>
+
+      <sect3 id="sect_pb_highlights">
+        <title>Highlights</title>
+
+        <para></para>
+
+        <sect4 id="sect_pb_readlengths">
+          <title>Read lengths</title>
+
+          <para>The reports are a bit contradictory regarding achievable read
+          lengths. While PacBio mentions they have attained read length of up
+          to 20Kb in their labs and expect to be able to go to up to 50Kb, the
+          first generation machines are marketed with much lower expectations.
+          However, "much lower" in this context still means: at least 1 Kb and
+          very good chances to have a good percentage of reads in the 3 to 5
+          Kb range.</para>
+        </sect4>
+
+        <sect4 id="sect_pb_highlightstrobe">
+          <title>Strobed sequencing</title>
+
+          <para>The strobed sequencing method should allow to do a couple of
+          interesting things. First of, simulate conventional paired-end
+          sequencing. Then, going into real strobe sequencing, extending the
+          length reads span over a DNA template by perhaps doubling or
+          tripling the length will be extremely useful to cross most but the
+          most annoying repeats one would encounter in prokaryotes ... and
+          probably also eukaryotes once PacBio regularly achieves lengths of
+          10000 bases.</para>
+        </sect4>
+      </sect3>
+    </sect2>
+  </sect1>
+  <sect1 id="sect_pb_howmirahandlesstrobes">
+    <title>How MIRA handles strobes with "elastic dark inserts"</title>
+    <para>MIRA currently knows two ways to handle strobed reads: 
+    </para>
+    <orderedlist>
+      <listitem>
+	<para>
+	  a more traditional approach by using two strobes at a time as read pair
+	</para>
+      </listitem>
+      <listitem>
+	<para>
+	  the "elastic dark insert" approach where all strobes are put in one
+	  read and connected by stretches of <literal>N</literal> representing
+	  the dark inserts. "Elastic" means that -- the initial lengths of the
+	  dark inserts being a rough estimate -- the length of the inserts are
+	  then corrected in the iterative assembly passes of MIRA.
+	</para>
+      </listitem>
+    </orderedlist>
+    <para>
+      The elastic dark insert approach has an invaluable advantage: it keeps
+      the small strobes connected in order in a read. This considerably
+      reduces sources of errors when highly repetitive data is to be
+      assembled where paired-end approaches also have limits.
+    </para>
+    <para>
+      Keeping the dark inserts as integral part of the reads however also
+      poses a couple of problems. Traditional Smith-Waterman alignments are
+      likely to give some of these alignments a bad score as there will
+      invariably be a number of overlaps where the true length of the dark
+      stretch is so different from the real length that an alignment algorithm
+      needs to counterbalance this with a considerable number of inserted
+      gaps. Which in turn can lower Smith-Waterman score to a level where
+      needed identity thresholds are not met. The following example shows an
+      excerpt of a case where a read with dark insert which length was
+      estimated too low aligning against a read without dark insert:
+    </para>
+    <screen>
+...TGACTGA****************nnnnnnnnnnnnnnnnnnnnnTCAGTTGAT...
+...TGACTGATGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...</screen>
+    <para>
+      While MIRA algorithms have methods to counterbalance this kind of
+      scoring malus (e.g., by simply not counting gap scores in dark strobe
+      inserts), another effect then appears: multiple alignment
+      disorders. Like in many other assemblers the construction of multiple
+      alignments is done iteratively by aggregating new reads to an existing
+      contig by aligning it against a temporary consensus. As the
+      misestimation of dark insert lengths can reach comparatively high
+      numbers like 20 to 100 bases or more, problems can arise if several
+      misestimated dark inserts in reads come together at one place. A simple
+      example: assume the following scenario, where reads 1, 2, 3 and 4 get to
+      form a contig by being assembled in exactly this order (1,2,3,4):
+    </para>
+    <screen>
+Read1  ...TGACTGAnnnnnnnnnnnnnnnnnnnnnTCAGTTGAT...</screen>
+     <para>then</para>
+    <screen>
+Read1  ...TGACTGA****************nnnnnnnnnnnnnnnnnnnnnTCAGTTGAT...
+Read2  ...TGACTGATGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...</screen>
+    <para>then</para>
+    <screen>
+Read1  ...TGACTGA****************nnnnnnnnnnnnnnnnnnnnnTCAGTTGAT...
+Read2  ...TGACTGATGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...
+Read3  ...TGACTGATGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...</screen>
+    <para>then</para>
+    <screen>
+Read1  ...TGACT*****GA****************nnnnnnnnnnnnnnnnnnnnnTCAGTTGAT...
+Read2  ...TGACT*****GATGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...
+Read3  ...TGACT*****GATGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...
+Read4  ...TGACTnnnnnnnnnnnnnnnnnnnnnnnnnnnnnATGCGTCGAGCTTGGTCAGTTGAT...</screen>
+    <sidebar><title>Why multiple alignments sometimes look funny</title>
+    <para>
+      You will note that the above alignment does not seem optimal as the
+      following would certainly look better:
+    </para>
+    <screen>
+Read1  ...TGACTGA*********************nnnnnnnnnnnnnnnnnnnnnTCAGTTGAT...
+Read2  ...TGACTGA*****TGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...
+Read3  ...TGACTGA*****TGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...
+Read4  ...TGACTnnnnnnnnnnnnnnnnnnnnnnnnnnnnnATGCGTCGAGCTTGGTCAGTTGAT...</screen>
+    <para>
+      However, remember that assembler add reads sequentially to a contig
+      without prior knowledge of the complete multiple alignment. This leads
+      to the necessity of using temporary consensus sequences as target for a
+      new read to align.
+    </para>
+    <para> 
+      MIRA knows a lot of tricks to mitigate the detrimental effects of
+      iteratively building multiple alignments, one of which is to use an
+      extended genetic code with weights hinting at potential gaps. This
+      however does not always suffice to resolve every problem.
+    </para>
+    <para>
+      Here's what happens step by step in for this example. First, read 1
+      forms the contig, then read 2 is aligned and both form a new contig with
+      a new temporary consensus (named TCONS2 below) like this:
+    </para>
+    <screen>
+Read1  ...TGACTGA****************nnnnnnnnnnnnnnnnnnnnnTCAGTTGAT...
+Read2  ...TGACTGATGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...
+
+TCONS2 ...TGACTGATGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...</screen>
+    <para>
+      Read 3 is then added and as it is equal to read 3 (at least in this part
+      of the sequence), things go smoothly as the alignment of TCONS2 and read
+      3 is without difference and the alignment of
+    </para>
+    <screen>
+TCONS2 ...TGACTGATGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...
+Read3  ...TGACTGATGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...</screen>
+    <para>
+      leads to the multiple alignment of the three reads like this:
+    </para>
+    <screen>
+Read1  ...TGACTGA****************nnnnnnnnnnnnnnnnnnnnnTCAGTTGAT...
+Read2  ...TGACTGATGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...
+Read3  ...TGACTGATGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...
+
+TCONS3 ...TGACTGATGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...</screen>
+    <para>
+      Note that a new temporary consensus TCONS3 is formed against which the
+      next read (read 4) will have to align:
+    </para>
+    <screen>
+TCONS3 ...TGACT*****GATGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...
+Read4  ...TGACTnnnnnnnnnnnnnnnnnnnnnnnnnnnnnATGCGTCGAGCTTGGTCAGTTGAT...</screen>
+    <para>
+      which then leads to the sub-optimal multiple alignment seen in the beginning:
+    </para>
+    <screen>
+Read1  ...TGACT*****GA****************nnnnnnnnnnnnnnnnnnnnnTCAGTTGAT...
+Read2  ...TGACT*****GATGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...
+Read3  ...TGACT*****GATGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...
+Read4  ...TGACTnnnnnnnnnnnnnnnnnnnnnnnnnnnnnATGCGTCGAGCTTGGTCAGTTGAT...</screen>
+    <para>
+      It would have been totally illogical for a Smith-Waterman alignment to
+      align the temporary consensus TCONS3 with read 4 like this:
+    </para>
+    <screen>
+TCONS3 ...TGACTGA*****TGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...
+Read4  ...TGACTnnnnnnnnnnnnnnnnnnnnnnnnnnnnnATGCGTCGAGCTTGGTCAGTTGAT...</screen>
+    <para>
+      as from purely mathematical point of view, the score of this alignment is
+      lower than for the previous alignment.
+    </para>
+    </sidebar>
+    <para>
+      This can lead to severe misaligns in multiple alignments with several
+      reads as the following screenshot shows exemplarily.
+    </para>
+    <figure id="pb_elasticdarkinserts01">
+      <title>Multiple alignment with PacBio elastic dark inserts, initial
+      status with severe misalignments</title>
+      <mediaobject>
+	<imageobject>
+<!--
+	  <imagedata fileref="bookfigures/pb_elasticdarkinserts01.png" width="4.8in"/>
+-->
+	  <imagedata fileref="bookfigures/pb_elasticdarkinserts01.png" width="90%"/>
+	</imageobject>
+      </mediaobject>
+    </figure>  
+    <para>
+      However, MIRA is an iterative assembler working in multiple passes and
+      iterations within a pass. This allows for a strategy of iterative
+      correction of the estimation of dark length inserts. Like with every
+      sequencing technology it knows, MIRA analyses the multiple alignment of
+      a contig in several ways and searches for, e.g., misassembled repeats
+      (for more information on this, please refer to the MIRA manual). When
+      having reads with the technology from Pacific Biosciences, MIRA also
+      analyses the elastic dark inserts whether or not their length as
+      measured in the multiple alignment fits the estimated length. If not,
+      the length of the dark insert will be corrected up or down for the next
+      pass, the correction factor being of two thirds of the estimated
+      difference between true and measured length of the dark insert.
+    </para>
+    <para>
+      Coming back to the example used previously:
+    </para>
+    <screen>
+Read1  ...TGACT*****GA****************nnnnnnnnnnnnnnnnnnnnnTCAGTTGAT...
+Read2  ...TGACT*****GATGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...
+Read3  ...TGACT*****GATGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...
+Read4  ...TGACTnnnnnnnnnnnnnnnnnnnnnnnnnnnnnATGCGTCGAGCTTGGTCAGTTGAT...</screen>
+    <para>
+      You will note that there are basically two elastic dark insert
+      stretches. The first in read 1 has an underestimation of of the dark
+      insert size of 16 bases, the second has an overestimation of five
+      bases. 
+    </para>
+    <sidebar>
+      <para>
+	While it is not depicted in this simple example, the calculation of how
+	many bases away the estimated length of a dark insert is from the real
+	value is not always simple as multiple misaligns can make this task
+	challenging. If taken without precautions, errors in this calculation
+	can lead to even more false estimation of dark insert lengths and
+	self-enhancing errors. During experimentation with simulated strobed
+	projects, MIRA built the best contigs and needed the least iterations
+	when applying a factor of two thirds to the calculated estimation of
+	dark insert length error.
+      </para>
+    </sidebar>
+    <para>
+	Accordingly, MIRA will add two thirds of 16 =
+	10 <literal>N</literal>s to the estimated dark insert in read 1 and
+	remove 3 <literal>N</literal>s (two thirds of 5) from read 4:
+    </para>
+    <screen>
+Read1 old  ...TGACTGAnnnnnnnnnnnnnnnnnnnnnTCAGTTGAT...
+Read1 new  ...TGACTGANNNNNNNNNNnnnnnnnnnnnnnnnnnnnnnTCAGTTGAT...
+
+Read4 old  ...TGACTnnnnnnnnnnnnnnnnnnnnnnnnnnnnnATGCGTCGAGCTTGGTCAGTTGAT...
+Read4 new  ...TGACTnnnnnnnnnnnnnnnnnnnnnnnnnnATGCGTCGAGCTTGGTCAGTTGAT...</screen>
+    <para>
+      These new reads will be used in the next (sub-)passes of MIRA. Continuing the example from above, the next multiple alignment of all four reads would look like this:
+    </para>
+    <screen>
+Read1  ...TGACT**GA******NNNNNNNNNNnnnnnnnnnnnnnnnnnnnnnTCAGTTGAT...
+Read2  ...TGACT**GATGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...
+Read3  ...TGACT**GATGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...
+Read4  ...TGACTnnnnnnnnnnnnnnnnnnnnnnnnnnATGCGTCGAGCTTGGTCAGTTGAT...</screen>
+    <para>
+      Again, the dark inserts would be corrected by MIRA, this time adding 4
+      <literal>N</literal>s to read 1 and removing one <literal>N</literal>
+      from read 4., so that the next multiple alignment is this:
+    </para>
+    <screen>
+Read1  ...TGACT*GA**NNNNNNNNNNNNNNnnnnnnnnnnnnnnnnnnnnnTCAGTTGAT...
+Read2  ...TGACT*GATGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...
+Read3  ...TGACT*GATGACTTTATCTATGGAGCTTATATGCGTCGAGCTTGGTCAGTTGAT...
+Read4  ...TGACTnnnnnnnnnnnnnnnnnnnnnnnnnATGCGTCGAGCTTGGTCAGTTGAT...</screen>
+    <para>
+      From there it is trivial to see one just needs two more iterations to
+      replace the initial estimated length of the dark insert by the true
+      length of it. The next screenshot continues the live example shown
+      previously after the second pass of MIRA (remember that each pass can
+      have multiple sub-passes):
+    </para>
+    <figure id="pb_elasticdarkinserts02">
+      <title>Assembly with PacBio dark inserts, status after second pass of MIRA</title>
+      <mediaobject>
+	<imageobject>
+	  <imagedata fileref="bookfigures/pb_elasticdarkinserts02.png" width="90%"/>
+	</imageobject>
+      </mediaobject>
+    </figure>  
+    <para>
+      One pass (and multiple sub-passes) later, the elastic dark inserts in
+      this example have reached their true lengths. The multiple alignment is
+      as good as it can get as the following figure shows:
+    </para>
+    <figure id="pb_elasticdarkinserts03">
+      <title>Assembly with PacBio dark inserts, status after third pass of MIRA</title>
+      <mediaobject>
+	<imageobject>
+	  <imagedata fileref="bookfigures/pb_elasticdarkinserts03.png" width="90%"/>
+	</imageobject>
+      </mediaobject>
+    </figure>  
+    <para>
+      The elastic dark insert strategy is quite successful for resolving most
+      problems but sometimes also fails to find a perfect solution. However,
+      the remaining multiple alignment is -- in most cases -- good enough for
+      a consensus algorithm to find the correct consensus as the next
+      screenshot shows:
+    </para>
+    <figure id="pb_elasticdarkinserts04">
+      <title>Assembly with PacBio dark inserts, example where elastic correction failed partially</title>
+      <mediaobject>
+	<imageobject>
+	  <imagedata fileref="bookfigures/pb_elasticdarkinserts04.png" width="90%"/>
+	</imageobject>
+      </mediaobject>
+    </figure>  
+  </sect1>
+  <sect1 id="sect_pb_pacbiowithmira">
+    <title>Assembly of PacBio data with MIRA</title>
+    <para>
+    </para>
+    <sect2 id="sect_pb_prepdata">
+      <title>Preparing data</title>
+      <para>
+	MIRA will happily read data in several different formats (FASTA,
+	FASTQ, etc.). For the sake of simplicity, this guide will use FASTQ as
+	demonstration format, but most of the time not add the quality line.
+      </para>
+      <sect3 id="sect_pb_as_prepdata_simple">
+	<title>Simple, unstrobed, non-paired reads</title>
+	<para>
+	  This is actually quite simple. Just put your reads as FASTQ in a
+	  file and you are done. No need to bother about read naming
+	  conventions or similar things. Like so:
+	  <screen>
+ at readname_001
+ACGTTGCAGGGTCATGCAGT...
+ at readname_002
+...</screen>
+	</para>
+      </sect3>
+      <sect3 id="sect_pb_as_prepdata_pairedend">
+	<title>Strobed reads with two strobes, simulating paired ends</title>
+	<para>
+	  You have two possibilities for that. If the "dark insert" is not too
+	  long and about the same size or shorter than the average sequenced
+	  length at the ends, you can put the data into one read and fill up
+	  the estimated dark insert length with the '<literal>n</literal>'
+	  character. The following example shows this, using lengths of 10 for
+	  the sequenced parts and a dark insert size of 10:
+	</para>
+	<screen>
+ at readname_001
+ACGTTGCAGGnnnnnnnnnnGTCATGCAGT
+ at readname_002
+...</screen>
+	<para>
+	  In case you have long "dark inserts", it is preferable to keep both
+	  parts physically separated in different reads. In this case, read
+	  naming becomes important for an assembler. Pick any paired-end
+	  naming scheme you want and name your reads accordingly. The
+	  following example shows the same data as above, split in two
+	  reads and using the Solexa naming scheme to denote the first read of
+	  a pair by appending <literal>/1</literal> to the read name and the
+	  second part by appending <literal>/2</literal>:
+	</para>
+	<screen>
+ at readname_001/1
+ACGTTGCAGG
+ at readname_001/2
+GTCATGCAGT
+ at readname_002/1
+...</screen>
+        <note>
+	  <para>
+	    The example above used Solexa naming scheme to denote paired-end
+	    partner reads. You can use any naming scheme you want as long as
+	    MIRA knows it. E.g.: the <emphasis>forward/reverse</emphasis> or
+	    <emphasis>Sanger</emphasis> or <emphasis>TIGR</emphasis> naming
+	    schemes, you will just need to tell MIRA about it with the
+	    <arg>-LR:rns</arg> parameter.
+	  </para>
+	  <para>
+	    As soon as first data sets with PacBio are available, MIRA will
+	    also implement their naming scheme.
+	  </para>
+	</note>
+	<para>
+	  Should all your reads approximately have the same total length of
+	  first part (/1) + dark insert + second part (/2), then you don't
+	  need to create an additional file with information about expected
+	  distance between the parts, you can use <arg>-GE:tismin:tismax</arg>
+	  to tell MIRA about it. In case you have different sizes because,
+	  e.g. you have sequenced different libraries, then you will need to
+	  tell MIRA which reads have which distance from each other. You can
+	  do this in an XML file in TRACEFORMAT (as defined by the NCBI). There will be other means in the future, but these have not been implemented yet.
+	</para>
+      </sect3>
+      <sect3 id="sect_pb_as_prepdata_multistrobe">
+	<title>Strobed reads with multiple strobes</title>
+	<para>
+	  Like in the case with two strobes, you have the choice between
+	  putting all strobes in one read ... or to separate the strobes in
+	  multiple reads. The following example shows the case where all
+	  strobes are in one read:
+	</para>
+	<screen>
+ at readname_001
+ACGTTGCAGGnnnnnnnnnnGTCATGCAGTnnnnnnnnnnnnnnnnnnnnnnnnTATGCACTGACnnnnnTAGCTGA
+ at readname_002
+...</screen>
+	<para>
+	  Note that the "dark inserts" do not necessarily need to be of the
+	  same length, even within a read. Indeed, depending on your
+	  sequencing strategy they can have very varying lengths, although one
+	  should take care that these inserts are not much longer than the
+	  longest strobes (or longest unstrobed read) in your data set.
+	</para>
+	<para>
+	  In case you have long dark inserts, you should split the parts
+	  separated by these long inserts into different reads. E.g., if your
+	  strobes are 500 bases long, but separated by dark inserts > 1Kb,
+	  split them. You are free to split them however you like, in
+	  sub-pairs, in single strobes or whatever. For the example given
+	  above, this could be done like this:
+	</para>
+	<screen>
+ at readname_001/1
+ACGTTGCAGGnnnnnnnnnnGTCATGCAGT
+ at readname_001/2
+TATGCACTGACnnnnnTAGCTGA
+ at readname_002
+...</screen>
+	<para>
+	  Note the dark inserts remaining in each read of the "virtual"
+	  read-pair. The same sequences could also be split like this:
+	</para>
+	<screen>
+ at readname_001a/1
+ACGTTGCAGG
+ at readname_001a/2
+GTCATGCAGT
+ at readname_001b/1
+TATGCACTGAC
+ at readname_001b/2
+TAGCTGA
+ at readname_002
+...</screen>
+        <para>
+	  which would then be two read-pairs: the first and second strobes are
+	  paired, as well as the third and fourth. Here too, you can use any
+	  combination strobes to pair to each other (or to use without pair
+	  information).
+	</para>
+	  <para>
+Combining first and fourth strobe as well as second
+	  and fourth would look like this:
+	</para>
+	<screen>
+ at readname_001a/1
+ACGTTGCAGG
+ at readname_001b/1
+TAGCTGA
+ at readname_001b/2
+GTCATGCAGT
+ at readname_001a/2
+TATGCACTGAC
+ at readname_002
+...</screen>
+        <para>
+	  Note that in this case you probably need to provide paired-end
+	  information in a NCBI TRACEARCHIVE XML file to tell MIRA about the
+	  different insert sizes.
+	</para>
+        <para>
+	  Finally, you can put the reads all in one template like this:
+	</para>
+	<screen>
+ at readname_001.f1
+ACGTTGCAGG
+ at readname_001.f2
+GTCATGCAGT
+ at readname_001.f3
+TATGCACTGAC
+ at readname_001.f4
+TAGCTGA
+ at readname_002
+...</screen>
+	<para>
+	  Note the subtle change in the naming of reads where I changed to a
+	  different postfix naming. This is because the Solexa naming scheme
+	  currently does not (officially) allow for more than two reads per
+	  DNA template (well, /1 and /2). The forward/reverse naming scheme
+	  like implemented by MIRA however does allow this.
+	</para>
+	<para>
+	  This has just one drawback: currently MIRA will not be able to store
+	  the distances between the strobes when they are all in one
+	  template. This is being worked on and will be possible in a future
+	  version.
+	</para>
+      </sect3>
+    </sect2>
+    <sect2 id="sect_pb_as_setting_up_files">
+      <title>Setting up files and directories</title>
+      <para>
+	Create a directory where you copy your input data into (or where you
+	set a soft-link where it really resides).
+      </para>
+      <para>
+	Currently (as of version 3.2.0) MIRA allows one input file per
+	sequencing technology (one for Sanger, one for 454, one for Solexa and
+	one for PacBio). This will change in the future, but for the moment it
+	is how it is.
+      </para>
+      <para>
+	While you could name your input files whatever you like and pass these
+	as parameters to MIRA, it is easier to follow a simple naming scheme
+	that allows MIRA to find everything automatically. This scheme is
+	<filename><emphasis>projectname</emphasis>_in.<emphasis>sequencingtechtype</emphasis>.<emphasis>filetypepostfix</emphasis></filename>
+      </para>
+      <para>
+	The <filename><emphasis>projectname</emphasis></filename> is a free
+	string which you decide to give to your project. The
+	<filename><emphasis>sequencingtechtype</emphasis></filename> can be
+	one of "sanger", "454", "solexa" or "pacbio". Finally the
+	<filename><emphasis>filetypepostfix</emphasis></filename> is either
+	"fasta" and "fasta.qual", "fastq" or any other type supported by MIRA.
+      </para>
+      <para>
+	Note that MIRA supports loading a lot of other information files (XML
+	TRACEINFO, strain data etc.), please consult the reference manual for
+	more information.
+      </para>
+    </sect2>
+    <sect2 id="sect_pb_as_launching_mira">
+      <title>Launching MIRA</title>
+      <para>
+	In the most basic incantation, you will need to tell MIRA just five things:
+      </para>
+      <orderedlist>
+	<listitem>
+	  <para>
+	    the name of your project.
+	  </para>
+	</listitem>
+	<listitem>
+	  <para>
+	    whether you want a "genome" or "EST" assembly
+	  </para>
+	</listitem>
+	<listitem>
+	  <para>
+	    whether it is a denovo or mapping assembly
+	  </para>
+	</listitem>
+	<listitem>
+	  <para>
+	    which quality level (draft, normal or accurate)
+	  </para>
+	</listitem>
+	<listitem>
+	  <para>
+	    which sequencing technologies are involved (sanger, 454, solexa, pacbio)
+	  </para>
+	</listitem>
+      </orderedlist>
+      <para>
+	Using the most basic <firstterm>quick switches</firstterm> of MIRA,
+	the command line for an accurate denovo genome with PacBio data then
+	looks like this:
+      </para>
+      <screen>
+<command>mira</command> --project=<replaceable>yourname</replaceable> --job=genome,denovo,accurate,pacbio</screen>
+      <para>
+	or for a hybrid PacBio and Solexa of the above:
+      </para>
+      <screen>
+<command>mira</command> --project=<replaceable>yourname</replaceable> --job=genome,denovo,accurate,pacbio,solexa</screen>
+      <note>
+	MIRA has -- at the last count -- more than 150 parameters one can use
+	to fine tune almost every aspect of an assembly, from data loading
+	options to results saving, from data preprocessing to results
+	interpretation, from simple alignment parameters to parametrisation of
+	internal misassembly decision rules ... and much more. Many of these
+	parameters can be even set individually for each sequencing technology
+	they apply to. Example given: in an assembly with Solexa, Sanger, 454
+	and PacBio data, the minimum read length for Solexa could be set to
+	30, while for 454 it could be 80, Sanger 100 and PacBio 150. Please
+	refer to the reference manual for a full overview on how to use
+	<emphasis>quick switches</emphasis> and <firstterm>extended
+	switches</firstterm>.
+      </note>
+    </sect2>
+  </sect1>
+  <sect1 id="sect_pb_walkthrough_realdata">
+    <title>Walkthroughs: real data sets from PacBio</title>
+    <para>
+      We'll use some data provided by PacBio for the
+      <emphasis>E. coli</emphasis> O104:H4 outbreak in 2011, see <ulink
+      url="http://www.pacbiodevnet.com/Share/Datasets/E-coli-Outbreak"/> for
+      more info.
+    </para>
+    <sect2 id="sect_pb_wtrd_clrc">
+      <title>
+	Error corrected CLR for E. coli C227-11$
+      </title>
+      <para>
+	That data set is quite interesting: PacBio took CLR reads (the reads
+	with only ~85% accuracy) and mapped CCS reads (presumably >00%
+	accuracy) to them to correct errors of the CLR reads. The resulting
+	<emphasis>error corrected CLR</emphasis> data is of pretty good
+	quality, not only from the quality values but when assembled, the
+	number of sequencing errors in the reads which can be spotted in the
+	aligments is obviously quite low.
+      </para>
+      <sect3 id="sect_pb_wtrd_clrc_prep_filesystem">
+	<title>
+	  Preparing a directory structure
+	</title>
+	<para>
+	  Note: this is how I set up a project, feel free to implement whatever
+	  structure suits your needs.
+	</para>
+	<screen>
+<prompt>$</prompt> <userinput>mkdir c227-11-clrc</userinput>
+<prompt>$</prompt> <userinput>cd c227-11-clrc</userinput>
+<prompt>arcadia:c227-11-clrc$</prompt> <userinput>mkdir origdata data assemblies</userinput></screen>
+	<para>
+	  Your directory should now look like this:
+	</para>
+	<screen>
+<prompt>arcadia:c227-11-clrc$</prompt> <userinput>ls -l</userinput>
+drwxr-xr-x 2 bach users 48 2011-08-19 20:21 assemblies
+drwxr-xr-x 2 bach users 48 2011-08-19 20:21 data
+drwxr-xr-x 2 bach users 48 2011-08-19 20:21 origdata</screen>
+        <para>
+	  "c227-11-clrc" is an arbitrary name I just chose by concatenating
+	  the name of the bug and "-clrc" to indicate that this project has
+	  <emphasis role="bold">CLR</emphasis> sequences which were <emphasis
+	  role="bold">C</emphasis>orected. But you can name this whatever you
+	  want: foobar, blafurbsel, ...
+	</para>
+        <para>
+	  Explanation of the structure:
+	</para>
+	<itemizedlist>
+	  <listitem>
+	    <para>
+	      the <filename>origdata</filename> directory will contain the 'raw'
+	      result files that one might get from sequencing. In our case it
+	      will be the <filename>.tar.gz</filename> file with the data in
+	      FASTQ format from the Devnet site.
+	    </para>
+	  </listitem>
+	  <listitem>
+	    <para>
+	      the <filename>data</filename> directory will contain the
+	      preprocessed sequences for the assembly, ready to be used by MIRA
+	    </para>
+	  </listitem>
+	  <listitem>
+	    <para>
+	      the <filename>assemblies</filename> directory will contain
+	      assemblies we make with our data (we might want to make more than
+	      one).
+	    </para>
+	  </listitem>
+	</itemizedlist>
+      </sect3>
+      <sect3 id="sect_pb_wtrd_clrc_getdata">
+	<title>
+	  Getting the data and preparing it
+	</title>
+	<para>
+	  Head over to PacBio DevNet and fetch the data set for the <ulink
+	  url="http://www.pacbiodevnet.com/Share/Datasets/e-coli-c227-11-corrected-fastq-1.2.2beta.tgz">E. coli
+	  C227-11 CLR corrected</ulink> data set. Put it into the
+	  <filename>origdata</filename> directory created a few moments ago.
+	</para>
+	<para>
+	  Now, let's extract the data to the <filename>data</filename> directory:
+	</para>
+	<screen>
+<prompt>arcadia:c227-11-clrc$</prompt> <userinput>cd data</userinput>
+<prompt>arcadia:data$</prompt> <userinput>tar xvzf ../origdata/e-coli-c227-11-corrected-fastq-1.2.2beta.tgz</userinput>
+e-coli-c227-11-corrected-fastq-1.2.2beta/
+e-coli-c227-11-corrected-fastq-1.2.2beta/e-coli-c227-11-corrected.fastq</screen>
+        <para>
+	  One thing you would quickly find out but which I tell now to save
+	  time: at the moment, PacBio seems to love ultra long read
+	  names. Here are the first 10 from the current data set:
+        </para>
+	<screen>
+<prompt>arcadia:data$</prompt> <userinput>grep ^@m e-coli-c227-11-corrected-fastq-1.2.2beta/e-coli-c227-11-corrected.fastq | head -10</userinput>
+ at m110618_035655_42142_c100158802555500000315044108071130_s1_p0/10040/0_5174/c0
+ at m110618_035655_42142_c100158802555500000315044108071130_s1_p0/10040/0_5174/c1
+ at m110618_035655_42142_c100158802555500000315044108071130_s1_p0/1017/0_1636/c0
+ at m110618_035655_42142_c100158802555500000315044108071130_s1_p0/1054/0_4073/c0
+ at m110618_035655_42142_c100158802555500000315044108071130_s1_p0/1054/0_4073/c1
+ at m110618_035655_42142_c100158802555500000315044108071130_s1_p0/1054/4121_4891/c0
+ at m110618_035655_42142_c100158802555500000315044108071130_s1_p0/10548/0_5766/c0
+ at m110618_035655_42142_c100158802555500000315044108071130_s1_p0/10548/0_5766/c1
+ at m110618_035655_42142_c100158802555500000315044108071130_s1_p0/10640/0_2393/c0
+ at m110618_035655_42142_c100158802555500000315044108071130_s1_p0/11000/0_3285/c0</screen>
+        <para>
+	  How sweet! File names with 80 and more characters AND having the "/"
+	  character as component, the later being a recipe for desaster sooner
+	  or later in some post-processing pipelines.
+        </para>
+	<note>
+	  MIRA has absolutely no problem with the above: neither with long read
+	  names nor with the "/" character in the name. However, long read names
+	  are a problem for example for <command>gap4</command> (an assembly
+	  viewer) and the "/" character might lead to confusion with the
+	  standard UNIX directory separator.
+	</note>
+        <para>
+	  For the sake of simplicity and compatibility, let's rename all
+	  sequences. For this we'll use <command>convert_project</command>,
+	  which is a binary of the MIRA program package:
+        </para>
+	<screen>
+<prompt>arcadia:data$</prompt> <userinput>convert_project
+  -f fastq -t fastq -R c227-11-clrc
+  e-coli-c227-11-corrected-fastq-1.2.2beta/e-coli-c227-11-corrected.fastq
+  c227-11-clrc_in.pacbio</userinput>
+Loading from fastq, saving to: fastq
+Loading data from FASTQ ...
+Counting sequences in FASTQ file: found 73496 sequences.
+Localtime: Sat Aug 20 20:36:26 2011
+Unusual offset of 34, guessing this file to be a Sanger-type FASTQ format.
+Using calculated FASTQ quality offset: 33
+Localtime: Sat Aug 20 20:36:26 2011
+Loading data from FASTQ file:
+ [0%] ....|.... [10%] ....|.... [20%] ....|.... [30%] ....|.... [40%] ....|....
+[50%] ....|.... [60%] ....|.... [70%] ....|.... [80%] ....|.... [90%] ....|.... [100%] 
+
+Done.
+Loaded 73496 reads, Localtime: Sat Aug 20 20:36:35 2011
+ done.
+Data conversion process finished, no obvious errors encountered.</screen>
+      <note>
+	The above command has been split in multiple lines for better overview
+	but should be entered in one line.
+      </note>
+      <para>
+	The parameters to <command>convert_project</command> say
+      </para>
+	<itemizedlist>
+	  <listitem>
+	    <para>
+	      <emphasis role="bold">-f fastq</emphasis>: the "from" type (type
+	      of the input file) is FASTQ
+	    </para>
+	  </listitem>
+	  <listitem>
+	    <para>
+	      <emphasis role="bold">-t fastq</emphasis>: the "to" type (type
+	      of the output file) should be FASTQ
+	    </para>
+	  </listitem>
+	  <listitem>
+	    <para>
+	      <emphasis role="bold">-R c227-11-clrc</emphasis>: sequences
+	      should be renamed, all starting with "c227-11-clrc" and to which
+	      <command>convert_project</command> will append an underscore and
+	      a counter.
+	    </para>
+	  </listitem>
+	  <listitem>
+	    <para>
+	      <emphasis
+	      role="bold">e-coli-c227-11-corrected-fastq-1.2.2beta/e-coli-c227-11-corrected.fastq</emphasis>:
+	      that's the full name of our input file.
+	    </para>
+	  </listitem>
+	  <listitem>
+	    <para>
+	      <emphasis role="bold">c227-11-clrc_in.pacbio</emphasis>: that's
+	      the partial name of our output file. Partial because
+	      <command>convert_project</command> will automatically add the
+	      postfix of the target format to the name, in this case
+	      <filename>.fastq</filename>.
+	    </para>
+	    <para>
+	      Just in case you wonder why this works like this:
+	      <command>convert_project</command> can convert to multiple
+	      formats at once, e.g., like this: convert_project -f fastq -t
+	      fasta -t fastq -t maf ... and then you will get nicely named
+	      files.
+	    </para>
+	  </listitem>
+	</itemizedlist>
+	<para>
+	  Your directory should now look like this ...
+	</para>
+	<screen>
+<prompt>arcadia:data$</prompt> <userinput>ls -l</userinput>
+-rw-r--r-- 1 bach bach 257844076 2011-08-20 21:04 c227-11-clrc_in.pacbio.fastq
+drwxr-x--- 2 bach bach      4096 2011-07-22 04:49 e-coli-c227-11-corrected-fastq-1.2.2beta</screen>
+	<para>
+	  ... and as we do not need the subdirectory with the extracted data from PacBio anymore, let's get rid of it:
+	</para>
+	<screen>
+<prompt>arcadia:data$</prompt> <userinput>rm -rf e-coli-c227-11-corrected-fastq-1.2.2beta</userinput>
+<prompt>arcadia:data$</prompt> <userinput>ls -l</userinput>
+-rw-r--r-- 1 bach bach 257844076 2011-08-20 21:04 c227-11-clrc_in.pacbio.fastq</screen>
+	<para>
+	  Perfect, we're done here.
+	</para>
+      </sect3>
+      <sect3 id="sect_pb_wtrd_clrc_starting_assembly">
+	<title>
+	  Starting the assembly
+	</title>
+	<para>
+	  Good, we're almost there. Let's switch to the
+	  <filename>assembly</filename> directory and create a subdirectory for our
+	  first assembly test.
+	</para>
+	<screen>
+<prompt>arcadia:data$</prompt> <userinput>cd ../assemblies/</userinput>
+<prompt>arcadia:assemblies$</prompt> <userinput>mkdir 1sttest</userinput>
+<prompt>arcadia:assemblies$</prompt> <userinput>cd 1sttest</userinput></screen>
+        <para>
+	  This directory is quite empty and the PacBio data is not
+	  present. Let's link to the file we just created in the previous step:
+	</para>
+	<screen>
+<prompt>arcadia:1sttest$</prompt> <userinput>ln -s ../../data/* .</userinput>
+<prompt>arcadia:1sttest$</prompt> <userinput>ls -l</userinput>
+lrwxrwxrwx 1 bach bach      39 2011-08-20 16:56 c227-11-clrc_in.pacbio.fastq -> ../../data/c227-11-clrc_in.pacbio.fastq</screen>
+        <para>
+	  Starting the assembly is now just a matter of one line with some
+	  parameters set correctly:
+	</para>
+	<screen>
+<prompt>arcadia:1sttest$</prompt> <userinput>mira 
+--project=c227-11-clrc
+--job=denovo,genome,accurate,pacbio
+>&log_assembly.txt </userinput></screen>
+        <note>
+	  The above command has been split in multiple lines for better
+	  overview but should be entered in one line.
+	</note>
+	<para>
+	  Some 3 to 4 hours later, you should have a nice and shiny assembly of
+	  your data.
+	</para>
+	<para>
+	  Now, that was easy, wasn't it? In the above example - for assemblies
+	  having only PacBio data and if you followed the walkthrough on how to
+	  prepare the data - everything you might want to adapt in the first
+	  time are the following options:
+	</para>
+	<itemizedlist>
+	  <listitem>
+	    <para>
+	      --project (for naming your assembly project)
+	    </para>
+	  </listitem>
+	  <listitem>
+	    <para>
+	      --job (perhaps to change the quality of the assembly to 'draft'
+	    </para>
+	  </listitem>
+	</itemizedlist>
+	<para>
+	  Of course, you are free to change any option via the extended
+	  parameters, perhaps change the default number of processors to use
+	  from 2 to 4 via <arg>-GE:not=4</arg> or any other of the > 150
+	  parameters MIRA has ... but this is covered in the MIRA main reference
+	  manual.
+	</para>
+      </sect3>
+      <sect3 id="sect_pb_wtrd_clrc_working_with_results">
+	<title>
+	  Working with the results of the assembly
+	</title>
+	<para>
+	  There is a whole chapter in the manual dedicated to this, you are expected to read it :-)
+	</para>
+	<para>
+	  However, for the impatient, here's a quick rundown on what I am going
+	  to show as example in this section: filtering of results and loading
+	  results into an assembly viewer.
+	</para>
+	<sect4 id="sect_pb_wtrd_clrc_wwr_filtering">
+	  <title>
+	    Filtering results
+	  </title>
+	  <para>
+	    This assembly project has an average coverage of roundabout 23 to
+	    24x. Due to sequencing errors, MIRA will have also created a few
+	    small contigs with just a few reads and lot less coverage. These
+	    contigs are, well, most of the time not interesting as they contain
+	    junk most of the time. I want to get rid of them.
+	  </para>
+	  <para>
+	    Let's say that only contigs ≥ 500 base pairs and with an average
+	    coverage ≥ 8 (which is 1/3 of the average coverage of 24 of the
+	    whole project) are interesting. Let's filter them out of the MIRA
+	    results and create a CAF file which can then be imported into either
+	    <command>gap4</command> or <command>gap5</command> (assembly viewers
+	    and finishing tools from the Staden package).
+	  </para>
+	  <para>
+	    Let's take a quick look at the main directories and files of the
+	    assembly:
+	  </para>
+	  <screen>
+<prompt>arcadia:1sttest$</prompt> <userinput>ls -l</userinput>
+drwxr-xr-x 6 bach bach    4096 2011-08-20 16:57 c227-11-clrc_assembly
+lrwxrwxrwx 1 bach bach      39 2011-08-20 16:56 c227-11-clrc_in.pacbio.fastq -> ../../data/c227-11-clrc_in.pacbio.fastq
+-rw-r--r-- 1 bach bach 2524406 2011-08-20 19:46 log_assembly.txt
+<prompt>arcadia:1sttest$</prompt> <userinput>cd c227-11-clrc_assembly</userinput>
+<prompt>arcadia:c227-11-clrc_assembly$</prompt> <userinput>ls -l</userinput>
+drwxr-xr-x 2 bach bach  4096 2011-08-20 17:01 c227-11-clrc_d_chkpt
+drwxr-xr-x 2 bach bach  4096 2011-08-20 19:46 c227-11-clrc_d_info
+drwxr-xr-x 2 bach bach  4096 2011-08-20 20:10 c227-11-clrc_d_results
+drwxr-xr-x 2 bach bach 36864 2011-08-20 19:46 c227-11-clrc_d_tmp
+<prompt>arcadia:c227-11-clrc_assembly$</prompt> <userinput>ls -l c227-11-clrc_d_info</userinput>
+-rw-r--r-- 1 bach bach     2320 2011-08-20 19:46 c227-11-clrc_info_assembly.txt
+-rw-r--r-- 1 bach bach       88 2011-08-20 16:57 c227-11-clrc_info_callparameters.txt
+-rw-r--r-- 1 bach bach   168049 2011-08-20 19:46 c227-11-clrc_info_consensustaglist.txt
+-rw-r--r-- 1 bach bach  1599427 2011-08-20 19:46 c227-11-clrc_info_contigreadlist.txt
+-rw-r--r-- 1 bach bach     6718 2011-08-20 19:46 c227-11-clrc_info_contigstats.txt
+-rw-r--r-- 1 bach bach     7401 2011-08-20 19:46 c227-11-clrc_info_debrislist.txt
+-rw-r--r-- 1 bach bach    10572 2011-08-20 19:15 c227-11-clrc_info_readrepeats.lst
+-rw-r--r-- 1 bach bach 42697892 2011-08-20 19:46 c227-11-clrc_info_readtaglist.txt
+<prompt>arcadia:c227-11-clrc_assembly$</prompt> <userinput>cd c227-11-clrc_d_results</userinput>
+<prompt>arcadia:c227-11-clrc_results$</prompt> <userinput>ls -l</userinput>
+-rw-r--r-- 1 bach bach 192615652 2011-08-20 19:46 c227-11-clrc_out.ace
+-rw-r--r-- 1 bach bach 597368574 2011-08-20 19:46 c227-11-clrc_out.caf
+-rw-r--r-- 1 bach bach 306918692 2011-08-20 19:46 c227-11-clrc_out.maf
+-rw-r--r-- 1 bach bach   6333500 2011-08-20 19:46 c227-11-clrc_out.padded.fasta
+-rw-r--r-- 1 bach bach  18987968 2011-08-20 19:46 c227-11-clrc_out.padded.fasta.qual
+-rw-r--r-- 1 bach bach      7240 2011-08-20 19:46 c227-11-clrc_out.tcs
+-rw-r--r-- 1 bach bach   6297565 2011-08-20 19:46 c227-11-clrc_out.unpadded.fasta
+-rw-r--r-- 1 bach bach  18881604 2011-08-20 19:46 c227-11-clrc_out.unpadded.fasta.qual
+-rw-r--r-- 1 bach bach   4442567 2011-08-20 19:46 c227-11-clrc_out.wig</screen>
+	  <para>
+	    OK, we're at the right spot for filtering. While we are at it, tell
+	    <command>convert_project</command> to not only convert to CAF, but
+	    also to write a new file with tabular data on contig statistics of
+	    the filtered contigs:
+	  </para>
+	  <screen>
+<prompt>arcadia:c227-11-clrc_results$</prompt> <userinput>convert_project
+  -f maf -t caf -t cstats -x 500 -y 8
+  c227-11-clrc_out.maf 
+  c227-11-clrc_filteredx500y8</userinput>
+Loading from maf, saving to: caf cstats
+First counting reads:
+ [0%] ....|.... [10%] ....|.... [20%] ....|.... [30%] ....|.... [40%] ....|.... [50%] ....|.... [60%] ....|.... [70%] ....|.... [80%] ....|.... [90%] ....|.... [100%] 
+Now loading and processing data:</screen>
+	  <para>
+	    ... lots of lines omitted ...
+	  </para>
+	  <screen>
+Data conversion process finished, no obvious errors encountered.
+<prompt>arcadia:c227-11-clrc_results$</prompt> <userinput>ls -l *filtered*</userinput>
+-rw-r--r-- 1 bach bach 584042411 2011-08-20 22:12 c227-11-clrc_filteredx500y8.caf
+-rw-r--r-- 1 bach bach      1518 2011-08-20 22:12 c227-11-clrc_filteredx500y8_info_contigstats.txt</screen>
+	  <screen>
+<prompt>arcadia:c227-11-clrc_results$</prompt> <userinput>cat c227-11-clrc_filteredx500y8_info_contigstats.txt</userinput>
+# name                  length  av.qual #-reads mx.cov. av.cov  GC%     CnIUPAC CnFunny CnN     CnX     CnGap   CnNoCov
+c227-11-clrc_c1         335375  90      4081    35      21.27   49.73   2       0       0       0       1975    0
+c227-11-clrc_c2         651370  90      9224    41      23.88   51.23   3       0       0       0       4535    0
+c227-11-clrc_c3         356318  90      4962    40      24.18   50.81   0       0       0       0       2208    0
+c227-11-clrc_c4         386288  90      5178    39      23.58   51.49   3       0       0       0       2367    0
+c227-11-clrc_c5         908271  90      12277   40      23.41   50.73   3       0       0       0       5912    0
+...</screen>
+          <para>
+	    Once filtered, how many contigs are there? Well, 22: it's the
+	    number of lines minus one of the file
+	    <filename>c227-11-clrc_filteredx500y8_info_contigstats.txt</filename>:
+	  </para>
+	  <screen>
+<prompt>arcadia:c227-11-clrc_results$</prompt> <userinput>wc -l c227-11-clrc_filteredx500y8_info_contigstats.txt</userinput>
+23</screen>
+       </sect4>
+       <sect4 id="sect_pb_wtrd_clrc_wwr_gap4">
+	 <title>
+	   Looking at the assembly in gap4
+	 </title>
+	 <para>
+	   I'm very fond of gap4, so I'll use it to show ho the assembly looks like:
+	 </para>
+	 <screen>
+<prompt>arcadia:c227-11-clrc_results$</prompt> <userinput>caf2gap -project c227-11 -ace c227-11-clrc_filteredx500y8.caf >&/dev/null</userinput>
+<prompt>arcadia:c227-11-clrc_results$</prompt> <userinput>ls -l C*</userinput>
+-rw-r--r-- 1 bach bach 543539856 2011-08-20 22:35 C227-11.0
+-rw-r--r-- 1 bach bach  39512896 2011-08-20 22:35 C227-11.0.aux
+<prompt>arcadia:c227-11-clrc_results$</prompt> <userinput>gap4 C227-11.0</userinput></screen>
+	 <para>
+	   And while it's difficult to judge an assembly only from a
+	   screenshot, I made one: 22 contigs, none smaller than 4kb and
+	   pretty good certainty your bases are correct. Pray tell, isn't that
+	   beautiful?
+	 </para>
+	 <figure id="chap_pacbio::pb_elasticdarkinserts04">
+	   <title>
+	     Result of the assembly of <emphasis>E. coli</emphasis> C227-11 with
+	     error corrected CLR reads.
+	   </title>
+	   <mediaobject>
+	     <imageobject>
+	       <imagedata fileref="bookfigures/pb_c227-11-clcr_res.png" width="90%"/>
+	     </imageobject>
+	   </mediaobject>
+	 </figure>  
+       </sect4>
+     </sect3>
+   </sect2>
+   <sect2>
+     <title>CCS reads for E. coli C227-11</title>
+     <para>
+       Head over to PacBio DevNet and fetch the data set for the <ulink
+       url="http://www.pacbiodevnet.com/Share/Datasets/e-coli-c227-11-ccs-fastq-1.2.2beta.tgz">E. coli
+       C227-11 CCS</ulink> data set.
+     </para>
+     <para>
+       For the rest ... well, it's pretty much the same as for the CLR data
+       set. Just one little difference: in the <filename>.tgz</filename> you
+       downloaded, PacBio has split the data set into multiple FASTQ files (for
+       whatever reason). You will need to concatenate them into one file
+       before starting to work with that. Yep, and that's it.
+     </para>
+   </sect2>
+  </sect1>
+  <sect1 id="sect_pb_walkthrough_simulated">
+    <title>Walkthroughs: assembly examples with simulated PacBio data</title>
+    <para>
+      Whole genome sequencing of bacteria will probably be amongst the first
+      for which the long PacBio reads will have an impact. Simply put: the
+      repeat structure -- like rRNA stretches, (pro)phages and or duplicated
+      genes/operons -- of bacteria is such that most genomes known so far can
+      be assembled and or scaffolded with paired-end libraries between 6Kb and
+      10Kb.  <emphasis role="bold">Cite paper ...!</emphasis>
+    </para>
+    <para>
+      Well, using strobed reads where a DNA template is sequenced in several
+      strobes and the dark inserts have approximately the same length as a
+      strobe, the initial PacBio data should be capable to generate strobed
+      data from DNA templates a total span between 2000 and 6000 bases. 
+    </para>
+    <para>
+      Furthermore, strobed reads can be used to generate traditional
+      paired-end sequence with large insert sizes like 10Kb or more.
+    </para>
+    <para>
+      In the first few examples showing assembly with only PacBio data, we
+      will use the genome of the <emphasis>Bacillus subtilis</emphasis> 168,
+      which is a long standing model organism for systems biology and also
+      used in biotechnology. From a complexity point of view, the genome has
+      some interesting things in. As example, there are 11 rRNA stretches,
+      some of them clustered together, which probably comes from the fact that
+      <emphasis>Bsub</emphasis> evolved under laboratory conditions to become
+      a fast grower. The most awful multiple rRNA cluster is the one starting
+      at ...Kb and is ... Kb long.
+    </para>
+    <para>
+      The examples afterwards we will work with <emphasis>Escherichia
+      coli</emphasis> ... (Eco), another model organism in the bacterial
+      community. That time we will mix simulated low coverage PacBio data with
+      real data from Solexa deposited at the NCBI Short read Archive (SRA).
+    </para>
+    <note>
+      <para>
+	Currently this section contains examples with real Solexa reads but
+	only simulated PacBio reads as I do not have early access to real
+	PacBio data. However, I think that these examples show the
+	possibilities such a technology could have.
+      </para>
+    </note>
+  <sect2 id="sect_pb_exsd_generalnotes">
+    <title>Some general notes on how directories and data are set-up in these examples</title>
+    <para>
+      Everyone (or every sequencing group / center) has more or less an own
+      standard on how to organise directories and data prior to an
+      assembly. Here's how I normally do it and how the following examples
+      will be -- more or less -- set up: one top directory with the name of
+      the project containing three specific sub-directories; one for original
+      data, one for eventually reformated data and one for assemblies. That
+      looks a bit like this:
+    </para>
+<screen>
+<prompt>$</prompt> <userinput>mkdir myproject</userinput>
+<prompt>$</prompt> <userinput>cd myproject</userinput>
+<prompt>myproject$</prompt> <userinput>mkdir origdata data assemblies</userinput>
+</screen>
+    <para>
+      The <emphasis>origdata</emphasis> directory contains whatever data file
+      (or links to those) I have for that project: sequencing files from the
+      provider, reference genomes from databases etc.pp. The general rule: no
+      other files, and these files are generally write protected and unchanged
+      from the state of delivery.
+    </para>
+    <para>
+      The <emphasis>data</emphasis> directory contains the files as MIRA will
+      want to use them, eventually reformatted or reworked or bundled together
+      with other data. E.g.: if your provider delivered several data files
+      with sequence data for PacBio, you currently need to combine them into
+      one file as MIRA currently reads only one input file per sequencing
+      technology.
+    </para>
+    <para>
+      The <emphasis>assemblies</emphasis> directory finally contains
+      sub-directories with different assembly trials I make. Every sub-directory
+      is quickly set-up by creating it, linking data files from the
+      <filename>data</filename> directory to it and then start
+      MIRA. Continuing the example from above:
+    </para>
+<screen>
+<prompt>myproject$</prompt> <userinput>cd assemblies</userinput>
+<prompt>myproject/assemblies$</prompt> <userinput>mkdir firstassembly</userinput>
+<prompt>myproject/assemblies$</prompt> <userinput>cd firstassembly</userinput>
+<prompt>myproject/assemblies/firstassembly$</prompt> <userinput>lndir ../../data</userinput>
+<prompt>myproject/assemblies/firstassembly$</prompt> <userinput>mira --project=...</userinput></screen>
+    <para>
+      That strategy keeps things nice and tidy in place and allows for a
+      maximum flexibility while testing out a couple of settings.
+    </para>
+  </sect2>
+  <sect2 id="sect_pb_exsd_pe">
+    <title>PacBio only: Bacterial whole genome, 1Kb "paired-end", 10Kb insert size</title>
+    <para>
+      Set up directories and fetch genome of Bacillus subtilis 168 from GenBank
+    </para>
+    <screen>
+<prompt>$</prompt> <userinput>mkdir bsubdemo1</userinput>
+<prompt>$</prompt> <userinput>cd bsubdemo1</userinput>
+<prompt>bsubdemo1$</prompt> <userinput>mkdir origdata data assemblies</userinput>
+<prompt>bsubdemo1$</prompt> <userinput>cd origdata</userinput>
+<prompt>bsubdemo1/origdata$</prompt> <userinput>wget ftp://ftp.ncbi.nih.gov/genbank/genomes/Bacteria/Bacillus_subtilis/AL009126.fna</userinput>
+<prompt>bsubdemo1/origdata$</prompt> <userinput>ls -l</userinput>
+-rw-r--r-- 1 bach bach 4275918 2010-06-06 00:34 AL009126.fna</screen>
+    <para>
+      After that, we'll prepare the the simulated PacBio data by running a
+      script which creates paired reads like we would expect from a sequencing
+      with PacBio with the following properties: DNA templates have 10k bases
+      or more, we sequence the first 1000 bases in a strobe, let approximately
+      8000 bases pass, then sequence another 1000 bases.
+    </para>
+    <screen>
+<prompt>bsubdemo1/origdata$</prompt> <userinput>cd ../data</userinput>
+<prompt>bsubdemo1/data$</prompt> <userinput>fasta2frag.tcl  -l 1000 -i 230 -p 1 -insert_size 10000 -pairednaming 454 -P 0 -r 2 -infile ../origdata/AL009126.fna -outfile bs168pe1k_10k_in.pacbio.fasta</userinput>
+no ../origdata/AL009126.fna.qual
+fragging gi|225184640|emb|AL009126.3|
+<prompt>bsubdemo1/data$</prompt> <userinput>ls -l</userinput>
+-rw-r--r-- 1 bach bach  38971051 2010-06-06 18:27 bs168pe1k_10k_in.pacbio.fasta
+-rw-r--r-- 1 bach bach   1642208 2010-06-06 18:27 bs168pe1k_10k_in.pacbio.fasta.bambus
+-rw-r--r-- 1 bach bach   1440988 2010-06-06 18:27 bs168pe1k_10k_in.pacbio.fasta.pairs
+-rw-r--r-- 1 bach bach 111214374 2010-06-06 18:27 bs168pe1k_10k_in.pacbio.fasta.qual</screen>
+    <para>
+      The command line given above will create an artificial data set with
+      equally distributed PacBio "paired-end" reads with an average coverage
+      of 8.6 across the genome. Note that the <filename>*.bambus</filename>
+      and <filename>*.pairs</filename> files are not needed for MIRA, but the
+      Tcl script generates these for some other use cases.
+    </para>
+    <para>
+      Next, we move to the assembly directory, make a new one to run a first
+      assembly and link all the needed input files for MIRA into this new
+      directory:
+    </para>
+    <screen>
+<prompt>bsubdemo1/data$</prompt> <userinput>cd ../assemblies</userinput>
+<prompt>bsubdemo1/assemblies$</prompt> <userinput>mkdir firsttest</userinput>
+<prompt>bsubdemo1/assemblies$</prompt> <userinput>cd firsttest</userinput>
+<prompt>bsubdemo1/assemblies/firsttest$</prompt> <userinput>ln -s ../../data/bs168pe1k_10k_in.pacbio.fasta .</userinput>
+<prompt>bsubdemo1/assemblies/firsttest$</prompt> <userinput>ln -s ../../data/bs168pe1k_10k_in.pacbio.fasta.qual .</userinput>
+<prompt>bsubdemo1/assemblies/firsttest$</prompt> <userinput>ls -l</userinput>
+lrwxrwxrwx 1 bach bach 39 2010-06-06 01:01 bs168pe1k_10k_in.pacbio.fasta -> ../../data/bs168pe1k_10k_in.pacbio.fasta
+lrwxrwxrwx 1 bach bach 44 2010-06-06 01:01 bs168pe1k_10k_in.pacbio.fasta.qual -> ../../data/bs168pe1k_10k_in.pacbio.fasta.qual</screen>
+    <para>
+      We're all set up now, just need to start the assembly:
+    </para>
+    <screen>
+<prompt>bsubdemo1/assemblies/firsttest$</prompt> <userinput>mira 
+  --project=bs168pe1k_10k --job=genome,denovo,accurate,pacbio 
+  --notraceinfo -GE:not=4 
+  PACBIO_SETTINGS
+  -GE:tpbd=1:tismin=9000:tismax=11000 -LR:rns=fr 
+  >&log_assembly.txt</userinput></screen>
+    <para>
+      The command above told MIRA
+    </para>
+    <itemizedlist>
+      <listitem>
+	<para>the <emphasis>name</emphasis> (<literal>bs168pe1k_10k</literal>)
+	you chose for your project. MIRA will search input files with this
+	prefix as well as write output files and directories with that prefix.
+	</para>
+      </listitem>
+      <listitem>
+	<para>the <emphasis>assembly job</emphasis> MIRA should perform. In this
+	case a de-novo genome assembly at accurate level with PacBio data.
+	</para>
+      </listitem>
+      <listitem>
+	<para>some additional information that MIRA should not search for
+	additional ancillary information in NCBI TRACEINFO XML files
+	</para>
+      </listitem>
+      <listitem>
+	<para>the <emphasis>number of threads</emphasis> which MIRA should run at most in parallel.
+	</para>
+      </listitem>
+      <listitem>
+	<para>then tell MIRA that the following switches apply to reads in the
+	assembly which are from Pacific Biosciences
+	</para>
+      </listitem>
+      <listitem>
+	<para> both reads of a PacBio read-pair should assemble in the same direction in a contig.. the minimum distance between the outer read ends should be at minimum 9000 bases and at maximum 11000 bases.
+	</para>
+      </listitem>
+      <listitem>
+	<para>the <emphasis>read naming scheme</emphasis> for a PacBio read-pair is "forward/reverse", i.e., the first read has ".f" appended to its name, the second read ".r".
+	</para>
+      </listitem>
+      <listitem>
+	<para>the standard output of MIRA should be <emphasis>redirected</emphasis> to a file name <filename>log_assembly.txt</filename>
+	</para>
+      </listitem>
+    </itemizedlist>
+    <para>
+      Some 12 to 13 minutes later, the data set will be assembled. Though you
+      should note that in real life projects with sequencing errors, MIRA will
+      take perhaps 3 to 4 times longer. Have a look at the information files
+      in directory <filename>bs168pe1k_10k_assembly /
+      bs168pe1k_10k_d_info/</filename>, there especially to the files
+      <filename>bs168pe1k_10k_info_assembly.txt</filename> and
+      <filename>bs168pe1k_10k_info_contigstats.txt</filename> which give a
+      first overview on how the assembly went.
+    </para>
+    <para>
+      In short: this assembly went -- unsurprisingly -- quite well: the
+      complete chromosome of <emphasis>Bacillus subtilis</emphasis> 168 has
+      been reconstructed into one complete contig. There are just two minor
+      flaws disturbing just a little bit. First, a few (twelve) repetitive
+      reads could not be placed and form a second small contig of 2Kb. Second,
+      the reconstructed chromosome contains 4 single-base differences with
+      respect to the original Bsub chromosome. It is an exercise left to the
+      reader to find out that this is due to almost identical rRNA repeats
+      where two almost adjacent elements lie within the expected template
+      insert size of the simulated PacBio Reads and therefore troubled the
+      assembler a bit.
+    </para>
+    <para>
+      Your next stop would then be the directory
+      <filename>bs168pe1k_10k_assembly / bs168pe1k_10k_d_results/</filename>
+      which contains the assembly results in all kind of formats. If a format
+      you need is missing, have a look at <command>convert_project</command>
+      from the MIRA package, it may be that the format you need can be
+      generated with it.
+    </para>
+  </sect2>
+  <sect2 id="sect_pb_exsd_3kstrobes">
+    <title>PacBio only: Bacterial whole genome, 3Kb strobed bases (6Kb with
+    elastic dark inserts)</title>
+
+    <para>
+      Set up directories and fetch genome of Bacillus subtilis 168 from GenBank
+    </para>
+    <screen>
+<prompt>$</prompt> <userinput>mkdir bsubdemo2</userinput>
+<prompt>$</prompt> <userinput>cd bsubdemo2</userinput>
+<prompt>bsubdemo2$</prompt> <userinput>mkdir origdata data assemblies</userinput>
+<prompt>bsubdemo2$</prompt> <userinput>cd origdata</userinput>
+<prompt>bsubdemo2/origdata$</prompt> <userinput>wget ftp://ftp.ncbi.nih.gov/genbank/genomes/Bacteria/Bacillus_subtilis/AL009126.fna</userinput>
+<prompt>bsubdemo2/origdata$</prompt> <userinput>ls -l</userinput>
+-rw-r--r-- 1 bach bach 4275918 2010-06-06 00:34 AL009126.fna</screen>
+    <para>
+      After that, we'll prepare the the simulated PacBio data by running a
+      script which creates strobed reads like we would expect from a sequencing
+      with PacBio with the following properties: DNA templates are 6k bases
+      or more, we sequence the first ~100 bases in a strobe, let approximately
+      100 bases pass, and repeat until we have 3000 bases in strobes.
+    </para>
+    <screen>
+<prompt>bsubdemo2/origdata$</prompt> <userinput>cd ../data</userinput>
+<prompt>bsubdemo2/data$</prompt> <userinput>fasta2frag.tcl -l 3000 -i 150 -r 2 -s 1 -strobeon 100 -strobeoff 100 -infile ../origdata/AL009126.fna -outfile bs168_3ks_100_100_in.pacbio.fasta</userinput>
+no ../origdata/AL009126.fna.qual
+fragging gi|225184640|emb|AL009126.3|
+<prompt>bsubdemo2/data$</prompt> <userinput>ls -l</userinput>
+-rw-r--r-- 1 bach bach 166909136 2010-06-06 19:18 bs168_3ks_100_100_in.pacbio.fasta
+-rw-r--r-- 1 bach bach 416614472 2010-06-06 19:18 bs168_3ks_100_100_in.pacbio.fasta.qual</screen>
+    <para>
+      The command line given above will create an artificial data set with
+      equally distributed PacBio strobed reads with an average coverage of ~20
+      across the genome, of which only half is filled with sequence data so
+      that the "real" coverage is ~10.
+    </para>
+    <para>
+      Next, we move to the assembly directory, make a new one to run a first
+      assembly and link all the needed input files for MIRA into this new
+      directory:
+    </para>
+    <screen>
+<prompt>bsubdemo2/data$</prompt> <userinput>cd ../assemblies</userinput>
+<prompt>bsubdemo2/assemblies$</prompt> <userinput>mkdir firsttest</userinput>
+<prompt>bsubdemo2/assemblies$</prompt> <userinput>cd firsttest</userinput>
+<prompt>bsubdemo2/assemblies/firsttest$</prompt> <userinput>ln -s ../../data/bs168_3ks_100_100_in.pacbio.fasta .</userinput>
+<prompt>bsubdemo2/assemblies/firsttest$</prompt> <userinput>ln -s ../../data/bs168_3ks_100_100_in.pacbio.fasta.qual .</userinput>
+<prompt>bsubdemo2/assemblies/firsttest$</prompt> <userinput>ls -l</userinput>
+lrwxrwxrwx 1 bach bach 39 2010-06-06 01:01 bs168_3ks_100_100_in.pacbio.fasta -> ../../data/bs168_3ks_100_100_in.pacbio.fasta
+lrwxrwxrwx 1 bach bach 44 2010-06-06 01:01 bs168_3ks_100_100_in.pacbio.fasta -> ../../data/bs168_3ks_100_100_in.pacbio.fasta</screen>
+    <para>
+      We're all set up now, just need to start the assembly:
+    </para>
+    <screen>
+<prompt>bsubdemo1/assemblies/firsttest$</prompt> <userinput>mira 
+  --project=bs168_3ks_100_100 --job=genome,denovo,accurate,pacbio 
+  --notraceinfo --noclipping 
+  -GE:not=4 
+  -GO:mr=no
+  PACBIO_SETTINGS 
+  -AL:egp=no
+  >&log_assembly.txt</userinput></screen>
+    <para>
+      The command above told MIRA
+    </para>
+    <itemizedlist>
+      <listitem>
+	<para>the <emphasis>name</emphasis> (<literal>bs168_3ks_100_100</literal>)
+	you chose for your project. MIRA will search input files with this
+	prefix as well as write output files and directories with that prefix.
+	</para>
+      </listitem>
+      <listitem>
+	<para>the <emphasis>assembly job</emphasis> MIRA should perform. In this
+	case a de-novo genome assembly at accurate level with PacBio data.
+	</para>
+      </listitem>
+      <listitem>
+	<para>some additional information that MIRA should not search for
+	additional ancillary information in NCBI TRACEINFO XML files
+	</para>
+      </listitem>
+      <listitem>
+	<para>the <emphasis>number of threads</emphasis> which MIRA should run
+	at most in parallel.
+	</para>
+      </listitem>
+      <listitem>
+	<para>a MIRA parameter called <emphasis>mark repeats</emphasis> should
+	be switched off for PacBio reads. This is absolutely necessary when
+	you have strobed reads with elastic dark inserts as MIRA otherwise
+	gets somewhat confused due to alignment problems shown earlier in this
+	guide.
+	</para>
+      </listitem>
+      <listitem>
+	<para>then tell MIRA that the following switches apply to reads in the
+	assembly which are from Pacific Biosciences
+	</para>
+      </listitem>
+      <listitem>
+	<para>a MIRA parameter called <emphasis>extra gap penalty</emphasis>
+	should be switched off for PacBio reads. This is necessary when you
+	have strobed reads with elastic dark inserts as otherwise alignment
+	problems with larger gaps lead to unnecessary rejection of alignments.
+	</para>
+      </listitem>
+      <listitem>
+	<para>the standard output of MIRA should be
+	<emphasis>redirected</emphasis> to a file name
+	<filename>log_assembly.txt</filename>
+	</para>
+      </listitem>
+    </itemizedlist>
+    <para>
+      Wait for approximately 4.5hrs for MIRA to complete. Using elastic dark
+      inserts is a pretty expensive feature from a computation perspective:
+      all the passes and sub-passes of MIRA to move from an estimated length to
+      an actually correct value means to build and break apart all the contigs
+      and start from anew.
+    </para>
+    <para>
+      Bad news first: looking at the results and info directories, you will
+      see that one single contig with a length of 4199898 bases was
+      created. The original B. subtilis genome we used for this walkthrough is
+      4215426 bases, so it looks like some 15.5Kb are "missing." But, and this
+      is the good news, the contig which was created represents the
+      B. subtilis genome pretty faithfully: a check with MUMMER confirms that
+      no misassemblies respectively re-ordering event of genome elements
+      occurred.
+    </para>
+    <note>
+      <para>
+	The following will need MUMMER3 installed on your system. Fetch it here: 
+	<ulink url="http://mummer.sourceforge.net/"/>
+      </para>
+    </note>
+    <screen>
+<prompt>bsubdemo2/assemblies/firsttest$</prompt> <userinput>cd bs168_3ks_100_100_assembly/bs168_3ks_100_100_d_results</userinput>
+<prompt>../bs168_3ks_100_100_d_results$</prompt> <userinput>ls -l</userinput>
+-rw-r--r-- 1 bach bach 280894715 2010-06-08 04:53 bs168_3ks_100_100_out.ace
+-rw-r--r-- 1 bach bach 776536315 2010-06-08 04:52 bs168_3ks_100_100_out.caf
+-rw-r--r-- 1 bach bach 461365272 2010-06-08 04:52 bs168_3ks_100_100_out.maf
+-rw-r--r-- 1 bach bach   4347658 2010-06-08 04:52 bs168_3ks_100_100_out.padded.fasta
+-rw-r--r-- 1 bach bach  13040564 2010-06-08 04:52 bs168_3ks_100_100_out.padded.fasta.qual
+-rw-r--r-- 1 bach bach 436189259 2010-06-08 04:53 bs168_3ks_100_100_out.tcs
+-rw-r--r-- 1 bach bach   4269919 2010-06-08 04:52 bs168_3ks_100_100_out.unpadded.fasta
+-rw-r--r-- 1 bach bach  12808422 2010-06-08 04:52 bs168_3ks_100_100_out.unpadded.fasta.qual
+-rw-r--r-- 1 bach bach   3203036 2010-06-08 04:53 bs168_3ks_100_100_out.wig
+<prompt>../bs168_3ks_100_100_d_results$</prompt> <userinput>nucmer -maxmatch -c 100 -p nucmer ../../../../origdata/AL009126.fna bs168_3ks_100_100_out.unpadded.fasta</userinput>
+1: PREPARING DATA
+2,3: RUNNING mummer AND CREATING CLUSTERS
+[... some lines left out ...]
+4: FINISHING DATA
+<prompt>../bs168_3ks_100_100_d_results$</prompt> <userinput>delta-filter -q -l 1000 nucmer.delta > nucmer.delta.q</userinput>
+<prompt>../bs168_3ks_100_100_d_results$</prompt> <userinput>show-coords -r -c -l nucmer.delta.q > nucmer.coords</userinput>
+<prompt>../bs168_3ks_100_100_d_results$</prompt> <userinput>cat nucmer.coords</userinput>
+NUCMER
+    [S1]     [E1]  |     [S2]     [E2]  |  [LEN 1]  [LEN 2]  |  [% IDY]  |  [LEN R]  [LEN Q]  |  [COV R]  [COV Q]  | [TAGS]
+===============================================================================================================================
+     181  4215606  |  4199698        1  |  4215426  4199698  |    99.62  |  4215606  4199898  |   100.00   100.00  | gi|225184640|emb|AL009126.3|      bs168_3ks_100_100_c1</screen>
+    <para>
+      As already said: not 100% perfect on a base by base basis, but good
+      enough for a using as reference sequence in subsequent mapping
+      assemblies to get all the bases right.
+    </para>
+  </sect2>
+  <sect2 id="sect_pb_exsd_hybrids">
+    <title>Hybrid assemblies: PacBio plus Sanger/454/Solexa</title>
+    <para>
+      TO BE EXPANDED: no real walkthrough yest, just a few hints.
+    </para>
+    <itemizedlist>
+      <listitem>
+	<para>
+	  Prepare your PacBio data like explained in this guide.
+	</para>
+      </listitem>
+      <listitem>
+	<para>
+	  Prepare your other data (Sanger, 454, Solexa, or any combination of
+	  it) like explained in the respective MIRA guides.
+	</para>
+      </listitem>
+      <listitem>
+	<para>
+	  Start MIRA with, e.g.,
+	  <literal>--job=denovo,genome,accurate,pacbio,solexa</literal> (and
+	  any other parameter you need) for a denovo genome assembly at
+	  accurate level with PacBio and Solexa data.
+	</para>
+      </listitem>
+    </itemizedlist>
+  </sect2>
+  </sect1>
+  <sect1 id="sect_pb_know_bugs">
+    <title>Known bugs in 3.4.0 with PacBio data</title>
+    <para>
+      For error-corrected CLR data, MIRA does not get the average coverage of
+      a project correct: it underestimates it, sometimes by a factor of
+      10. This in turn leads to too many "large" contigs and subsequently to a
+      N50 number which is way off the thruth.
+    </para>
+    <para>
+      Will be fixed asap.
+    </para>
+  </sect1>
+</chapter>
diff --git a/doc/docbook/chap_preface_part.xml b/doc/docbook/chap_preface_part.xml
index 53b7007..1535062 100644
--- a/doc/docbook/chap_preface_part.xml
+++ b/doc/docbook/chap_preface_part.xml
@@ -12,7 +12,7 @@
 <para>
   This "book" is actually the result of an exercise in self-defense. It
   contains texts from several years of help files, mails, postings, questions,
-  answers etc.pp concerning MIRA and assembly projects one can do with it.
+  anwers etc.pp concerning MIRA and assembly projects one can do with it.
 </para>
 <para>
   I never really intended to push MIRA. It started out as a PhD thesis and I
@@ -36,27 +36,20 @@
   somewhat lacking, some texts were re-used almost verbatim.
 </para>
 <para>
-  The last few years have seen tremendous change in the sequencing
-  technologies and MIRA 4 reflects that: core data structures and
-  routines had to be thrown overboard and replaced with faster and/or more
-  versatile versions suited for the broad range of technologies and use-cases
-  I am currently running MIRA with.
-</para>
-<para>
-  Nothing is perfect, and both MIRA and this documentation (even if it is
-  rather pompously called <emphasis>Definitive Guide</emphasis>) are far from
-  it. If you spot an error either in MIRA or this manual, feel free to report
-  it. Or, even better, correct it if you can. At least with the manual files
-  it should be easy: they're basically just some decorated text files.
+  Nothing is perfect, and both MIRA and this documentation are far from it. If
+  you spot an error either in MIRA or the docs, feel free to report it. Or,
+  even better, correct it if you can. At least with the help files it should
+  be easy, they're just text files.
 </para>
 <para>
   I hope that MIRA will be as useful to you as it has been to me. Have a lot
   of fun with it.
 </para>
 <para>
-  Rheinfelden, February 2014
+  Rheinfelden, Summer 2011
 </para>
 <para>
   Bastien Chevreux
 </para>
 </preface>
+
diff --git a/doc/docbook/book_definitiveguide.xml b/doc/docbook/chap_preface_part.xml~
similarity index 52%
copy from doc/docbook/book_definitiveguide.xml
copy to doc/docbook/chap_preface_part.xml~
index b46f378..71e0ca5 100644
--- a/doc/docbook/book_definitiveguide.xml
+++ b/doc/docbook/chap_preface_part.xml~
@@ -3,11 +3,11 @@
 <book>
  
 <bookinfo>
-<title>Sequence assembly with MIRA 4</title>
+<title>Sequence assembly with MIRA3</title>
 <subtitle>
   The Definitive Guide
 </subtitle>
-<titleabbrev>MIRA 4</titleabbrev>
+<titleabbrev>MIRA3</titleabbrev>
 <legalnotice>
 <para>
 This documentation is licensed under the Creative Commons
@@ -20,6 +20,9 @@ Creative Commons, 171 Second Street, Suite 300, San Francisco, California,
 </legalnotice>
 
 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="versionfile"/>
+<releaseinfo>
+  <emphasis role="light">Document revision $Id$</emphasis>
+</releaseinfo>
 
 <author>
   <firstname>Bastien</firstname>
@@ -45,7 +48,10 @@ Creative Commons, 171 Second Street, Suite 300, San Francisco, California,
   <contrib>Draft for section on preprocessing of ESTs in EST manual
   </contrib>
 </othercredit>
-<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="copyrightfile"/>
+<copyright><year>2010</year><holder>Bastien Chevreux</holder></copyright>
+<!--
+<releaseinfo>This book is alpha, MIRA3 is stable :-)</releaseinfo>
+-->
 </bookinfo>
 
 
@@ -54,37 +60,76 @@ Creative Commons, 171 Second Street, Suite 300, San Francisco, California,
 </dedication>
 -->
 
+<preface><title>Preface</title>
+<blockquote>
+  <attribution>Solomon Short</attribution>
+  <para>
+    <emphasis><quote>How much intelligence does one need to sneak upon lettuce?
+    </quote></emphasis>
+  </para>
+</blockquote>
+<para>
+  This "book" is actually the result of an exercise in self-defense. It
+  contains texts from several years of help files, mails, postings, questions,
+  anwers etc.pp concerning MIRA and assembly projects one can do with it.
+</para>
+<para>
+  I never really intended to push MIRA. It started out as a PhD thesis and I
+  subsequently continued development when I needed something to be done which
+  other programs couldn't do at the time. But MIRA has always been available
+  as binary on the Internet since 1999 ... and as Open Source since
+  2007. Somehow, MIRA seems to have caught the attention of more than just a
+  few specialised sequencing labs and over the years I've seen an ever growing
+  number of mails in my inbox and on the MIRA mailing list. Both from people
+  having been "since ever" in the sequencing business as well as from labs or
+  people just getting their feet wet in the area.
+</para>
+<para>
+  The help files -- and through them this book -- sort of reflect this
+  development. Most of the chapters<footnote><para>Avid readers of David
+  Gerrold will certainly recognise the quotes from his books at the beginning
+  of each chapter</para></footnote> contain both very specialised
+  topics as well as step-by-step walk-throughs intended to help people to get
+  their assembly projects going. Some parts of the documentation are written
+  in a decidedly non-scientific way. Please excuse, time for rewriting mails
+  somewhat lacking, some texts were re-used almost verbatim.
+</para>
+<para>
+  Nothing is perfect, and both MIRA and this documentation are far from it. If
+  you spot an error either in MIRA or the docs, feel free to report it. Or,
+  even better, correct it if you can. At least with the help files it should
+  be easy, they're just text files.
+</para>
+<para>
+  I hope that MIRA will be as useful to you as it has been to me. Have a lot
+  of fun with it.
+</para>
+<para>
+  Rheinfelden, Summer 2011
+</para>
+<para>
+  Bastien Chevreux
+</para>
+</preface>
 
 
-<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_preface_part.xml"/>
 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_intro_part.xml"/>
 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_installation_part.xml"/>
 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_reference_part.xml"/>
-<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_dataprep_part.xml"/>
-<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_denovo_part.xml"/>
-<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_mapping_part.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_sanger_part.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_454_part.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_iontor_part.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_solexa_part.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_pacbio_part.xml"/>
 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_est_part.xml"/>
-<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_specialparams_part.xml"/>
 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_results_part.xml"/>
 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_mirautils_part.xml"/>
 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_hard_part.xml"/>
-<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_seqtechdesc_part.xml"/>
 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_seqadvice_part.xml"/>
-<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_bitsandpieces_part.xml"/>
 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_faq_part.xml"/>
 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_maf_part.xml"/>
 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_logfiles_part.xml"/>
-
-<!--
-<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_sanger_part.xml"/>
 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_bonus_part.xml"/>
 
-<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_454_part.xml"/>
-<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_iontor_part.xml"/>
-<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_solexa_part.xml"/>
-<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_pacbio_part.xml"/>
-<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chap_sra_part.xml"/>
-
--->
-
 </book>
+
diff --git a/doc/docbook/chap_reference_part.xml b/doc/docbook/chap_reference_part.xml
index 36a9532..a3b7a80 100644
--- a/doc/docbook/chap_reference_part.xml
+++ b/doc/docbook/chap_reference_part.xml
@@ -3,12 +3,15 @@
 <chapter id="chap_reference">
   <chapterinfo>
     <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="versionfile"/>
+    <releaseinfo>
+      <emphasis role="light">Document revision	$Id$</emphasis>
+    </releaseinfo>
     <author>
       <firstname>Bastien</firstname>
       <surname>Chevreux</surname>
       <email>bach at chevreux.org</email>
     </author>
-    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="copyrightfile"/>
+    <copyright><year>2011</year><holder>Bastien Chevreux</holder></copyright>
   </chapterinfo>
   <blockquote>
     <attribution>Solomon Short</attribution>
@@ -17,91 +20,112 @@
       </quote></emphasis>
     </para>
   </blockquote>
-  <title>MIRA 4 reference manual</title> <subtitle>aka: The extended man page of MIRA 4,
-  a genome and EST/RNASeq sequence assembly and mapping program for Sanger, 454, IonTorrent,
-  PacBio and Illumina/Solexa sequencing data</subtitle>
+  <title>MIRA3 reference</title> <subtitle>aka: The extended man page of MIRA,
+  a genome and EST sequence assembly system for Sanger, 454, IonTorrent,
+  PacBio and Solexa sequencing data</subtitle>
   <sect1 id="sect_ref_synopsis">
     <title>
       Synopsis
     </title>
     <para>
-      <literal>mira <arg>-chmMrtv</arg> <replaceable>manifest-file</replaceable> <arg><replaceable>manifest-file</replaceable> ...</arg></literal>
+      mira 
+      <arg>--project=<name></arg>
+      <arg>--cwd=<directory></arg>
+      <arg>--job=<replaceable>arguments</replaceable></arg><sbr/>
+      <arg>--fasta[=<filename>] | --fastq[=<filename>] | --caf[=<filename>] | --phd[=<filename>]</arg>
+      <arg>--notraceinfo</arg>
+      <!--            \oOpt{-clippinglight $|$ -clippingnormal  $|$ -clippingheavy}-->
+      <arg>--noclipping[=...]</arg>
+      <arg>--highlyrepetitive</arg>
+      <arg>--lowqualitydata</arg>
+      <arg>--highqualitydata</arg>
+      <!--            \oOpt{-borg}-->
+      <arg>--params=<filename></arg>
+      <arg>-GENERAL:<replaceable>arguments</replaceable></arg><sbr/>
+      <arg>-STRAIN/BACKBONE:<replaceable>arguments</replaceable></arg><sbr/>
+      <arg>-ASSEMBLY:<replaceable>arguments</replaceable></arg><sbr/>
+      <arg>-DATAPROCESSING:<replaceable>arguments</replaceable></arg><sbr/>
+      <arg>-CLIPPING:<replaceable>arguments</replaceable></arg><sbr/>
+      <arg>-SKIM:<replaceable>arguments</replaceable></arg><sbr/>
+      <arg>-ALIGN:<replaceable>arguments</replaceable></arg><sbr/>
+      <arg>-CONTIG:<replaceable>arguments</replaceable></arg><sbr/>
+      <arg>-EDIT:<replaceable>arguments</replaceable></arg><sbr/>
+      <arg>-MISC:<replaceable>arguments</replaceable></arg><sbr/>
+      <arg>-DIRECTORY:<replaceable>arguments</replaceable></arg><sbr/>
+      <arg>-FILENAME:<replaceable>arguments</replaceable></arg><sbr/>
+      <arg>-OUTPUT:<replaceable>arguments</replaceable></arg><sbr/>
+      <arg>COMMON_SETTINGS | SANGER_SETTINGS | 454_SETTINGS | IONTOR_SETTINGS | PACBIO_SETTINGS | SOLEXA_SETTINGS</arg>
     </para>
+  </sect1>
+  <sect1 id="sect_ref_important_notes">
+    <title>
+      Important notes
+    </title>
+    <para>
+      For an easy introduction on how to use mira, a number of tutorials with
+      step-by-step instructions are available:
+    </para>
+    <orderedlist>
+      <listitem>
+	<para>
+	  <filename>mira_usage</filename> for basic Sanger assembly
+	</para>
+      </listitem>
+      <listitem>
+	<para>
+	  <filename>mira_454</filename> for basic 454 assembly
+	</para>
+      </listitem>
+      <listitem>
+	<para>
+	  <filename>mira_iontor</filename> for basic Ion Torrent assembly
+	</para>
+      </listitem>
+      <listitem>
+	<para>
+	  <filename>mira_pacbio</filename> for basic assembly of sequences
+	  from Pacific Bioscience
+	</para>
+      </listitem>
+      <listitem>
+	<para>
+	  <filename>mira_solexadev</filename> for basic mapping assembly of Solexa data
+	</para>
+      </listitem>
+      <listitem>
+	<para>
+	  <filename>mira_est</filename> for some advice concerning assembly of EST sequence
+	  (and miraSearchESTSNPs)
+	</para>
+      </listitem>
+      <listitem>
+	<para>
+	  <filename>mira_hard</filename> some notes on how to assemble 'hard'
+	  data sets: EST data sets or genome projects for eukaryotes, but some
+	  prokaryotes also qualify for this
+	</para>
+      </listitem>
+      <listitem>
+	<para>
+	  <filename>mira_faq</filename> with some frequently asked question
+	</para>
+      </listitem>
+    </orderedlist>
     <para>
-      The command line parameters in short:
     </para>
-    <variablelist>
-      <varlistentry>
-	<term>
-	  <arg>-c / --cwd=<replaceable>directory</replaceable></arg>
-	</term>
-	<listitem>
-	  Change working directory.
-	</listitem>
-      </varlistentry>
-      <varlistentry>
-	<term>
-	  <arg>-h / --help</arg>
-	</term>
-	<listitem>
-	  Print a short help and exit.
-	</listitem>
-      </varlistentry>
-      <varlistentry>
-	<term>
-	  <arg>-m / --mcheck</arg>
-	</term>
-	<listitem>
-	  Only check the manifest file, then exit.
-	</listitem>
-      </varlistentry>
-      <varlistentry>
-	<term>
-	  <arg>-M / --mdcheck</arg>
-	</term>
-	<listitem>
-	  Only check the manifest file and presence of data files, then exit.
-	</listitem>
-      </varlistentry>
-      <varlistentry>
-	<term>
-	  <arg>-r / --resume</arg>
-	</term>
-	<listitem>
-	  Resume / restart an interrupted assembly. Works only for de-novo
-	  assemblies at the moment.
-	</listitem>
-      </varlistentry>
-      <varlistentry>
-	<term>
-	  <arg>-t / --thread=<replaceable>integer ≥ 0</replaceable></arg>
-	</term>
-	<listitem>
-	  Force number of threads (overrides equivalent <arg>-GE:not</arg>
-          manifest entry).
-	</listitem>
-      </varlistentry>
-      <varlistentry>
-	<term>
-	  <arg>-v / --version</arg>
-	</term>
-	<listitem>
-	  Print version and exit.
-	</listitem>
-      </varlistentry>
-    </variablelist>
   </sect1>
   <sect1 id="sect_ref_requirements">
     <title>
       Requirements
     </title>
     <para>
-      To use MIRA itself, one doesn't need very much:
+      To use mira itself, one doesn't need very much:
     </para>
     <itemizedlist>
       <listitem>
 	<para>
-	  Sequence data in EXP, CAF, PHD, FASTA or FASTQ format
+	  Sequence data in EXP, CAF, PHD, FASTA or FASTQ format (ideally
+	  preprocessed)
 	</para>
       </listitem>
       <listitem>
@@ -115,7 +139,7 @@
       <listitem>
 	<para>
 	  Some memory and disk space. Actually lots of both if you are
-	  venturing into 454 or Illumina.
+	  venturing into 454 or Solexa.
 	</para>
       </listitem>
     </itemizedlist>
@@ -127,7 +151,7 @@
       Working modes
     </title>
     <para>
-      MIRA has three basic working modes: genome, EST/RNASeq or
+      mira has three basic working modes: genome, EST or
       EST-reconstruction-and-SNP-detection. From version 2.4 on, there is
       only executable which supports all modes. The name with which this
       executable is called defines the working mode:
@@ -148,7 +172,7 @@
 	  different strains (or organisms) and SNP detection within this
 	  assembly. This is the former <command>miraEST</command> program
 	  which was renamed as many people got confused regarding whether to
-	  use MIRA in est mode or miraEST.
+	  use mira in est mode or miraEST.
 	</para>
       </listitem>
     </orderedlist>
@@ -158,1139 +182,487 @@
       decides by the name it was called with which module to start.
     </para>
   </sect1>
-  <sect1 id="sect_ref_config">
+  <sect1 id="sect_ref_parameters">
     <title>
-      Configuring an assembly: files and parameters
+      Parameters
     </title>
     <para>
-      All the configuration needed for an assembly is done in one (or several)
-      configuration file(s): the <emphasis>manifest</emphasis> files. This
-      encompasses things like what kind of assembly you want to perform
-      (genome or EST / RNASeq, mapping or de-novo etc.pp) or which data files
-      contain the sequences you want to assemble (and in which format these
-      are).
+      Parameters can be given on the command line or loaded via parameter
+      files. 
     </para>
-    <sect2 id="sect_ref_manifest_introduction">
-      <title>
-	The manifest file: introduction
-      </title>
-      <para>
-	A <emphasis>manifest</emphasis> file can be seen as a two part
-	configuration file for an assembly: the first part contains some
-	general information while the second part contains information about
-	the sequencing data to be loaded. Examples being always easier to
-	follow than long texts, here's an example for a de-novo assembly with
-	single-end (also called shotgun) 454 data:
-      </para>
-<screen># Example for a manifest describing a simple 454 de-novo assembly
-
-# A manifest file can contain comment lines, these start with the #-character
-
-# First part: defining some basic things
-# In this example, we just give a name to the assembly
-#  and tell MIRA it should assemble a genome de-novo in accurate mode
-# As special parameter, we want to use 4 threads in parallel (where possible)
-
-<userinput>
-project = <replaceable>MyFirstAssembly</replaceable>
-job = <replaceable>genome,denovo,accurate</replaceable>
-parameters = <replaceable>-GE:not=4</replaceable></userinput>
-
-# The second part defines the sequencing data MIRA should load and assemble
-# The data is logically divided into "readgroups": this reflects the
-#  ... that read sequences ...
-
-<userinput>readgroup = <replaceable>SomeUnpaired454ReadsIGotFromTheLab</replaceable>
-data = <replaceable>TCMFS456ZH345.fastq TQF92GT7H34.fastq</replaceable>
-technology = <replaceable>454</replaceable></userinput></screen>
-      <para>
-	To make things a bit more interesting, here's an example using a
-	couple more technologies and showing some more options of the manifest
-	file like wild cards in file names, different paired-end/mate-pair
-	libraries and how to let MIRA refine pairing information (or even find
-	out everything by itself):
-      </para>
-<screen># Example for a manifest describing a de-novo assembly with
-# unpaired 454, paired-end Illumina, a mate-pair Illumina
-# and a paired Ion Torrent
-
-# First part: defining some basic things
-# In this example, we just give a name to the assembly
-#  and tell MIRA it should assemble a genome de-novo in accurate mode
-# As special parameter, we want to use 4 passes with kmer sizes of
-# 17, 31, 63 and 127 nucleotides. Obviously, read lengths of the
-# libraries should be greater than 127 bp.
-# Note: usually MIRA will choose sensible options for number of
-#  passes and kmer sizes to be used by itself.
-
-<userinput>project = <replaceable>MyFirstAssembly</replaceable>
-job = <replaceable>genome,denovo,accurate</replaceable>
-parameters = <replaceable>-AS:kms=17,31,63,127</replaceable></userinput>
-
-# The second part defines the sequencing data MIRA should load and assemble
-# The data is logically divided into "readgroups": this reflects the
-#  ... that read sequences ...
-
-# defining the shotgun (i.e. unpaired) 454 reads
-<userinput>readgroup = <replaceable>SomeUnpaired454ReadsIGotFromTheLab</replaceable>
-data = <replaceable>TCMFS456ZH345.fastq TQF92GT7H34.fastq</replaceable>
-technology = <replaceable>454</replaceable></userinput>
-
-# defining the paired-end Illumina reads, fixing all needed pair information
-<userinput>readgroup = <replaceable>SomePairedEndIlluminaReadsIGotFromTheLab</replaceable>
-data = <replaceable>datape*.fastq</replaceable>
-technology = <replaceable>solexa</replaceable>
-template_size = <replaceable>100 300</replaceable>
-segment_placement = <replaceable>---> <---</replaceable>
-segment_naming = <replaceable>solexa</replaceable></userinput>
-
-# defining the mate-pair Illumina reads, fixing most needed pair information
-#  but letting MIRA refine the template_size via "autorefine"
-<userinput>readgroup = <replaceable>SomeMatePairIlluminaReadsIGotFromTheLab</replaceable>
-data = <replaceable>datamp*.fastq</replaceable>
-technology = <replaceable>solexa</replaceable>
-template_size = <replaceable>2000 4000 autorefine</replaceable>
-segment_placement = <replaceable><--- ---></replaceable>
-segment_naming = <replaceable>solexa</replaceable></userinput>
-
-# defining paired Ion Torrent reads
-# example to show how lazy one can be and simply let MIRA estimate by itself
-#  all needed pairing information via "autopairing"
-#  Hint: it usually does a better job at it than we do ;-)
-<userinput>readgroup = <replaceable>SomePairedIonReadsIGotFromTheLab</replaceable>
-<replaceable>autopairing</replaceable>
-data = <replaceable>dataion*.fastq</replaceable>
-technology = <replaceable>iontor</replaceable></userinput></screen>
-    </sect2>
-    <sect2 id="sect_ref_manifest_basics">
+    <sect2 id="sect_ref_overview">
       <title>
-	The manifest file: basics
+	Overview
       </title>
       <para>
-	The first part of an assembly <emphasis>manifest</emphasis> contains
-	the very basic information the assembler needs to have to know what
-	you want it to do. This part consists of exactly three entries:
+	mira knows two basic parameter types: quick switches and extensive
+	switches.
       </para>
       <orderedlist>
 	<listitem>
 	  <para>
-	    <emphasis role="bold">project =</emphasis><arg>=
-	    <replaceable>project name</replaceable></arg> tells the assembler
-	    the name you wish to give to the whole assembly project. MIRA will
-	    use that name throughout the whole assembly for naming
-	    directories, files and a couple of other things.
-	  </para>
-	  <para>
-	    You can name the assembly anyway you want, you should however
-	    restrain yourself and use only alphanumeric characters and perhaps
-	    the characters plus, minus and underscore. Using slashes or
-	    backslashes here is a recipe for catastrophe.
+	    <emphasis role="bold">quick switches</emphasis>, also dubbed DWIM
+	    switches (for
+	    '<emphasis role="bold">D</emphasis>o-<emphasis role="bold">W</emphasis>hat-<emphasis role="bold">I</emphasis>-<emphasis role="bold">M</emphasis>ean'),
+	    are easy to use-and-combine switches activating parameter
+	    collections for predefined tasks that will suit most people's
+	    needs.
 	  </para>
 	</listitem>
 	<listitem>
 	  <para>
-	    <emphasis role="bold">job =</emphasis>
-	    <arg><replaceable>denovo|mapping</replaceable></arg>,
-	    <arg><replaceable>genome|est|fragments</replaceable></arg>,
-	    <arg><replaceable>draft|accurate</replaceable></arg> tells the
-	    assembler what kind of data it should expect and how it should
-	    assemble it.
+	    <emphasis role="bold">extensive switches</emphasis> offer a way to
+	    set about any possible parameter to configure mira for any kind of
+	    special need. While the format of extensive switches might look a
+	    little bit strange, it is borrowed from the SGI C compiler options
+	    and allows both compact command lines as well as readable and / or
+	    script generated parameter files.
 	  </para>
+	</listitem>
+      </orderedlist>
+      <para>
+      </para>
+      <para>
+	Due to the introduction of new sequencing technologies like 454,
+	Solexa and ABI SOLiD, the extensive switches had to be split into two
+	groups:
+      </para>
+      <orderedlist>
+	<listitem>
 	  <para>
-	  You need to make your choice mainly in three steps and in the end
-	  concatenate your choices to the <arg>job=</arg> entry of the manifest:
-	  </para>
-	  <orderedlist>
-	    <listitem>
-	      <para>
-		are you building an assembly from scratch
-		(choose: <emphasis>denovo</emphasis>) or are you mapping reads
-		to an existing backbone sequence
-		(choose: <emphasis>mapping</emphasis>)?  Pick one. Leaving this
-		out automatically chooses <emphasis>denovo</emphasis> as
-		default.
-	      </para>
-	    </listitem>
-	    <listitem>
-	      <para>
-		are the data you are assembling forming a larger contiguous
-		sequence (choose: <emphasis>genome</emphasis>) or are you
-		assembling small fragments like in EST or mRNA libraries
-		(choose: <emphasis>est</emphasis>)? Pick one. Leaving this out
-		automatically chooses <emphasis>genome</emphasis> as default.
-	      </para>
-	      <para>
-		Since version 4.9.4, a new mode <emphasis>fragments</emphasis>
-		is available. This mode is essentially similar to the
-		<emphasis>EST</emphasis> mode, but has all safety features
-		switched off which reduce data sizes. Use this mode for
-		assembly of comparatively small EST/mRNA projects where you
-		want to have highest accuracy and minimal filtering. Warning:
-		contigs with coverages going into the 1000s will lead to
-		really slow assemblies.
-	      </para>
-	    </listitem>
-	    <listitem>
-	      <para>
-		do you want a quick and dirty assembly for first insights
-		(choose: <emphasis>draft</emphasis>) or an assembly that should
-		be able to tackle even most nasty cases (choose:
-		<emphasis>accurate</emphasis>)? Pick one. Leaving this out
-		automatically chooses <emphasis>accurate</emphasis> as default.
-	      </para>
-	    </listitem>
-	  </orderedlist>
-	  <para>
-	    Once you're done with your choices, concatenate everything with
-	    commas and you're done. E.g.:
-	    '<literal>--job=mapping,genome,draft</literal>' will give you a
-	    mapping assembly of a genome in draft quality.
+	    <emphasis role="bold">technology independent switches</emphasis>
+	    which control general behaviour of MIRA like, e.g., the number of
+	    assembly passes or file names etc.
 	  </para>
-	  <note>
-	    For de-novo assembly of genomes, these switches are optimised for
-	    'decent' coverages that are commonly seen to get you something useful,
-	    i.e., ≥ 7x for Sanger, >=18x for 454 FLX or Titanium, ≥ 25x for
-	    454 GS20 and ≥ 30x for Solexa. Should you venture into lower
-	    coverage or extremely high coverage (say, >=60x for 454), you will
-	    need to adapt a few parameters via extensive switches.
-	  </note>
 	</listitem>
 	<listitem>
 	  <para>
-	    <emphasis role="bold">parameters =</emphasis> is used in case you
-	    want to change one of the 150+ extended parameters MIRA has to
-	    offer to control almost every aspect of an assembly. This is
-	    described in more detail in a separate section below.
+	    <emphasis role="bold">technology dependent switches</emphasis>
+	    which control behaviour of algorithms where the sequencing
+	    technology plays a role. Example for this would be the minimum
+	    length of a read (like 200 for Sanger reads and 120 for 454 FLX
+	    reads).
 	  </para>
 	</listitem>
       </orderedlist>
+      <para>
+      </para>
+      <para>
+	More on this a bit further down in this documentation.
+      </para>
+      <para>
+	As example, a typical call of <command>mira</command> using quick
+	switches and some tweaking with extended switches on the command line
+	could look like this:
+      </para>
+      <screen>
+<userinput>mira --job=denovo,genome,draft,sanger --fasta 
+  SANGER_SETTINGS
+   -ALIGN:min_relative_score=70
+   -GENERAL:use_template_information=yes
+   -GENERAL:templateinsertsizeminimum=500:templateinsertsizemaximum=2500</userinput></screen>
+      <para>
+	or in short form
+      </para>
+      <screen>
+<userinput>mira --job=denovo,genome,draft,sanger --fasta 
+  SANGER_SETTINGS
+   -AL:mrs=70
+   -GE:uti=yes:tismin=500:tismax=2500</userinput></screen>
+      <para>
+	Please note that it is also perfectly legal to decompose the switches
+	so that they can be used more easily in scripted environments (notice
+	the multiple -GE in the following example):
+      </para>
+      <screen>
+<userinput>mira --job=denovo,genome,draft,sanger --fasta 
+  SANGER_SETTINGS 
+   -AL:mrs=70 
+   -GE:uti=yes
+   -GE:tismin=500
+   -GE:tismax=2500</userinput></screen>
     </sect2>
-    <sect2 id="sect_ref_manifest_readgroups">
+    <sect2 id="sect_ref_quick_switches">
       <title>
-	The manifest file: information on the data you have
+	Quick switches
       </title>
       <para>
-	The second part of an assembly <emphasis>manifest</emphasis> tells
-	MIRA which files it needs to load, which sequencing technology
-	generated the data, whether there are DNA template constraints it can
-	use during the assembly process and a couple of other things.
+	These switches are
+	'<emphasis role="bold">D</emphasis>o-<emphasis role="bold">W</emphasis>hat-<emphasis role="bold">I</emphasis>-<emphasis role="bold">M</emphasis>ean'
+	parameter collections for predefined tasks which should suit most
+	people's needs. You might still need a few of the extensive switches,
+	but not too many anymore.
       </para>
-      <sect3 id="sect_ref_manifest_readgroups_readgroup">
-      <title>
-	Starting a new readgroup
-      </title>
-	<para>
-	  <emphasis role="bold">readgroup </emphasis><arg>= <replaceable>group name</replaceable></arg> is the keyword which tells MIRA that you are going to define a new read group. You can optionally name that group.
-	</para>
-	<sidebar id="sidebar_ref_manifest_readgroups_templates_and_readgroups">
-	  <title>
-	    Understanding readgroups and DNA templates
-	  </title>
-	  <para>
-	    When you send away your DNA for sequencing, it is going to be
-	    prepared for sequencing according to your wishes. Sequencing
-	    providers call this "constructing a library" and regardless
-	    whether you sequence with Sanger, 454, Illumina, Ion Torrent,
-	    Pacific Biosciences or other technologies, the "library prep" is
-	    always there.
-	  </para>
-	  <para>
-	    With most library preps, your DNA is first amplified and then
-	    cut into small pieces. These pieces are called
-	    <emphasis>templates</emphasis> and their length can be anywhere
-	    between a few dozen bases, a few hundred bases or even a couple
-	    of dozen or even hundred kilobases. The important thing is that
-	    these templates can be much bigger in size than the actual read
-	    length. While this is a wet lab step, protocols and providers
-	    have gotten pretty good at constructing libraries where the DNA
-	    templates are all in a given range of bases like, e.g., having a
-	    library with template size 500bp (+/- 100bp) and another library
-	    with template size around 7kb (+/- 500bp).
-	  </para>
-	  <para>
-	    Depending on the technology and sequencing strategy used, the
-	    DNA templates are used to create either one single read or - and
-	    that's important - two or more reads.
-	  </para>
-	  <para>
-	    Libraries with "single reads" are often called "single read
-	    libraries" or "shotgun libraries". They can be found for every
-	    sequencing technology and are most of the time easy to construct
-	    (therefore cheap) and are often used to provide a decent amount
-	    of bases as basic coverage for your project.
-	  </para>
-	  <para>
-	    Libraries with two reads per DNA template are often called
-	    "mate-pair" or "paired-end" libraries. They are harder to
-	    construct and sometime have less yield, therefore they are often
-	    more expensive. But the sequencing approach using several reads
-	    per DNA template allows assembly and scaffolding algorithms to
-	    resolve repetitive regions of a genome which are longer than the
-	    average read length. Note that Pacific Biosciences has a
-	    sequencing mode called "strobed sequencing" which is different
-	    from "paired-end/mate-pair" but also creates multiple reads per
-	    DNA template.
-	  </para>
-	  <para>
-	    Long story short: an assembler must know afterwards what kind of
-	    reads it has to expect: the sequencing technology, library
-	    preparation strategy etc. For this, the notion of <emphasis>read
-	    groups</emphasis> has emerged: reads coming from the same
-	    technology and same library preparation are pooled together in a
-	    read group to tell the assembler: in the assembly, if you see two
-	    reads coming from a same DNA template, you should expect them to
-	    be at a certain distance from each other and they should be
-	    oriented in a certain way.
-	  </para>
-	  <note>
-	    The above was a <emphasis role="bold">very</emphasis> simplified
-	    view on the whole area of DNA templates, readgroups, shotgun and
-	    paired end sequencing. Enough to hopefully understand the
-	    concepts, but you might want to read more about it.
-	  </note>
-	</sidebar>
-      </sect3>
-      <sect3 id="sect_ref_manifest_readgroups_data">
-      <title>
-	Defining data files to load
-      </title>
-	<para>
-	  <emphasis role="bold">data</emphasis> = <replaceable>filepath
-	  <arg>filepath ...</arg></replaceable> defines the file paths from
-	  which sequences should be loaded. A file path can contain just the
-	  name of one (or several) files or it can contain the
-	  <emphasis>path</emphasis>, i.e., the directory (absolute or
-	  relative) including the file name.
-	</para>
-	<para>
-	  MIRA automatically recognises what type the sequence data is by
-	  looking at the postfix of files. For postfixes not adhering widely
-	  used naming schemes for file types, there's additionally a way of
-	  explicitly defining the type (see further down at the end of this
-	  item on how this is done). Currently allowed file types are:
-	</para>
-	<itemizedlist>
-	  <listitem>
-	    <para>
-	      <filename>.fasta</filename> for sequences formatted in FASTA
-	      format where there exists an additional
-	      <filename>.fasta.qual</filename> file which contains quality
-	      data. If the file with quality data is missing, this is
-	      interpreted as error and MIRA will abort.
-	    </para>
-	  </listitem>
-	  <listitem>
-	    <para>
-	      <filename>.fna</filename> and <filename>.fa</filename> also
-	      for sequences formatted in FASTA format. The difference
-	      to <filename>.fasta</filename> lies in the way MIRA treats a
-	      missing quality file (called
-	      <filename>.fna.qual</filename>
-	      or <filename>.fa.qual</filename>): it does not see that as
-	      critical error and continues.
-	    </para>
-	  </listitem>
-	  <listitem>
-	    <para>
-	      <filename>.fastq</filename> or <filename>.fq</filename> for files in FASTQ format
-	    </para>
-	  </listitem>
-	  <listitem>
-	    <para>
-	      <filename>.gff3</filename> or <filename>.gff</filename> for files in GFF3 format. Note that
-	      MIRA will load all sequences and annotations contained in this
-	      file.
-	    </para>
-	  </listitem>
-	  <listitem>
-	    <para>
-	      <filename>.gbk</filename>, <filename>.gbf</filename>, <filename>.gbff</filename>
-	      or <filename>.gb</filename> for files formatted in GenBank
-	      format. Note that the MIRA GenBank loader does not understand
-	      intron/exon or other multiple-locus structures in this format,
-	      use GFF3 instead!
-	    </para>
-	  </listitem>
-	  <listitem>
-	    <para>
-	      <filename>.caf</filename> for files in the CAF format (from Sanger Centre)
-	    </para>
-	  </listitem>
-	  <listitem>
-	    <para>
-	      <filename>.maf</filename> for files in the MIRA MAF format
-	    </para>
-	  </listitem>
-	  <listitem>
-	    <para>
-	      <filename>.exp</filename> for files in the Staden EXP format.
-	    </para>
-	  </listitem>
-	  <listitem>
-	    <para>
-	      <filename>.fofnexp</filename> for a <emphasis>file of EXP
-	      filenames</emphasis> which all point to files in the Staden EXP
-	      format.
-	    </para>
-	  </listitem>
-	  <listitem>
-	    <para>
-	      <filename>.xml</filename>, <filename>.ssaha2</filename> and <filename>.smalt</filename> for ancillary data in NCBI TRACEINFO, SSAHA2 or SMALT format respectively.
-	    </para>
-	  </listitem>
-	</itemizedlist>
-	<para>
-	  Multiple 'data' lines and multiple entries per line (even
-	  different formats) are allowed, as in, e.g.,
-	</para>
-	<screen>data = file1.fastq file2.fastq file3.fasta file4.gbk
-data = myscreenings.smalt</screen>
-	<para>
-	  You can also use wildcards and/or directory names. E.g., loading
-	  all file types MIRA understand from a given directory
-	  <filename>mydir</filename>:
-	</para>
-	<screen>data = mydir</screen>
-	<para>
-	  or loading all files starting with <filename>mydata</filename> and
-	  ending with <filename>fastq</filename>:
-	</para>
-	<screen>data = mydata*fastq</screen>
-	<para>
-	  or loading all files in directory <filename>mydir</filename>
-	  starting with <filename>mydata</filename> and ending with
-	  <filename>fastq</filename>:
-	</para>
-	<screen>data = mydir/mydata*fastq</screen>
-	<para>
-	  or loading all FASTQ files in all directories starting with <filename>mydir</filename>:
-	</para>
-	<screen>data = mydir*/*fastq</screen>
-	<para>
-	  or ... well, you get the gist.
-	</para>
-	<note>
-	  Giving a directory like in <filename>mydir</filename> is
-	  equivalent to <filename>mydir/*</filename> (saying: give me all
-	  files in the directory <filename>mydir</filename>), however the
-	  first version should be preferred when the directory contains
-	  thousands of files.
-	</note>
-	<note>
-	  <para>
-	    GenBank and GFF3 files may or may not contain embedded sequences. If
-	    annotations are present in these files for which no sequence is
-	    present in the same file, MIRA will look for reads of the same
-	    name which it already loaded in this or previously defined read
-	    groups and add the annotations there.
-	  </para>
-	  <para>
-	    As security measure, annotations in GenBank and GFF3 files for which
-	    absolutely no sequence or read has been defined are treated as
-	    error.
-	  </para>
-	</note>
-	<para>
-	  <emphasis>Explicit definition of file types.</emphasis> It is
-	  possible to explicitly tell MIRA the type of a file even if said
-	  file does not have a 'standard' naming scheme. For this, the
-	  EMBOSS double-colon notation has been adapted to work also for
-	  MIRA, i.e., you prepend the type of a file and separate it from
-	  the file name by a double colon. E.g.,
-	  the <filename>.dat</filename> postfix is not anything MIRA will
-	  recognise, but you can define it should be loaded as FASTQ file
-	  like this:
-	</para>
-	<screen>data = fastq::myfile.dat</screen>
-	<para>
-	  Another frequent usage is forcing MIRA to load FASTA files
-	  named <filename>.fasta</filename> without complaining in case
-	  quality files (which MIRA wants you to provide) are not present:
-	</para>
-	<screen>data = fna::myfile.fasta</screen>
-	<para>
-	  This does (of course) work also with directories or wildcard
-	  characters. In the following example, the first line will load all
-	  files from <filename>mydirectory</filename> as FASTQ while the
-	  second line loads just <filename>.dat</filename> files in a given
-	  path as FASTA:
-	</para>
-	<screen>data = fastq::mydirectory
-data = fasta::/path/to/somewhere/*.dat</screen>
-	<para>
-	  It is entirely possible (although not really sensible), to give
-	  contradicting information to MIRA by using a different explicit
-	  file type than one would guess from the standard postfix. In this
-	  case, the explicit type takes precedence over the automatic
-	  type. E.g.: to force MIRA to load a file as FASTA although it is
-	  named <filename>.fastq</filename>, one could use this:
-	</para>
-	<screen>data = fasta::file.fastq</screen>
-	<para>
-	  Note that the above does not make any kind of file conversion,
-	  <filename>file.fastq</filename> needs to be already in FASTA
-	  format or else MIRA will fail loading that data.
-	</para>
-      </sect3>
-      <sect3 id="sect_ref_manifest_readgroups_defaultqual">
-      <title>
-	Setting default quality
-      </title>
+      <para>
+	<emphasis role="bold">Important note 1:</emphasis> For de-novo
+	assembly of genomes, these switches are optimised for 'decent'
+	coverages that are commonly seen to get you something useful, i.e.,
+	≥ 7x for Sanger, >=18x for 454 FLX or Titanium, ≥ 25x for 454
+	GS20 and ≥ 30x for Solexa. Should you venture into lower coverage
+	or extremely high coverage (say, >=60x for 454), you will need to
+	adapt a few parameters via extensive switches.
+      </para>
+      <para>
+	<emphasis role="bold">Important note 2:</emphasis> For some switches,
+	the order of appearance in the command line (or parameter file) is
+	important. This is because the quick switches are realised internally
+	as a collection of extensive switches that will overwrite any
+	previously manually set extensive switch. It is generally a good idea
+	to place switches in the order as described in this documentation,
+	that is: first the order dependent quick switches, then other quick
+	switches, then all the other extensive switches.
+      </para>
+      <warning>
 	<para>
-	  <emphasis role="bold">default_qual</emphasis>=
-	  <replaceable>quality_value</replaceable> is meant to be used as
-	  default fall-back quality value for sequences where the data files
-	  given above do not contain quality values. E.g., GFF3 or GenBank
-	  formats, eventually also FASTA files where quality data files is
-	  missing.
+	  E.g. always write <literal>--job=...  --highlyrepetitive</literal>
+	  and not <literal>--highlyrepetitive --job=...</literal>. In the same
+	  vein, always write <literal>--job=... -SK:mnr=yes</literal> and
+	  not <literal>-SK:mnr=yes --job=...</literal>.
 	</para>
-      </sect3>
-      <sect3 id="sect_ref_manifest_readgroups_technology">
+      </warning>
+      <sect3 id="sect_ref_order_dependent_quick_switches">
 	<title>
-	  Defining technology used to sequence
+	  Order dependent quick switches
 	</title>
 	<para>
-	  <emphasis role="bold">technology</emphasis>=
-	  <replaceable>technology</replaceable> which names the technology
-	  with which the sequences were produced. Allowed technologies are:
-	  <emphasis>sanger, 454, solexa, iontor, pcbiolq, pcbiohq,
-	  text</emphasis>.
-	</para>
-	<para>
-	  The <emphasis>text</emphasis> technology is not a technology per
-	  se, but should be used for sequences which are not coming from
-	  sequencing machines like, e.g., database entries, consensus
-	  sequences, artificial reads (which do not comply to normal
-	  behaviour of 'normal' sequencing data), etc.pp
 	</para>
-      </sect3>
-      <sect3 id="sect_ref_manifest_readgroups_nostatistics">
+	<variablelist>
+	  <varlistentry>
+	    <term>
+	      <arg>--job=</arg>
+	    </term>
+	    <listitem>
+	      <para>
+		The main one-stop-switches for most assemblies. You can choose
+		between two different assembly methods
+		(<emphasis>denovo</emphasis> or <emphasis>mapping</emphasis>),
+		two different assembly types (<emphasis>genome</emphasis> or
+		<emphasis>est</emphasis>), two different quality grades
+		(<emphasis>draft</emphasis> or <emphasis>accurate</emphasis>)
+		and mix different sequencing technologies
+		(<emphasis>sanger</emphasis>, <emphasis>454</emphasis>,
+		<emphasis>iontor</emphasis>,
+		<emphasis>solexa</emphasis>). This switch is explained in more
+		detail in the subsection "The --job= switch in detail".
+		<!--%\item[\oOpt{-clippinglight $|$ -clippingmedium $|$ -clippingheavy}] Three-->
+		<!--%  clipping grade modifiers, from \emph{light} clipping when working with well-->
+		<!--%  preprocessed sequences to \emph{heavy} clipping when the sequences that are-->
+		<!--%  being assembled had only sloppy or no preprocessing.\\-->
+		<!--%  Note 1: the \emph{light} version is already included in the-->
+		<!--%  \oOpt{-genome...} and \oOpt{-mapping...} switches.\\-->
+		<!--%  Note 2: it is recommended to perform a thorough preprocessing (clipping-->
+		<!--%  sequencing vector stretches, clipping of low quality bases, tagging standard-->
+		<!--%  repeats etc.)  before assembling sequences. The clipping routines of-->
+		<!--%  \Prog{mira} are more optimised to cope with last remnants of wrongly-->
+		<!--%  preprocessed sequences than with sequences having had no pre-processing at-->
+		<!--%  all.-->
+	      </para>
+	    </listitem>
+	  </varlistentry>
+	  <varlistentry>
+	    <term>
+	      <arg>-highlyrepetitive</arg>
+	    </term>
+	    <listitem>
+	      <para> A modifier switch for genome data that is
+	      deemed to be highly repetitive. The assemblies will run slower due to more
+	      iterative cycles that give mira a chance to resolve nasty repeats.
+	      <!--%\item[\oOpt{-lowqualitydata}] A modifier switch when the sequences that are-->
+	      <!--%  used are of low quality. \Prog{mira} will then change some settings that-->
+	      <!--%  tell the repeat finder to be a bit more lenient towards possible sequencing-->
+	      <!--%  errors.-->
+	      <!--%\item[\oOpt{-highqualitydata}] A modifier switch when the sequences that are-->
+	      <!--%  used are of exceptional quality. \Prog{mira} will then bump up a few quality-->
+	      <!--%  parameters which should lead to less false positives in the repeat and SNP-->
+	      <!--%  detection routines.-->
+	      </para>
+	    </listitem>
+	  </varlistentry>
+	  <varlistentry>
+	    <term>
+	      <arg>--noclipping=...</arg>
+	    </term>
+	    <listitem>
+	      <para> Switches off clipping options for given sequencing
+	      technologies. Technologies can be <emphasis>sanger</emphasis>,
+	      <emphasis>454</emphasis>, <emphasis>iontor</emphasis>,
+	      <emphasis>solexa</emphasis> or
+	      <emphasis>solid</emphasis>. Multiple entries separated by comma.
+	      </para>
+	      <para> Note that <arg>-CL:pec</arg> and the chimera clipping
+	      <arg>-CL:ascdc</arg> are not switched off by this parameter and
+	      should be switched off separately.
+	      </para>
+	      <para> Examples:
+	      </para>
+	      <orderedlist>
+		<listitem>
+		  <para>
+		    Switch off 454 and Solexa (but keep eventually keep Sanger
+		    clipping): <literal>--noclipping=454,solexa</literal>
+		  </para>
+		</listitem>
+		<listitem>
+		  <para>
+		    Switch off all: <literal>--noclipping</literal>
+		    or <literal>--noclipping=all</literal>
+		  </para>
+		</listitem>
+	      </orderedlist>
+	    </listitem>
+	  </varlistentry>
+	  <varlistentry>
+	    <term>
+	      <arg>--notraceinfo</arg>
+	    </term>
+	    <listitem>
+	      <para> Switches off loading TRACEINFO ancillary data in XML
+	      files for <emphasis role="bold">all</emphasis>
+	      technologies. Place it after <arg>--fasta</arg> and/or
+	      <arg>--job=</arg> quick switches.
+	      </para>
+	    </listitem>
+	  </varlistentry>
+	  <varlistentry>
+	    <term>
+	      <arg>--params|--parameterfile=<filename></arg>
+	    </term>
+	    <listitem>
+	      <para> Loads parameters from the filename given. Allows a
+	      maximum of 10 levels of recursion, i.e. a --params option
+	      appearing within a file that loads other parameter files (though
+	      I cannot think of useful applications with more than 3 levels).
+	      </para>
+	    </listitem>
+	  </varlistentry>
+	  <varlistentry>
+	    <term>
+	      <arg>--cwd=<directory></arg>
+	    </term>
+	    <listitem>
+	      <para> 
+		When encountered during parameter parsing, MIRA will change
+		the working directory immediately to the directory given and
+		read and write files there.
+	      </para>
+	      <para>
+		Therefore, a call like <literal>mira -DI:cwd=/somedir
+		--params=myparameters.txt</literal> will be enough to let MIRA
+		change to the directory <filename>/somedir</filename> and then read
+		further parameters from a text file
+		<filename>myparamaters.txt</filename> (which should be present there)
+		and at the same time have all the input and output of the
+		assembly occuring in firectory <filename>/somedir</filename>.
+	      </para>
+	    </listitem>
+	  </varlistentry>
+	  <varlistentry>
+	    <term>
+	      <arg>--fasta | --fasta=<filename></arg>
+	    </term>
+	    <listitem>
+	      <para> Sets parameters suited for loading sequences from FASTA
+	      files. The version with =<filename> will also set the
+	      input file to the given filename.
+	      </para>
+	    </listitem>
+	  </varlistentry>
+	  <varlistentry>
+	    <term>
+	      <arg>--phd | --phd=<filename></arg>
+	    </term>
+	    <listitem>
+	      <para> Sets parameters suited for loading sequences from PHD
+	      files. The version with =<filename> will also set the
+	      input file to the given filename.
+	      </para>
+	    </listitem>
+	  </varlistentry>
+	  <varlistentry>
+	    <term>
+	      <arg>--caf | --caf=<filename></arg>
+	    </term>
+	    <listitem>
+	      <para> Sets parameters suited for loading sequences from CAF
+	      files. The version with =<filename> will also set the
+	      input file to the given filename.
+	      </para>
+	    </listitem>
+	  </varlistentry>
+	</variablelist>
+      </sect3>
+      <sect3 id="sect_ref_order_independent_quick_switches">
 	<title>
-	  Preventing statistics for technologies with biases
+	  Order independent quick switches
 	</title>
 	<para>
-	  <emphasis role="bold">nostatistics</emphasis> used as keyword will
-	  prevent MIRA to calculate coverage estimates from reads of the given
-	  readgroup.
-	</para>
-	<para>
-	  This keyword should be used in denovo genome assemblies for reads
-	  from libraries which produce very uneven coverage (e.g.: old
-	  Illumina mate-pair protocols) or have a bias in the randomness of
-	  DNA fragmentations (e.g.: Nextera protocol from Illumina).
-	</para>
-      </sect3>
-      <sect3 id="sect_ref_manifest_readgroups_asreference">
-      <title>
-	Setting reference sequence for mapping jobs
-      </title>
-	<para>
-	  <emphasis role="bold">as_reference</emphasis> This keyword
-	  indicates to MIRA that the sequences in this readgroup should not
-	  be assembled, but should be used as reference backbone for a
-	  mapping assembly. That is, sequencing reads are then placed/mapped
-	  onto these reference reads.
+	  The following switches can be placed anywhere on the command line
+	  without interfering with other switches:
 	</para>
-      </sect3>
-      <sect3 id="sect_ref_manifest_readgroups_autopairing">
-      <title>
-	Autopairing: letting MIRA find out pair info by itself
-      </title>
-	<para>
-	  <emphasis role="bold">autopairing</emphasis> This keyword is used
-	  to tell MIRA it should estimate values for
-	  <emphasis>template_size</emphasis> and
-	  <emphasis>segment_placement</emphasis> (see below).
-	</para>
-	<para>
-	  This is basically the lazy way to tell MIRA that the data in the
-	  corresponding readgroup consists of paired reads and that you
-	  trust it will find out the correct values.
-	</para>
-	<note>
-	  <emphasis>autopairing</emphasis> usually works quite well for
-	  small and mid-sized libraries (up to, say, 10 kb). For larger
-	  libraries it might be a good thing to tell MIRA some rough
-	  boundaries via <emphasis>template_size</emphasis> /
-	  <emphasis>segment_placement</emphasis> and let MIRA refine the
-	  values for the template size via <emphasis>autorefine</emphasis>
-	  (see below).
-	</note>
-	<note>
-	  <emphasis>autopairing</emphasis> is a feature new to MIRA 4.0rc5,
-	  it may contain bugs for some corner cases. Feedback appreciated.
-	</note>
-      </sect3>
-      <sect3 id="sect_ref_manifest_readgroups_templatesize">
-      <title>
-	Setting size of read templates
-      </title>
-	<para>
-	  <emphasis role="bold">template_size </emphasis>=
-	  <replaceable>min_size max_size
-	  <emphasis>[infoonly|exclusion_criterion]</emphasis>
-	  <emphasis>[autorefine]</emphasis></replaceable>. Defines the
-	  minimum and maximum size of "good" DNA templates in the library
-	  prep for this read group. This defines at which distance the two
-	  reads of a pair are to be expected in a contig, a very useful
-	  information for an assembler to resolve repeats in a genome or
-	  different splice variants in transcriptome data.
-	</para>
-	<para>
-	  If the term <emphasis>infoonly</emphasis> is present, then MIRA
-	  will pass the information on template sizes in result files, but
-	  will not use it for any decision making during de-novo or mapping
-	  assembly. The term <emphasis>exclusion_criterion</emphasis> makes
-	  MIRA use the information for decision making.
-	</para>
-	<para>
-	  If <emphasis>infoonly</emphasis>
-	  or <emphasis>exclusion_criterion</emphasis> are missing, then MIRA
-	  assumes <emphasis>exclusion_criterion</emphasis> for de-novo
-	  assemblies and <emphasis>infoonly</emphasis> for mapping
-	  assemblies.
-	</para>
-	<para>
-	  If the term <emphasis>autorefine</emphasis> is present, MIRA will
-	  start the assembly with the given size information but switch to
-	  refined value computed from observed distances in an
-	  assembly. However, please note that the size values
-	  can <emphasis>never</emphasis> be expanded, only shrunk. It is
-	  therefore advisable to use generous bounds when using the
-	  autorefine feature.
-	</para>
-	<note>
-	  The <emphasis>template_size</emphasis> line in the manifest file
-	  replaces the parameters -GE:uti:tismin:tismax of earlier versions
-	  of MIRA (3.4.x and below).
-	</note>
-	<note>
-	  The minimum or the maximum size (or both) can be set to a negative
-	  value for "don't care and don't check". This allows constructs
-	  like <literal>template_size= 500 -1 exclusion_criterion</literal>
-	  which would check only the minimum distance but not the maximum
-	  distance.
-	</note>
-	<note>
-	  <para>
-	    For <emphasis>mapping</emphasis> assemblies with MIRA, you
-	    usually will want to use <emphasis>infoonly</emphasis> as else -
-	    in case of genome re-arrangements, larger deletions or
-	    insertions - MIRA would probably reject one read of every read
-	    pair in the corresponding areas as it would not be at the
-	    expected distance and/or orientation ... and you would not be
-	    able to simply find the re-arrangement in downstream analysis.
-	  </para>
-	  <para>
-	    For <emphasis>de-novo</emphasis> assemblies however
-	    you <emphasis>should not</emphasis>
-	    use <emphasis>infoonly</emphasis> except in very rare cases
-	    where you know what you do.
-	  </para>
-	</note>
-	<sidebar>
-	  <title>
-	    Understanding the size of DNA templates
-	  </title>
-	  <para>
-	    When using a <emphasis>paired-end</emphasis> or
-	    <emphasis>mate-pair</emphasis> sequencing strategy, two
-	    sequences are generated for the ends of each DNA template (see
-	    sidebar above: "understanding readgroups and DNA
-	    templates"). That is, if one has a library with 6kb fragments,
-	    one knows that the outer ends of the two reads will be
-	    approximately 6kb apart, like so:
-	  </para>
-	  <screen>DNA template    ##############################################################
-read 1          .......
-read 2                                                                  ......
-<------------------------- ~6 kb ----------------------------></screen>
-	  <para>
-	    Sequencing labs will try their best to get these two sequences
-	    from DNA templates which comply to a given length
-	    specification. But as this is chemistry and wet lab, things must
-	    be seen with a certain uncertainty and therefore the DNA
-	    templates generated are not exactly of the specified size
-	    (e.g. 6kb), but the size distribution will vary in a given
-	    range, e.g., 5.5kb to 6.5 kb.
-	  </para>
-	</sidebar>
-      </sect3>
-      <sect3 id="sect_ref_manifest_readgroups_segplace">
-      <title>
-	Read segment placement
-      </title>
-      <note>You do not need to use this when using 'autopairing' (see above).</note>
-	<para>
-	  <emphasis role="bold">segment_placement </emphasis>=
-	  <replaceable>placementcode <emphasis>[infoonly|exclusion_criterion]</emphasis></replaceable>. Allowed
-	  placement codes are:
-	</para>
-	<itemizedlist>
-	  <listitem>
-	    <para>
-	      <emphasis role="bold">?</emphasis>
-	      or <emphasis role="bold">unknown</emphasis> which are
-	      place-holders for "well, in the end: don't care." Segments of
-	      a template can be reads in any direction and in any
-	      relationship to each other.
-	    </para>
-	    <para>
-	      This is typically used for unpaired libraries (sometimes
-	      called <emphasis>shotgun libraries</emphasis>), but may be
-	      also useful for, e.g., primer walking with Sanger.
-	    </para>
-	  </listitem>
-	  <listitem>
-	    <para>
-	      <emphasis role="bold">---> <---</emphasis> or <emphasis
-	      role="bold">FR</emphasis> or <emphasis
-	      role="bold">INNIES</emphasis>. The <emphasis>forward /
-	      reverse</emphasis> scheme as used in traditional Sanger
-	      sequencing as well as Illumina paired-end sequencing,
-	    </para>
-	    <para>
-	      This is the usual placement code for Sanger paired-end
-	      protocols as well as Illumina paired-end. Less frequently used
-	      in IonTorrent paired-end sequencing.
-	    </para>
-	  </listitem>
-	  <listitem>
-	    <para>
-	      <emphasis role="bold"><--- ---></emphasis> or <emphasis
-	      role="bold">RF</emphasis> or <emphasis
-	      role="bold">OUTIES</emphasis>. The <emphasis>reverse /
-	      forward</emphasis> scheme as used in Illumina mate-pair
-	      sequencing.
-	    </para>
-	    <para>
-	      This is the usual placement code for Illumina mate-pair protocols.
-	    </para>
-	  </listitem>
-	  <listitem>
-	    <para>
-	      <emphasis role="bold">1---> 2---></emphasis> or
-	      <emphasis role="bold">samedir forward</emphasis> or <emphasis
-	      role="bold">SF</emphasis> or <emphasis
-	      role="bold">LEFTIES</emphasis>. The <emphasis>forward /
-	      forward</emphasis> scheme. Segments of a template are all
-	      placed in the same direction, the segment order in the contig
-	      follows segment ordering of the reads.
-	    </para>
-	  </listitem>
-	  <listitem>
-	    <para>
-	      <emphasis role="bold">2---> 1---></emphasis> <emphasis
-	      role="bold">samedir backward</emphasis> or <emphasis
-	      role="bold">SB</emphasis> or <emphasis
-	      role="bold">RIGHTIES</emphasis>. Segments of a template are
-	      all placed in the same direction, the segment order in the
-	      contig is reversed compared to segment ordering of the reads.
-	    </para>
-	    <para>
-	      This is the usual placement code for 454 "paired-end" and IonTorrent
-	      long-mate protocols.
-	    </para>
-	  </listitem>
-	  <listitem>
-	    <para>
-	      <emphasis role="bold">samedir</emphasis> Segments of a
-	      template are all placed in the same direction, the spatial
-	      relationship however is not cared of.
-	    </para>
-	  </listitem>
-	  <listitem>
-	    <para>
-	      <emphasis role="bold">>>></emphasis> (reserved for
-	      sequencing of several equidistant fragments per template like
-	      in PacBio strobe sequencing, not implemented yet)
-	    </para>
-	  </listitem>
-	</itemizedlist>
-	<para>
-	  If the term <emphasis>infoonly</emphasis> is present, then MIRA
-	  will pass the information on segment placement in result files, but
-	  will not use it for any decision making during de-novo assembly or
-	  mapping assembly. The term <emphasis>exclusion_criterion</emphasis> makes MIRA use the information for decision making.
-	</para>
-	<para>
-	  If <emphasis>infoonly</emphasis> or <emphasis>exclusion_criterion</emphasis> are missing, then MIRA assumes <emphasis>exclusion_criterion</emphasis> for de-novo assemblies and <emphasis>infoonly</emphasis> for mapping assemblies.
-	</para>
-	<note>
-	  <para>
-	    For <emphasis>mapping</emphasis> assemblies with MIRA, you
-	    usually will want to use <emphasis>infoonly</emphasis> as else -
-	    in case of genome re-arrangements, larger deletions or
-	    insertions - MIRA would probably reject one read of every read
-	    pair (as it would not be at the expected distance and/or
-	    orientation) and you would not be able to simply find the
-	    re-arrangement in downstream analysis.
-	  </para>
-	  <para>
-	    For <emphasis>de-novo</emphasis> assemblies however
-	    you <emphasis>should not</emphasis>
-	    use <emphasis>infoonly</emphasis> except in very rare cases
-	    where you know what you do.
-	  </para>
-	</note>
-	<note>
-	  As soon as you tell MIRA that a readgroup contains paired reads (via one of the other typical readgroup parameters like template_size, segment_naming etc.), the <emphasis>segment_placement</emphasis> line becomes mandatory in the manifest. This is because different sequencing technologies and/or library preparations result in different read orientations. E.g., Illumina libraries come in paired-end flavour which have FR (forward/reverse) placements, but there are also mate-pair librari [...]
-	</note>
-	<sidebar>
-	  <title>
-	    Understanding read segment placement on DNA templates
-	  </title>
-	  <para>
-	    bla
-	  </para>
-	</sidebar>
-      </sect3>
-      <sect3 id="sect_ref_manifest_readgroups_segname">
-      <title>
-	Read segment naming
-      </title>
-	<para>
-	  <emphasis role="bold">segment_naming </emphasis>= <replaceable>naming_scheme <emphasis>[rollcomment]</emphasis></replaceable>. Defines
-	  the naming scheme reads are following to indicate the DNA template
-	  they belong to. Allowed naming schemes are: <emphasis>sanger,
-	  stlouis, tigr, FR, solexa, sra</emphasis>.
-	</para>
-	<para>
-	  If not defined, the defaults are <emphasis
-	  role="underline">sanger</emphasis> for Sanger sequencing data,
-	  while <emphasis role="underline">solexa</emphasis> for Solexa, 454
-	  and Ion Torrent.
-	</para>
-	<para>
-	  For FASTQ files, the modifier <emphasis>rollcomment</emphasis> can
-	  be used to let MIRA take the first token in the comment as name of
-	  a read instead of the orginal name. E.g.: for a read
-	</para>
-	<screen>@DRR014327.1.1 HWUSI-EAS547_0013:1:1:1106:4597.1 length=91
-TTAGAAGGAGATCTGGAGAACATTTTAAACCGGATTGAACAACGCGGCCGTGAGATGGAGCTTCAGACAAGCCGGTCTTATTGGGACGAAC
-+
-bbb`bbbbabbR`\_bb_bba`b`bb_bb_`\^\^Y^`\Zb^b``]]\S^a`]]a``bbbb_bbbb]bbb\`^^^]\aaY\`\\^aa__aB</screen>
-	<para>
-	  the rollcomment modifier will lead to the read being named
-	  <filename> HWUSI-EAS547_0013:1:1:1106:4597.1</filename> (which
-	  is almost the original instrument read name) instead of
-	  <filename>DRR014327.1.1</filename> (which is the SRA read name).
-	</para>
-	<warning>
-	  For data from the short read archive (SRA), one will usually need
-	  to explicitly specify the 'sra' naming scheme or use the
-	  'rollcomment' modifier in FASTQ files.
-	</warning>
-	<note>
-	  This has changed with MIRA 3.9.1
-	  and <command>sff_extract</command> 0.3.0. Before that, 454 and Ion
-	  Torrent were given <emphasis role="underline">fr</emphasis> as naming
-	  scheme.
-	</note>
-	<sidebar>
-	  <title>
-	    Understanding read naming schemes
-	  </title>
-	  <para>
-	    Read naming is a long story with lots of historical gotchas: it
-	    needs to be clear and simple, but still people sometimes wanted
-	    to convey additional meta-information with it. Unsurprisingly,
-	    several "standards" emerged over time. In short: it's a mess. See also XKCD entry on <ulink url="http://xkcd.com/927/">proliferating standards</ulink>.
-	  </para>
-	  <para>
-	    How to choose: please read the documentation available at the
-	    different centres or ask your sequence provider. In a nutshell
-	    (and probably over-simplified):
-	  </para>
-	  <variablelist>
-	    <varlistentry>
-	      <term>
-		Sanger scheme
-	      </term>
-	      <listitem>
-		<para>
-		  "somename<emphasis>.[pqsfrw][12][bckdeflmnpt][a|b|c|...</emphasis>"
-		  (e.g.  U13a08f10.p1ca), but the length of the postfix
-		  must be at least 4 characters, i.e., ".p" alone will not
-		  be recognised.
-		</para>
-		<para>
-		  Usually, ".p" + 3 characters or "f" + 3 characters are
-		  used for forwards reads, while reverse complement reads
-		  take either ".q" or ".r" (+ 3 characters in both cases).
-		</para>
-	      </listitem>
-	    </varlistentry>
-	    <varlistentry>
-	      <term>
-		TIGR scheme
-	      </term>
-	      <listitem>
-		<para>
-		  "somename<emphasis>TF*|TR*|TA*</emphasis>"
-		  (e.g. GCPBN02TF or GCPDL68TABRPT103A58B),
-		</para>
-		<para>
-		  Forward reads take "TF*", reverse reads "TR*".
-		</para>
-	      </listitem>
-	    </varlistentry>
-	    <varlistentry>
-	      <term>
-		St. Louis scheme
-	      </term>
-	      <listitem>
-		<para>
-		  "somename<emphasis>.[sfrxzyingtpedca]*</emphasis>"
-		</para>
-	      </listitem>
-	    </varlistentry>
-	    <varlistentry>
-	      <term>
-		Forward/Reverse scheme
-	      </term>
-	      <listitem>
-		<para>
-		  "somename<emphasis>.[fr]*</emphasis>"
-		  (e.g.  E0K6C4E01DIGEW.f or E0K6C4E01BNDXN.r2nd),
-		</para>
-		<para>
-		  ".f*" for forward, ".r*" for reverse.
-		</para>
-	      </listitem>
-	    </varlistentry>
-	    <varlistentry>
-	      <term>
-		Solexa scheme
-	      </term>
-	      <listitem>
-		<para>
-		  Even simpler than the forward/reverse scheme, it allows
-		  only for one two reads per template:
-		  "somename<emphasis>/[12]</emphasis>"
-		</para>
-	      </listitem>
-	    </varlistentry>
-	    <varlistentry>
-	      <term>
-		SRA scheme
-	      </term>
-	      <listitem>
-		<para>
-		  The Short Read Archive (SRA) finally settled on a naming
-		  scheme and renames each and every read within its
-		  database. When you download sequences from the archive,
-		  all reads will be named
-		  <filename>XXX000000.Y[.Z]</filename> (where X's are
-		  characters A-Z, 0 are digits from 0 to 9, Y is a counter
-		  and Z is a number denoting the segment (usually 1,2 or
-		  3)). This naming scheme is applied to reads from all
-		  technologies, therefore the MIRA technology dependent
-		  defaults will not apply and one must specify the 'sra'
-		  naming scheme in the command line.
-		</para>
-	      </listitem>
-	    </varlistentry>
-	  </variablelist>
-	</sidebar>
-	<para>
-	  Any wildcard in the forward/reverse suffix must be consistent for
-	  a read pair, and is treated as part of the template name. This is
-	  to allow multiple sequencing of a fragment, particularly common
-	  with Sanger capillary data (e.g. given somename.f and somename.r,
-	  resequenced as somename.f2 and somename.r2, this would be treated
-	  as two pairs, with template names somename and somename_2
-	  respectively).
-	</para>
-      </sect3>
-      <sect3 id="sect_ref_manifest_readgroups_strainname">
-      <title>
-	Strain naming
-      </title>
+	<variablelist>
+	  <varlistentry>
+	    <term>
+	      <arg>--project=<name></arg>
+	    </term>
+	    <listitem>
+	      <para> Default is <emphasis
+	      role="underline">mira</emphasis>. Defines the project name for
+	      this assembly. The project name automatically influences the
+	      name of input and output files / directories. E.g. in the
+	      default setting, the file names for the output of the assembly
+	      in FASTA format would be <filename>mira_out.fasta</filename> and
+	      <filename>mira_out.fasta.qual</filename>. Setting the project
+	      name to "MyProject" would generate
+	      <filename>MyProject_out.fasta</filename> and
+	      <filename>MyProject_out.fasta.qual</filename>. See also
+	      <emphasis role="bold">-FILENAME:</emphasis> and <emphasis
+	      role="bold">-DIRECTORY:</emphasis> for a list of names that are
+	      influenced.
+	      </para>
+	    </listitem>
+	  </varlistentry>
+	  <varlistentry>
+	    <term>
+	      <arg>--projectin=<name></arg>
+	    </term>
+	    <listitem>
+	      <para> Default is <emphasis
+	      role="underline">mira</emphasis>. Works like
+	      <arg>--project=<name></arg>, but takes only effect on input
+	      files.
+	      </para>
+	    </listitem>
+	  </varlistentry>
+	  <varlistentry>
+	    <term>
+	      <arg>--projectout=<name></arg>
+	    </term>
+	    <listitem>
+	      <para> Default is <emphasis
+	      role="underline">mira</emphasis>. Works like
+	      <arg>--project=<name></arg>, but takes only effect on
+	      output files.
+	      </para>
+	    </listitem>
+	  </varlistentry>
+	</variablelist>
 	<para>
-	  <emphasis role="bold">strain_name </emphasis>=
-	  <replaceable>string</replaceable>. Defines the strain /
-	  organism-code the reads of this read group are from. If not set,
-	  MIRA will assign "StrainX" to normal readgroups and
-	  "ReferenceStrain" to readgroups with reference sequences.
 	</para>
-	<sidebar>
-	  <title>
-	    Understanding how MIRA uses strain information
-	  </title>
-	  <para>
-	    bla
-	  </para>
-	</sidebar>
-      </sect3>
-      <sect3 id="sect_ref_manifest_readgroups_datadirscf">
-      <title>
-	Data directory for SCF files
-      </title>
 	<para>
-	  <emphasis role="bold">datadir_scf </emphasis>=
-	  <replaceable>directory</replaceable>
+	  Note: A double dash (e.g. --params) may also be used instead of a
+	  single one in front of the quick switches.
 	</para>
 	<para>
-	  For SANGER data only: tells MIRA in which directory it can find
-	  SCF data belonging to reads of this read group.
+	  Examples for using these switches can be found in the documentation
+	  files describing mira usage.
 	</para>
       </sect3>
-      <sect3 id="sect_ref_manifest_readgroups_renameprefix">
-      <title>
-	Renaming read name prefixes
-      </title>
+      <sect3 id="sect_ref_the_job_switch_in_detail">
+	<title>
+	  The --job= switch in detail
+	</title>
 	<para>
-	  <emphasis role="bold">rename_prefix</emphasis>=
-	  <replaceable>prefix replacement</replaceable>. Allows to rename
-	  reads on the fly while loading data by searching each read name
-	  for a given <emphasis>prefix</emphasis> string and, if found,
-	  replace it with a given <emphasis>replacement</emphasis> string.
+	  This is the main one-stop-switches for most assemblies. You need to
+	  make your choice mainly in four steps and in the end concatenate
+	  your choices to the
+	  <arg>--job=</arg> switch:
 	</para>
+	<orderedlist>
+	  <listitem>
+	    <para>
+	      are you building an assembly from scratch
+	      (choose: <emphasis>denovo</emphasis>) or are you mapping reads
+	      to an existing backbone sequence
+	      (choose: <emphasis>mapping</emphasis>)?  Pick one. Leaving this
+	      out automatically chooses <emphasis>denovo</emphasis> as
+	      default.
+	    </para>
+	  </listitem>
+	  <listitem>
+	    <para>
+	      are the data you are assembling forming a larger contiguous
+	      sequence (choose: <emphasis>genome</emphasis>) or are you
+	      assembling small fragments like in EST or mRNA libraries
+	      (choose: <emphasis>est</emphasis>)? Pick one. Leaving this out
+	      automatically chooses <emphasis>genome</emphasis> as default.
+	    </para>
+	  </listitem>
+	  <listitem>
+	    <para>
+	      do you want a quick and dirty assembly for first insights
+	      (choose: <emphasis>draft</emphasis>) or an assembly that should
+	      be able to tackle even most nasty cases (choose:
+	      <emphasis>accurate</emphasis>)? Pick one. Leaving this out
+	      automatically chooses <emphasis>accurate</emphasis> as default.
+	    </para>
+	  </listitem>
+	  <listitem>
+	    <para>
+	      finally, which sequencing technologies have created your reads:
+	      <emphasis>sanger</emphasis>, <emphasis>454</emphasis>,
+	      <emphasis>iontor</emphasis>, <emphasis>solexa</emphasis> or
+	      <emphasis>solid</emphasis>? You can pick multiple. Leaving this
+	      out automatically chooses only <emphasis>sanger</emphasis> as
+	      default.
+	    </para>
+	  </listitem>
+	</orderedlist>
 	<para>
-	  This is most useful for systems like Illumina or PacBio which
-	  generate quite long read names which, in the end, are either
-	  utterly useless for an end user or are even breaking older
-	  programs which have a length restriction on read names. E.g.:
 	</para>
-	<screen>rename_prefix = DQT9AAQ4:436:H371HABMM: Sample1_</screen>
 	<para>
-	  will rename reads
-	  like <emphasis>DQT9AAQ4:436:H371HABMM:5:1101:9154:3062</emphasis>
-	  into <emphasis>Sample1_5:1101:9154:3062</emphasis>
+	  Once you're done with your choices, concatenate everything with
+	  commas and you're done. E.g.:
+	  '<literal>--job=denovo,genome,draft,sanger,iontor</literal>' will give
+	  you a de-novo assembly of a genome in draft quality using a hybrid
+	  assembly method with Sanger and Ion Torrent reads.
 	</para>
-	<note>
-	  <literal>rename_prefix</literal> entries are valid per
-	  readgroup. I.e., an entry for a readgroup will not rename reads of
-	  another readgroup.
-	</note>
-	<note>
-	  <para>
-	    Multiple <literal>rename_prefix</literal> entries are
-	    allowed per readgroup. E.g.:
-	  </para>
-	  <screen>rename_prefix = DQT9AAQ4:436:H371HABMM: S1sxa_
-rename_prefix = m140328_002546_42149_c100624422550000001823118308061414_s1_ S1pb_</screen>
-	  <para>
-	    will rename a read
-	    called <literal>DQT9AAQ4:436:H371HABMM:1:1101:3099:2186</literal>
-	    into <literal>S1sxa_1:1101:3099:2186</literal> while renaming
-	    another read called <literal>m140328_002546_42149_c100624422550000001823118308061414_s1_p0/100084/10792_20790/0_9573</literal>
-	    into <literal>S1pb_p0/100084/10792_20790/0_9573</literal>
-	  </para>
-	</note>
       </sect3>
     </sect2>
-    <sect2 id="sect_ref_manifest_parameters">
+    <sect2 id="sect_ref_extensive_switches">
       <title>
-	The manifest file: extended parameters
+	Extensive switches
       </title>
       <para>
-	The <emphasis role="bold">parameters=</emphasis> line in the manifest
-	file opens up the full panoply of possibilities the MIRA assembler
-	offers. This ranges from fine-tuning assemblies to setting parameters
-	in a way so that MIRA is suited also for very special assembly cases.
+	Extensive switches open up the full panoply of possibilities the MIRA
+	assembler offers. This ranges from fine-tuning assemblies with the quick
+	switches from above to setting parameters in a way so that mira is
+	suited also for very special assembly cases.
       </para>
-      <sect3 id="sect_ref_parameter_groups">
-	<title>
-	  Parameter groups
-	</title>
-	<para>
-	  Some parameters one can set in MIRA somehow belong together. Example
-	  given: when specifying an overlap in an alignment of two sequences,
-	  one could tell the assembler it should look at overlaps only if they
-	  have a certain similarity and a certain length. On the other hand,
-	  specifying how many processors / threads the assembler should use or
-	  whether the results of an assembly should be written out as SAM
-	  format does not seem to relate to alignments.
-	</para>
-	<para>
-	  MIRA uses <emphasis>parameter groups</emphasis> to keep parameters
-	  together which somehow belong together. Example given:
-	</para>
-      <screen>
-<userinput>parameters = <replaceable> -GENERAL:number_of_threads=4 \
-              -ALIGN:min_relative_score=70 -ASSEMBLY:minimum_read_length=150 \
-              -OUTPUT:output_result_caf=no</replaceable></userinput></screen>
       <para>
-	The parameters of the different parameter groups are described in
-	detail a bit later in this manual.
+	<emphasis role="bold">Important note:</emphasis> As soon as you use a
+	quick switch (especially --job), the 'default' settings given for
+	extensive switches in the manual below probably do not apply anymore
+	as the quick switch tweaks a lot of extensive switches internally.
       </para>
-      </sect3>
       <sect3 id="sect_ref_technology_sections">
 	<title>
 	  Technology sections
 	</title>
 	<para>
-	  With the introduction of new sequencing technologies, MIRA also had
+	  With the introduction of new sequencing technologies, mira also had
 	  to be able to set values that allow technology specific behaviour of
-	  algorithms. One simple example for this could be the minimum length
+	  algorithms.  One simple example for this could be the minimum length
 	  a read must have to be used in the assembly. For Sanger sequences,
 	  having this value to be 150 (meaning a read should have at least 150
-	  unclipped bases) would be a very valid, albeit conservative
+	  unclipped bases) would be a very valid albeit conservative
 	  choice. For 454 reads and especially Solexa and ABI SOLiD reads
 	  however, this value would be ridiculously high.
 	</para>
 	<para>
 	  To allow very fine grained behaviour, especially in hybrid
-	  assemblies, and to prevent the explosion of parameter names, MIRA
-	  knows two categories of parameters:
-	</para>
-	<orderedlist>
-	  <listitem>
-	    <para>
-	      <emphasis role="bold">technology independent parameters</emphasis>
-	      which control general behaviour of MIRA like, e.g., the number of
-	      assembly passes or file names etc.
-	    </para>
-	  </listitem>
-	  <listitem>
-	    <para>
-	      <emphasis role="bold">technology dependent parameters</emphasis>
-	      which control behaviour of algorithms where the sequencing
-	      technology plays a role. Example for this would be the minimum
-	      length of a read (like 200 for Sanger reads and 120 for 454 FLX
-	      reads).
-	    </para>
-	  </listitem>
-	</orderedlist>
-	<para>
-	  More on this a bit further down in this documentation.
+	  assemblies, and to prevent the explosion of parameter names, mira
+	  uses <emphasis>technology</emphasis>
+	  <emphasis>mode</emphasis> <emphasis>switching</emphasis> in the parameter files or on the command line.
 	</para>
 	<para>
-	  As example, a manifest using technology dependent and independent parameters could
-	  look like this:
+	  Example: assume the following basic command line
 	</para>
-	<screen>
-<userinput>parameters = <replaceable>COMMON_SETTINGS -GENERAL:number_of_threads=4 \
-              SANGER_SETTINGS -ALIGN:min_relative_score=70 -ASSEMBLY:minimum_read_length=150 \
-              454_SETTINGS -ALIGN:min_relative_score=75 -ASSEMBLY:minimum_read_length=100 \
-              SANGER_SETTINGS -ALIGN:min_relative_score=90 -ASSEMBLY:minimum_read_length=75</replaceable></userinput></screen>
-	<para>
-	  Now, assume the following read group descriptions in a manifest:
-	</para>
-	<screen>
-...
-
-readgroup
-technology=454
-...
-
-readgroup
-technology=solexa
-...</screen>
 	<para>
-	  For MIRA, this means a number of parameters should apply to the
-	  assembly as whole, while others apply to the sequencing data itself
-	  ... and some parameters might need to be different depending on the
-	  technology they apply to. MIRA dumps the parameters it is running
-	  with at the beginning of an assembly and it makes it clear there
-	  which parameters are "global" and which parameters apply to single
-	  technologies.
+	  <literal>mira -fasta -job=denovo,genome,draft,454,solexa</literal>
 	</para>
 	<para>
-	  Here is as example a part of the output of used parameters that MIRA
-	  will show when started with 454 and Illumina (Solexa) data:
+	  Here is exemplary a part of the output of used parameters that mira
+	  will show:
 	</para>
 	<screen>
 ...
@@ -1301,58 +673,37 @@ Assembly options (-AS):
     Maximum number of RMB break loops (rbl)     : 1
     Spoiler detection (sd)                      : no
     Last pass only (sdlpo)                      : yes
-
-    Minimum read length (mrl)                   :  [454]  40
-                                                   [sxa]  20
-    Enforce presence of qualities (epoq)        :  [454]  no
-                                                   [sxa]  yes
-
+    
+    Minimum read length (mrl)                   :  [san]  80
+                                                   [454]  40
+    						   [sxa]  20
+    Base default quality (bdq)                  :  [san]  10
+                                                   [454]  10
+    						   [sxa]  10
 ...</screen>
 	<para>
-	  You can see the two different kind of settings that MIRA uses:
+	  You can see the two different kind of settings that mira uses:
 	  <emphasis>common</emphasis> <emphasis>settings</emphasis> (like
-	  <arg>-AS:nop</arg>) which allows only one value and
-	  <emphasis>technology</emphasis> <emphasis>dependent</emphasis>
-	  <emphasis>settings</emphasis> (like <arg>-AS:mrl</arg>), where for
-	  each sequencing technology used in the project, the setting can be
-	  different.
+	  <arg>-AS:nop</arg>) and <emphasis>technology</emphasis>
+	  <emphasis>dependent</emphasis> <emphasis>settings</emphasis> (like
+	  <arg>-AS:mrl</arg>), where for each sequencing technology used in
+	  the project, the setting can be different.
 	</para>
 	<para>
-	  How would one set a minimum read length of 40 and not enforce
-	  presence of base qualities for Sanger reads, but for 454 reads a
-	  minimum read length of 30 and enforce base qualities? The answer:
+	  How would one set a minimum read length of 80 and a base default
+	  quality of 10 for 454 reads, but for Solexa reads a minimum read
+	  length of 30 with a base default quality of 15? The answer:
 	</para>
 	<screen>
-job=denovo,genome,draft
-parameters= SANGER_SETTINGS -AS:mrl=40:epoq=mo 454_SETTINGS -AS:mrl=40:epoq=yes</screen>
+<userinput>mira -job=denovo,genome,draft,454,solexa  -fasta
+  454_SETTINGS -AS:mrl=80:bdq=10 SOLEXA_SETTINGS -AS:mrl=30:bdq=15</userinput></screen>
+	<para>
+	</para>
 	<para>
 	  Notice the ..._SETTINGS section in the command line (or parameter file):
-	  these tell MIRA that all the following parameters until the advent of
+	  these tell mira that all the following parameters until the advent of
 	  another switch are to be set specifically for the said technology.
 	</para>
-	<note>
-	  <para>
-	    For improved readability, you can distribute parameters across
-	    several lines either by pre-fixing every line with
-	    <literal>parameter=</literal>, like so:
-	  </para>
-	  <screen>
-job=denovo,genome,draft
-parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no
-parameters= 454_SETTINGS -AS:mrl=30:epoq=yes</screen>
-          <para>
-	    Alternatively you can use a backslash at the end of a parameter
-	    line to indicate that the next line is a continuing line, like so:
-	  </para>
-	  <screen>
-job=denovo,genome,draft
-parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
-            454_SETTINGS -AS:mrl=30:epoq=yes</screen>
-	  <para>
-	    Note that the very last line of the parameters settings MUST NOT
-	    end with a backslash.
-	  </para>
-	</note>
 	<para>
 	  Beside COMMON_SETTINGS there are currently 6 technology settings available:
 	</para>
@@ -1374,12 +725,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  </listitem>
 	  <listitem>
 	    <para>
-	      PCBIOLQ_SETTINGS (currently not supported)
-	    </para>
-	  </listitem>
-	  <listitem>
-	    <para>
-	      PCBIOHQ_SETTINGS
+	      PACBIO_SETTINGS
 	    </para>
 	  </listitem>
 	  <listitem>
@@ -1389,27 +735,30 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  </listitem>
 	  <listitem>
 	    <para>
-	      TEXT_SETTINGS
+	      SOLID_SETTINGS
 	    </para>
 	  </listitem>
 	</orderedlist>
 	<para>
 	</para>
 	<para>
-	  Some settings of MIRA are influencing global behaviour and are not
+	  Some settings of mira are influencing global behaviour and are not
 	  related to a specific sequencing technology, these must be set in the
 	  COMMON_SETTINGS environment. For example, it would not make sense to try and
 	  set different number of assembly passes for each technology like in
 	</para>
 	<screen>
-<userinput>parameters= 454_SETTINGS -AS:nop=4 SOLEXA_SETTINGS -AS:nop=3</userinput></screen>
+<userinput>mira -job=denovo,genome,draft,454,solexa  -fasta
+  454_SETTINGS -AS:nop=4 SOLEXA_SETTINGS -AS:nop=3</userinput></screen>
 	<para>
-	  Beside being contradictory, this makes not really sense. MIRA will
-	  complain about cases like these. Simply set those common settings in
-	  an area prefixed with the COMMON_SETTINGS switch like in
+	</para>
+	<para>
+	  mira will complain about cases like these. Simply set those common
+	  settings in an area prefixed with the COMMON_SETTINGS switch like in
 	</para>
 	<screen>
-<userinput>parameters= COMMON_SETTINGS -AS:nop=4 454_SETTINGS ... SOLEXA_SETTINGS ...</userinput></screen>
+<userinput>mira -job=denovo,genome,draft,454,solexa -fasta 
+  COMMON_SETTINGS -AS:nop=4 454_SETTINGS ... SOLEXA_SETTINGS ...</userinput></screen>
 	<para>
 	</para>
 	<para>
@@ -1418,319 +767,545 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  technology dependent setting.
 	</para>
       </sect3>
-      <sect3 id="sect_ref_parameter_shortnames">
-	<title>
-	  Parameter short names
-	</title>
-	<para>
-	  Writing the verbose form of parameters can be quite a long task. Here a short example:
-	</para>
-	<screen>
-<userinput>parameters = <replaceable>COMMON_SETTINGS -GENERAL:number_of_threads=4 \
-              SANGER_SETTINGS -ALIGN:min_relative_score=70 -ASSEMBLY:minimum_read_length=150 \
-              454_SETTINGS -ALIGN:min_relative_score=75 -ASSEMBLY:minimum_read_length=100 \
-              SOLEXA_SETTINGS -ALIGN:min_relative_score=90 -ASSEMBLY:minimum_read_length=75</replaceable></userinput></screen>
-	<para>
-	  However, every parameter has a shortened form. The above could be written like this:
-	</para>
-	<screen>
-<userinput>parameters = <replaceable>COMMON_SETTINGS -GE:not=4 \
-              SANGER_SETTINGS -AL:mrs=70 -AS:mrl=150 \
-              454_SETTINGS -AL:mrs=75 -AS:mrl=100 \
-              SOLEXA_SETTINGS -AL:mrs=90 -AS:mrl=75</replaceable></userinput></screen>
-      <para>
-	Please note that it is also perfectly legal to decompose the switches
-	so that they can be used more easily in scripted environments (notice
-	the multiple -AL in some sections of the following example):
-      </para>
-      <screen>
-<userinput>parameters = <replaceable>COMMON_SETTINGS -GE:not=4 \
-              SANGER_SETTINGS \
-                -AL:mrs=70 \
-		-AL:mrl=150 \
-              454_SETTINGS -AL:mrs=75:mrl=100 \
-              SOLEXA_SETTINGS \
-	        -AL:mrs=90 \
-                -AL:mrl=75</replaceable></userinput></screen>
-      </sect3>
-      <sect3 id="sect_ref_order_dependent_quick_switches">
+      <sect3 id="sect_ref_general_ge">
 	<title>
-	  Order dependent quick switches
+	  -GENERAL (-GE)
 	</title>
 	<para>
-	  For some parameters, the order of appearance in the parameter lines
-	  of the manifest is important. This is because the <emphasis>quick
-	  parameters</emphasis> are realised internally as a collection of
-	  extended parameters that will overwrite any previously manually set
-	  extended parameters. It is generally a good idea to place quick parameters in
-	  the order as described in this documentation, that is: first the
-	  order dependent quick parameters, then other quick parameters, then all
-	  the other extended parameters.
+	  General options control the type of assembly to be performed and
+	  other switches not belonging anywhere else.
 	</para>
 	<variablelist>
 	  <varlistentry>
 	    <term>
-	      <arg>--hirep_best</arg>
+	      <arg>project(pro)=<replaceable>string</replaceable></arg>
+	    </term>
+	    <listitem>
+	      <para> Same as the quick switch
+	      <arg>-project</arg>. Defines the name of your project and influences the naming
+	      of your input and output files. 
+	      </para>
+	    </listitem>
+	  </varlistentry>
+	  <varlistentry>
+	    <term>
+	      <arg>number_of_threads(not)=<replaceable>1 ≤ integer ≤ 256</replaceable></arg>
+	    </term>
+	    <listitem>
+	      <para> Default is <emphasis
+	      role="underline">2</emphasis>. Master switch to set the number
+	      of threads used in different parts of mira.
+	      </para>
+	      <para>
+		Note 1: currently only the SKIM algorithm uses multiple
+		threads, other parts will follow.
+	      </para>
+	      <para>
+		Note 2: Although the main data structures are shared between
+		the threads, there's some additional memory needed for each
+		thread.
+	      </para>
+	      <para>
+		Note 3: when running the SKIM in parallel threads, MIRA can
+		give different results when started with the same data and
+		same arguments. While the effect could be averted for SKIM,
+		the memory cost for doing so would be an additional 50% for
+		one of the large tables, so this has not been implemented at
+		the moment. Besides, at the latest when the Smith-Watermans
+		run in parallel, this could not be easily avoided at all.
+	      </para>
+	    </listitem>
+	  </varlistentry>
+	  <varlistentry>
+	    <term>
+	      <arg>automatic_memory_management(amm)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
+	    <listitem>
+	      <para>
+		Default is <emphasis role="underline">Yes</emphasis>. Whether
+		mira tries to optimise run time of certain algorithms in a
+		space/time trade-off memory usage, increasing or reducing some
+		internal tables as memory permits.
+	      </para>
+	      <para>
+		Note 1: This functionality currently relies on the
+		<filename>/proc</filename> file system giving information on
+		the system memory ("MemTotal" in /proc/meminfo) and the memory
+		usage of the current process ("VmSize" in
+		<filename>/proc/self/status</filename>). If this is not
+		available, the functionality is switched off.
+	      </para>
+	      <para>
+		Note 2: The automatic memory management can only work if there
+		actually is unused system memory. It's not a wonder switch
+		which reduces memory consumption. In tight memory situations,
+		memory management has no effect and the algorithms fall back
+		to minimum table sizes. This means that the effective size in
+		memory can grow larger than given in the memory management
+		parameters, but then MIRA will try to keep the additional
+		memory requirements to a minimum.
+	      </para>
+	    </listitem>
+	  </varlistentry>
+	  <varlistentry>
 	    <term>
-	      <arg>--hirep_good</arg>
+	      <arg>max_process_size(mps)=<replaceable>0 ≤ integer</replaceable></arg>
 	    </term>
+	    <listitem>
+	      <para> Default is <emphasis role="underline">0</emphasis>. If
+	      automatic memory management is used (see above), this number is
+	      the size in gigabytes that the MIRA process will use as maximum
+	      target size when looking for space/time trade-offs. A value of 0
+	      means that MIRA does not try keep a fixed upper limit.
+	      </para>
+	      <para>
+		Note: when in competition to <arg>-GE:kpmf</arg> (see below),
+		the smaller of both sizes is taken as target. Example: if your
+		machine has 64 GiB but you limit the use to 32 GiB, then the
+		MIRA process will try to stay within these 32 GiB.
+	      </para>
+	    </listitem>
+	  </varlistentry>
+	  <varlistentry>
 	    <term>
-	      <arg>--hirep_something</arg>
+	      <arg>keep_percent_memory_free(kpmf)=<replaceable>0 ≤ integer</replaceable></arg>
 	    </term>
 	    <listitem>
+	      <para> Default is <emphasis role="underline">10</emphasis>. If
+	      automatic memory management is used (see above), this number
+	      works a bit like <arg>-GE:mps</arg> but the other way round: it
+	      tries to keep x percent of the memory free.
+	      </para>
 	      <para>
-		These are modifier switches for genome data that is deemed to
-		be highly repetitive. With <emphasis>hirep_good</emphasis> and
-		<emphasis>hirep_best</emphasis>, the assemblies will run
-		slower due to more iterative cycles and slightly different
-		default parameter sets that give MIRA a chance to resolve many
-		nasty repeats. The <emphasis>hirep_something</emphasis> switch
-		goes the other way round and resolves repeats less well than a
-		normal assembly, but allows MIRA to finish even on more
-		complex data.
+		Note: when in competition to <arg>-GE:mps</arg> (see above),
+		the argument leaving the most memory free is taken as
+		target. Example: if your machine has 64 GiB and you limit the
+		use to 42 GiB via <arg>-GE:mps</arg> but have a
+		<arg>-GE:kpmf</arg> of 50, then the MIRA process will try to
+		stay within 64-(64*50%)=32 GiB.
+	      </para>
+	    </listitem>
+	  </varlistentry>
+	  <varlistentry>
+	    <term>
+	      <arg>est_snp_pipeline_step(esps)=<replaceable>1 ≤ integer ≤ 4</replaceable></arg>
+	    </term>
+	    <listitem>
+	      <para> Default is <emphasis
+	      role="underline">1</emphasis>. Controls the starting step of the
+	      SNP search in EST pipeline and is therefore only useful in
+	      miraSearchESTSNPs.
+	      </para>
+	      <para> 
+		EST assembly is a three step process, each with different
+		settings to the assembly engine, with the result of each step
+		being saved to disk. If results of previous steps are present
+		in a directory, one can easily "play around" with different
+		setting for subsequent steps by reusing the results of the
+		previous steps and directly starting with step two or three.
 	      </para>
+	    </listitem>
+	  </varlistentry>
+	  <varlistentry>
+	    <term>
+	      <arg>use_template_information(uti)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
+	    </term>
+	    <listitem>
 	      <para>
-		Usage recommendations bacteria: starting MIRA without any
-		hirep switches yields good enough result in most cases. Under
-		normal circumstances one can use
-		<emphasis>hirep_good</emphasis> or
-		even <emphasis>hirep_best</emphasis> without remorse as data
-		sets and genome complexities are small enough to run within a
-		couple of hours at most.
+		Default is <emphasis role="underline">Yes</emphasis>. Two
+		reads sequenced from the same clone template form a read pair
+		with a known minimum and maximum distance. This feature will
+		definitively help for contigs containing lots of repeats. Set
+		this to 'yes' if your data contains information on insert
+		sizes (e.g. in paired-end sequencing).
 	      </para>
 	      <para>
-		Usage recommendations for 'simple' lower eukaryotes: starting
-		MIRA without any hirep switches yields good enough result in
-		most cases. If the genomes are not too complex,
-		using <emphasis>hirep_good</emphasis> can be a possibility.
+		Information on insert sizes can be given via the SI tag in EXP
+		files (for each read pair individually), via insert_size and
+		insert_stdev elements of NCBI TRACEINFO XML files or for the
+		whole project using <arg>-GE:tismin</arg> and
+		<arg>-GE:tismax</arg> (see below).
 	      </para>
 	      <para>
-		Usage recommendations for lower eukaryotes with complex
-		repeats: starting MIRA without any hirep switches might
-		already take too long or create temporary data files which are
-		too big. For these cases, using
-		<emphasis>hirep_something</emphasis> makes MIRA use a
-		parameter set which is targeted as resolving the
-		non-repetitive areas of a genome and additionally all repeats
-		which occur less than 10 times in the genome. Repeats occurring
-		more often will not be resolved, but using the debris
-		information one can recover affected reads and use these with
-		harsh data reduction algorithms (e.g. digital normalisation)
-		to get a glimpse into these.
+		Additional information to set the orientation of the
+		read-pairs can be given via <arg>-GE:tpbd</arg>.
 	      </para>
-	      <note>
-		These switches replace the '--highlyrepetitive' switch from
-		earlier versions.
-	      </note>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>--noclipping=...</arg>
+	      <arg>templateinsertsizeminimum(tismin)=<replaceable>integer</replaceable></arg>
 	    </term>
 	    <listitem>
-	      <para> Switches off clipping options for given sequencing
-	      technologies. Technologies can be <emphasis>sanger</emphasis>,
-	      <emphasis>454</emphasis>, <emphasis>iontor</emphasis>,
-	      <emphasis>solexa</emphasis> or
-	      <emphasis>solid</emphasis>. Multiple entries separated by comma.
+	      <para> Default is <emphasis role="underline">-1</emphasis>. The
+	      default value for the minimum template size for reads that have
+	      no template size in ancillary data. If -1 is used as value, then
+	      no default value is given and reads without ancillary data
+	      giving this number will behave as if they had no template.
 	      </para>
-	      <para> Note that <arg>-CL:pec</arg> and the chimera clipping
-	      <arg>-CL:gbcdc</arg> are not switched off by this parameter and
-	      should be switched off separately.
+	    </listitem>
+	  </varlistentry>
+	  <varlistentry>
+	    <term>
+	      <arg>templateinsertsizemaximum(tismax)=<replaceable>integer</replaceable></arg>
+	    </term>
+	    <listitem>
+	      <para> Default is <emphasis role="underline">-1</emphasis>. The
+	      default value for the maximum template size for reads that have
+	      no template size in ancillary data. If -1 is used as value, then
+	      no default value is given and reads without ancillary data
+	      giving this number will behave as if they had no template.
 	      </para>
-	      <para> Examples:
+	    </listitem>
+	  </varlistentry>
+	  <varlistentry>
+	    <term>
+	      <arg>templatepartnerbuilddirection(tpbd)=<replaceable>-1 or 1</replaceable></arg>
+	    </term>
+	    <listitem>
+	      <para>
+		Default is <emphasis role="underline">-1</emphasis> for all
+		sequencing technologies.
+	      </para>
+	      <para>
+		This value tells MIRA how read-pairs of a template must be
+		oriented in a contig to be valid. A value of "-1" means the
+		orientation must be 5'-3' to 3'-5', a value of "1" means 5'-3'
+		to 5'-3'.
+	      </para>
+	      <para>
+		Set this to "1" if you assemble paired-end 454 data downloaded
+		from the Short Read Archives (SRAs, at the NCBI and EMBL). Set
+		this also to "1" for Solexa data where the paired-end
+		sequencing protocol used creates 5'-3' to 5'-3' pairs.
+	      </para>
+	      <note>
+		Although with Solexa it is possible to build libraries in both
+		directions, with MIRA it is currently not possible to mix
+		within the same sequencing technology paired-end reads which
+		need "-1" as direction with mate-pair reads which have "1" as
+		direction. This will be worked on if the need arises.
+	      </note>
+	    </listitem>
+	  </varlistentry>
+	  <varlistentry>
+	    <term>
+	      <arg>print_date(pd)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
+	    </term>
+	    <listitem>
+	      <para> 
+		Default is <emphasis role="underline">yes</emphasis>. Controls
+		whether date and time are printed out during the
+		assembly. Suppressing it is not useful in normal operation,
+		only when debugging or benchmarking.
 	      </para>
-	      <orderedlist>
-		<listitem>
-		  <para>
-		    Switch off 454 and Solexa (but keep eventually keep Sanger
-		    clipping): <literal>--noclipping=454,solexa</literal>
-		  </para>
-		</listitem>
-		<listitem>
-		  <para>
-		    Switch off all: <literal>--noclipping</literal>
-		    or <literal>--noclipping=all</literal>
-		  </para>
-		</listitem>
-	      </orderedlist>
 	    </listitem>
 	  </varlistentry>
 	</variablelist>
+	<para>
+	</para>
       </sect3>
-      <sect3 id="sect_ref_general_ge">
+      <sect3 id="sect_ref_loadreads_options_lr">
 	<title>
-	  Parameter group: -GENERAL (-GE)
+	  -LOADREADS options (-LR)
 	</title>
 	<para>
-	  General options control the type of assembly to be performed and
-	  other switches not belonging anywhere else.
+	  Here one defines what type of reads to load.
 	</para>
 	<variablelist>
 	  <varlistentry>
 	    <term>
-	      <arg>number_of_threads(not)=<replaceable>0 ≤ integer ≤ 256</replaceable></arg>
+	      <arg>load_sequence_data(lsd)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para> Default is <emphasis
-	      role="underline">0</emphasis>. Master switch to set the number
-	      of threads used in different parts of MIRA.
+	      role="underline">No</emphasis>. Defines whether to load data
+	      generated by a given technology.
+	      </para>
+	    </listitem>
+	  </varlistentry>
+	  <varlistentry>
+	    <term>
+	      <arg>file_type(ft)=<replaceable>fofnexp, fasta, fastq, caf, phd,
+	      fofnphd</replaceable></arg>
+	    </term>
+	    <listitem>
+	      <para>
+		Default is <emphasis role="underline">fasta</emphasis>. Takes
+		effect only when <arg>-LR:lsd</arg>) is 'yes'.
 	      </para>
 	      <para>
-		A value of 0 tells MIRA to set this to the number of available
-		physical cores on the machine it runs on. That is,
-		hyperthreaded "cores" are not counted in as using these would
-		cause a tremendous slowdown in the heavy duty computation
-		parts. E.g., a machine with 2 processors having 4 cores each
-		will have this value set to 8.
+		Defines whether to load for assembly from FASTA sequences
+		(<filename><projectname>_in.fasta</filename>) and their
+		qualities
+		(<filename><projectname>_in.fasta.qual</filename>), from
+		a FASTQ file
+		(<filename><projectname>_in.fastq</filename>), from EXP
+		files from a file of filenames
+		(<filename><projectname>_in.fofn</filename>), from a phd
+		file (<filename><projectname>_in.phd</filename>) or from
+		a CAF file (<filename><projectname>_in.caf</filename>)
+		and assemble or eventually reassemble it.
 	      </para>
 	      <para>
-		In case MIRA cannot find out the number of cores, the
-		fall-back value is <emphasis role="underline">2</emphasis>.
+		Note 1: Only Sanger supports all file types. 454, Ion Torrent
+		and Solexa support only FASTA and FASTQ.
+	      </para>
+	      <para>
+		Note 2: fofnphd currently not available.
 	      </para>
 	      <para>
-		Note: when running the SKIM algorithm in parallel threads,
-		MIRA can give different results when started with the same
-		data and same arguments. While the effect could be averted for
-		SKIM, the memory cost for doing so would be an additional 50%
-		for one of the large tables, so this has not been implemented
-		at the moment. Besides, at the latest when the Smith-Watermans
-		run in parallel, this could not be easily avoided at all.
 	      </para>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>automatic_memory_management(amm)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>external_quality(eq)=<replaceable>none, SCF</replaceable></arg>
 	    </term>
 	    <listitem>
+	      <para> 
+		Default is <emphasis role="underline">SCF</emphasis>.  Takes
+		effect only when <arg>-LR:lsd</arg>) is 'yes' and for Sanger
+		reads.
+	      </para>
 	      <para>
-		Default is <emphasis role="underline">Yes</emphasis>. Whether
-		MIRA tries to optimise run time of certain algorithms in a
-		space/time trade-off memory usage, increasing or reducing some
-		internal tables as memory permits.
+		Defines the source format for reading qualities from external
+		sources. Normally takes effect <emphasis
+		role="bold">only</emphasis> when these are not present in the
+		format of the load_job project (EXP and FASTA can have them,
+		CAF and PHD must have them).
 	      </para>
+	    </listitem>
+	  </varlistentry>
+	  <varlistentry>
+	    <term>
+	      <arg>external_quality_override(eqo)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
+	    </term>
+	    <listitem>
 	      <para>
-		Note 1: This functionality currently relies on the
-		<filename>/proc</filename> file system giving information on
-		the system memory ("MemTotal" in /proc/meminfo) and the memory
-		usage of the current process ("VmSize" in
-		<filename>/proc/self/status</filename>). If this is not
-		available, the functionality is switched off.
+		Takes effect only when <arg>-LR:lsd</arg>) is 'yes' and for
+		Sanger reads.
 	      </para>
 	      <para>
-		Note 2: The automatic memory management can only work if there
-		actually is unused system memory. It's not a wonder switch
-		which reduces memory consumption. In tight memory situations,
-		memory management has no effect and the algorithms fall back
-		to minimum table sizes. This means that the effective size in
-		memory can grow larger than given in the memory management
-		parameters, but then MIRA will try to keep the additional
-		memory requirements to a minimum.
+		Default is <emphasis role="underline">no</emphasis>, only
+		takes effect when load_job is <emphasis
+		role="underline">fofnexp</emphasis>.  Defines whether or not
+		the qualities from the external source override the possibly
+		loaded qualities from the load_job project.  This might be of
+		use in case some post-processing software fiddles around with
+		the quality values of the input file but one wants to have the
+		original ones.
 	      </para>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>max_process_size(mps)=<replaceable>0 ≤ integer</replaceable></arg>
+	      <arg>discard_read_on_eq_error(droeqe)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
-	      <para> Default is <emphasis role="underline">0</emphasis>. If
-	      automatic memory management is used (see above), this number is
-	      the size in gigabytes that the MIRA process will use as maximum
-	      target size when looking for space/time trade-offs. A value of 0
-	      means that MIRA does not try keep a fixed upper limit.
+	      <para> 
+		Default is <emphasis role="underline">yes</emphasis>. Takes
+		effect only when <arg>-LR:lsd</arg>) is 'yes' and for Sanger
+		reads.
 	      </para>
 	      <para>
-		Note: when in competition to <arg>-GE:kpmf</arg> (see below),
-		the smaller of both sizes is taken as target. Example: if your
-		machine has 64 GiB but you limit the use to 32 GiB, then the
-		MIRA process will try to stay within these 32 GiB.
+		Should there be a major mismatch between the external quality
+		source and the sequence (e.g.: the base sequence read from a
+		SCF file does not match the originally read base sequence),
+		should the read be excluded from assembly or not. If not, it
+		will use the qualities it had before trying to load the
+		external qualities (either default qualities or the ones
+		loaded from the original source).
 	      </para>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>keep_percent_memory_free(kpmf)=<replaceable>0 ≤ integer</replaceable></arg>
+	      <arg>wants_quality_file(wqf)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
-	      <para> Default is <emphasis role="underline">10</emphasis>. If
-	      automatic memory management is used (see above), this number
-	      works a bit like <arg>-GE:mps</arg> but the other way round: it
-	      tries to keep x percent of the memory free.
-	      </para>
 	      <para>
-		Note: when in competition to <arg>-GE:mps</arg> (see above),
-		the argument leaving the most memory free is taken as
-		target. Example: if your machine has 64 GiB and you limit the
-		use to 42 GiB via <arg>-GE:mps</arg> but have a
-		<arg>-GE:kpmf</arg> of 50, then the MIRA process will try to
-		stay within 64-(64*50%)=32 GiB.
+		Default is <emphasis role="underline">yes</emphasis>. When set to yes, MIRA will stop the assembly if
+		there is no quality file for a given sequence file. E.g., if the FASTA
+		quality file is missing when loading from FASTA.
 	      </para>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>preprocess_only(ppo)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>readnaming_scheme(rns)=<replaceable>sanger, tigr, fr, stlouis, solexa</replaceable></arg>
 	    </term>
 	    <listitem>
-	      <para> Default is <emphasis role="underline">no</emphasis> As a
-	      special use case, MIRA will just run the following tasks:
-	      loading and clipping of reads as well as calculating kmer
-	      frequencies and read repeat information. The resulting reads can
-	      then be found as MAF file in the checkpoint directory; the read
-	      repeat information in the info directory.
+	      <para>
+		Default is <emphasis role="underline">sanger</emphasis> for
+		Sanger sequencing data, <emphasis
+		role="underline">fr</emphasis> for 454 and Ion Torrent while
+		<emphasis role="underline">solexa</emphasis> for
+		Solexa. Defines the read naming scheme for read
+		suffixes. These suffixes can be used by mira to deduce a
+		template name if none is given in ancillary data.
 	      </para>
 	      <para>
-		No assembly is performed.
+		Currently supported: Sanger centre, TIGR, simple forward /
+		reverse naming, St. Louis schemes and Solexa/Illumina schemes
+		are supported out of the box.
+	      </para>
+	      <para> 
+		How to choose: please read the documentation available at the
+		different centres or ask your sequence provider. In a nutshell
+		(and probably over-simplified):
+	      </para>
+
+	      <variablelist>
+		<varlistentry>
+		  <term>
+		    Sanger scheme
+		  </term>
+		  <listitem>
+		    <para> 
+		      "somename<emphasis>.[pqsfrw][12][bckdeflmnpt][a|b|c|...</emphasis>"
+		      (e.g.  U13a08f10.p1ca), but the length of the postfix
+		      must be at least 4 characters, i.e., ".p" alone will not
+		      be recognised.
+		    </para>
+		    <para>
+		      Usually, ".p" + 3 characters or "f" + 3 characters are
+		      used for forwards reads, while reverse complement reads
+		      take either ".q" or ".r" (+ 3 characters in both cases).
+		    </para>
+		  </listitem>
+		</varlistentry>
+		<varlistentry>
+		  <term>
+		    TIGR scheme
+		  </term>
+		  <listitem>
+		    <para> 
+		      "somename<emphasis>TF*|TR*|TA*</emphasis>"
+		      (e.g. GCPBN02TF or GCPDL68TABRPT103A58B), 
+		    </para>
+		    <para>
+		      Forward reads take "TF*", reverse reads "TR*".
+		    </para>
+		  </listitem>
+		</varlistentry>
+		<varlistentry>
+		  <term>
+		    Forward/Reverse scheme
+		  </term>
+		  <listitem>
+		    <para> 
+		      "somename<emphasis>.[fr]*</emphasis>"
+		      (e.g.  E0K6C4E01DIGEW.f or E0K6C4E01BNDXN.r2nd),
+		    </para>
+		    <para>
+		      ".f*" for forward, ".r*" for reverse.
+		    </para>
+		  </listitem>
+		</varlistentry>
+		<varlistentry>
+		  <term>
+		    St. Louis scheme
+		  </term>
+		  <listitem>
+		    <para> 
+		      "somename<emphasis>.[sfrxzyingtpedca]*</emphasis>"
+		    </para>
+		  </listitem>
+		</varlistentry>
+		<varlistentry>
+		  <term>
+		    Solexa scheme
+		  </term>
+		  <listitem>
+		    <para>
+		      Even simpler than the forward/reverse scheme, it allows
+		      only for one two reads per template:
+		      "somename<emphasis>/[12]</emphasis>"
+		    </para>
+		  </listitem>
+		</varlistentry>
+	      </variablelist>
+	    </listitem>
+	  </varlistentry>
+	  <varlistentry>
+	    <term>
+	      <arg>solexa_scores_in_qual_file(ssiqf)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
+	    </term>
+	    <listitem>
+	      <para> 
+		Default is <emphasis role="underline">no</emphasis>. This switch applies only for sequences
+		from older Illumina / Solexa sequencing technology when loading from FASTA!
+		Defines whether the FASTA quality file 
+		contains Solexa scores (which also have negative values) instead of quality
+		values. Solexa scores also have
+		negative values. If set to <emphasis role="underline">yes</emphasis>, mira will automatically
+		convert the Solexa scores to phred style quality values.
 	      </para>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>est_snp_pipeline_step(esps)=<replaceable>1 ≤ integer ≤ 4</replaceable></arg>
+	      <arg>fastq_qualoffset(fqqo)=<replaceable>integer</replaceable></arg>
 	    </term>
 	    <listitem>
-	      <para> Default is <emphasis
-	      role="underline">1</emphasis>. Controls the starting step of the
-	      SNP search in EST pipeline and is therefore only useful in
-	      miraSearchESTSNPs.
+	      <para> 
+		Default is <emphasis role="underline">0</emphasis>. This
+		switch applies only for sequences loaded from FASTQ
+		format!
 	      </para>
 	      <para>
-		EST assembly is a three step process, each with different
-		settings to the assembly engine, with the result of each step
-		being saved to disk. If results of previous steps are present
-		in a directory, one can easily "play around" with different
-		setting for subsequent steps by reusing the results of the
-		previous steps and directly starting with step two or three.
+		Defines the quality offset used to convert characters into
+		quality values. Usually, 33 is used for FASTQ in Sanger style,
+		Solexa 1.0 format uses 59 (I think) and newer Solexa 1.3
+		format uses 64.
+	      </para>
+	      <para>
+		The default value of 0 switches on routines that try to guess
+		the correct value from the data present in the FASTQ (which
+		they do when the data contains at least one read which at
+		least one base with quality between 0 and 4).
 	      </para>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>print_date(pd)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>merge_xmltraceinfo(mxti)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
+	      <para> 
+		Default is <emphasis role="underline">no</emphasis>. Some file
+		formats above (FASTA, PHD or even CAF and EXP) possibly do not
+		contain all the info necessary or useful for each read of an
+		assembly. Should additional information -- like clipping
+		positions etc. -- be available in a XML trace info file in
+		NCBI format (see <emphasis role="bold">File
+		formats</emphasis>), then set this option to <emphasis
+		role="underline">yes</emphasis> and it will be merged to all
+		the data loaded, be it for Sanger, 454, Ion Torrent, Solexa or
+		SOLiD technology. See also <emphasis
+		role="bold">-FILENAME:</emphasis> for the name of the XML file
+		to load.
+	      </para>
 	      <para>
-		Default is <emphasis role="underline">yes</emphasis>. Controls
-		whether date and time are printed out during the
-		assembly. Suppressing it is not useful in normal operation,
-		only when debugging or benchmarking.
+		Please note: quality clippings given here will override
+		quality clippings loaded earlier (e.g. in EXP files) or
+		performed by mira. Minimum clippings will still be made by the
+		program, though.
 	      </para>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>bang_on_throw(bot)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>filecheck_only(fo)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
-	      <para>
-		Default is <emphasis role="underline">no</emphasis>. For
-		debugging purposes only. Controls whether MIRA raises a signal
-		when detecting an error which triggers a running debugger like
-		gdb.
+	      <para> 
+		Default is <emphasis role="underline">no</emphasis>.  If set
+		to yes, the project will not be assembled and no assembly
+		output files will be produced. Instead, the project files will
+		only be loaded. This switch is useful for checking consistency
+		of input files.
 	      </para>
 	    </listitem>
 	  </varlistentry>
@@ -1740,7 +1315,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
       </sect3>
       <sect3 id="sect_ref_assembly_as">
 	<title>
-	  Parameter group: -ASSEMBLY (-AS)
+	  -ASSEMBLY (-AS)
 	</title>
 	<para>
 	  General options for controlling the assembly.
@@ -1748,17 +1323,21 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	<variablelist>
 	  <varlistentry>
 	    <term>
-	      <arg>num_of_passes(nop)=<replaceable>integer ≥ 0</replaceable></arg>
+	      <arg>num_of_passes(nop)=<replaceable>integer</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para>
-		Default is <emphasis role="underline">0</emphasis>. Defines how many iterations of the whole
+		Default is dependent of the sequencing technology and assembly
+		quality level. Defines how many iterations of the whole
 		assembly process are done.
 	      </para>
 	      <para>
-		The default of 0 will let MIRA choose automatically the number
-		of passes and the kmer sizes used in each pass
-		(see also <arg>-AS:kms</arg> below).
+		As a special use case, a value of 0 will let MIRA just run the
+		following tasks: loading and clipping of reads as well as
+		calculating hash frequencies and read repeat information. The
+		resulting reads can then be found as MAF file in the
+		checkpoint directory; the read repeat information in the info
+		directory.
 	      </para>
 	      <para>
 		Early termination: if the number of passes was chosen too
@@ -1770,37 +1349,28 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 		more passes (with special "last pass routines") before
 		finishing the assembly.
 	      </para>
-	      <note>
-		As a rule of thumb, <emphasis>de-novo</emphasis> assemblies
-		should always have at least two passes,
-		while <emphasis>mapping</emphasis> assemblies should work with
-		only one pass. Not doing this will lead to results unexpected
-		by users. The reason is that the MIRA the learning routines
-		either have no chance to learn enough about the assembly (for
-		de-novo with one pass) or learn "too much" (mapping with more
-		than one pass).
-	      </note>
-	      <warning>
-		MIRA versions ≤ 4.0.2 were interpreting the value of '0' in
-		a different way and only performed pre-processing of
-		reads. MIRA can still do this, but this is controlled by the
-		new parameter <arg>-GE:ppo</arg>.
-	      </warning>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>kmer_series(kms)=<replaceable>comma separated list of integers ≥ 0 and ≤ 256</replaceable></arg>
+	      <arg>skim_each_pass(sep)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
-	      <para>
-		Default is an empty value. If set, overrides <arg>-AS:nop</arg> and <arg>-SK:kms</arg>.
-	      </para>
-	      <para>
-		If set, this parameter provides a one-stop-shop for defining the number of passes and the kmer size used in each pass. E.g.: <literal>-AS:kms=17,31,63,127</literal> defines an assembly with 4 passes which uses a kmer size of 17 in pass 1, 31 in pass 2, 63 in pass 3 and 127 in pass 4.
+	      <para> 
+		Default is dependent of the sequencing technology and assembly
+		quality level. Defines whether the skim algorithm (and with it
+		also the recalculation of Smith-Waterman alignments) is called
+		in-between each main pass. If set to <emphasis
+		role="underline">no</emphasis>, skimming is done only when
+		needed by the workflow: either when read extensions are
+		searched for (<arg>-DP:ure</arg>) or when possible vector
+		leftovers are to be clipped (<arg>-CL:pvc</arg>).
 	      </para>
 	      <para>
-		Note that it is perfectly valid to use the same kmer size more than once, e.g.: <literal>17,31,63,63</literal> will perform a 4 pass assembly, using a kmer size of 63 in passes 3 and 4. It also makes sense to do this, as with default parameters MIRA uses its integrated automatic editor which edits away obvious sequencing errors in each step, thus the second pass with a kmer size of 63 bases can rely on improved reads.
+		Setting this option to <emphasis
+		role="underline">yes</emphasis> is highly recommended, setting
+		it to <emphasis role="underline">no</emphasis> only for quick
+		and dirty assemblies.
 	      </para>
 	    </listitem>
 	  </varlistentry>
@@ -1809,11 +1379,11 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	      <arg>rmb_break_loops(rbl)=<replaceable>integer > 0</replaceable></arg>
 	    </term>
 	    <listitem>
-	      <para>
+	      <para> 
 		Default is dependent of the sequencing technology and assembly
 		quality level. Defines the maximum number of times a contig
-		can be rebuilt during a main assembly pass
-		(see <arg>-AS:nop</arg> or <arg>-AS:kms</arg>) if misassemblies due to possible repeats
+		can be rebuilt during a main assembly passes
+		(<arg>-AS:nop</arg>) if misassemblies due to possible repeats
 		are found.
 	      </para>
 	    </listitem>
@@ -1836,11 +1406,11 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>automatic_repeat_detection(ard)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>automatic_repeat_detection(ard)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
-	      <para>
-		Default is is currently <emphasis role="underline">yes</emphasis>. Tells MIRA to use coverage
+	      <para> 
+		Default is is currently <emphasis role="underline">yes</emphasis>. Tells mira to use coverage
 		information accumulated over time to more accurately pinpoint reads that are
 		in repetitive regions.
 	      </para>
@@ -1853,7 +1423,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	    <listitem>
 	      <para> Default is
 	      <emphasis role="underline">2.0</emphasis> for all sequencing technologies in most assembly cases. This
-	      option says this: if MIRA a read has ever been aligned at positions
+	      option says this: if mira a read has ever been aligned at positions
 	      where the total coverage of all reads of the same sequencing technology
 	      attained the average coverage times <arg>-AS:ardct</arg> (over a length of
 	      <arg>-AS:ardml</arg>, see below), then this read is considered to be
@@ -1883,27 +1453,29 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	      <arg>grace_length(ardgl)=<replaceable>integer > 1</replaceable></arg>
 	    </term>
 	    <listitem>
-	      <para>
+	      <para> 
 		Default is dependent of the sequencing technology.
 	      </para>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>uniform_read_distribution(urd)=<replaceable>on|y[es]|t[rue],
-	      off|n[o]|f[alse]</replaceable></arg>
+	      <arg>uniform_read_distribution(urd)=<replaceable>on|yes|1,
+	      off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para>
-		Default is currently always <emphasis role="underline">no</emphasis>
-		as these algorithms were supplanted by better ones in MIRA 4.0.
+		Default is currently <emphasis role="underline">yes</emphasis>
+		for genome assemblies and <emphasis
+		role="underline">no</emphasis> for EST assemblies or
+		assemblies with Solexa data.
 	      </para>
 	      <para>
 		Takes effect only if uniform read distribution
 		(<arg>-AS:urd</arg>) is on.
 	      </para>
 	      <para>
-		When set to <emphasis role="underline">yes</emphasis>, MIRA
+		When set to <emphasis role="underline">yes</emphasis>, mira
 		will analyse coverage of contigs built at a certain stage of
 		the assembly and estimate an average expected coverage of
 		reads for contigs. This value will be used in subsequent
@@ -1956,16 +1528,17 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	      <arg>urd_clipoffmultiplier(urdcm)=<replaceable>float > 1.0</replaceable></arg>
 	    </term>
 	    <listitem>
-	      <para>
-		Default is <emphasis role="underline">1.5</emphasis> for all
-	        sequencing technologies in most assembly cases.
+	      <para> Default is <emphasis role="underline">1.5</emphasis> for
+	      all sequencing technologies in most assembly cases. The
+	      <arg>--highlyrepetitive</arg> quick-switch sets this to <emphasis
+	      role="underline">1.2</emphasis>.
 	      </para>
 	      <para>
-		This option says this: if MIRA determined that the average
-		coverage is <emphasis>x</emphasis>, then in subsequent passes it will allow
+		This option says this: if mira determined that the average
+		coverage is $x$, then in subsequent passes it will allow
 		coverage for reads determined to be repetitive to be built
 		into the contig only up to a total coverage of
-		<emphasis>x*urdcm</emphasis>. Reads that bring the coverage above the threshold
+		$x*urdcm$. Reads that bring the coverage above the threshold
 		will be rejected from that specific place in the contig (and
 		either be built into another copy of the repeat somewhere else
 		or end up as contig debris).
@@ -1983,7 +1556,24 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>spoiler_detection(sd)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>keep_long_repeats_separate(klrs)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
+	    </term>
+	    <listitem>
+	      <para> 
+		Default is is dependent on --job quality: currently <emphasis
+		role="underline">no</emphasis> for draft and <emphasis
+		role="underline">yes</emphasis> for accurate. Switched of for
+		EST assembly.
+	      </para>
+	      <para>
+		Tells mira to use keep repeats longer that the length of reads
+		in separate contigs.
+	      </para>
+	    </listitem>
+	  </varlistentry>
+	  <varlistentry>
+	    <term>
+	      <arg>spoiler_detection(sd)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para>
@@ -2008,7 +1598,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>sd_last_pass_only(sdlpo)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>sd_last_pass_only(sdlpo)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para>
@@ -2073,7 +1663,19 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>enforce_presence_of_qualities(epoq)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>base_default_quality(bdq)=<replaceable>integer ≥ 0</replaceable></arg>
+	    </term>
+	    <listitem>
+	      <para> Default is currently <emphasis
+	      role="underline">10</emphasis> for all sequencing
+	      technologies. Defines the default base quality of reads that
+	      have no quality read from file.
+	      </para>
+	    </listitem>
+	  </varlistentry>
+	  <varlistentry>
+	    <term>
+	      <arg>enforce_presence_of_qualities(epoq)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para>
@@ -2081,18 +1683,11 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 		to yes, MIRA will stop the assembly if any read has no quality
 		values loaded.
 	      </para>
-	      <note>
-		<arg>-AS:epoq</arg> switches on/off the quality check for a
-		complete sequencing technology. A more fine grained control
-		for switching checks of per readgroup is available via
-		the <emphasis>default_qual</emphasis> readgroup parameter in
-		the manifest file.
-	      </note>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>use_genomic_pathfinder(ugpf)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>use_genomic_pathfinder(ugpf)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para>
@@ -2121,7 +1716,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>use_emergency_search_stop(uess)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>use_emergency_search_stop(uess)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para>
@@ -2149,7 +1744,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>use_max_contig_buildtime(umcbt)=<replaceable>on|y[es]|t[rue],off|n[o]|f[alse]</replaceable></arg>
+	      <arg>use_max_contig_buildtime(umcbt)=<replaceable>on|yes|1,off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para>
@@ -2166,13 +1761,8 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	    </term>
 	    <listitem>
 	      <para> Default is
-	      <emphasis role="underline">3600</emphasis> for genome
-	      assemblies, <emphasis role="underline">720</emphasis> for EST
-	      assemblies with Sanger or 454
-	      and <emphasis role="underline">360</emphasis> for EST assemblies
-	      with Solexa or Ion Torrent. Depending on <arg>-AS:umcbt</arg>
-	      above, this number defines the time in seconds allocated to
-	      building one contig.
+	      <emphasis role="underline">10000</emphasis>. Depending on <arg>-AS:umcbt</arg> above, this number
+	      defines the time in seconds allocated to building one contig.
 	      </para>
 	    </listitem>
 	  </varlistentry>
@@ -2182,30 +1772,79 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
       </sect3>
       <sect3 id="sect_ref_strain_backbone_sb">
 	<title>
-	  Parameter group: -STRAIN/BACKBONE (-SB)
+	  -STRAIN/BACKBONE (-SB)
 	</title>
 	<para>
-	  Controlling backbone options in mapping assemblies:
+	  General options for controlling backbone options for mapping assemblies as
+	  well as general strain information.
 	</para>
 	<variablelist>
 	  <varlistentry>
 	    <term>
-	      <arg>bootstrap_new_backbone(bnb)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>load_straindata(lsd)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
+	    </term>
+	    <listitem>
+	      <para> Default is <emphasis
+	      role="underline">no</emphasis>. Straindata is a key value file,
+	      one read per line. First the name of the read, then the strain
+	      name of the organism the read comes from. It is used by the
+	      program to differentiate different types of SNPs appearing in
+	      organisms and classifying them.
+	      </para>
+	    </listitem>
+	  </varlistentry>
+	  <varlistentry>
+	    <term>
+	      <arg>assign_default_strain(ads)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
+	      <para> Default is <emphasis role="underline">no</emphasis> for
+	      <emphasis>de-novo</emphasis> assemblies and <emphasis
+	      role="underline">yes</emphasis> for
+	      <emphasis>mapping</emphasis>.
+	      </para>
 	      <para>
-		Default is <emphasis role="underline">yes</emphasis> for
-		mapping assemblies with Illumina data, no otherwise.
+		Defines whether, after having loaded all data from all
+		possible source, MIRA will assign a strain name to reads which
+		didn't get strain information via said data files (either NCBI
+		TRACEINFO XML files or the simple MIRA straindata files). The
+		strain name to assign the is determined via <arg>-SB:dsn</arg>
+		(see below).
 	      </para>
+	    </listitem>
+	  </varlistentry>
+	  <varlistentry>
+	    <term>
+	      <arg>default_strain_name(dsn)=<replaceable>string</replaceable></arg>
+	    </term>
+	    <listitem>
 	      <para>
-		When set to 'yes', MIRA will use a two stage mapping process
-		which bootstraps an intermediate backbone (reference) sequence
-		and greatly improves mapping accuracy at indel sites.
+		Default is <emphasis role="underline">StrainX</emphasis>.
+		Defines the strain name to assign to reads which don't have a
+		strain name after loading, works only if
+		<arg>-SB:ads=yes</arg> (see above).
+	      </para>
+	    </listitem>
+	  </varlistentry>
+	  <varlistentry>
+	    <term>
+	      <arg>load_backbone(lb)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
+	    </term>
+	    <listitem>
+	      <para>
+		Default is <emphasis role="underline">no</emphasis>. A
+		backbone is a sequence (or a previous assembly) that is used
+		as template for a mapping assembly. The current assembly
+		process will assemble reads first to those loaded backbone
+		contigs before creating new contigs (if any).
+	      </para>
+	      <para>
+		This feature is helpful for assembling against previous (and
+		already possibly edited) assembly iterations, or to make a
+		comparative assembly of two very closely related
+		organisms. Please read "very closely related" as in: only SNP
+		mutations or short indels present.
 	      </para>
-	      <note>
-		Currently only works with Illumina data, other sequencing
-		technologies will not be affected by this flag.
-	      </note>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
@@ -2222,7 +1861,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 		pass iteration (see <arg>-AS:nop</arg>) from which on the
 		backbones will be really used. In the passes preceding this
 		number, the non-backbone reads will be assembled together as
-		if no backbones existed.  This allows MIRA to correctly spot
+		if no backbones existed.  This allows mira to correctly spot
 		repetitive stretches that differ by single bases and tag them
 		accordingly. Note that full assemblies are considerably slower
 		than mapping assemblies, so be careful with this when
@@ -2238,15 +1877,75 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
+	      <arg>backbone_strainname(bsn)=<replaceable>string</replaceable></arg>
+	    </term>
+	    <listitem>
+	      <para>
+		Default is<emphasis
+		role="underline">ReferenceStrain</emphasis>. Defines the name
+		of the strain that the backbone sequences have.
+	      </para>
+	    </listitem>
+	  </varlistentry>
+	  <varlistentry>
+	    <term>
+	      <arg>backbone_strainname_forceforall(bsnffa)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
+	    </term>
+	    <listitem>
+	      <para>
+		Default is <emphasis role="underline">no</emphasis>. Useful
+		when using CAF as input for backbone: forces all reads of the
+		backbone contigs to get assigned the new backbone strain, even
+		if they previously had other strains assigned.
+	      </para>
+	      <para>
+		Main usage is in multi-step hybrid assemblies.
+	      </para>
+	    </listitem>
+	  </varlistentry>
+	  <varlistentry>
+	    <term>
+	      <arg>backbone_strain_name(bsn)=<replaceable>string</replaceable></arg>
+	    </term>
+	    <listitem>
+	      <para> Default is Default is an empty string. Useful when using
+	      CAF as input for backbone: when set to a given strain name, mira
+	      will internally use only reads from the given strain to build
+	      the rails it will use to align reads.
+	      </para>
+	      <para>
+		Main usage is in multi-step hybrid assemblies.
+	      </para>
+	    </listitem>
+	  </varlistentry>
+	  <varlistentry>
+	    <term>
+	      <arg>backbone_filetype(bft)=<replaceable>fasta, caf, gbf</replaceable></arg>
+	    </term>
+	    <listitem>
+	      <para> Default is
+	      <emphasis role="underline">fasta</emphasis>. Defines the
+	      filetype of the backbone file given.  Currently only FASTA, CAF
+	      and GBF files are supported.
+	      </para>
+	      <para>
+		When GBF (GenBank files, more commonly named '.gbk') files are
+		loaded, the features within theses files are automatically
+		transformed into Staden compatible tags and get passed through
+		the assembly.
+	      </para>
+	    </listitem>
+	  </varlistentry>
+	  <varlistentry>
+	    <term>
 	      <arg>backbone_raillength(brl)=<replaceable>0 ≤ integer ≤ 10000</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para> Default
-	      is <emphasis role="underline">0</emphasis>. Parameter for the
-	      internal sectioning size of the backbone to compute optimal
-	      alignments. Should be set to two times length of longest read in
-	      input data + 15%. When set to 0, MIRA will compute optimal
-	      values from the data loaded.
+	      is <emphasis role="underline">0</emphasis>. Parameter for the internal sectioning size of the backbone
+	      to compute optimal alignments. Should be set to two times length of longest read in
+	      input data + 15%. When set to 0, MIRA will compute optimal values from the
+	      data loaded.
 	      </para>
 	    </listitem>
 	  </varlistentry>
@@ -2255,78 +1954,50 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	      <arg>backbone_railoverlap(bro)=<replaceable>0 ≤ integer ≤ 2000</replaceable></arg>
 	    </term>
 	    <listitem>
-	      <para> Default is <emphasis role="underline">0</emphasis>.
-	      Parameter for the internal sectioning size of the backbone to
-	      compute optimal alignments. Should be set to length of the
-	      longest read. When set to 0, MIRA will compute optimal values
-	      from the data loaded.
+	      <para> Default
+	      is <emphasis role="underline">0</emphasis>.  Parameter for the internal sectioning size of the
+	      backbone to compute optimal alignments. Should be set to length of
+	      the longest read. When set to 0, MIRA will compute optimal values from the
+	      data loaded.
 	      </para>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>trim_overhanging_reads(tor)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>backbone_basequality(bbq)=<replaceable>-1 ≤ integer ≤ 100</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para>
-		Default is <emphasis role="underline">yes</emphasis>.
-	      </para>
-	      <para>
-		When set to 'yes', MIRA will trim back reads at end of contigs
-		which outgrow the reference sequence so that boundaries of
-		the reference and the mapped reads align perfectly. That is,
-		the mapping does not perform a sequence extension.
+		Default is <emphasis role="underline">-1</emphasis>. Defines the default quality that the
+		backbone sequences have if they came without quality values in their files
+		(like in GBF format or when FASTA is used without .qual files). A value of
+		-1 mira to use the same default quality for backbones as for reads.
 	      </para>
-	      <note>
-		The trimming is performed via setting low quality cutoffs in
-		the reads, i.e., the trimmed parts are not really gone but
-		just not part of the active contig anymore. They can be
-		uncovered when working on the assembly in finishing programs
-		like, e.g., <command>gap4</command>
-		or <command>gap5</command>.
-	      </note>
-	      <warning>
-		Previous versions of MIRA (up to and including 3.9.18) behaved
-		as if this option had been set to 'no'. This is a major change
-		in behaviour, but it is also what probably most people expect
-		from a mapping.
-	      </warning>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>also_build_new_contigs(abnc)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>also_build_new_contigs(abnc)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para>
-		Default is <emphasis role="underline">no</emphasis>. Standard
-		mapping assembly mode of the assembler is to map available
-		reads to a backbone and discard reads that do not fit.  If set
-		to 'yes', MIRA will use reads that did not map to the
-		backbone(s) to make new contigs (if possible). Please note:
-		while a simple mapping assembly is comparatively cheap in
-		terms of memory and time consumed, setting this option to
-		'yes' means that behind the scenes data for a full blown
-		de-novo assembly is generated in addition to the data needed
-		for a mapping assembly. This means, that in terms of memory
-		consumption and speed, this switch combines the worst of both
-		worlds.
+		Default is <emphasis role="underline">no</emphasis>. Standard mapping assembly mode of the assembler
+		is to map available reads to a backbone and discard reads that do not fit.
+		If set to 'yes', mira will use reads that did not map to the
+		backbone(s) to make new contigs (if possible). Please note: while a simple
+		mapping assembly is comparatively cheap in terms of memory and time
+		consumed, setting this option to 'yes' means that behind the scenes data for
+		a full blown de-novo assembly is generated in addition to the data needed
+		for a mapping assembly, which makes it a bit more costly that a de-novo
+		assembly per se.
 	      </para>
-	      <warning>
-		Using this switch is not recommended. Beside the memory and
-		speed considerations, a lot of different algorithms cannot
-		work optimally in this mode. I recommend to use a two step
-		approach instead: first map with MIRA, then assemble de-novo
-		all reads which did not map. This will lead more often than
-		not to the results expected (and in shorter time).
-	      </warning>
 	    </listitem>
 	  </varlistentry>
 	</variablelist>
       </sect3>
       <sect3 id="sect_ref_dataprocessing_dp">
 	<title>
-	  Parameter group: -DATAPROCESSING (-DP)
+	  -DATAPROCESSING (-DP)
 	</title>
 	<para>
 	  Options for controlling some data processing during the assembly.
@@ -2334,12 +2005,12 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	<variablelist>
 	  <varlistentry>
 	    <term>
-	      <arg>use_read_extension(ure)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>use_read_extension(ure)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para> Default
 	      is dependent of the sequencing technology used: <emphasis role="underline">yes</emphasis> for Sanger,
-	      no for all others. MIRA expects the sequences it is given to be
+	      no for all others. mira expects the sequences it is given to be
 	      quality clipped. During the assembly though, it will try to extend reads
 	      into the clipped region and gain additional coverage by analysing
 	      Smith-Waterman alignments between reads that were found to be valid. Only
@@ -2386,7 +2057,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	      routines can be called before assembly and/or after each assembly pass (see
 	      <arg>-AS:nop</arg>). This parameter defines the first pass in which the read
 	      extension routines are called. The default of <emphasis role="underline">0</emphasis> tells
-	      MIRA to extend the reads the first time before the first assembly
+	      mira to extend the reads the first time before the first assembly
 	      pass.
 	      </para>
 	    </listitem>
@@ -2402,16 +2073,20 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	      routines can be called before assembly and/or after each assembly pass (see
 	      <arg>-AS:nop</arg>). This parameter defines the last pass in which the read
 	      extension routines are called. The default of <emphasis role="underline">0</emphasis> tells
-	      MIRA to extend the reads the last time before the first assembly
+	      mira to extend the reads the last time before the first assembly
 	      pass.
 	      </para>
+	      <para>
+	      </para>
 	    </listitem>
 	  </varlistentry>
 	</variablelist>
+	<para>
+	</para>
       </sect3>
       <sect3 id="sect_ref_clipping_cl">
 	<title>
-	  Parameter group: -CLIPPING (-CL)
+	  -CLIPPING (-CL)
 	</title>
 	<para>
 	  Controls for clipping options: when and how sequences should be clipped.
@@ -2424,18 +2099,90 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	<variablelist>
 	  <varlistentry>
 	    <term>
+	      <arg>merge_ssahasmaltvectorscreen(msvs)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
+	    </term>
+	    <listitem>
+	      <para>
+		Default is <emphasis role="underline">no</emphasis>. Uses the
+		parameters
+		<arg>-CL:msvsgs:msvsmfg:msvsmeg</arg> (see below).
+	      </para>
+	      <para>
+		Before running mira, the <command>ssaha2</command> or
+		<command>smalt</command> programs from the Sanger centre can
+		be used to detect possible vector sequence stretches in the
+		input data for the assembly.  This parameter - if set to
+		<emphasis role="underline">yes</emphasis> - will let mira load
+		the result file of a ssaha2 or smalt run and tag the possible
+		vector sequences at the ends of reads.
+	      </para>
+	      <para>
+		ssaha2 must be called like this "<literal>ssaha2
+		<ssaha2options> vector.fasta sequences.fasta</literal>"
+		to generate an output that can be parsed by mira. In the above
+		example, replace <filename>vector.fasta</filename> by the name
+		of the file with your vector sequences and
+		<filename>sequences.fasta</filename> by the name of the file
+		containing your sequencing data.
+	      </para>
+	      <para>
+		smalt must be called like this: "<literal>smalt map -f ssaha
+		<ssaha2options> hash_index sequences.fasta</literal>"
+	      </para>
+	      <para>
+		This makes you basically independent from any other commercial
+		or license-requiring vector screening software. For Sanger
+		reads, a combination of <command>lucy</command> and
+		<command>ssaha2</command> or <command>smalt</command> together
+		with this parameter should do the trick. For reads coming from
+		454 pyro-sequencing, <command>ssaha2</command> or
+		<command>smalt</command> and this parameter will also work
+		very well. See the usage manual for a walkthrough example on
+		how to use SSAHA2 / SMALT screening data.
+	      </para>
+	      <para>
+		Note 1: the output format of SSAHA2 must the native output
+		format (<literal>-output ssaha2</literal>). For SMALT, the
+		output option <literal>-f ssaha</literal> must be used. Other
+		formats cannot be parsed by MIRA.
+	      </para>
+	      <para>
+		Note 2: when using SSAHA2 results, the input file must be
+		named
+		<filename><projectname>_ssaha2vectorscreen_in.txt</filename>. When
+		using SMALT results, the input file must be named
+		<filename><projectname>_smaltvectorscreen_in.txt</filename>.
+	      </para>
+	      <para>
+		Note 3: if both a ssah2 and smalt result file are present,
+		both will be read.
+	      </para>
+	      <para>
+		Note 4: I currently use the following SSAHA2 options:
+		<literal>-kmer 8 -skip 1 -seeds 1 -score 12 -cmatch 9 -ckmer
+		6</literal>
+	      </para>
+	      <para>
+		Note 5: Anyone contributing SMALT parameters?
+	      </para>
+	      <para>
+		Note 6: the sequence vector clippings generated from SSAHA2 /
+		SMALT data do not replace sequence vector clippings loaded via
+		the EXP, CAF or XML files, they rather extend them.
+	      </para>
+	    </listitem>
+	  </varlistentry>
+	  <varlistentry>
+	    <term>
 	      <arg>msvs_gap_size(msvsgs)=<replaceable>integer ≥ 0</replaceable></arg>
 	    </term>
 	    <listitem>
-	      <para>
-		Default is dependent of the sequencing technology used. Takes
-		effect only when loading data from ancillary SSAHA2 or SMALT
-		files.
-	      </para>
-	      <para>
-		While performing the clip of screened vector sequences, MIRA
-		will look if it can merge larger chunks of sequencing vector
-		bases that are a maximum of <arg>-CL:msvgsgs</arg> apart.
+	      <para> Default is dependent of the sequencing technology
+	      used. Takes effect only if <arg>-CL:msvs</arg> is <emphasis
+	      role="underline">yes</emphasis>.  While performing the clip of
+	      screened vector sequences, mira will look if it can merge larger
+	      chunks of sequencing vector bases that are a maximum of
+	      <arg>-CL:msvgsgs</arg> apart.
 	      </para>
 	    </listitem>
 	  </varlistentry>
@@ -2444,15 +2191,11 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	      <arg>msvs_max_front_gap(msvsmfg)=<replaceable>integer ≥ 0</replaceable></arg>
 	    </term>
 	    <listitem>
-	      <para>
-		Default is dependent of the sequencing technology used. Takes
-		effect only when loading data from ancillary SSAHA2 or SMALT
-		files.
-	      </para>
-	      <para>
-		While performing the clip of screened vector sequences at the
-		start of a sequence, MIRA will allow up to this number of
-		non-vector bases in front of a vector stretch.
+	      <para> Default is
+	      dependent of the sequencing technology used. Takes effect only if
+	      <arg>-CL:msvs</arg> is <emphasis role="underline">yes</emphasis>.  While performing the clip of
+	      screened vector sequences at the start of a sequence, mira will allow
+	      up to this number of non-vector bases in front of a vector stretch.
 	      </para>
 	    </listitem>
 	  </varlistentry>
@@ -2461,28 +2204,24 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	      <arg>msvs_max_end_gap(msvsmeg)=<replaceable>integer ≥ 0</replaceable></arg>
 	    </term>
 	    <listitem>
-	      <para>
-		Default is dependent of the sequencing technology used. Takes
-		effect only when loading data from ancillary SSAHA2 or SMALT
-		files.
-	      </para>
-	      <para>
-		While performing the clip of screened vector sequences at the
-		end of a sequence, MIRA will allow up to this number of
-		non-vector bases behind a vector stretch.
+	      <para> Default is
+	      dependent of the sequencing technology used. Takes effect only if
+	      <arg>-CL:msvs</arg> is <emphasis role="underline">yes</emphasis>.  While performing the clip of
+	      screened vector sequences at the end of a sequence, mira will allow
+	      up to this number of non-vector bases behind a vector stretch.
 	      </para>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>possible_vector_leftover_clip(pvlc)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>possible_vector_leftover_clip(pvlc)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para>
 		Default is dependent of the sequencing technology
 		used: <emphasis role="underline">yes</emphasis> for
 		Sanger, <emphasis role="underline">no</emphasis> for any
-		other. MIRA will try to identify possible sequencing vector
+		other. mira will try to identify possible sequencing vector
 		relics present at the start of a sequence and clip them
 		away. These relics are usually a few bases long and were not
 		correctly removed from the sequence in data preprocessing
@@ -2532,11 +2271,11 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>quality_clip(qc)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>quality_clip(qc)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para> Default is
-	      <emphasis role="underline">no</emphasis>. This will let MIRA
+	      <emphasis role="underline">no</emphasis>. This will let mira
 	      perform its own quality clipping before sequences are entered
 	      into the assembly. The clip function performed is a sequence end
 	      window quality clip with back iteration to get a maximum number
@@ -2582,7 +2321,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>bad_stretch_quality_clip (bsqc)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>bad_stretch_quality_clip (bsqc)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para> Default is <emphasis role="underline">no</emphasis>. This
@@ -2590,7 +2329,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 		and have unclipped bad quality stretches that might prevent a
 		good assembly.
 	      </para>
-	      <para> MIRA will search the sequence in forward direction for a
+	      <para> mira will search the sequence in forward direction for a
 		stretch of bases that have in average a quality less than a
 		defined threshold and then set the right quality clip of this
 		sequence to cover the given stretch.
@@ -2622,18 +2361,18 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>maskedbases_clip(mbc)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>maskedbases_clip(mbc)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para> Default is
-	      dependent of the sequencing technology used. This will let MIRA
+	      dependent of the sequencing technology used. This will let mira
 	      perform a 'clipping' of bases that were masked out (replaced with the
 	      character X). It is generally not a good idea to use mask bases to remove
 	      unwanted portions of a sequence, the EXP file format and the NCBI traceinfo
 	      format have excellent possibilities to circumvent this. But because a lot of
 	      preprocessing software are built around cross_match, scylla-
-	      and phrap-style of base masking, the need arose for MIRA to
-	      be able to handle this, too.  MIRA will look at the start and end of
+	      and phrap-style of base masking, the need arose for mira to
+	      be able to handle this, too.  mira will look at the start and end of
 	      each sequence to see whether there are masked bases that should be
 	      'clipped'.
 	      </para>
@@ -2646,7 +2385,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	    <listitem>
 	      <para> Default is dependent of
 	      the sequencing technology used. While performing the clip of masked bases,
-	      MIRA will look if it can merge larger chunks of masked bases that are
+	      mira will look if it can merge larger chunks of masked bases that are
 	      a maximum of <arg>-CL:mbcgs</arg> apart.
 	      </para>
 	    </listitem>
@@ -2658,7 +2397,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	    <listitem>
 	      <para> Default is
 	      dependent of the sequencing technology used. While performing the clip of
-	      masked bases at the start of a sequence, MIRA will allow up to this
+	      masked bases at the start of a sequence, mira will allow up to this
 	      number of unmasked bases in front of a masked stretch.
 	      </para>
 	    </listitem>
@@ -2670,36 +2409,20 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	    <listitem>
 	      <para> Default is
 	      dependent of the sequencing technology used. While performing the clip of
-	      masked bases at the end of a sequence, MIRA will allow up to this
+	      masked bases at the end of a sequence, mira will allow up to this
 	      number of unmasked bases behind a masked stretch.
 	      </para>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>lowercase_clip_front(lccf)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
-	    </term>
-	    <listitem>
-	      <para> Default is
-	      dependent of the sequencing technology used: on for 454 and Ion
-	      Torrent data, off for all
-	      others. This will let MIRA perform a 'clipping' of bases that are in
-	      lowercase at the front end of a sequence, leaving only the uppercase
-	      sequence. Useful when handling 454 data that does not have ancillary data in
-	      XML format.
-	      </para>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term>
-	      <arg>lowercase_clip_back(lccb)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>lowercase_clip(lcc)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para> Default is
-	      dependent of the sequencing technology used: on for 454 and Ion
-	      Torrent data, off for all
-	      others. This will let MIRA perform a 'clipping' of bases that are in
-	      lowercase at the back end of a sequence, leaving only the uppercase
+	      dependent of the sequencing technology used: on for 454 data, off for all
+	      others. This will let mira perform a 'clipping' of bases that are in
+	      lowercase at both ends of a sequence, leaving only the uppercase
 	      sequence. Useful when handling 454 data that does not have ancillary data in
 	      XML format.
 	      </para>
@@ -2707,73 +2430,45 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>clip_polyat(cpat)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>clip_polyat(cpat)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para> Default is
-	      <emphasis role="underline">yes</emphasis> for all EST/RNASeq
-	      assemblies. Poly-A stretches in forward reads and poly-T
-	      stretches in reverse reads get either clipped or tagged here
-	      (see <arg>-CL:cpkps</arg> below). The assembler will not use
-	      these stretches for finding overlaps, but it will use these to
-	      discern and disassemble different 3' UTR endings.
+	      <emphasis role="underline">no</emphasis>. This option is useful in EST assembly. Poly-A stretches in
+	      forward reads and poly-T stretches in reverse reads that were not correctly
+	      masked or clipped in preprocessing steps from external programs get clipped
+	      or tagged here. The assembler will not use these stretches for critical
+	      operations. 
 	      </para>
-	      <warning>
-		Should poly-A / poly-T stretches have been trimmed in
-		pre-processing steps before MIRA got the reads, this option
-		MUST be switched off.
-	      </warning>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>cp_keep_poly_stretch (cpkps)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>cp_keep_poly_signal (cpkps)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para> Default is
-	      <emphasis role="underline">yes</emphasis> but takes effect only
-	      if <arg>-CL:cpat</arg> (see above) is also set to yes.
+	      <emphasis role="underline">no</emphasis>. This option is
+	      currently <emphasis role="bold">not active</emphasis> (as of
+	      version 2.9.22).
 	      </para>
 	      <para>
-		Instead of clipping the poly-A / poly-T sequence away, the
-		stretch in question in the reads is kept and tagged. The tags
-		provide additional information for MIRA to discern between
-		different 3' UTR endings and alse a good visual anchor when
+		In future, this will allow to keep the poly-A signal in the
+		reads and tag them. The tags provide a good visual anchor when
 		looking at the assembly with different programs.
 	      </para>
-	      <note>
-		One side-effect of this option is that the poly-A / poly-T
-		stretch are 'cleaned'. That is, single non-poly A / poly-T
-		bases within the stretch are automatically edited to be
-		conforming to the surrounding stretch. This is necessary as
-		homopolymers are by nature one of the hardest motifs to be
-		sequenced correctly by any sequencing technology and one
-		frequently gets 'dirty' poly-A sequence from sequencing and
-		this interferes heavily with the methods MIRA uses to discern
-		repeats.
-	      </note>
-	      <note>
-		Keeping the poly-A sequence is a two-edged sword: on one hand it
-		enabled to discern different 3' UTR endings, on the other hand
-		it might be that sequencing problems toward the end of reads
-		create false-positive different endings. If you find that this
-		is the case for your data, just switch off this option: MIRA
-		will then simply build the longest possible 3' UTRs.
-	      </note>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>cp_min_sequence_len(cpmsl)=<replaceable>integer >
-	      0</replaceable></arg>
+	      <arg>cp_min_signal_len(cpmsl)=<replaceable>integer > 0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para> Default is
-	      <emphasis role="underline">10</emphasis>. Only takes effect
-	      when <arg>-CP:cpat</arg> (see above) is set
-	      to <emphasis role="underline">yes</emphasis>. Defines the number
-	      of 'A' (in forward direction) or 'T' (in reverse direction) must
-	      be present to be considered a poly-A sequence stretch.
+	      <emphasis role="underline">10</emphasis>. Only takes effect when <arg>-CP:cpat</arg> (see above) is
+	      set to <emphasis role="underline">yes</emphasis>. Defines the number of ``A'' (in forward direction)
+	      or ``T'' (in reverse direction'' must be present to be considered a poly-A
+	      signal stretch.
 	      </para>
 	    </listitem>
 	  </varlistentry>
@@ -2783,11 +2478,9 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	    </term>
 	    <listitem>
 	      <para> Default is
-	      <emphasis role="underline">1</emphasis>. Only takes effect
-	      when <arg>-CL:cpat</arg> (see above) is set
-	      to <emphasis role="underline">yes</emphasis>. Defines the
-	      maximum number of errors allowed in the potential poly-A
-	      sequence stretch. The distribution of these errors is not
+	      <emphasis role="underline">1</emphasis>. Only takes effect when <arg>-CL:cpat</arg> (see above) is set
+	      to <emphasis role="underline">yes</emphasis>. Defines the maximum number of errors allowed in the
+	      potential poly-A signal stretch. The distribution of these errors is not
 	      important.
 	      </para>
 	    </listitem>
@@ -2797,45 +2490,17 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	      <arg>cp_max_gap_from_end(cpmgfe)=<replaceable>integer > 0</replaceable></arg>
 	    </term>
 	    <listitem>
-	      <para> Default is <emphasis role="underline">9</emphasis>. Only
-	      takes effect when <arg>-CL:cpat</arg> (see above) is set
-	      to <emphasis role="underline">yes</emphasis>.Defines the number
-	      of bases from the end of a sequence (if masked: from the end of
-	      the masked area) within which a poly-A sequence stretch is
-	      looked for.
-	      </para>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term>
-	      <arg>clip_3ppolybase (c3pp)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
-	    </term>
-	    <listitem>
-	      c3p* options to be described ...
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term>
-	      <arg>clip_known_adaptorsright (ckar)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
-	    </term>
-	    <listitem>
-	      <para>
-		Default is <emphasis role="underline">yes</emphasis>. Defines
-		whether MIRA should search and clip known sequencing technology
-		specific sequencing adaptors. MIRA knows adaptors for Illumina
-		best, followed by Ion Torrent and some 454 adaptors.
-	      </para>
-	      <para>
-		As the list of known adaptors changes quite frequently, the
-		best place to get a list of known adaptors by MIRA is by
-		looking at the text files in the program
-		sources: <filename>src/mira/adaptorsforclip.*.xxd</filename>.
+	      <para> Default
+	      is <emphasis role="underline">9</emphasis>. Only takes effect when <arg>-CL:cpat</arg> (see above) is
+	      set to <emphasis role="underline">yes</emphasis>.Defines the number of bases from the end of a
+	      sequence (if masked: from the end of the masked area) within which a
+	      poly-A signal stretch is looked for.
 	      </para>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>ensure_minimum_left_clip(emlc)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>ensure_minimum_left_clip(emlc)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para>
@@ -2871,7 +2536,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>ensure_minimum_right_clip(emrc)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>ensure_minimum_right_clip(emrc)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para>
@@ -2907,90 +2572,58 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>gb_chimeradetectionclip(gbcdc)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
-	    </term>
-	    <listitem>
-	      <para>
-		Default is <emphasis role="underline">yes</emphasis> for all jobs.
-	      </para>
-	      <para>
-		Very safe chimera detection, should have no false
-		positives. For repetitive data, a low number of false
-		negatives is possible.
-	      </para>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term>
-	      <arg>kmerjunk_detection(kjd)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>apply_skim_chimeradetectionclip(ascdc)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para>
-		Default is currently <emphasis role="underline">yes</emphasis>.
-	      </para>
-	      <para>
-		Reads that look "fishy" are marked as potentially
-		chimeric. This mark leads either to a read being completely
-		killed or to a read being included into a contig only if no
-		other possibility remains.
+		Default is <emphasis role="underline">yes</emphasis> for
+		<arg>--job=genome</arg> assemblies and <emphasis role="underline">no</emphasis>
+		for <arg>--job=est</arg> assemblies.
 	      </para>
 	      <para>
-		It is currently suggested to leave this parameter switched on
-		and to fine-tune via <arg>-CL:kjck</arg> (see below).
+		The SKIM routines of MIRA can be also used without much time
+		overhead to find chimeric reads. When this parameter is set,
+		MIRA will use that info to cut back chimeras to their longest
+		non-chimeric length.
 	      </para>
+	      <warning>
+		When working on low coverage data (e.g. < 5 to 6x Sanger
+		and < 10x 454 or 10x Ion Torrent, you may want to switch
+		off this option if you try to go for the longest
+		contigs. Reason: single reads joining otherwise disjunct
+		contigs will probably be categorised as chimeras.
+	      </warning>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>kmerjunk_completekill(kjck)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>apply_skim_junkdetectionclip(asjdc)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para>
-		Default is currently <emphasis role="underline">no</emphasis>
-		for genome assemblies and <emphasis
-		role="underline">yes</emphasis> for EST/RNASeq assemblies.
+		Default is currently <emphasis role="underline">no</emphasis>.
 	      </para>
 	      <para>
-		If set to yes, reads marked as junk (see above) are completely
-		removed from an assembly. If set to no, reads are not removed
-		but included only into a contig as a very last resort.
+		The SKIM routines of MIRA can be also used without much time
+		overhead to find junk sequence at end of reads. When this parameter is set,
+		MIRA will use that info to cut back junk in reads.
 	      </para>
 	      <para>
-		Having reads killed guarantees assemblies of extremely high
-		quality containing virtually no missassembly due to chimeric
-		sequencing errors. The downside is that, computationally,
-		there is no difference between junk and stretches with correct
-		but very low coverage data (generally < 3x coverage). It's
-		up to you to decide what is more important: total accuracy or
-		longer contigs.
+		It is currently suggested to leave this parameter switched off
+		as the routines seem to be a bit too "trigger happy" and also
+		cut back perfectly valid sequences.
 	      </para>
-	      <note>
-		<para>
-		  As a rule of thumb: I set this to no for genome assemblies
-		  with at least medium average coverage (≥ 20-30x) as MIRA
-		  does a pretty good job to incorporate these reads so late in
-		  an assembly that they do not lead to misassemblies. In
-		  transcript assemblies I set this to yes as there is a high
-		  chance that high coverage transcripts could be extended via
-		  chimeric reads.
-		</para>
-		<para>
-		  With this in mind: deciding for metagenome assemblies would
-		  be really difficult though. It probably depends on what you
-		  need the data for.
-		</para>
-	      </note>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>propose_end_clips(pec)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>propose_end_clips(pec)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
-	      <para>
+	      <para> 
 		Default is is dependent on --job quality: currently <emphasis
 		role="underline">yes</emphasis> for all genome assemblies.
-		Switched off for EST assemblies (but one might want to switch
+		Switched off for EST assemblies (but one wmight want to switch
 		it on sometimes).
 	      </para>
 	      <para>
@@ -3003,18 +2636,18 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	      </para>
 	      <warning>
 		Extremely effective, but should NOT be used for very low
-		coverage genomic data, or for EST projects if one wants to
-		retain the rareest transcripts.
+		coverage genomic data, for EST projects or if one wants to
+		retain rare transcripts.
 	      </warning>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>handle_solexa_ggcxg_problem(pechsgp)=<replaceable>on|y[es]|t[rue],
-	      off|n[o]|f[alse]</replaceable></arg>
+	      <arg>handle_solexa_ggcxg_problem(pechsgp)=<replaceable>on|yes|1,
+	      off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
-	      <para>
+	      <para> 
 		Default is is dependent <emphasis
 		role="underline">yes</emphasis>.
 	      </para>
@@ -3035,156 +2668,51 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>pec_kmer_size(peckms)=<replaceable>10 ≤ integer ≤ 32</replaceable></arg>
+	      <arg>pec_bases_per_hash(pecbph)=<replaceable>integer ≥ 10</replaceable></arg>
 	    </term>
 	    <listitem>
-	      <para>
-		Default is is dependent on technology and quality in the --job
-		switch: usually
-		between <emphasis role="underline">17</emphasis>
-		and <emphasis role="underline">21</emphasis> for Sanger,
-		higher for 454 (up to
-		<emphasis role="underline">27</emphasis>) and highest for
-		Solexa (<emphasis role="underline">31</emphasis>). Ion Torrent
-		has at the moment <emphasis role="underline">17</emphasis>,
-		but this may change in the future to somewhat higher values.
+	      <para> Default is is dependent on technology and quality in the
+	      --job switch: usually between <emphasis
+	      role="underline">17</emphasis> and <emphasis
+	      role="underline">21</emphasis> for Sanger, higher for 454 (up to
+	      <emphasis role="underline">27</emphasis>) and highest for Solexa
+	      (<emphasis role="underline">31</emphasis>). Ion Toorent has at
+	      the moment <emphasis role="underline">17</emphasis>, but this
+	      may change in the future to somewhat higher values.
 	      </para>
 	      <para>
 		This parameter defines the minimum number of bases at each end
-		of a read that should be free of any sequencing errors.
-	      </para>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term>
-	      <arg>pec_minimum_kmer_forward_reverse(pmkfr)=<replaceable>integer ≥ 0</replaceable></arg>
-	    </term>
-	    <listitem>
-	      <para>
-		Default is is dependent on technology and quality in the --job
-		switch: usually
-		between <emphasis role="underline">1</emphasis>
-		and <emphasis role="underline">3</emphasis>
-		when <arg>-CL:pec=yes</arg>.
-	      </para>
-	      <para>
-		This parameter defines the minimum number of occurrence of a
-		kmer at each end of a read that should be free of any
-		sequencing errors.
-	      </para>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term>
-	      <arg>rare_kmer_mask(rkm)=<replaceable>on|y[es]|t[rue],
-	      off|n[o]|f[alse]</replaceable></arg>
-	    </term>
-	    <listitem>
-	      <para>
-		Default is is dependent on --job switch: currently
-		it's <emphasis role="underline">yes</emphasis> for Solexa data
-		and <emphasis role="underline">no</emphasis> otherwise.  If
-		this parameter is active, MIRA will completely mask with 'X'
-		those parts of a read which have kmer occurrence (in forward
-		and reverse direction) less than the value specified
-		via <arg>-CL:pmkfr</arg>.
-	      </para>
-	      <para>
-		This is a quality ensuring move which improves assembly of
-		ultra-high coverage contigs by cleaning out very likely, low
-		frequency sequence dependent sequencing errors which passed
-		all previous filters. The drawback is that very rare
-		transcripts or very lowly covered genome parts with an
-		occurrence less than the given value will also be masked
-		out. However, Illumina gives so much data that this is almost
-		never the case.
-	      </para>
-	      <note>
-		This works only if <arg>-CL:pec</arg> is active.
-	      </note>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term>
-	      <arg>search_phix174(spx174)=<replaceable>on|y[es]|t[rue],
-	      off|n[o]|f[alse]</replaceable></arg>
-	    </term>
-	    <listitem>
-	      <para> Default is <emphasis>on</emphasis> for Illumina data, off
-	      otherwise.
-	      </para>
-	      <para>
-		PhiX 174 is a small phage of enterobacteria whose DNA is often
-		spiked-in during Illumina sequencing to determine error rates
-		in datasets and to increase complexity in low-complexity
-		samples (amplicon, chipseq etc) to help in cluster
-		identification.
-	      </para>
-	      <para>
-		If it remains in the sequenced data, it has to be
-		seen as a contaminant for projects working with organisms
-		which should not contain the PhiX 174 phage.
-	      </para>
-	      <note>
-		However, PhiX may be part of some genome sequences
-		(enterobacteria). In these cases, the PhiX174 search will
-		report genuine genome data.
-	      </note>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term>
-	      <arg>filter_phix174(fpx174)=<replaceable>on|y[es]|t[rue],
-	      off|n[o]|f[alse]</replaceable></arg>
-	    </term>
-	    <listitem>
-	      <para> Default is <emphasis>on</emphasis> for Illumina data in
-	      EST (RNASeq) assemblies, off otherwise.
-	      </para>
-	      <para>
-		If <arg>-CL:spx174</arg> is on and <arg>-CL:fpx174</arg> also,
-		MIRA will filter out as contaminants all reads which have
-		PhiX174 sequence recognised.
-	      </para>
-	      <para>
-		The default value of having the filtering on only for Illumina
-		EST (RNASeq) data is a conservative approach: the overwhelming
-		majority of RNASeq data will indeed not sequence some
-		enterobacteria, so having PhiX174 containing reads thrown out
-		is indeed a valid move. For genomes however, MIRA currently is
-		cautious and will not filter these reads by default.
+		of a read that should be free of any sequencing errors. Note
+		that the algorithm is based on SKIM hashing (see below), and
+		compares hashes of all reads with each other. Therefore, using
+		values less than 12 will lead to false negative hits.
 	      </para>
-	      <warning>
-		However, PhiX may be part of some genome sequences
-		(enterobacteria). In these cases, the PhiX174 filter will
-		remove reads from valid genome or expression data.
-	      </warning>
 	    </listitem>
 	  </varlistentry>
 	</variablelist>
+	<para>
+	</para>
       </sect3>
       <sect3 id="sect_ref_skim_sk">
 	<title>
-	  Parameter group: -SKIM (-SK)
+	  -SKIM (-SK)
 	</title>
 	<para>
 	  Options that control the behaviour of the initial fast all-against-all read
 	  comparison algorithm. Matches found here will be confirmed later in the
 	  alignment phase. The new SKIM3 algorithm that is in place since version 2.7.4
-	  uses a kmer based algorithm that works similarly to SSAHA (see Ning Z, Cox AJ,
+	  uses a hash based algorithm that works similarly to SSAHA (see Ning Z, Cox AJ,
 	  Mullikin JC; "SSAHA: a fast search method for large DNA databases."; Genome
 	  Res. 2001;11;1725-9).
 	</para>
 	<para>
-	  The major differences of SKIM3 and SSAHA are:
+	  The major differences of SKIM3 and SSAHA are: 
 	</para>
 	<orderedlist>
 	  <listitem>
 	    <para>
-	      the word length <emphasis>n</emphasis> of a kmer (hash) in
-	      SSAHA2 must be < 15, but can be up to 32 bases in 64 bit
-	      versions of MIRA < 4.0.2 and lower, and up to 256 bases for
-	      higher versions of MIRA.
+	      the word length <emphasis>n</emphasis> of a hash can be up to 31
+	      bases (in 64 bit versions of MIRA)
 	    </para>
 	  </listitem>
 	  <listitem>
@@ -3197,6 +2725,8 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  </listitem>
 	</orderedlist>
 	<para>
+	</para>
+	<para>
 	  The parameters for SKIM3:
 	</para>
 	<variablelist>
@@ -3221,67 +2751,45 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>also_compute_reverse_complements(acrc)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>also_compute_reverse_complements(acrc)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
-	      <para>
+	      <para> 
 		Default is <emphasis role="underline">on</emphasis>. Defines
 		whether SKIM searches for matches only in forward/forward
 		direction or whether it also looks for forward/reverse
 		direction.
 	      </para>
-	      <para>
+	      <para> 
 		You usually will not want to touch the default, except for very
 		special application cases where you do not want MIRA to use
 		reverse complement sequences at all.
-	      </para>
+	      </para> 
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>kmer_size(kms)=<replaceable>10 < integer ≤ 256</replaceable></arg>
+	      <arg>bases_per_hash(bph)=<replaceable>10 < integer ≤ 32</replaceable></arg>
 	    </term>
 	    <listitem>
-	      <para>
-		Defaults are dependent on "--job" switch and sequencing
-		technologies used.
-	      </para>
-	      <para>
-		Controls the number of consecutive bases
-		<emphasis>n</emphasis> which are used as a kmer. The
-		higher the value, the faster the search. The lower the value,
-		the slower the search and the more weak matches are found.
-	      </para>
-	      <para>
-		A secondary effect of this parameter is the estimation of MIRA
-		on whether stretches within a read sequence are repetitive or
-		not. Large values of <arg>-SK:kms</arg> allow a better
-		distinction between "almost identical" repeats early in the
-		assembly process and, given enough coverage, generally lead to
-		less and longer contigs.
+	      <para> Controls the number of consecutive bases $n$ which are
+		used as a word hash. The higher the value, the faster the
+		search. The lower the value, the more weak matches are
+		found. Values below 10 are not recommended. Defaults are
+		dependend on "--job" switch.
 	      </para>
-	      <note>
-		This parameter gets overriden by the one-stop-shop parameter
-		<arg>-AS:kms</arg> which determines number of passes and kmer
-		size to use in each pass.
-	      </note>
-	      <warning>
-		For de-novo assemblies, values below 15 are not
-		recommended. For mapping assemblies, values below 10 should
-		not be used.
-	      </warning>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>kmer_save_stepping(kss)=<replaceable>integer ≥ 1</replaceable></arg>
+	      <arg>hash_save_stepping(hss)=<replaceable>integer ≥ 1</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para> Default is
 	      <emphasis role="underline">1</emphasis>. This is a parameter
-	      controlling the stepping increment <emphasis>s</emphasis> with which kmers are
+	      controlling the stepping increment $s$ with which hashes are
 	      generated. This allows for more or less fine grained search as
-	      matches are found with at least <emphasis>n+s</emphasis> (see <arg>-SK:kms</arg>)
+	      matches are found with at least $n+s$ (see <arg>-SK:bph</arg>)
 	      equal bases. The higher the value, the faster the search. The
 	      lower the value, the more weak matches are found.
 	      </para>
@@ -3303,7 +2811,8 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	      </para>
 	      <para>
 		Note: most of the time it makes sense to keep this parameter
-		in sync with <arg>-AL:mrs</arg>.
+		in sync with
+		<arg>-AL:mrs</arg>.
 	      </para>
 	    </listitem>
 	  </varlistentry>
@@ -3315,7 +2824,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	      <para> Default is
 	      <emphasis role="underline">2000</emphasis>. Controls the maximum
 	      number of possible hits one read can maximally transport to the
-	      overlap edge reduction phase. If more potential hits are found,
+	      graph edge reduction phase. If more potential hits are found,
 	      only the best ones are taken.
 	      </para>
 	      <para>
@@ -3336,66 +2845,10 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>filter_megahubs(fmh)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
-	    </term>
-	    <listitem>
-	      <para> Default is <emphasis
-	      role="underline">yes</emphasis>. Defines whether megahubs (reads
-	      with extremely many overlaps to other reads) are filtered.
-	      See also <arg>-SK:mhc:mmhr</arg>.
-	      </para>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term>
-	      <arg>megahub_cap(mhc)=<replaceable>integer > 0</replaceable></arg>
-	    </term>
-	    <listitem>
-	      <para> Default is <emphasis
-	      role="underline">150000</emphasis>. Defines the number of kmer
-	      overlaps a read may have before it is categorised as megahub.
-	      </para>
-	      <note>
-		You basically don't want to mess with this one. Except for
-		assemblies containing very long reads. Rule of thumb: you
-		might want to multiply the 150k value by n where n is the
-		average read length divided by 2000. Don't overdo, max n at 15
-		or so.
-	      </note>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term>
-	      <arg>max_megahub_ratio(mmhr)=<replaceable>integer ≥ 0</replaceable></arg>
-	    </term>
-	    <listitem>
-	      <para> Default is
-	      <emphasis role="underline">0</emphasis>. If the number of reads
-	      identified as megahubs exceeds the allowed ratio, MIRA will
-	      abort.
-	      </para>
-	      <para>
-		This is a fail-safe parameter to avoid assemblies where things
-		look fishy. In case you see this, you might want to ask for
-		advice on the mira_talk mailing list. In short: bacteria
-		should never have megahubs (90% of all cases reported were
-		contamination of some sort and the 10% were due to incredibly
-		high coverage numbers). Eukaryotes are likely to contain
-		megahubs if filtering is <arg>-KS:mnr</arg> not on.
-	      </para>
-	      <para>
-		EST project however, especially from non-normalised libraries,
-		will very probably contain megahubs. In this case, you might
-		want to think about masking, see <arg>-KS:mnr</arg>.
-	      </para>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term>
-	      <arg>sw_check_on_backbones(swcob)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>sw_check_on_backbones(swcob)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
-	      <para>
+	      <para> 
 		Default is currently (3.4.0) <emphasis
 		role="underline">yes</emphasis> for accurate mapping
 		jobs. Takes effect only in mapping assemblies. Defines whether
@@ -3403,197 +2856,119 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 		than 100% identity are double checked with Smith-Waterman to
 		improve mapping accuracy.
 	      </para>
-	      <para>
+	      <para> 
 		You will want to set this option to <emphasis
 		role="underline">yes</emphasis> whenever your reference
-		sequence contains more complex or numerous repeats and your
-		data has SNPs in those areas.
-	      </para>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term>
-	      <arg>max_kmers_in_memory(mkim)=<replaceable>integer ≥ 100000</replaceable></arg>
-	    </term>
-	    <listitem>
-	      <para> Default is
-	      <emphasis role="underline">15000000</emphasis>. Has no influence
-	      on the quality of the assembly, only on the maximum memory size
-	      needed during the skimming. The default value is equivalent to
-	      approximately 500MB.
-	      </para>
-	      <para>
-		Note: reducing the number will increase the run time, the more drastically
-		the bigger the reduction. On the other hand, increasing the default value
-		chosen will not result in speed improvements that are really noticeable. In
-		short: leave this number alone if you are not desperate to save a few MB.
-	      </para>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term>
-	      <arg>memcap_hitreduction(mchr)=<replaceable>integer ≥ 10</replaceable></arg>
-	    </term>
-	    <listitem>
-	      <para> Default is
-	      <emphasis role="underline">1024</emphasis>, <emphasis role="underline">2048</emphasis>
-	      when Solexa sequences are used. Maximum memory used (in MiB)
-	      during the reduction of skim hits.
-	      </para>
-	      <para>
-		Note: has no influence on the quality of the assembly,
-		reducing the number will increase the runtime, the more
-		drastically the bigger the reduction as hits then must be
-		streamed multiple times from disk.
-	      </para>
-	      <para>
-		The default is good enough for assembly of bacterial genomes
-		or small eukaryotes (using Sanger and/or 454 sequences). As
-		soon as assembling something bigger than 20 megabases, you
-		should increase it to 2048 or 4096 (equivalent to 2 or 4 GiB
-		of memory).
-	      </para>
-	    </listitem>
-	  </varlistentry>
-	</variablelist>
-	<para>
-	</para>
-      </sect3>
-      <sect3 id="sect_ref_hashstatistics_hs">
-	<title>
-	  Parameter group: -KMERSTATISTICS (-KS)
-	</title>
-	<para>
-	  Hash statistics (nowadays called kmer statistics in literature
-	  or other software packages) allows to quickly assess reads from a
-	  coverage point of view without actually assembling the reads. MIRA
-	  uses this as a quick pre-assembly evaluation to find and tag reads
-	  which are from repetitive and non-repetitive parts of a project.
-	</para>
-	<para>
-	  The length of the kmer is defined via <arg>-SK:kms</arg>
-	  or <arg>-AS:kms</arg> while the parameters in this section define
-	  the boundaries of the different repeat levels.
-	</para>
-	<para>
-	  A more in-depth description on kmer statistics is given in the
-	  sections <emphasis>Introduction to 'masking'</emphasis>
-	  and <emphasis>How does 'nasty repeat' masking work?</emphasis> in
-	  the chapter dealing with the assembly of hard projects.
-	</para>
-	<variablelist>
+		sequence contains more complex or numerous repeats and your
+		data has SNPs in those areas.
+	      </para> 
+	    </listitem>
+	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>freq_est_minnormal(fenn)=<replaceable>float > 0</replaceable></arg>
+	      <arg>freq_est_minnormal(fenn)=<replaceable>float < 0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para>
-		During kmer statistics analysis, MIRA will estimate how repetitive parts
-		of reads are. Parts which are occurring less than
-		<arg>-KS:fenn</arg> times the average occurrence will be tagged
+		During SKIM analysism, MIRA will estimate how repetitive parts
+		of reads are. Parts which are occuring less than
+		<arg>-SK:fenn</arg> times the average occurence will be tagged
 		with a HAF2 (less than average) tag.
 	      </para>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>freq_est_maxnormal(fexn)=<replaceable>float > 0</replaceable></arg>
+	      <arg>freq_est_maxnormal(fexn)=<replaceable>float < 0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para>
-		During kmer statistics analysis, MIRA will estimate how repetitive parts
-		of reads are. Parts which are occurring more than
-		<arg>-KS:fenn</arg> but less than <arg>-KS:fexn</arg> times
-		the average occurrence will be tagged with a HAF3 (normal) tag.
+		During SKIM analysism, MIRA will estimate how repetitive parts
+		of reads are. Parts which are occuring more than
+		<arg>-SK:fenn</arg> but less than <arg>-SK:fexn</arg> times
+		the average occurence will be tagged with a HAF3 (normal) tag.
 	      </para>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>freq_est_repeat(fer)=<replaceable>float > 0</replaceable></arg>
+	      <arg>freq_est_repeat(fer)=<replaceable>float < 0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para>
-		During kmer statistics analysis, MIRA will estimate how repetitive parts
-		of reads are. Parts which are occurring more than
-		<arg>-KS:fexn</arg> but less than <arg>-KS:fer</arg> times
-		the average occurrence will be tagged with a HAF4 (above average) tag.
+		During SKIM analysism, MIRA will estimate how repetitive parts
+		of reads are. Parts which are occuring more than
+		<arg>-SK:fexn</arg> but less than <arg>-SK:fer</arg> times
+		the average occurence will be tagged with a HAF4 (above average) tag.
 	      </para>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>freq_est_heavyrepeat(fehr)=<replaceable>float > 0</replaceable></arg>
+	      <arg>freq_est_heavyrepeat(fehr)=<replaceable>float < 0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para>
-		During kmer statistics analysis, MIRA will estimate how repetitive parts
-		of reads are. Parts which are occurring more than
-		<arg>-KS:fer</arg> but less than <arg>-KS:fehr</arg> times
-		the average occurrence will be tagged with a HAF5 (repeat) tag.
+		During SKIM analysism, MIRA will estimate how repetitive parts
+		of reads are. Parts which are occuring more than
+		<arg>-SK:fer</arg> but less than <arg>-SK:fehr</arg> times
+		the average occurence will be tagged with a HAF5 (repeat) tag.
 	      </para>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>freq_est_crazyrepeat(fecr)=<replaceable>float > 0</replaceable></arg>
+	      <arg>freq_est_crazyrepeat(fecr)=<replaceable>float < 0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para>
-		During kmer statistics analysis, MIRA will estimate how repetitive parts
-		of reads are. Parts which are occurring more than
-		<arg>-KS:fehr</arg> but less than <arg>-KS:fecr</arg> times
-		the average occurrence will be tagged with a HAF6 (heavy
-		repeat) tag. Parts which are occurring more than
-		<arg>-KS:fecr</arg> but less than <arg>-KS:nrr</arg> times the
-		average occurrence will be tagged with a HAF7 (crazy repeat)
+		During SKIM analysism, MIRA will estimate how repetitive parts
+		of reads are. Parts which are occuring more than
+		<arg>-SK:fehr</arg> but less than <arg>-SK:fecr</arg> times
+		the average occurence will be tagged with a HAF6 (heavy
+		repeat) tag. Parts which are occuring more than
+		<arg>-SK:fecr</arg> but less than <arg>-SK:nrr</arg> times the
+		average occurence will be tagged with a HAF7 (crazy repeat)
 		tag.
 	      </para>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>mask_nasty_repeats(mnr)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>mask_nasty_repeats(mnr)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
-	      <para>
-		Default is dependent on --job
-		type: <emphasis role="underline">yes</emphasis> for
-		de-novo, <emphasis role="underline">no</emphasis> for mapping.
+	      <para> 
+		Default is dependent on --job type: <emphasis
+		role="underline">yes</emphasis> for de-novo, <emphasis
+		role="underline">no</emphasis> for mapping. Tells mira to mask
+		during the SKIM phase subsequences of size <arg>-SK:nph</arg>
+		nucleotides that appear more often than the median occurrence
+		of subsequences would otherwise suggest. The threshold from
+		which on subsequences are considered nasty is set by
+		<arg>-SK:nrr</arg> (see below).
 	      </para>
 	      <para>
-		Tells MIRA to tag (during the kmer statistics phase) read
-		subsequences of length <arg>-SK:kms</arg> nucleotides that
-		appear more that X times more often than the median occurrence
-		of subsequences would otherwise suggest. The threshold X from
-		which on subsequences are considered nasty is set by
-		<arg>-KS:nrr</arg> or <arg>-KS:nrc</arg>, the action MIRA
-		should take when encountering those sequences is defined
-		by <arg>-KS:ldn</arg> (see below).
-	      </para>
-	      <para>
-		When not using lossless digital normalisation
-		(<arg>-KS:ldn</arg>), the tag used by MIRA will be "MNRr"
-		which stands for "Mask Nasty Repeat in read". This tag has an
-		active masking function in MIRA and the fast all-against-all
-		overlap searcher (SKIM) will then completely ignore the tagged
-		subsequences of reads. There's one drawback though: the
-		smaller the reads are that you try to assemble, the higher the
+		There's one drawback though: the smaller the reads are that
+		you try to assemble with this option turned on, the higher the
 		probability that your reads will not span nasty repeats
 		completely, therefore leading to a abortion of contig building
-		at this site. Reads completely covered by the MNRr tag will
-		therefore land in the debris file as no overlap will be found.
+		at this site.
+	      </para>
+	      <para>
+		The masked parts are tagged with "MNRr" in the reads.
 	      </para>
 	      <para>
 		This option is extremely useful for assembly of larger
-		projects (fungi-size) with a high percentage of repeats.
+		projects (fungi-size) with a high percentage of repeats. Or in
+		non-normalised EST projects, to get at least something
+		assenbled.
+	      </para>
+	      <para>
+		Although it is expected that bacteria will not really need this, leaving it
+		turned on will probably not harm except in unusual cases like several copies
+		of (pro-)phages integrated in a genome.
 	      </para>
-	      <note>
-		Although it is expected that bacteria will not really need
-		this, leaving it turned on will probably not harm except in
-		unusual cases like several copies of (pro-)phages integrated
-		in a genome.
-	      </note>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
@@ -3608,126 +2983,118 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	      </para>
 	      <para>
 		Sets the ratio from which on subsequences are considered nasty
-		and hidden from the kmer statistics overlapper with a
-		<emphasis>MNRr</emphasis> tag. E.g.: A value of 10 means: mask all
-		k-mers of <arg>-SK:kms</arg> length which are occurring more
-		than 10 times more often than the average of the whole project.
+		and hidden from the SKIM overlapper with a
+		<emphasis>MNRr</emphasis> tag. The value of 10 means: mask all
+		k-mers of <arg>-SK:bph</arg> length which are occurring more
+		than 10 times more often than the average of the project.
 	      </para>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>nasty_repeat_coverage(nrc)=<replaceable>integer ≥ 0</replaceable></arg>
+	      <arg>repeatlevel_in_infofile(rliif)=<replaceable>integer; 0, 5-8</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para>
-		Default is depending on the <arg>--job=...</arg>
-		parameters: <emphasis role="underline">0</emphasis> for genome
-		assemblies, <emphasis role="underline">200</emphasis> for EST assemblies.
+		Default is <emphasis role="underline">6</emphasis>. Sets the
+		minimum level of the HAF tags from which on MIRA will report
+		tentatively repetitive sequence in the
+		<filename>*_info_readrepeats.lst</filename> file of the info
+		directory.
+	      </para>
+	      <para>
+		A value of <emphasis role="underline">0</emphasis> means
+		"switched off". The default value of , <emphasis
+		role="underline">6</emphasis> means all subsequences tagged
+		with <emphasis>HAF6</emphasis>, <emphasis>HAF7</emphasis> and
+		<emphasis>MNRr</emphasis> will be logged. If you, e.g., only
+		wanted MNRr logged, you'd use <emphasis
+		role="underline">8</emphasis> as parameter value.
 	      </para>
 	      <para>
-		Closely related to the <arg>-KS:nrr</arg> parameter (see
-		above), but while the above works on ratios derived from a
-		calculated average, this parameter allows to set an absolute
-		value. Note that this parameter will take precedence
-		over <arg>-KS:nrr</arg> if the calculated value of nrr is
-		larger that the absolute value given here. A value of 0
-		de-activates this parameter.
+		See also <arg>-SK:fenn:fexn:fer:fehr:mnr:nrr</arg> to set the
+		different levels for the <emphasis>HAF</emphasis> and
+		<emphasis>MNRr</emphasis> tags.
 	      </para>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>lossless_digital_normalisation(ldn)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>max_megahub_ratio(mmhr)=<replaceable>integer ≥ 0</replaceable></arg>
 	    </term>
 	    <listitem>
-	      <para>
-		Default is dependent on --job
-		type: <emphasis role="underline">yes</emphasis> for denovo
-		EST/RNAseq assembly, <emphasis role="underline">no</emphasis>
-		otherwise.
+	      <para> Default is
+	      <emphasis role="underline">0</emphasis>. If the number of reads
+	      identified as megahubs exceeds the allowed ratio, mira will
+	      abort.
 	      </para>
 	      <para>
-		Tells MIRA how to treat reads containing nasty repeats
-		when <arg>-KS:mnr</arg> is active.
+		This is a fail-safe parameter to avoid assemblies where things
+		look fishy. In case you see this, you might want to ask for
+		advice on the mira_talk mailing list. In short: bacteria
+		should never have megahubs (90% of all cases reported were
+		contamination of some sort and the 10% were due to incredibly
+		high coverage numbers). Eukaryotes are likely to contain
+		megahubs if filtering is <arg>-SK:mnr</arg> not on.
 	      </para>
 	      <para>
-		When set to <emphasis>yes</emphasis>, MIRA will apply a
-		modified digital normalisation step to the reads, effectively
-		decreasing the coverage of a given repetitive stretch down to
-		a minimum needed to correctly represent one copy of the
-		repeat. However, contrary to the published method, MIRA will
-		keep enough reads of repetitive regions to also correctly
-		reconstruct slightly different variants of the repeats present
-		in the genome or EST / RNASeq data set, even if they differ in
-		only a single base.
+		EST project however, especially from non-normalised libraries,
+		will very probably contain megahubs. In this case, you might
+		want to think about masking, see <arg>-SK:mnr</arg>.
 	      </para>
-	      <para>
-		The tag used by MIRA to denote stretches which may have
-		contributed to the digital normalisation will be
-		"DGNr". Additionally, contigs which contain reads completely
-		covered by a DGNr tag will get an additional "_dn" as part of
-		their name to show that they contain read representatives for
-		digital normalisation. E.g.: "contig_dn_c1".
+	    </listitem>
+	  </varlistentry>
+	  <varlistentry>
+	    <term>
+	      <arg>max_hashes_in_memory(mhim)=<replaceable>integer ≥ 100000</replaceable></arg>
+	    </term>
+	    <listitem>
+	      <para> Default is
+	      <emphasis role="underline">15000000</emphasis>. Has no influence
+	      on the quality of the assembly, only on the maximum memory size
+	      needed during the skimming. The default value is equivalent to
+	      approximately 500MB.
 	      </para>
 	      <para>
-		This option is extremely useful for non-normalised EST /
-		RNASeq projects, to get at least the sequence of
-		overrepresented transcripts assembled even if the coverage
-		values then cannot be interpreted as expression values
-		anymore.
+		Note: reducing the number will increase the run time, the more drastically
+		the bigger the reduction. On the other hand, increasing the default value
+		chosen will not result in speed improvements that are really noticeable. In
+		short: leave this number alone if you are not desperate to save a few MB.
 	      </para>
-	      <note>
-		The lossless digital normalisation will be applied as soon as
-		the kmer size of the active pass (see <arg>-AS:kms</arg>)
-		reaches a size of at least 50 or, at the latest, in the second
-		to last pass.
-	      </note>
-	      <note>
-		Once digital normalisation has been applied, the
-		parameters <arg>-KS:nrr</arg> and <arg>-KS:nrc</arg> do not
-		take effect anymore.
-	      </note>
-	      <warning>
-		The effect of lossless digital normalisation on genome data
-		has not been studied sufficiently by me to approve it for
-		genomes. Use with care in genome assemblies.
-	      </warning>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>repeatlevel_in_infofile(rliif)=<replaceable>integer; 0, 5-8</replaceable></arg>
+	      <arg>memcap_hitreduction(mchr)=<replaceable>integer ≥ 10</replaceable></arg>
 	    </term>
 	    <listitem>
-	      <para>
-		Default is <emphasis role="underline">6</emphasis>. Sets the
-		minimum level of the HAF tags from which on MIRA will report
-		tentatively repetitive sequence in the
-		<filename>*_info_readrepeats.lst</filename> file of the info
-		directory.
+	      <para> Default is
+	      <emphasis role="underline">1024</emphasis>, <emphasis role="underline">2048</emphasis>
+	      when Solexa sequences are used. Maximum memory used (in MiB)
+	      during the reduction of skim hits.
 	      </para>
 	      <para>
-		A value of <emphasis role="underline">0</emphasis> means
-		"switched off". The default value of <emphasis
-		role="underline">6</emphasis> means all subsequences tagged
-		with <emphasis>HAF6</emphasis>, <emphasis>HAF7</emphasis> and
-		<emphasis>MNRr</emphasis> will be logged. If you, e.g., only
-		wanted MNRr logged, you'd use <emphasis
-		role="underline">8</emphasis> as parameter value.
+		Note: has no influence on the quality of the assembly,
+		reducing the number will increase the runtime, the more
+		drastically the bigger the reduction as hits then must be
+		streamed multiple times from disk.
 	      </para>
 	      <para>
-		See also <arg>-KS:fenn:fexn:fer:fehr:mnr:nrr</arg> to set the
-		different levels for the <emphasis>HAF</emphasis> and
-		<emphasis>MNRr</emphasis> tags.
+		The default is good enough for assembly of bacterial genomes
+		or small eukaryotes (using Sanger and/or 454 sequences). As
+		soon as assembling something bigger than 20 megabases, you
+		should increase it to 2048 or 4096 (equivalent to 2 or 4 GiB
+		of memory).
 	      </para>
 	    </listitem>
 	  </varlistentry>
 	</variablelist>
+	<para>
+	</para>
       </sect3>
       <sect3 id="sect_ref_align_al">
 	<title>
-	  Parameter group: -ALIGN (-AL)
+	  -ALIGN (-AL)
 	</title>
 	<para>
 	  The align options control the behaviour of the Smith-Waterman alignment
@@ -3797,7 +3164,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	    <listitem>
 	      <para> Default is dependent of the
 	      sequencing technology used. Describes the minimum score of an overlap to be
-	      taken into account for assembly. MIRA uses a default scoring scheme
+	      taken into account for assembly. mira uses a default scoring scheme
 	      for SW align: each match counts 1, a match with an N counts 0, each mismatch
 	      with a non-N base -1 and each gap -2. Take a bigger score to weed out a
 	      number of chance matches, a lower score to perhaps find the single (short)
@@ -3827,41 +3194,10 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>solexa_hack_max_errors(shme)=<replaceable>integer > -1</replaceable></arg>
+	      <arg>extra_gap_penalty(egp)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
-	      <para>
-		Currently a hack just for Solexa/Illumina data.
-	      </para>
-	      <para>
-		When running in mapping mode, this defines the maximum number
-		of mismatches and gaps a read may have compared to the
-		reference to be allowed to map. The result is usually a much
-		better mapping in areas with larger discrepancies between
-		reference sequence and mapped data. Note that the mapping
-		process takes longer if this value is unequal to 0 as MIRA
-		will use iterative mapping which involves a certain amount of
-		trial and error.
-	      </para>
-	      <para>
-		The default value of <emphasis role="underline">-1</emphasis>
-		lets MIRA choose this value automatically. It sets it to 15%
-		of the average Illumina read lengths loaded.
-	      </para>
-	      <para>
-		A value of <emphasis role="underline">0</emphasis> switches of
-		this functionality, leading to a much faster mapping
-		process. Useful when mapping expression data where coverage
-		values may be more important than the best possible alignment.
-	      </para>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term>
-	      <arg>extra_gap_penalty(egp)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
-	    </term>
-	    <listitem>
-	      <para>
+	      <para> 
 		Default is dependent of the sequencing technology
 		used. Defines whether or not to increase penalties applied to
 		alignments containing long gaps. Setting this to 'yes' might
@@ -3887,15 +3223,29 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>egp_level(egpl)=<replaceable>comma separated list of integer ≥ 0 and ≤ 100</replaceable></arg>
+	      <arg>egp_level(egpl)=<replaceable>low|0, medium|1, high|2, split_on_codongaps|10</replaceable></arg>
 	    </term>
 	    <listitem>
+	      <para> Default is dependent of the sequencing technology
+		used. Has no effect if extra_gap_penalty is off. Defines an
+		extra penalty applied to 'long' gaps.  There are these are
+		predefined levels: low - use this if you expect your base
+		caller frequently misses 2 or more bases.  medium - use this
+		if your base caller is expected to frequently miss 1 to 2
+		bases.  high - use this if your base caller does not
+		frequently miss more than 1 base.
+	      </para>
 	      <para>
-		Default is dependent of the sequencing technology and job
-		used. Has no effect if extra_gap_penalty is off.
+		For some stages of the EST assembly process, a special value
+		<emphasis>split_on_codongaps</emphasis> is used. It's even a
+		tick harsher that the 'high' level.
 	      </para>
 	      <para>
-		...
+		Also, usage of this parameter is probably a good thing if the
+		repeat marker of the contig is set to not mark on gap bases
+		(<arg>-CO:amgb</arg> equals to
+		<emphasis role="underline">no</emphasis>). This is generally
+		the case for 454 data.
 	      </para>
 	    </listitem>
 	  </varlistentry>
@@ -3928,7 +3278,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
       </sect3>
       <sect3 id="sect_ref_contig_co">
 	<title>
-	  Parameter group: -CONTIG (-CO)
+	  -CONTIG (-CO)
 	</title>
 	<para>
 	  The contig options control the behaviour of the contig objects.
@@ -3942,59 +3292,30 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	      <para>
 		Default is
 		<emphasis role="underline"><projectname></emphasis>. Contigs
-		will have this string prepended to their names. Normally,
-		the <arg>project=</arg> line in the manifest will set this.
-	      </para>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term>
-	      <arg>reject_on_drop_in_relscore(rodirs)=<replaceable>integer ≥ 0 and ≤100</replaceable></arg>
-	    </term>
-	    <listitem>
-	      <para>
-		Default is dependent of the sequencing technology used.
-	      </para>
-	      <para>
-		When adding reads to a contig, reject the reads if the drop in
-		the minimum relative score of the alignment of the current
-		consensus and the new read is > the expected value
-		calculated during the alignment phase. Lower values mean
-		stricter checking.
-	      </para>
-	      <para>
-		This value is doubled should a read be entered that has an
-		assembled template partner (a read pair) at the right distance
-		in the current contig.
+		will have this string prepended to their
+		names. The <arg>-project=</arg> quick-switch will also change
+		this option.
 	      </para>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>cmin_relative_score(cmrs)=<replaceable>integer ≥ -1 and ≤100</replaceable></arg>
+	      <arg>reject_on_drop_in_relscore(rodirs)=<replaceable>integer > 0 and ≤100</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para>
-		Default is <emphasis role="underline">-1</emphasis>. Works
-		similarly to <arg>-AL:mrs</arg>, but during contig
-		construction phase instead of read vs read alignment phase:
-		describes the min % of matching between a read being added to
-		a contig and the current contig consensus.
-	      </para>
-	      <para>
-		If value is set to -1, then the value of <arg>-AL:mrs</arg> is used.
-	      </para>
-	      <para>
-		Note: most of the time it makes sense to keep this parameter
-		at -1. Else have it at
-		approximately <emphasis><arg>-AL:mrs</arg>-10</emphasis> or
-		switch it completely off via 0.
+		Default is dependent of the sequencing technology used. When
+		adding reads to a contig, reject the reads if the drop in the
+		quality of the consensus is > the given value in %.  Lower
+		values mean stricter checking.  This value is doubled should a
+		read be entered that has a template partner (a read pair) at
+		the right distance.
 	      </para>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>mark_repeats(mr)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>mark_repeats(mr)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para> Default is
@@ -4009,7 +3330,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>only_in_result(mroir)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>only_in_result(mroir)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para> Default is <emphasis role="underline">no</emphasis>. Only
@@ -4027,14 +3348,14 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>assume_snp_instead_repeat(asir)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>assume_snp_instead_repeat(asir)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para> Default is <emphasis role="underline">no</emphasis>.
 	      Only takes effect when <arg>-CO:mr</arg> (see above) is set to
 	      <emphasis role="underline">yes</emphasis>, effect is also
 	      dependent on the fact whether strain data (see
-	      -<arg>-SB:lsd</arg>) is present or not.  Usually, MIRA will mark
+	      -<arg>-SB:lsd</arg>) is present or not.  Usually, mira will mark
 	      bases that differentiate between repeats when a conflict occurs
 	      between reads that belong to one strain. If the conflict occurs
 	      between reads belonging to different strains, they are marked as
@@ -4134,8 +3455,8 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>emea_set1_on_clipping_pec(emeas1clpec)=<replaceable>on|y[es]|t[rue],
-	      off|n[o]|f[alse]</replaceable></arg>
+	      <arg>emea_set1_on_clipping_pec(emeas1clpec)=<replaceable>on|yes|1,
+	      off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para>
@@ -4153,7 +3474,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>also_mark_gap_bases(amgb)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>also_mark_gap_bases(amgb)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para>
@@ -4169,8 +3490,8 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>also_mark_gap_bases_even_multicolumn(amgbemc)=<replaceable>on|y[es]|t[rue],
-	      off|n[o]|f[alse]</replaceable></arg>
+	      <arg>also_mark_gap_bases_even_multicolumn(amgbemc)=<replaceable>on|yes|1,
+	      off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para> Default is <emphasis role="underline">yes</emphasis>.
@@ -4182,7 +3503,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>also_mark_gap_bases_need_both_strands(amgbnbs)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>also_mark_gap_bases_need_both_strands(amgbnbs)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para> Default is <emphasis role="underline">yes</emphasis>.  Takes effect only when
@@ -4195,21 +3516,21 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>force_nonIUPACconsensus_perseqtype(fnic)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>force_nonIUPACconsensus_perseqtype(fnicpst)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
-	      <para>
-		Default is <emphasis role="underline">no</emphasis>. If set to
-		<emphasis role="underline">yes</emphasis>, MIRA will be forced
+	      <para> 
+		Default is <emphasis role="underline">no</emphasis> for all sequencing types. If set to
+		<emphasis role="underline">yes</emphasis>, mira will be forced
 		to make a choice for a consensus base (A,C,G,T or gap) even in
 		unclear cases where it would normally put a IUPAC base. All
 		other things being equal (like quality of the possible
-		consensus base and other things), MIRA will choose a base by
+		consensus base and other things), mira will choose a base by
 		either looking for a majority vote or, if that also is not
 		clear, by preferring gaps over T over G over C over finally A.
 	      </para>
 	      <para>
-		MIRA makes a considerable effort to deduce the right base at
+		mira makes a considerable effort to deduce the right base at
 		each position of an assembly. Only when cases begin to be
 		borderline it will use a IUPAC code to make you aware of
 		potential problems. It
@@ -4227,14 +3548,23 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 		is "good enough" with respect to the fact that you did not
 		have quality values.
 	      </para>
+	      <para>
+		<emphasis role="bold">Important note:</emphasis> in case you
+		are working with a hybrid assembly, mira will still use IUPAC
+		bases at places where reads from different sequencing types
+		contradict each other. In fact, when not forcing non-IUPAC
+		bases for hybrid assemblies, the overall consensus will be
+		better and probably have less IUPAC bases as mira can make a
+		better use of available information.
+	      </para>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>merge_short_reads(msr)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>merge_short_reads(msr)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
-	      <para>
+	      <para> 
 		Default is <emphasis role="underline">yes</emphasis> for all
 		Solexas when in a mapping assembly, else it's <emphasis
 		role="underline">no</emphasis>. Can only be used in mapping
@@ -4244,7 +3574,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 		Reads, CERs) while keeping quality and coverage information
 		intact.
 	      </para>
-	      <para>
+	      <para> 
 		This feature hugely reduces the number of Solexa reads and
 		makes assembly results with Solexa data small enough to be
 		handled by current finishing programs (gap4, consed, others)
@@ -4254,30 +3584,6 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>msr_keepcontigendsunmerged(msrme)=<replaceable>integer ≥ 0</replaceable></arg>
-	    </term>
-	    <listitem>
-	      <para>
-		Default is <emphasis role="underline">0</emphasis> for all
-		Solexas when in a mapping assembly. Takes only effect in
-		mapping assemblies if <arg>-CO:msr=yes</arg>.
-	      </para>
-	      <para>
-		Defines how many "errors" (i.e. differences) a read may have
-		to be merged into a coverage equivalent read. Useful only when
-		one does not need SNP information from an assembly but wants
-		to concentrate either on coverage data or on paired-end
-		information at contig ends.
-	      </para>
-	      <warning>
-		This feature allows to merge non-perfect reads, which makes
-		most SNP information simply disappear from the alignment. Use
-		with care!
-	      </warning>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term>
 	      <arg>msr_keepcontigendsunmerged(msrkceu)=<replaceable>-1, integer > 0</replaceable></arg>
 	    </term>
 	    <listitem>
@@ -4308,10 +3614,12 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	    </listitem>
 	  </varlistentry>
 	</variablelist>
+	<para>
+	</para>
       </sect3>
       <sect3 id="sect_ref_edit_ed">
 	<title>
-	  Parameter group: -EDIT (-ED)
+	  -EDIT (-ED)
 	</title>
 	<para>
 	  General options for controlling the integrated automatic editor. The editors
@@ -4347,93 +3655,43 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	<variablelist>
 	  <varlistentry>
 	    <term>
-	      <arg>_mira_automatic_contig_editing(mace)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
-	    </term>
-	    <listitem>
-	      <para>
-		Default is <emphasis role="underline">yes</emphasis>. When set
-		to yes, MIRA will use built-in versions of own automatic
-		contig editors (see parameters below) to improve alignments.
-	      </para>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term>
-	      <arg>edit_kmer_singlets(eks)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
-	    </term>
-	    <listitem>
-	      <para>
-		Default is <emphasis role="underline">yes</emphasis> for all
-		sequencing technologies, but only takes effect
-		if <arg>-ED:mace</arg> is on (see above).
-	      </para>
-	      <para>
-		When set to yes, MIRA uses the alignment information of a
-		complete contig at places with sequencing errors which lead to
-		unique kmers and correct the error according to the alignment.
-	      </para>
-	      <para>
-		This is an extremely conservative yet very effective editing
-		strategy and can therefore be kept always activated.
-	      </para>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term>
-	      <arg>edit_homopolymer_overcalls(ehpo)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>automatic_contig_editing(ace)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para>
-		Default is <emphasis role="underline">yes</emphasis> for 454
-		and Ion Torrent, but only takes effect if <arg>-ED:mace</arg>
-		is on (see above).
+		Default is <emphasis role="underline">no</emphasis>. Once
+		contigs have been build, mira can call a built-in versions of
+		the automatic contig editors. For Sanger reads this is EdIt,
+		for 454 reads it is a specially crafted editor that knows
+		about deficiencies of the 454 technology (homopolymers).
 	      </para>
 	      <para>
-		When set to yes, MIRA use the alignment information of a
-		complete contig at places with potential homopolymer
-		sequencing errors and correct the error according to the
-		alignment.
-	      </para>
-	      <para>
-		This editor should be switched on only for sequencing
-		technologies with known homopolymer sequencing problems. That
-		is: currently only 454 and Ion.
+		EdIt will try to resolve discrepancies in the contig by
+		performing trace analysis and correct even hard to resolve
+		errors.  This option is always useful, but especially in
+		conjunction with <arg>-AS:nop</arg> and
+		<arg>-DP:ure</arg> (see above).
 	      </para>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term>
-	      <arg>edit_automatic_contig_editing(eace)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
-	    </term>
-	    <listitem>
 	      <para>
-		Default is <emphasis role="underline">no</emphasis>. When set
-		to yes, MIRA will use built-in versions of the "EdIt"
-		automatic contig editor (see parameters below) to correct
-		sequencing errors in Sanger reads.
+		Notice 1: the current development version has a memory leak in
+		the editor, therefore the option is not automatically turned
+		on.
 	      </para>
 	      <para>
-		EdIt will try to resolve discrepancies in the contig by
-		performing trace signal analysis and correct even hard to resolve
-		errors.
+		Notice 2: it is strongly suggested to turn this option on for
+		454 data as this greatly improves the quality.
 	      </para>
-	      <note>
-		The current development version has a memory leak in
-		this editor, therefore the option cannot be turned
-		on.
-	      </note>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>strict_editing_mode(sem)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>strict_editing_mode(sem)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para>
-		Default is <emphasis role="underline">yes</emphasis>. Only for
-		Sanger data. If set to yes, the automatic editor will not take
-		error hypotheses with a low probability into account, even if
-		all the requirements to make an edit are fulfilled.
+		Default is <emphasis role="underline">yes</emphasis>. Only for Sanger data. If set to yes, the
+		automatic editor will not take error hypotheses with a low probability into
+		account, even if all the requirements to make an edit are fulfilled.
 	      </para>
 	    </listitem>
 	  </varlistentry>
@@ -4456,7 +3714,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
       </sect3>
       <sect3 id="sect_ref_misc_mi">
 	<title>
-	  Parameter group: -MISC (-MI)
+	  -MISC (-MI)
 	</title>
 	<para>
 	  Options which would not fit elsewhere.
@@ -4464,19 +3722,29 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	<variablelist>
 	  <varlistentry>
 	    <term>
-	      <arg>iknowwhatido(ikwid)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>stop_on_nfs(sonfs)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
-	      <para>
-		Default is <emphasis role="underline">no</emphasis>. This
-		switch tells MIRA that you know what you do in some
-		situations and force it not to stop when it thinks something is
-		really wrong, but simply continue.
+	      <para> 
+		Default is <emphasis role="underline">yes</emphasis>. MIRA
+		will check whether the tmp directory is running on an NFS
+		mount. If it is and <arg>-MI:sonfs</arg> is active, MIRA will
+		stop with a warning message.
 	      </para>
 	      <warning>
-		You generally should not to set this flag except in cases
-		where MIRA stopped and the warning / error message told you to
-		get around that very specific problem by setting this flag.
+		<para>
+		  You should never ever at all run MIRA on a NFS mounted
+		  directory ... or face the the fact that the assembly process
+		  may very well take 5 to 10 times longer (or more) than
+		  normal. You have been warned.
+		</para>
+		<para>
+		  The reason for the slowdown is the same as why one should
+		  never run a BLAST search on a big database being located on
+		  a NFS volume: access via network is terribly slow when
+		  compared to local disks, at least if you have not invested a
+		  lot of money into specialised solutions.
+		</para>
 	      </warning>
 	    </listitem>
 	  </varlistentry>
@@ -4490,12 +3758,10 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 		Default is <emphasis role="underline">500</emphasis>. This
 		parameter has absolutely no influence whatsoever on the
 		assembly process of MIRA. But is used in the reporting within
-		the <filename>*_assembly_info.txt</filename> file after the
-		assembly where MIRA reports statistics on
-		<emphasis>large</emphasis> contigs and
-		<emphasis>all</emphasis> contigs. <arg>-MI:lcs</arg> is the
-		threshold value for dividing the contigs into these two
-		categories.
+		the <filename>*_assembly_info.txt</filename> file after the assembly
+		where MIRA reports statistics on <emphasis>large</emphasis>
+		and <emphasis>all</emphasis> contigs. <arg>-MI:lcs</arg> is
+		the threshold value for categorising contigs.
 	      </para>
 	    </listitem>
 	  </varlistentry>
@@ -4505,7 +3771,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	      0</replaceable></arg>
 	    </term>
 	    <listitem>
-	      <para>
+	      <para> 
 		Default is <emphasis role="underline">5000</emphasis> for
 		<arg>--job=genome</arg> and <emphasis
 		role="underline">1000</emphasis> for <arg>--job=est</arg>.
@@ -4519,269 +3785,271 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 		MIRA uses coverage information of an assembly project to find
 		out about potentially repetitive areas in reads (and thus, a
 		genome). To calculate statistics which are reflecting the
-		approximate truth regarding the average coverage of a genome,
-		the "large contig size for stats" value of
-		<arg>-MI:lcs4s</arg> is used as a cutoff threshold: contigs
-		smaller than this value do not contribute to the calculation
-		of average coverage while contigs larger or equal to this
-		value do.
+		approximate truth, the value of <arg>-MI:lcs4s</arg> is used
+		as a cutoff threshold: contigs smaller than this value do not
+		contribute to the calculation of average coverage while
+		contigs larger or equal to this value do. Having this cutoff
+		discards small contigs which tend to muddy the picture of
+		average coverage of a project.
+	      </para>
+	      <para>
+		If in doubt, don't touch this parameter.
+	      </para>
+	    </listitem>
+	  </varlistentry>
+	</variablelist>
+      </sect3>
+      <sect3 id="sect_ref_directory_dir_di">
+	<title>
+	  -DIRECTORY (-DIR, -DI)
+	</title>
+	<para>
+	  General options for controlling where to find or where to write data.
+	</para>
+	<variablelist>
+	  <varlistentry>
+	    <term>
+	      <arg>cwd=<replaceable><directoryname></replaceable></arg>
+	    </term>
+	    <listitem>
+	      <para> 
+		Default is an empty string. When encountered during parameter
+		parsing, MIRA will change the working directory immediately to
+		the directory given and read and write files there.
+	      </para>
+	      <para>
+		Therefore, a call like <literal>mira -DI:cwd=/somedir
+		--params=myparameters.txt</literal> will be enough to let MIRA
+		change to the directory <filename>/somedir</filename> and then
+		read further parameters from a text file
+		<filename>myparamaters.txt</filename> (which should be present
+		there) and at the same time have all the input and output of
+		the assembly occuring in firectory
+		<filename>/somedir</filename>.
+	      </para>
+	    </listitem>
+	  </varlistentry>
+	  <varlistentry>
+	    <term>
+	      <arg>tmp_redirected_to(trt)=<replaceable><directoryname></replaceable></arg>
+	    </term>
+	    <listitem>
+	      <para> 
+		Default is an empty string. When set to a non-empty string,
+		MIRA will create the tmp directory at the given location
+		instead of using the current working directory.
 	      </para>
 	      <para>
-		This reflects two facts: on the one hand - especially with
-		short read sequencing technologies and in projects without
-		read pair libraries - contigs containing predominantly
-		repetitive sequences are of a relatively small size. On the
-		other hand, reads which could not be placed into contigs
-		(maybe due to a sequencing technology dependent motif error)
-		often enough form small contigs with extremely low
-		coverage.
+		This option is particularly useful for systems which have
+		solid state disks (SSDs) and some very fast disk subsystems
+		which can be used for temporary files. Or in projects where
+		the input and output files reside on a NFS mounted directory
+		(current working dir), to put the tmp directory somewhere
+		outside the NFS (see also: Things you should not do).
 	      </para>
 	      <para>
-		 It should be clear that one does not want any of the above
-		 when calculating average coverage statistics and having this
-		 cutoff discards small contigs which tend to muddy the
-		 picture. If in doubt, don't touch this parameter.
+		In both cases above, and for larger projects, MIRA then runs
+		a lot faster.
+	      </para>
+	    </listitem>
+	  </varlistentry>
+	  <varlistentry>
+	    <term>
+	      <arg>gap4da=<replaceable><directoryname></replaceable></arg>
+	    </term>
+	    <listitem>
+	      <para> Default is <emphasis role="underline">gap4da</emphasis>.
+	      Defines the extension of the directory where mira will write the
+	      result of an assembly ready to import into the Staden package (GAP4) in
+	      Direct Assembly format. The name of the directory will then be
+	      <filename><projectname>_.<extension></filename>
+	      </para>
+	    </listitem>
+	  </varlistentry>
+	  <varlistentry>
+	    <term>
+	      <arg>exp=<replaceable><directoryname></replaceable></arg>
+	    </term>
+	    <listitem>
+	      <para> Default is <emphasis role="underline">.</emphasis>. Defines the
+	      directory where mira should search for experiment files (EXP).
+	      </para>
+	    </listitem>
+	  </varlistentry>
+	  <varlistentry>
+	    <term>
+	      <arg>scf=<replaceable><directoryname></replaceable></arg>
+	    </term>
+	    <listitem>
+	      <para> Default is <emphasis role="underline">.</emphasis>. Defines
+	      the directory where mira should search for SCF files.
 	      </para>
 	    </listitem>
 	  </varlistentry>
 	</variablelist>
+	<para>
+	</para>
       </sect3>
-      <sect3 id="sect_ref_misc_nw">
+      <sect3 id="sect_ref_filename_fn">
 	<title>
-	  Parameter group: -NAG_AND_WARN (-NW)
+	  -FILENAME (-FN)
 	</title>
 	<para>
-	  Parameters which let MIRA warn you about unusual things or potential
-	  problems. The flags in this parameter section come in three
-	  flavours: <emphasis>stop</emphasis>, <emphasis>warn</emphasis> and
-	  <emphasis>no</emphasis> which let MIRA either stop, give a warning
-	  or do nothing if a specific problem is detected.
+	  The file options allows you to define your own input and output files.
 	</para>
 	<variablelist>
 	  <varlistentry>
 	    <term>
-	      <arg>check_nfs(cnfs)=<replaceable>stop|warn|no</replaceable></arg>
+	      <arg>fastain(fai)=<replaceable>string</replaceable></arg>
 	    </term>
 	    <listitem>
-	      <para>
-		Default is <emphasis role="underline">stop</emphasis>. MIRA
-		will check whether the tmp directory is running on a NFS
-		mount.
+	      <para> Default is <emphasis
+	      role="underline"><projectname>_in.<seqtype>.fasta</emphasis>. Defines
+	      the fasta file to load sequences of a project from.
 	      </para>
-	      <warning>
-		<para>
-		  You should never ever at all run MIRA on a NFS mounted
-		  directory ... or face the the fact that the assembly process
-		  may very well take 5 to 10 times longer (or more) than
-		  normal. You have been warned.
-		</para>
-		<para>
-		  The reason for the slowdown is the same as why one should
-		  never run a BLAST search on a big database being located on
-		  a NFS volume: access via network is terribly slow when
-		  compared to local disks, at least if you have not invested a
-		  lot of money into specialised solutions.
-		</para>
-	      </warning>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>check_duplicate_readnames(cdrn)=<replaceable>stop|warn|no</replaceable></arg>
+	      <arg>fastaqualin(fqui)=<replaceable>string</replaceable></arg>
 	    </term>
 	    <listitem>
-	      <para>
-		Default is <emphasis role="underline">stop</emphasis>. MIRA
-		will check for duplicate read names after loading.
+	      <para> Default is <emphasis
+	      role="underline"><projectname>_in.<seqtype>.fasta.qual</emphasis>. Defines
+	      the file containing base qualities. Although the order of reads
+	      in the quality file does not need to be the same as in the fasta
+	      or fofn (although it saves a bit of time if they are).
 	      </para>
-	      <warning>
-		<para>
-		  Duplicate read names usually hint to a serious problem with
-		  your input and should really, really be fixed. You can
-		  choose to ignore this error by switching off this flag, but
-		  this will almost certainly lead to problems with result
-		  files (ACE and CAF for sure, maybe also SAM) and probably to
-		  other unexpected effects.
-		</para>
-	      </warning>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>check_template_problems(ctp)=<replaceable>stop|warn|no</replaceable></arg>
+	      <arg>fastqin(fqi)=<replaceable>string</replaceable></arg>
 	    </term>
 	    <listitem>
-	      <para>
-		Default is <emphasis role="underline">stop</emphasis>. MIRA
-		will check read template naming after loading.
+	      <para> Default is <emphasis
+	      role="underline"><projectname>_in.<seqtype>.fastq</emphasis>. Defines
+	      the fastq file to load sequences of a project from.
 	      </para>
-	      <warning>
-		<para>
-		  Problems in read template naming point to problems with read
-		  names or to broken template information. You should try to
-		  find the cause of the problem instead of ignoring this error
-		  message.
-		</para>
-	      </warning>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>check_maxreadnamelength(cmrnl)=<replaceable>stop|warn|no</replaceable></arg>
+	      <arg>cafin(ci)=<replaceable>string</replaceable></arg>
 	    </term>
 	    <listitem>
-	      <para>
-		Default is <emphasis role="underline">stop</emphasis>. MIRA
-		will check whether the length of the names of your reads
-		surpass the given number of characters (see <arg>-NW:mrnl</arg>).
-	      </para>
-	      <para>
-		While MIRA and many other programs have no problem with long read names,
-		some older programs have restrictions concerning the length of
-		the read name. Example given: the pipeline <literal>CAF ->
-		caf2gap -> gap2caf</literal> will stop working at
-		the <command>gap2caf</command> stage if there are read names
-		having > 40 characters where the names differ only at >40
-		characters.
-	      </para>
-	      <para>
-		This should be a warning only, but as a couple of people were
-		bitten by this, the default behaviour of MIRA is to stop when
-		it sees that potential problem. You might want to rename your
-		reads to have ≤ 40 characters.
-	      </para>
-	      <para>
-		On the other hand, you also can ignore this potential problem
-		and force MIRA to continue by using the parameter:
-		<arg>-NW:cmrnl=warn</arg> or <arg>-NW:cmrnl=no</arg>
+	      <para> Default is <emphasis
+	      role="underline"><projectname>_in.<seqtype>.caf</emphasis>. Defines
+	      the file to load a CAF project from. Filename must end with
+	      '.caf'.
 	      </para>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>maxreadnamelength(mrnl)=<replaceable>integer ≥
-	      0</replaceable></arg>
+	      <arg>fofnexpin(fei)=<replaceable>string</replaceable></arg>
 	    </term>
 	    <listitem>
-	      <para>
-		Default is <emphasis role="underline">40</emphasis>. This
-		defines the effective check length for <arg>-NW:cmrnl</arg>.
+	      <para> Default is <emphasis
+	      role="underline"><projectname>_in.fofn</emphasis>. Defines
+	      the file of filenames where the names of the EXP files of a
+	      project are located.
 	      </para>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>check_average_coverage(cac)=<replaceable>stop|warn|no</replaceable></arg>
+	      <arg>fofnphdin(fpi)=<replaceable>string</replaceable></arg>
 	    </term>
 	    <listitem>
-	      <para>
-		Default is <emphasis role="underline">stop</emphasis>. In
-		genome de-novo assemblies, MIRA will perform checks early in
-		the assembly process whether the average coverage to be
-		expected exceeds a given value (see <arg>-NW:acv</arg>).
-	      </para>
-	      <para>
-		With todays' sequencing technologies (especially Illumina, but
-		also Ion Torrent and 454), many people simply take everything
-		they get and throw it into an assembly. Which, in the case of
-		Illumina and Ion, can mean they try to assemble their organism
-		with a coverage of 100x, 200x and more (I've seen trials with
-		more than 1000x).
-	      </para>
-	      <para>
-		This is not good. Not. At. All! For two reasons (well, three
-		to be precise).
-	      </para>
-	      <para>
-		The first reason is that, usually, one does not sequence a
-		single cell but a population of cells. If this population is
-		not clonal (i.e., it contains subpopulations with genomic
-		differences with each other), assemblers will be able to pick
-		up these differences in the DNA once a certain sequence count
-		is reached and they will try reconstruct a genome containing
-		all clonal variations, treating these variations as potential
-		repeats with slightly different sequences. Which, of course,
-		will be wrong and I am pretty sure you do not want that.
+	      <para> Default is <emphasis
+	      role="underline"><projectname>_in.fofn</emphasis>. Defines
+	      the file of filenames where the names of the PHD files of a
+	      project are located. Note: this is currently not available.
 	      </para>
-	      <para>
-		The second and way more important reason is that none of the
-		current sequencing technologies is completely error free. Even
-		more problematic, they contain both random and non-random
-		sequencing errors. Especially the latter can become a big
-		hurdle if these non-random errors are so prevalent that they
-		suddenly appear to be valid sequence to an assembler. This in
-		turn leads to false repeat detection, hence possibly contig
-		breaks or even wrong consensus sequence. You don't want that,
-		do you?
+	    </listitem>
+	  </varlistentry>
+	  <varlistentry>
+	    <term>
+	      <arg>phdin(pi)=<replaceable>string</replaceable></arg>
+	    </term>
+	    <listitem>
+	      <para> Default is <emphasis
+	      role="underline"><projectname>_in.phd</emphasis>. Defines
+	      the file of where all the sequences of a project are in PHD
+	      format.
 	      </para>
-	      <para>
-		The last reason is that overlap based assemblers (like MIRA
-		is) need <emphasis>exponentially</emphasis> more time and
-		memory when the coverage increases. So keeping the coverage
-		comparatively low helps you there.
+	    </listitem>
+	  </varlistentry>
+	  <varlistentry>
+	    <term>
+	      <arg>straindatain(sdi)=<replaceable>string</replaceable></arg>
+	    </term>
+	    <listitem>
+	      <para> Default is
+	      <emphasis role="underline"><projectname>_straindata_in.txt</emphasis>. Defines the file to load
+	      straindata from..
 	      </para>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>average_coverage_value(acv)=<replaceable>integer ≥
-	      0</replaceable></arg>
+	      <arg>xmltraceinfoin(xtii)=<replaceable>string</replaceable></arg>
 	    </term>
 	    <listitem>
-	      <para>
-		Default is <emphasis role="underline">80</emphasis> for
-		de-novo assemblies, in mapping assemblies it is 120 for Ion
-		Torrent and 160 for Illumina data (might change in
-		future). This defines the effective coverage to check for in
-		<arg>-NW:cac</arg>.
+	      <para> Default is
+	      <emphasis role="underline"><projectname>_xmltraceinfo_in.<seqtype>.xml</emphasis>. Defines the file to
+	      load a trace info file in XML format from. This can be used both when
+	      merging XML data to loaded files or when loading a project from an XML trace
+	      info file.
 	      </para>
 	    </listitem>
 	  </varlistentry>
- 	</variablelist>
-      </sect3>
-      <sect3 id="sect_ref_directory_dir_di">
-	<title>
-	  Parameter group: -DIRECTORY (-DIR, -DI)
-	</title>
-	<para>
-	  General options for controlling where to find or where to write data.
-	</para>
-	<variablelist>
 	  <varlistentry>
 	    <term>
-	      <arg>tmp_redirected_to(trt)=<replaceable><directoryname></replaceable></arg>
+	      <arg>ssahavectorscreenin(ssvsi)=<replaceable>string</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para>
-		Default is an empty string. When set to a non-empty string,
-		MIRA will create the MIRA-temporary directory at the given
-		location instead of using the current working directory.
+		Default is <emphasis
+		role="underline"><projectname>_ssaha2vectorscreen_in.txt</emphasis>. Defines
+		the file to load a the info about possible vector sequence
+		stretches.
 	      </para>
-	      <para>
-		This option is particularly useful for systems which have
-		solid state disks (SSDs) and some very fast disk subsystems
-		which can be used for temporary files. Or in projects where
-		the input and output files reside on a NFS mounted directory
-		(current working dir), to put the tmp directory somewhere
-		outside the NFS (see also: Things you should not do).
+	    </listitem>
+	  </varlistentry>
+	  <varlistentry>
+	    <term>
+	      <arg>smaltvectorscreenin(stvsi)=<replaceable>string</replaceable></arg>
+	    </term>
+	    <listitem>
+	      <para> 
+		Default is <emphasis
+		role="underline"><projectname>_smaltvectorscreen_in.txt</emphasis>. Defines
+		the file to load a the info about possible vector sequence
+		stretches.
 	      </para>
-	      <para>
-		In both cases above, and for larger projects, MIRA then runs
-		a lot faster.
+	    </listitem>
+	  </varlistentry>
+	  <varlistentry>
+	    <term>
+	      <arg>backbonein(bbin)=<replaceable>string</replaceable></arg>
+	    </term>
+	    <listitem>
+	      <para> Default is
+	      <emphasis role="underline"><projectname>_in.<seqtype>.<filetype></emphasis>. Defines the
+	      file to load a backbone from. Note that you still must define the file type
+	      with <arg>-SB:bft</arg>.
 	      </para>
-	      <note>
-		Prior to MIRA 4.0rc2, users had to make sure themselves that
-		the target directory did not already exist. MIRA now handles
-		this automatically by creating directory names with a random
-		substring attached.
-	      </note>
 	    </listitem>
 	  </varlistentry>
 	</variablelist>
+	<para>
+	</para>
       </sect3>
-       <sect3 id="sect_ref_output_out">
+      <sect3 id="sect_ref_output_out">
 	<title>
-	  Parameter group: -OUTPUT (-OUT)
+	  -OUTPUT (-OUT)
 	</title>
 	<para>
 	  Options for controlling which results to write to which type of files.
@@ -4793,24 +4061,23 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  temporary results. One probably needs only the results. Temporary
 	  and extra temporary results are written while building different
 	  stages of a contig and are given as convenience for trying to find
-	  out why MIRA set some RMBs or disassembled some contigs.
+	  out why mira set some RMBs or disassembled some contigs.
 	</para>
 	<para>
 	  Output can be generated in these formats: CAF, Gap4 Directed
 	  Assembly, FASTA, ACE, TCS, WIG, HTML and simple text.
 	</para>
 	<para>
-	  Naming conventions of the files follow the rules described in
-	  section <emphasis role="bold">Input / Output</emphasis>, subsection
-	  <emphasis role="bold">Filenames</emphasis>.
+	  Naming conventions of the files follow the rules described in section
+	  <emphasis role="bold">Input / Output</emphasis>, subsection <emphasis role="bold">Filenames</emphasis>.
 	</para>
 	<variablelist>
 	  <varlistentry>
 	    <term>
-	      <arg>savesimplesingletsinproject(sssip)=<replaceable>on|y[es]|t[rue],off|n[o]|f[alse]</replaceable></arg>
+	      <arg>savesimplesingletsinproject(sssip)=<replaceable>on|yes|1,off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
-	      <para>
+	      <para> 
 		Default is <emphasis role="underline">no</emphasis>. Controls
 		whether 'unimportant' singlets are written to the result
 		files.
@@ -4823,7 +4090,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>savetaggedsingletsinproject(stsip)=<replaceable>on|y[es]|t[rue],off|n[o]|f[alse]</replaceable></arg>
+	      <arg>savetaggedsingletsinproject(stsip)=<replaceable>on|yes|1,off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para> Default
@@ -4848,73 +4115,72 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>remove_rollover_tmps(rrot)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>remove_rollover_tmps(rrot)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
-	      <para> Default
-	      is <emphasis role="underline">yes</emphasis>. Removes log and
-	      temporary files once they should not be needed anymore during
-	      the assembly process.
+	      <para> Default is <emphasis
+	      role="underline">yes</emphasis>. Removes log and temporary files once they
+	      should not be needed anymore during the assembly process.
 	      </para>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>remove_tmp_directory(rtd)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>remove_tmp_directory(rld)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
-	      <para> Default
-	      is <emphasis role="underline">no</emphasis>. Removes the
-	      complete tmp directory at the end of the assembly process. Some
-	      logs and temporary files contain useful information that you may
-	      want to analyse though, therefore the default of MIRA is not to
-	      delete it.
+	      <para> Default is <emphasis
+	      role="underline">no</emphasis>. Removes the complete tmp
+	      directory at the end of the assembly process. Some logs and
+	      temporary files contain useful information that you may want to
+	      analyse though, therefor the default of MIRA is not to delete it.
 	      </para>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>output_result_caf(orc)=<replaceable>on|y[es]|t[rue],
-	      off|n[o]|f[alse]</replaceable></arg>
+	      <arg>output_result_caf(orc)=<replaceable>on|yes|1,
+	      off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para> Default is
-	      <emphasis role="underline">yes</emphasis>.
+	      <emphasis role="underline">yes</emphasis>. 
 	      </para>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>output_result_maf(orm)=<replaceable>on|y[es]|t[rue],
-	      off|n[o]|f[alse]</replaceable></arg>
+	      <arg>output_result_maf(orm)=<replaceable>on|yes|1,
+	      off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para> Default is
-	      <emphasis role="underline">yes</emphasis>.
+	      <emphasis role="underline">yes</emphasis>. 
 	      </para>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>output_result_gap4da(org)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>output_result_gap4da(org)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para>
-		Default is <emphasis role="underline">no</emphasis>.
+		Default is <emphasis role="underline">yes</emphasis> for
+		projects only with Sanger reads, 'no' as soon as there are
+		454, Solexa or SOLiD reads involved.
 	      </para>
 	      <note>
-		If set to <emphasis role="underline">yes</emphasis>, MIRA will
-		automatically switch back
-		to <emphasis role="underline">no</emphasis> (and cannot be
-		forced to 'yes') when 454 or Solexa reads are present in the
-		project as this ensure that the file system does not get
-		flooded with millions of files.
+		MIRA will automatically switch to <emphasis
+		role="underline">no</emphasis> (and cannot be forced to 'yes')
+		when 454 or Solexa reads are present in the project as this
+		ensure that the file system does not get flooded with millions
+		of files.
 	      </note>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>output_result_fasta(orf)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>output_result_fasta(orf)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para>
@@ -4924,12 +4190,12 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>output_result_ace(ora)=<replaceable>on|y[es]|t[rue],
-	      off|n[o]|f[alse]</replaceable></arg>
+	      <arg>output_result_ace(ora)=<replaceable>on|yes|1,
+	      off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para> Default
-	      is <emphasis role="underline">no</emphasis>.
+	      is <emphasis role="underline">yes</emphasis>.
 	      </para>
 	      <note>
 		<para>
@@ -4940,7 +4206,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 		</para>
 		<para>
 		  There is a workaround: the MIRA distribution comes with a
-		  small Tcl script <command>fixACE4consed.tcl</command>
+		  small Tcl script <command>fixACE4consed.tcl</command> 
 		  which implements a workaround to allow consed loading the
 		  ACE generated by MIRA. Use the script like this:
 		</para>
@@ -4950,15 +4216,11 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 		  and then load the resulting outfile into consed.
 		</para>
 	      </note>
-	      <warning>
-		ACE is the least suited file format for NGS data. Use it only
-		when absolutely necessary.
-	      </warning>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>output_result_txt(ort)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>output_result_txt(ort)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para>
@@ -4968,7 +4230,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>output_result_tcs(ors)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>output_result_tcs(ors)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para>
@@ -4978,7 +4240,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>output_result_html(orh)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>output_result_html(orh)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para> Default
@@ -4988,7 +4250,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>output_tmpresult_caf(otc)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>output_tmpresult_caf(otc)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para>
@@ -4998,7 +4260,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>output_tmpresult_maf(otm)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>output_tmpresult_maf(otm)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para>
@@ -5008,7 +4270,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>output_tmpresult_gap4da(otg)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>output_tmpresult_gap4da(otg)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para>
@@ -5018,7 +4280,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>output_tmpresult_fasta(otf)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>output_tmpresult_fasta(otf)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para>
@@ -5028,7 +4290,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>output_tmpresult_ace(ota)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>output_tmpresult_ace(ota)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para>
@@ -5038,7 +4300,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>output_tmpresult_txt(ott)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>output_tmpresult_txt(ott)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para>
@@ -5048,7 +4310,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>output_result_tcs(ots)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>output_result_tcs(ots)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para> Default
@@ -5058,7 +4320,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>output_tmpresult_html(oth)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>output_tmpresult_html(oth)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para>
@@ -5068,7 +4330,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>output_exttmpresult_caf(oetc)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>output_exttmpresult_caf(oetc)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para>
@@ -5078,27 +4340,27 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>output_exttmpresult_gap4da(oetg)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>output_exttmpresult_gap4da(oetg)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para> Default is
-	      <emphasis role="underline">no</emphasis>.
+	      <emphasis role="underline">no</emphasis>. 
 	      </para>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>output_exttmpresult_fasta(oetf)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>output_exttmpresult_fasta(oetf)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para> Default is
-	      <emphasis role="underline">no</emphasis>.
+	      <emphasis role="underline">no</emphasis>. 
 	      </para>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>output_exttmpresult_ace(oeta)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>output_exttmpresult_ace(oeta)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para>
@@ -5108,7 +4370,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>output_exttmpresult_txt(oett)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>output_exttmpresult_txt(oett)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para>
@@ -5118,7 +4380,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <arg>output_exttmpresult_html(oeth)=<replaceable>on|y[es]|t[rue], off|n[o]|f[alse]</replaceable></arg>
+	      <arg>output_exttmpresult_html(oeth)=<replaceable>on|yes|1, off|no|0</replaceable></arg>
 	    </term>
 	    <listitem>
 	      <para>
@@ -5180,34 +4442,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
       </sect3>
     </sect2>
   </sect1>
-  <sect1 id="sect_ref_resuming_assemblies">
-    <title>
-      Resuming / restarting assemblies
-    </title>
-    <para>
-      It may happen that a MIRA run is interrupted - sometimes rather harshly
-      - due to events more or less outside your control like, e.g., power
-      failures, machine shutdowns for maintenance, missing disk space,
-      run-time quotas etc. This may be less of a problem when assembling or
-      mapping small data sets with run times between a couple of minutes up to
-      a few hours, but becomes a nuisance for larger data sets like in small
-      eukaryotes or RNASeq samples where the run time is measured in days.
-    </para>
-    <para>
-      If this happens in de-novo assemblies, MIRA has
-      a <emphasis>resume</emphasis> functionality: at predefined points in the
-      assembly process, MIRA writes out special files to disk which enables it
-      to resume the assembly at the point where these files were
-      written. Starting MIRA in resume mode is pretty easy: simply add the
-      resume flag <arg>-r</arg> on a command line like this:
-    </para>
-    <screen>
-<prompt>$</prompt> <userinput>mira -r ...</userinput></screen>
-    <para>
-      where the ellipsis ("...") above stands for the rest of the command line you would have used to start a new assembly.
-    </para>
-  </sect1>
-  <sect1 id="sect_ref_input_output">
+  <sect1 id="sect_ref_input___output">
     <title>
       Input / Output
     </title>
@@ -5216,7 +4451,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	Directories
       </title>
       <para>
-	Since version 3.0.0, MIRA now puts all files and directories it
+	Since version 3.0.0, mira now puts all files and directories it
 	generates into one sub-directory which is named
 	<filename><replaceable>projectname</replaceable>_assembly</filename>. This directory contains up to four
 	sub-directories:
@@ -5232,7 +4467,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  <para>
 	    <filename><replaceable>projectname</replaceable>_d_info</filename>: this directory contains information
 	    files of the final assembly. They provide statistics as well as, e.g.,
-	    information (easily parsable by scripts) on which read is found in which
+	    information (easily parseable by scripts) on which read is found in which
 	    contig etc.
 	  </para>
 	</listitem>
@@ -5255,6 +4490,10 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	    contains checkpoint files needed to resume assemblies that crashed
 	    or were stopped.
 	  </para>
+	<note>
+	  The checkpointing functionality has not been completely implemented
+	  yet and currently cannot be used.
+	</note>
 	</listitem>
       </itemizedlist>
       <para>
@@ -5264,13 +4503,94 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
       <title>
 	Filenames
       </title>
+      <sect3 id="sect_ref_input">
+	<title>
+	  Input
+	</title>
+	<para>
+	  The input files must be placed (or linked to) in the directory from which
+	  mira is called.
+	</para>
+	<variablelist>
+	  <varlistentry>
+	    <term>
+	      <filename><replaceable>projectname</replaceable>_in.fofn</filename>
+	    </term>
+	    <listitem>
+	      <para> File of filenames containing the names of the experiment
+	      or phd files to assemble when the <arg>-LR:ft=FOFNEXP</arg>
+	      option is used. One filename per line, blank lines accepted,
+	      lines starting with a hash (<literal>#</literal>) are treated as
+	      comment lines, nothing else. Use <arg>-FN:fofnin</arg> to
+	      change the default name.
+	      </para>
+	    </listitem>
+	  </varlistentry>
+	  <varlistentry>
+	    <term>
+	      <filename><replaceable>projectname</replaceable>_in.phd</filename>
+	    </term>
+	    <listitem>
+	      <para> File containing the sequences (and
+	      their qualities) to assemble in PHD format.
+	      </para>
+	    </listitem>
+	  </varlistentry>
+	  <varlistentry>
+	    <term>
+	      <filename><replaceable>projectname</replaceable>_in.fasta</filename>
+	    </term>
+	    <listitem>
+	      <para> File containing sequences and ...
+	      </para>
+	    </listitem>
+	  </varlistentry>
+	  <varlistentry>
+	    <term>
+	      <filename><replaceable>projectname</replaceable>_in.fasta.qual</filename>
+	    </term>
+	    <listitem>
+	      <para> ... file containing quality
+	      values of sequences for the assembly in FASTA format.
+	      </para>
+	    </listitem>
+	  </varlistentry>
+	  <varlistentry>
+	    <term>
+	      <filename><replaceable>projectname</replaceable>_in.fastq</filename>
+	    </term>
+	    <listitem>
+	      <para> 
+		FASTQ file containing sequences and qualities. MIRA
+		automatically recognises Sanger FASTQ format (base quality
+		offset = 33) and newer Illumina FASTQ format (base quality
+		offset = 64). Old Illumina FASTQ format with negative base
+		qualities (base offset < 64) is not supported anymore).
+	      </para>
+	    </listitem>
+	  </varlistentry>
+	  <varlistentry>
+	    <term>
+	      <filename><replaceable>projectname</replaceable>_in.caf</filename>
+	    </term>
+	    <listitem>
+	      <para> File containing the sequences (and their qualities) to
+	      assemble in CAF format. This format also may contain the result
+	      of an assembly (the contig consensus sequences).
+	      </para>
+	    </listitem>
+	  </varlistentry>
+	</variablelist>
+	<para>
+	</para>
+      </sect3>
       <sect3 id="sect_ref_output">
 	<title>
 	  Output
 	</title>
 	<para>
 	  These result output files and sub-directories are placed in in the
-	  <replaceable>projectname</replaceable>_results directory after a run of MIRA.
+	  <replaceable>projectname</replaceable>_results directory after a run of mira.
 	</para>
 	<variablelist>
 	  <varlistentry>
@@ -5279,11 +4599,11 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	    </term>
 	    <listitem>
 	      <para> Assembled project written in type =
-	      (<emphasis>maf</emphasis> / <emphasis>gap4da</emphasis> / <emphasis>caf</emphasis> /
+	      (<emphasis>gap4da</emphasis> / <emphasis>caf</emphasis> /
 	      <emphasis>ace</emphasis> / <emphasis>fasta</emphasis> /
 	      <emphasis>html</emphasis> / <emphasis>tcs</emphasis> /
 	      <emphasis>wig</emphasis> / <emphasis>text</emphasis>) format by
-	      MIRA, final result.
+	      mira, final result.
 	      </para>
 	      <para>
 		Type <emphasis>gap4da</emphasis> is a directory containing
@@ -5296,7 +4616,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 		<emphasis>text</emphasis> contain visual representations of
 		the assembly suited for viewing in browsers or as simple text
 		file. <emphasis>tcs</emphasis> is a summary of a contig suited
-		for "quick" analysis from command-line tools or even visual
+		for "quick" analyses from command-line tools or even visual
 		inspection. <emphasis>wig</emphasis> is a file containing
 		coverage information (useful for mapping assemblies) which can
 		be loaded and shown by different genome browsers (IGB, GMOD,
@@ -5308,27 +4628,18 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 		note that they come in two flavours:
 		<emphasis role="underline">padded</emphasis>
 		and <emphasis role="underline">unpadded</emphasis>. The padded
-		versions may contain stars (*) denoting gap base positions
+		versions may contains stars (*) denoting gap base positions
 		where there was some minor evidence for additional bases, but
 		not strong enough to be considered as a real base. Unpadded
 		versions have these gaps removed. Padded versions have an
 		additional postfix <emphasis>.padded</emphasis>, while
-		unpadded versions <emphasis>.unpadded</emphasis>.
+		unpadded versions do not have a special postfix.
 	      </para>
 	    </listitem>
 	  </varlistentry>
-	  <varlistentry>
-	    <term>
-	      <filename><replaceable>projectname</replaceable>_LargeContigs_out.<type></filename>
-	    </term>
-	    <listitem>
-	      These files are only written when MIRA runs in
-	      <emphasis>de-novo</emphasis> mode. They usually contain a subset
-	      of contigs deemed 'large' from the whole project. More details
-	      are given in the chapter "working with results of MIRA."
-	    </listitem>
-	  </varlistentry>
 	</variablelist>
+	<para>
+	</para>
       </sect3>
       <sect3 id="sect_ref_assembly_statistics_and_information_files">
 	<title>
@@ -5337,7 +4648,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	<para>
 	  These information files are placed in in the
 	  <replaceable>projectname</replaceable>_info directory after a run of
-	  MIRA.
+	  mira.
 	</para>
 	<variablelist>
 	  <varlistentry>
@@ -5358,7 +4669,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	      </para>
 	      <note>
 		In contrast to other information files, this file
-		always appears in the "info" directory, even when just
+		appears always in the "info" directory, even when just
 		intermediate results are reported.
 	      </note>
 	    </listitem>
@@ -5383,9 +4694,6 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	      reads, maximum and average coverage, average read length, number
 	      of A, C, G, T, N, X and gaps in consensus.
 	      </para>
-	      <warning>
-		For contigs containing digitally normalised reads, the coverage numbers may sometimes seem strange. E.g.: a contig may contain only one read, but have an average coverage of 3. This means that the read was a representative for 3 reads. The coverage numbers are computed as if all 3 reads had been assembled instead of the representative. In EST/RNASeq projects, these numbers thus represent the (more or less) true expression coverage.
-	      </warning>
 	    </listitem>
 	  </varlistentry>
 	  <varlistentry>
@@ -5395,17 +4703,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	    <listitem>
 	      <para> This file contains
 	      information about the tags (and their position) that are present in the
-	      consensus of a contig.
-	      </para>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term>
-	      <filename><replaceable>projectname</replaceable>_info_largecontigs.txt</filename>
-	    </term>
-	    <listitem>
-	      <para>For de-novo assemblies, this file contains the name of the
-	      contigs which pass the (adaptable) 'large contig' criterion.
+	      consensus of a contig. 
 	      </para>
 	    </listitem>
 	  </varlistentry>
@@ -5414,10 +4712,10 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	      <filename><replaceable>projectname</replaceable>_info_readrepeats.lst</filename>
 	    </term>
 	    <listitem>
-	      <para>
+	      <para> 
 		Tab delimited file with three columns: read name, repeat level tag, sequence.
 	      </para>
-	      <para>
+	      <para> 
 		This file permits a quick analysis of the repetitiveness of
 		different parts of reads in a project. See
 		<arg>-SK:rliif</arg> to control from which repetitive level on
@@ -5458,30 +4756,6 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	  </varlistentry>
 	  <varlistentry>
 	    <term>
-	      <filename><replaceable>projectname</replaceable>_info_WARNINGS_*.txt</filename>
-	    </term>
-	    <listitem>
-	      <para>
-		These files collect warning messages MIRA dumped out
-		throughout the assembly process. These warnings cover a wide
-		area of things monitored by MIRA and can - together with the
-		output written to STDOUT - give an insight as to why an
-		assembly does not behave as expected. There are three warning
-		files representing different levels of
-		criticality: <emphasis>critical</emphasis>, <emphasis>medium</emphasis>
-		and <emphasis>minor</emphasis>. These files may be empty,
-		meaning that no warning of the corresponding level was
-		printed. It is strongly suggested to have a look at least at
-		critical warnings during and after an assembly run.
-	      </para>
-	      <note>
-		These files are quite new to MIRA and not all warning messages
-		appear there yet. This will come over time.
-	      </note>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term>
 	      <filename><replaceable>projectname</replaceable>_error_reads_invalid</filename>
 	    </term>
 	    <listitem>
@@ -5507,13 +4781,57 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
       <variablelist>
 	<varlistentry>
 	  <term>
+	    <filename>EXP</filename>
+	  </term>
+	  <listitem>
+	    <para> Standard experiment files used in genome
+	    sequencing. Correct EXP files are expected. Especially the ID
+	    record (containing the id of the reading) and the LN record
+	    (containing the name of the corresponding trace file) should be
+	    correctly set. See <ulink
+	    url="http://www.sourceforge.net/projects/staden/"/> for links to
+	    online format description.
+	    </para>
+	  </listitem>
+	</varlistentry>
+	<varlistentry>
+	  <term>
+	    <filename>SCF</filename>
+	  </term>
+	  <listitem>
+	    <para> The Staden trace file format that has established itself as
+	    compact standard replacement for the much bigger ABI files. See
+	    <ulink url="http://www.sourceforge.net/projects/staden/"/> for
+	    links to online format description.
+	    </para>
+	    <para>
+	      The SCF files should be V2-8bit, V2-16bit, V3-8bit or V3-16bit
+	      and can be packed with compress or gzip.
+	    </para>
+	  </listitem>
+	</varlistentry>
+	<varlistentry>
+	  <term>
+	    <filename>CAF</filename>
+	  </term>
+	  <listitem>
+	    <para> Common Assembly Format (CAF) developed by the Sanger
+	    Centre. <ulink url="http://www.sanger.ac.uk/resources/software/caf.html"/> provides a
+	    description of the format and some software documentation as well as the
+	    source for compiling caf2gap and gap2caf (thanks to Rob Davies
+	    for this).
+	    </para>
+	  </listitem>
+	</varlistentry>
+	<varlistentry>
+	  <term>
 	    <filename>ACE</filename>
 	  </term>
 	  <listitem>
-	    <para> This old assembly file format used mainly by phrap and
+	    <para> The assembly file format used mainly by phrap and
 	    consed. Support for .ace output is currently only in test status in
-	    MIRA as documentation on that format is ... sparse and I currently
-	    don't have access to consed to verify my assumptions.
+	    mira as documentation on that format is ... sparse and I currently
+	    don' have access to consed to verify my assumptions.
 	    </para>
 	    <para> Using consed, you will need to load projects with -nophd to
 	    view them. Tags /in reads and consensus) are fully supported. The
@@ -5531,39 +4849,22 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	</varlistentry>
 	<varlistentry>
 	  <term>
-	    <filename>BAM</filename>
-	  </term>
-	  <listitem>
-	    The binary cousin of the SAM format. MIRA neither reads nor writes
-	    BAM, but BAMs can be created out of SAMs (which can be created via
-	    <command>miraconvert</command>).
-	  </listitem>
-	</varlistentry>
-	<varlistentry>
-	  <term>
-	    <filename>CAF</filename>
+	    <filename>MAF</filename>
 	  </term>
 	  <listitem>
-	    <para> Common Assembly Format (CAF) developed by the Sanger
-	    Centre. <ulink url="http://www.sanger.ac.uk/resources/software/caf.html"/> provides a
-	    description of the format and some software documentation as well as the
-	    source for compiling caf2gap and gap2caf (thanks to Rob Davies
-	    for this).
+	    <para> MIRA Assembly Format (MAF). A faster and more compact form
+	    than EXP, CAF or ACE. See documentation in separate file. 
 	    </para>
 	  </listitem>
 	</varlistentry>
 	<varlistentry>
 	  <term>
-	    <filename>EXP</filename>
+	    <filename>HTML</filename>
 	  </term>
 	  <listitem>
-	    <para> Standard experiment files used in genome
-	    sequencing. Correct EXP files are expected. Especially the ID
-	    record (containing the id of the reading) and the LN record
-	    (containing the name of the corresponding trace file) should be
-	    correctly set. See <ulink
-	    url="http://www.sourceforge.net/projects/staden/"/> for links to
-	    online format description.
+	    <para> Hypertext Markup Language. Projects written in HTML format
+	    can be viewed directly with any table capable browser. Display is even
+	    better if the browser knows style sheets (CSS).
 	    </para>
 	  </listitem>
 	</varlistentry>
@@ -5579,7 +4880,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	    ending.
 	    </para>
 	    <para>
-	      MIRA writes two kinds of FASTA files for
+	      Mira writes two kinds of FASTA files for
 	      results: <emphasis>padded</emphasis> and
 	      <emphasis>unpadded</emphasis>. The difference is that the padded
 	      version still contains the gap (pad) character (an asterisk) at
@@ -5592,54 +4893,6 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	</varlistentry>
 	<varlistentry>
 	  <term>
-	    <filename>GBF, GBK</filename>
-	  </term>
-	  <listitem>
-	    <para> GenBank file format as used at the NCBI to describe
-	    sequences. MIRA is able to read and write this format (but only
-	    for viruses or bacteria) for using sequences as backbones in an
-	    assembly. Features of the GenBank format are also transferred
-	    automatically to Staden compatible tags.
-	    </para>
-	    <para>
-	      If possible, use GFF3 instead (see below).
-	    </para>
-	  </listitem>
-	</varlistentry>
-	<varlistentry>
-	  <term>
-	    <filename>GFF3</filename>
-	  </term>
-	  <listitem>
-	    <para> General feature format used to describe sequences and
-	    features on these sequences. MIRA is able to read and write this
-	    format.
-	    </para>
-	  </listitem>
-	</varlistentry>
-	<varlistentry>
-	  <term>
-	    <filename>HTML</filename>
-	  </term>
-	  <listitem>
-	    <para> Hypertext Markup Language. Projects written in HTML format
-	    can be viewed directly with any table capable browser. Display is even
-	    better if the browser knows style sheets (CSS).
-	    </para>
-	  </listitem>
-	</varlistentry>
-	<varlistentry>
-	  <term>
-	    <filename>MAF</filename>
-	  </term>
-	  <listitem>
-	    <para> MIRA Assembly Format (MAF). A faster and more compact form
-	    than EXP, CAF or ACE. See documentation in separate file.
-	    </para>
-	  </listitem>
-	</varlistentry>
-	<varlistentry>
-	  <term>
 	    <filename>PHD</filename>
 	  </term>
 	  <listitem>
@@ -5652,31 +4905,13 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	</varlistentry>
 	<varlistentry>
 	  <term>
-	    <filename>SAM</filename>
-	  </term>
-	  <listitem>
-	    <para> The Sequence Alignment/Map Format. MIRA does not write SAM
-	    directly, but <command>miraconvert</command> can be used for
-	    converting a MAF (or CAF) file to SAM.
-	    </para>
-	    <para>
-	      MIRA cannot read SAM though.
-	    </para>
-	  </listitem>
-	</varlistentry>
-	<varlistentry>
-	  <term>
-	    <filename>SCF</filename>
+	    <filename>GBF, GBK</filename>
 	  </term>
 	  <listitem>
-	    <para> The Staden trace file format that has established itself as
-	    compact standard replacement for the much bigger ABI files. See
-	    <ulink url="http://www.sourceforge.net/projects/staden/"/> for
-	    links to online format description.
-	    </para>
-	    <para>
-	      The SCF files should be V2-8bit, V2-16bit, V3-8bit or V3-16bit
-	      and can be packed with compress or gzip.
+	    <para> GenBank file format as used at the NCBI to describe
+	    sequences. mira is able to read this format for using sequences as
+	    backbones in an assembly. Features of the GenBank format are also
+	    transferred automatically to Staden compatible tags.
 	    </para>
 	  </listitem>
 	</varlistentry>
@@ -5688,7 +4923,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	    <para> XML based file with information relating to
 	    traces. Used at the NCBI and ENSEMBL trace archive to store additional
 	    information (like clippings, insert sizes etc.) for projects. See further
-	    down for for a description of the fields used and
+	    down for for a description of the fields used and 
 	    <ulink url="http://www.ncbi.nlm.nih.gov/Traces/trace.cgi?cmd=show&f=rfc&m=main&s=rfc"/> for a full description of all fields.
 	    </para>
 	  </listitem>
@@ -5698,9 +4933,9 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	    <filename>TCS</filename>
 	  </term>
 	  <listitem>
-	    <para> Transpose Contig Summary. A text file as written by MIRA
+	    <para> Transpose Contig Summary. A text file as written by mira
 	    which gives a summary of a contig in tabular fashion, one line per
-	    base. Nicely suited for "quick" analysis from command line tools,
+	    base. Nicely suited for "quick" analyses from command line tools,
 	    scripts, or even visual inspection in file viewers or spreadsheet
 	    programs.
 	    </para>
@@ -5859,11 +5094,11 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
       </title>
       <para>
 	The actual stage of the assembly is written to STDOUT, giving status messages
-	on what MIRA is actually doing. Dumping to STDERR is almost not used
+	on what mira is actually doing. Dumping to STDERR is almost not used
 	anymore by MIRA, remnants will disappear over time.
       </para>
       <para>
-	Some debugging information might also be written to STDOUT if MIRA
+	Some debugging information might also be written to STDOUT if mira
 	generates error messages.
       </para>
       <para>
@@ -5876,7 +5111,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	    WARNING: Messages in this error class do not stop the assembly but
 	    are meant as an information to the user. In some rare cases these
 	    errors are due to (an always possible) error in the I/O routines
-	    of MIRA, but nowadays they are mostly due to unexpected (read:
+	    of mira, but nowadays they are mostly due to unexpected (read:
 	    wrong) input data and can be traced back to errors in the
 	    preprocessing stages. If these errors arise, you
 	    definitively <emphasis role="bold">DO</emphasis> want to check how
@@ -5890,7 +5125,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	<listitem>
 	  <para>
 	    FATAL: Messages in this error class actually stop the
-	    assembly. These are mostly due to missing files that MIRA needs or
+	    assembly. These are mostly due to missing files that mira needs or
 	    to very garbled (wrong) input data.
 	  </para>
 	  <para>
@@ -5910,70 +5145,9 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
       <para>
       </para>
     </sect2>
-    <sect2 id="sect_ref_ssaha2smalt">
-      <title>
-	SSAHA2 / SMALT ancillary data
-      </title>
-      <para>
-	The <command>ssaha2</command> or <command>smalt</command> programs -
-	both from the Sanger Centre - can be used to detect possible vector
-	sequence stretches in the input data for the assembly.  MIRA can load
-	the result files of a
-	<command>ssaha2</command> or <command>smalt</command> run and
-	interpret the results to tag the possible vector sequences at the ends
-	of reads.
-      </para>
-      <para>
-	Note that this also uses the parameters
-	<arg>-CL:msvsgs:msvsmfg:msvsmeg</arg> (see below).
-      </para>
-      <para>
-	ssaha2 must be called like this "<literal>ssaha2
-	  <ssaha2options> vector.fasta sequences.fasta</literal>"
-	to generate an output that can be parsed by MIRA. In the above
-	example, replace <filename>vector.fasta</filename> by the name
-	of the file with your vector sequences and
-	<filename>sequences.fasta</filename> by the name of the file
-	containing your sequencing data.
-      </para>
-      <para>
-	smalt must be called like this: "<literal>smalt map -f ssaha
-	  <ssaha2options> hash_index sequences.fasta</literal>"
-      </para>
-      <para>
-	This makes you basically independent from any other commercial or
-	license-requiring vector screening software. For Sanger reads, a
-	combination of <command>lucy</command> and
-	<command>ssaha2</command> or <command>smalt</command> together with
-	this parameter should do the trick. For reads coming from 454
-	pyro-sequencing, <command>ssaha2</command> or
-	<command>smalt</command> and this parameter will also work very
-	well. See the usage manual for a walkthrough example on how to use
-	SSAHA2 / SMALT screening data.
-      </para>
-      <note>
-	The output format of SSAHA2 must the native output format
-	(<literal>-output ssaha2</literal>). For SMALT, the output
-	option <literal>-f ssaha</literal> must be used. Other formats cannot
-	be parsed by MIRA.
-      </note>
-      <note>
-	I currently use the following SSAHA2 options:
-	<literal>-kmer 8 -skip 1 -seeds 1 -score 12 -cmatch 9 -ckmer
-	  6</literal>
-      </note>
-      <note>
-	Anyone contributing SMALT parameters?
-      </note>
-      <note>
-	The sequence vector clippings generated from SSAHA2 /
-	SMALT data do not replace sequence vector clippings loaded via
-	the EXP, CAF or XML files, they rather extend them.
-      </note>
-    </sect2>
     <sect2 id="sect_ref_xml_traceinfo">
       <title>
-	XML TRACEINFO ancillary data
+	XML TRACEINFO
       </title>
       <para>
 	MIRA extracts the following data from the TRACEINFO files:
@@ -6090,12 +5264,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	Contig naming
       </title>
       <para>
-	MIRA names contigs the following
-	way: <emphasis><projectname>_<contigtype><number></emphasis>. While <emphasis><projectname></emphasis>
-	is dictated by the <arg>--project=</arg> parameter
-	and <emphasis><number></emphasis> should be clear,
-	the <emphasis><contigtype></emphasis> might need additional
-	explaining. There are currently three contig types existing:
+	MIRA names contigs the following way: <emphasis><projectname>_<contigtype><number></emphasis>. While <emphasis><projectname></emphasis> is dictated by the <arg>--project=</arg> parameter and <emphasis><number></emphasis> should be clear, the <emphasis><contigtype></emphasis> might need additional explaining. There are currently three contig types existing:
       </para>
       <orderedlist>
 	<listitem>
@@ -6105,11 +5274,10 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	</listitem>
 	<listitem>
 	  <para>
-	    _rep_c: only for genome assembly mode. These are contigs
-	    containing only repetitive areas. These contigs
-	    had <emphasis>_lrc</emphasis> as type in previous version of MIRA,
-	    this was changed to the <emphasis>_rep_c</emphasis> to make things
-	    clearer.
+	    _rep_c: these are contigs containing only repetitive areas. These
+	    contigs had <emphasis>_lrc</emphasis> as type in previous version
+	    of MIRA, this was changed to the <emphasis>_rep_c</emphasis> to
+	    make things clearer.
 	  </para>
 	</listitem>
 	<listitem>
@@ -6118,29 +5286,6 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	    single read.
 	  </para>
 	</listitem>
-	<listitem>
-	  <para>
-	    _dn: these is an additional contig type which can occur when MIRA
-	    ran a digital normalisation step during the assembly. Contigs
-	    which contain reads completely covered by a DGNr tag will get an
-	    additional "_dn" as part of their name to show that they contain
-	    read representatives for digital normalisation. E.g.:
-	    "contig_dn_c1".
-	  </para>
-	  <para>
-	    Reads covered only partly by the DGNr tag do not trigger the _dn
-	    naming.
-	  </para>
-	  <note>
-	    <title>Important side note</title> Due to the digital
-	    normalisation step, the coverage numbers in the info file
-	    regarding contig statistics will not represent the number of
-	    reads in the contig, but they will show an approximation of
-	    the true coverage or expression value as if there had not been
-	    a digital normalisation step performed. The approximation may
-	    be around 10 to 20% below the true value.
-	  </note>
-	</listitem>
       </orderedlist>
       <para>
 	Basically, for genome assemblies MIRA starts to build contigs in areas
@@ -6149,13 +5294,13 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	this get a <emphasis>_c</emphasis> name. If during the assembly MIRA
 	reaches a point where it cannot start building a contig in a
 	non-repetitive region, it will name the contig
-	<emphasis>_rep_c</emphasis> instead of <emphasis>_c</emphasis>. This
-	is why "_rep_c" contigs occur late in a genome assembly.
+	<emphasis>_rep_c</emphasis> instead of <emphasis>_c</emphasis>.
       </para>
       <note>
-	MIRA has a different understanding of "rock solid" when in EST/RNASeq
-	assembly: here, MIRA will try to reconstruct a full length gene
-	sequence, starting with the most abundant genes.
+	Although the distinction between <emphasis>_c</emphasis> and
+	<emphasis>_rep_c</emphasis> makes sense only for genome assemblies,
+	EST assemblies also use it (for no better reason than me not having an
+	alternative or better naming scheme there).
       </note>
       <note>
 	Depending on the settings of <arg>-AS:mrpc</arg>, your project may or
@@ -6164,25 +5309,29 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	singlet-contigs and hence not get <emphasis>_s</emphasis> names.
       </note>
     </sect2>
-    <sect2 id="sect_ref_recovering_strain_specific_consensus">
+    <sect2 id="sect_sxa_recovering_strain_specific_consensus">
       <title>
 	Recovering strain specific consensus as FASTA
       </title>
       <para>
 	In case you used strain information in an assembly, you can
 	recover the consensus for just any given strain
-	by using <command>miraconvert</command> and convert from a
+	by using <command>convert_project</command> and convert from a
 	full assembly format (e.g. MAF or CAF) which also carries
 	strain information to FASTA. MIRA will automatically detect
 	the strain information and create one FASTA file per strain
 	encountered.
       </para>
-      <para>
-	It will also create a blend of all strains encountered and
-	conveniently add "AllStrains" to the name of these files. Note that
-	this blend may or may not be something you need, but in some
-	cases I found it to be useful.
-      </para>
+      <note>
+	To be able to distinguish between consensus bases with a
+	'<literal>N</literal>' call and areas of a strain which were
+	not covered at all by any read of that strain, MIRA introduces
+	the '<literal>@</literal>' sign as additional "base". That is,
+	if you see a '<literal>@</literal>' in the consensus of a
+	given strain, this may be either due to too low coverage --
+	and therefore a hole -- or to a genuine deletion in your
+	strain.
+	</note>
     </sect2>
   </sect1>
   <sect1 id="sect_ref_tags_used_in_the_assembly_by_mira_and_edit">
@@ -6215,11 +5364,11 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	</listitem>
 	<listitem>
 	  <para>
-	    Fpas: GenBank feature for a poly-A sequence. Used in EST, cDNA or
+	    FpAS: GenBank feature for a poly-A signal. Used in EST, cDNA or
 	    transcript assembly. Either read in the input files or set when using
-	    <arg>-CL:cpat</arg>. This allows to keep the poly-A sequence in
-	    the reads during assembly without them interfering as massive
-	    repeats or as mismatches.
+	    <arg>-CL:cpat</arg>. This allows to keep the poly-A signal in the reads
+	    during assembly without them interfering as massive repeats or as
+	    mismatches.
 	  </para>
 	</listitem>
 	<listitem>
@@ -6254,7 +5403,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	    in <emphasis role="bold">R</emphasis>ead
 	    respectively <emphasis role="bold">C</emphasis>ontig.  These tags
 	    denote positions in an assembly with conflicts that could not be
-	    resolved automatically by MIRA. These positions should be looked
+	    resolved automatically by mira. These positions should be looked
 	    at during the finishing process.
 	  </para>
 	  <para>
@@ -6281,12 +5430,12 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	    columns (which is always a bit tricky).
 	  </para>
 	  <para>
-	    MIRA will automatically set these tags when it encounters repeats
+	    mira will automatically set these tags when it encounters repeats
 	    and will tag exactly those bases that can be used to discern the
 	    differences.
 	  </para>
 	  <para>
-	    Seeing such a tag in the consensus means that MIRA was not able to
+	    Seeing such a tag in the consensus means that mira was not able to
 	    finish the disentanglement of that special repeat stretch or that
 	    it found a new one in one of the last passes without having the
 	    opportunity to resolve the problem.
@@ -6310,16 +5459,16 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	    consensus. These tags denote SNP positions.
 	  </para>
 	  <para>
-	    MIRA will automatically set these tags when it encounters SNPs and
+	    mira will automatically set these tags when it encounters SNPs and
 	    will tag exactly those bases that can be used to discern the
 	    differences.  They denote SNPs as they occur within an organism
 	    (SAO), between two or more organisms (SRO) or within and between
 	    organisms (SIO).
 	  </para>
 	  <para>
-	    Seeing such a tag in the consensus means that MIRA set this as a
+	    Seeing such a tag in the consensus means that mira set this as a
 	    valid SNP in the assembly pass. Seeing such tags only in reads (but not in
-	    the consensus) shows that in a previous pass, MIRA thought these
+	    the consensus) shows that in a previous pass, mira thought these
 	    bases to be SNPs but that in later passes, this SNP does not appear anymore
 	    (perhaps due to resolved misassemblies).
 	  </para>
@@ -6330,7 +5479,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	    <emphasis role="bold">M</emphasis>ismatch <emphasis role="bold">S</emphasis>olved
 	    is tagged to positions in the assembly where the consensus of
 	    different sequencing technologies (Sanger, 454, Ion Torrent, Solexa, PacBio, SOLiD)
-	    reads differ, but MIRA thinks it found out the correct
+	    reads differ, but mira thinks it found out the correct
 	    solution. Often this is due to low coverage of one of the types
 	    and an additional base calling error.
 	  </para>
@@ -6346,7 +5495,7 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	    <emphasis role="bold">M</emphasis>ismatch <emphasis role="bold">U</emphasis>nresolved
 	    is tagged to positions in the assembly where the consensus of
 	    different sequencing technologies (Sanger, 454, Ion Torrent, Solexa, SOLiD)
-	    reads differ, but MIRA could not find a good resolution. Often this
+	    reads differ, but mira could not find a good resolution. Often this
 	    is due to low coverage of one of the types and an additional base
 	    calling error.
 	  </para>
@@ -6367,10 +5516,10 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
 	</listitem>
 	<listitem>
 	  <para>
-	    MNRr: (only with <arg>-KS:mnr</arg> active). The <emphasis role="bold">M</emphasis>asked
+	    MNRr: (only with <arg>-SK:mnr</arg> active). The <emphasis role="bold">M</emphasis>asked
 	    <emphasis role="bold">N</emphasis>asty <emphasis role="bold">R</emphasis>epeat tags are set over those parts of a read that
 	    have been detected as being many more times present than the average
-	    sub-sequence. MIRA will hide these parts during the initial
+	    sub-sequence. mira will hide these parts during the initial
 	    all-against-all overlap finding routine (SKIM3) but will otherwise happily
 	    use these sequences for consensus generation during contig building.
 	  </para>
@@ -6429,15 +5578,15 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
       Where reads end up: contigs, singlets, debris
     </title>
     <para>
-      At the start, things are simple: a read either aligns with other reads or it does not. Reads which
+      At the start, things are simple: a read either aligns with other reads or it does not. Reads which 
       align with other reads form contigs, and these MIRA will save in the results with a contig name
       of <emphasis>_c</emphasis>.
     </para>
     <para>
-      However, not all reads can be placed in an assembly. This can have several reasons and
+      However, not all reads can be placed in an assembly. This can have several reasons and 
       these reads may end up at two different places in the result files: either in the
       <emphasis>debris</emphasis> file, then just as a name entry, or as singlet (a "contig"
-      with just one read) in the regular results.
+      with just one read) in the regular results. 
     </para>
     <orderedlist>
       <listitem>
@@ -6467,10 +5616,11 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
     <para>
       MIRA filters out these reads in different stages: before and after read
       clipping, during the SKIM stage, during the Smith-Waterman overlap
-      checking stage or during contig building. The exact place where these
-      single reads land is dependent on why they do not align with other
-      reads. Reads landing in the debris file will have the reason and stage
-      attached to the decision.
+      checking stage or during contig building.
+    </para>
+    <para>
+      The exact place where these single reads land is dependend on why they
+      do not align with other reads.
     </para>
   </sect1>
   <sect1 id="sect_ref_snp_discovery">
@@ -6494,9 +5644,33 @@ parameters= SANGER_SETTINGS -AS:mrl=80:epoq=no <userinput>\</userinput>
       <arg>-CO:mr=yes</arg> (which is standard in all
       <literal>--job=...</literal> incantations of <command>mira</command> and
       in some steps of <command>miraSearchESTSNPs</command>. Furthermore, you
-      will need to provide <emphasis>strain information</emphasis>, either in
-      the manifest file or in ancillary NCBI TRACEINFO XML files.
+      will need:
     </para>
+    <variablelist>
+      <varlistentry>
+	<term>
+	  in de-novo assemblies:
+	</term>
+	<listitem>
+	  <para>
+	    to provide a <emphasis>straindata</emphasis> file for the reads or
+	    have the strain information in ancillary NCBI TRACEINFO XML files.
+	  </para>
+	</listitem>
+      </varlistentry>
+      <varlistentry>
+	<term>
+	  in mapping assemblies
+	</term>
+	<listitem>
+	  <para>
+	    to provide a <emphasis>straindata</emphasis> file for the reads
+	    and also give the reference sequence(s) (backbone(s)) a strain
+	    name via the <arg>-SB:bsn</arg> parameter.
+	  </para>
+	</listitem>
+      </varlistentry>
+    </variablelist>
     <para>
       The effect of using strain names attached to reads can be described
       briefly like this. Assume that you have 6 reads (called R1 to R6), three
@@ -6635,142 +5809,13 @@ R2 (hum)  ......A...G......
 R4 (chi)  ......C...G......
 R6 (chi)  ......C...G......</screen>
   </sect1>
-  <sect1 id="sect_ref_data_reduction">
-    <title>
-      Data reduction: subsampling vs. lossless digital normalisation
-    </title>
-    <para>
-      Some data sets have way too much data. Sometimes it is simply more than
-      needed like, e.g., performing a de-novo genome assembly with reads
-      enough for 300x coverage is like taking a sledgehammer for cracking a
-      nut. Sometimes it is even more than is good for an assembly (see also:
-      motif dependent sequencing errors).
-    </para>
-    <para>
-      MIRA being an overlap-based assembler, reducing a data set helps to keep
-      time and memory requirements low. There are basically two ways to
-      perform this: reduction by subsampling and reduction by digital
-      normalisation. Both methods have their pros and cons and can be used
-      effectively in different scenarios.
-    </para>
-    <itemizedlist>
-      <listitem>
-	<para>
-	  <emphasis>Subsampling</emphasis> is a process to create a smaller,
-	  hopefully representative set from a larger data set.
-	</para>
-	<para>
-	  In sequencing, various ways exist to perform subsampling. As
-	  sequencing data sets from current sequencing technologies can be
-	  seen as essentially randomised when coming fresh from the machine,
-	  the selection step can be as easy as selecting the
-	  first <emphasis>n</emphasis> reads. When the input data set is not
-	  random (e.g. in SAM/BAM files with mapped data), one must resort to
-	  random selection of reads.
-	</para>
-	<para>
-	  Subsampling must be done by the user prior to assembly with MIRA.
-	</para>
-	<para>
-	  On the upside, subsampling preserves the exact copy number structure
-	  of the input data set: a repeat with n copies in a genome will
-	  always be represented by reads forming n copies of the repeat in the
-	  reduced data set. Furthermore, subsampling is comparatively
-	  insensitive to motif dependent sequencing errors. On the downside,
-	  subsampling will more probably loose rare events of the data set
-	  (e.g., rare SNPs of a cell population or rare transcripts in
-	  EST/RNASeq). Also, in EST/RNASeq projects, subsampling will not be
-	  able to reduce extraordinary coverage events to a level which make
-	  the assembly not painfully slow. Examples for the later being rRNA
-	  genes or highly expressed house-keeping genes where todays' Illumina
-	  data sets sometimes contains enough data to reach coverage numbers
-	  ≥ 100,000x or even a million x.
-	</para>
-	<para>
-	  Subsampling should therefore be used for single genome de-novo
-	  assemblies; or for EST/RNASeq assemblies which need reliable
-	  coverage numbers for transcript expression data but where at least
-	  all rDNA has been filtered out prior to assembly.
-	</para>
-      </listitem>
-      <listitem>
-	<para>
-	  <emphasis>Digital normalisation</emphasis> is a process to perform a
-	  reduction of sequencing data redundancy. It was made known to a
-	  wider audience by the paper <emphasis>"A Reference-Free Algorithm
-	  for Computational Normalization of Shotgun Sequencing
-	  Data"</emphasis> by Brown et al. (see
-	  <ulink url="http://arxiv.org/abs/1203.4802"/>).
-	</para>
-	<para>
-	  The normalisation process works by progressively going through the
-	  sequencing data and selecting reads which bring new, previously
-	  unseen information to the assembly and discarding those which
-	  describe nothing new. For single genome assemblies, this has the
-	  effect that repeats with n copies in the genome are afterwards
-	  present often with just enough reads to reconstruct only a single
-	  copy of the repeat. In EST/RNASeq assemblies, this leads to
-	  reconstructed transcripts having all the more or less same coverage.
-	</para>
-	<para>
-	  The normalisation process as described in the paper allows for a
-	  certain lossiness during the data reduction as it was developed to
-	  cope with billions of reads. E.g., it will often loose borders in
-	  genome reorganisation events or SNP information from ploidies, from
-	  closely related genes copies or from closely related species.
-	</para>
-	<para>
-	  MIRA implements a variant of the algorithm: the <emphasis>lossless
-	  digital normalisation</emphasis>. Here, normalised data has copy
-	  numbers reduced like in the original algorithm, but all variants
-	  (SNPs, borders of reorganisation events etc.) present in the
-	  original data set are retained in the reduced data set. Furthermore,
-	  the normalisation is parameterised to take place only for
-	  excessively repetitive parts of a data set which would lead to
-	  overly increased run-time and memory consumption. This gives the
-	  assembler the opportunity to correctly evaluate and work with
-	  repeats which do not occur "too often" in a data set while still
-	  being able to reconstruct at least one copy of the really nasty
-	  repeats.
-	</para>
-	<para>
-	  Digital normalisation should not be done prior to an assembly with
-	  MIRA, rather the MIRA parameter to perform a digital normalisation
-	  on the complete data set should be used.
-	</para>
-	<para>
-	  The lossless digital normalisation of MIRA should be used for
-	  EST/RNASeq assemblies containing highly repetitive data. Metagenome
-	  assemblies may also profit from this feature.
-	</para>
-	<note>
-	  <para>
-	    MIRA keeps track of the approximate coverage represented by the
-	    reads chosen in the digital normalisation process. That is, MIRA is
-	    able to give approximate coverage numbers as if digital
-	    normalisation had never happened. The approximation may be around 10
-	    to 20% below the true value. Contigs affected by this coverage
-	    approximation are denoted with an additional "_dn" in their name.
-	  </para>
-	  <para>
-	    Due to the digital
-	    normalisation step, the coverage numbers in the info file
-	    regarding contig statistics will not represent the number of
-	    reads in the contig, but they will show an approximation of
-	    the true coverage or expression value as if there had not been
-	    a digital normalisation step performed.
-	</para>
-	</note>
-      </listitem>
-    </itemizedlist>
-  </sect1>
   <sect1 id="sect_ref_caveats">
     <title>
       Caveats
     </title>
-    <sect2 id="sect_ref_using_artificial_reads">
+    <sect2 id="sect_using_artificial_reads">
       <title>
-	Using data not from sequencing instruments: artificial / synthetic reads
+	Using data not from sequencing instruments: artifical / syntethic reads
       </title>
       <para>
 	The default parameters for MIRA assemblies work best when given real
@@ -6783,38 +5828,11 @@ R6 (chi)  ......C...G......</screen>
       <para>
 	If one doesn't take utter care to make these artificial reads at least
 	behave a little bit like real sequencing data, a number of quality
-	insurance algorithms of MIRA might spot that they "look funny" and
+	ensurance algorithms of MIRA might spot that they "look funny" and
 	trim back these artificial reads ... sometimes even removing them
-	completely.
-      </para>
-      <note>
-	<title>Summary tips for creating artificial reads for MIRA assemblies</title>
-	<para>
-	  The following should lead to the least amount of surprises for most
-	  assembly use cases when calling MIRA only with the most basic
-	  switches <literal>--project=... --job=...</literal>
-	</para>
-	<orderedlist>
-	  <listitem>
-	    <emphasis role="bold">Length:</emphasis> between 50 and 20000 bp
-	  </listitem>
-	  <listitem>
-	    <emphasis role="bold">Quality values:</emphasis> give your
-	    artificial reads quality values. Using <emphasis>30</emphasis>
-	    as quality value for your bases should be OK for most
-	    applications.
-	  </listitem>
-	  <listitem>
-	    <emphasis role="bold">Orientation:</emphasis> for every read you
-	    create, create a read with the same data (bases and quality
-	    values) in reverse complement direction.
-	  </listitem>
-	</orderedlist>
-      </note>
-      <para>
-	The following list gives all the gory details on how synthetic reads
-	should look like or which MIRA algorithms to switch off in certain
-	cases:
+	completely. The following list gives a short overview on what these
+	synthetic reads should look like or which MIRA algorithms to switch
+	off in certain cases:
       </para>
       <itemizedlist>
 	<listitem>
@@ -6853,15 +5871,14 @@ R6 (chi)  ......C...G......</screen>
 	</listitem>
 	<listitem>
 	  <para>
-	    Sequencing type/technology: MIRA currently knows Sanger, 454, Ion
-	    Torrent, Solexa, PacBioHQ/LQ and "Text" as sequencing
-	    technologies, every read entered in an assembly must be one of
-	    those.
+	    Sequencing type/technology: MIRA currently knows Sangers, 454, Ion
+	    Torrent, Solexa and PacBio as sequencing technologies, every read
+	    entered in an assembly must be one of those.
 	  </para>
 	  <para>
 	    Artificial reads should be classified depending on the data they
 	    were created from, that is, Sanger for consensus of Sanger reads,
-	    454 for consensus of 454 reads etc. However, should reads created
+	    454 for consensus of 454 reads etc. However, Should reads created
 	    from Illumina consensus be much longer than, say, 200 or 300
 	    bases, you should treat them as Sanger reads.
 	  </para>
@@ -6921,7 +5938,7 @@ R6 (chi)  ......C...G......</screen>
 	  distributed across the genome, MIRA will enforce an average coverage
 	  and temporarily reject reads from a contig when this average
 	  coverage multiplied by a safety factor is reached at a given
-	  site. This strategy reduces over-compression of repeats during the
+	  site. This strategy reduces overcompression of repeats during the
 	  contig building phase and keeps reads in reserve for other copies of
 	  that repeat.
 	</para>
@@ -6946,16 +5963,16 @@ R6 (chi)  ......C...G......</screen>
 	  following happens:
 	</para>
 	<para>
-	  (Note: <emphasis>p</emphasis> is the parameter <arg>-AS:urdsip</arg>)
+	  (Note: $p$ is the parameter <arg>-AS:urdsip</arg>)
 	</para>
 	<para>
-	  Pass 1 to <emphasis>p-1</emphasis>: MIRA happily assembles everything together and calculates a
-	  number of different things, amongst them an average coverage of ~8. At the
-	  end of pass <emphasis>p-1</emphasis>, it will announce this average coverage as first estimate
+	  Pass 1 to $p-1$: MIRA happily assembles everything together and calculates a 
+	  number of different things, amongst them an average coverage of ~8. At the 
+	  end of pass $p-1$, it will announce this average coverage as first estimate 
 	  to the assembly process.
 	</para>
 	<para>
-	  Pass <emphasis>p</emphasis>: MIRA has still assembled everything together, but at the end of each
+	  Pass $p$: MIRA has still assembled everything together, but at the end of each
 	  pass the contig self-checking algorithms now include an "average coverage
 	  check". They'll invariably find the 17 reads stacked and decide (looking at
 	  the <arg>-AS:ardct</arg> parameter which is assumed to be 2 for this example)
@@ -6963,9 +5980,9 @@ R6 (chi)  ......C...G......</screen>
 	  get flagged as possible repeats.
 	</para>
 	<para>
-	  Pass <emphasis>p+1</emphasis> to end: the "possibly repetitive" reads get a much tougher
+	  Pass $p+1$ to end: the "possibly repetitive" reads get a much tougher
 	  treatment in MIRA. Amongst other things, when building the contig, the contig
-	  now looks that "possibly repetitive" reads do not over-stack by an average
+	  now looks that "possibly repetitive" reads do not overstack by an average
 	  coverage multiplied by a safety value (<arg>-AS:urdcm</arg>) which we'll
 	  assume now to be 1.5 in this example. So, at a certain point, say when read 14
 	  or 15 of that possible repeat want to be aligned to the contig at this given
@@ -6977,9 +5994,9 @@ R6 (chi)  ......C...G......</screen>
 	  file.
 	</para>
 	<para>
-	  Tough luck. I do have ideas on how to re-integrate those reads at the and of an
-	  assembly, but I have deferred doing this as in every case I had looked up,
-	  adding those reads to the contigs wouldn't have changed anything ... there's
+	  Tough luck. I do have ideas on how to reintegrate those reads at the and of an 
+	  assembly, but I have deferred doing this as in every case I had looked up, 
+	  adding those reads to the contigs wouldn't have changed anything ... there's 
 	  already enough coverage.
 	</para>
 	<para>
@@ -6993,34 +6010,32 @@ R6 (chi)  ......C...G......</screen>
 	  Keeping 'long' repetitive contigs separate
 	</title>
 	<para>
-	  MIRA had since 2.9.36 a feature to keep long repeats in separate
-	  contigs. Due to algorithm changes, this feature is now standard. The
-	  effect of this is that contigs with non-repetitive sequence will
-	  stop at a 'long repeat' border which cannot be crossed by a single
-	  read or by paired reads, including only the first few bases of the
-	  repeat. Long repeats will be kept as separate contigs.
+	  MIRA had since 2.9.36 a feature to keep long repeats in separate contigs
+	  (<arg>-AS:klrs</arg>). Due to algorithm changes, this feature is now standard
+	  (even if the command line parameter is still present). The effect of this is
+	  that contigs with non-repetitive sequence will stop at a 'long repeat' border,
+	  including only the first few bases of the repeat. Long repeats will be kept as
+	  separate contigs.
 	</para>
 	<para>
-	  This has been implemented to get a clean overview on which parts of
-	  an assembly are 'safe' and which parts will be 'difficult'. For
-	  this, the naming of the contigs has been extended: contigs named
-	  with a '_c' at the end are contigs which contain mostly 'normal'
-	  coverage. Contigs with "rep_c" are contigs which contain mostly
-	  sequence classified as repetitive and which could not be assembled
-	  together with a 'c' contig.
+	  This has been implemented to get a clean overview on which parts of an
+	  assembly are 'safe' and which parts will be 'difficult'. For this, the naming
+	  of the contigs has been extended: contigs named with a '_c' at the end are
+	  contigs which contain mostly 'normal' coverage. Contigs with "rep_c" are
+	  contigs which contain mostly sequence classified as repetitive and which could
+	  not be assembled together with a 'c' contig.
 	</para>
 	<para>
-	  The question remains: what are 'long' repeats? MIRA defines these as
-	  repeats that are not spanned by any read that has non-repetitive
-	  parts at the end. Basically -for shotgun assemblies - the mean
-	  length of the reads that go into the assembly defines the minimum
+	  The question remains: what are 'long' repeats. MIRA defines these as repeats
+	  that are not spanned by any read that has non-repetitive parts at the end. So,
+	  basically, the mean length of the reads that go into the assembly defines the
 	  length of 'long' repeats that have to be kept in separate contigs.
 	</para>
 	<para>
-	  It has to be noted that when using paired-end (or template)
-	  sequencing, 'long' repeats which can be spanned by read-pairs (or
-	  templates) are frequently integrated into 'normal' contigs as MIRA
-	  can correctly place them most of the time.
+	  It has to be noted that when using paired-end (or template) sequencing, 'long'
+	  repeats which can be spanned by read-pairs (or templates) are mostly
+	  integrated into 'normal' contigs as MIRA can correctly place them most of the
+	  time.
 	</para>
       </sect3>
       <sect3 id="sect_ref_helping_finishing_by_tagging_reads_with_haf_tags">
@@ -7029,9 +6044,9 @@ R6 (chi)  ......C...G......</screen>
 	</title>
 	<para>
 	  HAF tags (HAsh Frequency) are set by MIRA when the option to colour reads by
-	  kmer frequency (<arg>-GE:crkf</arg>, on by default in most --job combinations)
+	  hash frequency (<arg>-GE:crhf</arg>, on by default in most --job combinations)
 	  is on. These tags show the status of k-mers (stretch of bases of given length
-	  <emphasis>k</emphasis>) in read sequences: whether MIRA recognised them as being present in
+	  $k$) in read sequences: whether MIRA recognised them as being present in
 	  sub-average, average, above average or repetitive numbers.
 	</para>
 	<para>
@@ -7100,7 +6115,7 @@ R6 (chi)  ......C...G......</screen>
 	      the proposed join involves contig ends mostly covered by HAF2
 	      tags. Joining these contigs is probably a safe bet. The assembly may have
 	      missed this join because of too many errors in the read ends or because
-	      sequence having been clipped away which could be useful to join contigs.
+	      sequence having been clipped away which could be useful to join contigs. 
 	      Just check whether the join seems sensible, then join.
 	    </para>
 	  </listitem>
@@ -7116,12 +6131,11 @@ R6 (chi)  ......C...G......</screen>
 	  <listitem>
 	    <para>
 	      the proposed join involves contig ends mostly covered by HAF4
-	      tags. Joining these contigs should be done with some caution, it
-	      may be a repeat occurring twice in the sequence.  Check whether
-	      the contig ends in question align with ends of several other
-	      contigs. If not, joining is probably the way to go. If potential
-	      joins exist with several other contigs, then it's a repeat (see
-	      below).
+	      tags. Joining these contigs should be done with some caution, it may be a
+	      repeat occurring twice in the sequence.
+	      Check whether the contig ends in question align with ends of other
+	      contigs. If not, joining is probably the way to go. If potential joins exist
+	      with other contigs, then it's a repeat (see below).
 	    </para>
 	  </listitem>
 	  <listitem>
@@ -7158,7 +6172,7 @@ R6 (chi)  ......C...G......</screen>
 	The recommended way to deal with this problem is: import the results from MIRA
 	into your finishing program like you always do. Then finish the genome there,
 	export the project from the finishing program as CAF and finally use
-	miraconvert (from the MIRA package ) with the "-r" option to
+	convert_project (from the MIRA package ) with the "-r" option to
 	recalculate the optimal consensus of your finished project.
       </para>
       <para>
@@ -7171,12 +6185,12 @@ R6 (chi)  ......C...G......</screen>
       <para>
       </para>
       <para>
-	Then, use<command>miraconvert</command> <emphasis>with</emphasis> <emphasis>option</emphasis> <emphasis>'-r'</emphasis> to
+	Then, use convert_project <emphasis>with</emphasis> <emphasis>option</emphasis> <emphasis>'-r'</emphasis> to
 	convert it into any other format that you need. Example for converting to a
 	CAF and a FASTA format with correct consensus:
       </para>
       <screen>
-<prompt>$</prompt> <userinput>miraconvert -t caf -t fasta -r c demo3.caf final_result</userinput></screen>
+<prompt>$</prompt> <userinput>convert_project -f caf -t caf -t fasta -r c demo3.caf final_result</userinput></screen>
       <para>
       </para>
     </sect2>
@@ -7189,14 +6203,14 @@ R6 (chi)  ......C...G......</screen>
       <itemizedlist>
 	<listitem>
 	  <para>
-	    MIRA cannot work with EXP files resulting from GAP4 that already
+	    mira cannot work with EXP files resulting from GAP4 that already
 	    have been edited. If you want to reassemble an edited GAP4 project, convert
 	    it to CAF format and use the <arg>-caf</arg> option to load.
 	  </para>
 	</listitem>
 	<listitem>
 	  <para>
-	    As also explained earlier, MIRA relies on sequencing vector being
+	    As also explained earlier, mira relies on sequencing vector being
 	    recognised in preprocessing steps by other programs. Sometimes, when a whole
 	    stretch of bases is not correctly marked as sequencing vector, the reads
 	    might not be aligned into a contig although they might otherwise match quite
@@ -7207,7 +6221,7 @@ R6 (chi)  ......C...G......</screen>
 	</listitem>
 	<listitem>
 	  <para>
-	    MIRA has been developed to assemble shotgun sequencing or EST
+	    mira has been developed to assemble shotgun sequencing or EST
 	    sequencing data. There are no explicit limitations concerning length or
 	    number of sequences. However, there are a few implicit assumptions that were
 	    made while writing portions of the code:
@@ -7215,24 +6229,43 @@ R6 (chi)  ......C...G......</screen>
 	  <orderedlist>
 	    <listitem>
 	      <para>
-		Problems which might arise with 'unnatural' long sequence
-		reads: my implementation of the Smith-Waterman alignment
-		routines. I use a banded version with linear running time
-		(linear to the bandwidth) but quadratic space usage. So,
-		comparing two 'reads' of length 5000 will result in memory
-		usage of 95 MiB, two reads with 50000 bases will need 9.5 GiB.
+		Sequence data produced by electrophoresis rarely surpasses 1000 usable
+		bases and I never heard of, let alone seen, more than 1100. The fast
+		filtering SKIM relies on the fact that sequences will never exceed 10000
+		bases in length.
+	      </para>
+	    </listitem>
+	    <listitem>
+	      <para>
+		The next problem that might arise with 'unnatural' long sequence
+		reads will be my implementation of the Smith-Waterman alignment
+		routines. I use a banded version with linear running time (linear
+		to the bandwidth) but quadratic space usage. So, comparing two
+		'reads' of length 5000 will result in memory usage of 100MB. I
+		know that this could be considered as a flaw.  On the other hand -
+		unless someone comes up with electrophoresis producing reads with
+		more than 2000 usable bases - I see no real need to change this as
+		long as there are more important things on the TODO list. Of
+		course, if anyone is willing to contribute a fast banded SW
+		alignment routine which runs in linear time and space, just feel
+		free to contact the author.
 	      </para>
+	    </listitem>
+	    <listitem>
 	      <para>
-		This problem has become acute now with PacBio, I'm working on
-		it. In the mean time, current usable sequence length of PacBio
-		are more in the 3 to 4 kilobase range, with only a few reads
-		attaining or surpassing 20 kb. So Todays' machines should
-		still be able to handle the problem more or less effortlessly.
+		Current data structures allow for a worst case read coverage of
+		maximally 16384 reads on top of the other.
+	      </para>
+	      <para> Note: this limit was more than enough for about any kind of
+	      genome sequencing, but since people started to do sequencing of
+	      non-normalised EST libraries with 454 and Solexa, this limit can be
+	      reached all too often. This will change in future releases.
 	      </para>
 	    </listitem>
 	    <listitem>
 	      <para>
-		32 bit versions of MIRA are not supported anymore.
+		the 32-bit Linux version is limited by the memory made available
+		by the Linux kernel (somewhere around 2.3 to 2.7GB).
 	      </para>
 	    </listitem>
 	    <listitem>
@@ -7242,9 +6275,23 @@ R6 (chi)  ......C...G......</screen>
 	    </listitem>
 	    <listitem>
 	      <para>
-		MIRA is not fully multi-threaded (yet), though most
-		bottlenecks are now in code areas which cannot be
-		multi-threaded by algorithm design.
+		the 64-bit Linux version has no implicit memory limits,
+		although the maximum number of bases of all reads may not
+		surpass 2.147.483.648 bases.  With that, even aliens with a
+		genome size ~800 times bigger than humans could be tackled (if
+		it were not for other limitations, mainly RAM and processing
+		power).
+	      </para>
+	    </listitem>
+	    <listitem>
+	      <para>
+		mira is not fully multi-threaded (yet), but even Sanger projects
+		for bigger bacteria can be assembled in ~2-3 hours on a current
+		hardware platform. Fungi may take two or three days.
+	      </para>
+	      <para>
+		For 454 genome projects, bacteria should be done in about a day at most,
+		Fungi could take about 10 days.
 	      </para>
 	    </listitem>
 	  </orderedlist>
@@ -7304,6 +6351,15 @@ R6 (chi)  ......C...G......</screen>
 	  </itemizedlist>
 	</listitem>
       </itemizedlist>
+      <para>
+      </para>
+      <para>
+	Note: Versions with uneven minor versions (e.g. 1.1.x, 1.3.x, ..., 2.1.x, ...
+	etc.) are development versions which might be unstable in parts (although I
+	don't think so). But to catch possible bugs, development versions of
+	mira are distributed with tons of internal checks compiled into the
+	code, making it somewhere between 10% and 50% slower than it could be.
+      </para>
     </sect2>
   </sect1>
   <sect1 id="sect_ref_things_you_should_not_do">
@@ -7323,8 +6379,8 @@ R6 (chi)  ......C...G......</screen>
 	cope with the amount of data MIRA needs to shift to and from disk
 	(writes/reads to the tmp directory). Slowdowns of a factor of 10 and
 	more have been observed. In case you have no other possibility, you
-	can force MIRA to run atop a NFS using <arg>-NW:cnfs=warn</arg>
-	(<arg>-NW:cnfs=no</arg>), but you have been warned.
+	can force MIRA to run atop a NFS using <arg>-MI:sonfs=no</arg>, but
+	you have been warned.
       </para>
       <para>
 	In case you want to keep input and output files on NFS, you can use
@@ -7338,48 +6394,42 @@ R6 (chi)  ......C...G......</screen>
       </title>
       <para>
 	Assembling sequences without quality values is like ... like ... like
-	driving a car downhill a sinuous mountain road with no rails at 200
-	km/h without brakes, airbags and no steering wheel. With a ravine on
-	one side and a rock face on the other. Did I mention the missing
-	seat-belts? You <emphasis>might</emphasis> get down safely, but
-	experience tells the result will rather be a bloody mess.
-      </para>
-      <para>
-	Well, assembling without quality values is a bit like above, but
-	bloodier. And the worst: you (or the people using the results of such
-	an assembly) will notice the gore only until it is way too late and
-	money has been sunk in follow-up experiments based on wrong data.
+	driving a car downhill a sinuous mountain road at 200 km/h without
+	brakes, airbags and no steering wheel. With a ravine on one side and a
+	rock face on the other. Did I mention the missing seat-belts? You
+	<emphasis>might</emphasis> get down safely, but experience tells the
+	result will rather be a bloody mess.
       </para>
       <para>
 	All MIRA routines internally are geared toward quality values guiding
 	decisions. No one should ever assembly anything without quality
 	values. Never. Ever. Even if quality values are sometimes inaccurate,
-	they do help.
+	they do help. 
       </para>
       <para>
 	Now, there are <emphasis role="bold">very rare occasions</emphasis>
 	where getting quality values is not possible. If you absolutely cannot
-	get them, and I mean only in this case, use the following
-	switch:<literal>--noqualities[=SEQUENCINGTECHNOLOGY]</literal> and
-	additionally give a default quality for reads of a readgroup. E.g.:
+	get them, and I mean only in this case, use these
+	switches:<literal>--noqualities[=SEQUENCINGTECHNOLOGY]
+	<replaceable>SEQUENCINGTECHNOLOGY</replaceable>_SETTINGS
+	-AS:bdq=30</literal>. E.g.:
       </para>
-      <screen>parameters= --noqualities=454
-
-readgroup
-technology=454
-data=...
-default_qual=30</screen>
+      <screen>--noqualities=454 454_SETTINGS -AS:bdq=30</screen>
+      <para>
+	or
+      </para>
+      <screen>--noqualities SANGER_SETTINGS -AS:bdq=30 454_SETTINGS -AS:bdq=30</screen>
       <para>
 	This tells MIRA not to complain about missing quality values and to
-	fake a quality value of 30 for all reads (of a readgroup) having no
-	qualities, allowing some MIRA routines (in standard parameter
-	settings) to start disentangling your repeats.
+	fake a quality value of 30 for all reads having no qualities, allowing
+	some MIRA routines (in standard parameter settings) to start
+	disentangling your repeats.
       </para>
       <warning>
 	Doing the above has some severe side-effects. You will be, e.g., at
 	the mercy of non-random sequencing errors. I suggest combining the
 	above with a <arg>-CO:mrpg=4</arg> or higher. You also may want to
-	tune the default quality parameter together with <arg>-CO:mnq</arg>
+	tune the <arg>-AS:bdq</arg> parameter together with <arg>-CO:mnq</arg>
 	and <arg>-CO:mgqrt</arg> in cases where you mix sequences with and
 	without quality values.
       </warning>
@@ -7390,7 +6440,7 @@ default_qual=30</screen>
       Useful third party programs
     </title>
     <para>
-      Viewing the results of a MIRA assembly or preprocessing the sequences
+      Viewing the results of a mira assembly or preprocessing the sequences
       for an assembly can be done with a number of different programs. The
       following ones are are just examples, there are a lot more packages
       available:
@@ -7414,14 +6464,12 @@ default_qual=30</screen>
 	  Assembly viewer / finishing / preprocessing
 	</term>
 	<listitem>
-	  <para>
-	    You'll want GAP4 or its successor GAP5 (generally speaking: the
-	    Staden package) to preprocess the sequences, visualise and
-	    eventually rework the results when using gap4da output. The Staden
-	    package comes with a fully featured sequence preparing and
-	    annotating engine (pregap4) that is very useful to preprocess your
-	    Sanger data (conversion between file types, quality clipping,
-	    tagging etc.).
+	  <para> You'll want GAP4 (generally speaking: the Staden package) to
+	  preprocess the sequences, visualise and eventually rework the
+	  results when using gap4da output. The Staden package comes with a
+	  fully featured sequence preparing and annotating engine (pregap4)
+	  that is very useful to preprocess your data (conversion between file
+	  types, quality clipping, tagging etc.).
 	  </para>
 	  <para>
 	    See <ulink url="http://www.sourceforge.net/projects/staden/"/> for
@@ -7435,16 +6483,16 @@ default_qual=30</screen>
 	  Vector screening
 	</term>
 	<listitem>
-	  <para>
+	  <para> 
 	    Reading result files from <command>ssaha2</command> or
-	    <command>smalt</command> from the Sanger Centre is supported
-	    directly by MIRA to perform a fast and efficient tagging of
+	    <command>smalt</command> from the Sanger centre is supported
+	    directly by mira to perform a fast and efficient tagging of
 	    sequencing vector stretches. This makes you basically independent
 	    from any other commercial or license-requiring vector screening
 	    software.  For Sanger reads, a combination of
 	    <command>lucy</command> (see below), <command>ssaha2</command> or
-	    <command>smalt</command> together with the MIRA parameters for
-	    SSAHA2 / SMALT support (see all <arg>-CL:msvs*</arg> parameters) and quality clipping
+	    <command>smalt</command> together with the mira parameters for
+	    SSAHA2 / SMALT support (<arg>-CL:msvs</arg>) and quality clipping
 	    (<arg>-CL:qc</arg>) should do the trick. For reads coming from 454
 	    pyro-sequencing, <command>ssaha2</command> or
 	    <command>smalt</command> and the SSAHA2 / SMALT support also work
@@ -7466,15 +6514,15 @@ default_qual=30</screen>
 	</term>
 	<listitem>
 	  <para> <command>lucy</command> from TIGR (now JCVI) is another
-	  useful sequence preprocessing program for Sanger data. Lucy is a
-	  utility that prepares raw DNA sequence fragments for sequence
-	  assembly. The cleanup process includes quality assessment,
-	  confidence reassurance, vector trimming and vector removal.
+	  useful sequence preprocessing program. Lucy is a utility that
+	  prepares raw DNA sequence fragments for sequence assembly. The
+	  cleanup process includes quality assessment, confidence reassurance,
+	  vector trimming and vector removal.
 	  </para>
 	  <para>
 	    There's a small script in the MIRA 3rd party package which
 	    converts the clipping data from the lucy format into something
-	    MIRA can understand (NCBI Traceinfo).
+	    mira can understand (NCBI Traceinfo).
 	  </para>
 	  <para>
 	    See <ulink url="ftp://ftp.tigr.org/pub/software/Lucy/"/> to download the source code
@@ -7491,10 +6539,9 @@ default_qual=30</screen>
 	  can be done with clview from TIGR. See
 	  <ulink url="http://www.tigr.org/tdb/tgi/software/"/>.
 	  </para>
-	  <para>
-	    A better alternative is Tablet <ulink
-	    url="http://bioinf.scri.ac.uk/tablet/"/> which also reads SAM
-	    format.
+	  <para> 
+	    Tablet <ulink url="http://bioinf.scri.ac.uk/tablet/"/> may also be
+	    used for this.
 	  </para>
 	</listitem>
       </varlistentry>
@@ -7503,7 +6550,7 @@ default_qual=30</screen>
 	  Assembly coverage analysis
 	</term>
 	<listitem>
-	  <para>
+	  <para> 
 	    The Integrated Genome Browser (IGB) of the GenoViz project at
 	    SourceForge (<ulink
 	    url="http://sourceforge.net/projects/genoviz/"/>) is just perfect
@@ -7517,7 +6564,7 @@ default_qual=30</screen>
 	  Preprocessing (base calling)
 	</term>
 	<listitem>
-	  <para>
+	  <para> 
 	    TraceTuner (<ulink
 	    url="http://sourceforge.net/projects/tracetuner/"/>) is a tool for
 	    base and quality calling of trace files from DNA sequencing
@@ -7580,13 +6627,13 @@ default_qual=30</screen>
 	Estimating needed memory for an assembly project
       </title>
       <para>
-	Since the V2.9.24x3 version of MIRA, there is <command>miramem</command> as
+	Since the V2.9.24x3 version of mira, there is <command>miramem</command> as
 	program call. When called from the command line, it will ask a number of
 	questions and then print out an estimate of the amount of RAM needed to
 	assemble the project. Take this estimate with a grain of salt, depending on
 	the sequences properties, variations in the estimate can be +/- 30% for
 	bacteria and 'simple' eukaryotes. The higher the number of repeats is, the
-	more likely you will need to restrict memory usage in some way or another.
+	more likely you will need to restrict memory usage in some way or another. 
       </para>
       <para>
 	Here's the transcript of a session with miramem:
@@ -7595,44 +6642,43 @@ default_qual=30</screen>
 This is MIRA V3.2.0rc1 (development version).
 
 Please cite: Chevreux, B., Wetter, T. and Suhai, S. (1999), Genome Sequence
-Assembly Using Trace Signals and Additional Sequence Information.
-Computer Science and Biology: Proceedings of the German Conference on
-Bioinformatics (GCB) 99, pp. 45-56.
+Assembly Using Trace Signals and Additional Sequence Information.          
+Computer Science and Biology: Proceedings of the German Conference on      
+Bioinformatics (GCB) 99, pp. 45-56.                                        
 
 To (un-)subscribe the MIRA mailing lists, see:
         http://www.chevreux.org/mira_mailinglists.html
 
 After subscribing, mail general questions to the MIRA talk mailing list:
-        mira_talk at freelists.org
+        mira_talk at freelists.org                                         
 
-To report bugs or ask for features, please use the SourceForge ticketing
-system at:
-        http://sourceforge.net/p/mira-assembler/tickets/
-This ensures that requests do not get lost.
+To report bugs or ask for features, please use the new ticketing system at:
+        http://sourceforge.net/apps/trac/mira-assembler/                   
+This ensures that requests don't get lost.                                 
 
 [...]
 
 miraMEM helps you to estimate the memory needed to assemble a project.
-Please answer the questions below.
+Please answer the questions below.                                    
 
 Defaults are give in square brackets and chosen if you just press return.
 Hint: you can add k/m/g modifiers to your numbers to say kilo, mega or giga.
 
-Is it a genome or transcript (EST/tag/etc.) project? (g/e/) [g]
-g
+Is it a genome or transcript (EST/tag/etc.) project? (g/e/) [g] 
+g                                                               
 Size of genome? [4.5m] <userinput>9.8m</userinput>
-9800000
-Size of largest chromosome? [9800000]
-9800000
-Is it a denovo or mapping assembly? (d/m/) [d]
-d
-Number of Sanger reads? [0]
-0
+9800000                                                         
+Size of largest chromosome? [9800000]                           
+9800000                                                         
+Is it a denovo or mapping assembly? (d/m/) [d]                  
+d                                                               
+Number of Sanger reads? [0]                                     
+0                                                               
 Are there 454 reads? (y/n/) [n] <userinput>y</userinput>
-y
-Number of 454 GS20 reads? [0]
-0
-Number of 454 FLX reads? [0]
+y                                                               
+Number of 454 GS20 reads? [0]                                   
+0                                                               
+Number of 454 FLX reads? [0]                                    
 0
 Number of 454 Titanium reads? [0] <userinput>750k</userinput>
 750000
@@ -7662,7 +6708,7 @@ for automatic memory management control this:
   -AS:amm, -AS:kpmf, -AS:mps
 Further switches that might reduce RAM (at cost of run time
 or accuracy):
-  -SK:mkim, -SK:mchr (both runtime); -SK:mhpr (accuracy)
+  -SK:mhim, -SK:mchr (both runtime); -SK:mhpr (accuracy)
 *************************************************************</screen>
       <para>
 	If your RAM is not large enough, you can still assemble projects by
@@ -7677,11 +6723,63 @@ or accuracy):
 	Some numbers on speed
       </title>
       <para>
-	To be rewritten for MIRA4.
+	<emphasis role="bold">NEW</emphasis> since 2.7.4: The new SKIM3
+	algorithm (initial all-against-all read comparison) is now
+	approximately 60 times faster that the SKIM algorithms of earlier
+	versions. E.g. SKIMming of 53,000 Sanger type shotguns reads now takes
+	a bit more than a minute instead of 62 minutes.
+      </para>
+      <para>
+	The times given below are only approximate and were gathered on my
+	home development box (Athlon 4800+) using a single core and minimal
+	debug code compiled in, somewhat slowing down the whole process.
+      </para>
+      <para>
+	Example 1: a small genomic project with 720 reads forming 35k bases of
+	contig
+	sequences. Using <literal>--job=denovo,genome,accurate,sanger</literal>
+	and resolving minor repeat misassemblies, full read extension and
+	automatic contig editing takes 19 seconds.
+      </para>
+      <para>
+	Example 2: a bacterial genome project with two very closely related
+	strains, 53000 Sanger reads forming a bit more than 3 megabases of
+	contig sequences for each strain. Using
+	the <literal>--job=denovo,genome,accurate,sanger</literal> (four main
+	passes, read extension, clipping of vector remnants), resolving repeat
+	misassemblies (mostly RNA stretches, but also some very closely
+	related genes) takes 1hr and 48 minutes and uses a maximum of 1.2GB of
+	RAM (miramem estimated the usage to be 1.5GB).
+      </para>
+      <para>
+	Example 3: Here are the times for miraSearchESTSNPs in a
+	non-normalised (thus very repetitive) EST project, 9747 reads with a
+	average length of 674 used bases,
+      </para>
+      <itemizedlist>
+	<listitem>
+	  <para>
+	    The fast filtering algorithm performs about 12 million sequence
+	    comparisons per second (8 seconds).
+	  </para>
+	</listitem>
+	<listitem>
+	  <para>
+	    Banded Smith-Waterman performs around 750 sequence alignments per
+	    second (with a 15% band to each side, which is quite generous),
+	    4:07 for about 182000 alignment checks.
+	  </para>
+	</listitem>
+      </itemizedlist>
+      <para>
+	The three steps of miraSearchESTSNPs (each one again subdivided in a
+	number of MIRA passes), including resolving very high coverage contigs
+	(>500 sequences) in multiple passes and splitting them into different
+	SNP and splice variants takes about 20 minutes.
       </para>
     </sect2>
   </sect1>
-  <sect1 id="sect_ref_known_problems_bugs">
+  <sect1 id="sect_ref_known_problems___bugs">
     <title>
       Known Problems / Bugs
     </title>
@@ -7691,7 +6789,7 @@ or accuracy):
     <orderedlist>
       <listitem>
 	<para>
-	  MIRA can only read unedited EXP files.
+	  mira can only read unedited EXP files. 
 	</para>
       </listitem>
       <listitem>
@@ -7701,6 +6799,14 @@ or accuracy):
 	  able to trace the reason yet.
 	</para>
       </listitem>
+      <listitem>
+	<para>
+	  There's an unexpected bug for MacOS which leads to rubbish
+	  assemblies on large data sets which assemble totally fine with Linux
+	  versions of MIRA. I have not been able to find out the reason for
+	  this yet.
+	</para>
+      </listitem>
     </orderedlist>
     <para>
     </para>
@@ -7720,6 +6826,13 @@ or accuracy):
 	  end of the sequences.
 	</para>
       </listitem>
+      <listitem>
+	<para>
+	  The assignment of reads to debris or singlets and whether or not
+	  they are put into the final result is messy, the statistic numbers
+	  about this sometimes even wrong. Needs to be redone.
+	</para>
+      </listitem>
     </orderedlist>
     <para>
     </para>
@@ -7735,8 +6848,19 @@ or accuracy):
     <orderedlist>
       <listitem>
 	<para>
-	  Making Smith-Waterman parts of the process multi-threaded or use SIMD
-	  (currently stopped due to other priorities like PacBio etc.)
+	  Making parts of the process multi-threaded (currently stopped due to
+	  other priorities like Solexa etc.)
+	</para>
+      </listitem>
+      <listitem>
+	<para>
+	  Less disk usage when using EST assembly on 10 or more million Solexa
+	  reads
+	</para>
+      </listitem>
+      <listitem>
+	<para>
+	  Others nifty ideas that I have not completely thought out yet.
 	</para>
       </listitem>
     </orderedlist>
@@ -7748,11 +6872,11 @@ or accuracy):
       Working principles
     </title>
     <para>
-      Note: description is old and needs to be adapted to the current 4.x line
-      of MIRA.
+      Note: description is old and needs to be adapted to the current 2.9.x /
+      3.x line.
     </para>
     <para>
-      To avoid the "garbage-in, garbage-out" problematic, MIRA uses a 'high
+      To avoid the "garbage-in, garbage-out" problematic, mira uses a 'high
       quality alignments first' contig building strategy. This means that the
       assembler will start with those regions of sequences that have been
       marked as good quality (high confidence region - HCR) with low error
@@ -7764,7 +6888,7 @@ or accuracy):
     <para>
       This assembly approach relies on some of the automatic editing
       functionality provided by the EdIt package which has been integrated in
-      parts within MIRA.
+      parts within mira.
     </para>
     <para>
       This is an approximate overview on the steps that are executed while
@@ -7801,7 +6925,7 @@ or accuracy):
       </listitem>
       <listitem>
 	<para>
-	  Optional pre-assembly read extension step: MIRA tries to extend HCR
+	  Optional pre-assembly read extension step: mira tries to extend HCR
 	  of reads by analysing the read pairs from the previous
 	  alignment. This is a bit shaky as reads in this step have not been
 	  edited yet, but it can help. Go back to step 2.
@@ -7813,7 +6937,7 @@ or accuracy):
 	  the alignment graph (through in-depth analysis up to a given level)
 	  and then adding the most probable overlap candidates to a given
 	  contig. Contigs may reject reads if these introduce to many errors
-	  in the existing consensus. Errors in regions known as dangerous
+	  in the existing consensus.  Errors in regions known as dangerous
 	  (for the time being only ALUS and REPT) get additional attention by
 	  performing simple signal analysis when alignment discrepancies
 	  occur.
@@ -7879,3 +7003,4 @@ or accuracy):
     </para>
   </sect1>
 </chapter>
+
diff --git a/doc/docbook/chap_results_part.xml b/doc/docbook/chap_results_part.xml
index f299609..4ff96d2 100644
--- a/doc/docbook/chap_results_part.xml
+++ b/doc/docbook/chap_results_part.xml
@@ -3,12 +3,15 @@
 <chapter id="chap_results">
   <chapterinfo>
     <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="versionfile"/>
+    <releaseinfo>
+      <emphasis role="light">Document revision	$Id$</emphasis>
+    </releaseinfo>
     <author>
       <firstname>Bastien</firstname>
       <surname>Chevreux</surname>
       <email>bach at chevreux.org</email>
     </author>
-    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="copyrightfile"/>
+    <copyright><year>2011</year><holder>Bastien Chevreux</holder></copyright>
   </chapterinfo>
   <blockquote>
     <attribution>Solomon Short</attribution>
@@ -23,6 +26,7 @@
     a few others. The preferred formats are CAF and MAF, as these format can be
     translated into any other supported format.
   </para>
+
   <sect1 id="sect_res_looking_at_results">
     <title>
       MIRA output directories and files
@@ -32,6 +36,11 @@
       <filename><replaceable>projectname</replaceable>_assembly</filename> in
       which a number of sub-directories will have appeared.
     </para>
+    <note>
+      The <filename><replaceable>projectname</replaceable></filename> is
+      determined by the mira parameter <literal>--project=...</literal> or,
+      if used, the specific <literal>--proout=...</literal> parameter.
+    </note>
     <para>
       These sub-directories (and files within) contain the results of the
       assembly itself, general information and statistics on the results and
@@ -51,7 +60,7 @@
 	  <filename><replaceable>projectname</replaceable>_d_info</filename>:
 	  this directory contains information files of the final
 	  assembly. They provide statistics as well as, e.g., information
-	  (easily parsable by scripts) on which read is found in which
+	  (easily parseable by scripts) on which read is found in which
 	  contig etc.
 	</para>
       </listitem>
@@ -72,7 +81,8 @@
 	<para>
 	  <filename><replaceable>projectname</replaceable>_d_chkpt</filename>:
 	  this directory contains checkpoint files needed to resume
-	  assemblies that crashed or were stopped.
+	  assemblies that crashed or were stopped (not implemented yet, but
+	  soon)
 	</para>
       </listitem>
     </itemizedlist>
@@ -84,10 +94,10 @@
 	The following files in
 	<filename><replaceable>projectname</replaceable>_d_results</filename>
 	contain results of the assembly in different formats. Depending on the
-	output options you defined for MIRA, some files may or may not be
-	there. As long as the CAF or MAF format are present, you can translate
-	your assembly later on to about any supported format with the
-	<command>miraconvert</command> program supplied with the MIRA
+	output options of MIRA, some files may or may not be there. As long as
+	the CAF or MAF format are present, you can translate your assembly
+	later on to about any supported format with the
+	<command>convert_project</command> program supplied with the MIRA
 	distribution:
       </para>
       <itemizedlist>
@@ -151,39 +161,6 @@
 	  </para>
 	</listitem>
       </itemizedlist>
-      <sect3 id="sect_res_resultsdir_denovo">
-	<title>
-	  Additional 'large contigs' result files for de-novo assemblies of genomes
-	</title>
-	<para>
-	  For de-novo assemblies of genomes, MIRA makes a proposal regarding
-	  which contigs you probably want to have a look at ... and which ones
-	  you can probably forget about.
-	</para>
-	<para>
-	  This proposal relies on the <emphasis>largecontigs</emphasis> file
-	  in the info directory (see section below) and MIRA automatically
-	  extracted these contigs into all the formats you wanted to have your
-	  results in.
-	</para>
-	<itemizedlist>
-	  <listitem>
-	    <para>
-	      The result files for 'large contigs' are all named:
-	      <filename><replaceable>projectname</replaceable>_<emphasis>LargeContigs</emphasis>_out.<replaceable>resulttype</replaceable></filename>:
-	    </para>
-	  </listitem>
-	  <listitem>
-	    <para>
-	      <filename>extractLargeContigs.sh</filename>: this is a small
-	      shell script which just contains the call
-	      to <command>miraconvert</command> with which MIRA extracted the
-	      large contigs for you. In case you want to redefine what large
-	      contigs are for you, feel free to use this as template.
-	    </para>
-	  </listitem>
-	</itemizedlist>
-      </sect3>
     </sect2>
     <sect2 id="sect_res_infodir">
       <title>
@@ -236,43 +213,9 @@
 	<listitem>
 	  <para>
 	    <filename><replaceable>projectname</replaceable>_info_debrislist.txt</filename>:
-	    This file contains the names of all the reads which were not
+	    This file contains the names off all the reads which were not
 	    assembled into contigs (or singlets if appropriate MIRA parameters
-	    were chosen). The file has two columns: first column is the name
-	    of the read, second column is a code showing the reason and stage
-	    at which the read was put into the debris category.
-	  </para>
-	</listitem>
-	<listitem>
-	  <para>
-	    <filename><replaceable>projectname</replaceable>_info_largecontigs.txt</filename>:
-	    This file contains as simple list the names of all the contigs
-	    MIRA thinks to be more or less important at the end of the
-	    assembly. To be present in this list, a contig needed to reach a
-	    certain length (usually 500, but see <arg>-MI:lcs</arg>) and had a
-	    coverage of at least 1/3 of the average coverage (per sequencing
-	    technology) of the complete project.
-	  </para>
-	  <para>
-	    Note: only present for de-novo assemblies of genomes.
-	  </para>
-	  <warning>
-	    The default heuristics (500bp length and 1/3 coverage per
-	    sequencing technology) generally work well enough for most
-	    projects. However, Projects with extremely different coverage
-	    numbers per sequencing technology may need to use different
-	    numbers. E.g.: a project with 80x Illumina and 6x Sanger would
-	    have contigs consisting only of 2 or 3 Sanger sequence but with
-	    the average coverage >= 2 also in this list although clearly no
-	    one would look at these under normal circumstances.
-	  </warning>
-	</listitem>
-	<listitem>
-	  <para>
-	    <filename><replaceable>projectname</replaceable>_info_groups.txt</filename>:
-	    This file contains information about readgroups as determined by
-	    MIRA. Most interesting will probably be statistics concerning
-	    read-pair sizes.
+	    were chosen).
 	  </para>
 	</listitem>
 	<listitem>
@@ -314,7 +257,7 @@
   </sect1>
 
 
-  <sect1 id="sect_res_first_look:the_assembly_info">
+  <sect1 id="sect_first_look:_the_assembly_info">
     <title>
       First look: the assembly info
     </title>
@@ -341,7 +284,7 @@
 	  </para>
       </listitem>
     </orderedlist>
-
+    
     <para>
       The first part for large contigs contains several sections. The first of
       these shows what MIRA counts as large contig for this particular
@@ -393,7 +336,7 @@ With    Contig size             >= 500
       numbers give the respective lengths.
     </para>
     <para>
-      The next section shows information about the coverage assessment of
+      The next section shows information about the coverage assessement of
       large contigs. An example:
     </para>
     <screen>
@@ -421,20 +364,15 @@ With    Contig size             >= 500
       reads.
     </para>
     <note>
-      <para>
-	For genome assemblies, the value for <emphasis>Avg. total coverage
-	(size >= 5000)</emphasis> is currently always calculated for contigs
-	having 5000 or more consensus bases. While this gives a very effective
-	measure for genome assemblies, assemblies of EST or RNASeq will often
-	have totally irrelevant values here: even if the default of MIRA is to
-	use smaller contig sizes (1000) for EST / RNASeq assemblies, the
-	coverage values for lowly and highly expressed genes can easily span a
-	factor of 10000 or more.
-      </para>
+      The value for "Avg. total coverage (size >= 5000)" is currently always
+      calculated for contig having 5000 or mor consensus bases. While this
+      gives a very effective measure for genome assemblies, EST assemblies
+      will often have totally irrelevant values here as most genes in
+      eukaryotes (and prokaryotes) tend to be smaller than 5000 bases.
     </note>
     <para>
-      The last section contains some numbers useful for quality assessment. It
-      looks like this:
+      The last section contains some numbers useful for quality
+      assessment. It looks like this:
     </para>
     <screen>
   Quality assessment:
@@ -452,7 +390,7 @@ With    Contig size             >= 500
       consensus which might point at problems.
     </para>
     <para>
-      The above mentioned sections (length assessment, coverage assessment and
+      The above mentioned sections (length assessemnt, coverage assessment and
       quality assessment) for <emphasis>large</emphasis> contigs will then be
       re-iterated for <emphasis>all</emphasis> contigs, this time including
       also contigs which MIRA did not take into account as large contig.
@@ -462,191 +400,88 @@ With    Contig size             >= 500
     <title>
       Converting results
     </title>
-    <sect2 id="sect_res_converting_miraconvert">
+    <sect2 id="sect_res_converting_to_gap4">
       <title>
-	Converting to and from other formats:<command>miraconvert</command>
+	Converting to and from gap4
       </title>
       <para>
-	<command>miraconvert</command> is tool in the MIRA package which
-	reads and writes a number of formats, ranging from full assembly
-	formats like CAF and MAF to simple output view formats like HTML or
-	plain text.
+	The <command>gap4</command> program from the Staden package is a
+	pretty useful finishing tool and assembly viewer. It has an own
+	database format which MIRA does not read or write, but there are
+	interconversion possibilities using the CAF format and the
+	<command>caf2gap</command> and <command>gap2caf</command> utilities.
+      </para>
+      <para>
+	Conversion is pretty straightforward. From MIRA to gap4, it's like
+	this:
+      </para>
+      <screen>
+<prompt>$</prompt> caf2gap -project <replaceable>YOURGAP4PROJECTNAME</replaceable> -ace <replaceable>mira_result.caf</replaceable> >&/dev/null</screen>
+      <note>
+	Don't be fooled by the <literal>-ace</literal> parameter of
+	<command>caf2gap</command>. It needs a CAF file as input, not an ACE
+	file.
+      </note>
+      <para>
+	From gap4 to CAF, it's like this:
       </para>
-      <figure id="chap_res::results_miraconvert.png">
-	<title><command>miraconvert</command> supports a wide range of
-	format conversions to simplify export / import of results to and from
-	other programs</title>
-	<titleabbrev>
-	  Format conversions with <command>miraconvert</command>
-	</titleabbrev>
-	<mediaobject>
-	  <imageobject>
-	    <imagedata fileref="bookfigures/results_miraconvert.png" width="90%"/>
-	  </imageobject>
-	</mediaobject>
-      </figure>
-      </sect2>
-    <sect2 id="sect_res_converting_reach_other_programs">
+      <screen>
+<prompt>$</prompt> gap2caf -project <replaceable>YOURGAP4PROJECTNAME</replaceable> >tmp.caf
+<prompt>$</prompt> convert_project -f caf -t caf -r c tmp.caf <replaceable>somenewname</replaceable></screen>
+      <note>
+	Using <command>gap2caf</command>, be careful to use the simple
+	<literal>></literal> redirection to file and
+	<emphasis>not</emphasis> the <literal>>&</literal> redirection.
+      </note>
+      <note>
+	Using first <command>gap2caf</command> and then
+	<command>convert_project</command> is needed as gap4 writes an own
+	consensus to the CAF file which is not necessarily the best. Indeed,
+	gap4 does not know about different sequencing technologies like 454
+	and treats everything as Sanger. Therefore, using
+	<command>convert_project</command> with the <arg>-r c</arg> option
+	recalculates a MIRA consensus during the "conversion" from CAF to CAF.
+      </note>      
+    </sect2>
+    <sect2 id="sect_res_converting_to_gap5">
       <title>
-	Steps for converting data from / to other tools
+	Converting to and from gap5
       </title>
       <para>
-	The question "How Do I convert to / from other tools?" is complicated
-	by the plethora of file formats and tools available. This section
-	gives an overview on what is needed to reach the most important ones.
+	The <command>gap5</command> program is the successor for gap4. It
+	comes with on own import utility (<command>tg_index</command>) which
+	can read CAF files, and gap5 itself can export to CAF.
+      </para>
+      <para>
+	Conversion is pretty straightforward. From MIRA to gap5, it's like
+	this:
+      </para>
+      <screen>
+<prompt>$</prompt> tg_index -C <replaceable>YOURGAP4PROJECTNAME</replaceable>_out.caf</screen>
+      <para>
+	This creates a gap5 database named
+	<filename><replaceable>YOURGAP4PROJECTNAME</replaceable>_out.g5d</filename>
+	which can be directly loaded with gap5 like this:
+      </para>
+      <screen>
+<prompt>$</prompt> gap5 <replaceable>YOURGAP4PROJECTNAME</replaceable>_out.g5d</screen>
+    </sect2>
+    <sect2 id="sect_res_converting_convert_project">
+      <title>
+	Converting to and from other formats: convert_project
+      </title>
+      <para>
+	<command>convert_project</command> is tool in the MIRA package which
+	reads and writes a number of formats, ranging from full assembly
+	formats like CAF and MAF to simple output view formats like HTML or
+	plain text.
       </para>
-      <figure id="chap_res::results_mira2other.png">
-	<title>
-	  Conversion steps, formats and programs needed to reach some tools
-	  like assembly viewers, editors or scaffolders.
-	</title>
-	<titleabbrev>
-	  Conversions needed for other tools.
-	</titleabbrev>
-	<mediaobject>
-	  <imageobject>
-	    <imagedata fileref="bookfigures/results_mira2other.png" width="90%"/>
-	  </imageobject>
-	</mediaobject>
-      </figure>
       <para>
-	Please also read the chapter on MIRA utilities in this manual to learn
-	more on <command>miraconvert</command> and have a look at
-	<literal>miraconvert -h</literal> which lists all possible formats
+	Please read the chapter on MIRA utilities in this manual to learn more
+	on <command>convert_project</command> and also have a look at
+	<literal>convert_project -h</literal> which lists all possible formats
 	and other command line options.
       </para>
-      <sect3 id="sect_res_converting_to_from_staden">
-	<title>
-	  Example: converting to and from the Staden package (gap4 / gap5)
-	</title>
-	<para>
-	  The <command>gap4</command> program (and its
-	  successor <command>gap5</command> from the Staden package are pretty
-	  useful finishing tools and assembly viewers. They have an own
-	  database format which MIRA does not read or write, but there are
-	  interconversion possibilities using the CAF format (for gap4) and
-	  SAM format (for gap5)
-	</para>
-	<variablelist>
-	  <varlistentry>
-	    <term>
-	      <arg>gap4</arg>
-	    </term>
-	    <listitem>
-	      <para>
-		You need the <command>caf2gap</command>
-		and <command>gap2caf</command> utilities for this, which are
-		distributed separately from the Sanger Centre
-		<ulink url="http://www.sanger.ac.uk/Software/formats/CAF/"/>).
-		Conversion is pretty straightforward. From MIRA to gap4, it's
-		like this:
-	      </para>
-	      <screen>
-<prompt>$</prompt> caf2gap -project <replaceable>YOURGAP4PROJECTNAME</replaceable> -ace <replaceable>mira_result.caf</replaceable> >&/dev/null</screen>
-	      <note>
-		Don't be fooled by the <literal>-ace</literal> parameter of
-		<command>caf2gap</command>. It needs a CAF file as input, not
-		an ACE file.
-	      </note>
-	      <para>
-		From gap4 to CAF, it's like this:
-	      </para>
-	      <screen>
-<prompt>$</prompt> gap2caf -project <replaceable>YOURGAP4PROJECTNAME</replaceable> >tmp.caf
-<prompt>$</prompt> miraconvert -r c tmp.caf <replaceable>somenewname</replaceable>.caf</screen>
-	      <note>
-		Using <command>gap2caf</command>, be careful to use the simple
-		<literal>></literal> redirection to file and
-		<emphasis>not</emphasis> the <literal>>&</literal>
-		redirection.
-	      </note>
-	      <note>
-		Using first <command>gap2caf</command> and then
-		<command>miraconvert</command> is needed as gap4 writes an
-		own consensus to the CAF file which is not necessarily the
-		best. Indeed, gap4 does not know about different sequencing
-		technologies like 454 and treats everything as
-		Sanger. Therefore, using
-		<command>miraconvert</command> with the <arg>-r c</arg> option
-		recalculates a MIRA consensus during the "conversion" from CAF to CAF.
-	      </note>
-	      <note>
-		If you work with a 32 bit executable of caf2gap, it might very
-		well be that the converter needs more memory than can be
-		handled by 32 bit. Only solution: switch to a 64 bit
-		executable of caf2gap.
-	      </note>
-	      <warning>
-		<title>
-		  caf2gap bug for sequence annotations in reverse direction
-		</title>
-		<para>
-		  caf2gap has currently (as of version 2.0.2) a bug that turns
-		  around all features in reverse direction during the
-		  conversion from CAF to a gap4 project. There is a fix
-		  available, please contact me for further information (until
-		  I find time to describe it here).
-		</para>
-	      </warning>
-	    </listitem>
-	  </varlistentry>
-	  <varlistentry>
-	    <term>
-	      <arg>gap5</arg>
-	    </term>
-	    <listitem>
-	      <para>
-		The <command>gap5</command> program is the successor for
-		gap4. It comes with on own import utility
-		(<command>tg_index</command>) which can import SAM and CAF
-		files, and gap5 itself has an export function which also
-		writes SAM and CAF. It is suggested to use the SAM format to
-		export data gap5 as it is more efficient and conveys more
-		information on sequencing technologies used.
-	      </para>
-	      <para>
-		Conversion is pretty straightforward. From MIRA to gap5, it's like
-		this:
-	      </para>
-	      <screen>
-<prompt>$</prompt> tg_index <replaceable>INPUT</replaceable>_out.sam</screen>
-	      <para>
-		This creates a gap5 database named
-		<filename><replaceable>INPUT</replaceable>_out.g5d</filename>
-		which can be directly loaded with gap5 like this:
-	      </para>
-	      <screen>
-<prompt>$</prompt> gap5 <replaceable>INPUT</replaceable>_out.g5d</screen>
-	      <para>
-		Exporting back to SAM or CAF is done in gap5 via
-		the <emphasis>File->Export Sequences</emphasis> menu there.
-	      </para>
-	    </listitem>
-	  </varlistentry>
-	</variablelist>
-      </sect3>
-      <sect3 id="sect_res_converting_to_from_sam">
-	<title>
-	  Example: converting to and from SAM (for samtools, tablet etc.)
-	</title>
-	<para>
-	  Converting to SAM is done by
-	  using <command>miraconvert</command> on a MIRA MAF file, like this:
-	</para>
-	<screen>
-<prompt>$</prompt> miraconvert maf -t sam <replaceable>INPUT</replaceable>.maf <replaceable>OUTPUT</replaceable></screen>
-	<para>
-	  The above will create a file named <filename>OUTPUT.sam</filename>.
-	</para>
-	<para>
-	  Converting from SAM to a format which either <command>mira</command>
-	  or <command>miraconvert</command> can understand takes a few
-	  more steps. As neither tool currently reads SAM natively, you need
-	  to go via the <command>gap5</command> editor of the Staden package:
-	  convert the SAM via <command>tg_index</command> to a gap5 database,
-	  load that database in gap5 and export it there to CAF.
-	</para>
-      </sect3>
     </sect2>
   </sect1>
   <sect1 id="sect_res_filtering_of_results">
@@ -654,28 +489,35 @@ With    Contig size             >= 500
       Filtering results
     </title>
     <para>
-      It is important to remember that, depending on assembly options, MIRA
-      will also include very small contigs (with eventually very low coverage)
-      made out of reads which were rejected from the "good" contigs for
-      quality or other reasons. You probably do not want to have a look at
-      this contig debris when finishing a genome unless you are really,
-      really, really picky.
+      It is important to remember that some assembly options of mira improve
+      the overall assembly while increasing the number of <emphasis>contig
+      debris</emphasis>, i.e.  small contigs with low coverage that can
+      probably be discarded. One infamous option is the option to use
+      <emphasis>uniform read distribution</emphasis> (<arg>-AS:urd</arg>)
+      which helps to reconstruct identical repeats across multiple locations
+      in the genome but as a side effect, some redundant reads will end up as
+      typical contig debris. You probably do not want to have a look at contig
+      debris when finishing a genome unless you are really, really, really
+      picky.
+    </para>
+    <para>
+      By default, the result files of MIRA contain everything which might play
+      a role in automatic assembly post-processing pipelines as most
+      sequencing centers have implemented.
     </para>
     <para>
       Many people prefer to just go on with what would be large
-      contigs. Therefore, in de-novo assemblies, MIRA writes out separate
-      files of what it thinks are "good", large contigs. In case you want to
-      extract contigs differently, the <command>miraconvert</command> program
-      from the MIRA package can selectively filter CAF or MAF files for
-      contigs with a certain size, average coverage or number of reads.
+      contigs. Therefore the <command>convert_project</command> program from
+      the MIRA package can selectively filter CAF or MAF files for contigs
+      with a certain size, average coverage or number of reads.
     </para>
     <para>
       The file <filename>*_info_assembly.txt</filename> in the info directory
       at the end of an assembly might give you first hints on what could be
-      suitable filter parameters. As example, for "normal" assemblies
-      (whatever this means), one could want to consider only contigs larger
-      than 500 bases and which have at least one third of the average coverage
-      of the N50 contigs.
+      suitable filter parameters. For example, in assemblies being made with a
+      in a normal (whatever this means) fashion I routinely only consider
+      contigs larger than 500 bases and have at least one third of the average
+      coverage of the N50 contigs.
     </para>
     <para>
       Here's an example: In the "Large contigs" section, there's a "Coverage
@@ -702,7 +544,7 @@ Solid:  0.00
       This project was obviously a 454 only project, and the average coverage
       for it is ~22. This number was estimated by MIRA by taking only contigs
       of at least 5kb into account, which for sure left out everything which
-      could be categorised as debris. Normally it's a pretty solid number.
+      could be categorised as debris. It's a pretty solid number.
     </para>
     <para>
       Now, depending on how much time you want to invest performing some manual
@@ -735,20 +577,20 @@ Solid:  0.00
       1000 bases and with a minimum average coverage of 4 into FASTA format:
     </para>
     <screen>
-<prompt>$</prompt> <userinput>miraconvert -x 1000 -y 4 <replaceable>sourcefile.maf targetfile.fasta</replaceable></userinput></screen>
+<prompt>$</prompt> <userinput>convert_project -f caf -t fasta -x 1000 -y 4 <replaceable>sourcefile.caf targetfile.fasta</replaceable></userinput></screen>
     <para>
       Example (useful with assemblies of 454 data): extracting only contigs
       ≥ 500 bases into FASTA format:
     </para>
     <screen>
-<prompt>$</prompt> <userinput>miraconvert -x 500 <replaceable>sourcefile.maf targetfile.fasta</replaceable></userinput></screen>
+<prompt>$</prompt> <userinput>convert_project -f caf -t fasta -x 500 <replaceable>sourcefile.caf targetfile.fasta</replaceable></userinput></screen>
     <para>
       Example (e.g. useful with Sanger/454 hybrid assemblies): extracting only
       contigs ≥ 500 bases and with an average coverage ≥ 15 reads into
       CAF format, then converting the reduced CAF into a Staden GAP4 project:
     </para>
     <screen>
-<prompt>$</prompt> <userinput>miraconvert -x 500 -y 15 <replaceable>sourcefile.maf tmp.caf</replaceable></userinput>
+<prompt>$</prompt> <userinput>convert_project -f caf -t caf -x 500 -y 15 <replaceable>sourcefile.caf tmp.caf</replaceable></userinput>
 <prompt>$</prompt> <userinput>caf2gap -project <replaceable>somename</replaceable> -ace <replaceable>tmp.caf</replaceable></userinput></screen>
     <para>
       Example (e.g. useful with Sanger/454 hybrid assemblies): extracting only
@@ -756,12 +598,16 @@ Solid:  0.00
       then converting the reduced CAF into a Staden GAP4 project:
     </para>
     <screen>
-<prompt>$</prompt> <userinput>miraconvert -x 500 -z 10 <replaceable>sourcefile.maf tmp.caf</replaceable></userinput>
+<prompt>$</prompt> <userinput>convert_project -f maf -t caf -x 500 -z 10 <replaceable>sourcefile.maf tmp</replaceable></userinput>
 <prompt>$</prompt> <userinput>caf2gap -project <replaceable>somename</replaceable> -ace <replaceable>tmp.caf</replaceable></userinput></screen>
+    <para>
+      Start <command>convert_project</command> with the
+      <emphasis>-h</emphasis> option for help on available options.
+    </para>
   </sect1>
-  <sect1 id="sect_res_places_of_importance_in_a_de_novo_assembly">
+  <sect1 id="sect_res_finishing_and_data_analysis_finding_places_of_importance_in_the_assembly">
     <title>
-      Places of importance in a de-novo assembly
+      Finishing and data analysis: finding places of importance in the assembly
     </title>
     <sect2 id="sect_res_tags_set_by_mira">
       <title>
@@ -772,21 +618,12 @@ Solid:  0.00
         (in which case they mostly end with a <emphasis>r</emphasis>) or in the consensus.(then
         ending with a <emphasis>c</emphasis>).
       </para>
-      <note>
-	<para>
-	  If you use the
-	  Staden <command>gap4</command>, <command>gap5</command> or
-	  <command>consed</command> assembly editor to tidy up the assembly, you
-	  can directly jump to places of interest that MIRA marked for further
-	  analysis by using the search functionality of these programs.
-	</para>
-	<para>
-	  However, you need to tell these programs that these tags exist. For
-	  that you must change some configuration files. More information on
-	  how to do this can be found in the
-	  <filename>support/README</filename> file of the MIRA distribution.
-	</para>
-      </note>
+      <para>
+	If you use the Staden <command>gap4</command> or
+	<command>consed</command> assembly editor to tidy up the assembly, you
+	can directly jump to places of interest that MIRA marked for further
+	analysis by using the search functionality of these programs.
+      </para>
       <para>
 	You should search for the following "consensus" tags for finding places of importance
 	(in this order).
@@ -794,17 +631,17 @@ Solid:  0.00
       <itemizedlist>
 	<listitem>
 	  <para>
-	    IUPc
+	    IUPc 
 	  </para>
 	</listitem>
 	<listitem>
 	  <para>
-	    UNSc
+	    UNSc 
 	  </para>
 	</listitem>
 	<listitem>
 	  <para>
-	    SRMc
+	    SRMc 
 	  </para>
 	</listitem>
 	<listitem>
@@ -821,7 +658,7 @@ Solid:  0.00
 	  <para>
 	    MCVc (only when assembling different strains, i.e., mostly relevant for mapping assemblies)
 	  </para>
-	</listitem>
+	</listitem>	
 	<listitem>
 	  <para>
 	    SROc (only when assembling different strains, i.e., mostly relevant for mapping assemblies)
@@ -947,7 +784,7 @@ Solid:  0.00
 	    </listitem>
 	  </orderedlist>
 	  <para>
-	    The following screen shot shows a case where one should not join as
+	    The following screenshot shows a case where one should not join as
 	    the finishing program (in this case <command>gap4</command>) warns
 	    that no template (read-pair) span the join site:
 	  </para>
@@ -961,9 +798,9 @@ Solid:  0.00
 		<imagedata fileref="bookfigures/haf_danger_join_notok.png" width="90%"/>
 	      </imageobject>
 	    </mediaobject>
-	  </figure>
+	  </figure>  
 	  <para>
-	    The next screen shot shows a case where one should join as the
+	    The next screenshot shows a case where one should join as the
 	    finishing program (in this case <command>gap4</command>) finds
 	    templates spanning the join site and all of them are good:
 	  </para>
@@ -977,7 +814,7 @@ Solid:  0.00
 		<imagedata fileref="bookfigures/haf_danger_join_ok.png" width="90%"/>
 	      </imageobject>
 	    </mediaobject>
-	  </figure>
+	  </figure>  
 	</para>
       </sect3>
       <sect3 id="sect_res_joining_FALSErepeats">
@@ -1003,7 +840,7 @@ Solid:  0.00
 	    the end of an assembly, these shaved-off reads will form short,
 	    low coverage contig debris which can more or less be safely
 	    ignored and sorted out via the filtering options (<arg>-x -y
-	    -z</arg>) of <command>miraconvert</command>.
+	    -z</arg>) of <command>convert_project</command>.
 	  </para>
 	  <para>
 	    Some 454 library construction protocols -- especially, but not
@@ -1023,7 +860,7 @@ Solid:  0.00
 		<imagedata fileref="bookfigures/454_stacks_join.png" width="90%"/>
 	      </imageobject>
 	    </mediaobject>
-	  </figure>
+	  </figure>  
 	  <para>
 	    For Solexa data, a non-negligible GC bias has been reported in
 	    genome assemblies since late 2009. In genomes with moderate to
@@ -1059,400 +896,5 @@ Solid:  0.00
       </orderedlist>
     </sect2>
   </sect1>
-  <sect1 id="sect_res_places_of_interest_in_a_mapping_assembly">
-    <title>
-      Places of interest in a mapping assembly
-    </title>
-    <para>
-      This section just give a short overview on the tags you might find
-      interesting. For more information, especially on how to configure gap4
-      or consed, please consult the <emphasis>mira usage</emphasis> document
-      and the <emphasis>mira</emphasis> manual.
-    </para>
-    <para>
-      In file types that allow tags (CAF, MAF, ACE), SNPs and other
-      interesting features will be marked by MIRA with a number of tags. The
-      following sections give a brief overview. For a description of what
-      the tags are (SROc, WRMc etc.), please read up the section "Tags used
-      in the assembly by MIRA and EdIt" in the main manual.
-    </para>
-    <note>
-      Screen shots in this section are taken from the walk-through with
-      Lenski data (see below).
-    </note>
-    <sect2 id="sect_res_poi_where_are_snps?">
-      <title>
-	Where are SNPs?
-      </title>
-      <itemizedlist>
-	<listitem>
-	  <para>
-	    the <emphasis role="bold">SROc</emphasis> tag will point to most
-	    SNPs. Should you assemble sequences of more than one strain (I
-	    cannot really recommend such a strategy), you also might
-	    encounter <emphasis role="bold">SIOc</emphasis> and <emphasis
-	    role="bold">SAOc</emphasis> tags.
-	  </para>
-	  <figure id="chap_sol::sxa_sroc_lenski1.png">
-	    <title>
-	      "SROc" tag showing a SNP position in a Solexa mapping
-	      assembly.
-	    </title>
-	    <mediaobject>
-	      <imageobject>
-		<imagedata fileref="bookfigures/sxa_sroc_lenski1.png" width="90%"/>
-	      </imageobject>
-	    </mediaobject>
-	  </figure>
-	  <figure id="chap_sol::sxa_sroc_lenski2.png">
-	    <title>
-	      "SROc" tag showing a SNP/indel position in a Solexa mapping
-	      assembly.
-	    </title>
-	    <mediaobject>
-	      <imageobject>
-		<imagedata fileref="bookfigures/sxa_sroc_lenski2.png" width="90%"/>
-	      </imageobject>
-	    </mediaobject>
-	  </figure>
-	</listitem>
-	<listitem>
-	  <para>
-	    the <emphasis role="bold">WRMc</emphasis> tags might sometimes
-	    point SNPs to indels of one or two bases.
-	  </para>
-	</listitem>
-      </itemizedlist>
-      <para>
-      </para>
-    </sect2>
-    <sect2 id="sect_res_poi_where_are_insertions_deletions_or_genome_rearrangements?">
-      <title>
-	Where are insertions, deletions or genome re-arrangements?
-      </title>
-      <itemizedlist>
-	<listitem>
-	  <para>
-	    Large deletions: the <emphasis role="bold">MCVc</emphasis> tags
-	    point to deletions in the resequenced data, where no read is
-	    covering the reference genome.
-	  </para>
-	  <figure id="chap_sol::sxa_mcvc_lenski.png">
-	    <title>
-	      "MCVc" tag (dark red stretch in figure) showing a genome
-	      deletion in Solexa mapping assembly.
-	    </title>
-	    <mediaobject>
-	      <imageobject>
-		<imagedata fileref="bookfigures/sxa_mcvc_lenski.png" width="90%"/>
-	      </imageobject>
-	    </mediaobject>
-	  </figure>
-	</listitem>
-	<listitem>
-	  <para>
-	    Insertions, small deletions and re-arrangements: these are
-	    harder to spot. In unpaired data sets they can be found looking
-	    at clusters of <emphasis role="bold">SROc</emphasis>, <emphasis
-	    role="bold">SRMc</emphasis>, <emphasis
-	    role="bold">WRMc</emphasis>, and / or <emphasis
-	    role="bold">UNSc</emphasis> tags.
-	  </para>
-	  <figure id="chap_sol::sxa_wrmcsrmc_hiding_lenski1.png">
-	    <title>
-	      An IS150 insertion hiding behind a WRMc and a SRMc tags
-	    </title>
-	    <mediaobject>
-	      <imageobject>
-		<imagedata fileref="bookfigures/sxa_wrmcsrmc_hiding_lenski1.png" width="90%"/>
-	      </imageobject>
-	    </mediaobject>
-	  </figure>
-	  <para>
-	    more massive occurrences of these tags lead to a rather colourful
-	    display in finishing programs, which is why these clusters are
-	    also sometimes called Xmas-trees.
-	  </para>
-	  <figure id="chap_sol::sxa_xmastree_lenski1.png">
-	    <title>
-	      A 16 base pair deletion leading to a SROc/UNsC xmas-tree
-	    </title>
-	    <mediaobject>
-	      <imageobject>
-		<imagedata fileref="bookfigures/sxa_xmastree_lenski1.png" width="90%"/>
-	      </imageobject>
-	    </mediaobject>
-	  </figure>
-	  <figure id="chap_sol::sxa_xmastree_lenski2.png">
-	    <title>
-	      An IS186 insertion leading to a SROc/UNsC xmas-tree
-	    </title>
-	    <mediaobject>
-	      <imageobject>
-		<imagedata fileref="bookfigures/sxa_xmastree_lenski2.png" width="90%"/>
-	      </imageobject>
-	    </mediaobject>
-	  </figure>
-	  <para>
-	    In sets with paired-end data, post-processing software (or
-	    alignment viewers) can use the read-pair information to guide
-	    you to these sites (MIRA doesn't set tags at the moment).
-	  </para>
-	</listitem>
-      </itemizedlist>
-      <para>
-      </para>
-    </sect2>
-    <sect2 id="sect_res_poi_other_tags_of_interest">
-      <title>
-	Other tags of interest
-      </title>
-      <itemizedlist>
-	<listitem>
-	  <para>
-	    the <emphasis role="bold">UNSc</emphasis> tag points to areas
-	    where the consensus algorithm had troubles choosing a base. This
-	    happens in low coverage areas, at places of insertions (compared
-	    to the reference genome) or sometimes also in places where
-	    repeats with a few bases difference are present. Often enough,
-	    these tags are in areas with problematic sequences for the
-	    Solexa sequencing technology like, e.g., a
-	    <literal>GGCxG</literal> or even <literal>GGC</literal> motif in
-	    the reads.
-	  </para>
-	</listitem>
-	<listitem>
-	  <para>
-	    the <emphasis role="bold">SRMc</emphasis> tag points to places
-	    where repeats with a few bases difference are present. Here too,
-	    sequence problematic for the Solexa technology are likely to
-	    have cause base calling errors and subsequently setting of this
-	    tag.
-	  </para>
-	</listitem>
-      </itemizedlist>
-      <para>
-      </para>
-    </sect2>
-  </sect1>
-  <sect1 id="sect_res_postprocessing_mapping_assemblies">
-    <title>
-      Post-processing mapping assemblies
-    </title>
-    <para>
-      This section is a bit terse, you should also read the chapter on
-      <emphasis>working with results</emphasis> of MIRA.
-    </para>
-    <sect2 id="sect_res_pp_manual_cleanup">
-      <title>
-	Manual cleanup and validation (optional)
-      </title>
-      <para>
-	When working with resequencing data and a mapping assembly, I always
-	load finished projects into an assembly editor and perform a quick
-	cleanup of the results. SNP or small indels normally do not need
-	cleanups, but every mapper will get larger indels mostly wrong, and
-	MIRA is no exception to this.
-      </para>
-      <para>
-	For close relatives of the reference strain this doesn't take long as
-	MIRA will have set tags (see section earlier in this document) at all
-	sites you should have a look at. For example, very close mutant
-	bacteria with just SNPs or simple deletions and no genome
-	reorganisation, I usually clean up in 10 to 15 minutes. That gives the
-	last boost to data quality and your users (biologists etc.) will thank
-	you for that as it reduces their work in analysing the data (be it
-	looking at data or performing wet-lab experiments).
-      </para>
-      <para>
-        The general workflow I use is to convert the CAF file to a gap4 or gap5
-        database. Then, in gap4 or gap5, I
-      </para>
-      <orderedlist>
-	<listitem>
-	  <para>
-	    quickly search for the UNSc and WRMc tags and check whether they
-	    could be real SNPs that were overseen by MIRA. In that case, I
-	    manually set a SROc (or SIOc) tag in gap4 via hotkeys that were
-	    defined to set these tags.
-	  </para>
-	</listitem>
-	<listitem>
-	  <para>
-	    sometimes also quickly clean up reads that are causing trouble in
-	    alignments and lead to wrong base calling. These can be found at
-	    sites with UNSc tags, most of the time they have the 5' to 3'
-	    <literal>GGCxG</literal> motif which can cause trouble to Solexa.
-	  </para>
-	</listitem>
-	<listitem>
-	  <para>
-	    look at sites with deletions (tagged with MCVc) and look whether I
-	    should clean up the borders of the deletion.
-	  </para>
-	</listitem>
-      </orderedlist>
-      <para>
-	After this, I convert the gap4 or gap5 database back to CAF format.
-	But beware: gap4 does not have the same consensus calling routines as
-	MIRA and will have saved it's own consensus in the new CAF. In fact,
-	gap4 performs rather badly in projects with multiple sequencing
-	technologies. So I use miraconvert from the MIRA package to recall
-	a good consensus (and save it in MAF as it's more compact and a lot
-	faster in handling than CAF):
-      </para>
-      <para>
-	And from this MAF file I can then convert with miraconvert to any
-	other format I or my users need: CAF, FASTA, ACE, WIG (for coverage
-	analysis), SNP and coverage analysis (see below), HTML etc.pp.
-      </para>
-    </sect2>
-    <sect2 id="sect_res_poi_comprehensive_snp_analysis_spreadsheet_tables_for_excel_or_oocalc">
-      <title>
-	Comprehensive SNP analysis spreadsheet tables (for Excel or OOcalc)
-      </title>
-      <para>
-	Biologists are not really interested in SNPs coordinates, and why
-	should they? They're more interested where SNPs are, how good they
-	are, which genes or other elements they hit, whether they have an
-	effect on a protein sequence, whether they may be important etc. For
-	organisms without intron/exon structure or splice variants, MIRA can
-	generate pretty comprehensive tables and files if an annotated
-	GenBank file was used as reference and strain information was given
-	to MIRA during the assembly.
-      </para>
-      <para>
-	Well, MIRA does all that automatically for you if the reference
-	sequence you gave was annotated.
-      </para>
-      <para>
-	For this, <command>miraconvert</command> should be used with the
-	<emphasis>asnp</emphasis> format as target and a MAF (or CAF) file as
-	input:
-      </para>
-      <screen><prompt>$</prompt> <userinput>miraconvert -t asnp <replaceable>input.maf output</replaceable></userinput></screen>
-      <para>
-	Note that it is strongly suggested to perform a quick manual cleanup
-	of the assembly prior to this: for rare cases (mainly at site of
-	small indels of one or two bases), MIRA will not tag SNPs with a SNP
-	tag (SROc, SAOc or SIOc) but will be fooled into a tag denoting
-	unsure positions (UNSc). This can be quickly corrected manually. See
-	further down in this manual in the section on post-processing.
-      </para>
-      <para>
-	After conversion, you will have four files in the directory which
-	you can all drag-and-drop into spreadsheet applications like
-	OpenOffice Calc or Excel.
-      </para>
-      <para>
-	The files should be pretty self-explanatory, here's just a short overview:
-      </para>
-      <orderedlist>
-	<listitem>
-	  <para>
-	    <filename>output_info_snplist.txt</filename> is a simple list of
-	    the SNPs, with their positions compared to the reference
-	    sequence (in bases and map degrees on the genome) as well as the
-	    GenBank features they hit.
-	  </para>
-	</listitem>
-	<listitem>
-	  <para>
-	    <filename>output_info_featureanalysis.txt</filename> is a much
-	    extended version of the list above. It puts the SNPs into
-	    context of the features (proteins, genes, RNAs etc.) and gives a
-	    nice list, SNP by SNP, what might cause bigger changes in
-	    proteins.
-	  </para>
-	</listitem>
-	<listitem>
-	  <para>
-	    <filename>output_info_featuresummary.txt</filename> looks at the
-	    changes (SNPs, indels) from the other way round. It gives an
-	    excellent overview which features (genes, proteins, RNAs,
-	    intergenic regions) you should investigate.
-	  </para>
-	  <para>
-	    There's one column (named 'interesting') which pretty much
-	    summarises up everything you need into three categories: yes,
-	    no, and perhaps. 'Yes' is set if indels were detected, an amino
-	    acid changed, start or stop codon changed or for SNPs in
-	    intergenic regions and RNAs. 'Perhaps' is set for SNPs in
-	    proteins that change a codon, but not an amino acid (silent
-	    SNPs). 'No' is set if no SNP is hitting a feature.
-	  </para>
-	</listitem>
-	<listitem>
-	  <para>
-	    <filename>output_info_featuresequences.txt</filename> simply
-	    gives the sequences of each feature of the reference sequence
-	    and the resequenced strain.
-	  </para>
-	</listitem>
-      </orderedlist>
-    </sect2>
-    <sect2 id="sect_res_poi_html_files_depicting_snp_positions_and_deletions">
-      <title>
-	HTML files depicting SNP positions and deletions
-      </title>
-      <para>
-	I've come to realise that people who don't handle data from NextGen
-	sequencing technologies on a regular basis (e.g., many biologists)
-	don't want to be bothered with learning to handle specialised
-	programs to have a look at their resequenced strains. Be it because
-	they don't have time to learn how to use a new program or because
-	their desktop is not strong enough (CPU, memory) to handle the data
-	sets.
-      </para>
-      <para>
-	Something even biologist know to operate are browsers. Therefore,
-	miraconvert has the option to load a MAF (or CAF) file of a
-	mapping assembly at output to HTML those areas which are interesting
-	to biologists. It uses the tags SROc, SAOc, SIOc and MCVc and outputs
-	the surrounding alignment of these areas together with a nice overview
-	and links to jump from one position to the previous or next.
-      </para>
-      <para>
-	This is done with the '<literal>-t hsnp</literal>' option of
-	miraconvert:
-      </para>
-      <screen><prompt>$</prompt> <userinput>miraconvert -t hsnp <replaceable>input.maf output</replaceable></userinput></screen>
-      <note>
-	I recommend doing this only if the resequenced strain is a very close
-	relative to the reference genome, else the HTML gets pretty big. But
-	for a couple of hundred SNPs it works great.
-      </note>
-    </sect2>
-    <sect2 id="sect_res_poi_wig_files">
-      <title>
-	WIG files depicting contig coverage or GC content
-      </title>
-      <para>
-	<command>miraconvert</command> can also dump a coverage file in WIG
-	format (using '<literal>-t wig</literal>') or a WIG file for GC
-	content (using '<literal>-t gcwig</literal>'). This comes pretty handy
-	for searching genome deletions or duplications in programs like the
-	Affymetrix Integrated Genome Browser (IGB, see <ulink
-	url="http://igb.bioviz.org/"/>) or when looking for foreign sequence
-	in a genome.
-      </para>
-    </sect2>
-    <sect2 id="sect_res_poi_tables_for_feature_coverage">
-      <title>
-	Comprehensive spreadsheet tables for gene expression values / genome deletions & duplications
-      </title>
-      <para>
-	When having data mapped against a reference with annotations (either
-	from GenBank formats or GFF3 formats),
-	<command>miraconvert</command> can generate tables depicting
-	either expression values (in RNASeq/EST data mappings) or probable
-	genome multiplication and deletion factors (in genome mappings). For
-	this to work, you must use a MAF or CAF file as input, specify
-	<emphasis>fcov</emphasis> as output format and the reference sequence
-	must have had annotations during the mapping with MIRA.
-      </para>
-      <para>TODO: add example</para>
-      <screen><userinput>miraconvert -t fcov <replaceable>mira_out.maf myfeaturetable</replaceable></userinput></screen>
-    </sect2>
-  </sect1>
 </chapter>
+
diff --git a/doc/docbook/attic/chap_sanger_part.xml b/doc/docbook/chap_sanger_part.xml
similarity index 91%
rename from doc/docbook/attic/chap_sanger_part.xml
rename to doc/docbook/chap_sanger_part.xml
index 5c3028d..bd44e35 100644
--- a/doc/docbook/attic/chap_sanger_part.xml
+++ b/doc/docbook/chap_sanger_part.xml
@@ -3,12 +3,15 @@
 <chapter id="chap_sanger">
   <chapterinfo>
     <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="versionfile"/>
+    <releaseinfo>
+      <emphasis role="light">Document revision	$Id$</emphasis>
+    </releaseinfo>
     <author>
       <firstname>Bastien</firstname>
       <surname>Chevreux</surname>
       <email>bach at chevreux.org</email>
     </author>
-    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="copyrightfile"/>
+    <copyright><year>2011</year><holder>Bastien Chevreux</holder></copyright>
   </chapterinfo>
   <blockquote>
     <attribution>Solomon Short</attribution>
@@ -19,7 +22,6 @@
   </blockquote>
 
   <title>Short usage introduction to MIRA3</title>
-  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="warning_frontofchapter.xml"/>
   <para>
     This guide assumes that you have basic working knowledge of Unix systems,
     know the basic principles of sequencing (and sequence assembly) and what
@@ -32,8 +34,8 @@
       Important notes
     </title>
     <para>
-      For working parameter settings for assemblies involving 454, IonTorrent,
-      Solexa or PacBio data, please also read the MIRA help files dedicated to these
+      For working parameter settings for assemblies involving 454 and / or
+      Solexa data, please also read the MIRA help files dedicated to these
       platforms.
     </para>
   </sect1>
@@ -65,10 +67,10 @@
       <para>
 	<emphasis>"Do I have enough memory?"</emphasis> has been one of the
 	most often asked question in former times. To answer this question,
-	please use <command>miramem</command> which will give you an
-	estimate. Basically, you just need to start the program and answer the
-	questions, for more information please refer to the corresponding
-	section in the main MIRA documentation.
+	please use miramem which will give you an estimate. Basically, you
+	just need to start the program and answer the questions, for more
+	information please refer to the corresponding section in the main MIRA
+	documentation.
       </para>
       <para>
 	Take this estimate with a grain of salt, depending on the sequences
@@ -154,7 +156,7 @@
 	  for vector sequence, you can do this yourself in a pretty robust
 	  manner using SSAHA2 -- or the successor, SMALT -- from the Sanger
 	  Centre. You just need to know which sequencing vector the provider
-	  used and have its sequence in FASTA format (ask your provider).
+	  used and have its sequence in FASTA format (ask your provider). 
 	</para>
 	<para>
 	  Note that this screening is a valid method for any type of Sanger
@@ -170,9 +172,9 @@
 <prompt>$</prompt> <userinput>cd bchoc_assembly1</userinput>
 <prompt>bchoc_assembly1$</prompt> <userinput>cp /your/path/sequences.fasta bchoc_in.sanger.fasta</userinput>
 <prompt>bchoc_assembly1$</prompt> <userinput>cp /your/path/qualities.someextension bchoc_in.sanger.fasta.qual</userinput>
-<prompt>bchoc_assembly1$</prompt> <userinput>ssaha2 -output ssaha2
-  -kmer 8 -skip 1 -seeds 1 -score 12 -cmatch 9 -ckmer 6
-  /path/where/the/vector/data/resides/vector.fasta
+<prompt>bchoc_assembly1$</prompt> <userinput>ssaha2 -output ssaha2 
+  -kmer 8 -skip 1 -seeds 1 -score 12 -cmatch 9 -ckmer 6 
+  /path/where/the/vector/data/resides/vector.fasta 
   bchoc_in.sanger.fasta > bchoc_ssaha2vectorscreen_in.txt</userinput>
 <prompt>bchoc_assembly1$</prompt> <userinput>mira -project=bchoc -job=denovo,genome,accurate,sanger -fasta SANGER_SETTINGS -CL:msvs=yes</userinput></screen>
 	<para>
@@ -589,4 +591,52 @@
       </para>
     </sect2>
   </sect1>
+  <sect1 id="sect_sanger_troubleshooting">
+    <title>
+      Troubleshooting
+    </title>
+    <para>
+      (To be expanded)
+    </para>
+    <sect2 id="sect_sanger_caf2gap_cannot_convert_the_result_of_a_large_assembly?">
+      <title>
+	caf2gap cannot convert the result of a large assembly?
+      </title>
+      <para>
+	This can have two causes: 
+      </para>
+      <orderedlist>
+	<listitem>
+	  <para>
+	    if you work with a 32 bit executable of caf2gap, it might very
+	    well be that the converter needs more memory than can be handled by 32
+	    bit. Only solution: switch to a 64 bit executable of caf2gap.
+	  </para>
+	</listitem>
+	<listitem>
+	  <para>
+	    you compiled caf2gap with a caftools version prior to 2.0.1 and
+	    then caf2gap throws <literal>segmentation errors</literal>. Simply grab the
+	    newest version of the caftools (at least 2.0.2) at
+	    ftp://ftp.sanger.ac.uk/pub/PRODUCTION_SOFTWARE/src/ and compile the whole
+	    package. caf2gap will be contained therein.
+	  </para>
+	</listitem>
+      </orderedlist>
+      <para>
+      </para>
+    </sect2>
+    <sect2 id="sect_sanger_reverse_genbank_features_are_in_forward_direction_in_a_gap4_project">
+      <title>
+	Reverse GenBank features are in forward direction in a gap4 project
+      </title>
+      <para>
+	caf2gap has currently (as of version 2.0.2) a bug that turns around all
+	features in reverse direction during the conversion from CAF to a gap4
+	project. There is a fix available, please contact me for further information
+	(until I find time to describe it here).
+      </para>
+    </sect2>
+  </sect1>
 </chapter>
+
diff --git a/doc/docbook/chap_seqadvice_part.xml b/doc/docbook/chap_seqadvice_part.xml
index 2491e23..a0d114d 100644
--- a/doc/docbook/chap_seqadvice_part.xml
+++ b/doc/docbook/chap_seqadvice_part.xml
@@ -3,12 +3,15 @@
 <chapter id="chap_seqadvice">
   <chapterinfo>
     <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="versionfile"/>
+    <releaseinfo>
+      <emphasis role="light">Document revision	$Id$</emphasis>
+    </releaseinfo>
     <author>
       <firstname>Bastien</firstname>
       <surname>Chevreux</surname>
       <email>bach at chevreux.org</email>
     </author>
-    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="copyrightfile"/>
+    <copyright><year>2011</year><holder>Bastien Chevreux</holder></copyright>
   </chapterinfo>
   <blockquote>
     <attribution>Solomon Short</attribution>
@@ -26,7 +29,7 @@
       Talk to your sequencing provider(s) before sequencing
     </title>
     <para>
-      Well, duh! But it's interesting what kind of mails I sometimes get. Like in:
+      Well, duh! But it's interesting what kind of mails I sometimes get. Like in: 
     </para>
     <blockquote><quote>We've sequenced a one gigabase, diploid eukaryote with
     Solexa 36bp paired-end with 200bp insert size at 25x coverage. Could you
@@ -46,7 +49,7 @@
     </para>
     <para>
       If you think they try to rip you off or are overselling their
-      competences (which most providers I know won't even think of trying,
+      competencies (which most providers I know won't even think of trying,
       but there are some), ask a quote from a couple of other
       providers. You'll see pretty quickly if there are some things not being
       right.
@@ -59,596 +62,63 @@
       reason.
     </note>
   </sect1>
-  <sect1 id="sect_seqadv_whichseqprovider">
+  <sect1 id="sect_seqadv_a_word_or_two_on_coverage">
     <title>
-      Choosing a sequencing provider
+      A word or two on coverage ...
     </title>
-    <note>
-      This is a slightly reworked version of a post I made on the MIRA talk
-      mailing list.  The question <emphasis>"Could you please recommend me a
-      sequencing provider?"</emphasis> arrives every now and then in my
-      private inbox, often enough for me decide to make a collage of the
-      responses I gave in the past and post it to MIRA talk.
-    </note>
     <para>
-      This response got, errrr, a little longer, but allow me to note that I
-      will not give you names. The reasons are manyfold:
+      For de-novo assembly of genomes, the MIRA quick switches (--job=...)
+      are optimised for 'decent' coverages that are commonly seen to get you
+      something useful, i.e., ≥ 7x for Sanger, >=18x for 454 FLX, ≥
+      25x for 454 GS20. Should you venture into lower coverages, you will
+      need to adapt a few parameters (clipping etc.) via extensive switches.
     </para>
-    <itemizedlist>
-      <listitem>
-	once upon a time I worked for a sequencing company
-      </listitem>
-      <listitem>
-	the company I am currently employed with is not in the sequencing
-	provider business, but the company uses more than one sequencing
-	provider on a regular base and I get to see quite some data
-      </listitem>
-      <listitem>
-	due to my development on MIRA in my free time, I'm getting insight
-	into a number of highs and lows of sequencing technologies at
-	different sequencing providers which I would not get if I were to
-	expose them publicly ... I do not want to jeopardise these
-	relationships.
-      </listitem>
-    </itemizedlist>
     <para>
-      That being said, there are a number of general considerations which
-      could help you. Excuse me in case the detours I am going to make are
-      obvious to you, but I'm writing this also for future references. Also,
-      please bear with me if I look at "sequencing" a bit differently than you
-      might be accustomed to from academia, but I have worked for quite some
-      time now in industry ... and there cost-effectiveness respectively
-      "probability of success" of a project as whole is paramount to
-      everything else. I'll come back to that further down.
+      There's one thing to be said about coverage and de-novo assembly:
+      especially for bacteria, getting more than 'decent' coverage with 454
+      FLX or Titanium is
+      <emphasis>cheap</emphasis>. Every assembler I know will be happy to
+      assemble de-novo genomes with coverages of 25x, 30x, 40x ... and the
+      number of contigs will still drop dramatically between a 15x 454 and a
+      30x 454 project.
     </para>
     <para>
-      There's one -- and only one -- question which you, as sequencing
-      customer, need to be able to answer ... if necessary in every
-      excruciating detail, but you must know the answer. The question is:
+      With the introduction of the Titanium series, a full 454 plate may
+      seem to be too much: you should
+      get <emphasis>at</emphasis> <emphasis>least</emphasis> 200 megabase
+      out of a plate, press releases from 454 seem to suggest 400 to 600
+      megabases.
     </para>
-    <sect2 id="sect_seqadv_whichseqprovider_want">
-      <title>
-	WHAT DO YOU WANT?!
-      </title>
-      <sidebar>
-	<title>
-	  Detour - Sequencing -
-	</title>
-	<para>
-	  For me, every "sequencing project", be it genomic or transcriptomic,
-	  really consists of four major phases:
-	</para>
-	<orderedlist>
-	  <listitem>
-	    <para>
-	      <emphasis role="bold">data generation:</emphasis> This can be
-	      broadly seen as everything to get the DNA/RNA ready to be sent
-	      off to sequencing (usually something the client does), the
-	      library prep at the sequencing provider and finally the
-	      sequencing itself (including base calling). An area of thousand
-	      pitfalls where each step (and the communication) is crucial and
-	      even one slight inadvertence can make the difference between a
-	      "simple" project and a "hard" project. E.g.: taking DNA from
-	      growing cells (especially bacteria in exponential growing phase)
-	      might not be a good idea ... it makes assembly more
-	      difficult. Some DNA extraction methods generate more junk than
-	      good fragments etc.pp
-	    </para>
-	    <para>
-	      The reason I am emphasizing this is simple: nowadays, the
-	      "sequencing" itself is not the most expensive part of a
-	      sequencing project, the next two steps are (most of the time
-	      anyway).
-	    </para>
-	  </listitem>
-	  <listitem>
-	    <para>
-	      <emphasis role="bold">assembly & finishing:</emphasis> Still
-	      a hard problem. Even a "simple" bacterium can present weeks of
-	      effort to get right if its riddled with phages, prophages,
-	      transposon elements, genetically engineered repeats etc.pp. And
-	      starting with eukaryotes the real fun starts: ploidy,
-	      retrotransposons etc. make for an unbelievable genome plasticity
-	      and almost always have their own surprises. I've seen "simple"
-	      Saccharomyces cerevisiae - where biologist swore to high heaven
-	      they were "close to the publicly sequenced strains" - being
-	      *very* different from what they were expected to be, both on the
-	      DNA level and the genome organisation level.
-	    </para>
-	    <para>
-	      Getting eukaryotes right "down to the last base" might cost
-	      quite some money, especially when looping back to step 1 (data
-	      generation) to tackle difficult areas.
-	    </para>
-	  </listitem>
-	  <listitem>
-	    <para>
-	      <emphasis role="bold">annotation:</emphasis> Something many
-	      people forget: give the sequence a meaning. Here too, things can
-	      get quite costly if done "right", i.e., with hand
-	      curation. Especially on organism which are not part of the more
-	      commonly sequenced species or are generally more complex.
-	    </para>
-	    <para>
-	      Annotation of a de-novo transcriptome assembly is also not for
-	      the faint of heart, especially if done on short, unpaired read
-	      assemblies.
-	    </para>
-	  </listitem>
-	  <listitem>
-	    <emphasis role="bold">using the sequencing data:</emphasis>
-	    ... for whatever it was generated for.
-	  </listitem>
-	</orderedlist>
-      </sidebar>
-      <para>
-	The above makes it clear that, depending on what you are really
-	interested in within your project and what you expect to be able to do
-	with the sequencing data, one can cut corners and reduce cost here and
-	there (but not everywhere). And therefore, the above question "What do
-	you want?" is one which - after the initial chit-chat of "hi, hello,
-	nice to meet you, a pleasure to be here, etc." - every good
-	representative of respectable sequencing providers I have met so far
-	will ask as very first question. Usually in the form of "what do you
-	want to sequence and what will you want to use the data for (and what
-	not)?"
-      </para>
-    </sect2>
-    <sect2 id="sect_seqadv_whichseqprovider_need">
-      <title>
-	WHAT DO YOU NEED?!
-      </title>
-      <para>
-	... difference between "want" and "need" ...
-      </para>
-      <para>
-	Every other question - like where to sequence, which sequencing
-	technology to use, how to process the sequencing data afterwards - is
-	incidental and subordinated to your answer(s) to the question of "what
-	do you want?!" But often sequencing customers get their priorities
-	wrong by putting forward another question:
-      </para>
-    </sect2>
-    <sect2 id="sect_seqadv_whichseqprovider_cost">
-      <title>
-	WHAT WILL IT COST ME?
-      </title>
-      <para>
-	And its inevitable companion question "Can you make it cheaper?"
-      </para>
-      <sidebar>
-	<title>
-	  Detour - Putting things into perspective -
-	</title>
-	<para>
-	  Come to think of it, people sometimes have very interesting ideas
-	  regarding costs. Interesting as in "outright silly." It may be
-	  because they do not really know what they want or feel unsure on a
-	  terrain unbeknownst to them, and often instead focus their energy on
-	  single aspects of a wider project because they feel more at home
-	  there. And suddenly the focus lies on haggling and bartering for
-	  some prices because, after all, this is something everyone knows how
-	  to do, right?
-	</para>
-	<para>
-	  As I hinted earlier, the pure sequencing costs are nowadays probably
-	  not the biggest factor in any sequencing project: 454, Illumina,
-	  IonTorrent and other technology providers have seen to that. E.g.,
-	  in 20043/2004 it still cost somewhere between 150 - 200 k€ to get an
-	  8x Sanger coverage of a moderately sized bacterium (4 to 5
-	  mb). Nowadays, for the same organism, you get coverages in the
-	  dozens (going with 454) for a few thousand Euro ... or coverages in
-	  the hundreds or even thousands (going with Illumina) for a few
-	  hundred Euro.
-	</para>
-	<para>
-	  Cost for assembly, finishing and annotation have not followed the
-	  same decrease. Yes, advances in algorithms have made things easier
-	  in some parts, but not really on the same scale. Furthermore, the
-	  "short read" technologies have more than made up for algorithmical
-	  complexity when compared to the old Sanger reads. Maybe that
-	  "(ultra)long read" technologies will alleviate the problem, but I
-	  would not hold my breath for them to really work well.
-	</para>
-	<para>
-	  One thing however has almost not changed at all: your costs of
-	  actually doing followup experiments and data interpretation!
-	  Remember that sequencing in itself is most of the time not the
-	  ultimate goal, you actually want to gain something out of it. Be it
-	  abstract knowledge for a paper or concrete hints for producing some
-	  compounds or whatever, chances are that you will actually devote a
-	  substantial amount of your resources (time, manpower, mental health)
-	  into followup activities (lab experiments, genetic engineering,
-	  writing papers) to turn the abstract act of sequencing into
-	  something tangible, be it papers, fame, new products, money, or
-	  whatever you want to achieve.
-	</para>
-	<para>
-	  And this is the place where it pays to stop and think: "what do I
-	  want? what are my strengths and where are my weaknesses? where are
-	  my priorities?" The English have a nice saying: "Being penny-wise
-	  and pound-foolish is not wise." I may add: Especially not if you are
-	  basing man months / years of lab work and your career on the outcome
-	  of something like sequencing. Maybe I'm spoiled because I have left
-	  academia for quite some time now, but in sequencing I always prefer
-	  to throw a bit more money at the sequencing process itself to
-	  minimise risks of the later stages.
-	</para>
-      </sidebar>
-    </sect2>
-    <sect2 id="sect_seqadv_whichseqprovider_where">
-      <title>
-	WHERE TO SEQUENCE?
-      </title>
-      <para>
-	There's one last detour I'd like to make, and that is the question of "where to sequence?"
-      </para>
-      <sidebar>
-	<title>
-	  Detour - Public or private, old-timers or young-timers ? -
-	</title>
-	<para>
-	  Choosing a sequencing provider is highly dependent on your answer to
-	  "what do you want?" In case you want to keep the sequencing data (or
-	  the very act of sequencing) secret (even only for some time) will
-	  probably lead you to commercial sequencing companies. There you more
-	  or less have complete control on the data. Paranoid people might
-	  perhaps argue that you can have that only with own sequencing
-	  equipment and personnel, but I have the feeling that only a minority
-	  is able to cough-up the necessary money for purchasing sequencing
-	  equipment for a small one-time project.
-	</para>
-	<para>
-	  Instead of companies you could however also look whether one of the
-	  existing sequencing centers in the world might be a good cooperation
-	  candidate. Especially if you are doing this project within the scope
-	  of your university. Note however that there might be a number of
-	  gotchas lurking there, beside the obvious "the data is not really
-	  secret anymore": sometimes the raw sequencing data needs to be
-	  publicly released, maybe earlier than you would like; or the
-	  sequencing center imposes that each and every paper you publish with
-	  that data as basis has them as (co-)first author.
-	</para>
-	<para>
-	  A related problem is "whom do I trust to deliver good work?"
-	  Intuition says that institutes with a long sequencing history have
-	  amassed quite some knowledge in this field, making them experts in
-	  all three aspects (data generation, assembly & finishing,
-	  annotation) of a sequencing project ... and intuition probably isn't
-	  wrong there. The same thing is probably true for sequencing
-	  companies which have existed for more than just a couple of years,
-	  though from what I have seen so far is that - due to size -
-	  sequencing companies sometimes really focus on the data generation
-	  and rely on partner companies for "assembly" and "annotation". This
-	  is not to say that younger companies are bad. Incidentally, it is my
-	  belief that in this field, people are still more important than
-	  technology ... and every once in a while good people split off a
-	  well known institute (or company) to try their luck in an own
-	  company. Always look for references there.
-	</para>
-	<para>
-	  The following statement is a personal opinion (and you can call me
-	  biased for that): Personally, I am however quite wary of sequencing
-	  done at locations where a sequencer exists because someone got a
-	  grant to buy one (because it was chic & en-vogue to get a shiny
-	  new toy) but where the instrument then slowly starts to collect dust
-	  after the initial flurry ... and because people often do not
-	  calculate chemistry costs which arise in case they'd really thought
-	  of using the machine 24/7. I want to know that technicians actually
-	  work with those things every day, that they know the ins and outs of
-	  the work, the protocols, the chemistry, the moods of the machine
-	  (even an instrument can have a bad day). I honestly do not believe
-	  that one can build up enough expertise when operating these things
-	  "every once in a while".
-	</para>
-      </sidebar>
-    </sect2>
-    <sect2 id="sect_seqadv_whichseqprovider_summary">
-      <title>
-	Summary of all the above
-      </title>
-      <para>
-	All of the above means that depending on what I need the data for, I
-	have the freedom choose among different providers. In case I just need
-	masses of raw data and potential savings are substantial, I might go
-	with the cheapest whom I know to generate good data. If I want good
-	service and second round of data in case I am not 110% satisfied with
-	the first round (somehow people have stopped questioning me there),
-	this is usually not the cheapest provider ... but the additional costs
-	are not really high. If I wanted my data really really quick, I'd
-	search for a provider with Ion Torrent, or MiSeq (I am actually
-	looking for one with a MiSeq, so if anyone knows a good one,
-	preferably in Europe -> mail me). Though I already did transcriptomics
-	on eukaryotes, in case I needed larger eukaryotes assembled de-novo
-	& also annotated, I would probably look for the help of a larger
-	sequencing center as this starts to get dangerously near the fringe of
-	my field of expertise.
-      </para>
-      <para>
-	In closing this part, here are a couple of guidelines which have not
-	failed me so far for choosing sequencing providers:
-      </para>
-      <itemizedlist>
-	<listitem>
-	  Building a good relationship helps. In case your institute /
-	  university already has good (or OK) experience with a provider, ask
-	  there first.
-	</listitem>
-	<listitem>
-	  It is a lot easier to build a good relationship with someone who
-	  speaks your language ... or a good(!) English.
-	</listitem>
-	<listitem>
-	  I will not haggle for a couple of hundred Euros in a single project,
-	  I'll certainly reconsider this when savings are in the tens of
-	  thousands.
-	</listitem>
-	<listitem>
-	  Managing expectations: some sequencing projects are high risk from
-	  the start, for lots of possible reasons (underfunded, bad starting
-	  material, unclear organism). This is *sometimes* (!) OK as long as
-	  everyone involved knows and acknowledges this. However, you should
-	  always have a clear target ("what am I looking for?") and preferably
-	  know in advance how to treat the data to get there.
-	</listitem>
-	<listitem>
-	  Errors occur, stay friendly at first. In case the expectations were
-	  clear (see above), the material and organism are not at fault but
-	  the data quality somehow is bad, it is not too difficult to have the
-	  sequencing provider acknowledge this and get additional sequencing
-	  for no added cost.
-	</listitem>
-      </itemizedlist>
-      <para>
-	Regarding the technologies you can use ... it really depends on what
-	you want to do :-) And note that I base my answers on technologies
-	available today without bigger problems: PacBio, Illumina, with
-	IonTorrent as Joker for quick projects. 454 can still be considered,
-	but probably not for too long anymore as Roche stopped development of
-	the technology and thus PacBio takes over the part for long
-	reads. Oxford Nanopore might become a game changer, but they are not
-	just yet
-      </para>
-    </sect2>
-  </sect1>
-  <sect1 id="sect_seqadv_specific">
-    <title>
-      Specific advice
-    </title>
     <para>
-      Here's how I see things as of now (January 2014), which might not
-      necessarily be how others see them.
+      In any case, do some calculations: if the coverage you expect to get
+      reaches 50x (e.g. 200MB raw sequence for a 4MB genome), then you
+      (respectively the assembler) can still throw away the worst 20% of the
+      sequence (with lots of sequencing errors) and concentrate on the
+      really, really good parts of the sequences to get you nice contigs.
     </para>
-    <sect2 id="sect_seqadv_technologies">
-      <title>
-	Technologies
-      </title>
-      <sect3 id="sect_seqadv_technologies_sanger">
-	<title>
-	  Sanger
-	</title>
-	<para>
-	  Use for: checking assemblies; closing gaps by PCR; checking for a couple of genes with
-	  known sequence (i.e., where you can design oligos for).
-	</para>
-	<para>
-	  Do not use for: anything else. In particular, if you find yourself
-	  designing oligos for a 96 well plate destined for Sanger sequencing
-	  of a single bacterial DNA sample, you (probably) are doing something
-	  wrong.
-	</para>
-      </sect3>
-      <sect3 id="sect_seqadv_technologies_pacbio">
-	<title>
-	  Pacific Biosciences
-	</title>
-	<para>
-	  Use for: de-novo of bacteria and lower eukaryotes (or higher
-	  eukaryotes if you have the money). PacBio should be seen as
-	  <emphasis>the</emphasis> technology to use when getting the best
-	  assemblies with least number of contigs is important to you. Also,
-	  resequencing of variants of known organisms with lots of genomic
-	  reorganisation flexibility due to high numbers of transposons (where
-	  short reads will not help in getting the chromosome assembled/mapped
-	  correctly).
-	</para>
-	<para>
-	  Do not use for: resequencing of "dull" organisms (where the only
-	  differences will be simple SNPs or simple insertion/deletions or
-	  simple contig reorganisations at non-repetitive places). Illumina
-	  will do a much better and cost effective job there.
-	</para>
-	<note>
-	  <para>
-	    As of January 2014: aim for at least 100x coverage of raw data,
-	    better 130x to 150x as pre-processing (quality clip, removal of
-	    adapters and other sequencing artefacts) will take its toll and
-	    reduce the data by up to 1/3. After that, the error
-	    correction/self-correction of raw reads into corrected reads will
-	    again reduce the data considerably.
-	  </para>
-	  <para>
-	    It's really a numbers game: the more data you have, the more
-	    likely you will also get many of those really long reads in the 5
-	    to 30 Kb range which are extremely useful to get over those nasty
-	    repeats.
-	  </para>
-	</note>
-	<note>
-	  MIRA will most probably give you longer contigs with corrected
-	  PacBio reads than you get with the HGAP pipeline, but the number of
-	  indel errors will currently be higher. Either use Quiver on the
-	  results of MIRA ... or simply polish the assembly with a cheap
-	  Illumina data set. The latter approach will also give you better
-	  results than a Quiver approach.
-	</note>
-	<warning>
-	  For non-haploid organisms, you might need more coverage to get
-	  enough data at ploidy sites to get the reads correctly out of
-	  error correction.
-	</warning>
-	<warning>
-	  Preparation of your DNA sample is not trivial as many methods will
-	  break your DNA into "small" chunks which are good enough for
-	  Sanger, 454, Illumina or Ion Torrents, but not for PacBio.
-	</warning>
-      </sect3>
-      <sect3 id="sect_seqadv_technologies_illumina">
-	<title>
-	  Illumina
-	</title>
-	<para>
-	  Use for: general resequencing jobs (finding SNPs, indel locations of
-	  any size, copy number variations etc.); gene expression analysis;
-	  cheap test sequencing of unknown organisms to assess complexity;
-	  de-novo sequencing if you are OK with getting hundreds / thousands
-	  of contigs (depending on organism, some bacteria get only a few
-	  dozen).
-	</para>
-	<warning>
-	  Careful with high GC organisms, starting with 60% to 65% GC Illumina
-	  reads contain more errors: SNP detection may be less reliable if
-	  extreme care is not taken to perform good read clipping. Especially
-	  the dreaded GGCxG motif often leads to problems in Illumina reads.
-	</warning>
-	<warning>
-	  For de-novo assemblies, do <emphasis>NOT</emphasis> (never ever at
-	  all and under no circumstances) use the Nextera kit, take
-	  TruSeq. The non-random fragmentation behaviour of Nextera leads to
-	  all sorts of problems for assemblers (not only MIRA) which try to
-	  use kmer frequencies as a criterion for repetitiveness of a given
-	  sequence.
-	</warning>
-      </sect3>
-      <sect3 id="sect_seqadv_technologies_iontorrent">
-	<title>
-	  Ion Torrent
-	</title>
-	<para>
-	  Use for: like Illumina. With three notable exceptions: 1) SNP
-	  detection is not as good as with Illumina (more false positives and
-	  false negatives) 2) de-novo assemblies will contain more single-base
-	  indels and 3) Ion having problems with homopolymers, that technology
-	  is not as well suited as complimentary hybrid technology for PacBio
-	  as is Illumina (except for high-GC perhaps).
-	</para>
-	<para>
-	  Ion has a speed advantage on Illumina: if you have your own machine,
-	  getting from your sample to data takes less time than with Illumina.
-	</para>
-	<para>
-	  Also, it looks like as if Ion has less problems with GC content or
-	  sequence motifs than Illumina.
-	</para>
-      </sect3>
-      <sect3 id="sect_seqadv_technologies_454">
-	<title>
-	  Roche 454
-	</title>
-	<para>
-	  That technology is on the way out, but there may be two reasons to
-	  not completely dismiss 454: 1) the average read length of 700 bp can
-	  be seen as a plus when compared to Illumina or Ion ... but then
-	  there's PacBio to take care of read length. 2) the large read-pair
-	  libraries work better with 454 than Illumina mate-pair libraries,
-	  something which might be important for scaffolding data where even
-	  PacBio could not completely resolve long repeats.
-	</para>
-      </sect3>
-    </sect2>
-    <sect2 id="sect_seqadv_denovo">
-      <title>
-	Sequencing de-novo
-      </title>
-      <itemizedlist>
-	<listitem>
-	  On a cheap gene fishing expedition? Probably Illumina HiSeq, at
-	  least 100bp, 150 to 250bp or 300bp if your provider supports it
-	  well. Paired-end definitely a plus. As alternative: Ion Torrent for
-	  small organism (maybe up to 100Mb) and when you need results quickly
-	  without caring for possible frameshifts.
-	</listitem>
-	<listitem>
-	  Want some larger contigs? PacBio. Add in cheap Illumina 100bp
-	  paired-end (150 to 300bp if provider supports it) to get rid of
-	  those last frameshifts which may remain.
-	</listitem>
-	<listitem>
-	  Maybe scaffolding of contigs above? PacBio + Illumina 100bp + a
-	  large paired-end library (e.g. 454 20kb)
-	</listitem>
-	<listitem>
-	  Have some good friends at Oxford Nanopore who can give you some
-	  MinIon engineering samples? Man, I'd kill for some bacterial test
-	  sets with those (especially Bacillus subtilis 168)
-	</listitem>
-      </itemizedlist>
-    </sect2>
-    <sect2 id="sect_seqadv_mapping">
-      <title>
-	Re-sequencing / mapping
-      </title>
-      <para>
-	There is a reason why Illumina currently dominates the market as it
-	does: a cheap Illumina run (preferably paired-end) will answer most of
-	your questions in 99% of the cases. Things will get difficult for
-	organisms with high numbers of repeats and/or frequent genome
-	re-arrangements. Then using longer read technologies and/or Illumina
-	mate-pair may be required.
-      </para>
-    </sect2>
-  </sect1>
-  <sect1 id="sect_seqadv_a_word_or_two_on_coverage">
-    <title>
-      A word or two on coverage ...
-    </title>
-    <sect2 id="sect_seqadv_lowcov">
-      <title>
-	Low coverage isn't worth it
-      </title>
-      <para>
-	There's one thing to be said about coverage and de-novo assembly:
-	especially for bacteria, getting more than 'decent' coverage is
-	<emphasis>cheap</emphasis> with any current day technology. Every
-	assembler I know will be happy to assemble de-novo genomes with
-	coverages of 25x, 30x, 40x ... and the number of contigs will still
-	drop dramatically between a 15x Ion Torrent and a 30x Ion Torrent
-	project.
-      </para>
-      <para>
-	In any case, do some calculations: if the coverage you expect to get
-	reaches 50x (e.g. 200MB raw sequence for a 4MB genome), then you
-	(respectively the assembler) can still throw away the worst 20% of the
-	sequence (with lots of sequencing errors) and concentrate on the
-	really, really good parts of the sequences to get you nice contigs.
-      </para>
-      <para>
-	Other example: the price for 1 gigabase Illumina paired-end of a
-	single DNA prep is way, way below USD 1000, even with commercial
-	providers. Then you just need to do the math: is it worth to invest
-	10, 20, 30 or more days of wet lab work, designing primers, doing PCR
-	sequencing etc. and trying to close remaining gaps or hunt down
-	sequencing errors when you went for a 'low' coverage or a non-hybrid
-	sequencing strategy? Or do you invest a few bucks more to get some
-	additional coverage and considerably reduce the uncertainties and gaps
-	which remain?
-      </para>
-      <para>
-	Remember, you probably want to do research on your bug and not
-	research on how to best assemble and close genomes. So even if you put
-	(PhD) students on the job, it's costing you time and money if you
-	wanted to save money earlier in the sequencing. Penny-wise and
-	pound-foolish is almost never a good strategy :-)
-      </para>
-      <para>
-	I do agree that with eukaryotes, things start to get a bit more
-	interesting from the financial point of view.
-      </para>
-    </sect2>
-    <sect2 id="sect_seqadv_highcov">
-      <title>
-	Catch-22: too high coverage
-      </title>
+    <para>
+      Including library prep, a full 454 plate will cost you between 8000 to
+      12000 bucks (or less). The price for a Solexa lane is also low ... 2000
+      or less. Then you just need to do the math: is it worth to invest 10,
+      20, 30 or more days of wet lab work, designing primers, doing PCR
+      sequencing etc. and trying to close remaining gaps or hunt down
+      sequencing errors when you went for a 'low' coverage or a non-hybrid
+      sequencing strategy? Or do you invest a few thousand bucks to get some
+      additional coverage and considerably reduce the uncertainties and gaps
+      which remain?
+    </para>
+    <para>
+      Remember, you probably want to do research on your bug and not
+      research on how to best assemble and close genomes. So even if you put
+      (PhD) students on the job, it's costing you time and money if you
+      wanted to save money earlier in the sequencing. Penny-wise and
+      pound-foolish is almost never a good strategy :-)
+    </para>
+    <para>
+      I do agree that with eukaryotes, things start to get a bit more
+      interesting from the financial point of view.
+    </para>
+    <warning>
       <para>
 	There is, however, a catch-22 situation with coverage: too much
 	coverage isn't good either. Without going into details: sequencing
@@ -661,20 +131,23 @@
 	for your project ... just cut it down to some reasonable amount: 40x
 	to 50x for 454 & IonTorrent, 100x for Solexa/Illumina.
       </para>
-    </sect2>
+    </warning>
   </sect1>
   <sect1 id="sect_seqadv_when_sequencing_a_word_of_caution_regarding_your_dna">
     <title>
       A word of caution regarding your DNA in hybrid sequencing projects
     </title>
     <para>
-      So, you have decided that sequencing your bug with PacBio and Illumina
-      (or PacBio and Ion Torrent or whatever) may be a viable way to get the
-      best bang for your buck. Then please follow this advice: prepare enough
-      DNA <emphasis>in</emphasis> <emphasis>one</emphasis>
-      <emphasis>go</emphasis> for the sequencing provider so that they can
-      sequence it with all the technologies you chose without you having to
-      prepare another batch ... or even grow another culture!
+    </para>
+    <para>
+      So, you have decided that sequencing your bug with 454 paired-end with
+      unpaired 454 data (or Sanger and 454, or Sanger and Solexa, or 454 and
+      Solexa or whatever) may be a viable way to get the best bang for your
+      buck. Then please follow this advice: prepare enough DNA
+      <emphasis>in</emphasis> <emphasis>one</emphasis> <emphasis>go</emphasis>
+      for the sequencing provider so that they can sequence it with all the
+      technologies you chose without you having to prepare another batch
+      ... or even grow another culture!
     </para>
     <para>
       The reason for that is that as soon as you do that, the probability that
@@ -703,102 +176,77 @@
       discern possible repeats from possible SNPs.
     </para>
   </sect1>
-  <sect1 id="sect_seqadv_for_bacteria">
+  <sect1 id="sect_seqadv_for_bacteria:_beware_of_high_copy_number_plasmids!">
     <title>
-      Advice for bacteria
+      For bacteria: beware of (high copy number) plasmids!
     </title>
-    <sect2 id="sect_seqadv_for_bacteria_no_not_sample_in_exponential_phase">
-      <title>
-	Do not sample DNA from bacteria in exponential growth phase!
-      </title>
-      <para>
-	The reason is simple: some bacteria grow so fast that they start
-	replicating themselves even before having finished the first
-	replication cycle. This leads to more DNA around the origin of
-	replication being present in cells, which in turn fools assemblers and
-	mappers into believing that those areas are either repeats or that
-	there are copy number changes.
-      </para>
-      <para>
-	Sample. In. Stationary. Phase!
-      </para>
-      <para>
-	For de-novo assemblies, MIRA will warn you if it detects data which
-	points at exponential phase. In mapping assemblies, look at the
-	coverage profile of your genome: if you see a smile shape (or V
-	shape), you have a problem.
-      </para>
-    </sect2>
-    <sect2 id="sect_seqadv_for_bacteria:_beware_of_high_copy_number_plasmids">
-      <title>
-	Beware of (high copy number) plasmids!
-      </title>
-      <para>
-	This is a source of interesting problems and furthermore gets people
-	wondering why MIRA sometimes creates more contigs than other
-	assemblers when it usually creates less.
-      </para>
-      <para>
-	Here's the short story: there are data sets which include one ore
-	several high-copy plasmid(s). Here's a particularly ugly example:
-	SRA001028 from the NCBI short read archive which contains a plate of
-	paired-end reads for Ecoli K12 MG1655-G
-	(<ulink url="ftp://ftp.ncbi.nih.gov/pub/TraceDB/ShortRead/SRA001028/"/>).
-      </para>
-      <para>
-	The genome is sequenced at ~10x coverage, but during the assembly,
-	three intermediate contigs with ~2kb attain a silly maximum coverage
-	of ~1800x each.  This means that there were ~540 copies of this
-	plasmid (or these plasmids) in the sequencing.
-      </para>
-      <para>
-	When using the uniform read distribution algorithm - which is switched
-	on by default when using "--job=" and the quality level of 'accurate' -
-	MIRA will find out about the average coverage of the genome to be at
-	~10x.  Subsequently this leads MIRA to dutifully create ~500 additional
-	contigs (plus a number of contig debris) with various incarnations of
-	that plasmid at an average of ~10x, because it thought that these were
-	repetitive sites within the genome that needed to be disentangled.
-      </para>
-      <para>
-	Things get even more interesting when some of the plasmid / phage
-	copies are slightly different from each other. These too will be split
-	apart and when looking through the results later on and trying to join
-	the copies back into one contig, one will see that this should not be
-	done because there are real differences.
-      </para>
-      <para>
-	DON'T PANIC!
-      </para>
-      <para>
-	The only effect this has on your assembly is that the number of
-	contigs goes up. This in turn leads to a number of questions in my
-	mailbox why MIRA is sometimes producing more contigs than Newbler (or
-	other assemblers), but that is another story (hint: Newbler either
-	collapses repeats or leaves them completely out of the picture by not
-	assembling repetitive reads).
-      </para>
-      <para>
-	What you can do is the following:
-      </para>
-      <orderedlist>
-	<listitem>
-	  <para>
-	    either you assemble everything together and the join the plasmid
-	    contigs manually after assembly, e.g. in gap4 (drawback: on really
-	    high copy numbers, MIRA will work quite a bit longer ... and you
-	    will have a lot of fun joining the contigs afterwards)
-	  </para>
-	</listitem>
-	<listitem>
-	  <para>
-	    or, after you found out about the plasmid(s) and know the sequence,
-	    you filter out reads in the input data which contain this sequence
-	    (you can use <command>mirabait</command> for this) and assemble the
-	    remaining reads.
-	  </para>
-	</listitem>
-      </orderedlist>
-    </sect2>
+    <para>
+      This is a source of interesting problems and furthermore gets people
+      wondering why MIRA sometimes creates more contigs than other
+      assemblers when it usually creates less.
+    </para>
+    <para>
+      Here's the short story: there are data sets which include one ore
+      several high-copy plasmid(s). Here's a particularly ugly example:
+      SRA001028 from the NCBI short read archive which contains a plate of
+      paired-end reads for Ecoli K12 MG1655-G
+      (<ulink url="ftp://ftp.ncbi.nih.gov/pub/TraceDB/ShortRead/SRA001028/"/>).
+    </para>
+    <para>
+      The genome is sequenced at ~10x coverage, but during the assembly,
+      three intermediate contigs with ~2kb attain a silly maximum coverage
+      of ~1800x each.  This means that there were ~540 copies of this
+      plasmid (or these plasmids) in the sequencing.
+    </para>
+    <para>
+      When using the uniform read distribution algorithm - which is switched
+      on by default when using "--job=" and the quality level of 'accurate' -
+      MIRA will find out about the average coverage of the genome to be at
+      ~10x.  Subsequently this leads MIRA to dutifully create ~500 additional
+      contigs (plus a number of contig debris) with various incarnations of
+      that plasmid at an average of ~10x, because it thought that these were
+      repetitive sites within the genome that needed to be disentangled.
+    </para>
+    <para>
+      Things get even more interesting when some of the plasmid / phage
+      copies are slightly different from each other. These too will be split
+      apart and when looking through the results later on and trying to join
+      the copies back into one contig, one will see that this should not be
+      done because there are real differences.
+    </para>
+    <para>
+      DON'T PANIC!
+    </para>
+    <para>
+      The only effect this has on your assembly is that the number of
+      contigs goes up. This in turn leads to a number of questions in my
+      mailbox why MIRA is sometimes producing more contigs than Newbler (or
+      other assemblers), but that is another story (hint: Newbler either
+      collapses repeats or leaves them completely out of the picture by not
+      assembling repetitive reads).
+    </para>
+    <para>
+      What you can do is the following:
+    </para>
+    <orderedlist>
+      <listitem>
+	<para>
+	  either you assemble everything together and the join the plasmid
+	  contigs manually after assembly, e.g. in gap4 (drawback: on really
+	  high copy numbers, MIRA will work quite a bit longer ... and you
+	  will have a lot of fun joining the contigs afterwards)
+	</para>
+      </listitem>
+      <listitem>
+	<para>
+	  or, after you found out about the plasmid(s) and know the
+	  sequence, you filter out reads in the input data which contain
+	  this sequence and assemble the remaining reads.
+	</para>
+      </listitem>
+    </orderedlist>
+    <para>
+    </para>
   </sect1>
 </chapter>
+
diff --git a/doc/docbook/chap_seqtechdesc_part.xml b/doc/docbook/chap_seqtechdesc_part.xml
deleted file mode 100644
index 9bbae37..0000000
--- a/doc/docbook/chap_seqtechdesc_part.xml
+++ /dev/null
@@ -1,891 +0,0 @@
-<?xml version="1.0" ?>
-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.docbook.org/xml/4.5/docbookx.dtd">
-<chapter id="chap_seqtechdesc">
-  <chapterinfo>
-    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="versionfile"/>
-    <author>
-      <firstname>Bastien</firstname>
-      <surname>Chevreux</surname>
-      <email>bach at chevreux.org</email>
-    </author>
-    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="copyrightfile"/>
-  </chapterinfo>
-  <blockquote>
-    <attribution>Solomon Short</attribution>
-    <para>
-      <emphasis><quote>Opinions are like chili powder - best used in moderation.</quote></emphasis>
-    </para>
-  </blockquote>
-  <title>Description of sequencing technologies</title>
-  <sect1 id="sect_std_intro">
-    <title>
-      Introduction
-    </title>
-    <para>
-      <emphasis role="bold">Note:</emphasis> This section contains things I've
-      seen in the past and simply jotted down. These may be fundamentally
-      correct or correct only under circumstances or not correct at all with
-      your data. You may have different observations.
-    </para>
-    <para>
-      ...
-    </para>
-  </sect1>
-  <sect1 id="sect_std_sxa">
-    <title>
-      Illumina (formerly Solexa)
-    </title>
-    <sect2 id="sect_std_sxa_caveats_for_illumina">
-      <title>
-	Caveats for Illumina data
-      </title>
-      <note>
-	<para>
-	  Even if you can get bacteria sequenced with ridiculously high coverage
-	  like 500x or 1000x, this amount of data is simply not needed. Even
-	  more important - though counterintuitive - is the fact that due to
-	  non-random sequence dependent sequencing errors, a too high coverage
-	  may even make the assembly worse.
-	</para>
-	<para>
-	  Another rule of thumb: when having more than enough data, reduce the
-	  data set so as to have an average coverage of approximately 100x. In
-	  some rare cases (high GC content), perhaps 120x to 150x, but certainly
-	  not more.
-	</para>
-      </note>
-      <warning>
-	When reducing a data set, do <emphasis role="bold">NOT</emphasis>,
-	under no circumstances not, try fancy selection of reads by some
-	arbitrary quality or length criteria. This will introduce a terrible
-	bias in your assembly due to non-random sequence-dependent sequencing
-	errors and non-random sequence dependent base quality assignment. More
-	on this in the next section.
-      </warning>
-    </sect2>
-    <sect2 id="sect_std_sxa_highlights">
-      <title>
-	Illumina highlights
-      </title>
-      <sect3 id="sect_std_sxa_highlights_quality">
-	<title>
-	  Quality
-	</title>
-	<para>
-	  For current HiSeq 100bp reads I get - after MIRA clipping - about 90
-	  to 95% reads matching to a reference without a single error. MiSeq
-	  250bp reads contain a couple more errors, but nothing to be alarmed
-	  off.
-	</para>
-	<para>
-	  In short: Illumina is currently <emphasis>the</emphasis> technology
-	  to use if you want high quality reads.
-	</para>
-      </sect3>
-    </sect2>
-    <sect2 id="sect_std_std_sxa_lowlights">
-      <title>
-	Lowlights
-      </title>
-      <sect3 id="sect_std_sxa_lowlights_longhomopolymers">
-	<title>
-	  Long homopolymers
-	</title>
-	<para>
-	  Long homopolymers (stretches of identical bases in reads) can be a
-	  slight problem for Solexa. However, it must be noted that this is a
-	  problem of all sequencing technologies on the market so far (Sanger,
-	  Solexa, 454). Furthermore, the problem in much less pronounced in
-	  Solexa than in 454 data: in Solexa, first problem appear may appear
-	  in stretches of 9 to 10 bases, in Ion Torrent a stretch of 3 to 4
-	  bases may already start being problematic in some cases.
-	</para>
-      </sect3>
-      <sect3 id="sect_std_sxa_lowlights_GGCxG_motif">
-	<title>
-	  The GGCxG and GGC motifs
-	</title>
-	<para>
-	  <literal>GGCxG</literal> or even <literal>GGC</literal> motif in the
-	  5' to 3' direction of reads. This one is particularly annoying and
-	  it took me quite a while to circumvent in MIRA the problems it
-	  causes.
-	</para>
-	<para>
-	  Simply put: at some places in a genome, base calling after a
-	  <literal>GGCxG</literal> or <literal>GGC</literal> motif is
-	  particularly error prone, the number of reads without errors
-	  declines markedly. Repeated <literal>GGC</literal> motifs worsen
-	  the situation. The following screen shots of a mapping assembly
-	  illustrate this.
-	</para>
-	<para>
-	  The first example is a the <literal>GGCxG</literal> motif (in form
-	  of a <literal>GGCTG</literal>) occurring in approximately one third
-	  of the reads at the shown position. Note that all but one read
-	  with this problem are in the same (plus) direction.
-	</para>
-	<figure id="sxa_unsc_ggcxg2_lenski.png">
-	  <title>
-	    The Solexa GGCxG problem.
-	  </title>
-	  <mediaobject>
-	    <imageobject>
-	      <imagedata fileref="bookfigures/sxa_unsc_ggcxg2_lenski.png" width="90%"/>
-	    </imageobject>
-	  </mediaobject>
-	</figure>
-	<para>
-	  The next two screen shots show the <literal>GGC</literal>, once for
-	  forward direction and one with reverse direction reads:
-	</para>
-	<figure id="sxa_unsc_ggc1_lenski.png">
-	  <title>
-	    The Solexa GGC problem, forward example
-	  </title>
-	  <mediaobject>
-	    <imageobject>
-	      <imagedata fileref="bookfigures/sxa_unsc_ggc1_lenski.png" width="90%"/>
-	    </imageobject>
-	  </mediaobject>
-	</figure>
-	<figure id="sxa_unsc_ggc4_lenski.png">
-	  <title>
-	    The Solexa GGC problem, reverse example
-	  </title>
-	  <mediaobject>
-	    <imageobject>
-	      <imagedata fileref="bookfigures/sxa_unsc_ggc4_lenski.png" width="90%"/>
-	    </imageobject>
-	  </mediaobject>
-	</figure>
-	<para>
-	  Places in the genome that have <literal>GGCGGC.....GCCGCC</literal>
-	  (a motif, perhaps even repeated, then some bases and then an
-	  inverted motif) almost always have very, very low number of good
-	  reads. Especially when the motif is <literal>GGCxG</literal>.
-	</para>
-	<para>
-	  Things get especially difficult when these motifs occur at sites
-	  where users may have a genuine interest. The following example is a
-	  screen shot from the Lenski data (see walk-through below) where a
-	  simple mapping reveals an anomaly which -- in reality -- is an IS
-	  insertion (see <ulink
-	  url="http://www.nature.com/nature/journal/v461/n7268/fig_tab/nature08480_F1.html"/>)
-	  but could also look like a <literal>GGCxG</literal> motif in forward
-	  direction (<literal>GGCCG</literal>) and at the same time a
-	  <literal>GGC</literal> motif in reverse direction:
-	</para>
-	<figure id="sxa_xmastree_lenski2.png">
-	  <title>
-	    A genuine place of interest almost masked by the
-	    <literal>GGCxG</literal> problem.
-	  </title>
-	  <mediaobject>
-	    <imageobject>
-	      <imagedata fileref="bookfigures/sxa_xmastree_lenski2.png" width="90%"/>
-	    </imageobject>
-	  </mediaobject>
-	</figure>
-      </sect3>
-      <sect3 id="sect_std_sxa_lowlights_chimericreads">
-	<title>
-	  Chimeric reads
-	</title>
-	<para>
-	  I did not realise chimeric reads were a problem with Illumina data
-	  until Fall 2014 when I got reads > 100bp for extremely well
-	  charactersided bacteria ... and because MIRA since ever used data
-	  cleaning methods which worked very well on either short reads ≤
-	  100bp or when chimeras occurred at a very low frequency.
-	</para>
-	<para>
-	  Chimeras are are artefacts reads from library preparation which
-	  contain parts of the sequence of interest which do not belong
-	  together. E.g., in DNA from a bacterial genome, there may be one
-	  read of 100 bp where the first 40 bp come from the genome position
-	  at 100kb and the last 60 bp come from a position at 1300kb ... more
-	  than one megabase apart.
-	</para>
-	<para>
-	  There is not much literature regarding chimeric sequences in
-	  Illumina data: most of it deals with 16S or amplicon sequencing
-	  where I always thought <emphasis>"that does not apply to my data
-	  sets."</emphasis> Well, tough luck ... it does. After some searching I
-	  found some papers which report quite varying levels depending on the
-	  protocols used.  Oyola et al. report between 0.24% and 2.3% of
-	  chimeras (<emphasis>Optimizing illumina next-generation sequencing
-	  library preparation for extremely at-biased genomes</emphasis>; BMC
-	  Genomics 2012, 13:1; doi:10.1186/1471-2164-13-1; <ulink
-	  url="http://www.biomedcentral.com/1471-2164/13/1"/>). Apparently, a
-	  paper from researchers at the Sanger Centre reported up to 5%
-	  chimeric reads (Bronner et al., <emphasis>Improved Protocols for
-	  Illumina Sequencing</emphasis>; Current Protocols in Human Genetics
-	  18:18.2:18.2.1–18.2.42; DOI: 10.1002/0471142905.hg1802s80; <ulink
-	  url="http://onlinelibrary.wiley.com/doi/10.1002/0471142905.hg1802s80/abstract"/>
-	  via <ulink
-	  url="http://www.sagescience.com/blog/sanger-reports-improved-prep-protocols-for-illumina-sequencing/"/>).
-	</para>
-	<para>
-	  I have now seen MiSeq 250bp and 300bp paired-end genomic data sets
-	  from different (trusted) sequencing providers for very well
-	  characterised, non-complex and non-GC-extreme bacterial genomes with
-	  up to 3% chimeric reads. To make things worse, some chimeras were
-	  represented by both reads of a read-pair, so one had the exact same
-	  chimeric sequence represented twice: once in forward and once in
-	  reverse complement direction.
-	</para>
-	<para>
-	  It turned out that MIRA versions ≤ 4.9.3 have problems in
-	  filtering chimeras in Illumina data sets with reads > 100bp as
-	  the chimera detection algorithms were designed to handle amounts
-	  much less than 1% of the total reads. This led to shorter contigs in
-	  genomic assemblies and to chimeric transcripts (when they are very
-	  low-coverage) in RNA assemblies.
-	</para>
-	<para>
-	  Note that projects using reads ≤ 100 bp assembled fine with MIRA
-	  4.9.3 and before as the default algorithms for proposed-end-clip
-	  (<arg>-CL:pec</arg>) implicitly caught chimeras occuring near the
-	  read ends and the remaining chimeras were caught by the algorithms
-	  for low level chimeras.
-	</para>
-	<warning>
-	  MIRA 4.9.4 and higher eliminate all chimeras in Illumina reads of
-	  any length, you do not need to take any precautionary steps
-	  here. But if you use other assemblers and in light of the above, I
-	  highly recommend to apply very stringent filters to Illumina data.
-	  Especially for applications like metagenomics or RNA de-novo
-	  assembly where low coverage may be expected for parts of the
-	  results! Indeed, I now treat any assembly result with consensus data
-	  generated from a coverage of less than 3 Illumina reads as
-	  potentially junk data.
-	</warning>
-      </sect3>
-      <sect3 id="sect_std_sxa_lowlights_samplemix">
-	<title>
-	  Sample barcode misidentification
-	</title>
-	<para>
-	  Long story short: data from multiplexed samples contains "low"
-	  amounts of foreign samples from the same lane. Probably not a
-	  problem for high coverage assemblies, but can become a problem in
-	  multiplexed RNASeq or projects looking for "rare" variants.
-	</para>
-	<para>
-	  In essence, the barcoding used for multiplexing several samples into
-	  a single lane is not a 100% foolproof process. I found one paper
-	  quantifying this effect to 0.3% of misidentified reads: Kircher et
-	  al., <emphasis>Double indexing overcomes inaccuracies in multiplex
-	  sequencing on the Illumina platform</emphasis>; Nucleic Acids
-	  Res. Jan 2012; 40(1): e3. <ulink
-	  url="http://www.ncbi.nlm.nih.gov/pmc/articles/PMC3245947/"/>
-	</para>
-	<para>
-	  For example, I got some genome sequecing data for a bacterium where
-	  closer inspection of some small contigs coming out of the assembly
-	  process turned out to be highly expressed genes from a plant. The
-	  sequencing provider had multiplexed our bacterial sample with a
-	  RNASeq project of that plant.
-	</para>
-	<para>
-	  Another example involved RNASeq of two genomes where one of the
-	  organisms had been modified to contain additional genes under a
-	  strong promoter. In the data set we suddenly saw those inserted
-	  genes pop-up in the samples of the wild type organism. Which,
-	  clearly, could not be.
-	</para>
-      </sect3>
-      <sect3 id="sect_std_sxa_lowlights_nextera">
-	<title>
-	  Nextera library prep
-	</title>
-	<para>
-	  Opinions seem to be divided about Nextera: some people don't like it
-	  as it introduces sometimes terrible coverage bias in the data, other
-	  people say they're happy with the data.
-	</para>
-	<para>
-	  Someone told me (or wrote, I do not remember) that this divide may
-	  be due to the fact that some people use their sequencing data for
-	  de-novo assemblies, while others just do mappings and hunt for
-	  SNPs. In fact, this would explain a lot: for de-novo assemblies, I
-	  would never use Nextera. When on a hunt for SNPs, they may be OK.
-	</para>
-      </sect3>
-      <sect3 id="sect_std_sxa_lowlights_gcbias">
-	<title>
-	  Strong GC bias in some Solexa data (2nd half 2009 until advent of TruSeq kit at end of 2010)
-	</title>
-	<para>
-	  I'm recycling a few slides from a couple of talks I held in 2010.
-	</para>
-	<para>
-	  Things used to be so nice and easy with the early Solexa data I worked
-	  with (36 and 44mers) in late 2007 / early 2008. When sample taking was
-	  done right -- e.g. for bacteria: in stationary phase -- and the
-	  sequencing lab did a good job, the read coverage of the genome was
-	  almost even. I did see a few papers claiming to see non-trivial GC
-	  bias back then, but after having analysed the data I worked with I
-	  dismissed them as "not relevant for my use cases." Have a look at the
-	  following figure showing exemplarily the coverage of a 45% GC
-	  bacterium in 2008:
-	</para>
-	<figure id="sxa_gcbias_nobias2008.png">
-	  <titleabbrev>
-	    Example for no GC coverage bias in 2008 Solexa data.
-	  </titleabbrev>
-	  <title>
-	    Example for no GC coverage bias in 2008 Solexa data. Apart from a
-	    slight <emphasis>smile shape</emphasis> of the coverage --
-	    indicating the sample taking was not 100% in stationary phase of the
-	    bacterial culture -- everything looks pretty nice: the average
-	    coverage is at 27x, and when looking at potential genome
-	    duplications at twice the coverage (54x), there's nothing apart a
-	    single peak (which turned out to be a problem in a rRNA region).
-	  </title>
-	  <mediaobject>
-	    <imageobject>
-	      <imagedata fileref="bookfigures/sxa_gcbias_nobias2008.png" width="90%"/>
-	    </imageobject>
-	  </mediaobject>
-	</figure>
-	<para>
-	  Things changed starting sometime in Q3 2009, at least that's when I
-	  got some data which made me notice a problem. Have a look at the
-	  following figure which shows exactly the same organism as in the
-	  figure above (bacterium, 45% GC):
-	</para>
-	<figure id="sxa_gcbias_bias2009.png">
-	  <titleabbrev>
-	    Example for GC coverage bias starting Q3 2009 in Solexa data.
-	  </titleabbrev>
-	  <title>
-	    Example for GC coverage bias starting Q3 2009 in Solexa
-	    data. There's no <emphasis>smile shape</emphasis> anymore -- the
-	    people in the lab learned to pay attention to sample in 100%
-	    stationary phase -- but something else is extremely disconcerting:
-	    the average coverage is at 33x, and when looking at potential genome
-	    duplications at twice the coverage (66x), there are several dozen
-	    peaks crossing the 66x threshold over a several kilobases (in one
-	    case over 200 Kb) all over the genome. As if several small genome
-	    duplications happened.
-	  </title>
-	  <mediaobject>
-	    <imageobject>
-	      <imagedata fileref="bookfigures/sxa_gcbias_bias2009.png" width="90%"/>
-	    </imageobject>
-	  </mediaobject>
-	</figure>
-	<para>
-	  By the way, the figures above are just examples: I saw over a dozen
-	  sequencing projects in 2008 without GC bias and several dozen in 2009
-	  / 2010 with GC bias.
-	</para>
-	<para>
-	  Checking the potential genome duplication sites, they all looked
-	  "clean", i.e., the typical genome insertion markers are
-	  missing. Poking around at possible explanations, I looked at GC
-	  content of those parts in the genome ... and there was the
-	  explanation:
-	</para>
-	<figure id="sxa_gcbias_comp20082009.png">
-	  <titleabbrev>
-	    Example for GC coverage bias, direct comparison 2008 / 2010 data.
-	  </titleabbrev>
-	  <title>
-	    Example for GC coverage bias, direct comparison 2008 / 2010
-	    data. The bug has 45% average GC, areas with above average read
-	    coverage in 2010 data turn out to be lower GC: around 33 to 36%. The
-	    effect is also noticeable in the 2008 data, but barely so.
-	  </title>
-	  <mediaobject>
-	    <imageobject>
-	      <imagedata fileref="bookfigures/sxa_gcbias_comp20082009.png" width="90%"/>
-	    </imageobject>
-	  </mediaobject>
-	</figure>
-	<para>
-	  Now as to actually <emphasis>why</emphasis> the GC bias suddenly
-	  became so strong is unknown to me. The people in the lab use the same
-	  protocol since several years to extract the DNA and the sequencing
-	  providers claim to always use the Illumina standard protocols.
-	</para>
-	<para>
-	  But obviously something must have changed.
-	</para>
-	<para>
-	  It took Illumina some 18 months to resolve that problem for the
-	  broader public: since data I work on were done with the TruSeq kit,
-	  this problem has vanished.
-	</para>
-	<para>
-	  However, if you based some conclusions or wrote a paper with Illumina
-	  data which might be affected by the GC bias (Q3 2009 to Q4 2010), I
-	  suggest you rethink all the conclusion drawn. This should be
-	  especially the case for transcriptomics experiments where a difference
-	  in expression of 2x to 3x starts to get highly significant!
-	</para>
-      </sect3>
-    </sect2>
-  </sect1>
-  <sect1 id="sect_std_iontor">
-    <title>
-      Ion Torrent
-    </title>
-    <para>
-      As of January 2014, I would say Ion Torrent reads behave very much like
-      late data from the 454 technology (FLX / Titanium chemistry): reads are
-      on average are > 300bp and the homopolymer problem is much less
-      pronounced than 2 years ago. The following figure shows what you can get
-      out of 100bp reads if you're lucky:
-    </para>
-    <figure id="chap_iontor::ion_dh10bgoodB13.png">
-      <title>
-	Example for good IonTorrent data (100bp reads). Note that only a
-	single sequencing error - shown by blue background - can be
-	seen. Except this, all homopolymers of size 3 and 4 in the area
-	shown are good.
-      </title>
-      <titleabbrev>
-	Example for good IonTorrent data (100bp reads)
-      </titleabbrev>
-      <mediaobject>
-	<imageobject>
-	  <imagedata fileref="bookfigures/ion_dh10bgoodB13.png" width="90%"/>
-	</imageobject>
-      </mediaobject>
-    </figure>
-    <para>
-      The "if you're lucky" part in the preceding sentence is not there by
-      accident: having so many clean reads is more of an exception rather a
-      rule. On the other hand, most sequencing errors in current IonTorrent
-      data are unproblematic ... if it were not for indels, which is going to
-      be explained on the next sections.
-    </para>
-    <sect2 id="sect_std_iontor_hpindels">
-      <title>
-	Homopolymer insertions / deletions
-      </title>
-      <para>
-	The main source of error in your data will be insertions / deletions
-	(indels) especially in homopolymer regions (but not only there, see
-	also next section). Starting with a base run of 4 to 6 bases, there
-	is a distinct tendency to have an increased occurrence of indel
-	errors.
-      </para>
-      <figure id="chap_iontor::iontor_indelhpexample.png">
-	<title>
-	  Example for problematic IonTorrent data (100bp reads).
-	</title>
-	<titleabbrev>
-	  Example for problematic IonTorrent data (100bp reads)
-	</titleabbrev>
-	<mediaobject>
-	  <imageobject>
-	    <imagedata fileref="bookfigures/iontor_indelhpexample.png" width="90%"/>
-	  </imageobject>
-	</mediaobject>
-      </figure>
-    </sect2>
-    <para>
-      The above figure contains a couple of particularly nasty indel
-      problems. While areas 2 (C-homopolymer length 3), 5 (A-homopolymer
-      length 4) and 6 (T-homopolymer length 3) are not a big problem as most
-      of the reads got the length right, the areas 1, 3 and 4 are nasty.
-    </para>
-    <para>
-      Area 1 is an A-homopolymer of length 7 and while many reads get that
-      length right (enough to tell MIRA what the true length is), it also
-      contains reads with a length of 6 and and others with a length of 8.
-    </para>
-    <para>
-      Area 2 is a "A-homopolymer" of length 2 where approximately half of the
-      reads get the length right, the other half not. See also the following
-      section.
-    </para>
-    <para>
-      Area 4 is a T-homopolymer of length 5 which also has approximately half
-      the reads with a wrong length of 4.
-    </para>
-    <sect2 id="sect_std_iontor_seqdirdepindels">
-      <title>
-	Sequencing direction dependent insertions / deletions
-      </title>
-      <para>
-	In the previous section, the screen shot showing indels had an indel
-	at a homopolymer of 2, which is something quite curious. Upon closer
-	investigation, one might notice a pattern in the gap/nogap
-	distribution: it is almost identical to the orientation of build
-	direction of reads!
-      </para>
-      <para>
-	I looked for other examples of this behaviour and found quite a
-	number of them, the following figure shows a very clear case of that
-	error behaviour:
-      </para>
-      <figure id="chap_iontor::ion_dh10bdirdepindel.png.png">
-	<title>
-	  Example for a sequencing direction dependent indel. Note how all
-	  but one of the reads in '+' direction miss a base while all reads
-	  built in in '-' direction have the correct number of bases.
-	</title>
-	<titleabbrev>
-	  Example for a sequencing direction dependent indel
-	</titleabbrev>
-	<mediaobject>
-	  <imageobject>
-	    <imagedata fileref="bookfigures/ion_dh10bdirdepindel.png" width="90%"/>
-	  </imageobject>
-	</mediaobject>
-      </figure>
-      <para>
-	This is quite astonishing: the problem occurs at a site without real
-	homopolymer (calling a 2-bases run a 'homopolymer' starts stretching
-	the definition a bit) and there are no major problematic homopolymer
-	sites near. In fact, this was more or less the case for all sites I
-	had a look at.
-      </para>
-      <para>
-	Neither did the cases which were investigated show common base
-	patterns, so unlike the Solexa GGCxG motif it does not look like
-	that error of IonTorrent is bound to a particular motif.
-      </para>
-      <para>
-	While I cannot prove the following statement, I somehow suspect that
-	there must be some kind of secondary structure forming which leads to
-	that kind of sequencing error. If anyone has a good explanation I'd be
-	happy to hear it: feel free to contact me at
-	<email>bach at chevreux.org</email>.
-      </para>
-    </sect2>
-    <sect2 id="sect_std_iontor_covvariance">
-      <title>
-	Coverage variance
-      </title>
-      <para>
-	The coverage variance with the old ~100bp reads was a bit on the
-	bad side for low coverage projects (10x to 15x): it varied wildly,
-	sometimes dropping to nearly zero, sometimes reaching approximately
-	double the coverage.
-      </para>
-      <para>
-	This has now improved and I have not seen pronounced coverage variance
-	in the data sets I have worked on.
-      </para>
-    </sect2>
-    <sect2 id="sect_std_iontor_gcbias">
-      <title>
-	GC bias
-      </title>
-      <para>
-	The GC bias seems to be small to non-existent, at least I could not
-	immediately make a correlation between GC content and coverage.
-      </para>
-    </sect2>
-    <sect2 id="sect_std_iontor_other_sources_of_error">
-      <title>
-	Other sources of error
-      </title>
-      <para>
-	You will want to keep an eye on the clipping of the data in the SFF
-	files from IonTorrent: while it is generally good enough, some data
-	sets of IonTorrent show that - for some error patterns - the clipping
-	is too lax and strange artefacts appear. MIRA will take care of these
-	- or at least of those it knows - but you should be aware of this
-	potential problem.
-      </para>
-    </sect2>
-    <sect2 id="sect_std_iontor_where_to_find_further_information">
-      <title>
-	Where to find further information
-      </title>
-      <para>
-	IonTorrent being pretty new, getting as much information on that
-	technology is quite important. So here are a couple of links I found
-	to be helpful:
-      </para>
-      <itemizedlist>
-	<listitem>
-	  <para>
-	    There is, of course, the TorrentDev site (<ulink
-	    url="http://lifetech-it.hosted.jivesoftware.com/community/torrent_dev"/>)
-	    at Life Technologies which will be helpful to get a couple of
-	    questions answered.
-	  </para>
-	  <para>
-	    Just be aware that some of the documents over there are sometimes
-	    painting an - how should I say it diplomatically? - overly
-	    optimistic view on the performance of the technology. On the
-	    other hand, so do documents released by the main competitors
-	    like 454/Roche, Illumina, PacBio etc. ... so no harm done there.
-	  </para>
-	</listitem>
-	<listitem>
-	  <para>
-	    I found Nick Loman's blog <ulink
-	    url="http://pathogenomics.bham.ac.uk/blog/">Pathogens: Genes and
-	    Genomes</ulink> to be my currently most valuable source of
-	    information on IonTorrent. While the group he works for won a
-	    sequencer from IonTorrent, he makes that fact very clear and still
-	    unsparingly dissects the data he gets from that machine.
-	  </para>
-	  <para>
-	    His posts got me going in getting MIRA grok IonTorrent.
-	  </para>
-	</listitem>
-	<listitem>
-	  <para>
-	    The blog of Lex Nederbragt <ulink
-	    url="http://flxlexblog.wordpress.com/">In between lines of
-	    code</ulink> is playing in the same league: very down to earth and
-	    he knows a bluff when he sees it ... and is not afraid to call it
-	    (be it from IonTorrent, PacBio or 454).
-	  </para>
-	  <para>
-	    The analysis he did on a couple of Ion data sets have saved me
-	    quite some time.
-	  </para>
-	</listitem>
-	<listitem>
-	  <para>
-	    Last, but not least, the board with <ulink
-	    url="http://seqanswers.com/forums/forumdisplay.php?f=40">IonTorrent-related-stuff</ulink>
-	    over at <ulink url="http://seqanswers.com/">SeqAnswers</ulink>,
-	    the first and foremost one-stop-shop ... erm ... discussion board
-	    for everything related to sequencing nowadays.
-	  </para>
-	</listitem>
-      </itemizedlist>
-    </sect2>
-  </sect1>
-  <sect1 id="sect_std_pacbio">
-    <title>
-      Pacific BioSciences
-    </title>
-    <para>
-      As of January 2014, PacBio should be seen as <emphasis>the</emphasis>
-      technology to go to for de-novo sequencing of bacteria and lower
-      eukaryotes. Period. Complement it with a bit of Illumina to get rid of
-      the last remaining errors and you'll have - for a couple of thousand
-      Euros - the best genome sequences money can buy.
-    </para>
-    <sect2 id="sect_std_pb_highlights">
-      <title>
-	Highlights
-      </title>
-      <sect3 id="sect_std_pb_hl_length">
-	<title>
-	  Sequence lengths
-	</title>
-	<para>
-	  Just one word: huge. At least compared to other currently existing
-	  technologies. It is not unusual to get average - usable - read lengths
-	  of more than 3 to 4 kb, some chemistries doubling that number (at
-	  the expense of accuracy). The largest - usable - reads I have seen
-	  were > 25kb, though one needs to keep in mind that these are
-	  quite rare and one does not see many of them in a project.
-	</para>
-      </sect3>
-      <sect3 id="sect_std_pb_hl_gcbias">
-	<title>
-	  GC bias
-	</title>
-	<para>
-	  I have seen none in my projects so far, neither have I in public
-	  data. But these were certainly not as many projects as Sanger, 454,
-	  Illumina and Ion, so take this with a grain of salt.
-	</para>
-      </sect3>
-      <sect3 id="sect_std_pb_hl_acccorrected">
-	<title>
-	  Accuracy of corrected reads
-	</title>
-	<para>
-	  Once the raw PacBio data has been corrected (HGAP pipeline), the
-	  resulting reads have a pretty good accuracy. There still are
-	  occasional homopolymer errors remaining at non-random locations, but
-	  they are a minor problem.
-	</para>
-      </sect3>
-      <sect3 id="sect_std_pb_hl_qualassemblies">
-	<title>
-	  Assemblies of corrected reads
-	</title>
-	<para>
-	  The assemblies coming out of the HGAP pipeline are already
-	  astoundingly good. Of course you get long contigs, but also the
-	  number of miscalled consensus bases is not too bad: 1 error per 20
-	  kb. Once the program
-	  <command>Quiver</command> went through the assembly to do its magic
-	  in polishing, the quality improves further to into the range of 1
-	  error per 50kb to 1 error per 250kb.
-	</para>
-	<para>
-	  In my hands, I get even better assemblies with MIRA (longer contigs
-	  which span repeats unresolved by HGAP). When combining this with
-	  some low coverage Illumina data (say, 50x) to do cheap polishing,
-	  the error rates I get are lower than 1 error in 4 megabases.
-	</para>
-	<note>
-	  Take the above with a grain of salt as at the time of this writing,
-	  I analysed in-depth only on a couple of bacteria. For ploidal
-	  organisms I have just played a bit around with public data without
-	  really doing an in depth analysis there.
-	</note>
-      </sect3>
-    </sect2>
-    <sect2 id="sect_std_pb_lowlights">
-      <title>
-	Lowlights
-      </title>
-      <sect3 id="sect_std_pb_ll_namingconfusion">
-	<title>
-	  Naming confusion
-	</title>
-	<para>
-	  With PacBio, there are quite a number of read types being thrown
-	  around and which do confuse people: <emphasis>polymerase
-	  reads</emphasis>, <emphasis>quality clipped
-	  reads</emphasis>, <emphasis>subreads</emphasis>, <emphasis>corrected
-	  reads</emphasis> and maybe some more I currently forgot. Here's the
-	  total unofficial guide on how to keep those things apart:
-	</para>
-	<itemizedlist>
-	  <listitem>
-	    <para>
-	      <emphasis role="bold">polymerase reads</emphasis> are the rawest
-	      and most unedited stuff you may come into contact. You can see
-	      it as "data fresh from the machine" and the number of megabases
-	      there is usually the one sequencing providers sell to you.
-	    </para>
-	    <para>
-	      The sequencing technology PacBio employs uses special hairpin
-	      adaptors they have named SMRTBell, and these adaptors will be
-	      present in the polymerase reads together with the fragments of
-	      your DNA.
-	    </para>
-	    <para>
-	      In terms of regular expression look-alike, the data in
-	      polymerase reads has the following form:
-	    </para>
-	    <screen>(Adaptor + (forward fragment sequence + (Adaptor + (fragment sequence in reverse complement))))*</screen>
-	    <para>
-	      E.g., some of your <emphasis>polymerase reads</emphasis> will
-	      contain just the adaptor and (part of) a fragment sequence:
-	      Adap+FwdSeq. Others might contain: Adap+FwdSeq+Adap+RevSeq. And
-	      still others might contain: multiple copies of
-	      Adap+FwdSeq+Adap+RevSeq.
-	    </para>
-	  </listitem>
-	  <listitem>
-	    <emphasis role="bold">quality clipped reads</emphasis> are
-	    simply <emphasis>polymerase reads</emphasis> where some sort of
-	    first quality clipping has been done.
-	  </listitem>
-	  <listitem>
-	    <emphasis role="bold">subreads</emphasis> are <emphasis>quality
-	    clipped reads</emphasis> where the adaptors have been removed and
-	    the read split into forward fragment sequences and reverse
-	    fragment sequences. Hence, one quality clipped polymerase read can
-	    yield several subreads.
-	  </listitem>
-	  <listitem>
-	    <para>
-	      <emphasis role="bold">corrected (sub)reads</emphasis> are
-	      subreads where through the magic of lots of computational power
-	      and a very high coverage of subreads, the errors have been
-	      almost completely removed from the subreads.
-	    </para>
-	    <para>
-	      This is usually done only on a part of the subreads as it takes
-	      already long enough (several hundred hours CPU for a simple
-	      bacterium).
-	    </para>
-	  </listitem>
-	</itemizedlist>
-      </sect3>
-      <sect3 id="sect_std_pb_ll_revseq">
-	<title>
-	  Forward / reverse chimeric sequences
-	</title>
-	<para>
-	  The splitting of polymerase reads into subreads (see above) needs
-	  the SMRTBell adaptor to be recognised by motif searching
-	  programs. Unfortunately, it looks like as if some "low percentage"
-	  of reads have a self-looped end instead of an adaptor. Which in turn
-	  means that the subread splitting will not split those reads and you
-	  end up with a chimeric sequence.
-	</para>
-      </sect3>
-      <sect3 id="sect_std_pb_ll_rawreadaccuracy">
-	<title>
-	  Accuracy of uncorrected subreads
-	</title>
-	<para>
-	  You need to be brave now: the accuracy of the the unclipped
-	  polymerase reads is usually only about 50%. That is: on average
-	  every second base is wrong. And I have seen a project where this
-	  accuracy was only 14% (6 out of 7 bases are wrong).
-	</para>
-	<para>
-	  After clipping, the average accuracy of the polymerase reads should
-	  be anywhere between 80% and 85% (this depends a little bit on the
-	  chemistry used), which translates to: every 5th to every 7th base is
-	  wrong. The vast majority of errors being insertions or deletions, not
-	  base substitutions.
-	</para>
-	<para>
-	  80% to 85% accurracy with indels as primary error is unfortunately
-	  something assemblers cannot use very well. Read: not at all if you
-	  want good assemblies (at least I know no program which does
-	  that). Therefore, one needs to apply some sort of correction
-	  ... which needs quite a deal of CPU, see below.
-	</para>
-      </sect3>
-      <sect3 id="sect_std_pb_ll_cpu">
-	<title>
-	  Immense need for CPU power
-	</title>
-	<para>
-	  The above mentioned accuracies of 80% to 85% are too low for any
-	  existing assembler I know to be correctly assembled. Therefore,
-	  people came up with the idea of doing error correction on subreads
-	  to improve their quality.
-	</para>
-	<para>
-	  There are two major approaches: 1) correcting PacBio subreads with
-	  other technologies with shorter reads and 2) correcting long PacBio
-	  subreads with shorter PacBio subreads. Both approaches have been
-	  shown to work, though there seems to be a preference nowadays to use
-	  the second option as the "shorter" PacBio reads provide the benefit
-	  of being still longer than read from other technologies and hence
-	  provide a better repeat resolution.
-	</para>
-	<para>
-	  Anyway, the amount of CPU power needed for any method above is
-	  something to keep for: bacteria with 3 to 5 megabases at a 100x
-	  polymerase read coverage can take several hundred hours of CPU for
-	  the correction step.
-	</para>
-      </sect3>
-      <sect3 id="sect_std_pb_ll_dnaprep">
-	<title>
-	  Increased quality requirements for clean DNA sample prep
-	</title>
-	<para>
-	  This is a problem which cannot be really attributed to PacBio: one
-	  absolutely needs to check whether the protocols used "since ever"
-	  for DNA extraction yield results which are clean and long enough for
-	  PacBio. Often they are not.
-	</para>
-	<para>
-	  The reason for this being a problem is simple: PacBio can sequence
-	  really long fragments, but if your DNA extraction protocol smashed
-	  the DNA into small pieces, then no sequencing technology in this
-	  universe will be able to give you long reads for small fragments.
-	</para>
-      </sect3>
-    </sect2>
-  </sect1>
-</chapter>
diff --git a/doc/docbook/chap_solexa_part.xml b/doc/docbook/chap_solexa_part.xml
new file mode 100644
index 0000000..0e28f63
--- /dev/null
+++ b/doc/docbook/chap_solexa_part.xml
@@ -0,0 +1,1995 @@
+<?xml version="1.0" ?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.docbook.org/xml/4.5/docbookx.dtd">
+<chapter id="chap_solexa">
+  <chapterinfo>
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="versionfile"/>
+    <releaseinfo>
+      <emphasis role="light">Document revision $Id$</emphasis>
+    </releaseinfo>
+    <author>
+      <firstname>Bastien</firstname>
+      <surname>Chevreux</surname>
+      <email>bach at chevreux.org</email>
+    </author>
+    <copyright><year>2011</year><holder>Bastien Chevreux</holder></copyright>
+  </chapterinfo>
+  <blockquote>
+    <attribution>Solomon Short</attribution>
+    <para>
+      <emphasis><quote>There is no such thing like overkill.
+      </quote></emphasis>
+    </para>
+  </blockquote>
+  <title>Solexa sequence assembly with MIRA3</title>
+  <para>
+    Notes of caution:
+  </para>
+  <orderedlist>
+    <listitem>
+      <para>
+	this guide is still not finished (and may contain old information
+	regarding read lengths in parts), but is should cover most basic use
+	cases.
+      </para>
+    </listitem>
+    <listitem>
+      <para>
+	you need lots of memory ... ~ 1 to 1.5 GiB per million Solexa reads.
+	Using mira for anything more than 50 to 100 million Solexa reads is
+	probably not a good idea.
+      </para>
+    </listitem>
+  </orderedlist>
+  <para>
+  </para>
+  <sect1 id="sect_sxa_introduction">
+    <title>
+      Introduction
+    </title>
+    <para>
+      This guide assumes that you have basic working knowledge of Unix systems, know
+      the basic principles of sequencing (and sequence assembly) and what assemblers
+      do.
+    </para>
+    <para>
+      While there are step by step instructions on how to setup your Solexa data and
+      then perform an assembly, this guide expects you to read at some point in time
+    </para>
+    <itemizedlist>
+      <listitem>
+	<para>
+	  the <emphasis>MIRA reference manual</emphasis> file to look up some
+	  command line options as well as general information on what tags
+	  MIRA uses in assemblies, files it generates etc.pp
+	</para>
+      </listitem>
+      <listitem>
+	<para>
+	  the <emphasis>short usage introduction</emphasis> to MIRA3 so that
+	  you have a basic knowledge on how to set up projects in mira for
+	  Sanger sequencing projects.
+	</para>
+      </listitem>
+    </itemizedlist>
+    <para>
+    </para>
+  </sect1>
+  <sect1 id="sect_sxa_caveats_when_assembling_solexa_data">
+    <title>
+      Caveats when assembling Solexa data
+    </title>
+    <para>
+      Even very short Solexa reads (< 50bp) are great for mapping assemblies. I
+      simply love them as you can easily spot differences in mutant organisms
+      ... or boost the quality of a newly sequenced genome to Q60.
+    </para>
+    <para>
+      Regarding de-novo assemblies ... well, from an assembler's point of
+      view, very short reads are a catastrophe, regardless of the sequencing
+      technology.
+    </para>
+    <orderedlist>
+      <listitem>
+	<para>
+	  Repeats. The problem of repetitive sequences (e.g. rRNA stretches in
+	  bacteria) gets worse the shorter the read lengths get.
+	</para>
+      </listitem>
+      <listitem>
+	<para>
+	  Amount of data. As mira is by heart an assembler to resolve
+	  difficult repetitive problems as they occur in Sanger and 454 reads, it
+	  drags along quite a lot of ancillary information which is useless in
+	  Solexa assemblies ... but still eats away memory
+	</para>
+      </listitem>
+    </orderedlist>
+    <para>
+    </para>
+    <para>
+      Things look better for the now available 'longer' Solexa reads. Starting
+      with a length of 75bp and paired-end data, de-novo for bacteria is not
+      that bad at all. The first Solexas with a length of ~110 bases are
+      appearing in public, and from a contig building these are about as good
+      for de-novo as the first 454 GS20 reads were.
+    </para>
+    <para>
+      Here's the rule of thumb I use: the longer, the better. If you have to
+      pay a bit more to get longer reads (e.g. Solexa 100mers instead of
+      75mers), go get the longer reads. With these, the results you generate
+      are way(!) better than with 36, 50 or even 75mers ... both in mapping and
+      de-novo. Don't try to save a couple of hundred bucks in sequencing,
+      you'll pay dearly afterwards in assembly.
+    </para>
+  </sect1>
+  <sect1 id="sect_sxa_typical_highlights_and_lowlights_of_solexa_sequencing_data">
+    <title>
+      Typical highlights and lowlights of Solexa sequencing data
+    </title>
+    <para>
+      <emphasis role="bold">Note:</emphasis> This section contains things I've
+      seen in the past and simply jotted down. You may have different
+      observations.
+    </para>
+    <sect2 id="sect_sxa_highlights">
+      <title>
+	Highlights
+      </title>
+      <para>
+      </para>
+      <sect3 id="sect_sxa_highlights_quality">
+	<title>
+	  Quality
+	</title>
+	<para>
+	  For 36mers and the MIRA proposed-end-clipping, even in the old
+	  pipeline I get about 90 to 95% reads matching to a reference without
+	  a single error. For 72mers, the number is approximately 5% lower,
+	  100mers another 5% less. Still, these are great numbers.
+	</para>
+      </sect3>
+      <sect3 id="sect_sxa_highlights_pipeline">
+	<title>
+	  Improved base calling pipeline of Illumina
+	</title>
+	<para>
+	  The new base calling pipeline (1.4 or 2.4?) rolled out by Illumina
+	  in Q1/Q2 2009 typically yields 20-50% more data from the very same
+	  images. Furthermore, the base calling is way better than in the old
+	  pipeline. For Solexa 76 mers, after trimming I get only 1% real
+	  junk, between 85 and 90% of the reads are matching to a reference
+	  without a single error. Of the remaining reads, roughly 50% have one
+	  error, 25% have two errors, 12.5% have three errors etc.
+	</para>
+	<para>
+	  It is worthwhile to re-analyse your old data if the images are
+	  still around.
+	</para>
+      </sect3>
+    </sect2>
+    <sect2 id="sect_sxa_lowlights">
+      <title>
+	Lowlights
+      </title>
+      <para>
+      </para>
+      <sect3 id="sect_sxa_lowlights_longhomopolymers">
+	<title>
+	  Long homopolymers
+	</title>
+	<para>
+	  Long homopolymers (stretches of identical bases in reads) can be a
+	  slight problem for Solexa. However, it must be noted that this is a
+	  problem of all sequencing technologies on the market so far (Sanger,
+	  Solexa, 454). Furthermore, the problem in much less pronounced in
+	  Solexa than in 454 data: in Solexa, first problem appear may appear
+	  in stretches of 9 to 10 bases, in 454 a stretch of 3 to 4 bases may
+	  already start being problematic in some reads.
+	</para>
+      </sect3>
+      <sect3 id="sect_sxa_lowlights_GGCxG_motif">
+	<title>
+	  The GGCxG and GGC motifs
+	</title>
+	<para>
+	  <literal>GGCxG</literal> or even <literal>GGC</literal> motif in the
+	  5' to 3' direction of reads. This one is particularly annoying and
+	  it took me quite a while to circumvent in MIRA the problems it
+	  causes.
+	</para>
+	<para>
+	  Simply put: at some places in a genome, base calling after a
+	  <literal>GGCxG</literal> or <literal>GGC</literal> motif is
+	  particularly error prone, the number of reads without errors
+	  declines markedly. Repeated <literal>GGC</literal> motifs worsen
+	  the situation. The following screenshots of a mapping assembly
+	  illustrate this.
+	</para>
+	<para>
+	  The first example is a the <literal>GGCxG</literal> motif (in form
+	  of a <literal>GGCTG</literal>) occuring in approximately one third
+	  of the reads at the shown position. Note that all but one read
+	  with this problem are in the same (plus) direction.
+	</para>
+	<figure id="sxa_unsc_ggcxg2_lenski.png">
+	  <title>
+	    The Solexa GGCxG problem.
+	  </title>
+	  <mediaobject>
+	    <imageobject>
+	      <imagedata fileref="bookfigures/sxa_unsc_ggcxg2_lenski.png" width="90%"/>
+	    </imageobject>
+	  </mediaobject>
+	</figure>  
+	<para>
+	  The next two screenshots show the <literal>GGC</literal>, once for
+	  forward direction and one with reverse direction reads:
+	</para>
+	<figure id="sxa_unsc_ggc1_lenski.png">
+	  <title>
+	    The Solexa GGC problem, forward example
+	  </title>
+	  <mediaobject>
+	    <imageobject>
+	      <imagedata fileref="bookfigures/sxa_unsc_ggc1_lenski.png" width="90%"/>
+	    </imageobject>
+	  </mediaobject>
+	</figure>  
+	<figure id="sxa_unsc_ggc4_lenski.png">
+	  <title>
+	    The Solexa GGC problem, reverse example
+	  </title>
+	  <mediaobject>
+	    <imageobject>
+	      <imagedata fileref="bookfigures/sxa_unsc_ggc4_lenski.png" width="90%"/>
+	    </imageobject>
+	  </mediaobject>
+	</figure>  
+	<para>
+	  Places in the genome that have <literal>GGCGGC.....GCCGCC</literal>
+	  (a motif, perhaps even repeated, then some bases and then an
+	  inverted motif) almost always have very, very low number of good
+	  reads. Especially when the motif is <literal>GGCxG</literal>.
+	</para>
+	<para>
+	  Things get especially difficult when these motifs occur at sites
+	  where users may have a genuine interest. The following example is a
+	  screenshot from the Lenski data (see walk-through below) where a
+	  simple mapping reveals an anomaly which -- in reality -- is an IS
+	  insertion (see <ulink
+	  url="http://www.nature.com/nature/journal/v461/n7268/fig_tab/nature08480_F1.html"/>)
+	  but could also look like a <literal>GGCxG</literal> motif in forward
+	  direction (<literal>GGCCG</literal>) and at the same time a
+	  <literal>GGC</literal> motif in reverse direction:
+	</para>
+	<figure id="sxa_xmastree_lenski2.png">
+	  <title>
+	    A genuine place of interest almost masked by the
+	    <literal>GGCxG</literal> problem.
+	  </title>
+	  <mediaobject>
+	    <imageobject>
+	      <imagedata fileref="bookfigures/sxa_xmastree_lenski2.png" width="90%"/>
+	    </imageobject>
+	  </mediaobject>
+	</figure>  
+      </sect3>
+      <sect3 id="sect_sxa_lowlights_gcbias">
+	<title>
+	  Strong GC bias in some Solexa data (2nd half 2009 until advent of TruSeq kit at end of 2010)
+	</title>
+      </sect3>
+      <para>
+	Here I'm recycling a few slides from a couple of talks I held in 2010.
+      </para>
+      <para>
+	Things used to be so nice and easy with the early Solexa data I worked
+	with (36 and 44mers) in late 2007 / early 2008. When sample taking was
+	done right -- e.g. for bacteria: in stationary phase -- and the
+	sequencing lab did a good job, the read coverage of the genome was
+	almost even. I did see a few papers claiming to see non-trivial GC
+	bias back then, but after having analysed the data I worked with I
+	dismissed them as "not relevant for my use cases." Have a look at the
+	following figure showing exemplarily the coverage of a 45% GC
+	bacterium in 2008:
+      </para>
+      <figure id="sxa_gcbias_nobias2008.png">
+	<titleabbrev>
+	  Example for no GC coverage bias in 2008 Solexa data.
+	</titleabbrev>
+	<title>
+	  Example for no GC coverage bias in 2008 Solexa data. Apart from a
+	  slight <emphasis>smile shape</emphasis> of the coverage --
+	  indicating the sample taking was not 100% in stationary phase of the
+	  bacterial culture -- everything looks pretty nice: the average
+	  coverage is at 27x, and when looking at potential genome
+	  duplications at twice the coverage (54x), there's nothing apart a
+	  single peak (which turned out to be a problem in a rRNA region).
+	</title>
+	<mediaobject>
+	  <imageobject>
+	    <imagedata fileref="bookfigures/sxa_gcbias_nobias2008.png" width="90%"/>
+	  </imageobject>
+	</mediaobject>
+      </figure>  
+      <para>
+	Things changed starting somewhen in Q3 2009, at least that's when I
+	got some data which made me notice a problem. Have a look at the
+	following figure which shows exactly the same organism as in the
+	figure above (bacterium, 45% GC):
+      </para>
+      <figure id="sxa_gcbias_bias2009.png">
+	<titleabbrev>
+	  Example for GC coverage bias starting Q3 2009 in Solexa data.
+	</titleabbrev>
+	<title>
+	  Example for GC coverage bias starting Q3 2009 in Solexa
+	  data. There's no <emphasis>smile shape</emphasis> anymore -- the
+	  people in the lab learned to pay attention to sample in 100%
+	  stationary phase -- but something else is extremely disconcerting:
+	  the average coverage is at 33x, and when looking at potential genome
+	  duplications at twice the coverage (66x), there are several dozen
+	  peaks crossing the 66x threshold over a several kilobases (in one
+	  case over 200 Kb) all over the genome. As if several small genome
+	  duplications happened.
+	</title>
+	<mediaobject>
+	  <imageobject>
+	    <imagedata fileref="bookfigures/sxa_gcbias_bias2009.png" width="90%"/>
+	  </imageobject>
+	</mediaobject>
+      </figure>  
+      <para>
+	By the way, the figures above are just examples: I saw over a dozen
+	sequencing projects in 2008 without GC bias and several dozen in 2009
+	/ 2010 with GC bias.
+      </para>
+      <para>
+	Checking the potential genome duplication sites, they all looked
+	"clean", i.e., the typical genome insertion markers are
+	missing. Poking around at possible explanations, I looked at GC
+	content of those parts in the genome ... and there was the
+	explanation:
+      </para>
+      <figure id="sxa_gcbias_comp20082009.png">
+	<titleabbrev>
+	  Example for GC coverage bias, direct comparison 2008 / 2010 data.
+	</titleabbrev>
+	<title>
+	  Example for GC coverage bias, direct comparison 2008 / 2010
+	  data. The bug has 45% average GC, areas with above average read
+	  coverage in 2010 data turn out to be lower GC: around 33 to 36%. The
+	  effect is also noticeable in the 2008 data, but barely so.
+	</title>
+	<mediaobject>
+	  <imageobject>
+	    <imagedata fileref="bookfigures/sxa_gcbias_comp20082009.png" width="90%"/>
+	  </imageobject>
+	</mediaobject>
+      </figure>  
+      <para>
+	Now as to actually <emphasis>why</emphasis> the GC bias suddenly
+	became so strong is unknown to me. The people in the lab use the same
+	protocol since several years to extract the DNA and the sequencing
+	providers claim to always use the Illumina standard protocols.
+      </para>
+      <para>
+	But obviously something must have changed. Current ideas about possoble reasons include
+      </para>
+      <itemizedlist>
+	<listitem>
+	  changed chemistries from Illumina leading perhaps to bias during DNA amplification
+	</listitem>
+	<listitem>
+	  changed "standard" protocols
+	</listitem>
+	<listitem>
+	  other ...
+	</listitem>
+      </itemizedlist>
+      <para>
+	It took Illumina some 18 months to resolve that problem for the
+	broader public: since data I work on were done with the TruSeq kit,
+	this problem has vanished.
+      </para>
+      <para>
+	However, if you based some conclusions or wrote a paper with Illumina
+	data which might be affected by the GC bias (Q3 2009 to Q4 2010), I
+	suggest you rethink all the conclusion drawn. This should be
+	especially the case for transcriptomics experiments where a difference
+	in expression of 2x to 3x starts to get highly significant!
+      </para>
+    </sect2>
+  </sect1>
+  <sect1 id="sect_sxa_mapping_assemblies">
+    <title>
+      Mapping assemblies
+    </title>
+    <para>
+      <!--%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%-->
+    </para>
+    <para>
+      This part will introduce you step by step how to get your data together for a
+      simple mapping assembly.
+    </para>
+    <para>
+      I'll make up an example using an imaginary bacterium: <emphasis>Bacillus chocorafoliensis</emphasis> (or short: <emphasis>Bchoc</emphasis>).
+    </para>
+    <para>
+      In this example, we assume you have two strains: a wild type strain of
+      <emphasis>Bchoc_wt</emphasis> and a mutant which you perhaps got from mutagenesis or other
+      means. Let's imagine that this mutant needs more time to eliminate a given
+      amount of chocolate, so we call the mutant <emphasis>Bchoc_se</emphasis> ... SE for
+      <emphasis role="bold">s</emphasis>low <emphasis role="bold">e</emphasis>ater
+    </para>
+    <para>
+      You wanted to know which mutations might be responsible for the observed
+      behaviour. Assume the genome of <emphasis>Bchoc_wt</emphasis> is available to you as it was
+      published (or you previously sequenced it), so you resequenced <emphasis>Bchoc_se</emphasis>
+      with Solexa to examine mutations.
+    </para>
+    <sect2 id="sect_sxa_copying_and_naming_the_sequence_data">
+      <title>
+	Copying and naming the sequence data
+      </title>
+      <para>
+	You need to create (or get from your sequencing provider) the sequencing data
+	in either FASTQ or FASTA + FASTA quality format. The following walkthrough
+	uses what most people nowadays get: FASTQ.
+      </para>
+      <para>
+	Put the FASTQ data into an empty directory and rename the file so that it looks
+	like this:
+      </para>
+      <screen>
+<prompt>arcadia:/path/to/myProject$</prompt> <userinput>ls -l</userinput>
+-rw-r--r-- 1 bach users 263985896 2008-03-28 21:49 bchocse_in.solexa.fastq</screen>
+    </sect2>
+    <sect2 id="sect_sxa_copying_and_naming_the_reference_sequence">
+      <title>
+	Copying and naming the reference sequence
+      </title>
+      <para>
+	The reference sequence (the backbone) can be in a number of different
+	formats: FASTA, GenBank, CAF. The later two have the advantage of
+	being able to carry additional information like, e.g., annotation. In
+	this example, we will use a GenBank file like the ones one can
+	download from the NCBI. So, let's assume that our wild type strain is
+	in the following file: <filename>NC_someNCBInumber.gbk</filename>. Copy this
+	file to the directory (you may also set a link), renaming it as
+	<filename>bchocse_backbone_in.gbf</filename>.
+      </para>
+      <screen>
+<prompt>arcadia:/path/to/myProject$</prompt> <userinput>cp /somewhere/NC_someNCBInumber.gbk bchocse_backbone_in.gbf</userinput>
+<prompt>arcadia:/path/to/myProject$</prompt> <userinput>ls -l</userinput>
+-rw-r--r-- 1 bach users   6543511 2008-04-08 23:53 bchocse_backbone_in.gbf
+-rw-r--r-- 1 bach users 263985896 2008-03-28 21:49 bchocse_in.solexa.fastq</screen>
+    </sect2>
+    <sect2 id="sect_sxa_starting_a_mapping_assembly:_unpaired_data">
+      <title>
+	Starting a mapping assembly: unpaired data
+      </title>
+      <para>
+	Starting the assembly is now just a matter of a simple command line with some
+	parameters set correctly. The following is an example of what I use when
+	mapping onto a reference sequence in GenBank format: 
+      </para>
+      <screen>
+<prompt>arcadia:/path/to/myProject$</prompt> <userinput>mira
+  --project=bchocse --job=mapping,genome,accurate,solexa
+  -AS:nop=1
+  -SB:bsn=bchoc_wt:bft=gbf:bbq=30
+  SOLEXA_SETTINGS
+  -SB:ads=yes:dsn=bchocse
+  >&log_assembly.txt</userinput></screen>
+      <note>
+	<title>Note 1</title>
+	<para>
+	  The above command has been split in multiple lines for better
+	  overview but should be entered in one line.
+	</para>
+      </note>
+      <note>
+	<title>Note 2</title>
+	<para>
+	  Please look up the parameters used in the main manual. The ones
+	  above basically say: make an accurate mapping of Solexa reads
+	  against a genome; in one pass; the name of the backbone strain is
+	  'bchoc_wt'; the file type containing backbone is a GenBank file; the
+	  base qualities for the backbone are to be assumed Q30; for Solexa
+	  data: assign default strain names for reads which have not loaded
+	  ancilarry data with strain info and that default strain name should
+	  be 'bchocse'.
+	</para>
+      </note>
+      <note>
+	<title>Note 3</title>
+	<para>
+	  For a bacterial project having a backbone of ~4 megabases and with
+	  ~4.5 million Solexa 36mers, MIRA needs some ~21 minutes on my
+	  development machine.
+	</para>
+	<para>
+	  A yeast project with a genome of ~20 megabases and ~20 million 36mers
+	  needs 3.5 hours and 28 GiB RAM.
+	</para>
+      </note>
+      <para>
+	For this example - if you followed the walk-through on how to prepare the data
+	- everything you might want to adapt in the first time are the following
+	options:
+      </para>
+      <itemizedlist>
+	<listitem>
+	  <para>
+	    -project (for naming your assembly project)
+	  </para>
+	</listitem>
+	<listitem>
+	  <para>
+	    -SB:bsn to give the backbone strain (your reference strain) another name
+	  </para>
+	</listitem>
+	<listitem>
+	  <para>
+	    -SB:bft to load the backbone sequence from another file type, say, a
+	    FASTA
+	  </para>
+	</listitem>
+	<listitem>
+	  <para>
+	    -SB:dsn to give a the Solexa reads another strain name
+	  </para>
+	</listitem>
+      </itemizedlist>
+      <para>
+	Of course, you are free to change any option via the extended parameters, but
+	this will be the topic of another FAQ.
+      </para>
+    </sect2>
+    <sect2 id="sect_sxa_assembling_with_multiple_strains">
+      <title>
+	Assembling with multiple strains
+      </title>
+      <para>
+	MIRA will make use of ancillary information when present. The
+	<emphasis role="bold">strain</emphasis> <emphasis
+	role="bold">name</emphasis> is such an ancillary information. That is,
+	we can tell MIRA the strain of each read we use in the assembly. In
+	the example above, this information was given on the command line as
+	all the reads to be mapped had the same strain information. But what
+	to do if one wants to map reads from several strains?
+      </para>
+      <para>
+	We could generate a TRACEINFO XML file with all bells and whistles,
+	but for strain data there's an easier way: the
+	<filename>straindata</filename> file. It's a simple key-value file,
+	one line per entry, with the name of the read as key (first entry in
+	line) and, separated by a blank the name of the strain as value
+	(second entry in line).  E.g.:
+      </para>
+      <screen>
+1_1_207_113 strain1
+1_1_61_711  strain1
+1_1_182_374 strain2
+...
+2_1_13_654 strain2
+...</screen>
+      <para>
+	Etcetera. You will obviously replace 'strain1' and 'strain2' with your
+	strain names.
+      </para>
+      <para>
+	This file can be quickly generated automatically, using the extracted
+	names from FASTQ files and rewritten a little bit. Here's how:
+      </para>
+      <screen>
+<prompt>arcadia:/path/to/myProject$</prompt> <userinput>ls -l</userinput>
+-rw-r--r-- 1 bach users 494282343 2008-03-28 22:11 bchocse_in.solexa.fastq
+
+<prompt>arcadia:/path/to/myProject$</prompt> <userinput>grep "^@" bchocse_in.solexa.fastq 
+  | sed -e 's/@//' 
+  | cut -f 1
+  | cut -f 1 -d ' '
+  |  sed -e 's/$/ bchocse/'
+  > bchocse_straindata_in.txt</userinput>
+
+<prompt>arcadia:/path/to/myProject$</prompt> <userinput>ls -l</userinput>
+-rw-r--r-- 1 bach users 494282343 2008-03-28 22:11 bchocse_in.solexa.fastq
+-rw-r--r-- 1 bach users 134822451 2008-03-28 22:13 bchocse_straindata_in.txt</screen>
+      <note>
+	<title>Note 1</title>
+	<para>
+	  The above command has been split in multiple lines for better
+	  overview but should be entered in one line.
+	</para>
+      </note>
+      <note>
+	<title>Note 2</title>
+	<para>
+	  for larger files, this can run a minute or two.
+	</para>
+      </note>
+      <note>
+	<title>Note 3</title>
+	<para>
+	  As you can also assemble sequences from more that one strain, the
+	  read names in <filename>bchocse_straindata_in.txt</filename> can
+	  have different strain names attached to them. You will then need to
+	  generate one straindata file from multiple FASTQ files.
+	</para>
+      </note>
+      <para>
+	This creates the needed data in the file
+	<filename>bchocse_straindata_in.txt</filename> (well, it's one way to
+	do it, feel free to use whatever suits you best).
+      </para>
+    </sect2>
+    <sect2 id="sect_sxa_starting_a_mapping_assembly:_pairedend_data">
+      <title>
+	Starting a mapping assembly: paired-end data
+      </title>
+      <para>
+	When using paired-end data, you must decide whether you want 
+      </para>
+      <orderedlist>
+	<listitem>
+	  <para>
+	    use the MIRA feature to create long 'coverage equivalent reads'
+	    (CERs) which saves a lot of memory (both in the assembler and
+	    later on in an assembly editor). However, you then
+	    <emphasis>loose</emphasis> <emphasis>paired-end</emphasis>
+	    <emphasis>information!</emphasis>
+	  </para>
+	</listitem>
+	<listitem>
+	  <para>
+	    or whether you want to <emphasis>keep</emphasis> <emphasis>paired-end</emphasis>
+	    <emphasis>information!</emphasis> at the expense of larger memory requirements both in MIRA
+	    and in assembly editors afterwards.
+	  </para>
+	</listitem>
+      </orderedlist>
+      <para>
+	The Illumina pipeline generally gives you two files for paired-end
+	data: a <filename>project-1.fastq</filename> and
+	<filename>project-2.fastq</filename>. The first file containing the
+	first read of a read-pair, the second file the second read. Depending
+	on the preprocessing pipeline of your sequencing provider, the names
+	of the reads can be either the very same in both files or already have
+	a <literal>/1</literal> or <literal>/2</literal> appended.
+      </para>
+      <note>
+	For running MIRA, you <emphasis>must</emphasis> concatenate all
+	sequence input files into one file.
+      </note>
+      <para>
+	If the read names do not follow the <literal>/1/2</literal> scheme,
+	you must obviously rename them in the process. A ltlle
+	<command>sed</command> command can do this automatically for
+	you. Assuming your reads all have the prefix <literal>SRR_something_</literal>
+	the following line appends <literal>/1</literal> to all lines which
+	begin with <literal>@SRR_something_</literal>
+      </para>
+      <screen>
+<prompt>arcadia:/path/to/myProject$</prompt> <userinput>sed -e 's/^@SRR_something_/&\/1/' input.fastq >output.fastq</userinput></screen>
+      <para>
+	If you don't care about the paired-end information, you can start the mapping
+	assembly exactly like an assembly for data without paired-end info (see
+	section above).
+      </para>
+      <para>
+	In case you want to keep the paired-end information, here's the command line
+	(again an example when mapping against a GenBank reference file, assuming that
+	the library insert size is ~500 bases):
+      </para>
+      <screen>
+<prompt>arcadia:/path/to/myProject$</prompt> <userinput>mira 
+  --project=bchocse --job=mapping,genome,accurate,solexa
+  -AS:nop=1
+  -SB:lsd=yes:bsn=bchoc_wt:bft=gbf:bbq=30
+  SOLEXA_SETTINGS 
+  -CO:msr=no -GE:uti=no:tismin=250:tismax=750 
+  -SB:ads=yes:dsn=bchocse
+  >&log_assembly.txt</userinput></screen>
+      <note>
+	<title>Note 1</title>
+	<para>
+	  For this example to work, make sure that the read pairs are named
+	  using the Solexa standard, i.e., having '/1' as postfix to the name
+	  of one read and '/2' for the other read. If yours have a different
+	  naming scheme, look up the -LR:rns parameter in the main
+	  documentation.
+	</para>
+      </note>
+      <note>
+	<title>Note 2</title>
+	<para>
+	  Please look up the parameters used in the main manual. The ones
+	  above basically say: make an accurate mapping of Solexa reads
+	  against a genome, in one pass, load additional strain data, the name
+	  of the backbone is 'bchoc_wt', the file type containing backbone is
+	  a GenBank file, the base qualities for the backbone are to assumed
+	  Q30. Additionally, only for Solexa reads, do not merge short reads
+	  to the contig, use template size information and set minimum and
+	  maximum expected distance to 250 and 750 respectively.
+	</para>
+      </note>
+      <note>
+	<title>Note 3</title>
+	<para>
+	  You will want to use other values than 250 and 750 if your Solexa
+	  paired-end library was not with insert sizes of approximately 500
+	  bases.
+	</para>
+      </note>
+      <para>
+	Comparing this command line with a command line for unpaired-data, two
+	parameters were added in the section for Solexa data:
+      </para>
+      <orderedlist>
+	<listitem>
+	  <para>
+	    <literal>-CO:msr=no</literal> tells MIRA not to merge reads that
+	    are 100% identical to the backbone. This also allows to keep the
+	    template information for the reads.
+	  </para>
+	</listitem>
+	<listitem>
+	  <para>
+	    <literal>-GE:uti=no</literal> actually switches
+	    <emphasis>off</emphasis> checking of template sizes when inserting
+	    reads into the backbone. At first glance this might seem
+	    counter-intuitive, but it's absolutely necessary to spot, e.g.,
+	    genome re-arrangements or indels in data analysis after the
+	    assembly.
+	  </para>
+	  <para>
+	    The reason is that if template size checking were on, the following would
+	    happen at, e.g. sites of re-arrangement: MIRA would map the first read of
+	    a read-pair without problem. However, it would very probably reject the
+	    second read because it would not map at the specified distance from its
+	    partner. Therefore, in mapping assemblies with paired-end data, checking of
+	    the template size must be switched off.
+	  </para>
+	</listitem>
+	<listitem>
+	  <para>
+	    <literal>-GE:tismin:tismax</literal> were set to give the maximum
+	    and minimum distance paired-end reads may be away from each
+	    other. Though the information is not used by MIRA in the assembly
+	    itself, the information is stored in result files and can be used
+	    afterwards by analysis programs which search for genome
+	    re-arrangements.
+	  </para>
+	</listitem>
+      </orderedlist>
+      <para>
+      </para>
+      <para>
+	<emphasis role="bold">Note:</emphasis> for other influencing factors
+	you might want to change depending on size of Solexa reads, see
+	section above on mapping of unpaired data.
+      </para>
+    </sect2>
+    <sect2 id="sect_sxa_places_of_interest_in_a_mapping_assembly">
+      <title>
+	Places of interest in a mapping assembly
+      </title>
+      <para>
+	This section just give a short overview on the tags you might find
+	interesting. For more information, especially on how to configure gap4
+	or consed, please consult the <emphasis>mira usage</emphasis> document
+	and the <emphasis>mira</emphasis> manual.
+      </para>
+      <para>
+	In file types that allow tags (CAF, MAF, ACE), SNPs and other
+	interesting features will be marked by MIRA with a number of tags. The
+	following sections give a brief overview. For a description of what
+	the tags are (SROc, WRMc etc.), please read up the section "Tags used
+	in the assembly by MIRA and EdIt" in the main manual.
+      </para>
+      <note>
+	Screenshots in this section are taken from the walk-through with
+	Lenski data (see below).
+      </note>
+      <sect3 id="sect_sxa_where_are_snps?">
+	<title>
+	  Where are SNPs?
+	</title>
+	<itemizedlist>
+	  <listitem>
+	    <para>
+	      the <emphasis role="bold">SROc</emphasis> tag will point to most
+	      SNPs. Should you assemble sequences of more than one strain (I
+	      cannot really recommend such a strategy), you also might
+	      encounter <emphasis role="bold">SIOc</emphasis> and <emphasis
+	      role="bold">SAOc</emphasis> tags.
+	    </para>
+	    <figure id="chap_sol::sxa_sroc_lenski1.png">
+	      <title>
+		"SROc" tag showing a SNP position in a Solexa mapping
+		assembly.
+	      </title>
+	      <mediaobject>
+		<imageobject>
+		  <imagedata fileref="bookfigures/sxa_sroc_lenski1.png" width="90%"/>
+		</imageobject>
+	      </mediaobject>
+	    </figure>  
+	    <figure id="chap_sol::sxa_sroc_lenski2.png">
+	      <title>
+		"SROc" tag showing a SNP/indel position in a Solexa mapping
+		assembly.
+	      </title>
+	      <mediaobject>
+		<imageobject>
+		  <imagedata fileref="bookfigures/sxa_sroc_lenski2.png" width="90%"/>
+		</imageobject>
+	      </mediaobject>
+	    </figure>  
+	  </listitem>
+	  <listitem>
+	    <para>
+	      the <emphasis role="bold">WRMc</emphasis> tags might sometimes
+	      point SNPs to indels of one or two bases.
+	    </para>
+	  </listitem>
+	</itemizedlist>
+	<para>
+	</para>
+      </sect3>
+      <sect3 id="sect_sxa_where_are_insertions_deletions_or_genome_rearrangements?">
+	<title>
+	  Where are insertions, deletions or genome re-arrangements?
+	</title>
+	<itemizedlist>
+	  <listitem>
+	    <para>
+	      Large deletions: the <emphasis role="bold">MCVc</emphasis> tags
+	      point to deletions in the resequenced data, where no read is
+	      covering the reference genome.
+	    </para>
+	    <figure id="chap_sol::sxa_mcvc_lenski.png">
+	      <title>
+		"MCVc" tag (dark red stretch in figure) showing a genome
+		deletion in Solexa mapping assembly.
+	      </title>
+	      <mediaobject>
+		<imageobject>
+		  <imagedata fileref="bookfigures/sxa_mcvc_lenski.png" width="90%"/>
+		</imageobject>
+	      </mediaobject>
+	    </figure>  
+	  </listitem>
+	  <listitem>
+	    <para>
+	      Insertions, small deletions and re-arrangements: these are
+	      harder to spot. In unpaired data sets they can be found looking
+	      at clusters of <emphasis role="bold">SROc</emphasis>, <emphasis
+	      role="bold">SRMc</emphasis>, <emphasis
+	      role="bold">WRMc</emphasis>, and / or <emphasis
+	      role="bold">UNSc</emphasis> tags.
+	    </para>
+	    <figure id="chap_sol::sxa_wrmcsrmc_hiding_lenski1.png">
+	      <title>
+		An IS150 insertion hiding behind a WRMc and a SRMc tags
+	      </title>
+	      <mediaobject>
+		<imageobject>
+		  <imagedata fileref="bookfigures/sxa_wrmcsrmc_hiding_lenski1.png" width="90%"/>
+		</imageobject>
+	      </mediaobject>
+	    </figure>  
+	    <para>
+	      more massive occurences of these tags lead to a rather colourful
+	      display in finishing programs, which is why these clusters are
+	      also sometimes called Xmas-trees.
+	    </para>
+	    <figure id="chap_sol::sxa_xmastree_lenski1.png">
+	      <title>
+		A 16 base pair deletion leading to a SROc/UNsC xmas-tree
+	      </title>
+	      <mediaobject>
+		<imageobject>
+		  <imagedata fileref="bookfigures/sxa_xmastree_lenski1.png" width="90%"/>
+		</imageobject>
+	      </mediaobject>
+	    </figure>  
+	    <figure id="chap_sol::sxa_xmastree_lenski2.png">
+	      <title>
+		An IS186 insertion leading to a SROc/UNsC xmas-tree
+	      </title>
+	      <mediaobject>
+		<imageobject>
+		  <imagedata fileref="bookfigures/sxa_xmastree_lenski2.png" width="90%"/>
+		</imageobject>
+	      </mediaobject>
+	    </figure>  
+	    <para> 
+	      In sets with paired-end data, post-processing software (or
+	      alignment viewers) can use the read-pair information to guide
+	      you to these sites (MIRA doesn't set tags at the moment).
+	    </para>
+	  </listitem>
+	</itemizedlist>
+	<para>
+	</para>
+      </sect3>
+      <sect3 id="sect_sxa_other_tags_of_interest">
+	<title>
+	  Other tags of interest
+	</title>
+	<itemizedlist>
+	  <listitem>
+	    <para>
+	      the <emphasis role="bold">UNSc</emphasis> tag points to areas
+	      where the consensus algorithm had troubles choosing a base. This
+	      happens in low coverage areas, at places of insertions (compared
+	      to the reference genome) or sometimes also in places where
+	      repeats with a few bases difference are present. Often enough,
+	      these tags are in areas with problematic sequences for the
+	      Solexa sequencing technology like, e.g., a
+	      <literal>GGCxG</literal> or even <literal>GGC</literal> motif in
+	      the reads.
+	    </para>
+	  </listitem>
+	  <listitem>
+	    <para>
+	      the <emphasis role="bold">SRMc</emphasis> tag points to places
+	      where repeats with a few bases difference are present. Here too,
+	      sequence problematic for the Solexa technology are likely to
+	      have cause base calling errors and subsequently setting of this
+	      tag.
+	    </para>
+	  </listitem>
+	</itemizedlist>
+	<para>
+	</para>
+      </sect3>
+      <sect3 id="sect_sxa_comprehensive_spreadsheet_tables_for_excel_or_oocalc">
+	<title>
+	  Comprehensive spreadsheet tables (for Excel or OOcalc)
+	</title>
+	<para>
+	  Biologists are not really interested in SNPs coordinates, and why
+	  should they? They're more interested where SNPs are, how good they
+	  are, which genes or other elements they hit, whether they have an
+	  effect on a protein sequence, whether they may be important etc. For
+	  organisms without intron/exon structure or splice variants, MIRA can
+	  generate pretty comprehensive tables and files if an annotated
+	  GenBank file was used as reference and strain information was given
+	  to MIRA during the assembly.
+	</para>
+	<para>
+	  Well, MIRA does all that automatically for you if the reference
+	  sequence you gave was annotated.
+	</para>
+	<para>
+	  For this, <command>convert_project</command> should be used with the
+	  <emphasis>asnp</emphasis> format as target and a CAF file as input:
+	</para>
+	<screen>
+<prompt>$</prompt> <userinput>convert_project -f caf -t asnp <replaceable>input.caf output</replaceable></userinput></screen>
+	<para>
+	  Note that it is strongly suggested to perform a quick manual cleanup
+	  of the assembly prior to this: for rare cases (mainly at site of
+	  small indels of one or two bases), mira will not tag SNPs with a SNP
+	  tag (SROc, SAOc or SIOc) but will be fooled into a tag denoting
+	  unsure positions (UNSc). This can be quickly corrected manually. See
+	  further down in this manual in the section on post-processing.
+	</para>
+	<para>
+	  After conversion, you will have four files in the directory which
+	  you can all drag-and-drop into spreadsheet applications like
+	  OpenOffice Calc or Excel.
+	</para>
+	<para>
+	  The files should be pretty self-explanatory, here's just a short overview:
+	</para>
+	<orderedlist>
+	  <listitem>
+	    <para>
+	      <filename>output_info_snplist.txt</filename> is a simple list of
+	      the SNPs, with their positions compared to the reference
+	      sequence (in bases and map degrees on the genome) as well as the
+	      GenBank features they hit.
+	    </para>
+	  </listitem>
+	  <listitem>
+	    <para>
+	      <filename>output_info_featureanalysis.txt</filename> is a much
+	      extended version of the list above. It puts the SNPs into
+	      context of the features (proteins, genes, RNAs etc.) and gives a
+	      nice list, SNP by SNP, what might cause bigger changes in
+	      proteins.
+	    </para>
+	  </listitem>
+	  <listitem>
+	    <para>
+	      <filename>output_info_featuresummary.txt</filename> looks at the
+	      changes (SNPs, indels) from the other way round. It gives an
+	      excellent overview which features (genes, proteins, RNAs,
+	      intergenic regions) you should investigate.
+	    </para>
+	    <para>
+	      There's one column (named 'interesting') which pretty much
+	      summarises up everything you need into three categories: yes,
+	      no, and perhaps. 'Yes' is set if indels were detected, an amino
+	      acid changed, start or stop codon changed or for SNPs in
+	      intergenic regions and RNAs. 'Perhaps' is set for SNPs in
+	      proteins that change a codon, but not an amino acid (silent
+	      SNPs). 'No' is set if no SNP is hitting a feature.
+	    </para>
+	  </listitem>
+	  <listitem>
+	    <para>
+	      <filename>output_info_featuresequences.txt</filename> simply
+	      gives the sequences of each feature of the reference sequence
+	      and the resequenced strain.
+	    </para>
+	  </listitem>
+	</orderedlist>
+	<para>
+	</para>
+      </sect3>
+      <sect3 id="sect_sxa_html_files_depicting_snp_positions_and_deletions">
+	<title>
+	  HTML files depicting SNP positions and deletions
+	</title>
+	<para>
+	  I've come to realise that people who don't handle data from NextGen
+	  sequencing technologies on a regular basis (e.g., many biologists)
+	  don't want to be bothered with learning to handle specialised
+	  programs to have a look at their resequenced strains. Be it because
+	  they don't have time to learn how to use a new program or because
+	  their desktop is not strong enough (CPU, memory) to handle the data
+	  sets.
+	</para>
+	<para>
+	  Something even biologist know to operate are browsers. Therefore,
+	  convert_project has the option to load a CAF file of a mapping
+	  assembly at output to HTML those areas which are interesting to
+	  biologists. It uses the tags SROc, SAOc, SIOc and MCVc and outputs
+	  the surrounding alignment of these areas together with a nice
+	  overview and links to jump from one position to the previous or
+	  next.
+	</para>
+	<para>
+	  This is done with the '-t hsnp' option of convert_project:
+	</para>
+	<screen>
+<prompt>$</prompt> <userinput>convert_project -f caf -t hsnp <replaceable>input.caf output</replaceable></userinput></screen>
+	<para>
+	  <emphasis role="bold">Note:</emphasis> I recommend doing this only
+	  if the resequenced strain is a very close relative to the reference
+	  genome, else the HTML gets pretty big. But for a couple of hundred
+	  SNPs it works great.
+	</para>
+      </sect3>
+      <sect3 id="sect_sxa_wig_files_depicting_contig_coverage">
+	<title>
+	  WIG files depicting contig coverage
+	</title>
+	<para>
+	  <command>convert_project</command> can also dump a coverage file in
+	  WIG format (using '-t wig'). This comes pretty handy for searching
+	  genome deletions or duplications in programs like the Affymetrix
+	  Integrated Genome Browser (IGB, see <ulink
+	  url="http://igb.bioviz.org/"/>).
+	</para>
+      </sect3>
+    </sect2>
+    <sect2 id="sect_sxa_walkthrough:_mapping_of_ecoli_from_lenski_lab_against_ecoli_b_rel606">
+      <title>
+	Walkthrough: mapping of E.coli from Lenski lab against E.coli B REL606
+      </title>
+      <para>
+	We're going to use data published by Richard Lenski in his great paper
+	<emphasis>"Genome evolution and adaptation in a long-term experiment
+	with Escherichia coli"</emphasis>. This shows how MIRA finds all
+	mutations between two strains and how one would need just a few
+	minutes to know which genes are affected.
+      </para>
+      <note>
+	All steps described in this walkthrough are present in ready-to-be-run
+	scripts in the <literal>solexa3_lenski</literal> demo directory of the
+	MIRA package.
+      </note>
+      <note>
+	This walkthrough takes a few detours which are not really necessary,
+	but show how things can be done: it reduces the number of reads, it
+	creates a strain data file etc. Actually, the whole demo could be
+	reduced to two steps: downloading the data (naming it correctly) and
+	starting the assembly with a couple of parameters.
+      </note>
+      <sect3 id="sect_sxa_getting_the_data">
+	<title>
+	  Getting the data
+	</title>
+	<para>
+	  We'll use the reference genome E.coli B REL606 to map one of the
+	  strains from the paper. For mapping, I picked strain REL8593A more
+	  or less at random. All the data needed is fortunately at the NCBI,
+	  let's go and grab it:
+	</para>
+	<orderedlist>
+	  <listitem>
+	    <para>
+	      the NCBI has REL606 named <emphasis>NC_012967</emphasis>. We'll
+	      use the RefSeq version and the GenBank formatted file you can
+	      download from
+	      <ulink url="ftp://ftp.ncbi.nih.gov/genomes/Bacteria/Escherichia_coli_B_REL606/NC_012967.gbk"/>
+	    </para>
+	  </listitem>
+	  <listitem>
+	    <para>
+	      the Solexa re-sequencing data you can get from <ulink
+	      url="ftp://ftp.ncbi.nlm.nih.gov/sra/static/SRX012/SRX012992/"/>. Download
+	      both FASTQ files, <filename>SRR030257_1.fastq.gz</filename> and
+	      <filename>SRR030257_2.fastq.gz</filename>.
+	    </para>
+	    <para> 
+	      If you want more info regarding these data sets, have a look at
+	    <ulink url="http://www.ncbi.nlm.nih.gov/sra/?db=sra&term=SRX012992&report=full"/>
+	    </para>
+	  </listitem>
+	</orderedlist>
+	<para>
+	</para>
+      </sect3>
+      <sect3 id="sect_sxa_preparing_the_data_for_an_assembly">
+	<title>
+	  Preparing the data for an assembly
+	</title>
+	<para>
+	  In this section we will setup the directory structure for the
+	  assembly and pre-process the data so that MIRA can start right away.
+	</para>
+	<para>
+	  Let's start with setting up a directory structure. Remember: you can
+	  setup the data almost any way you like, this is just how I do
+	  things.
+	</para>
+	<para>
+	  I normally create a project directory with three sub-directories:
+	  <filename>origdata</filename>, <filename>data</filename>, and
+	  <filename>assemblies</filename>. In <filename>origdata</filename> I
+	  put the files exactly as I got them from the sequencing or data
+	  provider, without touching them and even remowing write permissions
+	  to these files so that they cannot be tampered with. After that, I
+	  pre-process them and put the pre-processed files into
+	  <filename>data</filename>. Pre-processing can be a lot of things,
+	  starting from having to re-format the sequences, or renaming them,
+	  perhaps also doing clips etc. Finally, I use these pre-processed
+	  data in one or more assembly runs in the
+	  <filename>assemblies</filename> directory, perhaps trying out
+	  different assembly options.
+	</para>
+	<screen>
+<prompt>arcadia:/some/path/$</prompt> <userinput>mkdir lenskitest</userinput>
+<prompt>arcadia:/some/path/$</prompt> <userinput>cd lenskitest</userinput>
+<prompt>arcadia:/some/path/lenskitest$</prompt> <userinput>mkdir data origdata assemblies</userinput>
+<prompt>arcadia:/some/path/lenskitest$</prompt> <userinput>ls -l</userinput>
+drwxr-xr-x 2 bach bach 4096 2009-12-06 16:06 assemblies
+drwxr-xr-x 2 bach bach 4096 2009-12-06 16:06 data
+drwxr-xr-x 2 bach bach 4096 2009-12-06 16:06 origdata</screen>
+	<para>
+	  Now copy the files you just downloaded into the directory
+	  <filename>origdata</filename>.
+	</para>
+	<screen>
+<prompt>arcadia:/some/path/lenskitest$</prompt> <userinput>cp /wherever/the/files/are/SRR030257_1.fastq.gz origdata</userinput>
+<prompt>arcadia:/some/path/lenskitest$</prompt> <userinput>cp /wherever/the/files/are/SRR030257_2.fastq.gz origdata</userinput>
+<prompt>arcadia:/some/path/lenskitest$</prompt> <userinput>cp /wherever/the/files/are/NC_012967.gbk origdata</userinput>
+<prompt>arcadia:/some/path/lenskitest$</prompt> <userinput>ls -l origdata</userinput>
+-rw-r--r-- 1 bach bach  10543139 2009-12-06 16:38 NC_012967.gbk
+-rw-r--r-- 1 bach bach 158807975 2009-12-06 15:15 SRR030257_1.fastq.gz
+-rw-r--r-- 1 bach bach 157595587 2009-12-06 15:21 SRR030257_2.fastq.gz
+	</screen>
+	<para>
+	  Great, let's preprocess the data. For this you must know a few things:
+	</para>
+	<itemizedlist>
+	  <listitem>
+	    <para>
+	      the standard Illumina naming scheme for Solexa paired-end reads
+	      is to append forward read names with <literal>/1</literal> and
+	      reverse read names with <literal>/2</literal>. The reads are
+	      normally put into at least two different files (one for forward,
+	      one for reverse). Now, the Solexa data stored in the Short Read
+	      Archive at the NCBI also has forward and reverse files for
+	      paired-end Solexas. That's OK. What's a bit less good is that
+	      the read names there DO NOT have /1 appended to names of forward
+	      read, or /2 to names of reverse reads. The forward and reverse
+	      reads in both files are just named exactly the same.  We'll need
+	      to fix that.
+	    </para>
+	  </listitem>
+	  <listitem>
+	    <para>
+	      while Sanger and 454 reads should be preprocessed (clipping
+	      sequencing vectors, perhaps quality clipping etc.), reads from
+	      Solexa present do not. Some people perform quality clipping or
+	      clipping of reads with too many 'N's in the sequence, but this
+	      is not needed when using MIRA. In fact, MIRA will perform
+	      everything needed for Solexa reads itself and will generally do
+	      a much better job as the clipping performed is independent of
+	      Solexa quality values (which are not always the most trustworthy
+	      ones).
+	    </para>
+	  </listitem>
+	  <listitem>
+	    <para>
+	      for a mapping assembly, it's good to give the strain name of the
+	      backbone and the strain name for the reads mapped against. The
+	      former can be done via command line, the later is done for each
+	      read individually in a key-value file (the
+	      <emphasis>straindata</emphasis> file).
+	    </para>
+	  </listitem>
+	</itemizedlist>
+	<para>
+	</para>
+	<para>
+	  So, to pre-process the data, we will need to
+	</para>
+	<itemizedlist>
+	  <listitem>
+	    <para>
+	      put the reads of the NCBI forward and reverse pairs into one
+	      file
+	    </para>
+	  </listitem>
+	  <listitem>
+	    <para>
+	      append <literal>/1</literal> to the names of forward reads, and
+	      <literal>/2</literal> for reverse reads.
+	    </para>
+	  </listitem>
+	  <listitem>
+	    <para>
+	      create a straindata file for MIRA 
+	    </para>
+	  </listitem>
+	</itemizedlist>
+	<para>
+	</para>
+	<para>
+	  To ease things for you, I've prepared a small script which will do
+	  everything for you: copy and rename the reads as well as creating
+	  strain names. Note that it's a small part of a more general script
+	  which I use to sometimes sample subsets of large data sets, but for
+	  the Lenski data set is small enough so that everything is taken.
+	</para>
+	<para>
+	  Create a file <filename>prepdata.sh</filename> in directory
+	  <filename>data</filename> and copy paste the following into it:
+	</para>
+	<screen>
+######################################################################
+#######
+####### Prepare paired-end Solexa downloaded from NCBI
+#######
+######################################################################
+
+# srrname:    is the SRR name as downloaded form NCBI SRA
+# numreads:   maximum number of forward (and reverse) reads to take from
+#              each file. Just to avoid bacterial projects with a coverage
+#              of 200 or so.
+# strainname: name of the strain which was re-sequenced
+
+srrname="SRR030257"
+numreads=5000000
+strainname="REL8593A"
+
+################################
+
+numlines=$((4*${numreads}))
+
+# put "/1" Solexa reads into file
+echo "Copying ${numreads} reads from _1 (forward reads)"
+zcat ../origdata/${srrname}_1.fastq.gz | head -${numlines} | sed -e 's/SRR[0-9.]*/&\/1/' >${strainname}-${numreads}_in.solexa.fastq
+
+# put "/2" Solexa reads into file
+echo "Copying ${numreads} reads from _2 (reverse reads)"
+zcat ../origdata/${srrname}_2.fastq.gz | head -${numlines} | sed -e 's/SRR[0-9.]*/&\/2/' >>${strainname}-${numreads}_in.solexa.fastq
+
+# make file with strainnames
+echo "Creating file with strain names for copied reads (this may take a while)."
+grep "@SRR" ${strainname}-${numreads}_in.solexa.fastq | cut -f 1 -d ' ' | sed -e 's/@//' -e "s/$/ ${strainname}/" >>${strainname}-${numreads}_straindata_in.txt</screen>
+	<para>
+	  Now, let's create the needed data:
+	</para>
+	<screen>
+arcadia:/some/path/lenskitest$ <userinput>cd data</userinput>
+arcadia:/some/path/lenskitest/data$ <userinput>ls -l</userinput>
+-rw-r--r-- 1 bach bach       1349 2009-12-06 17:05 prepdata.sh
+arcadia:/some/path/lenskitest/data$ <userinput>sh prepdata.sh</userinput>
+Copying 5000000 reads from _1 (forward reads)
+Copying 5000000 reads from _2 (reverse reads)
+Creating file with strain names for copied reads (this may take a while).
+arcadia:/some/path/lenskitest/data$ <userinput>ls -l</userinput>
+-rw-r--r-- 1 bach bach       1349 2009-12-06 17:05 prepdata.sh
+-rw-r--r-- 1 bach bach 1553532192 2009-12-06 15:36 REL8593A-5000000_in.solexa.fastq
+-rw-r--r-- 1 bach bach  218188232 2009-12-06 15:36 REL8593A-5000000_straindata_in.txt</screen>
+	<para>
+	  Last step, just for the sake of completeness, link in the GenBank formatted
+	  file of the reference strain, giving it the same base name so that everything
+	  is nicely set up for MIRA.
+	</para>
+	<screen>
+<prompt>arcadia:/some/path/lenskitest/data$</prompt> <userinput>ln -s ../origdata/NC_012967.gbk REL8593A-5000000_backbone_in.gbf</userinput>
+<prompt>arcadia:/some/path/lenskitest/data$</prompt> <userinput>ls -l</userinput>
+-rw-r--r-- 1 bach bach       1349 2009-12-06 17:05 prepdata.sh
+lrwxrwxrwx 1 bach bach         25 2009-12-06 16:39 REL8593A-5000000_backbone_in.gbf -> ../origdata/NC_012967.gbk
+-rw-r--r-- 1 bach bach 1553532192 2009-12-06 15:36 REL8593A-5000000_in.solexa.fastq
+-rw-r--r-- 1 bach bach  218188232 2009-12-06 15:36 REL8593A-5000000_straindata_in.txt
+<prompt>arcadia:/some/path/lenskitest/data$</prompt> <userinput>cd ..</userinput>
+<prompt>arcadia:/some/path/lenskitest$</prompt></screen>
+	<para>
+	  Perfect, we're ready to start assemblies.
+	</para>
+      </sect3>
+      <sect3 id="sect_sxa_starting_the_mapping_assembly">
+	<title>
+	  Starting the mapping assembly
+	</title>
+	<screen>
+<prompt>arcadia:/some/path/lenskitest$</prompt> <userinput>cd assemblies</userinput>
+<prompt>arcadia:/some/path/lenskitest/assemblies$</prompt> <userinput>mkdir 1sttest</userinput>
+<prompt>arcadia:/some/path/lenskitest/assemblies/1sttest$</prompt> <userinput>lndir ../../data</userinput>
+<prompt>arcadia:/some/path/lenskitest/assemblies/1sttest$</prompt> <userinput>ls -l</userinput>
+lrwxrwxrwx 1 bach bach         22 2009-12-06 17:18 prepdata.sh -> ../../data/prepdata.sh
+lrwxrwxrwx 1 bach bach         43 2009-12-06 16:40 REL8593A-5000000_backbone_in.gbf -> ../../data/REL8593A-5000000_backbone_in.gbf
+lrwxrwxrwx 1 bach bach         43 2009-12-06 15:39 REL8593A-5000000_in.solexa.fastq -> ../../data/REL8593A-5000000_in.solexa.fastq
+lrwxrwxrwx 1 bach bach         45 2009-12-06 15:39 REL8593A-5000000_straindata_in.txt -> ../../data/REL8593A-5000000_straindata_in.txt</screen>
+	<para>
+	  Oooops, we don't need the link <filename>prepdata.sh</filename>
+	  here, just delete it.
+	</para>
+	<screen>
+<prompt>arcadia:/some/path/lenskitest/assemblies/1sttest$</prompt> <userinput>rm prepdata.sh</userinput></screen>
+	<para>
+	  Perfect. Now then, start a simple mapping assembly:
+	</para>
+	<screen>
+<prompt>arcadia:/some/path/lenskitest/assemblies/1sttest$</prompt> <userinput>mira 
+  --fastq 
+  --project=REL8593A-5000000 
+  --job=mapping,genome,accurate,solexa
+  -SB:lsd=yes:bsn=ECO_B_REL606:bft=gbf
+  >&log_assembly.txt</userinput></screen>
+	<note>
+	  <title>Note 1</title>
+	  <para>
+	    The above command has been split in multiple lines for better
+	    overview but should be entered in one line. It basically says:
+	    load all data in FASTQ format; the project name is
+	    <emphasis>REL8593A-5000000</emphasis> (and therefore all input and
+	    output files will have this prefix by default if not chosen
+	    otherwise); we want an accurate mapping of Solexa reads against a
+	    genome; load strain data of a separate strain file
+	    (<arg>-SB:lsd=yes</arg>); the strain name of the reference
+	    sequence is 'ECO_B_REL606' (<arg>-SB:bsn=ECO_B_REL606</arg>) and
+	    the file type containing the reference sequence in a GenBank
+	    format (<arg>-SB:bft=gbf</arg>). Last but not least, redirect the
+	    progress output of the assembler to a file named
+	    <filename>log_assembly.txt</filename>.
+	  </para>
+	</note>
+	<note>
+	  <title>Note 2</title>
+	  <para>
+	    The above assembly takes approximately 35 minutes on my computer
+	    (i7 940 with 12 GB RAM) when using 4 threads (I have '-GE:not=4'
+	    additionally). It may be faster or slower on your computer.
+	  </para>
+	</note>
+	<note>
+	  <title>Note 3</title>
+	  <para>
+	    You will need some 10.5 GB RAM to get through this. You might get
+	    away with a bit less RAM and using swap, but less than 8 GB RAM is
+	    not recommended.
+	  </para>
+	</note>
+	<para>
+	  Let's have a look at the directory now:
+	</para>
+	<screen>
+<prompt>arcadia:/some/path/lenskitest/assemblies/1sttest$</prompt> <userinput>ls -l</userinput>
+-rw-r--r-- 1 bach bach 1463331186 2010-01-27 20:41 log_assembly.txt
+drwxr-xr-x 6 bach bach       4096 2010-01-27 20:04 REL8593A-5000000_assembly
+lrwxrwxrwx 1 bach bach         43 2009-12-06 16:40 REL8593A-5000000_backbone_in.gbf -> ../../data/REL8593A-5000000_backbone_in.gbf
+lrwxrwxrwx 1 bach bach         43 2009-12-06 15:39 REL8593A-5000000_in.solexa.fastq -> ../../data/REL8593A-5000000_in.solexa.fastq
+lrwxrwxrwx 1 bach bach         45 2009-12-06 15:39 REL8593A-5000000_straindata_in.txt -> ../../data/REL8593A-5000000_straindata_in.txt</screen>
+	<para>
+	  Not much which changed. All files created by MIRA will be in the
+	  REL8593A-5000000_assembly directory. Going one level down, you'll see 4
+	  sub-directories:
+	</para>
+	<screen>
+<prompt>arcadia:/some/path/lenskitest/assemblies/1sttest$</prompt> <userinput>cd REL8593A-5000000_assembly</userinput>
+<prompt>arcadia:.../1sttest/REL8593A-5000000_assembly$</prompt> <userinput>ls -l</userinput>
+drwxr-xr-x 2 bach bach 4096 2010-01-27 20:29 REL8593A-5000000_d_chkpt
+drwxr-xr-x 2 bach bach 4096 2010-01-27 20:40 REL8593A-5000000_d_info
+drwxr-xr-x 2 bach bach 4096 2010-01-27 20:30 REL8593A-5000000_d_tmp
+drwxr-xr-x 2 bach bach 4096 2010-01-27 21:19 REL8593A-5000000_d_results</screen>
+	<para>
+	  You can safely delete the tmp and the chkpt directories, in this
+	  walkthrough they are not needed anymore.
+	</para>
+      </sect3>
+      <sect3 id="sect_sxa_looking_at_results">
+	<title>
+	  Looking at results
+	</title>
+	<para>
+	  Results will be in a sub-directories created by MIRA. Let's go there
+	  and have a look.
+	</para>
+	<screen>
+<prompt>arcadia:/some/path/lenskitest/assemblies/1sttest$</prompt> <userinput>cd REL8593A-5000000_assembly</userinput>
+<prompt>arcadia:.../1sttest/REL8593A-5000000_assembly$</prompt> <userinput>cd REL8593A-5000000_d_results</userinput>
+<prompt>arcadia:.../REL8593A-5000000_d_results$</prompt> <userinput>ls -l</userinput>
+-rw-r--r-- 1 bach bach  455087340 2010-01-27 20:40 REL8593A-5000000_out.ace
+-rw-r--r-- 1 bach bach  972479972 2010-01-27 20:38 REL8593A-5000000_out.caf
+-rw-r--r-- 1 bach bach  569619434 2010-01-27 20:38 REL8593A-5000000_out.maf
+-rw-r--r-- 1 bach bach    4708371 2010-01-27 20:39 REL8593A-5000000_out.padded.fasta
+-rw-r--r-- 1 bach bach   14125036 2010-01-27 20:39 REL8593A-5000000_out.padded.fasta.qual
+-rw-r--r-- 1 bach bach  472618709 2010-01-27 20:39 REL8593A-5000000_out.tcs
+-rw-r--r-- 1 bach bach    4707025 2010-01-27 20:39 REL8593A-5000000_out.unpadded.fasta
+-rw-r--r-- 1 bach bach   14120999 2010-01-27 20:39 REL8593A-5000000_out.unpadded.fasta.qual
+-rw-r--r-- 1 bach bach   13862715 2010-01-27 20:39 REL8593A-5000000_out.wig</screen>
+	<para>
+	  You can see that MIRA has created output in many different formats
+	  suited for a number of different applications. Most commonly known
+	  will be ACE and CAF for their use in finishing programs (e.g. gap4
+	  and consed).
+	</para>
+	<para>
+	  In a different directory (the info directory) there are also files
+	  containing all sorts of statistics and useful information.
+	</para>
+	<screen>
+<prompt>arcadia:.../REL8593A-5000000_d_results$</prompt> <userinput>cd ../REL8593A-5000000_d_info/</userinput>
+<prompt>arcadia:.../REL8593A-5000000_d_info$</prompt> <userinput>ls -l</userinput>
+-rw-r--r-- 1 bach bach     2256 2010-01-27 20:40 REL8593A-5000000_info_assembly.txt
+-rw-r--r-- 1 bach bach      124 2010-01-27 20:04 REL8593A-5000000_info_callparameters.txt
+-rw-r--r-- 1 bach bach    37513 2010-01-27 20:37 REL8593A-5000000_info_consensustaglist.txt
+-rw-r--r-- 1 bach bach 28522692 2010-01-27 20:37 REL8593A-5000000_info_contigreadlist.txt
+-rw-r--r-- 1 bach bach      176 2010-01-27 20:37 REL8593A-5000000_info_contigstats.txt
+-rw-r--r-- 1 bach bach 15359354 2010-01-27 20:40 REL8593A-5000000_info_debrislist.txt
+-rw-r--r-- 1 bach bach 45802751 2010-01-27 20:37 REL8593A-5000000_info_readtaglist.txt</screen>
+	<para>
+	  Just have a look at them to get a feeling what they show. You'll
+	  find more information regarding these files in that main manual of
+	  MIRA. At the moment, let's just have a quick assessment of the
+	  differences between the Lenski reference strain and the REL8593A
+	  train by counting how many SNPs MIRA thinks there are (marked with
+	  <emphasis>SROc</emphasis> tags in the consensus):
+	</para>
+	<screen>
+<prompt>arcadia:.../REL8593A-5000000_d_info$</prompt> <userinput>grep -c SROc REL8593A-5000000_info_consensustaglist.txt</userinput>
+102</screen>
+	<para>
+	</para>
+	<para>
+	  102 bases are marked with such a tag. You will later see that this
+	  is an overestimation due to several insert sites and deletions, but
+	  it's a good first approximation.
+	</para>
+	<para>
+	  Let's count how many potential deletion sites REL8593A has in
+	  comparison to the reference strain:
+	</para>
+	<screen>
+<prompt>arcadia:.../REL8593A-5000000_d_info$</prompt> <userinput>grep -c MCVc REL8593A-5000000_info_consensustaglist.txt</userinput>
+48</screen>
+	<para>
+	  This number too is a slight overestimation due to
+	  cross-contamination with sequenced strain which did not have these
+	  deletions, but it's also a first approximate.
+	</para>
+      </sect3>
+      <sect3 id="sect_sxa_postprocessing_with_gap4_and_reexporting_to_mira">
+	<title>
+	  Post-processing with gap4 and re-exporting to MIRA
+	</title>
+	<para>
+	  To have a look at your project in gap4, use the caf2gap program (you
+	  can get it at the Sanger Centre), and then gap4:
+	</para>
+	<screen>
+<prompt>arcadia:.../REL8593A-5000000_d_results$</prompt> <userinput>ls -l</userinput>
+-rw-r--r-- 1 bach bach  455087340 2010-01-27 20:40 REL8593A-5000000_out.ace
+-rw-r--r-- 1 bach bach  972479972 2010-01-27 20:38 REL8593A-5000000_out.caf
+-rw-r--r-- 1 bach bach  569619434 2010-01-27 20:38 REL8593A-5000000_out.maf
+-rw-r--r-- 1 bach bach    4708371 2010-01-27 20:39 REL8593A-5000000_out.padded.fasta
+-rw-r--r-- 1 bach bach   14125036 2010-01-27 20:39 REL8593A-5000000_out.padded.fasta.qual
+-rw-r--r-- 1 bach bach  472618709 2010-01-27 20:39 REL8593A-5000000_out.tcs
+-rw-r--r-- 1 bach bach    4707025 2010-01-27 20:39 REL8593A-5000000_out.unpadded.fasta
+-rw-r--r-- 1 bach bach   14120999 2010-01-27 20:39 REL8593A-5000000_out.unpadded.fasta.qual
+-rw-r--r-- 1 bach bach   13862715 2010-01-27 20:39 REL8593A-5000000_out.wig
+<prompt>arcadia:.../REL8593A-5000000_d_results$</prompt> <userinput>caf2gap -project REL8593A -ace REL8593A-5000000_out.caf >&/dev/null</userinput>
+<prompt>arcadia:.../REL8593A-5000000_d_results$</prompt> <userinput>ls -l</userinput>
+-rw-r--r-- 1 bach bach 1233494048 2010-01-27 20:43 REL8593A.0
+-rw-r--r-- 1 bach bach  233589448 2010-01-27 20:43 REL8593A.0.aux
+-rw-r--r-- 1 bach bach  455087340 2010-01-27 20:40 REL8593A-5000000_out.ace
+-rw-r--r-- 1 bach bach  972479972 2010-01-27 20:38 REL8593A-5000000_out.caf
+-rw-r--r-- 1 bach bach  569619434 2010-01-27 20:38 REL8593A-5000000_out.maf
+-rw-r--r-- 1 bach bach    4708371 2010-01-27 20:39 REL8593A-5000000_out.padded.fasta
+-rw-r--r-- 1 bach bach   14125036 2010-01-27 20:39 REL8593A-5000000_out.padded.fasta.qual
+-rw-r--r-- 1 bach bach  472618709 2010-01-27 20:39 REL8593A-5000000_out.tcs
+-rw-r--r-- 1 bach bach    4707025 2010-01-27 20:39 REL8593A-5000000_out.unpadded.fasta
+-rw-r--r-- 1 bach bach   14120999 2010-01-27 20:39 REL8593A-5000000_out.unpadded.fasta.qual
+-rw-r--r-- 1 bach bach   13862715 2010-01-27 20:39 REL8593A-5000000_out.wig
+
+<prompt>arcadia:.../REL8593A-5000000_d_results$</prompt> <userinput>gap4 REL8593A.0</userinput></screen>
+	<para>
+	  Search for the tags set by MIRA which denoted features or problems (SROc,
+	  WRMc, MCVc, UNSc, IUPc. See main manual for full list) in the assembly, and
+	  edit accordingly. Save your gap4 database as a new version (e.g. REL8593A.1),
+	  then exit gap4.
+	</para>
+	<para>
+	  Then use the gap2caf command (also from the Sanger Centre) to convert
+	  the gap4 database back to CAF.
+	</para>
+	<screen>
+<prompt>arcadia:.../REL8593A-5000000_d_results$</prompt> <userinput>gap2caf -project REL8593A.1 >rel8593a_edited.caf</userinput></screen>
+	<para>
+	  As gap4 jumbled the consensus (it does not know different sequencing
+	  technologies), having convert_project recalculate the consensus
+	  (with the "<literal>-r c</literal>" option) is generally a good
+	  idea.
+	</para>
+	<screen>
+<prompt>arcadia:.../REL8593A-5000000_d_results$</prompt> <userinput>convert_project -f caf -t caf -r c rel8593a_edited.caf rel8593a_edited_recalled</userinput></screen>
+      </sect3>
+      <sect3 id="sect_sxa_converting_mapping_results_into_html_and_simple_spreadsheet_tables_for_biologists">
+	<title>
+	  Converting mapping results into HTML and simple spreadsheet tables
+	  for biologists
+	</title>
+	<para>
+	  You will have to use either CAF or MAF as input, either of which can
+	  be the direct result from the MIRA assembly or an already cleaned
+	  and edited file. For the sake of simplicity, we'll use the file
+	  created by MIRA in the steps above.
+	</para>
+	<para>
+	  Let's start with a HTML file showing all positions of interest:
+	</para>
+	<screen>
+<prompt>arcadia:.../REL8593A-5000000_d_results$</prompt> <userinput>convert_project -f caf -t hsnp REL8593A-5000000_out.caf rel8593a</userinput>
+<prompt>arcadia:.../REL8593A-5000000_d_results$</prompt> <userinput>ls -l *html</userinput>
+-rw-r--r-- 1 bach bach 5198791 2010-01-27 20:49 rel8593a_info_snpenvironment.html</screen>
+	<para>
+	  But MIRA can do even better: create tables ready to be imported in spreadsheet
+	  programs.
+	</para>
+	<screen>
+<prompt>arcadia:.../REL8593A-5000000_d_results$</prompt> <userinput>convert_project -f caf -t asnp REL8593A-5000000_out.caf rel8593a</userinput>
+<prompt>arcadia:.../REL8593A-5000000_d_results$</prompt> <userinput>ls -l rel8593a*</userinput>
+-rw-r--r-- 1 bach bach      25864 2010-01-27 20:48 rel8593a_info_featureanalysis.txt
+-rw-r--r-- 1 bach bach   12402905 2010-01-27 20:48 rel8593a_info_featuresequences.txt
+-rw-r--r-- 1 bach bach     954473 2010-01-27 20:48 rel8593a_info_featuresummary.txt
+-rw-r--r-- 1 bach bach    5198791 2010-01-27 20:49 rel8593a_info_snpenvironment.html
+-rw-r--r-- 1 bach bach      13810 2010-01-27 20:47 rel8593a_info_snplist.txt</screen>
+	<para>
+	  Have a look at all file, perhaps starting with the SNP list, then the feature
+	  analysis, then the feature summary (your biologists will love that one,
+	  especially when combined with filters in the spreadsheet program) and
+	  then the feature sequences.
+	</para>
+      </sect3>
+    </sect2>
+  </sect1>
+  <sect1 id="sect_sxa_denovo_solexa_only_assemblies">
+    <title>
+      De-novo Solexa only assemblies
+    </title>
+    <para>
+      This is actually quite straightforward if you name your reads according
+      to the MIRA standard for input files. Assume you have the following
+      files (<emphasis>bchocse</emphasis> being an example for your mnemonic
+      for the project):
+    </para>
+    <screen>
+<prompt>arcadia:/path/to/myProject$</prompt> <userinput>ls -l</userinput>
+-rw-r--r-- 1 bach users 263985896 2008-03-28 21:49 bchocse_in.solexa.fastq</screen>
+    <para>
+    </para>
+    <sect2 id="sect_sxa_without_pairedend">
+      <title>
+	Without paired-end
+      </title>
+      <para>
+	Here's the simplest way to start the assembly:
+      </para>
+      <screen>
+<prompt>arcadia:/path/to/myProject$</prompt> <userinput>mira 
+  --project=bchocse
+  --job=denovo,genome,accurate,solexa 
+  >&log_assembly.txt</userinput></screen>
+      <para>
+	Of course, you can add any other switch you want like, e.g., changing the
+	number of processors used, adding default strain names etc.pp
+      </para>
+    </sect2>
+    <sect2 id="sect_sxa_with_pairedend_only_one_library_size">
+      <title>
+	With paired-end (only one library size)
+      </title>
+      <para>
+	If you have only one library with one insert size, you just need to
+	tell MIRA this minimum and maximum distance the reads should be away
+	from each other. In the following example I have a library size of 500
+	bp and have set the minimum and maximum distance to +/- 50% (you might
+	want to use other modifiers):
+      </para>
+      <screen>
+<prompt>arcadia:/path/to/myProject$</prompt> <userinput>mira 
+  --project=bchocse 
+  --job=denovo,genome,accurate,solexa 
+  SOLEXA_SETTINGS -GE:tismin=250:tismax=750
+  >&log_assembly.txt</userinput></screen>
+      <note>
+	<title>Note</title>
+	<para>
+	  For this example to work, make sure that the read pairs are named
+	  using the Solexa standard, i.e., having <emphasis
+	  role="underline">/1</emphasis> for one read and <emphasis
+	  role="underline">/2</emphasis> for the other read. If yours have a
+	  different naming scheme, look up the -LR:rns parameter in the main
+	  documentation.
+	</para>
+      </note>
+    </sect2>
+    <sect2 id="sect_sxa_with_pairedend_several_library_sizes">
+      <title>
+	With paired-end (several library sizes)
+      </title>
+      <para>
+	To tell MIRA exactly which reads have which insert size, one must use an XML
+	file containing ancillary data in NCBI TRACEINFO format. In case you don't
+	have such a file, here's a very simple example containing only insert sizes
+	for reads (lane 1 has a library size of 500 bases and lane 2 a library size of
+	2 Kb):
+      </para>
+      <screen>
+<?xml version="1.0"?>
+<trace_volume>
+<trace>
+<trace_name>1_17_510_1281/1</trace_name>
+<insert_size>500</insert_size>
+<insert_stdev>100</insert_stdev>
+</trace>
+<trace>
+<trace_name>1_17_510_1281/2</trace_name>
+<insert_size>500</insert_size>
+<insert_stdev>100</insert_stdev>
+</trace>
+...
+<trace>
+<trace_name>2_17_857_850/1</trace_name>
+<insert_size>2000</insert_size>
+<insert_stdev>300</insert_stdev>
+</trace>
+<trace>
+<trace_name>2_17_857_850/2</trace_name>
+<insert_size>2000</insert_size>
+<insert_stdev>300</insert_stdev>
+</trace>
+...
+</trace_volume></screen>
+      <para>
+	So, if your directory looks like this:
+      </para>
+      <screen>
+<prompt>arcadia:/path/to/myProject$</prompt> <userinput>ls -l</userinput>
+-rw-r--r-- 1 bach users 263985896 2008-03-28 21:49 bchocse_in.solexa.fastq
+-rw-r--r-- 1 bach users 324987513 2008-04-01 13:24 bchocse_traceinfo_in.solexa.xml
+      </screen>
+      <para>
+	then starting the assembly is done like this (note the additional
+	<arg>-LR:mxti</arg> parameter in the section for Solexa setting):
+      </para>
+      <screen>
+<prompt>arcadia:/path/to/myProject$</prompt> <userinput>mira
+  --project=bchocse 
+  --job=denovo,genome,accurate,solexa 
+  SOLEXA_SETTINGS -LR:mxti=yes
+  >&log_assembly.txt</userinput></screen>
+    </sect2>
+  </sect1>
+  <sect1 id="sect_sxa_denovo_hybrid_assemblies_solexa_+_">
+    <title>
+      De-novo hybrid assemblies (Solexa + ...)
+    </title>
+    <para>
+    </para>
+    <para>
+      Two strategies can be thought of to assemble genomes using a combination
+      of Solexa and other (longer) reads: either using all reads for a full
+      de-novo assembly or first assembling the longer reads and use the
+      resulting assembly as backbone to map Solexa reads. Both strategies have
+      their pro and cons.
+    </para>
+    <sect2 id="sect_sxa_all_reads_denovo">
+      <title>
+	All reads de-novo
+      </title>
+      <para>
+	Throwing all reads into a de-novo assembly is the most straightforward
+	way to get 'good' assemblies. This strategy is also the one which - in
+	most cases - yields the longest contigs as, in many projects, parts of
+	a genome not covered by one sequencing technology will probably be
+	covered by another sequencing technology. Furthermore, having the
+	consensus covered by more than one sequencing technology make base
+	calling a pretty robust thing: if MIRA finds disagreements it cannot
+	resolve easily, the assembler at least leaves a tag in the assembly to
+	point human finishers to these positions of interest.
+      </para>
+      <para>
+	The downside of this approach however is the fact that the sheer
+	amount of data in Solexa sequencing projects makes life difficult for
+	de-novo assemblers, especially for MIRA which is keeping quite some
+	additional information in memory in de-novo assemblies and tries to
+	use algorithms as exact as possible during contig
+	construction. Therefore, MIRA sometimes still runs into data sets
+	which make it behave quite badly with respect to assembly time and
+	memory consumption (but this is being constantly improved).
+      </para>
+      <para>
+	Full de-novo hybrid assemblies can be recommended only for bacteria at
+	the moment, although lower eukaryotes should also be feasible on
+	larger machines.
+      </para>
+      <sect3 id="sect_sxa_starting_the_assembly">
+	<title>
+	  Starting the assembly
+	</title>
+	<para>
+	  Starting the assembly is now just a matter of a simple command line
+	  with some parameters set correctly. The following is a de-novo
+	  hybrid assembly with 454 and Solexa reads.
+	</para>
+	<screen>
+<prompt>arcadia:/path/to/myProject$</prompt> <userinput>mira 
+  --project=bchocse --job=denovo,genome,normal,454,solexa
+  >&log_assembly.txt</userinput></screen>
+      </sect3>
+    </sect2>
+    <sect2 id="sect_sxa_long_reads_first_then_solexa">
+      <title>
+	Long reads first, then Solexa
+      </title>
+      <para>
+	This strategy works in two steps: first assembling long reads, then
+	mapping short reads to the full alignment (not just a consensus
+	sequence). The result will be an assembly containing 454 (or Sanger)
+	and Solexa reads.
+      </para>
+      <sect3 id="sect_sxa_step_1:_assemble_the_'long'_reads_454_or_sanger_or_both">
+	<title>
+	  Step 1: assemble the 'long' reads (454 or Sanger or both)
+	</title>
+	<para>
+	  Assemble your data just as you would when assembling 454 or Sanger
+	  data.
+	</para>
+      </sect3>
+      <sect3 id="sect_sxa_step_2:_filter_the_results">
+	<title>
+	  Step 2: filter the results
+	</title>
+	<para>
+	  This step fetches 'long' contigs from the assembly before. Idea is
+	  to get all contigs larger than 500 bases.
+	</para>
+	<screen>
+<prompt>$</prompt> <userinput>convert_project -f caf -t caf -x 500 assemblyresult.caf hybrid_backbone_in.caf</userinput></screen>
+	<para>
+	  You might eventually want to add an additional filter for minimum
+	  average coverage. If your project has an average coverage of 24, you
+	  should filter for a minimum average coverage of 33% (coverage 8, you
+	  might want to try out higher coverages) like this:
+	</para>
+	<screen>
+<prompt>$</prompt> <userinput>convert_project -f caf -t caf -x 500 -y 8 assemblyresult.caf hybrid_backbone_in.caf</userinput></screen>
+      </sect3>
+      <sect3 id="sect_sxa_step3_map_the_solexa_data">
+	<title>
+	  Step 3: map the Solexa data
+	</title>
+	<para>
+	  Copy the hybrid backbone to a new empty directory, add in the Solexa
+	  data, start a mapping assembly using the CAF as input for the
+	  backbone. If you assembled the 454 / Sanger data with strain info,
+	  the Solexa data should also get those (as described above).
+	</para>
+	<screen>
+<prompt>arcadia:/path/to/myProject$</prompt> <userinput>ls -l</userinput>
+-rw-r--r-- 1 bach bach 1159280980 2009-10-31 19:46 hybrid_backbone_in.caf
+-rw-r--r-- 1 bach bach  338430282 2009-10-31 20:31 hybrid_in.solexa.fastq
+<prompt>arcadia:/path/to/myProject$</prompt> <userinput>mira 
+  --project=hybrid --job=mapping,genome,accurate,solexa
+  -AS:nop=1
+  -SB:bft=caf
+  >&log_assembly.txt</userinput></screen>
+      </sect3>
+    </sect2>
+  </sect1>
+  <sect1 id="sect_sxa_postprocessing_of_assemblies">
+    <title>
+      Post-processing of assemblies
+    </title>
+    <para>
+      This section is a bit terse, you should also read the chapter on
+      <emphasis>working with results</emphasis> of MIRA3.
+    </para>
+    <sect2 id="sect_sxa_postprocessing_mapping_assemblies">
+      <title>
+	Post-processing mapping assemblies
+      </title>
+      <para>
+	When working with resequencing data and a mapping assembly, I always
+	load finished projects into an assembly editor and perform a quick
+	cleanup of the results.
+      </para>
+      <para>
+	For close relatives of the reference strain this doesn't take long as
+	MIRA will have set tags (see section earlier in this document) at all
+	sites you should have a look at. For example, very close mutant
+	bacteria with just SNPs or simple deletions and no genome
+	reorganisation, I usually clean up in 10 to 15 minutes. That gives the
+	last boost to data quality and your users (biologists etc.) will thank
+	you for that as it reduces their work in analysing the data (be it
+	looking at data or performing wet-lab experiments).
+      </para>
+      <para>
+	Assume you have the following result files in the result directory of
+	a MIRA assembly:
+      </para>
+      <screen>
+<prompt>arcadia:/path/to/myProject/newstrain_d_results$</prompt> <userinput>ls -l</userinput>
+-rw-r--r-- 1 bach bach 312607561 2009-06-08 14:57 newstrain_out.ace
+-rw-r--r-- 1 bach bach 655176303 2009-06-08 14:56 newstrain_out.caf
+...</screen>
+      <para>
+	The general workflow I use is to convert the CAF file to a gap4 database
+	and start the gap4 editor:
+      </para>
+      <screen>
+<prompt>arcadia:newstrain_d_results$</prompt> <userinput>caf2gap -project NEWSTRAIN -ace newstrain_out.caf >& /dev/null</userinput>
+<prompt>arcadia:newstrain_d_results$</prompt> <userinput>gap4 NEWSTRAIN.0</userinput></screen>
+      <para>
+	Then, in gap4, I 
+      </para>
+      <orderedlist>
+	<listitem>
+	  <para>
+	    quickly search for the UNSc and WRMc tags and check whether they
+	    could be real SNPs that were overseen by MIRA. In that case, I
+	    manually set a SROc (or SIOc) tag in gap4 via hotkeys that were
+	    defined to set these tags.
+	  </para>
+	</listitem>
+	<listitem>
+	  <para>
+	    sometimes also quickly clean up reads that are causing trouble in
+	    alignments and lead to wrong base calling. These can be found at
+	    sites with UNSc tags, most of the time they have the 5' to 3'
+	    <literal>GGCxG</literal> motif which can cause trouble to Solexa.
+	  </para>
+	</listitem>
+	<listitem>
+	  <para>
+	    look at sites with deletions (tagged with MCVc) and look whether I
+	    should clean up the borders of the deletion.
+	  </para>
+	</listitem>
+      </orderedlist>
+      <para>
+	After this, I convert the gap4 database back to CAF format:
+      </para>
+      <screen>
+<prompt>$</prompt> <userinput>gap2caf -project NEWSTRAIN >newstrain_edited.caf</userinput></screen>
+      <para>
+	But beware: gap4 does not have the same consensus calling routines as
+	MIRA and will have saved it's own consensus in the new CAF. In fact,
+	gap4 performs rather badly in projects with multiple sequencing
+	technologies. So I use convert_project from the MIRA package to recall
+	a good consensus (and save it in MAF as it's more compact and a lot
+	faster in handling than CAF):
+      </para>
+      <screen>
+<prompt>$</prompt> <userinput>convert_project -f caf -t maf -r c newstrain_edited.caf newstrain_edited_recalled</userinput></screen>
+      <para>
+	And from this file I can then convert with convert_project to any
+	other format I or my users need: CAF, FASTA, ACE, WIG (for coverage
+	analysis) etc.pp.
+      </para>
+      <para>
+	I can also also generate tables and HTML files with SNP analysis
+	results (with the "<literal>-t asnp</literal>" and "<literal>-t
+	hsnp</literal>" options of <command>convert_project</command>)
+      </para>
+    </sect2>
+    <sect2 id="sect_sxa_postprocessing_denovo_assemblies">
+      <title>
+	Post-processing de-novo assemblies
+      </title>
+      <para>
+	As the result file of MIRA de-novo assemblies contains everything down
+	to 'contigs' with just two reads, it is advised to first filter out
+	all contigs which are smaller than a given size or have a coverage
+	lower than 1/3 to 1/2 of the overall coverage.
+      </para>
+      <para>
+	Filtering is performed by convert_project using CAF file as
+	input. Assume you have the following file:
+      </para>
+      <screen>
+<prompt>arcadia:/path/to/myProject/newstrain_d_results$</prompt> <userinput>ls -l</userinput>
+...
+-rw-r--r-- 1 bach bach 655176303 2009-06-08 14:56 newstrain_out.caf
+...</screen>
+      <para>
+	Let's say you have a hybrid assembly with an average coverage of
+	50x. I normally filter out all contigs which have an average coverage
+	less than 1/3 and are smaller than 500 bases. These are mostly junk
+	contiglets remaining from the assembly and can be more or less safely
+	ignored. This is done the following way:
+      </para>
+      <screen>
+<prompt>arcadia:newstrain_d_results$</prompt> <userinput>convert_project
+  -f caf -t caf -x 500 -y 17 newstrain_out.caf newstrain_filterx500y17</userinput></screen>
+      <para>
+	From there on, convert the filtered CAF file to anything you need to
+	continue finishing of the genome (gap4 database, ACE, etc.pp).
+      </para>
+    </sect2>
+  </sect1>
+  <sect1 id="sect_sxa_known_bugs___problems">
+    <title>
+      Known bugs / problems
+    </title>
+    <para>
+      These are actual for version 3 of MIRA and might or might not have been
+      addressed in later version.
+    </para>
+    <para>
+      Bugs:
+    </para>
+    <orderedlist>
+      <listitem>
+	<para>
+	  mapping of paired-end reads with one read being in non-repetitive
+	  area and the other in a repeat is not as effective as it should
+	  be. The optimal strategy to use would be to map first the
+	  non-repetitive read and then the read in the repeat. Unfortunately,
+	  this is not yet implemented in MIRA.
+	</para>
+      </listitem>
+    </orderedlist>
+    <para>
+    </para>
+    <para>
+      Problems:
+    </para>
+    <orderedlist>
+      <listitem>
+	<para>
+	  the textual output of results is really slow with such massive
+	  amounts of data as with Solexa projects. If Solexa data is present,
+	  it's turned off by default at the moment.
+	</para>
+      </listitem>
+    </orderedlist>
+  </sect1>
+</chapter>
+
diff --git a/doc/docbook/chap_specialparams_part.xml b/doc/docbook/chap_specialparams_part.xml
deleted file mode 100644
index 15bdaa6..0000000
--- a/doc/docbook/chap_specialparams_part.xml
+++ /dev/null
@@ -1,79 +0,0 @@
-<?xml version="1.0" ?>
-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.docbook.org/xml/4.5/docbookx.dtd">
-<chapter id="chap_specialparams">
-  <chapterinfo>
-    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="versionfile"/>
-    <author>
-      <firstname>Bastien</firstname>
-      <surname>Chevreux</surname>
-      <email>bach at chevreux.org</email>
-    </author>
-    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="copyrightfile"/>
-  </chapterinfo>
-  <blockquote>
-    <attribution>Solomon Short</attribution>
-    <para>
-      <emphasis><quote>... .
-      </quote></emphasis>
-    </para>
-  </blockquote>
-  <title>Parameters for special situations</title>
-  <sect1 id="sect_sp_introduction">
-    <title>
-      Introduction
-    </title>
-    <para>
-      Most of this chapter and many sections are just stubs at the moment.
-    </para>
-  </sect1>
-  <sect1 id="sect_sp_pacbio">
-    <title>
-      PacBio
-    </title>
-    <sect2 id="sect_sp_pacbio_ccs">
-      <title>
-	PacBio CCS reads
-      </title>
-      <para>
-	Declare the sequencing technology to be high-quality PacBio (<emphasis
-	role="bold">PCBIOHQ</emphasis>). The last time I worked with CCS, the
-	ends of the reads were not really clean, so using the proposed end
-	clipping (which needs to be manually switched on for PCBIOHQ reads)
-	may be advisable.
-      </para>
-      <screen><userinput>...
-parameters = PCBIOHQ_SETTINGS -CL:pec=yes
-...
-
-readgroup
-technology=pcbiohq
-data=...
-...</userinput></screen>
-    </sect2>
-    <sect2 id="sect_sp_pacbio_ec">
-      <title>
-	PacBio error corrected reads
-      </title>
-      <para>
-	Declare the sequencing technology to be high-quality PacBio (<emphasis
-	role="bold">PCBIOHQ</emphasis>). For self-corrected data or data
-	corrected with other sequencing technologies, it is recommended to
-	change the <arg>-CO:mrpg</arg> setting to a value which is 1/4th to
-	1/5th of the average coverage of the corrected PacBio reads across the
-	genome. E.g.:
-      </para>
-      <screen><userinput>...
-parameters = PCBIOHQ_SETTINGS -CO:mrpg=5
-...
-
-readgroup
-technology=pcbiohq
-data=...
-...</userinput></screen>
-      <para>
-	for a project which has ~24x coverage. This necessity may change in
-	later versions of MIRA though.
-      </para>
-    </sect2>
-  </sect1>
-</chapter>
diff --git a/doc/docbook/chap_sra_part.xml b/doc/docbook/chap_sra_part.xml
deleted file mode 100644
index f722d97..0000000
--- a/doc/docbook/chap_sra_part.xml
+++ /dev/null
@@ -1,145 +0,0 @@
-<?xml version="1.0" ?>
-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.docbook.org/xml/4.5/docbookx.dtd">
-<chapter id="chap_sra">
-  <chapterinfo>
-    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="versionfile"/>
-    <author>
-      <firstname>Bastien</firstname>
-      <surname>Chevreux</surname>
-      <email>bach at chevreux.org</email>
-    </author>
-    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="copyrightfile"/>
-  </chapterinfo>
-  <blockquote>
-    <attribution>Solomon Short</attribution>
-    <para>
-      <emphasis><quote>........ .</quote></emphasis>
-    </para>
-  </blockquote>
-  <title>The Trace & Short Read Archive at NCBI</title>
-  <sect1 id="sect_sra_introduction">
-    <title>
-      Introduction
-    </title>
-    <para>
-      ...
-    </para>
-  </sect1>
-  <sect1 id="sect_sra_SFF">
-    <title>
-      SFF format and file conversion
-    </title>
-    <para>
-      The basic data type you will get from the sequencing instruments from
-      454 & Ion Torrent will be SFF files. Those files contain almost all
-      information needed for an assembly, but SFFs need to be converted into
-      more standard files before MIRA can use this information.
-    </para>
-    <para>
-      We'll use the <command>sff_extract</command> script to do that.
-    </para>
-    <warning>
-      For MIRA versions < 3.9.0, make sure you have the <command>sff_extract</command> version 0.2.*. Starting with MIRA version 3.9.0, you <emphasis role="bold">MUST</emphasis> have <command>sff_extract</command> version ≥ 0.3.0
-    </warning>
-    <note>
-      Make sure you have Python installed on your system
-    </note>
-    <sect2 id="sect_sra_extracting_unpaired_data_from_sff">
-      <title>
-	Extracting unpaired data
-      </title>
-      <screen><prompt>arcadia:/path/to/myProject$</prompt> <userinput>sff_extract -o bchoc EV10YMP01.sff EV5RTWS01.sff EVX95GF02.sff</userinput></screen>
-      <para>
-	The parameters to <command>sff_extract</command> tell it to extract to
-	FASTQ (which is the default nowadays), give the output files a prefix
-	name we chose (via -o) and convert the SFFs named
-	<filename>EV10YMP01.sff</filename>, <filename>EV5RTWS01.sff</filename>
-	and <filename>EVX95GF02.sff</filename>.
-      </para>
-      <para>
-	This can take some time, the 1.2 million FLX reads from this example
-	need approximately 9 minutes for conversion. Your directory should now
-	look something like this:
-      </para>
-      <screen>
-<prompt>arcadia:/path/to/myProject$</prompt> <userinput>ls -lR</userinput>
--rw-r--r-- 1 bach users 231698898 2007-10-21 15:16 bchoc.fastq
--rw-r--r-- 1 bach users 193962260 2007-10-21 15:16 bchoc.xml
--rw-rw-rw- 1 bach users 475849664 2007-09-23 10:10 EV10YMP01.sff
--rw-rw-rw- 1 bach users 452630172 2007-09-25 08:59 EV5RTWS01.sff
--rw-rw-rw- 1 bach users 436489612 2007-09-21 08:39 EVX95GF02.sff
-      </screen>
-    </sect2>
-    <sect2 id="sect_sra_extracting_pairedend_data_from_sff">
-      <title>
-	Extracting paired-end data
-      </title>
-      <para>
-	The paired-end protocol of 454 will generate reads which contain the
-	front and the back of a DNA template, separated by a linker sequence. You have
-	to know the linker sequence! Ask your sequencing provider to give it
-	to you. If standard protocols were used, then the linker sequence for
-	GS20 and FLX will be
-      </para>
-      <screen>
->flxlinker
-GTTGGAACCGAAAGGGTTTGAATTCAAACCCTTTCGGTTCCAAC</screen>
-      <para>
-	while for Titanium data, you need to use two linker sequences
-      </para>
-      <screen>
->titlinker1
-TCGTATAACTTCGTATAATGTATGCTATACGAAGTTATTACG
->titlinker2
-CGTAATAACTTCGTATAGCATACATTATACGAAGTTATACGA</screen>
-      <para>
-	For this example, the sequencing provider used the standard unmodified
-	454 FLX linker. Put that linker sequence into a FASTA file and copy
-	to wherever you like.
-      </para>
-      <screen>
-<prompt>arcadia:bceti_assembly/data$</prompt> <userinput>cp /from/whereever/your/file/is/linker.fasta ../origdata</userinput>
-<prompt>arcadia:bceti_assembly/data$</prompt> <userinput>ls -l ../origdata</userinput>
--rw-r--r-- 1 bach users        53 2008-11-08 17:32 linker.fasta
--rw-r--r-- 1 bach users 544623256 2008-11-08 16:49 SRR005481.sff
--rw-r--r-- 1 bach users 476632488 2008-11-08 16:55 SRR005482.sff
-<prompt>arcadia:bceti_assembly/data$</prompt> <userinput>cat ../origdata/linker.fasta</userinput>
->flxlinker
-GTTGGAACCGAAAGGGTTTGAATTCAAACCCTTTCGGTTCCAAC</screen>
-      <para>
-	Now let's extract the paired end sequences, and this may take eight to
-	ten minutes.
-      </para>
-      <screen>
-<prompt>arcadia:bceti_assembly/data$</prompt> <userinput>sff_extract -Q -o bceti
-  -a -l linker.fasta
-  SRR005482.sff</userinput>
-
-Testing whether SSAHA2 is installed and can be launched ...  ok.
-Working on 'SRR005482.sff':
-Creating temporary file from sequences in 'SRR005482.sff' ... done.
-Searching linker sequences with SSAHA2 (this may take a while) ...  ok.
-Parsing SSAHA2 result file ...  done.
-Converting 'SRR005482.sff' ...  done.
-Converted 268084 reads into 415327 sequences.</screen>
-      <para>
-	The above text tells you that the conversion process saw 268084 reads
-	in the SFF. Searching for the paired-end linker and removing it,
-	415327 sequences were created. Obviously, some sequences had either no
-	linker or the linker was on the far edges of the read so that the
-	'split' resulted into just one sequences.
-      </para>
-      <para>
-	The directory will now look like this:
-      </para>
-      <screen>
-<prompt>arcadia:bceti_assembly/data$</prompt> <userinput>ls -l</userinput>
--rw-r--r-- 1 bach users 170346423 2008-11-08 17:55 bceti.fastq
--rw-r--r-- 1 bach users 165413112 2008-11-08 17:55 bceti.xml
--rw-r--r-- 1 bach users 476632488 2008-11-08 16:55 SRR005482.sff</screen>
-      <para>
-	That's it.
-      </para>
-    </sect2>
-  </sect1>
-</chapter>
\ No newline at end of file
diff --git a/doc/docbook/copyrightfile b/doc/docbook/copyrightfile
deleted file mode 100644
index edf0235..0000000
--- a/doc/docbook/copyrightfile
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" ?>
-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.docbook.org/xml/4.5/docbookx.dtd">
-<copyright><year>2014</year><holder>Bastien Chevreux</holder></copyright>
-
diff --git a/doc/docbook/doccss/miradocstyle.css b/doc/docbook/doccss/miradocstyle.css
index 80e8175..e86b344 100644
--- a/doc/docbook/doccss/miradocstyle.css
+++ b/doc/docbook/doccss/miradocstyle.css
@@ -23,12 +23,4 @@
 
 .underline {
     text-decoration: underline;
-}
-
-.sidebar {
-  background-color: #FFFFcc ;
-  border: 1px solid #000066 ;
-  margin-left: 1cm;
-  margin-right: 1cm;
-}
-
+}
\ No newline at end of file
diff --git a/doc/docbook/replace_all.sh b/doc/docbook/replace_all.sh
deleted file mode 100644
index feed7d8..0000000
--- a/doc/docbook/replace_all.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-
-FROM=strainname
-TO=strain_name
-
-for f in *xml; do
-  echo $f
-  sed -e "s/$FROM/$TO/g" $f >bla
-  mv bla $f
-done
diff --git a/doc/docbook/version.stub b/doc/docbook/versionfile
similarity index 73%
rename from doc/docbook/version.stub
rename to doc/docbook/versionfile
index e16b253..0e30198 100644
--- a/doc/docbook/version.stub
+++ b/doc/docbook/versionfile
@@ -1,2 +1,3 @@
 <?xml version="1.0" ?>
 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.docbook.org/xml/4.5/docbookx.dtd">
+ <releaseinfo>MIRA Version 3.4.0</releaseinfo>
diff --git a/doc/docbook/warning_frontofchapter.xml b/doc/docbook/warning_frontofchapter.xml
deleted file mode 100644
index 4bbbcf9..0000000
--- a/doc/docbook/warning_frontofchapter.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" ?>
-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.docbook.org/xml/4.5/docbookx.dtd">
-<warning>
-  <para>
-  The documentation of MIRA 3.9.x has not completely caught up yet with the changes introduced by MIRA now using manifest files. Quite a number of recipes still show the old command-line style, e.g.:
-  </para>
-  <screen>
-mira --project=... --job=... ...</screen>
-  <para>
-    For those cases, please refer to chapter 3 (the reference) for how to write manifest files.
-  </para>
-</warning>
diff --git a/doccss/miradocstyle.css b/doccss/miradocstyle.css
deleted file mode 100644
index 80e8175..0000000
--- a/doccss/miradocstyle.css
+++ /dev/null
@@ -1,34 +0,0 @@
-.screen {
-    background-color : gainsboro;
-    color : navy;
-}
-
-.prompt {
-    background-color : gainsboro;
-    color : black;
-}
-
-.userinput {
-    background-color : gainsboro;
-    color : red;
-}
-
-.releaseinfo {
-    color : red;
-}
-
-.light {
-    color : lightgrey;
-}
-
-.underline {
-    text-decoration: underline;
-}
-
-.sidebar {
-  background-color: #FFFFcc ;
-  border: 1px solid #000066 ;
-  margin-left: 1cm;
-  margin-right: 1cm;
-}
-
diff --git a/ltmain.sh b/ltmain.sh
old mode 100644
new mode 100755
index c2852d8..fa4b1e1
--- a/ltmain.sh
+++ b/ltmain.sh
@@ -1,9 +1,9 @@
+# Generated from ltmain.m4sh.
 
-# libtool (GNU libtool) 2.4.2
+# ltmain.sh (GNU libtool) 2.2.6b
 # Written by Gordon Matzigkeit <gord at gnu.ai.mit.edu>, 1996
 
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
-# 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.
 # This is free software; see the source for copying conditions.  There is NO
 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
@@ -32,57 +32,50 @@
 #
 # Provide generalized library-building support services.
 #
-#       --config             show all configuration variables
-#       --debug              enable verbose shell tracing
-#   -n, --dry-run            display commands without modifying any files
-#       --features           display basic configuration information and exit
-#       --mode=MODE          use operation mode MODE
-#       --preserve-dup-deps  don't remove duplicate dependency libraries
-#       --quiet, --silent    don't print informational messages
-#       --no-quiet, --no-silent
-#                            print informational messages (default)
-#       --no-warn            don't display warning messages
-#       --tag=TAG            use configuration variables from tag TAG
-#   -v, --verbose            print more informational messages than default
-#       --no-verbose         don't print the extra informational messages
-#       --version            print version information
-#   -h, --help, --help-all   print short, long, or detailed help message
+#     --config             show all configuration variables
+#     --debug              enable verbose shell tracing
+# -n, --dry-run            display commands without modifying any files
+#     --features           display basic configuration information and exit
+#     --mode=MODE          use operation mode MODE
+#     --preserve-dup-deps  don't remove duplicate dependency libraries
+#     --quiet, --silent    don't print informational messages
+#     --tag=TAG            use configuration variables from tag TAG
+# -v, --verbose            print informational messages (default)
+#     --version            print version information
+# -h, --help               print short or long help message
 #
 # MODE must be one of the following:
 #
-#         clean              remove files from the build directory
-#         compile            compile a source file into a libtool object
-#         execute            automatically set library path, then run a program
-#         finish             complete the installation of libtool libraries
-#         install            install libraries or executables
-#         link               create a library or an executable
-#         uninstall          remove libraries from an installed directory
+#       clean              remove files from the build directory
+#       compile            compile a source file into a libtool object
+#       execute            automatically set library path, then run a program
+#       finish             complete the installation of libtool libraries
+#       install            install libraries or executables
+#       link               create a library or an executable
+#       uninstall          remove libraries from an installed directory
 #
-# MODE-ARGS vary depending on the MODE.  When passed as first option,
-# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
+# MODE-ARGS vary depending on the MODE.
 # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
 #
 # When reporting a bug, please describe a test case to reproduce it and
 # include the following information:
 #
-#         host-triplet:	$host
-#         shell:		$SHELL
-#         compiler:		$LTCC
-#         compiler flags:		$LTCFLAGS
-#         linker:		$LD (gnu? $with_gnu_ld)
-#         $progname:	(GNU libtool) 2.4.2 Debian-2.4.2-1ubuntu1
-#         automake:	$automake_version
-#         autoconf:	$autoconf_version
+#       host-triplet:	$host
+#       shell:		$SHELL
+#       compiler:		$LTCC
+#       compiler flags:		$LTCFLAGS
+#       linker:		$LD (gnu? $with_gnu_ld)
+#       $progname:		(GNU libtool) 2.2.6b Debian-2.2.6b-2ubuntu3
+#       automake:		$automake_version
+#       autoconf:		$autoconf_version
 #
 # Report bugs to <bug-libtool at gnu.org>.
-# GNU libtool home page: <http://www.gnu.org/software/libtool/>.
-# General help using GNU software: <http://www.gnu.org/gethelp/>.
 
-PROGRAM=libtool
+PROGRAM=ltmain.sh
 PACKAGE=libtool
-VERSION="2.4.2 Debian-2.4.2-1ubuntu1"
+VERSION="2.2.6b Debian-2.2.6b-2ubuntu3"
 TIMESTAMP=""
-package_revision=1.3337
+package_revision=1.3017
 
 # Be Bourne compatible
 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
@@ -98,15 +91,10 @@ fi
 BIN_SH=xpg4; export BIN_SH # for Tru64
 DUALCASE=1; export DUALCASE # for MKS sh
 
-# A function that is used when there is no print builtin or printf.
-func_fallback_echo ()
-{
-  eval 'cat <<_LTECHO_EOF
-$1
-_LTECHO_EOF'
-}
-
 # NLS nuisances: We save the old values to restore during execute mode.
+# Only set LANG and LC_ALL to C if already set.
+# These must not be set unconditionally because not all systems understand
+# e.g. LANG=C (notably SCO).
 lt_user_locale=
 lt_safe_locale=
 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
@@ -119,28 +107,24 @@ do
 	  lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
 	fi"
 done
-LC_ALL=C
-LANGUAGE=C
-export LANGUAGE LC_ALL
 
 $lt_unset CDPATH
 
 
-# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
-# is ksh but when the shell is invoked as "sh" and the current value of
-# the _XPG environment variable is not equal to 1 (one), the special
-# positional parameter $0, within a function call, is the name of the
-# function.
-progpath="$0"
 
 
 
 : ${CP="cp -f"}
-test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
+: ${ECHO="echo"}
+: ${EGREP="/bin/grep -E"}
+: ${FGREP="/bin/grep -F"}
+: ${GREP="/bin/grep"}
+: ${LN_S="ln -s"}
 : ${MAKE="make"}
 : ${MKDIR="mkdir"}
 : ${MV="mv -f"}
 : ${RM="rm -f"}
+: ${SED="/bin/sed"}
 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
 : ${Xsed="$SED -e 1s/^X//"}
 
@@ -160,27 +144,6 @@ IFS=" 	$lt_nl"
 dirname="s,/[^/]*$,,"
 basename="s,^.*/,,"
 
-# func_dirname file append nondir_replacement
-# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
-# otherwise set result to NONDIR_REPLACEMENT.
-func_dirname ()
-{
-    func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
-    if test "X$func_dirname_result" = "X${1}"; then
-      func_dirname_result="${3}"
-    else
-      func_dirname_result="$func_dirname_result${2}"
-    fi
-} # func_dirname may be replaced by extended shell implementation
-
-
-# func_basename file
-func_basename ()
-{
-    func_basename_result=`$ECHO "${1}" | $SED "$basename"`
-} # func_basename may be replaced by extended shell implementation
-
-
 # func_dirname_and_basename file append nondir_replacement
 # perform func_basename and func_dirname in a single function
 # call:
@@ -195,183 +158,33 @@ func_basename ()
 # those functions but instead duplicate the functionality here.
 func_dirname_and_basename ()
 {
-    # Extract subdirectory from the argument.
-    func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
-    if test "X$func_dirname_result" = "X${1}"; then
-      func_dirname_result="${3}"
-    else
-      func_dirname_result="$func_dirname_result${2}"
-    fi
-    func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
-} # func_dirname_and_basename may be replaced by extended shell implementation
-
-
-# func_stripname prefix suffix name
-# strip PREFIX and SUFFIX off of NAME.
-# PREFIX and SUFFIX must not contain globbing or regex special
-# characters, hashes, percent signs, but SUFFIX may contain a leading
-# dot (in which case that matches only a dot).
-# func_strip_suffix prefix name
-func_stripname ()
-{
-    case ${2} in
-      .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
-      *)  func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
-    esac
-} # func_stripname may be replaced by extended shell implementation
-
-
-# These SED scripts presuppose an absolute path with a trailing slash.
-pathcar='s,^/\([^/]*\).*$,\1,'
-pathcdr='s,^/[^/]*,,'
-removedotparts=':dotsl
-		s@/\./@/@g
-		t dotsl
-		s,/\.$,/,'
-collapseslashes='s@/\{1,\}@/@g'
-finalslash='s,/*$,/,'
-
-# func_normal_abspath PATH
-# Remove doubled-up and trailing slashes, "." path components,
-# and cancel out any ".." path components in PATH after making
-# it an absolute path.
-#             value returned in "$func_normal_abspath_result"
-func_normal_abspath ()
-{
-  # Start from root dir and reassemble the path.
-  func_normal_abspath_result=
-  func_normal_abspath_tpath=$1
-  func_normal_abspath_altnamespace=
-  case $func_normal_abspath_tpath in
-    "")
-      # Empty path, that just means $cwd.
-      func_stripname '' '/' "`pwd`"
-      func_normal_abspath_result=$func_stripname_result
-      return
-    ;;
-    # The next three entries are used to spot a run of precisely
-    # two leading slashes without using negated character classes;
-    # we take advantage of case's first-match behaviour.
-    ///*)
-      # Unusual form of absolute path, do nothing.
-    ;;
-    //*)
-      # Not necessarily an ordinary path; POSIX reserves leading '//'
-      # and for example Cygwin uses it to access remote file shares
-      # over CIFS/SMB, so we conserve a leading double slash if found.
-      func_normal_abspath_altnamespace=/
-    ;;
-    /*)
-      # Absolute path, do nothing.
-    ;;
-    *)
-      # Relative path, prepend $cwd.
-      func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
-    ;;
-  esac
-  # Cancel out all the simple stuff to save iterations.  We also want
-  # the path to end with a slash for ease of parsing, so make sure
-  # there is one (and only one) here.
-  func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
-        -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
-  while :; do
-    # Processed it all yet?
-    if test "$func_normal_abspath_tpath" = / ; then
-      # If we ascended to the root using ".." the result may be empty now.
-      if test -z "$func_normal_abspath_result" ; then
-        func_normal_abspath_result=/
-      fi
-      break
-    fi
-    func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
-        -e "$pathcar"`
-    func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
-        -e "$pathcdr"`
-    # Figure out what to do with it
-    case $func_normal_abspath_tcomponent in
-      "")
-        # Trailing empty path component, ignore it.
-      ;;
-      ..)
-        # Parent dir; strip last assembled component from result.
-        func_dirname "$func_normal_abspath_result"
-        func_normal_abspath_result=$func_dirname_result
-      ;;
-      *)
-        # Actual path component, append it.
-        func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
-      ;;
-    esac
-  done
-  # Restore leading double-slash if one was found on entry.
-  func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
+  # Extract subdirectory from the argument.
+  func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
+  if test "X$func_dirname_result" = "X${1}"; then
+    func_dirname_result="${3}"
+  else
+    func_dirname_result="$func_dirname_result${2}"
+  fi
+  func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
 }
 
-# func_relative_path SRCDIR DSTDIR
-# generates a relative path from SRCDIR to DSTDIR, with a trailing
-# slash if non-empty, suitable for immediately appending a filename
-# without needing to append a separator.
-#             value returned in "$func_relative_path_result"
-func_relative_path ()
-{
-  func_relative_path_result=
-  func_normal_abspath "$1"
-  func_relative_path_tlibdir=$func_normal_abspath_result
-  func_normal_abspath "$2"
-  func_relative_path_tbindir=$func_normal_abspath_result
-
-  # Ascend the tree starting from libdir
-  while :; do
-    # check if we have found a prefix of bindir
-    case $func_relative_path_tbindir in
-      $func_relative_path_tlibdir)
-        # found an exact match
-        func_relative_path_tcancelled=
-        break
-        ;;
-      $func_relative_path_tlibdir*)
-        # found a matching prefix
-        func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
-        func_relative_path_tcancelled=$func_stripname_result
-        if test -z "$func_relative_path_result"; then
-          func_relative_path_result=.
-        fi
-        break
-        ;;
-      *)
-        func_dirname $func_relative_path_tlibdir
-        func_relative_path_tlibdir=${func_dirname_result}
-        if test "x$func_relative_path_tlibdir" = x ; then
-          # Have to descend all the way to the root!
-          func_relative_path_result=../$func_relative_path_result
-          func_relative_path_tcancelled=$func_relative_path_tbindir
-          break
-        fi
-        func_relative_path_result=../$func_relative_path_result
-        ;;
-    esac
-  done
-
-  # Now calculate path; take care to avoid doubling-up slashes.
-  func_stripname '' '/' "$func_relative_path_result"
-  func_relative_path_result=$func_stripname_result
-  func_stripname '/' '/' "$func_relative_path_tcancelled"
-  if test "x$func_stripname_result" != x ; then
-    func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
-  fi
+# Generated shell functions inserted here.
 
-  # Normalisation. If bindir is libdir, return empty string,
-  # else relative path ending with a slash; either way, target
-  # file name can be directly appended.
-  if test ! -z "$func_relative_path_result"; then
-    func_stripname './' '' "$func_relative_path_result/"
-    func_relative_path_result=$func_stripname_result
-  fi
-}
+# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
+# is ksh but when the shell is invoked as "sh" and the current value of
+# the _XPG environment variable is not equal to 1 (one), the special
+# positional parameter $0, within a function call, is the name of the
+# function.
+progpath="$0"
 
 # The name of this program:
+# In the unlikely event $progname began with a '-', it would play havoc with
+# func_echo (imagine progname=-n), so we prepend ./ in that case:
 func_dirname_and_basename "$progpath"
 progname=$func_basename_result
+case $progname in
+  -*) progname=./$progname ;;
+esac
 
 # Make sure we have an absolute path for reexecution:
 case $progpath in
@@ -383,7 +196,7 @@ case $progpath in
      ;;
   *)
      save_IFS="$IFS"
-     IFS=${PATH_SEPARATOR-:}
+     IFS=:
      for progdir in $PATH; do
        IFS="$save_IFS"
        test -x "$progdir/$progname" && break
@@ -402,15 +215,6 @@ sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
 # Same as above, but do not quote variable references.
 double_quote_subst='s/\(["`\\]\)/\\\1/g'
 
-# Sed substitution that turns a string into a regex matching for the
-# string literally.
-sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
-
-# Sed substitution that converts a w32 file name or path
-# which contains forward slashes, into one that contains
-# (escaped) backslashes.  A very naive implementation.
-lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
-
 # Re-`\' parameter expansions in output of double_quote_subst that were
 # `\'-ed in input to the same.  If an odd number of `\' preceded a '$'
 # in input to double_quote_subst, that '$' was protected from expansion.
@@ -439,7 +243,7 @@ opt_warning=:
 # name if it has been set yet.
 func_echo ()
 {
-    $ECHO "$progname: ${opt_mode+$opt_mode: }$*"
+    $ECHO "$progname${mode+: }$mode: $*"
 }
 
 # func_verbose arg...
@@ -454,25 +258,18 @@ func_verbose ()
     :
 }
 
-# func_echo_all arg...
-# Invoke $ECHO with all args, space-separated.
-func_echo_all ()
-{
-    $ECHO "$*"
-}
-
 # func_error arg...
 # Echo program name prefixed message to standard error.
 func_error ()
 {
-    $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
+    $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
 }
 
 # func_warning arg...
 # Echo program name prefixed warning message to standard error.
 func_warning ()
 {
-    $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
+    $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
 
     # bash bug again:
     :
@@ -529,9 +326,9 @@ func_mkdir_p ()
         case $my_directory_path in */*) ;; *) break ;; esac
 
         # ...otherwise throw away the child directory and loop
-        my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
+        my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
       done
-      my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
+      my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
 
       save_mkdir_p_IFS="$IFS"; IFS=':'
       for my_dir in $my_dir_list; do
@@ -581,7 +378,7 @@ func_mktempdir ()
         func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
     fi
 
-    $ECHO "$my_tmpdir"
+    $ECHO "X$my_tmpdir" | $Xsed
 }
 
 
@@ -595,7 +392,7 @@ func_quote_for_eval ()
 {
     case $1 in
       *[\\\`\"\$]*)
-	func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
+	func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
       *)
         func_quote_for_eval_unquoted_result="$1" ;;
     esac
@@ -622,7 +419,7 @@ func_quote_for_expand ()
 {
     case $1 in
       *[\\\`\"]*)
-	my_arg=`$ECHO "$1" | $SED \
+	my_arg=`$ECHO "X$1" | $Xsed \
 	    -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
       *)
         my_arg="$1" ;;
@@ -691,39 +488,15 @@ func_show_eval_locale ()
     fi
 }
 
-# func_tr_sh
-# Turn $1 into a string suitable for a shell variable name.
-# Result is stored in $func_tr_sh_result.  All characters
-# not in the set a-zA-Z0-9_ are replaced with '_'. Further,
-# if $1 begins with a digit, a '_' is prepended as well.
-func_tr_sh ()
-{
-  case $1 in
-  [0-9]* | *[!a-zA-Z0-9_]*)
-    func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
-    ;;
-  * )
-    func_tr_sh_result=$1
-    ;;
-  esac
-}
+
+
 
 
 # func_version
 # Echo version message to standard output and exit.
 func_version ()
 {
-    $opt_debug
-
-    $SED -n '/(C)/!b go
-	:more
-	/\./!{
-	  N
-	  s/\n# / /
-	  b more
-	}
-	:go
-	/^# '$PROGRAM' (GNU /,/# warranty; / {
+    $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
         s/^# //
 	s/^# *$//
         s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
@@ -736,28 +509,22 @@ func_version ()
 # Echo short help message to standard output and exit.
 func_usage ()
 {
-    $opt_debug
-
-    $SED -n '/^# Usage:/,/^#  *.*--help/ {
+    $SED -n '/^# Usage:/,/# -h/ {
         s/^# //
 	s/^# *$//
 	s/\$progname/'$progname'/
 	p
     }' < "$progpath"
-    echo
+    $ECHO
     $ECHO "run \`$progname --help | more' for full usage"
     exit $?
 }
 
-# func_help [NOEXIT]
-# Echo long help message to standard output and exit,
-# unless 'noexit' is passed as argument.
+# func_help
+# Echo long help message to standard output and exit.
 func_help ()
 {
-    $opt_debug
-
     $SED -n '/^# Usage:/,/# Report bugs to/ {
-	:print
         s/^# //
 	s/^# *$//
 	s*\$progname*'$progname'*
@@ -767,18 +534,11 @@ func_help ()
 	s*\$LTCFLAGS*'"$LTCFLAGS"'*
 	s*\$LD*'"$LD"'*
 	s/\$with_gnu_ld/'"$with_gnu_ld"'/
-	s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/
-	s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/
+	s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
+	s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
 	p
-	d
-     }
-     /^# .* home page:/b print
-     /^# General help using/b print
-     ' < "$progpath"
-    ret=$?
-    if test -z "$1"; then
-      exit $ret
-    fi
+     }' < "$progpath"
+    exit $?
 }
 
 # func_missing_arg argname
@@ -786,106 +546,63 @@ func_help ()
 # exit_cmd.
 func_missing_arg ()
 {
-    $opt_debug
-
-    func_error "missing argument for $1."
+    func_error "missing argument for $1"
     exit_cmd=exit
 }
 
+exit_cmd=:
 
-# func_split_short_opt shortopt
-# Set func_split_short_opt_name and func_split_short_opt_arg shell
-# variables after splitting SHORTOPT after the 2nd character.
-func_split_short_opt ()
-{
-    my_sed_short_opt='1s/^\(..\).*$/\1/;q'
-    my_sed_short_rest='1s/^..\(.*\)$/\1/;q'
-
-    func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"`
-    func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"`
-} # func_split_short_opt may be replaced by extended shell implementation
-
-
-# func_split_long_opt longopt
-# Set func_split_long_opt_name and func_split_long_opt_arg shell
-# variables after splitting LONGOPT at the `=' sign.
-func_split_long_opt ()
-{
-    my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q'
-    my_sed_long_arg='1s/^--[^=]*=//'
-
-    func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"`
-    func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"`
-} # func_split_long_opt may be replaced by extended shell implementation
 
-exit_cmd=:
 
 
 
+# Check that we have a working $ECHO.
+if test "X$1" = X--no-reexec; then
+  # Discard the --no-reexec flag, and continue.
+  shift
+elif test "X$1" = X--fallback-echo; then
+  # Avoid inline document here, it may be left over
+  :
+elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
+  # Yippee, $ECHO works!
+  :
+else
+  # Restart under the correct shell, and then maybe $ECHO will work.
+  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
+fi
 
+if test "X$1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat <<EOF
+$*
+EOF
+  exit $EXIT_SUCCESS
+fi
 
 magic="%%%MAGIC variable%%%"
 magic_exe="%%%MAGIC EXE variable%%%"
 
 # Global variables.
+# $mode is unset
 nonopt=
+execute_dlfiles=
 preserve_args=
 lo2o="s/\\.lo\$/.${objext}/"
 o2lo="s/\\.${objext}\$/.lo/"
 extracted_archives=
 extracted_serial=0
 
+opt_dry_run=false
+opt_duplicate_deps=false
+opt_silent=false
+opt_debug=:
+
 # If this variable is set in any of the actions, the command in it
 # will be execed at the end.  This prevents here-documents from being
 # left over by shells.
 exec_cmd=
 
-# func_append var value
-# Append VALUE to the end of shell variable VAR.
-func_append ()
-{
-    eval "${1}=\$${1}\${2}"
-} # func_append may be replaced by extended shell implementation
-
-# func_append_quoted var value
-# Quote VALUE and append to the end of shell variable VAR, separated
-# by a space.
-func_append_quoted ()
-{
-    func_quote_for_eval "${2}"
-    eval "${1}=\$${1}\\ \$func_quote_for_eval_result"
-} # func_append_quoted may be replaced by extended shell implementation
-
-
-# func_arith arithmetic-term...
-func_arith ()
-{
-    func_arith_result=`expr "${@}"`
-} # func_arith may be replaced by extended shell implementation
-
-
-# func_len string
-# STRING may not start with a hyphen.
-func_len ()
-{
-    func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len`
-} # func_len may be replaced by extended shell implementation
-
-
-# func_lo2o object
-func_lo2o ()
-{
-    func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
-} # func_lo2o may be replaced by extended shell implementation
-
-
-# func_xform libobj-or-source
-func_xform ()
-{
-    func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
-} # func_xform may be replaced by extended shell implementation
-
-
 # func_fatal_configuration arg...
 # Echo program name prefixed message to standard error, followed by
 # a configuration failure hint, and exit.
@@ -919,16 +636,16 @@ func_config ()
 # Display the features supported by this script.
 func_features ()
 {
-    echo "host: $host"
+    $ECHO "host: $host"
     if test "$build_libtool_libs" = yes; then
-      echo "enable shared libraries"
+      $ECHO "enable shared libraries"
     else
-      echo "disable shared libraries"
+      $ECHO "disable shared libraries"
     fi
     if test "$build_old_libs" = yes; then
-      echo "enable static libraries"
+      $ECHO "enable static libraries"
     else
-      echo "disable static libraries"
+      $ECHO "disable static libraries"
     fi
 
     exit $?
@@ -975,209 +692,117 @@ func_enable_tag ()
   esac
 }
 
-# func_check_version_match
-# Ensure that we are using m4 macros, and libtool script from the same
-# release of libtool.
-func_check_version_match ()
+# Parse options once, thoroughly.  This comes as soon as possible in
+# the script to make things like `libtool --version' happen quickly.
 {
-  if test "$package_revision" != "$macro_revision"; then
-    if test "$VERSION" != "$macro_version"; then
-      if test -z "$macro_version"; then
-        cat >&2 <<_LT_EOF
-$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
-$progname: definition of this LT_INIT comes from an older release.
-$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
-$progname: and run autoconf again.
-_LT_EOF
-      else
-        cat >&2 <<_LT_EOF
-$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
-$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
-$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
-$progname: and run autoconf again.
-_LT_EOF
-      fi
-    else
-      cat >&2 <<_LT_EOF
-$progname: Version mismatch error.  This is $PACKAGE $VERSION, revision $package_revision,
-$progname: but the definition of this LT_INIT comes from revision $macro_revision.
-$progname: You should recreate aclocal.m4 with macros from revision $package_revision
-$progname: of $PACKAGE $VERSION and run autoconf again.
-_LT_EOF
-    fi
-
-    exit $EXIT_MISMATCH
-  fi
-}
-
-
-# Shorthand for --mode=foo, only valid as the first argument
-case $1 in
-clean|clea|cle|cl)
-  shift; set dummy --mode clean ${1+"$@"}; shift
-  ;;
-compile|compil|compi|comp|com|co|c)
-  shift; set dummy --mode compile ${1+"$@"}; shift
-  ;;
-execute|execut|execu|exec|exe|ex|e)
-  shift; set dummy --mode execute ${1+"$@"}; shift
-  ;;
-finish|finis|fini|fin|fi|f)
-  shift; set dummy --mode finish ${1+"$@"}; shift
-  ;;
-install|instal|insta|inst|ins|in|i)
-  shift; set dummy --mode install ${1+"$@"}; shift
-  ;;
-link|lin|li|l)
-  shift; set dummy --mode link ${1+"$@"}; shift
-  ;;
-uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
-  shift; set dummy --mode uninstall ${1+"$@"}; shift
-  ;;
-esac
-
-
-
-# Option defaults:
-opt_debug=:
-opt_dry_run=false
-opt_config=false
-opt_preserve_dup_deps=false
-opt_features=false
-opt_finish=false
-opt_help=false
-opt_help_all=false
-opt_silent=:
-opt_warning=:
-opt_verbose=:
-opt_silent=false
-opt_verbose=false
 
+  # Shorthand for --mode=foo, only valid as the first argument
+  case $1 in
+  clean|clea|cle|cl)
+    shift; set dummy --mode clean ${1+"$@"}; shift
+    ;;
+  compile|compil|compi|comp|com|co|c)
+    shift; set dummy --mode compile ${1+"$@"}; shift
+    ;;
+  execute|execut|execu|exec|exe|ex|e)
+    shift; set dummy --mode execute ${1+"$@"}; shift
+    ;;
+  finish|finis|fini|fin|fi|f)
+    shift; set dummy --mode finish ${1+"$@"}; shift
+    ;;
+  install|instal|insta|inst|ins|in|i)
+    shift; set dummy --mode install ${1+"$@"}; shift
+    ;;
+  link|lin|li|l)
+    shift; set dummy --mode link ${1+"$@"}; shift
+    ;;
+  uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
+    shift; set dummy --mode uninstall ${1+"$@"}; shift
+    ;;
+  esac
 
-# Parse options once, thoroughly.  This comes as soon as possible in the
-# script to make things like `--version' happen as quickly as we can.
-{
-  # this just eases exit handling
-  while test $# -gt 0; do
+  # Parse non-mode specific arguments:
+  while test "$#" -gt 0; do
     opt="$1"
     shift
+
     case $opt in
-      --debug|-x)	opt_debug='set -x'
+      --config)		func_config					;;
+
+      --debug)		preserve_args="$preserve_args $opt"
 			func_echo "enabling shell trace mode"
+			opt_debug='set -x'
 			$opt_debug
 			;;
-      --dry-run|--dryrun|-n)
-			opt_dry_run=:
-			;;
-      --config)
-			opt_config=:
-func_config
-			;;
-      --dlopen|-dlopen)
-			optarg="$1"
-			opt_dlopen="${opt_dlopen+$opt_dlopen
-}$optarg"
+
+      -dlopen)		test "$#" -eq 0 && func_missing_arg "$opt" && break
+			execute_dlfiles="$execute_dlfiles $1"
 			shift
 			;;
-      --preserve-dup-deps)
-			opt_preserve_dup_deps=:
-			;;
-      --features)
-			opt_features=:
-func_features
-			;;
-      --finish)
-			opt_finish=:
-set dummy --mode finish ${1+"$@"}; shift
-			;;
-      --help)
-			opt_help=:
-			;;
-      --help-all)
-			opt_help_all=:
-opt_help=': help-all'
-			;;
-      --mode)
-			test $# = 0 && func_missing_arg $opt && break
-			optarg="$1"
-			opt_mode="$optarg"
-case $optarg in
-  # Valid mode arguments:
-  clean|compile|execute|finish|install|link|relink|uninstall) ;;
-
-  # Catch anything else as an error
-  *) func_error "invalid argument for $opt"
-     exit_cmd=exit
-     break
-     ;;
-esac
+
+      --dry-run | -n)	opt_dry_run=:					;;
+      --features)       func_features					;;
+      --finish)		mode="finish"					;;
+
+      --mode)		test "$#" -eq 0 && func_missing_arg "$opt" && break
+			case $1 in
+			  # Valid mode arguments:
+			  clean)	;;
+			  compile)	;;
+			  execute)	;;
+			  finish)	;;
+			  install)	;;
+			  link)		;;
+			  relink)	;;
+			  uninstall)	;;
+
+			  # Catch anything else as an error
+			  *) func_error "invalid argument for $opt"
+			     exit_cmd=exit
+			     break
+			     ;;
+		        esac
+
+			mode="$1"
 			shift
 			;;
-      --no-silent|--no-quiet)
-			opt_silent=false
-func_append preserve_args " $opt"
-			;;
-      --no-warning|--no-warn)
-			opt_warning=false
-func_append preserve_args " $opt"
-			;;
-      --no-verbose)
-			opt_verbose=false
-func_append preserve_args " $opt"
-			;;
-      --silent|--quiet)
+
+      --preserve-dup-deps)
+			opt_duplicate_deps=:				;;
+
+      --quiet|--silent)	preserve_args="$preserve_args $opt"
 			opt_silent=:
-func_append preserve_args " $opt"
-        opt_verbose=false
 			;;
-      --verbose|-v)
-			opt_verbose=:
-func_append preserve_args " $opt"
-opt_silent=false
+
+      --verbose| -v)	preserve_args="$preserve_args $opt"
+			opt_silent=false
 			;;
-      --tag)
-			test $# = 0 && func_missing_arg $opt && break
-			optarg="$1"
-			opt_tag="$optarg"
-func_append preserve_args " $opt $optarg"
-func_enable_tag "$optarg"
+
+      --tag)		test "$#" -eq 0 && func_missing_arg "$opt" && break
+			preserve_args="$preserve_args $opt $1"
+			func_enable_tag "$1"	# tagname is set here
 			shift
 			;;
 
-      -\?|-h)		func_usage				;;
-      --help)		func_help				;;
-      --version)	func_version				;;
-
       # Separate optargs to long options:
-      --*=*)
-			func_split_long_opt "$opt"
-			set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"}
+      -dlopen=*|--mode=*|--tag=*)
+			func_opt_split "$opt"
+			set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
 			shift
 			;;
 
-      # Separate non-argument short options:
-      -\?*|-h*|-n*|-v*)
-			func_split_short_opt "$opt"
-			set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"}
-			shift
-			;;
+      -\?|-h)		func_usage					;;
+      --help)		opt_help=:					;;
+      --version)	func_version					;;
 
-      --)		break					;;
-      -*)		func_fatal_help "unrecognized option \`$opt'" ;;
-      *)		set dummy "$opt" ${1+"$@"};	shift; break  ;;
+      -*)		func_fatal_help "unrecognized option \`$opt'"	;;
+
+      *)		nonopt="$opt"
+			break
+			;;
     esac
   done
 
-  # Validate options:
-
-  # save first non-option argument
-  if test "$#" -gt 0; then
-    nonopt="$opt"
-    shift
-  fi
-
-  # preserve --debug
-  test "$opt_debug" = : || func_append preserve_args " --debug"
 
   case $host in
     *cygwin* | *mingw* | *pw32* | *cegcc*)
@@ -1185,44 +810,82 @@ func_enable_tag "$optarg"
       opt_duplicate_compiler_generated_deps=:
       ;;
     *)
-      opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
+      opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
       ;;
   esac
 
-  $opt_help || {
-    # Sanity checks first:
-    func_check_version_match
+  # Having warned about all mis-specified options, bail out if
+  # anything was wrong.
+  $exit_cmd $EXIT_FAILURE
+}
 
-    if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
-      func_fatal_configuration "not configured to build any kind of library"
+# func_check_version_match
+# Ensure that we are using m4 macros, and libtool script from the same
+# release of libtool.
+func_check_version_match ()
+{
+  if test "$package_revision" != "$macro_revision"; then
+    if test "$VERSION" != "$macro_version"; then
+      if test -z "$macro_version"; then
+        cat >&2 <<_LT_EOF
+$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
+$progname: definition of this LT_INIT comes from an older release.
+$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
+$progname: and run autoconf again.
+_LT_EOF
+      else
+        cat >&2 <<_LT_EOF
+$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
+$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
+$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
+$progname: and run autoconf again.
+_LT_EOF
+      fi
+    else
+      cat >&2 <<_LT_EOF
+$progname: Version mismatch error.  This is $PACKAGE $VERSION, revision $package_revision,
+$progname: but the definition of this LT_INIT comes from revision $macro_revision.
+$progname: You should recreate aclocal.m4 with macros from revision $package_revision
+$progname: of $PACKAGE $VERSION and run autoconf again.
+_LT_EOF
     fi
 
-    # Darwin sucks
-    eval std_shrext=\"$shrext_cmds\"
+    exit $EXIT_MISMATCH
+  fi
+}
 
-    # Only execute mode is allowed to have -dlopen flags.
-    if test -n "$opt_dlopen" && test "$opt_mode" != execute; then
-      func_error "unrecognized option \`-dlopen'"
-      $ECHO "$help" 1>&2
-      exit $EXIT_FAILURE
-    fi
 
-    # Change the help message to a mode-specific one.
-    generic_help="$help"
-    help="Try \`$progname --help --mode=$opt_mode' for more information."
-  }
+## ----------- ##
+##    Main.    ##
+## ----------- ##
 
+$opt_help || {
+  # Sanity checks first:
+  func_check_version_match
 
-  # Bail if the options were screwed
-  $exit_cmd $EXIT_FAILURE
-}
+  if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
+    func_fatal_configuration "not configured to build any kind of library"
+  fi
 
+  test -z "$mode" && func_fatal_error "error: you must specify a MODE."
 
 
+  # Darwin sucks
+  eval std_shrext=\"$shrext_cmds\"
+
+
+  # Only execute mode is allowed to have -dlopen flags.
+  if test -n "$execute_dlfiles" && test "$mode" != execute; then
+    func_error "unrecognized option \`-dlopen'"
+    $ECHO "$help" 1>&2
+    exit $EXIT_FAILURE
+  fi
+
+  # Change the help message to a mode-specific one.
+  generic_help="$help"
+  help="Try \`$progname --help --mode=$mode' for more information."
+}
 
-## ----------- ##
-##    Main.    ##
-## ----------- ##
 
 # func_lalib_p file
 # True iff FILE is a libtool `.la' library or `.lo' object file.
@@ -1287,9 +950,12 @@ func_ltwrapper_executable_p ()
 # temporary ltwrapper_script.
 func_ltwrapper_scriptname ()
 {
-    func_dirname_and_basename "$1" "" "."
-    func_stripname '' '.exe' "$func_basename_result"
-    func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
+    func_ltwrapper_scriptname_result=""
+    if func_ltwrapper_executable_p "$1"; then
+	func_dirname_and_basename "$1" "" "."
+	func_stripname '' '.exe' "$func_basename_result"
+	func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
+    fi
 }
 
 # func_ltwrapper_p file
@@ -1335,37 +1001,6 @@ func_source ()
 }
 
 
-# func_resolve_sysroot PATH
-# Replace a leading = in PATH with a sysroot.  Store the result into
-# func_resolve_sysroot_result
-func_resolve_sysroot ()
-{
-  func_resolve_sysroot_result=$1
-  case $func_resolve_sysroot_result in
-  =*)
-    func_stripname '=' '' "$func_resolve_sysroot_result"
-    func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
-    ;;
-  esac
-}
-
-# func_replace_sysroot PATH
-# If PATH begins with the sysroot, replace it with = and
-# store the result into func_replace_sysroot_result.
-func_replace_sysroot ()
-{
-  case "$lt_sysroot:$1" in
-  ?*:"$lt_sysroot"*)
-    func_stripname "$lt_sysroot" '' "$1"
-    func_replace_sysroot_result="=$func_stripname_result"
-    ;;
-  *)
-    # Including no sysroot.
-    func_replace_sysroot_result=$1
-    ;;
-  esac
-}
-
 # func_infer_tag arg
 # Infer tagged configuration to use if any are available and
 # if one wasn't chosen via the "--tag" command line option.
@@ -1378,15 +1013,13 @@ func_infer_tag ()
     if test -n "$available_tags" && test -z "$tagname"; then
       CC_quoted=
       for arg in $CC; do
-	func_append_quoted CC_quoted "$arg"
+        func_quote_for_eval "$arg"
+	CC_quoted="$CC_quoted $func_quote_for_eval_result"
       done
-      CC_expanded=`func_echo_all $CC`
-      CC_quoted_expanded=`func_echo_all $CC_quoted`
       case $@ in
       # Blanks in the command may have been stripped by the calling shell,
       # but not from the CC environment variable when configure was run.
-      " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
-      " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
+      " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;;
       # Blanks at the start of $base_compile will cause this to fail
       # if we don't check for them as well.
       *)
@@ -1397,13 +1030,11 @@ func_infer_tag ()
 	    CC_quoted=
 	    for arg in $CC; do
 	      # Double-quote args containing other shell metacharacters.
-	      func_append_quoted CC_quoted "$arg"
+	      func_quote_for_eval "$arg"
+	      CC_quoted="$CC_quoted $func_quote_for_eval_result"
 	    done
-	    CC_expanded=`func_echo_all $CC`
-	    CC_quoted_expanded=`func_echo_all $CC_quoted`
 	    case "$@ " in
-	    " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
-	    " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
+	      " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*)
 	      # The compiler in the base compile command matches
 	      # the one in the tagged configuration.
 	      # Assume this is the tagged configuration we want.
@@ -1466,486 +1097,6 @@ EOF
     }
 }
 
-
-##################################################
-# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
-##################################################
-
-# func_convert_core_file_wine_to_w32 ARG
-# Helper function used by file name conversion functions when $build is *nix,
-# and $host is mingw, cygwin, or some other w32 environment. Relies on a
-# correctly configured wine environment available, with the winepath program
-# in $build's $PATH.
-#
-# ARG is the $build file name to be converted to w32 format.
-# Result is available in $func_convert_core_file_wine_to_w32_result, and will
-# be empty on error (or when ARG is empty)
-func_convert_core_file_wine_to_w32 ()
-{
-  $opt_debug
-  func_convert_core_file_wine_to_w32_result="$1"
-  if test -n "$1"; then
-    # Unfortunately, winepath does not exit with a non-zero error code, so we
-    # are forced to check the contents of stdout. On the other hand, if the
-    # command is not found, the shell will set an exit code of 127 and print
-    # *an error message* to stdout. So we must check for both error code of
-    # zero AND non-empty stdout, which explains the odd construction:
-    func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
-    if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
-      func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
-        $SED -e "$lt_sed_naive_backslashify"`
-    else
-      func_convert_core_file_wine_to_w32_result=
-    fi
-  fi
-}
-# end: func_convert_core_file_wine_to_w32
-
-
-# func_convert_core_path_wine_to_w32 ARG
-# Helper function used by path conversion functions when $build is *nix, and
-# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
-# configured wine environment available, with the winepath program in $build's
-# $PATH. Assumes ARG has no leading or trailing path separator characters.
-#
-# ARG is path to be converted from $build format to win32.
-# Result is available in $func_convert_core_path_wine_to_w32_result.
-# Unconvertible file (directory) names in ARG are skipped; if no directory names
-# are convertible, then the result may be empty.
-func_convert_core_path_wine_to_w32 ()
-{
-  $opt_debug
-  # unfortunately, winepath doesn't convert paths, only file names
-  func_convert_core_path_wine_to_w32_result=""
-  if test -n "$1"; then
-    oldIFS=$IFS
-    IFS=:
-    for func_convert_core_path_wine_to_w32_f in $1; do
-      IFS=$oldIFS
-      func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
-      if test -n "$func_convert_core_file_wine_to_w32_result" ; then
-        if test -z "$func_convert_core_path_wine_to_w32_result"; then
-          func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result"
-        else
-          func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
-        fi
-      fi
-    done
-    IFS=$oldIFS
-  fi
-}
-# end: func_convert_core_path_wine_to_w32
-
-
-# func_cygpath ARGS...
-# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
-# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
-# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
-# (2), returns the Cygwin file name or path in func_cygpath_result (input
-# file name or path is assumed to be in w32 format, as previously converted
-# from $build's *nix or MSYS format). In case (3), returns the w32 file name
-# or path in func_cygpath_result (input file name or path is assumed to be in
-# Cygwin format). Returns an empty string on error.
-#
-# ARGS are passed to cygpath, with the last one being the file name or path to
-# be converted.
-#
-# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
-# environment variable; do not put it in $PATH.
-func_cygpath ()
-{
-  $opt_debug
-  if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
-    func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
-    if test "$?" -ne 0; then
-      # on failure, ensure result is empty
-      func_cygpath_result=
-    fi
-  else
-    func_cygpath_result=
-    func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
-  fi
-}
-#end: func_cygpath
-
-
-# func_convert_core_msys_to_w32 ARG
-# Convert file name or path ARG from MSYS format to w32 format.  Return
-# result in func_convert_core_msys_to_w32_result.
-func_convert_core_msys_to_w32 ()
-{
-  $opt_debug
-  # awkward: cmd appends spaces to result
-  func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
-    $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
-}
-#end: func_convert_core_msys_to_w32
-
-
-# func_convert_file_check ARG1 ARG2
-# Verify that ARG1 (a file name in $build format) was converted to $host
-# format in ARG2. Otherwise, emit an error message, but continue (resetting
-# func_to_host_file_result to ARG1).
-func_convert_file_check ()
-{
-  $opt_debug
-  if test -z "$2" && test -n "$1" ; then
-    func_error "Could not determine host file name corresponding to"
-    func_error "  \`$1'"
-    func_error "Continuing, but uninstalled executables may not work."
-    # Fallback:
-    func_to_host_file_result="$1"
-  fi
-}
-# end func_convert_file_check
-
-
-# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
-# Verify that FROM_PATH (a path in $build format) was converted to $host
-# format in TO_PATH. Otherwise, emit an error message, but continue, resetting
-# func_to_host_file_result to a simplistic fallback value (see below).
-func_convert_path_check ()
-{
-  $opt_debug
-  if test -z "$4" && test -n "$3"; then
-    func_error "Could not determine the host path corresponding to"
-    func_error "  \`$3'"
-    func_error "Continuing, but uninstalled executables may not work."
-    # Fallback.  This is a deliberately simplistic "conversion" and
-    # should not be "improved".  See libtool.info.
-    if test "x$1" != "x$2"; then
-      lt_replace_pathsep_chars="s|$1|$2|g"
-      func_to_host_path_result=`echo "$3" |
-        $SED -e "$lt_replace_pathsep_chars"`
-    else
-      func_to_host_path_result="$3"
-    fi
-  fi
-}
-# end func_convert_path_check
-
-
-# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
-# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
-# and appending REPL if ORIG matches BACKPAT.
-func_convert_path_front_back_pathsep ()
-{
-  $opt_debug
-  case $4 in
-  $1 ) func_to_host_path_result="$3$func_to_host_path_result"
-    ;;
-  esac
-  case $4 in
-  $2 ) func_append func_to_host_path_result "$3"
-    ;;
-  esac
-}
-# end func_convert_path_front_back_pathsep
-
-
-##################################################
-# $build to $host FILE NAME CONVERSION FUNCTIONS #
-##################################################
-# invoked via `$to_host_file_cmd ARG'
-#
-# In each case, ARG is the path to be converted from $build to $host format.
-# Result will be available in $func_to_host_file_result.
-
-
-# func_to_host_file ARG
-# Converts the file name ARG from $build format to $host format. Return result
-# in func_to_host_file_result.
-func_to_host_file ()
-{
-  $opt_debug
-  $to_host_file_cmd "$1"
-}
-# end func_to_host_file
-
-
-# func_to_tool_file ARG LAZY
-# converts the file name ARG from $build format to toolchain format. Return
-# result in func_to_tool_file_result.  If the conversion in use is listed
-# in (the comma separated) LAZY, no conversion takes place.
-func_to_tool_file ()
-{
-  $opt_debug
-  case ,$2, in
-    *,"$to_tool_file_cmd",*)
-      func_to_tool_file_result=$1
-      ;;
-    *)
-      $to_tool_file_cmd "$1"
-      func_to_tool_file_result=$func_to_host_file_result
-      ;;
-  esac
-}
-# end func_to_tool_file
-
-
-# func_convert_file_noop ARG
-# Copy ARG to func_to_host_file_result.
-func_convert_file_noop ()
-{
-  func_to_host_file_result="$1"
-}
-# end func_convert_file_noop
-
-
-# func_convert_file_msys_to_w32 ARG
-# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
-# conversion to w32 is not available inside the cwrapper.  Returns result in
-# func_to_host_file_result.
-func_convert_file_msys_to_w32 ()
-{
-  $opt_debug
-  func_to_host_file_result="$1"
-  if test -n "$1"; then
-    func_convert_core_msys_to_w32 "$1"
-    func_to_host_file_result="$func_convert_core_msys_to_w32_result"
-  fi
-  func_convert_file_check "$1" "$func_to_host_file_result"
-}
-# end func_convert_file_msys_to_w32
-
-
-# func_convert_file_cygwin_to_w32 ARG
-# Convert file name ARG from Cygwin to w32 format.  Returns result in
-# func_to_host_file_result.
-func_convert_file_cygwin_to_w32 ()
-{
-  $opt_debug
-  func_to_host_file_result="$1"
-  if test -n "$1"; then
-    # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
-    # LT_CYGPATH in this case.
-    func_to_host_file_result=`cygpath -m "$1"`
-  fi
-  func_convert_file_check "$1" "$func_to_host_file_result"
-}
-# end func_convert_file_cygwin_to_w32
-
-
-# func_convert_file_nix_to_w32 ARG
-# Convert file name ARG from *nix to w32 format.  Requires a wine environment
-# and a working winepath. Returns result in func_to_host_file_result.
-func_convert_file_nix_to_w32 ()
-{
-  $opt_debug
-  func_to_host_file_result="$1"
-  if test -n "$1"; then
-    func_convert_core_file_wine_to_w32 "$1"
-    func_to_host_file_result="$func_convert_core_file_wine_to_w32_result"
-  fi
-  func_convert_file_check "$1" "$func_to_host_file_result"
-}
-# end func_convert_file_nix_to_w32
-
-
-# func_convert_file_msys_to_cygwin ARG
-# Convert file name ARG from MSYS to Cygwin format.  Requires LT_CYGPATH set.
-# Returns result in func_to_host_file_result.
-func_convert_file_msys_to_cygwin ()
-{
-  $opt_debug
-  func_to_host_file_result="$1"
-  if test -n "$1"; then
-    func_convert_core_msys_to_w32 "$1"
-    func_cygpath -u "$func_convert_core_msys_to_w32_result"
-    func_to_host_file_result="$func_cygpath_result"
-  fi
-  func_convert_file_check "$1" "$func_to_host_file_result"
-}
-# end func_convert_file_msys_to_cygwin
-
-
-# func_convert_file_nix_to_cygwin ARG
-# Convert file name ARG from *nix to Cygwin format.  Requires Cygwin installed
-# in a wine environment, working winepath, and LT_CYGPATH set.  Returns result
-# in func_to_host_file_result.
-func_convert_file_nix_to_cygwin ()
-{
-  $opt_debug
-  func_to_host_file_result="$1"
-  if test -n "$1"; then
-    # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
-    func_convert_core_file_wine_to_w32 "$1"
-    func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
-    func_to_host_file_result="$func_cygpath_result"
-  fi
-  func_convert_file_check "$1" "$func_to_host_file_result"
-}
-# end func_convert_file_nix_to_cygwin
-
-
-#############################################
-# $build to $host PATH CONVERSION FUNCTIONS #
-#############################################
-# invoked via `$to_host_path_cmd ARG'
-#
-# In each case, ARG is the path to be converted from $build to $host format.
-# The result will be available in $func_to_host_path_result.
-#
-# Path separators are also converted from $build format to $host format.  If
-# ARG begins or ends with a path separator character, it is preserved (but
-# converted to $host format) on output.
-#
-# All path conversion functions are named using the following convention:
-#   file name conversion function    : func_convert_file_X_to_Y ()
-#   path conversion function         : func_convert_path_X_to_Y ()
-# where, for any given $build/$host combination the 'X_to_Y' value is the
-# same.  If conversion functions are added for new $build/$host combinations,
-# the two new functions must follow this pattern, or func_init_to_host_path_cmd
-# will break.
-
-
-# func_init_to_host_path_cmd
-# Ensures that function "pointer" variable $to_host_path_cmd is set to the
-# appropriate value, based on the value of $to_host_file_cmd.
-to_host_path_cmd=
-func_init_to_host_path_cmd ()
-{
-  $opt_debug
-  if test -z "$to_host_path_cmd"; then
-    func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
-    to_host_path_cmd="func_convert_path_${func_stripname_result}"
-  fi
-}
-
-
-# func_to_host_path ARG
-# Converts the path ARG from $build format to $host format. Return result
-# in func_to_host_path_result.
-func_to_host_path ()
-{
-  $opt_debug
-  func_init_to_host_path_cmd
-  $to_host_path_cmd "$1"
-}
-# end func_to_host_path
-
-
-# func_convert_path_noop ARG
-# Copy ARG to func_to_host_path_result.
-func_convert_path_noop ()
-{
-  func_to_host_path_result="$1"
-}
-# end func_convert_path_noop
-
-
-# func_convert_path_msys_to_w32 ARG
-# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
-# conversion to w32 is not available inside the cwrapper.  Returns result in
-# func_to_host_path_result.
-func_convert_path_msys_to_w32 ()
-{
-  $opt_debug
-  func_to_host_path_result="$1"
-  if test -n "$1"; then
-    # Remove leading and trailing path separator characters from ARG.  MSYS
-    # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
-    # and winepath ignores them completely.
-    func_stripname : : "$1"
-    func_to_host_path_tmp1=$func_stripname_result
-    func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
-    func_to_host_path_result="$func_convert_core_msys_to_w32_result"
-    func_convert_path_check : ";" \
-      "$func_to_host_path_tmp1" "$func_to_host_path_result"
-    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
-  fi
-}
-# end func_convert_path_msys_to_w32
-
-
-# func_convert_path_cygwin_to_w32 ARG
-# Convert path ARG from Cygwin to w32 format.  Returns result in
-# func_to_host_file_result.
-func_convert_path_cygwin_to_w32 ()
-{
-  $opt_debug
-  func_to_host_path_result="$1"
-  if test -n "$1"; then
-    # See func_convert_path_msys_to_w32:
-    func_stripname : : "$1"
-    func_to_host_path_tmp1=$func_stripname_result
-    func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
-    func_convert_path_check : ";" \
-      "$func_to_host_path_tmp1" "$func_to_host_path_result"
-    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
-  fi
-}
-# end func_convert_path_cygwin_to_w32
-
-
-# func_convert_path_nix_to_w32 ARG
-# Convert path ARG from *nix to w32 format.  Requires a wine environment and
-# a working winepath.  Returns result in func_to_host_file_result.
-func_convert_path_nix_to_w32 ()
-{
-  $opt_debug
-  func_to_host_path_result="$1"
-  if test -n "$1"; then
-    # See func_convert_path_msys_to_w32:
-    func_stripname : : "$1"
-    func_to_host_path_tmp1=$func_stripname_result
-    func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
-    func_to_host_path_result="$func_convert_core_path_wine_to_w32_result"
-    func_convert_path_check : ";" \
-      "$func_to_host_path_tmp1" "$func_to_host_path_result"
-    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
-  fi
-}
-# end func_convert_path_nix_to_w32
-
-
-# func_convert_path_msys_to_cygwin ARG
-# Convert path ARG from MSYS to Cygwin format.  Requires LT_CYGPATH set.
-# Returns result in func_to_host_file_result.
-func_convert_path_msys_to_cygwin ()
-{
-  $opt_debug
-  func_to_host_path_result="$1"
-  if test -n "$1"; then
-    # See func_convert_path_msys_to_w32:
-    func_stripname : : "$1"
-    func_to_host_path_tmp1=$func_stripname_result
-    func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
-    func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
-    func_to_host_path_result="$func_cygpath_result"
-    func_convert_path_check : : \
-      "$func_to_host_path_tmp1" "$func_to_host_path_result"
-    func_convert_path_front_back_pathsep ":*" "*:" : "$1"
-  fi
-}
-# end func_convert_path_msys_to_cygwin
-
-
-# func_convert_path_nix_to_cygwin ARG
-# Convert path ARG from *nix to Cygwin format.  Requires Cygwin installed in a
-# a wine environment, working winepath, and LT_CYGPATH set.  Returns result in
-# func_to_host_file_result.
-func_convert_path_nix_to_cygwin ()
-{
-  $opt_debug
-  func_to_host_path_result="$1"
-  if test -n "$1"; then
-    # Remove leading and trailing path separator characters from
-    # ARG. msys behavior is inconsistent here, cygpath turns them
-    # into '.;' and ';.', and winepath ignores them completely.
-    func_stripname : : "$1"
-    func_to_host_path_tmp1=$func_stripname_result
-    func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
-    func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
-    func_to_host_path_result="$func_cygpath_result"
-    func_convert_path_check : : \
-      "$func_to_host_path_tmp1" "$func_to_host_path_result"
-    func_convert_path_front_back_pathsep ":*" "*:" : "$1"
-  fi
-}
-# end func_convert_path_nix_to_cygwin
-
-
 # func_mode_compile arg...
 func_mode_compile ()
 {
@@ -1986,12 +1137,12 @@ func_mode_compile ()
 	  ;;
 
 	-pie | -fpie | -fPIE)
-          func_append pie_flag " $arg"
+          pie_flag="$pie_flag $arg"
 	  continue
 	  ;;
 
 	-shared | -static | -prefer-pic | -prefer-non-pic)
-	  func_append later " $arg"
+	  later="$later $arg"
 	  continue
 	  ;;
 
@@ -2012,14 +1163,15 @@ func_mode_compile ()
 	  save_ifs="$IFS"; IFS=','
 	  for arg in $args; do
 	    IFS="$save_ifs"
-	    func_append_quoted lastarg "$arg"
+	    func_quote_for_eval "$arg"
+	    lastarg="$lastarg $func_quote_for_eval_result"
 	  done
 	  IFS="$save_ifs"
 	  func_stripname ' ' '' "$lastarg"
 	  lastarg=$func_stripname_result
 
 	  # Add the arguments to base_compile.
-	  func_append base_compile " $lastarg"
+	  base_compile="$base_compile $lastarg"
 	  continue
 	  ;;
 
@@ -2035,7 +1187,8 @@ func_mode_compile ()
       esac    #  case $arg_mode
 
       # Aesthetically quote the previous argument.
-      func_append_quoted base_compile "$lastarg"
+      func_quote_for_eval "$lastarg"
+      base_compile="$base_compile $func_quote_for_eval_result"
     done # for arg
 
     case $arg_mode in
@@ -2060,7 +1213,7 @@ func_mode_compile ()
     *.[cCFSifmso] | \
     *.ada | *.adb | *.ads | *.asm | \
     *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
-    *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
+    *.[fF][09]? | *.for | *.java | *.obj | *.sx)
       func_xform "$libobj"
       libobj=$func_xform_result
       ;;
@@ -2135,7 +1288,7 @@ func_mode_compile ()
     # Calculate the filename of the output object if compiler does
     # not support -o with -c
     if test "$compiler_c_o" = no; then
-      output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
+      output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
       lockfile="$output_obj.lock"
     else
       output_obj=
@@ -2166,16 +1319,17 @@ compiler."
 	$opt_dry_run || $RM $removelist
 	exit $EXIT_FAILURE
       fi
-      func_append removelist " $output_obj"
+      removelist="$removelist $output_obj"
       $ECHO "$srcfile" > "$lockfile"
     fi
 
     $opt_dry_run || $RM $removelist
-    func_append removelist " $lockfile"
+    removelist="$removelist $lockfile"
     trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
 
-    func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
-    srcfile=$func_to_tool_file_result
+    if test -n "$fix_srcfile_path"; then
+      eval srcfile=\"$fix_srcfile_path\"
+    fi
     func_quote_for_eval "$srcfile"
     qsrcfile=$func_quote_for_eval_result
 
@@ -2195,7 +1349,7 @@ compiler."
 
       if test -z "$output_obj"; then
 	# Place PIC objects in $objdir
-	func_append command " -o $lobj"
+	command="$command -o $lobj"
       fi
 
       func_show_eval_locale "$command"	\
@@ -2242,11 +1396,11 @@ compiler."
 	command="$base_compile $qsrcfile $pic_flag"
       fi
       if test "$compiler_c_o" = yes; then
-	func_append command " -o $obj"
+	command="$command -o $obj"
       fi
 
       # Suppress compiler output if we already did a PIC compilation.
-      func_append command "$suppress_output"
+      command="$command$suppress_output"
       func_show_eval_locale "$command" \
         '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
 
@@ -2291,13 +1445,13 @@ compiler."
 }
 
 $opt_help || {
-  test "$opt_mode" = compile && func_mode_compile ${1+"$@"}
+test "$mode" = compile && func_mode_compile ${1+"$@"}
 }
 
 func_mode_help ()
 {
     # We need to display help for each of the modes.
-    case $opt_mode in
+    case $mode in
       "")
         # Generic help is extracted from the usage comments
         # at the start of this file.
@@ -2328,11 +1482,10 @@ This mode accepts the following additional options:
 
   -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
   -no-suppress      do not suppress compiler output for multiple passes
-  -prefer-pic       try to build PIC objects only
-  -prefer-non-pic   try to build non-PIC objects only
+  -prefer-pic       try to building PIC objects only
+  -prefer-non-pic   try to building non-PIC objects only
   -shared           do not build a \`.o' file suitable for static linking
   -static           only build a \`.o' file suitable for static linking
-  -Wc,FLAG          pass FLAG directly to the compiler
 
 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
 from the given SOURCEFILE.
@@ -2385,7 +1538,7 @@ either the \`install' or \`cp' program.
 
 The following components of INSTALL-COMMAND are treated specially:
 
-  -inst-prefix-dir PREFIX-DIR  Use PREFIX-DIR as a staging area for installation
+  -inst-prefix PREFIX-DIR  Use PREFIX-DIR as a staging area for installation
 
 The rest of the components are interpreted as arguments to that command (only
 BSD-compatible install options are recognized)."
@@ -2405,8 +1558,6 @@ The following components of LINK-COMMAND are treated specially:
 
   -all-static       do not do any dynamic linking at all
   -avoid-version    do not add a version suffix if possible
-  -bindir BINDIR    specify path to binaries directory (for systems where
-                    libraries must be found in the PATH setting at runtime)
   -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
   -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
   -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
@@ -2435,11 +1586,6 @@ The following components of LINK-COMMAND are treated specially:
   -version-info CURRENT[:REVISION[:AGE]]
                     specify library version info [each variable defaults to 0]
   -weak LIBNAME     declare that the target provides the LIBNAME interface
-  -Wc,FLAG
-  -Xcompiler FLAG   pass linker-specific FLAG directly to the compiler
-  -Wl,FLAG
-  -Xlinker FLAG     pass linker-specific FLAG directly to the linker
-  -XCClinker FLAG   pass link-specific FLAG to the compiler driver (CC)
 
 All other options (arguments beginning with \`-') are ignored.
 
@@ -2473,44 +1619,18 @@ Otherwise, only FILE itself is deleted using RM."
         ;;
 
       *)
-        func_fatal_help "invalid operation mode \`$opt_mode'"
+        func_fatal_help "invalid operation mode \`$mode'"
         ;;
     esac
 
-    echo
+    $ECHO
     $ECHO "Try \`$progname --help' for more information about other modes."
+
+    exit $?
 }
 
-# Now that we've collected a possible --mode arg, show help if necessary
-if $opt_help; then
-  if test "$opt_help" = :; then
-    func_mode_help
-  else
-    {
-      func_help noexit
-      for opt_mode in compile link execute install finish uninstall clean; do
-	func_mode_help
-      done
-    } | sed -n '1p; 2,$s/^Usage:/  or: /p'
-    {
-      func_help noexit
-      for opt_mode in compile link execute install finish uninstall clean; do
-	echo
-	func_mode_help
-      done
-    } |
-    sed '1d
-      /^When reporting/,/^Report/{
-	H
-	d
-      }
-      $x
-      /information about other modes/d
-      /more detailed .*MODE/d
-      s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
-  fi
-  exit $?
-fi
+  # Now that we've collected a possible --mode arg, show help if necessary
+  $opt_help && func_mode_help
 
 
 # func_mode_execute arg...
@@ -2523,16 +1643,13 @@ func_mode_execute ()
       func_fatal_help "you must specify a COMMAND"
 
     # Handle -dlopen flags immediately.
-    for file in $opt_dlopen; do
+    for file in $execute_dlfiles; do
       test -f "$file" \
 	|| func_fatal_help "\`$file' is not a file"
 
       dir=
       case $file in
       *.la)
-	func_resolve_sysroot "$file"
-	file=$func_resolve_sysroot_result
-
 	# Check to see that this really is a libtool archive.
 	func_lalib_unsafe_p "$file" \
 	  || func_fatal_help "\`$lib' is not a valid libtool archive"
@@ -2554,7 +1671,7 @@ func_mode_execute ()
 	dir="$func_dirname_result"
 
 	if test -f "$dir/$objdir/$dlname"; then
-	  func_append dir "/$objdir"
+	  dir="$dir/$objdir"
 	else
 	  if test ! -f "$dir/$dlname"; then
 	    func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
@@ -2595,7 +1712,7 @@ func_mode_execute ()
     for file
     do
       case $file in
-      -* | *.la | *.lo ) ;;
+      -*) ;;
       *)
 	# Do a test to see if this is really a libtool program.
 	if func_ltwrapper_script_p "$file"; then
@@ -2611,7 +1728,8 @@ func_mode_execute ()
 	;;
       esac
       # Quote arguments (to preserve shell metacharacters).
-      func_append_quoted args "$file"
+      func_quote_for_eval "$file"
+      args="$args $func_quote_for_eval_result"
     done
 
     if test "X$opt_dry_run" = Xfalse; then
@@ -2636,66 +1754,29 @@ func_mode_execute ()
       # Display what would be done.
       if test -n "$shlibpath_var"; then
 	eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
-	echo "export $shlibpath_var"
+	$ECHO "export $shlibpath_var"
       fi
       $ECHO "$cmd$args"
       exit $EXIT_SUCCESS
     fi
 }
 
-test "$opt_mode" = execute && func_mode_execute ${1+"$@"}
+test "$mode" = execute && func_mode_execute ${1+"$@"}
 
 
-# func_mode_finish arg...
-func_mode_finish ()
-{
-    $opt_debug
-    libs=
-    libdirs=
-    admincmds=
-
-    for opt in "$nonopt" ${1+"$@"}
-    do
-      if test -d "$opt"; then
-	func_append libdirs " $opt"
-
-      elif test -f "$opt"; then
-	if func_lalib_unsafe_p "$opt"; then
-	  func_append libs " $opt"
-	else
-	  func_warning "\`$opt' is not a valid libtool archive"
-	fi
-
-      else
-	func_fatal_error "invalid argument \`$opt'"
-      fi
-    done
-
-    if test -n "$libs"; then
-      if test -n "$lt_sysroot"; then
-        sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
-        sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
-      else
-        sysroot_cmd=
-      fi
-
-      # Remove sysroot references
-      if $opt_dry_run; then
-        for lib in $libs; do
-          echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
-        done
-      else
-        tmpdir=`func_mktempdir`
-        for lib in $libs; do
-	  sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
-	    > $tmpdir/tmp-la
-	  mv -f $tmpdir/tmp-la $lib
-	done
-        ${RM}r "$tmpdir"
-      fi
-    fi
+# func_mode_finish arg...
+func_mode_finish ()
+{
+    $opt_debug
+    libdirs="$nonopt"
+    admincmds=
 
     if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+      for dir
+      do
+	libdirs="$libdirs $dir"
+      done
+
       for libdir in $libdirs; do
 	if test -n "$finish_cmds"; then
 	  # Do each command in the finish commands.
@@ -2705,7 +1786,7 @@ func_mode_finish ()
 	if test -n "$finish_eval"; then
 	  # Do the single finish_eval.
 	  eval cmds=\"$finish_eval\"
-	  $opt_dry_run || eval "$cmds" || func_append admincmds "
+	  $opt_dry_run || eval "$cmds" || admincmds="$admincmds
        $cmds"
 	fi
       done
@@ -2714,55 +1795,53 @@ func_mode_finish ()
     # Exit here if they wanted silent mode.
     $opt_silent && exit $EXIT_SUCCESS
 
-    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
-      echo "----------------------------------------------------------------------"
-      echo "Libraries have been installed in:"
-      for libdir in $libdirs; do
-	$ECHO "   $libdir"
-      done
-      echo
-      echo "If you ever happen to want to link against installed libraries"
-      echo "in a given directory, LIBDIR, you must either use libtool, and"
-      echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
-      echo "flag during linking and do at least one of the following:"
-      if test -n "$shlibpath_var"; then
-	echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
-	echo "     during execution"
-      fi
-      if test -n "$runpath_var"; then
-	echo "   - add LIBDIR to the \`$runpath_var' environment variable"
-	echo "     during linking"
-      fi
-      if test -n "$hardcode_libdir_flag_spec"; then
-	libdir=LIBDIR
-	eval flag=\"$hardcode_libdir_flag_spec\"
-
-	$ECHO "   - use the \`$flag' linker flag"
-      fi
-      if test -n "$admincmds"; then
-	$ECHO "   - have your system administrator run these commands:$admincmds"
-      fi
-      if test -f /etc/ld.so.conf; then
-	echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
-      fi
-      echo
+    $ECHO "X----------------------------------------------------------------------" | $Xsed
+    $ECHO "Libraries have been installed in:"
+    for libdir in $libdirs; do
+      $ECHO "   $libdir"
+    done
+    $ECHO
+    $ECHO "If you ever happen to want to link against installed libraries"
+    $ECHO "in a given directory, LIBDIR, you must either use libtool, and"
+    $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'"
+    $ECHO "flag during linking and do at least one of the following:"
+    if test -n "$shlibpath_var"; then
+      $ECHO "   - add LIBDIR to the \`$shlibpath_var' environment variable"
+      $ECHO "     during execution"
+    fi
+    if test -n "$runpath_var"; then
+      $ECHO "   - add LIBDIR to the \`$runpath_var' environment variable"
+      $ECHO "     during linking"
+    fi
+    if test -n "$hardcode_libdir_flag_spec"; then
+      libdir=LIBDIR
+      eval flag=\"$hardcode_libdir_flag_spec\"
 
-      echo "See any operating system documentation about shared libraries for"
-      case $host in
-	solaris2.[6789]|solaris2.1[0-9])
-	  echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
-	  echo "pages."
-	  ;;
-	*)
-	  echo "more information, such as the ld(1) and ld.so(8) manual pages."
-	  ;;
-      esac
-      echo "----------------------------------------------------------------------"
+      $ECHO "   - use the \`$flag' linker flag"
     fi
+    if test -n "$admincmds"; then
+      $ECHO "   - have your system administrator run these commands:$admincmds"
+    fi
+    if test -f /etc/ld.so.conf; then
+      $ECHO "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
+    fi
+    $ECHO
+
+    $ECHO "See any operating system documentation about shared libraries for"
+    case $host in
+      solaris2.[6789]|solaris2.1[0-9])
+        $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual"
+	$ECHO "pages."
+	;;
+      *)
+        $ECHO "more information, such as the ld(1) and ld.so(8) manual pages."
+        ;;
+    esac
+    $ECHO "X----------------------------------------------------------------------" | $Xsed
     exit $EXIT_SUCCESS
 }
 
-test "$opt_mode" = finish && func_mode_finish ${1+"$@"}
+test "$mode" = finish && func_mode_finish ${1+"$@"}
 
 
 # func_mode_install arg...
@@ -2773,7 +1852,7 @@ func_mode_install ()
     # install_prog (especially on Windows NT).
     if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
        # Allow the use of GNU shtool's install command.
-       case $nonopt in *shtool*) :;; *) false;; esac; then
+       $ECHO "X$nonopt" | $GREP shtool >/dev/null; then
       # Aesthetically quote it.
       func_quote_for_eval "$nonopt"
       install_prog="$func_quote_for_eval_result "
@@ -2787,12 +1866,7 @@ func_mode_install ()
     # The real first argument should be the name of the installation program.
     # Aesthetically quote it.
     func_quote_for_eval "$arg"
-    func_append install_prog "$func_quote_for_eval_result"
-    install_shared_prog=$install_prog
-    case " $install_prog " in
-      *[\\\ /]cp\ *) install_cp=: ;;
-      *) install_cp=false ;;
-    esac
+    install_prog="$install_prog$func_quote_for_eval_result"
 
     # We need to accept at least all the BSD install flags.
     dest=
@@ -2802,12 +1876,10 @@ func_mode_install ()
     install_type=
     isdir=no
     stripme=
-    no_mode=:
     for arg
     do
-      arg2=
       if test -n "$dest"; then
-	func_append files " $dest"
+	files="$files $dest"
 	dest=$arg
 	continue
       fi
@@ -2815,9 +1887,10 @@ func_mode_install ()
       case $arg in
       -d) isdir=yes ;;
       -f)
-	if $install_cp; then :; else
-	  prev=$arg
-	fi
+	case " $install_prog " in
+	*[\\\ /]cp\ *) ;;
+	*) prev=$arg ;;
+	esac
 	;;
       -g | -m | -o)
 	prev=$arg
@@ -2831,10 +1904,6 @@ func_mode_install ()
       *)
 	# If the previous option needed an argument, then skip it.
 	if test -n "$prev"; then
-	  if test "x$prev" = x-m && test -n "$install_override_mode"; then
-	    arg2=$install_override_mode
-	    no_mode=false
-	  fi
 	  prev=
 	else
 	  dest=$arg
@@ -2845,11 +1914,7 @@ func_mode_install ()
 
       # Aesthetically quote the argument.
       func_quote_for_eval "$arg"
-      func_append install_prog " $func_quote_for_eval_result"
-      if test -n "$arg2"; then
-	func_quote_for_eval "$arg2"
-      fi
-      func_append install_shared_prog " $func_quote_for_eval_result"
+      install_prog="$install_prog $func_quote_for_eval_result"
     done
 
     test -z "$install_prog" && \
@@ -2858,13 +1923,6 @@ func_mode_install ()
     test -n "$prev" && \
       func_fatal_help "the \`$prev' option requires an argument"
 
-    if test -n "$install_override_mode" && $no_mode; then
-      if $install_cp; then :; else
-	func_quote_for_eval "$install_override_mode"
-	func_append install_shared_prog " -m $func_quote_for_eval_result"
-      fi
-    fi
-
     if test -z "$files"; then
       if test -z "$dest"; then
 	func_fatal_help "no file or destination specified"
@@ -2919,13 +1977,10 @@ func_mode_install ()
       case $file in
       *.$libext)
 	# Do the static libraries later.
-	func_append staticlibs " $file"
+	staticlibs="$staticlibs $file"
 	;;
 
       *.la)
-	func_resolve_sysroot "$file"
-	file=$func_resolve_sysroot_result
-
 	# Check to see that this really is a libtool archive.
 	func_lalib_unsafe_p "$file" \
 	  || func_fatal_help "\`$file' is not a valid libtool archive"
@@ -2939,23 +1994,23 @@ func_mode_install ()
 	if test "X$destdir" = "X$libdir"; then
 	  case "$current_libdirs " in
 	  *" $libdir "*) ;;
-	  *) func_append current_libdirs " $libdir" ;;
+	  *) current_libdirs="$current_libdirs $libdir" ;;
 	  esac
 	else
 	  # Note the libdir as a future libdir.
 	  case "$future_libdirs " in
 	  *" $libdir "*) ;;
-	  *) func_append future_libdirs " $libdir" ;;
+	  *) future_libdirs="$future_libdirs $libdir" ;;
 	  esac
 	fi
 
 	func_dirname "$file" "/" ""
 	dir="$func_dirname_result"
-	func_append dir "$objdir"
+	dir="$dir$objdir"
 
 	if test -n "$relink_command"; then
 	  # Determine the prefix the user has applied to our future dir.
-	  inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
+	  inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"`
 
 	  # Don't allow the user to place us outside of our expected
 	  # location b/c this prevents finding dependent libraries that
@@ -2968,9 +2023,9 @@ func_mode_install ()
 
 	  if test -n "$inst_prefix_dir"; then
 	    # Stick the inst_prefix_dir data into the link command.
-	    relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
+	    relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
 	  else
-	    relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
+	    relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"`
 	  fi
 
 	  func_warning "relinking \`$file'"
@@ -2988,7 +2043,7 @@ func_mode_install ()
 	  test -n "$relink_command" && srcname="$realname"T
 
 	  # Install the shared library and build the symlinks.
-	  func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
+	  func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \
 	      'exit $?'
 	  tstripme="$stripme"
 	  case $host_os in
@@ -3028,7 +2083,7 @@ func_mode_install ()
 	func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
 
 	# Maybe install the static library, too.
-	test -n "$old_library" && func_append staticlibs " $dir/$old_library"
+	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
 	;;
 
       *.lo)
@@ -3128,7 +2183,7 @@ func_mode_install ()
 	    if test -f "$lib"; then
 	      func_source "$lib"
 	    fi
-	    libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
+	    libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
 	    if test -n "$libdir" && test ! -f "$libfile"; then
 	      func_warning "\`$lib' has not been installed in \`$libdir'"
 	      finalize=no
@@ -3147,7 +2202,7 @@ func_mode_install ()
 		file="$func_basename_result"
 	        outputname="$tmpdir/$file"
 	        # Replace the output file specification.
-	        relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
+	        relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
 
 	        $opt_silent || {
 	          func_quote_for_expand "$relink_command"
@@ -3166,7 +2221,7 @@ func_mode_install ()
 	    }
 	  else
 	    # Install the binary that we compiled earlier.
-	    file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
+	    file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
 	  fi
 	fi
 
@@ -3202,13 +2257,11 @@ func_mode_install ()
 
       # Set up the ranlib parameters.
       oldlib="$destdir/$name"
-      func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
-      tool_oldlib=$func_to_tool_file_result
 
       func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
 
       if test -n "$stripme" && test -n "$old_striplib"; then
-	func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
+	func_show_eval "$old_striplib $oldlib" 'exit $?'
       fi
 
       # Do each command in the postinstall commands.
@@ -3227,7 +2280,7 @@ func_mode_install ()
     fi
 }
 
-test "$opt_mode" = install && func_mode_install ${1+"$@"}
+test "$mode" = install && func_mode_install ${1+"$@"}
 
 
 # func_generate_dlsyms outputname originator pic_p
@@ -3270,22 +2323,6 @@ func_generate_dlsyms ()
 extern \"C\" {
 #endif
 
-#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
-#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
-#endif
-
-/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
-#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
-/* DATA imports from DLLs on WIN32 con't be const, because runtime
-   relocations are performed -- see ld's documentation on pseudo-relocs.  */
-# define LT_DLSYM_CONST
-#elif defined(__osf__)
-/* This system does not cope well with relocations in const data.  */
-# define LT_DLSYM_CONST
-#else
-# define LT_DLSYM_CONST const
-#endif
-
 /* External symbol declarations for the compiler. */\
 "
 
@@ -3295,11 +2332,10 @@ extern \"C\" {
 	  $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
 
 	  # Add our own program objects to the symbol list.
-	  progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
+	  progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
 	  for progfile in $progfiles; do
-	    func_to_tool_file "$progfile" func_convert_file_msys_to_w32
-	    func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
-	    $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
+	    func_verbose "extracting global C symbols from \`$progfile'"
+	    $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
 	  done
 
 	  if test -n "$exclude_expsyms"; then
@@ -3335,7 +2371,7 @@ extern \"C\" {
 	      eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
 	      eval '$MV "$nlist"T "$nlist"'
 	      case $host in
-	        *cygwin* | *mingw* | *cegcc* )
+	        *cygwin | *mingw* | *cegcc* )
 	          eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
 	          eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
 	          ;;
@@ -3348,52 +2384,10 @@ extern \"C\" {
 	  func_verbose "extracting global C symbols from \`$dlprefile'"
 	  func_basename "$dlprefile"
 	  name="$func_basename_result"
-          case $host in
-	    *cygwin* | *mingw* | *cegcc* )
-	      # if an import library, we need to obtain dlname
-	      if func_win32_import_lib_p "$dlprefile"; then
-	        func_tr_sh "$dlprefile"
-	        eval "curr_lafile=\$libfile_$func_tr_sh_result"
-	        dlprefile_dlbasename=""
-	        if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
-	          # Use subshell, to avoid clobbering current variable values
-	          dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
-	          if test -n "$dlprefile_dlname" ; then
-	            func_basename "$dlprefile_dlname"
-	            dlprefile_dlbasename="$func_basename_result"
-	          else
-	            # no lafile. user explicitly requested -dlpreopen <import library>.
-	            $sharedlib_from_linklib_cmd "$dlprefile"
-	            dlprefile_dlbasename=$sharedlib_from_linklib_result
-	          fi
-	        fi
-	        $opt_dry_run || {
-	          if test -n "$dlprefile_dlbasename" ; then
-	            eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
-	          else
-	            func_warning "Could not compute DLL name from $name"
-	            eval '$ECHO ": $name " >> "$nlist"'
-	          fi
-	          func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
-	          eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
-	            $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
-	        }
-	      else # not an import lib
-	        $opt_dry_run || {
-	          eval '$ECHO ": $name " >> "$nlist"'
-	          func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
-	          eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
-	        }
-	      fi
-	    ;;
-	    *)
-	      $opt_dry_run || {
-	        eval '$ECHO ": $name " >> "$nlist"'
-	        func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
-	        eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
-	      }
-	    ;;
-          esac
+	  $opt_dry_run || {
+	    eval '$ECHO ": $name " >> "$nlist"'
+	    eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
+	  }
 	done
 
 	$opt_dry_run || {
@@ -3421,19 +2415,36 @@ extern \"C\" {
 	  if test -f "$nlist"S; then
 	    eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
 	  else
-	    echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
+	    $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms"
 	  fi
 
-	  echo >> "$output_objdir/$my_dlsyms" "\
+	  $ECHO >> "$output_objdir/$my_dlsyms" "\
 
 /* The mapping between symbol names and symbols.  */
 typedef struct {
   const char *name;
   void *address;
 } lt_dlsymlist;
-extern LT_DLSYM_CONST lt_dlsymlist
+"
+	  case $host in
+	  *cygwin* | *mingw* | *cegcc* )
+	    $ECHO >> "$output_objdir/$my_dlsyms" "\
+/* DATA imports from DLLs on WIN32 con't be const, because
+   runtime relocations are performed -- see ld's documentation
+   on pseudo-relocs.  */"
+	    lt_dlsym_const= ;;
+	  *osf5*)
+	    echo >> "$output_objdir/$my_dlsyms" "\
+/* This system does not cope well with relocations in const data */"
+	    lt_dlsym_const= ;;
+	  *)
+	    lt_dlsym_const=const ;;
+	  esac
+
+	  $ECHO >> "$output_objdir/$my_dlsyms" "\
+extern $lt_dlsym_const lt_dlsymlist
 lt_${my_prefix}_LTX_preloaded_symbols[];
-LT_DLSYM_CONST lt_dlsymlist
+$lt_dlsym_const lt_dlsymlist
 lt_${my_prefix}_LTX_preloaded_symbols[] =
 {\
   { \"$my_originator\", (void *) 0 },"
@@ -3446,7 +2457,7 @@ lt_${my_prefix}_LTX_preloaded_symbols[] =
 	    eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
 	    ;;
 	  esac
-	  echo >> "$output_objdir/$my_dlsyms" "\
+	  $ECHO >> "$output_objdir/$my_dlsyms" "\
   {0, (void *) 0}
 };
 
@@ -3473,7 +2484,7 @@ static const void *lt_preloaded_setup() {
 	  # linked before any other PIC object.  But we must not use
 	  # pic_flag when linking with -static.  The problem exists in
 	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
-	  *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
+	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
 	    pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
 	  *-*-hpux*)
 	    pic_flag_for_symtable=" $pic_flag"  ;;
@@ -3489,7 +2500,7 @@ static const void *lt_preloaded_setup() {
 	for arg in $LTCFLAGS; do
 	  case $arg in
 	  -pie | -fpie | -fPIE) ;;
-	  *) func_append symtab_cflags " $arg" ;;
+	  *) symtab_cflags="$symtab_cflags $arg" ;;
 	  esac
 	done
 
@@ -3504,16 +2515,16 @@ static const void *lt_preloaded_setup() {
 	case $host in
 	*cygwin* | *mingw* | *cegcc* )
 	  if test -f "$output_objdir/$my_outputname.def"; then
-	    compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
-	    finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+	    compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+	    finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
 	  else
-	    compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
-	    finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+	    compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
+	    finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
 	  fi
 	  ;;
 	*)
-	  compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
-	  finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+	  compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
+	  finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
 	  ;;
 	esac
 	;;
@@ -3527,8 +2538,8 @@ static const void *lt_preloaded_setup() {
       # really was required.
 
       # Nullify the symbol file.
-      compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
-      finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
+      compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
+      finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
     fi
 }
 
@@ -3538,7 +2549,6 @@ static const void *lt_preloaded_setup() {
 # Need a lot of goo to handle *both* DLLs and import libs
 # Has to be a shell function in order to 'eat' the argument
 # that is supplied when $file_magic_command is called.
-# Despite the name, also deal with 64 bit binaries.
 func_win32_libid ()
 {
   $opt_debug
@@ -3549,11 +2559,9 @@ func_win32_libid ()
     win32_libid_type="x86 archive import"
     ;;
   *ar\ archive*) # could be an import, or static
-    # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
     if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
-       $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
-      func_to_tool_file "$1" func_convert_file_msys_to_w32
-      win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
+       $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
+      win32_nmres=`eval $NM -f posix -A $1 |
 	$SED -n -e '
 	    1,100{
 		/ I /{
@@ -3582,131 +2590,6 @@ func_win32_libid ()
   $ECHO "$win32_libid_type"
 }
 
-# func_cygming_dll_for_implib ARG
-#
-# Platform-specific function to extract the
-# name of the DLL associated with the specified
-# import library ARG.
-# Invoked by eval'ing the libtool variable
-#    $sharedlib_from_linklib_cmd
-# Result is available in the variable
-#    $sharedlib_from_linklib_result
-func_cygming_dll_for_implib ()
-{
-  $opt_debug
-  sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
-}
-
-# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
-#
-# The is the core of a fallback implementation of a
-# platform-specific function to extract the name of the
-# DLL associated with the specified import library LIBNAME.
-#
-# SECTION_NAME is either .idata$6 or .idata$7, depending
-# on the platform and compiler that created the implib.
-#
-# Echos the name of the DLL associated with the
-# specified import library.
-func_cygming_dll_for_implib_fallback_core ()
-{
-  $opt_debug
-  match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
-  $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
-    $SED '/^Contents of section '"$match_literal"':/{
-      # Place marker at beginning of archive member dllname section
-      s/.*/====MARK====/
-      p
-      d
-    }
-    # These lines can sometimes be longer than 43 characters, but
-    # are always uninteresting
-    /:[	 ]*file format pe[i]\{,1\}-/d
-    /^In archive [^:]*:/d
-    # Ensure marker is printed
-    /^====MARK====/p
-    # Remove all lines with less than 43 characters
-    /^.\{43\}/!d
-    # From remaining lines, remove first 43 characters
-    s/^.\{43\}//' |
-    $SED -n '
-      # Join marker and all lines until next marker into a single line
-      /^====MARK====/ b para
-      H
-      $ b para
-      b
-      :para
-      x
-      s/\n//g
-      # Remove the marker
-      s/^====MARK====//
-      # Remove trailing dots and whitespace
-      s/[\. \t]*$//
-      # Print
-      /./p' |
-    # we now have a list, one entry per line, of the stringified
-    # contents of the appropriate section of all members of the
-    # archive which possess that section. Heuristic: eliminate
-    # all those which have a first or second character that is
-    # a '.' (that is, objdump's representation of an unprintable
-    # character.) This should work for all archives with less than
-    # 0x302f exports -- but will fail for DLLs whose name actually
-    # begins with a literal '.' or a single character followed by
-    # a '.'.
-    #
-    # Of those that remain, print the first one.
-    $SED -e '/^\./d;/^.\./d;q'
-}
-
-# func_cygming_gnu_implib_p ARG
-# This predicate returns with zero status (TRUE) if
-# ARG is a GNU/binutils-style import library. Returns
-# with nonzero status (FALSE) otherwise.
-func_cygming_gnu_implib_p ()
-{
-  $opt_debug
-  func_to_tool_file "$1" func_convert_file_msys_to_w32
-  func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
-  test -n "$func_cygming_gnu_implib_tmp"
-}
-
-# func_cygming_ms_implib_p ARG
-# This predicate returns with zero status (TRUE) if
-# ARG is an MS-style import library. Returns
-# with nonzero status (FALSE) otherwise.
-func_cygming_ms_implib_p ()
-{
-  $opt_debug
-  func_to_tool_file "$1" func_convert_file_msys_to_w32
-  func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
-  test -n "$func_cygming_ms_implib_tmp"
-}
-
-# func_cygming_dll_for_implib_fallback ARG
-# Platform-specific function to extract the
-# name of the DLL associated with the specified
-# import library ARG.
-#
-# This fallback implementation is for use when $DLLTOOL
-# does not support the --identify-strict option.
-# Invoked by eval'ing the libtool variable
-#    $sharedlib_from_linklib_cmd
-# Result is available in the variable
-#    $sharedlib_from_linklib_result
-func_cygming_dll_for_implib_fallback ()
-{
-  $opt_debug
-  if func_cygming_gnu_implib_p "$1" ; then
-    # binutils import library
-    sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
-  elif func_cygming_ms_implib_p "$1" ; then
-    # ms-generated import library
-    sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
-  else
-    # unknown
-    sharedlib_from_linklib_result=""
-  fi
-}
 
 
 # func_extract_an_archive dir oldlib
@@ -3715,18 +2598,7 @@ func_extract_an_archive ()
     $opt_debug
     f_ex_an_ar_dir="$1"; shift
     f_ex_an_ar_oldlib="$1"
-    if test "$lock_old_archive_extraction" = yes; then
-      lockfile=$f_ex_an_ar_oldlib.lock
-      until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
-	func_echo "Waiting for $lockfile to be removed"
-	sleep 2
-      done
-    fi
-    func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
-		   'stat=$?; rm -f "$lockfile"; exit $stat'
-    if test "$lock_old_archive_extraction" = yes; then
-      $opt_dry_run || rm -f "$lockfile"
-    fi
+    func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?'
     if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
      :
     else
@@ -3797,7 +2669,7 @@ func_extract_archives ()
 	    darwin_file=
 	    darwin_files=
 	    for darwin_file in $darwin_filelist; do
-	      darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
+	      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
 	      $LIPO -create -output "$darwin_file" $darwin_files
 	    done # $darwin_filelist
 	    $RM -rf unfat-$$
@@ -3812,30 +2684,25 @@ func_extract_archives ()
         func_extract_an_archive "$my_xdir" "$my_xabs"
 	;;
       esac
-      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
+      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
     done
 
     func_extract_archives_result="$my_oldobjs"
 }
 
 
-# func_emit_wrapper [arg=no]
-#
-# Emit a libtool wrapper script on stdout.
-# Don't directly open a file because we may want to
-# incorporate the script contents within a cygwin/mingw
-# wrapper executable.  Must ONLY be called from within
-# func_mode_link because it depends on a number of variables
-# set therein.
+
+# func_emit_wrapper_part1 [arg=no]
 #
-# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
-# variable will take.  If 'yes', then the emitted script
-# will assume that the directory in which it is stored is
-# the $objdir directory.  This is a cygwin/mingw-specific
-# behavior.
-func_emit_wrapper ()
+# Emit the first part of a libtool wrapper script on stdout.
+# For more information, see the description associated with
+# func_emit_wrapper(), below.
+func_emit_wrapper_part1 ()
 {
-	func_emit_wrapper_arg1=${1-no}
+	func_emit_wrapper_part1_arg1=no
+	if test -n "$1" ; then
+	  func_emit_wrapper_part1_arg1=$1
+	fi
 
 	$ECHO "\
 #! $SHELL
@@ -3851,6 +2718,7 @@ func_emit_wrapper ()
 
 # Sed substitution that helps us do robust quoting.  It backslashifies
 # metacharacters that are still active within double-quoted strings.
+Xsed='${SED} -e 1s/^X//'
 sed_quote_subst='$sed_quote_subst'
 
 # Be Bourne compatible
@@ -3881,135 +2749,31 @@ if test \"\$libtool_install_magic\" = \"$magic\"; then
 else
   # When we are sourced in execute mode, \$file and \$ECHO are already set.
   if test \"\$libtool_execute_magic\" != \"$magic\"; then
-    file=\"\$0\""
-
-    qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
-    $ECHO "\
-
-# A function that is used when there is no print builtin or printf.
-func_fallback_echo ()
-{
-  eval 'cat <<_LTECHO_EOF
-\$1
-_LTECHO_EOF'
-}
-    ECHO=\"$qECHO\"
-  fi
-
-# Very basic option parsing. These options are (a) specific to
-# the libtool wrapper, (b) are identical between the wrapper
-# /script/ and the wrapper /executable/ which is used only on
-# windows platforms, and (c) all begin with the string "--lt-"
-# (application programs are unlikely to have options which match
-# this pattern).
-#
-# There are only two supported options: --lt-debug and
-# --lt-dump-script. There is, deliberately, no --lt-help.
-#
-# The first argument to this parsing function should be the
-# script's $0 value, followed by "$@".
-lt_option_debug=
-func_parse_lt_options ()
-{
-  lt_script_arg0=\$0
-  shift
-  for lt_opt
-  do
-    case \"\$lt_opt\" in
-    --lt-debug) lt_option_debug=1 ;;
-    --lt-dump-script)
-        lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
-        test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
-        lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
-        cat \"\$lt_dump_D/\$lt_dump_F\"
-        exit 0
-      ;;
-    --lt-*)
-        \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
-        exit 1
-      ;;
-    esac
-  done
-
-  # Print the debug banner immediately:
-  if test -n \"\$lt_option_debug\"; then
-    echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
-  fi
-}
-
-# Used when --lt-debug. Prints its arguments to stdout
-# (redirection is the responsibility of the caller)
-func_lt_dump_args ()
-{
-  lt_dump_args_N=1;
-  for lt_arg
-  do
-    \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
-    lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
-  done
-}
-
-# Core function for launching the target application
-func_exec_program_core ()
-{
-"
-  case $host in
-  # Backslashes separate directories on plain windows
-  *-*-mingw | *-*-os2* | *-cegcc*)
-    $ECHO "\
-      if test -n \"\$lt_option_debug\"; then
-        \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
-        func_lt_dump_args \${1+\"\$@\"} 1>&2
-      fi
-      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
-"
-    ;;
-
-  *)
-    $ECHO "\
-      if test -n \"\$lt_option_debug\"; then
-        \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
-        func_lt_dump_args \${1+\"\$@\"} 1>&2
-      fi
-      exec \"\$progdir/\$program\" \${1+\"\$@\"}
-"
-    ;;
-  esac
-  $ECHO "\
-      \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
-      exit 1
-}
-
-# A function to encapsulate launching the target application
-# Strips options in the --lt-* namespace from \$@ and
-# launches target application with the remaining arguments.
-func_exec_program ()
-{
-  case \" \$* \" in
-  *\\ --lt-*)
-    for lt_wr_arg
-    do
-      case \$lt_wr_arg in
-      --lt-*) ;;
-      *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
-      esac
+    ECHO=\"$qecho\"
+    file=\"\$0\"
+    # Make sure echo works.
+    if test \"X\$1\" = X--no-reexec; then
+      # Discard the --no-reexec flag, and continue.
       shift
-    done ;;
-  esac
-  func_exec_program_core \${1+\"\$@\"}
-}
-
-  # Parse options
-  func_parse_lt_options \"\$0\" \${1+\"\$@\"}
+    elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then
+      # Yippee, \$ECHO works!
+      :
+    else
+      # Restart under the correct shell, and then maybe \$ECHO will work.
+      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
+    fi
+  fi\
+"
+	$ECHO "\
 
   # Find the directory that this script lives in.
-  thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
+  thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
   test \"x\$thisdir\" = \"x\$file\" && thisdir=.
 
   # Follow symbolic links until we get to the real thisdir.
-  file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
+  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
   while test -n \"\$file\"; do
-    destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
+    destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
 
     # If there was a directory component, then change thisdir.
     if test \"x\$destdir\" != \"x\$file\"; then
@@ -4019,13 +2783,30 @@ func_exec_program ()
       esac
     fi
 
-    file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
-    file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
+    file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
+    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
   done
+"
+}
+# end: func_emit_wrapper_part1
+
+# func_emit_wrapper_part2 [arg=no]
+#
+# Emit the second part of a libtool wrapper script on stdout.
+# For more information, see the description associated with
+# func_emit_wrapper(), below.
+func_emit_wrapper_part2 ()
+{
+	func_emit_wrapper_part2_arg1=no
+	if test -n "$1" ; then
+	  func_emit_wrapper_part2_arg1=$1
+	fi
+
+	$ECHO "\
 
   # Usually 'no', except on cygwin/mingw when embedded into
   # the cwrapper.
-  WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
+  WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1
   if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
     # special case for '.'
     if test \"\$thisdir\" = \".\"; then
@@ -4033,7 +2814,7 @@ func_exec_program ()
     fi
     # remove .libs from thisdir
     case \"\$thisdir\" in
-    *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
+    *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;;
     $objdir )   thisdir=. ;;
     esac
   fi
@@ -4088,18 +2869,6 @@ func_exec_program ()
 
   if test -f \"\$progdir/\$program\"; then"
 
-	# fixup the dll searchpath if we need to.
-	#
-	# Fix the DLL searchpath if we need to.  Do this before prepending
-	# to shlibpath, because on Windows, both are PATH and uninstalled
-	# libraries must come first.
-	if test -n "$dllsearchpath"; then
-	  $ECHO "\
-    # Add the dll search path components to the executable PATH
-    PATH=$dllsearchpath:\$PATH
-"
-	fi
-
 	# Export our shlibpath_var if we have one.
 	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
 	  $ECHO "\
@@ -4108,28 +2877,253 @@ func_exec_program ()
 
     # Some systems cannot cope with colon-terminated $shlibpath_var
     # The second colon is a workaround for a bug in BeOS R4 sed
-    $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
+    $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
 
     export $shlibpath_var
 "
 	fi
 
+	# fixup the dll searchpath if we need to.
+	if test -n "$dllsearchpath"; then
+	  $ECHO "\
+    # Add the dll search path components to the executable PATH
+    PATH=$dllsearchpath:\$PATH
+"
+	fi
+
 	$ECHO "\
     if test \"\$libtool_execute_magic\" != \"$magic\"; then
       # Run the actual program with our arguments.
-      func_exec_program \${1+\"\$@\"}
+"
+	case $host in
+	# Backslashes separate directories on plain windows
+	*-*-mingw | *-*-os2* | *-cegcc*)
+	  $ECHO "\
+      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
+"
+	  ;;
+
+	*)
+	  $ECHO "\
+      exec \"\$progdir/\$program\" \${1+\"\$@\"}
+"
+	  ;;
+	esac
+	$ECHO "\
+      \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
+      exit 1
     fi
   else
     # The program doesn't exist.
     \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
     \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
-    \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
+    $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
     exit 1
   fi
 fi\
 "
 }
+# end: func_emit_wrapper_part2
+
+
+# func_emit_wrapper [arg=no]
+#
+# Emit a libtool wrapper script on stdout.
+# Don't directly open a file because we may want to
+# incorporate the script contents within a cygwin/mingw
+# wrapper executable.  Must ONLY be called from within
+# func_mode_link because it depends on a number of variables
+# set therein.
+#
+# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
+# variable will take.  If 'yes', then the emitted script
+# will assume that the directory in which it is stored is
+# the $objdir directory.  This is a cygwin/mingw-specific
+# behavior.
+func_emit_wrapper ()
+{
+	func_emit_wrapper_arg1=no
+	if test -n "$1" ; then
+	  func_emit_wrapper_arg1=$1
+	fi
+
+	# split this up so that func_emit_cwrapperexe_src
+	# can call each part independently.
+	func_emit_wrapper_part1 "${func_emit_wrapper_arg1}"
+	func_emit_wrapper_part2 "${func_emit_wrapper_arg1}"
+}
+
+
+# func_to_host_path arg
+#
+# Convert paths to host format when used with build tools.
+# Intended for use with "native" mingw (where libtool itself
+# is running under the msys shell), or in the following cross-
+# build environments:
+#    $build          $host
+#    mingw (msys)    mingw  [e.g. native]
+#    cygwin          mingw
+#    *nix + wine     mingw
+# where wine is equipped with the `winepath' executable.
+# In the native mingw case, the (msys) shell automatically
+# converts paths for any non-msys applications it launches,
+# but that facility isn't available from inside the cwrapper.
+# Similar accommodations are necessary for $host mingw and
+# $build cygwin.  Calling this function does no harm for other
+# $host/$build combinations not listed above.
+#
+# ARG is the path (on $build) that should be converted to
+# the proper representation for $host. The result is stored
+# in $func_to_host_path_result.
+func_to_host_path ()
+{
+  func_to_host_path_result="$1"
+  if test -n "$1" ; then
+    case $host in
+      *mingw* )
+        lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
+        case $build in
+          *mingw* ) # actually, msys
+            # awkward: cmd appends spaces to result
+            lt_sed_strip_trailing_spaces="s/[ ]*\$//"
+            func_to_host_path_tmp1=`( cmd //c echo "$1" |\
+              $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
+            func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
+              $SED -e "$lt_sed_naive_backslashify"`
+            ;;
+          *cygwin* )
+            func_to_host_path_tmp1=`cygpath -w "$1"`
+            func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
+              $SED -e "$lt_sed_naive_backslashify"`
+            ;;
+          * )
+            # Unfortunately, winepath does not exit with a non-zero
+            # error code, so we are forced to check the contents of
+            # stdout. On the other hand, if the command is not
+            # found, the shell will set an exit code of 127 and print
+            # *an error message* to stdout. So we must check for both
+            # error code of zero AND non-empty stdout, which explains
+            # the odd construction:
+            func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null`
+            if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then
+              func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
+                $SED -e "$lt_sed_naive_backslashify"`
+            else
+              # Allow warning below.
+              func_to_host_path_result=""
+            fi
+            ;;
+        esac
+        if test -z "$func_to_host_path_result" ; then
+          func_error "Could not determine host path corresponding to"
+          func_error "  '$1'"
+          func_error "Continuing, but uninstalled executables may not work."
+          # Fallback:
+          func_to_host_path_result="$1"
+        fi
+        ;;
+    esac
+  fi
+}
+# end: func_to_host_path
 
+# func_to_host_pathlist arg
+#
+# Convert pathlists to host format when used with build tools.
+# See func_to_host_path(), above. This function supports the
+# following $build/$host combinations (but does no harm for
+# combinations not listed here):
+#    $build          $host
+#    mingw (msys)    mingw  [e.g. native]
+#    cygwin          mingw
+#    *nix + wine     mingw
+#
+# Path separators are also converted from $build format to
+# $host format. If ARG begins or ends with a path separator
+# character, it is preserved (but converted to $host format)
+# on output.
+#
+# ARG is a pathlist (on $build) that should be converted to
+# the proper representation on $host. The result is stored
+# in $func_to_host_pathlist_result.
+func_to_host_pathlist ()
+{
+  func_to_host_pathlist_result="$1"
+  if test -n "$1" ; then
+    case $host in
+      *mingw* )
+        lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
+        # Remove leading and trailing path separator characters from
+        # ARG. msys behavior is inconsistent here, cygpath turns them
+        # into '.;' and ';.', and winepath ignores them completely.
+        func_to_host_pathlist_tmp2="$1"
+        # Once set for this call, this variable should not be
+        # reassigned. It is used in tha fallback case.
+        func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\
+          $SED -e 's|^:*||' -e 's|:*$||'`
+        case $build in
+          *mingw* ) # Actually, msys.
+            # Awkward: cmd appends spaces to result.
+            lt_sed_strip_trailing_spaces="s/[ ]*\$//"
+            func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\
+              $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
+            func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
+              $SED -e "$lt_sed_naive_backslashify"`
+            ;;
+          *cygwin* )
+            func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"`
+            func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
+              $SED -e "$lt_sed_naive_backslashify"`
+            ;;
+          * )
+            # unfortunately, winepath doesn't convert pathlists
+            func_to_host_pathlist_result=""
+            func_to_host_pathlist_oldIFS=$IFS
+            IFS=:
+            for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do
+              IFS=$func_to_host_pathlist_oldIFS
+              if test -n "$func_to_host_pathlist_f" ; then
+                func_to_host_path "$func_to_host_pathlist_f"
+                if test -n "$func_to_host_path_result" ; then
+                  if test -z "$func_to_host_pathlist_result" ; then
+                    func_to_host_pathlist_result="$func_to_host_path_result"
+                  else
+                    func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result"
+                  fi
+                fi
+              fi
+              IFS=:
+            done
+            IFS=$func_to_host_pathlist_oldIFS
+            ;;
+        esac
+        if test -z "$func_to_host_pathlist_result" ; then
+          func_error "Could not determine the host path(s) corresponding to"
+          func_error "  '$1'"
+          func_error "Continuing, but uninstalled executables may not work."
+          # Fallback. This may break if $1 contains DOS-style drive
+          # specifications. The fix is not to complicate the expression
+          # below, but for the user to provide a working wine installation
+          # with winepath so that path translation in the cross-to-mingw
+          # case works properly.
+          lt_replace_pathsep_nix_to_dos="s|:|;|g"
+          func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\
+            $SED -e "$lt_replace_pathsep_nix_to_dos"`
+        fi
+        # Now, add the leading and trailing path separators back
+        case "$1" in
+          :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result"
+            ;;
+        esac
+        case "$1" in
+          *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;"
+            ;;
+        esac
+        ;;
+    esac
+  fi
+}
+# end: func_to_host_pathlist
 
 # func_emit_cwrapperexe_src
 # emit the source code for a wrapper executable on stdout
@@ -4147,23 +3141,31 @@ func_emit_cwrapperexe_src ()
 
    This wrapper executable should never be moved out of the build directory.
    If it is, it will not operate correctly.
+
+   Currently, it simply execs the wrapper *script* "$SHELL $output",
+   but could eventually absorb all of the scripts functionality and
+   exec $objdir/$outputname directly.
 */
 EOF
 	    cat <<"EOF"
-#ifdef _MSC_VER
-# define _CRT_SECURE_NO_DEPRECATE 1
-#endif
 #include <stdio.h>
 #include <stdlib.h>
 #ifdef _MSC_VER
 # include <direct.h>
 # include <process.h>
 # include <io.h>
+# define setmode _setmode
 #else
 # include <unistd.h>
 # include <stdint.h>
 # ifdef __CYGWIN__
 #  include <io.h>
+#  define HAVE_SETENV
+#  ifdef __STRICT_ANSI__
+char *realpath (const char *, char *);
+int putenv (char *);
+int setenv (const char *, const char *, int);
+#  endif
 # endif
 #endif
 #include <malloc.h>
@@ -4175,44 +3177,6 @@ EOF
 #include <fcntl.h>
 #include <sys/stat.h>
 
-/* declarations of non-ANSI functions */
-#if defined(__MINGW32__)
-# ifdef __STRICT_ANSI__
-int _putenv (const char *);
-# endif
-#elif defined(__CYGWIN__)
-# ifdef __STRICT_ANSI__
-char *realpath (const char *, char *);
-int putenv (char *);
-int setenv (const char *, const char *, int);
-# endif
-/* #elif defined (other platforms) ... */
-#endif
-
-/* portability defines, excluding path handling macros */
-#if defined(_MSC_VER)
-# define setmode _setmode
-# define stat    _stat
-# define chmod   _chmod
-# define getcwd  _getcwd
-# define putenv  _putenv
-# define S_IXUSR _S_IEXEC
-# ifndef _INTPTR_T_DEFINED
-#  define _INTPTR_T_DEFINED
-#  define intptr_t int
-# endif
-#elif defined(__MINGW32__)
-# define setmode _setmode
-# define stat    _stat
-# define chmod   _chmod
-# define getcwd  _getcwd
-# define putenv  _putenv
-#elif defined(__CYGWIN__)
-# define HAVE_SETENV
-# define FOPEN_WB "wb"
-/* #elif defined (other platforms) ... */
-#endif
-
 #if defined(PATH_MAX)
 # define LT_PATHMAX PATH_MAX
 #elif defined(MAXPATHLEN)
@@ -4228,7 +3192,14 @@ int setenv (const char *, const char *, int);
 # define S_IXGRP 0
 #endif
 
-/* path handling portability macros */
+#ifdef _MSC_VER
+# define S_IXUSR _S_IEXEC
+# define stat _stat
+# ifndef _INTPTR_T_DEFINED
+#  define intptr_t int
+# endif
+#endif
+
 #ifndef DIR_SEPARATOR
 # define DIR_SEPARATOR '/'
 # define PATH_SEPARATOR ':'
@@ -4259,6 +3230,10 @@ int setenv (const char *, const char *, int);
 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
 #endif /* PATH_SEPARATOR_2 */
 
+#ifdef __CYGWIN__
+# define FOPEN_WB "wb"
+#endif
+
 #ifndef FOPEN_WB
 # define FOPEN_WB "w"
 #endif
@@ -4271,13 +3246,22 @@ int setenv (const char *, const char *, int);
   if (stale) { free ((void *) stale); stale = 0; } \
 } while (0)
 
-#if defined(LT_DEBUGWRAPPER)
-static int lt_debug = 1;
+#undef LTWRAPPER_DEBUGPRINTF
+#if defined DEBUGWRAPPER
+# define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args
+static void
+ltwrapper_debugprintf (const char *fmt, ...)
+{
+    va_list args;
+    va_start (args, fmt);
+    (void) vfprintf (stderr, fmt, args);
+    va_end (args);
+}
 #else
-static int lt_debug = 0;
+# define LTWRAPPER_DEBUGPRINTF(args)
 #endif
 
-const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
+const char *program_name = NULL;
 
 void *xmalloc (size_t num);
 char *xstrdup (const char *string);
@@ -4287,27 +3271,41 @@ char *chase_symlinks (const char *pathspec);
 int make_executable (const char *path);
 int check_executable (const char *path);
 char *strendzap (char *str, const char *pat);
-void lt_debugprintf (const char *file, int line, const char *fmt, ...);
-void lt_fatal (const char *file, int line, const char *message, ...);
-static const char *nonnull (const char *s);
-static const char *nonempty (const char *s);
+void lt_fatal (const char *message, ...);
 void lt_setenv (const char *name, const char *value);
 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
+void lt_opt_process_env_set (const char *arg);
+void lt_opt_process_env_prepend (const char *arg);
+void lt_opt_process_env_append (const char *arg);
+int lt_split_name_value (const char *arg, char** name, char** value);
 void lt_update_exe_path (const char *name, const char *value);
 void lt_update_lib_path (const char *name, const char *value);
-char **prepare_spawn (char **argv);
-void lt_dump_script (FILE *f);
+
+static const char *script_text_part1 =
+EOF
+
+	    func_emit_wrapper_part1 yes |
+	        $SED -e 's/\([\\"]\)/\\\1/g' \
+	             -e 's/^/  "/' -e 's/$/\\n"/'
+	    echo ";"
+	    cat <<EOF
+
+static const char *script_text_part2 =
 EOF
+	    func_emit_wrapper_part2 yes |
+	        $SED -e 's/\([\\"]\)/\\\1/g' \
+	             -e 's/^/  "/' -e 's/$/\\n"/'
+	    echo ";"
 
 	    cat <<EOF
-volatile const char * MAGIC_EXE = "$magic_exe";
+const char * MAGIC_EXE = "$magic_exe";
 const char * LIB_PATH_VARNAME = "$shlibpath_var";
 EOF
 
 	    if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
-              func_to_host_path "$temp_rpath"
+              func_to_host_pathlist "$temp_rpath"
 	      cat <<EOF
-const char * LIB_PATH_VALUE   = "$func_to_host_path_result";
+const char * LIB_PATH_VALUE   = "$func_to_host_pathlist_result";
 EOF
 	    else
 	      cat <<"EOF"
@@ -4316,10 +3314,10 @@ EOF
 	    fi
 
 	    if test -n "$dllsearchpath"; then
-              func_to_host_path "$dllsearchpath:"
+              func_to_host_pathlist "$dllsearchpath:"
 	      cat <<EOF
 const char * EXE_PATH_VARNAME = "PATH";
-const char * EXE_PATH_VALUE   = "$func_to_host_path_result";
+const char * EXE_PATH_VALUE   = "$func_to_host_pathlist_result";
 EOF
 	    else
 	      cat <<"EOF"
@@ -4342,10 +3340,24 @@ EOF
 	    cat <<"EOF"
 
 #define LTWRAPPER_OPTION_PREFIX         "--lt-"
+#define LTWRAPPER_OPTION_PREFIX_LENGTH  5
 
+static const size_t opt_prefix_len         = LTWRAPPER_OPTION_PREFIX_LENGTH;
 static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
+
 static const char *dumpscript_opt       = LTWRAPPER_OPTION_PREFIX "dump-script";
-static const char *debug_opt            = LTWRAPPER_OPTION_PREFIX "debug";
+
+static const size_t env_set_opt_len     = LTWRAPPER_OPTION_PREFIX_LENGTH + 7;
+static const char *env_set_opt          = LTWRAPPER_OPTION_PREFIX "env-set";
+  /* argument is putenv-style "foo=bar", value of foo is set to bar */
+
+static const size_t env_prepend_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 11;
+static const char *env_prepend_opt      = LTWRAPPER_OPTION_PREFIX "env-prepend";
+  /* argument is putenv-style "foo=bar", new value of foo is bar${foo} */
+
+static const size_t env_append_opt_len  = LTWRAPPER_OPTION_PREFIX_LENGTH + 10;
+static const char *env_append_opt       = LTWRAPPER_OPTION_PREFIX "env-append";
+  /* argument is putenv-style "foo=bar", new value of foo is ${foo}bar */
 
 int
 main (int argc, char *argv[])
@@ -4362,13 +3374,10 @@ main (int argc, char *argv[])
   int i;
 
   program_name = (char *) xstrdup (base_name (argv[0]));
-  newargz = XMALLOC (char *, argc + 1);
+  LTWRAPPER_DEBUGPRINTF (("(main) argv[0]      : %s\n", argv[0]));
+  LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name));
 
-  /* very simple arg parsing; don't want to rely on getopt
-   * also, copy all non cwrapper options to newargz, except
-   * argz[0], which is handled differently
-   */
-  newargc=0;
+  /* very simple arg parsing; don't want to rely on getopt */
   for (i = 1; i < argc; i++)
     {
       if (strcmp (argv[i], dumpscript_opt) == 0)
@@ -4382,57 +3391,25 @@ EOF
 	      esac
 
 	    cat <<"EOF"
-	  lt_dump_script (stdout);
+	  printf ("%s", script_text_part1);
+	  printf ("%s", script_text_part2);
 	  return 0;
 	}
-      if (strcmp (argv[i], debug_opt) == 0)
-	{
-          lt_debug = 1;
-          continue;
-	}
-      if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
-        {
-          /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
-             namespace, but it is not one of the ones we know about and
-             have already dealt with, above (inluding dump-script), then
-             report an error. Otherwise, targets might begin to believe
-             they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
-             namespace. The first time any user complains about this, we'll
-             need to make LTWRAPPER_OPTION_PREFIX a configure-time option
-             or a configure.ac-settable value.
-           */
-          lt_fatal (__FILE__, __LINE__,
-		    "unrecognized %s option: '%s'",
-                    ltwrapper_option_prefix, argv[i]);
-        }
-      /* otherwise ... */
-      newargz[++newargc] = xstrdup (argv[i]);
     }
-  newargz[++newargc] = NULL;
-
-EOF
-	    cat <<EOF
-  /* The GNU banner must be the first non-error debug message */
-  lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
-EOF
-	    cat <<"EOF"
-  lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
-  lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
 
+  newargz = XMALLOC (char *, argc + 1);
   tmp_pathspec = find_executable (argv[0]);
   if (tmp_pathspec == NULL)
-    lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
-  lt_debugprintf (__FILE__, __LINE__,
-                  "(main) found exe (before symlink chase) at: %s\n",
-		  tmp_pathspec);
+    lt_fatal ("Couldn't find %s", argv[0]);
+  LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n",
+			  tmp_pathspec));
 
   actual_cwrapper_path = chase_symlinks (tmp_pathspec);
-  lt_debugprintf (__FILE__, __LINE__,
-                  "(main) found exe (after symlink chase) at: %s\n",
-		  actual_cwrapper_path);
+  LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n",
+			  actual_cwrapper_path));
   XFREE (tmp_pathspec);
 
-  actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
+  actual_cwrapper_name = xstrdup( base_name (actual_cwrapper_path));
   strendzap (actual_cwrapper_path, actual_cwrapper_name);
 
   /* wrapper name transforms */
@@ -4450,9 +3427,8 @@ EOF
   target_name = tmp_pathspec;
   tmp_pathspec = 0;
 
-  lt_debugprintf (__FILE__, __LINE__,
-		  "(main) libtool target name: %s\n",
-		  target_name);
+  LTWRAPPER_DEBUGPRINTF (("(main) libtool target name: %s\n",
+			  target_name));
 EOF
 
 	    cat <<EOF
@@ -4502,19 +3478,80 @@ EOF
 
   lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
   lt_setenv ("DUALCASE", "1");  /* for MSK sh */
-  /* Update the DLL searchpath.  EXE_PATH_VALUE ($dllsearchpath) must
-     be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
-     because on Windows, both *_VARNAMEs are PATH but uninstalled
-     libraries must come first. */
-  lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
   lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
+  lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
+
+  newargc=0;
+  for (i = 1; i < argc; i++)
+    {
+      if (strncmp (argv[i], env_set_opt, env_set_opt_len) == 0)
+        {
+          if (argv[i][env_set_opt_len] == '=')
+            {
+              const char *p = argv[i] + env_set_opt_len + 1;
+              lt_opt_process_env_set (p);
+            }
+          else if (argv[i][env_set_opt_len] == '\0' && i + 1 < argc)
+            {
+              lt_opt_process_env_set (argv[++i]); /* don't copy */
+            }
+          else
+            lt_fatal ("%s missing required argument", env_set_opt);
+          continue;
+        }
+      if (strncmp (argv[i], env_prepend_opt, env_prepend_opt_len) == 0)
+        {
+          if (argv[i][env_prepend_opt_len] == '=')
+            {
+              const char *p = argv[i] + env_prepend_opt_len + 1;
+              lt_opt_process_env_prepend (p);
+            }
+          else if (argv[i][env_prepend_opt_len] == '\0' && i + 1 < argc)
+            {
+              lt_opt_process_env_prepend (argv[++i]); /* don't copy */
+            }
+          else
+            lt_fatal ("%s missing required argument", env_prepend_opt);
+          continue;
+        }
+      if (strncmp (argv[i], env_append_opt, env_append_opt_len) == 0)
+        {
+          if (argv[i][env_append_opt_len] == '=')
+            {
+              const char *p = argv[i] + env_append_opt_len + 1;
+              lt_opt_process_env_append (p);
+            }
+          else if (argv[i][env_append_opt_len] == '\0' && i + 1 < argc)
+            {
+              lt_opt_process_env_append (argv[++i]); /* don't copy */
+            }
+          else
+            lt_fatal ("%s missing required argument", env_append_opt);
+          continue;
+        }
+      if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0)
+        {
+          /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
+             namespace, but it is not one of the ones we know about and
+             have already dealt with, above (inluding dump-script), then
+             report an error. Otherwise, targets might begin to believe
+             they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
+             namespace. The first time any user complains about this, we'll
+             need to make LTWRAPPER_OPTION_PREFIX a configure-time option
+             or a configure.ac-settable value.
+           */
+          lt_fatal ("Unrecognized option in %s namespace: '%s'",
+                    ltwrapper_option_prefix, argv[i]);
+        }
+      /* otherwise ... */
+      newargz[++newargc] = xstrdup (argv[i]);
+    }
+  newargz[++newargc] = NULL;
 
-  lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
-		  nonnull (lt_argv_zero));
+  LTWRAPPER_DEBUGPRINTF     (("(main) lt_argv_zero : %s\n", (lt_argv_zero ? lt_argv_zero : "<NULL>")));
   for (i = 0; i < newargc; i++)
     {
-      lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
-		      i, nonnull (newargz[i]));
+      LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d]   : %s\n", i, (newargz[i] ? newargz[i] : "<NULL>")));
     }
 
 EOF
@@ -4523,14 +3560,11 @@ EOF
 	      mingw*)
 		cat <<"EOF"
   /* execv doesn't actually work on mingw as expected on unix */
-  newargz = prepare_spawn (newargz);
   rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
   if (rval == -1)
     {
       /* failed to start process */
-      lt_debugprintf (__FILE__, __LINE__,
-		      "(main) failed to launch target \"%s\": %s\n",
-		      lt_argv_zero, nonnull (strerror (errno)));
+      LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno));
       return 127;
     }
   return rval;
@@ -4552,7 +3586,7 @@ xmalloc (size_t num)
 {
   void *p = (void *) malloc (num);
   if (!p)
-    lt_fatal (__FILE__, __LINE__, "memory exhausted");
+    lt_fatal ("Memory exhausted");
 
   return p;
 }
@@ -4586,8 +3620,8 @@ check_executable (const char *path)
 {
   struct stat st;
 
-  lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
-                  nonempty (path));
+  LTWRAPPER_DEBUGPRINTF (("(check_executable)  : %s\n",
+			  path ? (*path ? path : "EMPTY!") : "NULL!"));
   if ((!path) || (!*path))
     return 0;
 
@@ -4604,8 +3638,8 @@ make_executable (const char *path)
   int rval = 0;
   struct stat st;
 
-  lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
-                  nonempty (path));
+  LTWRAPPER_DEBUGPRINTF (("(make_executable)   : %s\n",
+			  path ? (*path ? path : "EMPTY!") : "NULL!"));
   if ((!path) || (!*path))
     return 0;
 
@@ -4631,8 +3665,8 @@ find_executable (const char *wrapper)
   int tmp_len;
   char *concat_name;
 
-  lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
-                  nonempty (wrapper));
+  LTWRAPPER_DEBUGPRINTF (("(find_executable)   : %s\n",
+			  wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"));
 
   if ((wrapper == NULL) || (*wrapper == '\0'))
     return NULL;
@@ -4685,8 +3719,7 @@ find_executable (const char *wrapper)
 		{
 		  /* empty path: current directory */
 		  if (getcwd (tmp, LT_PATHMAX) == NULL)
-		    lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
-                              nonnull (strerror (errno)));
+		    lt_fatal ("getcwd failed");
 		  tmp_len = strlen (tmp);
 		  concat_name =
 		    XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
@@ -4711,8 +3744,7 @@ find_executable (const char *wrapper)
     }
   /* Relative path | not found in path: prepend cwd */
   if (getcwd (tmp, LT_PATHMAX) == NULL)
-    lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
-              nonnull (strerror (errno)));
+    lt_fatal ("getcwd failed");
   tmp_len = strlen (tmp);
   concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
   memcpy (concat_name, tmp, tmp_len);
@@ -4738,9 +3770,8 @@ chase_symlinks (const char *pathspec)
   int has_symlinks = 0;
   while (strlen (tmp_pathspec) && !has_symlinks)
     {
-      lt_debugprintf (__FILE__, __LINE__,
-		      "checking path component for symlinks: %s\n",
-		      tmp_pathspec);
+      LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n",
+			      tmp_pathspec));
       if (lstat (tmp_pathspec, &s) == 0)
 	{
 	  if (S_ISLNK (s.st_mode) != 0)
@@ -4762,9 +3793,8 @@ chase_symlinks (const char *pathspec)
 	}
       else
 	{
-	  lt_fatal (__FILE__, __LINE__,
-		    "error accessing file \"%s\": %s",
-		    tmp_pathspec, nonnull (strerror (errno)));
+	  char *errstr = strerror (errno);
+	  lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr);
 	}
     }
   XFREE (tmp_pathspec);
@@ -4777,8 +3807,7 @@ chase_symlinks (const char *pathspec)
   tmp_pathspec = realpath (pathspec, buf);
   if (tmp_pathspec == 0)
     {
-      lt_fatal (__FILE__, __LINE__,
-		"could not follow symlinks for %s", pathspec);
+      lt_fatal ("Could not follow symlinks for %s", pathspec);
     }
   return xstrdup (tmp_pathspec);
 #endif
@@ -4804,25 +3833,11 @@ strendzap (char *str, const char *pat)
   return str;
 }
 
-void
-lt_debugprintf (const char *file, int line, const char *fmt, ...)
-{
-  va_list args;
-  if (lt_debug)
-    {
-      (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
-      va_start (args, fmt);
-      (void) vfprintf (stderr, fmt, args);
-      va_end (args);
-    }
-}
-
 static void
-lt_error_core (int exit_status, const char *file,
-	       int line, const char *mode,
+lt_error_core (int exit_status, const char *mode,
 	       const char *message, va_list ap)
 {
-  fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
+  fprintf (stderr, "%s: %s: ", program_name, mode);
   vfprintf (stderr, message, ap);
   fprintf (stderr, ".\n");
 
@@ -4831,32 +3846,20 @@ lt_error_core (int exit_status, const char *file,
 }
 
 void
-lt_fatal (const char *file, int line, const char *message, ...)
+lt_fatal (const char *message, ...)
 {
   va_list ap;
   va_start (ap, message);
-  lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
+  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
   va_end (ap);
 }
 
-static const char *
-nonnull (const char *s)
-{
-  return s ? s : "(null)";
-}
-
-static const char *
-nonempty (const char *s)
-{
-  return (s && !*s) ? "(empty)" : nonnull (s);
-}
-
 void
 lt_setenv (const char *name, const char *value)
 {
-  lt_debugprintf (__FILE__, __LINE__,
-		  "(lt_setenv) setting '%s' to '%s'\n",
-                  nonnull (name), nonnull (value));
+  LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n",
+                          (name ? name : "<NULL>"),
+                          (value ? value : "<NULL>")));
   {
 #ifdef HAVE_SETENV
     /* always make a copy, for consistency with !HAVE_SETENV */
@@ -4901,12 +3904,95 @@ lt_extend_str (const char *orig_value, const char *add, int to_end)
   return new_value;
 }
 
+int
+lt_split_name_value (const char *arg, char** name, char** value)
+{
+  const char *p;
+  int len;
+  if (!arg || !*arg)
+    return 1;
+
+  p = strchr (arg, (int)'=');
+
+  if (!p)
+    return 1;
+
+  *value = xstrdup (++p);
+
+  len = strlen (arg) - strlen (*value);
+  *name = XMALLOC (char, len);
+  strncpy (*name, arg, len-1);
+  (*name)[len - 1] = '\0';
+
+  return 0;
+}
+
+void
+lt_opt_process_env_set (const char *arg)
+{
+  char *name = NULL;
+  char *value = NULL;
+
+  if (lt_split_name_value (arg, &name, &value) != 0)
+    {
+      XFREE (name);
+      XFREE (value);
+      lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg);
+    }
+
+  lt_setenv (name, value);
+  XFREE (name);
+  XFREE (value);
+}
+
+void
+lt_opt_process_env_prepend (const char *arg)
+{
+  char *name = NULL;
+  char *value = NULL;
+  char *new_value = NULL;
+
+  if (lt_split_name_value (arg, &name, &value) != 0)
+    {
+      XFREE (name);
+      XFREE (value);
+      lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg);
+    }
+
+  new_value = lt_extend_str (getenv (name), value, 0);
+  lt_setenv (name, new_value);
+  XFREE (new_value);
+  XFREE (name);
+  XFREE (value);
+}
+
+void
+lt_opt_process_env_append (const char *arg)
+{
+  char *name = NULL;
+  char *value = NULL;
+  char *new_value = NULL;
+
+  if (lt_split_name_value (arg, &name, &value) != 0)
+    {
+      XFREE (name);
+      XFREE (value);
+      lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg);
+    }
+
+  new_value = lt_extend_str (getenv (name), value, 1);
+  lt_setenv (name, new_value);
+  XFREE (new_value);
+  XFREE (name);
+  XFREE (value);
+}
+
 void
 lt_update_exe_path (const char *name, const char *value)
 {
-  lt_debugprintf (__FILE__, __LINE__,
-		  "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
-                  nonnull (name), nonnull (value));
+  LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
+                          (name ? name : "<NULL>"),
+                          (value ? value : "<NULL>")));
 
   if (name && *name && value && *value)
     {
@@ -4925,9 +4011,9 @@ lt_update_exe_path (const char *name, const char *value)
 void
 lt_update_lib_path (const char *name, const char *value)
 {
-  lt_debugprintf (__FILE__, __LINE__,
-		  "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
-                  nonnull (name), nonnull (value));
+  LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
+                          (name ? name : "<NULL>"),
+                          (value ? value : "<NULL>")));
 
   if (name && *name && value && *value)
     {
@@ -4937,158 +4023,11 @@ lt_update_lib_path (const char *name, const char *value)
     }
 }
 
-EOF
-	    case $host_os in
-	      mingw*)
-		cat <<"EOF"
-
-/* Prepares an argument vector before calling spawn().
-   Note that spawn() does not by itself call the command interpreter
-     (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
-      ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
-         GetVersionEx(&v);
-         v.dwPlatformId == VER_PLATFORM_WIN32_NT;
-      }) ? "cmd.exe" : "command.com").
-   Instead it simply concatenates the arguments, separated by ' ', and calls
-   CreateProcess().  We must quote the arguments since Win32 CreateProcess()
-   interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
-   special way:
-   - Space and tab are interpreted as delimiters. They are not treated as
-     delimiters if they are surrounded by double quotes: "...".
-   - Unescaped double quotes are removed from the input. Their only effect is
-     that within double quotes, space and tab are treated like normal
-     characters.
-   - Backslashes not followed by double quotes are not special.
-   - But 2*n+1 backslashes followed by a double quote become
-     n backslashes followed by a double quote (n >= 0):
-       \" -> "
-       \\\" -> \"
-       \\\\\" -> \\"
- */
-#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
-#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
-char **
-prepare_spawn (char **argv)
-{
-  size_t argc;
-  char **new_argv;
-  size_t i;
-
-  /* Count number of arguments.  */
-  for (argc = 0; argv[argc] != NULL; argc++)
-    ;
-
-  /* Allocate new argument vector.  */
-  new_argv = XMALLOC (char *, argc + 1);
-
-  /* Put quoted arguments into the new argument vector.  */
-  for (i = 0; i < argc; i++)
-    {
-      const char *string = argv[i];
-
-      if (string[0] == '\0')
-	new_argv[i] = xstrdup ("\"\"");
-      else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
-	{
-	  int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
-	  size_t length;
-	  unsigned int backslashes;
-	  const char *s;
-	  char *quoted_string;
-	  char *p;
-
-	  length = 0;
-	  backslashes = 0;
-	  if (quote_around)
-	    length++;
-	  for (s = string; *s != '\0'; s++)
-	    {
-	      char c = *s;
-	      if (c == '"')
-		length += backslashes + 1;
-	      length++;
-	      if (c == '\\')
-		backslashes++;
-	      else
-		backslashes = 0;
-	    }
-	  if (quote_around)
-	    length += backslashes + 1;
-
-	  quoted_string = XMALLOC (char, length + 1);
-
-	  p = quoted_string;
-	  backslashes = 0;
-	  if (quote_around)
-	    *p++ = '"';
-	  for (s = string; *s != '\0'; s++)
-	    {
-	      char c = *s;
-	      if (c == '"')
-		{
-		  unsigned int j;
-		  for (j = backslashes + 1; j > 0; j--)
-		    *p++ = '\\';
-		}
-	      *p++ = c;
-	      if (c == '\\')
-		backslashes++;
-	      else
-		backslashes = 0;
-	    }
-	  if (quote_around)
-	    {
-	      unsigned int j;
-	      for (j = backslashes; j > 0; j--)
-		*p++ = '\\';
-	      *p++ = '"';
-	    }
-	  *p = '\0';
-
-	  new_argv[i] = quoted_string;
-	}
-      else
-	new_argv[i] = (char *) string;
-    }
-  new_argv[argc] = NULL;
-
-  return new_argv;
-}
-EOF
-		;;
-	    esac
 
-            cat <<"EOF"
-void lt_dump_script (FILE* f)
-{
-EOF
-	    func_emit_wrapper yes |
-	      $SED -n -e '
-s/^\(.\{79\}\)\(..*\)/\1\
-\2/
-h
-s/\([\\"]\)/\\\1/g
-s/$/\\n/
-s/\([^\n]*\).*/  fputs ("\1", f);/p
-g
-D'
-            cat <<"EOF"
-}
 EOF
 }
 # end: func_emit_cwrapperexe_src
 
-# func_win32_import_lib_p ARG
-# True if ARG is an import lib, as indicated by $file_magic_cmd
-func_win32_import_lib_p ()
-{
-    $opt_debug
-    case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
-    *import*) : ;;
-    *) false ;;
-    esac
-}
-
 # func_mode_link arg...
 func_mode_link ()
 {
@@ -5133,7 +4072,6 @@ func_mode_link ()
     new_inherited_linker_flags=
 
     avoid_version=no
-    bindir=
     dlfiles=
     dlprefiles=
     dlself=no
@@ -5226,11 +4164,6 @@ func_mode_link ()
 	esac
 
 	case $prev in
-	bindir)
-	  bindir="$arg"
-	  prev=
-	  continue
-	  ;;
 	dlfiles|dlprefiles)
 	  if test "$preload" = no; then
 	    # Add the symbol object into the linking commands.
@@ -5262,9 +4195,9 @@ func_mode_link ()
 	    ;;
 	  *)
 	    if test "$prev" = dlfiles; then
-	      func_append dlfiles " $arg"
+	      dlfiles="$dlfiles $arg"
 	    else
-	      func_append dlprefiles " $arg"
+	      dlprefiles="$dlprefiles $arg"
 	    fi
 	    prev=
 	    continue
@@ -5288,7 +4221,7 @@ func_mode_link ()
 	    *-*-darwin*)
 	      case "$deplibs " in
 		*" $qarg.ltframework "*) ;;
-		*) func_append deplibs " $qarg.ltframework" # this is fixed later
+		*) deplibs="$deplibs $qarg.ltframework" # this is fixed later
 		   ;;
 	      esac
 	      ;;
@@ -5307,7 +4240,7 @@ func_mode_link ()
 	    moreargs=
 	    for fil in `cat "$save_arg"`
 	    do
-#	      func_append moreargs " $fil"
+#	      moreargs="$moreargs $fil"
 	      arg=$fil
 	      # A libtool-controlled object.
 
@@ -5336,7 +4269,7 @@ func_mode_link ()
 
 		  if test "$prev" = dlfiles; then
 		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
-		      func_append dlfiles " $pic_object"
+		      dlfiles="$dlfiles $pic_object"
 		      prev=
 		      continue
 		    else
@@ -5348,7 +4281,7 @@ func_mode_link ()
 		  # CHECK ME:  I think I busted this.  -Ossama
 		  if test "$prev" = dlprefiles; then
 		    # Preload the old-style object.
-		    func_append dlprefiles " $pic_object"
+		    dlprefiles="$dlprefiles $pic_object"
 		    prev=
 		  fi
 
@@ -5418,12 +4351,12 @@ func_mode_link ()
 	  if test "$prev" = rpath; then
 	    case "$rpath " in
 	    *" $arg "*) ;;
-	    *) func_append rpath " $arg" ;;
+	    *) rpath="$rpath $arg" ;;
 	    esac
 	  else
 	    case "$xrpath " in
 	    *" $arg "*) ;;
-	    *) func_append xrpath " $arg" ;;
+	    *) xrpath="$xrpath $arg" ;;
 	    esac
 	  fi
 	  prev=
@@ -5435,28 +4368,28 @@ func_mode_link ()
 	  continue
 	  ;;
 	weak)
-	  func_append weak_libs " $arg"
+	  weak_libs="$weak_libs $arg"
 	  prev=
 	  continue
 	  ;;
 	xcclinker)
-	  func_append linker_flags " $qarg"
-	  func_append compiler_flags " $qarg"
+	  linker_flags="$linker_flags $qarg"
+	  compiler_flags="$compiler_flags $qarg"
 	  prev=
 	  func_append compile_command " $qarg"
 	  func_append finalize_command " $qarg"
 	  continue
 	  ;;
 	xcompiler)
-	  func_append compiler_flags " $qarg"
+	  compiler_flags="$compiler_flags $qarg"
 	  prev=
 	  func_append compile_command " $qarg"
 	  func_append finalize_command " $qarg"
 	  continue
 	  ;;
 	xlinker)
-	  func_append linker_flags " $qarg"
-	  func_append compiler_flags " $wl$qarg"
+	  linker_flags="$linker_flags $qarg"
+	  compiler_flags="$compiler_flags $wl$qarg"
 	  prev=
 	  func_append compile_command " $wl$qarg"
 	  func_append finalize_command " $wl$qarg"
@@ -5492,11 +4425,6 @@ func_mode_link ()
 	continue
 	;;
 
-      -bindir)
-	prev=bindir
-	continue
-	;;
-
       -dlopen)
 	prev=dlfiles
 	continue
@@ -5547,16 +4475,15 @@ func_mode_link ()
 	;;
 
       -L*)
-	func_stripname "-L" '' "$arg"
-	if test -z "$func_stripname_result"; then
+	func_stripname '-L' '' "$arg"
+	dir=$func_stripname_result
+	if test -z "$dir"; then
 	  if test "$#" -gt 0; then
 	    func_fatal_error "require no space between \`-L' and \`$1'"
 	  else
 	    func_fatal_error "need path for \`-L' option"
 	  fi
 	fi
-	func_resolve_sysroot "$func_stripname_result"
-	dir=$func_resolve_sysroot_result
 	# We need an absolute path.
 	case $dir in
 	[\\/]* | [A-Za-z]:[\\/]*) ;;
@@ -5568,30 +4495,24 @@ func_mode_link ()
 	  ;;
 	esac
 	case "$deplibs " in
-	*" -L$dir "* | *" $arg "*)
-	  # Will only happen for absolute or sysroot arguments
-	  ;;
+	*" -L$dir "*) ;;
 	*)
-	  # Preserve sysroot, but never include relative directories
-	  case $dir in
-	    [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
-	    *) func_append deplibs " -L$dir" ;;
-	  esac
-	  func_append lib_search_path " $dir"
+	  deplibs="$deplibs -L$dir"
+	  lib_search_path="$lib_search_path $dir"
 	  ;;
 	esac
 	case $host in
 	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
-	  testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
+	  testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'`
 	  case :$dllsearchpath: in
 	  *":$dir:"*) ;;
 	  ::) dllsearchpath=$dir;;
-	  *) func_append dllsearchpath ":$dir";;
+	  *) dllsearchpath="$dllsearchpath:$dir";;
 	  esac
 	  case :$dllsearchpath: in
 	  *":$testbindir:"*) ;;
 	  ::) dllsearchpath=$testbindir;;
-	  *) func_append dllsearchpath ":$testbindir";;
+	  *) dllsearchpath="$dllsearchpath:$testbindir";;
 	  esac
 	  ;;
 	esac
@@ -5601,7 +4522,7 @@ func_mode_link ()
       -l*)
 	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
 	  case $host in
-	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
+	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*)
 	    # These systems don't actually have a C or math library (as such)
 	    continue
 	    ;;
@@ -5615,7 +4536,7 @@ func_mode_link ()
 	    ;;
 	  *-*-rhapsody* | *-*-darwin1.[012])
 	    # Rhapsody C and math libraries are in the System framework
-	    func_append deplibs " System.ltframework"
+	    deplibs="$deplibs System.ltframework"
 	    continue
 	    ;;
 	  *-*-sco3.2v5* | *-*-sco5v6*)
@@ -5635,7 +4556,7 @@ func_mode_link ()
 	   ;;
 	 esac
 	fi
-	func_append deplibs " $arg"
+	deplibs="$deplibs $arg"
 	continue
 	;;
 
@@ -5647,22 +4568,21 @@ func_mode_link ()
       # Tru64 UNIX uses -model [arg] to determine the layout of C++
       # classes, name mangling, and exception handling.
       # Darwin uses the -arch flag to determine output architecture.
-      -model|-arch|-isysroot|--sysroot)
-	func_append compiler_flags " $arg"
+      -model|-arch|-isysroot)
+	compiler_flags="$compiler_flags $arg"
 	func_append compile_command " $arg"
 	func_append finalize_command " $arg"
 	prev=xcompiler
 	continue
 	;;
 
-      -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
-      |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
-	func_append compiler_flags " $arg"
+      -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
+	compiler_flags="$compiler_flags $arg"
 	func_append compile_command " $arg"
 	func_append finalize_command " $arg"
 	case "$new_inherited_linker_flags " in
 	    *" $arg "*) ;;
-	    * ) func_append new_inherited_linker_flags " $arg" ;;
+	    * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
 	esac
 	continue
 	;;
@@ -5729,17 +4649,13 @@ func_mode_link ()
 	# We need an absolute path.
 	case $dir in
 	[\\/]* | [A-Za-z]:[\\/]*) ;;
-	=*)
-	  func_stripname '=' '' "$dir"
-	  dir=$lt_sysroot$func_stripname_result
-	  ;;
 	*)
 	  func_fatal_error "only absolute run-paths are allowed"
 	  ;;
 	esac
 	case "$xrpath " in
 	*" $dir "*) ;;
-	*) func_append xrpath " $dir" ;;
+	*) xrpath="$xrpath $dir" ;;
 	esac
 	continue
 	;;
@@ -5792,8 +4708,8 @@ func_mode_link ()
 	for flag in $args; do
 	  IFS="$save_ifs"
           func_quote_for_eval "$flag"
-	  func_append arg " $func_quote_for_eval_result"
-	  func_append compiler_flags " $func_quote_for_eval_result"
+	  arg="$arg $wl$func_quote_for_eval_result"
+	  compiler_flags="$compiler_flags $func_quote_for_eval_result"
 	done
 	IFS="$save_ifs"
 	func_stripname ' ' '' "$arg"
@@ -5808,9 +4724,9 @@ func_mode_link ()
 	for flag in $args; do
 	  IFS="$save_ifs"
           func_quote_for_eval "$flag"
-	  func_append arg " $wl$func_quote_for_eval_result"
-	  func_append compiler_flags " $wl$func_quote_for_eval_result"
-	  func_append linker_flags " $func_quote_for_eval_result"
+	  arg="$arg $wl$func_quote_for_eval_result"
+	  compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
+	  linker_flags="$linker_flags $func_quote_for_eval_result"
 	done
 	IFS="$save_ifs"
 	func_stripname ' ' '' "$arg"
@@ -5838,27 +4754,23 @@ func_mode_link ()
 	arg="$func_quote_for_eval_result"
 	;;
 
-      # Flags to be passed through unchanged, with rationale:
-      # -64, -mips[0-9]      enable 64-bit mode for the SGI compiler
-      # -r[0-9][0-9]*        specify processor for the SGI compiler
-      # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
-      # +DA*, +DD*           enable 64-bit mode for the HP compiler
-      # -q*                  compiler args for the IBM compiler
-      # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
-      # -F/path              path to uninstalled frameworks, gcc on darwin
-      # -p, -pg, --coverage, -fprofile-*  profiling flags for GCC
-      # @file                GCC response files
-      # -tp=*                Portland pgcc target processor selection
-      # --sysroot=*          for sysroot support
-      # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
+      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
+      # -r[0-9][0-9]* specifies the processor on the SGI compiler
+      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
+      # +DA*, +DD* enable 64-bit mode on the HP compiler
+      # -q* pass through compiler args for the IBM compiler
+      # -m*, -t[45]*, -txscale* pass through architecture-specific
+      # compiler args for GCC
+      # -F/path gives path to uninstalled frameworks, gcc on darwin
+      # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
+      # @file GCC response files
       -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
-      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
-      -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
+      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
         func_quote_for_eval "$arg"
 	arg="$func_quote_for_eval_result"
         func_append compile_command " $arg"
         func_append finalize_command " $arg"
-        func_append compiler_flags " $arg"
+        compiler_flags="$compiler_flags $arg"
         continue
         ;;
 
@@ -5870,7 +4782,7 @@ func_mode_link ()
 
       *.$objext)
 	# A standard object.
-	func_append objs " $arg"
+	objs="$objs $arg"
 	;;
 
       *.lo)
@@ -5901,7 +4813,7 @@ func_mode_link ()
 
 	    if test "$prev" = dlfiles; then
 	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
-		func_append dlfiles " $pic_object"
+		dlfiles="$dlfiles $pic_object"
 		prev=
 		continue
 	      else
@@ -5913,7 +4825,7 @@ func_mode_link ()
 	    # CHECK ME:  I think I busted this.  -Ossama
 	    if test "$prev" = dlprefiles; then
 	      # Preload the old-style object.
-	      func_append dlprefiles " $pic_object"
+	      dlprefiles="$dlprefiles $pic_object"
 	      prev=
 	    fi
 
@@ -5958,25 +4870,24 @@ func_mode_link ()
 
       *.$libext)
 	# An archive.
-	func_append deplibs " $arg"
-	func_append old_deplibs " $arg"
+	deplibs="$deplibs $arg"
+	old_deplibs="$old_deplibs $arg"
 	continue
 	;;
 
       *.la)
 	# A libtool-controlled library.
 
-	func_resolve_sysroot "$arg"
 	if test "$prev" = dlfiles; then
 	  # This library was specified with -dlopen.
-	  func_append dlfiles " $func_resolve_sysroot_result"
+	  dlfiles="$dlfiles $arg"
 	  prev=
 	elif test "$prev" = dlprefiles; then
 	  # The library was specified with -dlpreopen.
-	  func_append dlprefiles " $func_resolve_sysroot_result"
+	  dlprefiles="$dlprefiles $arg"
 	  prev=
 	else
-	  func_append deplibs " $func_resolve_sysroot_result"
+	  deplibs="$deplibs $arg"
 	fi
 	continue
 	;;
@@ -6014,7 +4925,7 @@ func_mode_link ()
 
     if test -n "$shlibpath_var"; then
       # get the directories listed in $shlibpath_var
-      eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
+      eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
     else
       shlib_search_path=
     fi
@@ -6023,8 +4934,6 @@ func_mode_link ()
 
     func_dirname "$output" "/" ""
     output_objdir="$func_dirname_result$objdir"
-    func_to_tool_file "$output_objdir/"
-    tool_output_objdir=$func_to_tool_file_result
     # Create the object directory.
     func_mkdir_p "$output_objdir"
 
@@ -6045,12 +4954,12 @@ func_mode_link ()
     # Find all interdependent deplibs by searching for libraries
     # that are linked more than once (e.g. -la -lb -la)
     for deplib in $deplibs; do
-      if $opt_preserve_dup_deps ; then
+      if $opt_duplicate_deps ; then
 	case "$libs " in
-	*" $deplib "*) func_append specialdeplibs " $deplib" ;;
+	*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
 	esac
       fi
-      func_append libs " $deplib"
+      libs="$libs $deplib"
     done
 
     if test "$linkmode" = lib; then
@@ -6063,9 +4972,9 @@ func_mode_link ()
       if $opt_duplicate_compiler_generated_deps; then
 	for pre_post_dep in $predeps $postdeps; do
 	  case "$pre_post_deps " in
-	  *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
+	  *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
 	  esac
-	  func_append pre_post_deps " $pre_post_dep"
+	  pre_post_deps="$pre_post_deps $pre_post_dep"
 	done
       fi
       pre_post_deps=
@@ -6135,19 +5044,17 @@ func_mode_link ()
 	for lib in $dlprefiles; do
 	  # Ignore non-libtool-libs
 	  dependency_libs=
-	  func_resolve_sysroot "$lib"
 	  case $lib in
-	  *.la)	func_source "$func_resolve_sysroot_result" ;;
+	  *.la)	func_source "$lib" ;;
 	  esac
 
 	  # Collect preopened libtool deplibs, except any this library
 	  # has declared as weak libs
 	  for deplib in $dependency_libs; do
-	    func_basename "$deplib"
-            deplib_base=$func_basename_result
+            deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"`
 	    case " $weak_libs " in
 	    *" $deplib_base "*) ;;
-	    *) func_append deplibs " $deplib" ;;
+	    *) deplibs="$deplibs $deplib" ;;
 	    esac
 	  done
 	done
@@ -6163,17 +5070,16 @@ func_mode_link ()
 	lib=
 	found=no
 	case $deplib in
-	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
-        |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
+	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
 	  if test "$linkmode,$pass" = "prog,link"; then
 	    compile_deplibs="$deplib $compile_deplibs"
 	    finalize_deplibs="$deplib $finalize_deplibs"
 	  else
-	    func_append compiler_flags " $deplib"
+	    compiler_flags="$compiler_flags $deplib"
 	    if test "$linkmode" = lib ; then
 		case "$new_inherited_linker_flags " in
 		    *" $deplib "*) ;;
-		    * ) func_append new_inherited_linker_flags " $deplib" ;;
+		    * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
 		esac
 	    fi
 	  fi
@@ -6258,7 +5164,7 @@ func_mode_link ()
 	    if test "$linkmode" = lib ; then
 		case "$new_inherited_linker_flags " in
 		    *" $deplib "*) ;;
-		    * ) func_append new_inherited_linker_flags " $deplib" ;;
+		    * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
 		esac
 	    fi
 	  fi
@@ -6271,8 +5177,7 @@ func_mode_link ()
 	    test "$pass" = conv && continue
 	    newdependency_libs="$deplib $newdependency_libs"
 	    func_stripname '-L' '' "$deplib"
-	    func_resolve_sysroot "$func_stripname_result"
-	    func_append newlib_search_path " $func_resolve_sysroot_result"
+	    newlib_search_path="$newlib_search_path $func_stripname_result"
 	    ;;
 	  prog)
 	    if test "$pass" = conv; then
@@ -6286,8 +5191,7 @@ func_mode_link ()
 	      finalize_deplibs="$deplib $finalize_deplibs"
 	    fi
 	    func_stripname '-L' '' "$deplib"
-	    func_resolve_sysroot "$func_stripname_result"
-	    func_append newlib_search_path " $func_resolve_sysroot_result"
+	    newlib_search_path="$newlib_search_path $func_stripname_result"
 	    ;;
 	  *)
 	    func_warning "\`-L' is ignored for archives/objects"
@@ -6298,21 +5202,17 @@ func_mode_link ()
 	-R*)
 	  if test "$pass" = link; then
 	    func_stripname '-R' '' "$deplib"
-	    func_resolve_sysroot "$func_stripname_result"
-	    dir=$func_resolve_sysroot_result
+	    dir=$func_stripname_result
 	    # Make sure the xrpath contains only unique directories.
 	    case "$xrpath " in
 	    *" $dir "*) ;;
-	    *) func_append xrpath " $dir" ;;
+	    *) xrpath="$xrpath $dir" ;;
 	    esac
 	  fi
 	  deplibs="$deplib $deplibs"
 	  continue
 	  ;;
-	*.la)
-	  func_resolve_sysroot "$deplib"
-	  lib=$func_resolve_sysroot_result
-	  ;;
+	*.la) lib="$deplib" ;;
 	*.$libext)
 	  if test "$pass" = conv; then
 	    deplibs="$deplib $deplibs"
@@ -6330,7 +5230,7 @@ func_mode_link ()
 		match_pattern*)
 		  set dummy $deplibs_check_method; shift
 		  match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
-		  if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
+		  if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \
 		    | $EGREP "$match_pattern_regex" > /dev/null; then
 		    valid_a_lib=yes
 		  fi
@@ -6340,15 +5240,15 @@ func_mode_link ()
 		;;
 	      esac
 	      if test "$valid_a_lib" != yes; then
-		echo
+		$ECHO
 		$ECHO "*** Warning: Trying to link with static lib archive $deplib."
-		echo "*** I have the capability to make that library automatically link in when"
-		echo "*** you link to this library.  But I can only do this if you have a"
-		echo "*** shared version of the library, which you do not appear to have"
-		echo "*** because the file extensions .$libext of this argument makes me believe"
-		echo "*** that it is just a static archive that I should not use here."
+		$ECHO "*** I have the capability to make that library automatically link in when"
+		$ECHO "*** you link to this library.  But I can only do this if you have a"
+		$ECHO "*** shared version of the library, which you do not appear to have"
+		$ECHO "*** because the file extensions .$libext of this argument makes me believe"
+		$ECHO "*** that it is just a static archive that I should not use here."
 	      else
-		echo
+		$ECHO
 		$ECHO "*** Warning: Linking the shared library $output against the"
 		$ECHO "*** static library $deplib is not portable!"
 		deplibs="$deplib $deplibs"
@@ -6375,11 +5275,11 @@ func_mode_link ()
 	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
 	      # If there is no dlopen support or we're linking statically,
 	      # we need to preload.
-	      func_append newdlprefiles " $deplib"
+	      newdlprefiles="$newdlprefiles $deplib"
 	      compile_deplibs="$deplib $compile_deplibs"
 	      finalize_deplibs="$deplib $finalize_deplibs"
 	    else
-	      func_append newdlfiles " $deplib"
+	      newdlfiles="$newdlfiles $deplib"
 	    fi
 	  fi
 	  continue
@@ -6421,20 +5321,20 @@ func_mode_link ()
 
 	# Convert "-framework foo" to "foo.ltframework"
 	if test -n "$inherited_linker_flags"; then
-	  tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
+	  tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'`
 	  for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
 	    case " $new_inherited_linker_flags " in
 	      *" $tmp_inherited_linker_flag "*) ;;
-	      *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
+	      *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
 	    esac
 	  done
 	fi
-	dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+	dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
 	if test "$linkmode,$pass" = "lib,link" ||
 	   test "$linkmode,$pass" = "prog,scan" ||
 	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
-	  test -n "$dlopen" && func_append dlfiles " $dlopen"
-	  test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
+	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
+	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
 	fi
 
 	if test "$pass" = conv; then
@@ -6445,17 +5345,17 @@ func_mode_link ()
 	      func_fatal_error "cannot find name of link library for \`$lib'"
 	    fi
 	    # It is a libtool convenience library, so add in its objects.
-	    func_append convenience " $ladir/$objdir/$old_library"
-	    func_append old_convenience " $ladir/$objdir/$old_library"
+	    convenience="$convenience $ladir/$objdir/$old_library"
+	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
 	    tmp_libs=
 	    for deplib in $dependency_libs; do
 	      deplibs="$deplib $deplibs"
-	      if $opt_preserve_dup_deps ; then
+	      if $opt_duplicate_deps ; then
 		case "$tmp_libs " in
-		*" $deplib "*) func_append specialdeplibs " $deplib" ;;
+		*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
 		esac
 	      fi
-	      func_append tmp_libs " $deplib"
+	      tmp_libs="$tmp_libs $deplib"
 	    done
 	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
 	    func_fatal_error "\`$lib' is not a convenience library"
@@ -6466,15 +5366,9 @@ func_mode_link ()
 
 	# Get the name of the library we link against.
 	linklib=
-	if test -n "$old_library" &&
-	   { test "$prefer_static_libs" = yes ||
-	     test "$prefer_static_libs,$installed" = "built,no"; }; then
-	  linklib=$old_library
-	else
-	  for l in $old_library $library_names; do
-	    linklib="$l"
-	  done
-	fi
+	for l in $old_library $library_names; do
+	  linklib="$l"
+	done
 	if test -z "$linklib"; then
 	  func_fatal_error "cannot find name of link library for \`$lib'"
 	fi
@@ -6491,9 +5385,9 @@ func_mode_link ()
 	    # statically, we need to preload.  We also need to preload any
 	    # dependent libraries so libltdl's deplib preloader doesn't
 	    # bomb out in the load deplibs phase.
-	    func_append dlprefiles " $lib $dependency_libs"
+	    dlprefiles="$dlprefiles $lib $dependency_libs"
 	  else
-	    func_append newdlfiles " $lib"
+	    newdlfiles="$newdlfiles $lib"
 	  fi
 	  continue
 	fi # $pass = dlopen
@@ -6515,14 +5409,14 @@ func_mode_link ()
 
 	# Find the relevant object directory and library name.
 	if test "X$installed" = Xyes; then
-	  if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
 	    func_warning "library \`$lib' was moved."
 	    dir="$ladir"
 	    absdir="$abs_ladir"
 	    libdir="$abs_ladir"
 	  else
-	    dir="$lt_sysroot$libdir"
-	    absdir="$lt_sysroot$libdir"
+	    dir="$libdir"
+	    absdir="$libdir"
 	  fi
 	  test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
 	else
@@ -6530,12 +5424,12 @@ func_mode_link ()
 	    dir="$ladir"
 	    absdir="$abs_ladir"
 	    # Remove this search path later
-	    func_append notinst_path " $abs_ladir"
+	    notinst_path="$notinst_path $abs_ladir"
 	  else
 	    dir="$ladir/$objdir"
 	    absdir="$abs_ladir/$objdir"
 	    # Remove this search path later
-	    func_append notinst_path " $abs_ladir"
+	    notinst_path="$notinst_path $abs_ladir"
 	  fi
 	fi # $installed = yes
 	func_stripname 'lib' '.la' "$laname"
@@ -6546,46 +5440,20 @@ func_mode_link ()
 	  if test -z "$libdir" && test "$linkmode" = prog; then
 	    func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
 	  fi
-	  case "$host" in
-	    # special handling for platforms with PE-DLLs.
-	    *cygwin* | *mingw* | *cegcc* )
-	      # Linker will automatically link against shared library if both
-	      # static and shared are present.  Therefore, ensure we extract
-	      # symbols from the import library if a shared library is present
-	      # (otherwise, the dlopen module name will be incorrect).  We do
-	      # this by putting the import library name into $newdlprefiles.
-	      # We recover the dlopen module name by 'saving' the la file
-	      # name in a special purpose variable, and (later) extracting the
-	      # dlname from the la file.
-	      if test -n "$dlname"; then
-	        func_tr_sh "$dir/$linklib"
-	        eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
-	        func_append newdlprefiles " $dir/$linklib"
-	      else
-	        func_append newdlprefiles " $dir/$old_library"
-	        # Keep a list of preopened convenience libraries to check
-	        # that they are being used correctly in the link pass.
-	        test -z "$libdir" && \
-	          func_append dlpreconveniencelibs " $dir/$old_library"
-	      fi
-	    ;;
-	    * )
-	      # Prefer using a static library (so that no silly _DYNAMIC symbols
-	      # are required to link).
-	      if test -n "$old_library"; then
-	        func_append newdlprefiles " $dir/$old_library"
-	        # Keep a list of preopened convenience libraries to check
-	        # that they are being used correctly in the link pass.
-	        test -z "$libdir" && \
-	          func_append dlpreconveniencelibs " $dir/$old_library"
-	      # Otherwise, use the dlname, so that lt_dlopen finds it.
-	      elif test -n "$dlname"; then
-	        func_append newdlprefiles " $dir/$dlname"
-	      else
-	        func_append newdlprefiles " $dir/$linklib"
-	      fi
-	    ;;
-	  esac
+	  # Prefer using a static library (so that no silly _DYNAMIC symbols
+	  # are required to link).
+	  if test -n "$old_library"; then
+	    newdlprefiles="$newdlprefiles $dir/$old_library"
+	    # Keep a list of preopened convenience libraries to check
+	    # that they are being used correctly in the link pass.
+	    test -z "$libdir" && \
+		dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
+	  # Otherwise, use the dlname, so that lt_dlopen finds it.
+	  elif test -n "$dlname"; then
+	    newdlprefiles="$newdlprefiles $dir/$dlname"
+	  else
+	    newdlprefiles="$newdlprefiles $dir/$linklib"
+	  fi
 	fi # $pass = dlpreopen
 
 	if test -z "$libdir"; then
@@ -6603,7 +5471,7 @@ func_mode_link ()
 
 
 	if test "$linkmode" = prog && test "$pass" != link; then
-	  func_append newlib_search_path " $ladir"
+	  newlib_search_path="$newlib_search_path $ladir"
 	  deplibs="$lib $deplibs"
 
 	  linkalldeplibs=no
@@ -6616,8 +5484,7 @@ func_mode_link ()
 	  for deplib in $dependency_libs; do
 	    case $deplib in
 	    -L*) func_stripname '-L' '' "$deplib"
-	         func_resolve_sysroot "$func_stripname_result"
-	         func_append newlib_search_path " $func_resolve_sysroot_result"
+	         newlib_search_path="$newlib_search_path $func_stripname_result"
 		 ;;
 	    esac
 	    # Need to link against all dependency_libs?
@@ -6628,12 +5495,12 @@ func_mode_link ()
 	      # or/and link against static libraries
 	      newdependency_libs="$deplib $newdependency_libs"
 	    fi
-	    if $opt_preserve_dup_deps ; then
+	    if $opt_duplicate_deps ; then
 	      case "$tmp_libs " in
-	      *" $deplib "*) func_append specialdeplibs " $deplib" ;;
+	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
 	      esac
 	    fi
-	    func_append tmp_libs " $deplib"
+	    tmp_libs="$tmp_libs $deplib"
 	  done # for deplib
 	  continue
 	fi # $linkmode = prog...
@@ -6648,7 +5515,7 @@ func_mode_link ()
 	      # Make sure the rpath contains only unique directories.
 	      case "$temp_rpath:" in
 	      *"$absdir:"*) ;;
-	      *) func_append temp_rpath "$absdir:" ;;
+	      *) temp_rpath="$temp_rpath$absdir:" ;;
 	      esac
 	    fi
 
@@ -6660,7 +5527,7 @@ func_mode_link ()
 	    *)
 	      case "$compile_rpath " in
 	      *" $absdir "*) ;;
-	      *) func_append compile_rpath " $absdir" ;;
+	      *) compile_rpath="$compile_rpath $absdir"
 	      esac
 	      ;;
 	    esac
@@ -6669,7 +5536,7 @@ func_mode_link ()
 	    *)
 	      case "$finalize_rpath " in
 	      *" $libdir "*) ;;
-	      *) func_append finalize_rpath " $libdir" ;;
+	      *) finalize_rpath="$finalize_rpath $libdir"
 	      esac
 	      ;;
 	    esac
@@ -6694,12 +5561,12 @@ func_mode_link ()
 	  case $host in
 	  *cygwin* | *mingw* | *cegcc*)
 	      # No point in relinking DLLs because paths are not encoded
-	      func_append notinst_deplibs " $lib"
+	      notinst_deplibs="$notinst_deplibs $lib"
 	      need_relink=no
 	    ;;
 	  *)
 	    if test "$installed" = no; then
-	      func_append notinst_deplibs " $lib"
+	      notinst_deplibs="$notinst_deplibs $lib"
 	      need_relink=yes
 	    fi
 	    ;;
@@ -6716,7 +5583,7 @@ func_mode_link ()
 	    fi
 	  done
 	  if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
-	    echo
+	    $ECHO
 	    if test "$linkmode" = prog; then
 	      $ECHO "*** Warning: Linking the executable $output against the loadable module"
 	    else
@@ -6734,7 +5601,7 @@ func_mode_link ()
 	    *)
 	      case "$compile_rpath " in
 	      *" $absdir "*) ;;
-	      *) func_append compile_rpath " $absdir" ;;
+	      *) compile_rpath="$compile_rpath $absdir"
 	      esac
 	      ;;
 	    esac
@@ -6743,7 +5610,7 @@ func_mode_link ()
 	    *)
 	      case "$finalize_rpath " in
 	      *" $libdir "*) ;;
-	      *) func_append finalize_rpath " $libdir" ;;
+	      *) finalize_rpath="$finalize_rpath $libdir"
 	      esac
 	      ;;
 	    esac
@@ -6797,7 +5664,7 @@ func_mode_link ()
 	    linklib=$newlib
 	  fi # test -n "$old_archive_from_expsyms_cmds"
 
-	  if test "$linkmode" = prog || test "$opt_mode" != relink; then
+	  if test "$linkmode" = prog || test "$mode" != relink; then
 	    add_shlibpath=
 	    add_dir=
 	    add=
@@ -6819,9 +5686,9 @@ func_mode_link ()
 		      if test "X$dlopenmodule" != "X$lib"; then
 			$ECHO "*** Warning: lib $linklib is a module, not a shared library"
 			if test -z "$old_library" ; then
-			  echo
-			  echo "*** And there doesn't seem to be a static archive available"
-			  echo "*** The link will probably fail, sorry"
+			  $ECHO
+			  $ECHO "*** And there doesn't seem to be a static archive available"
+			  $ECHO "*** The link will probably fail, sorry"
 			else
 			  add="$dir/$old_library"
 			fi
@@ -6848,12 +5715,12 @@ func_mode_link ()
 	         test "$hardcode_direct_absolute" = no; then
 		add="$dir/$linklib"
 	      elif test "$hardcode_minus_L" = yes; then
-		add_dir="-L$absdir"
+		add_dir="-L$dir"
 		# Try looking first in the location we're being installed to.
 		if test -n "$inst_prefix_dir"; then
 		  case $libdir in
 		    [\\/]*)
-		      func_append add_dir " -L$inst_prefix_dir$libdir"
+		      add_dir="$add_dir -L$inst_prefix_dir$libdir"
 		      ;;
 		  esac
 		fi
@@ -6875,7 +5742,7 @@ func_mode_link ()
 	    if test -n "$add_shlibpath"; then
 	      case :$compile_shlibpath: in
 	      *":$add_shlibpath:"*) ;;
-	      *) func_append compile_shlibpath "$add_shlibpath:" ;;
+	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
 	      esac
 	    fi
 	    if test "$linkmode" = prog; then
@@ -6889,13 +5756,13 @@ func_mode_link ()
 		 test "$hardcode_shlibpath_var" = yes; then
 		case :$finalize_shlibpath: in
 		*":$libdir:"*) ;;
-		*) func_append finalize_shlibpath "$libdir:" ;;
+		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
 		esac
 	      fi
 	    fi
 	  fi
 
-	  if test "$linkmode" = prog || test "$opt_mode" = relink; then
+	  if test "$linkmode" = prog || test "$mode" = relink; then
 	    add_shlibpath=
 	    add_dir=
 	    add=
@@ -6909,7 +5776,7 @@ func_mode_link ()
 	    elif test "$hardcode_shlibpath_var" = yes; then
 	      case :$finalize_shlibpath: in
 	      *":$libdir:"*) ;;
-	      *) func_append finalize_shlibpath "$libdir:" ;;
+	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
 	      esac
 	      add="-l$name"
 	    elif test "$hardcode_automatic" = yes; then
@@ -6926,7 +5793,7 @@ func_mode_link ()
 	      if test -n "$inst_prefix_dir"; then
 		case $libdir in
 		  [\\/]*)
-		    func_append add_dir " -L$inst_prefix_dir$libdir"
+		    add_dir="$add_dir -L$inst_prefix_dir$libdir"
 		    ;;
 		esac
 	      fi
@@ -6961,21 +5828,21 @@ func_mode_link ()
 
 	    # Just print a warning and add the library to dependency_libs so
 	    # that the program can be linked against the static library.
-	    echo
+	    $ECHO
 	    $ECHO "*** Warning: This system can not link to static lib archive $lib."
-	    echo "*** I have the capability to make that library automatically link in when"
-	    echo "*** you link to this library.  But I can only do this if you have a"
-	    echo "*** shared version of the library, which you do not appear to have."
+	    $ECHO "*** I have the capability to make that library automatically link in when"
+	    $ECHO "*** you link to this library.  But I can only do this if you have a"
+	    $ECHO "*** shared version of the library, which you do not appear to have."
 	    if test "$module" = yes; then
-	      echo "*** But as you try to build a module library, libtool will still create "
-	      echo "*** a static module, that should work as long as the dlopening application"
-	      echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
+	      $ECHO "*** But as you try to build a module library, libtool will still create "
+	      $ECHO "*** a static module, that should work as long as the dlopening application"
+	      $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime."
 	      if test -z "$global_symbol_pipe"; then
-		echo
-		echo "*** However, this would only work if libtool was able to extract symbol"
-		echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
-		echo "*** not find such a program.  So, this module is probably useless."
-		echo "*** \`nm' from GNU binutils and a full rebuild may help."
+		$ECHO
+		$ECHO "*** However, this would only work if libtool was able to extract symbol"
+		$ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
+		$ECHO "*** not find such a program.  So, this module is probably useless."
+		$ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
 	      fi
 	      if test "$build_old_libs" = no; then
 		build_libtool_libs=module
@@ -7003,33 +5870,27 @@ func_mode_link ()
 	           temp_xrpath=$func_stripname_result
 		   case " $xrpath " in
 		   *" $temp_xrpath "*) ;;
-		   *) func_append xrpath " $temp_xrpath";;
+		   *) xrpath="$xrpath $temp_xrpath";;
 		   esac;;
-	      *) func_append temp_deplibs " $libdir";;
+	      *) temp_deplibs="$temp_deplibs $libdir";;
 	      esac
 	    done
 	    dependency_libs="$temp_deplibs"
 	  fi
 
-	  func_append newlib_search_path " $absdir"
+	  newlib_search_path="$newlib_search_path $absdir"
 	  # Link against this library
 	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
 	  # ... and its dependency_libs
 	  tmp_libs=
 	  for deplib in $dependency_libs; do
 	    newdependency_libs="$deplib $newdependency_libs"
-	    case $deplib in
-              -L*) func_stripname '-L' '' "$deplib"
-                   func_resolve_sysroot "$func_stripname_result";;
-              *) func_resolve_sysroot "$deplib" ;;
-            esac
-	    if $opt_preserve_dup_deps ; then
+	    if $opt_duplicate_deps ; then
 	      case "$tmp_libs " in
-	      *" $func_resolve_sysroot_result "*)
-                func_append specialdeplibs " $func_resolve_sysroot_result" ;;
+	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
 	      esac
 	    fi
-	    func_append tmp_libs " $func_resolve_sysroot_result"
+	    tmp_libs="$tmp_libs $deplib"
 	  done
 
 	  if test "$link_all_deplibs" != no; then
@@ -7039,10 +5900,8 @@ func_mode_link ()
 	      case $deplib in
 	      -L*) path="$deplib" ;;
 	      *.la)
-	        func_resolve_sysroot "$deplib"
-	        deplib=$func_resolve_sysroot_result
 	        func_dirname "$deplib" "" "."
-		dir=$func_dirname_result
+		dir="$func_dirname_result"
 		# We need an absolute path.
 		case $dir in
 		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
@@ -7069,8 +5928,8 @@ func_mode_link ()
                       if test -z "$darwin_install_name"; then
                           darwin_install_name=`${OTOOL64} -L $depdepl  | awk '{if (NR == 2) {print $1;exit}}'`
                       fi
-		      func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
-		      func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}"
+		      compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
+		      linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
 		      path=
 		    fi
 		  fi
@@ -7103,7 +5962,7 @@ func_mode_link ()
 	  compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
 	  finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
 	else
-	  compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+	  compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
 	fi
       fi
       dependency_libs="$newdependency_libs"
@@ -7120,7 +5979,7 @@ func_mode_link ()
 	  for dir in $newlib_search_path; do
 	    case "$lib_search_path " in
 	    *" $dir "*) ;;
-	    *) func_append lib_search_path " $dir" ;;
+	    *) lib_search_path="$lib_search_path $dir" ;;
 	    esac
 	  done
 	  newlib_search_path=
@@ -7178,10 +6037,10 @@ func_mode_link ()
 	    -L*)
 	      case " $tmp_libs " in
 	      *" $deplib "*) ;;
-	      *) func_append tmp_libs " $deplib" ;;
+	      *) tmp_libs="$tmp_libs $deplib" ;;
 	      esac
 	      ;;
-	    *) func_append tmp_libs " $deplib" ;;
+	    *) tmp_libs="$tmp_libs $deplib" ;;
 	    esac
 	  done
 	  eval $var=\"$tmp_libs\"
@@ -7197,7 +6056,7 @@ func_mode_link ()
 	  ;;
 	esac
 	if test -n "$i" ; then
-	  func_append tmp_libs " $i"
+	  tmp_libs="$tmp_libs $i"
 	fi
       done
       dependency_libs=$tmp_libs
@@ -7238,7 +6097,7 @@ func_mode_link ()
       # Now set the variables for building old libraries.
       build_libtool_libs=no
       oldlibs="$output"
-      func_append objs "$old_deplibs"
+      objs="$objs$old_deplibs"
       ;;
 
     lib)
@@ -7271,10 +6130,10 @@ func_mode_link ()
 	if test "$deplibs_check_method" != pass_all; then
 	  func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
 	else
-	  echo
+	  $ECHO
 	  $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
 	  $ECHO "*** objects $objs is not portable!"
-	  func_append libobjs " $objs"
+	  libobjs="$libobjs $objs"
 	fi
       fi
 
@@ -7333,14 +6192,13 @@ func_mode_link ()
 	  # which has an extra 1 added just for fun
 	  #
 	  case $version_type in
-	  # correct linux to gnu/linux during the next big refactor
 	  darwin|linux|osf|windows|none)
 	    func_arith $number_major + $number_minor
 	    current=$func_arith_result
 	    age="$number_minor"
 	    revision="$number_revision"
 	    ;;
-	  freebsd-aout|freebsd-elf|qnx|sunos)
+	  freebsd-aout|freebsd-elf|sunos)
 	    current="$number_major"
 	    revision="$number_minor"
 	    age="0"
@@ -7453,7 +6311,7 @@ func_mode_link ()
 	  versuffix="$major.$revision"
 	  ;;
 
-	linux) # correct to gnu/linux during the next big refactor
+	linux)
 	  func_arith $current - $age
 	  major=.$func_arith_result
 	  versuffix="$major.$age.$revision"
@@ -7476,7 +6334,7 @@ func_mode_link ()
 	  done
 
 	  # Make executables depend on our current version.
-	  func_append verstring ":${current}.0"
+	  verstring="$verstring:${current}.0"
 	  ;;
 
 	qnx)
@@ -7544,10 +6402,10 @@ func_mode_link ()
       fi
 
       func_generate_dlsyms "$libname" "$libname" "yes"
-      func_append libobjs " $symfileobj"
+      libobjs="$libobjs $symfileobj"
       test "X$libobjs" = "X " && libobjs=
 
-      if test "$opt_mode" != relink; then
+      if test "$mode" != relink; then
 	# Remove our outputs, but don't remove object files since they
 	# may have been created when compiling PIC objects.
 	removelist=
@@ -7563,7 +6421,7 @@ func_mode_link ()
 		   continue
 		 fi
 	       fi
-	       func_append removelist " $p"
+	       removelist="$removelist $p"
 	       ;;
 	    *) ;;
 	  esac
@@ -7574,28 +6432,27 @@ func_mode_link ()
 
       # Now set the variables for building old libraries.
       if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
-	func_append oldlibs " $output_objdir/$libname.$libext"
+	oldlibs="$oldlibs $output_objdir/$libname.$libext"
 
 	# Transform .lo files to .o files.
-	oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
+	oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
       fi
 
       # Eliminate all temporary directories.
       #for path in $notinst_path; do
-      #	lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
-      #	deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
-      #	dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
+      #	lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"`
+      #	deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"`
+      #	dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"`
       #done
 
       if test -n "$xrpath"; then
 	# If the user specified any rpath flags, then add them.
 	temp_xrpath=
 	for libdir in $xrpath; do
-	  func_replace_sysroot "$libdir"
-	  func_append temp_xrpath " -R$func_replace_sysroot_result"
+	  temp_xrpath="$temp_xrpath -R$libdir"
 	  case "$finalize_rpath " in
 	  *" $libdir "*) ;;
-	  *) func_append finalize_rpath " $libdir" ;;
+	  *) finalize_rpath="$finalize_rpath $libdir" ;;
 	  esac
 	done
 	if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
@@ -7609,7 +6466,7 @@ func_mode_link ()
       for lib in $old_dlfiles; do
 	case " $dlprefiles $dlfiles " in
 	*" $lib "*) ;;
-	*) func_append dlfiles " $lib" ;;
+	*) dlfiles="$dlfiles $lib" ;;
 	esac
       done
 
@@ -7619,19 +6476,19 @@ func_mode_link ()
       for lib in $old_dlprefiles; do
 	case "$dlprefiles " in
 	*" $lib "*) ;;
-	*) func_append dlprefiles " $lib" ;;
+	*) dlprefiles="$dlprefiles $lib" ;;
 	esac
       done
 
       if test "$build_libtool_libs" = yes; then
 	if test -n "$rpath"; then
 	  case $host in
-	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
+	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*)
 	    # these systems don't actually have a c library (as such)!
 	    ;;
 	  *-*-rhapsody* | *-*-darwin1.[012])
 	    # Rhapsody C library is in the System framework
-	    func_append deplibs " System.ltframework"
+	    deplibs="$deplibs System.ltframework"
 	    ;;
 	  *-*-netbsd*)
 	    # Don't link with libc until the a.out ld.so is fixed.
@@ -7648,7 +6505,7 @@ func_mode_link ()
 	  *)
 	    # Add libc to deplibs on all other systems if necessary.
 	    if test "$build_libtool_need_lc" = "yes"; then
-	      func_append deplibs " -lc"
+	      deplibs="$deplibs -lc"
 	    fi
 	    ;;
 	  esac
@@ -7697,7 +6554,7 @@ EOF
 		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 		  case " $predeps $postdeps " in
 		  *" $i "*)
-		    func_append newdeplibs " $i"
+		    newdeplibs="$newdeplibs $i"
 		    i=""
 		    ;;
 		  esac
@@ -7708,21 +6565,21 @@ EOF
 		  set dummy $deplib_matches; shift
 		  deplib_match=$1
 		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
-		    func_append newdeplibs " $i"
+		    newdeplibs="$newdeplibs $i"
 		  else
 		    droppeddeps=yes
-		    echo
+		    $ECHO
 		    $ECHO "*** Warning: dynamic linker does not accept needed library $i."
-		    echo "*** I have the capability to make that library automatically link in when"
-		    echo "*** you link to this library.  But I can only do this if you have a"
-		    echo "*** shared version of the library, which I believe you do not have"
-		    echo "*** because a test_compile did reveal that the linker did not use it for"
-		    echo "*** its dynamic dependency list that programs get resolved with at runtime."
+		    $ECHO "*** I have the capability to make that library automatically link in when"
+		    $ECHO "*** you link to this library.  But I can only do this if you have a"
+		    $ECHO "*** shared version of the library, which I believe you do not have"
+		    $ECHO "*** because a test_compile did reveal that the linker did not use it for"
+		    $ECHO "*** its dynamic dependency list that programs get resolved with at runtime."
 		  fi
 		fi
 		;;
 	      *)
-		func_append newdeplibs " $i"
+		newdeplibs="$newdeplibs $i"
 		;;
 	      esac
 	    done
@@ -7740,7 +6597,7 @@ EOF
 		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 		    case " $predeps $postdeps " in
 		    *" $i "*)
-		      func_append newdeplibs " $i"
+		      newdeplibs="$newdeplibs $i"
 		      i=""
 		      ;;
 		    esac
@@ -7751,29 +6608,29 @@ EOF
 		    set dummy $deplib_matches; shift
 		    deplib_match=$1
 		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
-		      func_append newdeplibs " $i"
+		      newdeplibs="$newdeplibs $i"
 		    else
 		      droppeddeps=yes
-		      echo
+		      $ECHO
 		      $ECHO "*** Warning: dynamic linker does not accept needed library $i."
-		      echo "*** I have the capability to make that library automatically link in when"
-		      echo "*** you link to this library.  But I can only do this if you have a"
-		      echo "*** shared version of the library, which you do not appear to have"
-		      echo "*** because a test_compile did reveal that the linker did not use this one"
-		      echo "*** as a dynamic dependency that programs can get resolved with at runtime."
+		      $ECHO "*** I have the capability to make that library automatically link in when"
+		      $ECHO "*** you link to this library.  But I can only do this if you have a"
+		      $ECHO "*** shared version of the library, which you do not appear to have"
+		      $ECHO "*** because a test_compile did reveal that the linker did not use this one"
+		      $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime."
 		    fi
 		  fi
 		else
 		  droppeddeps=yes
-		  echo
+		  $ECHO
 		  $ECHO "*** Warning!  Library $i is needed by this library but I was not able to"
-		  echo "*** make it link in!  You will probably need to install it or some"
-		  echo "*** library that it depends on before this library will be fully"
-		  echo "*** functional.  Installing it before continuing would be even better."
+		  $ECHO "*** make it link in!  You will probably need to install it or some"
+		  $ECHO "*** library that it depends on before this library will be fully"
+		  $ECHO "*** functional.  Installing it before continuing would be even better."
 		fi
 		;;
 	      *)
-		func_append newdeplibs " $i"
+		newdeplibs="$newdeplibs $i"
 		;;
 	      esac
 	    done
@@ -7790,27 +6647,15 @@ EOF
 	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 		case " $predeps $postdeps " in
 		*" $a_deplib "*)
-		  func_append newdeplibs " $a_deplib"
+		  newdeplibs="$newdeplibs $a_deplib"
 		  a_deplib=""
 		  ;;
 		esac
 	      fi
 	      if test -n "$a_deplib" ; then
 		libname=`eval "\\$ECHO \"$libname_spec\""`
-		if test -n "$file_magic_glob"; then
-		  libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
-		else
-		  libnameglob=$libname
-		fi
-		test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
 		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
-		  if test "$want_nocaseglob" = yes; then
-		    shopt -s nocaseglob
-		    potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
-		    $nocaseglob
-		  else
-		    potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
-		  fi
+		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
 		  for potent_lib in $potential_libs; do
 		      # Follow soft links.
 		      if ls -lLd "$potent_lib" 2>/dev/null |
@@ -7827,13 +6672,13 @@ EOF
 			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
 			case $potliblink in
 			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
-			*) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
+			*) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
 			esac
 		      done
 		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
 			 $SED -e 10q |
 			 $EGREP "$file_magic_regex" > /dev/null; then
-			func_append newdeplibs " $a_deplib"
+			newdeplibs="$newdeplibs $a_deplib"
 			a_deplib=""
 			break 2
 		      fi
@@ -7842,12 +6687,12 @@ EOF
 	      fi
 	      if test -n "$a_deplib" ; then
 		droppeddeps=yes
-		echo
+		$ECHO
 		$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
-		echo "*** I have the capability to make that library automatically link in when"
-		echo "*** you link to this library.  But I can only do this if you have a"
-		echo "*** shared version of the library, which you do not appear to have"
-		echo "*** because I did check the linker path looking for a file starting"
+		$ECHO "*** I have the capability to make that library automatically link in when"
+		$ECHO "*** you link to this library.  But I can only do this if you have a"
+		$ECHO "*** shared version of the library, which you do not appear to have"
+		$ECHO "*** because I did check the linker path looking for a file starting"
 		if test -z "$potlib" ; then
 		  $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
 		else
@@ -7858,7 +6703,7 @@ EOF
 	      ;;
 	    *)
 	      # Add a -L argument.
-	      func_append newdeplibs " $a_deplib"
+	      newdeplibs="$newdeplibs $a_deplib"
 	      ;;
 	    esac
 	  done # Gone through all deplibs.
@@ -7874,7 +6719,7 @@ EOF
 	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 		case " $predeps $postdeps " in
 		*" $a_deplib "*)
-		  func_append newdeplibs " $a_deplib"
+		  newdeplibs="$newdeplibs $a_deplib"
 		  a_deplib=""
 		  ;;
 		esac
@@ -7885,9 +6730,9 @@ EOF
 		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
 		  for potent_lib in $potential_libs; do
 		    potlib="$potent_lib" # see symlink-check above in file_magic test
-		    if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
+		    if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \
 		       $EGREP "$match_pattern_regex" > /dev/null; then
-		      func_append newdeplibs " $a_deplib"
+		      newdeplibs="$newdeplibs $a_deplib"
 		      a_deplib=""
 		      break 2
 		    fi
@@ -7896,12 +6741,12 @@ EOF
 	      fi
 	      if test -n "$a_deplib" ; then
 		droppeddeps=yes
-		echo
+		$ECHO
 		$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
-		echo "*** I have the capability to make that library automatically link in when"
-		echo "*** you link to this library.  But I can only do this if you have a"
-		echo "*** shared version of the library, which you do not appear to have"
-		echo "*** because I did check the linker path looking for a file starting"
+		$ECHO "*** I have the capability to make that library automatically link in when"
+		$ECHO "*** you link to this library.  But I can only do this if you have a"
+		$ECHO "*** shared version of the library, which you do not appear to have"
+		$ECHO "*** because I did check the linker path looking for a file starting"
 		if test -z "$potlib" ; then
 		  $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
 		else
@@ -7912,32 +6757,32 @@ EOF
 	      ;;
 	    *)
 	      # Add a -L argument.
-	      func_append newdeplibs " $a_deplib"
+	      newdeplibs="$newdeplibs $a_deplib"
 	      ;;
 	    esac
 	  done # Gone through all deplibs.
 	  ;;
 	none | unknown | *)
 	  newdeplibs=""
-	  tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
+	  tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \
+	      -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'`
 	  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 	    for i in $predeps $postdeps ; do
 	      # can't use Xsed below, because $i might contain '/'
-	      tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
+	      tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"`
 	    done
 	  fi
-	  case $tmp_deplibs in
-	  *[!\	\ ]*)
-	    echo
+	  if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[	 ]//g' |
+	     $GREP . >/dev/null; then
+	    $ECHO
 	    if test "X$deplibs_check_method" = "Xnone"; then
-	      echo "*** Warning: inter-library dependencies are not supported in this platform."
+	      $ECHO "*** Warning: inter-library dependencies are not supported in this platform."
 	    else
-	      echo "*** Warning: inter-library dependencies are not known to be supported."
+	      $ECHO "*** Warning: inter-library dependencies are not known to be supported."
 	    fi
-	    echo "*** All declared inter-library dependencies are being dropped."
+	    $ECHO "*** All declared inter-library dependencies are being dropped."
 	    droppeddeps=yes
-	    ;;
-	  esac
+	  fi
 	  ;;
 	esac
 	versuffix=$versuffix_save
@@ -7949,23 +6794,23 @@ EOF
 	case $host in
 	*-*-rhapsody* | *-*-darwin1.[012])
 	  # On Rhapsody replace the C library with the System framework
-	  newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
+	  newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
 	  ;;
 	esac
 
 	if test "$droppeddeps" = yes; then
 	  if test "$module" = yes; then
-	    echo
-	    echo "*** Warning: libtool could not satisfy all declared inter-library"
+	    $ECHO
+	    $ECHO "*** Warning: libtool could not satisfy all declared inter-library"
 	    $ECHO "*** dependencies of module $libname.  Therefore, libtool will create"
-	    echo "*** a static module, that should work as long as the dlopening"
-	    echo "*** application is linked with the -dlopen flag."
+	    $ECHO "*** a static module, that should work as long as the dlopening"
+	    $ECHO "*** application is linked with the -dlopen flag."
 	    if test -z "$global_symbol_pipe"; then
-	      echo
-	      echo "*** However, this would only work if libtool was able to extract symbol"
-	      echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
-	      echo "*** not find such a program.  So, this module is probably useless."
-	      echo "*** \`nm' from GNU binutils and a full rebuild may help."
+	      $ECHO
+	      $ECHO "*** However, this would only work if libtool was able to extract symbol"
+	      $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
+	      $ECHO "*** not find such a program.  So, this module is probably useless."
+	      $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
 	    fi
 	    if test "$build_old_libs" = no; then
 	      oldlibs="$output_objdir/$libname.$libext"
@@ -7975,16 +6820,16 @@ EOF
 	      build_libtool_libs=no
 	    fi
 	  else
-	    echo "*** The inter-library dependencies that have been dropped here will be"
-	    echo "*** automatically added whenever a program is linked with this library"
-	    echo "*** or is declared to -dlopen it."
+	    $ECHO "*** The inter-library dependencies that have been dropped here will be"
+	    $ECHO "*** automatically added whenever a program is linked with this library"
+	    $ECHO "*** or is declared to -dlopen it."
 
 	    if test "$allow_undefined" = no; then
-	      echo
-	      echo "*** Since this library must not contain undefined symbols,"
-	      echo "*** because either the platform does not support them or"
-	      echo "*** it was explicitly requested with -no-undefined,"
-	      echo "*** libtool will only create a static version of it."
+	      $ECHO
+	      $ECHO "*** Since this library must not contain undefined symbols,"
+	      $ECHO "*** because either the platform does not support them or"
+	      $ECHO "*** it was explicitly requested with -no-undefined,"
+	      $ECHO "*** libtool will only create a static version of it."
 	      if test "$build_old_libs" = no; then
 		oldlibs="$output_objdir/$libname.$libext"
 		build_libtool_libs=module
@@ -8001,9 +6846,9 @@ EOF
       # Time to change all our "foo.ltframework" stuff back to "-framework foo"
       case $host in
 	*-*-darwin*)
-	  newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
-	  new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
-	  deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+	  newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+	  new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+	  deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
 	  ;;
       esac
 
@@ -8016,7 +6861,7 @@ EOF
 	*)
 	  case " $deplibs " in
 	  *" -L$path/$objdir "*)
-	    func_append new_libs " -L$path/$objdir" ;;
+	    new_libs="$new_libs -L$path/$objdir" ;;
 	  esac
 	  ;;
 	esac
@@ -8026,10 +6871,10 @@ EOF
 	-L*)
 	  case " $new_libs " in
 	  *" $deplib "*) ;;
-	  *) func_append new_libs " $deplib" ;;
+	  *) new_libs="$new_libs $deplib" ;;
 	  esac
 	  ;;
-	*) func_append new_libs " $deplib" ;;
+	*) new_libs="$new_libs $deplib" ;;
 	esac
       done
       deplibs="$new_libs"
@@ -8041,22 +6886,15 @@ EOF
 
       # Test again, we may have decided not to build it any more
       if test "$build_libtool_libs" = yes; then
-	# Remove ${wl} instances when linking with ld.
-	# FIXME: should test the right _cmds variable.
-	case $archive_cmds in
-	  *\$LD\ *) wl= ;;
-        esac
 	if test "$hardcode_into_libs" = yes; then
 	  # Hardcode the library paths
 	  hardcode_libdirs=
 	  dep_rpath=
 	  rpath="$finalize_rpath"
-	  test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
+	  test "$mode" != relink && rpath="$compile_rpath$rpath"
 	  for libdir in $rpath; do
 	    if test -n "$hardcode_libdir_flag_spec"; then
 	      if test -n "$hardcode_libdir_separator"; then
-		func_replace_sysroot "$libdir"
-		libdir=$func_replace_sysroot_result
 		if test -z "$hardcode_libdirs"; then
 		  hardcode_libdirs="$libdir"
 		else
@@ -8065,18 +6903,18 @@ EOF
 		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
 		    ;;
 		  *)
-		    func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
+		    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
 		    ;;
 		  esac
 		fi
 	      else
 		eval flag=\"$hardcode_libdir_flag_spec\"
-		func_append dep_rpath " $flag"
+		dep_rpath="$dep_rpath $flag"
 	      fi
 	    elif test -n "$runpath_var"; then
 	      case "$perm_rpath " in
 	      *" $libdir "*) ;;
-	      *) func_append perm_rpath " $libdir" ;;
+	      *) perm_rpath="$perm_rpath $libdir" ;;
 	      esac
 	    fi
 	  done
@@ -8084,13 +6922,17 @@ EOF
 	  if test -n "$hardcode_libdir_separator" &&
 	     test -n "$hardcode_libdirs"; then
 	    libdir="$hardcode_libdirs"
-	    eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
+	    if test -n "$hardcode_libdir_flag_spec_ld"; then
+	      eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
+	    else
+	      eval dep_rpath=\"$hardcode_libdir_flag_spec\"
+	    fi
 	  fi
 	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
 	    # We should set the runpath_var.
 	    rpath=
 	    for dir in $perm_rpath; do
-	      func_append rpath "$dir:"
+	      rpath="$rpath$dir:"
 	    done
 	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
 	  fi
@@ -8098,7 +6940,7 @@ EOF
 	fi
 
 	shlibpath="$finalize_shlibpath"
-	test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
+	test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
 	if test -n "$shlibpath"; then
 	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
 	fi
@@ -8124,18 +6966,18 @@ EOF
 	linknames=
 	for link
 	do
-	  func_append linknames " $link"
+	  linknames="$linknames $link"
 	done
 
 	# Use standard objects if they are pic
-	test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
+	test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
 	test "X$libobjs" = "X " && libobjs=
 
 	delfiles=
 	if test -n "$export_symbols" && test -n "$include_expsyms"; then
 	  $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
 	  export_symbols="$output_objdir/$libname.uexp"
-	  func_append delfiles " $export_symbols"
+	  delfiles="$delfiles $export_symbols"
 	fi
 
 	orig_export_symbols=
@@ -8166,45 +7008,13 @@ EOF
 	    $opt_dry_run || $RM $export_symbols
 	    cmds=$export_symbols_cmds
 	    save_ifs="$IFS"; IFS='~'
-	    for cmd1 in $cmds; do
+	    for cmd in $cmds; do
 	      IFS="$save_ifs"
-	      # Take the normal branch if the nm_file_list_spec branch
-	      # doesn't work or if tool conversion is not needed.
-	      case $nm_file_list_spec~$to_tool_file_cmd in
-		*~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
-		  try_normal_branch=yes
-		  eval cmd=\"$cmd1\"
-		  func_len " $cmd"
-		  len=$func_len_result
-		  ;;
-		*)
-		  try_normal_branch=no
-		  ;;
-	      esac
-	      if test "$try_normal_branch" = yes \
-		 && { test "$len" -lt "$max_cmd_len" \
-		      || test "$max_cmd_len" -le -1; }
-	      then
-		func_show_eval "$cmd" 'exit $?'
-		skipped_export=false
-	      elif test -n "$nm_file_list_spec"; then
-		func_basename "$output"
-		output_la=$func_basename_result
-		save_libobjs=$libobjs
-		save_output=$output
-		output=${output_objdir}/${output_la}.nm
-		func_to_tool_file "$output"
-		libobjs=$nm_file_list_spec$func_to_tool_file_result
-		func_append delfiles " $output"
-		func_verbose "creating $NM input file list: $output"
-		for obj in $save_libobjs; do
-		  func_to_tool_file "$obj"
-		  $ECHO "$func_to_tool_file_result"
-		done > "$output"
-		eval cmd=\"$cmd1\"
+	      eval cmd=\"$cmd\"
+	      func_len " $cmd"
+	      len=$func_len_result
+	      if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
 		func_show_eval "$cmd" 'exit $?'
-		output=$save_output
-		libobjs=$save_libobjs
 		skipped_export=false
 	      else
 		# The command line is too long to execute in one step.
@@ -8226,7 +7036,7 @@ EOF
 	if test -n "$export_symbols" && test -n "$include_expsyms"; then
 	  tmp_export_symbols="$export_symbols"
 	  test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
-	  $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
+	  $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
 	fi
 
 	if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
@@ -8238,7 +7048,7 @@ EOF
 	  # global variables. join(1) would be nice here, but unfortunately
 	  # isn't a blessed tool.
 	  $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
-	  func_append delfiles " $export_symbols $output_objdir/$libname.filter"
+	  delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
 	  export_symbols=$output_objdir/$libname.def
 	  $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
 	fi
@@ -8248,7 +7058,7 @@ EOF
 	  case " $convenience " in
 	  *" $test_deplib "*) ;;
 	  *)
-	    func_append tmp_deplibs " $test_deplib"
+	    tmp_deplibs="$tmp_deplibs $test_deplib"
 	    ;;
 	  esac
 	done
@@ -8268,21 +7078,21 @@ EOF
 	    test "X$libobjs" = "X " && libobjs=
 	  else
 	    gentop="$output_objdir/${outputname}x"
-	    func_append generated " $gentop"
+	    generated="$generated $gentop"
 
 	    func_extract_archives $gentop $convenience
-	    func_append libobjs " $func_extract_archives_result"
+	    libobjs="$libobjs $func_extract_archives_result"
 	    test "X$libobjs" = "X " && libobjs=
 	  fi
 	fi
 
 	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
 	  eval flag=\"$thread_safe_flag_spec\"
-	  func_append linker_flags " $flag"
+	  linker_flags="$linker_flags $flag"
 	fi
 
 	# Make a backup of the uninstalled library when relinking
-	if test "$opt_mode" = relink; then
+	if test "$mode" = relink; then
 	  $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
 	fi
 
@@ -8327,8 +7137,7 @@ EOF
 	    save_libobjs=$libobjs
 	  fi
 	  save_output=$output
-	  func_basename "$output"
-	  output_la=$func_basename_result
+	  output_la=`$ECHO "X$output" | $Xsed -e "$basename"`
 
 	  # Clear the reloadable object creation command queue and
 	  # initialize k to one.
@@ -8341,16 +7150,13 @@ EOF
 	  if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
 	    output=${output_objdir}/${output_la}.lnkscript
 	    func_verbose "creating GNU ld script: $output"
-	    echo 'INPUT (' > $output
+	    $ECHO 'INPUT (' > $output
 	    for obj in $save_libobjs
 	    do
-	      func_to_tool_file "$obj"
-	      $ECHO "$func_to_tool_file_result" >> $output
+	      $ECHO "$obj" >> $output
 	    done
-	    echo ')' >> $output
-	    func_append delfiles " $output"
-	    func_to_tool_file "$output"
-	    output=$func_to_tool_file_result
+	    $ECHO ')' >> $output
+	    delfiles="$delfiles $output"
 	  elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
 	    output=${output_objdir}/${output_la}.lnk
 	    func_verbose "creating linker input file list: $output"
@@ -8364,12 +7170,10 @@ EOF
 	    fi
 	    for obj
 	    do
-	      func_to_tool_file "$obj"
-	      $ECHO "$func_to_tool_file_result" >> $output
+	      $ECHO "$obj" >> $output
 	    done
-	    func_append delfiles " $output"
-	    func_to_tool_file "$output"
-	    output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
+	    delfiles="$delfiles $output"
+	    output=$firstobj\"$file_list_spec$output\"
 	  else
 	    if test -n "$save_libobjs"; then
 	      func_verbose "creating reloadable object files..."
@@ -8393,19 +7197,17 @@ EOF
 		  # command to the queue.
 		  if test "$k" -eq 1 ; then
 		    # The first file doesn't have a previous command to add.
-		    reload_objs=$objlist
-		    eval concat_cmds=\"$reload_cmds\"
+		    eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
 		  else
 		    # All subsequent reloadable object files will link in
 		    # the last one created.
-		    reload_objs="$objlist $last_robj"
-		    eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
+		    eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\"
 		  fi
 		  last_robj=$output_objdir/$output_la-${k}.$objext
 		  func_arith $k + 1
 		  k=$func_arith_result
 		  output=$output_objdir/$output_la-${k}.$objext
-		  objlist=" $obj"
+		  objlist=$obj
 		  func_len " $last_robj"
 		  func_arith $len0 + $func_len_result
 		  len=$func_arith_result
@@ -8415,12 +7217,11 @@ EOF
 	      # reloadable object file.  All subsequent reloadable object
 	      # files will link in the last one created.
 	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
-	      reload_objs="$objlist $last_robj"
-	      eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
+	      eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
 	      if test -n "$last_robj"; then
 	        eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
 	      fi
-	      func_append delfiles " $output"
+	      delfiles="$delfiles $output"
 
 	    else
 	      output=
@@ -8454,7 +7255,7 @@ EOF
 		lt_exit=$?
 
 		# Restore the uninstalled library and exit
-		if test "$opt_mode" = relink; then
+		if test "$mode" = relink; then
 		  ( cd "$output_objdir" && \
 		    $RM "${realname}T" && \
 		    $MV "${realname}U" "$realname" )
@@ -8475,7 +7276,7 @@ EOF
 	    if test -n "$export_symbols" && test -n "$include_expsyms"; then
 	      tmp_export_symbols="$export_symbols"
 	      test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
-	      $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
+	      $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
 	    fi
 
 	    if test -n "$orig_export_symbols"; then
@@ -8487,7 +7288,7 @@ EOF
 	      # global variables. join(1) would be nice here, but unfortunately
 	      # isn't a blessed tool.
 	      $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
-	      func_append delfiles " $export_symbols $output_objdir/$libname.filter"
+	      delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
 	      export_symbols=$output_objdir/$libname.def
 	      $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
 	    fi
@@ -8528,10 +7329,10 @@ EOF
 	# Add any objects from preloaded convenience libraries
 	if test -n "$dlprefiles"; then
 	  gentop="$output_objdir/${outputname}x"
-	  func_append generated " $gentop"
+	  generated="$generated $gentop"
 
 	  func_extract_archives $gentop $dlprefiles
-	  func_append libobjs " $func_extract_archives_result"
+	  libobjs="$libobjs $func_extract_archives_result"
 	  test "X$libobjs" = "X " && libobjs=
 	fi
 
@@ -8547,7 +7348,7 @@ EOF
 	    lt_exit=$?
 
 	    # Restore the uninstalled library and exit
-	    if test "$opt_mode" = relink; then
+	    if test "$mode" = relink; then
 	      ( cd "$output_objdir" && \
 	        $RM "${realname}T" && \
 		$MV "${realname}U" "$realname" )
@@ -8559,7 +7360,7 @@ EOF
 	IFS="$save_ifs"
 
 	# Restore the uninstalled library and exit
-	if test "$opt_mode" = relink; then
+	if test "$mode" = relink; then
 	  $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
 
 	  if test -n "$convenience"; then
@@ -8640,21 +7441,18 @@ EOF
       if test -n "$convenience"; then
 	if test -n "$whole_archive_flag_spec"; then
 	  eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
-	  reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
+	  reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
 	else
 	  gentop="$output_objdir/${obj}x"
-	  func_append generated " $gentop"
+	  generated="$generated $gentop"
 
 	  func_extract_archives $gentop $convenience
 	  reload_conv_objs="$reload_objs $func_extract_archives_result"
 	fi
       fi
 
-      # If we're not building shared, we need to use non_pic_objs
-      test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
-
       # Create the old-style object.
-      reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
+      reload_objs="$objs$old_deplibs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
 
       output="$obj"
       func_execute_cmds "$reload_cmds" 'exit $?'
@@ -8714,8 +7512,8 @@ EOF
       case $host in
       *-*-rhapsody* | *-*-darwin1.[012])
 	# On Rhapsody replace the C library is the System framework
-	compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
-	finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
+	compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
+	finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
 	;;
       esac
 
@@ -8726,14 +7524,14 @@ EOF
 	if test "$tagname" = CXX ; then
 	  case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
 	    10.[0123])
-	      func_append compile_command " ${wl}-bind_at_load"
-	      func_append finalize_command " ${wl}-bind_at_load"
+	      compile_command="$compile_command ${wl}-bind_at_load"
+	      finalize_command="$finalize_command ${wl}-bind_at_load"
 	    ;;
 	  esac
 	fi
 	# Time to change all our "foo.ltframework" stuff back to "-framework foo"
-	compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
-	finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+	compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+	finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
 	;;
       esac
 
@@ -8747,7 +7545,7 @@ EOF
 	*)
 	  case " $compile_deplibs " in
 	  *" -L$path/$objdir "*)
-	    func_append new_libs " -L$path/$objdir" ;;
+	    new_libs="$new_libs -L$path/$objdir" ;;
 	  esac
 	  ;;
 	esac
@@ -8757,17 +7555,17 @@ EOF
 	-L*)
 	  case " $new_libs " in
 	  *" $deplib "*) ;;
-	  *) func_append new_libs " $deplib" ;;
+	  *) new_libs="$new_libs $deplib" ;;
 	  esac
 	  ;;
-	*) func_append new_libs " $deplib" ;;
+	*) new_libs="$new_libs $deplib" ;;
 	esac
       done
       compile_deplibs="$new_libs"
 
 
-      func_append compile_command " $compile_deplibs"
-      func_append finalize_command " $finalize_deplibs"
+      compile_command="$compile_command $compile_deplibs"
+      finalize_command="$finalize_command $finalize_deplibs"
 
       if test -n "$rpath$xrpath"; then
 	# If the user specified any rpath flags, then add them.
@@ -8775,7 +7573,7 @@ EOF
 	  # This is the magic to use -rpath.
 	  case "$finalize_rpath " in
 	  *" $libdir "*) ;;
-	  *) func_append finalize_rpath " $libdir" ;;
+	  *) finalize_rpath="$finalize_rpath $libdir" ;;
 	  esac
 	done
       fi
@@ -8794,18 +7592,18 @@ EOF
 	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
 		;;
 	      *)
-		func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
+		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
 		;;
 	      esac
 	    fi
 	  else
 	    eval flag=\"$hardcode_libdir_flag_spec\"
-	    func_append rpath " $flag"
+	    rpath="$rpath $flag"
 	  fi
 	elif test -n "$runpath_var"; then
 	  case "$perm_rpath " in
 	  *" $libdir "*) ;;
-	  *) func_append perm_rpath " $libdir" ;;
+	  *) perm_rpath="$perm_rpath $libdir" ;;
 	  esac
 	fi
 	case $host in
@@ -8814,12 +7612,12 @@ EOF
 	  case :$dllsearchpath: in
 	  *":$libdir:"*) ;;
 	  ::) dllsearchpath=$libdir;;
-	  *) func_append dllsearchpath ":$libdir";;
+	  *) dllsearchpath="$dllsearchpath:$libdir";;
 	  esac
 	  case :$dllsearchpath: in
 	  *":$testbindir:"*) ;;
 	  ::) dllsearchpath=$testbindir;;
-	  *) func_append dllsearchpath ":$testbindir";;
+	  *) dllsearchpath="$dllsearchpath:$testbindir";;
 	  esac
 	  ;;
 	esac
@@ -8845,18 +7643,18 @@ EOF
 	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
 		;;
 	      *)
-		func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
+		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
 		;;
 	      esac
 	    fi
 	  else
 	    eval flag=\"$hardcode_libdir_flag_spec\"
-	    func_append rpath " $flag"
+	    rpath="$rpath $flag"
 	  fi
 	elif test -n "$runpath_var"; then
 	  case "$finalize_perm_rpath " in
 	  *" $libdir "*) ;;
-	  *) func_append finalize_perm_rpath " $libdir" ;;
+	  *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
 	  esac
 	fi
       done
@@ -8870,8 +7668,8 @@ EOF
 
       if test -n "$libobjs" && test "$build_old_libs" = yes; then
 	# Transform all the library objects into standard objects.
-	compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
-	finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
+	compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+	finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
       fi
 
       func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
@@ -8883,15 +7681,15 @@ EOF
 
       wrappers_required=yes
       case $host in
-      *cegcc* | *mingw32ce*)
-        # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
-        wrappers_required=no
-        ;;
       *cygwin* | *mingw* )
         if test "$build_libtool_libs" != yes; then
           wrappers_required=no
         fi
         ;;
+      *cegcc)
+        # Disable wrappers for cegcc, we are cross compiling anyway.
+        wrappers_required=no
+        ;;
       *)
         if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
           wrappers_required=no
@@ -8900,19 +7698,13 @@ EOF
       esac
       if test "$wrappers_required" = no; then
 	# Replace the output file specification.
-	compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
+	compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
 	link_command="$compile_command$compile_rpath"
 
 	# We have no uninstalled library dependencies, so finalize right now.
 	exit_status=0
 	func_show_eval "$link_command" 'exit_status=$?'
 
-	if test -n "$postlink_cmds"; then
-	  func_to_tool_file "$output"
-	  postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
-	  func_execute_cmds "$postlink_cmds" 'exit $?'
-	fi
-
 	# Delete the generated files.
 	if test -f "$output_objdir/${outputname}S.${objext}"; then
 	  func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
@@ -8935,7 +7727,7 @@ EOF
 	  # We should set the runpath_var.
 	  rpath=
 	  for dir in $perm_rpath; do
-	    func_append rpath "$dir:"
+	    rpath="$rpath$dir:"
 	  done
 	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
 	fi
@@ -8943,7 +7735,7 @@ EOF
 	  # We should set the runpath_var.
 	  rpath=
 	  for dir in $finalize_perm_rpath; do
-	    func_append rpath "$dir:"
+	    rpath="$rpath$dir:"
 	  done
 	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
 	fi
@@ -8953,18 +7745,11 @@ EOF
 	# We don't need to create a wrapper script.
 	link_command="$compile_var$compile_command$compile_rpath"
 	# Replace the output file specification.
-	link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
+	link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
 	# Delete the old output file.
 	$opt_dry_run || $RM $output
 	# Link the executable and exit
 	func_show_eval "$link_command" 'exit $?'
-
-	if test -n "$postlink_cmds"; then
-	  func_to_tool_file "$output"
-	  postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
-	  func_execute_cmds "$postlink_cmds" 'exit $?'
-	fi
-
 	exit $EXIT_SUCCESS
       fi
 
@@ -8979,7 +7764,7 @@ EOF
 	if test "$fast_install" != no; then
 	  link_command="$finalize_var$compile_command$finalize_rpath"
 	  if test "$fast_install" = yes; then
-	    relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
+	    relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
 	  else
 	    # fast_install is set to needless
 	    relink_command=
@@ -8991,19 +7776,13 @@ EOF
       fi
 
       # Replace the output file specification.
-      link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
+      link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
 
       # Delete the old output files.
       $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
 
       func_show_eval "$link_command" 'exit $?'
 
-      if test -n "$postlink_cmds"; then
-	func_to_tool_file "$output_objdir/$outputname"
-	postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
-	func_execute_cmds "$postlink_cmds" 'exit $?'
-      fi
-
       # Now create the wrapper script.
       func_verbose "creating $output"
 
@@ -9021,7 +7800,18 @@ EOF
 	  fi
 	done
 	relink_command="(cd `pwd`; $relink_command)"
-	relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
+	relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+      fi
+
+      # Quote $ECHO for shipping.
+      if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then
+	case $progpath in
+	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
+	*) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
+	esac
+	qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"`
+      else
+	qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"`
       fi
 
       # Only actually do things if not in dry run mode.
@@ -9101,7 +7891,7 @@ EOF
 	else
 	  oldobjs="$old_deplibs $non_pic_objects"
 	  if test "$preload" = yes && test -f "$symfileobj"; then
-	    func_append oldobjs " $symfileobj"
+	    oldobjs="$oldobjs $symfileobj"
 	  fi
 	fi
 	addlibs="$old_convenience"
@@ -9109,10 +7899,10 @@ EOF
 
       if test -n "$addlibs"; then
 	gentop="$output_objdir/${outputname}x"
-	func_append generated " $gentop"
+	generated="$generated $gentop"
 
 	func_extract_archives $gentop $addlibs
-	func_append oldobjs " $func_extract_archives_result"
+	oldobjs="$oldobjs $func_extract_archives_result"
       fi
 
       # Do each command in the archive commands.
@@ -9123,10 +7913,10 @@ EOF
 	# Add any objects from preloaded convenience libraries
 	if test -n "$dlprefiles"; then
 	  gentop="$output_objdir/${outputname}x"
-	  func_append generated " $gentop"
+	  generated="$generated $gentop"
 
 	  func_extract_archives $gentop $dlprefiles
-	  func_append oldobjs " $func_extract_archives_result"
+	  oldobjs="$oldobjs $func_extract_archives_result"
 	fi
 
 	# POSIX demands no paths to be encoded in archives.  We have
@@ -9142,9 +7932,9 @@ EOF
 	    done | sort | sort -uc >/dev/null 2>&1); then
 	  :
 	else
-	  echo "copying selected object files to avoid basename conflicts..."
+	  $ECHO "copying selected object files to avoid basename conflicts..."
 	  gentop="$output_objdir/${outputname}x"
-	  func_append generated " $gentop"
+	  generated="$generated $gentop"
 	  func_mkdir_p "$gentop"
 	  save_oldobjs=$oldobjs
 	  oldobjs=
@@ -9168,30 +7958,18 @@ EOF
 		esac
 	      done
 	      func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
-	      func_append oldobjs " $gentop/$newobj"
+	      oldobjs="$oldobjs $gentop/$newobj"
 	      ;;
-	    *) func_append oldobjs " $obj" ;;
+	    *) oldobjs="$oldobjs $obj" ;;
 	    esac
 	  done
 	fi
-	func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
-	tool_oldlib=$func_to_tool_file_result
 	eval cmds=\"$old_archive_cmds\"
 
 	func_len " $cmds"
 	len=$func_len_result
 	if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
 	  cmds=$old_archive_cmds
-	elif test -n "$archiver_list_spec"; then
-	  func_verbose "using command file archive linking..."
-	  for obj in $oldobjs
-	  do
-	    func_to_tool_file "$obj"
-	    $ECHO "$func_to_tool_file_result"
-	  done > $output_objdir/$libname.libcmd
-	  func_to_tool_file "$output_objdir/$libname.libcmd"
-	  oldobjs=" $archiver_list_spec$func_to_tool_file_result"
-	  cmds=$old_archive_cmds
 	else
 	  # the command line is too long to link in one step, link in parts
 	  func_verbose "using piecewise archive linking..."
@@ -9265,7 +8043,7 @@ EOF
       done
       # Quote the link command for shipping.
       relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
-      relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
+      relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
       if test "$hardcode_automatic" = yes ; then
 	relink_command=
       fi
@@ -9285,23 +8063,12 @@ EOF
 	      *.la)
 		func_basename "$deplib"
 		name="$func_basename_result"
-		func_resolve_sysroot "$deplib"
-		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
+		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
 		test -z "$libdir" && \
 		  func_fatal_error "\`$deplib' is not a valid libtool archive"
-		func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
-		;;
-	      -L*)
-		func_stripname -L '' "$deplib"
-		func_replace_sysroot "$func_stripname_result"
-		func_append newdependency_libs " -L$func_replace_sysroot_result"
+		newdependency_libs="$newdependency_libs $libdir/$name"
 		;;
-	      -R*)
-		func_stripname -R '' "$deplib"
-		func_replace_sysroot "$func_stripname_result"
-		func_append newdependency_libs " -R$func_replace_sysroot_result"
-		;;
-	      *) func_append newdependency_libs " $deplib" ;;
+	      *) newdependency_libs="$newdependency_libs $deplib" ;;
 	      esac
 	    done
 	    dependency_libs="$newdependency_libs"
@@ -9315,9 +8082,9 @@ EOF
 		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
 		test -z "$libdir" && \
 		  func_fatal_error "\`$lib' is not a valid libtool archive"
-		func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
+		newdlfiles="$newdlfiles $libdir/$name"
 		;;
-	      *) func_append newdlfiles " $lib" ;;
+	      *) newdlfiles="$newdlfiles $lib" ;;
 	      esac
 	    done
 	    dlfiles="$newdlfiles"
@@ -9334,7 +8101,7 @@ EOF
 		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
 		test -z "$libdir" && \
 		  func_fatal_error "\`$lib' is not a valid libtool archive"
-		func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
+		newdlprefiles="$newdlprefiles $libdir/$name"
 		;;
 	      esac
 	    done
@@ -9346,7 +8113,7 @@ EOF
 		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
 		*) abs=`pwd`"/$lib" ;;
 	      esac
-	      func_append newdlfiles " $abs"
+	      newdlfiles="$newdlfiles $abs"
 	    done
 	    dlfiles="$newdlfiles"
 	    newdlprefiles=
@@ -9355,33 +8122,15 @@ EOF
 		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
 		*) abs=`pwd`"/$lib" ;;
 	      esac
-	      func_append newdlprefiles " $abs"
+	      newdlprefiles="$newdlprefiles $abs"
 	    done
 	    dlprefiles="$newdlprefiles"
 	  fi
 	  $RM $output
 	  # place dlname in correct position for cygwin
-	  # In fact, it would be nice if we could use this code for all target
-	  # systems that can't hard-code library paths into their executables
-	  # and that have no shared library path variable independent of PATH,
-	  # but it turns out we can't easily determine that from inspecting
-	  # libtool variables, so we have to hard-code the OSs to which it
-	  # applies here; at the moment, that means platforms that use the PE
-	  # object format with DLL files.  See the long comment at the top of
-	  # tests/bindir.at for full details.
 	  tdlname=$dlname
 	  case $host,$output,$installed,$module,$dlname in
-	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
-	      # If a -bindir argument was supplied, place the dll there.
-	      if test "x$bindir" != x ;
-	      then
-		func_relative_path "$install_libdir" "$bindir"
-		tdlname=$func_relative_path_result$dlname
-	      else
-		# Otherwise fall back on heuristic.
-		tdlname=../bin/$dlname
-	      fi
-	      ;;
+	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
 	  esac
 	  $ECHO > $output "\
 # $outputname - a libtool library file
@@ -9440,7 +8189,7 @@ relink_command=\"$relink_command\""
     exit $EXIT_SUCCESS
 }
 
-{ test "$opt_mode" = link || test "$opt_mode" = relink; } &&
+{ test "$mode" = link || test "$mode" = relink; } &&
     func_mode_link ${1+"$@"}
 
 
@@ -9460,9 +8209,9 @@ func_mode_uninstall ()
     for arg
     do
       case $arg in
-      -f) func_append RM " $arg"; rmforce=yes ;;
-      -*) func_append RM " $arg" ;;
-      *) func_append files " $arg" ;;
+      -f) RM="$RM $arg"; rmforce=yes ;;
+      -*) RM="$RM $arg" ;;
+      *) files="$files $arg" ;;
       esac
     done
 
@@ -9471,23 +8220,24 @@ func_mode_uninstall ()
 
     rmdirs=
 
+    origobjdir="$objdir"
     for file in $files; do
       func_dirname "$file" "" "."
       dir="$func_dirname_result"
       if test "X$dir" = X.; then
-	odir="$objdir"
+	objdir="$origobjdir"
       else
-	odir="$dir/$objdir"
+	objdir="$dir/$origobjdir"
       fi
       func_basename "$file"
       name="$func_basename_result"
-      test "$opt_mode" = uninstall && odir="$dir"
+      test "$mode" = uninstall && objdir="$dir"
 
-      # Remember odir for removal later, being careful to avoid duplicates
-      if test "$opt_mode" = clean; then
+      # Remember objdir for removal later, being careful to avoid duplicates
+      if test "$mode" = clean; then
 	case " $rmdirs " in
-	  *" $odir "*) ;;
-	  *) func_append rmdirs " $odir" ;;
+	  *" $objdir "*) ;;
+	  *) rmdirs="$rmdirs $objdir" ;;
 	esac
       fi
 
@@ -9513,17 +8263,18 @@ func_mode_uninstall ()
 
 	  # Delete the libtool libraries and symlinks.
 	  for n in $library_names; do
-	    func_append rmfiles " $odir/$n"
+	    rmfiles="$rmfiles $objdir/$n"
 	  done
-	  test -n "$old_library" && func_append rmfiles " $odir/$old_library"
+	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
 
-	  case "$opt_mode" in
+	  case "$mode" in
 	  clean)
-	    case " $library_names " in
+	    case "  $library_names " in
+	    # "  " in the beginning catches empty $dlname
 	    *" $dlname "*) ;;
-	    *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
+	    *) rmfiles="$rmfiles $objdir/$dlname" ;;
 	    esac
-	    test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
+	    test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
 	    ;;
 	  uninstall)
 	    if test -n "$library_names"; then
@@ -9551,19 +8302,19 @@ func_mode_uninstall ()
 	  # Add PIC object to the list of files to remove.
 	  if test -n "$pic_object" &&
 	     test "$pic_object" != none; then
-	    func_append rmfiles " $dir/$pic_object"
+	    rmfiles="$rmfiles $dir/$pic_object"
 	  fi
 
 	  # Add non-PIC object to the list of files to remove.
 	  if test -n "$non_pic_object" &&
 	     test "$non_pic_object" != none; then
-	    func_append rmfiles " $dir/$non_pic_object"
+	    rmfiles="$rmfiles $dir/$non_pic_object"
 	  fi
 	fi
 	;;
 
       *)
-	if test "$opt_mode" = clean ; then
+	if test "$mode" = clean ; then
 	  noexename=$name
 	  case $file in
 	  *.exe)
@@ -9573,7 +8324,7 @@ func_mode_uninstall ()
 	    noexename=$func_stripname_result
 	    # $file with .exe has already been added to rmfiles,
 	    # add $file without .exe
-	    func_append rmfiles " $file"
+	    rmfiles="$rmfiles $file"
 	    ;;
 	  esac
 	  # Do a test to see if this is a libtool program.
@@ -9582,7 +8333,7 @@ func_mode_uninstall ()
 	      func_ltwrapper_scriptname "$file"
 	      relink_command=
 	      func_source $func_ltwrapper_scriptname_result
-	      func_append rmfiles " $func_ltwrapper_scriptname_result"
+	      rmfiles="$rmfiles $func_ltwrapper_scriptname_result"
 	    else
 	      relink_command=
 	      func_source $dir/$noexename
@@ -9590,12 +8341,12 @@ func_mode_uninstall ()
 
 	    # note $name still contains .exe if it was in $file originally
 	    # as does the version of $file that was added into $rmfiles
-	    func_append rmfiles " $odir/$name $odir/${name}S.${objext}"
+	    rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
 	    if test "$fast_install" = yes && test -n "$relink_command"; then
-	      func_append rmfiles " $odir/lt-$name"
+	      rmfiles="$rmfiles $objdir/lt-$name"
 	    fi
 	    if test "X$noexename" != "X$name" ; then
-	      func_append rmfiles " $odir/lt-${noexename}.c"
+	      rmfiles="$rmfiles $objdir/lt-${noexename}.c"
 	    fi
 	  fi
 	fi
@@ -9603,6 +8354,7 @@ func_mode_uninstall ()
       esac
       func_show_eval "$RM $rmfiles" 'exit_status=1'
     done
+    objdir="$origobjdir"
 
     # Try to remove the ${objdir}s in the directories where we deleted files
     for dir in $rmdirs; do
@@ -9614,16 +8366,16 @@ func_mode_uninstall ()
     exit $exit_status
 }
 
-{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
+{ test "$mode" = uninstall || test "$mode" = clean; } &&
     func_mode_uninstall ${1+"$@"}
 
-test -z "$opt_mode" && {
+test -z "$mode" && {
   help="$generic_help"
   func_fatal_help "you must specify a MODE"
 }
 
 test -z "$exec_cmd" && \
-  func_fatal_help "invalid operation mode \`$opt_mode'"
+  func_fatal_help "invalid operation mode \`$mode'"
 
 if test -n "$exec_cmd"; then
   eval exec "$exec_cmd"
diff --git a/m4/ax_boost_filesystem.m4 b/m4/ax_boost_filesystem.m4
deleted file mode 100644
index 18df8f4..0000000
--- a/m4/ax_boost_filesystem.m4
+++ /dev/null
@@ -1,118 +0,0 @@
-# ===========================================================================
-#    http://www.gnu.org/software/autoconf-archive/ax_boost_filesystem.html
-# ===========================================================================
-#
-# SYNOPSIS
-#
-#   AX_BOOST_FILESYSTEM
-#
-# DESCRIPTION
-#
-#   Test for Filesystem library from the Boost C++ libraries. The macro
-#   requires a preceding call to AX_BOOST_BASE. Further documentation is
-#   available at <http://randspringer.de/boost/index.html>.
-#
-#   This macro calls:
-#
-#     AC_SUBST(BOOST_FILESYSTEM_LIB)
-#
-#   And sets:
-#
-#     HAVE_BOOST_FILESYSTEM
-#
-# LICENSE
-#
-#   Copyright (c) 2009 Thomas Porschberg <thomas at randspringer.de>
-#   Copyright (c) 2009 Michael Tindal
-#   Copyright (c) 2009 Roman Rybalko <libtorrent at romanr.info>
-#
-#   Copying and distribution of this file, with or without modification, are
-#   permitted in any medium without royalty provided the copyright notice
-#   and this notice are preserved. This file is offered as-is, without any
-#   warranty.
-
-#serial 22
-
-AC_DEFUN([AX_BOOST_FILESYSTEM],
-[
-	AC_ARG_WITH([boost-filesystem],
-	AS_HELP_STRING([--with-boost-filesystem@<:@=special-lib@:>@],
-                   [use the Filesystem library from boost - it is possible to specify a certain library for the linker
-                        e.g. --with-boost-filesystem=boost_filesystem-gcc-mt ]),
-        [
-        if test "$withval" = "no"; then
-			want_boost="no"
-        elif test "$withval" = "yes"; then
-            want_boost="yes"
-            ax_boost_user_filesystem_lib=""
-        else
-		    want_boost="yes"
-		ax_boost_user_filesystem_lib="$withval"
-		fi
-        ],
-        [want_boost="yes"]
-	)
-
-	if test "x$want_boost" = "xyes"; then
-        AC_REQUIRE([AC_PROG_CC])
-		CPPFLAGS_SAVED="$CPPFLAGS"
-		CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
-		export CPPFLAGS
-
-		LDFLAGS_SAVED="$LDFLAGS"
-		LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
-		export LDFLAGS
-
-		LIBS_SAVED=$LIBS
-		LIBS="$LIBS $BOOST_SYSTEM_LIB"
-		export LIBS
-
-        AC_CACHE_CHECK(whether the Boost::Filesystem library is available,
-					   ax_cv_boost_filesystem,
-        [AC_LANG_PUSH([C++])
-         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <boost/filesystem/path.hpp>]],
-                                   [[using namespace boost::filesystem;
-                                   path my_path( "foo/bar/data.txt" );
-                                   return 0;]])],
-					       ax_cv_boost_filesystem=yes, ax_cv_boost_filesystem=no)
-         AC_LANG_POP([C++])
-		])
-		if test "x$ax_cv_boost_filesystem" = "xyes"; then
-			AC_DEFINE(HAVE_BOOST_FILESYSTEM,,[define if the Boost::Filesystem library is available])
-            BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
-            if test "x$ax_boost_user_filesystem_lib" = "x"; then
-                for libextension in `ls $BOOSTLIBDIR/libboost_filesystem*.so* $BOOSTLIBDIR/libboost_filesystem*.dylib* $BOOSTLIBDIR/libboost_filesystem*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_filesystem.*\)\.so.*$;\1;' -e 's;^lib\(boost_filesystem.*\)\.a*$;\1;' -e 's;^lib\(boost_filesystem.*\)\.dylib$;\1;'` ; do
-                     ax_lib=${libextension}
-				    AC_CHECK_LIB($ax_lib, exit,
-                                 [BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break],
-                                 [link_filesystem="no"])
-				done
-                if test "x$link_filesystem" != "xyes"; then
-                for libextension in `ls $BOOSTLIBDIR/boost_filesystem*.{dll,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_filesystem.*\)\.dll.*$;\1;' -e 's;^\(boost_filesystem.*\)\.a*$;\1;'` ; do
-                     ax_lib=${libextension}
-				    AC_CHECK_LIB($ax_lib, exit,
-                                 [BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break],
-                                 [link_filesystem="no"])
-				done
-		    fi
-            else
-               for ax_lib in $ax_boost_user_filesystem_lib boost_filesystem-$ax_boost_user_filesystem_lib; do
-				      AC_CHECK_LIB($ax_lib, exit,
-                                   [BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break],
-                                   [link_filesystem="no"])
-                  done
-
-            fi
-            if test "x$ax_lib" = "x"; then
-                AC_MSG_ERROR(Could not find a version of the library!)
-            fi
-			if test "x$link_filesystem" != "xyes"; then
-				AC_MSG_ERROR(Could not link against $ax_lib !)
-			fi
-		fi
-
-		CPPFLAGS="$CPPFLAGS_SAVED"
-		LDFLAGS="$LDFLAGS_SAVED"
-		LIBS="$LIBS_SAVED"
-	fi
-])
diff --git a/m4/ax_boost_iostreams.m4 b/m4/ax_boost_iostreams.m4
deleted file mode 100644
index 0fef02f..0000000
--- a/m4/ax_boost_iostreams.m4
+++ /dev/null
@@ -1,116 +0,0 @@
-# ===========================================================================
-#    http://www.gnu.org/software/autoconf-archive/ax_boost_iostreams.html
-# ===========================================================================
-#
-# SYNOPSIS
-#
-#   AX_BOOST_IOSTREAMS
-#
-# DESCRIPTION
-#
-#   Test for IOStreams library from the Boost C++ libraries. The macro
-#   requires a preceding call to AX_BOOST_BASE. Further documentation is
-#   available at <http://randspringer.de/boost/index.html>.
-#
-#   This macro calls:
-#
-#     AC_SUBST(BOOST_IOSTREAMS_LIB)
-#
-#   And sets:
-#
-#     HAVE_BOOST_IOSTREAMS
-#
-# LICENSE
-#
-#   Copyright (c) 2008 Thomas Porschberg <thomas at randspringer.de>
-#
-#   Copying and distribution of this file, with or without modification, are
-#   permitted in any medium without royalty provided the copyright notice
-#   and this notice are preserved. This file is offered as-is, without any
-#   warranty.
-
-#serial 18
-
-AC_DEFUN([AX_BOOST_IOSTREAMS],
-[
-	AC_ARG_WITH([boost-iostreams],
-	AS_HELP_STRING([--with-boost-iostreams@<:@=special-lib@:>@],
-                   [use the IOStreams library from boost - it is possible to specify a certain library for the linker
-                        e.g. --with-boost-iostreams=boost_iostreams-gcc-mt-d-1_33_1 ]),
-        [
-        if test "$withval" = "no"; then
-			want_boost="no"
-        elif test "$withval" = "yes"; then
-            want_boost="yes"
-            ax_boost_user_iostreams_lib=""
-        else
-		    want_boost="yes"
-		ax_boost_user_iostreams_lib="$withval"
-		fi
-        ],
-        [want_boost="yes"]
-	)
-
-	if test "x$want_boost" = "xyes"; then
-        AC_REQUIRE([AC_PROG_CC])
-		CPPFLAGS_SAVED="$CPPFLAGS"
-		CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
-		export CPPFLAGS
-
-		LDFLAGS_SAVED="$LDFLAGS"
-		LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
-		export LDFLAGS
-
-        AC_CACHE_CHECK(whether the Boost::IOStreams library is available,
-					   ax_cv_boost_iostreams,
-        [AC_LANG_PUSH([C++])
-		 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <boost/iostreams/filtering_stream.hpp>
-											 @%:@include <boost/range/iterator_range.hpp>
-											]],
-                                  [[std::string  input = "Hello World!";
-								 namespace io = boost::iostreams;
-									 io::filtering_istream  in(boost::make_iterator_range(input));
-									 return 0;
-                                   ]])],
-                             ax_cv_boost_iostreams=yes, ax_cv_boost_iostreams=no)
-         AC_LANG_POP([C++])
-		])
-		if test "x$ax_cv_boost_iostreams" = "xyes"; then
-			AC_DEFINE(HAVE_BOOST_IOSTREAMS,,[define if the Boost::IOStreams library is available])
-            BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
-            if test "x$ax_boost_user_iostreams_lib" = "x"; then
-                for libextension in `ls $BOOSTLIBDIR/libboost_iostreams*.so* $BOOSTLIBDIR/libboost_iostreams*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_iostreams.*\)\.so.*$;\1;' -e 's;^lib\(boost_iostreams.*\)\.a*$;\1;'` ; do
-                     ax_lib=${libextension}
-				    AC_CHECK_LIB($ax_lib, exit,
-                                 [BOOST_IOSTREAMS_LIB="-l$ax_lib"; AC_SUBST(BOOST_IOSTREAMS_LIB) link_iostreams="yes"; break],
-                                 [link_iostreams="no"])
-				done
-                if test "x$link_iostreams" != "xyes"; then
-                for libextension in `ls $BOOSTLIBDIR/boost_iostreams*.{dll,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_iostreams.*\)\.dll.*$;\1;' -e 's;^\(boost_iostreams.*\)\.a*$;\1;'` ; do
-                     ax_lib=${libextension}
-				    AC_CHECK_LIB($ax_lib, exit,
-                                 [BOOST_IOSTREAMS_LIB="-l$ax_lib"; AC_SUBST(BOOST_IOSTREAMS_LIB) link_iostreams="yes"; break],
-                                 [link_iostreams="no"])
-				done
-                fi
-
-            else
-               for ax_lib in $ax_boost_user_iostreams_lib boost_iostreams-$ax_boost_user_iostreams_lib; do
-				      AC_CHECK_LIB($ax_lib, main,
-                                   [BOOST_IOSTREAMS_LIB="-l$ax_lib"; AC_SUBST(BOOST_IOSTREAMS_LIB) link_iostreams="yes"; break],
-                                   [link_iostreams="no"])
-                  done
-
-            fi
-            if test "x$ax_lib" = "x"; then
-                AC_MSG_ERROR(Could not find a version of the library!)
-            fi
-			if test "x$link_iostreams" != "xyes"; then
-				AC_MSG_ERROR(Could not link against $ax_lib !)
-			fi
-		fi
-
-		CPPFLAGS="$CPPFLAGS_SAVED"
-	LDFLAGS="$LDFLAGS_SAVED"
-	fi
-])
diff --git a/m4/ax_boost_system.m4 b/m4/ax_boost_system.m4
deleted file mode 100644
index 7fbf6d3..0000000
--- a/m4/ax_boost_system.m4
+++ /dev/null
@@ -1,120 +0,0 @@
-# ===========================================================================
-#      http://www.gnu.org/software/autoconf-archive/ax_boost_system.html
-# ===========================================================================
-#
-# SYNOPSIS
-#
-#   AX_BOOST_SYSTEM
-#
-# DESCRIPTION
-#
-#   Test for System library from the Boost C++ libraries. The macro requires
-#   a preceding call to AX_BOOST_BASE. Further documentation is available at
-#   <http://randspringer.de/boost/index.html>.
-#
-#   This macro calls:
-#
-#     AC_SUBST(BOOST_SYSTEM_LIB)
-#
-#   And sets:
-#
-#     HAVE_BOOST_SYSTEM
-#
-# LICENSE
-#
-#   Copyright (c) 2008 Thomas Porschberg <thomas at randspringer.de>
-#   Copyright (c) 2008 Michael Tindal
-#   Copyright (c) 2008 Daniel Casimiro <dan.casimiro at gmail.com>
-#
-#   Copying and distribution of this file, with or without modification, are
-#   permitted in any medium without royalty provided the copyright notice
-#   and this notice are preserved. This file is offered as-is, without any
-#   warranty.
-
-#serial 14
-
-AC_DEFUN([AX_BOOST_SYSTEM],
-[
-	AC_ARG_WITH([boost-system],
-	AS_HELP_STRING([--with-boost-system@<:@=special-lib@:>@],
-                   [use the System library from boost - it is possible to specify a certain library for the linker
-                        e.g. --with-boost-system=boost_system-gcc-mt ]),
-        [
-        if test "$withval" = "no"; then
-			want_boost="no"
-        elif test "$withval" = "yes"; then
-            want_boost="yes"
-            ax_boost_user_system_lib=""
-        else
-		    want_boost="yes"
-		ax_boost_user_system_lib="$withval"
-		fi
-        ],
-        [want_boost="yes"]
-	)
-
-	if test "x$want_boost" = "xyes"; then
-        AC_REQUIRE([AC_PROG_CC])
-        AC_REQUIRE([AC_CANONICAL_BUILD])
-		CPPFLAGS_SAVED="$CPPFLAGS"
-		CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
-		export CPPFLAGS
-
-		LDFLAGS_SAVED="$LDFLAGS"
-		LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
-		export LDFLAGS
-
-        AC_CACHE_CHECK(whether the Boost::System library is available,
-					   ax_cv_boost_system,
-        [AC_LANG_PUSH([C++])
-			 CXXFLAGS_SAVE=$CXXFLAGS
-
-			 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <boost/system/error_code.hpp>]],
-                                   [[boost::system::system_category]])],
-                   ax_cv_boost_system=yes, ax_cv_boost_system=no)
-			 CXXFLAGS=$CXXFLAGS_SAVE
-             AC_LANG_POP([C++])
-		])
-		if test "x$ax_cv_boost_system" = "xyes"; then
-			AC_SUBST(BOOST_CPPFLAGS)
-
-			AC_DEFINE(HAVE_BOOST_SYSTEM,,[define if the Boost::System library is available])
-            BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
-
-			LDFLAGS_SAVE=$LDFLAGS
-            if test "x$ax_boost_user_system_lib" = "x"; then
-                for libextension in `ls $BOOSTLIBDIR/libboost_system*.so* $BOOSTLIBDIR/libboost_system*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_system.*\)\.so.*$;\1;' -e 's;^lib\(boost_system.*\)\.a*$;\1;'` ; do
-                     ax_lib=${libextension}
-				    AC_CHECK_LIB($ax_lib, exit,
-                                 [BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break],
-                                 [link_system="no"])
-				done
-                if test "x$link_system" != "xyes"; then
-                for libextension in `ls $BOOSTLIBDIR/boost_system*.{dll,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_system.*\)\.dll.*$;\1;' -e 's;^\(boost_system.*\)\.a*$;\1;'` ; do
-                     ax_lib=${libextension}
-				    AC_CHECK_LIB($ax_lib, exit,
-                                 [BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break],
-                                 [link_system="no"])
-				done
-                fi
-
-            else
-               for ax_lib in $ax_boost_user_system_lib boost_system-$ax_boost_user_system_lib; do
-				      AC_CHECK_LIB($ax_lib, exit,
-                                   [BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break],
-                                   [link_system="no"])
-                  done
-
-            fi
-            if test "x$ax_lib" = "x"; then
-                AC_MSG_ERROR(Could not find a version of the library!)
-            fi
-			if test "x$link_system" = "xno"; then
-				AC_MSG_ERROR(Could not link against $ax_lib !)
-			fi
-		fi
-
-		CPPFLAGS="$CPPFLAGS_SAVED"
-	LDFLAGS="$LDFLAGS_SAVED"
-	fi
-])
diff --git a/minidemo/bbdemo2/runme.sh b/minidemo/bbdemo2/runme.sh
index f8eba69..7013a42 100755
--- a/minidemo/bbdemo2/runme.sh
+++ b/minidemo/bbdemo2/runme.sh
@@ -6,14 +6,14 @@
 
 # using the "accurate" assembly qualifier turns on MIRA in high quality mode,
 #  ready to tackle a fair number of problems one can encounter in genome
-#  assembly.
+#  assembly.  
 # It's not really needed for this small set, but neither does it harm.
 
 # The data itself is pretty good, but has a few reads that show distinct signs
 #  "extended too long", i.e., they contain really bad quality. This is why we
 #  turn on -CL:bsqc with standard parameters (look at the parameters.par file)
 
-# the difference to bbdemo1: we map reads from C.jejuni RM1221 against
+# the difference to bbdemo1: we map reads from C.jejuni RM1221 against 
 #  a backbone (the first 40kb of C.jejuni NCTC1168)
 
 ln -f -s ../data/bbdataset1/cjejuni_demo* .
@@ -22,9 +22,9 @@ echo "Running mira"
 mira -parameters=parameters.par | tee log_assembly.txt
 echo "Done."
 echo
-echo -n "Using miraconvert create files with info on SNPs betwee strains ... "
+echo -n "Using convert_project create files with info on SNPs betwee strains ... "
 cd cjejuni_demo_assembly/cjejuni_demo_d_results
-miraconvert -f maf -t asnp cjejuni_demo_out.caf cjejuni_snpanalysis >/dev/null
+convert_project -f maf -t asnp cjejuni_demo_out.caf cjejuni_snpanalysis >/dev/null
 cd ..
 echo " done."
 echo
@@ -32,11 +32,11 @@ echo
 echo "Load the project into the GAP4 editor to have a look at the first 40kb of"
 echo " Campylobacter jejuni RM1221 mapped against Campylobacter jejuni NCTC1168"
 echo
-echo "There are also showcase files to demonstrate how MIRA together with miraconvert"
+echo "There are also showcase files to demonstrate how MIRA together with convert_project"
 echo " helps you to find and analyse SNPs in prokaryotes."
 echo "Normally, I would first load the project in gap4 (using caf2gap), perform a bit of"
 echo " cleanup and manually check the data. Then only I would use gap2caf and"
-echo " miraconvert to extract and analyse SNP. But for showcasing, this will do."
+echo " convert_project to extract and analyse SNP. But for showcasing, this will do."
 echo
 echo
 echo "Want to know how many SNPs are between the strains?"
@@ -45,7 +45,7 @@ echo "Want to know the effect of SNPs on a gene/protein?"
 echo "  -> Look at the file cjejuni_snpanalysis_info_featureanalysis.txt"
 echo "Want to have a summary which genes/proteins are affected by SNPs?"
 echo "  -> Look at the file cjejuni_snpanalysis_info_featuresummary.txt"
-echo "Want to have the strain sequence of each gene/protein?"
+echo "Want to have the strain sequence of each gene/protein?" 
 echo "  -> Look at the file cjejuni_snpanalysis_info_featuresequences.txt"
 echo
 echo "(and please read the comments on top of the 'runme.sh' script)"
diff --git a/minidemo/estdemo2/README b/minidemo/estdemo2/README
index a01a640..2cb3f51 100644
--- a/minidemo/estdemo2/README
+++ b/minidemo/estdemo2/README
@@ -1,14 +1,14 @@
-This demo demonstrates the usage of
+This demo demonstrates the usage of 
 
     miraEST
-    miraconvert
+    convert_project
 
 to perform an EST assembly and SNP analysis.
 
 To run the demo, just execute 'runme.sh'.
 
 step1_* files are mostly not of interest, so I won't describe them
-here.
+here. 
 
 step2 files are named after the strain or organism they belong
 to (in this case "strain1_*" and "strain2_"). The results in these
diff --git a/minidemo/solexa1/runme.sh b/minidemo/solexa1/runme.sh
index 169f2db..fbe6d7c 100755
--- a/minidemo/solexa1/runme.sh
+++ b/minidemo/solexa1/runme.sh
@@ -1,8 +1,7 @@
-#!/bin/sh
 
 ln -s ../data/solexa_eco_art/ecoli_* .
 
 mira --project=ecoli --job=mapping,genome,normal,solexa --fasta -AS:nop=1 -SB:bsn=ecoli_k12_mg1655 -SB:lsd=yes:bft=gbf SOLEXA_SETTINGS -AL:mrs=60:shme=5  | tee log_assembly.txt
 
 echo
-echo "Please read the README to know what is in the results."
+echo "Please read the README to know what is in the results."
\ No newline at end of file
diff --git a/minidemo/solexa2/runme.sh b/minidemo/solexa2/runme.sh
index 087b8bd..43874ba 100755
--- a/minidemo/solexa2/runme.sh
+++ b/minidemo/solexa2/runme.sh
@@ -1,8 +1,7 @@
-#!/bin/sh
 
 ln -s ../data/solexa_eco_art/ecoli_*fasta* .
 
 mira --project=ecoli --job=denovo,genome,normal,solexa --fasta | tee log_assembly.txt
 
 echo
-echo "This was a de-novo assembly of Solexa reads."
+echo "This was a de-novo assembly of Solexa reads."
\ No newline at end of file
diff --git a/missing b/missing
index 86a8fc3..28055d2 100755
--- a/missing
+++ b/missing
@@ -1,10 +1,10 @@
 #! /bin/sh
 # Common stub for a few missing GNU programs while installing.
 
-scriptversion=2012-01-06.13; # UTC
+scriptversion=2009-04-28.21; # UTC
 
 # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
-# 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+# 2008, 2009 Free Software Foundation, Inc.
 # Originally by Fran,cois Pinard <pinard at iro.umontreal.ca>, 1996.
 
 # This program is free software; you can redistribute it and/or modify
@@ -84,6 +84,7 @@ Supported PROGRAM values:
   help2man     touch the output file
   lex          create \`lex.yy.c', if possible, from existing .c
   makeinfo     touch the output file
+  tar          try tar, gnutar, gtar, then tar without non-portable flags
   yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
 
 Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
@@ -121,6 +122,15 @@ case $1 in
     # Not GNU programs, they don't have --version.
     ;;
 
+  tar*)
+    if test -n "$run"; then
+       echo 1>&2 "ERROR: \`tar' requires --run"
+       exit 1
+    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+       exit 1
+    fi
+    ;;
+
   *)
     if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
        # We have it, but it failed.
@@ -216,7 +226,7 @@ WARNING: \`$1' $msg.  You should only need it if
          \`Bison' from any GNU archive site."
     rm -f y.tab.c y.tab.h
     if test $# -ne 1; then
-        eval LASTARG=\${$#}
+        eval LASTARG="\${$#}"
 	case $LASTARG in
 	*.y)
 	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
@@ -246,7 +256,7 @@ WARNING: \`$1' is $msg.  You should only need it if
          \`Flex' from any GNU archive site."
     rm -f lex.yy.c
     if test $# -ne 1; then
-        eval LASTARG=\${$#}
+        eval LASTARG="\${$#}"
 	case $LASTARG in
 	*.l)
 	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
@@ -308,6 +318,41 @@ WARNING: \`$1' is $msg.  You should only need it if
     touch $file
     ;;
 
+  tar*)
+    shift
+
+    # We have already tried tar in the generic part.
+    # Look for gnutar/gtar before invocation to avoid ugly error
+    # messages.
+    if (gnutar --version > /dev/null 2>&1); then
+       gnutar "$@" && exit 0
+    fi
+    if (gtar --version > /dev/null 2>&1); then
+       gtar "$@" && exit 0
+    fi
+    firstarg="$1"
+    if shift; then
+	case $firstarg in
+	*o*)
+	    firstarg=`echo "$firstarg" | sed s/o//`
+	    tar "$firstarg" "$@" && exit 0
+	    ;;
+	esac
+	case $firstarg in
+	*h*)
+	    firstarg=`echo "$firstarg" | sed s/h//`
+	    tar "$firstarg" "$@" && exit 0
+	    ;;
+	esac
+    fi
+
+    echo 1>&2 "\
+WARNING: I can't seem to be able to run \`tar' with the given arguments.
+         You may want to install GNU tar or Free paxutils, or check the
+         command line arguments."
+    exit 1
+    ;;
+
   *)
     echo 1>&2 "\
 WARNING: \`$1' is needed, and is $msg.
diff --git a/src/EdIt/Makefile.am b/src/EdIt/Makefile.am
new file mode 100644
index 0000000..3d67ea5
--- /dev/null
+++ b/src/EdIt/Makefile.am
@@ -0,0 +1,10 @@
+INCLUDES = -I$(top_srcdir)/src $(all_includes)
+
+noinst_LIBRARIES = libmiraEdIt.a
+libmiraEdIt_a_FLEXSRC= 
+nodist_libmiraEdIt_a_SOURCES= $(libmiraEdIt_a_FLEXSRC:.flex=.flex.C)
+libmiraEdIt_a_SOURCES= hypothesen.C parameters.C faultRegion.C parameters_flexer.ll
+noinst_HEADERS= hypothesen.H parameters.H parameters_tokens.h
+
+
+
diff --git a/src/caf/Makefile.in b/src/EdIt/Makefile.in
similarity index 80%
copy from src/caf/Makefile.in
copy to src/EdIt/Makefile.in
index 68a481e..39e1451 100644
--- a/src/caf/Makefile.in
+++ b/src/EdIt/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -35,18 +35,26 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
-subdir = src/caf
+subdir = src/EdIt
 DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
-	$(srcdir)/Makefile.in caf_flexer.cc
+	$(srcdir)/Makefile.in parameters_flexer.cc
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/ax_boost_base.m4 \
-	$(top_srcdir)/m4/ax_boost_filesystem.m4 \
-	$(top_srcdir)/m4/ax_boost_iostreams.m4 \
-	$(top_srcdir)/m4/ax_boost_regex.m4 \
-	$(top_srcdir)/m4/ax_boost_system.m4 \
-	$(top_srcdir)/m4/ax_boost_thread.m4 \
-	$(top_srcdir)/m4/ax_check_zlib.m4 \
-	$(top_srcdir)/m4/ax_lib_expat.m4 $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/config/m4/ax_boost_base.m4 \
+	$(top_srcdir)/config/m4/ax_boost_regex.m4 \
+	$(top_srcdir)/config/m4/ax_boost_thread.m4 \
+	$(top_srcdir)/config/m4/ax_check_zlib.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_std.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_stl.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_namespaces.m4 \
+	$(top_srcdir)/config/m4/ax_lib_expat.m4 \
+	$(top_srcdir)/config/m4/ax_with_perl.m4 \
+	$(top_srcdir)/config/m4/ax_with_prog.m4 \
+	$(top_srcdir)/config/m4/libtool.m4 \
+	$(top_srcdir)/config/m4/ltoptions.m4 \
+	$(top_srcdir)/config/m4/ltsugar.m4 \
+	$(top_srcdir)/config/m4/ltversion.m4 \
+	$(top_srcdir)/config/m4/lt~obsolete.m4 \
+	$(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -54,10 +62,14 @@ CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
 LIBRARIES = $(noinst_LIBRARIES)
 ARFLAGS = cru
-libmiracaf_a_AR = $(AR) $(ARFLAGS)
-libmiracaf_a_LIBADD =
-am_libmiracaf_a_OBJECTS = caf.$(OBJEXT) caf_flexer.$(OBJEXT)
-libmiracaf_a_OBJECTS = $(am_libmiracaf_a_OBJECTS)
+libmiraEdIt_a_AR = $(AR) $(ARFLAGS)
+libmiraEdIt_a_LIBADD =
+am_libmiraEdIt_a_OBJECTS = hypothesen.$(OBJEXT) parameters.$(OBJEXT) \
+	faultRegion.$(OBJEXT) parameters_flexer.$(OBJEXT)
+am__objects_1 =
+nodist_libmiraEdIt_a_OBJECTS = $(am__objects_1)
+libmiraEdIt_a_OBJECTS = $(am_libmiraEdIt_a_OBJECTS) \
+	$(nodist_libmiraEdIt_a_OBJECTS)
 DEFAULT_INCLUDES = -I. at am__isrc@
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
@@ -71,9 +83,9 @@ CXXLD = $(CXX)
 CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	--mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
 	$(LDFLAGS) -o $@
-LEXCOMPILE = $(LEX) $(AM_LFLAGS) $(LFLAGS)
+LEXCOMPILE = $(LEX) $(LFLAGS) $(AM_LFLAGS)
 LTLEXCOMPILE = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=compile $(LEX) $(AM_LFLAGS) $(LFLAGS)
+	--mode=compile $(LEX) $(LFLAGS) $(AM_LFLAGS)
 YLWRAP = $(top_srcdir)/ylwrap
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -84,8 +96,8 @@ CCLD = $(CC)
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
 	$(LDFLAGS) -o $@
-SOURCES = $(libmiracaf_a_SOURCES)
-DIST_SOURCES = $(libmiracaf_a_SOURCES)
+SOURCES = $(libmiraEdIt_a_SOURCES) $(nodist_libmiraEdIt_a_SOURCES)
+DIST_SOURCES = $(libmiraEdIt_a_SOURCES)
 HEADERS = $(noinst_HEADERS)
 ETAGS = etags
 CTAGS = ctags
@@ -100,13 +112,9 @@ AWK = @AWK@
 BITPACKAGE = @BITPACKAGE@
 BLOODYDARWINSTATLIBDIRHACK = @BLOODYDARWINSTATLIBDIRHACK@
 BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
-BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@
-BOOST_IOSTREAMS_LIB = @BOOST_IOSTREAMS_LIB@
 BOOST_LDFLAGS = @BOOST_LDFLAGS@
 BOOST_REGEX_LIB = @BOOST_REGEX_LIB@
-BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@
 BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
-BUNDLETARGET = @BUNDLETARGET@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
@@ -119,7 +127,6 @@ CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -129,13 +136,11 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LDFLAGS = @EXPAT_LDFLAGS@
-EXPAT_LIBS = @EXPAT_LIBS@
 EXPAT_VERSION = @EXPAT_VERSION@
 FGREP = @FGREP@
 FLEX = @FLEX@
 FLEXPP = @FLEXPP@
 GREP = @GREP@
-HAVE_XXD = @HAVE_XXD@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -153,7 +158,6 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
 MIRASTATIC = @MIRASTATIC@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
@@ -170,17 +174,18 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
+SHORTMIRAAUDIENCE = @SHORTMIRAAUDIENCE@
 STRIP = @STRIP@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -214,6 +219,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -229,10 +235,12 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-AM_CPPFLAGS = -I$(top_srcdir)/src $(all_includes)
-noinst_LIBRARIES = libmiracaf.a
-libmiracaf_a_SOURCES = caf.C caf_flexer.ll
-noinst_HEADERS = caf.H caf_tokens.h
+INCLUDES = -I$(top_srcdir)/src $(all_includes)
+noinst_LIBRARIES = libmiraEdIt.a
+libmiraEdIt_a_FLEXSRC = 
+nodist_libmiraEdIt_a_SOURCES = $(libmiraEdIt_a_FLEXSRC:.flex=.flex.C)
+libmiraEdIt_a_SOURCES = hypothesen.C parameters.C faultRegion.C parameters_flexer.ll
+noinst_HEADERS = hypothesen.H parameters.H parameters_tokens.h
 all: all-am
 
 .SUFFIXES:
@@ -246,9 +254,9 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/caf/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/EdIt/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu src/caf/Makefile
+	  $(AUTOMAKE) --gnu src/EdIt/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -270,10 +278,10 @@ $(am__aclocal_m4_deps):
 
 clean-noinstLIBRARIES:
 	-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
-libmiracaf.a: $(libmiracaf_a_OBJECTS) $(libmiracaf_a_DEPENDENCIES) $(EXTRA_libmiracaf_a_DEPENDENCIES) 
-	-rm -f libmiracaf.a
-	$(libmiracaf_a_AR) libmiracaf.a $(libmiracaf_a_OBJECTS) $(libmiracaf_a_LIBADD)
-	$(RANLIB) libmiracaf.a
+libmiraEdIt.a: $(libmiraEdIt_a_OBJECTS) $(libmiraEdIt_a_DEPENDENCIES) 
+	-rm -f libmiraEdIt.a
+	$(libmiraEdIt_a_AR) libmiraEdIt.a $(libmiraEdIt_a_OBJECTS) $(libmiraEdIt_a_LIBADD)
+	$(RANLIB) libmiraEdIt.a
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -281,8 +289,10 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/caf.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/caf_flexer.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/faultRegion.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hypothesen.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parameters.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parameters_flexer.Po at am__quote@
 
 .C.o:
 @am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@@ -431,15 +441,10 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	if test -z '$(STRIP)'; then \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	      install; \
-	else \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-	fi
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
 mostlyclean-generic:
 
 clean-generic:
@@ -451,11 +456,11 @@ distclean-generic:
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
 	@echo "it deletes files that may require special tools to rebuild."
-	-rm -f caf_flexer.cc
+	-rm -f parameters_flexer.cc
 clean: clean-am
 
-clean-am: clean-generic clean-libtool clean-local \
-	clean-noinstLIBRARIES mostlyclean-am
+clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
+	mostlyclean-am
 
 distclean: distclean-am
 	-rm -rf ./$(DEPDIR)
@@ -526,22 +531,18 @@ uninstall-am:
 .MAKE: install-am install-strip
 
 .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
-	clean-libtool clean-local clean-noinstLIBRARIES ctags \
-	distclean distclean-compile distclean-generic \
-	distclean-libtool distclean-tags distdir dvi dvi-am html \
-	html-am info info-am install install-am install-data \
-	install-data-am install-dvi install-dvi-am install-exec \
-	install-exec-am install-html install-html-am install-info \
-	install-info-am install-man install-pdf install-pdf-am \
-	install-ps install-ps-am install-strip installcheck \
-	installcheck-am installdirs maintainer-clean \
-	maintainer-clean-generic mostlyclean mostlyclean-compile \
-	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
-	tags uninstall uninstall-am
-
-
-clean-local:
-	rm -rf *flexer.cc
+	clean-libtool clean-noinstLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-strip installcheck installcheck-am installdirs \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+	pdf pdf-am ps ps-am tags uninstall uninstall-am
+
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/src/EdIt/faultRegion.C b/src/EdIt/faultRegion.C
new file mode 100644
index 0000000..62f8c16
--- /dev/null
+++ b/src/EdIt/faultRegion.C
@@ -0,0 +1,1222 @@
+/*
+ * Written by Thomas Pfisterer
+ *
+ * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
+ *   Krebsforschungszentrum, DKFZ Heidelberg) and Thomas Pfisterer
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ *
+ *
+ * faultRegion 
+ * There is no class for handling fault regions. This file is a collection
+ * of the functions used to create fault regions from a Contig 
+ *
+ * Written by Thomas Pfisterer 
+ * Version 0.80       16.03.1999
+ *
+ * May 2003 Small bugfixes by BaCh
+ */
+
+
+#include <stdlib.h>
+#include <iostream>
+
+#include "errorhandling/errorhandling.H"
+#include "mira/readpool.H"
+#include "mira/contig.H"
+#include "mira/align.H"
+
+#include "EdIt/hypothesen.H"
+#include "caf/caf.H"
+
+
+// 	$Id$	
+
+#ifndef lint
+static char vcid[] = "$Id$";
+#endif /* lint */
+
+
+
+// *************************************************************************
+// *
+// *  Extend a fault region right
+// *  returns the number of identical bases right of POS 
+// *  
+// *************************************************************************
+
+int32 extendFaultRegionRight(const Contig::cccontainer_t::iterator POS,
+	 		     const Contig::cccontainer_t::iterator END)
+{
+  Contig::cccontainer_t::iterator I = POS;
+
+  if (I == END) return 0;
+
+  try {
+    char lastBase = calledBase(*(I+1));
+
+    do {
+      I++;
+    } while (I != END && lastBase == calledBase(*I)); 
+  }
+  catch (Notify n) {
+    n.handleError("EdIt Error: Can not extend read to the right (1)");
+  }
+
+  return I-POS-1;
+}
+
+
+// *************************************************************************
+// *
+// *  Extend a fault region left
+// *  returns the number of identical bases left of POS 
+// *  
+// *************************************************************************
+
+int32 extendFaultRegionLeft(const Contig::cccontainer_t::iterator POS,
+			    const Contig::cccontainer_t::iterator START)
+{
+  Contig::cccontainer_t::iterator I = POS;
+
+  if (I == START) return 0;
+
+  try {
+    char firstBase = calledBase(*(I-1));
+    do {
+      I--;
+    } while (I != START && firstBase == calledBase(*I));
+  }
+
+  catch (Notify n) {
+    n.handleError("EdIt Error: Can not extend read to the right (2)");
+  }
+
+  return I-POS+1;
+}
+
+
+// *******************************************************
+//    checkColumnForMismatch:       
+//    compares the consensus bases with all reads
+//    returns true if there is a mismatch, false otherwise
+// *******************************************************
+
+
+bool checkColumnForMismatch(const Contig &aContig, const int32 pos,
+			    Contig::cccontainer_t &theConsensus) 
+{   
+  vector<char>::const_iterator seqIt;
+  vector<int32> theActiveReads;
+  const vector<Contig::contigread_t> &allReads = aContig.getContigReads();
+
+  aContig.getCRIndicesAtContigPosition(theActiveReads, pos-1);
+  vector<int32>::iterator I = theActiveReads.begin();
+
+  Contig::cccontainer_t::iterator I_CONS;
+  I_CONS = theConsensus.begin() + pos - 1;
+  char consensusBase = calledBase(*I_CONS);
+
+  // step through all active reads at this position
+  while (I != theActiveReads.end()) {
+    const Contig::contigread_t &r = allReads[*I];
+    
+    if (r.direction > 0) {
+      seqIt = r.read.getClippedSeqIterator();
+    } else {
+      seqIt = r.read.getClippedComplementSeqIterator();
+    }
+    seqIt += I_CONS - theConsensus.begin() - r.offset;
+
+    // search for a mismatch of the read with the consensus sequence
+    
+    if (isUndefinedBase(consensusBase)) {
+      return true;
+    }
+ 
+    if (toupper(*seqIt) != consensusBase) {
+      return true;
+    };
+    
+    I++;
+  }
+
+  return false;
+}
+
+
+// *******************************************************
+//    findPrevMismatch:       
+//    step backwards through a Contig base by base searching 
+//    for mismatches in the high quality parts starting with
+//    position "pos". Returns an iterator to the fault 
+//     position and updates the "pos" variable 
+// *******************************************************
+
+
+Contig::cccontainer_t::iterator
+findPrevMismatch(const Contig &aContig, int32 &pos, 
+	         Contig::cccontainer_t &theConsensus) 
+{  
+  Contig::cccontainer_t::iterator I_CONS;
+
+  try {
+    I_CONS = theConsensus.begin() + pos - 1;
+    // step through the contig base by base 
+    while (I_CONS != theConsensus.begin()) {
+      if (checkColumnForMismatch(aContig, pos, theConsensus))
+	 return I_CONS;
+       
+      I_CONS--;
+      pos--;
+    }
+  }
+  catch (Notify n) {
+    throw Notify(Notify::WARNING, "EdIt Error: findPrevMismatch failed");
+  }
+
+  // no mismatch found: returns theConsensus.begin()
+  return I_CONS;
+}
+
+
+
+// **********************************************************
+//    createFaultRegion
+//    creates and examines a region in the contig given
+//    tries to double-strand single stranded fault regions
+//    before hypotheses generation
+// **********************************************************
+
+
+hypotheses_pool* createFaultRegion(Contig &aContig, int32 von, int32 bis, 
+				   EDITParameters &p) 
+{
+  hypotheses_pool *aPool;
+  static int32 region_count = 0;
+
+  if (p.evalAt(von) == false && p.evalAt(bis) == false) {
+#ifndef RUN_ONLY
+    if (p.isVerbose(7)) {
+      cout << "FaultRegion out of edit range.... skipping." << endl;
+    }
+#endif
+    return NULL;
+  }
+
+
+#ifndef RUN_ONLY
+  if (p.isVerbose()) {
+    cout << "\nExamine Region " <<  von << " - " << bis 
+	 << "\t(" << ++region_count << ")" << endl;
+  }
+#endif
+
+  aPool = createRegion(aContig, von, bis, p); 
+
+  if (aPool == NULL) {
+    // no region created - e.g. the region is to long
+
+#ifndef RUN_ONLY
+    if (p.isVerbose()) {
+      cout << "Region not created" << endl;
+    }
+#endif
+    return NULL;
+  }
+
+#ifndef RUN_ONLY
+  if (p.isVerbose(8)) {
+    cout << "Region created." << endl;
+    cout << *aPool << endl;
+  }
+#endif
+
+  return aPool;
+}
+
+
+
+bool examineFaultRegion(Contig &aContig, int32 von, int32 bis, 
+			hypotheses_pool *aPool, EDITParameters &p) 
+{
+  bool forward, reverse;
+
+  if (aPool == NULL) {
+    return false;
+  }
+
+  // if not double-stranded and we try to make 
+  // it double stranded then try
+  
+
+  if (!aPool->isDoubleStranded(forward, reverse) && 
+      p.makeDoubleStranded())
+    {
+      aPool->makeDoubleStranded(aContig, von, bis, forward, reverse, p);
+    }
+
+#ifndef RUN_ONLY
+  if (p.isVerbose()) {
+    cout << *aPool;
+  }
+#endif
+
+  if (aPool->hasSufficientInformation(forward, reverse, true, p.getMinCoverage())) {
+
+    //  if (aPool->isDoubleStrandedOrCoverage(forward, reverse, 
+    //					p.getMinCoverage())) {
+
+    aPool->iterateFirstSolutionPlus(2);
+
+    vector<fault_region>::iterator I;
+    bool conf = false;
+    int32 count = 0;
+
+    if (aPool->createCfhInfoList(p) == false) {
+      return false;
+    }
+
+    I = aPool->getHypothesesList().begin();
+
+    if (p.isVerbose(4)) {
+      aPool->showResult();
+    }
+
+    if (p.doEval() == true) {
+
+      while (I != aPool->getHypothesesList().end()) {
+
+	if (true == p.getEditLowQualityBases()) {
+	  if (p.isVerbose()) {
+	    cout << "Confirm Quality" << endl;
+	  }
+	  I->getCfh().confirmQuality(p.getLowQualityThreshold());
+	}
+
+#ifndef RUN_ONLY
+	if (p.isVerbose(5)) {
+	  cout << I->getCfh();
+	  cout << *I;
+	}
+#endif
+
+	conf = I->getCfh().eval(true, // confirm until rejected  
+				p.isVerbose(), 
+				p.getConfirmationThreshold(),
+				true  // strict evalution
+				);
+#ifndef RUN_ONLY
+	if (p.isVerbose(5)) {
+          cout << "Evaluation result: " << conf << endl;
+	}
+#endif
+
+	if (conf) break;
+ 
+	I++;
+      }  
+    }
+
+    if (conf == true ) {
+#ifndef RUN_ONLY
+      if (p.isVerbose(3)) {
+	cout << "\nConfirmed: " << endl;
+	cout << I->getCfh() << endl;
+      }
+#endif      
+
+      if (true == p.doEdit()) {
+	I->performOperationsOnReads(aPool->getScfInfo(), p, 
+				    aPool->locomotion(*I)); 
+      }
+    } 
+#ifndef RUN_ONLY
+    else {
+      if (p.isVerbose(3)) {
+	cout << "Not strictly confirmed" << endl;
+      }
+    }
+#endif
+
+
+
+    // suche die beste unvollst�ndige best�tigte hypothese....
+
+    if (p.doEval() == true && conf == false ) {
+      float    best_score = 0;
+      fault_region *best_region = NULL;
+
+      I = aPool->getHypothesesList().begin();
+
+#ifndef RUN_ONLY
+      if (p.isVerbose(2)) {
+	cout << "Searching best partial solution" << endl;
+      }
+#endif
+
+      while (I != aPool->getHypothesesList().end()) {
+	I->getCfh().eval(true, 
+			 p.isVerbose(8), 
+			 p.getConfirmationThreshold(),
+			 false);
+
+	if (p.isVerbose(3)) {
+	  cout << "Score: " << I->getCfh().getRelScore() << endl;
+	  cout << I->getCfh();
+	}
+
+	if (I->getCfh().getRelScore() > best_score &&
+	    aPool->checkPartialSolution(*I) == 1) {
+
+	  best_score = I->getCfh().getRelScore();
+	  // BaCh: changed that for gcc3
+	  //best_region = *(&I);
+	  best_region = &(*I);
+	}
+
+	I++;
+      }
+
+      // den besten unvollst�ndigen kandidaten editieren...
+      if (conf == false && p.getStrictEvaluation() == false &&
+	  best_region != NULL && best_score > 0.8) {
+
+#ifndef RUN_ONLY
+	if (p.isVerbose(5)) {
+	  cout << "Best partial solution:" << endl;
+	  cout << best_region->getCfh();
+	}
+#endif
+
+	(best_region->getCfh()).eval(false, 
+				     p.isVerbose(), 
+				     p.getConfirmationThreshold(),
+				     false);
+
+	(best_region->getCfh()).evalExtendedAlterOperations
+	                             (p.getConfirmationThreshold());
+	
+	if (true == p.doEdit() && aPool->checkPartialSolution(*best_region)) {
+	  best_region->performOperationsOnReads(aPool->getScfInfo(), p, 
+				      aPool->locomotion(*best_region));
+	}	
+      }    
+    }
+
+  } else {
+
+#ifndef RUN_ONLY
+  if (p.isVerbose()) {
+    cout << "Hypothesis is single-stranded!" << endl << endl;
+  }
+#endif
+
+  }
+
+  delete aPool;
+  return true;
+}
+
+
+
+// **********************************************************
+//    findFaultRegionBack:       
+//    steps through a Contig via findPrevMismatch and creates 
+//    fault regions around them. Two mismatches are treated
+//    as dependent (i.e. in different faultRegions) if they     
+//    are only seperated by a sequence of identical bases  
+// **********************************************************
+
+
+void findFaultRegionBack(Contig &aContig, EDITParameters &p) 
+{
+  findFaultRegionBack(aContig, p);
+}
+
+
+
+void editContigBack(Contig &aContig, EDITParameters &p) 
+{
+  static int32 regionnr = 0; 
+  static int32 contignr = 0;
+  Contig::cccontainer_t &theConsensus = 
+    const_cast<Contig::cccontainer_t&>(aContig.getConsensusCounts());
+  Contig::cccontainer_t::iterator I_CONS = theConsensus.end();
+
+  int32 pos = 0;
+  int32 beginRegion = 0;
+  int32 endRegion = 0;
+
+  int32 oldContigSize;
+
+  // set pos to the last base of the contig
+  oldContigSize = aContig.getContigLength() - 1;
+  pos = oldContigSize;
+  
+  ProgressIndicator<int32> pi(0, oldContigSize);
+
+#ifndef RUN_ONLY
+  if (p.isVerbose(0)) {
+    cout << "\n========================= " << endl;
+    cout << "New Contig (Nr. " << ++contignr << ")" << endl;
+    cout << "Contig Length : " << pos << endl;
+    cout << "========================= " << endl;
+
+    if (p.isVerbose(9)) {
+      cout << aContig;
+    }
+  }
+#endif
+
+  if (false == p.doContig(regionnr)) {
+#ifndef RUN_ONLY
+    if (p.isVerbose()) {  
+      cout << "Contig skipped... " << endl;
+    }
+  }
+#endif
+
+
+  if (pos < MIN_CONTIG_EDIT_LENGTH) {
+#ifndef RUN_ONLY
+    if (p.isVerbose()) {  
+      cout << "Contig skipped: not long enough" << endl;
+    }
+#endif
+  
+    return ;
+  }
+
+
+  while (I_CONS != theConsensus.begin() && p.doHypo()) {
+    pos--;
+    I_CONS = findPrevMismatch(aContig, pos, theConsensus);
+
+    if (I_CONS == theConsensus.begin()) 
+      break; // exit while-loop
+    
+    try {
+
+#ifndef RUN_ONLY
+      if (p.isVerbose()) {
+	cout << "FR: Mismatch " << ++regionnr << " found at: " << pos << endl;
+      }
+#endif
+
+      if (beginRegion == 0) {
+	beginRegion = 
+	  pos + extendFaultRegionLeft(I_CONS, theConsensus.begin()) - 1;
+	endRegion =
+	  pos + extendFaultRegionRight(I_CONS, theConsensus.end()) - 1;
+      } else {
+	int32 rightBorder = pos + 
+	  extendFaultRegionRight(I_CONS, theConsensus.end()) - 1;
+
+	if (rightBorder < beginRegion) {
+
+	  /*
+	    cout << "\nCALL SMALL REGIONS " << beginRegion << "\t" 
+	    << endRegion << endl;
+
+	    editSmallRegionsBack(aContig, p, beginRegion, endRegion);
+	    cout << "END SMALL REGIONS" << endl;
+	  */
+	  {
+	    hypotheses_pool *aPool;
+	    aPool = createFaultRegion(aContig, beginRegion, endRegion, p);
+
+	    if (!examineFaultRegion(aContig, beginRegion, endRegion, 
+				    aPool, p)) {
+	      
+	      editSmallRegionsBack(aContig, p, beginRegion, endRegion);
+	    }
+	  }
+	  
+	  endRegion = pos + 
+	    extendFaultRegionRight(I_CONS, theConsensus.end()) - 1;
+
+	  beginRegion= pos + 
+	    extendFaultRegionLeft(I_CONS, theConsensus.begin()) - 1;
+      } else {
+	  
+	  beginRegion=pos + 
+	    extendFaultRegionLeft(I_CONS,theConsensus.begin()) - 1;
+	}
+      }
+ 
+    
+    }
+    catch (Notify n) {
+      beginRegion = pos-1;
+      endRegion = pos-1;
+      n.handleError("EdIt Error: Unable to handle mismatch! (1)");
+    }
+
+    if (p.getShowProgress()) {
+      pi.progress(oldContigSize - pos);
+    }
+  }
+
+  // don't forget the last mismatch if there is one...
+  if (beginRegion > 0) {
+    try {
+      hypotheses_pool *aPool;
+      aPool = createFaultRegion(aContig, beginRegion, endRegion, p);
+      
+      examineFaultRegion(aContig, beginRegion, endRegion, aPool, p);
+    }
+    catch (Notify n) {
+      n.handleError("EdIt Error: Unable to handle mismatch! (2)");
+    }
+  }
+
+  if (p.getShowProgress()) {
+    pi.progress(oldContigSize);
+    cout << endl;
+  }  
+}
+
+
+
+
+
+/*********************************************
+ *       editSmallRegionsBack                *
+ *********************************************/
+
+
+void editSmallRegionsBack(Contig &aContig, EDITParameters &p, 
+			  int32 von=-1, int32 bis=-1) 
+{
+  static int32 regionnr = 0; 
+  int32 last_region_start = 0;
+  int32 last_region_end   = 0;
+  int32 ende = 0;
+
+  Contig::cccontainer_t &theConsensus = 
+    const_cast<Contig::cccontainer_t&>(aContig.getConsensusCounts());
+  Contig::cccontainer_t::iterator I_CONS = theConsensus.end();
+
+  // set pos to the last base of the contig
+  int32 pos = 0;
+
+  if (bis < 0) {
+    pos = aContig.getContigLength() - 1;
+  } else {
+    pos = bis;
+  }
+
+  if (von > 0) {
+    ende = von;
+  } 
+  
+
+  while (I_CONS != theConsensus.begin() && pos > ende) {
+    I_CONS = findPrevMismatch(aContig, pos, theConsensus);
+
+    if (I_CONS == theConsensus.begin()) 
+      break; // exit while-loop
+    
+    try {
+
+#ifndef RUN_ONLY
+      if (p.isVerbose()) {
+	cout << "SR: Mismatch " << ++regionnr << " found at: " << pos << endl;
+      }
+#endif
+      
+      if (pos >= 2) {
+	if (last_region_start == 0) {
+	  last_region_start = pos;
+	  last_region_end = pos;
+	} else {
+	  if (abs(pos - last_region_end) > 1) {
+	    // Create region around lastpos
+	    hypotheses_pool *aPool;
+
+	    aPool = createFaultRegion(aContig, last_region_end-2, 
+				      last_region_start, p);
+
+	    //	    examineFaultRegion(aContig, last_region_start-2, 
+	    //		       last_region_end, aPool, p);
+	    examineFaultRegion(aContig, last_region_end-2, 
+			       last_region_start, aPool, p);
+
+	    last_region_start = pos;
+	    last_region_end = pos;
+	  } else {
+	    // extend the region
+	    last_region_end = pos;
+	  }
+	}
+      }  
+
+      if (p.isVerbose()) {
+	cout << "   " << last_region_start << "\t" << last_region_end << endl;
+      }
+    }
+    catch (Notify n) {
+      pos--;
+      n.handleError("EdIt Error: Unable to handle mismatch! (3)");
+    }
+    pos--;
+  }
+
+  if (last_region_end != 0 && pos >= ende) {
+    hypotheses_pool *aPool;
+    aPool = createFaultRegion(aContig, last_region_end-2, 
+			      last_region_start, p);
+
+    examineFaultRegion(aContig, last_region_end-2, 
+		       last_region_start, aPool, p);
+  }
+
+}
+
+
+
+
+
+/**********************************************
+ *       editTowardsConsensusBack             *
+ **********************************************/
+
+
+void editTowardsConsensusBack(Contig &aContig, EDITParameters &p) 
+{
+  static int32 regionnr = 0; 
+
+  Contig::cccontainer_t &theConsensus = 
+    const_cast<Contig::cccontainer_t&>(aContig.getConsensusCounts());
+  Contig::cccontainer_t::iterator I_CONS = theConsensus.end();
+
+  // set pos to the last base of the contig
+  int32 pos = 0;
+  pos = aContig.getContigLength() - 1;
+
+
+  while (I_CONS != theConsensus.begin()) {
+    I_CONS = findPrevMismatch(aContig, pos, theConsensus);
+
+    if (I_CONS == theConsensus.begin()) 
+      break; // exit while-loop
+    
+    try {
+
+#ifndef RUN_ONLY
+      if (p.isVerbose()) {
+	cout << "C: Mismatch " << ++regionnr << " found at: " << pos << endl;
+      }
+#endif
+      
+      if (pos >= 2) {
+	hypotheses_pool *aPool;
+	aPool = createFaultRegion(aContig, pos-2, pos, p);
+
+	// We only edit single columns, for several reasons (e.g. finding
+	// the correct fault-class) we include adjacent columns. But we do
+	// not edit the. A hypotheses with mismatches in these columns thus
+	// can not be solved - we iron out these mismatches my brute force
+        // in our hypotheses...
+
+	aPool->setFirstAndLastColumn(calledBase(*(I_CONS-1)), 
+				     calledBase(*(I_CONS+1)));
+
+	cout << "X5" << endl;
+	examineFaultRegion(aContig, pos-2, pos, aPool, p);
+      }
+       
+    }
+    catch (Notify n) {
+      n.handleError("EdIt Error: Unable to handle mismatch! (4)");
+    }
+    pos--;
+  }
+}
+
+
+
+// *******************************************************
+//    faultRegionFromRead:       
+//    create the scfInfo-structure for a fault region in    
+//    read 'R' (calling function must free the memory). 
+//    Copy the sequence of that fault region into   
+//    the paramter 'sequence'.
+// *******************************************************
+
+
+scfInfo* faultRegionFromRead(Contig &aContig, const Contig::contigread_t &R, 
+			     int32 readIndex, int32 von, int32 bis, 
+			     char *sequence)
+{
+  const vector<char>  &cseq  = R.read.getActualComplementSequence();
+  const vector<char>  &seq   = R.read.getActualSequence();
+  vector<char>::const_iterator I;
+  //  vector<char>::const_iterator Ende;
+  int32 readPos;
+  bool  hiddenData = false;
+
+  scfInfo *aScfInfo;
+
+  readPos = readPosFromContigPos(von, R);
+
+  if (R.direction > 0) {
+    I = seq.begin() + readPos;   
+    //Ende = seq.end();
+  } else {
+    I = cseq.begin() + readPos;
+    //Ende = cseq.end();
+  }
+
+  aScfInfo = new scfInfo;
+
+  if (von > bis) { 
+    von ^= bis ^= von ^= bis; 
+  }
+
+  aScfInfo->scfInfo_position.resize(bis - von + 3, -1);
+  
+  aScfInfo->scfInfo_dbpos = readPos;
+
+  if ((von < R.offset || von >= R.offset + R.read.getLenClippedSeq()) &&
+      (bis < R.offset || bis >= R.offset + R.read.getLenClippedSeq())) {
+    hiddenData = true;
+  }
+
+  for (int32 loop = 0; loop <= bis - von; loop++) {
+    if ((von + loop >= R.offset && 
+	von + loop <  R.offset + R.read.getLenClippedSeq()) ||
+	hiddenData) {
+      sequence[loop] = toupper(*I);
+      aScfInfo->scfInfo_position[loop] = scfPosFromDBPos(loop+readPos, R);
+    } else {
+      sequence[loop] = EOR_CHARACTER;
+      aScfInfo->scfInfo_position[loop] = -1;
+    }
+
+    //if (von + loop <= R.offset + R.read.getLenClippedSeq()) {
+    //if (I != Ende)
+      I++;
+    //} 
+  }
+
+  sequence[bis - von + 1] = 0;
+
+  aScfInfo->scfInfo_name = new char [R.read.getName().size() + 1];
+  strcpy(aScfInfo->scfInfo_name, R.read.getName().c_str());
+  aScfInfo->scfInfo_read = &R;
+  aScfInfo->scfInfo_contig = &aContig;
+  aScfInfo->scfInfo_readId = readIndex;
+  aScfInfo->scfInfo_hidden = hiddenData;
+
+  return aScfInfo;
+}
+
+
+
+// *******************************************************
+//    createRegion:       
+//    create a faultRegion from 'von' to 'bis' in the    
+//    given Contig and initialise a hypotheses_pool with 
+//    this faultRegion. Include reads that have some valid
+//    data between 'von' and 'bis'.
+// *******************************************************
+
+
+hypotheses_pool* createRegion(Contig &aContig, int32 von, int32 bis,
+			      EDITParameters &p)
+{
+  scfInfo *aScfInfo;
+  char sequence[100];  // FIXME 6  
+  const vector<Contig::contigread_t> &allReads = aContig.getContigReads();
+  vector<int32> theActiveReads;
+  vector<int32>::iterator I;
+  vector<scfInfo> scfInfoList;
+  fault_region    *aFaultRegion;
+  hypotheses_pool *aPool;
+
+  if (bis - von > 30) return NULL;
+  if (von < 0)  von = 0; 
+  if (bis >= aContig.getConsensusCounts().size()) { bis=aContig.getConsensusCounts().size()-1; }
+
+
+  if (p.isVerbose(9)) {
+    cout << "createRegion " << von << "-" << bis << endl;
+  }
+
+  {
+    // create union of the reads at the begin and at the end of 
+    // the region in 'theActiveReads'
+    vector<int32>  activeReads_von, activeReads_bis;
+    less<int> vergleich;
+
+    aContig.getCRIndicesAtContigPosition(activeReads_von, von);
+    sort(activeReads_von.begin(), activeReads_von.end(), vergleich);
+    aContig.getCRIndicesAtContigPosition(activeReads_bis, bis);
+    sort(activeReads_bis.begin(), activeReads_bis.end(), vergleich);
+
+    theActiveReads.reserve(activeReads_von.size()+activeReads_bis.size());
+    set_union(activeReads_von.begin(), activeReads_von.end(),
+	      activeReads_bis.begin(), activeReads_bis.end(), 
+	      inserter(theActiveReads, theActiveReads.begin()));
+  }
+
+
+  aFaultRegion = new fault_region;
+  scfInfoList.clear();
+
+  I = theActiveReads.begin();
+
+  while (I != theActiveReads.end()) {
+    const Contig::contigread_t &r = allReads[*I];
+    if(r.read.usesAdjustments()){
+      int32 readIndex = theActiveReads[I - theActiveReads.begin()];
+      int32 readPos;
+      
+      aScfInfo = faultRegionFromRead(aContig, r, readIndex, von, 
+				     bis, sequence);
+      
+      aFaultRegion->addSequence(sequence, *aScfInfo);
+      scfInfoList.push_back(*aScfInfo);
+      
+      delete aScfInfo;
+    }
+    I++;
+  }
+  
+  aPool = new hypotheses_pool(*aFaultRegion, scfInfoList, &p);
+  delete aFaultRegion;
+
+  return aPool;
+}
+
+
+
+
+// *******************************************************
+//    testADSforReadExtend:       
+//    examine a sequence alignment and look, if is can be   
+//    regarded as corresponing to the consensus with 
+//    sufficient quality
+// *******************************************************
+
+
+bool testADSforReadExtend(AlignedDualSeq &ads, int32 umgebung, int32 &offset) 
+{
+  const char *s1 = ads.getAlignedSequence(1); 
+  const char *s2 = ads.getAlignedSequence(2);
+  int32 verschiebung;
+  int32 pos;
+
+  // If we extend the read (we always extend from left to right!)
+  // the begin should match quite good (without offset).
+
+  if (ads.getOffsetInAlignment(1) != 0 ||
+      ads.getOffsetInAlignment(2) != 0)
+    {
+      return false;
+    }
+
+  /*
+  if (ads.getOffsetInAlignment(1) > umgebung ||
+      ads.getOffsetInAlignment(2) > umgebung)
+    {
+      return false;
+    }
+  */
+
+  if (ads.getRightOffsetInAlignment(1) == 0) {
+
+    verschiebung = ads.getRightOffsetInAlignment(2);
+
+#ifdef HYPOTHESES_VERBOSE
+    cout << "Fall 1. Offset:" << offset << "  Verschiebung: " 
+    	 << verschiebung << endl;
+#endif
+
+    offset = - verschiebung; // - offset;
+  } else {
+    verschiebung = ads.getRightOffsetInAlignment(1);
+
+#ifdef HYPOTHESES_VERBOSE
+    cout << "Fall 2. Offset:" << offset << "  Verschiebung: " 
+	 << verschiebung << endl;
+#endif
+
+    offset = verschiebung - offset;
+  }
+
+  // the alignment should have a certain quality
+
+  if (ads.getScoreRatio() < 85) {
+    return false;
+  }
+
+  pos = ads.getTotalLen() - verschiebung - 1;
+
+  //  the reads must not differ some bases before the region of interest
+
+  for (int32 loop = 1; loop <= 2 * umgebung + 1; loop++) {
+    if(s1[pos] != s2[pos] && 
+       toupper(s1[pos]) != 'N' && 
+       toupper(s2[pos] != 'N')) {
+      return false;
+    }
+    pos--;
+  }
+
+  
+  return true;
+}
+
+
+
+
+// *******************************************************
+//    ExtendRead:       
+//    Examine a single read if it fits the consensus and   
+//    thus can be extended to the given number of bases
+// *******************************************************
+
+
+bool extendRead(const Contig &aContig, const Contig::contigread_t &aRead, 
+		int32 dbPos, int32 anzBases, 
+		int32 umgebung, int32 &offset_to_readpos)
+{
+  Contig::cccontainer_t& theConsensus = 
+    const_cast<Contig::cccontainer_t&>(aContig.getConsensusCounts());
+  Contig::cccontainer_t::iterator I_CONS = theConsensus.begin();
+  const Read &R = aRead.read;
+  const vector<char> &csequence = R.getActualComplementSequence();
+  const vector<char> &sequence =  R.getActualSequence();
+
+  MIRAParameters mira_parameters;
+
+  mira_parameters.setAlignMinScore(3);
+  mira_parameters.setAlignMinOverlap(3);
+
+  int32 readPos;
+  int32 vonPos, bisPos;
+  bool  result = false;
+
+
+  // Find the positions in the read, where we have to look at and
+  // initialize I_CONS to the corresponding base in the consensus
+
+  readPos = readPosFromContigPos(dbPos, aRead);
+
+#ifdef HYPOTHESES_VERBOSE
+  cout << "Extend Read;  direction: " << aRead.direction << endl;
+  cout << "dbpos:" << dbPos << "  readpos:" << readPos;
+  cout << "  anzBases " << anzBases;
+  cout << "  offset:" << aRead.offset << endl;
+#endif
+
+  if (dbPos > aRead.offset) {
+    // We extend the read on the right
+    I_CONS = I_CONS + dbPos - anzBases;
+    vonPos = readPos - anzBases;
+    bisPos = readPos - 1 + umgebung;
+  } else {
+    // We extend the read on the left
+    I_CONS = I_CONS + dbPos +anzBases - 1;
+    vonPos = readPos - umgebung;
+    bisPos = readPos + anzBases - 1;
+  }
+
+  {
+    // Copy the part of the read, we want to extend and the corresponding
+    // part of the consensus (the base at dbPos is always on the rear)
+    // and align them. We copy 'umgebung' bases more!
+
+    Align myAlignment(&mira_parameters);
+    char *read, *cons;
+    list<AlignedDualSeq> adslist;
+    list<AlignedDualSeq>::iterator I_ADS;
+
+    read = new char [anzBases + umgebung + 1];
+    cons = new char [anzBases + umgebung + 1];
+
+
+    for (int32 loop = 0; loop < anzBases + umgebung; loop++) {
+      if (dbPos > aRead.offset) {
+	
+        if (I_CONS != theConsensus.end()) { 
+          if (aRead.direction > 0) {
+	    read[loop] = sequence[vonPos++];
+	  } else {
+	    read[loop] = csequence[vonPos++];
+	  }
+  	  cons[loop] = calledBase(*I_CONS);
+	  I_CONS++;
+        } else {
+          read[loop] = 'N';
+          cons[loop] = 'N';
+        } 
+
+      } else {
+	if (aRead.direction > 0) {
+	  read[loop] = sequence[bisPos--];
+	} else {
+	  read[loop] = csequence[bisPos--];
+	}
+        cons[loop] = calledBase(*I_CONS);
+
+        if (I_CONS != theConsensus.begin()) {
+          I_CONS--;
+        } else {
+	  while (loop < anzBases + umgebung) {
+            read[loop] = 'N';
+            cons[loop] = 'N';
+            loop++;
+          }
+        }
+      }
+    }
+
+    
+    read[anzBases + umgebung] = 0;
+    cons[anzBases + umgebung] = 0;
+
+    // Overlap is less than 5 bases long
+    // we do not use the alignment routines for these cases
+
+    if (anzBases + umgebung <= 5) {
+      bool  ok = true;
+      bool  undef = false;
+      int32 l = 0;
+
+      while (l < anzBases + umgebung && ok) {
+	if (read[l] != cons[l]) {
+	  if (undef) {
+	    ok = false;
+	  } else {
+	    ok = (toupper(read[l]) == 'N' || toupper(cons[l]) == 'N');
+	    undef = ok;
+	  }
+	}
+	l++;
+      }
+      result = ok;
+
+    } else {
+
+      myAlignment.acquireSequences(read, anzBases + umgebung, 
+				   cons, anzBases + umgebung, 
+				   1, 2, // ReadIDs
+				   1, 1, // Richtung
+				   true, // calculate with offset
+				   0     // expected offset 
+				   );
+
+      myAlignment.fullAlign(&adslist,false,false);
+
+      // we step through the list of possible alignments and search for
+      // if one of them satisfies outr conditions
+
+      I_ADS = adslist.begin();
+      while (I_ADS != adslist.end() && !result) {
+	result = testADSforReadExtend(*I_ADS, umgebung, offset_to_readpos);
+	
+	I_ADS++;
+      }
+
+      // turn the offset for reverse reads
+      // if (aRead.direction < 0) offset_to_readpos = -offset_to_readpos;
+    }
+
+    delete [] read;
+    delete [] cons;
+  }
+  return result;
+}
+
+
+
+// Bach: 30.07.2009
+// check usesAdjustments()
+int32 scfPosFromDBPos(const int32 pos, const Contig::contigread_t &aRead)
+{
+  const vector<int32> &adjust = aRead.read.getAdjustments();  
+
+  if (aRead.direction < 0) {
+    if(aRead.read.usesAdjustments()) return adjust[aRead.read.getLenSeq() - 1 - pos];
+    return aRead.read.getLenSeq() - 1 - pos;
+  } else {
+    if(aRead.read.usesAdjustments()) return adjust[pos];
+    return pos;
+  }
+}
+
+
+
+int32 scfInfo_contigPosFirstBase(scfInfo &si)
+{
+  return dbPosFromReadPos(si.scfInfo_dbpos, *(si.scfInfo_read));
+}
+
+
+
+// *******************************************************************
+//  dbPosFromReadPos
+//  We have a position in a read and we want to know the corresponding
+//  position in the contig
+//
+//  readPosFromContigPos
+//  We have a contig position and we want to know which basePos in the
+//  read corresponds to this position
+//
+//
+//  CONTIG                       Offset  
+//  ==============================+
+//                 *--------------|------x--------+
+//                 |<--leftClip-->|      readPos
+//
+//
+//  CONTIG                          Offset
+//  ================================+
+//            *---------------------|-------x-------+
+//            |<---len-rightClip--->|       readpos 
+//
+//  ******************************************************************        
+
+
+int32 dbPosFromReadPos(const int32 readPos, const Contig::contigread_t &cRead)
+{
+
+  if (cRead.direction > 0) {
+    return readPos + cRead.offset - cRead.read.getLeftClipoff();
+  } else {
+    return readPos + cRead.offset - 
+      (cRead.read.getLenSeq() -  cRead.read.getRightClipoff());
+  }
+}
+
+
+int32 readPosFromContigPos(const int32 contigPos, const Contig::contigread_t &cRead)
+{
+  if (cRead.direction > 0) {
+    return contigPos - cRead.offset + cRead.read.getLeftClipoff();   
+  } else {
+    return contigPos - cRead.offset + 
+      (cRead.read.getLenSeq() - cRead.read.getRightClipoff());
+  }
+}
+
+
diff --git a/src/EdIt/hypothesen.C b/src/EdIt/hypothesen.C
new file mode 100644
index 0000000..9d79da6
--- /dev/null
+++ b/src/EdIt/hypothesen.C
@@ -0,0 +1,2305 @@
+/*
+ * Written by Thomas Pfisterer
+ *
+ * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
+ *   Krebsforschungszentrum, DKFZ Heidelberg) and Thomas Pfisterer
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ *
+ *
+ * hypotheses generation
+ *
+ * Written by Thomas Pfisterer
+ * Version 0.92       13.08.1999 
+ *         0.93       02.09.1999   
+ *         0.94       19.10.1999
+ *
+ */
+
+
+#include "hypothesen.H"
+#include "assert.h"
+
+
+// TODO
+// Was ist, wenn am Ende doch eine Read in einer Richtung fehlt (z.B. Quality
+// war schlecht) und eigentlich sind welche zum Verl�ngern da.
+// => L�sung(?): Nimm alle verl�ngerbaren Reads mit auf?
+//
+// Syntaktische Operationen evtl. mit eigenenm Operationstyp fr_insert_syntax
+// und dann kein Aufruf von SCF_look und auch eigener penalty.
+//
+// Zwei Teilhypothesen werden nach dem einfachen Abstandskriterium getrennt.
+// Hier sollten Repeats ber�cksichtigt werden
+// ok. 07-09-97
+//
+// Mehrfaches Laden der gleichen SCF-Dateien bei mehrspaltigen Hypothesen 
+// vermeiden. Editieren auf den geladenen Hypothesen!
+//
+// 02.09 set tag in consensus if size has changed 
+// 19.10 friend funktionen zur ausgabe
+// 	$Id$	
+
+#ifndef lint
+static char vcid[] = "$Id$";
+#endif /* lint */
+
+
+// 
+//  Initialize new fault_region
+// 
+
+fault_region::fault_region() {
+  fr_sequenceList.clear();  
+  fr_sequenceList.reserve(5);
+
+  fr_edits.clear();
+  fr_edits.reserve(4);
+
+  fr_steps = 0;
+  fr_longest = 0;
+  fr_score = 0;
+  fr_solution_score = 0;
+  fr_has_eor = false;
+}
+
+
+
+fault_region::fault_region(fault_region const &other) 
+{
+  *this = other;
+} 
+
+
+
+fault_region::~fault_region() 
+{
+   clear();
+}
+
+
+
+void fault_region::clear()
+{
+  fr_sequenceList.clear();
+  fr_edits.clear();
+
+  fr_longest = 0;
+  fr_score = 0;
+  fr_steps = 0;
+  fr_has_eor = false;
+}
+
+
+
+const fault_region& fault_region::operator= (const fault_region &other) 
+{
+  if (this == &other) { 
+    return *this;
+  }
+
+  fr_sequenceList.clear();
+  fr_edits.clear();
+
+  // copy the object
+  fr_longest = other.fr_longest;  
+  fr_score   = other.fr_score;
+  fr_steps   = other.fr_steps;
+  fr_edits   = other.fr_edits;
+  fr_solution_score = other.fr_solution_score;
+  fr_sequenceList = other.fr_sequenceList;
+  fr_has_eor      = other.fr_has_eor;
+
+  // FIXME
+  //  scfEditHypotheses = ???
+
+  return other;
+}
+
+
+
+
+char fault_region::readBase(const int32 readId, const int32 readPos) const
+{  
+  return fr_sequenceList[readId].si_sequence[readPos];
+}
+
+
+
+int32 fault_region::readSequenceCount() const
+{
+  return fr_sequenceList.size();
+}
+
+
+
+int32 fault_region::readScore() const
+{
+  return fr_score;
+}
+
+
+
+vector<editoperation> &fault_region::readEditOperations() 
+{
+  return fr_edits;
+}
+
+
+
+const sequenceInfo& fault_region::readSequence(int32 sequenceId) 
+{
+  return fr_sequenceList[sequenceId];
+}
+
+
+
+inline int32 fault_region::size() const
+{
+  return fr_longest;
+}
+
+
+int32 fault_region::realSize() const
+{
+  int32 size = 0;
+  
+  for (int32 l=0; l < fr_longest; l++) {
+    vector<sequenceInfo>::const_iterator I = fr_sequenceList.begin();
+    while (I != fr_sequenceList.end()) {
+      if (I->si_sequence[l] != fr_eorchar &&
+	  I->si_sequence[l] != fr_fillchar) {
+	size++;
+	break;
+      }
+      I++;
+    }
+  }
+  return size;
+}
+
+
+inline int32 fault_region::readSolutionScore() const
+{
+  return fr_solution_score;
+}
+
+
+
+void fault_region::setColumnToBase(int32 col, char base)
+{
+ vector<sequenceInfo>::iterator I = fr_sequenceList.begin();
+
+ // cout << "SetColumnToBase " << col << " base: " << base << endl;
+ while (I != fr_sequenceList.end()) {
+   if (I->si_sequence[col] != fr_eorchar) {
+     (I->si_sequence)[col] = base;
+   } 
+   I++;
+ }
+}
+
+
+// *************************************************************************
+// *
+// *  Search the fr_sequenceList if the sequence `target' is in the list 
+// *  The sequences may differ in fr_fillchar characters at the end. 
+// *
+// *  return:  vector<sequenceInfo>::iterator to fr_sequenceList entry    
+// *
+// *************************************************************************
+
+vector<sequenceInfo>::iterator fault_region::findSequence(const char* target)
+{
+  vector<sequenceInfo>::iterator iter = fr_sequenceList.begin();
+  int32  pos;
+
+  if (target == NULL) {
+    throw Notify(Notify::FATAL, "findSequence: No valid Sequence (NULL)");
+  }
+ 
+  while (iter != fr_sequenceList.end()) {
+    vector<char>::iterator I = (*iter).si_sequence.begin();
+    pos = 0;
+
+    // skip over the identical part....
+
+    while (I != (*iter).si_sequence.end() && 
+	   (*I) == target[pos] && 
+	   target[pos] != 0) {
+      I++; 
+      pos++;
+    }
+
+    // they are really identical...
+    // FIXME 1
+    // if (*I == target[pos] && target[pos+1] == 0) return iter; 
+    //      pos+1 may access undefined memory
+
+    if (I == (*iter).si_sequence.end() &&
+	target[pos] == 0) 
+      { 
+	return iter; 
+      }
+
+    // perhaps 'I' has only some additional fillchars...
+    if (target[pos] == 0) {
+      while (I != iter->si_sequence.end() && (*I) == fr_fillchar) I++;  
+      if (I == iter->si_sequence.end()) return iter;
+    }  
+
+    iter++;
+  }
+
+  return iter;
+}
+
+
+// ***************************************************************************
+// *
+// *  Add sequence 's' to the fault region.
+// *  Fill out scfInfo to link the fault region to the scf-file and the contig 
+// *
+// *  return:     1  sequence found
+// *              0  new sequence added to fault region
+// * 
+// ***************************************************************************
+
+int32 fault_region::addSequence(const char* s, scfInfo &aScfInfo)
+{
+  int32  newSize = strlen(s);
+
+  // Search for sequence in the fault_region
+  vector<sequenceInfo>::iterator I = findSequence(s);
+
+
+  // the same sequence is already present in the fr_sequenceList
+  // scfInfo must not be deleted in this case, it links the 'real' sequence
+  // to the sequence in the fault_region
+
+  if (I != fr_sequenceList.end()) {
+    I->si_occurences++;
+    aScfInfo.scfInfo_sequenceId = I - fr_sequenceList.begin();
+    return 1;
+  }
+
+
+  // create a new sequenceInfo and put it in the fr_sequenceList
+  // link the scfInfo to the entry in fr_sequenceList
+  {
+    sequenceInfo seqInfo;
+    seqInfo.si_occurences = 1;
+    seqInfo.si_insertCount = 0;
+    seqInfo.si_lastEditPos = -1;
+    seqInfo.si_sequence.reserve(newSize+2);   // to speed up inserts
+    seqInfo.si_sequence.clear();
+
+    for (int a = 0; a < newSize; a++) { 
+      fr_has_eor = fr_has_eor || (s[a] == fr_eorchar);
+      seqInfo.si_sequence.push_back(toupper(s[a]));
+    }
+
+    fr_sequenceList.push_back(seqInfo);   
+    aScfInfo.scfInfo_sequenceId = fr_sequenceList.size() - 1;
+    aScfInfo.scfInfo_confirmed = false;
+  }
+
+
+  // resize all entries in the list to the length of the longes sequence
+  if (fr_sequenceList.size() == 0) {
+    fr_longest = newSize;
+  } else {
+    if (newSize != fr_longest) 
+      resizeRegion(abs(newSize - fr_longest));
+  }
+
+  fr_score = pairwiseMismatch();
+
+  return 0;
+}
+
+
+
+// ***************************************************************************
+// *
+// * Is this solution possible, given the scope of the current system?
+// * Not used at the moment - all operations are possible! ;-)
+// *
+// ***************************************************************************
+
+
+bool fault_region::possibleSolution() const 
+{
+  return true;
+}
+
+
+// ***************************************************************************
+// *
+// * Is this solution valid. We do not allow solutions that insert a base 
+// * and delete the adjacent base afterwards.
+// *
+// ***************************************************************************
+
+
+bool fault_region::validSolution() const 
+{
+
+  vector<editoperation>::const_iterator I = fr_edits.begin();
+  vector<editoperation>::const_iterator J;
+
+  while (I != fr_edits.end()) {
+    if (I->base_old == fr_fillchar && isRealBase(I->base_new)) {
+      // insert a base...
+      
+      J = fr_edits.begin();
+      while (J != fr_edits.end()) {
+	if (J->base_new == fr_fillchar && isRealBase(J->base_old)) {
+	  // and delete another base
+	  if ( I->sequenceId == J->sequenceId && 
+	      ( J->position   == I->position+1 ||
+	        J->position+1 == I->position)) 
+	    {
+	      // in the same sequence and in adjacent positions
+	      return false;
+	    }
+	}
+	J++;
+      }
+    }
+    I++;
+  }
+
+  if (fr_has_eor == false) 
+    return true;
+
+ 
+  vector<sequenceInfo>::const_iterator S = fr_sequenceList.begin(); 
+  vector<char>::const_iterator C;
+
+  while (S != fr_sequenceList.end()) {
+    C = S->si_sequence.begin();
+    C++;  // next position...
+
+    while (C+1 < S->si_sequence.end()) {
+      if (*C == fr_eorchar && 
+	  *(C-1) != fr_eorchar && *(C-1) != fr_fillchar &&
+	  *(C+1) != fr_eorchar && *(C+1) != fr_fillchar)  {
+	// cout << "Not valid! 2: " << *(C-1) << *C << *(C+1) << endl;
+	return false;
+      }
+
+      // FIXME 4
+      if (*C == fr_eorchar && *(C+1) == fr_gapchar) {
+      	return false;
+      }
+
+      C++;
+    }
+
+    C = S->si_sequence.end() - 1;
+    if (*C != fr_eorchar && *C != fr_fillchar && *(C-1) == fr_eorchar) {
+      // cout << "Not valid! 3: " << *C << *(C-1) << endl;
+       return false;
+    }
+    S++;
+  }
+  return true;
+}
+
+
+
+
+
+// ***************************************************************************
+// * 
+// *  resize all sequences in the fault region 
+// *    increment 'fr_longest' by 'size'
+// *    resize sequences to fr_longest
+// *
+// *   return:  -1 error / 0 ok 
+// ***************************************************************************
+
+
+int32 fault_region::resizeRegion(int32 size) 
+{
+  if (size < 1) {
+    cerr << "resizeRegion: size<0 not implemented!\n";
+    return -1;
+  }
+
+  fr_longest += size;
+  for (uint32 l = 0; l < fr_sequenceList.size(); l++) {
+    fr_sequenceList[l].si_sequence.resize(fr_longest, fr_fillchar);
+  }
+  return 0;
+}
+
+
+// ***************************************************************************
+// * 
+// *  calculate number of pairwise mismatches in fault_region 
+// *  return:   number of pairwise mismatches
+// *
+// ***************************************************************************
+
+int32 fault_region::pairwiseMismatch()
+{
+  int32 length_loop;
+  int32 mismatches = 0;
+
+  if (fr_sequenceList.size() < 2) return 0;
+
+  for (length_loop = 1; length_loop < fr_longest; length_loop++) {
+     mismatches += pairwiseMismatchColumn(length_loop);
+  }
+
+  return mismatches;
+}
+
+
+// ***************************************************************************
+// * 
+// *  calculate number of pairwise mismatches in a single column 
+// *  return:   number of pairwise mismatches 
+// *
+// ***************************************************************************
+
+
+int32 fault_region::pairwiseMismatchColumn(int32 col) {
+  int32 mismatches = 0;
+  int32 s = fr_sequenceList.size();
+
+  for (int32 l1=0; l1 < s; l1++) {
+    vector<char> &seq1 = fr_sequenceList[l1].si_sequence;
+      
+    for (int32 l2=l1+1; l2 < s; l2++) {
+      vector<char> &seq2 = fr_sequenceList[l2].si_sequence;
+      if (seq1[col] != seq2[col] && seq1[col] != EOR_CHARACTER && 
+	  seq2[col] != EOR_CHARACTER)   
+	mismatches++;
+      //        mismatches += fr_sequenceList[l1].si_occurences *
+      //  fr_sequenceList[l2].si_occurences;
+    }
+  }
+  return mismatches;
+}
+
+
+// ***************************************************************************
+// * 
+// *  to keep the search space compact we try to merge identical fault regions 
+// *  this is a criterion when regions are treated as identical
+// *
+// *  result  0  'identical' 
+// *          1  'different'
+// ***************************************************************************
+
+int32 fault_region::compare(fault_region &fr)
+{
+  // different score
+  if (fr.readScore() != readScore()) 
+    return 1;
+
+  // different number of edits
+  if (fr.fr_steps != fr_steps || fr.fr_steps >= fr_maxsteps)
+    return 1;
+
+  // different length ?????  -> fr_fillchar 
+  // if (fr.fr_longest != fr_longest)
+  //   return 1;
+
+  if (calcSolutionScore() != fr.calcSolutionScore())
+    return 1;
+
+  vector<sequenceInfo>::iterator iter1 = fr_sequenceList.begin();
+  vector<sequenceInfo>::iterator iter2 = fr.fr_sequenceList.begin();
+
+  while (iter1 != fr_sequenceList.end()) {
+    vector<char> &seq1 = (*iter1).si_sequence;
+    vector<char> &seq2 = (*iter2).si_sequence;
+    vector<char>::iterator I = seq1.begin();
+    vector<char>::iterator J = seq2.begin();
+
+    // the first character is alway identical loop=0 => loop=1
+
+    while(I != seq1.end() && J != seq2.end()) {
+      if (*I != *J) return 1;
+      I++;
+      J++;
+    }
+
+    iter1++;
+    iter2++;
+  }
+  return 0;
+}
+
+
+
+// ************************************************************
+// * 
+// * check for a valid readId and readPos 
+// * return: 0 ok; 
+// *         1 nonsens operation
+// *         throw an exception otherwise 
+// *
+// ************************************************************
+
+
+int32 fault_region::checkParameters(const int32 readId, const int32 readPos)
+{
+  if (readId > (int32)fr_sequenceList.size()) {
+    throw Notify(Notify::WARNING, 
+		 "fault_region -- readId out of range");
+  }
+
+  if(readPos > fr_longest) {
+    //    cout << "ReadPos   : " << readPos << endl;
+    //    cout << "fr_longest: " << fr_longest << endl;
+#ifdef LIGHTHEADED
+    return 1;
+#else
+    throw Notify(Notify::WARNING, 
+    		 "fault_region -- readPos is out of range");
+#endif
+  }
+
+  if (fr_sequenceList[readId].si_lastEditPos == readPos) {
+    return 1;  // nonsens operation
+  } 
+
+  return 0;
+}
+
+
+
+// ************************************************************
+// * 
+// * insertBase in a given read 
+// * 
+// ************************************************************
+
+
+int32 fault_region::insertBase(const int32 readId, 
+	  		       const int32 readPos, const char base) 
+{
+  vector<char> &aSequence = fr_sequenceList[readId].si_sequence;
+
+  if (checkParameters(readId, readPos) == 1) return 1;
+
+  // last base is not a fillchar, we must extend the region
+  if (aSequence[fr_longest-1] != fr_fillchar) {
+    resizeRegion(1);
+    aSequence = fr_sequenceList[readId].si_sequence;
+  } 
+
+  
+  // goto readpos, insert the base and delete resize the region
+  // this is why we checked for the fillchar
+  {
+    vector<char>::iterator I =aSequence.begin();
+    advance(I, readPos);
+    aSequence.insert(I, base);
+    aSequence.resize(fr_longest);
+  }
+
+
+  // note what we have edited in op and add it it to the list of
+  // editoperations made
+  {
+    editoperation op;
+    op.sequenceId = readId;
+    op.position  = readPos;
+    op.base_old  = fr_fillchar;
+    op.base_new  = base;
+
+    if (op.base_new == fr_gapchar) {
+      op.operation = fr_syntactic;
+    } else {
+      op.operation = fr_insert;
+    }
+
+    fr_edits.push_back(op);
+  }
+
+  fr_score = pairwiseMismatch();
+  fr_steps++;
+  
+  // mark where we have made the last edit
+  fr_sequenceList[readId].si_lastEditPos = readPos;
+ 
+  return 0;
+}
+
+
+// ************************************************************
+// * 
+// * deleteBase in a given read 
+// * 
+// ************************************************************
+
+int32 fault_region::deleteBase(const int readId, const int readPos)
+{
+  vector<char> &aSequence = fr_sequenceList[readId].si_sequence;
+
+  if (checkParameters(readId, readPos) == 1) return 1;
+
+  {
+    // keep track of our edit-operations
+    editoperation op;
+    op.sequenceId = readId;
+    op.position   = readPos;
+    op.base_old   = aSequence[readPos];
+    op.base_new   = fr_fillchar;
+
+    if (op.base_old == fr_gapchar) {
+      op.operation = fr_syntactic;
+    } else {
+      op.operation = fr_delete;
+    }
+
+    fr_edits.push_back(op);
+  }
+
+  {
+    // goto readPos, delete the base, resize the region
+    vector<char>::iterator I = aSequence.begin();
+    advance(I, readPos);
+    aSequence.erase(I);
+    aSequence.resize(fr_longest, fr_fillchar);
+  }
+
+  fr_score = pairwiseMismatch(); 
+  fr_steps++;
+  
+  fr_sequenceList[readId].si_lastEditPos = readPos; 
+
+  return 0;
+}
+
+
+// ************************************************************
+// * 
+// * alterBase in a given read 
+// * 
+// ************************************************************
+
+
+int32 fault_region::alterBase(const int32 readId, 
+			      const int32 readPos, const char base)
+{
+  vector<char> &aSequence = fr_sequenceList[readId].si_sequence;
+
+  if (checkParameters(readId, readPos) == 1) return 1;
+  
+  // If we want to alter a gapchar into a base and there is the required
+  // base on the left of some gaps it is possible to get the base by 
+  // shuffling the gaps to the right and the base to the left.
+  // e.g.
+  //      XXXX**AXXXX    ==>  XXXXA**XXXX
+  //       A--^         
+  // if we need another A on the left we can alter a gap to an A later
+  
+
+  if (aSequence[readPos] == fr_gapchar) {
+    int32 x = readPos;
+
+    while (aSequence[x] == fr_gapchar && x+1 < fr_longest) { x++; }
+
+    if (aSequence[x] == base && x < fr_longest) {
+      
+      //    cout << readId << " x " << x << " readPos" <<readPos<<" " << endl;
+      while (x > readPos) {
+	// We produce some new edit-operations which are only syntactic
+	deleteBase(readId, x-1);
+	insertBase(readId, x, fr_gapchar);
+	x--;
+      }
+
+    return 0;
+    }
+  }
+  
+
+  // keep track of what we did...
+  {
+    editoperation op;
+    op.sequenceId = readId;
+    op.position  = readPos;
+    op.base_old  = aSequence[readPos];
+    op.base_new  = base;
+
+    if (op.base_new == fr_gapchar) {
+      if (op.base_old == fr_fillchar) {
+	op.operation = fr_syntactic;
+      } else {
+	op.operation = fr_delete;
+      }
+    } else {
+      if (op.base_old == fr_gapchar || op.base_old == fr_fillchar) {
+	op.operation = fr_insert;
+      } else {
+	op.operation = fr_alter;
+      }
+    }
+    fr_edits.push_back(op);
+  }
+
+  // do the edit
+  aSequence[readPos] = base;
+
+  // recalculate some parameters
+  fr_score = pairwiseMismatch(); 
+  fr_steps++;
+  fr_sequenceList[readId].si_lastEditPos = readPos;  
+
+  return 0;
+}
+
+
+// ******************************************************************
+// * 
+// * calculate number of edits to perform the edits on all scf-reads.
+// *
+// *******************************************************************
+
+int32 fault_region::editCount() 
+{
+  int32 editCount = 0;
+
+  for (uint32 i = 0; i < fr_edits.size(); i++) {
+    editoperation &op = fr_edits[i];
+
+    if (op.operation == fr_delete || op.operation == fr_insert ||
+	op.operation == fr_alter) {
+      editCount += fr_sequenceList[op.sequenceId].si_occurences;
+    }
+  }
+
+  return editCount;
+}
+
+
+// ******************************************************************
+// * 
+// * calculate the score of a solution.
+// * all operations are rated by a certain penalty value. If the
+// * solution changes the size of the fault region a small additional
+// * 'unbalance_penalty' is added. This is to prevent unnecessary
+// * changes in the fault_region size by syntactical operations. 
+// *
+// *******************************************************************
+
+int32 fault_region::calcSolutionScore() 
+{
+  fr_solution_score = 0;
+
+  const int32 delete_base_penalty = 12;
+  const int32 alter_base_penalty  = 12;
+  const int32 alter_n_penalty     = 7;
+  const int32 insert_base_penalty = 12;
+  const int32 insert_pad_penalty  = 2;
+  const int32 unbalance_penalty   = 2;
+  const int32 syntactic_penalty   = 1;
+  int32 balance = 0;
+
+  for (uint32 i = 0; i < fr_edits.size(); i++) {
+    editoperation &op = fr_edits[i];
+    int32 k = fr_sequenceList[op.sequenceId].si_occurences;
+
+    switch (op.operation) {      
+    case fr_delete: 
+      if (op.base_old != fr_gapchar) {
+	fr_solution_score += (k * delete_base_penalty); 
+      } else {
+	fr_solution_score -= insert_pad_penalty;
+      }
+
+      if (op.base_new == '.') {
+	balance -= k;
+      }
+
+      break;
+
+    case fr_insert:
+      if (op.base_new != fr_gapchar) { 
+	fr_solution_score += (k * insert_base_penalty);
+      } else {
+        fr_solution_score += (k * insert_pad_penalty);
+      }
+
+      if (op.base_old == fr_fillchar) {
+	balance += k;
+      }
+      break;
+
+    case fr_alter:  
+      if (isUndefinedBase(op.base_old)) {
+	fr_solution_score += (k * alter_base_penalty);
+      } else {
+	fr_solution_score += (k * alter_n_penalty);
+      }
+      break;
+    
+    case fr_syntactic:
+      fr_solution_score += k * syntactic_penalty;
+      if (op.base_old == fr_gapchar && op.base_new == fr_fillchar) 
+	balance -= k;
+      if (op.base_old == fr_fillchar && op.base_new == fr_gapchar)
+	balance += k;
+      break;
+    }
+  }
+
+  fr_solution_score += abs(balance * unbalance_penalty);
+  return fr_solution_score;
+}
+
+
+
+// ******************************************************************
+// * 
+// * Perform an editoperation on the fault region
+// * This is necessary to do the edits step by step and look at the 
+// * intermediate states
+// *
+// *******************************************************************
+
+
+void fault_region::performEditOperationOnRegion(editoperation &edOp)
+{
+  if (edOp.base_new == fr_fillchar) {
+    deleteBase(edOp.sequenceId, edOp.position);
+    fr_sequenceList[edOp.sequenceId].si_insertCount--;
+  } else {
+    if (edOp.base_old == fr_fillchar) {
+      insertBase(edOp.sequenceId, edOp.position, edOp.base_new);
+      fr_sequenceList[edOp.sequenceId].si_insertCount++;
+    } else {
+      alterBase(edOp.sequenceId, edOp.position, edOp.base_new);
+    }
+  }
+}
+
+
+// ******************************************************************
+// * 
+// * PerformOperationsOnReads
+// * The operations of the fault_region are performed on the reads. 
+// * The changes are tagged. Syntactic operations are als performed
+// * but not tagged.
+// *
+// *******************************************************************
+
+
+void fault_region::performOperationsOnReads(vector<scfInfo> aScfInfo,
+					    const EDITParameters &p,
+					    int32 locomotion) 
+{
+  int32 seq_id;
+  int32 ins_count = 0;   // count insert operations
+  int32 del_count = 0;   // count delete operations
+  int32 sum_loco = 0;
+
+  vector<scfInfo>::iterator I;
+  editoperation op;
+  int32  contigpos = -1;
+  char   s[200];
+  bool   setTag;
+  Contig *c = NULL;
+  
+  FUNCSTART("void fault_region::perform_operations(vector<scfInfo> aScfInfo");
+
+  // Step through all editoperations for the region
+
+  if (fr_has_eor == true && locomotion != 0) {
+    // FIXME
+    // At the moment we have problems handling such cases
+    return;
+  }
+
+
+  for (uint32 i = 0; i < fr_edits.size(); i++) {
+    op = fr_edits[i];
+    seq_id = op.sequenceId;
+
+    vector<afh_Info*>::iterator XX = fr_edits[i].readEdits.begin();
+
+    while (XX != fr_edits[i].readEdits.end()) {
+
+      I = aScfInfo.begin();   
+      advance(I, (*XX)->scfInfoId);  //new
+
+      setTag = true;
+
+      if (I->scfInfo_sequenceId == seq_id &&
+	  I->scfInfo_dbpos > 0) {
+	
+	contigpos = scfInfo_contigPosFirstBase(*I) + op.position;
+
+#ifndef RUN_ONLY 
+	if (p.isVerbose()) {
+	  cout << I->scfInfo_name << " : " << I->scfInfo_dbpos << "\t ";
+	}
+#endif
+	// Is the edit-operation in the visible part of a read.
+	// For insert operations the visible part also includes the position
+	// before the first base, otherwise it starts with the first base
+	
+	bool visible;
+
+	if (op.operation == fr_insert) { 
+	  visible= 
+	    (contigpos < (int32)((I->scfInfo_read)->offset + 
+				 I->scfInfo_read->read.getLenClippedSeq()) 
+	     &&
+	     contigpos >= (int32)(I->scfInfo_read)->offset - 1);
+
+	} else {
+	  visible =
+	    (contigpos < (int32)((I->scfInfo_read)->offset + 
+				 I->scfInfo_read->read.getLenClippedSeq()) 
+	     &&
+	     contigpos >= (int32)(I->scfInfo_read)->offset);
+	}
+
+
+	//if (p.isVerbose()) {
+	//  cout << " visible: " << visible;
+	//  cout << " confirmed: " << (*XX)->isConfirmed();
+	//}
+
+	if (visible && ((*XX)->isConfirmed() ||
+			(*XX)->getFaultClass() == fhc_SYNTACTIC)){
+
+	  c = I->scfInfo_contig;
+          op.base_new = tolower(op.base_new);
+         
+	  if (op.base_new == fr_fillchar && op.operation == fr_syntactic) {
+	    // Syntactic insert operation - do not tag
+	    op.operation = fr_delete;
+	    setTag = false;
+
+#ifndef RUN_ONLY
+	    if (p.isVerbose()) {
+	      cout << "Op changed to fr_delete" << endl;
+	    }
+#endif
+	  }
+	  if (op.base_old == fr_fillchar && op.operation == fr_syntactic) {
+	    // Syntactic delete operation - do not tag
+	    op.operation = fr_insert;
+	    setTag = false;
+
+#ifndef RUN_ONLY
+	    if (p.isVerbose()) {
+	      cout << "Op changed to fr_insert" << endl;
+	    }
+#endif
+	  }
+
+	  switch (op.operation) {
+
+	  case fr_alter:
+            if (op.base_old == fr_fillchar) {
+
+	      sprintf(s, "Insert Base at %d %c=>%c %s %d", contigpos,
+		      op.base_old, op.base_new, I->scfInfo_name,
+		      I->scfInfo_position[op.position]);
+
+#ifndef RUN_ONLY
+	      if (p.isVerbose()) {
+		cout << s << endl;
+	      }
+#endif
+
+	      c->insertBaseInRead((char)op.base_new, contigpos,
+				  I->scfInfo_readId);
+	      ins_count++;
+	    } else {
+
+	      sprintf(s, "Alter Base at %d %c=>%c %s %d", contigpos,
+		      op.base_old, op.base_new, I->scfInfo_name,
+		      I->scfInfo_position[op.position]);
+
+#ifndef RUN_ONLY
+	      if (p.isVerbose()) {
+		cout << s << endl;
+	      }
+#endif
+
+	      c->changeBaseInRead((char)op.base_new,
+				  contigpos, I->scfInfo_readId);
+	    }
+
+	    if (setTag && p.tagAlterOperations()) {
+	      try {
+		c->addTagToRead(contigpos, contigpos, I->scfInfo_readId,
+				"ED_C", s);
+	      }
+	      catch (Notify n) {
+	      }
+	      p.logOperation(s);
+	    }
+
+	    break;
+
+	  case fr_delete: {
+	    int32 readpos = I->scfInfo_position[op.position];
+	    if (op.base_new == fr_fillchar) {
+
+	      sprintf(s, "Delete Base at %d %c=>%c %s %d", contigpos,
+		      op.base_old, op.base_new,I->scfInfo_name,
+		      I->scfInfo_position[op.position]);  // op.position-1
+
+#ifndef RUN_ONLY
+	      if (p.isVerbose()) {
+		cout << s << endl;
+	      }
+#endif
+
+	      //int32 readpos = I->scfInfo_position[op.position-1];
+
+	      c->deleteBaseInRead(contigpos, I->scfInfo_readId);
+	      del_count++;
+
+	      if (setTag && p.tagDeleteOperations() && 
+		  contigpos-1 >= I->scfInfo_read->offset &&
+		  contigpos-1 <= I->scfInfo_read->offset + 
+		                 I->scfInfo_read->read.getLenClippedSeq()) {
+		
+		c->addTagToRead(contigpos-1, contigpos-1, I->scfInfo_readId,
+				"ED_D", s);
+	      }
+	    } else {
+
+	      sprintf(s, "Change Base at %d %c=>%c %s %d", contigpos,
+		      op.base_old, op.base_new,I->scfInfo_name, readpos);
+
+#ifndef RUN_ONLY
+	      if (p.isVerbose()) {
+		cout << s << endl;
+	      }
+#endif
+
+	      c->changeBaseInRead('*', contigpos, I->scfInfo_readId);
+	      
+	      if (setTag && p.tagDeleteOperations()) {
+		//int32 readpos = I->scfInfo_position[op.position-1];
+		//int32 readpos = I->scfInfo_position[op.position];
+		int32 left;
+
+                if (contigpos-1 >= I->scfInfo_read->offset && 
+		    contigpos <= I->scfInfo_read->offset + 
+		                 I->scfInfo_read->read.getLenClippedSeq()) {
+
+		  c->addTagToRead(contigpos-1, contigpos, I->scfInfo_readId,
+				  "ED_D", s);
+		} else {
+		  c->addTagToRead(contigpos, contigpos, I->scfInfo_readId,
+				  "ED_D", s);
+		}	
+	      }
+	    }
+	    p.logOperation(s);
+	    break;
+	  }
+
+	  case fr_insert: 
+	    if (op.base_old == fr_fillchar) {
+	      
+	      sprintf(s, "Insert Base at %d %c=>%c %s %d", contigpos,
+		      op.base_old, op.base_new,I->scfInfo_name,
+		      I->scfInfo_position[op.position]);
+
+#ifndef RUN_ONLY
+	      if (p.isVerbose()) {
+		cout << s << endl;
+	      }
+#endif
+
+		c->insertBaseInRead((char)op.base_new, contigpos,
+				    I->scfInfo_readId);
+
+	      ins_count++;
+	    } else {
+
+	      sprintf(s, "Alter Base at %d %c=>%c %s %d", contigpos,
+		      op.base_old, op.base_new,I->scfInfo_name,
+		      I->scfInfo_position[op.position]);
+
+#ifndef RUN_ONLY
+	      if (p.isVerbose()) {
+		cout << s << endl;
+	      }
+#endif
+
+	      c->changeBaseInRead((char)op.base_new,
+				  contigpos, I->scfInfo_readId);
+	    }
+
+	    if (setTag && p.tagInsertOperations()) { 
+	      c->addTagToRead(contigpos, contigpos,  I->scfInfo_readId,
+			      "ED_I", s);
+	    }
+	    p.logOperation(s);
+	    break;
+
+          case fr_syntactic:
+	    if (op.base_old == fr_eorchar && op.base_new == fr_gapchar)
+	      del_count++;
+	    if (op.base_old == fr_gapchar && op.base_new == fr_eorchar)
+	      ins_count++;
+	    break;
+
+	  default: 
+            throw Notify(Notify::WARNING, "Illegal edit-operation");
+	  }
+	} else {
+	  // Read is hidden or hypo is not confirmed
+	}
+      }
+      // I++;
+      XX++;
+    }
+  }
+
+
+  // has the size of the fault region changed?
+  // shift all reads that begin after the fault-region
+
+  if (locomotion != 0 && c != NULL && 
+      contigpos < c->getConsensusCounts().size()) 
+    {
+      //      locomotion = (ins_count - del_count) / (int32)aScfInfo.size();
+      
+#ifndef RUN_ONLY
+      if (p.isVerbose()) {
+	cout << "AdjustReadOffsets (contigpos=" << contigpos 
+	     << ", loco=" << locomotion << ")" << endl;
+      }
+#endif
+
+      // BaCh
+      // cout << "Contig loco is:\n\n" << *c << endl;
+
+#ifdef LIGHTHEADED
+
+      // report the error and continue editing...
+      try {
+	//	c->adjustReadOffsets(contigpos, locomotion);
+	c->adjustReadOffsets(scfInfo_contigPosFirstBase(*I)+1, locomotion);
+      }
+      catch(Notify n) {
+	cout << "ERROR: Problems occured while adjustingReadOffsets!" <<endl;
+      }
+#else
+      //c->adjustReadOffsets(contigpos, locomotion);
+      c->adjustReadOffsets(scfInfo_contigPosFirstBase(*I)+1, locomotion);
+#endif
+
+  }
+
+  if (p.tagDeleteAsteriskColumns() && c != NULL) {
+    int32 oldsize = c->getContigLength();
+
+    if (contigpos < c->getContigLength() - 1) {    
+#ifndef RUN_ONLY
+      if (p.isVerbose()) {
+	cout << "DeleteStarOnlyColumns between " << contigpos-10 
+	     << " - " << contigpos+1 << endl;
+      }
+#endif
+
+      // BaCh
+      // cout << "Contig is:\n\n" << *c << endl;
+
+#ifdef LIGHTHEADED
+      // report the error and continue editing...
+      try {
+	 c->deleteStarOnlyColumns(max(contigpos-10, 0), contigpos+1);
+      }
+      catch(Notify n) {
+	n.handleError("Error while examining fault-region");
+      }
+#else
+        c->deleteStarOnlyColumns(max(contigpos-10, 0), contigpos+1);
+#endif
+    }
+
+    // BaCh
+    //cout << "New contig is:\n\n" << *c << endl;
+    //cout << "Done." << endl;
+
+    sum_loco = locomotion - (oldsize - c->getContigLength());
+  }
+
+  if (p.tagConsensus() && sum_loco != 0) {
+    if (sum_loco < 0) {
+      c->addTagToConsensus(contigpos, contigpos, '=',
+			   "ED_D", "EdIt: Consensus base deleted",
+			   false);
+    } else {
+      c->addTagToConsensus(contigpos, contigpos, '=',
+			   "ED_I", "EdIt: Consensus base inserted",
+			   false);
+    } 
+  }
+
+
+  FUNCEND();
+  return;
+}
+
+
+
+
+int32 fault_region::shufflePadInSequence(int read_id, int pos) 
+{
+  int32 lauf = pos + 1;
+  vector<char> &aSequence = fr_sequenceList[read_id].si_sequence;
+  
+  while (aSequence[lauf] == aSequence[pos]) lauf++;
+  
+  if (aSequence[lauf] == fr_gapchar) {
+    deleteBase(read_id, lauf);
+    insertBase(read_id, pos, fr_gapchar);
+    return 1;
+  }
+    
+  lauf = pos - 1;
+  while (aSequence[lauf] == aSequence[pos]) lauf--;
+  
+  if (aSequence[lauf] == fr_gapchar) {
+    insertBase(read_id, pos, fr_gapchar);
+    deleteBase(read_id, lauf);
+    return 1;
+  }
+  return 0;  
+}
+
+
+void fault_region::shufflePads() 
+{
+  int32 stern_count, other_count;
+
+  for (int loop = 0; loop < fr_longest; loop++) {
+    stern_count = 0;
+    other_count = 0;
+    
+    // Count pads and bases in the column
+    vector<sequenceInfo>::iterator I = fr_sequenceList.begin();
+    while (I != fr_sequenceList.end()) {
+      if (I->si_sequence[loop] == fr_gapchar) {
+	stern_count += I->si_occurences;
+      } else {
+	other_count += I->si_occurences;
+      }
+      I++;
+    }
+    
+    // if gaps are predominant try to shuffle the other reads
+    if (stern_count > other_count) {
+      vector<sequenceInfo>::iterator J = fr_sequenceList.begin();
+      while (J != fr_sequenceList.end()) {
+	if (J->si_sequence[loop] != fr_gapchar) {
+	  shufflePadInSequence(J - fr_sequenceList.begin(), loop);
+	}
+	J++;
+      }
+    }
+  }
+}
+
+
+
+bool fault_region::isBaseInColumn(int32 col, char aBase)
+{
+  vector<sequenceInfo>::iterator I = fr_sequenceList.begin();
+  while (I != fr_sequenceList.end()) {
+    if (I->si_sequence[col] == aBase) {
+       return true;
+    }
+    I++;
+  }
+  return false;
+}
+
+
+
+ostream &operator<<(ostream &ostr, fault_region const &i)
+{
+  vector<editoperation>::const_iterator I = i.fr_edits.begin();
+
+  ostr << endl;
+
+  for (uint32 l1 = 0; l1 < i.fr_sequenceList.size(); l1++) {
+    const vector<char> &seq = i.fr_sequenceList[l1].si_sequence;
+
+    for (uint32 l2 = 0; l2 < seq.size(); l2++) {
+      ostr << seq[l2];
+    }
+
+    ostr << "\t" << (int)i.fr_sequenceList[l1].si_occurences;
+    ostr << "  inserts: " << (int)i.fr_sequenceList[l1].si_insertCount;
+    ostr << endl;
+  
+  }
+
+  ostr << "Mismatches: " << i.fr_score   << "  Edits: " << i.fr_steps ;
+  ostr << "  Score : "   << i.fr_solution_score 
+       << "  size: " << i.realSize() << endl;
+
+  while (I != i.fr_edits.end()) {
+    ostr << I->base_old   << " -> " << I->base_new << " Op.";
+    ostr << (int)I->operation << "  ";
+    ostr << (int)I->sequenceId << ":"    << (int)I->position
+	 << endl;
+    I++; 
+  }  
+
+  ostr << "------------------" << endl;
+
+  return ostr;
+}
+
+
+
+/* --------------------------------------
+        hypotheses_pool
+   -------------------------------------- */
+
+hypotheses_pool::hypotheses_pool(const fault_region startzustand, 
+				 vector<scfInfo> &si)
+{
+  hp_ready.clear();
+  hp_ready.reserve(hp_poolsize);
+
+  hp_pool.clear();
+  hp_pool.reserve(hp_poolsize*2);
+
+  hp_start = startzustand;
+  hp_pool.push_back(hp_start);
+
+  hp_scfInfo.clear();
+  hp_scfInfo.swap(si);
+
+  hp_parameter = NULL; // new EDITParameters;
+}
+
+
+hypotheses_pool::hypotheses_pool(const fault_region startzustand, 
+				 vector<scfInfo> &si, EDITParameters *p)
+{
+  hp_ready.clear();
+  hp_ready.reserve(hp_poolsize);
+
+  hp_pool.clear();
+  hp_pool.reserve(hp_poolsize*2);
+
+  hp_start = startzustand;
+  hp_pool.push_back(hp_start);
+
+  hp_scfInfo.clear();
+  hp_scfInfo.swap(si);
+
+  hp_parameter = p;
+}
+
+
+
+hypotheses_pool::~hypotheses_pool()
+{
+  //  theBuffer.statistics();
+  hp_ready.clear();
+  hp_pool.clear();
+
+  hp_start.clear();
+
+  vector<scfInfo>::iterator I = hp_scfInfo.begin();
+  while (I != hp_scfInfo.end()) {
+    if (I->scfInfo_name != NULL) {
+      delete [] I->scfInfo_name;
+    }
+    I++;
+  }
+
+  hp_scfInfo.clear();
+}
+
+
+
+bool hypotheses_pool::isDoubleStranded(bool &forward, bool &reverse)
+{
+  forward = false;
+  reverse = false;
+  vector<scfInfo>::iterator I = hp_scfInfo.begin();
+  
+  while (I != hp_scfInfo.end()) {
+    if (I->scfInfo_read->direction > 0) {
+      forward = true;
+    } else {
+      reverse = true;
+    }
+    I++;
+  }
+
+  return (forward && reverse);
+}
+
+
+// Is doubleStranded _or_ has at a coverage of at least c  
+
+bool hypotheses_pool::isDoublestrandedOrCoverage(bool &forward, 
+						 bool &reverse, int32 c)
+{
+  int32   readCount = 0;
+  forward = false;
+  reverse = false;
+  vector<scfInfo>::iterator I = hp_scfInfo.begin();
+
+  while (I != hp_scfInfo.end()) {
+    if (I->scfInfo_read->direction > 0) {
+      forward = true;
+    } else {
+      reverse = true;
+    }
+    readCount++;
+    I++;
+  }
+
+  return ((forward && reverse) || (c > 0 && readCount >= c));
+}
+
+
+
+// are different sequencing machines used in this fault region/ for this hypothesis?
+// Evaluates the MACH flag in the comments of the SCF files. This is not always set
+// correctly!
+bool hypotheses_pool::usesDifferentChemistry()
+{
+  t_machinetype t = MT_undefined;
+  vector<scfInfo>::iterator I = hp_scfInfo.begin();
+  SCF_look *theTrace;
+
+  if (hp_scfInfo.size() < 2) {
+    return false;
+  }
+
+
+  while (I != hp_scfInfo.end()) {
+
+    theTrace = ScfBuffer::bufferRead(I->scfInfo_read->read,
+				     I->scfInfo_read->direction);
+  
+    if (t != MT_undefined) {
+      if (t != theTrace->getMACHType()) {
+	ScfBuffer::bufferDelete(theTrace);
+	return true;
+      } 
+    } else {
+      t = theTrace->getMACHType();
+      ScfBuffer::bufferDelete(theTrace);
+    }
+    I++;
+  }
+
+  return false;
+}
+
+
+
+// Test for sufficient information for the evaluation of a hypothesis
+// - double stranded is sufficient
+// - coverage of minCoverage' is sufficient (minCoverage > 0)
+// - different machines used is sufficienty if useChemistry = true
+
+bool hypotheses_pool::hasSufficientInformation(bool &forward, bool &reverse, 
+					       bool useChemistry, int32 minCoverage)
+{
+  if (isDoublestrandedOrCoverage(forward, reverse, minCoverage)) {
+    return true;
+  } else {
+    if (useChemistry == true) {
+      return usesDifferentChemistry();
+    } else {
+      return false;
+    }
+  }
+}
+
+
+
+
+void hypotheses_pool::pushStep(fault_region &fr)
+{
+
+  if (false == fr.validSolution()){
+    // We don't want this solution...
+    return;
+  }
+
+  if (fr.readScore() > 0) {
+    vector<fault_region>::iterator iter = hp_pool.begin();
+    while (iter != hp_pool.end() && iter->compare(fr) != 0) {
+      ++iter;
+    }
+
+    if (iter == hp_pool.end()) {
+      hp_pool.push_back(fr);
+    }
+
+  } else {
+    vector<fault_region>::iterator iter = hp_ready.begin();
+
+    while (iter != hp_ready.end() && iter->compare(fr) != 0) {
+      ++iter;
+    }
+
+    if (iter == hp_ready.end()) {
+      fr.calcSolutionScore();
+      hp_ready.push_back(fr);
+    }
+  }
+}
+
+
+void hypotheses_pool::iterate(fault_region &fr)
+{
+  int32 firstFaultCol = 1; 
+  fault_region nextStep;
+
+
+  while (firstFaultCol < fr.size() && 
+	 0 == fr.pairwiseMismatchColumn(firstFaultCol)) {
+    
+    firstFaultCol++;
+  }
+
+
+  if (firstFaultCol == fr.size()) {
+#ifdef HYPOTHESES_VERBOSE
+    cout << "Nothing to correct!" << endl;
+#endif     
+    return;
+  }
+
+  for (int32 read_loop=0; 
+       read_loop < fr.readSequenceCount(); 
+       read_loop++) 
+    { 
+      
+      if (fr.readBase(read_loop, firstFaultCol) != '_') {
+	// e.g. _ -> . makes some problems...
+
+	for (int8 loop = 0; loop < 5; loop++) {
+	  
+	  if (fr.readBase(read_loop, firstFaultCol) != "*ACGT"[loop] &&
+	      fr.isBaseInColumn(firstFaultCol, "*ACGT"[loop])) {
+	    
+	    nextStep = fr;
+	    if (0==nextStep.alterBase(read_loop,firstFaultCol,"*ACGT"[loop])) {
+	      pushStep(nextStep);
+	    }
+
+	    nextStep = fr;
+	    if(0==nextStep.insertBase(read_loop,firstFaultCol,"*ACGT"[loop])){
+	      pushStep(nextStep);
+	    }
+
+	  }
+	}
+	nextStep = fr;
+
+	if (0 == nextStep.deleteBase(read_loop, firstFaultCol))
+	  pushStep(nextStep);
+      }
+    }
+
+  return;
+}
+
+
+
+bool hp_compare(const fault_region &a, const fault_region &b)
+{   
+  return (a.readScore() < b.readScore());
+}
+
+
+
+bool hp_compare_solution(const fault_region &a, const fault_region &b)
+{   
+  return (a.readSolutionScore() < b.readSolutionScore());
+}
+
+
+
+void hypotheses_pool::iteratePool()
+{
+  vector<fault_region> hp_old;
+
+  hp_old.clear();
+  hp_old.reserve(hp_poolsize*2);
+  hp_pool.swap(hp_old);
+
+  vector<fault_region>::iterator iter = hp_old.begin();
+
+  while (iter != hp_old.end()) {
+    iterate(*iter);
+
+    if (hp_pool.size() == 0) {
+      hp_old.clear();
+      return;
+    }
+
+    sort(hp_pool.begin(), hp_pool.end(), hp_compare);
+
+    if (hp_pool.size() > hp_usesize) {
+      hp_pool.erase(hp_pool.begin() + hp_usesize, hp_pool.end());
+    } 
+
+    ++iter;
+  }
+
+  hp_old.clear();
+
+}
+
+
+void hypotheses_pool::iteratePool(int32 anz) 
+{
+  if (anz < 1)  return;
+  if (anz > 10) {
+    cerr << "Endless iterations skipped...\n";
+    cerr << "number of iterations set to 3\n";
+    anz = 3;
+  }
+
+  for (int loop = 0; loop<anz; loop++) {
+    iteratePool();
+  }
+}
+
+
+
+void hypotheses_pool::iterateFirstSolutionPlus(int32 anz)
+{
+  int8 count = 0;
+
+  if (anz > 5) {
+    cerr << "Endless iterations skipped...\n";
+    cerr << "Iterate until first solution.\n";
+    anz = 0;
+  }
+
+  while (hp_ready.size() == 0 && count < 10) {
+    iteratePool();
+    count++;
+  }
+  iteratePool(anz);
+
+}
+
+
+
+ostream &operator<<(ostream &ostr, hypotheses_pool const &i)
+{
+  vector<fault_region>::const_iterator I = i.hp_pool.begin();
+
+  ostr << "\nHypotheses-Pool" ;
+
+  while (I != i.hp_pool.end()) {
+    ostr << *I;
+    ++I;
+  }
+
+  if (i.hp_parameter != NULL && i.hp_parameter->isVerbose(4)) {
+    vector<fault_region>::const_iterator iter = i.hp_ready.begin();
+   
+    for (uint32 l = 0; l < i.hp_scfInfo.size(); l++) {
+      const scfInfo &aScf = i.hp_scfInfo[l];
+      if (aScf.scfInfo_read == NULL) {
+	ostr << "  " << aScf.scfInfo_name << "\t";
+      } else {
+	ostr << "  " << aScf.scfInfo_read->read.getName() << "\t";
+      }
+    
+      for (uint32 k = 0; k < aScf.scfInfo_position.size(); k++) {
+	ostr << aScf.scfInfo_position[k] << "\t";
+      }
+     
+      ostr << "\tc: " << aScf.scfInfo_confirmed 
+	   << "\th: " << aScf.scfInfo_hidden << endl;
+    }
+    ostr << "====================================" << endl;
+  }
+  return ostr;
+}
+
+
+void hypotheses_pool::showResult() 
+{
+  vector<fault_region>::iterator iter = hp_ready.begin();
+  
+  cout << "Show result:\n";
+
+  for (uint32 l = 0; l < hp_scfInfo.size(); l++) {
+    const scfInfo &aScf = hp_scfInfo[l];
+    if (aScf.scfInfo_read == NULL) {
+      cout << "  " << aScf.scfInfo_name << "\t";
+    } else {
+      cout << "  " << aScf.scfInfo_read->read.getName() << "\t";
+    }
+
+    for (uint32 k = 0; k < aScf.scfInfo_position.size(); k++) {
+      cout << aScf.scfInfo_position[k] << "\t";
+    }
+    
+    cout << "\tc: " << aScf.scfInfo_confirmed 
+	 << "\th: " << aScf.scfInfo_hidden << endl;
+  }
+  
+
+  sort(hp_ready.begin(), hp_ready.end(), hp_compare_solution);
+
+  while (iter != hp_ready.end()) {
+    //if ((*iter).possibleSolution()) {
+    cout << "Show Result" << endl;
+    cout << *iter;
+    cout << "Solution Score: " << iter->readSolutionScore() << endl;
+    //   }
+    ++iter;
+  }
+  
+}
+
+
+
+int32 hypotheses_pool::minimalEdits() {
+  vector<fault_region>::iterator iter = hp_ready.begin();
+  int32 minEds = 99999;
+
+  while (iter != hp_ready.end()) {
+     int32 i = iter->editCount();
+     if (i < minEds) minEds = i;
+     ++iter;
+  }
+  return minEds;
+}
+
+
+
+
+bool hypotheses_pool::createCfhInfoList(EDITParameters &p)
+{
+  vector<fault_region>::iterator iter = hp_ready.begin();
+  int32 n = 1;             // count solutions checked
+  int32 max_score = 0;     // max acceptable score for a solution
+
+  hp_parameter = &p;
+
+  if (iter == hp_ready.end()) {
+
+    if (p.isVerbose()) {
+      cout << "No solutions found!" << endl;
+    }
+
+    return false;
+  }
+
+  // Sort the solutions 
+  sort(hp_ready.begin(), hp_ready.end(), hp_compare_solution);
+
+  // We generate the solutions - best first -
+  max_score = ( (100 + p.getMaxScoreOverBest()) 
+		 * iter->readSolutionScore())/100;
+  
+  while (iter != hp_ready.end() && 
+        (iter->readSolutionScore() <= max_score || 
+	 n <= p.getMinSolutionsChecked())) {
+
+    fault_region editStart = hp_start;
+    editStart.generateAllHypotheses(*iter, hp_scfInfo, hp_parameter);    
+    
+    iter++;
+    n++;
+  }
+
+  // Delete the remaining solutions with unsufficient score
+  while(iter != hp_ready.end()) {
+    hp_ready.erase(iter);
+  }
+
+  return true;
+}
+
+
+
+bool fault_region::generateAllHypotheses(fault_region &target,
+					 vector<scfInfo> &scf, 
+					 EDITParameters *p)
+{
+  vector<editoperation>::iterator edOpLoop;
+  vector<editoperation> &theEdits = target.readEditOperations();  
+  vector<sequenceInfo>::const_iterator I = fr_sequenceList.begin();
+
+  int32 loop; 
+  int32 problem_offset = 0;   // necessary locomotions of the edit-posit
+  int32 question = fhc_UNDEFINED;
+  char  newBase  = GAP_BASE;
+  char  oldBase  = GAP_BASE;
+  bool  found;
+
+  // check each sequence if it was editied at the given position
+
+
+  edOpLoop = theEdits.begin();
+
+  while (edOpLoop != theEdits.end()) {
+
+    I = fr_sequenceList.begin();
+    loop = 0;
+    found = false;
+    edOpLoop->readEdits.clear();
+    problem_offset = 0;
+
+    while (I!= fr_sequenceList.end()) {
+
+      if (edOpLoop->sequenceId == loop) {
+
+	oldBase = edOpLoop->base_old;
+	newBase = edOpLoop->base_new;
+
+	switch (edOpLoop->operation) {
+	case fr_syntactic: {
+	  question = fhc_SYNTACTIC;
+          
+	  found = true;
+	  break;
+	}
+	case fr_delete: {  
+	  int32 x = edOpLoop->position-1;
+	  int32 y = edOpLoop->position+1;
+	  
+	  // TODO: (BaCh) fsck, this lets valgrind puke
+	  //  first repair attempt led to errors in the edited contig
+	  //
+	  //  I'll have to live with it
+
+	  while (I->si_sequence[x] == GAP_BASE) { x--; }
+	  while (I->si_sequence[y] == GAP_BASE) { y++; }
+	  
+	  if (I->si_sequence[edOpLoop->position] == I->si_sequence[x] ||
+	      I->si_sequence[edOpLoop->position] == I->si_sequence[y]) {
+	   question = fhc_OVERCALL;
+	  } else {
+	    question = fhc_ADDITIONAL;
+	  }
+
+	  found = true;
+	  break;
+	}
+	case fr_alter: {
+	  question = fhc_WRONG;
+	  found = true;
+	  break;
+	}
+	case fr_insert: {
+
+	  if (newBase == I->si_sequence[edOpLoop->position-1] || 
+	      newBase == I->si_sequence[edOpLoop->position]) {
+	    question = fhc_UNDERCALL;
+	    if (newBase == I->si_sequence[edOpLoop->position-1]) {
+	      problem_offset = -1;
+	    }
+	  } else {
+	    question = fhc_MISSING;
+	  }
+	  found = true;
+	  break;
+	}
+	}
+      
+	vector<scfInfo>::iterator theScfRead = scf.begin();
+	afh_Info *aProblem;
+
+	while (theScfRead != scf.end() && found) {
+
+	  if (theScfRead->scfInfo_sequenceId == loop) {
+	    try {
+
+	      //cout << "\n Edit position " << edOpLoop->position
+	      //     << "  offset: " << problem_offset << endl;
+	      //cout << "OldBase " << oldBase << " NewBase " 
+              //     << newBase << endl; 
+	      //cout << theScfRead->scfInfo_read->read.getName() << endl;
+
+	      aProblem=createSingleHypotheses(*theScfRead, *I, question, 
+					      newBase, oldBase,
+					      edOpLoop->position
+					      +problem_offset);
+	      if (aProblem != NULL) {
+		target.appendAfh(aProblem);  
+		aProblem->scfInfoId = theScfRead - scf.begin();
+		edOpLoop->readEdits.push_back(aProblem);  // FIXME V1
+	      } else {
+		throw Notify(Notify::FATAL, 
+			     "Error creating hypotheses!");
+	      }
+	      
+	    }
+	    catch(Notify n) {
+	      cout << "Error evaluating hypotheses!" << endl;
+	      throw Notify(Notify::WARNING, "Error evaluating hypotheses!");
+	    } 
+	  }
+	  theScfRead++;
+	}
+
+      }
+
+      loop++;
+      I++;
+    }
+    performEditOperationOnRegion(*edOpLoop);
+    edOpLoop++;
+  }
+  return true;
+}
+
+
+afh_Info* fault_region::createSingleHypotheses(scfInfo &theScfRead, 
+					  const sequenceInfo &s, 
+					  int32 question, char new_base, 
+					  char old_base, int32 pos)
+{
+  const Contig::contigread_t *myRead = theScfRead.scfInfo_read;
+  int32 ic = s.si_insertCount;
+  char  oldDBBase;
+  afh_Info *theProblem;
+
+  // FIXME ???
+  // Da �nderungen auf den Reads nachgezogen werden, sollten die
+  // Positionen �bereinstimmen ?!?
+  // int32 dbPos  = theScfRead.scfInfo_dbpos + pos - ic;
+  int32 dbPos  = theScfRead.scfInfo_dbpos + pos;
+  int32 scfPos ;
+
+
+  //cout << "start: " << theScfRead.scfInfo_dbpos  << "\tpos : " << pos 
+  //    << "\tic: " << ic 
+  //    << "\t" << theScfRead.scfInfo_read->read.getName() << endl;
+
+
+  if (pos < ic) {
+    scfPos = -1;
+  } else {
+    assert(pos-ic <= fr_longest);
+
+    scfPos = theScfRead.scfInfo_position[pos- ic];
+    //scfPos = theScfRead.scfInfo_position[pos];
+
+    if (scfPos < 0 && question != fhc_MISSING && 
+	question != fhc_UNDERCALL && question != fhc_SYNTACTIC){
+
+      // sollte eigentlich eine Position dasein.... 
+      // wir versuchen zu interpolieren
+
+      if (abs(theScfRead.scfInfo_position[pos - ic + 1] - 
+	      theScfRead.scfInfo_position[pos - ic - 1]) == 2) {
+
+	scfPos = (theScfRead.scfInfo_position[pos - ic + 1] + 
+		  theScfRead.scfInfo_position[pos - ic - 1]) / 2;
+      } else {
+	question = fhc_UNDEFINED;
+      } 
+    }
+    
+  }
+
+
+  oldDBBase = old_base;
+  /*  	      
+  if (question == fhc_MISSING || question == fhc_UNDERCALL) {
+    oldDBBase = GAP_BASE;
+  } else {
+    oldDBBase = old_base;
+  }
+  */
+
+
+  const vector<base_quality_t> &q = myRead->read.getQualities();
+  vector<base_quality_t>::const_iterator Q = q.begin();
+  
+  {
+    int32 qual_pos;
+    if (myRead->direction < 0) {
+      qual_pos = myRead->read.getLenSeq() - 1 - dbPos;
+      //  cout << "Adv -" << (int32)myRead->read.getLenSeq()-1-dbPos << endl;
+    } else {
+      qual_pos = dbPos;
+      //  cout << "Adv + " << dbPos << endl;
+    }
+    if (qual_pos < 0) qual_pos = 0;
+    advance(Q, qual_pos);
+  }
+    
+
+  //cout << "Quality of " << myRead->read.getName() << " at " << dbPos 
+  //     <<  " ScfPos: " << scfPos << " is " << (int)(*Q) << endl;
+
+  theProblem = new afh_Info(myRead, dbPos, scfPos, new_base,
+			    oldDBBase, question); 
+
+  if (theProblem != NULL && Q != q.end()) {
+    theProblem->setOriginalBaseQuality(*Q);
+  }
+
+  return theProblem;
+}
+
+
+
+// *******************************************************
+//    addExtendableReads:       
+//    Search the contig for reads in 'direction' where the 
+//    quality cutoff covers the position dbPos.  
+// *******************************************************
+
+
+bool hypotheses_pool::makeDoubleStranded(Contig &aContig, int32 contigPosVon, 
+				 int32 contigPosBis, bool forward, 
+				 bool reverse, const EDITParameters &p) 
+{
+  const vector<Contig::contigread_t> &allReads = aContig.getContigReads();
+  vector<Contig::contigread_t>::const_iterator I= allReads.begin();
+  scfInfo *aScfInfo;
+
+  int32 umgebung = p.getDoublestrandUmgebung();
+  int32 direction;
+  bool  reads_added = false;
+
+
+  if (!forward) { 
+    if (!reverse) direction = 0; else direction = 1;
+  } else { 
+    direction = -1;
+  }
+
+  while (I != allReads.end()) {
+    int32 relPosVon = contigPosVon - I->offset;
+    int32 relPosBis = contigPosBis - I->offset; 
+    int32 offset = 0;
+    bool  xtend  = false;
+    const Read &R = I->read;
+
+
+    if (I->direction == direction || direction == 0) {
+      // the read is in the desired direction ?
+      // >0 forward read    <0 reverse read  =0 very read       
+
+#ifdef DEBUG_MODE
+                 cout << "->" <<R.getName() << " O: " << I->offset
+      	   << " LC:" << R.getLeftClipoff() << " (" 
+      	   << R.getLSClipoff() << ") " 
+      	   << " RC:" << R.getRightClipoff() << " ("
+      	   << R.getRSClipoff() << ") " 
+      	   << " L:" << R.getLenClippedSeq() << " (" 
+      	   << R.getLenSeq() << ") " <<  "  dbPos:" << contigPosVon 
+      	   << " Direction: " << I->direction <<endl;
+#endif 
+
+      xtend = false;  
+ 
+      if (I->direction > 0) {
+        // forward read in the leftClipOff part?
+
+	if(relPosVon < 0 && relPosVon + R.getLeftClipoff() > 0) {
+	  // can we extend the read? 
+
+	  if ((abs(relPosVon) + umgebung) < R.getLeftExtend() &&
+	      (abs(relPosBis) + umgebung) < R.getLeftExtend()) {
+
+	    xtend = extendRead(aContig, *I, contigPosVon, -relPosVon, 
+	    		       umgebung, offset);    
+	  }
+	}
+
+	// forward read in the rightClipoff part?
+
+
+	if(relPosVon >= (int32)R.getLenClippedSeq() &&
+	   relPosVon < (int32)(R.getLenSeq()-R.getLeftClipoff()) -  umgebung) {
+	  // can we extend the read?
+
+	  if (relPosBis < R.getLenClippedSeq() + R.getRightExtend()) {
+
+	    xtend = extendRead(aContig, *I, contigPosVon, 
+			       relPosBis - R.getLenClippedSeq(), 
+			       umgebung, offset);
+	  }
+	}
+
+      } else {
+	if (relPosVon < 0 && 
+	    relPosVon > (int32(-R.getLenSeq() + R.getRightClipoff()))) {
+	  // reverse read in the left clipoff part?
+	  
+ 	  
+	  if (-relPosVon + umgebung < R.getRightExtend()) {
+
+	    // can we extend the read?  FIXME
+	    xtend = extendRead(aContig, *I, contigPosVon, 
+			       -relPosVon, umgebung, offset);
+	  }
+	}
+
+        if (relPosVon >= (int32)R.getLenClippedSeq() &&
+	    relPosVon < (int32)(R.getLenClippedSeq() 
+				 + R.getLeftClipoff() + umgebung)) {
+	  // reverse read in the right clipoff part?
+
+
+	  if (relPosBis - R.getLenClippedSeq() + 1 < R.getLeftExtend()) {
+	    // can we extend this read?
+	    xtend = extendRead(aContig, *I, contigPosVon, 
+			       relPosVon - R.getLenClippedSeq(), 
+			       umgebung, offset);
+	  }  
+	}
+      }  
+
+
+
+
+      if (xtend) {
+	// We found something to extend
+	char *sequence;
+ 	// sequence will hold the null-terminated part of the sequence from 
+	// contigPosVon to ContigPosBis: [contigPonVon - ContigPosBis] + '\0'
+	sequence = new char [contigPosBis - contigPosVon + 2];
+
+
+#ifdef HYPOTHESES_VERBOSE
+	cout << R.getName() << ": extended Fault Region: (Offset " 
+	     << offset << ")  Direction " << I->direction << endl;
+#endif
+	  
+	
+	aScfInfo = faultRegionFromRead(aContig, *I, I - allReads.begin(),  
+				       contigPosVon - offset, 
+ 				       contigPosBis - offset,
+				       sequence);
+
+	hp_start.addSequence(sequence, *aScfInfo);
+	hp_scfInfo.push_back(*aScfInfo);
+	hp_pool.clear();
+	hp_pool.push_back(hp_start);
+
+	delete aScfInfo;
+	delete [] sequence;
+	reads_added = true;
+
+	// return reads_added;   // FIXME ... nur einen read aufdecken
+      }
+    }   
+    I++;
+  }
+
+  return reads_added;
+}
+
+
+
+int32 hypotheses_pool::locomotion(const fault_region &r) const
+{ 
+   return (r.realSize() - hp_start.realSize());
+}
+
+
+
+// checkPartialSolution
+//    result  1:    all inserts/deletes confirmed; edit with all 
+//                  insert/delete operations - also syntactic!
+//    result  0:    only non ins/del ops confirmed; edit without syntactic
+//    result -1:    mixed confirmed...
+
+int32 hypotheses_pool::checkPartialSolution(fault_region &r) 
+{
+  // When is a partial solution valid? if it does not disturb the alignment!
+  // Disturbing the alignment can be done by 
+  //    - insert base
+  //    - delete base operations.
+  // If we 
+  //  allow only solutions where all or none of the insert/delete 
+  //  operations are confirmed we should be safe.  
+
+  vector<scfInfo>::iterator I;
+  editoperation op;
+  vector<editoperation> edits = r.readEditOperations();
+
+  bool all_confirmed = true;
+  bool all_rejected  = true;
+
+
+  for (uint32 i = 0; i < edits.size(); i++) {
+    op = edits[i];
+
+    if ((op.base_old == fr_fillchar) || (op.base_new == fr_fillchar)) {
+      vector<afh_Info*>::iterator XX = op.readEdits.begin();    
+
+      while (XX != op.readEdits.end()) {
+	all_confirmed = all_confirmed && (*XX)->isConfirmed();
+	all_rejected  = all_rejected  && !(*XX)->isConfirmed();
+
+	XX++;
+      }
+    }
+  }
+
+  if (hp_parameter->isVerbose(3)) {
+    cout << "Checking partial solution: " 
+	 << "all confirmed " << all_confirmed << "  "
+	 << "all rejected  " << all_rejected  << endl;
+  }
+
+  if (!(all_confirmed || all_rejected)) {
+    return -1;
+  } else {
+    if (all_confirmed) return 1;
+    return 0;
+  }
+}
+
+
+
+void hypotheses_pool::setFirstAndLastColumn(char first, char last)
+{
+ hp_start.setColumnToBase(0, first);
+ hp_start.setColumnToBase(hp_start.realSize()-1, last);
+
+ if (hp_pool.size() > 0) {
+   hp_pool.begin()->setColumnToBase(0, first);
+   hp_pool.begin()->setColumnToBase(hp_start.realSize()-1, last);
+ }
+}
+
+
+
diff --git a/src/EdIt/hypothesen.H b/src/EdIt/hypothesen.H
new file mode 100644
index 0000000..cdd86ec
--- /dev/null
+++ b/src/EdIt/hypothesen.H
@@ -0,0 +1,281 @@
+/*
+ * Written by Thomas Pfisterer
+ *
+ * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
+ *   Krebsforschungszentrum, DKFZ Heidelberg) and Thomas Pfisterer
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ *
+ *
+ * hypotheses generation - header file 
+ *
+ * Written by Thomas Pfiserer 
+ * Version 0.2.0       03.09.1998
+ */
+
+#ifndef _edit_hypothesen_H
+#define _edit_hypothesen_H
+
+
+#include "stdinc/defines.H"
+#include "stdinc/stlincludes.H"
+
+//#include <vector>
+//#include <map>
+//#include <list>
+//#include "algo.h"
+
+#include "examine/scf_look.H"
+#include "examine/buffer.H"
+#include "examine/globals.H"
+
+#include "io/scf.H"
+#include "mira/read.H"
+#include "mira/contig.H"
+#include "util/progressindic.H"
+#include "EdIt/parameters.H"
+
+
+// 	$Id$	
+
+// Minimum length for a Contig to be edited
+#define MIN_CONTIG_EDIT_LENGTH 200
+
+
+struct editoperation {
+  int16 sequenceId;
+  int16 position;
+  int16 operation;
+  char  base_old;
+  char  base_new;
+
+  vector<afh_Info*> readEdits;      // FIXME V1
+};
+
+
+
+struct scfInfo {
+  vector <int> scfInfo_position;
+  const  Contig::contigread_t  *scfInfo_read;
+  int32  scfInfo_readId;
+  Contig *scfInfo_contig;
+  char   *scfInfo_name;
+  int32  scfInfo_lcutoff;
+  int32  scfInfo_rcutoff;
+  int32  scfInfo_length;
+  int32  scfInfo_dbpos;
+  int32  scfInfo_sequenceId;
+  bool   scfInfo_confirmed;
+  bool   scfInfo_hidden;
+};
+
+
+class sequenceInfo {
+public:
+  vector<char> si_sequence;
+  int16        si_occurences;    // how often is this sequence in the problem
+  int16        si_lastEditPos;
+  int16        si_insertCount;
+};
+
+
+
+class fault_region
+{
+private:
+  enum { fr_fillchar = '.', fr_gapchar = '*', 
+	 fr_eorchar  = '_', fr_maxsteps = 15 }; 
+  enum { fr_insert = 1, fr_delete = 2, fr_alter = 3, fr_syntactic = 4  };
+
+  cfh_Info scfEditHypotheses;
+  int32  fr_longest;
+  int32  fr_score;           // # pairwise mismatches
+  int32  fr_steps;           // # edit operations
+  int32  fr_solution_score;  // score of a solution
+  bool   fr_has_eor;
+  vector<sequenceInfo>   fr_sequenceList;
+  vector<editoperation>  fr_edits;    
+
+
+  int32 resizeRegion(int32 size);
+  int32 pairwiseMismatch();
+  void  performEditOperationOnRegion(editoperation &edOp);
+  int32 shufflePadInSequence(int32 read_id, int32 pos);
+  int32 checkParameters(const int32 readId, const int32 readPos);
+public:
+  fault_region();
+  ~fault_region();
+  fault_region(fault_region const &other); 
+  const fault_region& operator= (const fault_region &other);
+  void clear();
+  vector<sequenceInfo>::iterator findSequence(const char *target);
+  int32 addSequence(const char *s, scfInfo &aScfInfo);
+  bool  possibleSolution() const;
+  bool  validSolution() const;
+  void  setColumnToBase(int32 col, char base);
+
+  int32 pairwiseMismatchColumn(int32 col);
+
+  void  performOperationsOnReads(vector<scfInfo> hp_scfInfo,
+				const EDITParameters &p, int32 locomotion);
+  int32 insertBase(const int32 readId, const int32 readPos, const char base);
+  int32 deleteBase(const int32 readId, const int32 readPos);
+  int32 alterBase(const int32 readId, const int32 readPos, const char base);
+  char readBase(const int32 readId, const int32 readPos) const;
+  int32 compare(fault_region &fr);
+  int32 readSequenceCount() const;
+  int32 readScore() const;
+  int32 readSolutionScore() const;
+  int32 calcSolutionScore();
+  int32 editCount();
+  bool  isBaseInColumn(int32 col, char aBase);
+  const sequenceInfo& readSequence(int32 sequenceId); 
+  vector<editoperation>& readEditOperations();
+  int32 size() const;
+  int32 realSize() const;
+  
+  void  appendAfh(afh_Info *aAfh) 
+    { scfEditHypotheses.appendAfh(aAfh); }
+
+  cfh_Info& getCfh() 
+    { return scfEditHypotheses; }
+
+  bool  generateAllHypotheses(fault_region &target,
+			      vector<scfInfo> &scf,
+			      // cfh_Info &aHypotheses,
+			      EDITParameters *p);
+
+  afh_Info* createSingleHypotheses(scfInfo &theScfRead, 
+				   const sequenceInfo &s, int32 question, 
+				   char new_base, char old_base, int32 pos);
+  
+  void  shufflePads();
+
+  friend ostream &operator<<(ostream &ostr, fault_region const &i);
+};
+
+
+
+class hypotheses_pool
+{
+private:
+  enum { hp_usesize = 20, hp_poolsize = 30 };
+  enum { fr_fillchar = '.', fr_gapchar = '*', 
+	 fr_eorchar  = '_' }; 
+
+  vector<fault_region>  hp_ready;
+  fault_region          hp_start;
+  vector<fault_region>  hp_pool;
+  vector<scfInfo>       hp_scfInfo;
+  ofstream              logfile;
+  EDITParameters        *hp_parameter;
+
+public:
+  hypotheses_pool(const fault_region startzustand, vector<scfInfo> &si);
+  hypotheses_pool(const fault_region startzustand, vector<scfInfo> &si,
+		  EDITParameters *p);
+  ~hypotheses_pool();
+
+  bool isDoubleStranded(bool& forward, bool &reverse);
+  bool isDoublestrandedOrCoverage(bool& forward, bool &reverse, int32 c);
+  bool usesDifferentChemistry();
+  bool hasSufficientInformation(bool &forward, bool &reverse, 
+				bool useChemistry, int32 minCoverage);
+ 
+  bool  makeDoubleStranded(Contig &aContig, int32 contigPosVon, 
+			  int32 contigPosBis, 
+			  bool forward, bool reverse, 
+			  const EDITParameters &p);
+  void   pushStep(fault_region &fr);
+  void   iterate(fault_region &fr);
+  void   iteratePool();
+  void   iteratePool(int32 anz);
+  void   iterateFirstSolutionPlus(int32 anz);
+  int32  minimalEdits();
+  void   showResult();
+  int32  locomotion(const fault_region &r) const;
+  bool                  createCfhInfoList(EDITParameters &p);
+  vector<fault_region>& getHypothesesList() { return hp_ready; }
+  vector<scfInfo>&      getScfInfo() { return hp_scfInfo; }
+
+  void   setFirstAndLastColumn(char first, char last);
+  int32  checkPartialSolution(fault_region &fr);
+
+  friend ostream &operator<<(ostream &ostr, hypotheses_pool const &i);
+
+};
+
+
+// find the consensus base
+//char calledBase(const Contig::consensus_counts_t &cc);
+
+// find next mismatch in a contig starting from the pos-th base
+deque<Contig::consensus_counts_t>::iterator
+findNextMismatch(const Contig &aContig, int32 &pos, 
+		  deque<Contig::consensus_counts_t> &theConsensus); 
+deque<Contig::consensus_counts_t>::iterator
+findPrevMismatch(const Contig &aContig, int32 &pos, 
+		 deque<Contig::consensus_counts_t> &theConsensus); 
+
+
+// create a fault region for the given contig ranging from the base
+// 'von' to the base 'bis'. returns an initialised hypotheses-pool object.
+hypotheses_pool* createRegion(Contig &aContig, int32 von, int32 bis,
+			      EDITParameters &p);
+
+scfInfo* 
+faultRegionFromComplementRead(const Contig::contigread_t &R, int32 von, int32 bis);
+
+scfInfo* 
+faultRegionFromRead(Contig &aContig, const Contig::contigread_t &R, 
+		    int32 readIndex, int32 von, int32 bis, char *sequence);
+
+
+bool extendRead(const Contig &aContig, const Contig::contigread_t &aRead, 
+		int32 dbPos, int32 anzBases, 
+		int32 umgebung, int32 &offset_to_readpos);
+
+
+
+
+int32 extendFaultRegionRight(const deque<Contig::consensus_counts_t>::iterator POS,
+			   const deque<Contig::consensus_counts_t>::iterator END);
+
+int32 extendFaultRegionLeft(const deque<Contig::consensus_counts_t>::iterator POS,
+			  const deque<Contig::consensus_counts_t>::iterator START);
+
+hypotheses_pool * createFaultRegion(Contig &aContig, int32 von, int32 bis, 
+				     EDITParameters &p);
+ 
+bool examineFaultRegion(Contig &aContig, int32 von, int32 bis, 
+			hypotheses_pool *aPool, EDITParameters &p); 
+
+void findFaultRegionBack(Contig &aContig, EDITParameters &p);
+void editContigBack(Contig &aContig, EDITParameters &p);
+void editTowardsConsensusBack(Contig &aContig, EDITParameters &p);
+void editSmallRegionsBack(Contig &aContig, EDITParameters &p,
+			  int32 von, int32 bis);
+
+int32 scfPosFromDBPos(const int32 pos, const Contig::contigread_t &aRead);
+int32 scfInfo_contigPosFirstBase(scfInfo &si);
+
+
+int32 dbPosFromReadPos(const int32 dbPos, const Contig::contigread_t &cRead);
+int32 readPosFromContigPos(const int32 contigPos, const Contig::contigread_t &cRead);
+
+#endif
diff --git a/src/EdIt/parameters.C b/src/EdIt/parameters.C
new file mode 100644
index 0000000..5b73bb5
--- /dev/null
+++ b/src/EdIt/parameters.C
@@ -0,0 +1,563 @@
+/*
+ * Written by Thomas Pfisterer
+ *
+ * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
+ *   Krebsforschungszentrum, DKFZ Heidelberg) and Thomas Pfisterer
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ *
+ */
+
+#include "EdIt/parameters.H"
+
+
+void EDITParameters::foolCompiler()
+{
+#ifdef __sgi
+  //(void) iostream_init;
+#endif
+}
+
+
+EDITParameters::EDITParameters()
+{
+
+  tag_parameters.tag_insert    = true;
+  tag_parameters.tag_delete    = true;
+  tag_parameters.tag_alter     = true;
+  tag_parameters.tag_asterisk  = true;
+  tag_parameters.tag_consensus = true;
+
+  
+  file_parameters.caf_input   = conditionalStrCpy("EdIt.in.caf");
+  file_parameters.caf_output  = conditionalStrCpy("EdIt.out.caf");
+  file_parameters.log_output  = conditionalStrCpy("EdIt.log");
+  file_parameters.text_output = NULL;
+  file_parameters.html_output = NULL;
+  file_parameters.caf_void = false;
+
+  strand_parameters.make_double_stranded     = true;
+  strand_parameters.doublestrand_machinetype = false;
+  strand_parameters.doublestrand_minscore = 85;
+  strand_parameters.doublestrand_umgebung = 2;
+  strand_parameters.mincoverage_single = 4;
+
+  eval_parameters.min_solutions_checked  = 3;
+  eval_parameters.max_score_over_best    = 20;   
+  eval_parameters.confirmation_threshold = 0.6;
+
+  // eval_parameters.strict_evaluation      = true;
+  eval_parameters.strict_evaluation      = false; 
+  eval_parameters.edit_quality_below     = -1;
+
+  setEditByColumn(false);
+  setEditByRegion(true);
+  setEditBySmallRegions(false);
+
+  command_edit   = true;   // Perform edit operations
+  command_eval   = true;   // Evaluate hypotheses
+  command_hypo   = true;   // Generate hypotheses
+
+  eval_range.contig_id_von = -1;     // for all Contigs
+  eval_range.contig_id_bis = -1;     // for all Contigs
+  eval_range.contig_pos_von = -1;    // for all bases
+  eval_range.contig_pos_bis = -1;    // for all bases
+
+  verbose       = 0;
+  show_progress = true;
+  debug         = 0;
+
+  help = false;   // print usage() instead of doing something
+
+  log_cleared=false;
+}
+
+
+EDITParameters::~EDITParameters() 
+{
+  delete [] file_parameters.caf_input;
+  delete [] file_parameters.caf_output;
+  delete [] file_parameters.log_output;
+  delete [] file_parameters.html_output;
+  delete [] file_parameters.text_output;
+}
+
+
+// return 0 if ok
+int32 EDITParameters::setTagParams(ep_tag_parameters & tp)
+{
+  tag_parameters = tp;
+  return 0;
+}
+
+
+ep_tag_parameters const & EDITParameters::getTagParams() const
+{
+  return tag_parameters;
+}
+
+
+
+void EDITParameters::logOperation(char *s) const 
+{
+  static int32 count = 0;
+  ofstream x;
+
+  if (file_parameters.caf_void == false) {
+    if(!log_cleared){
+      x.open(file_parameters.log_output);
+      x.close();
+      bool & lc=const_cast<bool &>(log_cleared);
+      lc=true;
+    }
+    x.open(file_parameters.log_output, ios::app);
+    x << ++count << "\t" << s << endl;
+    x.close();
+  }
+}
+
+
+
+
+void EDITParameters::cmdLine2Stream(int argc, char **argv)
+{
+  stringstream tss;
+
+  for(int32 i=1; i<argc; i++){
+    //cout << "Doing " << i << "\t" << argv[i] << endl;
+    tss << argv[i] << "-=BEGIN0=-";
+  }
+
+  parse(tss);
+}
+
+
+int32 EDITParameters::gimmeAnInt(FlexLexer * lexer)
+{
+  if(lexer->yylex() != EP_INT){
+    cout << "Expected an int";
+  }
+  return atoi(lexer->YYText());
+}
+
+
+int32 EDITParameters::getConAnalyseMode(FlexLexer * lexer)
+{
+  int32 tmp=lexer->yylex();
+  if(tmp==666){
+    cout << "Non recognised am option";
+    tmp=0;
+  }
+  return tmp;
+}
+
+
+bool EDITParameters::doContig(int32 id) 
+{
+  // evaluate all contigs
+  if (eval_range.contig_id_von < 0) return true;
+
+  // evaluate contigs starting with...
+  if (id >= eval_range.contig_id_von) {
+    if (eval_range.contig_id_bis < 0) {
+      return true;
+    } else {
+      return (id <= eval_range.contig_id_bis);
+    }
+  } else {
+    return false;
+  }
+}
+
+
+void EDITParameters::setFilenames(char *input, char *output, char *logfile)
+{
+  if (input != NULL) {
+    delete [] file_parameters.caf_input;
+    file_parameters.caf_input = new char[strlen(input) + 1];
+    strcpy(file_parameters.caf_input, input);
+  }
+  
+  if (output != NULL) {
+    delete [] file_parameters.caf_output;
+    file_parameters.caf_output = new char[strlen(output) + 1];
+    strcpy(file_parameters.caf_output, output);
+  }
+
+  if (logfile != NULL) {
+    delete [] file_parameters.log_output;
+    file_parameters.log_output = new char[strlen(logfile) + 1];
+    strcpy(file_parameters.log_output, logfile);
+  } 
+    
+  file_parameters.caf_void = (logfile == NULL);
+}
+
+
+
+void EDITParameters::parse(istream & is)
+{
+  FlexLexer* lexer = new EPFlexLexer(&is);
+
+  int yyretcode=-1;
+
+  while(yyretcode!=0){
+    yyretcode=lexer->yylex();
+
+    switch(yyretcode){
+    case 0: break;                              // do nothing, eof
+
+    case EP_ALTER_TAG :{
+      tag_parameters.tag_alter = ((gimmeAnInt(lexer) == 1));
+      cout << "PARAMETER: alter tag set to " 
+	   << tag_parameters.tag_alter << endl;
+      break;
+    }
+
+    case EP_DELETE_TAG: {
+      tag_parameters.tag_delete = ((gimmeAnInt(lexer) == 1));
+      cout << "PARAMETER: delete tag set to " 
+	   << tag_parameters.tag_alter << endl;
+      break;
+    }
+ 
+    case EP_INSERT_TAG: {
+      tag_parameters.tag_insert = ((gimmeAnInt(lexer) == 1));
+      cout << "PARAMETER: insert tag set to " 
+	   << tag_parameters.tag_alter << endl;
+      break;
+    }
+
+    case EP_CONSENSUS_TAG: {
+      tag_parameters.tag_consensus = ((gimmeAnInt(lexer) == 1));
+      cout << "PARAMETER: consensus tag set to "
+	   << tag_parameters.tag_consensus << endl;
+      break;
+    }
+
+    case EP_VERBOSE: {
+      verbose = gimmeAnInt(lexer);
+      cout << "PARAMETER: verbose mode set to " << verbose << endl;
+#ifdef RUNONLY
+      cout << "           compiled as run-only; some output ignored" << endl;
+#endif
+      break;
+    }
+
+    case EP_DEBUG: {
+      debug = ((gimmeAnInt(lexer) == 1));
+      cout << "PARAMETER: debug mode set to " << debug << endl;
+      break;
+    }
+
+    case EP_ALL_TAGS: {
+      tag_parameters.tag_insert    = true;
+      tag_parameters.tag_delete    = true;
+      tag_parameters.tag_alter     = true;
+      tag_parameters.tag_consensus = true;
+      cout << "PARAMETER: insert, delete, alter, consensus tag set to 1." 
+	   << endl;
+      break;
+    }
+
+   case EP_NO_TAGS: {
+      tag_parameters.tag_insert    = false;
+      tag_parameters.tag_delete    = false;
+      tag_parameters.tag_alter     = false;
+      tag_parameters.tag_consensus = false;
+      cout << "PARAMETER: insert, delete, alter, consensus tag set to 0." 
+	   << endl;
+      break;
+    }
+
+    case EP_DELETE_ASTERISK: {
+      tag_parameters.tag_asterisk = ((gimmeAnInt(lexer) == 1));
+      cout << "PARAMETER: delete asterisk columns set to " 
+	   << tag_parameters.tag_asterisk << endl;
+      break;
+    }
+
+    case EP_caf_in_file: {
+      delete [] file_parameters.caf_input;
+      file_parameters.caf_input = new char[lexer->YYLeng() + 1];
+      strcpy(file_parameters.caf_input, lexer->YYText());
+      cout << "PARAMETER: input file : " 
+	   << file_parameters.caf_input << endl;
+      break;
+    }
+
+    case EP_caf_out_file: {
+      int32 l;
+
+      delete [] file_parameters.caf_output;
+      file_parameters.caf_output = new char[lexer->YYLeng() + 1];
+      strcpy(file_parameters.caf_output, lexer->YYText());
+      cout << "PARAMETER: output file : " 
+	   << file_parameters.caf_output << endl;
+      break;
+    }
+
+   case EP_log_out_file: {
+      int32 l;
+
+      delete [] file_parameters.log_output;
+      file_parameters.log_output = new char[lexer->YYLeng() + 1];
+      strcpy(file_parameters.log_output, lexer->YYText());
+      cout << "PARAMETER: log file : " 
+	   << file_parameters.log_output << endl;
+      break;
+    }
+
+    case EP_html_out_file: {
+      int32 l;
+
+      delete [] file_parameters.html_output;
+      file_parameters.html_output = new char[lexer->YYLeng() + 1];
+      strcpy(file_parameters.html_output, lexer->YYText());
+      cout << "PARAMETER: html file : " 
+	   << file_parameters.html_output << endl;
+      break;
+    }
+
+
+    case EP_text_out_file: {
+      int32 l;
+
+      delete [] file_parameters.text_output;
+      file_parameters.text_output = new char[lexer->YYLeng() + 1];
+      strcpy(file_parameters.text_output, lexer->YYText());
+      cout << "PARAMETER: text file : " 
+	   << file_parameters.text_output << endl;
+      break;
+    }
+
+
+    case EP_outfile_void: {
+      file_parameters.caf_void = ((gimmeAnInt(lexer) == 1));
+      cout << "PARAMETER: create caf output: " 
+	   << file_parameters.caf_void << endl;
+      break;
+    }
+
+
+    case EP_make_double: {
+      strand_parameters.make_double_stranded = ((gimmeAnInt(lexer) == 1));
+      cout << "PARAMETER: make double-stranded " 
+	   << strand_parameters.make_double_stranded << endl;
+      break;
+    }     
+
+    case EP_use_machinetype: {
+      strand_parameters.doublestrand_machinetype = ((gimmeAnInt(lexer) == 1));
+      cout << "PARAMETER: make double-stranded if different sequencers "
+	   << strand_parameters.doublestrand_machinetype << endl;
+      break;
+    }
+
+    case EP_doublestrand_minscore: {
+      int32 score =  gimmeAnInt(lexer);
+      if (score <= 100 && score >= 0) {
+	strand_parameters.doublestrand_minscore = score;
+      } else {
+	cerr << "ERROR: minscore doublestranding outside [0,100]!\n";
+      }
+      break;
+    }
+
+    case EP_mincoverage_single: {
+      int32 coverage = gimmeAnInt(lexer);
+      if (coverage <= 100 && coverage >= -1) {
+	strand_parameters.mincoverage_single = coverage;
+	cout << "PARAMETER: minimum coverage for single stranded regions: "
+	     << coverage << endl;
+      } else {
+	cerr << "ERROR: parameter 'cover' outside [-1,100]!\n";
+      }
+      break;
+    }
+
+    case EP_ANID: {
+      cout <<  "PARAMETER: ERROR - unknown option: " 
+	   << lexer->YYText() <<endl;
+      cout.flush();
+      break;
+    }
+
+    case EP_DO_NOP: {
+      cout << "PARAMETER: do nothing (read the caf-file)" << endl;
+      command_hypo = command_eval = command_edit = false;
+      break;
+    }
+
+    case EP_DO_ALL: {
+      cout << "PARAMETER: do all (default)" << endl;
+      command_hypo = command_eval = command_edit = true; 
+      break;
+    }
+
+    case EP_DO_HYPO: {
+      cout << "PARAMETER: generate hypotheses only (no eval, no edit)" 
+	   << endl; 
+      command_hypo = true;
+      command_eval = command_edit = false;
+      break;
+    }
+
+    case EP_DO_EVAL: {
+      cout << "PARAMETER: evaluate hypotheses but do not edit" << endl;
+      command_hypo = command_eval = true;
+      command_edit = false;
+      break;
+    }
+
+    case EP_DO_CONTIG: {
+      eval_range.contig_id_von = gimmeAnInt(lexer);
+      eval_range.contig_id_bis = eval_range.contig_id_von ;
+      
+      cout << "PARAMETER: edit single contig - " 
+	   << eval_range.contig_id_von << endl;
+
+      setDoAll();
+
+      break;
+    }
+
+    case EP_DO_RANGE: {
+      eval_range.contig_pos_von = gimmeAnInt(lexer);
+      eval_range.contig_pos_bis = gimmeAnInt(lexer) ;
+                 
+      cout << "PARAMETER: eval range von " 
+	   << eval_range.contig_pos_von << " - "
+	   << eval_range.contig_pos_bis << endl;
+
+      break;
+    }
+
+    case EP_DO_STRICT: {
+      cout << "PARAMETER: strict evaluation ON" << endl;
+      eval_parameters.strict_evaluation = true;
+      break;
+    }
+
+    case EP_DO_NOSTRICT: {
+      cout << "PARAMETER: strict evaluation OFF" << endl;
+      eval_parameters.strict_evaluation = false;
+      break;
+    }
+
+    case EP_DO_THRESHOLD: {
+      setConfirmationThreshold((float)(gimmeAnInt(lexer))/100.0) ;
+      cout << "PARAMETER: confirmation threshold " 
+	   << getConfirmationThreshold() << endl;
+      break;
+    }
+      
+    case EP_DO_LOWQUAL: {
+      setEditLowQualityBases(gimmeAnInt(lexer));
+      cout << "PARAMETER: edit if base quality below " 
+	   << getLowQualityThreshold() << endl;
+      break;
+    }
+
+    case EP_DO_REGIONS: {
+      setEditByRegion(gimmeAnInt(lexer) != 0);
+      cout << "PARAMETER: edit by fault region is " 
+	   << getEditByRegion() << endl;
+      break;
+    }
+
+    case EP_DO_COLUMNS: {
+      setEditByColumn(gimmeAnInt(lexer) != 0);
+      cout << "PARAMETER: edit by column is " 
+	   << getEditByColumn() << endl;
+      break;
+    }
+
+    case EP_DO_SMALL_REGIONS: {
+      setEditBySmallRegions(gimmeAnInt(lexer) != 0);
+      cout << "PARAMETER: edit by small regions is " 
+	   << getEditBySmallRegions() << endl;
+      break;
+    }
+
+    case EP_HELP: {
+      setHelp(true);
+      break;
+    }
+
+    default:{
+	cout <<  "PARAMETER: ERROR - recognised but not caught: " 
+	     << lexer->YYText() <<endl;
+	cout.flush();
+    }
+    }
+    
+  }
+
+  delete lexer;
+
+}
+
+
+
+ostream &operator<<(ostream &ostr, EDITParameters const &i)
+{
+  ostr << "\nEdIt parameters : " << endl;
+  ostr << "  Edit by:";
+
+  if (i.getEditByRegion()) { ostr << " 'regions'"; }
+  if (i.getEditBySmallRegions()) { ostr << " 'small regions'"; }
+  if (i.getEditByColumn()) { ostr << "'columns'"; }
+  ostr << "." << endl;
+
+  ostr << "  Edit single contig: " << i.eval_range.contig_id_von << endl;
+  ostr << "  Check at least " << i.eval_parameters.min_solutions_checked 
+       << " solutions until " << i.eval_parameters.max_score_over_best 
+       << " % over best score." << endl;
+
+  ostr << "  Threshold for network evaluation: " 
+       << i.eval_parameters.confirmation_threshold 
+       << "." << endl;
+  ostr << "  Edit quality below " 
+       << i.eval_parameters.edit_quality_below << endl;
+  ostr << "  Strict evaluation :" ;
+  if (i.eval_parameters.strict_evaluation) {
+    ostr << " YES."  << endl;
+  } else {
+    ostr << " NO." << endl;
+  }
+
+  ostr << "  Tags : ";
+  if (i.tag_parameters.tag_insert)    { ostr << " 'insert'"; }
+  if (i.tag_parameters.tag_delete)    { ostr << " 'delete'"; }
+  if (i.tag_parameters.tag_alter)     { ostr << " 'alter'"; }
+  if (i.tag_parameters.tag_consensus) { ostr << " 'consensus'"; }
+  if (i.tag_parameters.tag_asterisk)  { ostr << " 'asterisk'"; }
+  ostr << "." << endl;
+
+  ostr << "  Files: ";
+  ostr << " " << i.file_parameters.caf_input << " ==> " 
+       << i.file_parameters.caf_output 
+       << "     log: " << i.file_parameters.log_output << endl;
+
+  ostr << endl;
+  return ostr;
+}
+
+
+
diff --git a/src/EdIt/parameters.H b/src/EdIt/parameters.H
new file mode 100644
index 0000000..ed239bc
--- /dev/null
+++ b/src/EdIt/parameters.H
@@ -0,0 +1,307 @@
+/*
+ * Written by Thomas Pfisterer
+ *
+ * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
+ *   Krebsforschungszentrum, DKFZ Heidelberg) and Thomas Pfisterer
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ *
+ */
+
+
+#ifndef _edit_parameters_H
+#define _edit_parameters_H
+
+#include "stdinc/defines.H"
+#include "stdinc/stlincludes.H"
+
+#include <stdlib.h>
+
+#include "errorhandling/errorhandling.H"
+#include "util/misc.H"
+
+#include <sstream>
+
+#include <fstream>
+//#include <algo.h>                     // STL min max template
+#include "EdIt/parameters_tokens.h"
+
+#undef yyFlexLexer
+#define yyFlexLexer EPFlexLexer
+#include <FlexLexer.h>
+
+
+
+// 	$Id$	
+
+
+
+struct ep_tag_parameters
+{
+  bool tag_alter;
+  bool tag_insert;
+  bool tag_delete;
+  bool tag_asterisk;
+  bool tag_consensus;
+};
+
+
+struct ep_file_parameters
+{
+  char *caf_input;
+  char *caf_output;
+  char *log_output;
+  char *text_output;
+  char *html_output;
+  bool caf_void;
+};
+
+
+
+struct ep_strand_parameters
+{
+  bool  make_double_stranded;
+  bool  doublestrand_machinetype;   // verschiedene sequenziermaschinen = doublestranded
+  int32 doublestrand_minscore;
+  int32 doublestrand_umgebung;
+  int32 mincoverage_single;
+};
+
+
+struct ep_evaluation_parameters
+{
+  int32  min_solutions_checked;    // minimum number of solutions tested 
+  // threshold: evaluate solutions if their score is less than x(%) over 
+  // higher than the score of the best solution  
+  int32  max_score_over_best;      
+  float  confirmation_threshold;   // KNN result threshold to confirm hypo.
+  bool   strict_evaluation;        // Edit only when completely confirmed. 
+  // Edit all bases below this quality value even without trace confirmation
+  // if set to -1 (default) no automatic editing of low quality bases is done
+  int32  edit_quality_below;          
+  bool   edit_by_columns;
+  bool   edit_by_regions;
+  bool   edit_by_small_regions;
+};
+
+
+
+struct ep_evaluation_range
+{
+  int32 contig_id_von;          // edit contigs starting from 
+  int32 contig_id_bis;          // until... 
+  int32 contig_len_von;         // edit contigs longer than...
+  int32 contig_len_bis;         //              shorter than...
+  int32 contig_pos_von;         // edit contig between 
+  int32 contig_pos_bis;         //              and...
+};
+
+
+
+class EDITParameters
+{
+private:
+
+  ep_tag_parameters          tag_parameters;
+  ep_file_parameters         file_parameters;
+  ep_strand_parameters       strand_parameters;
+  ep_evaluation_parameters   eval_parameters;
+  ep_evaluation_range        eval_range;
+
+  bool  command_hypo;
+  bool  command_eval;
+  bool  command_edit;
+
+  int32 verbose;
+  bool  show_progress;
+  bool  debug;
+
+  bool  log_cleared;
+
+  bool  help;    // parameter "help" was set
+
+  //Functions
+private:
+  void  foolCompiler();
+  int32 gimmeAnInt(FlexLexer * lexer);
+  int32 getConAnalyseMode(FlexLexer * lexer);
+  
+public:
+  EDITParameters();
+  ~EDITParameters();
+
+  ep_tag_parameters  const & getTagParams() const ;
+
+  void cmdLine2Stream(int argc, char **argv);
+  void parse(istream & is);
+
+  int32 setTagParams(ep_tag_parameters & ap);
+  void  logOperation(char *s) const;
+
+  void  setFilenames(char *input, char *output, char *logfile);
+  float getConfirmationThreshold() const 
+    { return eval_parameters.confirmation_threshold; }
+  void  setConfirmationThreshold(const float f) 
+    { eval_parameters.confirmation_threshold = f; }
+  bool getStrictEvaluation()
+    { return eval_parameters.strict_evaluation; }
+  void  setStrictEvaluation(const bool mode)
+    { eval_parameters.strict_evaluation = mode; }
+  bool  getEditLowQualityBases()
+    { return (eval_parameters.edit_quality_below > 0); }
+  int32 getLowQualityThreshold()
+    { return eval_parameters.edit_quality_below; }
+  void  setEditLowQualityBases(int32 quality_threshold)
+    { eval_parameters.edit_quality_below = quality_threshold; }
+  bool  getEditByRegion() const 
+    { return eval_parameters.edit_by_regions; }
+  void  setEditByRegion(bool b)
+    { eval_parameters.edit_by_regions = b; }
+  bool  getEditByColumn() const
+    { return eval_parameters.edit_by_columns; } 
+  void  setEditByColumn(bool b)
+    { eval_parameters.edit_by_columns = b; }
+  bool  getEditBySmallRegions() const   
+    { return eval_parameters.edit_by_small_regions; } 
+  void  setEditBySmallRegions(bool b)
+    { eval_parameters.edit_by_small_regions = b; }
+
+  bool   tagInsertOperations() const 
+    { return tag_parameters.tag_insert; };
+  bool   tagDeleteOperations() const
+    { return tag_parameters.tag_delete; };
+  bool   tagAlterOperations() const
+    { return tag_parameters.tag_alter; };
+  bool   tagDeleteAsteriskColumns() const
+    { return tag_parameters.tag_asterisk; };
+  bool   tagConsensus() const
+    { return tag_parameters.tag_consensus; };
+
+  char * getCafInputFileName()  const 
+    { return file_parameters.caf_input; };
+  char * getCafOutputFileName() const 
+    { return file_parameters.caf_output; };
+  bool   createCafOutput() const
+    { return file_parameters.caf_void == false; }
+  bool   createHtmlOutput() const
+    { return file_parameters.html_output != NULL; }
+  char*  getHtmlOutputFileName() const
+    { return file_parameters.html_output; }
+  bool   createTextOutput() const
+    { return file_parameters.text_output != NULL; }
+  char*  getTextOutputFileName() const
+    { return file_parameters.text_output; }
+
+  bool   makeDoubleStranded() const  
+    { return strand_parameters.make_double_stranded; };
+  void   makeDoubleStranded(const bool ds) 
+    { strand_parameters.make_double_stranded = ds; };
+  int32  getDoubleStrandMinScore() const
+    { return strand_parameters.doublestrand_minscore; };
+  int32  getDoublestrandUmgebung() const
+    { return strand_parameters.doublestrand_umgebung; };
+  int32  getMinCoverage() const
+    { return strand_parameters.mincoverage_single; };
+
+  int32  getMinSolutionsChecked() const
+    { return eval_parameters.min_solutions_checked; };
+  int32  getMaxScoreOverBest() const
+    { return eval_parameters.max_score_over_best; };
+
+  bool doSomething() const
+    { return command_hypo == true; }
+  bool doHypo() const
+    { return command_hypo == true; }
+  bool doEval() const
+    { return command_eval == true; }
+  bool doEdit() const 
+    { return command_edit == true; }
+
+
+  bool  doContig(int32 id);
+  int32 evalAt(int32 pos)
+    { 
+      if (eval_range.contig_pos_von == -1) return true;
+      return (pos >= eval_range.contig_pos_von && 
+	      pos <= eval_range.contig_pos_bis);
+    }
+  void  setEvalRange(int32 pos_von, int32 pos_bis)
+    {
+      eval_range.contig_pos_von = pos_von;
+      eval_range.contig_pos_bis = pos_bis;
+    }
+
+  bool isVerbose() const
+    { return verbose > 0; }
+
+  bool isVerbose(int32 i) const
+    { return verbose > i; }
+
+  bool isDebug() const
+    { return debug == true; }
+
+  void setVerbose(bool isitVerbose)
+    { if (isitVerbose) { verbose = 1; } else { verbose = 0; }}
+
+  void setVerbose(int32 verbmode)
+    { verbose = verbmode; } 
+
+  void setShowProgress(bool b)
+    { show_progress = b; }
+
+  bool getShowProgress()
+    { return show_progress; }
+
+
+
+  void setDoNothing() {
+    command_hypo = false; 
+    command_eval = false;
+    command_edit = false;
+  }
+
+  void setDoHypo() {
+    command_hypo = true; 
+    command_eval = true;
+    command_edit = false;
+  }
+
+  void setDoEval() {
+    command_hypo = true; 
+    command_eval = true;
+    command_edit = false;
+  }
+
+  void setDoAll() {
+    command_hypo = true; 
+    command_eval = true;
+    command_edit = true;
+  }
+
+  bool getHelp() { return help; }
+  void setHelp(bool h) { help = h; }
+
+  friend ostream &operator<<(ostream &ostr, EDITParameters const &i);
+};
+
+#endif
+
+
+
+
+
diff --git a/src/EdIt/parameters_flexer.cc b/src/EdIt/parameters_flexer.cc
new file mode 100644
index 0000000..c64d67d
--- /dev/null
+++ b/src/EdIt/parameters_flexer.cc
@@ -0,0 +1,2106 @@
+#line 2 "parameters_flexer.cc"
+
+#line 4 "parameters_flexer.cc"
+
+#define  YY_INT_ALIGNED short int
+
+/* A lexical scanner generated by flex */
+
+#define FLEX_SCANNER
+#define YY_FLEX_MAJOR_VERSION 2
+#define YY_FLEX_MINOR_VERSION 5
+#define YY_FLEX_SUBMINOR_VERSION 35
+#if YY_FLEX_SUBMINOR_VERSION > 0
+#define FLEX_BETA
+#endif
+
+    /* The c++ scanner is a mess. The FlexLexer.h header file relies on the
+     * following macro. This is required in order to pass the c++-multiple-scanners
+     * test in the regression suite. We get reports that it breaks inheritance.
+     * We will address this in a future release of flex, or omit the C++ scanner
+     * altogether.
+     */
+    #define yyFlexLexer EPFlexLexer
+
+/* First, we deal with  platform-specific or compiler-specific issues. */
+
+/* begin standard C headers. */
+
+/* end standard C headers. */
+
+/* flex integer type definitions */
+
+#ifndef FLEXINT_H
+#define FLEXINT_H
+
+/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
+
+#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+
+/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
+ * if you want the limit (max/min) macros for int types. 
+ */
+#ifndef __STDC_LIMIT_MACROS
+#define __STDC_LIMIT_MACROS 1
+#endif
+
+#include <inttypes.h>
+typedef int8_t flex_int8_t;
+typedef uint8_t flex_uint8_t;
+typedef int16_t flex_int16_t;
+typedef uint16_t flex_uint16_t;
+typedef int32_t flex_int32_t;
+typedef uint32_t flex_uint32_t;
+#else
+typedef signed char flex_int8_t;
+typedef short int flex_int16_t;
+typedef int flex_int32_t;
+typedef unsigned char flex_uint8_t; 
+typedef unsigned short int flex_uint16_t;
+typedef unsigned int flex_uint32_t;
+
+/* Limits of integral types. */
+#ifndef INT8_MIN
+#define INT8_MIN               (-128)
+#endif
+#ifndef INT16_MIN
+#define INT16_MIN              (-32767-1)
+#endif
+#ifndef INT32_MIN
+#define INT32_MIN              (-2147483647-1)
+#endif
+#ifndef INT8_MAX
+#define INT8_MAX               (127)
+#endif
+#ifndef INT16_MAX
+#define INT16_MAX              (32767)
+#endif
+#ifndef INT32_MAX
+#define INT32_MAX              (2147483647)
+#endif
+#ifndef UINT8_MAX
+#define UINT8_MAX              (255U)
+#endif
+#ifndef UINT16_MAX
+#define UINT16_MAX             (65535U)
+#endif
+#ifndef UINT32_MAX
+#define UINT32_MAX             (4294967295U)
+#endif
+
+#endif /* ! C99 */
+
+#endif /* ! FLEXINT_H */
+
+/* begin standard C++ headers. */
+#include <iostream> 
+#include <errno.h>
+#include <cstdlib>
+#include <cstdio>
+#include <cstring>
+/* end standard C++ headers. */
+
+#ifdef __cplusplus
+
+/* The "const" storage-class-modifier is valid. */
+#define YY_USE_CONST
+
+#else	/* ! __cplusplus */
+
+/* C99 requires __STDC__ to be defined as 1. */
+#if defined (__STDC__)
+
+#define YY_USE_CONST
+
+#endif	/* defined (__STDC__) */
+#endif	/* ! __cplusplus */
+
+#ifdef YY_USE_CONST
+#define yyconst const
+#else
+#define yyconst
+#endif
+
+/* Returned upon end-of-file. */
+#define YY_NULL 0
+
+/* Promotes a possibly negative, possibly signed char to an unsigned
+ * integer for use as an array index.  If the signed char is negative,
+ * we want to instead treat it as an 8-bit unsigned char, hence the
+ * double cast.
+ */
+#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
+
+/* Enter a start condition.  This macro really ought to take a parameter,
+ * but we do it the disgusting crufty way forced on us by the ()-less
+ * definition of BEGIN.
+ */
+#define BEGIN (yy_start) = 1 + 2 *
+
+/* Translate the current start state into a value that can be later handed
+ * to BEGIN to return to the state.  The YYSTATE alias is for lex
+ * compatibility.
+ */
+#define YY_START (((yy_start) - 1) / 2)
+#define YYSTATE YY_START
+
+/* Action number for EOF rule of a given start state. */
+#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
+
+/* Special action meaning "start processing a new file". */
+#define YY_NEW_FILE yyrestart( yyin  )
+
+#define YY_END_OF_BUFFER_CHAR 0
+
+/* Size of default input buffer. */
+#ifndef YY_BUF_SIZE
+#ifdef __ia64__
+/* On IA-64, the buffer size is 16k, not 8k.
+ * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
+ * Ditto for the __ia64__ case accordingly.
+ */
+#define YY_BUF_SIZE 32768
+#else
+#define YY_BUF_SIZE 16384
+#endif /* __ia64__ */
+#endif
+
+/* The state buf must be large enough to hold one state per character in the main buffer.
+ */
+#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
+
+#ifndef YY_TYPEDEF_YY_BUFFER_STATE
+#define YY_TYPEDEF_YY_BUFFER_STATE
+typedef struct yy_buffer_state *YY_BUFFER_STATE;
+#endif
+
+extern int yyleng;
+
+#define EOB_ACT_CONTINUE_SCAN 0
+#define EOB_ACT_END_OF_FILE 1
+#define EOB_ACT_LAST_MATCH 2
+
+    #define YY_LESS_LINENO(n)
+    
+/* Return all but the first "n" matched characters back to the input stream. */
+#define yyless(n) \
+	do \
+		{ \
+		/* Undo effects of setting up yytext. */ \
+        int yyless_macro_arg = (n); \
+        YY_LESS_LINENO(yyless_macro_arg);\
+		*yy_cp = (yy_hold_char); \
+		YY_RESTORE_YY_MORE_OFFSET \
+		(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
+		YY_DO_BEFORE_ACTION; /* set up yytext again */ \
+		} \
+	while ( 0 )
+
+#define unput(c) yyunput( c, (yytext_ptr)  )
+
+#ifndef YY_TYPEDEF_YY_SIZE_T
+#define YY_TYPEDEF_YY_SIZE_T
+typedef size_t yy_size_t;
+#endif
+
+#ifndef YY_STRUCT_YY_BUFFER_STATE
+#define YY_STRUCT_YY_BUFFER_STATE
+struct yy_buffer_state
+	{
+
+	std::istream* yy_input_file;
+
+	char *yy_ch_buf;		/* input buffer */
+	char *yy_buf_pos;		/* current position in input buffer */
+
+	/* Size of input buffer in bytes, not including room for EOB
+	 * characters.
+	 */
+	yy_size_t yy_buf_size;
+
+	/* Number of characters read into yy_ch_buf, not including EOB
+	 * characters.
+	 */
+	int yy_n_chars;
+
+	/* Whether we "own" the buffer - i.e., we know we created it,
+	 * and can realloc() it to grow it, and should free() it to
+	 * delete it.
+	 */
+	int yy_is_our_buffer;
+
+	/* Whether this is an "interactive" input source; if so, and
+	 * if we're using stdio for input, then we want to use getc()
+	 * instead of fread(), to make sure we stop fetching input after
+	 * each newline.
+	 */
+	int yy_is_interactive;
+
+	/* Whether we're considered to be at the beginning of a line.
+	 * If so, '^' rules will be active on the next match, otherwise
+	 * not.
+	 */
+	int yy_at_bol;
+
+    int yy_bs_lineno; /**< The line count. */
+    int yy_bs_column; /**< The column count. */
+    
+	/* Whether to try to fill the input buffer when we reach the
+	 * end of it.
+	 */
+	int yy_fill_buffer;
+
+	int yy_buffer_status;
+
+#define YY_BUFFER_NEW 0
+#define YY_BUFFER_NORMAL 1
+	/* When an EOF's been seen but there's still some text to process
+	 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
+	 * shouldn't try reading from the input source any more.  We might
+	 * still have a bunch of tokens to match, though, because of
+	 * possible backing-up.
+	 *
+	 * When we actually see the EOF, we change the status to "new"
+	 * (via yyrestart()), so that the user can continue scanning by
+	 * just pointing yyin at a new input file.
+	 */
+#define YY_BUFFER_EOF_PENDING 2
+
+	};
+#endif /* !YY_STRUCT_YY_BUFFER_STATE */
+
+/* We provide macros for accessing buffer states in case in the
+ * future we want to put the buffer states in a more general
+ * "scanner state".
+ *
+ * Returns the top of the stack, or NULL.
+ */
+#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
+                          ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
+                          : NULL)
+
+/* Same as previous macro, but useful when we know that the buffer stack is not
+ * NULL or when we need an lvalue. For internal use only.
+ */
+#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
+
+void *EPalloc (yy_size_t  );
+void *EPrealloc (void *,yy_size_t  );
+void EPfree (void *  );
+
+#define yy_new_buffer yy_create_buffer
+
+#define yy_set_interactive(is_interactive) \
+	{ \
+	if ( ! YY_CURRENT_BUFFER ){ \
+        yyensure_buffer_stack (); \
+		YY_CURRENT_BUFFER_LVALUE =    \
+            yy_create_buffer( yyin, YY_BUF_SIZE ); \
+	} \
+	YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
+	}
+
+#define yy_set_bol(at_bol) \
+	{ \
+	if ( ! YY_CURRENT_BUFFER ){\
+        yyensure_buffer_stack (); \
+		YY_CURRENT_BUFFER_LVALUE =    \
+            yy_create_buffer( yyin, YY_BUF_SIZE ); \
+	} \
+	YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
+	}
+
+#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
+
+/* Begin user sect3 */
+#define YY_SKIP_YYWRAP
+
+typedef unsigned char YY_CHAR;
+
+#define yytext_ptr yytext
+#define YY_INTERACTIVE
+
+#include <FlexLexer.h>
+
+int yyFlexLexer::yywrap() { return 1; }
+
+/* Done after the current pattern has been matched and before the
+ * corresponding action - sets up yytext.
+ */
+#define YY_DO_BEFORE_ACTION \
+	(yytext_ptr) = yy_bp; \
+	yyleng = (size_t) (yy_cp - yy_bp); \
+	(yy_hold_char) = *yy_cp; \
+	*yy_cp = '\0'; \
+	(yy_c_buf_p) = yy_cp;
+
+#define YY_NUM_RULES 75
+#define YY_END_OF_BUFFER 76
+/* This struct is not used in this scanner,
+   but its presence is necessary. */
+struct yy_trans_info
+	{
+	flex_int32_t yy_verify;
+	flex_int32_t yy_nxt;
+	};
+static yyconst flex_int16_t yy_accept[277] =
+    {   0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,   76,   75,   74,   75,   75,   71,
+       72,   73,   69,   69,   69,   69,   69,   69,   20,   26,
+       24,   22,   28,   30,   40,   38,   31,   31,   31,   32,
+       32,   32,   33,   33,   33,   34,   34,   34,   35,   35,
+       35,   49,   45,   47,   69,   69,   69,   69,   69,   69,
+       69,   69,   62,   71,    0,   51,   18,    0,   43,    4,
+       37,    2,    0,   71,   69,   69,   69,    6,   16,   69,
+       10,   69,    8,   12,   69,   69,   69,   69,   69,   69,
+
+       69,   69,   31,   31,   31,   31,   32,   32,   32,   32,
+       33,   33,   33,   33,   34,   34,   34,   34,   35,   35,
+       35,   35,   69,   69,   69,   69,   69,   69,   69,   69,
+       69,   69,   69,   69,   69,   69,    0,   50,    0,    0,
+        0,    0,    0,   70,   11,   69,   14,   69,   69,   69,
+       19,   69,   23,   21,   69,   69,   69,   69,   31,   32,
+       33,   34,   35,   69,   69,   69,   52,   63,   69,   69,
+       69,   60,   53,   69,   65,   69,   69,   69,    0,    0,
+        0,    0,    3,    0,   69,   69,   69,   69,   25,   27,
+       29,   69,   69,   69,   69,   69,   69,   69,   55,   54,
+
+       69,   69,   69,   69,   69,    0,   17,    1,    0,   36,
+       69,   69,   69,   69,   41,   69,   48,   69,   46,   69,
+       69,   57,   69,   67,   69,   69,    0,    0,    0,   69,
+       69,   69,   69,   44,   64,   56,   66,   69,   69,    0,
+       42,    0,   69,    0,    0,   39,    0,   69,    0,    0,
+       69,    0,    0,    0,    0,   69,    0,    5,   15,    0,
+        0,    0,    0,   58,   61,   68,    0,    9,    7,   59,
+        0,    0,    0,    0,   13,    0
+    } ;
+
+static yyconst flex_int32_t yy_ec[256] =
+    {   0,
+        1,    1,    1,    1,    1,    1,    1,    1,    2,    2,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    2,    1,    1,    3,    1,    1,    1,    1,    1,
+        1,    1,    4,    1,    5,    6,    1,    7,    8,    8,
+        8,    8,    8,    8,    8,    8,    8,    9,    1,    1,
+       10,    1,    1,    1,   11,   12,   13,   14,   15,   16,
+       17,   18,   19,   13,   13,   20,   13,   21,   22,   23,
+       13,   24,   25,   26,   13,   27,   13,   13,   13,   13,
+        1,    1,    1,    1,   28,    1,   29,   30,   31,   32,
+
+       33,   34,   35,   36,   37,   13,   38,   39,   40,   41,
+       42,   43,   13,   44,   45,   46,   47,   48,   49,   50,
+       51,   13,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1
+    } ;
+
+static yyconst flex_int32_t yy_meta[52] =
+    {   0,
+        1,    1,    2,    1,    1,    2,    3,    3,    1,    1,
+        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
+        3,    3,    3,    3,    3,    3,    3,    2,    3,    3,
+        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
+        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
+        3
+    } ;
+
+static yyconst flex_int16_t yy_base[294] =
+    {   0,
+        0,   28,    0,    0,   10,   17,   21,   34,   11,   13,
+       82,  110,  138,  166,  194,  222,  250,  278,  306,  334,
+       62,   64,  334,  352,  490,  491,  491,    4,  392,    7,
+      491,  491,    0,   29,  447,    7,    9,  446,  458,  440,
+      443,  437,  450,  440,  448,  447,    0,   10,   16,    0,
+       17,   75,    0,   91,   98,    0,  115,   99,    0,  122,
+      128,  437,  436,  446,  437,  433,  426,  422,  430,  429,
+       33,   31,  434,   13,  457,  446,  448,  412,  400,  414,
+      409,  491,   19,  129,    0,   33,  377,    0,  381,  382,
+        0,  375,    0,    0,  382,  375,  379,  367,  362,  374,
+
+      379,  363,    0,  117,  143,  149,    0,  125,  151,  157,
+        0,  146,  172,  158,    0,  174,  181,  187,    0,  176,
+      199,  205,  357,  357,  361,  362,   67,  366,  351,  343,
+      347,  348,  352,  357,  340,  338,  362,  491,  356,  354,
+      348,  354,  345,  184,    0,  335,    0,  321,  331,  328,
+        0,  321,    0,    0,  313,  326,  310,  326,  202,  205,
+      209,  211,  213,  322,  324,  309,    0,  305,  305,  311,
+      307,    0,    0,  313,  310,  307,  308,  300,  315,  316,
+      307,  318,  491,  316,  283,  293,  279,  280,    0,    0,
+        0,  288,  280,  277,  281,  286,  278,  280,    0,    0,
+
+      272,  262,  264,  271,  256,  281,  491,  491,  278,  491,
+      270,  256,  263,  249,    0,  249,    0,  260,    0,  251,
+      256,    0,  249,    0,  243,  241,  255,  261,  228,  228,
+      244,  243,  237,    0,    0,    0,    0,  241,  226,  260,
+      491,  237,  218,  215,  218,    0,  221,  223,  239,  213,
+      202,  201,  216,  214,  200,  210,  235,  491,    0,  193,
+      203,  202,  202,  491,    0,  491,  202,  491,  491,  491,
+      170,  128,  117,   62,  491,  491,  428,  431,  434,  437,
+      440,  443,   61,  445,  447,  449,  451,  453,  455,  457,
+      459,  461,  463
+
+    } ;
+
+static yyconst flex_int16_t yy_def[294] =
+    {   0,
+      277,  277,    2,    2,    2,    2,    2,    2,    2,    2,
+      278,  278,  279,  279,  280,  280,  281,  281,  282,  282,
+        2,    2,    2,    2,  276,  276,  276,  276,  276,  276,
+      276,  276,  283,  283,  283,  283,  283,  283,  283,  283,
+      283,  283,  283,  283,  283,  283,  284,  284,  285,  286,
+      286,  287,  288,  288,  289,  290,  290,  291,  292,  292,
+      293,  283,  283,  283,  283,  283,  283,  283,  283,  283,
+      283,  283,  283,  276,  276,  276,  276,  276,  276,  276,
+      276,  276,  276,  276,  283,  283,  283,  283,  283,  283,
+      283,  283,  283,  283,  283,  283,  283,  283,  283,  283,
+
+      283,  283,  284,  284,  284,  285,  286,  286,  286,  287,
+      288,  288,  288,  289,  290,  290,  290,  291,  292,  292,
+      292,  293,  283,  283,  283,  283,  283,  283,  283,  283,
+      283,  283,  283,  283,  283,  283,  276,  276,  276,  276,
+      276,  276,  276,  276,  283,  283,  283,  283,  283,  283,
+      283,  283,  283,  283,  283,  283,  283,  283,  284,  286,
+      288,  290,  292,  283,  283,  283,  283,  283,  283,  283,
+      283,  283,  283,  283,  283,  283,  283,  283,  276,  276,
+      276,  276,  276,  276,  283,  283,  283,  283,  283,  283,
+      283,  283,  283,  283,  283,  283,  283,  283,  283,  283,
+
+      283,  283,  283,  283,  283,  276,  276,  276,  276,  276,
+      283,  283,  283,  283,  283,  283,  283,  283,  283,  283,
+      283,  283,  283,  283,  283,  283,  276,  276,  276,  283,
+      283,  283,  283,  283,  283,  283,  283,  283,  283,  276,
+      276,  276,  283,  276,  276,  283,  276,  283,  276,  276,
+      283,  276,  276,  276,  276,  283,  276,  276,  283,  276,
+      276,  276,  276,  276,  283,  276,  276,  276,  276,  276,
+      276,  276,  276,  276,  276,    0,  276,  276,  276,  276,
+      276,  276,  276,  276,  276,  276,  276,  276,  276,  276,
+      276,  276,  276
+
+    } ;
+
+static yyconst flex_int16_t yy_nxt[543] =
+    {   0,
+       26,   27,   26,   28,   29,   26,   30,   30,   31,   32,
+       74,   74,   83,   84,   84,  104,  105,  105,  103,   74,
+       74,  103,  108,  109,  109,  144,  144,   26,   26,   27,
+       26,   28,   29,   26,   30,   30,   31,   32,   34,   90,
+       35,   36,   45,  103,   45,   34,   37,   35,   36,   92,
+       38,   39,   91,   37,   93,   26,   40,   38,   46,   41,
+       46,  132,   42,   85,   39,  133,   43,   86,   44,   40,
+      134,  145,   41,   87,   88,   42,  135,  107,  146,   43,
+      107,   44,   26,   27,   47,   28,   29,   47,   48,   48,
+       31,   32,   62,   63,   62,   63,  112,  113,  113,  275,
+
+      111,  115,  107,  111,  115,  168,   64,  169,   64,   47,
+       26,   27,   47,   28,   29,   47,   48,   48,   31,   32,
+      116,  117,  117,  159,  159,  111,  115,  120,  121,  121,
+      119,  160,  160,  119,   83,   84,   84,   47,   26,   27,
+       50,   28,   29,   50,   51,   51,   31,   32,  104,  105,
+      105,  103,  161,  161,  103,  119,  108,  109,  109,  107,
+      111,  274,  107,  111,  273,   50,   26,   27,   50,   28,
+       29,   50,   51,   51,   31,   32,  103,  112,  113,  113,
+      162,  162,  163,  163,  107,  111,  116,  117,  117,  115,
+      144,  144,  115,   50,   26,   27,   53,   28,   29,   53,
+
+       54,   54,   31,   32,  120,  121,  121,  119,  159,  159,
+      119,  160,  160,  272,  115,  161,  161,  162,  162,  163,
+      163,   53,   26,   27,   53,   28,   29,   53,   54,   54,
+       31,   32,  119,  263,  271,  270,  269,  268,  267,  266,
+      264,  265,  262,  252,  261,  260,  259,  258,  257,   53,
+       26,   27,   56,   28,   29,   56,   57,   57,   31,   32,
+      253,  256,  255,  254,  251,  250,  249,  248,  247,  246,
+      245,  244,  243,  242,  241,  240,  239,   56,   26,   27,
+       56,   28,   29,   56,   57,   57,   31,   32,  238,  237,
+      236,  235,  234,  233,  232,  231,  230,  229,  228,  227,
+
+      226,  225,  224,  223,  222,   56,   26,   27,   59,   28,
+       29,   59,   60,   60,   31,   32,  221,  220,  219,  218,
+      217,  216,  215,  214,  213,  212,  211,  210,  209,  208,
+      207,  206,  205,   59,   26,   27,   59,   28,   29,   59,
+       60,   60,   31,   32,  204,  203,  202,  201,  200,  199,
+      198,  197,  196,  195,  194,  193,  192,  191,  190,  189,
+      188,   59,   65,  187,   66,  186,   67,  185,  184,   68,
+      183,  182,   69,  181,   70,  180,  179,   71,   72,   73,
+       65,  178,   66,  177,   67,  176,  175,   68,  174,  173,
+       69,  172,   70,  171,  170,   71,   72,   73,   74,   74,
+
+      167,   75,  166,  165,  164,   76,  158,   77,  157,   78,
+      156,  155,  154,  153,  152,  151,   79,   80,   81,  150,
+      149,  148,  147,  143,  142,  141,  140,   82,   33,   33,
+       33,   49,   49,   49,   52,   52,   52,   55,   55,   55,
+       58,   58,   58,   61,   61,   61,  103,  103,  106,  106,
+      107,  107,  110,  110,  111,  111,  114,  114,  115,  115,
+      118,  118,  119,  119,  122,  122,  139,  138,  137,  136,
+      131,  130,  129,  128,  127,  126,  125,  124,  123,  102,
+      101,  100,   99,   98,   97,   96,   95,   94,   89,  276,
+       25,  276,  276,  276,  276,  276,  276,  276,  276,  276,
+
+      276,  276,  276,  276,  276,  276,  276,  276,  276,  276,
+      276,  276,  276,  276,  276,  276,  276,  276,  276,  276,
+      276,  276,  276,  276,  276,  276,  276,  276,  276,  276,
+      276,  276,  276,  276,  276,  276,  276,  276,  276,  276,
+      276,  276
+    } ;
+
+static yyconst flex_int16_t yy_chk[543] =
+    {   0,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+       28,   28,   30,   30,   30,   48,   48,   48,   49,   74,
+       74,   49,   51,   51,   51,   83,   83,    1,    2,    2,
+        2,    2,    2,    2,    2,    2,    2,    2,    5,   36,
+        5,    5,    9,   49,   10,    6,    5,    6,    6,   37,
+        5,    7,   36,    6,   37,    2,    7,    6,    9,    7,
+       10,   71,    7,  283,    8,   71,    7,   34,    7,    8,
+       72,   86,    8,   34,   34,    8,   72,   52,   86,    8,
+       52,    8,   11,   11,   11,   11,   11,   11,   11,   11,
+       11,   11,   21,   21,   22,   22,   54,   54,   54,  274,
+
+       55,   58,   52,   55,   58,  127,   21,  127,   22,   11,
+       12,   12,   12,   12,   12,   12,   12,   12,   12,   12,
+       57,   57,   57,  104,  104,   55,   58,   60,   60,   60,
+       61,  108,  108,   61,   84,   84,   84,   12,   13,   13,
+       13,   13,   13,   13,   13,   13,   13,   13,  105,  105,
+      105,  106,  112,  112,  106,   61,  109,  109,  109,  110,
+      114,  273,  110,  114,  272,   13,   14,   14,   14,   14,
+       14,   14,   14,   14,   14,   14,  106,  113,  113,  113,
+      116,  116,  120,  120,  110,  114,  117,  117,  117,  118,
+      144,  144,  118,   14,   15,   15,   15,   15,   15,   15,
+
+       15,   15,   15,   15,  121,  121,  121,  122,  159,  159,
+      122,  160,  160,  271,  118,  161,  161,  162,  162,  163,
+      163,   15,   16,   16,   16,   16,   16,   16,   16,   16,
+       16,   16,  122,  255,  267,  263,  262,  261,  260,  257,
+      255,  256,  254,  244,  253,  252,  251,  250,  249,   16,
+       17,   17,   17,   17,   17,   17,   17,   17,   17,   17,
+      244,  248,  247,  245,  243,  242,  240,  239,  238,  233,
+      232,  231,  230,  229,  228,  227,  226,   17,   18,   18,
+       18,   18,   18,   18,   18,   18,   18,   18,  225,  223,
+      221,  220,  218,  216,  214,  213,  212,  211,  209,  206,
+
+      205,  204,  203,  202,  201,   18,   19,   19,   19,   19,
+       19,   19,   19,   19,   19,   19,  198,  197,  196,  195,
+      194,  193,  192,  188,  187,  186,  185,  184,  182,  181,
+      180,  179,  178,   19,   20,   20,   20,   20,   20,   20,
+       20,   20,   20,   20,  177,  176,  175,  174,  171,  170,
+      169,  168,  166,  165,  164,  158,  157,  156,  155,  152,
+      150,   20,   23,  149,   23,  148,   23,  146,  143,   23,
+      142,  141,   23,  140,   23,  139,  137,   23,   23,   23,
+       24,  136,   24,  135,   24,  134,  133,   24,  132,  131,
+       24,  130,   24,  129,  128,   24,   24,   24,   29,   29,
+
+      126,   29,  125,  124,  123,   29,  102,   29,  101,   29,
+      100,   99,   98,   97,   96,   95,   29,   29,   29,   92,
+       90,   89,   87,   81,   80,   79,   78,   29,  277,  277,
+      277,  278,  278,  278,  279,  279,  279,  280,  280,  280,
+      281,  281,  281,  282,  282,  282,  284,  284,  285,  285,
+      286,  286,  287,  287,  288,  288,  289,  289,  290,  290,
+      291,  291,  292,  292,  293,  293,   77,   76,   75,   73,
+       70,   69,   68,   67,   66,   65,   64,   63,   62,   46,
+       45,   44,   43,   42,   41,   40,   39,   38,   35,   25,
+      276,  276,  276,  276,  276,  276,  276,  276,  276,  276,
+
+      276,  276,  276,  276,  276,  276,  276,  276,  276,  276,
+      276,  276,  276,  276,  276,  276,  276,  276,  276,  276,
+      276,  276,  276,  276,  276,  276,  276,  276,  276,  276,
+      276,  276,  276,  276,  276,  276,  276,  276,  276,  276,
+      276,  276
+    } ;
+
+/* The intent behind this definition is that it'll catch
+ * any uses of REJECT which flex missed.
+ */
+#define REJECT reject_used_but_not_detected
+#define yymore() yymore_used_but_not_detected
+#define YY_MORE_ADJ 0
+#define YY_RESTORE_YY_MORE_OFFSET
+#line 1 "parameters_flexer.ll"
+#line 7 "parameters_flexer.ll"
+/*
+ * Written by Thomas Pfisterer
+ *
+ * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
+ *   Krebsforschungszentrum, DKFZ Heidelberg) and Thomas Pfisterer
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ *
+ */
+
+#include <fstream>
+#include "parameters_tokens.h"
+
+using namespace std;
+
+#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
+#pragma set woff 1110
+#endif
+
+  //  int myretcode=0;
+
+
+
+ 
+
+
+
+
+
+
+
+
+#line 681 "parameters_flexer.cc"
+
+#define INITIAL 0
+#define GET_UNTIL_NEWLINE 1
+#define TAG_MODE 2
+#define FILE_MODE 3
+#define VERB_MODE 4
+#define CI_FILE_NAME 5
+#define CO_FILE_NAME 6
+#define HO_FILE_NAME 7
+#define TO_FILE_NAME 8
+#define LO_FILE_NAME 9
+#define STRAND_MODE 10
+#define COMMAND_MODE 11
+
+#ifndef YY_NO_UNISTD_H
+/* Special case for "unistd.h", since it is non-ANSI. We include it way
+ * down here because we want the user's section 1 to have been scanned first.
+ * The user has a chance to override it with an option.
+ */
+#include <unistd.h>
+#endif
+
+#ifndef YY_EXTRA_TYPE
+#define YY_EXTRA_TYPE void *
+#endif
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy (char *,yyconst char *,int );
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen (yyconst char * );
+#endif
+
+#ifndef YY_NO_INPUT
+
+#endif
+
+/* Amount of stuff to slurp up with each read. */
+#ifndef YY_READ_BUF_SIZE
+#ifdef __ia64__
+/* On IA-64, the buffer size is 16k, not 8k */
+#define YY_READ_BUF_SIZE 16384
+#else
+#define YY_READ_BUF_SIZE 8192
+#endif /* __ia64__ */
+#endif
+
+/* Copy whatever the last rule matched to the standard output. */
+#ifndef ECHO
+#define ECHO LexerOutput( yytext, yyleng )
+#endif
+
+/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
+ * is returned in "result".
+ */
+#ifndef YY_INPUT
+#define YY_INPUT(buf,result,max_size) \
+\
+	if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \
+		YY_FATAL_ERROR( "input in flex scanner failed" );
+
+#endif
+
+/* No semi-colon after return; correct usage is to write "yyterminate();" -
+ * we don't want an extra ';' after the "return" because that will cause
+ * some compilers to complain about unreachable statements.
+ */
+#ifndef yyterminate
+#define yyterminate() return YY_NULL
+#endif
+
+/* Number of entries by which start-condition stack grows. */
+#ifndef YY_START_STACK_INCR
+#define YY_START_STACK_INCR 25
+#endif
+
+/* Report a fatal error. */
+#ifndef YY_FATAL_ERROR
+#define YY_FATAL_ERROR(msg) LexerError( msg )
+#endif
+
+/* end tables serialization structures and prototypes */
+
+/* Default declaration of generated scanner - a define so the user can
+ * easily add parameters.
+ */
+#ifndef YY_DECL
+#define YY_DECL_IS_OURS 1
+#define YY_DECL int yyFlexLexer::yylex()
+#endif /* !YY_DECL */
+
+/* Code executed at the beginning of each rule, after yytext and yyleng
+ * have been set up.
+ */
+#ifndef YY_USER_ACTION
+#define YY_USER_ACTION
+#endif
+
+/* Code executed at the end of each rule. */
+#ifndef YY_BREAK
+#define YY_BREAK break;
+#endif
+
+#define YY_RULE_SETUP \
+	YY_USER_ACTION
+
+/** The main scanner function which does all the work.
+ */
+YY_DECL
+{
+	register yy_state_type yy_current_state;
+	register char *yy_cp, *yy_bp;
+	register int yy_act;
+    
+#line 61 "parameters_flexer.ll"
+
+
+
+
+#line 802 "parameters_flexer.cc"
+
+	if ( !(yy_init) )
+		{
+		(yy_init) = 1;
+
+#ifdef YY_USER_INIT
+		YY_USER_INIT;
+#endif
+
+		if ( ! (yy_start) )
+			(yy_start) = 1;	/* first start state */
+
+		if ( ! yyin )
+			yyin = & std::cin;
+
+		if ( ! yyout )
+			yyout = & std::cout;
+
+		if ( ! YY_CURRENT_BUFFER ) {
+			yyensure_buffer_stack ();
+			YY_CURRENT_BUFFER_LVALUE =
+				yy_create_buffer( yyin, YY_BUF_SIZE );
+		}
+
+		yy_load_buffer_state(  );
+		}
+
+	while ( 1 )		/* loops until end-of-file is reached */
+		{
+		yy_cp = (yy_c_buf_p);
+
+		/* Support of yytext. */
+		*yy_cp = (yy_hold_char);
+
+		/* yy_bp points to the position in yy_ch_buf of the start of
+		 * the current run.
+		 */
+		yy_bp = yy_cp;
+
+		yy_current_state = (yy_start);
+yy_match:
+		do
+			{
+			register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
+			if ( yy_accept[yy_current_state] )
+				{
+				(yy_last_accepting_state) = yy_current_state;
+				(yy_last_accepting_cpos) = yy_cp;
+				}
+			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+				{
+				yy_current_state = (int) yy_def[yy_current_state];
+				if ( yy_current_state >= 277 )
+					yy_c = yy_meta[(unsigned int) yy_c];
+				}
+			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+			++yy_cp;
+			}
+		while ( yy_base[yy_current_state] != 491 );
+
+yy_find_action:
+		yy_act = yy_accept[yy_current_state];
+		if ( yy_act == 0 )
+			{ /* have to back up */
+			yy_cp = (yy_last_accepting_cpos);
+			yy_current_state = (yy_last_accepting_state);
+			yy_act = yy_accept[yy_current_state];
+			}
+
+		YY_DO_BEFORE_ACTION;
+
+do_action:	/* This label is used only to access EOF actions. */
+
+		switch ( yy_act )
+	{ /* beginning of action switch */
+			case 0: /* must back up */
+			/* undo the effects of YY_DO_BEFORE_ACTION */
+			*yy_cp = (yy_hold_char);
+			yy_cp = (yy_last_accepting_cpos);
+			yy_current_state = (yy_last_accepting_state);
+			goto yy_find_action;
+
+case 1:
+#line 66 "parameters_flexer.ll"
+case 2:
+YY_RULE_SETUP
+#line 66 "parameters_flexer.ll"
+{ return EP_HELP; }
+	YY_BREAK
+case 3:
+#line 69 "parameters_flexer.ll"
+case 4:
+YY_RULE_SETUP
+#line 69 "parameters_flexer.ll"
+{ BEGIN(TAG_MODE); return yylex();}
+	YY_BREAK
+case 5:
+#line 71 "parameters_flexer.ll"
+case 6:
+YY_RULE_SETUP
+#line 71 "parameters_flexer.ll"
+{ return EP_ALTER_TAG;}
+	YY_BREAK
+case 7:
+#line 73 "parameters_flexer.ll"
+case 8:
+YY_RULE_SETUP
+#line 73 "parameters_flexer.ll"
+{ return EP_INSERT_TAG;}
+	YY_BREAK
+case 9:
+#line 75 "parameters_flexer.ll"
+case 10:
+YY_RULE_SETUP
+#line 75 "parameters_flexer.ll"
+{ return EP_DELETE_TAG;}
+	YY_BREAK
+case 11:
+YY_RULE_SETUP
+#line 76 "parameters_flexer.ll"
+{ return EP_ALL_TAGS;}
+	YY_BREAK
+case 12:
+YY_RULE_SETUP
+#line 77 "parameters_flexer.ll"
+{ return EP_NO_TAGS;}
+	YY_BREAK
+case 13:
+#line 79 "parameters_flexer.ll"
+case 14:
+YY_RULE_SETUP
+#line 79 "parameters_flexer.ll"
+{ return EP_DELETE_ASTERISK; }
+	YY_BREAK
+case 15:
+#line 81 "parameters_flexer.ll"
+case 16:
+YY_RULE_SETUP
+#line 81 "parameters_flexer.ll"
+{ return EP_CONSENSUS_TAG; }
+	YY_BREAK
+case 17:
+#line 84 "parameters_flexer.ll"
+case 18:
+YY_RULE_SETUP
+#line 84 "parameters_flexer.ll"
+{ BEGIN(FILE_MODE); return yylex();} 
+	YY_BREAK
+case 19:
+#line 86 "parameters_flexer.ll"
+case 20:
+YY_RULE_SETUP
+#line 86 "parameters_flexer.ll"
+{ BEGIN(CI_FILE_NAME); }
+	YY_BREAK
+case 21:
+#line 88 "parameters_flexer.ll"
+case 22:
+YY_RULE_SETUP
+#line 88 "parameters_flexer.ll"
+{ BEGIN(CO_FILE_NAME); }
+	YY_BREAK
+case 23:
+#line 90 "parameters_flexer.ll"
+case 24:
+YY_RULE_SETUP
+#line 90 "parameters_flexer.ll"
+{ BEGIN(LO_FILE_NAME); }
+	YY_BREAK
+case 25:
+#line 92 "parameters_flexer.ll"
+case 26:
+YY_RULE_SETUP
+#line 92 "parameters_flexer.ll"
+{ BEGIN(HO_FILE_NAME); }
+	YY_BREAK
+case 27:
+#line 94 "parameters_flexer.ll"
+case 28:
+YY_RULE_SETUP
+#line 94 "parameters_flexer.ll"
+{ BEGIN(TO_FILE_NAME); }
+	YY_BREAK
+case 29:
+#line 96 "parameters_flexer.ll"
+case 30:
+YY_RULE_SETUP
+#line 96 "parameters_flexer.ll"
+{ return EP_outfile_void; }
+	YY_BREAK
+case 31:
+YY_RULE_SETUP
+#line 99 "parameters_flexer.ll"
+{ BEGIN(FILE_MODE); return EP_caf_in_file;}
+	YY_BREAK
+case 32:
+YY_RULE_SETUP
+#line 100 "parameters_flexer.ll"
+{ BEGIN(FILE_MODE); return EP_caf_out_file; }
+	YY_BREAK
+case 33:
+YY_RULE_SETUP
+#line 101 "parameters_flexer.ll"
+{ BEGIN(FILE_MODE); return EP_html_out_file;}
+	YY_BREAK
+case 34:
+YY_RULE_SETUP
+#line 102 "parameters_flexer.ll"
+{ BEGIN(FILE_MODE); return EP_text_out_file;}
+	YY_BREAK
+case 35:
+YY_RULE_SETUP
+#line 103 "parameters_flexer.ll"
+{ BEGIN(FILE_MODE); return EP_log_out_file;}	
+	YY_BREAK
+case 36:
+#line 107 "parameters_flexer.ll"
+case 37:
+YY_RULE_SETUP
+#line 107 "parameters_flexer.ll"
+{ BEGIN(VERB_MODE); return yylex(); }
+	YY_BREAK
+case 38:
+#line 109 "parameters_flexer.ll"
+case 39:
+YY_RULE_SETUP
+#line 109 "parameters_flexer.ll"
+{ return EP_VERBOSE; }
+	YY_BREAK
+case 40:
+#line 111 "parameters_flexer.ll"
+case 41:
+YY_RULE_SETUP
+#line 111 "parameters_flexer.ll"
+{ return EP_DEBUG; }
+	YY_BREAK
+case 42:
+#line 115 "parameters_flexer.ll"
+case 43:
+YY_RULE_SETUP
+#line 115 "parameters_flexer.ll"
+{ BEGIN(STRAND_MODE); return yylex(); }
+	YY_BREAK
+case 44:
+#line 117 "parameters_flexer.ll"
+case 45:
+YY_RULE_SETUP
+#line 117 "parameters_flexer.ll"
+{ return EP_make_double; }
+	YY_BREAK
+case 46:
+#line 119 "parameters_flexer.ll"
+case 47:
+YY_RULE_SETUP
+#line 119 "parameters_flexer.ll"
+{ return EP_doublestrand_minscore; }   
+	YY_BREAK
+case 48:
+#line 121 "parameters_flexer.ll"
+case 49:
+YY_RULE_SETUP
+#line 121 "parameters_flexer.ll"
+{ return EP_mincoverage_single; }
+	YY_BREAK
+case 50:
+#line 125 "parameters_flexer.ll"
+case 51:
+YY_RULE_SETUP
+#line 125 "parameters_flexer.ll"
+{ BEGIN(COMMAND_MODE); return yylex(); }
+	YY_BREAK
+case 52:
+YY_RULE_SETUP
+#line 126 "parameters_flexer.ll"
+{ return EP_DO_ALL;       }
+	YY_BREAK
+case 53:
+YY_RULE_SETUP
+#line 127 "parameters_flexer.ll"
+{ return EP_DO_NOP;       }
+	YY_BREAK
+case 54:
+YY_RULE_SETUP
+#line 128 "parameters_flexer.ll"
+{ return EP_DO_HYPO;      }
+	YY_BREAK
+case 55:
+YY_RULE_SETUP
+#line 129 "parameters_flexer.ll"
+{ return EP_DO_EVAL;      }
+	YY_BREAK
+case 56:
+YY_RULE_SETUP
+#line 130 "parameters_flexer.ll"
+{ return EP_DO_CONTIG;    }
+	YY_BREAK
+case 57:
+YY_RULE_SETUP
+#line 131 "parameters_flexer.ll"
+{ return EP_DO_RANGE;     }
+	YY_BREAK
+case 58:
+YY_RULE_SETUP
+#line 132 "parameters_flexer.ll"
+{ return EP_DO_STRICT;    }
+	YY_BREAK
+case 59:
+YY_RULE_SETUP
+#line 133 "parameters_flexer.ll"
+{ return EP_DO_NOSTRICT;  }		     
+	YY_BREAK
+case 60:
+YY_RULE_SETUP
+#line 134 "parameters_flexer.ll"
+{ return EP_DO_LOWQUAL;   }
+	YY_BREAK
+case 61:
+#line 136 "parameters_flexer.ll"
+case 62:
+YY_RULE_SETUP
+#line 136 "parameters_flexer.ll"
+{ return EP_DO_THRESHOLD; }
+	YY_BREAK
+case 63:
+#line 138 "parameters_flexer.ll"
+case 64:
+YY_RULE_SETUP
+#line 138 "parameters_flexer.ll"
+{ return EP_DO_COLUMNS;   }
+	YY_BREAK
+case 65:
+#line 140 "parameters_flexer.ll"
+case 66:
+YY_RULE_SETUP
+#line 140 "parameters_flexer.ll"
+{ return EP_DO_REGIONS;   }
+	YY_BREAK
+case 67:
+YY_RULE_SETUP
+#line 141 "parameters_flexer.ll"
+{ return EP_DO_SMALL_REGIONS;    }
+	YY_BREAK
+case 68:
+YY_RULE_SETUP
+#line 143 "parameters_flexer.ll"
+{BEGIN(0);}     /* Hack for parsing command lines
+                                   where each blank resets the state */
+	YY_BREAK
+case 69:
+YY_RULE_SETUP
+#line 145 "parameters_flexer.ll"
+{return EP_ANID;}
+	YY_BREAK
+case 70:
+YY_RULE_SETUP
+#line 146 "parameters_flexer.ll"
+{return EP_FLOAT;}
+	YY_BREAK
+case 71:
+YY_RULE_SETUP
+#line 147 "parameters_flexer.ll"
+{return EP_INT;}
+	YY_BREAK
+case 72:
+YY_RULE_SETUP
+#line 149 "parameters_flexer.ll"
+
+	YY_BREAK
+case 73:
+YY_RULE_SETUP
+#line 150 "parameters_flexer.ll"
+
+	YY_BREAK
+case 74:
+/* rule 74 can match eol */
+YY_RULE_SETUP
+#line 152 "parameters_flexer.ll"
+{/* munch these, if not recognised earlier */ }
+	YY_BREAK
+case 75:
+YY_RULE_SETUP
+#line 154 "parameters_flexer.ll"
+ECHO;
+	YY_BREAK
+#line 1187 "parameters_flexer.cc"
+case YY_STATE_EOF(INITIAL):
+case YY_STATE_EOF(GET_UNTIL_NEWLINE):
+case YY_STATE_EOF(TAG_MODE):
+case YY_STATE_EOF(FILE_MODE):
+case YY_STATE_EOF(VERB_MODE):
+case YY_STATE_EOF(CI_FILE_NAME):
+case YY_STATE_EOF(CO_FILE_NAME):
+case YY_STATE_EOF(HO_FILE_NAME):
+case YY_STATE_EOF(TO_FILE_NAME):
+case YY_STATE_EOF(LO_FILE_NAME):
+case YY_STATE_EOF(STRAND_MODE):
+case YY_STATE_EOF(COMMAND_MODE):
+	yyterminate();
+
+	case YY_END_OF_BUFFER:
+		{
+		/* Amount of text matched not including the EOB char. */
+		int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
+
+		/* Undo the effects of YY_DO_BEFORE_ACTION. */
+		*yy_cp = (yy_hold_char);
+		YY_RESTORE_YY_MORE_OFFSET
+
+		if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
+			{
+			/* We're scanning a new file or input source.  It's
+			 * possible that this happened because the user
+			 * just pointed yyin at a new source and called
+			 * yylex().  If so, then we have to assure
+			 * consistency between YY_CURRENT_BUFFER and our
+			 * globals.  Here is the right place to do so, because
+			 * this is the first action (other than possibly a
+			 * back-up) that will match for the new input source.
+			 */
+			(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+			YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
+			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
+			}
+
+		/* Note that here we test for yy_c_buf_p "<=" to the position
+		 * of the first EOB in the buffer, since yy_c_buf_p will
+		 * already have been incremented past the NUL character
+		 * (since all states make transitions on EOB to the
+		 * end-of-buffer state).  Contrast this with the test
+		 * in input().
+		 */
+		if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
+			{ /* This was really a NUL. */
+			yy_state_type yy_next_state;
+
+			(yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
+
+			yy_current_state = yy_get_previous_state(  );
+
+			/* Okay, we're now positioned to make the NUL
+			 * transition.  We couldn't have
+			 * yy_get_previous_state() go ahead and do it
+			 * for us because it doesn't know how to deal
+			 * with the possibility of jamming (and we don't
+			 * want to build jamming into it because then it
+			 * will run more slowly).
+			 */
+
+			yy_next_state = yy_try_NUL_trans( yy_current_state );
+
+			yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+
+			if ( yy_next_state )
+				{
+				/* Consume the NUL. */
+				yy_cp = ++(yy_c_buf_p);
+				yy_current_state = yy_next_state;
+				goto yy_match;
+				}
+
+			else
+				{
+				yy_cp = (yy_c_buf_p);
+				goto yy_find_action;
+				}
+			}
+
+		else switch ( yy_get_next_buffer(  ) )
+			{
+			case EOB_ACT_END_OF_FILE:
+				{
+				(yy_did_buffer_switch_on_eof) = 0;
+
+				if ( yywrap(  ) )
+					{
+					/* Note: because we've taken care in
+					 * yy_get_next_buffer() to have set up
+					 * yytext, we can now set up
+					 * yy_c_buf_p so that if some total
+					 * hoser (like flex itself) wants to
+					 * call the scanner after we return the
+					 * YY_NULL, it'll still work - another
+					 * YY_NULL will get returned.
+					 */
+					(yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
+
+					yy_act = YY_STATE_EOF(YY_START);
+					goto do_action;
+					}
+
+				else
+					{
+					if ( ! (yy_did_buffer_switch_on_eof) )
+						YY_NEW_FILE;
+					}
+				break;
+				}
+
+			case EOB_ACT_CONTINUE_SCAN:
+				(yy_c_buf_p) =
+					(yytext_ptr) + yy_amount_of_matched_text;
+
+				yy_current_state = yy_get_previous_state(  );
+
+				yy_cp = (yy_c_buf_p);
+				yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+				goto yy_match;
+
+			case EOB_ACT_LAST_MATCH:
+				(yy_c_buf_p) =
+				&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
+
+				yy_current_state = yy_get_previous_state(  );
+
+				yy_cp = (yy_c_buf_p);
+				yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+				goto yy_find_action;
+			}
+		break;
+		}
+
+	default:
+		YY_FATAL_ERROR(
+			"fatal flex scanner internal error--no action found" );
+	} /* end of action switch */
+		} /* end of scanning one token */
+} /* end of yylex */
+
+/* The contents of this function are C++ specific, so the () macro is not used.
+ */
+yyFlexLexer::yyFlexLexer( std::istream* arg_yyin, std::ostream* arg_yyout )
+{
+	yyin = arg_yyin;
+	yyout = arg_yyout;
+	yy_c_buf_p = 0;
+	yy_init = 0;
+	yy_start = 0;
+	yy_flex_debug = 0;
+	yylineno = 1;	// this will only get updated if %option yylineno
+
+	yy_did_buffer_switch_on_eof = 0;
+
+	yy_looking_for_trail_begin = 0;
+	yy_more_flag = 0;
+	yy_more_len = 0;
+	yy_more_offset = yy_prev_more_offset = 0;
+
+	yy_start_stack_ptr = yy_start_stack_depth = 0;
+	yy_start_stack = NULL;
+
+	yy_buffer_stack = 0;
+	yy_buffer_stack_top = 0;
+	yy_buffer_stack_max = 0;
+
+	yy_state_buf = 0;
+
+}
+
+/* The contents of this function are C++ specific, so the () macro is not used.
+ */
+yyFlexLexer::~yyFlexLexer()
+{
+	delete [] yy_state_buf;
+	EPfree(yy_start_stack  );
+	yy_delete_buffer( YY_CURRENT_BUFFER );
+	EPfree(yy_buffer_stack  );
+}
+
+/* The contents of this function are C++ specific, so the () macro is not used.
+ */
+void yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out )
+{
+	if ( new_in )
+		{
+		yy_delete_buffer( YY_CURRENT_BUFFER );
+		yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE  ) );
+		}
+
+	if ( new_out )
+		yyout = new_out;
+}
+
+#ifdef YY_INTERACTIVE
+int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
+#else
+int yyFlexLexer::LexerInput( char* buf, int max_size )
+#endif
+{
+	if ( yyin->eof() || yyin->fail() )
+		return 0;
+
+#ifdef YY_INTERACTIVE
+	yyin->get( buf[0] );
+
+	if ( yyin->eof() )
+		return 0;
+
+	if ( yyin->bad() )
+		return -1;
+
+	return 1;
+
+#else
+	(void) yyin->read( buf, max_size );
+
+	if ( yyin->bad() )
+		return -1;
+	else
+		return yyin->gcount();
+#endif
+}
+
+void yyFlexLexer::LexerOutput( const char* buf, int size )
+{
+	(void) yyout->write( buf, size );
+}
+
+/* yy_get_next_buffer - try to read in a new buffer
+ *
+ * Returns a code representing an action:
+ *	EOB_ACT_LAST_MATCH -
+ *	EOB_ACT_CONTINUE_SCAN - continue scanning from current position
+ *	EOB_ACT_END_OF_FILE - end of file
+ */
+int yyFlexLexer::yy_get_next_buffer()
+{
+    	register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
+	register char *source = (yytext_ptr);
+	register int number_to_move, i;
+	int ret_val;
+
+	if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
+		YY_FATAL_ERROR(
+		"fatal flex scanner internal error--end of buffer missed" );
+
+	if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
+		{ /* Don't try to fill the buffer, so this is an EOF. */
+		if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
+			{
+			/* We matched a single character, the EOB, so
+			 * treat this as a final EOF.
+			 */
+			return EOB_ACT_END_OF_FILE;
+			}
+
+		else
+			{
+			/* We matched some text prior to the EOB, first
+			 * process it.
+			 */
+			return EOB_ACT_LAST_MATCH;
+			}
+		}
+
+	/* Try to read more data. */
+
+	/* First move last chars to start of buffer. */
+	number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
+
+	for ( i = 0; i < number_to_move; ++i )
+		*(dest++) = *(source++);
+
+	if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
+		/* don't do the read, it's not guaranteed to return an EOF,
+		 * just force an EOF
+		 */
+		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
+
+	else
+		{
+			int num_to_read =
+			YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
+
+		while ( num_to_read <= 0 )
+			{ /* Not enough room in the buffer - grow it. */
+
+			/* just a shorter name for the current buffer */
+			YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
+
+			int yy_c_buf_p_offset =
+				(int) ((yy_c_buf_p) - b->yy_ch_buf);
+
+			if ( b->yy_is_our_buffer )
+				{
+				int new_size = b->yy_buf_size * 2;
+
+				if ( new_size <= 0 )
+					b->yy_buf_size += b->yy_buf_size / 8;
+				else
+					b->yy_buf_size *= 2;
+
+				b->yy_ch_buf = (char *)
+					/* Include room in for 2 EOB chars. */
+					EPrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
+				}
+			else
+				/* Can't grow it, we don't own it. */
+				b->yy_ch_buf = 0;
+
+			if ( ! b->yy_ch_buf )
+				YY_FATAL_ERROR(
+				"fatal error - scanner input buffer overflow" );
+
+			(yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
+
+			num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
+						number_to_move - 1;
+
+			}
+
+		if ( num_to_read > YY_READ_BUF_SIZE )
+			num_to_read = YY_READ_BUF_SIZE;
+
+		/* Read in more data. */
+		YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
+			(yy_n_chars), (size_t) num_to_read );
+
+		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+		}
+
+	if ( (yy_n_chars) == 0 )
+		{
+		if ( number_to_move == YY_MORE_ADJ )
+			{
+			ret_val = EOB_ACT_END_OF_FILE;
+			yyrestart( yyin  );
+			}
+
+		else
+			{
+			ret_val = EOB_ACT_LAST_MATCH;
+			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
+				YY_BUFFER_EOF_PENDING;
+			}
+		}
+
+	else
+		ret_val = EOB_ACT_CONTINUE_SCAN;
+
+	if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+		/* Extend the array by 50%, plus the number we really need. */
+		yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
+		YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) EPrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );
+		if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+			YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
+	}
+
+	(yy_n_chars) += number_to_move;
+	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
+	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
+
+	(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
+
+	return ret_val;
+}
+
+/* yy_get_previous_state - get the state just before the EOB char was reached */
+
+    yy_state_type yyFlexLexer::yy_get_previous_state()
+{
+	register yy_state_type yy_current_state;
+	register char *yy_cp;
+    
+	yy_current_state = (yy_start);
+
+	for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
+		{
+		register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
+		if ( yy_accept[yy_current_state] )
+			{
+			(yy_last_accepting_state) = yy_current_state;
+			(yy_last_accepting_cpos) = yy_cp;
+			}
+		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+			{
+			yy_current_state = (int) yy_def[yy_current_state];
+			if ( yy_current_state >= 277 )
+				yy_c = yy_meta[(unsigned int) yy_c];
+			}
+		yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+		}
+
+	return yy_current_state;
+}
+
+/* yy_try_NUL_trans - try to make a transition on the NUL character
+ *
+ * synopsis
+ *	next_state = yy_try_NUL_trans( current_state );
+ */
+    yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
+{
+	register int yy_is_jam;
+    	register char *yy_cp = (yy_c_buf_p);
+
+	register YY_CHAR yy_c = 1;
+	if ( yy_accept[yy_current_state] )
+		{
+		(yy_last_accepting_state) = yy_current_state;
+		(yy_last_accepting_cpos) = yy_cp;
+		}
+	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+		{
+		yy_current_state = (int) yy_def[yy_current_state];
+		if ( yy_current_state >= 277 )
+			yy_c = yy_meta[(unsigned int) yy_c];
+		}
+	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+	yy_is_jam = (yy_current_state == 276);
+
+	return yy_is_jam ? 0 : yy_current_state;
+}
+
+    void yyFlexLexer::yyunput( int c, register char* yy_bp)
+{
+	register char *yy_cp;
+    
+    yy_cp = (yy_c_buf_p);
+
+	/* undo effects of setting up yytext */
+	*yy_cp = (yy_hold_char);
+
+	if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
+		{ /* need to shift things up to make room */
+		/* +2 for EOB chars. */
+		register int number_to_move = (yy_n_chars) + 2;
+		register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
+					YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
+		register char *source =
+				&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
+
+		while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+			*--dest = *--source;
+
+		yy_cp += (int) (dest - source);
+		yy_bp += (int) (dest - source);
+		YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
+			(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
+
+		if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
+			YY_FATAL_ERROR( "flex scanner push-back overflow" );
+		}
+
+	*--yy_cp = (char) c;
+
+	(yytext_ptr) = yy_bp;
+	(yy_hold_char) = *yy_cp;
+	(yy_c_buf_p) = yy_cp;
+}
+
+    int yyFlexLexer::yyinput()
+{
+	int c;
+    
+	*(yy_c_buf_p) = (yy_hold_char);
+
+	if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
+		{
+		/* yy_c_buf_p now points to the character we want to return.
+		 * If this occurs *before* the EOB characters, then it's a
+		 * valid NUL; if not, then we've hit the end of the buffer.
+		 */
+		if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
+			/* This was really a NUL. */
+			*(yy_c_buf_p) = '\0';
+
+		else
+			{ /* need more input */
+			int offset = (yy_c_buf_p) - (yytext_ptr);
+			++(yy_c_buf_p);
+
+			switch ( yy_get_next_buffer(  ) )
+				{
+				case EOB_ACT_LAST_MATCH:
+					/* This happens because yy_g_n_b()
+					 * sees that we've accumulated a
+					 * token and flags that we need to
+					 * try matching the token before
+					 * proceeding.  But for input(),
+					 * there's no matching to consider.
+					 * So convert the EOB_ACT_LAST_MATCH
+					 * to EOB_ACT_END_OF_FILE.
+					 */
+
+					/* Reset buffer status. */
+					yyrestart( yyin );
+
+					/*FALLTHROUGH*/
+
+				case EOB_ACT_END_OF_FILE:
+					{
+					if ( yywrap(  ) )
+						return EOF;
+
+					if ( ! (yy_did_buffer_switch_on_eof) )
+						YY_NEW_FILE;
+#ifdef __cplusplus
+					return yyinput();
+#else
+					return input();
+#endif
+					}
+
+				case EOB_ACT_CONTINUE_SCAN:
+					(yy_c_buf_p) = (yytext_ptr) + offset;
+					break;
+				}
+			}
+		}
+
+	c = *(unsigned char *) (yy_c_buf_p);	/* cast for 8-bit char's */
+	*(yy_c_buf_p) = '\0';	/* preserve yytext */
+	(yy_hold_char) = *++(yy_c_buf_p);
+
+	return c;
+}
+
+/** Immediately switch to a different input stream.
+ * @param input_file A readable stream.
+ * 
+ * @note This function does not reset the start condition to @c INITIAL .
+ */
+    void yyFlexLexer::yyrestart( std::istream* input_file )
+{
+    
+	if ( ! YY_CURRENT_BUFFER ){
+        yyensure_buffer_stack ();
+		YY_CURRENT_BUFFER_LVALUE =
+            yy_create_buffer( yyin, YY_BUF_SIZE );
+	}
+
+	yy_init_buffer( YY_CURRENT_BUFFER, input_file );
+	yy_load_buffer_state(  );
+}
+
+/** Switch to a different input buffer.
+ * @param new_buffer The new input buffer.
+ * 
+ */
+    void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
+{
+    
+	/* TODO. We should be able to replace this entire function body
+	 * with
+	 *		yypop_buffer_state();
+	 *		yypush_buffer_state(new_buffer);
+     */
+	yyensure_buffer_stack ();
+	if ( YY_CURRENT_BUFFER == new_buffer )
+		return;
+
+	if ( YY_CURRENT_BUFFER )
+		{
+		/* Flush out information for old buffer. */
+		*(yy_c_buf_p) = (yy_hold_char);
+		YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
+		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+		}
+
+	YY_CURRENT_BUFFER_LVALUE = new_buffer;
+	yy_load_buffer_state(  );
+
+	/* We don't actually know whether we did this switch during
+	 * EOF (yywrap()) processing, but the only time this flag
+	 * is looked at is after yywrap() is called, so it's safe
+	 * to go ahead and always set it.
+	 */
+	(yy_did_buffer_switch_on_eof) = 1;
+}
+
+    void yyFlexLexer::yy_load_buffer_state()
+{
+    	(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+	(yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
+	yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
+	(yy_hold_char) = *(yy_c_buf_p);
+}
+
+/** Allocate and initialize an input buffer state.
+ * @param file A readable stream.
+ * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
+ * 
+ * @return the allocated buffer state.
+ */
+    YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size )
+{
+	YY_BUFFER_STATE b;
+    
+	b = (YY_BUFFER_STATE) EPalloc(sizeof( struct yy_buffer_state )  );
+	if ( ! b )
+		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+	b->yy_buf_size = size;
+
+	/* yy_ch_buf has to be 2 characters longer than the size given because
+	 * we need to put in 2 end-of-buffer characters.
+	 */
+	b->yy_ch_buf = (char *) EPalloc(b->yy_buf_size + 2  );
+	if ( ! b->yy_ch_buf )
+		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+	b->yy_is_our_buffer = 1;
+
+	yy_init_buffer( b, file );
+
+	return b;
+}
+
+/** Destroy the buffer.
+ * @param b a buffer created with yy_create_buffer()
+ * 
+ */
+    void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
+{
+    
+	if ( ! b )
+		return;
+
+	if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
+		YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
+
+	if ( b->yy_is_our_buffer )
+		EPfree((void *) b->yy_ch_buf  );
+
+	EPfree((void *) b  );
+}
+
+extern "C" int isatty (int );
+
+/* Initializes or reinitializes a buffer.
+ * This function is sometimes called more than once on the same buffer,
+ * such as during a yyrestart() or at EOF.
+ */
+    void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream* file )
+
+{
+	int oerrno = errno;
+    
+	yy_flush_buffer( b );
+
+	b->yy_input_file = file;
+	b->yy_fill_buffer = 1;
+
+    /* If b is the current buffer, then yy_init_buffer was _probably_
+     * called from yyrestart() or through yy_get_next_buffer.
+     * In that case, we don't want to reset the lineno or column.
+     */
+    if (b != YY_CURRENT_BUFFER){
+        b->yy_bs_lineno = 1;
+        b->yy_bs_column = 0;
+    }
+
+	b->yy_is_interactive = 0;
+	errno = oerrno;
+}
+
+/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
+ * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
+ * 
+ */
+    void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
+{
+    	if ( ! b )
+		return;
+
+	b->yy_n_chars = 0;
+
+	/* We always need two end-of-buffer characters.  The first causes
+	 * a transition to the end-of-buffer state.  The second causes
+	 * a jam in that state.
+	 */
+	b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
+	b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
+
+	b->yy_buf_pos = &b->yy_ch_buf[0];
+
+	b->yy_at_bol = 1;
+	b->yy_buffer_status = YY_BUFFER_NEW;
+
+	if ( b == YY_CURRENT_BUFFER )
+		yy_load_buffer_state(  );
+}
+
+/** Pushes the new state onto the stack. The new state becomes
+ *  the current state. This function will allocate the stack
+ *  if necessary.
+ *  @param new_buffer The new state.
+ *  
+ */
+void yyFlexLexer::yypush_buffer_state (YY_BUFFER_STATE new_buffer)
+{
+    	if (new_buffer == NULL)
+		return;
+
+	yyensure_buffer_stack();
+
+	/* This block is copied from yy_switch_to_buffer. */
+	if ( YY_CURRENT_BUFFER )
+		{
+		/* Flush out information for old buffer. */
+		*(yy_c_buf_p) = (yy_hold_char);
+		YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
+		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+		}
+
+	/* Only push if top exists. Otherwise, replace top. */
+	if (YY_CURRENT_BUFFER)
+		(yy_buffer_stack_top)++;
+	YY_CURRENT_BUFFER_LVALUE = new_buffer;
+
+	/* copied from yy_switch_to_buffer. */
+	yy_load_buffer_state(  );
+	(yy_did_buffer_switch_on_eof) = 1;
+}
+
+/** Removes and deletes the top of the stack, if present.
+ *  The next element becomes the new top.
+ *  
+ */
+void yyFlexLexer::yypop_buffer_state (void)
+{
+    	if (!YY_CURRENT_BUFFER)
+		return;
+
+	yy_delete_buffer(YY_CURRENT_BUFFER );
+	YY_CURRENT_BUFFER_LVALUE = NULL;
+	if ((yy_buffer_stack_top) > 0)
+		--(yy_buffer_stack_top);
+
+	if (YY_CURRENT_BUFFER) {
+		yy_load_buffer_state(  );
+		(yy_did_buffer_switch_on_eof) = 1;
+	}
+}
+
+/* Allocates the stack if it does not exist.
+ *  Guarantees space for at least one push.
+ */
+void yyFlexLexer::yyensure_buffer_stack(void)
+{
+	int num_to_alloc;
+    
+	if (!(yy_buffer_stack)) {
+
+		/* First allocation is just for 2 elements, since we don't know if this
+		 * scanner will even need a stack. We use 2 instead of 1 to avoid an
+		 * immediate realloc on the next call.
+         */
+		num_to_alloc = 1;
+		(yy_buffer_stack) = (struct yy_buffer_state**)EPalloc
+								(num_to_alloc * sizeof(struct yy_buffer_state*)
+								);
+		if ( ! (yy_buffer_stack) )
+			YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
+								  
+		memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
+				
+		(yy_buffer_stack_max) = num_to_alloc;
+		(yy_buffer_stack_top) = 0;
+		return;
+	}
+
+	if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
+
+		/* Increase the buffer to prepare for a possible push. */
+		int grow_size = 8 /* arbitrary grow size */;
+
+		num_to_alloc = (yy_buffer_stack_max) + grow_size;
+		(yy_buffer_stack) = (struct yy_buffer_state**)EPrealloc
+								((yy_buffer_stack),
+								num_to_alloc * sizeof(struct yy_buffer_state*)
+								);
+		if ( ! (yy_buffer_stack) )
+			YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
+
+		/* zero only the new slots.*/
+		memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
+		(yy_buffer_stack_max) = num_to_alloc;
+	}
+}
+
+    void yyFlexLexer::yy_push_state( int new_state )
+{
+    	if ( (yy_start_stack_ptr) >= (yy_start_stack_depth) )
+		{
+		yy_size_t new_size;
+
+		(yy_start_stack_depth) += YY_START_STACK_INCR;
+		new_size = (yy_start_stack_depth) * sizeof( int );
+
+		if ( ! (yy_start_stack) )
+			(yy_start_stack) = (int *) EPalloc(new_size  );
+
+		else
+			(yy_start_stack) = (int *) EPrealloc((void *) (yy_start_stack),new_size  );
+
+		if ( ! (yy_start_stack) )
+			YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
+		}
+
+	(yy_start_stack)[(yy_start_stack_ptr)++] = YY_START;
+
+	BEGIN(new_state);
+}
+
+    void yyFlexLexer::yy_pop_state()
+{
+    	if ( --(yy_start_stack_ptr) < 0 )
+		YY_FATAL_ERROR( "start-condition stack underflow" );
+
+	BEGIN((yy_start_stack)[(yy_start_stack_ptr)]);
+}
+
+    int yyFlexLexer::yy_top_state()
+{
+    	return (yy_start_stack)[(yy_start_stack_ptr) - 1];
+}
+
+#ifndef YY_EXIT_FAILURE
+#define YY_EXIT_FAILURE 2
+#endif
+
+void yyFlexLexer::LexerError( yyconst char msg[] )
+{
+    	std::cerr << msg << std::endl;
+	exit( YY_EXIT_FAILURE );
+}
+
+/* Redefine yyless() so it works in section 3 code. */
+
+#undef yyless
+#define yyless(n) \
+	do \
+		{ \
+		/* Undo effects of setting up yytext. */ \
+        int yyless_macro_arg = (n); \
+        YY_LESS_LINENO(yyless_macro_arg);\
+		yytext[yyleng] = (yy_hold_char); \
+		(yy_c_buf_p) = yytext + yyless_macro_arg; \
+		(yy_hold_char) = *(yy_c_buf_p); \
+		*(yy_c_buf_p) = '\0'; \
+		yyleng = yyless_macro_arg; \
+		} \
+	while ( 0 )
+
+/* Accessor  methods (get/set functions) to struct members. */
+
+/*
+ * Internal utility routines.
+ */
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
+{
+	register int i;
+	for ( i = 0; i < n; ++i )
+		s1[i] = s2[i];
+}
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen (yyconst char * s )
+{
+	register int n;
+	for ( n = 0; s[n]; ++n )
+		;
+
+	return n;
+}
+#endif
+
+void *EPalloc (yy_size_t  size )
+{
+	return (void *) malloc( size );
+}
+
+void *EPrealloc  (void * ptr, yy_size_t  size )
+{
+	/* The cast to (char *) in the following accommodates both
+	 * implementations that use char* generic pointers, and those
+	 * that use void* generic pointers.  It works with the latter
+	 * because both ANSI C and C++ allow castless assignment from
+	 * any pointer type to void*, and deal with argument conversions
+	 * as though doing an assignment.
+	 */
+	return (void *) realloc( (char *) ptr, size );
+}
+
+void EPfree (void * ptr )
+{
+	free( (char *) ptr );	/* see EPrealloc() for (char *) cast */
+}
+
+#define YYTABLES_NAME "yytables"
+
+#line 154 "parameters_flexer.ll"
+
+
+
+#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
+#pragma reset woff 1110
+#endif
+
+
+
diff --git a/src/EdIt/parameters_flexer.ll b/src/EdIt/parameters_flexer.ll
new file mode 100644
index 0000000..abead4b
--- /dev/null
+++ b/src/EdIt/parameters_flexer.ll
@@ -0,0 +1,160 @@
+%option noyywrap
+%option c++
+%option outfile="lex.yy.c"
+%option prefix="EP"
+
+%{
+/*
+ * Written by Thomas Pfisterer
+ *
+ * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
+ *   Krebsforschungszentrum, DKFZ Heidelberg) and Thomas Pfisterer
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ *
+ */
+
+#include <fstream>
+#include "parameters_tokens.h"
+
+using namespace std;
+
+#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
+#pragma set woff 1110
+#endif
+
+  //  int myretcode=0;
+
+%}
+
+ANID [A-Za-z][A-Za-z0-9]*
+NAME [A-Za-z0-9_#.]+
+INT [+\-]?[0-9]+
+FLOAT [0-9]+"."[0-9]+
+
+%x GET_UNTIL_NEWLINE
+%x TAG_MODE
+%x FILE_MODE 
+%x VERB_MODE
+%x CI_FILE_NAME
+%x CO_FILE_NAME
+%x HO_FILE_NAME
+%x TO_FILE_NAME
+%x LO_FILE_NAME
+%x STRAND_MODE
+%x COMMAND_MODE
+%%
+
+
+
+<*>"-HELP" |
+<*>"-h"                           { return EP_HELP; }
+
+<*>"-TAG" |
+<*>"-T"                           { BEGIN(TAG_MODE); return yylex();}
+<TAG_MODE>"alter_tag" |
+<TAG_MODE>"at"                    { return EP_ALTER_TAG;}
+<TAG_MODE>"insert_tag" |
+<TAG_MODE>"it"                    { return EP_INSERT_TAG;}
+<TAG_MODE>"delete_tag" |
+<TAG_MODE>"dt"                    { return EP_DELETE_TAG;}
+<TAG_MODE>"all"                   { return EP_ALL_TAGS;}
+<TAG_MODE>"no"                    { return EP_NO_TAGS;}
+<TAG_MODE>"delete_asterisk" |
+<TAG_MODE>"ast"		          { return EP_DELETE_ASTERISK; }
+<TAG_MODE>"consensus" |
+<TAG_MODE>"co"                    { return EP_CONSENSUS_TAG; }
+
+<*>"-FILE" |
+<*>"-F"                           { BEGIN(FILE_MODE); return yylex();} 
+<FILE_MODE>"caf" | 
+<FILE_MODE>"c"			  { BEGIN(CI_FILE_NAME); }
+<FILE_MODE>"out" |
+<FILE_MODE>"o"			  { BEGIN(CO_FILE_NAME); }
+<FILE_MODE>"log" |
+<FILE_MODE>"l"                    { BEGIN(LO_FILE_NAME); }
+<FILE_MODE>"html" |
+<FILE_MODE>"h"                    { BEGIN(HO_FILE_NAME); }
+<FILE_MODE>"text" |
+<FILE_MODE>"t"                    { BEGIN(TO_FILE_NAME); }
+<FILE_MODE>"void" |
+<FILE_MODE>"v"                    { return EP_outfile_void; }
+
+
+<CI_FILE_NAME>{NAME}    { BEGIN(FILE_MODE); return EP_caf_in_file;}
+<CO_FILE_NAME>{NAME}	{ BEGIN(FILE_MODE); return EP_caf_out_file; }
+<HO_FILE_NAME>{NAME}    { BEGIN(FILE_MODE); return EP_html_out_file;}
+<TO_FILE_NAME>{NAME}    { BEGIN(FILE_MODE); return EP_text_out_file;}
+<LO_FILE_NAME>{NAME}	{ BEGIN(FILE_MODE); return EP_log_out_file;}	
+
+
+<*>"-VERB" |
+<*>"-V"                      { BEGIN(VERB_MODE); return yylex(); }
+<VERB_MODE>"v" |
+<VERB_MODE>"verbose"	     { return EP_VERBOSE; }
+<VERB_MODE>"d" |
+<VERB_MODE>"debug"           { return EP_DEBUG; }
+
+
+<*>"-STRAND" |
+<*>"-S"                      { BEGIN(STRAND_MODE); return yylex(); }
+<STRAND_MODE>"double" |
+<STRAND_MODE>"d"             { return EP_make_double; }
+<STRAND_MODE>"score" |  
+<STRAND_MODE>"s"             { return EP_doublestrand_minscore; }   
+<STRAND_MODE>"cover" |
+<STRAND_MODE>"c"             { return EP_mincoverage_single; }
+
+
+<*>"-DO" |
+<*>"-D"                      { BEGIN(COMMAND_MODE); return yylex(); }
+<COMMAND_MODE>"all"          { return EP_DO_ALL;       }
+<COMMAND_MODE>"nop"          { return EP_DO_NOP;       }
+<COMMAND_MODE>"hypo"         { return EP_DO_HYPO;      }
+<COMMAND_MODE>"eval"         { return EP_DO_EVAL;      }
+<COMMAND_MODE>"contig"       { return EP_DO_CONTIG;    }
+<COMMAND_MODE>"range"        { return EP_DO_RANGE;     }
+<COMMAND_MODE>"strict_on"    { return EP_DO_STRICT;    }
+<COMMAND_MODE>"strict_off"   { return EP_DO_NOSTRICT;  }		     
+<COMMAND_MODE>"low"          { return EP_DO_LOWQUAL;   }
+<COMMAND_MODE>"threshold" |
+<COMMAND_MODE>"t"            { return EP_DO_THRESHOLD; }
+<COMMAND_MODE>"col" |
+<COMMAND_MODE>"column"       { return EP_DO_COLUMNS;   }
+<COMMAND_MODE>"reg" |
+<COMMAND_MODE>"region"       { return EP_DO_REGIONS;   }
+<COMMAND_MODE>"small"        { return EP_DO_SMALL_REGIONS;    }
+
+<*>"-=BEGIN0=-" {BEGIN(0);}     /* Hack for parsing command lines
+                                   where each blank resets the state */
+<*>{ANID}  {return EP_ANID;}
+<*>{FLOAT} {return EP_FLOAT;}
+<*>{INT}   {return EP_INT;}
+
+<*>":"
+<*>"="
+
+<*>[\t\n ]   {/* munch these, if not recognised earlier */ }
+
+%%
+
+#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
+#pragma reset woff 1110
+#endif
+
+
diff --git a/src/EdIt/parameters_tokens.h b/src/EdIt/parameters_tokens.h
new file mode 100644
index 0000000..2e4c9e2
--- /dev/null
+++ b/src/EdIt/parameters_tokens.h
@@ -0,0 +1,74 @@
+/*
+ * Written by Thomas Pfisterer
+ *
+ * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
+ *   Krebsforschungszentrum, DKFZ Heidelberg) and Thomas Pfisterer
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ *
+ */
+
+enum { EP_bla=100,
+
+       
+       EP_ALTER_TAG,
+       EP_INSERT_TAG,
+       EP_DELETE_TAG,
+       EP_DELETE_ASTERISK,
+       EP_CONSENSUS_TAG,
+       EP_ALL_TAGS,
+       EP_NO_TAGS,
+
+       EP_caf_in_file,
+       EP_caf_out_file,
+       EP_html_out_file,
+       EP_text_out_file,
+       EP_log_out_file,
+       EP_outfile_void,
+
+       EP_VERBOSE,
+       EP_DEBUG,
+
+       EP_make_double,
+       EP_doublestrand_minscore,
+       EP_mincoverage_single,
+       EP_use_machinetype,
+
+       EP_ANID,
+       EP_FILENAME,
+       EP_FLOAT,
+       EP_INT,
+
+       EP_DO_ALL,
+       EP_DO_NOP,
+       EP_DO_HYPO,
+       EP_DO_EVAL,
+       EP_DO_CONTIG,
+       EP_DO_RANGE,
+       EP_DO_STRICT,
+       EP_DO_NOSTRICT,
+       EP_DO_THRESHOLD,
+       EP_DO_LOWQUAL,
+       EP_DO_COLUMNS,
+       EP_DO_REGIONS,
+       EP_DO_SMALL_REGIONS,
+
+       EP_HELP
+};
+
+
diff --git a/src/Makefile.am b/src/Makefile.am
index ab8b839..09a5143 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,39 +1,3 @@
 
-GITBUILD=`$(top_srcdir)/build-aux/git-version-gen $(top_srcdir)/.tarball-version`
+SUBDIRS = lec io stdinc errorhandling util mira EdIt caf examine knn_abi373 knn_alf examples_programming progs support scripts test
 
-noinst_HEADERS = version.H
-BUILT_SOURCES = version.H
-EXTRA_DIST = version.stub
-
-target_not_existing_always_run:
-	@echo >/dev/null
-
-version.H: version.stub target_not_existing_always_run
-	@cp version.stub version.H
-	@echo \#define GITBUILD \"${GITBUILD}\" >>version.H
-	@echo \#define MIRALIBVERSION GITBUILD >>version.H
-	@echo \#define MIRAVERSION MIRALIBVERSION \" \" MLV_QUIET MLV_TIME\"\" >>version.H
-
-
-SUBDIRS = \
-	debuggersupport\
-	io\
-	stdinc\
-	errorhandling\
-	util\
-	mira\
-	caf\
-	memorc\
-	modules\
-	progs\
-	support\
-	scripts
-
-#	test\
-#	EdIt\
-#	examine\
-#	knn_abi373\
-#	knn_alf\
-#
-#	examples_programming\
-#
\ No newline at end of file
diff --git a/src/Makefile.in b/src/Makefile.in
index d3e0683..74dcb00 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -14,7 +14,6 @@
 # PARTICULAR PURPOSE.
 
 @SET_MAKE@
-
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
@@ -35,17 +34,24 @@ POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
 subdir = src
-DIST_COMMON = README $(noinst_HEADERS) $(srcdir)/Makefile.am \
-	$(srcdir)/Makefile.in
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/ax_boost_base.m4 \
-	$(top_srcdir)/m4/ax_boost_filesystem.m4 \
-	$(top_srcdir)/m4/ax_boost_iostreams.m4 \
-	$(top_srcdir)/m4/ax_boost_regex.m4 \
-	$(top_srcdir)/m4/ax_boost_system.m4 \
-	$(top_srcdir)/m4/ax_boost_thread.m4 \
-	$(top_srcdir)/m4/ax_check_zlib.m4 \
-	$(top_srcdir)/m4/ax_lib_expat.m4 $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/config/m4/ax_boost_base.m4 \
+	$(top_srcdir)/config/m4/ax_boost_regex.m4 \
+	$(top_srcdir)/config/m4/ax_boost_thread.m4 \
+	$(top_srcdir)/config/m4/ax_check_zlib.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_std.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_stl.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_namespaces.m4 \
+	$(top_srcdir)/config/m4/ax_lib_expat.m4 \
+	$(top_srcdir)/config/m4/ax_with_perl.m4 \
+	$(top_srcdir)/config/m4/ax_with_prog.m4 \
+	$(top_srcdir)/config/m4/libtool.m4 \
+	$(top_srcdir)/config/m4/ltoptions.m4 \
+	$(top_srcdir)/config/m4/ltsugar.m4 \
+	$(top_srcdir)/config/m4/ltversion.m4 \
+	$(top_srcdir)/config/m4/lt~obsolete.m4 \
+	$(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -60,7 +66,6 @@ RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
 	install-pdf-recursive install-ps-recursive install-recursive \
 	installcheck-recursive installdirs-recursive pdf-recursive \
 	ps-recursive uninstall-recursive
-HEADERS = $(noinst_HEADERS)
 RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
   distclean-recursive maintainer-clean-recursive
 AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
@@ -105,13 +110,9 @@ AWK = @AWK@
 BITPACKAGE = @BITPACKAGE@
 BLOODYDARWINSTATLIBDIRHACK = @BLOODYDARWINSTATLIBDIRHACK@
 BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
-BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@
-BOOST_IOSTREAMS_LIB = @BOOST_IOSTREAMS_LIB@
 BOOST_LDFLAGS = @BOOST_LDFLAGS@
 BOOST_REGEX_LIB = @BOOST_REGEX_LIB@
-BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@
 BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
-BUNDLETARGET = @BUNDLETARGET@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
@@ -124,7 +125,6 @@ CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -134,13 +134,11 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LDFLAGS = @EXPAT_LDFLAGS@
-EXPAT_LIBS = @EXPAT_LIBS@
 EXPAT_VERSION = @EXPAT_VERSION@
 FGREP = @FGREP@
 FLEX = @FLEX@
 FLEXPP = @FLEXPP@
 GREP = @GREP@
-HAVE_XXD = @HAVE_XXD@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -158,7 +156,6 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
 MIRASTATIC = @MIRASTATIC@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
@@ -175,17 +172,18 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
+SHORTMIRAAUDIENCE = @SHORTMIRAAUDIENCE@
 STRIP = @STRIP@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -219,6 +217,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -234,26 +233,8 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-GITBUILD = `$(top_srcdir)/build-aux/git-version-gen $(top_srcdir)/.tarball-version`
-noinst_HEADERS = version.H
-BUILT_SOURCES = version.H
-EXTRA_DIST = version.stub
-SUBDIRS = \
-	debuggersupport\
-	io\
-	stdinc\
-	errorhandling\
-	util\
-	mira\
-	caf\
-	memorc\
-	modules\
-	progs\
-	support\
-	scripts
-
-all: $(BUILT_SOURCES)
-	$(MAKE) $(AM_MAKEFLAGS) all-recursive
+SUBDIRS = lec io stdinc errorhandling util mira EdIt caf examine knn_abi373 knn_alf examples_programming progs support scripts test
+all: all-recursive
 
 .SUFFIXES:
 $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
@@ -487,13 +468,11 @@ distdir: $(DISTFILES)
 	  fi; \
 	done
 check-am: all-am
-check: $(BUILT_SOURCES)
-	$(MAKE) $(AM_MAKEFLAGS) check-recursive
-all-am: Makefile $(HEADERS)
+check: check-recursive
+all-am: Makefile
 installdirs: installdirs-recursive
 installdirs-am:
-install: $(BUILT_SOURCES)
-	$(MAKE) $(AM_MAKEFLAGS) install-recursive
+install: install-recursive
 install-exec: install-exec-recursive
 install-data: install-data-recursive
 uninstall: uninstall-recursive
@@ -503,15 +482,10 @@ install-am: all-am
 
 installcheck: installcheck-recursive
 install-strip:
-	if test -z '$(STRIP)'; then \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	      install; \
-	else \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-	fi
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
 mostlyclean-generic:
 
 clean-generic:
@@ -523,7 +497,6 @@ distclean-generic:
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
 	@echo "it deletes files that may require special tools to rebuild."
-	-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
 clean: clean-recursive
 
 clean-am: clean-generic clean-libtool mostlyclean-am
@@ -590,9 +563,8 @@ ps-am:
 
 uninstall-am:
 
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all check \
-	ctags-recursive install install-am install-strip \
-	tags-recursive
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
+	install-am install-strip tags-recursive
 
 .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
 	all all-am check check-am clean clean-generic clean-libtool \
@@ -609,24 +581,6 @@ uninstall-am:
 	uninstall uninstall-am
 
 
-target_not_existing_always_run:
-	@echo >/dev/null
-
-version.H: version.stub target_not_existing_always_run
-	@cp version.stub version.H
-	@echo \#define GITBUILD \"${GITBUILD}\" >>version.H
-	@echo \#define MIRALIBVERSION GITBUILD >>version.H
-	@echo \#define MIRAVERSION MIRALIBVERSION \" \" MLV_QUIET MLV_TIME\"\" >>version.H
-
-#	test\
-#	EdIt\
-#	examine\
-#	knn_abi373\
-#	knn_alf\
-#
-#	examples_programming\
-#
-
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/src/caf/Makefile.am b/src/caf/Makefile.am
index bce1bb8..a3344a9 100644
--- a/src/caf/Makefile.am
+++ b/src/caf/Makefile.am
@@ -1,8 +1,7 @@
-AM_CPPFLAGS = -I$(top_srcdir)/src $(all_includes)
-
-clean-local:
-	rm -rf *flexer.cc
+INCLUDES = -I$(top_srcdir)/src $(all_includes)
 
 noinst_LIBRARIES = libmiracaf.a
 libmiracaf_a_SOURCES= caf.C caf_flexer.ll
 noinst_HEADERS= caf.H caf_tokens.h
+
+
diff --git a/src/caf/Makefile.in b/src/caf/Makefile.in
index 68a481e..f3086f7 100644
--- a/src/caf/Makefile.in
+++ b/src/caf/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -39,14 +39,22 @@ subdir = src/caf
 DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in caf_flexer.cc
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/ax_boost_base.m4 \
-	$(top_srcdir)/m4/ax_boost_filesystem.m4 \
-	$(top_srcdir)/m4/ax_boost_iostreams.m4 \
-	$(top_srcdir)/m4/ax_boost_regex.m4 \
-	$(top_srcdir)/m4/ax_boost_system.m4 \
-	$(top_srcdir)/m4/ax_boost_thread.m4 \
-	$(top_srcdir)/m4/ax_check_zlib.m4 \
-	$(top_srcdir)/m4/ax_lib_expat.m4 $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/config/m4/ax_boost_base.m4 \
+	$(top_srcdir)/config/m4/ax_boost_regex.m4 \
+	$(top_srcdir)/config/m4/ax_boost_thread.m4 \
+	$(top_srcdir)/config/m4/ax_check_zlib.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_std.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_stl.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_namespaces.m4 \
+	$(top_srcdir)/config/m4/ax_lib_expat.m4 \
+	$(top_srcdir)/config/m4/ax_with_perl.m4 \
+	$(top_srcdir)/config/m4/ax_with_prog.m4 \
+	$(top_srcdir)/config/m4/libtool.m4 \
+	$(top_srcdir)/config/m4/ltoptions.m4 \
+	$(top_srcdir)/config/m4/ltsugar.m4 \
+	$(top_srcdir)/config/m4/ltversion.m4 \
+	$(top_srcdir)/config/m4/lt~obsolete.m4 \
+	$(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -71,9 +79,9 @@ CXXLD = $(CXX)
 CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	--mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
 	$(LDFLAGS) -o $@
-LEXCOMPILE = $(LEX) $(AM_LFLAGS) $(LFLAGS)
+LEXCOMPILE = $(LEX) $(LFLAGS) $(AM_LFLAGS)
 LTLEXCOMPILE = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=compile $(LEX) $(AM_LFLAGS) $(LFLAGS)
+	--mode=compile $(LEX) $(LFLAGS) $(AM_LFLAGS)
 YLWRAP = $(top_srcdir)/ylwrap
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -100,13 +108,9 @@ AWK = @AWK@
 BITPACKAGE = @BITPACKAGE@
 BLOODYDARWINSTATLIBDIRHACK = @BLOODYDARWINSTATLIBDIRHACK@
 BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
-BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@
-BOOST_IOSTREAMS_LIB = @BOOST_IOSTREAMS_LIB@
 BOOST_LDFLAGS = @BOOST_LDFLAGS@
 BOOST_REGEX_LIB = @BOOST_REGEX_LIB@
-BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@
 BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
-BUNDLETARGET = @BUNDLETARGET@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
@@ -119,7 +123,6 @@ CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -129,13 +132,11 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LDFLAGS = @EXPAT_LDFLAGS@
-EXPAT_LIBS = @EXPAT_LIBS@
 EXPAT_VERSION = @EXPAT_VERSION@
 FGREP = @FGREP@
 FLEX = @FLEX@
 FLEXPP = @FLEXPP@
 GREP = @GREP@
-HAVE_XXD = @HAVE_XXD@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -153,7 +154,6 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
 MIRASTATIC = @MIRASTATIC@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
@@ -170,17 +170,18 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
+SHORTMIRAAUDIENCE = @SHORTMIRAAUDIENCE@
 STRIP = @STRIP@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -214,6 +215,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -229,7 +231,7 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-AM_CPPFLAGS = -I$(top_srcdir)/src $(all_includes)
+INCLUDES = -I$(top_srcdir)/src $(all_includes)
 noinst_LIBRARIES = libmiracaf.a
 libmiracaf_a_SOURCES = caf.C caf_flexer.ll
 noinst_HEADERS = caf.H caf_tokens.h
@@ -270,7 +272,7 @@ $(am__aclocal_m4_deps):
 
 clean-noinstLIBRARIES:
 	-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
-libmiracaf.a: $(libmiracaf_a_OBJECTS) $(libmiracaf_a_DEPENDENCIES) $(EXTRA_libmiracaf_a_DEPENDENCIES) 
+libmiracaf.a: $(libmiracaf_a_OBJECTS) $(libmiracaf_a_DEPENDENCIES) 
 	-rm -f libmiracaf.a
 	$(libmiracaf_a_AR) libmiracaf.a $(libmiracaf_a_OBJECTS) $(libmiracaf_a_LIBADD)
 	$(RANLIB) libmiracaf.a
@@ -431,15 +433,10 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	if test -z '$(STRIP)'; then \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	      install; \
-	else \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-	fi
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
 mostlyclean-generic:
 
 clean-generic:
@@ -454,8 +451,8 @@ maintainer-clean-generic:
 	-rm -f caf_flexer.cc
 clean: clean-am
 
-clean-am: clean-generic clean-libtool clean-local \
-	clean-noinstLIBRARIES mostlyclean-am
+clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
+	mostlyclean-am
 
 distclean: distclean-am
 	-rm -rf ./$(DEPDIR)
@@ -526,22 +523,18 @@ uninstall-am:
 .MAKE: install-am install-strip
 
 .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
-	clean-libtool clean-local clean-noinstLIBRARIES ctags \
-	distclean distclean-compile distclean-generic \
-	distclean-libtool distclean-tags distdir dvi dvi-am html \
-	html-am info info-am install install-am install-data \
-	install-data-am install-dvi install-dvi-am install-exec \
-	install-exec-am install-html install-html-am install-info \
-	install-info-am install-man install-pdf install-pdf-am \
-	install-ps install-ps-am install-strip installcheck \
-	installcheck-am installdirs maintainer-clean \
-	maintainer-clean-generic mostlyclean mostlyclean-compile \
-	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
-	tags uninstall uninstall-am
-
-
-clean-local:
-	rm -rf *flexer.cc
+	clean-libtool clean-noinstLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-strip installcheck installcheck-am installdirs \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+	pdf pdf-am ps ps-am tags uninstall uninstall-am
+
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/src/caf/caf.C b/src/caf/caf.C
index 09f884a..f3a2413 100644
--- a/src/caf/caf.C
+++ b/src/caf/caf.C
@@ -26,16 +26,16 @@
  *
  * Written by Thomas Pfisterer 13.08.1998
  *
- * Load a CAF-File
+ * Load a CAF-File      
  * Create a CAF-Object. This Object can load CAF-Files via the load
  * method. Reads and Contigs from the CAF-file are stored in the readpool
  * and the contig-list.
  *
- *
- * 10.05.99  Some missing keywords added (stolen, asped, dye, processStatus,
+ * 
+ * 10.05.99  Some missing keywords added (stolen, asped, dye, processStatus, 
  *           primer)
  * 22.06.99  Error with "Primer" keyword fixed
- * 27.07.99  Flex is now using environments; handling for comments improved
+ * 27.07.99  Flex is now using environments; handling for comments improved 
  *           (problem with '\n' fixed) 0.91
  * 13.08.99  Using environments in flex for most keword constructions (0.92)
  * 15.09.99  Scanner uses \0 to detect non-caf files
@@ -47,19 +47,22 @@
 
 
 #include "caf/caf_tokens.h"
-#include "caf/caf.H"
+#include "caf.H"
+#include "stdlib.h"
+#include <string.h>
 
-#include "io/annotationmappings.H"
-#include "util/dptools.H"
 
+// 	$Id$	
 
+#ifndef lint
+static char vcid[] = "$Id$";
+#endif /* lint */
 
-using namespace std;
 
 
 void showIntervall(caf_intervall i, ostream &output)
 {
-  output << "[" << i.leftBorder << "; " << i.rightBorder << "] ";
+  output << "[" << i.leftBorder << "; " << i.rightBorder << "] "; 
 }
 
 
@@ -76,13 +79,13 @@ void showIntervallList(list<caf_intervall> l, ostream &output)
 }
 
 
-caf_intervall schnittmenge(caf_intervall a, caf_intervall b)
+caf_intervall schnittmenge(caf_intervall a, caf_intervall b) 
 {
   caf_intervall schnittmenge;
 
   // works also if one of the borders is open (i.e. -1)
   schnittmenge.leftBorder  = max(a.leftBorder, b.leftBorder);
-
+  
   // if one of the borders is open, the other is the new border and the max
   if (a.rightBorder >= 0 &&  b.rightBorder >= 0) {
     schnittmenge.rightBorder = min(a.rightBorder, b.rightBorder);
@@ -93,7 +96,7 @@ caf_intervall schnittmenge(caf_intervall a, caf_intervall b)
       schnittmenge.rightBorder = a.rightBorder;
     }
   }
-
+  
 
   // showIntervall(a, cout); showIntervall(b, cout);
   // cout << " => ";
@@ -105,11 +108,11 @@ caf_intervall schnittmenge(caf_intervall a, caf_intervall b)
 
 
 
-bool intervall_leer(caf_intervall a)
+bool intervall_leer(caf_intervall a) 
 {
   // if one of the borders is open, the intervall is not empty
   if (a.leftBorder < 0 || a.rightBorder < 0) {
-    return false;
+    return false; 
   }
   return (a.leftBorder > a.rightBorder);
 }
@@ -120,13 +123,11 @@ bool intervall_leer(caf_intervall a)
 
 
 
-CAF::CAF(ReadPool * aPool, list<Contig> * aContiglist, vector<MIRAParameters> * mp)
-{
-  setNewContainers(aPool, aContiglist, mp);
-
-  CAF_piptr=nullptr;
-  CAF_lexer=nullptr;
-
+CAF::CAF(ReadPool &aPool, list<Contig> &aContiglist, vector<MIRAParameters> * mp) {
+  thePool    = &aPool;
+  theContigs = &aContiglist;
+  CAF_miraparams = mp;
+  
   CAF_isPadded = -1;
   CAF_insert_size_min = -1;
   CAF_insert_size_max = -1;
@@ -142,19 +143,8 @@ CAF::~CAF() {
 }
 
 
-void CAF::setNewContainers(ReadPool * rpool, list<Contig> * clist, vector<MIRAParameters> * mp)
-{
-  FUNCSTART("void CAF::setNewContainers(ReadPool * rpool, list<Contig> * clist, vector<MIRAParameters> * mp)");
-
-  BUGIFTHROW(rpool==nullptr,"rpool==nullptr???");
-  BUGIFTHROW(clist!=nullptr && mp==nullptr,"clist!=nullptr && mp==nullptr???");
 
-  CAF_readpool   = rpool;
-  CAF_clist = clist;
-  CAF_miraparams = mp;
-}
-
-void CAF::setStrictSeqVector(bool strict)
+void CAF::setStrictSeqVector(bool strict) 
 {
   strict_seq_vector = strict;
 }
@@ -174,26 +164,21 @@ void CAF::discard() {
   CAF_stolen.clear();
   CAF_clone.clear();
   CAF_sequencing_vector.clear();
-
+  
   cleanupContig();
-
-  if(CAF_lexer!=nullptr) delete CAF_lexer;
-  if(CAF_piptr!=nullptr) delete CAF_piptr;
-  CAF_lexer=nullptr;
-  CAF_piptr=nullptr;
-  CAF_token=1; // CAF_token==0 is used as EOF
 }
 
 
 void CAF::cleanupContig() {
   cleanup();
   CAF_assembledFrom.clear();
+  CAF_max_contig_length = 0;  
 }
 
 
 void CAF::cleanup() {
   caf_intervall i;
-
+  
   CAF_type   = caftype_unknown;
   CAF_dye    = DYE_UNDEFINED;
   CAF_length = 0;
@@ -216,7 +201,7 @@ void CAF::cleanup() {
   CAF_unprocessed.clear();
   CAF_taglist.clear();
   CAF_assembledFrom.clear();
-
+  
   CAF_no_seq_intervall.clear();
   i.leftBorder = -1;
   i.rightBorder = -1;
@@ -238,6 +223,11 @@ void CAF::cleanup() {
 
 
 
+char* CAF::getVersion() {
+  return vcid;
+}
+
+
 // ------------------------------------------------
 //      Main-loop for consuming the CAF-file
 // ------------------------------------------------
@@ -248,24 +238,24 @@ void CAF::cleanup() {
 caf_token CAF::readToken() {
 
   if (reReadToken == 0) {
-    CAF_token = static_cast<caf_token>(CAF_lexer->yylex());
+    token = static_cast<caf_token>(lexer->yylex());
   }
 
   if (verbose && reReadToken == 0) {
-    cout << "Read Token: " << static_cast<int32>(CAF_token) << " "
-	 << CAF_lexer->YYText() << endl;
+    cout << "Read Token: " << static_cast<int32>(token) << " " 
+	 << lexer->YYText() << endl;
   }
 
   reReadToken = 0;
 
-  return CAF_token;
+  return token;
 }
 
 
 // Load the CAF-File fileName into the ReadPool and the Contig-List of the
 // CAF_object.
 
-size_t CAF::countReadsBeforeLoad(const string & fileName)
+size_t CAF::countReadsBeforeLoad(const string & fileName) 
 {
   FUNCSTART("void CAF::countReadsBeforeLoad()");
 
@@ -275,7 +265,7 @@ size_t CAF::countReadsBeforeLoad(const string & fileName)
 
   cafin.open(fileName.c_str(), ios::in|ios::ate);
   if(!cafin) {
-    MIRANOTIFY(Notify::FATAL, "CAF file not found for loading: " << fileName);
+    MIRANOTIFY(Notify::FATAL, "CAF file not found for loading: " << fileName); 
   }
   if(!cafin.tellg() ) {
     MIRANOTIFY(Notify::FATAL, "CAF file is empty: " << fileName);
@@ -314,143 +304,105 @@ size_t CAF::countReadsBeforeLoad(const string & fileName)
 }
 
 
-
-void CAF::registerFile(const string & fileName)
-{
-  FUNCSTART("void CAF::registerFile(const string & fileName)");
-
-  cleanupContig();
-
-  CAF_ccallbackfunc=nullptr;
-  CAF_rcallbackfunc=nullptr;
-  CAF_filename=fileName;
-  CAF_recalcconsensus=false; // TODO!
-
-  if(CAF_fin.is_open()) CAF_fin.close();
-
-  CAF_fin.open(CAF_filename, ios::in);
-  if(!CAF_fin) {
-    MIRANOTIFY(Notify::FATAL, "CAF file " << CAF_filename << " not found for loading.");
-  }
-  auto fs=getFileSize(fileName);
-  if(fs==0) {
-    MIRANOTIFY(Notify::FATAL, "CAF file " << CAF_filename << " is empty.");
-  }
-  if(CAF_piptr!=nullptr) CAF_piptr->reset(0,fs);
-
-  if(CAF_lexer!=nullptr) delete CAF_lexer;
-  CAF_lexer = new CAFFlexLexer(&CAF_fin);
-  if (CAF_lexer == nullptr) {
-    MIRANOTIFY(Notify::FATAL, "Unable to create flexer!");
-  }
-
-  CAF_token=1; // CAF_token==0 is used as EOF
-
-  CAF_defaultseqtype=0;
-  CAF_lrperseqtype.clear();
-  CAF_lrperseqtype.resize(ReadGroupLib::SEQTYPE_END,0);
-
-  verbose=false;
-  CAF_listofreadnames.clear();
-  CAF_hashedreadnames.clear();
-  reReadToken = 0;
-}
-
-
-void CAF::setProgressIndicator(bool b)
-{
-  if(b && CAF_piptr==nullptr){
-    uint64 ms=1;
-    if(CAF_fin.is_open()) ms=getFileSize(CAF_filename);
-    CAF_piptr= new ProgressIndicator<int64>(0, ms,5000);
-  }else if(!b && CAF_piptr!=nullptr){
-    delete CAF_piptr;
-  }
-}
-
-
 /*
   seqtype = default seqtype of sequences if not encoded in the CAF
   loadaction:
     //  0 = count only
-    //  1 = load
+    //  1 = count, adjust readpool capacity and load
+    //  2 = load only
   lrperseqtype = longest read per seqtype
 
   returns:
     1) number of sequences loaded
-    2) if loading: size of longest read per seqtype in lrperseqtype
+    2) a) if loadaction = 0 and lrperseqtype empty: nothing more
+       b) else size of longest read per seqtype in lrperseqtype
  */
-size_t CAF::load(const string & fileName, const uint8 seqtype, const uint8 loadaction, vector<uint32> & lrperseqtype, bool recalcconsensus, void (*ccallback)(list<Contig> &, ReadPool &), void (*rcallback)(ReadPool &), bool isVerbose)
+size_t CAF::load(const string & fileName, const uint8 seqtype, const uint8 loadaction, vector<uint32> & lrperseqtype, bool recalcconsensus, void  (*callback)(list<Contig> &, ReadPool &), bool isVerbose) 
 {
   FUNCSTART("void CAF::load()");
 
-  BUGIFTHROW(loadaction>1,"loadaction>1??");
+  //cout << "gnuuu: " << lrperseqtype.size() << endl;
+  //cout << (uint16) loadaction << endl;
+
+  CAF_simulateloading=false;
+
+  theCallback=callback;
+  CAF_recalcconsensus=recalcconsensus;
 
   size_t numseqsloaded=0;
-  if(loadaction==0){
-    cout << "Counting reads:\n";
+  if(loadaction<2){
+    cout << "First counting reads:\n";
     numseqsloaded=countReadsBeforeLoad(fileName);
-    return numseqsloaded;
-  }
 
-  //cout << "gnuuu: " << lrperseqtype.size() << endl;
-  //cout << (uint16) loadaction << endl;
+    if(loadaction==0){
+      if(lrperseqtype.empty()) return numseqsloaded;
+      CAF_simulateloading=true;
+    }
 
-  registerFile(fileName);
+    if(loadaction==1) thePool->reserve(thePool->size()+numseqsloaded+10);
+  }
 
-  CAF_ccallbackfunc=ccallback;
-  CAF_rcallbackfunc=rcallback;
-  CAF_recalcconsensus=recalcconsensus;
+  numseqsloaded=0;
 
-  cout << "\nLoading CAF " << fileName << " :\n";
+  if(CAF_simulateloading){
+    cout << "\nNow simulating loading of data:\n";
+  }else{
+    cout << "\nNow loading and processing data:\n";
+  }
 
   CAF_defaultseqtype=seqtype;
+  CAF_lrperseqtype.clear();
+  CAF_lrperseqtype.resize(Read::SEQTYPE_END,0);
 
   verbose = isVerbose;
   //verbose=true;
 
-  loadNextSeqs(-1,-1);
+  CAF_listofreadnames.clear();
+  CAF_hashedreadnames.clear();
 
-  createCafObject();
-  delete CAF_lexer;
-  CAF_lexer=nullptr;
+  ifstream cafFile;
 
-  lrperseqtype=CAF_lrperseqtype;
+  cafFile.open(fileName.c_str(), ios::in|ios::ate);
+  if(!cafFile) {
+    MIRANOTIFY(Notify::FATAL, "CAF file not found for loading: " << fileName); 
+  }
+  if(!cafFile.tellg() ) {
+    MIRANOTIFY(Notify::FATAL, "CAF file is empty: " << fileName);
+  }
 
-  FUNCEND();
-  return CAF_numseqsloaded;
-}
+  ProgressIndicator<streamsize> P(0, cafFile.tellg(),5000);
 
-uint64 CAF::loadNextSeqs(uint64 numseqstoload,uint64 numconstoload)
-{
-  FUNCSTART("uint64 CAF::loadNextSeqs(uint64 numseqstoload,uint64 numconstoload)");
+  cafFile.seekg(0, ios::beg);
 
-  BUGIFTHROW(CAF_lexer==nullptr,"CAF_lexer==nullptr???")
+  lexer = new CAFFlexLexer(&cafFile);
+  if (lexer == NULL) {
+    MIRANOTIFY(Notify::WARNING, "Unable to create flexer!");
+  }
 
-  CAF_numseqsloaded=0;
-  CAF_numconsloaded=0;
+  reReadToken = 0;
 
-  while((numconstoload==0 || CAF_numconsloaded<numconstoload) && (numseqstoload==0 || CAF_numseqsloaded<numseqstoload)){
-    CAF_token = readToken();
-    if(CAF_token==0) break;
 
-    if(CAF_piptr!=nullptr && CAF_piptr->delaytrigger()) CAF_piptr->progress(CAF_fin.tellg());
+  while(0 != (token = readToken())) {
+    if(P.delaytrigger()) P.progress(cafFile.tellg());
 
-    switch(CAF_token) {
+    switch(token) {
 
     case token_sequencename:  {
       getCafReadname();
       CAF_type = caftype_read;   break;
     }
-    case token_type_read:     CAF_type = caftype_read;   break;
+    case token_type_read:{
+      numseqsloaded++;
+      CAF_type = caftype_read;   break;
+    }
     case token_type_contig:   CAF_type = caftype_contig; break;
     case token_type_assembly: CAF_type = caftype_assembly; break;
-    case token_type_group:    CAF_type = caftype_group;    break;
+    case token_type_group:    CAF_type = caftype_group;    break;  
     case token_padded:        CAF_isPadded = true; break;
     case token_unpadded:      CAF_isPadded = false; break;
-    case token_pstatus:       getCafProcessStatus(); break;
-    case token_asped:         getCafAspedDate();  break;
-    case token_dye:           getCafDye();        break;
+    case token_pstatus:       getCafProcessStatus(); break;  
+    case token_asped:         getCafAspedDate();  break;  
+    case token_dye:           getCafDye();        break;  
     case token_scf_file:      getCafSCFFile();    break;
     case token_primer:        getCafPrimer();     break;
     case token_template:      getCafTemplate();   break;
@@ -460,9 +412,9 @@ uint64 CAF::loadNextSeqs(uint64 numseqstoload,uint64 numconstoload)
     case token_forward:       CAF_strand_given = 1; break;
     case token_reverse:       CAF_strand_given = -1; break;
     case token_base_caller:   getCafBaseCaller();   break;
-    case token_seq_vector:    getCafSeqVector();    break;
+    case token_seq_vector:    getCafSeqVector();    break;  
     case token_sequencing_vector: getCafSequencingVector(); break;
-    case token_clone_vector:  getCafCloneVector();  break;
+    case token_clone_vector:  getCafCloneVector();  break;  
     case token_clipping:      getCafClipping();   break;
     case token_sequence:      getCafSequence();   break;
     case token_dna:           getCafDNA();        break;
@@ -473,21 +425,26 @@ uint64 CAF::loadNextSeqs(uint64 numseqstoload,uint64 numconstoload)
     case token_staden_id:     getCafStadenId();    break;
     case token_clone:         getCafClone();       break;
     case token_error:         {
-      cerr << "ARGH!: " << CAF_lexer->YYText() << endl;
-      throw  Notify(Notify::FATAL,
+      cerr << "ARGH!: " << lexer->YYText() << endl;
+      throw  Notify(Notify::FATAL, 
 		    "CAF::load(const char *filename, bool isVerbose)",
 		    "Illegal character in CAF-file!");
     }
-    default: addUnprocessed();
-    }
+    default: addUnprocessed();  
+    } 
   }
 
-  if(CAF_token==0 && CAF_piptr!=nullptr) {
-    CAF_piptr->finishAtOnce();
-    cout << endl;
-  }
+  createCafObject();
+  delete lexer; 
 
-  return CAF_numseqsloaded;
+  P.finishAtOnce();
+  cout << endl;
+
+  lrperseqtype=CAF_lrperseqtype;
+
+  FUNCEND();
+
+  return numseqsloaded;
 }
 
 
@@ -503,7 +460,7 @@ caf_token CAF::getNextToken() {
 
   FUNCSTART("CAF::getNextToken()");
 
-  new_token = static_cast<caf_token>(CAF_lexer->yylex());
+  new_token = static_cast<caf_token>(lexer->yylex());
   if (new_token == 0) {
     MIRANOTIFY(Notify::FATAL, "Unexpected end of CAF-File");
   }
@@ -513,19 +470,19 @@ caf_token CAF::getNextToken() {
 }
 
 
-// Read an identifier or a quoted text; allocate memory for it and return
-// a pointer to the text
-
-string CAF::getText()
+// Read an identifier or a quoted text; allocate memory for it and return 
+// a pointer to the text 
+ 
+string CAF::getText() 
 {
   string name;
-
+  
   FUNCSTART("CAF::getText()");
-
-  CAF_token = getNextToken();
-  if (CAF_token == token_identifier  ||
-      CAF_token == token_quoted_text) {
-    name = CAF_lexer->YYText();
+ 
+  token = getNextToken();
+  if (token == token_identifier  || 
+      token == token_quoted_text) {
+    name = lexer->YYText();
     deescapeString(name);
 
     FUNCEND();
@@ -540,47 +497,47 @@ string CAF::getText()
 // Read an identifier and allocate memory for it; return pointer to
 // text.
 
-char * CAF::getIdentifier()
+char * CAF::getIdentifier() 
 {
   caf_token new_token;
   char *name;
-
+  
   FUNCSTART("CAF::getIdentifier()");
-
+  
   new_token = getNextToken();
 
   if (new_token == token_identifier || new_token == token_number) {
-    name = new char[CAF_lexer->YYLeng() + 1];
-    // why is valgrind moaning on strlen(CAF_lexer->YYText()) here?
-    //cout << "Token string (" << CAF_lexer->YYLeng() << "): " << CAF_lexer->YYText() << endl;
-    //cout << (char) CAF_lexer->YYText()[0];
-    //cout << (char) CAF_lexer->YYText()[1];
-    //cout << (char) CAF_lexer->YYText()[2];
-    //cout << (char) CAF_lexer->YYText()[3];
-    //cout << (char) CAF_lexer->YYText()[4];
-    //cout << (char) CAF_lexer->YYText()[5];
-    //cout << (char) CAF_lexer->YYText()[6];
-    //cout << (char) CAF_lexer->YYText()[7];
-    //cout << (char) CAF_lexer->YYText()[8];
-    //cout << (char) CAF_lexer->YYText()[9];
-    //cout << (char) CAF_lexer->YYText()[10];
-    //cout << (char) CAF_lexer->YYText()[11];
-    //cout << (char) CAF_lexer->YYText()[12];
-    //cout << (char) CAF_lexer->YYText()[13];
-    //cout << (char) CAF_lexer->YYText()[14];
-    //cout << (char) CAF_lexer->YYText()[15];
-    //cout << (char) CAF_lexer->YYText()[16];
-    //cout << strlen(CAF_lexer->YYText()) << endl;
-    strcpy(name, CAF_lexer->YYText());
+    name = new char[lexer->YYLeng() + 1];
+    // why is valgrind moaning on strlen(lexer->YYText()) here?
+    //cout << "Token string (" << lexer->YYLeng() << "): " << lexer->YYText() << endl;
+    //cout << (char) lexer->YYText()[0];
+    //cout << (char) lexer->YYText()[1];
+    //cout << (char) lexer->YYText()[2];
+    //cout << (char) lexer->YYText()[3];
+    //cout << (char) lexer->YYText()[4];
+    //cout << (char) lexer->YYText()[5];
+    //cout << (char) lexer->YYText()[6];
+    //cout << (char) lexer->YYText()[7];
+    //cout << (char) lexer->YYText()[8];
+    //cout << (char) lexer->YYText()[9];
+    //cout << (char) lexer->YYText()[10];
+    //cout << (char) lexer->YYText()[11];
+    //cout << (char) lexer->YYText()[12];
+    //cout << (char) lexer->YYText()[13];
+    //cout << (char) lexer->YYText()[14];
+    //cout << (char) lexer->YYText()[15];
+    //cout << (char) lexer->YYText()[16];
+    //cout << strlen(lexer->YYText()) << endl;
+    strcpy(name, lexer->YYText());
 
     return name;
   }
 
   cout << "Token found: " << new_token << endl;
-  cout << "Token string: " << CAF_lexer->YYText() << endl;
+  cout << "Token string: " << lexer->YYText() << endl;
   //delete [] name;
   MIRANOTIFY(Notify::FATAL, ": Expected Name");
-
+ 
   FUNCEND();
 
 }
@@ -598,10 +555,10 @@ string CAF::getReadname(const string old_name) {
   new_name = getIdentifier();
 
   if (new_name.empty()) {
-    return "";
+    return "";  
   }
 
-  if (old_name.empty())
+  if (old_name.empty()) 
     return new_name;
 
   if (new_name!=old_name) {
@@ -611,7 +568,7 @@ string CAF::getReadname(const string old_name) {
 
     createCafObject();
 
-    return new_name;
+    return new_name;  
   }
 
   return old_name;
@@ -620,19 +577,19 @@ string CAF::getReadname(const string old_name) {
 
 // Reads two numbers an throws an exception if there are any problems.
 
-int32 CAF::get2Numbers(int32 &x1, int32 &x2)
+int32 CAF::get2Numbers(int32 &x1, int32 &x2) 
 {
   FUNCSTART("CAF::get2Numbers()");
 
-  if (token_number == CAF_token || token_quoted_text == CAF_token) {
-    x1 = atoi(CAF_lexer->YYText());
+  if (token_number == token || token_quoted_text == token) {
+    x1 = atoi(lexer->YYText());
   } else {
     MIRANOTIFY(Notify::FATAL, "Expected a number");
   }
 
-  CAF_token = getNextToken();
-  if (token_number == CAF_token || token_quoted_text == CAF_token) {
-    x2 = atoi(CAF_lexer->YYText());
+  token = getNextToken();
+  if (token_number == token || token_quoted_text == token) {
+    x2 = atoi(lexer->YYText());
   } else {
     MIRANOTIFY(Notify::FATAL, "Expected a second number");
   }
@@ -649,11 +606,11 @@ void CAF::addUnprocessed() {
   static int line = 0;
 
   FUNCSTART("CAF::addUnprocessed()");
-  line = CAF_lexer->lineno();
-
-  while (line == CAF_lexer->lineno()) {
-    for (int loop=0; loop<CAF_lexer->YYLeng(); loop++) {
-      CAF_unprocessed.push_back(CAF_lexer->YYText()[loop]);
+  line = lexer->lineno();
+  
+  while (line == lexer->lineno()) {
+    for (int loop=0; loop<lexer->YYLeng(); loop++) {
+      CAF_unprocessed.push_back(lexer->YYText()[loop]);      
     }
     CAF_unprocessed.push_back(' ');
     readToken();
@@ -670,7 +627,7 @@ void CAF::addUnprocessed() {
 //   Behandlung der Schl�sselworte
 // ---------------------------------------
 
-int32 CAF::getCafReadname()
+int32 CAF::getCafReadname() 
 {
   CAF_readname = getReadname(CAF_readname);
 
@@ -729,20 +686,20 @@ int CAF::getCafTemplate()
 }
 
 
-int32 CAF::getCafStadenId()
+int32 CAF::getCafStadenId() 
 {
   caf_token new_token;
 
   FUNCSTART("CAF::getCafStadenId()");
 
-  new_token = static_cast<caf_token>(CAF_lexer->yylex());
+  new_token = static_cast<caf_token>(lexer->yylex());
 
   if (token_number == new_token || token_identifier == new_token || token_quoted_text == new_token) {
-    CAF_staden_id = atoi(CAF_lexer->YYText());
+    CAF_staden_id = atoi(lexer->YYText());
   } else {
-    cout <<CAF_lexer->YYText() << endl;
+    cout <<lexer->YYText() << endl;
     MIRANOTIFY(Notify::FATAL, "Expected a number");
-  }
+  } 
 
   FUNCEND();
   return CAF_staden_id;
@@ -752,7 +709,7 @@ int32 CAF::getCafStadenId()
 int32 CAF::getCafProcessStatus() {
   FUNCSTART("CAF::getCafProcessStatus()");
 
-  CAF_state = getText();
+  CAF_state = getText();    
   FUNCEND();
   return (CAF_state.empty());
 }
@@ -761,7 +718,7 @@ int32 CAF::getCafProcessStatus() {
 int32 CAF::getCafDye() {
   caf_token new_token;
   new_token = getNextToken();
-
+  
   if (new_token == token_dye_primer) {
      CAF_dye = DYE_PRIMER;
      return 0;
@@ -770,27 +727,27 @@ int32 CAF::getCafDye() {
      CAF_dye = DYE_TERMINATOR;
      return 0;
   }
-  return 1;
+  return 1;   
 }
 
 
-int32 CAF::getCafPrimer()
+int32 CAF::getCafPrimer() 
 {
-  CAF_primer = getText();
+   CAF_primer = getText();
 
-  return 0;
+   return 0;
 }
 
 
-int32 CAF::getCafInsertSize()
+int32 CAF::getCafInsertSize() 
 {
-  CAF_token = getNextToken();
-  return get2Numbers(CAF_insert_size_min, CAF_insert_size_max);
+   token = getNextToken();
+   return get2Numbers(CAF_insert_size_min, CAF_insert_size_max);  
 }
 
 
 int32 CAF::getCafLigation()
-{
+{ 
   FUNCSTART("int32 CAF::getCafLigation()");
 
   CAF_ligation = getText();
@@ -820,13 +777,13 @@ int32 CAF::getCafSeqVector()
 
   FUNCSTART("CAF::getCafSeqVector()");
 
-  CAF_token = getNextToken();
-  if (CAF_token == token_identifier || CAF_token == token_state) {
-    CAF_token = getNextToken(); // ignore type
-  }
+  token = getNextToken();
+  if (token == token_identifier || token == token_state) { 
+    token = getNextToken(); // ignore type
+  }  
 
   get2Numbers(dummy_min, dummy_max);
-
+  
   if (dummy_min > dummy_max) swap(dummy_min,dummy_max);
 
   /*
@@ -836,10 +793,10 @@ int32 CAF::getCafSeqVector()
   Bug triggered by 454 data
 
   This was some code which Thomas and I put in to catch broken SVEC
-  tags of the type (assuming a sequence length of, say, 1000): SVEC 3 4
+  tags of the type (assuming a sequence length of, say, 1000): SVEC 3 4  
 
   The lines below assume that no one would tag SVEC with only two bases.
-  Well, 454 does not do it neither, but they currently also do not
+  Well, 454 does not do it neither, but they currently also do not 
   distinguish between QUAL clippings and SVEC clippings. And the
   NCBI therefore sets SVEC *and* QUAL clippings (same values), but this
   results into SVECs with a length of <=2.
@@ -849,23 +806,23 @@ int32 CAF::getCafSeqVector()
   any order of elements in a CAF file. That is, theoretically, "Sequence :"
   (and with it Seq_vec) could appear before "DNA :" or "BaseQuality :" ... and
   then the length of the sequence itself would not be known.
-
+  
   Anyway, I'm taking this out now and define SVECs in the middle of the
   sequence to be "broken" CAF. That is, SVECs that are not reaching to either
-  the left or right border of the sequence are invalid and MIRA not
+  the left or right border of the sequence are invalid and MIRA not 
   responsible for any mishaps that result out of it.
 
   // Ignore SeqVector definitions in the middle of the sequence
-  if (dummy_max - dummy_min < 2 && dummy_min > 1)
+  if (dummy_max - dummy_min < 2 && dummy_min > 1)  
     return 0;
   */
 
   newList.clear();
 
   if (dummy_min == 1) {
-    // We have only one good Intervall [dummy_max...oo]
+    // We have only one good Intervall [dummy_max...oo]    
     caf_intervall neu, schnitt;
-
+  
     neu.leftBorder  = dummy_max;
     neu.rightBorder = -1;
 
@@ -877,7 +834,7 @@ int32 CAF::getCafSeqVector()
       I++;
     }
   } else {
-    // We have the SeqVec Intervalls [0...dummy_min-1] and [dummy_max...oo]
+    // We have the SeqVec Intervalls [0...dummy_min-1] and [dummy_max...oo]  
     caf_intervall neu_links, neu_rechts, schnitt;
 
     neu_links.leftBorder   = 0;
@@ -902,7 +859,7 @@ int32 CAF::getCafSeqVector()
   CAF_no_seq_intervall.swap(newList);
   newList.clear();
 
-  if (verbose) {
+  if (verbose) {  
     cout << endl;
     showIntervallList(CAF_no_seq_intervall, cout);
   }
@@ -914,11 +871,11 @@ int32 CAF::getCafSeqVector()
   }
 
 
-  CAF_token = getNextToken();
-  if (CAF_token != token_quoted_text && CAF_token != token_identifier) {
-    reReadToken = 1;
+  token = getNextToken();
+  if (token != token_quoted_text && token != token_identifier) {
+    reReadToken = 1;   
   } else {
-    reReadToken = 0;
+    reReadToken = 0;    
   }
   FUNCEND();
   return 0;
@@ -928,41 +885,41 @@ int32 CAF::getCafSeqVector()
 
 int32 CAF::getCafCloneVector() {
   int dummy_min, dummy_max;
-
-  CAF_token = getNextToken();
-  //  if (token == token_identifier)
+  
+  token = getNextToken();
+  //  if (token == token_identifier) 
   //   token = getNextToken();  //ignore Type;
 
   get2Numbers(dummy_min, dummy_max);
 
-  if (dummy_min == 1) {
+  if (dummy_min == 1) {   
     CAF_clone_min = dummy_max;
   } else {
     CAF_clone_max = dummy_min - 1;
   }
 
-  CAF_token = getNextToken();
-  if (CAF_token != token_quoted_text && CAF_token != token_identifier) {
+  token = getNextToken();
+  if (token != token_quoted_text && token != token_identifier) {
     reReadToken = 1;
   } else {
 
-    CAF_clone_vector_text = CAF_lexer->YYText();
+    CAF_clone_vector_text = lexer->YYText();
     deescapeString(CAF_clone_vector_text);
   }
   return 0;
 }
 
 
-int32 CAF::getCafClipping() {
+int32 CAF::getCafClipping() {  
   int dummy_min, dummy_max;
 
 
   FUNCSTART("CAF::getCafClipping()");
 
-  CAF_token = getNextToken();
+  token = getNextToken();
 
   get2Numbers(dummy_min, dummy_max);
-
+      
   if (CAF_qual_clip_min == -1 || CAF_qual_clip_min < dummy_min) {
     CAF_qual_clip_min = dummy_min;
   }
@@ -979,15 +936,15 @@ int32 CAF::getCafClipping() {
     CAF_qual_clip_max = 1;
   }
 
-  CAF_token = getNextToken(); // quoted_text
+  token = getNextToken(); // quoted_text
 
   FUNCEND();
   return 0;
 }
 
 // Einlesen der Sequenz. Es wird so lange gelesen, bis ein Schl�sselwort
-// kommt. Der Sequenzname ersetzt einen evtl. vorher gesetzten Namen.
-// Sequenzen die l�nger als MAX_SEQUENCE_LENGTH sind k�nnen nicht eingelesen
+// kommt. Der Sequenzname ersetzt einen evtl. vorher gesetzten Namen. 
+// Sequenzen die l�nger als MAX_SEQUENCE_LENGTH sind k�nnen nicht eingelesen 
 // werden -> Align_to_SCF
 
 int32 CAF::getCafSequence() {
@@ -997,27 +954,27 @@ int32 CAF::getCafSequence() {
     return 1;
   }
 
-  CAF_token = getNextToken();
+  token = getNextToken();
 
   CAF_DNA.clear();
 
-  while (CAF_token == token_identifier) {
+  while (token == token_identifier) {
     // BaCh: added IUPAC bases
-    for (int32 loop = 0; loop < CAF_lexer->YYLeng(); loop++) {
-      if(dptools::isValidIUPACBase(CAF_lexer->YYText()[loop])) {
-	CAF_DNA.push_back((CAF_lexer->YYText())[loop]);
-      }else if((CAF_lexer->YYText())[loop] == '-'){
+    for (int32 loop = 0; loop < lexer->YYLeng(); loop++) {
+      if(dptools::isValidIUPACBase(lexer->YYText()[loop])) {
+	CAF_DNA.push_back((lexer->YYText())[loop]);
+      }else if((lexer->YYText())[loop] == '-'){
 	CAF_DNA.push_back('*');
       }else{
 	CAF_DNA.push_back('N');
       }
     }
-    CAF_token = readToken();
+    token = readToken();
   }
 
   CAF_length = CAF_DNA.size();
 
-  reReadToken = (CAF_token != token_ende);
+  reReadToken = (token != token_ende);
   return 0;
 }
 
@@ -1026,30 +983,30 @@ int32 CAF::getCafSequence() {
 // keine Zahl mehr kommt und das zuviel gelesene Token zur�ckgesetzt und nicht
 // bis eine Leerzeile kommt!
 // Der Sequenzname ersetzt einen evtl. vorher (beim DNA Einlesen) gelesenen
-// Namen.
+// Namen. 
 
 int32 CAF::getCafQuality() {
   CAF_quality.clear();
   CAF_quality.reserve(CAF_length+5);
   CAF_readname = getReadname(CAF_readname);
-  if (CAF_readname.empty())
-    return 1;
+  if (CAF_readname.empty()) 
+    return 1;  
 
-  CAF_token = getNextToken();
+  token = getNextToken();
 
-  while (CAF_token == token_number) {
-    CAF_quality.push_back(static_cast<uint8>(atoi(CAF_lexer->YYText())));
-    CAF_token = getNextToken();
+  while (token == token_number) {
+    CAF_quality.push_back(static_cast<uint8>(atoi(lexer->YYText())));
+    token = getNextToken();
   }
 
-  reReadToken = (CAF_token != token_ende);
+  reReadToken = (token != token_ende);
   return 0;
 }
 
 
 // Verarbeiten einer Align_to_SCF Zeile. Die dort stehede Zuordnung wird
 // in das CAF_align_scf-Array eingetragen. Dies passiert noch bevor die
-// Sequenz �berhaupt gelesen wurde und damit die L�nge ermittelt werden
+// Sequenz �berhaupt gelesen wurde und damit die L�nge ermittelt werden 
 // k�nnte! Daher wird mit einem Array fester Gr��e gearbeitet.
 
 int32 CAF::getCafAlignSCF()
@@ -1061,20 +1018,20 @@ int32 CAF::getCafAlignSCF()
   int scf_iterator = 1;
   int anzahl;
 
-  CAF_token = getNextToken();
+  token = getNextToken();  
   get2Numbers(seq_von, seq_bis);
-  CAF_token = getNextToken();
+  token = getNextToken();
   get2Numbers(scf_von, scf_bis);
 
-  if (seq_bis < seq_von)
+  if (seq_bis < seq_von) 
     seq_iterator = -1;
   if (scf_bis < scf_von)
     scf_iterator = -1;
 
-  if (abs(seq_bis - seq_von) != abs(scf_bis - scf_von)) {
+  if (abs(seq_bis - seq_von) != abs(scf_bis - scf_von)) { 
     return 0;
   }
-
+  
   if (max(seq_von, seq_bis) > static_cast<int32>(CAF_align_scf.size())) {
     CAF_align_scf.resize(max(seq_von, seq_bis), -1);
   }
@@ -1087,7 +1044,7 @@ int32 CAF::getCafAlignSCF()
       cout << "While reading read: " << CAF_readname << endl;
       cout << "While reading line: Align_to_SCF " << seq_von << " " << seq_bis << " " <<scf_von << " " << scf_bis << endl;
       cout << "This makes for an illegal alignment of the sequence to the scf, wrong values in this line?\n";
-      MIRANOTIFY(Notify::FATAL, "Illegal alignment to SCF: " << CAF_readname);
+      MIRANOTIFY(Notify::FATAL, "Illegal alignment to SCF: " << CAF_readname); 
     }
     CAF_align_scf[seqi-1] = scfi - 1;
     seqi += seq_iterator;
@@ -1105,7 +1062,7 @@ int32 CAF::getCafAlignSCF()
  * well, just for the main escaped chars
  *
  *************************************************************************/
-void CAF::deescapeString(string & s)
+void CAF::deescapeString(string & s) 
 {
   uint32 from=0;
   uint32 to=0;
@@ -1155,62 +1112,53 @@ void CAF::deescapeString(string & s)
  *************************************************************************/
 
 int32 CAF::getCafTag() {
-  multitag_t tmptag;
+  tag_t neuer_tag;
   int   tag_von, tag_bis;
 
   FUNCSTART("CAF::getCafTag()");
 
-  CAF_token = getNextToken();
+  token = getNextToken();
 
-  if (CAF_token != token_number) {
-    string tmps(CAF_lexer->YYText());
-    string identifier(AnnotationMappings::translateGAP4feat2SOfeat(tmps));
-    if(identifier.empty()){
-      identifier=AnnotationMappings::translateXGAP4feat2SOfeat(tmps);
-      if(identifier.empty()) identifier=tmps;
-    }
-    tmptag.setIdentifierStr(identifier);
-    CAF_token = getNextToken();
+  if (token != token_number) {
+    neuer_tag.identifier=lexer->YYText();
+    token = getNextToken();
   }
 
   get2Numbers(tag_von, tag_bis);
   // Verarbeite die Positionen
-  tmptag.from = tag_von - 1;
-  tmptag.to   = tag_bis - 1;
+  neuer_tag.from = tag_von - 1;
+  neuer_tag.to   = tag_bis - 1;
 
-  if(tmptag.from>tmptag.to) {
-    tmptag.setStrand('-');
-    swap(tmptag.from, tmptag.to);
+  if(neuer_tag.from>neuer_tag.to) {
+    neuer_tag.strand='-';
+    swap(neuer_tag.from, neuer_tag.to);
   }else{
-    tmptag.setStrand('+');
+    neuer_tag.strand='+';
   }
 
   if (verbose) {
     cout << "Tag Positition: " << tag_von << "-" <<  tag_bis << endl;
   }
 
-  CAF_token = getNextToken();
+  token = getNextToken();
 
-  if (CAF_token == token_quoted_text) {
-    if (CAF_lexer->YYLeng() < 1) {
+  if (token == token_quoted_text) {
+    if (lexer->YYLeng() < 1) {
       reReadToken = 1;
     } else {
-      // Verarbeite Kommentar
-      string tmps(CAF_lexer->YYText());
-      deescapeString(tmps);
-      tmptag.setCommentStr(tmps);
+      // Verarbeite Kommentar    
+      neuer_tag.comment=lexer->YYText();
+      deescapeString(neuer_tag.comment);
     }
   } else {
     if (verbose) {
-      cout << "Read token : " << CAF_token << endl;
-      cout << "YYText: " << CAF_lexer->YYText() << endl;
+      cout << "Read token : " << token << endl;
+      cout << "YYText: " << lexer->YYText() << endl;
     }
     reReadToken = 1;
   }
-
-  multitag_t newtag(tmptag);
-  Read::upgradeOldTagToMultitagWithGFF3(tmptag,newtag);
-  CAF_taglist.push_back(newtag);
+  
+  CAF_taglist.push_back(neuer_tag);  
 
   FUNCEND();
   return 0;
@@ -1227,58 +1175,70 @@ int32 CAF::getCafAssembledFrom()
 
 
   readname = getIdentifier();
-  if (readname == nullptr) return 1;
+  if (readname == NULL) return 1;
 
-  CAF_token = getNextToken();
+  token = getNextToken();  
   get2Numbers(contig_von, contig_bis);
-
+ 
   contigRead = new Contig::contig_init_read_t;
 
   if (contig_von > contig_bis) {
-    richtung = -1;
+    richtung = -1; 
     contigRead->offset_in_contig = contig_bis-1;
+    if (contig_von > CAF_max_contig_length) {
+      CAF_max_contig_length = contig_von; //-1;
+    }
  } else {
     richtung = 1;
     contigRead->offset_in_contig = contig_von-1;
+    if (contig_bis > CAF_max_contig_length) {
+      CAF_max_contig_length = contig_bis;
+    }
   }
 
-  CAF_token = getNextToken();
+  token = getNextToken();
   get2Numbers(read_von, read_bis);
 
-  if (read_von > read_bis) {
-    contigRead->read_rclip = read_von;
-    contigRead->read_lclip = read_bis-1;
-    contigRead->direction = - richtung;
-  } else {
-    contigRead->read_rclip = read_bis;
-    contigRead->read_lclip = read_von-1;
-    contigRead->direction = richtung;
-  }
-
-  try {
-    contigRead->id=-1;
-    {
-      strmap::iterator rnI;
+  if(!CAF_simulateloading){
+    if (read_von > read_bis) {
+      contigRead->read_rclip = read_von;
+      contigRead->read_lclip = read_bis-1;
+      contigRead->direction = - richtung;
+    } else {
+      contigRead->read_rclip = read_bis;
+      contigRead->read_lclip = read_von-1;
+      contigRead->direction = richtung;
+    }
 
-      rnI=CAF_hashedreadnames.find(readname);
-      if(rnI==CAF_hashedreadnames.end()){
-	cerr << "Searched for read " << readname << " but did not find it?" << endl;
-	MIRANOTIFY(Notify::INTERNAL, "Readname not found in hash as expected?"<< readname);
-      }else{
-	contigRead->id=rnI->second;
+    try {
+      // the following is DOG SLOW for larger CAF files
+      //contigRead->id = thePool->getReadIndex(readname);  
+      //
+      
+      contigRead->id=-1;
+      {
+	strmap::iterator rnI;
+
+	rnI=CAF_hashedreadnames.find(readname);
+	if(rnI==CAF_hashedreadnames.end()){
+	  cerr << "Searched for read " << readname << " but did not find it?" << endl;
+	  MIRANOTIFY(Notify::INTERNAL, "Readname not found in hash as expected?"<< readname);
+	}else{
+	  contigRead->id=rnI->second;
+	}
+      }
+      
+      if(contigRead->id < 0) {
+	MIRANOTIFY(Notify::INTERNAL, "Read ID not initialised: " << readname);
       }
-    }
 
-    if(contigRead->id < 0) {
-      MIRANOTIFY(Notify::INTERNAL, "Read ID not initialised: " << readname);
+      CAF_assembledFrom.push_back(*contigRead);
+    }
+    catch(Notify n) {
+      cout << "Unable to find Read in Pool\n";
+      n.handleError("int32 CAF::getCafAssembledFrom()");
+      return 0;
     }
-
-    CAF_assembledFrom.push_back(*contigRead);
-  }
-  catch(Notify n) {
-    cout << "Unable to find Read in Pool\n";
-    n.handleError("int32 CAF::getCafAssembledFrom()");
-    return 0;
   }
 
   delete [] readname;
@@ -1289,7 +1249,7 @@ int32 CAF::getCafAssembledFrom()
 
 
 
-Read & CAF::createCafRead()
+Read & CAF::createCafRead() 
 {
   FUNCSTART("Read & CAF::createCafRead()");
 
@@ -1297,9 +1257,17 @@ Read & CAF::createCafRead()
     cout << "Searching read in pool." << endl;
     cout.flush();
   }
+  
+  // 53K+ reads loading:
+  // 7:09 without, 13:17 with
+  // TODO: change readpool to work with hashed strings?
+  //if (thePool->isInPool(CAF_readname)) {
+  //  throw Notify(Notify::FATAL, "Duplicate readname in CAF file! ", 
+  //		 CAF_readname.c_str());
+  //}
 
   {
-    uint32 readid=CAF_readpool->size();
+    uint32 readid=thePool->size();
     strmap::iterator rnI;
 
     rnI=CAF_hashedreadnames.find(CAF_readname);
@@ -1316,7 +1284,7 @@ Read & CAF::createCafRead()
     cout << "Adding read to pool." << endl;
     cout.flush();
   }
-  Read &aRead = CAF_readpool->getRead(CAF_readpool->provideEmptyRead());
+  Read &aRead = thePool->addNewEmptyRead(); 
   if (verbose) {
     cout << "Read added." << endl;
     cout.flush();
@@ -1324,22 +1292,22 @@ Read & CAF::createCafRead()
 
   if (CAF_length == 0) {
     CAF_length = CAF_DNA.size();
-  }
-
+  } 
+ 
   caf_intervall neu={0,0};
   caf_intervall schnitt=neu;
   list<caf_intervall>::iterator I = CAF_no_seq_intervall.begin();
-
+    
   neu.leftBorder  = CAF_qual_clip_min-1;
   neu.rightBorder = CAF_qual_clip_max;
-
+  
   // Start Version B: Ignore SeqVecs not at the ends
-
+  
   if (false) { // true == strict_seq_vector) {
     caf_intervall alles;
     alles.leftBorder  = neu.rightBorder;
     alles.rightBorder = neu.leftBorder;
-
+    
     while (I != CAF_no_seq_intervall.end()) {
       schnitt = schnittmenge(*I, neu);
       if (!intervall_leer(schnitt)) {
@@ -1350,10 +1318,10 @@ Read & CAF::createCafRead()
       }
       I++;
     }
-
+    
     //showIntervall(alles, cout);
     //cout << endl;
-
+    
     schnitt = schnittmenge(alles, neu);
 
     //showIntervall(schnitt, cout);
@@ -1371,8 +1339,8 @@ Read & CAF::createCafRead()
       schnitt = schnittmenge(*I, neu);
       if (!intervall_leer(schnitt)) break;
       I++;
-    }
-
+    } 
+    
     if (!intervall_leer(schnitt)) {
       CAF_seq_min = I->leftBorder;
       CAF_seq_max = I->rightBorder;
@@ -1397,15 +1365,15 @@ Read & CAF::createCafRead()
 
   if (verbose) {
     cout << "Create Read " << CAF_readname <<endl;
-    cout << "clip left: " << CAF_qual_clip_min -1
+    cout << "clip left: " << CAF_qual_clip_min -1 
 	 << "\t clip right: " << CAF_qual_clip_max << endl;
-    cout << "Seq left:  " << CAF_seq_min
+    cout << "Seq left:  " << CAF_seq_min 
 	 << "\t Seq right : " << CAF_seq_max << endl;
 
-    vector<multitag_t>::iterator J = CAF_taglist.begin();
+    vector<tag_t>::iterator J = CAF_taglist.begin();
     while (J != CAF_taglist.end()) {
       cout << "Tag " << J->from << "  " << J->to << endl;
-      cout << "Comment: " << J->getCommentStr() << endl;
+      cout << "Comment: " << J->comment << endl;
       J++;
     }
     //    dump(cout);
@@ -1425,8 +1393,8 @@ Read & CAF::createCafRead()
 
   // BaCh 25.06.2006
   // actually, a bad bad bad decision, this breaks a number of different
-  //  assertions made by gap4/gap2caf
-  //
+  //  assertions made by gap4/gap2caf 
+  // 
   // Thomas and I seem to have run upon that kind of problem earlier,
   //  the "initialiseContig()" function has traces of tries for resolving
   //  that problem, but there is no real good solution
@@ -1470,202 +1438,154 @@ Read & CAF::createCafRead()
   }
 
   try {
-//    aRead.setReadNamingScheme((*CAF_miraparams)[aRead.getSequencingType()].getAssemblyParams().as_readnaming_scheme);
-
-    // TODO: further adapt to read groups?
-//    if (!CAF_clone_vector_text.empty()) {
-//      aRead.setClonevecName(CAF_clone_vector_text);
-//    }
-//
-//    if (CAF_dye == DYE_PRIMER) {
-//      aRead.setDye("Dye_primer");
-//    }
-//    if (CAF_dye == DYE_TERMINATOR) {
-//      aRead.setDye("Dye_terminator");
-//    }
-//
-
-    string minft_strainname;
-    string minft_seqtypename;
-    string minft_machinetype;
-    int8 minft_splacementcode;
-    bool minft_isbb;
-    bool minft_israil;
-    bool minft_isCER;
-
-    // treat CAF clones as strains
-    if (!CAF_clone.empty() && CAF_clone != "unknown") {
-      minft_strainname=CAF_clone;
-    }
-
-
-    (void) Read::extractMINFTagInfo(CAF_taglist,
-				    CAF_readname,
-				    minft_strainname,
-				    minft_seqtypename,
-				    minft_machinetype,
-				    minft_splacementcode,
-				    minft_isbb,
-				    minft_israil,
-				    minft_isCER);
-
-
-    string dummy_empty;
-
-    uint8 st=ReadGroupLib::stringToSeqType(minft_seqtypename);
-    if(st==ReadGroupLib::SEQTYPE_END) st=ReadGroupLib::SEQTYPE_TEXT;
-
-    ReadGroupLib::ReadGroupID rgid=ReadGroupLib::searchExactRGMatch(
-      dummy_empty,
-      st,
-      CAF_insert_size_min,
-      CAF_insert_size_max,
-      minft_splacementcode,
-      minft_strainname,
-      minft_isbb,
-      minft_israil,
-      minft_isCER,
-      CAF_sequencing_vector,
-      dummy_empty,
-      CAF_base_caller);
-
-    if(rgid.isDefaultNonValidReadGroupID()){
-      rgid=ReadGroupLib::newReadGroup();
-      rgid.setGroupName(dummy_empty);
-      rgid.setSequencingType(st);
-      rgid.setInsizeFrom(CAF_insert_size_min);
-      rgid.setInsizeTo(CAF_insert_size_max);
-      rgid.setSegmentPlacementCode(minft_splacementcode);
-      rgid.setStrainName(minft_strainname);
-      rgid.setBackbone(minft_isbb);
-      rgid.setRail(minft_israil);
-      rgid.setCoverageEquivalentRead(minft_isCER);
-      rgid.setSeqVecName(CAF_sequencing_vector);
-      rgid.setMachineType(minft_machinetype);
-      rgid.setBaseCaller(CAF_base_caller);
-
-      rgid.setCloneVecName(CAF_clone_vector_text);
-      rgid.setPrimer(CAF_primer);
-    }
-
     bool noqual=false;
     if(CAF_quality.empty()){
       noqual=true;
       cout << "WARNING: sequence " << CAF_readname << " in CAF file has no qualities given!\n";
-      CAF_quality.resize(CAF_DNA.size(), rgid.getDefaultQual());
+      CAF_quality.resize(CAF_DNA.size(), (*CAF_miraparams)[0].getAssemblyParams().as_basedefaultqual);
     }
 
-    aRead.initialiseRead(false,
-			 false,
-			 CAF_isPadded,  // bool
-			 rgid,
+    aRead.initialiseRead(false, 
+			 false, 
+			 CAF_isPadded,  // bool 
 			 CAF_DNA, CAF_quality, CAF_align_scf,
 			 CAF_taglist,
 			 CAF_readname, CAF_scf_file,
 			 CAF_qual_clip_min -1, CAF_qual_clip_max,
-			 CAF_seq_min, CAF_seq_max,
+			 CAF_seq_min, CAF_seq_max, 
 			 CAF_clone_min, CAF_clone_max);
 
     //cout << aRead;
 
+    aRead.setReadNamingScheme((*CAF_miraparams)[aRead.getSequencingType()].getAssemblyParams().as_readnaming_scheme);
+
+    if (CAF_insert_size_max > 0 || CAF_insert_size_min > 0) {
+      aRead.setInsize(CAF_insert_size_min, CAF_insert_size_max); 
+    }
+
     if(CAF_strand_given>0){
-      aRead.setTemplateSegment(1);
+      aRead.setTemplateEnd('F');
     }else if(CAF_strand_given<0){
-      aRead.setTemplateSegment(255);
+      aRead.setTemplateEnd('R');
     }
 
-    if (!CAF_state.empty()) {
-      aRead.setProcessStatus(CAF_state);
+    if (CAF_staden_id > 0) {
+      //aRead.setStadenID(CAF_staden_id);
     }
 
-    if (!CAF_asped_date.empty()) {
-      aRead.setAsped(CAF_asped_date);
+    if (!CAF_clone_vector_text.empty()) {
+      aRead.setClonevecName(CAF_clone_vector_text);
+    }
+
+    if (!CAF_sequencing_vector.empty()) {
+      aRead.setSeqvecName(CAF_sequencing_vector);
     }
 
     if (!CAF_template.empty()) {
       aRead.setTemplate(CAF_template);
     }
+
+    if (!CAF_base_caller.empty()) {
+      aRead.setBasecaller(CAF_base_caller);
+    }
+
+    //if (!CAF_stolen.empty()) {
+    //  aRead.setStolen(CAF_stolen);
+    //}
+
+    if (!CAF_asped_date.empty()) {
+      aRead.setAsped(CAF_asped_date);
+    }
+
+    if (CAF_dye == DYE_PRIMER) {
+      aRead.setDye("Dye_primer");
+    }
+    if (CAF_dye == DYE_TERMINATOR) {
+      aRead.setDye("Dye_terminator");
+    }
+
+    if (!CAF_state.empty()) {
+      aRead.setProcessStatus(CAF_state);
+    }
+
+    if (!CAF_primer.empty()) {
+      aRead.setPrimer(CAF_primer);
+    }
+    
+    // treat CAF clones as strains
+    if (!CAF_clone.empty() && CAF_clone != "unknown") {
+        aRead.setStrain(CAF_clone);
+    }
   }
   catch (Notify n) {
     n.handleError("Read & CAF::createCafRead()");
   }
 
   if(!aRead.isBackbone() && !aRead.isCoverageEquivalentRead()){
-    if(aRead.getSequencingType() >= ReadGroupLib::SEQTYPE_END){
+    if(aRead.getSequencingType() >= Read::SEQTYPE_END){
       MIRANOTIFY(Notify::FATAL, aRead.getName() << " has unknown sequencing type in MINF tag?\n");
     }
     CAF_lrperseqtype[aRead.getSequencingType()]=max(CAF_lrperseqtype[aRead.getSequencingType()],
 						    aRead.getLenClippedSeq());
   }
 
-  cleanup();
-
-  if(CAF_rcallbackfunc!=nullptr) {
-    (*CAF_rcallbackfunc)(*CAF_readpool);
-  }
-
-  ++CAF_numseqsloaded;
+  cleanup();  
 
   //Read::setCoutType(Read::AS_TEXTSHORT);
   //cout << aRead;
 
   FUNCEND();
-
   return aRead;
 }
 
 
 void CAF::createCafContig()
 {
-  if(CAF_clist!=nullptr){
-    {
-      Contig dummy(CAF_miraparams, *CAF_readpool);
-      CAF_clist->push_back(dummy);
-    }
+  {
+    Contig dummy(CAF_miraparams, *thePool);
+    theContigs->push_back(dummy);
+  }
 
-    if (verbose) {
-      cout << "Create Contig " << CAF_readname << "\n";
-    }
+  if (verbose) {
+    cout << "Create Contig (" << CAF_max_contig_length << ") " << CAF_readname << "\n";
+  }
 
-    // WTF??? BaCh 23.08.10��
-    // This destroys all strand information of consensus tags?!
-    // Why was this ever done? And by whom (Thomas, me?)
-    //
-    //// change all tags in consensus to have strand '='
-    //vector<tag_t>::iterator tI=CAF_taglist.begin();
-    //for(; tI!=CAF_taglist.end(); tI++){
-    //  tI->strand='=';
-    //}
+  // change all tags in consensus to have strand '='
+  vector<tag_t>::iterator tI=CAF_taglist.begin();
+  for(; tI!=CAF_taglist.end(); tI++){
+    tI->strand='=';
+  }
 
-    if(CAF_recalcconsensus){
-      string dummy1;
-      vector<base_quality_t> dummy2;
-      CAF_clist->back().initialiseContig(CAF_assembledFrom,
-					  CAF_taglist,
-					  CAF_readname,
-					  dummy1,dummy2);
-    }else{
-      string dummy1;
-      dummy1.reserve(CAF_DNA.size()+2);
-      {
-	vector<char>::const_iterator dnaI=CAF_DNA.begin();
-	for(; dnaI != CAF_DNA.end(); dnaI++){
-	  dummy1+=*dnaI;
-	}
+  if(CAF_recalcconsensus){
+    string dummy1;
+    vector<base_quality_t> dummy2;
+    theContigs->back().initialiseContig(CAF_max_contig_length, 
+					CAF_assembledFrom, 
+					CAF_taglist,
+					CAF_readname,
+					dummy1,dummy2);
+  }else{
+    string dummy1;
+    dummy1.reserve(CAF_DNA.size()+2);
+    {
+      vector<char>::const_iterator dnaI=CAF_DNA.begin();
+      for(; dnaI != CAF_DNA.end(); dnaI++){
+	dummy1+=*dnaI;
       }
-      CAF_clist->back().initialiseContig(CAF_assembledFrom,
-					  CAF_taglist,
-					  CAF_readname,
-					  dummy1,
-					  CAF_quality);
     }
+    theContigs->back().initialiseContig(CAF_max_contig_length, 
+					CAF_assembledFrom, 
+					CAF_taglist,
+					CAF_readname,
+					dummy1,
+					CAF_quality);
+  }
 
-    if(CAF_ccallbackfunc!=nullptr) {
-      (*CAF_ccallbackfunc)(*CAF_clist, *CAF_readpool);
-    }
+  if(theCallback!=NULL) {
+    (*theCallback)(*theContigs, *thePool);
   }
+
   cleanupContig();
-  ++CAF_numconsloaded;
 }
 
 
@@ -1680,11 +1600,46 @@ void CAF::createCafObject()
   try {
     switch (CAF_type) {
     case caftype_read: {
-      createCafRead();
+      if(CAF_simulateloading) {
+	// when simulating loading we don't want to use the full blown parsing
+	//  facilities, just the info from the MINF tag
+	//
+	// in effect, assign largest read per seqtype
+	//  only for reads that are not backbone and not CER reads
+	vector<tag_t>::iterator tI=CAF_taglist.begin();
+	for(; tI != CAF_taglist.end(); tI++){
+	  if(tI->identifier=="MINF") break;
+	}
+	if(tI != CAF_taglist.end()){
+	  string value;
+	  uint8 st=Read::SEQTYPE_SANGER;
+	  tI->extractGenBankKeyValueFromComment("ST",value);
+	  if(!value.empty()){
+	    st=Read::stringToSeqType(value);
+	    if(st==Read::SEQTYPE_END){
+	      st=Read::SEQTYPE_SANGER;
+	    }
+	  }
+
+	  tI->extractGenBankKeyValueFromComment("BB",value);
+	  if(value.empty() || value=="0"){
+	    tI->extractGenBankKeyValueFromComment("CER",value);
+	    if(value.empty() || value=="0"){
+	      CAF_lrperseqtype[st]=max(CAF_lrperseqtype[st], static_cast<uint32>(CAF_DNA.size()));
+	    }
+	  }
+	}else{
+	  CAF_lrperseqtype[0]=max(CAF_lrperseqtype[0], static_cast<uint32>(CAF_DNA.size()));
+	}
+      }else{
+	createCafRead();
+      }
       break;
     }
     case caftype_contig: {
-      createCafContig();
+      if(!CAF_simulateloading) {
+	createCafContig(); 
+      }
       break;
     }
     default: {
@@ -1702,7 +1657,7 @@ void CAF::createCafObject()
 
 
 
-ostream &operator<<(ostream &output, CAF const &i)
+ostream &operator<<(ostream &output, CAF const &i) 
 {
   output << "\nReadname   : " << i.CAF_readname << endl;
   output << "Length     : " << i.CAF_length << endl;
@@ -1717,11 +1672,11 @@ ostream &operator<<(ostream &output, CAF const &i)
   output << "Padded     : " << i.CAF_isPadded << endl;
   output << "SCF_File   : " << i.CAF_scf_file << endl;
   output << "Primer     : " << i.CAF_primer << endl;
-  output << "Q-Clipping : " << i.CAF_qual_clip_min;
+  output << "Q-Clipping : " << i.CAF_qual_clip_min; 
   output << " - " << i.CAF_qual_clip_max << endl;
-  output << "Seq-Vector : " << i.CAF_seq_min
+  output << "Seq-Vector : " << i.CAF_seq_min 
 	 << " - " << i.CAF_seq_max << endl;
-  output << "Cloning V. : " << i.CAF_clone_min << " - "
+  output << "Cloning V. : " << i.CAF_clone_min << " - " 
 	 << i.CAF_clone_max << endl;
   output << endl;
 
@@ -1738,3 +1693,10 @@ ostream &operator<<(ostream &output, CAF const &i)
 
   return output;
 }
+
+
+
+
+
+
+
diff --git a/src/caf/caf.H b/src/caf/caf.H
index f100d3a..87ec20e 100644
--- a/src/caf/caf.H
+++ b/src/caf/caf.H
@@ -22,13 +22,13 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  *
  *
- * Reading CAF-Files
+ * Reading CAF-Files 
  *
- * Version 1.4   19.11.99     Thomas Pfisterer
+ * Version 1.4   19.11.99     Thomas Pfisterer 
  */
 
 
-// 	$Id$
+// 	$Id$	
 
 
 
@@ -36,27 +36,23 @@
 #define _caf_caf_h
 
 
-#include "stdinc/stlincludes.H"
-#include "io/scf.H"
+#undef  yyFlexLexer
+#define yyFlexLexer CAFFlexLexer
+
+// added by BaCh  25.01.2002
+#include <string>
 
-#include "util/progressindic.H"
-#include "util/fileanddisk.H"
+// added by BaCh  31.10.2010
+#include "boost/unordered_map.hpp" 
 
+#include <FlexLexer.h>
 #include "mira/read.H"
 #include "mira/readpool.H"
 #include "mira/contig.H"
 #include "errorhandling/errorhandling.H"
-
-
-#include <string>         // added by BaCh  25.01.2002
-#include <unordered_map>  // added by BaCh  31.10.2010
-
 #include <vector>
-
-#undef  yyFlexLexer
-#define yyFlexLexer CAFFlexLexer
-
-#include <FlexLexer.h>
+#include "io/scf.H"
+#include "stdinc/stlincludes.H"
 
 
 
@@ -82,10 +78,10 @@ struct caf_intervall {
   int32 leftBorder;
   int32 rightBorder;
 };
-
+ 
 typedef uint8 caf_token;
 
-class CAF
+class CAF 
 {
   // Variables
 private:
@@ -99,13 +95,13 @@ private:
      larger tweaks, so this is a workaround: the CAF object itself
      keeps track of the readnames and the assigned read IDs
 
-     31.10.2010: changed to unordered_map
+     31.10.2010: changed to boost unordered_map
   */
 
-  typedef std::unordered_map<std::string, int32> strmap;
+  typedef boost::unordered_map<std::string, int32> strmap;
   strmap CAF_hashedreadnames;
 
-  std::list<std::string> CAF_listofreadnames;
+  list<string> CAF_listofreadnames;
 
   /*******************************************************************
    *
@@ -115,61 +111,54 @@ private:
    *******************************************************************/
 
   bool  verbose;
-  bool  strict_seq_vector;
-  // if strict_seq_vector is true all seqVec tags are treated as valid
-  // even if they are in the middle of the read.
-
-  FlexLexer*        CAF_lexer;           // The flexer
-  caf_token         CAF_token;           // the last token read
-
-  std::vector<MIRAParameters> *   CAF_miraparams;   // parameters for the contigs
-
-  // for CAF streaming
-  std::ifstream CAF_fin;
-  std::string CAF_filename;
-  ProgressIndicator<int64> * CAF_piptr;
-  uint64 CAF_numseqsloaded;
-  uint64 CAF_numconsloaded;
+  bool  strict_seq_vector;    
+  // if strict_seq_vector is true all seqVec tags are treated as valid 
+  // even if they are in the middle of the read. 
+  
+  FlexLexer*        lexer;           // The flexer
+  caf_token         token;           // the last token read
 
+  vector<MIRAParameters> *   CAF_miraparams;   // parameters for the contigs
 
   // Result Variables
-  ReadPool          * CAF_readpool;         // where to store the reads
-  std::list<Contig> * CAF_clist;      //
-  void (*CAF_ccallbackfunc)(std::list<Contig> &, ReadPool &);
-  void (*CAF_rcallbackfunc)(ReadPool &);
+  ReadPool*         thePool;         // where to store the reads
+  list<Contig>*     theContigs;      // 
+  void (*theCallback)(list<Contig> &, ReadPool &);
   bool              CAF_recalcconsensus;
 
-  std::vector<uint32> CAF_lrperseqtype;  // longest read per seqtype
+  bool   CAF_simulateloading;
+  vector<uint32> CAF_lrperseqtype;  // longest read per seqtype
   uint8 CAF_defaultseqtype;
-
+  
   int32 reReadToken;
 
-  std::string CAF_state;
-  std::string CAF_readname;
-  std::string CAF_asped_date;
-  std::string CAF_scf_file;
-  std::string CAF_primer;
-  std::string CAF_template;
-  std::string CAF_ligation;
-  std::string CAF_clone_vector_text;
-  std::string CAF_base_caller;
-  std::string CAF_stolen;
-  std::string CAF_clone;
-  std::string CAF_sequencing_vector;
+  string CAF_state;
+  string CAF_readname;
+  string CAF_asped_date;
+  string CAF_scf_file;
+  string CAF_primer;
+  string CAF_template;
+  string CAF_ligation;
+  string CAF_clone_vector_text;
+  string CAF_base_caller;
+  string CAF_stolen;
+  string CAF_clone;
+  string CAF_sequencing_vector;
 
   //  char  *CAF_seq_vector_text;
   //char  *CAF_clipping_text;
 
 
+  int32  CAF_max_contig_length;
   int32  CAF_staden_id;
 
-  std::vector<char>  CAF_DNA;
-  std::vector<uint8> CAF_quality;
-  std::vector<int32> CAF_align_scf;
-  std::vector<char>  CAF_unprocessed;
-  std::vector<multitag_t> CAF_taglist;
-  std::list<Contig::contig_init_read_t> CAF_assembledFrom;
-  std::list<caf_intervall> CAF_no_seq_intervall;
+  vector<char>  CAF_DNA;
+  vector<uint8> CAF_quality;
+  vector<int32> CAF_align_scf;
+  vector<char>  CAF_unprocessed;
+  vector<tag_t> CAF_taglist;
+  list<Contig::contig_init_read_t> CAF_assembledFrom;
+  list<caf_intervall> CAF_no_seq_intervall;
 
   caf_objecttype CAF_type;
   bool  CAF_isPadded;
@@ -189,13 +178,13 @@ private:
   caf_token getNextToken();  // advance in rule
   caf_token readToken();     // consume next; evtl. reread a token
   char* getIdentifier();
-  std::string getText();
-  std::string getReadname(std::string old_name);
+  string getText();
+  string getReadname(string old_name);
   int32 get2Numbers(int &x1, int &x2);
   void  addUnprocessed(void);
-  void  showVector(std::vector<char> v);
+  void  showVector(vector<char> v);
 
-  int32 getCafReadname();
+  int32 getCafReadname(); 
   int32 getCafProcessStatus();
   int32 getCafAspedDate();
   int32 getCafDye();
@@ -226,39 +215,29 @@ private:
   void createCafObject();
   void discard();
 
-  void deescapeString(std::string & s);
+  void deescapeString(string & s);
 
-  size_t countReadsBeforeLoad(const std::string & fileName);
+  size_t countReadsBeforeLoad(const string & fileName); 
 
 public:
-  CAF(ReadPool * aPool,
-      std::list<Contig>  * clist,
-      std::vector<MIRAParameters> * mp);
+  CAF(ReadPool &aPool, 
+      list<Contig>  &theContigs, 
+      vector<MIRAParameters> * mp);
   ~CAF();
 
-  size_t load(const std::string & fileName,
+  size_t load(const string & fileName,
 	      const uint8 seqtype,
 	      const uint8 loadaction,
-	      std::vector<uint32> & lrperseqtype,
+	      vector<uint32> & lrperseqtype,
 	      bool recalcconsensus = true,
-	      void (*ccallback)(std::list<Contig> &, ReadPool &) = nullptr, // callback after each contig loaded
-	      void (*rcallback)(ReadPool &) = nullptr, // callback after each read loaded
+	      void (*callback)(list<Contig> &, ReadPool &) = NULL, // callback after each contig loaded
 	      bool isVerbose = false);
 
-  void registerFile(const std::string & fileName);
-  uint64 loadNextSeqs(uint64 numseqstoload,uint64 numconsstoload);
-  void setNewContainers(ReadPool * rpool,
-			std::list<Contig>  * clist,
-			std::vector<MIRAParameters> * mp);
-  bool checkIfEOF() {return CAF_token==0;}
-  void setProgressIndicator(bool b);
-
-
   char* getVersion();
 
   void setStrictSeqVector(bool strict);
 
-  friend std::ostream &operator<<(std::ostream &ostr, CAF const &i);
+  friend ostream &operator<<(ostream &ostr, CAF const &i);
 
 };
 
diff --git a/src/caf/caf_flexer.cc b/src/caf/caf_flexer.cc
index 8febe08..7059a3b 100644
--- a/src/caf/caf_flexer.cc
+++ b/src/caf/caf_flexer.cc
@@ -348,8 +348,8 @@ int yyFlexLexer::yywrap() { return 1; }
 	*yy_cp = '\0'; \
 	(yy_c_buf_p) = yy_cp;
 
-#define YY_NUM_RULES 60
-#define YY_END_OF_BUFFER 61
+#define YY_NUM_RULES 62
+#define YY_END_OF_BUFFER 63
 /* This struct is not used in this scanner,
    but its presence is necessary. */
 struct yy_trans_info
@@ -357,193 +357,195 @@ struct yy_trans_info
 	flex_int32_t yy_verify;
 	flex_int32_t yy_nxt;
 	};
-static yyconst flex_int16_t yy_accept[1687] =
+static yyconst flex_int16_t yy_accept[1695] =
     {   0,
         0,    0,   30,   30,   28,   28,    0,    0,    0,    0,
         0,    0,    0,    0,   25,   25,    0,    0,    0,    0,
-        0,    0,   61,   59,   57,   59,   59,   58,   59,   59,
-       59,   59,   59,   59,   59,   59,   59,   59,   30,   59,
-       31,   59,   59,   59,   59,   59,   28,   59,   29,   33,
+        0,    0,   63,   61,   59,   61,   61,   60,   61,   61,
+       61,   61,   61,   61,   61,   61,   61,   61,   30,   61,
+       31,   61,   61,   61,   61,   61,   28,   61,   29,   33,
        33,   33,   33,   33,   33,   33,   33,   33,   33,   33,
-       33,   33,   27,   27,   26,   27,   27,   27,   27,   27,
-       27,   27,   27,   27,   27,   27,   37,   35,   36,   34,
-       37,   37,   37,   37,   37,   37,   37,   37,   37,   37,
-       37,   37,   37,   22,   22,   22,   22,   22,   22,   22,
-
-       22,   22,   22,   22,   22,   22,   24,   25,   25,   25,
-       25,   25,   25,   25,   25,   25,   25,   25,   25,   57,
-       44,   44,   44,   43,   44,   44,   44,   44,   44,   44,
-       44,   44,   44,   44,   44,   41,   41,   41,   41,   41,
-       41,   41,   41,   41,   41,   41,   41,   41,   40,   39,
-       38,   40,   40,   40,   40,   40,   40,   40,   40,   40,
-       40,   40,   40,   40,   56,    0,    0,    0,    0,    0,
+       33,   33,   33,   33,   27,   27,   26,   27,   27,   27,
+       27,   27,   27,   27,   27,   27,   27,   27,   38,   36,
+       37,   35,   38,   38,   38,   38,   38,   38,   38,   38,
+       38,   38,   38,   38,   38,   22,   22,   22,   22,   22,
+
+       22,   22,   22,   22,   22,   22,   22,   22,   24,   25,
+       25,   25,   25,   25,   25,   25,   25,   25,   25,   25,
+       25,   59,   46,   46,   46,   45,   46,   46,   46,   46,
+       46,   46,   46,   46,   46,   46,   46,   42,   42,   42,
+       42,   42,   42,   42,   42,   42,   42,   42,   42,   42,
+       42,   42,   41,   40,   39,   41,   41,   41,   41,   41,
+       41,   41,   41,   41,   41,   41,   41,   41,   58,    0,
         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,   30,   31,   31,    0,    0,    0,    0,
-       28,   29,   29,   33,   33,   33,   33,   33,   33,   33,
+        0,    0,    0,    0,    0,    0,    0,   30,   31,   31,
+        0,    0,    0,    0,   28,   29,   29,   33,   33,   33,
 
        33,   33,   33,   33,   33,   33,   33,   33,   33,   33,
-       33,   33,   33,   27,   26,   26,   27,   27,   27,   27,
+       33,   33,   33,   33,   33,   33,   33,   33,   33,   27,
+       26,   26,   27,   27,   27,   27,   27,   27,   27,   27,
        27,   27,   27,   27,   27,   27,   27,   27,   27,   27,
-       27,   27,   27,   27,   22,   22,   22,   22,   22,   22,
        22,   22,   22,   22,   22,   22,   22,   22,   22,   22,
-       22,   22,   22,   22,    0,   23,   25,   25,   25,   25,
+       22,   22,   22,   22,   22,   22,   22,   22,   22,   22,
+        0,   23,   25,   25,   25,   25,   25,   25,   25,   25,
        25,   25,   25,   25,   25,   25,   25,   25,   25,   25,
-       25,   25,   25,   25,   25,    0,   42,   44,   43,   44,
-       43,   44,   44,   44,   44,   44,   44,   44,   44,   44,
-       44,   44,   44,   44,   44,   44,   44,   44,   44,   41,
+       25,    0,   44,   46,   45,   46,   45,   46,   46,   46,
+       46,   46,   46,   46,   46,   46,   46,   46,   46,   46,
 
-       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,
-       41,   41,   41,   41,   41,   41,   41,   41,   41,    0,
-        0,    0,    0,    0,    0,    0,    0,   51,    0,    0,
+       46,   46,   46,   46,   46,   42,   42,   42,   42,   42,
+       42,   42,   42,   42,   42,   42,   42,   42,   42,   42,
+       42,   42,   42,   42,   42,   42,   42,    0,    0,    0,
+        0,    0,    0,    0,    0,   53,    0,    0,    0,    0,
         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,   33,   33,   33,   33,
+        0,    0,    0,    0,   33,   33,   33,   33,   33,   33,
        33,   33,   33,   33,   33,   33,   33,   33,   33,   33,
-       33,   33,   33,   33,   33,   33,   33,   33,   33,   27,
+       33,   33,   33,   33,   33,   33,   33,   27,   27,   27,
        27,   27,   27,   27,   27,   27,   27,   27,   27,   27,
        27,   27,   27,   27,   27,   27,   27,   27,   27,   27,
-       27,   27,   22,   22,   22,   22,   22,   22,   22,   22,
 
        22,   22,   22,   22,   22,   22,   22,   22,   22,   22,
-       22,   22,   22,   22,   22,   25,   25,   25,   25,   25,
+       22,   22,   22,   22,   22,   22,   22,   22,   22,   22,
+       22,   22,   22,   25,   25,   25,   25,   25,   25,   25,
        25,   25,   25,   25,   25,   25,   25,   25,   25,   25,
-       25,   25,   25,   25,   25,   25,   25,   44,   44,   44,
-       44,   44,   44,   44,   44,   44,   44,   44,   44,   44,
-       44,   44,   44,   44,   44,   44,   44,   44,   44,   44,
-       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,
-       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,
-       41,   41,   41,    0,    0,    0,    0,    0,    0,    0,
-        0,   12,    0,    0,    0,    0,    0,    0,    0,    0,
-
-        0,    0,    0,    0,    0,    0,    0,   11,    0,    0,
-       32,   33,   33,   33,   33,   33,   33,   33,   12,   33,
+       25,   25,   25,   25,   25,   46,   46,   46,   46,   46,
+       46,   46,   46,   46,   46,   46,   46,   46,   46,   46,
+       46,   46,   46,   46,   46,   46,   46,   46,   42,   42,
+       42,   42,   42,   42,   42,   42,   42,   42,   42,   42,
+       42,   42,   42,   42,   42,   42,   42,   42,   42,   42,
+       42,    0,    0,    0,    0,    0,    0,    0,    0,   12,
+
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,   11,    0,    0,   32,   33,
+       33,   33,   33,   33,   33,   33,   12,   33,   33,   33,
        33,   33,   33,   33,   33,   33,   33,   33,   33,   33,
-       33,   33,   33,   33,   33,   33,   27,   27,   27,   27,
-       27,   27,   27,   27,   27,   27,   27,   27,   27,   27,
+       33,   33,   33,   33,   27,   27,   27,   27,   27,   27,
        27,   27,   27,   27,   27,   27,   27,   27,   27,   27,
-       22,   22,   22,   22,   22,   22,   22,   12,   22,   22,
+       27,   27,   27,   27,   27,   27,   27,   27,   22,   22,
+       22,   22,   22,   22,   22,   12,   22,   22,   22,   22,
        22,   22,   22,   22,   22,   22,   22,   22,   22,   22,
-       22,   22,   22,   22,   22,   25,   25,   25,   25,   25,
-       25,   25,   25,   25,   25,   25,   25,   25,   25,   25,
+       22,   22,   22,   25,   25,   25,   25,   25,   25,   25,
 
-       25,   25,   44,   44,   44,   44,   44,   44,   44,   12,
-       44,   44,   44,   44,   44,   44,   44,   44,   44,   44,
-       44,   44,   44,   44,   44,   44,   44,   41,   41,   41,
-       41,   41,   41,   41,   12,   41,   41,   41,   41,   41,
-       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,
-       41,   41,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,   12,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,   33,
-       33,   33,   33,   33,   33,   33,   33,   33,   33,   33,
+       25,   25,   25,   25,   25,   25,   25,   25,   25,   25,
+       46,   46,   46,   46,   46,   46,   46,   12,   46,   46,
+       46,   46,   46,   46,   46,   46,   46,   46,   46,   46,
+       46,   46,   46,   46,   46,   42,   42,   42,   42,   42,
+       42,   42,   12,   42,   42,   42,   42,   42,   42,   42,
+       42,   42,   42,   42,   42,   42,   42,   42,   42,   42,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,   12,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,   33,   33,   33,
        33,   33,   33,   33,   33,   33,   33,   33,   33,   33,
 
-       33,   33,   33,   33,   33,   27,   27,   27,   27,   27,
-       27,   27,   27,   27,   27,   27,   27,   27,   27,   27,
+       33,   33,   33,   33,   33,   33,   33,   33,   33,   33,
+       33,   33,   33,   27,   27,   27,   27,   27,   27,   27,
        27,   27,   27,   27,   27,   27,   27,   27,   27,   27,
-       27,   22,   22,   22,   22,   22,   22,   22,   22,   22,
+       27,   27,   27,   27,   27,   27,   27,   27,   27,   22,
+       22,   22,   22,   22,   22,   22,   22,   22,   22,   22,
        22,   22,   22,   22,   22,   22,   22,   22,   22,   22,
-       22,   22,   22,   22,   22,   22,   22,   25,   25,   25,
+       22,   22,   22,   22,   22,   25,   25,   25,   25,   25,
        25,   25,   25,   25,   25,   25,   25,   25,   25,   25,
-       25,   25,   25,   25,   44,   44,   44,   44,   44,   44,
-       44,   44,   44,   44,   44,   44,   44,   44,   44,   44,
-       44,   44,   44,   44,   44,   44,   44,   44,   44,   44,
-
-       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,
-       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,
-       41,   41,   41,   41,   41,   41,    0,    0,    0,   15,
-        0,    0,    0,    0,    5,    0,    0,    0,    0,    0,
-        0,    0,   49,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,   33,   33,   33,   33,   33,   33,   33,
+       25,   25,   46,   46,   46,   46,   46,   46,   46,   46,
+       46,   46,   46,   46,   46,   46,   46,   46,   46,   46,
+
+       46,   46,   46,   46,   46,   46,   46,   46,   42,   42,
+       42,   42,   42,   42,   42,   42,   42,   42,   42,   42,
+       42,   42,   42,   42,   42,   42,   42,   42,   42,   42,
+       42,   42,   42,   42,    0,    0,    0,   15,    0,    0,
+        0,    0,    5,    0,    0,    0,    0,    0,    0,    0,
+       51,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,   33,   33,   33,   33,   33,   33,   33,   33,   33,
        33,   33,   33,   33,   33,   33,   33,   33,   33,   33,
-       33,   33,   33,   33,   33,   33,   33,   33,   27,   27,
-       27,   27,   27,   27,   27,   27,   27,   27,   27,   27,
+       33,   33,   33,   33,   33,   33,   27,   27,   27,   27,
        27,   27,   27,   27,   27,   27,   27,   27,   27,   27,
 
-       27,   27,   27,   22,   22,   22,   22,   22,   22,   22,
+       27,   27,   27,   27,   27,   27,   27,   27,   27,   27,
+       27,   22,   22,   22,   22,   22,   22,   22,   22,   22,
        22,   22,   22,   22,   22,   22,   22,   22,   22,   22,
-       22,   22,   22,   22,   22,   22,   22,   22,   25,   25,
+       22,   22,   22,   22,   22,   22,   25,   25,   25,   25,
        25,   25,   25,   25,   25,   25,   25,   25,   25,   25,
-       25,   25,   44,   44,   44,   44,   44,   44,   44,   44,
-       44,   44,   44,   44,   44,   44,   44,   44,   44,   44,
-       44,   44,   44,   44,   44,   44,   44,   41,   41,   41,
-       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,
-       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,
-       41,   41,    0,    0,    0,    0,    0,    0,    0,    0,
-
-        0,    0,    0,    0,   45,    0,   20,    0,    0,    0,
-        0,    0,   21,    0,    0,    0,   33,   33,   33,   33,
+       46,   46,   46,   46,   46,   46,   46,   46,   46,   46,
+       46,   46,   46,   46,   46,   46,   46,   46,   46,   46,
+       46,   46,   46,   46,   46,   42,   42,   42,   42,   42,
+       42,   42,   42,   42,   42,   42,   42,   42,   42,   42,
+       42,   42,   42,   42,   42,   42,   42,   42,   42,   42,
+
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,   47,    0,   20,    0,    0,    0,    0,    0,
+       21,    0,    0,    0,   33,   33,   33,   33,   33,   33,
        33,   33,   33,   33,   33,   33,   33,   33,   33,   33,
-       33,   33,   33,   33,   33,   33,   33,   33,   27,   27,
+       33,   33,   33,   33,   33,   33,   27,   27,   27,   27,
        27,   27,   27,   27,   27,   27,   27,   27,   27,   27,
-       27,   27,   27,   27,   27,   27,   27,   27,   27,   22,
+       27,   27,   27,   27,   27,   27,   27,   22,   22,   22,
        22,   22,   22,   22,   22,   22,   22,   22,   22,   22,
-       22,   22,   22,   22,   22,   22,   22,   22,   22,   22,
-       22,   25,   25,   25,   25,   25,   25,   25,   25,   44,
-       44,   44,   44,   44,   44,   44,   44,   44,   44,   44,
-
-       44,   44,   44,   44,   44,   44,   44,   44,   44,   44,
-       44,   41,   41,   41,   41,   41,   41,   41,   41,   41,
-       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,
-       41,   41,   41,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,   47,    0,    0,    0,    8,    0,
-        0,    0,    0,    0,    0,   50,   33,   33,   33,   33,
+       22,   22,   22,   22,   22,   22,   22,   22,   22,   25,
+       25,   25,   25,   25,   25,   25,   25,   46,   46,   46,
+
+       46,   46,   46,   46,   46,   46,   46,   46,   46,   46,
+       46,   46,   46,   46,   46,   46,   46,   46,   46,   42,
+       42,   42,   42,   42,   42,   42,   42,   42,   42,   42,
+       42,   42,   42,   42,   42,   42,   42,   42,   42,   42,
+       42,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,   49,    0,    0,    0,    8,    0,    0,    0,
+        0,    0,    0,   52,   33,   33,   33,   33,   33,   33,
        33,   33,   33,   33,   33,   33,   33,   33,   33,   33,
-       33,   33,   33,   33,   33,   33,   33,   33,   27,   27,
+       33,   33,   33,   33,   33,   33,   27,   27,   27,   27,
        27,   27,   27,   27,   27,   27,   27,   27,   27,   27,
-       27,   27,   27,   27,   27,   27,   27,   27,   22,   22,
 
+       27,   27,   27,   27,   27,   27,   22,   22,   22,   22,
        22,   22,   22,   22,   22,   22,   22,   22,   22,   22,
-       22,   22,   22,   22,   22,   22,   22,   22,   22,   22,
-       25,   25,   25,   25,   25,   25,   25,   25,   25,   44,
-       44,   44,   44,   44,   44,   44,   44,   44,   44,   44,
-       44,   44,   44,   44,   44,   44,   44,   44,   44,   44,
-       44,   41,   41,   41,   41,   41,   41,   41,   41,   41,
-       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,
-       41,   41,   41,    0,    0,    0,    0,    0,    0,    4,
-        0,    0,    0,   46,    0,    0,    7,    0,   13,    0,
-        0,    0,    0,   17,   33,   33,   33,   33,   33,   33,
-
-       33,   33,   33,   33,   33,   33,   13,   33,   33,   33,
-       33,   27,   27,   27,   27,   27,   27,   27,   27,   27,
-       27,   27,   27,   27,   27,   22,   22,   22,   22,   22,
-       22,   22,   22,   22,   22,   22,   22,   13,   22,   22,
-       22,   22,   25,   25,   25,   25,   44,   44,   44,   44,
-       44,   44,   44,   44,   44,   44,   44,   44,   13,   44,
-       44,   44,   44,   41,   41,   41,   41,   41,   41,   41,
-       41,   41,   41,   41,   41,   13,   41,   41,   41,   41,
-       53,    0,    0,    0,    0,    0,    3,    0,    0,    0,
-        0,   13,    0,   10,    0,    0,   33,   33,   33,   33,
-
-       33,   33,   33,   33,   33,   33,   33,   33,   33,   27,
+       22,   22,   22,   22,   22,   22,   22,   22,   25,   25,
+       25,   25,   25,   25,   25,   25,   25,   46,   46,   46,
+       46,   46,   46,   46,   46,   46,   46,   46,   46,   46,
+       46,   46,   46,   46,   46,   46,   46,   46,   46,   42,
+       42,   42,   42,   42,   42,   42,   42,   42,   42,   42,
+       42,   42,   42,   42,   42,   42,   42,   42,   42,   42,
+       42,    0,    0,    0,    0,    0,    0,    4,    0,    0,
+        0,   48,    0,    0,    7,    0,   13,    0,    0,    0,
+
+        0,   17,   33,   33,   33,   33,   33,   33,   33,   33,
+       33,   33,   33,   33,   13,   33,   33,   33,   33,   27,
        27,   27,   27,   27,   27,   27,   27,   27,   27,   27,
+       27,   27,   27,   22,   22,   22,   22,   22,   22,   22,
+       22,   22,   22,   22,   22,   13,   22,   22,   22,   22,
+       25,   25,   25,   25,   46,   46,   46,   46,   46,   46,
+       46,   46,   46,   46,   46,   46,   13,   46,   46,   46,
+       46,   42,   42,   42,   42,   42,   42,   42,   42,   42,
+       42,   42,   42,   13,   42,   42,   42,   42,   55,    0,
+        0,    0,    0,    0,    3,    0,    0,    0,    0,   13,
+
+        0,   10,    0,    0,   33,   33,   33,   33,   33,   33,
+       33,   33,   33,   33,   33,   33,   33,   27,   27,   27,
+       27,   27,   27,   27,   27,   27,   27,   27,   22,   22,
        22,   22,   22,   22,   22,   22,   22,   22,   22,   22,
-       22,   22,   22,   25,   25,   25,   44,   44,   44,   44,
-       44,   44,   44,   44,   44,   44,   44,   44,   44,   41,
-       41,   41,   41,   41,   41,   41,   41,   41,   41,   41,
-       41,   41,    0,    0,    0,    0,    0,    0,   48,    0,
-        0,    0,    0,    0,   33,   33,   33,   33,   33,   33,
-       33,   33,   33,   33,   33,   33,   27,   27,   27,   27,
-       27,   27,   27,   27,   27,   27,   22,   22,   22,   22,
+       22,   25,   25,   25,   46,   46,   46,   46,   46,   46,
+       46,   46,   46,   46,   46,   46,   46,   42,   42,   42,
+       42,   42,   42,   42,   42,   42,   42,   42,   42,   42,
+        0,    0,    0,    0,    0,    0,   50,    0,    0,    0,
+        0,    0,   33,   33,   33,   33,   33,   33,   33,   33,
+       33,   33,   33,   33,   27,   27,   27,   27,   27,   27,
+
+       27,   27,   27,   27,   22,   22,   22,   22,   22,   22,
+       22,   22,   22,   22,   22,   22,   25,   25,   46,   46,
+       46,   46,   46,   46,   46,   46,   46,   46,   46,   46,
+       42,   42,   42,   42,   42,   42,   42,   42,   42,   42,
+       42,   42,    0,    0,    0,    0,   14,   14,   16,    6,
+       18,    0,    0,    0,    0,   33,   33,   33,   14,   14,
+       33,   33,   33,   33,   27,   27,   27,   27,   27,   22,
+       22,   22,   14,   14,   22,   22,   22,   22,   25,   46,
+       46,   46,   14,   14,   46,   46,   46,   46,   42,   42,
+       42,   14,   14,   42,   42,   42,   42,    0,    1,    0,
+
+       14,   14,   14,    0,    0,    0,    0,   33,   33,   14,
+       14,   33,   33,   33,   33,   27,   27,   27,   27,   22,
+       22,   14,   14,   22,   22,   22,   22,   25,   46,   46,
+       14,   14,   46,   46,   46,   46,   42,   42,   14,   14,
+       42,   42,   42,   42,   54,    0,   19,    0,   56,   57,
+       33,   33,   33,   33,   33,   27,   27,   27,   22,   22,
+       22,   22,   22,   46,   46,   46,   46,   46,   42,   42,
+       42,   42,   42,    2,    0,   33,   27,   22,   46,   42,
+        0,   33,   27,   22,   46,   42,    0,   33,   27,   22,
+       46,   42,    9,    0
 
-       22,   22,   22,   22,   22,   22,   22,   22,   25,   25,
-       44,   44,   44,   44,   44,   44,   44,   44,   44,   44,
-       44,   44,   41,   41,   41,   41,   41,   41,   41,   41,
-       41,   41,   41,   41,    0,    0,    0,    0,   14,   14,
-       16,    6,   18,    0,    0,    0,    0,   33,   33,   33,
-       14,   14,   33,   33,   33,   33,   27,   27,   27,   27,
-       27,   22,   22,   22,   14,   14,   22,   22,   22,   22,
-       25,   44,   44,   44,   14,   14,   44,   44,   44,   44,
-       41,   41,   41,   14,   14,   41,   41,   41,   41,    0,
-        1,    0,   14,   14,   14,    0,    0,    0,    0,   33,
-
-       33,   14,   14,   33,   33,   33,   33,   27,   27,   27,
-       27,   22,   22,   14,   14,   22,   22,   22,   22,   25,
-       44,   44,   14,   14,   44,   44,   44,   44,   41,   41,
-       14,   14,   41,   41,   41,   41,   52,    0,   19,    0,
-       54,   55,   33,   33,   33,   33,   33,   27,   27,   27,
-       22,   22,   22,   22,   22,   44,   44,   44,   44,   44,
-       41,   41,   41,   41,   41,    2,    0,   33,   27,   22,
-       44,   41,    0,   33,   27,   22,   44,   41,    0,   33,
-       27,   22,   44,   41,    9,    0
     } ;
 
 static yyconst flex_int32_t yy_ec[256] =
@@ -551,17 +553,17 @@ static yyconst flex_int32_t yy_ec[256] =
         1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    4,    1,    5,    6,    1,    7,    7,    1,    1,
-        1,    8,    6,    6,    9,    6,   10,   11,   11,   11,
-       11,   11,   11,   11,   11,   11,   11,   12,    1,    1,
-        1,    1,    1,    1,   13,   14,   15,   16,   17,   18,
-       19,   19,   20,   19,   19,   21,   19,   22,   23,   24,
-       25,   26,   27,   28,   29,   30,   19,   19,   19,   19,
-        1,    1,    1,    1,   31,    1,   32,   33,   34,   35,
-
-       36,   37,   38,   19,   39,   19,   19,   40,   41,   42,
-       43,   44,   45,   46,   47,   48,   49,   50,   51,   19,
-       52,   53,    1,    6,    1,    1,    1,    1,    1,    1,
+        1,    4,    1,    5,    6,    1,    1,    1,    1,    1,
+        1,    7,    6,    6,    8,    6,    9,   10,   10,   10,
+       10,   10,   10,   10,   10,   10,   10,   11,    1,    1,
+        1,    1,    1,    1,   12,   13,   14,   15,   16,   17,
+       18,   18,   19,   18,   18,   20,   18,   21,   22,   23,
+       24,   25,   26,   27,   28,   29,   18,   18,   18,   18,
+        1,    1,    1,    1,   30,    1,   31,   32,   33,   34,
+
+       35,   36,   37,   18,   38,   18,   18,   39,   40,   41,
+       42,   43,   44,   45,   46,   47,   48,   49,   50,   18,
+       51,   52,    1,    6,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
@@ -578,903 +580,905 @@ static yyconst flex_int32_t yy_ec[256] =
         1,    1,    1,    1,    1
     } ;
 
-static yyconst flex_int32_t yy_meta[55] =
+static yyconst flex_int32_t yy_meta[54] =
     {   0,
-        1,    1,    1,    1,    2,    3,    2,    4,    5,    2,
-        3,    2,    5,    5,    5,    5,    5,    5,    5,    5,
+        1,    1,    1,    1,    2,    3,    4,    5,    2,    3,
+        2,    5,    5,    5,    5,    5,    5,    5,    5,    5,
+        5,    5,    5,    5,    5,    5,    5,    5,    5,    3,
         5,    5,    5,    5,    5,    5,    5,    5,    5,    5,
-        3,    5,    5,    5,    5,    5,    5,    5,    5,    5,
         5,    5,    5,    5,    5,    5,    5,    5,    5,    5,
-        5,    5,    5,    1
+        5,    5,    1
     } ;
 
-static yyconst flex_int16_t yy_base[1702] =
+static yyconst flex_int16_t yy_base[1710] =
     {   0,
-        0,   52,  105,    0,    3,   15,   30,  159,  213,  267,
-       40,  320,   85,  374,  428,  482,  536,  590,   95,  644,
-       48,  696, 2162, 2163, 2163, 2151, 2108, 2163,    1, 2127,
-     2118,    0,   27, 2118,    3,   42,   27, 2114,    4, 2144,
-     2143,    6, 2124, 2122,   52,   89,   19, 2140, 2139,    0,
-     2139, 2096,   30, 2115, 2106,   39,   70, 2106,   39,   95,
-       86, 2102,    0, 2132, 2131, 2089,   86, 2108, 2099,   61,
-       81, 2099,   92,  120,  104, 2095, 2163, 2163, 2163, 2163,
-     2126, 2083, 2163,   87, 2102, 2093,  119,  100, 2093,  112,
-      130,  114, 2089,    0, 2120, 2077,  108, 2096, 2087,  129,
-
-      110, 2087,  138,  149,  157, 2083,  188,    0, 2072,  154,
-     2091, 2082,  143,  135, 2082,  164,  183,  167, 2078,  202,
-        0, 2108, 2108, 2106, 2064,  160, 2083, 2074,  180,  186,
-     2074,  180,  194,  202, 2070,    0, 2101, 2058,  196, 2077,
-     2068,  189,  193, 2068,  205,  212,  213, 2064, 2163, 2163,
-     2163, 2095, 2052, 2163,  199, 2071, 2062,  232,  205, 2062,
-      212,  249,  221, 2058, 2163, 2063, 2059,  212, 2050,  222,
-     2083, 2059, 2047, 2062, 2054, 2056,  223, 2072, 2044,  257,
-     2050, 2046, 2042,   35, 2163, 2074, 2062, 2066, 2069, 2064,
-      288, 2163, 2069,    0,    0, 2043, 2039,  254, 2030,  263,
-
-     2063, 2039, 2027, 2042, 2034, 2036,  265, 2052, 2024,  267,
-     2030, 2026, 2022,    0,    0, 2054, 2028, 2024,  265, 2015,
-      268, 2048, 2024, 2012, 2027, 2019, 2021,  275, 2037, 2009,
-      273, 2015, 2011, 2007,    0,    0, 2014, 2010,  273, 2001,
-      288, 2034, 2010, 1998, 2013, 2005, 2007,  289, 2023, 1995,
-      283, 2001, 1997, 1993,  335, 2163,    0, 2000, 1996,  298,
-     1987,  307, 2020, 1996, 1984, 1999, 1991, 1993,  312, 2009,
-     1981,  311, 1987, 1983, 1979,  356, 2163,    0,    0,    0,
-     2011, 1985, 1981,  309, 1972,  322, 2005, 1981, 1969, 1984,
-     1976, 1978,  323, 1994, 1966,  337, 1972, 1968, 1964,    0,
-
-        0, 1971, 1967,  320, 1958,  329, 1991, 1967, 1955, 1970,
-     1962, 1964,  342, 1980, 1952,  354, 1958, 1954, 1950, 1962,
-     1954, 1955, 1954, 1953, 1944, 1945,  402, 1955, 1949,  377,
-     1952, 1948, 1941, 1947, 1949,  224, 1944, 1938, 1945, 1972,
-     1931, 1942, 1945, 1957, 1950, 1955, 1938, 1930, 1931, 1930,
-     1929, 1920, 1921,  408, 1931, 1925,  409, 1928, 1924, 1917,
-     1923, 1925,  321, 1920, 1914, 1921, 1948, 1907, 1918, 1918,
-     1910, 1911, 1910, 1909, 1900, 1901,  414, 1911, 1905,  414,
-     1908, 1904, 1897, 1903, 1905,  342, 1900, 1894, 1901, 1928,
-     1887, 1898, 1898, 1890, 1891, 1890, 1889, 1880, 1881,  449,
-
-     1891, 1885,  424, 1888, 1884, 1877, 1883, 1885,  368, 1880,
-     1874, 1881, 1908, 1867, 1878, 1878, 1870, 1871, 1870, 1869,
-     1860, 1861,  461, 1871, 1865, 1868, 1864, 1857, 1863, 1865,
-      393, 1860, 1854, 1861, 1888, 1847, 1858, 1858, 1850, 1851,
-     1850, 1849, 1840, 1841,  467, 1851, 1845,  480, 1848, 1844,
-     1837, 1843, 1845,  396, 1840, 1834, 1841, 1868, 1827, 1838,
-     1838, 1830, 1831, 1830, 1829, 1820, 1821,  503, 1831, 1825,
-      485, 1828, 1824, 1817, 1823, 1825,  418, 1820, 1814, 1821,
-     1848, 1807, 1818,  348, 1807, 1813, 1806,  443, 1802, 1809,
-      520,  473, 1798, 1796, 1799, 1795, 1804, 1791, 1802, 1801,
-
-     1800, 1817, 1784, 1797, 1796, 1795, 1788, 2163, 1789, 1793,
-     2163,  377, 1785, 1791, 1784,  496, 1780, 1787,  474, 1776,
-     1774, 1777, 1773, 1782, 1769, 1780, 1779, 1778, 1795, 1762,
-     1775, 1774, 1773, 1766, 1767, 1771,  456, 1763, 1769, 1762,
-      503, 1758, 1765, 1754, 1752, 1755, 1751, 1760, 1747, 1758,
-     1757, 1756, 1773, 1740, 1753, 1752, 1751, 1744, 1745, 1749,
-      472, 1741, 1747, 1740,  504, 1736, 1743,  497, 1732, 1730,
-     1733, 1729, 1738, 1725, 1736, 1735, 1734, 1751, 1718, 1731,
-     1730, 1729, 1722, 1723, 1727, 1719, 1725, 1718,  517, 1714,
-     1721, 1710, 1707, 1718, 1717, 1716, 1715, 1714, 1713, 1706,
-
-     1707, 1711,  505, 1703, 1709, 1702,  525, 1698, 1705,  539,
-     1694, 1692, 1695, 1691, 1700, 1687, 1698, 1697, 1696, 1713,
-     1680, 1693, 1692, 1691, 1684, 1685, 1689,  507, 1681, 1687,
-     1680,  529, 1676, 1683,  555, 1672, 1670, 1673, 1669, 1678,
-     1665, 1676, 1675, 1674, 1691, 1658, 1671, 1670, 1669, 1662,
-     1663, 1667, 1655, 1664, 1668, 1694, 1664, 1647, 1661, 1655,
-       16,  559, 1645, 1645, 1649, 1647, 1657, 1649, 1652, 1640,
-     1638, 1645, 1647, 1640, 1639, 1638, 1644, 1646, 1642, 1630,
-     1639, 1643, 1669, 1639, 1622, 1636, 1630,  433, 1619, 1616,
-     1615, 1610, 1618,   21,   65,   83,  106,  115,  140,  166,
-
-      208,  221,  251,  261,  328,  325,  343,  362,  401,  375,
-      373,  402,  411,  554,  409,  433,  439,  447,  459,  491,
-      498,  516,  517,  526,  530,  525,  526,  527,  535,  539,
-      537,  527,  538,  544,  572,  544,  529,  545,  541,  577,
-      534,  536,  542,  543,  555,  549,  554,  549,  549,  558,
-      566,  565,  567,  570,  578,  583,  581,  589,  617,  589,
-      574,  585,  622,  577,  588,  593,  583,  583,  589,  590,
-      591,  599,  603,  601,  591,  602,  608,  636,  608,  593,
-      609,  610,  646,  603,  608,  614,  618,  630,  624,  631,
-      621,  622,  631,  638,  633,  634,  636,  644,  648,  646,
-
-      636,  647,  653,  681,  653,  638,  654,  650,  687,  642,
-      645,  651,  651,  663,  657,  662,  654,  655,  664,  668,
-      663,  665,  666,  678,  682,  680,  680,  675,  674, 2163,
-      686,  695,  696,  687, 2163,  680,  700,  696,  685,  685,
-      700,  693, 2163,  733,  691,  699,  706,  707,  711,  739,
-      740,  698,  711,  709,  703,  703,  712,  721,  722,  713,
-      706,  726,  722,  711,  711,  726,  719,    0,  759,  717,
-      725,  732,  733,  737,  765,  766,  724,  737,  735,  729,
-      728,  737,  746,  747,  738,  731,  751,  747,  736,  736,
-      751,  744,    0,  784,  742,  750,  757,  758,  762,  790,
-
-      791,  749,  762,  760,  754,  753,  762,  771,  772,  763,
-      756,  776,  772,  761,  761,  776,  769,    0,  809,  767,
-      775,  782,  783,  787,  815,  816,  774,  787,  784,  793,
-      784,  796,  785,    0,  825,  783,  797,  801,  829,  830,
-      788,  801,  799,  793,  792,  801,  810,  811,  802,  795,
-      815,  811,  800,  800,  815,  808,    0,  848,  806,  814,
-      821,  822,  826,  854,  855,  813,  826,  824,  818,  817,
-      826,  835,  836,  827,  820,  840,  836,  825,  825,  840,
-      833,    0,  873,  831,  839,  846,  847,  851,  879,  880,
-      838,  851,  847,  848,  847,  855,  852,  853,  856,  859,
-
-      849,  856,  859,  855, 2163,  858, 2163,  874,  866,  899,
-      868,  866, 2163,  888,  872,  874,  869,  870,  869,  877,
-      875,  876,  879,  882,  872,  879,  882,  878,    0,  881,
-      897,  889,  922,  891,  889,  911,  895,  897,  892,  893,
-      892,  900,  898,  899,  902,  905,  895,  902,  905,  901,
-        0,  904,  920,  912,  945,  914,  912,  916,  919,  914,
-      915,  914,  922,  919,  920,  923,  926,  916,  923,  926,
-      922,    0,  925,  941,  933,  966,  935,  933,  955,  939,
-      941,  941,  938,  941,  938,  955,  947,  948,  950,  946,
-      947,  946,  954,  951,  952,  955,  958,  948,  955,  958,
-
-      954,    0,  957,  973,  965,  998,  967,  965,  987,  971,
-      973,  968,  969,  968,  976,  974,  975,  978,  981,  971,
-      978,  981,  977,    0,  980,  996,  988, 1021,  990,  988,
-     1010,  994,  996,  996,  994, 1003, 1000,  998,  998, 1035,
-     1006, 1002, 1009, 1005, 2163, 1013,  997, 1042, 2163, 1045,
-     1006, 1016, 1009, 1017, 1050, 2163, 1019, 1017, 1027, 1024,
-     1021, 1021, 1058, 1029, 1025, 1032, 1028,    0, 1036, 1020,
-     1065, 1068, 1029, 1039, 1032, 1040, 1073,    0, 1042, 1040,
-     1050, 1047, 1044, 1044, 1081, 1052, 1048, 1055, 1051,    0,
-     1059, 1043, 1088, 1091, 1052, 1062, 1094,    0, 1063, 1061,
-
-     1070, 1067, 1065, 1065, 1102, 1073, 1069, 1076, 1072,    0,
-     1080, 1064, 1109, 1112, 1073, 1083, 1076, 1084, 1117,    0,
-     1087, 1084, 1121, 1095, 1079, 1126, 1087, 1128,    0, 1097,
-     1095, 1104, 1101, 1098, 1099, 1136, 1107, 1103, 1110, 1106,
-        0, 1114, 1098, 1143, 1146, 1107, 1117, 1110, 1118, 1151,
-        0, 1120, 1118, 1128, 1125, 1122, 1122, 1159, 1130, 1126,
-     1133, 1129,    0, 1137, 1121, 1166, 1169, 1130, 1140, 1133,
-     1141, 1174,    0, 1133, 1138, 1155, 1152, 1136, 1149, 2163,
-     1182, 1134, 1148, 2163, 1147, 1158, 2163, 1189, 1193, 1154,
-     1192, 1152, 1149, 2163, 1154, 1160, 1176, 1173, 1157, 1170,
-
-     1203, 1155, 1169,    0, 1168, 1179, 1210, 1175, 1211, 1170,
-     1167, 1172, 1177, 1193, 1190, 1174, 1187, 1220, 1172, 1186,
-        0, 1185, 1196, 1191, 1226, 1185, 1190, 1206, 1203, 1187,
-     1200, 1233, 1185, 1199,    0, 1198, 1209, 1240, 1205, 1241,
-     1200, 1197, 1217, 1201, 1218, 1213, 1206, 1211, 1227, 1224,
-     1208, 1221, 1254, 1206, 1220,    0, 1219, 1230, 1261, 1226,
-     1262, 1221, 1218, 1223, 1228, 1244, 1241, 1225, 1238, 1271,
-     1223, 1237,    0, 1236, 1247, 1278, 1243, 1279, 1238, 1235,
-     2163, 1254, 1272, 1251, 1237, 1244, 2163, 1255, 1240, 1250,
-     1246, 1293, 1265, 2163, 1247, 1263,    0, 1268, 1286, 1265,
-
-     1251, 1258, 1269, 1254, 1264, 1260, 1278, 1259, 1275,    0,
-     1280, 1298, 1277, 1263, 1270, 1281, 1266, 1276, 1272, 1290,
-        0, 1290, 1308, 1287, 1273, 1280, 1291, 1276, 1286, 1282,
-     1300, 1281, 1297, 1282, 1287, 1305,    0, 1305, 1323, 1302,
-     1288, 1295, 1306, 1291, 1301, 1297, 1315, 1296, 1312,    0,
-     1317, 1335, 1314, 1300, 1307, 1318, 1303, 1313, 1309, 1327,
-     1308, 1324, 1313, 1344, 1317, 1360, 1362, 1363, 2163, 1364,
-     1320, 1320, 1339, 1327, 1326, 1357, 1330, 1373, 1375, 1376,
-        0, 1377, 1333, 1333, 1352, 1340, 1339, 1370, 1343, 1386,
-     1388, 1389,    0, 1390, 1346, 1346, 1349, 1381, 1354, 1397,
-
-     1399, 1400,    0, 1401, 1357, 1357, 1376, 1364, 1407, 1364,
-     1366, 1397, 1370, 1413, 1416, 1417,    0, 1418, 1374, 1374,
-     1394, 1381, 1380, 1411, 1384, 1427, 1429, 1430,    0, 1431,
-     1387, 1387, 1406, 1394, 1398, 1438, 1400, 1440, 1442, 1444,
-     2163, 2163, 2163, 1403, 1415, 1407, 1408, 1413, 1453, 1415,
-     1455, 1457, 1416, 1428, 1419, 1419, 1425, 1465, 1427, 1424,
-     1436, 1430, 1470, 1432, 1472, 1474, 1433, 1445, 1436, 1436,
-     1438, 1443, 1483, 1445, 1485, 1487, 1446, 1458, 1449, 1449,
-     1455, 1495, 1457, 1497, 1499, 1458, 1470, 1461, 1461, 1464,
-     2163, 1470, 1508, 1510, 1512, 1514, 1485, 1486, 1487, 1478,
-
-     1484, 1522, 1524, 1526, 1497, 1497, 1497, 1489, 1495, 1533,
-     1504, 1493, 1499, 1537, 1539, 1541, 1512, 1512, 1512, 1546,
-     1505, 1511, 1549, 1551, 1553, 1524, 1524, 1524, 1516, 1522,
-     1560, 1562, 1564, 1535, 1535, 1535, 2163, 1569, 2163, 1526,
-     2163, 2163,    0, 1571, 1528,    0,    0,    0, 1573, 1530,
-        0, 1575, 1532,    0,    0,    0, 1577, 1534,    0,    0,
-        0, 1579, 1536,    0,    0, 2163, 1542, 1543, 1544, 1545,
-     1546, 1547, 1545, 1546, 1547, 1548, 1549, 1550, 1593, 1594,
-     1595, 1596, 1597, 1598, 2163, 2163, 1602, 1607, 1612, 1617,
-     1622, 1627, 1632, 1637, 1642, 1646, 1649, 1653, 1655, 1659,
-
-     1663
+        0,   51,  103,    0,    3,   26,  156,  209,  262,  315,
+       16,  367,  420,  473,  526,  579,  632,  685,  738,  791,
+       30,  842, 2173, 2174, 2174, 2163, 2120, 2174,    1, 2139,
+     2130,    1,    0, 2130,    6,    9,    7, 2126,   46, 2156,
+     2155,   33, 2136, 2134,   46,   47,   55, 2152, 2151,    0,
+     2150, 2150, 2148, 2106,   34, 2125, 2116,   37,   26, 2116,
+       50,   73,   55, 2112,    0, 2142, 2141, 2099,   45, 2118,
+     2109,   68,   51, 2109,   65,   79,   67, 2105, 2174, 2174,
+     2174, 2174, 2136, 2093, 2174,   70, 2112, 2103,   79,   82,
+     2103,   70,   89,   90, 2099,    0, 2130, 2087,   92, 2106,
+
+     2097,  101,   91, 2097,  102,  120,  104, 2093,  138,    0,
+     2082,  104, 2101, 2092,  123,  105, 2092,  117,  135,  137,
+     2088,  173,    0, 2118, 2118, 2116, 2074,  115, 2093, 2084,
+      132,  132, 2084,  148,  155,  149, 2080,    0, 2110, 2110,
+     2108, 2066,  142, 2085, 2076,  164,  145, 2076,  156,  191,
+      161, 2072, 2174, 2174, 2174, 2103, 2060, 2174,  158, 2079,
+     2070,  174,  148, 2070,  169,  192,  168, 2066, 2174, 2071,
+     2067,  187, 2058,  202, 2091, 2067, 2055, 2070, 2062, 2064,
+      203, 2080, 2052,  189, 2058, 2054, 2050,  244, 2174, 2082,
+     2070, 2074, 2077, 2072,  245, 2174, 2077,    0,    0,    0,
+
+     2076, 2050, 2046,  207, 2037,  213, 2070, 2046, 2034, 2049,
+     2041, 2043,  214, 2059, 2031,  212, 2037, 2033, 2029,    0,
+        0, 2061, 2035, 2031,  215, 2022,  236, 2055, 2031, 2019,
+     2034, 2026, 2028,  237, 2044, 2016,  245, 2022, 2018, 2014,
+        0,    0, 2021, 2017,  237, 2008,  243, 2041, 2017, 2005,
+     2020, 2012, 2014,  244, 2030, 2002,  253, 2008, 2004, 2000,
+      289, 2174,    0, 2007, 2003,  251, 1994,  258, 2027, 2003,
+     1991, 2006, 1998, 2000,  261, 2016, 1988,  302, 1994, 1990,
+     1986,  302, 2174,    0,    0,    0, 2018, 1992, 1988,  264,
+     1979,  270, 2012, 1988, 1976, 1991, 1983, 1985,  271, 2001,
+
+     1973,  306, 1979, 1975, 1971,    0,    0,    0, 2003, 1977,
+     1973,  268, 1964,  294, 1997, 1973, 1961, 1976, 1968, 1970,
+      307, 1986, 1958,  308, 1964, 1960, 1956, 1968, 1960, 1961,
+     1960, 1959, 1950, 1951,  350, 1961, 1955,  329, 1958, 1954,
+     1947, 1953, 1955,  212, 1950, 1944, 1951, 1977, 1937, 1948,
+     1951, 1963, 1956, 1961, 1944, 1936, 1937, 1936, 1935, 1926,
+     1927,  354, 1937, 1931,  352, 1934, 1930, 1923, 1929, 1931,
+      316, 1926, 1920, 1927, 1953, 1913, 1924, 1924, 1916, 1917,
+     1916, 1915, 1906, 1907,  373, 1917, 1911,  365, 1914, 1910,
+     1903, 1909, 1911,  343, 1906, 1900, 1907, 1933, 1893, 1904,
+
+     1904, 1896, 1897, 1896, 1895, 1886, 1887,  401, 1897, 1891,
+      380, 1894, 1890, 1883, 1889, 1891,  370, 1886, 1880, 1887,
+     1913, 1873, 1884, 1884, 1876, 1877, 1876, 1875, 1866, 1867,
+      426, 1877, 1871, 1874, 1870, 1863, 1869, 1871,  371, 1866,
+     1860, 1867, 1893, 1853, 1864, 1864, 1856, 1857, 1856, 1855,
+     1846, 1847,  434, 1857, 1851,  409, 1854, 1850, 1843, 1849,
+     1851,  378, 1846, 1840, 1847, 1873, 1833, 1844, 1844, 1836,
+     1837, 1836, 1835, 1826, 1827,  439, 1837, 1831,  416, 1834,
+     1830, 1823, 1829, 1831,  384, 1826, 1820, 1827, 1853, 1813,
+     1824,  320, 1813, 1819, 1812,   19, 1808, 1815,  453,  405,
+
+     1804, 1802, 1805, 1801, 1810, 1797, 1808, 1807, 1806, 1823,
+     1790, 1803, 1802, 1801, 1794, 2174, 1795, 1799, 2174,  345,
+     1791, 1797, 1790,  432, 1786, 1793,  461, 1782, 1780, 1783,
+     1779, 1788, 1775, 1786, 1785, 1784, 1801, 1768, 1781, 1780,
+     1779, 1772, 1773, 1777,  405, 1769, 1775, 1768,  436, 1764,
+     1771, 1760, 1758, 1761, 1757, 1766, 1753, 1764, 1763, 1762,
+     1779, 1746, 1759, 1758, 1757, 1750, 1751, 1755,  424, 1747,
+     1753, 1746,  448, 1742, 1749,  466, 1738, 1736, 1739, 1735,
+     1744, 1731, 1742, 1741, 1740, 1757, 1724, 1737, 1736, 1735,
+     1728, 1729, 1733, 1725, 1731, 1724,  459, 1720, 1727, 1716,
+
+     1713, 1724, 1723, 1722, 1721, 1720, 1719, 1712, 1713, 1717,
+      447, 1709, 1715, 1708,  467, 1704, 1711,  477, 1700, 1698,
+     1701, 1697, 1706, 1693, 1704, 1703, 1702, 1719, 1686, 1699,
+     1698, 1697, 1690, 1691, 1695,  455, 1687, 1693, 1686,  479,
+     1682, 1689,  502, 1678, 1676, 1679, 1675, 1684, 1671, 1682,
+     1681, 1680, 1697, 1664, 1677, 1676, 1675, 1668, 1669, 1673,
+     1661, 1670, 1674, 1699, 1670, 1653, 1667, 1661,    2,  503,
+     1651, 1651, 1655, 1653, 1663, 1655, 1658, 1646, 1644, 1651,
+     1653, 1646, 1645, 1644, 1650, 1652, 1648, 1636, 1645, 1648,
+     1670, 1636, 1616, 1628,   61,  327,   98,  152,  166,  166,
+
+      228,  230,  254,  244,  255,  264,  286,  299,  358,  363,
+      381,  385,  399,  389,  416,  429,  465,  452,  447,  475,
+      472,  508,  464,  467,  473,  473,  485,  479,  484,  474,
+      474,  483,  487,  482,  483,  484,  499,  503,  505,  495,
+      507,  513,  540,  513,  498,  514,  510,  545,  503,  505,
+      511,  511,  523,  517,  523,  513,  513,  522,  526,  521,
+      522,  523,  531,  535,  533,  538,  565,  538,  523,  534,
+      570,  526,  538,  543,  533,  540,  546,  554,  555,  563,
+      570,  569,  559,  573,  580,  607,  580,  565,  581,  577,
+      613,  569,  572,  578,  578,  590,  584,  589,  579,  579,
+
+      588,  592,  587,  588,  589,  597,  606,  604,  599,  610,
+      616,  644,  617,  602,  618,  614,  649,  607,  609,  615,
+      615,  627,  621,  626,  616,  616,  625,  629,  624,  625,
+      626,  634,  638,  636,  633,  627,  626, 2174,  635,  644,
+      645,  636, 2174,  629,  650,  646,  635,  635,  650,  648,
+     2174,  687,  650,  662,  669,  670,  676,  703,  705,  667,
+      680,  678,  672,  671,  680,  689,  690,  681,  674,  694,
+      690,  679,  679,  694,  687,    0,  726,  685,  693,  700,
+      701,  705,  732,  739,  690,  714,  712,  706,  705,  715,
+      724,  725,  716,  709,  729,  725,  714,  714,  729,  722,
+
+        0,  761,  720,  728,  735,  736,  740,  767,  768,  727,
+      740,  738,  732,  731,  740,  749,  750,  741,  734,  754,
+      750,  739,  739,  754,  747,    0,  786,  750,  758,  769,
+      774,  778,  805,  808,  768,  781,  781,  790,  781,  793,
+      782,    0,  821,  780,  794,  798,  825,  826,  785,  798,
+      796,  790,  789,  798,  807,  808,  799,  792,  812,  808,
+      799,  800,  815,  808,    0,  848,  807,  819,  826,  827,
+      833,  860,  862,  824,  837,  835,  829,  828,  837,  846,
+      847,  838,  831,  851,  847,  836,  836,  851,  844,    0,
+      883,  842,  850,  857,  858,  862,  889,  892,  847,  863,
+
+      859,  860,  859,  867,  864,  865,  868,  871,  861,  868,
+      871,  867, 2174,  870, 2174,  886,  878,  910,  880,  878,
+     2174,  900,  884,  886,  881,  882,  881,  889,  887,  888,
+      891,  894,  884,  891,  894,  890,    0,  893,  909,  901,
+      933,  903,  901,  923,  907,  909,  904,  905,  904,  912,
+      910,  911,  914,  917,  907,  914,  917,  913,    0,  916,
+      932,  924,  956,  926,  924,  928,  931,  926,  927,  926,
+      934,  931,  932,  935,  938,  928,  935,  938,  934,    0,
+      937,  953,  945,  977,  947,  945,  967,  951,  953,  953,
+      950,  953,  950,  967,  959,  960,  962,  958,  959,  958,
+
+      966,  963,  964,  967,  970,  960,  967,  970,  966,    0,
+      969,  985,  977, 1009,  979,  977,  999,  983,  985,  980,
+      981,  980,  988,  986,  987,  990,  993,  983,  990,  993,
+      989,    0,  992, 1008, 1000, 1032, 1002, 1000, 1022, 1006,
+     1008, 1008, 1006, 1015, 1012, 1010, 1010, 1046, 1018, 1014,
+     1021, 1017, 2174, 1025, 1009, 1053, 2174, 1056, 1018, 1028,
+     1021, 1029, 1061, 2174, 1031, 1030, 1039, 1036, 1033, 1033,
+     1069, 1041, 1037, 1044, 1040,    0, 1048, 1032, 1076, 1079,
+     1041, 1051, 1044, 1052, 1084,    0, 1054, 1053, 1062, 1059,
+     1056, 1056, 1092, 1064, 1060, 1067, 1063,    0, 1071, 1055,
+
+     1099, 1102, 1064, 1074, 1105,    0, 1075, 1073, 1082, 1080,
+     1077, 1077, 1113, 1085, 1081, 1088, 1084,    0, 1092, 1076,
+     1120, 1123, 1085, 1095, 1088, 1096, 1128,    0, 1099, 1097,
+     1132, 1107, 1091, 1137, 1099, 1139,    0, 1109, 1107, 1116,
+     1113, 1111, 1111, 1147, 1119, 1115, 1122, 1118,    0, 1126,
+     1110, 1154, 1157, 1119, 1129, 1122, 1130, 1162,    0, 1132,
+     1131, 1140, 1137, 1134, 1134, 1170, 1142, 1138, 1145, 1141,
+        0, 1149, 1133, 1177, 1180, 1142, 1152, 1145, 1153, 1185,
+        0, 1145, 1151, 1167, 1164, 1148, 1161, 2174, 1193, 1146,
+     1160, 2174, 1159, 1170, 2174, 1200, 1204, 1166, 1203, 1164,
+
+     1161, 2174, 1167, 1172, 1188, 1185, 1169, 1182, 1214, 1167,
+     1181,    0, 1180, 1191, 1221, 1187, 1222, 1182, 1179, 1184,
+     1189, 1205, 1202, 1186, 1199, 1231, 1184, 1198,    0, 1197,
+     1208, 1203, 1237, 1197, 1202, 1218, 1215, 1199, 1212, 1244,
+     1197, 1211,    0, 1210, 1221, 1251, 1217, 1252, 1212, 1209,
+     1229, 1213, 1230, 1225, 1218, 1223, 1239, 1236, 1220, 1233,
+     1265, 1218, 1232,    0, 1231, 1242, 1272, 1238, 1273, 1233,
+     1230, 1235, 1240, 1256, 1253, 1237, 1250, 1282, 1235, 1249,
+        0, 1248, 1259, 1289, 1255, 1290, 1250, 1247, 2174, 1266,
+     1284, 1263, 1249, 1256, 2174, 1267, 1252, 1262, 1258, 1304,
+
+     1277, 2174, 1259, 1275,    0, 1280, 1298, 1277, 1263, 1270,
+     1281, 1266, 1276, 1272, 1290, 1271, 1287,    0, 1292, 1310,
+     1289, 1275, 1282, 1293, 1278, 1288, 1284, 1302,    0, 1302,
+     1320, 1299, 1285, 1292, 1303, 1288, 1298, 1294, 1312, 1293,
+     1309, 1294, 1299, 1317,    0, 1317, 1335, 1314, 1300, 1307,
+     1318, 1303, 1313, 1309, 1327, 1308, 1324,    0, 1329, 1347,
+     1326, 1312, 1319, 1330, 1315, 1325, 1321, 1339, 1320, 1336,
+     1325, 1356, 1329, 1371, 1373, 1374, 2174, 1375, 1332, 1332,
+     1352, 1339, 1338, 1369, 1342, 1384, 1386, 1387,    0, 1388,
+     1345, 1345, 1365, 1352, 1351, 1382, 1355, 1397, 1399, 1400,
+
+        0, 1401, 1358, 1358, 1362, 1393, 1366, 1408, 1410, 1411,
+        0, 1412, 1369, 1369, 1389, 1376, 1418, 1376, 1378, 1409,
+     1382, 1426, 1424, 1428,    0, 1429, 1386, 1386, 1405, 1393,
+     1392, 1423, 1396, 1438, 1440, 1441,    0, 1442, 1399, 1399,
+     1419, 1406, 1410, 1449, 1412, 1451, 1453, 1455, 2174, 2174,
+     2174, 1415, 1428, 1420, 1420, 1425, 1464, 1427, 1466, 1468,
+     1428, 1440, 1431, 1432, 1437, 1476, 1439, 1436, 1448, 1442,
+     1481, 1444, 1483, 1485, 1445, 1457, 1448, 1449, 1450, 1455,
+     1494, 1457, 1496, 1498, 1458, 1470, 1461, 1462, 1467, 1506,
+     1469, 1508, 1510, 1470, 1482, 1473, 1474, 1476, 2174, 1482,
+
+     1519, 1521, 1523, 1525, 1498, 1499, 1499, 1490, 1496, 1533,
+     1535, 1537, 1509, 1509, 1510, 1501, 1507, 1544, 1516, 1505,
+     1511, 1548, 1550, 1552, 1524, 1524, 1525, 1557, 1517, 1523,
+     1560, 1562, 1564, 1536, 1536, 1537, 1528, 1534, 1571, 1573,
+     1575, 1547, 1547, 1548, 2174, 1580, 2174, 1538, 2174, 2174,
+        0, 1582, 1540,    0,    0,    0, 1584, 1542,    0, 1586,
+     1544,    0,    0,    0, 1588, 1546,    0,    0,    0, 1590,
+     1548,    0,    0, 2174, 1554, 1555, 1556, 1557, 1558, 1559,
+     1557, 1558, 1559, 1560, 1561, 1562, 1604, 1605, 1606, 1607,
+     1608, 1609, 2174, 2174, 1613, 1618, 1623, 1628, 1633, 1638,
+
+     1643, 1648, 1653, 1657, 1660, 1664, 1666, 1670, 1674
     } ;
 
-static yyconst flex_int16_t yy_def[1702] =
+static yyconst flex_int16_t yy_def[1710] =
     {   0,
-     1687, 1687, 1687,    2,    3,    2, 1688, 1688, 1689, 1689,
-     1690, 1690, 1691, 1691, 1692, 1692, 1693, 1693, 1694, 1694,
-     1695, 1695, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686,
-     1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686,
-     1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1696,
-     1696, 1696, 1696, 1696, 1696, 1696, 1696, 1696, 1696, 1696,
-     1696, 1696, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697,
-     1697, 1697, 1697, 1697, 1697, 1697, 1686, 1686, 1686, 1686,
-     1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686,
-     1686, 1686, 1686, 1698, 1698, 1698, 1698, 1698, 1698, 1698,
-
-     1698, 1698, 1698, 1698, 1698, 1698, 1686, 1699, 1699, 1699,
-     1699, 1699, 1699, 1699, 1699, 1699, 1699, 1699, 1699, 1686,
-     1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700,
-     1700, 1700, 1700, 1700, 1700, 1701, 1701, 1701, 1701, 1701,
-     1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701, 1686, 1686,
-     1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686,
-     1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686,
-     1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686,
-     1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686,
-     1686, 1686, 1686, 1696, 1696, 1696, 1696, 1696, 1696, 1696,
-
-     1696, 1696, 1696, 1696, 1696, 1696, 1696, 1696, 1696, 1696,
-     1696, 1696, 1696, 1697, 1697, 1697, 1697, 1697, 1697, 1697,
-     1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697,
-     1697, 1697, 1697, 1697, 1698, 1698, 1698, 1698, 1698, 1698,
-     1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698,
-     1698, 1698, 1698, 1698, 1686, 1686, 1699, 1699, 1699, 1699,
-     1699, 1699, 1699, 1699, 1699, 1699, 1699, 1699, 1699, 1699,
-     1699, 1699, 1699, 1699, 1699, 1686, 1686, 1700, 1700, 1700,
-     1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700,
-     1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1701,
-
-     1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701,
-     1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701, 1686,
-     1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686,
-     1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686,
-     1686, 1686, 1686, 1686, 1686, 1686, 1696, 1696, 1696, 1696,
-     1696, 1696, 1696, 1696, 1696, 1696, 1696, 1696, 1696, 1696,
-     1696, 1696, 1696, 1696, 1696, 1696, 1696, 1696, 1696, 1697,
-     1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697,
-     1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697,
-     1697, 1697, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698,
-
-     1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698,
-     1698, 1698, 1698, 1698, 1698, 1699, 1699, 1699, 1699, 1699,
-     1699, 1699, 1699, 1699, 1699, 1699, 1699, 1699, 1699, 1699,
-     1699, 1699, 1699, 1699, 1699, 1699, 1699, 1700, 1700, 1700,
-     1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700,
-     1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700,
-     1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701,
-     1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701,
-     1701, 1701, 1701, 1686, 1686, 1686, 1686, 1686, 1686, 1686,
-     1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686,
-
-     1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686,
-     1686, 1696, 1696, 1696, 1696, 1696, 1696, 1696, 1696, 1696,
-     1696, 1696, 1696, 1696, 1696, 1696, 1696, 1696, 1696, 1696,
-     1696, 1696, 1696, 1696, 1696, 1696, 1697, 1697, 1697, 1697,
-     1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697,
-     1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697,
-     1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698,
-     1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698,
-     1698, 1698, 1698, 1698, 1698, 1699, 1699, 1699, 1699, 1699,
-     1699, 1699, 1699, 1699, 1699, 1699, 1699, 1699, 1699, 1699,
-
-     1699, 1699, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700,
-     1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700,
-     1700, 1700, 1700, 1700, 1700, 1700, 1700, 1701, 1701, 1701,
-     1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701,
-     1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701,
-     1701, 1701, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686,
-     1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686,
-     1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1696,
-     1696, 1696, 1696, 1696, 1696, 1696, 1696, 1696, 1696, 1696,
-     1696, 1696, 1696, 1696, 1696, 1696, 1696, 1696, 1696, 1696,
-
-     1696, 1696, 1696, 1696, 1696, 1697, 1697, 1697, 1697, 1697,
-     1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697,
-     1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697,
-     1697, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698,
-     1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698,
-     1698, 1698, 1698, 1698, 1698, 1698, 1698, 1699, 1699, 1699,
-     1699, 1699, 1699, 1699, 1699, 1699, 1699, 1699, 1699, 1699,
-     1699, 1699, 1699, 1699, 1700, 1700, 1700, 1700, 1700, 1700,
-     1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700,
-     1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700,
-
-     1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701,
-     1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701,
-     1701, 1701, 1701, 1701, 1701, 1701, 1686, 1686, 1686, 1686,
-     1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686,
-     1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686,
-     1686, 1686, 1686, 1696, 1696, 1696, 1696, 1696, 1696, 1696,
-     1696, 1696, 1696, 1696, 1696, 1696, 1696, 1696, 1696, 1696,
-     1696, 1696, 1696, 1696, 1696, 1696, 1696, 1696, 1697, 1697,
-     1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697,
-     1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697,
-
-     1697, 1697, 1697, 1698, 1698, 1698, 1698, 1698, 1698, 1698,
-     1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698,
-     1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1699, 1699,
-     1699, 1699, 1699, 1699, 1699, 1699, 1699, 1699, 1699, 1699,
-     1699, 1699, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700,
-     1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700,
-     1700, 1700, 1700, 1700, 1700, 1700, 1700, 1701, 1701, 1701,
-     1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701,
-     1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701,
-     1701, 1701, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686,
-
-     1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686,
-     1686, 1686, 1686, 1686, 1686, 1686, 1696, 1696, 1696, 1696,
-     1696, 1696, 1696, 1696, 1696, 1696, 1696, 1696, 1696, 1696,
-     1696, 1696, 1696, 1696, 1696, 1696, 1696, 1696, 1697, 1697,
-     1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697,
-     1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1698,
-     1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698,
-     1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698,
-     1698, 1699, 1699, 1699, 1699, 1699, 1699, 1699, 1699, 1700,
-     1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700,
-
-     1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700,
-     1700, 1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701,
-     1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701,
-     1701, 1701, 1701, 1686, 1686, 1686, 1686, 1686, 1686, 1686,
-     1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686,
-     1686, 1686, 1686, 1686, 1686, 1686, 1696, 1696, 1696, 1696,
-     1696, 1696, 1696, 1696, 1696, 1696, 1696, 1696, 1696, 1696,
-     1696, 1696, 1696, 1696, 1696, 1696, 1696, 1696, 1697, 1697,
-     1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697,
-     1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1698, 1698,
-
-     1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698,
-     1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698,
-     1699, 1699, 1699, 1699, 1699, 1699, 1699, 1699, 1699, 1700,
-     1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700,
-     1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700,
-     1700, 1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701,
-     1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701,
-     1701, 1701, 1701, 1686, 1686, 1686, 1686, 1686, 1686, 1686,
-     1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686,
-     1686, 1686, 1686, 1686, 1696, 1696, 1696, 1696, 1696, 1696,
-
-     1696, 1696, 1696, 1696, 1696, 1696, 1696, 1696, 1696, 1696,
-     1696, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697,
-     1697, 1697, 1697, 1697, 1697, 1698, 1698, 1698, 1698, 1698,
-     1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698,
-     1698, 1698, 1699, 1699, 1699, 1699, 1700, 1700, 1700, 1700,
-     1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700,
-     1700, 1700, 1700, 1701, 1701, 1701, 1701, 1701, 1701, 1701,
-     1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701,
-     1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686,
-     1686, 1686, 1686, 1686, 1686, 1686, 1696, 1696, 1696, 1696,
-
-     1696, 1696, 1696, 1696, 1696, 1696, 1696, 1696, 1696, 1697,
-     1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697,
-     1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698,
-     1698, 1698, 1698, 1699, 1699, 1699, 1700, 1700, 1700, 1700,
-     1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1701,
-     1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701,
-     1701, 1701, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686,
-     1686, 1686, 1686, 1686, 1696, 1696, 1696, 1696, 1696, 1696,
-     1696, 1696, 1696, 1696, 1696, 1696, 1697, 1697, 1697, 1697,
-     1697, 1697, 1697, 1697, 1697, 1697, 1698, 1698, 1698, 1698,
-
-     1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1699, 1699,
-     1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700,
-     1700, 1700, 1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701,
-     1701, 1701, 1701, 1701, 1686, 1686, 1686, 1686, 1686, 1686,
-     1686, 1686, 1686, 1686, 1686, 1686, 1686, 1696, 1696, 1696,
-     1696, 1696, 1696, 1696, 1696, 1696, 1697, 1697, 1697, 1697,
-     1697, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698,
-     1699, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700,
-     1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701, 1686,
-     1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1696,
-
-     1696, 1696, 1696, 1696, 1696, 1696, 1696, 1697, 1697, 1697,
-     1697, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1699,
-     1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1701, 1701,
-     1701, 1701, 1701, 1701, 1701, 1701, 1686, 1686, 1686, 1686,
-     1686, 1686, 1696, 1696, 1696, 1696, 1696, 1697, 1697, 1697,
-     1698, 1698, 1698, 1698, 1698, 1700, 1700, 1700, 1700, 1700,
-     1701, 1701, 1701, 1701, 1701, 1686, 1686, 1696, 1697, 1698,
-     1700, 1701, 1686, 1696, 1697, 1698, 1700, 1701, 1686, 1696,
-     1697, 1698, 1700, 1701, 1686,    0, 1686, 1686, 1686, 1686,
-     1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686,
-
-     1686
+     1695, 1695, 1695,    2,    3,    2, 1696, 1696, 1697, 1697,
+     1698, 1698, 1699, 1699, 1700, 1700, 1701, 1701, 1702, 1702,
+     1703, 1703, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694,
+     1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694,
+     1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1704,
+     1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704,
+     1704, 1704, 1704, 1704, 1705, 1705, 1705, 1705, 1705, 1705,
+     1705, 1705, 1705, 1705, 1705, 1705, 1705, 1705, 1694, 1694,
+     1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694,
+     1694, 1694, 1694, 1694, 1694, 1706, 1706, 1706, 1706, 1706,
+
+     1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706, 1694, 1707,
+     1707, 1707, 1707, 1707, 1707, 1707, 1707, 1707, 1707, 1707,
+     1707, 1694, 1708, 1708, 1708, 1708, 1708, 1708, 1708, 1708,
+     1708, 1708, 1708, 1708, 1708, 1708, 1708, 1709, 1709, 1709,
+     1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709,
+     1709, 1709, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694,
+     1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694,
+     1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694,
+     1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694,
+     1694, 1694, 1694, 1694, 1694, 1694, 1694, 1704, 1704, 1704,
+
+     1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704,
+     1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704, 1705,
+     1705, 1705, 1705, 1705, 1705, 1705, 1705, 1705, 1705, 1705,
+     1705, 1705, 1705, 1705, 1705, 1705, 1705, 1705, 1705, 1705,
+     1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706,
+     1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706,
+     1694, 1694, 1707, 1707, 1707, 1707, 1707, 1707, 1707, 1707,
+     1707, 1707, 1707, 1707, 1707, 1707, 1707, 1707, 1707, 1707,
+     1707, 1694, 1694, 1708, 1708, 1708, 1708, 1708, 1708, 1708,
+     1708, 1708, 1708, 1708, 1708, 1708, 1708, 1708, 1708, 1708,
+
+     1708, 1708, 1708, 1708, 1708, 1709, 1709, 1709, 1709, 1709,
+     1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709,
+     1709, 1709, 1709, 1709, 1709, 1709, 1709, 1694, 1694, 1694,
+     1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694,
+     1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694,
+     1694, 1694, 1694, 1694, 1704, 1704, 1704, 1704, 1704, 1704,
+     1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704,
+     1704, 1704, 1704, 1704, 1704, 1704, 1704, 1705, 1705, 1705,
+     1705, 1705, 1705, 1705, 1705, 1705, 1705, 1705, 1705, 1705,
+     1705, 1705, 1705, 1705, 1705, 1705, 1705, 1705, 1705, 1705,
+
+     1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706,
+     1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706,
+     1706, 1706, 1706, 1707, 1707, 1707, 1707, 1707, 1707, 1707,
+     1707, 1707, 1707, 1707, 1707, 1707, 1707, 1707, 1707, 1707,
+     1707, 1707, 1707, 1707, 1707, 1708, 1708, 1708, 1708, 1708,
+     1708, 1708, 1708, 1708, 1708, 1708, 1708, 1708, 1708, 1708,
+     1708, 1708, 1708, 1708, 1708, 1708, 1708, 1708, 1709, 1709,
+     1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709,
+     1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709,
+     1709, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694,
+
+     1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694,
+     1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1704,
+     1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704,
+     1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704,
+     1704, 1704, 1704, 1704, 1705, 1705, 1705, 1705, 1705, 1705,
+     1705, 1705, 1705, 1705, 1705, 1705, 1705, 1705, 1705, 1705,
+     1705, 1705, 1705, 1705, 1705, 1705, 1705, 1705, 1706, 1706,
+     1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706,
+     1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706,
+     1706, 1706, 1706, 1707, 1707, 1707, 1707, 1707, 1707, 1707,
+
+     1707, 1707, 1707, 1707, 1707, 1707, 1707, 1707, 1707, 1707,
+     1708, 1708, 1708, 1708, 1708, 1708, 1708, 1708, 1708, 1708,
+     1708, 1708, 1708, 1708, 1708, 1708, 1708, 1708, 1708, 1708,
+     1708, 1708, 1708, 1708, 1708, 1709, 1709, 1709, 1709, 1709,
+     1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709,
+     1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709,
+     1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694,
+     1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694,
+     1694, 1694, 1694, 1694, 1694, 1694, 1694, 1704, 1704, 1704,
+     1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704,
+
+     1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704,
+     1704, 1704, 1704, 1705, 1705, 1705, 1705, 1705, 1705, 1705,
+     1705, 1705, 1705, 1705, 1705, 1705, 1705, 1705, 1705, 1705,
+     1705, 1705, 1705, 1705, 1705, 1705, 1705, 1705, 1705, 1706,
+     1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706,
+     1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706,
+     1706, 1706, 1706, 1706, 1706, 1707, 1707, 1707, 1707, 1707,
+     1707, 1707, 1707, 1707, 1707, 1707, 1707, 1707, 1707, 1707,
+     1707, 1707, 1708, 1708, 1708, 1708, 1708, 1708, 1708, 1708,
+     1708, 1708, 1708, 1708, 1708, 1708, 1708, 1708, 1708, 1708,
+
+     1708, 1708, 1708, 1708, 1708, 1708, 1708, 1708, 1709, 1709,
+     1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709,
+     1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709,
+     1709, 1709, 1709, 1709, 1694, 1694, 1694, 1694, 1694, 1694,
+     1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694,
+     1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694,
+     1694, 1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704,
+     1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704,
+     1704, 1704, 1704, 1704, 1704, 1704, 1705, 1705, 1705, 1705,
+     1705, 1705, 1705, 1705, 1705, 1705, 1705, 1705, 1705, 1705,
+
+     1705, 1705, 1705, 1705, 1705, 1705, 1705, 1705, 1705, 1705,
+     1705, 1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706,
+     1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706,
+     1706, 1706, 1706, 1706, 1706, 1706, 1707, 1707, 1707, 1707,
+     1707, 1707, 1707, 1707, 1707, 1707, 1707, 1707, 1707, 1707,
+     1708, 1708, 1708, 1708, 1708, 1708, 1708, 1708, 1708, 1708,
+     1708, 1708, 1708, 1708, 1708, 1708, 1708, 1708, 1708, 1708,
+     1708, 1708, 1708, 1708, 1708, 1709, 1709, 1709, 1709, 1709,
+     1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709,
+     1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709,
+
+     1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694,
+     1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694,
+     1694, 1694, 1694, 1694, 1704, 1704, 1704, 1704, 1704, 1704,
+     1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704,
+     1704, 1704, 1704, 1704, 1704, 1704, 1705, 1705, 1705, 1705,
+     1705, 1705, 1705, 1705, 1705, 1705, 1705, 1705, 1705, 1705,
+     1705, 1705, 1705, 1705, 1705, 1705, 1705, 1706, 1706, 1706,
+     1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706,
+     1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706, 1707,
+     1707, 1707, 1707, 1707, 1707, 1707, 1707, 1708, 1708, 1708,
+
+     1708, 1708, 1708, 1708, 1708, 1708, 1708, 1708, 1708, 1708,
+     1708, 1708, 1708, 1708, 1708, 1708, 1708, 1708, 1708, 1709,
+     1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709,
+     1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709,
+     1709, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694,
+     1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694,
+     1694, 1694, 1694, 1694, 1704, 1704, 1704, 1704, 1704, 1704,
+     1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704,
+     1704, 1704, 1704, 1704, 1704, 1704, 1705, 1705, 1705, 1705,
+     1705, 1705, 1705, 1705, 1705, 1705, 1705, 1705, 1705, 1705,
+
+     1705, 1705, 1705, 1705, 1705, 1705, 1706, 1706, 1706, 1706,
+     1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706,
+     1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706, 1707, 1707,
+     1707, 1707, 1707, 1707, 1707, 1707, 1707, 1708, 1708, 1708,
+     1708, 1708, 1708, 1708, 1708, 1708, 1708, 1708, 1708, 1708,
+     1708, 1708, 1708, 1708, 1708, 1708, 1708, 1708, 1708, 1709,
+     1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709,
+     1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709,
+     1709, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694,
+     1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694,
+
+     1694, 1694, 1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704,
+     1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704, 1705,
+     1705, 1705, 1705, 1705, 1705, 1705, 1705, 1705, 1705, 1705,
+     1705, 1705, 1705, 1706, 1706, 1706, 1706, 1706, 1706, 1706,
+     1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706,
+     1707, 1707, 1707, 1707, 1708, 1708, 1708, 1708, 1708, 1708,
+     1708, 1708, 1708, 1708, 1708, 1708, 1708, 1708, 1708, 1708,
+     1708, 1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709,
+     1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709, 1694, 1694,
+     1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694,
+
+     1694, 1694, 1694, 1694, 1704, 1704, 1704, 1704, 1704, 1704,
+     1704, 1704, 1704, 1704, 1704, 1704, 1704, 1705, 1705, 1705,
+     1705, 1705, 1705, 1705, 1705, 1705, 1705, 1705, 1706, 1706,
+     1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706,
+     1706, 1707, 1707, 1707, 1708, 1708, 1708, 1708, 1708, 1708,
+     1708, 1708, 1708, 1708, 1708, 1708, 1708, 1709, 1709, 1709,
+     1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709,
+     1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694,
+     1694, 1694, 1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704,
+     1704, 1704, 1704, 1704, 1705, 1705, 1705, 1705, 1705, 1705,
+
+     1705, 1705, 1705, 1705, 1706, 1706, 1706, 1706, 1706, 1706,
+     1706, 1706, 1706, 1706, 1706, 1706, 1707, 1707, 1708, 1708,
+     1708, 1708, 1708, 1708, 1708, 1708, 1708, 1708, 1708, 1708,
+     1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709,
+     1709, 1709, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694,
+     1694, 1694, 1694, 1694, 1694, 1704, 1704, 1704, 1704, 1704,
+     1704, 1704, 1704, 1704, 1705, 1705, 1705, 1705, 1705, 1706,
+     1706, 1706, 1706, 1706, 1706, 1706, 1706, 1706, 1707, 1708,
+     1708, 1708, 1708, 1708, 1708, 1708, 1708, 1708, 1709, 1709,
+     1709, 1709, 1709, 1709, 1709, 1709, 1709, 1694, 1694, 1694,
+
+     1694, 1694, 1694, 1694, 1694, 1694, 1694, 1704, 1704, 1704,
+     1704, 1704, 1704, 1704, 1704, 1705, 1705, 1705, 1705, 1706,
+     1706, 1706, 1706, 1706, 1706, 1706, 1706, 1707, 1708, 1708,
+     1708, 1708, 1708, 1708, 1708, 1708, 1709, 1709, 1709, 1709,
+     1709, 1709, 1709, 1709, 1694, 1694, 1694, 1694, 1694, 1694,
+     1704, 1704, 1704, 1704, 1704, 1705, 1705, 1705, 1706, 1706,
+     1706, 1706, 1706, 1708, 1708, 1708, 1708, 1708, 1709, 1709,
+     1709, 1709, 1709, 1694, 1694, 1704, 1705, 1706, 1708, 1709,
+     1694, 1704, 1705, 1706, 1708, 1709, 1694, 1704, 1705, 1706,
+     1708, 1709, 1694,    0, 1694, 1694, 1694, 1694, 1694, 1694,
+
+     1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694
     } ;
 
-static yyconst flex_int16_t yy_nxt[2218] =
+static yyconst flex_int16_t yy_nxt[2228] =
     {   0,
-     1686,   39,   25,   39,   47,  184,   47,  184,   40,   26,
-       41,   48, 1686,   49,   45,   27,   47,   24,   47,  835,
-      191,  171,  191,   48,   43,   49,   46,   24,  187,   24,
-       24,   24,   25,   24,  176,  188,  184,   24,  184,   51,
-      167,   78,   79,   78,   80,   52,  836,  168,  177,   81,
-      150,  172,  151,   28,   25,   82,  178,  152,  181,  867,
-      201,   26,  182,  153,   29,   30,   31,   32,  173,  197,
-      206,   33,   34,  174,  187,   35,  198,  179,   36,   37,
-       38,  188,  222,   28,  207,   24,   24,   25,   24,  180,
-      202,  170,   24,   83,   95,   24,   24,   25,   24,  868,
-
-       96,  154,   24,  178,  137,   28,   39,   25,   39,  208,
-      138,  203,  223,   40,   26,   41,  204,  211,  190,   42,
-       27,  212,  224,  227,  179,  218,  167,  225,  869,   43,
-      209,   44,  219,  168,  229,  232,  180,  228,   28,  233,
-      171,  173,  210,  176,  178,  181,  174,  238,   28,  182,
-      242,  244,  870,  871,  239,  230,  245,  177,   28,   24,
-       24,   25,   24,  249,  263,  179,   24,  231,   51,  247,
-      172,   53,   54,   55,   56,  872,  265,  180,   57,   58,
-      243,  266,   59,  248,  250,   60,   61,   62,  252,  255,
-      256,  255,  253,  259,  264,  268,  251,  270,  273,  283,
-
-      260,  287,  274,  276,  277,  276,  284,  873,  294,  269,
-      307,  292,   28,   24,   24,   25,   24,   24,  271,   24,
-       24,   64,   26,   65,   24,  293,  314,  289,   66,  295,
-      272,  288,  290,  297,  309,  303,  312,  298,  167,  310,
-      308,  296,  304,  176,  317,  168,  173,  315,  318,  874,
-      313,  174,  181,  171,  503,  322,  182,  177,  323,  316,
-      325,  333,  875,  178,  326,  334,   28,   24,   24,   25,
-       24,   24,  504,   24,   24,   64,   26,   65,   24,   67,
-       68,   69,   70,  172,  179,  876,   71,   72,  337,  191,
-       73,  191,  877,   74,   75,   76,  180,  349,  364,  338,
-
-      350,  352,  339,  360,  387,  353,  375,  361,  372,  365,
-      376,  373,  366,  383,  410,  388,  395,  384,  389,  396,
-       28,   78,   79,   78,   80,  411,  398,  406,  412,   81,
-      399,  407,   84,   85,   86,   87,  255,  256,  255,   88,
-       89,  418,  432,   90,  419,  421,   91,   92,   93,  422,
-      428,  530,  440,  433,  429,  441,  434,  276,  277,  276,
-      443,  451,  878,  463,  444,  452,  464,  466,  455,  531,
-      879,  467,  554,   83,   24,   24,   25,   24,  880,  456,
-      474,   24,  457,   95,  475,  478,   97,   98,   99,  100,
-      555,  653,  881,  101,  102,  654,  479,  103,  579,  480,
-
-      104,  105,  106,  491,  830,  491,  492,  882,  494,  491,
-      495,  491,  519,  492,  496,  491,  580,  491,  492,  519,
-      680,  883,  497,  503,  681,  492,  621,   28,   24,   24,
-      107,   24,   24,   24,   24,  884,  835,   26,   24,   24,
-      521,  597,  522,  109,  622,  545,  523,  546,  646,  885,
-      491,  547,  491,  568,  524,  570,  887,  571,   24,  548,
-      568,  572,  491,  861,  491,  492,  647,  658,  491,  573,
-      491,  610,  492,  659,  662,  662,  662,  662,  610,  888,
-      889,   28,   24,   24,  107,   24,   24,   24,   24,  890,
-      891,   26,   24,   24,  110,  111,  112,  113,  662,  706,
-
-      662,  114,  115,  707,  491,  116,  491,  635,  117,  118,
-      119,  612,   24,  613,  635,  732,  637,  614,  638,  733,
-      685,  491,  639,  491,  492,  615,  686,  711,  737,  892,
-      640,  492,  893,  712,  738,   28,   24,   24,  120,   24,
-      662,  761,  662,   24,  122,  123,  124,  659,  775,  780,
-      801,  125,  776,  806,  802,  781,  662,  835,  662,  807,
-      662,  894,  662,  895,  896,  897,  898,  899,  900,  901,
-      902,  903,  904,  905,  906,  830,  907,  908,  909,  910,
-      835,  912,  913,  914,  886,  915,  916,  917,  918,   28,
-       24,   24,  120,   24,  919,  920,  921,   24,  122,  123,
-
-      124,  922,  126,  127,  128,  129,  923,  911,  924,  130,
-      131,  925,  926,  132,  927,  928,  133,  134,  135,  829,
-      830,  929,  930,  931,  932,  835,  933,  934,  935,  936,
-      937,  938,  939,  940,  941,  942,  943,  944,  945,  830,
-      946,  947,  948,   28,   24,   24,   25,   24,  949,  835,
-      951,   24,  836,  137,  952,  953,  139,  140,  141,  142,
-      954,  955,  956,  143,  144,  957,  958,  145,  959,  960,
-      146,  147,  148,  961,  962,  963,  950,  964,  965,  966,
-      967,  968,  969,  970,  830,  971,  972,  973,  974,  976,
-      835,  977,  978,  979,  980,  981,  982,   28,  150,  983,
-
-      151,  984,  985,  986,  987,  152,  988,  989,  155,  156,
-      157,  158,  990,  991,  992,  159,  160,  975,  993,  161,
-      994,  995,  162,  163,  164,  996,  997,  998,  999, 1000,
-     1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010,
-     1011, 1012, 1013, 1014, 1014, 1015, 1016, 1017, 1018,  154,
-     1019, 1020, 1021, 1022, 1023, 1024, 1025, 1026, 1027, 1028,
-     1029, 1030, 1007, 1031, 1032, 1033, 1034, 1035, 1013, 1014,
-     1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045,
-     1046, 1047, 1048, 1049, 1050, 1051, 1052, 1007, 1053, 1054,
-     1055, 1056, 1057, 1013, 1014, 1014, 1058, 1059, 1060, 1061,
-
-     1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071,
-     1072, 1073, 1007, 1074, 1075, 1076, 1077, 1078, 1013, 1014,
-     1079, 1080, 1081, 1082, 1083, 1084, 1001, 1085, 1007, 1086,
-     1087, 1012, 1013, 1014, 1014, 1088, 1089, 1090, 1091, 1092,
-     1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102,
-     1103, 1007, 1104, 1105, 1106, 1107, 1108, 1013, 1014, 1109,
-     1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119,
-     1120, 1121, 1122, 1123, 1124, 1125, 1007, 1126, 1127, 1128,
-     1129, 1130, 1013, 1014, 1131, 1132, 1133, 1134, 1135, 1136,
-     1137, 1138, 1139, 1140, 1141, 1142, 1143, 1144, 1145, 1146,
-
-     1147, 1148, 1149, 1150, 1152, 1153, 1151, 1155, 1156, 1157,
-     1158, 1159, 1160, 1154, 1161, 1162, 1163, 1164, 1165, 1166,
-     1167, 1168, 1169, 1170, 1171, 1149, 1172, 1174, 1175, 1173,
-     1177, 1178, 1179, 1180, 1181, 1182, 1176, 1183, 1184, 1185,
-     1186, 1187, 1188, 1189, 1190, 1191, 1192, 1193, 1149, 1194,
-     1196, 1197, 1195, 1198, 1199, 1200, 1201, 1202, 1203, 1204,
-     1205, 1206, 1207, 1208, 1209, 1210, 1211, 1212, 1213, 1149,
-     1214, 1216, 1217, 1215, 1219, 1220, 1221, 1222, 1223, 1224,
-     1218, 1225, 1226, 1228, 1229, 1227, 1230, 1231, 1232, 1233,
-     1234, 1235, 1236, 1237, 1238, 1239, 1240, 1241, 1242, 1243,
-
-     1244, 1149, 1245, 1247, 1248, 1246, 1250, 1251, 1252, 1253,
-     1254, 1255, 1249, 1256, 1257, 1258, 1259, 1260, 1261, 1262,
-     1263, 1264, 1265, 1266, 1149, 1267, 1269, 1270, 1268, 1272,
-     1273, 1274, 1275, 1276, 1277, 1271, 1278, 1279, 1280, 1281,
-     1282, 1283, 1284, 1285, 1286, 1287, 1288, 1290, 1288, 1289,
-     1291, 1292, 1293, 1294, 1295, 1296, 1289, 1297, 1298, 1299,
-     1300, 1280, 1301, 1302, 1303, 1304, 1305, 1306, 1287, 1288,
-     1308, 1288, 1307, 1309, 1310, 1311, 1294, 1312, 1313, 1307,
-     1314, 1315, 1316, 1317, 1280, 1318, 1319, 1320, 1321, 1322,
-     1323, 1287, 1288, 1324, 1288, 1289, 1325, 1294, 1326, 1327,
-
-     1328, 1329, 1289, 1330, 1331, 1280, 1332, 1333, 1334, 1335,
-     1336, 1337, 1287, 1288, 1339, 1288, 1338, 1340, 1341, 1342,
-     1294, 1343, 1344, 1338, 1280, 1285, 1345, 1288, 1346, 1288,
-     1289, 1294, 1347, 1348, 1349, 1350, 1351, 1289, 1352, 1280,
-     1353, 1354, 1355, 1356, 1357, 1358, 1287, 1288, 1360, 1288,
-     1359, 1361, 1362, 1363, 1294, 1364, 1365, 1359, 1366, 1367,
-     1368, 1369, 1280, 1370, 1371, 1372, 1373, 1374, 1375, 1287,
-     1288, 1377, 1288, 1376, 1378, 1379, 1380, 1294, 1381, 1382,
-     1376, 1383, 1384, 1385, 1386, 1387, 1388, 1389, 1390, 1391,
-     1288, 1393, 1288, 1289, 1392, 1394, 1392, 1395, 1396, 1397,
-
-     1289, 1398, 1399, 1400, 1401, 1402, 1387, 1403, 1404, 1405,
-     1406, 1392, 1407, 1392, 1394, 1408, 1409, 1410, 1411, 1412,
-     1413, 1414, 1415, 1387, 1416, 1417, 1418, 1419, 1420, 1394,
-     1421, 1422, 1423, 1424, 1425, 1426, 1387, 1427, 1428, 1429,
-     1430, 1392, 1431, 1392, 1394, 1432, 1433, 1384, 1434, 1435,
-     1436, 1437, 1438, 1439, 1440, 1441, 1442, 1387, 1443, 1444,
-     1445, 1446, 1392, 1447, 1392, 1394, 1448, 1449, 1450, 1451,
-     1452, 1453, 1454, 1455, 1387, 1456, 1457, 1458, 1459, 1392,
-     1460, 1392, 1394, 1461, 1462, 1463, 1464, 1465, 1466, 1467,
-     1468, 1469, 1470, 1471, 1392, 1472, 1392, 1473, 1474, 1475,
-
-     1476, 1477, 1478, 1479, 1480, 1481, 1482, 1483, 1484, 1485,
-     1486, 1487, 1488, 1489, 1490, 1491, 1492, 1493, 1494, 1495,
-     1496, 1497, 1498, 1499, 1500, 1501, 1502, 1503, 1504, 1505,
-     1506, 1507, 1508, 1509, 1510, 1472, 1511, 1512, 1513, 1514,
-     1515, 1516, 1517, 1518, 1519, 1520, 1521, 1522, 1523, 1524,
-     1525, 1526, 1527, 1528, 1529, 1530, 1531, 1532, 1533, 1534,
-     1535, 1536, 1537, 1538, 1539, 1541, 1542, 1543, 1544, 1545,
-     1546, 1540, 1547, 1548, 1549, 1550, 1538, 1551, 1541, 1542,
-     1543, 1553, 1554, 1555, 1552, 1556, 1557, 1558, 1559, 1538,
-     1539, 1541, 1542, 1543, 1560, 1561, 1562, 1540, 1563, 1564,
-
-     1538, 1565, 1541, 1542, 1543, 1567, 1568, 1569, 1566, 1570,
-     1538, 1539, 1571, 1572, 1573, 1574, 1538, 1575, 1540, 1541,
-     1542, 1543, 1577, 1578, 1576, 1579, 1580, 1581, 1582, 1583,
-     1538, 1584, 1541, 1542, 1543, 1586, 1587, 1588, 1585, 1589,
-     1590, 1591, 1592, 1538, 1539, 1593, 1594, 1595, 1595, 1596,
-     1597, 1540, 1598, 1540, 1599, 1600, 1591, 1601, 1593, 1602,
-     1595, 1603, 1604, 1605, 1606, 1607, 1552, 1608, 1591, 1609,
-     1610, 1611, 1612, 1591, 1613, 1593, 1614, 1595, 1615, 1616,
-     1617, 1618, 1619, 1566, 1620, 1621, 1591, 1622, 1593, 1623,
-     1595, 1624, 1625, 1626, 1627, 1628, 1576, 1629, 1591, 1630,
-
-     1593, 1631, 1595, 1632, 1633, 1634, 1635, 1636, 1585, 1637,
-     1638, 1593, 1594, 1593, 1594, 1595, 1595, 1639, 1640, 1540,
-     1641, 1540, 1642, 1643, 1644, 1593, 1602, 1595, 1603, 1639,
-     1645, 1646, 1647, 1552, 1648, 1649, 1639, 1650, 1651, 1652,
-     1593, 1614, 1595, 1615, 1639, 1653, 1654, 1655, 1566, 1639,
-     1656, 1657, 1593, 1623, 1595, 1624, 1639, 1658, 1659, 1660,
-     1576, 1661, 1662, 1593, 1631, 1595, 1632, 1639, 1663, 1664,
-     1665, 1585, 1666, 1667, 1666, 1668, 1666, 1669, 1666, 1670,
-     1666, 1671, 1666, 1672, 1673, 1674, 1675, 1676, 1677, 1678,
-     1679, 1680, 1681, 1682, 1683, 1684, 1685, 1685, 1685, 1685,
-
-     1685, 1685,   24,   24,   24,   24,   24,   50,   50,   50,
-       50,   50,   63,   63,   63,   63,   63,   77,   77,   77,
-       77,   77,   94,   94,   94,   94,   94,  108,  108,  108,
-      108,  108,  121,  121,  121,  121,  121,  136,  136,  136,
-      136,  136,  149,  149,  149,  149,  149,  194,  194,  866,
-      194,  214,  865,  214,  235,  235,  864,  235,  257,  257,
-      278,  278,  863,  278,  300,  300,  862,  300,  860,  859,
-      858,  857,  830,  856,  855,  854,  853,  852,  851,  850,
-      849,  848,  847,  846,  845,  844,  843,  842,  841,  840,
-      839,  838,  837,  834,  833,  832,  831,  830,  829,  828,
-
-      827,  826,  825,  824,  823,  822,  821,  820,  819,  818,
-      817,  816,  815,  814,  813,  812,  811,  810,  809,  808,
-      805,  804,  803,  800,  799,  798,  797,  796,  795,  794,
-      793,  792,  791,  790,  789,  788,  787,  786,  785,  784,
-      783,  782,  779,  778,  777,  774,  773,  772,  771,  770,
-      769,  768,  767,  766,  765,  764,  763,  762,  760,  759,
-      758,  757,  756,  755,  754,  753,  752,  751,  750,  749,
-      748,  747,  746,  745,  744,  743,  742,  741,  740,  739,
-      736,  735,  734,  731,  730,  729,  728,  727,  726,  725,
-      724,  723,  722,  721,  720,  719,  718,  717,  716,  715,
-
-      714,  713,  710,  709,  708,  705,  704,  703,  702,  701,
-      700,  699,  698,  697,  696,  695,  694,  693,  692,  691,
-      690,  689,  688,  687,  684,  683,  682,  679,  678,  677,
-      676,  675,  674,  673,  672,  671,  670,  669,  668,  667,
-      666,  665,  664,  663,  661,  660,  657,  656,  655,  652,
-      651,  508,  650,  649,  648,  645,  644,  643,  642,  641,
-      636,  628,  634,  633,  632,  631,  630,  629,  628,  627,
-      626,  508,  625,  624,  623,  620,  619,  618,  617,  616,
-      611,  603,  609,  608,  607,  606,  605,  604,  603,  602,
-      601,  508,  600,  599,  598,  502,  596,  595,  594,  593,
-
-      592,  484,  591,  590,  589,  588,  587,  586,  484,  585,
-      584,  508,  583,  582,  581,  578,  577,  576,  575,  574,
-      569,  561,  567,  566,  565,  564,  563,  562,  561,  560,
-      559,  508,  558,  557,  556,  553,  552,  551,  550,  549,
-      544,  537,  543,  542,  541,  540,  539,  538,  537,  536,
-      535,  508,  534,  533,  532,  529,  528,  527,  526,  525,
-      520,  512,  518,  517,  516,  515,  514,  513,  512,  511,
-      511,  511,  511,  510,  509,  508,  507,  506,  505,  502,
-      501,  500,  499,  498,  493,  484,  490,  489,  488,  487,
-      486,  485,  484,  483,  482,  481,  477,  476,  473,  472,
-
-      471,  470,  469,  468,  465,  462,  461,  460,  459,  458,
-      454,  453,  450,  449,  448,  447,  446,  445,  442,  439,
-      438,  281,  437,  436,  435,  431,  430,  427,  426,  330,
-      425,  424,  423,  420,  417,  416,  415,  414,  413,  409,
-      408,  405,  404,  403,  402,  401,  400,  397,  394,  393,
-      392,  391,  390,  386,  385,  382,  381,  380,  379,  378,
-      377,  374,  371,  370,  216,  369,  368,  367,  363,  362,
-      359,  358,  357,  356,  355,  354,  351,  348,  347,  193,
-      346,  345,  344,  343,  186,  342,  341,  340,  336,  335,
-      332,  331,  330,  329,  328,  327,  324,  321,  320,  183,
-
-      175,  170,  169,  166,  165,  319,  311,  306,  305,  302,
-      301,  299,  291,  286,  285,  282,  281,  280,  279,  275,
-      267,  262,  261,  258,  254,  246,  241,  240,  237,  236,
-      183,  175,  170,  169,  166,  165,  234,  226,  221,  220,
-      217,  216,  215,  213,  205,  200,  199,  196,  195,  193,
-      192,  190,  189,  186,  185,  183,  175,  170,  169,  166,
-      165, 1686,   23, 1686, 1686, 1686, 1686, 1686, 1686, 1686,
-     1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686,
-     1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686,
-     1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686,
-
-     1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686,
-     1686, 1686, 1686, 1686, 1686, 1686, 1686
+     1694,   39,   25,   39,   47,  843,   47,   40,   26,   41,
+       48, 1694,   49,   45,   27, 1694,   24,   80,   81,   80,
+       82,  175,  182,   43,   83,   46,   24,   47,   24,   47,
+       84,  844,  154,   48,  155,   49,  180,  185,  156,  171,
+      177,  186,  666,  183,  157,  178,  172,  188,  667,  188,
+      181,  176,   28,   25,  191,  184,  195,  207,  195,   26,
+      182,  192,   29,   30,   31,   32,  209,  191,   85,   33,
+       34,  210,  203,   35,  192,  194,   36,   37,   38,  204,
+      212,  183,  158,  224,  174,  217,  214,  208,  228,  218,
+      225,  230,  235,  184,  213,  233,  231,  238,  868,  175,
+
+      180,  239,  182,   28,   39,   25,   39,  215,  171,  234,
+       40,   26,   41,  236,  181,  172,   42,   27,  229,  216,
+      185,  248,  177,  183,  186,  237,   43,  178,   44,  176,
+      244,  250,  253,  255,  258,  184,  251,  245,  259,  261,
+      262,  261,  265,  269,  870,  271,  254,  274,  276,  266,
+      272,  249,  293,  289,  256,   28,   24,   24,   25,   24,
+      290,  275,   24,   51,   52,   53,  257,  279,  300,  277,
+       54,  280,  295,  270,  282,  283,  282,  296,  298,  303,
+      311,  278,  294,  304,  315,  317,  320,  312,  177,  301,
+      318,  325,  299,  178,  175,  326,  171,  871,  185,  180,
+
+      321,  302,  186,  172,  322,  182,  872,  873,   28,   24,
+       24,   25,   24,  181,  316,   24,   51,   52,   53,  345,
+       55,   56,   57,   58,  176,  323,  183,   59,   60,  330,
+      346,   61,  331,  347,   62,   63,   64,  324,  184,  333,
+      341,  511,  372,  334,  342,  188,  195,  188,  195,  357,
+      360,  368,  358,  373,  361,  369,  374,  380,  874,  512,
+      381,   28,   24,   24,   25,   24,   24,  875,   24,   66,
+       26,   67,   24,  383,  391,  395,   68,  384,  392,  403,
+      406,  414,  404,  418,  407,  415,  396,  876,  877,  397,
+      261,  262,  261,  426,  419,  429,  427,  420,  436,  430,
+
+      878,  879,  437,  282,  283,  282,  448,  451,  459,  449,
+      471,  452,  460,  472,   28,   24,   24,   25,   24,   24,
+      880,   24,   66,   26,   67,   24,   69,   70,   71,   72,
+      843,  474,  440,   73,   74,  475,  463,   75,  486,  881,
+       76,   77,   78,  441,  482,  538,  442,  464,  483,  487,
+      465,  499,  488,  499,  500,  499,  869,  499,  527,  502,
+      500,  503,  661,  539,  527,  504,  662,   28,   80,   81,
+       80,   82,  562,  505,  499,   83,  499,  500,   86,   87,
+       88,   89,  529,  500,  530,   90,   91,  688,  531,   92,
+      563,  689,   93,   94,   95,  553,  532,  554,  882,  587,
+
+      511,  555,  499,  883,  499,  576,  670,  629,  670,  556,
+      578,  576,  579,  654,  884,  885,  580,  588,  605,   85,
+       24,   24,   25,   24,  581,  630,   24,  499,   97,  499,
+      500,  655,  886,  887,   98,  499,  500,  499,  618,  620,
+      499,  621,  499,  643,  618,  622,  645,  714,  646,  643,
+      888,  715,  647,  623,  499,  693,  499,  500,  889,  719,
+      648,  694,  670,  500,  670,  720,  740,  670,  838,  670,
+      741,  745,   28,   24,   24,   25,   24,  746,  670,   24,
+      670,   97,  769,  890,   99,  100,  101,  102,  667,  783,
+      788,  103,  104,  784,  891,  105,  789,  809,  106,  107,
+
+      108,  810,  814,  670,  670,  670,  670,  892,  815,  893,
+      895,  843,  896,  897,  898,  899,  900,  901,  902,  903,
+      904,  905,  906,  907,  908,   28,   24,   24,  109,   24,
+       24,   24,  909,  910,   26,   24,   24,  894,  911,  912,
+      111,  913,  914,  838,  915,  916,  917,  918,  843,  920,
+      921,  922,  923,  924,  925,   24,  926,  927,  928,  929,
+      930,  931,  932,  933,  934,  935,  936,  837,  838,  937,
+      938,  939,  940,  843,  919,  941,  942,  943,   28,   24,
+       24,  109,   24,   24,   24,  944,  945,   26,   24,   24,
+      112,  113,  114,  115,  946,  947,  948,  116,  117,  844,
+
+      949,  118,  950,  951,  119,  120,  121,  952,   24,  953,
+      838,  954,  955,  956,  957,  959,  843,  960,  961,  962,
+      963,  964,  965,  966,  967,  968,  969,  970,  971,  972,
+      973,   28,   24,   24,  122,   24,  974,  975,   24,  124,
+      125,  126,  958,  976,  977,  978,  127,  838,  979,  980,
+      981,  982,  843,  984,  985,  986,  987,  988,  989,  990,
+      991,  992,  993,  994,  995,  996,  997,  998,  999, 1000,
+     1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008,  983, 1009,
+     1010, 1011, 1012, 1013,   28,   24,   24,  122,   24, 1014,
+     1015,   24,  124,  125,  126, 1016,  128,  129,  130,  131,
+
+     1017, 1018, 1019,  132,  133, 1020, 1021,  134, 1022, 1022,
+      135,  136,  137, 1023, 1024, 1025, 1026, 1027, 1028, 1029,
+     1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1015,
+     1039, 1040, 1041, 1042, 1043, 1021, 1045,   28,   24,   24,
+       25,   24, 1022, 1044,   24,  139,  140,  141, 1046, 1047,
+     1048, 1049,  142, 1050, 1051, 1052, 1053, 1054, 1055, 1056,
+     1057, 1058, 1059, 1060, 1015, 1061, 1062, 1063, 1064, 1065,
+     1021, 1022, 1022, 1066, 1067, 1068, 1069, 1070, 1071, 1072,
+     1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1015,
+       28,   24,   24,   25,   24, 1082, 1083,   24,  139,  140,
+
+      141, 1084,  143,  144,  145,  146, 1085, 1086, 1021,  147,
+      148, 1022, 1087,  149, 1088, 1089,  150,  151,  152, 1090,
+     1091, 1092, 1009, 1093, 1015, 1094, 1095, 1020, 1021, 1022,
+     1022, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104,
+     1105, 1106, 1107,   28,  154, 1108,  155, 1109, 1110, 1111,
+      156, 1015, 1112,  159,  160,  161,  162, 1113, 1114, 1115,
+      163,  164, 1116, 1021,  165, 1022, 1117,  166,  167,  168,
+     1118, 1119, 1120, 1121, 1122, 1123, 1124, 1125, 1126, 1127,
+     1128, 1129, 1130, 1131, 1132, 1133, 1015, 1134, 1135, 1136,
+     1137, 1138, 1021, 1140,  158, 1022, 1139, 1141, 1142, 1143,
+
+     1144, 1145, 1146, 1147, 1148, 1149, 1150, 1151, 1152, 1153,
+     1154, 1155, 1156, 1157, 1158, 1160, 1161, 1159, 1163, 1164,
+     1165, 1166, 1167, 1168, 1162, 1169, 1170, 1171, 1172, 1173,
+     1174, 1175, 1176, 1177, 1178, 1179, 1157, 1180, 1182, 1183,
+     1181, 1185, 1186, 1187, 1188, 1189, 1190, 1184, 1191, 1192,
+     1193, 1194, 1195, 1196, 1197, 1198, 1199, 1200, 1201, 1157,
+     1202, 1204, 1205, 1203, 1206, 1207, 1208, 1209, 1210, 1211,
+     1212, 1213, 1214, 1215, 1216, 1217, 1218, 1219, 1220, 1221,
+     1157, 1222, 1224, 1225, 1223, 1227, 1228, 1229, 1230, 1231,
+     1232, 1226, 1233, 1234, 1236, 1237, 1235, 1238, 1239, 1240,
+
+     1241, 1242, 1243, 1244, 1245, 1246, 1247, 1248, 1249, 1250,
+     1251, 1252, 1157, 1253, 1255, 1256, 1254, 1258, 1259, 1260,
+     1261, 1262, 1263, 1257, 1264, 1265, 1266, 1267, 1268, 1269,
+     1270, 1271, 1272, 1273, 1274, 1157, 1275, 1277, 1278, 1276,
+     1280, 1281, 1282, 1283, 1284, 1285, 1279, 1286, 1287, 1288,
+     1289, 1290, 1291, 1292, 1293, 1294, 1295, 1296, 1298, 1296,
+     1297, 1299, 1300, 1301, 1302, 1303, 1297, 1304, 1305, 1306,
+     1307, 1308, 1288, 1309, 1310, 1311, 1312, 1313, 1314, 1295,
+     1296, 1316, 1296, 1315, 1317, 1318, 1319, 1302, 1320, 1315,
+     1321, 1322, 1323, 1324, 1325, 1288, 1326, 1327, 1328, 1329,
+
+     1330, 1331, 1295, 1296, 1332, 1296, 1297, 1333, 1302, 1334,
+     1335, 1336, 1297, 1337, 1338, 1339, 1288, 1340, 1341, 1342,
+     1343, 1344, 1345, 1295, 1296, 1347, 1296, 1346, 1348, 1349,
+     1350, 1302, 1351, 1346, 1352, 1288, 1293, 1353, 1296, 1354,
+     1296, 1297, 1302, 1355, 1356, 1357, 1358, 1297, 1359, 1360,
+     1288, 1361, 1362, 1363, 1364, 1365, 1366, 1295, 1296, 1368,
+     1296, 1367, 1369, 1370, 1371, 1302, 1372, 1367, 1373, 1374,
+     1375, 1376, 1377, 1288, 1378, 1379, 1380, 1381, 1382, 1383,
+     1295, 1296, 1385, 1296, 1384, 1386, 1387, 1388, 1302, 1389,
+     1384, 1390, 1391, 1392, 1393, 1394, 1395, 1396, 1397, 1398,
+
+     1399, 1296, 1401, 1296, 1297, 1400, 1402, 1400, 1403, 1404,
+     1297, 1405, 1406, 1407, 1408, 1409, 1410, 1395, 1411, 1412,
+     1413, 1414, 1400, 1415, 1400, 1402, 1416, 1417, 1418, 1419,
+     1420, 1421, 1422, 1423, 1395, 1424, 1425, 1426, 1427, 1428,
+     1402, 1429, 1430, 1431, 1432, 1433, 1434, 1395, 1435, 1436,
+     1437, 1438, 1400, 1439, 1400, 1402, 1440, 1441, 1392, 1442,
+     1443, 1444, 1445, 1446, 1447, 1448, 1449, 1450, 1395, 1451,
+     1452, 1453, 1454, 1400, 1455, 1400, 1402, 1456, 1457, 1458,
+     1459, 1460, 1461, 1462, 1463, 1395, 1464, 1465, 1466, 1467,
+     1400, 1468, 1400, 1402, 1469, 1470, 1471, 1472, 1473, 1474,
+
+     1475, 1476, 1477, 1478, 1479, 1400, 1480, 1400, 1481, 1482,
+     1483, 1484, 1485, 1486, 1487, 1488, 1489, 1490, 1491, 1492,
+     1493, 1494, 1495, 1496, 1497, 1498, 1499, 1500, 1501, 1502,
+     1503, 1504, 1505, 1506, 1507, 1508, 1509, 1510, 1511, 1512,
+     1513, 1514, 1515, 1516, 1517, 1518, 1480, 1519, 1520, 1521,
+     1522, 1523, 1524, 1525, 1526, 1527, 1528, 1529, 1530, 1531,
+     1532, 1533, 1534, 1535, 1536, 1537, 1538, 1539, 1540, 1541,
+     1542, 1543, 1544, 1545, 1546, 1547, 1549, 1550, 1551, 1552,
+     1553, 1548, 1554, 1555, 1556, 1557, 1558, 1546, 1559, 1549,
+     1550, 1551, 1561, 1562, 1560, 1563, 1564, 1565, 1566, 1567,
+
+     1546, 1547, 1549, 1550, 1551, 1568, 1569, 1548, 1570, 1571,
+     1572, 1546, 1573, 1549, 1550, 1551, 1575, 1576, 1574, 1577,
+     1578, 1546, 1547, 1579, 1580, 1581, 1582, 1549, 1548, 1546,
+     1583, 1550, 1551, 1585, 1586, 1587, 1584, 1588, 1589, 1590,
+     1591, 1546, 1592, 1549, 1550, 1551, 1594, 1595, 1593, 1596,
+     1597, 1598, 1599, 1600, 1546, 1547, 1601, 1602, 1603, 1603,
+     1604, 1548, 1605, 1548, 1606, 1607, 1608, 1599, 1609, 1601,
+     1610, 1603, 1611, 1612, 1613, 1614, 1560, 1615, 1616, 1599,
+     1617, 1618, 1619, 1620, 1599, 1621, 1601, 1622, 1603, 1623,
+     1624, 1625, 1626, 1574, 1627, 1628, 1629, 1599, 1630, 1601,
+
+     1631, 1603, 1632, 1633, 1634, 1635, 1584, 1636, 1637, 1599,
+     1638, 1601, 1639, 1603, 1640, 1641, 1642, 1643, 1593, 1644,
+     1645, 1646, 1601, 1602, 1601, 1602, 1603, 1603, 1647, 1548,
+     1648, 1548, 1649, 1650, 1651, 1652, 1601, 1610, 1603, 1611,
+     1647, 1653, 1654, 1560, 1655, 1656, 1657, 1647, 1658, 1659,
+     1660, 1601, 1622, 1603, 1623, 1647, 1661, 1662, 1574, 1663,
+     1647, 1664, 1665, 1601, 1631, 1603, 1632, 1647, 1666, 1667,
+     1584, 1668, 1669, 1670, 1601, 1639, 1603, 1640, 1647, 1671,
+     1672, 1593, 1673, 1674, 1675, 1674, 1676, 1674, 1677, 1674,
+     1678, 1674, 1679, 1674, 1680, 1681, 1682, 1683, 1684, 1685,
+
+     1686, 1687, 1688, 1689, 1690, 1691, 1692, 1693, 1693, 1693,
+     1693, 1693, 1693,   24,   24,   24,   24,   24,   50,   50,
+       50,   50,   50,   65,   65,   65,   65,   65,   79,   79,
+       79,   79,   79,   96,   96,   96,   96,   96,  110,  110,
+      110,  110,  110,  123,  123,  123,  123,  123,  138,  138,
+      138,  138,  138,  153,  153,  153,  153,  153,  198,  198,
+      867,  198,  220,  866,  220,  241,  241,  865,  241,  263,
+      263,  284,  284,  838,  284,  306,  306,  864,  306,  863,
+      862,  861,  860,  859,  858,  857,  856,  855,  854,  853,
+      852,  851,  850,  849,  848,  847,  846,  845,  842,  841,
+
+      840,  839,  838,  837,  836,  835,  834,  833,  832,  831,
+      830,  829,  828,  827,  826,  825,  824,  823,  822,  821,
+      820,  819,  818,  817,  816,  813,  812,  811,  808,  807,
+      806,  805,  804,  803,  802,  801,  800,  799,  798,  797,
+      796,  795,  794,  793,  792,  791,  790,  787,  786,  785,
+      782,  781,  780,  779,  778,  777,  776,  775,  774,  773,
+      772,  771,  770,  768,  767,  766,  765,  764,  763,  762,
+      761,  760,  759,  758,  757,  756,  755,  754,  753,  752,
+      751,  750,  749,  748,  747,  744,  743,  742,  739,  738,
+      737,  736,  735,  734,  733,  732,  731,  730,  729,  728,
+
+      727,  726,  725,  724,  723,  722,  721,  718,  717,  716,
+      713,  712,  711,  710,  709,  708,  707,  706,  705,  704,
+      703,  702,  701,  700,  699,  698,  697,  696,  695,  692,
+      691,  690,  687,  686,  685,  684,  683,  682,  681,  680,
+      679,  678,  677,  676,  675,  674,  673,  672,  671,  669,
+      668,  665,  664,  663,  660,  659,  516,  658,  657,  656,
+      653,  652,  651,  650,  649,  644,  636,  642,  641,  640,
+      639,  638,  637,  636,  635,  634,  516,  633,  632,  631,
+      628,  627,  626,  625,  624,  619,  611,  617,  616,  615,
+      614,  613,  612,  611,  610,  609,  516,  608,  607,  606,
+
+      510,  604,  603,  602,  601,  600,  492,  599,  598,  597,
+      596,  595,  594,  492,  593,  592,  516,  591,  590,  589,
+      586,  585,  584,  583,  582,  577,  569,  575,  574,  573,
+      572,  571,  570,  569,  568,  567,  516,  566,  565,  564,
+      561,  560,  559,  558,  557,  552,  545,  551,  550,  549,
+      548,  547,  546,  545,  544,  543,  516,  542,  541,  540,
+      537,  536,  535,  534,  533,  528,  520,  526,  525,  524,
+      523,  522,  521,  520,  519,  519,  519,  519,  518,  517,
+      516,  515,  514,  513,  510,  509,  508,  507,  506,  501,
+      492,  498,  497,  496,  495,  494,  493,  492,  491,  490,
+
+      489,  485,  484,  481,  480,  479,  478,  477,  476,  473,
+      470,  469,  309,  468,  467,  466,  462,  461,  458,  457,
+      456,  455,  454,  453,  450,  447,  446,  287,  445,  444,
+      443,  439,  438,  435,  434,  338,  433,  432,  431,  428,
+      425,  424,  423,  422,  421,  417,  416,  413,  412,  411,
+      410,  409,  408,  405,  402,  401,  400,  399,  398,  394,
+      393,  390,  389,  388,  387,  386,  385,  382,  379,  378,
+      222,  377,  376,  375,  371,  370,  367,  366,  365,  364,
+      363,  362,  359,  356,  355,  201,  197,  354,  353,  352,
+      351,  190,  350,  349,  348,  344,  343,  340,  339,  338,
+
+      337,  336,  335,  332,  329,  328,  187,  179,  174,  173,
+      170,  169,  327,  319,  314,  313,  310,  309,  308,  307,
+      305,  297,  292,  291,  288,  287,  286,  285,  281,  273,
+      268,  267,  264,  260,  252,  247,  246,  243,  242,  187,
+      179,  174,  173,  170,  169,  240,  232,  227,  226,  223,
+      222,  221,  219,  211,  206,  205,  202,  201,  200,  199,
+      197,  196,  194,  193,  190,  189,  187,  179,  174,  173,
+      170,  169, 1694,   23, 1694, 1694, 1694, 1694, 1694, 1694,
+     1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694,
+     1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694,
+
+     1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694,
+     1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694,
+     1694, 1694, 1694, 1694, 1694, 1694, 1694
     } ;
 
-static yyconst flex_int16_t yy_chk[2218] =
+static yyconst flex_int16_t yy_chk[2228] =
     {   0,
-        0,    4,    1,    4,    5,   39,    5,   39,    4,    1,
-        4,    5,    0,    5,    4,    1,    6,    5,    6,  661,
-       47,   32,   47,    6,    4,    6,    4,    5,   42,    5,
-        7,    7,    7,    7,   35,   42,  184,    7,  184,    7,
-       29,   11,   11,   11,   11,    7,  661,   29,   35,   11,
-       21,   32,   21,    1,    2,   11,   36,   21,   37,  694,
-       56,    2,   37,   21,    2,    2,    2,    2,   33,   53,
-       59,    2,    2,   33,   45,    2,   53,   36,    2,    2,
-        2,   45,   70,    7,   59,   13,   13,   13,   13,   36,
-       56,   45,   13,   11,   13,   19,   19,   19,   19,  695,
-
-       13,   21,   19,   46,   19,    2,    3,    3,    3,   60,
-       19,   57,   70,    3,    3,    3,   57,   61,   46,    3,
-        3,   61,   71,   73,   46,   67,   84,   71,  696,    3,
-       60,    3,   67,   84,   74,   75,   46,   73,   13,   75,
-       87,   88,   60,   90,   91,   92,   88,   97,   19,   92,
-      100,  101,  697,  698,   97,   74,  101,   90,    3,    8,
-        8,    8,    8,  104,  113,   91,    8,   74,    8,  103,
-       87,    8,    8,    8,    8,  699,  114,   91,    8,    8,
-      100,  114,    8,  103,  104,    8,    8,    8,  105,  107,
-      107,  107,  105,  110,  113,  116,  104,  117,  118,  126,
-
-      110,  129,  118,  120,  120,  120,  126,  700,  133,  116,
-      142,  132,    8,    9,    9,    9,    9,    9,  117,    9,
-        9,    9,    9,    9,    9,  132,  146,  130,    9,  133,
-      117,  129,  130,  134,  143,  139,  145,  134,  155,  143,
-      142,  133,  139,  161,  147,  155,  159,  146,  147,  701,
-      145,  159,  163,  158,  336,  168,  163,  161,  168,  146,
-      170,  177,  702,  162,  170,  177,    9,   10,   10,   10,
-       10,   10,  336,   10,   10,   10,   10,   10,   10,   10,
-       10,   10,   10,  158,  162,  703,   10,   10,  180,  191,
-       10,  191,  704,   10,   10,   10,  162,  198,  210,  180,
-
-      198,  200,  180,  207,  231,  200,  221,  207,  219,  210,
-      221,  219,  210,  228,  251,  231,  239,  228,  231,  239,
-       10,   12,   12,   12,   12,  251,  241,  248,  251,   12,
-      241,  248,   12,   12,   12,   12,  255,  255,  255,   12,
-       12,  260,  272,   12,  260,  262,   12,   12,   12,  262,
-      269,  363,  284,  272,  269,  284,  272,  276,  276,  276,
-      286,  293,  705,  304,  286,  293,  304,  306,  296,  363,
-      706,  306,  386,   12,   14,   14,   14,   14,  707,  296,
-      313,   14,  296,   14,  313,  316,   14,   14,   14,   14,
-      386,  484,  708,   14,   14,  484,  316,   14,  409,  316,
-
-       14,   14,   14,  327,  709,  327,  327,  710,  330,  354,
-      330,  354,  354,  327,  330,  377,  409,  377,  377,  354,
-      512,  711,  330,  431,  512,  377,  454,   14,   15,   15,
-       15,   15,   15,   15,   15,  712,  688,   15,   15,   15,
-      357,  431,  357,   15,  454,  380,  357,  380,  477,  713,
-      400,  380,  400,  400,  357,  403,  715,  403,   15,  380,
-      400,  403,  423,  688,  423,  423,  477,  488,  445,  403,
-      445,  445,  423,  488,  492,  519,  492,  519,  445,  716,
-      717,   15,   16,   16,   16,   16,   16,   16,   16,  718,
-      719,   16,   16,   16,   16,   16,   16,   16,  568,  537,
-
-      568,   16,   16,  537,  468,   16,  468,  468,   16,   16,
-       16,  448,   16,  448,  468,  561,  471,  448,  471,  561,
-      516,  491,  471,  491,  491,  448,  516,  541,  565,  720,
-      471,  491,  721,  541,  565,   16,   17,   17,   17,   17,
-      610,  589,  610,   17,   17,   17,   17,  589,  603,  607,
-      628,   17,  603,  632,  628,  607,  635,  714,  635,  632,
-      662,  722,  662,  723,  724,  725,  726,  727,  728,  729,
-      730,  731,  732,  733,  734,  735,  736,  737,  738,  739,
-      740,  741,  742,  743,  714,  744,  745,  746,  747,   17,
-       18,   18,   18,   18,  748,  749,  750,   18,   18,   18,
-
-       18,  751,   18,   18,   18,   18,  752,  740,  753,   18,
-       18,  754,  755,   18,  756,  757,   18,   18,   18,  758,
-      759,  760,  761,  762,  764,  763,  765,  766,  767,  768,
-      769,  770,  771,  772,  773,  774,  775,  776,  777,  778,
-      779,  780,  781,   18,   20,   20,   20,   20,  782,  783,
-      784,   20,  763,   20,  785,  786,   20,   20,   20,   20,
-      787,  788,  789,   20,   20,  790,  791,   20,  792,  793,
-       20,   20,   20,  794,  795,  796,  783,  797,  798,  799,
-      800,  801,  802,  803,  804,  805,  806,  807,  808,  810,
-      809,  811,  812,  813,  814,  815,  816,   20,   22,  817,
-
-       22,  818,  819,  820,  821,   22,  822,  823,   22,   22,
-       22,   22,  824,  825,  826,   22,   22,  809,  827,   22,
-      828,  829,   22,   22,   22,  831,  832,  833,  834,  836,
-      837,  838,  839,  840,  841,  842,  844,  845,  846,  847,
-      848,  849,  850,  851,  851,  852,  853,  854,  855,   22,
-      856,  857,  858,  859,  860,  861,  862,  863,  864,  865,
-      866,  867,  869,  870,  871,  872,  873,  874,  875,  876,
-      876,  877,  878,  879,  880,  881,  882,  883,  884,  885,
-      886,  887,  888,  889,  890,  891,  892,  894,  895,  896,
-      897,  898,  899,  900,  901,  901,  902,  903,  904,  905,
-
-      906,  907,  908,  909,  910,  911,  912,  913,  914,  915,
-      916,  917,  919,  920,  921,  922,  923,  924,  925,  926,
-      926,  927,  928,  929,  930,  931,  932,  933,  935,  936,
-      937,  938,  939,  940,  940,  941,  942,  943,  944,  945,
-      946,  947,  948,  949,  950,  951,  952,  953,  954,  955,
-      956,  958,  959,  960,  961,  962,  963,  964,  965,  965,
-      966,  967,  968,  969,  970,  971,  972,  973,  974,  975,
-      976,  977,  978,  979,  980,  981,  983,  984,  985,  986,
-      987,  988,  989,  990,  990,  991,  992,  993,  994,  995,
-      996,  997,  998,  999, 1000, 1001, 1002, 1003, 1004, 1006,
-
-     1008, 1009, 1010, 1011, 1012, 1014, 1011, 1015, 1016, 1017,
-     1018, 1019, 1020, 1014, 1021, 1022, 1023, 1024, 1025, 1026,
-     1027, 1028, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1034,
-     1037, 1038, 1039, 1040, 1041, 1042, 1036, 1043, 1044, 1045,
-     1046, 1047, 1048, 1049, 1050, 1052, 1053, 1054, 1055, 1056,
-     1057, 1058, 1056, 1059, 1060, 1061, 1062, 1063, 1064, 1065,
-     1066, 1067, 1068, 1069, 1070, 1071, 1073, 1074, 1075, 1076,
-     1077, 1078, 1079, 1077, 1080, 1081, 1082, 1083, 1084, 1085,
-     1079, 1086, 1087, 1088, 1089, 1087, 1090, 1091, 1092, 1093,
-     1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1103, 1104,
-
-     1105, 1106, 1107, 1108, 1109, 1107, 1110, 1111, 1112, 1113,
-     1114, 1115, 1109, 1116, 1117, 1118, 1119, 1120, 1121, 1122,
-     1123, 1125, 1126, 1127, 1128, 1129, 1130, 1131, 1129, 1132,
-     1133, 1134, 1135, 1136, 1137, 1131, 1138, 1139, 1140, 1141,
-     1142, 1143, 1144, 1146, 1147, 1148, 1150, 1151, 1150, 1150,
-     1152, 1153, 1154, 1155, 1157, 1158, 1150, 1159, 1160, 1161,
-     1162, 1163, 1164, 1165, 1166, 1167, 1169, 1170, 1171, 1172,
-     1173, 1172, 1172, 1174, 1175, 1176, 1177, 1179, 1180, 1172,
-     1181, 1182, 1183, 1184, 1185, 1186, 1187, 1188, 1189, 1191,
-     1192, 1193, 1194, 1195, 1194, 1194, 1196, 1197, 1199, 1200,
-
-     1201, 1202, 1194, 1203, 1204, 1205, 1206, 1207, 1208, 1209,
-     1211, 1212, 1213, 1214, 1215, 1214, 1214, 1216, 1217, 1218,
-     1219, 1221, 1222, 1214, 1223, 1224, 1225, 1226, 1227, 1226,
-     1226, 1228, 1230, 1231, 1232, 1233, 1234, 1226, 1235, 1236,
-     1237, 1238, 1239, 1240, 1242, 1243, 1244, 1245, 1246, 1245,
-     1245, 1247, 1248, 1249, 1250, 1252, 1253, 1245, 1254, 1255,
-     1256, 1257, 1258, 1259, 1260, 1261, 1262, 1264, 1265, 1266,
-     1267, 1268, 1267, 1267, 1269, 1270, 1271, 1272, 1274, 1275,
-     1267, 1276, 1277, 1278, 1279, 1281, 1282, 1283, 1285, 1286,
-     1288, 1290, 1288, 1288, 1289, 1291, 1289, 1292, 1293, 1295,
-
-     1288, 1296, 1297, 1298, 1299, 1300, 1301, 1302, 1303, 1305,
-     1306, 1307, 1308, 1307, 1309, 1310, 1311, 1312, 1313, 1314,
-     1315, 1316, 1317, 1318, 1319, 1320, 1322, 1323, 1324, 1325,
-     1326, 1327, 1328, 1329, 1330, 1331, 1332, 1333, 1334, 1336,
-     1337, 1338, 1339, 1338, 1340, 1341, 1342, 1343, 1344, 1345,
-     1346, 1347, 1348, 1349, 1350, 1351, 1352, 1353, 1354, 1355,
-     1357, 1358, 1359, 1360, 1359, 1361, 1362, 1363, 1364, 1365,
-     1366, 1367, 1368, 1369, 1370, 1371, 1372, 1374, 1375, 1376,
-     1377, 1376, 1378, 1379, 1380, 1382, 1383, 1384, 1385, 1386,
-     1388, 1389, 1390, 1391, 1392, 1393, 1392, 1395, 1396, 1398,
-
-     1399, 1400, 1401, 1402, 1403, 1404, 1405, 1406, 1407, 1408,
-     1409, 1411, 1412, 1413, 1414, 1415, 1416, 1417, 1418, 1419,
-     1420, 1422, 1423, 1424, 1425, 1426, 1427, 1428, 1429, 1430,
-     1431, 1432, 1433, 1434, 1435, 1436, 1438, 1439, 1440, 1441,
-     1442, 1443, 1444, 1445, 1446, 1447, 1448, 1449, 1451, 1452,
-     1453, 1454, 1455, 1456, 1457, 1458, 1459, 1460, 1461, 1462,
-     1463, 1464, 1465, 1466, 1466, 1467, 1468, 1470, 1471, 1472,
-     1473, 1466, 1474, 1475, 1476, 1477, 1478, 1478, 1479, 1480,
-     1482, 1483, 1484, 1485, 1478, 1486, 1487, 1488, 1489, 1490,
-     1490, 1491, 1492, 1494, 1495, 1496, 1497, 1490, 1498, 1499,
-
-     1500, 1500, 1501, 1502, 1504, 1505, 1506, 1507, 1500, 1508,
-     1509, 1509, 1510, 1511, 1512, 1513, 1514, 1514, 1509, 1515,
-     1516, 1518, 1519, 1520, 1514, 1521, 1522, 1523, 1524, 1525,
-     1526, 1526, 1527, 1528, 1530, 1531, 1532, 1533, 1526, 1534,
-     1535, 1536, 1537, 1538, 1538, 1539, 1539, 1540, 1540, 1544,
-     1545, 1538, 1546, 1539, 1547, 1548, 1549, 1550, 1551, 1551,
-     1552, 1552, 1553, 1554, 1555, 1556, 1551, 1557, 1558, 1559,
-     1560, 1561, 1562, 1563, 1564, 1565, 1565, 1566, 1566, 1567,
-     1568, 1569, 1570, 1565, 1571, 1572, 1573, 1574, 1575, 1575,
-     1576, 1576, 1577, 1578, 1579, 1580, 1575, 1581, 1582, 1583,
-
-     1584, 1584, 1585, 1585, 1586, 1587, 1588, 1589, 1584, 1590,
-     1592, 1593, 1593, 1594, 1594, 1595, 1595, 1596, 1597, 1593,
-     1598, 1594, 1599, 1600, 1601, 1602, 1602, 1603, 1603, 1604,
-     1605, 1606, 1607, 1602, 1608, 1609, 1610, 1611, 1612, 1613,
-     1614, 1614, 1615, 1615, 1616, 1617, 1618, 1619, 1614, 1620,
-     1621, 1622, 1623, 1623, 1624, 1624, 1625, 1626, 1627, 1628,
-     1623, 1629, 1630, 1631, 1631, 1632, 1632, 1633, 1634, 1635,
-     1636, 1631, 1638, 1640, 1644, 1645, 1649, 1650, 1652, 1653,
-     1657, 1658, 1662, 1663, 1667, 1668, 1669, 1670, 1671, 1672,
-     1673, 1674, 1675, 1676, 1677, 1678, 1679, 1680, 1681, 1682,
-
-     1683, 1684, 1687, 1687, 1687, 1687, 1687, 1688, 1688, 1688,
-     1688, 1688, 1689, 1689, 1689, 1689, 1689, 1690, 1690, 1690,
-     1690, 1690, 1691, 1691, 1691, 1691, 1691, 1692, 1692, 1692,
-     1692, 1692, 1693, 1693, 1693, 1693, 1693, 1694, 1694, 1694,
-     1694, 1694, 1695, 1695, 1695, 1695, 1695, 1696, 1696,  693,
-     1696, 1697,  692, 1697, 1698, 1698,  691, 1698, 1699, 1699,
-     1700, 1700,  690, 1700, 1701, 1701,  689, 1701,  687,  686,
-      685,  684,  683,  682,  681,  680,  679,  678,  677,  676,
-      675,  674,  673,  672,  671,  670,  669,  668,  667,  666,
-      665,  664,  663,  660,  659,  658,  657,  656,  655,  654,
-
-      653,  652,  651,  650,  649,  648,  647,  646,  645,  644,
-      643,  642,  641,  640,  639,  638,  637,  636,  634,  633,
-      631,  630,  629,  627,  626,  625,  624,  623,  622,  621,
-      620,  619,  618,  617,  616,  615,  614,  613,  612,  611,
-      609,  608,  606,  605,  604,  602,  601,  600,  599,  598,
-      597,  596,  595,  594,  593,  592,  591,  590,  588,  587,
-      586,  585,  584,  583,  582,  581,  580,  579,  578,  577,
-      576,  575,  574,  573,  572,  571,  570,  569,  567,  566,
-      564,  563,  562,  560,  559,  558,  557,  556,  555,  554,
-      553,  552,  551,  550,  549,  548,  547,  546,  545,  544,
-
-      543,  542,  540,  539,  538,  536,  535,  534,  533,  532,
-      531,  530,  529,  528,  527,  526,  525,  524,  523,  522,
-      521,  520,  518,  517,  515,  514,  513,  510,  509,  507,
-      506,  505,  504,  503,  502,  501,  500,  499,  498,  497,
-      496,  495,  494,  493,  490,  489,  487,  486,  485,  483,
-      482,  481,  480,  479,  478,  476,  475,  474,  473,  472,
-      470,  469,  467,  466,  465,  464,  463,  462,  461,  460,
-      459,  458,  457,  456,  455,  453,  452,  451,  450,  449,
-      447,  446,  444,  443,  442,  441,  440,  439,  438,  437,
-      436,  435,  434,  433,  432,  430,  429,  428,  427,  426,
-
-      425,  424,  422,  421,  420,  419,  418,  417,  416,  415,
-      414,  413,  412,  411,  410,  408,  407,  406,  405,  404,
-      402,  401,  399,  398,  397,  396,  395,  394,  393,  392,
-      391,  390,  389,  388,  387,  385,  384,  383,  382,  381,
-      379,  378,  376,  375,  374,  373,  372,  371,  370,  369,
-      368,  367,  366,  365,  364,  362,  361,  360,  359,  358,
-      356,  355,  353,  352,  351,  350,  349,  348,  347,  346,
-      345,  344,  343,  342,  341,  340,  339,  338,  337,  335,
-      334,  333,  332,  331,  329,  328,  326,  325,  324,  323,
-      322,  321,  320,  319,  318,  317,  315,  314,  312,  311,
-
-      310,  309,  308,  307,  305,  303,  302,  299,  298,  297,
-      295,  294,  292,  291,  290,  289,  288,  287,  285,  283,
-      282,  281,  275,  274,  273,  271,  270,  268,  267,  266,
-      265,  264,  263,  261,  259,  258,  254,  253,  252,  250,
-      249,  247,  246,  245,  244,  243,  242,  240,  238,  237,
-      234,  233,  232,  230,  229,  227,  226,  225,  224,  223,
-      222,  220,  218,  217,  216,  213,  212,  211,  209,  208,
-      206,  205,  204,  203,  202,  201,  199,  197,  196,  193,
-      190,  189,  188,  187,  186,  183,  182,  181,  179,  178,
-      176,  175,  174,  173,  172,  171,  169,  167,  166,  164,
-
-      160,  157,  156,  153,  152,  148,  144,  141,  140,  138,
-      137,  135,  131,  128,  127,  125,  124,  123,  122,  119,
-      115,  112,  111,  109,  106,  102,   99,   98,   96,   95,
-       93,   89,   86,   85,   82,   81,   76,   72,   69,   68,
-       66,   65,   64,   62,   58,   55,   54,   52,   51,   49,
-       48,   44,   43,   41,   40,   38,   34,   31,   30,   27,
-       26,   23, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686,
-     1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686,
-     1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686,
-     1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686,
-
-     1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686, 1686,
-     1686, 1686, 1686, 1686, 1686, 1686, 1686
+        0,    4,    1,    4,    5,  669,    5,    4,    1,    4,
+        5,    0,    5,    4,    1,    0,    5,   11,   11,   11,
+       11,   32,   36,    4,   11,    4,    5,    6,    5,    6,
+       11,  669,   21,    6,   21,    6,   35,   37,   21,   29,
+       33,   37,  496,   36,   21,   33,   29,   39,  496,   39,
+       35,   32,    1,    2,   42,   36,   47,   58,   47,    2,
+       46,   42,    2,    2,    2,    2,   59,   45,   11,    2,
+        2,   59,   55,    2,   45,   46,    2,    2,    2,   55,
+       61,   46,   21,   69,   45,   63,   62,   58,   72,   63,
+       69,   73,   76,   46,   61,   75,   73,   77,  695,   89,
+
+       92,   77,   93,    2,    3,    3,    3,   62,   86,   75,
+        3,    3,    3,   76,   92,   86,    3,    3,   72,   62,
+       94,  102,   90,   93,   94,   76,    3,   90,    3,   89,
+       99,  103,  105,  106,  107,   93,  103,   99,  107,  109,
+      109,  109,  112,  115,  697,  116,  105,  118,  119,  112,
+      116,  102,  131,  128,  106,    3,    7,    7,    7,    7,
+      128,  118,    7,    7,    7,    7,  106,  120,  135,  119,
+        7,  120,  132,  115,  122,  122,  122,  132,  134,  136,
+      143,  119,  131,  136,  146,  147,  149,  143,  163,  135,
+      147,  151,  134,  163,  162,  151,  159,  698,  167,  165,
+
+      149,  135,  167,  159,  150,  166,  699,  700,    7,    8,
+        8,    8,    8,  165,  146,    8,    8,    8,    8,  184,
+        8,    8,    8,    8,  162,  150,  166,    8,    8,  172,
+      184,    8,  172,  184,    8,    8,    8,  150,  166,  174,
+      181,  344,  216,  174,  181,  188,  195,  188,  195,  204,
+      206,  213,  204,  216,  206,  213,  216,  225,  701,  344,
+      225,    8,    9,    9,    9,    9,    9,  702,    9,    9,
+        9,    9,    9,  227,  234,  237,    9,  227,  234,  245,
+      247,  254,  245,  257,  247,  254,  237,  703,  704,  237,
+      261,  261,  261,  266,  257,  268,  266,  257,  275,  268,
+
+      705,  706,  275,  282,  282,  282,  290,  292,  299,  290,
+      312,  292,  299,  312,    9,   10,   10,   10,   10,   10,
+      707,   10,   10,   10,   10,   10,   10,   10,   10,   10,
+      696,  314,  278,   10,   10,  314,  302,   10,  324,  708,
+       10,   10,   10,  278,  321,  371,  278,  302,  321,  324,
+      302,  335,  324,  335,  335,  362,  696,  362,  362,  338,
+      335,  338,  492,  371,  362,  338,  492,   10,   12,   12,
+       12,   12,  394,  338,  385,   12,  385,  385,   12,   12,
+       12,   12,  365,  385,  365,   12,   12,  520,  365,   12,
+      394,  520,   12,   12,   12,  388,  365,  388,  709,  417,
+
+      439,  388,  408,  710,  408,  408,  500,  462,  500,  388,
+      411,  408,  411,  485,  711,  712,  411,  417,  439,   12,
+       13,   13,   13,   13,  411,  462,   13,  431,   13,  431,
+      431,  485,  713,  714,   13,  453,  431,  453,  453,  456,
+      476,  456,  476,  476,  453,  456,  479,  545,  479,  476,
+      715,  545,  479,  456,  499,  524,  499,  499,  716,  549,
+      479,  524,  527,  499,  527,  549,  569,  576,  717,  576,
+      569,  573,   13,   14,   14,   14,   14,  573,  618,   14,
+      618,   14,  597,  718,   14,   14,   14,   14,  597,  611,
+      615,   14,   14,  611,  719,   14,  615,  636,   14,   14,
+
+       14,  636,  640,  643,  670,  643,  670,  720,  640,  721,
+      723,  722,  724,  725,  726,  727,  728,  729,  730,  731,
+      732,  733,  734,  735,  736,   14,   15,   15,   15,   15,
+       15,   15,  737,  738,   15,   15,   15,  722,  739,  740,
+       15,  741,  742,  743,  744,  745,  746,  747,  748,  749,
+      750,  751,  752,  753,  754,   15,  755,  756,  757,  758,
+      759,  760,  761,  762,  763,  764,  765,  766,  767,  768,
+      769,  770,  772,  771,  748,  773,  774,  775,   15,   16,
+       16,   16,   16,   16,   16,  776,  777,   16,   16,   16,
+       16,   16,   16,   16,  778,  779,  780,   16,   16,  771,
+
+      781,   16,  782,  783,   16,   16,   16,  784,   16,  785,
+      786,  787,  788,  789,  790,  792,  791,  793,  794,  795,
+      796,  797,  798,  799,  800,  801,  802,  803,  804,  805,
+      806,   16,   17,   17,   17,   17,  807,  808,   17,   17,
+       17,   17,  791,  809,  810,  811,   17,  812,  813,  814,
+      815,  816,  817,  818,  819,  820,  821,  822,  823,  824,
+      825,  826,  827,  828,  829,  830,  831,  832,  833,  834,
+      835,  836,  837,  839,  840,  841,  842,  844,  817,  845,
+      846,  847,  848,  849,   17,   18,   18,   18,   18,  850,
+      852,   18,   18,   18,   18,  853,   18,   18,   18,   18,
+
+      854,  855,  856,   18,   18,  857,  858,   18,  859,  859,
+       18,   18,   18,  860,  861,  862,  863,  864,  865,  866,
+      867,  868,  869,  870,  871,  872,  873,  874,  875,  877,
+      878,  879,  880,  881,  882,  883,  885,   18,   19,   19,
+       19,   19,  884,  884,   19,   19,   19,   19,  886,  887,
+      888,  889,   19,  890,  891,  892,  893,  894,  895,  896,
+      897,  898,  899,  900,  902,  903,  904,  905,  906,  907,
+      908,  909,  909,  910,  911,  912,  913,  914,  915,  916,
+      917,  918,  919,  920,  921,  922,  923,  924,  925,  927,
+       19,   20,   20,   20,   20,  928,  929,   20,   20,   20,
+
+       20,  930,   20,   20,   20,   20,  931,  932,  933,   20,
+       20,  934,  934,   20,  935,  936,   20,   20,   20,  937,
+      938,  939,  940,  941,  943,  944,  945,  946,  947,  948,
+      948,  949,  950,  951,  952,  953,  954,  955,  956,  957,
+      958,  959,  960,   20,   22,  961,   22,  962,  963,  964,
+       22,  966,  967,   22,   22,   22,   22,  968,  969,  970,
+       22,   22,  971,  972,   22,  973,  973,   22,   22,   22,
+      974,  975,  976,  977,  978,  979,  980,  981,  982,  983,
+      984,  985,  986,  987,  988,  989,  991,  992,  993,  994,
+      995,  996,  997,  999,   22,  998,  998, 1000, 1001, 1002,
+
+     1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012,
+     1014, 1016, 1017, 1018, 1019, 1020, 1022, 1019, 1023, 1024,
+     1025, 1026, 1027, 1028, 1022, 1029, 1030, 1031, 1032, 1033,
+     1034, 1035, 1036, 1038, 1039, 1040, 1041, 1042, 1043, 1044,
+     1042, 1045, 1046, 1047, 1048, 1049, 1050, 1044, 1051, 1052,
+     1053, 1054, 1055, 1056, 1057, 1058, 1060, 1061, 1062, 1063,
+     1064, 1065, 1066, 1064, 1067, 1068, 1069, 1070, 1071, 1072,
+     1073, 1074, 1075, 1076, 1077, 1078, 1079, 1081, 1082, 1083,
+     1084, 1085, 1086, 1087, 1085, 1088, 1089, 1090, 1091, 1092,
+     1093, 1087, 1094, 1095, 1096, 1097, 1095, 1098, 1099, 1100,
+
+     1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1111,
+     1112, 1113, 1114, 1115, 1116, 1117, 1115, 1118, 1119, 1120,
+     1121, 1122, 1123, 1117, 1124, 1125, 1126, 1127, 1128, 1129,
+     1130, 1131, 1133, 1134, 1135, 1136, 1137, 1138, 1139, 1137,
+     1140, 1141, 1142, 1143, 1144, 1145, 1139, 1146, 1147, 1148,
+     1149, 1150, 1151, 1152, 1154, 1155, 1156, 1158, 1159, 1158,
+     1158, 1160, 1161, 1162, 1163, 1165, 1158, 1166, 1167, 1168,
+     1169, 1170, 1171, 1172, 1173, 1174, 1175, 1177, 1178, 1179,
+     1180, 1181, 1180, 1180, 1182, 1183, 1184, 1185, 1187, 1180,
+     1188, 1189, 1190, 1191, 1192, 1193, 1194, 1195, 1196, 1197,
+
+     1199, 1200, 1201, 1202, 1203, 1202, 1202, 1204, 1205, 1207,
+     1208, 1209, 1202, 1210, 1211, 1212, 1213, 1214, 1215, 1216,
+     1217, 1219, 1220, 1221, 1222, 1223, 1222, 1222, 1224, 1225,
+     1226, 1227, 1229, 1222, 1230, 1231, 1232, 1233, 1234, 1235,
+     1234, 1234, 1236, 1238, 1239, 1240, 1241, 1234, 1242, 1243,
+     1244, 1245, 1246, 1247, 1248, 1250, 1251, 1252, 1253, 1254,
+     1253, 1253, 1255, 1256, 1257, 1258, 1260, 1253, 1261, 1262,
+     1263, 1264, 1265, 1266, 1267, 1268, 1269, 1270, 1272, 1273,
+     1274, 1275, 1276, 1275, 1275, 1277, 1278, 1279, 1280, 1282,
+     1275, 1283, 1284, 1285, 1286, 1287, 1289, 1290, 1291, 1293,
+
+     1294, 1296, 1298, 1296, 1296, 1297, 1299, 1297, 1300, 1301,
+     1296, 1303, 1304, 1305, 1306, 1307, 1308, 1309, 1310, 1311,
+     1313, 1314, 1315, 1316, 1315, 1317, 1318, 1319, 1320, 1321,
+     1322, 1323, 1324, 1325, 1326, 1327, 1328, 1330, 1331, 1332,
+     1333, 1334, 1335, 1336, 1337, 1338, 1339, 1340, 1341, 1342,
+     1344, 1345, 1346, 1347, 1346, 1348, 1349, 1350, 1351, 1352,
+     1353, 1354, 1355, 1356, 1357, 1358, 1359, 1360, 1361, 1362,
+     1363, 1365, 1366, 1367, 1368, 1367, 1369, 1370, 1371, 1372,
+     1373, 1374, 1375, 1376, 1377, 1378, 1379, 1380, 1382, 1383,
+     1384, 1385, 1384, 1386, 1387, 1388, 1390, 1391, 1392, 1393,
+
+     1394, 1396, 1397, 1398, 1399, 1400, 1401, 1400, 1403, 1404,
+     1406, 1407, 1408, 1409, 1410, 1411, 1412, 1413, 1414, 1415,
+     1416, 1417, 1419, 1420, 1421, 1422, 1423, 1424, 1425, 1426,
+     1427, 1428, 1430, 1431, 1432, 1433, 1434, 1435, 1436, 1437,
+     1438, 1439, 1440, 1441, 1442, 1443, 1444, 1446, 1447, 1448,
+     1449, 1450, 1451, 1452, 1453, 1454, 1455, 1456, 1457, 1459,
+     1460, 1461, 1462, 1463, 1464, 1465, 1466, 1467, 1468, 1469,
+     1470, 1471, 1472, 1473, 1474, 1474, 1475, 1476, 1478, 1479,
+     1480, 1474, 1481, 1482, 1483, 1484, 1485, 1486, 1486, 1487,
+     1488, 1490, 1491, 1492, 1486, 1493, 1494, 1495, 1496, 1497,
+
+     1498, 1498, 1499, 1500, 1502, 1503, 1504, 1498, 1505, 1506,
+     1507, 1508, 1508, 1509, 1510, 1512, 1513, 1514, 1508, 1515,
+     1516, 1517, 1517, 1518, 1519, 1520, 1521, 1523, 1517, 1522,
+     1522, 1524, 1526, 1527, 1528, 1529, 1522, 1530, 1531, 1532,
+     1533, 1534, 1534, 1535, 1536, 1538, 1539, 1540, 1534, 1541,
+     1542, 1543, 1544, 1545, 1546, 1546, 1547, 1547, 1548, 1548,
+     1552, 1546, 1553, 1547, 1554, 1555, 1556, 1557, 1558, 1559,
+     1559, 1560, 1560, 1561, 1562, 1563, 1559, 1564, 1565, 1566,
+     1567, 1568, 1569, 1570, 1571, 1572, 1573, 1573, 1574, 1574,
+     1575, 1576, 1577, 1573, 1578, 1579, 1580, 1581, 1582, 1583,
+
+     1583, 1584, 1584, 1585, 1586, 1587, 1583, 1588, 1589, 1590,
+     1591, 1592, 1592, 1593, 1593, 1594, 1595, 1596, 1592, 1597,
+     1598, 1600, 1601, 1601, 1602, 1602, 1603, 1603, 1604, 1601,
+     1605, 1602, 1606, 1607, 1608, 1609, 1610, 1610, 1611, 1611,
+     1612, 1613, 1614, 1610, 1615, 1616, 1617, 1618, 1619, 1620,
+     1621, 1622, 1622, 1623, 1623, 1624, 1625, 1626, 1622, 1627,
+     1628, 1629, 1630, 1631, 1631, 1632, 1632, 1633, 1634, 1635,
+     1631, 1636, 1637, 1638, 1639, 1639, 1640, 1640, 1641, 1642,
+     1643, 1639, 1644, 1646, 1648, 1652, 1653, 1657, 1658, 1660,
+     1661, 1665, 1666, 1670, 1671, 1675, 1676, 1677, 1678, 1679,
+
+     1680, 1681, 1682, 1683, 1684, 1685, 1686, 1687, 1688, 1689,
+     1690, 1691, 1692, 1695, 1695, 1695, 1695, 1695, 1696, 1696,
+     1696, 1696, 1696, 1697, 1697, 1697, 1697, 1697, 1698, 1698,
+     1698, 1698, 1698, 1699, 1699, 1699, 1699, 1699, 1700, 1700,
+     1700, 1700, 1700, 1701, 1701, 1701, 1701, 1701, 1702, 1702,
+     1702, 1702, 1702, 1703, 1703, 1703, 1703, 1703, 1704, 1704,
+      694, 1704, 1705,  693, 1705, 1706, 1706,  692, 1706, 1707,
+     1707, 1708, 1708,  691, 1708, 1709, 1709,  690, 1709,  689,
+      688,  687,  686,  685,  684,  683,  682,  681,  680,  679,
+      678,  677,  676,  675,  674,  673,  672,  671,  668,  667,
+
+      666,  665,  664,  663,  662,  661,  660,  659,  658,  657,
+      656,  655,  654,  653,  652,  651,  650,  649,  648,  647,
+      646,  645,  644,  642,  641,  639,  638,  637,  635,  634,
+      633,  632,  631,  630,  629,  628,  627,  626,  625,  624,
+      623,  622,  621,  620,  619,  617,  616,  614,  613,  612,
+      610,  609,  608,  607,  606,  605,  604,  603,  602,  601,
+      600,  599,  598,  596,  595,  594,  593,  592,  591,  590,
+      589,  588,  587,  586,  585,  584,  583,  582,  581,  580,
+      579,  578,  577,  575,  574,  572,  571,  570,  568,  567,
+      566,  565,  564,  563,  562,  561,  560,  559,  558,  557,
+
+      556,  555,  554,  553,  552,  551,  550,  548,  547,  546,
+      544,  543,  542,  541,  540,  539,  538,  537,  536,  535,
+      534,  533,  532,  531,  530,  529,  528,  526,  525,  523,
+      522,  521,  518,  517,  515,  514,  513,  512,  511,  510,
+      509,  508,  507,  506,  505,  504,  503,  502,  501,  498,
+      497,  495,  494,  493,  491,  490,  489,  488,  487,  486,
+      484,  483,  482,  481,  480,  478,  477,  475,  474,  473,
+      472,  471,  470,  469,  468,  467,  466,  465,  464,  463,
+      461,  460,  459,  458,  457,  455,  454,  452,  451,  450,
+      449,  448,  447,  446,  445,  444,  443,  442,  441,  440,
+
+      438,  437,  436,  435,  434,  433,  432,  430,  429,  428,
+      427,  426,  425,  424,  423,  422,  421,  420,  419,  418,
+      416,  415,  414,  413,  412,  410,  409,  407,  406,  405,
+      404,  403,  402,  401,  400,  399,  398,  397,  396,  395,
+      393,  392,  391,  390,  389,  387,  386,  384,  383,  382,
+      381,  380,  379,  378,  377,  376,  375,  374,  373,  372,
+      370,  369,  368,  367,  366,  364,  363,  361,  360,  359,
+      358,  357,  356,  355,  354,  353,  352,  351,  350,  349,
+      348,  347,  346,  345,  343,  342,  341,  340,  339,  337,
+      336,  334,  333,  332,  331,  330,  329,  328,  327,  326,
+
+      325,  323,  322,  320,  319,  318,  317,  316,  315,  313,
+      311,  310,  309,  305,  304,  303,  301,  300,  298,  297,
+      296,  295,  294,  293,  291,  289,  288,  287,  281,  280,
+      279,  277,  276,  274,  273,  272,  271,  270,  269,  267,
+      265,  264,  260,  259,  258,  256,  255,  253,  252,  251,
+      250,  249,  248,  246,  244,  243,  240,  239,  238,  236,
+      235,  233,  232,  231,  230,  229,  228,  226,  224,  223,
+      222,  219,  218,  217,  215,  214,  212,  211,  210,  209,
+      208,  207,  205,  203,  202,  201,  197,  194,  193,  192,
+      191,  190,  187,  186,  185,  183,  182,  180,  179,  178,
+
+      177,  176,  175,  173,  171,  170,  168,  164,  161,  160,
+      157,  156,  152,  148,  145,  144,  142,  141,  140,  139,
+      137,  133,  130,  129,  127,  126,  125,  124,  121,  117,
+      114,  113,  111,  108,  104,  101,  100,   98,   97,   95,
+       91,   88,   87,   84,   83,   78,   74,   71,   70,   68,
+       67,   66,   64,   60,   57,   56,   54,   53,   52,   51,
+       49,   48,   44,   43,   41,   40,   38,   34,   31,   30,
+       27,   26,   23, 1694, 1694, 1694, 1694, 1694, 1694, 1694,
+     1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694,
+     1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694,
+
+     1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694,
+     1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694, 1694,
+     1694, 1694, 1694, 1694, 1694, 1694, 1694
     } ;
 
 /* Table of booleans, true if rule could match eol. */
-static yyconst flex_int32_t yy_rule_can_match_eol[61] =
+static yyconst flex_int32_t yy_rule_can_match_eol[63] =
     {   0,
 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
-    0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 
-    0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 
-    0,     };
+    0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 
+    1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 
+    0, 0, 0,     };
 
 /* The intent behind this definition is that it'll catch
  * any uses of REJECT which flex missed.
@@ -1518,7 +1522,7 @@ using namespace std;
 #include "caf_tokens.h"
 #if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
 #pragma set woff 1110
-#endif
+#endif 
 
 int intcount=0;
 int opa=0;
@@ -1532,7 +1536,7 @@ int opa=0;
 
 
 
-#line 1536 "caf_flexer.cc"
+#line 1540 "caf_flexer.cc"
 
 #define INITIAL 0
 #define NUMBER_2_TEXT 1
@@ -1653,7 +1657,7 @@ YY_DECL
 #line 74 "caf_flexer.ll"
 
 
-#line 1657 "caf_flexer.cc"
+#line 1661 "caf_flexer.cc"
 
 	if ( !(yy_init) )
 		{
@@ -1713,13 +1717,13 @@ yy_match:
 			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 				{
 				yy_current_state = (int) yy_def[yy_current_state];
-				if ( yy_current_state >= 1687 )
+				if ( yy_current_state >= 1695 )
 					yy_c = yy_meta[(unsigned int) yy_c];
 				}
 			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
 			++yy_cp;
 			}
-		while ( yy_base[yy_current_state] != 2163 );
+		while ( yy_base[yy_current_state] != 2174 );
 
 yy_find_action:
 		yy_act = yy_accept[yy_current_state];
@@ -1777,7 +1781,7 @@ YY_RULE_SETUP
 case 4:
 YY_RULE_SETUP
 #line 88 "caf_flexer.ll"
-{ BEGIN(NUMBER_2_TEXT);
+{ BEGIN(NUMBER_2_TEXT); 
 		         intcount = 0;
 		         return(token_clipping); }
 	YY_BREAK
@@ -1797,7 +1801,7 @@ YY_RULE_SETUP
 case 7:
 YY_RULE_SETUP
 #line 99 "caf_flexer.ll"
-{ BEGIN(QUOTED_TEXT);
+{ BEGIN(QUOTED_TEXT); 
 		         return(token_scf_file);   }
 	YY_BREAK
 case 8:
@@ -1810,7 +1814,7 @@ YY_RULE_SETUP
 case 9:
 YY_RULE_SETUP
 #line 106 "caf_flexer.ll"
-{ BEGIN(QUOTED_TEXT);
+{ BEGIN(QUOTED_TEXT); 
 		           return(token_sequencing_vector); }
 	YY_BREAK
 case 10:
@@ -1822,7 +1826,7 @@ YY_RULE_SETUP
 case 11:
 YY_RULE_SETUP
 #line 112 "caf_flexer.ll"
-{ BEGIN(TAG_MODE);
+{ BEGIN(TAG_MODE); 
 		         intcount = 0;
 			 return(token_tag); }
 	YY_BREAK
@@ -1830,7 +1834,7 @@ case 12:
 YY_RULE_SETUP
 #line 116 "caf_flexer.ll"
 { BEGIN(DNA_MODE);
-                         return(token_sequence); }
+                         return(token_sequence); }	
 	YY_BREAK
 case 13:
 YY_RULE_SETUP
@@ -1847,7 +1851,7 @@ YY_RULE_SETUP
 case 15:
 YY_RULE_SETUP
 #line 125 "caf_flexer.ll"
-{ BEGIN(QUOTED_TEXT);
+{ BEGIN(QUOTED_TEXT); 
 		         return(token_asped);      }
 	YY_BREAK
 case 16:
@@ -1859,19 +1863,19 @@ YY_RULE_SETUP
 case 17:
 YY_RULE_SETUP
 #line 131 "caf_flexer.ll"
-{ BEGIN(QUOTED_TEXT);
+{ BEGIN(QUOTED_TEXT); 
 		         return(token_template);   }
 	YY_BREAK
 case 18:
 YY_RULE_SETUP
 #line 134 "caf_flexer.ll"
-{ BEGIN(QUOTED_TEXT);
+{ BEGIN(QUOTED_TEXT); 
 		         return(token_ligation);   }
 	YY_BREAK
 case 19:
 YY_RULE_SETUP
 #line 137 "caf_flexer.ll"
-{ BEGIN(QUOTED_TEXT);
+{ BEGIN(QUOTED_TEXT); 
 			 return(token_pstatus);    }
 	YY_BREAK
 case 20:
@@ -1906,12 +1910,12 @@ YY_RULE_SETUP
 case 25:
 YY_RULE_SETUP
 #line 152 "caf_flexer.ll"
-{ return(token_identifier); }
+{ return(token_identifier); }          
 	YY_BREAK
 case 26:
 YY_RULE_SETUP
 #line 155 "caf_flexer.ll"
-{ intcount++;
+{ intcount++; 
 		               BEGIN(NUMBER_2_TEXT);
 		               return(token_number); }
 	YY_BREAK
@@ -1951,142 +1955,150 @@ YY_RULE_SETUP
 case 33:
 YY_RULE_SETUP
 #line 173 "caf_flexer.ll"
-{ BEGIN(NUMBER_4);
+{ BEGIN(NUMBER_4); 
 			        return(token_identifier); }
 	YY_BREAK
 case 34:
 YY_RULE_SETUP
-#line 176 "caf_flexer.ll"
-{ BEGIN(TEXT); opa = 1; }
+#line 175 "caf_flexer.ll"
+{ BEGIN(NUMBER_4);
+			        return(token_identifier); }
 	YY_BREAK
 case 35:
 YY_RULE_SETUP
-#line 177 "caf_flexer.ll"
-
+#line 178 "caf_flexer.ll"
+{ BEGIN(TEXT); opa = 1; }
 	YY_BREAK
 case 36:
-/* rule 36 can match eol */
 YY_RULE_SETUP
-#line 178 "caf_flexer.ll"
-{ yyless(yyleng-1); BEGIN(0); return(token_quoted_text);}
+#line 179 "caf_flexer.ll"
+
 	YY_BREAK
 case 37:
+/* rule 37 can match eol */
 YY_RULE_SETUP
-#line 179 "caf_flexer.ll"
-{ yymore(); BEGIN(TEXT); opa = 0; }
+#line 180 "caf_flexer.ll"
+{ yyless(yyleng-1); BEGIN(0); return(token_quoted_text);}
 	YY_BREAK
 case 38:
 YY_RULE_SETUP
-#line 182 "caf_flexer.ll"
-{ yymore(); }
+#line 181 "caf_flexer.ll"
+{ yymore(); BEGIN(TEXT); opa = 0; }
 	YY_BREAK
 case 39:
-/* rule 39 can match eol */
 YY_RULE_SETUP
-#line 183 "caf_flexer.ll"
-{ yyless(yyleng-1-opa);
-  	       BEGIN(0); return(token_quoted_text); }
+#line 184 "caf_flexer.ll"
+{ yymore(); }
 	YY_BREAK
 case 40:
+/* rule 40 can match eol */
 YY_RULE_SETUP
 #line 185 "caf_flexer.ll"
-{ yymore(); }
+{ yyless(yyleng-1-opa); 
+  	       BEGIN(0); return(token_quoted_text); }
 	YY_BREAK
 case 41:
 YY_RULE_SETUP
-#line 188 "caf_flexer.ll"
-{ BEGIN(0); return(token_identifier); }
+#line 187 "caf_flexer.ll"
+{ yymore(); }   
 	YY_BREAK
 case 42:
-/* rule 42 can match eol */
-YY_RULE_SETUP
 #line 191 "caf_flexer.ll"
-{ BEGIN(0); return(token_ende); }
-	YY_BREAK
 case 43:
 YY_RULE_SETUP
-#line 192 "caf_flexer.ll"
-{ return(token_number);     }
+#line 191 "caf_flexer.ll"
+{ BEGIN(0); return(token_identifier); }
 	YY_BREAK
 case 44:
+/* rule 44 can match eol */
 YY_RULE_SETUP
-#line 193 "caf_flexer.ll"
-{ return(token_identifier); }
+#line 194 "caf_flexer.ll"
+{ BEGIN(0); return(token_ende); }
 	YY_BREAK
 case 45:
 YY_RULE_SETUP
-#line 199 "caf_flexer.ll"
-{ return(token_type_read);   }
+#line 195 "caf_flexer.ll"
+{ return(token_number);     }
 	YY_BREAK
 case 46:
 YY_RULE_SETUP
-#line 200 "caf_flexer.ll"
-{ return(token_type_contig); }
+#line 196 "caf_flexer.ll"
+{ return(token_identifier); }
 	YY_BREAK
 case 47:
 YY_RULE_SETUP
-#line 201 "caf_flexer.ll"
-{ return(token_type_group);  }
+#line 202 "caf_flexer.ll"
+{ return(token_type_read);   }
 	YY_BREAK
 case 48:
 YY_RULE_SETUP
-#line 202 "caf_flexer.ll"
-{ return(token_type_assembly); }
+#line 203 "caf_flexer.ll"
+{ return(token_type_contig); }
 	YY_BREAK
 case 49:
 YY_RULE_SETUP
-#line 203 "caf_flexer.ll"
-{ return(token_padded);     }
+#line 204 "caf_flexer.ll"
+{ return(token_type_group);  }
 	YY_BREAK
 case 50:
 YY_RULE_SETUP
-#line 204 "caf_flexer.ll"
-{ return(token_unpadded);   }
+#line 205 "caf_flexer.ll"
+{ return(token_type_assembly); }
 	YY_BREAK
 case 51:
 YY_RULE_SETUP
 #line 206 "caf_flexer.ll"
-{ return(token_dye);        }
+{ return(token_padded);     }
 	YY_BREAK
 case 52:
 YY_RULE_SETUP
 #line 207 "caf_flexer.ll"
-{ return(token_dye_terminator); }
+{ return(token_unpadded);   }
 	YY_BREAK
 case 53:
 YY_RULE_SETUP
-#line 208 "caf_flexer.ll"
-{ return(token_dye_primer); }
+#line 209 "caf_flexer.ll"
+{ return(token_dye);        }
 	YY_BREAK
 case 54:
 YY_RULE_SETUP
+#line 210 "caf_flexer.ll"
+{ return(token_dye_terminator); }
+	YY_BREAK
+case 55:
+YY_RULE_SETUP
 #line 211 "caf_flexer.ll"
+{ return(token_dye_primer); }
+	YY_BREAK
+case 56:
+YY_RULE_SETUP
+#line 214 "caf_flexer.ll"
 { return(token_forward); }
 	YY_BREAK
-case 55:
+case 57:
 YY_RULE_SETUP
-#line 212 "caf_flexer.ll"
+#line 215 "caf_flexer.ll"
 { return(token_reverse); }
 	YY_BREAK
-case 56:
+case 58:
 YY_RULE_SETUP
-#line 213 "caf_flexer.ll"
+#line 216 "caf_flexer.ll"
 { while( yyinput() != '\n'); }
 	YY_BREAK
-case 57:
-/* rule 57 can match eol */
+case 59:
+/* rule 59 can match eol */
 YY_RULE_SETUP
-#line 214 "caf_flexer.ll"
+#line 217 "caf_flexer.ll"
 
 	YY_BREAK
-case 58:
+case 60:
 YY_RULE_SETUP
-#line 215 "caf_flexer.ll"
+#line 218 "caf_flexer.ll"
 { return(token_error); }
 	YY_BREAK
-case 59:
+case 61:
 YY_RULE_SETUP
-#line 216 "caf_flexer.ll"
+#line 219 "caf_flexer.ll"
 
 	YY_BREAK
 case YY_STATE_EOF(INITIAL):
@@ -2100,15 +2112,15 @@ case YY_STATE_EOF(DNA_SEQ):
 case YY_STATE_EOF(QUALITY_MODE):
 case YY_STATE_EOF(IDENTIFIER_MODE):
 case YY_STATE_EOF(TEXT):
-#line 217 "caf_flexer.ll"
-{ yyterminate();  }
+#line 220 "caf_flexer.ll"
+{ yyterminate();  }   
 	YY_BREAK
-case 60:
+case 62:
 YY_RULE_SETUP
-#line 218 "caf_flexer.ll"
+#line 221 "caf_flexer.ll"
 ECHO;
 	YY_BREAK
-#line 2112 "caf_flexer.cc"
+#line 2124 "caf_flexer.cc"
 
 	case YY_END_OF_BUFFER:
 		{
@@ -2479,7 +2491,7 @@ int yyFlexLexer::yy_get_next_buffer()
 
 	for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
 		{
-		register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 54);
+		register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 53);
 		if ( yy_accept[yy_current_state] )
 			{
 			(yy_last_accepting_state) = yy_current_state;
@@ -2488,7 +2500,7 @@ int yyFlexLexer::yy_get_next_buffer()
 		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 			{
 			yy_current_state = (int) yy_def[yy_current_state];
-			if ( yy_current_state >= 1687 )
+			if ( yy_current_state >= 1695 )
 				yy_c = yy_meta[(unsigned int) yy_c];
 			}
 		yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -2507,7 +2519,7 @@ int yyFlexLexer::yy_get_next_buffer()
 	register int yy_is_jam;
     	register char *yy_cp = (yy_c_buf_p);
 
-	register YY_CHAR yy_c = 54;
+	register YY_CHAR yy_c = 53;
 	if ( yy_accept[yy_current_state] )
 		{
 		(yy_last_accepting_state) = yy_current_state;
@@ -2516,11 +2528,11 @@ int yyFlexLexer::yy_get_next_buffer()
 	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 		{
 		yy_current_state = (int) yy_def[yy_current_state];
-		if ( yy_current_state >= 1687 )
+		if ( yy_current_state >= 1695 )
 			yy_c = yy_meta[(unsigned int) yy_c];
 		}
 	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
-	yy_is_jam = (yy_current_state == 1686);
+	yy_is_jam = (yy_current_state == 1694);
 
 	return yy_is_jam ? 0 : yy_current_state;
 }
@@ -3017,11 +3029,15 @@ void CAFfree (void * ptr )
 
 #define YYTABLES_NAME "yytables"
 
-#line 218 "caf_flexer.ll"
-
+#line 221 "caf_flexer.ll"
 
 
+  
 #if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
 #pragma reset woff 1110
 #endif
 
+
+
+
+
diff --git a/src/caf/caf_flexer.ll b/src/caf/caf_flexer.ll
index 62cd41d..7cf5854 100644
--- a/src/caf/caf_flexer.ll
+++ b/src/caf/caf_flexer.ll
@@ -37,7 +37,7 @@ using namespace std;
 #include "caf_tokens.h"
 #if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
 #pragma set woff 1110
-#endif
+#endif 
 
 int intcount=0;
 int opa=0;
@@ -45,7 +45,7 @@ int opa=0;
 
 %option yylineno
 
-
+	
 ws         [ \t]
 blank      [" "]
 letter     [A-Za-z]
@@ -53,7 +53,7 @@ seqletter  [A-Za-z\-\*]
 digit      [0-9]
 alphanum   {letter}|{digit}
 identifier ({letter}|{digit}|[\.\-\,\_\+\#\|])+
-identifierextended ({letter}|{digit}|[\%\&\/\.\-\,\_\+\#\|":"])+
+identifierextended ({letter}|{digit}|[\/\.\-\,\_\+\#\|":"])+
 number     ([\-]{digit})|{digit}({digit})*
 comment    \/\/
 sequence   ^Sequence{ws}*[":"]{ws}*
@@ -85,7 +85,7 @@ quality    ^BaseQuality{blank}*[":"]{blank}*
 		         intcount = 0;
 		         return(token_clone_vector); }
 
-<*>^"Clipping "        { BEGIN(NUMBER_2_TEXT);
+<*>^"Clipping "        { BEGIN(NUMBER_2_TEXT); 
 		         intcount = 0;
 		         return(token_clipping); }
 
@@ -96,25 +96,25 @@ quality    ^BaseQuality{blank}*[":"]{blank}*
 		         intcount = 2;
 		         return(token_insert_size); }
 
-<*>^"SCF_File "        { BEGIN(QUOTED_TEXT);
+<*>^"SCF_File "        { BEGIN(QUOTED_TEXT); 
 		         return(token_scf_file);   }
 
 <*>^"Seq_vec "         { BEGIN(NUMBER_2_TEXT);
 		         intcount = 0;
 		         return(token_seq_vector);   }
 
-<*>^"Sequencing_vector " { BEGIN(QUOTED_TEXT);
+<*>^"Sequencing_vector " { BEGIN(QUOTED_TEXT); 
 		           return(token_sequencing_vector); }
 
 <*>^"Staden_id "       { BEGIN(QUOTED_TEXT);
 		         return(token_staden_id);  }
 
-<*>^"Tag "	       { BEGIN(TAG_MODE);
+<*>^"Tag "	       { BEGIN(TAG_MODE); 
 		         intcount = 0;
 			 return(token_tag); }
 
 <*>{dna}               { BEGIN(DNA_MODE);
-                         return(token_sequence); }
+                         return(token_sequence); }	
 
 <*>{sequence}          { BEGIN(IDENTIFIER_MODE);
 		         return(token_sequencename); }
@@ -122,19 +122,19 @@ quality    ^BaseQuality{blank}*[":"]{blank}*
 <*>{quality}           { BEGIN(QUALITY_MODE);
 		         return(token_quality);   }
 
-<*>^"Asped "	       { BEGIN(QUOTED_TEXT);
+<*>^"Asped "	       { BEGIN(QUOTED_TEXT); 
 		         return(token_asped);      }
 
 <*>^"Base_caller "     { BEGIN(QUOTED_TEXT);
 			 return(token_base_caller);  }
 
-<*>^"Template "        { BEGIN(QUOTED_TEXT);
+<*>^"Template "        { BEGIN(QUOTED_TEXT); 
 		         return(token_template);   }
 
-<*>^"Ligation_no "     { BEGIN(QUOTED_TEXT);
+<*>^"Ligation_no "     { BEGIN(QUOTED_TEXT); 
 		         return(token_ligation);   }
 
-<*>^"ProcessStatus "   { BEGIN(QUOTED_TEXT);
+<*>^"ProcessStatus "   { BEGIN(QUOTED_TEXT); 
 			 return(token_pstatus);    }
 
 <*>^"Primer "          { BEGIN QUOTED_TEXT;
@@ -149,10 +149,10 @@ quality    ^BaseQuality{blank}*[":"]{blank}*
 
 <DNA_SEQ>\n{ws}*\n       { BEGIN(0); return(token_ende); }
 <DNA_SEQ>\n              { }
-<DNA_SEQ>{seqletter}*    { return(token_identifier); }
+<DNA_SEQ>{seqletter}*    { return(token_identifier); }          
 
 
-<TAG_MODE>{number}           { intcount++;
+<TAG_MODE>{number}           { intcount++; 
 		               BEGIN(NUMBER_2_TEXT);
 		               return(token_number); }
 <TAG_MODE>{identifier}       { BEGIN(NUMBER_2_TEXT);
@@ -166,26 +166,29 @@ quality    ^BaseQuality{blank}*[":"]{blank}*
 <NUMBER_2_TEXT>{ws}*
 <NUMBER_2_TEXT>{number} { if (++intcount == 2) BEGIN(QUOTED_TEXT);
   		          return(token_number);  }
-<NUMBER_2_TEXT>QUAL|SVEC|CONT|CVEC
+<NUMBER_2_TEXT>QUAL|SVEC|CONT|CVEC                
 
 
 
-<IDENT_NUMBER_4>{identifierextended}  { BEGIN(NUMBER_4);
+<IDENT_NUMBER_4>{identifierextended}  { BEGIN(NUMBER_4); 
+			        return(token_identifier); }
+<IDENT_NUMBER_4>{number}      { BEGIN(NUMBER_4);
 			        return(token_identifier); }
 
 <QUOTED_TEXT>[\"]   { BEGIN(TEXT); opa = 1; }
-<QUOTED_TEXT>{ws}
+<QUOTED_TEXT>{ws}  
 <QUOTED_TEXT>\n     { yyless(yyleng-1); BEGIN(0); return(token_quoted_text);}
 <QUOTED_TEXT>.      { yymore(); BEGIN(TEXT); opa = 0; }
 
 
 <TEXT>[\"]   { yymore(); }
-<TEXT>\n     { yyless(yyleng-1-opa);
+<TEXT>\n     { yyless(yyleng-1-opa); 
   	       BEGIN(0); return(token_quoted_text); }
-<TEXT>.      { yymore(); }
+<TEXT>.      { yymore(); }   
 
 
-<IDENTIFIER_MODE>{identifierextended} { BEGIN(0); return(token_identifier); }
+<IDENTIFIER_MODE>{identifierextended} |
+<IDENTIFIER_MODE>{number}               { BEGIN(0); return(token_identifier); }
 
 
 <QUALITY_MODE>\n{ws}*\n         { BEGIN(0); return(token_ende); }
@@ -211,12 +214,16 @@ quality    ^BaseQuality{blank}*[":"]{blank}*
 <*>^Strand{blank}Forward   { return(token_forward); }
 <*>^Strand{blank}Reverse   { return(token_reverse); }
 <*>{comment}        { while( yyinput() != '\n'); }
-<*>\n
+<*>\n               
 <*>\0               { return(token_error); }
-<*>.
-<<EOF>>             { yyterminate();  }
+<*>.                
+<<EOF>>             { yyterminate();  }   
 %%
-
+  
 #if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
 #pragma reset woff 1110
 #endif
+
+
+
+
diff --git a/src/debuggersupport/Makefile.am b/src/debuggersupport/Makefile.am
deleted file mode 100644
index d152a49..0000000
--- a/src/debuggersupport/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-AM_CPPFLAGS = -I$(top_srcdir)/src $(all_includes)
-
-noinst_LIBRARIES = libmiradebuggersupport.a
-libmiradebuggersupport_a_SOURCES= dbgsupport.C
-noinst_HEADERS= dbgsupport.H
diff --git a/src/debuggersupport/dbgsupport.C b/src/debuggersupport/dbgsupport.C
deleted file mode 100644
index 367e1b6..0000000
--- a/src/debuggersupport/dbgsupport.C
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 2012 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-#include "dbgsupport.H"
-
-#include <cstdio>
-
-bool mira___seendebugger=miraDetectDebugger();
-
-bool seenDebugger()
-{
-  return mira___seendebugger;
-}
-
-void miraDetectGDB()
-{
-  mira___seendebugger=false;
-
-  // fileno() is not std C, does not work, e.g., on Windows
-#if _POSIX_C_SOURCE >= 1 || _XOPEN_SOURCE || _POSIX_SOURCE
-  // take /bin instead of /tmp, some machines apparently have access to /tmp denied
-  FILE *fd = fopen("/bin", "r");
-  // careful, the above may fail! (bug report from Chris Hoefler)
-  if(fd!=nullptr){
-    if(fileno(fd) > 5){
-      mira___seendebugger=true;
-    }
-    fclose(fd);
-  }
-#endif
-
-}
-
-bool miraDetectDebugger()
-{
-  miraDetectGDB();
-  return mira___seendebugger;
-}
diff --git a/src/debuggersupport/dbgsupport.H b/src/debuggersupport/dbgsupport.H
deleted file mode 100644
index 20a86ca..0000000
--- a/src/debuggersupport/dbgsupport.H
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 2012 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-
-#ifndef _mira_debuggersupport_h_
-#define _mira_debuggersupport_h_
-
-bool seenDebugger();
-
-bool miraDetectDebugger();
-
-#endif
diff --git a/src/errorhandling/Makefile.am b/src/errorhandling/Makefile.am
index c2dd591..cc55c9e 100644
--- a/src/errorhandling/Makefile.am
+++ b/src/errorhandling/Makefile.am
@@ -1,5 +1,6 @@
-AM_CPPFLAGS = -I$(top_srcdir)/src $(all_includes)
+INCLUDES = -I$(top_srcdir)/src $(all_includes)
 
 noinst_LIBRARIES = libmiraerrorhandling.a
 libmiraerrorhandling_a_SOURCES= errorhandling.C
 noinst_HEADERS= errorhandling.H
+
diff --git a/src/errorhandling/Makefile.in b/src/errorhandling/Makefile.in
index 3074d7b..656ba78 100644
--- a/src/errorhandling/Makefile.in
+++ b/src/errorhandling/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -39,14 +39,22 @@ subdir = src/errorhandling
 DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/ax_boost_base.m4 \
-	$(top_srcdir)/m4/ax_boost_filesystem.m4 \
-	$(top_srcdir)/m4/ax_boost_iostreams.m4 \
-	$(top_srcdir)/m4/ax_boost_regex.m4 \
-	$(top_srcdir)/m4/ax_boost_system.m4 \
-	$(top_srcdir)/m4/ax_boost_thread.m4 \
-	$(top_srcdir)/m4/ax_check_zlib.m4 \
-	$(top_srcdir)/m4/ax_lib_expat.m4 $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/config/m4/ax_boost_base.m4 \
+	$(top_srcdir)/config/m4/ax_boost_regex.m4 \
+	$(top_srcdir)/config/m4/ax_boost_thread.m4 \
+	$(top_srcdir)/config/m4/ax_check_zlib.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_std.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_stl.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_namespaces.m4 \
+	$(top_srcdir)/config/m4/ax_lib_expat.m4 \
+	$(top_srcdir)/config/m4/ax_with_perl.m4 \
+	$(top_srcdir)/config/m4/ax_with_prog.m4 \
+	$(top_srcdir)/config/m4/libtool.m4 \
+	$(top_srcdir)/config/m4/ltoptions.m4 \
+	$(top_srcdir)/config/m4/ltsugar.m4 \
+	$(top_srcdir)/config/m4/ltversion.m4 \
+	$(top_srcdir)/config/m4/lt~obsolete.m4 \
+	$(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -87,13 +95,9 @@ AWK = @AWK@
 BITPACKAGE = @BITPACKAGE@
 BLOODYDARWINSTATLIBDIRHACK = @BLOODYDARWINSTATLIBDIRHACK@
 BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
-BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@
-BOOST_IOSTREAMS_LIB = @BOOST_IOSTREAMS_LIB@
 BOOST_LDFLAGS = @BOOST_LDFLAGS@
 BOOST_REGEX_LIB = @BOOST_REGEX_LIB@
-BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@
 BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
-BUNDLETARGET = @BUNDLETARGET@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
@@ -106,7 +110,6 @@ CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -116,13 +119,11 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LDFLAGS = @EXPAT_LDFLAGS@
-EXPAT_LIBS = @EXPAT_LIBS@
 EXPAT_VERSION = @EXPAT_VERSION@
 FGREP = @FGREP@
 FLEX = @FLEX@
 FLEXPP = @FLEXPP@
 GREP = @GREP@
-HAVE_XXD = @HAVE_XXD@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -140,7 +141,6 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
 MIRASTATIC = @MIRASTATIC@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
@@ -157,17 +157,18 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
+SHORTMIRAAUDIENCE = @SHORTMIRAAUDIENCE@
 STRIP = @STRIP@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -201,6 +202,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -216,7 +218,7 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-AM_CPPFLAGS = -I$(top_srcdir)/src $(all_includes)
+INCLUDES = -I$(top_srcdir)/src $(all_includes)
 noinst_LIBRARIES = libmiraerrorhandling.a
 libmiraerrorhandling_a_SOURCES = errorhandling.C
 noinst_HEADERS = errorhandling.H
@@ -257,7 +259,7 @@ $(am__aclocal_m4_deps):
 
 clean-noinstLIBRARIES:
 	-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
-libmiraerrorhandling.a: $(libmiraerrorhandling_a_OBJECTS) $(libmiraerrorhandling_a_DEPENDENCIES) $(EXTRA_libmiraerrorhandling_a_DEPENDENCIES) 
+libmiraerrorhandling.a: $(libmiraerrorhandling_a_OBJECTS) $(libmiraerrorhandling_a_DEPENDENCIES) 
 	-rm -f libmiraerrorhandling.a
 	$(libmiraerrorhandling_a_AR) libmiraerrorhandling.a $(libmiraerrorhandling_a_OBJECTS) $(libmiraerrorhandling_a_LIBADD)
 	$(RANLIB) libmiraerrorhandling.a
@@ -393,15 +395,10 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	if test -z '$(STRIP)'; then \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	      install; \
-	else \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-	fi
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
 mostlyclean-generic:
 
 clean-generic:
diff --git a/src/errorhandling/errorhandling.C b/src/errorhandling/errorhandling.C
index 21eb6e6..2a6b025 100644
--- a/src/errorhandling/errorhandling.C
+++ b/src/errorhandling/errorhandling.C
@@ -11,30 +11,33 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
+// 	$Id$	
+
+#ifndef lint
+static char vcid[] = "$Id$";
+#endif /* lint */
 
-#include "errorhandling.H"
-#include "util/fmttext.H"
 
-#include <cstdlib>     // exit(), free() under Cygwin
-#include <csignal>
-#include <unistd.h>
+#include "errorhandling.H"
 
-using namespace std;
 
-bool Notify::NO_bangonthrow=false;
+void Notify::foolCompiler()
+{
+#include "stdinc/foolcompiler.C"
+}
 
 Notify::Notify(uint8 _gravity, const char * _tif)
 {
@@ -43,13 +46,7 @@ Notify::Notify(uint8 _gravity, const char * _tif)
 
   cerr.flush();
   gravity=_gravity;
-  tif=_tif;
-
-  if(NO_bangonthrow && _gravity>WARNING){
-    cout << *this;
-    raise(SIGTRAP);
-  }
-
+  tif=conditionalStrCpy(_tif);
   FUNCEND();
 }
 
@@ -61,14 +58,8 @@ Notify::Notify(uint8 _gravity, const char * _tif, const char * _msg1)
 
   cerr.flush();
   gravity=_gravity;
-  tif=_tif;
-  msg1= _msg1;
-
-  if(NO_bangonthrow && _gravity>WARNING){
-    cout << *this;
-    raise(SIGTRAP);
-  }
-
+  tif=conditionalStrCpy(_tif);
+  msg1= conditionalStrCpy(_msg1);
   FUNCEND();
 }
 
@@ -91,10 +82,11 @@ Notify const & Notify::operator=(Notify const & other)
   FUNCSTART("Notify const & Contig::operator=(Notify const & other)");
 
   if(this != &other){
+    TRACE("copying\n");
     discard();
 
-    tif=other.tif;
-    msg1=other.msg1;
+    tif=conditionalStrCpy(other.tif);
+    msg1=conditionalStrCpy(other.msg1);
     gravity=other.gravity;
   }
 
@@ -108,8 +100,8 @@ void Notify::zeroPointers()
   FUNCSTART("void Notify::zeroPointers()");
 
   gravity=FATAL;
-  tif.clear();
-  msg1.clear();
+  tif=NULL;
+  msg1=NULL;
 
   FUNCEND();
 }
@@ -126,6 +118,8 @@ Notify::~Notify()
 void Notify::discard()
 {
   FUNCSTART("Notify::discard()");
+  if(tif!=NULL) delete [] tif;
+  if(msg1!=NULL) delete [] msg1;
 
   zeroPointers();
   FUNCEND();
@@ -139,37 +133,35 @@ void Notify::setGravity(uint8 _gravity)
 ostream & operator<<(ostream &ostr, Notify const &n)
 {
   // flush stdout and stderr, there might be still some thing in it
-  ostr.flush();
+  cout.flush();
   cerr.flush();
 
-  ostr << "\n";
+  cout << "\n";
   switch(n.gravity){
   case Notify::INTERNAL: {
-    ostr << FmtText::wordWrap("Internal logic/programming/debugging error (*sigh* this should not have happened)\n\n",80);
+    cout << "Internal logic/programming/debugging error (*sigh* this should not have happened).\nPlease file a bug report on http://sourceforge.net/apps/trac/mira-assembler/\n\n";
     break;
   }
   case Notify::FATAL: {
-    ostr << "Fatal error (may be due to problems of the input data or parameters):\n\n";
+    cout << "Fatal error (may be due to problems of the input data or parameters):\n\n";
     break;
   }
   case Notify::WARNING: {
-    ostr << "Warning:\n\n";
+    cout << "Warning:\n\n";
     break;
   }
   case Notify::REMARK: {
-    ostr << "Remark:\n\n";
+    cout << "Remark:\n\n";
     break;
   }
   }
-  if(!n.msg1.empty()){
-    ostr << FmtText::makeTextSign(n.msg1,80);
+  if(n.msg1!=NULL){
+    cout << "\"" << n.msg1 << "\"";
   }
-  if(!n.tif.empty()){
-    ostr << "\n->Thrown: " << n.tif;
+  if(n.tif!=NULL){
+    cout << "\n\n->Thrown: " << n.tif;
   }
-  ostr << endl;
-
-  return ostr;
+  cout << endl;
 }
 
 void Notify::handleError(const char * _cif)
@@ -177,29 +169,30 @@ void Notify::handleError(const char * _cif)
   FUNCSTART("void Notify::handleError(const char * _cif)");
 
   if(gravity!=SILENT) {
-
+    
     cout << *this;
-    if(_cif!=nullptr){
+    if(_cif!=NULL){
       cout << "->Caught: " << _cif << endl << endl;
     }
 
     if(gravity==INTERNAL) {
-      cout << FmtText::wordWrap("Aborting process, probably due to an internal error.\n\n"
-				"If you want to report the error, please do so on\n"
-				"\thttp://sourceforge.net/p/mira-assembler/tickets/\n"
-				"and also give a short notice on the mira talk mailing list.\n\n"
-				"If reporting, please do not delete the log and checkpoint directories, there may be files in them which could be needed to find the problem.",80) << endl;
+      cout << "Aborting process, probably due to an internal error.\n\n"
+	"If you want to report the error, please do so on\n"
+	"\thttp://sourceforge.net/apps/trac/mira-assembler/\n"
+	"and also give a short notice on the mira talk mailing list.\n\n"
+	"If reporting, please do not delete the log and checkpoint directories, there may\n"
+	"be files in them which could be needed to find the problem.\n" << endl;
     }
     if(gravity==FATAL) {
-      cout << FmtText::wordWrap("Aborting process, probably due to error in the input data or parametrisation."
-				" Please check the output log for more information.\n"
-				"For help, please write a mail to the mira talk mailing list.",80)
+      cout << "Aborting process, probably due to error in the input data or parametrisation.\n"
+	"Please check the output log for more information.\n" 
+	"For help, please write a mail to the mira talk mailing list.\n"
 	   << endl;
     }
     if(gravity==FATAL || gravity==INTERNAL) {
       cout << "Subscribing / unsubscribing to mira talk, see: http://www.freelists.org/list/mira_talk\n" << endl;
 	char *cwd;
-	if ((cwd = getcwd(nullptr, 4096)) == nullptr) {
+	if ((cwd = getcwd(NULL, 4096)) == NULL) {
 	    perror("pwd error");
 	    exit(2);
 	}
@@ -209,7 +202,7 @@ void Notify::handleError(const char * _cif)
 	cout << "Thank you for noticing that this is *NOT* a crash, but a"
 	  "\ncontrolled program stop.\n";
 
-	exit(100);
+	exit(1);
     }
   }
 
@@ -255,7 +248,7 @@ ostream & operator<<(ostream &ostr, Flow const  &f)
   }
 
   ostr << "\nData: " << f.fl_data << endl;
-
+ 
   return ostr;
 }
 
diff --git a/src/errorhandling/errorhandling.H b/src/errorhandling/errorhandling.H
index 2b87225..e364643 100644
--- a/src/errorhandling/errorhandling.H
+++ b/src/errorhandling/errorhandling.H
@@ -11,52 +11,61 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
-// 	$Id$
+// 	$Id$	
 
 #ifndef _errorclasses_h_
 #define _errorclasses_h_
 
-#include <string>
-#include <sstream>
+#include <cstdio>
+#include <strings.h>
+#include <unistd.h>
 
+#include <iostream>
+#if __GNUC__ >= 3
+#include <sstream>
+#else
+#include <strstream>
+#endif 
 
 #include "stdinc/defines.H"
 #include "util/misc.H"
 
 
 
+//#if __GNUC__ >= 3
+//#define NOTIFYMSG(bla) ostringstream opuffer; opuffer << bla << ends; string n1=opuffer.str(); char notifymsg[10000]; strcpy(notifymsg, n1.c_str()); 
+//#else
+//#define NOTIFYMSG(bla) ostrstream opuffer; opuffer << bla << ends; char *n1=opuffer.str(); char notifymsg[10000]; strcpy(notifymsg, n1); delete [] n1;
+//#endif
 
 
+using namespace std;
+
 class Notify
 {
 public:
-  enum {SILENT=0, REMARK, WARNING, FATAL, INTERNAL};
+  enum {SILENT, REMARK, WARNING, FATAL, INTERNAL};
 
 public:
-  std::string tif;               // thrown_in_function;
-  std::string msg1;              // normally: Errordescription
+  char * tif;               // thrown_in_function;
+  char * msg1;              // normally: Errordescription
   uint8  gravity;
 
-  // variables
-private:
-  static bool NO_bangonthrow;
-
   //Functions
 private:
-
   void foolCompiler();
 
   void zeroPointers();
@@ -70,16 +79,12 @@ public:
   Notify(Notify const &other);
   virtual ~Notify();
 
-  friend std::ostream & operator<<(std::ostream &ostr, Notify const &n);
+  friend ostream & operator<<(ostream &ostr, Notify const &n);
   Notify const & operator=(Notify const & other);
 
   void setGravity(uint8 _gravity);
-  void setMsg(const char * msg) {msg1=msg;}
 
   void handleError(const char * _cif);     // caught in function
-  void handleError(const std::string & _cif) {handleError(_cif.c_str());};     // caught in function
-
-  static void setBangOnThrow(bool b) {NO_bangonthrow=b;}
 };
 
 
@@ -100,7 +105,7 @@ public:
   Flow(int32 flowtype=UNDEFINED);
   Flow(int32 flowtype, int32 data);
 
-  friend std::ostream & operator<<(std::ostream &ostr, Flow const &f);
+  friend ostream & operator<<(ostream &ostr, Flow const &f);
 
   void exitWhenUndefined();
 };
diff --git a/src/examine/Makefile.am b/src/examine/Makefile.am
new file mode 100644
index 0000000..392b367
--- /dev/null
+++ b/src/examine/Makefile.am
@@ -0,0 +1,7 @@
+INCLUDES = -I$(top_srcdir)/src $(all_includes)
+
+noinst_LIBRARIES = libmiraExamine.a
+libmiraExamine_a_SOURCES= scf_look.C ranges.C afh_info.C cfh.C calc.C prescan.C misc.C buffer.C
+noinst_HEADERS= buffer.H misc.H scf_look.H globals.H prescan.H scfbuffer.H
+
+
diff --git a/src/debuggersupport/Makefile.in b/src/examine/Makefile.in
similarity index 83%
rename from src/debuggersupport/Makefile.in
rename to src/examine/Makefile.in
index 7424bc5..500a37e 100644
--- a/src/debuggersupport/Makefile.in
+++ b/src/examine/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -35,18 +35,26 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
-subdir = src/debuggersupport
+subdir = src/examine
 DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/ax_boost_base.m4 \
-	$(top_srcdir)/m4/ax_boost_filesystem.m4 \
-	$(top_srcdir)/m4/ax_boost_iostreams.m4 \
-	$(top_srcdir)/m4/ax_boost_regex.m4 \
-	$(top_srcdir)/m4/ax_boost_system.m4 \
-	$(top_srcdir)/m4/ax_boost_thread.m4 \
-	$(top_srcdir)/m4/ax_check_zlib.m4 \
-	$(top_srcdir)/m4/ax_lib_expat.m4 $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/config/m4/ax_boost_base.m4 \
+	$(top_srcdir)/config/m4/ax_boost_regex.m4 \
+	$(top_srcdir)/config/m4/ax_boost_thread.m4 \
+	$(top_srcdir)/config/m4/ax_check_zlib.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_std.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_stl.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_namespaces.m4 \
+	$(top_srcdir)/config/m4/ax_lib_expat.m4 \
+	$(top_srcdir)/config/m4/ax_with_perl.m4 \
+	$(top_srcdir)/config/m4/ax_with_prog.m4 \
+	$(top_srcdir)/config/m4/libtool.m4 \
+	$(top_srcdir)/config/m4/ltoptions.m4 \
+	$(top_srcdir)/config/m4/ltsugar.m4 \
+	$(top_srcdir)/config/m4/ltversion.m4 \
+	$(top_srcdir)/config/m4/lt~obsolete.m4 \
+	$(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -54,11 +62,12 @@ CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
 LIBRARIES = $(noinst_LIBRARIES)
 ARFLAGS = cru
-libmiradebuggersupport_a_AR = $(AR) $(ARFLAGS)
-libmiradebuggersupport_a_LIBADD =
-am_libmiradebuggersupport_a_OBJECTS = dbgsupport.$(OBJEXT)
-libmiradebuggersupport_a_OBJECTS =  \
-	$(am_libmiradebuggersupport_a_OBJECTS)
+libmiraExamine_a_AR = $(AR) $(ARFLAGS)
+libmiraExamine_a_LIBADD =
+am_libmiraExamine_a_OBJECTS = scf_look.$(OBJEXT) ranges.$(OBJEXT) \
+	afh_info.$(OBJEXT) cfh.$(OBJEXT) calc.$(OBJEXT) \
+	prescan.$(OBJEXT) misc.$(OBJEXT) buffer.$(OBJEXT)
+libmiraExamine_a_OBJECTS = $(am_libmiraExamine_a_OBJECTS)
 DEFAULT_INCLUDES = -I. at am__isrc@
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
@@ -72,8 +81,8 @@ CXXLD = $(CXX)
 CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	--mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
 	$(LDFLAGS) -o $@
-SOURCES = $(libmiradebuggersupport_a_SOURCES)
-DIST_SOURCES = $(libmiradebuggersupport_a_SOURCES)
+SOURCES = $(libmiraExamine_a_SOURCES)
+DIST_SOURCES = $(libmiraExamine_a_SOURCES)
 HEADERS = $(noinst_HEADERS)
 ETAGS = etags
 CTAGS = ctags
@@ -88,13 +97,9 @@ AWK = @AWK@
 BITPACKAGE = @BITPACKAGE@
 BLOODYDARWINSTATLIBDIRHACK = @BLOODYDARWINSTATLIBDIRHACK@
 BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
-BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@
-BOOST_IOSTREAMS_LIB = @BOOST_IOSTREAMS_LIB@
 BOOST_LDFLAGS = @BOOST_LDFLAGS@
 BOOST_REGEX_LIB = @BOOST_REGEX_LIB@
-BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@
 BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
-BUNDLETARGET = @BUNDLETARGET@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
@@ -107,7 +112,6 @@ CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -117,13 +121,11 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LDFLAGS = @EXPAT_LDFLAGS@
-EXPAT_LIBS = @EXPAT_LIBS@
 EXPAT_VERSION = @EXPAT_VERSION@
 FGREP = @FGREP@
 FLEX = @FLEX@
 FLEXPP = @FLEXPP@
 GREP = @GREP@
-HAVE_XXD = @HAVE_XXD@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -141,7 +143,6 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
 MIRASTATIC = @MIRASTATIC@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
@@ -158,17 +159,18 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
+SHORTMIRAAUDIENCE = @SHORTMIRAAUDIENCE@
 STRIP = @STRIP@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -202,6 +204,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -217,10 +220,10 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-AM_CPPFLAGS = -I$(top_srcdir)/src $(all_includes)
-noinst_LIBRARIES = libmiradebuggersupport.a
-libmiradebuggersupport_a_SOURCES = dbgsupport.C
-noinst_HEADERS = dbgsupport.H
+INCLUDES = -I$(top_srcdir)/src $(all_includes)
+noinst_LIBRARIES = libmiraExamine.a
+libmiraExamine_a_SOURCES = scf_look.C ranges.C afh_info.C cfh.C calc.C prescan.C misc.C buffer.C
+noinst_HEADERS = buffer.H misc.H scf_look.H globals.H prescan.H scfbuffer.H
 all: all-am
 
 .SUFFIXES:
@@ -234,9 +237,9 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/debuggersupport/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/examine/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu src/debuggersupport/Makefile
+	  $(AUTOMAKE) --gnu src/examine/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -258,10 +261,10 @@ $(am__aclocal_m4_deps):
 
 clean-noinstLIBRARIES:
 	-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
-libmiradebuggersupport.a: $(libmiradebuggersupport_a_OBJECTS) $(libmiradebuggersupport_a_DEPENDENCIES) $(EXTRA_libmiradebuggersupport_a_DEPENDENCIES) 
-	-rm -f libmiradebuggersupport.a
-	$(libmiradebuggersupport_a_AR) libmiradebuggersupport.a $(libmiradebuggersupport_a_OBJECTS) $(libmiradebuggersupport_a_LIBADD)
-	$(RANLIB) libmiradebuggersupport.a
+libmiraExamine.a: $(libmiraExamine_a_OBJECTS) $(libmiraExamine_a_DEPENDENCIES) 
+	-rm -f libmiraExamine.a
+	$(libmiraExamine_a_AR) libmiraExamine.a $(libmiraExamine_a_OBJECTS) $(libmiraExamine_a_LIBADD)
+	$(RANLIB) libmiraExamine.a
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -269,7 +272,14 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dbgsupport.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/afh_info.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/buffer.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/calc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cfh.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/misc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/prescan.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ranges.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/scf_look.Po at am__quote@
 
 .C.o:
 @am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@@ -394,15 +404,10 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	if test -z '$(STRIP)'; then \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	      install; \
-	else \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-	fi
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
 mostlyclean-generic:
 
 clean-generic:
diff --git a/src/examine/afh_info.C b/src/examine/afh_info.C
new file mode 100644
index 0000000..bd739ce
--- /dev/null
+++ b/src/examine/afh_info.C
@@ -0,0 +1,541 @@
+/*
+ * Written by Thomas Pfisterer
+ *
+ * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
+ *   Krebsforschungszentrum, DKFZ Heidelberg) and Thomas Pfisterer
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ *
+ */
+
+#include "scf_look.H"
+#include "globals.H"
+
+// 	$Id$	
+
+#ifndef lint
+static char vcid[] = "$Id$";
+#endif /* lint */
+
+
+
+/* --------------------- */
+/*       afh_Info        */
+/* --------------------- */
+
+/*
+afh_Info::afh_Info(SCF_look *r) 
+{
+  read   = r;
+  status = fhs_UNHANDLED;
+  next   = NULL;
+
+  original_base   = 'X';
+  hypothesis_base = 'X';
+}
+*/
+
+
+afh_Info::afh_Info(SCF_look *r, const int32 dbPos, const int32 scfPos, 
+		   const char hypoBase, const char oldBase, const int32 fClass)
+{
+  theTrace = NULL;
+  contig_read = NULL;
+
+  status   = fhs_UNHANDLED;
+  confirmed= -1.0;
+  next     = NULL;
+  question = fClass;
+ 
+  dbPosition       = dbPos;
+  scfPosition      = scfPos;
+  hypothesis_base  = hypoBase;
+  original_base    = oldBase;
+  original_quality = 99;
+}
+
+
+afh_Info::afh_Info(const Contig::contigread_t *r, const int32 dbPos, 
+		   const int32 scfPos,  const char hypoBase, 
+		   const char oldBase, const int32 fClass)
+{
+  theTrace    = NULL;
+  contig_read = r;
+
+  status   = fhs_UNHANDLED;
+  confirmed= -1.0;
+  next     = NULL;
+  question = fClass;
+ 
+  dbPosition      = dbPos;
+  scfPosition     = scfPos;
+  hypothesis_base = hypoBase;
+  original_base   = oldBase;
+  original_quality = 99; 
+}
+
+
+
+afh_Info::~afh_Info()
+{
+  if (theTrace != NULL) { 
+    //    SCFBuffer::bufferDelete(theTrace);
+    delete theTrace;
+  }
+  theTrace = NULL;
+}
+
+
+/*
+afh_Info::afh_Info(afh_Info const &other)
+{
+  clear();
+  *this=other;
+}
+*/
+
+ 
+bool afh_Info::compareWith(afh_Info &a)
+{
+  return (contig_read == a.getContigRead());
+}
+
+
+
+SCF_look* afh_Info::performEditOnRead(afh_Info &a)
+{
+  SCF_look *unedited;
+
+  if (theTrace != NULL) {
+    delete theTrace;
+  }
+  theTrace = NULL;
+
+  unedited = a.getTraceData();
+
+  if (unedited == NULL) {
+    // we can not perform any edits because there is no trace.
+    // e.g. if the scf-file is missing.
+    return NULL;
+  }
+
+  theTrace  = new SCF_look;
+  *theTrace = *unedited;
+
+  int32 operation = a.getQuestion();
+  char  old_base  = a.getOriginalBase(); 
+  char  new_base  = a.getHypothesisBase();
+
+
+#ifdef VERBOSE
+  cout << "VORHER" << endl;
+  theTrace->showDBArea(a.dbPos(), 5, cout);
+  cout << "\n" << old_base << " => " << new_base << endl; 
+#endif
+
+
+ 
+  if (operation  == fhc_SYNTACTIC) {
+    if (old_base  == '.' || old_base == ' ') {
+      
+#ifdef VERBOSE
+      cout << "fhc_SYNTACTIC -> fhc_MISSING" << endl;
+#endif
+      operation = fhc_MISSING;
+    }
+    if (new_base == '.' || new_base == ' ') {
+#ifdef VERBOSE
+      cout << "fhc_SYNTACTIC -> fhc_ADDITIONAL" << endl;
+#endif 
+      
+      //      assert(old_base == '*');
+      //theTrace->deleteBaseDB(a.dbPos());
+      operation = fhc_ADDITIONAL;
+    }
+  }
+  
+  switch (operation) {
+  case fhc_OVERCALL:
+  case fhc_ADDITIONAL:
+
+#ifdef VERBOSE
+    cout << "Delete Base" << endl;
+    cout << *this;
+#endif
+
+    if (new_base != '*') {
+      theTrace->deleteBaseDB(a.dbPos());
+    } else {
+      theTrace->alterBaseDB(a.dbPos(), new_base);
+    }
+    break;
+
+  case fhc_UNDERCALL:
+  case fhc_MISSING:
+#ifdef VERBOSE
+    cout << "Insert Base" << endl;
+    cout << *this;
+#endif
+
+    if (old_base != '*') {
+      theTrace->insertBaseDB(a.dbPos(), a.scfPos(), new_base);
+    } else {
+      if (theTrace->getDBBase(a.dbPos()) == '*') {
+	theTrace->alterBaseDB(a.dbPos(), new_base);
+      } else {
+	if (a.dbPos() > 0 && theTrace->getDBBase(a.dbPos())-1 == '*') {
+	  theTrace->alterBaseDB(a.dbPos()-1, new_base);
+	} else {
+	  theTrace->alterBaseDB(a.dbPos()+1, new_base);
+	}
+      }
+    }
+    break;
+
+  case fhc_WRONG:
+#ifdef VERBOSE
+    cout << "Alter Base" << endl;
+    cout << *this;
+#endif
+    theTrace->alterBaseDB(a.dbPos(), new_base);
+    break;
+
+#ifdef VERBOSE  
+  default:
+    cout << "Syntactic" << endl;
+#endif
+
+  }
+
+#ifdef VERBOSE
+  cout << "\nNACHHER:" << endl;
+  theTrace->showDBArea(a.dbPos(), 5, cout);
+  cout << endl << endl;
+#endif
+
+  return theTrace;
+}
+
+
+
+const char *afh_Info::getReadName() const 
+{
+  if (theTrace != NULL) {
+    return theTrace->getFileName();
+  } 
+  if (contig_read != NULL) {
+    return (contig_read->read).getName().c_str();
+  }
+  return NULL;
+}
+
+
+
+const char* afh_Info::getFaultClassName() const 
+{
+ static const char *fhClassName[] = { 
+  "Undefined", 
+  "Overcall", 
+  "Additional Call", 
+  "Wrong Call",
+  "Undercall", 
+  "Missing Call", 
+  "Syntactic", 
+  "Correct Call", 
+  "Correct Gap" 
+  };
+
+ if (question < 0 || question > 8) {
+   return fhClassName[0];
+ } else { 
+   return fhClassName[question];
+ }
+}
+
+
+
+bool afh_Info::getIsExtendedAlterOperation()
+{
+  switch (question) {
+  case fhc_WRONG: return true;
+  case fhc_OVERCALL:
+  case fhc_ADDITIONAL:
+    return hypothesis_base == '*';
+  case fhc_UNDERCALL:
+  case fhc_MISSING: 
+    return original_base == '*';
+  }
+  return false;
+}
+
+
+
+
+bool afh_Info::loadRead()
+{
+  if (confirmed < 0) {
+    if (theTrace == NULL) {
+      try {
+	//	theTrace = new SCF_look;
+	//*theTrace = *(ScfBuffer::bufferRead(contig_read->read,
+	//				   contig_read->direction));
+
+	theTrace = &(ScfBuffer::bufferReadCopy(contig_read->read,
+					       contig_read->direction));
+      }
+      catch (Notify n) {
+	theTrace  = NULL;
+	reject(0);
+      }
+    }
+  }
+  return (theTrace != NULL);  
+}
+
+
+
+float afh_Info::eval(const bool verbose) 
+{
+  if (theTrace == NULL) {
+    loadRead();  
+  }
+
+  if (theTrace != NULL) {
+    
+    if (verbose) {
+      confirmed =  evaluate(scfPosition, dbPosition, question, 
+			    hypothesis_base, theTrace, cout);
+    } else {
+      confirmed =  evaluate(scfPosition, dbPosition, question, 
+			    hypothesis_base, theTrace);
+    }
+
+  }
+  return confirmed;
+}
+
+
+
+const char* afh_Info::getFaultStatusName() const
+{
+  static const char *fhStatusName[] = {
+    "UNDEFINED", 
+    "UNHANDLED", 
+    "CONFIRMED",
+    "REJECTED", 
+    "UNDECIDABLE"
+  };
+
+  if (status < 0 || status > 4) {
+    return fhStatusName[0];
+  } else {
+    return fhStatusName[status];
+  }
+}
+
+
+bool afh_Info::isConfirmed() const
+{
+  return (status == fhs_CONFIRMED);
+}
+
+
+void afh_Info::confirm(const float confirmValue) {
+  status  = fhs_CONFIRMED;
+  confirmed = confirmValue;
+}
+
+
+void afh_Info::reject(const float confirmValue) {
+  status  = fhs_REJECTED;
+  confirmed = confirmValue;
+}
+
+
+
+afh_Info* afh_Info::nextAfh() {
+  return next;
+}
+
+
+
+int16 afh_Info::isSupportingHypotheses() 
+{
+  return (question == fhc_GAP || question == fhc_CORRECT);  
+}
+
+
+
+bool afh_Info::isNPlusHypotheses()
+{
+  return (isUndefinedBase(original_base) && hypothesis_base != '*');
+}
+
+
+bool afh_Info::isNToBaseHypotheses()
+{
+  return (isUndefinedBase(original_base) && isRealBase(hypothesis_base));
+}
+
+
+
+int16 afh_Info::isReversed() {
+  if (theTrace != NULL) {
+    return theTrace->isReversed();
+  }
+  if (contig_read != NULL) {
+    return (contig_read->direction < 0);
+  }
+  return 0;
+}
+
+
+
+int16 afh_Info::appendAfh(afh_Info *a) {
+  afh_Info *xx;
+
+  if (a == NULL) { return 1; }
+
+  xx = this;
+  while (xx->next != NULL) { xx = xx->next; }  
+
+  xx->next = a;
+  a->next = NULL;
+
+  return 0;
+}
+
+
+void afh_Info::setDBPos(int32 newPos)
+{
+  dbPosition = newPos;
+}
+
+void afh_Info::setSCFPos(int32 newPos)
+{
+  scfPosition = newPos;
+}
+
+
+// verschiebe alle editpositionen hinter hypothese wenn sie den selben
+// read betreffen und die position des edits nach pos liegt
+
+void afh_Info::shiftLeftAfterPos(int32 startPos)
+{
+  afh_Info *l = this;
+
+  cout << "shift left" << endl;
+  while (l != NULL) {
+    if (l->compareWith(*this))  {
+      if (l->dbPos() >= startPos) {
+	l->setDBPos(l->dbPos() - 1);
+
+	/*
+	if (l->isReversed()) {
+	  l->setSCFPos(l->scfPos() + 1);
+	} else {
+	  l->setSCFPos(l->scfPos() - 1);
+	}
+	*/
+      }
+    }
+    l = l->next;
+  }
+}
+
+
+
+void afh_Info::shiftRightAfterPos(int32 startPos)
+{
+  afh_Info *l = this;
+
+  cout << "shift right" << endl;
+  while (l != NULL) {
+    if (l->compareWith(*this))  {
+      if (l->dbPos() >= startPos) {
+	l->setDBPos(l->dbPos() + 1);
+	/*
+	if (l->isReversed()) {
+	  l->setSCFPos(l->scfPos() - 1);
+	} else {
+	  l->setSCFPos(l->scfPos() + 1);
+	}
+	*/
+      }
+    }
+    l = l->next;
+  }
+}
+
+
+
+char afh_Info::dbBase() 
+{
+  if (theTrace == NULL) {
+    throw Notify(Notify::FATAL, "dbBase", "SCF-File not loaded!!");
+  }
+  return theTrace->getDBBase(dbPosition);
+}
+
+
+
+// -------------------------------------------------------
+
+
+ostream &operator<<(ostream &ostr, afh_Info const &i)
+{
+  ostr << "DB: " << i.dbPosition;
+  ostr << "\tSCF: " << i.scfPosition;
+  ostr << "\t" << i.getReadName();
+  ostr << "\t" << i.getFaultClassName(); 
+  ostr << "\t" << i.getFaultStatusName();
+  ostr << "\t" << i.original_base << "=>" << i.hypothesis_base;
+  ostr << "\tconf " << i.confirmed 
+       << " BQ " << ((int)(i.original_quality)) 
+       << " ID" << i.scfInfoId << "\t" << i.theTrace << endl;
+
+  if (i.next != NULL) { ostr << *(i.next); }
+
+  return ostr;
+}
+
+
+
+// Is there something in the chemistry that supports that the 
+// correct bases are before-base-after?
+// For reversed reads take the complement of the DB-bases.
+int16 afh_Info::chemistryEvaluation(char before, char base, char after)
+{
+  int result = 100;
+
+  if (isReversed()) {
+    if ((toupper(after) == 'A') && (toupper(base) == 'G')) {
+      result = 200;
+      DEBUG_EDIT("Supported by chemistry (reversed)\n");
+    }
+  } else {
+    if ((toupper(before) == 'A') && (toupper(base) == 'G')) {
+      DEBUG_EDIT("Supported by chemistry\n");
+      result = 200;
+    } 
+  }
+
+  return result;
+}
+
+
diff --git a/src/examine/buffer.C b/src/examine/buffer.C
new file mode 100644
index 0000000..dca3426
--- /dev/null
+++ b/src/examine/buffer.C
@@ -0,0 +1,296 @@
+/*
+ * Written by Thomas Pfisterer
+ *
+ * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
+ *   Krebsforschungszentrum, DKFZ Heidelberg) and Thomas Pfisterer
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ *
+ *
+ * SCF examination methods: Buffer for SCF-Files
+ *
+ * Written by Thomas Pfisterer 
+ *
+ * 22.09.99 Using stl for keeping the date; change of storage concept.
+ *          resize is now possible.
+ * 16.12.99 bufferReadCopy implemented.
+ */
+
+
+#include "examine/buffer.H"
+
+
+// 	$Id$	
+
+#ifndef lint
+static char vcid[] = "$Id$";
+#endif /* lint */
+
+
+
+bool  ScfBuffer::isValid   = false;
+int32 ScfBuffer::bufReads  = 0;
+int32 ScfBuffer::fileReads = 0;
+int32 ScfBuffer::scfBufferSize = 25;
+list<SCF_look*> ScfBuffer::scfBufferRead; 
+list<int32> ScfBuffer::readCount;
+
+
+void ScfBuffer::initialize() 
+{
+  scfBufferRead.clear();
+  readCount.clear();
+
+  bufReads  = 0;
+  fileReads = 0; 
+  isValid = true;
+}
+
+
+void ScfBuffer::resize(int32 buffersize)
+{
+  scfBufferSize = buffersize;
+  //  scfBufferRead.resize(scfBufferSize);
+}
+
+
+
+void ScfBuffer::discard() 
+{
+  if (!isValid) return;    // do not discard an uninitialized buffer
+
+  list<SCF_look*>::iterator I = scfBufferRead.begin();
+  while (I != scfBufferRead.end()) {
+    delete *I;
+    I++;
+  }
+
+  scfBufferRead.clear();
+  readCount.clear();
+}
+
+
+
+void ScfBuffer::statistics() {
+  cerr << "\nSCF-Buffer Statistics" << endl;
+  cerr << "---------------------" << endl;
+  cerr << "Buffersize : " << scfBufferSize << endl;
+  cerr << "ListBuffersize : " << scfBufferRead.size() << endl;
+  cerr << "Read Operations: " << (bufReads + fileReads)<<endl;
+  if (bufReads > 0) {
+    cerr << "Buffered : " << 100 * bufReads /
+      (bufReads + fileReads) 
+	 << "%" << endl; 
+  }
+  cerr << endl;
+}
+
+
+
+SCF_look* ScfBuffer::search_insert(const char *fname) 
+{
+  list<SCF_look*>::iterator I = scfBufferRead.begin();
+  list<int32>::iterator C = readCount.begin();
+
+  //cout << "Searching (insert) " << fname << endl;
+
+  while (I != scfBufferRead.end()) {
+    if (0 == strcmp(fname, (*I)->getFileName())) {
+      (*C)++;
+
+      bufReads++;
+      return *I;
+    }
+    I++;
+    C++;
+  }
+  return NULL;
+}
+
+
+
+SCF_look* ScfBuffer::search_delete(const char *fname) 
+{
+  list<SCF_look*>::iterator I = scfBufferRead.begin();
+  list<int32>::iterator C = readCount.begin();
+
+  //cout << "Searching (delete) " << fname << endl;
+  //
+  //if(fname == NULL) {
+  //  cout << *(fname-1) ;
+  //}
+
+  while (I != scfBufferRead.end()) {
+    if (0 == strcmp(fname, (*I)->getFileName())) {
+      (*C)--;  // decrease counter
+
+      if (scfBufferRead.size() > scfBufferSize) {
+	deleteIfUnused(scfBufferSize - scfBufferRead.size());
+      }
+      return *I;
+    }
+    I++;
+    C++;
+  }
+
+  return NULL;  // this should not happen
+}
+
+
+
+bool ScfBuffer::deleteIfUnused(const int32 anzahl)
+{
+  list<SCF_look*>::iterator I = scfBufferRead.begin();
+  list<int32>::iterator C = readCount.begin();
+  int32 count = anzahl;
+
+  while(count>0 && I != scfBufferRead.end()) {
+    if (*C < 1) {
+      //cout << "Remove from buffer " << (*I)->getFileName() << endl;
+
+      delete *I;
+      I = scfBufferRead.erase(I);
+      C = readCount.erase(C);
+      count--;
+    } else {
+      I++;
+      C++;
+    }
+  }
+  //cout << "Objects in use: " << scfBufferRead.size() << endl;
+
+  return (count == 0); 
+}
+
+
+
+SCF_look* ScfBuffer::bufferRead(const Read &aRead, int32 richtung) 
+{
+  FUNCSTART("SCF_bufferRead(const char * fname)");
+
+  if (!isValid) {
+    ScfBuffer::initialize();
+  }
+
+  // BaCh: added hasSCFData(), we know what we're doing, so the const cast is ok
+  if(!const_cast<Read &>(aRead).hasSCFData()) {
+    MIRANOTIFY(Notify::WARNING, "no SCF Data here " << aRead.getName() << "... is this a SCF file?.");
+  }
+
+  // cout << "BufferRead " << aRead.getName() << endl;
+
+  SCF_look *aScfRead = search_insert(aRead.getName().c_str());
+
+  if (aScfRead == NULL) {
+    /* Nichts gefunden, aber Read meint, da gaebe es was. Dann m�ssen wir wohl laden */
+    try {
+      aScfRead = new SCF_look;
+      aScfRead->load(aRead, richtung);
+      scfBufferRead.push_back(aScfRead);
+      readCount.push_back(1);
+
+      fileReads++; // count filereads
+
+      //      cout << "using " << scfBufferRead.size() << " of "
+      //	   << scfBufferSize << " objects " << endl;
+
+      if (scfBufferRead.size() > scfBufferSize) {
+
+	if (!deleteIfUnused(1)) {
+	  cout << "Warning: Buffer overflow (no real problem)" << endl;
+	}
+      }
+    }
+
+    catch(Notify n) {
+      cout << "ScfBuffer: Error loading SCF-File " << aRead.getName() << endl;
+      delete aScfRead;
+      aScfRead = NULL;
+
+      n.handleError(THISFUNC);
+
+      throw Notify(Notify::WARNING, THISFUNC, "");
+    }
+  }
+
+  return aScfRead;
+}
+
+
+
+SCF_look& ScfBuffer::bufferReadCopy(const Read &aRead, int32 richtung)
+{
+  // We read the pointer from the buffer and copy the object to result
+  SCF_look *result = new SCF_look;
+  SCF_look *bufferRead = NULL;
+
+  //Read::setCoutType(Read::AS_TEXTSHORT);
+  //cout << aRead;
+  bufferRead = ScfBuffer::bufferRead(aRead, richtung);
+  
+  if (bufferRead != NULL) {
+     *result = *bufferRead;
+  }
+
+  // We remove the object from the buffer: we have a copy, we do not need
+  // it any more.
+  ScfBuffer::bufferDelete(result);
+
+  return *result;
+}
+
+
+
+void ScfBuffer::bufferDelete(SCF_look *aRead) {
+  list<SCF_look*>::iterator I = scfBufferRead.begin();
+
+  if (!isValid) {
+    cerr << "Deleting read from uninititialize buffer.... ignored" << endl;
+    return;      // do not delete from an uninitialized buffer
+  }
+
+  if (aRead == NULL) return; 
+  
+  //cout << "BufferDelete " << aRead->getFileName() << endl;
+
+  if (search_delete(aRead->getFileName()) == NULL) {
+    //cerr << "Removing SCF-File from buffer that is not in the buffer!"<<endl;
+  }
+  aRead = NULL;
+}
+
+
+
+void ScfBuffer::show()
+{
+  list<SCF_look*>::iterator I = scfBufferRead.begin();
+  list<int32>::iterator C = readCount.begin();
+
+  SCF_look *aRead = NULL;
+
+  cout << "\nBuffer contains: " << endl;
+  while (I != scfBufferRead.end()) { 
+    cout << "\t" << (*I)->getFileName() 
+	 << "\t" << *C  //<< "\t" << hex << &(*C) << dec 
+	 << endl;
+
+    I++;
+    C++;
+  }
+}
+
diff --git a/src/examine/buffer.H b/src/examine/buffer.H
new file mode 100644
index 0000000..6f8a109
--- /dev/null
+++ b/src/examine/buffer.H
@@ -0,0 +1,84 @@
+/*
+ * Written by Thomas Pfisterer
+ *
+ * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
+ *   Krebsforschungszentrum, DKFZ Heidelberg) and Thomas Pfisterer
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ *
+ * 
+ * Buffer for SCF_look objects
+ *
+ * Written by Thomas Pfisterer 
+ *
+ * 16.12.99 bufferReadCopy: returns a copy of the object in the buffer.
+ * 22.09.99 Using stl to store the data; change of storage concept.
+ *
+ *
+ * bufferRead:    ==> pointer to SCF_look object
+ *                    to each call of bufferRead you have to call:
+ * bufferDelete   ==> release the object, buffer can remove it.
+ *
+ * bufferReadCopy ==> copy of the object. You have to delete the object
+ *                    for memory deallocation.
+ */
+
+
+#ifndef _buffer_buffer_H_
+#define _buffer_buffer_H_
+
+
+#include "examine/scf_look.H"
+
+// 	$Id$	
+
+class SCF_look;
+
+
+class ScfBuffer {
+private:
+  static list<SCF_look*> scfBufferRead;
+  static list<int32>    readCount;
+  static int32    scfBufferSize;
+  static int32    bufReads, fileReads;
+  static bool     isValid;
+
+  static SCF_look *search_insert(const char * fName);
+  static SCF_look *search_delete(const char * fName);
+  static bool deleteIfUnused(const int32 anzahl);
+public:
+  ScfBuffer();
+  ~ScfBuffer();
+
+  static void initialize();
+  static void resize(int32 buffersize);
+  static void discard();
+  static SCF_look *bufferRead(const Read & aRead, int32 richtung);
+  static SCF_look &bufferReadCopy(const Read & aRead, int32 richtung);  
+  static void  bufferDelete(SCF_look *aRead);
+  static void  statistics(); 
+
+  static void show();
+};
+
+
+
+
+
+#endif
+
diff --git a/src/examine/calc.C b/src/examine/calc.C
new file mode 100644
index 0000000..bbbe723
--- /dev/null
+++ b/src/examine/calc.C
@@ -0,0 +1,754 @@
+/*
+ * Written by Thomas Pfisterer
+ *
+ * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
+ *   Krebsforschungszentrum, DKFZ Heidelberg) and Thomas Pfisterer
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ *
+ * 
+ */
+
+
+#include "examine/scf_look.H"
+#include "examine/globals.H"
+
+extern "C" {
+  int add(float *in, float *out, int init);
+  int missing(float *in, float *out, int init);
+  int nplus(float *in, float *out, int init);
+  int over(float *in, float *out, int init);
+  int under(float *in, float *out, int init);
+  int wrong(float *in, float *out, int init);
+  int ncall(float *in, float *out, int init);
+	   }
+
+// 	$Id$	
+
+
+#ifndef lint
+static char vcid[] = "$Id$";
+#endif /* lint */
+
+
+float evaluate(int32 scfPos, int32 dbPos, int32 faultClass, 
+	       char newBase, SCF_look *aScfLook)
+{
+  ofstream devNull;
+ 
+  devNull.open("/dev/null", ios::out);
+
+  return evaluate(scfPos, dbPos, faultClass, newBase, aScfLook, devNull);
+}
+
+
+
+
+float evaluate(int32 scfPos, int32 dbPos, int32 faultClass, 
+	       char newBase, SCF_look *aScfLook, ostream &output)
+{
+  float in_parameter[25];
+  float out_parameter[1];
+  int32 parameter_anz;
+  int32 nnFaultClass;
+  char  oldDBBase;
+  bool  ko;
+
+
+  if (!aScfLook->testDBPos(dbPos)) {
+      // BACh: added the SILENT throw: if no filename, no point in warning
+      //  (shouldn't this not be called anyway?)
+      if(aScfLook->getFileName() != NULL && strlen(aScfLook->getFileName())) {
+	throw Notify(Notify::WARNING,
+		     "evaluate: DB-Baseposition exceeds limit. Please check file: ",
+		     aScfLook->getFileName());
+      } else {
+	throw Notify(Notify::SILENT, "");
+      }
+  }
+
+  if (faultClass == fhc_SYNTACTIC) {
+    if (newBase == '*') oldDBBase = '.';
+    if (newBase == '.') oldDBBase = '*';
+
+    output << "Evaluate " << aScfLook->getFileName() << " at: " << dbPos;     
+    aScfLook->showDBArea(dbPos, 6, output); 
+    return 1.0;
+
+  } else {
+    if (faultClass == fhc_UNDERCALL || faultClass == fhc_MISSING) {
+      oldDBBase = '*';
+    } else {
+      oldDBBase = aScfLook->getDBBase(dbPos);
+    }
+  }
+
+
+  output << "\nEvaluate " << aScfLook->getFileName() << " at: " << dbPos; 
+  output << " (" << scfPos << ")  " << oldDBBase 
+	 << " => " << newBase << "  faultClass " << faultClass << endl;
+
+  if (dbPos < 0) {
+    output << "DBPos < 0 found - abort examination" << endl;
+    return 0.0;
+  }
+
+  if (dbPos >= aScfLook->getDBBases()) {
+    output << "DBPos > readLen - abort examination" << endl;
+    return 0.0;
+  }
+
+
+  /*
+  if (scfPos < 0) {    
+    oldDBBase = '*';
+  } else {
+    //    oldDBBase  = aScfLook->getOriginalSCFBase(scfPos);
+    oldDBBase = aScfLook->getDBBase(dbPos);
+  }
+  */
+
+
+
+  if (scfPos > (int32)aScfLook->getNumBases()) {
+    output << "Error in SCF-Position " << scfPos << " > " 
+	   << aScfLook->getNumBases() << endl;
+    return 0.0;
+  }
+
+  nnFaultClass = faultClassToNNClass(faultClass, oldDBBase);
+
+  if (nnFaultClass != UNDEFINED_INDEX) {
+    try {
+      parameter_anz = calculateParameters(scfPos, dbPos, nnFaultClass, 
+					  newBase, in_parameter, 
+					  aScfLook, output, ko);
+     
+      for (int32 loop = 0; loop < parameter_anz; loop++) {
+	output << in_parameter[loop] << "  ";
+      }
+      output << endl;
+    }
+
+    catch(Notify n) {
+      output << "Problems while calculating parameters.....\n" << endl;
+      output << "Abort and reject evaluating. \n" << endl;
+      return 0.0;
+    }
+ 
+    switch (nnFaultClass) {
+    case WRONGCALL_INDEX:  
+      wrong(in_parameter, out_parameter, 0); 
+      break; 
+    case UNDERCALL_INDEX:  
+      under(in_parameter, out_parameter, 0); 
+      break;
+    case MISSING_INDEX:    
+      missing(in_parameter, out_parameter, 0); 
+      break;
+    case OVERCALL_INDEX:  
+      over(in_parameter, out_parameter, 0);      
+      break;
+    case N_PLUS_INDEX:  
+      nplus(in_parameter, out_parameter, 0); 
+      break;
+    case ADDITIONAL_INDEX:  
+      add(in_parameter, out_parameter, 0); 
+      break;
+    case N_CALL_INDEX: 
+      ncall(in_parameter, out_parameter, 0);
+      break; 
+    default: return 0.0;
+    } 
+
+    output << "Result: " << out_parameter[0] << endl;
+
+    if (ko) {
+      output << "Apply k.o. rule" << endl;
+      out_parameter[0] = 0;
+    }
+ 
+    return out_parameter[0];
+  } 
+  return 1.0;
+}
+
+
+
+// Achtung!!!
+// faultClass ist hier nicht die fhc klasse, sondern die hier
+// verwendete Fehlerklasse!!
+int32 calculateParameters(int32 scfPos, int32 dbPos, int32 faultClass, 
+			char newBase, float *inParameter, 
+			SCF_look *aScfLook, ostream &output, bool &ko)
+{
+ int32 areaMin, areaMax;
+ int16 anzPeaks, anzRepeat, qual;
+ int32 regCount;
+ char  oldDBBase, oldSCFBase;
+ int32 parameter_used = 0;
+ int32 pos[4];
+
+ int32 calcCode = 0;
+ float meanVic_meanRep = 1.0;
+ 
+ ko = false;
+
+ // if (scfPos<0|| faultClass==UNDERCALL_INDEX || faultClass==MISSING_INDEX) {
+ //  oldDBBase = GAP_BASE;
+ //} else {
+ oldDBBase  = toupper(aScfLook->getDBBase(dbPos));
+ //}
+ oldSCFBase = toupper(toSCFBase(oldDBBase, aScfLook->isReversed()));
+
+
+ 
+ if (newBase == oldDBBase && faultClass == WRONGCALL_INDEX) {
+   output << "Edited back to old Base!!!!" << endl;
+   //return 0;
+ }
+ 
+ 
+ output << "\nOldBase was : " << oldDBBase << " (DB) " << oldSCFBase 
+	<< " (SCF)   newBase: " << newBase 
+	<< "  nnfaultClass " << faultClass 
+	<< "  scfPos: " << scfPos 
+        << "  dbPos: " << dbPos << endl;
+
+ aScfLook->showDBArea(dbPos, 7, output); 
+ output << endl;
+
+
+ switch (faultClass) {
+ case WRONGCALL_INDEX:  
+   calcCode = WRONGCALL_OPT;
+   break;
+ case N_CALL_INDEX:
+   calcCode = N_CALL_OPT;
+   break;
+ case UNDERCALL_INDEX:  
+   calcCode = UNDERCALL_OPT;
+   break;
+ case MISSING_INDEX:    
+   calcCode = MISSING_OPT;
+   break;
+ case OVERCALL_INDEX:  
+   calcCode = OVERCALL_OPT;
+   break;
+ case N_PLUS_INDEX:  
+   calcCode = N_PLUS_OPT;
+   break;
+ case ADDITIONAL_INDEX: 
+   calcCode = ADDITIONAL_OPT; 
+   break;
+ default: return 0;
+ } 
+
+
+ {
+   int32 max[4];
+   aScfLook->findMaxDB(dbPos, max);
+   indirectSort4(max, pos);
+ }
+
+
+ if (DISTANCE_CODE & calcCode) {
+
+   // --------------------------------------------------------------------
+   // Calculates the following four parameters:
+   // meanVic/meanRep:    distance in ROI relative to distances in vicinity
+   // minRep/100:         smallest distance in ROI in relation to the mean
+   //                     distance in the vicinity
+   // maxRep/100:         same for maximum distance
+   // repBases:           number of identical bases in the ROI
+   //
+   // Parameters:
+   // the position of the ROI in the database
+   // ---------------------------------------------------------------------
+
+   output << "calculate distance parameter" << endl;
+
+
+   SCF_distance *pd=NULL;
+
+
+   try {
+     pd = aScfLook->calcDBDistance(dbPos);
+
+     // BaCh: changed abs() to fabs() (seems what Thoams intended)
+     if (fabs(pd->getRelativeProblemDistance()) < 0.01) {
+       meanVic_meanRep = 1.0;
+     } else {
+       meanVic_meanRep = 1.0 / pd->getRelativeProblemDistance();
+     }
+
+     if (REL_DIST_PAR & calcCode) {
+       inParameter[parameter_used++] = meanVic_meanRep;
+     }
+     
+
+     if (REL_MIN_PAR & calcCode) 
+       inParameter[parameter_used++] = pd->getRelativeMinDistance();
+     if (REL_MAX_PAR & calcCode) 
+       inParameter[parameter_used++] = pd->getRelativeMaxDistance();
+
+     if (BASECOUNT_PAR & calcCode) 
+       inParameter[parameter_used++] = 1.0 / pd->getProblemBases();
+
+     if (MIN_DIST_PAR & calcCode)
+       inParameter[parameter_used++] = pd->getMinDistanceScore();
+     if (MAX_DIST_PAR & calcCode)
+       inParameter[parameter_used++] = pd->getMaxDistanceScore();
+     if (MEAN_DIST_PAR & calcCode) 
+       inParameter[parameter_used++] = pd->getDistanceScore();
+
+   }
+   catch(Notify n) {
+     output << "FEHLER: calcDBDistance " << dbPos << endl;
+ 
+     if (REL_DIST_PAR & calcCode) 
+       inParameter[parameter_used++] = 0;
+     if (REL_MIN_PAR & calcCode) 
+       inParameter[parameter_used++] = 0;
+     if (REL_MAX_PAR & calcCode) 
+       inParameter[parameter_used++] = 0;
+
+     if (BASECOUNT_PAR & calcCode) 
+       inParameter[parameter_used++] = 0;
+
+     if (MIN_DIST_PAR & calcCode)
+       inParameter[parameter_used++] = 0;
+     if (MAX_DIST_PAR & calcCode)
+       inParameter[parameter_used++] = 0;
+     if (MEAN_DIST_PAR & calcCode) 
+       inParameter[parameter_used++] = 0;
+   }
+   
+   if(pd!=NULL) delete pd;
+  
+ }
+
+ 
+
+ if (PEAKS_OLD_CODE & calcCode) {
+
+   assert(isRealBase(oldDBBase));
+
+   output << "calculate peaks_old " << oldDBBase << endl;     
+   aScfLook->countRepeatPeaks(dbPos, oldDBBase, anzRepeat, anzPeaks, qual);
+
+   output << "Peaks : " << anzPeaks << "  Repeat: " << anzRepeat << endl;
+
+   if (QUAL_OLD_PAR & calcCode)
+     inParameter[parameter_used++] = float(qual) / 100;
+   if (PEAKS_OLD_PAR & calcCode)
+     inParameter[parameter_used++] = anzRepeat - anzPeaks;
+
+   
+   if (faultClass == OVERCALL_INDEX) {
+     if (anzRepeat >= anzPeaks && meanVic_meanRep < 1.12) { 
+       output << "KO-Rule: anzRepeat == anzPeaks && meanVic_meanRep < 1.05\n";
+       output << "meanVic_meanRep = " << meanVic_meanRep << endl;
+
+       ko = true;
+     }
+   }
+   if (faultClass == ADDITIONAL_INDEX) {
+     if (anzPeaks == 0 && meanVic_meanRep < 1.2) {
+       output << "KO-Rule: anzPeaks=0 && meanVic_meanRep < 1.10" << endl;
+       ko = true;
+     }
+   }
+ }
+
+
+
+ if (PEAKS_NEW_CODE & calcCode) {
+   assert(isRealBase(newBase));
+
+   output << "calculate peaks for new " << newBase << endl;     
+   aScfLook->countRepeatPeaks(dbPos, newBase, anzRepeat, anzPeaks, qual);
+
+   output << "Peaks : " << anzPeaks << "  Repeat: " << anzRepeat << endl;
+
+   if (QUAL_NEW_PAR & calcCode) 
+     inParameter[parameter_used++] = float(qual)/100;
+   if (PEAKS_NEW_PAR & calcCode)
+     inParameter[parameter_used++] = anzRepeat - anzPeaks;
+
+
+   if (faultClass == UNDERCALL_INDEX) {
+     if (anzRepeat >= anzPeaks && meanVic_meanRep > .80) { 
+       output << "KO-Rule: anzRepeat == anzPeaks && meanVic_meanRep > 0.95\n";
+       output << "meanVic_meanRep = " << meanVic_meanRep << endl;
+
+       ko = true;
+     }
+   }
+   if (faultClass == MISSING_INDEX) {
+     if ((anzPeaks <= 0 && meanVic_meanRep > 0.75) || meanVic_meanRep > 0.90) {
+       output << "KO-Rule: anzPeaks=0 && meanVic_meanRep> 0.67" << endl;
+       ko = true;
+     }
+   }
+ }
+
+
+ if (CONV_OLD_CODE & calcCode) {
+   // regCount        number of convergence regions (f"<0) - number of Bases
+   // areaMin         Area under the smallest convergence region.
+   // areaMax         Area under the largest convergence region.
+   // These parameters make only sense in case of repeats (undercall or
+   // overcall). 
+
+   output << "Calculate conv.regions for original base " << oldDBBase << endl;
+
+   regCount = aScfLook->countConvergenceRegions(dbPos, oldDBBase, 
+						areaMin, areaMax);
+
+   if (CONV_OLD_PAR & calcCode) {
+     if (regCount != -1) {
+       inParameter[parameter_used++] = 1/float(regCount+1);   
+     } else {
+       inParameter[parameter_used++] = 1;   
+     }
+   }
+   
+   if (AREA_OLD_PAR & calcCode) {
+     if (areaMax < 0.01) { 
+       inParameter[parameter_used++] = 0.50;
+     } else {
+       inParameter[parameter_used++] = float(areaMin) / float(areaMax);
+     }
+   }
+ }
+
+
+ if (CONV_NEW_CODE & calcCode) {
+   int32 regCount;
+
+   output << "Calculate conv.regions for new base " << newBase << endl;
+
+   regCount = aScfLook->countConvergenceRegions(dbPos, newBase, 
+						areaMin, areaMax);
+
+   if (CONV_NEW_PAR & calcCode) {
+     if (regCount != -1) {
+       inParameter[parameter_used++] = 1/float(regCount+1);   
+     } else {
+       inParameter[parameter_used++] = 1;   
+     }
+   }
+   
+   if (AREA_NEW_PAR & calcCode) {
+     if (areaMax < 0.01) { 
+       inParameter[parameter_used++] = 0.50;
+     } else {
+       inParameter[parameter_used++] = float(areaMin) / float(areaMax);
+     }
+   }
+ }
+
+
+ if (POSRAT_NEW_CODE & calcCode) {
+   float new_pos_rating = 0;
+   float hoehenkrit = 0;
+   int32 max;
+
+
+   if (oldDBBase == '*' || oldDBBase == '.') {
+     output << "calculate posrating new (1) " << endl;
+
+     hoehenkrit = aScfLook->einzelpeak(-dbPos, newBase, max, new_pos_rating);
+   } else {
+     output << "calculate posrating new (2) " << endl;
+     hoehenkrit = aScfLook->einzelpeak(dbPos, newBase, max, new_pos_rating);
+   }
+
+   if (POS_NEW_PAR & calcCode) 
+     inParameter[parameter_used++] = new_pos_rating;
+   if (SHAPE_NEW_PAR & calcCode) 
+     inParameter[parameter_used++] = hoehenkrit;
+
+ }
+
+
+
+ if (POSRAT_OLD_CODE & calcCode) {
+   float old_pos_rating = 0;
+   float hoehenkrit = 0;
+   int32 max;
+   
+
+   if (newBase == '*' || newBase == '.') {
+     output << "calculate posrating old (1)" << oldDBBase << endl;
+     hoehenkrit = aScfLook->einzelpeak(-dbPos, oldDBBase, max,old_pos_rating);
+   } else {
+     output << "calculate posrating old (2)" << endl;
+     hoehenkrit = aScfLook->einzelpeak(dbPos, oldDBBase, max,old_pos_rating);
+   }
+
+   if (POS_OLD_PAR & calcCode)
+     inParameter[parameter_used++] = old_pos_rating;
+   if (SHAPE_OLD_PAR & calcCode)
+     inParameter[parameter_used++] = hoehenkrit;
+
+ }
+
+
+ if (PEAK1_REL_CODE & calcCode) {
+   float newRatio, oldRatio, oldNewRatio;
+
+   output << "calculate single peak relations" << endl;
+
+   assert(isRealBase(newBase));
+
+   aScfLook->peakRelations(dbPos, newBase, newBase,
+			   newRatio, oldRatio, oldNewRatio);
+
+   inParameter[parameter_used++] = newRatio;
+ }
+
+
+
+ if (PEAK_REL_CODE & calcCode) {
+   float newRatio, oldRatio, oldNewRatio;
+
+   output << "calculate peak relations" << endl;
+
+   assert(isRealBase(newBase));
+
+   aScfLook->peakRelations(dbPos, newBase, oldDBBase,
+			   newRatio, oldRatio, oldNewRatio);
+
+   if (INT_NEW_PAR & calcCode) 
+     inParameter[parameter_used++] = newRatio;
+   if (INT_OLD_PAR & calcCode) 
+     inParameter[parameter_used++] = oldRatio;
+   if (INT_OLDNEW_PAR & calcCode) 
+     inParameter[parameter_used++] = oldNewRatio;
+
+   if (faultClass == WRONGCALL_INDEX || faultClass == N_CALL_INDEX){
+     if (isRealBase(oldDBBase)) {
+       if (newRatio < 0.12) {
+	 output << "KO-Rule: newRatio < 0,12 " << newRatio << endl;
+	 ko=true;
+       }
+       if (oldNewRatio < 0.12) {
+	 output << "KO-rule: oldNewRatio < 0,12 " << oldNewRatio << endl;
+	 ko =true;
+       }
+       if (newRatio + oldNewRatio < 0.35) {
+	 output << "KO-rule: newRatio + oldNewRatio < 0,35" << endl;
+	 output << "newRatio:"<<newRatio<<" oldNewRatio:"<<oldNewRatio<<endl;
+	 ko = true;
+       }
+     } else {
+       if ((newRatio < 0.10) && (oldNewRatio < 0.50)) {
+	 output << "KO-rule: newRatio < 0.10 && oldNewRatio < 0.50 " << endl;
+	 output << "newRatio: " << newRatio 
+		<< " oldNewRatio: " << oldNewRatio << endl;
+	 ko = true;  
+       }
+     }
+   }
+ }
+
+ 
+ if (PEAK_VALLEY_CODE & calcCode) {
+   float result[4][6];
+   int32 oldPos = 0;
+   int32 newPos = 1;
+
+   output << "calculate peak-valley" << endl;
+ 
+   if (isRealBase(oldDBBase)) {
+     DEBUG_EDIT("Normal Case " << oldDBBase << " - " << newBase << endl);
+     aScfLook->peakValleyValues(dbPos, newBase, result[oldPos]);
+     aScfLook->peakValleyValues(dbPos, oldDBBase, result[newPos]);
+   } else {
+     if (newBase == GAP_BASE) {
+       DEBUG_EDIT("N-Case (nplus) " << endl);
+
+       aScfLook->peakValleyValues(dbPos, "ACGT"[pos[0]], result[oldPos]);
+       aScfLook->peakValleyValues(dbPos, "ACGT"[pos[1]], result[newPos]);
+       
+     } else {
+       DEBUG_EDIT("N-Case (alter) " << endl);
+       float x;
+       float max = 0;
+
+       
+       for (int32 i=0; i<4; i++) {
+	 x = aScfLook->peakValleyValues(dbPos, "ACGT"[i], result[i]);
+
+	 if ("ACGT"[i] == newBase) {
+	   oldPos = i;
+	 } else {
+	   if (x > max) {
+	     max = x; 
+	     newPos = i;
+	   }
+	 }
+       }
+     }
+   }
+
+   for (int32 i=0; i<6; i++) { 
+     inParameter[parameter_used++] = result[oldPos][i];
+   }   
+ }
+
+
+ if (COR_OLD_CODE & calcCode) {
+   double sigma = 5.0;
+   double old_value;
+
+   output << "calculate correlation old base" << endl;
+   
+   if (!isBase(oldDBBase)) {
+     output << "WARNING: expected a base !! " << endl;
+     inParameter[parameter_used++] = 0.0;
+     ko = true;
+   } else {
+     old_value = aScfLook->singlePeakQuality(dbPos, sigma, oldDBBase);
+     inParameter[parameter_used++] = old_value;
+   }
+ }
+
+
+ if (COR_NEW_CODE & calcCode) {
+   double sigma = 5.0;
+   double new_value;
+
+   output << "calculate correlation new base" << endl;
+   assert(isBase(newBase)); 
+   new_value = aScfLook->singlePeakQuality(dbPos, sigma, newBase);
+   inParameter[parameter_used++] = new_value;   
+
+   output << "New Base " << newBase << "\tvalue: " << new_value << endl;
+ }
+
+ /*
+ if (calculateThis(CALC_TRIPLETT_RANKING, faultClass)) {
+    prescan  aPrescan;
+    int32    index;
+    int32    ranking;
+
+    output << "calculate triplett ranking" << endl;
+    index = baseToIndex3(aScfLook->getOriginalSCFBase(scfPos-2),
+			 aScfLook->getOriginalSCFBase(scfPos-1),
+			 aScfLook->getOriginalSCFBase(scfPos));
+
+    ranking = aPrescan.getRanking(index);  
+
+    output << aScfLook->getOriginalSCFBase(scfPos-2) 
+	   << aScfLook->getOriginalSCFBase(scfPos-1)
+	   << aScfLook->getOriginalSCFBase(scfPos) 
+	   << "  index:  "  << index 
+	   << "  ranking: " << ranking << endl;
+
+    inParameter[parameter_used++] = (float)ranking / 64.0;
+ }
+ */
+
+
+ if (MACHINETYPE_CODE & calcCode) {
+   int32 m = (int32)aScfLook->getMACHType();
+
+   inParameter[parameter_used++] = (m == 1);
+   inParameter[parameter_used++] = (m == 2);
+   inParameter[parameter_used++] = (m == 3);
+   
+ }
+
+ return parameter_used;
+ 
+}
+
+
+
+
+bool calculateThis(int32 calculation, int32 faultClass)
+{
+  int32 calculate[INDEX_COUNT]; 
+  
+  calculate[WRONGCALL_INDEX ] = 
+    CALC_POSRATING_OLD 
+    | CALC_POSRATING_NEW  
+    | CALC_PEAKRELATION  
+    //| CALC_PEAK_VALLEY 
+    //| MARK_UNDEFINED_BASE
+    //| CALC_TRIPLETT_RANKING
+    | CALC_CORRELATION_OLD
+    | CALC_CORRELATION_NEW
+    ;
+
+  calculate[N_CALL_INDEX ] = 
+    CALC_POSRATING_OLD 
+    | CALC_POSRATING_NEW  
+    | CALC_PEAKRELATION  
+    //| CALC_PEAK_VALLEY 
+    //| MARK_UNDEFINED_BASE
+    //| CALC_TRIPLETT_RANKING
+    | CALC_CORRELATION_OLD
+    | CALC_CORRELATION_NEW
+    ;
+  calculate[ADDITIONAL_INDEX] = 
+    CALC_DISTANCE 
+    | CALC_PEAKS_OLD 
+    | CALC_CONV_OLD
+    | CALC_POSRATING_OLD
+    // | CALC_PEAK_VALLEY
+    // | CALC_POSRATING_NEW
+    ;
+
+  calculate[OVERCALL_INDEX  ] = 
+    CALC_DISTANCE  
+    | CALC_PEAKS_OLD 
+    | CALC_CONV_OLD
+    | CALC_POSRATING_OLD
+    ;
+
+  calculate[N_PLUS_INDEX    ] = 
+    CALC_DISTANCE 
+    //| CALC_PEAKRELATION 
+    //| CALC_PEAK_VALLEY
+    //| CALC_CONV_OLD
+    ;
+
+  calculate[UNDERCALL_INDEX ] = 
+    CALC_DISTANCE 
+    | CALC_PEAKS_NEW 
+    | CALC_CONV_NEW
+    | CALC_POSRATING_NEW
+    ;
+
+  calculate[MISSING_INDEX   ] = 
+    CALC_DISTANCE 
+    | CALC_PEAKS_NEW 
+    | CALC_CONV_NEW
+    | CALC_POSRATING_NEW
+    ;
+  
+
+  return (calculate[faultClass] & calculation);
+}
+
+
+
diff --git a/src/examine/cfh.C b/src/examine/cfh.C
new file mode 100644
index 0000000..06cb99a
--- /dev/null
+++ b/src/examine/cfh.C
@@ -0,0 +1,420 @@
+/*
+ * Written by Thomas Pfisterer
+ *
+ * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
+ *   Krebsforschungszentrum, DKFZ Heidelberg) and Thomas Pfisterer
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ *
+ * 
+ *
+ * SCF examination methods
+ *
+ * Written by Thomas Pfisterer 
+ *
+ *
+ */
+
+
+// 	$Id$	
+
+#ifndef lint
+static char vcid[] = "$Id$";
+#endif /* lint */
+
+
+#include "examine/scf_look.H"
+
+
+/* --------------------- */
+/*       cfh_Info        */
+/* --------------------- */
+
+void cfh_Info::foolCompiler(void) 
+{
+#include "stdinc/foolcompiler.C"
+}
+
+
+
+cfh_Info::cfh_Info() 
+{
+  first = NULL;
+  last  = NULL;
+
+  rejected_faults = 0;
+  rejected_n = 0;
+  confirmed_positive = 0;
+  confirmed_reverse = 0;
+  positive = 0;
+  reversed = 0;
+}
+
+
+cfh_Info::cfh_Info(afh_Info *a) 
+{
+  first = a;
+  last  = a;
+
+  rejected_faults = 0;
+  rejected_n = 0;
+  confirmed_positive = 0;
+  confirmed_reverse = 0;
+  positive = 0;
+  reversed = 0;
+}
+
+
+cfh_Info::~cfh_Info()
+{
+  deleteAllBuffered();
+}
+
+
+
+void cfh_Info::appendAfh(afh_Info *a) 
+{
+  if (last == NULL) {
+    first = a;
+    last  = a;
+  } else {
+    last->appendAfh(a);
+    last = a; 
+  }
+}
+
+
+void cfh_Info::deleteAllBuffered() 
+{
+  afh_Info *weg;
+
+  while (first != NULL) {
+    weg = first;
+    first = first->nextAfh();
+
+    delete weg;    
+  }
+
+  first = NULL;
+  last  = NULL;
+}
+
+
+
+void cfh_Info::countInformation() 
+{
+  afh_Info *loop = first;
+
+  confirmed_reverse = 0;
+  confirmed_positive = 0;
+  reversed = 0;
+  positive = 0;
+  rejected_faults = 0;
+  rejected_n = 0;
+
+  while (loop != NULL) {
+    // DEBUG_EDIT("Status: " << loop->getStatus()) ;
+    // DEBUG_EDIT(" Direction: " << loop->isReversed() << " " << endl);
+
+    if (loop->isSupportingHypotheses()){
+      if (loop->getStatus() == fhs_CONFIRMED) {
+	if (loop->isReversed()) {
+	  confirmed_reverse++;
+	} else {
+	  confirmed_positive++;
+	}
+      }
+      if (loop->isReversed()) {
+	reversed++;
+      } else {
+	positive++;
+      }
+    } else {
+	// good, fault-hypotheses
+	if (loop->getStatus() != fhs_CONFIRMED) {
+	  if (false == loop->isNToBaseHypotheses()) {
+	    rejected_faults++;
+	  } else {
+	    //rejected_faults++;
+	    rejected_n++;
+	  }
+	} else {
+	  if (loop->isReversed()) {
+	    confirmed_reverse++;
+	  } else {
+	    confirmed_positive++;
+	  }  
+	}
+    }
+    loop = loop->nextAfh();  
+  }
+}
+
+
+
+bool cfh_Info::needsInformationOfType(
+               const int16 question, const int16 direction) 
+{
+  countInformation();
+#ifdef HYPOTHESES_VERBOSE
+  cout << *this;
+#endif
+
+  // Cannot become true;
+
+  if (rejected_faults != 0) return false;
+
+  if (question == fhc_GAP || question == fhc_CORRECT) {
+    // Supporting Hypotheses....
+    if (confirmed_positive > 0 && confirmed_reverse > 0) { 
+      return false;  
+    }
+    if (confirmed_positive > 0) return (direction < 0);
+    if (confirmed_reverse  > 0) return (direction > 0);
+    return true;
+  } else {
+    // Fault hypotheses: always
+    return true;
+  }
+}
+
+
+
+// ****************************************************
+// examineCfhPartial:
+// examines if a hypotheses is confirmed and if
+// the hypotheses can become true. Returns false
+// if there is no possibiliy to confirm the Cfh.
+// ****************************************************
+
+bool cfh_Info::examineCfhPartial(bool &isConfirmed) 
+{
+  countInformation();
+
+#ifdef HYPOTHESES_VERBOSE
+  cout << *this;
+#endif
+
+
+  //  isConfirmed = (rejected_faults == 0 && confirmed_positive > 0 && 
+  //		 confirmed_reverse > 0);
+  isConfirmed = rejected_faults == 0;
+  
+  return (rejected_faults == 0);
+
+}
+
+
+
+ostream & operator<<(ostream &ostr, cfh_Info const &i) 
+{
+  ostr << "===== cfh_info ===== " << endl;
+  ostr << "rejected_faults   : " << i.rejected_faults;
+  ostr << "   rejected_n   " << i.rejected_n;
+  ostr << "   conf+   " << i.confirmed_positive 
+       << "  (" << i.positive << ")";
+  ostr << "   conf- : " << i.confirmed_reverse  
+       << "  (" << i.reversed << ")";
+  ostr << "\tScore: " << i.rel_score << endl;
+
+  if (i.first != NULL) {
+    ostr << *(i.first);
+  } 
+
+  ostr << "==================== " << endl;
+  return ostr; 
+}
+
+
+
+// Evaluate the afh's and confirm if they are above the given threshold
+// if complete == false evaluate until a hypotheses is rejected
+// otherwise evaluate all of them.
+ 
+bool cfh_Info::eval(const bool complete, const bool verbose,
+		    const float threshold, bool strict_N)
+{
+
+  afh_Info* l = first;
+  bool  result = true;
+  float f;
+  float score = 0;
+  int32 count = 0;
+
+
+#ifndef RUNONLY
+  if (verbose==true) {
+    cout << "Evaluate: " << endl;
+    cout << *this << endl;
+  }
+#endif
+
+  while (l != NULL && (complete || result)) {
+    if (loadAfhTraces(l)) {
+
+      f = l->eval(verbose);
+
+      if (f > threshold) {
+	l->confirm();
+
+	if (l->getFaultClass() != fhc_SYNTACTIC) {
+	  score = score + 1.0;
+	  count++;
+	}
+      } else {
+	if (l->isNPlusHypotheses() && strict_N == false) {
+          l->confirm();
+        }
+
+	if (l->isNToBaseHypotheses() == false || strict_N == true) {
+          score = score + f;
+          count++;
+          result = false;
+        }
+      }
+    } else {
+      result = false;
+      l->reject();
+    }
+    l = l->nextAfh();
+  }
+
+  
+  if (l == NULL && count > 0) {
+    rel_score = score / count;
+  } else {
+    rel_score = -1.0;
+  }
+
+  return result;
+}
+
+
+//
+// confirm only a single class of hypothesis
+// above a given threshold.
+
+bool cfh_Info::singleEval(const float threshold, int32 fhc_class)
+{
+  afh_Info* l = first;
+  bool hasSinglePositive = false;
+  float f;
+
+  while (l != NULL) {
+    f = l->eval(false);
+    if (l->getQuestion() == fhc_class && f > threshold) {
+      l->confirm();
+      hasSinglePositive = true;
+    } else {
+      l->reject();
+    }
+    l = l->nextAfh();
+  }
+
+  return hasSinglePositive;
+}
+
+
+//
+// confirm only a single class of hypothesis
+// above a given threshold.
+
+bool cfh_Info::evalExtendedAlterOperations(const float threshold)
+{
+  afh_Info* l = first;
+  bool hasSinglePositive = false;
+  float f;
+
+  while (l != NULL) {
+    f = l->eval(false);
+    
+    if (l->getIsExtendedAlterOperation() && f > threshold) {
+      l->confirm();
+      hasSinglePositive = true;
+    } else {
+      l->reject();
+    }
+    l = l->nextAfh();
+  }
+
+  return hasSinglePositive;
+}
+
+
+bool cfh_Info::confirmQuality(const int32 threshold)
+{
+  afh_Info* l = first;
+  
+  while (l != NULL) {
+    if (l->getOriginalBaseQuality() != 0 && 
+        l->getOriginalBaseQuality() < threshold) {
+      l->confirm(1.0);
+    }
+    l = l->nextAfh();
+  }
+
+  return true;
+}
+
+
+//   If more of the afh in a cfh edit the same base, there is a problem: 
+//   edit operations should be performed on the SCF_look before the next 
+//   operation is examined - but we would like to avoid to copy the object
+//   if not absolutely necessary.
+//   Thus we test for an afh if another operation affected the same read.
+//  
+// 
+
+
+bool cfh_Info::loadAfhTraces(afh_Info *a)
+{
+  afh_Info* lastEdit = readEditedBefore(a);
+
+  if (lastEdit == NULL) {
+    // cout << "New Trace" << endl;
+    return a->loadRead();
+  } else {
+    // cout << "Copy Trace" << endl;
+    a->performEditOnRead(*lastEdit);
+  }
+
+  return true;
+}
+
+
+
+afh_Info* cfh_Info::readEditedBefore(afh_Info *a)
+{
+  afh_Info *l = first;
+  afh_Info *found = NULL;
+
+
+  while (l != a) {
+    if (l->compareWith(*a))  {
+      found = l;
+    }
+    l = l->nextAfh();
+  }
+  
+  return found;
+
+}
+
+
+
+
diff --git a/src/examine/globals.H b/src/examine/globals.H
new file mode 100644
index 0000000..b7d0f28
--- /dev/null
+++ b/src/examine/globals.H
@@ -0,0 +1,239 @@
+/*
+ * Written by Thomas Pfisterer
+ *
+ * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
+ *   Krebsforschungszentrum, DKFZ Heidelberg) and Thomas Pfisterer
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ *
+ * 
+ *
+ * Global definitions for the status of a hypotheses and for the 
+ * possible fault-hypothesis classes
+ *
+ * Written by Thomas Pfisterer
+ */
+
+#ifndef __EDIT_GLOBALS__
+#define __EDIT_GLOBALS__
+
+#define TEST
+//#define RUN_ONLY
+
+//#define DEBUG_EDIT(blah) { cout << blah; }
+#define DEBUG_EDIT(blah) {}
+//#define VERBOSE
+
+//#define RANGECHECK_ON
+//#define DEBUG_MODE
+//#define PARAMETER_VERBOSE
+//#define HYPOTHESES_VERBOSE
+//#define FAULT_HYPOTHESES_VERBOSE
+
+
+#define LIGHTHEADED
+
+#define UNDEFINED_BASE '-'
+#define NO_BASE        '.'
+#define GAP_BASE       '*'
+// end-of-read-character: character to fill fault regions with if 
+// the read has ended or not startet yet-
+#define EOR_CHARACTER '_'
+
+
+#define UNDEFINED_INDEX -1
+#define WRONGCALL_INDEX  0
+#define ADDITIONAL_INDEX 1
+#define OVERCALL_INDEX   2
+#define N_PLUS_INDEX     3
+#define UNDERCALL_INDEX  4
+#define MISSING_INDEX    5
+#define N_CALL_INDEX     6
+
+#define INDEX_COUNT 7
+
+
+
+#define CALC_DISTANCE           1
+#define CALC_PEAKS_OLD          2
+#define CALC_PEAKS_NEW          4
+#define CALC_CONV_OLD           8
+#define CALC_CONV_NEW           16
+#define CALC_CORRELATION_OLD    32
+#define CALC_CORRELATION_NEW    64
+#define CALC_POSRATING_NEW     128
+#define CALC_POSRATING_OLD     256
+#define CALC_PEAKRELATION      512
+#define CALC_PEAK_VALLEY      1024
+#define CALC_TRIPLETT_RANKING 2048  
+#define MARK_UNDEFINED_BASE   4096
+
+
+
+#define DISTANCE_CODE    0x0000007fl   // 00000000 00000000 00000000 01111111
+#define REL_DIST_PAR     0x00000001l
+#define REL_MIN_PAR      0x00000002l
+#define REL_MAX_PAR      0x00000004l
+#define BASECOUNT_PAR    0x00000008l
+#define MIN_DIST_PAR     0x00000010l
+#define MAX_DIST_PAR     0x00000020l
+#define MEAN_DIST_PAR    0x00000040l
+
+#define PEAKS_OLD_CODE   0x00000180l   // 00000000 00000000 00000001 10000000
+#define QUAL_OLD_PAR     0x00000080l
+#define PEAKS_OLD_PAR    0x00000100l
+
+#define PEAKS_NEW_CODE   0x00000600l   // 00000000 00000000 00000110 00000000
+#define QUAL_NEW_PAR     0x00000200l
+#define PEAKS_NEW_PAR    0x00000400l
+
+#define CONV_OLD_CODE    0x00001800l   // 00000000 00000000 00011000 00000000
+#define CONV_OLD_PAR     0x00000800l
+#define AREA_OLD_PAR     0x00001000l
+
+#define CONV_NEW_CODE    0x00006000l   // 00000000 00000000 01100000 00000000
+#define CONV_NEW_PAR     0x00002000l
+#define AREA_NEW_PAR     0x00004000l
+
+#define POSRAT_NEW_CODE  0x00018000l   // 00000000 00000001 10000000 00000000
+#define POS_NEW_PAR      0x00008000l
+#define SHAPE_NEW_PAR    0x00010000l
+
+#define POSRAT_OLD_CODE  0x00060000l   // 00000000 00000110 00000000 00000000
+#define POS_OLD_PAR      0x00020000l
+#define SHAPE_OLD_PAR    0x00040000l
+
+#define PEAK_REL_CODE    0x00380000l   // 00000000 00111000 00000000 00000000
+#define INT_NEW_PAR      0x00080000l
+#define INT_OLD_PAR      0x00100000l
+#define INT_OLDNEW_PAR   0x00200000l
+
+#define PEAK_VALLEY_CODE 0x0fc00000l   // 00001111 11000000 00000000 00000000
+
+#define COR_OLD_CODE     0x10000000l   // 00010000 00000000 00000000 00000000
+#define COR_NEW_CODE     0x20000000l   // 00100000 00010000 00000000 00000000
+
+#define MACHINETYPE_CODE 0x40000000l   // 01000000 00000000 00000000 00000000
+#define PEAK1_REL_CODE   0x80000000l
+
+
+//#define WRONGCALL_OPT POSRAT_NEW_CODE | POS_OLD_PAR | PEAK_REL_CODE | CORREL_OLD_CODE | CORREL_NEW_CODE  
+
+#define WRONGCALL_OPT POSRAT_OLD_CODE|POSRAT_NEW_CODE|COR_OLD_CODE|COR_NEW_CODE|PEAK_REL_CODE|MACHINETYPE_CODE
+
+#define N_CALL_OPT POSRAT_OLD_CODE|POSRAT_NEW_CODE|COR_OLD_CODE|COR_NEW_CODE|PEAK_REL_CODE
+
+// Wrongcall (Optimal: 1,2,3,5,6,7,8,9)
+// CALC_POSRATING_NEW  (1,2)
+// CALC_POSRATING_OLD  (3,4)
+// PEAK_RELATION (5,6,7)
+// COR_OLD + NEW (8,9)
+// MARK_UNDEFINED (10)
+
+//#define ADDITIONAL_OPT REL_MAX_PAR|BASECOUNT_PAR|MEAN_DIST_PAR|PEAKS_OLD_CODE
+#define ADDITIONAL_OPT DISTANCE_CODE|PEAKS_OLD_CODE|PEAKS_OLD_CODE|CONV_OLD_CODE|POSRAT_OLD_CODE|MACHINETYPE_CODE
+
+// Additional (Optimal: 3,4,7,8,9)
+// CALC_DISTANCE (1-7)
+// CALC_PEAKS_OLD  (8,9)
+// CALC_CONV_OLD (10,11)
+// CALC_POSRATING_OLD (12,13)
+
+//#define OVERCALL_OPT REL_DIST_PAR|REL_MIN_PAR|BASECOUNT_PAR|MAX_DIST_PAR|PEAKS_OLD_CODE|PEAKS_NEW_CODE|CONV_OLD_CODE|POSRAT_OLD_CODE
+
+#define OVERCALL_OPT DISTANCE_CODE|PEAKS_OLD_CODE|PEAKS_OLD_CODE|CONV_OLD_CODE|POSRAT_OLD_CODE|MACHINETYPE_CODE
+
+// Overcall (Optimal: ohne 3 evtl. 5,7)
+// CALC_DISTANCE  (1-7)
+// CALC_PEAKS_OLD (8,9)
+// CALC_CONV_OLD  (10,11)
+// CALC_POSRATING_OLD (12,13)
+
+//#define UNDERCALL_OPT DISTANCE_CODE|PEAKS_NEW_CODE|POSRAT_NEW_CODE 
+#define UNDERCALL_OPT DISTANCE_CODE|PEAKS_NEW_CODE|CONV_NEW_CODE|POSRAT_NEW_CODE|MACHINETYPE_CODE
+
+// Undercall (Optimal = 
+// CALC_DISTANCE  (1-7)
+// CALC_PEAKS_NEW (8,9)
+// CALC_CONV_NEW  (10,11)
+// CALC_POSRATING_NEW (12,13)
+
+//#define MISSING_OPT DISTANCE_CODE|QUAL_OLD_PAR|SHAPE_NEW_PAR
+#define MISSING_OPT DISTANCE_CODE|PEAKS_NEW_CODE|CONV_NEW_CODE|POSRAT_NEW_CODE|PEAK1_REL_CODE|MACHINETYPE_CODE
+
+// Missing (Optimal z.B. 1-7, 8,13)
+// CALC_DISTANCE  (1-7)
+// CALC_PEAKS_NEW (8,9)
+// CALC_CONV_NEW  (10,11)
+// CALC_POSRATING_NEW (12,13)
+
+//#define N_PLUS_OPT REL_DIST_PAR|REL_MIN_PAR|MAX_DIST_PAR|MEAN_DIST_PAR
+#define N_PLUS_OPT DISTANCE_CODE | MACHINETYPE_CODE
+
+// NPlus (Optimal 1,2,6,7)
+// CALC_DISTANCE (1-7)
+
+
+
+
+/* List of possible states of a fault hypotheses  */
+/* Achtung: Behandelter Status > fhs_UNHANDLED!!  */
+enum fhStatus {fhs_UNDEFINED, fhs_UNHANDLED, fhs_CONFIRMED, 
+	       fhs_REJECTED, fhs_UNDECIDABLE};
+
+/* List of possible atomic fault hypotheses classes (uncomplete) */
+enum fhClass  {fhc_UNDEFINED, fhc_OVERCALL, fhc_ADDITIONAL, fhc_WRONG,
+	       fhc_UNDERCALL, fhc_MISSING,  fhc_SYNTACTIC,
+	       fhc_CORRECT,   fhc_GAP};
+
+enum fhRating {rating_GOOD, rating_INDIFFERENT, 
+	       rating_BAD, rating_VERY_BAD};
+
+#define IS_BETTER_THAN <
+
+
+/* 
+   fhc_GAP and fhc_CORRECT are not fault-hypotheses; they state that the
+   situation found is right but this is also a hypotheses than can be 
+   examined 
+*/
+
+/* 
+  #define HYPOTHESES_ONLY
+*/
+
+
+int readParameter(char *name);
+
+#define STAT_INFO_FILE "EdIt.stat"
+#define PARAMETER_FILE "EdIt.par"
+
+
+
+// Definition of machine types
+
+enum t_machinetype {
+  MT_undefined,
+  MT_unknown,
+  MT_ABI_3700,
+  MT_LICOR,
+  MT_MegaBACE
+};
+
+
+#endif
diff --git a/src/examine/misc.C b/src/examine/misc.C
new file mode 100644
index 0000000..faa0a77
--- /dev/null
+++ b/src/examine/misc.C
@@ -0,0 +1,398 @@
+/*
+ * Written by Thomas Pfisterer
+ *
+ * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
+ *   Krebsforschungszentrum, DKFZ Heidelberg) and Thomas Pfisterer
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ *
+ * 
+ * SCF examination methods - misc.C
+ *
+ * Written by Thomas Pfisterer 
+ *
+ * 06.07.99  Functions to handle/check bases etc. that do not belong 
+ *           to any class
+ * 15.07.99  new functions isUndefinedBase/indirectSort4. isRealBase
+ *           also with lowercase letters.
+ */
+
+
+// 	$Id$	
+
+#include "misc.H"
+#include "assert.h"
+#include "math.h"
+
+
+#ifndef lint
+static char vcid[] = "$Id$";
+#endif /* lint */
+
+
+
+// Sorts array "pos" such that references to "a" are sorted (descending)
+// Is used to find the n-th-greatest value in array "a"
+
+void indirectSort4(int32 a[4], int32 pos[4]) 
+{
+  for (int32 l=0; l<4; l++) pos[l] = l;
+
+  for (int32 l1 = 0; l1 < 3; l1++) { 
+    for (int32 l2 = l1; l2 < 4; l2++) {
+      if (a[pos[l1]] < a[pos[l2]]) { 
+	int32 d = pos[l1]; pos[l1] = pos[l2]; pos[l2] = d;
+      }
+    }
+  }
+}
+
+
+// Given the base we want to alter into another base and the bases before
+// and after the base this function calculates the corresponding fault class
+
+
+int32 findFaultClass(const char prev, const char aBase, 
+		     const char next, const char newBase)
+{
+
+  if (newBase == GAP_BASE || newBase == '.') {
+    if (aBase == GAP_BASE) return fhc_GAP;
+
+    if (prev == aBase || next == aBase) {
+      return fhc_OVERCALL;
+    } else {
+      return fhc_ADDITIONAL;
+    }
+  }
+
+  if (aBase == GAP_BASE) {
+    if (prev == newBase || next == newBase) {
+      return fhc_UNDERCALL;
+    } else {
+      return fhc_MISSING;
+    }	
+  }
+
+  if (aBase == newBase) {
+    return fhc_CORRECT;
+  } else {
+    return fhc_WRONG;
+  }
+
+}
+
+
+// Find the fault class (and neural net) for the given fhc fault-class
+// and the old base in the DB. Differences are e.g. altering an
+// undefined base which has a seperate NNClass.
+
+int32 faultClassToNNClass(const int32 faultClass, const char oldDBBase)
+{
+  int32 nnFaultClass;
+
+  switch (faultClass) {
+  case fhc_WRONG:
+    if (isRealBase(oldDBBase)) {
+      nnFaultClass = WRONGCALL_INDEX;
+    } else {
+      if (isUndefinedBase(oldDBBase)) { 
+	nnFaultClass = N_CALL_INDEX;
+      } else {
+	nnFaultClass = UNDEFINED_INDEX;
+      } 
+    }
+    break;
+  case fhc_UNDERCALL: 
+    nnFaultClass = UNDERCALL_INDEX; 
+    break;
+  case fhc_OVERCALL:
+    if (isRealBase(oldDBBase)) {
+      nnFaultClass = OVERCALL_INDEX;
+    } else {
+      if (isUndefinedBase(oldDBBase)) {
+	nnFaultClass = N_PLUS_INDEX;
+      } else {
+	nnFaultClass = UNDEFINED_INDEX;
+      }
+    }
+    break;
+  case fhc_MISSING:   
+    nnFaultClass = MISSING_INDEX;  
+    break;
+ 
+ case fhc_ADDITIONAL:
+    if (isRealBase(oldDBBase)) {
+      nnFaultClass = ADDITIONAL_INDEX;
+    } else {
+      if (isUndefinedBase(oldDBBase)) {
+	nnFaultClass = N_PLUS_INDEX;
+      } else {
+	nnFaultClass = UNDEFINED_INDEX;
+      }
+    } 
+
+    break;
+    // case fhc_GAP:
+    // output << "nnFaultClass : Gap " << endl;
+  default: 
+    nnFaultClass = UNDEFINED_INDEX;
+  }
+
+ return nnFaultClass;
+}
+
+
+
+
+int16 isRealBase(const char c)
+{
+  static char flags[128];
+  static int8 is_init = 0;
+
+  if (is_init == 0) {
+    for (int32 loop = 0; loop < 128; loop++) { flags[loop] = 0; }
+    flags['A'] =  flags['C'] = flags['G'] = flags['T'] = 1;
+    flags['a'] =  flags['c'] = flags['g'] = flags['t'] = 1;
+  }
+
+  return flags[c];
+}
+
+
+
+int16 isBase(const char c) 
+{
+  static char flags[128];
+  static int8 is_init = 0;
+
+  if (is_init == 0) {
+    for (int32 loop = 0; loop < 128; loop++) { flags[loop] = 0; }
+      flags['A'] = flags['C'] = flags['G'] = flags['T'] = 1;
+      flags['a'] = flags['c'] = flags['g'] = flags['t'] = 1;
+      flags['N'] = flags['n'] = flags['-'] = 1;
+  }
+
+  return flags[c];
+}
+
+
+
+int16 isUndefinedBase(const char c)
+{
+  return (c == '-' || c == 'N');
+}
+
+
+
+char invertBase(const char c)  
+{
+  static char flags[128];
+  static int8 is_init = 0;
+
+  if (0 == is_init) { 
+    for (int32 loop = 0; loop < 128; loop++) { flags[loop] = 'N'; }
+    flags['A'] = flags['a'] = 'T';
+    flags['C'] = flags['c'] = 'G';
+    flags['G'] = flags['g'] = 'C';
+    flags['T'] = flags['t'] = 'A';
+    flags['*'] = '*';
+  }
+
+ return flags[c];	 
+}
+
+
+int32 valueForBase(const int32 theArray[4], const char theSCFBase) {
+  switch (theSCFBase) {
+  case 'A':
+  case 'a': return theArray[0];
+  case 'C':
+  case 'c': return theArray[1];
+  case 'G':
+  case 'g': return theArray[2];
+  case 'T':
+  case 't': return theArray[3];
+  default: 
+    return ((theArray[0]+theArray[1]+theArray[2]+theArray[3])/4);
+  }
+}
+
+
+char toDBBase(const char c, const int32 reversed)
+{
+  if (reversed == 0) return c;
+  return invertBase(c);
+}
+
+
+char toSCFBase(const char c, const int32 reversed) 
+{
+  if (reversed == 0) return c;
+  return invertBase(c);
+}
+
+
+// *******************************************************
+//    calledBase
+//    simple method to calculate the consensus base.
+//    actually the calculated base is not that important
+//    ther is always a difference to one of the reads if
+//    the reads don't agree unanimously
+// *******************************************************
+
+
+char calledBase(const Contig::consensus_counts_t &cc) 
+{
+  if (cc.A > cc.C && cc.A > cc.G && cc.A > cc.T) { return 'A';};
+  if (cc.C > cc.A && cc.C > cc.G && cc.C > cc.T) { return 'C';};
+  if (cc.G > cc.A && cc.G > cc.C && cc.G > cc.T) { return 'G';};
+  if (cc.T > cc.A && cc.T > cc.C && cc.T > cc.G) { return 'T';};
+  return 'N';
+}
+
+
+
+void initializeGaussPattern(uint16* pattern, int32 size, double sigma)
+{
+  double offset = - ((double)size - 1) / 2;
+
+  if (size < 1) {
+    return;
+  }
+
+  for (int32 loop = 0; loop < size; loop++) {
+    pattern[loop] = (uint16)(0.5 + 100 * 
+			     exp(- fabs((offset+loop)/sigma)));
+  }
+
+}
+
+
+
+// Simple Korrelation of a small pattern in a larger pattern
+
+double simpleNormedCorrelation(uint16 *sequence, int32 vonpos, 
+			      int32 bispos, double sigma)
+{
+  int32   patternsize = 9;
+  //uint16  pattern[15];
+
+  //  initializeGaussPattern(pattern, patternsize, sigma);
+
+  // Dreieck 1
+  //uint16  pattern[9] = { 0, 1, 2, 3, 4, 3, 2, 1, 0};
+
+  // Dreieck 2
+  // uint16  pattern[9] = { 1, 2, 3, 4, 5, 4, 3, 2, 1};
+
+  // Gauss Sigma=1  (Gauss 1)
+  // uint16  pattern[9] = { 2, 5, 14, 37, 100, 37, 14, 5, 2};
+
+  // Gauss Sigma=4/3 (Gauss 11)
+  //  uint16  pattern[9] = {11, 22, 47, 100, 47, 22, 11};
+
+  // Gauss Sigma=2  (Gauss 2)
+  // uint16  pattern[9] = { 14, 22, 37, 60, 100, 60, 37, 22, 14 };
+
+  // Gauss Sigma=2.5  (Gauss 21)
+  //  uint16  pattern[9] = { 20, 30, 45, 67, 100, 67, 45, 30, 20 };
+
+  // Gaus Sigma=3   (Gauss 3)
+  uint16 pattern[9] = {26, 37, 51, 72, 100, 72, 51, 37, 26};
+
+  int32  maxpos = -1;
+  int32  k, kmax = -1;
+  int32  maximum = 1;
+
+  if (sequence == NULL) {
+    cout << "No Trace!!" << endl;
+    return 0;
+  }
+
+ 
+  for (int32 loop = vonpos; loop <= bispos; loop++) {
+    if (sequence[loop] > maximum) { maximum = sequence[loop]; }
+  }
+
+  for (int32 loop = vonpos; loop+patternsize-1 <= bispos; loop++) {
+    k = 0;
+    for (int32 l = 0; l<patternsize; l++) {
+      k = k + (pattern[l] * (int32)sequence[loop+l]);
+    }
+    if (k > kmax) {
+      kmax = k; 
+      maxpos = loop;
+    }
+  }
+
+  if (maxpos < 0) {
+    return 0;
+  }
+
+  double ac1 = autoCorrelation(sequence, maxpos, maxpos+patternsize, 0);
+  double ac2 = autoCorrelation(pattern, 0, patternsize-1, 0);
+
+  // cout << "Autokorrelation Signal  : " << ac1 << endl;
+  // cout << "Autokorrelation Pattern : " << ac2 << endl;
+  double norm = sqrt(ac1 * ac2);
+
+  if (norm <= 0.001) {
+    return 0;
+  }
+
+  //#ifndef RUNONLY
+  //if (norm < kmax) {
+  //  cout << "Norm: " << norm << "\t kmax " << kmax << endl;
+  //}
+
+  if (norm <= 0.01 || kmax/norm > 1.01) {
+    return 0;
+  }
+  // Norm should be in [0;1] (with a little epsilion)
+  // assert(kmax/norm < 1.1);
+  //#endif
+
+
+  // Value betwen 0 and 100; the higher the value the better the korrelation
+
+  return kmax/norm;
+}
+
+
+
+
+double autoCorrelation(uint16 *sequence, int32 vonpos, int32 bispos, int32 o)
+{
+  int32  offset = o;
+  double s = 0;
+
+  if (o < 0) offset = -o;
+
+  if (bispos < vonpos) {
+    int32 dummy = bispos; bispos = vonpos; vonpos = dummy;
+  }
+
+  //cout << "Autokorrelation " << vonpos << "-" << bispos << endl;
+
+  for (int32 loop=vonpos; loop<=bispos; loop++) {
+    s = s + (double)(sequence[loop]*sequence[loop+offset]);
+  }
+
+  return s;
+}
diff --git a/src/examine/misc.H b/src/examine/misc.H
new file mode 100644
index 0000000..83b4d3b
--- /dev/null
+++ b/src/examine/misc.H
@@ -0,0 +1,76 @@
+/*
+ * Written by Thomas Pfisterer
+ *
+ * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
+ *   Krebsforschungszentrum, DKFZ Heidelberg) and Thomas Pfisterer
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ *
+ * 
+ *
+ * misc functions - header file 
+ *
+ * Written by Thomas Pfisterer 
+ * 09.10.1999
+ */
+
+
+#ifndef _edit_misc_H
+#define _edit_misc_H
+
+
+#include "scf_look.H"
+
+
+//struct Contig::consensus_counts_t;
+
+
+// get the fault class from what we want to change...
+int32 findFaultClass(char prev, char aBase, char next, char newBase);
+
+
+// Find the fault class (and neural net) for the given fhc fault-class
+// and the old base in the DB. Differences are e.g. altering an
+// undefined base which has a seperate NNClass.
+int32 faultClassToNNClass(const int32 faultClass, const char oldDBBase);
+
+
+// find the consensus base
+char calledBase(const Contig::consensus_counts_t &cc);
+
+
+// Sorts array "pos" such that references to "a" are sorted (descending)
+// Is used to find the n-th-greatest value in array "a"
+void  indirectSort4(int32 a[4], int32 pos[4]);
+
+
+
+int16 isRealBase(const char c);
+int16 isBase(const char c);
+int16 isUndefinedBase(const char c);
+char  invertBase(const char c);
+
+int32 valueForBase(const int32 theArray[4], const char theBase);
+char  toSCFBase(const char c, const int32 reversed); 
+char  toDBBase(const char c, const int32 reversed);
+
+double simpleNormedCorrelation(uint16 *sequence, int32 vonpos, 
+			      int32 bispos, double sigma);
+double autoCorrelation(uint16 *sequence, int32 vonpos, int32 bispos, int32 o);
+
+#endif
diff --git a/src/examine/prescan.C b/src/examine/prescan.C
new file mode 100644
index 0000000..c582fb4
--- /dev/null
+++ b/src/examine/prescan.C
@@ -0,0 +1,261 @@
+/*
+ * Written by Thomas Pfisterer
+ *
+ * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
+ *   Krebsforschungszentrum, DKFZ Heidelberg) and Thomas Pfisterer
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ *
+ * 
+ * Hilfsfunktionen zur Analyse der Chemieeigenschaften
+ *
+ */
+
+
+// 	$Id$	
+
+#ifndef lint
+static char vcid[] = "$Id$";
+#endif /* lint */
+
+
+#include "examine/prescan.H"
+#include <math.h>
+#include "stdlib.h"
+
+
+
+bool  prescan::ready   = false;
+bool  prescan::verbose = true;
+int32 prescan::triplett_ranking[65];
+
+
+
+
+prescan::prescan() 
+{
+  initialize();
+}
+
+
+
+prescan::~prescan()
+{
+}
+
+
+
+
+int32 prescan::initialize()
+{
+  if (!ready) {
+    return load("prescan.par");
+  }
+  return 1;
+}
+
+
+
+void prescan::out(const char *aText)
+{
+  if (true == verbose) {
+    cout << aText;
+  }
+}
+
+
+int32 prescan::getRanking(int32 index)
+{
+  if (index >= 0 && index < arraysize) {
+    return triplett_ranking[index];
+  } else {
+    return (arraysize / 2);
+  }
+}
+
+
+int32 prescan::load(char *filename) {
+  ifstream file; 
+  int32    index, freq, val;
+  char     code[10];
+  int32    loop = 0;
+
+  ready=true;
+
+  try {
+    file.open(filename, ios::in);
+    
+    if (!file) {
+      // FIXME   geht so nicht; ~ wird offensichtlich nicht expandiert
+      out("Try to open ~/prescan.par.\n");
+      file.open("~/prescan.par", ios::in);
+    }
+
+    // Initialize with identical values (e.g. no effect of sequence)
+    for (int l=0; l < arraysize; l++) {
+      triplett_ranking[l] = (arraysize / 2);
+    }
+
+    if (!file) {
+      out("Couldn't open prescan information!\n");
+      return -1;
+    }
+
+    loop = 0;
+    do {
+      file >> index >> code >> freq >> val;
+      triplett_ranking[index-1] = loop;
+
+      loop++;
+    } while (!file.eof() && loop < arraysize);
+
+    file.close();
+  }
+  catch(Notify n) {
+    file.close();
+    return -1;
+  }
+
+  out("Prescan information loaded.\n");
+  return 1;
+}
+
+
+
+
+
+ringbuffer::ringbuffer()
+{
+  buffer_usage = 0;
+  buffer_index = 0;
+  buffer_size  = buffersize;
+  buffer = new int32 [buffersize];
+}
+
+
+ringbuffer::ringbuffer(int32 size)
+{
+  buffer_usage = 0;
+  buffer_index = 0;
+  buffer_size  = size;
+  buffer = new int32 [buffer_size];
+}
+
+
+ringbuffer::~ringbuffer()
+{
+  delete buffer;
+}
+ 
+
+
+void ringbuffer::add(int32 element)
+{
+  buffer[buffer_index] = element;
+  buffer_index = (buffer_index+1) % buffer_size;
+  buffer_usage++;
+}
+
+
+
+bool ringbuffer::getMean(int32 &mean)
+{
+  int32 sum = 0;
+
+  if (buffer_usage < buffer_size) {
+    mean = 0;
+    return false;
+  }
+
+  for (int32 i=0; i < buffer_size; i++) {
+    sum += buffer[i];
+  }
+
+  mean = sum / buffer_size;
+  return true;
+}
+
+
+
+int32 baseToIndex1(char base)
+{ 
+  switch(toupper(base)) {
+  case 'A': return 0;
+  case 'C': return 1;
+  case 'G': return 2;
+  case 'T': return 3;
+  default: return 4;
+  }
+}
+
+
+int32 baseToIndex2(char prev_base, char base)
+{
+  int i = 0;
+   
+  switch(toupper(prev_base)) {
+  case 'A': i = 0;  break;
+  case 'C': i = 4;  break;
+  case 'G': i = 8;  break;
+  case 'T': i = 12; break;
+  default: return 16;
+  }
+
+  switch(toupper(base)) {
+  case 'A': return i;
+  case 'C': return i+1;
+  case 'G': return i+2;
+  case 'T': return i+3;
+  default: return 16;
+  }
+}
+
+
+int32 baseToIndex3(char prev_base, char base, char next_base)
+{
+  int i = 0;
+   
+  switch(toupper(prev_base)) {
+  case 'A': i = 0;   break;
+  case 'C': i = 16;  break;
+  case 'G': i = 32;  break;
+  case 'T': i = 48;  break;
+  default: return 64;
+  }
+
+  switch(toupper(base)) {
+  case 'A': break;
+  case 'C': i += 4;  break;
+  case 'G': i += 8;  break;
+  case 'T': i += 12; break;
+  default: return 64;
+  }
+
+  switch(toupper(next_base)) {
+  case 'A': return i;
+  case 'C': return i+1;
+  case 'G': return i+2;
+  case 'T': return i+3;
+  default: return 64;
+  }
+}
+
+
+
+
+
diff --git a/src/examine/prescan.H b/src/examine/prescan.H
new file mode 100644
index 0000000..6ccba59
--- /dev/null
+++ b/src/examine/prescan.H
@@ -0,0 +1,102 @@
+/*
+ * Written by Thomas Pfisterer
+ *
+ * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
+ *   Krebsforschungszentrum, DKFZ Heidelberg) and Thomas Pfisterer
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ *
+ *
+ * SCF examination methods
+ *
+ */
+
+
+#ifndef _prescan_prescan_H_
+#define _prescan_prescan_H_
+
+// 	$Id$	
+
+
+
+#include <iostream>
+#include "mira/read.H"
+#include "examine/scf_look.H"
+
+
+
+struct prescan_parameter{
+  int32    offset;
+  bool     relativ;
+  bool     liste;
+  int32    lock_back_bases;
+};
+
+
+
+class prescan {
+  enum { arraysize = 65};
+
+  static int32 triplett_ranking[arraysize];
+  static bool  ready;
+  static bool  verbose;
+
+public:
+  prescan();
+  ~prescan();
+
+  int32 initialize();
+  void  out(const char *aText);
+  int32 load(char *filename);
+  int32 getRanking(int32 index);
+};
+
+
+
+class ringbuffer {
+  enum { buffersize = 10 };
+
+  int32 buffer_index;
+  int32 buffer_usage;
+
+  int32 *buffer;
+  int32 buffer_size;
+
+public:
+  ringbuffer();
+  ringbuffer(int32 size);
+  ~ringbuffer();
+  void   add(int32 element);
+  bool   getMean(int32 &mean);
+};
+
+
+
+int32 baseToIndex1(char base);
+int32 baseToIndex2(char prev_base, char base);
+int32 baseToIndex3(char prev_base, char base, char next_base);
+
+
+
+
+
+
+
+
+
+#endif
diff --git a/src/examine/ranges.C b/src/examine/ranges.C
new file mode 100644
index 0000000..5adce25
--- /dev/null
+++ b/src/examine/ranges.C
@@ -0,0 +1,591 @@
+/*
+ * Written by Thomas Pfisterer
+ *
+ * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
+ *   Krebsforschungszentrum, DKFZ Heidelberg) and Thomas Pfisterer
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ *
+ *
+ */
+
+#include "scf_look.H"
+
+// 	$Id$	
+
+#ifndef lint
+static char vcid[] = "$Id$";
+#endif /* lint */
+
+
+
+// area around a single base (halfway to adjacent peaks)
+void SCF_look::range(const int32 basePos, int32 &von, int32 &bis) 
+{
+
+  if (basePos <= 0) {
+    von = 0;
+  } else {
+    if (basePos < db_samples-1) {
+      // skip the gaps
+      int32 i = 1;
+      while (db_bases[basePos-i] == '*' && basePos > i) i++;
+
+      von = (db_peak_index[basePos-i] + db_peak_index[basePos]) / 2;
+    } else {
+      von = db_peak_index[db_samples-1];
+    }
+  }
+
+  if (basePos < db_samples - 1) {
+    if (basePos > 0) {
+      // skip the gaps
+      int32 i = 1;
+      while (db_bases[basePos+i] == '*' && basePos+i < db_samples-1) i++;
+
+      bis = (db_peak_index[basePos+i] + db_peak_index[basePos]) / 2;
+    } else {
+      bis = db_peak_index[0];
+    }
+  } else {
+    bis = db_peak_index[db_samples-1];
+  }
+
+#ifdef RANGECHECK_ON
+  if (von < 0 ||  von > (int32)SCF_header.samples) {
+    cerr << "VON ist out of range! 3 " << endl;
+    //    cout << "VON ist out of range! 3 " << von << endl;
+    throw Notify(Notify::WARNING, "range", "von out-of range");
+  }
+  if (bis < 0 ||  bis > (int32)SCF_header.samples) {
+    cerr << "BIS ist out of range! 3 " << endl;
+    //    cout << "BIS ist out of range! 3 " << bis << endl;
+    //cerr << "Index: " << db_peak_index[basePos+1] << " ";
+    //cerr <<  db_peak_index[basePos];
+    //cerr << "BasePos: " << basePos << endl;
+    //cout << "Bases in Read: " << db_samples << endl;
+    throw Notify(Notify::WARNING, "range", "bis out of range");
+  }
+#endif
+
+  if (von > bis) { von ^= bis ^= von ^= bis; }
+}
+
+
+
+// region around the bases (halfway to the adjacent peaks)
+void SCF_look::range(const int32 dbPosVon, const int32 dbPosBis,
+		     int32 &von, int32 &bis)
+{
+
+  if (dbPosVon < 1) {
+    von = (db_peak_index[0]);
+  } else {
+    if (dbPosVon >= db_samples-1) {
+      von = db_peak_index[db_samples-1];
+    } else {
+      // skip the gaps
+      int32 i=1;
+      while (db_bases[dbPosVon-i] == '*' && dbPosVon > i) i++;
+
+      von = (db_peak_index[dbPosVon-i] + db_peak_index[dbPosVon]) / 2;
+    }
+  }
+  
+  if (dbPosBis >= (db_samples-1)) {
+    bis = db_peak_index[db_samples-1];
+  } else { 
+    if (dbPosBis < 0) {
+      bis = db_peak_index[0];
+    } else {
+      // skip the gaps
+      int32 i=1;
+      while (db_bases[dbPosBis+i] == '*' && dbPosBis+i < db_samples-1) i++;
+
+      bis = (db_peak_index[dbPosBis+i] + db_peak_index[dbPosBis]) / 2;
+    }
+  }
+
+#ifdef RANGECHECK_ON
+  if (von < 0 || bis < 0 || 
+      von >= (int32)SCF_header.samples || 
+      bis >= (int32)SCF_header.samples) {
+
+    cerr << "basepos" << dbPosVon << "-" << dbPosBis << "  range " 
+	 << von << "-" << bis 
+	 << " #" << db_samples << endl;
+    throw Notify(Notify::WARNING, "range.", "von/bis out of range");
+  }
+#endif
+
+  if (von > bis)  { von ^= bis ^= von ^= bis; }
+}
+
+
+// narrow region around a base (one third to the next base)
+void SCF_look::half_range(const int32 basePos, int32 &von, int32 &bis) 
+{
+  int32 pos = basePos;
+
+ if (basePos > (db_samples-1)) { pos = db_samples - 2; }
+
+ if (pos < 1) {
+    //    von = (0 + 2 * db_peak_index[1]) / 3;
+    von = db_peak_index[0];
+  } else {
+    // skip the gap
+    int32 i=1;
+    while (db_bases[pos-i] == '*' && pos > i) i++;
+
+    von = (db_peak_index[pos-i] + 2 * db_peak_index[pos]) / 3;
+  }
+
+  if (pos >= (db_samples-1)) {
+    bis = db_peak_index[db_samples-1];
+  } else {
+    // skip the gap
+    int32 i=1;
+    while (db_bases[pos+i] == '*' && pos+i < db_samples-1) i++;
+
+    bis = (db_peak_index[pos+i] + 2 * db_peak_index[pos]) / 3;
+  }
+
+#ifdef RANGECHECK_ON
+  if (von < 0 || bis < 0 || 
+      von >= (int32) SCF_header.samples || 
+      bis >= (int32) SCF_header.samples) {
+
+    cerr << "Out of Range: " << basePos << "half_range " << von << "-" << bis 
+	 << " #" << db_samples << endl;
+    throw Notify(Notify::WARNING, "half_range", "von/bis out of range");
+  }
+#endif
+
+  if (von > bis) { von ^= bis ^= von ^= bis; }
+}
+
+
+// wide region around the bases (two third of the distance to the  
+// adjacent peaks
+void SCF_look::wide_range(const int32 dbPosVon, const int32 dbPosBis,
+			  int32 &von, int32 &bis)
+{
+  if (dbPosVon < 1) {
+    von = db_peak_index[0];
+  } else {
+    if (dbPosVon < (db_samples-1)) {
+      // skip the gaps
+      int32 i=1;
+      while (db_bases[dbPosVon-i] == '*' && dbPosVon > i) i++;
+
+      von = ((2* db_peak_index[dbPosVon-i]) + db_peak_index[dbPosVon]) / 3;
+    } else {
+      von = db_peak_index[db_samples-1];
+    }
+  }
+
+  if (dbPosBis >= (db_samples-1)) {
+    bis = db_peak_index[db_samples-1];
+  } else {
+    if (dbPosBis > 0) {
+      // skip the gaps
+      int32 i=1;
+      while (db_bases[dbPosBis+i] == '*' && dbPosBis+i < db_samples-1) i++;
+
+      bis = ((2* db_peak_index[dbPosBis+i]) + db_peak_index[dbPosBis]) / 3;
+    } else {
+      bis = db_peak_index[0];
+    }
+  }
+
+#ifdef RANGECHECK_ON
+  if (von < 0 || bis < 0 || 
+      von >= (int32) SCF_header.samples || 
+      bis >= (int32) SCF_header.samples) {
+
+    cerr << "Out of range half_range " << von << "-" << bis 
+	 << " #" << db_samples << endl;
+    throw Notify(Notify::WARNING, "half_range", "von/bis out of range");
+  }
+#endif
+
+  if (von > bis) { von ^= bis ^= von ^= bis; }
+}
+
+
+// finds the maximum of each base at the base at "basePos" 
+// e.g. max[0] = highest value of base A around basePos
+// returns: overall maximum
+uint16 SCF_look::findMaxDB(int32 basePos, int32 max[4]) {
+  int32 first_sample;
+  int32 last_sample;  
+
+  range (basePos, first_sample, last_sample);
+  return findMaxDB(max, first_sample, last_sample);
+
+}
+
+
+
+// same as findMaxDB with a smaller environment around the base
+uint16 SCF_look::findMaxDBHalf(int32 basePos, int32 max[4]) {
+  int32 first_sample;
+  int32 last_sample;  
+
+  half_range (basePos, first_sample, last_sample);
+  return findMaxDB(max, first_sample, last_sample);
+}
+
+
+// finds the maximum of each base in a range of sample values 
+// e.g. max[0] = highest value of "A"
+// returns: overall maximum
+
+uint16 SCF_look::findMaxDB(int32 max[4], 
+			   int32 first_sample, int32 last_sample) {
+  uint16 max_all = 0;
+  
+  max[0] = max[1] = max[2] = max[3] = 0;
+
+  max[0] = findMaxBase(SCF_samples_A, first_sample, last_sample);
+  max[1] = findMaxBase(SCF_samples_C, first_sample, last_sample);
+  max[2] = findMaxBase(SCF_samples_G, first_sample, last_sample);
+  max[3] = findMaxBase(SCF_samples_T, first_sample, last_sample);
+
+
+  for (int16 loop = 0; loop < 4; loop++) {
+    if (max_all < max[loop]) max_all = max[loop];
+  }
+
+  return max_all;
+}
+
+
+// finds the minimum of each base in a range of sample values 
+// e.g. max[0] = smallest value of "A"
+// returns: overall minimum
+
+uint16 SCF_look::findMinDB(int32 min[4], 
+			   int32 first_sample, int32 last_sample) {
+  uint16 min_all = 0;
+  
+  min[0] = min[1] = min[2] = min[3] = 0;
+
+  min[0] = findMinBase(SCF_samples_A, first_sample, last_sample);
+  min[1] = findMinBase(SCF_samples_C, first_sample, last_sample);
+  min[2] = findMinBase(SCF_samples_G, first_sample, last_sample);
+  min[3] = findMinBase(SCF_samples_T, first_sample, last_sample);
+
+
+  for (int16 loop = 0; loop < 4; loop++) {
+    if (min_all < min[loop]) min_all = min[loop];
+  }
+
+  return min_all;
+}
+
+
+/* Finds the maximum value of a base in a given range */
+uint16 SCF_look::findMaxBase(uint16 *SCF_samples, int32 von, int32 bis) {
+  uint16 max = 0;
+
+  if (von > bis) { von ^= bis ^= von ^= bis; }
+ 
+#ifdef RANGECHECK_ON
+  if (von < 0 ||  von > (int32) SCF_header.samples) {
+    cerr << "VON ist out of range! 2 " << endl;
+    //cout << "VON ist out of range! 2 " << von << endl;
+    //cout << "Von: " << von << " bis: " << bis << endl;
+    throw Notify(Notify::WARNING, "range", "von out-of range");
+  }
+  if (bis < 0 ||  bis > (int32) SCF_header.samples) {
+    cerr << "BIS ist out of range! 2 " << endl;
+    //cout << "BIS ist out of range! 2 " << bis << endl;
+    //cout << "Von: " << von << " bis: " << bis << endl;
+    throw Notify(Notify::WARNING, "range", "bis out of range");
+  }
+#endif
+
+  for (int32 loop = von; loop < bis; loop++) {
+    if (SCF_samples[loop] > max) {
+      max = SCF_samples[loop];
+    }
+  }
+  return max;
+}
+
+
+
+/* Finds the minumum value of a base in a given range */
+uint16 SCF_look::findMinBase(uint16 *SCF_samples, int32 von, int32 bis) {
+  uint16 min = 10000;
+  int16 step = 1;
+
+  if (von > bis) { von ^= bis ^= von ^= bis; }
+
+#ifdef RANGECHECK_ON
+  if (von < 0 ||  von > (int32) SCF_header.samples) {
+    cerr << "VON ist out of range! 1" << endl;
+    //cout << "VON ist out of range! 1" << von << endl;
+
+    throw Notify(Notify::WARNING, "range", "von out-of range");
+  }
+  if (bis < 0 ||  bis > (int32)SCF_header.samples) {
+    cerr << "BIS ist out of range! 1" << endl;
+    //cout << "BIS ist out of range! 1 " << bis << endl;
+    throw Notify(Notify::WARNING, "range", "bis out of range");
+  }
+#endif
+
+  for (int32 loop = von; loop < bis; loop += step) {
+    if (SCF_samples[loop] < min) {
+      min = SCF_samples[loop];
+    }
+  }
+  return min;
+}
+
+
+// ==========================================================
+// ==========================================================
+
+// Searches the peak with the greatest distance to the borders of the 
+// searched intervall [von;bis] (sample positions)   
+int32 bestPeakBetweenBases(uint16 *samples, int32 von, int32 bis)
+{
+  int i;
+  int bestPeak = 0;
+
+  if (samples == NULL) {
+    DEBUG_EDIT("bestPeakBetweenBases: No trace!! " << endl);
+    return 0;
+  }
+
+  if (von > bis) { von ^= bis ^= von ^= bis; }  // swap
+
+  i = von+1;
+  while (i < bis) {
+    if (samples[i-1] < samples[i] && samples[i+1] <= samples[i]) {
+
+      // Maximum
+      if (bestPeak != 0) {
+	if (min(bestPeak - von, bis - bestPeak) < min(i - von, bis - i)) {
+	  bestPeak = i;
+	}
+      } else {
+	bestPeak = i;
+      }
+    }
+    i++; 
+  }  
+
+  return bestPeak;
+}
+
+ 
+// Searches the peak with the greatest distance to the borders of the 
+// searched intervall [von;bis] (sample positions)   
+int32 bestValleyBetweenBases(uint16 *samples, int32 von, int32 bis)
+{
+  int i;
+  int bestValley = 0;
+
+  if (samples == NULL) {
+    DEBUG_EDIT("bestValleyBetweenBase: No trace!! " << endl);
+    return 0;
+  }
+
+  if (von > bis) { von ^= bis ^= von ^= bis; }  // swap
+
+  i = von+1;
+  while (i < bis) {
+    if (samples[i-1] > samples[i] && samples[i+1] >= samples[i]) {
+      // Minimum
+      if (bestValley != 0) {
+	if (min(bestValley - von, bis - bestValley) < min(i-von, bis-i)) {
+	  bestValley = i;
+	}
+      } else {
+	bestValley = i;
+      }
+    }
+    i++; 
+        
+  }  
+  return bestValley;
+}
+ 
+
+
+bool slopeChangeTest(const uint16 *samples, const int32 pos) 
+{
+  float slopeDiff, meanSlope;
+
+  slopeDiff = 2.0 * samples[pos] - samples[pos-1] - samples[pos+1];
+  meanSlope = (float)(samples[pos+1] - samples[pos-1]) / 2.0;
+
+  if (meanSlope == 0.0) {
+    return !(slopeDiff == 0);
+  } 
+
+  if ((slopeDiff / meanSlope) < 0) {
+    return ((slopeDiff / meanSlope) < -0.75);
+  } else {
+    return ((slopeDiff / meanSlope) > 0.75);
+  }
+}
+
+
+
+int32 findBestWeakPeak(const uint16 *samples, int32 von, int32 bis,
+		       int32 &peak, int32 &valley)
+{
+  int32 i, mitte;
+  int32 bestC, bestD;
+
+  if (samples == NULL) {
+    DEBUG_EDIT("findBestWeakPea: No trace !!" << endl);
+    return 0;
+  }
+
+  if (von > bis) { von ^= bis ^= von ^= bis; }  // swap
+  i = von + 1;
+  mitte = (von + bis + 1) / 2;
+  bestC = bestD = 0;
+
+  while (i < bis) {
+    if(slopeChangeTest(samples, i)) {
+
+	if ((samples[i-1] - 2*samples[i] + samples[i+1]) < 0) {
+	  if (bestC == 0 || (abs(bestC - mitte) > abs(i - mitte))) {
+	    bestC = i;
+	  } 
+	} else {
+	  if (bestD == 0 || (abs(bestD - mitte) > abs(i - mitte))) {
+	    bestD = i;
+	  }
+	}
+    }
+    i++;
+  }
+
+  peak = bestC;
+  valley = bestD;
+
+  return 1;
+}
+
+
+int32 constSlopeBetweenBases(const uint16 *samples, int32 von, 
+			     int32 bis, int32 &bestC, int32 &bestD)
+{
+  int32 i;
+
+  if (samples == NULL) {
+    DEBUG_EDIT("constSlopeBetweenBases: No trace!! " << endl);
+    return 0;
+  }
+
+  if (von > bis) { von ^= bis ^= von ^= bis; }  // swap
+  
+  bestC = bestD = 0;
+  i = von + 1;
+
+  while (i < bis) {
+
+    if (!slopeChangeTest(samples, i-1) &&
+	slopeChangeTest(samples, i)  && 
+	!slopeChangeTest(samples, i+1)) {
+      
+
+      if ((2 * samples[i] - samples[i-1] - samples[i+1]) > 0) {
+	if (bestC != 0) {
+	  if (min(bestC - von, bis - bestC) < min(i-von, bis-i)) {
+	    bestC = i;
+	  }
+	} else {
+	  bestC = i;
+	}
+      } else {
+	if (bestD != 0) {
+	  if (min(bestD - von, bis - bestD) < min(i-von, bis-i)) {
+	    bestD = i;
+	  } 
+	} else {
+	  bestD = i;
+	}
+      }
+
+    }
+    i++; 
+        
+  }  
+  return bestC;
+}
+ 
+
+int32 bestConvergenceRegion(uint16 *samples, int32 von, int32 bis)
+{
+  int32 regStart = -1;
+  int32 regEnd   = -1;
+  int32 bestCV = 0;
+  int32 i;
+
+  if (samples == NULL) {
+    DEBUG_EDIT("bestConvergenceRegion: No trace !!" << endl);
+    return 0;
+  }
+
+  if (von > bis) { von ^= bis ^= von ^= bis; }  // swap
+
+  i = von + 1;
+  while (i < bis) {
+    if (samples[i-1] + samples[i+1] < 2*samples[i]) {
+      
+      // Convergence 
+      if (i > regEnd+1) {  // gap or start
+	if (regStart > 0) { // gap => old region finished
+
+	  int32 mitte = (regStart + regEnd + 1) / 2;
+	  if (bestCV == 0) bestCV = mitte;
+
+	  if (min(bestCV - von, bis - bestCV) < 
+	      min(mitte - von, bis - mitte)) 
+	    {
+	      bestCV = mitte;
+	    }
+	}
+	regStart = i;
+      }
+      regEnd = i;
+    }
+    i++;
+  }
+
+  if (regStart > 0 && regStart < bis-1) {
+    if (bestCV == 0 || 
+	min(bestCV - von, bis - bestCV) < min(i - von, bis - i)) {
+      bestCV = (regStart + regEnd) / 2;
+    }
+  }
+
+  return bestCV;
+}
+
+
+
diff --git a/src/examine/scf_look.C b/src/examine/scf_look.C
new file mode 100644
index 0000000..ca37054
--- /dev/null
+++ b/src/examine/scf_look.C
@@ -0,0 +1,2655 @@
+/*
+ * Written by Thomas Pfisterer
+ *
+ * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
+ *   Krebsforschungszentrum, DKFZ Heidelberg) and Thomas Pfisterer
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ *
+ *
+ * SCF examination methods
+ *
+ * 13.08.98  Now loading of scf-files using a contigread_t object to
+ *           get the assignment to the scf-file possible  
+ * 04.11.98  SCF_buffer operating without instances
+ * 17.04.2002 Changed load routine to honor full path names (BaCh)
+ */
+
+
+// 	$Id$	
+#ifndef lint
+static char vcid[] = "$Id$";
+#endif /* lint */
+
+
+
+#include <math.h>
+#include "examine/scf_look.H"
+#include "io/scf.H"
+#include "globals.H"
+#include <stdlib.h>
+#include <cstdio>
+#include <assert.h>
+
+
+int32 SCF_look::count = 0;
+
+
+/* ------------------------ */
+/*          scf_look        */
+/* ------------------------ */
+
+
+// Copy constructor
+SCF_look::SCF_look(SCF_look const &other)
+{
+
+#ifdef VERBOSE
+  count++;
+  cout << "SCF_look count CopyOperator " << count;  
+#endif
+
+  zeroVars();
+  *this = other;
+  return;
+}
+
+
+// Copy operator
+const SCF_look& SCF_look::operator=(const SCF_look &other)
+{
+  if (this != &other) {
+    discard();
+
+    SCF::operator=(other);
+
+    reversed   = other.reversed;
+    db_samples = other.db_samples;
+    theRead    = other.theRead;
+    
+    if (db_samples!=0) {
+      db_peak_index = new uint32[db_samples];
+      db_bases = new uint8[db_samples];
+
+      memcpy(db_peak_index, other.db_peak_index, db_samples*sizeof(uint32));
+      memcpy(db_bases, other.db_bases, db_samples*sizeof(uint8));
+    }
+
+    if (other.fName != NULL) {
+      fName = new char[strlen(other.fName)+1];
+      strcpy(fName, other.fName);
+    }
+
+  }
+  return *this;
+}
+
+
+
+
+SCF_look::SCF_look() 
+{
+#ifdef VERBOSE
+  count++;
+  cout << "SCF_look count ^ " << count << endl;
+#endif
+
+  zeroVars();
+}
+
+
+
+SCF_look::~SCF_look() 
+{
+#ifdef VERBOSE
+  count--;
+  cout << "SCF_look count v" << count << "  " << fName << endl;
+#endif
+
+  discard();
+}
+
+
+
+void SCF_look::zeroVars() 
+{  
+  // BaCh: Added these two inits, especially db_samples caused segfaults *grummel*
+  reversed=0;
+  db_samples=0;
+
+  db_peak_index = NULL;
+  db_bases   = NULL;
+  theRead = NULL;
+  fName   = NULL;
+}
+
+
+void SCF_look::discard()
+{
+  if (db_peak_index != NULL) delete [] db_peak_index;
+  if (db_bases != NULL)      delete [] db_bases;
+  //  if (theRead != NULL)       delete [] theRead;
+  if (fName != NULL)         delete [] fName;
+
+  zeroVars();
+}
+
+
+
+int8 SCF_look::setFilename(const char *filename) 
+{
+  if (filename == NULL) return 1;
+
+  if (fName != NULL) {
+    delete [] fName;
+    fName = NULL;
+  }
+
+  fName = new char[strlen(filename) + 1];
+  strcpy(fName, filename);
+  return 0; 
+}
+
+
+
+int8 SCF_look::load() 
+{
+  if (fName == NULL) return 1;
+  return load(fName);
+}
+
+
+
+void SCF_look::interpolate() {
+  int32 lastBase, step;
+  int32 loop = 1;
+
+  if (db_peak_index[0] == 0) {
+    while (db_peak_index[loop] == 0) { loop++; }
+    for (int32 l = 0; l < loop; l++) {
+      db_peak_index[l] = (db_peak_index[loop] * l) / loop;
+    }
+  }
+  
+  for (; loop < db_samples; loop++) {
+     if (db_peak_index[loop] == 0) {
+
+      /* find the right step-width to interpolate between the bases */
+      lastBase = loop; 
+      while (db_peak_index[lastBase] == 0) lastBase++;
+
+
+      if (lastBase >= db_samples) {
+	assert((db_samples - loop + 1) != 0);
+
+        step = ((int32) SCF_header.samples - 1 -
+		(int32) db_peak_index[loop-1]) / (db_samples - loop + 1);
+      } else {
+	assert((lastBase - loop + 1) != 0);
+
+	step = ((int32) db_peak_index[lastBase] - 
+		(int32) db_peak_index[loop-1]) / (lastBase - loop + 1);
+      }
+
+      /* do the interpolation */
+      while (db_peak_index[loop] == 0 && loop < db_samples) {
+	db_peak_index[loop] = db_peak_index[loop-1] + step;
+        // cout<<"Interpolate "<<loop << ": "<<db_peak_index[loop] << endl;
+	loop++;
+      }
+    }
+  }
+
+}
+
+
+/* 
+   Load an SCF-File and a *.ass file to connect the bases over the 
+   db-positions (instead of using the SCF-file positions. 
+
+*/
+int8 SCF_look::load(const char *filename)
+{
+  FUNCSTART("int8 SCF_look::load(const char *filename)");
+
+  ifstream assignment;
+  char   *fNameAss;
+  char   *fNameSCF;
+  int32  index;
+
+  if (setFilename(filename)) return 1; 
+
+
+  fNameSCF = new char[strlen(filename) + 5];
+  strcpy(fNameSCF, filename);
+  strcat(fNameSCF, "SCF");
+
+  SCF::load(fNameSCF);
+  transposeAmbiguityCodes();
+
+  fNameAss = new char[strlen(filename) + 5];
+  strcpy(fNameAss, filename);
+  strcat(fNameAss, ".ass");
+  assignment.open(fNameAss, ios::in);
+  if(!assignment) {
+    MIRANOTIFY(Notify::WARNING, "Assignmentfile not found for loading: " << fName);
+  }
+  
+  assignment >> db_samples;
+
+  db_peak_index = new uint32[db_samples];
+  db_bases = new uint8[db_samples];
+  
+  {
+     for (int32 loop=0; loop < db_samples; loop++) {    
+      assignment >> db_bases[loop] >> index;
+      if (index != 0) {
+	db_peak_index[loop] = SCF_peak_index[index-1];
+      } else {
+	db_peak_index[loop] = 0;
+      }
+    }
+  }
+
+  interpolate();
+
+  if (db_peak_index[0] > db_peak_index[db_samples-1]) {
+    reversed = 1;
+  } else {
+    reversed = 0;
+  }
+
+  if (fNameSCF != NULL) {
+    delete [] fNameSCF;
+    fNameSCF = NULL;
+  }
+  if (fNameAss != NULL) {
+    delete [] fNameAss;
+    fNameAss = NULL;
+  }
+
+  return 0;
+}
+
+
+
+int8 SCF_look::simpleLoad(const char *filename) {
+
+
+  SCF::load(filename);
+  transposeAmbiguityCodes();
+
+  db_samples = getNumBases();
+
+  db_peak_index = new uint32[db_samples];
+  db_bases = new uint8[db_samples];
+  
+
+  for (int32 loop=0; loop < db_samples; loop++) {    
+    db_bases[loop] = SCF_bases[loop];
+    db_peak_index[loop] = SCF_peak_index[loop];
+    /*
+    cout << loop << " :  " << db_bases[loop] << " " 
+	 << db_peak_index[loop] << endl;
+    */
+  }
+
+  reversed = 0;
+   
+  return 0;
+}
+
+
+// TODO: BaCh 04.10.2008
+//  cleanup this sickening mixture of old char * and string 
+int8 SCF_look::load(const Read &aRead, int32 richtung)
+{
+  FUNCSTART("int8 SCF_look::load(const Read &aRead, int32 richtung)");
+
+  // BaCh 30.07.2009
+  // handle reads that have no adjustments
+  if(!aRead.usesAdjustments()){
+    MIRANOTIFY(Notify::WARNING, "Read has no adjustments: " << aRead.getName());
+  }
+
+  char *fNameSCF = NULL;
+  const vector<char> &sequence = aRead.getActualSequence();
+  const vector<char> &csequence = aRead.getActualComplementSequence();
+
+  theRead = &aRead;
+
+  if (setFilename(aRead.getName().c_str())) return 1;
+
+  try {
+    fNameSCF = new char[aRead.getSCFName().size() + 1];
+    strcpy(fNameSCF, aRead.getSCFName().c_str());
+    
+    string dummy;
+    aRead.getSCFFullPathName(dummy);
+    SCF::load(dummy.c_str());
+    transposeAmbiguityCodes();
+  }
+  catch (Notify n) {
+    cerr << "Error loading SCF-File " << fNameSCF << endl;
+    if (fNameSCF != NULL) { 
+      delete [] fNameSCF; 
+      fNameSCF = NULL; 
+    }
+    discard();
+    zeroVars();
+
+    n.handleError("Error loading SCF-File");
+    MIRANOTIFY(Notify::WARNING, "Error loading SCF-File: " << fNameSCF);
+  }
+
+
+  db_samples = sequence.size();
+
+  db_peak_index = new uint32[db_samples];
+  db_bases = new uint8[db_samples];
+
+
+  const vector<int32> &alignToScf = aRead.getAdjustments();
+
+  { 
+    vector<int32>::const_iterator I = alignToScf.begin();
+
+    if (richtung < 0) { 
+      reversed = 1;
+    } else {
+      reversed = 0;
+    }
+
+    for(int32 loop=0; loop < db_samples; loop++) {
+      int32 dummyPos;
+
+      if (richtung > 0) {
+        db_bases[loop] = sequence[loop];
+	dummyPos = loop;
+      } else {
+	db_bases[loop] = csequence[loop];
+	dummyPos = db_samples - loop - 1;
+      }
+
+      
+      switch (toupper(db_bases[loop])) {
+      case 'A':
+      case 'C':
+      case 'G':
+      case 'T': 
+      case '*': break;
+      default: db_bases[loop] = UNDEFINED_BASE;
+      }
+
+      if (*I < 0 || I == alignToScf.end()) {
+	db_peak_index[dummyPos] = 0;
+      } else {
+	if (*I < (int32)SCF_header.bases) {
+	  db_peak_index[dummyPos] = SCF_peak_index[*I];
+	} else {
+	  discard();
+	  zeroVars();
+
+	  MIRANOTIFY(Notify::WARNING, "Error: inconsistent trace data!");
+	}
+      }
+
+      I++;
+    }
+  }
+
+  interpolate();
+
+  delete [] fNameSCF;
+
+  return 0;
+}
+
+
+
+// =========================================================
+// Some dirty functions
+// hope you know, what you are using!!
+// 
+// These funtions are made to simulate errors for generating negative
+// examples in the lerning set. Bases are inserted, hypotheses are tested
+// and the bases are deleted afterwards. 
+//
+// the size of the array is not changed during insert/delete; thus
+// the last base in the array is duplicated or corrupted!!
+// 
+// We do *not* shift the base-quality values because we:
+//     - expect they are not used
+//     - regard delete/insert as __temporary__ operations that should be
+//       corrected by the converse operation as soon as possible! 
+// 
+
+int32 SCF_look::deleteBaseDB(int32 pos) 
+{
+
+  if (pos < 0 || pos >= db_samples) {
+    return 1;
+  }
+
+  for (int32 loop = pos; loop < db_samples-1; loop++) {
+    db_peak_index[loop] = db_peak_index[loop+1];
+    db_bases[loop] = db_bases[loop+1];
+
+    /*    
+    SCF_prob_A[loop] = SCF_prob_A[loop+1];
+    SCF_prob_C[loop] = SCF_prob_C[loop+1];
+    SCF_prob_G[loop] = SCF_prob_G[loop+1];
+    SCF_prob_T[loop] = SCF_prob_T[loop+1];
+    */
+  }
+
+  //db_samples--;  // do not change sample size
+  return 0;
+}
+
+
+int32 SCF_look::insertBaseDB(int32 pos, int32 scfPos, char newBase)
+{
+
+  if (pos < 0 || pos > db_samples-1) {
+    return -1;
+  }
+
+  for (int32 loop = db_samples-1; loop > pos; loop--) {
+    db_peak_index[loop] = db_peak_index[loop-1];
+    db_bases[loop]      = db_bases[loop-1];
+    
+    /*
+    SCF_prob_A[loop] = SCF_prob_A[loop-1];
+    SCF_prob_C[loop] = SCF_prob_C[loop-1];
+    SCF_prob_G[loop] = SCF_prob_G[loop-1];
+    SCF_prob_T[loop] = SCF_prob_T[loop-1];
+    */
+  }
+
+  db_bases[pos] = newBase;
+
+  {
+    // find a Position for the new peak
+
+    int32 newPeakPos = -1;
+    int32 left;
+    int32 right;
+
+    if (scfPos >= 0) {
+      newPeakPos = SCF_peak_index[scfPos];
+    }
+
+    if (pos > 0) {
+      left = db_peak_index[pos-1];
+    } else {
+      left = db_peak_index[pos];
+    }
+
+    if (pos < db_samples - 1) {
+      right = db_peak_index[pos+1];
+    } else {
+      right = db_peak_index[pos];
+    }
+
+    if (newPeakPos < left || newPeakPos > right) {
+      if (pos > 0 && pos + 1 < db_samples) {
+	db_peak_index[pos] = (left +  right) / 2;
+      }
+    } else {
+      db_peak_index[pos] = newPeakPos;
+    }
+  }
+  return 0;
+}
+
+
+
+int32 SCF_look::alterBaseDB(int32 pos, char newBase) 
+{
+  if (pos < 1 || pos >= db_samples) {
+    return -1;
+  } 
+ 
+  db_bases[pos] = newBase; 
+  if (db_peak_index[pos] < 1) {
+    db_peak_index[pos] = (db_peak_index[pos+1] + db_peak_index[pos-1]) / 2;
+  }
+  
+  return 0;
+}
+
+
+#if 1
+
+// BaCh: let's use the string class here
+t_machinetype SCF_look::getMACHType() const
+{
+  string scfcomments=getComments();
+
+  // use find ... MACH might be present more than once
+  // lets hope the first one is the right one
+  string::size_type startpos = scfcomments.find("MACH=");
+
+  if (startpos != string::npos) {
+    string::size_type endpos = scfcomments.find('\n',startpos);
+    string::size_type foundpos;
+
+    foundpos = scfcomments.find("ABI 3730",startpos);
+    if (foundpos != string::npos && foundpos < endpos) {
+      return MT_ABI_3700;;
+    }
+    foundpos = scfcomments.find("ABI 3700",startpos);
+    if (foundpos != string::npos && foundpos < endpos) {
+      return MT_ABI_3700;;
+    }
+    foundpos = scfcomments.find("ABI3730",startpos);
+    if (foundpos != string::npos && foundpos < endpos) {
+      return MT_ABI_3700;;
+    }
+    foundpos = scfcomments.find("ABI3700",startpos);
+    if (foundpos != string::npos && foundpos < endpos) {
+      return MT_ABI_3700;;
+    }
+    foundpos = scfcomments.find("ABI 373A",startpos);
+    if (foundpos != string::npos && foundpos < endpos) {
+      return MT_ABI_3700;;
+    }
+    foundpos = scfcomments.find("ABI373A",startpos);
+    if (foundpos != string::npos && foundpos < endpos) {
+      return MT_ABI_3700;;
+    }
+    foundpos = scfcomments.find("LI-COR",startpos);
+    if (foundpos != string::npos && foundpos < endpos) {
+      return MT_LICOR;
+    }
+    foundpos = scfcomments.find("MegaBACE",startpos);
+    if (foundpos != string::npos && foundpos < endpos) {
+      return MT_MegaBACE;
+    }
+  }
+
+  return MT_undefined;
+}
+
+#else
+
+// BaCh: valgrind pukes
+t_machinetype SCF_look::getMACHType() const
+{
+  const SCF_Comments *comment;
+  char token[] = "MACH=";
+  char tokenvalue[30];
+    
+  int32   loop=0;
+  int32   i=0;
+  int32   j=0;
+  bool    found = false;
+
+  comment = getComments();
+
+  while (comment[loop] != 0 && found == false) {
+    if (comment[loop] == '\n' || loop == 0) {
+    
+      // Test for token
+      i=0;
+      if (loop > 0) loop++;  // skip the linebreak if not start of comment...
+   
+      while (comment[loop] != 0 && token[i] == comment[loop] && token[i] != 0) {
+	i++; loop++;
+      }
+      
+      // token found read tag....
+      if (token[i] == 0) {
+	j=0;
+	while (j<20 && comment[loop] != 0 && comment[loop] != '\n') {
+	  tokenvalue[j] = comment[loop];
+	  j++; loop++;
+	}
+	tokenvalue[j] = 0;
+	found =  j > 1;
+      }
+    }
+    loop++;
+    
+  }
+
+  if (strstr(tokenvalue, "ABI 373A") != NULL) {
+    //    cout << "ABI3700" << endl;
+    // ABI 3700 !!!!
+    return MT_ABI_3700;
+  }
+  if (strstr(tokenvalue, "LI-COR") != NULL) {
+    // LI-COR
+    // cout << "LICOR" << endl;
+    return MT_LICOR;
+  }
+  if (strstr(tokenvalue, "MegaBACE") != NULL) {
+    // MegaBACE
+    // cout << "MagaBace" << endl;
+    return MT_MegaBACE;
+  }
+   
+  return MT_undefined;
+}
+#endif
+
+
+// End of dirty functions
+// ============================================================
+
+
+
+char* SCF_look::getFileName() const 
+{
+  return fName;
+}
+
+
+uint16* SCF_look::getTraceData(const char dbbase) const 
+{  
+ char aBase = toupper(dbbase);
+
+ if (reversed != 0) aBase = invertBase(aBase);
+
+ switch (aBase) {
+    case 'A': return SCF_samples_A; 
+    case 'C': return SCF_samples_C; 
+    case 'G': return SCF_samples_G; 
+    case 'T': return SCF_samples_T; 
+    default: return NULL;
+  }
+}
+
+
+
+uint16* SCF_look::getTraceData(const char dbbase, int32 isReversed) const
+{  
+ char aBase = dbbase;
+
+ if (isReversed != 0) aBase = invertBase(aBase);
+ switch (aBase) {
+    case 'A': return SCF_samples_A; 
+    case 'C': return SCF_samples_C; 
+    case 'G': return SCF_samples_G; 
+    case 'T': return SCF_samples_T; 
+    default: return NULL;
+  }
+}
+
+
+
+void SCF_look::showDBArea(int32 pos, int32 circle, ostream &output ) {
+  int32 start;
+  int32 end;
+
+  start = max(pos - circle, 0);
+  end   = min(pos + circle, (int32)db_samples - 1);
+
+  while (start <= end) {
+    if (start == pos) output << "->";
+    output << db_bases[start] << " \t";
+    if (start == pos) output << "<- ";
+    start++;
+  }
+
+  output << endl;
+  start = max(pos - circle, 0);
+  while (start <= end) {
+    if (start == pos) output << "->";
+    output << db_peak_index[start] << " \t";
+    if (start == pos) output << "<- ";
+    start++;
+  }
+
+  /*
+  output << endl;
+  start = max(pos - circle, 0);
+  while (start <= end) {
+    if (start == pos) output << "->";
+    output << (int) getDBQuality(start) << "  \t";
+    if (start == pos) output << "<- ";
+    start++;
+  }
+  */
+
+  output << endl;
+  start = max(pos - circle, 0);
+  while (start <= end) {
+    if (start == pos) output << "->";
+    output << start << "  \t";
+    if (start == pos) output << "<- ";
+    start++;
+  }
+
+}
+
+
+// FIXME: scheint irgendwie nicht richtig zu funktionieren?!
+/*
+base_quality_t SCF_look::getDBQuality(int32 dbpos) const
+{
+    if (theRead != NULL) {
+
+    if (dbpos > 0 && dbpos < db_samples) {
+      const vector<base_quality_t> &q = theRead->getQualities();
+      vector<base_quality_t>::const_iterator I = q.begin();
+
+      if (isReversed()) {
+        advance(I, db_samples - dbpos - 1);
+      } else {
+	advance(I, dbpos);
+      }
+
+      return *I;
+    }
+  }
+  
+  return -1;
+
+}
+*/
+
+
+void SCF_look::showArea(int32 pos, int32 circle, ostream &output) {
+  int32 start;
+  int32 end;
+
+  start = max(pos - circle, 0);
+  end   = min(pos + circle, (int)SCF_header.bases - 1);
+  
+  if (reversed == 0) {
+    while (start <= end) {
+      if (start == pos) output << "=>";
+      output << SCF_bases[start] << " ";
+      if (start == pos) output << "<= ";
+      start++;
+    }
+  } else {
+    while (start <= end) {
+      if (end == pos) output << "=>";
+      output << invertBase(SCF_bases[end]) << " ";
+      if (end == pos) output << "<= ";
+      end--;
+    }
+  }
+
+}
+
+
+
+SCF_distance* SCF_look::calcDBDistance(int32 dbPos) 
+{
+  int32 posStart, posEnd;
+  int32 count_steps, count_bases, radius = 5;
+  int32 left, right, rep;
+  int32 min = 999999;
+  int32 max = 0;
+
+  int32 repBases = 0;   // FIXME
+
+  if (db_bases[dbPos] == '*') {
+    posStart = dbPos;
+    while (db_bases[posStart-1] == '*' && posStart > 0) posStart--;
+    posEnd = dbPos;
+    while (db_bases[posEnd+1] == '*' < db_samples-2) posEnd++;
+    repBases = 0;
+  } else {
+    posStart = dbPos;
+    repBases = findRepeatSize(posStart, posEnd);
+  }
+
+  // include distance to the neighbors  
+
+  if (posStart > 1) {
+    do {
+      posStart--;
+      repBases++;
+    } while (posStart > 1 && db_bases[posStart] == '*');
+  }
+
+  if (posEnd < db_samples-1) {
+    do {
+      posEnd++; 
+      repBases++;
+    } while (posEnd < db_samples-1 && db_bases[posEnd] == '*');
+  }
+
+  if (posEnd > db_samples-1) {
+    posEnd = db_samples-1;
+    repBases = repBases - (posEnd - db_samples + 1);
+  }
+
+  count_steps = 0; 
+  count_bases = 0;
+  while (count_bases < radius && count_steps < posStart) {
+    if (GAP_BASE != db_bases[posStart - count_steps]) 
+      { count_bases++; }
+    count_steps++;
+  }
+
+  left = db_peak_index[posStart] - db_peak_index[posStart-count_steps];
+
+  //cout << "left : " << left << " posStart " <<posStart << "  pi:"
+  //   << db_peak_index[posStart] << "-" << db_peak_index[posStart-count_steps]
+  //     << endl;
+
+  count_steps = 0;
+  while (count_bases < (2*radius) && (count_steps + posEnd) < db_samples-1) {
+    if (GAP_BASE != db_bases[posEnd + count_steps]) 
+      { count_bases++; }
+    count_steps++;
+  }  
+  right = db_peak_index[posEnd + count_steps] - db_peak_index[posEnd];
+
+  //  cout << "right : " << right << " posEnd " <<posStart << "  pi:"
+  //     << db_peak_index[posEnd] << "-" << db_peak_index[posEnd+count_steps]
+  //     << endl;
+  {
+    // find minimum/maximum distance between two peaks
+    // => skip gaps in the db_bases!!
+
+    int32 loop = posStart;
+    int32 step = 1;
+
+    while (loop < posEnd) {
+      while (db_bases[loop+step] == '*') step++;
+
+      // BaCh:
+      // gcc3 barfs (rightly) here with the abs()
+      // dirty fix: dirty cast
+      if (abs((int32) db_peak_index[loop+step] - (int32) db_peak_index[loop]) < min) {
+	min = abs((int32) db_peak_index[loop+step] - (int32) db_peak_index[loop]);
+      }
+      if (abs((int32) db_peak_index[loop+step] - (int32) db_peak_index[loop]) > max) {
+	max = abs((int32) db_peak_index[loop+step] - (int32) db_peak_index[loop]);
+      }
+
+      loop += step;
+      step = 1;
+    }
+  }
+  
+  DEBUG_EDIT("Distances: min = " << min << "    max=" << max << endl);
+  DEBUG_EDIT("peak  posStart = " << posStart << "  end=" << posEnd << endl);
+
+  // BaCh:
+  // gcc3 barfs (rightly) here with the abs()
+  // dirty fix: dirty cast
+  rep = abs((int32) db_peak_index[posStart] - (int32) db_peak_index[posEnd]);
+
+  { 
+    SCF_distance *pd = new SCF_distance(dbPos);
+    
+    pd->setMinMaxProblemDistance(min, max);
+    pd->setMeanVicDistance(left+right, count_bases);
+    pd->setProblemDistance(rep, repBases-1);
+
+#ifdef PARAMETER_VERBOSE
+    cout << *pd;
+#endif
+    return pd;
+  }
+}
+
+
+float SCF_look::singlePeakQuality(int32 dbpos, float sigma, char b)
+{
+  int32  minpos, maxpos;
+  char   base;
+  double x;
+
+  if (b == '-') {
+    base = db_bases[dbpos];
+  } else {
+    base = toupper(b);
+  }
+
+
+  if (isBase(base) == false) {
+    // cout << "Not a base! " << endl;
+    // not base: think about it!
+    return -0.01;
+  }
+
+  if (dbpos < 1 || dbpos >= db_samples-1) {
+    // at the fringe: think about it!
+    // cout << "out of range" << endl;
+    return -0.02;
+  }
+
+  wide_range(dbpos, dbpos, minpos, maxpos);
+
+#ifndef RUNONLY
+  assert(maxpos < (int32)SCF_header.samples);
+#endif
+
+
+  if (isRealBase(base)) {
+    x = simpleNormedCorrelation(getTraceData(base), minpos, maxpos, sigma);
+  } else {
+    double dummy = 0;
+    
+    x = 0;
+    for (int16 loop = 0; loop<4; loop++) {
+      dummy += simpleNormedCorrelation(getTraceData("ACGT"[loop]), 
+				      minpos, maxpos, sigma);
+      //if (dummy > x) {
+      //	x = dummy;
+      //}
+    }
+    x = dummy/4;
+  }
+
+  return x;
+}
+
+
+
+// einzelpeak:
+// max        wird mit den maxima der base belegt
+// lage       ein qualit�tsmass f�r die lage des peaks
+// r�ckgabe:  hoehenkriterium   2* peak/(min1 + min2)
+
+float SCF_look::einzelpeak(int32 dbPos, char dbBase, int32 &max, 
+			   float &pos_rating)
+{
+  int32 min_left = 0, min_right = 0, max_pos;
+  int32 von, bis;
+  int32 pl, pr;        // Peak-Position links und rechts
+  int32 fromBase, toBase;
+  float hoehenkriterium = 0;
+  uint16 *samples;
+
+  max = 0;
+  pos_rating = 1;  // we found no peak position of interest until now ;-)
+
+
+  if (dbPos > 0) {
+    // examine peak between two bases (dbPos and the real base on the 
+    // left). Use this if you want to find a missing peek in between.
+    toBase = dbPos;
+    while(0 == isBase(db_bases[toBase]) && toBase < db_samples-1) toBase++;
+    fromBase = dbPos-1;
+    while(0 == isBase(db_bases[fromBase]) && toBase > 1) fromBase--;
+
+    if (fromBase < 1 || toBase >= db_samples-1) {
+      return -1;
+    }
+
+    DEBUG_EDIT("Base Position: " << dbPos << " Base:" << dbBase << endl);
+    DEBUG_EDIT("Between : " << db_bases[fromBase-1] << db_bases[fromBase] \
+	       << "<->"<< db_bases[toBase] << db_bases[toBase+1] << endl);
+
+    von = db_peak_index[fromBase];
+    bis = db_peak_index[toBase];
+    
+    pl = von;
+    pr = bis;
+
+    
+  } else {
+    // examine peak around a base. Use this if you want to examine
+    // an existing peak.
+    dbPos = -dbPos;
+
+    toBase = dbPos+1;
+    while(false == isBase(db_bases[toBase]) && 
+	  toBase < db_samples-1) 
+      toBase++;
+
+    fromBase = dbPos-1;
+    while(false == isBase(db_bases[fromBase]) && 
+	  toBase > 1) 
+      fromBase--;
+
+    if (fromBase < 1 || toBase >= db_samples-1) {
+      return -1;
+    }
+
+    von = db_peak_index[fromBase];
+    bis = db_peak_index[toBase];
+
+    pl = bestPeakBetweenBases(getTraceData(db_bases[fromBase]), von-5, von+5);
+    pr = bestPeakBetweenBases(getTraceData(db_bases[toBase]), bis-5, bis+5);
+
+    if (pl < 1) { pl = von; }
+    if (pr < 1) { pr = bis; }
+
+    range(dbPos, von, bis);
+
+    //cout << "pl = " << pl << "\t pr = " << pr << endl;
+    //cout << "Range : " << von << "-" << bis << endl;
+  }
+
+  samples = getTraceData(dbBase);
+
+  if (samples == NULL) {
+    pos_rating = 0.5;
+    hoehenkriterium = 0.5;
+    max = 0;
+    return hoehenkriterium;
+  }
+
+  if (von > bis) { von ^= bis ^= von ^= bis; }  // swap
+  if (pl  > pr ) { pl  ^= pr  ^=  pl ^= pr;  }  // swap
+
+  min_left  = samples[von];
+  min_right = samples[bis];
+
+  max_pos = bestPeakBetweenBases(getTraceData(dbBase), von, bis) ;
+
+  //cout << "Min_left " << min_left << "  min_right " << min_right << endl;
+  //cout << "max_pos " << max_pos << endl;
+
+  if (0 == max_pos) {
+    DEBUG_EDIT("No Peak found between the Bases\n");
+    pos_rating = 0.5;
+    max = samples[max_pos];
+    return -1;
+  } else {
+    max = samples[max_pos];
+  }
+
+  //cout << "Peak at: " << max_pos << "  max = " << max << endl;
+ 
+  int32 min_abstand = min(max_pos - pl, pr - max_pos);
+
+  if (min_abstand > 0) {
+    pos_rating = 2.0 * ((float)min_abstand) / (float)(pr-pl);  
+  } else {
+    pos_rating = 0.0;
+  }
+
+  // hoehenkriterium
+  if (min_left == 0 && min_right == 0) {
+    if (max > 0) {
+      hoehenkriterium = 1.0;
+    } else {
+      hoehenkriterium = 0.0;
+    }
+  } else {
+    assert ((min_left + min_right) != 0);
+    hoehenkriterium = 0.5 * (float)(min_left + min_right) / max;
+
+    if (hoehenkriterium > 1.0) hoehenkriterium = 1.0;
+  }
+
+  DEBUG_EDIT("Pos_rating : " << pos_rating << 
+             " min_left: " << min_left << " min_right " << min_right <<  
+	     " Hoehenkrit: " << hoehenkriterium << endl);
+
+  return hoehenkriterium;
+}
+
+
+
+
+
+
+
+int32 SCF_look::convergenceRegions(uint16 *samples, int32 von, int32 bis,
+				   int32 &areaMin,  int32 &areaMax)
+{
+  int32 regStart = 0;
+  int32 regEnd   = 0;
+  int32 regArea  = 0;
+  int32 regCount = 0;
+
+  areaMax = 0;
+  areaMin = 0;
+
+
+  if (samples == NULL) return -1;
+  if (von < 1) von = 1;
+  if (bis >= (int32)SCF_header.samples-1) 
+    bis = SCF_header.samples - 2;
+
+  for (int32 loop = von+1; loop < bis; loop++) {
+    if (samples[loop-1] + samples[loop+1] < 2*samples[loop]) {
+      if (loop > regEnd+1) {  // gap or start
+	if (regStart != 0) {
+	  ++regCount;
+
+	  //	  cout << "Region " << regCount << ". " << regStart <<" - " 
+	  //	<< regEnd << "  Area: " << regArea << endl;
+	}
+
+	if (regArea > areaMax) areaMax = regArea;
+        if (areaMin == 0 || regArea < areaMin) areaMin = regArea;
+
+	regStart = loop;
+	regArea = 0;
+      }
+      regEnd = loop;
+      regArea += samples[loop];
+    }
+  }
+
+  if (regStart != 0 && regStart < bis-1) {
+    ++regCount;
+    //cout <<"Region " << regCount << ". " << regStart <<" - " 
+    //	 << regEnd << "  Area: " << regArea);
+  }
+  if (regArea > areaMax) areaMax = regArea;
+  if (areaMin == 0 || regArea < areaMin) areaMin = regArea;
+
+
+  DEBUG_EDIT("\nAreas : Anz: " << regCount << "  Max: " << areaMax 
+	     << "  Area Min: " << areaMin << endl);
+  return regCount;
+}
+
+
+
+void SCF_look::peakRelations(int32 dbPos, char newDBBase, char oldDBBase,
+			     float &newRatio, float &oldRatio, 
+			     float &oldNewRatio)
+{
+  int32 cRatio; 
+  int32 meanPeakSize[4];
+  int32 von, bis;
+
+  char newSCFBase;
+  char oldSCFBase;
+
+  float newMax, oldMax;
+
+  if (isRealBase(newDBBase)) {
+    newSCFBase = toSCFBase(newDBBase, isReversed());
+  } else {
+    int32 max[4], pos[4];
+    findMaxDB(dbPos, max);
+    indirectSort4(max, pos);
+
+    newSCFBase = "ACGT"[pos[0]];
+    newDBBase = toDBBase(newSCFBase, isReversed());
+  }
+
+  if (isRealBase(oldDBBase)) {
+    oldSCFBase = toSCFBase(oldDBBase, isReversed());
+  } else {
+    int32 max[4], pos[4];
+    findMaxDB(dbPos, max);
+    indirectSort4(max, pos);
+
+    if (newSCFBase != "ACGT"[pos[0]]) {
+      oldSCFBase = "ACGT"[pos[0]];
+    } else {
+      oldSCFBase = "ACGT"[pos[1]];
+    }
+    oldDBBase = toDBBase(oldSCFBase, isReversed());
+  }
+
+  DEBUG_EDIT("Examine Peaks for " << oldDBBase << ":" << newDBBase << endl);
+
+  if (dbPos >= db_samples || dbPos < 0) {
+    cerr << "peakRelations: Examining base that is out of range!" << endl; 
+    newRatio    = 0.0;
+    oldRatio    = 0.0;
+    oldNewRatio = 0.0;
+    return;
+  }
+
+  noiseRatioDB(dbPos, qualityRadius, cRatio, meanPeakSize);
+  range(dbPos, von, bis);
+
+  if ((von+bis) / 2 >= (int32) SCF_header.samples || (von+bis) < 0) {
+    cerr << "Illegal position!!! " << endl;
+  }
+
+  uint16 *samples_old = getTraceData(oldDBBase);
+  uint16 *samples_new = getTraceData(newDBBase);
+
+  if (samples_old != NULL) {
+    int32 peakPosOld = bestPeakBetweenBases(samples_old, von, bis);
+
+    if (peakPosOld > 0) {
+      oldMax = samples_old[peakPosOld];
+    } else {
+      oldMax = samples_old[(von+bis)/2];
+    }
+  } else {
+    oldMax = (SCF_samples_A[(von+bis)/2] + SCF_samples_C[(von+bis)/2] +
+	      SCF_samples_G[(von+bis)/2] + SCF_samples_T[(von+bis)/2])/4;
+
+	//findMaxDBHalf(dbPos, peakMax);
+	//oldMax = valueForBase(peakMax, oldSCFBase);
+  }
+
+
+  if (samples_new != NULL) {
+    int32 peakPosNew = bestPeakBetweenBases(samples_new, von, bis);
+    
+    
+    if (peakPosNew > 0) {
+      newMax = samples_new[peakPosNew];
+    } else {
+      newMax = samples_new[(von+bis)/2];
+    }
+  } else {
+    newMax = (SCF_samples_A[(von+bis)/2] + SCF_samples_C[(von+bis)/2] +
+	      SCF_samples_G[(von+bis)/2] + SCF_samples_T[(von+bis)/2])/4;
+
+    //findMaxDBHalf(dbPos, peakMax);
+    //newMax = valueForBase(peakMax, newSCFBase);  
+  }
+
+  //  int newMax  = valueForBase(peakMax, newSCFBase);
+  float newMean = (float) valueForBase(meanPeakSize, newSCFBase);
+  //int oldMax  = valueForBase(peakMax, oldSCFBase);
+  float oldMean = (float) valueForBase(meanPeakSize, oldSCFBase);
+
+  newRatio = oldRatio = 1.0;
+  oldNewRatio = 0.0;
+
+  // FIXME
+  // Wenn es einen peak gibt, w�re es besser den peakwert zu nehmen!
+  //  if (max_old == 0) { max_old = called_base; }
+  //  if (max_new == 0) { max_new = hypo_base;}
+
+  DEBUG_EDIT(newSCFBase <<" New Mean: "<<newMean<<" Max " << newMax << endl);
+  DEBUG_EDIT(oldSCFBase << " Old Mean: "<<oldMean << " Max "<<oldMax << endl);
+
+  if (newMean > 0.01) {
+    newRatio = newMax / newMean;
+  }
+  if (oldMean > 0.01) { 
+    oldRatio = oldMax / oldMean;
+  }
+  if (oldMax > 0.01) {
+    oldNewRatio = newMax/ oldMax;
+  } else {
+    oldNewRatio = 0.0;
+  }
+
+  DEBUG_EDIT("MaxOld : " << oldMax << " MaxNew: " << newMax << endl);
+
+  return;
+}
+
+
+
+int32 SCF_look::findNextMax(const uint16 *samples, const int32 samplePos, 
+			    const bool forward) 
+{
+  int32 i = samplePos;
+  
+  while (i > 0 && i < (int32)SCF_header.samples-1) {
+    if (samples[i-1] < samples[i] && samples[i+1] <= samples[i]) {
+      // Maximum
+      return i;
+    }
+    if (forward) { i++; } else { i--; }
+  }
+  return i;
+}
+
+
+
+int32 SCF_look::findNextMin(const uint16 *samples, const int32 samplePos, 
+			    const bool forward) 
+{
+  int32 i = samplePos;
+  
+  while (i > 0 && i < (int32)SCF_header.samples-1) {
+    if (samples[i-1] >= samples[i] && samples[i+1] > samples[i]) {
+      // Maximum
+      return i;
+    }
+
+    if (forward) { i++; } else { i--; }
+  }
+  return i;
+}
+
+
+int32 SCF_look::findNextSlopeChange(const uint16 *samples, 
+				    const int32 samplePos, 
+				    const bool forward) 
+{
+  int32 i = samplePos;
+
+  while (i > 0 && i < (int32)SCF_header.samples-1) {
+    if (slopeChangeTest(samples, i))
+      return i;
+
+    if (forward) { i++; } else { i--; }
+  }
+  return i;
+}
+
+
+
+float SCF_look::peakValleyValues(const int32 dbPos, const char base,
+				 float result[6])
+{
+  bool  peak, conv, rest;  // what have we found
+  int32 von, bis, mitte;   // area until halfway to the next base
+  int32 EP, EV;            // Extrema-Peak and Extrema-Valley position
+  int32 EC, ED;            // medium Peak - convergent  and divergent point
+  int32 WC, WD;            // schwache Peaks - convergent/divergent
+  int32 L, R;              // Positions to the left/right 
+  //int32 PeakPos, ValleyPos;// Positon of the actually used Peak/Valley 
+  float SP, MP, WP;        // Strong, medium and weak peak-values
+  float SV, MV, WV;        // Strong, medium and weak valleys. 
+  uint16 *samples;         // samplesdate 
+  
+  /*
+  uint16 samples[15];
+
+  
+  samples[0] = 0;
+  samples[1] = 39;
+  samples[2] = 14;
+  samples[3] = 47;
+  samples[4] = 375;
+  samples[5] = 404;
+  samples[6] = 464;
+  samples[7] = 704;
+  samples[8] = 833;
+  samples[9] = 702;
+  samples[10] = 570;
+  samples[11] = 1401;
+  samples[12] = 1321;
+  samples[13] = 0;
+  samples[14] = 0;
+
+  von = 1; bis = 12;
+  */
+
+  range(dbPos, von, bis);
+  mitte = (von + bis + 1) / 2;
+
+  samples = getTraceData(base);
+  
+  if (samples == NULL) {
+#ifdef VERBOSE_PARAMETER
+    cout << "No Samples" << endl;
+#endif
+    return 0;
+  }
+  
+  EP = bestPeakBetweenBases(samples, von, bis);
+  EV = bestValleyBetweenBases(samples, von, bis);
+  constSlopeBetweenBases(samples, von, bis, EC, ED);
+  findBestWeakPeak(samples, von, bis, WC, WD);
+
+#ifdef PARAMETER_VERBOSE
+  cout << "===============================" << endl;
+  cout << "Base : " << base << endl;
+  cout << "Peaks    : EP " << EP << " EV " << EV << endl;
+  cout << "Shoulders: EC " << EC << " ED " << ED << endl;
+  cout << "Weak     : WC " << WC << " WD " << WD << endl;
+#endif
+
+  // Calculate Peak-Values
+  peak = conv = rest = false;
+  
+  if (EP > 0) {
+    int32 dp = abs(EP-mitte);
+    if (EC > 0) {
+      int32 dc = abs(EC-mitte);
+      if (dp <= dc) {
+	peak = true;
+      } else {
+	conv = true;
+      }
+    } else {
+      peak = true;
+    }
+  } else {
+    if (EC > 0) {
+      conv = true;
+    } else {
+      rest = true;
+    }
+  }
+	
+  if (peak == true) {
+    L = findNextMin(samples, EP, true);
+    R = findNextMin(samples, EP, false);
+
+    if (samples[EP] == 0) {
+      SP = 0.0;
+    } else {
+      SP = 1.0 - (float)(samples[L] + samples[R]) / (2.0 * samples[EP]);
+    }
+
+    MP = 1.0 - SP;
+    WP = 0.0;
+
+    //    cout << "L: " << samples[L] << " R: " << samples[R] << " EP " 
+    // << samples[EP] << " ==> " << SP << endl;
+    
+    assert ((bis-von) != 0);
+
+    SP = SP * (1.0 - (float)(abs(EP - mitte))/(float)(bis-von));
+    MP = MP * (1.0 - (float)(abs(EP - mitte))/(bis-von)); 
+  } else {
+    SP = 0.0;
+    MP = 0.0;
+    WP = 1.0;
+  }
+
+  if (conv == true) {
+    L = findNextSlopeChange(samples, EC-1, false);
+    R = findNextSlopeChange(samples, EC+1, true);
+
+    {
+    int32 m = max(samples[L], samples[R]);
+
+    SP = 0.0;
+    if (m == 0) {
+      WP = 1.0;
+    } else {
+      assert(m != 0);
+
+      WP = ((float)m - samples[EC]) / m;
+    }
+    MP = 1.0 - WP;
+
+
+
+
+    MP = MP * (1.0 - (float)abs(EC - mitte)/(float)(bis-von));
+    WP = WP * (1.0 - (float)abs(EC - mitte)/(float)(bis-von));
+
+    //    cout << "ConstSlope: "  << L << " " << EC << " " << R 
+    // << " ==> " << WP << endl;
+    }
+  } 
+
+  if (rest == true) {
+     if (WC != 0) {
+       assert((bis - von) != 0);
+
+       WP = 1.0 - ((float)abs(WC - mitte)/(float)(bis-von));
+    } else {
+      WP = 0.0;
+    }
+
+    SP = 0.0;
+    MP = 0.0;
+  }
+
+
+  // Now the same for valleys....
+  peak = conv = rest = false;
+
+  if (EV > 0) {
+    int32 dv = abs(EV - mitte);
+    if (ED > 0) {
+      int32 dd = abs(ED - mitte);
+
+      if (dv <= dd) {
+	peak = true;
+      } else {
+	conv = true;
+      }
+    } else {
+      peak = true;
+    }
+  } else {
+    if (ED > 0) {
+      conv = true;
+    } else {
+      rest = true;
+    }
+  }
+
+  // Calculate Valley
+  if (peak == true) {
+    L = findNextMax(samples, EV, true);
+    R = findNextMax(samples, EV, false);
+   
+    assert((samples[L] + samples[R]) != 0);
+    assert((bis - von) != 0);
+
+    SV = 1.0 - (float)samples[EV] / (float)(samples[L] + samples[R]);
+    MV = 1.0 - SV;
+    WV = 0.0;
+
+    SV = SV * (1.0 - (float)(abs(EV - mitte))/(float)(bis-von));
+    MV = MV * (1.0 - (float)(abs(EV - mitte))/(bis-von));
+ 
+    //    cout << "L: " << L << " R: " << R << " EV " << EV 
+    //	 << " ==> " << SV << endl;
+  } else {
+    SV = 0.0;
+    MV = 0.0;
+    WV = 1.0;
+  }
+
+
+  if (conv == true) {
+    L = findNextSlopeChange(samples, ED-1, false);
+    R = findNextSlopeChange(samples, ED+1, true);
+
+    if (samples[ED] == 0) {
+      MV = 1.0;
+    } else {
+      MV = 1.0 - (float)(samples[ED] - min(samples[L], samples[R])) 
+	/ (float)samples[ED];
+    }
+
+    WV = 1.0 - MV;
+    SV = 0;
+
+    assert((bis - von) != 0);
+
+    MV = MV * (1.0 - (float)abs(ED - mitte)/(float)(bis-von));
+    WV = WV * (1.0 - (float)abs(ED - mitte)/(float)(bis-von));
+
+    //    cout << "L: " << L << " R: " << R << " ED " << ED 
+    //	 << " ==> " << WV << endl;
+  }
+
+  if (rest == true) {
+    if (WD != 0) {
+      assert((bis - von) != 0);
+
+      WV = 1.0 - ((float)abs(WD - mitte)/(float)(bis-von));
+
+      //      cout << "WV " << WV << " mitte: " << mitte << " bis-von" 
+      //	   << bis-von <<endl;
+    } else {
+      WV = 0.0;
+    }
+
+    SV = 0.0;
+    MV = 0.0;
+  }
+
+
+  result[0] = SP; 
+  result[1] = MP;
+  result[2] = WP;  
+  result[3] = SV;
+  result[4] = MV;
+  result[5] = WV;
+  
+  return (SP + MP);
+} 
+
+
+
+int32 SCF_look::countPeaksInTrace(uint16 *samples, int32 von, int32 bis, 
+				  int32 &peak, int16 &qual)
+{
+  int32 i = von;
+  int32 anzPeak = 0;
+  int32 peakSum = 0;
+  int32 diffSum = 0;
+  int32 lastPeak = 0;
+
+  // �berlese absteigenden Teil
+  while (samples[i] < samples[i-1] && i < bis)  i++; 
+
+  //1  lastPeak = samples[i];
+
+  while (i < bis) {
+    if (samples[i-1] <  samples[i] && samples[i+1] <= samples[i]) {
+      // Maximum
+      peakSum += samples[i];
+
+      if (anzPeak != 0) {
+	diffSum += abs(lastPeak - samples[i]);
+      }
+
+      //      cout << "Peak at : " << i << "\t" << samples[i-1]
+      //	   << " " << samples[i] << " " << samples[i+1] << endl;
+      anzPeak++;
+
+      lastPeak = samples[i];
+    }
+    if (samples[i-1] > samples[i] && samples[i+1] >= samples[i]) {
+      // Minimum
+      peakSum += samples[i];
+
+      if (anzPeak != 0) {
+	diffSum += abs(lastPeak - samples[i]);
+      }
+
+      lastPeak = samples[i];
+    }  
+    i++; 
+  }
+  
+  if (peakSum > 0 && diffSum > 0) {
+    qual = (100 * diffSum) / peakSum;
+  } else {
+    if (peakSum > 0) {
+      qual = 200 - (100 * (samples[von] + samples[bis])) / peakSum ;
+    } else {
+      qual = 0;
+    }
+  }
+
+  peak = lastPeak;
+
+  return anzPeak;
+}
+
+
+int32 SCF_look::calcConvergenceRegionQuality(int32 dbPos) {
+  int32 fromBase, toBase;
+  int32 von, bis, peak, q;
+
+  // Skip gaps on both sides of the BOI 
+  toBase = dbPos;
+  while(0 == isBase(db_bases[toBase]) && toBase < db_samples-1) toBase++;
+  fromBase = dbPos;
+  while(0 == isBase(db_bases[fromBase]) && toBase > 1) fromBase--;
+
+  DEBUG_EDIT("  ConvergenceRegionQuality: " << endl);
+  DEBUG_EDIT("  From Base " << fromBase << " toBase " << toBase << endl);
+
+  if (fromBase < 1 || toBase >= db_samples-1) {
+    return -1;
+  }
+
+  von = db_peak_index[fromBase];
+  bis = db_peak_index[toBase];
+
+  if (von > bis) { von ^= bis ^= von ^= bis; }  // swap
+
+  if (von > 4) {
+    von = von - 4;
+  } else {
+    von = 1;
+  }
+
+  if (bis + 5 < (int32)SCF_header.samples) {
+    bis = bis + 4;
+  } else {
+    bis = SCF_header.samples - 2;
+  }
+
+  {
+    uint16 *trace = getTraceData(db_bases[fromBase]);
+    
+    if (trace != NULL) { 
+      peak = bestConvergenceRegion(trace, von, bis);
+    } else {
+      // e.g. if fromBase is an undefined base
+      peak = von;  // not in the middle ->low quality
+    }
+  }
+
+  q = 0;
+  if (von != bis) {
+    q = (200 * min(peak - von, bis - peak))/(bis-von);   // q in [0...100]
+  } 
+
+  DEBUG_EDIT("  Quality [0..100] : " << q << endl);
+  
+  return q;
+}
+
+
+// Count the peaks in the trace for `base` between the base
+// [basePos-1, basePos]
+
+int32 SCF_look::countPeaksBetweenBases(char base, int32 basePos)
+{
+  int32  last_max_pos;
+  int16  qual;         // peak quality measure
+  uint16 *samples;
+
+  samples = getTraceData(base);  // get the trace for this base 
+  if (samples == NULL) {
+    return -1;
+  } else {
+    return countPeaksInTrace(
+	     samples, 
+	     db_peak_index[basePos-1] + 1, 
+	     db_peak_index[basePos] - 1,
+	     last_max_pos, qual);
+  }  
+}
+
+
+
+
+
+int32 SCF_look::countConvergenceRegions(int32 dbBasePos, char base,
+					int32 &minArea, int32 &maxArea)
+{
+  int32 dbBaseBis, dbBaseVon = dbBasePos;
+  int32 minPos = 1;
+  int32 maxPos = SCF_header.samples-1;
+  int32 convRegs = 0;
+
+  assert(isBase(base));
+
+  if (isRealBase(base)) {
+    findRepeatSize(dbBaseVon, dbBaseBis);
+    wide_range(dbBaseVon, dbBaseBis, minPos, maxPos);
+    convRegs = convergenceRegions(getTraceData(base), minPos, maxPos, 	
+			minArea, maxArea);
+
+    DEBUG_EDIT("Convergence Regions: " << convRegs << endl);
+    return (abs(dbBaseBis - dbBaseVon) - convRegs);
+  } else {
+   int32 max[4], pos[4];
+   int32 regCount1, regCount2;
+   int32 areaMin1 = 0, areaMin2 = 0, areaMax1 = 0, areaMax2 = 0;
+   char  base1, base2;
+
+   findMaxDB(dbBasePos, max);
+   indirectSort4(max, pos);
+
+   base1 = "ACGT"[pos[0]];
+   base2 = "ACGT"[pos[1]];
+
+   wide_range(dbBasePos, dbBasePos, minPos, maxPos);
+     
+   regCount1 = convergenceRegions(getTraceData(base1), 
+ 		            minPos, maxPos, areaMin1, areaMax1);
+
+   regCount2 = convergenceRegions(getTraceData(base2), 
+			    minPos, maxPos, areaMin2, areaMax2);
+
+   if (regCount1 == regCount2) {
+     maxArea = (areaMax1 + areaMax2)/2;
+     minArea = (areaMin1 + areaMin2)/2;
+     return (regCount1 - 1);
+   }
+   if (regCount1 > regCount2) {
+     minArea = areaMin1;
+     maxArea = areaMax1;
+     return (regCount1 - 1);
+   } else {
+     minArea = areaMin2;
+     maxArea = areaMax2;
+     return (regCount2 - 1);
+   }
+  }
+}
+
+
+int32 SCF_look::countRepeatPeaks(const int32 basePos, const char base, 
+				 int16 &anzRepeat, int16 &anzPeaks, 
+				 int16 &qual)
+{
+  FUNCSTART("int32 SCF_look::countRepeatPeaks(const int32 basePos, const char base, int16 &anzRepeat, int16 &anzPeaks, int16 &qual)");
+
+  int32 minPos = 1;
+  int32 maxPos = SCF_header.samples-1;
+  int32 baseVon = basePos;
+  int32 baseBis = basePos;
+  int32 peakPos;
+  uint16 *samples;
+
+  // Ermittelt l�nge des repeats und setzt basePos auf die erste base
+  // und baseBis auf die letzte Base des repeats. Ermittle dann die
+  // zugeh�rigen sample positionen
+
+  if (db_bases[basePos] != base) {
+    anzRepeat = 0;
+  } else {
+    anzRepeat = findRepeatSize(baseVon, baseBis);
+  }
+
+  wide_range(baseVon, baseBis, minPos, maxPos);
+
+  if (isBase(base)) {
+    samples = getTraceData(base);
+  } else {
+    samples = getTraceData(db_bases[baseVon]);
+  }
+
+  if (samples == NULL) {
+    anzPeaks  = 0;
+    qual      = 0;
+    
+    MIRANOTIFY(Notify::WARNING, "SCF_look::countRepeatPeaks: NoTrace");
+  } else {
+    anzPeaks = countPeaksInTrace(samples, minPos, maxPos, peakPos, qual);
+    return anzRepeat - anzPeaks; 
+  }
+}
+
+
+
+int32 SCF_look::countDBPeaks(int32 basePos, int16 &anzRepeat, 
+			     int16 &anzPeaks, int16 &qual) {
+
+  int32 minPos = 1;
+  int32 maxPos = SCF_header.samples-1;
+  uint16 * samples;
+
+  anzRepeat = 1;
+  anzPeaks  = 0;
+  
+  //  if (basePos < 0) basePos = problem->dbPos();
+
+  {
+    // Ermittelt l�nge des repeats und setzt basePos auf die erste base
+    // und baseBis auf die letzte Base des repeats.
+    int32 baseBis = 0;
+
+    anzRepeat = findRepeatSize(basePos, baseBis);
+    wide_range(basePos, baseBis, minPos, maxPos);
+  }
+
+  if (isRealBase(db_bases[basePos])) {     
+    int32 peakPos;
+
+    samples = getTraceData(db_bases[basePos]); 
+
+    anzPeaks = countPeaksInTrace(samples, minPos, maxPos, peakPos, qual);
+
+    DEBUG_EDIT("Extrema: " << anzPeaks << " Basen: " << anzRepeat<< endl);
+  } 
+
+  return anzRepeat - anzPeaks;
+}
+
+
+
+
+
+// Returns the length of the repeat and sets the parameter pos_von 
+// to the first base and pos_bis to the last base of the repeat
+int32 SCF_look::findRepeatSize(int32 &dbPosVon, int32 &dbPosBis)
+{
+  int32 base_count = 1;
+  char  repeatBase = db_bases[dbPosVon];
+
+  dbPosBis = dbPosVon;
+
+  while ((repeatBase == db_bases[dbPosVon - 1] || 
+	  db_bases[dbPosVon - 1] == GAP_BASE) && dbPosVon > 1) { 
+
+    dbPosVon--;   
+    if (db_bases[dbPosVon] != GAP_BASE) { 
+      base_count++; 
+    } 
+  }
+
+  while ((repeatBase == db_bases[dbPosBis + 1] ||
+	 db_bases[dbPosBis + 1] == GAP_BASE) && dbPosBis < db_samples-1) { 
+    dbPosBis ++;
+    
+    if (db_bases[dbPosBis] != GAP_BASE) {  
+      base_count++; 
+    }
+  }
+
+  return base_count;
+}
+
+
+ 
+//  Ermittelt f�r aufeinanderfolgende Peaks der gleichen Base das 
+//  prozentuale Verh�ltnisder mittleren Zwischentaltiefen 
+//  zur mittleren Peakh�he in einer Umgebung um die angegebene Stelle
+ 
+int16 SCF_look::peakQuality(int32 pos, int32 radius) {
+  int32  minPos, maxPos;
+  uint16 minimum, max1, max2;
+  int32  von, bis; 
+  uint32 distance_sum = 0, distance_max = 0;
+  uint16 *trace;
+  char   base;
+ 
+  minPos = max(2, pos - radius);
+  maxPos = min(db_samples - 3, pos + radius);
+  
+  for (int32 loop = minPos + 1; loop <= maxPos; loop++){
+    if (db_bases[loop] == db_bases[loop-1]) {
+      base = db_bases[loop];
+
+      if (isRealBase(base)) {
+        trace = getTraceData(base);
+	minimum=findMinBase(trace, db_peak_index[loop-1], db_peak_index[loop]);
+
+	range(loop - 1, von, bis);
+	max1 = findMaxBase(trace, von, bis) / 2;
+	range(loop, von, bis); 
+	max2 = findMaxBase(trace, von, bis) / 2;
+
+	distance_sum = distance_sum + max1 + max2 - minimum;
+	distance_max = distance_max + max1 + max2;
+	
+	//cout << "Min " << min << "  Max " << max1 << ";" << max2;
+	//cout << "  Sum " << distance_sum << "  Anz " << distance_max;
+	//cout << " Base: " << db_bases[loop] << endl;
+      } 
+    }
+  }  
+  if (distance_max > 0) {
+    return distance_sum * 100 / distance_max;
+  } else {
+    return 0;
+  }
+}
+
+
+
+// Calculate the average relative-to-maximum noise of all three not-maximal traces in
+// the given region (db positions)
+
+float SCF_look::noiseRatioAll(uint32 min_pos, uint32 max_pos) 
+{
+  int32 first_sample, last_sample;
+  int32 max_array[4];
+  float sum_noise = 0;
+
+  if (min_pos > max_pos) {
+    uint32 dummy = min_pos;
+    min_pos = max_pos; max_pos = dummy;
+  }
+
+  for (uint32 loop = min_pos; loop <= max_pos; loop++) {
+    int32 max_intensity = 0;
+    int32 sum_intensity = 0;
+
+    half_range(loop, first_sample, last_sample);
+    max_intensity = findMaxDB(max_array, first_sample, last_sample);
+    sum_intensity = -max_intensity; // subtract peak from the noise
+ 
+    for (int16 j = 0; j < 4; j++) {
+      sum_intensity += max_array[j];  // sum up the intensities 
+    }
+
+    if (max_intensity > 0) {
+      sum_noise += (float)sum_intensity / (float)max_intensity;    
+    } else {
+      sum_noise += 1;
+    }
+
+  }
+
+  return (sum_noise / float(max_pos - min_pos + 1));
+}
+
+
+// Calculate the mean of lowest intensity of all for traces for the given region
+// (as db-positions)
+
+
+float SCF_look::meanBaseline(uint32 min_pos, uint32 max_pos)
+{  
+  int32 first_sample, last_sample;
+  int32 min_array[4];
+  int32 sum_intensity = 0;
+  int32 min_intensity;
+
+
+  if (min_pos > max_pos) {
+    uint32 dummy = min_pos;
+    min_pos = max_pos; max_pos = dummy;
+  }
+
+  // Step through all bases....
+  for (uint32 loop = min_pos; loop <= max_pos; loop++) {
+    range(loop, first_sample, last_sample);
+    min_intensity = findMinDB(min_array, first_sample, last_sample);    
+
+    sum_intensity += min_intensity;
+  }
+  
+  return (float)sum_intensity/(max_pos - min_pos + 1);
+}
+
+
+
+//  calculate for all bases the ratio called/best_non_called and 
+//  calculate the frequency of bases with a ratio less that 2 
+int32 SCF_look::calledNoncalledRatioDB(int32 pos, int32 radius) 
+{
+  uint32 minPos, maxPos;
+  int32 first_sample, last_sample;
+  int32 max_array[4];
+  int32 bad = 0;
+  float value = 0.0;
+
+  // find the region where we want to examine the trace...
+  minPos = max(2, pos - radius);
+  maxPos = min(db_samples - 2, pos + radius);
+
+
+  for (uint32 loop = minPos; loop <= maxPos; loop++) {
+    int32 m0 = 1, m1 = 1, m2 = 1;
+
+    half_range(loop, first_sample, last_sample);
+    m0 = findMaxDB(max_array, first_sample, last_sample);
+
+    // max_array contains the highest intensity value for the four bases
+    // in a small vicinity of the called base
+
+    for (int16 j = 0; j < 4; j++) { 
+      if (max_array[j] > m1) {
+	m2 = m1; 
+	m1 = max_array[j];
+      } else {
+	if (max_array[j] > m2) {
+	  m2 = max_array[j];
+	}
+      }
+    }
+
+    /*
+      if ((float(m1) / float(m2)) < min_value) {
+        min_value = float(m1) /float(m2);
+      }
+    */
+
+    assert (m2 != 0);
+
+    if ((float(m1) / float(m2)) < 2.0) { 
+      bad++ ;
+    }
+
+    value += (float(m1) / float(m2));
+  }
+
+  assert((1 + maxPos - minPos) != 0);
+
+  return ((100* bad) / (1 + maxPos - minPos)); 
+}
+
+
+/* 
+   Calculate the mean ratio between called bases and non-called bases
+   in the area around pos. r_min is the worst ratio of all four bases 
+*/
+
+
+int32 SCF_look::noiseRatioDB(int32 pos, int32 radius, 
+			     int32 &c_ratio, int32 meanPeakSize[4]) 
+{
+  int32 minPos = pos - radius;
+  int32 maxPos = pos + radius;
+
+  if (minPos < 1) { minPos = 1; }
+  if (maxPos >= db_samples) { maxPos = db_samples-1; }
+
+  if (db_bases[pos] == UNDEFINED_BASE) {
+    return meanCalledLevel(minPos, maxPos, pos, c_ratio, meanPeakSize);
+  } else {
+    return noiseRatioBaseDB(minPos, maxPos, pos, c_ratio, meanPeakSize);
+  } 
+
+}
+
+
+
+/* Calculate the mean level of a called base. */
+/* Returns 10 * signal / noise */
+
+int32 SCF_look::meanCalledLevel(int32 minPos, int32 maxPos, int32 pos, 
+				int32 &relMax, int32 meanPeakSize[4]) 
+{
+  int32 summe = 0; 
+  int32 nc_summe = 0;
+  int32 count = 0;
+  int32 max, max_array[4], noise;
+  int32 pos_max  = 0;  // base_max for the base at pos
+  int32 left, right;
+
+  {
+    int32 dummy_pos = pos;
+
+    while (dummy_pos < db_samples &&
+	   db_bases[dummy_pos] == UNDEFINED_BASE) 
+      dummy_pos++;
+    noiseRatioBaseDB(minPos, maxPos, dummy_pos, relMax, meanPeakSize);
+  }
+
+  half_range(pos, left, right);
+  pos_max = findMaxDB(max_array, left+1, right-1);
+
+  for (int32 loop = minPos; loop <= maxPos; loop++) {
+    findMaxDB(loop, max_array);
+    max = 0; noise = 0;
+    
+    if (isRealBase(db_bases[loop])) {
+      for (int16 k = 0; k < 4; k++) {
+	if (max < max_array[k]) {
+          noise = max;
+	  max = max_array[k]; 
+	} else {
+	  if (max_array[k] > noise) noise = max_array[k];
+	}
+      }
+      summe += max;  // We assume the called base to be the highest
+      nc_summe += noise;
+      count++;
+    }
+  }
+
+  
+  if (count > 0) {
+    int16 mean_call = summe / count;
+
+    if (mean_call == 0) {
+      relMax = 100;
+    } else {
+      relMax = (100 * pos_max) / mean_call;
+    }
+
+#ifdef PARAMETER_VERBOSE
+    cout << "Mean of all called bases: "<< mean_call << endl;
+    cout << "Max of base at position : "<< pos_max  << endl;
+    cout << "Ratio average-call/call : "<< relMax   << endl;
+    if (nc_summe != 0) {
+      cout << "c_ratio                 : "<< (10*summe) / nc_summe << endl;
+    } else {
+      cout << "c_ratio --- no noise found" << endl;
+    }
+#endif
+
+    if (nc_summe == 0) {
+      // no noise at all - assume signal/noise = 5
+      return 50;
+    } else {  
+      return (10 * summe) / nc_summe;
+    }
+
+  } else {
+    relMax = 100;
+    return -1;
+  }
+
+  /* 
+  RelMax    ist der prozentuale Anteil, einer mittleren gecallten Base, 
+            den das Maximum an der untersuchten Stelle erreicht hat.
+  R�ckgabe  das mit Verh�ltnis 10 * signal/noise
+  */	    
+}
+
+
+
+void SCF_look::meanTraceValues(int32 mean[4], int32 offset)
+{
+  mean[0] = mean[1] = mean[2] = mean[3] = 0;
+  
+  if ((int32)SCF_header.samples <= offset) {
+    return;
+  }
+
+  for (uint32 loop = offset; loop < SCF_header.samples-1; loop++) {
+    mean[0] += (int32)SCF_samples_A[loop]; 
+    mean[1] += (int32)SCF_samples_C[loop];
+    mean[2] += (int32)SCF_samples_G[loop];
+    mean[3] += (int32)SCF_samples_T[loop];
+  } 
+
+  for (int32 loop = 0; loop < 4; loop++) {
+    assert(offset != (int32)SCF_header.samples);
+
+    mean[loop] = mean[loop] / (SCF_header.samples - offset);
+  }
+}
+
+
+bool SCF_look::localPeakOverMean(char base, int32 scfPos, int32 radius,
+				 int32 &above_mean)
+{
+  uint16 *the_trace;
+  int32  von, bis, sum, position;
+  
+  switch (base) {
+  case 'A': the_trace = SCF_samples_A; break;
+  case 'C': the_trace = SCF_samples_C; break;
+  case 'G': the_trace = SCF_samples_G; break;
+  case 'T': the_trace = SCF_samples_T; break;
+  default: return false;
+  }
+
+  if (scfPos < 0 || scfPos >= (int32)SCF_header.bases) {
+    return false;
+  }
+
+  position = SCF_peak_index[scfPos];
+  von = 0;
+  if (position > radius) {
+    von = position - radius;
+  } else {
+    von = 0;
+  }
+
+  if (position + radius < (int32)SCF_header.samples) {
+    bis = position + radius;
+  } else {
+    bis = SCF_header.samples-1;
+  }
+
+  sum = 0;
+  
+  sum = the_trace[(SCF_peak_index[scfPos-1] + position) / 2] +
+        the_trace[(SCF_peak_index[scfPos+1] + position) / 2];
+
+  /*
+  for (int32 loop = von; loop < bis; loop++) {
+    sum += (int32)the_trace[loop]; 
+  } 
+  */
+
+  if (bis > von) {
+    above_mean = the_trace[position] - (sum / 2);
+    return true;
+  } else {
+    return false;
+  }
+}
+
+
+
+
+int32 SCF_look::noiseRatioBaseDB(int32 minPos, int32 maxPos, int32 pos,
+				 int32 &c_ratio, int32 meanPeakSize[4]) {
+  int32 max_array[4], num_called[4], num_ncalled[4], r_min = 0;
+  int32 sum_called[4], sum_ncalled[4];
+
+  c_ratio = -1;
+
+  for (int16 i = 0; i < 4; i++) {
+    num_called[i]  = 0;
+    num_ncalled[i] = 0;
+    sum_called[i]  = 0;
+    sum_ncalled[i] = 0;
+  }
+
+  if (pos >= db_samples-1 || pos < 0) {
+     return 0;
+  }
+
+  if (maxPos >= db_samples - 2) maxPos = db_samples - 2;
+  if (minPos <=  1) minPos = 2;
+
+  //  cout << "noiseRatioBaseDB " << endl
+  //     << "minPos " << minPos << "  MaxPos " << maxPos << endl;
+  /* wir betrachten die intervalle [first_sample; last_sample[ */
+
+  for (int32 loop = minPos; loop <= maxPos; loop++) {
+
+    findMaxDB(loop, max_array);    
+
+    for (int16 j = 0; j < 4; j++) {
+      int32 jj = isReversed() ? 3-j : j;
+
+      if (db_bases[loop] == "ACGT"[jj]) {
+	//cout << "Peak :" << loop << " " << max_array[j] << endl;
+	num_called[jj]++;
+	sum_called[jj] += max_array[j];
+      } else {
+	if (db_bases[loop+1] != "ACGT"[jj] && 
+	    db_bases[loop-1]!= "ACGT"[jj]){
+	  num_ncalled[jj]++;
+	  // cout << " NC:" << max_array[j];
+	  sum_ncalled[jj] += max_array[j];
+	}
+      }
+    }
+  }
+
+  {
+    float ratio = 0;
+    float ratio_called  = 0;  // mean height of the called peaks
+    float ratio_ncalled = 0;  // mean max. height at non called positions
+  
+    for (int16 j=0; j<4; j++) {
+      int32 jj = (isReversed() ? 3-j : j);
+ 
+      if (num_called[jj] > 0) {
+	ratio_called = (float)sum_called[jj] / (float)num_called[jj];
+	// cout << "Ratio-Called: " << ratio_called ;
+
+	if (db_bases[pos] == "ACGT"[j]) {
+	  // calculate peak height
+	  findMaxDB(pos, max_array);
+
+	  if (ratio_called == 0) {
+	    // no base in the vicinity found... assume ratio 1 (100%)
+	    c_ratio = 100;
+	  } else {
+	    c_ratio = (int16)(100 * max_array[jj] / ratio_called);
+	  }
+	}
+      }
+      meanPeakSize[j] = (int32)ratio_called;
+
+
+      if (num_ncalled[j] > 0) {
+	ratio_ncalled = (float)sum_ncalled[j] / (float)num_ncalled[j];
+	// cout<<" Ratio N-called : " << ratio_ncalled;
+      }
+
+      if (ratio_ncalled > 0) {
+	ratio = min(1000, (int)(10 * ratio_called / ratio_ncalled));
+	// cout << " Ratio:" <<ratio << endl;
+	if ((ratio < r_min || r_min == 0) && ratio > 0){
+	  r_min = (int)ratio;
+	}
+      }
+
+    }
+  }
+  return r_min;
+}
+
+
+
+// scfBasePos ist aber die position der gesuchten scf-base in der DB!!
+char SCF_look::getSCFBase(int32 scfBasePos) const
+{
+  FUNCSTART("char SCF_look::getSCFBase(int32 scfBasePos) const");
+  if (scfBasePos < 0 || scfBasePos >= db_samples) {
+    cout << "scf_look::getSCFBase SCF-Baseposition exceeds limit\n";
+    cout << "File: " << getFileName() << "\tpos:" << scfBasePos << endl;
+
+    MIRANOTIFY(Notify::WARNING, "SCF-Baseposition exceeds limit");
+  }
+
+  if (isReversed()) {
+    return invertBase(db_bases[scfBasePos]);
+  } else { 
+    return db_bases[scfBasePos];
+  }
+}
+
+
+
+char SCF_look::getOriginalSCFBase(int32 scfBasePos) const
+{
+  FUNCSTART("char SCF_look::getOriginalSCFBase(int32 scfBasePos) const");
+  if (!testSCFPos(scfBasePos)) {
+
+    cout << "scf_look::getOriginalSCFBase scf-Baseposition exceeds limit\n";
+    cout << "File: " << getFileName() << "\tpos:" << scfBasePos << endl;
+
+    MIRANOTIFY(Notify::WARNING,"SCF-Baseposition exceeds limit");
+  }
+
+  if (isReversed()) {
+    return invertBase(SCF_bases[scfBasePos]);
+  } else { 
+    return SCF_bases[scfBasePos];
+  }
+}
+
+
+
+char SCF_look::getDBBase(int32 dbbasePos) const
+{
+  FUNCSTART("char SCF_look::getDBBase(int32 dbbasePos) const");
+  if (testDBPos(dbbasePos)) {
+    return db_bases[dbbasePos];
+  }
+
+  cout << "scf_look::getDBBase DB-Baseposition exceeds limit\n";
+  cout << "File: " << getFileName() << "\tpos:" << dbbasePos << endl;
+
+  MIRANOTIFY(Notify::WARNING,"DB-Baseposition exceeds limit");
+}
+
+
+
+
+int32 SCF_look::getDBBasePeakVal(int32 dbBasePos) const
+{
+  FUNCSTART("int32 SCF_look::getDBBasePeakVal(int32 dbBasePos) const");
+  uint16 *samples;
+
+  if (testDBPos(dbBasePos)) {
+    samples = getTraceData(db_bases[dbBasePos]);
+    return samples[db_peak_index[dbBasePos]];
+  }
+
+  cout << "scf_look::getDBBasePeakVal DB-Baseposition exceeds limit\n";
+  cout << "File: " << getFileName() << "\tpos:" << dbBasePos << endl;
+
+  MIRANOTIFY(Notify::WARNING, "DB-Baseposition exceeds limit");
+}
+
+
+
+
+int32 SCF_look::calculateCompressionParameters(int32 dbPos, int32 radius,
+					       float *inParameter)
+{
+  int32 used = 0;
+  float b1, b2;
+
+  inParameter[used++] = noiseRatioAll(dbPos - radius, dbPos - 1);
+  inParameter[used++] = noiseRatioAll(dbPos + 1, dbPos + radius);
+  
+  b1 = meanBaseline(dbPos - radius, dbPos - 1);
+  b2 = meanBaseline(dbPos + 1, dbPos + radius);
+
+  if (b2 != 0) {
+    inParameter[used++] = b1/b2;
+  } else {
+    inParameter[used++] = b1/1;
+  }
+
+  return used;
+}
+
+
+
+
+
+
+// ===================================================
+
+peak_examination::peak_examination(SCF_look *aRead, int32 aDbPos) {
+  theRead = aRead;
+  dbPos   = aDbPos;
+  theBase = toupper(theRead->getDBBase(dbPos));
+
+  nonBorderRealBase = 
+    isBase(theBase) && 
+    dbPos > 0 && 
+    dbPos < theRead->getDBBases()-2;
+ 
+  return;
+}
+
+
+bool peak_examination::peakHeightWithPrevMin(int32 &peak_height) 
+{
+  int32  leftValleyPos  = dbPos-1;
+  int32  rightValleyPos = dbPos+1;
+  int32  von, bis, min;
+  uint16 *samples;
+
+  if (!nonBorderRealBase) return false;
+
+  // find next and previous base which is different from the called base
+  // We expect the trace to go down to the base level here
+  while(leftValleyPos > 1 && 
+	toupper(theRead->getDBBase(leftValleyPos)) == theBase) {
+    leftValleyPos--;
+  }
+
+  while(rightValleyPos < theRead->getDBBases() - 2 && 
+	toupper(theRead->getDBBase(rightValleyPos)) == theBase) {
+    rightValleyPos++;
+  }
+  
+  samples = theRead->getTraceData(theBase);
+  if (samples == NULL) return false;
+
+
+  //  theRead->range(leftValleyPos, rightValleyPos, von, bis);
+  //  min = theRead->findMinBase(samples, von, bis);
+
+  {
+    int32 min1, min2;
+    theRead->range(leftValleyPos, von, bis);
+    min1 = theRead->findMinBase(samples, von, bis);
+    theRead->range(rightValleyPos, von, bis);
+    min2 = theRead->findMinBase(samples, von, bis);
+    min = (min1 + min2) / 2;
+  }
+
+  peak_height = theRead->getDBBasePeakVal(dbPos) - min;
+  return true;
+}
+
+/*
+float peak_examination::getPeakWeight()
+{
+  char  prev_base, this_base;
+  int32 i = 0;
+  float weight[17] = { 
+    0.69, 1.00, 0.70, 0.98,
+    0.77, 1.00, 0.61, 0.99,
+    1.00, 0.51, 0.56, 0.94,
+    0.55, 1.00, 0.91, 0.60,
+    1.00
+  };
+ 
+  if (false == nonBorderRealBase) return 1.0;
+
+  if (theRead->isReversed()) {
+    prev_base = toupper(theRead->getDBBase(dbPos-1));
+  } else {
+    prev_base = toupper(theRead->getDBBase(dbPos+1));
+  }
+
+  switch(prev_base) {
+  case 'A': i = 0;  break;
+  case 'C': i = 4;  break;
+  case 'G': i = 8;  break;
+  case 'T': i = 12; break;
+  default:  i = 16;
+  }
+
+  switch(theBase) {
+  case 'A': break;
+  case 'C': i = i+1; break;
+  case 'G': i = i+2; break;
+  case 'T': i = i+3; break;
+  default:  i = 16;
+  }
+
+  return weight[i];
+}
+
+*/
+
+
+
+
+
+
+// ========================================
+// ==========    SCF_distance   ===========
+// ========================================
+
+float SCF_distance::getMeanProblemDistance() 
+{
+  if (problemBases > 1) {
+    return (float)(problemDistanceSum / (problemBases - 1));
+  } else {
+    return (float)problemDistanceSum;
+  }  
+}
+
+
+float SCF_distance::getMeanVicDistance()
+{
+  if (vicDistanceSum != 0) {
+    if (vicDistanceBases > 1) { 
+      return (float)(abs (vicDistanceSum) / vicDistanceBases);
+    } else {
+      return abs(vicDistanceSum);
+    }
+  } else {
+    return 10.0;  
+    // Quit arbitrary value; should never happen...
+  }
+}
+
+
+float SCF_distance::getRelativeProblemDistance()
+{
+  if (problemBases != 0 && vicDistanceSum != 0) {
+    return (float)(problemDistanceSum * vicDistanceBases) /
+      (float)(problemBases * vicDistanceSum);
+  } else {
+    return 1.0;
+  }
+}
+
+
+
+float SCF_distance::getRelativeMinDistance()
+{
+  float m = getMeanVicDistance();  
+
+  if (m > 0.001) {
+    return (float)minDistanceProblem / getMeanVicDistance();
+  }
+  return 1.0;
+}
+
+
+
+float SCF_distance::getRelativeMaxDistance()
+{
+  float m = getMeanVicDistance();
+
+  if (m > 0.001) {
+    return (float)maxDistanceProblem / getMeanVicDistance();
+  }
+  return 1.0;
+}
+  
+
+float SCF_distance::getMinDistanceScore()
+{
+  float d1 = 50 * pow(getRelativeMinDistance() - 1, 4);
+
+  return d1;
+}
+
+float SCF_distance::getMaxDistanceScore()
+{
+  float d2 = 50 * pow(getRelativeMaxDistance() - 1, 4);
+
+  return d2;
+}
+
+
+float SCF_distance::getDistanceScore()
+{
+  float d3 = 50 * pow(getRelativeProblemDistance() - 1, 4); 
+
+  return d3;
+}
+
+
+
+ostream & operator<<(ostream &ostr, SCF_distance const &i) {
+  ostr << "Peakpos:    " << i.peakPos << " Bases: " << i.problemBases << endl;
+  ostr << "Problem Min " << i.minDistanceProblem 
+       << " Max: " << i.maxDistanceProblem << endl;
+  ostr << "Vicinity Bases: " << i.vicDistanceBases << " Sum " 
+       << i.vicDistanceSum << endl;
+
+  return ostr;
+}
+
diff --git a/src/examine/scf_look.H b/src/examine/scf_look.H
new file mode 100644
index 0000000..1ce3905
--- /dev/null
+++ b/src/examine/scf_look.H
@@ -0,0 +1,406 @@
+/*
+ * Written by Thomas Pfisterer
+ *
+ * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
+ *   Krebsforschungszentrum, DKFZ Heidelberg) and Thomas Pfisterer
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ *
+ *
+ * SCF examination methods
+ *
+ */
+
+
+// 	$Id$	
+
+#ifndef _scflook_scflook_H_
+#define _scflook_scflook_H_
+
+
+
+// forward deklarationen
+class SCF_buffer;
+class afh_Info;
+//struct contigread_t;
+
+#include <string>
+
+#include <math.h>
+#include "ctype.h"
+ 
+#include "io/scf.H"
+#include "errorhandling/errorhandling.H"
+#include "mira/read.H"
+#include "mira/contig.H" 
+
+#include "buffer.H"
+#include "prescan.H"
+#include "globals.H"
+#include "misc.H"
+
+
+class SCF_distance {
+private:
+  int32 peakPos;
+
+  int32 vicDistanceSum;
+  int32 vicDistanceBases;
+
+  int32 problemDistanceSum;
+  int32 problemBases;
+  int32 minDistanceProblem;
+  int32 maxDistanceProblem;
+
+public:
+  SCF_distance(int32 pos) {peakPos = pos; }
+  void setMinMaxProblemDistance(int32 min, int32 max)  
+    { minDistanceProblem = min; maxDistanceProblem = max; }
+  void setMeanVicDistance(int32 distance, int32 bases)
+    { vicDistanceSum = abs(distance); vicDistanceBases = bases; }
+  void setProblemDistance(int32 distance, int32 bases)
+    { problemDistanceSum = abs(distance); problemBases = bases; }
+
+  int32 getProblemBases() { return problemBases; }
+  float getMeanProblemDistance();
+  float getMeanVicDistance();
+  float getRelativeProblemDistance();
+  float getRelativeMinDistance();
+  float getRelativeMaxDistance();
+  float getDistanceScore();
+  float getMinDistanceScore();
+  float getMaxDistanceScore();
+
+  friend ostream & operator<<(ostream &ostr, SCF_distance const &i);
+};
+
+
+
+/* Create a class that can handle SCF-Files and more */
+class SCF_look : public SCF { 
+  static int32 count;
+private:
+  enum { qualityRadius = 15 };
+  int8   reversed;      /* read is the other way round in the db */
+  int32  db_samples;
+  const Read   * theRead;
+  uint8  * db_bases;
+  uint32 * db_peak_index;
+  char   * fName;
+
+
+  void  zeroVars();
+  void  discard();
+
+  void  wide_range(const int32 dbPosVon, const int32 dbPosBis, 
+		   int32 &von, int32 &bis);  
+
+  int32 meanCalledLevel(int32 minPos, int32 maxPos, int32 pos, 
+			int32 &relMax, int32 meanPeakSize[4]);
+  int32 noiseRatioBaseDB(int32 minPos, int32 maxPos, int32 pos, 
+			 int32 &c_ratio, int32 meanPeakSize[4]);
+  int32 countPeaksInTrace(uint16 *samples, int32 von, int32 bis, 
+			  int32 &peak, int16 &qual);
+  void  interpolate();
+public:
+  SCF_look();
+  ~SCF_look();
+  SCF_look(SCF_look const &other); //: SCF(other);
+
+  const SCF_look& operator=(const SCF_look &other);
+  
+  int8  load(const char *filename); 
+  int8  simpleLoad(const char *filename); 
+  int8  load(const Read &aRead, int32 richtung);
+  int8  load();
+
+  char   *getFileName() const;
+  int8    setFilename(const char *filename);
+  t_machinetype getMACHType() const;
+
+  uint16 *getTraceData(const char dbbase) const;
+  uint16 *getTraceData(const char dbbase, int32 isReversed) const;
+  void    range(int32 basePos, int32 &von, int32 &bis);
+  void    range(const int32 dbPosVon, const int32 dbPosBis, 
+	        int32 &von, int32 &bis);
+  void   half_range(int32 basePos, int32 &von, int32 &bis);
+  uint16 findMaxDB(int32 basePos, int32 max[4]);
+  uint16 findMaxDB(int32 max[4], int32 first, int32 last);  
+  uint16 findMinDB(int32 min[4], int32 first, int32 last);  
+  uint16 findMaxDBHalf(int32 basePos, int32 max[4]);
+  uint16 findMaxBase(uint16 *SCF_samples, int32 von, int32 bis);
+  uint16 findMinBase(uint16 *SCF_samples, int32 von, int32 bis);
+
+
+  void   meanTraceValues(int32 mean[4], int32 offset);
+  bool   localPeakOverMean(char base, int32 scfPos, int32 radius,
+			   int32 &above_mean);
+
+  int32  findNextMax(const uint16 *samples, const int32 samplePos, 
+		     const bool forward);
+  int32  findNextMin(const uint16 *samples, const int32 samplePos, 
+		     const bool forward);
+  int32  findNextSlopeChange(const uint16 *samples, const int32 samplePos, 
+			     const bool forward);
+
+  float  peakValleyValues(const int32 dbPos, const char newBase, 
+			  float result[6]);
+
+  int32  findRepeatSize(int32 &dbPosVon, int32 &dbPosBis);
+
+  SCF_distance* calcDBDistance(int32 dbPos);
+
+  int32  calcConvergenceRegionQuality(int32 dbPos);
+  int8   isReversed() const { return reversed; }
+
+
+
+  int32  convergenceRegions(uint16 *samples, int32 von, int32 bis,
+			    int32 &areaMin, int32 &areaMax);
+  //  int32  countConvergenceRegions(int32 dbBasePos, 
+  //				 int32 &areaMin, int32 &areaMax);
+
+  int32  countConvergenceRegions(int32 dbBasePos, char base,
+				 int32 &areaMin, int32 &areaMax);
+
+  float  einzelpeak(int32 dbPos, char dbBase, int32 &max, 
+		    float &pos_rating);
+
+  float  singlePeakQuality(int32 dbpos, float sigma, char base = '-');
+
+  void   peakRelations(int32 dbPos, char newDBBase, char oldDBBase,
+		       float &newRatio, float &oldRatio, float &oldNewRatio);
+
+  int32  countPeaksBetweenBases(char base, int32 basPos);
+
+
+  int32 countRepeatPeaks(const int32 basePos, const char base, 
+			 int16 &anzRepeat, int16 &anzPeaks, int16 &qual);
+
+  int32  countDBPeaks(int32 basePos, int16 &anzRepeat, 
+  		      int16 &anzPeak, int16 &qual);
+  int16 peakQuality(int32 pos, int32 radius);
+
+  float noiseRatioAll(uint32 von, uint32 bis);
+  float meanBaseline(uint32 min_pos, uint32 max_pos);
+
+  int32 calledNoncalledRatioDB(int32 pos, int32 radius);
+  int32 noiseRatioDB(int32 pos, int32 radius, int32 &c_ratio, 
+		     int32 meanPeakSize[4]);
+  void  showDBArea(int32 pos, int32 circle, ostream &output);
+  void  showArea(int32 pos, int32 circle, ostream &output);
+
+  char  getSCFBase(int32 scfBasePos) const;
+  //base_quality_t getDBQuality(int32 dbpos) const;
+  char  getOriginalSCFBase(int32 scfBasePos) const;
+  char  getDBBase(int32 dbBasePos) const;
+  int32 getDBBasePeakVal(int32 dbBasePos) const;
+  int32 getDBBases() const { return db_samples; }
+
+  inline bool testDBPos(int32 dbpos) const
+    { return (dbpos >= 0 && dbpos < db_samples); }
+  inline bool testSCFPos(int32 scfpos) const
+    { return (scfpos >= 0 && scfpos < static_cast<int32>(SCF_header.bases)); }
+
+  int32  deleteBaseDB(int32 pos);
+  int32  insertBaseDB(int32 pos, int32 scfPos, char newBase);
+  int32  alterBaseDB(int32 pos, char newBase);
+
+
+  int32 calculateCompressionParameters(int32 dbPos, int32 radius, float *inParameter);
+
+};
+
+
+
+class peak_examination {
+  SCF_look  *theRead;
+  int32     dbPos;
+  bool      nonBorderRealBase;
+  char      theBase;
+
+public:
+  peak_examination(SCF_look *aRead, int32 aDbPos);
+  
+  bool  peakHeightWithPrevMin(int32 &peak_height);
+  float getPeakWeight();
+
+};
+
+
+
+
+
+class afh_Info {
+  enum { qualityRadius = 15 };
+  afh_Info *next;
+
+  SCF_look *theTrace;
+
+  const Contig::contigread_t *contig_read; 
+  base_quality_t original_quality;
+
+  int32 question;
+  char  hypothesis_base;    // for inserts and wrong calls
+  char  original_base;
+  int32 status;
+  float confirmed;
+  int32 dbPosition;
+  int32 scfPosition;
+  
+
+
+  void setDBPos(int32 newPos);
+  void setSCFPos(int32 newPos);
+  void shiftLeftAfterPos(int32 startPos);
+  void shiftRightAfterPos(int32 startPos);
+
+public:
+  int32 scfInfoId;     // reference to a scfInfo in hypotheses generation
+
+  afh_Info(afh_Info const &other);
+  //afh_Info(SCF_look *r);
+  afh_Info(SCF_look *r, const int32 dbPos, const int32 scfPos, 
+	   const char hypoBase, const char oldBase, const int32 fClass);
+  afh_Info(const Contig::contigread_t *r, int32 dbPos, int32 scfPos, 
+	   char hypoBase, char oldBase, int32 fClass);
+  afh_Info();
+  ~afh_Info();
+  afh_Info const & operator=(afh_Info const &other);
+  afh_Info* nextAfh();
+  int16 appendAfh(afh_Info *a);
+  bool  loadRead();
+
+  float eval(const bool verbose);
+
+  SCF_look *performEditOnRead(afh_Info &a);
+  SCF_look *getTraceData() { return theTrace; }
+  
+  bool  compareWith(afh_Info &a);
+  int32 getFaultClass() const { return question; }
+  bool  getIsExtendedAlterOperation();
+  const char* getFaultClassName() const;
+  const char* getFaultStatusName() const;
+  const char* getReadName() const;
+  const Contig::contigread_t* getContigRead() const { return contig_read; }
+  int16 isSupportingHypotheses();
+  bool  isNPlusHypotheses();
+  bool  isNToBaseHypotheses();
+  int16 isReversed();
+
+  int32 scfPos() { return scfPosition; }
+  int32 dbPos()  { return dbPosition;  }
+  char  dbBase();
+  char  getHypothesisBase()    { return hypothesis_base; }
+  char  getOriginalBase()      { return original_base; }
+  int16 getStatus() const   { return static_cast<int16>(status);   }
+  int16 getQuestion() const { return static_cast<int16>(question); }
+  void  confirm(const float confirmValue);
+  void  confirm() { status = fhs_CONFIRMED; }
+  void  reject(const float confirmValue);
+  void  reject() { status = fhs_REJECTED; }
+  bool  isConfirmed() const;
+
+  base_quality_t getOriginalBaseQuality() { return original_quality;}
+  void setOriginalBaseQuality(base_quality_t t) { original_quality = t; }
+
+  int16 chemistryEvaluation(char before, char base, char after);
+
+  friend ostream & operator<<(ostream &ostr, afh_Info const &i);
+};
+
+
+
+class cfh_Info {
+private:
+  afh_Info *first;
+  afh_Info *last;
+
+  int32 rejected_faults;
+  int32 confirmed_positive;
+  int32 confirmed_reverse;
+  int32 rejected_n;
+  int32 positive;
+  int32 reversed;
+
+  float rel_score;         // quality of confirmation
+
+  void foolCompiler(void);
+  void countInformation();
+public:
+  int32 cfh_id;
+  
+  cfh_Info(cfh_Info const &other);  
+  cfh_Info const & operator=(cfh_Info const &other);
+
+  cfh_Info();
+  cfh_Info(afh_Info *a);
+  ~cfh_Info();
+  
+  afh_Info* firstAfh() const { return first; };
+  bool  loadAfhTraces(afh_Info *a);
+  float getRelScore() { return rel_score; };
+  void  appendAfh(afh_Info *a);
+  void  deleteAllBuffered();
+  //int32 examineCfh();
+  bool  examineCfhPartial(bool &isConfirmed);
+  bool  needsInformationOfType(const int16 question, const int16 direction);
+  bool  eval(const bool complete, const bool verbose, 
+	     const float threshold, const bool strict_N);
+  bool  singleEval(const float threshold, int32 fhc_class = fhc_WRONG);
+  bool  evalExtendedAlterOperations(const float threshold);
+  bool  confirmQuality(const int32 threshold);
+  afh_Info* readEditedBefore(afh_Info *afh_Info);
+
+  friend ostream & operator<<(ostream &ostr, cfh_Info const &i);
+};
+
+
+
+int32 calculateParameters(int32 scfPos, int32 dbPos, int32 faultClass, 
+			char newBase, float *inParameter, 
+			SCF_look *aScfLook, ostream &output,
+			bool &ko);
+
+bool calculateThis(int32 calculation, int32 faultClass);
+
+
+float evaluate(int32 scfPos, int32 dbPos, int32 faultClass, 
+	       char newBase, SCF_look *aScfLook, ostream &output);
+
+float evaluate(int32 scfPos, int32 dbPos, int32 faultClass, 
+	       char newBase, SCF_look *aScfLook);
+
+
+int32 bestPeakBetweenBases  (uint16 *samples, int32 von, int32 bis);
+int32 bestValleyBetweenBases(uint16 *samples, int32 von, int32 bis);
+
+bool  slopeChangeTest(const uint16 *samples, const int32 pos);
+
+int32 constSlopeBetweenBases(const uint16 *samples, int32 von, int32 bis,
+			     int32 &conv, int32 &div);
+
+int32 findBestWeakPeak(const uint16 *samples, int32 von, int32 bis,
+		       int32 &peak, int32 &valley);
+
+int32 bestConvergenceRegion(uint16 *samples, int32 von, int32 bis);
+
+#endif
+
+
+
diff --git a/src/examine/scfbuffer.H b/src/examine/scfbuffer.H
new file mode 100644
index 0000000..0e06c74
--- /dev/null
+++ b/src/examine/scfbuffer.H
@@ -0,0 +1,70 @@
+/*
+ * Written by Thomas Pfisterer
+ *
+ * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
+ *   Krebsforschungszentrum, DKFZ Heidelberg) and Thomas Pfisterer
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ *
+ *
+ * SCF examination methods
+ *
+ */
+
+
+#ifndef _scfbuffer_scfbuffer_H_
+#define _scfbuffer_scfbuffer_H_
+
+
+// 	$Id$	
+class SCF_look;
+
+
+class SCF_buffer {
+private:
+  //  static int32    scfBufferSize;
+  enum { scfBufferSize = 40 };
+
+  static SCF_look *scfBufferRead[scfBufferSize];
+  static int32    scfBufferIndex[scfBufferSize];
+  //static SCF_look **scfBufferRead;
+  //static int32    *scfBufferIndex;
+  static int32    scfBufferLast;
+  static int32    bufReads, fileReads;
+  static bool     isValid;
+public:
+  SCF_buffer();
+  ~SCF_buffer();
+
+  static void initialize();
+  static void discard();
+  static SCF_look *search(const char * fName);
+  static SCF_look *bufferRead(const char * fname);
+  static SCF_look *bufferRead(const Read & aRead, int richtung);
+  static void  bufferDelete(SCF_look *aRead);
+  static void  statistics(); 
+
+  static void show();
+};
+
+
+
+
+
+#endif
+
diff --git a/src/examples_programming/Makefile.am b/src/examples_programming/Makefile.am
new file mode 100644
index 0000000..d77daaf
--- /dev/null
+++ b/src/examples_programming/Makefile.am
@@ -0,0 +1,25 @@
+
+AM_CXXFLAGS = $(BOOST_CPPFLAGS)
+
+INCLUDES = -I$(top_srcdir)/src $(all_includes)
+
+
+noinst_PROGRAMS= mira_101 read_101 readpool_101
+
+AM_LDFLAGS= -L../io/ -L../util/ -L../errorhandling/ -L../mira -L../examine/ -L../EdIt/ -L../caf/ -L../knn_abi373 -L../knn_alf $(BOOST_LDFLAGS)
+
+
+mira_101.C: 
+mira_101_SOURCES= mira_101.C
+mira_101_LDADD= -lmira  -lmiraEdIt -lmiraExamine -lmirasupport -lmiraestass -lmiraerrorhandling  -lmirautil -lmiradptools -lmirafio -lmiracaf -lmiraKNN_abi373 -lm -lexpat -lz $(BOOST_THREAD_LIB)  $(BOOST_REGEX_LIB) $(BLOODYDARWINHACK)
+
+read_101.C: 
+read_101_SOURCES= read_101.C
+read_101_LDADD= -lmirasupport -lmiraerrorhandling  -lmirautil -lmiradptools -lmirafio -lm -lz
+
+readpool_101.C: 
+readpool_101_SOURCES= readpool_101.C
+readpool_101_LDADD= -lmirasupport -lmiraerrorhandling  -lmirautil -lmiradptools -lmirafio -lm -lz -lexpat
+
+
+
diff --git a/src/modules/Makefile.in b/src/examples_programming/Makefile.in
similarity index 76%
copy from src/modules/Makefile.in
copy to src/examples_programming/Makefile.in
index 64c2955..bc72fde 100644
--- a/src/modules/Makefile.in
+++ b/src/examples_programming/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -15,7 +15,6 @@
 
 @SET_MAKE@
 
-
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
@@ -35,33 +34,43 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
-subdir = src/modules
-DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
-	$(srcdir)/Makefile.in
+noinst_PROGRAMS = mira_101$(EXEEXT) read_101$(EXEEXT) \
+	readpool_101$(EXEEXT)
+subdir = src/examples_programming
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/ax_boost_base.m4 \
-	$(top_srcdir)/m4/ax_boost_filesystem.m4 \
-	$(top_srcdir)/m4/ax_boost_iostreams.m4 \
-	$(top_srcdir)/m4/ax_boost_regex.m4 \
-	$(top_srcdir)/m4/ax_boost_system.m4 \
-	$(top_srcdir)/m4/ax_boost_thread.m4 \
-	$(top_srcdir)/m4/ax_check_zlib.m4 \
-	$(top_srcdir)/m4/ax_lib_expat.m4 $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/config/m4/ax_boost_base.m4 \
+	$(top_srcdir)/config/m4/ax_boost_regex.m4 \
+	$(top_srcdir)/config/m4/ax_boost_thread.m4 \
+	$(top_srcdir)/config/m4/ax_check_zlib.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_std.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_stl.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_namespaces.m4 \
+	$(top_srcdir)/config/m4/ax_lib_expat.m4 \
+	$(top_srcdir)/config/m4/ax_with_perl.m4 \
+	$(top_srcdir)/config/m4/ax_with_prog.m4 \
+	$(top_srcdir)/config/m4/libtool.m4 \
+	$(top_srcdir)/config/m4/ltoptions.m4 \
+	$(top_srcdir)/config/m4/ltsugar.m4 \
+	$(top_srcdir)/config/m4/ltversion.m4 \
+	$(top_srcdir)/config/m4/lt~obsolete.m4 \
+	$(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
-LIBRARIES = $(noinst_LIBRARIES)
-ARFLAGS = cru
-libmiramodules_a_AR = $(AR) $(ARFLAGS)
-libmiramodules_a_LIBADD =
-am_libmiramodules_a_OBJECTS = mod_sigconex.$(OBJEXT) \
-	mod_scaffold.$(OBJEXT) mod_bait.$(OBJEXT) \
-	mod_dbgreplay.$(OBJEXT) mod_diff.$(OBJEXT) mod_mer.$(OBJEXT) \
-	mod_mira.$(OBJEXT) mod_convert.$(OBJEXT) \
-	mod_memestim.$(OBJEXT) mod_tagsnp.$(OBJEXT) misc.$(OBJEXT)
-libmiramodules_a_OBJECTS = $(am_libmiramodules_a_OBJECTS)
+PROGRAMS = $(noinst_PROGRAMS)
+am_mira_101_OBJECTS = mira_101.$(OBJEXT)
+mira_101_OBJECTS = $(am_mira_101_OBJECTS)
+am__DEPENDENCIES_1 =
+mira_101_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+am_read_101_OBJECTS = read_101.$(OBJEXT)
+read_101_OBJECTS = $(am_read_101_OBJECTS)
+read_101_DEPENDENCIES =
+am_readpool_101_OBJECTS = readpool_101.$(OBJEXT)
+readpool_101_OBJECTS = $(am_readpool_101_OBJECTS)
+readpool_101_DEPENDENCIES =
 DEFAULT_INCLUDES = -I. at am__isrc@
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
@@ -75,9 +84,10 @@ CXXLD = $(CXX)
 CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	--mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
 	$(LDFLAGS) -o $@
-SOURCES = $(libmiramodules_a_SOURCES)
-DIST_SOURCES = $(libmiramodules_a_SOURCES)
-HEADERS = $(noinst_HEADERS)
+SOURCES = $(mira_101_SOURCES) $(read_101_SOURCES) \
+	$(readpool_101_SOURCES)
+DIST_SOURCES = $(mira_101_SOURCES) $(read_101_SOURCES) \
+	$(readpool_101_SOURCES)
 ETAGS = etags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -91,13 +101,9 @@ AWK = @AWK@
 BITPACKAGE = @BITPACKAGE@
 BLOODYDARWINSTATLIBDIRHACK = @BLOODYDARWINSTATLIBDIRHACK@
 BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
-BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@
-BOOST_IOSTREAMS_LIB = @BOOST_IOSTREAMS_LIB@
 BOOST_LDFLAGS = @BOOST_LDFLAGS@
 BOOST_REGEX_LIB = @BOOST_REGEX_LIB@
-BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@
 BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
-BUNDLETARGET = @BUNDLETARGET@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
@@ -110,7 +116,6 @@ CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -120,13 +125,11 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LDFLAGS = @EXPAT_LDFLAGS@
-EXPAT_LIBS = @EXPAT_LIBS@
 EXPAT_VERSION = @EXPAT_VERSION@
 FGREP = @FGREP@
 FLEX = @FLEX@
 FLEXPP = @FLEXPP@
 GREP = @GREP@
-HAVE_XXD = @HAVE_XXD@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -144,7 +147,6 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
 MIRASTATIC = @MIRASTATIC@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
@@ -161,17 +163,18 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
+SHORTMIRAAUDIENCE = @SHORTMIRAAUDIENCE@
 STRIP = @STRIP@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -205,6 +208,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -220,10 +224,15 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-AM_CPPFLAGS = -I$(top_srcdir)/src $(all_includes)
-noinst_LIBRARIES = libmiramodules.a
-libmiramodules_a_SOURCES = mod_sigconex.C mod_scaffold.C mod_bait.C mod_dbgreplay.C mod_diff.C mod_mer.C mod_mira.C mod_convert.C mod_memestim.C mod_tagsnp.C misc.C
-noinst_HEADERS = mod_sigconex.H mod_scaffold.H mod_bait.H mod_diff.H mod_mer.H mod_mira.H mod_convert.H mod_memestim.H mod_tagsnp.H misc.H
+AM_CXXFLAGS = $(BOOST_CPPFLAGS)
+INCLUDES = -I$(top_srcdir)/src $(all_includes)
+AM_LDFLAGS = -L../io/ -L../util/ -L../errorhandling/ -L../mira -L../examine/ -L../EdIt/ -L../caf/ -L../knn_abi373 -L../knn_alf $(BOOST_LDFLAGS)
+mira_101_SOURCES = mira_101.C
+mira_101_LDADD = -lmira  -lmiraEdIt -lmiraExamine -lmirasupport -lmiraestass -lmiraerrorhandling  -lmirautil -lmiradptools -lmirafio -lmiracaf -lmiraKNN_abi373 -lm -lexpat -lz $(BOOST_THREAD_LIB)  $(BOOST_REGEX_LIB) $(BLOODYDARWINHACK)
+read_101_SOURCES = read_101.C
+read_101_LDADD = -lmirasupport -lmiraerrorhandling  -lmirautil -lmiradptools -lmirafio -lm -lz
+readpool_101_SOURCES = readpool_101.C
+readpool_101_LDADD = -lmirasupport -lmiraerrorhandling  -lmirautil -lmiradptools -lmirafio -lm -lz -lexpat
 all: all-am
 
 .SUFFIXES:
@@ -237,9 +246,9 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/modules/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/examples_programming/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu src/modules/Makefile
+	  $(AUTOMAKE) --gnu src/examples_programming/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -259,12 +268,23 @@ $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(am__aclocal_m4_deps):
 
-clean-noinstLIBRARIES:
-	-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
-libmiramodules.a: $(libmiramodules_a_OBJECTS) $(libmiramodules_a_DEPENDENCIES) $(EXTRA_libmiramodules_a_DEPENDENCIES) 
-	-rm -f libmiramodules.a
-	$(libmiramodules_a_AR) libmiramodules.a $(libmiramodules_a_OBJECTS) $(libmiramodules_a_LIBADD)
-	$(RANLIB) libmiramodules.a
+clean-noinstPROGRAMS:
+	@list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
+	echo " rm -f" $$list; \
+	rm -f $$list || exit $$?; \
+	test -n "$(EXEEXT)" || exit 0; \
+	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+	echo " rm -f" $$list; \
+	rm -f $$list
+mira_101$(EXEEXT): $(mira_101_OBJECTS) $(mira_101_DEPENDENCIES) 
+	@rm -f mira_101$(EXEEXT)
+	$(CXXLINK) $(mira_101_OBJECTS) $(mira_101_LDADD) $(LIBS)
+read_101$(EXEEXT): $(read_101_OBJECTS) $(read_101_DEPENDENCIES) 
+	@rm -f read_101$(EXEEXT)
+	$(CXXLINK) $(read_101_OBJECTS) $(read_101_LDADD) $(LIBS)
+readpool_101$(EXEEXT): $(readpool_101_OBJECTS) $(readpool_101_DEPENDENCIES) 
+	@rm -f readpool_101$(EXEEXT)
+	$(CXXLINK) $(readpool_101_OBJECTS) $(readpool_101_LDADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -272,17 +292,9 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/misc.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mod_bait.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mod_convert.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mod_dbgreplay.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mod_diff.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mod_memestim.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mod_mer.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mod_mira.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mod_scaffold.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mod_sigconex.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mod_tagsnp.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mira_101.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/read_101.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/readpool_101.Po at am__quote@
 
 .C.o:
 @am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@@ -395,7 +407,7 @@ distdir: $(DISTFILES)
 	done
 check-am: all-am
 check: check-am
-all-am: Makefile $(LIBRARIES) $(HEADERS)
+all-am: Makefile $(PROGRAMS)
 installdirs:
 install: install-am
 install-exec: install-exec-am
@@ -407,15 +419,10 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	if test -z '$(STRIP)'; then \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	      install; \
-	else \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-	fi
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
 mostlyclean-generic:
 
 clean-generic:
@@ -429,7 +436,7 @@ maintainer-clean-generic:
 	@echo "it deletes files that may require special tools to rebuild."
 clean: clean-am
 
-clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
+clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
 	mostlyclean-am
 
 distclean: distclean-am
@@ -501,7 +508,7 @@ uninstall-am:
 .MAKE: install-am install-strip
 
 .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
-	clean-libtool clean-noinstLIBRARIES ctags distclean \
+	clean-libtool clean-noinstPROGRAMS ctags distclean \
 	distclean-compile distclean-generic distclean-libtool \
 	distclean-tags distdir dvi dvi-am html html-am info info-am \
 	install install-am install-data install-data-am install-dvi \
@@ -514,6 +521,12 @@ uninstall-am:
 	pdf pdf-am ps ps-am tags uninstall uninstall-am
 
 
+mira_101.C: 
+
+read_101.C: 
+
+readpool_101.C: 
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/src/examples_programming/README b/src/examples_programming/README
new file mode 100644
index 0000000..cbad631
--- /dev/null
+++ b/src/examples_programming/README
@@ -0,0 +1,6 @@
+The programs in this directory are examples on how to use different MIRA
+classes and functions.
+
+As the overall code documentation is a bit ... lacking, they are meant to help
+in the first steps of programming with MIRA.
+
diff --git a/src/examples_programming/mira_101.C b/src/examples_programming/mira_101.C
new file mode 100644
index 0000000..cd604f1
--- /dev/null
+++ b/src/examples_programming/mira_101.C
@@ -0,0 +1,114 @@
+/*
+ * Written by Bastien Chevreux (BaCh)
+ *
+ * Copyright (C) 2007 and later by Bastien Chevreux
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ * 
+ */
+
+// 	$Id$	
+
+
+/*****************************************************************
+ *
+ * Example mira_101
+ *
+ * Simply copy the behaviour of the "mira" executable (without
+ *  miraEST part): perform an assembly as defined by the user on 
+ *  the command line
+ *
+ * Topics covered:
+ * - always enclose usage of MIRA classes with a try/catch block
+ *   (at least on the main program level)
+ * - simple usage of the the MIRAParameter class
+ * - simple usage of the Assembly class
+ *
+ *****************************************************************/
+
+
+// include C++ iostreams
+#include <iostream>
+
+// include the MIRA assembly class
+#include "mira/assembly.H"
+
+
+int main(int argc, char ** argv)
+{
+  cout << "Example program mira_101: how to make an assembly.\n";
+
+  // ALWAYS use a try/catch block when using MIRA library classes
+  //  the way it is shown here. On nasty problems, the classes will
+  //  throw exceptions to abort.
+
+  try{
+
+    // MIRAParameters contains all parameters the MIRA classes use,
+    //  (especially the ones performing computations) so define one
+    // With the advent of different sequencing types, this has changed
+    //  to a vector of MIRAParameters
+
+    vector<MIRAParameters> Pv;
+
+    // setup standard values for these parameters
+    // you MUST do this
+
+    MIRAParameters::setupStdMIRAParameters(Pv);
+
+    // Parse MIRA parameters from the command line into the class
+    // One can also load them from a file via: P.loadParams("somefile")
+
+    MIRAParameters::parse(argc, argv, Pv);
+
+    // dump the MIRAParameters to stdout so that the user knows
+    //  with which parameters this assembly will run
+
+    cout << "\nParameters parsed without error, perfect.\n\n";
+    MIRAParameters::dumpAllParams(Pv, cout);
+
+    // once the parameters are set, create an instance of the Assembly 
+    //  class, passing the parameter vector as reference
+    Assembly as(Pv, false);
+
+    // tell class to load all necessary data as instructed by parameters
+    as.loadSequenceData();
+
+    // tell class to assemble data as instructed by parameters
+    as.assemble();
+
+    // tell class to save final results as instructed by parameters
+    as.saveResults();
+  }
+  // Catch exceptions as thrown by MIRA classes
+  catch(Notify n){
+    n.handleError("main");
+    return 1;
+  }
+  catch(Flow f){
+    cerr << "INTERNAL ERROR: Unexpected exception: Flow()\n";
+    return 1;
+  }
+  // you can define own catches here
+  catch(...){
+    cerr << "Unknown exception caught, aborting the process.\n\n";
+    return 1;
+  }
+
+  return 0;
+}
diff --git a/src/examples_programming/read_101.C b/src/examples_programming/read_101.C
new file mode 100644
index 0000000..9c04eee
--- /dev/null
+++ b/src/examples_programming/read_101.C
@@ -0,0 +1,155 @@
+/*
+ * Written by Bastien Chevreux (BaCh)
+ *
+ * Copyright (C) 2007 and later by Bastien Chevreux
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ * 
+ */
+
+// 	$Id$	
+
+
+/*****************************************************************
+ *
+ * Example read_101
+ *
+ *
+ * Topics covered:
+ * - always enclose usage of MIRA classes with a try/catch block
+ *   (at least on the main program level)
+ * - setting name and sequence
+ * - setting quality and sequencing vector clips
+ * - defining output types
+ * - setting quality values
+ * - sequence and quality manipulation
+ * - setting additional information like template name etc.
+ * - adding tags to sequences
+ *
+ *****************************************************************/
+
+// include C++ iostreams
+#include <iostream>
+
+// include MIRA read class
+#include "mira/read.H"
+
+
+int main(int argc, char ** argv)
+{
+  cout << "Example program read_101: basic Read functions.\n";
+
+  // ALWAYS use a try/catch block when using MIRA library classes
+  //  the way it is shown here. On nasty problems, the classes will
+  //  throw exceptions to abort.
+
+  try{
+    // create a read
+    Read r;
+
+    // we want our read at the minimum to have a name and a sequence
+    //  for the read
+    r.setName("U45pbk14A");
+    r.setSequenceFromString("aggtcatgacttctcatgactgcatcatctgctactgatcgtgcatg");
+
+    // have a look at how it looks like ... as FASTA
+    // tell the read class to output as FASTA
+    Read::setCoutType(Read::AS_FASTA);
+    cout << r;
+
+    /**************** Clips and output types ******************/
+
+    // play a bit around: set left and right (quality) clips
+    r.setClipoffs(3,r.getLenSeq()-6, false);
+    // look at it again (still FASTA)
+    cout << r;
+    // and now only the clipped part
+    Read::setCoutType(Read::AS_CLIPPEDFASTA);
+    cout << r;
+
+    // set left sequencing vector clip
+    r.setLSClipoff(7);
+    // look at it again (still CLIPPEDFASTA)
+    cout << r;
+
+    // have a look at it in gap4 EXP file format
+    Read::setCoutType(Read::AS_GAP4DA);
+    cout << r;
+
+    /******************* Quality values ***********************/
+    // the default quality value for each base in a read is 10
+    // set it to something else, like 25
+    r.setQualities(25);
+    cout << r;
+
+    // if you have a vector qith qualities (perhaps loaded from
+    //  a file), well, then this also works.
+    // here we use a vector with all values at 1
+    {
+      vector<base_quality_t> quals(r.getLenSeq(),1);
+      r.setQualities(quals);
+    }
+    cout << r;
+
+    /************ Sequence and quality manipulation **********/
+    // change, insert and delete a base in the sequence
+    // change base at pos 12 to A and give quality 99
+    r.changeBaseInSequence('A',99,12);
+
+    // delete base at position 14
+    r.deleteBaseFromSequence(14);
+
+    // insert a base 'G' at position 16 with quality 98
+    r.insertBaseInSequence('G',98,16, false);
+
+    cout << r;
+
+    /************ Set a few additional information ***********/
+    r.setTemplate("ACklp56tft");
+    r.setClonevecName("pGEX-3x");
+    r.setSeqvecName("M13mp18");
+
+    cout << r;
+
+    /***************** Setting tags **************************/
+    r.addTag(8,15,"MIRA","An example tag.");
+
+    // oh well, just for fun change the output type to CAF
+    // (note that e.g. the cloning vector name is not contained 
+    //  in this format)
+    Read::setCoutType(Read::AS_CAF);
+    cout << r;
+  }
+  // Catch exceptions as thrown by MIRA classes
+  catch(Notify n){
+    n.handleError("main");
+    return 1;
+  }
+  catch(Flow f){
+    cerr << "INTERNAL ERROR: Unexpected exception: Flow()\n";
+    return 1;
+  }
+  // you can define own catches here
+  catch(...){
+    cerr << "Unknown exception caught, aborting the process.\n\n";
+    return 1;
+  }
+
+  return 0;
+}
+
diff --git a/src/examples_programming/readpool_101.C b/src/examples_programming/readpool_101.C
new file mode 100644
index 0000000..4b7e33b
--- /dev/null
+++ b/src/examples_programming/readpool_101.C
@@ -0,0 +1,142 @@
+/*
+ * Written by Bastien Chevreux (BaCh)
+ *
+ * Copyright (C) 2007 and later by Bastien Chevreux
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ * 
+ */
+
+
+// 	$Id$	
+
+
+/*****************************************************************
+ *
+ * Example readpool_101
+ *
+ *
+ * Topics covered:
+ * - always enclose usage of MIRA classes with a try/catch block
+ *   (at least on the main program level)
+ * - add new empty reads to a ReadPool
+ * - accessing reads in readpool by index or by name
+ * - (from class Read: setting some basic values)
+ * - (from class Read: output single reads)
+ * - dumping the readpool in different formats to a stream
+ *
+ *****************************************************************/
+
+// include C++ iostreams
+#include <iostream>
+
+// include MIRA readpool class
+#include "mira/readpool.H"
+
+
+int main(int argc, char ** argv)
+{
+  cout << "Example program readpool_101: basic ReadPool functions.\n";
+
+  // ALWAYS use a try/catch block when using MIRA library classes
+  //  the way it is shown here. On nasty problems, the classes will
+  //  throw exceptions to abort.
+
+  try{
+    // for creating a readpool, we need a vector of MIRAParameters
+    vector<MIRAParameters> Pv;
+    MIRAParameters::setupStdMIRAParameters(Pv);
+
+    // create a readpool
+    ReadPool thepool(&Pv);
+
+    // create three new empty reads in the readpool
+    thepool.addNewEmptyRead();
+    thepool.addNewEmptyRead();
+    thepool.addNewEmptyRead();
+
+    // initialise that last read in the pool with some values
+    thepool.back().setName("MyRead3");
+    thepool.back().setSequenceFromString("ttggtacgtacgttggtac");
+    thepool.back().setRQClipoff(thepool.back().getLenSeq()-9);
+
+
+    // initialise the first read in the pool with some values
+    thepool[0].setName("MyRead1");
+    thepool[0].setSequenceFromString("gacttgactagctgactgactgacgtacgtac");
+    thepool[0].setLSClipoff(7);
+
+    // The second new empty read in the readpool
+    // won't be initialised with sequence -> read will be invalid
+    thepool[1].setName("MyRead2");
+
+
+    // dump some pool info to cout stream
+    thepool.dumpPoolInfo(cout);
+
+    // fetch the read with index 0 (== the first)
+    // and dump to cout as EXP (GAP4DA) format
+    Read & aread=thepool[0];
+    Read::setCoutType(Read::AS_GAP4DA);
+    cout << aread;
+
+
+    // fetch the read with name "MyRead2" (== the second)
+    // and dump to cout as text format (for debugging or so)
+    aread=thepool.getRead("MyRead2");
+    Read::setCoutType(Read::AS_TEXT);
+    cout << aread;
+
+
+    // dump all the reads (valid and invalid) as CAF to cout
+    thepool.dumpAs(cout,Read::AS_CAF,true);
+
+    // dump the valid reads as CAF to cout
+    thepool.dumpAs(cout,Read::AS_CAF,false);
+
+    // dump the valid reads with sequencing vector masked to cout
+    //  as FASTA
+    thepool.dumpAs(cout,Read::AS_SEQVECMASKEDFASTA,false);
+    //  as FASTA quality
+    thepool.dumpAs(cout,Read::AS_SEQVECMASKEDFASTAQUAL,false);
+
+    // dump the valid reads, only the "good" part without clips
+    //  as FASTA
+    thepool.dumpAs(cout,Read::AS_CLIPPEDFASTA,false);
+    //  as FASTA quality
+    thepool.dumpAs(cout,Read::AS_CLIPPEDFASTAQUAL,false);
+  }
+  // Catch exceptions as thrown by MIRA classes
+  catch(Notify n){
+    n.handleError("main");
+    return 1;
+  }
+  catch(Flow f){
+    cerr << "INTERNAL ERROR: Unexpected exception: Flow()\n";
+    return 1;
+  }
+  // you can define own catches here
+  catch(...){
+    cerr << "Unknown exception caught, aborting the process.\n\n";
+    return 1;
+  }
+
+
+  return 0;
+}
+
diff --git a/src/io/Makefile.am b/src/io/Makefile.am
index ad413ed..84775db 100644
--- a/src/io/Makefile.am
+++ b/src/io/Makefile.am
@@ -1,49 +1,8 @@
-AM_CPPFLAGS = -I$(top_srcdir)/src $(all_includes)
+INCLUDES = -I$(top_srcdir)/src $(all_includes)
 
-clean-local:
-	rm -rf *flexer.cc *xxd.H
-
-so.obo.xxd: so.obo
-	@echo "Reducing so.obo for smaller so.obo.xxd"
-	@grep -E '^\[|^id:|^name:' so.obo >so.obo.xxd
-
-SUFFIXES= .xxd
-
-%.xxd.H: %.xxd
-	@echo "Making .H out of .xxd" $@
-	@$(SHELL) -ec 'grep -v "^#" $< | xxd -i >$<.H'
-
-
-libmirafio_a_XXDSRC = mira_ft_set.xxd gap4_ft_so_map.xxd so.obo.xxd so2xgap4map.xxd oldso2so.xxd
-BUILT_SOURCES=$(libmirafio_a_XXDSRC:.xxd=.xxd.H)
-nodist_libmirafio_a_SOURCES=$(libmirafio_a_XXDSRC:.xxd=.xxd.H)
+noinst_LIBRARIES = libmirafio.a
+libmirafio_a_SOURCES= gbf.C generalio.C fasta.C fastq-mira.C phd.C scf.C exp.C ncbiinfoxml.C exp_flexer.ll
+noinst_HEADERS= exp.H fasta.H fastq-mira.H fastq-lh.H gbf.H generalio.H ncbiinfoxml.H scf.H phd.H tokens.h
 
 
-noinst_LIBRARIES = libmirafio.a
-libmirafio_a_SOURCES= \
-	annotationmappings.C\
-	exp.C\
-	generalio.C\
-	fasta.C\
-	fastq-mira.C\
-	phd.C\
-	scf.C\
-	ncbiinfoxml.C\
-	exp_flexer.ll\
-	gap4_ft_so_map.xxd\
-	mira_ft_set.xxd\
-	oldso2so.xxd\
-	so2xgap4map.xxd\
-	so.obo
 
-noinst_HEADERS= \
-	annotationmappings.H\
-	exp.H\
-	fasta.H\
-	fastq-mira.H\
-	fastq-lh.H\
-	generalio.H\
-	ncbiinfoxml.H\
-	phd.H\
-	scf.H\
-	tokens.h
diff --git a/src/io/Makefile.in b/src/io/Makefile.in
index ba4aa78..77894f5 100644
--- a/src/io/Makefile.in
+++ b/src/io/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -39,14 +39,22 @@ subdir = src/io
 DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in exp_flexer.cc
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/ax_boost_base.m4 \
-	$(top_srcdir)/m4/ax_boost_filesystem.m4 \
-	$(top_srcdir)/m4/ax_boost_iostreams.m4 \
-	$(top_srcdir)/m4/ax_boost_regex.m4 \
-	$(top_srcdir)/m4/ax_boost_system.m4 \
-	$(top_srcdir)/m4/ax_boost_thread.m4 \
-	$(top_srcdir)/m4/ax_check_zlib.m4 \
-	$(top_srcdir)/m4/ax_lib_expat.m4 $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/config/m4/ax_boost_base.m4 \
+	$(top_srcdir)/config/m4/ax_boost_regex.m4 \
+	$(top_srcdir)/config/m4/ax_boost_thread.m4 \
+	$(top_srcdir)/config/m4/ax_check_zlib.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_std.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_stl.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_namespaces.m4 \
+	$(top_srcdir)/config/m4/ax_lib_expat.m4 \
+	$(top_srcdir)/config/m4/ax_with_perl.m4 \
+	$(top_srcdir)/config/m4/ax_with_prog.m4 \
+	$(top_srcdir)/config/m4/libtool.m4 \
+	$(top_srcdir)/config/m4/ltoptions.m4 \
+	$(top_srcdir)/config/m4/ltsugar.m4 \
+	$(top_srcdir)/config/m4/ltversion.m4 \
+	$(top_srcdir)/config/m4/lt~obsolete.m4 \
+	$(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -56,14 +64,11 @@ LIBRARIES = $(noinst_LIBRARIES)
 ARFLAGS = cru
 libmirafio_a_AR = $(AR) $(ARFLAGS)
 libmirafio_a_LIBADD =
-am_libmirafio_a_OBJECTS = annotationmappings.$(OBJEXT) exp.$(OBJEXT) \
-	generalio.$(OBJEXT) fasta.$(OBJEXT) fastq-mira.$(OBJEXT) \
-	phd.$(OBJEXT) scf.$(OBJEXT) ncbiinfoxml.$(OBJEXT) \
+am_libmirafio_a_OBJECTS = gbf.$(OBJEXT) generalio.$(OBJEXT) \
+	fasta.$(OBJEXT) fastq-mira.$(OBJEXT) phd.$(OBJEXT) \
+	scf.$(OBJEXT) exp.$(OBJEXT) ncbiinfoxml.$(OBJEXT) \
 	exp_flexer.$(OBJEXT)
-am__objects_1 =
-nodist_libmirafio_a_OBJECTS = $(am__objects_1)
-libmirafio_a_OBJECTS = $(am_libmirafio_a_OBJECTS) \
-	$(nodist_libmirafio_a_OBJECTS)
+libmirafio_a_OBJECTS = $(am_libmirafio_a_OBJECTS)
 DEFAULT_INCLUDES = -I. at am__isrc@
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
@@ -77,9 +82,9 @@ CXXLD = $(CXX)
 CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	--mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
 	$(LDFLAGS) -o $@
-LEXCOMPILE = $(LEX) $(AM_LFLAGS) $(LFLAGS)
+LEXCOMPILE = $(LEX) $(LFLAGS) $(AM_LFLAGS)
 LTLEXCOMPILE = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=compile $(LEX) $(AM_LFLAGS) $(LFLAGS)
+	--mode=compile $(LEX) $(LFLAGS) $(AM_LFLAGS)
 YLWRAP = $(top_srcdir)/ylwrap
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -90,7 +95,7 @@ CCLD = $(CC)
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
 	$(LDFLAGS) -o $@
-SOURCES = $(libmirafio_a_SOURCES) $(nodist_libmirafio_a_SOURCES)
+SOURCES = $(libmirafio_a_SOURCES)
 DIST_SOURCES = $(libmirafio_a_SOURCES)
 HEADERS = $(noinst_HEADERS)
 ETAGS = etags
@@ -106,13 +111,9 @@ AWK = @AWK@
 BITPACKAGE = @BITPACKAGE@
 BLOODYDARWINSTATLIBDIRHACK = @BLOODYDARWINSTATLIBDIRHACK@
 BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
-BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@
-BOOST_IOSTREAMS_LIB = @BOOST_IOSTREAMS_LIB@
 BOOST_LDFLAGS = @BOOST_LDFLAGS@
 BOOST_REGEX_LIB = @BOOST_REGEX_LIB@
-BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@
 BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
-BUNDLETARGET = @BUNDLETARGET@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
@@ -125,7 +126,6 @@ CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -135,13 +135,11 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LDFLAGS = @EXPAT_LDFLAGS@
-EXPAT_LIBS = @EXPAT_LIBS@
 EXPAT_VERSION = @EXPAT_VERSION@
 FGREP = @FGREP@
 FLEX = @FLEX@
 FLEXPP = @FLEXPP@
 GREP = @GREP@
-HAVE_XXD = @HAVE_XXD@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -159,7 +157,6 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
 MIRASTATIC = @MIRASTATIC@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
@@ -176,17 +173,18 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
+SHORTMIRAAUDIENCE = @SHORTMIRAAUDIENCE@
 STRIP = @STRIP@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -220,6 +218,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -235,45 +234,14 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-AM_CPPFLAGS = -I$(top_srcdir)/src $(all_includes)
-SUFFIXES = .xxd
-libmirafio_a_XXDSRC = mira_ft_set.xxd gap4_ft_so_map.xxd so.obo.xxd so2xgap4map.xxd oldso2so.xxd
-BUILT_SOURCES = $(libmirafio_a_XXDSRC:.xxd=.xxd.H)
-nodist_libmirafio_a_SOURCES = $(libmirafio_a_XXDSRC:.xxd=.xxd.H)
+INCLUDES = -I$(top_srcdir)/src $(all_includes)
 noinst_LIBRARIES = libmirafio.a
-libmirafio_a_SOURCES = \
-	annotationmappings.C\
-	exp.C\
-	generalio.C\
-	fasta.C\
-	fastq-mira.C\
-	phd.C\
-	scf.C\
-	ncbiinfoxml.C\
-	exp_flexer.ll\
-	gap4_ft_so_map.xxd\
-	mira_ft_set.xxd\
-	oldso2so.xxd\
-	so2xgap4map.xxd\
-	so.obo
-
-noinst_HEADERS = \
-	annotationmappings.H\
-	exp.H\
-	fasta.H\
-	fastq-mira.H\
-	fastq-lh.H\
-	generalio.H\
-	ncbiinfoxml.H\
-	phd.H\
-	scf.H\
-	tokens.h
-
-all: $(BUILT_SOURCES)
-	$(MAKE) $(AM_MAKEFLAGS) all-am
+libmirafio_a_SOURCES = gbf.C generalio.C fasta.C fastq-mira.C phd.C scf.C exp.C ncbiinfoxml.C exp_flexer.ll
+noinst_HEADERS = exp.H fasta.H fastq-mira.H fastq-lh.H gbf.H generalio.H ncbiinfoxml.H scf.H phd.H tokens.h
+all: all-am
 
 .SUFFIXES:
-.SUFFIXES: .xxd .C .cc .ll .lo .o .obj
+.SUFFIXES: .C .cc .ll .lo .o .obj
 $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
@@ -307,7 +275,7 @@ $(am__aclocal_m4_deps):
 
 clean-noinstLIBRARIES:
 	-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
-libmirafio.a: $(libmirafio_a_OBJECTS) $(libmirafio_a_DEPENDENCIES) $(EXTRA_libmirafio_a_DEPENDENCIES) 
+libmirafio.a: $(libmirafio_a_OBJECTS) $(libmirafio_a_DEPENDENCIES) 
 	-rm -f libmirafio.a
 	$(libmirafio_a_AR) libmirafio.a $(libmirafio_a_OBJECTS) $(libmirafio_a_LIBADD)
 	$(RANLIB) libmirafio.a
@@ -318,11 +286,11 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/annotationmappings.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/exp.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/exp_flexer.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fasta.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fastq-mira.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gbf.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/generalio.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ncbiinfoxml.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/phd.Po at am__quote@
@@ -462,12 +430,10 @@ distdir: $(DISTFILES)
 	  fi; \
 	done
 check-am: all-am
-check: $(BUILT_SOURCES)
-	$(MAKE) $(AM_MAKEFLAGS) check-am
+check: check-am
 all-am: Makefile $(LIBRARIES) $(HEADERS)
 installdirs:
-install: $(BUILT_SOURCES)
-	$(MAKE) $(AM_MAKEFLAGS) install-am
+install: install-am
 install-exec: install-exec-am
 install-data: install-data-am
 uninstall: uninstall-am
@@ -477,15 +443,10 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	if test -z '$(STRIP)'; then \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	      install; \
-	else \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-	fi
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
 mostlyclean-generic:
 
 clean-generic:
@@ -498,11 +459,10 @@ maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
 	@echo "it deletes files that may require special tools to rebuild."
 	-rm -f exp_flexer.cc
-	-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
 clean: clean-am
 
-clean-am: clean-generic clean-libtool clean-local \
-	clean-noinstLIBRARIES mostlyclean-am
+clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
+	mostlyclean-am
 
 distclean: distclean-am
 	-rm -rf ./$(DEPDIR)
@@ -570,33 +530,21 @@ ps-am:
 
 uninstall-am:
 
-.MAKE: all check install install-am install-strip
+.MAKE: install-am install-strip
 
 .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
-	clean-libtool clean-local clean-noinstLIBRARIES ctags \
-	distclean distclean-compile distclean-generic \
-	distclean-libtool distclean-tags distdir dvi dvi-am html \
-	html-am info info-am install install-am install-data \
-	install-data-am install-dvi install-dvi-am install-exec \
-	install-exec-am install-html install-html-am install-info \
-	install-info-am install-man install-pdf install-pdf-am \
-	install-ps install-ps-am install-strip installcheck \
-	installcheck-am installdirs maintainer-clean \
-	maintainer-clean-generic mostlyclean mostlyclean-compile \
-	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
-	tags uninstall uninstall-am
-
-
-clean-local:
-	rm -rf *flexer.cc *xxd.H
-
-so.obo.xxd: so.obo
-	@echo "Reducing so.obo for smaller so.obo.xxd"
-	@grep -E '^\[|^id:|^name:' so.obo >so.obo.xxd
-
-%.xxd.H: %.xxd
-	@echo "Making .H out of .xxd" $@
-	@$(SHELL) -ec 'grep -v "^#" $< | xxd -i >$<.H'
+	clean-libtool clean-noinstLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-strip installcheck installcheck-am installdirs \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+	pdf pdf-am ps ps-am tags uninstall uninstall-am
+
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/src/io/annotationmappings.C b/src/io/annotationmappings.C
deleted file mode 100644
index de4ee4a..0000000
--- a/src/io/annotationmappings.C
+++ /dev/null
@@ -1,348 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 2003 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-#include "annotationmappings.H"
-
-#include <boost/algorithm/string.hpp>
-#include <boost/tokenizer.hpp>
-
-using namespace std;
-
-
-const string AnnotationMappings::AM_emptystring;
-
-AnnotationMappings::strstr_bimap AnnotationMappings::AM_map_xgap4ANDsoterm;
-AnnotationMappings::strstr_bimap AnnotationMappings::AM_map_soidANDsoterm;
-//AnnotationMappings::strstr_bimap AnnotationMappings::AM_map_gap4ANDsoterm;
-//AnnotationMappings::strstr_bimap AnnotationMappings::AM_map_gbfANDsoterm;
-
-unordered_map<string,string> AnnotationMappings::AM_map_gap4TOsoterm;
-unordered_map<string,string> AnnotationMappings::AM_map_sotermTOgap4;
-
-unordered_map<string,string> AnnotationMappings::AM_map_gbfTOsoterm;
-unordered_map<string,string> AnnotationMappings::AM_map_sotermTOgbf;
-
-unordered_map<string,string> AnnotationMappings::AM_map_oldsotermTOsoterm;
-
-unordered_set<string> AnnotationMappings::AM_set_miratags;
-
-const bool AnnotationMappings::AM_staticinit=AnnotationMappings::staticInitialiser();
-
-// Plain vanilla constructor
-AnnotationMappings::AnnotationMappings()
-{
-  FUNCSTART("AnnotationMappings::AnnotationMappings()");
-
-  zeroVars();
-  init();
-
-  ERROR("Not implemented yet.");
-  FUNCEND();
-}
-
-void AnnotationMappings::zeroVars()
-{
-  FUNCSTART("void AnnotationMappings::zeroVars()");
-  FUNCEND();
-}
-
-void AnnotationMappings::init()
-{
-  FUNCSTART("void AnnotationMappings::init()");
-  FUNCEND();
-}
-
-
-
-AnnotationMappings::~AnnotationMappings()
-{
-  FUNCSTART("AnnotationMappings::~AnnotationMappings()");
-
-  discard();
-
-  ERROR("Not implemented yet.");
-  FUNCEND();
-}
-
-
-void AnnotationMappings::discard()
-{
-  FUNCSTART("AnnotationMappings::discard()");
-
-  zeroVars();
-
-  FUNCEND();
-}
-
-// remember: this is run before main(), so cannot really throw something here
-//  as nothing would catch it, hence no error message printed
-bool AnnotationMappings::staticInitialiser()
-{
-  FUNCSTART("bool AnnotationMappings::staticInitialiser()");
-
-  {
-    istringstream tmpis;
-    static const char mappingfile[] = {
-#include "mira_ft_set.xxd.H"
-      ,0
-    };
-    tmpis.str(mappingfile);
-
-    string tmpline;
-
-    while(getline(tmpis,tmpline)){
-      boost::trim(tmpline);
-      if(tmpline.empty()
-	 || tmpline[0]=='#') continue;
-
-      AM_set_miratags.insert(tmpline);
-    }
-  }
-
-  {
-    istringstream tmpis;
-    static const char mappingfile[] = {
-#include "gap4_ft_so_map.xxd.H"
-      ,0
-    };
-    tmpis.str(mappingfile);
-
-    string tmpline;
-    vector<string> tmpline_splitted;
-
-    while(getline(tmpis,tmpline)){
-      //boost::trim(tmpline);
-      if(tmpline.empty()
-	 || tmpline[0]=='#') continue;
-
-      tmpline_splitted.clear();
-      boost::split(tmpline_splitted, tmpline, boost::is_any_of("\t"));
-      if(tmpline_splitted.size()!=6){
-	string tmptmp(tmpline);
-	boost::trim(tmptmp);
-	if(tmptmp.empty()) continue;
-	cerr << "gap4_ft_so_map.xxd.H: line contains " << tmpline_splitted.size() << " entries instead of 6. Line:\n"<<tmpline<<"\nOuch.\n";
-	exit(1000);
-      }
-      // SO term empty? nothing to map
-      if(tmpline_splitted[2].empty()) continue;
-      if(!tmpline_splitted[0].empty()){
-	//AM_map_gap4ANDsoterm.insert(strstr_bimap_valuetype(tmpline_splitted[0],tmpline_splitted[2]));
-	AM_map_gap4TOsoterm[tmpline_splitted[0]]=tmpline_splitted[2];
-	AM_map_sotermTOgap4[tmpline_splitted[2]]=tmpline_splitted[0];
-      }
-      if(!tmpline_splitted[1].empty()){
-	//AM_map_gbfANDsoterm.insert(strstr_bimap_valuetype(tmpline_splitted[1],tmpline_splitted[2]));
-	AM_map_gbfTOsoterm[tmpline_splitted[1]]=tmpline_splitted[2];
-	AM_map_sotermTOgbf[tmpline_splitted[2]]=tmpline_splitted[1];
-      }
-    }
-  }
-
-
-  {
-    istringstream tmpis;
-    static const char mappingfile[] = {
-#include "so.obo.xxd.H"
-      ,0
-    };
-    tmpis.str(mappingfile);
-
-    string soterm;
-    string soid;
-    string tmpline;
-    vector<string> tmpline_splitted;
-
-    while(getline(tmpis,tmpline)){
-      //cout << "Line: " << tmpline << endl;
-      boost::trim(tmpline);
-      if(tmpline.empty()
-	 || tmpline[0]=='#') continue;
-      if(tmpline[0]=='['){
-	if(!soterm.empty() && !soid.empty()){
-	  //cout << "Adding ###" << soterm << "###" << soid << "###\n";
-	  AM_map_soidANDsoterm.insert(strstr_bimap_valuetype(soid,soterm));
-	}
-	soterm.clear();
-	soid.clear();
-      }else{
-	tmpline_splitted.clear();
-	boost::split(tmpline_splitted, tmpline, boost::is_any_of("\t "));
-	if(tmpline_splitted.size()!=2){
-	  // Do nothing
-	  // apparently sometimes the OBO contains errors where spaces have not been replaced by underscores
-	  // In this case, silently drop this term
-
-	  // cerr << "so.obo.xxd.H: line contains " << tmpline_splitted.size() << " entries instead of 2. Line:\n"<<tmpline<<"\nOuch.\n";
-	  //exit(1000);
-
-	}else{
-	  if(tmpline_splitted[0]=="id:"){
-	    soid=tmpline_splitted[1];
-	  }else if(tmpline_splitted[0]=="name:"){
-	    soterm=tmpline_splitted[1];
-	  }else{
-	    cerr << "so.obo.xxd.H: unexpected key in line:\n"<<tmpline<<"\nOuch.\n";
-	  }
-	}
-      }
-    }
-  }
-
-  {
-    istringstream tmpis;
-    static const char mappingfile[] = {
-#include "oldso2so.xxd.H"
-      ,0
-    };
-    tmpis.str(mappingfile);
-
-    string oldsoterm;
-    string soterm;
-    string tmpline;
-    vector<string> tmpline_splitted;
-
-    while(getline(tmpis,tmpline)){
-      //cout << "Line: " << tmpline << endl;
-      boost::trim(tmpline);
-      if(tmpline.empty()
-	 || tmpline[0]=='#') continue;
-      tmpline_splitted.clear();
-      boost::split(tmpline_splitted, tmpline, boost::is_any_of("\t"));
-      if(tmpline_splitted.size()!=2){
-	string tmptmp(tmpline);
-	boost::trim(tmptmp);
-	if(tmptmp.empty()) continue;
-	cerr << "oldso.xxd.H: line contains " << tmpline_splitted.size() << " entries instead of 2. Line:\n"<<tmpline<<"\nOuch.\n";
-	exit(1000);
-      }
-      if(translateSOfeat2SOID(tmpline_splitted[1]).empty()){
-	cerr << "oldso2so.xxd.H: new SO term " << tmpline_splitted[1] << " does not exist in SO?\n";
-	exit(1000);
-      }
-      AM_map_oldsotermTOsoterm[tmpline_splitted[0]]=tmpline_splitted[1];
-    }
-  }
-
-
-  {
-    istringstream tmpis;
-    static const char mappingfile[] = {
-#include "so2xgap4map.xxd.H"
-      ,0
-    };
-    tmpis.str(mappingfile);
-
-    string tmpline;
-    vector<string> tmpline_splitted;
-
-    while(getline(tmpis,tmpline)){
-      //cout << "Line: " << tmpline << endl;
-      boost::trim(tmpline);
-      if(tmpline.empty()
-	 || tmpline[0]=='#') continue;
-      tmpline_splitted.clear();
-      boost::split(tmpline_splitted, tmpline, boost::is_any_of("\t "));
-      if(tmpline_splitted.size()!=2){
-	cerr << "so2xgap4map.xxd.H: line contains " << tmpline_splitted.size() << " entries instead of 2. Line:\n"<<tmpline<<"\nOuch.\n";
-	exit(1000);
-      }
-      if(tmpline_splitted[0].empty()){
-	cerr << "so2xgap4map.xxd.H: line has empty key field? Line:\n"<<tmpline<<"\nOuch.\n";
-	exit(1000);
-      }
-      if(tmpline_splitted[1].empty()){
-	cerr << "so2xgap4map.xxd.H: line has empty value field? Line:\n"<<tmpline<<"\nOuch.\n";
-	exit(1000);
-      }
-      AM_map_xgap4ANDsoterm.insert(strstr_bimap_valuetype(tmpline_splitted[1],tmpline_splitted[0]));
-    }
-    //cout << "xgap 2 so map: " << AM_map_xgap4ANDsoterm.size() << endl;
-  }
-
-
-  {
-    char buffer[24];
-    uint32 xnum=4095;
-    for(;true; --xnum){
-      sprintf(buffer, "%03x", xnum);
-      string xgap4="X"+static_cast<string>(&buffer[0]);
-      if(!translateXGAP4feat2SOfeat(xgap4).empty()) break;
-    }
-    ++xnum;
-
-    //cout << "highest xnum:" << xnum << endl;
-
-    for(auto sotI=AM_map_soidANDsoterm.right.begin(); sotI!=AM_map_soidANDsoterm.right.end(); ++sotI){
-      //cout << sotI->first << '\t'  << translateSOfeat2GAP4feat(sotI->first) << endl;
-      if(translateSOfeat2GAP4feat(sotI->first).empty() && translateSOfeat2XGAP4feat(sotI->first).empty()){
-	sprintf(buffer, "%03x", xnum);
-	string xgap4="X"+static_cast<string>(&buffer[0]);
-	if(translateXGAP4feat2SOfeat(xgap4).empty()){
-	  AM_map_xgap4ANDsoterm.insert(strstr_bimap_valuetype(xgap4,sotI->first));
-	}else{
-	  cerr << "Tried to add " << sotI->first << " as new xgap4 term, but xgap4 id " << xgap4 << " already exists?\nOuch.\n";
-	  exit(1000);
-	}
-	cout << "New gap4 xdb: " << sotI->first << "\t" << xgap4 << endl;
-	++xnum;
-      }
-    }
-  }
-
-  return true;
-}
-
-
-//// Copy constructor
-////  no discard needed as this object will be freshly created when
-////  called through this constructor
-//AnnotationMappings::AnnotationMappings(AnnotationMappings const &other)
-//{
-//  FUNCSTART("AnnotationMappings::AnnotationMappings(AnnotationMappings const &other)");
-//
-//  ??_valid=0;
-//
-//  *this=other;                               // call the copy operator
-//
-//  FUNCEND();
-//}
-//
-//// Copy operator, needed by copy-constructor
-//AnnotationMappings const & AnnotationMappings::operator=(AnnotationMappings const & other)
-//{
-//  FUNCSTART("AnnotationMappings const & AnnotationMappings::operator=(AnnotationMappings const & other)");
-//  ERROR("Not implemented yet.");
-//  FUNCEND();
-//  return *this;
-//}
-
-//ostream & operator<<(ostream &ostr, AnnotationMappings const &???)
-//{
-//  FUNCSTART("friend ostream & AnnotationMappings::operator<<(ostream &ostr, const  &???)");
-//  ERROR("Not implemented yet.");
-//
-//  FUNCEND();
-//  return ostr;
-//}
diff --git a/src/io/annotationmappings.H b/src/io/annotationmappings.H
deleted file mode 100644
index e4a22b6..0000000
--- a/src/io/annotationmappings.H
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 2003 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-#ifndef _bas_annomap_h_
-#define _bas_annomap_h_
-
-#include <iostream>
-
-#include "stdinc/defines.H"
-#include "errorhandling/errorhandling.H"
-
-#include <unordered_set>
-#include <unordered_map>
-
-#include <boost/bimap.hpp>
-
-
-class AnnotationMappings
-{
-  //Variables
-private:
-  static const bool AM_staticinit;
-
-  static const std::string AM_emptystring;
-
-  typedef boost::bimap< std::string, std::string > strstr_bimap;
-  typedef strstr_bimap::value_type strstr_bimap_valuetype;
-
-  static strstr_bimap AM_map_soidANDsoterm;
-
-  static strstr_bimap AM_map_xgap4ANDsoterm;  // eXtended gap4 identifiers
-
-  // cannot use bimaps for these as some multiple gap4/gbf terms map to one SO term
-  // e.g.: gbf: prim_transcript & precursor_RNA -> SO: primary_transcript
-  // *sigh*
-
-  static std::unordered_map<std::string,std::string> AM_map_gap4TOsoterm;
-  static std::unordered_map<std::string,std::string> AM_map_sotermTOgap4;
-
-  static std::unordered_map<std::string,std::string> AM_map_gbfTOsoterm;
-  static std::unordered_map<std::string,std::string> AM_map_sotermTOgbf;
-
-  static std::unordered_map<std::string,std::string> AM_map_oldsotermTOsoterm;
-
-  static std::unordered_set<std::string> AM_set_miratags;
-
-  //static strstr_bimap AM_map_gap4ANDsoterm;
-  //static strstr_bimap AM_map_gbfANDsoterm;
-
-
-
-public:
-
-
-  //Functions
-private:
-  void init();
-  void zeroVars();
-  static bool staticInitialiser();
-
-  static const std::string & translateFeat2Other(const strstr_bimap::right_map & map, const std::string & text) {
-    // first use of C++11 feature in MIRA!
-    // and that's because I initially could not figure out the return type of
-    //   AM_map_gap4ANDsoterm.right.find(feature);
-    // from the BOOST::bimap docs
-    //
-    // oh well, let's start using C++11 right now
-
-    auto I=map.find(text);
-    if(I==map.end()) return AM_emptystring;
-    return I->second;
-  }
-  static const std::string & translateOther2Feat(const strstr_bimap::left_map & map, const std::string & text) {
-    auto I=map.find(text);
-    if(I==map.end()) return AM_emptystring;
-    return I->second;
-  }
-
-  static const std::string & translateStrToStr(const std::unordered_map<std::string,std::string> & map, const std::string & text) {
-    auto I=map.find(text);
-    if(I==map.end()) return AM_emptystring;
-    return I->second;
-  }
-
-public:
-  AnnotationMappings();
-  AnnotationMappings(AnnotationMappings const &other);
-  ~AnnotationMappings();
-
-  AnnotationMappings const & operator=(AnnotationMappings const & other);
-  friend std::ostream & operator<<(std::ostream &ostr, AnnotationMappings const &am);
-
-  void discard();
-
-  inline static const std::string & translateSOfeat2GAP4feat(const std::string & feature){
-    return translateStrToStr(AM_map_sotermTOgap4,feature);
-  }
-  inline static const std::string & translateGAP4feat2SOfeat(const std::string & feature) {
-    return translateStrToStr(AM_map_gap4TOsoterm,feature);
-  };
-
-
-  inline static const std::string & translateSOfeat2GenBankfeat(const std::string & feature){
-    return translateStrToStr(AM_map_sotermTOgbf,feature);
-  }
-  inline static const std::string & translateGenBankfeat2SOfeat(const std::string & feature){
-    return translateStrToStr(AM_map_gbfTOsoterm,feature);
-  };
-
-
-  inline static const std::string & translateSOfeat2XGAP4feat(const std::string & feature){
-    return translateFeat2Other(AM_map_xgap4ANDsoterm.right,feature);
-  }
-  inline static const std::string & translateXGAP4feat2SOfeat(const std::string & feature) {
-    return translateOther2Feat(AM_map_xgap4ANDsoterm.left,feature);
-  };
-
-
-
-  inline static const std::string & translateSOfeat2SOID(const std::string & feature){
-    return translateFeat2Other(AM_map_soidANDsoterm.right,feature);
-  }
-  inline static const std::string & translateSOID2SOfeat(const std::string & feature){
-    return translateOther2Feat(AM_map_soidANDsoterm.left,feature);
-  };
-
-  inline static const std::string & translateOldSOfeat2SOfeat(const std::string & feature){
-    return translateStrToStr(AM_map_oldsotermTOsoterm,feature);
-  }
-
-
-  static bool isValidGFF3SOEntry(const std::string & text){
-    if(!translateSOfeat2SOID(text).empty()) return true;
-    if(!translateSOID2SOfeat(text).empty()) return true;
-    return false;
-  }
-
-  static bool isValidGAP4Entry(const std::string & text){
-    if(translateXGAP4feat2SOfeat(text).empty()) return false;
-    return true;
-  }
-
-  static bool isMIRAEntry(const std::string & text){
-    return AM_set_miratags.find(text)!=AM_set_miratags.end();
-  }
-};
-
-
-#endif
diff --git a/src/io/exp.C b/src/io/exp.C
index 4c2346d..84147d0 100644
--- a/src/io/exp.C
+++ b/src/io/exp.C
@@ -11,34 +11,36 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
+// 	$Id$	
+
 /*
  * Routines fro simple handling of EXP files
  *
  */
 
 
-#include "tokens.h"
-#include "exp.H"
+#ifndef lint
+static char vcid[] = "$Id$";
+#endif /* lint */
 
-#include <cstdlib>     // atoi() under Cygwin
 
-#define CEBUG(bla)
+#include "tokens.h"
+#include "exp.H"
 
 
-using namespace std;
 
 /*************************************************************************
  *
@@ -72,7 +74,7 @@ void tag_t::serialiseComment(const string & comment, string & result)
  *
  *************************************************************************/
 
-void tag_t::serialiseComment(string & result) const
+void tag_t::serialiseComment(string & result) const 
 {
   serialiseComment(comment,result);
   return;
@@ -142,6 +144,11 @@ bool tag_t::extractGenBankKeyValueFromComment(const string & comment, const stri
 
 
 
+void EXP::foolCompiler()
+{
+#include "stdinc/foolcompiler.C"
+}
+
 
 /*************************************************************************
  *
@@ -235,7 +242,7 @@ void EXP::zeroVars()
 
 //char * EXP::conditionalStrCpy(const char * src)
 //{
-//  if(src == nullptr) return nullptr;
+//  if(src == NULL) return NULL;
 //  uint32 len=strlen(src);
 //  char * dest= new char[len+1];
 //  strcpy(dest, src);
@@ -334,7 +341,7 @@ void EXP::load(const char * filename, bool warning)
       if(warning){
 	cout << "WARNING (in " << filename << "): unknown identifier " << lexer->YYText() << ", assuming oneliner with content:  ";
       }
-      lexer->yylex();
+      lexer->yylex(); 
       if(warning){
 	cout << lexer->YYText() << endl;
       }
@@ -507,7 +514,7 @@ void EXP::load(const char * filename, bool warning)
       CEBUG(lexer->YYText() << "found");
 
       yyretcode=lexer->yylex();
-
+      
       if(yyretcode==EXPT_TAGONELINER){
 	CEBUG("search TAG-ONELINER:");
 	bool needcopy=false;
@@ -634,7 +641,7 @@ void EXP::load(const char * filename, bool warning)
 void EXP::dump()
 {
 
-
+  
   cout << "EXP_bc      " << EXP_bc     << endl;
   cout << "EXP_cf      " << EXP_cf     << endl;
   cout << "EXP_cn      " << EXP_cn     << endl;
@@ -657,9 +664,9 @@ void EXP::dump()
   cout << "EXP_tn      " << EXP_tn     << endl;
   cout << "EXP_op      " << EXP_op     << endl;
   cout << "EXP_pn      " << EXP_pn     << endl;
-
+		
   cout << "EXP_sq      " << EXP_sq     << endl;
-
+		
   cout << "EXP_aq      " << EXP_aq     << endl;
   cout << "EXP_ch      " << EXP_ch     << endl;
   cout << "EXP_pr      " << EXP_pr     << endl;
@@ -673,7 +680,7 @@ void EXP::dump()
   cout << "EXP_qr      " << EXP_qr     << endl;
   cout << "EXP_sl      " << EXP_sl     << endl;
   cout << "EXP_sr      " << EXP_sr     << endl;
-
+		
   cout << "EXP_len_seq " << EXP_len_seq<< endl;
 
 }
diff --git a/src/io/exp.H b/src/io/exp.H
index c3f3240..28df014 100644
--- a/src/io/exp.H
+++ b/src/io/exp.H
@@ -11,20 +11,20 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
-// 	$Id$
+// 	$Id$	
 
 
 #ifndef _exp_h_
@@ -55,12 +55,12 @@
 
 class tag_t {
 public:
-  uint32 from;                  // including
+  uint32 from;                  // including 
   uint32 to;                    // including
   char   strand;                // +, -, = means both
-  std::string identifier;      /* Staden EXP doc says 4 byte id, but BNF
+  string identifier;      /* Staden EXP doc says 4 byte id, but BNF
 				   notation in TAG docs says string :( */
-  std::string comment;
+  string comment;
 
 public:
   inline tag_t(){
@@ -69,21 +69,21 @@ public:
     strand='?';
   };
 
-  void serialiseComment(std::string & result) const;
-  static void serialiseComment(const std::string & comment, std::string & result);
+  void serialiseComment(string & result) const;
+  static void serialiseComment(const string & comment, string & result);
 
-  bool extractGenBankKeyValueFromComment(const std::string & whatkex,
-						std::string & result) const;
-  static bool extractGenBankKeyValueFromComment(const std::string & comment,
-						const std::string & whatkex,
-						std::string & result);
+  bool extractGenBankKeyValueFromComment(const string & whatkex,
+						string & result) const;
+  static bool extractGenBankKeyValueFromComment(const string & comment,
+						const string & whatkex,
+						string & result);
 
-  friend std::ostream & operator<<(std::ostream &ostr, const tag_t &t){
-    ostr << "From: " << t.from <<  std::endl;
-    ostr << "To: " << t.to << std::endl;
-    ostr << "Strand: " << t.strand << std::endl;
-    ostr << "Identifier: " << t.identifier << std::endl;
-    ostr << "Comment: " << t.comment << std::endl;
+  friend ostream & operator<<(ostream &ostr, const tag_t &t){
+    ostr << "From: " << t.from <<  endl;
+    ostr << "To: " << t.to << endl;
+    ostr << "Strand: " << t.strand << endl;
+    ostr << "Identifier: " << t.identifier << endl;
+    ostr << "Comment: " << t.comment << endl;
 
     return ostr;
   }
@@ -92,6 +92,8 @@ public:
 // for Read
 inline void emuoc_statsOnType(const tag_t & c, size_t & total_size, size_t & total_freecap, size_t & total_lostba, size_t & num_size, size_t & bytes_size, size_t & overhead, size_t & lostbyalign, bool & iscontainer)
 {
+  CEBUG("emuoc_statsOnType(tag_t): " << typeid(c).name() << endl);
+
   (void) c;
   (void) total_freecap;
   (void) total_lostba;
@@ -111,6 +113,8 @@ inline void emuoc_statsOnType(const tag_t & c, size_t & total_size, size_t & tot
   bytes_size+=estimateMemoryUsageOfContainer(c.comment,false);
 
 
+  CEBUG("Lost by align: " <<lostbyalign << endl);
+
   return;
 }
 
@@ -120,30 +124,30 @@ class EXP
 {
 private:
   // values taken from the exp-file, all strings 0 terminated.
-  std::string EXP_bc;
-  std::string EXP_cf;
-  std::string EXP_cn;
-  std::string EXP_cv;
-  std::string EXP_dt;
-  std::string EXP_en;
-  std::string EXP_id;
-  std::string EXP_le;
-  std::string EXP_li;
-  std::string EXP_ln;
-  std::string EXP_lt;
-  std::string EXP_ma;
-  std::string EXP_mc;
-  std::string EXP_mn;
-  std::string EXP_mt;
-  std::string EXP_ps;
-  std::string EXP_sf;
-  std::string EXP_sv;
-  std::string EXP_ss;
-  std::string EXP_tn;
-  std::string EXP_op;
-  std::string EXP_pn;
-
-  std::string EXP_sq;
+  string EXP_bc;
+  string EXP_cf;
+  string EXP_cn;
+  string EXP_cv;
+  string EXP_dt;
+  string EXP_en;
+  string EXP_id;
+  string EXP_le;
+  string EXP_li;
+  string EXP_ln;
+  string EXP_lt;
+  string EXP_ma;
+  string EXP_mc;
+  string EXP_mn;
+  string EXP_mt;
+  string EXP_ps;
+  string EXP_sf;
+  string EXP_sv;
+  string EXP_ss;
+  string EXP_tn;
+  string EXP_op;
+  string EXP_pn;
+
+  string EXP_sq;
 
   int32 EXP_aq;
   int32 EXP_ch;
@@ -165,14 +169,15 @@ private:
 
   uint32 EXP_len_seq;
 
-  std::vector<base_quality_t> EXP_qualities;
-    //std::vector<int8> EXP_qualities;
-  std::vector<tag_t> EXP_tags;
+  vector<base_quality_t> EXP_qualities;
+    //vector<int8> EXP_qualities;
+  vector<tag_t> EXP_tags;
 
-  std::vector<int32> EXP_on_ranges;
+  vector<int32> EXP_on_ranges;
 
 
 private:
+  void foolCompiler();
   void   zeroVars();
   //char * conditionalStrCpy(const char * src);
   int32  gimmeAnInt(FlexLexer * lexer, const char * filename);
@@ -189,7 +194,7 @@ public:
   void dump();                           //dump an EXP to stdout
   //  int8 save(const char * filename);
 
-  void swapTags(std::vector<tag_t> & tv) {
+  void swapTags(vector<tag_t> & tv) {
     EXP_tags.swap(tv);
   }
 
@@ -206,32 +211,33 @@ public:
   inline int32 getSIto() const { return EXP_si_to; };
   inline int32 getSP() const { return EXP_sp; };
 
-  inline const std::string & getSequence() const { return EXP_sq; }
-  inline const std::string & getSQ() const { return EXP_sq; }
-
-  inline const std::vector<base_quality_t> & getQualities() const { return EXP_qualities;}
-  inline const std::vector<base_quality_t> & getAV() const { return EXP_qualities;}
-  inline const std::vector<int32> & getON() const { return EXP_on_ranges;}
-
-  inline const std::string & getBC() const { return EXP_bc;}
-  inline const std::string & getCF() const { return EXP_cf;}
-  inline const std::string & getCN() const { return EXP_cn;}
-  inline const std::string & getDT() const { return EXP_dt;}
-  inline const std::string & getEN() const { return EXP_en;}
-  inline const std::string & getID() const { return EXP_id;}
-  inline const std::string & getLE() const { return EXP_le;}
-  inline const std::string & getLI() const { return EXP_li;}
-  inline const std::string & getLN() const { return EXP_ln;}
-  inline const std::string & getLT() const { return EXP_lt;}
-  inline const std::string & getMA() const { return EXP_ma;}
-  inline const std::string & getMC() const { return EXP_mc;}
-  inline const std::string & getMN() const { return EXP_mn;}
-  inline const std::string & getMT() const { return EXP_mt;}
-  inline const std::string & getPN() const { return EXP_pn;}
-  inline const std::string & getPS() const { return EXP_ps;}
-  inline const std::string & getSF() const { return EXP_sf;}
-  inline const std::string & getSV() const { return EXP_sv;}
-  inline const std::string & getTN() const { return EXP_tn;}
+  inline const string & getSequence() const { return EXP_sq; }
+  inline const string & getSQ() const { return EXP_sq; }
+
+  inline const vector<base_quality_t> & getQualities() const { return EXP_qualities;}
+  inline const vector<base_quality_t> & getAV() const { return EXP_qualities;}
+  inline const vector<int32> & getON() const { return EXP_on_ranges;}
+		      
+  inline const string & getBC() const { return EXP_bc;}
+  inline const string & getCF() const { return EXP_cf;}
+  inline const string & getCN() const { return EXP_cn;}
+  inline const string & getDT() const { return EXP_dt;}
+  inline const string & getEN() const { return EXP_en;}
+  inline const string & getID() const { return EXP_id;}
+  inline const string & getLE() const { return EXP_le;}
+  inline const string & getLI() const { return EXP_li;}
+  inline const string & getLN() const { return EXP_ln;}
+  inline const string & getLT() const { return EXP_lt;}
+  inline const string & getMA() const { return EXP_ma;}
+  inline const string & getMC() const { return EXP_mc;}
+  inline const string & getMN() const { return EXP_mn;}
+  inline const string & getMT() const { return EXP_mt;}
+  inline const string & getPN() const { return EXP_pn;}
+  inline const string & getPS() const { return EXP_ps;}
+  inline const string & getSF() const { return EXP_sf;}
+  inline const string & getSV() const { return EXP_sv;}
+  inline const string & getTN() const { return EXP_tn;}
 };
 
 #endif
+
diff --git a/src/io/fasta.C b/src/io/fasta.C
index 01e6c8f..582f529 100644
--- a/src/io/fasta.C
+++ b/src/io/fasta.C
@@ -9,29 +9,34 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
-// 	$Id$
+// 	$Id$	
 
 #include "io/fasta.H"
 
-// for boost::trim, split
-#include <boost/algorithm/string.hpp>
+#ifndef lint
+static char vcid[] = "$Id$";
+#endif /* lint */
 
-using namespace std;
 
 
+void FASTA::foolCompiler()
+{
+#include "stdinc/foolcompiler.C"
+}
+
 // Plain vanilla constructor
 FASTA::FASTA()
 {
@@ -49,7 +54,6 @@ void FASTA::zeroVars()
 
   FA_fastaseqname.clear();
   FA_qualseqname.clear();
-  FA_comment.clear();
   FA_sequence.clear();
   FA_intvalues.clear();
 
@@ -93,16 +97,13 @@ void FASTA::discard()
  * this function searches for reads with that characteristics and sets
  *  the name of the string given to the "real" one
  *
- * extracts name
- * also splits line into name and comment if comment!=nullptr
- *
  *************************************************************************/
 
-void FASTA::adjustNameNCBIHack(string & name, string * comment)
+void FASTA::adjustNameNCBIHack(string & name)
 {
   FUNCSTART("void FASTA::adjustNameNCBIHack(string & name)");
 
-  static const string blanks=" \t";
+  string blanks=" \t";
   if(name.size()>7
      && name[0] == 'g'
      && name[1] == 'n'
@@ -113,7 +114,7 @@ void FASTA::adjustNameNCBIHack(string & name, string * comment)
      && name[6] == '|'){
 
     string::size_type tokenstart=string::npos;
-
+    
     tokenstart=name.find(" name:",0);
 
     if(tokenstart!=string::npos){
@@ -122,43 +123,28 @@ void FASTA::adjustNameNCBIHack(string & name, string * comment)
       tokenstart+=6;
       tokenend=name.find_first_of(blanks,tokenstart);
       if(tokenend==string::npos) tokenend=name.size();
-
+      
       string token=name.substr(tokenstart, tokenend-tokenstart);
-      swap(name,token);
+      name=token;
       return;
     }
   }
 
-  // ok, no gnl|ti|
-  // but maybe a NCBI GI "name"?
-  if(name.size() > 3
-     && name[0]=='g'
-     && name[1]=='i'
-     && name[2]=='|'){
-    // OK, this *might* be a GI line
-    vector<string> subnames;
-    boost::split(subnames, name, boost::is_any_of("|"));
-    if(subnames.size()==5){
-      // bloody well looks like an NCBI style name line. Extract the real sequence name
-      swap(name,subnames[3]);
-      return;
-    }
+  // ok, no gnl|ti| , get only the first "token"
+  //  as the name
+  string::size_type tokenend=string::npos;
+  tokenend=name.find_first_of(blanks,0);
+  if(tokenend!=string::npos){
+    string token=name.substr(0, tokenend);
+    name=token;
   }
 
-  // nothing of the above, get only the first "token"
-  //  as the name, the rest as comment
-  if(!name.empty()){
-    string::size_type tokenend=string::npos;
-    tokenend=name.find_first_of(blanks,0);
-    if(tokenend!=string::npos){
-      if(comment!=nullptr && tokenend<name.size()-1){
-	*comment=name.substr(tokenend+1, string::npos);
-	boost::trim(*comment);
-      }
-      string token=name.substr(0, tokenend);
-      name=token;
-    }
-  }
+  // there might still be "|" in the name, replace those
+  
+  //for(uint32 i=0; i<name.size(); i++){
+  //  if(name[i]=='|') name[i]='_';
+  //}
+
 
   FUNCEND();
 }
@@ -176,7 +162,6 @@ void FASTA::loadNextSeq(ifstream & fin)
 
   FA_fastaseqname.clear();
   FA_sequence.clear();
-  FA_comment.clear();
 
   bool read_read=false;
 
@@ -226,7 +211,7 @@ void FASTA::loadNextSeq(ifstream & fin)
 	  MIRANOTIFY(Notify::FATAL,"Missing name of fasta sequence at file byte position " << fin.tellg());
 	}
 	//cout << "RawName: " << FA_fastaseqname << endl;
-	adjustNameNCBIHack(FA_fastaseqname, &FA_comment);
+	adjustNameNCBIHack(FA_fastaseqname);
 	nl=true;
 	inseq=true;
       } else {
@@ -271,14 +256,11 @@ void FASTA::loadNextSeq(ifstream & fin)
 	case 'H' :
 	case 'B' :
 	case 'V' :
-	case 'D' :
+	case 'D' : 
 	case '*' : break;
 	case '-' :
 	  inchar='*';
 	  break;
-	case 'U' :
-	  inchar='T';
-	  break;
 	default : {
 	  if(badchars.size()<=100){
 	    badchars.push_back(inchar);
@@ -303,14 +285,10 @@ void FASTA::loadNextSeq(ifstream & fin)
       if(badchars.size()>0){
 	cerr << '\n';
 	for(uint32 i=0; i<badchars.size(); i++){
-	  cerr << "-- 2 Illegal character (" << badchars[i] << ": " << hex << static_cast<uint16>(badchars[i]) << dec << ") in fasta sequence at file byte position " << badpos[i] << endl;
-	}
-	if(badchars.size()==100){
-	  cerr << "\nThere may be more errors like the above, but stopping reporting here.\n";
+	  cerr << "-- 2 Illegal character (" << badchars[i] << ": " << hex << static_cast<uint16>(badchars[i]) << dec << ") in fasta sequence at file byte position " << badpos[i];
 	}
-	cerr << "This happened in sequence: " << FA_fastaseqname << "\nPlease fix your file.\n";
-
-	MIRANOTIFY(Notify::FATAL,"The sequence " << FA_sequence << " in file " << FA_fastaseqname << " showed unrecoverable errors while trying to load it (see also log above). Is it a valid FASTA sequence? Please double check ... and fix your file if necessary.");
+	cerr << "This happened in sequence: " << FA_fastaseqname << "\nPlease fix your file.";
+	MIRANOTIFY(Notify::FATAL,"Aborting ...");
       }
 
       read_read=true;
@@ -381,8 +359,8 @@ void FASTA::loadNextINTSeq(ifstream & fin, int32 maxvalue)
 
   while(!(fin.get(inchar)).eof() && !read_read) {
     switch(inchar) {
-    case ' ' :
-    case '\t' :
+    case ' ' : 
+    case '\t' : 
     case '\r' : {      // that's from MS-DOS Files, where \n is \r\n
       isnegative=false;
       break;
@@ -418,8 +396,8 @@ void FASTA::loadNextINTSeq(ifstream & fin, int32 maxvalue)
 	}
       	//cout << "Name: " << FA_qualseqname << endl;
 
-	adjustNameNCBIHack(FA_qualseqname, nullptr);
-
+	adjustNameNCBIHack(FA_qualseqname);
+	
 	nl=true;
 	inseq=true;
       } else {
@@ -616,9 +594,6 @@ void FASTA::dumpSequence(ostream & fout)
   FUNCSTART("void FASTA::dumpSequence(ofstream & fout)");
   if(FA_fastaseqname.size()){
     fout << ">" << FA_fastaseqname;
-    if(!FA_comment.empty()){
-      fout << FA_comment;
-    }
     for(uint32 i=0; i<FA_sequence.size(); i++){
       if(i%60==0) fout << "\n";
       fout << FA_sequence[i];
diff --git a/src/io/fasta.H b/src/io/fasta.H
index 0130e40..3dce5de 100644
--- a/src/io/fasta.H
+++ b/src/io/fasta.H
@@ -9,17 +9,17 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
 
@@ -34,23 +34,27 @@
 #include <fstream>
 #include <string>
 
+#include <string.h>
+
 #include "stdinc/defines.H"
 #include "stdinc/stlincludes.H"
 #include "errorhandling/errorhandling.H"
 
 
+using namespace std;
+
+
 
 class FASTA
 {
   //Variables
 private:
   uint32 FA_valid;
-
-  std::string         FA_fastaseqname;
-  std::string         FA_qualseqname;
-  std::string         FA_sequence;
-  std::string         FA_comment;
-  std::vector<int32>  FA_intvalues;
+  
+  string         FA_fastaseqname;
+  string         FA_qualseqname;
+  string         FA_sequence;
+  vector<int32>  FA_intvalues;
 
 
 public:
@@ -58,9 +62,10 @@ public:
 
   //Functions
 private:
+  void foolCompiler();
   void init();
   void zeroVars();
-  void adjustNameNCBIHack(std::string & name, std::string * comment);
+  void adjustNameNCBIHack(string & name);
 
 public:
   FASTA();
@@ -68,20 +73,22 @@ public:
   ~FASTA();
 
   FASTA const & operator=(FASTA const & other);
-  friend std::ostream & operator<<(std::ostream &ostr, FASTA const & fas);
-
-  const std::string & getSeqName() const { return FA_fastaseqname;};
-  const std::string & getQualName() const { return FA_qualseqname;};
-  const std::string & getSequence() const { return FA_sequence;};
-  const std::string & getComment() const { return FA_comment;};
-  const std::vector<base_quality_t> getQualities() const {
-    std::vector<base_quality_t> bla;
+  friend ostream & operator<<(ostream &ostr, FASTA const & fas);
+
+  const string & getSeqName() const { return FA_fastaseqname;};
+  const string & getQualName() const { return FA_qualseqname;};
+  const string & getSequence() const { return FA_sequence;};
+  const vector<base_quality_t> getQualities() const { 
+    vector<base_quality_t> bla;
     bla.reserve(FA_sequence.size()+1);
-    for(auto & iv : FA_intvalues) bla.push_back(static_cast<base_quality_t>(iv));
+    vector<int32>::const_iterator I=FA_intvalues.begin();
+    for(;I != FA_intvalues.end(); I++){
+      bla.push_back(static_cast<base_quality_t>(*I));
+    }
     return bla;
   };
 
-  const std::vector<int32> & getINTValues() const { return FA_intvalues;};
+  const vector<int32> & getINTValues() const { return FA_intvalues;};
 
   void discard();
   void load(const char * fastain);
@@ -89,15 +96,15 @@ public:
   void loadQual(const char * qualin);
   void loadINT(const char * qualin, int32 maxvalue);
 
-  void loadNext(std::ifstream & fastafin, std::ifstream & qualin);
-  void loadNextSeq(std::ifstream & fastafin);
-  void loadNextINTSeq(std::ifstream & qualfin, int32 maxvalue);
+  void loadNext(ifstream & fastafin, ifstream & qualin);
+  void loadNextSeq(ifstream & fastafin);
+  void loadNextINTSeq(ifstream & qualfin, int32 maxvalue);
 
   void testIfSeqAndQualMatch();
   bool testIfEmpty();
-
-  void dumpSequence(std::ostream & fout);
-  void dumpQuality(std::ostream & fout);
+  
+  void dumpSequence(ostream & fout);
+  void dumpQuality(ostream & fout);
 };
 
 
diff --git a/src/io/fastq-lh.H b/src/io/fastq-lh.H
index fcf4ee2..f6c7134 100644
--- a/src/io/fastq-lh.H
+++ b/src/io/fastq-lh.H
@@ -9,41 +9,36 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
 #ifndef _bas_fastq_h_
 #define _bas_fastq_h_
 
-#include <cctype>
-#include <cstring>
-#include <cstdlib>
-#include <cstdio>
-
+#include <ctype.h>
+#include <string.h>
+#include <stdlib.h>
 #include <zlib.h>
-
-// The enclosed lines are copied verbatim from kseq.h
-//  from the readfq code from Heng Li at GitHub:
-//  https://github.com/lh3/readfq
-//
-// GPL license stops at this line, MIT license takes over for
-//  the rest of this file
+#include <cstdio>
 
 // -----------------------------------------------------------------------
 
+// The following lines are copied verbatim from kseq.h
+//  from Heng Li <lh3 at sanger.ac.uk>
+
 /* The MIT License
 
-   Copyright (c) 2008, 2009, 2011 Attractive Chaos <attractor at live.co.uk>
+   Copyright (c) 2008 Genome Research Ltd (GRL).
 
    Permission is hereby granted, free of charge, to any person obtaining
    a copy of this software and associated documentation files (the
@@ -66,19 +61,18 @@
    SOFTWARE.
 */
 
-/* Last Modified: 05MAR2012 */
+/* Contact: Heng Li <lh3 at sanger.ac.uk> */
+
+/* Last Modified: 12APR2009 */
 
-#ifndef AC_KSEQ_H
-#define AC_KSEQ_H
 
 #define KS_SEP_SPACE 0 // isspace(): \t, \n, \v, \f, \r
 #define KS_SEP_TAB   1 // isspace() && !' '
-#define KS_SEP_LINE  2 // line separator: "\n" (Unix) or "\r\n" (Windows)
-#define KS_SEP_MAX   2
+#define KS_SEP_MAX   1
 
 #define __KS_TYPE(type_t)						\
 	typedef struct __kstream_t {				\
-		unsigned char *buf;						\
+		char *buf;								\
 		int begin, end, is_eof;					\
 		type_t f;								\
 	} kstream_t;
@@ -91,7 +85,7 @@
 	{																\
 		kstream_t *ks = (kstream_t*)calloc(1, sizeof(kstream_t));	\
 		ks->f = f;													\
-		ks->buf = (unsigned char*)malloc(__bufsize);				\
+		ks->buf = (char*)malloc(__bufsize);							\
 		return ks;													\
 	}																\
 	static inline void ks_destroy(kstream_t *ks)					\
@@ -128,10 +122,10 @@ typedef struct __kstring_t {
 #endif
 
 #define __KS_GETUNTIL(__read, __bufsize)								\
-	static int ks_getuntil2(kstream_t *ks, int delimiter, kstring_t *str, int *dret, int append) \
+	static int ks_getuntil(kstream_t *ks, int delimiter, kstring_t *str, int *dret) \
 	{																	\
 		if (dret) *dret = 0;											\
-		str->l = append? str->l : 0;									\
+		str->l = 0;														\
 		if (ks->begin >= ks->end && ks->is_eof) return -1;				\
 		for (;;) {														\
 			int i;														\
@@ -143,10 +137,7 @@ typedef struct __kstring_t {
 					if (ks->end == 0) break;							\
 				} else break;											\
 			}															\
-			if (delimiter == KS_SEP_LINE) { \
-				for (i = ks->begin; i < ks->end; ++i) \
-					if (ks->buf[i] == '\n') break; \
-			} else if (delimiter > KS_SEP_MAX) {						\
+			if (delimiter > KS_SEP_MAX) {								\
 				for (i = ks->begin; i < ks->end; ++i)					\
 					if (ks->buf[i] == delimiter) break;					\
 			} else if (delimiter == KS_SEP_SPACE) {						\
@@ -156,7 +147,7 @@ typedef struct __kstring_t {
 				for (i = ks->begin; i < ks->end; ++i)					\
 					if (isspace(ks->buf[i]) && ks->buf[i] != ' ') break; \
 			} else i = 0; /* never come to here! */						\
-			if (str->m - str->l < (size_t)(i - ks->begin + 1)) {		\
+			if (str->m - str->l < i - ks->begin + 1) {					\
 				str->m = str->l + (i - ks->begin) + 1;					\
 				kroundup32(str->m);										\
 				str->s = (char*)realloc(str->s, str->m);				\
@@ -169,15 +160,13 @@ typedef struct __kstring_t {
 				break;													\
 			}															\
 		}																\
-		if (str->s == 0) {												\
+		if (str->l == 0) {												\
 			str->m = 1;													\
 			str->s = (char*)calloc(1, 1);								\
-		} else if (delimiter == KS_SEP_LINE && str->l > 1 && str->s[str->l-1] == '\r') --str->l; \
+		}																\
 		str->s[str->l] = '\0';											\
 		return str->l;													\
-	} \
-	static inline int ks_getuntil(kstream_t *ks, int delimiter, kstring_t *str, int *dret) \
-	{ return ks_getuntil2(ks, delimiter, str, dret, 0); }
+	}
 
 #define KSTREAM_INIT(type_t, __read, __bufsize) \
 	__KS_TYPE(type_t)							\
@@ -185,16 +174,19 @@ typedef struct __kstring_t {
 	__KS_GETC(__read, __bufsize)				\
 	__KS_GETUNTIL(__read, __bufsize)
 
-#define kseq_rewind(ks) ((ks)->last_char = (ks)->f->is_eof = (ks)->f->begin = (ks)->f->end = 0)
-
-#define __KSEQ_BASIC(SCOPE, type_t)										\
-	SCOPE kseq_t *kseq_init(type_t fd)									\
+#define __KSEQ_BASIC(type_t)											\
+	static inline kseq_t *kseq_init(type_t fd)							\
 	{																	\
 		kseq_t *s = (kseq_t*)calloc(1, sizeof(kseq_t));					\
 		s->f = ks_init(fd);												\
 		return s;														\
 	}																	\
-	SCOPE void kseq_destroy(kseq_t *ks)									\
+	static inline void kseq_rewind(kseq_t *ks)							\
+	{																	\
+		ks->last_char = 0;												\
+		ks->f->is_eof = ks->f->begin = ks->f->end = 0;					\
+	}																	\
+	static inline void kseq_destroy(kseq_t *ks)							\
 	{																	\
 		if (!ks) return;												\
 		free(ks->name.s); free(ks->comment.s); free(ks->seq.s);	free(ks->qual.s); \
@@ -207,46 +199,44 @@ typedef struct __kstring_t {
    -1   end-of-file
    -2   truncated quality string
  */
-#define __KSEQ_READ(SCOPE) \
-	SCOPE int kseq_read(kseq_t *seq) \
-	{ \
-		int c; \
-		kstream_t *ks = seq->f; \
+#define __KSEQ_READ														\
+	static int kseq_read(kseq_t *seq)									\
+	{																	\
+		int c;															\
+		kstream_t *ks = seq->f;											\
 		if (seq->last_char == 0) { /* then jump to the next header line */ \
-			while ((c = ks_getc(ks)) != -1 && c != '>' && c != '@'); \
-			if (c == -1) return -1; /* end of file */ \
-			seq->last_char = c; \
-		} /* else: the first header char has been read in the previous call */ \
-		seq->comment.l = seq->seq.l = seq->qual.l = 0; /* reset all members */ \
-		if (ks_getuntil(ks, 0, &seq->name, &c) < 0) return -1; /* normal exit: EOF */ \
-		if (c != '\n') ks_getuntil(ks, KS_SEP_LINE, &seq->comment, 0); /* read FASTA/Q comment */ \
-		if (seq->seq.s == 0) { /* we can do this in the loop below, but that is slower */ \
-			seq->seq.m = 256; \
-			seq->seq.s = (char*)malloc(seq->seq.m); \
-		} \
+			while ((c = ks_getc(ks)) != -1 && c != '>' && c != '@');	\
+			if (c == -1) return -1; /* end of file */					\
+			seq->last_char = c;											\
+		} /* the first header char has been read */						\
+		seq->comment.l = seq->seq.l = seq->qual.l = 0;					\
+		if (ks_getuntil(ks, 0, &seq->name, &c) < 0) return -1;			\
+		if (c != '\n') ks_getuntil(ks, '\n', &seq->comment, 0);			\
 		while ((c = ks_getc(ks)) != -1 && c != '>' && c != '+' && c != '@') { \
-			if (c == '\n') continue; /* skip empty lines */ \
-			seq->seq.s[seq->seq.l++] = c; /* this is safe: we always have enough space for 1 char */ \
-			ks_getuntil2(ks, KS_SEP_LINE, &seq->seq, 0, 1); /* read the rest of the line */ \
-		} \
+			if (isgraph(c)) { /* printable non-space character */		\
+				if (seq->seq.l + 1 >= seq->seq.m) { /* double the memory */ \
+					seq->seq.m = seq->seq.l + 2;						\
+					kroundup32(seq->seq.m); /* rounded to next closest 2^k */ \
+					seq->seq.s = (char*)realloc(seq->seq.s, seq->seq.m); \
+				}														\
+				seq->seq.s[seq->seq.l++] = (char)c;						\
+			}															\
+		}																\
 		if (c == '>' || c == '@') seq->last_char = c; /* the first header char has been read */	\
-		if (seq->seq.l + 1 >= seq->seq.m) { /* seq->seq.s[seq->seq.l] below may be out of boundary */ \
-			seq->seq.m = seq->seq.l + 2; \
-			kroundup32(seq->seq.m); /* rounded to the next closest 2^k */ \
-			seq->seq.s = (char*)realloc(seq->seq.s, seq->seq.m); \
-		} \
-		seq->seq.s[seq->seq.l] = 0;	/* null terminated string */ \
-		if (c != '+') return seq->seq.l; /* FASTA */ \
-		if (seq->qual.m < seq->seq.m) {	/* allocate memory for qual in case insufficient */ \
-			seq->qual.m = seq->seq.m; \
-			seq->qual.s = (char*)realloc(seq->qual.s, seq->qual.m); \
-		} \
+		seq->seq.s[seq->seq.l] = 0;	/* null terminated string */		\
+		if (c != '+') return seq->seq.l; /* FASTA */					\
+		if (seq->qual.m < seq->seq.m) {	/* allocate enough memory */	\
+			seq->qual.m = seq->seq.m;									\
+			seq->qual.s = (char*)realloc(seq->qual.s, seq->qual.m);		\
+		}																\
 		while ((c = ks_getc(ks)) != -1 && c != '\n'); /* skip the rest of '+' line */ \
-		if (c == -1) return -2; /* error: no quality string */ \
-		while (ks_getuntil2(ks, KS_SEP_LINE, &seq->qual, 0, 1) >= 0 && seq->qual.l < seq->seq.l); \
+		if (c == -1) return -2; /* we should not stop here */			\
+		while ((c = ks_getc(ks)) != -1 && seq->qual.l < seq->seq.l)		\
+			if (c >= 33 && c <= 127) seq->qual.s[seq->qual.l++] = (unsigned char)c;	\
+		seq->qual.s[seq->qual.l] = 0; /* null terminated string */		\
 		seq->last_char = 0;	/* we have not come to the next header line */ \
-		if (seq->seq.l != seq->qual.l) return -2; /* error: qual string is of a different length */ \
-		return seq->seq.l; \
+		if (seq->seq.l != seq->qual.l) return -2; /* qual string is shorter than seq string */ \
+		return seq->seq.l;												\
 	}
 
 #define __KSEQ_TYPE(type_t)						\
@@ -256,26 +246,16 @@ typedef struct __kstring_t {
 		kstream_t *f;							\
 	} kseq_t;
 
-#define KSEQ_INIT2(SCOPE, type_t, __read)		\
-	KSTREAM_INIT(type_t, __read, 16384)			\
+#define KSEQ_INIT(type_t, __read)				\
+	KSTREAM_INIT(type_t, __read, 4096)			\
 	__KSEQ_TYPE(type_t)							\
-	__KSEQ_BASIC(SCOPE, type_t)					\
-	__KSEQ_READ(SCOPE)
-
-#define KSEQ_INIT(type_t, __read) KSEQ_INIT2(static, type_t, __read)
+	__KSEQ_BASIC(type_t)						\
+	__KSEQ_READ
 
-#define KSEQ_DECLARE(type_t) \
-	__KS_TYPE(type_t) \
-	__KSEQ_TYPE(type_t) \
-	extern kseq_t *kseq_init(type_t fd); \
-	void kseq_destroy(kseq_t *ks); \
-	int kseq_read(kseq_t *seq);
-
-#endif
 
 // -----------------------------------------------------------------------
 
 
-// no class ... cannot be done with this setup :-(
+// no class ... can be done with this setup :-(
 
 #endif
diff --git a/src/io/fastq-mira.C b/src/io/fastq-mira.C
index 2761c6f..f47fcdc 100644
--- a/src/io/fastq-mira.C
+++ b/src/io/fastq-mira.C
@@ -9,31 +9,24 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
 
 #include "io/fastq-mira.H"
-#include "util/boostiostrutil.H"
-
-//#include <boost/iostreams/filter/zlib.hpp>
-//#include <boost/iostreams/filter/gzip.hpp>
-
 
-using namespace std;
 
-
-const string FastQ::FQ_blanks=" \t";
+string FastQ::FQ_blanks=" \t";
 
 
 // Plain vanilla constructor
@@ -41,11 +34,13 @@ FastQ::FastQ()
 {
   FUNCSTART("FastQ::FastQ()");
 
-  FQ_name.reserve(200);
-  FQ_comment.reserve(200);
-  FQ_seq.reserve(500);
-  FQ_quals.reserve(500);
-  FQ_dummy1.reserve(500);
+  FQ_linebuffer.reserve(2000);
+  FQ_name.reserve(100);
+  FQ_comment.reserve(100);
+  FQ_seq.reserve(100);
+  FQ_quals.reserve(100);
+  FQ_dummy1.reserve(100);
+  FQ_dummy2.reserve(100);
   FQ_tracktellg=0;
   FQ_filesize=0;
 
@@ -70,34 +65,61 @@ void FastQ::discard()
 }
 
 
+//// Copy constructor
+////  no discard needed as this object will be freshly created when
+////  called through this constructor
+//FastQ::FastQ(FastQ const &other)
+//{
+//  FUNCSTART("FastQ::FastQ(FastQ const &other)");
+//
+//  ??_valid=0;
+//
+//  *this=other;                               // call the copy operator
+//
+//  FUNCEND();
+//}
+//
+//// Copy operator, needed by copy-constructor
+//FastQ const & FastQ::operator=(FastQ const & other)
+//{
+//  FUNCSTART("FastQ const & FastQ::operator=(FastQ const & other)");
+//  ERROR("Not implemented yet.");
+//  FUNCEND();
+//  return *this;
+//}
+
+//ostream & operator<<(ostream &ostr, FastQ const &???)
+//{
+//  FUNCSTART("friend ostream & FastQ::operator<<(ostream &ostr, const  &???)");
+//  ERROR("Not implemented yet.");
+//
+//  FUNCEND();
+//  return ostr;
+//}
 
 
 void FastQ::openFile(const string & filename, bool tracktellg)
 {
   FUNCSTART("void FastQ::openFile(string & filename, bool tracktellg)");
 
-  if(FQ_ifstream.is_open()){
-    FQ_ifstream.close();
+  if(FQ_fin.is_open()){
+    FQ_fin.close();
   }
-  FQ_ifstream.clear();
+  FQ_fin.clear();
   FQ_tracktellg=tracktellg;
 
-  FQ_ifstream.open(filename.c_str(),ios::in|ios::ate|ios::binary);
-  if(!FQ_ifstream){
+  FQ_fin.open(filename.c_str(),ios::in|ios::ate|ios::binary);
+  if(!FQ_fin){
     MIRANOTIFY(Notify::FATAL, "File not found: " << filename);
   }
-  FQ_filesize=FQ_ifstream.tellg();
+  FQ_filesize=FQ_fin.tellg();
   if(FQ_filesize==static_cast<streampos>(0)){
     MIRANOTIFY(Notify::FATAL, "Zero length file: " << filename);
   }
-  FQ_ifstream.seekg(0, ios::beg);
-
-  //FQ_fin.push(boost::iostreams::zlib_decompressor());
-  //FQ_fin.push(boost::iostreams::gzip_decompressor());
-  //FQ_fin.push(FQ_ifstream);
-  setupStreamFilterByName(FQ_fin, FQ_ifstream, filename);
+  FQ_fin.seekg(0, ios::beg);
 
   FQ_linecount=0;
+  FQ_lasttellg=0;
   FQ_tellgofread=0;
 
   FUNCEND();
@@ -105,192 +127,100 @@ void FastQ::openFile(const string & filename, bool tracktellg)
 
 /*************************************************************************
  *
- *
+ * Careful: at function end, may already have preloaded one line after
+ *  the next read into FQ_linebuffer
  *
  *************************************************************************/
 
 int64_t FastQ::loadNext(streampos sp)
 {
   FUNCSTART("int64_t FastQ::loadNext(streampos sp)");
-  BUGIFTHROW(!FQ_ifstream.is_open(),"Tried to load a sequence while no file is opened.");
+  BUGIFTHROW(!FQ_fin.is_open(),"Tried to load a sequence while no file is opened.");
   FQ_fin.clear();
   FQ_fin.seekg(sp, ios::beg);
+  FQ_linebuffer.clear();
   FUNCEND();
   return loadNext();
 }
 
-/*************************************************************************
- *
- * returns size of read
- *  or -1 if end of file
- *
- *************************************************************************/
-
 int64_t FastQ::loadNext()
 {
   FUNCSTART("void FastQ::loadNext()");
 
-  BUGIFTHROW(!FQ_ifstream.is_open(),"Tried to load a sequence while no file is opened.");
+  BUGIFTHROW(!FQ_fin.is_open(),"Tried to load a sequence while no file is opened.");
 
   FQ_name.clear();
   FQ_comment.clear();
   FQ_seq.clear();
   FQ_quals.clear();
-  if(safeGetLineIntoName()){
-    if(safeGetLineIntoSeq()){
-      safeGetLineIntoQName();
-      safeGetLineIntoQual();
-    }
-  }
-
-  FUNCEND();
-  if(FQ_name.empty() && FQ_fin.eof()) return -1;
-
-  //cout << *this;
-  return static_cast<int64>(FQ_seq.size());
-}
-
-
-
-bool FastQ::safeGetLineIntoName()
-{
-  FUNCSTART("void FastQ::safeGetLineIntName()");
-
-  if(FQ_tracktellg) FQ_tellgofread=FQ_fin.tellg();
-
-  if(FQ_fin.eof()) return false;
-  if(static_cast<char>(FQ_fin.get())!='@'){
-    if(!FQ_fin.eof()) MIRANOTIFY(Notify::FATAL,"First character of line " << FQ_linecount << " is not a '@'. That file is not in FASTQ format.");
-  }
-  if(FQ_fin.eof()) return false;
-  while(getline(FQ_fin,FQ_name)){
-    ++FQ_linecount;
-    // get rid of '\r' from DOS
-    while(!FQ_name.empty() && FQ_name[FQ_name.size()-1]=='\r') FQ_name.resize(FQ_name.size()-1);
-    if(!FQ_name.empty()) break;
-  }
-  if(FQ_fin.eof()) return false;
-
-  string::size_type nameend=string::npos;
-  nameend=FQ_name.find_first_of(FQ_blanks,0);
-  if(nameend!=string::npos){
-    FQ_comment=FQ_name.substr(nameend+1,FQ_name.size()-nameend);
-    FQ_name.resize(nameend-1);
-  }
-
-  return true;
-}
-
-bool FastQ::safeGetLineIntoSeq()
-{
-  FUNCSTART("bool FastQ::safeGetLineIntoSeq()");
 
-  while(getline(FQ_fin,FQ_seq)){
-    ++FQ_linecount;
-    // get rid of '\r' from DOS
-    while(!FQ_seq.empty() && FQ_seq[FQ_seq.size()-1]=='\r') FQ_seq.resize(FQ_seq.size()-1);
-    // allow for empty lines??
-    if(!FQ_seq.empty()) break;
-  }
-  if(FQ_fin.eof()){
-    MIRANOTIFY(Notify::FATAL,"At around line " << FQ_linecount << ": expected a sequence, none found.");
+  if(FQ_linebuffer.empty()) {
+    safeGetLineIntoLineBuffer();
   }
+  FQ_tellgofread=FQ_lasttellg;
 
-  // continuation lines
-  char peektmp=FQ_fin.peek();
-  while(!FQ_fin.eof() && peektmp!='@' && peektmp!='+'){
-    while(getline(FQ_fin,FQ_dummy1)){
-      ++FQ_linecount;
-      // get rid of '\r' from DOS
-      while(!FQ_dummy1.empty() && FQ_dummy1[FQ_dummy1.size()-1]=='\r') FQ_dummy1.resize(FQ_dummy1.size()-1);
-      // allow for empty lines??
-      if(!FQ_dummy1.empty()) break;
+  // allow for empty lines??
+  if(!FQ_linebuffer.empty()){
+    if(FQ_linebuffer[0]!='@'){
+      MIRANOTIFY(Notify::FATAL,"First character of line " << FQ_linecount << " is not a '@'. That file is not in FASTQ format.");
     }
-    FQ_seq.append(FQ_dummy1);
-    peektmp=FQ_fin.peek();
-  }
-  if(FQ_fin.eof()){
-    MIRANOTIFY(Notify::FATAL,"At around line " << FQ_linecount << ": expected a sequence, none found.");
-  }
-
-  return peektmp=='+';
-}
-
-
-void FastQ::safeGetLineIntoQName()
-{
-  FUNCSTART("void FastQ::safeGetLineIntQName()");
-
-  if(static_cast<char>(FQ_fin.get())!='+'){
-    MIRANOTIFY(Notify::FATAL,"First character of line " << FQ_linecount << " is not a '+'. We saw it moments ago, it should be ???");
-  }
-  if(static_cast<char>(FQ_fin.peek())=='\n'){
-    ++FQ_linecount;
-    FQ_fin.get();
-  }else{
-    while(getline(FQ_fin,FQ_dummy1)){
-      ++FQ_linecount;
-      // get rid of '\r' from DOS
-      while(!FQ_dummy1.empty() && FQ_dummy1[FQ_dummy1.size()-1]=='\r') FQ_dummy1.resize(FQ_dummy1.size()-1);
-      if(!FQ_dummy1.empty()) break;
+    splitNameLine(FQ_name,FQ_comment);
+    while(safeGetLineIntoLineBuffer() && FQ_linebuffer[0] != '@' && FQ_linebuffer[0] != '+'){
+      FQ_seq+=FQ_linebuffer;
     }
-
-    if(FQ_dummy1.size()!=1){
-      string::size_type nameend=string::npos;
-      nameend=FQ_dummy1.find_first_of(FQ_blanks,0);
-      if(nameend!=string::npos){
-	if(nameend){
-	  FQ_dummy1.resize(nameend-1);
-	}else{
-	  FQ_dummy1.clear();
+    if(!FQ_linebuffer.empty() && FQ_linebuffer[0] == '+'){
+      if(FQ_linebuffer.size()>1){
+	splitNameLine(FQ_dummy1,FQ_dummy2);
+	if(FQ_name!=FQ_dummy1){
+	  MIRANOTIFY(Notify::FATAL,"Quality name of read '" << FQ_dummy1 << "' is not equal to sequence name '" << FQ_name << "'. Around line " << FQ_linecount);
 	}
       }
-      if(FQ_dummy1!=FQ_name){
-	MIRANOTIFY(Notify::FATAL,"Sequence name of read '" << FQ_name << "' is not equal to quality name '" << FQ_dummy1 << "'. Around line " << FQ_linecount);
+      while(safeGetLineIntoLineBuffer() && FQ_quals.size()<FQ_seq.size()){
+	FQ_quals+=FQ_linebuffer;
+      }
+      if(!FQ_quals.empty() && FQ_quals.size() != FQ_seq.size()){
+	MIRANOTIFY(Notify::FATAL,"Read " << FQ_name << ": length of quality string (" << FQ_quals.size() << ") is not equal to sequence size (" << FQ_seq.size() << "') Around line " << FQ_linecount);
       }
     }
   }
 
-  return;
+  FUNCEND();
+  if(FQ_seq.empty() && FQ_fin.eof()) return -1;
+  return static_cast<int64>(FQ_seq.size());
 }
 
-
-void FastQ::safeGetLineIntoQual()
+size_t FastQ::safeGetLineIntoLineBuffer()
 {
-  FUNCSTART("bool FastQ::safeGetLineIntoQual()");
-
-  if(FQ_fin.eof()){
-    MIRANOTIFY(Notify::FATAL,"At around line " << FQ_linecount << ": expected a sequence, none found.");
-  }
-
-  while(getline(FQ_fin,FQ_quals)){
+  FQ_linebuffer.clear();
+  if(FQ_tracktellg) FQ_lasttellg=FQ_fin.tellg();
+  while(getline(FQ_fin,FQ_linebuffer)){
     ++FQ_linecount;
     // get rid of '\r' from DOS
-    while(!FQ_quals.empty() && FQ_quals[FQ_quals.size()-1]=='\r') FQ_quals.resize(FQ_quals.size()-1);
+    while(!FQ_linebuffer.empty() && FQ_linebuffer[FQ_linebuffer.size()-1]=='\r') FQ_linebuffer.resize(FQ_linebuffer.size()-1);
     // allow for empty lines??
-    if(!FQ_quals.empty()) break;
-  }
-  if(FQ_fin.eof()){
-    MIRANOTIFY(Notify::FATAL,"At around line " << FQ_linecount << ": expected a sequence, none found.");
+    if(!FQ_linebuffer.empty()) break;
   }
+  return FQ_linebuffer.size();
+}
 
-  // continuation lines
-  while(!FQ_fin.eof() && FQ_quals.size() < FQ_seq.size()){
-    while(getline(FQ_fin,FQ_dummy1)){
-      ++FQ_linecount;
-      // get rid of '\r' from DOS
-      while(!FQ_dummy1.empty() && FQ_dummy1[FQ_dummy1.size()-1]=='\r') FQ_dummy1.resize(FQ_dummy1.size()-1);
-      // allow for empty lines??
-      if(!FQ_dummy1.empty()) break;
-    }
-    FQ_quals.append(FQ_dummy1);
-  }
+void FastQ::splitNameLine(string & name, string & comment)
+{
+  name.clear();
+  comment.clear();
 
-  if(FQ_seq.size()!=FQ_quals.size()){
-    MIRANOTIFY(Notify::FATAL,"At around line " << FQ_linecount << ": sequence " << FQ_name << " has " << FQ_seq.size() << " bases, but it has " << FQ_quals.size() << " quality values ??? Here's what was read:\n" << *this);
-  }
+  string::size_type nameend=string::npos;
 
-  return;
+  nameend=FQ_linebuffer.find_first_of(FQ_blanks,0);
+  if(nameend==string::npos){
+    // do not use swap: FQ_linebuffer may have a large memory
+    //  block reserved due to long lines read in the past
+    //  keep that with FQ_linebuffer to avoid reallocations
+    name=FQ_linebuffer.substr(1, FQ_linebuffer.size()-1);
+  }else{
+    name=FQ_linebuffer.substr(1, nameend-1);
+    comment=FQ_linebuffer.substr(nameend+1,FQ_linebuffer.size()-nameend);
+  }
+ 
 }
 
 
diff --git a/src/io/fastq-mira.H b/src/io/fastq-mira.H
index d2b9df7..43269c5 100644
--- a/src/io/fastq-mira.H
+++ b/src/io/fastq-mira.H
@@ -9,26 +9,23 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
 #ifndef _bas_fastq_mira_h_
 #define _bas_fastq_mira_h_
 
 #include <iostream>
-#include <fstream>
-
-#include <boost/iostreams/filtering_stream.hpp>
 
 #include "stdinc/defines.H"
 #include "errorhandling/errorhandling.H"
@@ -39,23 +36,24 @@ class FastQ
 {
   //Variables
 private:
-  static const std::string FQ_blanks;
+  static string FQ_blanks;
 
-  boost::iostreams::filtering_istream FQ_fin;
-  std::ifstream    FQ_ifstream;
-  std::string      FQ_linebuffer;
-  size_t           FQ_linecount;
-  std::streampos   FQ_filesize;
-  std::streampos   FQ_tellgofread;
-  bool             FQ_tracktellg;
+  ifstream FQ_fin;
+  string FQ_linebuffer;
+  size_t FQ_linecount; 
+  streampos FQ_filesize;
+  streampos FQ_tellgofread;
+  streampos FQ_lasttellg;
+  bool      FQ_tracktellg;
 
-  std::string FQ_name;
-  std::string FQ_comment;
-  std::string FQ_seq;
-  std::string FQ_quals;
+  string FQ_name;
+  string FQ_comment;
+  string FQ_seq;
+  string FQ_quals;
 
   // for splitting quality name line and comparing to FQ_name
-  std::string FQ_dummy1;
+  string FQ_dummy1;
+  string FQ_dummy2;
 
 public:
 
@@ -64,40 +62,28 @@ public:
 private:
   void foolCompiler();
 
-  void splitNameLine(std::string & name,std::string & comment);
+  void splitNameLine(string & name,string & comment);
   size_t safeGetLineIntoLineBuffer();
-  bool safeGetLineIntoName();
-  void safeGetLineIntoQName();
-  bool safeGetLineIntoSeq();
-  void safeGetLineIntoQual();
 
 public:
   FastQ();
+  FastQ(FastQ const &other);
   ~FastQ();
 
-  FastQ(FastQ const &other) = delete;
-  FastQ const & operator=(FastQ const & other) = delete;
-  friend std::ostream & operator<<(std::ostream &ostr, FastQ const &fq){
-    ostr << '@' << fq.FQ_name;
-    if(!fq.FQ_comment.empty()) ostr << ' ' << fq.FQ_comment << '\n';
-    if(!fq.FQ_quals.empty()){
-      ostr << "+\n" << fq.FQ_quals << '\n';
-    }
-    return ostr;
-  }
-
-  void openFile(const std::string & filename, bool tracktellg=false);
+  FastQ const & operator=(FastQ const & other);
+  friend ostream & operator<<(ostream &ostr, FastQ const &fq);
+
+  void openFile(const string & filename, bool tracktellg=false);
   int64 loadNext();
-  int64 loadNext(std::streampos sp);
-
-  inline const std::string & getName() const {return FQ_name;}
-  inline const std::string & getComment() const {return FQ_comment;}
-  inline const std::string & getSequence() const {return FQ_seq;}
-  inline const std::string & getQuals() const {return FQ_quals;}
-  std::streampos getStreamposOfRead() const;
-  void setStreampos(std::streampos sp) const;
-  inline std::streampos getFileSize() const {return FQ_filesize;}
-  inline size_t getLineCount() const {return FQ_linecount;}
+  int64 loadNext(streampos sp);
+
+  inline const string & getName() const {return FQ_name;}
+  inline const string & getComment() const {return FQ_comment;}
+  inline const string & getSequence() const {return FQ_seq;}
+  inline const string & getQuals() const {return FQ_quals;}
+  streampos getStreamposOfRead() const;
+  void setStreampos(streampos sp) const;
+  inline streampos getFileSize() const {return FQ_filesize;}
 
   void discard();
 };
diff --git a/src/io/gap4_ft_so_map.xxd b/src/io/gap4_ft_so_map.xxd
deleted file mode 100644
index f50782c..0000000
--- a/src/io/gap4_ft_so_map.xxd
+++ /dev/null
@@ -1,99 +0,0 @@
-#gap4db	FT term	SO term	SO ID	FT definition	SO definition
-#
-# First part:
-#
-# BaCh: from http://sequenceontology.org/resources/mapping/FT_SO.txt and added gap4 codes
-#
-# added missing SO definitions for GenBank: C_region, J_segment, N_region,
-#  S_region, V_region, V_segment, conflict, unsure
-#
-# Added gap4db IDs which exist in FT or SO: Fgap for gap, FsoR for snoRNA
-# Added a "new" gap4 ID (needed to tag poly-A): Fpas
-#
-# Do NOT clean up tabs at end of lines which have some, these are needed!
-
-F---	-	located_sequence_feature	SO:0000110	"-" is a placeholder for no key;  should be used when the need is merely to mark  region in order to comment on it or to use it in another feature's location;	A biological feature that can be attributed to a region of biological sequence.
-F-10	-10_signal	minus_10_signal	SO:0000175	Pribnow box; a conserved region about 10 bp upstream of the start point of bacterial transcription units which may be involved in  binding RNA polymerase; consensus=TAtAaT [1,2,3,4];	A conserved region about 10-bp upstream of the start point of bacterial transcription units which may be involved in binding RNA polymerase; consensus=TAtAaT.
-F-35	-35_signal	minus_35_signal	SO:0000176	a conserved hexamer about 35 bp upstream of the start point of bacterial transcription units; consensus=TTGACa or TGTTGACA;	A conserved hexamer about 35-bp upstream of the start point of bacterial transcription units; consensus=TTGACa or TGTTGACA.
-F3_U	3'UTR	three_prime_UTR	SO:0000205	region at the 3' end of a mature transcript (following  the stop codon) that is not translated into a protein;	A region at the 3' end of a mature transcript (following the stop codon) that is not translated into a protein.
-F3_c	3'clip	three_prime_clip	SO:0000557	3'-most region of a precursor transcript that is clipped off during processing;	3'-most region of a precursor transcript that is clipped off during processing.
-F5_U	5'UTR	five_prime_UTR	SO:0000204	region at the 5' end of a mature transcript (preceding  the initiation codon) that is not translated into a  protein;	A region at the 5' end of a mature transcript (preceding the initiation codon) that is not translated into a protein.
-F5_c	5'clip	five_prime_clip	SO:0000555	5'-most region of a precursor transcript that is clipped off during processing;	5' most region of a precursor transcript that is clipped off during processing.
-FCAA	CAAT_signal	CAAT_signal	SO:0000172	CAAT box; part of a conserved sequence located about 75 bp up-stream of the start point of eukaryotic transcription units which may be involved in RNA polymerase binding; consensus=GG(C or T)CAATCT [1,2].	Part of a conserved sequence located about 75-bp upstream of the start point of eukaryotic transcription units which may be involved in RNA polymerase binding; consensus=GG(C|T)CAATCT.
-FCDS	CDS	CDS	SO:0000316	coding sequence; sequence of nucleotides that corresponds with the sequence of amino acids in a protein (location includes stop codon);  feature includes amino acid conceptual translation.	A contiguous sequence which begins with, and includes, a start codon and ends with, and includes, a stop codon.
-FCre	C_region	SO:0001834	SO:0001834	constant region of immunoglobulin light and heavy  chains, and T-cell receptor alpha, beta, and gamma  chains; includes one or more exons depending on the  particular chain	The constant region of an immunoglobulin polypeptide sequence. [SO:ke]
-FD-l	D-loop	D_loop	SO:0000297	displacement loop; a region within mitochondrial DNA in which a short stretch of RNA is paired with one strand of DNA, displacing the original partner DNA strand in this region; also used to describe the displacement of a region of one strand of duplex DNA by a single stranded invader in the reaction catalyzed by RecA protein	Displacement loop; a region within mitochondrial DNA in which a short stretch of RNA is paired with one strand of DNA, displacing the  [...]
-FD-s	D_segment	D_gene	SO:0000458	Diversity segment of immunoglobulin heavy chain, and  T-cell receptor beta chain;  	germline genomic DNA including D-region with 5' UTR and 3' UTR, also designated as D-segment.
-FGCs	GC_signal	GC_rich_region	SO:0000173	GC box; a conserved GC-rich region located upstream of the start point of eukaryotic transcription units which may occur in multiple copies or in either orientation; consensus=GGGCGG;	A conserved GC-rich region located upstream of the start point of eukaryotic transcription units which may occur in multiple copies or in either orientation; consensus=GGGCGG.
-FJ-s	J_segment	J_gene_segment	SO:0000470	joining segment of immunoglobulin light and heavy  chains, and T-cell receptor alpha, beta, and gamma  chains;  	Germline genomic DNA of an immunoglobulin/T-cell receptor gene including J-region with 5' UTR (SO:0000204) and 3' UTR (SO:0000205), also designated as J-segment. [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-FLTR	LTR	long_terminal_repeat	SO:0000286	long terminal repeat, a sequence directly repeated at both ends of a defined sequence, of the sort typically found in retroviruses;	A sequence directly repeated at both ends of a defined sequence, of the sort typically found in retroviruses.
-FN-r	N_region	N_region	SO:0001835	extra nucleotides inserted between rearranged  immunoglobulin segments.	Extra nucleotides inserted between rearranged immunoglobulin segments. [SO:ke]
-FRBS	RBS	ribosome_entry_site	SO:0000139	ribosome binding site;	Region in mRNA where ribosome assembles.
-FSTS	STS	STS	SO:0000331	sequence tagged site; short, single-copy DNA sequence that characterizes a mapping landmark on the genome and can be detected by PCR; a region of the genome can be mapped by determining the order of a series of STSs;	Short (typically a few hundred base pairs) DNA sequence that has a single occurrence in a genome and whose location and base sequence are known.
-FS-r	S_region	S_region	SO:0001836	switch region of immunoglobulin heavy chains;   involved in the rearrangement of heavy chain DNA leading  to the expression of a different immunoglobulin class  from the same B-cell;	The switch region of immunoglobulin heavy chains; it is involved in the rearrangement of heavy chain DNA leading to the expression of a different immunoglobulin classes from the same B-cell. [SO:ke]
-FTAT	TATA_signal	TATA_box	SO:0000174	TATA box; Goldberg-Hogness box; a conserved AT-rich septamer found about 25 bp before the start point of each eukaryotic RNA polymerase II  transcript  unit which may be involved in positioning the enzyme  for correct  initiation; consensus=TATA(A or T)A(A or T) [1,2];	A conserved AT-rich septamer found about 25-bp before the start point of many eukaryotic RNA polymerase II transcript units; may be involved in positioning the enzyme for correct initia [...]
-FV-r	V_region	V_region	SO:0001833	variable region of immunoglobulin light and heavy chains, and T-cell receptor alpha, beta, and gamma chains;  codes for the variable amino terminal portion; can be composed of V_segments, D_segments, N_regions, and J_segments;	The variable region of an immunoglobulin polypeptide sequence. [SO:ke]
-FV-s	V_segment	V_gene_segment	SO:0000466	variable segment of immunoglobulin light and heavy chains, and T-cell receptor alpha, beta, and gamma chains; codes for most of the variable region (V_region) and the last few amino acids of the leader peptide;	Germline genomic DNA including L-part1, V-intron and V-exon, with the 5' UTR and 3' UTR. [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-Fatt	attenuator	attenuator	SO:0000140	1) region of DNA at which regulation of termination of transcription occurs, which controls the expression of some bacterial operons; 2) sequence segment located between the promoter and the first structural gene that causes partial termination of transcription	A sequence segment located between the promoter and a structural gene that causes partial termination of transcription.
-Fcon	conflict	sequence_conflict	SO:0001085	independent determinations of the "same" sequence differ at this site or region; Or /compare=[accession-number.sequence-version]	Different sources report differing sequences. [EBIBS:GAR, UniProt:curation_manual]
-Fenh	enhancer	enhancer	SO:0000165	a cis-acting sequence that increases the utilization of (some)  eukaryotic promoters, and can function in either orientation and in any location (upstream or downstream) relative to the promoter;	A cis-acting sequence that increases the utilization of (some) eukaryotic promoters, and can function in either orientation and in any location (upstream or downstream) relative to the promoter.
-Fexn	exon	exon	SO:0000147	region of genome that codes for portion of spliced mRNA,  rRNA and tRNA; may contain 5'UTR, all CDSs and 3' UTR; 	A region of the genome that codes for portion of spliced messenger RNA (SO:0000234); may contain 5'-untranslated region (SO:0000204), all open reading frames (SO:0000236) and 3'-untranslated region (SO:0000205).
-Fgap	gap	gap	SO:0000730	gap in the sequence	A gap in the sequence of known length. The unknown bases are filled in with N's.
-Fgen	gene	gene	SO:0000704	region of biological interest identified as a gene  and for which a name has been assigned;	A locatable region of genomic sequence, corresponding to a unit of inheritance, which is associated with regulatory regions, transcribed regions and/or other functional sequence regions
-FiDN	iDNA	iDNA	SO:0000723	intervening DNA; DNA which is eliminated through any of several kinds of recombination;	Genomic sequence removed from the genome, as a normal event, by a process of recombination. 
-Fint	intron	intron	SO:0000188	a segment of DNA that is transcribed, but removed from within the transcript by splicing together the sequences (exons) on either side of it;	A segment of DNA that is transcribed, but removed from within the transcript by splicing together the sequences (exons) on either side of it.
-FmRN	mRNA	mRNA	SO:0000234	messenger RNA; includes 5'untranslated region (5'UTR), coding sequences (CDS, exon) and 3'untranslated region (3'UTR);	messenger RNA is the intermediate molecule between DNA and protein. It  includes UTR and coding sequences. It does not contain introns. 
-Fmat	mat_peptide	mature_peptide	SO:0000419	mature peptide or protein coding sequence; coding sequence for the mature or final peptide or protein product following post-translational modification; the location does not include the stop codon (unlike the corresponding CDS);	The coding sequence for the mature or final peptide or protein product following post-translational modification.
-Fm-R	misc_RNA	transcript	SO:0000673	any transcript or RNA product that cannot be defined by other RNA keys (prim_transcript, precursor_RNA, mRNA, 5'clip, 3'clip, 5'UTR, 3'UTR, exon, CDS, sig_peptide, transit_peptide, mat_peptide, intron, polyA_site, rRNA, tRNA, scRNA, and snRNA);	An RNA synthesized on a DNA or RNA template by an RNA polymerase.
-Fm-b	misc_binding	binding_site	SO:0000409	site in nucleic acid which covalently or non-covalently binds another moiety that cannot be described by any other binding key (primer_bind or protein_bind);	A region on the surface of a molecule that may interact with another molecule.
-Fm-d	misc_difference	sequence_difference	SO:0000413	feature sequence is different from that presented  in the entry and cannot be described by any other  Difference key (conflict, unsure, old_sequence,  variation, or modified_base);	A region where the sequences differs from that of a specified sequence.
-Fm-f	misc_feature	region	SO:0000001	region of biological interest which cannot be described by any other feature key; a new or rare feature;	Continuous sequence.
-Fm-r	misc_recomb	recombination_feature	SO:0000298	site of any generalized, site-specific or replicative recombination event where there is a breakage and reunion of duplex DNA that cannot be described by other recombination keys or qualifiers of source key  (/insertion_seq, /transposon, /proviral);	
-Fm-S	misc_signal	regulatory_region	SO:0005836	any region containing a signal controlling or altering gene function or expression that cannot be described by other signal keys (promoter, CAAT_signal, TATA_signal, -35_signal, -10_signal, GC_signal, RBS, polyA_signal, enhancer, attenuator, terminator, and rep_origin).	A DNA sequence that controls the expression of a gene.
-Fm-s	misc_structure	sequence_secondary_structure	SO:0000002	any secondary or tertiary nucleotide structure or  conformation that cannot be described by other Structure keys (stem_loop and D-loop);	A folded sequence.
-Fmod	modified_base	modified_base_site	SO:0000305	the indicated nucleotide is a modified nucleotide and should be substituted for by the indicated molecule (given in the mod_base qualifier value)	A modified nucleotide, i.e. a nucleotide other than A, T, C. G or (in RNA) U.
-Fmut	old_sequence			the presented sequence revises a previous version of the sequence at this location; Or /compare=[accession-number.sequence-version]	
-Fold	operon	operon	SO:0000178	region containing polycistronic transcript containing genes that encode enzymes that are  in the same metabolic pathway and regulatory sequences 	A group of contiguous genes transcribed as a single (polycistronic) mRNA from a single regulatory region.
-Frpo	rep_origin	origin_of_replication	SO:0000296	The origin of replication;	starting site for duplication of a nucleic acid molecule to give two identical copies.
-	oriT	origin_of_transfer	SO:0000724	origin of transfer; region of a DNA molecule where  transfer is initiated during the process of conjugation  or mobilization	A region of a DNA molecule whre transfer is initiated during the process of conjugation or mobilization.
-FpAS	polyA_signal	polyA_signal_sequence	SO:0000551	recognition region necessary for endonuclease cleavage of an RNA transcript that is followed by polyadenylation; consensus=AATAAA [1];	The recognition sequence necessary for endonuclease cleavage of an RNA transcript that is followed by polyadenylation; consensus=AATAAA.
-FpAs	polyA_site	polyA_site	SO:0000553	site on an RNA transcript to which will be added adenine residues by post-transcriptional polyadenylation;	The site on an RNA transcript to which will be added adenine residues by post-transcriptional polyadenylation.
-Fpas	polyA_sequence	polyA_sequence	SO:0000610	Sequence of about 100 nucleotides of A added to the 3' end of most eukaryotic mRNAs.	  Sequence of about 100 nucleotides of A added to the 3' end of most eukaryotic mRNAs.
-FpRN	precursor_RNA	primary_transcript	SO:0000185	any RNA species that is not yet the mature RNA product; may include 5' clipped region (5'clip), 5' untranslated region (5'UTR), coding sequences (CDS, exon), intervening sequences (intron), 3' untranslated region (3'UTR), and 3' clipped region (3'clip);	The primary (initial, unprocessed) transcript; includes five_prime_clip (SO:0000555), five_prime_untranslated_region (SO:0000204), open reading frames (SO:0000236), introns (SO:0000188) and [...]
-Fp_t	prim_transcript	primary_transcript	SO:0000185	primary (initial, unprocessed) transcript;  includes 5' clipped region (5'clip), 5' untranslated region (5'UTR), coding sequences (CDS, exon), intervening sequences (intron), 3' untranslated region (3'UTR), and 3' clipped region (3'clip);	The primary (initial, unprocessed) transcript; includes five_prime_clip (SO:0000555), five_prime_untranslated_region (SO:0000204), open reading frames (SO:0000236), introns (SO:0000188) and three_prime_ [...]
-Fp_b	primer_bind	primer_binding_site	SO:0005850	non-covalent primer binding site for initiation of replication, transcription, or reverse transcription; includes site(s) for synthetic e.g., PCR primer elements;	Non-covalent primer binding site for initiation of replication, transcription, or reverse transcription.  
-Fpro	promoter	promoter	SO:0000167	region on a DNA molecule involved in RNA polymerase binding to initiate transcription;	The region on a DNA molecule involved in RNA polymerase binding to initiate transcription.
-Fprt	protein_bind	protein_binding_site	SO:0000410	non-covalent protein binding site on nucleic acid;	A region of a molecule that binds to a protein.
-FrRN	rRNA	rRNA	SO:0000252	mature ribosomal RNA ; RNA component of the ribonucleoprotein particle (ribosome) which assembles amino acids into proteins.	RNA that comprises part of a ribosome, and that can provide both structural scaffolding and catalytic activity.
-Frpr	repeat_region	repeat_region	SO:0000657	region of genome containing repeating units;	A region of sequence containing one or more repeat units.
-Frpu	repeat_unit	repeat_unit	SO:0000726	single repeat element;	A single repeat element.
-Fsat	satellite	satellite_DNA	SO:0000005	many tandem repeats (identical or related) of a short basic repeating unit;  many have a base composition or other property different from the genome average  that allows them to be separated from the bulk (main band) genomic DNA;	The many tandem repeats (identical or related) of a short basic repeating unit; many have a base composition or other property different from the genome average that allows them to be separated from the bulk (main band) g [...]
-FscR	scRNA	scRNA	SO:0000013	small cytoplasmic RNA; any one of several small cytoplasmic RNA molecules present in the cytoplasm and (sometimes) nucleus of a eukaryote; 	Any one of several small cytoplasmic RNA moleculespresent in the cytoplasm and sometimes nucleus of a eukaryote. 
-Fsig	sig_peptide	signal_peptide	SO:0000418	signal peptide coding sequence; coding sequence for an N-terminal domain of a secreted protein; this domain is involved in attaching nascent polypeptide to the membrane leader sequence;	The sequence for an N-terminal domain of a secreted protein; this domain is involved in attaching nascent polypeptide to the membrane leader sequence.
-FsnR	snRNA	snRNA	SO:0000274	small nuclear RNA molecules involved in pre-mRNA  splicing and processing  	Small non-coding RNA in the nucleoplasm.
-FsoR	snoRNA	snoRNA	SO:0000275	small nucleolar RNA molecules mostly involved in  rRNA modification and processing;  	Small nucleolar RNAs (snoRNAs) are involved in the processing and modification of rRNA in the nucleolus. There are two main classes of snoRNAs: the box C/D class, and the box H/ACA class. U3 snoRNA is a member of the box C/D class. Indeed, the box C/D element is a subset of the six short sequence elements found in all U3 snoRNAs, namely boxes A, A', B, C, C', and D. The U3  [...]
-Fsrc	source	databank_entry	SO:2000061	identifies the biological source of the specified span of the sequence; this key is mandatory; more than one source key per sequence is allowed; every entry/record will have, as a minimum, either a single source key spanning the  entire sequence or multiple source keys which together  span the entire sequence. /mol_type="genomic DNA", "genomic RNA", "mRNA",  "tRNA", "rRNA", "snoRNA", "snRNA", "scRNA", "pre-RNA", "other RNA", "other DNA",  "unassigned [...]
-Fstm	stem_loop	stem_loop	SO:0000313	hairpin; a double-helical region formed by base-pairing between adjacent (inverted) complementary sequences in a single strand of RNA or DNA. 	A double-helical region of nucleic acid formed by base-pairing between adjacent (inverted) complementary sequences.
-FtRN	tRNA	tRNA	SO:0000253	mature transfer RNA, a small RNA molecule (75-85 bases long) that mediates the translation of a nucleic acid sequence into an amino acid sequence;	Transfer RNA (tRNA) molecules are approximately 80 nucleotides in length. Their secondary structure includes four short double-helical elements and three loops (D, anti-codon, and T loops). Further hydrogen bonds mediate the characteristic L-shaped molecular structure. tRNAs have two regions of fundamental functional  [...]
-Fter	terminator	terminator	SO:0000141	sequence of DNA located either at the end of the transcript that causes RNA polymerase to terminate  transcription;	The sequence of DNA located either at the end of the transcript that causes RNA polymerase to terminate transcription.
-Ft-p	transit_peptide	transit_peptide	SO:0000725	transit peptide coding sequence; coding sequence for an N-terminal domain of a nuclear-encoded organellar protein; this domain is involved in post-translational import of the protein into the organelle;	The coding sequence for an N-terminal domain of a nuclear-encoded organellar protein: this domain is involved in post translational import of the protein into the organelle. 
-F???	unsure	sequence_uncertainty	SO:0001086	author is unsure of exact sequence in this region;	Describes the positions in a sequence where the authors are unsure about the sequence assignment. [EBIBS:GAR, UniProt:curation_manual]
-Fvar	variation	sequence_variant	SO:0000109	a related strain contains stable mutations from the same gene (e.g., RFLPs, polymorphisms, etc.) which differ from the presented sequence at this location (and possibly others);	A region of sequence where variation has been observed.
-
-
-# Second part
-#
-# BaCh: added some gap4/SO translations used previously
-
-Fctg		contig	   		     
-Fmel		mobile_element			
-FncR		ncRNA			
-Fpgn		pseudogene			
-Fpxn		pseudogenic_exon			
-Fprg		pseudogenic_region			
-FptR		pseudotRNA			
-Freg		region			
-Frrg		regulatory_region			
-FtmR		tmRNA			
-Fptr		processed_transcript			
-COMM		remark			
diff --git a/src/mira/gbf_parse.C b/src/io/gbf.C
similarity index 56%
rename from src/mira/gbf_parse.C
rename to src/io/gbf.C
index bbb91ab..757a0b2 100644
--- a/src/mira/gbf_parse.C
+++ b/src/io/gbf.C
@@ -9,84 +9,113 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
-#include <boost/algorithm/string.hpp>
-
-#include "mira/gbf_parse.H"
-
-#include "io/annotationmappings.H"
-#include "util/progressindic.H"
-#include "util/misc.H"
-#include "mira/multitag.H"
-
-
-using namespace std;
-
-#define CEBUG(bla)
-
-const char * GBF::GBF_miragbfscankeys[]= {
-  "/gene",
-  "/locus_tag",
-  "/product",
-  "/note",
-  "/function",
-  "/EC_number",
-  "/operon",
-  "/protein_id",
-  "/codon_start",
-  "/transl_table",
-  "/translation",
-  "/standard_name",
+// 	$Id$	
+
+
+#include "io/gbf.H"
+
+#ifndef lint
+static char vcid[] = "$Id$";
+#endif /* lint */
+
+
+vector<string>   GBF::GBF_gbffeaturenames;
+vector<string>   GBF::GBF_gap4featurenames;
+
+
+bool GBF::GBF_staticfeaturesinit=false;
+// do not delete last (empty) entry in field below, it's needed
+//  in GBF::fillFeatureTranslationVectors()
+const char * GBF::GBF_featuretranslations[]= {
+  "MFSM","MFSM",                // this one does not exist in GenBank !!! just for testing ... should probably use F??? and note=MFSM
+
+  "CDS","FCDS",
+  "gene","Fgen",
+  "mRNA","FmRN",
+  "misc_RNA","Fm-R",
+  "precursor_RNA","FpRN",
+  "rRNA","FrRN",
+  "scRNA","FscR",
+  "snRNA","FsnR",
+  "tRNA","FtRN",
+
+  "-","F---",
+  "-10_signal","F-10",
+  "-35_signal","F-35",
+  "3'UTR","F3_U",
+  "3'clip","F3_c",
+  "5'UTR","F5_U",
+  "5'clip","F5_c",
+  "CAAT_signal","FCAA",
+  "C_region","FCre",
+  "D-loop","FD-l",
+  "D_segment","FD-s",
+  "GC_signal","FGCs",
+  "J_segment","FJ-s",
+  "LTR","FLTR",
+  "N_region","FN-r",
+  "RBS","FRBS",
+  "STS","FSTS",
+  "S_region","FS-r",
+  "TATA_signal","FTAT",
+  "V_region","FV-r",
+  "V_segment","FV-s",
+  "attenuator","Fatt",
+  "conflict","Fcon",
+  "enhancer","Fenh",
+  "exon","Fexn",
+  "iDNA","FiDN",
+  "intron","Fint",
+  "mat_peptide","Fmat",
+  "misc_binding","Fm-b",
+  "misc_difference","Fm-d",
+  "misc_feature","Fm-f",
+  "misc_recomb","Fm-r",
+  "misc_signal","Fm-S",
+  "misc_structure","Fm-s",
+  "modified_base","Fmod",
+  "mutation","Fmut",
+  "old_sequence","Fold",
+  "polyA_signal","FpAS",
+  "polyA_site","FpAs",
+  "prim_transcript","Fp_t",
+  "primer_bind","Fp_b",
+  "promoter","Fpro",
+  "protein_bind","Fprt",
+  "rep_origin","Frpo",
+  "repeat_region","Frpr",
+  "repeat_unit","Frpu",
+  "satellite","Fsat",
+  "sig_peptide","Fsig",
+  "source","Fsrc",
+  "stem_loop","Fstm",
+  "terminator","Fter",
+  "transit_peptide","Ft-p",
+  "unsure","F???",
+  "variation","Fvar",
   ""
 };
 
-const char * GBF::GBF_oldmiragbf2gff3translations[]= {
-  "/gene", "gene=",
-  "/locus_tag", "locus_tag=",
-  "/product", "product=",
-  "/note", "Note=",
-  "/function", "function=",
-  "/EC_number", "eC_number=",
-  "/operon", "operon=",
-  "/protein_id", "protein_id=",
-  "/codon_start", "codon_start=",
-  "/transl_table", "transl_table=",
-  "/translation", "translation=",
-  "/standard_name", "standard_name=",
-  ""
-};
-
-GBF::strstrmap GBF::GBF_mapoldmiragbf2gff3;
-
-// keep this last
-const bool GBF::GBF_staticfeaturesinit=GBF::staticInitialiser();
 
 
-bool GBF::staticInitialiser()
+void GBF::foolCompiler()
 {
-  FUNCSTART("bool GBF::staticInitialiser()");
-
-  for(uint32 i=0; GBF_oldmiragbf2gff3translations[i][0] != 0; i+=2) {
-    GBF_mapoldmiragbf2gff3[GBF_oldmiragbf2gff3translations[i]]=GBF_oldmiragbf2gff3translations[i+1];
-  }
-
-  FUNCEND();
-  return true;
+#include "stdinc/foolcompiler.C"
 }
 
-
 // Plain vanilla constructor
 GBF::GBF()
 {
@@ -150,7 +179,7 @@ const string & GBF::getSequenceName(uint32 i) const
   FUNCSTART("const string & GBF::getSequenceName(uint32 i) const");
 
   if(i>=GBF_sequencenames.size()){
-    MIRANOTIFY(Notify::WARNING, ": Tried to get out of range sequence name.");
+    throw Notify(Notify::WARNING, THISFUNC, ": Tried to get out of range sequence name.");
   }
 
   FUNCEND();
@@ -169,7 +198,7 @@ const string & GBF::getSequence(uint32 i) const
   FUNCSTART("const string & GBF::getSequence(uint32 i) const");
 
   if(i>=GBF_sequencenames.size()){
-    MIRANOTIFY(Notify::WARNING, ": Tried to get out of range sequence.");
+    throw Notify(Notify::WARNING, THISFUNC, ": Tried to get out of range sequence.");
   }
 
   FUNCEND();
@@ -183,12 +212,12 @@ const string & GBF::getSequence(uint32 i) const
  *
  *************************************************************************/
 
-const vector<multitag_t> & GBF::getTags(uint32 i) const
+const vector<tag_t> & GBF::getTags(uint32 i) const
 {
   FUNCSTART("const vector<tag_t> & GBF::getTags(uint32 i) const");
 
   if(i>=GBF_sequencenames.size()){
-    MIRANOTIFY(Notify::WARNING, ": Tried to get out of range tags.");
+    throw Notify(Notify::WARNING, THISFUNC, ": Tried to get out of range tags.");
   }
 
   FUNCEND();
@@ -208,40 +237,40 @@ void GBF::transferGeneInfoToCDSInfo()
 {
   FUNCSTART("void GBF::transferGeneInfoToCDSInfo()");
 
-//  BUGIFTHROW(GBF_sequences.size()!=GBF_sequencenames.size()
-//	     || GBF_sequencenames.size() != GBF_tags.size(),
-//	     "GBF data read is fishy, unequal number of sequences, names and tag vectors?");
-//
-//  vector<string> thingstotransfer;
-//  thingstotransfer.push_back("/gene");
-//  thingstotransfer.push_back("/locus_tag");
-//
-//  for(uint32 i=0; i<GBF_tags.size(); i++){
-//    auto J=GBF_tags[i].begin();
-//    for(uint32 j=1; j< GBF_tags[i].size(); j++){
-//      if(GBF_tags[i][j].identifier!="Fgen") {
-//	if(GBF_tags[i][j].from==GBF_tags[i][j-1].from
-//	   && GBF_tags[i][j].to==GBF_tags[i][j-1].to) {
-//	  for(uint32 t=0; t<thingstotransfer.size(); t++){
-//	    string::size_type fpos=GBF_tags[i][j].comment.find(thingstotransfer[t],0);
-//	    if(fpos==string::npos){
-//	      fpos=GBF_tags[i][j-1].comment.find(thingstotransfer[t],0);
-//	      if(fpos!=string::npos){
-//		string::size_type lpos=GBF_tags[i][j-1].comment.find('\n',0);
-//		if(lpos==string::npos) lpos=GBF_tags[i][j-1].comment.size();
-//		string newcomment=GBF_tags[i][j-1].comment.substr(fpos, lpos-fpos);
-//		if(GBF_tags[i][j].comment.size()){
-//		  if(newcomment[newcomment.size()-1]!='\n') newcomment+='\n';
-//		  newcomment+=GBF_tags[i][j].comment;
-//		}
-//		GBF_tags[i][j].comment=newcomment;
-//	      }
-//	    }
-//	  }
-//	}
-//      }
-//    }
-//  }
+  BUGIFTHROW(GBF_sequences.size()!=GBF_sequencenames.size()
+	     || GBF_sequencenames.size() != GBF_tags.size(),
+	     "GBF data read is fishy, unequal number of sequences, names and tag vectors?");
+  
+  vector<string> thingstotransfer;
+  thingstotransfer.push_back("/gene");
+  thingstotransfer.push_back("/locus_tag");
+
+  for(uint32 i=0; i<GBF_tags.size(); i++){
+    vector<tag_t>::iterator J=GBF_tags[i].begin();
+    for(uint32 j=1; j< GBF_tags[i].size(); j++){
+      if(GBF_tags[i][j].identifier!="Fgen") {
+	if(GBF_tags[i][j].from==GBF_tags[i][j-1].from
+	   && GBF_tags[i][j].to==GBF_tags[i][j-1].to) {
+	  for(uint32 t=0; t<thingstotransfer.size(); t++){
+	    string::size_type fpos=GBF_tags[i][j].comment.find(thingstotransfer[t],0);
+	    if(fpos==string::npos){
+	      fpos=GBF_tags[i][j-1].comment.find(thingstotransfer[t],0);
+	      if(fpos!=string::npos){
+		string::size_type lpos=GBF_tags[i][j-1].comment.find('\n',0);
+		if(lpos==string::npos) lpos=GBF_tags[i][j-1].comment.size();
+		string newcomment=GBF_tags[i][j-1].comment.substr(fpos, lpos-fpos);
+		if(GBF_tags[i][j].comment.size()){
+		  if(newcomment[newcomment.size()-1]!='\n') newcomment+='\n';
+		  newcomment+=GBF_tags[i][j].comment;
+		}
+		GBF_tags[i][j].comment=newcomment;
+	      }
+	    }
+	  }
+	}
+      }
+    }
+  }
 
   FUNCEND();
   return;
@@ -256,28 +285,28 @@ void GBF::transferGeneInfoToCDSInfo()
  *************************************************************************/
 
 
-void GBF::load(const string & gbfname)
+void GBF::load(const string & gbfin)
 {
-  FUNCSTART("GBF::load(const string & gbfname)");
+  FUNCSTART("GBF::load(const string & gbfin)");
 
   discard();
 
   ifstream fin;
-  fin.open(gbfname.c_str(), ios::in|ios::ate);
+  fin.open(gbfin.c_str(), ios::in|ios::ate);
   if(!fin){
-    MIRANOTIFY(Notify::WARNING, "File not found: " << gbfname);
+    MIRANOTIFY(Notify::WARNING, "File not found: " << gbfin);
   }
 
   streampos lenfile=fin.tellg();
   // static cast needed for gcc 3.3.3
   if(lenfile==static_cast<streampos>(0)){
-    MIRANOTIFY(Notify::FATAL, "Zero length file: " << gbfname);
+    MIRANOTIFY(Notify::FATAL, "Zero length file: " << gbfin);
   }
   fin.seekg(0, ios::beg);
 
   loadTheFile(fin, lenfile);
 
-  correctForTagPositionErrors(gbfname);
+  correctForTagPositionErrors();
 
   //cout << "Name: " << GBF_sequencenames.back() << endl;
   //cout << "Sequence: " << GBF_sequences.back() << endl;
@@ -295,36 +324,25 @@ void GBF::load(const string & gbfname)
  *
  *************************************************************************/
 
-void GBF::correctForTagPositionErrors(const string & gbfname)
+void GBF::correctForTagPositionErrors()
 {
   FUNCSTART("void GBF::correctForTagPositionErrors()");
 
   BUGIFTHROW(GBF_sequences.size()!=GBF_sequencenames.size()
 	     || GBF_sequencenames.size() != GBF_tags.size(),
 	     "GBF data read is fishy, unequal number of sequences, names and tag vectors?");
-
-  bool unrecoverable=false;
+  
   for(uint32 i=0; i<GBF_tags.size(); i++){
     size_t seqlen=GBF_sequences[i].size();
-    if(seqlen==0){
-      MIRANOTIFY(Notify::FATAL,"Entry " << GBF_sequencenames[i] << " in file " << gbfname << " has no DNA sequence??? Did you download an incomplete GenBank file without 'ORIGIN' entry (aka the DNA sequence)?");
-    }
-    for(auto & thistag : GBF_tags[i]){
-      if(thistag.from > seqlen){
-	cout << "Fishy tag which starts completely outside the sequence:\n" << thistag;
-	unrecoverable=true;
-      }
-      if(thistag.to > seqlen) {
-	cout << "Fishy tag (to is greater than sequence length of " << seqlen << "):\n" << thistag;
-	thistag.to=static_cast<uint32>(seqlen);
+    vector<tag_t>::iterator J=GBF_tags[i].begin();
+    for(;J != GBF_tags[i].end(); J++){
+      if(J->to > seqlen) {
+	cout << "Fishy tag (to is greater than sequence length of " << seqlen << "):\n" << *J;
+	J->to=static_cast<uint32>(seqlen);
       }
     }
   }
 
-  if(unrecoverable){
-    MIRANOTIFY(Notify::FATAL,"Some data in the loaded GenBank file had unrecoverable errors (see log above), please fix the file.");
-  }
-
   FUNCEND();
   return;
 }
@@ -346,26 +364,19 @@ void GBF::loadTheFile(ifstream & fin, uint64 lentoreserve)
   FUNCSTART("void GBF::loadTheFile(ifstream & fin, streampos lentoreserve)");
 
   ProgressIndicator<uint64> P(0, lentoreserve,1000);
-
+ 
   string::size_type linepos;
-  string::size_type postokenstart;
 
   uint32 numloci=0;
 
-  //tag_t emptytag;
-  //emptytag.from=0;
-  //emptytag.to=0;
-  //emptytag.strand='=';
-  //emptytag.identifier="";
-  //emptytag.comment="";
-  //
-  //tag_t acttag=emptytag;
-
-  string guessedname;
-
-  string tagidentifier;
-  string tagcomment;
+  tag_t emptytag;
+  emptytag.from=0;
+  emptytag.to=0;
+  emptytag.strand='=';
+  emptytag.identifier="";
+  emptytag.comment="";
 
+  tag_t acttag=emptytag;
   string actkey;
   string actval;
   vector<int32> fromtopos;
@@ -375,31 +386,25 @@ void GBF::loadTheFile(ifstream & fin, uint64 lentoreserve)
   bool haveLocus=false;
   bool haveFeature=false;
   bool haveOrigin=false;
-  uint64 linecount=0;
   while (getline(fin,line,'\n')){
-    ++linecount;
     if(P.delaytrigger()) P.progress(fin.tellg());
 
     // get rid of '\r' from DOS
     while(!line.empty() && line[line.size()-1]=='\r') line.resize(line.size()-1);
 
     linepos=0;
-    getNextToken(line, linepos, token, postokenstart);
-    CEBUG("line: " << line);
-    CEBUG("token\t" << token << endl);
-    CEBUG("linepos: " << linepos << endl);
+    getNextToken(line, linepos, token);
+    //cout << "line: " << line ;
+    //cout << "token\t" << token << endl;
+    //cout << "linepos: " << linepos << endl;
     if(token.size()==0) continue;
     if(token=="//") {
       haveLocus=false;
       haveFeature=false;
       haveOrigin=false;
-
-      guessedname.clear();
-      tagidentifier.clear();
-      tagcomment.clear();
-
-      actkey.clear();
-      actval.clear();
+      acttag=emptytag;
+      actkey="";
+      actval="";
       fromtopos.clear();
     } else if(haveLocus && haveOrigin) {
       // in ORIGIN
@@ -410,54 +415,42 @@ void GBF::loadTheFile(ifstream & fin, uint64 lentoreserve)
       for(;linepos<line.size(); linepos++){
 	if(!isblank(line[linepos])) {
 	  actseq+=line[linepos];
-	  //CEBUG("Tadaaa: " << line[linepos] << endl);
+	  CEBUG("Tadaaa: " << line[linepos] << endl);
 	}
       }
     } else if(haveLocus && haveFeature) {
       // in feature
-      if(postokenstart==0 && token=="ORIGIN") {
+      if(token=="ORIGIN" && linepos==6) {
 	haveOrigin=true;
-	addKeyVal2TagComment(actkey,actval,tagcomment);
-	storeAccumulatedTags(guessedname, tagidentifier, tagcomment, fromtopos);
-      }else if(postokenstart==0 && token=="BASE") {
-	// DDBJ file: BASE COUNT ... just ignore that line
-      } else if(postokenstart==0){
-	cout << "Fishy line (" << linecount << "): " << line << "\nViolating GenBank standard guidelines: we are in features, token is not ORIGIN, but starts at column 0.\n";
-      } else if(postokenstart==5 && linepos<=20){
+	addKeyVal2TagComment(actkey,actval,acttag);
+	storeAccumulatedTags(acttag,fromtopos);
+      } else if(linepos<=20){
 	// new feature
-	CEBUG("New feature " << postokenstart << " " << linepos << endl);
-	addKeyVal2TagComment(actkey,actval,tagcomment);
-	storeAccumulatedTags(guessedname, tagidentifier, tagcomment, fromtopos);
 
-	guessedname.clear();
-	tagidentifier.clear();
-	tagcomment.clear();
+	addKeyVal2TagComment(actkey,actval,acttag);
+	storeAccumulatedTags(acttag,fromtopos);
 
+	acttag=emptytag;
 	actkey.clear();
 	actval.clear();
 
 	string location;
-	getNextToken(line, linepos, location, postokenstart);
-	// handle non-compliance of CloneManager which has a blank between complement and bracket: "complement (x..y)"
-	// *sigh*
-	// in those cases, location only contains "complement" and not "complement(...)"
-	// make this a general resolution (in case other elements are also badly writen by CloneManager)
-	if(location.back()!=')'){
-	  auto newloc=location;
-	  getNextToken(line, linepos, location, postokenstart);
-	  location=newloc+location;
-	}
+	getNextToken(line, linepos, location);
 	fromtopos.clear();
 	parseGBFLocation(location,fromtopos,1);
 
-	tagidentifier=token;
+	const char * id= translateGBFfeat2GAP4GBFfeat(token);
+	if(strlen(id)>0){
+	  acttag.identifier=id;
+	  //cout << token << " (" << id << ")" << location << endl;
+	}
       } else {
 	// feature continuation line
 	if(token[0]=='/') {
 	  // new key
-	  CEBUG("New key : " << token << endl);
+	  //cout << "Key : " << token << endl;
 
-	  addKeyVal2TagComment(actkey,actval,tagcomment);
+	  addKeyVal2TagComment(actkey,actval,acttag);
 
 	  actkey.clear();
 	  actval.clear();
@@ -466,47 +459,31 @@ void GBF::loadTheFile(ifstream & fin, uint64 lentoreserve)
 	  if(equpos!=string::npos && equpos != token.size()-1){
 	    actkey=token.substr(0,equpos);
 	    actval=token.substr(equpos+1,10000000)+line.substr(linepos,1000000);;
-
-	    // *sigh* workaround for Vector NTI "/label"
-	    strstrmap::const_iterator tI=GBF_mapoldmiragbf2gff3.find(actkey);
-	    if(tI==GBF_mapoldmiragbf2gff3.end() && actkey!="/label"){
+	    if(actkey=="/gene"
+	       || actkey=="/locus_tag"
+	       || actkey=="/product"
+	       || actkey=="/note"
+	       || actkey=="/function"
+	       || actkey=="/EC_number"
+	       || actkey=="/operon"
+	       || actkey=="/protein_id"
+	       || actkey=="/codon_start"
+	       || actkey=="/transl_table"
+	       || actkey=="/protein_id"
+//	       || actkey=="/translation"
+	       || actkey=="/standard_name") {
+	      //cout << "Key : " << actkey << "\t" << actval << endl;	    
+	      //actkey=substr(1,10000);
+	    }else{
 	      actkey.clear();
 	      actval.clear();
-	    }else{
-	      if(actkey!="/label"){
-		actkey=tI->second;
-	      }else{
-		// transform the "\" from Vector NTI to regular spaces *sigh*
-		actkey="label=";
-		for(auto & c : actval){
-		  if(c=='\\') c=' ';
-		}
-	      }
-	      // BaCh 05.04.2013: Hmmmm ... this is double coding (addKeyVal2TagComment() already does it)
-	      // Why was it in?
-	      //
-              //string tmp;
-	      //gff3Code(actval,tmp);
-	      //tmp.swap(actval);
-	      if(actkey=="gene="){
-		boost::trim_if(actval,boost::is_any_of("\""));
-		guessedname=actval;
-		actkey.clear();
-		actval.clear();
-	      }else{
-		if(guessedname.empty()
-		   && (actkey=="locus_tag="
-		       || actkey=="protein_id")){
-		  boost::trim_if(actval,boost::is_any_of("\""));
-		  guessedname=actval;
-		}
-	      }
 	    }
+
 	  }
 	}else{
 	  // key continuation line
 	  // additionally insert a space to anything but /translation
-	  CEBUG("cont " << token << endl);
+	  //cout << "cont " << token << endl;
 	  if(!actkey.empty()){
 	    if(actkey!="/translation") actval+=' ';
 	    actval+=token;
@@ -527,14 +504,14 @@ void GBF::loadTheFile(ifstream & fin, uint64 lentoreserve)
 	haveLocus=true;
 	numloci++;
 	string seqname;
-	getNextToken(line, linepos,seqname, postokenstart);
+	getNextToken(line, linepos,seqname);
 	GBF_sequencenames.push_back(seqname);
 	GBF_sequences.push_back("");
 	GBF_sequences.back().reserve(lentoreserve);
 	GBF_tags.resize(numloci);
 	GBF_tags.back().reserve(10000);
       }else{
-	MIRANOTIFY(Notify::FATAL, "Missing LOCUS token as first entry in file ... are you sure that this is a Genbank file?");
+	throw Notify(Notify::FATAL, THISFUNC, "Missing LOCUS token as first entry in file ... are you sure that this is a Genbank file?");
       }
     }
   }
@@ -545,24 +522,11 @@ void GBF::loadTheFile(ifstream & fin, uint64 lentoreserve)
   FUNCEND();
 }
 
-
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-void GBF::addKeyVal2TagComment(const string & actkey, const string & actval, string & comment) const
+void GBF::addKeyVal2TagComment(const string & actkey, const string & actval, tag_t & thetag) const 
 {
   if(!actkey.empty()) {
-    if(!comment.empty()) comment+=';';
-    comment+=actkey;
-    string tmp(boost::trim_copy_if(actval,boost::is_any_of("\"")));
-    string tmp2;
-    gff3Code(tmp,tmp2);
-    comment+=tmp2;
+    if(!thetag.comment.empty()) thetag.comment+='\n';
+    thetag.comment+=actkey+'='+actval;
   }
 }
 
@@ -576,59 +540,17 @@ void GBF::addKeyVal2TagComment(const string & actkey, const string & actval, str
  *************************************************************************/
 
 
-void GBF::storeAccumulatedTags(const string & guessedname, const string & identifier, const string & comment, vector<int32> & fromto)
+void GBF::storeAccumulatedTags(tag_t & acttag, vector<int32> & fromto) 
 {
   FUNCSTART("void GBF::storeAccumulatedTags(tag_t & acttag, vector<int32> & fromto)");
 
-  if(!identifier.empty()){
-    string namecomment;
-    if(guessedname.empty()){
-      namecomment=comment;
-    }else{
-      namecomment="Name="+guessedname+";"+comment;
-    }
-    if(fromto.size()%3 != 0) {
-      MIRANOTIFY(Notify::INTERNAL, "Could not parse feature location in GBF file. This also might be an FATAL error due to buggy GBF!");
-    }
-
-    string soidentifier(AnnotationMappings::translateGenBankfeat2SOfeat(identifier));
-
-    vector<int32>::const_iterator I=fromto.begin();
-    for(;I!=fromto.end(); I+=3) {
-      multitag_t acttag;
-
-      acttag.setSourceStr("GenBank");
-      if(soidentifier.empty()){
-	acttag.setIdentifierStr("located_sequence_feature");
-      }else{
-	acttag.setIdentifierStr(soidentifier);
-      }
-      acttag.setCommentStr(namecomment);
-      acttag.commentisgff3=true;
-
-      if(*I>0) {
-	acttag.setStrand('+');
-      }else{
-	acttag.setStrand('-');
-      }
-      // tags have positions beginning at 0 in MIRA
-      acttag.from=*(I+1)-1;
-      acttag.to=*(I+2)-1;
-
-      GBF_tags.back().push_back(acttag);
-
-      CEBUG("Stored: "<< acttag << endl);
-    }
-  }
-
-#if 0
   if(!acttag.identifier.empty()){
     //cout << "Write tag(s):"<<endl;
     //cout << "identifier: " << acttag.identifier << endl;
     //cout << "comment: " << acttag.comment << endl;
     //cout << "for ranges: ";
     if(fromto.size()%3 != 0) {
-      MIRANOTIFY(Notify::INTERNAL, "Could not parse feature location in GBF file. This also might be an FATAL error due to buggy GBF!");
+      throw Notify(Notify::INTERNAL, THISFUNC, "Could not parse feature location in GBF file. This also might be an FATAL error due to buggy GBF!");
     }
     vector<int32>::const_iterator I=fromto.begin();
     for(;I!=fromto.end(); I+=3) {
@@ -642,14 +564,14 @@ void GBF::storeAccumulatedTags(const string & guessedname, const string & identi
       acttag.to=*(I+2)-1;
       //cout << "Storing: ";
       //acttag.dump();
-
+      GBF_tags.back().push_back(acttag);
+      //cout << "Stored: ";
+      //GBF_tags.back().back().dump();
       //cout << "strand: " << acttag.strand << endl;
       //cout << "from: " << acttag.from << "\tto: " << acttag.to << endl;
     }
   }
 
-#endif
-
   FUNCEND();
 }
 
@@ -663,7 +585,7 @@ void GBF::storeAccumulatedTags(const string & guessedname, const string & identi
  *
  *************************************************************************/
 
-void GBF::getNextToken(const string & line, string::size_type & linepos, string & token, string::size_type & postokenstart) const
+void GBF::getNextToken(const string & line, string::size_type & linepos, string & token) const 
 {
   token="";
   if(linepos>=line.size()) {
@@ -673,18 +595,18 @@ void GBF::getNextToken(const string & line, string::size_type & linepos, string
 
   string blanks=" \t";
 
-  postokenstart=string::npos;
+  string::size_type tokenstart=string::npos;
   string::size_type tokenend=string::npos;
 
-  postokenstart=line.find_first_not_of(blanks,linepos);
-  if(postokenstart==string::npos){
+  tokenstart=line.find_first_not_of(blanks,linepos);
+  if(tokenstart==string::npos){
     linepos=string::npos;
     return;
   }
-  tokenend=line.find_first_of(blanks,postokenstart);
+  tokenend=line.find_first_of(blanks,tokenstart);
   if(tokenend==string::npos) tokenend=line.size();
 
-  token=line.substr(postokenstart, tokenend-postokenstart);
+  token=line.substr(tokenstart, tokenend-tokenstart);
   linepos=tokenend;
   return;
 }
@@ -698,15 +620,21 @@ void GBF::getNextToken(const string & line, string::size_type & linepos, string
  *
  *************************************************************************/
 
+
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+
 void GBF::parseGBFLocation(const string & location, vector<int32> & fromto, int32 direction) const
 {
   if(location.empty()) return;
 
-  //cout << "GBF need to parse loc: #" << location << "#\n";
-
   if(location[0]=='c'
      || location[0]=='j'
-     || location[0]=='o') {
+     || location[0]=='o') { 
     if(location[0]=='c') direction*=-1;
     string::size_type leftbracket=location.find('(');
     if(leftbracket==string::npos) return;
@@ -746,13 +674,13 @@ void GBF::parseGBFLocation(const string & location, vector<int32> & fromto, int3
 	firstnum=choice2;
 	secondnum=choice1;
       }
-
+ 
       locpos+=rightbracket+1;
       //cout << "Rest after bracket: " << (char *) &location[locpos] << endl;
     }else{
       //cout << "Analyse firstnum: " << location << endl;
-
-      firstnum=strtol(&location[locpos],nullptr,10);
+      
+      firstnum=strtol(&location[locpos],NULL,10);
       //cout << "Firstnum is " << firstnum << endl;
       while(locpos<location.size() && isdigit(location[locpos])) locpos++;
       //cout << "Eaten until " << location[locpos] << endl;
@@ -763,8 +691,8 @@ void GBF::parseGBFLocation(const string & location, vector<int32> & fromto, int3
     }
     if(locpos<location.size()){
       //cout << "Analyse secondpart: " << (char *) &location[locpos] << endl;
-      while(locpos<location.size()
-	    && (location[locpos] == '.'
+      while(locpos<location.size() 
+	    && (location[locpos] == '.' 
 		|| location[locpos]=='^'
 		|| location[locpos]=='<'
 		|| location[locpos]=='>')) {
@@ -778,7 +706,7 @@ void GBF::parseGBFLocation(const string & location, vector<int32> & fromto, int3
 	parseGBFLocation(location.substr(locpos+1,rightbracket-locpos-1),
 			 fromto,
 			 direction);
-//      werte poppen und größten nehmen
+//      werte poppen und gr��ten nehmen
 	int32 choice2=fromto.back();
 	fromto.pop_back();
 	int32 choice1=fromto.back();
@@ -792,7 +720,7 @@ void GBF::parseGBFLocation(const string & location, vector<int32> & fromto, int3
 	  secondnum=choice2;
 	}
       }else{
-	secondnum=strtol(&location[locpos],nullptr,10);
+	secondnum=strtol(&location[locpos],NULL,10);
 	while(locpos<location.size() && isdigit(location[locpos])) locpos++;
 	//cout << "Eaten until " << location[locpos] << endl;
       }
@@ -801,9 +729,9 @@ void GBF::parseGBFLocation(const string & location, vector<int32> & fromto, int3
     fromto.push_back(direction);
     fromto.push_back(static_cast<uint32>(firstnum));
     fromto.push_back(static_cast<uint32>(secondnum));
-    CEBUG("Push direction: " << direction << endl);
-    CEBUG("Push firstnum: " << firstnum << endl);
-    CEBUG("Push secondnum: " << secondnum << endl);
+    //cout << "Push direction: " << direction << endl;
+    //cout << "Push firstnum: " << firstnum << endl;
+    //cout << "Push secondnum: " << secondnum << endl;
     if(locpos<location.size() && location[locpos]==','){
       parseGBFLocation(location.substr(locpos+1,100000000),
 		       fromto,
@@ -828,15 +756,15 @@ string::size_type GBF::getCorrespondingRightBracket(const string & chars, string
   if(start<chars.size()) {
     if(chars[start]!='('){
       cerr << chars << "At start " << start << " in " << chars << " is " << chars[start] << " and not a bracket?\n";
-      MIRANOTIFY(Notify::FATAL, "expected a open bracket (. This also might be an INTERNAL error in the parsing routine!");
+      throw Notify(Notify::FATAL, THISFUNC, "expected a open bracket (. This also might be an INTERNAL error in the parsing routine!");
     }
   } else {
-    MIRANOTIFY(Notify::INTERNAL, ": tried to parse after string???");
+    throw Notify(Notify::INTERNAL, THISFUNC, ": tried to parse after string???");
   }
   start++;
   int32 leftopen=1;
   while(start<chars.size()){
-    //cout << (char) chars[start];
+    //cout << (char) chars[start]; 
     if(leftopen==1 && chars[start]==')') break;
     if(chars[start]=='(') leftopen++;
     if(chars[start]==')') leftopen--;
@@ -854,26 +782,78 @@ string::size_type GBF::getCorrespondingRightBracket(const string & chars, string
   return start;
 }
 
+void GBF::fillFeatureTranslationVectors()
+{
+  FUNCSTART("void GBF::fillFeatureTranslationVectors()");
+
+  if(GBF_gbffeaturenames.size()==0){
+    uint32 i=0;
+    while( strlen(GBF_featuretranslations[i]) != 0) {
+      GBF_gbffeaturenames.push_back(GBF_featuretranslations[i]);
+      i++;
+      GBF_gap4featurenames.push_back(GBF_featuretranslations[i]);
+      i++;
+    }
+  }
 
+  GBF_staticfeaturesinit=true;
 
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
+  FUNCEND();
+}
 
-bool GBF::checkIfCommentInOldMIRAGBFstyle(const string & comment)
+const char * GBF::translateGBFfeat2GAP4GBFfeat(const string & feature)
 {
-  if(comment.empty()) return false;
+  if(!GBF_staticfeaturesinit) fillFeatureTranslationVectors();
+
+  vector<string>::const_iterator gbfI=GBF_gbffeaturenames.begin();
+  vector<string>::const_iterator gapI=GBF_gap4featurenames.begin();
 
-  for(uint32 i=0; GBF_miragbfscankeys[i][0] != 0; ++i) {
-    string::size_type fpos=comment.find(GBF_miragbfscankeys[i],0);
-    if(fpos!=string::npos) return true;
+  for(; gbfI!=GBF_gbffeaturenames.end(); gbfI++, gapI++){
+    if(feature==*gbfI) return gapI->c_str();
   }
+
+  return "";
+}
+
+const char * GBF::translateGAP4GBFfeat2GBFfeat(const string & feature)
+{
+  if(!GBF_staticfeaturesinit) fillFeatureTranslationVectors();
+
+  vector<string>::const_iterator gbfI=GBF_gbffeaturenames.begin();
+  vector<string>::const_iterator gapI=GBF_gap4featurenames.begin();
+
+  for(; gapI!=GBF_gap4featurenames.end(); gbfI++, gapI++){
+    if(feature==*gapI) return gbfI->c_str();
+  }
+
+  return "";
+}
+
+bool GBF::checkIfGBFfeature(const string & feature)
+{
+  if(!GBF_staticfeaturesinit) fillFeatureTranslationVectors();
+
+  vector<string>::const_iterator gbfI=GBF_gbffeaturenames.begin();
+
+  for(; gbfI!=GBF_gbffeaturenames.end(); gbfI++){
+    if(feature==*gbfI) return true;
+  }
+
   return false;
 }
 
+bool GBF::checkIfGAP4GBFfeaure(const string & feature)
+{
+  if(!GBF_staticfeaturesinit) fillFeatureTranslationVectors();
+
+  vector<string>::const_iterator gapI=GBF_gap4featurenames.begin();
+
+  for(; gapI!=GBF_gap4featurenames.end(); gapI++){
+    if(feature==*gapI) return true;
+  }
+
+  return false;
+}
 
 
 
@@ -908,40 +888,3 @@ bool GBF::checkIfCommentInOldMIRAGBFstyle(const string & comment)
 //  FUNCEND();
 //  return ostr;
 //}
-
-
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-void GBF::liftOldMIRAGBFCommentToGFF3(const string & src, string & dst)
-{
-  dst.clear();
-  if(src.empty()) return;
-
-  strstrmap::iterator mI=GBF_mapoldmiragbf2gff3.begin();
-
-  string tmpstr1;
-  string tmpstr2;
-  for(; mI!=GBF_mapoldmiragbf2gff3.end(); ++mI){
-    if(tag_t::extractGenBankKeyValueFromComment(src,mI->first,tmpstr1)){
-      gff3Code(tmpstr1,tmpstr2);
-      if(!dst.empty()) dst+=';';
-      dst+=mI->second;
-      dst+=tmpstr2;
-    }
-  }
-
-  if(dst.empty()){
-    gff3Code(src,tmpstr1);
-    dst+="Note=";
-    dst+=tmpstr1;
-  }
-
-  //for(uint32 i=0; GBF_oldmiragbf2gff3[i][0] != 0; i+=2) {
-  //}
-}
diff --git a/src/io/gbf.H b/src/io/gbf.H
new file mode 100644
index 0000000..6c7fb8f
--- /dev/null
+++ b/src/io/gbf.H
@@ -0,0 +1,128 @@
+/*
+ * Written by Bastien Chevreux (BaCh)
+ *
+ * Copyright (C) 2003 and later by Bastien Chevreux
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ * 
+ */
+
+#ifndef _bas_gbf_h_
+#define _bas_gbf_h_
+
+#include <ctype.h>
+#include <string.h>
+
+#include <iostream>
+#include <fstream>
+#include <string>
+
+#include "stdinc/defines.H"
+#include "errorhandling/errorhandling.H"
+
+#include "io/exp.H"
+#include "util/progressindic.H"
+
+//// apparently, some systems may lack isblank() although it's part
+////  of C99
+//// patch kindly provided by
+////  Alfredo Jose Hernandez Alvarez <ajhernan at lcg.unam.mx>
+//#ifndef isblank
+//#define isblank(c) ((c) == ' ' || (c) == '\t')
+//#endif
+
+#if HAVE_ISBLANK == 0
+#define isblank(c) ((c) == ' ' || (c) == '\t')
+#endif
+
+using namespace std;
+
+
+
+class GBF
+{
+  //Variables
+private:
+  uint32 GBF_valid;
+
+  vector<string>          GBF_sequencenames;
+  vector<string>          GBF_sequences;
+  vector<vector<tag_t> >  GBF_tags;
+
+  static vector<string>   GBF_gbffeaturenames;
+  static vector<string>   GBF_gap4featurenames;
+
+  static bool   GBF_staticfeaturesinit;
+  static const char * GBF_featuretranslations[];
+
+public:
+
+
+  //Functions
+private:
+  void foolCompiler();
+  void init();
+  void zeroVars();
+
+  void loadTheFile(ifstream & gbfin, uint64 lentoreserve);
+  void getNextToken(const string & line, 
+		    string::size_type & linepos, 
+		    string & token) const;
+
+  //const char * getFeatureIdentifier(const string & feature) const;
+  void addKeyVal2TagComment(const string & actkey,
+			    const string & actval, 
+			    tag_t & thetag) const; 
+  void storeAccumulatedTags(tag_t & acttag, vector<int32> & fromto);
+  void parseGBFLocation(const string & location, 
+			vector<int32> & fromto,
+			int32 direction) const;
+  string::size_type getCorrespondingRightBracket(const string & chars, 
+						 string::size_type start) const;
+  void correctForTagPositionErrors();
+
+  static void fillFeatureTranslationVectors();
+
+public:
+  GBF();
+  GBF(GBF const &other);
+  ~GBF();
+
+  GBF const & operator=(GBF const & other);
+  friend ostream & operator<<(ostream &ostr, GBF const & gbf);
+
+  void discard();
+
+  void load(const string & gbfin);
+  size_t getNumSequences() const {return GBF_sequences.size();}
+  const string & getSequenceName(uint32 i) const;
+  const string & getSequence(uint32 i) const;
+  const vector<tag_t> & getTags(uint32 i) const;
+
+  void transferGeneInfoToCDSInfo();
+
+  static const char * translateGBFfeat2GAP4GBFfeat(const string & feature);
+  static const char * translateGAP4GBFfeat2GBFfeat(const string & feature);
+
+  // multitag?
+  static bool checkIfGBFfeature(const string & feature);
+  static bool checkIfGAP4GBFfeaure(const string & feature);
+};
+
+
+#endif
diff --git a/src/io/generalio.C b/src/io/generalio.C
index 88db261..e62ad3d 100644
--- a/src/io/generalio.C
+++ b/src/io/generalio.C
@@ -9,29 +9,25 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
 
-// 	$Id$
+// 	$Id$	
 
 
 #include "generalio.H"
 
-
-using namespace std;
-
-
 namespace GeneralIO {
 
 /*************************************************************************
@@ -45,7 +41,7 @@ namespace GeneralIO {
  *
  *************************************************************************/
 
-  bool readKeyValue(istream & sin, string & key, string & value)
+  bool readKeyValue(istream & sin, string & key, string & value) 
   {
     string tmpline;
     value.resize(0);
@@ -55,14 +51,12 @@ namespace GeneralIO {
       if(sin.eof()) break;
 
       // read a new line
-      while(!sin.rdstate()) {
+      while(!sin.eof()){
 	char tmpc= static_cast<char>(sin.get());
-        if(sin.rdstate()) break;
 	if(tmpc=='\n' || tmpc== -1) break;
 	tmpline+=tmpc;
       }
 
-      if(sin.rdstate()) return 0;
       //cout << "Line: " << tmpline << endl;;
 
       // use the istrstream facility to parse that :)
@@ -90,7 +84,9 @@ namespace GeneralIO {
     }
 
     //cout << "KV: " << key << "\t" << value << endl;
-
+    
     return (key.size()>0);
   }
 }
+
+
diff --git a/src/io/generalio.H b/src/io/generalio.H
index d7ad757..e7a85d5 100644
--- a/src/io/generalio.H
+++ b/src/io/generalio.H
@@ -9,17 +9,17 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
 #ifndef _bas_gio_h_
@@ -39,16 +39,19 @@
 #else
 
 #include <strstream>
-#endif
+#endif 
 
 #include <string>
 
 #include "errorhandling/errorhandling.H"
 
 
+// either uing namespace std; or using std::istream; using std::string; etc.
+using namespace std;
+
 namespace GeneralIO
 {
-  bool readKeyValue(std::istream & sin, std::string & key, std::string & value);
+  bool readKeyValue(istream & sin, string & key, string & value);
 }
 
 
diff --git a/src/io/mira_ft_set.xxd b/src/io/mira_ft_set.xxd
deleted file mode 100644
index 2d614a3..0000000
--- a/src/io/mira_ft_set.xxd
+++ /dev/null
@@ -1,54 +0,0 @@
-# A simple list of tags which MIRA sets or uses somewhere
-# List used to quickly decide whether an unknown tag identifier is a MIRA tag
-#  as those are encountered way more often in MAF files written by MIRA it's
-#  worth it.
-
-SRMc
-SRMr
-WRMc
-WRMr
-ORMB
-CRMr
-MNRr
-UNSr
-UNSc
-
-IUPc
-MCVc
-
-SROr
-SROc
-SAOr
-SAOc
-SIOr
-SIOc
-
-ED_I
-ED_D
-ED_C
-
-R454
-PSHP
-STMS
-STMU
-
-HAF0
-HAF1
-HAF2
-HAF3
-HAF4
-HAF5
-HAF6
-HAF7
-
-Q454
-P454
-T454
-H454
-
-MINF
-MIT2
-
-ESDN
-
-MIRA
diff --git a/src/io/ncbiinfoxml.C b/src/io/ncbiinfoxml.C
index 3940307..cc2c90f 100644
--- a/src/io/ncbiinfoxml.C
+++ b/src/io/ncbiinfoxml.C
@@ -9,17 +9,17 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
 /*
@@ -32,15 +32,20 @@
  *
  */
 
+// 	$Id$	
 
 #include "ncbiinfoxml.H"
 
-#include <cstring>
 
-
-using namespace std;
+#ifndef lint
+static char vcid[] = "$Id$";
+#endif /* lint */
 
 
+void NCBIInfoXML::foolCompiler()
+{
+#include "stdinc/foolcompiler.C"
+}
 
 // Plain vanilla constructor
 NCBIInfoXML::NCBIInfoXML()
@@ -129,7 +134,7 @@ void NCBIInfoXML::discard()
 
 
 
-void NCBIInfoXML::cdata(void *userData, const char *data, int len)
+void NCBIInfoXML::cdata(void *userData, const char *data, int len) 
 {
   XML_parsedata *pd = static_cast<XML_parsedata *>(userData);
   int i=0;
@@ -167,65 +172,65 @@ void NCBIInfoXML::endElement(void *userData, const char *name)
     uint32 element_code=0;
     if(strcmp(name,"trace_name") == 0) {
       element_code=NCBIXML_TRACE_NAME;
-    } else
-    if(strcmp(name,"trace_file") == 0) {
+    } else 
+    if(strcmp(name,"trace_file") == 0) { 
       element_code=NCBIXML_TRACE_FILE;
-    } else
-    if(strcmp(name,"trace_type_code") == 0) {
+    } else 
+    if(strcmp(name,"trace_type_code") == 0) { 
       element_code=NCBIXML_TRACE_TYPE_CODE;
-    } else
-    if(strcmp(name,"clip_quality_left") == 0) {
+    } else 
+    if(strcmp(name,"clip_quality_left") == 0) { 
       element_code=NCBIXML_CLIP_QUALITY_LEFT;
-    } else
-    if(strcmp(name,"clip_quality_right") == 0) {
+    } else 
+    if(strcmp(name,"clip_quality_right") == 0) { 
       element_code=NCBIXML_CLIP_QUALITY_RIGHT;
-    } else
-    if(strcmp(name,"clip_vector_left") == 0) {
+    } else 
+    if(strcmp(name,"clip_vector_left") == 0) { 
       element_code=NCBIXML_CLIP_VECTOR_LEFT;
-    } else
-    if(strcmp(name,"clip_vector_right") == 0) {
+    } else 
+    if(strcmp(name,"clip_vector_right") == 0) { 
       element_code=NCBIXML_CLIP_VECTOR_RIGHT;
-    } else
-    if(strcmp(name,"insert_size") == 0) {
+    } else 
+    if(strcmp(name,"insert_size") == 0) { 
       element_code=NCBIXML_INSERT_SIZE;
-    } else
-    if(strcmp(name,"insert_stdev") == 0) {
+    } else 
+    if(strcmp(name,"insert_stdev") == 0) { 
       element_code=NCBIXML_INSERT_STDEV;
     } else
-//    if(strcmp(name,"insert_size_min") == 0) {
+//    if(strcmp(name,"insert_size_min") == 0) { 
 //      element_code=NCBIXML_INSERT_SIZE_MIN;
-//    } else
-//    if(strcmp(name,"insert_size_max") == 0) {
+//    } else 
+//    if(strcmp(name,"insert_size_max") == 0) { 
 //      element_code=NCBIXML_INSERT_SIZE_MAX;
-//    } else
-    if(strcmp(name,"template_id") == 0) {
+//    } else 
+    if(strcmp(name,"template_id") == 0) { 
       element_code=NCBIXML_TEMPLATE_ID;
-    } else
-    if(strcmp(name,"trace_end") == 0) {
+    } else 
+    if(strcmp(name,"trace_end") == 0) { 
       element_code=NCBIXML_TRACE_END;
     } else
-    if(strcmp(name,"mate_ti") == 0) {
+    if(strcmp(name,"mate_ti") == 0) { 
       element_code=NCBIXML_MATE_TI;
-    } else
-    if(strcmp(name,"mate_name") == 0) {
+    } else 
+    if(strcmp(name,"mate_name") == 0) { 
       element_code=NCBIXML_MATE_NAME;
-    } else
-    if(strcmp(name,"ti") == 0) {
+    } else 
+    if(strcmp(name,"ti") == 0) { 
       element_code=NCBIXML_TI;
-    } else
-    if(strcmp(name,"base_file") == 0) {
+    } else 
+    if(strcmp(name,"base_file") == 0) { 
       element_code=NCBIXML_BASE_FILE;
-    } else
-    if(strcmp(name,"qual_file") == 0) {
+    } else 
+    if(strcmp(name,"qual_file") == 0) { 
       element_code=NCBIXML_QUAL_FILE;
     } else
-    if(strcmp(name,"program_id") == 0) {
+    if(strcmp(name,"program_id") == 0) { 
       element_code=NCBIXML_PROGRAM_ID;
     } else
-    if(strcmp(name,"machine_type") == 0) {
+    if(strcmp(name,"machine_type") == 0) { 
       element_code=NCBIXML_MACHINE_TYPE;
     } else
-    if(strcmp(name,"strain") == 0) {
+    if(strcmp(name,"strain") == 0) { 
       element_code=NCBIXML_STRAIN;
     }
 
@@ -264,12 +269,12 @@ void NCBIInfoXML::readXMLFile(const string & filename, list<ncbitraceelements_t>
 
 
   char buf[10000];
-  XML_Parser parser = XML_ParserCreate(nullptr);
+  XML_Parser parser = XML_ParserCreate(NULL);
   bool done;
   //int depth = 0;
   XML_SetUserData(parser, &NIX_parsedata);
-  XML_SetElementHandler(parser,
-			NCBIInfoXML::startElement,
+  XML_SetElementHandler(parser, 
+			NCBIInfoXML::startElement, 
 			NCBIInfoXML::endElement);
   XML_SetCharacterDataHandler(parser,NCBIInfoXML::cdata);
   do {
diff --git a/src/io/ncbiinfoxml.H b/src/io/ncbiinfoxml.H
index 85be009..572ac0d 100644
--- a/src/io/ncbiinfoxml.H
+++ b/src/io/ncbiinfoxml.H
@@ -9,26 +9,27 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
 
 #ifndef _bas_nix_h_
 #define _bas_nix_h_
 
+#include <iostream>
 #include <fstream>
 
-#include <list>
+#include <string.h>
 
 #include "stdinc/defines.H"
 #include "stdinc/stlincludes.H"
@@ -41,7 +42,7 @@
 #else
 
 #include <strstream>
-#endif
+#endif 
 
 #include <string>
 
@@ -51,6 +52,8 @@
 #include <expat.h>
 
 
+using namespace std;
+
 
 class NCBIInfoXML
 {
@@ -61,7 +64,7 @@ public:
   //  own expansion
 
   enum ncbixml_elements {
-    NCBIXML_TRACE_NAME=1,
+    NCBIXML_TRACE_NAME=1, 
     NCBIXML_TRACE_FILE,
     NCBIXML_TRACE_TYPE_CODE,
     NCBIXML_CLIP_QUALITY_LEFT ,
@@ -78,15 +81,15 @@ public:
     NCBIXML_MATE_TI ,
     NCBIXML_MATE_NAME ,
     NCBIXML_BASE_FILE ,
-    NCBIXML_QUAL_FILE,
+    NCBIXML_QUAL_FILE, 
     NCBIXML_PROGRAM_ID,
     NCBIXML_MACHINE_TYPE,
     NCBIXML_STRAIN
   };
 
   struct ncbitraceelements_t {
-    std::list<uint32> elements;
-    std::list<std::string> elements_cdata;
+    list<uint32> elements;
+    list<string> elements_cdata;
   };
 
   //Variables
@@ -94,15 +97,16 @@ private:
   uint32 NIX_valid;
 
   struct XML_parsedata {
-    std::list<ncbitraceelements_t> * targetlist;
+    list<ncbitraceelements_t> * targetlist;
 
-    std::string cdata;
+    string cdata;
     ncbitraceelements_t acttrace;
   } NIX_parsedata;
 
 
   //Functions
 private:
+  void foolCompiler();
   void init();
   void zeroVars();
 
@@ -117,12 +121,12 @@ public:
   ~NCBIInfoXML();
 
   NCBIInfoXML const & operator=(NCBIInfoXML const & other);
-  friend std::ostream & operator<<(std::ostream &ostr, NCBIInfoXML const &nix);
+  friend ostream & operator<<(ostream &ostr, NCBIInfoXML const &nix);
 
   void discard();
 
-  void readXMLFile(const std::string & filename,
-		   std::list<ncbitraceelements_t> & traceelems
+  void readXMLFile(const string & filename, 
+		   list<ncbitraceelements_t> & traceelems
     );
 };
 
diff --git a/src/io/oldso2so.xxd b/src/io/oldso2so.xxd
deleted file mode 100644
index a65ec3c..0000000
--- a/src/io/oldso2so.xxd
+++ /dev/null
@@ -1,2 +0,0 @@
-pseudotRNA	pseudogenic_tRNA
-mobile_element	mobile_genetic_element
diff --git a/src/io/phd.C b/src/io/phd.C
index 557bdc6..085dfa9 100644
--- a/src/io/phd.C
+++ b/src/io/phd.C
@@ -9,24 +9,31 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
-#include "io/phd.H"
+// 	$Id$	
 
+#ifndef lint
+static char vcid[] = "$Id$";
+#endif /* lint */
 
-using namespace std;
+#include "io/phd.H"
 
+void PHD::foolCompiler()
+{
+#include "stdinc/foolcompiler.C"
+}
 
 // Plain vanilla constructor
 PHD::PHD()
@@ -82,7 +89,7 @@ void PHD::discard()
 ostream & operator<<(ostream &ostr, PHD const &thephd)
 {
   //  FUNCSTART("friend ostream & PHD::operator<<(ostream &ostr, const  &???)");
-
+  
   ostr << "BEGIN_SEQUENCE x\n\n";
   ostr << "BEGIN_DNA\n";
   for(uint32 i=0; i<thephd.PHD_sequence.size(); i++) {
@@ -107,7 +114,7 @@ bool PHD::testIfEmpty()
   return true;
 }
 
-void PHD::load(const char * filename)
+void PHD::load(const char * filename) 
 {
   FUNCSTART("void PHD::load(const char * filename)");
 
@@ -215,3 +222,9 @@ g 6 11
 c 8 26
 
 #endif
+
+
+
+
+
+
diff --git a/src/io/phd.H b/src/io/phd.H
index e74fe78..3765cd6 100644
--- a/src/io/phd.H
+++ b/src/io/phd.H
@@ -9,17 +9,17 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
 
@@ -29,6 +29,8 @@
 #include <fstream>
 #include <string>
 
+#include <stdlib.h>
+
 #include "stdinc/stlincludes.H"
 
 #include "stdinc/defines.H"
@@ -38,32 +40,36 @@
 class PHD
 {
 private:
-  std::string         PHD_name;
-  std::string         PHD_sequence;
+  string         PHD_name;
+  string         PHD_sequence;
 
-  std::vector<base_quality_t>  PHD_qualities;
-  std::vector<uint32>          PHD_peakindex;
+  vector<base_quality_t>  PHD_qualities;
+  vector<uint32>          PHD_peakindex;
 
 private:
+  void   foolCompiler();
+
+
   void   zeroVars();
 
 public:
   PHD();
   virtual ~PHD();
-  friend std::ostream & operator<<(std::ostream &ostr, PHD const &thephd);
+  friend ostream & operator<<(ostream &ostr, PHD const &thephd);
   PHD const & operator=(PHD const & other);
 
   void load(const char * filename);
-  void loadNextSeq(std::ifstream & phdfin);
+  void loadNextSeq(ifstream & phdfin);
   bool testIfEmpty();
 
   void discard();
 
-  inline const std::string   & getSequence() const { return PHD_sequence;}
-  inline const std::string   & getName() const { return PHD_name;}
-  inline const std::vector<base_quality_t>  & getQualities() const { return PHD_qualities;}
-  inline const std::vector<uint32> & getPeakIndex() const { return PHD_peakindex;}
-
+  inline const string   & getSequence() const { return PHD_sequence;}
+  inline const string   & getName() const { return PHD_name;}
+  inline const vector<base_quality_t>  & getQualities() const { return PHD_qualities;}
+  inline const vector<uint32> & getPeakIndex() const { return PHD_peakindex;}
+		      
 };
 
 #endif
+
diff --git a/src/io/scf.C b/src/io/scf.C
index eb47bfe..4208b96 100644
--- a/src/io/scf.C
+++ b/src/io/scf.C
@@ -11,36 +11,40 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
 
-#include "scf.H"
+// 	$Id$	
 
+#ifndef lint
+static char vcid[] = "$Id$";
+#endif /* lint */
 
-#include <cstdlib>     // mkstemp() under Cygwin, also needs -U__STRICT_ANSI__
+#include "scf.H"
 
 
-#define CEBUG(bla)
 
-using namespace std;
+vector<string> SCF::SCF_suffixalternatives;
 
-#include <cstring>
 
 
-vector<string> SCF::SCF_suffixalternatives;
+void SCF::foolCompiler()
+{
 
+#include "stdinc/foolcompiler.C"
 
+}
 
 SCF::SCF()
 {
@@ -78,14 +82,14 @@ void SCF::discard()
   if(SCF_tmpfnameforload) {
     remove(SCF_tmpfnameforload);
     delete [] SCF_tmpfnameforload;
-    SCF_tmpfnameforload=nullptr;
+    SCF_tmpfnameforload=NULL;
   }
 
-  if(SCF_samples_A!=nullptr) delete [] SCF_samples_A;
-  if(SCF_samples_C!=nullptr) delete [] SCF_samples_C;
-  if(SCF_samples_G!=nullptr) delete [] SCF_samples_G;
-  if(SCF_samples_T!=nullptr) delete [] SCF_samples_T;
-
+  if(SCF_samples_A!=NULL) delete [] SCF_samples_A;
+  if(SCF_samples_C!=NULL) delete [] SCF_samples_C;
+  if(SCF_samples_G!=NULL) delete [] SCF_samples_G;
+  if(SCF_samples_T!=NULL) delete [] SCF_samples_T;
+    
   if(SCF_peak_index) delete [] SCF_peak_index;
   if(SCF_prob_A)     delete [] SCF_prob_A;
   if(SCF_prob_C)     delete [] SCF_prob_C;
@@ -94,12 +98,12 @@ void SCF::discard()
   if(SCF_prob_sub)     delete [] SCF_prob_sub;
   if(SCF_prob_ins)     delete [] SCF_prob_ins;
   if(SCF_prob_del)     delete [] SCF_prob_del;
-  if(SCF_bases)      delete [] SCF_bases;
-
+  if(SCF_bases)      delete [] SCF_bases;      
+    
   if(SCF_comments) delete [] SCF_comments;
-
+  
   if(SCF_private_data) delete [] SCF_private_data;
-
+  
   zeroVars();
 
   FUNCEND();
@@ -109,25 +113,25 @@ void SCF::zeroVars()
 {
   FUNCSTART("void SCF::zeroVars()");
 
-  SCF_tmpfnameforload=nullptr;
-
-  SCF_samples_A=nullptr;
-  SCF_samples_C=nullptr;
-  SCF_samples_G=nullptr;
-  SCF_samples_T=nullptr;
-
-  SCF_peak_index=nullptr;
-  SCF_prob_A=nullptr;
-  SCF_prob_C=nullptr;
-  SCF_prob_G=nullptr;
-  SCF_prob_T=nullptr;
-  SCF_prob_sub=nullptr;
-  SCF_prob_ins=nullptr;
-  SCF_prob_del=nullptr;
-  SCF_bases=nullptr;
-
-  SCF_comments=nullptr;
-  SCF_private_data=nullptr;
+  SCF_tmpfnameforload=NULL;
+
+  SCF_samples_A=NULL;
+  SCF_samples_C=NULL;
+  SCF_samples_G=NULL;
+  SCF_samples_T=NULL;
+  
+  SCF_peak_index=NULL;
+  SCF_prob_A=NULL;
+  SCF_prob_C=NULL;
+  SCF_prob_G=NULL;
+  SCF_prob_T=NULL;
+  SCF_prob_sub=NULL;
+  SCF_prob_ins=NULL;
+  SCF_prob_del=NULL;
+  SCF_bases=NULL;
+  
+  SCF_comments=NULL;
+  SCF_private_data=NULL;
 
   SCF_valid_data=0;
   SCF_header.magic_number=0;
@@ -144,7 +148,7 @@ SCF::SCF(SCF const &other)
   FUNCSTART("SCF::SCF(SCF const &other)");
 
   zeroVars();
-
+  
   *this=other;                               // call the copy operator
 
   FUNCEND();
@@ -165,7 +169,7 @@ SCF const & SCF::operator=(SCF const & other)
       memcpy(SCF_private_data, other.SCF_private_data, SCF_header.private_size);
     }
 
-    if(other.SCF_comments!=nullptr){
+    if(other.SCF_comments!=NULL){
       size_t len=strlen(other.SCF_comments);
       SCF_comments= new char [len+1];
       strcpy(SCF_comments, other.SCF_comments);
@@ -206,7 +210,7 @@ SCF const & SCF::operator=(SCF const & other)
       memcpy(SCF_peak_index, other.SCF_peak_index, SCF_header.bases*sizeof(uint32));
 
     }
-
+    
     SCF_valid_data=other.SCF_valid_data;
   }
 
@@ -214,20 +218,16 @@ SCF const & SCF::operator=(SCF const & other)
   return *this;
 }
 
-// return
-//  if ok: 0 and emsg is empty
-//  if non-fatal error: 1 and emsg is not empty
-int8 SCF::load(const char * givenname, string & emsg)
+
+int8 SCF::load(const char * givenname)
 {
   FUNCSTART("SCF::load(const char * filename)");
 
-  emsg.clear();
-
   // free memory if previously used
   discard();
 
-  if(givenname==nullptr){
-    MIRANOTIFY(Notify::INTERNAL, "got nullptr as SCF givenname???");
+  if(givenname==NULL){
+    MIRANOTIFY(Notify::INTERNAL, "got NULL as SCF givenname???");
   }
 
   if(strlen(givenname)==0){
@@ -254,12 +254,10 @@ int8 SCF::load(const char * givenname, string & emsg)
 
     if(!filefound) {
       discard();
-      emsg="SCF file not found for loading, even tried .Z, .gz, .scf, .scf.gz and .scf.Z extension: ";
-      emsg+=givenname;
-      return 1;
+      MIRANOTIFY(Notify::WARNING, "SCF file not found for loading, even tried .Z, .gz, .scf, .scf.gz and .scf.Z extension: " << givenname);
     }
   }
-  cout << "Loading " << filename << endl;
+
   SCF_lastloadedscfname=filename;
 
   fin.read((char *) &SCF_header, sizeof(SCF_header));
@@ -283,8 +281,8 @@ int8 SCF::load(const char * givenname, string & emsg)
 
       CEBUG("Compressed magic!\n");
       //Ok, seems to be a packed file. As gzip can handle all these
-      // methods, use only gzip to unpack.
-
+      // methods, use only gzip to unpack.  
+      
       // first, close the original file
       fin.close();
 
@@ -304,7 +302,7 @@ int8 SCF::load(const char * givenname, string & emsg)
 	    cerr << "Load retries failed, giving up.\n";
 	    delete [] command_buffer;
 	    discard();
-	    MIRANOTIFY(Notify::FATAL, "Unpacking of file failed. Not enough space in tmp-filesystem, corrupt file or process table full? : " << filename);
+	    MIRANOTIFY(Notify::WARNING, "Unpacking of file failed. Not enough space in tmp-filesystem, corrupt file or process table full? : " << filename);
 	  }
 	}
       }
@@ -324,7 +322,7 @@ int8 SCF::load(const char * givenname, string & emsg)
 	discard();
 	MIRANOTIFY(Notify::FATAL, "Unexpected EOF while reading header from temporarily uncompressed file. This should not have happened: " << filename);
       }
-
+      
       convertHeaderByteOrderToHost();
 
       if(SCF_header.magic_number!=SCF_MAGIC){
@@ -332,7 +330,7 @@ int8 SCF::load(const char * givenname, string & emsg)
 	//cout << hex << SCF_header.magic_number << endl;
 	//cout << SCF_tmpfnameforload << endl;
 	//exit(0);
-
+	
 	discard();
 	MIRANOTIFY(Notify::FATAL, "File is not an SCF: " << filename);
       }
@@ -622,7 +620,7 @@ int8 SCF::load(const char * givenname, string & emsg)
   if(SCF_tmpfnameforload) {
     remove(SCF_tmpfnameforload);
     delete [] SCF_tmpfnameforload;
-    SCF_tmpfnameforload=nullptr;
+    SCF_tmpfnameforload=NULL;
   }
 
   //looks like everything's ok
@@ -773,7 +771,7 @@ void SCF::delta16(uint16 * ptr)
     p_sample=*optr;
     *optr=*optr-p_delta;
     optr++;
-    p_delta=p_sample;
+    p_delta=p_sample;    
   }
 
   FUNCEND();
@@ -814,7 +812,7 @@ void SCF::delta8(uint8 * ptr)
     p_sample=*optr;
     *optr=*optr-p_delta;
     optr++;
-    p_delta=p_sample;
+    p_delta=p_sample;    
   }
 
   FUNCEND();
@@ -835,7 +833,7 @@ int8 SCF::dump()
 
   ptr=(char *)&SCF_header.magic_number;
   cptr=&SCF_header.magic_number;
-
+  
   *cptr=htonl(*cptr);
   cout << ptr[0] << ptr[1]<<ptr[2]<<ptr[3] << "\t\t# magic_number" << endl;
   *cptr=ntohl(*cptr);
@@ -871,8 +869,8 @@ int8 SCF::dump()
 	   SCF_prob_A[i] ,SCF_prob_C[i] ,SCF_prob_G[i] ,SCF_prob_T[i], i);
   }
   // flush the stdout
-  fflush(stdout);
-
+  fflush(stdout);    
+  
 
   cout << "\n\n[A-Trace]\n";
   dumpSample(&SCF_samples_A[0]);
@@ -882,7 +880,7 @@ int8 SCF::dump()
   dumpSample(&SCF_samples_G[0]);
   cout << "\n\n[T-Trace]\n";
   dumpSample(&SCF_samples_T[0]);
-
+  
   if(SCF_header.comments_size){
     cout << "\n\n[Comments]\n" << SCF_comments;
   }
@@ -949,28 +947,28 @@ void SCF::save(const char * filename)
     // is sample precision 1 byte or 2 byte?
     if(SCF_header.sample_size==2) {
       // 2 byte
-
+      
       // delta the SCF samples temporarily for saving
       delta16(SCF_samples_A);
       delta16(SCF_samples_C);
       delta16(SCF_samples_G);
       delta16(SCF_samples_T);
-
+      
       convert2ByteOrderToNetwork(SCF_samples_A, SCF_header.samples);
       convert2ByteOrderToNetwork(SCF_samples_C, SCF_header.samples);
       convert2ByteOrderToNetwork(SCF_samples_G, SCF_header.samples);
       convert2ByteOrderToNetwork(SCF_samples_T, SCF_header.samples);
-
+      
       fout.write((char *) SCF_samples_A, SCF_header.samples*SCF_header.sample_size);
       fout.write((char *) SCF_samples_C, SCF_header.samples*SCF_header.sample_size);
       fout.write((char *) SCF_samples_G, SCF_header.samples*SCF_header.sample_size);
       fout.write((char *) SCF_samples_T, SCF_header.samples*SCF_header.sample_size);
-
+      
       convert2ByteOrderToHost(SCF_samples_A, SCF_header.samples);
       convert2ByteOrderToHost(SCF_samples_C, SCF_header.samples);
       convert2ByteOrderToHost(SCF_samples_G, SCF_header.samples);
       convert2ByteOrderToHost(SCF_samples_T, SCF_header.samples);
-
+      
       // undelta again
       undelta16(SCF_samples_A);
       undelta16(SCF_samples_C);
@@ -978,12 +976,12 @@ void SCF::save(const char * filename)
       undelta16(SCF_samples_T);
     } else {
       // *sigh* 1 byte
-
+      
       uint8 * tmpsamplesA= new uint8[SCF_header.samples];
       uint8 * tmpsamplesC= new uint8[SCF_header.samples];
       uint8 * tmpsamplesG= new uint8[SCF_header.samples];
       uint8 * tmpsamplesT= new uint8[SCF_header.samples];
-
+      
       uint8 * dst=tmpsamplesA;
       uint16 * src=SCF_samples_A;
       for(uint32 i=0; i<SCF_header.samples; i++, src++, dst++){
@@ -1004,17 +1002,17 @@ void SCF::save(const char * filename)
       for(uint32 i=0; i<SCF_header.samples; i++, src++, dst++){
 	*dst=static_cast<uint8>(*src);
       }
-
+      
       delta8(tmpsamplesA);
       delta8(tmpsamplesC);
       delta8(tmpsamplesG);
       delta8(tmpsamplesT);
-
+      
       fout.write((char *) tmpsamplesA, SCF_header.samples*SCF_header.sample_size);
       fout.write((char *) tmpsamplesC, SCF_header.samples*SCF_header.sample_size);
       fout.write((char *) tmpsamplesG, SCF_header.samples*SCF_header.sample_size);
       fout.write((char *) tmpsamplesT, SCF_header.samples*SCF_header.sample_size);
-
+      
       delete [] tmpsamplesA;
       delete [] tmpsamplesC;
       delete [] tmpsamplesG;
@@ -1026,13 +1024,13 @@ void SCF::save(const char * filename)
     convert4ByteOrderToNetwork(SCF_peak_index, SCF_header.bases);
     fout.write((char *) SCF_peak_index, SCF_header.bases*4);
     convert4ByteOrderToHost(SCF_peak_index, SCF_header.bases);
-
+    
     fout.write((char *) SCF_prob_A, SCF_header.bases);
     fout.write((char *) SCF_prob_C, SCF_header.bases);
     fout.write((char *) SCF_prob_G, SCF_header.bases);
     fout.write((char *) SCF_prob_T, SCF_header.bases);
     fout.write((char *) SCF_bases, SCF_header.bases);
-
+    
     // create a temp array filed with zeros to write 3*SCF_header.bases
     //  as space which is not used yet
     {
@@ -1045,7 +1043,7 @@ void SCF::save(const char * filename)
 
   if(fout.fail()){
     MIRANOTIFY(Notify::FATAL, "Error while writing data into SCF: " << filename);
-  }
+  }  
 
   //good, now write the comments and private data (if any)
 
@@ -1099,13 +1097,13 @@ void SCF::cutBases(uint32 frombase, uint32 tobase)
   // search for how many samples on the right side to cut
   // if frombase = SCF_header.bases then none
   uint32 rsamples_to_cut=SCF_header.samples;
-
+  
   if(tobase!=SCF_header.bases){
     rsamples_to_cut=(SCF_peak_index[tobase]-SCF_peak_index[tobase-1])/2+SCF_peak_index[tobase-1];
   }
 
   uint32 samples_to_copy=rsamples_to_cut-lsamples_to_cut;
-
+  
   {
     // cut the samples
 
@@ -1144,12 +1142,12 @@ void SCF::cutBases(uint32 frombase, uint32 tobase)
     memcpy(tmpprob, SCF_prob_C+frombase, bases_to_copy);
     delete [] SCF_prob_C;
     SCF_prob_C=tmpprob;
-
+    
     tmpprob= new uint8[bases_to_copy];
     memcpy(tmpprob, SCF_prob_G+frombase, bases_to_copy);
     delete [] SCF_prob_G;
     SCF_prob_G=tmpprob;
-
+    
     tmpprob= new uint8[bases_to_copy];
     memcpy(tmpprob, SCF_prob_T+frombase, bases_to_copy);
     delete [] SCF_prob_T;
@@ -1188,7 +1186,7 @@ void SCF::cutBases(uint32 frombase, uint32 tobase)
 
 
 
-void SCF::recalcHeader()
+void SCF::recalcHeader() 
 {
   uint32 total_offset=128;
 
@@ -1215,23 +1213,23 @@ void SCF::setBases(const string & newbases, const vector<uint8> & newprobs, cons
     MIRANOTIFY(Notify::FATAL, "Number of elements in bases, qualities and peakindex arrays are not equal!");
   }
 
-  if(SCF_peak_index!=nullptr) delete [] SCF_peak_index;
-  if(SCF_prob_A!=nullptr) delete [] SCF_prob_A;
-  if(SCF_prob_C!=nullptr) delete [] SCF_prob_C;
-  if(SCF_prob_G!=nullptr) delete [] SCF_prob_G;
-  if(SCF_prob_T!=nullptr) delete [] SCF_prob_T;
-  if(SCF_bases!=nullptr) delete [] SCF_bases;
+  if(SCF_peak_index!=NULL) delete [] SCF_peak_index;
+  if(SCF_prob_A!=NULL) delete [] SCF_prob_A;
+  if(SCF_prob_C!=NULL) delete [] SCF_prob_C;
+  if(SCF_prob_G!=NULL) delete [] SCF_prob_G;
+  if(SCF_prob_T!=NULL) delete [] SCF_prob_T;
+  if(SCF_bases!=NULL) delete [] SCF_bases;
 
-  SCF_peak_index=nullptr;
-  SCF_prob_A=nullptr;
-  SCF_prob_C=nullptr;
-  SCF_prob_G=nullptr;
-  SCF_prob_T=nullptr;
-  SCF_bases=nullptr;
+  SCF_peak_index=NULL;
+  SCF_prob_A=NULL;
+  SCF_prob_C=NULL;
+  SCF_prob_G=NULL;
+  SCF_prob_T=NULL;
+  SCF_bases=NULL;
 
   uint32 numbases=static_cast<uint32>(newbases.size());
   SCF_header.bases=numbases;
-
+  
   if(numbases!=0) {
 
     SCF_peak_index= new uint32[numbases];
@@ -1243,7 +1241,7 @@ void SCF::setBases(const string & newbases, const vector<uint8> & newprobs, cons
     SCF_prob_ins= new uint8[numbases];
     SCF_prob_del= new uint8[numbases];
     SCF_bases= new char[numbases];
-
+    
     memset(SCF_prob_A, 0, numbases*sizeof(uint8));
     memset(SCF_prob_C, 0, numbases*sizeof(uint8));
     memset(SCF_prob_G, 0, numbases*sizeof(uint8));
@@ -1251,7 +1249,7 @@ void SCF::setBases(const string & newbases, const vector<uint8> & newprobs, cons
     memset(SCF_prob_sub, 0, numbases*sizeof(uint8));
     memset(SCF_prob_ins, 0, numbases*sizeof(uint8));
     memset(SCF_prob_del, 0, numbases*sizeof(uint8));
-
+    
     //memcpy(SCF_peak_index, newpeakindex, numbases*sizeof(uint32));
     //memcpy(SCF_bases, newbases, numbases*sizeof(uint8));
     {
@@ -1415,7 +1413,7 @@ void SCF::transposeAmbiguityCodes()
 	*ptr='N';
 	break;
       }
-
+      
       case 'x':
 
       case 'r':
@@ -1548,11 +1546,11 @@ uint32 SCF::getPeakIndex(uint32 basepos) const
   return SCF_peak_index[basepos];
 }
 
-void SCF::addComment(const char * comment)
+void SCF::addComment(const char * comment) 
 {
   FUNCSTART("void SCF::addComment(char * newcomment)");
 
-  if(comment==nullptr) return;
+  if(comment==NULL) return;
   uint32 newcomlen=SCF_header.comments_size+static_cast<uint32>(strlen(comment)+1);
 
   char * newcom= new char[newcomlen];
@@ -1567,3 +1565,4 @@ void SCF::addComment(const char * comment)
 
   FUNCEND();
 }
+
diff --git a/src/io/scf.H b/src/io/scf.H
index 6d6f8b5..c7bb799 100644
--- a/src/io/scf.H
+++ b/src/io/scf.H
@@ -1,7 +1,7 @@
 /*
  * Written by Bastien Chevreux (BaCh)
  *
- * See down below in this file for MRC copyright of SCF header
+ * See down below in this file for MRC copyright of SCF header 
  *
  * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
  *   Krebsforschungszentrum, DKFZ) and Bastien Chevreux
@@ -13,26 +13,26 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
-// 	$Id$
+// 	$Id$	
 
 /*
  * SCF routines
  *
  * Written by Bastien Chevreux (BaCh)
- *
+ * 
  * - Can load SCF V2 and V3 files.
  * - Can load (gzip|compress|pack) compressed files.
  * - Handles the deltaed SCF V3 sample traces.
@@ -48,6 +48,11 @@
 #ifndef _scf_h_
 #define _scf_h_
 
+#include <cstdio>
+#include <string.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <sys/types.h>
 
 #ifndef SOLARIS_CLUDGE
 #include <netinet/in.h>
@@ -81,12 +86,13 @@
  */
 
 
-#define SCF_MAGIC (static_cast<uint32>('.')<<24)+(static_cast<uint32>('s')<<16)+(static_cast<uint32>('c')<<8)+(static_cast<uint32>('f'))
-
+#define SCF_MAGIC ((((static_cast<uint32>('.')<<8)+static_cast<uint32>('s')<<8)\
+                     +static_cast<uint32>('c')<<8)+static_cast<uint32>('f'))
 
+    
 // define uncertainty code sets
 #define CSET_DEFAULT 0  /* {A,C,G,T,-} */
-#define CSET_STADEN  1
+#define CSET_STADEN  1 
 #define CSET_NC_IUB  2  /* Pharmacia A.L.F. */
 #define CSET_ALF     3  /* extended NC_IUB */
 #define CSET_ABI     4  /* {A,C,G,T,N} */
@@ -96,7 +102,7 @@
 #define CSET_PCGENE  8  /* IG/PC-Gene */
 #define CSET_GENIE   9  /* MicroGenie */
 
-// define samples to delta_delta values
+// define samples to delta_delta values 
 #define DELTA_IT 1
 
 
@@ -200,14 +206,14 @@ typedef struct{
 } scf_type2;
 
 
-class SCF
+class SCF 
 {
   // Variables
 private:
-  static std::vector<std::string> SCF_suffixalternatives;
+  static vector<string> SCF_suffixalternatives;
 
   char * SCF_tmpfnameforload;
-  std::string SCF_lastloadedscfname;
+  string SCF_lastloadedscfname;
 
 protected:
   // Header, comments and private data are the same in all SCF versions
@@ -230,7 +236,7 @@ protected:
   uint8  * SCF_prob_del;
   char   * SCF_bases;
 
-  //if SCF version <3, then read or write the file with this temporary
+  //if SCF version <3, then read or write the file with this temporary 
   // structure. The struct itself is already here, the arrays must be
   // allocated and deallocated
   scf_type2 SCF_tmp_scf2;
@@ -243,9 +249,11 @@ protected:
 
   //functions
 private:
+  void foolCompiler();
+
   // functions to convert byte order in architectures not
   //  working in the network byte order (e.g. Intel x86)
-  //  on other machines, these functions should automatically
+  //  on other machines, these functions should automatically 
   //  be optimized away by the compiler
   inline void convert4ByteOrderToHost(uint32 *ptr, uint32 num);
   inline void convert2ByteOrderToHost(uint16 *ptr, uint32 num);
@@ -273,8 +281,8 @@ public:
   SCF const & operator=(SCF const & other);
 //  friend ostream & operator<<(ostream &ostr, SCF const &scf);
 
-  int8 load(const char * filename, std::string & emsg);
-  const std::string & getNameOfLastLoadedFile() const { return SCF_lastloadedscfname;}
+  int8 load(const char * filename);
+  const string & getNameOfLastLoadedFile() const { return SCF_lastloadedscfname;} 
   int8 dump();                           //dump an SCF to stdout
   void save(const char * filename);
   void discard();                        // discard the SCF
@@ -288,13 +296,13 @@ public:
   // provide new bases to a file, replace old ones
   //  each base has only one probability, gotta write other functions for multiple
   //  probabilities.
-//  void setBases(      uint32   numbases,
-//		const char   * newbases,
-//		const uint8  * newprobabilities,
+//  void setBases(      uint32   numbases, 
+//		const char   * newbases, 
+//		const uint8  * newprobabilities, 
 //		const uint32 * newpeakpositions);
-  void setBases(const std::string & newbases,
-		const std::vector<uint8> & newprobabilities,
-		const std::vector<uint32> & newpeakpositions);
+  void setBases(const string & newbases, 
+		const vector<uint8> & newprobabilities, 
+		const vector<uint32> & newpeakpositions);
   void addComment(const char * comment);
 
   uint32 getNumBases() const {return SCF_header.bases;};
diff --git a/src/io/so.obo b/src/io/so.obo
deleted file mode 100644
index 501ffa5..0000000
--- a/src/io/so.obo
+++ /dev/null
@@ -1,18725 +0,0 @@
-format-version: 1.2
-date: 24:10:2011 14:42
-saved-by: kareneilbeck
-auto-generated-by: OBO-Edit 2.1-beta10
-subsetdef: biosapiens "biosapiens protein feature ontology"
-subsetdef: DBVAR "database of genomic structural variation"
-subsetdef: SOFA "SO feature annotation"
-synonymtypedef: aa1 "amino acid 1 letter code"
-synonymtypedef: aa3 "amino acid 3 letter code"
-synonymtypedef: AAMOD "amino acid modification"
-synonymtypedef: BS "biosapiens"
-synonymtypedef: dbsnp "dbsnp variant terms"
-synonymtypedef: dbvar "DBVAR"
-synonymtypedef: ebi_variants "ensembl variant terms"
-synonymtypedef: RNAMOD "RNA modification" EXACT
-default-namespace: sequence
-remark: autogenerated-by\:   DAG-Edit version 1.417\nsaved-by\:       eilbeck\ndate\:         Tue May 11 15\:18\:44 PDT 2004\nversion\: $Revision\: 1.45 $
-
-[Term]
-id: SO:0000000
-name: Sequence_Ontology
-subset: SOFA
-is_obsolete: true
-
-[Term]
-id: SO:0000001
-name: region
-def: "A sequence_feature with an extent greater than zero. A nucleotide region is composed of bases and a polypeptide region is composed of amino acids." [SO:ke]
-subset: SOFA
-synonym: "sequence" EXACT []
-is_a: SO:0000110 ! sequence_feature
-
-[Term]
-id: SO:0000002
-name: sequence_secondary_structure
-def: "A folded sequence." [SO:ke]
-synonym: "sequence secondary structure" EXACT []
-is_a: SO:0001411 ! biological_region
-
-[Term]
-id: SO:0000003
-name: G_quartet
-def: "G-quartets are unusual nucleic acid structures consisting of a planar arrangement where each guanine is hydrogen bonded by hoogsteen pairing to another guanine in the quartet." [http://www.ncbi.nlm.nih.gov/pubmed/7919797?dopt=Abstract]
-synonym: "G quartet" EXACT []
-synonym: "G tetrad" EXACT []
-synonym: "G-quadruplex" EXACT []
-synonym: "G-quartet" EXACT []
-synonym: "G-tetrad" EXACT []
-synonym: "G_quadruplex" EXACT []
-synonym: "guanine tetrad" EXACT []
-xref: http://en.wikipedia.org/wiki/G-quadruplex "wiki"
-is_a: SO:0000002 ! sequence_secondary_structure
-
-[Term]
-id: SO:0000004
-name: interior_coding_exon
-subset: SOFA
-synonym: "interior coding exon" EXACT []
-is_a: SO:0000195 ! coding_exon
-
-[Term]
-id: SO:0000005
-name: satellite_DNA
-def: "The many tandem repeats (identical or related) of a short basic repeating unit; many have a base composition or other property different from the genome average that allows them to be separated from the bulk (main band) genomic DNA." [http://www.ebi.ac.uk/embl/Documentation/FT_definitions/feature_table.html]
-subset: SOFA
-synonym: "satellite DNA" EXACT []
-xref: http://en.wikipedia.org/wiki/Satellite_DNA "wiki"
-is_a: SO:0000705 ! tandem_repeat
-
-[Term]
-id: SO:0000006
-name: PCR_product
-def: "A region amplified by a PCR reaction." [SO:ke]
-comment: This term is mapped to MGED. This term is now located in OBI, with the following ID OBI_0000406.
-subset: SOFA
-synonym: "amplicon" RELATED []
-synonym: "PCR product" EXACT []
-xref: http://en.wikipedia.org/wiki/RAPD "wiki"
-is_a: SO:0000695 ! reagent
-
-[Term]
-id: SO:0000007
-name: read_pair
-def: "One of a pair of sequencing reads in which the two members of the pair are related by originating at either end of a clone insert." [SO:ls]
-subset: SOFA
-synonym: "mate pair" EXACT []
-synonym: "read-pair" EXACT []
-is_a: SO:0000150 ! read
-relationship: part_of SO:0000149 ! contig
-relationship: part_of SO:0001790 ! paired_end_fragment
-
-[Term]
-id: SO:0000008
-name: gene_sensu_your_favorite_organism
-is_obsolete: true
-
-[Term]
-id: SO:0000009
-name: gene_class
-is_obsolete: true
-
-[Term]
-id: SO:0000010
-name: protein_coding
-synonym: "protein-coding" EXACT []
-is_a: SO:0000401 ! gene_attribute
-
-[Term]
-id: SO:0000011
-name: non_protein_coding
-synonym: "non protein-coding" EXACT []
-is_a: SO:0000401 ! gene_attribute
-
-[Term]
-id: SO:0000012
-name: scRNA_primary_transcript
-def: "The primary transcript of any one of several small cytoplasmic RNA molecules present in the cytoplasm and sometimes nucleus of a eukaryote." [http://www.ebi.ac.uk/embl/WebFeat/align/scRNA_s.html]
-synonym: "scRNA primary transcript" EXACT []
-synonym: "scRNA transcript" EXACT []
-synonym: "small cytoplasmic RNA" RELATED []
-synonym: "small cytoplasmic RNA transcript" EXACT []
-synonym: "small_cytoplasmic_RNA" RELATED []
-is_a: SO:0000483 ! nc_primary_transcript
-
-[Term]
-id: SO:0000013
-name: scRNA
-def: "A small non coding RNA sequence, present in the cytoplasm." [SO:ke]
-subset: SOFA
-synonym: "small cytoplasmic RNA" EXACT []
-is_a: SO:0000655 ! ncRNA
-relationship: derives_from SO:0000012 ! scRNA_primary_transcript
-
-[Term]
-id: SO:0000014
-name: INR_motif
-def: "A sequence element characteristic of some RNA polymerase II promoters required for the correct positioning of the polymerase for the start of transcription. Overlaps the TSS. The mammalian consensus sequence is YYAN(T|A)YY; the Drosophila consensus sequence is TCA(G|T)t(T|C). In each the A is at position +1 with respect to the TSS. Functionally similar to the TATA box element." [PMID:12651739, PMID:16858867]
-comment: Binds TAF1, TAF2.
-synonym: "DMp2" RELATED []
-synonym: "initiator" EXACT []
-synonym: "initiator motif" EXACT []
-synonym: "INR motif" EXACT []
-is_a: SO:0001660 ! core_promoter_element
-relationship: part_of SO:0001669 ! RNApol_II_core_promoter
-
-[Term]
-id: SO:0000015
-name: DPE_motif
-def: "A sequence element characteristic of some RNA polymerase II promoters; Positioned from +28 to +32 with respect to the TSS (+1). Experimental results suggest that the DPE acts in conjunction with the INR_motif to provide a binding site for TFIID in the absence of a TATA box to mediate transcription of TATA-less promoters. Consensus sequence (A|G)G(A|T)(C|T)(G|A|C)." [PMID:12651739\:12537576, PMID:16858867]
-comment: Binds TAF6, TAF9.
-synonym: "CRWMGCGWKCGCTTS" NARROW []
-synonym: "downstream core promoter element" EXACT []
-synonym: "DPE motif" EXACT []
-is_a: SO:0001660 ! core_promoter_element
-relationship: part_of SO:0001669 ! RNApol_II_core_promoter
-
-[Term]
-id: SO:0000016
-name: BREu_motif
-def: "A sequence element characteristic of some RNA polymerase II promoters, located immediately upstream of some TATA box elements at -37 to -32 with respect to the TSS (+1). Consensus sequence is (G|C)(G|C)(G|A)CGCC. Binds TFIIB." [PMID:12651739, PMID:16858867]
-comment: Binds TFIIB.
-synonym: "B-recognition element" EXACT []
-synonym: "BRE motif" EXACT []
-synonym: "BREu" RELATED []
-synonym: "BREu motif" EXACT []
-synonym: "TFIIB recognition element" RELATED []
-synonym: "transcription factor B-recognition element" EXACT []
-is_a: SO:0001660 ! core_promoter_element
-relationship: part_of SO:0001669 ! RNApol_II_core_promoter
-
-[Term]
-id: SO:0000017
-name: PSE_motif
-def: "A sequence element characteristic of the promoters of snRNA genes transcribed by RNA polymerase II or by RNA polymerase III. Located between -45 and -60 relative to the TSS. The human PSE_motif consensus sequence is TCACCNTNA(C|G)TNAAAAG(T|G)." [PMID:12651739]
-synonym: "proximal sequence element" EXACT []
-synonym: "PSE motif" EXACT []
-is_a: SO:0000713 ! DNA_motif
-relationship: part_of SO:0000167 ! promoter
-
-[Term]
-id: SO:0000018
-name: linkage_group
-def: "A group of loci that can be grouped in a linear order representing the different degrees of linkage among the genes concerned." [ISBN:038752046]
-synonym: "linkage group" EXACT []
-xref: http://en.wikipedia.org/wiki/Linkage_group "wiki"
-is_a: SO:0001411 ! biological_region
-
-[Term]
-id: SO:0000020
-name: RNA_internal_loop
-def: "A region of double stranded RNA where the bases do not conform to WC base pairing. The loop is closed on both sides by canonical base pairing. If the interruption to base pairing occurs on one strand only, it is known as a bulge." [SO:ke]
-synonym: "RNA internal loop" EXACT []
-is_a: SO:0000715 ! RNA_motif
-
-[Term]
-id: SO:0000021
-name: asymmetric_RNA_internal_loop
-def: "An internal RNA loop where one of the strands includes more bases than the corresponding region on the other strand." [SO:ke]
-synonym: "asymmetric RNA internal loop" EXACT []
-is_a: SO:0000020 ! RNA_internal_loop
-
-[Term]
-id: SO:0000022
-name: A_minor_RNA_motif
-def: "A region forming a motif, composed of adenines, where the minor groove edges are inserted into the minor groove of another helix." [SO:ke]
-synonym: "A minor RNA motif" EXACT []
-is_a: SO:0000715 ! RNA_motif
-
-[Term]
-id: SO:0000023
-name: K_turn_RNA_motif
-def: "The kink turn (K-turn) is an RNA structural motif that creates a sharp (~120 degree) bend between two continuous helices." [SO:ke]
-synonym: "K turn RNA motif" EXACT []
-synonym: "K-turn" EXACT []
-synonym: "kink turn" EXACT []
-synonym: "kink-turn motif" EXACT []
-xref: http://en.wikipedia.org/wiki/K-turn "wiki"
-is_a: SO:0000021 ! asymmetric_RNA_internal_loop
-
-[Term]
-id: SO:0000024
-name: sarcin_like_RNA_motif
-def: "A loop in ribosomal RNA containing the sites of attack for ricin and sarcin." [http://www.ncbi.nlm.nih.gov/pubmed/7897662]
-synonym: "sarcin like RNA motif" EXACT []
-synonym: "sarcin/ricin domain" EXACT []
-synonym: "sarcin/ricin loop" EXACT []
-synonym: "sarcin/ricin RNA domain" EXACT []
-is_a: SO:0000021 ! asymmetric_RNA_internal_loop
-
-[Term]
-id: SO:0000025
-name: symmetric_RNA_internal_loop
-def: "An internal RNA loop where the extent of the loop on both stands is the same size." [SO:ke]
-synonym: "A-minor RNA motif" EXACT []
-is_a: SO:0000020 ! RNA_internal_loop
-
-[Term]
-id: SO:0000026
-name: RNA_junction_loop
-synonym: "RNA junction loop" EXACT []
-is_a: SO:0000715 ! RNA_motif
-
-[Term]
-id: SO:0000027
-name: RNA_hook_turn
-synonym: "hook turn" RELATED []
-synonym: "hook-turn motif" EXACT []
-synonym: "RNA hook turn" EXACT []
-is_a: SO:0000026 ! RNA_junction_loop
-
-[Term]
-id: SO:0000028
-name: base_pair
-synonym: "base pair" EXACT []
-xref: http://en.wikipedia.org/wiki/Base_pair "wiki"
-is_a: SO:0000002 ! sequence_secondary_structure
-
-[Term]
-id: SO:0000029
-name: WC_base_pair
-def: "The canonical base pair, where two bases interact via WC edges, with glycosidic bonds oriented cis relative to the axis of orientation." [PMID:12177293]
-synonym: "canonical base pair" EXACT []
-synonym: "Watson Crick base pair" EXACT []
-synonym: "Watson-Crick base pair" RELATED []
-synonym: "Watson-Crick pair" EXACT []
-synonym: "WC base pair" EXACT []
-is_a: SO:0000028 ! base_pair
-
-[Term]
-id: SO:0000030
-name: sugar_edge_base_pair
-def: "A type of non-canonical base-pairing." [PMID:12177293]
-synonym: "sugar edge base pair" EXACT []
-is_a: SO:0000028 ! base_pair
-
-[Term]
-id: SO:0000031
-name: aptamer
-def: "DNA or RNA molecules that have been selected from random pools based on their ability to bind other molecules." [http://aptamer.icmb.utexas.edu]
-xref: http://en.wikipedia.org/wiki/Aptamer "wiki"
-is_a: SO:0000696 ! oligo
-
-[Term]
-id: SO:0000032
-name: DNA_aptamer
-def: "DNA molecules that have been selected from random pools based on their ability to bind other molecules." [http:aptamer.icmb.utexas.edu]
-synonym: "DNA aptamer" EXACT []
-is_a: SO:0000031 ! aptamer
-
-[Term]
-id: SO:0000033
-name: RNA_aptamer
-def: "RNA molecules that have been selected from random pools based on their ability to bind other molecules." [http://aptamer.icmb.utexas.edu]
-synonym: "RNA aptamer" EXACT []
-is_a: SO:0000031 ! aptamer
-
-[Term]
-id: SO:0000034
-name: morpholino_oligo
-def: "Morpholino oligos are synthesized from four different Morpholino subunits, each of which contains one of the four genetic bases (A, C, G, T) linked to a 6-membered morpholine ring. Eighteen to 25 subunits of these four subunit types are joined in a specific order by non-ionic phosphorodiamidate intersubunit linkages to give a Morpholino." [http://www.gene-tools.com/]
-synonym: "morphant" BROAD []
-synonym: "morpholino" EXACT []
-synonym: "morpholino oligo" EXACT []
-is_a: SO:0001247 ! implied link automatically realized ! synthetic_oligo
-intersection_of: SO:0001247 ! synthetic_oligo
-intersection_of: has_quality SO:0001183 ! morpholino_backbone
-
-[Term]
-id: SO:0000035
-name: riboswitch
-def: "A riboswitch is a part of an mRNA that can act as a direct sensor of small molecules to control their own expression. A riboswitch is a cis element in the 5' end of an mRNA, that acts as a direct sensor of metabolites." [PMID:2820954]
-synonym: "riboswitch RNA" EXACT []
-xref: http://en.wikipedia.org/wiki/Riboswitch "wiki"
-is_a: SO:0000836 ! mRNA_region
-relationship: part_of SO:0000234 ! mRNA
-
-[Term]
-id: SO:0000036
-name: matrix_attachment_site
-def: "A DNA region that is required for the binding of chromatin to the nuclear matrix." [SO:ma]
-synonym: "MAR" EXACT []
-synonym: "matrix association region" EXACT []
-synonym: "matrix attachment region" EXACT []
-synonym: "matrix attachment site" EXACT []
-synonym: "nuclear matrix association region" EXACT []
-synonym: "nuclear matrix attachment site" EXACT []
-synonym: "S/MAR" EXACT []
-synonym: "S/MAR element" RELATED []
-synonym: "scaffold attachment site" EXACT []
-synonym: "scaffold matrix attachment region" EXACT []
-synonym: "SMAR" EXACT []
-xref: http://en.wikipedia.org/wiki/Matrix_attachment_site "wiki"
-is_a: SO:0000626 ! chromosomal_regulatory_element
-
-[Term]
-id: SO:0000037
-name: locus_control_region
-def: "A DNA region that includes DNAse hypersensitive sites located 5' to a gene that confers the high-level, position-independent, and copy number-dependent expression to that gene." [SO:ma]
-synonym: "LCR" EXACT []
-synonym: "locus control element" RELATED []
-synonym: "locus control region" EXACT []
-xref: http://en.wikipedia.org/wiki/Locus_control_region "wiki"
-is_a: SO:0000727 ! CRM
-
-[Term]
-id: SO:0000038
-name: match_set
-def: "A collection of match parts." [SO:ke]
-subset: SOFA
-is_obsolete: true
-
-[Term]
-id: SO:0000039
-name: match_part
-def: "A part of a match, for example an hsp from blast is a match_part." [SO:ke]
-subset: SOFA
-synonym: "match part" EXACT []
-is_a: SO:0001410 ! experimental_feature
-relationship: part_of SO:0000343 ! match
-
-[Term]
-id: SO:0000040
-name: genomic_clone
-def: "A clone of a DNA region of a genome." [SO:ma]
-synonym: "genomic clone" EXACT []
-is_a: SO:0000151 ! implied link automatically realized ! clone
-intersection_of: SO:0000151 ! clone
-intersection_of: has_quality SO:0000991 ! genomic_DNA
-
-[Term]
-id: SO:0000041
-name: sequence_operation
-def: "An operation that can be applied to a sequence, that results in a change." [SO:ke]
-synonym: "sequence operation" EXACT []
-is_obsolete: true
-
-[Term]
-id: SO:0000042
-name: pseudogene_attribute
-def: "An attribute of a pseudogene (SO:0000336)." [SO:ma]
-synonym: "pseudogene attribute" EXACT []
-is_obsolete: true
-
-[Term]
-id: SO:0000043
-name: processed_pseudogene
-def: "A pseudogene where by an mRNA was retrotransposed. The mRNA sequence is transcribed back into the genome, lacking introns and promoters, but often including a polyA tail." [SO:xp]
-comment: Please not the synonym R psi M uses the spelled out form of the greek letter.
-synonym: "processed pseudogene" EXACT []
-synonym: "pseudogene by reverse transcription" RELATED []
-synonym: "R psi G" RELATED []
-synonym: "retropseudogene" EXACT []
-is_a: SO:0000336 ! pseudogene
-
-[Term]
-id: SO:0000044
-name: pseudogene_by_unequal_crossing_over
-def: "A pseudogene caused by unequal crossing over at recombination." [SO:ke]
-synonym: "pseudogene by unequal crossing over" EXACT []
-is_a: SO:0001760 ! non_processed_pseudogene
-
-[Term]
-id: SO:0000045
-name: delete
-def: "To remove a subsection of sequence." [SO:ke]
-is_obsolete: true
-
-[Term]
-id: SO:0000046
-name: insert
-def: "To insert a subsection of sequence." [SO:ke]
-is_obsolete: true
-
-[Term]
-id: SO:0000047
-name: invert
-def: "To invert a subsection of sequence." [SO:ke]
-is_obsolete: true
-
-[Term]
-id: SO:0000048
-name: substitute
-def: "To substitute a subsection of sequence for another." [SO:ke]
-is_obsolete: true
-
-[Term]
-id: SO:0000049
-name: translocate
-def: "To translocate a subsection of sequence." [SO:ke]
-is_obsolete: true
-
-[Term]
-id: SO:0000050
-name: gene_part
-def: "A part of a gene, that has no other route in the ontology back to region. This concept is necessary for logical inference as these parts must have the properties of region. It also allows us to associate all the parts of genes with a gene." [SO:ke]
-subset: SOFA
-is_obsolete: true
-
-[Term]
-id: SO:0000051
-name: probe
-def: "A DNA sequence used experimentally to detect the presence or absence of a complementary nucleic acid." [SO:ma]
-xref: http://en.wikipedia.org/wiki/Hybridization_probe "wiki"
-is_a: SO:0000696 ! oligo
-
-[Term]
-id: SO:0000052
-name: assortment_derived_deficiency
-synonym: "assortment-derived_deficiency" RELATED []
-is_obsolete: true
-
-[Term]
-id: SO:0000053
-name: sequence_variant_affecting_regulatory_region
-def: "A sequence_variant_effect which changes the regulatory region of a gene." [SO:ke]
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation affecting regulatory region" RELATED []
-synonym: "sequence variant affecting regulatory region" EXACT []
-is_obsolete: true
-replaced_by: SO:0001556
-
-[Term]
-id: SO:0000054
-name: aneuploid
-def: "A kind of chromosome variation where the chromosome complement is not an exact multiple of the haploid number." [SO:ke]
-xref: http://en.wikipedia.org/wiki/Aneuploid "wiki"
-is_a: SO:1000182 ! chromosome_number_variation
-
-[Term]
-id: SO:0000055
-name: hyperploid
-def: "A kind of chromosome variation where the chromosome complement is not an exact multiple of the haploid number as extra chromosomes are present." [SO:ke]
-xref: http://en.wikipedia.org/wiki/Hyperploid "wiki"
-is_a: SO:0000054 ! aneuploid
-
-[Term]
-id: SO:0000056
-name: hypoploid
-def: "A kind of chromosome variation where the chromosome complement is not an exact multiple of the haploid number as some chromosomes are missing." [SO:ke]
-xref: http://en.wikipedia.org/wiki/Hypoploid "wiki"
-is_a: SO:0000054 ! aneuploid
-
-[Term]
-id: SO:0000057
-name: operator
-def: "A regulatory element of an operon to which activators or repressors bind thereby effecting translation of genes in that operon." [SO:ma]
-subset: SOFA
-synonym: "operator segment" EXACT []
-xref: http://en.wikipedia.org/wiki/Operator_(biology)#Operator "wiki"
-is_a: SO:0000752 ! gene_group_regulatory_region
-
-[Term]
-id: SO:0000058
-name: assortment_derived_aneuploid
-synonym: "assortment-derived_aneuploid" RELATED []
-is_obsolete: true
-
-[Term]
-id: SO:0000059
-name: nuclease_binding_site
-def: "A binding site that, of a nucleotide molecule, that interacts selectively and non-covalently with polypeptide residues of a nuclease." [SO:cb]
-subset: SOFA
-synonym: "nuclease binding site" EXACT []
-is_a: SO:0001654 ! nucleotide_to_protein_binding_site
-
-[Term]
-id: SO:0000060
-name: compound_chromosome_arm
-comment: FLAG - this term is should probably be a part of rather than an is_a.
-synonym: "compound chromosome arm" EXACT []
-is_a: SO:1000042 ! compound_chromosome
-
-[Term]
-id: SO:0000061
-name: restriction_enzyme_binding_site
-def: "A binding site that, in the nucleotide molecule, interacts selectively and non-covalently with polypeptide residues of a restriction enzyme." [SO:cb]
-comment: A region of a molecule that binds to a restriction enzyme.
-synonym: "restriction endonuclease binding site" EXACT []
-synonym: "restriction enzyme binding site" EXACT []
-is_a: SO:0000059 ! nuclease_binding_site
-
-[Term]
-id: SO:0000062
-name: deficient_intrachromosomal_transposition
-def: "An intrachromosomal transposition whereby a translocation in which one of the four broken ends loses a segment before re-joining." [FB:reference_manual]
-synonym: "deficient intrachromosomal transposition" EXACT []
-is_a: SO:1000029 ! implied link automatically realized ! chromosomal_deletion
-is_a: SO:1000041 ! intrachromosomal_transposition
-intersection_of: SO:1000041 ! intrachromosomal_transposition
-intersection_of: has_part SO:0000159 ! deletion
-
-[Term]
-id: SO:0000063
-name: deficient_interchromosomal_transposition
-def: "An interchromosomal transposition whereby a translocation in which one of the four broken ends loses a segment before re-joining." [SO:ke]
-synonym: "deficient interchromosomal transposition" EXACT []
-is_a: SO:1000155 ! interchromosomal_transposition
-
-[Term]
-id: SO:0000064
-name: gene_by_transcript_attribute
-comment: This classes of attributes was added by MA to allow the broad description of genes based on qualities of the transcript(s). A product of SO meeting 2004.
-is_obsolete: true
-
-[Term]
-id: SO:0000065
-name: free_chromosome_arm
-def: "A chromosome structure variation whereby an arm exists as an individual chromosome element." [SO:ke]
-synonym: "free chromosome arm" EXACT []
-is_a: SO:1000183 ! chromosome_structure_variation
-
-[Term]
-id: SO:0000066
-name: gene_by_polyadenylation_attribute
-is_obsolete: true
-
-[Term]
-id: SO:0000067
-name: gene_to_gene_feature
-synonym: "gene to gene feature" EXACT []
-is_a: SO:0000401 ! gene_attribute
-
-[Term]
-id: SO:0000068
-name: overlapping
-def: "An attribute describing a gene that has a sequence that overlaps the sequence of another gene." [SO:ke]
-is_a: SO:0000067 ! gene_to_gene_feature
-
-[Term]
-id: SO:0000069
-name: inside_intron
-def: "An attribute to describe a gene when it is located within the intron of another gene." [SO:ke]
-synonym: "inside intron" EXACT []
-is_a: SO:0000068 ! overlapping
-
-[Term]
-id: SO:0000070
-name: inside_intron_antiparallel
-def: "An attribute to describe a gene when it is located within the intron of another gene and on the opposite strand." [SO:ke]
-synonym: "inside intron antiparallel" EXACT []
-is_a: SO:0000069 ! inside_intron
-
-[Term]
-id: SO:0000071
-name: inside_intron_parallel
-def: "An attribute to describe a gene when it is located within the intron of another gene and on the same strand." [SO:ke]
-synonym: "inside intron parallel" EXACT []
-is_a: SO:0000069 ! inside_intron
-
-[Term]
-id: SO:0000072
-name: end_overlapping_gene
-is_obsolete: true
-
-[Term]
-id: SO:0000073
-name: five_prime_three_prime_overlap
-def: "An attribute to describe a gene when the five prime region overlaps with another gene's 3' region." [SO:ke]
-synonym: "five prime-three prime overlap" EXACT []
-is_a: SO:0000068 ! overlapping
-
-[Term]
-id: SO:0000074
-name: five_prime_five_prime_overlap
-def: "An attribute to describe a gene when the five prime region overlaps with another gene's five prime region." [SO:ke]
-synonym: "five prime-five prime overlap" EXACT []
-is_a: SO:0000068 ! overlapping
-
-[Term]
-id: SO:0000075
-name: three_prime_three_prime_overlap
-def: "An attribute to describe a gene when the 3' region overlaps with another gene's 3' region." [SO:ke]
-synonym: "three prime-three prime overlap" EXACT []
-is_a: SO:0000068 ! overlapping
-
-[Term]
-id: SO:0000076
-name: three_prime_five_prime_overlap
-def: "An attribute to describe a gene when the 3' region overlaps with another gene's 5' region." [SO:ke]
-synonym: "5' 3' overlap" EXACT []
-synonym: "three prime five prime overlap" EXACT []
-is_a: SO:0000068 ! overlapping
-
-[Term]
-id: SO:0000077
-name: antisense
-def: "A region sequence that is complementary to a sequence of messenger RNA." [SO:ke]
-xref: http://en.wikipedia.org/wiki/Antisense "wiki"
-is_a: SO:0000068 ! overlapping
-
-[Term]
-id: SO:0000078
-name: polycistronic_transcript
-def: "A transcript that is polycistronic." [SO:xp]
-synonym: "polycistronic transcript" EXACT []
-is_a: SO:0000673 ! implied link automatically realized ! transcript
-intersection_of: SO:0000673 ! transcript
-intersection_of: has_quality SO:0000880 ! polycistronic
-
-[Term]
-id: SO:0000079
-name: dicistronic_transcript
-def: "A transcript that is dicistronic." [SO:ke]
-synonym: "dicistronic transcript" EXACT []
-is_a: SO:0000078 ! implied link automatically realized ! polycistronic_transcript
-intersection_of: SO:0000673 ! transcript
-intersection_of: has_quality SO:0000879 ! dicistronic
-
-[Term]
-id: SO:0000080
-name: operon_member
-synonym: "operon member" EXACT []
-is_a: SO:0000081 ! gene_array_member
-
-[Term]
-id: SO:0000081
-name: gene_array_member
-synonym: "gene array member" EXACT []
-is_a: SO:0000401 ! gene_attribute
-
-[Term]
-id: SO:0000082
-name: processed_transcript_attribute
-is_obsolete: true
-
-[Term]
-id: SO:0000083
-name: macronuclear_sequence
-synonym: "macronuclear sequence" EXACT []
-is_a: SO:0000736 ! organelle_sequence
-
-[Term]
-id: SO:0000084
-name: micronuclear_sequence
-synonym: "micronuclear sequence" EXACT []
-is_a: SO:0000736 ! organelle_sequence
-
-[Term]
-id: SO:0000085
-name: gene_by_genome_location
-is_obsolete: true
-
-[Term]
-id: SO:0000086
-name: gene_by_organelle_of_genome
-is_obsolete: true
-
-[Term]
-id: SO:0000087
-name: nuclear_gene
-def: "A gene from nuclear sequence." [SO:xp]
-synonym: "nuclear gene" EXACT []
-xref: http://en.wikipedia.org/wiki/Nuclear_gene "wiki"
-is_a: SO:0000704 ! implied link automatically realized ! gene
-intersection_of: SO:0000704 ! gene
-intersection_of: has_origin SO:0000738 ! nuclear_sequence
-
-[Term]
-id: SO:0000088
-name: mt_gene
-def: "A gene located in mitochondrial sequence." [SO:xp]
-synonym: "mitochondrial gene" EXACT []
-synonym: "mt gene" EXACT []
-xref: http://en.wikipedia.org/wiki/Mitochondrial_gene "wiki"
-is_a: SO:0000704 ! implied link automatically realized ! gene
-intersection_of: SO:0000704 ! gene
-intersection_of: has_origin SO:0000737 ! mitochondrial_sequence
-
-[Term]
-id: SO:0000089
-name: kinetoplast_gene
-def: "A gene located in kinetoplast sequence." [SO:xp]
-synonym: "kinetoplast gene" EXACT []
-is_a: SO:0000088 ! implied link automatically realized ! mt_gene
-intersection_of: SO:0000088 ! mt_gene
-intersection_of: has_origin SO:0000741 ! kinetoplast
-
-[Term]
-id: SO:0000090
-name: plastid_gene
-def: "A gene from plastid sequence." [SO:xp]
-synonym: "plastid gene" EXACT []
-is_a: SO:0000704 ! implied link automatically realized ! gene
-intersection_of: SO:0000704 ! gene
-intersection_of: has_origin SO:0000740 ! plastid_sequence
-
-[Term]
-id: SO:0000091
-name: apicoplast_gene
-def: "A gene from apicoplast sequence." [SO:xp]
-synonym: "apicoplast gene" EXACT []
-is_a: SO:0000090 ! implied link automatically realized ! plastid_gene
-intersection_of: SO:0000090 ! plastid_gene
-intersection_of: has_origin SO:0000743 ! apicoplast_sequence
-
-[Term]
-id: SO:0000092
-name: ct_gene
-def: "A gene from chloroplast sequence." [SO:xp]
-synonym: "chloroplast gene" EXACT []
-synonym: "ct gene" EXACT []
-is_a: SO:0000090 ! implied link automatically realized ! plastid_gene
-intersection_of: SO:0000090 ! plastid_gene
-intersection_of: has_origin SO:0000745 ! chloroplast_sequence
-
-[Term]
-id: SO:0000093
-name: chromoplast_gene
-def: "A gene from chromoplast_sequence." [SO:xp]
-synonym: "chromoplast gene" EXACT []
-is_a: SO:0000090 ! implied link automatically realized ! plastid_gene
-intersection_of: SO:0000090 ! plastid_gene
-intersection_of: has_origin SO:0000744 ! chromoplast_sequence
-
-[Term]
-id: SO:0000094
-name: cyanelle_gene
-def: "A gene from cyanelle sequence." [SO:xp]
-synonym: "cyanelle gene" EXACT []
-is_a: SO:0000090 ! implied link automatically realized ! plastid_gene
-intersection_of: SO:0000090 ! plastid_gene
-intersection_of: has_origin SO:0000746 ! cyanelle_sequence
-
-[Term]
-id: SO:0000095
-name: leucoplast_gene
-def: "A plastid gene from leucoplast sequence." [SO:xp]
-synonym: "leucoplast gene" EXACT []
-is_a: SO:0000090 ! implied link automatically realized ! plastid_gene
-intersection_of: SO:0000090 ! plastid_gene
-intersection_of: has_origin SO:0000747 ! leucoplast_sequence
-
-[Term]
-id: SO:0000096
-name: proplastid_gene
-def: "A gene from proplastid sequence." [SO:ke]
-synonym: "proplastid gene" EXACT []
-is_a: SO:0000090 ! implied link automatically realized ! plastid_gene
-intersection_of: SO:0000090 ! plastid_gene
-intersection_of: has_origin SO:0000748 ! proplastid_sequence
-
-[Term]
-id: SO:0000097
-name: nucleomorph_gene
-def: "A gene from nucleomorph sequence." [SO:xp]
-synonym: "nucleomorph gene" EXACT []
-is_a: SO:0000704 ! implied link automatically realized ! gene
-intersection_of: SO:0000704 ! gene
-intersection_of: has_origin SO:0000739 ! nucleomorphic_sequence
-
-[Term]
-id: SO:0000098
-name: plasmid_gene
-def: "A gene from plasmid sequence." [SO:xp]
-synonym: "plasmid gene" EXACT []
-is_a: SO:0000704 ! implied link automatically realized ! gene
-intersection_of: SO:0000704 ! gene
-intersection_of: has_origin SO:0000749 ! plasmid_location
-
-[Term]
-id: SO:0000099
-name: proviral_gene
-def: "A gene from proviral sequence." [SO:xp]
-synonym: "proviral gene" EXACT []
-is_a: SO:0000704 ! implied link automatically realized ! gene
-intersection_of: SO:0000704 ! gene
-intersection_of: has_origin SO:0000751 ! proviral_location
-
-[Term]
-id: SO:0000100
-name: endogenous_retroviral_gene
-def: "A proviral gene with origin endogenous retrovirus." [SO:xp]
-synonym: "endogenous retroviral gene" EXACT []
-is_a: SO:0000099 ! implied link automatically realized ! proviral_gene
-intersection_of: SO:0000099 ! proviral_gene
-intersection_of: has_origin SO:0000903 ! endogenous_retroviral_sequence
-
-[Term]
-id: SO:0000101
-name: transposable_element
-def: "A transposon or insertion sequence. An element that can insert in a variety of DNA sequences." [http://www.sci.sdsu.edu/~smaloy/Glossary/T.html]
-subset: SOFA
-synonym: "transposable element" EXACT []
-synonym: "transposon" EXACT []
-xref: http://en.wikipedia.org/wiki/Transposable_element "wiki"
-is_a: SO:0001039 ! integrated_mobile_genetic_element
-
-[Term]
-id: SO:0000102
-name: expressed_sequence_match
-def: "A match to an EST or cDNA sequence." [SO:ke]
-subset: SOFA
-synonym: "expressed sequence match" EXACT []
-is_a: SO:0000347 ! nucleotide_match
-
-[Term]
-id: SO:0000103
-name: clone_insert_end
-def: "The end of the clone insert." [SO:ke]
-subset: SOFA
-synonym: "clone insert end" EXACT []
-is_a: SO:0000699 ! junction
-relationship: part_of SO:0000753 ! clone_insert
-
-[Term]
-id: SO:0000104
-name: polypeptide
-alt_id: SO:0000358
-def: "A sequence of amino acids linked by peptide bonds which may lack appreciable tertiary structure and may not be liable to irreversible denaturation." [SO:ma]
-comment: This term is mapped to MGED. Do not obsolete without consulting MGED ontology. The term 'protein' was merged with 'polypeptide'. Although 'protein' was a sequence_attribute and therefore meant to describe the quality rather than an actual feature, it was being used erroneously. It is replaced by 'peptidyl' as the polymer attribute.
-subset: SOFA
-synonym: "protein" EXACT []
-xref: http://en.wikipedia.org/wiki/Polypeptide "wiki"
-is_a: SO:0001411 ! biological_region
-relationship: derives_from SO:0000316 ! CDS
-
-[Term]
-id: SO:0000105
-name: chromosome_arm
-def: "A region of the chromosome between the centromere and the telomere. Human chromosomes have two arms, the p arm (short) and the q arm (long) which are separated from each other by the centromere." [http://www.medterms.com/script/main/art.asp?articlekey=5152]
-synonym: "chromosome arm" EXACT []
-is_a: SO:0000830 ! chromosome_part
-
-[Term]
-id: SO:0000106
-name: non_capped_primary_transcript
-is_obsolete: true
-
-[Term]
-id: SO:0000107
-name: sequencing_primer
-synonym: "sequencing primer" EXACT []
-is_a: SO:0000112 ! primer
-
-[Term]
-id: SO:0000108
-name: mRNA_with_frameshift
-def: "An mRNA with a frameshift." [SO:xp]
-synonym: "frameshifted mRNA" EXACT []
-synonym: "mRNA with frameshift" EXACT []
-is_a: SO:0000234 ! implied link automatically realized ! mRNA
-intersection_of: SO:0000234 ! mRNA
-intersection_of: has_quality SO:0000865 ! frameshift
-
-[Term]
-id: SO:0000109
-name: sequence_variant_obs
-def: "A sequence_variant is a non exact copy of a sequence_feature or genome exhibiting one or more sequence_alteration." [SO:ke]
-subset: SOFA
-synonym: "mutation" RELATED []
-is_obsolete: true
-
-[Term]
-id: SO:0000110
-name: sequence_feature
-def: "An extent of biological sequence." [SO:ke]
-subset: SOFA
-synonym: "located sequence feature" RELATED []
-synonym: "located_sequence_feature" EXACT []
-synonym: "sequence feature" EXACT []
-disjoint_from: SO:0000400 ! sequence_attribute
-
-[Term]
-id: SO:0000111
-name: transposable_element_gene
-def: "A gene encoded within a transposable element. For example gag, int, env and pol are the transposable element genes of the TY element in yeast." [SO:ke]
-synonym: "transposable element gene" EXACT []
-is_a: SO:0000704 ! implied link automatically realized ! gene
-intersection_of: SO:0000704 ! gene
-intersection_of: part_of SO:0000101 ! transposable_element
-relationship: part_of SO:0000101 ! transposable_element
-
-[Term]
-id: SO:0000112
-name: primer
-def: "An oligo to which new deoxyribonucleotides can be added by DNA polymerase." [SO:ke]
-subset: SOFA
-synonym: "DNA primer" EXACT []
-synonym: "primer oligonucleotide" EXACT []
-synonym: "primer polynucleotide" EXACT []
-synonym: "primer sequence" EXACT []
-xref: http://en.wikipedia.org/wiki/Primer_(molecular_biology) "wiki"
-is_a: SO:0000441 ! ss_oligo
-
-[Term]
-id: SO:0000113
-name: proviral_region
-def: "A viral sequence which has integrated into a host genome." [SO:ke]
-subset: SOFA
-synonym: "proviral region" EXACT []
-synonym: "proviral sequence" RELATED []
-is_a: SO:0001039 ! integrated_mobile_genetic_element
-
-[Term]
-id: SO:0000114
-name: methylated_C
-def: "A methylated deoxy-cytosine." [SO:ke]
-subset: SOFA
-synonym: "methylated C" EXACT []
-synonym: "methylated cytosine" EXACT []
-synonym: "methylated cytosine base" EXACT []
-synonym: "methylated cytosine residue" EXACT []
-is_a: SO:0000306 ! methylated_base_feature
-
-[Term]
-id: SO:0000115
-name: transcript_feature
-is_obsolete: true
-
-[Term]
-id: SO:0000116
-name: edited
-def: "An attribute describing a sequence that is modified by editing." [SO:ke]
-is_a: SO:0000237 ! transcript_attribute
-
-[Term]
-id: SO:0000117
-name: transcript_with_readthrough_stop_codon
-is_obsolete: true
-
-[Term]
-id: SO:0000118
-name: transcript_with_translational_frameshift
-def: "A transcript with a translational frameshift." [SO:xp]
-synonym: "transcript with translational frameshift" EXACT []
-is_a: SO:0000673 ! implied link automatically realized ! transcript
-intersection_of: SO:0000673 ! transcript
-intersection_of: has_quality SO:0000887 ! translationally_frameshifted
-
-[Term]
-id: SO:0000119
-name: regulated
-def: "An attribute to describe a sequence that is regulated." [SO:ke]
-is_a: SO:0000401 ! gene_attribute
-
-[Term]
-id: SO:0000120
-name: protein_coding_primary_transcript
-def: "A primary transcript that, at least in part, encodes one or more proteins." [SO:ke]
-comment: May contain introns.
-subset: SOFA
-synonym: "pre mRNA" RELATED []
-synonym: "protein coding primary transcript" EXACT []
-is_a: SO:0000185 ! primary_transcript
-
-[Term]
-id: SO:0000121
-name: forward_primer
-def: "A single stranded oligo used for polymerase chain reaction." [http://mged.sourceforge.net/ontologies/MGEDontology.php]
-comment: This term is mapped to MGED. Do not obsolete without consulting MGED ontology.
-synonym: "DNA forward primer" EXACT []
-synonym: "forward DNA primer" EXACT []
-synonym: "forward primer" EXACT []
-synonym: "forward primer oligo" EXACT []
-synonym: "forward primer oligonucleotide" EXACT []
-synonym: "forward primer polynucleotide" EXACT []
-synonym: "forward primer sequence" EXACT []
-is_a: SO:0000112 ! implied link automatically realized ! primer
-intersection_of: SO:0000112 ! primer
-intersection_of: has_quality SO:0001030 ! forward
-
-[Term]
-id: SO:0000122
-name: RNA_sequence_secondary_structure
-def: "A folded RNA sequence." [SO:ke]
-synonym: "RNA sequence secondary structure" EXACT []
-is_a: SO:0000002 ! sequence_secondary_structure
-
-[Term]
-id: SO:0000123
-name: transcriptionally_regulated
-def: "An attribute describing a gene that is regulated at transcription." [SO:ma]
-comment: By:<protein_id>.
-synonym: "transcriptionally regulated" EXACT []
-is_a: SO:0000119 ! regulated
-
-[Term]
-id: SO:0000124
-name: transcriptionally_constitutive
-def: "Expressed in relatively constant amounts without regard to cellular environmental conditions such as the concentration of a particular substrate." [SO:ke]
-synonym: "transcriptionally constitutive" EXACT []
-is_a: SO:0000123 ! transcriptionally_regulated
-
-[Term]
-id: SO:0000125
-name: transcriptionally_induced
-def: "An inducer molecule is required for transcription to occur." [SO:ke]
-synonym: "transcriptionally induced" EXACT []
-is_a: SO:0000123 ! transcriptionally_regulated
-
-[Term]
-id: SO:0000126
-name: transcriptionally_repressed
-def: "A repressor molecule is required for transcription to stop." [SO:ke]
-synonym: "transcriptionally repressed" EXACT []
-is_a: SO:0000123 ! transcriptionally_regulated
-
-[Term]
-id: SO:0000127
-name: silenced_gene
-def: "A gene that is silenced." [SO:xp]
-synonym: "silenced gene" EXACT []
-is_a: SO:0000704 ! implied link automatically realized ! gene
-intersection_of: SO:0000704 ! gene
-intersection_of: has_quality SO:0000893 ! silenced
-
-[Term]
-id: SO:0000128
-name: gene_silenced_by_DNA_modification
-def: "A gene that is silenced by DNA modification." [SO:xp]
-synonym: "gene silenced by DNA modification" EXACT []
-is_a: SO:0000127 ! implied link automatically realized ! silenced_gene
-intersection_of: SO:0000704 ! gene
-intersection_of: has_quality SO:0000894 ! silenced_by_DNA_modification
-
-[Term]
-id: SO:0000129
-name: gene_silenced_by_DNA_methylation
-def: "A gene that is silenced by DNA methylation." [SO:xp]
-synonym: "gene silenced by DNA methylation" EXACT []
-synonym: "methylation-silenced gene" EXACT []
-is_a: SO:0000128 ! implied link automatically realized ! gene_silenced_by_DNA_modification
-intersection_of: SO:0000128 ! gene_silenced_by_DNA_modification
-intersection_of: has_quality SO:0000895 ! silenced_by_DNA_methylation
-
-[Term]
-id: SO:0000130
-name: post_translationally_regulated
-def: "An attribute describing a gene that is regulated after it has been translated." [SO:ke]
-synonym: "post translationally regulated" EXACT []
-synonym: "post-translationally regulated" EXACT []
-is_a: SO:0000119 ! regulated
-
-[Term]
-id: SO:0000131
-name: translationally_regulated
-def: "An attribute describing a gene that is regulated as it is translated." [SO:ke]
-synonym: "translationally regulated" EXACT []
-is_a: SO:0000119 ! regulated
-
-[Term]
-id: SO:0000132
-name: reverse_primer
-def: "A single stranded oligo used for polymerase chain reaction." [http://mged.sourceforge.net/ontologies/MGEDontology.php]
-comment: This term is mapped to MGED. Do not obsolete without consulting MGED ontology.
-synonym: "DNA reverse primer" EXACT []
-synonym: "reverse DNA primer" EXACT []
-synonym: "reverse primer" EXACT []
-synonym: "reverse primer oligo" EXACT []
-synonym: "reverse primer oligonucleotide" EXACT []
-synonym: "reverse primer sequence" EXACT []
-is_a: SO:0000112 ! implied link automatically realized ! primer
-intersection_of: SO:0000112 ! primer
-intersection_of: has_quality SO:0001031 ! reverse
-
-[Term]
-id: SO:0000133
-name: epigenetically_modified
-def: "This attribute describes a gene where heritable changes other than those in the DNA sequence occur. These changes include: modification to the DNA (such as DNA methylation, the covalent modification of cytosine), and post-translational modification of histones." [SO:ke]
-synonym: "epigenetically modified" EXACT []
-is_a: SO:0000401 ! gene_attribute
-
-[Term]
-id: SO:0000134
-name: imprinted
-def: "Imprinted genes are epigenetically modified genes that are expressed monoallelically according to their parent of origin." [SO:ke]
-xref: http:http\://en.wikipedia.org/wiki/Genomic_imprinting "wiki"
-is_a: SO:0000119 ! regulated
-is_a: SO:0000133 ! epigenetically_modified
-
-[Term]
-id: SO:0000135
-name: maternally_imprinted
-def: "The maternal copy of the gene is modified, rendering it transcriptionally silent." [SO:ke]
-synonym: "maternally imprinted" EXACT []
-is_a: SO:0000134 ! imprinted
-
-[Term]
-id: SO:0000136
-name: paternally_imprinted
-def: "The paternal copy of the gene is modified, rendering it transcriptionally silent." [SO:ke]
-synonym: "paternally imprinted" EXACT []
-is_a: SO:0000134 ! imprinted
-
-[Term]
-id: SO:0000137
-name: allelically_excluded
-def: "Allelic exclusion is a process occurring in diploid organisms, where a gene is inactivated and not expressed in that cell." [SO:ke]
-comment: Examples are x-inactivation and immunoglobulin formation.
-synonym: "allelically excluded" EXACT []
-is_a: SO:0000133 ! epigenetically_modified
-
-[Term]
-id: SO:0000138
-name: gene_rearranged_at_DNA_level
-def: "An epigenetically modified gene, rearranged at the DNA level." [SO:xp]
-synonym: "gene rearranged at DNA level" EXACT []
-is_a: SO:0000898 ! implied link automatically realized ! epigenetically_modified_gene
-intersection_of: SO:0000898 ! epigenetically_modified_gene
-intersection_of: has_quality SO:0000904 ! rearranged_at_DNA_level
-
-[Term]
-id: SO:0000139
-name: ribosome_entry_site
-def: "Region in mRNA where ribosome assembles." [SO:ke]
-subset: SOFA
-synonym: "ribosome entry site" EXACT []
-is_a: SO:0000836 ! mRNA_region
-
-[Term]
-id: SO:0000140
-name: attenuator
-def: "A sequence segment located within the five prime end of an mRNA that causes premature termination of translation." [SO:as]
-subset: SOFA
-synonym: "attenuator sequence" EXACT []
-xref: http://en.wikipedia.org/wiki/Attenuator "wiki"
-is_a: SO:0001680 ! translation_regulatory_region
-relationship: part_of SO:0000234 ! mRNA
-
-[Term]
-id: SO:0000141
-name: terminator
-def: "The sequence of DNA located either at the end of the transcript that causes RNA polymerase to terminate transcription." [http://www.ebi.ac.uk/embl/Documentation/FT_definitions/feature_table.html]
-subset: SOFA
-synonym: "terminator sequence" EXACT []
-xref: http://en.wikipedia.org/wiki/Terminator_(genetics) "wiki"
-is_a: SO:0001679 ! transcription_regulatory_region
-relationship: part_of SO:0000673 ! transcript
-
-[Term]
-id: SO:0000142
-name: DNA_sequence_secondary_structure
-def: "A folded DNA sequence." [SO:ke]
-synonym: "DNA sequence secondary structure" EXACT []
-is_a: SO:0000002 ! sequence_secondary_structure
-
-[Term]
-id: SO:0000143
-name: assembly_component
-def: "A region of known length which may be used to manufacture a longer region." [SO:ke]
-subset: SOFA
-synonym: "assembly component" EXACT []
-is_a: SO:0001410 ! experimental_feature
-
-[Term]
-id: SO:0000144
-name: primary_transcript_attribute
-is_obsolete: true
-
-[Term]
-id: SO:0000145
-name: recoded_codon
-def: "A codon that has been redefined at translation. The redefinition may be as a result of translational bypass, translational frameshifting or stop codon readthrough." [SO:xp]
-synonym: "recoded codon" EXACT []
-is_a: SO:0000360 ! codon
-
-[Term]
-id: SO:0000146
-name: capped
-def: "An attribute describing when a sequence, usually an mRNA is capped by the addition of a modified guanine nucleotide at the 5' end." [SO:ke]
-is_a: SO:0000237 ! transcript_attribute
-
-[Term]
-id: SO:0000147
-name: exon
-def: "A region of the transcript sequence within a gene which is not removed from the primary RNA transcript by RNA splicing." [SO:ke]
-comment: This term is mapped to MGED. Do not obsolete without consulting MGED ontology.
-subset: SOFA
-xref: http://en.wikipedia.org/wiki/Exon "wiki"
-is_a: SO:0000833 ! transcript_region
-
-[Term]
-id: SO:0000148
-name: supercontig
-def: "One or more contigs that have been ordered and oriented using end-read information. Contains gaps that are filled with N's." [SO:ls]
-subset: SOFA
-synonym: "scaffold" RELATED []
-is_a: SO:0000353 ! sequence_assembly
-relationship: part_of SO:0000719 ! ultracontig
-
-[Term]
-id: SO:0000149
-name: contig
-def: "A contiguous sequence derived from sequence assembly. Has no gaps, but may contain N's from unavailable bases." [SO:ls]
-subset: SOFA
-xref: http://en.wikipedia.org/wiki/Contig "wiki"
-is_a: SO:0000143 ! assembly_component
-is_a: SO:0000353 ! sequence_assembly
-relationship: part_of SO:0000148 ! supercontig
-
-[Term]
-id: SO:0000150
-name: read
-def: "A sequence obtained from a single sequencing experiment. Typically a read is produced when a base calling program interprets information from a chromatogram trace file produced from a sequencing machine." [SO:rd]
-subset: SOFA
-is_a: SO:0000143 ! assembly_component
-relationship: part_of SO:0000149 ! contig
-
-[Term]
-id: SO:0000151
-name: clone
-def: "A piece of DNA that has been inserted in a vector so that it can be propagated in a host bacterium or some other organism." [SO:ke]
-subset: SOFA
-xref: http:http\://en.wikipedia.org/wiki/Clone_(genetics) "wiki"
-is_a: SO:0000695 ! reagent
-
-[Term]
-id: SO:0000152
-name: YAC
-def: "Yeast Artificial Chromosome, a vector constructed from the telomeric, centromeric, and replication origin sequences needed for replication in yeast cells." [SO:ma]
-comment: This term is mapped to MGED. Do not obsolete without consulting MGED ontology.
-synonym: "yeast artificial chromosome" EXACT []
-is_a: SO:0000440 ! vector_replicon
-
-[Term]
-id: SO:0000153
-name: BAC
-def: "Bacterial Artificial Chromosome, a cloning vector that can be propagated as mini-chromosomes in a bacterial host." [SO:ma]
-comment: This term is mapped to MGED. Do not obsolete without consulting MGED ontology.
-synonym: "bacterial artificial chromosome" EXACT []
-is_a: SO:0000440 ! vector_replicon
-
-[Term]
-id: SO:0000154
-name: PAC
-def: "The P1-derived artificial chromosome are DNA constructs that are derived from the DNA of P1 bacteriophage. They can carry large amounts (about 100-300 kilobases) of other sequences for a variety of bioengineering purposes. It is one type of vector used to clone DNA fragments (100- to 300-kb insert size; average, 150 kb) in Escherichia coli cells." [http://en.wikipedia.org/wiki/P1-derived_artificial_chromosome]
-comment: This term is mapped to MGED. Do not obsolete without consulting MGED ontology. Drosophila melanogaster PACs carry an average insert size of 80 kb. The library represents a 6-fold coverage of the genome.
-synonym: "P1" EXACT []
-synonym: "P1 artificial chromosome" EXACT []
-xref: http://en.wikipedia.org/wiki/P1-derived_artificial_chromosome "wiki"
-is_a: SO:0000440 ! vector_replicon
-
-[Term]
-id: SO:0000155
-name: plasmid
-def: "A self replicating, using the hosts cellular machinery, often circular nucleic acid molecule that is distinct from a chromosome in the organism." [SO:ma]
-comment: This term is mapped to MGED. Do not obsolete without consulting MGED ontology.
-synonym: "plasmid sequence" EXACT []
-is_a: SO:0001235 ! replicon
-
-[Term]
-id: SO:0000156
-name: cosmid
-def: "A cloning vector that is a hybrid of lambda phages and a plasmid that can be propagated as a plasmid or packaged as a phage,since they retain the lambda cos sites." [SO:ma]
-comment: Paper: vans GA et al. High efficiency vectors for cosmid microcloning and genomic analysis. Gene 1989; 79(1):9-20. This term is mapped to MGED. Do not obsolete without consulting MGED ontology.
-synonym: "cosmid vector" EXACT []
-xref: http://en.wikipedia.org/wiki/Cosmid "wiki"
-is_a: SO:0000440 ! vector_replicon
-
-[Term]
-id: SO:0000157
-name: phagemid
-def: "A plasmid which carries within its sequence a bacteriophage replication origin. When the host bacterium is infected with \"helper\" phage, a phagemid is replicated along with the phage DNA and packaged into phage capsids." [SO:ma]
-synonym: "phagemid vector" RELATED []
-xref: http://en.wikipedia.org/wiki/Phagemid "wiki"
-is_a: SO:0000440 ! vector_replicon
-
-[Term]
-id: SO:0000158
-name: fosmid
-def: "A cloning vector that utilizes the E. coli F factor." [SO:ma]
-comment: Birren BW et al. A human chromosome 22 fosmid resource: mapping and analysis of 96 clones. Genomics 1996.
-synonym: "fosmid vector" RELATED []
-xref: http://en.wikipedia.org/wiki/Fosmid "wiki"
-is_a: SO:0000440 ! vector_replicon
-
-[Term]
-id: SO:0000159
-name: deletion
-alt_id: SO:1000033
-def: "The point at which one or more contiguous nucleotides were excised." [SO:ke]
-subset: SOFA
-synonym: "deleted_sequence" EXACT []
-synonym: "nucleotide deletion" EXACT []
-synonym: "nucleotide_deletion" EXACT []
-xref: http://en.wikipedia.org/wiki/Nucleotide_deletion "wiki"
-is_a: SO:0001059 ! sequence_alteration
-is_a: SO:0001411 ! biological_region
-
-[Term]
-id: SO:0000160
-name: lambda_clone
-def: "A linear clone derived from lambda bacteriophage. The genes involved in the lysogenic pathway are removed from the from the viral DNA. Up to 25 kb of foreign DNA can then be inserted into the lambda genome." [ISBN:0-1767-2380-8]
-is_obsolete: true
-
-[Term]
-id: SO:0000161
-name: methylated_A
-def: "A modified RNA base in which adenine has been methylated." [SO:ke]
-subset: SOFA
-synonym: "methylated A" EXACT []
-synonym: "methylated adenine" EXACT []
-synonym: "methylated adenine base" EXACT []
-synonym: "methylated adenine residue" EXACT []
-is_a: SO:0000306 ! methylated_base_feature
-
-[Term]
-id: SO:0000162
-name: splice_site
-def: "Consensus region of primary transcript bordering junction of splicing. A region that overlaps exactly 2 base and adjacent_to splice_junction." [SO:cjm, SO:ke]
-comment: With spliceosomal introns, the splice sites bind the spliceosomal machinery.
-subset: SOFA
-synonym: "splice site" EXACT []
-xref: http://en.wikipedia.org/wiki/Splice_site "wiki"
-is_a: SO:0000835 ! primary_transcript_region
-
-[Term]
-id: SO:0000163
-name: five_prime_cis_splice_site
-def: "Intronic 2 bp region bordering the exon, at the 5' edge of the intron. A splice_site that is downstream_adjacent_to exon and starts intron." [http://www.ucl.ac.uk/~ucbhjow/b241/glossary.html, SO:cjm, SO:ke]
-subset: SOFA
-synonym: "5' splice site" EXACT []
-synonym: "donor" RELATED []
-synonym: "donor splice site" EXACT []
-synonym: "five prime splice site" EXACT []
-synonym: "splice donor site" EXACT []
-is_a: SO:0001419 ! cis_splice_site
-
-[Term]
-id: SO:0000164
-name: three_prime_cis_splice_site
-def: "Intronic 2 bp region bordering the exon, at the 3' edge of the intron. A splice_site that is upstream_adjacent_to exon and finishes intron." [http://www.ucl.ac.uk/~ucbhjow/b241/glossary.html, SO:cjm, SO:ke]
-subset: SOFA
-synonym: "3' splice site" RELATED []
-synonym: "acceptor" RELATED []
-synonym: "acceptor splice site" EXACT []
-synonym: "splice acceptor site" EXACT []
-synonym: "three prime splice site" EXACT []
-is_a: SO:0001419 ! cis_splice_site
-
-[Term]
-id: SO:0000165
-name: enhancer
-def: "A cis-acting sequence that increases the utilization of (some) eukaryotic promoters, and can function in either orientation and in any location (upstream or downstream) relative to the promoter." [http://www.ebi.ac.uk/embl/Documentation/FT_definitions/feature_table.html]
-comment: An enhancer may participate in an enhanceosome GO:0034206. A protein-DNA complex formed by the association of a distinct set of general and specific transcription factors with a region of enhancer DNA. The cooperative assembly of an enhanceosome confers specificity of transcriptional regulation. This comment is a place holder should we start to make cross products with GO.
-subset: SOFA
-xref: http://en.wikipedia.org/wiki/Enhancer_(genetics) "wiki"
-is_a: SO:0000727 ! CRM
-
-[Term]
-id: SO:0000166
-name: enhancer_bound_by_factor
-def: "An enhancer bound by a factor." [SO:xp]
-synonym: "enhancer bound by factor" EXACT []
-is_a: SO:0000165 ! implied link automatically realized ! enhancer
-intersection_of: SO:0000165 ! enhancer
-intersection_of: has_quality SO:0000277 ! bound_by_factor
-
-[Term]
-id: SO:0000167
-name: promoter
-def: "A regulatory_region composed of the TSS(s) and binding sites for TF_complexes of the basal transcription machinery." [SO:regcreative]
-comment: This term is mapped to MGED. Do not obsolete without consulting MGED ontology. The region on a DNA molecule involved in RNA polymerase binding to initiate transcription.
-subset: SOFA
-synonym: "promoter sequence" EXACT []
-xref: http://en.wikipedia.org/wiki/Promoter "wiki"
-is_a: SO:0001055 ! transcriptional_cis_regulatory_region
-
-[Term]
-id: SO:0000168
-name: restriction_enzyme_cut_site
-def: "A specific nucleotide sequence of DNA at or near which a particular restriction enzyme cuts the DNA." [SO:ma]
-is_obsolete: true
-
-[Term]
-id: SO:0000169
-name: RNApol_I_promoter
-def: "A DNA sequence in eukaryotic DNA to which RNA polymerase I binds, to begin transcription." [SO:ke]
-synonym: "pol I promoter" EXACT []
-synonym: "polymerase I promoter" EXACT []
-synonym: "RNA polymerase A promoter" EXACT []
-synonym: "RNApol I promoter" EXACT []
-is_a: SO:0001203 ! RNA_polymerase_promoter
-
-[Term]
-id: SO:0000170
-name: RNApol_II_promoter
-def: "A DNA sequence in eukaryotic DNA to which RNA polymerase II binds, to begin transcription." [SO:ke]
-synonym: "pol II promoter" RELATED []
-synonym: "polymerase II promoter" EXACT []
-synonym: "RNA polymerase B promoter" EXACT []
-synonym: "RNApol II promoter" EXACT []
-is_a: SO:0001203 ! RNA_polymerase_promoter
-
-[Term]
-id: SO:0000171
-name: RNApol_III_promoter
-def: "A DNA sequence in eukaryotic DNA to which RNA polymerase III binds, to begin transcription." [SO:ke]
-synonym: "pol III promoter" EXACT []
-synonym: "polymerase III promoter" EXACT []
-synonym: "RNA polymerase C promoter" EXACT []
-synonym: "RNApol III promoter" EXACT []
-is_a: SO:0001203 ! RNA_polymerase_promoter
-
-[Term]
-id: SO:0000172
-name: CAAT_signal
-def: "Part of a conserved sequence located about 75-bp upstream of the start point of eukaryotic transcription units which may be involved in RNA polymerase binding; consensus=GG(C|T)CAATCT." [http://www.ebi.ac.uk/embl/Documentation/FT_definitions/feature_table.html]
-synonym: "CAAT box" EXACT []
-synonym: "CAAT signal" EXACT []
-synonym: "CAAT-box" EXACT []
-xref: http://en.wikipedia.org/wiki/CAAT_box "wiki"
-is_a: SO:0000713 ! DNA_motif
-relationship: part_of SO:0000170 ! RNApol_II_promoter
-
-[Term]
-id: SO:0000173
-name: GC_rich_promoter_region
-def: "A conserved GC-rich region located upstream of the start point of eukaryotic transcription units which may occur in multiple copies or in either orientation; consensus=GGGCGG." [http://www.ebi.ac.uk/embl/Documentation/FT_definitions/feature_table.html]
-synonym: "GC rich promoter region" EXACT []
-synonym: "GC-rich region" EXACT []
-is_a: SO:0001659 ! promoter_element
-relationship: part_of SO:0000170 ! RNApol_II_promoter
-
-[Term]
-id: SO:0000174
-name: TATA_box
-def: "A conserved AT-rich septamer found about 25-bp before the start point of many eukaryotic RNA polymerase II transcript units; may be involved in positioning the enzyme for correct initiation; consensus=TATA(A|T)A(A|T)." [http://www.ebi.ac.uk/embl/Documentation/FT_definitions/feature_table.html, PMID:16858867]
-comment: Binds TBP.
-synonym: "Goldstein-Hogness box" EXACT []
-synonym: "TATA box" EXACT []
-xref: http://en.wikipedia.org/wiki/TATA_box "wiki"
-is_a: SO:0001660 ! core_promoter_element
-
-[Term]
-id: SO:0000175
-name: minus_10_signal
-def: "A conserved region about 10-bp upstream of the start point of bacterial transcription units which may be involved in binding RNA polymerase; consensus=TAtAaT. This region is associated with sigma factor 70." [http://www.ebi.ac.uk/embl/Documentation/FT_definitions/feature_table.html]
-synonym: "-10 signal" EXACT []
-synonym: "minus 10 signal" EXACT []
-synonym: "Pribnow box" EXACT []
-synonym: "Pribnow Schaller box" EXACT []
-synonym: "Pribnow-Schaller box" EXACT []
-xref: http://en.wikipedia.org/wiki/Pribnow_box "wiki"
-is_a: SO:0000713 ! DNA_motif
-relationship: part_of SO:0001671 ! bacterial_RNApol_promoter_sigma_70
-
-[Term]
-id: SO:0000176
-name: minus_35_signal
-def: "A conserved hexamer about 35-bp upstream of the start point of bacterial transcription units; consensus=TTGACa or TGTTGACA. This region is associated with sigma factor 70." [http://www.ebi.ac.uk/embl/Documentation/FT_definitions/feature_table.html]
-synonym: "-35 signal" EXACT []
-synonym: "minus 35 signal" EXACT []
-is_a: SO:0000713 ! DNA_motif
-relationship: part_of SO:0001671 ! bacterial_RNApol_promoter_sigma_70
-
-[Term]
-id: SO:0000177
-name: cross_genome_match
-def: "A nucleotide match against a sequence from another organism." [SO:ma]
-subset: SOFA
-synonym: "cross genome match" EXACT []
-is_a: SO:0000347 ! nucleotide_match
-
-[Term]
-id: SO:0000178
-name: operon
-def: "A group of contiguous genes transcribed as a single (polycistronic) mRNA from a single regulatory region." [SO:ma]
-comment: This term is mapped to MGED. Do not obsolete without consulting MGED ontology.
-subset: SOFA
-xref: http://en.wikipedia.org/wiki/Operon "wiki"
-is_a: SO:0005855 ! gene_group
-
-[Term]
-id: SO:0000179
-name: clone_insert_start
-def: "The start of the clone insert." [SO:ke]
-subset: SOFA
-synonym: "clone insert start" EXACT []
-is_a: SO:0000699 ! junction
-relationship: part_of SO:0000753 ! clone_insert
-
-[Term]
-id: SO:0000180
-name: retrotransposon
-def: "A transposable element that is incorporated into a chromosome by a mechanism that requires reverse transcriptase." [http://www.dddmag.com/Glossary.aspx#r]
-synonym: "class I" RELATED []
-synonym: "class I transposon" EXACT []
-synonym: "retrotransposon element" EXACT []
-xref: http://en.wikipedia.org/wiki/Retrotransposon "wiki"
-is_a: SO:0000101 ! transposable_element
-
-[Term]
-id: SO:0000181
-name: translated_nucleotide_match
-def: "A match against a translated sequence." [SO:ke]
-subset: SOFA
-synonym: "translated nucleotide match" EXACT []
-is_a: SO:0000347 ! nucleotide_match
-
-[Term]
-id: SO:0000182
-name: DNA_transposon
-def: "A transposon where the mechanism of transposition is via a DNA intermediate." [SO:ke]
-synonym: "class II" RELATED []
-synonym: "class II transposon" EXACT []
-synonym: "DNA transposon" EXACT []
-is_a: SO:0000101 ! transposable_element
-
-[Term]
-id: SO:0000183
-name: non_transcribed_region
-def: "A region of the gene which is not transcribed." [SO:ke]
-subset: SOFA
-synonym: "non transcribed region" EXACT []
-synonym: "non-transcribed sequence" EXACT []
-synonym: "nontranscribed region" EXACT []
-synonym: "nontranscribed sequence" EXACT []
-is_a: SO:0000842 ! gene_component_region
-
-[Term]
-id: SO:0000184
-name: U2_intron
-def: "A major type of spliceosomal intron spliced by the U2 spliceosome, that includes U1, U2, U4/U6 and U5 snRNAs." [PMID:9428511]
-comment: May have either GT-AG or AT-AG 5' and 3' boundaries.
-synonym: "U2 intron" EXACT []
-is_a: SO:0000662 ! spliceosomal_intron
-
-[Term]
-id: SO:0000185
-name: primary_transcript
-def: "A transcript that in its initial state requires modification to be functional." [SO:ma]
-subset: SOFA
-synonym: "precursor RNA" EXACT []
-synonym: "primary transcript" EXACT []
-xref: http://en.wikipedia.org/wiki/Primary_transcript "wiki"
-is_a: SO:0000673 ! transcript
-
-[Term]
-id: SO:0000186
-name: LTR_retrotransposon
-def: "A retrotransposon flanked by long terminal repeat sequences." [SO:ke]
-synonym: "long terminal repeat retrotransposon" EXACT []
-synonym: "LTR retrotransposon" EXACT []
-is_a: SO:0000180 ! retrotransposon
-
-[Term]
-id: SO:0000187
-name: repeat_family
-def: "A group of characterized repeat sequences." [SO:ke]
-subset: SOFA
-is_obsolete: true
-
-[Term]
-id: SO:0000188
-name: intron
-def: "A region of a primary transcript that is transcribed, but removed from within the transcript by splicing together the sequences (exons) on either side of it." [http://www.ebi.ac.uk/embl/Documentation/FT_definitions/feature_table.html]
-comment: This term is mapped to MGED. Do not obsolete without consulting MGED ontology.
-subset: SOFA
-xref: http://en.wikipedia.org/wiki/Intron "wiki"
-is_a: SO:0000835 ! primary_transcript_region
-
-[Term]
-id: SO:0000189
-name: non_LTR_retrotransposon
-def: "A retrotransposon without long terminal repeat sequences." [SO:ke]
-synonym: "non LTR retrotransposon" EXACT []
-is_a: SO:0000180 ! retrotransposon
-
-[Term]
-id: SO:0000190
-name: five_prime_intron
-synonym: "5' intron" EXACT []
-synonym: "5' intron sequence" EXACT []
-synonym: "five prime intron" EXACT []
-is_a: SO:0000188 ! intron
-
-[Term]
-id: SO:0000191
-name: interior_intron
-synonym: "interior intron" EXACT []
-is_a: SO:0000188 ! intron
-
-[Term]
-id: SO:0000192
-name: three_prime_intron
-synonym: "3' intron" EXACT []
-synonym: "3' intron sequence" RELATED []
-synonym: "three prime intron" EXACT []
-is_a: SO:0000188 ! intron
-
-[Term]
-id: SO:0000193
-name: RFLP_fragment
-def: "A DNA fragment used as a reagent to detect the polymorphic genomic loci by hybridizing against the genomic DNA digested with a given restriction enzyme." [GOC:pj]
-subset: SOFA
-synonym: "restriction fragment length polymorphism" EXACT []
-synonym: "RFLP" EXACT []
-synonym: "RFLP fragment" EXACT []
-xref: http://en.wikipedia.org/wiki/Restriction_fragment_length_polymorphism "wiki"
-is_a: SO:0000412 ! restriction_fragment
-
-[Term]
-id: SO:0000194
-name: LINE_element
-def: "A dispersed repeat family with many copies, each from 1 to 6 kb long. New elements are generated by retroposition of a transcribed copy. Typically the LINE contains 2 ORF's one of which is reverse transcriptase, and 3'and 5' direct repeats." [http://www.ucl.ac.uk/~ucbhjow/b241/glossary.html]
-synonym: "LINE" EXACT []
-synonym: "LINE element" EXACT []
-synonym: "Long interspersed element" EXACT []
-synonym: "Long interspersed nuclear element" EXACT []
-is_a: SO:0000189 ! non_LTR_retrotransposon
-
-[Term]
-id: SO:0000195
-name: coding_exon
-def: "An exon whereby at least one base is part of a codon (here, 'codon' is inclusive of the stop_codon)." [SO:ke]
-subset: SOFA
-synonym: "coding exon" EXACT []
-is_a: SO:0000147 ! exon
-
-[Term]
-id: SO:0000196
-name: five_prime_coding_exon_coding_region
-def: "The sequence of the five_prime_coding_exon that codes for protein." [SO:cjm]
-subset: SOFA
-synonym: "five prime exon coding region" EXACT []
-is_a: SO:0001215 ! coding_region_of_exon
-relationship: part_of SO:0000200 ! five_prime_coding_exon
-
-[Term]
-id: SO:0000197
-name: three_prime_coding_exon_coding_region
-def: "The sequence of the three_prime_coding_exon that codes for protein." [SO:cjm]
-subset: SOFA
-synonym: "three prime exon coding region" EXACT []
-is_a: SO:0001215 ! coding_region_of_exon
-relationship: part_of SO:0000202 ! three_prime_coding_exon
-
-[Term]
-id: SO:0000198
-name: noncoding_exon
-def: "An exon that does not contain any codons." [SO:ke]
-subset: SOFA
-synonym: "noncoding exon" EXACT []
-is_a: SO:0000147 ! exon
-
-[Term]
-id: SO:0000199
-name: translocation
-def: "A region of nucleotide sequence that has translocated to a new position." [SO:ke]
-subset: DBVAR
-synonym: "transchr" RELATED [http://www.ncbi.nlm.nih.gov/dbvar/]
-synonym: "translocated sequence" EXACT []
-is_a: SO:0001059 ! sequence_alteration
-
-[Term]
-id: SO:0000200
-name: five_prime_coding_exon
-def: "The 5' most coding exon." [SO:ke]
-subset: SOFA
-synonym: "5' coding exon" EXACT []
-synonym: "five prime coding exon" EXACT []
-is_a: SO:0000195 ! coding_exon
-
-[Term]
-id: SO:0000201
-name: interior_exon
-def: "An exon that is bounded by 5' and 3' splice sites." [PMID:10373547]
-synonym: "interior exon" EXACT []
-is_a: SO:0000147 ! exon
-
-[Term]
-id: SO:0000202
-name: three_prime_coding_exon
-def: "The coding exon that is most 3-prime on a given transcript." [SO:ma]
-synonym: "3' coding exon" RELATED []
-synonym: "three prime coding exon" EXACT []
-is_a: SO:0000195 ! coding_exon
-
-[Term]
-id: SO:0000203
-name: UTR
-def: "Messenger RNA sequences that are untranslated and lie five prime or three prime to sequences which are translated." [SO:ke]
-subset: SOFA
-synonym: "untranslated region" EXACT []
-is_a: SO:0000836 ! mRNA_region
-
-[Term]
-id: SO:0000204
-name: five_prime_UTR
-def: "A region at the 5' end of a mature transcript (preceding the initiation codon) that is not translated into a protein." [http://www.ebi.ac.uk/embl/Documentation/FT_definitions/feature_table.html]
-subset: SOFA
-synonym: "5' UTR" EXACT []
-synonym: "five prime UTR" EXACT []
-synonym: "five_prime_untranslated_region" EXACT []
-xref: http://en.wikipedia.org/wiki/5'_UTR "wiki"
-is_a: SO:0000203 ! UTR
-
-[Term]
-id: SO:0000205
-name: three_prime_UTR
-def: "A region at the 3' end of a mature transcript (following the stop codon) that is not translated into a protein." [http://www.ebi.ac.uk/embl/Documentation/FT_definitions/feature_table.html]
-subset: SOFA
-synonym: "three prime untranslated region" EXACT []
-synonym: "three prime UTR" EXACT []
-xref: http://en.wikipedia.org/wiki/Three_prime_untranslated_region "wiki"
-is_a: SO:0000203 ! UTR
-
-[Term]
-id: SO:0000206
-name: SINE_element
-def: "A repetitive element, a few hundred base pairs long, that is dispersed throughout the genome. A common human SINE is the Alu element." [SO:ke]
-synonym: "Short interspersed element" EXACT []
-synonym: "Short interspersed nuclear element" EXACT []
-synonym: "SINE element" EXACT []
-xref: http://en.wikipedia.org/wiki/Short_interspersed_nuclear_element "wiki"
-is_a: SO:0000189 ! non_LTR_retrotransposon
-
-[Term]
-id: SO:0000207
-name: simple_sequence_length_variation
-synonym: "simple sequence length polymorphism" RELATED []
-synonym: "simple sequence length variation" EXACT []
-synonym: "SSLP" RELATED []
-is_a: SO:0000248 ! sequence_length_variation
-
-[Term]
-id: SO:0000208
-name: terminal_inverted_repeat_element
-def: "A DNA transposable element defined as having termini with perfect, or nearly perfect short inverted repeats, generally 10 - 40 nucleotides long." [http://www.genetics.org/cgi/reprint/156/4/1983.pdf]
-synonym: "terminal inverted repeat element" EXACT []
-synonym: "TIR element" EXACT []
-is_a: SO:0000182 ! DNA_transposon
-
-[Term]
-id: SO:0000209
-name: rRNA_primary_transcript
-def: "A primary transcript encoding a ribosomal RNA." [SO:ke]
-subset: SOFA
-synonym: "ribosomal RNA primary transcript" EXACT []
-synonym: "rRNA primary transcript" EXACT []
-is_a: SO:0000483 ! nc_primary_transcript
-
-[Term]
-id: SO:0000210
-name: tRNA_primary_transcript
-def: "A primary transcript encoding a transfer RNA (SO:0000253)." [SO:ke]
-synonym: "tRNA primary transcript" EXACT []
-is_a: SO:0000483 ! nc_primary_transcript
-
-[Term]
-id: SO:0000211
-name: alanine_tRNA_primary_transcript
-def: "A primary transcript encoding alanyl tRNA." [SO:ke]
-synonym: "alanine tRNA primary transcript" EXACT []
-is_a: SO:0000210 ! tRNA_primary_transcript
-
-[Term]
-id: SO:0000212
-name: arginine_tRNA_primary_transcript
-def: "A primary transcript encoding arginyl tRNA (SO:0000255)." [SO:ke]
-synonym: "arginine tRNA primary transcript" EXACT []
-is_a: SO:0000210 ! tRNA_primary_transcript
-
-[Term]
-id: SO:0000213
-name: asparagine_tRNA_primary_transcript
-def: "A primary transcript encoding asparaginyl tRNA (SO:0000256)." [SO:ke]
-synonym: "asparagine tRNA primary transcript" EXACT []
-is_a: SO:0000210 ! tRNA_primary_transcript
-
-[Term]
-id: SO:0000214
-name: aspartic_acid_tRNA_primary_transcript
-def: "A primary transcript encoding aspartyl tRNA (SO:0000257)." [SO:ke]
-synonym: "aspartic acid tRNA primary transcript" EXACT []
-is_a: SO:0000210 ! tRNA_primary_transcript
-
-[Term]
-id: SO:0000215
-name: cysteine_tRNA_primary_transcript
-def: "A primary transcript encoding cysteinyl tRNA (SO:0000258)." [SO:ke]
-synonym: "cysteine tRNA primary transcript" EXACT []
-is_a: SO:0000210 ! tRNA_primary_transcript
-
-[Term]
-id: SO:0000216
-name: glutamic_acid_tRNA_primary_transcript
-def: "A primary transcript encoding glutaminyl tRNA (SO:0000260)." [SO:ke]
-synonym: "glutamic acid tRNA primary transcript" EXACT []
-is_a: SO:0000210 ! tRNA_primary_transcript
-
-[Term]
-id: SO:0000217
-name: glutamine_tRNA_primary_transcript
-def: "A primary transcript encoding glutamyl tRNA (SO:0000260)." [SO:ke]
-synonym: "glutamine tRNA primary transcript" EXACT []
-is_a: SO:0000210 ! tRNA_primary_transcript
-
-[Term]
-id: SO:0000218
-name: glycine_tRNA_primary_transcript
-def: "A primary transcript encoding glycyl tRNA (SO:0000263)." [SO:ke]
-synonym: "glycine tRNA primary transcript" EXACT []
-is_a: SO:0000210 ! tRNA_primary_transcript
-
-[Term]
-id: SO:0000219
-name: histidine_tRNA_primary_transcript
-def: "A primary transcript encoding histidyl tRNA (SO:0000262)." [SO:ke]
-synonym: "histidine tRNA primary transcript" EXACT []
-is_a: SO:0000210 ! tRNA_primary_transcript
-
-[Term]
-id: SO:0000220
-name: isoleucine_tRNA_primary_transcript
-def: "A primary transcript encoding isoleucyl tRNA (SO:0000263)." [SO:ke]
-synonym: "isoleucine tRNA primary transcript" EXACT []
-is_a: SO:0000210 ! tRNA_primary_transcript
-
-[Term]
-id: SO:0000221
-name: leucine_tRNA_primary_transcript
-def: "A primary transcript encoding leucyl tRNA (SO:0000264)." [SO:ke]
-synonym: "leucine tRNA primary transcript" EXACT []
-is_a: SO:0000210 ! tRNA_primary_transcript
-
-[Term]
-id: SO:0000222
-name: lysine_tRNA_primary_transcript
-def: "A primary transcript encoding lysyl tRNA (SO:0000265)." [SO:ke]
-synonym: "lysine tRNA primary transcript" EXACT []
-is_a: SO:0000210 ! tRNA_primary_transcript
-
-[Term]
-id: SO:0000223
-name: methionine_tRNA_primary_transcript
-def: "A primary transcript encoding methionyl tRNA (SO:0000266)." [SO:ke]
-synonym: "methionine tRNA primary transcript" EXACT []
-is_a: SO:0000210 ! tRNA_primary_transcript
-
-[Term]
-id: SO:0000224
-name: phenylalanine_tRNA_primary_transcript
-def: "A primary transcript encoding phenylalanyl tRNA (SO:0000267)." [SO:ke]
-synonym: "phenylalanine tRNA primary transcript" EXACT []
-is_a: SO:0000210 ! tRNA_primary_transcript
-
-[Term]
-id: SO:0000225
-name: proline_tRNA_primary_transcript
-def: "A primary transcript encoding prolyl tRNA (SO:0000268)." [SO:ke]
-synonym: "proline tRNA primary transcript" EXACT []
-is_a: SO:0000210 ! tRNA_primary_transcript
-
-[Term]
-id: SO:0000226
-name: serine_tRNA_primary_transcript
-def: "A primary transcript encoding seryl tRNA (SO:000269)." [SO:ke]
-synonym: "serine tRNA primary transcript" EXACT []
-is_a: SO:0000210 ! tRNA_primary_transcript
-
-[Term]
-id: SO:0000227
-name: threonine_tRNA_primary_transcript
-def: "A primary transcript encoding threonyl tRNA (SO:000270)." [SO:ke]
-synonym: "threonine tRNA primary transcript" EXACT []
-is_a: SO:0000210 ! tRNA_primary_transcript
-
-[Term]
-id: SO:0000228
-name: tryptophan_tRNA_primary_transcript
-def: "A primary transcript encoding tryptophanyl tRNA (SO:000271)." [SO:ke]
-synonym: "tryptophan tRNA primary transcript" EXACT []
-is_a: SO:0000210 ! tRNA_primary_transcript
-
-[Term]
-id: SO:0000229
-name: tyrosine_tRNA_primary_transcript
-def: "A primary transcript encoding tyrosyl tRNA (SO:000272)." [SO:ke]
-synonym: "tyrosine tRNA primary transcript" EXACT []
-is_a: SO:0000210 ! tRNA_primary_transcript
-
-[Term]
-id: SO:0000230
-name: valine_tRNA_primary_transcript
-def: "A primary transcript encoding valyl tRNA (SO:000273)." [SO:ke]
-synonym: "valine tRNA primary transcript" EXACT []
-is_a: SO:0000210 ! tRNA_primary_transcript
-
-[Term]
-id: SO:0000231
-name: snRNA_primary_transcript
-def: "A primary transcript encoding a small nuclear RNA (SO:0000274)." [SO:ke]
-synonym: "snRNA primary transcript" EXACT []
-is_a: SO:0000483 ! nc_primary_transcript
-
-[Term]
-id: SO:0000232
-name: snoRNA_primary_transcript
-def: "A primary transcript encoding a small nucleolar mRNA (SO:0000275)." [SO:ke]
-synonym: "snoRNA primary transcript" EXACT []
-is_a: SO:0000483 ! nc_primary_transcript
-
-[Term]
-id: SO:0000233
-name: mature_transcript
-def: "A transcript which has undergone the necessary modifications, if any, for its function. In eukaryotes this includes, for example, processing of introns, cleavage, base modification, and modifications to the 5' and/or the 3' ends, other than addition of bases. In bacteria functional mRNAs are usually not modified." [SO:ke]
-comment: A processed transcript cannot contain introns.
-subset: SOFA
-synonym: "mature transcript" EXACT []
-xref: http://en.wikipedia.org/wiki/Mature_transcript "wiki"
-is_a: SO:0000673 ! transcript
-relationship: derives_from SO:0000185 ! primary_transcript
-
-[Term]
-id: SO:0000234
-name: mRNA
-def: "Messenger RNA is the intermediate molecule between DNA and protein. It includes UTR and coding sequences. It does not contain introns." [SO:ma]
-comment: An mRNA does not contain introns as it is a processed_transcript. The equivalent kind of primary_transcript is protein_coding_primary_transcript (SO:0000120) which may contain introns. This term is mapped to MGED. Do not obsolete without consulting MGED ontology.
-subset: SOFA
-synonym: "messenger RNA" EXACT []
-xref: http://en.wikipedia.org/wiki/MRNA "wiki"
-is_a: SO:0000233 ! mature_transcript
-
-[Term]
-id: SO:0000235
-name: TF_binding_site
-def: "A region of a nucleotide molecule that binds a Transcription Factor or Transcription Factor complex [GO:0005667]." [SO:ke]
-subset: SOFA
-synonym: "TF binding site" EXACT []
-synonym: "transcription factor binding site" EXACT []
-is_a: SO:0001654 ! nucleotide_to_protein_binding_site
-is_a: SO:0001679 ! transcription_regulatory_region
-
-[Term]
-id: SO:0000236
-name: ORF
-def: "The in-frame interval between the stop codons of a reading frame which when read as sequential triplets, has the potential of encoding a sequential string of amino acids. TER(NNN)nTER." [SGD:rb, SO:ma]
-comment: The definition was modified by Rama. ORF is defined by the sequence, whereas the CDS is defined according to whether a polypeptide is made. This term is mapped to MGED. Do not obsolete without consulting MGED ontology.
-subset: SOFA
-synonym: "open reading frame" EXACT []
-is_a: SO:0000717 ! reading_frame
-
-[Term]
-id: SO:0000237
-name: transcript_attribute
-synonym: "transcript attribute" EXACT []
-is_a: SO:0000733 ! feature_attribute
-
-[Term]
-id: SO:0000238
-name: foldback_element
-def: "A transposable element with extensive secondary structure, characterized by large modular imperfect long inverted repeats." [http://www.genetics.org/cgi/reprint/156/4/1983.pdf]
-synonym: "foldback element" EXACT []
-synonym: "long inverted repeat element" RELATED []
-synonym: "LVR element" RELATED []
-is_a: SO:0000182 ! DNA_transposon
-
-[Term]
-id: SO:0000239
-name: flanking_region
-def: "The sequences extending on either side of a specific region." [SO:ke]
-subset: SOFA
-synonym: "flanking region" EXACT []
-is_a: SO:0001412 ! topologically_defined_region
-
-[Term]
-id: SO:0000240
-name: chromosome_variation
-synonym: "chromosome variation" EXACT []
-is_a: SO:0001507 ! variant_collection
-disjoint_from: SO:0000110 ! sequence_feature
-disjoint_from: SO:0000400 ! sequence_attribute
-relationship: part_of SO:0001524 ! chromosomally_aberrant_genome
-
-[Term]
-id: SO:0000241
-name: internal_UTR
-def: "A UTR bordered by the terminal and initial codons of two CDSs in a polycistronic transcript. Every UTR is either 5', 3' or internal." [SO:cjm]
-synonym: "internal UTR" EXACT []
-is_a: SO:0000203 ! UTR
-
-[Term]
-id: SO:0000242
-name: untranslated_region_polycistronic_mRNA
-def: "The untranslated sequence separating the 'cistrons' of multicistronic mRNA." [SO:ke]
-synonym: "untranslated region polycistronic mRNA" EXACT []
-is_a: SO:0000203 ! UTR
-
-[Term]
-id: SO:0000243
-name: internal_ribosome_entry_site
-def: "Sequence element that recruits a ribosomal subunit to internal mRNA for translation initiation." [SO:ke]
-synonym: "internal ribosomal entry sequence" EXACT []
-synonym: "internal ribosomal entry site" EXACT []
-synonym: "internal ribosome entry sequence" RELATED []
-synonym: "internal ribosome entry site" EXACT []
-synonym: "IRES" EXACT []
-xref: http://en.wikipedia.org/wiki/Internal_ribosome_entry_site "wiki"
-is_a: SO:0000139 ! ribosome_entry_site
-
-[Term]
-id: SO:0000244
-name: four_cutter_restriction_site
-synonym: "4-cutter_restriction_site" RELATED []
-synonym: "four-cutter_restriction_sit" RELATED []
-is_obsolete: true
-
-[Term]
-id: SO:0000245
-name: mRNA_by_polyadenylation_status
-is_obsolete: true
-
-[Term]
-id: SO:0000246
-name: polyadenylated
-def: "A attribute describing the addition of a poly A tail to the 3' end of a mRNA molecule." [SO:ke]
-is_a: SO:0000863 ! mRNA_attribute
-
-[Term]
-id: SO:0000247
-name: mRNA_not_polyadenylated
-is_obsolete: true
-
-[Term]
-id: SO:0000248
-name: sequence_length_variation
-synonym: "sequence length variation" EXACT []
-is_a: SO:1000002 ! substitution
-
-[Term]
-id: SO:0000249
-name: six_cutter_restriction_site
-synonym: "6-cutter_restriction_site" RELATED []
-synonym: "six-cutter_restriction_site" RELATED []
-is_obsolete: true
-
-[Term]
-id: SO:0000250
-name: modified_RNA_base_feature
-def: "A post_transcriptionally modified base." [SO:ke]
-synonym: "modified RNA base feature" EXACT []
-is_a: SO:0001236 ! base
-
-[Term]
-id: SO:0000251
-name: eight_cutter_restriction_site
-synonym: "8-cutter_restriction_site" RELATED []
-synonym: "eight-cutter_restriction_site" RELATED []
-is_obsolete: true
-
-[Term]
-id: SO:0000252
-name: rRNA
-def: "RNA that comprises part of a ribosome, and that can provide both structural scaffolding and catalytic activity." [http://www.ebi.ac.uk/embl/Documentation/FT_definitions/feature_table.html, ISBN:0198506732]
-subset: SOFA
-synonym: "ribosomal ribonucleic acid" EXACT []
-synonym: "ribosomal RNA" EXACT []
-xref: http://en.wikipedia.org/wiki/RRNA "wiki"
-is_a: SO:0000655 ! ncRNA
-relationship: derives_from SO:0000209 ! rRNA_primary_transcript
-
-[Term]
-id: SO:0000253
-name: tRNA
-def: "Transfer RNA (tRNA) molecules are approximately 80 nucleotides in length. Their secondary structure includes four short double-helical elements and three loops (D, anti-codon, and T loops). Further hydrogen bonds mediate the characteristic L-shaped molecular structure. Transfer RNAs have two regions of fundamental functional importance: the anti-codon, which is responsible for specific mRNA codon recognition, and the 3' end, to which the tRNA's corresponding amino acid is attached  [...]
-comment: This term is mapped to MGED. Do not obsolete without consulting MGED ontology.
-subset: SOFA
-synonym: "transfer ribonucleic acid" RELATED []
-synonym: "transfer RNA" RELATED []
-xref: http://en.wikipedia.org/wiki/TRNA "wiki"
-is_a: SO:0000655 ! ncRNA
-relationship: derives_from SO:0000210 ! tRNA_primary_transcript
-
-[Term]
-id: SO:0000254
-name: alanyl_tRNA
-def: "A tRNA sequence that has an alanine anticodon, and a 3' alanine binding region." [SO:ke]
-synonym: "alanyl tRNA" EXACT []
-synonym: "alanyl-transfer ribonucleic acid" EXACT []
-synonym: "alanyl-transfer RNA" EXACT []
-is_a: SO:0000253 ! tRNA
-relationship: derives_from SO:0000211 ! alanine_tRNA_primary_transcript
-
-[Term]
-id: SO:0000255
-name: rRNA_small_subunit_primary_transcript
-def: "A primary transcript encoding a small ribosomal subunit RNA." [SO:ke]
-synonym: "rRNA small subunit primary transcript" EXACT []
-is_a: SO:0000209 ! rRNA_primary_transcript
-
-[Term]
-id: SO:0000256
-name: asparaginyl_tRNA
-def: "A tRNA sequence that has an asparagine anticodon, and a 3' asparagine binding region." [SO:ke]
-synonym: "asparaginyl tRNA" EXACT []
-synonym: "asparaginyl-transfer ribonucleic acid" EXACT []
-synonym: "asparaginyl-transfer RNA" EXACT []
-is_a: SO:0000253 ! tRNA
-relationship: derives_from SO:0000213 ! asparagine_tRNA_primary_transcript
-
-[Term]
-id: SO:0000257
-name: aspartyl_tRNA
-def: "A tRNA sequence that has an aspartic acid anticodon, and a 3' aspartic acid binding region." [SO:ke]
-synonym: "aspartyl tRNA" EXACT []
-synonym: "aspartyl-transfer ribonucleic acid" EXACT []
-synonym: "aspartyl-transfer RNA" EXACT []
-is_a: SO:0000253 ! tRNA
-relationship: derives_from SO:0000214 ! aspartic_acid_tRNA_primary_transcript
-
-[Term]
-id: SO:0000258
-name: cysteinyl_tRNA
-def: "A tRNA sequence that has a cysteine anticodon, and a 3' cysteine binding region." [SO:ke]
-synonym: "cysteinyl tRNA" EXACT []
-synonym: "cysteinyl-transfer ribonucleic acid" EXACT []
-synonym: "cysteinyl-transfer RNA" EXACT []
-is_a: SO:0000253 ! tRNA
-relationship: derives_from SO:0000215 ! cysteine_tRNA_primary_transcript
-
-[Term]
-id: SO:0000259
-name: glutaminyl_tRNA
-def: "A tRNA sequence that has a glutamine anticodon, and a 3' glutamine binding region." [SO:ke]
-synonym: "glutaminyl tRNA" EXACT []
-synonym: "glutaminyl-transfer ribonucleic acid" EXACT []
-synonym: "glutaminyl-transfer RNA" EXACT []
-is_a: SO:0000253 ! tRNA
-relationship: derives_from SO:0000216 ! glutamic_acid_tRNA_primary_transcript
-
-[Term]
-id: SO:0000260
-name: glutamyl_tRNA
-def: "A tRNA sequence that has a glutamic acid anticodon, and a 3' glutamic acid binding region." [SO:ke]
-synonym: "glutamyl tRNA" EXACT []
-synonym: "glutamyl-transfer ribonucleic acid" EXACT []
-synonym: "glutamyl-transfer RNA" RELATED []
-is_a: SO:0000253 ! tRNA
-relationship: derives_from SO:0000217 ! glutamine_tRNA_primary_transcript
-
-[Term]
-id: SO:0000261
-name: glycyl_tRNA
-def: "A tRNA sequence that has a glycine anticodon, and a 3' glycine binding region." [SO:ke]
-synonym: "glycyl tRNA" EXACT []
-synonym: "glycyl-transfer ribonucleic acid" RELATED []
-synonym: "glycyl-transfer RNA" RELATED []
-is_a: SO:0000253 ! tRNA
-relationship: derives_from SO:0000218 ! glycine_tRNA_primary_transcript
-
-[Term]
-id: SO:0000262
-name: histidyl_tRNA
-def: "A tRNA sequence that has a histidine anticodon, and a 3' histidine binding region." [SO:ke]
-synonym: "histidyl tRNA" EXACT []
-synonym: "histidyl-transfer ribonucleic acid" EXACT []
-synonym: "histidyl-transfer RNA" EXACT []
-is_a: SO:0000253 ! tRNA
-relationship: derives_from SO:0000219 ! histidine_tRNA_primary_transcript
-
-[Term]
-id: SO:0000263
-name: isoleucyl_tRNA
-def: "A tRNA sequence that has an isoleucine anticodon, and a 3' isoleucine binding region." [SO:ke]
-synonym: "isoleucyl tRNA" EXACT []
-synonym: "isoleucyl-transfer ribonucleic acid" EXACT []
-synonym: "isoleucyl-transfer RNA" EXACT []
-is_a: SO:0000253 ! tRNA
-relationship: derives_from SO:0000220 ! isoleucine_tRNA_primary_transcript
-
-[Term]
-id: SO:0000264
-name: leucyl_tRNA
-def: "A tRNA sequence that has a leucine anticodon, and a 3' leucine binding region." [SO:ke]
-synonym: "leucyl tRNA" EXACT []
-synonym: "leucyl-transfer ribonucleic acid" EXACT []
-synonym: "leucyl-transfer RNA" EXACT []
-is_a: SO:0000253 ! tRNA
-relationship: derives_from SO:0000221 ! leucine_tRNA_primary_transcript
-
-[Term]
-id: SO:0000265
-name: lysyl_tRNA
-def: "A tRNA sequence that has a lysine anticodon, and a 3' lysine binding region." [SO:ke]
-synonym: "lysyl tRNA" EXACT []
-synonym: "lysyl-transfer ribonucleic acid" EXACT []
-synonym: "lysyl-transfer RNA" EXACT []
-is_a: SO:0000253 ! tRNA
-relationship: derives_from SO:0000222 ! lysine_tRNA_primary_transcript
-
-[Term]
-id: SO:0000266
-name: methionyl_tRNA
-def: "A tRNA sequence that has a methionine anticodon, and a 3' methionine binding region." [SO:ke]
-synonym: "methionyl tRNA" EXACT []
-synonym: "methionyl-transfer ribonucleic acid" EXACT []
-synonym: "methionyl-transfer RNA" EXACT []
-is_a: SO:0000253 ! tRNA
-relationship: derives_from SO:0000223 ! methionine_tRNA_primary_transcript
-
-[Term]
-id: SO:0000267
-name: phenylalanyl_tRNA
-def: "A tRNA sequence that has a phenylalanine anticodon, and a 3' phenylalanine binding region." [SO:ke]
-synonym: "phenylalanyl tRNA" EXACT []
-synonym: "phenylalanyl-transfer ribonucleic acid" EXACT []
-synonym: "phenylalanyl-transfer RNA" EXACT []
-is_a: SO:0000253 ! tRNA
-relationship: derives_from SO:0000224 ! phenylalanine_tRNA_primary_transcript
-
-[Term]
-id: SO:0000268
-name: prolyl_tRNA
-def: "A tRNA sequence that has a proline anticodon, and a 3' proline binding region." [SO:ke]
-synonym: "prolyl tRNA" EXACT []
-synonym: "prolyl-transfer ribonucleic acid" EXACT []
-synonym: "prolyl-transfer RNA" EXACT []
-is_a: SO:0000253 ! tRNA
-relationship: derives_from SO:0000225 ! proline_tRNA_primary_transcript
-
-[Term]
-id: SO:0000269
-name: seryl_tRNA
-def: "A tRNA sequence that has a serine anticodon, and a 3' serine binding region." [SO:ke]
-synonym: "seryl tRNA" EXACT []
-synonym: "seryl-transfer ribonucleic acid" RELATED []
-synonym: "seryl-transfer RNA" EXACT []
-is_a: SO:0000253 ! tRNA
-relationship: derives_from SO:0000226 ! serine_tRNA_primary_transcript
-
-[Term]
-id: SO:0000270
-name: threonyl_tRNA
-def: "A tRNA sequence that has a threonine anticodon, and a 3' threonine binding region." [SO:ke]
-synonym: "threonyl tRNA" EXACT []
-synonym: "threonyl-transfer ribonucleic acid" EXACT []
-synonym: "threonyl-transfer RNA" RELATED []
-is_a: SO:0000253 ! tRNA
-relationship: derives_from SO:0000227 ! threonine_tRNA_primary_transcript
-
-[Term]
-id: SO:0000271
-name: tryptophanyl_tRNA
-def: "A tRNA sequence that has a tryptophan anticodon, and a 3' tryptophan binding region." [SO:ke]
-synonym: "tryptophanyl tRNA" EXACT []
-synonym: "tryptophanyl-transfer ribonucleic acid" EXACT []
-synonym: "tryptophanyl-transfer RNA" EXACT []
-is_a: SO:0000253 ! tRNA
-relationship: derives_from SO:0000228 ! tryptophan_tRNA_primary_transcript
-
-[Term]
-id: SO:0000272
-name: tyrosyl_tRNA
-def: "A tRNA sequence that has a tyrosine anticodon, and a 3' tyrosine binding region." [SO:ke]
-synonym: "tyrosyl tRNA" EXACT []
-synonym: "tyrosyl-transfer ribonucleic acid" EXACT []
-synonym: "tyrosyl-transfer RNA" RELATED []
-is_a: SO:0000253 ! tRNA
-relationship: derives_from SO:0000229 ! tyrosine_tRNA_primary_transcript
-
-[Term]
-id: SO:0000273
-name: valyl_tRNA
-def: "A tRNA sequence that has a valine anticodon, and a 3' valine binding region." [SO:ke]
-synonym: "valyl tRNA" EXACT []
-synonym: "valyl-transfer ribonucleic acid" EXACT []
-synonym: "valyl-transfer RNA" RELATED []
-is_a: SO:0000253 ! tRNA
-relationship: derives_from SO:0000230 ! valine_tRNA_primary_transcript
-
-[Term]
-id: SO:0000274
-name: snRNA
-def: "A small nuclear RNA molecule involved in pre-mRNA splicing and processing." [http://www.ebi.ac.uk/embl/Documentation/FT_definitions/feature_table.html, PMID:11733745, WB:ems]
-comment: This term is mapped to MGED. Do not obsolete without consulting MGED ontology.
-subset: SOFA
-synonym: "small nuclear RNA" EXACT []
-xref: http://en.wikipedia.org/wiki/SnRNA "wiki"
-is_a: SO:0000655 ! ncRNA
-relationship: derives_from SO:0000231 ! snRNA_primary_transcript
-
-[Term]
-id: SO:0000275
-name: snoRNA
-def: "A snoRNA (small nucleolar RNA) is any one of a class of small RNAs that are associated with the eukaryotic nucleus as components of small nucleolar ribonucleoproteins. They participate in the processing or modifications of many RNAs, mostly ribosomal RNAs (rRNAs) though snoRNAs are also known to target other classes of RNA, including spliceosomal RNAs, tRNAs, and mRNAs via a stretch of sequence that is complementary to a sequence in the targeted RNA." [GOC:kgc]
-subset: SOFA
-synonym: "small nucleolar RNA" EXACT []
-xref: http://en.wikipedia.org/wiki/SnoRNA "wiki"
-is_a: SO:0000655 ! ncRNA
-relationship: derives_from SO:0000232 ! snoRNA_primary_transcript
-
-[Term]
-id: SO:0000276
-name: miRNA
-def: "Small, ~22-nt, RNA molecule that is the endogenous transcript of a miRNA gene. Micro RNAs are produced from precursor molecules (SO:0000647) that can form local hairpin structures, which ordinarily are processed (via the Dicer pathway) such that a single miRNA molecule accumulates from one arm of a hairpin precursor molecule. Micro RNAs may trigger the cleavage of their target molecules or act as translational repressors." [PMID:12592000]
-subset: SOFA
-synonym: "micro RNA" EXACT []
-synonym: "microRNA" EXACT []
-xref: http://en.wikipedia.org/wiki/MiRNA "wiki"
-is_a: SO:0000370 ! small_regulatory_ncRNA
-relationship: derives_from SO:0000647 ! miRNA_primary_transcript
-
-[Term]
-id: SO:0000277
-name: bound_by_factor
-def: "An attribute describing a sequence that is bound by another molecule." [SO:ke]
-comment: Formerly called transcript_by_bound_factor.
-synonym: "bound by factor" EXACT []
-is_a: SO:0000733 ! feature_attribute
-
-[Term]
-id: SO:0000278
-name: transcript_bound_by_nucleic_acid
-def: "A transcript that is bound by a nucleic acid." [SO:xp]
-comment: Formerly called transcript_by_bound_nucleic_acid.
-synonym: "transcript bound by nucleic acid" EXACT []
-is_a: SO:0000673 ! implied link automatically realized ! transcript
-intersection_of: SO:0000673 ! transcript
-intersection_of: has_quality SO:0000876 ! bound_by_nucleic_acid
-
-[Term]
-id: SO:0000279
-name: transcript_bound_by_protein
-def: "A transcript that is bound by a protein." [SO:xp]
-comment: Formerly called transcript_by_bound_protein.
-synonym: "transcript bound by protein" EXACT []
-is_a: SO:0000673 ! implied link automatically realized ! transcript
-intersection_of: SO:0000673 ! transcript
-intersection_of: has_quality SO:0000875 ! bound_by_protein
-
-[Term]
-id: SO:0000280
-name: engineered_gene
-def: "A gene that is engineered." [SO:xp]
-synonym: "engineered gene" EXACT []
-is_a: SO:0000704 ! implied link automatically realized ! gene
-is_a: SO:0000804 ! implied link automatically realized ! engineered_region
-intersection_of: SO:0000704 ! gene
-intersection_of: has_quality SO:0000783 ! engineered
-
-[Term]
-id: SO:0000281
-name: engineered_foreign_gene
-def: "A gene that is engineered and foreign." [SO:xp]
-synonym: "engineered foreign gene" EXACT []
-is_a: SO:0000280 ! implied link automatically realized ! engineered_gene
-is_a: SO:0000285 ! implied link automatically realized ! foreign_gene
-is_a: SO:0000805 ! implied link automatically realized ! engineered_foreign_region
-intersection_of: SO:0000280 ! engineered_gene
-intersection_of: has_quality SO:0000783 ! engineered
-intersection_of: has_quality SO:0000784 ! foreign
-
-[Term]
-id: SO:0000282
-name: mRNA_with_minus_1_frameshift
-def: "An mRNA with a minus 1 frameshift." [SO:xp]
-synonym: "mRNA with minus 1 frameshift" EXACT []
-is_a: SO:0000108 ! implied link automatically realized ! mRNA_with_frameshift
-intersection_of: SO:0000108 ! mRNA_with_frameshift
-intersection_of: has_quality SO:0000866 ! minus_1_frameshift
-
-[Term]
-id: SO:0000283
-name: engineered_foreign_transposable_element_gene
-def: "A transposable_element that is engineered and foreign." [SO:xp]
-synonym: "engineered foreign transposable element gene" EXACT []
-is_a: SO:0000111 ! implied link automatically realized ! transposable_element_gene
-is_a: SO:0000281 ! implied link automatically realized ! engineered_foreign_gene
-intersection_of: SO:0000111 ! transposable_element_gene
-intersection_of: has_quality SO:0000783 ! engineered
-intersection_of: has_quality SO:0000784 ! foreign
-
-[Term]
-id: SO:0000284
-name: type_I_enzyme_restriction_site
-def: "The recognition site is bipartite and interrupted." [http://www.promega.com]
-is_obsolete: true
-
-[Term]
-id: SO:0000285
-name: foreign_gene
-def: "A gene that is foreign." [SO:xp]
-synonym: "foreign gene" EXACT []
-is_a: SO:0000704 ! implied link automatically realized ! gene
-intersection_of: SO:0000704 ! gene
-intersection_of: has_quality SO:0000784 ! foreign
-
-[Term]
-id: SO:0000286
-name: long_terminal_repeat
-def: "A sequence directly repeated at both ends of a defined sequence, of the sort typically found in retroviruses." [http://www.ebi.ac.uk/embl/Documentation/FT_definitions/feature_table.html]
-synonym: "direct terminal repeat" RELATED []
-synonym: "long terminal repeat" EXACT []
-synonym: "LTR" EXACT []
-xref: http://en.wikipedia.org/wiki/Long_terminal_repeat "wiki"
-is_a: SO:0000657 ! repeat_region
-relationship: part_of SO:0000186 ! LTR_retrotransposon
-
-[Term]
-id: SO:0000287
-name: fusion_gene
-def: "A gene that is a fusion." [SO:xp]
-synonym: "fusion gene" EXACT []
-xref: http://en.wikipedia.org/wiki/Fusion_gene "wiki"
-is_a: SO:0000704 ! implied link automatically realized ! gene
-intersection_of: SO:0000704 ! gene
-intersection_of: has_quality SO:0000806 ! fusion
-
-[Term]
-id: SO:0000288
-name: engineered_fusion_gene
-def: "A fusion gene that is engineered." [SO:xp]
-synonym: "engineered fusion gene" EXACT []
-is_a: SO:0000280 ! implied link automatically realized ! engineered_gene
-is_a: SO:0000287 ! implied link automatically realized ! fusion_gene
-intersection_of: SO:0000287 ! fusion_gene
-intersection_of: has_quality SO:0000783 ! engineered
-
-[Term]
-id: SO:0000289
-name: microsatellite
-def: "A repeat_region containing repeat_units (2 to 4 bp) that is repeated multiple times in tandem." [http://www.informatics.jax.org/silver/glossary.shtml]
-subset: SOFA
-synonym: "microsatellite locus" EXACT []
-synonym: "microsatellite marker" EXACT []
-synonym: "VNTR" EXACT []
-xref: http://en.wikipedia.org/wiki/Microsatellite "wiki"
-is_a: SO:0000005 ! satellite_DNA
-
-[Term]
-id: SO:0000290
-name: dinucleotide_repeat_microsatellite_feature
-synonym: "dinucleotide repeat microsatellite" EXACT []
-synonym: "dinucleotide repeat microsatellite feature" EXACT []
-synonym: "dinucleotide repeat microsatellite locus" EXACT []
-synonym: "dinucleotide repeat microsatellite marker" EXACT []
-is_a: SO:0000289 ! microsatellite
-
-[Term]
-id: SO:0000291
-name: trinucleotide_repeat_microsatellite_feature
-synonym: "dinucleotide repeat microsatellite marker" RELATED []
-synonym: "rinucleotide repeat microsatellite" EXACT []
-synonym: "trinucleotide repeat microsatellite feature" EXACT []
-synonym: "trinucleotide repeat microsatellite locus" EXACT []
-is_a: SO:0000289 ! microsatellite
-
-[Term]
-id: SO:0000292
-name: repetitive_element
-is_obsolete: true
-
-[Term]
-id: SO:0000293
-name: engineered_foreign_repetitive_element
-def: "A repetitive element that is engineered and foreign." [SO:xp]
-synonym: "engineered foreign repetitive element" EXACT []
-is_a: SO:0000657 ! implied link automatically realized ! repeat_region
-is_a: SO:0000805 ! implied link automatically realized ! engineered_foreign_region
-intersection_of: SO:0000657 ! repeat_region
-intersection_of: has_quality SO:0000783 ! engineered
-intersection_of: has_quality SO:0000784 ! foreign
-
-[Term]
-id: SO:0000294
-name: inverted_repeat
-def: "The sequence is complementarily repeated on the opposite strand. It is a palindrome, and it may, or may not be hyphenated. Examples: GCTGATCAGC, or GCTGA-----TCAGC." [SO:ke]
-subset: SOFA
-synonym: "inverted repeat" EXACT []
-synonym: "inverted repeat sequence" EXACT []
-xref: http://en.wikipedia.org/wiki/Inverted_repeat "wiki"
-is_a: SO:0000657 ! repeat_region
-
-[Term]
-id: SO:0000295
-name: U12_intron
-def: "A type of spliceosomal intron spliced by the U12 spliceosome, that includes U11, U12, U4atac/U6atac and U5 snRNAs." [PMID:9428511]
-comment: May have either GT-AC or AT-AC 5' and 3' boundaries.
-synonym: "U12 intron" EXACT []
-synonym: "U12-dependent intron" EXACT []
-is_a: SO:0000662 ! spliceosomal_intron
-
-[Term]
-id: SO:0000296
-name: origin_of_replication
-def: "The origin of replication; starting site for duplication of a nucleic acid molecule to give two identical copies." [http://www.ebi.ac.uk/embl/Documentation/FT_definitions/feature_table.html]
-subset: SOFA
-synonym: "ori" EXACT []
-synonym: "origin of replication" EXACT []
-xref: http://en.wikipedia.org/wiki/Origin_of_replication "wiki"
-is_a: SO:0001411 ! biological_region
-relationship: part_of SO:0001235 ! replicon
-
-[Term]
-id: SO:0000297
-name: D_loop
-def: "Displacement loop; a region within mitochondrial DNA in which a short stretch of RNA is paired with one strand of DNA, displacing the original partner DNA strand in this region; also used to describe the displacement of a region of one strand of duplex DNA by a single stranded invader in the reaction catalyzed by RecA protein." [http://www.ebi.ac.uk/embl/Documentation/FT_definitions/feature_table.html]
-synonym: "D-loop" EXACT []
-synonym: "displacement loop" RELATED []
-xref: http://en.wikipedia.org/wiki/D_loop "wiki"
-is_a: SO:0000296 ! origin_of_replication
-
-[Term]
-id: SO:0000298
-name: recombination_feature
-synonym: "recombination feature" EXACT []
-is_a: SO:0001411 ! biological_region
-
-[Term]
-id: SO:0000299
-name: specific_recombination_site
-synonym: "specific recombination site" EXACT []
-is_a: SO:0000669 ! sequence_rearrangement_feature
-
-[Term]
-id: SO:0000300
-name: recombination_feature_of_rearranged_gene
-synonym: "recombination feature of rearranged gene" EXACT []
-is_a: SO:0000299 ! specific_recombination_site
-
-[Term]
-id: SO:0000301
-name: vertebrate_immune_system_gene_recombination_feature
-synonym: "vertebrate immune system gene recombination feature" EXACT []
-is_a: SO:0000300 ! recombination_feature_of_rearranged_gene
-
-[Term]
-id: SO:0000302
-name: J_gene_recombination_feature
-def: "Recombination signal including J-heptamer, J-spacer and J-nonamer in 5' of J-region of a J-gene or J-sequence." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "J gene recombination feature" EXACT []
-synonym: "J-RS" EXACT []
-is_a: SO:0000939 ! vertebrate_immune_system_gene_recombination_signal_feature
-
-[Term]
-id: SO:0000303
-name: clip
-def: "Part of the primary transcript that is clipped off during processing." [SO:ke]
-subset: SOFA
-is_a: SO:0000835 ! primary_transcript_region
-
-[Term]
-id: SO:0000304
-name: type_II_enzyme_restriction_site
-def: "The recognition site is either palindromic, partially palindromic or an interrupted palindrome. Cleavage occurs within the recognition site." [http://www.promega.com]
-is_obsolete: true
-
-[Term]
-id: SO:0000305
-name: modified_base
-def: "A modified nucleotide, i.e. a nucleotide other than A, T, C. G." [http://www.ebi.ac.uk/embl/Documentation/FT_definitions/feature_table.html]
-comment: Modified base:<modified_base>.
-subset: SOFA
-synonym: "modified base site" EXACT []
-is_a: SO:0001720 ! epigenetically_modified_region
-
-[Term]
-id: SO:0000306
-name: methylated_base_feature
-def: "A nucleotide modified by methylation." [SO:ke]
-subset: SOFA
-synonym: "methylated base feature" EXACT []
-is_a: SO:0000305 ! modified_base
-
-[Term]
-id: SO:0000307
-name: CpG_island
-def: "Regions of a few hundred to a few thousand bases in vertebrate genomes that are relatively GC and CpG rich; they are typically unmethylated and often found near the 5' ends of genes." [SO:rd]
-subset: SOFA
-synonym: "CG island" EXACT []
-synonym: "CpG island" EXACT []
-xref: http://en.wikipedia.org/wiki/CpG_island "wiki"
-is_a: SO:0001411 ! biological_region
-
-[Term]
-id: SO:0000308
-name: sequence_feature_locating_method
-is_obsolete: true
-
-[Term]
-id: SO:0000309
-name: computed_feature
-is_obsolete: true
-
-[Term]
-id: SO:0000310
-name: predicted_ab_initio_computation
-is_obsolete: true
-
-[Term]
-id: SO:0000311
-name: computed_feature_by_similarity
-def: "." [SO:ma]
-comment: similar to:<sequence_id>
-is_obsolete: true
-
-[Term]
-id: SO:0000312
-name: experimentally_determined
-def: "Attribute to describe a feature that has been experimentally verified." [SO:ke]
-synonym: "experimentally determined" EXACT []
-is_a: SO:0000789 ! validated
-
-[Term]
-id: SO:0000313
-name: stem_loop
-alt_id: SO:0000019
-def: "A double-helical region of nucleic acid formed by base-pairing between adjacent (inverted) complementary sequences." [http://www.ebi.ac.uk/embl/Documentation/FT_definitions/feature_table.html]
-synonym: "RNA_hairpin_loop" EXACT []
-synonym: "stem loop" EXACT []
-synonym: "stem-loop" EXACT []
-xref: http://en.wikipedia.org/wiki/Stem_loop "wiki"
-is_a: SO:0000122 ! RNA_sequence_secondary_structure
-
-[Term]
-id: SO:0000314
-name: direct_repeat
-def: "A repeat where the same sequence is repeated in the same direction. Example: GCTGA-----GCTGA." [SO:ke]
-subset: SOFA
-synonym: "direct repeat" EXACT []
-xref: http://en.wikipedia.org/wiki/Direct_repeat "wiki"
-is_a: SO:0000657 ! repeat_region
-
-[Term]
-id: SO:0000315
-name: TSS
-def: "The first base where RNA polymerase begins to synthesize the RNA transcript." [SO:ke]
-subset: SOFA
-synonym: "transcription start site" EXACT []
-is_a: SO:0000835 ! primary_transcript_region
-
-[Term]
-id: SO:0000316
-name: CDS
-def: "A contiguous sequence which begins with, and includes, a start codon and ends with, and includes, a stop codon." [SO:ma]
-subset: SOFA
-synonym: "coding sequence" EXACT []
-is_a: SO:0000836 ! mRNA_region
-
-[Term]
-id: SO:0000317
-name: cDNA_clone
-def: "Complementary DNA; A piece of DNA copied from an mRNA and spliced into a vector for propagation in a suitable host." [http://seqcore.brcf.med.umich.edu/doc/educ/dnapr/mbglossary/mbgloss.html]
-comment: This term is mapped to MGED. Do not obsolete without consulting MGED ontology.
-synonym: "cDNA clone" EXACT []
-is_a: SO:0000151 ! implied link automatically realized ! clone
-intersection_of: SO:0000151 ! clone
-intersection_of: has_quality SO:0000756 ! cDNA
-
-[Term]
-id: SO:0000318
-name: start_codon
-def: "First codon to be translated by a ribosome." [SO:ke]
-subset: SOFA
-synonym: "initiation codon" EXACT []
-synonym: "start codon" EXACT []
-xref: http://en.wikipedia.org/wiki/Start_codon "wiki"
-is_a: SO:0000360 ! codon
-
-[Term]
-id: SO:0000319
-name: stop_codon
-def: "In mRNA, a set of three nucleotides that indicates the end of information for protein synthesis." [SO:ke]
-subset: SOFA
-synonym: "stop codon" EXACT []
-xref: http://en.wikipedia.org/wiki/Stop_codon "wiki"
-is_a: SO:0000360 ! codon
-
-[Term]
-id: SO:0000320
-name: intronic_splice_enhancer
-def: "Sequences within the intron that modulate splice site selection for some introns." [SO:ke]
-synonym: "intronic splice enhancer" EXACT []
-is_a: SO:0000344 ! splice_enhancer
-is_a: SO:0000841 ! spliceosomal_intron_region
-
-[Term]
-id: SO:0000321
-name: mRNA_with_plus_1_frameshift
-def: "An mRNA with a plus 1 frameshift." [SO:ke]
-synonym: "mRNA with plus 1 frameshift" EXACT []
-is_a: SO:0000108 ! implied link automatically realized ! mRNA_with_frameshift
-intersection_of: SO:0000108 ! mRNA_with_frameshift
-intersection_of: has_quality SO:0000868 ! plus_1_frameshift
-
-[Term]
-id: SO:0000322
-name: nuclease_hypersensitive_site
-synonym: "nuclease hypersensitive site" EXACT []
-is_a: SO:0000684 ! nuclease_sensitive_site
-
-[Term]
-id: SO:0000323
-name: coding_start
-def: "The first base to be translated into protein." [SO:ke]
-synonym: "coding start" EXACT []
-synonym: "translation initiation site" EXACT []
-synonym: "translation start" RELATED []
-is_a: SO:0000851 ! CDS_region
-
-[Term]
-id: SO:0000324
-name: tag
-def: "A nucleotide sequence that may be used to identify a larger sequence." [SO:ke]
-subset: SOFA
-is_a: SO:0000696 ! oligo
-
-[Term]
-id: SO:0000325
-name: rRNA_large_subunit_primary_transcript
-def: "A primary transcript encoding a large ribosomal subunit RNA." [SO:ke]
-subset: SOFA
-synonym: "rRNA large subunit primary transcript" EXACT []
-is_a: SO:0000209 ! rRNA_primary_transcript
-
-[Term]
-id: SO:0000326
-name: SAGE_tag
-def: "A short diagnostic sequence tag, serial analysis of gene expression (SAGE), that allows the quantitative and simultaneous analysis of a large number of transcripts." [http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&db=PubMed&list_uids=7570003&dopt=Abstract]
-subset: SOFA
-synonym: "SAGE tag" EXACT []
-is_a: SO:0000324 ! tag
-
-[Term]
-id: SO:0000327
-name: coding_end
-def: "The last base to be translated into protein. It does not include the stop codon." [SO:ke]
-synonym: "coding end" EXACT []
-synonym: "translation termination site" EXACT []
-synonym: "translation_end" EXACT []
-is_a: SO:0000851 ! CDS_region
-
-[Term]
-id: SO:0000328
-name: microarray_oligo
-synonym: "microarray oligo" EXACT []
-synonym: "microarray oligonucleotide" EXACT []
-is_a: SO:0000051 ! probe
-
-[Term]
-id: SO:0000329
-name: mRNA_with_plus_2_frameshift
-def: "An mRNA with a plus 2 frameshift." [SO:xp]
-synonym: "mRNA with plus 2 frameshift" EXACT []
-is_a: SO:0000108 ! implied link automatically realized ! mRNA_with_frameshift
-intersection_of: SO:0000108 ! mRNA_with_frameshift
-intersection_of: has_quality SO:0000869 ! plus_2_framshift
-
-[Term]
-id: SO:0000330
-name: conserved_region
-def: "Region of sequence similarity by descent from a common ancestor." [SO:ke]
-subset: SOFA
-synonym: "conserved region" EXACT []
-xref: http://en.wikipedia.org/wiki/Conserved_region "wiki"
-is_a: SO:0001410 ! experimental_feature
-
-[Term]
-id: SO:0000331
-name: STS
-def: "Short (typically a few hundred base pairs) DNA sequence that has a single occurrence in a genome and whose location and base sequence are known." [http://www.biospace.com]
-subset: SOFA
-synonym: "sequence tag site" EXACT []
-is_a: SO:0000324 ! tag
-
-[Term]
-id: SO:0000332
-name: coding_conserved_region
-def: "Coding region of sequence similarity by descent from a common ancestor." [SO:ke]
-subset: SOFA
-synonym: "coding conserved region" EXACT []
-is_a: SO:0000330 ! conserved_region
-
-[Term]
-id: SO:0000333
-name: exon_junction
-def: "The boundary between two exons in a processed transcript." [SO:ke]
-subset: SOFA
-synonym: "exon junction" EXACT []
-is_a: SO:0000699 ! junction
-relationship: part_of SO:0000233 ! mature_transcript
-
-[Term]
-id: SO:0000334
-name: nc_conserved_region
-def: "Non-coding region of sequence similarity by descent from a common ancestor." [SO:ke]
-subset: SOFA
-synonym: "nc conserved region" EXACT []
-synonym: "noncoding conserved region" EXACT []
-is_a: SO:0000330 ! conserved_region
-
-[Term]
-id: SO:0000335
-name: mRNA_with_minus_2_frameshift
-def: "A mRNA with a minus 2 frameshift." [SO:ke]
-synonym: "mRNA with minus 2 frameshift" EXACT []
-is_a: SO:0000108 ! implied link automatically realized ! mRNA_with_frameshift
-intersection_of: SO:0000108 ! mRNA_with_frameshift
-intersection_of: has_quality SO:0000867 ! minus_2_frameshift
-
-[Term]
-id: SO:0000336
-name: pseudogene
-def: "A sequence that closely resembles a known functional gene, at another locus within a genome, that is non-functional as a consequence of (usually several) mutations that prevent either its transcription or translation (or both). In general, pseudogenes result from either reverse transcription of a transcript of their \"normal\" paralog (SO:0000043) (in which case the pseudogene typically lacks introns and includes a poly(A) tail) or from recombination (SO:0000044) (in which case the [...]
-subset: SOFA
-xref: http://en.wikipedia.org/wiki/Pseudogene "wiki"
-is_a: SO:0001411 ! biological_region
-relationship: non_functional_homolog_of SO:0000704 ! gene
-
-[Term]
-id: SO:0000337
-name: RNAi_reagent
-def: "A double stranded RNA duplex, at least 20bp long, used experimentally to inhibit gene function by RNA interference." [SO:rd]
-subset: SOFA
-synonym: "RNAi reagent" EXACT []
-is_a: SO:0000442 ! ds_oligo
-
-[Term]
-id: SO:0000338
-name: MITE
-def: "A highly repetitive and short (100-500 base pair) transposable element with terminal inverted repeats (TIR) and target site duplication (TSD). MITEs do not encode proteins." [http://www.pnas.org/cgi/content/full/97/18/10083]
-synonym: "miniature inverted repeat transposable element" EXACT []
-is_a: SO:0000208 ! terminal_inverted_repeat_element
-
-[Term]
-id: SO:0000339
-name: recombination_hotspot
-def: "A region in a genome which promotes recombination." [SO:rd]
-synonym: "recombination hotspot" EXACT []
-xref: http://en.wikipedia.org/wiki/Recombination_hotspot "wiki"
-is_a: SO:0000298 ! recombination_feature
-
-[Term]
-id: SO:0000340
-name: chromosome
-def: "Structural unit composed of a nucleic acid molecule which controls its own replication through the interaction of specific proteins at one or more origins of replication." [SO:ma]
-comment: This term is mapped to MGED. Do not obsolete without consulting MGED ontology.
-subset: SOFA
-xref: http://en.wikipedia.org/wiki/Chromosome "wiki"
-is_a: SO:0001235 ! replicon
-
-[Term]
-id: SO:0000341
-name: chromosome_band
-def: "A cytologically distinguishable feature of a chromosome, often made visible by staining, and usually alternating light and dark." [SO:ma]
-subset: SOFA
-synonym: "chromosome band" EXACT []
-synonym: "cytoband" EXACT []
-synonym: "cytological band" EXACT []
-xref: http://en.wikipedia.org/wiki/Cytological_band "wiki"
-is_a: SO:0000830 ! chromosome_part
-
-[Term]
-id: SO:0000342
-name: site_specific_recombination_target_region
-synonym: "site specific recombination target region" EXACT []
-is_a: SO:0000299 ! specific_recombination_site
-
-[Term]
-id: SO:0000343
-name: match
-def: "A region of sequence, aligned to another sequence with some statistical significance, using an algorithm such as BLAST or SIM4." [SO:ke]
-subset: SOFA
-is_a: SO:0001410 ! experimental_feature
-
-[Term]
-id: SO:0000344
-name: splice_enhancer
-def: "Region of a transcript that regulates splicing." [SO:ke]
-subset: SOFA
-synonym: "splice enhancer" EXACT []
-is_a: SO:0001056 ! splicing_regulatory_region
-
-[Term]
-id: SO:0000345
-name: EST
-def: "A tag produced from a single sequencing read from a cDNA clone or PCR product; typically a few hundred base pairs long." [SO:ke]
-comment: This term is mapped to MGED. Do not obsolete without consulting MGED ontology.
-subset: SOFA
-synonym: "expressed sequence tag" EXACT []
-is_a: SO:0000324 ! tag
-relationship: derives_from SO:0000234 ! mRNA
-
-[Term]
-id: SO:0000346
-name: loxP_site
-synonym: "Cre-recombination target region" RELATED []
-synonym: "loxP site" EXACT []
-is_a: SO:0000947 ! resolution_site
-
-[Term]
-id: SO:0000347
-name: nucleotide_match
-def: "A match against a nucleotide sequence." [SO:ke]
-subset: SOFA
-synonym: "nucleotide match" EXACT []
-is_a: SO:0000343 ! match
-
-[Term]
-id: SO:0000348
-name: nucleic_acid
-def: "An attribute describing a sequence consisting of nucleobases bound to repeating units. The forms found in nature are deoxyribonucleic acid (DNA), where the repeating units are 2-deoxy-D-ribose rings connected to a phosphate backbone, and ribonucleic acid (RNA), where the repeating units are D-ribose rings connected to a phosphate backbone." [CHEBI:33696, RSC:cb]
-synonym: "nucleic acid" EXACT []
-xref: http://en.wikipedia.org/wiki/Nucleic_acid "wiki"
-is_a: SO:0000443 ! polymer_attribute
-
-[Term]
-id: SO:0000349
-name: protein_match
-def: "A match against a protein sequence." [SO:ke]
-subset: SOFA
-synonym: "protein match" EXACT []
-is_a: SO:0000343 ! match
-
-[Term]
-id: SO:0000350
-name: FRT_site
-def: "An inversion site found on the Saccharomyces cerevisiae 2 micron plasmid." [SO:ma]
-synonym: "FLP recombination target region" EXACT []
-synonym: "FRT site" EXACT []
-is_a: SO:0000948 ! inversion_site
-
-[Term]
-id: SO:0000351
-name: synthetic_sequence
-def: "An attribute to decide a sequence of nucleotides, nucleotide analogs, or amino acids that has been designed by an experimenter and which may, or may not, correspond with any natural sequence." [SO:ma]
-synonym: "synthetic sequence" EXACT []
-is_a: SO:0000443 ! polymer_attribute
-
-[Term]
-id: SO:0000352
-name: DNA
-def: "An attribute describing a sequence consisting of nucleobases bound to a repeating unit made of a 2-deoxy-D-ribose ring connected to a phosphate backbone." [RSC:cb]
-is_a: SO:0000348 ! nucleic_acid
-
-[Term]
-id: SO:0000353
-name: sequence_assembly
-def: "A sequence of nucleotides that has been algorithmically derived from an alignment of two or more different sequences." [SO:ma]
-subset: SOFA
-synonym: "sequence assembly" EXACT []
-xref: http://en.wikipedia.org/wiki/Sequence_assembly "wiki"
-is_a: SO:0001248 ! assembly
-
-[Term]
-id: SO:0000354
-name: group_1_intron_homing_endonuclease_target_region
-def: "A region of intronic nucleotide sequence targeted by a nuclease enzyme." [SO:ke]
-synonym: "group 1 intron homing endonuclease target region" EXACT []
-is_a: SO:0000684 ! nuclease_sensitive_site
-
-[Term]
-id: SO:0000355
-name: haplotype_block
-def: "A region of the genome which is co-inherited as the result of the lack of historic recombination within it." [SO:ma]
-synonym: "haplotype block" EXACT []
-is_a: SO:0000298 ! recombination_feature
-
-[Term]
-id: SO:0000356
-name: RNA
-def: "An attribute describing a sequence consisting of nucleobases bound to a repeating unit made of a D-ribose ring connected to a phosphate backbone." [RSC:cb]
-comment: This term is mapped to MGED. Do not obsolete without consulting MGED ontology.
-is_a: SO:0000348 ! nucleic_acid
-
-[Term]
-id: SO:0000357
-name: flanked
-def: "An attribute describing a region that is bounded either side by a particular kind of region." [SO:ke]
-is_a: SO:0000733 ! feature_attribute
-
-[Term]
-id: SO:0000359
-name: floxed
-def: "An attribute describing sequence that is flanked by Lox-P sites." [SO:ke]
-xref: http://en.wikipedia.org/wiki/Floxed "wiki"
-is_a: SO:0000357 ! flanked
-
-[Term]
-id: SO:0000360
-name: codon
-def: "A set of (usually) three nucleotide bases in a DNA or RNA sequence, which together code for a unique amino acid or the termination of translation and are contained within the CDS." [http://www.everythingbio.com/glos/definition.php?word=codon, SO:ke]
-subset: SOFA
-xref: http://en.wikipedia.org/wiki/Codon "wiki"
-is_a: SO:0000851 ! CDS_region
-
-[Term]
-id: SO:0000361
-name: FRT_flanked
-def: "An attribute to describe sequence that is flanked by the FLP recombinase recognition site, FRT." [SO:ke]
-synonym: "FRT flanked" EXACT []
-is_a: SO:0000357 ! flanked
-
-[Term]
-id: SO:0000362
-name: invalidated_by_chimeric_cDNA
-def: "A cDNA clone constructed from more than one mRNA. Usually an experimental artifact." [SO:ma]
-synonym: "invalidated by chimeric cDNA" EXACT []
-is_a: SO:0000790 ! invalidated
-
-[Term]
-id: SO:0000363
-name: floxed_gene
-def: "A transgene that is floxed." [SO:xp]
-synonym: "floxed gene" EXACT []
-is_a: SO:0000902 ! implied link automatically realized ! transgene
-intersection_of: SO:0000902 ! transgene
-intersection_of: has_quality SO:0000359 ! floxed
-
-[Term]
-id: SO:0000364
-name: transposable_element_flanking_region
-def: "The region of sequence surrounding a transposable element." [SO:ke]
-synonym: "transposable element flanking region" EXACT []
-is_a: SO:0000239 ! flanking_region
-
-[Term]
-id: SO:0000365
-name: integron
-def: "A region encoding an integrase which acts at a site adjacent to it (attI_site) to insert DNA which must include but is not limited to an attC_site." [SO:as]
-xref: http://en.wikipedia.org/wiki/Integron "wiki"
-is_a: SO:0001039 ! integrated_mobile_genetic_element
-
-[Term]
-id: SO:0000366
-name: insertion_site
-def: "The junction where an insertion occurred." [SO:ke]
-subset: SOFA
-synonym: "insertion site" EXACT []
-is_a: SO:0000699 ! junction
-
-[Term]
-id: SO:0000367
-name: attI_site
-def: "A region within an integron, adjacent to an integrase, at which site specific recombination involving an attC_site takes place." [SO:as]
-synonym: "attI site" EXACT []
-is_a: SO:0000946 ! integration_excision_site
-relationship: part_of SO:0000365 ! integron
-
-[Term]
-id: SO:0000368
-name: transposable_element_insertion_site
-def: "The junction in a genome where a transposable_element has inserted." [SO:ke]
-subset: SOFA
-synonym: "transposable element insertion site" EXACT []
-is_a: SO:0000366 ! insertion_site
-
-[Term]
-id: SO:0000369
-name: integrase_coding_region
-is_obsolete: true
-
-[Term]
-id: SO:0000370
-name: small_regulatory_ncRNA
-def: "A non-coding RNA, usually with a specific secondary structure, that acts to regulate gene expression." [SO:ma]
-subset: SOFA
-synonym: "small regulatory ncRNA" EXACT []
-is_a: SO:0000655 ! ncRNA
-
-[Term]
-id: SO:0000371
-name: conjugative_transposon
-def: "A transposon that encodes function required for conjugation." [http://www.sci.sdsu.edu/~smaloy/Glossary/C.html]
-synonym: "conjugative transposon" EXACT []
-is_a: SO:0000182 ! DNA_transposon
-
-[Term]
-id: SO:0000372
-name: enzymatic_RNA
-def: "An RNA sequence that has catalytic activity with or without an associated ribonucleoprotein." [RSC:cb]
-comment: This was moved to be a child of transcript (SO:0000673) because some enzymatic RNA regions are part of primary transcripts and some are part of processed transcripts.
-subset: SOFA
-synonym: "enzymatic RNA" EXACT []
-is_a: SO:0000673 ! implied link automatically realized ! transcript
-intersection_of: SO:0000673 ! transcript
-intersection_of: has_quality SO:0001185 ! enzymatic
-
-[Term]
-id: SO:0000373
-name: recombinationally_inverted_gene
-def: "A recombinationally rearranged gene by inversion." [SO:xp]
-synonym: "recombinationally inverted gene" EXACT []
-is_a: SO:0000456 ! implied link automatically realized ! recombinationally_rearranged_gene
-intersection_of: SO:0000456 ! recombinationally_rearranged_gene
-intersection_of: has_quality SO:1000036 ! inversion
-
-[Term]
-id: SO:0000374
-name: ribozyme
-def: "An RNA with catalytic activity." [SO:ma]
-subset: SOFA
-xref: http://en.wikipedia.org/wiki/Ribozyme "wiki"
-is_a: SO:0000372 ! implied link automatically realized ! enzymatic_RNA
-intersection_of: SO:0000372 ! enzymatic_RNA
-intersection_of: has_quality SO:0001186 ! ribozymic
-
-[Term]
-id: SO:0000375
-name: rRNA_5_8S
-def: "5_8S ribosomal RNA (5. 8S rRNA) is a component of the large subunit of the eukaryotic ribosome. It is transcribed by RNA polymerase I as part of the 45S precursor that also contains 18S and 28S rRNA. Functionally, it is thought that 5.8S rRNA may be involved in ribosome translocation. It is also known to form covalent linkage to the p53 tumour suppressor protein. 5_8S rRNA is also found in archaea." [http://www.sanger.ac.uk/cgi-bin/Rfam/getacc?RF00002]
-subset: SOFA
-synonym: "5.8S LSU rRNA" EXACT []
-synonym: "5.8S ribosomal RNA" EXACT []
-synonym: "5.8S rRNA" EXACT []
-synonym: "rRNA 5 8S" EXACT []
-xref: http://en.wikipedia.org/wiki/5.8S_ribosomal_RNA "wiki"
-is_a: SO:0000651 ! large_subunit_rRNA
-
-[Term]
-id: SO:0000376
-name: RNA_6S
-def: "A small (184-nt in E. coli) RNA that forms a hairpin type structure. 6S RNA associates with RNA polymerase in a highly specific manner. 6S RNA represses expression from a sigma70-dependent promoter during stationary phase." [http://www.sanger.ac.uk/cgi-bin/Rfam/getacc?RF00013]
-synonym: "6S RNA" EXACT []
-synonym: "RNA 6S" EXACT []
-xref: http://en.wikipedia.org/wiki/6S_RNA "wiki"
-is_a: SO:0000370 ! small_regulatory_ncRNA
-
-[Term]
-id: SO:0000377
-name: CsrB_RsmB_RNA
-def: "An enterobacterial RNA that binds the CsrA protein. The CsrB RNAs contain a conserved motif CAGGXXG that is found in up to 18 copies and has been suggested to bind CsrA. The Csr regulatory system has a strong negative regulatory effect on glycogen biosynthesis, glyconeogenesis and glycogen catabolism and a positive regulatory effect on glycolysis. In other bacteria such as Erwinia caratovara the RsmA protein has been shown to regulate the production of virulence determinants, such  [...]
-synonym: "CsrB RsmB RNA" EXACT []
-synonym: "CsrB-RsmB RNA" EXACT []
-is_a: SO:0000370 ! small_regulatory_ncRNA
-
-[Term]
-id: SO:0000378
-name: DsrA_RNA
-def: "DsrA RNA regulates both transcription, by overcoming transcriptional silencing by the nucleoid-associated H-NS protein, and translation, by promoting efficient translation of the stress sigma factor, RpoS. These two activities of DsrA can be separated by mutation: the first of three stem-loops of the 85 nucleotide RNA is necessary for RpoS translation but not for anti-H-NS action, while the second stem-loop is essential for antisilencing and less critical for RpoS translation. The  [...]
-synonym: "DsrA RNA" EXACT []
-xref: http://en.wikipedia.org/wiki/DsrA_RNA "wiki"
-is_a: SO:0000370 ! small_regulatory_ncRNA
-
-[Term]
-id: SO:0000379
-name: GcvB_RNA
-def: "A small untranslated RNA involved in expression of the dipeptide and oligopeptide transport systems in Escherichia coli." [http://www.sanger.ac.uk/cgi-bin/Rfam/getacc?RF00022]
-synonym: "GcvB RNA" EXACT []
-xref: http://en.wikipedia.org/wiki/GcvB_RNA "wiki"
-is_a: SO:0000378 ! DsrA_RNA
-
-[Term]
-id: SO:0000380
-name: hammerhead_ribozyme
-def: "A small catalytic RNA motif that catalyzes self-cleavage reaction. Its name comes from its secondary structure which resembles a carpenter's hammer. The hammerhead ribozyme is involved in the replication of some viroid and some satellite RNAs." [PMID:2436805]
-subset: SOFA
-synonym: "hammerhead ribozyme" EXACT []
-xref: http://en.wikipedia.org/wiki/Hammerhead_ribozyme "wiki"
-is_a: SO:0000715 ! implied link automatically realized ! RNA_motif
-intersection_of: SO:0000715 ! RNA_motif
-intersection_of: has_quality SO:0001186 ! ribozymic
-
-[Term]
-id: SO:0000381
-name: group_IIA_intron
-synonym: "group IIA intron" EXACT []
-is_a: SO:0000603 ! group_II_intron
-
-[Term]
-id: SO:0000382
-name: group_IIB_intron
-synonym: "group IIB intron" EXACT []
-is_a: SO:0000603 ! group_II_intron
-
-[Term]
-id: SO:0000383
-name: MicF_RNA
-def: "A non-translated 93 nt antisense RNA that binds its target ompF mRNA and regulates ompF expression by inhibiting translation and inducing degradation of the message." [http://www.sanger.ac.uk/cgi-bin/Rfam/getacc?RF00033]
-synonym: "MicF RNA" EXACT []
-xref: http://en.wikipedia.org/wiki/MicF_RNA "wiki"
-is_a: SO:0000644 ! antisense_RNA
-
-[Term]
-id: SO:0000384
-name: OxyS_RNA
-def: "A small untranslated RNA which is induced in response to oxidative stress in Escherichia coli. Acts as a global regulator to activate or repress the expression of as many as 40 genes, including the fhlA-encoded transcriptional activator and the rpoS-encoded sigma(s) subunit of RNA polymerase. OxyS is bound by the Hfq protein, that increases the OxyS RNA interaction with its target messages." [http://www.sanger.ac.uk/cgi-bin/Rfam/getacc?RF00035]
-synonym: "OxyS RNA" EXACT []
-xref: http://en.wikipedia.org/wiki/OxyS_RNA "wiki"
-is_a: SO:0000370 ! small_regulatory_ncRNA
-
-[Term]
-id: SO:0000385
-name: RNase_MRP_RNA
-def: "The RNA molecule essential for the catalytic activity of RNase MRP, an enzymatically active ribonucleoprotein with two distinct roles in eukaryotes. In mitochondria it plays a direct role in the initiation of mitochondrial DNA replication. In the nucleus it is involved in precursor rRNA processing, where it cleaves the internal transcribed spacer 1 between 18S and 5.8S rRNAs." [http://www.sanger.ac.uk/cgi-bin/Rfam/getacc?RF00030]
-subset: SOFA
-synonym: "RNase MRP RNA" EXACT []
-is_a: SO:0000655 ! ncRNA
-
-[Term]
-id: SO:0000386
-name: RNase_P_RNA
-def: "The RNA component of Ribonuclease P (RNase P), a ubiquitous endoribonuclease, found in archaea, bacteria and eukarya as well as chloroplasts and mitochondria. Its best characterized activity is the generation of mature 5 prime ends of tRNAs by cleaving the 5 prime leader elements of precursor-tRNAs. Cellular RNase Ps are ribonucleoproteins. RNA from bacterial RNase Ps retains its catalytic activity in the absence of the protein subunit, i.e. it is a ribozyme. Isolated eukaryotic an [...]
-subset: SOFA
-synonym: "RNase P RNA" EXACT []
-is_a: SO:0000655 ! ncRNA
-
-[Term]
-id: SO:0000387
-name: RprA_RNA
-def: "Translational regulation of the stationary phase sigma factor RpoS is mediated by the formation of a double-stranded RNA stem-loop structure in the upstream region of the rpoS messenger RNA, occluding the translation initiation site. Clones carrying rprA (RpoS regulator RNA) increased the translation of RpoS. The rprA gene encodes a 106 nucleotide regulatory RNA. As with DsrA Rfam:RF00014, RprA is predicted to form three stem-loops. Thus, at least two small RNAs, DsrA and RprA, par [...]
-synonym: "RprA RNA" EXACT []
-xref: http://en.wikipedia.org/wiki/RprA_RNA "wiki"
-is_a: SO:0000370 ! small_regulatory_ncRNA
-
-[Term]
-id: SO:0000388
-name: RRE_RNA
-def: "The Rev response element (RRE) is encoded within the HIV-env gene. Rev is an essential regulatory protein of HIV that binds an internal loop of the RRE leading, encouraging further Rev-RRE binding. This RNP complex is critical for mRNA export and hence for expression of the HIV structural proteins." [http://www.sanger.ac.uk/cgi-bin/Rfam/getacc?RF00036]
-synonym: "RRE RNA" EXACT []
-is_a: SO:0000370 ! small_regulatory_ncRNA
-
-[Term]
-id: SO:0000389
-name: spot_42_RNA
-def: "A 109-nucleotide RNA of E. coli that seems to have a regulatory role on the galactose operon. Changes in Spot 42 levels are implicated in affecting DNA polymerase I levels." [http://www.sanger.ac.uk/cgi-bin/Rfam/getacc?RF00021]
-synonym: "spot-42 RNA" EXACT []
-xref: http://en.wikipedia.org/wiki/Spot_42_RNA "wiki"
-is_a: SO:0000370 ! small_regulatory_ncRNA
-
-[Term]
-id: SO:0000390
-name: telomerase_RNA
-def: "The RNA component of telomerase, a reverse transcriptase that synthesizes telomeric DNA." [http://www.sanger.ac.uk/cgi-bin/Rfam/getacc?RF00025]
-subset: SOFA
-synonym: "telomerase RNA" EXACT []
-xref: http://en.wikipedia.org/wiki/Telomerase_RNA "wiki"
-is_a: SO:0000655 ! ncRNA
-
-[Term]
-id: SO:0000391
-name: U1_snRNA
-def: "U1 is a small nuclear RNA (snRNA) component of the spliceosome (involved in pre-mRNA splicing). Its 5' end forms complementary base pairs with the 5' splice junction, thus defining the 5' donor site of an intron. There are significant differences in sequence and secondary structure between metazoan and yeast U1 snRNAs, the latter being much longer (568 nucleotides as compared to 164 nucleotides in human). Nevertheless, secondary structure predictions suggest that all U1 snRNAs shar [...]
-subset: SOFA
-synonym: "small nuclear RNA U1" EXACT [RSC:cb]
-synonym: "snRNA U1" EXACT [RSC:cb]
-synonym: "U1 small nuclear RNA" EXACT [RSC:cb]
-synonym: "U1 snRNA" EXACT []
-xref: http://en.wikipedia.org/wiki/U1_snRNA "wiki"
-is_a: SO:0000274 ! snRNA
-
-[Term]
-id: SO:0000392
-name: U2_snRNA
-def: "U2 is a small nuclear RNA (snRNA) component of the spliceosome (involved in pre-mRNA splicing). Complementary binding between U2 snRNA (in an area lying towards the 5' end but 3' to hairpin I) and the branchpoint sequence (BPS) of the intron results in the bulging out of an unpaired adenine, on the BPS, which initiates a nucleophilic attack at the intronic 5' splice site, thus starting the first of two transesterification reactions that mediate splicing." [http://www.sanger.ac.uk/c [...]
-subset: SOFA
-synonym: "small nuclear RNA U2" EXACT [RSC:CB]
-synonym: "snRNA U2" EXACT [RSC:CB]
-synonym: "U2 small nuclear RNA" EXACT [RSC:CB]
-synonym: "U2 snRNA" EXACT []
-xref: http://en.wikipedia.org/wiki/U2_snRNA "wiki"
-is_a: SO:0000274 ! snRNA
-
-[Term]
-id: SO:0000393
-name: U4_snRNA
-def: "U4 small nuclear RNA (U4 snRNA) is a component of the major U2-dependent spliceosome. It forms a duplex with U6, and with each splicing round, it is displaced from U6 (and the spliceosome) in an ATP-dependent manner, allowing U6 to refold and create the active site for splicing catalysis. A recycling process involving protein Prp24 re-anneals U4 and U6." [http://www.sanger.ac.uk/cgi-bin/Rfam/getacc?RF00015]
-subset: SOFA
-synonym: "small nuclear RNA U4" EXACT [RSC:cb]
-synonym: "snRNA U4" EXACT [RSC:cb]
-synonym: "U4 small nuclear RNA" EXACT [RSC:cb]
-synonym: "U4 snRNA" EXACT []
-xref: http://en.wikipedia.org/wiki/U4_snRNA "wiki"
-is_a: SO:0000274 ! snRNA
-
-[Term]
-id: SO:0000394
-name: U4atac_snRNA
-def: "An snRNA required for the splicing of the minor U12-dependent class of eukaryotic nuclear introns. It forms a base paired complex with U6atac_snRNA (SO:0000397)." [PMID:=12409455]
-subset: SOFA
-synonym: "small nuclear RNA U4atac" EXACT [RSC:cb]
-synonym: "snRNA U4atac" EXACT [RSC:cb]
-synonym: "U4atac small nuclear RNA" EXACT [RSC:cb]
-synonym: "U4atac snRNA" EXACT []
-is_a: SO:0000274 ! snRNA
-
-[Term]
-id: SO:0000395
-name: U5_snRNA
-def: "U5 RNA is a component of both types of known spliceosome. The precise function of this molecule is unknown, though it is known that the 5' loop is required for splice site selection and p220 binding, and that both the 3' stem-loop and the Sm site are important for Sm protein binding and cap methylation." [http://www.sanger.ac.uk/cgi-bin/Rfam/getacc?RF00020]
-subset: SOFA
-synonym: "small nuclear RNA U5" EXACT [RSC:cb]
-synonym: "snRNA U5" EXACT [RSC:cb]
-synonym: "U5 small nuclear RNA" EXACT [RSC:cb]
-synonym: "U5 snRNA" EXACT []
-xref: http://en.wikipedia.org/wiki/U5_snRNA "wiki"
-is_a: SO:0000274 ! snRNA
-
-[Term]
-id: SO:0000396
-name: U6_snRNA
-def: "U6 snRNA is a component of the spliceosome which is involved in splicing pre-mRNA. The putative secondary structure consensus base pairing is confined to a short 5' stem loop, but U6 snRNA is thought to form extensive base-pair interactions with U4 snRNA." [http://www.sanger.ac.uk/cgi-bin/Rfam/getacc?RF00015]
-subset: SOFA
-synonym: "small nuclear RNA U6" EXACT [RSC:cb]
-synonym: "snRNA U6" EXACT [RSC:cb]
-synonym: "U6 small nuclear RNA" EXACT [RSC:cb]
-synonym: "U6 snRNA" EXACT []
-xref: http://en.wikipedia.org/wiki/U6_snRNA "wiki"
-is_a: SO:0000274 ! snRNA
-
-[Term]
-id: SO:0000397
-name: U6atac_snRNA
-def: "U6atac_snRNA is an snRNA required for the splicing of the minor U12-dependent class of eukaryotic nuclear introns. It forms a base paired complex with U4atac_snRNA (SO:0000394)." [http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=retrieve&db=pubmed&list_uids=12409455&dopt=Abstract]
-subset: SOFA
-synonym: "snRNA U6atac" EXACT [RSC:cb]
-synonym: "U6atac small nuclear RNA" EXACT [RSC:cb]
-synonym: "U6atac snRNA" EXACT [RSC:cb]
-is_a: SO:0000274 ! snRNA
-
-[Term]
-id: SO:0000398
-name: U11_snRNA
-def: "U11 snRNA plays a role in splicing of the minor U12-dependent class of eukaryotic nuclear introns, similar to U1 snRNA in the major class spliceosome it base pairs to the conserved 5' splice site sequence." [PMID:9622129]
-subset: SOFA
-synonym: "small nuclear RNA U11" EXACT [RSC:cb]
-synonym: "snRNA U11" EXACT [RSC:cb]
-synonym: "U11 small nuclear RNA" EXACT [RSC:cb]
-synonym: "U11 snRNA" EXACT []
-xref: http://en.wikipedia.org/wiki/U11_snRNA "wiki"
-is_a: SO:0000274 ! snRNA
-
-[Term]
-id: SO:0000399
-name: U12_snRNA
-def: "The U12 small nuclear (snRNA), together with U4atac/U6atac, U5, and U11 snRNAs and associated proteins, forms a spliceosome that cleaves a divergent class of low-abundance pre-mRNA introns." [http://www.sanger.ac.uk/cgi-bin/Rfam/getacc?RF00007]
-subset: SOFA
-synonym: "small nuclear RNA U12" EXACT [RSC:cb]
-synonym: "snRNA U12" EXACT [RSC:cb]
-synonym: "U12 small nuclear RNA" EXACT [RSC:cb]
-synonym: "U12 snRNA" EXACT []
-xref: http://en.wikipedia.org/wiki/U12_snRNA "wiki"
-is_a: SO:0000274 ! snRNA
-
-[Term]
-id: SO:0000400
-name: sequence_attribute
-def: "An attribute describes a quality of sequence." [SO:ke]
-synonym: "sequence attribute" EXACT []
-disjoint_from: SO:0000110 ! sequence_feature
-disjoint_from: SO:0000240 ! chromosome_variation
-
-[Term]
-id: SO:0000401
-name: gene_attribute
-synonym: "gene attribute" EXACT []
-is_a: SO:0000733 ! feature_attribute
-
-[Term]
-id: SO:0000402
-name: enhancer_attribute
-is_obsolete: true
-
-[Term]
-id: SO:0000403
-name: U14_snoRNA
-alt_id: SO:0005839
-def: "U14 small nucleolar RNA (U14 snoRNA) is required for early cleavages of eukaryotic precursor rRNAs. In yeasts, this molecule possess a stem-loop region (known as the Y-domain) which is essential for function. A similar structure, but with a different consensus sequence, is found in plants, but is absent in vertebrates." [http://www.sanger.ac.uk/cgi-bin/Rfam/getacc?RF00016, PMID:2551119]
-comment: An evolutionarily conserved eukaryotic low molecular weight RNA capable of intermolecular hybridization with both homologous and heterologous 18S rRNA.
-subset: SOFA
-synonym: "small nucleolar RNA U14" EXACT []
-synonym: "snoRNA U14" EXACT []
-synonym: "U14 small nucleolar RNA" EXACT []
-synonym: "U14 snoRNA" EXACT []
-is_a: SO:0000593 ! C_D_box_snoRNA
-relationship: derives_from SO:0005837 ! U14_snoRNA_primary_transcript
-
-[Term]
-id: SO:0000404
-name: vault_RNA
-def: "A family of RNAs are found as part of the enigmatic vault ribonucleoprotein complex. The complex consists of a major vault protein (MVP), two minor vault proteins (VPARP and TEP1), and several small untranslated RNA molecules. It has been suggested that the vault complex is involved in drug resistance." [http://www.sanger.ac.uk/cgi-bin/Rfam/getacc?RF00006]
-subset: SOFA
-synonym: "vault RNA" EXACT []
-xref: http://en.wikipedia.org/wiki/Vault_RNA "wiki"
-is_a: SO:0000655 ! ncRNA
-
-[Term]
-id: SO:0000405
-name: Y_RNA
-def: "Y RNAs are components of the Ro ribonucleoprotein particle (Ro RNP), in association with Ro60 and La proteins. The Y RNAs and Ro60 and La proteins are well conserved, but the function of the Ro RNP is not known. In humans the RNA component can be one of four small RNAs: hY1, hY3, hY4 and hY5. These small RNAs are predicted to fold into a conserved secondary structure containing three stem structures. The largest of the four, hY1, contains an additional hairpin." [http://www.sanger. [...]
-subset: SOFA
-synonym: "Y RNA" EXACT []
-xref: http://en.wikipedia.org/wiki/Y_RNA "wiki"
-is_a: SO:0000655 ! ncRNA
-
-[Term]
-id: SO:0000406
-name: twintron
-def: "An intron within an intron. Twintrons are group II or III introns, into which another group II or III intron has been transposed." [PMID:1899376, PMID:7823908]
-xref: http://en.wikipedia.org/wiki/Twintron "wiki"
-is_a: SO:0000188 ! intron
-
-[Term]
-id: SO:0000407
-name: rRNA_18S
-def: "A large polynucleotide in eukaryotes, which functions as the small subunit of the ribosome." [SO:ke]
-subset: SOFA
-synonym: "18S ribosomal RNA" EXACT []
-synonym: "18S rRNA" EXACT []
-synonym: "rRNA 18S" EXACT []
-xref: http://en.wikipedia.org/wiki/18S_ribosomal_RNA "wiki"
-is_a: SO:0000650 ! small_subunit_rRNA
-
-[Term]
-id: SO:0000408
-name: site
-def: "The interbase position where something (eg an aberration) occurred." [SO:ke]
-is_obsolete: true
-
-[Term]
-id: SO:0000409
-name: binding_site
-alt_id: BS:00033
-def: "A biological_region of sequence that, in the molecule, interacts selectively and non-covalently with other molecules. A region on the surface of a molecule that may interact with another molecule. When applied to polypeptides: Amino acids involved in binding or interactions. It can also apply to an amino acid bond which is represented by the positions of the two flanking amino acids." [EBIBS:GAR, SO:ke]
-comment: See GO:0005488 : binding.
-subset: biosapiens
-subset: SOFA
-synonym: "binding_or_interaction_site" EXACT []
-synonym: "site" RELATED []
-xref: http://en.wikipedia.org/wiki/Binding_site "wiki"
-is_a: SO:0001411 ! biological_region
-
-[Term]
-id: SO:0000410
-name: protein_binding_site
-def: "A binding site that, in the molecule, interacts selectively and non-covalently with polypeptide molecules." [SO:ke]
-comment: See GO:0042277 : peptide binding.
-subset: SOFA
-synonym: "protein binding site" EXACT []
-is_a: SO:0000409 ! binding_site
-
-[Term]
-id: SO:0000411
-name: rescue_region
-def: "A region that rescues." [SO:xp]
-synonym: "rescue fragment" EXACT []
-synonym: "rescue region" EXACT []
-synonym: "rescue segment" RELATED []
-is_a: SO:0000695 ! implied link automatically realized ! reagent
-intersection_of: SO:0000695 ! reagent
-intersection_of: has_quality SO:0000814 ! rescue
-
-[Term]
-id: SO:0000412
-name: restriction_fragment
-def: "A region of polynucleotide sequence produced by digestion with a restriction endonuclease." [SO:ke]
-subset: SOFA
-synonym: "restriction fragment" EXACT []
-xref: http://en.wikipedia.org/wiki/Restriction_fragment "wiki"
-is_a: SO:0000143 ! assembly_component
-
-[Term]
-id: SO:0000413
-name: sequence_difference
-def: "A region where the sequence differs from that of a specified sequence." [SO:ke]
-subset: SOFA
-synonym: "sequence difference" EXACT []
-is_a: SO:0000700 ! remark
-
-[Term]
-id: SO:0000414
-name: invalidated_by_genomic_contamination
-def: "An attribute to describe a feature that is invalidated due to genomic contamination." [SO:ke]
-synonym: "invalidated by genomic contamination" EXACT []
-is_a: SO:0000790 ! invalidated
-
-[Term]
-id: SO:0000415
-name: invalidated_by_genomic_polyA_primed_cDNA
-def: "An attribute to describe a feature that is invalidated due to polyA priming." [SO:ke]
-synonym: "invalidated by genomic polyA primed cDNA" EXACT []
-is_a: SO:0000790 ! invalidated
-
-[Term]
-id: SO:0000416
-name: invalidated_by_partial_processing
-def: "An attribute to describe a feature that is invalidated due to partial processing." [SO:ke]
-synonym: "invalidated by partial processing" EXACT []
-is_a: SO:0000790 ! invalidated
-
-[Term]
-id: SO:0000417
-name: polypeptide_domain
-alt_id: BS:00012
-alt_id: BS:00134
-alt_id: SO:0001069
-def: "A structurally or functionally defined protein region. In proteins with multiple domains, the combination of the domains determines the function of the protein. A region which has been shown to recur throughout evolution." [EBIBS:GAR]
-comment: Range. Old definition from before biosapiens: A region of a single polypeptide chain that folds into an independent unit and exhibits biological activity. A polypeptide chain may have multiple domains.
-subset: biosapiens
-synonym: "ca_bind" RELATED BS [uniprot:feature_type]
-synonym: "DNA_bind" RELATED BS [uniprot:feature_type]
-synonym: "domain" BROAD BS [uniprot:feature_type]
-synonym: "np_bind" RELATED BS [uniprot:feature_type]
-synonym: "polypeptide domain" EXACT []
-synonym: "polypeptide_structural_domain" EXACT BS []
-synonym: "structural domain" BROAD BS []
-synonym: "zn_fing" RELATED BS [uniprot:feature_type]
-is_a: SO:0001070 ! polypeptide_structural_region
-is_a: SO:0100021 ! polypeptide_conserved_region
-
-[Term]
-id: SO:0000418
-name: signal_peptide
-alt_id: BS:00159
-def: "The signal_peptide is a short region of the peptide located at the N-terminus that directs the protein to be secreted or part of membrane components." [http://www.ebi.ac.uk/embl/Documentation/FT_definitions/feature_table.html]
-comment: Old def before biosapiens:The sequence for an N-terminal domain of a secreted protein; this domain is involved in attaching nascent polypeptide to the membrane leader sequence.
-subset: biosapiens
-subset: SOFA
-synonym: "signal" RELATED [uniprot:feature_type]
-synonym: "signal peptide" EXACT []
-synonym: "signal peptide coding sequence" EXACT []
-xref: http://en.wikipedia.org/wiki/Signal_peptide "wiki"
-is_a: SO:0001527 ! peptide_localization_signal
-relationship: part_of SO:0001062 ! propeptide
-
-[Term]
-id: SO:0000419
-name: mature_protein_region
-alt_id: BS:00149
-def: "The polypeptide sequence that remains when the cleaved peptide regions have been cleaved from the immature peptide." [EBIBS:GAR, http://www.ebi.ac.uk/embl/Documentation/FT_definitions/feature_table.html, SO:cb]
-comment: This term mature peptide, merged with the biosapiens term mature protein region and took that to be the new name. Old def: The coding sequence for the mature or final peptide or protein product following post-translational modification.
-subset: biosapiens
-subset: SOFA
-synonym: "chain" RELATED [uniprot:feature_type]
-synonym: "mature peptide" RELATED []
-synonym: "mature protein region" EXACT []
-is_a: SO:0000839 ! polypeptide_region
-relationship: part_of SO:0001063 ! immature_peptide_region
-
-[Term]
-id: SO:0000420
-name: five_prime_terminal_inverted_repeat
-synonym: "5' TIR" EXACT []
-synonym: "five prime terminal inverted repeat" EXACT []
-is_a: SO:0000481 ! terminal_inverted_repeat
-
-[Term]
-id: SO:0000421
-name: three_prime_terminal_inverted_repeat
-synonym: "3' TIR" EXACT []
-synonym: "three prime terminal inverted repeat" EXACT []
-is_a: SO:0000481 ! terminal_inverted_repeat
-
-[Term]
-id: SO:0000422
-name: U5_LTR_region
-synonym: "U5 long terminal repeat region" EXACT []
-synonym: "U5 LTR region" EXACT []
-is_a: SO:0000848 ! LTR_component
-
-[Term]
-id: SO:0000423
-name: R_LTR_region
-synonym: "R long terminal repeat region" EXACT []
-synonym: "R LTR region" EXACT []
-is_a: SO:0000848 ! LTR_component
-
-[Term]
-id: SO:0000424
-name: U3_LTR_region
-synonym: "U3 long terminal repeat region" EXACT []
-synonym: "U3 LTR region" EXACT []
-is_a: SO:0000848 ! LTR_component
-
-[Term]
-id: SO:0000425
-name: five_prime_LTR
-synonym: "5' long terminal repeat" EXACT []
-synonym: "5' LTR" EXACT []
-synonym: "five prime LTR" EXACT []
-is_a: SO:0000286 ! long_terminal_repeat
-
-[Term]
-id: SO:0000426
-name: three_prime_LTR
-synonym: "3' long terminal repeat" EXACT []
-synonym: "3' LTR" EXACT []
-synonym: "three prime LTR" EXACT []
-is_a: SO:0000286 ! long_terminal_repeat
-
-[Term]
-id: SO:0000427
-name: R_five_prime_LTR_region
-synonym: "R 5' long term repeat region" EXACT []
-synonym: "R five prime LTR region" EXACT []
-is_a: SO:0000423 ! R_LTR_region
-is_a: SO:0000850 ! five_prime_LTR_component
-
-[Term]
-id: SO:0000428
-name: U5_five_prime_LTR_region
-synonym: "U5 5' long terminal repeat region" EXACT []
-synonym: "U5 five prime LTR region" EXACT []
-is_a: SO:0000422 ! U5_LTR_region
-is_a: SO:0000850 ! five_prime_LTR_component
-
-[Term]
-id: SO:0000429
-name: U3_five_prime_LTR_region
-synonym: "U3 5' long term repeat region" EXACT []
-synonym: "U3 five prime LTR region" EXACT []
-is_a: SO:0000424 ! U3_LTR_region
-is_a: SO:0000850 ! five_prime_LTR_component
-
-[Term]
-id: SO:0000430
-name: R_three_prime_LTR_region
-synonym: "R 3' long terminal repeat region" EXACT []
-synonym: "R three prime LTR region" EXACT []
-is_a: SO:0000849 ! three_prime_LTR_component
-
-[Term]
-id: SO:0000431
-name: U3_three_prime_LTR_region
-synonym: "U3 3' long terminal repeat region" EXACT []
-synonym: "U3 three prime LTR region" EXACT []
-is_a: SO:0000849 ! three_prime_LTR_component
-
-[Term]
-id: SO:0000432
-name: U5_three_prime_LTR_region
-synonym: "U5 3' long terminal repeat region" EXACT []
-synonym: "U5 three prime LTR region" EXACT []
-is_a: SO:0000849 ! three_prime_LTR_component
-
-[Term]
-id: SO:0000433
-name: non_LTR_retrotransposon_polymeric_tract
-def: "A polymeric tract, such as poly(dA), within a non_LTR_retrotransposon." [SO:ke]
-synonym: "non LTR retrotransposon polymeric tract" EXACT []
-is_a: SO:0000657 ! repeat_region
-is_a: SO:0000840 ! repeat_component
-relationship: part_of SO:0000189 ! non_LTR_retrotransposon
-
-[Term]
-id: SO:0000434
-name: target_site_duplication
-def: "A sequence of the target DNA that is duplicated when a transposable element or phage inserts; usually found at each end the insertion." [http://www.koko.gov.my/CocoaBioTech/Glossaryt.html]
-synonym: "target site duplication" EXACT []
-is_a: SO:0000314 ! direct_repeat
-intersection_of: SO:0000314 ! direct_repeat
-intersection_of: derives_from SO:0000101 ! transposable_element
-relationship: derives_from SO:0000101 ! transposable_element
-
-[Term]
-id: SO:0000435
-name: RR_tract
-def: "A polypurine tract within an LTR_retrotransposon." [SO:ke]
-synonym: "LTR retrotransposon poly purine tract" RELATED []
-synonym: "RR tract" EXACT []
-is_a: SO:0000330 ! conserved_region
-relationship: part_of SO:0000186 ! LTR_retrotransposon
-
-[Term]
-id: SO:0000436
-name: ARS
-def: "A sequence that can autonomously replicate, as a plasmid, when transformed into a bacterial host." [SO:ma]
-subset: SOFA
-synonym: "autonomously replicating sequence" EXACT []
-is_a: SO:0000296 ! origin_of_replication
-
-[Term]
-id: SO:0000437
-name: assortment_derived_duplication
-is_obsolete: true
-
-[Term]
-id: SO:0000438
-name: gene_not_polyadenylated
-is_obsolete: true
-
-[Term]
-id: SO:0000439
-name: inverted_ring_chromosome
-synonym: "inverted ring chromosome" EXACT []
-is_a: SO:1000030 ! chromosomal_inversion
-is_a: SO:1000045 ! ring_chromosome
-
-[Term]
-id: SO:0000440
-name: vector_replicon
-def: "A replicon that has been modified to act as a vector for foreign sequence." [SO:ma]
-comment: This term is mapped to MGED. Do not obsolete without consulting MGED ontology.
-synonym: "vector" EXACT []
-synonym: "vector replicon" EXACT []
-xref: http://en.wikipedia.org/wiki/Vector_(molecular_biology) "wiki"
-is_a: SO:0001235 ! replicon
-relationship: part_of SO:0000151 ! clone
-
-[Term]
-id: SO:0000441
-name: ss_oligo
-def: "A single stranded oligonucleotide." [SO:ke]
-comment: This term is mapped to MGED. Do not obsolete without consulting MGED ontology.
-subset: SOFA
-synonym: "single strand oligo" EXACT []
-synonym: "single strand oligonucleotide" EXACT []
-synonym: "single stranded oligonucleotide" EXACT []
-synonym: "ss oligo" EXACT []
-synonym: "ss oligonucleotide" EXACT []
-is_a: SO:0000696 ! oligo
-
-[Term]
-id: SO:0000442
-name: ds_oligo
-def: "A double stranded oligonucleotide." [SO:ke]
-comment: This term is mapped to MGED. Do not obsolete without consulting MGED ontology.
-subset: SOFA
-synonym: "double stranded oligonucleotide" EXACT []
-synonym: "ds oligo" EXACT []
-synonym: "ds-oligonucleotide" EXACT []
-is_a: SO:0000696 ! oligo
-
-[Term]
-id: SO:0000443
-name: polymer_attribute
-def: "An attribute to describe the kind of biological sequence." [SO:ke]
-synonym: "polymer attribute" EXACT []
-is_a: SO:0000400 ! sequence_attribute
-
-[Term]
-id: SO:0000444
-name: three_prime_noncoding_exon
-def: "Non-coding exon in the 3' UTR." [SO:ke]
-synonym: "three prime noncoding exon" EXACT []
-is_a: SO:0000198 ! noncoding_exon
-
-[Term]
-id: SO:0000445
-name: five_prime_noncoding_exon
-def: "Non-coding exon in the 5' UTR." [SO:ke]
-synonym: "5' nc exon" EXACT []
-synonym: "5' non coding exon" EXACT []
-synonym: "five prime noncoding exon" EXACT []
-is_a: SO:0000198 ! noncoding_exon
-
-[Term]
-id: SO:0000446
-name: UTR_intron
-def: "Intron located in the untranslated region." [SO:ke]
-synonym: "UTR intron" EXACT []
-is_a: SO:0000188 ! intron
-
-[Term]
-id: SO:0000447
-name: five_prime_UTR_intron
-def: "An intron located in the 5' UTR." [SO:ke]
-synonym: "five prime UTR intron" EXACT []
-is_a: SO:0000446 ! UTR_intron
-
-[Term]
-id: SO:0000448
-name: three_prime_UTR_intron
-def: "An intron located in the 3' UTR." [SO:ke]
-synonym: "three prime UTR intron" EXACT []
-is_a: SO:0000446 ! UTR_intron
-
-[Term]
-id: SO:0000449
-name: random_sequence
-def: "A sequence of nucleotides or amino acids which, by design, has a \"random\" order of components, given a predetermined input frequency of these components." [SO:ma]
-synonym: "random sequence" EXACT []
-is_a: SO:0000351 ! synthetic_sequence
-
-[Term]
-id: SO:0000450
-name: interband
-def: "A light region between two darkly staining bands in a polytene chromosome." [SO:ma]
-synonym: "chromosome interband" RELATED []
-is_a: SO:0000830 ! chromosome_part
-
-[Term]
-id: SO:0000451
-name: gene_with_polyadenylated_mRNA
-def: "A gene that encodes a polyadenylated mRNA." [SO:xp]
-synonym: "gene with polyadenylated mRNA" EXACT []
-is_a: SO:0001217 ! implied link automatically realized ! protein_coding_gene
-intersection_of: SO:0001217 ! protein_coding_gene
-intersection_of: transcribed_to SO:0000871 ! polyadenylated_mRNA
-
-[Term]
-id: SO:0000452
-name: transgene_attribute
-is_obsolete: true
-
-[Term]
-id: SO:0000453
-name: chromosomal_transposition
-def: "A chromosome structure variant whereby a region of a chromosome has been transferred to another position. Among interchromosomal rearrangements, the term transposition is reserved for that class in which the telomeres of the chromosomes involved are coupled (that is to say, form the two ends of a single DNA molecule) as in wild-type." [FB:reference_manual, SO:ke]
-synonym: "chromosomal transposition" EXACT []
-synonym: "transposition" NARROW []
-is_a: SO:1000183 ! chromosome_structure_variation
-
-[Term]
-id: SO:0000454
-name: rasiRNA
-def: "A 17-28-nt, small interfering RNA derived from transcripts of repetitive elements." [http://www.developmentalcell.com/content/article/abstract?uid=PIIS1534580703002284]
-subset: SOFA
-synonym: "repeat associated small interfering RNA" EXACT []
-xref: http://en.wikipedia.org/wiki/RasiRNA "wiki"
-is_a: SO:0000655 ! ncRNA
-
-[Term]
-id: SO:0000455
-name: gene_with_mRNA_with_frameshift
-def: "A gene that encodes an mRNA with a frameshift." [SO:xp]
-synonym: "gene with mRNA with frameshift" EXACT []
-is_a: SO:0001217 ! implied link automatically realized ! protein_coding_gene
-intersection_of: SO:0001217 ! protein_coding_gene
-intersection_of: has_quality SO:0000865 ! frameshift
-
-[Term]
-id: SO:0000456
-name: recombinationally_rearranged_gene
-def: "A gene that is recombinationally rearranged." [SO:ke]
-synonym: "recombinationally rearranged gene" EXACT []
-is_a: SO:0000704 ! implied link automatically realized ! gene
-intersection_of: SO:0000704 ! gene
-intersection_of: has_quality SO:0000940 ! recombinationally_rearranged
-
-[Term]
-id: SO:0000457
-name: interchromosomal_duplication
-def: "A chromosome duplication involving an insertion from another chromosome." [SO:ke]
-synonym: "interchromosomal duplication" EXACT []
-is_a: SO:1000037 ! chromosomal_duplication
-
-[Term]
-id: SO:0000458
-name: D_gene_segment
-def: "Germline genomic DNA including D-region with 5' UTR and 3' UTR, also designated as D-segment." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "D gene" EXACT []
-synonym: "D-GENE" EXACT []
-is_a: SO:0000460 ! vertebrate_immunoglobulin_T_cell_receptor_segment
-
-[Term]
-id: SO:0000459
-name: gene_with_trans_spliced_transcript
-def: "A gene with a transcript that is trans-spliced." [SO:xp]
-synonym: "gene with trans spliced transcript" EXACT []
-is_a: SO:0000704 ! implied link automatically realized ! gene
-intersection_of: SO:0000704 ! gene
-intersection_of: transcribed_to SO:0000479 ! trans_spliced_transcript
-
-[Term]
-id: SO:0000460
-name: vertebrate_immunoglobulin_T_cell_receptor_segment
-comment: I am using the term segment instead of gene here to avoid confusion with the region 'gene'.
-synonym: "vertebrate immunoglobulin T cell receptor segment" EXACT []
-synonym: "vertebrate_immunoglobulin/T-cell receptor gene" EXACT []
-is_a: SO:0000301 ! vertebrate_immune_system_gene_recombination_feature
-
-[Term]
-id: SO:0000461
-name: inversion_derived_bipartite_deficiency
-def: "A chromosomal deletion whereby a chromosome generated by recombination between two inversions; has a deficiency at each end of the inversion." [FB:km]
-synonym: "inversion derived bipartite deficiency" EXACT []
-is_a: SO:1000029 ! chromosomal_deletion
-
-[Term]
-id: SO:0000462
-name: pseudogenic_region
-def: "A non-functional descendent of a functional entity." [SO:cjm]
-subset: SOFA
-synonym: "pseudogenic region" EXACT []
-is_a: SO:0001411 ! biological_region
-
-[Term]
-id: SO:0000463
-name: encodes_alternately_spliced_transcripts
-def: "A gene that encodes more than one transcript." [SO:ke]
-synonym: "encodes alternately spliced transcripts" EXACT []
-is_a: SO:0000401 ! gene_attribute
-
-[Term]
-id: SO:0000464
-name: decayed_exon
-def: "A non-functional descendant of an exon." [SO:ke]
-subset: SOFA
-synonym: "decayed exon" EXACT []
-is_a: SO:0000462 ! pseudogenic_region
-relationship: non_functional_homolog_of SO:0000147 ! exon
-
-[Term]
-id: SO:0000465
-name: inversion_derived_deficiency_plus_duplication
-def: "A chromosome deletion whereby a chromosome is generated by recombination between two inversions; there is a deficiency at one end of the inversion and a duplication at the other end of the inversion." [FB:km]
-synonym: "inversion derived deficiency plus duplication" EXACT []
-is_a: SO:1000029 ! chromosomal_deletion
-is_a: SO:1000038 ! intrachromosomal_duplication
-
-[Term]
-id: SO:0000466
-name: V_gene_segment
-def: "Germline genomic DNA including L-part1, V-intron and V-exon, with the 5' UTR and 3' UTR." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "V gene" EXACT []
-synonym: "V-GENE" EXACT []
-synonym: "variable_gene" EXACT []
-is_a: SO:0000460 ! vertebrate_immunoglobulin_T_cell_receptor_segment
-
-[Term]
-id: SO:0000467
-name: post_translationally_regulated_by_protein_stability
-def: "An attribute describing a gene sequence where the resulting protein is regulated by the stability of the resulting protein." [SO:ke]
-synonym: "post translationally regulated by protein stability" EXACT []
-synonym: "post-translationally regulated by protein stability" EXACT []
-is_a: SO:0000130 ! post_translationally_regulated
-
-[Term]
-id: SO:0000468
-name: golden_path_fragment
-def: "One of the pieces of sequence that make up a golden path." [SO:rd]
-subset: SOFA
-synonym: "golden path fragment" EXACT []
-is_a: SO:0000143 ! assembly_component
-relationship: part_of SO:0000688 ! golden_path
-
-[Term]
-id: SO:0000469
-name: post_translationally_regulated_by_protein_modification
-def: "An attribute describing a gene sequence where the resulting protein is modified to regulate it." [SO:ke]
-synonym: "post translationally regulated by protein modification" EXACT []
-synonym: "post-translationally regulated by protein modification" EXACT []
-is_a: SO:0000130 ! post_translationally_regulated
-
-[Term]
-id: SO:0000470
-name: J_gene_segment
-def: "Germline genomic DNA of an immunoglobulin/T-cell receptor gene including J-region with 5' UTR (SO:0000204) and 3' UTR (SO:0000205), also designated as J-segment." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "J gene" EXACT []
-synonym: "J-GENE" EXACT []
-is_a: SO:0000460 ! vertebrate_immunoglobulin_T_cell_receptor_segment
-
-[Term]
-id: SO:0000471
-name: autoregulated
-def: "The gene product is involved in its own transcriptional regulation." [SO:ke]
-is_a: SO:0000123 ! transcriptionally_regulated
-
-[Term]
-id: SO:0000472
-name: tiling_path
-def: "A set of regions which overlap with minimal polymorphism to form a linear sequence." [SO:cjm]
-subset: SOFA
-synonym: "tiling path" EXACT []
-is_a: SO:0000353 ! sequence_assembly
-
-[Term]
-id: SO:0000473
-name: negatively_autoregulated
-def: "The gene product is involved in its own transcriptional regulation where it decreases transcription." [SO:ke]
-synonym: "negatively autoregulated" EXACT []
-is_a: SO:0000126 ! transcriptionally_repressed
-is_a: SO:0000471 ! autoregulated
-
-[Term]
-id: SO:0000474
-name: tiling_path_fragment
-def: "A piece of sequence that makes up a tiling_path (SO:0000472)." [SO:ke]
-subset: SOFA
-synonym: "tiling path fragment" EXACT []
-is_a: SO:0000143 ! assembly_component
-relationship: part_of SO:0000472 ! tiling_path
-
-[Term]
-id: SO:0000475
-name: positively_autoregulated
-def: "The gene product is involved in its own transcriptional regulation, where it increases transcription." [SO:ke]
-synonym: "positively autoregulated" EXACT []
-is_a: SO:0000125 ! transcriptionally_induced
-is_a: SO:0000471 ! autoregulated
-
-[Term]
-id: SO:0000476
-name: contig_read
-def: "A DNA sequencer read which is part of a contig." [SO:ke]
-synonym: "contig read" EXACT []
-is_a: SO:0000150 ! read
-
-[Term]
-id: SO:0000477
-name: polycistronic_gene
-def: "A gene that is polycistronic." [SO:ke]
-is_obsolete: true
-
-[Term]
-id: SO:0000478
-name: C_gene_segment
-def: "Genomic DNA of immunoglobulin/T-cell receptor gene including C-region (and introns if present) with 5' UTR (SO:0000204) and 3' UTR (SO:0000205)." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "C gene" EXACT []
-synonym: "C_GENE" EXACT []
-synonym: "constant gene" EXACT []
-is_a: SO:0000460 ! vertebrate_immunoglobulin_T_cell_receptor_segment
-
-[Term]
-id: SO:0000479
-name: trans_spliced_transcript
-def: "A transcript that is trans-spliced." [SO:xp]
-synonym: "trans spliced transcript" EXACT []
-synonym: "trans-spliced transcript" EXACT []
-is_a: SO:0000673 ! implied link automatically realized ! transcript
-intersection_of: SO:0000673 ! transcript
-intersection_of: has_quality SO:0000870 ! trans_spliced
-
-[Term]
-id: SO:0000480
-name: tiling_path_clone
-def: "A clone which is part of a tiling path. A tiling path is a set of sequencing substrates, typically clones, which have been selected in order to efficiently cover a region of the genome in preparation for sequencing and assembly." [SO:ke]
-synonym: "tiling path clone" EXACT []
-is_a: SO:0000151 ! clone
-is_a: SO:0000474 ! tiling_path_fragment
-
-[Term]
-id: SO:0000481
-name: terminal_inverted_repeat
-def: "An inverted repeat (SO:0000294) occurring at the termini of a DNA transposon." [SO:ke]
-synonym: "terminal inverted repeat" EXACT []
-synonym: "TIR" EXACT []
-is_a: SO:0000294 ! inverted_repeat
-relationship: part_of SO:0000208 ! terminal_inverted_repeat_element
-
-[Term]
-id: SO:0000482
-name: vertebrate_immunoglobulin_T_cell_receptor_gene_cluster
-synonym: "vertebrate immunoglobulin T cell receptor gene cluster" EXACT []
-synonym: "vertebrate_immunoglobulin/T-cell receptor gene cluster" EXACT []
-is_a: SO:0000301 ! vertebrate_immune_system_gene_recombination_feature
-
-[Term]
-id: SO:0000483
-name: nc_primary_transcript
-def: "A primary transcript that is never translated into a protein." [SO:ke]
-subset: SOFA
-synonym: "nc primary transcript" EXACT []
-synonym: "noncoding primary transcript" EXACT []
-is_a: SO:0000185 ! primary_transcript
-
-[Term]
-id: SO:0000484
-name: three_prime_coding_exon_noncoding_region
-def: "The sequence of the 3' exon that is not coding." [SO:ke]
-subset: SOFA
-synonym: "three prime coding exon noncoding region" EXACT []
-synonym: "three_prime_exon_noncoding_region" EXACT []
-is_a: SO:0001214 ! noncoding_region_of_exon
-relationship: part_of SO:0000202 ! three_prime_coding_exon
-
-[Term]
-id: SO:0000485
-name: DJ_J_cluster
-def: "Genomic DNA of immunoglobulin/T-cell receptor gene in rearranged configuration including at least one DJ-gene, and one J-gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "(DJ)-J-CLUSTER" EXACT []
-synonym: "DJ J cluster" EXACT []
-is_a: SO:0000938 ! vertebrate_immunoglobulin_T_cell_receptor_rearranged_gene_cluster
-relationship: has_part SO:0000470 ! J_gene_segment
-relationship: has_part SO:0000572 ! DJ_gene_segment
-
-[Term]
-id: SO:0000486
-name: five_prime_coding_exon_noncoding_region
-def: "The sequence of the 5' exon preceding the start codon." [SO:ke]
-subset: SOFA
-synonym: "five prime coding exon noncoding region" EXACT []
-synonym: "five_prime_exon_noncoding_region" EXACT []
-is_a: SO:0001214 ! noncoding_region_of_exon
-relationship: part_of SO:0000200 ! five_prime_coding_exon
-
-[Term]
-id: SO:0000487
-name: VDJ_J_C_cluster
-def: "Genomic DNA of immunoglobulin/T-cell receptor gene in rearranged configuration including at least one VDJ-gene, one J-gene and one C-gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "(VDJ)-J-C-CLUSTER" EXACT []
-synonym: "VDJ J C cluster" EXACT []
-is_a: SO:0000938 ! vertebrate_immunoglobulin_T_cell_receptor_rearranged_gene_cluster
-relationship: has_part SO:0000470 ! J_gene_segment
-relationship: has_part SO:0000478 ! C_gene_segment
-relationship: has_part SO:0000574 ! VDJ_gene_segment
-
-[Term]
-id: SO:0000488
-name: VDJ_J_cluster
-def: "Genomic DNA of immunoglobulin/T-cell receptor gene in rearranged configuration including at least one VDJ-gene and one J-gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "(VDJ)-J-CLUSTER" EXACT []
-synonym: "VDJ J cluster" EXACT []
-is_a: SO:0000938 ! vertebrate_immunoglobulin_T_cell_receptor_rearranged_gene_cluster
-relationship: has_part SO:0000470 ! J_gene_segment
-relationship: has_part SO:0000574 ! VDJ_gene_segment
-
-[Term]
-id: SO:0000489
-name: VJ_C_cluster
-def: "Genomic DNA of immunoglobulin/T-cell receptor gene in rearranged configuration including at least one VJ-gene and one C-gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "(VJ)-C-CLUSTER" RELATED []
-synonym: "VJ C cluster" EXACT []
-is_a: SO:0000938 ! vertebrate_immunoglobulin_T_cell_receptor_rearranged_gene_cluster
-relationship: has_part SO:0000478 ! C_gene_segment
-relationship: has_part SO:0000576 ! VJ_gene_segment
-
-[Term]
-id: SO:0000490
-name: VJ_J_C_cluster
-def: "Genomic DNA of immunoglobulin/T-cell receptor gene in rearranged configuration including at least one VJ-gene, one J-gene and one C-gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "(VJ)-J-C-CLUSTER" EXACT []
-synonym: "VJ J C cluster" EXACT []
-is_a: SO:0000938 ! vertebrate_immunoglobulin_T_cell_receptor_rearranged_gene_cluster
-relationship: has_part SO:0000470 ! J_gene_segment
-relationship: has_part SO:0000478 ! C_gene_segment
-relationship: has_part SO:0000576 ! VJ_gene_segment
-
-[Term]
-id: SO:0000491
-name: VJ_J_cluster
-def: "Genomic DNA of immunoglobulin/T-cell receptor gene in rearranged configuration including at least one VJ-gene and one J-gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "(VJ)-J-CLUSTER" EXACT []
-synonym: "VJ J cluster" EXACT []
-is_a: SO:0000938 ! vertebrate_immunoglobulin_T_cell_receptor_rearranged_gene_cluster
-relationship: has_part SO:0000470 ! J_gene_segment
-relationship: has_part SO:0000576 ! VJ_gene_segment
-
-[Term]
-id: SO:0000492
-name: D_gene_recombination_feature
-synonym: "D gene recombination feature" EXACT []
-is_a: SO:0000939 ! vertebrate_immune_system_gene_recombination_signal_feature
-
-[Term]
-id: SO:0000493
-name: three_prime_D_heptamer
-def: "7 nucleotide recombination site like CACAGTG, part of a 3' D-recombination signal sequence of an immunoglobulin/T-cell receptor gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "3'D-HEPTAMER" EXACT []
-synonym: "three prime D heptamer" EXACT []
-is_a: SO:0000561 ! heptamer_of_recombination_feature_of_vertebrate_immune_system_gene
-relationship: part_of SO:0000570 ! three_prime_D_recombination_signal_sequence
-
-[Term]
-id: SO:0000494
-name: three_prime_D_nonamer
-def: "A 9 nucleotide recombination site (e.g. ACAAAAACC), part of a 3' D-recombination signal sequence of an immunoglobulin/T-cell receptor gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "3'D-NOMAMER" EXACT []
-synonym: "three prime D nonamer" EXACT []
-is_a: SO:0000562 ! nonamer_of_recombination_feature_of_vertebrate_immune_system_gene
-relationship: part_of SO:0000570 ! three_prime_D_recombination_signal_sequence
-
-[Term]
-id: SO:0000495
-name: three_prime_D_spacer
-def: "A 12 or 23 nucleotide spacer between the 3'D-HEPTAMER and 3'D-NONAMER of a 3'D-RS." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "3'D-SPACER" EXACT []
-synonym: "three prime D spacer" EXACT []
-is_a: SO:0000563 ! vertebrate_immune_system_gene_recombination_spacer
-relationship: part_of SO:0000570 ! three_prime_D_recombination_signal_sequence
-
-[Term]
-id: SO:0000496
-name: five_prime_D_heptamer
-def: "7 nucleotide recombination site (e.g. CACTGTG), part of a 5' D-recombination signal sequence (SO:0000556) of an immunoglobulin/T-cell receptor gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "5'D-HEPTAMER" EXACT []
-synonym: "five prime D heptamer" EXACT []
-is_a: SO:0000561 ! heptamer_of_recombination_feature_of_vertebrate_immune_system_gene
-relationship: part_of SO:0000556 ! five_prime_D_recombination_signal_sequence
-
-[Term]
-id: SO:0000497
-name: five_prime_D_nonamer
-def: "9 nucleotide recombination site (e.g. GGTTTTTGT), part of a five_prime_D-recombination signal sequence (SO:0000556) of an immunoglobulin/T-cell receptor gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "5'D-NONAMER" EXACT []
-synonym: "five prime D nonamer" EXACT []
-is_a: SO:0000562 ! nonamer_of_recombination_feature_of_vertebrate_immune_system_gene
-relationship: part_of SO:0000556 ! five_prime_D_recombination_signal_sequence
-
-[Term]
-id: SO:0000498
-name: five_prime_D_spacer
-def: "12 or 23 nucleotide spacer between the 5' D-heptamer (SO:0000496) and 5' D-nonamer (SO:0000497) of a 5' D-recombination signal sequence (SO:0000556) of an immunoglobulin/T-cell receptor gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "5'-SPACER" EXACT []
-synonym: "five prime D spacer" EXACT []
-synonym: "five prime D-spacer" EXACT []
-is_a: SO:0000563 ! vertebrate_immune_system_gene_recombination_spacer
-relationship: part_of SO:0000556 ! five_prime_D_recombination_signal_sequence
-
-[Term]
-id: SO:0000499
-name: virtual_sequence
-def: "A continuous piece of sequence similar to the 'virtual contig' concept of the Ensembl database." [SO:ke]
-subset: SOFA
-synonym: "virtual sequence" EXACT []
-is_a: SO:0000353 ! sequence_assembly
-
-[Term]
-id: SO:0000500
-name: Hoogsteen_base_pair
-def: "A type of non-canonical base-pairing. This is less energetically favourable than watson crick base pairing. Hoogsteen GC base pairs only have two hydrogen bonds." [PMID:12177293]
-synonym: "Hoogsteen base pair" EXACT []
-xref: http://en.wikipedia.org/wiki/Hoogsteen_base_pair "wiki"
-is_a: SO:0000028 ! base_pair
-
-[Term]
-id: SO:0000501
-name: reverse_Hoogsteen_base_pair
-def: "A type of non-canonical base-pairing." [SO:ke]
-synonym: "reverse Hoogsteen base pair" EXACT []
-is_a: SO:0000028 ! base_pair
-
-[Term]
-id: SO:0000502
-name: transcribed_region
-def: "A region of sequence that is transcribed. This region may cover the transcript of a gene, it may emcompas the sequence covered by all of the transcripts of a alternately spliced gene, or it may cover the region transcribed by a polycistronic transcript. A gene may have 1 or more transcribed regions and a transcribed_region may belong to one or more genes." [SO:ke]
-comment: This concept cam about as a direct result of the SO meeting August 2004.nThe exact nature of the relationship between transcribed_region and gene is still up for discussion. We are going with 'associated_with' for the time being.
-subset: SOFA
-is_obsolete: true
-
-[Term]
-id: SO:0000503
-name: alternately_spliced_gene_encodeing_one_transcript
-is_obsolete: true
-
-[Term]
-id: SO:0000504
-name: D_DJ_C_cluster
-def: "Genomic DNA of immunoglobulin/T-cell receptor gene in rearranged configuration including at least one D-gene, one DJ-gene and one C-gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "D DJ C cluster" EXACT []
-synonym: "D-(DJ)-C-CLUSTER" EXACT []
-is_a: SO:0000938 ! vertebrate_immunoglobulin_T_cell_receptor_rearranged_gene_cluster
-relationship: has_part SO:0000458 ! D_gene_segment
-relationship: has_part SO:0000478 ! C_gene_segment
-relationship: has_part SO:0000572 ! DJ_gene_segment
-
-[Term]
-id: SO:0000505
-name: D_DJ_cluster
-def: "Genomic DNA of immunoglobulin/T-cell receptor gene in rearranged configuration including at least one D-gene and one DJ-gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "D DJ cluster" EXACT []
-synonym: "D-(DJ)-CLUSTER" EXACT []
-is_a: SO:0000938 ! vertebrate_immunoglobulin_T_cell_receptor_rearranged_gene_cluster
-relationship: has_part SO:0000458 ! D_gene_segment
-relationship: has_part SO:0000572 ! DJ_gene_segment
-
-[Term]
-id: SO:0000506
-name: D_DJ_J_C_cluster
-def: "Genomic DNA of immunoglobulin/T-cell receptor gene in rearranged configuration including at least one D-gene, one DJ-gene, one J-gene and one C-gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "D DJ J C cluster" EXACT []
-synonym: "D-(DJ)-J-C-CLUSTER" EXACT []
-is_a: SO:0000938 ! vertebrate_immunoglobulin_T_cell_receptor_rearranged_gene_cluster
-relationship: has_part SO:0000458 ! D_gene_segment
-relationship: has_part SO:0000470 ! J_gene_segment
-relationship: has_part SO:0000478 ! C_gene_segment
-relationship: has_part SO:0000572 ! DJ_gene_segment
-
-[Term]
-id: SO:0000507
-name: pseudogenic_exon
-def: "A non functional descendant of an exon, part of a pseudogene." [SO:ke]
-comment: This is the analog of the exon of a functional gene. The term was requested by Rama - SGD to allow the annotation of the parts of a pseudogene. Non-functional is defined as either its transcription or translation (or both) are prevented due to one or more mutations.
-synonym: "pseudogenic exon" EXACT []
-is_a: SO:0000462 ! pseudogenic_region
-relationship: non_functional_homolog_of SO:0000147 ! exon
-relationship: part_of SO:0000516 ! pseudogenic_transcript
-
-[Term]
-id: SO:0000508
-name: D_DJ_J_cluster
-def: "Genomic DNA of immunoglobulin/T-cell receptor gene in rearranged configuration including at least one D-gene, one DJ-gene, and one J-gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "D DJ J cluster" EXACT []
-synonym: "D-(DJ)-J-CLUSTER" EXACT []
-is_a: SO:0000938 ! vertebrate_immunoglobulin_T_cell_receptor_rearranged_gene_cluster
-relationship: has_part SO:0000458 ! D_gene_segment
-relationship: has_part SO:0000470 ! J_gene_segment
-relationship: has_part SO:0000572 ! DJ_gene_segment
-
-[Term]
-id: SO:0000509
-name: D_J_C_cluster
-def: "Genomic DNA of immunoglobulin/T-cell receptor gene in germline configuration including at least one D-gene, one J-gene and one C-gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "D J C cluster" EXACT []
-synonym: "D-J-C-CLUSTER" EXACT []
-is_a: SO:0000482 ! vertebrate_immunoglobulin_T_cell_receptor_gene_cluster
-relationship: has_part SO:0000458 ! D_gene_segment
-relationship: has_part SO:0000470 ! J_gene_segment
-relationship: has_part SO:0000478 ! C_gene_segment
-
-[Term]
-id: SO:0000510
-name: VD_gene_segment
-def: "Genomic DNA of immunoglobulin/T-cell receptor gene in partially rearranged genomic DNA including L-part1, V-intron and V-D-exon, with the 5' UTR (SO:0000204) and 3' UTR (SO:0000205)." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "V_D_GENE" EXACT []
-synonym: "VD gene" EXACT []
-is_a: SO:0000936 ! vertebrate_immunoglobulin_T_cell_receptor_rearranged_segment
-
-[Term]
-id: SO:0000511
-name: J_C_cluster
-def: "Genomic DNA of immunoglobulin/T-cell receptor gene in germline configuration including at least one J-gene and one C-gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "J C cluster" EXACT []
-synonym: "J-C-CLUSTER" EXACT []
-is_a: SO:0000482 ! vertebrate_immunoglobulin_T_cell_receptor_gene_cluster
-relationship: has_part SO:0000470 ! J_gene_segment
-relationship: has_part SO:0000478 ! C_gene_segment
-
-[Term]
-id: SO:0000512
-name: inversion_derived_deficiency_plus_aneuploid
-def: "A chromosomal deletion whereby a chromosome generated by recombination between two inversions; has a deficiency at one end and presumed to have a deficiency or duplication at the other end of the inversion." [FB:km]
-synonym: "inversion derived deficiency plus aneuploid" EXACT []
-is_a: SO:1000029 ! chromosomal_deletion
-
-[Term]
-id: SO:0000513
-name: J_cluster
-def: "Genomic DNA of immunoglobulin/T-cell receptor gene in germline configuration including more than one J-gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "J cluster" EXACT []
-synonym: "J-CLUSTER" EXACT []
-is_a: SO:0000482 ! vertebrate_immunoglobulin_T_cell_receptor_gene_cluster
-relationship: has_part SO:0000470 ! J_gene_segment
-
-[Term]
-id: SO:0000514
-name: J_nonamer
-def: "9 nucleotide recombination site (e.g. GGTTTTTGT), part of a J-gene recombination feature of an immunoglobulin/T-cell receptor gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "J nonamer" EXACT []
-synonym: "J-NONAMER" EXACT []
-is_a: SO:0000562 ! nonamer_of_recombination_feature_of_vertebrate_immune_system_gene
-relationship: part_of SO:0000302 ! J_gene_recombination_feature
-
-[Term]
-id: SO:0000515
-name: J_heptamer
-def: "7 nucleotide recombination site (e.g. CACAGTG), part of a J-gene recombination feature of an immunoglobulin/T-cell receptor gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "J heptamer" EXACT []
-synonym: "J-HEPTAMER" EXACT []
-is_a: SO:0000561 ! heptamer_of_recombination_feature_of_vertebrate_immune_system_gene
-relationship: part_of SO:0000302 ! J_gene_recombination_feature
-
-[Term]
-id: SO:0000516
-name: pseudogenic_transcript
-def: "A non functional descendant of a transcript, part of a pseudogene." [SO:ke]
-comment: This is the analog of the transcript of a functional gene. The term was requested by Rama - SGD to allow the annotation of the parts of a pseudogene. Non-functional is defined as either its transcription or translation (or both) are prevented due to one or more mutations.
-synonym: "pseudogenic transcript" EXACT []
-is_a: SO:0000462 ! pseudogenic_region
-relationship: non_functional_homolog_of SO:0000673 ! transcript
-relationship: part_of SO:0000336 ! pseudogene
-
-[Term]
-id: SO:0000517
-name: J_spacer
-def: "12 or 23 nucleotide spacer between the J-nonamer and the J-heptamer of a J-gene recombination feature of an immunoglobulin/T-cell receptor gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "J spacer" EXACT []
-synonym: "J-SPACER" EXACT []
-is_a: SO:0000563 ! vertebrate_immune_system_gene_recombination_spacer
-relationship: part_of SO:0000302 ! J_gene_recombination_feature
-
-[Term]
-id: SO:0000518
-name: V_DJ_cluster
-def: "Genomic DNA of immunoglobulin/T-cell receptor gene in rearranged configuration including at least one V-gene and one DJ-gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "V DJ cluster" EXACT []
-synonym: "V-(DJ)-CLUSTER" EXACT []
-is_a: SO:0000938 ! vertebrate_immunoglobulin_T_cell_receptor_rearranged_gene_cluster
-relationship: has_part SO:0000466 ! V_gene_segment
-relationship: has_part SO:0000572 ! DJ_gene_segment
-
-[Term]
-id: SO:0000519
-name: V_DJ_J_cluster
-def: "Genomic DNA of immunoglobulin/T-cell receptor gene in rearranged configuration including at least one V-gene, one DJ-gene and one J-gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "V DJ J cluster" EXACT []
-synonym: "V-(DJ)-J-CLUSTER" RELATED []
-is_a: SO:0000938 ! vertebrate_immunoglobulin_T_cell_receptor_rearranged_gene_cluster
-relationship: has_part SO:0000466 ! V_gene_segment
-relationship: has_part SO:0000470 ! J_gene_segment
-relationship: has_part SO:0000572 ! DJ_gene_segment
-
-[Term]
-id: SO:0000520
-name: V_VDJ_C_cluster
-def: "Genomic DNA of immunoglobulin/T-cell receptor gene in rearranged configuration including at least one V-gene, one VDJ-gene and one C-gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "V VDJ C cluster" EXACT []
-synonym: "V-(VDJ)-C-CLUSTER" EXACT []
-is_a: SO:0000938 ! vertebrate_immunoglobulin_T_cell_receptor_rearranged_gene_cluster
-relationship: has_part SO:0000466 ! V_gene_segment
-relationship: has_part SO:0000478 ! C_gene_segment
-relationship: has_part SO:0000574 ! VDJ_gene_segment
-
-[Term]
-id: SO:0000521
-name: V_VDJ_cluster
-def: "Genomic DNA of immunoglobulin/T-cell receptor gene in rearranged configuration including at least one V-gene and one VDJ-gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "V VDJ cluster" EXACT []
-synonym: "V-(VDJ)-CLUSTER" EXACT []
-is_a: SO:0000938 ! vertebrate_immunoglobulin_T_cell_receptor_rearranged_gene_cluster
-relationship: has_part SO:0000466 ! V_gene_segment
-relationship: has_part SO:0000574 ! VDJ_gene_segment
-
-[Term]
-id: SO:0000522
-name: V_VDJ_J_cluster
-def: "Genomic DNA of immunoglobulin/T-cell receptor gene in rearranged configuration including at least one V-gene, one VDJ-gene and one J-gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "V VDJ J cluster" EXACT []
-synonym: "V-(VDJ)-J-CLUSTER" RELATED []
-is_a: SO:0000938 ! vertebrate_immunoglobulin_T_cell_receptor_rearranged_gene_cluster
-relationship: has_part SO:0000466 ! V_gene_segment
-relationship: has_part SO:0000470 ! J_gene_segment
-relationship: has_part SO:0000574 ! VDJ_gene_segment
-
-[Term]
-id: SO:0000523
-name: V_VJ_C_cluster
-def: "Genomic DNA of immunoglobulin/T-cell receptor gene in rearranged configuration including at least one V-gene, one VJ-gene and one C-gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "V VJ C cluster" EXACT []
-synonym: "V-(VJ)-C-CLUSTER" EXACT []
-is_a: SO:0000938 ! vertebrate_immunoglobulin_T_cell_receptor_rearranged_gene_cluster
-relationship: has_part SO:0000466 ! V_gene_segment
-relationship: has_part SO:0000478 ! C_gene_segment
-relationship: has_part SO:0000576 ! VJ_gene_segment
-
-[Term]
-id: SO:0000524
-name: V_VJ_cluster
-def: "Genomic DNA of immunoglobulin/T-cell receptor gene in rearranged configuration including at least one V-gene and one VJ-gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "V VJ cluster" EXACT []
-synonym: "V-(VJ)-CLUSTER" EXACT []
-is_a: SO:0000938 ! vertebrate_immunoglobulin_T_cell_receptor_rearranged_gene_cluster
-relationship: has_part SO:0000466 ! V_gene_segment
-relationship: has_part SO:0000576 ! VJ_gene_segment
-
-[Term]
-id: SO:0000525
-name: V_VJ_J_cluster
-def: "Genomic DNA of immunoglobulin/T-cell receptor gene in rearranged configuration including at least one V-gene, one VJ-gene and one J-gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "V VJ J cluster" EXACT []
-synonym: "V-(VJ)-J-CLUSTER" EXACT []
-is_a: SO:0000938 ! vertebrate_immunoglobulin_T_cell_receptor_rearranged_gene_cluster
-relationship: has_part SO:0000466 ! V_gene_segment
-relationship: has_part SO:0000470 ! J_gene_segment
-relationship: has_part SO:0000576 ! VJ_gene_segment
-
-[Term]
-id: SO:0000526
-name: V_cluster
-def: "Genomic DNA of immunoglobulin/T-cell receptor gene in germline configuration including more than one V-gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "V cluster" EXACT []
-synonym: "V-CLUSTER" EXACT []
-is_a: SO:0000482 ! vertebrate_immunoglobulin_T_cell_receptor_gene_cluster
-relationship: has_part SO:0000466 ! V_gene_segment
-
-[Term]
-id: SO:0000527
-name: V_D_DJ_C_cluster
-def: "Genomic DNA of immunoglobulin/T-cell receptor gene in rearranged configuration including at least one V-gene, one D-gene, one DJ-gene and one C-gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "V D DJ C cluster" EXACT []
-synonym: "V-D-(DJ)-C-CLUSTER" EXACT []
-is_a: SO:0000938 ! vertebrate_immunoglobulin_T_cell_receptor_rearranged_gene_cluster
-relationship: has_part SO:0000458 ! D_gene_segment
-relationship: has_part SO:0000466 ! V_gene_segment
-relationship: has_part SO:0000478 ! C_gene_segment
-relationship: has_part SO:0000572 ! DJ_gene_segment
-
-[Term]
-id: SO:0000528
-name: V_D_DJ_cluster
-def: "Genomic DNA of immunoglobulin/T-cell receptor gene in rearranged configuration including at least one V-gene, one D-gene, one DJ-gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "V D DJ cluster" EXACT []
-synonym: "V-D-(DJ)-CLUSTER" EXACT []
-is_a: SO:0000938 ! vertebrate_immunoglobulin_T_cell_receptor_rearranged_gene_cluster
-relationship: has_part SO:0000458 ! D_gene_segment
-relationship: has_part SO:0000466 ! V_gene_segment
-relationship: has_part SO:0000572 ! DJ_gene_segment
-
-[Term]
-id: SO:0000529
-name: V_D_DJ_J_C_cluster
-def: "Genomic DNA of immunoglobulin/T-cell receptor gene in rearranged configuration including at least one V-gene, one D-gene, one DJ-gene, one J-gene and one C-gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "V D DJ J C cluster" EXACT []
-synonym: "V-D-(DJ)-J-C-CLUSTER" EXACT []
-is_a: SO:0000938 ! vertebrate_immunoglobulin_T_cell_receptor_rearranged_gene_cluster
-relationship: has_part SO:0000458 ! D_gene_segment
-relationship: has_part SO:0000466 ! V_gene_segment
-relationship: has_part SO:0000470 ! J_gene_segment
-relationship: has_part SO:0000478 ! C_gene_segment
-relationship: has_part SO:0000572 ! DJ_gene_segment
-
-[Term]
-id: SO:0000530
-name: V_D_DJ_J_cluster
-def: "Genomic DNA of immunoglobulin/T-cell receptor gene in rearranged configuration including at least one V-gene, one D-gene, one DJ-gene and one J-gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "V D DJ J cluster" EXACT []
-synonym: "V-D-(DJ)-J-CLUSTER" EXACT []
-is_a: SO:0000938 ! vertebrate_immunoglobulin_T_cell_receptor_rearranged_gene_cluster
-relationship: has_part SO:0000458 ! D_gene_segment
-relationship: has_part SO:0000466 ! V_gene_segment
-relationship: has_part SO:0000470 ! J_gene_segment
-relationship: has_part SO:0000572 ! DJ_gene_segment
-
-[Term]
-id: SO:0000531
-name: V_D_J_C_cluster
-def: "Genomic DNA of immunoglobulin/T-cell receptor gene in germline configuration including at least one V-gene, one D-gene and one J-gene and one C-gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "V D J C cluster" EXACT []
-synonym: "V-D-J-C-CLUSTER" EXACT []
-is_a: SO:0000938 ! vertebrate_immunoglobulin_T_cell_receptor_rearranged_gene_cluster
-relationship: has_part SO:0000458 ! D_gene_segment
-relationship: has_part SO:0000466 ! V_gene_segment
-relationship: has_part SO:0000470 ! J_gene_segment
-relationship: has_part SO:0000478 ! C_gene_segment
-
-[Term]
-id: SO:0000532
-name: V_D_J_cluster
-def: "Genomic DNA of immunoglobulin/T-cell receptor gene in germline configuration including at least one V-gene, one D-gene and one J-gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "V D J cluster" EXACT []
-synonym: "V-D-J-CLUSTER" EXACT []
-is_a: SO:0000938 ! vertebrate_immunoglobulin_T_cell_receptor_rearranged_gene_cluster
-relationship: has_part SO:0000458 ! D_gene_segment
-relationship: has_part SO:0000466 ! V_gene_segment
-relationship: has_part SO:0000470 ! J_gene_segment
-
-[Term]
-id: SO:0000533
-name: V_heptamer
-def: "7 nucleotide recombination site (e.g. CACAGTG), part of V-gene recombination feature of an immunoglobulin/T-cell receptor gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "V heptamer" EXACT []
-synonym: "V-HEPTAMER" EXACT []
-is_a: SO:0000561 ! heptamer_of_recombination_feature_of_vertebrate_immune_system_gene
-relationship: part_of SO:0000538 ! V_gene_recombination_feature
-
-[Term]
-id: SO:0000534
-name: V_J_cluster
-def: "Genomic DNA of immunoglobulin/T-cell receptor gene in germline configuration including at least one V-gene and one J-gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "V J cluster" EXACT []
-synonym: "V-J-CLUSTER" EXACT []
-is_a: SO:0000482 ! vertebrate_immunoglobulin_T_cell_receptor_gene_cluster
-relationship: has_part SO:0000466 ! V_gene_segment
-relationship: has_part SO:0000470 ! J_gene_segment
-
-[Term]
-id: SO:0000535
-name: V_J_C_cluster
-def: "Genomic DNA of immunoglobulin/T-cell receptor gene in germline configuration including at least one V-gene, one J-gene and one C-gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "V J C cluster" EXACT []
-synonym: "V-J-C-CLUSTER" EXACT []
-is_a: SO:0000482 ! vertebrate_immunoglobulin_T_cell_receptor_gene_cluster
-relationship: has_part SO:0000466 ! V_gene_segment
-relationship: has_part SO:0000470 ! J_gene_segment
-relationship: has_part SO:0000478 ! C_gene_segment
-
-[Term]
-id: SO:0000536
-name: V_nonamer
-def: "9 nucleotide recombination site (e.g. ACAAAAACC), part of V-gene recombination feature of an immunoglobulin/T-cell receptor gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "V nonamer" EXACT []
-synonym: "V-NONAMER" EXACT []
-is_a: SO:0000562 ! nonamer_of_recombination_feature_of_vertebrate_immune_system_gene
-relationship: part_of SO:0000538 ! V_gene_recombination_feature
-
-[Term]
-id: SO:0000537
-name: V_spacer
-def: "12 or 23 nucleotide spacer between the V-heptamer and the V-nonamer of a V-gene recombination feature of an immunoglobulin/T-cell receptor gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "V spacer" EXACT []
-synonym: "V-SPACER" EXACT []
-is_a: SO:0000563 ! vertebrate_immune_system_gene_recombination_spacer
-relationship: part_of SO:0000538 ! V_gene_recombination_feature
-
-[Term]
-id: SO:0000538
-name: V_gene_recombination_feature
-def: "Recombination signal including V-heptamer, V-spacer and V-nonamer in 3' of V-region of a V-gene or V-sequence of an immunoglobulin/T-cell receptor gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "V gene recombination feature" EXACT []
-synonym: "V-RS" EXACT []
-is_a: SO:0000939 ! vertebrate_immune_system_gene_recombination_signal_feature
-
-[Term]
-id: SO:0000539
-name: DJ_C_cluster
-def: "Genomic DNA of immunoglobulin/T-cell receptor gene in rearranged configuration including at least one DJ-gene and one C-gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "(DJ)-C-CLUSTER" EXACT []
-synonym: "DJ C cluster" EXACT []
-is_a: SO:0000938 ! vertebrate_immunoglobulin_T_cell_receptor_rearranged_gene_cluster
-relationship: has_part SO:0000478 ! C_gene_segment
-relationship: has_part SO:0000572 ! DJ_gene_segment
-
-[Term]
-id: SO:0000540
-name: DJ_J_C_cluster
-def: "Genomic DNA in rearranged configuration including at least one D-J-GENE, one J-GENE and one C-GENE." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "(DJ)-J-C-CLUSTER" EXACT []
-synonym: "DJ J C cluster" EXACT []
-is_a: SO:0000938 ! vertebrate_immunoglobulin_T_cell_receptor_rearranged_gene_cluster
-relationship: has_part SO:0000470 ! J_gene_segment
-relationship: has_part SO:0000478 ! C_gene_segment
-relationship: has_part SO:0000572 ! DJ_gene_segment
-
-[Term]
-id: SO:0000541
-name: VDJ_C_cluster
-def: "Genomic DNA of immunoglobulin/T-cell receptor gene in rearranged configuration including at least one VDJ-gene and one C-gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "(VDJ)-C-CLUSTER" EXACT []
-synonym: "VDJ C cluster" EXACT []
-is_a: SO:0000938 ! vertebrate_immunoglobulin_T_cell_receptor_rearranged_gene_cluster
-relationship: has_part SO:0000478 ! C_gene_segment
-relationship: has_part SO:0000574 ! VDJ_gene_segment
-
-[Term]
-id: SO:0000542
-name: V_DJ_C_cluster
-def: "Genomic DNA of immunoglobulin/T-cell receptor gene in rearranged configuration including at least one V-gene, one DJ-gene and one C-gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "V DJ C cluster" EXACT []
-synonym: "V-(DJ)-C-CLUSTER" EXACT []
-is_a: SO:0000938 ! vertebrate_immunoglobulin_T_cell_receptor_rearranged_gene_cluster
-relationship: has_part SO:0000466 ! V_gene_segment
-relationship: has_part SO:0000478 ! C_gene_segment
-relationship: has_part SO:0000572 ! DJ_gene_segment
-
-[Term]
-id: SO:0000543
-name: alternately_spliced_gene_encoding_greater_than_one_transcript
-is_obsolete: true
-
-[Term]
-id: SO:0000544
-name: helitron
-def: "A rolling circle transposon. Autonomous helitrons encode a 5'-to-3' DNA helicase and nuclease/ligase similar to those encoded by known rolling-circle replicons." [http://www.pnas.org/cgi/content/full/100/11/6569]
-synonym: "ISCR" RELATED []
-xref: http://en.wikipedia.org/wiki/Helitron "wiki"
-is_a: SO:0000182 ! DNA_transposon
-
-[Term]
-id: SO:0000545
-name: recoding_pseudoknot
-def: "The pseudoknots involved in recoding are unique in that, as they play their role as a structure, they are immediately unfolded and their now linear sequence serves as a template for decoding." [http://www.pubmedcentral.nih.gov/articlerender.fcgi?artid=33937]
-synonym: "recoding pseudoknot" EXACT []
-is_a: SO:0000591 ! pseudoknot
-relationship: part_of SO:1001268 ! recoding_stimulatory_region
-
-[Term]
-id: SO:0000546
-name: designed_sequence
-synonym: "designed sequence" EXACT []
-is_a: SO:0000351 ! synthetic_sequence
-
-[Term]
-id: SO:0000547
-name: inversion_derived_bipartite_duplication
-def: "A chromosome generated by recombination between two inversions; there is a duplication at each end of the inversion." [FB:km]
-synonym: "inversion derived bipartite duplication" EXACT []
-is_a: SO:1000038 ! intrachromosomal_duplication
-
-[Term]
-id: SO:0000548
-name: gene_with_edited_transcript
-def: "A gene that encodes a transcript that is edited." [SO:xp]
-synonym: "gene with edited transcript" EXACT []
-is_a: SO:0001217 ! implied link automatically realized ! protein_coding_gene
-intersection_of: SO:0001217 ! protein_coding_gene
-intersection_of: transcribed_to SO:0000873 ! edited_transcript
-
-[Term]
-id: SO:0000549
-name: inversion_derived_duplication_plus_aneuploid
-def: "A chromosome generated by recombination between two inversions; has a duplication at one end and presumed to have a deficiency or duplication at the other end of the inversion." [FB:km]
-synonym: "inversion derived duplication plus aneuploid" EXACT []
-is_a: SO:1000038 ! intrachromosomal_duplication
-
-[Term]
-id: SO:0000550
-name: aneuploid_chromosome
-def: "A chromosome structural variation whereby either a chromosome exists in addition to the normal chromosome complement or is lacking." [SO:ke]
-comment: Examples are Nullo-4, Haplo-4 and triplo-4 in Drosophila.
-synonym: "aneuploid chromosome" EXACT []
-is_a: SO:1000183 ! chromosome_structure_variation
-
-[Term]
-id: SO:0000551
-name: polyA_signal_sequence
-def: "The recognition sequence necessary for endonuclease cleavage of an RNA transcript that is followed by polyadenylation; consensus=AATAAA." [http://www.ebi.ac.uk/embl/Documentation/FT_definitions/feature_table.html]
-subset: SOFA
-synonym: "poly(A) signal" EXACT []
-synonym: "polyA signal sequence" EXACT []
-synonym: "polyadenylation termination signal" EXACT []
-is_a: SO:0001679 ! transcription_regulatory_region
-
-[Term]
-id: SO:0000552
-name: Shine_Dalgarno_sequence
-def: "A region in the 5' UTR that pairs with the 16S rRNA during formation of the preinitiation complex." [SO:jh]
-comment: Not found in Eukaryotic sequence.
-synonym: "five prime ribosome binding site" EXACT []
-synonym: "RBS" RELATED []
-synonym: "Shine Dalgarno sequence" EXACT []
-synonym: "Shine-Dalgarno sequence" EXACT []
-xref: http://en.wikipedia.org/wiki/Shine-Dalgarno_sequence "wiki"
-is_a: SO:0000139 ! ribosome_entry_site
-
-[Term]
-id: SO:0000553
-name: polyA_site
-alt_id: SO:0001430
-def: "The site on an RNA transcript to which will be added adenine residues by post-transcriptional polyadenylation. The boundary between the UTR and the polyA sequence." [http://www.ebi.ac.uk/embl/Documentation/FT_definitions/feature_table.html]
-subset: SOFA
-synonym: "polyA cleavage site" EXACT []
-synonym: "polyA junction" EXACT []
-synonym: "polyA site" EXACT []
-synonym: "polyA_junction" EXACT []
-synonym: "polyadenylation site" RELATED []
-is_a: SO:0000699 ! junction
-relationship: part_of SO:0000205 ! three_prime_UTR
-relationship: part_of SO:0000233 ! mature_transcript
-
-[Term]
-id: SO:0000554
-name: assortment_derived_deficiency_plus_duplication
-is_obsolete: true
-
-[Term]
-id: SO:0000555
-name: five_prime_clip
-def: "5' most region of a precursor transcript that is clipped off during processing." [http://www.ebi.ac.uk/embl/Documentation/FT_definitions/feature_table.html]
-synonym: "5' clip" RELATED []
-synonym: "five prime clip" EXACT []
-is_a: SO:0000303 ! clip
-
-[Term]
-id: SO:0000556
-name: five_prime_D_recombination_signal_sequence
-def: "Recombination signal of an immunoglobulin/T-cell receptor gene, including the 5' D-nonamer (SO:0000497), 5' D-spacer (SO:0000498), and 5' D-heptamer (SO:0000396) in 5' of the D-region of a D-gene, or in 5' of the D-region of DJ-gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "5'RS" EXACT []
-synonym: "five prime D recombination signal sequence" EXACT []
-synonym: "five prime D-recombination signal sequence" EXACT []
-is_a: SO:0000492 ! D_gene_recombination_feature
-
-[Term]
-id: SO:0000557
-name: three_prime_clip
-def: "3'-most region of a precursor transcript that is clipped off during processing." [http://www.ebi.ac.uk/embl/Documentation/FT_definitions/feature_table.html]
-synonym: "3'-clip" EXACT []
-synonym: "three prime clip" EXACT []
-is_a: SO:0000303 ! clip
-
-[Term]
-id: SO:0000558
-name: C_cluster
-def: "Genomic DNA of immunoglobulin/T-cell receptor gene including more than one C-gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "C cluster" EXACT []
-synonym: "C-CLUSTER" EXACT []
-is_a: SO:0000482 ! vertebrate_immunoglobulin_T_cell_receptor_gene_cluster
-relationship: has_part SO:0000478 ! C_gene_segment
-
-[Term]
-id: SO:0000559
-name: D_cluster
-def: "Genomic DNA of immunoglobulin/T-cell receptor gene in germline configuration including more than one D-gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "D cluster" EXACT []
-synonym: "D-CLUSTER" EXACT []
-is_a: SO:0000482 ! vertebrate_immunoglobulin_T_cell_receptor_gene_cluster
-relationship: has_part SO:0000458 ! D_gene_segment
-
-[Term]
-id: SO:0000560
-name: D_J_cluster
-def: "Genomic DNA of immunoglobulin/T-cell receptor gene in germline configuration including at least one D-gene and one J-gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "D J cluster" EXACT []
-synonym: "D-J-CLUSTER" EXACT []
-is_a: SO:0000482 ! vertebrate_immunoglobulin_T_cell_receptor_gene_cluster
-relationship: has_part SO:0000458 ! D_gene_segment
-relationship: has_part SO:0000470 ! J_gene_segment
-
-[Term]
-id: SO:0000561
-name: heptamer_of_recombination_feature_of_vertebrate_immune_system_gene
-def: "Seven nucleotide recombination site (e.g. CACAGTG), part of V-gene, D-gene or J-gene recombination feature of an immunoglobulin or T-cell receptor gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "HEPTAMER" RELATED []
-synonym: "heptamer of recombination feature of vertebrate immune system gene" EXACT []
-is_a: SO:0000939 ! vertebrate_immune_system_gene_recombination_signal_feature
-
-[Term]
-id: SO:0000562
-name: nonamer_of_recombination_feature_of_vertebrate_immune_system_gene
-synonym: "nonamer of recombination feature of vertebrate immune system gene" EXACT []
-is_a: SO:0000939 ! vertebrate_immune_system_gene_recombination_signal_feature
-
-[Term]
-id: SO:0000563
-name: vertebrate_immune_system_gene_recombination_spacer
-synonym: "vertebrate immune system gene recombination spacer" EXACT []
-is_a: SO:0000301 ! vertebrate_immune_system_gene_recombination_feature
-
-[Term]
-id: SO:0000564
-name: V_DJ_J_C_cluster
-def: "Genomic DNA of immunoglobulin/T-cell receptor gene in rearranged configuration including at least one V-gene, one DJ-gene, one J-gene and one C-gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "V DJ J C cluster" EXACT []
-synonym: "V-(DJ)-J-C-CLUSTER" EXACT []
-is_a: SO:0000938 ! vertebrate_immunoglobulin_T_cell_receptor_rearranged_gene_cluster
-relationship: has_part SO:0000466 ! V_gene_segment
-relationship: has_part SO:0000470 ! J_gene_segment
-relationship: has_part SO:0000478 ! C_gene_segment
-relationship: has_part SO:0000572 ! DJ_gene_segment
-
-[Term]
-id: SO:0000565
-name: V_VDJ_J_C_cluster
-def: "Genomic DNA of immunoglobulin/T-cell receptor gene in rearranged configuration including at least one V-gene, one VDJ-gene, one J-gene and one C-gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "V VDJ J C cluster" EXACT []
-synonym: "V-(VDJ)-J-C-CLUSTER" EXACT []
-is_a: SO:0000938 ! vertebrate_immunoglobulin_T_cell_receptor_rearranged_gene_cluster
-relationship: has_part SO:0000466 ! V_gene_segment
-relationship: has_part SO:0000470 ! J_gene_segment
-relationship: has_part SO:0000478 ! C_gene_segment
-relationship: has_part SO:0000574 ! VDJ_gene_segment
-
-[Term]
-id: SO:0000566
-name: V_VJ_J_C_cluster
-def: "Genomic DNA of immunoglobulin/T-cell receptor gene in rearranged configuration including at least one V-gene, one VJ-gene, one J-gene and one C-gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "V VJ J C cluster" EXACT []
-synonym: "V-(VJ)-J-C-CLUSTER" EXACT []
-is_a: SO:0000938 ! vertebrate_immunoglobulin_T_cell_receptor_rearranged_gene_cluster
-relationship: has_part SO:0000466 ! V_gene_segment
-relationship: has_part SO:0000470 ! J_gene_segment
-relationship: has_part SO:0000478 ! C_gene_segment
-relationship: has_part SO:0000576 ! VJ_gene_segment
-
-[Term]
-id: SO:0000567
-name: inversion_derived_aneuploid_chromosome
-def: "A chromosome may be generated by recombination between two inversions; presumed to have a deficiency or duplication at each end of the inversion." [FB:km]
-synonym: "inversion derived aneuploid chromosome" EXACT []
-is_a: SO:0000550 ! aneuploid_chromosome
-
-[Term]
-id: SO:0000568
-name: bidirectional_promoter
-synonym: "bidirectional promoter" EXACT []
-is_a: SO:0000167 ! promoter
-
-[Term]
-id: SO:0000569
-name: retrotransposed
-alt_id: SO:0100042
-def: "An attribute of a feature that occurred as the product of a reverse transcriptase mediated event." [SO:ke]
-comment: GO:0003964 RNA-directed DNA polymerase activity.
-xref: http://en.wikipedia.org/wiki/Retrotransposed "wiki"
-is_a: SO:0000733 ! feature_attribute
-
-[Term]
-id: SO:0000570
-name: three_prime_D_recombination_signal_sequence
-def: "Recombination signal of an immunoglobulin/T-cell receptor gene, including the 3' D-heptamer (SO:0000493), 3' D-spacer, and 3' D-nonamer (SO:0000494) in 3' of the D-region of a D-gene." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "3'D-RS" EXACT []
-synonym: "three prime D recombination signal sequence" EXACT []
-synonym: "three_prime_D-recombination_signal_sequence" EXACT []
-is_a: SO:0000492 ! D_gene_recombination_feature
-
-[Term]
-id: SO:0000571
-name: miRNA_encoding
-synonym: "miRNA encoding" EXACT []
-is_a: SO:0000011 ! non_protein_coding
-
-[Term]
-id: SO:0000572
-name: DJ_gene_segment
-def: "Genomic DNA of immunoglobulin/T-cell receptor gene in partially rearranged genomic DNA including D-J-region with 5' UTR and 3' UTR, also designated as D-J-segment." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "D-J-GENE" EXACT []
-synonym: "DJ gene" EXACT []
-is_a: SO:0000936 ! vertebrate_immunoglobulin_T_cell_receptor_rearranged_segment
-
-[Term]
-id: SO:0000573
-name: rRNA_encoding
-synonym: "rRNA encoding" EXACT []
-is_a: SO:0000011 ! non_protein_coding
-
-[Term]
-id: SO:0000574
-name: VDJ_gene_segment
-def: "Rearranged genomic DNA of immunoglobulin/T-cell receptor gene including L-part1, V-intron and V-D-J-exon, with the 5'UTR (SO:0000204) and 3'UTR (SO:0000205)." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "V-D-J-GENE" EXACT []
-synonym: "VDJ gene" EXACT []
-is_a: SO:0000936 ! vertebrate_immunoglobulin_T_cell_receptor_rearranged_segment
-
-[Term]
-id: SO:0000575
-name: scRNA_encoding
-synonym: "scRNA encoding" EXACT []
-is_a: SO:0000011 ! non_protein_coding
-
-[Term]
-id: SO:0000576
-name: VJ_gene_segment
-def: "Rearranged genomic DNA of immunoglobulin/T-cell receptor gene including L-part1, V-intron and V-J-exon, with the 5'UTR (SO:0000204) and 3'UTR (SO:0000205)." [http://www.imgt.org/cgi-bin/IMGTlect.jv?query=7#]
-synonym: "V-J-GENE" EXACT []
-synonym: "VJ gene" EXACT []
-is_a: SO:0000936 ! vertebrate_immunoglobulin_T_cell_receptor_rearranged_segment
-
-[Term]
-id: SO:0000577
-name: centromere
-def: "A region of chromosome where the spindle fibers attach during mitosis and meiosis." [SO:ke]
-subset: SOFA
-xref: http://en.wikipedia.org/wiki/Centromere "wiki"
-is_a: SO:0000628 ! chromosomal_structural_element
-
-[Term]
-id: SO:0000578
-name: snoRNA_encoding
-synonym: "snoRNA encoding" EXACT []
-is_a: SO:0000011 ! non_protein_coding
-
-[Term]
-id: SO:0000579
-name: edited_transcript_feature
-def: "A locatable feature on a transcript that is edited." [SO:ma]
-synonym: "edited transcript feature" EXACT []
-is_a: SO:0000833 ! transcript_region
-
-[Term]
-id: SO:0000580
-name: methylation_guide_snoRNA_primary_transcript
-def: "A primary transcript encoding a methylation guide small nucleolar RNA." [SO:ke]
-synonym: "methylation guide snoRNA primary transcript" EXACT []
-is_a: SO:0000232 ! snoRNA_primary_transcript
-
-[Term]
-id: SO:0000581
-name: cap
-def: "A structure consisting of a 7-methylguanosine in 5'-5' triphosphate linkage with the first nucleotide of an mRNA. It is added post-transcriptionally, and is not encoded in the DNA." [http://seqcore.brcf.med.umich.edu/doc/educ/dnapr/mbglossary/mbgloss.html]
-subset: SOFA
-xref: http://en.wikipedia.org/wiki/5%27_cap "wiki"
-is_a: SO:0001411 ! biological_region
-
-[Term]
-id: SO:0000582
-name: rRNA_cleavage_snoRNA_primary_transcript
-def: "A primary transcript encoding an rRNA cleavage snoRNA." [SO:ke]
-synonym: "rRNA cleavage snoRNA primary transcript" EXACT []
-is_a: SO:0000232 ! snoRNA_primary_transcript
-
-[Term]
-id: SO:0000583
-name: pre_edited_region
-def: "The region of a transcript that will be edited." [http://dna.kdna.ucla.edu/rna/index.aspx]
-synonym: "pre edited region" EXACT []
-synonym: "pre-edited region" EXACT []
-is_a: SO:0000579 ! edited_transcript_feature
-
-[Term]
-id: SO:0000584
-name: tmRNA
-def: "A tmRNA liberates a mRNA from a stalled ribosome. To accomplish this part of the tmRNA is used as a reading frame that ends in a translation stop signal. The broken mRNA is replaced in the ribosome by the tmRNA and translation of the tmRNA leads to addition of a proteolysis tag to the incomplete protein enabling recognition by a protease. Recently a number of permuted tmRNAs genes have been found encoded in two parts. TmRNAs have been identified in eubacteria and some chloroplasts  [...]
-synonym: "10Sa RNA" RELATED []
-synonym: "ssrA" RELATED []
-xref: http://en.wikipedia.org/wiki/TmRNA "wiki"
-is_a: SO:0000370 ! small_regulatory_ncRNA
-
-[Term]
-id: SO:0000585
-name: C_D_box_snoRNA_encoding
-synonym: "C/D box snoRNA encoding" EXACT []
-is_a: SO:0000578 ! snoRNA_encoding
-
-[Term]
-id: SO:0000586
-name: tmRNA_primary_transcript
-def: "A primary transcript encoding a tmRNA (SO:0000584)." [SO:ke]
-synonym: "10Sa RNA primary transcript" RELATED []
-synonym: "ssrA RNA primary transcript" RELATED []
-synonym: "tmRNA primary transcript" EXACT []
-is_a: SO:0000483 ! nc_primary_transcript
-
-[Term]
-id: SO:0000587
-name: group_I_intron
-def: "Group I catalytic introns are large self-splicing ribozymes. They catalyze their own excision from mRNA, tRNA and rRNA precursors in a wide range of organisms. The core secondary structure consists of 9 paired regions (P1-P9). These fold to essentially two domains, the P4-P6 domain (formed from the stacking of P5, P4, P6 and P6a helices) and the P3-P9 domain (formed from the P8, P3, P7 and P9 helices). Group I catalytic introns often have long ORFs inserted in loop regions." [http: [...]
-comment: GO:0000372.
-subset: SOFA
-synonym: "group I intron" EXACT []
-xref: http://en.wikipedia.org/wiki/Group_I_intron "wiki"
-is_a: SO:0000588 ! autocatalytically_spliced_intron
-
-[Term]
-id: SO:0000588
-name: autocatalytically_spliced_intron
-def: "A self spliced intron." [SO:ke]
-subset: SOFA
-synonym: "autocatalytically spliced intron" EXACT []
-is_a: SO:0000188 ! implied link automatically realized ! intron
-intersection_of: SO:0000188 ! intron
-intersection_of: has_quality SO:0001186 ! ribozymic
-
-[Term]
-id: SO:0000589
-name: SRP_RNA_primary_transcript
-def: "A primary transcript encoding a signal recognition particle RNA." [SO:ke]
-synonym: "SRP RNA primary transcript" EXACT []
-is_a: SO:0000483 ! nc_primary_transcript
-
-[Term]
-id: SO:0000590
-name: SRP_RNA
-def: "The signal recognition particle (SRP) is a universally conserved ribonucleoprotein. It is involved in the co-translational targeting of proteins to membranes. The eukaryotic SRP consists of a 300-nucleotide 7S RNA and six proteins: SRPs 72, 68, 54, 19, 14, and 9. Archaeal SRP consists of a 7S RNA and homologues of the eukaryotic SRP19 and SRP54 proteins. In most eubacteria, the SRP consists of a 4.5S RNA and the Ffh protein (a homologue of the eukaryotic SRP54 protein). Eukaryotic  [...]
-subset: SOFA
-synonym: "7S RNA" RELATED []
-synonym: "signal recognition particle RNA" RELATED []
-synonym: "SRP RNA" EXACT []
-is_a: SO:0000655 ! ncRNA
-relationship: derives_from SO:0000589 ! SRP_RNA_primary_transcript
-
-[Term]
-id: SO:0000591
-name: pseudoknot
-def: "A tertiary structure in RNA where nucleotides in a loop form base pairs with a region of RNA downstream of the loop." [RSC:cb]
-xref: http://en.wikipedia.org/wiki/Pseudoknot "wiki"
-is_a: SO:0000002 ! sequence_secondary_structure
-
-[Term]
-id: SO:0000592
-name: H_pseudoknot
-def: "A pseudoknot which contains two stems and at least two loops." [http://www.ncbi.nlm.nih.gov\:80/entrez/query.fcgi?cmd=Retrieve&db=PubMed&list_uids=10334330&dopt=Abstract]
-synonym: "classical pseudoknot" EXACT []
-synonym: "H pseudoknot" EXACT []
-synonym: "H-pseudoknot" EXACT []
-synonym: "H-type pseudoknot" EXACT []
-synonym: "hairpin-type pseudoknot" EXACT []
-is_a: SO:0000591 ! pseudoknot
-
-[Term]
-id: SO:0000593
-name: C_D_box_snoRNA
-def: "Most box C/D snoRNAs also contain long (>10 nt) sequences complementary to rRNA. Boxes C and D, as well as boxes C' and D', are usually located in close proximity, and form a structure known as the box C/D motif. This motif is important for snoRNA stability, processing, nucleolar targeting and function. A small number of box C/D snoRNAs are involved in rRNA processing; most, however, are known or predicted to serve as guide RNAs in ribose methylation of rRNA. Targeting involves dir [...]
-subset: SOFA
-synonym: "box C/D snoRNA" EXACT []
-synonym: "C D box snoRNA" EXACT []
-synonym: "C/D box snoRNA" EXACT []
-is_a: SO:0000275 ! snoRNA
-relationship: derives_from SO:0000595 ! C_D_box_snoRNA_primary_transcript
-
-[Term]
-id: SO:0000594
-name: H_ACA_box_snoRNA
-def: "Members of the box H/ACA family contain an ACA triplet, exactly 3 nt upstream from the 3' end and an H-box in a hinge region that links two structurally similar functional domains of the molecule. Both boxes are important for snoRNA biosynthesis and function. A few box H/ACA snoRNAs are involved in rRNA processing; most others are known or predicted to participate in selection of uridine nucleosides in rRNA to be converted to pseudouridines. Site selection is mediated by direct bas [...]
-synonym: "box H/ACA snoRNA" EXACT []
-synonym: "H ACA box snoRNA" EXACT []
-synonym: "H/ACA box snoRNA" EXACT []
-is_a: SO:0000275 ! snoRNA
-relationship: derives_from SO:0000596 ! H_ACA_box_snoRNA_primary_transcript
-
-[Term]
-id: SO:0000595
-name: C_D_box_snoRNA_primary_transcript
-def: "A primary transcript encoding a small nucleolar RNA of the box C/D family." [SO:ke]
-synonym: "C/D box snoRNA primary transcript" EXACT []
-is_a: SO:0000232 ! snoRNA_primary_transcript
-
-[Term]
-id: SO:0000596
-name: H_ACA_box_snoRNA_primary_transcript
-def: "A primary transcript encoding a small nucleolar RNA of the box H/ACA family." [SO:ke]
-synonym: "H ACA box snoRNA primary transcript" EXACT []
-is_a: SO:0000232 ! snoRNA_primary_transcript
-
-[Term]
-id: SO:0000597
-name: transcript_edited_by_U_insertion/deletion
-def: "The insertion and deletion of uridine (U) residues, usually within coding regions of mRNA transcripts of cryptogenes in the mitochondrial genome of kinetoplastid protozoa." [http://www.rna.ucla.edu/index.html]
-is_obsolete: true
-
-[Term]
-id: SO:0000598
-name: edited_by_C_insertion_and_dinucleotide_insertion
-synonym: "transcript_edited_by_C-insertion_and_dinucleotide_insertion" RELATED []
-is_obsolete: true
-
-[Term]
-id: SO:0000599
-name: edited_by_C_to_U_substitution
-is_obsolete: true
-
-[Term]
-id: SO:0000600
-name: edited_by_A_to_I_substitution
-is_obsolete: true
-
-[Term]
-id: SO:0000601
-name: edited_by_G_addition
-is_obsolete: true
-
-[Term]
-id: SO:0000602
-name: guide_RNA
-def: "A short 3'-uridylated RNA that can form a duplex (except for its post-transcriptionally added oligo_U tail (SO:0000609)) with a stretch of mature edited mRNA." [http://www.rna.ucla.edu/index.html]
-subset: SOFA
-synonym: "gRNA" EXACT []
-synonym: "guide RNA" EXACT []
-xref: http://en.wikipedia.org/wiki/Guide_RNA "wiki"
-is_a: SO:0000655 ! ncRNA
-
-[Term]
-id: SO:0000603
-name: group_II_intron
-def: "Group II introns are found in rRNA, tRNA and mRNA of organelles in fungi, plants and protists, and also in mRNA in bacteria. They are large self-splicing ribozymes and have 6 structural domains (usually designated dI to dVI). A subset of group II introns also encode essential splicing proteins in intronic ORFs. The length of these introns can therefore be up to 3kb. Splicing occurs in almost identical fashion to nuclear pre-mRNA splicing with two transesterification steps. The 2' h [...]
-comment: GO:0000373.
-subset: SOFA
-synonym: "group II intron" EXACT []
-xref: http://en.wikipedia.org/wiki/Group_II_intron "wiki"
-is_a: SO:0000588 ! autocatalytically_spliced_intron
-
-[Term]
-id: SO:0000604
-name: editing_block
-def: "Edited mRNA sequence mediated by a single guide RNA (SO:0000602)." [http://dna.kdna.ucla.edu/rna/index.aspx]
-synonym: "editing block" EXACT []
-is_a: SO:0000579 ! edited_transcript_feature
-
-[Term]
-id: SO:0000605
-name: intergenic_region
-def: "A region containing or overlapping no genes that is bounded on either side by a gene, or bounded by a gene and the end of the chromosome." [SO:cjm]
-comment: This term is mapped to MGED. Do not obsolete without consulting MGED ontology.
-subset: SOFA
-synonym: "intergenic region" EXACT []
-xref: http://en.wikipedia.org/wiki/Intergenic_region "wiki"
-is_a: SO:0001411 ! biological_region
-
-[Term]
-id: SO:0000606
-name: editing_domain
-def: "Edited mRNA sequence mediated by two or more overlapping guide RNAs (SO:0000602)." [http://dna.kdna.ucla.edu/rna/index.aspx]
-synonym: "editing domain" EXACT []
-is_a: SO:0000579 ! edited_transcript_feature
-
-[Term]
-id: SO:0000607
-name: unedited_region
-def: "The region of an edited transcript that will not be edited." [http://dna.kdna.ucla.edu/rna/index.aspx]
-synonym: "unedited region" EXACT []
-is_a: SO:0000579 ! edited_transcript_feature
-
-[Term]
-id: SO:0000608
-name: H_ACA_box_snoRNA_encoding
-synonym: "H ACA box snoRNA encoding" EXACT []
-is_a: SO:0000578 ! snoRNA_encoding
-
-[Term]
-id: SO:0000609
-name: oligo_U_tail
-def: "The string of non-encoded U's at the 3' end of a guide RNA (SO:0000602)." [http://www.rna.ucla.edu/]
-synonym: "oligo U tail" EXACT []
-is_a: SO:0001411 ! biological_region
-relationship: adjacent_to SO:0000602 ! guide_RNA
-
-[Term]
-id: SO:0000610
-name: polyA_sequence
-def: "Sequence of about 100 nucleotides of A added to the 3' end of most eukaryotic mRNAs." [SO:ke]
-subset: SOFA
-synonym: "polyA sequence" EXACT []
-is_a: SO:0001411 ! biological_region
-relationship: adjacent_to SO:0000234 ! mRNA
-
-[Term]
-id: SO:0000611
-name: branch_site
-def: "A pyrimidine rich sequence near the 3' end of an intron to which the 5'end becomes covalently bound during nuclear splicing. The resulting structure resembles a lariat." [SO:ke]
-subset: SOFA
-synonym: "branch point" EXACT []
-synonym: "branch site" EXACT []
-synonym: "branch_point" EXACT []
-is_a: SO:0000841 ! spliceosomal_intron_region
-
-[Term]
-id: SO:0000612
-name: polypyrimidine_tract
-def: "The polypyrimidine tract is one of the cis-acting sequence elements directing intron removal in pre-mRNA splicing." [http://nar.oupjournals.org/cgi/content/full/25/4/888]
-subset: SOFA
-synonym: "polypyrimidine tract" EXACT []
-xref: http://en.wikipedia.org/wiki/Polypyrimidine_tract "wiki"
-is_a: SO:0000841 ! spliceosomal_intron_region
-
-[Term]
-id: SO:0000613
-name: bacterial_RNApol_promoter
-def: "A DNA sequence to which bacterial RNA polymerase binds, to begin transcription." [SO:ke]
-synonym: "bacterial RNApol promoter" EXACT []
-is_a: SO:0000752 ! gene_group_regulatory_region
-is_a: SO:0001203 ! RNA_polymerase_promoter
-
-[Term]
-id: SO:0000614
-name: bacterial_terminator
-def: "A terminator signal for bacterial transcription." [SO:ke]
-synonym: "bacterial terminator" EXACT []
-is_a: SO:0000141 ! terminator
-is_a: SO:0000752 ! gene_group_regulatory_region
-
-[Term]
-id: SO:0000615
-name: terminator_of_type_2_RNApol_III_promoter
-def: "A terminator signal for RNA polymerase III transcription." [SO:ke]
-synonym: "terminator of type 2 RNApol III promoter" EXACT []
-is_a: SO:0000951 ! eukaryotic_terminator
-
-[Term]
-id: SO:0000616
-name: transcription_end_site
-def: "The base where transcription ends." [SO:ke]
-subset: SOFA
-synonym: "transcription end site" EXACT []
-is_a: SO:0000835 ! primary_transcript_region
-
-[Term]
-id: SO:0000617
-name: RNApol_III_promoter_type_1
-synonym: "RNApol III promoter type 1" EXACT []
-is_a: SO:0000171 ! RNApol_III_promoter
-
-[Term]
-id: SO:0000618
-name: RNApol_III_promoter_type_2
-synonym: "RNApol III promoter type 2" EXACT []
-synonym: "tRNA promoter" RELATED []
-is_a: SO:0000171 ! RNApol_III_promoter
-
-[Term]
-id: SO:0000619
-name: A_box
-def: "A variably distant linear promoter region recognized by TFIIIC, with consensus sequence TGGCnnAGTGG." [SO:ke]
-comment: Binds TFIIIC.
-synonym: "A-box" EXACT []
-xref: http://en.wikipedia.org/wiki/A-box "wiki"
-is_a: SO:0001660 ! core_promoter_element
-
-[Term]
-id: SO:0000620
-name: B_box
-def: "A variably distant linear promoter region recognized by TFIIIC, with consensus sequence AGGTTCCAnnCC." [SO:ke]
-comment: Binds TFIIIC.
-synonym: "B-box" EXACT []
-is_a: SO:0001660 ! core_promoter_element
-relationship: part_of SO:0000618 ! RNApol_III_promoter_type_2
-
-[Term]
-id: SO:0000621
-name: RNApol_III_promoter_type_3
-synonym: "RNApol III promoter type 3" EXACT []
-is_a: SO:0000171 ! RNApol_III_promoter
-
-[Term]
-id: SO:0000622
-name: C_box
-def: "An RNA polymerase III type 1 promoter with consensus sequence CAnnCCn." [SO:ke]
-synonym: "C-box" EXACT []
-is_a: SO:0001660 ! core_promoter_element
-relationship: part_of SO:0000617 ! RNApol_III_promoter_type_1
-
-[Term]
-id: SO:0000623
-name: snRNA_encoding
-synonym: "snRNA encoding" EXACT []
-is_a: SO:0000011 ! non_protein_coding
-
-[Term]
-id: SO:0000624
-name: telomere
-def: "A specific structure at the end of a linear chromosome, required for the integrity and maintenance of the end." [SO:ma]
-subset: SOFA
-synonym: "telomeric DNA" EXACT []
-synonym: "telomeric sequence" EXACT []
-xref: http://en.wikipedia.org/wiki/Telomere "wiki"
-is_a: SO:0000628 ! chromosomal_structural_element
-
-[Term]
-id: SO:0000625
-name: silencer
-def: "A regulatory region which upon binding of transcription factors, suppress the transcription of the gene or genes they control." [SO:ke]
-subset: SOFA
-xref: http://en.wikipedia.org/wiki/Silencer_(DNA) "wiki"
-is_a: SO:0000727 ! CRM
-
-[Term]
-id: SO:0000626
-name: chromosomal_regulatory_element
-synonym: "chromosomal regulatory element" EXACT []
-is_a: SO:0000830 ! chromosome_part
-
-[Term]
-id: SO:0000627
-name: insulator
-def: "A transcriptional cis regulatory region that when located between a CM and a gene's promoter prevents the CRM from modulating that genes expression." [SO:regcreative]
-subset: SOFA
-synonym: "insulator element" EXACT []
-xref: http://en.wikipedia.org/wiki/Insulator_(genetics) "wiki"
-is_a: SO:0001055 ! transcriptional_cis_regulatory_region
-
-[Term]
-id: SO:0000628
-name: chromosomal_structural_element
-subset: SOFA
-synonym: "chromosomal structural element" EXACT []
-is_a: SO:0000830 ! chromosome_part
-
-[Term]
-id: SO:0000629
-name: five_prime_open_reading_frame
-synonym: "five prime open reading frame" EXACT []
-is_a: SO:0000836 ! mRNA_region
-relationship: part_of SO:0000204 ! five_prime_UTR
-
-[Term]
-id: SO:0000630
-name: upstream_AUG_codon
-def: "A start codon upstream of the ORF." [SO:ke]
-synonym: "upstream AUG codon" EXACT []
-is_a: SO:0000837 ! UTR_region
-relationship: part_of SO:0000203 ! UTR
-
-[Term]
-id: SO:0000631
-name: polycistronic_primary_transcript
-def: "A primary transcript encoding for more than one gene product." [SO:ke]
-synonym: "polycistronic primary transcript" EXACT []
-is_a: SO:0000078 ! implied link automatically realized ! polycistronic_transcript
-is_a: SO:0000185 ! implied link automatically realized ! primary_transcript
-intersection_of: SO:0000185 ! primary_transcript
-intersection_of: has_quality SO:0000880 ! polycistronic
-
-[Term]
-id: SO:0000632
-name: monocistronic_primary_transcript
-def: "A primary transcript encoding for one gene product." [SO:ke]
-synonym: "monocistronic primary transcript" EXACT []
-is_a: SO:0000185 ! implied link automatically realized ! primary_transcript
-is_a: SO:0000665 ! implied link automatically realized ! monocistronic_transcript
-intersection_of: SO:0000185 ! primary_transcript
-intersection_of: has_quality SO:0000878 ! monocistronic
-
-[Term]
-id: SO:0000633
-name: monocistronic_mRNA
-def: "An mRNA with either a single protein product, or for which the regions encoding all its protein products overlap." [SO:rd]
-synonym: "monocistronic mRNA" EXACT []
-synonym: "monocistronic processed transcript" EXACT []
-xref: http://en.wikipedia.org/wiki/Monocistronic_mRNA "wiki"
-is_a: SO:0000234 ! implied link automatically realized ! mRNA
-is_a: SO:0000665 ! implied link automatically realized ! monocistronic_transcript
-intersection_of: SO:0000234 ! mRNA
-intersection_of: has_quality SO:0000878 ! monocistronic
-
-[Term]
-id: SO:0000634
-name: polycistronic_mRNA
-def: "An mRNA that encodes multiple proteins from at least two non-overlapping regions." [SO:rd]
-synonym: "polycistronic mRNA" EXACT []
-synonym: "polycistronic processed transcript" RELATED []
-xref: http://en.wikipedia.org/wiki/Polycistronic_mRNA "wiki"
-is_a: SO:0000078 ! implied link automatically realized ! polycistronic_transcript
-is_a: SO:0000234 ! implied link automatically realized ! mRNA
-intersection_of: SO:0000234 ! mRNA
-intersection_of: has_quality SO:0000880 ! polycistronic
-
-[Term]
-id: SO:0000635
-name: mini_exon_donor_RNA
-def: "A primary transcript that donates the spliced leader to other mRNA." [SO:ke]
-synonym: "mini exon donor RNA" EXACT []
-synonym: "mini-exon donor RNA" EXACT []
-is_a: SO:0000185 ! primary_transcript
-
-[Term]
-id: SO:0000636
-name: spliced_leader_RNA
-synonym: "mini-exon" RELATED []
-synonym: "spliced leader RNA" EXACT []
-is_a: SO:0000835 ! primary_transcript_region
-relationship: part_of SO:0000635 ! mini_exon_donor_RNA
-
-[Term]
-id: SO:0000637
-name: engineered_plasmid
-def: "A plasmid that is engineered." [SO:xp]
-synonym: "engineered plasmid" EXACT []
-synonym: "engineered plasmid gene" RELATED []
-is_a: SO:0000155 ! implied link automatically realized ! plasmid
-is_a: SO:0000804 ! implied link automatically realized ! engineered_region
-intersection_of: SO:0000155 ! plasmid
-intersection_of: has_quality SO:0000783 ! engineered
-
-[Term]
-id: SO:0000638
-name: transcribed_spacer_region
-def: "Part of an rRNA transcription unit that is transcribed but discarded during maturation, not giving rise to any part of rRNA." [http://oregonstate.edu/instruction/bb492/general/glossary.html]
-synonym: "transcribed spacer region" EXACT []
-is_a: SO:0000838 ! rRNA_primary_transcript_region
-
-[Term]
-id: SO:0000639
-name: internal_transcribed_spacer_region
-def: "Non-coding regions of DNA sequence that separate genes coding for the 28S, 5.8S, and 18S ribosomal RNAs." [SO:ke]
-synonym: "internal transcribed spacer region" EXACT []
-is_a: SO:0000638 ! transcribed_spacer_region
-
-[Term]
-id: SO:0000640
-name: external_transcribed_spacer_region
-def: "Non-coding regions of DNA that precede the sequence that codes for the ribosomal RNA." [SO:ke]
-synonym: "external transcribed spacer region" EXACT []
-is_a: SO:0000638 ! transcribed_spacer_region
-
-[Term]
-id: SO:0000641
-name: tetranucleotide_repeat_microsatellite_feature
-synonym: "tetranucleotide repeat microsatellite feature" EXACT []
-is_a: SO:0000289 ! microsatellite
-
-[Term]
-id: SO:0000642
-name: SRP_RNA_encoding
-synonym: "SRP RNA encoding" EXACT []
-is_a: SO:0000011 ! non_protein_coding
-
-[Term]
-id: SO:0000643
-name: minisatellite
-def: "A repeat region containing tandemly repeated sequences having a unit length of 10 to 40 bp." [http://www.informatics.jax.org/silver/glossary.shtml]
-subset: SOFA
-xref: http://en.wikipedia.org/wiki/Minisatellite "wiki"
-is_a: SO:0000005 ! satellite_DNA
-
-[Term]
-id: SO:0000644
-name: antisense_RNA
-def: "Antisense RNA is RNA that is transcribed from the coding, rather than the template, strand of DNA. It is therefore complementary to mRNA." [SO:ke]
-subset: SOFA
-synonym: "antisense RNA" EXACT []
-xref: http://en.wikipedia.org/wiki/Antisense_RNA "wiki"
-is_a: SO:0000655 ! ncRNA
-relationship: derives_from SO:0000645 ! antisense_primary_transcript
-
-[Term]
-id: SO:0000645
-name: antisense_primary_transcript
-def: "The reverse complement of the primary transcript." [SO:ke]
-subset: SOFA
-synonym: "antisense primary transcript" EXACT []
-is_a: SO:0000185 ! primary_transcript
-
-[Term]
-id: SO:0000646
-name: siRNA
-def: "A small RNA molecule that is the product of a longer exogenous or endogenous dsRNA, which is either a bimolecular duplex or very long hairpin, processed (via the Dicer pathway) such that numerous siRNAs accumulate from both strands of the dsRNA. SRNAs trigger the cleavage of their target molecules." [PMID:12592000]
-subset: SOFA
-synonym: "small interfering RNA" EXACT []
-xref: http://en.wikipedia.org/wiki/SiRNA "wiki"
-is_a: SO:0000655 ! ncRNA
-
-[Term]
-id: SO:0000647
-name: miRNA_primary_transcript
-def: "A primary transcript encoding a micro RNA." [SO:ke]
-synonym: "micro RNA primary transcript" EXACT []
-synonym: "miRNA primary transcript" EXACT []
-is_a: SO:0000483 ! nc_primary_transcript
-
-[Term]
-id: SO:0000648
-name: stRNA_primary_transcript
-def: "A primary transcript encoding a small temporal mRNA (SO:0000649)." [SO:ke]
-synonym: "small temporal RNA primary transcript" EXACT []
-synonym: "stRNA primary transcript" EXACT []
-is_a: SO:0000647 ! miRNA_primary_transcript
-
-[Term]
-id: SO:0000649
-name: stRNA
-def: "Non-coding RNAs of about 21 nucleotides in length that regulate temporal development; first discovered in C. elegans." [PMID:11081512]
-subset: SOFA
-synonym: "small temporal RNA" EXACT []
-xref: http://en.wikipedia.org/wiki/StRNA "wiki"
-is_a: SO:0000655 ! ncRNA
-
-[Term]
-id: SO:0000650
-name: small_subunit_rRNA
-def: "Ribosomal RNA transcript that structures the small subunit of the ribosome." [SO:ke]
-subset: SOFA
-synonym: "small subunit rRNA" EXACT []
-synonym: "SSU RNA" EXACT [RSC:cb]
-synonym: "SSU rRNA" EXACT [RSC:cb]
-is_a: SO:0000252 ! rRNA
-relationship: derives_from SO:0000255 ! rRNA_small_subunit_primary_transcript
-
-[Term]
-id: SO:0000651
-name: large_subunit_rRNA
-def: "Ribosomal RNA transcript that structures the large subunit of the ribosome." [SO:ke]
-subset: SOFA
-synonym: "large subunit rRNA" EXACT []
-synonym: "LSU RNA" EXACT [RSC:cb]
-synonym: "LSU rRNA" EXACT [RSC:cb]
-is_a: SO:0000252 ! rRNA
-relationship: derives_from SO:0000325 ! rRNA_large_subunit_primary_transcript
-
-[Term]
-id: SO:0000652
-name: rRNA_5S
-def: "5S ribosomal RNA (5S rRNA) is a component of the large ribosomal subunit in both prokaryotes and eukaryotes. In eukaryotes, it is synthesised by RNA polymerase III (the other eukaryotic rRNAs are cleaved from a 45S precursor synthesised by RNA polymerase I). In Xenopus oocytes, it has been shown that fingers 4-7 of the nine-zinc finger transcription factor TFIIIA can bind to the central region of 5S RNA. Thus, in addition to positively regulating 5S rRNA transcription, TFIIIA also  [...]
-subset: SOFA
-synonym: "5S LSU rRNA" EXACT []
-synonym: "5S ribosomal RNA" EXACT []
-synonym: "5S rRNA" EXACT []
-synonym: "rRNA 5S" EXACT []
-xref: http://en.wikipedia.org/wiki/5S_ribosomal_RNA "wiki"
-is_a: SO:0000651 ! large_subunit_rRNA
-
-[Term]
-id: SO:0000653
-name: rRNA_28S
-def: "A component of the large ribosomal subunit." [SO:ke]
-subset: SOFA
-synonym: "28S LSU rRNA" EXACT []
-synonym: "28S ribosomal RNA" EXACT []
-synonym: "28S rRNA" EXACT []
-synonym: "rRNA 28S" EXACT []
-xref: http://en.wikipedia.org/wiki/28S_ribosomal_RNA "wiki"
-is_a: SO:0000651 ! large_subunit_rRNA
-
-[Term]
-id: SO:0000654
-name: maxicircle_gene
-def: "A mitochondrial gene located in a maxicircle." [SO:xp]
-synonym: "maxi-circle gene" EXACT []
-synonym: "maxicircle gene" EXACT []
-is_a: SO:0000089 ! implied link automatically realized ! kinetoplast_gene
-intersection_of: SO:0000089 ! kinetoplast_gene
-intersection_of: part_of SO:0000742 ! maxicircle
-
-[Term]
-id: SO:0000655
-name: ncRNA
-def: "An RNA transcript that does not encode for a protein rather the RNA molecule is the gene product." [SO:ke]
-comment: A ncRNA is a processed_transcript, so it may not contain parts such as transcribed_spacer_regions that are removed in the act of processing. For the corresponding primary_transcripts, please see term SO:0000483 nc_primary_transcript.
-subset: SOFA
-synonym: "noncoding RNA" EXACT []
-xref: http://en.wikipedia.org/wiki/NcRNA "wiki"
-is_a: SO:0000233 ! mature_transcript
-
-[Term]
-id: SO:0000656
-name: stRNA_encoding
-synonym: "stRNA encoding" EXACT []
-is_a: SO:0000011 ! non_protein_coding
-
-[Term]
-id: SO:0000657
-name: repeat_region
-def: "A region of sequence containing one or more repeat units." [SO:ke]
-subset: SOFA
-synonym: "repeat region" EXACT []
-is_a: SO:0001411 ! biological_region
-relationship: has_part SO:0000726 ! repeat_unit
-
-[Term]
-id: SO:0000658
-name: dispersed_repeat
-def: "A repeat that is located at dispersed sites in the genome." [SO:ke]
-subset: SOFA
-synonym: "dispersed repeat" EXACT []
-synonym: "interspersed repeat" EXACT []
-xref: http://en.wikipedia.org/wiki/Interspersed_repeat "wiki"
-is_a: SO:0000657 ! repeat_region
-
-[Term]
-id: SO:0000659
-name: tmRNA_encoding
-synonym: "tmRNA encoding" EXACT []
-is_a: SO:0000011 ! non_protein_coding
-
-[Term]
-id: SO:0000660
-name: DNA_invertase_target_sequence
-is_obsolete: true
-
-[Term]
-id: SO:0000661
-name: intron_attribute
-is_obsolete: true
-
-[Term]
-id: SO:0000662
-name: spliceosomal_intron
-def: "An intron which is spliced by the spliceosome." [SO:ke]
-comment: GO:0000398.
-subset: SOFA
-synonym: "spliceosomal intron" EXACT []
-is_a: SO:0000188 ! intron
-
-[Term]
-id: SO:0000663
-name: tRNA_encoding
-synonym: "tRNA encoding" EXACT []
-is_a: SO:0000011 ! non_protein_coding
-
-[Term]
-id: SO:0000664
-name: introgressed_chromosome_region
-synonym: "introgressed chromosome region" EXACT []
-is_a: SO:0000830 ! chromosome_part
-
-[Term]
-id: SO:0000665
-name: monocistronic_transcript
-def: "A transcript that is monocistronic." [SO:xp]
-synonym: "monocistronic transcript" EXACT []
-is_a: SO:0000673 ! implied link automatically realized ! transcript
-intersection_of: SO:0000673 ! transcript
-intersection_of: has_quality SO:0000878 ! monocistronic
-
-[Term]
-id: SO:0000666
-name: mobile_intron
-def: "An intron (mitochondrial, chloroplast, nuclear or prokaryotic) that encodes a double strand sequence specific endonuclease allowing for mobility." [SO:ke]
-synonym: "mobile intron" EXACT []
-is_a: SO:0000188 ! implied link automatically realized ! intron
-is_a: SO:0001037 ! implied link automatically realized ! mobile_genetic_element
-intersection_of: SO:0000188 ! intron
-intersection_of: has_quality SO:0001234 ! mobile
-
-[Term]
-id: SO:0000667
-name: insertion
-alt_id: SO:1000034
-def: "The sequence of one or more nucleotides added between two adjacent nucleotides in the sequence." [SO:ke]
-subset: DBVAR
-subset: SOFA
-synonym: "insertion" EXACT dbvar [http://www.ncbi.nlm.nih.gov/dbvar/]
-synonym: "nucleotide insertion" EXACT []
-synonym: "nucleotide_insertion" EXACT []
-is_a: SO:0001059 ! sequence_alteration
-is_a: SO:0001411 ! biological_region
-
-[Term]
-id: SO:0000668
-name: EST_match
-def: "A match against an EST sequence." [SO:ke]
-subset: SOFA
-synonym: "EST match" EXACT []
-is_a: SO:0000102 ! expressed_sequence_match
-
-[Term]
-id: SO:0000669
-name: sequence_rearrangement_feature
-synonym: "sequence rearrangement feature" EXACT []
-is_a: SO:0000298 ! recombination_feature
-
-[Term]
-id: SO:0000670
-name: chromosome_breakage_sequence
-def: "A sequence within the micronuclear DNA of ciliates at which chromosome breakage and telomere addition occurs during nuclear differentiation." [SO:ma]
-synonym: "chromosome breakage sequence" EXACT []
-is_a: SO:0000669 ! sequence_rearrangement_feature
-
-[Term]
-id: SO:0000671
-name: internal_eliminated_sequence
-def: "A sequence eliminated from the genome of ciliates during nuclear differentiation." [SO:ma]
-synonym: "internal eliminated sequence" EXACT []
-is_a: SO:0000669 ! sequence_rearrangement_feature
-
-[Term]
-id: SO:0000672
-name: macronucleus_destined_segment
-def: "A sequence that is conserved, although rearranged relative to the micronucleus, in the macronucleus of a ciliate genome." [SO:ma]
-synonym: "macronucleus destined segment" EXACT []
-is_a: SO:0000669 ! sequence_rearrangement_feature
-
-[Term]
-id: SO:0000673
-name: transcript
-def: "An RNA synthesized on a DNA or RNA template by an RNA polymerase." [SO:ma]
-subset: SOFA
-xref: http://en.wikipedia.org/wiki/RNA "wiki"
-is_a: SO:0000831 ! gene_member_region
-
-[Term]
-id: SO:0000674
-name: non_canonical_splice_site
-def: "A splice site where the donor and acceptor sites differ from the canonical form." [SO:ke]
-synonym: "non canonical splice site" EXACT []
-synonym: "non-canonical splice site" EXACT []
-is_obsolete: true
-consider: SO:0000678
-consider: SO:0000679
-
-[Term]
-id: SO:0000675
-name: canonical_splice_site
-def: "The major class of splice site with dinucleotides GT and AG for donor and acceptor sites, respectively." [SO:ke]
-synonym: "canonical splice site" EXACT []
-is_obsolete: true
-consider: SO:0000676
-consider: SO:0000677
-
-[Term]
-id: SO:0000676
-name: canonical_three_prime_splice_site
-def: "The canonical 3' splice site has the sequence \"AG\"." [SO:ke]
-synonym: "canonical 3' splice site" EXACT []
-synonym: "canonical three prime splice site" EXACT []
-is_a: SO:0000164 ! three_prime_cis_splice_site
-
-[Term]
-id: SO:0000677
-name: canonical_five_prime_splice_site
-def: "The canonical 5' splice site has the sequence \"GT\"." [SO:ke]
-synonym: "canonical 5' splice site" EXACT []
-synonym: "canonical five prime splice site" EXACT []
-is_a: SO:0000163 ! five_prime_cis_splice_site
-
-[Term]
-id: SO:0000678
-name: non_canonical_three_prime_splice_site
-def: "A 3' splice site that does not have the sequence \"AG\"." [SO:ke]
-synonym: "non canonical 3' splice site" RELATED []
-synonym: "non canonical three prime splice site" EXACT []
-synonym: "non-canonical three prime splice site" EXACT []
-is_a: SO:0000164 ! three_prime_cis_splice_site
-
-[Term]
-id: SO:0000679
-name: non_canonical_five_prime_splice_site
-def: "A 5' splice site which does not have the sequence \"GT\"." [SO:ke]
-synonym: "non canonical 5' splice site" EXACT []
-synonym: "non canonical five prime splice site" EXACT []
-synonym: "non-canonical five prime splice site" EXACT []
-is_a: SO:0000163 ! five_prime_cis_splice_site
-
-[Term]
-id: SO:0000680
-name: non_canonical_start_codon
-def: "A start codon that is not the usual AUG sequence." [SO:ke]
-synonym: "non ATG start codon" EXACT []
-synonym: "non canonical start codon" EXACT []
-synonym: "non-canonical start codon" EXACT []
-is_a: SO:0000318 ! start_codon
-
-[Term]
-id: SO:0000681
-name: aberrant_processed_transcript
-def: "A transcript that has been processed \"incorrectly\", for example by the failure of splicing of one or more exons." [SO:ke]
-synonym: "aberrant processed transcript" EXACT []
-is_a: SO:0000673 ! transcript
-
-[Term]
-id: SO:0000682
-name: splicing_feature
-is_obsolete: true
-
-[Term]
-id: SO:0000683
-name: exonic_splice_enhancer
-def: "Exonic splicing enhancers (ESEs) facilitate exon definition by assisting in the recruitment of splicing factors to the adjacent intron." [http://www.ncbi.nlm.nih.gov\:80/entrez/query.fcgi?cmd=Retrieve&db=PubMed&list_uids=12403462&dopt=Abstract]
-synonym: "exonic splice enhancer" EXACT []
-is_a: SO:0000344 ! splice_enhancer
-
-[Term]
-id: SO:0000684
-name: nuclease_sensitive_site
-def: "A region of nucleotide sequence targeted by a nuclease enzyme." [SO:ma]
-subset: SOFA
-synonym: "nuclease sensitive site" EXACT []
-is_a: SO:0000059 ! nuclease_binding_site
-
-[Term]
-id: SO:0000685
-name: DNAseI_hypersensitive_site
-synonym: "DHS" EXACT []
-synonym: "DNAseI hypersensitive site" EXACT []
-is_a: SO:0000322 ! nuclease_hypersensitive_site
-
-[Term]
-id: SO:0000686
-name: translocation_element
-def: "A chromosomal translocation whereby the chromosomes carrying non-homologous centromeres may be recovered independently. These chromosomes are described as translocation elements. This occurs for some translocations, particularly but not exclusively, reciprocal translocations." [SO:ma]
-synonym: "translocation element" EXACT []
-is_a: SO:1000044 ! chromosomal_translocation
-
-[Term]
-id: SO:0000687
-name: deletion_junction
-def: "The space between two bases in a sequence which marks the position where a deletion has occurred." [SO:ke]
-subset: SOFA
-synonym: "deletion junction" EXACT []
-is_a: SO:0000699 ! junction
-
-[Term]
-id: SO:0000688
-name: golden_path
-def: "A set of subregions selected from sequence contigs which when concatenated form a nonredundant linear sequence." [SO:ls]
-subset: SOFA
-synonym: "golden path" EXACT []
-is_a: SO:0000353 ! sequence_assembly
-
-[Term]
-id: SO:0000689
-name: cDNA_match
-def: "A match against cDNA sequence." [SO:ke]
-subset: SOFA
-synonym: "cDNA match" EXACT []
-is_a: SO:0000102 ! expressed_sequence_match
-
-[Term]
-id: SO:0000690
-name: gene_with_polycistronic_transcript
-def: "A gene that encodes a polycistronic transcript." [SO:xp]
-synonym: "gene with polycistronic transcript" EXACT []
-is_a: SO:0000704 ! implied link automatically realized ! gene
-intersection_of: SO:0000704 ! gene
-intersection_of: transcribed_to SO:0000078 ! polycistronic_transcript
-
-[Term]
-id: SO:0000691
-name: cleaved_initiator_methionine
-alt_id: BS:00067
-def: "The initiator methionine that has been cleaved from a mature polypeptide sequence." [EBIBS:GAR]
-subset: biosapiens
-synonym: "cleaved initiator methionine" EXACT []
-synonym: "init_met" RELATED [uniprot:feature_type]
-synonym: "initiator methionine" RELATED []
-is_a: SO:0100011 ! cleaved_peptide_region
-
-[Term]
-id: SO:0000692
-name: gene_with_dicistronic_transcript
-def: "A gene that encodes a dicistronic transcript." [SO:xp]
-synonym: "gene with dicistronic transcript" EXACT []
-is_a: SO:0000690 ! implied link automatically realized ! gene_with_polycistronic_transcript
-intersection_of: SO:0000690 ! gene_with_polycistronic_transcript
-intersection_of: transcribed_to SO:0000079 ! dicistronic_transcript
-
-[Term]
-id: SO:0000693
-name: gene_with_recoded_mRNA
-def: "A gene that encodes an mRNA that is recoded." [SO:xp]
-synonym: "gene with recoded mRNA" EXACT []
-is_a: SO:0001217 ! implied link automatically realized ! protein_coding_gene
-intersection_of: SO:0001217 ! protein_coding_gene
-intersection_of: has_quality SO:0000881 ! recoded
-
-[Term]
-id: SO:0000694
-name: SNP
-def: "SNPs are single base pair positions in genomic DNA at which different sequence alternatives exist in normal individuals in some population(s), wherein the least frequent variant has an abundance of 1% or greater." [SO:cb]
-subset: SOFA
-synonym: "single nucleotide polymorphism" EXACT []
-is_a: SO:0001483 ! SNV
-
-[Term]
-id: SO:0000695
-name: reagent
-def: "A sequence used in experiment." [SO:ke]
-comment: Requested by Lynn Crosby, jan 2006.
-subset: SOFA
-is_a: SO:0001409 ! biomaterial_region
-
-[Term]
-id: SO:0000696
-name: oligo
-def: "A short oligonucleotide sequence, of length on the order of 10's of bases; either single or double stranded." [SO:ma]
-subset: SOFA
-synonym: "oligonucleotide" EXACT []
-xref: http://en.wikipedia.org/wiki/Oligonucleotide "wiki"
-is_a: SO:0000695 ! reagent
-
-[Term]
-id: SO:0000697
-name: gene_with_stop_codon_read_through
-def: "A gene that encodes a transcript with stop codon readthrough." [SO:xp]
-synonym: "gene with stop codon read through" EXACT []
-is_a: SO:0000693 ! implied link automatically realized ! gene_with_recoded_mRNA
-intersection_of: SO:0000693 ! gene_with_recoded_mRNA
-intersection_of: has_part SO:0000883 ! stop_codon_read_through
-
-[Term]
-id: SO:0000698
-name: gene_with_stop_codon_redefined_as_pyrrolysine
-def: "A gene encoding an mRNA that has the stop codon redefined as pyrrolysine." [SO:xp]
-synonym: "gene with stop codon redefined as pyrrolysine" EXACT []
-is_a: SO:0000697 ! implied link automatically realized ! gene_with_stop_codon_read_through
-intersection_of: SO:0000693 ! gene_with_recoded_mRNA
-intersection_of: has_part SO:0000884 ! stop_codon_redefined_as_pyrrolysine
-
-[Term]
-id: SO:0000699
-name: junction
-def: "A sequence_feature with an extent of zero." [SO:ke]
-comment: A junction is a boundary between regions. A boundary has an extent of zero.
-subset: SOFA
-synonym: "boundary" EXACT []
-synonym: "breakpoint" EXACT []
-is_a: SO:0000110 ! sequence_feature
-disjoint_from: SO:0000001 ! region
-
-[Term]
-id: SO:0000700
-name: remark
-def: "A comment about the sequence." [SO:ke]
-subset: SOFA
-is_a: SO:0001410 ! experimental_feature
-
-[Term]
-id: SO:0000701
-name: possible_base_call_error
-def: "A region of sequence where the validity of the base calling is questionable." [SO:ke]
-subset: SOFA
-synonym: "possible base call error" EXACT []
-is_a: SO:0000413 ! sequence_difference
-
-[Term]
-id: SO:0000702
-name: possible_assembly_error
-def: "A region of sequence where there may have been an error in the assembly." [SO:ke]
-subset: SOFA
-synonym: "possible assembly error" EXACT []
-is_a: SO:0000413 ! sequence_difference
-
-[Term]
-id: SO:0000703
-name: experimental_result_region
-def: "A region of sequence implicated in an experimental result." [SO:ke]
-subset: SOFA
-synonym: "experimental result region" EXACT []
-is_a: SO:0000700 ! remark
-
-[Term]
-id: SO:0000704
-name: gene
-def: "A region (or regions) that includes all of the sequence elements necessary to encode a functional transcript. A gene may include regulatory regions, transcribed regions and/or other functional sequence regions." [SO:immuno_workshop]
-comment: This term is mapped to MGED. Do not obsolete without consulting MGED ontology. A gene may be considered as a unit of inheritance.
-subset: SOFA
-xref: http://en.wikipedia.org/wiki/Gene "wiki"
-is_a: SO:0001411 ! biological_region
-relationship: member_of SO:0005855 ! gene_group
-
-[Term]
-id: SO:0000705
-name: tandem_repeat
-def: "Two or more adjcent copies of a region (of length greater than 1)." [SO:ke]
-subset: SOFA
-synonym: "tandem repeat" EXACT []
-xref: http://en.wikipedia.org/wiki/Tandem_repeat "wiki"
-xref: http://www.sci.sdsu.edu/~smaloy/Glossary/T.html
-is_a: SO:0000657 ! repeat_region
-
-[Term]
-id: SO:0000706
-name: trans_splice_acceptor_site
-def: "The 3' splice site of the acceptor primary transcript." [SO:ke]
-comment: This region contains a polypyridine tract and AG dinucleotide in some organisms and is UUUCAG in C. elegans.
-subset: SOFA
-synonym: "3' trans splice site" RELATED []
-synonym: "trans splice acceptor site" EXACT []
-is_a: SO:0001420 ! trans_splice_site
-
-[Term]
-id: SO:0000707
-name: trans_splice_donor_site
-def: "The 5' five prime splice site region of the donor RNA." [SO:ke]
-comment: SL RNA contains a donor site.
-synonym: "5 prime trans splice site" RELATED []
-synonym: "trans splice donor site" EXACT []
-synonym: "trans-splice donor site" EXACT []
-is_a: SO:0001420 ! trans_splice_site
-
-[Term]
-id: SO:0000708
-name: SL1_acceptor_site
-def: "A trans_splicing_acceptor_site which appends the 22nt SL1 RNA leader sequence to the 5' end of most mRNAs." [SO:nlw]
-synonym: "SL1 acceptor site" EXACT []
-is_a: SO:0000706 ! trans_splice_acceptor_site
-
-[Term]
-id: SO:0000709
-name: SL2_acceptor_site
-def: "A trans_splicing_acceptor_site which appends the 22nt SL2 RNA leader sequence to the 5' end of mRNAs. SL2 acceptor sites occur in genes in internal segments of polycistronic transcripts." [SO:nlw]
-synonym: "SL2 acceptor site" EXACT []
-is_a: SO:0000706 ! trans_splice_acceptor_site
-
-[Term]
-id: SO:0000710
-name: gene_with_stop_codon_redefined_as_selenocysteine
-def: "A gene encoding an mRNA that has the stop codon redefined as selenocysteine." [SO:xp]
-synonym: "gene with stop codon redefined as selenocysteine" EXACT []
-is_a: SO:0000697 ! implied link automatically realized ! gene_with_stop_codon_read_through
-intersection_of: SO:0000697 ! gene_with_stop_codon_read_through
-intersection_of: has_part SO:0000885 ! stop_codon_redefined_as_selenocysteine
-
-[Term]
-id: SO:0000711
-name: gene_with_mRNA_recoded_by_translational_bypass
-def: "A gene with mRNA recoded by translational bypass." [SO:xp]
-synonym: "gene with mRNA recoded by translational bypass" EXACT []
-is_a: SO:0000693 ! implied link automatically realized ! gene_with_recoded_mRNA
-intersection_of: SO:0001217 ! protein_coding_gene
-intersection_of: has_quality SO:0000886 ! recoded_by_translational_bypass
-
-[Term]
-id: SO:0000712
-name: gene_with_transcript_with_translational_frameshift
-def: "A gene encoding a transcript that has a translational frameshift." [SO:xp]
-synonym: "gene with transcript with translational frameshift" EXACT []
-is_a: SO:0000693 ! implied link automatically realized ! gene_with_recoded_mRNA
-intersection_of: SO:0000693 ! gene_with_recoded_mRNA
-intersection_of: has_quality SO:0000887 ! translationally_frameshifted
-
-[Term]
-id: SO:0000713
-name: DNA_motif
-def: "A motif that is active in the DNA form of the sequence." [SO:ke]
-synonym: "DNA motif" EXACT []
-xref: http://en.wikipedia.org/wiki/DNA_motif "wiki"
-is_a: SO:0000714 ! nucleotide_motif
-
-[Term]
-id: SO:0000714
-name: nucleotide_motif
-def: "A region of nucleotide sequence corresponding to a known motif." [SO:ke]
-subset: SOFA
-synonym: "nucleotide motif" EXACT []
-is_a: SO:0001683 ! sequence_motif
-
-[Term]
-id: SO:0000715
-name: RNA_motif
-def: "A motif that is active in RNA sequence." [SO:ke]
-subset: SOFA
-synonym: "RNA motif" EXACT []
-is_a: SO:0000714 ! nucleotide_motif
-
-[Term]
-id: SO:0000716
-name: dicistronic_mRNA
-def: "An mRNA that has the quality dicistronic." [SO:ke]
-synonym: "dicistronic mRNA" EXACT []
-synonym: "dicistronic processed transcript" RELATED []
-is_a: SO:0000079 ! implied link automatically realized ! dicistronic_transcript
-is_a: SO:0000634 ! implied link automatically realized ! polycistronic_mRNA
-intersection_of: SO:0000234 ! mRNA
-intersection_of: has_quality SO:0000879 ! dicistronic
-
-[Term]
-id: SO:0000717
-name: reading_frame
-def: "A nucleic acid sequence that when read as sequential triplets, has the potential of encoding a sequential string of amino acids. It need not contain the start or stop codon." [SGD:rb]
-comment: This term was added after a request by SGD. August 2004. Modified after SO meeting in Cambridge to not include start or stop.
-subset: SOFA
-synonym: "reading frame" EXACT []
-xref: http://en.wikipedia.org/wiki/Reading_frame "wiki"
-is_a: SO:0001410 ! experimental_feature
-
-[Term]
-id: SO:0000718
-name: blocked_reading_frame
-def: "A reading_frame that is interrupted by one or more stop codons; usually identified through intergenomic sequence comparisons." [SGD:rb]
-comment: Term requested by Rama from SGD.
-synonym: "blocked reading frame" EXACT []
-is_a: SO:0000717 ! reading_frame
-
-[Term]
-id: SO:0000719
-name: ultracontig
-def: "An ordered and oriented set of scaffolds based on somewhat weaker sets of inferential evidence such as one set of mate pair reads together with supporting evidence from ESTs or location of markers from SNP or microsatellite maps, or cytogenetic localization of contained markers." [FB:WG]
-subset: SOFA
-synonym: "superscaffold" RELATED []
-is_a: SO:0000353 ! sequence_assembly
-
-[Term]
-id: SO:0000720
-name: foreign_transposable_element
-def: "A transposable element that is foreign." [SO:ke]
-comment: requested by Michael on 19 Nov 2004.
-synonym: "foreign transposable element" EXACT []
-is_a: SO:0000101 ! implied link automatically realized ! transposable_element
-intersection_of: SO:0000101 ! transposable_element
-intersection_of: has_quality SO:0000784 ! foreign
-
-[Term]
-id: SO:0000721
-name: gene_with_dicistronic_primary_transcript
-def: "A gene that encodes a dicistronic primary transcript." [SO:xp]
-comment: Requested by Michael, 19 nov 2004.
-synonym: "gene with dicistronic primary transcript" EXACT []
-is_a: SO:0000692 ! implied link automatically realized ! gene_with_dicistronic_transcript
-intersection_of: SO:0000692 ! gene_with_dicistronic_transcript
-intersection_of: transcribed_to SO:1001197 ! dicistronic_primary_transcript
-
-[Term]
-id: SO:0000722
-name: gene_with_dicistronic_mRNA
-def: "A gene that encodes a polycistronic mRNA." [SO:xp]
-comment: Requested by MA nov 19 2004.
-synonym: "gene with dicistronic mRNA" EXACT []
-synonym: "gene with dicistronic processed transcript" EXACT []
-is_a: SO:0000692 ! implied link automatically realized ! gene_with_dicistronic_transcript
-intersection_of: SO:0000692 ! gene_with_dicistronic_transcript
-intersection_of: transcribed_to SO:0000716 ! dicistronic_mRNA
-
-[Term]
-id: SO:0000723
-name: iDNA
-def: "Genomic sequence removed from the genome, as a normal event, by a process of recombination." [SO:ma]
-synonym: "intervening DNA" EXACT []
-xref: http://en.wikipedia.org/wiki/IDNA "wiki"
-is_a: SO:0000298 ! recombination_feature
-
-[Term]
-id: SO:0000724
-name: oriT
-def: "A region of a DNA molecule where transfer is initiated during the process of conjugation or mobilization." [http://www.ebi.ac.uk/embl/Documentation/FT_definitions/feature_table.html]
-subset: SOFA
-synonym: "origin of transfer" EXACT []
-xref: http://en.wikipedia.org/wiki/Origin_of_transfer "wiki"
-is_a: SO:0000296 ! origin_of_replication
-
-[Term]
-id: SO:0000725
-name: transit_peptide
-alt_id: BS:00055
-def: "The transit_peptide is a short region at the N-terminus of the peptide that directs the protein to an organelle (chloroplast, mitochondrion, microbody or cyanelle)." [http://www.ebi.ac.uk/embl/Documentation/FT_definitions/feature_table.html]
-comment: Added to bring SO inline with the embl ddbj genbank feature table. Old definition before biosapiens: The coding sequence for an N-terminal domain of a nuclear-encoded organellar protein. This domain is involved in post translational import of the protein into the organelle.
-subset: biosapiens
-subset: SOFA
-synonym: "signal" RELATED []
-synonym: "transit" RELATED [uniprot:feature_type]
-synonym: "transit peptide" EXACT []
-is_a: SO:0001527 ! peptide_localization_signal
-
-[Term]
-id: SO:0000726
-name: repeat_unit
-def: "The simplest repeated component of a repeat region. A single repeat." [SO:ke]
-comment: Added to comply with the feature table. A single repeat.
-synonym: "repeat unit" EXACT []
-xref: http://www.ebi.ac.uk/embl/Documentation/FT_definitions/feature_table.html
-is_a: SO:0001411 ! biological_region
-
-[Term]
-id: SO:0000727
-name: CRM
-def: "A regulatory_region where more than 1 TF_binding_site together are regulatorily active." [SO:SG]
-comment: Requested by Stepen Grossmann Dec 2004.
-subset: SOFA
-synonym: "cis regulatory module" EXACT []
-synonym: "TF module" EXACT []
-is_a: SO:0001055 ! implied link automatically realized ! transcriptional_cis_regulatory_region
-intersection_of: SO:0001055 ! transcriptional_cis_regulatory_region
-intersection_of: has_part SO:0000235 ! TF_binding_site
-
-[Term]
-id: SO:0000728
-name: intein
-def: "A region of a peptide that is able to excise itself and rejoin the remaining portions with a peptide bond." [SO:ke]
-comment: Intein-mediated protein splicing occurs after mRNA has been translated into a protein.
-synonym: "protein intron" RELATED []
-xref: http://en.wikipedia.org/wiki/Intein "wiki"
-is_a: SO:0100011 ! cleaved_peptide_region
-
-[Term]
-id: SO:0000729
-name: intein_containing
-def: "An attribute of protein-coding genes where the initial protein product contains an intein." [SO:ke]
-synonym: "intein containing" EXACT []
-is_a: SO:0000010 ! protein_coding
-
-[Term]
-id: SO:0000730
-name: gap
-def: "A gap in the sequence of known length. The unknown bases are filled in with N's." [SO:ke]
-subset: SOFA
-is_a: SO:0000143 ! assembly_component
-relationship: part_of SO:0000353 ! sequence_assembly
-
-[Term]
-id: SO:0000731
-name: fragmentary
-def: "An attribute to describe a feature that is incomplete." [SO:ke]
-comment: Term added because of request by MO people.
-synonym: "fragment" EXACT []
-is_a: SO:0000905 ! status
-
-[Term]
-id: SO:0000732
-name: predicted
-def: "An attribute describing an unverified region." [SO:ke]
-xref: http://en.wikipedia.org/wiki/Predicted "wiki"
-is_a: SO:0000905 ! status
-
-[Term]
-id: SO:0000733
-name: feature_attribute
-def: "An attribute describing a located_sequence_feature." [SO:ke]
-synonym: "feature attribute" EXACT []
-is_a: SO:0000400 ! sequence_attribute
-
-[Term]
-id: SO:0000734
-name: exemplar_mRNA
-def: "An exemplar is a representative cDNA sequence for each gene. The exemplar approach is a method that usually involves some initial clustering into gene groups and the subsequent selection of a representative from each gene group." [http://mged.sourceforge.net/ontologies/MGEDontology.php]
-comment: Added for the MO people.
-synonym: "exemplar mRNA" EXACT []
-is_a: SO:0000234 ! implied link automatically realized ! mRNA
-intersection_of: SO:0000234 ! mRNA
-intersection_of: has_quality SO:0000864 ! exemplar
-
-[Term]
-id: SO:0000735
-name: sequence_location
-synonym: "sequence location" EXACT []
-is_a: SO:0000400 ! sequence_attribute
-
-[Term]
-id: SO:0000736
-name: organelle_sequence
-synonym: "organelle sequence" EXACT []
-is_a: SO:0000735 ! sequence_location
-
-[Term]
-id: SO:0000737
-name: mitochondrial_sequence
-comment: This term is mapped to MGED. Do not obsolete without consulting MGED ontology.
-synonym: "mitochondrial sequence" EXACT []
-is_a: SO:0000736 ! organelle_sequence
-
-[Term]
-id: SO:0000738
-name: nuclear_sequence
-synonym: "nuclear sequence" EXACT []
-is_a: SO:0000736 ! organelle_sequence
-
-[Term]
-id: SO:0000739
-name: nucleomorphic_sequence
-synonym: "nucleomorphic sequence" EXACT []
-is_a: SO:0000736 ! organelle_sequence
-
-[Term]
-id: SO:0000740
-name: plastid_sequence
-synonym: "plastid sequence" EXACT []
-is_a: SO:0000736 ! organelle_sequence
-
-[Term]
-id: SO:0000741
-name: kinetoplast
-alt_id: SO:0000826
-def: "A kinetoplast is an interlocked network of thousands of minicircles and tens of maxi circles, located near the base of the flagellum of some protozoan species." [PMID:8395055]
-synonym: "kinetoplast_chromosome" EXACT []
-xref: http://en.wikipedia.org/wiki/Kinetoplast "wiki"
-is_a: SO:0001026 ! implied link automatically realized ! genome
-is_a: SO:0001260 ! sequence_collection
-intersection_of: SO:0001260 ! sequence_collection
-intersection_of: has_part SO:0000742 ! maxicircle
-intersection_of: has_part SO:0000980 ! minicircle
-
-[Term]
-id: SO:0000742
-name: maxicircle
-alt_id: SO:0000827
-def: "A maxicircle is a replicon, part of a kinetoplast, that contains open reading frames and replicates via a rolling circle method." [PMID:8395055]
-synonym: "maxicircle_chromosome" EXACT []
-is_a: SO:0001235 ! replicon
-relationship: part_of SO:0000741 ! kinetoplast
-
-[Term]
-id: SO:0000743
-name: apicoplast_sequence
-synonym: "apicoplast sequence" EXACT []
-is_a: SO:0000740 ! plastid_sequence
-
-[Term]
-id: SO:0000744
-name: chromoplast_sequence
-synonym: "chromoplast sequence" EXACT []
-is_a: SO:0000740 ! plastid_sequence
-
-[Term]
-id: SO:0000745
-name: chloroplast_sequence
-synonym: "chloroplast sequence" EXACT []
-is_a: SO:0000740 ! plastid_sequence
-
-[Term]
-id: SO:0000746
-name: cyanelle_sequence
-synonym: "cyanelle sequence" EXACT []
-is_a: SO:0000740 ! plastid_sequence
-
-[Term]
-id: SO:0000747
-name: leucoplast_sequence
-synonym: "leucoplast sequence" EXACT []
-is_a: SO:0000740 ! plastid_sequence
-
-[Term]
-id: SO:0000748
-name: proplastid_sequence
-synonym: "proplastid sequence" EXACT []
-is_a: SO:0000740 ! plastid_sequence
-
-[Term]
-id: SO:0000749
-name: plasmid_location
-synonym: "plasmid location" EXACT []
-is_a: SO:0000735 ! sequence_location
-
-[Term]
-id: SO:0000750
-name: amplification_origin
-def: "An origin_of_replication that is used for the amplification of a chromosomal nucleic acid sequence." [SO:ma]
-synonym: "amplification origin" EXACT []
-is_a: SO:0000296 ! origin_of_replication
-
-[Term]
-id: SO:0000751
-name: proviral_location
-synonym: "proviral location" EXACT []
-is_a: SO:0000735 ! sequence_location
-
-[Term]
-id: SO:0000752
-name: gene_group_regulatory_region
-subset: SOFA
-synonym: "gene group regulatory region" EXACT []
-is_a: SO:0001679 ! transcription_regulatory_region
-relationship: member_of SO:0005855 ! gene_group
-
-[Term]
-id: SO:0000753
-name: clone_insert
-def: "The region of sequence that has been inserted and is being propagated by the clone." [SO:ke]
-subset: SOFA
-synonym: "clone insert" EXACT []
-is_a: SO:0000695 ! reagent
-relationship: part_of SO:0000151 ! clone
-
-[Term]
-id: SO:0000754
-name: lambda_vector
-def: "The lambda bacteriophage is the vector for the linear lambda clone. The genes involved in the lysogenic pathway are removed from the from the viral DNA. Up to 25 kb of foreign DNA can then be inserted into the lambda genome." [ISBN:0-1767-2380-8]
-synonym: "lambda vector" EXACT []
-is_a: SO:0000440 ! vector_replicon
-
-[Term]
-id: SO:0000755
-name: plasmid_vector
-synonym: "plasmid vector" EXACT []
-xref: http://en.wikipedia.org/wiki/Plasmid_vector#Vectors "wiki"
-is_a: SO:0000440 ! vector_replicon
-intersection_of: SO:0001235 ! replicon
-intersection_of: derives_from SO:0000155 ! plasmid
-
-[Term]
-id: SO:0000756
-name: cDNA
-def: "DNA synthesized by reverse transcriptase using RNA as a template." [SO:ma]
-xref: http://en.wikipedia.org/wiki/CDNA "wiki"
-is_a: SO:0000352 ! DNA
-
-[Term]
-id: SO:0000757
-name: single_stranded_cDNA
-synonym: "single strand cDNA" EXACT []
-synonym: "single stranded cDNA" EXACT []
-synonym: "single-strand cDNA" RELATED []
-is_a: SO:0000756 ! cDNA
-
-[Term]
-id: SO:0000758
-name: double_stranded_cDNA
-synonym: "double strand cDNA" RELATED []
-synonym: "double stranded cDNA" EXACT []
-synonym: "double-strand cDNA" RELATED []
-is_a: SO:0000756 ! cDNA
-
-[Term]
-id: SO:0000759
-name: plasmid_clone
-is_obsolete: true
-
-[Term]
-id: SO:0000760
-name: YAC_clone
-is_obsolete: true
-
-[Term]
-id: SO:0000761
-name: phagemid_clone
-is_obsolete: true
-
-[Term]
-id: SO:0000762
-name: PAC_clone
-synonym: "P1_clone" RELATED []
-is_obsolete: true
-
-[Term]
-id: SO:0000763
-name: fosmid_clone
-is_obsolete: true
-
-[Term]
-id: SO:0000764
-name: BAC_clone
-is_obsolete: true
-
-[Term]
-id: SO:0000765
-name: cosmid_clone
-is_obsolete: true
-
-[Term]
-id: SO:0000766
-name: pyrrolysyl_tRNA
-def: "A tRNA sequence that has a pyrrolysine anticodon, and a 3' pyrrolysine binding region." [SO:ke]
-synonym: "pyrrolysyl tRNA" EXACT []
-synonym: "pyrrolysyl-transfer ribonucleic acid" EXACT []
-synonym: "pyrrolysyl-transfer RNA" EXACT []
-is_a: SO:0000253 ! tRNA
-relationship: derives_from SO:0001178 ! pyrrolysine_tRNA_primary_transcript
-
-[Term]
-id: SO:0000767
-name: clone_insert_start
-is_obsolete: true
-
-[Term]
-id: SO:0000768
-name: episome
-def: "A plasmid that may integrate with a chromosome." [SO:ma]
-is_a: SO:0000155 ! plasmid
-
-[Term]
-id: SO:0000769
-name: tmRNA_coding_piece
-def: "The region of a two-piece tmRNA that bears the reading frame encoding the proteolysis tag. The tmRNA gene undergoes circular permutation in some groups of bacteria. Processing of the transcripts from such a gene leaves the mature tmRNA in two pieces, base-paired together." [doi:10.1093/nar/gkh795, Indiana:kw, issn:1362-4962]
-comment: Added in response to comment from Kelly Williams from Indiana. Nov 2005.
-synonym: "tmRNA coding piece" EXACT []
-is_a: SO:0000847 ! tmRNA_region
-
-[Term]
-id: SO:0000770
-name: tmRNA_acceptor_piece
-def: "The acceptor region of a two-piece tmRNA that when mature is charged at its 3' end with alanine. The tmRNA gene undergoes circular permutation in some groups of bacteria; processing of the transcripts from such a gene leaves the mature tmRNA in two pieces, base-paired together." [doi:10.1093/nar/gkh795, Indiana:kw]
-comment: Added in response to Kelly Williams from Indiana. Date: Nov 2005.
-synonym: "tmRNA acceptor piece" EXACT []
-is_a: SO:0000847 ! tmRNA_region
-
-[Term]
-id: SO:0000771
-name: QTL
-def: "A quantitative trait locus (QTL) is a polymorphic locus which contains alleles that differentially affect the expression of a continuously distributed phenotypic trait. Usually it is a marker described by statistical association to quantitative variation in the particular phenotypic trait that is thought to be controlled by the cumulative action of alleles at multiple loci." [http://rgd.mcw.edu/tu/qtls/]
-comment: Added in respose to request by Simon Twigger November 14th 2005.
-synonym: "quantitative trait locus" EXACT []
-is_a: SO:0001411 ! biological_region
-
-[Term]
-id: SO:0000772
-name: genomic_island
-def: "A genomic island is an integrated mobile genetic element, characterized by size (over 10 Kb). It that has features that suggest a foreign origin. These can include nucleotide distribution (oligonucleotides signature, CG content etc.) that differs from the bulk of the chromosome and/or genes suggesting DNA mobility." [Phigo:at, SO:ke]
-comment: Genomic islands are transmissible elements characterized by large size (>10kb).
-synonym: "genomic island" EXACT []
-xref: http://en.wikipedia.org/wiki/Genomic_island "wiki"
-is_a: SO:0001039 ! integrated_mobile_genetic_element
-
-[Term]
-id: SO:0000773
-name: pathogenic_island
-def: "Mobile genetic elements that contribute to rapid changes in virulence potential. They are present on the genomes of pathogenic strains but absent from the genomes of non pathogenic members of the same or related species." [SO:ke]
-comment: Nature Reviews Microbiology 2, 414-424 (2004); doi:10.1038 micro 884 GENOMIC ISLANDS IN PATHOGENIC AND ENVIRONMENTAL MICROORGANISMS Ulrich Dobrindt, Bianca Hochhut, Ute Hentschel & Jorg Hacker.
-synonym: "pathogenic island" EXACT []
-is_a: SO:0000772 ! genomic_island
-
-[Term]
-id: SO:0000774
-name: metabolic_island
-def: "A transmissible element containing genes involved in metabolism, analogous to the pathogenicity islands of gram negative bacteria." [SO:ke]
-comment: Genes for phenolic compound degradation in Pseudomonas putida are found on metabolic islands.
-synonym: "metabolic island" EXACT []
-is_a: SO:0000772 ! genomic_island
-
-[Term]
-id: SO:0000775
-name: adaptive_island
-def: "An adaptive island is a genomic island that provides an adaptive advantage to the host." [SO:ke]
-comment: The iron-uptake ability of many pathogens are conveyed by adaptive islands. Nature Reviews Microbiology 2, 414-424 (2004); doi:10.1038 micro 884 GENOMIC ISLANDS IN PATHOGENIC AND ENVIRONMENTAL MICROORGANISMS Ulrich Dobrindt, Bianca Hochhut, Ute Hentschel & Jorg Hacker.
-synonym: "adaptive island" EXACT []
-is_a: SO:0000772 ! genomic_island
-
-[Term]
-id: SO:0000776
-name: symbiosis_island
-def: "A transmissible element containing genes involved in symbiosis, analogous to the pathogenicity islands of gram negative bacteria." [SO:ke]
-comment: Nitrogen fixation in Rhizobiaceae species is encoded by symbiosis islands. Evolution of rhizobia by acquisition of a 500-kb symbiosis island that integrates into a phe-tRNA gene. John T. Sullivan and Clive W. Ronso PNAS 1998 Apr 28 95 (9) 5145-5149.
-synonym: "symbiosis island" EXACT []
-is_a: SO:0000772 ! genomic_island
-
-[Term]
-id: SO:0000777
-name: pseudogenic_rRNA
-def: "A non functional descendent of an rRNA." [SO:ke]
-comment: Added Jan 2006 to allow the annotation of the pseudogenic rRNA by flybase. Non-functional is defined as its transcription is prevented due to one or more mutatations.
-subset: SOFA
-synonym: "pseudogenic rRNA" EXACT []
-is_a: SO:0000462 ! pseudogenic_region
-
-[Term]
-id: SO:0000778
-name: pseudogenic_tRNA
-def: "A non functional descendent of a tRNA." [SO:ke]
-comment: Added Jan 2006 to allow the annotation of the pseudogenic tRNA by flybase. Non-functional is defined as its transcription is prevented due to one or more mutatations.
-subset: SOFA
-synonym: "pseudogenic tRNA" EXACT []
-is_a: SO:0000462 ! pseudogenic_region
-
-[Term]
-id: SO:0000779
-name: engineered_episome
-def: "An episome that is engineered." [SO:xp]
-comment: Requested by Lynn Crosby Jan 2006.
-synonym: "engineered episome" EXACT []
-is_a: SO:0000637 ! implied link automatically realized ! engineered_plasmid
-is_a: SO:0000768 ! implied link automatically realized ! episome
-intersection_of: SO:0000768 ! episome
-intersection_of: has_quality SO:0000783 ! engineered
-
-[Term]
-id: SO:0000780
-name: transposable_element_attribute
-comment: Added by KE Jan 2006 to capture the kinds of attributes of TEs
-is_obsolete: true
-
-[Term]
-id: SO:0000781
-name: transgenic
-def: "Attribute describing sequence that has been integrated with foreign sequence." [SO:ke]
-is_a: SO:0000733 ! feature_attribute
-
-[Term]
-id: SO:0000782
-name: natural
-def: "An attribute describing a feature that occurs in nature." [SO:ke]
-is_a: SO:0000733 ! feature_attribute
-
-[Term]
-id: SO:0000783
-name: engineered
-def: "An attribute to describe a region that was modified in vitro." [SO:ke]
-is_a: SO:0000733 ! feature_attribute
-
-[Term]
-id: SO:0000784
-name: foreign
-def: "An attribute to describe a region from another species." [SO:ke]
-is_a: SO:0000733 ! feature_attribute
-
-[Term]
-id: SO:0000785
-name: cloned_region
-comment: Added in response to Lynn Crosby. A clone insert may be composed of many cloned regions.
-synonym: "cloned region" EXACT []
-synonym: "cloned segment" EXACT []
-is_a: SO:0000695 ! reagent
-relationship: part_of SO:0000753 ! clone_insert
-
-[Term]
-id: SO:0000786
-name: reagent_attribute
-comment: Added jan 2006 by KE.
-synonym: "reagent attribute" EXACT []
-is_obsolete: true
-
-[Term]
-id: SO:0000787
-name: clone_attribute
-is_obsolete: true
-
-[Term]
-id: SO:0000788
-name: cloned
-is_obsolete: true
-
-[Term]
-id: SO:0000789
-name: validated
-def: "An attribute to describe a feature that has been proven." [SO:ke]
-is_a: SO:0000905 ! status
-
-[Term]
-id: SO:0000790
-name: invalidated
-def: "An attribute describing a feature that is invalidated." [SO:ke]
-is_a: SO:0000905 ! status
-
-[Term]
-id: SO:0000791
-name: cloned_genomic
-is_obsolete: true
-
-[Term]
-id: SO:0000792
-name: cloned_cDNA
-is_obsolete: true
-
-[Term]
-id: SO:0000793
-name: engineered_DNA
-is_obsolete: true
-
-[Term]
-id: SO:0000794
-name: engineered_rescue_region
-def: "A rescue region that is engineered." [SO:xp]
-synonym: "engineered rescue fragment" EXACT []
-synonym: "engineered rescue region" EXACT []
-synonym: "engineered rescue segment" EXACT []
-is_a: SO:0000411 ! implied link automatically realized ! rescue_region
-is_a: SO:0000804 ! implied link automatically realized ! engineered_region
-intersection_of: SO:0000411 ! rescue_region
-intersection_of: has_quality SO:0000783 ! engineered
-
-[Term]
-id: SO:0000795
-name: rescue_mini_gene
-def: "A mini_gene that rescues." [SO:xp]
-synonym: "rescue mini gene" EXACT []
-synonym: "rescue mini-gene" EXACT []
-is_a: SO:0000815 ! implied link automatically realized ! mini_gene
-intersection_of: SO:0000815 ! mini_gene
-intersection_of: has_quality SO:0000814 ! rescue
-
-[Term]
-id: SO:0000796
-name: transgenic_transposable_element
-def: "TE that has been modified in vitro, including insertion of DNA derived from a source other than the originating TE." [FB:mc]
-comment: Modified as requested by Lynn - FB. May 2007.
-synonym: "transgenic transposable element" EXACT []
-is_a: SO:0000101 ! implied link automatically realized ! transposable_element
-intersection_of: SO:0000101 ! transposable_element
-intersection_of: derives_from SO:0000151 ! clone
-intersection_of: has_quality SO:0000781 ! transgenic
-
-[Term]
-id: SO:0000797
-name: natural_transposable_element
-def: "TE that exists (or existed) in nature." [FB:mc]
-synonym: "natural transposable element" EXACT []
-is_a: SO:0000101 ! implied link automatically realized ! transposable_element
-is_a: SO:0001038 ! extrachromosomal_mobile_genetic_element
-intersection_of: SO:0000101 ! transposable_element
-intersection_of: has_quality SO:0000782 ! natural
-
-[Term]
-id: SO:0000798
-name: engineered_transposable_element
-def: "TE that has been modified by manipulations in vitro." [FB:mc]
-synonym: "engineered transposable element" EXACT []
-is_a: SO:0000101 ! implied link automatically realized ! transposable_element
-is_a: SO:0000804 ! implied link automatically realized ! engineered_region
-intersection_of: SO:0000101 ! transposable_element
-intersection_of: has_quality SO:0000783 ! engineered
-
-[Term]
-id: SO:0000799
-name: engineered_foreign_transposable_element
-def: "A transposable_element that is engineered and foreign." [FB:mc]
-synonym: "engineered foreign transposable element" EXACT []
-is_a: SO:0000720 ! implied link automatically realized ! foreign_transposable_element
-is_a: SO:0000798 ! implied link automatically realized ! engineered_transposable_element
-is_a: SO:0000805 ! implied link automatically realized ! engineered_foreign_region
-intersection_of: SO:0000101 ! transposable_element
-intersection_of: has_quality SO:0000783 ! engineered
-intersection_of: has_quality SO:0000784 ! foreign
-
-[Term]
-id: SO:0000800
-name: assortment_derived_duplication
-def: "A multi-chromosome duplication aberration generated by reassortment of other aberration components." [FB:gm]
-synonym: "assortment derived duplication" EXACT []
-is_a: SO:0001504 ! assortment_derived_variation
-
-[Term]
-id: SO:0000801
-name: assortment_derived_deficiency_plus_duplication
-def: "A multi-chromosome aberration generated by reassortment of other aberration components; presumed to have a deficiency and a duplication." [FB:gm]
-synonym: "assortment derived deficiency plus duplication" EXACT []
-is_a: SO:0001504 ! assortment_derived_variation
-
-[Term]
-id: SO:0000802
-name: assortment_derived_deficiency
-def: "A multi-chromosome deficiency aberration generated by reassortment of other aberration components." [FB:gm]
-synonym: "assortment-derived deficiency" EXACT []
-is_a: SO:0001504 ! assortment_derived_variation
-
-[Term]
-id: SO:0000803
-name: assortment_derived_aneuploid
-def: "A multi-chromosome aberration generated by reassortment of other aberration components; presumed to have a deficiency or a duplication." [FB:gm]
-synonym: "assortment derived aneuploid" EXACT []
-is_a: SO:0001504 ! assortment_derived_variation
-
-[Term]
-id: SO:0000804
-name: engineered_region
-def: "A region that is engineered." [SO:xp]
-synonym: "construct" EXACT []
-synonym: "engineered region" EXACT []
-synonym: "engineered sequence" EXACT []
-is_a: SO:0001409 ! biomaterial_region
-intersection_of: SO:0000001 ! region
-intersection_of: has_quality SO:0000783 ! engineered
-
-[Term]
-id: SO:0000805
-name: engineered_foreign_region
-def: "A region that is engineered and foreign." [SO:xp]
-synonym: "engineered foreign region" EXACT []
-is_a: SO:0000804 ! implied link automatically realized ! engineered_region
-intersection_of: SO:0000001 ! region
-intersection_of: has_quality SO:0000783 ! engineered
-intersection_of: has_quality SO:0000784 ! foreign
-
-[Term]
-id: SO:0000806
-name: fusion
-is_a: SO:0000733 ! feature_attribute
-
-[Term]
-id: SO:0000807
-name: engineered_tag
-def: "A tag that is engineered." [SO:xp]
-synonym: "engineered tag" EXACT []
-is_a: SO:0000324 ! implied link automatically realized ! tag
-is_a: SO:0000804 ! implied link automatically realized ! engineered_region
-intersection_of: SO:0000324 ! tag
-intersection_of: has_quality SO:0000783 ! engineered
-
-[Term]
-id: SO:0000808
-name: validated_cDNA_clone
-def: "A cDNA clone that has been validated." [SO:xp]
-synonym: "validated cDNA clone" EXACT []
-is_a: SO:0000317 ! implied link automatically realized ! cDNA_clone
-intersection_of: SO:0000317 ! cDNA_clone
-intersection_of: has_quality SO:0000789 ! validated
-
-[Term]
-id: SO:0000809
-name: invalidated_cDNA_clone
-def: "A cDNA clone that is invalid." [SO:xp]
-synonym: "invalidated cDNA clone" EXACT []
-is_a: SO:0000317 ! implied link automatically realized ! cDNA_clone
-intersection_of: SO:0000317 ! cDNA_clone
-intersection_of: has_quality SO:0000790 ! invalidated
-
-[Term]
-id: SO:0000810
-name: chimeric_cDNA_clone
-def: "A cDNA clone invalidated because it is chimeric." [SO:xp]
-synonym: "chimeric cDNA clone" EXACT []
-is_a: SO:0000809 ! implied link automatically realized ! invalidated_cDNA_clone
-intersection_of: SO:0000809 ! invalidated_cDNA_clone
-intersection_of: has_quality SO:0000362 ! invalidated_by_chimeric_cDNA
-
-[Term]
-id: SO:0000811
-name: genomically_contaminated_cDNA_clone
-def: "A cDNA clone invalidated by genomic contamination." [SO:xp]
-synonym: "genomically contaminated cDNA clone" EXACT []
-is_a: SO:0000809 ! implied link automatically realized ! invalidated_cDNA_clone
-intersection_of: SO:0000809 ! invalidated_cDNA_clone
-intersection_of: has_quality SO:0000414 ! invalidated_by_genomic_contamination
-
-[Term]
-id: SO:0000812
-name: polyA_primed_cDNA_clone
-def: "A cDNA clone invalidated by polyA priming." [SO:xp]
-synonym: "polyA primed cDNA clone" EXACT []
-is_a: SO:0000809 ! implied link automatically realized ! invalidated_cDNA_clone
-intersection_of: SO:0000809 ! invalidated_cDNA_clone
-intersection_of: has_quality SO:0000415 ! invalidated_by_genomic_polyA_primed_cDNA
-
-[Term]
-id: SO:0000813
-name: partially_processed_cDNA_clone
-def: "A cDNA invalidated clone by partial processing." [SO:xp]
-synonym: "partially processed cDNA clone" EXACT []
-is_a: SO:0000809 ! implied link automatically realized ! invalidated_cDNA_clone
-intersection_of: SO:0000809 ! invalidated_cDNA_clone
-intersection_of: has_quality SO:0000416 ! invalidated_by_partial_processing
-
-[Term]
-id: SO:0000814
-name: rescue
-def: "An attribute describing a region's ability, when introduced to a mutant organism, to re-establish (rescue) a phenotype." [SO:ke]
-is_a: SO:0000733 ! feature_attribute
-
-[Term]
-id: SO:0000815
-name: mini_gene
-def: "By definition, minigenes are short open-reading frames (ORF), usually encoding approximately 9 to 20 amino acids, which are expressed in vivo (as distinct from being synthesized as peptide or protein ex vivo and subsequently injected). The in vivo synthesis confers a distinct advantage: the expressed sequences can enter both antigen presentation pathways, MHC I (inducing CD8+ T- cells, which are usually cytotoxic T-lymphocytes (CTL)) and MHC II (inducing CD4+ T-cells, usually 'T-he [...]
-synonym: "mini gene" EXACT []
-is_a: SO:0000236 ! ORF
-
-[Term]
-id: SO:0000816
-name: rescue_gene
-def: "A gene that rescues." [SO:xp]
-synonym: "rescue gene" EXACT []
-is_a: SO:0000704 ! implied link automatically realized ! gene
-intersection_of: SO:0000704 ! gene
-intersection_of: has_quality SO:0000814 ! rescue
-
-[Term]
-id: SO:0000817
-name: wild_type
-def: "An attribute describing sequence with the genotype found in nature and/or standard laboratory stock." [SO:ke]
-synonym: "wild type" EXACT []
-xref: http://en.wikipedia.org/wiki/Wild_type "wiki"
-is_a: SO:0000733 ! feature_attribute
-
-[Term]
-id: SO:0000818
-name: wild_type_rescue_gene
-def: "A gene that rescues." [SO:xp]
-synonym: "wild type rescue gene" EXACT []
-is_a: SO:0000816 ! rescue_gene
-intersection_of: SO:0000704 ! gene
-intersection_of: has_quality SO:0000817 ! wild_type
-
-[Term]
-id: SO:0000819
-name: mitochondrial_chromosome
-def: "A chromosome originating in a mitochondria." [SO:xp]
-synonym: "mitochondrial chromosome" EXACT []
-is_a: SO:0000340 ! implied link automatically realized ! chromosome
-intersection_of: SO:0000340 ! chromosome
-intersection_of: has_origin SO:0000737 ! mitochondrial_sequence
-
-[Term]
-id: SO:0000820
-name: chloroplast_chromosome
-def: "A chromosome originating in a chloroplast." [SO:xp]
-synonym: "chloroplast chromosome" EXACT []
-is_a: SO:0000340 ! implied link automatically realized ! chromosome
-intersection_of: SO:0000340 ! chromosome
-intersection_of: has_origin SO:0000745 ! chloroplast_sequence
-
-[Term]
-id: SO:0000821
-name: chromoplast_chromosome
-def: "A chromosome originating in a chromoplast." [SO:xp]
-synonym: "chromoplast chromosome" EXACT []
-is_a: SO:0000340 ! implied link automatically realized ! chromosome
-intersection_of: SO:0000340 ! chromosome
-intersection_of: has_origin SO:0000744 ! chromoplast_sequence
-
-[Term]
-id: SO:0000822
-name: cyanelle_chromosome
-def: "A chromosome originating in a cyanelle." [SO:xp]
-synonym: "cyanelle chromosome" EXACT []
-is_a: SO:0000340 ! implied link automatically realized ! chromosome
-intersection_of: SO:0000340 ! chromosome
-intersection_of: has_origin SO:0000746 ! cyanelle_sequence
-
-[Term]
-id: SO:0000823
-name: leucoplast_chromosome
-def: "A chromosome with origin in a leucoplast." [SO:xp]
-synonym: "leucoplast chromosome" EXACT []
-is_a: SO:0000340 ! implied link automatically realized ! chromosome
-intersection_of: SO:0000340 ! chromosome
-intersection_of: has_origin SO:0000747 ! leucoplast_sequence
-
-[Term]
-id: SO:0000824
-name: macronuclear_chromosome
-def: "A chromosome originating in a macronucleus." [SO:xp]
-synonym: "macronuclear chromosome" EXACT []
-is_a: SO:0000340 ! implied link automatically realized ! chromosome
-intersection_of: SO:0000340 ! chromosome
-intersection_of: has_origin SO:0000083 ! macronuclear_sequence
-
-[Term]
-id: SO:0000825
-name: micronuclear_chromosome
-def: "A chromosome originating in a micronucleus." [SO:xp]
-synonym: "micronuclear chromosome" EXACT []
-is_a: SO:0000340 ! implied link automatically realized ! chromosome
-intersection_of: SO:0000340 ! chromosome
-intersection_of: has_origin SO:0000084 ! micronuclear_sequence
-
-[Term]
-id: SO:0000828
-name: nuclear_chromosome
-def: "A chromosome originating in a nucleus." [SO:xp]
-synonym: "nuclear chromosome" EXACT []
-is_a: SO:0000340 ! implied link automatically realized ! chromosome
-intersection_of: SO:0000340 ! chromosome
-intersection_of: has_origin SO:0000738 ! nuclear_sequence
-
-[Term]
-id: SO:0000829
-name: nucleomorphic_chromosome
-def: "A chromosome originating in a nucleomorph." [SO:xp]
-synonym: "nucleomorphic chromosome" EXACT []
-is_a: SO:0000340 ! implied link automatically realized ! chromosome
-intersection_of: SO:0000340 ! chromosome
-intersection_of: has_origin SO:0000739 ! nucleomorphic_sequence
-
-[Term]
-id: SO:0000830
-name: chromosome_part
-def: "A region of a chromosome." [SO:ke]
-comment: This is a manufactured term, that serves the purpose of allow the parts of a chromosome to have an is_a path to the root.
-subset: SOFA
-synonym: "chromosome part" EXACT []
-is_a: SO:0001411 ! biological_region
-relationship: part_of SO:0000340 ! chromosome
-
-[Term]
-id: SO:0000831
-name: gene_member_region
-def: "A region of a gene." [SO:ke]
-comment: A manufactured term used to allow the parts of a gene to have an is_a path to the root.
-subset: SOFA
-synonym: "gene member region" EXACT []
-is_a: SO:0001411 ! biological_region
-relationship: member_of SO:0000704 ! gene
-
-[Term]
-id: SO:0000832
-name: promoter_region
-def: "A region of sequence which is part of a promoter." [SO:ke]
-comment: This is a manufactured term to allow the parts of promoter to have an is_a path back to the root.
-is_obsolete: true
-
-[Term]
-id: SO:0000833
-name: transcript_region
-def: "A region of a transcript." [SO:ke]
-comment: This term was added to provide a grouping term for the region parts of transcript, thus giving them an is_a path back to the root.
-subset: SOFA
-synonym: "transcript region" EXACT []
-is_a: SO:0001411 ! biological_region
-relationship: part_of SO:0000673 ! transcript
-
-[Term]
-id: SO:0000834
-name: mature_transcript_region
-def: "A region of a mature transcript." [SO:ke]
-comment: A manufactured term to collect together the parts of a mature transcript and give them an is_a path to the root.
-subset: SOFA
-synonym: "mature transcript region" EXACT []
-is_a: SO:0000833 ! transcript_region
-
-[Term]
-id: SO:0000835
-name: primary_transcript_region
-def: "A part of a primary transcript." [SO:ke]
-comment: This term was added to provide a grouping term for the region parts of primary_transcript, thus giving them an is_a path back to the root.
-subset: SOFA
-synonym: "primary transcript region" EXACT []
-is_a: SO:0000833 ! transcript_region
-relationship: part_of SO:0000185 ! primary_transcript
-
-[Term]
-id: SO:0000836
-name: mRNA_region
-def: "A region of an mRNA." [SO:cb]
-comment: This term was added to provide a grouping term for the region parts of mRNA, thus giving them an is_a path back to the root.
-subset: SOFA
-synonym: "mRNA region" EXACT []
-is_a: SO:0000834 ! mature_transcript_region
-relationship: part_of SO:0000234 ! mRNA
-
-[Term]
-id: SO:0000837
-name: UTR_region
-def: "A region of UTR." [SO:ke]
-comment: A region of UTR. This term is a grouping term to allow the parts of UTR to have an is_a path to the root.
-subset: SOFA
-synonym: "UTR region" EXACT []
-is_a: SO:0000836 ! mRNA_region
-
-[Term]
-id: SO:0000838
-name: rRNA_primary_transcript_region
-def: "A region of an rRNA primary transcript." [SO:ke]
-comment: To allow transcribed_spacer_region to have a path to the root.
-synonym: "rRNA primary transcript region" EXACT []
-is_a: SO:0000835 ! primary_transcript_region
-relationship: part_of SO:0000209 ! rRNA_primary_transcript
-
-[Term]
-id: SO:0000839
-name: polypeptide_region
-alt_id: BS:00124
-alt_id: BS:00331
-def: "Biological sequence region that can be assigned to a specific subsequence of a polypeptide." [SO:GAR, SO:ke]
-comment: Added to allow the polypeptide regions to have is_a paths back to the root.
-subset: biosapiens
-subset: SOFA
-synonym: "positional" RELATED []
-synonym: "positional polypeptide feature" RELATED []
-synonym: "region" NARROW [uniprot:feature_type]
-synonym: "region or site annotation" RELATED []
-synonym: "site" NARROW [uniprot:feature_type]
-is_a: SO:0001411 ! biological_region
-relationship: part_of SO:0000104 ! polypeptide
-
-[Term]
-id: SO:0000840
-name: repeat_component
-def: "A region of a repeated sequence." [SO:ke]
-comment: A manufactured to group the parts of repeats, to give them an is_a path back to the root.
-synonym: "repeat component" EXACT []
-is_a: SO:0001412 ! topologically_defined_region
-
-[Term]
-id: SO:0000841
-name: spliceosomal_intron_region
-def: "A region within an intron." [SO:ke]
-comment: A terms added to allow the parts of introns to have is_a paths to the root.
-subset: SOFA
-synonym: "spliceosomal intron region" EXACT []
-is_a: SO:0000835 ! primary_transcript_region
-relationship: part_of SO:0000662 ! spliceosomal_intron
-
-[Term]
-id: SO:0000842
-name: gene_component_region
-subset: SOFA
-synonym: "gene component region" EXACT []
-is_a: SO:0001411 ! biological_region
-relationship: part_of SO:0000704 ! gene
-
-[Term]
-id: SO:0000843
-name: bacterial_RNApol_promoter_region
-def: "A region which is part of a bacterial RNA polymerase promoter." [SO:ke]
-comment: This is a manufactured term to allow the parts of bacterial_RNApol_promoter to have an is_a path back to the root.
-is_obsolete: true
-
-[Term]
-id: SO:0000844
-name: RNApol_II_promoter_region
-def: "A region of sequence which is a promoter for RNA polymerase II." [SO:ke]
-comment: This is a manufactured term to allow the parts of RNApol_II_promoter to have an is_a path back to the root.
-is_obsolete: true
-
-[Term]
-id: SO:0000845
-name: RNApol_III_promoter_type_1_region
-def: "A region of sequence which is a promoter for RNA polymerase III type 1." [SO:ke]
-comment: This is a manufactured term to allow the parts of RNApol_III_promoter_type_1 to have an is_a path back to the root.
-is_obsolete: true
-
-[Term]
-id: SO:0000846
-name: RNApol_III_promoter_type_2_region
-def: "A region of sequence which is a promoter for RNA polymerase III type 2." [SO:ke]
-comment: This is a manufactured term to allow the parts of RNApol_III_promoter_type_2 to have an is_a path back to the root.
-is_obsolete: true
-
-[Term]
-id: SO:0000847
-name: tmRNA_region
-def: "A region of a tmRNA." [SO:cb]
-comment: This term was added to provide a grouping term for the region parts of tmRNA, thus giving them an is_a path back to the root.
-synonym: "tmRNA region" EXACT []
-is_a: SO:0000834 ! mature_transcript_region
-relationship: part_of SO:0000584 ! tmRNA
-
-[Term]
-id: SO:0000848
-name: LTR_component
-synonym: "long term repeat component" EXACT []
-synonym: "LTR component" EXACT []
-is_a: SO:0000840 ! repeat_component
-relationship: part_of SO:0000286 ! long_terminal_repeat
-
-[Term]
-id: SO:0000849
-name: three_prime_LTR_component
-synonym: "3' long terminal repeat component" EXACT []
-synonym: "three prime LTR component" EXACT []
-is_a: SO:0000848 ! LTR_component
-relationship: part_of SO:0000426 ! three_prime_LTR
-
-[Term]
-id: SO:0000850
-name: five_prime_LTR_component
-synonym: "5' long term repeat component" EXACT []
-synonym: "five prime LTR component" EXACT []
-is_a: SO:0000848 ! LTR_component
-relationship: part_of SO:0000425 ! five_prime_LTR
-
-[Term]
-id: SO:0000851
-name: CDS_region
-def: "A region of a CDS." [SO:cb]
-subset: SOFA
-synonym: "CDS region" EXACT []
-is_a: SO:0000836 ! mRNA_region
-relationship: part_of SO:0000316 ! CDS
-
-[Term]
-id: SO:0000852
-name: exon_region
-def: "A region of an exon." [RSC:cb]
-subset: SOFA
-synonym: "exon region" EXACT []
-is_a: SO:0000833 ! transcript_region
-relationship: part_of SO:0000147 ! exon
-
-[Term]
-id: SO:0000853
-name: homologous_region
-def: "A region that is homologous to another region." [SO:ke]
-synonym: "homolog" EXACT []
-synonym: "homologous region" EXACT []
-synonym: "homologue" EXACT []
-xref: http://en.wikipedia.org/wiki/Homology_(biology) "wiki"
-is_a: SO:0000330 ! implied link automatically realized ! conserved_region
-intersection_of: SO:0000330 ! conserved_region
-intersection_of: has_quality SO:0000857 ! homologous
-
-[Term]
-id: SO:0000854
-name: paralogous_region
-def: "A homologous_region that is paralogous to another region." [SO:ke]
-comment: A term to be used in conjunction with the paralogous_to relationship.
-synonym: "paralog" EXACT []
-synonym: "paralogous region" EXACT []
-synonym: "paralogue" EXACT []
-xref: http://en.wikipedia.org/wiki/Paralog#Paralogy "wiki"
-is_a: SO:0000853 ! implied link automatically realized ! homologous_region
-intersection_of: SO:0000853 ! homologous_region
-intersection_of: has_quality SO:0000859 ! paralogous
-
-[Term]
-id: SO:0000855
-name: orthologous_region
-def: "A homologous_region that is orthologous to another region." [SO:ke]
-comment: This term should be used in conjunction with the similarity relationships defined in SO.
-synonym: "ortholog" EXACT []
-synonym: "orthologous region" EXACT []
-synonym: "orthologue" EXACT []
-xref: http://en.wikipedia.org/wiki/Ortholog#Orthology "wiki"
-is_a: SO:0000853 ! implied link automatically realized ! homologous_region
-intersection_of: SO:0000853 ! homologous_region
-intersection_of: has_quality SO:0000858 ! orthologous
-
-[Term]
-id: SO:0000856
-name: conserved
-is_a: SO:0000733 ! feature_attribute
-
-[Term]
-id: SO:0000857
-name: homologous
-def: "Similarity due to common ancestry." [SO:ke]
-is_a: SO:0000856 ! conserved
-
-[Term]
-id: SO:0000858
-name: orthologous
-def: "An attribute describing a kind of homology where divergence occured after a speciation event." [SO:ke]
-is_a: SO:0000857 ! homologous
-
-[Term]
-id: SO:0000859
-name: paralogous
-def: "An attribute describing a kind of homology where divergence occurred after a duplication event." [SO:ke]
-is_a: SO:0000857 ! homologous
-
-[Term]
-id: SO:0000860
-name: syntenic
-def: "Attribute describing sequence regions occurring in same order on chromosome of different species." [SO:ke]
-xref: http://en.wikipedia.org/wiki/Syntenic "wiki"
-is_a: SO:0000856 ! conserved
-
-[Term]
-id: SO:0000861
-name: capped_primary_transcript
-def: "A primary transcript that is capped." [SO:xp]
-synonym: "capped primary transcript" EXACT []
-is_a: SO:0000185 ! implied link automatically realized ! primary_transcript
-intersection_of: SO:0000185 ! primary_transcript
-intersection_of: adjacent_to SO:0000581 ! cap
-intersection_of: has_quality SO:0000146 ! capped
-
-[Term]
-id: SO:0000862
-name: capped_mRNA
-def: "An mRNA that is capped." [SO:xp]
-synonym: "capped mRNA" EXACT []
-is_a: SO:0000234 ! implied link automatically realized ! mRNA
-intersection_of: SO:0000234 ! mRNA
-intersection_of: adjacent_to SO:0000581 ! cap
-intersection_of: has_quality SO:0000146 ! capped
-
-[Term]
-id: SO:0000863
-name: mRNA_attribute
-def: "An attribute describing an mRNA feature." [SO:ke]
-synonym: "mRNA attribute" EXACT []
-is_a: SO:0000237 ! transcript_attribute
-
-[Term]
-id: SO:0000864
-name: exemplar
-def: "An attribute describing a sequence is representative of a class of similar sequences." [SO:ke]
-is_a: SO:0000863 ! mRNA_attribute
-
-[Term]
-id: SO:0000865
-name: frameshift
-def: "An attribute describing a sequence that contains a mutation involving the deletion or insertion of one or more bases, where this number is not divisible by 3." [SO:ke]
-xref: http://en.wikipedia.org/wiki/Frameshift "wiki"
-is_a: SO:0000863 ! mRNA_attribute
-
-[Term]
-id: SO:0000866
-name: minus_1_frameshift
-def: "A frameshift caused by deleting one base." [SO:ke]
-synonym: "minus 1 frameshift" EXACT []
-is_a: SO:0000865 ! frameshift
-
-[Term]
-id: SO:0000867
-name: minus_2_frameshift
-def: "A frameshift caused by deleting two bases." [SO:ke]
-synonym: "minus 2 frameshift" EXACT []
-is_a: SO:0000865 ! frameshift
-
-[Term]
-id: SO:0000868
-name: plus_1_frameshift
-def: "A frameshift caused by inserting one base." [SO:ke]
-synonym: "plus 1 frameshift" EXACT []
-is_a: SO:0000865 ! frameshift
-
-[Term]
-id: SO:0000869
-name: plus_2_framshift
-def: "A frameshift caused by inserting two bases." [SO:ke]
-synonym: "plus 2 framshift" EXACT []
-is_a: SO:0000865 ! frameshift
-
-[Term]
-id: SO:0000870
-name: trans_spliced
-def: "An attribute describing transcript sequence that is created by splicing exons from diferent genes." [SO:ke]
-synonym: "trans-spliced" EXACT []
-is_a: SO:0000237 ! transcript_attribute
-
-[Term]
-id: SO:0000871
-name: polyadenylated_mRNA
-def: "An mRNA that is polyadenylated." [SO:xp]
-synonym: "polyadenylated mRNA" EXACT []
-is_a: SO:0000234 ! implied link automatically realized ! mRNA
-intersection_of: SO:0000234 ! mRNA
-intersection_of: adjacent_to SO:0000610 ! polyA_sequence
-intersection_of: has_quality SO:0000246 ! polyadenylated
-
-[Term]
-id: SO:0000872
-name: trans_spliced_mRNA
-def: "An mRNA that is trans-spliced." [SO:xp]
-synonym: "trans-spliced mRNA" EXACT []
-is_a: SO:0000234 ! implied link automatically realized ! mRNA
-is_a: SO:0000479 ! implied link automatically realized ! trans_spliced_transcript
-intersection_of: SO:0000234 ! mRNA
-intersection_of: adjacent_to SO:0000636 ! spliced_leader_RNA
-intersection_of: has_quality SO:0000870 ! trans_spliced
-
-[Term]
-id: SO:0000873
-name: edited_transcript
-def: "A transcript that is edited." [SO:ke]
-synonym: "edited transcript" EXACT []
-is_a: SO:0000673 ! implied link automatically realized ! transcript
-intersection_of: SO:0000673 ! transcript
-intersection_of: has_quality SO:0000116 ! edited
-relationship: guided_by SO:0000602 ! guide_RNA
-relationship: has_part SO:0000977 ! anchor_binding_site
-
-[Term]
-id: SO:0000874
-name: edited_transcript_by_A_to_I_substitution
-def: "A transcript that has been edited by A to I substitution." [SO:ke]
-synonym: "edited transcript by A to I substitution" EXACT []
-is_a: SO:0000873 ! edited_transcript
-
-[Term]
-id: SO:0000875
-name: bound_by_protein
-def: "An attribute describing a sequence that is bound by a protein." [SO:ke]
-synonym: "bound by protein" EXACT []
-is_a: SO:0000277 ! bound_by_factor
-
-[Term]
-id: SO:0000876
-name: bound_by_nucleic_acid
-def: "An attribute describing a sequence that is bound by a nucleic acid." [SO:ke]
-synonym: "bound by nucleic acid" EXACT []
-is_a: SO:0000277 ! bound_by_factor
-
-[Term]
-id: SO:0000877
-name: alternatively_spliced
-def: "An attribute describing a situation where a gene may encode for more than 1 transcript." [SO:ke]
-synonym: "alternatively spliced" EXACT []
-is_a: SO:0000237 ! transcript_attribute
-
-[Term]
-id: SO:0000878
-name: monocistronic
-def: "An attribute describing a sequence that contains the code for one gene product." [SO:ke]
-is_a: SO:0000237 ! transcript_attribute
-
-[Term]
-id: SO:0000879
-name: dicistronic
-def: "An attribute describing a sequence that contains the code for two gene products." [SO:ke]
-is_a: SO:0000880 ! polycistronic
-
-[Term]
-id: SO:0000880
-name: polycistronic
-def: "An attribute describing a sequence that contains the code for more than one gene product." [SO:ke]
-is_a: SO:0000237 ! transcript_attribute
-
-[Term]
-id: SO:0000881
-name: recoded
-def: "An attribute describing an mRNA sequence that has been reprogrammed at translation, causing localized alterations." [SO:ke]
-is_a: SO:0000863 ! mRNA_attribute
-
-[Term]
-id: SO:0000882
-name: codon_redefined
-def: "An attribute describing the alteration of codon meaning." [SO:ke]
-synonym: "codon redefined" EXACT []
-is_a: SO:0000881 ! recoded
-
-[Term]
-id: SO:0000883
-name: stop_codon_read_through
-def: "A stop codon redefined to be a new amino acid." [SO:ke]
-synonym: "stop codon read through" EXACT []
-synonym: "stop codon readthrough" RELATED []
-is_a: SO:0000145 ! recoded_codon
-
-[Term]
-id: SO:0000884
-name: stop_codon_redefined_as_pyrrolysine
-def: "A stop codon redefined to be the new amino acid, pyrrolysine." [SO:ke]
-synonym: "stop codon redefined as pyrrolysine" EXACT []
-is_a: SO:0000883 ! stop_codon_read_through
-
-[Term]
-id: SO:0000885
-name: stop_codon_redefined_as_selenocysteine
-def: "A stop codon redefined to be the new amino acid, selenocysteine." [SO:ke]
-synonym: "stop codon redefined as selenocysteine" EXACT []
-is_a: SO:0000883 ! stop_codon_read_through
-
-[Term]
-id: SO:0000886
-name: recoded_by_translational_bypass
-def: "Recoded mRNA where a block of nucleotides is not translated." [SO:ke]
-synonym: "recoded by translational bypass" EXACT []
-is_a: SO:0000881 ! recoded
-
-[Term]
-id: SO:0000887
-name: translationally_frameshifted
-def: "Recoding by frameshifting a particular site." [SO:ke]
-synonym: "translationally frameshifted" EXACT []
-is_a: SO:0000881 ! recoded
-
-[Term]
-id: SO:0000888
-name: maternally_imprinted_gene
-def: "A gene that is maternally_imprinted." [SO:xp]
-synonym: "maternally imprinted gene" EXACT []
-is_a: SO:0000898 ! implied link automatically realized ! epigenetically_modified_gene
-intersection_of: SO:0000704 ! gene
-intersection_of: has_quality SO:0000135 ! maternally_imprinted
-
-[Term]
-id: SO:0000889
-name: paternally_imprinted_gene
-def: "A gene that is paternally imprinted." [SO:xp]
-synonym: "paternally imprinted gene" EXACT []
-is_a: SO:0000898 ! implied link automatically realized ! epigenetically_modified_gene
-intersection_of: SO:0000704 ! gene
-intersection_of: has_quality SO:0000136 ! paternally_imprinted
-
-[Term]
-id: SO:0000890
-name: post_translationally_regulated_gene
-def: "A gene that is post translationally regulated." [SO:xp]
-synonym: "post translationally regulated gene" EXACT []
-is_a: SO:0000704 ! implied link automatically realized ! gene
-intersection_of: SO:0000704 ! gene
-intersection_of: has_quality SO:0000130 ! post_translationally_regulated
-
-[Term]
-id: SO:0000891
-name: negatively_autoregulated_gene
-def: "A gene that is negatively autoreguated." [SO:xp]
-synonym: "negatively autoregulated gene" EXACT []
-is_a: SO:0000704 ! implied link automatically realized ! gene
-intersection_of: SO:0000704 ! gene
-intersection_of: has_quality SO:0000473 ! negatively_autoregulated
-
-[Term]
-id: SO:0000892
-name: positively_autoregulated_gene
-def: "A gene that is positively autoregulated." [SO:xp]
-synonym: "positively autoregulated gene" EXACT []
-is_a: SO:0000704 ! implied link automatically realized ! gene
-intersection_of: SO:0000704 ! gene
-intersection_of: has_quality SO:0000475 ! positively_autoregulated
-
-[Term]
-id: SO:0000893
-name: silenced
-def: "An attribute describing an epigenetic process where a gene is inactivated at transcriptional or translational level." [SO:ke]
-xref: http://en.wikipedia.org/wiki/Silenced "wiki"
-is_a: SO:0000126 ! transcriptionally_repressed
-
-[Term]
-id: SO:0000894
-name: silenced_by_DNA_modification
-def: "An attribute describing an epigenetic process where a gene is inactivated by DNA modifications, resulting in repression of transcription." [SO:ke]
-synonym: "silenced by DNA modification" EXACT []
-is_a: SO:0000893 ! silenced
-
-[Term]
-id: SO:0000895
-name: silenced_by_DNA_methylation
-def: "An attribute describing an epigenetic process where a gene is inactivated by DNA methylation, resulting in repression of transcription." [SO:ke]
-synonym: "silenced by DNA methylation" EXACT []
-is_a: SO:0000894 ! silenced_by_DNA_modification
-
-[Term]
-id: SO:0000896
-name: translationally_regulated_gene
-def: "A gene that is translationally regulated." [SO:xp]
-synonym: "translationally regulated gene" EXACT []
-is_a: SO:0000704 ! implied link automatically realized ! gene
-intersection_of: SO:0000704 ! gene
-intersection_of: has_quality SO:0000131 ! translationally_regulated
-
-[Term]
-id: SO:0000897
-name: allelically_excluded_gene
-def: "A gene that is allelically_excluded." [SO:xp]
-synonym: "allelically excluded gene" EXACT []
-is_a: SO:0000898 ! implied link automatically realized ! epigenetically_modified_gene
-intersection_of: SO:0000898 ! epigenetically_modified_gene
-intersection_of: has_quality SO:0000137 ! allelically_excluded
-
-[Term]
-id: SO:0000898
-name: epigenetically_modified_gene
-def: "A gene that is epigenetically modified." [SO:ke]
-synonym: "epigenetically modified gene" EXACT []
-is_a: SO:0000704 ! implied link automatically realized ! gene
-is_a: SO:0001720 ! implied link automatically realized ! epigenetically_modified_region
-intersection_of: SO:0000704 ! gene
-intersection_of: has_quality SO:0000133 ! epigenetically_modified
-
-[Term]
-id: SO:0000899
-name: nuclear_mitochondrial
-def: "An attribute describing a nuclear pseudogene of a mitochndrial gene." [SO:ke]
-synonym: "nuclear mitochondrial" EXACT []
-is_obsolete: true
-
-[Term]
-id: SO:0000900
-name: processed
-def: "An attribute describing a pseudogene where by an mRNA was retrotransposed. The mRNA sequence is transcribed back into the genome, lacking introns and promotors, but often including a polyA tail." [SO:ke]
-is_obsolete: true
-
-[Term]
-id: SO:0000901
-name: unequally_crossed_over
-def: "An attribute describing a pseudogene that was created by tandem duplication and unequal crossing over during recombination." [SO:ke]
-synonym: "unequally crossed over" EXACT []
-is_obsolete: true
-
-[Term]
-id: SO:0000902
-name: transgene
-def: "A transgene is a gene that has been transferred naturally or by any of a number of genetic engineering techniques from one organism to another." [SO:xp]
-xref: http://en.wikipedia.org/wiki/Transgene "wiki"
-is_a: SO:0000704 ! implied link automatically realized ! gene
-intersection_of: SO:0000704 ! gene
-intersection_of: has_quality SO:0000781 ! transgenic
-
-[Term]
-id: SO:0000903
-name: endogenous_retroviral_sequence
-synonym: "endogenous retroviral sequence" EXACT []
-is_a: SO:0000751 ! proviral_location
-
-[Term]
-id: SO:0000904
-name: rearranged_at_DNA_level
-def: "An attribute to describe the sequence of a feature, where the DNA is rearranged." [SO:ke]
-synonym: "rearranged at DNA level" EXACT []
-is_a: SO:0000133 ! epigenetically_modified
-
-[Term]
-id: SO:0000905
-name: status
-def: "An attribute describing the status of a feature, based on the available evidence." [SO:ke]
-comment: This term is the hypernym of attributes and should not be annotated to.
-is_a: SO:0000733 ! feature_attribute
-
-[Term]
-id: SO:0000906
-name: independently_known
-def: "Attribute to describe a feature that is independently known - not predicted." [SO:ke]
-synonym: "independently known" EXACT []
-is_a: SO:0000905 ! status
-
-[Term]
-id: SO:0000907
-name: supported_by_sequence_similarity
-def: "An attribute to describe a feature that has been predicted using sequence similarity techniques." [SO:ke]
-synonym: "supported by sequence similarity" EXACT []
-is_a: SO:0000732 ! predicted
-
-[Term]
-id: SO:0000908
-name: supported_by_domain_match
-def: "An attribute to describe a feature that has been predicted using sequence similarity of a known domain." [SO:ke]
-synonym: "supported by domain match" EXACT []
-is_a: SO:0000907 ! supported_by_sequence_similarity
-
-[Term]
-id: SO:0000909
-name: supported_by_EST_or_cDNA
-def: "An attribute to describe a feature that has been predicted using sequence similarity to EST or cDNA data." [SO:ke]
-synonym: "supported by EST or cDNA" EXACT []
-is_a: SO:0000907 ! supported_by_sequence_similarity
-
-[Term]
-id: SO:0000910
-name: orphan
-is_a: SO:0000732 ! predicted
-
-[Term]
-id: SO:0000911
-name: predicted_by_ab_initio_computation
-def: "An attribute describing a feature that is predicted by a computer program that did not rely on sequence similarity." [SO:ke]
-synonym: "predicted by ab initio computation" EXACT []
-is_a: SO:0000732 ! predicted
-
-[Term]
-id: SO:0000912
-name: asx_turn
-alt_id: BS:00203
-def: "A motif of three consecutive residues and one H-bond in which: residue(i) is Aspartate or Asparagine (Asx), the side-chain O of residue(i) is H-bonded to the main-chain NH of residue(i+2)." [http://www.ebi.ac.uk/msd-srv/msdmotif/]
-subset: biosapiens
-synonym: "asx turn" EXACT []
-is_a: SO:0001128 ! polypeptide_turn_motif
-
-[Term]
-id: SO:0000913
-name: cloned_cDNA_insert
-def: "A clone insert made from cDNA." [SO:xp]
-synonym: "cloned cDNA insert" EXACT []
-is_a: SO:0000753 ! implied link automatically realized ! clone_insert
-intersection_of: SO:0000753 ! clone_insert
-intersection_of: has_quality SO:0000756 ! cDNA
-
-[Term]
-id: SO:0000914
-name: cloned_genomic_insert
-def: "A clone insert made from genomic DNA." [SO:xp]
-synonym: "cloned genomic insert" EXACT []
-is_a: SO:0000753 ! implied link automatically realized ! clone_insert
-intersection_of: SO:0000753 ! clone_insert
-intersection_of: has_quality SO:0000991 ! genomic_DNA
-
-[Term]
-id: SO:0000915
-name: engineered_insert
-def: "A clone insert that is engineered." [SO:xp]
-synonym: "engineered insert" EXACT []
-is_a: SO:0000753 ! implied link automatically realized ! clone_insert
-is_a: SO:0000804 ! implied link automatically realized ! engineered_region
-intersection_of: SO:0000753 ! clone_insert
-intersection_of: has_quality SO:0000783 ! engineered
-
-[Term]
-id: SO:0000916
-name: edit_operation
-synonym: "edit operation" EXACT []
-is_obsolete: true
-
-[Term]
-id: SO:0000917
-name: insert_U
-def: "An edit to insert a U." [SO:ke]
-comment: The insertion and deletion of uridine (U) residues, usually within coding regions of mRNA transcripts of cryptogenes in the mitochondrial genome of kinetoplastid protozoa.
-synonym: "insert U" EXACT []
-is_obsolete: true
-
-[Term]
-id: SO:0000918
-name: delete_U
-def: "An edit to delete a uridine." [SO:ke]
-comment: The insertion and deletion of uridine (U) residues, usually within coding regions of mRNA transcripts of cryptogenes in the mitochondrial genome of kinetoplastid protozoa.
-synonym: "delete U" EXACT []
-is_obsolete: true
-
-[Term]
-id: SO:0000919
-name: substitute_A_to_I
-def: "An edit to substitute an I for an A." [SO:ke]
-synonym: "substitute A to I" EXACT []
-is_obsolete: true
-
-[Term]
-id: SO:0000920
-name: insert_C
-def: "An edit to insert a cytidine." [SO:ke]
-synonym: "insert C" EXACT []
-is_obsolete: true
-
-[Term]
-id: SO:0000921
-name: insert_dinucleotide
-def: "An edit to insert a dinucleotide." [SO:ke]
-synonym: "insert dinucleotide" EXACT []
-is_obsolete: true
-
-[Term]
-id: SO:0000922
-name: substitute_C_to_U
-def: "An edit to substitute an U for a C." [SO:ke]
-synonym: "substitute C to U" EXACT []
-is_obsolete: true
-
-[Term]
-id: SO:0000923
-name: insert_G
-def: "An edit to insert a G." [SO:ke]
-synonym: "insert G" EXACT []
-is_obsolete: true
-
-[Term]
-id: SO:0000924
-name: insert_GC
-def: "An edit to insert a GC dinucleotide." [SO:ke]
-comment: The type of RNA editing found in the mitochondria of Myxomycota, characterized by the insertion of mono- and dinucleotides in RNAs relative to their mtDNA template and in addition, C to U base conversion. The most common mononucleotide insertion is cytidine, although a number of uridine mononucleotides are inserted at specific sites. Adenine and guanine have not been observed in mononucleotide insertions. Five different dinucleotide insertions have been observed, GC, GU, CU, AU  [...]
-synonym: "insert GC" EXACT []
-is_obsolete: true
-
-[Term]
-id: SO:0000925
-name: insert_GU
-def: "An edit to insert a GU dinucleotide." [SO:ke]
-comment: The type of RNA editing found in the mitochondria of Myxomycota, characterized by the insertion of mono- and dinucleotides in RNAs relative to their mtDNA template and in addition, C to U base conversion. The most common mononucleotide insertion is cytidine, although a number of uridine mononucleotides are inserted at specific sites. Adenine and guanine have not been observed in mononucleotide insertions. Five different dinucleotide insertions have been observed, GC, GU, CU, AU  [...]
-synonym: "insert GU" EXACT []
-is_obsolete: true
-
-[Term]
-id: SO:0000926
-name: insert_CU
-def: "An edit to insert a CU dinucleotide." [SO:ke]
-comment: The type of RNA editing found in the mitochondria of Myxomycota, characterized by the insertion of mono- and dinucleotides in RNAs relative to their mtDNA template and in addition, C to U base conversion. The most common mononucleotide insertion is cytidine, although a number of uridine mononucleotides are inserted at specific sites. Adenine and guanine have not been observed in mononucleotide insertions. Five different dinucleotide insertions have been observed, GC, GU, CU, AU  [...]
-synonym: "insert CU" EXACT []
-is_obsolete: true
-
-[Term]
-id: SO:0000927
-name: insert_AU
-def: "An edit to insert a AU dinucleotide." [SO:ke]
-comment: The type of RNA editing found in the mitochondria of Myxomycota, characterized by the insertion of mono- and dinucleotides in RNAs relative to their mtDNA template and in addition, C to U base conversion. The most common mononucleotide insertion is cytidine, although a number of uridine mononucleotides are inserted at specific sites. Adenine and guanine have not been observed in mononucleotide insertions. Five different dinucleotide insertions have been observed, GC, GU, CU, AU  [...]
-synonym: "insert AU" EXACT []
-is_obsolete: true
-
-[Term]
-id: SO:0000928
-name: insert_AA
-def: "An edit to insert a AA dinucleotide." [SO:ke]
-comment: The type of RNA editing found in the mitochondria of Myxomycota, characterized by the insertion of mono- and dinucleotides in RNAs relative to their mtDNA template and in addition, C to U base conversion. The most common mononucleotide insertion is cytidine, although a number of uridine mononucleotides are inserted at specific sites. Adenine and guanine have not been observed in mononucleotide insertions. Five different dinucleotide insertions have been observed, GC, GU, CU, AU  [...]
-synonym: "insert AA" EXACT []
-is_obsolete: true
-
-[Term]
-id: SO:0000929
-name: edited_mRNA
-def: "An mRNA that is edited." [SO:xp]
-synonym: "edited mRNA" EXACT []
-is_a: SO:0000234 ! implied link automatically realized ! mRNA
-is_a: SO:0000873 ! implied link automatically realized ! edited_transcript
-intersection_of: SO:0000234 ! mRNA
-intersection_of: has_quality SO:0000116 ! edited
-
-[Term]
-id: SO:0000930
-name: guide_RNA_region
-def: "A region of guide RNA." [SO:ma]
-synonym: "guide RNA region" EXACT []
-is_a: SO:0000834 ! mature_transcript_region
-relationship: part_of SO:0000602 ! guide_RNA
-
-[Term]
-id: SO:0000931
-name: anchor_region
-def: "A region of a guide_RNA that base-pairs to a target mRNA." [SO:jk]
-synonym: "anchor region" EXACT []
-is_a: SO:0000930 ! guide_RNA_region
-
-[Term]
-id: SO:0000932
-name: pre_edited_mRNA
-synonym: "pre-edited mRNA" EXACT []
-is_a: SO:0000120 ! protein_coding_primary_transcript
-
-[Term]
-id: SO:0000933
-name: intermediate
-def: "An attribute to describe a feature between stages of processing." [SO:ke]
-is_a: SO:0000733 ! feature_attribute
-
-[Term]
-id: SO:0000934
-name: miRNA_target_site
-def: "A miRNA target site is a binding site where the molecule is a micro RNA." [FB:cds]
-synonym: "miRNA target site" EXACT []
-is_a: SO:0001655 ! nucleotide_binding_site
-
-[Term]
-id: SO:0000935
-name: edited_CDS
-def: "A CDS that is edited." [SO:xp]
-synonym: "edited CDS" EXACT []
-is_a: SO:0000316 ! implied link automatically realized ! CDS
-intersection_of: SO:0000316 ! CDS
-intersection_of: has_quality SO:0000116 ! edited
-
-[Term]
-id: SO:0000936
-name: vertebrate_immunoglobulin_T_cell_receptor_rearranged_segment
-synonym: "vertebrate immunoglobulin T cell receptor rearranged segment" EXACT []
-is_a: SO:0000301 ! vertebrate_immune_system_gene_recombination_feature
-
-[Term]
-id: SO:0000937
-name: vertebrate_immune_system_feature
-is_obsolete: true
-
-[Term]
-id: SO:0000938
-name: vertebrate_immunoglobulin_T_cell_receptor_rearranged_gene_cluster
-synonym: "vertebrate immunoglobulin T cell receptor rearranged gene cluster" EXACT []
-is_a: SO:0000301 ! vertebrate_immune_system_gene_recombination_feature
-
-[Term]
-id: SO:0000939
-name: vertebrate_immune_system_gene_recombination_signal_feature
-synonym: "vertebrate immune system gene recombination signal feature" EXACT []
-is_a: SO:0000301 ! vertebrate_immune_system_gene_recombination_feature
-
-[Term]
-id: SO:0000940
-name: recombinationally_rearranged
-synonym: "recombinationally rearranged" EXACT []
-is_a: SO:0000733 ! feature_attribute
-
-[Term]
-id: SO:0000941
-name: recombinationally_rearranged_vertebrate_immune_system_gene
-def: "A recombinationally rearranged gene of the vertebrate immune system." [SO:xp]
-synonym: "recombinationally rearranged vertebrate immune system gene" EXACT []
-is_a: SO:0000456 ! recombinationally_rearranged_gene
-
-[Term]
-id: SO:0000942
-name: attP_site
-def: "An integration/excision site of a phage chromosome at which a recombinase acts to insert the phage DNA at a cognate integration/excision site on a bacterial chromosome." [SO:as]
-synonym: "attP site" EXACT []
-is_a: SO:0000946 ! integration_excision_site
-relationship: part_of SO:0001042 ! phage_sequence
-
-[Term]
-id: SO:0000943
-name: attB_site
-def: "An integration/excision site of a bacterial chromosome at which a recombinase acts to insert foreign DNA containing a cognate integration/excision site." [SO:as]
-synonym: "attB site" EXACT []
-is_a: SO:0000946 ! integration_excision_site
-
-[Term]
-id: SO:0000944
-name: attL_site
-def: "A region that results from recombination between attP_site and attB_site, composed of the 5' portion of attB_site and the 3' portion of attP_site." [SO:as]
-synonym: "attBP'" RELATED []
-synonym: "attL site" RELATED []
-is_a: SO:0000946 ! integration_excision_site
-
-[Term]
-id: SO:0000945
-name: attR_site
-def: "A region that results from recombination between attP_site and attB_site, composed of the 5' portion of attP_site and the 3' portion of attB_site." [SO:as]
-synonym: "attPB'" RELATED []
-synonym: "attR site" EXACT []
-is_a: SO:0000946 ! integration_excision_site
-
-[Term]
-id: SO:0000946
-name: integration_excision_site
-def: "A region specifically recognised by a recombinase, which inserts or removes another region marked by a distinct cognate integration/excision site." [SO:as]
-synonym: "attachment site" RELATED []
-synonym: "integration excision site" EXACT []
-is_a: SO:0000342 ! site_specific_recombination_target_region
-
-[Term]
-id: SO:0000947
-name: resolution_site
-def: "A region specifically recognised by a recombinase, which separates a physically contiguous circle of DNA into two physically separate circles." [SO:as]
-synonym: "res site" EXACT []
-synonym: "resolution site" EXACT []
-is_a: SO:0000342 ! site_specific_recombination_target_region
-
-[Term]
-id: SO:0000948
-name: inversion_site
-def: "A region specifically recognised by a recombinase, which inverts the region flanked by a pair of sites." [SO:ma]
-comment: A target region for site-specific inversion of a DNA region and which carries binding sites for a site-specific recombinase and accessory proteins as well as the site for specific cleavage by the recombinase.
-synonym: "inversion site" EXACT []
-is_a: SO:0000342 ! site_specific_recombination_target_region
-
-[Term]
-id: SO:0000949
-name: dif_site
-def: "A site at which replicated bacterial circular chromosomes are decatenated by site specific resolvase." [SO:as]
-synonym: "dif site" EXACT []
-is_a: SO:0000947 ! resolution_site
-
-[Term]
-id: SO:0000950
-name: attC_site
-def: "An attC site is a sequence required for the integration of a DNA of an integron." [SO:as]
-synonym: "attC site" EXACT []
-is_a: SO:0000946 ! integration_excision_site
-relationship: part_of SO:0000365 ! integron
-
-[Term]
-id: SO:0000951
-name: eukaryotic_terminator
-synonym: "eukaryotic terminator" EXACT []
-is_a: SO:0000141 ! terminator
-
-[Term]
-id: SO:0000952
-name: oriV
-def: "An origin of vegetative replication in plasmids and phages." [SO:as]
-synonym: "origin of vegetative replication" EXACT []
-is_a: SO:0000296 ! origin_of_replication
-
-[Term]
-id: SO:0000953
-name: oriC
-def: "An origin of bacterial chromosome replication." [SO:as]
-synonym: "origin of bacterial chromosome replication" EXACT []
-is_a: SO:0000296 ! origin_of_replication
-
-[Term]
-id: SO:0000954
-name: DNA_chromosome
-def: "Structural unit composed of a self-replicating, DNA molecule." [SO:ma]
-synonym: "DNA chromosome" EXACT []
-is_a: SO:0000340 ! implied link automatically realized ! chromosome
-intersection_of: SO:0000340 ! chromosome
-intersection_of: has_quality SO:0000352 ! DNA
-
-[Term]
-id: SO:0000955
-name: double_stranded_DNA_chromosome
-def: "Structural unit composed of a self-replicating, double-stranded DNA molecule." [SO:ma]
-synonym: "double stranded DNA chromosome" EXACT []
-is_a: SO:0000954 ! implied link automatically realized ! DNA_chromosome
-intersection_of: SO:0000954 ! DNA_chromosome
-intersection_of: has_quality SO:0000985 ! double
-
-[Term]
-id: SO:0000956
-name: single_stranded_DNA_chromosome
-def: "Structural unit composed of a self-replicating, single-stranded DNA molecule." [SO:ma]
-synonym: "single stranded DNA chromosome" EXACT []
-is_a: SO:0000954 ! implied link automatically realized ! DNA_chromosome
-intersection_of: SO:0000954 ! DNA_chromosome
-intersection_of: has_quality SO:0000984 ! single
-
-[Term]
-id: SO:0000957
-name: linear_double_stranded_DNA_chromosome
-def: "Structural unit composed of a self-replicating, double-stranded, linear DNA molecule." [SO:ma]
-synonym: "linear double stranded DNA chromosome" EXACT []
-is_a: SO:0000955 ! implied link automatically realized ! double_stranded_DNA_chromosome
-intersection_of: SO:0000955 ! double_stranded_DNA_chromosome
-intersection_of: has_quality SO:0000987 ! linear
-
-[Term]
-id: SO:0000958
-name: circular_double_stranded_DNA_chromosome
-def: "Structural unit composed of a self-replicating, double-stranded, circular DNA molecule." [SO:ma]
-synonym: "circular double stranded DNA chromosome" EXACT []
-is_a: SO:0000955 ! implied link automatically realized ! double_stranded_DNA_chromosome
-intersection_of: SO:0000955 ! double_stranded_DNA_chromosome
-intersection_of: has_quality SO:0000988 ! circular
-
-[Term]
-id: SO:0000959
-name: linear_single_stranded_DNA_chromosome
-def: "Structural unit composed of a self-replicating, single-stranded, linear DNA molecule." [SO:ma]
-synonym: "linear single stranded DNA chromosome" EXACT []
-is_a: SO:0000956 ! implied link automatically realized ! single_stranded_DNA_chromosome
-intersection_of: SO:0000956 ! single_stranded_DNA_chromosome
-intersection_of: has_quality SO:0000987 ! linear
-
-[Term]
-id: SO:0000960
-name: circular_single_stranded_DNA_chromosome
-def: "Structural unit composed of a self-replicating, single-stranded, circular DNA molecule." [SO:ma]
-synonym: "circular single stranded DNA chromosome" EXACT []
-is_a: SO:0000956 ! implied link automatically realized ! single_stranded_DNA_chromosome
-intersection_of: SO:0000956 ! single_stranded_DNA_chromosome
-intersection_of: has_quality SO:0000988 ! circular
-
-[Term]
-id: SO:0000961
-name: RNA_chromosome
-def: "Structural unit composed of a self-replicating, RNA molecule." [SO:ma]
-synonym: "RNA chromosome" EXACT []
-is_a: SO:0000340 ! implied link automatically realized ! chromosome
-intersection_of: SO:0000340 ! chromosome
-intersection_of: has_quality SO:0000356 ! RNA
-
-[Term]
-id: SO:0000962
-name: single_stranded_RNA_chromosome
-def: "Structural unit composed of a self-replicating, single-stranded RNA molecule." [SO:ma]
-synonym: "single stranded RNA chromosome" EXACT []
-is_a: SO:0000961 ! implied link automatically realized ! RNA_chromosome
-intersection_of: SO:0000961 ! RNA_chromosome
-intersection_of: has_quality SO:0000984 ! single
-
-[Term]
-id: SO:0000963
-name: linear_single_stranded_RNA_chromosome
-def: "Structural unit composed of a self-replicating, single-stranded, linear RNA molecule." [SO:ma]
-synonym: "linear single stranded RNA chromosome" EXACT []
-is_a: SO:0000962 ! implied link automatically realized ! single_stranded_RNA_chromosome
-intersection_of: SO:0000962 ! single_stranded_RNA_chromosome
-intersection_of: has_quality SO:0000987 ! linear
-
-[Term]
-id: SO:0000964
-name: linear_double_stranded_RNA_chromosome
-def: "Structural unit composed of a self-replicating, double-stranded, linear RNA molecule." [SO:ma]
-synonym: "linear double stranded RNA chromosome" EXACT []
-is_a: SO:0000965 ! implied link automatically realized ! double_stranded_RNA_chromosome
-intersection_of: SO:0000965 ! double_stranded_RNA_chromosome
-intersection_of: has_quality SO:0000987 ! linear
-
-[Term]
-id: SO:0000965
-name: double_stranded_RNA_chromosome
-def: "Structural unit composed of a self-replicating, double-stranded RNA molecule." [SO:ma]
-synonym: "double stranded RNA chromosome" EXACT []
-is_a: SO:0000961 ! implied link automatically realized ! RNA_chromosome
-intersection_of: SO:0000961 ! RNA_chromosome
-intersection_of: has_quality SO:0000985 ! double
-
-[Term]
-id: SO:0000966
-name: circular_single_stranded_RNA_chromosome
-def: "Structural unit composed of a self-replicating, single-stranded, circular DNA molecule." [SO:ma]
-synonym: "circular single stranded RNA chromosome" EXACT []
-is_a: SO:0000962 ! implied link automatically realized ! single_stranded_RNA_chromosome
-intersection_of: SO:0000962 ! single_stranded_RNA_chromosome
-intersection_of: has_quality SO:0000988 ! circular
-
-[Term]
-id: SO:0000967
-name: circular_double_stranded_RNA_chromosome
-def: "Structural unit composed of a self-replicating, double-stranded, circular RNA molecule." [SO:ma]
-synonym: "circular double stranded RNA chromosome" EXACT []
-is_a: SO:0000965 ! implied link automatically realized ! double_stranded_RNA_chromosome
-intersection_of: SO:0000965 ! double_stranded_RNA_chromosome
-intersection_of: has_quality SO:0000988 ! circular
-
-[Term]
-id: SO:0000968
-name: sequence_replication_mode
-comment: This has been obsoleted as it represents a process. replaced_by: GO:0034961.
-synonym: "sequence replication mode" EXACT []
-is_obsolete: true
-
-[Term]
-id: SO:0000969
-name: rolling_circle
-comment: This has been obsoleted as it represents a process. replaced_by: GO:0070581.
-synonym: "rolling circle" EXACT []
-xref: http://en.wikipedia.org/wiki/Rolling_circle "wiki"
-is_obsolete: true
-
-[Term]
-id: SO:0000970
-name: theta_replication
-comment: This has been obsoleted as it represents a process. replaced_by: GO:0070582
-synonym: "theta replication" EXACT []
-is_obsolete: true
-
-[Term]
-id: SO:0000971
-name: DNA_replication_mode
-comment: This has been obsoleted as it represents a process. replaced_by: GO:0006260.
-synonym: "DNA replication mode" EXACT []
-is_obsolete: true
-
-[Term]
-id: SO:0000972
-name: RNA_replication_mode
-comment: This has been obsoleted as it represents a process. replaced_by: GO:0034961.
-synonym: "RNA replication mode" EXACT []
-is_obsolete: true
-
-[Term]
-id: SO:0000973
-name: insertion_sequence
-def: "A terminal_inverted_repeat_element that is bacterial and only encodes the functions required for its transposition between these inverted repeats." [SO:as]
-synonym: "insertion sequence" EXACT []
-synonym: "IS" RELATED []
-xref: http://en.wikipedia.org/wiki/Insertion_sequence "wiki"
-is_a: SO:0000208 ! terminal_inverted_repeat_element
-
-[Term]
-id: SO:0000975
-name: minicircle_gene
-synonym: "minicircle gene" EXACT []
-is_a: SO:0000089 ! implied link automatically realized ! kinetoplast_gene
-intersection_of: SO:0000089 ! kinetoplast_gene
-intersection_of: part_of SO:0000980 ! minicircle
-
-[Term]
-id: SO:0000976
-name: cryptic
-def: "A feature_attribute describing a feature that is not manifest under normal conditions." [SO:ke]
-is_a: SO:0000733 ! feature_attribute
-
-[Term]
-id: SO:0000977
-name: anchor_binding_site
-comment: Part of an edited transcript only.
-synonym: "anchor binding site" EXACT []
-is_a: SO:0000833 ! transcript_region
-
-[Term]
-id: SO:0000978
-name: template_region
-def: "A region of a guide_RNA that specifies the insertions and deletions of bases in the editing of a target mRNA." [SO:jk]
-synonym: "information region" EXACT []
-synonym: "template region" EXACT []
-is_a: SO:0000930 ! guide_RNA_region
-
-[Term]
-id: SO:0000979
-name: gRNA_encoding
-def: "A non-protein_coding gene that encodes a guide_RNA." [SO:ma]
-synonym: "gRNA encoding" EXACT []
-is_a: SO:0000011 ! non_protein_coding
-
-[Term]
-id: SO:0000980
-name: minicircle
-alt_id: SO:0000974
-def: "A minicircle is a replicon, part of a kinetoplast, that encodes for guide RNAs." [PMID:8395055]
-synonym: "minicircle_chromosome" EXACT []
-xref: http://en.wikipedia.org/wiki/Minicircle "wiki"
-is_a: SO:0001235 ! replicon
-relationship: part_of SO:0000741 ! kinetoplast
-
-[Term]
-id: SO:0000981
-name: rho_dependent_bacterial_terminator
-synonym: "rho dependent bacterial terminator" EXACT []
-is_a: SO:0000614 ! bacterial_terminator
-
-[Term]
-id: SO:0000982
-name: rho_independent_bacterial_terminator
-synonym: "rho independent bacterial terminator" EXACT []
-is_a: SO:0000614 ! bacterial_terminator
-
-[Term]
-id: SO:0000983
-name: strand_attribute
-comment: Attributes added to describe the different kinds of replicon. SO workshop, September 2006.
-synonym: "strand attribute" EXACT []
-is_a: SO:0000733 ! feature_attribute
-
-[Term]
-id: SO:0000984
-name: single
-comment: Attributes added to describe the different kinds of replicon. SO workshop, September 2006.
-is_a: SO:0000983 ! strand_attribute
-
-[Term]
-id: SO:0000985
-name: double
-comment: Attributes added to describe the different kinds of replicon. SO workshop, September 2006.
-is_a: SO:0000983 ! strand_attribute
-
-[Term]
-id: SO:0000986
-name: topology_attribute
-comment: Attributes added to describe the different kinds of replicon. SO workshop, September 2006.
-synonym: "topology attribute" EXACT []
-is_a: SO:0000443 ! polymer_attribute
-
-[Term]
-id: SO:0000987
-name: linear
-def: "A quality of a nucleotide polymer that has a 3'-terminal residue and a 5'-terminal residue." [SO:cb]
-comment: Attributes added to describe the different kinds of replicon. SO workshop, September 2006.
-synonym: "two-ended" RELATED []
-is_a: SO:0000986 ! topology_attribute
-disjoint_from: SO:0000988 ! circular
-
-[Term]
-id: SO:0000988
-name: circular
-def: "A quality of a nucleotide polymer that has no terminal nucleotide residues." [SO:cb]
-comment: Attributes added to describe the different kinds of replicon. SO workshop, September 2006.
-synonym: "zero-ended" RELATED []
-is_a: SO:0000986 ! topology_attribute
-disjoint_from: SO:0000987 ! linear
-
-[Term]
-id: SO:0000989
-name: class_II_RNA
-def: "Small non-coding RNA (59-60 nt long) containing 5' and 3' ends that are predicted to come together to form a stem structure. Identified in the social amoeba Dictyostelium discoideum and localized in the cytoplasm." [PMID:15333696]
-synonym: "class II RNA" EXACT []
-is_a: SO:0000655 ! ncRNA
-
-[Term]
-id: SO:0000990
-name: class_I_RNA
-def: "Small non-coding RNA (55-65 nt long) containing highly conserved 5' and 3' ends (16 and 8 nt, respectively) that are predicted to come together to form a stem structure. Identified in the social amoeba Dictyostelium discoideum and localized in the cytoplasm." [PMID:15333696]
-comment: Requested by Karen Pilcher - Dictybase. song-Term Tracker-1574577.
-synonym: "class I RNA" EXACT []
-is_a: SO:0000655 ! ncRNA
-
-[Term]
-id: SO:0000991
-name: genomic_DNA
-comment: This term is mapped to MGED. Do not obsolete without consulting MGED ontology.
-synonym: "genomic DNA" EXACT []
-is_a: SO:0000352 ! DNA
-
-[Term]
-id: SO:0000992
-name: BAC_cloned_genomic_insert
-comment: Requested by Andy Schroder - Flybase Harvard, Nov 2006.
-synonym: "BAC cloned genomic insert" EXACT []
-is_a: SO:0000914 ! implied link automatically realized ! cloned_genomic_insert
-intersection_of: SO:0000914 ! cloned_genomic_insert
-intersection_of: derives_from SO:0000153 ! BAC
-
-[Term]
-id: SO:0000993
-name: consensus
-comment: Term added Dec 06 to comply with mapping to MGED terms. It should be used to generate consensus regions. The specific cross product terms they require are consensus_region and consensus_mRNA.
-is_a: SO:0000905 ! status
-
-[Term]
-id: SO:0000994
-name: consensus_region
-comment: DO not obsolete without considering MGED mapping.
-synonym: "consensus region" EXACT []
-is_a: SO:0001410 ! experimental_feature
-intersection_of: SO:0000001 ! region
-intersection_of: has_quality SO:0000993 ! consensus
-
-[Term]
-id: SO:0000995
-name: consensus_mRNA
-comment: DO not obsolete without considering MGED mapping.
-synonym: "consensus mRNA" EXACT []
-is_a: SO:0000234 ! implied link automatically realized ! mRNA
-is_a: SO:0000994 ! implied link automatically realized ! consensus_region
-intersection_of: SO:0000234 ! mRNA
-intersection_of: has_quality SO:0000993 ! consensus
-
-[Term]
-id: SO:0000996
-name: predicted_gene
-comment: This term is mapped to MGED. Do not obsolete without consulting MGED ontology.
-synonym: "predicted gene" EXACT []
-is_a: SO:0000704 ! implied link automatically realized ! gene
-intersection_of: SO:0000704 ! gene
-intersection_of: has_quality SO:0000732 ! predicted
-
-[Term]
-id: SO:0000997
-name: gene_fragment
-comment: This term is mapped to MGED. Do not obsolete without consulting MGED ontology.
-synonym: "gene fragment" EXACT []
-is_a: SO:0000842 ! implied link automatically realized ! gene_component_region
-intersection_of: SO:0000842 ! gene_component_region
-intersection_of: has_quality SO:0000731 ! fragmentary
-
-[Term]
-id: SO:0000998
-name: recursive_splice_site
-def: "A recursive splice site is a splice site which subdivides a large intron. Recursive splicing is a mechanism that splices large introns by sub dividing the intron at non exonic elements and alternate exons." [http://www.genetics.org/cgi/content/full/170/2/661]
-synonym: "recursive splice site" EXACT []
-is_a: SO:0001419 ! cis_splice_site
-
-[Term]
-id: SO:0000999
-name: BAC_end
-def: "A region of sequence from the end of a BAC clone that may provide a highly specific marker." [SO:ke]
-comment: Requested by Keith Boroevich December, 2006.
-synonym: "BAC end" EXACT []
-synonym: "BAC end sequence" EXACT []
-synonym: "BES" EXACT []
-is_a: SO:0000150 ! read
-relationship: part_of SO:0000153 ! BAC
-
-[Term]
-id: SO:0001000
-name: rRNA_16S
-def: "A large polynucleotide in Bacteria and Archaea, which functions as the small subunit of the ribosome." [SO:ke]
-subset: SOFA
-synonym: "16S ribosomal RNA" EXACT []
-synonym: "16S rRNA" RELATED []
-synonym: "16S SSU RNA" EXACT []
-synonym: "rRNA 16S" EXACT []
-xref: http://en.wikipedia.org/wiki/16S_ribosomal_RNA "wiki"
-is_a: SO:0000650 ! small_subunit_rRNA
-
-[Term]
-id: SO:0001001
-name: rRNA_23S
-def: "A large polynucleotide in Bacteria and Archaea, which functions as the large subunit of the ribosome." [SO:ke]
-subset: SOFA
-synonym: "23S LSU rRNA" EXACT []
-synonym: "23S ribosomal RNA" RELATED []
-synonym: "23S rRNA" EXACT []
-synonym: "rRNA 23S" EXACT []
-is_a: SO:0000651 ! large_subunit_rRNA
-
-[Term]
-id: SO:0001002
-name: rRNA_25S
-def: "A large polynucleotide which functions as part of the large subunit of the ribosome in some eukaryotes." [RSC:cb]
-subset: SOFA
-synonym: "25S LSU rRNA" EXACT []
-synonym: "25S ribosomal RNA" EXACT []
-synonym: "25S rRNA" EXACT []
-synonym: "rRNA 25S" EXACT []
-is_a: SO:0000651 ! large_subunit_rRNA
-
-[Term]
-id: SO:0001003
-name: solo_LTR
-def: "A recombination product between the 2 LTR of the same element." [SO:ke]
-comment: Requested by Hadi Quesneville January 2007.
-synonym: "solo LTR" EXACT []
-is_a: SO:0000286 ! long_terminal_repeat
-
-[Term]
-id: SO:0001004
-name: low_complexity
-synonym: "low complexity" EXACT []
-is_a: SO:0000905 ! status
-
-[Term]
-id: SO:0001005
-name: low_complexity_region
-synonym: "low complexity region" EXACT []
-is_a: SO:0001410 ! experimental_feature
-intersection_of: SO:0000001 ! region
-intersection_of: has_quality SO:0001004 ! low_complexity
-
-[Term]
-id: SO:0001006
-name: prophage
-def: "A phage genome after it has established in the host genome in a latent/immune state either as a plasmid or as an integrated \"island\"." [GOC:jl]
-xref: http://en.wikipedia.org/wiki/Prophage "wiki"
-is_a: SO:0000113 ! proviral_region
-
-[Term]
-id: SO:0001007
-name: cryptic_prophage
-def: "A remnant of an integrated prophage in the host genome or an \"island\" in the host genome that includes phage like-genes." [GOC:jl]
-comment: This is not cryptic in the same sense as a cryptic gene or cryptic splice site.
-synonym: "cryptic prophage" EXACT []
-xref: http://ecoliwiki.net/colipedia/index.php/Category\:Cryptic_Prophage.w
-is_a: SO:0000772 ! genomic_island
-
-[Term]
-id: SO:0001008
-name: tetraloop
-def: "A base-paired stem with loop of 4 non-hydrogen bonded nucleotides." [SO:ke]
-xref: http://en.wikipedia.org/wiki/Tetraloop "wiki"
-is_a: SO:0000313 ! stem_loop
-
-[Term]
-id: SO:0001009
-name: DNA_constraint_sequence
-def: "A double-stranded DNA used to control macromolecular structure and function." [http:/www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=search&db=pubmed&term=SILVERMAN+SK[au\]&dispmax=50]
-synonym: "DNA constraint" EXACT []
-synonym: "DNA constraint sequence" EXACT []
-is_a: SO:0000442 ! ds_oligo
-
-[Term]
-id: SO:0001010
-name: i_motif
-def: "A cytosine rich domain whereby strands associate both inter- and intramolecularly at moderately acidic pH." [PMID:9753739]
-synonym: "i motif" EXACT []
-synonym: "short intercalated motif" EXACT []
-is_a: SO:0000142 ! DNA_sequence_secondary_structure
-
-[Term]
-id: SO:0001011
-name: PNA_oligo
-def: "Peptide nucleic acid, is a chemical not known to occur naturally but is artificially synthesized and used in some biological research and medical treatments. The PNA backbone is composed of repeating N-(2-aminoethyl)-glycine units linked by peptide bonds. The purine and pyrimidine bases are linked to the backbone by methylene carbonyl bonds." [SO:ke]
-synonym: "peptide nucleic acid" EXACT []
-synonym: "PNA oligo" EXACT []
-xref: http://en.wikipedia.org/wiki/Peptide_nucleic_acid "wiki"
-is_a: SO:0001247 ! implied link automatically realized ! synthetic_oligo
-intersection_of: SO:0001247 ! synthetic_oligo
-intersection_of: has_quality SO:0001184 ! PNA
-
-[Term]
-id: SO:0001012
-name: DNAzyme
-def: "A DNA sequence with catalytic activity." [SO:cb]
-comment: Added by request from Colin Batchelor.
-synonym: "catalytic DNA" EXACT []
-synonym: "deoxyribozyme" RELATED []
-synonym: "DNA enzyme" EXACT []
-is_a: SO:0000696 ! implied link automatically realized ! oligo
-intersection_of: SO:0000696 ! oligo
-intersection_of: has_quality SO:0001185 ! enzymatic
-
-[Term]
-id: SO:0001013
-name: MNP
-def: "A multiple nucleotide polymorphism with alleles of common length > 1, for example AAA/TTT." [http://www.ncbi.nlm.nih.gov/SNP/snp_ref.cgi?rs=rs2067431]
-synonym: "multiple nucleotide polymorphism" RELATED []
-is_a: SO:1000002 ! substitution
-
-[Term]
-id: SO:0001014
-name: intron_domain
-comment: Requested by Colin Batchelor, Feb 2007.
-synonym: "intron domain" EXACT []
-is_a: SO:0000835 ! primary_transcript_region
-relationship: part_of SO:0000188 ! intron
-
-[Term]
-id: SO:0001015
-name: wobble_base_pair
-def: "A type of non-canonical base pairing, most commonly between G and U, which is important for the secondary structure of RNAs. It has similar thermodynamic stability to the Watson-Crick pairing. Wobble base pairs only have two hydrogen bonds. Other wobble base pair possibilities are I-A, I-U and I-C." [PMID:11256617]
-synonym: "wobble base pair" EXACT []
-synonym: "wobble pair" EXACT []
-xref: http://en.wikipedia.org/wiki/Wobble_base_pair "wiki"
-is_a: SO:0000028 ! base_pair
-
-[Term]
-id: SO:0001016
-name: internal_guide_sequence
-def: "A purine-rich sequence in the group I introns which determines the locations of the splice sites in group I intron splicing and has catalytic activity." [SO:cb]
-synonym: "IGS" EXACT []
-synonym: "internal guide sequence" EXACT []
-is_a: SO:0001014 ! intron_domain
-relationship: part_of SO:0000587 ! group_I_intron
-
-[Term]
-id: SO:0001017
-name: silent_mutation
-def: "A sequence variant that does not affect protein function. Silent mutations may occur in genic ( CDS, UTR, intron etc) and intergenic regions. Silent mutations may have affects on processes such as splicing and regulation." [SO:ke]
-comment: Added in March 2007 in after meeting with pharmgkb. Although this term is in common usage, it is better to annotate with the most specific term possible, such as synonymous codon, intron variant etc.
-synonym: "silent mutation" EXACT []
-xref: http://en.wikipedia.org/wiki/Silent_mutation "wiki"
-is_a: SO:0001537 ! structural_variant
-
-[Term]
-id: SO:0001018
-name: epitope
-def: "A binding site that, in the molecule, interacts selectively and non-covalently with antibodies, B cells or T cells." [http://en.wikipedia.org/wiki/Epitope, SO:cb]
-comment: Requested by Trish Whetzel.
-xref: http://en.wikipedia.org/wiki/Epitope "wiki"
-is_a: SO:0000409 ! binding_site
-
-[Term]
-id: SO:0001019
-name: copy_number_variation
-def: "A variation that increases or decreases the copy number of a given region." [SO:ke]
-subset: SOFA
-synonym: "CNP" EXACT []
-synonym: "CNV" EXACT []
-synonym: "copy number polymorphism" EXACT []
-synonym: "copy number variation" EXACT []
-xref: http://en.wikipedia.org/wiki/Copy_number_variation "wiki"
-is_a: SO:0001059 ! sequence_alteration
-
-[Term]
-id: SO:0001020
-name: sequence_variant_affecting_copy_number
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation affecting copy number" EXACT []
-synonym: "sequence variant affecting copy number" EXACT []
-is_obsolete: true
-replaced_by: SO:0001563
-
-[Term]
-id: SO:0001021
-name: chromosome_breakpoint
-alt_id: SO:0001242
-synonym: "aberration breakpoint" EXACT []
-synonym: "aberration_junction" EXACT []
-synonym: "chromosome breakpoint" EXACT []
-is_a: SO:0000699 ! junction
-relationship: part_of SO:0000340 ! chromosome
-
-[Term]
-id: SO:0001022
-name: inversion_breakpoint
-def: "The point within a chromosome where an inversion begins or ends." [SO:cb]
-synonym: "inversion breakpoint" EXACT []
-is_a: SO:0001021 ! chromosome_breakpoint
-
-[Term]
-id: SO:0001023
-name: allele
-def: "An allele is one of a set of coexisting sequence variants of a gene." [SO:immuno_workshop]
-synonym: "allelomorph" EXACT []
-xref: http://en.wikipedia.org/wiki/Allele "wiki"
-is_a: SO:0001507 ! variant_collection
-relationship: variant_of SO:0000704 ! gene
-
-[Term]
-id: SO:0001024
-name: haplotype
-def: "A haplotype is one of a set of coexisting sequence variants of a haplotype block." [SO:immuno_workshop]
-xref: http://en.wikipedia.org/wiki/Haplotype "wiki"
-is_a: SO:0001507 ! variant_collection
-relationship: variant_of SO:0000355 ! haplotype_block
-
-[Term]
-id: SO:0001025
-name: polymorphic_sequence_variant
-def: "A sequence variant that is segregating in one or more natural populations of a species." [SO:immuno_workshop]
-synonym: "polymorphic sequence variant" EXACT []
-is_a: SO:0001023 ! allele
-
-[Term]
-id: SO:0001026
-name: genome
-def: "A genome is the sum of genetic material within a cell or virion." [SO:immuno_workshop]
-xref: http://en.wikipedia.org/wiki/Genome "wiki"
-is_a: SO:0001260 ! sequence_collection
-intersection_of: SO:0001260 ! sequence_collection
-intersection_of: has_part SO:0001235 ! replicon
-
-[Term]
-id: SO:0001027
-name: genotype
-def: "A genotype is a variant genome, complete or incomplete." [SO:immuno_workshop]
-xref: http://en.wikipedia.org/wiki/Genotype "wiki"
-is_a: SO:0001507 ! variant_collection
-relationship: variant_of SO:0001026 ! genome
-
-[Term]
-id: SO:0001028
-name: diplotype
-def: "A diplotype is a pair of haplotypes from a given individual. It is a genotype where the phase is known." [SO:immuno_workshop]
-is_a: SO:0001507 ! variant_collection
-
-[Term]
-id: SO:0001029
-name: direction_attribute
-synonym: "direction attribute" EXACT []
-is_a: SO:0000733 ! feature_attribute
-
-[Term]
-id: SO:0001030
-name: forward
-def: "Forward is an attribute of the feature, where the feature is in the 5' to 3' direction." [SO:ke]
-is_a: SO:0001029 ! direction_attribute
-
-[Term]
-id: SO:0001031
-name: reverse
-def: "Reverse is an attribute of the feature, where the feature is in the 3' to 5' direction. Again could be applied to primer." [SO:ke]
-is_a: SO:0001029 ! direction_attribute
-
-[Term]
-id: SO:0001032
-name: mitochondrial_DNA
-comment: This terms is used by MO.
-synonym: "mitochondrial DNA" EXACT []
-xref: http://en.wikipedia.org/wiki/Mitochondrial_DNA "wiki"
-is_a: SO:0000737 ! implied link automatically realized ! mitochondrial_sequence
-intersection_of: SO:0000737 ! mitochondrial_sequence
-intersection_of: has_quality SO:0000352 ! DNA
-
-[Term]
-id: SO:0001033
-name: chloroplast_DNA
-comment: This term is used by MO.
-synonym: "chloroplast DNA" EXACT []
-is_a: SO:0000745 ! implied link automatically realized ! chloroplast_sequence
-intersection_of: SO:0000745 ! chloroplast_sequence
-intersection_of: has_quality SO:0000352 ! DNA
-
-[Term]
-id: SO:0001034
-name: mirtron
-def: "A de-branched intron which mimics the structure of pre-miRNA and enters the miRNA processing pathway without Drosha mediated cleavage." [PMID:17589500, SO:ma]
-comment: Ruby et al. Nature 448:83 describe a new class of miRNAs that are derived from de-branched introns.
-is_a: SO:0001014 ! intron_domain
-
-[Term]
-id: SO:0001035
-name: piRNA
-def: "A small non coding RNA, part of a silencing system that prevents the spreading of selfish genetic elements." [SO:ke]
-synonym: "piwi-associated RNA" EXACT []
-xref: http://en.wikipedia.org/wiki/PiRNA "wiki"
-is_a: SO:0000655 ! ncRNA
-
-[Term]
-id: SO:0001036
-name: arginyl_tRNA
-def: "A tRNA sequence that has an arginine anticodon, and a 3' arginine binding region." [SO:ke]
-synonym: "arginyl tRNA" EXACT []
-is_a: SO:0000253 ! tRNA
-relationship: derives_from SO:0000212 ! arginine_tRNA_primary_transcript
-
-[Term]
-id: SO:0001037
-name: mobile_genetic_element
-def: "A nucleotide region with either intra-genome or intracellular moblity, of varying length, which often carry the information necessary for transfer and recombination with the host genome." [PMID:14681355]
-subset: SOFA
-synonym: "MGE" EXACT []
-synonym: "mobile genetic element" EXACT []
-xref: http://en.wikipedia.org/wiki/Mobile_genetic_element "wiki"
-is_a: SO:0001411 ! biological_region
-intersection_of: SO:0000001 ! region
-intersection_of: has_quality SO:0001234 ! mobile
-
-[Term]
-id: SO:0001038
-name: extrachromosomal_mobile_genetic_element
-def: "An MGE that is not integrated into the host chromosome." [SO:ke]
-synonym: "extrachromosomal mobile genetic element" EXACT []
-is_a: SO:0001037 ! mobile_genetic_element
-
-[Term]
-id: SO:0001039
-name: integrated_mobile_genetic_element
-def: "An MGE that is integrated into the host chromosome." [SO:ke]
-subset: SOFA
-synonym: "integrated mobile genetic element" EXACT []
-is_a: SO:0001037 ! mobile_genetic_element
-
-[Term]
-id: SO:0001040
-name: integrated_plasmid
-def: "A plasmid sequence that is integrated within the host chromosome." [SO:ke]
-synonym: "integrated plasmid" EXACT []
-is_a: SO:0001039 ! implied link automatically realized ! integrated_mobile_genetic_element
-intersection_of: SO:0001039 ! integrated_mobile_genetic_element
-intersection_of: derives_from SO:0000155 ! plasmid
-
-[Term]
-id: SO:0001041
-name: viral_sequence
-def: "The region of nucleotide sequence of a virus, a submicroscopic particle that replicates by infecting a host cell." [SO:ke]
-comment: The definitions of the children of this term were revised Decemeber 2007 after discussion on song-devel. The resulting definitions are slightly unweildy but hopefully more logically correct.
-synonym: "viral sequence" EXACT []
-synonym: "virus sequence" EXACT []
-is_a: SO:0001038 ! extrachromosomal_mobile_genetic_element
-is_a: SO:0001235 ! replicon
-
-[Term]
-id: SO:0001042
-name: phage_sequence
-def: "The nucleotide sequence of a virus that infects bacteria." [SO:ke]
-synonym: "bacteriophage" EXACT []
-synonym: "phage" EXACT []
-synonym: "phage sequence" EXACT []
-xref: http://en.wikipedia.org/wiki/Bacteriophage "wiki"
-is_a: SO:0001041 ! viral_sequence
-
-[Term]
-id: SO:0001043
-name: attCtn_site
-def: "An attachment site located on a conjugative transposon and used for site-specific integration of a conjugative transposon." [Phigo:at]
-synonym: "attCtn site" EXACT []
-is_a: SO:0000946 ! integration_excision_site
-relationship: part_of SO:0000371 ! conjugative_transposon
-
-[Term]
-id: SO:0001044
-name: nuclear_mt_pseudogene
-def: "A nuclear pseudogene of either coding or non-coding mitochondria derived sequence." [SO:xp]
-comment: Definition change requested by Val, 3172757.
-synonym: "nuclear mitochondrial pseudogene" EXACT []
-synonym: "nuclear mt pseudogene" EXACT []
-synonym: "NUMT" EXACT []
-xref: http://en.wikipedia.org/wiki/Numt "wikipedia"
-is_a: SO:0001760 ! non_processed_pseudogene
-
-[Term]
-id: SO:0001045
-name: cointegrated_plasmid
-def: "A MGE region consisting of two fused plasmids resulting from a replicative transposition event." [phigo:at]
-synonym: "cointegrated plasmid" EXACT []
-synonym: "cointegrated replicon" EXACT []
-is_a: SO:0001039 ! integrated_mobile_genetic_element
-
-[Term]
-id: SO:0001046
-name: IRLinv_site
-def: "Component of the inversion site located at the left of a region susceptible to site-specific inversion." [Phigo:at]
-synonym: "IRLinv site" EXACT []
-is_a: SO:0001048 ! inversion_site_part
-relationship: part_of SO:0000948 ! inversion_site
-
-[Term]
-id: SO:0001047
-name: IRRinv_site
-def: "Component of the inversion site located at the right of a region susceptible to site-specific inversion." [Phigo:at]
-synonym: "IRRinv site" EXACT []
-is_a: SO:0001048 ! inversion_site_part
-relationship: part_of SO:0000948 ! inversion_site
-
-[Term]
-id: SO:0001048
-name: inversion_site_part
-def: "A region located within an inversion site." [SO:ke]
-comment: A term created to allow the parts of an inversion site have an is_a path back to the root.
-synonym: "inversion site part" EXACT []
-is_a: SO:0000342 ! site_specific_recombination_target_region
-
-[Term]
-id: SO:0001049
-name: defective_conjugative_transposon
-def: "An island that contains genes for integration/excision and the gene and site for the initiation of intercellular transfer by conjugation. It can be complemented for transfer by a conjugative transposon." [Phigo:ariane]
-synonym: "defective conjugative transposon" EXACT []
-is_a: SO:0000772 ! genomic_island
-
-[Term]
-id: SO:0001050
-name: repeat_fragment
-def: "A portion of a repeat, interrupted by the insertion of another element." [SO:ke]
-comment: Requested by Chris Smith, and others at Flybase to help annotate nested repeats.
-synonym: "repeat fragment" EXACT []
-is_a: SO:0000840 ! repeat_component
-relationship: part_of SO:0001649 ! nested_repeat
-
-[Term]
-id: SO:0001051
-name: nested_region
-is_obsolete: true
-
-[Term]
-id: SO:0001052
-name: nested_repeat
-is_obsolete: true
-
-[Term]
-id: SO:0001053
-name: nested_transposon
-is_obsolete: true
-
-[Term]
-id: SO:0001054
-name: transposon_fragment
-def: "A portion of a transposon, interrupted by the insertion of another element." [SO:ke]
-synonym: "transposon fragment" EXACT []
-is_a: SO:0000840 ! repeat_component
-relationship: part_of SO:0001648 ! nested_transposon
-
-[Term]
-id: SO:0001055
-name: transcriptional_cis_regulatory_region
-def: "A regulatory_region that modulates the transcription of a gene or genes." [SO:regcreative]
-subset: SOFA
-synonym: "transcriptional cis regulatory region" EXACT []
-is_a: SO:0001679 ! transcription_regulatory_region
-
-[Term]
-id: SO:0001056
-name: splicing_regulatory_region
-def: "A regulatory_region that modulates splicing." [SO:ke]
-subset: SOFA
-synonym: "splicing regulatory region" EXACT []
-is_a: SO:0001679 ! transcription_regulatory_region
-
-[Term]
-id: SO:0001057
-name: enhanceosome
-is_obsolete: true
-
-[Term]
-id: SO:0001058
-name: promoter_targeting_sequence
-def: "A transcriptional_cis_regulatory_region that restricts the activity of a CRM to a single promoter and which functions only when both itself and an insulator are located between the CRM and the promoter." [SO:regcreative]
-synonym: "promoter targeting sequence" EXACT []
-is_a: SO:0001055 ! transcriptional_cis_regulatory_region
-
-[Term]
-id: SO:0001059
-name: sequence_alteration
-alt_id: SO:1000004
-alt_id: SO:1000007
-def: "A sequence_alteration is a sequence_feature whose extent is the deviation from another sequence." [SO:ke]
-comment: Merged with partially characterized change in nucleotide sequence.
-subset: SOFA
-synonym: "partially characterised change in DNA sequence" NARROW []
-synonym: "partially_characterised_change_in_DNA_sequence" NARROW []
-synonym: "sequence alteration" EXACT []
-synonym: "uncharacterised_change_in_nucleotide_sequence" NARROW []
-is_a: SO:0000110 ! sequence_feature
-
-[Term]
-id: SO:0001060
-name: sequence_variant
-def: "A sequence_variant is a non exact copy of a sequence_feature or genome exhibiting one or more sequence_alteration." [SO:ke]
-synonym: "sequence variant" EXACT []
-
-[Term]
-id: SO:0001061
-name: propeptide_cleavage_site
-alt_id: BS:00063
-def: "The propeptide_cleavage_site is the arginine/lysine boundary on a propeptide where cleavage occurs." [EBIBS:GAR]
-comment: Discrete.
-subset: biosapiens
-synonym: "propeptide cleavage site" EXACT []
-is_a: SO:0100011 ! cleaved_peptide_region
-relationship: part_of SO:0001062 ! propeptide
-
-[Term]
-id: SO:0001062
-name: propeptide
-alt_id: BS:00077
-def: "Part of a peptide chain which is cleaved off during the formation of the mature protein." [EBIBS:GAR]
-comment: Range.
-subset: biosapiens
-synonym: "propep" RELATED [uniprot:feature_type]
-xref: http://en.wikipedia.org/wiki/Propeptide "wiki"
-is_a: SO:0100011 ! cleaved_peptide_region
-
-[Term]
-id: SO:0001063
-name: immature_peptide_region
-alt_id: BS:00129
-def: "An immature_peptide_region is the extent of the peptide after it has been translated and before any processing occurs." [EBIBS:GAR]
-comment: Range.
-subset: biosapiens
-subset: SOFA
-synonym: "immature peptide region" EXACT []
-is_a: SO:0000839 ! polypeptide_region
-
-[Term]
-id: SO:0001064
-name: active_peptide
-alt_id: BS:00076
-def: "Active peptides are proteins which are biologically active, released from a precursor molecule." [EBIBS:GAR, UniProt:curation_manual]
-comment: Hormones, neuropeptides, antimicrobial peptides, are active peptides. They are typically short (<40 amino acids) in length.
-subset: biosapiens
-synonym: "active peptide" EXACT []
-synonym: "peptide" BROAD [uniprot:feature_type]
-xref: http://en.wikipedia.org/wiki/Peptide "wiki"
-is_a: SO:0000419 ! mature_protein_region
-
-[Term]
-id: SO:0001066
-name: compositionally_biased_region_of_peptide
-alt_id: BS:00068
-def: "Polypeptide region that is rich in a particular amino acid or homopolymeric and greater than three residues in length." [EBIBS:GAR, UniProt:curation_manual]
-comment: Range.
-subset: biosapiens
-synonym: "compbias" RELATED [uniprot:feature_type]
-synonym: "compositional bias" RELATED []
-synonym: "compositionally biased" RELATED []
-synonym: "compositionally biased region of peptide" RELATED []
-synonym: "compositionally_biased_region" EXACT []
-is_a: SO:0000839 ! polypeptide_region
-
-[Term]
-id: SO:0001067
-name: polypeptide_motif
-alt_id: BS:00032
-def: "A sequence motif is a short (up to 20 amino acids) region of biological interest. Such motifs, although they are too short to constitute functional domains, share sequence similarities and are conserved in different proteins. They display a common function (protein-binding, subcellular location etc.)." [EBIBS:GAR, UniProt:curation_manual]
-comment: Range.
-subset: biosapiens
-synonym: "motif" BROAD [uniprot:feature_type]
-synonym: "polypeptide motif" EXACT []
-is_a: SO:0100021 ! polypeptide_conserved_region
-
-[Term]
-id: SO:0001068
-name: polypeptide_repeat
-alt_id: BS:00070
-def: "A polypeptide_repeat is a single copy of an internal sequence repetition." [EBIBS:GAR]
-comment: Range.
-subset: biosapiens
-synonym: "polypeptide repeat" EXACT []
-synonym: "repeat" RELATED [uniprot:feature_type]
-is_a: SO:0100021 ! polypeptide_conserved_region
-
-[Term]
-id: SO:0001070
-name: polypeptide_structural_region
-alt_id: BS:00337
-def: "Region of polypeptide with a given structural property." [EBIBS:GAR, SO:cb]
-comment: Range.
-subset: biosapiens
-synonym: "polypeptide structural region" EXACT []
-synonym: "structural_region" RELATED []
-is_a: SO:0000839 ! polypeptide_region
-
-[Term]
-id: SO:0001071
-name: membrane_structure
-alt_id: BS:00128
-def: "Arrangement of the polypeptide with respect to the lipid bilayer." [EBIBS:GAR]
-comment: Range.
-subset: biosapiens
-synonym: "membrane structure" EXACT []
-is_a: SO:0001070 ! polypeptide_structural_region
-
-[Term]
-id: SO:0001072
-name: extramembrane_polypeptide_region
-alt_id: BS:00154
-def: "Polypeptide region that is localized outside of a lipid bilayer." [EBIBS:GAR, SO:cb]
-comment: Range.
-subset: biosapiens
-synonym: "extramembrane" RELATED BS []
-synonym: "extramembrane polypeptide region" EXACT []
-synonym: "extramembrane_region" RELATED BS []
-synonym: "topo_dom" RELATED BS [uniprot:feature_type]
-is_a: SO:0001070 ! polypeptide_structural_region
-relationship: part_of SO:0001071 ! membrane_structure
-
-[Term]
-id: SO:0001073
-name: cytoplasmic_polypeptide_region
-alt_id: BS:00145
-def: "Polypeptide region that is localized inside the cytoplasm." [EBIBS:GAR, SO:cb]
-subset: biosapiens
-synonym: "cytoplasm_location" EXACT BS []
-synonym: "cytoplasmic polypeptide region" EXACT []
-synonym: "inside" RELATED BS []
-is_a: SO:0001072 ! extramembrane_polypeptide_region
-
-[Term]
-id: SO:0001074
-name: non_cytoplasmic_polypeptide_region
-alt_id: BS:00144
-def: "Polypeptide region that is localized outside of a lipid bilayer and outside of the cytoplasm." [EBIBS:GAR, SO:cb]
-comment: This could be inside an organelle within the cell.
-subset: biosapiens
-synonym: "non cytoplasmic polypeptide region" EXACT []
-synonym: "non_cytoplasm_location" EXACT BS []
-synonym: "outside" RELATED BS []
-is_a: SO:0001072 ! extramembrane_polypeptide_region
-
-[Term]
-id: SO:0001075
-name: intramembrane_polypeptide_region
-alt_id: BS:00156
-def: "Polypeptide region present in the lipid bilayer." [EBIBS:GAR]
-subset: biosapiens
-synonym: "intramembrane" RELATED BS []
-synonym: "intramembrane polypeptide region" EXACT []
-is_a: SO:0001070 ! polypeptide_structural_region
-relationship: part_of SO:0001071 ! membrane_structure
-
-[Term]
-id: SO:0001076
-name: membrane_peptide_loop
-alt_id: BS:00155
-def: "Polypeptide region localized within the lipid bilayer where both ends traverse the same membrane." [EBIBS:GAR, SO:cb]
-subset: biosapiens
-synonym: "membrane peptide loop" EXACT []
-synonym: "membrane_loop" RELATED BS []
-is_a: SO:0001075 ! intramembrane_polypeptide_region
-
-[Term]
-id: SO:0001077
-name: transmembrane_polypeptide_region
-alt_id: BS:00158
-def: "Polypeptide region traversing the lipid bilayer." [EBIBS:GAR, UniProt:curator_manual]
-subset: biosapiens
-synonym: "transmem" RELATED BS [uniprot:feature_type]
-synonym: "transmembrane" RELATED BS []
-synonym: "transmembrane polypeptide region" EXACT []
-is_a: SO:0001075 ! intramembrane_polypeptide_region
-
-[Term]
-id: SO:0001078
-name: polypeptide_secondary_structure
-alt_id: BS:00003
-def: "A region of peptide with secondary structure has hydrogen bonding along the peptide chain that causes a defined conformation of the chain." [EBIBS:GAR]
-comment: Biosapien term was secondary_structure.
-subset: biosapiens
-synonym: "2nary structure" RELATED BS []
-synonym: "polypeptide secondary structure" EXACT []
-synonym: "secondary structure" RELATED BS []
-synonym: "secondary structure region" RELATED BS []
-synonym: "secondary_structure" RELATED BS []
-xref: http://en.wikipedia.org/wiki/Secondary_structure "wiki"
-is_a: SO:0001070 ! polypeptide_structural_region
-
-[Term]
-id: SO:0001079
-name: polypeptide_structural_motif
-alt_id: BS:0000338
-def: "Motif is a three-dimensional structural element within the chain, which appears also in a variety of other molecules. Unlike a domain, a motif does not need to form a stable globular unit." [EBIBS:GAR]
-subset: biosapiens
-synonym: "polypeptide structural motif" RELATED []
-synonym: "structural_motif" RELATED BS []
-xref: http://en.wikipedia.org/wiki/Structural_motif "wiki"
-is_a: SO:0001070 ! polypeptide_structural_region
-
-[Term]
-id: SO:0001080
-name: coiled_coil
-alt_id: BS:00041
-def: "A coiled coil is a structural motif in proteins, in which alpha-helices are coiled together like the strands of a rope." [EBIBS:GAR, UniProt:curation_manual]
-comment: Range.
-subset: biosapiens
-synonym: "coiled" RELATED BS [uniprot:feature_type]
-synonym: "coiled coil" EXACT []
-xref: http://en.wikipedia.org/wiki/Coiled_coil "wiki"
-is_a: SO:0001079 ! polypeptide_structural_motif
-
-[Term]
-id: SO:0001081
-name: helix_turn_helix
-alt_id: BS:00147
-def: "A motif comprising two helices separated by a turn." [EBIBS:GAR]
-subset: biosapiens
-synonym: "helix turn helix" EXACT []
-synonym: "helix-turn-helix" EXACT []
-synonym: "HTH" RELATED BS []
-is_a: SO:0001079 ! polypeptide_structural_motif
-relationship: has_part SO:0001114 ! peptide_helix
-relationship: has_part SO:0001128 ! polypeptide_turn_motif
-
-[Term]
-id: SO:0001082
-name: polypeptide_sequencing_information
-alt_id: BS:00125
-def: "Incompatibility in the sequence due to some experimental problem." [EBIBS:GAR]
-comment: Range.
-subset: biosapiens
-synonym: "sequencing_information" EXACT []
-is_a: SO:0000700 ! remark
-
-[Term]
-id: SO:0001083
-name: non_adjacent_residues
-alt_id: BS:00182
-def: "Indicates that two consecutive residues in a fragment sequence are not consecutive in the full-length protein and that there are a number of unsequenced residues between them." [EBIBS:GAR, UniProt:curation_manual]
-subset: biosapiens
-synonym: "non consecutive" EXACT []
-synonym: "non_cons" EXACT [uniprot:feature_type]
-is_a: SO:0001082 ! polypeptide_sequencing_information
-
-[Term]
-id: SO:0001084
-name: non_terminal_residue
-alt_id: BS:00072
-def: "The residue at an extremity of the sequence is not the terminal residue." [EBIBS:GAR, UniProt:curation_manual]
-comment: Discrete.
-subset: biosapiens
-synonym: "non terminal" EXACT []
-synonym: "non_ter" EXACT [uniprot:feature_type]
-is_a: SO:0001082 ! polypeptide_sequencing_information
-
-[Term]
-id: SO:0001085
-name: sequence_conflict
-alt_id: BS:00069
-def: "Different sources report differing sequences." [EBIBS:GAR, UniProt:curation_manual]
-comment: Discrete.
-subset: biosapiens
-synonym: "conflict" EXACT [uniprot:feature_type]
-is_a: SO:0001082 ! polypeptide_sequencing_information
-
-[Term]
-id: SO:0001086
-name: sequence_uncertainty
-alt_id: BS:00181
-def: "Describes the positions in a sequence where the authors are unsure about the sequence assignment." [EBIBS:GAR, UniProt:curation_manual]
-subset: biosapiens
-synonym: "unsure" EXACT [uniprot:feature_type]
-is_a: SO:0001082 ! polypeptide_sequencing_information
-
-[Term]
-id: SO:0001087
-name: cross_link
-alt_id: BS:00178
-def: "Posttranslationally formed amino acid bonds." [EBIBS:GAR, UniProt:curation_manual]
-subset: biosapiens
-synonym: "cross link" EXACT []
-synonym: "crosslink" RELATED []
-is_obsolete: true
-
-[Term]
-id: SO:0001088
-name: disulfide_bond
-alt_id: BS:00028
-def: "The covalent bond between sulfur atoms that binds two peptide chains or different parts of one peptide chain and is a structural determinant in many protein molecules." [EBIBS:GAR, UniProt:curation_manual]
-comment: 2 discreet & joined.
-subset: biosapiens
-synonym: "disulfid" RELATED []
-synonym: "disulfide" RELATED []
-synonym: "disulfide bond" RELATED []
-synonym: "disulphide" EXACT []
-synonym: "disulphide bond" RELATED []
-is_obsolete: true
-
-[Term]
-id: SO:0001089
-name: post_translationally_modified_region
-alt_id: BS:00052
-def: "A region where a transformation occurs in a protein after it has been synthesized. This which may regulate, stabilize, crosslink or introduce new chemical functionalities in the protein." [EBIBS:GAR, UniProt:curation_manual]
-comment: Discrete.
-subset: biosapiens
-synonym: "mod_res" EXACT [uniprot:feature_type]
-synonym: "modified residue" EXACT []
-synonym: "post_translational_modification" EXACT []
-xref: http://en.wikipedia.org/wiki/Post_translational_modification "wiki"
-is_a: SO:0100001 ! biochemical_region_of_peptide
-
-[Term]
-id: SO:0001090
-name: covalent_binding_site
-alt_id: BS:00246
-def: "Binding involving a covalent bond." [EBIBS:GAR]
-subset: biosapiens
-synonym: "covalent binding site" EXACT []
-is_obsolete: true
-
-[Term]
-id: SO:0001091
-name: non_covalent_binding_site
-alt_id: BS:00029
-def: "Binding site for any chemical group (co-enzyme, prosthetic group, etc.)." [EBIBS:GAR]
-comment: Discrete.
-subset: biosapiens
-synonym: "binding" RELATED [uniprot:curation]
-synonym: "binding site" RELATED []
-synonym: "non covalent binding site" EXACT []
-is_obsolete: true
-
-[Term]
-id: SO:0001092
-name: polypeptide_metal_contact
-alt_id: BS:00027
-def: "A binding site that, in the polypeptide molecule, interacts selectively and non-covalently with metal ions." [EBIBS:GAR, SO:cb, UniProt:curation_manual]
-comment: Residue is part of a binding site for a metal ion.
-subset: biosapiens
-synonym: "metal_binding" RELATED []
-is_a: SO:0001656 ! metal_binding_site
-is_a: SO:0100002 ! molecular_contact_region
-
-[Term]
-id: SO:0001093
-name: protein_protein_contact
-alt_id: BS:00131
-def: "A binding site that, in the protein molecule, interacts selectively and non-covalently with polypeptide residues." [EBIBS:GAR, UniProt:Curation_manual]
-subset: biosapiens
-synonym: "protein protein contact" EXACT []
-synonym: "protein protein contact site" EXACT []
-synonym: "protein_protein_interaction" RELATED []
-xref: http://en.wikipedia.org/wiki/Protein_protein_interaction "wiki"
-is_a: SO:0000410 ! protein_binding_site
-is_a: SO:0100002 ! molecular_contact_region
-
-[Term]
-id: SO:0001094
-name: polypeptide_calcium_ion_contact_site
-alt_id: BS:00186
-def: "A binding site that, in the polypeptide molecule, interacts selectively and non-covalently with calcium ions." [EBIBS:GAR]
-comment: Residue involved in contact with calcium.
-subset: biosapiens
-synonym: "ca bind" RELATED []
-synonym: "Ca_contact_site" EXACT []
-synonym: "polypeptide calcium ion contact site" EXACT []
-is_a: SO:0001092 ! polypeptide_metal_contact
-
-[Term]
-id: SO:0001095
-name: polypeptide_cobalt_ion_contact_site
-alt_id: BS:00136
-def: "A binding site that, in the polypeptide molecule, interacts selectively and non-covalently with cobalt ions." [EBIBS:GAR, SO:cb]
-subset: biosapiens
-synonym: "Co_contact_site" EXACT []
-synonym: "polypeptide cobalt ion contact site" EXACT []
-is_a: SO:0001092 ! polypeptide_metal_contact
-
-[Term]
-id: SO:0001096
-name: polypeptide_copper_ion_contact_site
-alt_id: BS:00146
-def: "A binding site that, in the polypeptide molecule, interacts selectively and non-covalently with copper ions." [EBIBS:GAR, SO:cb]
-subset: biosapiens
-synonym: "Cu_contact_site" EXACT []
-synonym: "polypeptide copper ion contact site" EXACT []
-is_a: SO:0001092 ! polypeptide_metal_contact
-
-[Term]
-id: SO:0001097
-name: polypeptide_iron_ion_contact_site
-alt_id: BS:00137
-def: "A binding site that, in the polypeptide molecule, interacts selectively and non-covalently with iron ions." [EBIBS:GAR, SO:cb]
-subset: biosapiens
-synonym: "Fe_contact_site" EXACT []
-synonym: "polypeptide iron ion contact site" EXACT []
-is_a: SO:0001092 ! polypeptide_metal_contact
-
-[Term]
-id: SO:0001098
-name: polypeptide_magnesium_ion_contact_site
-alt_id: BS:00187
-def: "A binding site that, in the polypeptide molecule, interacts selectively and non-covalently with magnesium ions." [EBIBS:GAR, SO:cb]
-subset: biosapiens
-synonym: "Mg_contact_site" EXACT []
-synonym: "polypeptide magnesium ion contact site" EXACT []
-is_a: SO:0001092 ! polypeptide_metal_contact
-
-[Term]
-id: SO:0001099
-name: polypeptide_manganese_ion_contact_site
-alt_id: BS:00140
-def: "A binding site that, in the polypeptide molecule, interacts selectively and non-covalently with manganese ions." [EBIBS:GAR, SO:cb]
-subset: biosapiens
-synonym: "Mn_contact_site" EXACT []
-synonym: "polypeptide manganese ion contact site" EXACT []
-is_a: SO:0001092 ! polypeptide_metal_contact
-
-[Term]
-id: SO:0001100
-name: polypeptide_molybdenum_ion_contact_site
-alt_id: BS:00141
-def: "A binding site that, in the polypeptide molecule, interacts selectively and non-covalently with molybdenum ions." [EBIBS:GAR, SO:cb]
-subset: biosapiens
-synonym: "Mo_contact_site" EXACT []
-synonym: "polypeptide molybdenum ion contact site" EXACT []
-is_a: SO:0001092 ! polypeptide_metal_contact
-
-[Term]
-id: SO:0001101
-name: polypeptide_nickel_ion_contact_site
-alt_id: BS:00142
-def: "A binding site that, in the polypeptide molecule, interacts selectively and non-covalently with nickel ions." [EBIBS:GAR]
-subset: biosapiens
-synonym: "Ni_contact_site" EXACT []
-synonym: "polypeptide nickel ion contact site" EXACT []
-is_a: SO:0001092 ! polypeptide_metal_contact
-
-[Term]
-id: SO:0001102
-name: polypeptide_tungsten_ion_contact_site
-alt_id: BS:00143
-def: "A binding site that, in the polypeptide molecule, interacts selectively and non-covalently with tungsten ions." [EBIBS:GAR, SO:cb]
-subset: biosapiens
-synonym: "polypeptide tungsten ion contact site" EXACT []
-synonym: "W_contact_site" EXACT []
-is_a: SO:0001092 ! polypeptide_metal_contact
-
-[Term]
-id: SO:0001103
-name: polypeptide_zinc_ion_contact_site
-alt_id: BS:00185
-def: "A binding site that, in the polypeptide molecule, interacts selectively and non-covalently with zinc ions." [EBIBS:GAR, SO:cb]
-subset: biosapiens
-synonym: "polypeptide zinc ion contact site" EXACT []
-synonym: "Zn_contact_site" EXACT []
-is_a: SO:0001092 ! polypeptide_metal_contact
-
-[Term]
-id: SO:0001104
-name: catalytic_residue
-alt_id: BS:00026
-def: "Amino acid involved in the activity of an enzyme." [EBIBS:GAR, UniProt:curation_manual]
-comment: Discrete.
-subset: biosapiens
-synonym: "act_site" RELATED [uniprot:feature_type]
-synonym: "active site residue" EXACT []
-synonym: "catalytic residue" EXACT []
-is_a: SO:0001237 ! amino_acid
-relationship: part_of SO:0100019 ! polypeptide_catalytic_motif
-
-[Term]
-id: SO:0001105
-name: polypeptide_ligand_contact
-alt_id: BS:00157
-def: "Residues which interact with a ligand." [EBIBS:GAR]
-subset: biosapiens
-synonym: "polypeptide ligand contact" EXACT []
-synonym: "protein-ligand interaction" RELATED []
-is_a: SO:0001657 ! ligand_binding_site
-is_a: SO:0100002 ! molecular_contact_region
-
-[Term]
-id: SO:0001106
-name: asx_motif
-alt_id: BS:00202
-def: "A motif of five consecutive residues and two H-bonds in which: Residue(i) is Aspartate or Asparagine (Asx), side-chain O of residue(i) is H-bonded to the main-chain NH of residue(i+2) or (i+3), main-chain CO of residue(i) is H-bonded to the main-chain NH of residue(i+3) or (i+4)." [EBIBS:GAR, http://www.ebi.ac.uk/msd-srv/msdmotif/]
-subset: biosapiens
-synonym: "asx motif" EXACT []
-is_a: SO:0001078 ! polypeptide_secondary_structure
-
-[Term]
-id: SO:0001107
-name: beta_bulge
-alt_id: BS:00208
-def: "A motif of three residues within a beta-sheet in which the main chains of two consecutive residues are H-bonded to that of the third, and in which the dihedral angles are as follows: Residue(i): -140 degrees < phi(l) -20 degrees , -90 degrees < psi(l) < 40 degrees. Residue (i+1): -180 degrees < phi < -25 degrees or +120 degrees < phi < +180 degrees, +40 degrees < psi < +180 degrees or -180 degrees < psi < -120 degrees." [EBIBS:GAR, http://www.ebi.ac.uk/msd-srv/msdmotif/]
-subset: biosapiens
-synonym: "beta bulge" EXACT []
-xref: http://en.wikipedia.org/wiki/Beta_bulge "wiki"
-is_a: SO:0001078 ! polypeptide_secondary_structure
-
-[Term]
-id: SO:0001108
-name: beta_bulge_loop
-alt_id: BS:00209
-def: "A motif of three residues within a beta-sheet consisting of two H-bonds. Beta bulge loops often occur at the loop ends of beta-hairpins." [EBIBS:GAR, Http://www.ebi.ac.uk/msd-srv/msdmotif/]
-subset: biosapiens
-synonym: "beta bulge loop" EXACT []
-is_a: SO:0001078 ! polypeptide_secondary_structure
-
-[Term]
-id: SO:0001109
-name: beta_bulge_loop_five
-alt_id: BS:00210
-def: "A motif of three residues within a beta-sheet consisting of two H-bonds in which: the main-chain NH of residue(i) is H-bonded to the main-chain CO of residue(i+4), the main-chain CO of residue i is H-bonded to the main-chain NH of residue(i+3), these loops have an RL nest at residues i+2 and i+3." [EBIBS:GAR, http://www.ebi.ac.uk/msd-srv/msdmotif/]
-subset: biosapiens
-synonym: "beta bulge loop five" EXACT []
-is_a: SO:0001108 ! beta_bulge_loop
-
-[Term]
-id: SO:0001110
-name: beta_bulge_loop_six
-alt_id: BS:00211
-def: "A motif of three residues within a beta-sheet consisting of two H-bonds in which: the main-chain NH of residue(i) is H-bonded to the main-chain CO of residue(i+5), the main-chain CO of residue i is H-bonded to the main-chain NH of residue(i+4), these loops have an RL nest at residues i+3 and i+4." [EBIBS:GAR, http://www.ebi.ac.uk/msd-srv/msdmotif/]
-subset: biosapiens
-synonym: "beta bulge loop six" EXACT []
-is_a: SO:0001108 ! beta_bulge_loop
-
-[Term]
-id: SO:0001111
-name: beta_strand
-alt_id: BS:00042
-def: "A beta strand describes a single length of polypeptide chain that forms part of a beta sheet. A single continuous stretch of amino acids adopting an extended conformation of hydrogen bonds between the N-O and the C=O of another part of the peptide. This forms a secondary protein structure in which two or more extended polypeptide regions are hydrogen-bonded to one another in a planar array." [EBIBS:GAR, UniProt:curation_manual]
-comment: Range.
-subset: biosapiens
-synonym: "strand" RELATED BS [uniprot:feature_type]
-xref: http://en.wikipedia.org/wiki/Beta_sheet "wiki"
-is_a: SO:0001078 ! polypeptide_secondary_structure
-
-[Term]
-id: SO:0001112
-name: antiparallel_beta_strand
-alt_id: BS:0000341
-def: "A peptide region which hydrogen bonded to another region of peptide running in the oposite direction (one running N-terminal to C-terminal and one running C-terminal to N-terminal). Hydrogen bonding occurs between every other C=O from one strand to every other N-H on the adjacent strand. In this case, if two atoms C-alpha (i) and C-alpha (j) are adjacent in two hydrogen-bonded beta strands, then they form two mutual backbone hydrogen bonds to each other's flanking peptide groups; t [...]
-comment: Range.
-subset: biosapiens
-synonym: "antiparallel beta strand" EXACT []
-is_a: SO:0001111 ! beta_strand
-
-[Term]
-id: SO:0001113
-name: parallel_beta_strand
-alt_id: BS:00151
-def: "A peptide region which hydrogen bonded to another region of peptide running in the oposite direction (both running N-terminal to C-terminal). This orientation is slightly less stable because it introduces nonplanarity in the inter-strand hydrogen bonding pattern. Hydrogen bonding occurs between every other C=O from one strand to every other N-H on the adjacent strand. In this case, if two atoms C-alpha (i)and C-alpha (j) are adjacent in two hydrogen-bonded beta strands, then they d [...]
-comment: Range.
-subset: biosapiens
-synonym: "parallel beta strand" EXACT []
-is_a: SO:0001111 ! beta_strand
-
-[Term]
-id: SO:0001114
-name: peptide_helix
-alt_id: BS:00152
-def: "A helix is a secondary_structure conformation where the peptide backbone forms a coil." [EBIBS:GAR]
-comment: Range.
-subset: biosapiens
-synonym: "helix" RELATED BS []
-is_a: SO:0001078 ! polypeptide_secondary_structure
-
-[Term]
-id: SO:0001115
-name: left_handed_peptide_helix
-alt_id: BS:00222
-def: "A left handed helix is a region of peptide where the coiled conformation turns in an anticlockwise, left handed screw." [EBIBS:GAR]
-subset: biosapiens
-synonym: "helix-l" RELATED []
-synonym: "left handed helix" EXACT []
-is_a: SO:0001114 ! peptide_helix
-
-[Term]
-id: SO:0001116
-name: right_handed_peptide_helix
-alt_id: BS:0000339
-def: "A right handed helix is a region of peptide where the coiled conformation turns in a clockwise, right handed screw." [EBIBS:GAR]
-subset: biosapiens
-synonym: "helix" RELATED BS []
-synonym: "right handed helix" EXACT []
-is_a: SO:0001114 ! peptide_helix
-
-[Term]
-id: SO:0001117
-name: alpha_helix
-alt_id: BS:00040
-def: "The helix has 3.6 residues per turn which corersponds to a translation of 1.5 angstroms (= 0.15 nm) along the helical axis. Every backbone N-H group donates a hydrogen bond to the backbone C=O group of the amino acid four residues earlier." [EBIBS:GAR]
-comment: Range.
-subset: biosapiens
-synonym: "a-helix" RELATED BS []
-synonym: "helix" RELATED BS [uniprot:feature_type]
-xref: http://en.wikipedia.org/wiki/Alpha_helix "wiki"
-is_a: SO:0001116 ! right_handed_peptide_helix
-
-[Term]
-id: SO:0001118
-name: pi_helix
-alt_id: BS:00153
-def: "The pi helix has 4.1 residues per turn and a translation of 1.15  (=0.115 nm) along the helical axis. The N-H group of an amino acid forms a hydrogen bond with the C=O group of the amino acid five residues earlier." [EBIBS:GAR]
-comment: Range.
-subset: biosapiens
-synonym: "pi helix" EXACT []
-xref: http://en.wikipedia.org/wiki/Pi_helix "wiki"
-is_a: SO:0001116 ! right_handed_peptide_helix
-
-[Term]
-id: SO:0001119
-name: three_ten_helix
-alt_id: BS:0000340
-def: "The 3-10 helix has 3 residues per turn with a translation of 2.0 angstroms (=0.2 nm) along the helical axis. The N-H group of an amino acid forms a hydrogen bond with the C=O group of the amino acid three residues earlier." [EBIBS:GAR]
-comment: Range.
-subset: biosapiens
-synonym: "3(10) helix" EXACT []
-synonym: "3-10 helix" EXACT []
-synonym: "310 helix" EXACT []
-synonym: "three ten helix" EXACT []
-xref: http://en.wikipedia.org/wiki/310_helix "wiki"
-is_a: SO:0001116 ! right_handed_peptide_helix
-
-[Term]
-id: SO:0001120
-name: polypeptide_nest_motif
-alt_id: BS:00223
-def: "A motif of two consecutive residues with dihedral angles. Nest should not have Proline as any residue. Nests frequently occur as parts of other motifs such as Schellman loops." [EBIBS:GAR, http://www.ebi.ac.uk/msd-srv/msdmotif/]
-subset: biosapiens
-synonym: "nest" RELATED BS []
-synonym: "nest_motif" EXACT []
-synonym: "polypeptide nest motif" RELATED []
-is_a: SO:0001078 ! polypeptide_secondary_structure
-
-[Term]
-id: SO:0001121
-name: polypeptide_nest_left_right_motif
-alt_id: BS:00224
-def: "A motif of two consecutive residues with dihedral angles: Residue(i): +20 degrees < phi < +140 degrees, -40 degrees < psi < +90 degrees. Residue(i+1): -140 degrees < phi < -20 degrees, -90 degrees < psi < +40 degrees." [EBIBS:GAR, http://www.ebi.ac.uk/msd-srv/msdmotif/]
-subset: biosapiens
-synonym: "nest_left_right" EXACT []
-synonym: "nest_lr" EXACT []
-synonym: "polypeptide nest left right motif" EXACT []
-is_a: SO:0001120 ! polypeptide_nest_motif
-
-[Term]
-id: SO:0001122
-name: polypeptide_nest_right_left_motif
-alt_id: BS:00225
-def: "A motif of two consecutive residues with dihedral angles: Residue(i): -140 degrees < phi < -20 degrees, -90 degrees < psi < +40 degrees. Residue(i+1): +20 degrees < phi < +140 degrees, -40 degrees < psi < +90 degrees." [EBIBS:GAR, http://www.ebi.ac.uk/msd-srv/msdmotif/]
-subset: biosapiens
-synonym: "nest_right_left" EXACT []
-synonym: "nest_rl" EXACT []
-synonym: "polypeptide nest right left motif" EXACT []
-is_a: SO:0001120 ! polypeptide_nest_motif
-
-[Term]
-id: SO:0001123
-name: schellmann_loop
-alt_id: BS:00226
-def: "A motif of six or seven consecutive residues that contains two H-bonds." [EBIBS:GAR, http://www.ebi.ac.uk/msd-srv/msdmotif/]
-subset: biosapiens
-synonym: "paperclip" RELATED BS []
-synonym: "paperclip loop" RELATED []
-synonym: "schellmann loop" EXACT []
-is_a: SO:0001078 ! polypeptide_secondary_structure
-
-[Term]
-id: SO:0001124
-name: schellmann_loop_seven
-alt_id: BS:00228
-def: "Wild type: A motif of seven consecutive residues that contains two H-bonds in which: the main-chain CO of residue(i) is H-bonded to the main-chain NH of residue(i+6), the main-chain CO of residue(i+1) is H-bonded to the main-chain NH of residue(i+5)." [EBIBS:GAR, http://www.ebi.ac.uk/msd-srv/msdmotif/]
-subset: biosapiens
-synonym: "schellmann loop seven" EXACT []
-synonym: "seven-residue schellmann loop" EXACT []
-is_a: SO:0001123 ! schellmann_loop
-
-[Term]
-id: SO:0001125
-name: schellmann_loop_six
-alt_id: BS:00227
-def: "Common Type: A motif of six consecutive residues that contains two H-bonds in which: the main-chain CO of residue(i) is H-bonded to the main-chain NH of residue(i+5) the main-chain CO of residue(i+1) is H-bonded to the main-chain NH of residue(i+4)." [EBIBS:GAR, http://www.ebi.ac.uk/msd-srv/msdmotif/]
-subset: biosapiens
-synonym: "schellmann loop six" EXACT []
-synonym: "six-residue schellmann loop" EXACT []
-is_a: SO:0001123 ! schellmann_loop
-
-[Term]
-id: SO:0001126
-name: serine_threonine_motif
-alt_id: BS:00229
-def: "A motif of five consecutive residues and two hydrogen bonds in which: residue(i) is Serine (S) or Threonine (T), the side-chain O of residue(i) is H-bonded to the main-chain NH of residue(i+2) or (i+3) , the main-chain CO group of residue(i) is H-bonded to the main-chain NH of residue(i+3) or (i+4)." [EBIBS:GAR, http://www.ebi.ac.uk/msd-srv/msdmotif/]
-subset: biosapiens
-synonym: "serine/threonine motif" EXACT []
-synonym: "st motif" EXACT []
-synonym: "st_motif" EXACT []
-is_a: SO:0001078 ! polypeptide_secondary_structure
-
-[Term]
-id: SO:0001127
-name: serine_threonine_staple_motif
-alt_id: BS:00230
-def: "A motif of four or five consecutive residues and one H-bond in which: residue(i) is Serine (S) or Threonine (T), the side-chain OH of residue(i) is H-bonded to the main-chain CO of residue(i3) or (i4), Phi angles of residues(i1), (i2) and (i3) are negative." [EBIBS:GAR, http://www.ebi.ac.uk/msd-srv/msdmotif/]
-subset: biosapiens
-synonym: "serine threonine staple motif" EXACT []
-synonym: "st_staple" EXACT []
-is_a: SO:0001078 ! polypeptide_secondary_structure
-
-[Term]
-id: SO:0001128
-name: polypeptide_turn_motif
-alt_id: BS:00148
-def: "A reversal in the direction of the backbone of a protein that is stabilized by hydrogen bond between backbone NH and CO groups, involving no more than 4 amino acid residues." [EBIBS:GAR, uniprot:feature_type]
-comment: Range.
-subset: biosapiens
-synonym: "turn" RELATED BS []
-is_a: SO:0001078 ! polypeptide_secondary_structure
-
-[Term]
-id: SO:0001129
-name: asx_turn_left_handed_type_one
-alt_id: BS:00206
-def: "Left handed type I (dihedral angles):- Residue(i): -140 degrees < chi (1) -120 degrees < -20 degrees, -90 degrees < psi +120 degrees < +40 degrees. Residue(i+1): -140 degrees < phi < -20 degrees, -90 degrees < psi < +40 degrees." [EBIBS:GAR, http://www.ebi.ac.uk/msd-srv/msdmotif/]
-subset: biosapiens
-synonym: "asx turn left handed type one" EXACT []
-synonym: "asx_turn_il" RELATED []
-is_a: SO:0000912 ! asx_turn
-
-[Term]
-id: SO:0001130
-name: asx_turn_left_handed_type_two
-alt_id: BS:00204
-def: "Left handed type II (dihedral angles):- Residue(i): -140 degrees < chi (1) -120 degrees < -20 degrees, +80 degrees < psi +120 degrees < +180 degrees. Residue(i+1): +20 degrees < phi < +140 degrees, -40 degrees < psi < +90 degrees." [EBIBS:GAR, http://www.ebi.ac.uk/msd-srv/msdmotif/]
-subset: biosapiens
-synonym: "asx turn left handed type two" EXACT []
-synonym: "asx_turn_iil" EXACT []
-is_a: SO:0000912 ! asx_turn
-
-[Term]
-id: SO:0001131
-name: asx_turn_right_handed_type_two
-alt_id: BS:00205
-def: "Right handed type II (dihedral angles):- Residue(i): -140 degrees < chi (1) -120 degrees < -20 degrees, +80 degrees < psi +120 degrees < +180 degrees. Residue(i+1): +20 degrees < phi < +140 degrees, -40 degrees < psi < +90 degrees." [EBIBS:GAR, http://www.ebi.ac.uk/msd-srv/msdmotif/]
-subset: biosapiens
-synonym: "asx turn right handed type two" EXACT []
-synonym: "asx_turn_iir" EXACT []
-is_a: SO:0000912 ! asx_turn
-
-[Term]
-id: SO:0001132
-name: asx_turn_right_handed_type_one
-alt_id: BS:00207
-def: "Right handed type I (dihedral angles):- Residue(i): -140 degrees < chi (1) -120 degrees < -20 degrees, -90 degrees < psi +120 degrees < +40 degrees. Residue(i+1): -140 degrees < phi < -20 degrees, -90 degrees < psi < +40 degrees." [EBIBS:GAR, http://www.ebi.ac.uk/msd-srv/msdmotif/]
-subset: biosapiens
-synonym: "asx turn type right handed type one" EXACT []
-synonym: "asx_turn_ir" EXACT []
-is_a: SO:0000912 ! asx_turn
-
-[Term]
-id: SO:0001133
-name: beta_turn
-alt_id: BS:00212
-def: "A motif of four consecutive residues that may contain one H-bond, which, if present, is between the main-chain CO of the first residue and the main-chain NH of the fourth. It is characterized by the dihedral angles of the second and third residues, which are the basis for sub-categorization." [EBIBS:GAR, http://www.ebi.ac.uk/msd-srv/msdmotif/]
-subset: biosapiens
-synonym: "beta turn" EXACT []
-is_a: SO:0001128 ! polypeptide_turn_motif
-
-[Term]
-id: SO:0001134
-name: beta_turn_left_handed_type_one
-alt_id: BS:00215
-def: "Left handed type I:A motif of four consecutive residues that may contain one H-bond, which, if present, is between the main-chain CO of the first residue and the main-chain NH of the fourth. It is characterized by the dihedral angles:- Residue(i+1): -140 degrees > phi > -20 degrees, -90 degrees > psi > +40 degrees. Residue(i+2): -140 degrees > phi > -20 degrees, -90 degrees > psi > +40 degrees." [EBIBS:GAR, http://www.ebi.ac.uk/msd-srv/msdmotif/]
-subset: biosapiens
-synonym: "beta turn left handed type one" EXACT []
-synonym: "beta_turn_il" EXACT []
-synonym: "type I' beta turn" EXACT []
-synonym: "type I' turn" EXACT []
-is_a: SO:0001133 ! beta_turn
-
-[Term]
-id: SO:0001135
-name: beta_turn_left_handed_type_two
-alt_id: BS:00213
-def: "Left handed type II: A motif of four consecutive residues that may contain one H-bond, which, if present, is between the main-chain CO of the first residue and the main-chain NH of the fourth. It is characterized by the dihedral angles: Residue(i+1): -140 degrees > phi > -20 degrees, +80 degrees > psi > +180 degrees. Residue(i+2): +20 degrees > phi > +140 degrees, -40 degrees > psi > +90 degrees." [EBIBS:GAR, http://www.ebi.ac.uk/msd-srv/msdmotif/]
-subset: biosapiens
-synonym: "beta turn left handed type two" EXACT []
-synonym: "beta_turn_iil" EXACT []
-synonym: "type II' beta turn" EXACT []
-synonym: "type II' turn" EXACT []
-is_a: SO:0001133 ! beta_turn
-
-[Term]
-id: SO:0001136
-name: beta_turn_right_handed_type_one
-alt_id: BS:00216
-def: "Right handed type I:A motif of four consecutive residues that may contain one H-bond, which, if present, is between the main-chain CO of the first residue and the main-chain NH of the fourth. It is characterized by the dihedral angles: Residue(i+1): -140 degrees < phi < -20 degrees, -90 degrees < psi < +40 degrees. Residue(i+2): -140 degrees < phi < -20 degrees, -90 degrees < psi < +40 degrees." [EBIBS:GAR, http://www.ebi.ac.uk/msd-srv/msdmotif/]
-subset: biosapiens
-synonym: "beta turn right handed type one" EXACT []
-synonym: "beta_turn_ir" EXACT []
-synonym: "type I beta turn" EXACT []
-synonym: "type I turn" EXACT []
-is_a: SO:0001133 ! beta_turn
-
-[Term]
-id: SO:0001137
-name: beta_turn_right_handed_type_two
-alt_id: BS:00214
-def: "Right handed type II:A motif of four consecutive residues that may contain one H-bond, which, if present, is between the main-chain CO of the first residue and the main-chain NH of the fourth. It is characterized by the dihedral angles: Residue(i+1): -140 degrees < phi < -20 degrees, +80 degrees < psi < +180 degrees. Residue(i+2): +20 degrees < phi < +140 degrees, -40 degrees < psi < +90 degrees." [EBIBS:GAR, http://www.ebi.ac.uk/msd-srv/msdmotif/]
-subset: biosapiens
-synonym: "beta turn right handed type two" EXACT []
-synonym: "beta_turn_iir" EXACT []
-synonym: "type II beta turn" EXACT []
-synonym: "type II turn" EXACT []
-is_a: SO:0001133 ! beta_turn
-
-[Term]
-id: SO:0001138
-name: gamma_turn
-alt_id: BS:00219
-def: "Gamma turns, defined for 3 residues i,( i+1),( i+2) if a hydrogen bond exists between residues i and i+2 and the phi and psi angles of residue i+1 fall within 40 degrees." [EBIBS:GAR, http://www.ebi.ac.uk/msd-srv/msdmotif/]
-subset: biosapiens
-synonym: "gamma turn" EXACT []
-is_a: SO:0001128 ! polypeptide_turn_motif
-
-[Term]
-id: SO:0001139
-name: gamma_turn_classic
-alt_id: BS:00220
-def: "Gamma turns, defined for 3 residues i, i+1, i+2 if a hydrogen bond exists between residues i and i+2 and the phi and psi angles of residue i+1 fall within 40 degrees: phi(i+1)=75.0 - psi(i+1)=-64.0." [EBIBS:GAR, http://www.ebi.ac.uk/msd-srv/msdmotif/]
-subset: biosapiens
-synonym: "classic gamma turn" EXACT []
-synonym: "gamma turn classic" EXACT []
-is_a: SO:0001138 ! gamma_turn
-
-[Term]
-id: SO:0001140
-name: gamma_turn_inverse
-alt_id: BS:00221
-def: "Gamma turns, defined for 3 residues i, i+1, i+2 if a hydrogen bond exists between residues i and i+2 and the phi and psi angles of residue i+1 fall within 40 degrees: phi(i+1)=-79.0 - psi(i+1)=69.0." [EBIBS:GAR, http://www.ebi.ac.uk/msd-srv/msdmotif/]
-subset: biosapiens
-synonym: "gamma turn inverse" EXACT []
-is_a: SO:0001138 ! gamma_turn
-
-[Term]
-id: SO:0001141
-name: serine_threonine_turn
-alt_id: BS:00231
-def: "A motif of three consecutive residues and one H-bond in which: residue(i) is Serine (S) or Threonine (T), the side-chain O of residue(i) is H-bonded to the main-chain NH of residue(i+2)." [EBIBS:GAR, http://www.ebi.ac.uk/msd-srv/msdmotif/]
-subset: biosapiens
-synonym: "serine/threonine turn" EXACT []
-synonym: "st_turn" EXACT []
-is_a: SO:0001128 ! polypeptide_turn_motif
-
-[Term]
-id: SO:0001142
-name: st_turn_left_handed_type_one
-alt_id: BS:00234
-def: "The peptide twists in an anticlockwise, left handed manner. The dihedral angles for this turn are: Residue(i): -140 degrees < chi(1) -120 degrees < -20 degrees, -90 degrees psi +120 degrees < +40 degrees, residue(i+1): -140 degrees < phi < -20 degrees, -90 < psi < +40 degrees." [EBIBS:GAR, http://www.ebi.ac.uk/msd-srv/msdmotif/]
-subset: biosapiens
-synonym: "st turn left handed type one" EXACT []
-synonym: "st_turn_il" EXACT []
-is_a: SO:0001141 ! serine_threonine_turn
-
-[Term]
-id: SO:0001143
-name: st_turn_left_handed_type_two
-alt_id: BS:00232
-def: "The peptide twists in an anticlockwise, left handed manner. The dihedral angles for this turn are: Residue(i): -140 degrees < chi(1) -120 degrees < -20 degrees, +80 degrees psi +120 degrees < +180 degrees, residue(i+1): +20 degrees < phi < +140 degrees, -40 < psi < +90 degrees." [EBIBS:GAR, http://www.ebi.ac.uk/msd-srv/msdmotif/]
-subset: biosapiens
-synonym: "st turn left handed type two" EXACT []
-synonym: "st_turn_iil" EXACT []
-is_a: SO:0001141 ! serine_threonine_turn
-
-[Term]
-id: SO:0001144
-name: st_turn_right_handed_type_one
-alt_id: BS:00235
-def: "The peptide twists in an clockwise, right handed manner. The dihedral angles for this turn are: Residue(i): -140 degrees < chi(1) -120 degrees < -20 degrees, -90 degrees psi +120 degrees < +40 degrees, residue(i+1): -140 degrees < phi < -20 degrees, -90 < psi < +40 degrees." [EBIBS:GAR, http://www.ebi.ac.uk/msd-srv/msdmotif/]
-subset: biosapiens
-synonym: "st turn right handed type one" EXACT []
-synonym: "st_turn_ir" EXACT []
-is_a: SO:0001141 ! serine_threonine_turn
-
-[Term]
-id: SO:0001145
-name: st_turn_right_handed_type_two
-alt_id: BS:00233
-def: "The peptide twists in an clockwise, right handed manner. The dihedral angles for this turn are: Residue(i): -140 degrees < chi(1) -120 degrees < -20 degrees, +80 degrees psi +120 degrees < +180 degrees, residue(i+1): +20 degrees < phi < +140 degrees, -40 < psi < +90 degrees." [EBIBS:GAR, http://www.ebi.ac.uk/msd-srv/msdmotif/]
-subset: biosapiens
-synonym: "st turn right handed type two" EXACT []
-synonym: "st_turn_iir" EXACT []
-is_a: SO:0001141 ! serine_threonine_turn
-
-[Term]
-id: SO:0001146
-name: polypeptide_variation_site
-alt_id: BS:00336
-def: "A site of sequence variation (alteration). Alternative sequence due to naturally occuring events such as polymorphisms and altermatve splicing or experimental methods such as site directed mutagenesis." [EBIBS:GAR, SO:ke]
-comment: For example, was a substitution natural or mutated as part of an experiment? This term is added to merge the biosapiens term sequence_variations.
-subset: biosapiens
-synonym: "sequence_variations" EXACT []
-is_a: SO:0000839 ! polypeptide_region
-
-[Term]
-id: SO:0001147
-name: natural_variant_site
-alt_id: BS:00071
-def: "Describes the natural sequence variants due to polymorphisms, disease-associated mutations, RNA editing and variations between strains, isolates or cultivars." [EBIBS:GAR, UniProt:curation_manual]
-comment: Discrete.
-subset: biosapiens
-synonym: "natural_variant" BROAD []
-synonym: "sequence variation" BROAD []
-synonym: "variant" BROAD [uniprot:feature_type]
-is_a: SO:0001146 ! polypeptide_variation_site
-
-[Term]
-id: SO:0001148
-name: mutated_variant_site
-alt_id: BS:00036
-def: "Site which has been experimentally altered." [EBIBS:GAR, UniProt:curation_manual]
-comment: Discrete.
-subset: biosapiens
-synonym: "mutagen" EXACT BS [uniprot:feature_type]
-synonym: "mutagenesis" EXACT []
-synonym: "mutated_site" EXACT []
-is_a: SO:0001146 ! polypeptide_variation_site
-
-[Term]
-id: SO:0001149
-name: alternate_sequence_site
-alt_id: BS:00073
-alt_id: SO:0001065
-def: "Description of sequence variants produced by alternative splicing, alternative promoter usage, alternative initiation and ribosomal frameshifting." [EBIBS:GAR, UniProt:curation_manual]
-comment: Discrete.
-subset: biosapiens
-synonym: "alternative_sequence" EXACT []
-synonym: "isoform" NARROW []
-synonym: "sequence variation" NARROW []
-synonym: "var_seq" EXACT [uniprot:feature_type]
-synonym: "varsplic" NARROW []
-is_a: SO:0001146 ! polypeptide_variation_site
-
-[Term]
-id: SO:0001150
-name: beta_turn_type_six
-def: "A motif of four consecutive peptide resides of type VIa or type VIb and where the i+2 residue is cis-proline." [SO:cb]
-subset: biosapiens
-synonym: "beta turn type six" EXACT []
-synonym: "cis-proline loop" EXACT []
-synonym: "type VI beta turn" EXACT []
-synonym: "type VI turn" EXACT []
-is_a: SO:0001133 ! beta_turn
-
-[Term]
-id: SO:0001151
-name: beta_turn_type_six_a
-def: "A motif of four consecutive peptide residues, of which the i+2 residue is proline, and that may contain one H-bond, which, if present, is between the main-chain CO of the first residue and the main-chain NH of the fourth and is characterized by the dihedral angles: Residue(i+1): phi ~ -60 degrees, psi ~ 120 degrees. Residue(i+2): phi ~ -90 degrees, psi ~ 0 degrees." [PMID:2371257, SO:cb]
-subset: biosapiens
-synonym: "beta turn type six a" EXACT []
-synonym: "type VIa beta turn" EXACT []
-synonym: "type VIa turn" EXACT []
-is_a: SO:0001150 ! beta_turn_type_six
-
-[Term]
-id: SO:0001152
-name: beta_turn_type_six_a_one
-subset: biosapiens
-synonym: "beta turn type six a one" EXACT []
-synonym: "type VIa1 beta turn" EXACT []
-synonym: "type VIa1 turn" EXACT []
-is_a: SO:0001151 ! beta_turn_type_six_a
-
-[Term]
-id: SO:0001153
-name: beta_turn_type_six_a_two
-subset: biosapiens
-synonym: "beta turn type six a two" EXACT []
-synonym: "type VIa2 beta turn" EXACT []
-synonym: "type VIa2 turn" EXACT []
-is_a: SO:0001151 ! beta_turn_type_six_a
-
-[Term]
-id: SO:0001154
-name: beta_turn_type_six_b
-def: "A motif of four consecutive peptide residues, of which the i+2 residue is proline, and that may contain one H-bond, which, if present, is between the main-chain CO of the first residue and the main-chain NH of the fourth and is characterized by the dihedral angles: Residue(i+1): phi ~ -120 degrees, psi ~ 120 degrees. Residue(i+2): phi ~ -60 degrees, psi ~ 0 degrees." [PMID:2371257, SO:cb]
-subset: biosapiens
-synonym: "beta turn type six b" EXACT []
-synonym: "type VIb beta turn" EXACT []
-synonym: "type VIb turn" EXACT []
-is_a: SO:0001150 ! beta_turn_type_six
-
-[Term]
-id: SO:0001155
-name: beta_turn_type_eight
-def: "A motif of four consecutive peptide residues that may contain one H-bond, which, if present, is between the main-chain CO of the first residue and the main-chain NH of the fourth and is characterized by the dihedral angles: Residue(i+1): phi ~ -60 degrees, psi ~ -30 degrees. Residue(i+2): phi ~ -120 degrees, psi ~ 120 degrees." [PMID:2371257, SO:cb]
-subset: biosapiens
-synonym: "beta turn type eight" EXACT []
-synonym: "type VIII beta turn" EXACT []
-synonym: "type VIII turn" EXACT []
-is_a: SO:0001133 ! beta_turn
-
-[Term]
-id: SO:0001156
-name: DRE_motif
-def: "A sequence element characteristic of some RNA polymerase II promoters, usually located between -10 and -60 relative to the TSS. Consensus sequence is WATCGATW." [PMID:12537576]
-comment: This consensus sequence was identified computationally using the MEME algorithm within core promoter sequences from -60 to +40, with an E value of 1.7e-183.  Tends to co-occur with Motif 7. Tends to not occur with DPE motif (SO:0000015) or motif 10.
-synonym: "DRE motif" EXACT []
-synonym: "NDM4" EXACT []
-synonym: "WATCGATW_motif" EXACT []
-is_a: SO:0000713 ! DNA_motif
-relationship: part_of SO:0000170 ! RNApol_II_promoter
-
-[Term]
-id: SO:0001157
-name: DMv4_motif
-def: "A sequence element characteristic of some RNA polymerase II promoters, located immediately upstream of some TATA box elements with respect to the TSS (+1). Consensus sequence is YGGTCACACTR. Marked spatial preference within core promoter; tend to occur near the TSS, although not as tightly as INR (SO:0000014)." [PMID:16827941\:12537576]
-synonym: "directional motif v4" EXACT []
-synonym: "DMv4" EXACT []
-synonym: "DMv4 motif" EXACT []
-synonym: "motif 1 element" EXACT []
-synonym: "promoter motif 1" EXACT []
-synonym: "YGGTCACATR" NARROW []
-is_a: SO:0001659 ! promoter_element
-
-[Term]
-id: SO:0001158
-name: E_box_motif
-def: "A sequence element characteristic of some RNA polymerase II promoters, usually located between -60 and +1 relative to the TSS. Consensus sequence is AWCAGCTGWT. Tends to co-occur with DMv2 (SO:0001161). Tends to not occur with DPE motif (SO:0000015)." [PMID:12537576\:16827941]
-synonym: "AWCAGCTGWT" NARROW []
-synonym: "E box motif" EXACT []
-synonym: "generic E box motif" EXACT []
-synonym: "NDM5" RELATED []
-is_a: SO:0000713 ! DNA_motif
-relationship: part_of SO:0000170 ! RNApol_II_promoter
-
-[Term]
-id: SO:0001159
-name: DMv5_motif
-def: "A sequence element characteristic of some RNA polymerase II promoters, usually located between -50 and -10 relative to the TSS. Consensus sequence is KTYRGTATWTTT. Tends to co-occur with DMv4 (SO:0001157) . Tends to not occur with DPE motif (SO:0000015) or MTE (SO:0001162)." [PMID:12537576\:16827941]
-synonym: "directional motif v5" EXACT []
-synonym: "DMv5" EXACT []
-synonym: "DMv5 motif" EXACT []
-synonym: "KTYRGTATWTTT" NARROW []
-synonym: "promoter motif 6" RELATED []
-is_a: SO:0001659 ! promoter_element
-relationship: part_of SO:0000170 ! RNApol_II_promoter
-
-[Term]
-id: SO:0001160
-name: DMv3_motif
-def: "A sequence element characteristic of some RNA polymerase II promoters, usually located between -30 and +15 relative to the TSS. Consensus sequence is KNNCAKCNCTRNY. Tends to co-occur with DMv2 (SO:0001161). Tends to not occur with DPE motif (SO:0000015) or MTE (0001162)." [PMID:12537576\:16827941]
-synonym: "directional motif v3" EXACT []
-synonym: "DMv3" EXACT []
-synonym: "DMv3 motif" EXACT []
-synonym: "KNNCAKCNCTRNY" NARROW []
-synonym: "promoter motif 7" EXACT []
-is_a: SO:0001659 ! promoter_element
-relationship: part_of SO:0000170 ! RNApol_II_promoter
-
-[Term]
-id: SO:0001161
-name: DMv2_motif
-def: "A sequence element characteristic of some RNA polymerase II promoters, usually located between -60 and -45 relative to the TSS. Consensus sequence is MKSYGGCARCGSYSS. Tends to co-occur with DMv3 (SO:0001160). Tends to not occur with DPE motif (SO:0000015) or MTE (SO:0001162)." [PMID:12537576\:16827941]
-synonym: "directional motif v2" EXACT []
-synonym: "DMv2" EXACT []
-synonym: "DMv2 motif" EXACT []
-synonym: "MKSYGGCARCGSYSS" NARROW []
-synonym: "promoter motif 8" EXACT []
-is_a: SO:0001659 ! promoter_element
-relationship: part_of SO:0000170 ! RNApol_II_promoter
-
-[Term]
-id: SO:0001162
-name: MTE
-def: "A sequence element characteristic of some RNA polymerase II promoters, usually located between +20 and +30 relative to the TSS. Consensus sequence is CSARCSSAACGS. Tends to co-occur with INR motif (SO:0000014). Tends to not occur with DPE motif (SO:0000015) or DMv5 (SO:0001159)." [PMID:12537576\:15231738, PMID:16858867]
-synonym: "CSARCSSAACGS" NARROW []
-synonym: "motif ten element" EXACT []
-synonym: "motif_ten_element" EXACT []
-is_a: SO:0001660 ! core_promoter_element
-relationship: part_of SO:0001669 ! RNApol_II_core_promoter
-
-[Term]
-id: SO:0001163
-name: INR1_motif
-def: "A promoter motif with consensus sequence TCATTCG." [PMID:16827941]
-synonym: "directional motif p3" EXACT []
-synonym: "directional promoter motif 3" EXACT []
-synonym: "DMp3" EXACT []
-synonym: "INR1 motif" EXACT []
-is_a: SO:0000713 ! DNA_motif
-relationship: part_of SO:0000170 ! RNApol_II_promoter
-
-[Term]
-id: SO:0001164
-name: DPE1_motif
-def: "A promoter motif with consensus sequence CGGACGT." [PMID:16827941]
-synonym: "directional motif 5" EXACT []
-synonym: "directional promoter motif 5" RELATED []
-synonym: "DMp5" EXACT []
-synonym: "DPE1 motif" EXACT []
-is_a: SO:0001659 ! promoter_element
-relationship: part_of SO:0000170 ! RNApol_II_promoter
-
-[Term]
-id: SO:0001165
-name: DMv1_motif
-def: "A promoter motif with consensus sequence CARCCCT." [PMID:16827941]
-synonym: "directional promoter motif v1" RELATED []
-synonym: "DMv1" RELATED []
-synonym: "DMv1 motif" EXACT []
-is_a: SO:0001659 ! promoter_element
-relationship: part_of SO:0000170 ! RNApol_II_promoter
-
-[Term]
-id: SO:0001166
-name: GAGA_motif
-def: "A non directional promoter motif with consensus sequence GAGAGCG." [PMID:16827941]
-synonym: "GAGA" EXACT []
-synonym: "GAGA motif" EXACT []
-synonym: "NDM1" EXACT []
-is_a: SO:0000713 ! DNA_motif
-relationship: part_of SO:0000170 ! RNApol_II_promoter
-
-[Term]
-id: SO:0001167
-name: NDM2_motif
-def: "A non directional promoter motif with consensus CGMYGYCR." [PMID:16827941]
-synonym: "NDM2" EXACT []
-synonym: "NDM2 motif" EXACT []
-synonym: "non directional promoter motif 2" EXACT []
-is_a: SO:0001659 ! promoter_element
-relationship: part_of SO:0000170 ! RNApol_II_promoter
-
-[Term]
-id: SO:0001168
-name: NDM3_motif
-def: "A non directional promoter motif with consensus sequence GAAAGCT." [PMID:16827941]
-synonym: "NDM3" EXACT []
-synonym: "NDM3 motif" EXACT []
-synonym: "non directional motif 3" EXACT []
-is_a: SO:0001659 ! promoter_element
-relationship: part_of SO:0000170 ! RNApol_II_promoter
-
-[Term]
-id: SO:0001169
-name: ds_RNA_viral_sequence
-def: "A ds_RNA_viral_sequence is a viral_sequence that is the sequence of a virus that exists as double stranded RNA." [SO:ke]
-synonym: "double stranded RNA virus sequence" EXACT []
-synonym: "ds RNA viral sequence" EXACT []
-is_a: SO:0001041 ! viral_sequence
-
-[Term]
-id: SO:0001170
-name: polinton
-def: "A kind of DNA transposon that populates the genomes of protists, fungi, and animals, characterized by a unique set of proteins necessary for their transposition, including a protein-primed DNA polymerase B, retroviral integrase, cysteine protease, and ATPase. Polintons are characterized by 6-bp target site duplications, terminal-inverted repeats that are several hundred nucleotides long, and 5'-AG and TC-3' termini. Polintons exist as autonomous and nonautonomous elements." [PMID:1 [...]
-synonym: "maverick element" RELATED []
-is_a: SO:0000208 ! terminal_inverted_repeat_element
-
-[Term]
-id: SO:0001171
-name: rRNA_21S
-def: "A component of the large ribosomal subunit in mitochondrial rRNA." [RSC:cb]
-synonym: "21S LSU rRNA" EXACT []
-synonym: "21S ribosomal RNA" EXACT []
-synonym: "21S rRNA" EXACT []
-synonym: "rRNA 21S" EXACT []
-is_a: SO:0000651 ! large_subunit_rRNA
-
-[Term]
-id: SO:0001172
-name: tRNA_region
-def: "A region of a tRNA." [RSC:cb]
-synonym: "tRNA region" EXACT []
-is_a: SO:0000834 ! mature_transcript_region
-relationship: part_of SO:0000253 ! tRNA
-
-[Term]
-id: SO:0001173
-name: anticodon_loop
-def: "A sequence of seven nucleotide bases in tRNA which contains the anticodon. It has the sequence 5'-pyrimidine-purine-anticodon-modified purine-any base-3." [ISBN:0716719207]
-synonym: "anti-codon loop" EXACT []
-synonym: "anticodon loop" EXACT []
-is_a: SO:0001172 ! tRNA_region
-
-[Term]
-id: SO:0001174
-name: anticodon
-def: "A sequence of three nucleotide bases in tRNA which recognizes a codon in mRNA." [RSC:cb]
-synonym: "anti-codon" EXACT []
-xref: http://en.wikipedia.org/wiki/Anticodon "wiki"
-is_a: SO:0001172 ! tRNA_region
-relationship: part_of SO:0001173 ! anticodon_loop
-
-[Term]
-id: SO:0001175
-name: CCA_tail
-def: "Base sequence at the 3' end of a tRNA. The 3'-hydroxyl group on the terminal adenosine is the attachment point for the amino acid." [ISBN:0716719207]
-synonym: "CCA sequence" EXACT []
-synonym: "CCA tail" EXACT []
-is_a: SO:0001172 ! tRNA_region
-
-[Term]
-id: SO:0001176
-name: DHU_loop
-def: "Non-base-paired sequence of nucleotide bases in tRNA. It contains several dihydrouracil residues." [ISBN:071671920]
-synonym: "D loop" RELATED []
-synonym: "DHU loop" EXACT []
-is_a: SO:0001172 ! tRNA_region
-
-[Term]
-id: SO:0001177
-name: T_loop
-def: "Non-base-paired sequence of three nucleotide bases in tRNA. It has sequence T-Psi-C." [ISBN:0716719207]
-synonym: "T loop" EXACT []
-synonym: "TpsiC loop" EXACT []
-is_a: SO:0001172 ! tRNA_region
-
-[Term]
-id: SO:0001178
-name: pyrrolysine_tRNA_primary_transcript
-def: "A primary transcript encoding pyrrolysyl tRNA (SO:0000766)." [RSC:cb]
-synonym: "pyrrolysine tRNA primary transcript" EXACT []
-is_a: SO:0000210 ! tRNA_primary_transcript
-
-[Term]
-id: SO:0001179
-name: U3_snoRNA
-def: "U3 snoRNA is a member of the box C/D class of small nucleolar RNAs. The U3 snoRNA secondary structure is characterised by a small 5' domain (with boxes A and A'), and a larger 3' domain (with boxes B, C, C', and D), the two domains being linked by a single-stranded hinge. Boxes B and C form the B/C motif, which appears to be exclusive to U3 snoRNAs, and boxes C' and D form the C'/D motif. The latter is functionally similar to the C/D motifs found in other snoRNAs. The 5' domain and [...]
-comment: The definition is most of the old definition for snoRNA (SO:0000275).
-synonym: "small nucleolar RNA U3" EXACT []
-synonym: "snoRNA U3" EXACT []
-synonym: "U3 small nucleolar RNA" EXACT []
-synonym: "U3 snoRNA" EXACT []
-xref: http://en.wikipedia.org/wiki/Small_nucleolar_RNA_U3 "wiki"
-is_a: SO:0000593 ! C_D_box_snoRNA
-
-[Term]
-id: SO:0001180
-name: AU_rich_element
-def: "A cis-acting element found in the 3' UTR of some mRNA which is rich in AUUUA pentamers. Messenger RNAs bearing multiple AU-rich elements are often unstable." [PMID:7892223]
-synonym: "ARE" RELATED []
-synonym: "AU rich element" EXACT []
-synonym: "AU-rich element" EXACT []
-xref: http://en.wikipedia.org/wiki/AU-rich_element "wiki"
-is_a: SO:0000837 ! UTR_region
-relationship: part_of SO:0000205 ! three_prime_UTR
-
-[Term]
-id: SO:0001181
-name: Bruno_response_element
-def: "A cis-acting element found in the 3' UTR of some mRNA which is bound by the Drosophila Bruno protein and its homologs." [PMID:10893231]
-comment: Not to be confused with BRE_motif (SO:0000016), which binds transcription factor II B.
-synonym: "BRE" RELATED []
-synonym: "Bruno response element" EXACT []
-is_a: SO:0000837 ! UTR_region
-relationship: part_of SO:0000205 ! three_prime_UTR
-
-[Term]
-id: SO:0001182
-name: iron_responsive_element
-def: "A regulatory sequence found in the 5' and 3' UTRs of many mRNAs which encode iron-binding proteins. It has a hairpin structure and is recognized by trans-acting proteins known as iron-regulatory proteins." [PMID:3198610, PMID:8710843]
-synonym: "IRE" EXACT []
-synonym: "iron responsive element" EXACT []
-xref: http://en.wikipedia.org/wiki/Iron_responsive_element "wiki"
-is_a: SO:0000837 ! UTR_region
-relationship: part_of SO:0000203 ! UTR
-
-[Term]
-id: SO:0001183
-name: morpholino_backbone
-def: "An attribute describing a sequence composed of nucleobases bound to a morpholino backbone. A morpholino backbone consists of morpholine (CHEBI:34856) rings connected by phosphorodiamidate linkages." [RSC:cb]
-comment: Do not use this for feature annotation. Use morpholino_oligo (SO:0000034) instead.
-xref: http://en.wikipedia.org/wiki/Morpholino "wiki"
-is_a: SO:0000348 ! nucleic_acid
-
-[Term]
-id: SO:0001184
-name: PNA
-def: "An attribute describing a sequence composed of peptide nucleic acid (CHEBI:48021), a chemical consisting of nucleobases bound to a backbone composed of repeating N-(2-aminoethyl)-glycine units linked by peptide bonds. The purine and pyrimidine bases are linked to the backbone by methylene carbonyl bonds." [RSC:cb]
-comment: Do not use this term for feature annotation. Use PNA_oligo (SO:0001011) instead.
-synonym: "peptide nucleic acid" RELATED []
-is_a: SO:0000348 ! nucleic_acid
-
-[Term]
-id: SO:0001185
-name: enzymatic
-def: "An attribute describing the sequence of a transcript that has catalytic activity with or without an associated ribonucleoprotein." [RSC:cb]
-comment: Do not use this for feature annotation. Use enzymatic_RNA (SO:0000372) instead.
-is_a: SO:0000733 ! feature_attribute
-
-[Term]
-id: SO:0001186
-name: ribozymic
-def: "An attribute describing the sequence of a transcript that has catalytic activity even without an associated ribonucleoprotein." [RSC:cb]
-comment: Do not use this for feature annotation. Use ribozyme (SO:0000374) instead.
-is_a: SO:0001185 ! enzymatic
-
-[Term]
-id: SO:0001187
-name: pseudouridylation_guide_snoRNA
-def: "A snoRNA that specifies the site of pseudouridylation in an RNA molecule by base pairing with a short sequence around the target residue." [GOC:mah, PMID:12457565]
-comment: Has RNA pseudouridylation guide activity (GO:0030558).
-synonym: "pseudouridylation guide snoRNA" EXACT []
-is_a: SO:0000594 ! H_ACA_box_snoRNA
-
-[Term]
-id: SO:0001188
-name: LNA
-def: "An attribute describing a sequence consisting of nucleobases attached to a repeating unit made of 'locked' deoxyribose rings connected to a phosphate backbone. The deoxyribose unit's conformation is 'locked' by a 2'-C,4'-C-oxymethylene link." [CHEBI:48010]
-comment: Do not use this term for feature annotation. Use LNA_oligo (SO:0001189) instead.
-is_a: SO:0000348 ! nucleic_acid
-
-[Term]
-id: SO:0001189
-name: LNA_oligo
-def: "An oligo composed of LNA residues." [RSC:cb]
-synonym: "LNA oligo" EXACT []
-synonym: "locked nucleic acid" EXACT []
-xref: http://en.wikipedia.org/wiki/Locked_nucleic_acid "wiki"
-is_a: SO:0001247 ! implied link automatically realized ! synthetic_oligo
-intersection_of: SO:0001247 ! synthetic_oligo
-intersection_of: has_quality SO:0001188 ! LNA
-
-[Term]
-id: SO:0001190
-name: TNA
-def: "An attribute describing a sequence consisting of nucleobases attached to a repeating unit made of threose rings connected to a phosphate backbone." [CHEBI:48019]
-comment: Do not use this term for feature annotation. Use TNA_oligo (SO:0001191) instead.
-is_a: SO:0000348 ! nucleic_acid
-
-[Term]
-id: SO:0001191
-name: TNA_oligo
-def: "An oligo composed of TNA residues." [RSC:cb]
-synonym: "threose nucleic acid" EXACT []
-synonym: "TNA oligo" EXACT []
-xref: http://en.wikipedia.org/wiki/Threose_nucleic_acid "wiki"
-is_a: SO:0001247 ! implied link automatically realized ! synthetic_oligo
-intersection_of: SO:0001247 ! synthetic_oligo
-intersection_of: has_quality SO:0001190 ! TNA
-
-[Term]
-id: SO:0001192
-name: GNA
-def: "An attribute describing a sequence consisting of nucleobases attached to a repeating unit made of an acyclic three-carbon propylene glycol connected to a phosphate backbone. It has two enantiomeric forms, (R)-GNA and (S)-GNA." [CHEBI:48015]
-comment: Do not use this term for feature annotation. Use GNA_oligo (SO:0001192) instead.
-is_a: SO:0000348 ! nucleic_acid
-
-[Term]
-id: SO:0001193
-name: GNA_oligo
-def: "An oligo composed of GNA residues." [RSC:cb]
-synonym: "glycerol nucleic acid" EXACT []
-synonym: "glycol nucleic acid" EXACT []
-synonym: "GNA oligo" EXACT []
-xref: http://en.wikipedia.org/wiki/Glycerol_nucleic_acid "wiki"
-is_a: SO:0001247 ! implied link automatically realized ! synthetic_oligo
-intersection_of: SO:0001247 ! synthetic_oligo
-intersection_of: has_quality SO:0001192 ! GNA
-
-[Term]
-id: SO:0001194
-name: R_GNA
-def: "An attribute describing a GNA sequence in the (R)-GNA enantiomer." [CHEBI:48016]
-comment: Do not use this term for feature annotation. Use R_GNA_oligo (SO:0001195) instead.
-synonym: "R GNA" EXACT []
-is_a: SO:0001192 ! GNA
-
-[Term]
-id: SO:0001195
-name: R_GNA_oligo
-def: "An oligo composed of (R)-GNA residues." [RSC:cb]
-synonym: "(R)-glycerol nucleic acid" EXACT []
-synonym: "(R)-glycol nucleic acid" EXACT []
-synonym: "R GNA oligo" EXACT []
-is_a: SO:0001193 ! implied link automatically realized ! GNA_oligo
-intersection_of: SO:0001193 ! GNA_oligo
-intersection_of: has_quality SO:0001194 ! R_GNA
-
-[Term]
-id: SO:0001196
-name: S_GNA
-def: "An attribute describing a GNA sequence in the (S)-GNA enantiomer." [CHEBI:48017]
-comment: Do not use this term for feature annotation. Use S_GNA_oligo (SO:0001197) instead.
-synonym: "S GNA" EXACT []
-is_a: SO:0001192 ! GNA
-
-[Term]
-id: SO:0001197
-name: S_GNA_oligo
-def: "An oligo composed of (S)-GNA residues." [RSC:cb]
-synonym: "(S)-glycerol nucleic acid" EXACT []
-synonym: "(S)-glycol nucleic acid" EXACT []
-synonym: "S GNA oligo" EXACT []
-is_a: SO:0001193 ! implied link automatically realized ! GNA_oligo
-intersection_of: SO:0001193 ! GNA_oligo
-intersection_of: has_quality SO:0001196 ! S_GNA
-
-[Term]
-id: SO:0001198
-name: ds_DNA_viral_sequence
-def: "A ds_DNA_viral_sequence is a viral_sequence that is the sequence of a virus that exists as double stranded DNA." [SO:ke]
-synonym: "double stranded DNA virus" EXACT []
-synonym: "ds DNA viral sequence" EXACT []
-is_a: SO:0001041 ! viral_sequence
-
-[Term]
-id: SO:0001199
-name: ss_RNA_viral_sequence
-def: "A ss_RNA_viral_sequence is a viral_sequence that is the sequence of a virus that exists as single stranded RNA." [SO:ke]
-synonym: "single strand RNA virus" EXACT []
-synonym: "ss RNA viral sequence" EXACT []
-is_a: SO:0001041 ! viral_sequence
-
-[Term]
-id: SO:0001200
-name: negative_sense_ssRNA_viral_sequence
-def: "A negative_sense_RNA_viral_sequence is a ss_RNA_viral_sequence that is the sequence of a single stranded RNA virus that is complementary to mRNA and must be converted to positive sense RNA by RNA polymerase before translation." [SO:ke]
-synonym: "negative sense single stranded RNA virus" RELATED []
-synonym: "negative sense ssRNA viral sequence" EXACT []
-is_a: SO:0001199 ! ss_RNA_viral_sequence
-
-[Term]
-id: SO:0001201
-name: positive_sense_ssRNA_viral_sequence
-def: "A positive_sense_RNA_viral_sequence is a ss_RNA_viral_sequence that is the sequence of a single stranded RNA virus that can be immediately translated by the host." [SO:ke]
-synonym: "positive sense single stranded RNA virus" RELATED []
-synonym: "positive sense ssRNA viral sequence" EXACT []
-is_a: SO:0001199 ! ss_RNA_viral_sequence
-
-[Term]
-id: SO:0001202
-name: ambisense_ssRNA_viral_sequence
-def: "A ambisense_RNA_virus is a ss_RNA_viral_sequence that is the sequence of a single stranded RNA virus with both messenger and anti messenger polarity." [SO:ke]
-synonym: "ambisense single stranded RNA virus" EXACT []
-synonym: "ambisense ssRNA viral sequence" EXACT []
-is_a: SO:0001199 ! ss_RNA_viral_sequence
-
-[Term]
-id: SO:0001203
-name: RNA_polymerase_promoter
-def: "A region (DNA) to which RNA polymerase binds, to begin transcription." [xenbase:jb]
-synonym: "RNA polymerase promoter" EXACT []
-is_a: SO:0000167 ! promoter
-
-[Term]
-id: SO:0001204
-name: Phage_RNA_Polymerase_Promoter
-def: "A region (DNA) to which Bacteriophage RNA polymerase binds, to begin transcription." [xenbase:jb]
-synonym: "Phage RNA Polymerase Promoter" EXACT []
-is_a: SO:0001203 ! RNA_polymerase_promoter
-
-[Term]
-id: SO:0001205
-name: SP6_RNA_Polymerase_Promoter
-def: "A region (DNA) to which the SP6 RNA polymerase binds, to begin transcription." [xenbase:jb]
-synonym: "SP6 RNA Polymerase Promoter" EXACT []
-is_a: SO:0001204 ! Phage_RNA_Polymerase_Promoter
-
-[Term]
-id: SO:0001206
-name: T3_RNA_Polymerase_Promoter
-def: "A DNA sequence to which the T3 RNA polymerase binds, to begin transcription." [xenbase:jb]
-synonym: "T3 RNA Polymerase Promoter" EXACT []
-is_a: SO:0001204 ! Phage_RNA_Polymerase_Promoter
-
-[Term]
-id: SO:0001207
-name: T7_RNA_Polymerase_Promoter
-def: "A region (DNA) to which the T7 RNA polymerase binds, to begin transcription." [xenbase:jb]
-synonym: "T7 RNA Polymerase Promoter" EXACT []
-is_a: SO:0001204 ! Phage_RNA_Polymerase_Promoter
-
-[Term]
-id: SO:0001208
-name: five_prime_EST
-def: "An EST read from the 5' end of a transcript that usually codes for a protein. These regions tend to be conserved across species and do not change much within a gene family." [http://www.ncbi.nlm.nih.gov/About/primer/est.html]
-synonym: "5' EST" EXACT []
-synonym: "five prime EST" EXACT []
-is_a: SO:0000345 ! EST
-
-[Term]
-id: SO:0001209
-name: three_prime_EST
-def: "An EST read from the 3' end of a transcript. They are more likely to fall within non-coding, or untranslated regions(UTRs)." [http://www.ncbi.nlm.nih.gov/About/primer/est.html]
-synonym: "3' EST" EXACT []
-synonym: "three prime EST" EXACT []
-is_a: SO:0000345 ! EST
-
-[Term]
-id: SO:0001210
-name: translational_frameshift
-def: "The region of mRNA (not divisible by 3 bases) that is skipped during the process of translational frameshifting (GO:0006452), causing the reading frame to be different." [SO:ke]
-synonym: "ribosomal frameshift" EXACT []
-synonym: "translational frameshift" EXACT []
-xref: http://en.wikipedia.org/wiki/Translational_frameshift "wiki"
-is_a: SO:0000836 ! mRNA_region
-
-[Term]
-id: SO:0001211
-name: plus_1_translational_frameshift
-def: "The region of mRNA 1 base long that is skipped during the process of translational frameshifting (GO:0006452), causing the reading frame to be different." [SO:ke]
-synonym: "plus 1 ribosomal frameshift" EXACT []
-synonym: "plus 1 translational frameshift" EXACT []
-is_a: SO:0001210 ! translational_frameshift
-
-[Term]
-id: SO:0001212
-name: plus_2_translational_frameshift
-def: "The region of mRNA 2 bases long that is skipped during the process of translational frameshifting (GO:0006452), causing the reading frame to be different." [SO:ke]
-synonym: "plus 2 ribosomal frameshift" EXACT []
-synonym: "plus 2 translational frameshift" EXACT []
-is_a: SO:0001210 ! translational_frameshift
-
-[Term]
-id: SO:0001213
-name: group_III_intron
-def: "Group III introns are introns found in the mRNA of the plastids of euglenoid protists. They are spliced by a two step transesterification with bulged adenosine as initiating nucleophile." [PMID:11377794]
-comment: GO:0000374.
-synonym: "group III intron" EXACT []
-xref: http://en.wikipedia.org/wiki/Group_III_intron "wiki"
-is_a: SO:0000588 ! autocatalytically_spliced_intron
-
-[Term]
-id: SO:0001214
-name: noncoding_region_of_exon
-def: "The maximal intersection of exon and UTR." [SO:ke]
-comment: An exon either containing but not starting with a start codon or containing but not ending with a stop codon will be partially coding and partially non coding.
-subset: SOFA
-synonym: "noncoding region of exon" EXACT []
-is_a: SO:0000852 ! exon_region
-
-[Term]
-id: SO:0001215
-name: coding_region_of_exon
-def: "The region of an exon that encodes for protein sequence." [SO:ke]
-comment: An exon containing either a start or stop codon will be partially coding and partially non coding.
-subset: SOFA
-synonym: "coding region of exon" EXACT []
-is_a: SO:0000852 ! exon_region
-
-[Term]
-id: SO:0001216
-name: endonuclease_spliced_intron
-def: "An intron that spliced via endonucleolytic cleavage and ligation rather than transesterification." [SO:ke]
-synonym: "endonuclease spliced intron" EXACT []
-is_a: SO:0000188 ! intron
-
-[Term]
-id: SO:0001217
-name: protein_coding_gene
-synonym: "protein coding gene" EXACT []
-is_a: SO:0000704 ! implied link automatically realized ! gene
-intersection_of: SO:0000704 ! gene
-intersection_of: has_quality SO:0000010 ! protein_coding
-
-[Term]
-id: SO:0001218
-name: transgenic_insertion
-def: "An insertion that derives from another organism, via the use of recombinant DNA technology." [SO:bm]
-synonym: "transgenic insertion" EXACT []
-is_a: SO:0000667 ! implied link automatically realized ! insertion
-intersection_of: SO:0000667 ! insertion
-intersection_of: has_quality SO:0000781 ! transgenic
-
-[Term]
-id: SO:0001219
-name: retrogene
-is_a: SO:0000704 ! implied link automatically realized ! gene
-intersection_of: SO:0000704 ! gene
-intersection_of: has_quality SO:0000569 ! retrotransposed
-
-[Term]
-id: SO:0001220
-name: silenced_by_RNA_interference
-def: "An attribute describing an epigenetic process where a gene is inactivated by RNA interference." [RSC:cb]
-comment: RNA interference is GO:0016246.
-synonym: "silenced by RNA interference" EXACT []
-is_a: SO:0000893 ! silenced
-
-[Term]
-id: SO:0001221
-name: silenced_by_histone_modification
-def: "An attribute describing an epigenetic process where a gene is inactivated by histone modification." [RSC:cb]
-comment: Histone modification is GO:0016570.
-synonym: "silenced by histone modification" EXACT []
-is_a: SO:0000893 ! silenced
-
-[Term]
-id: SO:0001222
-name: silenced_by_histone_methylation
-def: "An attribute describing an epigenetic process where a gene is inactivated by histone methylation." [RSC:cb]
-comment: Histone methylation is GO:0016571.
-synonym: "silenced by histone methylation" EXACT []
-is_a: SO:0001221 ! silenced_by_histone_modification
-
-[Term]
-id: SO:0001223
-name: silenced_by_histone_deacetylation
-def: "An attribute describing an epigenetic process where a gene is inactivated by histone deacetylation." [RSC:cb]
-comment: Histone deacetylation is GO:0016573.
-synonym: "silenced by histone deacetylation" EXACT []
-is_a: SO:0001221 ! silenced_by_histone_modification
-
-[Term]
-id: SO:0001224
-name: gene_silenced_by_RNA_interference
-def: "A gene that is silenced by RNA interference." [SO:xp]
-synonym: "gene silenced by RNA interference" EXACT []
-synonym: "RNA interference silenced gene" EXACT []
-synonym: "RNAi silenced gene" EXACT []
-is_a: SO:0000127 ! implied link automatically realized ! silenced_gene
-intersection_of: SO:0000127 ! silenced_gene
-intersection_of: has_quality SO:0001220 ! silenced_by_RNA_interference
-
-[Term]
-id: SO:0001225
-name: gene_silenced_by_histone_modification
-def: "A gene that is silenced by histone modification." [SO:xp]
-synonym: "gene silenced by histone modification" EXACT []
-is_a: SO:0000127 ! implied link automatically realized ! silenced_gene
-intersection_of: SO:0000127 ! silenced_gene
-intersection_of: has_quality SO:0001221 ! silenced_by_histone_modification
-
-[Term]
-id: SO:0001226
-name: gene_silenced_by_histone_methylation
-def: "A gene that is silenced by histone methylation." [SO:xp]
-synonym: "gene silenced by histone methylation" EXACT []
-is_a: SO:0001225 ! implied link automatically realized ! gene_silenced_by_histone_modification
-intersection_of: SO:0001225 ! gene_silenced_by_histone_modification
-intersection_of: has_quality SO:0001222 ! silenced_by_histone_methylation
-
-[Term]
-id: SO:0001227
-name: gene_silenced_by_histone_deacetylation
-def: "A gene that is silenced by histone deacetylation." [SO:xp]
-synonym: "gene silenced by histone deacetylation" EXACT []
-is_a: SO:0001225 ! implied link automatically realized ! gene_silenced_by_histone_modification
-intersection_of: SO:0001225 ! gene_silenced_by_histone_modification
-intersection_of: has_quality SO:0001223 ! silenced_by_histone_deacetylation
-
-[Term]
-id: SO:0001228
-name: dihydrouridine
-def: "A modified RNA base in which the 5,6-dihydrouracil is bound to the ribose ring." [RSC:cb]
-synonym: "D" EXACT RNAMOD []
-xref: http://en.wikipedia.org/wiki/Dihydrouridine "wiki"
-xref: RNAMOD:051
-is_a: SO:0001277 ! modified_uridine
-
-[Term]
-id: SO:0001229
-name: pseudouridine
-def: "A modified RNA base in which the 5- position of the uracil is bound to the ribose ring instead of the 4- position." [RSC:cb]
-comment: The free molecule is CHEBI:17802.
-synonym: "Y" EXACT RNAMOD []
-xref: http://en.wikipedia.org/wiki/Pseudouridine "wiki"
-xref: RNAMOD:050
-is_a: SO:0001277 ! modified_uridine
-
-[Term]
-id: SO:0001230
-name: inosine
-def: "A modified RNA base in which hypoxanthine is bound to the ribose ring." [http://library.med.utah.edu/RNAmods/, RSC:cb]
-comment: The free molecule is CHEBI:17596.
-synonym: "I" RELATED []
-synonym: "RNAMOD:017" RELATED []
-xref: http://en.wikipedia.org/wiki/Inosine "wiki"
-is_a: SO:0000250 ! modified_RNA_base_feature
-
-[Term]
-id: SO:0001231
-name: seven_methylguanine
-def: "A modified RNA base in which guanine is methylated at the 7- position." [RSC:cb]
-comment: The free molecule is CHEBI:2274.
-synonym: "7-methylguanine" EXACT []
-synonym: "seven methylguanine" EXACT []
-is_a: SO:0000250 ! modified_RNA_base_feature
-
-[Term]
-id: SO:0001232
-name: ribothymidine
-def: "A modified RNA base in which thymine is bound to the ribose ring." [RSC:cb]
-comment: The free molecule is CHEBI:30832.
-is_a: SO:0000250 ! modified_RNA_base_feature
-
-[Term]
-id: SO:0001233
-name: methylinosine
-def: "A modified RNA base in which methylhypoxanthine is bound to the ribose ring." [RSC:cb]
-is_a: SO:0001274 ! modified_inosine
-
-[Term]
-id: SO:0001234
-name: mobile
-def: "An attribute describing a feature that has either intra-genome or intracellular mobility." [RSC:cb]
-xref: http://en.wikipedia.org/wiki/Mobile "wiki"
-is_a: SO:0000733 ! feature_attribute
-
-[Term]
-id: SO:0001235
-name: replicon
-def: "A region containing at least one unique origin of replication and a unique termination site." [ISBN:0716719207]
-subset: SOFA
-xref: http://en.wikipedia.org/wiki/Replicon_(genetics) "wiki"
-is_a: SO:0001411 ! biological_region
-
-[Term]
-id: SO:0001236
-name: base
-def: "A base is a sequence feature that corresponds to a single unit of a nucleotide polymer." [SO:ke]
-subset: SOFA
-xref: http://en.wikipedia.org/wiki/Nucleobase "wiki"
-is_a: SO:0001411 ! biological_region
-
-[Term]
-id: SO:0001237
-name: amino_acid
-def: "A sequence feature that corresponds to a single amino acid residue in a polypeptide." [RSC:cb]
-comment: Probably in the future this will cross reference to Chebi.
-synonym: "amino acid" EXACT []
-xref: http://en.wikipedia.org/wiki/Amino_acid "wiki"
-is_a: SO:0001411 ! biological_region
-relationship: part_of SO:0000104 ! polypeptide
-
-[Term]
-id: SO:0001238
-name: major_TSS
-synonym: "major transcription start site" EXACT []
-synonym: "major TSS" EXACT []
-is_a: SO:0000315 ! TSS
-
-[Term]
-id: SO:0001239
-name: minor_TSS
-synonym: "minor TSS" EXACT []
-is_a: SO:0000315 ! TSS
-
-[Term]
-id: SO:0001240
-name: TSS_region
-def: "The region of a gene from the 5' most TSS to the 3' TSS." [BBOP:nw]
-synonym: "TSS region" EXACT []
-is_a: SO:0000842 ! gene_component_region
-relationship: has_part SO:0000315 ! TSS
-
-[Term]
-id: SO:0001241
-name: encodes_alternate_transcription_start_sites
-synonym: "encodes alternate transcription start sites" EXACT []
-is_a: SO:0000401 ! gene_attribute
-
-[Term]
-id: SO:0001243
-name: miRNA_primary_transcript_region
-def: "A part of an miRNA primary_transcript." [SO:ke]
-synonym: "miRNA primary transcript region" EXACT []
-is_a: SO:0000835 ! primary_transcript_region
-
-[Term]
-id: SO:0001244
-name: pre_miRNA
-def: "The 60-70 nucleotide region remain after Drosha processing of the primary transcript, that folds back upon itself to form a hairpin sructure." [SO:ke]
-synonym: "pre-miRNA" EXACT []
-is_a: SO:0001243 ! miRNA_primary_transcript_region
-relationship: part_of SO:0000647 ! miRNA_primary_transcript
-
-[Term]
-id: SO:0001245
-name: miRNA_stem
-def: "The stem of the hairpin loop formed by folding of the pre-miRNA." [SO:ke]
-synonym: "miRNA stem" EXACT []
-is_a: SO:0001243 ! miRNA_primary_transcript_region
-relationship: part_of SO:0001244 ! pre_miRNA
-
-[Term]
-id: SO:0001246
-name: miRNA_loop
-def: "The loop of the hairpin loop formed by folding of the pre-miRNA." [SO:ke]
-synonym: "miRNA loop" EXACT []
-is_a: SO:0001243 ! miRNA_primary_transcript_region
-relationship: part_of SO:0001244 ! pre_miRNA
-
-[Term]
-id: SO:0001247
-name: synthetic_oligo
-def: "An oligo composed of synthetic nucleotides." [SO:ke]
-synonym: "synthetic oligo" EXACT []
-is_a: SO:0000696 ! oligo
-
-[Term]
-id: SO:0001248
-name: assembly
-def: "A region of the genome of known length that is composed by ordering and aligning two or more different regions." [SO:ke]
-subset: SOFA
-xref: http://en.wikipedia.org/wiki/Genome_assembly#Genome_assembly "wiki"
-is_a: SO:0001410 ! experimental_feature
-
-[Term]
-id: SO:0001249
-name: fragment_assembly
-def: "A fragment assembly is a genome assembly that orders overlapping fragments of the genome based on landmark sequences. The base pair distance between the landmarks is known allowing additivity of lengths." [SO:ke]
-synonym: "fragment assembly" EXACT []
-synonym: "physical map" EXACT []
-is_a: SO:0001248 ! assembly
-
-[Term]
-id: SO:0001250
-name: fingerprint_map
-def: "A fingerprint_map is a physical map composed of restriction fragments." [SO:ke]
-synonym: "BACmap" EXACT []
-synonym: "fingerprint map" EXACT []
-synonym: "FPC" EXACT []
-synonym: "FPCmap" EXACT []
-synonym: "restriction map" EXACT []
-is_a: SO:0001249 ! fragment_assembly
-relationship: has_part SO:0000412 ! restriction_fragment
-
-[Term]
-id: SO:0001251
-name: STS_map
-def: "An STS map is a physical map organized by the unique STS landmarks." [SO:ke]
-synonym: "STS map" EXACT []
-is_a: SO:0001249 ! fragment_assembly
-relationship: has_part SO:0000331 ! STS
-
-[Term]
-id: SO:0001252
-name: RH_map
-def: "A radiation hybrid map is a physical map." [SO:ke]
-synonym: "radiation hybrid map" EXACT []
-synonym: "RH map" EXACT []
-is_a: SO:0001249 ! fragment_assembly
-relationship: has_part SO:0000331 ! STS
-
-[Term]
-id: SO:0001253
-name: sonicate_fragment
-def: "A DNA fragment generated by sonication. Sonication is a technique used to sheer DNA into smaller fragments." [SO:ke]
-synonym: "sonicate fragment" EXACT []
-is_a: SO:0000143 ! assembly_component
-
-[Term]
-id: SO:0001254
-name: polyploid
-def: "A kind of chromosome variation where the chromosome complement is an exact multiple of the haploid number and is greater than the diploid number." [SO:ke]
-xref: http://en.wikipedia.org/wiki/Polyploid "wiki"
-is_a: SO:1000182 ! chromosome_number_variation
-
-[Term]
-id: SO:0001255
-name: autopolyploid
-def: "A polyploid where the multiple chromosome set was derived from the same organism." [SO:ke]
-xref: http://en.wikipedia.org/wiki/Autopolyploid "wiki"
-is_a: SO:0001254 ! polyploid
-
-[Term]
-id: SO:0001256
-name: allopolyploid
-def: "A polyploid where the multiple chromosome set was derived from a different organism." [SO:ke]
-xref: http://en.wikipedia.org/wiki/Allopolyploid "wiki"
-is_a: SO:0001254 ! polyploid
-
-[Term]
-id: SO:0001257
-name: homing_endonuclease_binding_site
-def: "The binding site (recognition site) of a homing endonuclease. The binding site is typically large." [SO:ke]
-synonym: "homing endonuclease binding site" EXACT []
-is_a: SO:0000059 ! nuclease_binding_site
-
-[Term]
-id: SO:0001258
-name: octamer_motif
-def: "A sequence element characteristic of some RNA polymerase II promoters with sequence ATTGCAT that binds Pou-domain transcription factors." [GOC:dh, PMID:3095662]
-comment: Nature. 1986 Oct 16-22;323(6089):640-3.
-synonym: "octamer motif" EXACT []
-is_a: SO:0000713 ! DNA_motif
-relationship: part_of SO:0000170 ! RNApol_II_promoter
-
-[Term]
-id: SO:0001259
-name: apicoplast_chromosome
-def: "A chromosome originating in an apicoplast." [SO:xp]
-synonym: "apicoplast chromosome" EXACT []
-is_a: SO:0000340 ! implied link automatically realized ! chromosome
-intersection_of: SO:0000340 ! chromosome
-intersection_of: has_origin SO:0000743 ! apicoplast_sequence
-
-[Term]
-id: SO:0001260
-name: sequence_collection
-def: "A collection of discontinuous sequences." [SO:ke]
-synonym: "sequence collection" EXACT []
-
-[Term]
-id: SO:0001261
-name: overlapping_feature_set
-def: "A continuous region of sequence composed of the overlapping of multiple sequence_features, which ultimately provides evidence for another sequence_feature." [SO:ke]
-comment: This feature was requested by Nicole, tracker id 1911479. It is required to gather evidence together for annotation. An example would be overlapping ESTs that support an mRNA.
-synonym: "overlapping feature set" EXACT []
-is_a: SO:0000703 ! experimental_result_region
-
-[Term]
-id: SO:0001262
-name: overlapping_EST_set
-def: "A continous experimental result region extending the length of multiple overlapping EST's." [SO:ke]
-synonym: "overlapping EST set" EXACT []
-is_a: SO:0001261 ! overlapping_feature_set
-relationship: has_part SO:0000345 ! EST
-
-[Term]
-id: SO:0001263
-name: ncRNA_gene
-synonym: "ncRNA gen" EXACT []
-synonym: "ncRNA gene" EXACT []
-synonym: "non-coding RNA gene" RELATED []
-is_a: SO:0000704 ! gene
-
-[Term]
-id: SO:0001264
-name: gRNA_gene
-synonym: "gRNA gene" EXACT []
-is_a: SO:0001263 ! implied link automatically realized ! ncRNA_gene
-intersection_of: SO:0001263 ! ncRNA_gene
-intersection_of: has_quality SO:0000979 ! gRNA_encoding
-
-[Term]
-id: SO:0001265
-name: miRNA_gene
-synonym: "miRNA gene" EXACT []
-is_a: SO:0001263 ! implied link automatically realized ! ncRNA_gene
-intersection_of: SO:0001263 ! ncRNA_gene
-intersection_of: has_quality SO:0000571 ! miRNA_encoding
-
-[Term]
-id: SO:0001266
-name: scRNA_gene
-synonym: "scRNA gene" EXACT []
-is_a: SO:0001263 ! implied link automatically realized ! ncRNA_gene
-intersection_of: SO:0001263 ! ncRNA_gene
-intersection_of: has_quality SO:0000575 ! scRNA_encoding
-
-[Term]
-id: SO:0001267
-name: snoRNA_gene
-synonym: "snoRNA gene" EXACT []
-is_a: SO:0001263 ! implied link automatically realized ! ncRNA_gene
-intersection_of: SO:0001263 ! ncRNA_gene
-intersection_of: has_quality SO:0000578 ! snoRNA_encoding
-
-[Term]
-id: SO:0001268
-name: snRNA_gene
-synonym: "snRNA gene" EXACT []
-is_a: SO:0001263 ! implied link automatically realized ! ncRNA_gene
-intersection_of: SO:0001263 ! ncRNA_gene
-intersection_of: has_quality SO:0001263 ! ncRNA_gene
-
-[Term]
-id: SO:0001269
-name: SRP_RNA_gene
-synonym: "SRP RNA gene" EXACT []
-is_a: SO:0001263 ! implied link automatically realized ! ncRNA_gene
-intersection_of: SO:0001263 ! ncRNA_gene
-intersection_of: has_quality SO:0000642 ! SRP_RNA_encoding
-
-[Term]
-id: SO:0001270
-name: stRNA_gene
-synonym: "stRNA gene" EXACT []
-is_a: SO:0001263 ! implied link automatically realized ! ncRNA_gene
-intersection_of: SO:0001263 ! ncRNA_gene
-intersection_of: has_quality SO:0000656 ! stRNA_encoding
-
-[Term]
-id: SO:0001271
-name: tmRNA_gene
-synonym: "tmRNA gene" EXACT []
-is_a: SO:0001263 ! implied link automatically realized ! ncRNA_gene
-intersection_of: SO:0001263 ! ncRNA_gene
-intersection_of: has_quality SO:0000659 ! tmRNA_encoding
-
-[Term]
-id: SO:0001272
-name: tRNA_gene
-synonym: "tRNA gene" EXACT []
-is_a: SO:0001263 ! implied link automatically realized ! ncRNA_gene
-intersection_of: SO:0001263 ! ncRNA_gene
-intersection_of: has_quality SO:0000663 ! tRNA_encoding
-
-[Term]
-id: SO:0001273
-name: modified_adenosine
-def: "A modified adenine is an adenine base feature that has been altered." [SO:ke]
-synonym: "modified adenosine" EXACT []
-is_a: SO:0000250 ! modified_RNA_base_feature
-
-[Term]
-id: SO:0001274
-name: modified_inosine
-def: "A modified inosine is an inosine base feature that has been altered." [SO:ke]
-synonym: "modified inosine" EXACT []
-is_a: SO:0001230 ! inosine
-
-[Term]
-id: SO:0001275
-name: modified_cytidine
-def: "A modified cytidine is a cytidine base feature which has been altered." [SO:ke]
-synonym: "modified cytidine" EXACT []
-is_a: SO:0000250 ! modified_RNA_base_feature
-
-[Term]
-id: SO:0001276
-name: modified_guanosine
-synonym: "modified guanosine" EXACT []
-is_a: SO:0000250 ! modified_RNA_base_feature
-
-[Term]
-id: SO:0001277
-name: modified_uridine
-synonym: "modified uridine" EXACT []
-is_a: SO:0000250 ! modified_RNA_base_feature
-
-[Term]
-id: SO:0001278
-name: one_methylinosine
-def: "1-methylinosine is a modified insosine." [http://library.med.utah.edu/RNAmods/]
-synonym: "1-methylinosine" EXACT []
-synonym: "m1I" EXACT RNAMOD []
-synonym: "one methylinosine" EXACT []
-xref: RNAMOD:018
-is_a: SO:0001274 ! modified_inosine
-
-[Term]
-id: SO:0001279
-name: one_two_prime_O_dimethylinosine
-def: "1,2'-O-dimethylinosine is a modified inosine." [http://library.med.utah.edu/RNAmods/]
-synonym: "1,2'-O-dimethylinosine" EXACT []
-synonym: "m'Im" EXACT RNAMOD []
-synonym: "one two prime O dimethylinosine" EXACT []
-xref: RNAMOD:019
-is_a: SO:0001274 ! modified_inosine
-
-[Term]
-id: SO:0001280
-name: two_prime_O_methylinosine
-def: "2'-O-methylinosine is a modified inosine." [http://library.med.utah.edu/RNAmods/]
-synonym: "2'-O-methylinosine" EXACT []
-synonym: "Im" EXACT RNAMOD []
-synonym: "two prime O methylinosine" EXACT []
-xref: RNAMOD:081
-is_a: SO:0001274 ! modified_inosine
-
-[Term]
-id: SO:0001281
-name: three_methylcytidine
-def: "3-methylcytidine is a modified cytidine." [http://library.med.utah.edu/RNAmods/]
-synonym: "3-methylcytidine" EXACT []
-synonym: "m3C" EXACT RNAMOD []
-synonym: "three methylcytidine" EXACT []
-xref: RNAMOD:020
-is_a: SO:0001275 ! modified_cytidine
-
-[Term]
-id: SO:0001282
-name: five_methylcytidine
-def: "5-methylcytidine is a modified cytidine." [http://library.med.utah.edu/RNAmods/]
-synonym: "5-methylcytidine" EXACT []
-synonym: "five methylcytidine" EXACT []
-synonym: "m5C" EXACT RNAMOD []
-xref: RNAMOD:021
-is_a: SO:0001275 ! modified_cytidine
-
-[Term]
-id: SO:0001283
-name: two_prime_O_methylcytidine
-def: "2'-O-methylcytidine is a modified cytidine." [http://library.med.utah.edu/RNAmods/]
-synonym: "2'-O-methylcytidine" EXACT []
-synonym: "Cm" EXACT RNAMOD []
-synonym: "two prime O methylcytidine" EXACT []
-xref: RNAMOD:022
-is_a: SO:0001275 ! modified_cytidine
-
-[Term]
-id: SO:0001284
-name: two_thiocytidine
-def: "2-thiocytidine is a modified cytidine." [http://library.med.utah.edu/RNAmods/]
-synonym: "2-thiocytidine" EXACT []
-synonym: "s2C" EXACT RNAMOD []
-synonym: "two thiocytidine" EXACT []
-xref: RNAMOD:023
-is_a: SO:0001275 ! modified_cytidine
-
-[Term]
-id: SO:0001285
-name: N4_acetylcytidine
-def: "N4-acetylcytidine is a modified cytidine." [http://library.med.utah.edu/RNAmods/]
-synonym: "ac4C" EXACT RNAMOD []
-synonym: "N4 acetylcytidine" EXACT []
-synonym: "N4-acetylcytidine" EXACT []
-xref: RNAMOD:024
-is_a: SO:0001275 ! modified_cytidine
-
-[Term]
-id: SO:0001286
-name: five_formylcytidine
-def: "5-formylcytidine is a modified cytidine." [http://library.med.utah.edu/RNAmods/]
-synonym: "5-formylcytidine" EXACT []
-synonym: "f5C" EXACT RNAMOD []
-synonym: "five formylcytidine" EXACT []
-xref: RNAMOD:025
-is_a: SO:0001275 ! modified_cytidine
-
-[Term]
-id: SO:0001287
-name: five_two_prime_O_dimethylcytidine
-def: "5,2'-O-dimethylcytidine is a modified cytidine." [http://library.med.utah.edu/RNAmods/]
-synonym: "5,2'-O-dimethylcytidine" EXACT []
-synonym: "five two prime O dimethylcytidine" EXACT []
-synonym: "m5Cm" EXACT RNAMOD []
-xref: RNAMOD:026
-is_a: SO:0001275 ! modified_cytidine
-
-[Term]
-id: SO:0001288
-name: N4_acetyl_2_prime_O_methylcytidine
-def: "N4-acetyl-2'-O-methylcytidine is a modified cytidine." [http://library.med.utah.edu/RNAmods/]
-synonym: "ac4Cm" EXACT RNAMOD []
-synonym: "N4 acetyl 2 prime O methylcytidine" EXACT []
-synonym: "N4-acetyl-2'-O-methylcytidine" EXACT []
-xref: RNAMOD:027
-is_a: SO:0001275 ! modified_cytidine
-
-[Term]
-id: SO:0001289
-name: lysidine
-def: "Lysidine is a modified cytidine." [http://library.med.utah.edu/RNAmods/]
-synonym: "k2C" EXACT RNAMOD []
-xref: http://en.wikipedia.org/wiki/Lysidine "wiki"
-xref: RNAMOD:028
-is_a: SO:0001275 ! modified_cytidine
-
-[Term]
-id: SO:0001290
-name: N4_methylcytidine
-def: "N4-methylcytidine is a modified cytidine." [http://library.med.utah.edu/RNAmods/]
-synonym: "m4C" EXACT RNAMOD []
-synonym: "N4 methylcytidine" EXACT []
-synonym: "N4-methylcytidine" EXACT []
-xref: RNAMOD:082
-is_a: SO:0001275 ! modified_cytidine
-
-[Term]
-id: SO:0001291
-name: N4_2_prime_O_dimethylcytidine
-def: "N4,2'-O-dimethylcytidine is a modified cytidine." [http://library.med.utah.edu/RNAmods/]
-synonym: "m4Cm" EXACT RNAMOD []
-synonym: "N4 2 prime O dimethylcytidine" EXACT []
-synonym: "N4,2'-O-dimethylcytidine" EXACT []
-xref: RNAMOD:083
-is_a: SO:0001275 ! modified_cytidine
-
-[Term]
-id: SO:0001292
-name: five_hydroxymethylcytidine
-def: "5-hydroxymethylcytidine is a modified cytidine." [http://library.med.utah.edu/RNAmods/]
-synonym: "5-hydroxymethylcytidine" EXACT []
-synonym: "five hydroxymethylcytidine" EXACT []
-synonym: "hm5C" EXACT RNAMOD []
-xref: RNAMOD:084
-is_a: SO:0001275 ! modified_cytidine
-
-[Term]
-id: SO:0001293
-name: five_formyl_two_prime_O_methylcytidine
-def: "5-formyl-2'-O-methylcytidine is a modified cytidine." [http://library.med.utah.edu/RNAmods/]
-synonym: "5-formyl-2'-O-methylcytidine" EXACT []
-synonym: "f5Cm" EXACT RNAMOD []
-synonym: "five formyl two prime O methylcytidine" EXACT []
-xref: RNAMOD:095
-is_a: SO:0001275 ! modified_cytidine
-
-[Term]
-id: SO:0001294
-name: N4_N4_2_prime_O_trimethylcytidine
-def: "N4_N4_2_prime_O_trimethylcytidine is a modified cytidine." [http://library.med.utah.edu/RNAmods/]
-synonym: "m42Cm" EXACT RNAMOD []
-synonym: "N4,N4,2'-O-trimethylcytidine" EXACT []
-xref: RNAMOD:107
-is_a: SO:0001275 ! modified_cytidine
-
-[Term]
-id: SO:0001295
-name: one_methyladenosine
-def: "1_methyladenosine is a modified adenosine." [http://library.med.utah.edu/RNAmods/]
-synonym: "1-methyladenosine" EXACT []
-synonym: "m1A" EXACT RNAMOD []
-synonym: "one methyladenosine" EXACT []
-xref: RNAMOD:001
-is_a: SO:0001273 ! modified_adenosine
-
-[Term]
-id: SO:0001296
-name: two_methyladenosine
-def: "2_methyladenosine is a modified adenosine." [http://library.med.utah.edu/RNAmods/]
-synonym: "2-methyladenosine" EXACT []
-synonym: "m2A" EXACT RNAMOD []
-synonym: "two methyladenosine" EXACT []
-xref: RNAMOD:002
-is_a: SO:0001273 ! modified_adenosine
-
-[Term]
-id: SO:0001297
-name: N6_methyladenosine
-def: "N6_methyladenosine is a modified adenosine." [http://library.med.utah.edu/RNAmods/]
-synonym: "m6A" EXACT RNAMOD []
-synonym: "N6 methyladenosine" EXACT []
-synonym: "N6-methyladenosine" EXACT []
-xref: RNAMOD:003
-is_a: SO:0001273 ! modified_adenosine
-
-[Term]
-id: SO:0001298
-name: two_prime_O_methyladenosine
-def: "2prime_O_methyladenosine is a modified adenosine." [http://library.med.utah.edu/RNAmods/]
-synonym: "2'-O-methyladenosine" EXACT []
-synonym: "Am" EXACT RNAMOD []
-synonym: "two prime O methyladenosine" EXACT []
-xref: RNAMOD:004
-is_a: SO:0001273 ! modified_adenosine
-
-[Term]
-id: SO:0001299
-name: two_methylthio_N6_methyladenosine
-def: "2_methylthio_N6_methyladenosine is a modified adenosine." [http://library.med.utah.edu/RNAmods/]
-synonym: "2-methylthio-N6-methyladenosine" EXACT []
-synonym: "ms2m6A" EXACT RNAMOD []
-synonym: "two methylthio N6 methyladenosine" EXACT []
-xref: RNAMOD:005
-is_a: SO:0001273 ! modified_adenosine
-
-[Term]
-id: SO:0001300
-name: N6_isopentenyladenosine
-def: "N6_isopentenyladenosine is a modified adenosine." [http://library.med.utah.edu/RNAmods/]
-synonym: "i6A" EXACT RNAMOD []
-synonym: "N6 isopentenyladenosine" EXACT []
-synonym: "N6-isopentenyladenosine" EXACT []
-xref: RNAMOD:006
-is_a: SO:0001273 ! modified_adenosine
-
-[Term]
-id: SO:0001301
-name: two_methylthio_N6_isopentenyladenosine
-def: "2_methylthio_N6_isopentenyladenosine is a modified adenosine." [http://library.med.utah.edu/RNAmods/]
-synonym: "2-methylthio-N6-isopentenyladenosine" EXACT []
-synonym: "ms2i6A" EXACT RNAMOD []
-synonym: "two methylthio N6 isopentenyladenosine" EXACT []
-xref: RNAMOD:007
-is_a: SO:0001273 ! modified_adenosine
-
-[Term]
-id: SO:0001302
-name: N6_cis_hydroxyisopentenyl_adenosine
-def: "N6_cis_hydroxyisopentenyl_adenosine is a modified adenosine." [http://library.med.utah.edu/RNAmods/]
-synonym: "io6A" EXACT RNAMOD []
-synonym: "N6 cis hydroxyisopentenyl adenosine" EXACT []
-synonym: "N6-(cis-hydroxyisopentenyl)adenosine" EXACT []
-xref: RNAMOD:008
-is_a: SO:0001273 ! modified_adenosine
-
-[Term]
-id: SO:0001303
-name: two_methylthio_N6_cis_hydroxyisopentenyl_adenosine
-def: "2_methylthio_N6_cis_hydroxyisopentenyl_adenosine is a modified adenosine." [http://library.med.utah.edu/RNAmods/]
-synonym: "2-methylthio-N6-(cis-hydroxyisopentenyl) adenosine" EXACT []
-synonym: "ms2io6A" EXACT RNAMOD []
-synonym: "two methylthio N6 cis hydroxyisopentenyl adenosine" EXACT []
-xref: RNAMOD:009
-is_a: SO:0001273 ! modified_adenosine
-
-[Term]
-id: SO:0001304
-name: N6_glycinylcarbamoyladenosine
-def: "N6_glycinylcarbamoyladenosine is a modified adenosine." [http://library.med.utah.edu/RNAmods/]
-synonym: "g6A" EXACT RNAMOD []
-synonym: "N6 glycinylcarbamoyladenosine" EXACT []
-synonym: "N6-glycinylcarbamoyladenosine" EXACT []
-xref: RNAMOD:010
-is_a: SO:0001273 ! modified_adenosine
-
-[Term]
-id: SO:0001305
-name: N6_threonylcarbamoyladenosine
-def: "N6_threonylcarbamoyladenosine is a modified adenosine." [http://library.med.utah.edu/RNAmods/]
-synonym: "N6 threonylcarbamoyladenosine" EXACT []
-synonym: "N6-threonylcarbamoyladenosine" EXACT []
-synonym: "t6A" EXACT RNAMOD []
-xref: RNAMOD:011
-is_a: SO:0001273 ! modified_adenosine
-
-[Term]
-id: SO:0001306
-name: two_methylthio_N6_threonyl_carbamoyladenosine
-def: "2_methylthio_N6_threonyl_carbamoyladenosine is a modified adenosine." [http://library.med.utah.edu/RNAmods/]
-synonym: "2-methylthio-N6-threonyl carbamoyladenosine" EXACT []
-synonym: "ms2t6A" EXACT RNAMOD []
-synonym: "two methylthio N6 threonyl carbamoyladenosine" EXACT []
-xref: RNAMOD:012
-is_a: SO:0001273 ! modified_adenosine
-
-[Term]
-id: SO:0001307
-name: N6_methyl_N6_threonylcarbamoyladenosine
-def: "N6_methyl_N6_threonylcarbamoyladenosine is a modified adenosine." [http://library.med.utah.edu/RNAmods/]
-synonym: "m6t6A" EXACT RNAMOD []
-synonym: "N6 methyl N6 threonylcarbamoyladenosine" EXACT []
-synonym: "N6-methyl-N6-threonylcarbamoyladenosine" EXACT []
-xref: RNAMOD:013
-is_a: SO:0001273 ! modified_adenosine
-
-[Term]
-id: SO:0001308
-name: N6_hydroxynorvalylcarbamoyladenosine
-def: "N6_hydroxynorvalylcarbamoyladenosine is a modified adenosine." [http://library.med.utah.edu/RNAmods/]
-synonym: "hn6A" EXACT RNAMOD []
-synonym: "N6 hydroxynorvalylcarbamoyladenosine" EXACT []
-synonym: "N6-hydroxynorvalylcarbamoyladenosine" EXACT []
-xref: RNAMOD:014
-is_a: SO:0001273 ! modified_adenosine
-
-[Term]
-id: SO:0001309
-name: two_methylthio_N6_hydroxynorvalyl_carbamoyladenosine
-def: "2_methylthio_N6_hydroxynorvalyl_carbamoyladenosine is a modified adenosine." [http://library.med.utah.edu/RNAmods/]
-synonym: "2-methylthio-N6-hydroxynorvalyl carbamoyladenosine" EXACT []
-synonym: "ms2hn6A" EXACT RNAMOD []
-synonym: "two methylthio N6 hydroxynorvalyl carbamoyladenosine" EXACT []
-xref: RNAMOD:015
-is_a: SO:0001273 ! modified_adenosine
-
-[Term]
-id: SO:0001310
-name: two_prime_O_ribosyladenosine_phosphate
-def: "2prime_O_ribosyladenosine_phosphate is a modified adenosine." [http://library.med.utah.edu/RNAmods/]
-synonym: "2'-O-ribosyladenosine (phosphate)" EXACT []
-synonym: "Ar(p)" EXACT RNAMOD []
-synonym: "two prime O ribosyladenosine phosphate" EXACT []
-xref: RNAMOD:016
-is_a: SO:0001273 ! modified_adenosine
-
-[Term]
-id: SO:0001311
-name: N6_N6_dimethyladenosine
-def: "N6_N6_dimethyladenosine is a modified adenosine." [http://library.med.utah.edu/RNAmods/]
-synonym: "m62A" EXACT RNAMOD []
-synonym: "N6,N6-dimethyladenosine" EXACT []
-xref: RNAMOD:080
-is_a: SO:0001273 ! modified_adenosine
-
-[Term]
-id: SO:0001312
-name: N6_2_prime_O_dimethyladenosine
-def: "N6_2prime_O_dimethyladenosine is a modified adenosine." [http://library.med.utah.edu/RNAmods/]
-synonym: "m6Am" EXACT RNAMOD []
-synonym: "N6 2 prime O dimethyladenosine" EXACT []
-synonym: "N6,2'-O-dimethyladenosine" EXACT []
-xref: RNAMOD:088
-is_a: SO:0001273 ! modified_adenosine
-
-[Term]
-id: SO:0001313
-name: N6_N6_2_prime_O_trimethyladenosine
-def: "N6_N6_2prime_O_trimethyladenosine is a modified adenosine." [http://library.med.utah.edu/RNAmods/]
-synonym: "m62Am" EXACT RNAMOD []
-synonym: "N6,N6,2'-O-trimethyladenosine" EXACT []
-xref: RNAMOD:089
-is_a: SO:0001273 ! modified_adenosine
-
-[Term]
-id: SO:0001314
-name: one_two_prime_O_dimethyladenosine
-def: "1,2'-O-dimethyladenosine is a modified adenosine." [http://library.med.utah.edu/RNAmods/]
-synonym: "1,2'-O-dimethyladenosine" EXACT []
-synonym: "m1Am" EXACT RNAMOD []
-synonym: "one two prime O dimethyladenosine" EXACT []
-xref: RNAMOD:097
-is_a: SO:0001273 ! modified_adenosine
-
-[Term]
-id: SO:0001315
-name: N6_acetyladenosine
-def: "N6_acetyladenosine is a modified adenosine." [http://library.med.utah.edu/RNAmods/]
-synonym: "ac6A" EXACT RNAMOD []
-synonym: "N6 acetyladenosine" EXACT []
-synonym: "N6-acetyladenosine" EXACT []
-xref: RNAMOD:102
-is_a: SO:0001273 ! modified_adenosine
-
-[Term]
-id: SO:0001316
-name: seven_deazaguanosine
-def: "7-deazaguanosine is a moddified guanosine." [http://library.med.utah.edu/RNAmods/]
-synonym: "7-deazaguanosine" RELATED []
-synonym: "seven deazaguanosine" EXACT []
-is_a: SO:0001276 ! modified_guanosine
-
-[Term]
-id: SO:0001317
-name: queuosine
-def: "Queuosine is a modified 7-deazoguanosine." [http://library.med.utah.edu/RNAmods/]
-synonym: "Q" EXACT RNAMOD []
-xref: http://en.wikipedia.org/wiki/Queuosine "wiki"
-xref: RNAMOD:043
-is_a: SO:0001316 ! seven_deazaguanosine
-
-[Term]
-id: SO:0001318
-name: epoxyqueuosine
-def: "Epoxyqueuosine is a modified 7-deazoguanosine." [http://library.med.utah.edu/RNAmods/]
-synonym: "eQ" EXACT RNAMOD []
-xref: RNAMOD:044
-is_a: SO:0001316 ! seven_deazaguanosine
-
-[Term]
-id: SO:0001319
-name: galactosyl_queuosine
-def: "Galactosyl_queuosine is a modified 7-deazoguanosine." [http://library.med.utah.edu/RNAmods/]
-synonym: "galactosyl queuosine" EXACT []
-synonym: "galactosyl-queuosine" EXACT []
-synonym: "galQ" EXACT RNAMOD []
-xref: RNAMOD:045
-is_a: SO:0001316 ! seven_deazaguanosine
-
-[Term]
-id: SO:0001320
-name: mannosyl_queuosine
-def: "Mannosyl_queuosine is a modified 7-deazoguanosine." [http://library.med.utah.edu/RNAmods/]
-synonym: "mannosyl queuosine" EXACT []
-synonym: "mannosyl-queuosine" EXACT []
-synonym: "manQ" EXACT RNAMOD []
-xref: RNAMOD:046
-is_a: SO:0001316 ! seven_deazaguanosine
-
-[Term]
-id: SO:0001321
-name: seven_cyano_seven_deazaguanosine
-def: "7_cyano_7_deazaguanosine is a modified 7-deazoguanosine." [http://library.med.utah.edu/RNAmods/]
-synonym: "7-cyano-7-deazaguanosine" EXACT []
-synonym: "preQ0" EXACT RNAMOD []
-synonym: "seven cyano seven deazaguanosine" EXACT []
-xref: RNAMOD:047
-is_a: SO:0001316 ! seven_deazaguanosine
-
-[Term]
-id: SO:0001322
-name: seven_aminomethyl_seven_deazaguanosine
-def: "7_aminomethyl_7_deazaguanosine is a modified 7-deazoguanosine." [http://library.med.utah.edu/RNAmods/]
-synonym: "7-aminomethyl-7-deazaguanosine" EXACT []
-synonym: "preQ1" EXACT RNAMOD []
-synonym: "seven aminomethyl seven deazaguanosine" EXACT []
-xref: RNAMOD:048
-is_a: SO:0001316 ! seven_deazaguanosine
-
-[Term]
-id: SO:0001323
-name: archaeosine
-def: "Archaeosine is a modified 7-deazoguanosine." [http://library.med.utah.edu/RNAmods/]
-synonym: "G+" EXACT RNAMOD []
-xref: RNAMOD:049
-is_a: SO:0001316 ! seven_deazaguanosine
-
-[Term]
-id: SO:0001324
-name: one_methylguanosine
-def: "1_methylguanosine is a modified guanosine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "1-methylguanosine" EXACT []
-synonym: "m1G" EXACT RNAMOD []
-synonym: "one methylguanosine" EXACT []
-xref: RNAMOD:029
-is_a: SO:0001276 ! modified_guanosine
-
-[Term]
-id: SO:0001325
-name: N2_methylguanosine
-def: "N2_methylguanosine is a modified guanosine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "m2G" EXACT RNAMOD []
-synonym: "N2 methylguanosine" EXACT []
-synonym: "N2-methylguanosine" EXACT []
-xref: RNAMOD:030
-is_a: SO:0001276 ! modified_guanosine
-
-[Term]
-id: SO:0001326
-name: seven_methylguanosine
-def: "7_methylguanosine is a modified guanosine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "7-methylguanosine" EXACT []
-synonym: "m7G" EXACT RNAMOD []
-synonym: "seven methylguanosine" EXACT []
-xref: RNAMOD:031
-is_a: SO:0001276 ! modified_guanosine
-
-[Term]
-id: SO:0001327
-name: two_prime_O_methylguanosine
-def: "2prime_O_methylguanosine is a modified guanosine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "2'-O-methylguanosine" EXACT []
-synonym: "Gm" EXACT RNAMOD []
-synonym: "two prime O methylguanosine" EXACT []
-xref: RNAMOD:032
-is_a: SO:0001276 ! modified_guanosine
-
-[Term]
-id: SO:0001328
-name: N2_N2_dimethylguanosine
-def: "N2_N2_dimethylguanosine is a modified guanosine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "m22G" EXACT RNAMOD []
-synonym: "N2,N2-dimethylguanosine" EXACT []
-xref: RNAMOD:033
-is_a: SO:0001276 ! modified_guanosine
-
-[Term]
-id: SO:0001329
-name: N2_2_prime_O_dimethylguanosine
-def: "N2_2prime_O_dimethylguanosine is a modified guanosine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "m2Gm" EXACT RNAMOD []
-synonym: "N2 2 prime O dimethylguanosine" EXACT []
-synonym: "N2,2'-O-dimethylguanosine" EXACT []
-xref: RNAMOD:034
-is_a: SO:0001276 ! modified_guanosine
-
-[Term]
-id: SO:0001330
-name: N2_N2_2_prime_O_trimethylguanosine
-def: "N2_N2_2prime_O_trimethylguanosine is a modified guanosine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "m22Gmv" EXACT RNAMOD []
-synonym: "N2,N2,2'-O-trimethylguanosine" EXACT []
-xref: RNAMOD:035
-is_a: SO:0001276 ! modified_guanosine
-
-[Term]
-id: SO:0001331
-name: two_prime_O_ribosylguanosine_phosphate
-def: "2prime_O_ribosylguanosine_phosphate is a modified guanosine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "2'-O-ribosylguanosine (phosphate)" EXACT []
-synonym: "Gr(p)" EXACT RNAMOD []
-synonym: "two prime O ribosylguanosine phosphate" EXACT []
-xref: RNAMOD:036
-is_a: SO:0001276 ! modified_guanosine
-
-[Term]
-id: SO:0001332
-name: wybutosine
-def: "Wybutosine is a modified guanosine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "yW" EXACT RNAMOD []
-xref: RNAMOD:037
-is_a: SO:0001276 ! modified_guanosine
-
-[Term]
-id: SO:0001333
-name: peroxywybutosine
-def: "Peroxywybutosine is a modified guanosine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "o2yW" EXACT RNAMOD []
-xref: RNAMOD:038
-is_a: SO:0001276 ! modified_guanosine
-
-[Term]
-id: SO:0001334
-name: hydroxywybutosine
-def: "Hydroxywybutosine is a modified guanosine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "OHyW" EXACT RNAMOD []
-xref: RNAMOD:039
-is_a: SO:0001276 ! modified_guanosine
-
-[Term]
-id: SO:0001335
-name: undermodified_hydroxywybutosine
-def: "Undermodified_hydroxywybutosine is a modified guanosine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "OHyW*" EXACT RNAMOD []
-synonym: "undermodified hydroxywybutosine" EXACT []
-xref: RNAMOD:040
-is_a: SO:0001276 ! modified_guanosine
-
-[Term]
-id: SO:0001336
-name: wyosine
-def: "Wyosine is a modified guanosine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "IMG" EXACT RNAMOD []
-xref: RNAMOD:041
-is_a: SO:0001276 ! modified_guanosine
-
-[Term]
-id: SO:0001337
-name: methylwyosine
-def: "Methylwyosine is a modified guanosine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "mimG" EXACT RNAMOD []
-xref: RNAMOD:042
-is_a: SO:0001276 ! modified_guanosine
-
-[Term]
-id: SO:0001338
-name: N2_7_dimethylguanosine
-def: "N2_7_dimethylguanosine is a modified guanosine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "m2,7G" EXACT RNAMOD []
-synonym: "N2 7 dimethylguanosine" EXACT []
-synonym: "N2,7-dimethylguanosine" EXACT []
-xref: RNAMOD:090
-is_a: SO:0001276 ! modified_guanosine
-
-[Term]
-id: SO:0001339
-name: N2_N2_7_trimethylguanosine
-def: "N2_N2_7_trimethylguanosine is a modified guanosine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "m2,2,7G" EXACT RNAMOD []
-synonym: "N2,N2,7-trimethylguanosine" EXACT []
-xref: RNAMOD:091
-is_a: SO:0001276 ! modified_guanosine
-
-[Term]
-id: SO:0001340
-name: one_two_prime_O_dimethylguanosine
-def: "1_2prime_O_dimethylguanosine is a modified guanosine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "1,2'-O-dimethylguanosine" EXACT []
-synonym: "m1Gm" EXACT RNAMOD []
-synonym: "one two prime O dimethylguanosine" EXACT []
-xref: RNAMOD:096
-is_a: SO:0001276 ! modified_guanosine
-
-[Term]
-id: SO:0001341
-name: four_demethylwyosine
-def: "4_demethylwyosine is a modified guanosine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "4-demethylwyosine" EXACT []
-synonym: "four demethylwyosine" EXACT []
-synonym: "imG-14" EXACT RNAMOD []
-xref: RNAMOD:100
-is_a: SO:0001276 ! modified_guanosine
-
-[Term]
-id: SO:0001342
-name: isowyosine
-def: "Isowyosine is a modified guanosine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "imG2" EXACT RNAMOD []
-xref: RNAMOD:101
-is_a: SO:0001276 ! modified_guanosine
-
-[Term]
-id: SO:0001343
-name: N2_7_2prirme_O_trimethylguanosine
-def: "N2_7_2prirme_O_trimethylguanosine is a modified guanosine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "m2,7Gm" EXACT RNAMOD []
-synonym: "N2 7 2prirme O trimethylguanosine" EXACT []
-synonym: "N2,7,2'-O-trimethylguanosine" EXACT []
-xref: RNAMOD:106
-is_a: SO:0001276 ! modified_guanosine
-
-[Term]
-id: SO:0001344
-name: five_methyluridine
-def: "5_methyluridine is a modified uridine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "5-methyluridine" EXACT []
-synonym: "five methyluridine" EXACT []
-synonym: "m5U" EXACT RNAMOD []
-xref: http://en.wikipedia.org/wiki/5-methyluridine "wiki"
-xref: RNAMOD:052
-is_a: SO:0001277 ! modified_uridine
-
-[Term]
-id: SO:0001345
-name: two_prime_O_methyluridine
-def: "2prime_O_methyluridine is a modified uridine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "2'-O-methyluridine" EXACT []
-synonym: "two prime O methyluridine" EXACT []
-synonym: "Um" EXACT RNAMOD []
-xref: RNAMOD:053
-is_a: SO:0001277 ! modified_uridine
-
-[Term]
-id: SO:0001346
-name: five_two_prime_O_dimethyluridine
-def: "5_2_prime_O_dimethyluridine is a modified uridine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "5,2'-O-dimethyluridine" EXACT []
-synonym: "five two prime O dimethyluridine" EXACT []
-synonym: "m5Um" EXACT RNAMOD []
-xref: RNAMOD:054
-is_a: SO:0001277 ! modified_uridine
-
-[Term]
-id: SO:0001347
-name: one_methylpseudouridine
-def: "1_methylpseudouridine is a modified uridine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "1-methylpseudouridine" EXACT []
-synonym: "m1Y" EXACT RNAMOD []
-synonym: "one methylpseudouridine" EXACT []
-xref: RNAMOD:055
-is_a: SO:0001277 ! modified_uridine
-
-[Term]
-id: SO:0001348
-name: two_prime_O_methylpseudouridine
-def: "2prime_O_methylpseudouridine is a modified uridine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "2'-O-methylpseudouridine" EXACT []
-synonym: "two prime O methylpseudouridine" EXACT []
-synonym: "Ym" EXACT RNAMOD []
-xref: RNAMOD:056
-is_a: SO:0001277 ! modified_uridine
-
-[Term]
-id: SO:0001349
-name: two_thiouridine
-def: "2_thiouridine is a modified uridine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "2-thiouridine" EXACT []
-synonym: "s2U" EXACT RNAMOD []
-synonym: "two thiouridine" EXACT []
-xref: RNAMOD:057
-is_a: SO:0001277 ! modified_uridine
-
-[Term]
-id: SO:0001350
-name: four_thiouridine
-def: "4_thiouridine is a modified uridine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "4-thiouridine" EXACT []
-synonym: "four thiouridine" EXACT []
-synonym: "s4U" EXACT RNAMOD []
-xref: RNAMOD:058
-is_a: SO:0001277 ! modified_uridine
-
-[Term]
-id: SO:0001351
-name: five_methyl_2_thiouridine
-def: "5_methyl_2_thiouridine is a modified uridine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "5-methyl-2-thiouridine" EXACT []
-synonym: "five methyl 2 thiouridine" EXACT []
-synonym: "m5s2U" EXACT RNAMOD []
-xref: RNAMOD:059
-is_a: SO:0001277 ! modified_uridine
-
-[Term]
-id: SO:0001352
-name: two_thio_two_prime_O_methyluridine
-def: "2_thio_2prime_O_methyluridine is a modified uridine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "2-thio-2'-O-methyluridine" EXACT []
-synonym: "s2Um" EXACT RNAMOD []
-synonym: "two thio two prime O methyluridine" EXACT []
-xref: RNAMOD:060
-is_a: SO:0001277 ! modified_uridine
-
-[Term]
-id: SO:0001353
-name: three_three_amino_three_carboxypropyl_uridine
-def: "3_3_amino_3_carboxypropyl_uridine is a modified uridine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "3-(3-amino-3-carboxypropyl)uridine" EXACT []
-synonym: "acp3U" EXACT RNAMOD []
-xref: RNAMOD:061
-is_a: SO:0001277 ! modified_uridine
-
-[Term]
-id: SO:0001354
-name: five_hydroxyuridine
-def: "5_hydroxyuridine is a modified uridine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "5-hydroxyuridine" EXACT []
-synonym: "five hydroxyuridine" EXACT []
-synonym: "ho5U" EXACT RNAMOD []
-xref: RNAMOD:060
-is_a: SO:0001277 ! modified_uridine
-
-[Term]
-id: SO:0001355
-name: five_methoxyuridine
-def: "5_methoxyuridine is a modified uridine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "5-methoxyuridine" EXACT []
-synonym: "five methoxyuridine" EXACT []
-synonym: "mo5U" EXACT RNAMOD []
-xref: RNAMOD:063
-is_a: SO:0001277 ! modified_uridine
-
-[Term]
-id: SO:0001356
-name: uridine_five_oxyacetic_acid
-def: "Uridine_5_oxyacetic_acid is a modified uridine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "cmo5U" EXACT RNAMOD []
-synonym: "uridine 5-oxyacetic acid" EXACT []
-synonym: "uridine five oxyacetic acid" EXACT []
-xref: RNAMOD:064
-is_a: SO:0001277 ! modified_uridine
-
-[Term]
-id: SO:0001357
-name: uridine_five_oxyacetic_acid_methyl_ester
-def: "Uridine_5_oxyacetic_acid_methyl_ester is a modified uridine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "mcmo5U" EXACT RNAMOD []
-synonym: "uridine 5-oxyacetic acid methyl ester" EXACT []
-synonym: "uridine five oxyacetic acid methyl ester" EXACT []
-xref: RNAMOD:065
-is_a: SO:0001277 ! modified_uridine
-
-[Term]
-id: SO:0001358
-name: five_carboxyhydroxymethyl_uridine
-def: "5_carboxyhydroxymethyl_uridine is a modified uridine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "5-(carboxyhydroxymethyl)uridine" EXACT []
-synonym: "chm5U" EXACT RNAMOD []
-synonym: "five carboxyhydroxymethyl uridine" EXACT []
-xref: RNAMOD:066
-is_a: SO:0001277 ! modified_uridine
-
-[Term]
-id: SO:0001359
-name: five_carboxyhydroxymethyl_uridine_methyl_ester
-def: "5_carboxyhydroxymethyl_uridine_methyl_ester is a modified uridine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "5-(carboxyhydroxymethyl)uridine methyl ester" EXACT []
-synonym: "five carboxyhydroxymethyl uridine methyl ester" EXACT []
-synonym: "mchm5U" EXACT RNAMOD []
-xref: RNAMOD:067
-is_a: SO:0001277 ! modified_uridine
-
-[Term]
-id: SO:0001360
-name: five_methoxycarbonylmethyluridine
-def: "Five_methoxycarbonylmethyluridine is a modified uridine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "5-methoxycarbonylmethyluridine" EXACT []
-synonym: "five methoxycarbonylmethyluridine" EXACT []
-synonym: "mcm5U" EXACT RNAMOD []
-xref: RNAMOD:068
-is_a: SO:0001277 ! modified_uridine
-
-[Term]
-id: SO:0001361
-name: five_methoxycarbonylmethyl_two_prime_O_methyluridine
-def: "Five_methoxycarbonylmethyl_2_prime_O_methyluridine is a modified uridine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "5-methoxycarbonylmethyl-2'-O-methyluridine" EXACT []
-synonym: "five methoxycarbonylmethyl two prime O methyluridine" EXACT []
-synonym: "mcm5Um" EXACT RNAMOD []
-xref: RNAMOD:069
-is_a: SO:0001277 ! modified_uridine
-
-[Term]
-id: SO:0001362
-name: five_methoxycarbonylmethyl_two_thiouridine
-def: "5_methoxycarbonylmethyl_2_thiouridine is a modified uridine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "5-methoxycarbonylmethyl-2-thiouridine" EXACT []
-synonym: "five methoxycarbonylmethyl two thiouridine" EXACT []
-synonym: "mcm5s2U" EXACT RNAMOD []
-xref: RNAMOD:070
-is_a: SO:0001277 ! modified_uridine
-
-[Term]
-id: SO:0001363
-name: five_aminomethyl_two_thiouridine
-def: "5_aminomethyl_2_thiouridine is a modified uridine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "5-aminomethyl-2-thiouridine" EXACT []
-synonym: "five aminomethyl two thiouridine" EXACT []
-synonym: "nm5s2U" EXACT RNAMOD []
-xref: RNAMOD:071
-is_a: SO:0001277 ! modified_uridine
-
-[Term]
-id: SO:0001364
-name: five_methylaminomethyluridine
-def: "5_methylaminomethyluridine is a modified uridine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "5-methylaminomethyluridine" EXACT []
-synonym: "five methylaminomethyluridine" EXACT []
-synonym: "mnm5U" EXACT RNAMOD []
-xref: RNAMOD:072
-is_a: SO:0001277 ! modified_uridine
-
-[Term]
-id: SO:0001365
-name: five_methylaminomethyl_two_thiouridine
-def: "5_methylaminomethyl_2_thiouridine is a modified uridine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "5-methylaminomethyl-2-thiouridine" EXACT []
-synonym: "five methylaminomethyl two thiouridine" EXACT []
-synonym: "mnm5s2U" EXACT RNAMOD []
-xref: RNAMOD:073
-is_a: SO:0001277 ! modified_uridine
-
-[Term]
-id: SO:0001366
-name: five_methylaminomethyl_two_selenouridine
-def: "5_methylaminomethyl_2_selenouridine is a modified uridine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "5-methylaminomethyl-2-selenouridine" EXACT []
-synonym: "five methylaminomethyl two selenouridine" EXACT []
-synonym: "mnm5se2U" EXACT RNAMOD []
-xref: RNAMOD:074
-is_a: SO:0001277 ! modified_uridine
-
-[Term]
-id: SO:0001367
-name: five_carbamoylmethyluridine
-def: "5_carbamoylmethyluridine is a modified uridine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "5-carbamoylmethyluridine" EXACT []
-synonym: "five carbamoylmethyluridine" EXACT []
-synonym: "ncm5U" EXACT RNAMOD []
-xref: RNAMOD:075
-is_a: SO:0001277 ! modified_uridine
-
-[Term]
-id: SO:0001368
-name: five_carbamoylmethyl_two_prime_O_methyluridine
-def: "5_carbamoylmethyl_2_prime_O_methyluridine is a modified uridine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "5-carbamoylmethyl-2'-O-methyluridine" EXACT []
-synonym: "five carbamoylmethyl two prime O methyluridine" EXACT []
-synonym: "ncm5Um" EXACT RNAMOD []
-xref: RNAMOD:076
-is_a: SO:0001277 ! modified_uridine
-
-[Term]
-id: SO:0001369
-name: five_carboxymethylaminomethyluridine
-def: "5_carboxymethylaminomethyluridine is a modified uridine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "5-carboxymethylaminomethyluridine" EXACT []
-synonym: "cmnm5U" EXACT RNAMOD []
-synonym: "five carboxymethylaminomethyluridine" EXACT []
-xref: RNAMOD:077
-is_a: SO:0001277 ! modified_uridine
-
-[Term]
-id: SO:0001370
-name: five_carboxymethylaminomethyl_two_prime_O_methyluridine
-def: "5_carboxymethylaminomethyl_2_prime_O_methyluridine is a modified uridine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "5-carboxymethylaminomethyl- 2'-O-methyluridine" EXACT []
-synonym: "cmnm5Um" EXACT RNAMOD []
-synonym: "five carboxymethylaminomethyl two prime O methyluridine" EXACT []
-xref: RNAMOD:078
-is_a: SO:0001277 ! modified_uridine
-
-[Term]
-id: SO:0001371
-name: five_carboxymethylaminomethyl_two_thiouridine
-def: "5_carboxymethylaminomethyl_2_thiouridine is a modified uridine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "5-carboxymethylaminomethyl-2-thiouridine" EXACT []
-synonym: "cmnm5s2U" EXACT RNAMOD []
-synonym: "five carboxymethylaminomethyl two thiouridine" EXACT []
-xref: RNAMOD:079
-is_a: SO:0001277 ! modified_uridine
-
-[Term]
-id: SO:0001372
-name: three_methyluridine
-def: "3_methyluridine is a modified uridine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "3-methyluridine" EXACT []
-synonym: "m3U" EXACT RNAMOD []
-synonym: "three methyluridine" EXACT []
-xref: RNAMOD:085
-is_a: SO:0001277 ! modified_uridine
-
-[Term]
-id: SO:0001373
-name: one_methyl_three_three_amino_three_carboxypropyl_pseudouridine
-def: "1_methyl_3_3_amino_3_carboxypropyl_pseudouridine is a modified uridine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "1-methyl-3-(3-amino-3-carboxypropyl) pseudouridine" EXACT []
-synonym: "m1acp3Y" EXACT RNAMOD []
-xref: RNAMOD:086
-is_a: SO:0001277 ! modified_uridine
-
-[Term]
-id: SO:0001374
-name: five_carboxymethyluridine
-def: "5_carboxymethyluridine is a modified uridine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "5-carboxymethyluridine" EXACT []
-synonym: "cm5U" EXACT RNAMOD []
-synonym: "five carboxymethyluridine" EXACT []
-xref: RNAMOD:087
-is_a: SO:0001277 ! modified_uridine
-
-[Term]
-id: SO:0001375
-name: three_two_prime_O_dimethyluridine
-def: "3_2prime_O_dimethyluridine is a modified uridine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "3,2'-O-dimethyluridine" EXACT []
-synonym: "m3Um" EXACT RNAMOD []
-synonym: "three two prime O dimethyluridine" EXACT []
-xref: RNAMOD:092
-is_a: SO:0001277 ! modified_uridine
-
-[Term]
-id: SO:0001376
-name: five_methyldihydrouridine
-def: "5_methyldihydrouridine is a modified uridine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "5-methyldihydrouridine" EXACT []
-synonym: "five methyldihydrouridine" EXACT []
-synonym: "m5D" EXACT RNAMOD []
-xref: RNAMOD:093
-is_a: SO:0001277 ! modified_uridine
-
-[Term]
-id: SO:0001377
-name: three_methylpseudouridine
-def: "3_methylpseudouridine is a modified uridine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "3-methylpseudouridine" EXACT []
-synonym: "m3Y" EXACT RNAMOD []
-synonym: "three methylpseudouridine" EXACT []
-xref: RNAMOD:094
-is_a: SO:0001277 ! modified_uridine
-
-[Term]
-id: SO:0001378
-name: five_taurinomethyluridine
-def: "5_taurinomethyluridine is a modified uridine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "5-taurinomethyluridine" EXACT []
-synonym: "five taurinomethyluridine" EXACT []
-synonym: "tm5U" EXACT RNAMOD []
-xref: RNAMOD:098
-is_a: SO:0001277 ! modified_uridine
-
-[Term]
-id: SO:0001379
-name: five_taurinomethyl_two_thiouridine
-def: "5_taurinomethyl_2_thiouridineis a modified uridine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "5-taurinomethyl-2-thiouridine" EXACT []
-synonym: "five taurinomethyl two thiouridine" EXACT []
-synonym: "tm5s2U" EXACT RNAMOD []
-xref: RNAMOD:099
-is_a: SO:0001277 ! modified_uridine
-
-[Term]
-id: SO:0001380
-name: five_isopentenylaminomethyl_uridine
-def: "5_isopentenylaminomethyl_uridine is a modified uridine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "5-(isopentenylaminomethyl)uridine" EXACT []
-synonym: "five isopentenylaminomethyl uridine" EXACT []
-synonym: "inm5U" EXACT RNAMOD []
-xref: RNAMOD:103
-is_a: SO:0001277 ! modified_uridine
-
-[Term]
-id: SO:0001381
-name: five_isopentenylaminomethyl_two_thiouridine
-def: "5_isopentenylaminomethyl_2_thiouridine is a modified uridine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "5-(isopentenylaminomethyl)- 2-thiouridine" EXACT []
-synonym: "five isopentenylaminomethyl two thiouridine" EXACT []
-synonym: "inm5s2U" EXACT RNAMOD []
-xref: RNAMOD:104
-is_a: SO:0001277 ! modified_uridine
-
-[Term]
-id: SO:0001382
-name: five_isopentenylaminomethyl_two_prime_O_methyluridine
-def: "5_isopentenylaminomethyl_2prime_O_methyluridine is a modified uridine base feature." [http://library.med.utah.edu/RNAmods/]
-synonym: "5-(isopentenylaminomethyl)- 2'-O-methyluridine" EXACT []
-synonym: "five isopentenylaminomethyl two prime O methyluridine" EXACT []
-synonym: "inm5Um" EXACT RNAMOD []
-xref: RNAMOD:105
-is_a: SO:0001277 ! modified_uridine
-
-[Term]
-id: SO:0001383
-name: histone_binding_site
-def: "A binding site that, in the nucleotide molecule, interacts selectively and non-covalently with polypeptide residues of a histone." [SO:ke]
-synonym: "histone binding site" EXACT []
-is_a: SO:0001654 ! nucleotide_to_protein_binding_site
-
-[Term]
-id: SO:0001384
-name: CDS_fragment
-synonym: "CDS fragment" EXACT []
-synonym: "incomplete CDS" EXACT []
-is_a: SO:0000316 ! implied link automatically realized ! CDS
-intersection_of: SO:0000316 ! CDS
-intersection_of: has_quality SO:0000731 ! fragmentary
-
-[Term]
-id: SO:0001385
-name: modified_amino_acid_feature
-def: "A post translationally modified amino acid feature." [SO:ke]
-synonym: "modified amino acid feature" EXACT []
-is_a: SO:0001237 ! amino_acid
-
-[Term]
-id: SO:0001386
-name: modified_glycine
-def: "A post translationally modified glycine amino acid feature." [SO:ke]
-synonym: "ModGly" EXACT AAMOD []
-synonym: "modified glycine" EXACT []
-xref: MOD:00908
-is_a: SO:0001385 ! modified_amino_acid_feature
-
-[Term]
-id: SO:0001387
-name: modified_L_alanine
-def: "A post translationally modified alanine amino acid feature." [SO:ke]
-synonym: "ModAla" EXACT AAMOD []
-synonym: "modified L alanine" EXACT []
-synonym: "modified L-alanine" EXACT []
-xref: MOD:00901
-is_a: SO:0001385 ! modified_amino_acid_feature
-
-[Term]
-id: SO:0001388
-name: modified_L_asparagine
-def: "A post translationally modified asparagine amino acid feature." [SO:ke]
-synonym: "ModAsn" EXACT AAMOD []
-synonym: "modified L asparagine" EXACT []
-synonym: "modified L-asparagine" EXACT []
-xref: MOD:00903
-is_a: SO:0001385 ! modified_amino_acid_feature
-
-[Term]
-id: SO:0001389
-name: modified_L_aspartic_acid
-def: "A post translationally modified aspartic acid amino acid feature." [SO:ke]
-synonym: "ModAsp" EXACT AAMOD []
-synonym: "modified L aspartic acid" EXACT []
-synonym: "modified L-aspartic acid" EXACT []
-xref: MOD:00904
-is_a: SO:0001385 ! modified_amino_acid_feature
-
-[Term]
-id: SO:0001390
-name: modified_L_cysteine
-def: "A post translationally modified cysteine amino acid feature." [SO:ke]
-synonym: "ModCys" EXACT AAMOD []
-synonym: "modified L cysteine" EXACT []
-synonym: "modified L-cysteine" EXACT []
-xref: MOD:00905
-is_a: SO:0001385 ! modified_amino_acid_feature
-
-[Term]
-id: SO:0001391
-name: modified_L_glutamic_acid
-synonym: "ModGlu" EXACT AAMOD []
-synonym: "modified L glutamic acid" EXACT []
-synonym: "modified L-glutamic acid" EXACT []
-xref: MOD:00906
-is_a: SO:0001385 ! modified_amino_acid_feature
-
-[Term]
-id: SO:0001392
-name: modified_L_threonine
-def: "A post translationally modified threonine amino acid feature." [SO:ke]
-synonym: "modified L threonine" EXACT []
-synonym: "modified L-threonine" EXACT []
-synonym: "ModThr" EXACT AAMOD []
-xref: MOD:00917
-is_a: SO:0001385 ! modified_amino_acid_feature
-
-[Term]
-id: SO:0001393
-name: modified_L_tryptophan
-def: "A post translationally modified tryptophan amino acid feature." [SO:ke]
-synonym: "modified L tryptophan" EXACT []
-synonym: "modified L-tryptophan" EXACT []
-synonym: "ModTrp" EXACT AAMOD []
-xref: MOD:00918
-is_a: SO:0001385 ! modified_amino_acid_feature
-
-[Term]
-id: SO:0001394
-name: modified_L_glutamine
-def: "A post translationally modified glutamine amino acid feature." [SO:ke]
-synonym: "ModGln" EXACT []
-synonym: "modified L glutamine" EXACT []
-synonym: "modified L-glutamine" EXACT []
-xref: MOD:00907
-is_a: SO:0001385 ! modified_amino_acid_feature
-
-[Term]
-id: SO:0001395
-name: modified_L_methionine
-def: "A post translationally modified methionine amino acid feature." [SO:ke]
-synonym: "modified L methionine" EXACT []
-synonym: "modified L-methionine" EXACT []
-synonym: "ModMet" EXACT AAMOD []
-xref: MOD:00913
-is_a: SO:0001385 ! modified_amino_acid_feature
-
-[Term]
-id: SO:0001396
-name: modified_L_isoleucine
-def: "A post translationally modified isoleucine amino acid feature." [SO:ke]
-synonym: "modified L isoleucine" EXACT []
-synonym: "modified L-isoleucine" EXACT []
-synonym: "ModIle" EXACT AAMOD []
-xref: MOD:00910
-is_a: SO:0001385 ! modified_amino_acid_feature
-
-[Term]
-id: SO:0001397
-name: modified_L_phenylalanine
-def: "A post translationally modified phenylalanine amino acid feature." [SO:ke]
-synonym: "modified L phenylalanine" EXACT []
-synonym: "modified L-phenylalanine" EXACT []
-synonym: "ModPhe" EXACT AAMOD []
-xref: MOD:00914
-is_a: SO:0001385 ! modified_amino_acid_feature
-
-[Term]
-id: SO:0001398
-name: modified_L_histidine
-def: "A post translationally modified histidie amino acid feature." [SO:ke]
-synonym: "ModHis" EXACT []
-synonym: "modified L histidine" EXACT []
-synonym: "modified L-histidine" EXACT []
-xref: MOD:00909
-is_a: SO:0001385 ! modified_amino_acid_feature
-
-[Term]
-id: SO:0001399
-name: modified_L_serine
-def: "A post translationally modified serine amino acid feature." [SO:ke]
-synonym: "modified L serine" EXACT []
-synonym: "modified L-serine" EXACT []
-synonym: "MosSer" EXACT AAMOD []
-xref: MOD:00916 "http://www.psidev.info/index.php?q=node/104"
-is_a: SO:0001385 ! modified_amino_acid_feature
-
-[Term]
-id: SO:0001400
-name: modified_L_lysine
-def: "A post translationally modified lysine amino acid feature." [SO:ke]
-synonym: "modified L lysine" EXACT []
-synonym: "modified L-lysine" EXACT []
-synonym: "ModLys" EXACT AAMOD []
-xref: MOD:00912
-is_a: SO:0001385 ! modified_amino_acid_feature
-
-[Term]
-id: SO:0001401
-name: modified_L_leucine
-def: "A post translationally modified leucine amino acid feature." [SO:ke]
-synonym: "modified L leucine" EXACT []
-synonym: "modified L-leucine " EXACT []
-synonym: "ModLeu" EXACT AAMOD []
-xref: MOD:00911
-is_a: SO:0001385 ! modified_amino_acid_feature
-
-[Term]
-id: SO:0001402
-name: modified_L_selenocysteine
-def: "A post translationally modified selenocysteine amino acid feature." [SO:ke]
-synonym: "modified L selenocysteine" EXACT []
-synonym: "modified L-selenocysteine" EXACT []
-xref: MOD:01158
-is_a: SO:0001385 ! modified_amino_acid_feature
-
-[Term]
-id: SO:0001403
-name: modified_L_valine
-def: "A post translationally modified valine amino acid feature." [SO:ke]
-synonym: "modified L valine" EXACT []
-synonym: "modified L-valine" EXACT []
-synonym: "ModVal" EXACT AAMOD []
-xref: MOD:00920
-is_a: SO:0001385 ! modified_amino_acid_feature
-
-[Term]
-id: SO:0001404
-name: modified_L_proline
-def: "A post translationally modified proline amino acid feature." [SO:ke]
-synonym: "modified L proline" EXACT []
-synonym: "modified L-proline " EXACT []
-synonym: "ModPro" EXACT AAMOD []
-xref: MOD:00915
-is_a: SO:0001385 ! modified_amino_acid_feature
-
-[Term]
-id: SO:0001405
-name: modified_L_tyrosine
-def: "A post translationally modified tyrosine amino acid feature." [SO:ke]
-synonym: "modified L tyrosine" EXACT []
-synonym: "modified L-tyrosine" EXACT []
-synonym: "ModTry" EXACT AAMOD []
-xref: MOD:00919
-is_a: SO:0001385 ! modified_amino_acid_feature
-
-[Term]
-id: SO:0001406
-name: modified_L_arginine
-def: "A post translationally modified arginine amino acid feature." [SO:ke]
-synonym: "ModArg" EXACT AAMOD []
-synonym: "modified L arginine" EXACT []
-synonym: "modified L-arginine" EXACT []
-xref: MOD:00902
-is_a: SO:0001385 ! modified_amino_acid_feature
-
-[Term]
-id: SO:0001407
-name: peptidyl
-def: "An attribute describing the nature of a proteinaceous polymer, where by the amino acid units are joined by peptide bonds." [SO:ke]
-is_a: SO:0000443 ! polymer_attribute
-
-[Term]
-id: SO:0001408
-name: cleaved_for_gpi_anchor_region
-def: "The C-terminal residues of a polypeptide which are exchanged for a GPI-anchor." [EBI:rh]
-synonym: "cleaved for gpi anchor region" EXACT []
-is_a: SO:0100011 ! cleaved_peptide_region
-
-[Term]
-id: SO:0001409
-name: biomaterial_region
-def: "A region which is intended for use in an experiment." [SO:cb]
-subset: SOFA
-synonym: "biomaterial region" EXACT []
-is_a: SO:0000001 ! region
-
-[Term]
-id: SO:0001410
-name: experimental_feature
-def: "A region which is the result of some arbitrary experimental procedure. The procedure may be carried out with biological material or inside a computer." [SO:cb]
-subset: SOFA
-synonym: "analysis feature" RELATED []
-synonym: "experimental output artefact" EXACT []
-synonym: "experimental_output_artefact" EXACT []
-is_a: SO:0000001 ! region
-
-[Term]
-id: SO:0001411
-name: biological_region
-def: "A region defined by its disposition to be involved in a biological process." [SO:cb]
-subset: SOFA
-synonym: "biological region" EXACT []
-is_a: SO:0000001 ! region
-
-[Term]
-id: SO:0001412
-name: topologically_defined_region
-def: "A region that is defined according to its relations with other regions within the same sequence." [SO:cb]
-subset: SOFA
-synonym: "topologically defined region" EXACT []
-is_a: SO:0000001 ! region
-
-[Term]
-id: SO:0001413
-name: translocation_breakpoint
-def: "The point within a chromosome where a translocation begins or ends." [SO:cb]
-synonym: "translocation breakpoint" EXACT []
-is_a: SO:0001021 ! chromosome_breakpoint
-
-[Term]
-id: SO:0001414
-name: insertion_breakpoint
-def: "The point within a chromosome where a insertion begins or ends." [SO:cb]
-synonym: "insertion breakpoint" EXACT []
-is_a: SO:0001021 ! chromosome_breakpoint
-
-[Term]
-id: SO:0001415
-name: deletion_breakpoint
-def: "The point within a chromosome where a deletion begins or ends." [SO:cb]
-synonym: "deletion breakpoint" EXACT []
-is_a: SO:0001021 ! chromosome_breakpoint
-
-[Term]
-id: SO:0001416
-name: five_prime_flanking_region
-def: "A flanking region located five prime of a specific region." [SO:chado]
-synonym: "5' flanking region" RELATED []
-synonym: "five prime flanking region" EXACT []
-is_a: SO:0000239 ! flanking_region
-
-[Term]
-id: SO:0001417
-name: three_prime_flanking_region
-def: "A flanking region located three prime of a specific region." [SO:chado]
-synonym: "3' flanking region" RELATED []
-synonym: "three prime flanking region" EXACT []
-is_a: SO:0000239 ! flanking_region
-
-[Term]
-id: SO:0001418
-name: transcribed_fragment
-def: "An experimental region, defined by a tiling array experiment to be transcribed at some level." [SO:ke]
-comment: Term requested by the MODencode group.
-synonym: "transcribed fragment" EXACT []
-synonym: "transfrag" RELATED []
-is_a: SO:0001410 ! experimental_feature
-
-[Term]
-id: SO:0001419
-name: cis_splice_site
-def: "Intronic 2 bp region bordering exon. A splice_site that adjacent_to exon and overlaps intron." [SO:cjm, SO:ke]
-subset: SOFA
-synonym: "cis splice site" EXACT []
-is_a: SO:0000162 ! splice_site
-
-[Term]
-id: SO:0001420
-name: trans_splice_site
-def: "Primary transcript region bordering trans-splice junction." [SO:ke]
-subset: SOFA
-synonym: "trans splice site" EXACT []
-is_a: SO:0000162 ! splice_site
-
-[Term]
-id: SO:0001421
-name: splice_junction
-def: "The boundary between an intron and an exon." [SO:ke]
-synonym: "splice boundary" EXACT []
-synonym: "splice junction" EXACT []
-is_a: SO:0000699 ! junction
-
-[Term]
-id: SO:0001422
-name: conformational_switch
-def: "A region of a polypeptide, involved in the transition from one conformational state to another." [SO:ke]
-comment: MM Young, K Kirshenbaum, KA Dill & S Highsmith. Predicting conformational switches in proteins. Protein Science, 1999, 8, 1752-64. K. Kirshenbaum, M.M. Young and S. Highsmith. Predicting Allosteric Switches in Myosins. Protein Science 8(9):1806-1815. 1999.
-synonym: "polypeptide conformational switch" EXACT []
-is_a: SO:0100001 ! biochemical_region_of_peptide
-
-[Term]
-id: SO:0001423
-name: dye_terminator_read
-def: "A read produced by the dye terminator method of sequencing." [SO:ke]
-synonym: "dye terminator read" RELATED []
-is_a: SO:0000150 ! read
-
-[Term]
-id: SO:0001424
-name: pyrosequenced_read
-def: "A read produced by pyrosequencing technology." [SO:ke]
-comment: An example is a read produced by Roche 454 technology.
-synonym: "pyorsequenced read" RELATED []
-is_a: SO:0000150 ! read
-
-[Term]
-id: SO:0001425
-name: ligation_based_read
-def: "A read produced by ligation based sequencing technologies." [SO:ke]
-comment: An example of this kind of read is one produced by ABI SOLiD.
-synonym: "ligation based read" RELATED []
-is_a: SO:0000150 ! read
-
-[Term]
-id: SO:0001426
-name: polymerase_synthesis_read
-def: "A read produced by the polymerase based sequence by synthesis method." [SO:ke]
-comment: An example is a read produced by Illumina technology.
-synonym: "polymerase synthesis read" RELATED []
-is_a: SO:0000150 ! read
-
-[Term]
-id: SO:0001427
-name: cis_regulatory_frameshift_element
-def: "A structural region in an RNA molecule which promotes ribosomal frameshifting of cis coding sequence." [RFAM:jd]
-synonym: "cis regulatory frameshift element" EXACT []
-is_a: SO:0001679 ! transcription_regulatory_region
-
-[Term]
-id: SO:0001428
-name: expressed_sequence_assembly
-def: "A sequence assembly derived from expressed sequences." [SO:ke]
-comment: From tracker [ 2372385 ] expressed_sequence_assembly.
-synonym: "expressed sequence assembly" EXACT []
-is_a: SO:0000353 ! sequence_assembly
-
-[Term]
-id: SO:0001429
-name: DNA_binding_site
-def: "A binding site that, in the molecule, interacts selectively and non-covalently with DNA." [SO:ke]
-synonym: "DNA binding site" EXACT []
-is_a: SO:0001655 ! nucleotide_binding_site
-
-[Term]
-id: SO:0001431
-name: cryptic_gene
-def: "A gene that is not transcribed under normal conditions and is not critical to normal cellular functioning." [SO:ke]
-synonym: "cryptic gene" EXACT []
-is_a: SO:0000704 ! implied link automatically realized ! gene
-intersection_of: SO:0000704 ! gene
-intersection_of: has_quality SO:0000976 ! cryptic
-
-[Term]
-id: SO:0001432
-name: sequence_variant_affecting_polyadenylation
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation affecting polyadenylation" RELATED []
-synonym: "sequence variant affecting polyadenylation" EXACT []
-is_obsolete: true
-replaced_by: SO:0001545
-
-[Term]
-id: SO:0001433
-name: three_prime_RACE_clone
-def: "A three prime RACE (Rapid Amplification of cDNA Ends) clone is a cDNA clone copied from the 3' end of an mRNA (using a poly-dT primer to capture the polyA tail and a gene-specific or randomly primed 5' primer), and spliced into a vector for propagation in a suitable host." [modENCODE:nlw]
-synonym: "3' RACE clone" RELATED []
-is_a: SO:0000317 ! cDNA_clone
-
-[Term]
-id: SO:0001434
-name: cassette_pseudogene
-def: "A cassette pseudogene is a kind of gene in an inactive form which may recombine at a telomeric locus to form a functional copy." [SO:ke]
-comment: Requested by the Trypanosome community.
-synonym: "cassette pseudogene" EXACT []
-synonym: "cassette type psedogene" RELATED []
-is_a: SO:0001760 ! non_processed_pseudogene
-
-[Term]
-id: SO:0001435
-name: alanine
-comment: A place holder for a cross product with chebi.
-synonym: "A" EXACT aa1 []
-synonym: "Ala" EXACT aa3 []
-is_a: SO:0001237 ! amino_acid
-
-[Term]
-id: SO:0001436
-name: valine
-comment: A place holder for a cross product with chebi.
-synonym: "V" EXACT aa1 []
-synonym: "Val" EXACT aa3 []
-is_a: SO:0001237 ! amino_acid
-
-[Term]
-id: SO:0001437
-name: leucine
-comment: A place holder for a cross product with chebi.
-synonym: "L" EXACT aa1 []
-synonym: "Leu" EXACT aa3 []
-is_a: SO:0001237 ! amino_acid
-
-[Term]
-id: SO:0001438
-name: isoleucine
-comment: A place holder for a cross product with chebi.
-synonym: "I" EXACT aa1 []
-synonym: "Ile" EXACT aa3 []
-is_a: SO:0001237 ! amino_acid
-
-[Term]
-id: SO:0001439
-name: proline
-comment: A place holder for a cross product with chebi.
-synonym: "P" EXACT aa1 []
-synonym: "Pro" EXACT aa3 []
-is_a: SO:0001237 ! amino_acid
-
-[Term]
-id: SO:0001440
-name: tryptophan
-comment: A place holder for a cross product with chebi.
-synonym: "Trp" EXACT aa3 []
-synonym: "W" EXACT aa1 []
-is_a: SO:0001237 ! amino_acid
-
-[Term]
-id: SO:0001441
-name: phenylalanine
-comment: A place holder for a cross product with chebi.
-synonym: "F" EXACT aa1 []
-synonym: "Phe" EXACT aa3 []
-is_a: SO:0001237 ! amino_acid
-
-[Term]
-id: SO:0001442
-name: methionine
-comment: A place holder for a cross product with chebi.
-synonym: "M" EXACT aa1 []
-synonym: "Met" EXACT aa3 []
-is_a: SO:0001237 ! amino_acid
-
-[Term]
-id: SO:0001443
-name: glycine
-comment: A place holder for a cross product with chebi.
-synonym: "G" EXACT aa1 []
-synonym: "Gly" EXACT aa3 []
-is_a: SO:0001237 ! amino_acid
-
-[Term]
-id: SO:0001444
-name: serine
-comment: A place holder for a cross product with chebi.
-synonym: "S" EXACT aa1 []
-synonym: "Ser" EXACT aa3 []
-is_a: SO:0001237 ! amino_acid
-
-[Term]
-id: SO:0001445
-name: threonine
-comment: A place holder for a cross product with chebi.
-synonym: "T" EXACT aa1 []
-synonym: "Thr" EXACT aa3 []
-is_a: SO:0001237 ! amino_acid
-
-[Term]
-id: SO:0001446
-name: tyrosine
-comment: A place holder for a cross product with chebi.
-synonym: "Tyr" EXACT aa3 []
-synonym: "Y" EXACT aa1 []
-is_a: SO:0001237 ! amino_acid
-
-[Term]
-id: SO:0001447
-name: cysteine
-comment: A place holder for a cross product with chebi.
-synonym: "C" EXACT aa1 []
-synonym: "Cys" EXACT aa3 []
-is_a: SO:0001237 ! amino_acid
-
-[Term]
-id: SO:0001448
-name: glutamine
-comment: A place holder for a cross product with chebi.
-synonym: "Gln" EXACT aa3 []
-synonym: "Q" EXACT aa1 []
-is_a: SO:0001237 ! amino_acid
-
-[Term]
-id: SO:0001449
-name: asparagine
-comment: A place holder for a cross product with chebi.
-synonym: "Asn" EXACT aa3 []
-synonym: "N" EXACT aa1 []
-is_a: SO:0001237 ! amino_acid
-
-[Term]
-id: SO:0001450
-name: lysine
-comment: A place holder for a cross product with chebi.
-synonym: "K" EXACT aa1 []
-synonym: "Lys" EXACT aa3 []
-is_a: SO:0001237 ! amino_acid
-
-[Term]
-id: SO:0001451
-name: arginine
-comment: A place holder for a cross product with chebi.
-synonym: "Arg" EXACT aa3 []
-synonym: "R" EXACT aa1 []
-is_a: SO:0001237 ! amino_acid
-
-[Term]
-id: SO:0001452
-name: histidine
-comment: A place holder for a cross product with chebi.
-synonym: "H" EXACT aa1 []
-synonym: "His" EXACT aa3 []
-is_a: SO:0001237 ! amino_acid
-
-[Term]
-id: SO:0001453
-name: aspartic_acid
-comment: A place holder for a cross product with chebi.
-synonym: "Asp" EXACT aa3 []
-synonym: "aspartic acid" EXACT []
-synonym: "D" EXACT aa1 []
-is_a: SO:0001237 ! amino_acid
-
-[Term]
-id: SO:0001454
-name: glutamic_acid
-comment: A place holder for a cross product with chebi.
-synonym: "E" EXACT aa1 []
-synonym: "Glu" EXACT aa3 []
-synonym: "glutamic acid" EXACT []
-is_a: SO:0001237 ! amino_acid
-
-[Term]
-id: SO:0001455
-name: selenocysteine
-comment: A place holder for a cross product with chebi.
-synonym: "Sec" EXACT aa3 []
-synonym: "U" EXACT aa1 []
-is_a: SO:0001237 ! amino_acid
-
-[Term]
-id: SO:0001456
-name: pyrrolysine
-comment: A place holder for a cross product with chebi.
-synonym: "O" EXACT aa1 []
-synonym: "Pyl" EXACT aa3 []
-is_a: SO:0001237 ! amino_acid
-
-[Term]
-id: SO:0001457
-name: transcribed_cluster
-def: "A region defined by a set of transcribed sequences from the same gene or expressed pseudogene." [SO:ke]
-comment: This term was requested by Jeff Bowes, using the tracker, ID = 2594157.
-synonym: "transcribed cluster" EXACT []
-synonym: "unigene cluster" RELATED []
-is_a: SO:0001410 ! experimental_feature
-relationship: has_part SO:0000695 ! reagent
-
-[Term]
-id: SO:0001458
-name: unigene_cluster
-def: "A kind of transcribed_cluster defined by a set of transcribed sequences from the a unique gene." [SO:ke]
-comment: This term was requested by Jeff Bowes, using the tracker, ID = 2594157.
-synonym: "unigene cluster" RELATED []
-is_a: SO:0001457 ! transcribed_cluster
-
-[Term]
-id: SO:0001459
-name: CRISPR
-def: "Clustered Palindromic Repeats interspersed with bacteriophage derived spacer sequences." [RFAM:jd]
-synonym: "Clustered_Regularly_Interspaced_Short_Palindromic_Repeat" EXACT []
-synonym: "CRISPR element" EXACT []
-xref: http:en.wikipedia.org/wiki/CRISPR
-is_a: SO:0000314 ! direct_repeat
-
-[Term]
-id: SO:0001460
-name: insulator_binding_site
-def: "A binding site that, in an insulator region of a nucleotide molecule, interacts selectively and non-covalently with polypeptide residues." [SO:ke]
-comment: See tracker ID 2060908.
-synonym: "insulator binding site" RELATED []
-is_a: SO:0001654 ! nucleotide_to_protein_binding_site
-relationship: part_of SO:0000627 ! insulator
-
-[Term]
-id: SO:0001461
-name: enhancer_binding_site
-def: "A binding site that, in the enhancer region of a nucleotide molecule, interacts selectively and non-covalently with polypeptide residues." [SO:ke]
-synonym: "enhancer binding site" RELATED []
-is_a: SO:0001654 ! nucleotide_to_protein_binding_site
-relationship: part_of SO:0000165 ! enhancer
-
-[Term]
-id: SO:0001462
-name: contig_collection
-def: "A collection of contigs." [SO:ke]
-comment: See tracker ID: 2138359.
-synonym: "contig collection" EXACT []
-is_a: SO:0001085 ! implied link automatically realized ! sequence_conflict
-is_a: SO:0001260 ! sequence_collection
-intersection_of: SO:0001085 ! sequence_conflict
-intersection_of: has_part SO:0000149 ! contig
-
-[Term]
-id: SO:0001463
-name: lincRNA
-def: "A multiexonic non-coding RNA transcribed by RNA polymerase II." [PMID:19182780, SO:ke]
-synonym: "large intervening non-coding RNA" EXACT []
-is_a: SO:0000655 ! ncRNA
-
-[Term]
-id: SO:0001464
-name: UST
-def: "An EST spanning part or all of the untranslated regions of a protein-coding transcript." [SO:nlw]
-synonym: "UTR sequence tag" EXACT []
-is_a: SO:0000345 ! EST
-
-[Term]
-id: SO:0001465
-name: three_prime_UST
-def: "A UST located in the 3'UTR of a protein-coding transcript." [SO:nlw]
-synonym: "3' UST" RELATED []
-is_a: SO:0001464 ! UST
-
-[Term]
-id: SO:0001466
-name: five_prime_UST
-def: "An UST located in the 5'UTR of a protein-coding transcript." [SO:nlw]
-synonym: "5' UST" RELATED []
-is_a: SO:0001464 ! UST
-
-[Term]
-id: SO:0001467
-name: RST
-def: "A tag produced from a single sequencing read from a RACE product; typically a few hundred base pairs long." [SO:nlw]
-synonym: "RACE sequence tag" EXACT []
-is_a: SO:0000345 ! EST
-
-[Term]
-id: SO:0001468
-name: three_prime_RST
-def: "A tag produced from a single sequencing read from a 3'-RACE product; typically a few hundred base pairs long." [SO:nlw]
-synonym: "3' RST" EXACT []
-is_a: SO:0001467 ! RST
-
-[Term]
-id: SO:0001469
-name: five_prime_RST
-def: "A tag produced from a single sequencing read from a 5'-RACE product; typically a few hundred base pairs long." [SO:nlw]
-synonym: "5' RST" RELATED []
-is_a: SO:0001467 ! RST
-
-[Term]
-id: SO:0001470
-name: UST_match
-def: "A match against an UST sequence." [SO:nlw]
-synonym: "UST match" EXACT []
-is_a: SO:0000102 ! expressed_sequence_match
-
-[Term]
-id: SO:0001471
-name: RST_match
-def: "A match against an RST sequence." [SO:nlw]
-synonym: "RST match" EXACT []
-is_a: SO:0000102 ! expressed_sequence_match
-
-[Term]
-id: SO:0001472
-name: primer_match
-def: "A nucleotide match to a primer sequence." [SO:nlw]
-synonym: "primer match" EXACT []
-is_a: SO:0000347 ! nucleotide_match
-
-[Term]
-id: SO:0001473
-name: miRNA_antiguide
-def: "A region of the pri miRNA that basepairs with the guide to form the hairpin." [SO:ke]
-synonym: "miRNA antiguide " EXACT []
-synonym: "miRNA passenger strand" EXACT []
-synonym: "miRNA star" EXACT []
-is_a: SO:0001243 ! miRNA_primary_transcript_region
-created_by: kareneilbeck
-creation_date: 2009-05-27T03:35:43Z
-
-[Term]
-id: SO:0001474
-name: trans_splice_junction
-def: "The boundary between the spliced leader and the first exon of the mRNA." [SO:ke]
-synonym: "trans-splice junction" EXACT []
-is_a: SO:0000699 ! junction
-created_by: kareneilbeck
-creation_date: 2009-07-13T04:50:49Z
-
-[Term]
-id: SO:0001475
-name: outron
-def: "A region of a primary transcript, that is removed via trans splicing." [PMID:16401417, SO:ke]
-is_a: SO:0000835 ! primary_transcript_region
-created_by: kareneilbeck
-creation_date: 2009-07-14T11:36:08Z
-
-[Term]
-id: SO:0001476
-name: natural_plasmid
-def: "A plasmid that occurs naturally." [SO:xp]
-synonym: "natural plasmid" EXACT []
-is_a: SO:0000155 ! plasmid
-is_a: SO:0001038 ! extrachromosomal_mobile_genetic_element
-intersection_of: SO:0000155 ! plasmid
-intersection_of: has_quality SO:0000782 ! natural
-created_by: kareneilbeck
-creation_date: 2009-09-01T03:43:06Z
-
-[Term]
-id: SO:0001477
-name: gene_trap_construct
-def: "A gene trap construct is a type of engineered plasmid which is designed to integrate into a genome and produce a fusion transcript between exons of the gene into which it inserts and a reporter element in the construct. Gene traps contain a splice acceptor, do not contain promoter elements for the reporter, and are mutagenic. Gene traps may be bicistronic with the second cassette containing a promoter driving an a selectable marker." [ZFIN:dh]
-synonym: "gene trap construct" EXACT []
-is_a: SO:0000637 ! engineered_plasmid
-created_by: kareneilbeck
-creation_date: 2009-09-01T03:49:09Z
-
-[Term]
-id: SO:0001478
-name: promoter_trap_construct
-def: "A promoter trap construct is a type of engineered plasmid which is designed to integrate into a genome and express a reporter when inserted in close proximity to a promoter element. Promoter traps typically do not contain promoter elements and are mutagenic." [ZFIN:dh]
-synonym: "promoter trap construct" EXACT []
-is_a: SO:0000637 ! engineered_plasmid
-created_by: kareneilbeck
-creation_date: 2009-09-01T03:52:01Z
-
-[Term]
-id: SO:0001479
-name: enhancer_trap_construct
-def: "An enhancer trap construct is a type of engineered plasmid which is designed to integrate into a genome and express a reporter when the expression from a basic minimal promoter is enhanced by genomic enhancer elements. Enhancer traps contain promoter elements and are not usually mutagenic." [ZFIN:dh]
-synonym: "enhancer trap construct" EXACT []
-is_a: SO:0000637 ! engineered_plasmid
-created_by: kareneilbeck
-creation_date: 2009-09-01T03:53:26Z
-
-[Term]
-id: SO:0001480
-name: PAC_end
-def: "A region of sequence from the end of a PAC clone that may provide a highly specific marker." [ZFIN:mh]
-synonym: "PAC end" EXACT []
-is_a: SO:0000150 ! read
-relationship: part_of SO:0000154 ! PAC
-created_by: kareneilbeck
-creation_date: 2009-09-09T05:18:12Z
-
-[Term]
-id: SO:0001481
-name: RAPD
-def: "RAPD is a 'PCR product' where a sequence variant is identified through the use of PCR with random primers." [ZFIN:mh]
-synonym: "Random Amplification Polymorphic DNA" EXACT []
-is_a: SO:0000006 ! PCR_product
-created_by: kareneilbeck
-creation_date: 2009-09-09T05:26:10Z
-
-[Term]
-id: SO:0001482
-name: shadow_enhancer
-synonym: "shadow enhancer" EXACT []
-is_a: SO:0000165 ! enhancer
-created_by: kareneilbeck
-creation_date: 2009-09-09T05:29:29Z
-
-[Term]
-id: SO:0001483
-name: SNV
-def: "SNVs are single nucleotide positions in genomic DNA at which different sequence alternatives exist." [SO:bm]
-subset: SOFA
-synonym: "single nucleotide variant" EXACT []
-is_a: SO:1000002 ! substitution
-created_by: kareneilbeck
-creation_date: 2009-10-08T11:37:49Z
-
-[Term]
-id: SO:0001484
-name: X_element_combinatorial_repeat
-def: "An X element combinatorial repeat is a repeat region located between the X element and the telomere or adjacent Y' element." [http://www.yeastgenome.org/help/glossary.html]
-comment: X element combinatorial repeats contain Tbf1p binding sites,\nand possible functions include a role in telomerase-independent telomere\nmaintenance via recombination or as a barrier against transcriptional\nsilencing. These are usually present as a combination of one or more of\nseveral types of smaller elements (designated A, B, C, or D). This term was requested 2009-10-16 by Michel Dumontier, tracker id 2880747.
-synonym: "X element combinatorial repeat" EXACT []
-is_a: SO:0000657 ! repeat_region
-relationship: part_of SO:0000624 ! telomere
-created_by: kareneilbeck
-creation_date: 2009-11-10T11:03:37Z
-
-[Term]
-id: SO:0001485
-name: Y_prime_element
-def: "A Y' element is a repeat region (SO:0000657) located adjacent to telomeric repeats or X element combinatorial repeats, either as a single copy or tandem repeat of two to four copies." [http:http\://www.yeastgenome.org/help/glossary.html]
-comment: This term was requested 2009-10-16 by Michel Dumontier, tracker id 2880747.
-synonym: "Y' element" EXACT []
-is_a: SO:0000657 ! repeat_region
-relationship: part_of SO:0000624 ! telomere
-created_by: kareneilbeck
-creation_date: 2009-11-10T12:08:57Z
-
-[Term]
-id: SO:0001486
-name: standard_draft
-def: "The status of a whole genome sequence, where the data is minimally filtered or un-filtered, from any number of sequencing platforms, and is assembled into contigs. Genome sequence of this quality may harbour regions of poor quality and can be relatively incomplete." [DOI:10.1126]
-synonym: "standard draft" EXACT []
-is_a: SO:0001499 ! whole_genome_sequence_status
-created_by: kareneilbeck
-creation_date: 2009-10-23T12:48:32Z
-
-[Term]
-id: SO:0001487
-name: high_quality_draft
-def: "The status of a whole genome sequence, where overall coverage represents at least 90 percent of the genome." [DOI:10.1126]
-synonym: "high quality draft" EXACT []
-is_a: SO:0001499 ! whole_genome_sequence_status
-created_by: kareneilbeck
-creation_date: 2009-10-23T12:52:36Z
-
-[Term]
-id: SO:0001488
-name: improved_high_quality_draft
-def: "The status of a whole genome sequence, where additional work has been performed, using either manual or automated methods, such as gap resolution." [DOI:10.1126]
-synonym: "improved high quality draft" EXACT []
-is_a: SO:0001499 ! whole_genome_sequence_status
-created_by: kareneilbeck
-creation_date: 2009-10-23T12:54:35Z
-
-[Term]
-id: SO:0001489
-name: annotation_directed_improved_draft
-def: "The status of a whole genome sequence,where annotation, and verification of coding regions has occurred." [DOI:10.1126]
-synonym: "annotation directed improvement" EXACT []
-is_a: SO:0001499 ! whole_genome_sequence_status
-created_by: kareneilbeck
-creation_date: 2009-10-23T12:57:10Z
-
-[Term]
-id: SO:0001490
-name: noncontiguous_finished
-def: "The status of a whole genome sequence, where the assembly is high quality, closure approaches have been successful for most gaps, misassemblies and low quality regions." [DOI:10.1126]
-synonym: "non contiguous finished" EXACT []
-is_a: SO:0001499 ! whole_genome_sequence_status
-created_by: kareneilbeck
-creation_date: 2009-10-23T01:01:07Z
-
-[Term]
-id: SO:0001491
-name: finished_genome
-def: "The status of a whole genome sequence, with less than 1 error per 100,000 base pairs." [DOI:10.1126]
-synonym: "finished" EXACT []
-synonym: "finished genome" EXACT []
-is_a: SO:0001499 ! whole_genome_sequence_status
-created_by: kareneilbeck
-creation_date: 2009-10-23T01:04:43Z
-
-[Term]
-id: SO:0001492
-name: intronic_regulatory_region
-def: "A regulatory region that is part of an intron." [SO:ke]
-synonym: "intronic regulatory region" EXACT []
-is_a: SO:0001679 ! transcription_regulatory_region
-relationship: part_of SO:0000188 ! intron
-created_by: kareneilbeck
-creation_date: 2009-11-08T02:48:02Z
-
-[Term]
-id: SO:0001493
-name: centromere_DNA_Element_I
-def: "A centromere DNA Element I (CDEI) is a conserved region, part of the centromere, consisting of a consensus region composed of 8-11bp which enables binding by the centromere binding factor 1(Cbf1p)." [PMID:11222754]
-comment: This term was requested 2009-10-16 by Michel Dumontier, tracker id 2880699.
-synonym: "CDEI" EXACT []
-synonym: "Centromere DNA Element I" EXACT []
-is_a: SO:0000330 ! conserved_region
-relationship: part_of SO:0001794 ! point_centromere
-created_by: kareneilbeck
-creation_date: 2009-11-09T05:47:23Z
-
-[Term]
-id: SO:0001494
-name: centromere_DNA_Element_II
-def: "A centromere DNA Element II (CDEII) is part a conserved region of the centromere, consisting of a consensus region that is AT-rich and ~ 75-100 bp in length." [PMID:11222754]
-comment: This term was requested 2009-10-16 by Michel Dumontier, tracker id 2880699.
-synonym: "CDEII" EXACT []
-synonym: "centromere DNA Element II" EXACT []
-is_a: SO:0000330 ! conserved_region
-relationship: part_of SO:0001794 ! point_centromere
-created_by: kareneilbeck
-creation_date: 2009-11-09T05:51:26Z
-
-[Term]
-id: SO:0001495
-name: centromere_DNA_Element_III
-def: "A centromere DNA Element I (CDEI) is a conserved region, part of the centromere, consisting of a consensus region that consists of a 25-bp which enables binding by the centromere DNA binding factor 3 (CBF3) complex." [PMID:11222754]
-comment: This term was requested 2009-10-16 by Michel Dumontier, tracker id 2880699.
-synonym: "CDEIII" EXACT []
-synonym: "centromere DNA Element III" EXACT []
-is_a: SO:0000330 ! conserved_region
-relationship: part_of SO:0001794 ! point_centromere
-created_by: kareneilbeck
-creation_date: 2009-11-09T05:54:47Z
-
-[Term]
-id: SO:0001496
-name: telomeric_repeat
-def: "The telomeric repeat is a repeat region, part of the chromosome, which in yeast, is a G-rich terminal sequence of the form (TG(1-3))n or more precisely ((TG)(1-6)TG(2-3))n." [PMID:8720065]
-comment: The repeats are maintained by telomerase and there is generally 300 (+/-) 75 bp of TG(1-3) at a given end. Telomeric repeats function in completing chromosome replication and protecting the ends from degradation and end-to-end fusions. This term was requested 2009-10-16 by Michel Dumontier, tracker id 2880739.
-synonym: "telomeric repeat" EXACT []
-is_a: SO:0000657 ! repeat_region
-relationship: part_of SO:0000624 ! telomere
-created_by: kareneilbeck
-creation_date: 2009-11-09T06:00:42Z
-
-[Term]
-id: SO:0001497
-name: X_element
-def: "The X element is a conserved region, of the telomere, of ~475 bp that contains an ARS sequence and in most cases an Abf1p binding site." [http://www.yeastgenome.org/help/glossary.html#xelemcoresequence]
-comment: Possible functions include roles in chromosomal segregation,\nmaintenance of chromosome stability, recombinational sequestering, or as a\nbarrier to transcriptional silencing. This term was requested 2009-10-16 by Michel Dumontier, tracker id 2880747.
-synonym: "X element" RELATED []
-is_a: SO:0000330 ! conserved_region
-relationship: part_of SO:0000624 ! telomere
-created_by: kareneilbeck
-creation_date: 2009-11-10T10:56:54Z
-
-[Term]
-id: SO:0001498
-name: YAC_end
-def: "A region of sequence from the end of a YAC clone that may provide a highly specific marker." [SO:ke]
-synonym: "YAC end" EXACT []
-is_a: SO:0000150 ! read
-relationship: part_of SO:0000152 ! YAC
-created_by: kareneilbeck
-creation_date: 2009-11-19T11:07:18Z
-
-[Term]
-id: SO:0001499
-name: whole_genome_sequence_status
-def: "The status of whole genome sequence." [DOI:10.1126]
-comment: This terms and children were added to SO in response to tracker request by Patrick Chain. The paper Genome Project Standards in a New Era of Sequencing. Science October 9th 2009, addresses these terms.
-synonym: "whole genome sequence status" EXACT []
-is_a: SO:0000905 ! status
-created_by: kareneilbeck
-creation_date: 2009-10-23T12:47:47Z
-
-[Term]
-id: SO:0001500
-name: heritable_phenotypic_marker
-def: "A biological_region characterized as a single heritable trait in a phenotype screen. The heritable phenotype may be mapped to a chromosome but generally has not been characterized to a specific gene locus." [JAX:hdene]
-synonym: "heritable phenotypic marker" EXACT []
-synonym: "phenotypic marker" EXACT []
-is_a: SO:0001645 ! genetic_marker
-created_by: kareneilbeck
-creation_date: 2009-12-07T01:50:55Z
-
-[Term]
-id: SO:0001501
-name: peptide_collection
-def: "A collection of peptide sequences." [BBOP:nlw]
-comment: Term requested via tracker ID: 2910829.
-synonym: "peptide collection" EXACT []
-synonym: "peptide set" EXACT []
-is_a: SO:0001260 ! sequence_collection
-intersection_of: SO:0001260 ! sequence_collection
-intersection_of: has_part SO:0000104 ! polypeptide
-created_by: kareneilbeck
-creation_date: 2009-12-11T10:58:58Z
-
-[Term]
-id: SO:0001502
-name: high_identity_region
-def: "An experimental feature with high sequence identity to another sequence." [SO:ke]
-comment: Requested by tracker ID: 2902685.
-synonym: "high identity region" EXACT []
-is_a: SO:0001410 ! experimental_feature
-created_by: kareneilbeck
-creation_date: 2009-12-11T11:06:05Z
-
-[Term]
-id: SO:0001503
-name: processed_transcript
-def: "A transcript for which no open reading frame has been identified and for which no other function has been determined." [MGI:hdeen]
-comment: Ensembl and Vega also use this term name. Requested by Howard Deen of MGI.
-synonym: "processed transcript" EXACT []
-is_a: SO:0000673 ! transcript
-created_by: kareneilbeck
-creation_date: 2009-12-21T05:37:14Z
-
-[Term]
-id: SO:0001504
-name: assortment_derived_variation
-def: "A chromosome variation derived from an event during meiosis." [SO:ke]
-synonym: "assortment derived variation" RELATED []
-is_a: SO:0000240 ! chromosome_variation
-created_by: kareneilbeck
-creation_date: 2010-03-02T05:03:18Z
-
-[Term]
-id: SO:0001505
-name: reference_genome
-def: "A collection of sequences (often chromosomes) taken as the standard for a given organism and genome assembly." [SO:ke]
-synonym: "reference genome" RELATED []
-is_a: SO:0001026 ! genome
-created_by: kareneilbeck
-creation_date: 2010-03-03T02:10:03Z
-
-[Term]
-id: SO:0001506
-name: variant_genome
-def: "A collection of sequences (often chromosomes) of an individual." [SO:ke]
-synonym: "variant genome" RELATED []
-is_a: SO:0001026 ! genome
-created_by: kareneilbeck
-creation_date: 2010-03-03T02:11:25Z
-
-[Term]
-id: SO:0001507
-name: variant_collection
-def: "A collection of one or more sequences of an individual." [SO:ke]
-synonym: "variant collection" RELATED []
-is_a: SO:0001260 ! sequence_collection
-intersection_of: SO:0001260 ! sequence_collection
-intersection_of: has_part SO:0001059 ! sequence_alteration
-created_by: kareneilbeck
-creation_date: 2010-03-03T02:13:28Z
-
-[Term]
-id: SO:0001508
-name: alteration_attribute
-synonym: "alteration attribute" EXACT []
-is_a: SO:0000733 ! feature_attribute
-created_by: kareneilbeck
-creation_date: 2010-03-04T02:53:23Z
-
-[Term]
-id: SO:0001509
-name: chromosomal_variation_attribute
-synonym: "chromosomal variation attribute" EXACT []
-is_a: SO:0001508 ! alteration_attribute
-created_by: kareneilbeck
-creation_date: 2010-03-04T02:54:30Z
-
-[Term]
-id: SO:0001510
-name: intrachromosomal
-is_a: SO:0001509 ! chromosomal_variation_attribute
-created_by: kareneilbeck
-creation_date: 2010-03-04T02:55:25Z
-
-[Term]
-id: SO:0001511
-name: interchromosomal
-is_a: SO:0001509 ! chromosomal_variation_attribute
-created_by: kareneilbeck
-creation_date: 2010-03-04T02:55:43Z
-
-[Term]
-id: SO:0001512
-name: insertion_attribute
-def: "A quality of a chromosomal insertion,." [SO:ke]
-synonym: "insertion attribute" EXACT []
-is_a: SO:0001508 ! alteration_attribute
-created_by: kareneilbeck
-creation_date: 2010-03-04T02:55:56Z
-
-[Term]
-id: SO:0001513
-name: tandem
-is_a: SO:0001512 ! insertion_attribute
-created_by: kareneilbeck
-creation_date: 2010-03-04T02:56:37Z
-
-[Term]
-id: SO:0001514
-name: direct
-def: "A quality of an insertion where the insert is not in a cytologically inverted orientation." [SO:ke]
-is_a: SO:0001512 ! insertion_attribute
-created_by: kareneilbeck
-creation_date: 2010-03-04T02:56:49Z
-
-[Term]
-id: SO:0001515
-name: inverted
-def: "A quality of an insertion where the insert is in a cytologically inverted orientation." [SO:ke]
-is_a: SO:0001512 ! insertion_attribute
-created_by: kareneilbeck
-creation_date: 2010-03-04T02:57:40Z
-
-[Term]
-id: SO:0001516
-name: free
-def: "The quality of a duplication where the new region exists independently of the original." [SO:ke]
-is_a: SO:0001523 ! duplication_attribute
-created_by: kareneilbeck
-creation_date: 2010-03-04T02:57:51Z
-
-[Term]
-id: SO:0001517
-name: inversion_attribute
-synonym: "inversion attribute" EXACT []
-is_a: SO:0001508 ! alteration_attribute
-created_by: kareneilbeck
-creation_date: 2010-03-04T02:58:10Z
-
-[Term]
-id: SO:0001518
-name: pericentric
-is_a: SO:0001517 ! inversion_attribute
-created_by: kareneilbeck
-creation_date: 2010-03-04T02:58:24Z
-
-[Term]
-id: SO:0001519
-name: paracentric
-is_a: SO:0001517 ! inversion_attribute
-created_by: kareneilbeck
-creation_date: 2010-03-04T02:58:35Z
-
-[Term]
-id: SO:0001520
-name: translocaton_attribute
-synonym: "translocation attribute" EXACT []
-is_a: SO:0001508 ! alteration_attribute
-created_by: kareneilbeck
-creation_date: 2010-03-04T02:58:47Z
-
-[Term]
-id: SO:0001521
-name: reciprocal
-is_a: SO:0001520 ! translocaton_attribute
-created_by: kareneilbeck
-creation_date: 2010-03-04T02:59:34Z
-
-[Term]
-id: SO:0001522
-name: insertional
-is_a: SO:0001520 ! translocaton_attribute
-created_by: kareneilbeck
-creation_date: 2010-03-04T02:59:51Z
-
-[Term]
-id: SO:0001523
-name: duplication_attribute
-synonym: "duplication attribute" RELATED []
-is_a: SO:0001508 ! alteration_attribute
-created_by: kareneilbeck
-creation_date: 2010-03-05T01:56:33Z
-
-[Term]
-id: SO:0001524
-name: chromosomally_aberrant_genome
-synonym: "chromosomally aberrant genome" RELATED []
-is_a: SO:0001506 ! variant_genome
-created_by: kareneilbeck
-creation_date: 2010-03-05T02:21:00Z
-
-[Term]
-id: SO:0001525
-name: assembly_error_correction
-def: "A region of sequence where the final nucleotide assignment differs from the original assembly due to an improvement that replaces a mistake." [SO:ke]
-synonym: "assembly error correction" RELATED []
-is_a: SO:0000413 ! sequence_difference
-created_by: kareneilbeck
-creation_date: 2010-03-09T02:16:31Z
-
-[Term]
-id: SO:0001526
-name: base_call_error_correction
-def: "A region of sequence where the final nucleotide assignment is different from that given by the base caller due to an improvement that replaces a mistake." [SO:ke]
-synonym: "base call error correction" RELATED []
-is_a: SO:0000413 ! sequence_difference
-created_by: kareneilbeck
-creation_date: 2010-03-09T02:18:07Z
-
-[Term]
-id: SO:0001527
-name: peptide_localization_signal
-def: "A region of peptide sequence used to target the polypeptide molecule to a specific organelle." [SO:ke]
-subset: SOFA
-synonym: "localization signal" RELATED []
-synonym: "peptide localization signal" EXACT []
-is_a: SO:0000839 ! polypeptide_region
-created_by: kareneilbeck
-creation_date: 2010-03-11T02:15:05Z
-
-[Term]
-id: SO:0001528
-name: nuclear_localization_signal
-def: "A polypeptide region that targets a polypeptide to the nucleus." [SO:ke]
-synonym: "NLS" EXACT []
-xref: http://en.wikipedia.org/wiki/Nuclear_localization_signal "wikipedia"
-is_a: SO:0001527 ! peptide_localization_signal
-created_by: kareneilbeck
-creation_date: 2010-03-11T02:16:38Z
-
-[Term]
-id: SO:0001529
-name: endosomal_localization_signal
-def: "A polypeptide region that targets a polypeptide to the endosome." [SO:ke]
-synonym: "endosomal localization signal" EXACT []
-is_a: SO:0001527 ! peptide_localization_signal
-created_by: kareneilbeck
-creation_date: 2010-03-11T02:20:58Z
-
-[Term]
-id: SO:0001530
-name: lysosomal_localization_signal
-def: "A polypeptide region that targets a polypeptide to the lysosome." [SO:ke]
-synonym: "lysosomal localization signal" EXACT []
-is_a: SO:0001527 ! peptide_localization_signal
-created_by: kareneilbeck
-creation_date: 2010-03-11T02:24:10Z
-
-[Term]
-id: SO:0001531
-name: nuclear_export_signal
-def: "A polypeptide region that targets a polypeptide to he cytoplasm." [SO:ke]
-synonym: "NES" EXACT []
-synonym: "nuclear export signal" EXACT []
-xref: http://en.wikipedia.org/wiki/Nuclear_export_signal
-is_a: SO:0001527 ! peptide_localization_signal
-created_by: kareneilbeck
-creation_date: 2010-03-11T02:25:25Z
-
-[Term]
-id: SO:0001532
-name: recombination_signal_sequence
-def: "A region recognized by a recombinase." [SO:ke]
-synonym: "recombination signal sequence" RELATED []
-xref: http://en.wikipedia.org/wiki/Recombination_Signal_Sequences "wikipedia"
-is_a: SO:0000299 ! specific_recombination_site
-created_by: kareneilbeck
-creation_date: 2010-03-11T03:16:47Z
-
-[Term]
-id: SO:0001533
-name: cryptic_splice_site
-def: "A splice site that is in part of the transcript not normally spliced. They occur via mutation or transcriptional error." [SO:ke]
-synonym: "cryptic splice signal" RELATED []
-synonym: "cryptic splice site" EXACT []
-is_a: SO:0000162 ! splice_site
-created_by: kareneilbeck
-creation_date: 2010-03-11T03:25:06Z
-
-[Term]
-id: SO:0001534
-name: nuclear_rim_localization_signal
-def: "A polypeptide region that targets a polypeptide to the nuclear rim." [SO:ke]
-synonym: "nuclear rim localization signal" RELATED []
-xref: PMID:16027110
-is_a: SO:0001527 ! peptide_localization_signal
-created_by: kareneilbeck
-creation_date: 2010-03-11T03:31:30Z
-
-[Term]
-id: SO:0001535
-name: p_element
-def: "A P_element is a DNA transposon responsible for hybrid dysgenesis." [SO:ke]
-synonym: "P element" RELATED []
-is_a: SO:0000182 ! DNA_transposon
-created_by: kareneilbeck
-creation_date: 2010-03-12T03:40:33Z
-
-[Term]
-id: SO:0001536
-name: functional_variant
-def: "A sequence variant in which the function of a gene product is altered with respect to a reference." [SO:ke]
-synonym: "functional variant" EXACT []
-is_a: SO:0001060 ! sequence_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T11:30:25Z
-
-[Term]
-id: SO:0001537
-name: structural_variant
-def: "A sequence variant that changes one or more sequence features." [SO:ke]
-synonym: "structural variant" RELATED []
-is_a: SO:0001060 ! sequence_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T11:31:01Z
-
-[Term]
-id: SO:0001538
-name: transcript_function_variant
-def: "A sequence variant which alters the functioning of a transcript with respect to a reference sequence." [SO:ke]
-synonym: "transcript function variant" EXACT []
-is_a: SO:0001536 ! functional_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T11:32:58Z
-
-[Term]
-id: SO:0001539
-name: translational_product_function_variant
-def: "A sequence variant that affects the functioning of a translational product with respect to a reference sequence." [SO:ke]
-synonym: "translational product variant" EXACT []
-is_a: SO:0001536 ! functional_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T11:46:15Z
-
-[Term]
-id: SO:0001540
-name: level_of_transcript_variant
-def: "A sequence variant which alters the level of a transcript." [SO:ke]
-synonym: "level of transcript variant" EXACT []
-is_a: SO:0001538 ! transcript_function_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T11:47:07Z
-
-[Term]
-id: SO:0001541
-name: decreased_transcript_level_variant
-def: "A sequence variant that increases the level of mature, spliced and processed RNA with respect to a reference sequence." [SO:ke]
-synonym: "decreased transcript level" EXACT []
-is_a: SO:0001540 ! level_of_transcript_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T11:47:47Z
-
-[Term]
-id: SO:0001542
-name: increased_transcript_level_variant
-def: "A sequence variant that increases the level of mature, spliced and processed RNA with respect to a reference sequence." [SO:ke]
-synonym: "increased transcript level variant" EXACT []
-is_a: SO:0001540 ! level_of_transcript_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T11:48:17Z
-
-[Term]
-id: SO:0001543
-name: transcript_processing_variant
-def: "A sequence variant that affects the post transcriptional processing of a transcript with respect to a reference sequence." [SO:ke]
-synonym: "transcript processing variant" EXACT []
-is_a: SO:0001538 ! transcript_function_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T11:48:48Z
-
-[Term]
-id: SO:0001544
-name: editing_variant
-def: "A transcript processing variant whereby the process of editing is disrupted with respect to the reference." [SO:ke]
-synonym: "editing variant" EXACT []
-is_a: SO:0001543 ! transcript_processing_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T11:49:25Z
-
-[Term]
-id: SO:0001545
-name: polyadenylation_variant
-def: "A sequence variant that changes polyadenylation with respect to a reference sequence." [SO:ke]
-synonym: "polyadenylation variant" EXACT []
-is_a: SO:0001543 ! transcript_processing_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T11:49:40Z
-
-[Term]
-id: SO:0001546
-name: transcript_stability_variant
-def: "A variant that changes the stability of a transcript with respect to a reference sequence." [SO:ke]
-synonym: "transcript stability variant" EXACT []
-is_a: SO:0001538 ! transcript_function_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T11:50:01Z
-
-[Term]
-id: SO:0001547
-name: decreased_transcript_stability_variant
-def: "A sequence variant that decreases transcript stability with respect to a reference sequence." [SO:ke]
-synonym: "decrease transcript stability variant" EXACT []
-is_a: SO:0001546 ! transcript_stability_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T11:50:23Z
-
-[Term]
-id: SO:0001548
-name: increased_transcript_stability_variant
-def: "A sequence variant that increases transcript stability with respect to a reference sequence." [SO:ke]
-synonym: "increased transcript stability variant" EXACT []
-is_a: SO:0001546 ! transcript_stability_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T11:50:39Z
-
-[Term]
-id: SO:0001549
-name: transcription_variant
-def: "A variant that changes alters the transcription of a transcript with respect to a reference sequence." [SO:ke]
-synonym: "transcription variant" EXACT []
-is_a: SO:0001538 ! transcript_function_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T11:51:26Z
-
-[Term]
-id: SO:0001550
-name: rate_of_transcription_variant
-def: "A sequence variant that changes the rate of transcription with respect to a reference sequence." [SO:ke]
-synonym: "rate of transcription variant" EXACT []
-is_a: SO:0001549 ! transcription_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T11:51:50Z
-
-[Term]
-id: SO:0001551
-name: increased_transcription_rate_variant
-def: "A sequence variant that increases the rate of transcription with respect to a reference sequence." [SO:ke]
-synonym: "increased transcription rate variant" EXACT []
-is_a: SO:0001550 ! rate_of_transcription_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T11:52:17Z
-
-[Term]
-id: SO:0001552
-name: decreased_transcription_rate_variant
-def: "A sequence variant that decreases the rate of transcription with respect to a reference sequence." [SO:ke]
-synonym: "decreased transcription rate variant" EXACT []
-is_a: SO:0001550 ! rate_of_transcription_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T11:52:43Z
-
-[Term]
-id: SO:0001553
-name: translational_product_level_variant
-def: "A functional variant that changes the translational product level with respect to a reference sequence." [SO:ke]
-synonym: "translational product level variant" EXACT []
-is_a: SO:0001539 ! translational_product_function_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T11:53:32Z
-
-[Term]
-id: SO:0001554
-name: polypeptide_function_variant
-def: "A sequence variant which changes polypeptide functioning with respect to a reference sequence." [SO:ke]
-synonym: "polypeptide function variant" EXACT []
-is_a: SO:0001539 ! translational_product_function_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T11:53:54Z
-
-[Term]
-id: SO:0001555
-name: decreased_translational_product_level
-def: "A sequence variant which decreases the translational product level with respect to a reference sequence." [SO:ke]
-synonym: "decrease translational product level" EXACT []
-is_a: SO:0001553 ! translational_product_level_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T11:54:25Z
-
-[Term]
-id: SO:0001556
-name: increased_translational_product_level
-def: "A sequence variant which increases the translational product level with respect to a reference sequence." [SO:ke]
-synonym: "increase translational product level" EXACT []
-is_a: SO:0001553 ! translational_product_level_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T11:55:25Z
-
-[Term]
-id: SO:0001557
-name: polypeptide_gain_of_function_variant
-def: "A sequence variant which causes gain of polypeptide function with respect to a reference sequence." [SO:ke]
-synonym: "polypeptide gain of function variant" EXACT []
-is_a: SO:0001554 ! polypeptide_function_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T11:56:12Z
-
-[Term]
-id: SO:0001558
-name: polypeptide_localization_variant
-def: "A sequence variant which changes the localization of a polypeptide with respect to a reference sequence." [SO:ke]
-synonym: "polypeptide localization variant" EXACT []
-is_a: SO:0001554 ! polypeptide_function_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T11:56:37Z
-
-[Term]
-id: SO:0001559
-name: polypeptide_loss_of_function_variant
-def: "A sequence variant that causes the loss of a polypeptide function with respect to a reference sequence." [SO:ke]
-synonym: "polypeptide loss of function variant" EXACT []
-is_a: SO:0001554 ! polypeptide_function_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T11:56:58Z
-
-[Term]
-id: SO:0001560
-name: inactive_ligand_binding_site
-def: "A sequence variant that causes the inactivation of a ligand binding site with respect to a reference sequence." [SO:ke]
-synonym: "inactive ligand binding site" EXACT []
-is_a: SO:0001559 ! polypeptide_loss_of_function_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T11:58:00Z
-
-[Term]
-id: SO:0001561
-name: polypeptide_partial_loss_of_function
-def: "A sequence variant that causes some but not all loss of polypeptide function with respect to a reference sequence." [SO:ke]
-synonym: "polypeptide partial loss of function" EXACT []
-is_a: SO:0001559 ! polypeptide_loss_of_function_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T11:58:32Z
-
-[Term]
-id: SO:0001562
-name: polypeptide_post_translational_processing_variant
-def: "A sequence variant that causes a change in post translational processing of the peptide with respect to a reference sequence." [SO:ke]
-synonym: "polypeptide post translational processing variant" EXACT []
-is_a: SO:0001554 ! polypeptide_function_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T11:59:06Z
-
-[Term]
-id: SO:0001563
-name: copy_number_change
-def: "A sequence variant where copies of a feature (CNV) are either increased or decreased." [SO:ke]
-synonym: "copy number change" EXACT []
-is_a: SO:0001537 ! structural_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:27:33Z
-
-[Term]
-id: SO:0001564
-name: gene_variant
-def: "A sequence variant where the structure of the gene is changed." [SO:ke]
-synonym: "gene structure variant" EXACT []
-is_a: SO:0001537 ! structural_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:28:01Z
-
-[Term]
-id: SO:0001565
-name: gene_fusion
-def: "A sequence variant whereby a two genes have become joined." [SO:ke]
-synonym: "gene fusion" EXACT []
-is_a: SO:0001564 ! gene_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:28:28Z
-
-[Term]
-id: SO:0001566
-name: regulatory_region_variant
-def: "A sequence variant located within a regulatory region." [SO:ke]
-comment: EBI term: Regulatory region variations - In regulatory region annotated by Ensembl.
-synonym: "regulatory region variant" EXACT []
-synonym: "regulatory_region_" EXACT ebi_variants [http://uswest.ensembl.org/info/docs/variation/index.html]
-is_a: SO:0001537 ! structural_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:28:48Z
-
-[Term]
-id: SO:0001567
-name: stop_retained_variant
-def: "A sequence variant where at least one base in the terminator codon is changed, but the terminator remains." [SO:ke]
-synonym: "stop retained variant" EXACT []
-is_a: SO:0001590 ! terminator_codon_variant
-is_a: SO:0001650 ! inframe_variant
-is_a: SO:0001819 ! synonymous_variant
-created_by: kareneilbeck
-creation_date: 2010-04-19T05:02:30Z
-
-[Term]
-id: SO:0001568
-name: splicing_variant
-def: "A sequence variant that changes the process of splicing." [SO:ke]
-synonym: "splicing variant" EXACT []
-xref: EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html
-is_a: SO:0001564 ! gene_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:29:22Z
-
-[Term]
-id: SO:0001569
-name: cryptic_splice_site_variant
-def: "A sequence variant causing a new (functional) splice site." [EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html]
-synonym: "cryptic splice site activation" EXACT []
-xref: EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html
-is_a: SO:0001568 ! splicing_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:29:41Z
-
-[Term]
-id: SO:0001570
-name: cryptic_splice_acceptor
-def: "A sequence variant whereby a new splice site is created due to the activation of a new acceptor." [SO:ke]
-synonym: "cryptic splice acceptor" EXACT []
-is_a: SO:0001569 ! cryptic_splice_site_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:30:11Z
-
-[Term]
-id: SO:0001571
-name: cryptic_splice_donor
-def: "A sequence variant whereby a new splice site is created due to the activation of a new donor." [SO:ke]
-synonym: "cryptic splice donor" EXACT []
-is_a: SO:0001569 ! cryptic_splice_site_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:30:35Z
-
-[Term]
-id: SO:0001572
-name: exon_loss
-def: "A sequence variant whereby an exon is lost from the transcript." [SO:ke]
-synonym: "exon loss" EXACT []
-is_a: SO:0001568 ! splicing_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:31:09Z
-
-[Term]
-id: SO:0001573
-name: intron_gain
-def: "A sequence variant whereby an intron is gained by the processed transcript; usually a result of an alteration of the donor or acceptor." [EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html]
-synonym: "intron gain" EXACT []
-xref: EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html
-is_a: SO:0001568 ! splicing_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:31:25Z
-
-[Term]
-id: SO:0001574
-name: splice_acceptor_variant
-def: "A splice variant that changes the 2 base region at the 3' end of an intron." [SO:ke]
-synonym: "splice acceptor variant" EXACT []
-is_a: SO:0001629 ! splice_site_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:31:52Z
-
-[Term]
-id: SO:0001575
-name: splice_donor_variant
-def: "A splice variant that changes the2 base region at the 5' end of an intron." [SO:ke]
-synonym: "splice donor variant" EXACT []
-is_a: SO:0001629 ! splice_site_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:32:10Z
-
-[Term]
-id: SO:0001576
-name: transcript_variant
-def: "A sequence variant that changes the structure of the transcript." [SO:ke]
-synonym: "transcript variant" EXACT []
-xref: EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html
-is_a: SO:0001564 ! gene_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:32:41Z
-
-[Term]
-id: SO:0001577
-name: complex_change_in_transcript
-def: "A transcript variant with a complex INDEL- Insertion or deletion that spans an exon/intron border or a coding sequence/UTR border." [http://uswest.ensembl.org/info/docs/variation/index.html]
-comment: EBI term: Complex InDel - Insertion or deletion that spans an exon/intron border or a coding sequence/UTR border.
-synonym: "complex_indel" EXACT ebi_variants [http://uswest.ensembl.org/info/docs/variation/index.html]
-synonym: "complext change in transcript" EXACT []
-is_a: SO:0001576 ! transcript_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:33:03Z
-
-[Term]
-id: SO:0001578
-name: stop_lost
-def: "A sequence variant where at least one base of the terminator codon (stop) is changed, resulting in an elongated transcript." [SO:ke]
-comment: EBI term: Stop lost - In coding sequence, resulting in the loss of a stop codon.
-synonym: "stop codon lost" EXACT []
-synonym: "stop lost" EXACT []
-synonym: "stop_lost" EXACT ebi_variants [http://uswest.ensembl.org/info/docs/variation/index.html]
-is_a: SO:0001590 ! terminator_codon_variant
-is_a: SO:0001650 ! inframe_variant
-is_a: SO:0001818 ! non_synonymous_variant
-created_by: kareneilbeck
-creation_date: 2010-03-23T03:46:42Z
-
-[Term]
-id: SO:0001579
-name: transcript_sequence_variant
-synonym: "transcript sequence variant" EXACT []
-is_obsolete: true
-
-[Term]
-id: SO:0001580
-name: coding_sequence_variant
-def: "A sequence variant that changes the coding sequence." [SO:ke]
-synonym: "coding sequence variant" EXACT []
-is_a: SO:0001791 ! exon_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:34:36Z
-
-[Term]
-id: SO:0001581
-name: codon_variant
-def: "A sequence variant that changes at least one base in a codon." [SO:ke]
-synonym: "coding variant" EXACT []
-synonym: "codon variant" EXACT []
-xref: EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html
-is_a: SO:0001580 ! coding_sequence_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:34:56Z
-
-[Term]
-id: SO:0001582
-name: initiator_codon_change
-def: "A codon variant that changes at least one base of the first codon of a transcript." [SO:ke]
-synonym: "initiator codon change" EXACT []
-xref: EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html
-is_a: SO:0001583 ! non_synonymous_codon
-is_a: SO:0001650 ! inframe_variant
-is_a: SO:0001818 ! non_synonymous_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:35:18Z
-
-[Term]
-id: SO:0001583
-name: non_synonymous_codon
-alt_id: SO:0001584
-def: "A sequence variant, where the change may be longer than 3 bases, and at least one base of a codon is changed resulting in a codon that encodes for a different amino acid or stop codon." [EBI:gr, SO:ke]
-comment: EBI term: Non-synonymous SNPs. SNPs that are located in the coding sequence and result in an amino acid change in the encoded peptide sequence. A change that causes a non_synonymous_codon can be more than 3 bases - for example 4 base substitution.
-synonym: "non synonymous codon" EXACT []
-synonym: "non_synonymous_coding" EXACT ebi_variants [http://uswest.ensembl.org/info/docs/variation/index.html]
-xref: EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html
-is_a: SO:0001581 ! codon_variant
-is_a: SO:0001818 ! non_synonymous_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:35:49Z
-
-[Term]
-id: SO:0001585
-name: conservative_missense_codon
-def: "A sequence variant whereby at least one base of a codon is changed resulting in a codon that encodes for a different but similar amino acid. These variants may or may not be deleterious." [SO:ke]
-synonym: "conservative missense codon" EXACT []
-synonym: "neutral missense codon" RELATED []
-synonym: "quiet missense codon" RELATED []
-xref: EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html
-is_a: SO:0001783 ! missense_codon
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:36:40Z
-
-[Term]
-id: SO:0001586
-name: non_conservative_missense_codon
-def: "A sequence variant whereby at least one base of a codon is changed resulting in a codon that encodes for an amino acid with different biochemical properties." [SO:ke]
-synonym: "non conservative missense codon" EXACT []
-xref: EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html
-is_a: SO:0001783 ! missense_codon
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:37:16Z
-
-[Term]
-id: SO:0001587
-name: stop_gained
-def: "A sequence variant whereby at least one base of a codon is changed, resulting in a premature stop codon, leading to a shortened transcript." [SO:ke]
-comment: EBI term: Stop gained - In coding sequence, resulting in the gain of a stop codon (i.e. leading to a shortened peptide sequence).
-synonym: "nonsense" EXACT dbsnp [ftp://ftp.ncbi.nih.gov/snp/specs/docsum_3.1.xsd]
-synonym: "nonsense codon" EXACT []
-synonym: "stop codon gained" RELATED []
-synonym: "stop gained" EXACT []
-synonym: "stop_gained" EXACT ebi_variants [http://uswest.ensembl.org/info/docs/variation/index.html]
-is_a: SO:0001583 ! non_synonymous_codon
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:37:52Z
-
-[Term]
-id: SO:0001588
-name: synonymous_codon
-def: "A sequence variant whereby a base of a codon is changed, but there is no resulting change to the encoded amino acid." [SO:ke]
-comment: EBI term: Synonymous SNPs - In coding sequence, not resulting in an amino acid change (i.e. silent mutation).\nThis term is sometimes used synonomously with the more general term 'silent mutation', although a silent mutation may occur in non coding sequence. The best practice is to annotate to the most specific term.
-synonym: "coding-synon" EXACT dbsnp [ftp://ftp.ncbi.nih.gov/snp/specs/docsum_3.1.xsd]
-synonym: "silent mutation" RELATED []
-synonym: "silent substitution" RELATED []
-synonym: "silent_mutation" RELATED []
-synonym: "synonymous codon" EXACT []
-synonym: "synonymous_coding" EXACT ebi_variants []
-xref: EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html
-xref: http://en.wikipedia.org/wiki/Silent_mutation "wiki"
-xref: http://en.wikipedia.org/wiki/Synonymous_mutation
-is_a: SO:0001581 ! codon_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:39:38Z
-
-[Term]
-id: SO:0001589
-name: frameshift_variant
-def: "A sequence variant which causes a disruption of the translational reading frame, because the number of nucleotides inserted or deleted is not a multiple of three." [SO:ke]
-comment: EBI term:Frameshift variations - In coding sequence, resulting in a frameshift.
-synonym: "frameshift variant" EXACT []
-synonym: "frameshift_" EXACT dbsnp [ftp://ftp.ncbi.nih.gov/snp/specs/docsum_3.1.xsd]
-synonym: "frameshift_coding" EXACT ebi_variants [http://uswest.ensembl.org/info/docs/variation/index.html]
-is_a: SO:0001580 ! coding_sequence_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:40:19Z
-
-[Term]
-id: SO:0001590
-name: terminator_codon_variant
-def: "A sequence variant whereby at least one of the bases in the terminator codon is changed." [SO:ke]
-synonym: "terminator codon variant" EXACT []
-is_a: SO:0001625 ! terminal_codon_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:40:37Z
-
-[Term]
-id: SO:0001591
-name: frame_restoring_variant
-def: "A sequence variant that reverts the sequence of a previous frameshift mutation back to the initial frame." [SO:ke]
-synonym: "frame restoring variant" EXACT []
-is_a: SO:0001589 ! frameshift_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:41:09Z
-
-[Term]
-id: SO:0001592
-name: minus_1_frameshift_variant
-def: "A sequence variant which causes a disruption of the translational reading frame, by shifting one base ahead." [http://arjournals.annualreviews.org/doi/pdf/10.1146/annurev.ge.08.120174.001535]
-synonym: "-1 frameshift variant" EXACT []
-synonym: "minus 1 frameshift variant" EXACT []
-is_a: SO:0001589 ! frameshift_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:41:30Z
-
-[Term]
-id: SO:0001593
-name: minus_2_frameshift_variant
-synonym: "-2 frameshift variant" EXACT []
-synonym: "minus 2 frameshift variant" EXACT []
-is_a: SO:0001589 ! frameshift_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:41:52Z
-
-[Term]
-id: SO:0001594
-name: plus_1_frameshift_variant
-def: "A sequence variant which causes a disruption of the translational reading frame, by shifting one base backward." [http://arjournals.annualreviews.org/doi/pdf/10.1146/annurev.ge.08.120174.001535]
-synonym: "+1 frameshift variant" EXACT []
-synonym: "plus 1 frameshift variant" EXACT []
-is_a: SO:0001589 ! frameshift_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:42:06Z
-
-[Term]
-id: SO:0001595
-name: plus_2_frameshift variant
-synonym: "+2 frameshift variant" EXACT []
-synonym: "plus 2 frameshift variant" EXACT []
-is_a: SO:0001589 ! frameshift_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:42:23Z
-
-[Term]
-id: SO:0001596
-name: transcript_secondary_structure_variant
-def: "A sequence variant within a transcript that changes the secondary structure of the RNA product." [SO:ke]
-synonym: "transcript secondary structure variant" EXACT []
-is_a: SO:0001576 ! transcript_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:43:18Z
-
-[Term]
-id: SO:0001597
-name: compensatory_transcript_secondary_structure_variant
-def: "A secondary structure variant that compensate for the change made by a previous variant." [SO:ke]
-synonym: "compensatory transcript secondary structure variant" EXACT []
-is_a: SO:0001596 ! transcript_secondary_structure_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:43:54Z
-
-[Term]
-id: SO:0001598
-name: translational_product_structure_variant
-def: "A sequence variant within the transcript that changes the structure of the translational product." [SO:ke]
-synonym: "translational product structure variant" EXACT []
-xref: EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html
-is_a: SO:0001564 ! gene_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:44:17Z
-
-[Term]
-id: SO:0001599
-name: 3D_polypeptide_structure_variant
-def: "A sequence variant that changes the resulting polypeptide structure." [SO:ke]
-synonym: "3D polypeptide structure variant" EXACT []
-is_a: SO:0001598 ! translational_product_structure_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:44:46Z
-
-[Term]
-id: SO:0001600
-name: complex_3D_structural_variant
-def: "A sequence variant that changes the resulting polypeptide structure." [SO:ke]
-synonym: "complex 3D structural variant" EXACT []
-is_a: SO:0001599 ! 3D_polypeptide_structure_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:45:13Z
-
-[Term]
-id: SO:0001601
-name: conformational_change_variant
-def: "A sequence variant in the CDS region that causes a conformational change in the resulting polypeptide sequence." [SO:ke]
-synonym: "conformational change variant" EXACT []
-is_a: SO:0001599 ! 3D_polypeptide_structure_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:45:48Z
-
-[Term]
-id: SO:0001602
-name: complex_change_of_translational_product_variant
-synonym: "complex change of translational product variant" EXACT []
-is_a: SO:0001598 ! translational_product_structure_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:46:54Z
-
-[Term]
-id: SO:0001603
-name: polypeptide_sequence_variant
-def: "A sequence variant with in the CDS that causes a change in the resulting polypeptide sequence." [SO:ke]
-synonym: "polypeptide sequence variant" EXACT []
-is_a: SO:0001598 ! translational_product_structure_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:47:13Z
-
-[Term]
-id: SO:0001604
-name: amino_acid_deletion
-def: "A sequence variant within a CDS resulting in the loss of an amino acid from the resulting polypeptide." [SO:ke]
-synonym: "amino acid deletion" EXACT []
-xref: EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html
-is_a: SO:0001603 ! polypeptide_sequence_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:47:36Z
-
-[Term]
-id: SO:0001605
-name: amino_acid_insertion
-def: "A sequence variant within a CDS resulting in the gain of an amino acid to the resulting polypeptide." [SO:ke]
-synonym: "amino acid insertion" EXACT []
-xref: EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html
-is_a: SO:0001603 ! polypeptide_sequence_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:47:56Z
-
-[Term]
-id: SO:0001606
-name: amino_acid_substitution
-def: "A sequence variant of a codon resulting in the substitution of one amino acid for another in the resulting polypeptide." [SO:ke]
-synonym: "amino acid substitution" EXACT []
-xref: EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html
-is_a: SO:0001603 ! polypeptide_sequence_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:48:17Z
-
-[Term]
-id: SO:0001607
-name: conservative_amino_acid_substitution
-def: "A sequence variant of a codon causing the substitution of a similar amino acid for another in the resulting polypeptide." [SO:ke]
-synonym: "conservative amino acid substitution" EXACT []
-is_a: SO:0001606 ! amino_acid_substitution
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:48:57Z
-
-[Term]
-id: SO:0001608
-name: non_conservative_amino_acid_substitution
-def: "A sequence variant of a codon causing the substitution of a non conservative amino acid for another in the resulting polypeptide." [SO:ke]
-synonym: "non conservative amino acid substitution" EXACT []
-is_a: SO:0001606 ! amino_acid_substitution
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:49:23Z
-
-[Term]
-id: SO:0001609
-name: elongated_polypeptide
-def: "A sequence variant with in the CDS that causes elongation of the resulting polypeptide sequence." [SO:ke]
-synonym: "elongated polypeptide" EXACT []
-xref: EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html
-is_a: SO:0001603 ! polypeptide_sequence_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:49:52Z
-
-[Term]
-id: SO:0001610
-name: elongated_polypeptide_C_terminal
-def: "A sequence variant with in the CDS that causes elongation of the resulting polypeptide sequence at the C terminus." [SO:ke]
-synonym: "elongated polypeptide C terminal" EXACT []
-is_a: SO:0001609 ! elongated_polypeptide
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:50:20Z
-
-[Term]
-id: SO:0001611
-name: elongated_polypeptide_N_terminal
-def: "A sequence variant with in the CDS that causes elongation of the resulting polypeptide sequence at the N terminus." [SO:ke]
-synonym: "elongated polypeptide N terminal" EXACT []
-is_a: SO:0001609 ! elongated_polypeptide
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:50:31Z
-
-[Term]
-id: SO:0001612
-name: elongated_in_frame_polypeptide_C_terminal
-def: "A sequence variant with in the CDS that causes in frame elongation of the resulting polypeptide sequence at the C terminus." [SO:ke]
-synonym: "elongated in frame polypeptide C terminal" EXACT []
-is_a: SO:0001610 ! elongated_polypeptide_C_terminal
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:51:05Z
-
-[Term]
-id: SO:0001613
-name: elongated_out_of_frame_polypeptide_C_terminal
-def: "A sequence variant with in the CDS that causes out of frame elongation of the resulting polypeptide sequence at the C terminus." [SO:ke]
-synonym: "elongated polypeptide out of frame C terminal" EXACT []
-is_a: SO:0001610 ! elongated_polypeptide_C_terminal
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:51:20Z
-
-[Term]
-id: SO:0001614
-name: elongated_in_frame_polypeptide_N_terminal_elongation
-def: "A sequence variant with in the CDS that causes in frame elongation of the resulting polypeptide sequence at the N terminus." [SO:ke]
-synonym: "elongated in frame polypeptide N terminal" EXACT []
-is_a: SO:0001611 ! elongated_polypeptide_N_terminal
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:51:49Z
-
-[Term]
-id: SO:0001615
-name: elongated_out_of_frame_polypeptide_N_terminal
-def: "A sequence variant with in the CDS that causes out of frame elongation of the resulting polypeptide sequence at the N terminus." [SO:ke]
-synonym: "elongated out of frame N terminal" EXACT []
-is_a: SO:0001611 ! elongated_polypeptide_N_terminal
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:52:05Z
-
-[Term]
-id: SO:0001616
-name: polypeptide_fusion
-def: "A sequence variant that causes a fusion of two polypeptide sequences." [SO:ke]
-synonym: "polypeptide fusion" EXACT []
-is_a: SO:0001603 ! polypeptide_sequence_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:52:43Z
-
-[Term]
-id: SO:0001617
-name: polypeptide_truncation
-def: "A sequence variant of the CD that causes a truncation of the resulting polypeptide." [SO:ke]
-synonym: "polypeptide truncation" EXACT []
-xref: EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html
-is_a: SO:0001603 ! polypeptide_sequence_variant
-created_by: kareneilbeck
-creation_date: 2010-03-22T02:53:07Z
-
-[Term]
-id: SO:0001618
-name: inactive_catalytic_site
-def: "A sequence variant that causes the inactivation of a catalytic site with respect to a reference sequence." [SO:ke]
-synonym: "inactive catalytic site" EXACT []
-is_a: SO:0001560 ! inactive_ligand_binding_site
-created_by: kareneilbeck
-creation_date: 2010-03-22T03:06:14Z
-
-[Term]
-id: SO:0001619
-name: nc_transcript_variant
-def: "A transcript variant of a non coding RNA gene." [SO:ke]
-comment: Within non-coding gene - Located within a gene that does not code for a protein.
-synonym: "nc transcript variant" EXACT []
-synonym: "non coding transcript variant" EXACT []
-synonym: "within_non_coding_gene" EXACT dbsnp [http://uswest.ensembl.org/info/docs/variation/index.html]
-is_a: SO:0001576 ! transcript_variant
-created_by: kareneilbeck
-creation_date: 2010-03-23T11:16:23Z
-
-[Term]
-id: SO:0001620
-name: mature_miRNA_variant
-def: "A transcript variant located with the sequence of the mature miRNA." [SO:ke]
-comment: EBI term: Within mature miRNA - Located within a microRNA.
-synonym: "mature miRNA variant" EXACT []
-synonym: "within_mature_miRNA" EXACT ebi_variants [http://uswest.ensembl.org/info/docs/variation/index.html]
-is_a: SO:0001619 ! nc_transcript_variant
-created_by: kareneilbeck
-creation_date: 2010-03-23T11:16:58Z
-
-[Term]
-id: SO:0001621
-name: NMD_transcript_variant
-def: "A variant in a transcript that is the target of NMD." [SO:ke]
-synonym: "NMD transcript variant" EXACT []
-synonym: "NMD_transcript" EXACT ebi_variants [http://uswest.ensembl.org/info/docs/variation/index.html]
-is_a: SO:0001576 ! transcript_variant
-created_by: kareneilbeck
-creation_date: 2010-03-23T11:20:40Z
-
-[Term]
-id: SO:0001622
-name: UTR_variant
-def: "A transcript variant that is located within the UTR." [SO:ke]
-synonym: "UTR variant" EXACT []
-synonym: "UTR_" EXACT ebi_variants [http://uswest.ensembl.org/info/docs/variation/index.html]
-is_a: SO:0001576 ! transcript_variant
-created_by: kareneilbeck
-creation_date: 2010-03-23T11:22:58Z
-
-[Term]
-id: SO:0001623
-name: 5_prime_UTR_variant
-def: "A UTR variant of the 5' UTR." [SO:ke]
-comment: EBI term: 5prime UTR variations - In 5prime UTR (untranslated region).
-synonym: "5'UTR variant" EXACT []
-synonym: "5PRIME_UTR" EXACT ebi_variants [http://uswest.ensembl.org/info/docs/variation/index.html]
-synonym: "five prime UTR variant" EXACT []
-synonym: "untranslated-5" EXACT dbsnp [ftp://ftp.ncbi.nih.gov/snp/specs/docsum_3.1.xsd]
-is_a: SO:0001622 ! UTR_variant
-created_by: kareneilbeck
-creation_date: 2010-03-23T11:23:29Z
-
-[Term]
-id: SO:0001624
-name: 3_prime_UTR_variant
-def: "A UTR variant of the 3' UTR." [SO:ke]
-comment: EBI term 3prime UTR variations - In 3prime UTR.
-synonym: "3'UTR variant" EXACT []
-synonym: "3PRIME_UTR" EXACT ebi_variants [http://uswest.ensembl.org/info/docs/variation/index.html]
-synonym: "three prime UTR variant" EXACT []
-synonym: "untranslated-3" EXACT dbsnp [ftp://ftp.ncbi.nih.gov/snp/specs/docsum_3.1.xsd]
-is_a: SO:0001622 ! UTR_variant
-created_by: kareneilbeck
-creation_date: 2010-03-23T11:23:54Z
-
-[Term]
-id: SO:0001625
-name: terminal_codon_variant
-def: "A codon variant that changes at least one base of the last codon of the transcript." [SO:ke]
-comment: The terminal codon may be the terminator, or in an incomplete transcript the last available codon.
-synonym: "terminal codon variant" EXACT []
-is_a: SO:0001581 ! codon_variant
-created_by: kareneilbeck
-creation_date: 2010-03-23T03:49:55Z
-
-[Term]
-id: SO:0001626
-name: incomplete_terminal_codon_variant
-def: "A sequence variant where at least one base of the final codon of an incompletely annotated transcript is changed." [SO:ke]
-comment: EBI term: Partial codon - Located within the final, incomplete codon of a transcript with a shortened coding sequence where the end is unknown.
-synonym: "incomplete terminal codon variant" EXACT []
-synonym: "partial_codon" EXACT ebi_variants [http://uswest.ensembl.org/info/docs/variation/index.html]
-is_a: SO:0001625 ! terminal_codon_variant
-created_by: kareneilbeck
-creation_date: 2010-03-23T03:51:15Z
-
-[Term]
-id: SO:0001627
-name: intron_variant
-def: "A transcript variant occurring within an intron." [SO:ke]
-comment: EBI term: Intronic variations - In intron.
-synonym: "intron variant" EXACT []
-synonym: "intron_" EXACT dbsnp [ftp://ftp.ncbi.nih.gov/snp/specs/docsum_3.1.xsd]
-synonym: "intronic" EXACT ebi_variants [http://uswest.ensembl.org/info/docs/variation/index.html]
-is_a: SO:0001576 ! transcript_variant
-created_by: kareneilbeck
-creation_date: 2010-03-23T03:52:38Z
-
-[Term]
-id: SO:0001628
-name: intergenic_variant
-def: "A sequence variant located in the intergenic region, between genes." [SO:ke]
-comment: EBI term Intergenic variations - More than 5 kb either upstream or downstream of a transcript.
-synonym: "intergenic" EXACT ebi_variants [http://uswest.ensembl.org/info/docs/variation/index.html]
-synonym: "intergenic variant" EXACT []
-is_a: SO:0001537 ! structural_variant
-created_by: kareneilbeck
-creation_date: 2010-03-23T05:07:37Z
-
-[Term]
-id: SO:0001629
-name: splice_site_variant
-def: "A sequence variant that changes the first two or last two bases of an intron, or the 5th base from the start of the intron in the orientation of the transcript." [http://uswest.ensembl.org/info/docs/variation/index.html]
-comment: EBI term - essential splice site - In the first 2 or the last 2 base pairs of an intron. The 5th base is on the donor (5') side of the intron. Updated to b in line with Cancer Genome Project at the Sanger.
-synonym: "essential_splice_site" EXACT ebi_variants [http://uswest.ensembl.org/info/docs/variation/index.html]
-synonym: "splice site variant" EXACT []
-is_a: SO:0001627 ! intron_variant
-created_by: kareneilbeck
-creation_date: 2010-03-24T09:42:00Z
-
-[Term]
-id: SO:0001630
-name: splice_region_variant
-def: "A sequence variant in which a change has occurred within the region of the splice site, either within 1-3 bases of the exon or 3-8 bases of the intron." [http://uswest.ensembl.org/info/docs/variation/index.html]
-comment: EBI term: splice site - 1-3 bps into an exon or 3-8 bps into an intron.
-synonym: "splice region variant" EXACT []
-synonym: "splice_region_variant" EXACT ebi_variants [http://uswest.ensembl.org/info/docs/variation/index.html]
-is_a: SO:0001568 ! splicing_variant
-created_by: kareneilbeck
-creation_date: 2010-03-24T09:46:02Z
-
-[Term]
-id: SO:0001631
-name: upstream_gene_variant
-def: "A sequence variant located 5' of a gene." [SO:ke]
-comment: Different groups annotate up and downstream to different lengths. The subtypes are specific and are backed up with cross references.
-synonym: "upstream gene variant" EXACT []
-is_a: SO:0001537 ! structural_variant
-created_by: kareneilbeck
-creation_date: 2010-03-24T09:49:13Z
-
-[Term]
-id: SO:0001632
-name: downstream_gene_variant
-def: "A sequence variant located 3' of a gene." [SO:ke]
-comment: Different groups annotate up and downstream to different lengths. The subtypes are specific and are backed up with cross references.
-synonym: "downstream gene variant" EXACT []
-is_a: SO:0001537 ! structural_variant
-created_by: kareneilbeck
-creation_date: 2010-03-24T09:49:38Z
-
-[Term]
-id: SO:0001633
-name: 5KB_downstream_variant
-def: "A sequence variant located within 5 KB of the end of a gene." [SO:ke]
-comment: EBI term Downstream variations - Within 5 kb downstream of the 3prime end of a transcript.
-synonym: "5KB downstream variant" EXACT []
-synonym: "downstream" EXACT ebi_variants [http://uswest.ensembl.org/info/docs/variation/index.html]
-synonym: "within 5KB downstream" RELATED []
-is_a: SO:0001632 ! downstream_gene_variant
-created_by: kareneilbeck
-creation_date: 2010-03-24T09:50:16Z
-
-[Term]
-id: SO:0001634
-name: 500B_downstream_variant
-def: "A sequence variant located within a half KB of the end of a gene." [SO:ke]
-synonym: "500B downstream variant" EXACT []
-synonym: "near-gene-3" EXACT dbsnp [ftp://ftp.ncbi.nih.gov/snp/specs/docsum_3.1.xsd]
-is_a: SO:0001633 ! 5KB_downstream_variant
-created_by: kareneilbeck
-creation_date: 2010-03-24T09:50:42Z
-
-[Term]
-id: SO:0001635
-name: 5KB_upstream_variant
-def: "A sequence variant located within 5KB 5' of a gene." [SO:ke]
-comment: EBI term Upstream variations - Within 5 kb upstream of the 5prime end of a transcript.
-synonym: "5kb upstream variant" EXACT []
-synonym: "upstream" EXACT ebi_variants [http://uswest.ensembl.org/info/docs/variation/index.html]
-is_a: SO:0001631 ! upstream_gene_variant
-created_by: kareneilbeck
-creation_date: 2010-03-24T09:51:06Z
-
-[Term]
-id: SO:0001636
-name: 2KB_upstream_variant
-def: "A sequence variant located within 2KB 5' of a gene." [SO:ke]
-synonym: "2KB upstream variant" EXACT []
-synonym: "near-gene-5" EXACT dbsnp [ftp://ftp.ncbi.nih.gov/snp/specs/docsum_3.1.xsd]
-is_a: SO:0001635 ! 5KB_upstream_variant
-created_by: kareneilbeck
-creation_date: 2010-03-24T09:51:22Z
-
-[Term]
-id: SO:0001637
-name: rRNA_gene
-def: "A gene that encodes for ribosomal RNA." [SO:ke]
-synonym: "rRNA gene" EXACT []
-is_a: SO:0001263 ! ncRNA_gene
-created_by: kareneilbeck
-creation_date: 2010-04-21T10:10:32Z
-
-[Term]
-id: SO:0001638
-name: piRNA_gene
-def: "A gene that encodes for an piwi associated RNA." [SO:ke]
-synonym: "piRNA gene" EXACT []
-is_a: SO:0001263 ! ncRNA_gene
-created_by: kareneilbeck
-creation_date: 2010-04-21T10:11:36Z
-
-[Term]
-id: SO:0001639
-name: RNase_P_RNA_gene
-def: "A gene that encodes an RNase P RNA." [SO:ke]
-synonym: "RNase P RNA gene" EXACT []
-is_a: SO:0001263 ! ncRNA_gene
-created_by: kareneilbeck
-creation_date: 2010-04-21T10:13:23Z
-
-[Term]
-id: SO:0001640
-name: RNase_MRP_RNA_gene
-def: "A gene that encodes a RNase_MRP_RNA." [SO:ke]
-synonym: "RNase MRP RNA gene" RELATED []
-is_a: SO:0001263 ! ncRNA_gene
-created_by: kareneilbeck
-creation_date: 2010-04-21T10:13:58Z
-
-[Term]
-id: SO:0001641
-name: lincRNA_gene
-def: "A gene that encodes large intervening non-coding RNA." [SO:ke]
-synonym: "lincRNA gene" EXACT []
-is_a: SO:0001263 ! ncRNA_gene
-created_by: kareneilbeck
-creation_date: 2010-04-21T10:14:24Z
-
-[Term]
-id: SO:0001642
-name: mathematically_defined_repeat
-def: "A mathematically defined repeat (MDR) is a experimental feature that is determined by querying overlapping oligomers of length k against a database of shotgun sequence data and identifying regions in the query sequence that exceed a statistically determined threshold of repetitiveness." [SO:jestill]
-comment: Mathematically defined repeat regions are determined without regard to the biological origin of the repetitive region. The repeat units of a MDR are the overlapping oligomers of size k that were used to for the query. Tools that can annotate mathematically defined repeats include Tallymer (Kurtz et al 2008, BMC Genomics: 517) and RePS (Wang et al, Genome Res 12(5): 824-831.).
-synonym: "mathematically defined repeat" EXACT []
-is_a: SO:0001410 ! experimental_feature
-created_by: kareneilbeck
-creation_date: 2010-05-03T11:50:14Z
-
-[Term]
-id: SO:0001643
-name: telomerase_RNA_gene
-def: "A telomerase RNA gene is a non coding RNA gene the RNA product of which is a component of telomerase." [SO:ke]
-synonym: "Telomerase RNA component" EXACT []
-synonym: "telomerase RNA gene" EXACT []
-synonym: "TERC" EXACT []
-xref: http:http\://en.wikipedia.org/wiki/Telomerase_RNA_component "wikipedia"
-is_a: SO:0001263 ! ncRNA_gene
-created_by: kareneilbeck
-creation_date: 2010-05-18T05:26:38Z
-
-[Term]
-id: SO:0001644
-name: targeting_vector
-def: "An engineered vector that is able to take part in homologous recombination in a host with the intent of introducing site specific genomic modifications." [MGD:tm, PMID:10354467]
-synonym: "targeting vector" RELATED []
-is_a: SO:0000440 ! vector_replicon
-is_a: SO:0000804 ! implied link automatically realized ! engineered_region
-intersection_of: SO:0000440 ! vector_replicon
-intersection_of: has_part SO:0000853 ! homologous_region
-intersection_of: has_quality SO:0000783 ! engineered
-created_by: kareneilbeck
-creation_date: 2010-05-28T02:05:25Z
-
-[Term]
-id: SO:0001645
-name: genetic_marker
-def: "A measurable sequence feature that varies within a population." [SO:db]
-synonym: "genetic marker" RELATED []
-is_a: SO:0001411 ! biological_region
-created_by: kareneilbeck
-creation_date: 2010-05-28T02:33:07Z
-
-[Term]
-id: SO:0001646
-name: DArT_marker
-def: "A genetic marker, discovered using Diversity Arrays Technology (DArT) technology." [SO:ke]
-synonym: "DArT marker" EXACT []
-is_a: SO:0001645 ! genetic_marker
-created_by: kareneilbeck
-creation_date: 2010-05-28T02:34:43Z
-
-[Term]
-id: SO:0001647
-name: kozak_sequence
-def: "A kind of ribosome entry site, specific to Eukaryotic organisms that overlaps part of both 5' UTR and CDS sequence." [SO:ke]
-subset: SOFA
-synonym: "kozak consensus" EXACT []
-synonym: "kozak consensus sequence" EXACT []
-synonym: "kozak sequence" EXACT []
-xref: http://en.wikipedia.org/wiki/Kozak_consensus_sequence "wikipedia"
-is_a: SO:0000139 ! ribosome_entry_site
-created_by: kareneilbeck
-creation_date: 2010-06-07T03:12:20Z
-
-[Term]
-id: SO:0001648
-name: nested_transposon
-def: "A transposon that is disrupted by the insertion of another element." [SO:ke]
-synonym: "nested transposon" EXACT []
-is_a: SO:0000101 ! transposable_element
-created_by: kareneilbeck
-creation_date: 2010-06-23T03:22:57Z
-
-[Term]
-id: SO:0001649
-name: nested_repeat
-def: "A repeat that is disrupted by the insertion of another element." [SO:ke]
-synonym: "nested repeat" RELATED []
-is_a: SO:0000657 ! repeat_region
-created_by: kareneilbeck
-creation_date: 2010-06-23T03:24:55Z
-
-[Term]
-id: SO:0001650
-name: inframe_variant
-def: "A sequence variant which does not cause a disruption of the translational reading frame." [SO:ke]
-synonym: "cds-indel" EXACT dbsnp []
-synonym: "inframe variant" EXACT []
-is_a: SO:0001580 ! coding_sequence_variant
-created_by: kareneilbeck
-creation_date: 2010-07-19T01:24:44Z
-
-[Term]
-id: SO:0001651
-name: inframe_codon_gain
-def: "A sequence variant which gains a codon, and does not cause a disruption of the translational reading frame." [SO:ke]
-synonym: "inframe codon gain" RELATED []
-is_a: SO:0001821 ! inframe_increase_in_CDS_length
-created_by: kareneilbeck
-creation_date: 2010-07-19T01:29:08Z
-
-[Term]
-id: SO:0001652
-name: inframe_codon_loss
-def: "A sequence variant which loses a codon, and does not cause a disruption of the translational reading frame." [SO:ke]
-synonym: "inframe codon loss" RELATED []
-is_a: SO:0001822 ! inframe_decrease_in_CDS_length
-created_by: kareneilbeck
-creation_date: 2010-07-19T01:29:35Z
-
-[Term]
-id: SO:0001653
-name: retinoic_acid_responsive_element
-def: "A transcription factor binding site of variable direct repeats of the sequence PuGGTCA spaced by five nucleotides (DR5) found in the promoters of retinoic acid-responsive genes, to which retinoic acid receptors bind." [PMID:11327309, PMID:19917671]
-synonym: "RARE" EXACT []
-synonym: "retinoic acid responsive element" EXACT []
-is_a: SO:0000713 ! DNA_motif
-relationship: part_of SO:0000167 ! promoter
-created_by: kareneilbeck
-creation_date: 2010-08-03T10:46:12Z
-
-[Term]
-id: SO:0001654
-name: nucleotide_to_protein_binding_site
-def: "A binding site that, in the nucleotide molecule, interacts selectively and non-covalently with polypeptide residues." [SO:ke]
-subset: SOFA
-synonym: "nucleotide to protein binding site" RELATED []
-is_a: SO:0000410 ! protein_binding_site
-created_by: kareneilbeck
-creation_date: 2010-08-03T12:26:05Z
-
-[Term]
-id: SO:0001655
-name: nucleotide_binding_site
-def: "A binding site that, in the molecule, interacts selectively and non-covalently with nucleotide residues." [SO:cb]
-comment: See GO:0000166 : nucleotide binding.
-synonym: "nucleotide binding site" EXACT []
-is_a: SO:0000409 ! binding_site
-created_by: kareneilbeck
-creation_date: 2010-08-03T12:30:04Z
-
-[Term]
-id: SO:0001656
-name: metal_binding_site
-def: "A binding site that, in the molecule, interacts selectively and non-covalently with metal ions." [SO:cb]
-comment: See GO:0046872 : metal ion binding.
-synonym: "metal binding site" RELATED []
-is_a: SO:0000409 ! binding_site
-created_by: kareneilbeck
-creation_date: 2010-08-03T12:31:42Z
-
-[Term]
-id: SO:0001657
-name: ligand_binding_site
-def: "A binding site that, in the molecule, interacts selectively and non-covalently with a small molecule such as a drug, or hormone." [SO:ke]
-synonym: "ligand binding site" EXACT []
-is_a: SO:0000409 ! binding_site
-created_by: kareneilbeck
-creation_date: 2010-08-03T12:32:58Z
-
-[Term]
-id: SO:0001658
-name: nested_tandem_repeat
-def: "An NTR is a nested repeat of two distinct tandem motifs interspersed with each other." [SO:AF]
-comment: Tracker ID: 3052459.
-synonym: "nested tandem repeat" EXACT []
-synonym: "NTR" EXACT []
-is_a: SO:0001649 ! nested_repeat
-created_by: kareneilbeck
-creation_date: 2010-08-26T09:36:16Z
-
-[Term]
-id: SO:0001659
-name: promoter_element
-synonym: "promoter element" EXACT []
-is_a: SO:0000713 ! DNA_motif
-relationship: overlaps SO:0000235 ! TF_binding_site
-created_by: kareneilbeck
-creation_date: 2010-10-01T11:48:32Z
-
-[Term]
-id: SO:0001660
-name: core_promoter_element
-synonym: "core promoter element" EXACT []
-synonym: "general transcription factor binding site" RELATED []
-is_a: SO:0001659 ! promoter_element
-created_by: kareneilbeck
-creation_date: 2010-10-01T11:49:03Z
-
-[Term]
-id: SO:0001661
-name: RNA_polymerase_II_TATA_box
-def: "A TATA box core promoter of a gene transcribed by RNA polymerase II." [PMID:16858867]
-synonym: "RNA polymerase II TATA box" EXACT []
-is_a: SO:0000174 ! TATA_box
-relationship: part_of SO:0001669 ! RNApol_II_core_promoter
-created_by: kareneilbeck
-creation_date: 2010-10-01T02:42:12Z
-
-[Term]
-id: SO:0001662
-name: RNA_polymerase_III_TATA_box
-def: "A TATA box core promoter of a gene transcribed by RNA polymerase III." [SO:ke]
-synonym: "RNA polymerase III TATA box" EXACT []
-is_a: SO:0000174 ! TATA_box
-relationship: part_of SO:0000171 ! RNApol_III_promoter
-created_by: kareneilbeck
-creation_date: 2010-10-01T02:43:16Z
-
-[Term]
-id: SO:0001663
-name: BREd_motif
-def: "A core TRNA polymerase II promoter element with consensus (G/A)T(T/G/A)(T/A)(G/T)(T/G)(T/G)." [PMID:16858867]
-synonym: "BREd" EXACT []
-synonym: "BREd motif" RELATED []
-is_a: SO:0001660 ! core_promoter_element
-relationship: part_of SO:0001669 ! RNApol_II_core_promoter
-created_by: kareneilbeck
-creation_date: 2010-10-01T02:49:55Z
-
-[Term]
-id: SO:0001664
-name: DCE
-def: "A discontinuous core element of RNA polymerase II transcribed genes, situated downstream of the TSS. It is composed of three sub elements: SI, SII and SIII." [PMID:16858867]
-synonym: "downstream core element" RELATED []
-is_a: SO:0001660 ! core_promoter_element
-relationship: part_of SO:0001669 ! RNApol_II_core_promoter
-created_by: kareneilbeck
-creation_date: 2010-10-01T02:56:41Z
-
-[Term]
-id: SO:0001665
-name: DCE_SI
-def: "A sub element of the DCE core promoter element, with consensus sequence CTTC." [PMID:16858867, SO:ke]
-synonym: "DCE SI" RELATED []
-is_a: SO:0000713 ! DNA_motif
-relationship: part_of SO:0001664 ! DCE
-created_by: kareneilbeck
-creation_date: 2010-10-01T03:00:10Z
-
-[Term]
-id: SO:0001666
-name: DCE_SII
-def: "A sub element of the DCE core promoter element with consensus sequence CTGT." [PMID:16858867, SO:ke]
-synonym: "DCE SII" EXACT []
-is_a: SO:0000713 ! DNA_motif
-relationship: part_of SO:0001664 ! DCE
-created_by: kareneilbeck
-creation_date: 2010-10-01T03:00:30Z
-
-[Term]
-id: SO:0001667
-name: DCE_SIII
-def: "A sub element of the DCE core promoter element with consensus sequence AGC." [PMID:16858867, SO:ke]
-synonym: "DCE SIII" EXACT []
-is_a: SO:0000713 ! DNA_motif
-relationship: part_of SO:0001664 ! DCE
-created_by: kareneilbeck
-creation_date: 2010-10-01T03:00:44Z
-
-[Term]
-id: SO:0001668
-name: proximal_promoter_element
-synonym: "proximal promoter element" RELATED []
-synonym: "specific transcription factor binding site" RELATED []
-is_a: SO:0001678 ! regulatory_promoter_element
-created_by: kareneilbeck
-creation_date: 2010-10-01T03:10:23Z
-
-[Term]
-id: SO:0001669
-name: RNApol_II_core_promoter
-def: "The minimal portion of the promoter required to properly initiate transcription in RNA polymerase II transcribed genes." [PMID:16858867]
-synonym: "RNApol II core promoter" EXACT []
-is_a: SO:0000170 ! RNApol_II_promoter
-created_by: kareneilbeck
-creation_date: 2010-10-01T03:13:41Z
-
-[Term]
-id: SO:0001670
-name: distal_promoter_element
-synonym: "distal promoter element" RELATED []
-is_a: SO:0001678 ! regulatory_promoter_element
-created_by: kareneilbeck
-creation_date: 2010-10-01T03:21:08Z
-
-[Term]
-id: SO:0001671
-name: bacterial_RNApol_promoter_sigma_70
-synonym: "bacterial RNA polymerase promoter sigma 70" EXACT []
-is_a: SO:0000613 ! bacterial_RNApol_promoter
-created_by: kareneilbeck
-creation_date: 2010-10-06T01:41:34Z
-
-[Term]
-id: SO:0001672
-name: bacterial_RNApol_promoter_sigma54
-synonym: "bacterial RNA polymerase promoter sigma54" EXACT []
-is_a: SO:0000613 ! bacterial_RNApol_promoter
-created_by: kareneilbeck
-creation_date: 2010-10-06T01:42:37Z
-
-[Term]
-id: SO:0001673
-name: minus_12_signal
-def: "A conserved region about 12-bp upstream of the start point of bacterial transcription units, involved with sigma factor 54." [PMID:18331472]
-synonym: "minus 12 signal" EXACT []
-is_a: SO:0000713 ! DNA_motif
-relationship: part_of SO:0001672 ! bacterial_RNApol_promoter_sigma54
-created_by: kareneilbeck
-creation_date: 2010-10-06T01:44:57Z
-
-[Term]
-id: SO:0001674
-name: minus_24_signal
-def: "A conserved region about 12-bp upstream of the start point of bacterial transcription units, involved with sigma factor 54." [PMID:18331472]
-synonym: "minus 24 signal" RELATED []
-is_a: SO:0000713 ! DNA_motif
-relationship: part_of SO:0001672 ! bacterial_RNApol_promoter_sigma54
-created_by: kareneilbeck
-creation_date: 2010-10-06T01:45:24Z
-
-[Term]
-id: SO:0001675
-name: A_box_type_1
-def: "An A box within an RNA polymerase III type 1 promoter." [SO:ke]
-comment: The A box can be found in the promoters of type 1 and type 2 (pol III) so sub-typing here allows the part of relationship of the subtypes to remain true.
-synonym: "A box type 1" RELATED []
-is_a: SO:0000619 ! A_box
-relationship: part_of SO:0000617 ! RNApol_III_promoter_type_1
-created_by: kareneilbeck
-creation_date: 2010-10-06T05:43:43Z
-
-[Term]
-id: SO:0001676
-name: A_box_type_2
-def: "An A box within an RNA polymerase III type 2 promoter." [SO:ke]
-comment: The A box can be found in the promoters of type 1 and type 2 (pol III) so sub-typing here allows the part of relationship of the subtypes to remain true.
-synonym: "A box type 2" RELATED []
-is_a: SO:0000619 ! A_box
-relationship: part_of SO:0000618 ! RNApol_III_promoter_type_2
-created_by: kareneilbeck
-creation_date: 2010-10-06T05:44:18Z
-
-[Term]
-id: SO:0001677
-name: intermediate_element
-def: "A core promoter region of RNA polymerase III type 1 promoters." [PMID:12381659]
-synonym: "IE" EXACT []
-synonym: "intermediate element" RELATED []
-is_a: SO:0001660 ! core_promoter_element
-relationship: part_of SO:0000617 ! RNApol_III_promoter_type_1
-created_by: kareneilbeck
-creation_date: 2010-10-06T05:52:03Z
-
-[Term]
-id: SO:0001678
-name: regulatory_promoter_element
-def: "A promoter element that is not part of the core promoter, but provides the promoter with a specific regulatory region." [PMID:12381659]
-synonym: "regulatory promoter element" RELATED []
-is_a: SO:0001659 ! promoter_element
-created_by: kareneilbeck
-creation_date: 2010-10-07T04:39:48Z
-
-[Term]
-id: SO:0001679
-name: transcription_regulatory_region
-def: "A regulatory region that is involved in the control of the process of transcription." [SO:ke]
-subset: SOFA
-synonym: "transcription regulatory region" EXACT []
-is_a: SO:0005836 ! regulatory_region
-created_by: kareneilbeck
-creation_date: 2010-10-12T03:49:35Z
-
-[Term]
-id: SO:0001680
-name: translation_regulatory_region
-def: "A regulatory region that is involved in the control of the process of translation." [SO:ke]
-synonym: "translation regulatory region" EXACT []
-is_a: SO:0005836 ! regulatory_region
-created_by: kareneilbeck
-creation_date: 2010-10-12T03:52:45Z
-
-[Term]
-id: SO:0001681
-name: recombination_regulatory_region
-def: "A regulatory region that is involved in the control of the process of recombination." [SO:ke]
-synonym: "recombination regulatory region" EXACT []
-is_a: SO:0005836 ! regulatory_region
-created_by: kareneilbeck
-creation_date: 2010-10-12T03:53:35Z
-
-[Term]
-id: SO:0001682
-name: replication_regulatory_region
-def: "A regulatory region that is involved in the control of the process of nucleotide replication." [SO:ke]
-synonym: "replication regulatory region" RELATED []
-is_a: SO:0005836 ! regulatory_region
-created_by: kareneilbeck
-creation_date: 2010-10-12T03:54:09Z
-
-[Term]
-id: SO:0001683
-name: sequence_motif
-def: "A sequence motif is a nucleotide or amino-acid sequence pattern that may have biological significance." [http://en.wikipedia.org/wiki/Sequence_motif]
-subset: SOFA
-synonym: "sequence motif" RELATED []
-xref: http://en.wikipedia.org/wiki/Sequence_motif "wikipedia"
-is_a: SO:0001411 ! biological_region
-created_by: kareneilbeck
-creation_date: 2010-10-14T04:13:22Z
-
-[Term]
-id: SO:0001684
-name: experimental_feature_attribute
-def: "An attribute of an experimentally derived feature." [SO:ke]
-synonym: "experimental feature attribute" RELATED []
-is_a: SO:0000733 ! feature_attribute
-created_by: kareneilbeck
-creation_date: 2010-10-28T02:22:23Z
-
-[Term]
-id: SO:0001685
-name: score
-def: "The score of an experimentally derived feature such as a p-value." [SO:ke]
-is_a: SO:0001684 ! experimental_feature_attribute
-created_by: kareneilbeck
-creation_date: 2010-10-28T02:23:16Z
-
-[Term]
-id: SO:0001686
-name: quality_value
-def: "An experimental feature attribute that defines the quality of the feature in a quantitative way, such as a phred quality score." [SO:ke]
-synonym: "quality value" RELATED []
-is_a: SO:0001684 ! experimental_feature_attribute
-created_by: kareneilbeck
-creation_date: 2010-10-28T02:24:11Z
-
-[Term]
-id: SO:0001687
-name: restriction_enzyme_recognition_site
-def: "The nucleotide region (usually a palindrome) that is recognized by a restriction enzyme. This may or may not be equal to the restriction enzyme binding site." [SO:ke]
-synonym: "restriction endonuclease recognition site" EXACT []
-synonym: "restriction enzyme recognition site" EXACT []
-is_a: SO:0001411 ! biological_region
-created_by: kareneilbeck
-creation_date: 2010-10-29T12:29:57Z
-
-[Term]
-id: SO:0001688
-name: restriction_enzyme_cleavage_junction
-def: "The boundary at which a restriction enzyme breaks the nucleotide sequence." [SO:ke]
-synonym: "restriction enzyme cleavage junction" EXACT []
-is_a: SO:0000699 ! junction
-created_by: kareneilbeck
-creation_date: 2010-10-29T12:35:02Z
-
-[Term]
-id: SO:0001689
-name: five_prime_restriction_enzyme_junction
-def: "The restriction enzyme cleavage junction on the 5' strand of the nucleotide sequence." [SO:ke]
-synonym: "5' restriction enzyme junction" EXACT []
-is_a: SO:0001694 ! single_strand_restriction_enzyme_cleavage_site
-relationship: part_of SO:0001692 ! sticky_end_restriction_enzyme_cleavage_site
-created_by: kareneilbeck
-creation_date: 2010-10-29T12:36:24Z
-
-[Term]
-id: SO:0001690
-name: three_prime_restriction_enzyme_junction
-synonym: "3' restriction enzyme junction" EXACT []
-is_a: SO:0001694 ! single_strand_restriction_enzyme_cleavage_site
-relationship: part_of SO:0001692 ! sticky_end_restriction_enzyme_cleavage_site
-created_by: kareneilbeck
-creation_date: 2010-10-29T12:37:52Z
-
-[Term]
-id: SO:0001691
-name: blunt_end_restriction_enzyme_cleavage_site
-synonym: "blunt end restriction enzyme cleavage site" EXACT []
-is_a: SO:0001687 ! restriction_enzyme_recognition_site
-created_by: kareneilbeck
-creation_date: 2010-10-29T12:39:53Z
-
-[Term]
-id: SO:0001692
-name: sticky_end_restriction_enzyme_cleavage_site
-synonym: "sticky end restriction enzyme cleavage site" RELATED []
-is_a: SO:0001687 ! restriction_enzyme_recognition_site
-created_by: kareneilbeck
-creation_date: 2010-10-29T12:40:50Z
-
-[Term]
-id: SO:0001693
-name: blunt_end_restriction_enzyme_cleavage_junction
-def: "A restriction enzyme cleavage site where both strands are cut at the same position." [SO:ke]
-synonym: "blunt end restriction enzyme cleavage site" RELATED []
-is_a: SO:0001688 ! restriction_enzyme_cleavage_junction
-relationship: part_of SO:0001691 ! blunt_end_restriction_enzyme_cleavage_site
-created_by: kareneilbeck
-creation_date: 2010-10-29T12:43:14Z
-
-[Term]
-id: SO:0001694
-name: single_strand_restriction_enzyme_cleavage_site
-def: "A restriction enzyme cleavage site whereby only one strand is cut." [SO:ke]
-synonym: "single strand restriction enzyme cleavage site" RELATED []
-is_a: SO:0001688 ! restriction_enzyme_cleavage_junction
-created_by: kareneilbeck
-creation_date: 2010-10-29T12:44:48Z
-
-[Term]
-id: SO:0001695
-name: restriction_enzyme_single_strand_overhang
-def: "A terminal region of DNA sequence where the end of the region is not blunt ended." [SO:ke]
-synonym: "single strand overhang" EXACT []
-synonym: "sticky end" RELATED []
-is_a: SO:0001411 ! biological_region
-relationship: part_of SO:0001692 ! sticky_end_restriction_enzyme_cleavage_site
-created_by: kareneilbeck
-creation_date: 2010-10-29T12:48:35Z
-
-[Term]
-id: SO:0001696
-name: experimentally_defined_binding_region
-def: "A region that has been implicated in binding although the exact coordinates of binding may be unknown." [SO:ke]
-synonym: "experimentally defined binding region" RELATED []
-is_a: SO:0001410 ! experimental_feature
-created_by: kareneilbeck
-creation_date: 2010-11-02T11:39:59Z
-
-[Term]
-id: SO:0001697
-name: ChIP_seq_region
-def: "A region of sequence identified by CHiP seq technology to contain a protein binding site." [SO:ke]
-synonym: "ChIP seq region" RELATED []
-is_a: SO:0001696 ! experimentally_defined_binding_region
-relationship: contains SO:0000410 ! protein_binding_site
-created_by: kareneilbeck
-creation_date: 2010-11-02T11:43:07Z
-
-[Term]
-id: SO:0001698
-name: ASPE_primer
-def: "\"A primer containing an SNV at the 3' end for accurate genotyping." [http://www.ncbi.nlm.nih.gov/pubmed/11252801]
-synonym: "allele specific primer extension primer" EXACT []
-synonym: "ASPE primer" EXACT []
-is_a: SO:0000112 ! primer
-created_by: kareneilbeck
-creation_date: 2010-11-11T03:25:21Z
-
-[Term]
-id: SO:0001699
-name: dCAPS_primer
-def: "A primer with one or more mis-matches to the DNA template corresponding to a position within a restriction enzyme recognition site." [http://www.ncbi.nlm.nih.gov/pubmed/9628033]
-synonym: "dCAPS primer" EXACT []
-synonym: "derived cleaved amplified polymorphic primer" EXACT []
-is_a: SO:0000112 ! primer
-created_by: kareneilbeck
-creation_date: 2010-11-11T03:27:09Z
-
-[Term]
-id: SO:0001700
-name: histone_modification
-def: "Histone modification is a post translationally modified region whereby residues of the histone protein are modified by methylation, acetylation, phosphorylation, ubiquitination, sumoylation, citrullination, or ADP-ribosylation." [http:en.wikipedia.org/wiki/Histone]
-synonym: "histone modification" EXACT []
-synonym: "histone modification site" RELATED []
-is_a: SO:0001089 ! post_translationally_modified_region
-is_a: SO:0001720 ! implied link automatically realized ! epigenetically_modified_region
-intersection_of: SO:0001089 ! post_translationally_modified_region
-intersection_of: has_quality SO:0000133 ! epigenetically_modified
-created_by: kareneilbeck
-creation_date: 2010-03-31T10:22:08Z
-
-[Term]
-id: SO:0001701
-name: histone_methylation_site
-def: "A histone modification site where the modification is the methylation of the residue." [SO:ke]
-synonym: "histone methylation" EXACT []
-synonym: "histone methylation site" EXACT []
-is_a: SO:0001700 ! histone_modification
-created_by: kareneilbeck
-creation_date: 2010-03-31T10:23:02Z
-
-[Term]
-id: SO:0001702
-name: histone_acetylation_site
-def: "A histone modification where the modification is the acylation of the residue." [SO:ke]
-synonym: "histone acetylation" EXACT []
-synonym: "histone acetylatoin site" EXACT []
-is_a: SO:0001700 ! histone_modification
-created_by: kareneilbeck
-creation_date: 2010-03-31T10:23:27Z
-
-[Term]
-id: SO:0001703
-name: H3K9_acetylation_site
-def: "A kind of histone modification site, whereby the 9th residue (a lysine), from the start of the H3 histone protein is acylated." [http://en.wikipedia.org/wiki/Histone]
-synonym: "H3K9 acetylation site" EXACT []
-synonym: "H3K9Ac" RELATED []
-is_a: SO:0001702 ! histone_acetylation_site
-created_by: kareneilbeck
-creation_date: 2010-03-31T10:25:05Z
-
-[Term]
-id: SO:0001704
-name: H3K14_acetylation_site
-def: "A kind of histone modification site, whereby the 14th residue (a lysine), from the start of the H3 histone protein is acylated." [http://en.wikipedia.org/wiki/Histone]
-synonym: "H3K14 acetylation site" EXACT []
-synonym: "H3K14Ac" RELATED []
-is_a: SO:0001702 ! histone_acetylation_site
-created_by: kareneilbeck
-creation_date: 2010-03-31T10:25:53Z
-
-[Term]
-id: SO:0001705
-name: H3K4_monomethylation_site
-def: "A kind of histone modification, whereby the 4th residue (a lysine), from the start of the H3 protein is mono-methylated." [http://en.wikipedia.org/wiki/Histone]
-synonym: "H3K4 mono-methylation site" EXACT []
-synonym: "H3K4me1" RELATED []
-is_a: SO:0001734 ! H3K4_methylation_site
-created_by: kareneilbeck
-creation_date: 2010-03-31T10:28:14Z
-
-[Term]
-id: SO:0001706
-name: H3K4_trimethylation
-def: "A kind of histone modification site, whereby the 4th residue (a lysine), from the start of the H3 protein is tri-methylated." [http://en.wikipedia.org/wiki/Histone]
-synonym: "H3K4 tri-methylation" EXACT []
-synonym: "H3K4me3" RELATED []
-is_a: SO:0001734 ! H3K4_methylation_site
-created_by: kareneilbeck
-creation_date: 2010-03-31T10:29:12Z
-
-[Term]
-id: SO:0001707
-name: H3K9_trimethylation_site
-def: "A kind of histone modification site, whereby the 9th residue (a lysine), from the start of the H3 histone protein is tri-methylated." [http://en.wikipedia.org/wiki/Histone]
-synonym: "H3K9 tri-methylation site" EXACT []
-synonym: "H3K9Me3" RELATED []
-is_a: SO:0001736 ! H3K9_methylation_site
-created_by: kareneilbeck
-creation_date: 2010-03-31T10:30:34Z
-
-[Term]
-id: SO:0001708
-name: H3K27_monomethylation_site
-def: "A kind of histone modification site, whereby the 27th residue (a lysine), from the start of the H3 histone protein is mono-methylated." [http://en.wikipedia.org/wiki/Histone]
-synonym: "H2K27 mono-methylation site" EXACT []
-synonym: "H2K27Me1" RELATED []
-is_a: SO:0001732 ! H3K27_methylation_site
-created_by: kareneilbeck
-creation_date: 2010-03-31T10:31:54Z
-
-[Term]
-id: SO:0001709
-name: H3K27_trimethylation_site
-def: "A kind of histone modification site, whereby the 27th residue (a lysine), from the start of the H3 histone protein is tri-methylated." [http://en.wikipedia.org/wiki/Histone]
-synonym: "H3K27 tri-methylation site" EXACT []
-synonym: "H3K27Me3" RELATED []
-is_a: SO:0001732 ! H3K27_methylation_site
-created_by: kareneilbeck
-creation_date: 2010-03-31T10:32:41Z
-
-[Term]
-id: SO:0001710
-name: H3K79_monomethylation_site
-def: "A kind of histone modification site, whereby the 79th residue (a lysine), from the start of the H3 histone protein is mono- methylated." [http://en.wikipedia.org/wiki/Histone]
-synonym: "H3K79 mono-methylation site" EXACT []
-synonym: "H3K79me1" RELATED []
-is_a: SO:0001735 ! H3K79_methylation_site
-created_by: kareneilbeck
-creation_date: 2010-03-31T10:33:42Z
-
-[Term]
-id: SO:0001711
-name: H3K79_dimethylation_site
-def: "A kind of histone modification site, whereby the 79th residue (a lysine), from the start of the H3 histone protein is di-methylated." [http://en.wikipedia.org/wiki/Histone]
-synonym: "H3K79 di-methylation site" EXACT []
-synonym: "H3K79Me2" RELATED []
-is_a: SO:0001735 ! H3K79_methylation_site
-created_by: kareneilbeck
-creation_date: 2010-03-31T10:34:39Z
-
-[Term]
-id: SO:0001712
-name: H3K79_trimethylation_site
-def: "A kind of histone modification site, whereby the 79th residue (a lysine), from the start of the H3 histone protein is tri-methylated." [http://en.wikipedia.org/wiki/Histone]
-synonym: "H3K79 tri-methylation site" EXACT []
-synonym: "H3K79Me3" RELATED []
-is_a: SO:0001735 ! H3K79_methylation_site
-created_by: kareneilbeck
-creation_date: 2010-03-31T10:35:30Z
-
-[Term]
-id: SO:0001713
-name: H4K20_monomethylation_site
-def: "A kind of histone modification site, whereby the 20th residue (a lysine), from the start of the H34histone protein is mono-methylated." [http://en.wikipedia.org/wiki/Histone]
-synonym: "H4K20 mono-methylation site" EXACT []
-synonym: "H4K20Me1" RELATED []
-is_a: SO:0001701 ! histone_methylation_site
-created_by: kareneilbeck
-creation_date: 2010-03-31T10:36:43Z
-
-[Term]
-id: SO:0001714
-name: H2BK5_monomethylation_site
-def: "A kind of histone modification site, whereby the 5th residue (a lysine), from the start of the H2B protein is methylated." [http://en.wikipedia.org/wiki/Histone]
-synonym: "H2BK5 mono-methylation site" EXACT []
-is_a: SO:0001701 ! histone_methylation_site
-created_by: kareneilbeck
-creation_date: 2010-03-31T10:38:12Z
-
-[Term]
-id: SO:0001715
-name: ISRE
-def: "An ISRE is a transcriptional cis regulatory region, containing the consensus region: YAGTTTC(A/T)YTTTYCC, responsible for increased transcription via interferon binding." [http://genesdev.cshlp.org/content/2/4/383.abstrac]
-comment: Term requested via tracker (2981725) by Alan Ruttenberg, April 2010. It has been described as both an enhancer and a promoter, so the parent is the more general term.
-synonym: "interferon stimulated response element" EXACT []
-is_a: SO:0001055 ! transcriptional_cis_regulatory_region
-created_by: kareneilbeck
-creation_date: 2010-04-05T11:15:08Z
-
-[Term]
-id: SO:0001716
-name: histone_ubiqitination_site
-def: "A histone modification site where ubiquitin may be added." [SO:ke]
-synonym: "histone ubiquitination site" RELATED []
-is_a: SO:0001700 ! histone_modification
-created_by: kareneilbeck
-creation_date: 2010-04-13T10:12:18Z
-
-[Term]
-id: SO:0001717
-name: H2B_ubiquitination_site
-def: "A histone modification site on H2B where ubiquitin may be added." [SO:ke]
-synonym: "H2BUbiq" RELATED []
-is_a: SO:0001716 ! histone_ubiqitination_site
-created_by: kareneilbeck
-creation_date: 2010-04-13T10:13:28Z
-
-[Term]
-id: SO:0001718
-name: H3K18_acetylation_site
-def: "A kind of histone modification site, whereby the 14th residue (a lysine), from the start of the H3 histone protein is acylated." [SO:ke]
-synonym: "H3K18 acetylation site" EXACT []
-synonym: "H3K18Ac" RELATED []
-is_a: SO:0001702 ! histone_acetylation_site
-created_by: kareneilbeck
-creation_date: 2010-04-13T10:39:35Z
-
-[Term]
-id: SO:0001719
-name: H3K23_acylation site
-def: "A kind of histone modification, whereby the 23rd residue (a lysine), from the start of the H3 histone protein is acylated." [SO:ke]
-synonym: "H3K23 acylation site" RELATED []
-synonym: "H3K23Ac" RELATED []
-is_a: SO:0001702 ! histone_acetylation_site
-created_by: kareneilbeck
-creation_date: 2010-04-13T10:42:45Z
-
-[Term]
-id: SO:0001720
-name: epigenetically_modified_region
-def: "A biological region implicated in inherited changes caused by mechanisms other than changes in the underlying DNA sequence." [http://en.wikipedia.org/wiki/Epigenetics, SO:ke]
-subset: SOFA
-synonym: "epigenetically modified region" RELATED []
-is_a: SO:0001411 ! biological_region
-intersection_of: SO:0001411 ! biological_region
-intersection_of: has_quality SO:0000133 ! epigenetically_modified
-created_by: kareneilbeck
-creation_date: 2010-03-27T12:02:29Z
-
-[Term]
-id: SO:0001721
-name: H3K27_acylation_site
-def: "A kind of histone modification site, whereby the 27th residue (a lysine), from the start of the H3 histone protein is acylated." [SO:ke]
-synonym: "H3K27 acylation site" EXACT []
-synonym: "H3K27Ac" RELATED []
-is_a: SO:0001702 ! histone_acetylation_site
-created_by: kareneilbeck
-creation_date: 2010-04-13T10:44:09Z
-
-[Term]
-id: SO:0001722
-name: H3K36_monomethylation_site
-def: "A kind of histone modification site, whereby the 36th residue (a lysine), from the start of the H3 histone protein is mono-methylated." [SO:ke]
-synonym: "H3K36 mono-methylation site" EXACT []
-synonym: "H3K36<Me1" RELATED []
-is_a: SO:0001733 ! H3K36_methylation_site
-created_by: kareneilbeck
-creation_date: 2010-04-13T10:46:32Z
-
-[Term]
-id: SO:0001723
-name: H3K36_dimethylation_site
-def: "A kind of histone modification site, whereby the 36th residue (a lysine), from the start of the H3 histone protein is dimethylated." [SO:ke]
-synonym: "H3K36 di-methylation site" EXACT []
-synonym: "H3K36Me2" RELATED []
-is_a: SO:0001733 ! H3K36_methylation_site
-created_by: kareneilbeck
-creation_date: 2010-04-13T10:59:35Z
-
-[Term]
-id: SO:0001724
-name: H3K36_trimethylation_site
-def: "A kind of histone modification site, whereby the 36th residue (a lysine), from the start of the H3 histone protein is tri-methylated." [SO:ke]
-synonym: "H3K36 tri-methylation site" EXACT []
-synonym: "H3K36Me3" RELATED []
-is_a: SO:0001733 ! H3K36_methylation_site
-created_by: kareneilbeck
-creation_date: 2010-04-13T11:01:58Z
-
-[Term]
-id: SO:0001725
-name: H3K4_dimethylation_site
-def: "A kind of histone modification site, whereby the 4th residue (a lysine), from the start of the H3 histone protein is di-methylated." [SO:ke]
-synonym: "H3K4 di-methylation site" EXACT []
-synonym: "H3K4Me2" RELATED []
-is_a: SO:0001734 ! H3K4_methylation_site
-created_by: kareneilbeck
-creation_date: 2010-04-13T11:03:15Z
-
-[Term]
-id: SO:0001726
-name: H3K27_dimethylation_site
-def: "A kind of histone modification site, whereby the 27th residue (a lysine), from the start of the H3 histone protein is di-methylated." [SO:ke]
-synonym: "H3K27 di-methylation site" EXACT []
-synonym: "H3K27Me2" RELATED []
-is_a: SO:0001732 ! H3K27_methylation_site
-created_by: kareneilbeck
-creation_date: 2010-04-13T01:45:41Z
-
-[Term]
-id: SO:0001727
-name: H3K9_monomethylation_site
-def: "A kind of histone modification site, whereby the 9th residue (a lysine), from the start of the H3 histone protein is mono-methylated." [SO:ke]
-synonym: "H3K9 mono-methylation site" EXACT []
-synonym: "H3K9Me1" RELATED []
-is_a: SO:0001736 ! H3K9_methylation_site
-created_by: kareneilbeck
-creation_date: 2010-04-13T11:06:17Z
-
-[Term]
-id: SO:0001728
-name: H3K9_dimethylation_site
-def: "A kind of histone modification site, whereby the 9th residue (a lysine), from the start of the H3 histone protein may be dimethylated." [SO:ke]
-synonym: "H3K9 di-methylation site" EXACT []
-synonym: "H3K9Me2" RELATED []
-is_a: SO:0001736 ! H3K9_methylation_site
-created_by: kareneilbeck
-creation_date: 2010-04-13T11:08:19Z
-
-[Term]
-id: SO:0001729
-name: H4K16_acylation_site
-def: "A kind of histone modification site, whereby the 16th residue (a lysine), from the start of the H4 histone protein is acylated." [SO:ke]
-synonym: "H4K16 acylation_site" RELATED []
-synonym: "H4K16Ac" RELATED []
-is_a: SO:0001702 ! histone_acetylation_site
-created_by: kareneilbeck
-creation_date: 2010-04-13T11:09:41Z
-
-[Term]
-id: SO:0001730
-name: H4K5_acylation_site
-def: "A kind of histone modification site, whereby the 5th residue (a lysine), from the start of the H4 histone protein is acylated." [SO:ke]
-synonym: "H4K5 acylation site" RELATED []
-synonym: "H4K5Ac" RELATED []
-is_a: SO:0001702 ! histone_acetylation_site
-created_by: kareneilbeck
-creation_date: 2010-04-13T11:13:00Z
-
-[Term]
-id: SO:0001731
-name: H4K8_acylation site
-def: "A kind of histone modification site, whereby the 8th residue (a lysine), from the start of the H4 histone protein is acylated." [SO:KE]
-synonym: "H4K8 acylation site" RELATED []
-synonym: "H4K8Ac" RELATED []
-is_a: SO:0001702 ! histone_acetylation_site
-created_by: kareneilbeck
-creation_date: 2010-04-13T11:14:24Z
-
-[Term]
-id: SO:0001732
-name: H3K27_methylation_site
-def: "A kind of histone modification site, whereby the 27th residue (a lysine), from the start of the H3 histone protein is methylated." [SO:ke]
-synonym: "H3K27 methylation site" EXACT []
-is_a: SO:0001701 ! histone_methylation_site
-created_by: kareneilbeck
-creation_date: 2010-04-13T11:26:22Z
-
-[Term]
-id: SO:0001733
-name: H3K36_methylation_site
-def: "A kind of histone modification site, whereby the 36th residue (a lysine), from the start of the H3 histone protein is methylated." [SO:ke]
-synonym: "H3K36 methylation site" EXACT []
-is_a: SO:0001701 ! histone_methylation_site
-created_by: kareneilbeck
-creation_date: 2010-04-13T11:27:28Z
-
-[Term]
-id: SO:0001734
-name: H3K4_methylation_site
-def: "A kind of histone modification, whereby the 4th residue (a lysine), from the start of the H3 protein is methylated." [SO:ke]
-synonym: "H3K4 methylation site" EXACT []
-is_a: SO:0001701 ! histone_methylation_site
-created_by: kareneilbeck
-creation_date: 2010-04-13T11:28:14Z
-
-[Term]
-id: SO:0001735
-name: H3K79_methylation_site
-def: "A kind of histone modification site, whereby the 79th residue (a lysine), from the start of the H3 histone protein is methylated." [SO:ke]
-synonym: "H3K79 methylation site" EXACT []
-is_a: SO:0001701 ! histone_methylation_site
-created_by: kareneilbeck
-creation_date: 2010-04-13T11:29:16Z
-
-[Term]
-id: SO:0001736
-name: H3K9_methylation_site
-def: "A kind of histone modification site, whereby the 9th residue (a lysine), from the start of the H3 histone protein is methylated." [SO:ke]
-synonym: "H3K9 methylation site" EXACT []
-is_a: SO:0001701 ! histone_methylation_site
-created_by: kareneilbeck
-creation_date: 2010-04-13T11:31:37Z
-
-[Term]
-id: SO:0001737
-name: histone_acylation_region
-def: "A histone modification, whereby the histone protein is acylated at multiple sites in a region." [SO:ke]
-synonym: "histone acylation region" RELATED []
-is_a: SO:0001700 ! histone_modification
-created_by: kareneilbeck
-creation_date: 2010-04-13T01:58:21Z
-
-[Term]
-id: SO:0001738
-name: H4K_acylation_region
-def: "A region of the H4 histone whereby multiple lysines are acylated." [SO:ke]
-synonym: "H4K acylation region" EXACT []
-synonym: "H4KAc" RELATED []
-is_a: SO:0001737 ! histone_acylation_region
-created_by: kareneilbeck
-creation_date: 2010-04-13T02:00:06Z
-
-[Term]
-id: SO:0001739
-name: gene_with_non_canonical_start_codon
-def: "A gene with a start codon other than AUG." [SO:xp]
-comment: Requested by flybase, Dec 2010.
-is_a: SO:0000704 ! gene
-intersection_of: SO:0000704 ! gene
-intersection_of: contains SO:0000680 ! non_canonical_start_codon
-created_by: kareneilbeck
-creation_date: 2011-01-10T01:30:31Z
-
-[Term]
-id: SO:0001740
-name: gene_with_start_codon_CUG
-def: "A gene with a translational start codon of CUG." [SO:mc]
-comment: Requested by flybase, Dec 2010.
-is_a: SO:0001739 ! gene_with_non_canonical_start_codon
-created_by: kareneilbeck
-creation_date: 2011-01-10T01:32:35Z
-
-[Term]
-id: SO:0001741
-name: pseudogenic_gene_segment
-def: "A gene segment which when incorporated by somatic recombination in the final gene transcript results in a nonfunctional product." [SO:hd]
-is_a: SO:3000000 ! gene_segment
-created_by: batchelorc
-creation_date: 2011-02-15T05:07:52Z
-
-[Term]
-id: SO:0001742
-name: copy_number_gain
-def: "A sequence alteration whereby the copy number of a given regions is greater than the reference sequence." [SO:ke]
-subset: DBVAR
-synonym: "copy number gain" EXACT []
-synonym: "gain" RELATED dbvar [http://www.ncbi.nlm.nih.gov/dbvar/]
-is_a: SO:0001019 ! copy_number_variation
-created_by: kareneilbeck
-creation_date: 2011-02-28T01:54:09Z
-
-[Term]
-id: SO:0001743
-name: copy_number_loss
-def: "A sequence alteration whereby the copy number of a given region is less than the reference sequence." [SO:ke]
-subset: DBVAR
-synonym: "copy number loss" EXACT []
-synonym: "loss" RELATED dbvar [http://www.ncbi.nlm.nih.gov/dbvar/]
-is_a: SO:0001019 ! copy_number_variation
-created_by: kareneilbeck
-creation_date: 2011-02-28T01:55:02Z
-
-[Term]
-id: SO:0001744
-name: UPD
-def: "Uniparental disomy is a sequence_alteration where a diploid individual receives two copies for all or part of a chromosome from one parent and no copies of the same chromosome or region from the other parent." [SO:BM]
-subset: DBVAR
-synonym: "uniparental disomy" EXACT []
-synonym: "UPD" EXACT dbvar [http://www.ncbi.nlm.nih.gov/dbvar/]
-xref: http:http\://en.wikipedia.org/wiki/Uniparental_disomy "wikipedia"
-is_a: SO:0001059 ! sequence_alteration
-created_by: kareneilbeck
-creation_date: 2011-02-28T02:01:05Z
-
-[Term]
-id: SO:0001745
-name: maternal_uniparental_disomy
-def: "Uniparental disomy is a sequence_alteration where a diploid individual receives two copies for all or part of a chromosome from the mother and no copies of the same chromosome or region from the father." [SO:bm]
-synonym: "maternal uniparental disomy" EXACT []
-is_a: SO:0001744 ! UPD
-created_by: kareneilbeck
-creation_date: 2011-02-28T02:03:01Z
-
-[Term]
-id: SO:0001746
-name: paternal_uniparental_disomy
-def: "Uniparental disomy is a sequence_alteration where a diploid individual receives two copies for all or part of a chromosome from the father and no copies of the same chromosome or region from the mother." [SO:bm]
-synonym: "paternal uniparental disomy" EXACT []
-is_a: SO:0001744 ! UPD
-created_by: kareneilbeck
-creation_date: 2011-02-28T02:03:30Z
-
-[Term]
-id: SO:0001747
-name: open_chromatin_region
-def: "A DNA sequence that in the normal state of the chromosome corresponds to an unfolded, un-complexed stretch of double-stranded DNA." [SO:cb]
-comment: Requested by John Calley 3125900.
-is_a: SO:0001411 ! biological_region
-created_by: kareneilbeck
-creation_date: 2011-02-28T02:21:52Z
-
-[Term]
-id: SO:0001748
-name: SL3_acceptor_site
-def: "A SL2_acceptor_site which appends the SL3 RNA leader sequence to the 5' end of an mRNA. SL3 acceptor sites occur in genes in internal segments of polycistronic transcripts." [SO:nlw]
-is_a: SO:0000709 ! SL2_acceptor_site
-created_by: kareneilbeck
-creation_date: 2011-02-28T02:58:40Z
-
-[Term]
-id: SO:0001749
-name: SL4_acceptor_site
-def: "A SL2_acceptor_site which appends the SL4 RNA leader sequence to the 5' end of an mRNA. SL4 acceptor sites occur in genes in internal segments of polycistronic transcripts." [SO:nlw]
-is_a: SO:0000709 ! SL2_acceptor_site
-created_by: kareneilbeck
-creation_date: 2011-02-28T03:08:47Z
-
-[Term]
-id: SO:0001750
-name: SL5_acceptor_site
-def: "A SL2_acceptor_site which appends the SL5 RNA leader sequence to the 5' end of an mRNA. SL5 acceptor sites occur in genes in internal segments of polycistronic transcripts." [SO:nlw]
-is_a: SO:0000709 ! SL2_acceptor_site
-created_by: kareneilbeck
-creation_date: 2011-02-28T03:09:36Z
-
-[Term]
-id: SO:0001751
-name: SL6_acceptor_site
-def: "A SL2_acceptor_site which appends the SL6 RNA leader sequence to the 5' end of an mRNA. SL6 acceptor sites occur in genes in internal segments of polycistronic transcripts." [SO:nlw]
-is_a: SO:0000709 ! SL2_acceptor_site
-created_by: kareneilbeck
-creation_date: 2011-02-28T03:10:14Z
-
-[Term]
-id: SO:0001752
-name: SL7_acceptor_site
-def: "A SL2_acceptor_site which appends the SL7 RNA leader sequence to the 5' end of an mRNA. SL7 acceptor sites occur in genes in internal segments of polycistronic transcripts." [SO:nlw]
-is_a: SO:0000709 ! SL2_acceptor_site
-created_by: kareneilbeck
-creation_date: 2011-02-28T03:13:20Z
-
-[Term]
-id: SO:0001753
-name: SL8_acceptor_site
-def: "A SL2_acceptor_site which appends the SL8 RNA leader sequence to the 5' end of an mRNA. SL8 acceptor sites occur in genes in internal segments of polycistronic transcripts." [SO:nlw]
-is_a: SO:0000709 ! SL2_acceptor_site
-created_by: kareneilbeck
-creation_date: 2011-02-28T03:15:26Z
-
-[Term]
-id: SO:0001754
-name: SL9_acceptor_site
-def: "A SL2_acceptor_site which appends the SL9 RNA leader sequence to the 5' end of an mRNA. SL9 acceptor sites occur in genes in internal segments of polycistronic transcripts." [SO:nlw]
-is_a: SO:0000709 ! SL2_acceptor_site
-created_by: kareneilbeck
-creation_date: 2011-02-28T03:15:57Z
-
-[Term]
-id: SO:0001755
-name: SL10_accceptor_site
-def: "A SL2_acceptor_site which appends the SL10 RNA leader sequence to the 5' end of an mRNA. SL10 acceptor sites occur in genes in internal segments of polycistronic transcripts." [SO:nlw]
-is_a: SO:0000709 ! SL2_acceptor_site
-created_by: kareneilbeck
-creation_date: 2011-02-28T03:16:31Z
-
-[Term]
-id: SO:0001756
-name: SL11_acceptor_site
-def: "A SL2_acceptor_site which appends the SL11 RNA leader sequence to the 5' end of an mRNA. SL11 acceptor sites occur in genes in internal segments of polycistronic transcripts." [SO:nlw]
-is_a: SO:0000709 ! SL2_acceptor_site
-created_by: kareneilbeck
-creation_date: 2011-02-28T03:16:54Z
-
-[Term]
-id: SO:0001757
-name: SL12_acceptor_site
-def: "A SL2_acceptor_site which appends the SL12 RNA leader sequence to the 5' end of an mRNA. SL12 acceptor sites occur in genes in internal segments of polycistronic transcripts." [SO:nlw]
-is_a: SO:0000709 ! SL2_acceptor_site
-created_by: kareneilbeck
-creation_date: 2011-02-28T03:17:23Z
-
-[Term]
-id: SO:0001758
-name: duplicated_pseudogene
-def: "A pseudogene that arose via gene duplication. Generally duplicated pseudogenes have the same structure as the original gene, including intron-exon structure and some regulatory sequence." [http://en.wikipedia.org/wiki/Pseudogene]
-synonym: "duplicated pseudogene" RELATED []
-is_a: SO:0001760 ! non_processed_pseudogene
-created_by: kareneilbeck
-creation_date: 2011-03-09T09:58:04Z
-
-[Term]
-id: SO:0001759
-name: unitary_pseudogene
-def: "A pseudogene, deactivated from original state by mutation, fixed in a population." [http://en.wikipedia.org/wiki/Pseudogene, SO:ke]
-comment: This is different from a non processed pseudogene because the gene was not duplicated. An example is the L-gulono-lactone oxidase pseudogene in primates.
-synonym: "disabled gene" RELATED []
-synonym: "unitary pseudogene" RELATED []
-is_a: SO:0001760 ! non_processed_pseudogene
-created_by: kareneilbeck
-creation_date: 2011-03-09T10:04:04Z
-
-[Term]
-id: SO:0001760
-name: non_processed_pseudogene
-def: "A pseudogene that arose from a means other than retrotransposition." [SO:ke]
-synonym: "non processed pseudogene" RELATED []
-is_a: SO:0000336 ! pseudogene
-created_by: kareneilbeck
-creation_date: 2011-03-09T10:54:47Z
-
-[Term]
-id: SO:0001761
-name: variant_quality
-def: "A dependent entity that inheres in a bearer, a sequence variant." [PMID:17597783, SO:ke]
-synonym: "variant quality" EXACT []
-is_a: SO:0000400 ! sequence_attribute
-created_by: kareneilbeck
-creation_date: 2011-03-15T03:40:35Z
-
-[Term]
-id: SO:0001762
-name: variant_origin
-def: "A quality inhering in a variant by virtue of its origin." [PMID:17597783, SO:ke]
-synonym: "variant origin" EXACT []
-is_a: SO:0001761 ! variant_quality
-created_by: kareneilbeck
-creation_date: 2011-03-15T03:42:13Z
-
-[Term]
-id: SO:0001763
-name: variant_frequency
-def: "A physical quality which inheres to the variant by virtue of the number instances of the variant within a population." [PMID:17597783, SO:ke]
-synonym: "variant frequency" EXACT []
-is_a: SO:0001761 ! variant_quality
-created_by: kareneilbeck
-creation_date: 2011-03-15T03:44:39Z
-
-[Term]
-id: SO:0001764
-name: unique_variant
-def: "A physical quality which inheres to the variant by virtue of the number instances of the variant within a population." [SO:ke]
-synonym: "unique variant" EXACT []
-is_a: SO:0001763 ! variant_frequency
-created_by: kareneilbeck
-creation_date: 2011-03-15T03:47:20Z
-
-[Term]
-id: SO:0001765
-name: rare_variant
-synonym: "rare variant" EXACT []
-is_a: SO:0001763 ! variant_frequency
-created_by: kareneilbeck
-creation_date: 2011-03-15T03:48:29Z
-
-[Term]
-id: SO:0001766
-name: polymorphic_variant
-synonym: "polymorphic variant" EXACT []
-is_a: SO:0001763 ! variant_frequency
-created_by: kareneilbeck
-creation_date: 2011-03-15T03:48:51Z
-
-[Term]
-id: SO:0001767
-name: common_variant
-synonym: "common variant" EXACT []
-is_a: SO:0001763 ! variant_frequency
-created_by: kareneilbeck
-creation_date: 2011-03-15T03:50:36Z
-
-[Term]
-id: SO:0001768
-name: fixed_variant
-synonym: "fixed variant" EXACT []
-is_a: SO:0001763 ! variant_frequency
-created_by: kareneilbeck
-creation_date: 2011-03-15T03:50:53Z
-
-[Term]
-id: SO:0001769
-name: variant_phenotype
-def: "A quality inhering in a variant by virtue of its phenotype." [PMID:17597783, SO:ke]
-synonym: "variant phenotype" EXACT []
-is_a: SO:0001761 ! variant_quality
-created_by: kareneilbeck
-creation_date: 2011-03-15T03:53:15Z
-
-[Term]
-id: SO:0001770
-name: benign_variant
-synonym: "benign variant" EXACT []
-is_a: SO:0001769 ! variant_phenotype
-created_by: kareneilbeck
-creation_date: 2011-03-15T03:55:40Z
-
-[Term]
-id: SO:0001771
-name: disease_associated_variant
-synonym: "disease associated variant" EXACT []
-is_a: SO:0001769 ! variant_phenotype
-created_by: kareneilbeck
-creation_date: 2011-03-15T04:05:16Z
-
-[Term]
-id: SO:0001772
-name: disease_causing_variant
-synonym: "disease causing variant" EXACT []
-is_a: SO:0001769 ! variant_phenotype
-created_by: kareneilbeck
-creation_date: 2011-03-15T04:05:46Z
-
-[Term]
-id: SO:0001773
-name: lethal_variant
-synonym: "lethal variant" EXACT []
-is_a: SO:0001769 ! variant_phenotype
-created_by: kareneilbeck
-creation_date: 2011-03-15T04:06:22Z
-
-[Term]
-id: SO:0001774
-name: quantitative_variant
-synonym: "quantitative variant" EXACT []
-is_a: SO:0001769 ! variant_phenotype
-created_by: kareneilbeck
-creation_date: 2011-03-15T04:28:13Z
-
-[Term]
-id: SO:0001775
-name: maternal_variant
-synonym: "maternal variant" EXACT []
-is_a: SO:0001762 ! variant_origin
-created_by: kareneilbeck
-creation_date: 2011-03-15T04:30:23Z
-
-[Term]
-id: SO:0001776
-name: paternal_variant
-synonym: "paternal variant" EXACT []
-is_a: SO:0001762 ! variant_origin
-created_by: kareneilbeck
-creation_date: 2011-03-15T04:30:47Z
-
-[Term]
-id: SO:0001777
-name: somatic_variant
-synonym: "somatic variant" EXACT []
-is_a: SO:0001762 ! variant_origin
-created_by: kareneilbeck
-creation_date: 2011-03-15T04:31:12Z
-
-[Term]
-id: SO:0001778
-name: germline_variant
-synonym: "germline variant" EXACT []
-is_a: SO:0001762 ! variant_origin
-created_by: kareneilbeck
-creation_date: 2011-03-15T04:31:46Z
-
-[Term]
-id: SO:0001779
-name: pedigree_specific_variant
-synonym: "pedigree specific variant" EXACT []
-is_a: SO:0001762 ! variant_origin
-created_by: kareneilbeck
-creation_date: 2011-03-15T04:32:18Z
-
-[Term]
-id: SO:0001780
-name: population_specific_variant
-synonym: "population specific variant" EXACT []
-is_a: SO:0001762 ! variant_origin
-created_by: kareneilbeck
-creation_date: 2011-03-15T04:33:05Z
-
-[Term]
-id: SO:0001781
-name: de_novo_variant
-synonym: "de novo variant" EXACT []
-is_a: SO:0001762 ! variant_origin
-created_by: kareneilbeck
-creation_date: 2011-03-15T04:33:34Z
-
-[Term]
-id: SO:0001782
-name: TF_binding_site_variant
-def: "A sequence variant located within a transcription factor binding site." [EBI:fc]
-is_a: SO:0001566 ! regulatory_region_variant
-created_by: kareneilbeck
-creation_date: 2011-03-17T10:59:20Z
-
-[Term]
-id: SO:0001783
-name: missense_codon
-def: "A sequence variant whereby at least one base of a codon is changed resulting in a codon that encodes for a different amino acid." [SO:ke]
-synonym: "missense" EXACT [ftp://ftp.ncbi.nih.gov/snp/specs/docsum_3.1.xsd]
-synonym: "missense codon" EXACT []
-xref: http://en.wikipedia.org/wiki/Missense_mutation
-is_a: SO:0001583 ! non_synonymous_codon
-created_by: kareneilbeck
-creation_date: 2011-03-17T11:08:03Z
-
-[Term]
-id: SO:0001784
-name: complex_structural_alteration
-def: "A structural sequence alteration where there are multiple equally plausible explanations for the change." [SO:ke]
-subset: DBVAR
-synonym: "complex" RELATED dbvar [http://www.ncbi.nlm.nih.gov/dbvar/]
-is_a: SO:0001785 ! structural_alteration
-created_by: kareneilbeck
-creation_date: 2011-03-23T03:21:19Z
-
-[Term]
-id: SO:0001785
-name: structural_alteration
-subset: DBVAR
-is_a: SO:0001059 ! sequence_alteration
-created_by: kareneilbeck
-creation_date: 2011-03-25T02:27:41Z
-
-[Term]
-id: SO:0001786
-name: loss_of_heterozygosity
-subset: DBVAR
-synonym: "LOH" EXACT []
-synonym: "loss of heterozygosity" RELATED []
-is_a: SO:0001060 ! sequence_variant
-created_by: kareneilbeck
-creation_date: 2011-03-25T02:32:58Z
-
-[Term]
-id: SO:0001787
-name: splice_donor_5th_base_variant
-def: "A sequence variant that causes a change at the 5th base pair after the start of the intron in the orientation of the transcript." [EBI:gr]
-synonym: "splice donor 5th base variant" EXACT []
-is_a: SO:0001629 ! splice_site_variant
-created_by: kareneilbeck
-creation_date: 2011-04-05T04:16:28Z
-
-[Term]
-id: SO:0001788
-name: U_box
-def: "An U-box is a conserved T-rich region upstream of a retroviral polypurine tract that is involved in PPT primer creation during reverse transcription." [PMID:10556309, PMID:11577982, PMID:9649446]
-is_a: SO:0000330 ! conserved_region
-relationship: part_of SO:0000186 ! LTR_retrotransposon
-created_by: kareneilbeck
-creation_date: 2011-04-08T10:39:14Z
-
-[Term]
-id: SO:0001789
-name: mating_type_region
-def: "A specialized region in the genomes of some yeast and fungi, the genes of which regulate mating type." [SO:ke]
-xref: http://en.wikipedia.org/wiki/Mating-type_region
-is_a: SO:0005855 ! gene_group
-created_by: kareneilbeck
-creation_date: 2011-04-08T11:14:07Z
-
-[Term]
-id: SO:0001790
-name: paired_end_fragment
-def: "An assembly region that has been sequenced from both ends resulting in a read_pair (mate_pair)." [SO:ke]
-subset: SOFA
-is_a: SO:0000143 ! assembly_component
-created_by: kareneilbeck
-creation_date: 2011-04-14T01:48:20Z
-
-[Term]
-id: SO:0001791
-name: exon_variant
-def: "A sequence variant that changes exon sequence." [SO:ke]
-is_a: SO:0001576 ! transcript_variant
-created_by: kareneilbeck
-creation_date: 2011-05-06T01:51:17Z
-
-[Term]
-id: SO:0001792
-name: non_coding_exon_variant
-def: "A sequence variant that changes non-coding exon sequence." [SO:ke]
-is_a: SO:0001791 ! exon_variant
-created_by: kareneilbeck
-creation_date: 2011-05-06T01:51:59Z
-
-[Term]
-id: SO:0001793
-name: clone_end
-def: "A read from an end of the clone sequence." [SO:ke]
-synonym: "clone end" EXACT []
-is_a: SO:0000150 ! read
-relationship: part_of SO:0000151 ! clone
-created_by: kareneilbeck
-creation_date: 2011-05-13T11:32:27Z
-
-[Term]
-id: SO:0001794
-name: point_centromere
-def: "A point centromere is a relatively small centromere (about 125 bp DNA) in discrete sequence, found in some yeast including S. cerevisiae." [PMID:7502067, SO:vw]
-synonym: "point centromere" EXACT []
-is_a: SO:0000577 ! centromere
-created_by: kareneilbeck
-creation_date: 2011-05-31T12:42:35Z
-
-[Term]
-id: SO:0001795
-name: regional_centromere
-def: "A regional centromere is a large modular centromere found in fission yeast and higher eukaryotes. It consist of a central core region flanked by inverted inner and outer repeat regions." [PMID:7502067, SO:vw]
-synonym: "regional centromere" EXACT []
-is_a: SO:0000577 ! centromere
-created_by: kareneilbeck
-creation_date: 2011-05-31T12:43:07Z
-
-[Term]
-id: SO:0001796
-name: regional_centromere_central_core
-def: "A conserved region within the central region of a modular centromere, where the kinetochore is formed." [SO:vw]
-synonym: "regional centromere central core" EXACT []
-is_a: SO:0000330 ! conserved_region
-relationship: part_of SO:0001795 ! regional_centromere
-created_by: kareneilbeck
-creation_date: 2011-05-31T12:56:30Z
-
-[Term]
-id: SO:0001797
-name: centromeric_repeat
-def: "A repeat region found within the modular centromere." [SO:ke]
-synonym: "centromeric repeat" EXACT []
-is_a: SO:0000657 ! repeat_region
-created_by: kareneilbeck
-creation_date: 2011-05-31T12:59:27Z
-
-[Term]
-id: SO:0001798
-name: regional_centromere_inner_repeat_region
-def: "The inner repeat region of a modular centromere. This region is adjacent to the central core, on each chromosome arm." [SO:vw]
-synonym: "regional centromere inner repeat region" EXACT []
-is_a: SO:0001797 ! centromeric_repeat
-relationship: part_of SO:0001795 ! regional_centromere
-created_by: kareneilbeck
-creation_date: 2011-05-31T01:01:08Z
-
-[Term]
-id: SO:0001799
-name: regional_centromere_outer_repeat_region
-def: "The heterochromatic outer repeat region of a modular centromere. These repeats exist in tandem arrays on both chromosome arms." [SO:vw]
-synonym: "regional centromere outer repeat region" EXACT []
-is_a: SO:0001797 ! centromeric_repeat
-relationship: part_of SO:0001795 ! regional_centromere
-created_by: kareneilbeck
-creation_date: 2011-05-31T01:03:23Z
-
-[Term]
-id: SO:0001800
-name: tasiRNA
-def: "The sequence of a 21 nucleotide double stranded, polyadenylated non coding RNA, transcribed from the TAS gene." [PMID:16145017]
-synonym: "trans acting small interfering RNA" RELATED []
-is_a: SO:0000655 ! ncRNA
-relationship: derives_from SO:0001801 ! tasiRNA_primary_transcript
-created_by: kareneilbeck
-creation_date: 2011-05-31T03:24:06Z
-
-[Term]
-id: SO:0001801
-name: tasiRNA_primary_transcript
-def: "A primary transcript encoding a tasiRNA." [PMID:16145017]
-is_a: SO:0000483 ! nc_primary_transcript
-created_by: kareneilbeck
-creation_date: 2011-05-31T03:27:35Z
-
-[Term]
-id: SO:0001802
-name: increased_polyadenylation_variant
-def: "A transcript processing variant whereby polyadenylation of the encoded transcript is increased with respect to the reference." [SO:ke]
-comment: Term requested by M. Dumontier, June 1 2011.
-synonym: "increased polyadenylation variant" EXACT []
-is_a: SO:0001545 ! polyadenylation_variant
-created_by: kareneilbeck
-creation_date: 2011-06-01T10:53:12Z
-
-[Term]
-id: SO:0001803
-name: decreased_polyadenylation_variant
-def: "A transcript processing variant whereby polyadenylation of the encoded transcript is decreased with respect to the reference." [SO:ke]
-comment: Term requested by M. Dumontier, June 1 2011.
-synonym: "decreased polyadenylation variant" EXACT []
-is_a: SO:0001545 ! polyadenylation_variant
-created_by: kareneilbeck
-creation_date: 2011-06-01T10:53:40Z
-
-[Term]
-id: SO:0001804
-name: DDB_box
-def: "A conserved polypeptide motif that mediates protein-protein interaction and defines adaptor proteins for DDB1/cullin 4 ubiquitin ligases." [PMID:18794354, PMID:19818632]
-comment: Note: PMID:18794354 describes the DDB box, and has lots of alignments, but doesn't actually come out with a consensus sequence.
-synonym: "DDB box" EXACT []
-synonym: "DDB-box" EXACT []
-is_a: SO:0001093 ! protein_protein_contact
-created_by: kareneilbeck
-creation_date: 2011-06-17T12:10:44Z
-
-[Term]
-id: SO:0001805
-name: destruction_box
-def: "A conserved polypeptide motif that can be recognized by both Fizzy/Cdc20- and FZR/Cdh1-activated anaphase-promoting complex/cyclosome (APC/C) and targets a protein for ubiquitination and subsequent degradation by the APC/C. The consensus sequence is RXXLXXXXN." [PMID:12208841, PMID:1842691]
-synonym: "D-box" EXACT []
-synonym: "destruction box" EXACT []
-is_a: SO:0100017 ! polypeptide_conserved_motif
-created_by: kareneilbeck
-creation_date: 2011-06-17T12:16:02Z
-
-[Term]
-id: SO:0001806
-name: ER_retention_signal
-def: "A C-terminal tetrapeptide motif that mediates retention of a protein in (or retrieval to) the endoplasmic reticulum. In mammals the sequence is KDEL, and in fungi HDEL or DDEL." [doi:10.1093/jxb/50.331.157, PMID:2077689]
-synonym: "endoplasmic reticulum retention signal" EXACT []
-synonym: "ER retention signal" EXACT []
-is_a: SO:0001527 ! peptide_localization_signal
-created_by: kareneilbeck
-creation_date: 2011-06-17T12:19:49Z
-
-[Term]
-id: SO:0001807
-name: KEN_box
-def: "A conserved polypeptide motif that can be recognized by FZR/Cdh1-activated anaphase-promoting complex/cyclosome (APC/C) and targets a protein for ubiquitination and subsequent degradation by the APC/C. The consensus sequence is KENXXXN." [PMID:10733526, PMID:1220884, PMID:18426916]
-synonym: "KEN box" EXACT []
-is_a: SO:0100017 ! polypeptide_conserved_motif
-created_by: kareneilbeck
-creation_date: 2011-06-17T12:24:14Z
-
-[Term]
-id: SO:0001808
-name: mitochondrial_targeting_signal
-def: "A polypeptide region that targets a polypeptide to the mitochondrion." [PomBase:mah]
-synonym: "mitochondrial signal sequence" EXACT []
-synonym: "mitochondrial targeting signal" EXACT []
-synonym: "MTS" EXACT []
-is_a: SO:0001527 ! peptide_localization_signal
-created_by: kareneilbeck
-creation_date: 2011-06-17T12:26:35Z
-
-[Term]
-id: SO:0001809
-name: signal_anchor
-def: "A signal sequence that is not cleaved from the polypeptide. Anchors a Type II membrane protein to the membrane." [http://www.cbs.dtu.dk/services/SignalP/background/biobackground.php]
-synonym: "signal anchor" EXACT []
-synonym: "uncleaved signal peptide" EXACT []
-is_a: SO:0000418 ! signal_peptide
-created_by: kareneilbeck
-creation_date: 2011-06-17T12:28:53Z
-
-[Term]
-id: SO:0001810
-name: PIP_box
-def: "A polypeptide region that mediates binding to PCNA. The consensus sequence is QXX(hh)XX(aa), where (h) denotes residues with moderately hydrophobic side chains and (a) denotes residues with highly hydrophobic aromatic side chains." [PMID:9631646]
-synonym: "PIP box" EXACT []
-is_a: SO:0001093 ! protein_protein_contact
-created_by: kareneilbeck
-creation_date: 2011-06-17T12:33:25Z
-
-[Term]
-id: SO:0001811
-name: phosphorylation_site
-def: "A post-translationally modified region in which residues of the protein are modified by phosphorylation." [PomBase:mah]
-synonym: "phosphorylation site" EXACT []
-is_a: SO:0001089 ! post_translationally_modified_region
-created_by: kareneilbeck
-creation_date: 2011-06-17T12:36:20Z
-
-[Term]
-id: SO:0001812
-name: transmembrane_helix
-def: "A region that traverses the lipid bilayer and adopts a helical secondary structure." [PomBase:mah]
-synonym: "transmembrane helix" EXACT []
-is_a: SO:0001114 ! peptide_helix
-relationship: part_of SO:0001077 ! transmembrane_polypeptide_region
-created_by: kareneilbeck
-creation_date: 2011-06-17T12:39:46Z
-
-[Term]
-id: SO:0001813
-name: vacuolar_sorting_signal
-def: "A polypeptide region that targets a polypeptide to the vacuole." [PomBase:mah]
-synonym: "vacuolar sorting signal" EXACT []
-is_a: SO:0001527 ! peptide_localization_signal
-created_by: kareneilbeck
-creation_date: 2011-06-17T12:42:48Z
-
-[Term]
-id: SO:0001814
-name: coding_variant_quality
-is_a: SO:0001761 ! variant_quality
-created_by: kareneilbeck
-creation_date: 2011-06-24T03:32:25Z
-
-[Term]
-id: SO:0001815
-name: synonymous
-is_a: SO:0001814 ! coding_variant_quality
-created_by: kareneilbeck
-creation_date: 2011-06-24T03:33:16Z
-
-[Term]
-id: SO:0001816
-name: non_synonymous
-is_a: SO:0001814 ! coding_variant_quality
-created_by: kareneilbeck
-creation_date: 2011-06-24T03:33:36Z
-
-[Term]
-id: SO:0001817
-name: inframe
-def: "An attribute describing a sequence that contains a mutation involving the deletion or insertion of one or more bases, where this number is divisible by 3." [SO:ke]
-is_a: SO:0000863 ! mRNA_attribute
-created_by: kareneilbeck
-creation_date: 2011-06-24T03:34:03Z
-
-[Term]
-id: SO:0001818
-name: non_synonymous_variant
-def: "A sequence_variant which is predicted to change the protein encoded in the coding sequence." [EBI:gr]
-is_a: SO:0001580 ! coding_sequence_variant
-created_by: kareneilbeck
-creation_date: 2011-06-24T03:38:02Z
-
-[Term]
-id: SO:0001819
-name: synonymous_variant
-is_a: SO:0001580 ! coding_sequence_variant
-created_by: kareneilbeck
-creation_date: 2011-06-24T03:38:30Z
-
-[Term]
-id: SO:0001820
-name: inframe_change_in_CDS_length
-synonym: "inframe change in CDS length" EXACT []
-is_a: SO:0001581 ! codon_variant
-is_a: SO:0001650 ! inframe_variant
-is_a: SO:0001818 ! non_synonymous_variant
-created_by: kareneilbeck
-creation_date: 2011-06-27T11:25:33Z
-
-[Term]
-id: SO:0001821
-name: inframe_increase_in_CDS_length
-def: "An inframe_non_synonymous_variant that inserts bases into in the coding sequence." [EBI:gr]
-synonym: "inframe increase in CDS length" EXACT []
-is_a: SO:0001820 ! inframe_change_in_CDS_length
-created_by: kareneilbeck
-creation_date: 2011-06-27T11:26:22Z
-
-[Term]
-id: SO:0001822
-name: inframe_decrease_in_CDS_length
-def: "An inframe_non_synonymous_variant that deletes bases from the coding sequence." [EBI:gr]
-synonym: "inframe decrease in CDS length" RELATED []
-is_a: SO:0001820 ! inframe_change_in_CDS_length
-created_by: kareneilbeck
-creation_date: 2011-06-27T11:27:10Z
-
-[Term]
-id: SO:0001823
-name: conservative_increase_in_CDS_length
-def: "An inframe_increase_in_cds_length that inserts one or more codons into the coding sequence between existing codons." [EBI:gr]
-synonym: "conservative increase in CDS length" EXACT []
-is_a: SO:0001821 ! inframe_increase_in_CDS_length
-created_by: kareneilbeck
-creation_date: 2011-06-27T11:28:02Z
-
-[Term]
-id: SO:0001824
-name: disruptive_increase_in_CDS_length
-def: "An inframe_increase_in_cds_length that inserts one or more codons into the coding sequence within an existing codon." [EBI:gr]
-synonym: "disruptive increase in CDS length" EXACT []
-is_a: SO:0001821 ! inframe_increase_in_CDS_length
-created_by: kareneilbeck
-creation_date: 2011-06-27T11:28:37Z
-
-[Term]
-id: SO:0001825
-name: conservative_decrease_in_CDS_length
-def: "An inframe_decrease_in_cds_length that deletes one or more entire codons from the coding sequence but does not change any remaining codons." [EBI:gr]
-synonym: "conservative decrease in CDS length" RELATED []
-is_a: SO:0001822 ! inframe_decrease_in_CDS_length
-created_by: kareneilbeck
-creation_date: 2011-06-27T11:30:43Z
-
-[Term]
-id: SO:0001826
-name: disruptive_decrease_in_CDS_length
-def: "An inframe_decrease_in_cds_length that deletes bases from the coding sequence starting within an existing codon." [EBI:gr]
-synonym: "disruptive decrease in CDS length" EXACT []
-is_a: SO:0001822 ! inframe_decrease_in_CDS_length
-created_by: kareneilbeck
-creation_date: 2011-06-27T11:31:31Z
-
-[Term]
-id: SO:0001827
-name: mRNA_read
-def: "A sequencer read of an mRNA substrate." [SO:ke]
-comment: Requested by Bayer Cropscience June, 2011.
-synonym: "mRNA read" EXACT []
-is_a: SO:0000150 ! read
-created_by: kareneilbeck
-creation_date: 2011-06-28T04:04:32Z
-
-[Term]
-id: SO:0001828
-name: genomic_DNA_read
-def: "A sequencer read of a genomic DNA substrate." [SO:ke]
-synonym: "genomic DNA read" EXACT []
-is_a: SO:0000150 ! read
-created_by: kareneilbeck
-creation_date: 2011-06-28T04:06:10Z
-
-[Term]
-id: SO:0001829
-name: mRNA_contig
-def: "A contig composed of mRNA_reads." [SO:ke]
-comment: Requested by Bayer Cropscience June, 2011.
-synonym: "mRNA contig" RELATED []
-is_a: SO:0000149 ! contig
-created_by: kareneilbeck
-creation_date: 2011-06-28T04:07:09Z
-
-[Term]
-id: SO:0001830
-name: AFLP_fragment
-def: "A PCR product obtained by applying the AFLP technique, based on a restriction enzyme digestion of genomic DNA and an amplification of the resulting fragments." [GMOD:ea]
-comment: Requested by Bayer Cropscience June, 2011.
-synonym: "AFLP" EXACT []
-synonym: "AFLP fragment" EXACT []
-synonym: "AFLP-PCR" EXACT []
-synonym: "amplified fragment length polymorphism" EXACT []
-synonym: "amplified fragment length polymorphism PCR" EXACT []
-xref: http://en.wikipedia.org/wiki/Amplified_fragment_length_polymorphism "wiki"
-is_a: SO:0000006 ! PCR_product
-created_by: kareneilbeck
-creation_date: 2011-07-14T12:12:35Z
-
-[Term]
-id: SO:0001831
-name: protein_hmm_match
-def: "A match to a protein HMM such as pfam." [SO:ke]
-is_a: SO:0000349 ! protein_match
-created_by: kareneilbeck
-creation_date: 2011-08-11T03:20:27Z
-
-[Term]
-id: SO:0001832
-name: immunoglobulin_region
-def: "A region of immunoglobulin sequence, either constant or variable." [SO:ke]
-is_a: SO:0000839 ! polypeptide_region
-created_by: kareneilbeck
-creation_date: 2011-09-01T03:27:20Z
-
-[Term]
-id: SO:0001833
-name: V_region
-def: "The variable region of an immunoglobulin polypeptide sequence." [SO:ke]
-is_a: SO:0001832 ! immunoglobulin_region
-created_by: kareneilbeck
-creation_date: 2011-09-01T03:28:40Z
-
-[Term]
-id: SO:0001834
-name: C_region
-def: "The constant region of an immunoglobulin polypeptide sequence." [SO:ke]
-is_a: SO:0001832 ! immunoglobulin_region
-created_by: kareneilbeck
-creation_date: 2011-09-01T03:29:41Z
-
-[Term]
-id: SO:0001835
-name: N_region
-def: "Extra nucleotides inserted between rearranged immunoglobulin segments." [SO:ke]
-is_a: SO:0000301 ! vertebrate_immune_system_gene_recombination_feature
-created_by: kareneilbeck
-creation_date: 2011-09-01T03:50:16Z
-
-[Term]
-id: SO:0001836
-name: S_region
-def: "The switch region of immunoglobulin heavy chains; it is involved in the rearrangement of heavy chain DNA leading to the expression of a different immunoglobulin classes from the same B-cell." [SO:ke]
-is_a: SO:0000301 ! vertebrate_immune_system_gene_recombination_feature
-created_by: kareneilbeck
-creation_date: 2011-09-01T03:52:05Z
-
-[Term]
-id: SO:0001837
-name: mobile_element_insertion
-def: "A kind of insertion where the inserted sequence is a mobile element." [EBI:dvga]
-comment: Requested by the ebi.
-synonym: "mobile element insertion" EXACT []
-is_a: SO:0000667 ! insertion
-intersection_of: contains SO:0001037 ! mobile_genetic_element
-created_by: kareneilbeck
-creation_date: 2011-10-04T12:36:52Z
-
-[Term]
-id: SO:0001838
-name: novel_sequence_insertion
-def: "An insertion the sequence of which cannot be mapped to the reference genome." [NCBI:th]
-comment: Requested by the NCBI.
-synonym: "novel sequence insertion" EXACT []
-is_a: SO:0000667 ! insertion
-created_by: kareneilbeck
-creation_date: 2011-10-04T01:14:50Z
-
-[Term]
-id: SO:0001839
-name: CSL_response_element
-def: "A promoter element with consensus sequence GTGRGAA, bound by CSL (CBF1/RBP-JK/Suppressor of Hairless/LAG-1) transcription factors." [PMID:19101542]
-synonym: "CSL response element" EXACT []
-is_a: SO:0001659 ! promoter_element
-created_by: kareneilbeck
-creation_date: 2011-10-07T03:37:43Z
-
-[Term]
-id: SO:0001840
-name: GATA_box
-def: "A GATA transcription factor element containing the consensus sequence WGATAR (in which W indicates A/T and R indicates A/G)." [PMID:8321208]
-synonym: "GATA box" EXACT []
-synonym: "GATA element" RELATED []
-is_a: SO:0001660 ! core_promoter_element
-created_by: kareneilbeck
-creation_date: 2011-10-07T03:42:05Z
-
-[Term]
-id: SO:0001841
-name: polymorphic_pseudogene
-def: "Pseudogene owing to a SNP/DIP but in other individuals/haplotypes/strains the gene is translated." [JAX:hd]
-comment: This terms is used by ensembl and vega.
-synonym: "polymorphic psuedogene" EXACT []
-is_a: SO:0000336 ! pseudogene
-created_by: kareneilbeck
-creation_date: 2011-10-07T03:46:57Z
-
-[Term]
-id: SO:0001842
-name: AP_1_binding_site
-def: "A promoter element with consensus sequence TGACTCA, bound by AP-1 and related transcription factors." [PMID:1899230, PMID:3034432, PMID:3125983]
-synonym: "AP-1 binding site" EXACT []
-is_a: SO:0001659 ! promoter_element
-created_by: kareneilbeck
-creation_date: 2011-10-07T03:54:52Z
-
-[Term]
-id: SO:0001843
-name: CRE
-def: "A promoter element with consensus sequence TGACGTCA; bound by the ATF/CREB family of transcription factors." [PMID:11483355, PMID:11483993]
-synonym: "ATF/CRE site" EXACT [PMID:11483993]
-synonym: "cyclic AMP response element" EXACT []
-is_a: SO:0001659 ! promoter_element
-created_by: kareneilbeck
-creation_date: 2011-10-07T03:58:48Z
-
-[Term]
-id: SO:0001844
-name: CuRE
-def: "A promoter element bound by copper ion-sensing transcription factors such as S. cerevisiae Mac1p or S. pombe Cuf1; the consensus sequence is HTHNNGCTGD (more specifically TTTGCKCR in budding yeast)." [PMID:10593913, PMID:9188496, PMID:9211922]
-synonym: "copper-response element" EXACT []
-is_a: SO:0001659 ! promoter_element
-created_by: kareneilbeck
-creation_date: 2011-10-07T04:02:51Z
-
-[Term]
-id: SO:0001845
-name: DRE
-def: "A promoter element with consensus sequence CGWGGWNGMM, bound by transcription factors related to RecA and found in promoters of genes expressed following several types of DNA damage or inhibition of DNA synthesis." [PMID:11073995, PMID:8668127]
-synonym: "DNA damage response element" EXACT []
-is_a: SO:0001659 ! promoter_element
-created_by: kareneilbeck
-creation_date: 2011-10-07T04:17:25Z
-
-[Term]
-id: SO:0001846
-name: FLEX_element
-def: "A promoter element that has consensus sequence GTAAACAAACAAAM and contains a heptameric core GTAAACA, bound by transcription factors with a forkhead DNA-binding domain." [PMID:10747048, PMID:14871934]
-synonym: "FLEX element" RELATED []
-is_a: SO:0001659 ! promoter_element
-created_by: kareneilbeck
-creation_date: 2011-10-07T04:20:01Z
-
-[Term]
-id: SO:0001847
-name: forkhead_motif
-def: "A promoter element with consensus sequence TTTRTTTACA, bound by transcription factors with a forkhead DNA-binding domain." [PMID:15195092]
-synonym: "forkhead motif" EXACT []
-is_a: SO:0001659 ! promoter_element
-created_by: kareneilbeck
-creation_date: 2011-10-07T04:22:06Z
-
-[Term]
-id: SO:0001848
-name: homol_D_box
-def: "A core promoter element that has the consensus sequence CAGTCACA (or its inverted form TGTGACTG), and plays the role of a TATA box in promoters that do not contain a canonical TATA sequence." [PMID:7501449, PMID:8458332]
-synonym: "homol D box" EXACT []
-is_a: SO:0001660 ! core_promoter_element
-created_by: kareneilbeck
-creation_date: 2011-10-07T04:24:14Z
-
-[Term]
-id: SO:0001849
-name: homol_E_box
-def: "A core promoter element that has the consensus sequence ACCCTACCCT (or its inverted form AGGGTAGGGT), and is found near the homol D box in some promoters that use a homol D box instead of a canonical TATA sequence." [PMID:7501449]
-synonym: "homol E box" EXACT []
-is_a: SO:0001659 ! promoter_element
-created_by: kareneilbeck
-creation_date: 2011-10-07T04:26:09Z
-
-[Term]
-id: SO:0001850
-name: HSE
-def: "A promoter element that consists of at least three copies of the pentanucleotide NGAAN, bound by the heat shock transcription factor HSF." [PMID:17347150, PMID:8689565]
-synonym: "heat shock element" EXACT []
-is_a: SO:0001659 ! promoter_element
-created_by: kareneilbeck
-creation_date: 2011-10-07T04:29:10Z
-
-[Term]
-id: SO:0001851
-name: iron_repressed_GATA_element
-def: "A GATA promoter element with consensus sequence WGATAA, found in promoters of genes repressed in the presence of iron." [PMID:11956219, PMID:17211681]
-comment: The synonym IDP (GATA) is found in an annotation but un-traced as far as literature goes.
-synonym: "IDP (GATA)" EXACT []
-synonym: "iron repressed GATA element" EXACT []
-is_a: SO:0001840 ! GATA_box
-created_by: kareneilbeck
-creation_date: 2011-10-07T04:32:42Z
-
-[Term]
-id: SO:0001852
-name: mating_type_M_box
-def: "A promoter element with consensus sequence ACAAT, found in promoters of mating type M-specific genes in fission yeast and bound by the transcription factor Mat1-Mc." [PMID:9233811]
-comment: Note that this should not be confused with the M-box that has consensus sequence CATGTG and is bound by bHLH transcription factors such as MITF.
-synonym: "mating type M-box" EXACT []
-is_a: SO:0001659 ! promoter_element
-created_by: kareneilbeck
-creation_date: 2011-10-07T04:39:43Z
-
-[Term]
-id: SO:0001853
-name: androgen_response_element
-def: "A non-palindromic sequence found in the promoters of genes whose expression is regulated in response to androgen." [PMID:21796522]
-synonym: "androgen response element" EXACT []
-synonym: "ARE" EXACT []
-is_a: SO:0000713 ! DNA_motif
-created_by: kareneilbeck
-creation_date: 2011-10-10T04:52:44Z
-
-[Term]
-id: SO:0001854
-name: smFISH_probe
-def: "A smFISH is a probe that binds RNA in a single molecule in situ hybridization experiment." [PMID:18806792]
-synonym: "single molecule fish probe" EXACT []
-synonym: "smFISH probe" RELATED []
-is_a: SO:0000051 ! probe
-created_by: kareneilbeck
-creation_date: 2011-10-10T05:00:30Z
-
-[Term]
-id: SO:0001855
-name: MCB
-def: "A promoter element with consensus sequence ACGCGT, bound by the transcription factor complex MBF (MCB-binding factor) and found in promoters of genes expressed during the G1/S transition of the cell cycle." [PMID:16285853]
-synonym: "MluI cell cycle box" EXACT []
-is_a: SO:0001659 ! promoter_element
-created_by: kareneilbeck
-creation_date: 2011-10-10T05:09:45Z
-
-[Term]
-id: SO:0001856
-name: CCAAT_motif
-def: "A promoter element with consensus sequence CCAAT, bound by a protein complex that represses transcription in response to low iron levels." [PMID:16963626]
-synonym: "CCAAT motif" EXACT []
-is_a: SO:0001659 ! promoter_element
-created_by: kareneilbeck
-creation_date: 2011-10-10T05:13:54Z
-
-[Term]
-id: SO:0001857
-name: Ace2_UAS
-def: "A promoter element with consensus sequence CCAGCC, bound by the fungal transcription factor Ace2." [PMID:16678171]
-synonym: "Ace2 upstream activating sequence" EXACT []
-is_a: SO:0001659 ! promoter_element
-created_by: kareneilbeck
-creation_date: 2011-10-10T05:19:10Z
-
-[Term]
-id: SO:0001858
-name: TR_box
-def: "A promoter element with consensus sequence TTCTTTGTTY, bound an HMG-box transcription factor such as S. pombe Ste11, and found in promoters of genes up-regulated early in meiosis." [PMID:1657709]
-synonym: "TR box" EXACT []
-is_a: SO:0001659 ! promoter_element
-created_by: kareneilbeck
-creation_date: 2011-10-10T05:22:13Z
-
-[Term]
-id: SO:0001859
-name: STREP_motif
-def: "A promoter element with consensus sequence CCCCTC, bound by the PKA-responsive zinc finger transcription factor Rst2." [PMID:11739717]
-synonym: "STREP motif" RELATED []
-synonym: "stress-starvation response element of Schizosaccharomyces pombe" EXACT []
-is_a: SO:0001659 ! promoter_element
-created_by: kareneilbeck
-creation_date: 2011-10-14T10:25:02Z
-
-[Term]
-id: SO:0001860
-name: rDNA_intergenic_spacer_element
-def: "A DNA motif that contains a core consensus sequence AGGTAAGGGTAATGCAC, is found in the intergenic regions of rDNA repeats, and is bound by an RNA polymerase I transcription termination factor (e.g. S. pombe Reb1)." [PMID:9016645]
-synonym: "rDIS" EXACT []
-is_a: SO:0000713 ! DNA_motif
-created_by: kareneilbeck
-creation_date: 2011-10-19T11:23:09Z
-
-[Term]
-id: SO:0001861
-name: sterol_regulatory_element
-def: "A 10-bp promoter element bound by sterol regulatory element binding proteins (SREBPs), found in promoters of genes involved in sterol metabolism. Many variants of the sequence ATCACCCCAC function as SREs." [GO:mah, PMID:11111080, PMID:16537923]
-synonym: "SRE" BROAD [GO:mah]
-is_a: SO:0001659 ! promoter_element
-created_by: kareneilbeck
-creation_date: 2011-10-19T03:02:05Z
-
-[Term]
-id: SO:0001862
-name: GT_dinucleotide_repeat
-def: "A dinucleotide repeat region composed of GT repeating elements." [SO:ke]
-comment: paper:PMID:16043634.
-synonym: "d(GT)n" EXACT []
-is_a: SO:0000290 ! dinucleotide_repeat_microsatellite_feature
-created_by: kareneilbeck
-creation_date: 2011-10-19T03:54:37Z
-
-[Term]
-id: SO:0001863
-name: GTT_trinucleotide_repeat
-def: "A trinucleotide repeat region composed of GTT repeating elements." [SO:ke]
-synonym: "d(GTT)" EXACT []
-is_a: SO:0000291 ! trinucleotide_repeat_microsatellite_feature
-created_by: kareneilbeck
-creation_date: 2011-10-19T03:56:54Z
-
-[Term]
-id: SO:0001864
-name: Sap1_recognition_motif
-def: "A DNA motif to which the S. pombe Sap1 protein binds. The consensus sequence is 5'-TARGCAGNTNYAACGMG-3'; it is found at the mating type locus, where it is important for mating type switching, and at replication fork barriers in rDNA repeats." [PMID:16166653, PMID:7651412]
-synonym: "Sap1 recognitions site" EXACT []
-is_a: SO:0000713 ! DNA_motif
-created_by: kareneilbeck
-creation_date: 2011-10-19T04:24:16Z
-
-[Term]
-id: SO:0001865
-name: CDRE_motif
-def: "An RNA polymerase II promoter element found in the promoters of genes regulated by calcineurin. The consensus sequence is GNGGCKCA." [PMID:16928959]
-synonym: "calcineurin-dependent response element" EXACT [PMID:16928959]
-synonym: "CDRE motif" EXACT []
-is_a: SO:0001659 ! promoter_element
-created_by: kareneilbeck
-creation_date: 2011-10-20T10:12:19Z
-
-[Term]
-id: SO:0005836
-name: regulatory_region
-def: "A region of sequence that is involved in the control of a biological process." [SO:ke]
-subset: SOFA
-synonym: "regulatory region" EXACT []
-xref: http://en.wikipedia.org/wiki/Regulatory_region "wiki"
-is_a: SO:0000831 ! gene_member_region
-
-[Term]
-id: SO:0005837
-name: U14_snoRNA_primary_transcript
-def: "The primary transcript of an evolutionarily conserved eukaryotic low molecular weight RNA capable of intermolecular hybridization with both homologous and heterologous 18S rRNA." [PMID:2251119]
-synonym: "4.5S snRNA primary transcript" EXACT []
-synonym: "U14 snoRNA primary transcript" EXACT []
-is_a: SO:0000232 ! snoRNA_primary_transcript
-
-[Term]
-id: SO:0005841
-name: methylation_guide_snoRNA
-def: "A snoRNA that specifies the site of 2'-O-ribose methylation in an RNA molecule by base pairing with a short sequence around the target residue." [GOC:mah, PMID:12457565]
-comment: Has RNA 2'-O-ribose methylation guide activity (GO:0030561).
-synonym: "methylation guide snoRNA" EXACT []
-is_a: SO:0000593 ! C_D_box_snoRNA
-relationship: derives_from SO:0000580 ! methylation_guide_snoRNA_primary_transcript
-
-[Term]
-id: SO:0005843
-name: rRNA_cleavage_RNA
-def: "An ncRNA that is part of a ribonucleoprotein that cleaves the primary pre-rRNA transcript in the process of producing mature rRNA molecules." [GOC:kgc]
-synonym: "rRNA cleavage RNA" EXACT []
-is_a: SO:0000655 ! ncRNA
-relationship: derives_from SO:0000582 ! rRNA_cleavage_snoRNA_primary_transcript
-
-[Term]
-id: SO:0005845
-name: exon_of_single_exon_gene
-def: "An exon that is the only exon in a gene." [RSC:cb]
-synonym: "exon of single exon gene" EXACT []
-synonym: "single_exon" RELATED []
-synonym: "singleton exon" EXACT []
-is_a: SO:0000147 ! exon
-
-[Term]
-id: SO:0005847
-name: cassette_array_member
-synonym: "cassette array member" EXACT []
-is_a: SO:0005848 ! gene_cassette_member
-
-[Term]
-id: SO:0005848
-name: gene_cassette_member
-synonym: "gene cassette member" EXACT []
-is_a: SO:0000081 ! gene_array_member
-
-[Term]
-id: SO:0005849
-name: gene_subarray_member
-synonym: "gene subarray member" EXACT []
-is_a: SO:0000081 ! gene_array_member
-
-[Term]
-id: SO:0005850
-name: primer_binding_site
-def: "Non-covalent primer binding site for initiation of replication, transcription, or reverse transcription." [http://www.ebi.ac.uk/embl/Documentation/FT_definitions/feature_table.html]
-synonym: "primer binding site" EXACT []
-xref: http://en.wikipedia.org/wiki/Primer_binding_site "wiki"
-is_a: SO:0001655 ! nucleotide_binding_site
-relationship: part_of SO:0000186 ! LTR_retrotransposon
-
-[Term]
-id: SO:0005851
-name: gene_array
-def: "An array includes two or more genes, or two or more gene subarrays, contiguously arranged where the individual genes, or subarrays, are either identical in sequence, or essentially so." [SO:ma]
-comment: This would include, for example, a cluster of genes each encoding the major ribosomal RNAs and a cluster of histone gene subarrays.
-synonym: "gene array" EXACT []
-is_a: SO:0005855 ! gene_group
-
-[Term]
-id: SO:0005852
-name: gene_subarray
-def: "A subarray is, by defintition, a member of a gene array (SO:0005851); the members of a subarray may differ substantially in sequence, but are closely related in function." [SO:ma]
-comment: This would include, for example, a cluster of genes encoding different histones.
-synonym: "gene subarray" EXACT []
-is_a: SO:0005855 ! gene_group
-
-[Term]
-id: SO:0005853
-name: gene_cassette
-def: "A gene that can be substituted for a related gene at a different site in the genome." [SGD:se]
-comment: This would include, for example, the mating type gene cassettes of S. cerevisiae. Gene cassettes usually exist as linear sequences as part of a larger DNA molecule, such as a chromosome or plasmid.
-synonym: "gene cassette" EXACT []
-xref: http://en.wikipedia.org/wiki/Gene_cassette "wiki"
-is_a: SO:0000704 ! gene
-
-[Term]
-id: SO:0005854
-name: gene_cassette_array
-def: "An array of non-functional genes whose members, when captured by recombination form functional genes." [SO:ma]
-comment: This would include, for example, the arrays of non-functional VSG genes of Trypanosomes.
-synonym: "gene cassette array" EXACT []
-is_a: SO:0005855 ! gene_group
-relationship: has_part SO:0005853 ! gene_cassette
-
-[Term]
-id: SO:0005855
-name: gene_group
-def: "A collection of related genes." [SO:ma]
-subset: SOFA
-synonym: "gene group" EXACT []
-is_a: SO:0001411 ! biological_region
-
-[Term]
-id: SO:0005856
-name: selenocysteine_tRNA_primary_transcript
-def: "A primary transcript encoding seryl tRNA (SO:000269)." [SO:ke]
-synonym: "selenocysteine tRNA primary transcript" EXACT []
-is_a: SO:0000210 ! tRNA_primary_transcript
-
-[Term]
-id: SO:0005857
-name: selenocysteinyl_tRNA
-def: "A tRNA sequence that has a selenocysteine anticodon, and a 3' selenocysteine binding region." [SO:ke]
-synonym: "selenocysteinyl tRNA" EXACT []
-synonym: "selenocysteinyl-transfer ribonucleic acid" EXACT []
-synonym: "selenocysteinyl-transfer RNA" EXACT []
-is_a: SO:0000253 ! tRNA
-relationship: derives_from SO:0005856 ! selenocysteine_tRNA_primary_transcript
-
-[Term]
-id: SO:0005858
-name: syntenic_region
-def: "A region in which two or more pairs of homologous markers occur on the same chromosome in two or more species." [http://www.informatics.jax.org/silverbook/glossary.shtml]
-synonym: "syntenic region" EXACT []
-is_a: SO:0000330 ! implied link automatically realized ! conserved_region
-intersection_of: SO:0000330 ! conserved_region
-intersection_of: has_quality SO:0000860 ! syntenic
-
-[Term]
-id: SO:0100001
-name: biochemical_region_of_peptide
-def: "A region of a peptide that is involved in a biochemical function." [EBIBS:GAR]
-comment: Range.
-subset: biosapiens
-synonym: "biochemical motif" EXACT []
-synonym: "biochemical region of peptide" EXACT []
-synonym: "biochemical_region" RELATED []
-is_a: SO:0001067 ! polypeptide_motif
-
-[Term]
-id: SO:0100002
-name: molecular_contact_region
-def: "A region that is involved a contact with another molecule." [EBIBS:GAR]
-comment: Range.
-subset: biosapiens
-synonym: "molecular contact region" RELATED []
-is_a: SO:0100001 ! biochemical_region_of_peptide
-
-[Term]
-id: SO:0100003
-name: intrinsically_unstructured_polypeptide_region
-def: "A region of polypeptide chain with high conformational flexibility." [EBIBS:GAR]
-subset: biosapiens
-synonym: "disordered region" RELATED BS []
-synonym: "intrinsically unstructured polypeptide region" EXACT []
-is_a: SO:0001070 ! polypeptide_structural_region
-
-[Term]
-id: SO:0100004
-name: catmat_left_handed_three
-def: "A motif of 3 consecutive residues with dihedral angles as follows: res i: phi -90 bounds -120 to -60, res i: psi -10 bounds -50 to 30, res i+1: phi -75 bounds -100 to -50, res i+1: psi 140 bounds 110 to 170. An extra restriction of the length of the O to O distance would be useful, that it be less than 5 Angstrom. More precisely these two oxygens are the main chain carbonyl oxygen atoms of residues i-1 and i+1." [EBIBS:GAR, http://www.ebi.ac.uk/msd-srv/msdmotif/]
-subset: biosapiens
-synonym: "catmat-3l" EXACT []
-is_a: SO:0001078 ! polypeptide_secondary_structure
-
-[Term]
-id: SO:0100005
-name: catmat_left_handed_four
-def: "A motif of 4 consecutive residues with dihedral angles as follows: res i: phi -90 bounds -120 to -60, res i psi -10 bounds -50 to 30, res i+1: phi -90 bounds -120 to -60, res i+1: psi -10 bounds -50 to 30, res i+2: phi -75 bounds -100 to -50, res i+2: psi 140 bounds 110 to 170.  The extra restriction of the length of the O to O distance is similar, that it be less than 5 Angstrom. In this case these two Oxygen atoms are the main chain carbonyl oxygen atoms of residues i-1 and i+2." [...]
-subset: biosapiens
-synonym: "catmat-4l" EXACT []
-is_a: SO:0001078 ! polypeptide_secondary_structure
-
-[Term]
-id: SO:0100006
-name: catmat_right_handed_three
-def: "A motif of 3 consecutive residues with dihedral angles as follows: res i: phi -90 bounds -120 to -60, res i: psi -10 bounds -50 to 30, res i+1: phi -75 bounds -100 to -50, res i+1: psi 140 bounds 110 to 170. An extra restriction of the length of the O to O distance would be useful, that it be less than 5 Angstrom. More precisely these two oxygens are the main chain carbonyl oxygen atoms of residues i-1 and i+1." [EBIBS:GAR, http://www.ebi.ac.uk/msd-srv/msdmotif/]
-subset: biosapiens
-synonym: "catmat-3r" EXACT []
-is_a: SO:0001078 ! polypeptide_secondary_structure
-
-[Term]
-id: SO:0100007
-name: catmat_right_handed_four
-def: "A motif of 4 consecutive residues with dihedral angles as follows: res i: phi -90 bounds -120 to -60, res i: psi -10 bounds -50 to 30, res i+1: phi -90 bounds -120 to -60, res i+1: psi -10 bounds -50 to 30, res i+2: phi -75 bounds -100 to -50, res i+2: psi 140 bounds 110 to 170. The extra restriction of the length of the O to O distance is similar, that it be less than 5 Angstrom. In this case these two Oxygen atoms are the main chain carbonyl oxygen atoms of residues i-1 and i+2." [...]
-subset: biosapiens
-synonym: "catmat-4r" EXACT []
-is_a: SO:0001078 ! polypeptide_secondary_structure
-
-[Term]
-id: SO:0100008
-name: alpha_beta_motif
-def: "A motif of five consecutive residues and two H-bonds in which: H-bond between CO of residue(i) and NH of residue(i+4), H-bond between CO of residue(i) and NH of residue(i+3),Phi angles of residues(i+1), (i+2) and (i+3) are negative." [EBIBS:GAR, http://www.ebi.ac.uk/msd-srv/msdmotif/]
-subset: biosapiens
-synonym: "alpha beta motif" EXACT []
-is_a: SO:0001078 ! polypeptide_secondary_structure
-
-[Term]
-id: SO:0100009
-name: lipoprotein_signal_peptide
-def: "A peptide that acts as a signal for both membrane translocation and lipid attachment in prokaryotes." [EBIBS:GAR]
-subset: biosapiens
-synonym: "lipoprotein signal peptide" EXACT []
-synonym: "prokaryotic membrane lipoprotein lipid attachment site" EXACT []
-is_a: SO:0100011 ! cleaved_peptide_region
-
-[Term]
-id: SO:0100010
-name: no_output
-def: "An experimental region wherean analysis has been run and not produced any annotation." [EBIBS:GAR]
-subset: biosapiens
-synonym: "no output" EXACT BS []
-is_a: SO:0000703 ! experimental_result_region
-
-[Term]
-id: SO:0100011
-name: cleaved_peptide_region
-def: "The cleaved_peptide_regon is the a region of peptide sequence that is cleaved during maturation." [EBIBS:GAR]
-comment: Range.
-subset: biosapiens
-subset: SOFA
-synonym: "cleaved peptide region" EXACT []
-is_a: SO:0000839 ! polypeptide_region
-relationship: part_of SO:0001063 ! immature_peptide_region
-
-[Term]
-id: SO:0100012
-name: peptide_coil
-def: "Irregular, unstructured regions of a protein's backbone, as distinct from the regular region (namely alpha helix and beta strand - characterised by specific patterns of main-chain hydrogen bonds)." [EBIBS:GAR]
-subset: biosapiens
-synonym: "coil" RELATED BS []
-synonym: "peptide coil" EXACT []
-synonym: "random coil" RELATED BS []
-is_a: SO:0001078 ! polypeptide_secondary_structure
-
-[Term]
-id: SO:0100013
-name: hydrophobic_region_of_peptide
-def: "Hydrophobic regions are regions with a low affinity for water." [EBIBS:GAR]
-comment: Range.
-subset: biosapiens
-synonym: "hydropathic" RELATED []
-synonym: "hydrophobic region of peptide" RELATED []
-synonym: "hydrophobic_region" EXACT []
-synonym: "hydrophobicity" RELATED []
-is_a: SO:0000839 ! polypeptide_region
-
-[Term]
-id: SO:0100014
-name: n_terminal_region
-def: "The amino-terminal positively-charged region of a signal peptide (approx 1-5 aa)." [EBIBS:GAR]
-subset: biosapiens
-synonym: "N-region" RELATED []
-is_a: SO:0100011 ! cleaved_peptide_region
-relationship: part_of SO:0000418 ! signal_peptide
-
-[Term]
-id: SO:0100015
-name: c_terminal_region
-def: "The more polar, carboxy-terminal region of the signal peptide (approx 3-7 aa)." [EBIBS:GAR]
-subset: biosapiens
-synonym: "C-region" RELATED []
-is_a: SO:0100011 ! cleaved_peptide_region
-relationship: part_of SO:0000418 ! signal_peptide
-
-[Term]
-id: SO:0100016
-name: central_hydrophobic_region_of_signal_peptide
-def: "The central, hydrophobic region of the signal peptide (approx 7-15 aa)." [EBIBS:GAR]
-subset: biosapiens
-synonym: "central hydrophobic region of signal peptide" EXACT []
-synonym: "central_hydrophobic_region" RELATED []
-synonym: "H-region" RELATED []
-is_a: SO:0100011 ! cleaved_peptide_region
-relationship: part_of SO:0000418 ! signal_peptide
-
-[Term]
-id: SO:0100017
-name: polypeptide_conserved_motif
-def: "A conserved motif is a short (up to 20 amino acids) region of biological interest that is conserved in different proteins. They may or may not have functional or structural significance within the proteins in which they are found." [EBIBS:GAR]
-subset: biosapiens
-synonym: "motif" RELATED []
-is_a: SO:0001067 ! polypeptide_motif
-
-[Term]
-id: SO:0100018
-name: polypeptide_binding_motif
-def: "A polypeptide binding motif is a short (up to 20 amino acids) polypeptide region of biological interest that contains one or more amino acids experimentally shown to bind to a ligand." [EBIBS:GAR]
-subset: biosapiens
-synonym: "binding" RELATED [uniprot:feature_type]
-synonym: "polypeptide binding motif" EXACT []
-is_a: SO:0100001 ! biochemical_region_of_peptide
-
-[Term]
-id: SO:0100019
-name: polypeptide_catalytic_motif
-def: "A polypeptide catalytic motif is a short (up to 20 amino acids) polypeptide region that contains one or more active site residues." [EBIBS:GAR]
-subset: biosapiens
-synonym: "catalytic_motif" RELATED []
-synonym: "polypeptide catalytic motif" EXACT []
-is_a: SO:0100001 ! biochemical_region_of_peptide
-
-[Term]
-id: SO:0100020
-name: polypeptide_DNA_contact
-def: "A binding site that, in the polypeptide molecule, interacts selectively and non-covalently with DNA." [EBIBS:GAR, SO:ke]
-subset: biosapiens
-synonym: "polypeptide DNA contact" EXACT []
-is_a: SO:0001429 ! DNA_binding_site
-is_a: SO:0100002 ! molecular_contact_region
-
-[Term]
-id: SO:0100021
-name: polypeptide_conserved_region
-def: "A subsection of sequence with biological interest that is conserved in different proteins. They may or may not have functional or structural significance within the proteins in which they are found." [EBIBS:GAR]
-subset: biosapiens
-synonym: "polypeptide conserved region" EXACT []
-is_a: SO:0000839 ! polypeptide_region
-
-[Term]
-id: SO:1000002
-name: substitution
-def: "A sequence alteration where the length of the change in the variant is the same as that of the reference." [SO:ke]
-subset: SOFA
-is_a: SO:0001059 ! sequence_alteration
-is_a: SO:0001411 ! biological_region
-
-[Term]
-id: SO:1000005
-name: complex_substitution
-def: "When no simple or well defined DNA mutation event describes the observed DNA change, the keyword \"complex\" should be used. Usually there are multiple equally plausible explanations for the change." [EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html]
-subset: SOFA
-synonym: "complex substitution" EXACT []
-is_a: SO:1000002 ! substitution
-
-[Term]
-id: SO:1000008
-name: point_mutation
-def: "A single nucleotide change which has occurred at the same position of a corresponding nucleotide in a reference sequence." [SO:immuno_workshop]
-subset: SOFA
-synonym: "point mutation" EXACT []
-xref: http://en.wikipedia.org/wiki/Point_mutation "wiki"
-is_a: SO:0001483 ! SNV
-
-[Term]
-id: SO:1000009
-name: transition
-def: "Change of a pyrimidine nucleotide, C or T, into an other pyrimidine nucleotide, or change of a purine nucleotide, A or G, into an other purine nucleotide." [EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html]
-is_a: SO:0001483 ! SNV
-
-[Term]
-id: SO:1000010
-name: pyrimidine_transition
-def: "A substitution of a pyrimidine, C or T, for another pyrimidine." [SO:ke]
-synonym: "pyrimidine transition" EXACT []
-is_a: SO:1000009 ! transition
-
-[Term]
-id: SO:1000011
-name: C_to_T_transition
-def: "A transition of a cytidine to a thymine." [SO:ke]
-synonym: "C to T transition" EXACT []
-is_a: SO:1000010 ! pyrimidine_transition
-
-[Term]
-id: SO:1000012
-name: C_to_T_transition_at_pCpG_site
-def: "The transition of cytidine to thymine occurring at a pCpG site as a consequence of the spontaneous deamination of 5'-methylcytidine." [EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html]
-synonym: "C to T transition at pCpG site" EXACT []
-is_a: SO:1000011 ! C_to_T_transition
-
-[Term]
-id: SO:1000013
-name: T_to_C_transition
-synonym: "T to C transition" EXACT []
-is_a: SO:1000010 ! pyrimidine_transition
-
-[Term]
-id: SO:1000014
-name: purine_transition
-def: "A substitution of a purine, A or G, for another purine." [SO:ke]
-synonym: "purine transition" EXACT []
-is_a: SO:1000009 ! transition
-
-[Term]
-id: SO:1000015
-name: A_to_G_transition
-def: "A transition of an adenine to a guanine." [SO:ke]
-synonym: "A to G transition" EXACT []
-is_a: SO:1000014 ! purine_transition
-
-[Term]
-id: SO:1000016
-name: G_to_A_transition
-def: "A transition of a guanine to an adenine." [SO:ke]
-synonym: "G to A transition" EXACT []
-is_a: SO:1000014 ! purine_transition
-
-[Term]
-id: SO:1000017
-name: transversion
-def: "Change of a pyrimidine nucleotide, C or T, into a purine nucleotide, A or G, or vice versa." [EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html]
-xref: http://en.wikipedia.org/wiki/Transversion "wiki"
-is_a: SO:0001483 ! SNV
-
-[Term]
-id: SO:1000018
-name: pyrimidine_to_purine_transversion
-def: "Change of a pyrimidine nucleotide, C or T, into a purine nucleotide, A or G." [SO:ke]
-synonym: "pyrimidine to purine transversion" EXACT []
-is_a: SO:1000017 ! transversion
-
-[Term]
-id: SO:1000019
-name: C_to_A_transversion
-def: "A transversion from cytidine to adenine." [SO:ke]
-synonym: "C to A transversion" EXACT []
-is_a: SO:1000018 ! pyrimidine_to_purine_transversion
-
-[Term]
-id: SO:1000020
-name: C_to_G_transversion
-synonym: "C to G transversion" EXACT []
-is_a: SO:1000018 ! pyrimidine_to_purine_transversion
-
-[Term]
-id: SO:1000021
-name: T_to_A_transversion
-def: "A transversion from T to A." [SO:ke]
-synonym: "T to A transversion" EXACT []
-is_a: SO:1000018 ! pyrimidine_to_purine_transversion
-
-[Term]
-id: SO:1000022
-name: T_to_G_transversion
-def: "A transversion from T to G." [SO:ke]
-synonym: "T to G transversion" EXACT []
-is_a: SO:1000018 ! pyrimidine_to_purine_transversion
-
-[Term]
-id: SO:1000023
-name: purine_to_pyrimidine_transversion
-def: "Change of a purine nucleotide, A or G , into a pyrimidine nucleotide C or T." [SO:ke]
-synonym: "purine to pyrimidine transversion" EXACT []
-is_a: SO:1000017 ! transversion
-
-[Term]
-id: SO:1000024
-name: A_to_C_transversion
-def: "A transversion from adenine to cytidine." [SO:ke]
-synonym: "A to C transversion" EXACT []
-is_a: SO:1000023 ! purine_to_pyrimidine_transversion
-
-[Term]
-id: SO:1000025
-name: A_to_T_transversion
-def: "A transversion from adenine to thymine." [SO:ke]
-synonym: "A to T transversion" EXACT []
-is_a: SO:1000023 ! purine_to_pyrimidine_transversion
-
-[Term]
-id: SO:1000026
-name: G_to_C_transversion
-def: "A transversion from guanine to cytidine." [SO:ke]
-synonym: "G to C transversion" EXACT []
-is_a: SO:1000023 ! purine_to_pyrimidine_transversion
-
-[Term]
-id: SO:1000027
-name: G_to_T_transversion
-def: "A transversion from guanine to thymine." [SO:ke]
-synonym: "G to T transversion" EXACT []
-is_a: SO:1000023 ! purine_to_pyrimidine_transversion
-
-[Term]
-id: SO:1000028
-name: intrachromosomal_mutation
-def: "A chromosomal structure variation within a single chromosome." [SO:ke]
-synonym: "intrachromosomal mutation" EXACT []
-is_a: SO:1000183 ! chromosome_structure_variation
-intersection_of: SO:1000183 ! chromosome_structure_variation
-intersection_of: has_quality SO:0001510 ! intrachromosomal
-
-[Term]
-id: SO:1000029
-name: chromosomal_deletion
-def: "An incomplete chromosome." [SO:ke]
-synonym: "(bacteria)&Dgr;" RELATED []
-synonym: "(Drosophila)Df" RELATED []
-synonym: "(fungi)D" RELATED []
-synonym: "chromosomal deletion" EXACT []
-synonym: "deficiency" EXACT []
-xref: http://en.wikipedia.org/wiki/Chromosomal_deletion "wiki"
-is_a: SO:1000028 ! intrachromosomal_mutation
-intersection_of: SO:1000028 ! intrachromosomal_mutation
-intersection_of: has_part SO:0000159 ! deletion
-
-[Term]
-id: SO:1000030
-name: chromosomal_inversion
-def: "An interchromosomal mutation where a region of the chromosome is inverted with respect to wild type." [SO:ke]
-synonym: "(bacteria)IN" RELATED []
-synonym: "(Drosophila)In" RELATED []
-synonym: "(fungi)In" RELATED []
-synonym: "chromosomal inversion" EXACT []
-xref: http://en.wikipedia.org/wiki/Chromosomal_inversion "wiki"
-is_a: SO:1000028 ! intrachromosomal_mutation
-intersection_of: SO:1000028 ! intrachromosomal_mutation
-intersection_of: has_part SO:1000036 ! inversion
-
-[Term]
-id: SO:1000031
-name: interchromosomal_mutation
-def: "A chromosomal structure variation whereby more than one chromosome is involved." [SO:ke]
-synonym: "interchromosomal mutation" EXACT []
-is_a: SO:1000183 ! chromosome_structure_variation
-intersection_of: SO:1000183 ! chromosome_structure_variation
-intersection_of: has_quality SO:0001511 ! interchromosomal
-
-[Term]
-id: SO:1000032
-name: indel
-def: "A sequence alteration which included an insertion and a deletion, affecting 2 or more bases." [EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html, http:http\://www.hgvs.org/mutnomen/recs-DNA.html#indel]
-comment: Indels can have a different number of bases than the corresponding reference sequence.
-xref: http://en.wikipedia.org/wiki/Indel "wiki"
-is_a: SO:0001059 ! sequence_alteration
-
-[Term]
-id: SO:1000035
-name: duplication
-def: "One or more nucleotides are added between two adjacent nucleotides in the sequence; the inserted sequence derives from, or is identical in sequence to, nucleotides adjacent to insertion point." [EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html]
-synonym: "nucleotide duplication" EXACT []
-synonym: "nucleotide_duplication" RELATED []
-is_a: SO:0000667 ! insertion
-
-[Term]
-id: SO:1000036
-name: inversion
-def: "A continuous nucleotide sequence is inverted in the same position." [EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html]
-subset: DBVAR
-subset: SOFA
-synonym: "inversion" EXACT dbvar [http://www.ncbi.nlm.nih.gov/dbvar/]
-is_a: SO:0001059 ! sequence_alteration
-is_a: SO:0001411 ! biological_region
-
-[Term]
-id: SO:1000037
-name: chromosomal_duplication
-def: "An extra chromosome." [SO:ke]
-synonym: "(Drosophila)Dp" RELATED []
-synonym: "(fungi)Dp" RELATED []
-synonym: "chromosomal duplication" EXACT []
-xref: http://en.wikipedia.org/wiki/Chromosomal_duplication "wiki"
-is_a: SO:1000183 ! chromosome_structure_variation
-
-[Term]
-id: SO:1000038
-name: intrachromosomal_duplication
-def: "A duplication that occurred within a chromosome." [SO:ke]
-synonym: "intrachromosomal duplication" EXACT []
-is_a: SO:1000028 ! intrachromosomal_mutation
-is_a: SO:1000037 ! chromosomal_duplication
-intersection_of: SO:1000028 ! intrachromosomal_mutation
-intersection_of: has_part SO:1000035 ! duplication
-
-[Term]
-id: SO:1000039
-name: direct_tandem_duplication
-def: "A tandem duplication where the individual regions are in the same orientation." [SO:ke]
-synonym: "direct tandem duplication" EXACT []
-is_a: SO:1000173 ! tandem_duplication
-
-[Term]
-id: SO:1000040
-name: inverted_tandem_duplication
-def: "A tandem duplication where the individual regions are not in the same orientation." [SO:ke]
-synonym: "inverted tandem duplication" EXACT []
-synonym: "mirror duplication" RELATED []
-is_a: SO:1000173 ! tandem_duplication
-
-[Term]
-id: SO:1000041
-name: intrachromosomal_transposition
-def: "A chromosome structure variation whereby a transposition occurred within a chromosome." [SO:ke]
-synonym: "(Drosophila)Tp" RELATED []
-synonym: "intrachromosomal transposition" EXACT []
-is_a: SO:0000453 ! chromosomal_transposition
-is_a: SO:1000038 ! intrachromosomal_duplication
-intersection_of: SO:1000028 ! intrachromosomal_mutation
-intersection_of: has_part SO:0000199 ! translocation
-intersection_of: has_part SO:1000035 ! duplication
-
-[Term]
-id: SO:1000042
-name: compound_chromosome
-def: "A chromosome structure variant where a monocentric element is caused by the fusion of two chromosome arms." [SO:ke]
-synonym: "compound chromosome" EXACT []
-is_a: SO:1000183 ! chromosome_structure_variation
-
-[Term]
-id: SO:1000043
-name: Robertsonian_fusion
-def: "A non reciprocal translocation whereby the participating chromosomes break at their centromeres and the long arms fuse to form a single chromosome with a single centromere." [http://en.wikipedia.org/wiki/Robertsonian_translocation]
-synonym: "centric-fusion translocations" EXACT []
-synonym: "Robertsonian fusion" EXACT []
-synonym: "whole-arm translocations" EXACT []
-xref: http://en.wikipedia.org/wiki/Robertsonian_fusion "wiki"
-is_a: SO:1000044 ! chromosomal_translocation
-
-[Term]
-id: SO:1000044
-name: chromosomal_translocation
-def: "An interchromosomal mutation. Rearrangements that alter the pairing of telomeres are classified as translocations." [FB:reference_manual]
-synonym: "(Drosophila)T" RELATED []
-synonym: "(fungi)T" RELATED []
-synonym: "chromosomal translocation" EXACT []
-xref: http://en.wikipedia.org/wiki/Chromosomal_translocation "wiki"
-is_a: SO:1000031 ! interchromosomal_mutation
-intersection_of: SO:1000031 ! interchromosomal_mutation
-intersection_of: has_part SO:0000199 ! translocation
-
-[Term]
-id: SO:1000045
-name: ring_chromosome
-def: "A ring chromosome is a chromosome whose arms have fused together to form a ring, often with the loss of the ends of the chromosome." [http://en.wikipedia.org/wiki/Ring_chromosome]
-synonym: "(Drosophila)R" RELATED []
-synonym: "(fungi)C" RELATED []
-synonym: "ring chromosome" EXACT []
-xref: http://en.wikipedia.org/wiki/Ring_chromosome "wiki"
-is_a: SO:1000028 ! intrachromosomal_mutation
-intersection_of: SO:1000028 ! intrachromosomal_mutation
-intersection_of: has_quality SO:0000988 ! circular
-
-[Term]
-id: SO:1000046
-name: pericentric_inversion
-def: "A chromosomal inversion that includes the centromere." [FB:reference_manual]
-synonym: "pericentric inversion" EXACT []
-is_a: SO:1000030 ! chromosomal_inversion
-intersection_of: SO:1000030 ! chromosomal_inversion
-intersection_of: has_quality SO:0001518 ! pericentric
-
-[Term]
-id: SO:1000047
-name: paracentric_inversion
-def: "A chromosomal inversion that does not include the centromere." [FB:reference_manual]
-synonym: "paracentric inversion" EXACT []
-is_a: SO:1000030 ! chromosomal_inversion
-intersection_of: SO:1000030 ! chromosomal_inversion
-intersection_of: has_quality SO:0001519 ! paracentric
-
-[Term]
-id: SO:1000048
-name: reciprocal_chromosomal_translocation
-def: "A chromosomal translocation with two breaks; two chromosome segments have simply been exchanged." [FB:reference_manual]
-synonym: "reciprocal chromosomal translocation" EXACT []
-is_a: SO:1000044 ! chromosomal_translocation
-
-[Term]
-id: SO:1000049
-name: sequence_variation_affecting_transcript
-alt_id: SO:1000177
-alt_id: SO:1000179
-def: "Any change in mature, spliced and processed, RNA that results from a change in the corresponding DNA sequence." [EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html]
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation affecting transcript" EXACT []
-synonym: "mutation causing partially characterised change in transcript" RELATED []
-synonym: "mutation causing uncharacterised change in transcript" RELATED []
-synonym: "sequence variant causing partially characterised change in transcript" EXACT []
-synonym: "sequence variant causing uncharacterised change in transcript" EXACT []
-synonym: "sequence variation affecting transcript" EXACT []
-synonym: "sequence_variant_causing_partially_characterised_change_in_transcript" EXACT []
-synonym: "sequence_variant_causing_uncharacterised_change_in_transcript" EXACT []
-is_obsolete: true
-replaced_by: SO:0001576
-
-[Term]
-id: SO:1000050
-name: sequence_variant_causing_no_change_in_transcript
-def: "No effect on the state of the RNA." [EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html]
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect. Also as there is not change, it is not a good ontological term.
-synonym: "mutation causing no change in transcript" RELATED []
-synonym: "sequence variant causing no change in transcript" EXACT []
-is_obsolete: true
-
-[Term]
-id: SO:1000054
-name: sequence_variation_affecting_coding_sequence
-def: "Any of the amino acid coding triplets of a gene are affected by the DNA mutation." [EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html]
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation affecting coding sequence" EXACT []
-synonym: "sequence variation affecting coding sequence" RELATED []
-is_obsolete: true
-replaced_by: SO:0001580
-
-[Term]
-id: SO:1000055
-name: sequence_variant_causing_initiator_codon_change_in_transcript
-def: "The DNA mutation changes, usually destroys, the first coding triplet of a gene. Usually prevents translation although another initiator codon may be used." [EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html]
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation causing initiator codon change in transcript" RELATED []
-synonym: "sequence variant causing initiator codon change in transcript" EXACT []
-is_obsolete: true
-replaced_by: SO:0001582
-
-[Term]
-id: SO:1000056
-name: sequence_variant_causing_amino_acid_coding_codon_change_in_transcript
-def: "The DNA mutation affects the amino acid coding sequence of a gene; this region includes both the initiator and terminator codons." [EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html]
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutaton causing amino acid coding codon change in transcript" RELATED []
-synonym: "sequence variant causing amino acid coding codon change in transcript" EXACT []
-is_obsolete: true
-consider: SO:0001606
-
-[Term]
-id: SO:1000057
-name: sequence_variant_causing_synonymous_codon_change_in_transcript
-def: "The changed codon has the same translation product as the original codon." [EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html]
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation causing synonymous codon change in transcript" RELATED []
-synonym: "sequence variant causing synonymous codon change in transcript" EXACT []
-is_obsolete: true
-replaced_by: SO:0001588
-
-[Term]
-id: SO:1000058
-name: sequence_variant_causing_non_synonymous_codon_change_in_transcript
-def: "A DNA point mutation that causes a substitution of an amino acid by an other." [EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html]
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation causing non synonymous codon change in transcript" RELATED []
-synonym: "non-synonymous codon change in transcript" EXACT []
-synonym: "sequence variant causing non synonymous codon change in transcript" EXACT []
-is_obsolete: true
-consider: SO:0001583
-
-[Term]
-id: SO:1000059
-name: sequence_variant_causing_missense_codon_change_in_transcript
-def: "The nucleotide change in the codon leads to a new codon coding for a new amino acid." [EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html]
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation causing missense codon change in transcript" RELATED []
-synonym: "sequence variant causing missense codon change in transcript" EXACT []
-is_obsolete: true
-consider: SO:0001583
-
-[Term]
-id: SO:1000060
-name: sequence_variant_causing_conservative_missense_codon_change_in_transcript
-def: "The amino acid change following from the codon change does not change the gross properties (size, charge, hydrophobicity) of the amino acid at that position." [EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html]
-comment: The exact rules need to be stated, a common set of rules can be derived from e.g. BLOSUM62 amino acid distance matrix.
-synonym: "mutation causing conservative missense codon change in transcript" RELATED []
-synonym: "sequence variant causing conservative missense codon change in transcript" EXACT []
-is_obsolete: true
-replaced_by: SO:0001585
-
-[Term]
-id: SO:1000061
-name: sequence_variant_causing_nonconservative_missense_codon_change_in_transcript
-def: "The amino acid change following from the codon change changes the gross properties (size, charge, hydrophobicity) of the amino acid in that position." [EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html]
-comment: The exact rules need to be stated, a common set of rules can be derived from e.g. BLOSUM62 amino acid distance matrix.
-synonym: "mutation causing nonconservative missense codon change in transcript" RELATED []
-synonym: "sequence variant causing nonconservative missense codon change in transcript" EXACT []
-is_obsolete: true
-consider: SO:0001586
-
-[Term]
-id: SO:1000062
-name: sequence_variant_causing_nonsense_codon_change_in_transcript
-def: "The nucleotide change in the codon triplet creates a terminator codon." [EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html]
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation causing nonsense codon change in transcript" RELATED []
-synonym: "sequence variant causing nonsense codon change in transcript" EXACT []
-is_obsolete: true
-consider: SO:0001587
-
-[Term]
-id: SO:1000063
-name: sequence_variant_causing_terminator_codon_change_in_transcript
-def: "The nucleotide change in the codon triplet changes the stop codon, causing an elongated transcript sequence." [SO:ke]
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation causing terminator codon change in transcript" RELATED []
-synonym: "sequence variant causing terminator codon change in transcript" EXACT []
-is_obsolete: true
-consider: SO:0001590
-
-[Term]
-id: SO:1000064
-name: sequence_variation_affecting_reading_frame
-def: "An umbrella term for terms describing an effect of a sequence variation on the frame of translation." [EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html]
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation affecting reading frame" EXACT []
-synonym: "sequence variation affecting reading frame" RELATED []
-is_obsolete: true
-
-[Term]
-id: SO:1000065
-name: frameshift_sequence_variation
-def: "A mutation causing a disruption of the translational reading frame, because the number of nucleotides inserted or deleted is not a multiple of three." [SO:ke]
-synonym: "frameshift mutation" EXACT []
-synonym: "frameshift sequence variation" RELATED []
-synonym: "out of frame mutation" RELATED []
-xref: http://en.wikipedia.org/wiki/Frameshift_mutation "wiki"
-is_obsolete: true
-
-[Term]
-id: SO:1000066
-name: sequence_variant_causing_plus_1_frameshift_mutation
-def: "A mutation causing a disruption of the translational reading frame, due to the insertion of a nucleotide." [SO:ke]
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "plus 1 frameshift mutation" EXACT []
-synonym: "sequence variant causing plus 1 frameshift mutation" EXACT []
-is_obsolete: true
-replaced_by: SO:0001594
-
-[Term]
-id: SO:1000067
-name: sequence_variant_causing_minus_1_frameshift
-def: "A mutation causing a disruption of the translational reading frame, due to the deletion of a nucleotide." [SO:ke]
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "minus 1 frameshift mutation" EXACT []
-synonym: "sequence variant causing minus 1 frameshift" EXACT []
-is_obsolete: true
-replaced_by: SO:0001592
-
-[Term]
-id: SO:1000068
-name: sequence_variant_causing_plus_2_frameshift
-def: "A mutation causing a disruption of the translational reading frame, due to the insertion of two nucleotides." [SO:ke]
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "plus 2 frameshift mutation" EXACT []
-synonym: "sequence variant causing plus 2 frameshift" EXACT []
-is_obsolete: true
-replaced_by: SO:0001595
-
-[Term]
-id: SO:1000069
-name: sequence_variant_causing_minus_2_frameshift
-def: "A mutation causing a disruption of the translational reading frame, due to the deletion of two nucleotides." [SO:ke]
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "minus 2 frameshift mutation" EXACT []
-synonym: "sequence variant causing minus 2 frameshift" EXACT []
-is_obsolete: true
-replaced_by: SO:0001593
-
-[Term]
-id: SO:1000070
-name: sequence_variant_affecting_transcript_processing
-def: "Sequence variant affects the way in which the primary transcriptional product is processed to form the mature transcript." [EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html]
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation affecting transcript processing" RELATED []
-synonym: "sequence variant affecting transcript processing" EXACT []
-is_obsolete: true
-replaced_by: SO:0001543
-
-[Term]
-id: SO:1000071
-name: sequence_variant_affecting_splicing
-def: "A sequence_variant_effect where the way in which the primary transcriptional product is processed to form the mature transcript, specifically by the removal (splicing) of intron sequences is changed." [EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html]
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation affecting splicing" RELATED []
-synonym: "sequence variant affecting splicing" EXACT []
-is_obsolete: true
-replaced_by: SO:0001568
-
-[Term]
-id: SO:1000072
-name: sequence_variant_affecting_splice_donor
-def: "A sequence_variant_effect that changes the splice donor sequence." [SO:ke]
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation affecting splice donor" RELATED []
-synonym: "sequence variant affecting splice donor" RELATED []
-synonym: "splice donor mutation" EXACT []
-is_obsolete: true
-replaced_by: SO:0001575
-
-[Term]
-id: SO:1000073
-name: sequence_variant_affecting_splice_acceptor
-def: "A sequence_variant_effect that changes the splice acceptor sequence." [SO:ke]
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation affecting splicing" RELATED []
-synonym: "sequence variant affecting splice acceptor" RELATED []
-synonym: "splice acceptor mutation" EXACT []
-is_obsolete: true
-replaced_by: SO:0001574
-
-[Term]
-id: SO:1000074
-name: sequence_variant_causing_cryptic_splice_activation
-def: "A sequence variant causing a new (functional) splice site." [EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html]
-comment: A cryptic splice site is only used when the natural splice site has been disrupted by a sequence alteration.
-synonym: "cryptic splice activator sequence variant" EXACT []
-synonym: "mutation causing cryptic splice activator" RELATED []
-synonym: "sequence variant causing cryptic splice activator" EXACT []
-is_obsolete: true
-replaced_by: SO:0001569
-
-[Term]
-id: SO:1000075
-name: sequence_variant_affecting_editing
-def: "Sequence variant affects the editing of the transcript." [EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html]
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation affecting editing" RELATED []
-synonym: "sequence variant affecting editing" EXACT []
-is_obsolete: true
-replaced_by: SO:0001544
-
-[Term]
-id: SO:1000076
-name: sequence_variant_affecting_transcription
-def: "Mutation affects the process of transcription, its initiation, progression or termination." [EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html]
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation affecting transcription" RELATED []
-synonym: "sequence variant affecting transcription" EXACT []
-is_obsolete: true
-replaced_by: SO:0001549
-
-[Term]
-id: SO:1000078
-name: sequence_variant_decreasing_rate_of_transcription
-def: "A sequence variation that decreases the rate a which transcription of the sequence occurs." [SO:ke]
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation decreasing rate of transcription" RELATED []
-synonym: "sequence variation decreasing rate of transcription" EXACT []
-is_obsolete: true
-
-[Term]
-id: SO:1000079
-name: sequence_variation_affecting_transcript_sequence
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation affecting transcript sequence" EXACT []
-synonym: "sequence variation affecting transcript sequence" EXACT []
-is_obsolete: true
-
-[Term]
-id: SO:1000080
-name: sequence_variant_increasing_rate_of_transcription
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation increasing rate of transcription" RELATED []
-synonym: "sequence variation increasing rate of transcription" EXACT []
-is_obsolete: true
-
-[Term]
-id: SO:1000081
-name: sequence_variant_affecting_rate_of_transcription
-def: "A mutation that alters the rate a which transcription of the sequence occurs." [SO:ke]
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation affecting rate of transcription" RELATED []
-synonym: "sequence variant affecting rate of transcription" EXACT []
-is_obsolete: true
-replaced_by: SO:0001550
-
-[Term]
-id: SO:1000082
-name: sequence variant_affecting_transcript_stability
-def: "Sequence variant affects the stability of the transcript." [EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html]
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation affecting transcript stability" RELATED []
-synonym: "sequence variant affecting transcript stability" EXACT []
-is_obsolete: true
-replaced_by: SO:0001546
-
-[Term]
-id: SO:1000083
-name: sequence_variant_increasing_transcript_stability
-def: "Sequence variant increases the stability (half-life) of the transcript." [EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html]
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation increasing transcript stability" RELATED []
-synonym: "sequence variant increasing transcript stability" EXACT []
-is_obsolete: true
-
-[Term]
-id: SO:1000084
-name: sequence_variant_decreasing_transcript_stability
-def: "Sequence variant decreases the stability (half-life) of the transcript." [EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html]
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation decreasing transcript stability" RELATED []
-synonym: "sequence variant decreasing transcript stability" EXACT []
-is_obsolete: true
-
-[Term]
-id: SO:1000085
-name: sequence_variation_affecting_level_of_transcript
-def: "A sequence variation that causes a change in the level of mature, spliced and processed RNA, resulting from a change in the corresponding DNA sequence." [SO:ke]
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation affecting level of transcript" RELATED []
-synonym: "sequence variation affecting level of transcript" EXACT []
-is_obsolete: true
-replaced_by: SO:0001540
-
-[Term]
-id: SO:1000086
-name: sequence_variation_decreasing_level_of_transcript
-def: "A sequence variation that causes a decrease in the level of mature, spliced and processed RNA, resulting from a change in the corresponding DNA sequence." [SO:ke]
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation decreasing level of transcript" EXACT []
-synonym: "sequence variation decreasing level of transcript" RELATED []
-is_obsolete: true
-
-[Term]
-id: SO:1000087
-name: sequence_variation_increasing_level_of_transcript
-def: "A sequence_variation that causes an increase in the level of mature, spliced and processed RNA, resulting from a change in the corresponding DNA sequence." [SO:ke]
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation increasing level of transcript" EXACT []
-synonym: "sequence variation increasing level of transcript" EXACT []
-is_obsolete: true
-
-[Term]
-id: SO:1000088
-name: sequence_variant_affecting_translational_product
-alt_id: SO:1000090
-alt_id: SO:1000091
-def: "A sequence variant causing a change in primary translation product of a transcript." [EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html]
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation affecting translational product" RELATED []
-synonym: "mutation causing partially characterised change of translational product" RELATED []
-synonym: "mutation causing uncharacterised change of translational product" RELATED []
-synonym: "sequence variant affecting translational product" EXACT []
-synonym: "sequence variant causing partially characterised change of translational product" EXACT []
-synonym: "sequence variant causing uncharacterised change of translational product" EXACT []
-synonym: "sequence_variant_causing_partially_characterised_change_of_translational_product" EXACT []
-synonym: "sequence_variant_causing_uncharacterised_change_of_translational_product" EXACT []
-is_obsolete: true
-replaced_by: SO:0001553
-
-[Term]
-id: SO:1000089
-name: sequence_variant_causing_no_change_of_translational_product
-def: "The sequence variant at RNA level does not lead to any change in polypeptide." [EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html]
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect. Also, as there is no change, this is not a good ontological term.
-synonym: "mutation causing no change of translational product" RELATED []
-synonym: "sequence variant causing no change of translational product" EXACT []
-is_obsolete: true
-
-[Term]
-id: SO:1000092
-name: sequence_variant_causing_complex_change_of_translational_product
-def: "Any sequence variant effect that is known at nucleotide level but cannot be explained by using other key terms." [EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html]
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation causing complex change of translational product" RELATED []
-synonym: "sequence variant causing complex change of translational product" EXACT []
-is_obsolete: true
-consider: SO:0001539
-
-[Term]
-id: SO:1000093
-name: sequence_variant_causing_amino_acid_substitution
-def: "The replacement of a single amino acid by another." [EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html]
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation causing amino acid substitution" RELATED []
-synonym: "sequence variant causing amino acid substitution" EXACT []
-is_obsolete: true
-replaced_by: SO:0001606
-
-[Term]
-id: SO:1000094
-name: sequence_variant_causing_conservative_amino_acid_substitution
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation causing conservative amino acid substitution" RELATED []
-synonym: "sequence variant causing conservative amino acid substitution" EXACT []
-is_obsolete: true
-replaced_by: SO:0001607
-
-[Term]
-id: SO:1000095
-name: sequence_variant_causing_nonconservative_amino_acid_substitution
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation causing nonconservative amino acid substitution" RELATED []
-synonym: "sequence variant causing nonconservative amino acid substitution" EXACT []
-is_obsolete: true
-replaced_by: SO:0001607
-
-[Term]
-id: SO:1000096
-name: sequence_variant_causing_amino_acid_insertion
-def: "The insertion of one or more amino acids from the polypeptide, without affecting the surrounding sequence." [EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html]
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation causing amino acid insertion" RELATED []
-synonym: "sequence variant causing amino acid insertion" EXACT []
-is_obsolete: true
-replaced_by: SO:0001603
-
-[Term]
-id: SO:1000097
-name: sequence_variant_causing_amino_acid_deletion
-def: "The deletion of one or more amino acids from the polypeptide, without affecting the surrounding sequence." [EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html]
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation causing amino acid deletion" RELATED []
-synonym: "sequence variant causing amino acid deletion" EXACT []
-is_obsolete: true
-consider: SO:0001583
-
-[Term]
-id: SO:1000098
-name: sequence_variant_causing_polypeptide_truncation
-def: "The translational product is truncated at its C-terminus, usually a result of a nonsense codon change in transcript (SO:1000062)." [EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html]
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation causing polypeptide truncation" RELATED []
-synonym: "sequence variant causing polypeptide truncation" EXACT []
-is_obsolete: true
-replaced_by: SO:0001167
-
-[Term]
-id: SO:1000099
-name: sequence_variant_causing_polypeptide_elongation
-def: "The extension of the translational product at either (or both) the N-terminus and/or the C-terminus." [EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html]
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation causing polypeptide elongation" RELATED []
-synonym: "sequence variant causing polypeptide elongation" EXACT []
-is_obsolete: true
-replaced_by: SO:0001609
-
-[Term]
-id: SO:1000100
-name: mutation_causing_polypeptide_N_terminal_elongation
-def: "." [EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html]
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation causing polypeptide N terminal elongation" EXACT []
-synonym: "polypeptide N-terminal elongation" EXACT []
-is_obsolete: true
-replaced_by: SO:0001611
-
-[Term]
-id: SO:1000101
-name: mutation_causing_polypeptide_C_terminal_elongation
-def: "." [EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html]
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation causing polypeptide C terminal elongation" EXACT []
-synonym: "polypeptide C-terminal elongation" EXACT []
-is_obsolete: true
-replaced_by: SO:0001610
-
-[Term]
-id: SO:1000102
-name: sequence_variant_affecting_level_of_translational_product
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation affecting level of translational product" RELATED []
-synonym: "sequence variant affecting level of translational product" EXACT []
-is_obsolete: true
-replaced_by: SO:0001553
-
-[Term]
-id: SO:1000103
-name: sequence_variant_decreasing_level_of_translation_product
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutationdecreasing level of translation product" RELATED []
-synonym: "sequence variant decreasing level of translation product" EXACT []
-is_obsolete: true
-
-[Term]
-id: SO:1000104
-name: sequence_variant_increasing_level_of_translation_product
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutationt increasing level of translation product" RELATED []
-synonym: "sequence variant increasing level of translation product" EXACT []
-is_obsolete: true
-
-[Term]
-id: SO:1000105
-name: sequence_variant_affecting_polypeptide_amino_acid_sequence
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation affecting polypeptide amino acid sequence" RELATED []
-synonym: "sequence variant affecting polypeptide amino acid sequence" EXACT []
-is_obsolete: true
-replaced_by: SO:0001603
-
-[Term]
-id: SO:1000106
-name: mutation_causing_inframe_polypeptide_N_terminal_elongation
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "inframe polypeptide N-terminal elongation" EXACT []
-synonym: "mutation causing inframe polypeptide N terminal elongation" EXACT []
-is_obsolete: true
-replaced_by: SO:0001614
-
-[Term]
-id: SO:1000107
-name: mutation_causing_out_of_frame_polypeptide_N_terminal_elongation
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation causing out of frame polypeptide N terminal elongation" EXACT []
-synonym: "out of frame polypeptide N-terminal elongation" EXACT []
-is_obsolete: true
-replaced_by: SO:0001615
-
-[Term]
-id: SO:1000108
-name: mutaton_causing_inframe_polypeptide_C_terminal_elongation
-synonym: "inframe_polypeptide C-terminal elongation" EXACT []
-synonym: "mutaton causing inframe polypeptide C terminal elongation" EXACT []
-is_obsolete: true
-replaced_by: SO:0001612
-
-[Term]
-id: SO:1000109
-name: mutation_causing_out_of_frame_polypeptide_C_terminal_elongation
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation causing out of frame polypeptide C terminal elongation" EXACT []
-synonym: "out of frame polypeptide C-terminal elongation" EXACT []
-is_obsolete: true
-replaced_by: SO:0001613
-
-[Term]
-id: SO:1000110
-name: frame_restoring_sequence_variant
-def: "A mutation that reverts the sequence of a previous frameshift mutation back to the initial frame." [SO:ke]
-synonym: "frame restoring mutation" EXACT []
-synonym: "frame restoring sequence variant" EXACT []
-is_obsolete: true
-
-[Term]
-id: SO:1000111
-name: sequence_variant_affecting_3D_structure_of_polypeptide
-alt_id: SO:1000113
-alt_id: SO:1000114
-def: "A mutation that changes the amino acid sequence of the peptide in such a way that it changes the 3D structure of the molecule." [SO:ke]
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation affecting 3D structure of polypeptide" RELATED []
-synonym: "mutation causing partially characterised 3D structural change" RELATED []
-synonym: "mutation causing uncharacterised 3D structural change" RELATED []
-synonym: "sequence variant affecting 3D structure of polypeptide" EXACT []
-synonym: "sequence variant affecting 3D-structure of polypeptide" EXACT []
-synonym: "sequence variant causing partially characterised 3D structural change" EXACT []
-synonym: "sequence variant causing uncharacterised 3D structural change" EXACT []
-synonym: "sequence_variant_causing_partially_characterised_3D_structural_change" EXACT []
-synonym: "sequence_variant_causing_uncharacterised_3D_structural_change" EXACT []
-is_obsolete: true
-replaced_by: SO:0001599
-
-[Term]
-id: SO:1000112
-name: sequence_variant_causing_no_3D_structural_change
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect. Also as there is no effect, it is not a good term.
-synonym: "mutation causing no 3D structural change" RELATED []
-synonym: "sequence variant causing no 3D structural change" EXACT []
-is_obsolete: true
-
-[Term]
-id: SO:1000115
-name: sequence_variant_causing_complex_3D_structural_change
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation causing complex 3D structural change" RELATED []
-synonym: "sequence variant causing complex 3D structural change" EXACT []
-is_obsolete: true
-replaced_by: SO:0001600
-
-[Term]
-id: SO:1000116
-name: sequence_variant_causing_conformational_change
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation causing conformational change" RELATED []
-synonym: "sequence variant causing conformational change" EXACT []
-is_obsolete: true
-replaced_by: SO:0001601
-
-[Term]
-id: SO:1000117
-name: sequence_variant_affecting_polypeptide_function
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation affecting polypeptide function" RELATED []
-synonym: "sequence variant affecting polypeptide function" EXACT []
-is_obsolete: true
-replaced_by: SO:0001554
-
-[Term]
-id: SO:1000118
-name: sequence_variant_causing_loss_of_function_of_polypeptide
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "loss of function of polypeptide" RELATED []
-synonym: "mutation causing loss of function of polypeptide" RELATED []
-synonym: "sequence variant causing loss of function of polypeptide" EXACT []
-is_obsolete: true
-replaced_by: SO:0001559
-
-[Term]
-id: SO:1000119
-name: sequence_variant_causing_inactive_ligand_binding_site
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation causing inactive ligand binding site" RELATED []
-synonym: "sequence variant causing inactive ligand binding site" EXACT []
-is_obsolete: true
-replaced_by: SO:0001560
-
-[Term]
-id: SO:1000120
-name: sequence_variant_causing_inactive_catalytic_site
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation causing inactive catalytic site" RELATED []
-synonym: "sequence variant causing inactive catalytic site" EXACT []
-is_obsolete: true
-replaced_by: SO:0001618
-
-[Term]
-id: SO:1000121
-name: sequence_variant_causing_polypeptide_localization_change
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation causing polypeptide localization change" RELATED []
-synonym: "sequence variant causing polypeptide localization change" EXACT []
-is_obsolete: true
-replaced_by: SO:0001558
-
-[Term]
-id: SO:1000122
-name: sequence_variant_causing_polypeptide_post_translational_processing_change
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation causing polypeptide post translational processing change" RELATED []
-synonym: "polypeptide post-translational processing affected" EXACT []
-synonym: "sequence variant causing polypeptide post translational processing change" EXACT []
-is_obsolete: true
-replaced_by: SO:0001562
-
-[Term]
-id: SO:1000123
-name: polypeptide_post_translational_processing_affected
-synonym: "polypeptide_post-translational_processing_affected" RELATED []
-is_obsolete: true
-
-[Term]
-id: SO:1000124
-name: sequence_variant_causing_partial_loss_of_function_of_polypeptide
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation causing partial loss of function of polypeptide" RELATED []
-synonym: "partial loss of function of polypeptide" EXACT []
-synonym: "sequence variant causing partial loss of function of polypeptide" EXACT []
-is_obsolete: true
-replaced_by: SO:0001561
-
-[Term]
-id: SO:1000125
-name: sequence_variant_causing_gain_of_function_of_polypeptide
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "gain of function of polypeptide" EXACT []
-synonym: "mutation causing gain of function of polypeptide" RELATED []
-synonym: "sequence variant causing gain of function of polypeptide" EXACT []
-is_obsolete: true
-replaced_by: SO:0001557
-
-[Term]
-id: SO:1000126
-name: sequence_variant_affecting_transcript_secondary_structure
-def: "A sequence variant that affects the secondary structure (folding) of the RNA transcript molecule." [SO:ke]
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation affecting transcript secondary structure" RELATED []
-synonym: "sequence variant affecting transcript secondary structure" EXACT []
-is_obsolete: true
-replaced_by: SO:0001596
-
-[Term]
-id: SO:1000127
-name: sequence_variant_causing_compensatory_transcript_secondary_structure_mutation
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation causing compensatory transcript secondary structure mutation" RELATED []
-synonym: "sequence variant causing compensatory transcript secondary structure mutation" EXACT []
-is_obsolete: true
-replaced_by: SO:0001597
-
-[Term]
-id: SO:1000132
-name: sequence_variant_effect
-def: "The effect of a change in nucleotide sequence." [SO:ke]
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.\nUpdated after discussion with Peter Taschner - Feb 09.
-synonym: "sequence variant effect" RELATED []
-is_obsolete: true
-
-[Term]
-id: SO:1000134
-name: sequence_variant_causing_polypeptide_fusion
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation causing polypeptide fusion" RELATED []
-synonym: "sequence variant causing polypeptide fusion" EXACT []
-is_obsolete: true
-replaced_by: SO:0001616
-
-[Term]
-id: SO:1000136
-name: autosynaptic_chromosome
-def: "An autosynaptic chromosome is the aneuploid product of recombination between a pericentric inversion and a cytologically wild-type chromosome." [PMID:6804304]
-synonym: "(Drosophila)A" RELATED []
-synonym: "autosynaptic chromosome" EXACT []
-is_a: SO:1000183 ! chromosome_structure_variation
-
-[Term]
-id: SO:1000138
-name: homo_compound_chromosome
-def: "A compound chromosome whereby two copies of the same chromosomal arm attached to a common centromere. The chromosome is diploid for the arm involved." [SO:ke]
-synonym: "homo compound chromosome" EXACT []
-synonym: "homo-compound chromosome" EXACT []
-is_a: SO:1000042 ! compound_chromosome
-
-[Term]
-id: SO:1000140
-name: hetero_compound_chromosome
-def: "A compound chromosome whereby two arms from different chromosomes are connected through the centromere of one of them." [FB:reference_manual, SO:ke]
-synonym: "hetero compound chromosome" EXACT []
-synonym: "hetero-compound chromosome" EXACT []
-is_a: SO:1000042 ! compound_chromosome
-
-[Term]
-id: SO:1000141
-name: chromosome_fission
-def: "A chromosome that occurred by the division of a larger chromosome." [SO:ke]
-synonym: "chromosome fission" EXACT []
-is_a: SO:1000028 ! intrachromosomal_mutation
-
-[Term]
-id: SO:1000142
-name: dexstrosynaptic_chromosome
-def: "An autosynaptic chromosome carrying the two right (D = dextro) telomeres." [FB:manual]
-synonym: "dexstrosynaptic chromosome" EXACT []
-is_a: SO:1000136 ! autosynaptic_chromosome
-
-[Term]
-id: SO:1000143
-name: laevosynaptic_chromosome
-def: "LS is an autosynaptic chromosome carrying the two left (L = levo) telomeres." [FB:manual]
-synonym: "laevosynaptic chromosome" EXACT []
-is_a: SO:1000136 ! autosynaptic_chromosome
-
-[Term]
-id: SO:1000144
-name: free_duplication
-def: "A chromosome structure variation whereby the duplicated sequences are carried as a free centric element." [FB:reference_manual]
-synonym: "free duplication" EXACT []
-is_a: SO:1000037 ! chromosomal_duplication
-
-[Term]
-id: SO:1000145
-name: free_ring_duplication
-def: "A ring chromosome which is a copy of another chromosome." [SO:ke]
-synonym: "(Drosophila)R" RELATED []
-synonym: "free ring duplication" EXACT []
-is_a: SO:1000045 ! ring_chromosome
-is_a: SO:1000144 ! free_duplication
-intersection_of: SO:1000045 ! ring_chromosome
-intersection_of: has_quality SO:0001516 ! free
-
-[Term]
-id: SO:1000146
-name: complex_chromosomal_mutation
-def: "A chromosome structure variant with 4 or more breakpoints." [FB:reference_manual, SO:ke]
-synonym: "complex chromosomal mutation" EXACT []
-is_a: SO:1000183 ! chromosome_structure_variation
-
-[Term]
-id: SO:1000147
-name: deficient_translocation
-def: "A chromosomal deletion whereby a translocation occurs in which one of the four broken ends loses a segment before re-joining." [FB:reference_manual]
-synonym: "(Drosophila)Df" RELATED []
-synonym: "(Drosophila)DfT" RELATED []
-synonym: "deficient translocation" EXACT []
-is_a: SO:1000029 ! chromosomal_deletion
-is_a: SO:1000044 ! chromosomal_translocation
-intersection_of: SO:1000044 ! chromosomal_translocation
-intersection_of: has_part SO:0000159 ! deletion
-intersection_of: has_part SO:0000199 ! translocation
-
-[Term]
-id: SO:1000148
-name: inversion_cum_translocation
-def: "A chromosomal translocation whereby the first two breaks are in the same chromosome, and the region between them is rejoined in inverted order to the other side of the first break, such that both sides of break one are present on the same chromosome. The remaining free ends are joined as a translocation with those resulting from the third break." [FB:reference_manual]
-synonym: "(Drosophila)InT" RELATED []
-synonym: "(Drosophila)T" RELATED []
-synonym: "inversion cum translocation" EXACT []
-is_a: SO:1000030 ! chromosomal_inversion
-is_a: SO:1000044 ! chromosomal_translocation
-intersection_of: SO:1000028 ! intrachromosomal_mutation
-intersection_of: has_part SO:0000199 ! translocation
-intersection_of: has_part SO:1000036 ! inversion
-
-[Term]
-id: SO:1000149
-name: bipartite_duplication
-def: "An interchromosomal mutation whereby the (large) region between the first two breaks listed is lost, and the two flanking segments (one of them centric) are joined as a translocation to the free ends resulting from the third break." [FB:reference_manual]
-synonym: "(Drosophila)bDp" RELATED []
-synonym: "bipartite duplication" EXACT []
-is_a: SO:1000031 ! interchromosomal_mutation
-is_a: SO:1000038 ! intrachromosomal_duplication
-
-[Term]
-id: SO:1000150
-name: cyclic_translocation
-def: "A chromosomal translocation whereby three breaks occurred in three different chromosomes. The centric segment resulting from the first break listed is joined to the acentric segment resulting from the second, rather than the third." [FB:reference_manual]
-synonym: "cyclic translocation" EXACT []
-is_a: SO:1000044 ! chromosomal_translocation
-
-[Term]
-id: SO:1000151
-name: bipartite_inversion
-def: "A chromosomal inversion caused by three breaks in the same chromosome; both central segments are inverted in place (i.e., they are not transposed)." [FB:reference_manual]
-synonym: "(Drosophila)bIn" RELATED []
-synonym: "bipartite inversion" EXACT []
-is_a: SO:1000030 ! chromosomal_inversion
-
-[Term]
-id: SO:1000152
-name: uninverted_insertional_duplication
-def: "An insertional duplication where a copy of the segment between the first two breaks listed is inserted at the third break; the insertion is in cytologically the same orientation as its flanking segments." [FB:reference_manual]
-synonym: "(Drosophila)eDp" RELATED []
-synonym: "uninverted insertional duplication" EXACT []
-is_a: SO:1000154 ! insertional_duplication
-
-[Term]
-id: SO:1000153
-name: inverted_insertional_duplication
-def: "An insertional duplication where a copy of the segment between the first two breaks listed is inserted at the third break; the insertion is in cytologically inverted orientation with respect to its flanking segments." [FB:reference_manual]
-synonym: "(Drosophila)iDp" RELATED []
-synonym: "inverted insertional duplication" EXACT []
-is_a: SO:1000154 ! insertional_duplication
-
-[Term]
-id: SO:1000154
-name: insertional_duplication
-def: "A chromosome duplication involving the insertion of a duplicated region (as opposed to a free duplication)." [SO:ke]
-synonym: "(Drosophila)Dpp" RELATED []
-synonym: "insertional duplication" EXACT []
-is_a: SO:1000037 ! chromosomal_duplication
-
-[Term]
-id: SO:1000155
-name: interchromosomal_transposition
-def: "A chromosome structure variation whereby a transposition occurred between chromosomes." [SO:ke]
-synonym: "(Drosophila)Tp" RELATED []
-synonym: "interchromosomal transposition" EXACT []
-is_a: SO:0000453 ! chromosomal_transposition
-is_a: SO:1000031 ! interchromosomal_mutation
-
-[Term]
-id: SO:1000156
-name: inverted_interchromosomal_transposition
-def: "An interchromosomal transposition whereby a copy of the segment between the first two breaks listed is inserted at the third break; the insertion is in cytologically inverted orientation with respect to its flanking segment." [FB:reference_manual]
-synonym: "(Drosophila)iTp" RELATED []
-synonym: "inverted interchromosomal transposition" EXACT []
-is_a: SO:1000155 ! interchromosomal_transposition
-
-[Term]
-id: SO:1000157
-name: uninverted_interchromosomal_transposition
-def: "An interchromosomal transition where the segment between the first two breaks listed is removed and inserted at the third break; the insertion is in cytologically the same orientation as its flanking segments." [FB:reference_manual]
-synonym: "(Drosophila)eTp" RELATED []
-synonym: "uninverted interchromosomal transposition" EXACT []
-is_a: SO:1000155 ! interchromosomal_transposition
-
-[Term]
-id: SO:1000158
-name: inverted_intrachromosomal_transposition
-def: "An intrachromosomal transposition whereby the segment between the first two breaks listed is removed and inserted at the third break; the insertion is in cytologically inverted orientation with respect to its flanking segments." [FB:reference_manual]
-synonym: "(Drosophila)iTp" RELATED []
-synonym: "inverted intrachromosomal transposition" EXACT []
-is_a: SO:1000030 ! chromosomal_inversion
-is_a: SO:1000041 ! intrachromosomal_transposition
-is_a: SO:1000148 ! implied link automatically realized ! inversion_cum_translocation
-intersection_of: SO:1000041 ! intrachromosomal_transposition
-intersection_of: has_part SO:1000036 ! inversion
-
-[Term]
-id: SO:1000159
-name: uninverted_intrachromosomal_transposition
-def: "An intrachromosomal transposition whereby the segment between the first two breaks listed is removed and inserted at the third break; the insertion is in cytologically the same orientation as its flanking segments." [FB:reference_manual]
-synonym: "(Drosophila)eTp" RELATED []
-synonym: "uninverted intrachromosomal transposition" EXACT []
-is_a: SO:1000041 ! intrachromosomal_transposition
-intersection_of: SO:1000041 ! intrachromosomal_transposition
-intersection_of: has_part SO:0001514 ! direct
-
-[Term]
-id: SO:1000160
-name: unoriented_insertional_duplication
-def: "An insertional duplication where a copy of the segment between the first two breaks listed is inserted at the third break; the orientation of the insertion with respect to its flanking segments is not recorded." [FB:reference_manual]
-comment: Flag - unknown in the definition.
-synonym: "(Drosophila)uDp" RELATED []
-synonym: "unoriented insertional duplication" EXACT []
-is_a: SO:1000154 ! insertional_duplication
-
-[Term]
-id: SO:1000161
-name: unoriented_interchromosomal_transposition
-def: "An interchromosomal transposition whereby a copy of the segment between the first two breaks listed is inserted at the third break; the orientation of the insertion with respect to its flanking segments is not recorded." [FB:reference_manual]
-comment: FLAG - term describes an unknown.
-synonym: "(Drosophila)uTp" RELATED []
-synonym: "unorientated interchromosomal transposition" EXACT []
-is_a: SO:1000155 ! interchromosomal_transposition
-
-[Term]
-id: SO:1000162
-name: unoriented_intrachromosomal_transposition
-def: "An intrachromosomal transposition whereby the segment between the first two breaks listed is removed and inserted at the third break; the orientation of the insertion with respect to its flanking segments is not recorded." [FB:reference_manual]
-comment: FLAG - definition describes an unknown.
-synonym: "(Drosophila)uTp" RELATED []
-synonym: "unorientated intrachromosomal transposition" EXACT []
-is_a: SO:1000041 ! intrachromosomal_transposition
-
-[Term]
-id: SO:1000170
-name: uncharacterised_chromosomal_mutation
-synonym: "uncharacterised chromosomal mutation" EXACT []
-is_a: SO:1000183 ! chromosome_structure_variation
-
-[Term]
-id: SO:1000171
-name: deficient_inversion
-def: "A chromosomal deletion whereby three breaks occur in the same chromosome; one central region is lost, and the other is inverted." [FB:reference_manual, SO:ke]
-synonym: "(Drosophila)Df" RELATED []
-synonym: "(Drosophila)DfIn" RELATED []
-synonym: "deficient inversion" EXACT []
-is_a: SO:1000029 ! chromosomal_deletion
-is_a: SO:1000030 ! chromosomal_inversion
-intersection_of: SO:1000028 ! intrachromosomal_mutation
-intersection_of: has_part SO:0000159 ! deletion
-intersection_of: has_part SO:1000036 ! inversion
-
-[Term]
-id: SO:1000173
-name: tandem_duplication
-def: "A duplication consisting of 2 identical adjacent regions." [SO:ke]
-subset: DBVAR
-synonym: "erverted" RELATED dbvar [http://www.ncbi.nlm.nih.gov/dbvar/]
-synonym: "tandem duplication" EXACT []
-is_a: SO:1000035 ! duplication
-
-[Term]
-id: SO:1000175
-name: partially_characterised_chromosomal_mutation
-synonym: "partially characterised chromosomal mutation" EXACT []
-is_a: SO:1000170 ! uncharacterised_chromosomal_mutation
-
-[Term]
-id: SO:1000180
-name: sequence_variant_affecting_gene_structure
-def: "A sequence_variant_effect that changes the gene structure." [SO:ke]
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation affecting gene structure" RELATED []
-synonym: "sequence variant affecting gene structure" EXACT []
-is_obsolete: true
-replaced_by: SO:0001564
-
-[Term]
-id: SO:1000181
-name: sequence_variant_causing_gene_fusion
-def: "A sequence_variant_effect that changes the gene structure by causing a fusion to another gene." [SO:ke]
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation causing gene fusion" RELATED []
-synonym: "sequence variant causing gene fusion" EXACT []
-is_obsolete: true
-replaced_by: SO:0001565
-
-[Term]
-id: SO:1000182
-name: chromosome_number_variation
-def: "A kind of chromosome variation where the chromosome complement is not an exact multiple of the haploid number." [SO:ke]
-synonym: "chromosome number variation" EXACT []
-is_a: SO:0000240 ! chromosome_variation
-
-[Term]
-id: SO:1000183
-name: chromosome_structure_variation
-synonym: "chromosome structure variation" EXACT []
-is_a: SO:0000240 ! chromosome_variation
-
-[Term]
-id: SO:1000184
-name: sequence_variant_causes_exon_loss
-def: "A sequence variant affecting splicing and causes an exon loss." [SO:ke]
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation causes exon loss" RELATED []
-synonym: "sequence variant causes exon loss" EXACT []
-is_obsolete: true
-
-[Term]
-id: SO:1000185
-name: sequence_variant_causes_intron_gain
-def: "A sequence variant effect, causing an intron to be gained by the processed transcript; usually a result of a donor acceptor mutation (SO:1000072)." [EBI:www.ebi.ac.uk/mutations/recommendations/mutevent.html]
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "mutation causes intron gain" RELATED []
-synonym: "sequence variant causes intron gain" EXACT []
-is_obsolete: true
-
-[Term]
-id: SO:1000186
-name: sequence_variant_causing_cryptic_splice_donor_activation
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "sequence variant causing cryptic splice donor activation" EXACT []
-is_obsolete: true
-replaced_by: SO:0001571
-
-[Term]
-id: SO:1001186
-name: sequence_variant_causing_cryptic_splice_acceptor_activation
-comment: OBSOLETE: This term was deleted as it conflated more than one term. The alteration is separate from the effect.
-synonym: "sequence variant causing cryptic splice acceptor activation" EXACT []
-is_obsolete: true
-replaced_by: SO:0001570
-
-[Term]
-id: SO:1001187
-name: alternatively_spliced_transcript
-def: "A transcript that is alternatively spliced." [SO:xp]
-synonym: "alternatively spliced transcript" EXACT []
-is_a: SO:0000673 ! implied link automatically realized ! transcript
-intersection_of: SO:0000673 ! transcript
-intersection_of: has_quality SO:0000877 ! alternatively_spliced
-
-[Term]
-id: SO:1001188
-name: encodes_1_polypeptide
-def: "A gene that is alternately spliced, but encodes only one polypeptide." [SO:ke]
-synonym: "encodes 1 polypeptide" EXACT []
-is_a: SO:0000463 ! encodes_alternately_spliced_transcripts
-
-[Term]
-id: SO:1001189
-name: encodes_greater_than_1_polypeptide
-def: "A gene that is alternately spliced, and encodes more than one polypeptide." [SO:ke]
-synonym: "encodes greater than 1 polypeptide" EXACT []
-is_a: SO:0000463 ! encodes_alternately_spliced_transcripts
-
-[Term]
-id: SO:1001190
-name: encodes_different_polypeptides_different_stop
-def: "A gene that is alternately spliced, and encodes more than one polypeptide, that have overlapping peptide sequences, but use different stop codons." [SO:ke]
-synonym: "encodes different polypeptides different stop" EXACT []
-is_a: SO:1001195 ! encodes_overlapping_peptides
-
-[Term]
-id: SO:1001191
-name: encodes_overlapping_peptides_different_start
-def: "A gene that is alternately spliced, and encodes more than one polypeptide, that have overlapping peptide sequences, but use different start codons." [SO:ke]
-synonym: "encodes overlapping peptides different start" EXACT []
-is_a: SO:1001195 ! encodes_overlapping_peptides
-
-[Term]
-id: SO:1001192
-name: encodes_disjoint_polypeptides
-def: "A gene that is alternately spliced, and encodes more than one polypeptide, that do not have overlapping peptide sequences." [SO:ke]
-synonym: "encodes disjoint polypeptides" EXACT []
-is_a: SO:1001189 ! encodes_greater_than_1_polypeptide
-
-[Term]
-id: SO:1001193
-name: encodes_overlapping_polypeptides_different_start_and_stop
-def: "A gene that is alternately spliced, and encodes more than one polypeptide, that have overlapping peptide sequences, but use different start and stop codons." [SO:ke]
-synonym: "encodes overlapping polypeptides different start and stop" EXACT []
-is_a: SO:1001195 ! encodes_overlapping_peptides
-
-[Term]
-id: SO:1001194
-name: alternatively_spliced_gene_encoding_greater_than_1_polypeptide_coding_regions_overlapping
-is_obsolete: true
-
-[Term]
-id: SO:1001195
-name: encodes_overlapping_peptides
-def: "A gene that is alternately spliced, and encodes more than one polypeptide, that have overlapping peptide sequences." [SO:ke]
-synonym: "encodes overlapping peptides" EXACT []
-is_a: SO:1001189 ! encodes_greater_than_1_polypeptide
-
-[Term]
-id: SO:1001196
-name: cryptogene
-def: "A maxicircle gene so extensively edited that it cannot be matched to its edited mRNA sequence." [SO:ma]
-is_a: SO:0000654 ! implied link automatically realized ! maxicircle_gene
-is_a: SO:0001431 ! implied link automatically realized ! cryptic_gene
-intersection_of: SO:0000654 ! maxicircle_gene
-intersection_of: has_quality SO:0000976 ! cryptic
-
-[Term]
-id: SO:1001197
-name: dicistronic_primary_transcript
-def: "A primary transcript that has the quality dicistronic." [SO:xp]
-synonym: "dicistronic primary transcript" EXACT []
-is_a: SO:0000079 ! implied link automatically realized ! dicistronic_transcript
-is_a: SO:0000631 ! implied link automatically realized ! polycistronic_primary_transcript
-intersection_of: SO:0000185 ! primary_transcript
-intersection_of: has_quality SO:0000879 ! dicistronic
-
-[Term]
-id: SO:1001217
-name: member_of_regulon
-synonym: "member of regulon" EXACT []
-is_a: SO:0000081 ! gene_array_member
-
-[Term]
-id: SO:1001244
-name: alternatively_spliced_transcript_encoding_greater_than_1_polypeptide_different_start_codon_different_stop_codon_coding_regions_non_overlapping
-synonym: "alternatively_spliced_transcript_encoding_greater_than_1_polypeptide_different_start_codon_different_stop_codon_coding_regions_non-overlapping" RELATED []
-is_obsolete: true
-
-[Term]
-id: SO:1001246
-name: CDS_independently_known
-def: "A CDS with the evidence status of being independently known." [SO:xp]
-synonym: "CDS independently known" EXACT []
-is_a: SO:0000316 ! implied link automatically realized ! CDS
-intersection_of: SO:0000316 ! CDS
-intersection_of: has_quality SO:0000906 ! independently_known
-
-[Term]
-id: SO:1001247
-name: orphan_CDS
-def: "A CDS whose predicted amino acid sequence is unsupported by any experimental evidence or by any match with any other known sequence." [SO:ma]
-synonym: "orphan CDS" EXACT []
-is_a: SO:1001254 ! implied link automatically realized ! CDS_predicted
-intersection_of: SO:1001254 ! CDS_predicted
-intersection_of: has_origin SO:0000910 ! orphan
-
-[Term]
-id: SO:1001249
-name: CDS_supported_by_domain_match_data
-def: "A CDS that is supported by domain similarity." [SO:xp]
-synonym: "CDS supported by domain match data" EXACT []
-is_a: SO:1001251 ! implied link automatically realized ! CDS_supported_by_sequence_similarity_data
-intersection_of: SO:1001251 ! CDS_supported_by_sequence_similarity_data
-intersection_of: has_quality SO:0000908 ! supported_by_domain_match
-
-[Term]
-id: SO:1001251
-name: CDS_supported_by_sequence_similarity_data
-def: "A CDS that is supported by sequence similarity data." [SO:xp]
-synonym: "CDS supported by sequence similarity data" EXACT []
-is_a: SO:1001254 ! implied link automatically realized ! CDS_predicted
-intersection_of: SO:0000316 ! CDS
-intersection_of: has_quality SO:0000907 ! supported_by_sequence_similarity
-
-[Term]
-id: SO:1001254
-name: CDS_predicted
-def: "A CDS that is predicted." [SO:ke]
-synonym: "CDS predicted" EXACT []
-is_a: SO:0000316 ! implied link automatically realized ! CDS
-intersection_of: SO:0000316 ! CDS
-intersection_of: has_quality SO:0000732 ! predicted
-
-[Term]
-id: SO:1001255
-name: status_of_coding_sequence
-is_obsolete: true
-
-[Term]
-id: SO:1001259
-name: CDS_supported_by_EST_or_cDNA_data
-def: "A CDS that is supported by similarity to EST or cDNA data." [SO:xp]
-synonym: "CDS supported by EST or cDNA data" EXACT []
-is_a: SO:1001251 ! implied link automatically realized ! CDS_supported_by_sequence_similarity_data
-intersection_of: SO:1001251 ! CDS_supported_by_sequence_similarity_data
-intersection_of: has_quality SO:0000909 ! supported_by_EST_or_cDNA
-
-[Term]
-id: SO:1001260
-name: internal_Shine_Dalgarno_sequence
-def: "A Shine-Dalgarno sequence that stimulates recoding through interactions with the anti-Shine-Dalgarno in the RNA of small ribosomal subunits of translating ribosomes. The signal is only operative in Bacteria." [PMID:12519954, SO:ke]
-synonym: "internal Shine Dalgarno sequence" EXACT []
-synonym: "internal Shine-Dalgarno sequence" EXACT []
-is_a: SO:0000243 ! internal_ribosome_entry_site
-is_a: SO:1001268 ! recoding_stimulatory_region
-
-[Term]
-id: SO:1001261
-name: recoded_mRNA
-def: "The sequence of a mature mRNA transcript, modified before translation or during translation, usually by special cis-acting signals." [http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&db=PubMed&list_uids=8811194&dopt=Abstract]
-synonym: "recoded mRNA" EXACT []
-is_a: SO:0000234 ! implied link automatically realized ! mRNA
-intersection_of: SO:0000234 ! mRNA
-intersection_of: has_quality SO:0000881 ! recoded
-
-[Term]
-id: SO:1001262
-name: minus_1_translationally_frameshifted
-def: "An attribute describing a translational frameshift of -1." [SO:ke]
-synonym: "minus 1 translationally frameshifted" EXACT []
-is_a: SO:0000887 ! translationally_frameshifted
-
-[Term]
-id: SO:1001263
-name: plus_1_translationally_frameshifted
-def: "An attribute describing a translational frameshift of +1." [SO:ke]
-synonym: "plus 1 translationally frameshifted" EXACT []
-is_a: SO:0000887 ! translationally_frameshifted
-
-[Term]
-id: SO:1001264
-name: mRNA_recoded_by_translational_bypass
-def: "A recoded_mRNA where translation was suspended at a particular codon and resumed at a particular non-overlapping downstream codon." [http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&db=PubMed&list_uids=8811194&dopt=Abstract]
-synonym: "mRNA recoded by translational bypass" EXACT []
-is_a: SO:1001261 ! implied link automatically realized ! recoded_mRNA
-intersection_of: SO:0000234 ! mRNA
-intersection_of: has_quality SO:0000886 ! recoded_by_translational_bypass
-
-[Term]
-id: SO:1001265
-name: mRNA_recoded_by_codon_redefinition
-def: "A recoded_mRNA that was modified by an alteration of codon meaning." [SO:ma]
-synonym: "mRNA recoded by codon redefinition" EXACT []
-is_a: SO:1001261 ! implied link automatically realized ! recoded_mRNA
-intersection_of: SO:0000234 ! mRNA
-intersection_of: has_quality SO:0000882 ! codon_redefined
-
-[Term]
-id: SO:1001266
-name: stop_codon_redefinition_as_selenocysteine
-is_obsolete: true
-
-[Term]
-id: SO:1001267
-name: stop_codon_readthrough
-is_obsolete: true
-
-[Term]
-id: SO:1001268
-name: recoding_stimulatory_region
-def: "A site in an mRNA sequence that stimulates the recoding of a region in the same mRNA." [http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&db=PubMed&list_uids=12519954&dopt=Abstract]
-synonym: "recoding stimulatory region" EXACT []
-synonym: "recoding stimulatory signal" EXACT []
-is_a: SO:0000836 ! mRNA_region
-
-[Term]
-id: SO:1001269
-name: four_bp_start_codon
-def: "A non-canonical start codon with 4 base pairs." [SO:ke]
-synonym: "4bp start codon" EXACT []
-synonym: "four bp start codon" EXACT []
-is_a: SO:0000680 ! non_canonical_start_codon
-
-[Term]
-id: SO:1001270
-name: stop_codon_redefinition_as_pyrrolysine
-is_obsolete: true
-
-[Term]
-id: SO:1001271
-name: archaeal_intron
-def: "An intron characteristic of Archaeal tRNA and rRNA genes, where intron transcript generates a bulge-helix-bulge motif that is recognised by a splicing endoribonuclease." [PMID:9301331, SO:ma]
-comment: Intron characteristic of tRNA genes; splices by an endonuclease-ligase mediated mechanism.
-synonym: "archaeal intron" EXACT []
-is_a: SO:0001216 ! endonuclease_spliced_intron
-
-[Term]
-id: SO:1001272
-name: tRNA_intron
-def: "An intron found in tRNA that is spliced via endonucleolytic cleavage and ligation rather than transesterification." [SO:ke]
-comment: Could be a cross product with Gene ontology, GO:0006388.
-synonym: "pre-tRNA intron" EXACT []
-synonym: "tRNA intron" EXACT []
-is_a: SO:0001216 ! endonuclease_spliced_intron
-
-[Term]
-id: SO:1001273
-name: CTG_start_codon
-def: "A non-canonical start codon of sequence CTG." [SO:ke]
-synonym: "CTG start codon" EXACT []
-is_a: SO:0000680 ! non_canonical_start_codon
-
-[Term]
-id: SO:1001274
-name: SECIS_element
-def: "The incorporation of selenocysteine into a protein sequence is directed by an in-frame UGA codon (usually a stop codon) within the coding region of the mRNA. Selenoprotein mRNAs contain a conserved secondary structure in the 3' UTR that is required for the distinction of UGA stop from UGA selenocysteine. The selenocysteine insertion sequence (SECIS) is around 60 nt in length and adopts a hairpin structure which is sufficiently well-defined and conserved to act as a computational sc [...]
-synonym: "SECIS element" EXACT []
-xref: http://en.wikipedia.org/wiki/SECIS_element "wiki"
-is_a: SO:1001268 ! recoding_stimulatory_region
-
-[Term]
-id: SO:1001275
-name: retron
-def: "Sequence coding for a short, single-stranded, DNA sequence via a retrotransposed RNA intermediate; characteristic of some microbial genomes." [SO:ma]
-is_a: SO:0001411 ! biological_region
-
-[Term]
-id: SO:1001277
-name: three_prime_recoding_site
-def: "The recoding stimulatory signal located downstream of the recoding site." [SO:ke]
-synonym: "three prime recoding site" EXACT []
-is_a: SO:1001268 ! recoding_stimulatory_region
-
-[Term]
-id: SO:1001279
-name: three_prime_stem_loop_structure
-def: "A recoding stimulatory region, the stem-loop secondary structural element is downstream of the redefined region." [PMID:12519954, SO:ke]
-synonym: "three prime stem loop structure" EXACT []
-is_a: SO:1001277 ! three_prime_recoding_site
-
-[Term]
-id: SO:1001280
-name: five_prime_recoding_site
-def: "The recoding stimulatory signal located upstream of the recoding site." [SO:ke]
-synonym: "five prime recoding site" EXACT []
-is_a: SO:1001268 ! recoding_stimulatory_region
-
-[Term]
-id: SO:1001281
-name: flanking_three_prime_quadruplet_recoding_signal
-def: "Four base pair sequence immediately downstream of the redefined region. The redefined region is a frameshift site. The quadruplet is 2 overlapping codons." [PMID:12519954, SO:ke]
-synonym: "flanking three prime quadruplet recoding signal" EXACT []
-is_a: SO:1001277 ! three_prime_recoding_site
-
-[Term]
-id: SO:1001282
-name: UAG_stop_codon_signal
-def: "A stop codon signal for a UAG stop codon redefinition." [SO:ke]
-synonym: "UAG stop codon signal" EXACT []
-is_a: SO:1001288 ! stop_codon_signal
-
-[Term]
-id: SO:1001283
-name: UAA_stop_codon_signal
-def: "A stop codon signal for a UAA stop codon redefinition." [SO:ke]
-synonym: "UAA stop codon signal" EXACT []
-is_a: SO:1001288 ! stop_codon_signal
-
-[Term]
-id: SO:1001284
-name: regulon
-def: "A group of genes, whether linked as a cluster or not, that respond to a common regulatory signal." [ISBN:0198506732]
-subset: SOFA
-xref: http://en.wikipedia.org/wiki/Regulon "wiki"
-is_a: SO:0005855 ! gene_group
-
-[Term]
-id: SO:1001285
-name: UGA_stop_codon_signal
-def: "A stop codon signal for a UGA stop codon redefinition." [SO:ke]
-synonym: "UGA stop codon signal" EXACT []
-is_a: SO:1001288 ! stop_codon_signal
-
-[Term]
-id: SO:1001286
-name: three_prime_repeat_recoding_signal
-def: "A recoding stimulatory signal, downstream sequence important for recoding that contains repetitive elements." [PMID:12519954, SO:ke]
-synonym: "three prime repeat recoding signal" EXACT []
-is_a: SO:1001277 ! three_prime_recoding_site
-
-[Term]
-id: SO:1001287
-name: distant_three_prime_recoding_signal
-def: "A recoding signal that is found many hundreds of nucleotides 3' of a redefined stop codon." [http://www.ncbi.nlm.nih.gov\:80/entrez/query.fcgi?cmd=Retrieve&db=PubMed&list_uids=8709208&dopt=Abstract]
-synonym: "distant three prime recoding signal" EXACT []
-is_a: SO:1001277 ! three_prime_recoding_site
-
-[Term]
-id: SO:1001288
-name: stop_codon_signal
-def: "A recoding stimulatory signal that is a stop codon and has effect on efficiency of recoding." [PMID:12519954, SO:ke]
-comment: This term does not include the stop codons that are redefined. An example would be a stop codon that partially overlapped a frame shifting site would be an example stimulatory signal.
-synonym: "stop codon signal" EXACT []
-is_a: SO:1001268 ! recoding_stimulatory_region
-
-[Term]
-id: SO:2000061
-name: databank_entry
-def: "The sequence referred to by an entry in a databank such as Genbank or SwissProt." [SO:ke]
-subset: SOFA
-synonym: "accession" RELATED []
-synonym: "databank entry" EXACT []
-is_a: SO:0000695 ! reagent
-
-[Term]
-id: SO:3000000
-name: gene_segment
-def: "A gene component region which acts as a recombinational unit of a gene whose functional form is generated through somatic recombination." [GOC:add]
-comment: Requested by tracker 2021594, July 2008, by Alex.
-synonym: "gene segment" EXACT []
-is_a: SO:0000842 ! gene_component_region
-
-[Typedef]
-id: adjacent_to
-name: adjacent_to
-def: "A geometric operator, specified in Egenhofer 1989. Two features meet if they share a junction on the sequence. X adjacent_to Y iff X and Y share a boundary but do not overlap." [PMID:20226267, SO:ke]
-subset: SOFA
-
-[Typedef]
-id: associated_with
-name: associated_with
-comment: This relationship is vague and up for discussion.
-
-[Typedef]
-id: complete_evidence_for_feature
-name: complete_evidence_for_feature
-def: "B is complete_evidence_for_feature A if the extent (5' and 3' boundaries) and internal boundaries of B fully support the extent and internal boundaries of A." [SO:ke]
-comment: If A is a feature with multiple regions such as a multi exon transcript, the supporting EST evidence is complete if each of the regions is supported by an equivalent region in B. Also there must be no extra regions in B that are not represented in A. This relationship was requested by jeltje on the SO term tracker. The thread for the discussion is available can be accessed via tracker ID:1917222.
-is_transitive: true
-is_a: evidence_for_feature ! evidence_for_feature
-
-[Typedef]
-id: connects_on
-name: connects_on
-def: "X connects_on Y, Z, R iff whenever Z is on a R, X is adjacent to a Y and adjacent to a Z." [PMID:20226267]
-comment: Example: A splice_junction connects_on exon, exon, mature_transcript.
-created_by: kareneilbeck
-creation_date: 2010-10-14T01:38:51Z
-
-[Typedef]
-id: contained_by
-name: contained_by
-def: "X contained_by Y iff X starts after start of Y and X ends before end of Y." [PMID:20226267]
-comment: The inverse is contains. Example: intein contained_by immature_peptide_region.
-is_transitive: true
-created_by: kareneilbeck
-creation_date: 2010-10-14T01:26:16Z
-
-[Typedef]
-id: contains
-name: contains
-def: "The inverse of contained_by." [PMID:20226267]
-comment: Example: pre_miRNA contains miRNA_loop.
-is_transitive: true
-created_by: kareneilbeck
-creation_date: 2010-10-14T01:32:15Z
-
-[Typedef]
-id: derives_from
-name: derives_from
-subset: SOFA
-is_transitive: true
-
-[Typedef]
-id: disconnected_from
-name: disconnected_from
-def: "X is disconnected_from Y iff it is not the case that X overlaps Y." [PMID:20226267]
-comment: Example: intron disconnected from exon \{on primary_transcript}.
-created_by: kareneilbeck
-creation_date: 2010-10-14T01:42:10Z
-
-[Typedef]
-id: edited_from
-name: edited_from
-created_by: kareneilbeck
-creation_date: 2009-08-19T02:19:45Z
-
-[Typedef]
-id: edited_to
-name: edited_to
-created_by: kareneilbeck
-creation_date: 2009-08-19T02:19:11Z
-
-[Typedef]
-id: evidence_for_feature
-name: evidence_for_feature
-def: "B is evidence_for_feature A, if an instance of B supports the existence of A." [SO:ke]
-comment: This relationship was requested by nlw on the SO term tracker. The thread for the discussion is available can be accessed via tracker ID:1917222.
-is_transitive: true
-
-[Typedef]
-id: exemplar_of
-name: exemplar_of
-def: "X is exemplar of Y if X is the best evidence for Y." [SO:ke]
-comment: Tracker id: 2594157.
-
-[Typedef]
-id: finished_by
-name: finished_by
-def: "Xy is finished_by Y if Y part of X, and X and Y share a 3' boundary." [PMID:20226267]
-comment: Example CDS finished_by stop_codon.
-created_by: kareneilbeck
-creation_date: 2010-10-14T01:45:45Z
-
-[Typedef]
-id: finishes
-name: finishes
-def: "X finishes Y if X is part_of Y and X and Y share a 3' or C terminal boundary." [PMID:20226267]
-comment: Example: stop_codon finishes CDS.
-created_by: kareneilbeck
-creation_date: 2010-10-14T02:17:53Z
-
-[Typedef]
-id: gained
-name: gained
-def: "X gained Y if X is a variant_of X' and Y part of X but not X'." [SO:ke]
-comment: A relation with which to annotate the changes in a variant sequence with respect to a reference.\nFor example a variant transcript may gain a stop codon not present in the reference sequence.
-created_by: kareneilbeck
-creation_date: 2011-06-28T12:51:10Z
-
-[Typedef]
-id: genome_of
-name: genome_of
-
-[Typedef]
-id: guided_by
-name: guided_by
-created_by: kareneilbeck
-creation_date: 2009-08-19T02:27:04Z
-
-[Typedef]
-id: guides
-name: guides
-created_by: kareneilbeck
-creation_date: 2009-08-19T02:27:24Z
-
-[Typedef]
-id: has_integral_part
-name: has_integral_part
-def: "X has_integral_part Y if and only if: X has_part Y and Y part_of X." [http://precedings.nature.com/documents/3495/version/1]
-comment: Example: mRNA has_integral_part CDS.
-is_a: has_part ! has_part
-created_by: kareneilbeck
-creation_date: 2009-08-19T12:01:46Z
-
-[Typedef]
-id: has_origin
-name: has_origin
-
-[Typedef]
-id: has_part
-name: has_part
-def: "Inverse of part_of." [http://precedings.nature.com/documents/3495/version/1]
-comment: Example: operon has_part gene.
-
-[Typedef]
-id: has_quality
-name: has_quality
-comment: The relationship between a feature and an attribute.
-
-[Typedef]
-id: homologous_to
-name: homologous_to
-subset: SOFA
-is_symmetric: true
-is_a: similar_to ! similar_to
-
-[Typedef]
-id: integral_part_of
-name: integral_part_of
-def: "X integral_part_of Y if and only if: X part_of Y and Y has_part X." [http://precedings.nature.com/documents/3495/version/1]
-comment: Example: exon integral_part_of transcript.
-is_a: part_of ! part_of
-created_by: kareneilbeck
-creation_date: 2009-08-19T12:03:28Z
-
-[Typedef]
-id: is_consecutive_sequence_of
-name: is_consecutive_sequence_of
-def: "R is_consecutive_sequence_of R iff every instance of R is equivalent to a collection of instances of U:u1, u2, un, such that no pair of ux uy is overlapping and for all ux, it is adjacent to ux-1 and ux+1, with the exception of the initial and terminal u1,and un (which may be identical)." [PMID:20226267]
-comment: Example: region is consecutive_sequence of base.
-created_by: kareneilbeck
-creation_date: 2010-10-14T02:19:48Z
-
-[Typedef]
-id: lost
-name: lost
-def: "X lost Y if X is a variant_of X' and Y part of X' but not X." [SO:ke]
-comment: A relation with which to annotate the changes in a variant sequence with respect to a reference.\nFor example a variant transcript may have lost a stop codon present in the reference sequence.
-created_by: kareneilbeck
-creation_date: 2011-06-28T12:53:16Z
-
-[Typedef]
-id: maximally_overlaps
-name: maximally_overlaps
-def: "A maximally_overlaps X iff all parts of A (including A itself) overlap both A and Y." [PMID:20226267]
-comment: Example: non_coding_region_of_exon maximally_overlaps the intersections of exon and UTR.
-created_by: kareneilbeck
-creation_date: 2010-10-14T01:34:48Z
-
-[Typedef]
-id: member_of
-name: member_of
-comment: A subtype of part_of. Inverse is collection_of. Winston, M, Chaffin, R, Herrmann: A taxonomy of part-whole relations. Cognitive Science 1987, 11:417-444.
-subset: SOFA
-is_transitive: true
-is_a: part_of ! part_of
-
-[Typedef]
-id: non_functional_homolog_of
-name: non_functional_homolog_of
-def: "A relationship between a pseudogenic feature and its functional ancestor." [SO:ke]
-subset: SOFA
-is_a: homologous_to ! homologous_to
-
-[Typedef]
-id: orthologous_to
-name: orthologous_to
-subset: SOFA
-is_symmetric: true
-is_a: homologous_to ! homologous_to
-
-[Typedef]
-id: overlaps
-name: overlaps
-def: "X overlaps Y iff there exists some Z such that Z contained_by X and Z contained_by Y." [PMID:20226267]
-comment: Example: coding_exon overlaps CDS.
-created_by: kareneilbeck
-creation_date: 2010-10-14T01:33:15Z
-
-[Typedef]
-id: paralogous_to
-name: paralogous_to
-subset: SOFA
-is_symmetric: true
-is_a: homologous_to ! homologous_to
-
-[Typedef]
-id: part_of
-name: part_of
-def: "X part_of Y if X is a subregion of Y." [http://precedings.nature.com/documents/3495/version/1]
-comment: Example: amino_acid part_of polypeptide.
-subset: SOFA
-is_transitive: true
-
-[Typedef]
-id: partial_evidence_for_feature
-name: partial_evidence_for_feature
-def: "B is partial_evidence_for_feature A if the extent of B supports part_of but not all of A." [SO:ke]
-is_a: evidence_for_feature ! evidence_for_feature
-
-[Typedef]
-id: position_of
-name: position_of
-
-[Typedef]
-id: processed_from
-name: processed_from
-def: "Inverse of processed_into." [http://precedings.nature.com/documents/3495/version/1]
-comment: Example: miRNA processed_from miRNA_primary_transcript.
-created_by: kareneilbeck
-creation_date: 2009-08-19T12:14:00Z
-
-[Typedef]
-id: processed_into
-name: processed_into
-def: "X is processed_into Y if a region X is modified to create Y." [http://precedings.nature.com/documents/3495/version/1]
-comment: Example: miRNA_primary_transcript processed into miRNA.
-created_by: kareneilbeck
-creation_date: 2009-08-19T12:15:02Z
-
-[Typedef]
-id: recombined_from
-name: recombined_from
-created_by: kareneilbeck
-creation_date: 2009-08-19T02:21:03Z
-
-[Typedef]
-id: recombined_to
-name: recombined_to
-created_by: kareneilbeck
-creation_date: 2009-08-19T02:20:07Z
-
-[Typedef]
-id: sequence_of
-name: sequence_of
-
-[Typedef]
-id: similar_to
-name: similar_to
-subset: SOFA
-is_symmetric: true
-
-[Typedef]
-id: started_by
-name: started_by
-def: "X is strted_by Y if Y is part_of X and X and Y share a 5' boundary." [PMID:20226267]
-comment: Example: CDS started_by start_codon.
-created_by: kareneilbeck
-creation_date: 2010-10-14T01:43:55Z
-
-[Typedef]
-id: starts
-name: starts
-def: "X starts Y if X is part of Y, and A and Y share a 5' or N-terminal boundary." [PMID:20226267]
-comment: Example: start_codon starts CDS.
-created_by: kareneilbeck
-creation_date: 2010-10-14T01:47:53Z
-
-[Typedef]
-id: trans_spliced_from
-name: trans_spliced_from
-created_by: kareneilbeck
-creation_date: 2009-08-19T02:22:14Z
-
-[Typedef]
-id: trans_spliced_to
-name: trans_spliced_to
-created_by: kareneilbeck
-creation_date: 2009-08-19T02:22:00Z
-
-[Typedef]
-id: transcribed_from
-name: transcribed_from
-def: "X is transcribed_from Y if X is synthesized from template Y." [http://precedings.nature.com/documents/3495/version/1]
-comment: Example: primary_transcript transcribed_from gene.
-created_by: kareneilbeck
-creation_date: 2009-08-19T12:05:39Z
-
-[Typedef]
-id: transcribed_to
-name: transcribed_to
-def: "Inverse of transcribed_from." [http://precedings.nature.com/documents/3495/version/1]
-comment: Example: gene transcribed_to primary_transcript.
-created_by: kareneilbeck
-creation_date: 2009-08-19T12:08:24Z
-
-[Typedef]
-id: translates_to
-name: translates_to
-def: "Inverse of translation _of." [http://precedings.nature.com/documents/3495/version/1]
-comment: Example: codon translates_to amino_acid.
-created_by: kareneilbeck
-creation_date: 2009-08-19T12:11:53Z
-
-[Typedef]
-id: translation_of
-name: translation_of
-def: "X is translation of Y if X is translated by ribosome to create Y." [http://precedings.nature.com/documents/3495/version/1]
-comment: Example: Polypeptide translation_of CDS.
-created_by: kareneilbeck
-creation_date: 2009-08-19T12:09:59Z
-
-[Typedef]
-id: variant_of
-name: variant_of
-def: "A' is a variant (mutation) of A = definition every instance of A' is either an immediate mutation of some instance of A, or there is a chain of immediate mutation processes linking A' to some instance of A." [SO:immuno_workshop]
-comment: Added to SO during the immunology workshop, June 2007.  This relationship was approved by Barry Smith.
-
diff --git a/src/io/so2xgap4map.xxd b/src/io/so2xgap4map.xxd
deleted file mode 100644
index bd25bd0..0000000
--- a/src/io/so2xgap4map.xxd
+++ /dev/null
@@ -1,2068 +0,0 @@
-2KB_upstream_variant	X000
-3D_polypeptide_structure_variant	X001
-3_prime_UTR_variant	X002
-500B_downstream_variant	X003
-5KB_downstream_variant	X004
-5KB_upstream_variant	X005
-5_prime_UTR_variant	X006
-AFLP_fragment	X007
-AP_1_binding_site	X008
-ARS	X009
-ASPE_primer	X00a
-AU_rich_element	X00b
-A_box	X00c
-A_box_type_1	X00d
-A_box_type_2	X00e
-A_minor_RNA_motif	X00f
-A_to_C_transversion	X010
-A_to_G_transition	X011
-A_to_T_transversion	X012
-Ace2_UAS	X013
-BAC	X014
-BAC_clone	X015
-BAC_cloned_genomic_insert	X016
-BAC_end	X017
-BREd_motif	X018
-BREu_motif	X019
-B_box	X01a
-Bruno_response_element	X01b
-CCAAT_motif	X01c
-CCA_tail	X01d
-CDRE_motif	X01e
-CDS_fragment	X01f
-CDS_independently_known	X020
-CDS_predicted	X021
-CDS_region	X022
-CDS_supported_by_EST_or_cDNA_data	X023
-CDS_supported_by_domain_match_data	X024
-CDS_supported_by_sequence_similarity_data	X025
-CRE	X026
-CRISPR	X027
-CRM	X028
-CSL_response_element	X029
-CTG_start_codon	X02a
-C_D_box_snoRNA	X02b
-C_D_box_snoRNA_encoding	X02c
-C_D_box_snoRNA_primary_transcript	X02d
-C_box	X02e
-C_cluster	X02f
-C_gene_segment	X030
-C_region	X031
-C_to_A_transversion	X032
-C_to_G_transversion	X033
-C_to_T_transition	X034
-C_to_T_transition_at_pCpG_site	X035
-ChIP_seq_region	X036
-CpG_island	X037
-CsrB_RsmB_RNA	X038
-CuRE	X039
-DArT_marker	X03a
-DCE	X03b
-DCE_SI	X03c
-DCE_SII	X03d
-DCE_SIII	X03e
-DDB_box	X03f
-DHU_loop	X040
-DJ_C_cluster	X041
-DJ_J_C_cluster	X042
-DJ_J_cluster	X043
-DJ_gene_segment	X044
-DMv1_motif	X045
-DMv2_motif	X046
-DMv3_motif	X047
-DMv4_motif	X048
-DMv5_motif	X049
-DNA	X04a
-DNA_aptamer	X04b
-DNA_binding_site	X04c
-DNA_chromosome	X04d
-DNA_constraint_sequence	X04e
-DNA_invertase_target_sequence	X04f
-DNA_motif	X050
-DNA_replication_mode	X051
-DNA_sequence_secondary_structure	X052
-DNA_transposon	X053
-DNAseI_hypersensitive_site	X054
-DNAzyme	X055
-DPE1_motif	X056
-DPE_motif	X057
-DRE	X058
-DRE_motif	X059
-D_DJ_C_cluster	X05a
-D_DJ_J_C_cluster	X05b
-D_DJ_J_cluster	X05c
-D_DJ_cluster	X05d
-D_J_C_cluster	X05e
-D_J_cluster	X05f
-D_cluster	X060
-D_gene_recombination_feature	X061
-D_gene_segment	X062
-DsrA_RNA	X063
-ER_retention_signal	X064
-EST	X065
-EST_match	X066
-E_box_motif	X067
-FLEX_element	X068
-FRT_flanked	X069
-FRT_site	X06a
-GAGA_motif	X06b
-GATA_box	X06c
-GC_rich_promoter_region	X06d
-GNA	X06e
-GNA_oligo	X06f
-GTT_trinucleotide_repeat	X070
-GT_dinucleotide_repeat	X071
-G_quartet	X072
-G_to_A_transition	X073
-G_to_C_transversion	X074
-G_to_T_transversion	X075
-GcvB_RNA	X076
-H2BK5_monomethylation_site	X077
-H2B_ubiquitination_site	X078
-H3K14_acetylation_site	X079
-H3K18_acetylation_site	X07a
-H3K27_acylation_site	X07b
-H3K27_dimethylation_site	X07c
-H3K27_methylation_site	X07d
-H3K27_monomethylation_site	X07e
-H3K27_trimethylation_site	X07f
-H3K36_dimethylation_site	X080
-H3K36_methylation_site	X081
-H3K36_monomethylation_site	X082
-H3K36_trimethylation_site	X083
-H3K4_dimethylation_site	X084
-H3K4_methylation_site	X085
-H3K4_monomethylation_site	X086
-H3K4_trimethylation	X087
-H3K79_dimethylation_site	X088
-H3K79_methylation_site	X089
-H3K79_monomethylation_site	X08a
-H3K79_trimethylation_site	X08b
-H3K9_acetylation_site	X08c
-H3K9_dimethylation_site	X08d
-H3K9_methylation_site	X08e
-H3K9_monomethylation_site	X08f
-H3K9_trimethylation_site	X090
-H4K16_acylation_site	X091
-H4K20_monomethylation_site	X092
-H4K5_acylation_site	X093
-H4K_acylation_region	X094
-HSE	X095
-H_ACA_box_snoRNA	X096
-H_ACA_box_snoRNA_encoding	X097
-H_ACA_box_snoRNA_primary_transcript	X098
-H_pseudoknot	X099
-Hoogsteen_base_pair	X09a
-INR1_motif	X09b
-INR_motif	X09c
-IRLinv_site	X09d
-IRRinv_site	X09e
-ISRE	X09f
-J_C_cluster	X0a0
-J_cluster	X0a1
-J_gene_recombination_feature	X0a2
-J_heptamer	X0a3
-J_nonamer	X0a4
-J_spacer	X0a5
-KEN_box	X0a6
-K_turn_RNA_motif	X0a7
-LINE_element	X0a8
-LNA	X0a9
-LNA_oligo	X0aa
-LTR_component	X0ab
-LTR_retrotransposon	X0ac
-MCB	X0ad
-MITE	X0ae
-MNP	X0af
-MTE	X0b0
-MicF_RNA	X0b1
-N2_2_prime_O_dimethylguanosine	X0b2
-N2_7_2prirme_O_trimethylguanosine	X0b3
-N2_7_dimethylguanosine	X0b4
-N2_N2_2_prime_O_trimethylguanosine	X0b5
-N2_N2_7_trimethylguanosine	X0b6
-N2_N2_dimethylguanosine	X0b7
-N2_methylguanosine	X0b8
-N4_2_prime_O_dimethylcytidine	X0b9
-N4_N4_2_prime_O_trimethylcytidine	X0ba
-N4_acetyl_2_prime_O_methylcytidine	X0bb
-N4_acetylcytidine	X0bc
-N4_methylcytidine	X0bd
-N6_2_prime_O_dimethyladenosine	X0be
-N6_N6_2_prime_O_trimethyladenosine	X0bf
-N6_N6_dimethyladenosine	X0c0
-N6_acetyladenosine	X0c1
-N6_cis_hydroxyisopentenyl_adenosine	X0c2
-N6_glycinylcarbamoyladenosine	X0c3
-N6_hydroxynorvalylcarbamoyladenosine	X0c4
-N6_isopentenyladenosine	X0c5
-N6_methyl_N6_threonylcarbamoyladenosine	X0c6
-N6_methyladenosine	X0c7
-N6_threonylcarbamoyladenosine	X0c8
-NDM2_motif	X0c9
-NDM3_motif	X0ca
-NMD_transcript_variant	X0cb
-ORF	X0cc
-OxyS_RNA	X0cd
-PAC	X0ce
-PAC_clone	X0cf
-PAC_end	X0d0
-PCR_product	X0d1
-PIP_box	X0d2
-PNA	X0d3
-PNA_oligo	X0d4
-PSE_motif	X0d5
-Phage_RNA_Polymerase_Promoter	X0d6
-QTL	X0d7
-RAPD	X0d8
-RFLP_fragment	X0d9
-RH_map	X0da
-RNA	X0db
-RNA_6S	X0dc
-RNA_aptamer	X0dd
-RNA_chromosome	X0de
-RNA_hook_turn	X0df
-RNA_internal_loop	X0e0
-RNA_junction_loop	X0e1
-RNA_motif	X0e2
-RNA_polymerase_III_TATA_box	X0e3
-RNA_polymerase_II_TATA_box	X0e4
-RNA_polymerase_promoter	X0e5
-RNA_replication_mode	X0e6
-RNA_sequence_secondary_structure	X0e7
-RNAi_reagent	X0e8
-RNApol_III_promoter	X0e9
-RNApol_III_promoter_type_1	X0ea
-RNApol_III_promoter_type_1_region	X0eb
-RNApol_III_promoter_type_2	X0ec
-RNApol_III_promoter_type_2_region	X0ed
-RNApol_III_promoter_type_3	X0ee
-RNApol_II_core_promoter	X0ef
-RNApol_II_promoter	X0f0
-RNApol_II_promoter_region	X0f1
-RNApol_I_promoter	X0f2
-RNase_MRP_RNA	X0f3
-RNase_MRP_RNA_gene	X0f4
-RNase_P_RNA	X0f5
-RNase_P_RNA_gene	X0f6
-RRE_RNA	X0f7
-RR_tract	X0f8
-RST	X0f9
-RST_match	X0fa
-R_GNA	X0fb
-R_GNA_oligo	X0fc
-R_LTR_region	X0fd
-R_five_prime_LTR_region	X0fe
-R_three_prime_LTR_region	X0ff
-Robertsonian_fusion	X100
-RprA_RNA	X101
-SAGE_tag	X102
-SECIS_element	X103
-SINE_element	X104
-SL10_accceptor_site	X105
-SL11_acceptor_site	X106
-SL12_acceptor_site	X107
-SL1_acceptor_site	X108
-SL2_acceptor_site	X109
-SL3_acceptor_site	X10a
-SL4_acceptor_site	X10b
-SL5_acceptor_site	X10c
-SL6_acceptor_site	X10d
-SL7_acceptor_site	X10e
-SL8_acceptor_site	X10f
-SL9_acceptor_site	X110
-SNP	X111
-SNV	X112
-SP6_RNA_Polymerase_Promoter	X113
-SRP_RNA	X114
-SRP_RNA_encoding	X115
-SRP_RNA_gene	X116
-SRP_RNA_primary_transcript	X117
-STREP_motif	X118
-STS_map	X119
-S_GNA	X11a
-S_GNA_oligo	X11b
-Sap1_recognition_motif	X11c
-Sequence_Ontology	X11d
-Shine_Dalgarno_sequence	X11e
-T3_RNA_Polymerase_Promoter	X11f
-T7_RNA_Polymerase_Promoter	X120
-TF_binding_site	X121
-TF_binding_site_variant	X122
-TNA	X123
-TNA_oligo	X124
-TR_box	X125
-TSS	X126
-TSS_region	X127
-T_loop	X128
-T_to_A_transversion	X129
-T_to_C_transition	X12a
-T_to_G_transversion	X12b
-U11_snRNA	X12c
-U12_intron	X12d
-U12_snRNA	X12e
-U14_snoRNA	X12f
-U14_snoRNA_primary_transcript	X130
-U1_snRNA	X131
-U2_intron	X132
-U2_snRNA	X133
-U3_LTR_region	X134
-U3_five_prime_LTR_region	X135
-U3_snoRNA	X136
-U3_three_prime_LTR_region	X137
-U4_snRNA	X138
-U4atac_snRNA	X139
-U5_LTR_region	X13a
-U5_five_prime_LTR_region	X13b
-U5_snRNA	X13c
-U5_three_prime_LTR_region	X13d
-U6_snRNA	X13e
-U6atac_snRNA	X13f
-UAA_stop_codon_signal	X140
-UAG_stop_codon_signal	X141
-UGA_stop_codon_signal	X142
-UPD	X143
-UST	X144
-UST_match	X145
-UTR	X146
-UTR_intron	X147
-UTR_region	X148
-UTR_variant	X149
-U_box	X14a
-VDJ_C_cluster	X14b
-VDJ_J_C_cluster	X14c
-VDJ_J_cluster	X14d
-VDJ_gene_segment	X14e
-VD_gene_segment	X14f
-VJ_C_cluster	X150
-VJ_J_C_cluster	X151
-VJ_J_cluster	X152
-VJ_gene_segment	X153
-V_DJ_C_cluster	X154
-V_DJ_J_C_cluster	X155
-V_DJ_J_cluster	X156
-V_DJ_cluster	X157
-V_D_DJ_C_cluster	X158
-V_D_DJ_J_C_cluster	X159
-V_D_DJ_J_cluster	X15a
-V_D_DJ_cluster	X15b
-V_D_J_C_cluster	X15c
-V_D_J_cluster	X15d
-V_J_C_cluster	X15e
-V_J_cluster	X15f
-V_VDJ_C_cluster	X160
-V_VDJ_J_C_cluster	X161
-V_VDJ_J_cluster	X162
-V_VDJ_cluster	X163
-V_VJ_C_cluster	X164
-V_VJ_J_C_cluster	X165
-V_VJ_J_cluster	X166
-V_VJ_cluster	X167
-V_cluster	X168
-V_gene_recombination_feature	X169
-V_heptamer	X16a
-V_nonamer	X16b
-V_spacer	X16c
-WC_base_pair	X16d
-X_element	X16e
-X_element_combinatorial_repeat	X16f
-YAC	X170
-YAC_clone	X171
-YAC_end	X172
-Y_RNA	X173
-Y_prime_element	X174
-aberrant_processed_transcript	X175
-active_peptide	X176
-adaptive_island	X177
-adjacent_to	X178
-alanine	X179
-alanine_tRNA_primary_transcript	X17a
-alanyl_tRNA	X17b
-allele	X17c
-allelically_excluded	X17d
-allelically_excluded_gene	X17e
-allopolyploid	X17f
-alpha_beta_motif	X180
-alpha_helix	X181
-alteration_attribute	X182
-alternate_sequence_site	X183
-alternately_spliced_gene_encodeing_one_transcript	X184
-alternately_spliced_gene_encoding_greater_than_one_transcript	X185
-alternatively_spliced	X186
-alternatively_spliced_gene_encoding_greater_than_1_polypeptide_coding_regions_overlapping	X187
-alternatively_spliced_transcript	X188
-alternatively_spliced_transcript_encoding_greater_than_1_polypeptide_different_start_codon_different_stop_codon_coding_regions_non_overlapping	X189
-ambisense_ssRNA_viral_sequence	X18a
-amino_acid	X18b
-amino_acid_deletion	X18c
-amino_acid_insertion	X18d
-amino_acid_substitution	X18e
-amplification_origin	X18f
-anchor_binding_site	X190
-anchor_region	X191
-androgen_response_element	X192
-aneuploid	X193
-aneuploid_chromosome	X194
-annotation_directed_improved_draft	X195
-anticodon	X196
-anticodon_loop	X197
-antiparallel_beta_strand	X198
-antisense	X199
-antisense_RNA	X19a
-antisense_primary_transcript	X19b
-apicoplast_chromosome	X19c
-apicoplast_gene	X19d
-apicoplast_sequence	X19e
-aptamer	X19f
-archaeal_intron	X1a0
-archaeosine	X1a1
-arginine	X1a2
-arginine_tRNA_primary_transcript	X1a3
-arginyl_tRNA	X1a4
-asparagine	X1a5
-asparagine_tRNA_primary_transcript	X1a6
-asparaginyl_tRNA	X1a7
-aspartic_acid	X1a8
-aspartic_acid_tRNA_primary_transcript	X1a9
-aspartyl_tRNA	X1aa
-assembly	X1ab
-assembly_component	X1ac
-assembly_error_correction	X1ad
-associated_with	X1ae
-assortment_derived_aneuploid	X1af
-assortment_derived_deficiency	X1b0
-assortment_derived_deficiency_plus_duplication	X1b1
-assortment_derived_duplication	X1b2
-assortment_derived_variation	X1b3
-asx_motif	X1b4
-asx_turn	X1b5
-asx_turn_left_handed_type_one	X1b6
-asx_turn_left_handed_type_two	X1b7
-asx_turn_right_handed_type_one	X1b8
-asx_turn_right_handed_type_two	X1b9
-asymmetric_RNA_internal_loop	X1ba
-attB_site	X1bb
-attC_site	X1bc
-attCtn_site	X1bd
-attI_site	X1be
-attL_site	X1bf
-attP_site	X1c0
-attR_site	X1c1
-autocatalytically_spliced_intron	X1c2
-autopolyploid	X1c3
-autoregulated	X1c4
-autosynaptic_chromosome	X1c5
-bacterial_RNApol_promoter	X1c6
-bacterial_RNApol_promoter_region	X1c7
-bacterial_RNApol_promoter_sigma54	X1c8
-bacterial_RNApol_promoter_sigma_70	X1c9
-bacterial_terminator	X1ca
-base	X1cb
-base_call_error_correction	X1cc
-base_pair	X1cd
-benign_variant	X1ce
-beta_bulge	X1cf
-beta_bulge_loop	X1d0
-beta_bulge_loop_five	X1d1
-beta_bulge_loop_six	X1d2
-beta_strand	X1d3
-beta_turn	X1d4
-beta_turn_left_handed_type_one	X1d5
-beta_turn_left_handed_type_two	X1d6
-beta_turn_right_handed_type_one	X1d7
-beta_turn_right_handed_type_two	X1d8
-beta_turn_type_eight	X1d9
-beta_turn_type_six	X1da
-beta_turn_type_six_a	X1db
-beta_turn_type_six_a_one	X1dc
-beta_turn_type_six_a_two	X1dd
-beta_turn_type_six_b	X1de
-bidirectional_promoter	X1df
-biochemical_region_of_peptide	X1e0
-biological_region	X1e1
-biomaterial_region	X1e2
-bipartite_duplication	X1e3
-bipartite_inversion	X1e4
-blocked_reading_frame	X1e5
-blunt_end_restriction_enzyme_cleavage_junction	X1e6
-blunt_end_restriction_enzyme_cleavage_site	X1e7
-bound_by_factor	X1e8
-bound_by_nucleic_acid	X1e9
-bound_by_protein	X1ea
-branch_site	X1eb
-cDNA	X1ec
-cDNA_clone	X1ed
-cDNA_match	X1ee
-c_terminal_region	X1ef
-canonical_five_prime_splice_site	X1f0
-canonical_splice_site	X1f1
-canonical_three_prime_splice_site	X1f2
-cap	X1f3
-capped	X1f4
-capped_mRNA	X1f5
-capped_primary_transcript	X1f6
-cassette_array_member	X1f7
-cassette_pseudogene	X1f8
-catalytic_residue	X1f9
-catmat_left_handed_four	X1fa
-catmat_left_handed_three	X1fb
-catmat_right_handed_four	X1fc
-catmat_right_handed_three	X1fd
-central_hydrophobic_region_of_signal_peptide	X1fe
-centromere	X1ff
-centromere_DNA_Element_I	X200
-centromere_DNA_Element_II	X201
-centromere_DNA_Element_III	X202
-centromeric_repeat	X203
-chimeric_cDNA_clone	X204
-chloroplast_DNA	X205
-chloroplast_chromosome	X206
-chloroplast_sequence	X207
-chromoplast_chromosome	X208
-chromoplast_gene	X209
-chromoplast_sequence	X20a
-chromosomal_deletion	X20b
-chromosomal_duplication	X20c
-chromosomal_inversion	X20d
-chromosomal_regulatory_element	X20e
-chromosomal_structural_element	X20f
-chromosomal_translocation	X210
-chromosomal_transposition	X211
-chromosomal_variation_attribute	X212
-chromosomally_aberrant_genome	X213
-chromosome	X214
-chromosome_arm	X215
-chromosome_band	X216
-chromosome_breakage_sequence	X217
-chromosome_breakpoint	X218
-chromosome_fission	X219
-chromosome_number_variation	X21a
-chromosome_part	X21b
-chromosome_structure_variation	X21c
-chromosome_variation	X21d
-circular	X21e
-circular_double_stranded_DNA_chromosome	X21f
-circular_double_stranded_RNA_chromosome	X220
-circular_single_stranded_DNA_chromosome	X221
-circular_single_stranded_RNA_chromosome	X222
-cis_regulatory_frameshift_element	X223
-cis_splice_site	X224
-class_II_RNA	X225
-class_I_RNA	X226
-cleaved_for_gpi_anchor_region	X227
-cleaved_initiator_methionine	X228
-cleaved_peptide_region	X229
-clip	X22a
-clone	X22b
-clone_attribute	X22c
-clone_end	X22d
-clone_insert	X22e
-clone_insert_end	X22f
-clone_insert_start	X230
-cloned	X231
-cloned_cDNA	X232
-cloned_cDNA_insert	X233
-cloned_genomic	X234
-cloned_genomic_insert	X235
-cloned_region	X236
-coding_conserved_region	X237
-coding_end	X238
-coding_exon	X239
-coding_region_of_exon	X23a
-coding_sequence_variant	X23b
-coding_start	X23c
-coding_variant_quality	X23d
-codon	X23e
-codon_redefined	X23f
-codon_variant	X240
-coiled_coil	X241
-cointegrated_plasmid	X242
-common_variant	X243
-compensatory_transcript_secondary_structure_variant	X244
-complete_evidence_for_feature	X245
-complex_3D_structural_variant	X246
-complex_change_in_transcript	X247
-complex_change_of_translational_product_variant	X248
-complex_chromosomal_mutation	X249
-complex_structural_alteration	X24a
-complex_substitution	X24b
-compositionally_biased_region_of_peptide	X24c
-compound_chromosome	X24d
-compound_chromosome_arm	X24e
-computed_feature	X24f
-computed_feature_by_similarity	X250
-conformational_change_variant	X251
-conformational_switch	X252
-conjugative_transposon	X253
-connects_on	X254
-consensus	X255
-consensus_mRNA	X256
-consensus_region	X257
-conservative_amino_acid_substitution	X258
-conservative_decrease_in_CDS_length	X259
-conservative_increase_in_CDS_length	X25a
-conservative_missense_codon	X25b
-conserved	X25c
-conserved_region	X25d
-contained_by	X25e
-contains	X25f
-contig_collection	X260
-contig_read	X261
-copy_number_change	X262
-copy_number_gain	X263
-copy_number_loss	X264
-copy_number_variation	X265
-core_promoter_element	X266
-cosmid	X267
-cosmid_clone	X268
-covalent_binding_site	X269
-cross_genome_match	X26a
-cross_link	X26b
-cryptic	X26c
-cryptic_gene	X26d
-cryptic_prophage	X26e
-cryptic_splice_acceptor	X26f
-cryptic_splice_donor	X270
-cryptic_splice_site	X271
-cryptic_splice_site_variant	X272
-cryptogene	X273
-ct_gene	X274
-cyanelle_chromosome	X275
-cyanelle_gene	X276
-cyanelle_sequence	X277
-cyclic_translocation	X278
-cysteine	X279
-cysteine_tRNA_primary_transcript	X27a
-cysteinyl_tRNA	X27b
-cytoplasmic_polypeptide_region	X27c
-dCAPS_primer	X27d
-de_novo_variant	X27e
-decayed_exon	X27f
-decreased_polyadenylation_variant	X280
-decreased_transcript_level_variant	X281
-decreased_transcript_stability_variant	X282
-decreased_transcription_rate_variant	X283
-decreased_translational_product_level	X284
-defective_conjugative_transposon	X285
-deficient_interchromosomal_transposition	X286
-deficient_intrachromosomal_transposition	X287
-deficient_inversion	X288
-deficient_translocation	X289
-delete	X28a
-delete_U	X28b
-deletion	X28c
-deletion_breakpoint	X28d
-deletion_junction	X28e
-derives_from	X28f
-designed_sequence	X290
-destruction_box	X291
-dexstrosynaptic_chromosome	X292
-dicistronic	X293
-dicistronic_mRNA	X294
-dicistronic_primary_transcript	X295
-dicistronic_transcript	X296
-dif_site	X297
-dihydrouridine	X298
-dinucleotide_repeat_microsatellite_feature	X299
-diplotype	X29a
-direct	X29b
-direct_repeat	X29c
-direct_tandem_duplication	X29d
-direction_attribute	X29e
-disconnected_from	X29f
-disease_associated_variant	X2a0
-disease_causing_variant	X2a1
-dispersed_repeat	X2a2
-disruptive_decrease_in_CDS_length	X2a3
-disruptive_increase_in_CDS_length	X2a4
-distal_promoter_element	X2a5
-distant_three_prime_recoding_signal	X2a6
-disulfide_bond	X2a7
-double	X2a8
-double_stranded_DNA_chromosome	X2a9
-double_stranded_RNA_chromosome	X2aa
-double_stranded_cDNA	X2ab
-downstream_gene_variant	X2ac
-ds_DNA_viral_sequence	X2ad
-ds_RNA_viral_sequence	X2ae
-ds_oligo	X2af
-duplicated_pseudogene	X2b0
-duplication	X2b1
-duplication_attribute	X2b2
-dye_terminator_read	X2b3
-edit_operation	X2b4
-edited	X2b5
-edited_CDS	X2b6
-edited_by_A_to_I_substitution	X2b7
-edited_by_C_insertion_and_dinucleotide_insertion	X2b8
-edited_by_C_to_U_substitution	X2b9
-edited_by_G_addition	X2ba
-edited_from	X2bb
-edited_mRNA	X2bc
-edited_to	X2bd
-edited_transcript	X2be
-edited_transcript_by_A_to_I_substitution	X2bf
-edited_transcript_feature	X2c0
-editing_block	X2c1
-editing_domain	X2c2
-editing_variant	X2c3
-eight_cutter_restriction_site	X2c4
-elongated_in_frame_polypeptide_C_terminal	X2c5
-elongated_in_frame_polypeptide_N_terminal_elongation	X2c6
-elongated_out_of_frame_polypeptide_C_terminal	X2c7
-elongated_out_of_frame_polypeptide_N_terminal	X2c8
-elongated_polypeptide	X2c9
-elongated_polypeptide_C_terminal	X2ca
-elongated_polypeptide_N_terminal	X2cb
-encodes_1_polypeptide	X2cc
-encodes_alternate_transcription_start_sites	X2cd
-encodes_alternately_spliced_transcripts	X2ce
-encodes_different_polypeptides_different_stop	X2cf
-encodes_disjoint_polypeptides	X2d0
-encodes_greater_than_1_polypeptide	X2d1
-encodes_overlapping_peptides	X2d2
-encodes_overlapping_peptides_different_start	X2d3
-encodes_overlapping_polypeptides_different_start_and_stop	X2d4
-end_overlapping_gene	X2d5
-endogenous_retroviral_gene	X2d6
-endogenous_retroviral_sequence	X2d7
-endonuclease_spliced_intron	X2d8
-endosomal_localization_signal	X2d9
-engineered	X2da
-engineered_DNA	X2db
-engineered_episome	X2dc
-engineered_foreign_gene	X2dd
-engineered_foreign_region	X2de
-engineered_foreign_repetitive_element	X2df
-engineered_foreign_transposable_element	X2e0
-engineered_foreign_transposable_element_gene	X2e1
-engineered_fusion_gene	X2e2
-engineered_gene	X2e3
-engineered_insert	X2e4
-engineered_plasmid	X2e5
-engineered_region	X2e6
-engineered_rescue_region	X2e7
-engineered_tag	X2e8
-engineered_transposable_element	X2e9
-enhanceosome	X2ea
-enhancer_attribute	X2eb
-enhancer_binding_site	X2ec
-enhancer_bound_by_factor	X2ed
-enhancer_trap_construct	X2ee
-enzymatic	X2ef
-enzymatic_RNA	X2f0
-epigenetically_modified	X2f1
-epigenetically_modified_gene	X2f2
-epigenetically_modified_region	X2f3
-episome	X2f4
-epitope	X2f5
-epoxyqueuosine	X2f6
-eukaryotic_terminator	X2f7
-evidence_for_feature	X2f8
-exemplar	X2f9
-exemplar_mRNA	X2fa
-exemplar_of	X2fb
-exon_junction	X2fc
-exon_loss	X2fd
-exon_of_single_exon_gene	X2fe
-exon_region	X2ff
-exon_variant	X300
-exonic_splice_enhancer	X301
-experimental_feature	X302
-experimental_feature_attribute	X303
-experimental_result_region	X304
-experimentally_defined_binding_region	X305
-experimentally_determined	X306
-expressed_sequence_assembly	X307
-expressed_sequence_match	X308
-external_transcribed_spacer_region	X309
-extrachromosomal_mobile_genetic_element	X30a
-extramembrane_polypeptide_region	X30b
-feature_attribute	X30c
-fingerprint_map	X30d
-finished_by	X30e
-finished_genome	X30f
-finishes	X310
-five_aminomethyl_two_thiouridine	X311
-five_carbamoylmethyl_two_prime_O_methyluridine	X312
-five_carbamoylmethyluridine	X313
-five_carboxyhydroxymethyl_uridine	X314
-five_carboxyhydroxymethyl_uridine_methyl_ester	X315
-five_carboxymethylaminomethyl_two_prime_O_methyluridine	X316
-five_carboxymethylaminomethyl_two_thiouridine	X317
-five_carboxymethylaminomethyluridine	X318
-five_carboxymethyluridine	X319
-five_formyl_two_prime_O_methylcytidine	X31a
-five_formylcytidine	X31b
-five_hydroxymethylcytidine	X31c
-five_hydroxyuridine	X31d
-five_isopentenylaminomethyl_two_prime_O_methyluridine	X31e
-five_isopentenylaminomethyl_two_thiouridine	X31f
-five_isopentenylaminomethyl_uridine	X320
-five_methoxycarbonylmethyl_two_prime_O_methyluridine	X321
-five_methoxycarbonylmethyl_two_thiouridine	X322
-five_methoxycarbonylmethyluridine	X323
-five_methoxyuridine	X324
-five_methyl_2_thiouridine	X325
-five_methylaminomethyl_two_selenouridine	X326
-five_methylaminomethyl_two_thiouridine	X327
-five_methylaminomethyluridine	X328
-five_methylcytidine	X329
-five_methyldihydrouridine	X32a
-five_methyluridine	X32b
-five_prime_D_heptamer	X32c
-five_prime_D_nonamer	X32d
-five_prime_D_recombination_signal_sequence	X32e
-five_prime_D_spacer	X32f
-five_prime_EST	X330
-five_prime_LTR	X331
-five_prime_LTR_component	X332
-five_prime_RST	X333
-five_prime_UST	X334
-five_prime_UTR_intron	X335
-five_prime_cis_splice_site	X336
-five_prime_coding_exon	X337
-five_prime_coding_exon_coding_region	X338
-five_prime_coding_exon_noncoding_region	X339
-five_prime_five_prime_overlap	X33a
-five_prime_flanking_region	X33b
-five_prime_intron	X33c
-five_prime_noncoding_exon	X33d
-five_prime_open_reading_frame	X33e
-five_prime_recoding_site	X33f
-five_prime_restriction_enzyme_junction	X340
-five_prime_terminal_inverted_repeat	X341
-five_prime_three_prime_overlap	X342
-five_taurinomethyl_two_thiouridine	X343
-five_taurinomethyluridine	X344
-five_two_prime_O_dimethylcytidine	X345
-five_two_prime_O_dimethyluridine	X346
-fixed_variant	X347
-flanked	X348
-flanking_region	X349
-flanking_three_prime_quadruplet_recoding_signal	X34a
-floxed	X34b
-floxed_gene	X34c
-foldback_element	X34d
-foreign	X34e
-foreign_gene	X34f
-foreign_transposable_element	X350
-forkhead_motif	X351
-forward	X352
-forward_primer	X353
-fosmid	X354
-fosmid_clone	X355
-four_bp_start_codon	X356
-four_cutter_restriction_site	X357
-four_demethylwyosine	X358
-four_thiouridine	X359
-fragment_assembly	X35a
-fragmentary	X35b
-frame_restoring_sequence_variant	X35c
-frame_restoring_variant	X35d
-frameshift	X35e
-frameshift_sequence_variation	X35f
-frameshift_variant	X360
-free	X361
-free_chromosome_arm	X362
-free_duplication	X363
-free_ring_duplication	X364
-functional_variant	X365
-fusion	X366
-fusion_gene	X367
-gRNA_encoding	X368
-gRNA_gene	X369
-gained	X36a
-galactosyl_queuosine	X36b
-gamma_turn	X36c
-gamma_turn_classic	X36d
-gamma_turn_inverse	X36e
-gene_array	X36f
-gene_array_member	X370
-gene_attribute	X371
-gene_by_genome_location	X372
-gene_by_organelle_of_genome	X373
-gene_by_polyadenylation_attribute	X374
-gene_by_transcript_attribute	X375
-gene_cassette	X376
-gene_cassette_array	X377
-gene_cassette_member	X378
-gene_class	X379
-gene_component_region	X37a
-gene_fragment	X37b
-gene_fusion	X37c
-gene_group	X37d
-gene_group_regulatory_region	X37e
-gene_member_region	X37f
-gene_not_polyadenylated	X380
-gene_part	X381
-gene_rearranged_at_DNA_level	X382
-gene_segment	X383
-gene_sensu_your_favorite_organism	X384
-gene_silenced_by_DNA_methylation	X385
-gene_silenced_by_DNA_modification	X386
-gene_silenced_by_RNA_interference	X387
-gene_silenced_by_histone_deacetylation	X388
-gene_silenced_by_histone_methylation	X389
-gene_silenced_by_histone_modification	X38a
-gene_subarray	X38b
-gene_subarray_member	X38c
-gene_to_gene_feature	X38d
-gene_trap_construct	X38e
-gene_variant	X38f
-gene_with_dicistronic_mRNA	X390
-gene_with_dicistronic_primary_transcript	X391
-gene_with_dicistronic_transcript	X392
-gene_with_edited_transcript	X393
-gene_with_mRNA_recoded_by_translational_bypass	X394
-gene_with_mRNA_with_frameshift	X395
-gene_with_non_canonical_start_codon	X396
-gene_with_polyadenylated_mRNA	X397
-gene_with_polycistronic_transcript	X398
-gene_with_recoded_mRNA	X399
-gene_with_start_codon_CUG	X39a
-gene_with_stop_codon_read_through	X39b
-gene_with_stop_codon_redefined_as_pyrrolysine	X39c
-gene_with_stop_codon_redefined_as_selenocysteine	X39d
-gene_with_trans_spliced_transcript	X39e
-gene_with_transcript_with_translational_frameshift	X39f
-genetic_marker	X3a0
-genome	X3a1
-genome_of	X3a2
-genomic_DNA	X3a3
-genomic_DNA_read	X3a4
-genomic_clone	X3a5
-genomic_island	X3a6
-genomically_contaminated_cDNA_clone	X3a7
-genotype	X3a8
-germline_variant	X3a9
-glutamic_acid	X3aa
-glutamic_acid_tRNA_primary_transcript	X3ab
-glutamine	X3ac
-glutamine_tRNA_primary_transcript	X3ad
-glutaminyl_tRNA	X3ae
-glutamyl_tRNA	X3af
-glycine	X3b0
-glycine_tRNA_primary_transcript	X3b1
-glycyl_tRNA	X3b2
-golden_path	X3b3
-golden_path_fragment	X3b4
-group_1_intron_homing_endonuclease_target_region	X3b5
-group_IIA_intron	X3b6
-group_IIB_intron	X3b7
-group_III_intron	X3b8
-group_II_intron	X3b9
-group_I_intron	X3ba
-guide_RNA	X3bb
-guide_RNA_region	X3bc
-guided_by	X3bd
-guides	X3be
-hammerhead_ribozyme	X3bf
-haplotype	X3c0
-haplotype_block	X3c1
-has_integral_part	X3c2
-has_origin	X3c3
-has_part	X3c4
-has_quality	X3c5
-helitron	X3c6
-helix_turn_helix	X3c7
-heptamer_of_recombination_feature_of_vertebrate_immune_system_gene	X3c8
-heritable_phenotypic_marker	X3c9
-hetero_compound_chromosome	X3ca
-high_identity_region	X3cb
-high_quality_draft	X3cc
-histidine	X3cd
-histidine_tRNA_primary_transcript	X3ce
-histidyl_tRNA	X3cf
-histone_acetylation_site	X3d0
-histone_acylation_region	X3d1
-histone_binding_site	X3d2
-histone_methylation_site	X3d3
-histone_modification	X3d4
-histone_ubiqitination_site	X3d5
-homing_endonuclease_binding_site	X3d6
-homo_compound_chromosome	X3d7
-homol_D_box	X3d8
-homol_E_box	X3d9
-homologous	X3da
-homologous_region	X3db
-homologous_to	X3dc
-hydrophobic_region_of_peptide	X3dd
-hydroxywybutosine	X3de
-hyperploid	X3df
-hypoploid	X3e0
-i_motif	X3e1
-immature_peptide_region	X3e2
-immunoglobulin_region	X3e3
-imprinted	X3e4
-improved_high_quality_draft	X3e5
-inactive_catalytic_site	X3e6
-inactive_ligand_binding_site	X3e7
-incomplete_terminal_codon_variant	X3e8
-increased_polyadenylation_variant	X3e9
-increased_transcript_level_variant	X3ea
-increased_transcript_stability_variant	X3eb
-increased_transcription_rate_variant	X3ec
-increased_translational_product_level	X3ed
-indel	X3ee
-independently_known	X3ef
-inframe	X3f0
-inframe_change_in_CDS_length	X3f1
-inframe_codon_gain	X3f2
-inframe_codon_loss	X3f3
-inframe_decrease_in_CDS_length	X3f4
-inframe_increase_in_CDS_length	X3f5
-inframe_variant	X3f6
-initiator_codon_change	X3f7
-inosine	X3f8
-insert	X3f9
-insert_AA	X3fa
-insert_AU	X3fb
-insert_C	X3fc
-insert_CU	X3fd
-insert_G	X3fe
-insert_GC	X3ff
-insert_GU	X400
-insert_U	X401
-insert_dinucleotide	X402
-insertion	X403
-insertion_attribute	X404
-insertion_breakpoint	X405
-insertion_sequence	X406
-insertion_site	X407
-insertional	X408
-insertional_duplication	X409
-inside_intron	X40a
-inside_intron_antiparallel	X40b
-inside_intron_parallel	X40c
-insulator	X40d
-insulator_binding_site	X40e
-integral_part_of	X40f
-integrase_coding_region	X410
-integrated_mobile_genetic_element	X411
-integrated_plasmid	X412
-integration_excision_site	X413
-integron	X414
-intein	X415
-intein_containing	X416
-interband	X417
-interchromosomal	X418
-interchromosomal_duplication	X419
-interchromosomal_mutation	X41a
-interchromosomal_transposition	X41b
-intergenic_region	X41c
-intergenic_variant	X41d
-interior_coding_exon	X41e
-interior_exon	X41f
-interior_intron	X420
-intermediate	X421
-intermediate_element	X422
-internal_Shine_Dalgarno_sequence	X423
-internal_UTR	X424
-internal_eliminated_sequence	X425
-internal_guide_sequence	X426
-internal_ribosome_entry_site	X427
-internal_transcribed_spacer_region	X428
-intrachromosomal	X429
-intrachromosomal_duplication	X42a
-intrachromosomal_mutation	X42b
-intrachromosomal_transposition	X42c
-intramembrane_polypeptide_region	X42d
-intrinsically_unstructured_polypeptide_region	X42e
-introgressed_chromosome_region	X42f
-intron_attribute	X430
-intron_domain	X431
-intron_gain	X432
-intron_variant	X433
-intronic_regulatory_region	X434
-intronic_splice_enhancer	X435
-invalidated	X436
-invalidated_by_chimeric_cDNA	X437
-invalidated_by_genomic_contamination	X438
-invalidated_by_genomic_polyA_primed_cDNA	X439
-invalidated_by_partial_processing	X43a
-invalidated_cDNA_clone	X43b
-inversion	X43c
-inversion_attribute	X43d
-inversion_breakpoint	X43e
-inversion_cum_translocation	X43f
-inversion_derived_aneuploid_chromosome	X440
-inversion_derived_bipartite_deficiency	X441
-inversion_derived_bipartite_duplication	X442
-inversion_derived_deficiency_plus_aneuploid	X443
-inversion_derived_deficiency_plus_duplication	X444
-inversion_derived_duplication_plus_aneuploid	X445
-inversion_site	X446
-inversion_site_part	X447
-invert	X448
-inverted	X449
-inverted_insertional_duplication	X44a
-inverted_interchromosomal_transposition	X44b
-inverted_intrachromosomal_transposition	X44c
-inverted_repeat	X44d
-inverted_ring_chromosome	X44e
-inverted_tandem_duplication	X44f
-iron_repressed_GATA_element	X450
-iron_responsive_element	X451
-is_consecutive_sequence_of	X452
-isoleucine	X453
-isoleucine_tRNA_primary_transcript	X454
-isoleucyl_tRNA	X455
-isowyosine	X456
-junction	X457
-kinetoplast	X458
-kinetoplast_gene	X459
-kozak_sequence	X45a
-laevosynaptic_chromosome	X45b
-lambda_clone	X45c
-lambda_vector	X45d
-large_subunit_rRNA	X45e
-left_handed_peptide_helix	X45f
-lethal_variant	X460
-leucine	X461
-leucine_tRNA_primary_transcript	X462
-leucoplast_chromosome	X463
-leucoplast_gene	X464
-leucoplast_sequence	X465
-leucyl_tRNA	X466
-level_of_transcript_variant	X467
-ligand_binding_site	X468
-ligation_based_read	X469
-lincRNA	X46a
-lincRNA_gene	X46b
-linear	X46c
-linear_double_stranded_DNA_chromosome	X46d
-linear_double_stranded_RNA_chromosome	X46e
-linear_single_stranded_DNA_chromosome	X46f
-linear_single_stranded_RNA_chromosome	X470
-linkage_group	X471
-lipoprotein_signal_peptide	X472
-locus_control_region	X473
-loss_of_heterozygosity	X474
-lost	X475
-low_complexity	X476
-low_complexity_region	X477
-loxP_site	X478
-lysidine	X479
-lysine	X47a
-lysine_tRNA_primary_transcript	X47b
-lysosomal_localization_signal	X47c
-lysyl_tRNA	X47d
-mRNA_attribute	X47e
-mRNA_by_polyadenylation_status	X47f
-mRNA_contig	X480
-mRNA_not_polyadenylated	X481
-mRNA_read	X482
-mRNA_recoded_by_codon_redefinition	X483
-mRNA_recoded_by_translational_bypass	X484
-mRNA_region	X485
-mRNA_with_frameshift	X486
-mRNA_with_minus_1_frameshift	X487
-mRNA_with_minus_2_frameshift	X488
-mRNA_with_plus_1_frameshift	X489
-mRNA_with_plus_2_frameshift	X48a
-macronuclear_chromosome	X48b
-macronuclear_sequence	X48c
-macronucleus_destined_segment	X48d
-major_TSS	X48e
-mannosyl_queuosine	X48f
-match	X490
-match_part	X491
-match_set	X492
-maternal_uniparental_disomy	X493
-maternal_variant	X494
-maternally_imprinted	X495
-maternally_imprinted_gene	X496
-mathematically_defined_repeat	X497
-mating_type_M_box	X498
-mating_type_region	X499
-matrix_attachment_site	X49a
-mature_miRNA_variant	X49b
-mature_protein_region	X49c
-mature_transcript	X49d
-mature_transcript_region	X49e
-maxicircle	X49f
-maxicircle_gene	X4a0
-maximally_overlaps	X4a1
-member_of	X4a2
-member_of_regulon	X4a3
-membrane_peptide_loop	X4a4
-membrane_structure	X4a5
-metabolic_island	X4a6
-metal_binding_site	X4a7
-methionine	X4a8
-methionine_tRNA_primary_transcript	X4a9
-methionyl_tRNA	X4aa
-methylated_A	X4ab
-methylated_C	X4ac
-methylated_base_feature	X4ad
-methylation_guide_snoRNA	X4ae
-methylation_guide_snoRNA_primary_transcript	X4af
-methylinosine	X4b0
-methylwyosine	X4b1
-miRNA	X4b2
-miRNA_antiguide	X4b3
-miRNA_encoding	X4b4
-miRNA_gene	X4b5
-miRNA_loop	X4b6
-miRNA_primary_transcript	X4b7
-miRNA_primary_transcript_region	X4b8
-miRNA_stem	X4b9
-miRNA_target_site	X4ba
-microarray_oligo	X4bb
-micronuclear_chromosome	X4bc
-micronuclear_sequence	X4bd
-microsatellite	X4be
-mini_exon_donor_RNA	X4bf
-mini_gene	X4c0
-minicircle	X4c1
-minicircle_gene	X4c2
-minisatellite	X4c3
-minor_TSS	X4c4
-minus_12_signal	X4c5
-minus_1_frameshift	X4c6
-minus_1_frameshift_variant	X4c7
-minus_1_translationally_frameshifted	X4c8
-minus_24_signal	X4c9
-minus_2_frameshift	X4ca
-minus_2_frameshift_variant	X4cb
-mirtron	X4cc
-missense_codon	X4cd
-mitochondrial_DNA	X4ce
-mitochondrial_chromosome	X4cf
-mitochondrial_sequence	X4d0
-mitochondrial_targeting_signal	X4d1
-mobile	X4d2
-mobile_element_insertion	X4d3
-mobile_genetic_element	X4d4
-mobile_intron	X4d5
-modified_L_alanine	X4d6
-modified_L_arginine	X4d7
-modified_L_asparagine	X4d8
-modified_L_aspartic_acid	X4d9
-modified_L_cysteine	X4da
-modified_L_glutamic_acid	X4db
-modified_L_glutamine	X4dc
-modified_L_histidine	X4dd
-modified_L_isoleucine	X4de
-modified_L_leucine	X4df
-modified_L_lysine	X4e0
-modified_L_methionine	X4e1
-modified_L_phenylalanine	X4e2
-modified_L_proline	X4e3
-modified_L_selenocysteine	X4e4
-modified_L_serine	X4e5
-modified_L_threonine	X4e6
-modified_L_tryptophan	X4e7
-modified_L_tyrosine	X4e8
-modified_L_valine	X4e9
-modified_RNA_base_feature	X4ea
-modified_adenosine	X4eb
-modified_amino_acid_feature	X4ec
-modified_base	X4ed
-modified_cytidine	X4ee
-modified_glycine	X4ef
-modified_guanosine	X4f0
-modified_inosine	X4f1
-modified_uridine	X4f2
-molecular_contact_region	X4f3
-monocistronic	X4f4
-monocistronic_mRNA	X4f5
-monocistronic_primary_transcript	X4f6
-monocistronic_transcript	X4f7
-morpholino_backbone	X4f8
-morpholino_oligo	X4f9
-mt_gene	X4fa
-mutated_variant_site	X4fb
-mutation_causing_inframe_polypeptide_N_terminal_elongation	X4fc
-mutation_causing_out_of_frame_polypeptide_C_terminal_elongation	X4fd
-mutation_causing_out_of_frame_polypeptide_N_terminal_elongation	X4fe
-mutation_causing_polypeptide_C_terminal_elongation	X4ff
-mutation_causing_polypeptide_N_terminal_elongation	X500
-mutaton_causing_inframe_polypeptide_C_terminal_elongation	X501
-n_terminal_region	X502
-natural	X503
-natural_plasmid	X504
-natural_transposable_element	X505
-natural_variant_site	X506
-ncRNA_gene	X507
-nc_conserved_region	X508
-nc_primary_transcript	X509
-nc_transcript_variant	X50a
-negative_sense_ssRNA_viral_sequence	X50b
-negatively_autoregulated	X50c
-negatively_autoregulated_gene	X50d
-nested_region	X50e
-nested_repeat	X50f
-nested_tandem_repeat	X510
-nested_transposon	X511
-no_output	X512
-non_LTR_retrotransposon	X513
-non_LTR_retrotransposon_polymeric_tract	X514
-non_adjacent_residues	X515
-non_canonical_five_prime_splice_site	X516
-non_canonical_splice_site	X517
-non_canonical_start_codon	X518
-non_canonical_three_prime_splice_site	X519
-non_capped_primary_transcript	X51a
-non_coding_exon_variant	X51b
-non_conservative_amino_acid_substitution	X51c
-non_conservative_missense_codon	X51d
-non_covalent_binding_site	X51e
-non_cytoplasmic_polypeptide_region	X51f
-non_functional_homolog_of	X520
-non_processed_pseudogene	X521
-non_protein_coding	X522
-non_synonymous	X523
-non_synonymous_codon	X524
-non_synonymous_variant	X525
-non_terminal_residue	X526
-non_transcribed_region	X527
-nonamer_of_recombination_feature_of_vertebrate_immune_system_gene	X528
-noncoding_exon	X529
-noncoding_region_of_exon	X52a
-noncontiguous_finished	X52b
-novel_sequence_insertion	X52c
-nuclear_chromosome	X52d
-nuclear_export_signal	X52e
-nuclear_gene	X52f
-nuclear_localization_signal	X530
-nuclear_mitochondrial	X531
-nuclear_mt_pseudogene	X532
-nuclear_rim_localization_signal	X533
-nuclear_sequence	X534
-nuclease_binding_site	X535
-nuclease_hypersensitive_site	X536
-nuclease_sensitive_site	X537
-nucleic_acid	X538
-nucleomorph_gene	X539
-nucleomorphic_chromosome	X53a
-nucleomorphic_sequence	X53b
-nucleotide_binding_site	X53c
-nucleotide_match	X53d
-nucleotide_motif	X53e
-nucleotide_to_protein_binding_site	X53f
-octamer_motif	X540
-oligo	X541
-oligo_U_tail	X542
-one_methyl_three_three_amino_three_carboxypropyl_pseudouridine	X543
-one_methyladenosine	X544
-one_methylguanosine	X545
-one_methylinosine	X546
-one_methylpseudouridine	X547
-one_two_prime_O_dimethyladenosine	X548
-one_two_prime_O_dimethylguanosine	X549
-one_two_prime_O_dimethylinosine	X54a
-open_chromatin_region	X54b
-operator	X54c
-operon_member	X54d
-organelle_sequence	X54e
-oriC	X54f
-oriT	X550
-oriV	X551
-origin_of_replication	X552
-orphan	X553
-orphan_CDS	X554
-orthologous	X555
-orthologous_region	X556
-orthologous_to	X557
-outron	X558
-overlapping	X559
-overlapping_EST_set	X55a
-overlapping_feature_set	X55b
-overlaps	X55c
-p_element	X55d
-paired_end_fragment	X55e
-paracentric	X55f
-paracentric_inversion	X560
-parallel_beta_strand	X561
-paralogous	X562
-paralogous_region	X563
-paralogous_to	X564
-part_of	X565
-partial_evidence_for_feature	X566
-partially_characterised_chromosomal_mutation	X567
-partially_processed_cDNA_clone	X568
-paternal_uniparental_disomy	X569
-paternal_variant	X56a
-paternally_imprinted	X56b
-paternally_imprinted_gene	X56c
-pathogenic_island	X56d
-pedigree_specific_variant	X56e
-peptide_coil	X56f
-peptide_collection	X570
-peptide_helix	X571
-peptide_localization_signal	X572
-peptidyl	X573
-pericentric	X574
-pericentric_inversion	X575
-peroxywybutosine	X576
-phage_sequence	X577
-phagemid	X578
-phagemid_clone	X579
-phenylalanine	X57a
-phenylalanine_tRNA_primary_transcript	X57b
-phenylalanyl_tRNA	X57c
-phosphorylation_site	X57d
-piRNA	X57e
-piRNA_gene	X57f
-pi_helix	X580
-plasmid	X581
-plasmid_clone	X582
-plasmid_gene	X583
-plasmid_location	X584
-plasmid_vector	X585
-plastid_gene	X586
-plastid_sequence	X587
-plus_1_frameshift	X588
-plus_1_frameshift_variant	X589
-plus_1_translational_frameshift	X58a
-plus_1_translationally_frameshifted	X58b
-plus_2_framshift	X58c
-plus_2_translational_frameshift	X58d
-point_centromere	X58e
-point_mutation	X58f
-polinton	X590
-polyA_primed_cDNA_clone	X591
-polyA_sequence	X592
-polyadenylated	X593
-polyadenylated_mRNA	X594
-polyadenylation_variant	X595
-polycistronic	X596
-polycistronic_gene	X597
-polycistronic_mRNA	X598
-polycistronic_primary_transcript	X599
-polycistronic_transcript	X59a
-polymer_attribute	X59b
-polymerase_synthesis_read	X59c
-polymorphic_pseudogene	X59d
-polymorphic_sequence_variant	X59e
-polymorphic_variant	X59f
-polypeptide	X5a0
-polypeptide_DNA_contact	X5a1
-polypeptide_binding_motif	X5a2
-polypeptide_calcium_ion_contact_site	X5a3
-polypeptide_catalytic_motif	X5a4
-polypeptide_cobalt_ion_contact_site	X5a5
-polypeptide_conserved_motif	X5a6
-polypeptide_conserved_region	X5a7
-polypeptide_copper_ion_contact_site	X5a8
-polypeptide_domain	X5a9
-polypeptide_function_variant	X5aa
-polypeptide_fusion	X5ab
-polypeptide_gain_of_function_variant	X5ac
-polypeptide_iron_ion_contact_site	X5ad
-polypeptide_ligand_contact	X5ae
-polypeptide_localization_variant	X5af
-polypeptide_loss_of_function_variant	X5b0
-polypeptide_magnesium_ion_contact_site	X5b1
-polypeptide_manganese_ion_contact_site	X5b2
-polypeptide_metal_contact	X5b3
-polypeptide_molybdenum_ion_contact_site	X5b4
-polypeptide_motif	X5b5
-polypeptide_nest_left_right_motif	X5b6
-polypeptide_nest_motif	X5b7
-polypeptide_nest_right_left_motif	X5b8
-polypeptide_nickel_ion_contact_site	X5b9
-polypeptide_partial_loss_of_function	X5ba
-polypeptide_post_translational_processing_affected	X5bb
-polypeptide_post_translational_processing_variant	X5bc
-polypeptide_region	X5bd
-polypeptide_repeat	X5be
-polypeptide_secondary_structure	X5bf
-polypeptide_sequence_variant	X5c0
-polypeptide_sequencing_information	X5c1
-polypeptide_structural_motif	X5c2
-polypeptide_structural_region	X5c3
-polypeptide_truncation	X5c4
-polypeptide_tungsten_ion_contact_site	X5c5
-polypeptide_turn_motif	X5c6
-polypeptide_variation_site	X5c7
-polypeptide_zinc_ion_contact_site	X5c8
-polyploid	X5c9
-polypyrimidine_tract	X5ca
-population_specific_variant	X5cb
-position_of	X5cc
-positive_sense_ssRNA_viral_sequence	X5cd
-positively_autoregulated	X5ce
-positively_autoregulated_gene	X5cf
-possible_assembly_error	X5d0
-possible_base_call_error	X5d1
-post_translationally_modified_region	X5d2
-post_translationally_regulated	X5d3
-post_translationally_regulated_by_protein_modification	X5d4
-post_translationally_regulated_by_protein_stability	X5d5
-post_translationally_regulated_gene	X5d6
-pre_edited_mRNA	X5d7
-pre_edited_region	X5d8
-pre_miRNA	X5d9
-predicted	X5da
-predicted_ab_initio_computation	X5db
-predicted_by_ab_initio_computation	X5dc
-predicted_gene	X5dd
-primary_transcript_attribute	X5de
-primary_transcript_region	X5df
-primer	X5e0
-primer_match	X5e1
-probe	X5e2
-processed	X5e3
-processed_from	X5e4
-processed_into	X5e5
-processed_pseudogene	X5e6
-processed_transcript_attribute	X5e7
-proline	X5e8
-proline_tRNA_primary_transcript	X5e9
-prolyl_tRNA	X5ea
-promoter_element	X5eb
-promoter_region	X5ec
-promoter_targeting_sequence	X5ed
-promoter_trap_construct	X5ee
-propeptide	X5ef
-propeptide_cleavage_site	X5f0
-prophage	X5f1
-proplastid_gene	X5f2
-proplastid_sequence	X5f3
-protein_coding	X5f4
-protein_coding_gene	X5f5
-protein_coding_primary_transcript	X5f6
-protein_hmm_match	X5f7
-protein_match	X5f8
-protein_protein_contact	X5f9
-proviral_gene	X5fa
-proviral_location	X5fb
-proviral_region	X5fc
-proximal_promoter_element	X5fd
-pseudogene_attribute	X5fe
-pseudogene_by_unequal_crossing_over	X5ff
-pseudogenic_gene_segment	X600
-pseudogenic_rRNA	X601
-pseudogenic_tRNA	X602
-pseudogenic_transcript	X603
-pseudoknot	X604
-pseudouridine	X605
-pseudouridylation_guide_snoRNA	X606
-purine_to_pyrimidine_transversion	X607
-purine_transition	X608
-pyrimidine_to_purine_transversion	X609
-pyrimidine_transition	X60a
-pyrosequenced_read	X60b
-pyrrolysine	X60c
-pyrrolysine_tRNA_primary_transcript	X60d
-pyrrolysyl_tRNA	X60e
-quality_value	X60f
-quantitative_variant	X610
-queuosine	X611
-rDNA_intergenic_spacer_element	X612
-rRNA_16S	X613
-rRNA_18S	X614
-rRNA_21S	X615
-rRNA_23S	X616
-rRNA_25S	X617
-rRNA_28S	X618
-rRNA_5S	X619
-rRNA_5_8S	X61a
-rRNA_cleavage_RNA	X61b
-rRNA_cleavage_snoRNA_primary_transcript	X61c
-rRNA_encoding	X61d
-rRNA_gene	X61e
-rRNA_large_subunit_primary_transcript	X61f
-rRNA_primary_transcript	X620
-rRNA_primary_transcript_region	X621
-rRNA_small_subunit_primary_transcript	X622
-random_sequence	X623
-rare_variant	X624
-rasiRNA	X625
-rate_of_transcription_variant	X626
-read	X627
-read_pair	X628
-reading_frame	X629
-reagent	X62a
-reagent_attribute	X62b
-rearranged_at_DNA_level	X62c
-reciprocal	X62d
-reciprocal_chromosomal_translocation	X62e
-recoded	X62f
-recoded_by_translational_bypass	X630
-recoded_codon	X631
-recoded_mRNA	X632
-recoding_pseudoknot	X633
-recoding_stimulatory_region	X634
-recombination_feature_of_rearranged_gene	X635
-recombination_hotspot	X636
-recombination_regulatory_region	X637
-recombination_signal_sequence	X638
-recombinationally_inverted_gene	X639
-recombinationally_rearranged	X63a
-recombinationally_rearranged_gene	X63b
-recombinationally_rearranged_vertebrate_immune_system_gene	X63c
-recombined_from	X63d
-recombined_to	X63e
-recursive_splice_site	X63f
-reference_genome	X640
-regional_centromere	X641
-regional_centromere_central_core	X642
-regional_centromere_inner_repeat_region	X643
-regional_centromere_outer_repeat_region	X644
-regulated	X645
-regulatory_promoter_element	X646
-regulatory_region_variant	X647
-regulon	X648
-repeat_component	X649
-repeat_family	X64a
-repeat_fragment	X64b
-repetitive_element	X64c
-replication_regulatory_region	X64d
-replicon	X64e
-rescue	X64f
-rescue_gene	X650
-rescue_mini_gene	X651
-rescue_region	X652
-resolution_site	X653
-restriction_enzyme_binding_site	X654
-restriction_enzyme_cleavage_junction	X655
-restriction_enzyme_cut_site	X656
-restriction_enzyme_recognition_site	X657
-restriction_enzyme_single_strand_overhang	X658
-restriction_fragment	X659
-retinoic_acid_responsive_element	X65a
-retrogene	X65b
-retron	X65c
-retrotransposed	X65d
-retrotransposon	X65e
-reverse	X65f
-reverse_Hoogsteen_base_pair	X660
-reverse_primer	X661
-rho_dependent_bacterial_terminator	X662
-rho_independent_bacterial_terminator	X663
-riboswitch	X664
-ribothymidine	X665
-ribozyme	X666
-ribozymic	X667
-right_handed_peptide_helix	X668
-ring_chromosome	X669
-rolling_circle	X66a
-sarcin_like_RNA_motif	X66b
-scRNA_encoding	X66c
-scRNA_gene	X66d
-scRNA_primary_transcript	X66e
-schellmann_loop	X66f
-schellmann_loop_seven	X670
-schellmann_loop_six	X671
-score	X672
-selenocysteine	X673
-selenocysteine_tRNA_primary_transcript	X674
-selenocysteinyl_tRNA	X675
-sequence_alteration	X676
-sequence_assembly	X677
-sequence_attribute	X678
-sequence_collection	X679
-sequence_feature	X67a
-sequence_feature_locating_method	X67b
-sequence_length_variation	X67c
-sequence_location	X67d
-sequence_motif	X67e
-sequence_of	X67f
-sequence_operation	X680
-sequence_rearrangement_feature	X681
-sequence_replication_mode	X682
-sequence_variant_affecting_3D_structure_of_polypeptide	X683
-sequence_variant_affecting_copy_number	X684
-sequence_variant_affecting_editing	X685
-sequence_variant_affecting_gene_structure	X686
-sequence_variant_affecting_level_of_translational_product	X687
-sequence_variant_affecting_polyadenylation	X688
-sequence_variant_affecting_polypeptide_amino_acid_sequence	X689
-sequence_variant_affecting_polypeptide_function	X68a
-sequence_variant_affecting_rate_of_transcription	X68b
-sequence_variant_affecting_regulatory_region	X68c
-sequence_variant_affecting_splice_acceptor	X68d
-sequence_variant_affecting_splice_donor	X68e
-sequence_variant_affecting_splicing	X68f
-sequence_variant_affecting_transcript_processing	X690
-sequence_variant_affecting_transcript_secondary_structure	X691
-sequence_variant_affecting_transcription	X692
-sequence_variant_affecting_translational_product	X693
-sequence_variant_causes_exon_loss	X694
-sequence_variant_causes_intron_gain	X695
-sequence_variant_causing_amino_acid_coding_codon_change_in_transcript	X696
-sequence_variant_causing_amino_acid_deletion	X697
-sequence_variant_causing_amino_acid_insertion	X698
-sequence_variant_causing_amino_acid_substitution	X699
-sequence_variant_causing_compensatory_transcript_secondary_structure_mutation	X69a
-sequence_variant_causing_complex_3D_structural_change	X69b
-sequence_variant_causing_complex_change_of_translational_product	X69c
-sequence_variant_causing_conformational_change	X69d
-sequence_variant_causing_conservative_amino_acid_substitution	X69e
-sequence_variant_causing_conservative_missense_codon_change_in_transcript	X69f
-sequence_variant_causing_cryptic_splice_acceptor_activation	X6a0
-sequence_variant_causing_cryptic_splice_activation	X6a1
-sequence_variant_causing_cryptic_splice_donor_activation	X6a2
-sequence_variant_causing_gain_of_function_of_polypeptide	X6a3
-sequence_variant_causing_gene_fusion	X6a4
-sequence_variant_causing_inactive_catalytic_site	X6a5
-sequence_variant_causing_inactive_ligand_binding_site	X6a6
-sequence_variant_causing_initiator_codon_change_in_transcript	X6a7
-sequence_variant_causing_loss_of_function_of_polypeptide	X6a8
-sequence_variant_causing_minus_1_frameshift	X6a9
-sequence_variant_causing_minus_2_frameshift	X6aa
-sequence_variant_causing_missense_codon_change_in_transcript	X6ab
-sequence_variant_causing_no_3D_structural_change	X6ac
-sequence_variant_causing_no_change_in_transcript	X6ad
-sequence_variant_causing_no_change_of_translational_product	X6ae
-sequence_variant_causing_non_synonymous_codon_change_in_transcript	X6af
-sequence_variant_causing_nonconservative_amino_acid_substitution	X6b0
-sequence_variant_causing_nonconservative_missense_codon_change_in_transcript	X6b1
-sequence_variant_causing_nonsense_codon_change_in_transcript	X6b2
-sequence_variant_causing_partial_loss_of_function_of_polypeptide	X6b3
-sequence_variant_causing_plus_1_frameshift_mutation	X6b4
-sequence_variant_causing_plus_2_frameshift	X6b5
-sequence_variant_causing_polypeptide_elongation	X6b6
-sequence_variant_causing_polypeptide_fusion	X6b7
-sequence_variant_causing_polypeptide_localization_change	X6b8
-sequence_variant_causing_polypeptide_post_translational_processing_change	X6b9
-sequence_variant_causing_polypeptide_truncation	X6ba
-sequence_variant_causing_synonymous_codon_change_in_transcript	X6bb
-sequence_variant_causing_terminator_codon_change_in_transcript	X6bc
-sequence_variant_decreasing_level_of_translation_product	X6bd
-sequence_variant_decreasing_rate_of_transcription	X6be
-sequence_variant_decreasing_transcript_stability	X6bf
-sequence_variant_effect	X6c0
-sequence_variant_increasing_level_of_translation_product	X6c1
-sequence_variant_increasing_rate_of_transcription	X6c2
-sequence_variant_increasing_transcript_stability	X6c3
-sequence_variant_obs	X6c4
-sequence_variation_affecting_coding_sequence	X6c5
-sequence_variation_affecting_level_of_transcript	X6c6
-sequence_variation_affecting_reading_frame	X6c7
-sequence_variation_affecting_transcript	X6c8
-sequence_variation_affecting_transcript_sequence	X6c9
-sequence_variation_decreasing_level_of_transcript	X6ca
-sequence_variation_increasing_level_of_transcript	X6cb
-sequencing_primer	X6cc
-serine	X6cd
-serine_tRNA_primary_transcript	X6ce
-serine_threonine_motif	X6cf
-serine_threonine_staple_motif	X6d0
-serine_threonine_turn	X6d1
-seryl_tRNA	X6d2
-seven_aminomethyl_seven_deazaguanosine	X6d3
-seven_cyano_seven_deazaguanosine	X6d4
-seven_deazaguanosine	X6d5
-seven_methylguanine	X6d6
-seven_methylguanosine	X6d7
-shadow_enhancer	X6d8
-siRNA	X6d9
-signal_anchor	X6da
-silenced	X6db
-silenced_by_DNA_methylation	X6dc
-silenced_by_DNA_modification	X6dd
-silenced_by_RNA_interference	X6de
-silenced_by_histone_deacetylation	X6df
-silenced_by_histone_methylation	X6e0
-silenced_by_histone_modification	X6e1
-silenced_gene	X6e2
-silencer	X6e3
-silent_mutation	X6e4
-similar_to	X6e5
-simple_sequence_length_variation	X6e6
-single	X6e7
-single_strand_restriction_enzyme_cleavage_site	X6e8
-single_stranded_DNA_chromosome	X6e9
-single_stranded_RNA_chromosome	X6ea
-single_stranded_cDNA	X6eb
-site	X6ec
-site_specific_recombination_target_region	X6ed
-six_cutter_restriction_site	X6ee
-smFISH_probe	X6ef
-small_regulatory_ncRNA	X6f0
-small_subunit_rRNA	X6f1
-snRNA_encoding	X6f2
-snRNA_gene	X6f3
-snRNA_primary_transcript	X6f4
-snoRNA_encoding	X6f5
-snoRNA_gene	X6f6
-snoRNA_primary_transcript	X6f7
-solo_LTR	X6f8
-somatic_variant	X6f9
-sonicate_fragment	X6fa
-specific_recombination_site	X6fb
-splice_acceptor_variant	X6fc
-splice_donor_5th_base_variant	X6fd
-splice_donor_variant	X6fe
-splice_enhancer	X6ff
-splice_junction	X700
-splice_region_variant	X701
-splice_site	X702
-splice_site_variant	X703
-spliced_leader_RNA	X704
-spliceosomal_intron	X705
-spliceosomal_intron_region	X706
-splicing_feature	X707
-splicing_regulatory_region	X708
-splicing_variant	X709
-spot_42_RNA	X70a
-ss_RNA_viral_sequence	X70b
-ss_oligo	X70c
-stRNA	X70d
-stRNA_encoding	X70e
-stRNA_gene	X70f
-stRNA_primary_transcript	X710
-st_turn_left_handed_type_one	X711
-st_turn_left_handed_type_two	X712
-st_turn_right_handed_type_one	X713
-st_turn_right_handed_type_two	X714
-standard_draft	X715
-start_codon	X716
-started_by	X717
-starts	X718
-status	X719
-status_of_coding_sequence	X71a
-sterol_regulatory_element	X71b
-sticky_end_restriction_enzyme_cleavage_site	X71c
-stop_codon	X71d
-stop_codon_read_through	X71e
-stop_codon_readthrough	X71f
-stop_codon_redefined_as_pyrrolysine	X720
-stop_codon_redefined_as_selenocysteine	X721
-stop_codon_redefinition_as_pyrrolysine	X722
-stop_codon_redefinition_as_selenocysteine	X723
-stop_codon_signal	X724
-stop_gained	X725
-stop_lost	X726
-stop_retained_variant	X727
-strand_attribute	X728
-structural_alteration	X729
-structural_variant	X72a
-substitute	X72b
-substitute_A_to_I	X72c
-substitute_C_to_U	X72d
-substitution	X72e
-sugar_edge_base_pair	X72f
-supercontig	X730
-supported_by_EST_or_cDNA	X731
-supported_by_domain_match	X732
-supported_by_sequence_similarity	X733
-symbiosis_island	X734
-symmetric_RNA_internal_loop	X735
-synonymous	X736
-synonymous_codon	X737
-synonymous_variant	X738
-syntenic	X739
-syntenic_region	X73a
-synthetic_oligo	X73b
-synthetic_sequence	X73c
-tRNA_encoding	X73d
-tRNA_gene	X73e
-tRNA_intron	X73f
-tRNA_primary_transcript	X740
-tRNA_region	X741
-tag	X742
-tandem	X743
-tandem_duplication	X744
-tandem_repeat	X745
-target_site_duplication	X746
-targeting_vector	X747
-tasiRNA	X748
-tasiRNA_primary_transcript	X749
-telomerase_RNA	X74a
-telomerase_RNA_gene	X74b
-telomere	X74c
-telomeric_repeat	X74d
-template_region	X74e
-terminal_codon_variant	X74f
-terminal_inverted_repeat	X750
-terminal_inverted_repeat_element	X751
-terminator_codon_variant	X752
-terminator_of_type_2_RNApol_III_promoter	X753
-tetraloop	X754
-tetranucleotide_repeat_microsatellite_feature	X755
-theta_replication	X756
-three_methylcytidine	X757
-three_methylpseudouridine	X758
-three_methyluridine	X759
-three_prime_D_heptamer	X75a
-three_prime_D_nonamer	X75b
-three_prime_D_recombination_signal_sequence	X75c
-three_prime_D_spacer	X75d
-three_prime_EST	X75e
-three_prime_LTR	X75f
-three_prime_LTR_component	X760
-three_prime_RACE_clone	X761
-three_prime_RST	X762
-three_prime_UST	X763
-three_prime_UTR_intron	X764
-three_prime_cis_splice_site	X765
-three_prime_coding_exon	X766
-three_prime_coding_exon_coding_region	X767
-three_prime_coding_exon_noncoding_region	X768
-three_prime_five_prime_overlap	X769
-three_prime_flanking_region	X76a
-three_prime_intron	X76b
-three_prime_noncoding_exon	X76c
-three_prime_recoding_site	X76d
-three_prime_repeat_recoding_signal	X76e
-three_prime_restriction_enzyme_junction	X76f
-three_prime_stem_loop_structure	X770
-three_prime_terminal_inverted_repeat	X771
-three_prime_three_prime_overlap	X772
-three_ten_helix	X773
-three_three_amino_three_carboxypropyl_uridine	X774
-three_two_prime_O_dimethyluridine	X775
-threonine	X776
-threonine_tRNA_primary_transcript	X777
-threonyl_tRNA	X778
-tiling_path	X779
-tiling_path_clone	X77a
-tiling_path_fragment	X77b
-tmRNA_acceptor_piece	X77c
-tmRNA_coding_piece	X77d
-tmRNA_encoding	X77e
-tmRNA_gene	X77f
-tmRNA_primary_transcript	X780
-tmRNA_region	X781
-topologically_defined_region	X782
-topology_attribute	X783
-trans_splice_acceptor_site	X784
-trans_splice_donor_site	X785
-trans_splice_junction	X786
-trans_splice_site	X787
-trans_spliced	X788
-trans_spliced_from	X789
-trans_spliced_mRNA	X78a
-trans_spliced_to	X78b
-trans_spliced_transcript	X78c
-transcribed_cluster	X78d
-transcribed_fragment	X78e
-transcribed_from	X78f
-transcribed_region	X790
-transcribed_spacer_region	X791
-transcribed_to	X792
-transcript_attribute	X793
-transcript_bound_by_nucleic_acid	X794
-transcript_bound_by_protein	X795
-transcript_edited_by_U_insertion/deletion	X796
-transcript_feature	X797
-transcript_function_variant	X798
-transcript_processing_variant	X799
-transcript_region	X79a
-transcript_secondary_structure_variant	X79b
-transcript_sequence_variant	X79c
-transcript_stability_variant	X79d
-transcript_variant	X79e
-transcript_with_readthrough_stop_codon	X79f
-transcript_with_translational_frameshift	X7a0
-transcription_end_site	X7a1
-transcription_regulatory_region	X7a2
-transcription_variant	X7a3
-transcriptional_cis_regulatory_region	X7a4
-transcriptionally_constitutive	X7a5
-transcriptionally_induced	X7a6
-transcriptionally_regulated	X7a7
-transcriptionally_repressed	X7a8
-transgene	X7a9
-transgene_attribute	X7aa
-transgenic	X7ab
-transgenic_insertion	X7ac
-transgenic_transposable_element	X7ad
-transition	X7ae
-translated_nucleotide_match	X7af
-translates_to	X7b0
-translation_of	X7b1
-translation_regulatory_region	X7b2
-translational_frameshift	X7b3
-translational_product_function_variant	X7b4
-translational_product_level_variant	X7b5
-translational_product_structure_variant	X7b6
-translationally_frameshifted	X7b7
-translationally_regulated	X7b8
-translationally_regulated_gene	X7b9
-translocate	X7ba
-translocation	X7bb
-translocation_breakpoint	X7bc
-translocation_element	X7bd
-translocaton_attribute	X7be
-transmembrane_helix	X7bf
-transmembrane_polypeptide_region	X7c0
-transposable_element	X7c1
-transposable_element_attribute	X7c2
-transposable_element_flanking_region	X7c3
-transposable_element_gene	X7c4
-transposable_element_insertion_site	X7c5
-transposon_fragment	X7c6
-transversion	X7c7
-trinucleotide_repeat_microsatellite_feature	X7c8
-tryptophan	X7c9
-tryptophan_tRNA_primary_transcript	X7ca
-tryptophanyl_tRNA	X7cb
-twintron	X7cc
-two_methyladenosine	X7cd
-two_methylthio_N6_cis_hydroxyisopentenyl_adenosine	X7ce
-two_methylthio_N6_hydroxynorvalyl_carbamoyladenosine	X7cf
-two_methylthio_N6_isopentenyladenosine	X7d0
-two_methylthio_N6_methyladenosine	X7d1
-two_methylthio_N6_threonyl_carbamoyladenosine	X7d2
-two_prime_O_methyladenosine	X7d3
-two_prime_O_methylcytidine	X7d4
-two_prime_O_methylguanosine	X7d5
-two_prime_O_methylinosine	X7d6
-two_prime_O_methylpseudouridine	X7d7
-two_prime_O_methyluridine	X7d8
-two_prime_O_ribosyladenosine_phosphate	X7d9
-two_prime_O_ribosylguanosine_phosphate	X7da
-two_thio_two_prime_O_methyluridine	X7db
-two_thiocytidine	X7dc
-two_thiouridine	X7dd
-type_II_enzyme_restriction_site	X7de
-type_I_enzyme_restriction_site	X7df
-tyrosine	X7e0
-tyrosine_tRNA_primary_transcript	X7e1
-tyrosyl_tRNA	X7e2
-ultracontig	X7e3
-uncharacterised_chromosomal_mutation	X7e4
-undermodified_hydroxywybutosine	X7e5
-unedited_region	X7e6
-unequally_crossed_over	X7e7
-unigene_cluster	X7e8
-uninverted_insertional_duplication	X7e9
-uninverted_interchromosomal_transposition	X7ea
-uninverted_intrachromosomal_transposition	X7eb
-unique_variant	X7ec
-unitary_pseudogene	X7ed
-unoriented_insertional_duplication	X7ee
-unoriented_interchromosomal_transposition	X7ef
-unoriented_intrachromosomal_transposition	X7f0
-untranslated_region_polycistronic_mRNA	X7f1
-upstream_AUG_codon	X7f2
-upstream_gene_variant	X7f3
-uridine_five_oxyacetic_acid	X7f4
-uridine_five_oxyacetic_acid_methyl_ester	X7f5
-vacuolar_sorting_signal	X7f6
-validated	X7f7
-validated_cDNA_clone	X7f8
-valine	X7f9
-valine_tRNA_primary_transcript	X7fa
-valyl_tRNA	X7fb
-variant_collection	X7fc
-variant_frequency	X7fd
-variant_genome	X7fe
-variant_origin	X7ff
-variant_phenotype	X800
-variant_quality	X801
-vault_RNA	X802
-vector_replicon	X803
-vertebrate_immune_system_feature	X804
-vertebrate_immune_system_gene_recombination_feature	X805
-vertebrate_immune_system_gene_recombination_signal_feature	X806
-vertebrate_immune_system_gene_recombination_spacer	X807
-vertebrate_immunoglobulin_T_cell_receptor_gene_cluster	X808
-vertebrate_immunoglobulin_T_cell_receptor_rearranged_gene_cluster	X809
-vertebrate_immunoglobulin_T_cell_receptor_rearranged_segment	X80a
-vertebrate_immunoglobulin_T_cell_receptor_segment	X80b
-viral_sequence	X80c
-virtual_sequence	X80d
-whole_genome_sequence_status	X80e
-wild_type	X80f
-wild_type_rescue_gene	X810
-wobble_base_pair	X811
-wybutosine	X812
-wyosine	X813
diff --git a/src/knn_abi373/Makefile.am b/src/knn_abi373/Makefile.am
new file mode 100644
index 0000000..2cbbeb4
--- /dev/null
+++ b/src/knn_abi373/Makefile.am
@@ -0,0 +1,6 @@
+INCLUDES = -I$(top_srcdir)/src $(all_includes)
+
+noinst_LIBRARIES = libmiraKNN_abi373.a
+libmiraKNN_abi373_a_SOURCES= wrong.c under.c add.c over.c nplus.c missing.c ncall.c
+noinst_HEADERS= wrong.h under.h add.h over.h nplus.h missing.h ncall.h
+
diff --git a/src/errorhandling/Makefile.in b/src/knn_abi373/Makefile.in
similarity index 73%
copy from src/errorhandling/Makefile.in
copy to src/knn_abi373/Makefile.in
index 3074d7b..64b832e 100644
--- a/src/errorhandling/Makefile.in
+++ b/src/knn_abi373/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -35,18 +35,26 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
-subdir = src/errorhandling
+subdir = src/knn_abi373
 DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/ax_boost_base.m4 \
-	$(top_srcdir)/m4/ax_boost_filesystem.m4 \
-	$(top_srcdir)/m4/ax_boost_iostreams.m4 \
-	$(top_srcdir)/m4/ax_boost_regex.m4 \
-	$(top_srcdir)/m4/ax_boost_system.m4 \
-	$(top_srcdir)/m4/ax_boost_thread.m4 \
-	$(top_srcdir)/m4/ax_check_zlib.m4 \
-	$(top_srcdir)/m4/ax_lib_expat.m4 $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/config/m4/ax_boost_base.m4 \
+	$(top_srcdir)/config/m4/ax_boost_regex.m4 \
+	$(top_srcdir)/config/m4/ax_boost_thread.m4 \
+	$(top_srcdir)/config/m4/ax_check_zlib.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_std.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_stl.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_namespaces.m4 \
+	$(top_srcdir)/config/m4/ax_lib_expat.m4 \
+	$(top_srcdir)/config/m4/ax_with_perl.m4 \
+	$(top_srcdir)/config/m4/ax_with_prog.m4 \
+	$(top_srcdir)/config/m4/libtool.m4 \
+	$(top_srcdir)/config/m4/ltoptions.m4 \
+	$(top_srcdir)/config/m4/ltsugar.m4 \
+	$(top_srcdir)/config/m4/ltversion.m4 \
+	$(top_srcdir)/config/m4/lt~obsolete.m4 \
+	$(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -54,25 +62,27 @@ CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
 LIBRARIES = $(noinst_LIBRARIES)
 ARFLAGS = cru
-libmiraerrorhandling_a_AR = $(AR) $(ARFLAGS)
-libmiraerrorhandling_a_LIBADD =
-am_libmiraerrorhandling_a_OBJECTS = errorhandling.$(OBJEXT)
-libmiraerrorhandling_a_OBJECTS = $(am_libmiraerrorhandling_a_OBJECTS)
+libmiraKNN_abi373_a_AR = $(AR) $(ARFLAGS)
+libmiraKNN_abi373_a_LIBADD =
+am_libmiraKNN_abi373_a_OBJECTS = wrong.$(OBJEXT) under.$(OBJEXT) \
+	add.$(OBJEXT) over.$(OBJEXT) nplus.$(OBJEXT) missing.$(OBJEXT) \
+	ncall.$(OBJEXT)
+libmiraKNN_abi373_a_OBJECTS = $(am_libmiraKNN_abi373_a_OBJECTS)
 DEFAULT_INCLUDES = -I. at am__isrc@
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
 am__mv = mv -f
-CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
-	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
-LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
-	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
-CXXLD = $(CXX)
-CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
 	$(LDFLAGS) -o $@
-SOURCES = $(libmiraerrorhandling_a_SOURCES)
-DIST_SOURCES = $(libmiraerrorhandling_a_SOURCES)
+SOURCES = $(libmiraKNN_abi373_a_SOURCES)
+DIST_SOURCES = $(libmiraKNN_abi373_a_SOURCES)
 HEADERS = $(noinst_HEADERS)
 ETAGS = etags
 CTAGS = ctags
@@ -87,13 +97,9 @@ AWK = @AWK@
 BITPACKAGE = @BITPACKAGE@
 BLOODYDARWINSTATLIBDIRHACK = @BLOODYDARWINSTATLIBDIRHACK@
 BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
-BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@
-BOOST_IOSTREAMS_LIB = @BOOST_IOSTREAMS_LIB@
 BOOST_LDFLAGS = @BOOST_LDFLAGS@
 BOOST_REGEX_LIB = @BOOST_REGEX_LIB@
-BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@
 BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
-BUNDLETARGET = @BUNDLETARGET@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
@@ -106,7 +112,6 @@ CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -116,13 +121,11 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LDFLAGS = @EXPAT_LDFLAGS@
-EXPAT_LIBS = @EXPAT_LIBS@
 EXPAT_VERSION = @EXPAT_VERSION@
 FGREP = @FGREP@
 FLEX = @FLEX@
 FLEXPP = @FLEXPP@
 GREP = @GREP@
-HAVE_XXD = @HAVE_XXD@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -140,7 +143,6 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
 MIRASTATIC = @MIRASTATIC@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
@@ -157,17 +159,18 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
+SHORTMIRAAUDIENCE = @SHORTMIRAAUDIENCE@
 STRIP = @STRIP@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -201,6 +204,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -216,14 +220,14 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-AM_CPPFLAGS = -I$(top_srcdir)/src $(all_includes)
-noinst_LIBRARIES = libmiraerrorhandling.a
-libmiraerrorhandling_a_SOURCES = errorhandling.C
-noinst_HEADERS = errorhandling.H
+INCLUDES = -I$(top_srcdir)/src $(all_includes)
+noinst_LIBRARIES = libmiraKNN_abi373.a
+libmiraKNN_abi373_a_SOURCES = wrong.c under.c add.c over.c nplus.c missing.c ncall.c
+noinst_HEADERS = wrong.h under.h add.h over.h nplus.h missing.h ncall.h
 all: all-am
 
 .SUFFIXES:
-.SUFFIXES: .C .lo .o .obj
+.SUFFIXES: .c .lo .o .obj
 $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
@@ -233,9 +237,9 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/errorhandling/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/knn_abi373/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu src/errorhandling/Makefile
+	  $(AUTOMAKE) --gnu src/knn_abi373/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -257,10 +261,10 @@ $(am__aclocal_m4_deps):
 
 clean-noinstLIBRARIES:
 	-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
-libmiraerrorhandling.a: $(libmiraerrorhandling_a_OBJECTS) $(libmiraerrorhandling_a_DEPENDENCIES) $(EXTRA_libmiraerrorhandling_a_DEPENDENCIES) 
-	-rm -f libmiraerrorhandling.a
-	$(libmiraerrorhandling_a_AR) libmiraerrorhandling.a $(libmiraerrorhandling_a_OBJECTS) $(libmiraerrorhandling_a_LIBADD)
-	$(RANLIB) libmiraerrorhandling.a
+libmiraKNN_abi373.a: $(libmiraKNN_abi373_a_OBJECTS) $(libmiraKNN_abi373_a_DEPENDENCIES) 
+	-rm -f libmiraKNN_abi373.a
+	$(libmiraKNN_abi373_a_AR) libmiraKNN_abi373.a $(libmiraKNN_abi373_a_OBJECTS) $(libmiraKNN_abi373_a_LIBADD)
+	$(RANLIB) libmiraKNN_abi373.a
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -268,28 +272,34 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/errorhandling.Po at am__quote@
-
-.C.o:
- at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXXCOMPILE) -c -o $@ $<
-
-.C.obj:
- at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
-
-.C.lo:
- at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(LTCXXCOMPILE) -c -o $@ $<
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/missing.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ncall.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nplus.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/over.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/under.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/wrong.Po at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ at am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
 
 mostlyclean-libtool:
 	-rm -f *.lo
@@ -393,15 +403,10 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	if test -z '$(STRIP)'; then \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	      install; \
-	else \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-	fi
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
 mostlyclean-generic:
 
 clean-generic:
diff --git a/src/knn_abi373/add.c b/src/knn_abi373/add.c
new file mode 100644
index 0000000..282dd1f
--- /dev/null
+++ b/src/knn_abi373/add.c
@@ -0,0 +1,224 @@
+/*********************************************************
+  add.c
+  --------------------------------------------------------
+  generated at Tue Feb 22 14:20:39 2000
+  by snns2c ( Bernward Kett 1995 ) 
+*********************************************************/
+
+#include <math.h>
+
+#define Act_Logistic(sum, bias)  ( (sum+bias<10000.0) ? ( 1.0/(1.0 + exp(-sum-bias) ) ) : 0.0 )
+#define NULL (void *)0
+
+typedef struct UT {
+          float act;         /* Activation       */
+          float Bias;        /* Bias of the Unit */
+          int   NoOfSources; /* Number of predecessor units */
+   struct UT   **sources; /* predecessor units */
+          float *weights; /* weights from predecessor units */
+        } UnitType, *pUnit;
+
+  /* Forward Declaration for all unit types */
+  static UnitType Units[22];
+  /* Sources definition section */
+  static pUnit Sources[] =  {
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, 
+Units + 14, Units + 15, Units + 16, Units + 17, Units + 18, Units + 19, Units + 20, 
+
+  };
+
+  /* Weigths definition section */
+  static float Weights[] =  {
+-0.672380, -0.105020, -0.664100, 0.027140, -0.186750, -0.003710, 0.025020, 0.536790, -0.861780, 0.964860, 
+-0.687690, -0.895390, -0.675340, 
+4.974400, 0.945640, -2.006370, -0.005400, 1.085460, -0.200780, 3.171800, -2.240540, -0.498900, -0.803070, 
+0.160160, -2.488470, -0.579550, 
+-2.233090, -0.500910, -0.163610, -1.228330, 0.595270, 0.152740, -1.206640, 1.373060, 0.281470, 0.462890, 
+0.048750, 1.315130, 0.747070, 
+3.221040, -0.246640, -2.066770, -0.695040, -0.214200, -0.034200, 1.909330, -0.213160, -0.175820, 0.252840, 
+0.250910, -1.456660, -0.532660, 
+2.286180, -0.096540, -0.110770, 0.126850, 0.945610, 0.126490, 0.230370, 0.514270, -0.585760, -1.667200, 
+0.100310, -1.311160, -0.885550, 
+-1.270310, 0.314090, -0.631960, 0.540150, -0.131940, -0.197690, -1.637230, 2.394210, -0.514470, 1.214290, 
+0.282420, -0.621710, -0.729490, 
+-2.098290, 0.609410, 2.450490, -0.883100, -0.878350, 1.470870, -1.695120, -0.293530, -0.751880, -1.275710, 
+-0.965290, 1.689720, 2.344350, 
+0.513810, 7.012270, -3.013900, 4.056260, 2.679840, -2.671080, -4.449240, 
+
+  };
+
+  /* unit definition section (see also UnitType) */
+  static UnitType Units[22] = 
+  {
+    { 0.0, 0.0, 0, NULL , NULL },
+    { /* unit 1 (Old: 1) */
+      0.0, -0.489050, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 2 (Old: 2) */
+      0.0, 0.314600, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 3 (Old: 3) */
+      0.0, 0.777830, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 4 (Old: 4) */
+      0.0, 0.155320, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 5 (Old: 5) */
+      0.0, 0.837780, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 6 (Old: 6) */
+      0.0, -0.712880, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 7 (Old: 7) */
+      0.0, 0.002400, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 8 (Old: 8) */
+      0.0, 0.042370, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 9 (Old: 9) */
+      0.0, -0.381620, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 10 (Old: 10) */
+      0.0, -0.669190, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 11 (Old: 11) */
+      0.0, 0.074200, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 12 (Old: 12) */
+      0.0, -0.155280, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 13 (Old: 13) */
+      0.0, -0.067950, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 14 (Old: 14) */
+      0.0, 0.960020, 13,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 15 (Old: 15) */
+      0.0, 1.399300, 13,
+       &Sources[13] , 
+       &Weights[13] , 
+      },
+    { /* unit 16 (Old: 16) */
+      0.0, 0.098240, 13,
+       &Sources[26] , 
+       &Weights[26] , 
+      },
+    { /* unit 17 (Old: 17) */
+      0.0, 0.306210, 13,
+       &Sources[39] , 
+       &Weights[39] , 
+      },
+    { /* unit 18 (Old: 18) */
+      0.0, -0.115990, 13,
+       &Sources[52] , 
+       &Weights[52] , 
+      },
+    { /* unit 19 (Old: 19) */
+      0.0, 0.079310, 13,
+       &Sources[65] , 
+       &Weights[65] , 
+      },
+    { /* unit 20 (Old: 20) */
+      0.0, 0.642690, 13,
+       &Sources[78] , 
+       &Weights[78] , 
+      },
+    { /* unit 21 (Old: 21) */
+      0.0, -0.171910, 7,
+       &Sources[91] , 
+       &Weights[91] , 
+      }
+
+  };
+
+
+
+int add(float *in, float *out, int init)
+{
+  int member, source;
+  float sum;
+  enum{OK, Error, Not_Valid};
+  pUnit unit;
+
+
+  /* layer definition section (names & member units) */
+
+  static pUnit Input[13] = {Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, Units + 11, Units + 12, Units + 13}; /* members */
+
+  static pUnit Hidden1[7] = {Units + 14, Units + 15, Units + 16, Units + 17, Units + 18, Units + 19, Units + 20}; /* members */
+
+  static pUnit Output1[1] = {Units + 21}; /* members */
+
+  static int Output[1] = {21};
+
+  for(member = 0; member < 13; member++) {
+    Input[member]->act = in[member];
+  }
+
+  for (member = 0; member < 7; member++) {
+    unit = Hidden1[member];
+    sum = 0.0;
+    for (source = 0; source < unit->NoOfSources; source++) {
+      sum += unit->sources[source]->act
+             * unit->weights[source];
+    }
+    unit->act = Act_Logistic(sum, unit->Bias);
+  };
+
+  for (member = 0; member < 1; member++) {
+    unit = Output1[member];
+    sum = 0.0;
+    for (source = 0; source < unit->NoOfSources; source++) {
+      sum += unit->sources[source]->act
+             * unit->weights[source];
+    }
+    unit->act = Act_Logistic(sum, unit->Bias);
+  };
+
+  for(member = 0; member < 1; member++) {
+    out[member] = Units[Output[member]].act;
+  }
+
+  return(OK);
+}
diff --git a/src/knn_abi373/add.h b/src/knn_abi373/add.h
new file mode 100644
index 0000000..a0929f9
--- /dev/null
+++ b/src/knn_abi373/add.h
@@ -0,0 +1,14 @@
+/*********************************************************
+  add.h
+  --------------------------------------------------------
+  generated at Tue Feb 22 14:20:39 2000
+  by snns2c ( Bernward Kett 1995 ) 
+*********************************************************/
+
+extern int add(float *in, float *out, int init);
+
+static struct {
+  int NoOfInput;    /* Number of Input Units  */
+  int NoOfOutput;   /* Number of Output Units */
+  int(* propFunc)(float *, float*, int);
+} addREC = {13,1,add};
diff --git a/src/knn_abi373/missing.c b/src/knn_abi373/missing.c
new file mode 100644
index 0000000..afc357f
--- /dev/null
+++ b/src/knn_abi373/missing.c
@@ -0,0 +1,238 @@
+/*********************************************************
+  missing.c
+  --------------------------------------------------------
+  generated at Tue Feb 22 14:20:39 2000
+  by snns2c ( Bernward Kett 1995 ) 
+*********************************************************/
+
+#include <math.h>
+
+#define Act_Logistic(sum, bias)  ( (sum+bias<10000.0) ? ( 1.0/(1.0 + exp(-sum-bias) ) ) : 0.0 )
+#define NULL (void *)0
+
+typedef struct UT {
+          float act;         /* Activation       */
+          float Bias;        /* Bias of the Unit */
+          int   NoOfSources; /* Number of predecessor units */
+   struct UT   **sources; /* predecessor units */
+          float *weights; /* weights from predecessor units */
+        } UnitType, *pUnit;
+
+  /* Forward Declaration for all unit types */
+  static UnitType Units[24];
+  /* Sources definition section */
+  static pUnit Sources[] =  {
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, Units + 14, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, Units + 14, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, Units + 14, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, Units + 14, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, Units + 14, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, Units + 14, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, Units + 14, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, Units + 14, 
+Units + 15, Units + 16, Units + 17, Units + 18, Units + 19, Units + 20, Units + 21, Units + 22, 
+
+  };
+
+  /* Weigths definition section */
+  static float Weights[] =  {
+-0.879130, -0.178880, 0.202790, 0.053380, 0.399030, 0.820630, 0.827890, -0.949970, -0.189170, -1.172030, 
+-0.474610, 0.573670, -0.085110, 1.781750, 
+0.706790, -0.645120, 0.895300, 0.418910, 0.455110, -0.674400, -0.908570, 0.849720, -0.218110, -0.064390, 
+0.445130, 0.340180, -0.196660, -0.358650, 
+-2.539240, 1.638450, -0.254560, -0.333820, 0.991600, 0.337970, 0.944570, 1.358890, 1.423090, -0.048890, 
+0.260500, 2.955450, 0.195520, 2.134110, 
+1.812730, -0.545800, 0.843810, 1.472980, -0.751050, -0.279610, -0.991680, 0.264490, 0.394910, -0.563050, 
+0.045960, -2.766530, 0.073620, -3.544490, 
+0.324910, -0.676920, 0.696690, -0.615960, -0.343840, 0.738860, -0.481600, -0.087610, 0.062830, -0.405430, 
+0.838180, -0.469810, 1.337330, 0.372410, 
+-1.301730, 0.745030, -0.742470, -0.291550, 0.506000, -0.538930, -0.175510, 0.728360, 0.505400, -0.231330, 
+0.072880, -0.748380, -0.417540, 0.661810, 
+0.952460, -0.523330, -0.728740, -0.747490, -0.313570, -0.382590, -0.581780, 0.106290, 0.536330, -0.972230, 
+0.570760, 0.482180, 0.144510, -0.747070, 
+-1.725080, 0.740740, -0.450920, 0.089550, 0.448510, 0.226260, 1.352380, -0.158780, 0.383830, -0.325020, 
+0.471630, 1.679200, 0.635480, 2.876520, 
+2.355600, -1.511380, 4.810840, -5.275760, 0.310820, 0.394520, -1.042470, 3.578630, 
+
+  };
+
+  /* unit definition section (see also UnitType) */
+  static UnitType Units[24] = 
+  {
+    { 0.0, 0.0, 0, NULL , NULL },
+    { /* unit 1 (Old: 1) */
+      0.0, -0.489050, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 2 (Old: 2) */
+      0.0, 0.314600, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 3 (Old: 3) */
+      0.0, 0.777830, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 4 (Old: 4) */
+      0.0, 0.155320, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 5 (Old: 5) */
+      0.0, 0.837780, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 6 (Old: 6) */
+      0.0, -0.712880, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 7 (Old: 7) */
+      0.0, 0.002400, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 8 (Old: 8) */
+      0.0, 0.042370, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 9 (Old: 9) */
+      0.0, -0.381620, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 10 (Old: 10) */
+      0.0, -0.669190, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 11 (Old: 11) */
+      0.0, 0.074200, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 12 (Old: 12) */
+      0.0, -0.155280, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 13 (Old: 13) */
+      0.0, -0.067950, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 14 (Old: 14) */
+      0.0, 0.948220, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 15 (Old: 15) */
+      0.0, -0.631700, 14,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 16 (Old: 16) */
+      0.0, 0.888890, 14,
+       &Sources[14] , 
+       &Weights[14] , 
+      },
+    { /* unit 17 (Old: 17) */
+      0.0, -1.164350, 14,
+       &Sources[28] , 
+       &Weights[28] , 
+      },
+    { /* unit 18 (Old: 18) */
+      0.0, -0.155440, 14,
+       &Sources[42] , 
+       &Weights[42] , 
+      },
+    { /* unit 19 (Old: 19) */
+      0.0, 0.676200, 14,
+       &Sources[56] , 
+       &Weights[56] , 
+      },
+    { /* unit 20 (Old: 20) */
+      0.0, -0.496060, 14,
+       &Sources[70] , 
+       &Weights[70] , 
+      },
+    { /* unit 21 (Old: 21) */
+      0.0, 0.000710, 14,
+       &Sources[84] , 
+       &Weights[84] , 
+      },
+    { /* unit 22 (Old: 22) */
+      0.0, 0.266120, 14,
+       &Sources[98] , 
+       &Weights[98] , 
+      },
+    { /* unit 23 (Old: 23) */
+      0.0, -1.084810, 8,
+       &Sources[112] , 
+       &Weights[112] , 
+      }
+
+  };
+
+
+
+int missing(float *in, float *out, int init)
+{
+  int member, source;
+  float sum;
+  enum{OK, Error, Not_Valid};
+  pUnit unit;
+
+
+  /* layer definition section (names & member units) */
+
+  static pUnit Input[14] = {Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, Units + 11, Units + 12, Units + 13, Units + 14}; /* members */
+
+  static pUnit Hidden1[8] = {Units + 15, Units + 16, Units + 17, Units + 18, Units + 19, Units + 20, Units + 21, Units + 22}; /* members */
+
+  static pUnit Output1[1] = {Units + 23}; /* members */
+
+  static int Output[1] = {23};
+
+  for(member = 0; member < 14; member++) {
+    Input[member]->act = in[member];
+  }
+
+  for (member = 0; member < 8; member++) {
+    unit = Hidden1[member];
+    sum = 0.0;
+    for (source = 0; source < unit->NoOfSources; source++) {
+      sum += unit->sources[source]->act
+             * unit->weights[source];
+    }
+    unit->act = Act_Logistic(sum, unit->Bias);
+  };
+
+  for (member = 0; member < 1; member++) {
+    unit = Output1[member];
+    sum = 0.0;
+    for (source = 0; source < unit->NoOfSources; source++) {
+      sum += unit->sources[source]->act
+             * unit->weights[source];
+    }
+    unit->act = Act_Logistic(sum, unit->Bias);
+  };
+
+  for(member = 0; member < 1; member++) {
+    out[member] = Units[Output[member]].act;
+  }
+
+  return(OK);
+}
diff --git a/src/knn_abi373/missing.h b/src/knn_abi373/missing.h
new file mode 100644
index 0000000..1973b23
--- /dev/null
+++ b/src/knn_abi373/missing.h
@@ -0,0 +1,14 @@
+/*********************************************************
+  missing.h
+  --------------------------------------------------------
+  generated at Tue Feb 22 14:20:39 2000
+  by snns2c ( Bernward Kett 1995 ) 
+*********************************************************/
+
+extern int missing(float *in, float *out, int init);
+
+static struct {
+  int NoOfInput;    /* Number of Input Units  */
+  int NoOfOutput;   /* Number of Output Units */
+  int(* propFunc)(float *, float*, int);
+} missingREC = {14,1,missing};
diff --git a/src/knn_abi373/ncall.c b/src/knn_abi373/ncall.c
new file mode 100644
index 0000000..d1ab89b
--- /dev/null
+++ b/src/knn_abi373/ncall.c
@@ -0,0 +1,176 @@
+/*********************************************************
+  ncall.c
+  --------------------------------------------------------
+  generated at Tue Feb 22 14:20:40 2000
+  by snns2c ( Bernward Kett 1995 ) 
+*********************************************************/
+
+#include <math.h>
+
+#define Act_Logistic(sum, bias)  ( (sum+bias<10000.0) ? ( 1.0/(1.0 + exp(-sum-bias) ) ) : 0.0 )
+#define NULL (void *)0
+
+typedef struct UT {
+          float act;         /* Activation       */
+          float Bias;        /* Bias of the Unit */
+          int   NoOfSources; /* Number of predecessor units */
+   struct UT   **sources; /* predecessor units */
+          float *weights; /* weights from predecessor units */
+        } UnitType, *pUnit;
+
+  /* Forward Declaration for all unit types */
+  static UnitType Units[16];
+  /* Sources definition section */
+  static pUnit Sources[] =  {
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, 
+Units + 10, Units + 11, Units + 12, Units + 13, Units + 14, 
+
+  };
+
+  /* Weigths definition section */
+  static float Weights[] =  {
+0.075160, 0.289060, 1.797810, 2.813980, -4.205520, 1.215330, -0.564600, -0.650220, -5.272390, 
+-0.476600, -0.110200, -1.722730, 0.000330, -1.553920, -3.613230, -0.213780, 0.125970, 5.025960, 
+0.378910, 0.193040, 0.897440, 0.460310, 1.169750, 0.594330, -3.628080, 0.546550, 1.518100, 
+0.200730, -0.338270, -1.073700, -1.008920, 3.622840, 0.364810, 3.394980, 0.468640, 1.995030, 
+0.086310, 0.127610, 0.348910, 0.460080, 0.401440, -0.783350, 1.333270, -0.157220, -0.957470, 
+-6.503880, 4.887620, 3.858670, 4.254280, -1.907580, 
+
+  };
+
+  /* unit definition section (see also UnitType) */
+  static UnitType Units[16] = 
+  {
+    { 0.0, 0.0, 0, NULL , NULL },
+    { /* unit 1 (Old: 1) */
+      0.0, -0.489050, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 2 (Old: 2) */
+      0.0, 0.314600, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 3 (Old: 3) */
+      0.0, 0.777830, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 4 (Old: 4) */
+      0.0, 0.155320, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 5 (Old: 5) */
+      0.0, 0.837780, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 6 (Old: 6) */
+      0.0, -0.712880, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 7 (Old: 7) */
+      0.0, 0.002400, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 8 (Old: 8) */
+      0.0, 0.042370, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 9 (Old: 9) */
+      0.0, -0.381620, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 10 (Old: 10) */
+      0.0, 3.062330, 9,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 11 (Old: 11) */
+      0.0, -1.751130, 9,
+       &Sources[9] , 
+       &Weights[9] , 
+      },
+    { /* unit 12 (Old: 12) */
+      0.0, 0.822930, 9,
+       &Sources[18] , 
+       &Weights[18] , 
+      },
+    { /* unit 13 (Old: 13) */
+      0.0, -2.552420, 9,
+       &Sources[27] , 
+       &Weights[27] , 
+      },
+    { /* unit 14 (Old: 14) */
+      0.0, -0.124220, 9,
+       &Sources[36] , 
+       &Weights[36] , 
+      },
+    { /* unit 15 (Old: 15) */
+      0.0, -3.718900, 5,
+       &Sources[45] , 
+       &Weights[45] , 
+      }
+
+  };
+
+
+
+int ncall(float *in, float *out, int init)
+{
+  int member, source;
+  float sum;
+  enum{OK, Error, Not_Valid};
+  pUnit unit;
+
+
+  /* layer definition section (names & member units) */
+
+  static pUnit Input[9] = {Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9}; /* members */
+
+  static pUnit Hidden1[5] = {Units + 10, Units + 11, Units + 12, Units + 13, Units + 14}; /* members */
+
+  static pUnit Output1[1] = {Units + 15}; /* members */
+
+  static int Output[1] = {15};
+
+  for(member = 0; member < 9; member++) {
+    Input[member]->act = in[member];
+  }
+
+  for (member = 0; member < 5; member++) {
+    unit = Hidden1[member];
+    sum = 0.0;
+    for (source = 0; source < unit->NoOfSources; source++) {
+      sum += unit->sources[source]->act
+             * unit->weights[source];
+    }
+    unit->act = Act_Logistic(sum, unit->Bias);
+  };
+
+  for (member = 0; member < 1; member++) {
+    unit = Output1[member];
+    sum = 0.0;
+    for (source = 0; source < unit->NoOfSources; source++) {
+      sum += unit->sources[source]->act
+             * unit->weights[source];
+    }
+    unit->act = Act_Logistic(sum, unit->Bias);
+  };
+
+  for(member = 0; member < 1; member++) {
+    out[member] = Units[Output[member]].act;
+  }
+
+  return(OK);
+}
diff --git a/src/knn_abi373/ncall.h b/src/knn_abi373/ncall.h
new file mode 100644
index 0000000..bb23ba2
--- /dev/null
+++ b/src/knn_abi373/ncall.h
@@ -0,0 +1,14 @@
+/*********************************************************
+  ncall.h
+  --------------------------------------------------------
+  generated at Tue Feb 22 14:20:40 2000
+  by snns2c ( Bernward Kett 1995 ) 
+*********************************************************/
+
+extern int ncall(float *in, float *out, int init);
+
+static struct {
+  int NoOfInput;    /* Number of Input Units  */
+  int NoOfOutput;   /* Number of Output Units */
+  int(* propFunc)(float *, float*, int);
+} ncallREC = {9,1,ncall};
diff --git a/src/knn_abi373/nplus.c b/src/knn_abi373/nplus.c
new file mode 100644
index 0000000..887b44f
--- /dev/null
+++ b/src/knn_abi373/nplus.c
@@ -0,0 +1,159 @@
+/*********************************************************
+  nplus.c
+  --------------------------------------------------------
+  generated at Tue Feb 22 14:20:39 2000
+  by snns2c ( Bernward Kett 1995 ) 
+*********************************************************/
+
+#include <math.h>
+
+#define Act_Logistic(sum, bias)  ( (sum+bias<10000.0) ? ( 1.0/(1.0 + exp(-sum-bias) ) ) : 0.0 )
+#define NULL (void *)0
+
+typedef struct UT {
+          float act;         /* Activation       */
+          float Bias;        /* Bias of the Unit */
+          int   NoOfSources; /* Number of predecessor units */
+   struct UT   **sources; /* predecessor units */
+          float *weights; /* weights from predecessor units */
+        } UnitType, *pUnit;
+
+  /* Forward Declaration for all unit types */
+  static UnitType Units[13];
+  /* Sources definition section */
+  static pUnit Sources[] =  {
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, 
+Units + 8, Units + 9, Units + 10, Units + 11, 
+
+  };
+
+  /* Weigths definition section */
+  static float Weights[] =  {
+3.547170, -3.553980, -1.116620, -0.025180, 1.089420, 0.803130, 0.529420, 
+-0.325320, -0.799210, -0.662850, -0.085720, 0.610610, 0.408650, -0.561280, 
+3.562170, -3.912450, -1.808290, 0.690540, 1.446580, 0.627760, 1.319640, 
+-2.048400, 2.575210, 1.037980, -0.229640, -1.377640, 0.538870, -1.307310, 
+4.001350, 0.610380, 4.446260, -3.682270, 
+
+  };
+
+  /* unit definition section (see also UnitType) */
+  static UnitType Units[13] = 
+  {
+    { 0.0, 0.0, 0, NULL , NULL },
+    { /* unit 1 (Old: 1) */
+      0.0, -0.489050, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 2 (Old: 2) */
+      0.0, 0.314600, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 3 (Old: 3) */
+      0.0, 0.777830, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 4 (Old: 4) */
+      0.0, 0.155320, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 5 (Old: 5) */
+      0.0, 0.837780, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 6 (Old: 6) */
+      0.0, -0.712880, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 7 (Old: 7) */
+      0.0, 0.002400, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 8 (Old: 8) */
+      0.0, 0.302570, 7,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 9 (Old: 9) */
+      0.0, -0.386940, 7,
+       &Sources[7] , 
+       &Weights[7] , 
+      },
+    { /* unit 10 (Old: 10) */
+      0.0, 1.267810, 7,
+       &Sources[14] , 
+       &Weights[14] , 
+      },
+    { /* unit 11 (Old: 11) */
+      0.0, -0.653340, 7,
+       &Sources[21] , 
+       &Weights[21] , 
+      },
+    { /* unit 12 (Old: 12) */
+      0.0, -2.467430, 4,
+       &Sources[28] , 
+       &Weights[28] , 
+      }
+
+  };
+
+
+
+int nplus(float *in, float *out, int init)
+{
+  int member, source;
+  float sum;
+  enum{OK, Error, Not_Valid};
+  pUnit unit;
+
+
+  /* layer definition section (names & member units) */
+
+  static pUnit Input[7] = {Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7}; /* members */
+
+  static pUnit Hidden1[4] = {Units + 8, Units + 9, Units + 10, Units + 11}; /* members */
+
+  static pUnit Output1[1] = {Units + 12}; /* members */
+
+  static int Output[1] = {12};
+
+  for(member = 0; member < 7; member++) {
+    Input[member]->act = in[member];
+  }
+
+  for (member = 0; member < 4; member++) {
+    unit = Hidden1[member];
+    sum = 0.0;
+    for (source = 0; source < unit->NoOfSources; source++) {
+      sum += unit->sources[source]->act
+             * unit->weights[source];
+    }
+    unit->act = Act_Logistic(sum, unit->Bias);
+  };
+
+  for (member = 0; member < 1; member++) {
+    unit = Output1[member];
+    sum = 0.0;
+    for (source = 0; source < unit->NoOfSources; source++) {
+      sum += unit->sources[source]->act
+             * unit->weights[source];
+    }
+    unit->act = Act_Logistic(sum, unit->Bias);
+  };
+
+  for(member = 0; member < 1; member++) {
+    out[member] = Units[Output[member]].act;
+  }
+
+  return(OK);
+}
diff --git a/src/knn_abi373/nplus.h b/src/knn_abi373/nplus.h
new file mode 100644
index 0000000..9afdf36
--- /dev/null
+++ b/src/knn_abi373/nplus.h
@@ -0,0 +1,14 @@
+/*********************************************************
+  nplus.h
+  --------------------------------------------------------
+  generated at Tue Feb 22 14:20:39 2000
+  by snns2c ( Bernward Kett 1995 ) 
+*********************************************************/
+
+extern int nplus(float *in, float *out, int init);
+
+static struct {
+  int NoOfInput;    /* Number of Input Units  */
+  int NoOfOutput;   /* Number of Output Units */
+  int(* propFunc)(float *, float*, int);
+} nplusREC = {7,1,nplus};
diff --git a/src/knn_abi373/over.c b/src/knn_abi373/over.c
new file mode 100644
index 0000000..e856f72
--- /dev/null
+++ b/src/knn_abi373/over.c
@@ -0,0 +1,224 @@
+/*********************************************************
+  over.c
+  --------------------------------------------------------
+  generated at Tue Feb 22 14:20:39 2000
+  by snns2c ( Bernward Kett 1995 ) 
+*********************************************************/
+
+#include <math.h>
+
+#define Act_Logistic(sum, bias)  ( (sum+bias<10000.0) ? ( 1.0/(1.0 + exp(-sum-bias) ) ) : 0.0 )
+#define NULL (void *)0
+
+typedef struct UT {
+          float act;         /* Activation       */
+          float Bias;        /* Bias of the Unit */
+          int   NoOfSources; /* Number of predecessor units */
+   struct UT   **sources; /* predecessor units */
+          float *weights; /* weights from predecessor units */
+        } UnitType, *pUnit;
+
+  /* Forward Declaration for all unit types */
+  static UnitType Units[22];
+  /* Sources definition section */
+  static pUnit Sources[] =  {
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, 
+Units + 14, Units + 15, Units + 16, Units + 17, Units + 18, Units + 19, Units + 20, 
+
+  };
+
+  /* Weigths definition section */
+  static float Weights[] =  {
+-2.741110, 1.612550, 0.072220, -2.176600, -1.328590, -0.173110, -0.838530, -1.464620, -2.374660, 0.752570, 
+1.035680, -4.081110, -4.421090, 
+1.279820, 0.714940, 0.188530, -0.114850, 0.831470, 1.272000, 0.642760, -0.609680, 0.154040, -0.424740, 
+-1.289250, -0.169390, 1.875400, 
+0.635110, -0.223790, -1.144410, -0.142940, 0.624480, -0.047670, 0.097170, 0.496940, -0.239030, 0.096900, 
+0.711610, 1.794680, -0.902940, 
+3.426980, -1.518050, -3.700240, 1.552130, 0.070020, 3.895670, 1.627850, 0.568500, -0.625040, 0.650830, 
+1.830140, 4.092140, -0.703900, 
+2.080610, -1.479060, -1.120990, 1.407860, 1.297010, -0.358070, -0.229900, 1.225030, 0.218510, 0.106970, 
+0.149620, 2.196170, -1.392770, 
+-1.665130, 1.297160, -0.468820, -0.695840, 0.958910, 0.120550, -1.660320, 2.721870, 0.967870, 0.750830, 
+2.654700, -4.732220, 0.049560, 
+-2.213550, 0.843870, 3.702150, -2.971100, -0.736910, -0.177500, -1.545490, 1.149680, -3.489310, -0.644770, 
+-0.902890, -4.929760, -0.187020, 
+-7.344120, 2.232830, 2.247220, 7.348330, 4.070420, -6.094320, -8.280490, 
+
+  };
+
+  /* unit definition section (see also UnitType) */
+  static UnitType Units[22] = 
+  {
+    { 0.0, 0.0, 0, NULL , NULL },
+    { /* unit 1 (Old: 1) */
+      0.0, -0.489050, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 2 (Old: 2) */
+      0.0, 0.314600, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 3 (Old: 3) */
+      0.0, 0.777830, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 4 (Old: 4) */
+      0.0, 0.155320, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 5 (Old: 5) */
+      0.0, 0.837780, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 6 (Old: 6) */
+      0.0, -0.712880, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 7 (Old: 7) */
+      0.0, 0.002400, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 8 (Old: 8) */
+      0.0, 0.042370, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 9 (Old: 9) */
+      0.0, -0.381620, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 10 (Old: 10) */
+      0.0, -0.669190, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 11 (Old: 11) */
+      0.0, 0.074200, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 12 (Old: 12) */
+      0.0, -0.155280, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 13 (Old: 13) */
+      0.0, -0.067950, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 14 (Old: 14) */
+      0.0, 1.321120, 13,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 15 (Old: 15) */
+      0.0, 0.483940, 13,
+       &Sources[13] , 
+       &Weights[13] , 
+      },
+    { /* unit 16 (Old: 16) */
+      0.0, 0.761950, 13,
+       &Sources[26] , 
+       &Weights[26] , 
+      },
+    { /* unit 17 (Old: 17) */
+      0.0, -1.351390, 13,
+       &Sources[39] , 
+       &Weights[39] , 
+      },
+    { /* unit 18 (Old: 18) */
+      0.0, -1.215800, 13,
+       &Sources[52] , 
+       &Weights[52] , 
+      },
+    { /* unit 19 (Old: 19) */
+      0.0, 0.959950, 13,
+       &Sources[65] , 
+       &Weights[65] , 
+      },
+    { /* unit 20 (Old: 20) */
+      0.0, 2.362970, 13,
+       &Sources[78] , 
+       &Weights[78] , 
+      },
+    { /* unit 21 (Old: 21) */
+      0.0, 0.337930, 7,
+       &Sources[91] , 
+       &Weights[91] , 
+      }
+
+  };
+
+
+
+int over(float *in, float *out, int init)
+{
+  int member, source;
+  float sum;
+  enum{OK, Error, Not_Valid};
+  pUnit unit;
+
+
+  /* layer definition section (names & member units) */
+
+  static pUnit Input[13] = {Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, Units + 11, Units + 12, Units + 13}; /* members */
+
+  static pUnit Hidden1[7] = {Units + 14, Units + 15, Units + 16, Units + 17, Units + 18, Units + 19, Units + 20}; /* members */
+
+  static pUnit Output1[1] = {Units + 21}; /* members */
+
+  static int Output[1] = {21};
+
+  for(member = 0; member < 13; member++) {
+    Input[member]->act = in[member];
+  }
+
+  for (member = 0; member < 7; member++) {
+    unit = Hidden1[member];
+    sum = 0.0;
+    for (source = 0; source < unit->NoOfSources; source++) {
+      sum += unit->sources[source]->act
+             * unit->weights[source];
+    }
+    unit->act = Act_Logistic(sum, unit->Bias);
+  };
+
+  for (member = 0; member < 1; member++) {
+    unit = Output1[member];
+    sum = 0.0;
+    for (source = 0; source < unit->NoOfSources; source++) {
+      sum += unit->sources[source]->act
+             * unit->weights[source];
+    }
+    unit->act = Act_Logistic(sum, unit->Bias);
+  };
+
+  for(member = 0; member < 1; member++) {
+    out[member] = Units[Output[member]].act;
+  }
+
+  return(OK);
+}
diff --git a/src/knn_abi373/over.h b/src/knn_abi373/over.h
new file mode 100644
index 0000000..2ec6bc8
--- /dev/null
+++ b/src/knn_abi373/over.h
@@ -0,0 +1,14 @@
+/*********************************************************
+  over.h
+  --------------------------------------------------------
+  generated at Tue Feb 22 14:20:39 2000
+  by snns2c ( Bernward Kett 1995 ) 
+*********************************************************/
+
+extern int over(float *in, float *out, int init);
+
+static struct {
+  int NoOfInput;    /* Number of Input Units  */
+  int NoOfOutput;   /* Number of Output Units */
+  int(* propFunc)(float *, float*, int);
+} overREC = {13,1,over};
diff --git a/src/knn_abi373/under.c b/src/knn_abi373/under.c
new file mode 100644
index 0000000..23d1cef
--- /dev/null
+++ b/src/knn_abi373/under.c
@@ -0,0 +1,224 @@
+/*********************************************************
+  under.c
+  --------------------------------------------------------
+  generated at Tue Feb 22 14:20:40 2000
+  by snns2c ( Bernward Kett 1995 ) 
+*********************************************************/
+
+#include <math.h>
+
+#define Act_Logistic(sum, bias)  ( (sum+bias<10000.0) ? ( 1.0/(1.0 + exp(-sum-bias) ) ) : 0.0 )
+#define NULL (void *)0
+
+typedef struct UT {
+          float act;         /* Activation       */
+          float Bias;        /* Bias of the Unit */
+          int   NoOfSources; /* Number of predecessor units */
+   struct UT   **sources; /* predecessor units */
+          float *weights; /* weights from predecessor units */
+        } UnitType, *pUnit;
+
+  /* Forward Declaration for all unit types */
+  static UnitType Units[22];
+  /* Sources definition section */
+  static pUnit Sources[] =  {
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, 
+Units + 14, Units + 15, Units + 16, Units + 17, Units + 18, Units + 19, Units + 20, 
+
+  };
+
+  /* Weigths definition section */
+  static float Weights[] =  {
+0.553260, -1.862410, -0.419620, -1.422950, -1.062190, 0.021970, -0.587490, 1.960180, -1.057200, 2.469110, 
+-1.020990, -1.980180, 0.205530, 
+-1.571930, 2.284010, -0.423110, 1.452060, 1.396540, 0.134870, 1.147750, -0.689870, -1.250520, -0.525170, 
+-0.561510, 0.284070, 0.308750, 
+2.502770, -2.599970, -0.599820, -3.754130, -0.685920, -1.750990, -1.216380, 1.042120, -0.621250, 0.114690, 
+0.135980, -0.473180, 0.088790, 
+0.474500, 0.119810, -0.734830, -0.773710, -0.232180, 0.792410, 0.616230, 0.481070, -0.143960, -0.276020, 
+-0.072460, -0.024980, 0.468570, 
+-1.551220, 1.893560, 0.632360, 1.763980, 1.350610, 1.449080, 0.044910, -0.723790, 0.377790, -0.103080, 
+-0.082100, 0.311310, -0.187220, 
+0.358510, -0.225730, -1.043730, -0.108010, -0.462990, -0.750880, -1.351200, 0.834550, -0.261140, -0.031780, 
+0.195460, -1.134300, 0.049470, 
+0.697110, -0.726470, 0.241840, -1.310910, -1.031490, 1.039500, -0.450670, 0.940720, -1.617490, -0.517930, 
+-0.647590, -0.334740, 0.169390, 
+-3.681990, 3.893300, -5.278480, -0.080400, 3.726740, -0.805490, -1.940030, 
+
+  };
+
+  /* unit definition section (see also UnitType) */
+  static UnitType Units[22] = 
+  {
+    { 0.0, 0.0, 0, NULL , NULL },
+    { /* unit 1 (Old: 1) */
+      0.0, -0.489050, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 2 (Old: 2) */
+      0.0, 0.314600, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 3 (Old: 3) */
+      0.0, 0.777830, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 4 (Old: 4) */
+      0.0, 0.155320, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 5 (Old: 5) */
+      0.0, 0.837780, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 6 (Old: 6) */
+      0.0, -0.712880, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 7 (Old: 7) */
+      0.0, 0.002400, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 8 (Old: 8) */
+      0.0, 0.042370, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 9 (Old: 9) */
+      0.0, -0.381620, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 10 (Old: 10) */
+      0.0, -0.669190, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 11 (Old: 11) */
+      0.0, 0.074200, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 12 (Old: 12) */
+      0.0, -0.155280, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 13 (Old: 13) */
+      0.0, -0.067950, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 14 (Old: 14) */
+      0.0, 1.118810, 13,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 15 (Old: 15) */
+      0.0, -0.335500, 13,
+       &Sources[13] , 
+       &Weights[13] , 
+      },
+    { /* unit 16 (Old: 16) */
+      0.0, 1.441040, 13,
+       &Sources[26] , 
+       &Weights[26] , 
+      },
+    { /* unit 17 (Old: 17) */
+      0.0, -0.264910, 13,
+       &Sources[39] , 
+       &Weights[39] , 
+      },
+    { /* unit 18 (Old: 18) */
+      0.0, -1.040220, 13,
+       &Sources[52] , 
+       &Weights[52] , 
+      },
+    { /* unit 19 (Old: 19) */
+      0.0, 0.488900, 13,
+       &Sources[65] , 
+       &Weights[65] , 
+      },
+    { /* unit 20 (Old: 20) */
+      0.0, 0.774590, 13,
+       &Sources[78] , 
+       &Weights[78] , 
+      },
+    { /* unit 21 (Old: 21) */
+      0.0, 0.673250, 7,
+       &Sources[91] , 
+       &Weights[91] , 
+      }
+
+  };
+
+
+
+int under(float *in, float *out, int init)
+{
+  int member, source;
+  float sum;
+  enum{OK, Error, Not_Valid};
+  pUnit unit;
+
+
+  /* layer definition section (names & member units) */
+
+  static pUnit Input[13] = {Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, Units + 11, Units + 12, Units + 13}; /* members */
+
+  static pUnit Hidden1[7] = {Units + 14, Units + 15, Units + 16, Units + 17, Units + 18, Units + 19, Units + 20}; /* members */
+
+  static pUnit Output1[1] = {Units + 21}; /* members */
+
+  static int Output[1] = {21};
+
+  for(member = 0; member < 13; member++) {
+    Input[member]->act = in[member];
+  }
+
+  for (member = 0; member < 7; member++) {
+    unit = Hidden1[member];
+    sum = 0.0;
+    for (source = 0; source < unit->NoOfSources; source++) {
+      sum += unit->sources[source]->act
+             * unit->weights[source];
+    }
+    unit->act = Act_Logistic(sum, unit->Bias);
+  };
+
+  for (member = 0; member < 1; member++) {
+    unit = Output1[member];
+    sum = 0.0;
+    for (source = 0; source < unit->NoOfSources; source++) {
+      sum += unit->sources[source]->act
+             * unit->weights[source];
+    }
+    unit->act = Act_Logistic(sum, unit->Bias);
+  };
+
+  for(member = 0; member < 1; member++) {
+    out[member] = Units[Output[member]].act;
+  }
+
+  return(OK);
+}
diff --git a/src/knn_abi373/under.h b/src/knn_abi373/under.h
new file mode 100644
index 0000000..bc95fde
--- /dev/null
+++ b/src/knn_abi373/under.h
@@ -0,0 +1,14 @@
+/*********************************************************
+  under.h
+  --------------------------------------------------------
+  generated at Tue Feb 22 14:20:40 2000
+  by snns2c ( Bernward Kett 1995 ) 
+*********************************************************/
+
+extern int under(float *in, float *out, int init);
+
+static struct {
+  int NoOfInput;    /* Number of Input Units  */
+  int NoOfOutput;   /* Number of Output Units */
+  int(* propFunc)(float *, float*, int);
+} underREC = {13,1,under};
diff --git a/src/knn_abi373/wrong.c b/src/knn_abi373/wrong.c
new file mode 100644
index 0000000..8c9ded4
--- /dev/null
+++ b/src/knn_abi373/wrong.c
@@ -0,0 +1,176 @@
+/*********************************************************
+  wrong.c
+  --------------------------------------------------------
+  generated at Tue Feb 22 14:20:40 2000
+  by snns2c ( Bernward Kett 1995 ) 
+*********************************************************/
+
+#include <math.h>
+
+#define Act_Logistic(sum, bias)  ( (sum+bias<10000.0) ? ( 1.0/(1.0 + exp(-sum-bias) ) ) : 0.0 )
+#define NULL (void *)0
+
+typedef struct UT {
+          float act;         /* Activation       */
+          float Bias;        /* Bias of the Unit */
+          int   NoOfSources; /* Number of predecessor units */
+   struct UT   **sources; /* predecessor units */
+          float *weights; /* weights from predecessor units */
+        } UnitType, *pUnit;
+
+  /* Forward Declaration for all unit types */
+  static UnitType Units[16];
+  /* Sources definition section */
+  static pUnit Sources[] =  {
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, 
+Units + 10, Units + 11, Units + 12, Units + 13, Units + 14, 
+
+  };
+
+  /* Weigths definition section */
+  static float Weights[] =  {
+0.821270, 0.347730, 0.951210, 0.551740, -4.569540, -3.122010, -2.151940, 1.162300, -0.200580, 
+0.101760, 1.291510, -0.537760, 0.579040, -1.891680, -2.147570, -1.018570, 0.626710, 0.417660, 
+0.314540, -0.419920, 0.827890, 0.502720, 0.689150, -0.366510, -0.380200, 0.439680, -0.586430, 
+-0.508890, 0.122640, 0.612790, 0.650820, 2.615490, -2.414350, 4.559760, -1.095140, 2.415640, 
+0.945880, 0.178610, 0.147690, 0.138760, 2.212590, 0.391190, 1.831230, -0.247900, -1.589140, 
+-5.603230, -2.497710, -0.042000, 4.901480, 1.988140, 
+
+  };
+
+  /* unit definition section (see also UnitType) */
+  static UnitType Units[16] = 
+  {
+    { 0.0, 0.0, 0, NULL , NULL },
+    { /* unit 1 (Old: 1) */
+      0.0, -0.489050, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 2 (Old: 2) */
+      0.0, 0.314600, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 3 (Old: 3) */
+      0.0, 0.777830, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 4 (Old: 4) */
+      0.0, 0.155320, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 5 (Old: 5) */
+      0.0, 0.837780, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 6 (Old: 6) */
+      0.0, -0.712880, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 7 (Old: 7) */
+      0.0, 0.002400, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 8 (Old: 8) */
+      0.0, 0.042370, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 9 (Old: 9) */
+      0.0, -0.381620, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 10 (Old: 10) */
+      0.0, 1.216290, 9,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 11 (Old: 11) */
+      0.0, 0.125010, 9,
+       &Sources[9] , 
+       &Weights[9] , 
+      },
+    { /* unit 12 (Old: 12) */
+      0.0, 0.658340, 9,
+       &Sources[18] , 
+       &Weights[18] , 
+      },
+    { /* unit 13 (Old: 13) */
+      0.0, -0.461420, 9,
+       &Sources[27] , 
+       &Weights[27] , 
+      },
+    { /* unit 14 (Old: 14) */
+      0.0, 0.005310, 9,
+       &Sources[36] , 
+       &Weights[36] , 
+      },
+    { /* unit 15 (Old: 15) */
+      0.0, -1.649980, 5,
+       &Sources[45] , 
+       &Weights[45] , 
+      }
+
+  };
+
+
+
+int wrong(float *in, float *out, int init)
+{
+  int member, source;
+  float sum;
+  enum{OK, Error, Not_Valid};
+  pUnit unit;
+
+
+  /* layer definition section (names & member units) */
+
+  static pUnit Input[9] = {Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9}; /* members */
+
+  static pUnit Hidden1[5] = {Units + 10, Units + 11, Units + 12, Units + 13, Units + 14}; /* members */
+
+  static pUnit Output1[1] = {Units + 15}; /* members */
+
+  static int Output[1] = {15};
+
+  for(member = 0; member < 9; member++) {
+    Input[member]->act = in[member];
+  }
+
+  for (member = 0; member < 5; member++) {
+    unit = Hidden1[member];
+    sum = 0.0;
+    for (source = 0; source < unit->NoOfSources; source++) {
+      sum += unit->sources[source]->act
+             * unit->weights[source];
+    }
+    unit->act = Act_Logistic(sum, unit->Bias);
+  };
+
+  for (member = 0; member < 1; member++) {
+    unit = Output1[member];
+    sum = 0.0;
+    for (source = 0; source < unit->NoOfSources; source++) {
+      sum += unit->sources[source]->act
+             * unit->weights[source];
+    }
+    unit->act = Act_Logistic(sum, unit->Bias);
+  };
+
+  for(member = 0; member < 1; member++) {
+    out[member] = Units[Output[member]].act;
+  }
+
+  return(OK);
+}
diff --git a/src/knn_abi373/wrong.h b/src/knn_abi373/wrong.h
new file mode 100644
index 0000000..7d4933b
--- /dev/null
+++ b/src/knn_abi373/wrong.h
@@ -0,0 +1,14 @@
+/*********************************************************
+  wrong.h
+  --------------------------------------------------------
+  generated at Tue Feb 22 14:20:40 2000
+  by snns2c ( Bernward Kett 1995 ) 
+*********************************************************/
+
+extern int wrong(float *in, float *out, int init);
+
+static struct {
+  int NoOfInput;    /* Number of Input Units  */
+  int NoOfOutput;   /* Number of Output Units */
+  int(* propFunc)(float *, float*, int);
+} wrongREC = {9,1,wrong};
diff --git a/src/knn_alf/Makefile.am b/src/knn_alf/Makefile.am
new file mode 100644
index 0000000..ac93502
--- /dev/null
+++ b/src/knn_alf/Makefile.am
@@ -0,0 +1,6 @@
+INCLUDES = -I$(top_srcdir)/src $(all_includes)
+
+noinst_LIBRARIES = libmiraKNN_alf.a
+libmiraKNN_alf_a_SOURCES= wrong.c under.c add.c over.c nplus.c missing.c ncall.c
+noinst_HEADERS= wrong.h under.h add.h over.h nplus.h missing.h ncall.h
+
diff --git a/src/errorhandling/Makefile.in b/src/knn_alf/Makefile.in
similarity index 73%
copy from src/errorhandling/Makefile.in
copy to src/knn_alf/Makefile.in
index 3074d7b..2d0af6d 100644
--- a/src/errorhandling/Makefile.in
+++ b/src/knn_alf/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -35,18 +35,26 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
-subdir = src/errorhandling
+subdir = src/knn_alf
 DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/ax_boost_base.m4 \
-	$(top_srcdir)/m4/ax_boost_filesystem.m4 \
-	$(top_srcdir)/m4/ax_boost_iostreams.m4 \
-	$(top_srcdir)/m4/ax_boost_regex.m4 \
-	$(top_srcdir)/m4/ax_boost_system.m4 \
-	$(top_srcdir)/m4/ax_boost_thread.m4 \
-	$(top_srcdir)/m4/ax_check_zlib.m4 \
-	$(top_srcdir)/m4/ax_lib_expat.m4 $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/config/m4/ax_boost_base.m4 \
+	$(top_srcdir)/config/m4/ax_boost_regex.m4 \
+	$(top_srcdir)/config/m4/ax_boost_thread.m4 \
+	$(top_srcdir)/config/m4/ax_check_zlib.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_std.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_stl.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_namespaces.m4 \
+	$(top_srcdir)/config/m4/ax_lib_expat.m4 \
+	$(top_srcdir)/config/m4/ax_with_perl.m4 \
+	$(top_srcdir)/config/m4/ax_with_prog.m4 \
+	$(top_srcdir)/config/m4/libtool.m4 \
+	$(top_srcdir)/config/m4/ltoptions.m4 \
+	$(top_srcdir)/config/m4/ltsugar.m4 \
+	$(top_srcdir)/config/m4/ltversion.m4 \
+	$(top_srcdir)/config/m4/lt~obsolete.m4 \
+	$(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -54,25 +62,27 @@ CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
 LIBRARIES = $(noinst_LIBRARIES)
 ARFLAGS = cru
-libmiraerrorhandling_a_AR = $(AR) $(ARFLAGS)
-libmiraerrorhandling_a_LIBADD =
-am_libmiraerrorhandling_a_OBJECTS = errorhandling.$(OBJEXT)
-libmiraerrorhandling_a_OBJECTS = $(am_libmiraerrorhandling_a_OBJECTS)
+libmiraKNN_alf_a_AR = $(AR) $(ARFLAGS)
+libmiraKNN_alf_a_LIBADD =
+am_libmiraKNN_alf_a_OBJECTS = wrong.$(OBJEXT) under.$(OBJEXT) \
+	add.$(OBJEXT) over.$(OBJEXT) nplus.$(OBJEXT) missing.$(OBJEXT) \
+	ncall.$(OBJEXT)
+libmiraKNN_alf_a_OBJECTS = $(am_libmiraKNN_alf_a_OBJECTS)
 DEFAULT_INCLUDES = -I. at am__isrc@
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
 am__mv = mv -f
-CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
-	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
-LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
-	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
-CXXLD = $(CXX)
-CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
 	$(LDFLAGS) -o $@
-SOURCES = $(libmiraerrorhandling_a_SOURCES)
-DIST_SOURCES = $(libmiraerrorhandling_a_SOURCES)
+SOURCES = $(libmiraKNN_alf_a_SOURCES)
+DIST_SOURCES = $(libmiraKNN_alf_a_SOURCES)
 HEADERS = $(noinst_HEADERS)
 ETAGS = etags
 CTAGS = ctags
@@ -87,13 +97,9 @@ AWK = @AWK@
 BITPACKAGE = @BITPACKAGE@
 BLOODYDARWINSTATLIBDIRHACK = @BLOODYDARWINSTATLIBDIRHACK@
 BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
-BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@
-BOOST_IOSTREAMS_LIB = @BOOST_IOSTREAMS_LIB@
 BOOST_LDFLAGS = @BOOST_LDFLAGS@
 BOOST_REGEX_LIB = @BOOST_REGEX_LIB@
-BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@
 BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
-BUNDLETARGET = @BUNDLETARGET@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
@@ -106,7 +112,6 @@ CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -116,13 +121,11 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LDFLAGS = @EXPAT_LDFLAGS@
-EXPAT_LIBS = @EXPAT_LIBS@
 EXPAT_VERSION = @EXPAT_VERSION@
 FGREP = @FGREP@
 FLEX = @FLEX@
 FLEXPP = @FLEXPP@
 GREP = @GREP@
-HAVE_XXD = @HAVE_XXD@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -140,7 +143,6 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
 MIRASTATIC = @MIRASTATIC@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
@@ -157,17 +159,18 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
+SHORTMIRAAUDIENCE = @SHORTMIRAAUDIENCE@
 STRIP = @STRIP@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -201,6 +204,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -216,14 +220,14 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-AM_CPPFLAGS = -I$(top_srcdir)/src $(all_includes)
-noinst_LIBRARIES = libmiraerrorhandling.a
-libmiraerrorhandling_a_SOURCES = errorhandling.C
-noinst_HEADERS = errorhandling.H
+INCLUDES = -I$(top_srcdir)/src $(all_includes)
+noinst_LIBRARIES = libmiraKNN_alf.a
+libmiraKNN_alf_a_SOURCES = wrong.c under.c add.c over.c nplus.c missing.c ncall.c
+noinst_HEADERS = wrong.h under.h add.h over.h nplus.h missing.h ncall.h
 all: all-am
 
 .SUFFIXES:
-.SUFFIXES: .C .lo .o .obj
+.SUFFIXES: .c .lo .o .obj
 $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
@@ -233,9 +237,9 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/errorhandling/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/knn_alf/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu src/errorhandling/Makefile
+	  $(AUTOMAKE) --gnu src/knn_alf/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -257,10 +261,10 @@ $(am__aclocal_m4_deps):
 
 clean-noinstLIBRARIES:
 	-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
-libmiraerrorhandling.a: $(libmiraerrorhandling_a_OBJECTS) $(libmiraerrorhandling_a_DEPENDENCIES) $(EXTRA_libmiraerrorhandling_a_DEPENDENCIES) 
-	-rm -f libmiraerrorhandling.a
-	$(libmiraerrorhandling_a_AR) libmiraerrorhandling.a $(libmiraerrorhandling_a_OBJECTS) $(libmiraerrorhandling_a_LIBADD)
-	$(RANLIB) libmiraerrorhandling.a
+libmiraKNN_alf.a: $(libmiraKNN_alf_a_OBJECTS) $(libmiraKNN_alf_a_DEPENDENCIES) 
+	-rm -f libmiraKNN_alf.a
+	$(libmiraKNN_alf_a_AR) libmiraKNN_alf.a $(libmiraKNN_alf_a_OBJECTS) $(libmiraKNN_alf_a_LIBADD)
+	$(RANLIB) libmiraKNN_alf.a
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -268,28 +272,34 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/errorhandling.Po at am__quote@
-
-.C.o:
- at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXXCOMPILE) -c -o $@ $<
-
-.C.obj:
- at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
-
-.C.lo:
- at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(LTCXXCOMPILE) -c -o $@ $<
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/missing.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ncall.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nplus.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/over.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/under.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/wrong.Po at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ at am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
 
 mostlyclean-libtool:
 	-rm -f *.lo
@@ -393,15 +403,10 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	if test -z '$(STRIP)'; then \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	      install; \
-	else \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-	fi
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
 mostlyclean-generic:
 
 clean-generic:
diff --git a/src/knn_alf/add.c b/src/knn_alf/add.c
new file mode 100644
index 0000000..3a2a4c7
--- /dev/null
+++ b/src/knn_alf/add.c
@@ -0,0 +1,224 @@
+/*********************************************************
+  add.c
+  --------------------------------------------------------
+  generated at Tue Feb 29 16:27:52 2000
+  by snns2c ( Bernward Kett 1995 ) 
+*********************************************************/
+
+#include <math.h>
+
+#define Act_Logistic(sum, bias)  ( (sum+bias<10000.0) ? ( 1.0/(1.0 + exp(-sum-bias) ) ) : 0.0 )
+#define NULL (void *)0
+
+typedef struct UT {
+          float act;         /* Activation       */
+          float Bias;        /* Bias of the Unit */
+          int   NoOfSources; /* Number of predecessor units */
+   struct UT   **sources; /* predecessor units */
+          float *weights; /* weights from predecessor units */
+        } UnitType, *pUnit;
+
+  /* Forward Declaration for all unit types */
+  static UnitType Units[22];
+  /* Sources definition section */
+  static pUnit Sources[] =  {
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, 
+Units + 14, Units + 15, Units + 16, Units + 17, Units + 18, Units + 19, Units + 20, 
+
+  };
+
+  /* Weigths definition section */
+  static float Weights[] =  {
+-0.618930, -0.189080, -0.794380, 0.009860, -0.169890, -0.007730, 0.062230, 0.337980, -0.890290, 0.856050, 
+-0.732770, -0.951400, -0.644090, 
+3.038520, 0.513190, -2.829950, -0.453670, 1.527360, -0.368030, 1.822900, -1.213060, -0.609130, 0.671600, 
+-0.957500, -0.702360, 0.099150, 
+-2.142120, -0.086490, 0.832910, -1.062650, -0.253880, 0.212890, -1.218620, 0.655910, 0.805110, 0.439000, 
+0.718680, 0.457260, 0.790070, 
+2.667970, -0.083000, -2.680620, -0.825920, 0.236360, -0.073970, 1.453210, -0.132850, -0.036460, 0.325540, 
+-0.032890, -0.116150, 0.058830, 
+2.670230, -0.156380, -1.282520, 0.064340, 1.516800, 0.015360, 0.424450, -0.046210, -0.695470, -0.508280, 
+-0.527550, -0.400790, -0.867030, 
+-2.120440, 0.939510, 1.186680, 0.673390, -0.654040, 0.309290, -1.979610, 1.123930, -0.305430, -0.262850, 
+0.419640, -0.821440, -0.161700, 
+-2.115660, 0.517020, 3.336870, -0.838710, -1.784470, 1.051590, -1.677760, 0.821500, -1.404430, -0.704730, 
+-0.058540, -0.544560, 0.435740, 
+0.127140, 4.886230, -2.728880, 3.674980, 3.079150, -2.975730, -5.054220, 
+
+  };
+
+  /* unit definition section (see also UnitType) */
+  static UnitType Units[22] = 
+  {
+    { 0.0, 0.0, 0, NULL , NULL },
+    { /* unit 1 (Old: 1) */
+      0.0, -0.489050, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 2 (Old: 2) */
+      0.0, 0.314600, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 3 (Old: 3) */
+      0.0, 0.777830, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 4 (Old: 4) */
+      0.0, 0.155320, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 5 (Old: 5) */
+      0.0, 0.837780, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 6 (Old: 6) */
+      0.0, -0.712880, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 7 (Old: 7) */
+      0.0, 0.002400, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 8 (Old: 8) */
+      0.0, 0.042370, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 9 (Old: 9) */
+      0.0, -0.381620, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 10 (Old: 10) */
+      0.0, -0.669190, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 11 (Old: 11) */
+      0.0, 0.074200, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 12 (Old: 12) */
+      0.0, -0.155280, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 13 (Old: 13) */
+      0.0, -0.067950, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 14 (Old: 14) */
+      0.0, 0.925570, 13,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 15 (Old: 15) */
+      0.0, 0.502870, 13,
+       &Sources[13] , 
+       &Weights[13] , 
+      },
+    { /* unit 16 (Old: 16) */
+      0.0, 0.429900, 13,
+       &Sources[26] , 
+       &Weights[26] , 
+      },
+    { /* unit 17 (Old: 17) */
+      0.0, 0.044410, 13,
+       &Sources[39] , 
+       &Weights[39] , 
+      },
+    { /* unit 18 (Old: 18) */
+      0.0, -0.241020, 13,
+       &Sources[52] , 
+       &Weights[52] , 
+      },
+    { /* unit 19 (Old: 19) */
+      0.0, 0.345880, 13,
+       &Sources[65] , 
+       &Weights[65] , 
+      },
+    { /* unit 20 (Old: 20) */
+      0.0, 0.731500, 13,
+       &Sources[78] , 
+       &Weights[78] , 
+      },
+    { /* unit 21 (Old: 21) */
+      0.0, -0.195490, 7,
+       &Sources[91] , 
+       &Weights[91] , 
+      }
+
+  };
+
+
+
+int add(float *in, float *out, int init)
+{
+  int member, source;
+  float sum;
+  enum{OK, Error, Not_Valid};
+  pUnit unit;
+
+
+  /* layer definition section (names & member units) */
+
+  static pUnit Input[13] = {Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, Units + 11, Units + 12, Units + 13}; /* members */
+
+  static pUnit Hidden1[7] = {Units + 14, Units + 15, Units + 16, Units + 17, Units + 18, Units + 19, Units + 20}; /* members */
+
+  static pUnit Output1[1] = {Units + 21}; /* members */
+
+  static int Output[1] = {21};
+
+  for(member = 0; member < 13; member++) {
+    Input[member]->act = in[member];
+  }
+
+  for (member = 0; member < 7; member++) {
+    unit = Hidden1[member];
+    sum = 0.0;
+    for (source = 0; source < unit->NoOfSources; source++) {
+      sum += unit->sources[source]->act
+             * unit->weights[source];
+    }
+    unit->act = Act_Logistic(sum, unit->Bias);
+  };
+
+  for (member = 0; member < 1; member++) {
+    unit = Output1[member];
+    sum = 0.0;
+    for (source = 0; source < unit->NoOfSources; source++) {
+      sum += unit->sources[source]->act
+             * unit->weights[source];
+    }
+    unit->act = Act_Logistic(sum, unit->Bias);
+  };
+
+  for(member = 0; member < 1; member++) {
+    out[member] = Units[Output[member]].act;
+  }
+
+  return(OK);
+}
diff --git a/src/knn_alf/add.h b/src/knn_alf/add.h
new file mode 100644
index 0000000..ed20002
--- /dev/null
+++ b/src/knn_alf/add.h
@@ -0,0 +1,14 @@
+/*********************************************************
+  add.h
+  --------------------------------------------------------
+  generated at Tue Feb 29 16:27:52 2000
+  by snns2c ( Bernward Kett 1995 ) 
+*********************************************************/
+
+extern int add(float *in, float *out, int init);
+
+static struct {
+  int NoOfInput;    /* Number of Input Units  */
+  int NoOfOutput;   /* Number of Output Units */
+  int(* propFunc)(float *, float*, int);
+} addREC = {13,1,add};
diff --git a/src/knn_alf/missing.c b/src/knn_alf/missing.c
new file mode 100644
index 0000000..a53c12d
--- /dev/null
+++ b/src/knn_alf/missing.c
@@ -0,0 +1,238 @@
+/*********************************************************
+  missing.c
+  --------------------------------------------------------
+  generated at Tue Feb 29 16:27:52 2000
+  by snns2c ( Bernward Kett 1995 ) 
+*********************************************************/
+
+#include <math.h>
+
+#define Act_Logistic(sum, bias)  ( (sum+bias<10000.0) ? ( 1.0/(1.0 + exp(-sum-bias) ) ) : 0.0 )
+#define NULL (void *)0
+
+typedef struct UT {
+          float act;         /* Activation       */
+          float Bias;        /* Bias of the Unit */
+          int   NoOfSources; /* Number of predecessor units */
+   struct UT   **sources; /* predecessor units */
+          float *weights; /* weights from predecessor units */
+        } UnitType, *pUnit;
+
+  /* Forward Declaration for all unit types */
+  static UnitType Units[24];
+  /* Sources definition section */
+  static pUnit Sources[] =  {
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, Units + 14, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, Units + 14, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, Units + 14, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, Units + 14, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, Units + 14, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, Units + 14, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, Units + 14, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, Units + 14, 
+Units + 15, Units + 16, Units + 17, Units + 18, Units + 19, Units + 20, Units + 21, Units + 22, 
+
+  };
+
+  /* Weigths definition section */
+  static float Weights[] =  {
+-0.775630, -0.307030, 0.901090, 1.059520, 0.464540, 2.556430, 0.778640, -0.515940, 1.113650, -0.365000, 
+0.442630, 0.402400, 0.250000, 1.656440, 
+1.751540, -0.941550, 0.289640, -1.163610, 0.530390, -2.488400, -1.327890, 0.230870, -0.332220, -0.560510, 
+-0.820210, -0.222230, -0.122980, -1.876830, 
+-2.313840, 0.778810, -0.242500, 1.313870, 0.570160, 1.063080, 0.568190, 0.466490, 1.388440, 1.172740, 
+1.038820, 1.453360, 1.017650, 0.589880, 
+0.737940, 0.445220, 0.118930, 0.260750, -0.384090, -2.409260, -0.409700, 0.109810, -0.228920, -0.618760, 
+-0.571430, -0.720400, 0.655780, -0.991180, 
+1.335600, -0.946470, 0.647550, -1.144130, -0.461660, -0.119990, -0.872790, -0.436990, 0.763900, -0.094560, 
+0.763040, -1.064020, 0.694070, -0.948490, 
+-1.370480, 0.912410, -0.487610, -0.094780, 0.573910, -0.296660, -0.105720, 0.799720, 0.210590, -0.473000, 
+0.020200, -0.805560, -0.731080, 0.846070, 
+1.297920, -0.843400, -0.680370, -1.605840, -0.299790, 0.423510, -0.685570, -0.474020, 1.371400, -1.193960, 
+0.417590, 0.694080, -1.058760, -1.100260, 
+-1.032550, 0.179860, -0.212590, 1.056550, 0.238420, 0.712240, 0.993500, 0.220890, 1.039400, -0.637820, 
+0.498250, 0.604910, 0.665120, 1.932210, 
+3.253960, -3.963880, 3.573960, -2.533980, -2.308270, 1.057980, -2.778150, 2.272780, 
+
+  };
+
+  /* unit definition section (see also UnitType) */
+  static UnitType Units[24] = 
+  {
+    { 0.0, 0.0, 0, NULL , NULL },
+    { /* unit 1 (Old: 1) */
+      0.0, -0.489050, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 2 (Old: 2) */
+      0.0, 0.314600, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 3 (Old: 3) */
+      0.0, 0.777830, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 4 (Old: 4) */
+      0.0, 0.155320, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 5 (Old: 5) */
+      0.0, 0.837780, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 6 (Old: 6) */
+      0.0, -0.712880, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 7 (Old: 7) */
+      0.0, 0.002400, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 8 (Old: 8) */
+      0.0, 0.042370, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 9 (Old: 9) */
+      0.0, -0.381620, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 10 (Old: 10) */
+      0.0, -0.669190, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 11 (Old: 11) */
+      0.0, 0.074200, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 12 (Old: 12) */
+      0.0, -0.155280, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 13 (Old: 13) */
+      0.0, -0.067950, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 14 (Old: 14) */
+      0.0, 0.948220, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 15 (Old: 15) */
+      0.0, -0.346610, 14,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 16 (Old: 16) */
+      0.0, 1.026970, 14,
+       &Sources[14] , 
+       &Weights[14] , 
+      },
+    { /* unit 17 (Old: 17) */
+      0.0, -1.325400, 14,
+       &Sources[28] , 
+       &Weights[28] , 
+      },
+    { /* unit 18 (Old: 18) */
+      0.0, -0.536750, 14,
+       &Sources[42] , 
+       &Weights[42] , 
+      },
+    { /* unit 19 (Old: 19) */
+      0.0, 1.015300, 14,
+       &Sources[56] , 
+       &Weights[56] , 
+      },
+    { /* unit 20 (Old: 20) */
+      0.0, -0.407300, 14,
+       &Sources[70] , 
+       &Weights[70] , 
+      },
+    { /* unit 21 (Old: 21) */
+      0.0, 0.036180, 14,
+       &Sources[84] , 
+       &Weights[84] , 
+      },
+    { /* unit 22 (Old: 22) */
+      0.0, 0.475610, 14,
+       &Sources[98] , 
+       &Weights[98] , 
+      },
+    { /* unit 23 (Old: 23) */
+      0.0, -1.036240, 8,
+       &Sources[112] , 
+       &Weights[112] , 
+      }
+
+  };
+
+
+
+int missing(float *in, float *out, int init)
+{
+  int member, source;
+  float sum;
+  enum{OK, Error, Not_Valid};
+  pUnit unit;
+
+
+  /* layer definition section (names & member units) */
+
+  static pUnit Input[14] = {Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, Units + 11, Units + 12, Units + 13, Units + 14}; /* members */
+
+  static pUnit Hidden1[8] = {Units + 15, Units + 16, Units + 17, Units + 18, Units + 19, Units + 20, Units + 21, Units + 22}; /* members */
+
+  static pUnit Output1[1] = {Units + 23}; /* members */
+
+  static int Output[1] = {23};
+
+  for(member = 0; member < 14; member++) {
+    Input[member]->act = in[member];
+  }
+
+  for (member = 0; member < 8; member++) {
+    unit = Hidden1[member];
+    sum = 0.0;
+    for (source = 0; source < unit->NoOfSources; source++) {
+      sum += unit->sources[source]->act
+             * unit->weights[source];
+    }
+    unit->act = Act_Logistic(sum, unit->Bias);
+  };
+
+  for (member = 0; member < 1; member++) {
+    unit = Output1[member];
+    sum = 0.0;
+    for (source = 0; source < unit->NoOfSources; source++) {
+      sum += unit->sources[source]->act
+             * unit->weights[source];
+    }
+    unit->act = Act_Logistic(sum, unit->Bias);
+  };
+
+  for(member = 0; member < 1; member++) {
+    out[member] = Units[Output[member]].act;
+  }
+
+  return(OK);
+}
diff --git a/src/knn_alf/missing.h b/src/knn_alf/missing.h
new file mode 100644
index 0000000..2f88d4e
--- /dev/null
+++ b/src/knn_alf/missing.h
@@ -0,0 +1,14 @@
+/*********************************************************
+  missing.h
+  --------------------------------------------------------
+  generated at Tue Feb 29 16:27:52 2000
+  by snns2c ( Bernward Kett 1995 ) 
+*********************************************************/
+
+extern int missing(float *in, float *out, int init);
+
+static struct {
+  int NoOfInput;    /* Number of Input Units  */
+  int NoOfOutput;   /* Number of Output Units */
+  int(* propFunc)(float *, float*, int);
+} missingREC = {14,1,missing};
diff --git a/src/knn_alf/ncall.c b/src/knn_alf/ncall.c
new file mode 100644
index 0000000..4c60183
--- /dev/null
+++ b/src/knn_alf/ncall.c
@@ -0,0 +1,176 @@
+/*********************************************************
+  ncall.c
+  --------------------------------------------------------
+  generated at Tue Feb 29 16:27:52 2000
+  by snns2c ( Bernward Kett 1995 ) 
+*********************************************************/
+
+#include <math.h>
+
+#define Act_Logistic(sum, bias)  ( (sum+bias<10000.0) ? ( 1.0/(1.0 + exp(-sum-bias) ) ) : 0.0 )
+#define NULL (void *)0
+
+typedef struct UT {
+          float act;         /* Activation       */
+          float Bias;        /* Bias of the Unit */
+          int   NoOfSources; /* Number of predecessor units */
+   struct UT   **sources; /* predecessor units */
+          float *weights; /* weights from predecessor units */
+        } UnitType, *pUnit;
+
+  /* Forward Declaration for all unit types */
+  static UnitType Units[16];
+  /* Sources definition section */
+  static pUnit Sources[] =  {
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, 
+Units + 10, Units + 11, Units + 12, Units + 13, Units + 14, 
+
+  };
+
+  /* Weigths definition section */
+  static float Weights[] =  {
+0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 
+0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 
+0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 
+0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 
+0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 
+0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 
+
+  };
+
+  /* unit definition section (see also UnitType) */
+  static UnitType Units[16] = 
+  {
+    { 0.0, 0.0, 0, NULL , NULL },
+    { /* unit 1 (Old: 1) */
+      0.0, 0.000000, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 2 (Old: 2) */
+      0.0, 0.000000, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 3 (Old: 3) */
+      0.0, 0.000000, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 4 (Old: 4) */
+      0.0, 0.000000, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 5 (Old: 5) */
+      0.0, 0.000000, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 6 (Old: 6) */
+      0.0, 0.000000, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 7 (Old: 7) */
+      0.0, 0.000000, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 8 (Old: 8) */
+      0.0, 0.000000, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 9 (Old: 9) */
+      0.0, 0.000000, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 10 (Old: 10) */
+      0.0, 0.000000, 9,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 11 (Old: 11) */
+      0.0, 0.000000, 9,
+       &Sources[9] , 
+       &Weights[9] , 
+      },
+    { /* unit 12 (Old: 12) */
+      0.0, 0.000000, 9,
+       &Sources[18] , 
+       &Weights[18] , 
+      },
+    { /* unit 13 (Old: 13) */
+      0.0, 0.000000, 9,
+       &Sources[27] , 
+       &Weights[27] , 
+      },
+    { /* unit 14 (Old: 14) */
+      0.0, 0.000000, 9,
+       &Sources[36] , 
+       &Weights[36] , 
+      },
+    { /* unit 15 (Old: 15) */
+      0.0, 0.000000, 5,
+       &Sources[45] , 
+       &Weights[45] , 
+      }
+
+  };
+
+
+
+int ncall(float *in, float *out, int init)
+{
+  int member, source;
+  float sum;
+  enum{OK, Error, Not_Valid};
+  pUnit unit;
+
+
+  /* layer definition section (names & member units) */
+
+  static pUnit Input[9] = {Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9}; /* members */
+
+  static pUnit Hidden1[5] = {Units + 10, Units + 11, Units + 12, Units + 13, Units + 14}; /* members */
+
+  static pUnit Output1[1] = {Units + 15}; /* members */
+
+  static int Output[1] = {15};
+
+  for(member = 0; member < 9; member++) {
+    Input[member]->act = in[member];
+  }
+
+  for (member = 0; member < 5; member++) {
+    unit = Hidden1[member];
+    sum = 0.0;
+    for (source = 0; source < unit->NoOfSources; source++) {
+      sum += unit->sources[source]->act
+             * unit->weights[source];
+    }
+    unit->act = Act_Logistic(sum, unit->Bias);
+  };
+
+  for (member = 0; member < 1; member++) {
+    unit = Output1[member];
+    sum = 0.0;
+    for (source = 0; source < unit->NoOfSources; source++) {
+      sum += unit->sources[source]->act
+             * unit->weights[source];
+    }
+    unit->act = Act_Logistic(sum, unit->Bias);
+  };
+
+  for(member = 0; member < 1; member++) {
+    out[member] = Units[Output[member]].act;
+  }
+
+  return(OK);
+}
diff --git a/src/knn_alf/ncall.h b/src/knn_alf/ncall.h
new file mode 100644
index 0000000..5104526
--- /dev/null
+++ b/src/knn_alf/ncall.h
@@ -0,0 +1,14 @@
+/*********************************************************
+  ncall.h
+  --------------------------------------------------------
+  generated at Tue Feb 29 16:27:52 2000
+  by snns2c ( Bernward Kett 1995 ) 
+*********************************************************/
+
+extern int ncall(float *in, float *out, int init);
+
+static struct {
+  int NoOfInput;    /* Number of Input Units  */
+  int NoOfOutput;   /* Number of Output Units */
+  int(* propFunc)(float *, float*, int);
+} ncallREC = {9,1,ncall};
diff --git a/src/knn_alf/nplus.c b/src/knn_alf/nplus.c
new file mode 100644
index 0000000..a7f1afe
--- /dev/null
+++ b/src/knn_alf/nplus.c
@@ -0,0 +1,159 @@
+/*********************************************************
+  nplus.c
+  --------------------------------------------------------
+  generated at Tue Feb 29 16:27:52 2000
+  by snns2c ( Bernward Kett 1995 ) 
+*********************************************************/
+
+#include <math.h>
+
+#define Act_Logistic(sum, bias)  ( (sum+bias<10000.0) ? ( 1.0/(1.0 + exp(-sum-bias) ) ) : 0.0 )
+#define NULL (void *)0
+
+typedef struct UT {
+          float act;         /* Activation       */
+          float Bias;        /* Bias of the Unit */
+          int   NoOfSources; /* Number of predecessor units */
+   struct UT   **sources; /* predecessor units */
+          float *weights; /* weights from predecessor units */
+        } UnitType, *pUnit;
+
+  /* Forward Declaration for all unit types */
+  static UnitType Units[13];
+  /* Sources definition section */
+  static pUnit Sources[] =  {
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, 
+Units + 8, Units + 9, Units + 10, Units + 11, 
+
+  };
+
+  /* Weigths definition section */
+  static float Weights[] =  {
+0.383750, -3.785780, 2.561380, -0.080500, 1.967470, 1.961440, -0.237310, 
+-0.069180, -2.196420, 1.659500, 0.093840, 1.988610, 1.169960, -0.494460, 
+0.005600, -3.731170, 1.729160, 0.602080, 2.120740, 1.771150, 0.536360, 
+0.041810, 3.964270, -2.570720, -0.242730, -2.557900, -0.515340, -0.791130, 
+4.330270, 2.795560, 3.835630, -5.290350, 
+
+  };
+
+  /* unit definition section (see also UnitType) */
+  static UnitType Units[13] = 
+  {
+    { 0.0, 0.0, 0, NULL , NULL },
+    { /* unit 1 (Old: 1) */
+      0.0, -0.489050, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 2 (Old: 2) */
+      0.0, 0.314600, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 3 (Old: 3) */
+      0.0, 0.777830, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 4 (Old: 4) */
+      0.0, 0.155320, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 5 (Old: 5) */
+      0.0, 0.837780, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 6 (Old: 6) */
+      0.0, -0.712880, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 7 (Old: 7) */
+      0.0, 0.002400, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 8 (Old: 8) */
+      0.0, 0.191920, 7,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 9 (Old: 9) */
+      0.0, -0.027840, 7,
+       &Sources[7] , 
+       &Weights[7] , 
+      },
+    { /* unit 10 (Old: 10) */
+      0.0, 1.090890, 7,
+       &Sources[14] , 
+       &Weights[14] , 
+      },
+    { /* unit 11 (Old: 11) */
+      0.0, -0.679520, 7,
+       &Sources[21] , 
+       &Weights[21] , 
+      },
+    { /* unit 12 (Old: 12) */
+      0.0, -2.739330, 4,
+       &Sources[28] , 
+       &Weights[28] , 
+      }
+
+  };
+
+
+
+int nplus(float *in, float *out, int init)
+{
+  int member, source;
+  float sum;
+  enum{OK, Error, Not_Valid};
+  pUnit unit;
+
+
+  /* layer definition section (names & member units) */
+
+  static pUnit Input[7] = {Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7}; /* members */
+
+  static pUnit Hidden1[4] = {Units + 8, Units + 9, Units + 10, Units + 11}; /* members */
+
+  static pUnit Output1[1] = {Units + 12}; /* members */
+
+  static int Output[1] = {12};
+
+  for(member = 0; member < 7; member++) {
+    Input[member]->act = in[member];
+  }
+
+  for (member = 0; member < 4; member++) {
+    unit = Hidden1[member];
+    sum = 0.0;
+    for (source = 0; source < unit->NoOfSources; source++) {
+      sum += unit->sources[source]->act
+             * unit->weights[source];
+    }
+    unit->act = Act_Logistic(sum, unit->Bias);
+  };
+
+  for (member = 0; member < 1; member++) {
+    unit = Output1[member];
+    sum = 0.0;
+    for (source = 0; source < unit->NoOfSources; source++) {
+      sum += unit->sources[source]->act
+             * unit->weights[source];
+    }
+    unit->act = Act_Logistic(sum, unit->Bias);
+  };
+
+  for(member = 0; member < 1; member++) {
+    out[member] = Units[Output[member]].act;
+  }
+
+  return(OK);
+}
diff --git a/src/knn_alf/nplus.h b/src/knn_alf/nplus.h
new file mode 100644
index 0000000..15e66a3
--- /dev/null
+++ b/src/knn_alf/nplus.h
@@ -0,0 +1,14 @@
+/*********************************************************
+  nplus.h
+  --------------------------------------------------------
+  generated at Tue Feb 29 16:27:52 2000
+  by snns2c ( Bernward Kett 1995 ) 
+*********************************************************/
+
+extern int nplus(float *in, float *out, int init);
+
+static struct {
+  int NoOfInput;    /* Number of Input Units  */
+  int NoOfOutput;   /* Number of Output Units */
+  int(* propFunc)(float *, float*, int);
+} nplusREC = {7,1,nplus};
diff --git a/src/knn_alf/over.c b/src/knn_alf/over.c
new file mode 100644
index 0000000..1ce7b57
--- /dev/null
+++ b/src/knn_alf/over.c
@@ -0,0 +1,224 @@
+/*********************************************************
+  over.c
+  --------------------------------------------------------
+  generated at Tue Feb 29 16:27:52 2000
+  by snns2c ( Bernward Kett 1995 ) 
+*********************************************************/
+
+#include <math.h>
+
+#define Act_Logistic(sum, bias)  ( (sum+bias<10000.0) ? ( 1.0/(1.0 + exp(-sum-bias) ) ) : 0.0 )
+#define NULL (void *)0
+
+typedef struct UT {
+          float act;         /* Activation       */
+          float Bias;        /* Bias of the Unit */
+          int   NoOfSources; /* Number of predecessor units */
+   struct UT   **sources; /* predecessor units */
+          float *weights; /* weights from predecessor units */
+        } UnitType, *pUnit;
+
+  /* Forward Declaration for all unit types */
+  static UnitType Units[22];
+  /* Sources definition section */
+  static pUnit Sources[] =  {
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, 
+Units + 14, Units + 15, Units + 16, Units + 17, Units + 18, Units + 19, Units + 20, 
+
+  };
+
+  /* Weigths definition section */
+  static float Weights[] =  {
+-0.918370, 0.370610, 1.419830, 0.291790, -0.305740, 0.457350, -1.196380, -0.175770, -2.659160, 0.733330, 
+0.310130, -3.870330, -1.625070, 
+0.915850, 0.127310, -0.645950, -0.631970, 1.637260, 0.471990, 0.687560, 0.017850, -1.299840, 0.266150, 
+-0.362100, -0.473790, -0.285090, 
+-3.364300, 0.211250, 0.091130, -1.333520, 1.250740, 2.097380, -0.773040, 0.390560, 3.853620, 1.748080, 
+1.149280, 0.170110, 0.911580, 
+6.011590, -1.431990, -5.931900, -1.080570, -0.754630, 1.945610, 2.263600, 3.397350, 0.691530, 1.166110, 
+-0.297710, 1.999240, -1.013310, 
+4.052380, -2.356590, -1.414310, -1.499220, 4.025910, 2.307680, 0.387890, 1.207810, 0.986170, -1.624860, 
+-0.144260, 1.310330, -0.974570, 
+-0.749680, 0.732430, 0.560220, 0.714560, -0.222730, -1.934050, -1.542080, 4.318600, -3.202300, 0.713290, 
+-0.229660, -0.556860, -1.880610, 
+-4.263560, -0.677420, 3.185130, 0.011430, -2.323510, 0.208840, -1.990960, 2.176030, 2.153380, -2.045750, 
+-2.845090, -1.417130, 2.885740, 
+-5.088340, 0.941440, -4.849660, 7.412120, 6.326800, -3.988370, -6.462060, 
+
+  };
+
+  /* unit definition section (see also UnitType) */
+  static UnitType Units[22] = 
+  {
+    { 0.0, 0.0, 0, NULL , NULL },
+    { /* unit 1 (Old: 1) */
+      0.0, -0.489050, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 2 (Old: 2) */
+      0.0, 0.314600, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 3 (Old: 3) */
+      0.0, 0.777830, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 4 (Old: 4) */
+      0.0, 0.155320, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 5 (Old: 5) */
+      0.0, 0.837780, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 6 (Old: 6) */
+      0.0, -0.712880, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 7 (Old: 7) */
+      0.0, 0.002400, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 8 (Old: 8) */
+      0.0, 0.042370, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 9 (Old: 9) */
+      0.0, -0.381620, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 10 (Old: 10) */
+      0.0, -0.669190, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 11 (Old: 11) */
+      0.0, 0.074200, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 12 (Old: 12) */
+      0.0, -0.155280, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 13 (Old: 13) */
+      0.0, -0.067950, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 14 (Old: 14) */
+      0.0, 2.274920, 13,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 15 (Old: 15) */
+      0.0, 0.058120, 13,
+       &Sources[13] , 
+       &Weights[13] , 
+      },
+    { /* unit 16 (Old: 16) */
+      0.0, 0.127750, 13,
+       &Sources[26] , 
+       &Weights[26] , 
+      },
+    { /* unit 17 (Old: 17) */
+      0.0, -0.708540, 13,
+       &Sources[39] , 
+       &Weights[39] , 
+      },
+    { /* unit 18 (Old: 18) */
+      0.0, -1.144540, 13,
+       &Sources[52] , 
+       &Weights[52] , 
+      },
+    { /* unit 19 (Old: 19) */
+      0.0, 1.236020, 13,
+       &Sources[65] , 
+       &Weights[65] , 
+      },
+    { /* unit 20 (Old: 20) */
+      0.0, 0.280990, 13,
+       &Sources[78] , 
+       &Weights[78] , 
+      },
+    { /* unit 21 (Old: 21) */
+      0.0, 0.303350, 7,
+       &Sources[91] , 
+       &Weights[91] , 
+      }
+
+  };
+
+
+
+int over(float *in, float *out, int init)
+{
+  int member, source;
+  float sum;
+  enum{OK, Error, Not_Valid};
+  pUnit unit;
+
+
+  /* layer definition section (names & member units) */
+
+  static pUnit Input[13] = {Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, Units + 11, Units + 12, Units + 13}; /* members */
+
+  static pUnit Hidden1[7] = {Units + 14, Units + 15, Units + 16, Units + 17, Units + 18, Units + 19, Units + 20}; /* members */
+
+  static pUnit Output1[1] = {Units + 21}; /* members */
+
+  static int Output[1] = {21};
+
+  for(member = 0; member < 13; member++) {
+    Input[member]->act = in[member];
+  }
+
+  for (member = 0; member < 7; member++) {
+    unit = Hidden1[member];
+    sum = 0.0;
+    for (source = 0; source < unit->NoOfSources; source++) {
+      sum += unit->sources[source]->act
+             * unit->weights[source];
+    }
+    unit->act = Act_Logistic(sum, unit->Bias);
+  };
+
+  for (member = 0; member < 1; member++) {
+    unit = Output1[member];
+    sum = 0.0;
+    for (source = 0; source < unit->NoOfSources; source++) {
+      sum += unit->sources[source]->act
+             * unit->weights[source];
+    }
+    unit->act = Act_Logistic(sum, unit->Bias);
+  };
+
+  for(member = 0; member < 1; member++) {
+    out[member] = Units[Output[member]].act;
+  }
+
+  return(OK);
+}
diff --git a/src/knn_alf/over.h b/src/knn_alf/over.h
new file mode 100644
index 0000000..b4c9dc4
--- /dev/null
+++ b/src/knn_alf/over.h
@@ -0,0 +1,14 @@
+/*********************************************************
+  over.h
+  --------------------------------------------------------
+  generated at Tue Feb 29 16:27:52 2000
+  by snns2c ( Bernward Kett 1995 ) 
+*********************************************************/
+
+extern int over(float *in, float *out, int init);
+
+static struct {
+  int NoOfInput;    /* Number of Input Units  */
+  int NoOfOutput;   /* Number of Output Units */
+  int(* propFunc)(float *, float*, int);
+} overREC = {13,1,over};
diff --git a/src/knn_alf/under.c b/src/knn_alf/under.c
new file mode 100644
index 0000000..a8e889d
--- /dev/null
+++ b/src/knn_alf/under.c
@@ -0,0 +1,224 @@
+/*********************************************************
+  under.c
+  --------------------------------------------------------
+  generated at Tue Feb 29 16:27:52 2000
+  by snns2c ( Bernward Kett 1995 ) 
+*********************************************************/
+
+#include <math.h>
+
+#define Act_Logistic(sum, bias)  ( (sum+bias<10000.0) ? ( 1.0/(1.0 + exp(-sum-bias) ) ) : 0.0 )
+#define NULL (void *)0
+
+typedef struct UT {
+          float act;         /* Activation       */
+          float Bias;        /* Bias of the Unit */
+          int   NoOfSources; /* Number of predecessor units */
+   struct UT   **sources; /* predecessor units */
+          float *weights; /* weights from predecessor units */
+        } UnitType, *pUnit;
+
+  /* Forward Declaration for all unit types */
+  static UnitType Units[22];
+  /* Sources definition section */
+  static pUnit Sources[] =  {
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, 
+Units + 11, Units + 12, Units + 13, 
+Units + 14, Units + 15, Units + 16, Units + 17, Units + 18, Units + 19, Units + 20, 
+
+  };
+
+  /* Weigths definition section */
+  static float Weights[] =  {
+-0.121620, -0.229650, -0.823380, -2.905130, 0.686760, 0.126550, -0.759800, 1.402180, 0.573010, 7.778510, 
+-3.309840, -0.245130, 1.686710, 
+-4.205530, 4.003810, 2.832970, -3.229900, 3.578260, 3.092170, 2.128760, -5.190020, -0.253670, 3.793810, 
+1.422560, 0.494220, -0.012320, 
+-0.154100, 0.885540, 0.268240, -8.324870, 0.488750, -1.719580, -3.093420, 5.538470, 5.805040, 0.257900, 
+1.558270, 1.933320, 0.134210, 
+-4.843140, 4.541890, -0.813390, -2.224750, -4.703660, 0.103560, 2.262650, 2.259110, 3.737190, -1.419830, 
+-0.803930, -0.900670, -0.633970, 
+-10.058550, 6.589460, 0.755010, 3.045690, 2.331790, 0.637010, 2.260530, 1.434680, 0.958410, 0.704530, 
+0.603110, 1.714440, 0.647160, 
+-0.999510, -0.580070, -1.991490, -0.064530, -2.759080, -0.600010, -1.780430, 5.260690, -1.301850, 1.421830, 
+-0.025900, 0.022520, -0.949510, 
+2.457970, -3.126870, 0.642770, -2.040750, -1.390250, 1.383280, -1.362000, -0.882310, -0.176850, -2.550730, 
+0.610280, -2.589600, 1.345880, 
+-6.400270, 7.088050, -8.249350, 5.243170, 6.116480, -2.840860, -3.708750, 
+
+  };
+
+  /* unit definition section (see also UnitType) */
+  static UnitType Units[22] = 
+  {
+    { 0.0, 0.0, 0, NULL , NULL },
+    { /* unit 1 (Old: 1) */
+      0.0, -0.489050, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 2 (Old: 2) */
+      0.0, 0.314600, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 3 (Old: 3) */
+      0.0, 0.777830, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 4 (Old: 4) */
+      0.0, 0.155320, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 5 (Old: 5) */
+      0.0, 0.837780, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 6 (Old: 6) */
+      0.0, -0.712880, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 7 (Old: 7) */
+      0.0, 0.002400, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 8 (Old: 8) */
+      0.0, 0.042370, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 9 (Old: 9) */
+      0.0, -0.381620, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 10 (Old: 10) */
+      0.0, -0.669190, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 11 (Old: 11) */
+      0.0, 0.074200, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 12 (Old: 12) */
+      0.0, -0.155280, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 13 (Old: 13) */
+      0.0, -0.067950, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 14 (Old: 14) */
+      0.0, 0.215660, 13,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 15 (Old: 15) */
+      0.0, 0.347620, 13,
+       &Sources[13] , 
+       &Weights[13] , 
+      },
+    { /* unit 16 (Old: 16) */
+      0.0, 0.082590, 13,
+       &Sources[26] , 
+       &Weights[26] , 
+      },
+    { /* unit 17 (Old: 17) */
+      0.0, -0.424250, 13,
+       &Sources[39] , 
+       &Weights[39] , 
+      },
+    { /* unit 18 (Old: 18) */
+      0.0, -2.696320, 13,
+       &Sources[52] , 
+       &Weights[52] , 
+      },
+    { /* unit 19 (Old: 19) */
+      0.0, -0.914310, 13,
+       &Sources[65] , 
+       &Weights[65] , 
+      },
+    { /* unit 20 (Old: 20) */
+      0.0, 0.655430, 13,
+       &Sources[78] , 
+       &Weights[78] , 
+      },
+    { /* unit 21 (Old: 21) */
+      0.0, 2.759120, 7,
+       &Sources[91] , 
+       &Weights[91] , 
+      }
+
+  };
+
+
+
+int under(float *in, float *out, int init)
+{
+  int member, source;
+  float sum;
+  enum{OK, Error, Not_Valid};
+  pUnit unit;
+
+
+  /* layer definition section (names & member units) */
+
+  static pUnit Input[13] = {Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, Units + 10, Units + 11, Units + 12, Units + 13}; /* members */
+
+  static pUnit Hidden1[7] = {Units + 14, Units + 15, Units + 16, Units + 17, Units + 18, Units + 19, Units + 20}; /* members */
+
+  static pUnit Output1[1] = {Units + 21}; /* members */
+
+  static int Output[1] = {21};
+
+  for(member = 0; member < 13; member++) {
+    Input[member]->act = in[member];
+  }
+
+  for (member = 0; member < 7; member++) {
+    unit = Hidden1[member];
+    sum = 0.0;
+    for (source = 0; source < unit->NoOfSources; source++) {
+      sum += unit->sources[source]->act
+             * unit->weights[source];
+    }
+    unit->act = Act_Logistic(sum, unit->Bias);
+  };
+
+  for (member = 0; member < 1; member++) {
+    unit = Output1[member];
+    sum = 0.0;
+    for (source = 0; source < unit->NoOfSources; source++) {
+      sum += unit->sources[source]->act
+             * unit->weights[source];
+    }
+    unit->act = Act_Logistic(sum, unit->Bias);
+  };
+
+  for(member = 0; member < 1; member++) {
+    out[member] = Units[Output[member]].act;
+  }
+
+  return(OK);
+}
diff --git a/src/knn_alf/under.h b/src/knn_alf/under.h
new file mode 100644
index 0000000..fef2011
--- /dev/null
+++ b/src/knn_alf/under.h
@@ -0,0 +1,14 @@
+/*********************************************************
+  under.h
+  --------------------------------------------------------
+  generated at Tue Feb 29 16:27:52 2000
+  by snns2c ( Bernward Kett 1995 ) 
+*********************************************************/
+
+extern int under(float *in, float *out, int init);
+
+static struct {
+  int NoOfInput;    /* Number of Input Units  */
+  int NoOfOutput;   /* Number of Output Units */
+  int(* propFunc)(float *, float*, int);
+} underREC = {13,1,under};
diff --git a/src/knn_alf/wrong.c b/src/knn_alf/wrong.c
new file mode 100644
index 0000000..a36df7f
--- /dev/null
+++ b/src/knn_alf/wrong.c
@@ -0,0 +1,176 @@
+/*********************************************************
+  wrong.c
+  --------------------------------------------------------
+  generated at Tue Feb 29 16:27:52 2000
+  by snns2c ( Bernward Kett 1995 ) 
+*********************************************************/
+
+#include <math.h>
+
+#define Act_Logistic(sum, bias)  ( (sum+bias<10000.0) ? ( 1.0/(1.0 + exp(-sum-bias) ) ) : 0.0 )
+#define NULL (void *)0
+
+typedef struct UT {
+          float act;         /* Activation       */
+          float Bias;        /* Bias of the Unit */
+          int   NoOfSources; /* Number of predecessor units */
+   struct UT   **sources; /* predecessor units */
+          float *weights; /* weights from predecessor units */
+        } UnitType, *pUnit;
+
+  /* Forward Declaration for all unit types */
+  static UnitType Units[16];
+  /* Sources definition section */
+  static pUnit Sources[] =  {
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, 
+Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9, 
+Units + 10, Units + 11, Units + 12, Units + 13, Units + 14, 
+
+  };
+
+  /* Weigths definition section */
+  static float Weights[] =  {
+0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 
+0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 
+0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 
+0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 
+0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 
+0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 
+
+  };
+
+  /* unit definition section (see also UnitType) */
+  static UnitType Units[16] = 
+  {
+    { 0.0, 0.0, 0, NULL , NULL },
+    { /* unit 1 (Old: 1) */
+      0.0, 0.000000, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 2 (Old: 2) */
+      0.0, 0.000000, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 3 (Old: 3) */
+      0.0, 0.000000, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 4 (Old: 4) */
+      0.0, 0.000000, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 5 (Old: 5) */
+      0.0, 0.000000, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 6 (Old: 6) */
+      0.0, 0.000000, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 7 (Old: 7) */
+      0.0, 0.000000, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 8 (Old: 8) */
+      0.0, 0.000000, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 9 (Old: 9) */
+      0.0, 0.000000, 0,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 10 (Old: 10) */
+      0.0, 0.000000, 9,
+       &Sources[0] , 
+       &Weights[0] , 
+      },
+    { /* unit 11 (Old: 11) */
+      0.0, 0.000000, 9,
+       &Sources[9] , 
+       &Weights[9] , 
+      },
+    { /* unit 12 (Old: 12) */
+      0.0, 0.000000, 9,
+       &Sources[18] , 
+       &Weights[18] , 
+      },
+    { /* unit 13 (Old: 13) */
+      0.0, 0.000000, 9,
+       &Sources[27] , 
+       &Weights[27] , 
+      },
+    { /* unit 14 (Old: 14) */
+      0.0, 0.000000, 9,
+       &Sources[36] , 
+       &Weights[36] , 
+      },
+    { /* unit 15 (Old: 15) */
+      0.0, 0.000000, 5,
+       &Sources[45] , 
+       &Weights[45] , 
+      }
+
+  };
+
+
+
+int wrong(float *in, float *out, int init)
+{
+  int member, source;
+  float sum;
+  enum{OK, Error, Not_Valid};
+  pUnit unit;
+
+
+  /* layer definition section (names & member units) */
+
+  static pUnit Input[9] = {Units + 1, Units + 2, Units + 3, Units + 4, Units + 5, Units + 6, Units + 7, Units + 8, Units + 9}; /* members */
+
+  static pUnit Hidden1[5] = {Units + 10, Units + 11, Units + 12, Units + 13, Units + 14}; /* members */
+
+  static pUnit Output1[1] = {Units + 15}; /* members */
+
+  static int Output[1] = {15};
+
+  for(member = 0; member < 9; member++) {
+    Input[member]->act = in[member];
+  }
+
+  for (member = 0; member < 5; member++) {
+    unit = Hidden1[member];
+    sum = 0.0;
+    for (source = 0; source < unit->NoOfSources; source++) {
+      sum += unit->sources[source]->act
+             * unit->weights[source];
+    }
+    unit->act = Act_Logistic(sum, unit->Bias);
+  };
+
+  for (member = 0; member < 1; member++) {
+    unit = Output1[member];
+    sum = 0.0;
+    for (source = 0; source < unit->NoOfSources; source++) {
+      sum += unit->sources[source]->act
+             * unit->weights[source];
+    }
+    unit->act = Act_Logistic(sum, unit->Bias);
+  };
+
+  for(member = 0; member < 1; member++) {
+    out[member] = Units[Output[member]].act;
+  }
+
+  return(OK);
+}
diff --git a/src/knn_alf/wrong.h b/src/knn_alf/wrong.h
new file mode 100644
index 0000000..195a733
--- /dev/null
+++ b/src/knn_alf/wrong.h
@@ -0,0 +1,14 @@
+/*********************************************************
+  wrong.h
+  --------------------------------------------------------
+  generated at Tue Feb 29 16:27:52 2000
+  by snns2c ( Bernward Kett 1995 ) 
+*********************************************************/
+
+extern int wrong(float *in, float *out, int init);
+
+static struct {
+  int NoOfInput;    /* Number of Input Units  */
+  int NoOfOutput;   /* Number of Output Units */
+  int(* propFunc)(float *, float*, int);
+} wrongREC = {9,1,wrong};
diff --git a/src/lec/Makefile.am b/src/lec/Makefile.am
new file mode 100644
index 0000000..b48b54e
--- /dev/null
+++ b/src/lec/Makefile.am
@@ -0,0 +1,6 @@
+INCLUDES = -I$(top_srcdir)/src $(all_includes)
+
+#noinst_LIBRARIES = liblec.a
+#liblec_a_SOURCES= lec.C
+#noinst_HEADERS= lec.H
+
diff --git a/src/scripts/Makefile.in b/src/lec/Makefile.in
similarity index 79%
copy from src/scripts/Makefile.in
copy to src/lec/Makefile.in
index c20f441..01c24bd 100644
--- a/src/scripts/Makefile.in
+++ b/src/lec/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,17 +33,25 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
-subdir = src/scripts
+subdir = src/lec
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/ax_boost_base.m4 \
-	$(top_srcdir)/m4/ax_boost_filesystem.m4 \
-	$(top_srcdir)/m4/ax_boost_iostreams.m4 \
-	$(top_srcdir)/m4/ax_boost_regex.m4 \
-	$(top_srcdir)/m4/ax_boost_system.m4 \
-	$(top_srcdir)/m4/ax_boost_thread.m4 \
-	$(top_srcdir)/m4/ax_check_zlib.m4 \
-	$(top_srcdir)/m4/ax_lib_expat.m4 $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/config/m4/ax_boost_base.m4 \
+	$(top_srcdir)/config/m4/ax_boost_regex.m4 \
+	$(top_srcdir)/config/m4/ax_boost_thread.m4 \
+	$(top_srcdir)/config/m4/ax_check_zlib.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_std.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_stl.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_namespaces.m4 \
+	$(top_srcdir)/config/m4/ax_lib_expat.m4 \
+	$(top_srcdir)/config/m4/ax_with_perl.m4 \
+	$(top_srcdir)/config/m4/ax_with_prog.m4 \
+	$(top_srcdir)/config/m4/libtool.m4 \
+	$(top_srcdir)/config/m4/ltoptions.m4 \
+	$(top_srcdir)/config/m4/ltsugar.m4 \
+	$(top_srcdir)/config/m4/ltversion.m4 \
+	$(top_srcdir)/config/m4/lt~obsolete.m4 \
+	$(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -62,13 +70,9 @@ AWK = @AWK@
 BITPACKAGE = @BITPACKAGE@
 BLOODYDARWINSTATLIBDIRHACK = @BLOODYDARWINSTATLIBDIRHACK@
 BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
-BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@
-BOOST_IOSTREAMS_LIB = @BOOST_IOSTREAMS_LIB@
 BOOST_LDFLAGS = @BOOST_LDFLAGS@
 BOOST_REGEX_LIB = @BOOST_REGEX_LIB@
-BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@
 BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
-BUNDLETARGET = @BUNDLETARGET@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
@@ -81,7 +85,6 @@ CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -91,13 +94,11 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LDFLAGS = @EXPAT_LDFLAGS@
-EXPAT_LIBS = @EXPAT_LIBS@
 EXPAT_VERSION = @EXPAT_VERSION@
 FGREP = @FGREP@
 FLEX = @FLEX@
 FLEXPP = @FLEXPP@
 GREP = @GREP@
-HAVE_XXD = @HAVE_XXD@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -115,7 +116,6 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
 MIRASTATIC = @MIRASTATIC@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
@@ -132,17 +132,18 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
+SHORTMIRAAUDIENCE = @SHORTMIRAAUDIENCE@
 STRIP = @STRIP@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -176,6 +177,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -191,7 +193,7 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-EXTRA_DIST = fixACE4consed.tcl fasta2frag.tcl
+INCLUDES = -I$(top_srcdir)/src $(all_includes)
 all: all-am
 
 .SUFFIXES:
@@ -204,9 +206,9 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/scripts/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lec/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu src/scripts/Makefile
+	  $(AUTOMAKE) --gnu src/lec/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -282,15 +284,10 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	if test -z '$(STRIP)'; then \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	      install; \
-	else \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-	fi
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
 mostlyclean-generic:
 
 clean-generic:
@@ -329,8 +326,7 @@ install-dvi: install-dvi-am
 install-dvi-am:
 
 install-exec-am:
-	@$(NORMAL_INSTALL)
-	$(MAKE) $(AM_MAKEFLAGS) install-exec-hook
+
 install-html: install-html-am
 
 install-html-am:
@@ -368,32 +364,24 @@ ps: ps-am
 ps-am:
 
 uninstall-am:
-	@$(NORMAL_INSTALL)
-	$(MAKE) $(AM_MAKEFLAGS) uninstall-hook
-.MAKE: install-am install-exec-am install-strip uninstall-am
+
+.MAKE: install-am install-strip
 
 .PHONY: all all-am check check-am clean clean-generic clean-libtool \
 	distclean distclean-generic distclean-libtool distdir dvi \
 	dvi-am html html-am info info-am install install-am \
 	install-data install-data-am install-dvi install-dvi-am \
-	install-exec install-exec-am install-exec-hook install-html \
-	install-html-am install-info install-info-am install-man \
-	install-pdf install-pdf-am install-ps install-ps-am \
-	install-strip installcheck installcheck-am installdirs \
-	maintainer-clean maintainer-clean-generic mostlyclean \
-	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
-	uninstall uninstall-am uninstall-hook
-
-
-install-exec-hook:
-	rm -f $(DESTDIR)$(bindir)/fixACE4consed.tcl && \
-	cp fixACE4consed.tcl $(DESTDIR)$(bindir)
-	rm -f $(DESTDIR)$(bindir)/fasta2frag.tcl && \
-	cp fasta2frag.tcl $(DESTDIR)$(bindir)
-
-uninstall-hook:
-	rm -f $(DESTDIR)$(bindir)/fixACE4consed.tcl
-	rm -f $(DESTDIR)$(bindir)/fasta2frag.tcl
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+
+
+#noinst_LIBRARIES = liblec.a
+#liblec_a_SOURCES= lec.C
+#noinst_HEADERS= lec.H
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/src/memorc/Makefile.am b/src/memorc/Makefile.am
deleted file mode 100644
index ad74e6a..0000000
--- a/src/memorc/Makefile.am
+++ /dev/null
@@ -1,23 +0,0 @@
-AM_CPPFLAGS = -I$(top_srcdir)/src $(all_includes)
-
-if BUILDMIRASTATIC
-AM_LDFLAGS=  $(BLOODYDARWINSTATLIBDIRHACK) -L../io/ -L../util/ -L../errorhandling/ -L../mira -L../caf/ $(BOOST_LDFLAGS) -all-static
-else
-AM_LDFLAGS=  -L../io/ -L../util/ -L../errorhandling/ -L../mira -L../caf/ $(BOOST_LDFLAGS)
-endif
-
-if BUILDMIRAMEMORC
-MEMORC= -L. -lmemorc
-endif
-
-noinst_LIBRARIES = libmemorc.a
-libmemorc_a_SOURCES= memorc.C
-noinst_HEADERS= memorc.H
-
-noinst_PROGRAMS= main
-
-main.C: memorc.o
-main_SOURCES= main.C
-main_LDADD= $(MEMORC) -lmiraerrorhandling
-
-#main_LDADD= -L../memorc -lmemorc -L../util/ -lmirautil -L../errorhandling/ -lmiraerrorhandling -L../mira/ -lmira -lmirasupport -lpreventinitfiasco
diff --git a/src/memorc/Makefile.in b/src/memorc/Makefile.in
deleted file mode 100644
index b9a57d5..0000000
--- a/src/memorc/Makefile.in
+++ /dev/null
@@ -1,535 +0,0 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
- at SET_MAKE@
-
-
-
-VPATH = @srcdir@
-pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-noinst_PROGRAMS = main$(EXEEXT)
-subdir = src/memorc
-DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
-	$(srcdir)/Makefile.in
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/ax_boost_base.m4 \
-	$(top_srcdir)/m4/ax_boost_filesystem.m4 \
-	$(top_srcdir)/m4/ax_boost_iostreams.m4 \
-	$(top_srcdir)/m4/ax_boost_regex.m4 \
-	$(top_srcdir)/m4/ax_boost_system.m4 \
-	$(top_srcdir)/m4/ax_boost_thread.m4 \
-	$(top_srcdir)/m4/ax_check_zlib.m4 \
-	$(top_srcdir)/m4/ax_lib_expat.m4 $(top_srcdir)/configure.ac
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
-	$(ACLOCAL_M4)
-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
-CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
-LIBRARIES = $(noinst_LIBRARIES)
-ARFLAGS = cru
-libmemorc_a_AR = $(AR) $(ARFLAGS)
-libmemorc_a_LIBADD =
-am_libmemorc_a_OBJECTS = memorc.$(OBJEXT)
-libmemorc_a_OBJECTS = $(am_libmemorc_a_OBJECTS)
-PROGRAMS = $(noinst_PROGRAMS)
-am_main_OBJECTS = main.$(OBJEXT)
-main_OBJECTS = $(am_main_OBJECTS)
-am__DEPENDENCIES_1 =
-main_DEPENDENCIES = $(am__DEPENDENCIES_1)
-DEFAULT_INCLUDES = -I. at am__isrc@
-depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
-am__mv = mv -f
-CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
-	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
-LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
-	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
-CXXLD = $(CXX)
-CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
-	$(LDFLAGS) -o $@
-SOURCES = $(libmemorc_a_SOURCES) $(main_SOURCES)
-DIST_SOURCES = $(libmemorc_a_SOURCES) $(main_SOURCES)
-HEADERS = $(noinst_HEADERS)
-ETAGS = etags
-CTAGS = ctags
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-AMTAR = @AMTAR@
-AR = @AR@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-BITPACKAGE = @BITPACKAGE@
-BLOODYDARWINSTATLIBDIRHACK = @BLOODYDARWINSTATLIBDIRHACK@
-BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
-BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@
-BOOST_IOSTREAMS_LIB = @BOOST_IOSTREAMS_LIB@
-BOOST_LDFLAGS = @BOOST_LDFLAGS@
-BOOST_REGEX_LIB = @BOOST_REGEX_LIB@
-BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@
-BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
-BUNDLETARGET = @BUNDLETARGET@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CXX = @CXX@
-CXXCPP = @CXXCPP@
-CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-EXPAT_CFLAGS = @EXPAT_CFLAGS@
-EXPAT_LDFLAGS = @EXPAT_LDFLAGS@
-EXPAT_LIBS = @EXPAT_LIBS@
-EXPAT_VERSION = @EXPAT_VERSION@
-FGREP = @FGREP@
-FLEX = @FLEX@
-FLEXPP = @FLEXPP@
-GREP = @GREP@
-HAVE_XXD = @HAVE_XXD@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
-LDFLAGS = @LDFLAGS@
-LEX = @LEX@
-LEXLIB = @LEXLIB@
-LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LIPO = @LIPO@
-LN_S = @LN_S@
-LTLIBOBJS = @LTLIBOBJS@
-MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
-MIRASTATIC = @MIRASTATIC@
-MKDIR_P = @MKDIR_P@
-NM = @NM@
-NMEDIT = @NMEDIT@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-RANLIB = @RANLIB@
-SED = @SED@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-STRIP = @STRIP@
-VERSION = @VERSION@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_CXX = @ac_ct_CXX@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-AM_CPPFLAGS = -I$(top_srcdir)/src $(all_includes)
- at BUILDMIRASTATIC_FALSE@AM_LDFLAGS = -L../io/ -L../util/ -L../errorhandling/ -L../mira -L../caf/ $(BOOST_LDFLAGS)
- at BUILDMIRASTATIC_TRUE@AM_LDFLAGS = $(BLOODYDARWINSTATLIBDIRHACK) -L../io/ -L../util/ -L../errorhandling/ -L../mira -L../caf/ $(BOOST_LDFLAGS) -all-static
- at BUILDMIRAMEMORC_TRUE@MEMORC = -L. -lmemorc
-noinst_LIBRARIES = libmemorc.a
-libmemorc_a_SOURCES = memorc.C
-noinst_HEADERS = memorc.H
-main_SOURCES = main.C
-main_LDADD = $(MEMORC) -lmiraerrorhandling
-all: all-am
-
-.SUFFIXES:
-.SUFFIXES: .C .lo .o .obj
-$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
-	@for dep in $?; do \
-	  case '$(am__configure_deps)' in \
-	    *$$dep*) \
-	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
-	        && { if test -f $@; then exit 0; else break; fi; }; \
-	      exit 1;; \
-	  esac; \
-	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/memorc/Makefile'; \
-	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu src/memorc/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
-	@case '$?' in \
-	  *config.status*) \
-	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
-	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
-	esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure:  $(am__configure_deps)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
-
-clean-noinstLIBRARIES:
-	-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
-libmemorc.a: $(libmemorc_a_OBJECTS) $(libmemorc_a_DEPENDENCIES) $(EXTRA_libmemorc_a_DEPENDENCIES) 
-	-rm -f libmemorc.a
-	$(libmemorc_a_AR) libmemorc.a $(libmemorc_a_OBJECTS) $(libmemorc_a_LIBADD)
-	$(RANLIB) libmemorc.a
-
-clean-noinstPROGRAMS:
-	@list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
-	echo " rm -f" $$list; \
-	rm -f $$list || exit $$?; \
-	test -n "$(EXEEXT)" || exit 0; \
-	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
-	echo " rm -f" $$list; \
-	rm -f $$list
-main$(EXEEXT): $(main_OBJECTS) $(main_DEPENDENCIES) $(EXTRA_main_DEPENDENCIES) 
-	@rm -f main$(EXEEXT)
-	$(CXXLINK) $(main_OBJECTS) $(main_LDADD) $(LIBS)
-
-mostlyclean-compile:
-	-rm -f *.$(OBJEXT)
-
-distclean-compile:
-	-rm -f *.tab.c
-
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/main.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/memorc.Po at am__quote@
-
-.C.o:
- at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXXCOMPILE) -c -o $@ $<
-
-.C.obj:
- at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
-
-.C.lo:
- at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(LTCXXCOMPILE) -c -o $@ $<
-
-mostlyclean-libtool:
-	-rm -f *.lo
-
-clean-libtool:
-	-rm -rf .libs _libs
-
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
-	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	mkid -fID $$unique
-tags: TAGS
-
-TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
-	set x; \
-	here=`pwd`; \
-	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	shift; \
-	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
-	  test -n "$$unique" || unique=$$empty_fix; \
-	  if test $$# -gt 0; then \
-	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	      "$$@" $$unique; \
-	  else \
-	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	      $$unique; \
-	  fi; \
-	fi
-ctags: CTAGS
-CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
-	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	test -z "$(CTAGS_ARGS)$$unique" \
-	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-	     $$unique
-
-GTAGS:
-	here=`$(am__cd) $(top_builddir) && pwd` \
-	  && $(am__cd) $(top_srcdir) \
-	  && gtags -i $(GTAGS_ARGS) "$$here"
-
-distclean-tags:
-	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-
-distdir: $(DISTFILES)
-	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-	list='$(DISTFILES)'; \
-	  dist_files=`for file in $$list; do echo $$file; done | \
-	  sed -e "s|^$$srcdirstrip/||;t" \
-	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
-	case $$dist_files in \
-	  */*) $(MKDIR_P) `echo "$$dist_files" | \
-			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
-			   sort -u` ;; \
-	esac; \
-	for file in $$dist_files; do \
-	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-	  if test -d $$d/$$file; then \
-	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
-	    if test -d "$(distdir)/$$file"; then \
-	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-	    fi; \
-	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
-	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-	    fi; \
-	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
-	  else \
-	    test -f "$(distdir)/$$file" \
-	    || cp -p $$d/$$file "$(distdir)/$$file" \
-	    || exit 1; \
-	  fi; \
-	done
-check-am: all-am
-check: check-am
-all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(HEADERS)
-installdirs:
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
-	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
-	if test -z '$(STRIP)'; then \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	      install; \
-	else \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-	fi
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
-	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
-
-maintainer-clean-generic:
-	@echo "This command is intended for maintainers to use"
-	@echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
-
-clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
-	clean-noinstPROGRAMS mostlyclean-am
-
-distclean: distclean-am
-	-rm -rf ./$(DEPDIR)
-	-rm -f Makefile
-distclean-am: clean-am distclean-compile distclean-generic \
-	distclean-tags
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-html-am:
-
-info: info-am
-
-info-am:
-
-install-data-am:
-
-install-dvi: install-dvi-am
-
-install-dvi-am:
-
-install-exec-am:
-
-install-html: install-html-am
-
-install-html-am:
-
-install-info: install-info-am
-
-install-info-am:
-
-install-man:
-
-install-pdf: install-pdf-am
-
-install-pdf-am:
-
-install-ps: install-ps-am
-
-install-ps-am:
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
-	-rm -rf ./$(DEPDIR)
-	-rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
-	mostlyclean-libtool
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am:
-
-.MAKE: install-am install-strip
-
-.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
-	clean-libtool clean-noinstLIBRARIES clean-noinstPROGRAMS ctags \
-	distclean distclean-compile distclean-generic \
-	distclean-libtool distclean-tags distdir dvi dvi-am html \
-	html-am info info-am install install-am install-data \
-	install-data-am install-dvi install-dvi-am install-exec \
-	install-exec-am install-html install-html-am install-info \
-	install-info-am install-man install-pdf install-pdf-am \
-	install-ps install-ps-am install-strip installcheck \
-	installcheck-am installdirs maintainer-clean \
-	maintainer-clean-generic mostlyclean mostlyclean-compile \
-	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
-	tags uninstall uninstall-am
-
-
-main.C: memorc.o
-
-#main_LDADD= -L../memorc -lmemorc -L../util/ -lmirautil -L../errorhandling/ -lmiraerrorhandling -L../mira/ -lmira -lmirasupport -lpreventinitfiasco
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/src/memorc/main.C b/src/memorc/main.C
deleted file mode 100644
index 122d283..0000000
--- a/src/memorc/main.C
+++ /dev/null
@@ -1,101 +0,0 @@
-#include "memorc.H"
-
-#include <boost/algorithm/string.hpp>
-
-#include "util/misc.H"
-
-using namespace std;
-
-// in MIRA: in preventinifiasco, not in library!
-#ifdef MIRAMEMORC
-MemORC::mbmap_t MemORC::MOC_memblocks;
-MemORC::mbmap_t MemORC::MOC_hotblocks;
-vector<uint64> MemORC::MOC_hotaidsrequested;
-
-MemORC MemORC::MOC_semaphore; // keep last for memorc: when instantiated, sets readytouse
-                   //  when destructed, clears readytouse
-#endif
-
-
-int main2(int argc, char ** argv)
-{
-#ifdef MIREMEMORC
-  cout << "Start 1\n";
-  string xx("sjkfghasfjkh");
-  cout << "Start 2\n";
-  string xxx("sjkfghasfjkh1");
-  cout << "Start 3\n";
-  string xxxx("sjkfghasfjkh2");
-  cout << "Start 4\n";
-  string xxxxx("sjkfghasfjkh3");
-  cout << "Start 5\n";
-  string y=xx;
-  cout << "Start 6\n";
-  y+=xxx;
-  cout << "Start 7\n";
-  y+=xxxx;
-  cout << "Start 8\n";
-  y+=xxxxx;
-  cout << "Start 9\n";
-
-  char * bla;
-  printf("let's go\n");
-  bla=new char[10];
-  printf("got %p\n", bla);
-  fflush(stdout);
-
-  char * ptr=bla;
-
-  for(int32 i=0; i<10; i++, ptr++){
-    *ptr=1;
-  }
-
-  cout << "#### tag" << endl;
-  //multitag_t t;
-
-  cout << "#### string" << endl;
-  string path;
-  string miraprog;
-
-  cout << "#### split" << endl;
-
-
-  // bang almost immediately, at next new/delete call
-  //*(ptr-40)=0;
-  // bang, but later, on the delete[]
-  bla+=2;
-
-
-  splitFullPathAndFileName(argv[0],path,miraprog);
-  cout << "#### done split" << endl;
-
-  cout << "#### lower" << endl;
-  boost::to_lower(miraprog);
-  cout << "#### done lower" << endl;
-
-  cout << "#### cout" << endl;
-//  cout << t;
-
-
-  char * ble;
-  ble=new char[10];
-  delete [] ble;
-  printf("got %p\n", ble);
-
-  delete [] bla;
-#endif
-  return 0;
-}
-
-int main(int argc, char ** argv)
-{
-#ifdef MIRAMEMORC
-  MemORC::setChecking(true);
-  cout << "start 000\n";
-  auto x=main2(argc,argv);
-#else
-  printf("Not compiled with MemORC, cannot test.\n");
-  int x=0;
-#endif
-  return x;
-}
diff --git a/src/memorc/memorc.C b/src/memorc/memorc.C
deleted file mode 100644
index a672a85..0000000
--- a/src/memorc/memorc.C
+++ /dev/null
@@ -1,566 +0,0 @@
-#include "memorc/memorc.H"
-
-#include <cstdlib>      // new(), abort(), free() on Cygwin
-#include <cstdio>       // printf() on Cygwin
-#include <cstring>
-#include <iostream>
-
-
-using namespace std;
-
-bool MemORC::MOC_readytouse=false;
-bool MemORC::MOC_newallocsgetthisnocheckflag=true;
-bool MemORC::MOC_exitset=false;
-
-const int32 MemORC::MOC_fencesize=10;
-
-uint8 MemORC::MOC_clowfencemagic  [4] = {0xab, 0xad, 0xca, 0xfe};
-uint8 MemORC::MOC_chighfencemagic [4] = {0xde, 0xad, 0xbe, 0xef};
-
-int32 MemORC::MOC_lowfencemagic= *((int32 *) MemORC::MOC_clowfencemagic);
-int32 MemORC::MOC_highfencemagic= *((int32 *) MemORC::MOC_chighfencemagic);
-
-uint8 MemORC::MOC_maskmagic=0xaa;
-
-uint32 MemORC::MOC_innewcount=0;
-
-bool MemORC::MOC_mostfatalerroroccured=false;
-bool MemORC::MOC_allhot=false;
-
-bool MemORC::MOC_fillondelete=false;
-
-uint64 MemORC::MOC_alloccounter=0;
-uint64 MemORC::MOC_checksperformed=0;
-
-size_t MemORC::MOC_reqmemalloc=0;
-size_t MemORC::MOC_totalmemalloc=0;
-
-
-
-//#define LEBUG(bla) {bla;}
-#define LEBUG(bla)
-
-#if 1
-/////////////////////////////////////////////////////////////////////
-
-void * operator new[](size_t n)
-{
-  LEBUG(printf("new [] called\n"));
-
-  auto * newmem=MemORC::newMemBlock(n);
-  if(newmem==nullptr) throw std::bad_alloc();
-
-  LEBUG(printf("giving back: %p\n", newmem));
-  return newmem;
-}
-
-void operator delete[](void *mb)
-{
-  LEBUG(printf("delete [] called with adress: %p\n", mb));
-  MemORC::deleteMemBlock(mb);
-}
-
-void * operator new(size_t n)
-{
-  LEBUG(printf("new called\n"));
-
-  auto * newmem=MemORC::newMemBlock(n);
-  if(newmem==nullptr) throw std::bad_alloc();
-
-  LEBUG(printf("giving back: %p\n", newmem));
-  return newmem;
-}
-
-void operator delete(void *mb)
-{
-  LEBUG(printf("delete called with adress: %p\n", mb));
-  MemORC::deleteMemBlock(mb);
-}
-
-/////////////////////////////////////////////////////////////////////
-#else
-/////////////////////////////////////////////////////////////////////
-
-void * operator new[](size_t n)
-{
-  return malloc(n);
-}
-
-void operator delete[](void *mb)
-{
-  free(mb);
-}
-
-void * operator new(size_t n)
-{
-  return malloc(n);
-}
-
-void operator delete(void *mb)
-{
-  free(mb);
-}
-/////////////////////////////////////////////////////////////////////
-#endif
-
-
-MemORC::MemORC()
-{
-  LEBUG(printf("MemORC is ready to use, fencesize %d\n",MOC_fencesize));
-  MOC_readytouse=true;
-}
-
-void MemORC::atExit()
-{
-  LEBUG(printf("exiting, stopping MemORC\n"));
-  statistics();
-}
-
-MemORC::~MemORC()
-{
-  MOC_readytouse=false;
-}
-
-void MemORC::setChecking(bool b)
-{
-  MOC_newallocsgetthisnocheckflag=!b;
-  if(!MOC_exitset){
-    atexit(&MemORC::atExit);
-    MOC_exitset=true;
-  }
-  if(b){
-    printf("memory allocation now checks fences, this will cause some slow down\n");
-  }else{
-    printf("switching off check of fences, checks now apply only to existing memory\n");
-  }
-  LEBUG(printf("MOC_innewcount %d\n", MOC_innewcount));
-}
-
-void MemORC::setAllHot(bool b)
-{
-  MOC_allhot=b;
-  if(b){
-    printf("all hot memory checks, expect major slowdown on large programs\n");
-  }else{
-    printf("all hot now off, things should go faster\n");
-  }
-}
-
-void MemORC::statistics()
-{
-  printf("MemORC statistics:\n");
-  printf("Current alloc counter  : %llu\n", MOC_alloccounter);
-  printf("Total checks performed : %llu\n", MOC_checksperformed);
-  printf("Num. memory blocks     : %llu\n", MOC_memblocks.size());
-  printf("Num. active hot blocks : %llu\n", MOC_hotblocks.size());
-  printf("Num. pending hot blocks: %llu\n", MOC_hotaidsrequested.size());
-  printf("Total mem reqested     : %llu\n", MOC_reqmemalloc);
-  printf("Total mem allocated    : %llu (including pads and fences)\n", MOC_totalmemalloc);
-}
-
-void MemORC::myexit(int32 n)
-{
-  LEBUG(printf("shouldn't check anything anymore\n"));
-  MemORC::MOC_readytouse=false;
-  statistics();
-  abort();
-  exit(n);
-}
-
-
-void * MemORC::internalMAlloc(size_t n)
-{
-  if(MOC_mostfatalerroroccured){
-    abort();
-  }
-  void * newmem=malloc(n);
-  // Most significant bit set? Come on ... not on x86_64! Must be a magic number
-  //  for invalid mem
-  if(reinterpret_cast<uint64>(newmem)&0x8000000000000000ull){
-    MOC_mostfatalerroroccured=true;
-    printf("Houston, we have a malloc pointer problem: %p\n",newmem);
-    statistics();
-    MemORC::checkAllMemBlocks();
-    printf("No error found yet, exiting\n");
-    myexit(1000);
-  }
-  return newmem;
-}
-
-
-void * MemORC::newMemBlock(size_t n)
-{
-  LEBUG(printf("MOC_innewcount %d\n", MOC_innewcount));
-  void * newmem;
-  if(!MOC_readytouse || MOC_innewcount){
-    if(!MOC_readytouse){
-      LEBUG(printf("not ready malloc\n"));
-    }else {
-      LEBUG(printf("innew malloc\n"));
-    }
-    newmem=internalMAlloc(n);
-  }else{
-    ++MOC_innewcount;
-    LEBUG(printf("my malloc, want %llu\n",n));
-
-    if(MOC_allhot){
-      checkAllMemBlocks();
-    } else if(!MOC_hotblocks.empty()){
-      checkAllHotBlocks();
-    }
-
-    size_t totaln= n +  2*(sizeof(MOC_lowfencemagic) * MOC_fencesize);
-
-    if(totaln%4){
-      totaln+=4-(totaln%4);
-    }
-
-    //if(totaln<256)totaln=256;
-    LEBUG(printf("my malloc, getting %llu\n",totaln));
-    newmem=internalMAlloc(totaln);
-    LEBUG(printf("my malloc, addr %p to %p\n",newmem,newmem+totaln));
-
-    if(newmem==nullptr){
-      printf("Used malloc()\nTried to allocate %llu byte.\nSorry, memory allocation failed. Bailing out.\n", totaln);
-      myexit(1);
-    }
-
-    MOC_reqmemalloc+=n;
-    MOC_totalmemalloc+=totaln;
-
-    int32 * magicptr=static_cast<int32*>(newmem);
-    for(int32 i=0; i<MOC_fencesize; ++i) *magicptr++=MOC_lowfencemagic;
-
-    newmem=magicptr;
-    magicptr+=(n/sizeof(int32));
-    *magicptr=0xbbbbbbbb;
-
-    uint8 * maskptr=(uint8 *) magicptr;
-
-    switch(n%4){
-    case 3:{
-      *maskptr++=0;
-      *maskptr++=0;
-      *maskptr++=0;
-      *maskptr++=MOC_maskmagic;
-      break;
-    }
-    case 2:{
-      *maskptr++=0;
-      *maskptr++=0;
-      *maskptr++=MOC_maskmagic;
-      *maskptr++=MOC_maskmagic;
-      break;
-    }
-    case 1:{
-      *maskptr++=0;
-      *maskptr++=MOC_maskmagic;
-      *maskptr++=MOC_maskmagic;
-      *maskptr++=MOC_maskmagic;
-      break;
-    }
-    case 0:{
-      break;
-    }
-    }
-
-    magicptr=(int32 *) maskptr;
-
-    for(int32 i=0; i<MOC_fencesize; i++) *magicptr++=MOC_highfencemagic;
-
-    LEBUG(printf("done init\n"));
-    bool hashot=false;
-    ++MOC_alloccounter;
-    for(auto hvI=MOC_hotaidsrequested.begin(); hvI!=MOC_hotaidsrequested.end(); ++hvI){
-      if(*hvI==MOC_alloccounter){
-	hashot=true;
-	MOC_hotaidsrequested.erase(hvI);
-	break;
-      }
-    }
-    MOC_memblocks.insert(mbmapelem_t(newmem,memblockinfo_t(n,hashot,MOC_newallocsgetthisnocheckflag,MOC_alloccounter)));
-    if(hashot){
-      MOC_hotblocks.insert(mbmapelem_t(newmem,memblockinfo_t(n,hashot,MOC_newallocsgetthisnocheckflag,MOC_alloccounter)));
-    }
-
-    --MOC_innewcount;
-
-  }
-  return newmem;
-}
-
-void MemORC::deleteMemBlock(void * usraddr)
-{
-  LEBUG(printf("dmb\n"));
-  LEBUG(printf("MOC_innewcount %d\n", MOC_innewcount));
-  if(usraddr==nullptr) return;
-  if(!MOC_readytouse){
-    LEBUG(printf("not ready free %p\n", usraddr));
-    free(usraddr);
-    return;
-  }
-  if(MOC_memblocks.find(usraddr)==MOC_memblocks.end()){
-    if(MOC_innewcount==0 && !MOC_memblocks.empty()){
-      ++MOC_innewcount;
-      printf("Houston, trying to free something we haven't seen: %p\n",usraddr);
-      auto mbI=MOC_memblocks.lower_bound(usraddr);
-      if(mbI==MOC_memblocks.end()){
-	printf("No nearest memblock above\n");
-      }else{
-	printf("Nearest memblock above (%d):\t",reinterpret_cast<uint64>(mbI->first)-reinterpret_cast<uint64>(usraddr));
-	printMemBlockInfo(mbI);
-      }
-      if(mbI==MOC_memblocks.begin()){
-	printf("No nearest memblock below\n");
-      }else{
-	--mbI;
-	printf("Nearest memblock below (-%d):\t",reinterpret_cast<uint64>(usraddr)-reinterpret_cast<uint64>(mbI->first));
-	printMemBlockInfo(mbI);
-      }
-      statistics();
-      MemORC::checkAllMemBlocks();
-      printf("No error found yet, exiting\n");
-      myexit(1000);
-    }
-    ++MOC_innewcount;
-    if(reinterpret_cast<uint64>(usraddr)&0x8000000000000000ull){
-      printf("Houston, we have a pointer problem for free: %p\n",usraddr);
-      statistics();
-      MemORC::checkAllMemBlocks();
-      printf("No error found yet, exiting\n");
-      myexit(1000);
-    }
-    LEBUG(printf("oooops orig free %p\n", usraddr));
-    free(usraddr);
-    --MOC_innewcount;
-    return;
-  }
-
-  ++MOC_innewcount;
-  LEBUG(printf("my free\n"));
-
-  auto mbI=MOC_memblocks.end();  // .end() because I'm lazy, want to use "auto"
-  auto haserror=checkMemBlock(usraddr,mbI);
-  if(haserror){
-    printf("Overruns detected, exiting!\n");
-    myexit(100);
-  }
-
-  if(MOC_allhot){
-    checkAllMemBlocks();
-  } else if(!MOC_hotblocks.empty()){
-    checkAllHotBlocks();
-  }
-
-  size_t size=mbI->second.size;
-  MOC_reqmemalloc-=size;
-
-  uint8 * ptr=static_cast<uint8 *>(mbI->first);
-  // align size to be filled
-  if(size%4){
-    size+=4-(size%4);
-  }
-  uint8 * ptrfh=ptr+size;
-  uint8 * ptrfl=ptr-MOC_fencesize*sizeof(MOC_lowfencemagic);
-
-  // add fence size, magic sizes and size of a size_t to it
-  MOC_totalmemalloc-=(size+2*MOC_fencesize*sizeof(MOC_lowfencemagic));
-
-
-  if(MOC_fillondelete){
-    memset(ptrfl,0xaa,MOC_fencesize*sizeof(MOC_lowfencemagic));
-    memset(ptr,0xbb,size);
-    memset(ptrfh,0xcc,MOC_fencesize*sizeof(MOC_highfencemagic));
-  }
-
-  if(mbI->second.hashot){
-    auto tmpI=MOC_hotblocks.erase(usraddr);
-  }
-  MOC_memblocks.erase(usraddr);
-
-  LEBUG(printf("my free %p\n", ptrfl));
-  free(ptrfl);
-
-  --MOC_innewcount;
-
-  return;
-}
-
-
-bool MemORC::checkMemBlock(void *mb, mbmap_t::iterator & retI)
-{
-  if(!MOC_readytouse) return false;
-
-  LEBUG(printf("check raw user addr %p\n",mb));
-
-  ++MOC_innewcount;
-  retI=MOC_memblocks.find(mb);
-  if(retI==MOC_memblocks.end()){
-    printf("checking memory block that was not allocated by MemORC ???: %p\n", (uint8 *) mb);
-    printf("Bailing out\n");
-    myexit(1);
-    return false;
-  }
-
-  auto ret=checkMemBlock(retI);
-  --MOC_innewcount;
-  return ret;
-}
-
-bool MemORC::checkMemBlock(mbmap_t::iterator mbI)
-{
-  if(!MOC_readytouse) return false;
-  if(mbI->second.nocheck) return false;
-
-  LEBUG(printf("checkMemBlock mbI %p\n", mbI->first));
-
-  ++MOC_checksperformed;
-
-  ++MOC_innewcount;
-
-  bool haserror=false;
-
-  int32 * fenceptr=static_cast<int32 *>(mbI->first);
-  fenceptr-=MOC_fencesize;
-  for(int32 i=-MOC_fencesize; i<0; ++i, ++fenceptr){
-    if(*fenceptr!=MOC_lowfencemagic){
-      uint8 * fencecptr=static_cast<uint8 *>(static_cast<void *>(fenceptr));
-      if(*fencecptr!=MOC_clowfencemagic[0]){
-	printf("check: lower fence .0 destroyed at position: %d\tExpected: %x\tGot: %x\n", i*sizeof(int32),MOC_clowfencemagic[0], *fencecptr);
-      }
-      if(*(++fencecptr)!=MOC_clowfencemagic[1]){
-	printf("check: lower fence .1 destroyed at position: %d\tExpected: %x\tGot: %x\n", i*sizeof(int32)+1,MOC_clowfencemagic[1], *fencecptr);
-      }
-      if(*(++fencecptr)!=MOC_clowfencemagic[2]){
-	printf("check: lower fence .2 destroyed at position: %d\tExpected: %x\tGot: %x\n", i*sizeof(int32)+2,MOC_clowfencemagic[2], *fencecptr);
-      }
-      if(*(++fencecptr)!=MOC_clowfencemagic[3]){
-	printf("check: lower fence .3 destroyed at position: %d\tExpected: %x\tGot: %x\n", i*sizeof(int32)+3,MOC_clowfencemagic[3], *fencecptr);
-      }
-      haserror=true;
-    }
-  }
-
-  uint32 ufpos=1;
-  uint8 * maskptr=static_cast<uint8 *>(mbI->first);
-  maskptr+=mbI->second.size;
-  switch(mbI->second.size%4){
-  case 0: break;
-  case 1:{
-    if(*(maskptr) != MOC_maskmagic){
-      printf("check: upper fence (mm) destroyed at position: %d\tExpected: %x\tGot: %x\n",ufpos,MOC_maskmagic,*maskptr);
-      haserror=true;
-    }
-    ++ufpos;
-    ++maskptr;
-  }
-  case 2:{
-    if(*(maskptr) != MOC_maskmagic){
-      printf("check: upper fence (mm) destroyed at position: %d\tExpected: %x\tGot: %x\n",ufpos,MOC_maskmagic,*maskptr);
-      haserror=true;
-    }
-    ++ufpos;
-    ++maskptr;
-  }
-  case 3:{
-    if(*(maskptr) != MOC_maskmagic){
-      printf("check: upper fence (mm) destroyed at position: %d\tExpected: %x\tGot: %x\n",ufpos,MOC_maskmagic,*maskptr);
-      haserror=true;
-    }
-    ++ufpos;
-    ++maskptr;
-  }
-  }
-  fenceptr=static_cast<int32 *>(static_cast<void*>(maskptr));
-
-  for(int32 i=0; i<MOC_fencesize; ++i, ++fenceptr, ufpos+=4){
-    if(*fenceptr!=MOC_highfencemagic){
-      uint8 * fencecptr=static_cast<uint8 *>(static_cast<void *>(fenceptr));
-      if(*fencecptr!=MOC_chighfencemagic[0]){
-	printf("check: upper fence .0 destroyed at position: %d\tExpected: %x\tGot: %x\n", ufpos,MOC_chighfencemagic[0], *fencecptr);
-      }
-      if(*(++fencecptr)!=MOC_chighfencemagic[1]){
-	printf("check: upper fence .1 destroyed at position: %d\tExpected: %x\tGot: %x\n", ufpos+1,MOC_chighfencemagic[1], *fencecptr);
-      }
-      if(*(++fencecptr)!=MOC_chighfencemagic[2]){
-	printf("check: upper fence .2 destroyed at position: %d\tExpected: %x\tGot: %x\n", ufpos+2,MOC_chighfencemagic[2], *fencecptr);
-      }
-      if(*(++fencecptr)!=MOC_chighfencemagic[3]){
-	printf("check: upper fence .3 destroyed at position: %d\tExpected: %x\tGot: %x\n", ufpos+3,MOC_chighfencemagic[3], *fencecptr);
-      }
-      haserror=true;
-    }
-  }
-
-  if(haserror){
-    cout.flush();
-    printf("\nError while checking a memoryblock:\n");
-    printf("Addr: %p\n", mbI->first);
-    printf("Size: %llu\n", mbI->second.size);
-    printf("AllocID: %llu\n", mbI->second.allocid);
-  }
-
-  --MOC_innewcount;
-  return haserror;
-}
-
-void MemORC::checkAllMemBlocks()
-{
-  if(!MOC_readytouse) return;
-  LEBUG(printf("check all\n"));
-
-  ++MOC_innewcount;
-
-  bool haserror=false;
-  for(auto mbI=MOC_memblocks.begin(); mbI!=MOC_memblocks.end(); ++mbI){
-    haserror|=checkMemBlock(mbI);
-  }
-  if(haserror){
-    printf("Overruns detected, exiting!\n");
-    myexit(100);
-  }
-  --MOC_innewcount;
-}
-
-void MemORC::checkAllHotBlocks()
-{
-  if(!MOC_readytouse) return;
-  LEBUG(printf("check hb\n"));
-
-  ++MOC_innewcount;
-
-  bool haserror=false;
-  for(auto mbI=MOC_hotblocks.begin(); mbI!=MOC_hotblocks.end(); ++mbI){
-    haserror|=checkMemBlock(mbI);
-  }
-  if(haserror){
-    printf("Overruns in hot blocks detected, exiting!\n");
-    myexit(100);
-  }
-  --MOC_innewcount;
-}
-
-
-void MemORC::requestHotAlloicID(uint64 aid)
-{
-  ++MOC_innewcount;
-  MOC_hotaidsrequested.push_back(aid);
-  --MOC_innewcount;
-};
-
-
-void MemORC::printMemBlockInfo(mbmap_t::iterator mbI)
-{
-  if(mbI==MOC_memblocks.end()){
-    printf("no memblock, end of list");
-  }
-  printf("%p\t%llu\t",mbI->first,mbI->second.size);
-  if(mbI->second.hashot) {
-    printf("hot");
-  }else{
-    printf("normal");
-  }
-  printf("\t%llu\n",mbI->second.allocid);
-}
-
-
diff --git a/src/memorc/memorc.H b/src/memorc/memorc.H
deleted file mode 100644
index 4637180..0000000
--- a/src/memorc/memorc.H
+++ /dev/null
@@ -1,91 +0,0 @@
-#ifndef _bas_memorc_h_
-#define _bas_memorc_h_
-
-#include "stdinc/defines.H"
-
-#include <vector>
-#include <map>
-
-class MemORC
-{
-private:
-  static MemORC MOC_semaphore;
-  static bool MOC_readytouse;
-  static bool MOC_trackingon;
-  static bool MOC_exitset;
-
-  static const int32 MOC_fencesize;
-
-  static uint32 MOC_innewcount;
-
-  static bool MOC_mostfatalerroroccured;
-  static bool MOC_newallocsgetthisnocheckflag;
-  static bool MOC_allhot;
-  static bool MOC_fillondelete; // unused atm
-
-  static uint8 MOC_clowfencemagic[4];
-  static uint8 MOC_chighfencemagic[4];
-
-  static int32 MOC_lowfencemagic;
-  static int32 MOC_highfencemagic;
-
-  static uint8 MOC_maskmagic;
-
-  static uint64 MOC_alloccounter;
-  static uint64 MOC_checksperformed;
-
-  static size_t MOC_reqmemalloc;
-  static size_t MOC_totalmemalloc;
-
-  struct memblockinfo_t {
-    size_t size;
-    uint64 allocid;
-
-    bool   hashot:1;
-    bool   nocheck:1;
-
-    memblockinfo_t(size_t s, bool hot, bool nc, uint64 aid) : size(s), allocid(aid), hashot(hot), nocheck(nc) {};
-  };
-  typedef std::map<void *,memblockinfo_t> mbmap_t;
-  typedef std::pair<void *,memblockinfo_t> mbmapelem_t;
-
-  // Note: these 3 are not defined in memorc.C!
-  // to prevent the typical C++ init fiasco, they were integrated in preventinitfiasco.C
-  static mbmap_t MOC_memblocks;
-  static mbmap_t MOC_hotblocks;
-  static std::vector<uint64> MOC_hotaidsrequested;
-
-private:
-  static void myexit(int32 n);
-
-  static bool staticInit();
-
-  static bool checkMemBlock(void * usraddr, mbmap_t::iterator & retI);
-  static bool checkMemBlock(mbmap_t::iterator mbI);
-
-  static void checkAllHotBlocks();
-
-  static void * internalMAlloc(size_t n);
-
-  static void printMemBlockInfo(mbmap_t::iterator mbI);
-
-  // No error: contructor and destructor are private, no one else can instantiate
-  MemORC();
-  ~MemORC();
-  static void atExit();
-
-public:
-  static void * newMemBlock(size_t n);
-  static void deleteMemBlock(void * usraddr);
-
-  static void setTracking(bool b);
-  static void statistics();
-  static void checkAllMemBlocks();
-  static void requestHotAlloicID(uint64 aid);
-  static void setAllHot(bool b);
-  static void setChecking(bool b);
-};
-
-
-
-#endif
diff --git a/src/mira/CHANGES.txt b/src/mira/CHANGES.txt
index 74bafbd..42767ce 100644
--- a/src/mira/CHANGES.txt
+++ b/src/mira/CHANGES.txt
@@ -1,685 +1,54 @@
-4.9.5
+3.4.0
 -----
-- bugfix: ion, sanger, 454 & Pacbio consensus had been inadvertantly switched
-  off in 4.9.4
-- improvement: runtime of consensus calculation reduced by ~30-45% (depending
-  on project)
-- change: format of SNP list info file now carries counters for fwd/rev
-  directions of every base (and gaps)
-
-4.9.4
------
-- new routines to detect and eliminate extremely high levels of chimeric reads
-  as they occur in some widely used libraries.
-  New parameters: -CL:gbcdc:kjd:kjck (which need proper documentation)
-- new assembly mode: "fragments". Similar to "est", but all safety features
-  like digital normalisation, repeat masking etc. are switched off.
-- new routines to pre-correct reads
-- new routines to spot and deal with fishy reads having survived until late in
-  the assembly process.
-- improvement: automatic settings for kmer size fine-tuned and now also work
-  when user sets an own number of passes for MIRA.
-- improvement: when resuming, data from existing kmer statistics are now
-  resumed, too, instead of being recalculated.
-- improvement: mapping projects with several tens of thousands of reference
-  sequences are now much faster in the setup phase
-- improvement: info files for SNPs and feature analysis in mapping experiments
-  expanded and improved
-- change: in EST/RNASeq, digital normalisation only applied once
-- change: IUPAC consensus generation has changed. Subsequently, -CO:fnicpst
-  has been exchanged with -CO:fnic
-- FASTA/FASTQ output of contigs now has basic values like length, average
-  coverage and number of sequences added as comments.
-- miraconvert: stabilised implemention of -F
-- miraconvert: new parameter -Y to cap the number of bases converted.
-- MIRA does not link per default to TCMalloc library anymore. Tests with the
-  4.9.x versions showed 40% more max memory usage and 80% more overall memory
-  need when using default kmer series going from short (17-32bp) to very long
-  (>128bp) kmers.
-- various smaller and larger bugfixes in mira and miraconvert which were
-  spotted since 4.9.3
-- change: MIRA now needs GCC >=4.9; clang >= 3.5
-
-DOCUMENT -AL:ece:ced:cema + changed egpl !
-
-
-4.9.3
------
-- fixed two bugs that could lead to segfaults
-- fixed bug that could lead to premature stop of assemblies
-
-
-4.9.2
------
-- fixed bug that led EST assemblies to often stop
-
-
-4.9.1
------
-MIRABAIT
-- all new mirabait functionality: work on read pairs; multiple bait files;
-  simultaneous filtering of matches and non matches; safety checks on -L data
-- change: mirabait lowercases all sequences, uppercasing just kmers hitting
-  bait sequences. Use -c if not wanted.
-- improvement: mirabait can now use kmer sizes up to 256 bases
-- improvement: mirabait now understands .fa, .fq, .gbk, .gbff and .gb
-  file endings.
-
-MIRACONVERT
-- change: miraconvert, old -A parameter renamed to -P
-- change: miraconvert new behaviour. Adjust sequence case for data containing
-  clipping information when output is in format which has no clipping
-  information. Use -A to prevent if not wanted.
-- improvement: miraconvert now has again the possibility to mask
-  coverages. Use -V
-- change: miraconvert -q and -Q have switched meaning (to better fit -V)
-- improvement: miraconvert -T to trim ends.
-
-MIRA
-- improvement: better overall assemblies.
-- improvement: mira can now use kmer sizes up to 256 bases
-- improvement: new functionality to automatically determine optimal number of
-  passes and different kmer sizes in a denovo assembly (see -AS:nop=0 below)
-- improvement: new parameter -AS:kms as one-stop-shop to configure number of
-  passes and used kmer sizes. E.g.: -AS:kms=17,31,63,127,127
-- improvement: better assembly of data with self-hybridising read chimeras
-  (seen in Illumina 300bp data). Not perfect yet, but an improvement.
-
-- improvement: mira now understands .fa, .fq, .gbk, .gbff and .gb file
-  endings.
-- improvement: in manifest, new segment_naming scheme "SRA" for reads comming
-  from the short read archive. New attribute 'rollcomment'.
-- implemented "nostatistics" keyword in readgroups: reads of that readgroup
-  not used for calculating kmer statistics
-- improvement: new MIRA parameters: better control of megahub reporting via
-  -SK:fmh:mhc
-- improvement: new MIRA parameter -CO:cmrs for better control on reads
-  incorporated in contigs
-- improvement: debris list now contains additional reasons MASKEDNASTYREPEAT,
-  MASKEDHAF7REPEAT and MASKEDHAF6REPEAT to help finding out why certain reads
-  land in debris file.
-- improvement: faster mapping of long Illumina reads with lots of differences
-- improvement: MIRA now uses the SIOc tag also in mapping. Allows finding
-  ploidy differences in multiploid genomes.
-- improvement: -CL:pec now works a bit less harsh, better for Illumina high GC
-  organsisms.
-- improvement: old and time consuming routines to search for vector now
-  restricted to Sanger sequences.
-- improvement: new info file "*_readgroups.txt"
-- improvement: some temporary files compressed to minimise impact on disk
-  space.
-- improvement: MIRA now compiles with clang (test phase, currently tested only
-  on OSX)
-- improvement: MIRA now compiles on Cygwin out of the box
-- change: MIRA now needs GCC >=4.8; clang >= 3.5
-
-- change: parameter section -HASHSTATISTICS was renamed to
-  -KMERSTATISTICS. This move adapts MIRA from SSAHA terminology to nowadays
-  prevalent terminology.
-- change: renamed a lot of parameters containing 'bases_per_hash' (bph) to now
-  be named with 'kmer_size' (kms). The same apllies to 'hash', replaced by
-  'kmer'.
-- change: -AS:nop=0 now interpreted differently. Instead of doing only
-  -pre-processing, it automatically lets MIRA choose 'optimal' number of
-  passes and used kmer sizes in each pass depending on sequencing technology
-  -and read lengths present. See also: -GE:ppo
-- change: new parameter -GE:ppo to preprocess only the data without assembling
-  it. Replaces -AS:nop=0 of earlier versions.
-
-- bugfix: Smith-Waterman could lead to memory corruption in very rare cases.
-- bugfix: -HS:mhpb did not work as intended when Solexa data was present.
-- bugfix: -CO:amgb did not work as intended
-- bugfix: -AS:shme did not always work
-- bugfix: -SB:bnb parameter not displayed correctly in parameters
-- bugfix: projects which end up with 0 usable bases now do not lead to a
-  crash.
-- lots of smaller fixes and improvements.
-
-
-4.0.2
------
-- fix: mirabait did not recognise output format to use in situations where
-  unknown formats comflicted with specified formats like the following:
-   mirabait -f fastq bait.fasta in.dat outfile
-
-
-4.0.1
------
-- improvement: drastically improved mapping speed of reads belonging to
-  strains which are far away from reference
-- improvement: RNA sequences (having U instead of T) can now be read
-  natively. U bases are automatically converted to T.
-- improvement: mirabait can now work with multiple input files
-- improvement: functionality to change prefix of reads on the fly while
-  loading data. Keyword: 'rename_prefix' in the manifest file
-- improvement: build on OSX now does not delete OSXstatlibs directory
-- bugfix: in mapping assemblies, bases of the reference could be edited away
-  on very rare occasions.
-- bugfix: GFF3 files with phase information could result in wrong exon
-  boundaries
-- bugfix: MIRA can now be installed in filesystem paths which contain a space
-- other small improvements and changes, mainly in error reporting and file
-  conversion
-
-
-MIRA 4.0
---------
-
-MIRA 4.0 is the result of a bit more than two years of work since MIRA 3.4
-came out and much has changed. A lot behind the scenes, but also interesting
-things for everyone, most notably in speed and quality terms.
-
-The most important change for users: the interface. Please absolutely do
-consult the section on manifest files in the documentation! Users who have not
-used the MIRA 3.9 development series ABSOLUTELY MUST read the
-documentation. Read at least, in the MIRA Definitive Guide, the sections
-describing the new assembly description files ("manifest files"); and have a
-look at the chapters describing the results of MIRA; and the utilities in the
-package:
-
-     3.5. Configuring an assembly: files and parameters
-          3.5.1. The manifest file: introduction
-          3.5.2. The manifest file: basics
-          3.5.3. The manifest file: defining the data to load
-       9. Working with the results of MIRA
-      10. Utilities in the MIRA package
-
-Furthermore, you might want to skim through the following chapters:
-
-       4. Preparing data
-       5. De-novo assemblies
-       6. Mapping assemblies
-       7. EST / RNASeq assemblies
-       8. Parameters for special situations
-
-
-Main improvements made to simplify life:
-- flexibilised parametrisation to easily define input data and assembly job:
-  the "manifest" configuration files allow using concepts of read groups as
-  well as segment orientation & segment placement
-- new "fire & forget" mode of MIRA which basically should reduce misassemblies
-  in result files to zero: earlier version of MIRA would dump out
-  misassemblied contigs (with markers pointing at the misassembly), now
-  contigs dumped out do not contain any misassembly (at least none which MIRA
-  could discover).
-- possibility to have MIRA determine automatically paired library parameters
-  (size & orientation)
-- new automatic extraction of "large contigs" at the end of a genome de-novo
-  assembly.
-- SAM output via "miraconvert", simplifies interaction with outside world
-  (gap5, tablet etc.pp)
-- full GFF3 input and output compatibility, using Sequence Ontology,
-  translation to and from gap4/gap5
-- CASAVA 1.8 read naming for the new Illumina read name scheme
-- new sequencing "technology" TEXT for unspecified data, i.e., from databases
-  like NCBI etc.
-- new companion program "mirabait", which is a "grep" like utility for
-  retrieving sequences by in-silico baiting
-- automatic estimation of parameters for paired libraries
-- lots of other improvements left and right which add up ;-)
-
-Main speed improvements:
-- faster contig handling routines, improves de-novo assembly times with Ion
-  Torrent or 454 / Solexa hybrid by 30%
-- faster mapping routines, allows MIRA to more or less gracefully handle
-  projects with several thousand reference sequences. Useful for mapping
-  against EST / RNASeq assemblies.
-- faster handling of deep coverage RNASeq and genome data (to be improved
-  still)
-- faster kmer counting & smaller footprint in RAM and on disk
-- faster checking of template restrictions
-- optimized: faster data reading, does not need to count reads beforehand
-  anymore
-- lots of other improvements left and right which add up ;-)
-
-Main assembly quality improvements:
-- improved assembly quality for ultra-high coverage Solexa RNASeq data contigs
-  (new parameter -CL:rkm)
-- better handling of sequencing libraries with uneven coverage (Nextera)
-- lots of other improvements left and right which add up, like, handling of
-  newer MiSeq and Ion data, lossless digital normalisation etc.pp ;-)
-
-Documentation
-- rewritten in large parts for manifest files
-- started to update walkthrough for newer public data sets.
-
-Other internal changes:
-- lots of reshuffled/reworked code
-- improved gcc warnings
-- improved build environment, now out-of-the box building on more Linux
-  distros and Mac OSX
-- better and simplified code due to transitioning to C++11
-- new MAF format v2
-
-
-
-Changes for the 3.9.x development line since MIRA 3.4.0:
-========================================================
-4.0
----
-- improvement: missing or additional backslashes in "parameters=" manifest
-  lines are diagnosed a bit better.
-- increased max length of reads allowed in mapping to 32kb
-- fine-tuning of standard parameters for PCBIOHQ reads
-- fine-tuning of contig building in low-coverage areas of a contig
-- fine-tuning of standard parameters for 3' polybase clipping
-- bugfix: SAM output for mapping assemblies was sometimes broken (bug
-  uncovered by new parameter -SB:tor=yes)
-- bugfix: the term "exclusion_criterion" for "segment_placement" in manifest
-  files was parsed wrongly.
-- bugfix: miraconvert now does not munch away part of filenames separated by
-  dots.
-- bugfix: using digital normalisation on genome assemblies led to an error,
-  fixed.
-
-
-4.0rc5
-------
-- major improvements in contig building for genomes with really nasty repeats,
-  leading to more accurate contigs especially with paired data
-- interface change: the "--highlyrepetitive" keyword has been replace by
-  "--hirep_something", "--hirep_good" and "--hirep_best"
-- improvement: the proposal for "large contigs" in de-novo assemblies extracts
-  a better subset of contigs to represent the "true" genome, especially in
-  hybrid assemblies.
-- improvement: automatic estimation of parameters for paired libraries,
-  switched on via "autopairing" keyword in manifest files
-- improvement: in mapping assemblies better alignment in cases where the
-  mapped data contains non-clonal sequencing data or data which has more indels.
-- improvement: the automatic sequencing error editor for "trivial" errors now
-  corrects more cases
-- improvement: new command line parameter -t for setting number of threads
-  (overwriting -GE:not if set in manifest)
-- improvement: new command line parameter -m and -M for checking manifest
-  files without performing an assembly
-- improvement: poly-A stretches in EST / RNASeq assemblies are kept by default
-  in the sequences to differentiate between different 3' UTR endings
-- improvement: the routines searching for chimeras were made more resistant to
-  finding wrong chimeras in "low" coverage data
-- improvement: skim now filtering hits saved on disk a bit faster for de-novo
-  assemblies
-- improvement: the misassembly detector for libraries with paired reads is on
-  by default (temporary parameter: -MI:ef3)
-- improvement: detection (and warning) if de-novo assembly shows signs of a
-  skewed coverage over a genome like it occurs, e.g., in sequencing data
-  sampled from exponential growth phase of bacteria.
-- improvement: started to log warnings to separate info files
-- bugfix: extraction of large contigs only done for genome de-novo assemblies
-- bugfix: poly-A stretches were annotated as polyA_signal_sequence instead of
-  polyA_sequence in GFF3 files.
-- bugfix: non-repetitive overlaps in reads with masked stretches (-SK:mnr=yes)
-  are less likely to be dismissed, leading to better assembly of heavy
-  repeats.
-- new parameters -ED:mace:eks:ehpo for more fine grained control of automatic
-  editor
-- new parameters -NW:cac:acv to catch and warn early about assemblies
-  performed with overly large coverage
-- new parameter -SB:bnb to allow mapping without bootstrapping
-- minor: mirabait can no re-use precalculated kmer statistics via -L parameter
-- minor: command line -v for mirabait & miramem
-- minor; when compiling, the build script for MIRA now honours $CC and $CXX if
-  set
-- minor: updated GTAGDB file for compatibility to Staden gap4 / gap5 package
-  (support directory)
-
-
-4.0rc4
-------
-- improvement: simple variations in coverage which are not repeats are now
-  handled gratiously, i.e., these do not break contig building. Seems to be
-  extremely important for some Nextera libraries which can have some terribly
-  uneven coverage.
-- improvement: the automatic adaptor clipping was a tad too overzealous
-  for some genome data and clip perfectly valid data in very rare cases.
-- major bugfix: segment placements were not checked rigorously enough. E.g.,
-  paired-end Illumina would also accept a mate-pair placement of its reads.
-- major bugfix: paired-reads libraries were essentially broken since 3.9.11
-  and reads were often assigned a wrong partner.
-- improvement: the automatic overcall editor is now configurable and defaults
-  to correct only 454 and Ion data.
-- bugfix: some coverage values in the assembly info file contained temporary
-  values from during the assembly, not from the end result.
-- bugfix: when MIRA was started from a location not in path, it would not
-  always automatically find "miraconvert" and fail at the extraction of large
-  contigs in de-novo genome assemblies.
-
-
-4.0rc3
-------
-- binaries now recognise themselves when run as "mira4", "mira4bait" and
-  "mira4convert". Note: the canonical name should be those without "4" in the
-  name though.
-- small bugfix: error code was not >0 in certain situations
-- mira now searches the binaries for itself and miraconvert in the directory
-  the called binary was installed, then in the $PATH environment.
-- change: gap4da result type now always turned off by default
-- new parameters: -HK:mhpb:rkrk
-- loading of files in the manifest: a file type can now be explicitely given
-  via the EMBOSS-like double colon scheme. E.g.: data = fastq::file.dat
-- bugfix: miraconvert -A did not work
-- building: m4 configuration files now in the "m4" directory, not "config/m4"
-- bugfix: the shell script to show how to extract large contigs now always
-  written for genome assembly projects even if automatic extraction failed.
-- data checks: MIRA now halts if it does not correctly recognise read pairs
-  due to unknown read naming schemes.
-
-
-4.0rc2
-------
-- speed improvement: extracting the consensus of an assembly via miraconvert
-  is now faster by a factor between 1.3 and 4.5 (depending on number of
-  strains present and a couple of other things)
-- improvement: determination of "large contigs" did not handle well projects
-  with corrected PacBio reads, fixed.
-- convenience: when using -DI:trt, MIRA now creates temporary dir names for
-  the target directory so that several runs of MIRA can be started in parallel
-  using the same manifest file but the temporary data of these runs do not
-  interfere with eachother
-- bugfix: Smith-Waterman alignments entered an infinite loop in rare cases
-- bugfix: "miraconvert -r C" produced IUPACs
-- bugfix: miraconvert did not evalute the complete path of the result file but
-  always wrote to current directory
-- bugfix: target install missed a && in progs/Makefile.am
-- bugfix: loading of assemblies (in mira and miraconvert) could fail
-- bugfix: saved diginorm multiplier values in MAF files led sometimes to
-  MAF parsing errors.
-- bugfix: contig coverage statistics did not always correctly account for
-  diginorm reads
-- fix for OSX: better binaries which should behave like Unix binaries
-- small fix for compiling on Cygwin
-
-
-4.0rc1
-------
-- for de-novo assemblies, MIRA now automatically extracts 'large contigs' into
-  additional result files
-- new info file: "largecontigs". Only written for genome denovo.
-- saving of "AllStrains" FASTA or FASTAQ now happens only if more than one
-  strain is present in the assembly (mira and convert_project)
-- new behaviour in mapping assemblies: reads overhanging the reference
-  sequence left and right are trimmed back by default to the boundaries of the
-  reference sequence. Can be controlled via new parameter -SB:tor
-- added new file type in manifest: .exp for loading single EXP files (compare
-  to "fofnexp")
-- added new file type in manifest: ".fa". Behaves like ".fna"
-- fix segfault when read access to /tmp directory is denied
-- bugfix: merging of reads did sometimes not work as intended (introduced in
-  3.9.2)
-- bugfix: convert_project does not stop anymore on template problems
-- bugfix: MAF output for projects with several strains now immediately
-  convertable to SAM
-- bugfix: FASTQ files in MS-DOS format led to parsing problems
-- bugfix: possible endless loop in mapping projects with -AS:nop>1
-- bugfix: miraconvert -n with an empty file selected all contigs/reads, now
-  selects none (as one would expect)
-- renaming of all major MIRA binaries to have "mira" as prefix. Most important
-  change: "convert_project" is now "miraconvert"
-- renamed and changed behaviour of all NAG_AND_WARN parameters. Now three
-  options: stop, warn, no
-
-
-dev3.9.18
----------
-- improved lossless digital normalisation
-- fixed bug leading to wrong acceptance of SW alignments of sequences on
-  recognized repeat/SNP sites
-- workaround for bug of Apple standard C libraries leading to wrong MIRA
-  assemblies on OSX
-- fixed bug which led MIRA 3.9.x to stop if no SCF files were found for Sanger
-  data
-- new parameters: -NW:sodnr:sote for more fine grained nagging/warning
-  messages
-- added patches from Debian Med
-
-
-dev3.9.17
----------
-- improvement: mira now increases stack size to allow for full length
-  alignments of reads >= 15kb
-- change: results in FASTA format now splitted into strain specific result
-  files
-- bugfix: cause for rare premature stop of assembly found and fixed
-- bugfix: calculation of number of strains now corrrect
-- bugfix: calculation of digital normalisation coverage estimates could be
-  wrong for reads lateron determined to be chimeric
-
-
-dev3.9.16
----------
-- change of parameter parsing: "1" and "0" are not allowed anymore for boolean
-  parameters. To make up for it, "y", "n", "t", "f" are now allowed shortcuts
-- change of parameter parsing: -MI:somrnl:sonfs moved to new section
-  -NAG_AND_WARN section: -NW:somrnl:sonfs
-- change of parameter parsing: new section -HASHSTATISTICS. Moved several
-  parameters from -SKIM to -HASHSTATISTICS
-- new parameter: -CL:search_phix174:filter_phix174 to automatically search for
-  and filter PhiX174 from Illumina data. Defaults: search only in genome mode,
-  search and filter in EST mode
-- new parameter -SK:fcem for EST/RNASeq assembly of very skewed distributions
-- output: debris file in info directory now contains reason for read being
-  pushed to debris
-- new functionality: lossless digital normalisaton
-- mira: slightly adapted contig naming scheming when using digital
-  normalisation
-- mira: computation of hash statistics a bit faster
-- mira: hash statistics analysis now partly multithreaded
-- mira: uses less memory for high-coverage genes in EST/RNASeq projects
-- mira: now knows about Nextera adaptors
-- mira: increased speed on very large projects with tens of millions of reads
-- mira: improved output of parameters, now does not output "san" if sanger is
-  not used.
-- convert_project: new option -Q for default read quality. Also does not stop
-  when missing quality files
-- convert_project: new to-target "samnbb". In reference assemblies, leaves out
-  the backbone (reference) sequence. Enhances compatibility for conversion to
-  BAM.
-- convert_project: SAM output now uses "255" as mapping quality instead of
-  "50"
-- convert_project: bugfix for correctly guessing to and from filetypes from
-  filenames
-- bugfix: annotations in GenBank files were sometimes garbled
-- bugfix: parsing of -AS:mrpc did not work in the long version
-- bugfix: repeat resolving of very deep repeats involving indels sometimes did
-  not resolve repeats correctly
-- bugfix: writing MAF checkpoint files for mapping assemblies
-- bugfix: fixed "*sigh*" error in mapping assemblies which struck especially
-  in deep mappings and when the reference was very different from mapped
-  reads.
-- bugfix: erroneous overcall editing in mapping assemblies
-- potential bugfix for "would extend AS_skim_edges" error
-- more readable error messages
-
-
-dev3.9.15
----------
-- further improvement of EST/RNASeq assembly: more probably reconstructs the
-  most frequent splice variant as full transcript and less frequent variants
-  as partial transcripts. Further reduction of intron assembly.
-- bugfix of problem which led to abort of assembly process.
-
-
-dev3.9.14
----------
-- preprocessing and assembly algorithm improvement for MiSeq data
-- improvement: avoidance of intron sequence improved for EST / RNASeq assembly
-- improvement: adjustments to default parametrisation for EST / RNASeq
-  assemblies lead to better results
-- improvement: hybrid assembly of long and short reads (e.g. 454 & Illumina)
-  now finds more contig joins
-- mirabait: new output type "txt" for list of matching read names
-- workaround: convert_project & mirabait now also work (like mira) when
-  computer locale is broken.
-- bugfix: dump of replay data did not work as intended for mapping
-  assemblies.
-
-dev3.9.13
----------
-- ooops, forgot to include new file in source
-
-dev3.9.12
----------
-- fixed bug which led to stops of the assembly process
-- fixed bug which led to segmentation faults in rare cases when mapping
-  against a single, short backbone sequence.
-
-
-dev3.9.11
----------
-- several bugfixes in the assembly engine which previously led to an abort of
-  the assembly process.
-- changes in configure script to ensure better build compatibility on GenToo
-
-
-dev3.9.10
----------
-- improvement: major speed improvement for mapping projects with hybrid
-  technologies where one of the technologies is Illumina
-- improvement: preprocessing of read now fully multi-threaded
-- improvement: now reads faulty GenBank files written by CloneManager
-- convert_project: comfort functions. Parameters -f and -t now not mandatory
-  anymore but deduced from given file names
-- convert_project: now also understands .gbk as filetype for GenBank data
-- new/old functionality: reactivated, MAF & CAF files can now be used as again
-  as input in manifest files
-- change: some warnings caused by internal errors now cause a full MIRA stop
-  to hunt down the cause of the problems.
-- change: in mapping assemblies, template_size and segment_placement now use
-  "infoonly" as default if not given.
-- change: MIRA version written to assembly info file
-- several internal changes to loading system for future enhancements
-- several internal code cleanups
-- bugfix: mira -c did not work as described
-- bugfix: some reads could sometimes not be correctly aligned, problem
-  triggered by many indels in reads (Ion Torrent, 454) of high coverage
-  contigs.
-- bugfix: -highlyrepetitive in manifest parameters caused a parsing error
-- documentation: added "default_qual" in documentation for manifest files
-
-dev3.9.9
---------
-- bugfix: MIRA sometimes stopped when building low coverage contigs
-
-
-dev3.9.8
---------
-- bugfix: on machines with heavy load, some files and directories sometimes
-  failed to be deleted. Fixed.
-- bugfix: mapping of Illumina at contig ends sometimes failed (since 3.9.6)
-- bugfix: error causing "gaaah, had doubles" in de-novo assemblies of genomes
-  fixed.
-- small runtime improvement: some unnecessary steps in the overlap graph
-  traversal are now dynamically left out.
-- convert_project: new option -S (currently only for Illumina data)
-- convert_project: reactivated -i
-- unnecessary debug files are now not written anymore to the tmp directory
-- new -MI:ef2 flag for switching off experimental code
-
-
-dev3.9.7
---------
-- bugfix: -MI:ef1 did not work
-
-
-dev3.9.6
---------
-- improvement: mapping assemblies with greatly improved alignments for
-  non-perfect matches, especially in larger indel regions
-- improvement: assembly of repetitive areas in de-novo assemblies, no more
-  "repeat coverage peaks"
-- improvement: parsing of sequence identifiers in NCBI gi format automatically
-  chooses the simple sequence name as read name
-- improvement: can now load GFF3 files without sequences (as provided by the
-  NCBI)
-- improvement: data loading consistency checks added to catch illegal quality
-  values >100.
-- convert_project: "-t stats" now also outputs consensus tags info file
-- slight change in output of info file of consensus tags (added length of tag)
-- change: output of wiggle files is now always for the full, padded contig
-- change: output of alignments as text or HTML now has lowercase alignments,
-  uppercase for bases which do not match the consensus
-- documentation: using Illumina data from the SRA
-- bugfix: possible segmentation faults removed
-- bugfix: -SB:abnc=true led to a problem since 3.9.5, fixed.
-- bugfix: MAF parsing got phase information wrong in GFF3 tags
-- bugfix: CAF writing phase info from GFF3 tags was not ASCII
-- bugfix: creation of SAM files failed when libraries with FR or RF
-  orientation were present.
-- bugfix: coverage equivalent reads were created too short for coverages >1.
-
-
-dev3.9.5
---------
-- better handling of failing disk operations when memory is tight
-- improved assembly of repetitive regions in genome assemblies: faster and
-  non-heuristic.
-- improved assembly of EST / RNASeq of eukaryotic data: intronic sequences
-  should be less frequent.
-- major speed improvement in de-novo assemblies higher coverages of Illumina,
-  Ion Torrent and 454 data
-- better clipping of degenerated Ion Torrent adaptors
-- new 454 adaptor clipped
-- rename -CL:mkfr to -CL:pmkfr and added automatic adjustments for high
-  coverage data.
-- better error handling on OSX: user now always gets a specific MIRA error
-  message.
-- better semantic checking of manifest files (missing reference, no data,
-  etc.)
-- manifest files: allowing LEFTIES and RIGHTIES in segment placement
-- the 3.9.x line now recognises if it was called with parameters from the
-  3.4.x line and stops
-- parameter -CL:lcc was split into -CL:lccf:lccb
-- bugfix: parsing MAF files with Illumina and / or Ion data leads to less used
-  memory like as if loaded anew (important for resumed assemblies).
-- bugfix: FASTQ loader now stops on illegal FASTQ files
-- bugfix: some alignments did don get propper flags, leading to suboptimal
-  assembly graphs.
-
-
-dev3.9.4
---------
-- bugfix: FASTQ input in Illumina-64 format was broken
-- bugfix & improvement: SAM format from convert_project now more compatible to
-  SAM specification
-- bugfix: bugs leading to error message trackingunused != countingunused
-- bugfix: loading of gzip packed FASTQ with a name ending in .gz did not work
-- first speed improvements in contig cleanup routines when mapping Ion data,
-  more to come in next versions
-- further improvements for binary compatibility to older Linux kernels, errors
-  of BOOST induced problems with locale settings should now be a thing of the
-  past
-- minor updates to the documentation
-- new ./configure option "--enable-native" for processor specific optimised
-  code
-
-
-dev3.9.3
---------
-- fixed ./configure to produce a fully statically linked binary on OSX
-- bugfix: CAF files were not read correctly (bug due to MIRA now also saving
-  placement code in CAF)
-- fixed segfault for some projects when doing "convert_project -t asnp"
-- fix: building without EdIt broke on some systems
-- mira now advertises the resume option in "mira -h"
-- improvement: distributed binary packages now compatible again to older
-  kernels (down to 2.6.15)
-- improvement: saving of snapshots is now much more error resistant, a working
-  snapshot should always be present on disk
-- improvement: SNP and feature analysis now only writes "X" as amino acid if a
-  SNP leads to a codon change which resolves to a different AA.
-- improvement: quicker SNP and feature analysis in intergenic regions
-- improvement: parsing of MAF files with lots of tags a lot faster (50% and
-  more)
-- change: *_info_featuresequences.txt and *_info_featureanalysis.txt now
-  include an additional column "FType" (FeatureType)
-
-
-dev3.9.2
---------
-- fixed possible segfault (only hit when assembling de-novo with more than one
-  strain)
-- fixed parsing error in manifest files when loading data from pacbio
-- improved configure script for compiling on a wider variety of platforms and
-  with different versions of gcc and BOOST libraries
-- MIRA resume: added "-r"
-- binary package for Linux: fixed issue where older Linux kernels needed to
-  have 'export LC_ALL=C' or else they would not start.
+Development of the 3.4 series of MIRA concentrated on making assemblies with
+30m to 100m reads more "liveable", i.e., reduce memory and disk footprint of
+MIRA as well as improving run-times. At the same time, an updated assembly
+strategy both for genome and EST / RNASeq data was devised to reduce the
+influence of chimeras and intronic data on the assembly. Also MIRA is now
+pretty smart in handling de-novo Solexa projects with "low coverage" (<30x) as
+well as "high coverage" (>= 100x).
+
+While we are at it: default parameters for Solexa de-novo were adapted to work
+with at least 75mers. While doing de-novo assembly with smaller read lengths
+is still possible for MIRA, the whole concept of ultra-short-read de-novo
+assembly is a silly idea in the first place. So don't do it.
+
+The new ability to handle IonTorrent data also made its appearance in MIRA as
+implementing support for this kind of sequencing technology was comparatively
+simple and straight forward. MIRA supports all kind of read lengths presently
+on the market (100bp, 220bp) out of the box, but longer read lengths should
+not pose a problem. Current IonTorrent data behaves very much like early 454
+GS20 reads and I am curious whether Life will be able to perform the same
+length and quality improvement within 12 month like 454 did in 2006. Time will
+tell.
+
+For PacBio, results are a mixed bag: CCS reads as well as error-corrected CLR
+data works extremely well with MIRA, at least I'm happy how the E. coli
+C227-11 demo data from the PacBio DevNet gets assembled. I suppose MIRA will
+still need to get a couple more rules regarding the error profile of those
+reads, but I'll be able to do that only once I've seen more data. What does
+not work at all at the moment (and causes me some terrible headache) are the
+CLR reads: those with an accuracy of only 80% to 85%. I'm not sure how to
+tackle them efficiently.
+
+For mapping assemblies, many smaller and bigger improvements ease the daily
+life and improve results with those data sets. Exemplarily named should be
+improved mapping quality of reads in highly repetitive regions of a genome
+when the reference sequence is not optimal as well as the new ability to load
+backbone sequences and annotation from GFF3 format files (saving will follow
+shortly).
+
+Quality control and automated clipping has been another focus in the past few
+months. Notable developments there are automated clipping of known adaptors in
+Solexa and IonTorrent data, improvements in the detection and avoidance of
+chimeric reads and a some new automated editing algorithms which edit away
+pretty clear cases of sequencing errors.
+
+Regarding utilities, 'convert_project' has been revamped to be able to
+convert large assembly or data files with less memory. It also got a number of
+new options to get even more use cases covered. The new tool 'mirabait'
+enables to quickly extract reads based on matching k-mers from a huge data
+set.
+
+For detailed changes, please consult the src/mira/CHANGES_old.txt file in the
+source distribution.
diff --git a/src/mira/CHANGES_old.txt b/src/mira/CHANGES_old.txt
index b58bf85..2effa46 100644
--- a/src/mira/CHANGES_old.txt
+++ b/src/mira/CHANGES_old.txt
@@ -1,60 +1,3 @@
-3.4.0
------
-Development of the 3.4 series of MIRA concentrated on making assemblies with
-30m to 100m reads more "liveable", i.e., reduce memory and disk footprint of
-MIRA as well as improving run-times. At the same time, an updated assembly
-strategy both for genome and EST / RNASeq data was devised to reduce the
-influence of chimeras and intronic data on the assembly. Also MIRA is now
-pretty smart in handling de-novo Solexa projects with "low coverage" (<30x) as
-well as "high coverage" (>= 100x).
-
-While we are at it: default parameters for Solexa de-novo were adapted to work
-with at least 75mers. While doing de-novo assembly with smaller read lengths
-is still possible for MIRA, the whole concept of ultra-short-read de-novo
-assembly is a silly idea in the first place. So don't do it.
-
-The new ability to handle IonTorrent data also made its appearance in MIRA as
-implementing support for this kind of sequencing technology was comparatively
-simple and straight forward. MIRA supports all kind of read lengths presently
-on the market (100bp, 220bp) out of the box, but longer read lengths should
-not pose a problem. Current IonTorrent data behaves very much like early 454
-GS20 reads and I am curious whether Life will be able to perform the same
-length and quality improvement within 12 month like 454 did in 2006. Time will
-tell.
-
-For PacBio, results are a mixed bag: CCS reads as well as error-corrected CLR
-data works extremely well with MIRA, at least I'm happy how the E. coli
-C227-11 demo data from the PacBio DevNet gets assembled. I suppose MIRA will
-still need to get a couple more rules regarding the error profile of those
-reads, but I'll be able to do that only once I've seen more data. What does
-not work at all at the moment (and causes me some terrible headache) are the
-CLR reads: those with an accuracy of only 80% to 85%. I'm not sure how to
-tackle them efficiently.
-
-For mapping assemblies, many smaller and bigger improvements ease the daily
-life and improve results with those data sets. Exemplarily named should be
-improved mapping quality of reads in highly repetitive regions of a genome
-when the reference sequence is not optimal as well as the new ability to load
-backbone sequences and annotation from GFF3 format files (saving will follow
-shortly).
-
-Quality control and automated clipping has been another focus in the past few
-months. Notable developments there are automated clipping of known adaptors in
-Solexa and IonTorrent data, improvements in the detection and avoidance of
-chimeric reads and a some new automated editing algorithms which edit away
-pretty clear cases of sequencing errors.
-
-Regarding utilities, 'convert_project' has been revamped to be able to
-convert large assembly or data files with less memory. It also got a number of
-new options to get even more use cases covered. The new tool 'mirabait'
-enables to quickly extract reads based on matching k-mers from a huge data
-set.
-
-For detailed changes, please consult the src/mira/CHANGES_old.txt file in the
-source distribution.
-
-
-
 
 3.4.rc5 (never officially released)
 -----------------------------------
diff --git a/src/mira/Makefile.am b/src/mira/Makefile.am
index e28d98f..9ea31ec 100644
--- a/src/mira/Makefile.am
+++ b/src/mira/Makefile.am
@@ -1,9 +1,5 @@
-AM_CPPFLAGS = -I$(top_srcdir)/src $(all_includes)
+INCLUDES = -I$(top_srcdir)/src $(all_includes)
 
-clean-local:
-	rm -rf *flexer.cc *xxd.H
-
-EXTRA_DIST = CHANGES.txt CHANGES_old.txt
 
 SUFFIXES= .xxd
 
@@ -12,110 +8,24 @@ SUFFIXES= .xxd
 	@$(SHELL) -ec 'grep -v "^#" $< | xxd -i >$<.H'
 
 
-noinst_LIBRARIES = libmiraestass.a libmira.a
-#noinst_LIBRARIES = libmirasupport.a libmira.a
+noinst_LIBRARIES = libmiraestass.a libmirasupport.a libmira.a 
 
-libmira_a_XXDSRC = adaptorsforclip.454.xxd adaptorsforclip.solexa.xxd adaptorsforclip.iontor.xxd adaptorsregex.solexa.xxd adaptorsregex.iontor.xxd seqforfilter_phix174.solexa.xxd
+libmira_a_XXDSRC = adaptorsforclip.454.xxd adaptorsforclip.solexa.xxd adaptorsforclip.iontor.xxd adaptorsregex.solexa.xxd adaptorsregex.iontor.xxd
+EXTRA_DIST = CHANGES.txt CHANGES_old.txt
 BUILT_SOURCES=$(libmira_a_XXDSRC:.xxd=.xxd.H)
 nodist_libmira_a_SOURCES=$(libmira_a_XXDSRC:.xxd=.xxd.H)
 
 dist_pkgdata_DATA = demoparam.prm
 pkgdatadir=$(prefix)/share/$(PACKAGE)
 
-# put hashstats, assembly, read, contig, etc. in front: with make -j .... they'll get made first
+# put read and contig in front: with make -j .... they'll get made first
 #  and won't block the rest.
+libmirasupport_a_SOURCES=  contig.C gff_parse.C parameters_flexer.ll multitag.C maf_parse.C adsfacts.C ads.C assembly_output.C assembly_info.C readpool.C contig_output.C contig_analysis.C  contig_edit.C read.C align.C dynamic.C parameters.C 
+libmira_a_SOURCES= assembly.C scaffolder.C skim.C dataprocessing.C assembly_io.C assembly_repeatresolve.C assembly_reduceskimhits.C assembly_swalign.C newpathfinder.C adaptorsforclip.454.xxd adaptorsforclip.solexa.xxd adaptorsforclip.iontor.xxd adaptorsregex.solexa.xxd adaptorsregex.iontor.xxd
+noinst_HEADERS= adsfacts.H ads.H assembly_output.H parameters.H align.H assembly_info.H assembly.H  contig.H dynamic.H enums.H gff_parse.H indexed_deque.H maf_parse.H multitag.H newpathfinder.H read.H readpool.H stringcontainer.H structs.H skim.H parameters_tokens.h timerestrict.H scaffolder.H 
 
-libmira_a_SOURCES= \
-	$(libmira_a_XXDSRC) \
-	hashstats_sdbg.C\
-	hashstats.C\
-	skim.C\
-	assembly.C\
-	contig.C\
-	read.C\
-	contig_analysis.C\
-	ads.C\
-	\
-	adsfacts.C\
-	align.C\
-	assembly_info.C\
-	assembly_buildcontigs.C\
-	assembly_io.C\
-	assembly_misc.C\
-	assembly_output.C\
-	assembly_pbcorrect.C\
-	assembly_reduceskimhits.C\
-	assembly_swalign.C\
-	contig_consensus.C\
-	contig_covanalysis.C\
-	contig_edit.C\
-	contig_featureinfo.C\
-	contig_output.C\
-	contig_pairconsistency.C\
-	dataprocessing.C\
-	dynamic.C\
-	gbf_parse.C\
-	gff_parse.C\
-	gff_save.C\
-	maf_parse.C\
-	manifest.C\
-	multitag.C\
-	parameters_flexer.ll\
-	parameters.C \
-	pcrcontainer.C \
-	ppathfinder.C\
-	preventinitfiasco.C\
-	readgrouplib.C\
-	readlotstat.C\
-	readpool.C\
-	readpool_io.C\
-	sam_collect.C\
-	scaffolder.C\
-	seqtohash.C\
-	simplebloomfilter.C\
-	skim_lowbph.C\
-	warnings.C
-noinst_HEADERS= adsfacts.H\
-	ads.H\
-	assembly_output.H\
-	parameters.H\
-	align.H\
-	assembly_info.H\
-	assembly.H\
-	contig.H\
-	dataprocessing.H\
-	dynamic.H\
-	enums.H\
-	gbf_parse.H\
-	gff_parse.H\
-	gff_save.H\
-	hashstats.H\
-	hdeque.H\
-	manifest.H\
-	maf_parse.H\
-	multitag.H\
-	overlapedges.H\
-	parameters_tokens.h\
-	pcrcontainer.H \
-	ppathfinder.H\
-	read.H\
-	readgrouplib.H\
-	readlotstat.H\
-	readpool.H\
-	readpool_io.H\
-	readseqtypes.H\
-	sam_collect.H\
-	scaffolder.H\
-	seqtohash.H\
-	simple_2Dsignalprocessing.H\
-	simplebloomfilter.H\
-	skim.H\
-	stringcontainer.H\
-	structs.H\
-	timerestrict.H\
-	types_basic.H\
-	vhash.H\
-	vluint.H\
-	warnings.H
 
 libmiraestass_a_SOURCES= estassembly.C
+
+
+
diff --git a/src/mira/Makefile.in b/src/mira/Makefile.in
index a31608c..fe9e17a 100644
--- a/src/mira/Makefile.in
+++ b/src/mira/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -40,14 +40,22 @@ DIST_COMMON = $(dist_pkgdata_DATA) $(noinst_HEADERS) \
 	$(srcdir)/Makefile.am $(srcdir)/Makefile.in TODO \
 	parameters_flexer.cc
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/ax_boost_base.m4 \
-	$(top_srcdir)/m4/ax_boost_filesystem.m4 \
-	$(top_srcdir)/m4/ax_boost_iostreams.m4 \
-	$(top_srcdir)/m4/ax_boost_regex.m4 \
-	$(top_srcdir)/m4/ax_boost_system.m4 \
-	$(top_srcdir)/m4/ax_boost_thread.m4 \
-	$(top_srcdir)/m4/ax_check_zlib.m4 \
-	$(top_srcdir)/m4/ax_lib_expat.m4 $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/config/m4/ax_boost_base.m4 \
+	$(top_srcdir)/config/m4/ax_boost_regex.m4 \
+	$(top_srcdir)/config/m4/ax_boost_thread.m4 \
+	$(top_srcdir)/config/m4/ax_check_zlib.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_std.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_stl.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_namespaces.m4 \
+	$(top_srcdir)/config/m4/ax_lib_expat.m4 \
+	$(top_srcdir)/config/m4/ax_with_perl.m4 \
+	$(top_srcdir)/config/m4/ax_with_prog.m4 \
+	$(top_srcdir)/config/m4/libtool.m4 \
+	$(top_srcdir)/config/m4/ltoptions.m4 \
+	$(top_srcdir)/config/m4/ltsugar.m4 \
+	$(top_srcdir)/config/m4/ltversion.m4 \
+	$(top_srcdir)/config/m4/lt~obsolete.m4 \
+	$(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -57,28 +65,12 @@ LIBRARIES = $(noinst_LIBRARIES)
 ARFLAGS = cru
 libmira_a_AR = $(AR) $(ARFLAGS)
 libmira_a_LIBADD =
-am__objects_1 =
-am_libmira_a_OBJECTS = $(am__objects_1) hashstats_sdbg.$(OBJEXT) \
-	hashstats.$(OBJEXT) skim.$(OBJEXT) assembly.$(OBJEXT) \
-	contig.$(OBJEXT) read.$(OBJEXT) contig_analysis.$(OBJEXT) \
-	ads.$(OBJEXT) adsfacts.$(OBJEXT) align.$(OBJEXT) \
-	assembly_info.$(OBJEXT) assembly_buildcontigs.$(OBJEXT) \
-	assembly_io.$(OBJEXT) assembly_misc.$(OBJEXT) \
-	assembly_output.$(OBJEXT) assembly_pbcorrect.$(OBJEXT) \
+am_libmira_a_OBJECTS = assembly.$(OBJEXT) scaffolder.$(OBJEXT) \
+	skim.$(OBJEXT) dataprocessing.$(OBJEXT) assembly_io.$(OBJEXT) \
+	assembly_repeatresolve.$(OBJEXT) \
 	assembly_reduceskimhits.$(OBJEXT) assembly_swalign.$(OBJEXT) \
-	contig_consensus.$(OBJEXT) contig_covanalysis.$(OBJEXT) \
-	contig_edit.$(OBJEXT) contig_featureinfo.$(OBJEXT) \
-	contig_output.$(OBJEXT) contig_pairconsistency.$(OBJEXT) \
-	dataprocessing.$(OBJEXT) dynamic.$(OBJEXT) gbf_parse.$(OBJEXT) \
-	gff_parse.$(OBJEXT) gff_save.$(OBJEXT) maf_parse.$(OBJEXT) \
-	manifest.$(OBJEXT) multitag.$(OBJEXT) \
-	parameters_flexer.$(OBJEXT) parameters.$(OBJEXT) \
-	pcrcontainer.$(OBJEXT) ppathfinder.$(OBJEXT) \
-	preventinitfiasco.$(OBJEXT) readgrouplib.$(OBJEXT) \
-	readlotstat.$(OBJEXT) readpool.$(OBJEXT) readpool_io.$(OBJEXT) \
-	sam_collect.$(OBJEXT) scaffolder.$(OBJEXT) seqtohash.$(OBJEXT) \
-	simplebloomfilter.$(OBJEXT) skim_lowbph.$(OBJEXT) \
-	warnings.$(OBJEXT)
+	newpathfinder.$(OBJEXT)
+am__objects_1 =
 nodist_libmira_a_OBJECTS = $(am__objects_1)
 libmira_a_OBJECTS = $(am_libmira_a_OBJECTS) \
 	$(nodist_libmira_a_OBJECTS)
@@ -86,6 +78,16 @@ libmiraestass_a_AR = $(AR) $(ARFLAGS)
 libmiraestass_a_LIBADD =
 am_libmiraestass_a_OBJECTS = estassembly.$(OBJEXT)
 libmiraestass_a_OBJECTS = $(am_libmiraestass_a_OBJECTS)
+libmirasupport_a_AR = $(AR) $(ARFLAGS)
+libmirasupport_a_LIBADD =
+am_libmirasupport_a_OBJECTS = contig.$(OBJEXT) gff_parse.$(OBJEXT) \
+	parameters_flexer.$(OBJEXT) multitag.$(OBJEXT) \
+	maf_parse.$(OBJEXT) adsfacts.$(OBJEXT) ads.$(OBJEXT) \
+	assembly_output.$(OBJEXT) assembly_info.$(OBJEXT) \
+	readpool.$(OBJEXT) contig_output.$(OBJEXT) \
+	contig_analysis.$(OBJEXT) contig_edit.$(OBJEXT) read.$(OBJEXT) \
+	align.$(OBJEXT) dynamic.$(OBJEXT) parameters.$(OBJEXT)
+libmirasupport_a_OBJECTS = $(am_libmirasupport_a_OBJECTS)
 DEFAULT_INCLUDES = -I. at am__isrc@
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
@@ -99,9 +101,9 @@ CXXLD = $(CXX)
 CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	--mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
 	$(LDFLAGS) -o $@
-LEXCOMPILE = $(LEX) $(AM_LFLAGS) $(LFLAGS)
+LEXCOMPILE = $(LEX) $(LFLAGS) $(AM_LFLAGS)
 LTLEXCOMPILE = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=compile $(LEX) $(AM_LFLAGS) $(LFLAGS)
+	--mode=compile $(LEX) $(LFLAGS) $(AM_LFLAGS)
 YLWRAP = $(top_srcdir)/ylwrap
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -113,8 +115,9 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
 	$(LDFLAGS) -o $@
 SOURCES = $(libmira_a_SOURCES) $(nodist_libmira_a_SOURCES) \
-	$(libmiraestass_a_SOURCES)
-DIST_SOURCES = $(libmira_a_SOURCES) $(libmiraestass_a_SOURCES)
+	$(libmiraestass_a_SOURCES) $(libmirasupport_a_SOURCES)
+DIST_SOURCES = $(libmira_a_SOURCES) $(libmiraestass_a_SOURCES) \
+	$(libmirasupport_a_SOURCES)
 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
 am__vpath_adj = case $$p in \
     $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@@ -136,12 +139,6 @@ am__nobase_list = $(am__nobase_strip_setup); \
 am__base_list = \
   sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
   sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
-am__uninstall_files_from_dir = { \
-  test -z "$$files" \
-    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
-    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
-         $(am__cd) "$$dir" && rm -f $$files; }; \
-  }
 am__installdirs = "$(DESTDIR)$(pkgdatadir)"
 DATA = $(dist_pkgdata_DATA)
 HEADERS = $(noinst_HEADERS)
@@ -159,13 +156,9 @@ AWK = @AWK@
 BITPACKAGE = @BITPACKAGE@
 BLOODYDARWINSTATLIBDIRHACK = @BLOODYDARWINSTATLIBDIRHACK@
 BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
-BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@
-BOOST_IOSTREAMS_LIB = @BOOST_IOSTREAMS_LIB@
 BOOST_LDFLAGS = @BOOST_LDFLAGS@
 BOOST_REGEX_LIB = @BOOST_REGEX_LIB@
-BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@
 BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
-BUNDLETARGET = @BUNDLETARGET@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
@@ -178,7 +171,6 @@ CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -188,13 +180,11 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LDFLAGS = @EXPAT_LDFLAGS@
-EXPAT_LIBS = @EXPAT_LIBS@
 EXPAT_VERSION = @EXPAT_VERSION@
 FGREP = @FGREP@
 FLEX = @FLEX@
 FLEXPP = @FLEXPP@
 GREP = @GREP@
-HAVE_XXD = @HAVE_XXD@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -212,7 +202,6 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
 MIRASTATIC = @MIRASTATIC@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
@@ -229,17 +218,18 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
+SHORTMIRAAUDIENCE = @SHORTMIRAAUDIENCE@
 STRIP = @STRIP@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -273,6 +263,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -288,112 +279,20 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-AM_CPPFLAGS = -I$(top_srcdir)/src $(all_includes)
-EXTRA_DIST = CHANGES.txt CHANGES_old.txt
+INCLUDES = -I$(top_srcdir)/src $(all_includes)
 SUFFIXES = .xxd
-noinst_LIBRARIES = libmiraestass.a libmira.a
-#noinst_LIBRARIES = libmirasupport.a libmira.a
-libmira_a_XXDSRC = adaptorsforclip.454.xxd adaptorsforclip.solexa.xxd adaptorsforclip.iontor.xxd adaptorsregex.solexa.xxd adaptorsregex.iontor.xxd seqforfilter_phix174.solexa.xxd
+noinst_LIBRARIES = libmiraestass.a libmirasupport.a libmira.a 
+libmira_a_XXDSRC = adaptorsforclip.454.xxd adaptorsforclip.solexa.xxd adaptorsforclip.iontor.xxd adaptorsregex.solexa.xxd adaptorsregex.iontor.xxd
+EXTRA_DIST = CHANGES.txt CHANGES_old.txt
 BUILT_SOURCES = $(libmira_a_XXDSRC:.xxd=.xxd.H)
 nodist_libmira_a_SOURCES = $(libmira_a_XXDSRC:.xxd=.xxd.H)
 dist_pkgdata_DATA = demoparam.prm
 
-# put hashstats, assembly, read, contig, etc. in front: with make -j .... they'll get made first
+# put read and contig in front: with make -j .... they'll get made first
 #  and won't block the rest.
-libmira_a_SOURCES = \
-	$(libmira_a_XXDSRC) \
-	hashstats_sdbg.C\
-	hashstats.C\
-	skim.C\
-	assembly.C\
-	contig.C\
-	read.C\
-	contig_analysis.C\
-	ads.C\
-	\
-	adsfacts.C\
-	align.C\
-	assembly_info.C\
-	assembly_buildcontigs.C\
-	assembly_io.C\
-	assembly_misc.C\
-	assembly_output.C\
-	assembly_pbcorrect.C\
-	assembly_reduceskimhits.C\
-	assembly_swalign.C\
-	contig_consensus.C\
-	contig_covanalysis.C\
-	contig_edit.C\
-	contig_featureinfo.C\
-	contig_output.C\
-	contig_pairconsistency.C\
-	dataprocessing.C\
-	dynamic.C\
-	gbf_parse.C\
-	gff_parse.C\
-	gff_save.C\
-	maf_parse.C\
-	manifest.C\
-	multitag.C\
-	parameters_flexer.ll\
-	parameters.C \
-	pcrcontainer.C \
-	ppathfinder.C\
-	preventinitfiasco.C\
-	readgrouplib.C\
-	readlotstat.C\
-	readpool.C\
-	readpool_io.C\
-	sam_collect.C\
-	scaffolder.C\
-	seqtohash.C\
-	simplebloomfilter.C\
-	skim_lowbph.C\
-	warnings.C
-
-noinst_HEADERS = adsfacts.H\
-	ads.H\
-	assembly_output.H\
-	parameters.H\
-	align.H\
-	assembly_info.H\
-	assembly.H\
-	contig.H\
-	dataprocessing.H\
-	dynamic.H\
-	enums.H\
-	gbf_parse.H\
-	gff_parse.H\
-	gff_save.H\
-	hashstats.H\
-	hdeque.H\
-	manifest.H\
-	maf_parse.H\
-	multitag.H\
-	overlapedges.H\
-	parameters_tokens.h\
-	pcrcontainer.H \
-	ppathfinder.H\
-	read.H\
-	readgrouplib.H\
-	readlotstat.H\
-	readpool.H\
-	readpool_io.H\
-	readseqtypes.H\
-	sam_collect.H\
-	scaffolder.H\
-	seqtohash.H\
-	simple_2Dsignalprocessing.H\
-	simplebloomfilter.H\
-	skim.H\
-	stringcontainer.H\
-	structs.H\
-	timerestrict.H\
-	types_basic.H\
-	vhash.H\
-	vluint.H\
-	warnings.H
-
+libmirasupport_a_SOURCES = contig.C gff_parse.C parameters_flexer.ll multitag.C maf_parse.C adsfacts.C ads.C assembly_output.C assembly_info.C readpool.C contig_output.C contig_analysis.C  contig_edit.C read.C align.C dynamic.C parameters.C 
+libmira_a_SOURCES = assembly.C scaffolder.C skim.C dataprocessing.C assembly_io.C assembly_repeatresolve.C assembly_reduceskimhits.C assembly_swalign.C newpathfinder.C adaptorsforclip.454.xxd adaptorsforclip.solexa.xxd adaptorsforclip.iontor.xxd adaptorsregex.solexa.xxd adaptorsregex.iontor.xxd
+noinst_HEADERS = adsfacts.H ads.H assembly_output.H parameters.H align.H assembly_info.H assembly.H  contig.H dynamic.H enums.H gff_parse.H indexed_deque.H maf_parse.H multitag.H newpathfinder.H read.H readpool.H stringcontainer.H structs.H skim.H parameters_tokens.h timerestrict.H scaffolder.H 
 libmiraestass_a_SOURCES = estassembly.C
 all: $(BUILT_SOURCES)
 	$(MAKE) $(AM_MAKEFLAGS) all-am
@@ -433,14 +332,18 @@ $(am__aclocal_m4_deps):
 
 clean-noinstLIBRARIES:
 	-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
-libmira.a: $(libmira_a_OBJECTS) $(libmira_a_DEPENDENCIES) $(EXTRA_libmira_a_DEPENDENCIES) 
+libmira.a: $(libmira_a_OBJECTS) $(libmira_a_DEPENDENCIES) 
 	-rm -f libmira.a
 	$(libmira_a_AR) libmira.a $(libmira_a_OBJECTS) $(libmira_a_LIBADD)
 	$(RANLIB) libmira.a
-libmiraestass.a: $(libmiraestass_a_OBJECTS) $(libmiraestass_a_DEPENDENCIES) $(EXTRA_libmiraestass_a_DEPENDENCIES) 
+libmiraestass.a: $(libmiraestass_a_OBJECTS) $(libmiraestass_a_DEPENDENCIES) 
 	-rm -f libmiraestass.a
 	$(libmiraestass_a_AR) libmiraestass.a $(libmiraestass_a_OBJECTS) $(libmiraestass_a_LIBADD)
 	$(RANLIB) libmiraestass.a
+libmirasupport.a: $(libmirasupport_a_OBJECTS) $(libmirasupport_a_DEPENDENCIES) 
+	-rm -f libmirasupport.a
+	$(libmirasupport_a_AR) libmirasupport.a $(libmirasupport_a_OBJECTS) $(libmirasupport_a_LIBADD)
+	$(RANLIB) libmirasupport.a
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -452,50 +355,29 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/adsfacts.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/align.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/assembly.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/assembly_buildcontigs.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/assembly_info.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/assembly_io.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/assembly_misc.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/assembly_output.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/assembly_pbcorrect.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/assembly_reduceskimhits.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/assembly_repeatresolve.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/assembly_swalign.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/contig.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/contig_analysis.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/contig_consensus.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/contig_covanalysis.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/contig_edit.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/contig_featureinfo.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/contig_output.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/contig_pairconsistency.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dataprocessing.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dynamic.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/estassembly.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gbf_parse.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gff_parse.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gff_save.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hashstats.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hashstats_sdbg.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/maf_parse.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/manifest.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/multitag.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/newpathfinder.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parameters.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parameters_flexer.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pcrcontainer.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ppathfinder.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/preventinitfiasco.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/read.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/readgrouplib.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/readlotstat.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/readpool.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/readpool_io.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/sam_collect.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/scaffolder.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/seqtohash.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/simplebloomfilter.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/skim.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/skim_lowbph.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/warnings.Po at am__quote@
 
 .C.o:
 @am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@@ -564,7 +446,9 @@ uninstall-dist_pkgdataDATA:
 	@$(NORMAL_UNINSTALL)
 	@list='$(dist_pkgdata_DATA)'; test -n "$(pkgdatadir)" || list=; \
 	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
-	dir='$(DESTDIR)$(pkgdatadir)'; $(am__uninstall_files_from_dir)
+	test -n "$$files" || exit 0; \
+	echo " ( cd '$(DESTDIR)$(pkgdatadir)' && rm -f" $$files ")"; \
+	cd "$(DESTDIR)$(pkgdatadir)" && rm -f $$files
 
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
@@ -667,15 +551,10 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	if test -z '$(STRIP)'; then \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	      install; \
-	else \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-	fi
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
 mostlyclean-generic:
 
 clean-generic:
@@ -691,8 +570,8 @@ maintainer-clean-generic:
 	-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
 clean: clean-am
 
-clean-am: clean-generic clean-libtool clean-local \
-	clean-noinstLIBRARIES mostlyclean-am
+clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
+	mostlyclean-am
 
 distclean: distclean-am
 	-rm -rf ./$(DEPDIR)
@@ -763,23 +642,19 @@ uninstall-am: uninstall-dist_pkgdataDATA
 .MAKE: all check install install-am install-strip
 
 .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
-	clean-libtool clean-local clean-noinstLIBRARIES ctags \
-	distclean distclean-compile distclean-generic \
-	distclean-libtool distclean-tags distdir dvi dvi-am html \
-	html-am info info-am install install-am install-data \
-	install-data-am install-dist_pkgdataDATA install-dvi \
-	install-dvi-am install-exec install-exec-am install-html \
-	install-html-am install-info install-info-am install-man \
-	install-pdf install-pdf-am install-ps install-ps-am \
-	install-strip installcheck installcheck-am installdirs \
-	maintainer-clean maintainer-clean-generic mostlyclean \
-	mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
-	pdf pdf-am ps ps-am tags uninstall uninstall-am \
-	uninstall-dist_pkgdataDATA
-
-
-clean-local:
-	rm -rf *flexer.cc *xxd.H
+	clean-libtool clean-noinstLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am \
+	install-dist_pkgdataDATA install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags uninstall uninstall-am uninstall-dist_pkgdataDATA
+
 
 %.xxd.H: %.xxd
 	@echo "Making .H out of .xxd" $@
diff --git a/src/mira/TODO b/src/mira/TODO
index e6dc0b6..3ad412a 100644
--- a/src/mira/TODO
+++ b/src/mira/TODO
@@ -1,245 +1,7 @@
-
-Maybe for EST/RNASeq assembly only?
-
-disallow short overlaps (even 100% matches) on low entropy
-
-The below joined two different proteins together.
-
-         hictree_br:1:1208:3561:53878/1   - atgagtttgtgtctacctaatgaataatacatatat*tttttatttTcttaaaaaaaa
-         hictree_br:1:1203:19652:53508    - atgagtttgtgtctacctaatgaataatacatatat*tttttatttTcttaaaa
-100%     hictree_br:1:1115:10648:15532/1  - atgagtttgtgtctacctaatgaataatacatatat*tttttatttTcttaaaaaaaaa
-         hictree_br:1:2103:2240:67066     + atgagtttg
-         hictree_br:1:1209:15440:14393    - atgagtttgtgtctacctaatgaataatacatatat*tttttaAAAaAA
-         hictree_br:1:1111:6993:9703/1    - atgagtttgtgtctacctaat
-         hictree_br:1:2105:16335:20880    +                              cTGaACtGCAACtatttacttaaaaaaaaaa
-         hictree_br:1:1102:16982:53407/2  -                                    tGCAACtatttTcttaaaaaaaaaa
-         hictree_br:1:1207:3054:24329/2   +                                      CAACtatttacttaaaaaaaaaa
-         hictree_br:1:1207:6278:13826/1   -                                      CAACtatttTcttaaaaaaaaaa
-         mictree_br:1:1107:5162:22321/2   -                                       AACtatttacttaaaaaaaaaa
-100%     mictree_br:1:1115:5293:7671/2    -                                           atttTcttaaaaaaaaaa
-         mictree_br:1:1102:12199:12157/2  -                                           atttacttaaaaaaaaaa
-
-Above: polyA-9 and poly-T 4 (total 13) on 18 bp match
-
-Idea: if sum of poly-runs >=4 is >=50% of overlap, reject. Maybe for overlaps
-<20 (25? 30? 40?) Also maybe if contains a run >=8 on overlaps <= 20-25?
-
------------------------------------
-
-contig_consensus: makeIntelligentConsensus()
-helper2 remade for solexa, need to redo for others, too:
-- return all possible groups, let the predictlevel choose afterwards!
-
------------------------------------
-
-assembly.C:
-markReadsWithInvalidKMerEndsAsChimeras_Pool and
-markReadsWithRareKMersAsChimeras_Pool throw out single coverage reads in
-mapping. Switched off in mapping for now. See whether to switch back on
-again.
-
------------------------------------
-
-sxa300
-
-1. ppathfinder: deprioritise
-  - not well_connected + no valid kmer at ends
-
-2. contig building: starting in pass3?
-  - iteratively cut back read overhangs without valid kmer and remove from contig
-
-...
-
---
-- Why does contig building not always give same start contig on restart?
-
------------------------------------
-
-On resume: how to get some "increasing" parameters (-SK:bph, maybe others???)
-up to value needed for pass in resume?
-
------------------------------------
-
-Unify clipping log output, tabular.
-
------------------------------------
-
-keep -AL:mo=25 aligned with -SK:bph=17 ??? when using multiple pass with
-increasing bph?
-
------------------------------------
-
-!!!!!!!!!!!!! CLAM ribDypuD search: iteration 1. Did not assemble 100% matches???
-
------------------------------------
-
-maybe optimise the keeping of persistent overlaps?
-RhoSPhae 80x 100bp shotgun: 1 GiB file
-Eco 1655 2*3m 100bp: 2.7 GiB
-
------------------------------------
-
-simple scaffolder. soon!
-
------------------------------------
-
-implement no truncate within SKIM of _posmatch?_pass.*.bin when doing mapping only???
-
------------------------------------
-
-populate more data for *_info_readgroups.txt
-
------------------------------------
-
-instead of using fixed -CL:pmkfr, maybe scale back to pmkfr=1 on kmers with
-high GC?
-
------------------------------------
-
-go through code and make use of boost::filesystem /-operator to construct
-file and path names.
-
------------------------------------
-
-Assembly with -AS:nop=3, stopped in pass 2 and resumed: just calculates pass 2
-and stopps without a pass 3???
-
------------------------------------
-
-neisseria:
-paired-end wishlist
-
------------------------------------
-
-apropos function on manifest parameters
-
------------------------------------
-
-Loading of CAF/ MAF for assembly:
-
-if manifest like this
-readgroup
-technology=pcbiohq
-data=... .maf
-
-but the MAF contains, e.g., Solexa, MIRA does not know about the
-Solexas after the manifest parsed and hence did not prepared its
-parameters!
-
-*sigh*
-
------------------------------------
-
-sam depad : no "allstrains" consensus embedded in MAF anymore?
-
------------------------------------
-
-Read::getDigiNormMultiplier();
-
-eventually cache a boolean for quick yes/no?
-
------------------------------------
-
-removing pcr duplicates (solexa)
-
-work on pairs per read group: need to have the same direction, length and same crc32/md5 for segment pairs
-
-eg
-
-pair 1   + aaaa/1           - gggg/2
-pair 2   + aaaa/1           - gggg/2
-pair 3   + aaaa/1           - gggg/2
-
-but not
-         + aaa/1            - gggg/2
-         + aaTa/1           - gggg/2
-         + aaaa/2           - gggg/1
-         - aaaa/1           + gggg/2
-
-
-Then (for genomes only?):
-if readgroup had "enough" duplicates seen earlier and/or if hashstats avg freq
-"OK", remove single read duplicate: same length, same crc32/md5, same segment
-
-
-Then (for genomes only?):
-analyse contig for pcr dup patterns (same start, same end)
-
------------------------------------
-
--SB:abnc gives totally weird results (first 2kb bs168)
-
------------------------------------
-
-John, bughunt, SEnt small map
-HWI-ST724:221:C1BU4ACXX:5:1102:16881:253
-misaligned!!!!
-
-problem goes away after git 426f466a946300e8d84ab66043cd6cc2831596fa
-but it's just because the misalignment bug is not triggered anymore
-need to still hunt down.
-
------------------------------------
-
-Titus:
-digital normalisation include in MIRA?
-Read: median of kmer frequency >= threshold, throw away
-MIRA: keep reads which have untaken kmers >= threshold (+/-)
-MIRA: get average kmer cov x, norm average coverage to y<x with y ~ 5-10
-MIRA: keep read-pairs
-Problem est/RNASeq: unprocessed mRNA
-
-kmer include in MIRA?
-
-kmer: max k?
-
-digital normalisation of partitioning for metagenomics / est???
-
-trinity recommends diginorm for rnaseq
-
------------------------------------
-
-walkthrough for NCBI data: loading .fna, .gff3 and assembly of SRA
-
------------------------------------
-
-docs for -CL:pmkfr:cbse
-
------------------------------------
-
-resume mapping assemblies! (is that needed or "simply not supported"?
-
-need to save backbone sequences and rails as contigs, taking them out of
-normal readpool.maf. This would/might destroy read order ... need to also save read
-order in readpool.
-
------------------------------------
-
-move Read::isUsedInAssembly() to Assembly
----> merge with other flags into a bitfiled?
-
-
------------------------------------
-EST:
-
-categorise reads as possible introns by coverage within a contig if no SRMc
-
------------------------------------
-
-reactivate TCS
-
-
------------------------------------
-
 document ltr2mfsm, mfsm tags
 make user able to define own tags to mfsm
 
-document fcov example
-
-document clipping options of -CL:pec group, -CL:rkm
-
 -----------------------------------
-
 > During the 3 steps of the miraSearchESTSNPs pipeline I encountered several
 > problems, that were overcome with a few �scamotages that I�m not sure were
 > properly addressed. First of all, I had problems in highering the assembly
@@ -252,15 +14,28 @@ document clipping options of -CL:pec group, -CL:rkm
 Oooops ... you sure about that? I'll need to have a look at that one.
 --------------------------------
 
-idee: count how often read is incorporated in contigs without involvement in
+idee: count how often read is incorporated in contigs without involvement in 
  new SRMc. last pass: throw out / remove well connected status for reads
  never OK
 idee: lastpast, cut back ends not covered by HAF tags (+2 into HAF??)
 
 --------------------------------
 
-implement BLOOM filter for shash statistics as pre-filter
-First pass BLOOM, storing hashes >= 2x in the filter
+Skim: diskhash_t: also insert count. Keep in memory 50-100m entries, sort,
+write out already partially counted (==compressed) version. Should use much
+less disk space!
+
+later ... perhaps have multiple buffers and threads: one filling, several
+other sorting / compressing / writing.
+
+--------------------------------
+
+pathfinder: n4_findNextGoodOverlap()
+breaking loop at >=3000 checks is not optimal
+
+--------------------------------
+
+MAF: have read orientation saved somehow to MAF / CAF?
 
 --------------------------------
 
@@ -283,7 +58,7 @@ document/parametrise skim.C analyseHashes(): fwdrevmin
 document: -OUT:org3
 -----------------------------------
 
-implement VCF, BED
+implement VCF, BED, GFF
 
 scere artificial: pass 2
 400m edges added by rsh4_takeReptPEPEHitsThatExtend(20,100,fname, blockpos,
@@ -306,6 +81,11 @@ replace INCLUDES in Makefile.am with CXXFLAGS=-I... // progs: look at itxt
 configurable: 64 instead of 16 files for hstat.
 
 
+newpathfinder: new n4_searchBest...Genome(): perhaps make a bit more
+   intelligent?
+
+
+
 aci_adp: hybrid ... SRMr tags set only in 454 reads, not sxa???
 
 
@@ -329,6 +109,8 @@ Problem: Very, very spurious overhang misassemblies. All HAF3. If detectable,
          xx...............................
 ------------------------------------------------------------------------------
 
+REA_strainid is now unnecessary
+
 document order of file creation
 document hard/soft Solexa filters
 
@@ -385,6 +167,32 @@ DOCUMENTATION
 ==================================
 
 
+write doc: where do reads land? (debris, _s, _c)
+
+I'll need to improve logging on the things you reported ... why reads "fall out" etc. Basically, a few possibilities arise:
+
+- too short (you noticed that)
+- no hit in SKIM phase (no overlap to nothing found). Which means, true
+  singlets. Or sequencing junk.
+- no hit confirmation in Smith-Waterman overlap checking. Here too, either
+  singlet or too many sequencing errors.
+
+Anyway, everything which gets sorted out here lands in the debris.
+
+If reads passed this stage, they will go to contig assembly. Here, a few things can happen:
+- they assemble well and are happily integrated into contigs
+- they assemble not so well (because of repeats, are taken apart again but
+  still don't assemble 
+
+The handling of these reads is governed by -OUT:sssip and -OUT:stsip, please consult the docs ... oh, darn, they have not been documented yet. In short:  if -OUT:ssip is "yes", every singlet lands as "_s" in the result file (which might be overkill for 454 projects). If -OUT:sssip is "no" (default), -OUT:sts decides: some reads will have flags/tags (SRMr, WRMr or the different SNP categories) because MIRA found repeat marker bases. Singlets with these flags are dragged along as "_s", tho [...]
+
+That is: in the default config (-OUT.sssip=no:stsip=yes) you still get everything that MIRA thinks might be valuable because it did assemble at some point or another (even if not so well). But be reminded that reads in the debris are not junk per se: especially in EST projects these might be the really rare transcripts. But MIRA has absolutely no way to discern them from sequencing junk as they did not align to anything.
+
+
+
+> 2. what is the actual difference between 'accurate' and 'normal'?
+
+I don't remember exactly for that version. Easiest thing for you to do: in an empty directory, use the same command line with once "accurate" and once "normal" (redirecting to different logs) and then do a diff on the logs which will show you the parameters that changed.
 
 
 use
@@ -394,7 +202,7 @@ http://www.ncbi.nlm.nih.gov/Traces/sra/sra.cgi?run=SRR005482&cmd=viewer&m=data&s
 to write a paired / unpaired 454 assembly guide
 
 
-use
+use 
 
 SRR005677 (Acinetobacter sp. ATCC 27244) Solexa + 454
 
@@ -410,17 +218,27 @@ SRR005677 (Acinetobacter sp. ATCC 27244) Solexa + 454
 HIGHEST PRIORITY (2.9.x)
 ==================================
 
-idea: pass 1: no ads_enforce_clean_ends, no editing,
+idea: pass 1: no ads_enforce_clean_ends, no editing, 
       pass 2: switch on enforce
       pass 3: switch on editing (or in pass2?)
-      after 2 rounds edit, recalc *all* reads with SRM/WRM
+      after 2 rounds edit, recalc *all* reads with SRM/WRM 
+
 
+Fahrplan:
+fasta2frag:
+DONE - paired-end
 
 
+n3pathfinder:
+- overlapfinder for contigs that started with MC read
+
 skim:
 - (eventually, if easy, else later): prefer to write skim results with non-mc
   overlaps
 
+reduceSkim:
+- load/save skim hits as binary?
+
 
 Hmmm... bs168:
 - sequencing bias. Idea: if more than x reads align at same position, same
@@ -449,6 +267,12 @@ CCCCAGTAGCGGCGAGCGAACGGGGAGCAGCCCAGAGCCTGAATCAGTATGTGTGTTAGTGGAAGCGT  cons
                                    x  x xx  xx xx  xxx   xx     xxx
 
 
+newpathfinder: flag for "contig has nonmulticopyreads" so that
+usestricttemplatepairrule can be loosened
+
+newpathfinder: do not ban paired-end which have a non-multicopy partner in the
+contig???
+
 
 replace -AL:egpl with mechanism not in Align class (for handling different
 strains)
@@ -507,6 +331,8 @@ Loading backbone: are SRMr tags transposed to rails??? (they must be!)
 HIGH PRIORITY
 ==================================
 
+feature analysis: probable copy number
+
 feature analysis: uppercasing /lowercasing sequences on mutation does not work
 for feature strain???
 
@@ -520,6 +346,8 @@ GBF: "ncRNA" are "gene" after gbf in assembly, caf->gap4->caf->gbf
 GBF: write "/codon_start" and "/transl_table" (and have convert_proejct a
 switch to choose the table
 
+*sigh* rework contig: find something better than deque<consensus_count_t> and
+ vector<contigread_t>?
 
 E0K6C4E02JXSHC (bs168) nachpr�fen warum mistig aligned? (ohne gap)
 
@@ -533,6 +361,8 @@ test miraclip/mirapre
 
 convert_project: caf2caf with -d deleteStarOnlyColumns() throws on GLL 14k
 
+done? enable saveStrainsAsFASTAQUAL for incremental write
+
 !!!!!!! STILL THERE??? GLL 7ksmall (and GLL full) after 1st pass:
         possible SRM tagged??? 138832_3005_0985 (pos 2657 in contig). miratest
         finds it???
@@ -548,7 +378,7 @@ MEDIUM PRIORITY
 
 add some parameter that allows to set mask tags that MIRA will not use in
 consensus computation (only if no other sequence is present). Needs als slight
-changes to
+changes to 
 
 Maximum allowed coverage? (start in loop ...). Use 1.5x avg cov as general
 threshold and 1.2x avg. cov for for "convicted multicopies" (rails can be
@@ -599,6 +429,9 @@ partner from contig
 
 ---------------------------
 
+support CAF/gap4 NOTES (put MINF there)
+
+
 
 SKIM: SRMr/CRMr als preferred match position mitziehen, wenn links & rechts
 davon hits, dann muss auch da ein hit sein?
@@ -630,8 +463,8 @@ getting clean alignments (stop if any read does not perform as
 advertised). re-edit that.
 
 read: changeQualityInSequence()? (baseruns) and align with lowest baserun qual
-base set to lowercase?
-ACGTAGTCTGACCCcACGTACGT
+base set to lowercase?  
+ACGTAGTCTGACCCcACGTACGT 
 ACGTAGTCTGACCC*ACGTACGT
 
 
@@ -669,8 +502,8 @@ stimmen kann?
 replace FUNCSTART with __PRETTY_FUNCTION__ (portability?)
 use __builtin_prefetch (portability)
 
-alignment of Read::READTYPE_...consshred with same type -> replace bmin
-with fixed value (e.g.21 or similar) to speed up massive oversampling
+alignment of Read::READTYPE_...consshred with same type -> replace bmin 
+with fixed value (e.g.21 or similar) to speed up massive oversampling 
 
 convert_project: CAF and other files with only reads: convert one read at a
 time (to save memory)
@@ -680,6 +513,8 @@ time (to save memory)
 TOCHECK
 ==================================
 
+mira --caf -AS:nop=1 -454data -OUT:oetc=yes ---> kein assembly?????
+
 multithreading: to prevent locks in alignments: 1 thread grabs all possible
 hits with first read equal
 
diff --git a/src/mira/adaptorsforclip.454.xxd b/src/mira/adaptorsforclip.454.xxd
index 6fabb95..65547a5 100644
--- a/src/mira/adaptorsforclip.454.xxd
+++ b/src/mira/adaptorsforclip.454.xxd
@@ -4,12 +4,10 @@
 #  will be stripped before processing with xxd, but restrain
 #  from adding comments to FASTA names (e.g. ">s1 some comment")
 #
-# Note that if you want to have sequences searched in
+# Note that if you want to have sequences searched in 
 # reverse complement direction, then the reverse complemented
 # sequences must be included extra in this file (see "rev_*"
 # down below
 #
->unknown_lookslike_adaptorB
+>unkown_lookslike_adaptorB
 ACTCGTATAGTGACACGCAACAGGGGATAGACAAGGCACACAGGGGATA
->unknown_from_cDNA_project_titanium450bp
-TTCGCAGTGAGTGACAGGCCACTGAGACTGCCAAGGCACACGAGGGGATAGG
diff --git a/src/mira/adaptorsforclip.iontor.xxd b/src/mira/adaptorsforclip.iontor.xxd
index a8cef61..40b54f3 100644
--- a/src/mira/adaptorsforclip.iontor.xxd
+++ b/src/mira/adaptorsforclip.iontor.xxd
@@ -4,21 +4,14 @@
 #  will be stripped before processing with xxd, but restrain
 #  from adding comments to FASTA names (e.g. ">s1 some comment")
 #
-# Note that if you want to have sequences searched in
+# Note that if you want to have sequences searched in 
 # reverse complement direction, then the reverse complemented
-# sequences must be included extra in this file
+# sequences must be included extra in this file (see "rev_*"
+# down below
 #
 # Derived from first test set
 >ion_adaptor1
 TGAGCATCGATCGATGTACAGCTACGTACGTC
 # Derived from set B14_387_CR_0.05
-# Confirmed by BEL-335 (Eco K12)
 >ion_adaptor2
 ATCACCGACTGCCCATAGAGAGGCTGAGACTGCCAAGGCACACAGGGGATAGG
-# Derived from C11-127_40X
-# (Eco shotgun)
-# maybe broken ion_adaptor2, misses 7 bases in the middle
-# 26256 occurrences
-# 45270 occurrences for truncated CCATCTG...
->ion_adaptor2_broken
-ATCACCGACTGCCCATCTGAGACTGCCAAGGCACACAGGGGATAGG
diff --git a/src/mira/adaptorsforclip.solexa.xxd b/src/mira/adaptorsforclip.solexa.xxd
index 467e19c..56b1023 100644
--- a/src/mira/adaptorsforclip.solexa.xxd
+++ b/src/mira/adaptorsforclip.solexa.xxd
@@ -4,14 +4,14 @@
 #  will be stripped before processing with xxd, but restrain
 #  from adding comments to FASTA names (e.g. ">s1 some comment")
 #
-# Note that if you want to have sequences searched in
+# Note that if you want to have sequences searched in 
 # reverse complement direction, then the reverse complemented
 # sequences must be included extra in this file (see "rev_*"
 # down below
 #
->Illumina_Single_End_Adapter_1
+>Illumina_Single_End_Apapter_1
 ACACTCTTTCCCTACACGACGCTGTTCCATCT
->Illumina_Single_End_Adapter_2
+>Illumina_Single_End_Apapter_2
 CAAGCAGAAGACGGCATACGAGCTCTTCCGATCT
 >Illumina_Single_End_PCR_Primer_1
 AATGATACGGCGACCACCGAGATCTACACTCTTTCCCTACACGACGCTCTTCCGATCT
@@ -261,9 +261,9 @@ CAAGCAGAAGACGGCATACGAGATTCGGGAGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA
 CAAGCAGAAGACGGCATACGAGATCTTCGAGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA
 >RNA_PCR_Primer_Index_48
 CAAGCAGAAGACGGCATACGAGATTGCCGAGTGACTGGAGTTCCTTGGCACCCGAGAATTCCA
->rev_Illumina_Single_End_Adapter_1
+>rev_Illumina_Single_End_Apapter_1
 AGATGGAACAGCGTCGTGTAGGGAAAGAGTGT
->rev_Illumina_Single_End_Adapter_2
+>rev_Illumina_Single_End_Apapter_2
 AGATCGGAAGAGCTCGTATGCCGTCTTCTGCTTG
 >rev_Illumina_Single_End_PCR_Primer_1
 AGATCGGAAGAGCGTCGTGTAGGGAAAGAGTGTAGATCTCGGTGGTCGCCGTATCATT
@@ -513,86 +513,3 @@ TGGAATTCTCGGGTGCCAAGGAACTCCAGTCACTCCCGAATCTCGTATGCCGTCTTCTGCTTG
 TGGAATTCTCGGGTGCCAAGGAACTCCAGTCACTCGAAGATCTCGTATGCCGTCTTCTGCTTG
 >rev_RNA_PCR_Primer_Index_48
 TGGAATTCTCGGGTGCCAAGGAACTCCAGTCACTCGGCAATCTCGTATGCCGTCTTCTGCTTG
-#
-# Nextera
-#
->nik_1_i7_n701
-CTGTCTCTTATACACATCTCCGAGCCCACGAGACTAAGGCGAATCTCGTATGCCGTCTTCTGCTTGA
->nik_1_i7_n702
-CTGTCTCTTATACACATCTCCGAGCCCACGAGACCGTACTAGATCTCGTATGCCGTCTTCTGCTTGA
->nik_1_i7_n703
-CTGTCTCTTATACACATCTCCGAGCCCACGAGACAGGCAGAAATCTCGTATGCCGTCTTCTGCTTGA
->nik_1_i7_n704
-CTGTCTCTTATACACATCTCCGAGCCCACGAGACTCCTGAGCATCTCGTATGCCGTCTTCTGCTTGA
->nik_1_i7_n705
-CTGTCTCTTATACACATCTCCGAGCCCACGAGACGGACTCCTATCTCGTATGCCGTCTTCTGCTTGA
->nik_1_i7_n706
-CTGTCTCTTATACACATCTCCGAGCCCACGAGACTAGGCATGATCTCGTATGCCGTCTTCTGCTTGA
->nik_1_i7_n707
-CTGTCTCTTATACACATCTCCGAGCCCACGAGACCTCTCTACATCTCGTATGCCGTCTTCTGCTTGA
->nik_1_i7_n708
-CTGTCTCTTATACACATCTCCGAGCCCACGAGACCAGAGAGGATCTCGTATGCCGTCTTCTGCTTGA
->nik_1_i7_n709
-CTGTCTCTTATACACATCTCCGAGCCCACGAGACGCTACGCTATCTCGTATGCCGTCTTCTGCTTGA
->nik_1_i7_n710
-CTGTCTCTTATACACATCTCCGAGCCCACGAGACCGAGGCTGATCTCGTATGCCGTCTTCTGCTTGA
->nik_1_i7_n711
-CTGTCTCTTATACACATCTCCGAGCCCACGAGACAAGAGGCAATCTCGTATGCCGTCTTCTGCTTGA
->nik_1_i7_n712
-CTGTCTCTTATACACATCTCCGAGCCCACGAGACGTAGAGGAATCTCGTATGCCGTCTTCTGCTTGA
->nik_1_i7_a701
-CTGTCTCTTATACACATCTCCGAGCCCACGAGACATCACGACATCTCGTATGCCGTCTTCTGCTTGA
->nik_1_i7_a702
-CTGTCTCTTATACACATCTCCGAGCCCACGAGACACAGTGGTATCTCGTATGCCGTCTTCTGCTTGA
->nik_1_i7_a703
-CTGTCTCTTATACACATCTCCGAGCCCACGAGACCAGATCCAATCTCGTATGCCGTCTTCTGCTTGA
->nik_1_i7_a704
-CTGTCTCTTATACACATCTCCGAGCCCACGAGACACAAACGGATCTCGTATGCCGTCTTCTGCTTGA
->nik_1_i7_a705
-CTGTCTCTTATACACATCTCCGAGCCCACGAGACACCCAGCAATCTCGTATGCCGTCTTCTGCTTGA
->nik_1_i7_a706
-CTGTCTCTTATACACATCTCCGAGCCCACGAGACAACCCCTCATCTCGTATGCCGTCTTCTGCTTGA
->nik_1_i7_a707
-CTGTCTCTTATACACATCTCCGAGCCCACGAGACCCCAACCTATCTCGTATGCCGTCTTCTGCTTGA
->nik_1_i7_a708
-CTGTCTCTTATACACATCTCCGAGCCCACGAGACCACCACACATCTCGTATGCCGTCTTCTGCTTGA
->nik_1_i7_a709
-CTGTCTCTTATACACATCTCCGAGCCCACGAGACGAAACCCAATCTCGTATGCCGTCTTCTGCTTGA
->nik_1_i7_a710
-CTGTCTCTTATACACATCTCCGAGCCCACGAGACTGTGACCAATCTCGTATGCCGTCTTCTGCTTGA
->nik_1_i7_a711
-CTGTCTCTTATACACATCTCCGAGCCCACGAGACAGGGTCAAATCTCGTATGCCGTCTTCTGCTTGA
->nik_1_i7_a712
-CTGTCTCTTATACACATCTCCGAGCCCACGAGACAGGAGTGGATCTCGTATGCCGTCTTCTGCTTGA
->nik_1_i5_n501
-CTGTCTCTTATACACATCTGACGCTGCCGACGAGCGATCTAGTGTAGATCTCGGTGGTCGCCGTATCATT
->nik_1_i5_n502
-CTGTCTCTTATACACATCTGACGCTGCCGACGAATAGAGAGGTGTAGATCTCGGTGGTCGCCGTATCATT
->nik_1_i5_n503
-CTGTCTCTTATACACATCTGACGCTGCCGACGAAGAGGATAGTGTAGATCTCGGTGGTCGCCGTATCATT
->nik_1_i5_n504
-CTGTCTCTTATACACATCTGACGCTGCCGACGATCTACTCTGTGTAGATCTCGGTGGTCGCCGTATCATT
->nik_1_i5_n505
-CTGTCTCTTATACACATCTGACGCTGCCGACGACTCCTTACGTGTAGATCTCGGTGGTCGCCGTATCATT
->nik_1_i5_n506
-CTGTCTCTTATACACATCTGACGCTGCCGACGATATGCAGTGTGTAGATCTCGGTGGTCGCCGTATCATT
->nik_1_i5_n507
-CTGTCTCTTATACACATCTGACGCTGCCGACGATACTCCTTGTGTAGATCTCGGTGGTCGCCGTATCATT
->nik_1_i5_n508
-CTGTCTCTTATACACATCTGACGCTGCCGACGAAGGCTTAGGTGTAGATCTCGGTGGTCGCCGTATCATT
->nik_1_i5_a501
-CTGTCTCTTATACACATCTGACGCTGCCGACGAAAGGTTCAGTGTAGATCTCGGTGGTCGCCGTATCATT
->nik_1_i5_a502
-CTGTCTCTTATACACATCTGACGCTGCCGACGAACTTAGCAGTGTAGATCTCGGTGGTCGCCGTATCATT
->nik_1_i5_a503
-CTGTCTCTTATACACATCTGACGCTGCCGACGAAGAGAACAGTGTAGATCTCGGTGGTCGCCGTATCATT
->nik_1_i5_a504
-CTGTCTCTTATACACATCTGACGCTGCCGACGAGTGTCTTAGTGTAGATCTCGGTGGTCGCCGTATCATT
->nik_1_i5_a505
-CTGTCTCTTATACACATCTGACGCTGCCGACGATCGATTAGGTGTAGATCTCGGTGGTCGCCGTATCATT
->nik_1_i5_a506
-CTGTCTCTTATACACATCTGACGCTGCCGACGATGTTCTAGGTGTAGATCTCGGTGGTCGCCGTATCATT
->nik_1_i5_a507
-CTGTCTCTTATACACATCTGACGCTGCCGACGAGGAACTTAGTGTAGATCTCGGTGGTCGCCGTATCATT
->nik_1_i5_a508
-CTGTCTCTTATACACATCTGACGCTGCCGACGATAGACCTAGTGTAGATCTCGGTGGTCGCCGTATCATT
diff --git a/src/mira/adaptorsregex.iontor.xxd b/src/mira/adaptorsregex.iontor.xxd
index e04f3c7..318d260 100644
--- a/src/mira/adaptorsregex.iontor.xxd
+++ b/src/mira/adaptorsregex.iontor.xxd
@@ -1,12 +1,7 @@
-# first a master regexp (with ">" as first character which will be cut away
-# from RE) which triggers checking of subsequent regexes
-# then one regex per line until next master RE (or eof)
-#
+# one regex per line
 # derived from first data set
 # TGAGCATCGATCGATGTACAGCTACGTACGTC
->
 TGAGCATCGATCGATG.*
->ACGTACGTC
 GATGTACAGCTACGTACGTC$
 ATGTACAGCTACGTACGTC$
 TGTACAGCTACGTACGTC$
@@ -20,7 +15,6 @@ CTACGTACGTC$
 TACGTACGTC$
 ACGTACGTC$
 # Derived from set B14_387_CR_0.05
->GGGGATAGG
 CCAAGGCACACAGGGGATAGG$
 CAAGGCACACAGGGGATAGG$
 AAGGCACACAGGGGATAGG$
diff --git a/src/mira/adaptorsregex.solexa.xxd b/src/mira/adaptorsregex.solexa.xxd
index f49e280..42ccff1 100644
--- a/src/mira/adaptorsregex.solexa.xxd
+++ b/src/mira/adaptorsregex.solexa.xxd
@@ -1,7 +1,4 @@
-# first a master regexp (with ">" as first character which will be cut away
-# from RE) which triggers checking of subsequent regexes
-# then one regex per line until next master RE (or eof)
->GATCGGAAG
+# one regex per line
 GATCGGAAGAGCGGTT.*
 GATCGGAAGAGCGGT$
 GATCGGAAGAGCGG$
diff --git a/src/mira/ads.C b/src/mira/ads.C
index b9c629d..8cf0705 100644
--- a/src/mira/ads.C
+++ b/src/mira/ads.C
@@ -11,17 +11,17 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
 /*
@@ -33,18 +33,25 @@
  *
  */
 
+// 	$Id$	
+
+#ifndef lint
+static char vcid[] = "$Id$";
+#endif /* lint */
+
 
 #include "ads.H"
 
+#include <cstdio>
+
+#include <strings.h>
+#include <ctype.h>
+#include <iostream>
+
 #include "errorhandling/errorhandling.H"
 #include "util/dptools.H"
-#include "mira/ads.H"
 
-#include <cmath>
 
-using namespace std;
-
-#define CEBUG(bla)
 
 vector<double> AlignedDualSeq::ADS_powofstarcounter;
 
@@ -62,6 +69,12 @@ char AlignedDualSeq::ADS_consensus_gap_matrix[ADS_MATSIZE][ADS_MATSIZE];
 const bool AlignedDualSeq::ADS_initialisedstatics=AlignedDualSeq::staticInitialiser();
 
 
+void AlignedDualSeq::foolCompiler()
+{
+#include "stdinc/foolcompiler.C"
+}
+
+
 
 /*************************************************************************
  *
@@ -76,17 +89,16 @@ bool AlignedDualSeq::staticInitialiser()
 {
   ADS_powofstarcounter.resize(50,1);
   for(uint32 i=1; i<ADS_powofstarcounter.size(); i++){
-    ADS_powofstarcounter[i]=pow(static_cast<double>(.9),static_cast<double>(i));
+    ADS_powofstarcounter[i]=pow(.9,static_cast<double>(i));
   }
-  return true;
 }
 
 
-/*
+
 // Constructor with sequences already known
-AlignedDualSeq::AlignedDualSeq(MIRAParameters * params, const char * seq1, const char * seq2, readid_t id1, readid_t id2, int8 id1dir, int8 id2dir, bool enforce_clean_ends, bool dontpenalisengaps) : AlignedDualSeqFacts ()
+AlignedDualSeq::AlignedDualSeq(MIRAParameters * params, const char * seq1, const char * seq2, int32 id1, int32 id2, int8 id1dir, int8 id2dir, bool enforce_clean_ends, bool dontpenalisengaps) : AlignedDualSeqFacts ()
 {
-  FUNCSTART("AlignedDualSeq::AlignedDualSeq(MIRAParameters * params, const char * seq1, const char * seq2, readid_t id1, readid_t id2, int8 id1dir, int8 id2dir, bool enforce_clean_ends, bool dontpenalisengaps)");
+  FUNCSTART("AlignedDualSeq::AlignedDualSeq(MIRAParameters * params, const char * seq1, const char * seq2, int32 id1, int32 id2, int8 id1dir, int8 id2dir, bool enforce_clean_ends, bool dontpenalisengaps)");
 
   ADS_valid=0;
   ADS_miraparams=params;
@@ -97,8 +109,6 @@ AlignedDualSeq::AlignedDualSeq(MIRAParameters * params, const char * seq1, const
 
   FUNCEND();
 }
-//*/
-
 
 // Constructor with sequences not known
 AlignedDualSeq::AlignedDualSeq(MIRAParameters * params) : AlignedDualSeqFacts ()
@@ -121,13 +131,13 @@ AlignedDualSeq::AlignedDualSeq(MIRAParameters * params) : AlignedDualSeqFacts ()
 
 void AlignedDualSeq::init()
 {
-  ADS_aligned_seq1=nullptr;
-  ADS_aligned_seq2=nullptr;
-  ADS_consensus_seq=nullptr;
-  ADS_consensus_gap_seq=nullptr;
+  ADS_aligned_seq1=NULL;
+  ADS_aligned_seq2=NULL;
+  ADS_consensus_seq=NULL;
+  ADS_consensus_gap_seq=NULL;
   ADS_cursize=0;
-  ADS_seq1=nullptr;
-  ADS_seq2=nullptr;
+  ADS_seq1=NULL;
+  ADS_seq2=NULL;
 
   ADS_contained=0;
   ADS_score=0;
@@ -141,9 +151,6 @@ void AlignedDualSeq::init()
 
   ADS_dontpenalisengaps=false;
 
-  ADS_minbanddistance=0;
-  ADS_bandwidthused=0;
-
   // initialise the following match matrices
   //  ADS_realscore_matrix
   //  ADS_expectedscore_matrix,
@@ -356,7 +363,7 @@ void AlignedDualSeq::init()
     matinit((char *) &ADS_realscore_matrix,'A','H',(char) dyp.dyn_score_halfmismatch);
     matinit((char *) &ADS_realscore_matrix,'A','D',(char) dyp.dyn_score_halfmismatch);
     matinit((char *) &ADS_realscore_matrix,'A','B',(char) dyp.dyn_score_mismatch);
-
+				    
     matinit((char *) &ADS_realscore_matrix,'C','C',(char) dyp.dyn_score_match);
     matinit((char *) &ADS_realscore_matrix,'C','G',(char) dyp.dyn_score_mismatch);
     matinit((char *) &ADS_realscore_matrix,'C','T',(char) dyp.dyn_score_mismatch);
@@ -370,7 +377,7 @@ void AlignedDualSeq::init()
     matinit((char *) &ADS_realscore_matrix,'C','H',(char) dyp.dyn_score_halfmismatch);
     matinit((char *) &ADS_realscore_matrix,'C','D',(char) dyp.dyn_score_mismatch);
     matinit((char *) &ADS_realscore_matrix,'C','B',(char) dyp.dyn_score_halfmismatch);
-
+				    
     matinit((char *) &ADS_realscore_matrix,'G','G',(char) dyp.dyn_score_match);
     matinit((char *) &ADS_realscore_matrix,'G','T',(char) dyp.dyn_score_mismatch);
     matinit((char *) &ADS_realscore_matrix,'G','M',(char) dyp.dyn_score_mismatch);
@@ -383,7 +390,7 @@ void AlignedDualSeq::init()
     matinit((char *) &ADS_realscore_matrix,'G','H',(char) dyp.dyn_score_mismatch);
     matinit((char *) &ADS_realscore_matrix,'G','D',(char) dyp.dyn_score_halfmismatch);
     matinit((char *) &ADS_realscore_matrix,'G','B',(char) dyp.dyn_score_halfmismatch);
-
+				    
     matinit((char *) &ADS_realscore_matrix,'T','T',(char) dyp.dyn_score_match);
     matinit((char *) &ADS_realscore_matrix,'T','M',(char) dyp.dyn_score_mismatch);
     matinit((char *) &ADS_realscore_matrix,'T','R',(char) dyp.dyn_score_mismatch);
@@ -666,7 +673,7 @@ void AlignedDualSeq::init()
     matinit((char *) &ADS_expectedscore_matrix,'A','H',(char) dyp.dyn_score_match);
     matinit((char *) &ADS_expectedscore_matrix,'A','D',(char) dyp.dyn_score_match);
     matinit((char *) &ADS_expectedscore_matrix,'A','B',(char) dyp.dyn_score_match);
-
+				    
     matinit((char *) &ADS_expectedscore_matrix,'C','C',(char) dyp.dyn_score_match);
     matinit((char *) &ADS_expectedscore_matrix,'C','G',(char) dyp.dyn_score_match);
     matinit((char *) &ADS_expectedscore_matrix,'C','T',(char) dyp.dyn_score_match);
@@ -680,7 +687,7 @@ void AlignedDualSeq::init()
     matinit((char *) &ADS_expectedscore_matrix,'C','H',(char) dyp.dyn_score_match);
     matinit((char *) &ADS_expectedscore_matrix,'C','D',(char) dyp.dyn_score_match);
     matinit((char *) &ADS_expectedscore_matrix,'C','B',(char) dyp.dyn_score_match);
-
+				    
     matinit((char *) &ADS_expectedscore_matrix,'G','G',(char) dyp.dyn_score_match);
     matinit((char *) &ADS_expectedscore_matrix,'G','T',(char) dyp.dyn_score_match);
     matinit((char *) &ADS_expectedscore_matrix,'G','M',(char) dyp.dyn_score_match);
@@ -693,7 +700,7 @@ void AlignedDualSeq::init()
     matinit((char *) &ADS_expectedscore_matrix,'G','H',(char) dyp.dyn_score_match);
     matinit((char *) &ADS_expectedscore_matrix,'G','D',(char) dyp.dyn_score_match);
     matinit((char *) &ADS_expectedscore_matrix,'G','B',(char) dyp.dyn_score_match);
-
+				    
     matinit((char *) &ADS_expectedscore_matrix,'T','T',(char) dyp.dyn_score_match);
     matinit((char *) &ADS_expectedscore_matrix,'T','M',(char) dyp.dyn_score_match);
     matinit((char *) &ADS_expectedscore_matrix,'T','R',(char) dyp.dyn_score_match);
@@ -1068,7 +1075,7 @@ void AlignedDualSeq::init()
 
     matinit((char *) &ADS_consensus_matrix,'B','B','B');
 
-    memcpy(&ADS_consensus_gap_matrix, &ADS_consensus_matrix, sizeof(ADS_consensus_matrix));
+    memcpy(&ADS_consensus_gap_matrix, &ADS_consensus_matrix, sizeof(ADS_consensus_matrix)); 
 
     matinit((char *) &ADS_consensus_gap_matrix,'*','#','*');
     matinit((char *) &ADS_consensus_gap_matrix,'*','*','*');
@@ -1214,10 +1221,7 @@ AlignedDualSeq const & AlignedDualSeq::operator=(AlignedDualSeq const &other)
 
       ADS_dontpenalisengaps=other.ADS_dontpenalisengaps;
 
-      ADS_minbanddistance=other.ADS_minbanddistance;
-      ADS_bandwidthused=other.ADS_bandwidthused;
-
-      if(other.ADS_aligned_seq1!=nullptr){
+      if(other.ADS_aligned_seq1!=NULL){
 	ADS_cursize=other.ADSF_total_len+1;
 	ADS_aligned_seq1= new char[ADS_cursize];
 	ADS_aligned_seq2= new char[ADS_cursize];
@@ -1232,12 +1236,12 @@ AlignedDualSeq const & AlignedDualSeq::operator=(AlignedDualSeq const &other)
 	ADS_seq2=ADS_aligned_seq2+ADSF_delta;;
       }else{
 	ADS_cursize=0;
-	ADS_aligned_seq1=nullptr;
-	ADS_aligned_seq2=nullptr;
-	ADS_consensus_seq=nullptr;
-	ADS_consensus_gap_seq=nullptr;
-	ADS_seq1=nullptr;
-	ADS_seq2=nullptr;
+	ADS_aligned_seq1=NULL;
+	ADS_aligned_seq2=NULL;
+	ADS_consensus_seq=NULL;
+	ADS_consensus_gap_seq=NULL;
+	ADS_seq1=NULL;
+	ADS_seq2=NULL;
       }
 
     }
@@ -1280,14 +1284,14 @@ void AlignedDualSeq::discard()
   FUNCSTART("void AlignedDualSeq::discard()");
 
   if(ADS_valid){
-    if(ADS_aligned_seq1!=nullptr) delete [] ADS_aligned_seq1;
-    ADS_aligned_seq1=nullptr;
-    if(ADS_aligned_seq2!=nullptr) delete [] ADS_aligned_seq2;
-    ADS_aligned_seq2=nullptr;
-    if(ADS_consensus_seq!=nullptr) delete [] ADS_consensus_seq;
-    ADS_consensus_seq=nullptr;
-    if(ADS_consensus_gap_seq!=nullptr) delete [] ADS_consensus_gap_seq;
-    ADS_consensus_gap_seq=nullptr;
+    if(ADS_aligned_seq1!=NULL) delete [] ADS_aligned_seq1;
+    ADS_aligned_seq1=NULL;
+    if(ADS_aligned_seq2!=NULL) delete [] ADS_aligned_seq2;
+    ADS_aligned_seq2=NULL;
+    if(ADS_consensus_seq!=NULL) delete [] ADS_consensus_seq;
+    ADS_consensus_seq=NULL;
+    if(ADS_consensus_gap_seq!=NULL) delete [] ADS_consensus_gap_seq;
+    ADS_consensus_gap_seq=NULL;
   }
   ADS_cursize=0;
 
@@ -1302,30 +1306,34 @@ void AlignedDualSeq::discard()
 // The first sequence (seq1) always begins with a non endgap character.
 // No errorchecking is done for endgaps within the sequences itself.
 // Compute some classification numbers like score etc.
-void AlignedDualSeq::acquireSequences(const char * seq1, const char * seq2, readid_t id1, readid_t id2, int8 id1dir, int8 id2dir, bool enforce_clean_ends, bool dontpenalisengaps, int32 bandwidthused, int32 minbanddistance)
+void AlignedDualSeq::acquireSequences(const char * seq1, const char * seq2, int32 id1, int32 id2, int8 id1dir, int8 id2dir, bool enforce_clean_ends, bool dontpenalisengaps)
 {
-  FUNCSTART("void AlignedDualSeq::acquireSequences(const char * seq1, const char * seq2, readid_t id1, readid_t id2, int8 id1dir, int8 id2dir, bool enforce_clean_ends, bool dontpenalisengaps, int32 bandwidthused, int32 minbanddistance)");
-
-  {
-    auto tmplen=strlen(seq1);
-    BUGIFTHROW(tmplen!=strlen(seq2)," Sequence lengths unequal: " << tmplen << " vs. " << strlen(seq2));
-    BUGIFTHROW(tmplen==0, "Sequence lengths 0?");
-    BUGIFTHROW(tmplen>65530, "Alignment of two sequences: " << tmplen << " > 65530 bases, cannot handle, shouldn't have happened!");
-    ADSF_total_len= static_cast<uint16>(tmplen);
+  FUNCSTART("void AlignedDualSeq::acquireSequences(const char * seq1, const char * seq2, int32 id1, int32 id2, int8 id1dir, int8 id2dir, bool enforce_clean_ends, bool dontpenalisengaps)");
+
+  ADSF_total_len= static_cast<uint16>(strlen(seq1));
+  if(ADSF_total_len!=strlen(seq2)){
+    cerr << "\nlens1: " << strlen(seq1);
+    cerr << "\nlens2: " << strlen(seq2);
+    cerr << '\n';
+    throw Notify(Notify::INTERNAL, THISFUNC, " Sequence lengths unequal.");
+  }
+  if(ADSF_total_len==0){
+    throw Notify(Notify::INTERNAL, THISFUNC, " Sequence lengths 0?");
+  }
+  if(ADSF_total_len>65530){
+    throw Notify(Notify::INTERNAL, THISFUNC, " Alignment of two sequences > 65530 bases, cannot handle, shouldn't have happened!");
   }
-  CEBUG("ADSF_total_len: " << ADSF_total_len << endl);
 
-  ADS_minbanddistance=minbanddistance;
-  ADS_bandwidthused=bandwidthused;
+  CEBUG("ADSF_total_len: " << ADSF_total_len << endl);
 
-  if(ADS_aligned_seq1==nullptr
+  if(ADS_aligned_seq1==NULL
      || ADS_cursize<ADSF_total_len+1){
     discard();
-    ADS_cursize=ADSF_total_len+1;                          // 0 character!
-    ADS_aligned_seq1=new char[ADS_cursize];
-    ADS_aligned_seq2=new char[ADS_cursize];
-    ADS_consensus_seq=new char[ADS_cursize];
-    ADS_consensus_gap_seq=new char[ADS_cursize];
+    ADS_cursize=ADSF_total_len+1;
+    ADS_aligned_seq1=new char[ADS_cursize];         // 0 character!
+    ADS_aligned_seq2=new char[ADS_cursize];         // 0 character!
+    ADS_consensus_seq=new char[ADS_cursize];         // 0 character!
+    ADS_consensus_gap_seq=new char[ADS_cursize];         // 0 character!
   }
 
   ADSF_id1=id1;
@@ -1355,7 +1363,7 @@ void AlignedDualSeq::acquireSequences(const char * seq1, const char * seq2, read
     const char * src2ptr=seq2;
     char * dst1ptr=ADS_aligned_seq1;
     char * dst2ptr=ADS_aligned_seq2;
-    for(uint32 runi=0; runi<ADSF_total_len; ++runi, ++src1ptr, ++src2ptr, ++dst1ptr, ++dst2ptr){
+    for(uint32 runi=0; runi<ADSF_total_len; runi++, src1ptr++, src2ptr++, dst1ptr++, dst2ptr++){
       uint32 overlap=1;
 
       CEBUG("" << *src1ptr << *src2ptr << " ");
@@ -1381,13 +1389,13 @@ void AlignedDualSeq::acquireSequences(const char * seq1, const char * seq2, read
 	break;
       }
       }
-
+      
       CEBUG(overlap);
     }
-    *dst1ptr=0;                     // terminate sequence with 0
-    *dst2ptr=0;                     // terminate sequence with 0
+    *dst1ptr++=0;                     // terminate sequence with 0
+    *dst2ptr++=0;                     // terminate sequence with 0
   }
-
+  
   ADS_seq1=ADS_aligned_seq1;
   ADS_seq2=ADS_aligned_seq2+ADSF_delta;
 
@@ -1400,11 +1408,11 @@ void AlignedDualSeq::acquireSequences(const char * seq1, const char * seq2, read
     uint32 i=0;
 
     while(*ptr != 0 && *ptr!=' '){
-      ++i; ++ptr;
+      i++; ptr++;
     }
     ADS_len1=static_cast<uint16>(i);
     i=0;
-    while(*ptr++ != 0) ++i;
+    while(*ptr++ != 0) i++;
     ADSF_id1_rightdelta=static_cast<uint16>(i);
   }
 
@@ -1413,11 +1421,11 @@ void AlignedDualSeq::acquireSequences(const char * seq1, const char * seq2, read
     uint32 i=0;
 
     while(*ptr != 0 && *ptr!=' '){
-      ++i; ++ptr;
+      i++; ptr++;
     }
     ADS_len2=static_cast<uint16>(i);
     i=0;
-    while(*ptr++ != 0) ++i;
+    while(*ptr++ != 0) i++;
     ADSF_id2_rightdelta=static_cast<uint16>(i);
   }
 
@@ -1465,16 +1473,6 @@ void AlignedDualSeq::acquireSequences(const char * seq1, const char * seq2, read
 
   ADS_weight=ADS_score*ADSF_score_ratio*ADSF_score_ratio;
 
-  // remaining ADSF_ entries ...
-  if(ADS_numgaps+ADS_nummismatches>1023){
-    ADSF_totalnonmatches=1023;
-  }else{
-    ADSF_totalnonmatches=static_cast<uint16>(ADS_numgaps+ADS_nummismatches);
-  }
-  // TODO: can this be deferred somehow until "really needed[tm]"?
-  calcEndsLenContiguousMatch();
-
-
   //cout << *this;
 
   FUNCEND();
@@ -1526,15 +1524,14 @@ int32 AlignedDualSeq::score(bool enforce_clean_ends, bool dontpenalisengaps)
   align_parameters alpar= ADS_miraparams->getAlignParams();
 
   if(!ADS_valid || !ADS_s_matrix_valid){
-    MIRANOTIFY(Notify::FATAL, " Object not initialised.");
+    throw Notify(Notify::FATAL, THISFUNC, " Object not initialised.");
   }
 
   double realscore=0.0;
   double expectedscore=0.0;
   int32 addpenpercent=0;
 
-  uint32 badendcounter1=0;
-  uint32 badendcounter2=0;
+  uint32 badendcounter=0;
 
   vector<uint8> nogappenalties;
 
@@ -1553,7 +1550,7 @@ int32 AlignedDualSeq::score(bool enforce_clean_ends, bool dontpenalisengaps)
       if(bla==1){
 	seqe=ADS_aligned_seq2;
       }
-      for(uint32 iend=0; static_cast<int32>(iend)< ADS_cursize; ++iend, ++seqe){
+      for(uint32 iend=0; iend< ADS_cursize; ++iend, ++seqe){
 	if(*seqe!='*' && *seqe!='#'){
 	  if(toupper(*seqe) == 'N'){
 	    if(ncount==0) istart=iend;
@@ -1572,7 +1569,6 @@ int32 AlignedDualSeq::score(bool enforce_clean_ends, bool dontpenalisengaps)
   ADS_maxcontiguousgaps=0;
 
   if(getOverlapLen()){
-    CEBUG("OVERLAP SCORE CALC\n");
     char * ptr1=ADS_aligned_seq1+ADSF_delta;
     char * ptr2=ADS_aligned_seq2+ADSF_delta;
     char * ptrconsgap=ADS_consensus_gap_seq+ADSF_delta;
@@ -1594,8 +1590,8 @@ int32 AlignedDualSeq::score(bool enforce_clean_ends, bool dontpenalisengaps)
     //  For this last loop, the characters are set manually to ' '
     // Reason for the extra loop included in loop:
     //  I don't want the code for addpenpercent doubled after the loop
-    for(int32 oli=getOverlapLen(); oli>=0;--oli, ++ptr1, ++ptr2, ++ptrconsgap, ++ngpI){
-      if(likely(oli>0)) {
+    for(int32 oli=getOverlapLen(); oli>=0;oli--, ptr1++, ptr2++, ptrconsgap++, ngpI++){
+      if(oli>0) {
 	a=static_cast<uint8>(*ptr1);
 	b=static_cast<uint8>(*ptr2);
       } else {
@@ -1606,15 +1602,11 @@ int32 AlignedDualSeq::score(bool enforce_clean_ends, bool dontpenalisengaps)
       CEBUG(a << b << " ");
 
       if(enforce_clean_ends){
-	if(unlikely(toupper(a) != toupper(b))) {
-	  if(likely(dptools::isValidACGTStarBase(a) && dptools::isValidACGTStarBase(b))){
-	    if(oli <alpar.ads_clean_end_distance) {
-	      ++badendcounter1;
-	      CEBUG("BADEND1!!! ");
-	    }
-	    if(getOverlapLen()-oli < alpar.ads_clean_end_distance){
-	      ++badendcounter2;
-	      CEBUG("BADEND2!!! ");
+	if(oli <alpar.ads_clean_end_distance || getOverlapLen()-oli < alpar.ads_clean_end_distance){
+	  if(dptools::isValidACGTBase(a) && dptools::isValidACGTBase(b)){
+	    if(toupper(a) != toupper(b)) {
+	      badendcounter++;
+	      CEBUG("BADEND!!! ");
 	    }
 	  }
 	}
@@ -1627,7 +1619,7 @@ int32 AlignedDualSeq::score(bool enforce_clean_ends, bool dontpenalisengaps)
 
 	  // if starcounter < size of ADS_powofstarcounter, add to real score
 	  // if not, the value would be 0 anyway
-	  // This makes a increasing penalty for inreasing gap lengths
+	  // This makes a increasing penalty for inreasing gap lengths 
 	  if(starcounter<ADS_powofstarcounter.size()){
 	    realscore+=ADS_realscore_matrix[a][b]*ADS_powofstarcounter[starcounter];
 	  }
@@ -1638,10 +1630,10 @@ int32 AlignedDualSeq::score(bool enforce_clean_ends, bool dontpenalisengaps)
 	if(!dontpenalisengaps){
 	  if(starcounter>0){
 	    if(starcounter>ADS_maxcontiguousgaps) ADS_maxcontiguousgaps=static_cast<uint16>(starcounter);
-	    if(starcounter>=alpar.ads_gp_function.size()){
-	      addpenpercent+=alpar.ads_gp_function[alpar.ads_gp_function.size()-1];
+	    if(starcounter>=ADS_miraparams->getAlignParams().ads_gp_function.size()){
+	      addpenpercent+=ADS_miraparams->getAlignParams().ads_gp_function[ADS_miraparams->getAlignParams().ads_gp_function.size()-1];
 	    }else{
-	      addpenpercent+=alpar.ads_gp_function[starcounter];
+	      addpenpercent+=ADS_miraparams->getAlignParams().ads_gp_function[starcounter];
 	    }
 	  }
 	}
@@ -1649,33 +1641,32 @@ int32 AlignedDualSeq::score(bool enforce_clean_ends, bool dontpenalisengaps)
 	realscore+=ADS_realscore_matrix[a][b];
 	expectedscore+=ADS_expectedscore_matrix[a][b];
       }
-      CEBUG("\tes: " << expectedscore << "\trs: " << realscore<< "\n");
     }
   }
 
-  if(addpenpercent>static_cast<int32>(alpar.ads_max_gppercent)){
-    addpenpercent=alpar.ads_max_gppercent;
+  if(addpenpercent>static_cast<int32>(ADS_miraparams->getAlignParams().ads_max_gppercent)){
+    addpenpercent=ADS_miraparams->getAlignParams().ads_max_gppercent;
   }
 
-  CEBUG("\nExpected score " << expectedscore << endl);
   CEBUG("Real score " << realscore << endl);
   CEBUG("Max contiguous gaps: " << ADS_maxcontiguousgaps << endl);
-  CEBUG("Clean end killer: " << enforce_clean_ends << " " << alpar.ads_clean_end_distance << " " << alpar.ads_clean_end_mismatchallowed << endl);
   CEBUG("Additional penalty (%) " << addpenpercent << endl);
 
-  if(alpar.ads_extra_gap_penalty){
+  if(ADS_miraparams->getAlignParams().ads_extra_gap_penalty){
     realscore-=realscore*addpenpercent/100;
     CEBUG("Adjusted real score " << realscore << endl);
   }
 
-  if(realscore<0.0){
-    realscore=0.0;
+  if(realscore<0){
+    realscore=0;
   }
 
-  if(badendcounter1>alpar.ads_clean_end_mismatchallowed
-     || badendcounter2>alpar.ads_clean_end_mismatchallowed){
-    CEBUG("Killer: " << badendcounter1 << ' ' << badendcounter2 << '\n');
-    realscore=0.0;
+  if(badendcounter>=5){
+    CEBUG("Killer: " << badendcounter << '\n');
+    //if(ADSF_id1==500 || ADSF_id2==500) {
+    //  cout << "didididaaa\n" << *this << endl;
+    //}
+    realscore=0;
   }
 
   ADS_score=static_cast<int32>(realscore/dyp.dyn_score_multiplier);
@@ -1697,10 +1688,10 @@ int32 AlignedDualSeq::score(bool enforce_clean_ends, bool dontpenalisengaps)
 
 /*************************************************************************
  *
- * Computes two kinds of consensus: one where gap against a base gives a
+ * Computes two kinds of consensus: one where gap against a base gives a 
  *  base, once where it gives a gap
  *
- * Additionally, counts how many mismatches or real gaps are present and
+ * Additionally, counts how many mismatches or real gaps are present and 
  *  stores those numbers
  *
  *************************************************************************/
@@ -1727,18 +1718,18 @@ void AlignedDualSeq::consensus()
 
     // counting mismatches and gaps
     // count errors only if none is a blank (endgap)
-    if(*src1ptr!=' ' && *src2ptr!=' '){
+    if(*src1ptr!=' ' && *src2ptr!=' '){      
       // if the consensus gap result is not [ACGTNX], we need to seriously
       //  check for mismatches
       if(!dptools::isValidBase(*dstptr2)){
 	CEBUG("Check for mismatch: ");
 	// first, check whether we have a gap situation
 	bool foundreason=false;
-	if(*src1ptr=='*' || *src1ptr=='#'
+	if(*src1ptr=='*' || *src1ptr=='#' 
 	   || *src2ptr=='*' || *src2ptr=='#') {
-
+	  
 	  CEBUG("gap? ");
-
+	  
 	  // if one of the two is a IUPAC, we have a gap/base situation
 	  //  and must count a gap
 	  if(dptools::isValidIUPACBase(*src1ptr)
@@ -1755,9 +1746,9 @@ void AlignedDualSeq::consensus()
 	if(!foundreason){
 	  CEBUG("no! mismatch. ");
 	  // so, we have a potential mismatch situation without gaps
-	  //
+	  // 
 	  // if both are valid bases, it's a normal mismatch involving
-	  //  [ACGT] vs another [ACGT] (in a [ACGT vs [NX] situation,
+	  //  [ACGT] vs another [ACGT] (in a [ACGT vs [NX] situation, 
 	  //  we wouldn't be in this branch anyway
 	  if(dptools::isValidBase(*src1ptr) && dptools::isValidBase(*src2ptr)){
 	    CEBUG("normal base/base mismatch.\n");
@@ -1827,13 +1818,13 @@ ostream & operator<<(ostream & ostr, const AlignedDualSeq &ads)
     if(ads.ADS_expected_score!=ads.ADS_score){
       ostr << "Not equal.\n";
     }
-    if( ads.ADS_aligned_seq1 != nullptr
-        && ads.ADS_aligned_seq2 != nullptr
-	&& ads.ADS_consensus_seq != nullptr
-        && ads.ADS_consensus_gap_seq != nullptr){
+    if( ads.ADS_aligned_seq1 != NULL     
+        && ads.ADS_aligned_seq2 != NULL     
+	&& ads.ADS_consensus_seq != NULL     
+        && ads.ADS_consensus_gap_seq != NULL){
       const uint32 cpl=60;
       uint32 cut =cpl;
-
+      
       bool addtab=false;
       if(ads.ADSF_id1 >999 || ads.ADSF_id2 >999) addtab=true;
 
@@ -1936,14 +1927,14 @@ ostream & operator<<(ostream & ostr, const AlignedDualSeq &ads)
  *
  *************************************************************************/
 
-const char * AlignedDualSeq::getAlignedSequence(readid_t id) const
+const char * AlignedDualSeq::getAlignedSequence(int32 id) const
 {
-  FUNCSTART("char * getAlignedSequence(readid_t id)");
+  FUNCSTART("char * getAlignedSequence(int32 id)");
   if(!ADS_valid){
-    MIRANOTIFY(Notify::FATAL, " Object not initialised.");
+    throw Notify(Notify::FATAL, THISFUNC, " Object not initialised.");
   }
-  if(ADS_aligned_seq1==nullptr || ADS_aligned_seq2==nullptr){
-    MIRANOTIFY(Notify::FATAL, " Tried to get aligned sequences on object where saveMem() had been called previously!");
+  if(ADS_aligned_seq1==NULL || ADS_aligned_seq2==NULL){
+    throw Notify(Notify::FATAL, THISFUNC, " Tried to get aligned sequences on object where saveMem() had been called previously!");
   }
   if(id==ADSF_id1){
     FUNCEND();
@@ -1952,34 +1943,7 @@ const char * AlignedDualSeq::getAlignedSequence(readid_t id) const
     FUNCEND();
     return ADS_seq2;
   }else{
-    MIRANOTIFY(Notify::FATAL, "ID not in alignment.");
-  }
-}
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-const char * AlignedDualSeq::getSequenceAtOverlapStart(readid_t id) const
-{
-  FUNCSTART("char * getSequenceAtOverlapStart(readid_t id)");
-  if(!ADS_valid){
-    MIRANOTIFY(Notify::FATAL, " Object not initialised.");
-  }
-  if(ADS_aligned_seq1==nullptr || ADS_aligned_seq2==nullptr){
-    MIRANOTIFY(Notify::FATAL, " Tried to get aligned sequences on object where saveMem() had been called previously!");
-  }
-  if(id==ADSF_id1){
-    FUNCEND();
-    return ADS_seq1+ADSF_delta;
-  }else if(id==ADSF_id2){
-    FUNCEND();
-    return ADS_seq2;
-  }else{
-    MIRANOTIFY(Notify::FATAL, "ID not in alignment.");
+    throw Notify(Notify::FATAL, THISFUNC, "ID not in alignment.");
   }
 }
 
@@ -1990,11 +1954,11 @@ const char * AlignedDualSeq::getSequenceAtOverlapStart(readid_t id) const
  *
  *************************************************************************/
 
-uint32 AlignedDualSeq::getLenOfAlignedSequence(readid_t id) const
+uint32 AlignedDualSeq::getLenOfAlignedSequence(int32 id) const
 {
-  FUNCSTART("uint32 getLenOfAlignedSequence(readid_t id)");
+  FUNCSTART("uint32 getLenOfAlignedSequence(int32 id)");
   if(!ADS_valid){
-    MIRANOTIFY(Notify::FATAL, " Object not initialised.");
+    throw Notify(Notify::FATAL, THISFUNC, " Object not initialised.");
   }
   if(id==ADSF_id1){
     FUNCEND();
@@ -2003,7 +1967,7 @@ uint32 AlignedDualSeq::getLenOfAlignedSequence(readid_t id) const
     FUNCEND();
     return ADS_len2;
   }else{
-    MIRANOTIFY(Notify::FATAL, "ID not in alignment.");
+    throw Notify(Notify::FATAL, THISFUNC, "ID not in alignment.");
   }
 }
 
@@ -2014,7 +1978,7 @@ uint32 AlignedDualSeq::getLenOfAlignedSequence(readid_t id) const
  *
  *************************************************************************/
 
-bool AlignedDualSeq::isContained(readid_t id) const
+bool AlignedDualSeq::isContained(int32 id) const
 {
   if(!ADS_contained) return false;
   if(ADS_contained==2) return true;
@@ -2023,118 +1987,6 @@ bool AlignedDualSeq::isContained(readid_t id) const
 }
 
 
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-#define CEBUG(bla)
-void AlignedDualSeq::calcEndsLenContiguousMatch()
-{
-  FUNCSTART("uint32 AlignedDualSeq::calcEndsLenContiguousMatch()");
-  if(!ADS_valid){
-    MIRANOTIFY(Notify::FATAL, " Object not initialised.");
-  }
-  BUGIFTHROW(ADS_aligned_seq1==nullptr,"ADS_aligned_seq1==nullptr ???");
-  BUGIFTHROW(ADS_aligned_seq2==nullptr,"ADS_aligned_seq2==nullptr ???");
-
-  CEBUG("CCCCCCCCCCCCCCCCCC\n");
-
-  int32 local_5pconmatch1=0;
-  int32 local_3pconmatch1=0;
-  int32 local_5pconmatch2=0;
-  int32 local_3pconmatch2=0;
-
-  // forward
-  auto as1=ADS_aligned_seq1;
-  auto as2=ADS_aligned_seq2;
-  bool b1=true; // seq 1 is clean from blank
-  bool b2=true; // seq 2 is clean from blank
-  int32 runl=0;
-  CEBUG("FORWARD S\n");
-  for(; (runl<ADS_cursize && (*as1==' ' || *as2==' ')); ++as1, ++as2, ++runl){
-    if(*as1!=' ') b1=false;
-    if(*as2!=' ') b2=false;
-    CEBUG(runl << '\t' << *as1 << '\t' << *as2 << endl);
-  }
-  CEBUG("FORWARD B " << b1 << ' ' << b2 << endl);
-  {
-    auto left=runl;
-    CEBUG("FORWARD M\n");
-    for(; runl<ADS_cursize && toupper(*as1)==toupper(*as2); ++as1, ++as2, ++runl){
-      CEBUG(runl << '\t' << *as1 << '\t' << *as2 << endl);
-    }
-    if(b1) local_5pconmatch1=runl-left;
-    if(b2) local_5pconmatch2=runl-left;
-    CEBUG("local_5pconmatch1 " << local_5pconmatch1 << endl);
-    CEBUG("local_5pconmatch2 " << local_5pconmatch2 << endl);
-  }
-
-  // backward
-  b1=true; // seq 1 is clean from blank
-  b2=true; // seq 2 is clean from blank
-  as1=ADS_aligned_seq1+ADSF_total_len-1; // there's the final 0 to be accounted for
-  as2=ADS_aligned_seq2+ADSF_total_len-1; // there's the final 0 to be accounted for
-  runl=ADS_cursize;
-  CEBUG("BACKWARD S\n");
-  for(; (runl>0 && (*as1==' ' || *as2==' ')); --as1, --as2, --runl){
-    if(*as1!=' ') b1=false;
-    if(*as2!=' ') b2=false;
-    CEBUG(runl << '\t' << *as1 << '\t' << *as2 << endl);
-  }
-  CEBUG("BACKWARD B " << b1 << ' ' << b2 << endl);
-  {
-    auto right=runl;
-    CEBUG("BACKWARD M\n");
-    for(; runl>0 && toupper(*as1)==toupper(*as2); --as1, --as2, --runl){
-      CEBUG(runl << '\t' << *as1 << '\t' << *as2 << endl);
-    }
-    if(b1) local_3pconmatch1=right-runl;
-    if(b2) local_3pconmatch2=right-runl;
-    CEBUG("local_3pconmatch1 " << local_3pconmatch1 << endl);
-    CEBUG("local_3pconmatch2 " << local_3pconmatch2 << endl);
-  }
-
-  // swap if needed
-  if(getSequenceDirection(ADSF_id1)<0) swap(local_5pconmatch1,local_3pconmatch1);
-  if(getSequenceDirection(ADSF_id2)<0) swap(local_5pconmatch2,local_3pconmatch2);
-
-  // fill in ADSF_... pendants
-
-  if(local_5pconmatch1>=28){
-    ADSF_5pconmatch1=7;
-  }else{
-    ADSF_5pconmatch1=static_cast<uint16>(local_5pconmatch1/4);
-  }
-  if(local_3pconmatch1>=28){
-    ADSF_3pconmatch1=7;
-  }else{
-    ADSF_3pconmatch1=static_cast<uint16>(local_3pconmatch1/4);
-  }
-  if(local_5pconmatch2>=28){
-    ADSF_5pconmatch2=7;
-  }else{
-    ADSF_5pconmatch2=static_cast<uint16>(local_5pconmatch2/4);
-  }
-  if(local_3pconmatch2>=28){
-    ADSF_3pconmatch2=7;
-  }else{
-    ADSF_3pconmatch2=static_cast<uint16>(local_3pconmatch2/4);
-  }
-
-  CEBUG("ADSF_5pconmatch1 " << ADSF_5pconmatch1 << endl);
-  CEBUG("ADSF_3pconmatch1 " << ADSF_3pconmatch1 << endl);
-  CEBUG("ADSF_5pconmatch2 " << ADSF_5pconmatch2 << endl);
-  CEBUG("ADSF_3pconmatch2 " << ADSF_3pconmatch2 << endl);
-
-
-  return;
-}
-#define CEBUG(bla)
-
-
 
 /*************************************************************************
  *
@@ -2148,24 +2000,24 @@ void AlignedDualSeq::saveMem(bool delete_seq, bool delete_consseq)
   FUNCSTART("void AlignedDualSeq::saveMem(bool delete_seq, bool delete_consseq)");
 
   if(!ADS_valid){
-    MIRANOTIFY(Notify::FATAL, " Object not initialised.");
+    throw Notify(Notify::FATAL, THISFUNC, " Object not initialised.");
   }
 
   if(delete_seq){
-    if(ADS_aligned_seq1!=nullptr) delete [] ADS_aligned_seq1;
-    ADS_aligned_seq1=nullptr;
-    if(ADS_aligned_seq2!=nullptr) delete [] ADS_aligned_seq2;
-    ADS_aligned_seq2=nullptr;
+    if(ADS_aligned_seq1!=NULL) delete [] ADS_aligned_seq1;
+    ADS_aligned_seq1=NULL;
+    if(ADS_aligned_seq2!=NULL) delete [] ADS_aligned_seq2;
+    ADS_aligned_seq2=NULL;
 
     // avoid dangling pointers
-    ADS_seq1=nullptr;
-    ADS_seq2=nullptr;
+    ADS_seq1=NULL;
+    ADS_seq2=NULL;
   }
   if(delete_consseq){
-    if(ADS_consensus_seq!=nullptr) delete [] ADS_consensus_seq;
-    ADS_consensus_seq=nullptr;
-    if(ADS_consensus_gap_seq!=nullptr) delete [] ADS_consensus_gap_seq;
-    ADS_consensus_gap_seq=nullptr;
+    if(ADS_consensus_seq!=NULL) delete [] ADS_consensus_seq;
+    ADS_consensus_seq=NULL;
+    if(ADS_consensus_gap_seq!=NULL) delete [] ADS_consensus_gap_seq;
+    ADS_consensus_gap_seq=NULL;
   }
 
   FUNCEND();
@@ -2183,8 +2035,6 @@ void AlignedDualSeq::saveMem(bool delete_seq, bool delete_consseq)
  *
  * return length for each sequence
  *
- * currently used in extendADS()
- *
  *************************************************************************/
 
 bool AlignedDualSeq::clipper(uint32 winlen, int32 allerr, int32 & retgoodlen1, int32 & retgoodlen2) const
@@ -2193,17 +2043,17 @@ bool AlignedDualSeq::clipper(uint32 winlen, int32 allerr, int32 & retgoodlen1, i
 
   BUGIFTHROW(!ADS_valid, " Object not initialised.");
 
-  BUGIFTHROW((ADS_aligned_seq1==nullptr || ADS_aligned_seq2==nullptr)," Tried to use function on object where saveMem() had been called previously!");
+  BUGIFTHROW((ADS_aligned_seq1==NULL || ADS_aligned_seq2==NULL)," Tried to use function on object where saveMem() had been called previously!");
 
   BUGIFTHROW(winlen==0,"winlen == 0 ?");
 
   if(getOverlapLen()<=winlen){
-    // nicht verlängerbar;
+    // nicht verl�ngerbar;
     //cout << "too short";
     return false;
     FUNCEND();
   }
-
+  
   //  cout << "hipping";
 
   dynamic_parameters dyp= ADS_miraparams->getDynamicParams();
@@ -2282,7 +2132,7 @@ bool AlignedDualSeq::clipper(uint32 winlen, int32 allerr, int32 & retgoodlen1, i
     FUNCEND();
     return false;
   }
-
+  
   retgoodlen2=lastnoerror+winlen;
   retgoodlen1=ADSF_delta+lastnoerror+winlen;
 
@@ -2309,6 +2159,115 @@ ADSEstimator::ADSEstimator()
   ADSE_dir2=0;
 }
 
+//ADSEstimator::ADSEstimator(int32 offsets1tos2, uint32 len1, uint32 len2, int32 id1, int32 id2, int8 id1dir, int8 id2dir)
+//{
+//  calcNewEstimate(offsets1tos2, len1, len2, id1, id2, id1dir, id2dir);
+//}
+
+
+
+///*************************************************************************
+// *
+// * This class is not for storage, but meant as simple helper to estimate
+// *  different values of an alignment of two sequences.
+// *
+// * e.g.  len1 = 13; len2 = 12
+// *
+// *  s1  ------------>               s1      ------------>  		 
+// *  s2      ----------->	    s2  ----------->     
+// *				   				 
+// * init with offsets1tos2 = -4	   init with offsets1tos2 = 4	 
+// *				   				 
+// * lexpandof1=0			   lexpandof1=4			 
+// * rexpandof1=3			   rexpandof1=0			 
+// * lexpandof2=4			   lexpandof2=0			 
+// * rexpandof1=0                    rexpandof1=5                  
+// *
+// *  s1  <------------               s1      <------------  		 
+// *  s2      ----------->	    s2  ----------->     
+// *				   				 
+// * init with offsets1tos2 = -4	   init with offsets1tos2 = 4	 
+// *				   				 
+// * lexpandof1=3			   lexpandof1=0			 
+// * rexpandof1=0			   rexpandof1=4			 
+// * lexpandof2=4			   lexpandof2=0			 
+// * rexpandof1=0                    rexpandof1=5                  
+// *
+// *
+// *
+// *  s1  ------------>               s1      ------------>  	 
+// *  s2      <-----------	    s2  <-----------     	 
+// *				   				 
+// * init with offsets1tos2 = -4     init with offsets1tos2 = 4	 
+// *				   				 
+// * lexpandof1=0			   lexpandof1=4			 
+// * rexpandof1=3			   rexpandof1=0			 
+// * lexpandof2=0			   lexpandof2=5			 
+// * rexpandof1=4			   rexpandof1=0                  
+// *
+// *  s1  <------------               s1      <------------  	 
+// *  s2      <-----------	    s2  <-----------     	 
+// *				   				 
+// * init with offsets1tos2 = -4     init with offsets1tos2 = 4	 
+// *				   				 
+// * lexpandof1=3			   lexpandof1=0			 
+// * rexpandof1=0			   rexpandof1=4			 
+// * lexpandof2=0			   lexpandof2=5			 
+// * rexpandof1=4			   rexpandof1=0                  
+// *
+// *************************************************************************/
+//
+//void ADSEstimator::calcNewEstimate(int32 offsets1tos2, uint32 len1, uint32 len2, int32 id1, int32 id2, int8 id1dir, int8 id2dir)
+//{
+//  ADSE_len1=len1;
+//  ADSE_len2=len2;
+//  ADSE_id1=id1;
+//  ADSE_id2=id2;
+//  ADSE_dir1=id1dir;
+//  ADSE_dir2=id2dir;
+//
+//  uint32 absoffsets1tos2=abs(offsets1tos2);
+//  uint32 totallen;
+//
+//  if(offsets1tos2>=0){
+//
+//    ADSE_lexpandof1=absoffsets1tos2;
+//    ADSE_lexpandof2=0;
+//
+//    totallen=absoffsets1tos2+len1;
+//    if(totallen<len2) {
+//      // containment
+//      totallen=len2;
+//      ADSE_rexpandof1=totallen-len1-absoffsets1tos2;
+//      ADSE_rexpandof2=0;
+//    }else{
+//      ADSE_rexpandof1=0;
+//      ADSE_rexpandof2=totallen-len2;
+//    }
+//  }else{
+//
+//    ADSE_lexpandof1=0;
+//    ADSE_lexpandof2=absoffsets1tos2;
+//
+//    totallen=absoffsets1tos2+len2;
+//    if(totallen<len1) {
+//      // containment
+//      totallen=len1;
+//      ADSE_rexpandof1=0;
+//      ADSE_rexpandof2=totallen-len2-absoffsets1tos2;
+//    }else{
+//      ADSE_rexpandof1=totallen-len1;
+//      ADSE_rexpandof2=0;
+//    }
+//  }
+//
+//  // now get the directiony right
+//  if(id1dir<0) swap(ADSE_lexpandof1,ADSE_rexpandof1);
+//  if(id2dir<0) swap(ADSE_lexpandof2,ADSE_rexpandof2);
+//
+//  return;
+//}
+
 
 
 /*************************************************************************
@@ -2318,41 +2277,41 @@ ADSEstimator::ADSEstimator()
  *
  * e.g.  len1 = 13; len2 = 12
  *
- *  s1  ------------>               s1      ------------>
- *  s2      ----------->	    s2  ----------->
- *
+ *  s1  ------------>               s1      ------------>  		 
+ *  s2      ----------->	    s2  ----------->     
+ *				   				 
  * init with offsets1tos2 = 4	   init with offsets1tos2 = -4
+ *				   				 
+ * lexpandof1=0			   lexpandof1=4			 
+ * rexpandof1=3			   rexpandof1=0			 
+ * lexpandof2=4			   lexpandof2=0			 
+ * rexpandof2=0                    rexpandof2=5                  
  *
- * lexpandof1=0			   lexpandof1=4
- * rexpandof1=3			   rexpandof1=0
- * lexpandof2=4			   lexpandof2=0
- * rexpandof2=0                    rexpandof2=5
- *
- *
- *  s1  ------------>               s1      ------------>
- *  s2      <-----------	    s2  <-----------
- *
- * init with offsets1tos2 = 4      init with offsets1tos2 = -4
  *
- * lexpandof1=0			   lexpandof1=4
- * rexpandof1=3			   rexpandof1=0
- * lexpandof2=0			   lexpandof2=5
- * rexpandof2=4			   rexpandof2=0
+ *  s1  ------------>               s1      ------------>  	 
+ *  s2      <-----------	    s2  <-----------     	 
+ *				   				 
+ * init with offsets1tos2 = 4      init with offsets1tos2 = -4	 
+ *				   				 
+ * lexpandof1=0			   lexpandof1=4			 
+ * rexpandof1=3			   rexpandof1=0			 
+ * lexpandof2=0			   lexpandof2=5			 
+ * rexpandof2=4			   rexpandof2=0                  
  *
  *************************************************************************/
 
 // handling of s1 in - and s2 in + is more a makeshift ... improve when time
 
-void ADSEstimator::calcNewEstimate(int32 offsets1tos2, uint32 len1, uint32 len2, readid_t id1, readid_t id2, int8 id1dir, int8 id2dir)
+void ADSEstimator::calcNewEstimate(int32 offsets1tos2, uint32 len1, uint32 len2, int32 id1, int32 id2, int8 id1dir, int8 id2dir)
 {
-  FUNCSTART("void ADSEstimator::calcNewEstimate(int32 offsets1tos2, uint32 len1, uint32 len2, readid_t id1, readid_t id2, int8 id1dir, int8 id2dir)");
+  FUNCSTART("void ADSEstimator::calcNewEstimate(int32 offsets1tos2, uint32 len1, uint32 len2, int32 id1, int32 id2, int8 id1dir, int8 id2dir)");
 
-  BUGIFTHROW(len1==0,"len1==0 ? id1= " << id1 << " id2= " << id2);
-  BUGIFTHROW(len2==0,"len2==0 ? id2= " << id2 << " id1= " << id1);
+  BUGIFTHROW(len1==0,"len1==0 ?");
+  BUGIFTHROW(len2==0,"len2==0 ?");
 
   if(id1dir<0 && id2dir<0){
-    id1dir=1;
-    id2dir=1;
+    id1dir=-id1dir;
+    id2dir=-id2dir;
   }
 
   bool mustswap=false;
@@ -2451,7 +2410,7 @@ void ADSEstimator::calcNewEstimate(int32 offsets1tos2, uint32 len1, uint32 len2,
 //                           or id1>id2 && dir1<0
 // else it's the *right* offset ... in which case one must
 //  swap a few values
-void ADSEstimator::calcNewEstimateFromSkim(int32 offsets1tos2, uint32 len1, uint32 len2, readid_t id1, readid_t id2, int8 id1dir, int8 id2dir)
+void ADSEstimator::calcNewEstimateFromSkim(int32 offsets1tos2, uint32 len1, uint32 len2, int32 id1, int32 id2, int8 id1dir, int8 id2dir)
 {
   bool itsright=false;
   if(id1dir*id2dir<0){
@@ -2466,9 +2425,9 @@ void ADSEstimator::calcNewEstimateFromSkim(int32 offsets1tos2, uint32 len1, uint
 }
 
 
-uint32 ADSEstimator::getEstimatedLeftExpand(readid_t id) const
+uint32 ADSEstimator::getEstimatedLeftExpand(int32 id) const
 {
-  FUNCSTART("uint32 ADSEstimator::getEstimatedLeftExpand(readid_t id) const");
+  FUNCSTART("uint32 ADSEstimator::getEstimatedLeftExpand(int32 id) const");
 
   if(ADSE_id1==id){
     return ADSE_lexpandof1;
@@ -2479,9 +2438,9 @@ uint32 ADSEstimator::getEstimatedLeftExpand(readid_t id) const
 }
 
 
-uint32 ADSEstimator::getEstimatedRightExpand(readid_t id) const
+uint32 ADSEstimator::getEstimatedRightExpand(int32 id) const
 {
-  FUNCSTART("uint32 ADSEstimator::getEstimatedRightExpand(readid_t id) const");
+  FUNCSTART("uint32 ADSEstimator::getEstimatedRightExpand(int32 id) const");
 
   if(ADSE_id1==id){
     return ADSE_rexpandof1;
@@ -2491,9 +2450,9 @@ uint32 ADSEstimator::getEstimatedRightExpand(readid_t id) const
   MIRANOTIFY(Notify::INTERNAL,"id " << id << " not in ADSEstimator.\n");
 }
 
-uint32 ADSEstimator::getLen(readid_t id) const
+uint32 ADSEstimator::getLen(int32 id) const
 {
-  FUNCSTART("uint32 ADSEstimator::getLen(readid_t id) const");
+  FUNCSTART("uint32 ADSEstimator::getLen(int32 id) const");
 
   if(ADSE_id1==id){
     return ADSE_len1;
@@ -2546,9 +2505,9 @@ int32 ADSEstimator::getIDOfContained() const
 }
 
 
-void ADSEstimator::getPositionsInForwardSequenceofAlignmentStart(readid_t id1, readid_t id2, int32 & offset1, int32 & offset2) const
+void ADSEstimator::getPositionsInForwardSequenceofAlignmentStart(int32 id1, int32 id2, int32 & offset1, int32 & offset2) const
 {
-  FUNCSTART("void ADSEstimator::getStartOffsetPositions(readid_t id1, readid_t id2, int32 & offset1, int32 & offset2) const");
+  FUNCSTART("void ADSEstimator::getStartOffsetPositions(int32 id1, int32 id2, int32 & offset1, int32 & offset2) const");
 
   bool needswap=false;
   if(id1==ADSE_id2){
diff --git a/src/mira/ads.H b/src/mira/ads.H
index e7965d5..a1f7a16 100644
--- a/src/mira/ads.H
+++ b/src/mira/ads.H
@@ -11,17 +11,17 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
 
@@ -42,7 +42,7 @@ class AlignedDualSeq : public AlignedDualSeqFacts
 private:
   const static bool ADS_initialisedstatics;
 
-  static std::vector<double> ADS_powofstarcounter;
+  static vector<double> ADS_powofstarcounter;
 
   static uint32 ADS_c_matrix_valid;
 
@@ -51,7 +51,7 @@ private:
   static int8   ADS_realscore_matrix[ADS_MATSIZE][ADS_MATSIZE];
   static int8   ADS_expectedscore_matrix[ADS_MATSIZE][ADS_MATSIZE];
   static uint32 ADS_s_matrix_valid;
-
+  
 private:
   static bool staticInitialiser();
 
@@ -63,7 +63,7 @@ private:
   char   * ADS_consensus_gap_seq;    /* consensus sequence, but here
 					a star in aligned sequences is
 					shown as a star in the consensus */
-  int32    ADS_cursize;              // size in bytes of each of the 4 arrays above
+  int32    ADS_cursize;              // size in bytes of each of the 4 arrays above 
 
 
                                  // (pointing into ADS_aligned_seqX)!
@@ -78,7 +78,7 @@ private:
   uint16   ADS_numgaps;          /* num of gap/base mismatches,
 				    gap/gap (or oldgaps) is a match */
   uint16   ADS_maxcontiguousgaps; // max num of contiguous gaps
-
+  
   uint16   ADS_len1;             // length of sequence (without end-gaps)
   uint16   ADS_len2;             // length of sequence (without end-gaps)
 
@@ -93,8 +93,6 @@ private:
 				    This is for PacBio
 				 */
 
-  int32   ADS_minbanddistance; // how far Align::rAlign() was from a band in this solution
-  int32   ADS_bandwidthused;   // effective bandwidth used by Dynamic::computeBSimMatrix()
 
   //Functions
 private:
@@ -104,29 +102,26 @@ private:
   void zeroVars();
   void init();
   void matinit(char * arr, char a, char b, char value);
-  void calcEndsLenContiguousMatch();
 
 public:
   AlignedDualSeq(MIRAParameters * params);
-  AlignedDualSeq(MIRAParameters * params, const char * seq1, const char * seq2, readid_t id1,  readid_t id2, int8 id1dir, int8 id2dir, bool enforce_clean_ends, bool dontpenalisengaps);
+  AlignedDualSeq(MIRAParameters * params, const char * seq1, const char * seq2, int32 id1, int32 id2, int8 id1dir, int8 id2dir, bool enforce_clean_ends, bool dontpenalisengaps);
   AlignedDualSeq(AlignedDualSeq const &other);
   ~AlignedDualSeq();
 
   AlignedDualSeq const & operator=(AlignedDualSeq const &other);
-  friend std::ostream & operator<<(std::ostream &ostr, const AlignedDualSeq &ads);
+  friend ostream & operator<<(ostream &ostr, const AlignedDualSeq &ads);
 
   void  discard();
   void  saveMem(bool delete_seq=true, bool delete_consseq=true);
-  void  acquireSequences(const char * seq1,
-			 const char * seq2,
-			 readid_t id1,
-			 readid_t id2,
-			 int8 id1dir,
-			 int8 id2dir,
+  void  acquireSequences(const char * seq1, 
+			 const char * seq2, 
+			 int32 id1, 
+			 int32 id2, 
+			 int8 id1dir, 
+			 int8 id2dir, 
 			 bool enforce_clean_ends,
-			 bool dontpenalisengaps,
-			 int32 bandwidthused,
-			 int32 minbanddistance);
+			 bool dontpenalisengaps);
 
   inline bool  isValid() const {return ADS_valid!=0;}
   inline bool  isContained() const {return ADS_contained>0;};
@@ -134,26 +129,19 @@ public:
   inline int32 getScore() const {return ADS_score;};
   inline int32 getExpectedScore() const {return ADS_expected_score;};
   inline int32 getWeight() const {return ADS_weight;};
-
+  
   inline uint16 getNumMismatches() const {return ADS_nummismatches;};
   inline uint16 getNumGaps() const {return ADS_numgaps;};
 
-  const char * getAlignedSequence(readid_t id) const;
-  uint32 getLenOfAlignedSequence(readid_t id) const;
-
-  const char * getSequenceAtOverlapStart(readid_t id) const;
-
+  const char * getAlignedSequence(int32 id) const;
+  uint32 getLenOfAlignedSequence(int32 id) const;
+  
   inline const char * getConsensusSequence() const {return ADS_consensus_seq;};
   inline const char * getGapedConsensusSequence() const {return ADS_consensus_gap_seq;};
 
-  // information about how the alignment was computed
-  inline int32 getMinBandDistance() const { return ADS_minbanddistance;}
-  inline int32 getBandwidthUsed() const { return ADS_bandwidthused;}
-
-
-  bool clipper(uint32 winlen,
-	       int32 numerr,
-	       int32 & retgoodlen1,
+  bool clipper(uint32 winlen, 
+	       int32 numerr, 
+	       int32 & retgoodlen1, 
 	       int32 & retgoodlen2) const;
 
 };
@@ -164,8 +152,8 @@ public:
 class ADSEstimator
 {
 private:
-  readid_t ADSE_id1;
-  readid_t ADSE_id2;
+  int32  ADSE_id1;
+  int32  ADSE_id2;
 
   uint32 ADSE_lexpandof1;
   uint32 ADSE_rexpandof1;
@@ -182,27 +170,27 @@ private:
 
 public:
   ADSEstimator();
-  //ADSEstimator(int32 offsets1tos2,
-  //	       uint32 len1, uint32 len2,
+  //ADSEstimator(int32 offsets1tos2, 
+  //	       uint32 len1, uint32 len2, 
   //	       int32 id1, int32 id2,
   //	       int8 id1dir, int8 id2dir);
 
-  void calcNewEstimate(int32 offsets1tos2,
-		       uint32 len1, uint32 len2,
-		       readid_t id1, readid_t id2,
+  void calcNewEstimate(int32 offsets1tos2, 
+		       uint32 len1, uint32 len2, 
+		       int32 id1, int32 id2,
 		       int8 id1dir, int8 id2dir);
-  void calcNewEstimateFromSkim(int32 offsets1tos2,
-			       uint32 len1, uint32 len2,
-			       readid_t id1, readid_t id2,
+  void calcNewEstimateFromSkim(int32 offsets1tos2, 
+			       uint32 len1, uint32 len2, 
+			       int32 id1, int32 id2,
 			       int8 id1dir, int8 id2dir);
 
   inline uint32 getEstimatedOverlap() const {return ADSE_overlaplen;}
   inline uint32 getEstimatedTotalLen() const {return ADSE_totallen;}
 
-  uint32 getEstimatedLeftExpand(readid_t id) const;
-  uint32 getEstimatedRightExpand(readid_t id) const;
+  uint32 getEstimatedLeftExpand(int32 id) const;
+  uint32 getEstimatedRightExpand(int32 id) const;
 
-  uint32 getLen(readid_t id) const;
+  uint32 getLen(int32 id) const;
   inline int32 getID1() const {return ADSE_id1;}
   inline int32 getID2() const {return ADSE_id2;}
 
@@ -215,24 +203,24 @@ public:
   int32 getIDOfContained() const;
 
   void getPositionsInForwardSequenceofAlignmentStart(
-    readid_t id1, readid_t id2,
+    int32 id1, int32 id2,
     int32 & offset1, int32 & offset2) const;
 
 
-  friend std::ostream & operator<<(std::ostream &ostr, const ADSEstimator &adse){
-    ostr << "adse: id1: " << adse.ADSE_id1
-	 << " id2: " << adse.ADSE_id2
-	 << " le1: " << adse.ADSE_lexpandof1
-	 << " re1: " << adse.ADSE_rexpandof1
-	 << " le2: " << adse.ADSE_lexpandof2
-	 << " re2: " << adse.ADSE_rexpandof2
+  friend ostream & operator<<(ostream &ostr, const ADSEstimator &adse){
+    ostr << "adse: id1: " << adse.ADSE_id1 
+	 << " id2: " << adse.ADSE_id2 
+	 << " le1: " << adse.ADSE_lexpandof1 
+	 << " re1: " << adse.ADSE_rexpandof1 
+	 << " le2: " << adse.ADSE_lexpandof2 
+	 << " re2: " << adse.ADSE_rexpandof2 
 	 << " ln1: " << adse.ADSE_len1
 	 << " ln2: " << adse.ADSE_len2
 	 << " tl: " << adse.ADSE_totallen
 	 << " ol: " << adse.ADSE_overlaplen
 	 << " dr1: " << static_cast<int16>(adse.ADSE_dir1)
 	 << " dr2: " << static_cast<int16>(adse.ADSE_dir2)
-	 << std::endl;
+	 << endl;
     return ostr;
   }
 
diff --git a/src/mira/adsfacts.C b/src/mira/adsfacts.C
index 64432cc..03e34db 100644
--- a/src/mira/adsfacts.C
+++ b/src/mira/adsfacts.C
@@ -11,39 +11,43 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
 /*
  * 2 Sequences aligned, fact storage
  * AlignedDualSeq manages the data produced by the alignement routines. Two
  *  sequences have been aligned and are stored in an ADS object.
- *
+ * 
  * The ADSFacts object is a smaller storage unit for the plain facts,
  *  smaller and therefore less memory consuming (454 data *sigh*)
  *
  */
 
+// 	$Id$	
+
+#ifndef lint
+static char vcid[] = "$Id$";
+#endif /* lint */
 
 #include "adsfacts.H"
 
 #include "errorhandling/errorhandling.H"
 
-using namespace std;
-
-
 ostream & operator<<(ostream & ostr, const AlignedDualSeqFacts &adsf)
 {
+  (void) vcid;
+
   ostr << "ID1:" << adsf.ADSF_id1 << '\n';
   ostr << "ID2:" << adsf.ADSF_id2 << '\n';
   ostr << "Direction1: " << static_cast<int16>(adsf.getSequenceDirection(adsf.ADSF_id1)) << '\n';
@@ -51,45 +55,36 @@ ostream & operator<<(ostream & ostr, const AlignedDualSeqFacts &adsf)
   ostr << "Delta Seq2 to Seq1: " << adsf.ADSF_delta << '\n';
   ostr << "ID1 right delta: " << adsf.ADSF_id1_rightdelta << '\n';
   ostr << "ID2 right delta: " << adsf.ADSF_id2_rightdelta << '\n';
-  ostr << "ID1 5p clean: " << adsf.ADSF_5pconmatch1*4
-       << "\nID1 3p clean: " << adsf.ADSF_3pconmatch1*4
-       << "\nID2 5p clean: " << adsf.ADSF_5pconmatch2*4
-       << "\nID2 3p clean: " << adsf.ADSF_3pconmatch2*4 << '\n';
   ostr << "Overlap length: " << adsf.getOverlapLen() << '\n';
   ostr << "Total length: " << adsf.ADSF_total_len << '\n';
   ostr << "Score ratio: " << static_cast<uint16>(adsf.ADSF_score_ratio) << '\n';
   return ostr;
 }
 
-void AlignedDualSeqFacts::serialiseOut(ostream & ostr)
+void AlignedDualSeqFacts::serialiseOut(ofstream & ostr)
 {
-  ostr << ADSF_id1
-       << '\t' << ADSF_id2
-       << '\t' << static_cast<int16>(getSequenceDirection(ADSF_id1))
-       << '\t' << static_cast<int16>(getSequenceDirection(ADSF_id2))
-       << '\t' << ADSF_delta
-       << '\t' << ADSF_id1_rightdelta
-       << '\t' << ADSF_id2_rightdelta
-       << '\t' << getOverlapLen()
-       << '\t' << ADSF_total_len
-       << '\t' << static_cast<uint16>(ADSF_score_ratio)
-       << '\t' << static_cast<uint16>(ADSF_totalnonmatches)
-       << '\t' << ADSF_5pconmatch1
-       << '\t' << ADSF_3pconmatch1
-       << '\t' << ADSF_5pconmatch2
-       << '\t' << ADSF_3pconmatch2;
+  ostr << ADSF_id1;
+  ostr << '\t' << ADSF_id2;
+  ostr << '\t' << static_cast<int16>(getSequenceDirection(ADSF_id1));
+  ostr << '\t' << static_cast<int16>(getSequenceDirection(ADSF_id2));
+  ostr << '\t' << ADSF_delta;
+  ostr << '\t' << ADSF_id1_rightdelta;
+  ostr << '\t' << ADSF_id2_rightdelta;
+  ostr << '\t' << getOverlapLen();
+  ostr << '\t' << ADSF_total_len;
+  ostr << '\t' << static_cast<uint16>(ADSF_score_ratio);
 
   return;
 }
 
-void AlignedDualSeqFacts::serialiseIn(istream & istr)
+void AlignedDualSeqFacts::serialiseIn(ifstream & istr)
 {
   istr >> ADSF_id1;
   istr >> ADSF_id2;
 
   ADSF_id1and2_directions=0;
   // no idea why I can't directly stream into an int8 *sigh*
-  int32 tmp;
+  int16 tmp;
   istr >> tmp;
   if(tmp>0) ADSF_id1and2_directions=1;
   istr >> tmp;
@@ -97,32 +92,22 @@ void AlignedDualSeqFacts::serialiseIn(istream & istr)
   istr >> ADSF_delta;
   istr >> ADSF_id1_rightdelta;
   istr >> ADSF_id2_rightdelta;
+  // ADSF_overlap_len has been thrown out as it
+  //  can be computed
+  //istr >> ADSF_overlap_len;
   istr >> tmp;
   istr >> ADSF_total_len;
   istr >> tmp;
   ADSF_score_ratio=static_cast<int8>(tmp);
 
-  // bitfields need temp variable
-  istr >> tmp;
-  ADSF_totalnonmatches=tmp;
-  istr >> tmp;
-  ADSF_5pconmatch1=tmp;
-  istr >> tmp;
-  ADSF_3pconmatch1=tmp;
-  istr >> tmp;
-  ADSF_5pconmatch2=tmp;
-  istr >> tmp;
-  ADSF_3pconmatch2=tmp;
-
-
   //cout << *this;
   return;
 }
 
 
-int8 AlignedDualSeqFacts::getSequenceDirection(readid_t id) const
+int8 AlignedDualSeqFacts::getSequenceDirection(int32 id) const
 {
-  FUNCSTART("int8 AlignedDualSeqFacts::getSequenceDirection(readid_t id) const");
+  FUNCSTART("int8 AlignedDualSeqFacts::getSequenceDirection(int32 id) const");
   if(id==ADSF_id1){
     FUNCEND();
     if(ADSF_id1and2_directions & 0x1) return 1;
@@ -132,13 +117,16 @@ int8 AlignedDualSeqFacts::getSequenceDirection(readid_t id) const
     if(ADSF_id1and2_directions & 0x2) return 1;
     return -1;
   }else{
-    MIRANOTIFY(Notify::FATAL, "ID not in alignment.");
+    throw Notify(Notify::FATAL, THISFUNC, "ID not in alignment.");
   }
 }
 
-int32 AlignedDualSeqFacts::getOtherID(readid_t id) const
+int32 AlignedDualSeqFacts::getOtherID(int32 id) const
 {
-  FUNCSTART("uint32 ADS::getOtherID(ureadid_t id)");
+  FUNCSTART("uint32 ADS::getOtherID(uint32 id)");
+  //if(!ADS_valid){
+  //  throw Notify(Notify::FATAL, THISFUNC, " Object not initialised.");
+  //}
   if(id==ADSF_id1){
     FUNCEND();
     return ADSF_id2;
@@ -146,14 +134,17 @@ int32 AlignedDualSeqFacts::getOtherID(readid_t id) const
     FUNCEND();
     return ADSF_id1;
   }else{
-    MIRANOTIFY(Notify::FATAL, "ID not in alignment.");
+    throw Notify(Notify::FATAL, THISFUNC, "ID not in alignment.");
   }
 }
 
 
-uint32 AlignedDualSeqFacts::getOffsetInAlignment(readid_t id) const
+uint32 AlignedDualSeqFacts::getOffsetInAlignment(int32 id) const
 {
-  FUNCSTART("uint32 AlignedDualSeqFacts::getOffsetInAlignment(readid_t id) const");
+  FUNCSTART("uint32 AlignedDualSeqFacts::getOffsetInAlignment(int32 id) const");
+  //if(!ADS_valid){
+  //  throw Notify(Notify::FATAL, THISFUNC, " Object not initialised.");
+  //}
   if(id==ADSF_id1){
     FUNCEND();
     return 0;
@@ -161,13 +152,16 @@ uint32 AlignedDualSeqFacts::getOffsetInAlignment(readid_t id) const
     FUNCEND();
     return ADSF_delta;
   }else{
-    MIRANOTIFY(Notify::FATAL, "ID not in alignment.");
+    throw Notify(Notify::FATAL, THISFUNC, "ID not in alignment.");
   }
 }
 
-uint32 AlignedDualSeqFacts::getRightOffsetInAlignment(readid_t id) const
+uint32 AlignedDualSeqFacts::getRightOffsetInAlignment(int32 id) const
 {
-  FUNCSTART("uint32 ADS::getOffsetInAlignment(readid_t id)");
+  FUNCSTART("uint32 ADS::getOffsetInAlignment(int32 id)");
+  //if(!ADS_valid){
+  //  throw Notify(Notify::FATAL, THISFUNC, " Object not initialised.");
+  //}
   if(id==ADSF_id1){
     FUNCEND();
     return ADSF_id1_rightdelta;
@@ -175,65 +169,39 @@ uint32 AlignedDualSeqFacts::getRightOffsetInAlignment(readid_t id) const
     FUNCEND();
     return ADSF_id2_rightdelta;
   }else{
-    MIRANOTIFY(Notify::FATAL, "ID not in alignment.");
+    throw Notify(Notify::FATAL, THISFUNC, "ID not in alignment.");
   }
 }
 
-void AlignedDualSeqFacts::publicinit(readid_t id1, readid_t id2, uint16 delta, uint16 id1_rightdelta, uint16 id2_rightdelta, uint16 total_len, int8 id1_direction, int8 id2_direction, int8 score_ratio, uint16 totalnonmatches, uint16 s5pcm1, uint16 s3pcm1, uint16 s5pcm2, uint16 s3pcm2)
+void AlignedDualSeqFacts::publicinit(int32  id1, int32  id2, uint16 delta, uint16 id1_rightdelta, uint16 id2_rightdelta, uint16 total_len, int8 id1_direction, int8   id2_direction, int8 score_ratio)
 {
-  FUNCSTART("void AlignedDualSeqFacts::publicinit(readid_t id1, readid_t id2, uint16 delta, uint16 id1_rightdelta, uint16 id2_rightdelta, uint16 total_len, int8 id1_direction, int8 id2_direction, int8 score_ratio, uint16 totalnonmatches, uint16 s5pcm1, uint16 s3pcm1, uint16 s5pcm2, uint16 s3pcm2)");
+  FUNCSTART("uint32ADS::getOffsetInAlignment(int32id)");
   ADSF_id1=id1;
   ADSF_id2=id2;
   ADSF_delta=delta;
   ADSF_id1_rightdelta=id1_rightdelta;
   ADSF_id2_rightdelta=id2_rightdelta;
   ADSF_total_len=total_len;
-  ADSF_5pconmatch1=(s5pcm1>=28) ? 7 : s5pcm1/4;
-  ADSF_3pconmatch1=(s3pcm1>=28) ? 7 : s3pcm1/4;
-  ADSF_5pconmatch2=(s5pcm2>=28) ? 7 : s5pcm2/4;
-  ADSF_3pconmatch2=(s3pcm2>=28) ? 7 : s3pcm2/4;
-
+  
   ADSF_id1and2_directions=0;
   if(id1_direction>0) ADSF_id1and2_directions=1;
   if(id2_direction>0) ADSF_id1and2_directions|=2;
   ADSF_score_ratio=score_ratio;
-
+  
   FUNCEND();
 }
 
 
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-uint32 AlignedDualSeqFacts::get5pLenContiguousMatch(readid_t id) const
-{
-  if(ADSF_id1==id) return ADSF_5pconmatch1*4;
-  return ADSF_5pconmatch2*4;
-}
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-uint32 AlignedDualSeqFacts::get3pLenContiguousMatch(readid_t id) const
-{
-  if(ADSF_id1==id) return ADSF_3pconmatch1*4;
-  return ADSF_3pconmatch2*4;
-}
-
-
-uint16 AlignedDualSeqFacts::getRightDelta(readid_t id) const
-{
-  FUNCSTART("uint16 AlignedDualSeqFacts::getRightDelta(readid_t id) const");
-  if(id==ADSF_id1){
-    return ADSF_id1_rightdelta;
-  }else if(unlikely(id!=ADSF_id2)){
-    MIRANOTIFY(Notify::FATAL, "ID " << id << " not in alignment.");
-  }
-  return ADSF_id2_rightdelta;
-}
+//uint32 AlignedDualSeqFacts::getOverlapLen() const
+//{
+//  if(ADSF_total_len-ADSF_delta-ADSF_id1_rightdelta-ADSF_id2_rightdelta != ADSF_overlap_len){
+//    cout << "Argh, ADFS len violation.\n";
+//    cout << ADSF_total_len 
+//	 << " - " << ADSF_delta 
+//	 << " - " << ADSF_id1_rightdelta 
+//	 << " - " << ADSF_id2_rightdelta 
+//	 << " != " << ADSF_overlap_len << " ???\n";
+//    abort();
+//  }
+//  return ADSF_overlap_len;
+//};
diff --git a/src/mira/adsfacts.H b/src/mira/adsfacts.H
index e28ce24..7b4bf5a 100644
--- a/src/mira/adsfacts.H
+++ b/src/mira/adsfacts.H
@@ -9,29 +9,29 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
 #ifndef _adsfacts_h_
 #define _adsfacts_h_
 
-#include <fstream>
+#include <iostream>
 #include "stdinc/defines.H"
 
 
 
-// Note that we need to save memory, therefore this class implicitly
-//  limits the length of sequences that can be worked on to 2^15-1=32767
+// Note that we need to save memory, therefore this class implicitly 
+//  limits the length of sequences that can be worked on to 2^15-1=32767 
 //  bases in length
 //
 // This is a crucial structure that will live a few million copies over
@@ -40,11 +40,12 @@
 // This limitation is ok, an assembler should not try to align
 //  sequences that come even close to this limit.
 
+using namespace std;
 class AlignedDualSeqFacts
 {
 protected:
-  readid_t ADSF_id1;
-  readid_t ADSF_id2;
+  int32    ADSF_id1;
+  int32    ADSF_id2;
 
   uint16   ADSF_delta;            /* offset needed to get from *ADS_aligned_seq
 				    to  *ADS_seq2;*/
@@ -67,49 +68,24 @@ protected:
      0x2 = id2 forward, id1 reverse
      0x3 = both forward
    */
-  uint8   ADSF_id1and2_directions:2;
-
-
-   /*
-      1 + acgtaaagggcccttt            1 + acgtaaagggcccttt         etc.pp
-      2 +     aaaTggccctttacgt        2 -     aaaTggccctttacgt
-      5pcm1 = 0;    3pcm1 = 8         5pcm1 = 0;    3pcm1 = 8
-      5pcm2 = 3;    3pcm1 = 0         5pcm2 = 0;    3pcm1 = 3
-
-      compressed version of ADS_... variables with 3 bits
-      steps of 4: 0= 0-3, 1= 4-7, etc. ..., 7= >=28
-      so, the above becomes:
-
-      5pcm1 = 0;    3pcm1 = 2         5pcm1 = 0;    3pcm1 = 2
-      5pcm2 = 0;    3pcm1 = 0         5pcm2 = 0;    3pcm1 = 0
-  */
-  uint16 ADSF_5pconmatch1:3;
-  uint16 ADSF_3pconmatch1:3;
-  uint16 ADSF_5pconmatch2:3;
-  uint16 ADSF_3pconmatch2:3;
-
-  uint16 ADSF_totalnonmatches:10;  // = ADS_nummismatches+ADS_numgaps; 1023 means >=1023
+  uint8   ADSF_id1and2_directions;
 
   //Functions
 private:
 
 public:
-  friend std::ostream & operator<<(std::ostream &ostr, const AlignedDualSeqFacts &adsf);
-
-  void serialiseOut(std::ostream & ostr);
-  void serialiseIn(std::istream & ostr);
+  friend ostream & operator<<(ostream &ostr, const AlignedDualSeqFacts &adsf);
+  
+  void serialiseOut(ofstream & ostr);
+  void serialiseIn(ifstream & ostr);
 
-  inline readid_t getID1() const {return ADSF_id1;};
-  inline readid_t getID2() const {return ADSF_id2;};
-  readid_t getOtherID(readid_t id) const;
-  int8 getSequenceDirection(readid_t id) const;
+  inline int32 getID1() const {return ADSF_id1;};
+  inline int32 getID2() const {return ADSF_id2;};
+  int32 getOtherID(int32 id) const;
+  int8   getSequenceDirection(int32 id) const;
 
-  uint32 getOffsetInAlignment(readid_t id) const;
-  uint32 getRightOffsetInAlignment(readid_t id) const;
-
-  uint32 get5pLenContiguousMatch(readid_t id) const;
-  uint32 get3pLenContiguousMatch(readid_t id) const;
-  uint32 getTotalNonMatches() const {return ADSF_totalnonmatches; };
+  uint32 getOffsetInAlignment(int32 id) const;
+  uint32 getRightOffsetInAlignment(int32 id) const;
 
   inline uint32 getTotalLen() const {return ADSF_total_len;};
   inline int8 getScoreRatio() const {return ADSF_score_ratio;};
@@ -121,21 +97,16 @@ public:
     return ADSF_total_len-ADSF_delta-ADSF_id1_rightdelta-ADSF_id2_rightdelta;
   }
 
-  void publicinit(readid_t id1,
-		  readid_t id2,
-		  uint16   delta,
-		  uint16   id1_rightdelta,
-		  uint16   id2_rightdelta,
-		  uint16   totallen,
-		  int8     id1_direction,
-		  int8     id2_direction,
-		  int8     score_ratio,
-		  uint16 totalnonmatches, uint16 s5pcm1, uint16 s3pcm1, uint16 s5pcm2, uint16 s3pcm2);
-
-  // these here are more for debugging: addRead() needs this for dumping help
-  //  in the replay log
-  inline uint16 getDelta() const { return ADSF_delta;}
-  uint16 getRightDelta (readid_t) const;
+
+  void publicinit(int32  id1,
+		  int32  id2,
+		  uint16 delta,
+		  uint16 id1_rightdelta,
+		  uint16 id2_rightdelta,
+		  uint16 totallen,
+		  int8   id1_direction,
+		  int8   id2_direction,
+		  int8   score_ratio);
 };
 
 
diff --git a/src/mira/align.C b/src/mira/align.C
index bc6d34d..41deaf5 100644
--- a/src/mira/align.C
+++ b/src/mira/align.C
@@ -11,29 +11,30 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
+// 	$Id$	
 
-#include "mira/align.H"
-
-#include "errorhandling/errorhandling.H"
-
-#include "mira/ads.H"
+#ifndef lint
+static char vcid[] = "$Id$";
+#endif /* lint */
 
+#include "align.H"
 
-using namespace std;
+#include <strings.h>                         // C-strings
 
+#include "errorhandling/errorhandling.H"
 
 #ifdef CEBUGFLAG
 #define CEBUG(bla)   {cout << bla; cout.flush();}
@@ -43,7 +44,7 @@ using namespace std;
 #define CEBUGF(bla)
 #endif
 
-#define CLOCK_STEPS1
+
 
 
 #if __GNUC__ >= 3
@@ -62,6 +63,41 @@ using namespace std;
 uint64 Align::AL_alloccount=0;
 
 
+void Align::foolCompiler()
+{
+#include "stdinc/foolcompiler.C"
+}
+
+
+
+/*************************************************************************
+ *
+ *
+ *
+ *************************************************************************/
+
+Align::Align(MIRAParameters * params, const char * seq1, uint32 len1, const char * seq2, uint32 len2, int32 id1, int32 id2, int8 id1dir, int8 id2dir, bool calcwithoffset, int32 expectedoffset) : Dynamic(params, seq1, len1, seq2, len2, calcwithoffset, expectedoffset)
+{
+  FUNCSTART("Align::Align(MIRAParameters * params, const char * seq1, uint32 len1, const char * seq2, uint32 len2, int32 id1, int32 id2, int8 id1dir, int8 id2dir) : Dynamic(params, seq1, len1, seq2, len2, bool calcwithoffset, int32 expectedoffset)");
+
+  AL_miraparams=params;
+
+  AL_id1=id1;
+  AL_id2=id2;
+  AL_id1dir=id1dir;
+  AL_id2dir=id2dir;
+
+  AL_tmpads=NULL;
+  AL_alseq1=NULL;
+  AL_alseq2=NULL;
+  AL_as12size=0;
+
+
+  init();
+
+  FUNCEND();
+}
+
 
 /*************************************************************************
  *
@@ -75,18 +111,12 @@ Align::Align(MIRAParameters * params): Dynamic(params)
 
   AL_miraparams=params;
 
-  AL_tmpads=nullptr;
-  AL_alseq1=nullptr;
-  AL_alseq2=nullptr;
+  AL_tmpads=NULL;
+  AL_alseq1=NULL;
+  AL_alseq2=NULL;
   AL_as12size=0;
 
-  AL_userle=false;
-  AL_rle_create_packed_align=false;
-  AL_rle_create_stdleft_align=true;
-  AL_rle_create_nonstdright_align=false;
-
   init();
-  resetTimings();
 
   FUNCEND();
 }
@@ -133,9 +163,9 @@ Align::~Align()
 {
   FUNCSTART("Align::~Align()");
 
-  if(AL_tmpads != nullptr) delete AL_tmpads;
-  if(AL_alseq1 != nullptr) delete [] AL_alseq1;
-  if(AL_alseq2 != nullptr) delete [] AL_alseq2;
+  if(AL_tmpads != NULL) delete AL_tmpads;
+  if(AL_alseq1 != NULL) delete [] AL_alseq1;
+  if(AL_alseq2 != NULL) delete [] AL_alseq2;
 
   FUNCEND();
 }
@@ -151,41 +181,25 @@ void Align::acquireSequences(const char * seq1, uint32 len1, const char * seq2,
 {
   FUNCSTART("Align::acquireSequences(const char * seq1, uint32 len1, const char * seq2, uint32 len2, int32 id1, int32 id2, int8 id1dir, int8 id2dir, bool calcwithoffset, int32 expectedoffset)");
 
-#ifdef CLOCK_STEPS1
-  timeval tv;
-  gettimeofday(&tv,nullptr);
-#endif
-
-  if(AL_userle){
-    auto newoffset=expectedoffset;
-    pa_packSeqToRLE(seq1,len1,AL_rles1, AL_rlev1, newoffset);
-    if(newoffset>=0) expectedoffset=newoffset;
-    newoffset=-expectedoffset;
-    pa_packSeqToRLE(seq2,len2,AL_rles2, AL_rlev2, newoffset);
-    if(newoffset>=0) expectedoffset=-newoffset;
-    seq1=AL_rles1.c_str();
-    len1=static_cast<uint32>(AL_rles1.size());
-    seq2=AL_rles2.c_str();
-    len2=static_cast<uint32>(AL_rles2.size());
-  }else{
-    AL_rles1.clear();
-    AL_rles2.clear();
-    AL_rlev1.clear();
-    AL_rlev2.clear();
-  }
-
   Dynamic::setSequences(seq1, len1, seq2, len2, calcwithoffset, expectedoffset);
+  //for(uint32 i=0; i<5000; i++) {
+  //  Dynamic::acquireSequences(seq1, len1, seq2, len2, calcwithoffset, expectedoffset, true);
+  //  //Dynamic::acquireSequences(seq1, len1, seq2, len2, calcwithoffset, expectedoffset, false);
+  //}
+  //exit(0);
 
   AL_id1=id1;
   AL_id2=id2;
   AL_id1dir=id1dir;
   AL_id2dir=id2dir;
 
-  init();
+  //if(AL_alseq1) delete [] AL_alseq1;
+  // REMOVEME (comment)
+  //  AL_alseq1=NULL;
+  //if(AL_alseq2) delete [] AL_alseq2;
+  //  AL_alseq2=NULL;
 
-#ifdef CLOCK_STEPS1
-  AL_timing_acquires+=diffsuseconds(tv);
-#endif
+  init();
 
   FUNCEND();
 }
@@ -208,10 +222,10 @@ void Align::discard()
 
   Dynamic::discard();
 
-  if(AL_alseq1!=nullptr) delete [] AL_alseq1;
-  if(AL_alseq2!=nullptr) delete [] AL_alseq2;
-  AL_alseq1=nullptr;
-  AL_alseq2=nullptr;
+  if(AL_alseq1!=NULL) delete [] AL_alseq1;
+  if(AL_alseq2!=NULL) delete [] AL_alseq2;
+  AL_alseq1=NULL;
+  AL_alseq2=NULL;
   AL_as12size=0;
 
   FUNCEND();
@@ -228,21 +242,18 @@ void Align::prepareAlign(list<AlignedDualSeq> * adslist)
 {
   FUNCSTART("void Align::prepareAlign(list<AlignedDualSeq> * adslist)");
 
-  BUGIFTHROW(!DYN_validseq,": Programming error. Tried to align without proper initialisation of Align-object.");
-
-#ifdef CLOCK_STEPS1
-  timeval tv;
-  gettimeofday(&tv,nullptr);
-#endif
+  if(!DYN_valid){
+    throw Notify(Notify::INTERNAL, THISFUNC, ": Programming error. Tried to align without proper initialisation of Align-object.");
+  }
 
   AL_adslist=adslist;
-  if(AL_tmpads==nullptr) AL_tmpads= new AlignedDualSeq(AL_miraparams);
+  if(AL_tmpads==NULL) AL_tmpads= new AlignedDualSeq(AL_miraparams);
 
   AL_align_maxlen=DYN_len_seq1+DYN_len_seq2+1;
 
   if(AL_as12size < AL_align_maxlen){
-    if(AL_alseq1 != nullptr) delete [] AL_alseq1;
-    if(AL_alseq2 != nullptr) delete [] AL_alseq2;
+    if(AL_alseq1 != NULL) delete [] AL_alseq1;
+    if(AL_alseq2 != NULL) delete [] AL_alseq2;
 
     AL_as12size=AL_align_maxlen;
     if(AL_as12size<2000) AL_as12size=2000;
@@ -259,20 +270,15 @@ void Align::prepareAlign(list<AlignedDualSeq> * adslist)
   AL_error_hit_band=false;
 
   // clear the aligned sequences
-  // TODO: check: do I need this???
-  memset(AL_alseq1,0,AL_align_maxlen);
-  memset(AL_alseq2,0,AL_align_maxlen);
-
+  for(uint32 i=0; i<AL_align_maxlen; i++){
+    AL_alseq1[i]=0;
+    AL_alseq2[i]=0;
+  }
   AL_allen=AL_align_maxlen-1;
 
   AL_seq1ptr=DYN_sequence1+DYN_len_seq1-1;
   AL_seq2ptr=DYN_sequence2+DYN_len_seq2-1;
 
-
-#ifdef CLOCK_STEPS1
-  AL_timing_prepalign+=diffsuseconds(tv);
-#endif
-
   FUNCEND();
 }
 
@@ -286,7 +292,7 @@ void Align::setRAlignParams()
 {
   align_parameters const & AL_params = AL_miraparams->getAlignParams();
   dynamic_parameters const & DYN_params = DYN_miraparams->getDynamicParams();
-
+  
   if(AL_mpset_al_min_relscore!=0){
     AL_mpcache_al_min_relscore=AL_mpset_al_min_relscore;
   }else{
@@ -316,8 +322,6 @@ void Align::simpleAlign(list<AlignedDualSeq> * adslist, bool enforce_clean_ends,
 {
   FUNCSTART("void Align::simpleAlign(list<AlignedDualSeq> * adslist, bool enforce_clean_ends, bool dontpenalisengaps)");
 
-  if(!DYN_matrixcalculated) Dynamic::computeMatrix();
-
   AL_enforce_clean_ends=enforce_clean_ends;
   AL_dont_penalise_ngaps=dontpenalisengaps;
 
@@ -325,7 +329,6 @@ void Align::simpleAlign(list<AlignedDualSeq> * adslist, bool enforce_clean_ends,
 
   AL_new_solution=1;
   AL_cutoff_counter=0;
-  AL_minbanddistance=1000000;
 
   setRAlignParams();
 
@@ -346,36 +349,16 @@ void Align::fullAlign(list<AlignedDualSeq> * adslist, bool enforce_clean_ends, b
 {
   FUNCSTART("void Align::fullAlign(list<AlignedDualSeq> * adslist, bool enforce_clean_ends, bool dontpenalisengaps)");
 
-  if(!DYN_matrixcalculated) Dynamic::computeMatrix();
-
-#ifdef CLOCK_STEPS1
-  timeval tv;
-  gettimeofday(&tv,nullptr);
-#endif
-
-  try {
-    AL_enforce_clean_ends=enforce_clean_ends;
-    AL_dont_penalise_ngaps=dontpenalisengaps;
-
-    prepareAlign(adslist);
+  AL_enforce_clean_ends=enforce_clean_ends;
+  AL_dont_penalise_ngaps=dontpenalisengaps;
 
-    setRAlignParams();
+  prepareAlign(adslist);
 
-    termAlign();
-  }
-  catch(Notify n){
-    cout << "Full align failed!"
-	 << "\nenforce_clean_ends: " << enforce_clean_ends
-	 << "\ndontpenalisengaps: " << dontpenalisengaps
-	 << endl;
-    coutWhatWasGiven();
-    n.handleError(THISFUNC);
-  }
+  setRAlignParams();
 
+  termAlign();
 
-#ifdef CLOCK_STEPS1
-  AL_timing_fullalign+=diffsuseconds(tv);
-#endif
+  //delete AL_tmpads;
 
   FUNCEND();
 }
@@ -406,9 +389,8 @@ void Align::termAlign()
   // FIXME: bad fix. if both are 1, termAlign will read across memborders
   // Albeit this should never happen, I'll fix termAlign later
   if(AL_params.al_min_score==1 && AL_params.al_min_overlap == 1){
-    align_parameters & AL_ncparams = const_cast<align_parameters &>(AL_miraparams->getAlignParams());
-    AL_ncparams.al_min_score=2;
-    AL_ncparams.al_min_overlap=2;
+    AL_miraparams->setAlignMinScore(2);
+    AL_miraparams->setAlignMinOverlap(2);
   }
 
   // simple tactics now: just take the best value from last column
@@ -416,15 +398,15 @@ void Align::termAlign()
 
   int32 maxvalrow=-1;
   int32 maxvalcol=maxvalrow;
-
+  
   uint32 maxvalrowpos=0;
   uint32 maxvalcolpos=0;
   {
     CEBUG("\n\nLast row (left to right):\n");
-    for(uint32 i=1; i<=DYN_len_seq2; ++i) {
+    for(int32 i=1; i<=DYN_len_seq2; i++) {
       int32 vAL_actpos=DYN_simmatrix[((DYN_len_seq1)*(DYN_len_seq2+1)+i)];
       CEBUG("R-Looking: " << i << "\tval:" << vAL_actpos << '\n');
-      int32 relscore=(vAL_actpos*10000)/min(i,DYN_len_seq1);
+      int32 relscore=(vAL_actpos*10000)/min(i,static_cast<int32>(DYN_len_seq1));
       if(relscore >= AL_params.al_min_relscore
 	 && vAL_actpos>=AL_params.al_min_score
 	 && vAL_actpos>=maxvalrow){
@@ -434,10 +416,10 @@ void Align::termAlign()
     }
 
     CEBUG("Last column:\n");
-    for(uint32 i=1; i<=DYN_len_seq1; ++i) {
+    for(int32 i=1; i<=DYN_len_seq1; i++) {
       int32 vAL_actpos=(DYN_simmatrix[i*(DYN_len_seq2+1)+DYN_len_seq2]);
       CEBUG("C-Looking: " << i << "\tval: " << vAL_actpos << '\n');
-      int32 relscore=(vAL_actpos*10000)/min(i,DYN_len_seq2);
+      int32 relscore=(vAL_actpos*10000)/min(i,static_cast<int32>(DYN_len_seq2));
       if(relscore >= AL_params.al_min_relscore
 	 && vAL_actpos>=AL_params.al_min_score
 	 && vAL_actpos >= maxvalcol){
@@ -452,47 +434,31 @@ void Align::termAlign()
 
   AL_new_solution=1;
   AL_cutoff_counter=0;
-  AL_minbanddistance=1000000;
-
   //if(maxvalrow==maxvalcol
   //   && maxvalrowpos+1==DYN_len_seq2
   //   && maxvalcolpos+1==DYN_len_seq1){
   //  // we start in the corner
   //  rAlign(DYN_len_seq1, DYN_len_seq2,'d');
-  //}else
+  //}else 
   if(maxvalrow>maxvalcol){
     if(maxvalrowpos>0) {
       CEBUG("maxvalrowpos: " << maxvalrowpos << '\t' << "DYN_len_seq2: " << DYN_len_seq2 << endl);
-      for(uint32 i=maxvalrowpos; i<DYN_len_seq2; ++i){
+      for(int32 i=maxvalrowpos; i<DYN_len_seq2; i++){
 	AL_alseq1[--AL_allen]=' ';
 	AL_alseq2[AL_allen]=*AL_seq2ptr--;
       }
       CEBUG("DoAlign");
-#ifdef CLOCK_STEPS1
-      timeval tv;
-      gettimeofday(&tv,nullptr);
-#endif
       rAlign(DYN_len_seq1, maxvalrowpos,'d',false);
-#ifdef CLOCK_STEPS1
-      AL_timing_raligntot+=diffsuseconds(tv);
-#endif
     }
   } else {
     if(maxvalcolpos>0) {
       CEBUG("maxvalcolpos: " << maxvalcolpos << '\t' << "DYN_len_seq1: " << DYN_len_seq1 << endl);
-      for(uint32 i=maxvalcolpos; i<DYN_len_seq1; ++i){
+      for(int32 i=maxvalcolpos; i<DYN_len_seq1; i++){
 	AL_alseq1[--AL_allen]=*AL_seq1ptr--;
 	AL_alseq2[AL_allen]=' ';
       }
       CEBUG("DoAlign");
-#ifdef CLOCK_STEPS1
-      timeval tv;
-      gettimeofday(&tv,nullptr);
-#endif
       rAlign(maxvalcolpos, DYN_len_seq2,'d',false);
-#ifdef CLOCK_STEPS1
-      AL_timing_raligntot+=diffsuseconds(tv);
-#endif
     }
   }
   CEBUG("I'm out! AL_adslist->size(): " << AL_adslist->size() << endl;);
@@ -517,9 +483,9 @@ void Align::termAlign()
 //#define FUNCEND()
 
 //#define CEBUG(bla)   {cout << bla; cout.flush();}
-void Align::rAlign(uint32 irow, uint32 jcol, char lastdir, bool hadn)
+void Align::rAlign(uint32 i, uint32 j, char lastdir, bool hadn)
 {
-  FUNCSTART("void Align::rAlign(uint32 irow, uint32 jcol, char lastdir, bool hadn)");
+  FUNCSTART("void Align::rAlign(uint32 i, uint32 j, char lastdir)");
 
 //  align_parameters const & AL_params = AL_miraparams->getAlignParams();
 //  dynamic_parameters const & DYN_params = DYN_miraparams->getDynamicParams();
@@ -533,10 +499,10 @@ void Align::rAlign(uint32 irow, uint32 jcol, char lastdir, bool hadn)
   //  prefetchrl(&DYN_simmatrix[(i-1)*mll+j]);
 
   CEBUG("Dong!\n");
-  CEBUG("irow: " << irow << "\tjcol: " << jcol << "\tAL_allen: " << AL_allen<< endl);
-  CEBUG("s[i,j]:" << DYN_simmatrix[irow*(DYN_len_seq2+1)+jcol]<< endl);
-  if(irow>0 && jcol>0){
-    CEBUG("s[i-1,j-1]:" << DYN_simmatrix[((irow-1)*(DYN_len_seq2+1))+jcol-1] << endl);
+  CEBUG("i: " << i << "\tj: " << j << "\tAL_allen: " << AL_allen<< endl);
+  CEBUG("s[i,j]:" << DYN_simmatrix[i*(DYN_len_seq2+1)+j]<< endl);
+  if(i>0 && j>0){
+    CEBUG("s[i-1,j-1]:" << DYN_simmatrix[((i-1)*(DYN_len_seq2+1))+j-1] << endl);
   }
 
   bool hasn=false;
@@ -544,202 +510,131 @@ void Align::rAlign(uint32 irow, uint32 jcol, char lastdir, bool hadn)
     CEBUG("seq1ptr points on: " << *AL_seq1ptr << endl);
     hasn=(*AL_seq1ptr=='N');
   }else{
-    CEBUG("seq1ptr points on: nullptr\n");
+    CEBUG("seq1ptr points on: NULL\n");
   }
   if(AL_seq2ptr>=DYN_sequence2 && *AL_seq2ptr){
     CEBUG("seq2ptr points on: " << *AL_seq2ptr << endl);
     hasn=hasn | (*AL_seq2ptr=='N');
   }else{
-    CEBUG("seq2ptr points on: nullptr\n");
+    CEBUG("seq2ptr points on: NULL\n");
   }
-  if(unlikely(AL_allen>AL_align_maxlen)) {
+  if(AL_allen>AL_align_maxlen) {
     cerr << "allen:: "<< AL_allen;
-    MIRANOTIFY(Notify::INTERNAL, ": FOOOOOO!.") ;
+    throw Notify(Notify::INTERNAL, THISFUNC, ": FOOOOOO!.") ;
   }
 
-  if(unlikely(AL_cutoff_counter==AL_mpcache_al_max_cutoff)) {
+  if(AL_cutoff_counter==AL_mpcache_al_max_cutoff) {
     CEBUG("back... (because of cutoff)\n");
     return;
   }
-  if(unlikely(AL_error_hit_band)) {
-    CEBUG("back... (because of band hit)\n");
-    return;
-  }
 
-  if(unlikely(irow==0 && jcol==0)) {
+  if(i==0 && j==0) {
     if(AL_seq1ptr==DYN_sequence1-1 && AL_seq2ptr==DYN_sequence2-1){
-      const char * adss1ptr=AL_alseq1+AL_allen;
-      const char * adss2ptr=AL_alseq2+AL_allen;
-#ifdef CLOCK_STEPS1
-      timeval tv;
-      gettimeofday(&tv,nullptr);
-#endif
-      AL_tmpads->acquireSequences(adss1ptr, adss2ptr, AL_id1, AL_id2, AL_id1dir, AL_id2dir, AL_enforce_clean_ends, AL_dont_penalise_ngaps, DYN_bandwidth, AL_minbanddistance);
-#ifdef CLOCK_STEPS1
-      AL_timing_ra_adsacquire+=diffsuseconds(tv);
-#endif
+      AL_tmpads->acquireSequences(AL_alseq1+AL_allen, AL_alseq2+AL_allen, AL_id1, AL_id2, AL_id1dir, AL_id2dir, AL_enforce_clean_ends, AL_dont_penalise_ngaps);
       CEBUG("Solution\n");
       CEBUG(*AL_tmpads);
 
       if(AL_tmpads->getScore() >= static_cast<int32>(AL_mpcache_al_min_score / AL_mpcache_dyn_score_multiplier)
-	 && ((AL_tmpads->getOverlapLen() >= static_cast<uint32>(AL_mpcache_al_min_overlap)
-	      && AL_tmpads->getScoreRatio() >= static_cast<int32>(AL_mpcache_al_min_relscore))
-	     || (true
-		 && AL_tmpads->getOverlapLen() >= 17
-		 && AL_tmpads->getScoreRatio() == 100))) {
-
-#ifdef CLOCK_STEPS1
-	gettimeofday(&tv,nullptr);
-#endif
+	 && AL_tmpads->getOverlapLen() >= static_cast<uint32>(AL_mpcache_al_min_overlap)
+	 && AL_tmpads->getScoreRatio() >= static_cast<int32>(AL_mpcache_al_min_relscore)){
 	AL_adslist->push_back(*AL_tmpads);
-#ifdef CLOCK_STEPS1
-	AL_timing_ra_adslist+=diffsuseconds(tv);
-#endif
-
-	if(!AL_rlev1.empty()){
-	  if(AL_rle_create_stdleft_align){
-	    ra_expandRLEAlignments(adss1ptr,adss2ptr,true);
-#ifdef CLOCK_STEPS1
-	    gettimeofday(&tv,nullptr);
-#endif
-	    AL_tmpads->acquireSequences(AL_unrles1.c_str(), AL_unrles2.c_str(), AL_id1, AL_id2, AL_id1dir, AL_id2dir, AL_enforce_clean_ends, AL_dont_penalise_ngaps, DYN_bandwidth, AL_minbanddistance);
-#ifdef CLOCK_STEPS1
-	    AL_timing_ra_adsacquire+=diffsuseconds(tv);
-#endif
-#ifdef CLOCK_STEPS1
-	    gettimeofday(&tv,nullptr);
-#endif
-	    AL_adslist->push_back(*AL_tmpads);
-#ifdef CLOCK_STEPS1
-	    AL_timing_ra_adslist+=diffsuseconds(tv);
-#endif
-	  }
-	  if(AL_rle_create_nonstdright_align){
-	    ra_expandRLEAlignments(adss1ptr,adss2ptr,false);
-#ifdef CLOCK_STEPS1
-	    gettimeofday(&tv,nullptr);
-#endif
-	    AL_tmpads->acquireSequences(AL_unrles1.c_str(), AL_unrles2.c_str(), AL_id1, AL_id2, AL_id1dir, AL_id2dir, AL_enforce_clean_ends, AL_dont_penalise_ngaps, DYN_bandwidth, AL_minbanddistance);
-#ifdef CLOCK_STEPS1
-	    AL_timing_ra_adsacquire+=diffsuseconds(tv);
-#endif
-#ifdef CLOCK_STEPS1
-	    gettimeofday(&tv,nullptr);
-#endif
-	    AL_adslist->push_back(*AL_tmpads);
-#ifdef CLOCK_STEPS1
-	    AL_timing_ra_adslist+=diffsuseconds(tv);
-#endif
-	  }
-	}
-
-
       }
-
-      ++AL_cutoff_counter;
-      ++AL_no_solutions;
+      
+      AL_no_solutions++;
+      AL_cutoff_counter++;
       if(AL_new_solution){
 	AL_new_solution=0;
-	++AL_no_diff_solutions;
+	AL_no_diff_solutions++;
       }
     }
     CEBUG("back...\n");
     return;
   }
 
-  if(irow==0){
-    CEBUG("irow=0 left ...\n");
+  if(i==0){
+
+    CEBUG("i=0 left ...\n");
 
     AL_alseq1[--AL_allen]=' ';
     AL_alseq2[AL_allen]=*AL_seq2ptr--;
-    rAlign(irow,jcol-1,'l',hasn);
+    rAlign(i,j-1,'l',hasn);
 //    AL_alseq1[AL_allen]='^';
 //    AL_alseq2[AL_allen++]='^';
     AL_allen++;
     AL_seq2ptr++;
-  }else if(jcol==0){
+  }else if(j==0){
 
-    CEBUG("jcol=0 up ...\n");
+    CEBUG("j=0 up ...\n");
 
     AL_alseq1[--AL_allen]=*AL_seq1ptr--;
     AL_alseq2[AL_allen]=' ';
-    rAlign(irow-1,jcol,'u',hasn);
+    rAlign(i-1,j,'u',hasn);
 //    AL_alseq1[AL_allen]='%';
 //    AL_alseq2[AL_allen++]='%';
     AL_allen++;
     AL_seq1ptr++;
   } else {
-    // minimum distance from left band ...
-    AL_minbanddistance= min(AL_minbanddistance,static_cast<int32>(jcol)-(DYN_leftbandx+static_cast<int32>(irow)));
-    BUGIFTHROW(AL_minbanddistance<0,"left AL_minbanddistance " << AL_minbanddistance << " < 0 ???\nirow: " << irow << " jcol: " << jcol << " lbx: " << DYN_leftbandx);
-    // ... and right band
-    AL_minbanddistance= min(AL_minbanddistance,DYN_rightbandx+static_cast<int32>(irow)-static_cast<int32>(jcol));
-    BUGIFTHROW(AL_minbanddistance<0,"right AL_minbanddistance " << AL_minbanddistance << " < 0 ???\nirow: " << irow << " jcol: " << jcol << " rbx: " << DYN_rightbandx);
-
-    if(AL_minbanddistance <= DYN_bandsafety){
-      AL_error_hit_band=true;
-      CEBUG("HIT BAND LIMIT " << DYN_bandsafety << " : " << static_cast<int32>(jcol)-(DYN_leftbandx+static_cast<int32>(irow)) << " " << DYN_rightbandx+static_cast<int32>(irow)-static_cast<int32>(jcol) << endl);
-    }else{
-      int32 vgl=DYN_match_matrix[static_cast<uint8>(*AL_seq1ptr)][static_cast<uint8>(*AL_seq2ptr)];
-
-      CEBUG("vgl: " << vgl << endl);
-
-      // precompute possibilities, optimised for memory access
-      // at the same time, check whether we hit a band limit
-      if(DYN_simmatrix[irow*mll+jcol-1]==DYN_BANDLIMIT) AL_error_hit_band=true;
-      bool leftok=(DYN_simmatrix[irow*mll+jcol-1]+AL_mpcache_dyn_score_gap==DYN_simmatrix[irow*mll+jcol]);
-      bool diagok=(DYN_simmatrix[(irow-1)*mll+jcol-1]+vgl==DYN_simmatrix[irow*mll+jcol]);
-      if(DYN_simmatrix[(irow-1)*mll+jcol]==DYN_BANDLIMIT) AL_error_hit_band=true;
-      bool upok=(DYN_simmatrix[(irow-1)*mll+jcol]+AL_mpcache_dyn_score_gap==DYN_simmatrix[irow*mll+jcol]);
-
-      // This is a special rule for strobe sequencing
-      // If a stretch of 'N' occurs and there's the choice between
-      //  a match and a gap, choose gap
-      // this prevents things like:
-      //    ..nnnnnnnaaaaaaaaat.....
-      //    ..nnnnnnn*****nnnnt.....
-      // and make it
-      //    ..nnnnnnnaaaaaaaaat.....
-      //    ..nn*****nnnnnnnnnt.....
-      //
-      // i.e., align gaps to N
-
-      // BaCh 21.04.2010: not that good this idea.
-      // - new PacBio dark strobe editing strategy doesn't need this
-      // - no directly visible improvement
-      // -> remove.
-      //if(*AL_seq1ptr=='N'
-      //   && *AL_seq2ptr=='N'
-      //   && diagok
-      //   && (leftok || upok)){
-      //  diagok=false;
-      //}
-
-      // prevent
-      //    ..cccctccaccgaatgcctaa
-      //    ..cccctcc****a-----------------
-      // and make it
-      //    ..cccctccaccgaatgcctaa
-      //    ..cccctcca****-----------------
-
-      if(hadn
-	 && diagok
-	 && (leftok || upok)){
-	diagok=false;
-      }
+    int32 vgl=DYN_match_matrix[static_cast<uint8>(*AL_seq1ptr)][static_cast<uint8>(*AL_seq2ptr)];
+
+    CEBUG("vgl: " << vgl << endl);
+    
+    // precompute possibilities, optimised for memory access
+    // at the same time, check whether we hit a band limit
+    if(DYN_simmatrix[i*mll+j-1]==DYN_BANDLIMIT) AL_error_hit_band=true;
+    bool leftok=(DYN_simmatrix[i*mll+j-1]+AL_mpcache_dyn_score_gap==DYN_simmatrix[i*mll+j]);
+    bool diagok=(DYN_simmatrix[(i-1)*mll+j-1]+vgl==DYN_simmatrix[i*mll+j]);
+    if(DYN_simmatrix[(i-1)*mll+j]==DYN_BANDLIMIT) AL_error_hit_band=true;
+    bool upok=(DYN_simmatrix[(i-1)*mll+j]+AL_mpcache_dyn_score_gap==DYN_simmatrix[i*mll+j]);
+
+    // This is a special rule for strobe sequencing
+    // If a stretch of 'N' occurs and there's the choice between
+    //  a match and a gap, choose gap
+    // this prevents things like:
+    //    ..nnnnnnnaaaaaaaaat.....
+    //    ..nnnnnnn*****nnnnt.....
+    // and make it 
+    //    ..nnnnnnnaaaaaaaaat.....
+    //    ..nn*****nnnnnnnnnt.....
+    //
+    // i.e., align gaps to N
+
+    // BaCh 21.04.2010: not that good this idea.
+    // - new PacBio dark strobe editing strategy doesn't need this
+    // - no directly visible improvement
+    // -> remove.
+    //if(*AL_seq1ptr=='N'
+    //   && *AL_seq2ptr=='N'
+    //   && diagok
+    //   && (leftok || upok)){
+    //  diagok=false;
+    //}
+
+    // prevent
+    //    ..cccctccaccgaatgcctaa
+    //    ..cccctcc****a-----------------
+    // and make it
+    //    ..cccctccaccgaatgcctaa
+    //    ..cccctcca****-----------------
+
+    if(hadn
+       && diagok
+       && (leftok || upok)){
+      diagok=false;
+    }
+
 
-      // now, look which possibilities we have
-      //  if a diagonal and (up or left) are equal, then take
-      //  the same direction as last time
-      // this prevents things like:
-      //    ..tggaaaaaaaaat.....
-      //    ..t*g*********t.....
-      // and make it
-      //    ..tggaaaaaaaaat.....
-      //    ..tg**********t.....
+    // now, look which possibilities we have
+    //  if a diagonal and (up or left) are equal, then take 
+    //  the same direction as last time
+    // this prevents things like:
+    //    ..tggaaaaaaaaat.....
+    //    ..t*g*********t.....
+    // and make it 
+    //    ..tggaaaaaaaaat.....
+    //    ..tg**********t.....
 
 
-      //if(diagok){
+    //if(diagok){
       if(upok){
 	if(lastdir=='u') {
 	  diagok=false;
@@ -751,47 +646,46 @@ void Align::rAlign(uint32 irow, uint32 jcol, char lastdir, bool hadn)
 	  upok=false;
 	}
       }
-      //}
+    //}
 
-      if(diagok){
+    if(diagok){
 
-	CEBUG("diagonal ...\n");
+      CEBUG("diagonal ...\n");
 
-	AL_alseq1[--AL_allen]=*AL_seq1ptr--;
-	AL_alseq2[AL_allen]=*AL_seq2ptr--;
-	rAlign(irow-1,jcol-1,'d',hasn);
+      AL_alseq1[--AL_allen]=*AL_seq1ptr--;
+      AL_alseq2[AL_allen]=*AL_seq2ptr--;
+      rAlign(i-1,j-1,'d',hasn);
 //	AL_alseq1[AL_allen]='/';
 //	AL_alseq2[AL_allen++]='/';
-	AL_allen++;
-	AL_seq1ptr++;
-	AL_seq2ptr++;
-      }
+      AL_allen++;
+      AL_seq1ptr++;
+      AL_seq2ptr++;
+    }
 
-      if(upok && !AL_error_hit_band){
+    if(upok){
 
-	CEBUG("up ...\n");
+      CEBUG("up ...\n");
 
-	AL_alseq1[--AL_allen]=*AL_seq1ptr--;
-	AL_alseq2[AL_allen]='*';
-	rAlign(irow-1,jcol,'u',hasn);
+      AL_alseq1[--AL_allen]=*AL_seq1ptr--;
+      AL_alseq2[AL_allen]='*';
+      rAlign(i-1,j,'u',hasn);
 //	AL_alseq1[AL_allen]='$';
 //	AL_alseq2[AL_allen++]='$';
-	AL_allen++;
-	AL_seq1ptr++;
-      }
-
-      if(leftok && !AL_error_hit_band){
+      AL_allen++;
+      AL_seq1ptr++;
+    }
+    
+    if(leftok){
 
-	CEBUG("left ...\n");
+      CEBUG("left ...\n");
 
-	AL_alseq1[--AL_allen]='*';
-	AL_alseq2[AL_allen]=*AL_seq2ptr--;
-	rAlign(irow,jcol-1,'l',hasn);
+      AL_alseq1[--AL_allen]='*';
+      AL_alseq2[AL_allen]=*AL_seq2ptr--;
+      rAlign(i,j-1,'l',hasn);
 //	AL_alseq1[AL_allen]='#';
 //	AL_alseq2[AL_allen++]='#';
-	AL_allen++;
-	AL_seq2ptr++;
-      }
+      AL_allen++;
+      AL_seq2ptr++;
     }
   }
 
@@ -803,172 +697,11 @@ void Align::rAlign(uint32 irow, uint32 jcol, char lastdir, bool hadn)
 
 
 
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-void Align::pa_packSeqToRLE(const char * seq, uint32 len, std::string & rles, std::vector<uint32> & rlev, int32 & eoffset)
-{
-  FUNCSTART("void Align::pa_packSeqToRLE(const char * seq, uint32 len, std::string & rles, std::vector<uint32> rlev)");
-
-  rles.clear();
-  rlev.clear();
-
-  uint32 run=0;
-  char runchar=*seq;
-  for(uint32 ri=0; ri<len; ++seq, ++ri){
-    if(*seq==runchar){
-      ++run;
-    }else{
-      rles.push_back(runchar);
-      runchar=*seq;
-      rlev.push_back(run);
-      run=1;
-    }
-    if(static_cast<int32>(ri)==eoffset) eoffset=static_cast<uint32>(rles.size());
-  }
-  rles.push_back(runchar);
-  rlev.push_back(run);
-}
-
-
-/*************************************************************************
- *
- * Transform packed RLE alignment
- *    s1        AAACGTC
- *    s2        AAA**TC
- * to (shakedirstdleft==true)
- *    s1        **AAACGTTTC
- *    s2        AAAAA**TTTC
- * or (shakedirstdleft==false)
- *    s1        AAA**CGTTTC
- *    s2        AAAAA**TTTC
- *
- * according to RLE values stored for reads
- *
- *************************************************************************/
-
-void Align::ra_expandRLEAlignments(const char * s1, const char * s2, bool shakedirstdleft)
-{
-  FUNCSTART("void Align::ra_expandRLEAlignments(const char * s1, const char * s2, bool shakedirstdleft)");
-
-  AL_unrles1.clear();
-  AL_unrles2.clear();
-  auto vs1I=AL_rlev1.cbegin();
-  auto vs2I=AL_rlev2.cbegin();
-  for(; *s1 ; ++s1, ++s2){
-    uint32 lens1=1;
-    uint32 lens2=1;
-    if(*s1==' '){
-      if(*s2!='*'){
-	lens2=*vs2I;
-	++vs2I;
-      }
-      lens1=lens2;
-    }else if(*s2==' '){
-      if(*s1!='*'){
-	lens1=*vs1I;
-	++vs1I;
-      }
-      lens2=lens1;
-    }else{
-      if(*s1!='*'){
-	lens1=*vs1I;
-	++vs1I;
-      }
-      if(*s2!='*'){
-	lens2=*vs2I;
-	++vs2I;
-      }
-    }
-    uint32 maxlen=max(lens1,lens2);
-    uint32 run=0;
-    if(shakedirstdleft){
-      for(; run<maxlen-lens1; ++run) AL_unrles1.push_back('*');
-      for(; run<maxlen; ++run) AL_unrles1.push_back(*s1);
-      run=0;
-      for(; run<maxlen-lens2; ++run) AL_unrles2.push_back('*');
-      for(; run<maxlen; ++run) AL_unrles2.push_back(*s2);
-    }else{
-      for(; run<lens1; ++run) AL_unrles1.push_back(*s1);
-      for(; run<maxlen; ++run) AL_unrles1.push_back('*');
-      run=0;
-      for(; run<lens2; ++run) AL_unrles2.push_back(*s2);
-      for(; run<maxlen; ++run) AL_unrles2.push_back('*');
-    }
-  }
-  BUGIFTHROW(vs1I!=AL_rlev1.cend(),"vs1I!=AL_rlev1.cend()");
-  BUGIFTHROW(vs2I!=AL_rlev2.cend(),"vs2I!=AL_rlev2.cend()");
-}
-
-/*************************************************************************
- *
- * Transform
- *    s1        AAA**CGT
- *    s2        AAAAA**T
- * to
- *    s1        AAACGT
- *    s2        AAAAAT
- *
- * Really? Not sure I want that for PacBio.
- *
- *************************************************************************/
-
-/*
-void Align::ra_fitRLEIndents()
-{
-}
-//*/
-
 void Align::coutWhatWasGiven()
 {
   Dynamic::coutWhatWasGiven();
 
-  cout << "Align\n------"
-       << "\nAL_id1: " << AL_id1
-       << "\nAL_id2: " << AL_id2
-       << "\nAL_id1dir: " << static_cast<int16>(AL_id1dir)
-       << "\nAL_id2dir: " << static_cast<int16>(AL_id2dir)
-       << endl;
-}
+  cout << "Align\n------\n";
 
-
-void Align::resetTimings()
-{
-  DYN_timing_seqcopy=0;
-  DYN_timing_bswmatrix=0;
-  DYN_timing_bswm_setup=0;
-  DYN_timing_bswm_p1=0;
-  DYN_timing_bswm_p2a=0;
-  DYN_timing_bswm_p2b=0;
-  DYN_timing_bswm_p3=0;
-  DYN_timing_bswm_cleanband=0;
-  AL_timing_acquires=0;
-  AL_timing_fullalign=0;
-  AL_timing_prepalign=0;
-  AL_timing_raligntot=0;
-  AL_timing_ra_adsacquire=0;
-  AL_timing_ra_adslist=0;
 }
 
-void Align::dumpTimings()
-{
-  cout << "Align timing DYN seqcpy : " << DYN_timing_seqcopy << endl;
-  cout << "Align timing DYN bsw su : " << DYN_timing_bswm_setup << endl;
-  cout << "Align timing DYN bsw p1 : " << DYN_timing_bswm_p1 << endl;
-  cout << "Align timing DYN bsw p2a: " << DYN_timing_bswm_p2a << endl;
-  cout << "Align timing DYN bsw p2b: " << DYN_timing_bswm_p2b << endl;
-  cout << "Align timing DYN bsw p3 : " << DYN_timing_bswm_p3 << endl;
-  cout << "Align timing DYN bsw cb : " << DYN_timing_bswm_cleanband << endl;
-
-  cout << "Align timing DYN bsw    : " << DYN_timing_bswmatrix << endl;
-  cout << "Align timing AL acqu s  : " << AL_timing_acquires << endl;
-  cout << "Align timing AL full    : " << AL_timing_fullalign << endl;
-  cout << "Align timing AL prep    : " << AL_timing_prepalign << endl;
-  cout << "Align timing AL ralignt : " << AL_timing_raligntot << endl;
-  cout << "Align timing AL ralignc : " << AL_timing_raligntot-AL_timing_ra_adsacquire-AL_timing_ra_adslist << endl;
-  cout << "Align timing AL ads a   : " << AL_timing_ra_adsacquire << endl;
-  cout << "Align timing AL ads s   : " << AL_timing_ra_adslist << endl;
-}
diff --git a/src/mira/align.H b/src/mira/align.H
index b503c84..c3def9e 100644
--- a/src/mira/align.H
+++ b/src/mira/align.H
@@ -11,33 +11,32 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
+// 	$Id$	
+
 #ifndef _bas_align_h_
 #define _bas_align_h_
 
 #include <iostream>
 
-#include <list>
-
 #include "stdinc/defines.H"
 #include "stdinc/stlincludes.H"
 
 #include "mira/parameters.H"
 #include "mira/dynamic.H"
-
-class AlignedDualSeq;
+#include "mira/ads.H"
 
 
 class Align : public Dynamic
@@ -56,7 +55,7 @@ private:
 				   the instance  */
   char * AL_alseq2;		// dito for the second sequence
 
-  uint32 AL_as12size;           // size of alseq1 / alseq2 array
+  int32  AL_as12size;           // size of alseq1 / alseq2 array
 
   char * AL_seq1ptr;		// ptr for the actual position in seq 1
   char * AL_seq2ptr;		// dito for sequence 2
@@ -71,14 +70,14 @@ private:
 				   =len(seq1)+len(seq2)  */
 
   uint8  AL_new_solution;
-
+  
   bool   AL_error_hit_band;     /* true if traceback hit band in matrix,
 				   bandwidth should be increased */
 
   uint32 AL_cutoff_counter;	// failsafe counter for stopping calc
-
+  
   AlignedDualSeq       * AL_tmpads;
-  std::list<AlignedDualSeq> * AL_adslist;
+  list<AlignedDualSeq> * AL_adslist;
 
   // cached parameters from MIRAPARAMS so that rAlign doesn't need to
   //  get pointers to MIRAPARAMS every time
@@ -98,34 +97,6 @@ private:
   uint32 AL_mpset_al_min_overlap;
   uint32 AL_mpset_al_min_relscore;
 
-  // rAlign stores here the minimum distance it was away from left/right band
-  // can be used to optimise alignment of very long sequences (PacBio)
-  //  in later recalculations if this info is somehow stored
-  // It's passed on to the AlignedDualSeq object for every alignment found
-  int32 AL_minbanddistance;
-
-
-  // RLE
-  bool AL_userle;
-  bool AL_rle_create_packed_align;
-  bool AL_rle_create_stdleft_align;
-  bool AL_rle_create_nonstdright_align;
-
-  std::string         AL_rles1;    // space for packed seq1
-  std::string         AL_rles2;    // space for packed seq2
-  std::vector<uint32> AL_rlev1;    // rle values s1
-  std::vector<uint32> AL_rlev2;    // rle values s2
-  std::string         AL_unrles1;    // space for unpacked alignment of seq1
-  std::string         AL_unrles2;    // space for unpacked alignment of seq2
-
-  // Timing checks
-  suseconds_t AL_timing_acquires;
-  suseconds_t AL_timing_fullalign;
-  suseconds_t AL_timing_prepalign;
-  suseconds_t AL_timing_raligntot;
-  suseconds_t AL_timing_ra_adsacquire;
-  suseconds_t AL_timing_ra_adslist;
-
 public:
   uint32 AL_no_solutions;       // number of alignment solutions found
   uint32 AL_no_diff_solutions;	// where no # these have different starting
@@ -141,23 +112,25 @@ private:
   void init();
   void termAlign();
   void rAlign(uint32 i, uint32 j, char lastdir, bool hadn);
-  void prepareAlign(std::list<AlignedDualSeq> * adslist);
+  void prepareAlign(list<AlignedDualSeq> * adslist);
   void setRAlignParams();
 
-  void pa_packSeqToRLE(const char * seq,
-		       uint32 len,
-		       std::string & rles,
-		       std::vector<uint32> & rlev,
-		       int32 & eoffset);
-  void ra_expandRLEAlignments(const char * s1, const char * s2, bool shakedirstdleft);
-
-
 public:
   Align(MIRAParameters * params);
+  Align(MIRAParameters * params, 
+	const char * seq1, 
+	uint32 len1, 
+	const char * seq2,
+	uint32 len2, 
+	int32 id1,
+	int32 id2,
+	int8 id1dir,
+	int8 id2dir,
+	bool calcwithoffset=true,
+	int32 expectedoffset=0);
   ~Align();
 
   void discard();
-  inline void setUseRLE(bool b) {AL_userle=b;}
   void acquireSequences(const char * seq1,
 			uint32 len1,
 			const char * seq2,
@@ -172,17 +145,13 @@ public:
   void useSpecialMinOverlap(uint32 a) {AL_mpset_al_min_overlap=a;}
   void useSpecialMinRelScore(uint32 a) {AL_mpset_al_min_relscore=a;}
 
-  void simpleAlign(std::list<AlignedDualSeq> * adslist, bool enforce_clean_ends, bool dontpenalisengaps);
-  void fullAlign(std::list<AlignedDualSeq> * adslist, bool enforce_clean_ends, bool dontpenalisengaps);
-
+  void simpleAlign(list<AlignedDualSeq> * adslist, bool enforce_clean_ends, bool dontpenalisengaps);
+  void fullAlign(list<AlignedDualSeq> * adslist, bool enforce_clean_ends, bool dontpenalisengaps);
   bool wasBandHit() const {return AL_error_hit_band;}
 
-  void MONITOR() {std::cout << "MONITOR: " << DYN_simmatrix << std::endl;}
+  void MONITOR() {cout << "MONITOR: " << DYN_simmatrix << endl;}
 
   void coutWhatWasGiven();
-
-  void dumpTimings();
-  void resetTimings();
 };
 
 
diff --git a/src/mira/assembly.C b/src/mira/assembly.C
index 6f3bd96..fe461c6 100644
--- a/src/mira/assembly.C
+++ b/src/mira/assembly.C
@@ -11,50 +11,74 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
+// 	$Id$	
 
-#include "assembly.H"
 
-#include "util/machineinfo.H"
+#ifndef lint
+static char vcid[] = "$Id$";
+#endif /* lint */
 
-#include "mira/align.H"
 
-// BOOST
-#include <boost/algorithm/string.hpp>
-#include <boost/filesystem.hpp>
+#include "assembly.H"
 
+// MIRA uses sleep(3)
+#include <unistd.h>
 
-#include <cstdlib>
+// MIRA uses stat (2)
+#include <sys/types.h>
+#include <sys/stat.h>
+
+// for perror (3C) and some routines that use the quick C I/O
+//  instead of the dog slow C++ streams
 #include <cstdio>
+//we use errno
+#include <errno.h>
 
+// for getting username etc
+#include <pwd.h>
 
+// for time measurements
+#include <sys/times.h>
+#include <sys/time.h>
+#include <limits.h>
+#include <unistd.h>
+
+// BOOST
+#include <boost/algorithm/string.hpp> 
+
+// for checking time restrictions
+#include <time.h>
+#include "mira/timerestrict.H"
+
+#include "errorhandling/errorhandling.H"
+#include "mira/dynamic.H"
+#include "mira/ads.H"
+#include "util/progressindic.H"
+#include "util/dptools.H"
+#include "util/misc.H"
+#include "caf/caf.H"
+#include "mira/structs.H"
+#include "mira/contig.H"
 
-#ifdef MIRAMEMORC
-#include "memorc/memorc.H"
-#endif
 
 #if 0
 #include <valgrind/memcheck.h>
 #define VALGRIND_LEAKCHECK
 #endif
 
-
-using namespace std;
-
-#define CEBUG(bla)
-
 // cs1 for normal clocking ('user compatible' as is does not disturb)
 //  cs2 for extensive clocking output, more for analysis of MIRA behaviour
 //  during development
@@ -65,9 +89,20 @@ using namespace std;
 #define CLOCK_STEPS2
 
 
+#if DEVELOPMENTVERSION != 0 
 //#define TRACKMEMUSAGE 1
 #define TRACKMEMUSAGE 0
+#else
+#define TRACKMEMUSAGE 0
+#endif
+
 
+//#define FUNCSTART(bla)  static const char * THISFUNC = bla"  "; {cout << THISFUNC << "enter.\n"; cout.flush();}
+//#define FUNCTRACE(bla) { cout << THISFUNC << bla; cout.flush();}
+//#define FUNCEND() {cout << THISFUNC << "exit.\n"; cout.flush();}
+//
+//#define CEBUG(bla)
+//#define CEBUGF(bla)
 
 
 
@@ -88,17 +123,22 @@ void Assembly::test()
 }
 
 
+void Assembly::foolCompiler()
+{
+#include "stdinc/foolcompiler.C"
+}
+
+
 /*************************************************************************
  *
  *
  *
  *************************************************************************/
 
-Assembly::Assembly(Manifest & manifest, vector<MIRAParameters> & params, bool resumeassembly): AS_dataprocessing(&params)
+Assembly::Assembly(vector<MIRAParameters> & params, bool resumeassembly): AS_readpool(&params)
 {
   FUNCSTART("Assembly::Assembly(MIRAParameters * params)");
 
-  AS_manifest=manifest;
   AS_miraparams=params;
   AS_resumeasembly=resumeassembly;
 
@@ -110,31 +150,23 @@ Assembly::Assembly(Manifest & manifest, vector<MIRAParameters> & params, bool re
 
   setExtendedLog(AS_miraparams[0].getSpecialParams().mi_extended_log);
 
-  // For resuming assemblies
-  if(resumeassembly){
-    if(!dirExists(AS_miraparams[0].getDirectoryParams().dir_top)){
-      MIRANOTIFY(Notify::FATAL,"Could not not find directory " << AS_miraparams[0].getDirectoryParams().dir_top << " while trying to resume the assembly. If you intended to start a new assembly, do not use '-r' (resume) when starting MIRA.");
-    }
-    if(!dirExists(AS_miraparams[0].getDirectoryParams().dir_checkpoint)){
-      MIRANOTIFY(Notify::FATAL,"Could not not find directory " << AS_miraparams[0].getDirectoryParams().dir_checkpoint << " while trying to resume the assembly. Resuming is impossible, sorry.");
-    }
-    // do purge the results directory!
-    if(ensureDirectory(AS_miraparams[0].getDirectoryParams().dir_results, true)){
-      MIRANOTIFY(Notify::FATAL,"Could not delete and recreate results directory while trying to resume an assembly?");
+  // honour user supplied working directory
+  // will probably already be done by the parameter parsing already, but just in case
+  //  this was done programatically ...
+  if(!AS_miraparams[0].getDirectoryParams().dir_cwd.empty()){
+    int ret=chdir(AS_miraparams[0].getDirectoryParams().dir_cwd.c_str());
+    if(ret){
+      MIRANOTIFY(Notify::FATAL,"Changing working directory to '" << AS_miraparams[0].getDirectoryParams().dir_cwd << "' failed, system message is: " << strerror(errno) << endl);
     }
   }
-
-  // purge the the remaining directories (if we're not resuming)
+  // purge the directories if we're not resuming
   ensureStandardDirectories(!resumeassembly);
 
-  // after ensureStandardDirectories() as usually located in info directory
-  AS_warnings.setOutputPath(AS_miraparams[0].getDirectoryParams().dir_info+"/"+AS_miraparams[0].getAssemblyParams().as_outfile_stats_warnings);
-
   setContigBuiltCallback();
 
   AS_assemblyinfo.setLargeContigSize(500);
 
-  AS_systemmemory=MachineInfo::getMemTotal();
+  AS_systemmemory=grepMemSizeFromProcFS("/proc/meminfo","MemTotal:");
 
   //makeTmpDir();
 
@@ -156,9 +188,8 @@ void Assembly::init()
     AS_steps[i]=0;
   }
 
-  AS_tmptag_CRMr=Read::REA_defaulttag_CRMr;
-
   // initialise some other variables
+
   zeroVars();
 }
 
@@ -176,12 +207,10 @@ void Assembly::zeroVars()
   AS_numADSFacts_fromalignments=0;
   AS_numADSFacts_fromshreds=0;
   AS_seqtypespresent.clear();
-  AS_hasbackbones=false;
-
-  AS_hashstat_avghashfreq=0;
+  AS_454dosimpleedit=false;
+  AS_needsskimfornastyrepeats=false;
 
   AS_doneskimchimera=false;
-  AS_resumeisok=false;
 
 #ifdef TIMERESTRICTED
   AS_timesup=false;
@@ -189,10 +218,6 @@ void Assembly::zeroVars()
 
   AS_shouldrun_nfs_check=true;
 
-  AS_coveragetotal=0;
-
-  AS_everythingwentfine=false;
-
   //TODO: rest
 }
 
@@ -212,16 +237,16 @@ Assembly::~Assembly()
 
   dumpMemInfo();
 
-  AS_warnings.dumpWarnings();
-
-  cout << "Dynamic s allocs: " << Dynamic::DYN_alloccounts << endl;
-  cout << "Dynamic m allocs: " << Dynamic::DYN_alloccountm << endl;
+  cout << "Dynamic allocs: " << Dynamic::DYN_alloccount << endl;
   cout << "Align allocs: " << Align::AL_alloccount << endl;
 
   discard();
-
-  if(AS_everythingwentfine && AS_miraparams[0].getAssemblyParams().as_output_removetmpdir){
-    removeDirectory(AS_miraparams[0].getDirectoryParams().dir_tmp,false,false);
+  
+  if(AS_miraparams[0].getAssemblyParams().as_output_removetmpdir){
+    string system_rmdir = static_cast<string>("rm -rf ")+AS_miraparams[0].getDirectoryParams().dir_tmp;
+    int tmp=system(system_rmdir.c_str()); 
+    // don't complain about unused variable
+    (void) tmp;
   }
 
   // TODO: scandir on result and remove all if no results?
@@ -307,7 +332,7 @@ void Assembly::dmi_dumpALine(ostream & ostr, const char * desc, size_t numelem,
     ostr << setw(12) << ostrstr.str();
   }
 
-  ostr << endl;
+  ostr << '\n';
 }
 
 
@@ -353,7 +378,7 @@ void Assembly::dumpMemInfo()
   dumpFile("/proc/self/status",cout);
 
   cout << "\nInformation on current assembly object:\n\n";
-
+  
   cout << "AS_readpool: " << AS_readpool.size() << " reads.\n";
   cout << "AS_contigs: " << AS_contigs.size() << " contigs.\n";
   cout << "AS_bbcontigs: " << AS_bbcontigs.size() << " contigs.\n";
@@ -363,7 +388,7 @@ void Assembly::dumpMemInfo()
   byteToHumanReadableSize(static_cast<double>(bytes_size), cout);
   cout << ")\n\nMemory used in assembly structures:\n"
        << setw(52) << "Eff. Size" << setw(12) << "Free cap." << setw(12) << "LostByAlign" << endl;
-
+  
 
   tmp_bytes_size=estimateMemoryUsageOfContainer(AS_writtenskimhitsperid,true,tmp_numelem,tmp_bytes_size,tmp_freecapacity,tmp_lostbyalign);
   dmi_dumpALine(cout,"AS_writtenskimhitsperid: ",tmp_numelem,tmp_bytes_size,tmp_freecapacity,tmp_lostbyalign);
@@ -421,8 +446,8 @@ void Assembly::dumpMemInfo()
   dmi_dumpALine(cout,"AS_maxcoveragereached: ",tmp_numelem,tmp_bytes_size,tmp_freecapacity,tmp_lostbyalign);
   bytes_size+=tmp_bytes_size;
 
-  tmp_bytes_size=estimateMemoryUsageOfContainer(AS_coverageperseqtype,true,tmp_numelem,tmp_bytes_size,tmp_freecapacity,tmp_lostbyalign);
-  dmi_dumpALine(cout,"AS_coverageperseqtype: ",tmp_numelem,tmp_bytes_size,tmp_freecapacity,tmp_lostbyalign);
+  tmp_bytes_size=estimateMemoryUsageOfContainer(AS_coverageperseqtype,true,tmp_numelem,tmp_bytes_size,tmp_freecapacity,tmp_lostbyalign);   
+  dmi_dumpALine(cout,"AS_coverageperseqtype: ",tmp_numelem,tmp_bytes_size,tmp_freecapacity,tmp_lostbyalign);   
   bytes_size+=tmp_bytes_size;
 
   tmp_bytes_size=estimateMemoryUsageOfContainer(AS_istroublemaker,true,tmp_numelem,tmp_bytes_size,tmp_freecapacity,tmp_lostbyalign);
@@ -481,10 +506,6 @@ void Assembly::dumpMemInfo()
   dmi_dumpALine(cout,"AS_skimrightextendratio: ",tmp_numelem,tmp_bytes_size,tmp_freecapacity,tmp_lostbyalign);
   bytes_size+=tmp_bytes_size;
 
-  tmp_bytes_size=estimateMemoryUsageOfContainer(AS_skimmegahubs,true,tmp_numelem,tmp_bytes_size,tmp_freecapacity,tmp_lostbyalign);
-  dmi_dumpALine(cout,"AS_skimmegahubs: ",tmp_numelem,tmp_bytes_size,tmp_freecapacity,tmp_lostbyalign);
-  bytes_size+=tmp_bytes_size;
-
   tmp_bytes_size=estimateMemoryUsageOfContainer(AS_usedtmpfiles,true,tmp_numelem,tmp_bytes_size,tmp_freecapacity,tmp_lostbyalign);
   dmi_dumpALine(cout,"AS_usedtmpfiles: ",tmp_numelem,tmp_bytes_size,tmp_freecapacity,tmp_lostbyalign);
   bytes_size+=tmp_bytes_size;
@@ -518,8 +539,6 @@ uint32 Assembly::cleanupOldFile(const string & basename, const string & filename
 
   CEBUG("\nCOF: ###" << basename << "### and ###"<<filename<<"###\n");
 
-  boost::system::error_code ec;
-
   uint32 numdeleted=0;
   list<usedtmpfiles_t>::iterator ulfI=AS_usedtmpfiles.begin();
   while(ulfI != AS_usedtmpfiles.end()){
@@ -535,15 +554,47 @@ uint32 Assembly::cleanupOldFile(const string & basename, const string & filename
       if(numdeleted>100) {
 	cerr << "\n\nOUCH! something strange ... tried more than 100 deletes of " << basename << " ... list size is " << AS_usedtmpfiles.size() << '\n';
       }
-      if(numdeleted>1200) {
-	cerr << "\n\nOUCH! something weird ... tried more than 1200 deletes of " << basename << " ... list size is " << AS_usedtmpfiles.size() << '\n';
+      if(numdeleted>120) {
+	cerr << "\n\nOUCH! something wierd ... tried more than 120 deletes of " << basename << " ... list size is " << AS_usedtmpfiles.size() << '\n';
 	cerr << "We'll stop that here.\n";
 	return numdeleted;
       }
 
-      fileRemove(ulfI->filename,true);
+      /* 
+
+      string system_rmfile = static_cast<string>("rm -f ")+ulfI->filename;
+
+      //cout << "RMFILE: " << system_rmfile << endl;
+
+      // on my system at home, the delete sometime fails for no apparent
+      //  reason at all (file can be removed later by hand without
+      //  problem etc.)
+      // as I've also had this report once from another system, I'll put
+      //  the system call in a loop with 10 tries, always waiting a
+      //  second between each try
+
+      bool filestillthere=true;
+      for(uint32 i=0; i<10 && filestillthere; i++){
+	filestillthere=system(system_rmfile.c_str());
+	if(filestillthere) sleep(1);
+      }
+      */
+
+      // Let's try something different ... using remove() and the rm -rf system call
+      int filestillthere=1;
+      string system_rmfile = static_cast<string>("rm -f ")+ulfI->filename;
+      for(uint32 i=0; i<10 && filestillthere; i++){
+	CEBUG("COF: removing with remove: " << ulfI->filename.c_str() << endl);
+	filestillthere=remove(ulfI->filename.c_str());
+	if(filestillthere) {
+	  int errsv=errno;
+	  cout << "Errno: " << errsv << endl;
+	  filestillthere=system(system_rmfile.c_str());
+	  if(filestillthere) sleep(1);
+	}
+      }
 
-      if(boost::filesystem::exists(ulfI->filename,ec)){
+      if(filestillthere) {
 	cerr << "WARNING: Could not delete old file " + ulfI->filename
 	     << "\nThis can have a number of different reasons, none of them"
 	     << "\nwarranting an abort, but this is strange anyway.\n\n";
@@ -637,67 +688,32 @@ string Assembly::buildFileName(int32 version, const string & prefix, const strin
 void Assembly::ensureStandardDirectories(bool purge){
   FUNCSTART("void Assembly::ensureStandardDirectories(bool purge)");
 
-  auto & dparams = AS_miraparams[0].getNonConstDirectoryParams();
-
-  string existingtmpdir;
-  // special purge logic to handle eventually existing symlinks to -DI:trt
-  if(!dparams.dir_tmp_symlink.empty()
-     && boost::filesystem::exists(dparams.dir_tmp_symlink)
-     && boost::filesystem::is_symlink(dparams.dir_tmp_symlink)){
-    existingtmpdir=boost::filesystem::read_symlink(dparams.dir_tmp_symlink).string();
-  }else if(boost::filesystem::exists(dparams.dir_tmp)
-	   && boost::filesystem::is_symlink(dparams.dir_tmp)){
-    existingtmpdir=boost::filesystem::read_symlink(dparams.dir_tmp).string();
-  }
-  if(purge
-     && !existingtmpdir.empty()){
-    boost::filesystem::remove_all(existingtmpdir);
-    existingtmpdir.clear();
-  }
-
-  // make sure the main directories exist or are created
-  if(ensureDirectory(dparams.dir_top, purge, true, false)
-     || ensureDirectory(dparams.dir_results, purge, true, false)
-     || ensureDirectory(dparams.dir_info, purge, true, false)
-     || ensureDirectory(dparams.dir_checkpoint, purge, true, false)){
+  if(ensureDirectory(AS_miraparams[0].getDirectoryParams().dir_top, purge)
+     || ensureDirectory(AS_miraparams[0].getDirectoryParams().dir_tmp, purge)
+     || ensureDirectory(AS_miraparams[0].getDirectoryParams().dir_results, purge)
+     || ensureDirectory(AS_miraparams[0].getDirectoryParams().dir_info, purge)
+     || ensureDirectory(AS_miraparams[0].getDirectoryParams().dir_checkpoint, purge)){
 
-    MIRANOTIFY(Notify::FATAL, "Could not make sure that a needed directory exists (see log above for more info), aborting MIRA.");
+    MIRANOTIFY(Notify::FATAL, "Could not make sure that a needed directory exists, aborting MIRA.");
   }
 
-  // make sure the tmp directory exists or is created
-  // either as directory or as symlinked directory (-DI:trt=...)
-  if(dparams.dir_tmp_symlink.empty()){
-    if(ensureDirectory(dparams.dir_tmp, purge, true, false)){
-      MIRANOTIFY(Notify::FATAL, "Could not make sure that the MIRA tmp directory exists, aborting.");
-    }
-  }else{
-    if(!existingtmpdir.empty() && !boost::filesystem::is_directory(existingtmpdir)){
-      // existing ist not a directory??? Should be very, very ... very rare
-      // but if yes, let's purge it
-      boost::filesystem::remove_all(existingtmpdir);
-      existingtmpdir.clear();
-    }
-    if(existingtmpdir.empty()){
-      existingtmpdir=dparams.dir_tmp+"_XXXXXX";
-      auto * ptr=mkdtemp(const_cast<char *>(existingtmpdir.c_str()));
-      if(ptr==nullptr){
-	perror(static_cast<string>("Could not create directory for temporary MIRA data "+existingtmpdir).c_str());
-      }
-      // contrary to what "man mkdtemp" may lead to believe, mkdtemp() does not return NULL (failure)
-      //  if given a path to a non-existing directory ("/bla/bla_XXXXXX")
-      // need to check ourselves
-      if(!boost::filesystem::exists(existingtmpdir)){
-	MIRANOTIFY(Notify::FATAL, "Could not create MIRA tmp directory \"" << existingtmpdir << "\": is some part of the path not existing or access protected?");
-      }
-    }
-
-    dparams.dir_tmp=existingtmpdir;
-
-    if(!boost::filesystem::exists(dparams.dir_tmp_symlink)){
-      boost::filesystem::create_symlink(dparams.dir_tmp,dparams.dir_tmp_symlink);
+  if(AS_miraparams[0].getDirectoryParams().dir_tmp_symlink.size()){
+    struct stat st;
+    int rc=lstat(AS_miraparams[0].getDirectoryParams().dir_tmp_symlink.c_str(),&st);
+
+    if(rc){
+      string system_lntmp = 
+	static_cast<string>("ln -s ")
+	+AS_miraparams[0].getDirectoryParams().dir_tmp
+	+" "
+	+AS_miraparams[0].getDirectoryParams().dir_tmp_symlink;
+      
+      //cout << "LINKING: " << system_lntmp << endl;
+      
+      if(system(system_lntmp.c_str())) {
+	perror((static_cast<string>("Could not link "+AS_miraparams[0].getDirectoryParams().dir_tmp_symlink+" to "+AS_miraparams[0].getDirectoryParams().dir_tmp)).c_str()) ;
+      } 
     }
-
-    cout << "Symlink " << dparams.dir_tmp_symlink << " now pointing to " << dparams.dir_tmp << endl;;
   }
 
   checkForNFSMountOnTmpDir();
@@ -719,31 +735,40 @@ void Assembly::checkForNFSMountOnTmpDir()
 
   if(!AS_shouldrun_nfs_check) return;
 
-  auto res=checkForNFSMountOnDirectory(AS_miraparams[0].getDirectoryParams().dir_tmp, true);
+  string cmd="stat -f -L -c %T " + AS_miraparams[0].getDirectoryParams().dir_tmp;
+  string result;
 
   cout << '\n';
-  if(res==0){
-    cout << "Tmp directory is not on a NFS mount, good.\n\n";
-  }else if(res==1){
-    cout << "\nMake sure " << AS_miraparams[0].getDirectoryParams().dir_tmp
-	 << " is *NOT* on a NFS mount or else MIRA will run *very* slowly.\n";
-  }else{
-    cout << "\n\n\n\n\nWARNING WARNING WARNING!\n\n"
-      "It looks like the directory MIRA uses for temporary files\n    " << AS_miraparams[0].getDirectoryParams().dir_tmp <<
-      "\nis on a NFS (Network File System) mount. This will slow down MIRA *considerably*\n"
-      "... by about a factor of 10!\n\n"
-      "If you don't want that, you have three possibilities:\n\n"
-      "1) RECOMMENDED! Use -DI:trt to redirect the tmp directory somewhere else on a\n"
-      "   local disk or even SSD.\n"
-      "2) ALSO POSSIBLE: put the whole project somewhere else on your file system.\n"
-      "3) ABSOLUTELY NOT RECOMMENDED AT ALL: use \"-NW:cnfs=warn\" to tell MIRA not\n"
-      "   to stop when it finds the tmp directory on NFS.\n\n"
-      "If you do not know what NFS is and which directory to use in \"-DI:trt\", ask\n"
-      "your local system administrator to guide you.\n\n";
-
-    if(AS_miraparams[0].getNagAndWarnParams().nw_check_nfs==NWSTOP){
-      MIRANOTIFY(Notify::FATAL,"Tmp directory is on a NFS mount ... but we don't want that.");
+  if(checkRunabilityOfCommand(cmd) && getSTDOUTFromCommand(cmd,result)){
+    //cout << "result from NFS check: " << result << endl;
+    boost::to_lower(result);
+    if(boost::find_first(result,"nfs")){
+      cout << "\n\n\n\n\nWARNING WARNING WARNING!\n\n"
+	"It looks like the tmp directory is on a NFS (Network File System) mount. This\n"
+	"will slow down MIRA *considerably* ... by about a factor of 10!\n"
+	"If you don't want that, you have three possibilities:\n\n"
+	"1) RECOMMENDED! Use -DI:trt to redirect the tmp directory somewhere else on a\n"
+	"   local disk or even SSD.\n"
+	"2) POSSIBLE: put the whole project somewhere else and restart MIRA.\n"
+	"3) ABSOLUTELY NOT RECOMMENDED AT ALL: use \"-MI:sonfs=no\" to tell MIRA not\n"
+	"   to stop when it finds the tmp directory on NFS.\n\n"
+	"If you do not know what NFS is and which directory to use in \"-DI:trt\", ask\n"
+	"your local system administrator to guide you.\n\n";
+
+      if(AS_miraparams[0].getSpecialParams().mi_stop_on_nfs){
+	MIRANOTIFY(Notify::FATAL,"Tmp directory is on a NFS mount ... but we don't want that.");
+      }
+    }else{
+      cout << "Tmp directory is not on a NFS mount, good.\n\n";
     }
+  }else{
+    cout << "Could not perform NFS check for directory " 
+	 <<  AS_miraparams[0].getDirectoryParams().dir_tmp
+	 << "\nMake sure it is *NOT* on a NFS mount or else MIRA will run *very* slowly.\n"
+      "\nFor a check to run smoothly, please make sure the Unix 'stat' command is available"
+      "\nand understands the following call: " << cmd 
+	 << "\nNote that this might not be the case on BSD systems and derivatives (e.g. MacOSX),"
+      "\nin which case no check for NFS is possible.\n\n";
   }
 
   AS_shouldrun_nfs_check=false;
@@ -764,12 +789,12 @@ void Assembly::preassembleTasks(bool usereadextension, bool clipvectorleftovers)
 {
   assembly_parameters const & as_fixparams= AS_miraparams[0].getAssemblyParams();
 
-  {
+  if(as_fixparams.as_clip_proposeendclips){
     string tmpfname;
-    tmpfname=buildFileName(0,"","",
+    tmpfname=buildFileName(0,"","", 
 			  as_fixparams.as_tmpf_clippings,
-			   ".txt","",0);
-
+			  ".txt");
+      
     // doing it twice catches a few outliers missed the first time
     string logprefix="proposed cutback 1a: ";
     uint64 numclipped=performNewProposedCutbackClips(tmpfname,logprefix);
@@ -786,20 +811,68 @@ void Assembly::preassembleTasks(bool usereadextension, bool clipvectorleftovers)
 
   //performHashEditing();
 
-#if TRACKMEMUSAGE
+#if TRACKMEMUSAGE 
   cout << "\ndmi pre 00\n";
   dumpMemInfo();
 #endif
+    
+  // find out whether there are SRMr or CRMr tags that need attention
+  bool initialrepeatmarkerspresent=false;
+  for(uint32 i=0; i< AS_readpool.size() && !initialrepeatmarkerspresent; i++){
+    if(AS_readpool[i].isUsedInAssembly()){
+      if(AS_readpool[i].hasTag(Read::REA_tagentry_idSRMr)){
+	initialrepeatmarkerspresent=true;
+      }else if(AS_readpool[i].hasTag(Read::REA_tagentry_idCRMr)){
+	initialrepeatmarkerspresent=true;
+      }
+    }
+  }
 
-  //if(AS_454dosimpleedit) editSimple454Overcalls(0);
+  if(initialrepeatmarkerspresent){
+    performHashAnalysis(0,"","");
+    
+    //performSnapshot(0);
+
+#if TRACKMEMUSAGE 
+    cout << "\ndmi pre 10\n";
+    dumpMemInfo();
+#endif
+
+    cout << "Repeat markers found in data loaded, performing an initial step of marker propagation.\nInitial marker propagation 1/2\n";
+    findPossibleOverlaps(0, "", "_initialRMpropagation");
+      
+#if TRACKMEMUSAGE 
+    cout << "\ndmi pre 20\n";
+    dumpMemInfo();
+#endif
+      
+    AS_steps[ASADSLISTOK]=0;
+    makeAlignments(Assembly::ma_needSRMrOrTwoCRMr, true, false, 0, "", "", "initialRMpropagation1");
+#if TRACKMEMUSAGE 
+    cout << "\ndmi pre 30\n";
+    dumpMemInfo();
+#endif
+      
+    AS_steps[ASADSLISTOK]=0;
+    cout << "Initial marker propagation 2/2\n";
+    makeAlignments(Assembly::ma_needSRMrOrTwoCRMr, true, false, 0, "", "", "initialRMpropagation2");
+    AS_steps[ASADSLISTOK]=0;
+  }
+    
+#if TRACKMEMUSAGE 
+  cout << "\ndmi pre 50\n";
+  dumpMemInfo();
+#endif
 
+  //if(AS_454dosimpleedit) editSimple454Overcalls(0);
+ 
   if(clipvectorleftovers
 	 || (usereadextension && as_fixparams.as_readextension_firstpassnum == 0)){
     cout << "Pre-assembly alignment search for read extension and / or vector clipping:\n";
 
     findPossibleOverlaps(0, "", "_preassembly");
-
-#if TRACKMEMUSAGE
+    
+#if TRACKMEMUSAGE 
     cout << "\ndmi pre 61\n";
     dumpMemInfo();
 #endif
@@ -807,23 +880,24 @@ void Assembly::preassembleTasks(bool usereadextension, bool clipvectorleftovers)
     // do not use the 100% trans rule for read extension and clipping!
     // needed vectors would not get filled
     makeAlignments(Assembly::ma_takeall, false, false, 0, "", "_preassembly1");
-
-#if TRACKMEMUSAGE
+      
+#if TRACKMEMUSAGE 
     cout << "\ndmi pre 62a\n";
     dumpMemInfo();
 #endif
-
-    priv_loadAlignmentsFromFile(0, "", "_preassembly1");
-
-#if TRACKMEMUSAGE
+      
+    loadAlignmentsFromFile(0, "", "_preassembly1");
+      
+#if TRACKMEMUSAGE 
     cout << "\ndmi pre 62b\n";
     dumpMemInfo();
 #endif
-
+      
     if(usereadextension) {
       cout << "Pre-assembly read extension:\n";
       extendADS(0, "", "_preassembly1");
-#if TRACKMEMUSAGE
+      AS_needsskimfornastyrepeats=true;
+#if TRACKMEMUSAGE 
       cout << "\ndmi pre 62c\n";
       dumpMemInfo();
 #endif
@@ -831,58 +905,59 @@ void Assembly::preassembleTasks(bool usereadextension, bool clipvectorleftovers)
     if(clipvectorleftovers) {
       cout << "Pre-assembly vector clipping\n";
       performSeqVectorClippings();
-#if TRACKMEMUSAGE
+      AS_needsskimfornastyrepeats=true;
+#if TRACKMEMUSAGE 
       cout << "\ndmi pre 62d\n";
       dumpMemInfo();
 #endif
     }
-
+      
     dumpSomeStatistics();
-
+      
     // we need to throw away all permbans that might have appeared in
     //  this pre-assembly sequence massage
-
+      
     AS_permanent_overlap_bans.nuke();
     AS_permanent_overlap_bans.resize(AS_readpool.size());
-
-#if TRACKMEMUSAGE
+      
+#if TRACKMEMUSAGE 
     cout << "\ndmi pre 63\n";
     dumpMemInfo();
 #endif
-
-    priv_performHashAnalysis("",false,false, 0, "", "_preassembly2");
-
-#if TRACKMEMUSAGE
+      
+    performHashAnalysis(0, "", "_preassembly2");
+      
+#if TRACKMEMUSAGE 
     cout << "\ndmi pre 64\n";
     dumpMemInfo();
 #endif
-
-    {
+      
+    if(as_fixparams.as_clip_proposeendclips){
       string tmpfname;
-      tmpfname=buildFileName(0,"","",
+      tmpfname=buildFileName(0,"","", 
 			    as_fixparams.as_tmpf_clippings,
-			     ".txt","",false);
-      string logprefix="proposed cutback preassembly: ";
-
+			    ".txt");
+      string logprefix="proposed cutback: ";
+	
       performNewProposedCutbackClips(tmpfname,logprefix);
       dumpSomeStatistics();
-#if TRACKMEMUSAGE
+#if TRACKMEMUSAGE 
       cout << "\ndmi pre 64b\n";
       dumpMemInfo();
 #endif
     }
-
+      
     //nukeSTLContainer(AS_adsfacts);
     //nukeSTLContainer(AS_confirmed_edges);
     AS_adsfacts.clear();
     AS_confirmed_edges.clear();
-
-#if TRACKMEMUSAGE
+      
+#if TRACKMEMUSAGE 
     cout << "\ndmi pre 65a\n";
     dumpMemInfo();
 #endif
 //    findPossibleOverlaps(0, "", "_preassembly2");
-//#if TRACKMEMUSAGE
+//#if TRACKMEMUSAGE 
 //    cout << "\ndmi pre 65b\n";
 //    dumpMemInfo();
 //#endif
@@ -892,146 +967,6 @@ void Assembly::preassembleTasks(bool usereadextension, bool clipvectorleftovers)
 
 /*************************************************************************
  *
- * also determines the pass in which diginorm is applied (if needed)
- *
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush(); }
-void Assembly::priv_setupAutoPasses()
-{
-  auto & ncaparams=AS_miraparams[0].getNonConstAssemblyParams();
-
-  if(!ncaparams.as_bphseries.empty()){
-    cout << "user defined kmer series.\n";
-    ncaparams.as_numpasses=ncaparams.as_bphseries.size();
-  }else{
-    // no bph series setup by user, we need to calc that
-    AS_fixed_rls_bytype=AS_current_rls_bytype;
-    AS_fixed_rls_byrg=AS_current_rls_byrg;
-
-    auto & sparams=AS_miraparams[0].getSkimParams();
-
-    uint64 maxavg=0;
-    for(uint32 rgi=1; rgi<AS_fixed_rls_byrg.size();++rgi){
-      auto rgid=ReadGroupLib::getReadGroupID(rgi);
-      if(rgid.isBackbone() || rgid.isRail()) continue;
-      maxavg=max(maxavg,AS_fixed_rls_byrg[rgi].getAvgLenUsed());
-    }
-
-    // two modes: either user set numpasses, then calculate bph series by
-    //  initial bph and increase per pass
-    // or user wanted all auto (numpasses<0), then use the info from the different average
-    //  readgroup read lengths to decide
-    if(ncaparams.as_numpasses>0){
-      cout << "user defined number of passes.\n";
-
-      auto stepping=sparams.sk_bph_increasestep;
-      CEBUG("initial stepping " << stepping << endl);
-      if(stepping==0){
-	// no user supplied stepping. calc it equidistant in the range of [kmer,maxbph2use]
-	// (yes, rounding errors ... I don't care)
-	if(ncaparams.as_numpasses>1){
-	  auto maxbphtouse=maxavg*100/60;
-	  if(maxbphtouse<sparams.sk_basesperhash) maxbphtouse=sparams.sk_basesperhash;
-	  stepping=(maxbphtouse-sparams.sk_basesperhash)/(ncaparams.as_numpasses-1);
-	}else{
-	  stepping=1;
-	}
-      }
-      CEBUG("used stepping " << stepping << endl);
-      for(uint8 ap=0; ap<ncaparams.as_numpasses; ++ap){
-	auto newbph=sparams.sk_basesperhash+(stepping*ap);
-	if(sparams.sk_bph_max && newbph>sparams.sk_bph_max) newbph=sparams.sk_bph_max;
-	if(newbph>256) newbph=256;
-	ncaparams.as_bphseries.push_back(newbph);
-      }
-    }else{
-      cout << "all-auto determination of passes and kmer series.\n";
-
-      CEBUG("ncaparams.as_assemblyjob_accurate " << ncaparams.as_assemblyjob_accurate << endl);
-      CEBUG("maxavg " << maxavg << endl);
-
-      // TODO: get that cleaned up
-      if(ncaparams.as_assemblyjob_accurate){
-	if(maxavg>383) {
-	  ncaparams.as_bphseries={17,31,63,127,255};
-	}else if(maxavg>290) {
-	  ncaparams.as_bphseries={17,31,63,127,200};
-	}else if(maxavg>240) {
-	  ncaparams.as_bphseries={17,31,63,127,165};
-	}else if(maxavg>190) {
-	  ncaparams.as_bphseries={17,31,63,95,127};
-	}else if(maxavg>140) {
-	  ncaparams.as_bphseries={17,31,53,75,99};
-	}else if(maxavg>90) {
-	  ncaparams.as_bphseries={17,31,53,65};
-	}else if(maxavg>70) {
-	  ncaparams.as_bphseries={17,27,37,47};
-	}else if(maxavg>45) {
-	  ncaparams.as_bphseries={17,21,25,31};
-	}else{
-	  ncaparams.as_bphseries={17,19,21,23};
-	}
-      }else{
-	if(maxavg>383) {
-	  ncaparams.as_bphseries={17,31,255};
-	}else if(maxavg>290) {
-	  ncaparams.as_bphseries={17,31,200};
-	}else if(maxavg>240) {
-	  ncaparams.as_bphseries={17,31,165};
-	}else if(maxavg>190) {
-	  ncaparams.as_bphseries={17,31,127};
-	}else if(maxavg>140) {
-	  ncaparams.as_bphseries={17,31,99};
-	}else if(maxavg>90) {
-	  ncaparams.as_bphseries={17,31,65};
-	}else if(maxavg>70) {
-	  ncaparams.as_bphseries={17,27,47};
-	}else if(maxavg>45) {
-	  ncaparams.as_bphseries={17,21,31};
-	}else{
-	  ncaparams.as_bphseries={17,19,23};
-	}
-      }
-
-      ncaparams.as_numpasses=ncaparams.as_bphseries.size();
-    }
-  }
-
-
-  cout << "Number of passes used by MIRA: " << ncaparams.as_numpasses;
-  cout << "\nkmer series: " << ncaparams.as_bphseries[0];
-  for(uint8 i=1; i<ncaparams.as_bphseries.size(); ++i) cout << ", " << ncaparams.as_bphseries[i];
-  cout << '\n';
-
-  if(AS_miraparams[0].getHashStatisticsParams().hs_masknastyrepeats
-     && AS_miraparams[0].getHashStatisticsParams().hs_apply_digitalnormalisation){
-    AS_applydiginorminpass=0;
-    // first kmer >=50 or second to last pass
-    for(uint8 i=0; i<ncaparams.as_bphseries.size(); ++i){
-      if(ncaparams.as_bphseries[i]>=50){
-	AS_applydiginorminpass=i+1;
-	break;
-      }
-    }
-    if(AS_applydiginorminpass==0){
-      if(ncaparams.as_bphseries.size()>1){
-	AS_applydiginorminpass=ncaparams.as_bphseries.size()-1;
-      }else{
-	AS_applydiginorminpass=1;
-      }
-    }
-    cout << "Digital normalisation scheduled for pass " << AS_applydiginorminpass << endl;
-  }
-
-  return;
-}
-//#define CEBUG(bla)
-
-
-/*************************************************************************
- *
  *
  *
  *
@@ -1047,7 +982,7 @@ bool Assembly::checkTerminationRequest()
       +AS_miraparams[0].getDirectoryParams().dir_checkpoint+"/terminate"
       +" "
       +AS_miraparams[0].getDirectoryParams().dir_checkpoint+"/terminate_acknowledged";
-    int dummy=system(command.c_str());
+    system(command.c_str());
     return true;
   }
   return false;
@@ -1064,16 +999,7 @@ void Assembly::assemble()
 {
   FUNCSTART("Assembly::assemble()");
 
-#ifdef MIRAMEMORC
-  cout.flush();
-  MemORC::statistics();
-  MemORC::checkAllMemBlocks();
-#endif
-
-  basicDataChecks();
-
   uint32 startpass=1;
-  AS_guessedtemplatevalues=false;
 
   ensureStandardDirectories(false);
 
@@ -1081,28 +1007,13 @@ void Assembly::assemble()
   //directory_parameters const & dir_params= AS_miraparams->getDirectoryParams();
   edit_parameters const & ed_params= AS_miraparams[0].getEditParams();
 
-  AS_donequickdenovocoveragecheck=false;
-
-  // fill quick lookup which sequencing types are present as well as whether backbones are there
-  AS_seqtypespresent.clear();
-  AS_seqtypespresent.resize(ReadGroupLib::SEQTYPE_END,false);
-  for(uint32 rgi=0; rgi< ReadGroupLib::getNumReadGroups(); ++rgi){
-    auto rgid=ReadGroupLib::getReadGroupID(rgi);
-    if(rgid.isBackbone()){
-      AS_hasbackbones=true;
-    }
-    if(!rgid.isRail() && !rgid.isBackbone()){
-      AS_seqtypespresent[rgid.getSequencingType()]=true;
-    }
-  }
-
   if (as_fixparams.as_numrmbbreakloops <1) {
-    const_cast<assembly_parameters &>(AS_miraparams[0].getAssemblyParams()).as_numrmbbreakloops=1;
+    AS_miraparams[0].setAssemblyNumRMBBreakLoops(1);
     cout << "Number of RMB break loops <1, setting to 1\n";
   }
-  if (AS_hasbackbones
+  if (as_fixparams.as_loadbackbone
       && as_fixparams.as_startbackboneusage_inpass > static_cast<int32>(as_fixparams.as_numpasses)) {
-    const_cast<assembly_parameters &>(AS_miraparams[0].getAssemblyParams()).as_startbackboneusage_inpass=as_fixparams.as_numpasses;
+    AS_miraparams[0].setAssemblyStartBackboneUsageInPass(as_fixparams.as_numpasses);
     cout << "Start of backbone usage > number of passes, correcting start to " << as_fixparams.as_numpasses << endl;
   }
 
@@ -1115,36 +1026,41 @@ void Assembly::assemble()
   AS_assemblyinfo.setLargeContigSize(AS_miraparams[0].getSpecialParams().mi_as_largecontigsize);
   AS_assemblyinfo.setLargeContigSizeForStats(AS_miraparams[0].getSpecialParams().mi_as_largecontigsize4stats);
 
-  if((AS_seqtypespresent[ReadGroupLib::SEQTYPE_454GS20]
-      || AS_seqtypespresent[ReadGroupLib::SEQTYPE_SOLEXA]
-      || AS_seqtypespresent[ReadGroupLib::SEQTYPE_IONTORRENT])
+
+  // find out whether we have 454 reads in the data set
+  // also find out whether there are SRMr or CRMr tags that need attention
+  AS_seqtypespresent.clear();
+  AS_seqtypespresent.resize(Read::SEQTYPE_END,false);
+  AS_454dosimpleedit=false;
+  for(uint32 i=0; i< AS_readpool.size(); i++){
+    if(AS_readpool[i].isUsedInAssembly()){
+      if(!AS_readpool[i].isBackbone() && !AS_readpool[i].isRail()){
+	AS_seqtypespresent[AS_readpool[i].getSequencingType()]=true;
+      }
+      if(AS_readpool[i].getSequencingType()==Read::SEQTYPE_454GS20){
+	AS_454dosimpleedit=true;
+      }
+    }
+  }
+
+  if((AS_seqtypespresent[Read::SEQTYPE_454GS20]
+      || AS_seqtypespresent[Read::SEQTYPE_SOLEXA]
+      || AS_seqtypespresent[Read::SEQTYPE_IONTORRENT])
      && (as_fixparams.as_output_gap4da
 	 || as_fixparams.as_output_tmp_gap4da
 	 || as_fixparams.as_output_exttmp_gap4da)){
-    cout << "454, Solexa or IonTorrent data present, switching off GAP4DA type output results (you *DO NOT* want millions of files in a directory, really.)\n";
-    MIRAParameters::parseQuickmode("-OUT:org=no:otg=no:oetg=no",
+    cout << "454 type data present, switching off GAP4DA type output results (you *DO NOT* want millions of files in a directory, really.)\n";
+    MIRAParameters::parseQuickmode("-OUT:org=no:otg=no:oetg=no", 
 				   "", AS_miraparams);
   }
 
-  // look for template ids found
-  AS_maxtemplateid=-1;
-  for(uint32 rpi=0; rpi<AS_readpool.size(); ++rpi){
-    if(AS_readpool[rpi].getTemplateID()>AS_maxtemplateid) AS_maxtemplateid=AS_readpool[rpi].getTemplateID();
-  }
-  cout << "PRED MAXTID " << AS_maxtemplateid << endl;
-
   // allocate or reserve memory that is quite static from the size,
   //  reducing memory fragmentations at least a bit
   {
-#if TRACKMEMUSAGE
+#if TRACKMEMUSAGE 
     cout << "\ndmi as_init 00\n";
     dumpMemInfo();
 #endif
-    if(AS_maxtemplateid>=0){
-      AS_templateguesses.reserve(AS_maxtemplateid+1);
-    }
-
-    AS_estnochimerakill.clear();
     AS_multicopies.reserve(AS_readpool.size());  // do NOT init multicopies!
     AS_hasmcoverlaps.reserve(AS_readpool.size()); // does not need init
 
@@ -1155,58 +1071,44 @@ void Assembly::assemble()
     AS_clipleft.resize(AS_readpool.size(),0);
     AS_clipright.resize(AS_readpool.size(),0);
     AS_istroublemaker.resize(AS_readpool.size(),0);
-    AS_debrisreason.resize(AS_readpool.size(),0);
-    AS_incorchim.resize(AS_readpool.size(),0);
     AS_isdebris.resize(AS_readpool.size(),0);
     AS_needalloverlaps.resize(AS_readpool.size(),false);
     AS_maxcoveragereached.resize(AS_readpool.size(),0);
 
+    //AS_allowquickoverlap.resize(AS_readpool.size(),false);
+
     // these 3 only temp filled, but block anyway to reduce fragmentation
     AS_allrmbsok.reserve(AS_readpool.size());
     AS_probablermbsnotok.reserve(AS_readpool.size());
     AS_weakrmbsnotok.reserve(AS_readpool.size());
-#if TRACKMEMUSAGE
+#if TRACKMEMUSAGE 
     cout << "\ndmi as_init 10\n";
     dumpMemInfo();
 #endif
   }
 
+  AS_needsskimfornastyrepeats=true;
+
   bool clipvectorleftovers=false;
   bool usereadextension=false;
-  for(uint32 i=0; i<ReadGroupLib::SEQTYPE_END; i++){
+  for(uint32 i=0; i<Read::SEQTYPE_END; i++){
     if(AS_seqtypespresent[i]){
       if(AS_miraparams[i].getAssemblyParams().as_clip_possible_vectors){
-	if(i != ReadGroupLib::SEQTYPE_SANGER){
-	  cout << "-CL:pvlc takes effect only for Sanger sequences.\n";
-	}else{
-	  clipvectorleftovers=true;
-	}
+	clipvectorleftovers=true;
       }
       if(AS_miraparams[i].getAssemblyParams().as_use_read_extension){
-	if(i != ReadGroupLib::SEQTYPE_SANGER){
-	  cout << "-DP:ure takes effect only for Sanger sequences.\n";
-	}else{
-	  usereadextension=true;
-	}
+	usereadextension=true;
       }
     }
   }
 
-  AS_resumeisok=false;
+  //performSnapshot(0);
+
   if(AS_resumeasembly){
-    AS_resumeisok=true;
-    try{
-      loadSnapshotData(startpass);
-    }
-    catch(Notify n){
-      cout << "Error while loading snapshot metadata, resuming assembly is not possible, sorry\n";
-      n.handleError(THISFUNC);
-    }
-    // set a couple of values
-    if(startpass>1) AS_doneskimchimera=true;
+    // startpass=...;
+    //performHashAnalysis(startpass,"","");
   }else{
     preassembleTasks(usereadextension,clipvectorleftovers);
-    performSnapshot(1);
   }
 
   EDITParameters eparams;
@@ -1217,40 +1119,22 @@ void Assembly::assemble()
 #else
 #endif
 
-  priv_setupAutoPasses();
-
   uint32 actpass=startpass;
-  if(as_fixparams.as_assemblyjob_preprocessonly){
-    // only preprocess?
-    // Just calculate some statistics and the hash analysis
-
-    // currently not needed I think, just to be sure
-    AS_resumeisok=false;
+  if(as_fixparams.as_numpasses==0){
+    // 0 passes? Then the user does not want an assembly
+    // Just calculate some statistics and the hash analysis 
 
     cout << "You have selected to have 0 passes on the assembly, therefore"
-      "\njust running a couple of hash statistics and info for read repeats."
-      "\n(also performing rare kmer clips if wished)\n";
+      "\njust running a couple of hash statistics and info for read repeats.\n";
     dumpSomeStatistics();
-    priv_performHashAnalysis("",true,false, 0, "", "_pass");
-
-    dumpSomeStatistics();
-    performSnapshot(1);
+    performHashAnalysis(0, "", "_pass");
   }else{
+    bool rerunSKIM=true;
     for(; actpass<=as_fixparams.as_numpasses; actpass++){
 
-      //if(actpass==2) {
-      //	Contig::setMasterCEBUGFlag(true);
-      //}else{
-      //	Contig::setMasterCEBUGFlag(false);
-      //}
-
       //dumpMemInfo();
       dumpFile("/proc/self/status",cout);
-
       cout << "\n\nPass: " << actpass << " / " << as_fixparams.as_numpasses << endl;
-      if(as_fixparams.as_dateoutput) dateStamp(cout);
-
-      AS_warnings.dumpWarnings();
 
 #ifdef VALGRIND_LEAKCHECK
       cout << "\n==MEMTRACK1 debugging start\n";
@@ -1264,11 +1148,8 @@ void Assembly::assemble()
 	exit(0);
       }
 #endif
-#ifdef MIRAMEMORC
-      cout.flush();
-      MemORC::statistics();
-      MemORC::checkAllMemBlocks();
-#endif
+
+      performSnapshot(actpass);
 
       AS_contigs.clear();
 
@@ -1285,108 +1166,63 @@ void Assembly::assemble()
       }
 #endif
 
-      {
-	auto newbph=priv_calcBasesPerHashOnPass(actpass);
-	AS_miraparams[0].getNonConstSkimParams().sk_basesperhash=newbph;
-	cout << "Automatic -SK:bph set to " << newbph << endl;
-      }
-
-      dumpSomeStatistics();
+      if(as_fixparams.as_skimeachpass
+	 || rerunSKIM                  // forced by new SRMs in previous pass
+	 || usereadextension
+	 || clipvectorleftovers
+	 || AS_seqtypespresent[Read::SEQTYPE_SOLEXA]){
 
-#if TRACKMEMUSAGE
-      cout << "\ndmi 20\n";
-      dumpMemInfo();
+	dumpSomeStatistics();
+      
+#if TRACKMEMUSAGE 
+	cout << "\ndmi 20\n";
+	dumpMemInfo();
+#endif
+	// as something might have changed in the reads, redo
+	//  the hash analysis
+	performHashAnalysis(actpass, "", "_pass");
+      
+#if TRACKMEMUSAGE 
+	cout << "\ndmi 30\n";
+	dumpMemInfo();
 #endif
 
-      // preparing hash analysis
-
-      // on the last pass, maybe the user wants a rare kmer final kill
+//      for(uint32 i=0; i<AS_readpool.size();++i){
+//	if(AS_readpool[i].isBackbone()) continue;
+//	if(AS_readpool[i].isRail()) continue;
+//	if(1) {
+//	//if(i==16226603) {
+//	  Read::setCoutType(Read::AS_TEXT);
+//	  cout << "########\n" << AS_readpool[i] << endl;
+//	  continue;
+//	}
+//	AS_readpool[i].setValidData(false);
+//      }
 
-      {
-	bool rkfk=(actpass==as_fixparams.as_numpasses);
-	if(rkfk){
-	  // resolve auto mode: only for de-novo, set "hs_rare_kmer_final_kill", set it to 3
-	  // all other cases: no change
-	  if(AS_miraparams[0].getNonConstHashStatisticsParams().hs_rare_kmer_final_kill==0
-	     && !as_fixparams.as_assemblyjob_mapping) {
-	    AS_miraparams[0].getNonConstHashStatisticsParams().hs_rare_kmer_final_kill=3;
-	  }
-	}
-	priv_performHashAnalysis("", true, rkfk, actpass, "", "_pass");
-      }
-
-      // on every pass, throw out dubious reads which might be chimeras
-      // atm only for denovo
-      if(!as_fixparams.as_assemblyjob_mapping
-	 && as_fixparams.as_clip_kmer_junkdetection){
-	string tmpfname;
-	tmpfname=buildFileName(0,"","",
-			       as_fixparams.as_tmpf_clippings,
-			       ".txt","",false);
-	AS_dataprocessing.startLogging(tmpfname,false);
-
-	if(actpass<as_fixparams.as_numpasses){
-	  auto numfound=AS_dataprocessing.markReadsWithInvalidKMerEndsAsChimeras_Pool(
-	    AS_readpool,
-	    AS_miraparams[0].getSkimParams().sk_basesperhash,
-	    as_fixparams.as_clip_kmer_junkkill,  //false, just mark reads; true, kill them
-	    &AS_debrisreason,
-	    AS_incorchim,
-	    AS_estnochimerakill,
-	    "passX");
-	  cout << "Found " << numfound << " incorrectible read ends or possible chimeras.\n";
-	}else{
-	  auto numfound=AS_dataprocessing.markReadsWithRareKMersAsChimeras_Pool(
-	    AS_readpool,
-	    AS_miraparams[0].getSkimParams().sk_basesperhash,
-	    as_fixparams.as_clip_kmer_junkkill,  //false, just mark reads; true, kill them
-	    &AS_debrisreason,
-	    AS_incorchim,
-	    AS_estnochimerakill,
-	    "passX");
-	  cout << "Found " << numfound << " terminally incorrectible reads or possible chimeras.\n";
-	}
-	AS_dataprocessing.stopLogging();
+	findPossibleOverlaps(actpass, "", "_pass");
+	//if(AS_454dosimpleedit) editSimple454Overcalls(actpass);
       }
 
-#if TRACKMEMUSAGE
-      cout << "\ndmi 30\n";
-      dumpMemInfo();
-#endif
-
-      findPossibleOverlaps(actpass, "", "_pass");
+      rerunSKIM=false;
 
       // TODO: setting that here is messy
       AS_steps[ASVECTORSCLIPPED]=0;
 
-#if TRACKMEMUSAGE
+#if TRACKMEMUSAGE 
       cout << "\ndmi 40\n";
       dumpMemInfo();
 #endif
 
-      {
-	string signalfile(buildFileName(actpass, "", "_pass",
-					AS_miraparams[0].getAssemblyParams().as_tmpf_signal_mainalignments,
-					".ok"));
-	if(!AS_resumeasembly || !AS_resumeisok || !fileExists(signalfile)){
-	  AS_resumeisok=false;
-	  makeAlignments(Assembly::ma_takeall, false, true, actpass, "", "_pass");
-	  saveResumeDataMA(actpass, "", "_pass");
-	  ofstream fout(signalfile.c_str());  // create checkpoint signal file for main alignments
-	}else{
-	  cout << "Resume assembly: alignments already present, good.\n";
-	  loadResumeDataMA(actpass, "", "_pass");
-	}
-      }
+      makeAlignments(Assembly::ma_takeall, false, true, actpass, "", "_pass");
 
-#if TRACKMEMUSAGE
+#if TRACKMEMUSAGE 
       cout << "\ndmi 50\n";
       dumpMemInfo();
 #endif
 
-      priv_loadAlignmentsFromFile(actpass, "", "_pass");
+      loadAlignmentsFromFile(actpass, "", "_pass");
 
-#if TRACKMEMUSAGE
+#if TRACKMEMUSAGE 
       cout << "\ndmi 60\n";
       dumpMemInfo();
 #endif
@@ -1400,7 +1236,7 @@ void Assembly::assemble()
 	xrmrcount[rnr]=AS_readpool.getRead(rnr).countTags(Read::REA_tagentry_idSRMr);
       }
 
-#if TRACKMEMUSAGE
+#if TRACKMEMUSAGE 
       cout << "\ndmi 70\n";
       dumpMemInfo();
 #endif
@@ -1415,14 +1251,9 @@ void Assembly::assemble()
       if(as_fixparams.as_dateoutput) dateStamp(cout);
 
       bool foundrepeats=buildFirstContigs(actpass,
-					  eparams,
+					  eparams, 
 					  (actpass==as_fixparams.as_numpasses));
 
-      if(!AS_bbcontigs.empty()){
-	// mapping may have created new readgroups (CER reads)
-	AS_current_rls_byrg.resize(ReadGroupLib::getNumReadGroups());
-      }
-
 #ifdef VALGRIND_LEAKCHECK
       cout << "\n==MEMTRACK3 debugging start\n";
       dumpMemInfo();
@@ -1430,7 +1261,7 @@ void Assembly::assemble()
 	cout << "\n==MEMTRACK3 debugging end\n";
 #endif
 
-#if TRACKMEMUSAGE
+#if TRACKMEMUSAGE 
       cout << "\ndmi 80\n";
       dumpMemInfo();
 #endif
@@ -1438,46 +1269,24 @@ void Assembly::assemble()
       // try to guess a good value for minimum coverage
       //  for large contigs
       AS_assemblyinfo.calcCurrentInfo();
-      {
-	auto avc=AS_assemblyinfo.ASI_avgcoverage[1];
-	if(avc==0){
-	  avc=AS_assemblyinfo.ASI_avgcoverage[0];
-	}
-	double multval=0.5;
-	if(avc<40) multval=static_cast<double>(1.0)/3;
+      if(AS_assemblyinfo.ASI_avgcoverage[1]>0){
 	AS_assemblyinfo.setLargeTotalCov(
-	  static_cast<uint32>(static_cast<double>(.5)+avc*multval)
+	  static_cast<uint32>(.5+AS_assemblyinfo.ASI_avgcoverage[1]/3)
 	  );
-	for(uint8 st=0; st<ReadGroupLib::SEQTYPE_END; st++){
-	  avc=AS_assemblyinfo.ASI_avgcoverage_perst[1][st];
-	  if(avc==0) avc=AS_assemblyinfo.ASI_avgcoverage_perst[0][st];
-	  AS_assemblyinfo.setLargeContigCovPerST(
-	    static_cast<uint32>(static_cast<double>(.5)+avc*multval),
-	    st
-	    );
-	}
-      }
-      saveAssemblyInfo();
-
-      // save large contigs info only for genome de-novo,
-      //  i.e., no backbones present and we're using genomic pathfinder (not EST)
-      // ah, and hunt for smile shape
-      if(AS_bbcontigs.empty() && AS_miraparams[0].getPathfinderParams().paf_use_genomic_algorithms){
-	saveLargeContigsInfo();
-	warnAtSmileCoverage();
-      }
-
-      // this also sets the info for RGSTInfo
-      warnChimeraContent();
-
-      if(actpass==as_fixparams.as_numpasses) {
-	saveRGSTInfo();
       }else{
-	saveRGSTInfo(actpass, "", "_pass");
+	AS_assemblyinfo.setLargeTotalCov(
+	  static_cast<uint32>(.5+AS_assemblyinfo.ASI_avgcoverage[0]/3)
+	  );
       }
+      for(uint8 st=0; st<Read::SEQTYPE_END; st++){
+	AS_assemblyinfo.setLargeContigCovPerST(
+	  static_cast<uint32>(.5+AS_assemblyinfo.ASI_avgcoverage_perst[0][st]/3),
+	  st
+	  );
+      }
+      saveAssemblyInfo();
 
-
-#if TRACKMEMUSAGE
+#if TRACKMEMUSAGE 
       cout << "\ndmi 90\n";
       dumpMemInfo();
 #endif
@@ -1503,8 +1312,8 @@ void Assembly::assemble()
 	  for(uint32 rnr=0; rnr<AS_readpool.size(); rnr++){
 	    xrmrcount[rnr]=AS_readpool.getRead(rnr).countTags(Read::REA_tagentry_idCRMr);
 	  }
-
-#if TRACKMEMUSAGE
+	
+#if TRACKMEMUSAGE 
 	  cout << "\ndmi a0\n";
 	  dumpMemInfo();
 #endif
@@ -1521,31 +1330,40 @@ void Assembly::assemble()
 	    if(AS_readpool.getRead(rnr).countTags(Read::REA_tagentry_idCRMr) != xrmrcount[rnr]) AS_readsforrepeatresolve[rnr]=true;
 	  }
 
-#if TRACKMEMUSAGE
+#if TRACKMEMUSAGE 
 	  cout << "\ndmi b0\n";
 	  dumpMemInfo();
 #endif
 	  makeAlignments(Assembly::ma_needRRFlagAndBothCRMr, true, false, actpass, "", "", "repeat_resolve");
-
-#if TRACKMEMUSAGE
+	
+#if TRACKMEMUSAGE 
 	  cout << "\ndmi c0\n";
 	  dumpMemInfo();
 #endif
 	  nukeSTLContainer(AS_readsforrepeatresolve);
-
-#if TRACKMEMUSAGE
+	
+#if TRACKMEMUSAGE 
 	  cout << "\ndmi d0\n";
 	  dumpMemInfo();
 #endif
+	  rerunSKIM=true;
 	}
 
 	if(usereadextension
 	   && actpass >= as_fixparams.as_readextension_firstpassnum
 	   && actpass <= as_fixparams.as_readextension_lastpassnum) {
 	  extendADS(actpass, "", "_pass");
+	  AS_needsskimfornastyrepeats=true;
+	  rerunSKIM=true;
 	}
 	if(clipvectorleftovers) {
 	  performSeqVectorClippings();
+	  AS_needsskimfornastyrepeats=true;
+	  rerunSKIM=true;
+	}
+	if(AS_seqtypespresent[Read::SEQTYPE_SOLEXA]
+	   || AS_seqtypespresent[Read::SEQTYPE_ABISOLID]){
+	  performSRMRightClippings();
 	}
       }
 
@@ -1565,123 +1383,52 @@ void Assembly::assemble()
       cout << "\ndmi e0\n";
       dumpMemInfo();
 #endif
+    }
+  }
 
-      performSnapshot(actpass+1);
-
-    }
-
-    if(AS_hasbackbones && AS_guessedtemplatevalues){
-      priv_hackMergeTwoResultMAFs();
-    }
-
-  }
-
-  AS_warnings.dumpWarnings();
-
-
-#ifdef MIRAMEMORC
-  cout.flush();
-  MemORC::statistics();
-  MemORC::checkAllMemBlocks();
-#endif
+  performSnapshot(actpass);
 
   FUNCEND();
   return;
 }
 
 
-/*************************************************************************
- *
- * Given a pass number, return the bph (kmer) size which will be
- * used in Skim
- *
- *************************************************************************/
-
-uint32 Assembly::priv_calcBasesPerHashOnPass(uint32 passnr) const
-{
-  if(passnr>0) --passnr;
-  if(passnr>=AS_miraparams[0].getAssemblyParams().as_bphseries.size()){
-    passnr=AS_miraparams[0].getAssemblyParams().as_bphseries.size()-1;
-  }
-  return AS_miraparams[0].getAssemblyParams().as_bphseries[passnr];
-}
 
 /*************************************************************************
  *
- * In mapping assemblies, the results for guessing template numbers
- *  (size, segment placement) are available only after the MAF has been written
- * Therefore, need to rewrite header of MAF (and CAF completely)
- * Easiest way out: MAF header from chkpoint, body of 'usual' result MAF
  *
- * delete CAF, have outer caller recreate it from new MAF
+ *
  *
  *************************************************************************/
 
-void Assembly::priv_hackMergeTwoResultMAFs()
+void Assembly::performSnapshot(uint32 actpass)
 {
-  string headermaf(buildDefaultCheckpointFileName(AS_miraparams[0].getFileParams().chkpt_readpool));
-  if(!fileExists(headermaf)) return;
-
-  string bodymaf(getMAFFilename());
-  if(!fileExists(bodymaf)) return;
-
-  string newmaf(bodymaf+"tmp");
-
-  std::ifstream fin(headermaf, ios::in);
-  if(!fin.is_open()){
-    cout << "MAFmerge: Could not open headermaf " << headermaf << endl;
-    return;
-  }
-
-  std::ofstream  fout(newmaf,ios::out);
-  if(!fout.is_open()){
-    cout << "MAFmerge: Could not open newmaf " << newmaf << endl;
-    return;
-  }
+  FUNCSTART("void Assembly::performSnapshot(uint32 actpass)");
 
-  string actline;
-  actline.reserve(1000);
-  while(!fin.eof()){
-    getline(fin,actline);
-    if(!actline.empty()){
-      if(actline[0]=='@'
-	 || actline[0]=='#'){
-	fout << actline << '\n';
-      }else{
-	break;
-      }
-    }
-  }
-  fin.close();
-  fin.open(bodymaf, ios::in);
-  if(!fin.is_open()){
-    cout << "MAFmerge: Could not open bodymaf " << bodymaf << endl;
-    return;
-  }
-  while(!fin.eof()){
-    getline(fin,actline);
-    if(actline.empty()) continue;
-    if(actline[0]!='@'
-       && actline[0]!='#') break;
+  assembly_parameters const & as_fixparams= AS_miraparams[0].getAssemblyParams();
+  cout << "Performing snapshot " << actpass << endl;
+  if(as_fixparams.as_dateoutput) dateStamp(cout);
+  {
+    ofstream fout(buildDefaultCheckpointFileName(as_fixparams.as_infile_chkptMAF).c_str(),
+		  ios::out|ios::trunc);
+    
+    AS_readpool.dumpAs(fout,Read::AS_MAF,true);
+    fout.close();
   }
-  fout << actline << '\n';
-  fout << fin.rdbuf();
 
-  if(fout.bad()){
-    cout << "MAFmerge: Could not finish copying to " << newmaf << endl;
+  {
+    ofstream fout(buildDefaultCheckpointFileName("passInfo.txt").c_str(),
+		  ios::out|ios::trunc);
+    fout << actpass << endl;
+		  
+    fout.close();
   }
-  fin.close();
-  fout.close();
+  if(as_fixparams.as_dateoutput) dateStamp(cout);
 
-  fileRename(newmaf,bodymaf);
-  string caffile(getCAFFilename());
-  if(fileExists(caffile)){
-    fileRemove(caffile,true);
-    fout.open(AS_miraparams[0].getDirectoryParams().dir_results+"/_tmprecreate");
-    fout << caffile << endl;
-  }
+  FUNCEND();
 }
 
+
 /*************************************************************************
  *
  *
@@ -1689,101 +1436,67 @@ void Assembly::priv_hackMergeTwoResultMAFs()
  *
  *************************************************************************/
 
-void Assembly::performSnapshot(uint32 actpass)
+void Assembly::saveResults()
 {
-  FUNCSTART("void Assembly::performSnapshot(uint32 actpass)");
+  FUNCSTART("void Assembly::saveResults()");
 
-  auto const & as_fixparams= AS_miraparams[0].getAssemblyParams();
-  auto const & ffp= AS_miraparams[0].getFileParams();
-
-  list<string> filesanew;
-
-  auto & dirchkpt=AS_miraparams[0].getDirectoryParams().dir_checkpoint;
-  auto & dirtmpchkpt=AS_miraparams[0].getDirectoryParams().dir_checkpoint_tmp;
+  assembly_parameters const & as_fixparams= AS_miraparams[0].getAssemblyParams();
 
-  cout << "Performing snapshot " << actpass << endl;
+  saveDebrisList();
   if(as_fixparams.as_dateoutput) dateStamp(cout);
-  try{
-    boost::filesystem::rename(dirchkpt,dirtmpchkpt);
+  saveStatistics();
+  if(as_fixparams.as_dateoutput) dateStamp(cout);
+  saveReadTagList();
+  if(as_fixparams.as_dateoutput) dateStamp(cout);
+  saveConsensusTagList();
+  if(as_fixparams.as_dateoutput) dateStamp(cout);
+  saveContigReadList();
+  if(as_fixparams.as_dateoutput) dateStamp(cout);
+  if(as_fixparams.as_output_caf){
+    saveAsCAF();
+    if(as_fixparams.as_dateoutput) dateStamp(cout);
   }
-  catch(boost::filesystem::filesystem_error fse){
-    MIRANOTIFY(Notify::FATAL,"Could not rename checkpoint directory in preparation of saving new checkpoint?\nError message is " << fse.what());
+  if(as_fixparams.as_output_maf){
+    saveAsMAF();
+    if(as_fixparams.as_dateoutput) dateStamp(cout);
   }
-  catch(...){
-    MIRANOTIFY(Notify::FATAL,"Could not rename checkpoint directory in preparation of saving new checkpoint?\nUnspecified exception?");
+  if(as_fixparams.as_output_wiggle){
+    saveAsWiggle();
+    if(as_fixparams.as_dateoutput) dateStamp(cout);
   }
-  if(ensureDirectory(dirchkpt, false)){
-    // Oooops? Cannot create new? Well, roll back the rename and exit
-    try{
-      boost::filesystem::rename(dirtmpchkpt,dirchkpt);
-    }
-    catch(boost::filesystem::filesystem_error fse){
-      MIRANOTIFY(Notify::FATAL,"Could not rollback initial checkpoint rename?\nError message is " << fse.what());
-    }
-    catch(...){
-      MIRANOTIFY(Notify::FATAL,"Could not rollback initial checkpoint rename?\nUnspecified exception?");
-    }
-    MIRANOTIFY(Notify::FATAL,"Could not create new snapshot directory? Disk full? changed permissions?");
+  if(as_fixparams.as_output_gap4da){
+    saveAsGAP4DA();
+    if(as_fixparams.as_dateoutput) dateStamp(cout);
   }
-  try{
-    ssdReadPool(buildDefaultCheckpointFileName(ffp.chkpt_readpool));
-    ssdPassInfo(buildDefaultCheckpointFileName(ffp.chkpt_passinfo),actpass);
-    ssdMaxCovReached(buildDefaultCheckpointFileName(ffp.chkpt_maxcovreached));
-    ssdBannedOverlaps(buildDefaultCheckpointFileName(ffp.chkpt_bannedoverlaps));
-
-    filesanew.push_back(ffp.chkpt_readpool);
-    filesanew.push_back(ffp.chkpt_passinfo);
-    filesanew.push_back(ffp.chkpt_maxcovreached);
-    filesanew.push_back(ffp.chkpt_bannedoverlaps);
-  }
-  catch(...){
-    // Oooops? Error while writing new checkpoint data? Rollback ...
-    try{
-      boost::filesystem::remove_all(dirtmpchkpt);
-    }
-    catch(boost::filesystem::filesystem_error fse){
-      MIRANOTIFY(Notify::FATAL,"Now, this is embarassing: could not delete failed checkpoint directory. Contact the author.\nError message is " << fse.what());
-    }
-    catch(...){
-      MIRANOTIFY(Notify::FATAL,"Now, this is embarassing: could not delete failed checkpoint directory. Contact the author.\nnUnspecified exception?");
-    }
-    try{
-      boost::filesystem::rename(dirtmpchkpt,dirchkpt);
-    }
-    catch(boost::filesystem::filesystem_error fse){
-      MIRANOTIFY(Notify::FATAL,"Now, this is embarassing: could not rollback checkpoint rename after failed snapshot?\nError message is " << fse.what());
-    }
-    catch(...){
-      MIRANOTIFY(Notify::FATAL,"Now, this is embarassing: could not rollback checkpoint rename after failed snapshot?\nUnspecified exception?");
-    }
-    MIRANOTIFY(Notify::FATAL,"Could not correctly write new snapshot data. Disk full? Changed permissions?");
+  if(as_fixparams.as_output_fasta) {
+    saveAsFASTA();
+    if(AS_readpool.getNumOfStrainInReadpool()>1) saveStrainsAsFASTAQUAL();
+    if(as_fixparams.as_dateoutput) dateStamp(cout);
   }
-
-  // so we've written anew a couple of files, let's delete the old versions in the tmp checkpoint and move the remaining files
-  try{
-    for(auto & fn : filesanew){
-      fileRemove(dirtmpchkpt+"/"+fn,true);
-    }
-
-    // now move the files remaining in the tmp chkpoint to the chkpoint
-    // then remove checkpoint tmp dir
-
-    for(boost::filesystem::directory_iterator fI(dirtmpchkpt);
-        fI != boost::filesystem::directory_iterator(); ++fI){
-      //cout << "renaming " << fI->path().string() << " to " << (dirchkpt+"/"+fI->path().filename().string()) << endl;
-      fileRename(fI->path().string(),dirchkpt+"/"+fI->path().filename().string());
-    }
-
-    boost::filesystem::remove_all(dirtmpchkpt);
+  if(as_fixparams.as_output_tcs) {
+    saveAsTCS();
+    if(as_fixparams.as_dateoutput) dateStamp(cout);
   }
-  catch(...){
+  saveSNPList();
+  //saveFeatureAnalysis();
+  if(as_fixparams.as_output_txt){
+    saveAsTXT();
+    if(as_fixparams.as_dateoutput) dateStamp(cout);
+  }
+  if(as_fixparams.as_output_ace){
+    saveAsACE();
+    if(as_fixparams.as_dateoutput) dateStamp(cout);
+  }
+  if(as_fixparams.as_output_html){
+    saveAsHTML();
+    if(as_fixparams.as_dateoutput) dateStamp(cout);
   }
-
-  if(as_fixparams.as_dateoutput) dateStamp(cout);
 
   FUNCEND();
 }
 
+
+
 /*************************************************************************
  *
  *
@@ -1791,369 +1504,1672 @@ void Assembly::performSnapshot(uint32 actpass)
  *
  *************************************************************************/
 
-void Assembly::loadSnapshotData(uint32 & actpass)
+void Assembly::makeNewReadPoolFromContigs()
 {
-  FUNCSTART("void Assembly::loadSnapshotData(uint32 & actpass)");
+  FUNCSTART("void Assembly::makeNewReadPoolFromContigs()");
 
-  auto const & ffp= AS_miraparams[0].getFileParams();
+  list<Contig>::iterator I = AS_contigs.begin();
+  int32 ccounter=0;
+
+  while(I!=AS_contigs.end()){
+    //const vector<Contig::contigread_t> & cr = I->getContigReads();
+    //vector<Contig::contigread_t>::iterator crI = const_cast<vector<Contig::contigread_t>::iterator>(cr.begin());
+    const vector<Contig::contigread_t> & cr = I->getContigReads();
+    vector<Contig::contigread_t>::const_iterator crI = cr.begin();
 
-  // readpool was loaded before, don't load here
-  actpass=lsdPassInfo(buildDefaultCheckpointFileName(ffp.chkpt_passinfo));
-  lsdMaxCovReached(buildDefaultCheckpointFileName(ffp.chkpt_maxcovreached));
-  lsdBannedOverlaps(buildDefaultCheckpointFileName(ffp.chkpt_bannedoverlaps));
+
+    for(;crI!=cr.end();crI++){
+      if(crI->orpid>=0){
+	if(crI->read.checkRead()){
+	  cout << "Precheck failed: " << endl;
+	  cout << crI->read;
+	  throw Notify(Notify::FATAL, THISFUNC, crI->read.checkRead()) ;
+	}
+	
+	AS_readpool.getRead(crI->orpid)=crI->read;
+	
+	if(AS_readpool.getRead(crI->orpid).checkRead()){
+	  cout << "Postcheck1 failed: " << endl;
+	  cout << AS_readpool.getRead(crI->orpid);
+	  throw Notify(Notify::FATAL, THISFUNC, AS_readpool.getRead(crI->orpid).checkRead()) ;
+	}
+	
+	const_cast<Read &>(crI->read).discard();
+	
+	if(AS_readpool.getRead(crI->orpid).checkRead()){
+	  cout << "Postcheck2 failed: " << endl;
+	  cout << AS_readpool.getRead(crI->orpid);
+	  throw Notify(Notify::FATAL, THISFUNC, AS_readpool.getRead(crI->orpid).checkRead()) ;
+	}
+      }
+    }
+
+    I++;ccounter++;
+  }
+  AS_contigs.clear();
 
   FUNCEND();
 }
 
 
+
 /*************************************************************************
  *
- *
- *
+ * returns whether new strong repeat markers (SRMs) were found for
+ *  any contig built in any stage
  *
  *************************************************************************/
 
-void Assembly::ssdReadPool(const string & filename)
-{
-  FUNCSTART("void Assembly::ssdReadPool(const string & filename)");
-  ofstream fout(filename,ios::out|ios::trunc);
-  Contig::dumpMAF_Head(fout);
-  AS_readpool.dumpAs(fout,Read::AS_MAF,true);
-  fout.close();
-  if(fout.fail()){
-    MIRANOTIFY(Notify::FATAL,"Could not write snapshot readpool?");
-  }
-}
+#define CEBUG(bla)   {cout << bla; cout.flush(); }
 
-void Assembly::ssdPassInfo(const string & filename, uint32 actpass)
+bool Assembly::buildFirstContigs(const int32 passnr, const EDITParameters & eparams, const bool lastpass)
 {
-  FUNCSTART("void Assembly::ssdPassInfo(const string & filename, uint32 actpass)");
-  ofstream fout(filename.c_str(),ios::out|ios::trunc);
-  fout << actpass << endl;
-  fout.close();
-  if(fout.fail()){
-    MIRANOTIFY(Notify::FATAL,"Could not write snapshot actpass?");
+  FUNCSTART("void Assembly::buildFirstContigs()");
+
+  CEBUG("BFC: " << passnr << "\t" << lastpass << endl);
+
+  assembly_parameters const & as_fixparams= AS_miraparams[0].getAssemblyParams();
+  directory_parameters const & dir_params= AS_miraparams[0].getDirectoryParams();
+  edit_parameters const & ed_params= AS_miraparams[0].getEditParams();
+
+  AS_deleteoldresultfiles=true;
+
+  AS_contigs.clear();
+  Contig::setIDCounter(1);
+  Contig::resetCERNumbering();
+
+  AS_assemblyinfo.zeroInfo();
+
+  vector<Align> aligncache;
+  setupAlignCache(aligncache);
+
+  // AS_hasmcoverlaps will be initialised by Pathfinder
+  AS_hasmcoverlaps.clear();
+
+  // when using short reads (Solexa, SOLiD), the contig might propose
+  //  new right clips to squeeze the data in. This vector holds
+  //  the info.
+  // -1 says: no proposed new right clip
+  AS_clipright.clear();
+  AS_clipright.resize(AS_readpool.size(),-1);
+
+  // Keep track of coverage information for contigs so to be able to make
+  //  average contig coverage predictions
+  vector<vector<uint32> > covperstpercon(Read::SEQTYPE_END);
+
+  // initially, overlaps of every read can be reduced
+  if(AS_needalloverlaps.size()==0){
+    AS_needalloverlaps.resize(AS_readpool.size(),false);
   }
-}
 
-void Assembly::ssdMaxCovReached(const string & filename)
-{
-  FUNCSTART("void Assembly::ssdMaxCovReached(const string & filename)");
-  ofstream fout(filename.c_str(),ios::out|ios::trunc);
-  for(auto mc : AS_maxcoveragereached) fout << mc << endl;
-  fout.close();
-  if(fout.fail()){
-    MIRANOTIFY(Notify::FATAL,"Could not write snapshot maxcov?");
+  // filter out all reads that have no overlap at this stage
+  // for this, first set all reads to "used" and "singlet", then
+  //   re-allow those that have at least one SW ovelap
+
+  AS_used_ids.clear();
+  AS_used_ids.resize(AS_readpool.size(),1);
+  AS_isdebris.clear();
+  AS_isdebris.resize(AS_readpool.size(),1);
+
+  // take back all reads with overlaps
+  {
+    vector<newedges_t>::const_iterator ceI=AS_confirmed_edges.begin();
+    for(;ceI!=AS_confirmed_edges.end();ceI++){
+      AS_isdebris[ceI->rid1]=0;
+      AS_used_ids[ceI->rid1]=0;
+    }
   }
-}
 
-void Assembly::ssdBannedOverlaps(const string & filename)
-{
-  FUNCSTART("void Assembly::ssdBannedOverlaps(const string & filename)");
-  // 1st line: size of AS_permanent_overlap_bans
-  // nth line: id1 id2 id2 id2 ...
-  ofstream fout(filename.c_str(),ios::out|ios::trunc);
-  fout << AS_permanent_overlap_bans.size() << endl;
-  for(size_t rid=0; rid < AS_permanent_overlap_bans.size(); ++rid){
-    if(!AS_permanent_overlap_bans.bop[rid].empty()){
-      fout << rid;
-      for(auto id2 : AS_permanent_overlap_bans.bop[rid]){
-	fout << '\t' << id2;
-      }
-      fout << '\n';
+  // Now, go through all the singlets and take them back into
+  //  assembly if they have special MIRA tags attached
+  // Also remove backbones & rails from the debris list
+  {
+    for(uint32 i=0; i< AS_readpool.size(); i++){
+      if(AS_readpool[i].hasTag(Read::REA_tagentry_idSRMr)
+	 || AS_readpool[i].hasTag(Read::REA_tagentry_idCRMr)
+	 || AS_readpool[i].hasTag(Read::REA_tagentry_idWRMr)
+	 || AS_readpool[i].hasTag(Read::REA_tagentry_idSAOr)
+	 || AS_readpool[i].hasTag(Read::REA_tagentry_idSROr)
+	 || AS_readpool[i].hasTag(Read::REA_tagentry_idSIOr)) {
+	AS_isdebris[i]=0;
+	AS_used_ids[i]=0;
+      }
+      if(AS_readpool[i].isBackbone()
+	 || AS_readpool[i].isRail()) {
+	AS_isdebris[i]=0;
+      }
     }
   }
-  fout.close();
-  if(fout.fail()){
-    MIRANOTIFY(Notify::FATAL,"Could not write snapshot banned overlaps?");
+
+  // get out reads that are
+  //  - invalid or not used in assembly
+  //  - or backbone or rail
+  // additionally set flag if we have 454 reads that are used
+
+  bool used454readsinpool=false;
+  {
+    for(uint32 i=0; i< AS_readpool.size(); i++){
+      if(AS_readpool[i].hasValidData()== false
+	|| AS_readpool[i].isUsedInAssembly()==false){
+	AS_used_ids[i]=-1;
+	if(AS_readpool[i].isSequencingType(Read::SEQTYPE_454GS20)){
+	  used454readsinpool=true;
+	}
+//      } else if(AS_readpool[i].isBackbone()
+//		|| AS_readpool[i].isRail()) {
+//	AS_used_ids[i]=1;
+//      } 
+      }
+    }
   }
-}
 
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
+  //AS_miraparams[0].setAssemblyLogUnusedIDs("unused.debug");
 
-uint32 Assembly::lsdPassInfo(const string & filename)
-{
-  FUNCSTART("uint32 Assembly::lsdPassInfo(const string & filename)");
 
-  ifstream fin(filename.c_str(), ios::in);
-  if(!fin.good()) {
-    MIRANOTIFY(Notify::FATAL,"Did not find " << filename);
+  // get total length of backbones (if any)
+  uint32 totalbblen=0;
+  for(list<Contig>::const_iterator cI=AS_bbcontigs.begin(); cI!=AS_bbcontigs.end(); cI++){
+    totalbblen+=cI->getContigLength();
   }
-  string tmp;
-  fin >> tmp;
-  auto n=atoll(tmp.c_str());
-  if(n<0){
-    MIRANOTIFY(Notify::FATAL,"negative value in " << filename << " is not expected");
+
+  ofstream fout;
+  if(as_fixparams.as_tmpf_unused_ids.size()!=0){
+    fout.open((dir_params.dir_tmp+"/"+as_fixparams.as_tmpf_unused_ids).c_str(), ios::out);
+    fout.close();
   }
-  return static_cast<uint32>(n);
-}
 
-void Assembly::lsdMaxCovReached(const string & filename)
-{
-  FUNCSTART("uint32 Assembly::lsdMaxCovReached(const string & filename)");
-
-  ifstream fin(filename.c_str(), ios::in);
-  if(!fin.good()) {
-    MIRANOTIFY(Notify::FATAL,"Did not find " << filename);
-  }
-  AS_maxcoveragereached.clear();
-  string tmpline;
-  while(getline(fin,tmpline)){
-    boost::trim(tmpline);
-    if(tmpline.empty()){
-      MIRANOTIFY(Notify::FATAL,"empty line in " << filename << " is not expected");
-    }
-    auto n=atoll(tmpline.c_str());
-    AS_maxcoveragereached.push_back(static_cast<uint32>(n));
+  // outside precomputed lowerbound of oedges, for PathFinder
+  // is used lateron in constructStepByStep() of the Pathfinder
+  //
+  // however, every once in a while (every 10k to 100k reads used from
+  //  the pool), the overlap edges vector will be compressed (unecessary
+  //  edges thrown out) and therefore this vector will be emptied (to be reconstructed
+  //  by pathfinder)
+  //
+  // On mapping 8m Solexas to 70 contigs (4MB), time goes down from 234 minutes to
+  //  221 minutes (Core i940)
+  //
+  // effect of compression not as big as hoped for, but every little bit helps
+
+  vector<vector<newedges_t>::iterator> tmp_lowerbound_oedges;
+
+  // PathFinder object can be created ouside loop and re-used
+  //  (constructor needs to do a lot of lower_bound() searches.
+  // Saves a lot of time in the endgame (singlets) of big projects
+  // TODO: check wrt multiple MIRAparams
+  Pathfinder paf(&AS_miraparams,
+		 AS_readpool,
+		 AS_confirmed_edges,
+		 AS_adsfacts);
+
+  // this vector will hold the read IDs added by pathfinder to contig
+  // + backbone + rail IDs
+  // used after call to *_constructStepByStep() to set AS_used_ids[] elements
+  vector<int32> pf_ids_in_contig;
+
+  uint32 overlapcompressstepping=AS_readpool.size()/5;
+  if(overlapcompressstepping<10000) overlapcompressstepping=10000;
+  //if(overlapcompressstepping<100) overlapcompressstepping=100;
+  if(overlapcompressstepping>100000) overlapcompressstepping=100000;
+  if(overlapcompressstepping>AS_readpool.size()) overlapcompressstepping=AS_readpool.size();
+  uint32 nextoverlapcompress=overlapcompressstepping;
+  cout << "overlapcompressstepping: " << overlapcompressstepping
+       << "\nnextoverlapcompress: " << nextoverlapcompress << endl;
+
+  bool foundSRMs=false;
+  uint32 numsingletssincecleanup=0;
+
+  bool maykillintermediatesinmglets=true;
+  bool shouldmovesmallclusterstodebris=false;
+  for(uint32 st=0;st < AS_miraparams.size(); st++){
+    if(AS_miraparams[st].getAssemblyParams().as_savesimplesingletsinproject) maykillintermediatesinmglets=false;
+    if(AS_miraparams[st].getAssemblyParams().as_minimum_readspercontig>1) shouldmovesmallclusterstodebris=true;
   }
-}
 
-void Assembly::lsdBannedOverlaps(const string & filename)
-{
-  FUNCSTART("void Assembly::lsdBannedOverlaps(const string & filename)");
+  if(shouldmovesmallclusterstodebris) bfc_moveSmallClustersToDebris();
 
-  ifstream fin(filename.c_str(), ios::in);
-  if(!fin.good()) {
-    MIRANOTIFY(Notify::FATAL,"Did not find " << filename);
-  }
 
-  size_t bopsize=0;
-  string tmpline;
-  vector<string> substrs;
-  if(getline(fin,tmpline)){
-    boost::trim(tmpline);
-    if(tmpline.empty()){
-      MIRANOTIFY(Notify::FATAL,"empty first line in " << filename << " ??");
+#ifdef CLOCK_STEPS2
+  timeval tv;
+  timeval tvloop;
+  timeval tvtotal;
+  gettimeofday(&tvtotal,NULL);
+#endif
+
+  uint32 unused=AS_used_ids.size();
+  uint32 numcontigs=1;
+  // bug: if someone specifically sets as_maxcontigsperpass to 2^32-1, then
+  //  this loop never runs.
+  for(;unused>0; ++numcontigs){
+    CEBUG("bfc 1\n");
+    if(as_fixparams.as_dateoutput) dateStamp(cout);
+    cout << '\n';
+
+#ifdef CLOCK_STEPS2
+    gettimeofday(&tv,NULL);
+#endif
+
+    if(as_fixparams.as_tmpf_unused_ids.size()!=0){
+      fout.open((dir_params.dir_tmp+"/"+as_fixparams.as_tmpf_unused_ids).c_str(), ios::out);
+      fout << "\nUnused for contig" << numcontigs << endl;
     }
-    boost::split(substrs, tmpline, boost::is_any_of(" \t"));
-    if(substrs.size()>1){
-      MIRANOTIFY(Notify::FATAL,"first line in " << filename << " should have one element only");
+    unused=0;
+    for(uint32 i=0; i<AS_used_ids.size(); i++){
+      if(AS_used_ids[i]==0){
+	unused++;
+	//cout << "nused: " << AS_readpool[i].getName() <<endl;
+	if(as_fixparams.as_tmpf_unused_ids.size()!=0){
+	  fout << AS_readpool[i].getName();
+	  fout << "\t" << AS_readpool[i].getSCFName() << endl;;
+	}
+      }else{
+	//cout << "ASui["<<i<<"]: " << static_cast<int16>(AS_used_ids[i]) << endl;
+      }
     }
-    auto n=atoll(substrs[0].c_str());
-    if(n<0){
-      cout << "Faulty first line, has negative values:\n" << tmpline << endl;
-      MIRANOTIFY(Notify::FATAL,"negative value in " << filename << " is not expected");
+    if(as_fixparams.as_tmpf_unused_ids.c_str()!=0){
+      fout.close();
+    }
+
+#ifdef CLOCK_STEPS2
+    cout << "Timing BFC unused: " << diffsuseconds(tv) << endl;
+    cout << "Unused: " << unused << endl;
+    cout << "AS_used_ids.size(): " << AS_used_ids.size() << endl;
+#endif
+
+    // jump out of for loop if max number of contigs was reached
+    if(as_fixparams.as_maxcontigsperpass>0 && numcontigs==as_fixparams.as_maxcontigsperpass+1) break;
+
+    CEBUG("bfc 2\n");
+    if(unused>0){
+
+#ifdef CLOCK_STEPS2
+      gettimeofday(&tv,NULL);
+      tvloop=tv;
+#endif
+
+      //// compress the overlap edges when needed
+      //if(AS_readpool.size()-unused > nextoverlapcompress){
+      //	if(AS_miraparams[0].getAssemblyParams().as_dateoutput) dateStamp(cout);
+      //	cout << "Compressing overlap edges ..."; cout.flush();
+      //	vector<newedges_t>::const_iterator srcI=AS_confirmed_edges.begin();
+      //	vector<newedges_t>::iterator dstI=AS_confirmed_edges.begin();
+      //	for(; srcI != AS_confirmed_edges.end(); ++srcI){
+      //	  if(AS_used_ids[srcI->rid1] == 0
+      //	     || AS_used_ids[srcI->linked_with] == 0){
+      //	    *dstI=*srcI;
+      //	    ++dstI;
+      //	  }
+      //	}
+      //	AS_confirmed_edges.resize(dstI-AS_confirmed_edges.begin());
+      //	nextoverlapcompress=AS_readpool.size()-unused+overlapcompressstepping;
+      //	cout << "done.\n";
+      //	if(AS_miraparams[0].getAssemblyParams().as_dateoutput) dateStamp(cout);
+      //}
+
+      Contig::setIDCounter(numcontigs);
+      // TODO: change wrt multiple MIRAparams
+      Contig buildcon(&AS_miraparams, AS_readpool);
+
+      //vector<int8> tmpused=AS_used_ids;
+
+#ifdef CLOCK_STEPS2
+      cout << "Timing BFC prelim1: " << diffsuseconds(tv) << endl;
+#endif
+
+      CEBUG("bfc 3\n");
+      list<Contig>::const_iterator bbContigI=AS_bbcontigs.begin();
+      if(numcontigs <= AS_bbcontigs.size()){
+	advance(bbContigI,numcontigs-1);
+      } else {
+	bbContigI=AS_bbcontigs.end();
+      }
+
+      CEBUG("bfc 4\n");
+      // set newreptmarked to true just to get into the for pass
+      //  value is changed within pass
+      bool newreptmarked=true;
+      bool wasovercalledited=false;
+      bool wasmajorovercalledited=false;
+      bool mayeditovercalls=true;
+
+      bool mastermayeditovercalls=AS_miraparams[Read::SEQTYPE_454GS20].getEditParams().ed_automatic_contic_editing;
+
+      // build a contig, repetitively until
+      //  ... maximum number of iterations has passed
+      //  ... or no now repeats were marked
+      //  ... or no 454 edits happened in last iteration
+
+      // Note: if we�re in last pass, iterate at least once if
+      //  454 edits were made! (disregarding as_fixparams.as_numrmbbreakloops,
+      //  maxiter gets adapted in loop then
+
+      uint32 maxiter=as_fixparams.as_numrmbbreakloops;
+
+      // Note: assemblies with a lot of passes (>=4) will
+      //  get only one loop in the first pass. The reason: first pass already
+      //  discovers a lot of repeats that are dealt with later on
+      //  in makeAlignments(). It's faster to let makeAlignments() deal
+      //  with "discovering" and marking reads than to loop here.
+
+      if(as_fixparams.as_mark_repeats){
+	if(as_fixparams.as_numpasses >= 4 && passnr==1){
+	  maxiter=1;
+	}
+	// same thing: passes >= 6, pass 2 leads to maxiter = 2 
+	if(as_fixparams.as_numpasses >= 6 && passnr==2
+	  && maxiter > 2){
+	  maxiter=2;
+	}
+      }
+
+      bool markrepeatsduringstore=true;
+
+      bool contignotok=false;
+
+      list<Contig::pbdse_t> pbdsev;
+
+      CEBUG("bfc 5\n");
+      for(uint32 iter=0; 
+	  iter < maxiter 
+	    && (newreptmarked || wasmajorovercalledited || contignotok);
+	  iter++){
+
+#ifdef CLOCK_STEPS2
+	gettimeofday(&tv,NULL);
+#endif
+
+	//AS_used_ids=tmpused;
+
+	// if pf_ids_in_contig entries, they're from the previous iteration
+	// which means that AS_used_ids is also not clean
+	// get that out again
+	{
+	  vector<int32>::const_iterator iibcI=pf_ids_in_contig.begin();
+	  for(;iibcI!=pf_ids_in_contig.end(); ++iibcI){
+	    AS_used_ids[*iibcI]=0;
+	    //cout << "deusing " << AS_readpool[*iibcI].getName() << endl;
+	  }
+	}
+	
+#ifdef CLOCK_STEPS2
+	cout << "Timing BFC setup AS_used_ids: " << diffsuseconds(tv) << endl;
+#endif
+
+	CEBUG("bfc 6/"<<iter << '\n');
+	if(as_fixparams.as_loadbackbone 
+	   && passnr>=as_fixparams.as_startbackboneusage_inpass
+	   && bbContigI != AS_bbcontigs.end()) {
+
+#ifdef CLOCK_STEPS2
+	  gettimeofday(&tv,NULL);
+#endif
+	  // let's try to pre-allocate memory for the most crucial
+	  //  parts of the contig structure: number of reads and contig len
+	  
+	  {
+	    double cfraction=100.0/static_cast<double>(totalbblen)*static_cast<double>(bbContigI->getContigLength());
+	    uint32 expectedmaxlen=static_cast<uint32>(
+	      cfraction*static_cast<double>(bbContigI->getContigLength())
+	      );
+	    // add 12.5% for the expected maxlen (worst case: 454 reads: 1 indel 
+	    //  all 8 bases.
+	    expectedmaxlen+=expectedmaxlen/8;
+
+	    uint32 expectedmaxreads=bbContigI->getNumReadsInContig()+static_cast<uint32>(
+	      cfraction*static_cast<double>(AS_readpool.size())
+	      );
+	    // add 20% to expected maxreads
+	    expectedmaxreads+=expectedmaxreads/5;
+
+	    //cout << "expectedmaxreads: " << expectedmaxreads << endl;
+
+	    if(expectedmaxreads>AS_readpool.size()) expectedmaxreads=AS_readpool.size();
+
+	    //cout << "rps: " << AS_readpool.size() << endl;
+	    //cout << "allocate: " << expectedmaxreads << endl;
+	    
+
+	    buildcon.reserveCapacity(expectedmaxlen, expectedmaxreads);
+	  }
+
+#ifdef CLOCK_STEPS2
+	  cout << "Timing BFC prealloc con: " << diffsuseconds(tv) << endl;
+	  gettimeofday(&tv,NULL);
+#endif
+	  buildcon=*bbContigI;
+
+#ifdef CLOCK_STEPS2
+	  cout << "Timing BFC copy bbcon: " << diffsuseconds(tv) << endl;
+	  gettimeofday(&tv,NULL);
+#endif
+
+	  // re-initialising the baselocks is necessary as reads might
+	  //  have got new SRMc/WRMc tags in previous iterations
+	  //  these are not known in the initial backbone contig, so
+	  //  they must be made known
+	  buildcon.initialiseBaseLocks();
+	  buildcon.setContigID(numcontigs);
+
+	  // tell contig to use backbone characters when possible for 
+	  //  tmp consensus
+	  // TODO: make configurable?
+	  buildcon.useBackbone4TmpConsensus(true);
+
+	  // and by default try to merge short reads (Solexa, SOLiD)
+	  buildcon.mergeNewSRReads(true);
+#ifdef CLOCK_STEPS2
+	  cout << "Timing BFC bbsetup remain: " << diffsuseconds(tv) << endl;
+#endif
+
+	} else {
+#ifdef CLOCK_STEPS2
+	  gettimeofday(&tv,NULL);
+#endif
+	  buildcon.discard();
+#ifdef CLOCK_STEPS2
+	  cout << "Timing BFC discard con: " << diffsuseconds(tv) << endl;
+#endif
+	}
+
+	CEBUG("bfc 7/"<<iter << '\n');
+
+	buildcon.setContigNamePrefix(
+	  AS_miraparams[0].getContigParams().con_nameprefix);
+
+	if(iter!=0){
+	  if(newreptmarked){
+	    cout << "\nIdentified misassembled reads in contig.\n";
+	  } else {
+	    cout << "\nLooping because of edits in reads.\n";
+	  }
+	  cout << "Rebuilding contig " << numcontigs << " now.\n";
+	}else{
+	  cout << "Building new contig " << numcontigs << endl;
+	}
+
+	//Contig::setCoutType(Contig::AS_DEBUG);
+	//cout << con;
+
+	if(!AS_coverageperseqtype.empty()){
+	  cout << "Setting contig coverage targets to: ";
+	  for(uint8 ii=0; ii<AS_coverageperseqtype.size(); ii++){
+	    cout << '\t' << AS_coverageperseqtype[ii];
+	  }
+	  cout << endl;
+	  buildcon.setContigCoverageTarget(AS_coverageperseqtype);
+	}
+
+	if(as_fixparams.as_dateoutput) dateStamp(cout);
+	
+	cout << "Unused reads: " << unused << endl;
+	cout.flush();
+	
+	//cerr << "paf.constructStepByStep()\n";
+	//exit(1);
+
+	CEBUG("bfc 8/"<<iter << '\n');
+
+	// in which mode are we? de-novo or mapping?
+	bool assemblymode_mapping=false;
+	if(as_fixparams.as_loadbackbone
+	   && passnr >= as_fixparams.as_startbackboneusage_inpass
+	   && ! as_fixparams.as_backbone_alsobuildnewcontigs){
+	  assemblymode_mapping=true;
+	}
+
+	CEBUG("assemblymode_mapping: " << assemblymode_mapping << '\n');
+
+	// if we have Solexa or Solid mapping, first round shall be
+	//  without any error, then slowly increase until
+	if(assemblymode_mapping
+	   && (AS_seqtypespresent[Read::SEQTYPE_SOLEXA]
+	       || AS_seqtypespresent[Read::SEQTYPE_ABISOLID])){
+
+	  if(1){
+	    cout << "Gogo: 100% mapping\n";
+	    buildcon.setSpecialSRAddConditions(0,0,0);
+	    paf.constructStepByStep(aligncache,
+				    &AS_used_ids,
+				    &pf_ids_in_contig,
+				    &AS_multicopies,
+				    &AS_hasmcoverlaps,
+				    &AS_istroublemaker,
+				    &tmp_lowerbound_oedges,
+				    &AS_clipright,
+				    buildcon);
+	    buildcon.setCoutType(Contig::AS_TEXT);buildcon.stats(cout);
+	    cout << "\nbfc debug checkpoint" << endl;
+	    //assout::saveAsCAF(con, "bfcdebug_m0.caf", true);
+	    cout << "done" << endl;
+
+	    if(AS_miraparams[0].getAlignParams().al_solexahack_maxerrors>0 && paf.getReadAddAttempts()>0) {
+	      cout << "Gogo: mapping 1 mismatch\n";
+	      if(as_fixparams.as_dateoutput) dateStamp(cout);
+	      //buildcon.allowedRefIDs_allowSomeRailsOnShortReadCoverage(
+	      //  6,-1,Read::SEQTYPE_SOLEXA);
+	      buildcon.setSpecialSRAddConditions(1,0,1);
+	      paf.constructStepByStep(aligncache,
+				      &AS_used_ids,
+				      &pf_ids_in_contig,
+				      &AS_multicopies,
+				      &AS_hasmcoverlaps,
+				      &AS_istroublemaker,
+				      &tmp_lowerbound_oedges,
+				      &AS_clipright,
+				      buildcon);
+	      //buildcon.allowedRefIDs_forbidAll();
+	      buildcon.setCoutType(Contig::AS_TEXT);buildcon.stats(cout);
+	      cout << "\nbfc debug checkpoint" << endl;
+	      //assout::saveAsCAF(con, "bfcdebug_m1.caf", true);
+	      cout << "done" << endl;
+	    
+	      cout << "Gogo: mapping 1 gap\n";
+	      if(as_fixparams.as_dateoutput) dateStamp(cout);
+	      //buildcon.allowedRefIDs_allowSomeRailsOnShortReadCoverage(
+	      //  6,-1,Read::SEQTYPE_SOLEXA);
+	      buildcon.setSpecialSRAddConditions(1,-1,0);
+	      paf.constructStepByStep(aligncache,
+				      &AS_used_ids,
+				      &pf_ids_in_contig,
+				      &AS_multicopies,
+				      &AS_hasmcoverlaps,
+				      &AS_istroublemaker,
+				      &tmp_lowerbound_oedges,
+				      &AS_clipright,
+				      buildcon);
+	      //buildcon.allowedRefIDs_forbidAll();
+	      buildcon.setCoutType(Contig::AS_TEXT);buildcon.stats(cout);
+	      cout << "\nbfc debug checkpoint" << endl;
+	      //assout::saveAsCAF(con, "bfcdebug_m1g.caf", true);
+	      cout << "done" << endl;
+	    }
+
+	    if(AS_miraparams[0].getAlignParams().al_solexahack_maxerrors>1 && paf.getReadAddAttempts()>0) {
+	      cout << "Gogo: mapping 2 mismatches\n";
+	      if(as_fixparams.as_dateoutput) dateStamp(cout);
+	      //buildcon.allowedRefIDs_allowSomeRailsOnShortReadCoverage(
+	      //  8,-1,Read::SEQTYPE_SOLEXA);
+	      buildcon.setSpecialSRAddConditions(2,0,2);
+	      paf.constructStepByStep(aligncache,
+				      &AS_used_ids,
+				      &pf_ids_in_contig,
+				      &AS_multicopies,
+				      &AS_hasmcoverlaps,
+				      &AS_istroublemaker,
+				      &tmp_lowerbound_oedges,
+				      &AS_clipright,
+				      buildcon);
+	      //buildcon.allowedRefIDs_forbidAll();
+	      buildcon.setCoutType(Contig::AS_TEXT);buildcon.stats(cout);
+	      cout << "\nbfc debug checkpoint" << endl;
+	      //assout::saveAsCAF(con, "bfcdebug_m2.caf", true);
+	      cout << "done" << endl;
+	    
+	      cout << "Gogo: mapping 1 gap, 1 mismatch\n";
+	      if(as_fixparams.as_dateoutput) dateStamp(cout);
+	      //buildcon.allowedRefIDs_allowSomeRailsOnShortReadCoverage(
+	      //  8,-1,Read::SEQTYPE_SOLEXA);
+	      buildcon.setSpecialSRAddConditions(2,1,1);
+	      paf.constructStepByStep(aligncache,
+				      &AS_used_ids,
+				      &pf_ids_in_contig,
+				      &AS_multicopies,
+				      &AS_hasmcoverlaps,
+				      &AS_istroublemaker,
+				      &tmp_lowerbound_oedges,
+				      &AS_clipright,
+				      buildcon);
+	      //buildcon.allowedRefIDs_forbidAll();
+	      buildcon.setCoutType(Contig::AS_TEXT);buildcon.stats(cout);
+	      cout << "\nbfc debug checkpoint" << endl;
+	      //assout::saveAsCAF(con, "bfcdebug_m2m1g1.caf", true);
+	      cout << "done" << endl;
+	    
+	      cout << "Gogo: mapping 2 errors (==remaining 2 gaps)\n";
+	      if(as_fixparams.as_dateoutput) dateStamp(cout);
+	      //buildcon.allowedRefIDs_allowSomeRailsOnShortReadCoverage(
+	      //  8,-1,Read::SEQTYPE_SOLEXA);
+	      buildcon.setSpecialSRAddConditions(2,-1,-1);
+	      paf.constructStepByStep(aligncache,
+				      &AS_used_ids,
+				      &pf_ids_in_contig,
+				      &AS_multicopies,
+				      &AS_hasmcoverlaps,
+				      &AS_istroublemaker,
+				      &tmp_lowerbound_oedges,
+				      &AS_clipright,
+				      buildcon);
+	      //buildcon.allowedRefIDs_forbidAll();
+	      buildcon.setCoutType(Contig::AS_TEXT);buildcon.stats(cout);
+	      cout << "\nbfc debug checkpoint" << endl;
+	      //assout::saveAsCAF(con, "bfcdebug_m2g2.caf", true);
+	      cout << "done" << endl;
+	    }
+
+	    for(uint32 numerr=3; numerr<=AS_miraparams[0].getAlignParams().al_solexahack_maxerrors; numerr++){
+	      if(paf.getReadAddAttempts()==0) break;
+	      cout << "Gogo: mapping all " << numerr << " errors\n";
+	      if(as_fixparams.as_dateoutput) dateStamp(cout);
+	      buildcon.setSpecialSRAddConditions(numerr,-1,-1);
+	      paf.constructStepByStep(aligncache,
+				      &AS_used_ids,
+				      &pf_ids_in_contig,
+				      &AS_multicopies,
+				      &AS_hasmcoverlaps,
+				      &AS_istroublemaker,
+				      &tmp_lowerbound_oedges,
+				      &AS_clipright,
+				      buildcon);
+	      buildcon.setCoutType(Contig::AS_TEXT);buildcon.stats(cout);
+	      cout << "\nbfc debug checkpoint" << endl;
+	      //assout::saveAsCAF(con, "bfcdebug_m2g2.caf", true);
+	      cout << "done" << endl;
+	    }
+
+
+	  }else{
+	    cout << "Gogo: mapping 1 gap\n";
+	    if(as_fixparams.as_dateoutput) dateStamp(cout);
+
+	    buildcon.setSpecialSRAddConditions(1,1,0);
+	    paf.constructStepByStep(aligncache,
+				    &AS_used_ids,
+				    &pf_ids_in_contig,
+				    &AS_multicopies,
+				    &AS_hasmcoverlaps,
+				    &AS_istroublemaker,
+				    &tmp_lowerbound_oedges,
+				    &AS_clipright,
+				    buildcon);
+	    buildcon.setCoutType(Contig::AS_TEXT);buildcon.stats(cout);
+	    cout << "\nbfc debug checkpoint" << endl;
+	    //assout::saveAsCAF(con, "bfcdebug_m1g.caf", true);
+	    cout << "done" << endl;
+
+	    cout << "Gogo: mapping 2 gaps\n";
+	    buildcon.setSpecialSRAddConditions(2,2,0);
+	    paf.constructStepByStep(aligncache,
+				    &AS_used_ids,
+				    &pf_ids_in_contig,
+				    &AS_multicopies,
+				    &AS_hasmcoverlaps,
+				    &AS_istroublemaker,
+				    &tmp_lowerbound_oedges,
+				    &AS_clipright,
+				    buildcon);
+	    buildcon.setCoutType(Contig::AS_TEXT);buildcon.stats(cout);
+	    cout << "\nbfc debug checkpoint" << endl;
+	    //assout::saveAsCAF(con, "bfcdebug_m1g.caf", true);
+	    cout << "done" << endl;
+
+	    cout << "Gogo: mapping 3 gaps\n";
+	    buildcon.setSpecialSRAddConditions(3,3,0);
+	    paf.constructStepByStep(aligncache,
+				    &AS_used_ids,
+				    &pf_ids_in_contig,
+				    &AS_multicopies,
+				    &AS_hasmcoverlaps,
+				    &AS_istroublemaker,
+				    &tmp_lowerbound_oedges,
+				    &AS_clipright,
+				    buildcon);
+	    buildcon.setCoutType(Contig::AS_TEXT);buildcon.stats(cout);
+	    cout << "\nbfc debug checkpoint" << endl;
+	    //assout::saveAsCAF(con, "bfcdebug_m1g.caf", true);
+	    cout << "done" << endl;
+
+	    cout << "Gogo: mapping 1 gap, 1 mismatch\n";
+	    if(as_fixparams.as_dateoutput) dateStamp(cout);
+	    //buildcon.allowedRefIDs_allowSomeRailsOnShortReadCoverage(
+	    //  8,-1,Read::SEQTYPE_SOLEXA);
+	    buildcon.setSpecialSRAddConditions(2,1,1);
+	    paf.constructStepByStep(aligncache,
+				    &AS_used_ids,
+				    &pf_ids_in_contig,
+				    &AS_multicopies,
+				    &AS_hasmcoverlaps,
+				    &AS_istroublemaker,
+				    &tmp_lowerbound_oedges,
+				    &AS_clipright,
+				    buildcon);
+	    //buildcon.allowedRefIDs_forbidAll();
+	    buildcon.setCoutType(Contig::AS_TEXT);buildcon.stats(cout);
+	    cout << "\nbfc debug checkpoint" << endl;
+	    //assout::saveAsCAF(con, "bfcdebug_m2m1g1.caf", true);
+	    cout << "done" << endl;
+
+
+	    cout << "Gogo: mapping 2 gaps, 1 mismatch\n";
+	    if(as_fixparams.as_dateoutput) dateStamp(cout);
+	    //buildcon.allowedRefIDs_allowSomeRailsOnShortReadCoverage(
+	    //  8,-1,Read::SEQTYPE_SOLEXA);
+	    buildcon.setSpecialSRAddConditions(3,2,1);
+	    paf.constructStepByStep(aligncache,
+				    &AS_used_ids,
+				    &pf_ids_in_contig,
+				    &AS_multicopies,
+				    &AS_hasmcoverlaps,
+				    &AS_istroublemaker,
+				    &tmp_lowerbound_oedges,
+				    &AS_clipright,
+				    buildcon);
+	    //buildcon.allowedRefIDs_forbidAll();
+	    buildcon.setCoutType(Contig::AS_TEXT);buildcon.stats(cout);
+	    cout << "\nbfc debug checkpoint" << endl;
+	    //assout::saveAsCAF(con, "bfcdebug_m2m1g1.caf", true);
+	    cout << "done" << endl;
+
+	    cout << "Gogo: mapping 1 gap, 2 mismatches\n";
+	    if(as_fixparams.as_dateoutput) dateStamp(cout);
+	    //buildcon.allowedRefIDs_allowSomeRailsOnShortReadCoverage(
+	    //  8,-1,Read::SEQTYPE_SOLEXA);
+	    buildcon.setSpecialSRAddConditions(3,1,2);
+	    paf.constructStepByStep(aligncache,
+				    &AS_used_ids,
+				    &pf_ids_in_contig,
+				    &AS_multicopies,
+				    &AS_hasmcoverlaps,
+				    &AS_istroublemaker,
+				    &tmp_lowerbound_oedges,
+				    &AS_clipright,
+				    buildcon);
+	    //buildcon.allowedRefIDs_forbidAll();
+	    buildcon.setCoutType(Contig::AS_TEXT);buildcon.stats(cout);
+	    cout << "\nbfc debug checkpoint" << endl;
+	    //assout::saveAsCAF(con, "bfcdebug_m2m1g1.caf", true);
+	    cout << "done" << endl;
+
+	    // ----------------------------------------------------
+
+	    cout << "Gogo: 100% mapping\n";
+	    buildcon.setSpecialSRAddConditions(0,0,0);
+	    paf.constructStepByStep(aligncache,
+				    &AS_used_ids,
+				    &pf_ids_in_contig,
+				    &AS_multicopies,
+				    &AS_hasmcoverlaps,
+				    &AS_istroublemaker,
+				    &tmp_lowerbound_oedges,
+				    &AS_clipright,
+				    buildcon);
+	    buildcon.setCoutType(Contig::AS_TEXT);buildcon.stats(cout);
+	    cout << "\nbfc debug checkpoint" << endl;
+	    //assout::saveAsCAF(con, "bfcdebug_m0.caf", true);
+	    cout << "done" << endl;
+
+	    if(AS_miraparams[0].getAlignParams().al_solexahack_maxerrors>0) {
+	      cout << "Gogo: mapping 1 mismatch\n";
+	      if(as_fixparams.as_dateoutput) dateStamp(cout);
+	      //buildcon.allowedRefIDs_allowSomeRailsOnShortReadCoverage(
+	      //  6,-1,Read::SEQTYPE_SOLEXA);
+	      buildcon.setSpecialSRAddConditions(1,0,1);
+	      paf.constructStepByStep(aligncache,
+				      &AS_used_ids,
+				      &pf_ids_in_contig,
+				      &AS_multicopies,
+				      &AS_hasmcoverlaps,
+				      &AS_istroublemaker,
+				      &tmp_lowerbound_oedges,
+				      &AS_clipright,
+				      buildcon);
+	      //buildcon.allowedRefIDs_forbidAll();
+	      buildcon.setCoutType(Contig::AS_TEXT);buildcon.stats(cout);
+	      cout << "\nbfc debug checkpoint" << endl;
+	      //assout::saveAsCAF(con, "bfcdebug_m1.caf", true);
+	      cout << "done" << endl;
+	    
+	    }
+
+	    if(AS_miraparams[0].getAlignParams().al_solexahack_maxerrors>1) {
+	      cout << "Gogo: mapping 2 mismatches\n";
+	      if(as_fixparams.as_dateoutput) dateStamp(cout);
+	      //buildcon.allowedRefIDs_allowSomeRailsOnShortReadCoverage(
+	      //  8,-1,Read::SEQTYPE_SOLEXA);
+	      buildcon.setSpecialSRAddConditions(2,0,2);
+	      paf.constructStepByStep(aligncache,
+				      &AS_used_ids,
+				      &pf_ids_in_contig,
+				      &AS_multicopies,
+				      &AS_hasmcoverlaps,
+				      &AS_istroublemaker,
+				      &tmp_lowerbound_oedges,
+				      &AS_clipright,
+				      buildcon);
+	      //buildcon.allowedRefIDs_forbidAll();
+	      buildcon.setCoutType(Contig::AS_TEXT);buildcon.stats(cout);
+	      cout << "\nbfc debug checkpoint" << endl;
+	      //assout::saveAsCAF(con, "bfcdebug_m2.caf", true);
+	      cout << "done" << endl;
+	    
+	    
+	      cout << "Gogo: mapping 2 errors (==remaining 2 gaps)\n";
+	      if(as_fixparams.as_dateoutput) dateStamp(cout);
+	      //buildcon.allowedRefIDs_allowSomeRailsOnShortReadCoverage(
+	      //  8,-1,Read::SEQTYPE_SOLEXA);
+	      buildcon.setSpecialSRAddConditions(2,-1,-1);
+	      paf.constructStepByStep(aligncache,
+				      &AS_used_ids,
+				      &pf_ids_in_contig,
+				      &AS_multicopies,
+				      &AS_hasmcoverlaps,
+				      &AS_istroublemaker,
+				      &tmp_lowerbound_oedges,
+				      &AS_clipright,
+				      buildcon);
+	      //buildcon.allowedRefIDs_forbidAll();
+	      buildcon.setCoutType(Contig::AS_TEXT);buildcon.stats(cout);
+	      cout << "\nbfc debug checkpoint" << endl;
+	      //assout::saveAsCAF(con, "bfcdebug_m2g2.caf", true);
+	      cout << "done" << endl;
+	    }
+
+	    for(uint32 numerr=3; numerr<=AS_miraparams[0].getAlignParams().al_solexahack_maxerrors; numerr++){
+	      cout << "Gogo: mapping all " << numerr << " errors\n";
+	      if(as_fixparams.as_dateoutput) dateStamp(cout);
+	      buildcon.setSpecialSRAddConditions(numerr,-1,-1);
+	      paf.constructStepByStep(aligncache,
+				      &AS_used_ids,
+				      &pf_ids_in_contig,
+				      &AS_multicopies,
+				      &AS_hasmcoverlaps,
+				      &AS_istroublemaker,
+				      &tmp_lowerbound_oedges,
+				      &AS_clipright,
+				      buildcon);
+	      buildcon.setCoutType(Contig::AS_TEXT);buildcon.stats(cout);
+	      cout << "\nbfc debug checkpoint" << endl;
+	      //assout::saveAsCAF(con, "bfcdebug_m2g2.caf", true);
+	      cout << "done" << endl;
+	    }
+	  }
+
+
+
+
+	  // TODO: hack until there's a routine that only clears tags set by the
+	  //  makeIntelligentConsensus() functions.
+	  buildcon.clearConsensusTags();
+
+	}else{
+#ifdef CLOCK_STEPS2
+	  gettimeofday(&tv,NULL);
+#endif
+
+	  CEBUG("use genomic pathfinder: " << AS_miraparams[0].getPathfinderParams().paf_use_genomic_algorithms << '\n');
+	  if(AS_miraparams[0].getPathfinderParams().paf_use_genomic_algorithms){
+	    paf.n4_constructStepByStep(aligncache,
+				       &AS_used_ids,
+				       &pf_ids_in_contig,
+				       &AS_multicopies,
+				       &AS_hasmcoverlaps,
+				       &AS_istroublemaker,
+				       &tmp_lowerbound_oedges,
+				       &AS_clipright,
+				       &AS_wellconnected,
+				       buildcon);
+	  }else{
+	    // EST routines also use new version
+	    paf.n4_constructStepByStep(aligncache,
+				       &AS_used_ids,
+				       &pf_ids_in_contig,
+				       &AS_multicopies,
+				       &AS_hasmcoverlaps,
+				       &AS_istroublemaker,
+				       &tmp_lowerbound_oedges,
+				       &AS_clipright,
+				       &AS_wellconnected,
+				       buildcon);
+	  }
+
+#ifdef CLOCK_STEPS2
+	  cout << "Timing BFC paf construct: " << diffsuseconds(tv) << endl;
+#endif
+
+	  // as n4_* will completely use start cache for starting ID of contig build, ask the pathfinder
+	  //  whether there are any left in cache. Trigger moving small clusters to debris if not
+	  if(shouldmovesmallclusterstodebris && paf.n4_getNumElementsInStartCache()==0){
+	    cout << "Triggering additional cluster check.\n";
+	    bfc_moveSmallClustersToDebris();
+	  }
+	}
+
+	CEBUG("bfc 9/"<<iter << '\n');
+
+	bool contigok=bfc_checkIfContigMeetsRequirements(buildcon);
+	if(!contigok){
+	  newreptmarked=false;
+
+	  // this contig won't be taken, but contig numbering would
+	  //  go up in next loop. 
+	  // Countermeasure: decrease contig number by one to have the
+	  //  loop increase it afterwards, effectivly re-using same contig number
+	  --numcontigs;
+
+	  // break out of the iter loop
+	  break;
+	}
+
+	if(buildcon.getContigLength()>5 && buildcon.getNumReadsInContig()>1){
+	  if(as_fixparams.as_put_asswithmira_tags){
+	    buildcon.addTagToConsensus(0, 
+				       4,
+				       '=', 
+				       "MIRA", 
+				       "Assembled with MIRA",
+				       false);
+	  }
+	}
+
+	cout << "\n\nFinished building." << endl;
+
+	try {
+	  if(buildcon.getNumReadsInContig()>1){
+	    if(as_fixparams.as_dateoutput) dateStamp(cout);
+	    if(buildcon.getContigLength()>100000){
+	      cout << "Calculating statistics (this may take a while)." << endl;
+	    }
+
+#ifdef CLOCK_STEPS2
+	    gettimeofday(&tv,NULL);
+#endif
+	    // see whether we can define new multicopies
+	    if(as_fixparams.as_automatic_repeat_detection){
+	      buildcon.analyseReadCoverage(AS_maxcoveragereached,
+				      AS_multicopies,
+				      AS_coverageperseqtype);
+	    }
+#ifdef CLOCK_STEPS2
+	    cout << "Timing BFC analysereadcov: " << diffsuseconds(tv) << endl;
+	    gettimeofday(&tv,NULL);
+#endif
+
+	    buildcon.setCoutType(Contig::AS_TEXT);
+	    buildcon.stats(cout);
+
+#ifdef CLOCK_STEPS2
+	    cout << "Timing BFC cout constats: " << diffsuseconds(tv) << endl;
+#endif
+	    
+	    if(as_fixparams.as_dateoutput) dateStamp(cout);
+//	  }else{
+//	    cout << "Is singlet.\n";
+//	    numsingletssincecleanup++;
+//	    if(maykillintermediatesinmglets && numsingletssincecleanup>=20){
+//#ifdef CLOCK_STEPS2
+//	      gettimeofday(&tv,NULL);
+//#endif
+//	      cout << "Converted " << bfc_killIntermediateSinglets() << " intermediate singlets into debris.\n";
+//#ifdef CLOCK_STEPS2
+//	      cout << "Timing BFC kill singlets: " << diffsuseconds(tv) << endl;
+//#endif
+//	      numsingletssincecleanup=0;
+//	    }
+	  }
+	}
+	catch (Notify n) {
+	  n.setGravity(Notify::FATAL);
+	  n.handleError(n.tif);
+	}
+	catch (...) {
+	  cerr << "Darn, error with that contig. See darn.fasta.\n";
+	  vector<Contig::contigread_t>::const_iterator I=buildcon.getContigReads().begin(); 
+	  while(I != buildcon.getContigReads().end()) {
+	    Read::setCoutType(Read::AS_CLIPPEDFASTA);
+	    cout << I->read;
+	    I++;
+	  }
+	  abort();
+	}
+
+	CEBUG("bfc 10/"<<iter << '\n');
+
+	string basename_forextsave;
+	{
+	  ostringstream ostr;
+	  ostr << dir_params.dir_tmp << "/miratmp.pass_" << passnr << "_cb" << numcontigs << "_i" << iter << "_";
+	  
+	  basename_forextsave=ostr.str();
+	}
+	// saving pre-edit
+	saveExtTmpContig(buildcon,(basename_forextsave+"pre"));
+
+	bool wasedited=false;
+	newreptmarked=false;
+
+#ifdef CLOCK_STEPS2
+	gettimeofday(&tv,NULL);
+#endif
+
+
+// doesn't work really well
+//	if(buildcon.hasPacBioData() && iter < 1){
+//	  if(mastermayeditovercalls){
+//	    buildcon.deleteStarOnlyColumns(0, buildcon.getContigLength()-1,true,2);
+//	    wasovercalledited=true;
+//	    contignotok=true;
+//	    
+//	    // another iteration is needed to get a valid contig
+//	    if(maxiter<2) maxiter=2;
+//	  }
+//	}else{
+
+	bool goforit=true;
+	//if(buildcon.hasPacBioData() && iter < 1){
+	pbdsev.clear();
+	if(buildcon.hasPacBioData() && !(lastpass && iter==maxiter-1)){
+	  uint32 maxcorrect=buildcon.createPacBioDarkStrobeEdits(pbdsev);
+
+	  CEBUG("PacBio maxcorrect: " << maxcorrect << endl);
+
+	  if(maxcorrect>5) {
+	    goforit=false;
+	    wasmajorovercalledited=true;
+	  }
+
+	  // another iteration is needed to get a valid contig
+	  //if(maxiter<2) maxiter=2;
+	}
+
+	if(goforit){
+	  // handling of 454 / Solexa data
+	  mayeditovercalls=buildcon.hasEditableOvercallData() & mastermayeditovercalls;
+
+
+	  vector<bool> readsmarkedsrm;
+
+	  // if 454 data present, mark areas with tricky overcalls
+	  // in those areas, no repeat marker may be set
+	  // do this always
+	  if(mayeditovercalls && buildcon.getNumReadsInContig() >1){
+	    cout << "\nMarking tricky 454 / Solexa overcalls in temporary contig.\n";
+	    cout << "Marked " << buildcon.editTrickyOvercalls(true,false,readsmarkedsrm) << " reads.\n";
+	  }
+
+#ifdef CLOCK_STEPS2
+	  cout << "Timing BFC edit tricky1: " << diffsuseconds(tv) << endl;
+	  gettimeofday(&tv,NULL);
+#endif
+
+	  if(buildcon.getNumReadsInContig() <= 8) mayeditovercalls=false;
+
+	  markrepeatsduringstore=true;
+	  if(as_fixparams.as_mark_repeats
+	     && !as_fixparams.as_mark_repeats_onlyinresult
+	     && buildcon.getNumReadsInContig() >1){
+	    newreptmarked=markRepeats(buildcon, readsmarkedsrm);
+	    foundSRMs|=newreptmarked;
+	    markrepeatsduringstore=false;
+	  }
+	  
+#ifdef CLOCK_STEPS2
+	  cout << "Timing BFC mark reps: " << diffsuseconds(tv) << endl;
+	  gettimeofday(&tv,NULL);
+#endif
+
+	  CEBUG("bfc 11/"<<iter << '\n');
+
+	  // edit only when no misassembled repeats found
+	  //  this is to prevent the editor to try something foolish on
+	  //  misassembled things
+	  // same applies to overcall editing
+	  //
+
+	  wasovercalledited=false;
+
+	  if(!newreptmarked && mayeditovercalls && buildcon.getNumReadsInContig() >1){
+	    cout << "Editing tricky 454 / Solexa overcalls";
+	    //if(newreptmarked){
+	    //  cout << ", but not when reads with SRMs are involved";
+	    //}
+	    cout << ".\n";
+	    //uint32 nummarks=buildcon.edit454TrickyOvercalls(false,newreptmarked);
+	    uint32 nummarks=buildcon.editTrickyOvercalls(false,false,readsmarkedsrm);
+	    cout << "Edited " << nummarks << " reads.\n";
+	    wasovercalledited=nummarks>0;
+
+	    // major edit is edits in >=5% of the reads
+	    wasmajorovercalledited=(nummarks >= buildcon.getNumReadsInContig()/20);
+
+//#if DEVELOPMENTVERSION == 0
+	    if(wasovercalledited){
+	      AS_needsskimfornastyrepeats=true;
+	      cout << "Deleting superfluous gap columns ... ";
+	      cout.flush();
+	      buildcon.deleteStarOnlyColumns(0, buildcon.getContigLength()-1);
+	      cout << "done.\n";
+	    }
+//#endif
+#ifdef CLOCK_STEPS2
+	    cout << "Timing BFC edit tricky2: " << diffsuseconds(tv) << endl;
+	    gettimeofday(&tv,NULL);
+#endif
+	  }
+
+	  // BaCh 29.04.2011
+	  // However, editSingleDiscrepancyNoHAFTag() is conservative enough to allow
+	  //  that kind of edits all the time
+	  //
+
+	  if(buildcon.getNumReadsInContig() >4){
+	    uint32 numedits=buildcon.editSingleDiscrepancyNoHAFTag(readsmarkedsrm);
+	    cout << "\nEdited " << numedits << " positions.\n";
+	    if(numedits>0){
+	      AS_needsskimfornastyrepeats=true;
+	      cout << "Deleting superfluous gap columns ... ";
+	      cout.flush();
+	      buildcon.deleteStarOnlyColumns(0, buildcon.getContigLength()-1);
+	      cout << "done.\n";
+	    }
+#ifdef CLOCK_STEPS2
+	    cout << "Timing BFC edit single discrepancy, no HAF: " << diffsuseconds(tv) << endl;
+	    gettimeofday(&tv,NULL);
+#endif
+	  }
+
+	  // if we're in last pass and 454 / pacbio edits were made, loop at least
+	  //  once (switching off the 454 / pacbio edits for next pass)
+	  if(lastpass 
+	     && wasovercalledited
+	     && iter==maxiter-1){
+	    if(maxiter>=1) {
+	      mastermayeditovercalls=false;
+	    }
+	    maxiter++;
+	  }
+
+	  CEBUG("bfc 12/"<<iter << '\n');
+
+#ifdef CLOCK_STEPS2
+	  gettimeofday(&tv,NULL);
+#endif
+	  // get rid of all PSHP tags
+	  buildcon.deleteTagsInReads(Read::REA_tagentry_idPSHP);
+#ifdef CLOCK_STEPS2
+	  cout << "Timing BFC delPSHP: " << diffsuseconds(tv) << endl;
+#endif
+
+	  CEBUG("bfc 13/"<<iter << '\n');
+
+#ifdef MIRA_HAS_EDIT
+	  if(!newreptmarked && ed_params.ed_automatic_contic_editing!=0){
+	    cout << "Editing temporary contig: ";
+	    if (buildcon.getNumReadsInContig() >1) {
+	      cout << endl;
+#ifdef CLOCK_STEPS2
+	      gettimeofday(&tv,NULL);
+#endif
+	      wasedited=true;
+
+	      editContigBack(buildcon, const_cast<EDITParameters &>(eparams));
+
+	      //ScfBuffer::statistics();
+	      //ScfBuffer::show();
+	      //ScfBuffer::discard();
+	      //ScfBuffer::statistics();
+	      //ScfBuffer::show();
+	    
+	      cout << "done.\nDeleting superfluous gap columns ... ";
+	      cout.flush();
+	      buildcon.deleteStarOnlyColumns(0, buildcon.getContigLength()-1);
+	      cout << "done.\n";
+	    
+#ifdef CLOCK_STEPS2
+	      cout << "Timing BFC editconback and more: " << diffsuseconds(tv) << endl;
+#endif
+	      Contig::setCoutType(Contig::AS_TEXT);
+	      if(as_fixparams.as_dateoutput) dateStamp(cout);
+	      buildcon.stats(cout);
+	      if(as_fixparams.as_dateoutput) dateStamp(cout);
+	    } else {
+	      cout << "(only 1 read in contig, no editing)\n";
+	    }
+	  }
+#endif
+
+
+	  CEBUG("bfc 14/"<<iter << '\n');
+	  
+	  // saving again if rept-marked or edited
+	  if(newreptmarked || wasedited || wasovercalledited) {
+	    if(wasovercalledited) {
+	      saveExtTmpContig(buildcon,(basename_forextsave+"post454"));
+	    } else {
+	      saveExtTmpContig(buildcon,(basename_forextsave+"post"));
+	    }
+	  } else {
+	    if ( as_fixparams.as_output_exttmp_fasta
+		 || as_fixparams.as_output_exttmp_ace
+		 || as_fixparams.as_output_exttmp_gap4da
+		 || as_fixparams.as_output_exttmp_caf) {
+	      cout << "No edit and no new repeat found, not saving extra temporary contig again.\n";
+	    }
+	  }
+	}
+
+
+	CEBUG("bfc 15/"<<iter << '\n');
+
+	CEBUG("bfc 16/"<<iter << '\n');
+
+	// Transfer all the reads fron the new contig into readpool
+	//  if no misassembly was detected (or 454 editing happened)
+#ifdef CLOCK_STEPS2
+	gettimeofday(&tv,NULL);
+#endif
+	if(!newreptmarked || wasovercalledited || !pbdsev.empty()) {
+	  transferContigReadsToReadpool(buildcon, pbdsev, passnr);
+
+#ifdef CLOCK_STEPS2
+	  cout << "Timing BFC rp transfer: " << diffsuseconds(tv) << endl;
+#endif
+	} else {
+	  cout << " Transfering read tags to readpool." << endl;
+	  transferContigReadTagsToReadpool(buildcon, bbContigI);
+#ifdef CLOCK_STEPS2
+	  cout << "Timing BFC crtag2rp transfer: " << diffsuseconds(tv) << endl;
+#endif
+	}
+	cout << "Done." << endl;
+
+	CEBUG("bfc 17/"<<iter << '\n');
+
+	//cout << "\nbfc debug checkpoint" << endl;
+	//assout::saveAsCAF(con, "bfcdebug.caf", true);
+	//cout << "done" << endl;
+	//
+	//abort();
+	
+      }
+
+      {
+	const vector<Contig::contigread_t> & cr=buildcon.getContigReads();
+	vector<Contig::contigread_t>::const_iterator crI=cr.begin();
+	
+	for(; crI!=cr.end(); crI++){
+	  if(crI->orpid>=0){
+	    AS_used_ids[crI->orpid]=1;
+	  }
+	}
+      }
+      pf_ids_in_contig.clear();
+
+      if(pbdsev.empty()
+	 && lastpass
+	 && as_fixparams.as_mark_repeats
+	 && as_fixparams.as_mark_repeats_onlyinresult
+	 && buildcon.getNumReadsInContig() >1){
+	CEBUG("bfc 18\n");
+#ifdef CLOCK_STEPS2
+	gettimeofday(&tv,NULL);
+#endif
+	vector<bool> dummy;
+	newreptmarked=markRepeats(buildcon, dummy);
+	foundSRMs|=newreptmarked;
+	markrepeatsduringstore=false;
+#ifdef CLOCK_STEPS2
+	cout << "Timing BFC markrep during store: " << diffsuseconds(tv) << endl;
+#endif
+      }
+
+      if(buildcon.getNumReadsInContig() >0){
+	if(newreptmarked){
+	  cout << "\nAccepting probably misassembled contig because of too many iterations.\n";
+	}
+
+	CEBUG("bfc 19\n");
+
+#ifdef CLOCK_STEPS2
+	gettimeofday(&tv,NULL);
+#endif
+	bfc_storeContig(buildcon,numcontigs,markrepeatsduringstore,passnr,lastpass);
+#ifdef CLOCK_STEPS2
+	cout << "Timing BFC store con: " << diffsuseconds(tv) << endl;
+#endif
+	
+	{
+	  if(buildcon.getContigLength()>=5000){
+	    cout << "Contig coverage analysis ";
+	    if(buildcon.getContigLength()>=100000){
+	      cout << "(this may take a while) ";
+	    }
+	    cout << "... "; cout.flush();
+	    const Contig::constats_t & cs=buildcon.getStats();
+	    for(uint32 st=0; st<Read::SEQTYPE_END; st++){
+	      covperstpercon[st].push_back(static_cast<uint32>(cs.avg_covperst[st]+.5));
+	      //cout << "cccccccccccc: " << covperstpercon[st].back() << endl;
+	    }
+	  }
+	}
+
+	// did the caller to assemble() ask for a callback for each contig built?
+	// if we're on the last past, then call it
+	if(lastpass && AS_contigbuilt_callbackfunc!=NULL){
+	  (*AS_contigbuilt_callbackfunc)(buildcon, AS_readpool);
+	}
+
+	if(as_fixparams.as_spoilerdetection) {
+	  //if(as_fixparams.as_keepcontigsinmem) {
+	  //	if(!as_fixparams.as_spdetect_lastpassonly
+	  //	   || actpass==as_fixparams.as_numpasses-1) {
+	  //	  huntPossibleContigJoinGrinches(actpass);
+	  //	}
+	  //}
+	  
+	  if(!as_fixparams.as_spdetect_lastpassonly
+	     || passnr==as_fixparams.as_numpasses-1) {
+	    huntSpoilSports(buildcon);
+	  }
+	}
+      }
+
+      // if we were in mapping mode, on the last contig and not also building 
+      //  new contigs, move all remaining reads to debris
+
+      if( !as_fixparams.as_backbone_alsobuildnewcontigs
+	  && bbContigI != AS_bbcontigs.end()){
+	++bbContigI;  // don't bother to decrease after using this ... will be re-init in next loop anyway
+	if(bbContigI == AS_bbcontigs.end()){
+	  uint32 adddebris=0;
+	  for(size_t uid=0; uid<AS_used_ids.size(); ++uid){
+	    if(AS_used_ids[uid]==0){
+	      ++adddebris;
+	      AS_isdebris[uid]=1;
+	      AS_used_ids[uid]=1;
+	    }
+	  }
+	  cout << "Last backbone mapped, not building new ones.\nMoved " << adddebris << " remaining reads to debris.\n"; 
+	}
+      }  
+    }
+    //unused=0;
+#ifdef CLOCK_STEPS2
+    cout << "Timing BFC loop total: " << diffsuseconds(tvloop) << endl;
+#endif
+  }   //while(unused>0...
+
+  if(unused>0){
+    // unused reads? we jumped out of contig creation
+    // define unused reads as debris
+    for(size_t uid=0; uid<AS_used_ids.size(); ++uid){
+      if(AS_used_ids[uid]==0){
+	AS_isdebris[uid]=1;
+	AS_used_ids[uid]=1;
+      }
     }
-    bopsize=static_cast<size_t>(n);
-  }else{
-    MIRANOTIFY(Notify::FATAL,"Error reading first line of " << filename);
-  }
-  if(bopsize==0){
-    MIRANOTIFY(Notify::FATAL,"Ooooooops, first line should have positive number: " << filename);
   }
-  if(bopsize!=AS_readpool.size()){
-    MIRANOTIFY(Notify::FATAL,"Ooooooops, : size of read pool in " << filename  << " (" << bopsize << ") is not equal to size of current readpool (" << AS_readpool.size() << ") ???");
+
+  if(lastpass) {
+    saveDebrisList();
+  }else{
+    saveDebrisList(passnr, "", "_pass");
   }
-  AS_permanent_overlap_bans.nuke();
-  AS_permanent_overlap_bans.resize(bopsize);
-  vector<uint32> tmpvec;
-  while(getline(fin,tmpline)){
-    substrs.clear();
-    boost::trim(tmpline);
-    if(tmpline.empty()){
-      MIRANOTIFY(Notify::FATAL,"empty line in " << filename << " is not expected");
-    }
-    boost::split(substrs, tmpline, boost::is_any_of(" \t"));
-    if(substrs.size()<2){
-      cout << "Faulty line, need more elements:\n" << tmpline << endl;
-      MIRANOTIFY(Notify::FATAL,"empty line in " << filename << " is not expected");
+
+  // reads that are debris or singlets apparently need every chance
+  //  they can get to align, therefore subsequent passes should not
+  //  reduce the overlaps
+  // Change: for Solexa reads ... sorry, we'll just miss out
+  {
+    for(uint32 i=0; i<AS_needalloverlaps.size(); i++){
+      if(AS_isdebris[i] && AS_readpool[i].getSequencingType() != Read::SEQTYPE_SOLEXA) AS_needalloverlaps[i]=true;
     }
-    auto sI=substrs.begin();
-    size_t rid=0;
-    {
-      auto n=atoll(sI->c_str());
-      if(n<0){
-	cout << "Faulty line, has negative first value:\n" << tmpline << endl;
-	MIRANOTIFY(Notify::FATAL,"Ooooooops, first value should value >= 0: " << filename);
+
+    list<Contig>::const_iterator clI=AS_contigs.begin();
+    vector<int32> contigids;
+    for(; clI!=AS_contigs.end(); clI++){
+      if(clI->getNumReadsInContig()==1){
+	clI->getReadIDsAtContigPosition(contigids,0,0);
+	AS_needalloverlaps[contigids[0]]=true;
       }
-      rid=static_cast<size_t>(n);
     }
-    ++sI;
-    for(; sI!=substrs.end(); ++sI){
-      auto n=atoll(sI->c_str());
-      if(n<0){
-	cout << "Faulty line, has negative values:\n" << tmpline << endl;
-	MIRANOTIFY(Notify::FATAL,"negative value in " << filename << " is not expected");
-      }
-      tmpvec.push_back(static_cast<uint32>(n));
+  }
+
+  // calculate median of average contig coverage
+  // TODO: this is calculated only once because of problems
+  //  with decreasing average/median in subsequent passes
+  //  see if it can be improved
+  if(as_fixparams.as_uniform_read_distribution
+     && passnr+1>=as_fixparams.as_urd_startinpass
+     && !covperstpercon[0].empty() && AS_coverageperseqtype.empty()){
+    AS_coverageperseqtype.clear();
+
+    cout << "Setting coverage analysis values for uniform read distribution:\n";
+    for(uint32 st=0; st<Read::SEQTYPE_END; st++){
+      sort(covperstpercon[st].begin(),covperstpercon[st].end());
+      AS_coverageperseqtype.push_back(covperstpercon[st][covperstpercon[st].size()/2]);
+      cout << '\t' << Read::getNameOfSequencingType(st) << " coverage:\t" << AS_coverageperseqtype.back() << '\n';
     }
-    AS_permanent_overlap_bans.bop[rid].swap(tmpvec);
   }
+
+  AS_steps[ASCONTIGSOK]=1;
+
+  AS_used_ids.clear();
+
+  //  saveAsCAF();
+
+  FUNCEND();
+
+  return foundSRMs;
 }
 
+#define CEBUG(bla)
+
 
 
 /*************************************************************************
  *
  *
  *
- *
  *************************************************************************/
 
-void Assembly::saveResumeDataFPO(int32 version, const string & prefix, const string & postfix)
+uint32 Assembly::bfc_killIntermediateSinglets()
 {
-  FUNCSTART("void Assembly::saveResumeDataFPO()");
-
-  string filename(buildFileName(version,
-					 prefix,
-					 postfix,
-					 AS_miraparams[0].getAssemblyParams().as_tmpf_wellconnected,
-					 ".bin"));
-
-  bool allok=true;
-  if(saveVector(AS_wellconnected,filename)){
-    filename=buildFileName(version, "", "_pass",
-			   AS_miraparams[0].getAssemblyParams().as_tmpf_debrisreason,
-			   ".bin");
-    if(saveVector(AS_debrisreason,filename)){
-      filename=buildFileName(version, "", "_pass",
-			     AS_miraparams[0].getAssemblyParams().as_tmpf_skimmegahubs,
-			     ".bin");
-      if(saveVector(AS_skimmegahubs,filename)){
-	allok=true;
+  uint32 counter=0;
+
+  int32 lastrid1=-1;
+  int32 numopenoverlaps=-1;
+
+  vector<newedges_t>::const_iterator ceI=AS_confirmed_edges.begin();
+  for(;ceI!=AS_confirmed_edges.end();ceI++){
+    if(ceI->rid1 != lastrid1){
+      if(numopenoverlaps==0 && AS_used_ids[lastrid1]==0){
+	AS_isdebris[lastrid1]=1;
+	AS_used_ids[lastrid1]=1;
+	counter++;
       }
+      lastrid1=ceI->rid1;
+      numopenoverlaps=0;
+    }
+    //if(AS_isdebris[ceI->rid1] == 0
+    //   && AS_used_ids[ceI->rid1] == 0
+    //   && AS_isdebris[ceI->linked_with] == 0
+    //   && AS_used_ids[ceI->linked_with] == 0){
+    //  numopenoverlaps++;
+    //}
+    if(AS_used_ids[ceI->rid1] == 0
+       && AS_used_ids[ceI->linked_with] == 0){
+      numopenoverlaps++;
     }
   }
-  if(!allok){
-    MIRANOTIFY(Notify::FATAL, "Error while writing file " << filename << ". Is the disk full? Are permissions right?");
+  if(numopenoverlaps==0){
+    AS_isdebris[lastrid1]=1;
+    AS_used_ids[lastrid1]=1;
+    counter++;
   }
+
+  return counter;
 }
 
+
 /*************************************************************************
  *
  *
  *
- *
  *************************************************************************/
 
-void Assembly::loadResumeDataFPO(int32 version, const string & prefix, const string & postfix)
+void Assembly::bfc_moveSmallClustersToDebris()
 {
-  FUNCSTART("void Assembly::loadResumeDataFPO()");
-
-  string filename(buildFileName(version,
-				prefix,
-				postfix,
-				AS_miraparams[0].getAssemblyParams().as_tmpf_wellconnected,
-				".bin"));
-  bool allok=false;
-  AS_wellconnected.clear();
-  AS_debrisreason.clear();
-  AS_skimmegahubs.clear();
-  if(loadVector(AS_wellconnected,filename,0)){
-    filename=buildFileName(version, "", "_pass",
-			   AS_miraparams[0].getAssemblyParams().as_tmpf_debrisreason,
-			   ".bin");
-    if(loadVector(AS_debrisreason,filename,0)){
-      filename=buildFileName(version, "", "_pass",
-			     AS_miraparams[0].getAssemblyParams().as_tmpf_skimmegahubs,
-			     ".bin");
-      if(loadVector(AS_skimmegahubs,filename,0)){
-	allok=true;
+
+  cout << "Moving small clusters to debris:\n";
+
+  uint32 totaldebris=0;
+
+  vector<uint32> numreadsperst(Read::getNumSequencingTypes(),0);
+  vector<int32> clusteridperread;
+  vector<list<int32> > readinclusterlist;
+
+  clusterUnassembledReads(clusteridperread,readinclusterlist, AS_used_ids);
+
+  uint32 clustercount=0;
+
+  for(size_t ricli=0; ricli<readinclusterlist.size(); ricli++){
+    if(!readinclusterlist[ricli].empty()){
+      uint32 totalreadsincluster=0;
+      numreadsperst.clear();
+      numreadsperst.resize(Read::getNumSequencingTypes(),0);
+      {
+	list<int32>::const_iterator rI=readinclusterlist[ricli].begin();
+	for(; rI != readinclusterlist[ricli].end(); ++rI) {
+	  numreadsperst[AS_readpool[*rI].getSequencingType()]++;
+	  totalreadsincluster++;
+	}
+      }
+      bool takecluster=false;
+      for(size_t st=0; st<numreadsperst.size(); ++st){
+	if(numreadsperst[st]>0
+	   && totalreadsincluster>=AS_miraparams[st].getAssemblyParams().as_minimum_readspercontig){
+	  takecluster=true;
+	}
+      }
+      // the above also kill mapping reads
+      // therefore, first check whether an unsued rail is part of that cluster
+      //  if yes, then don't kill cluster
+      if(!takecluster){
+	list<int32>::const_iterator rI=readinclusterlist[ricli].begin();
+	for(; rI != readinclusterlist[ricli].end(); ++rI) {
+	  if(AS_readpool[*rI].isRail()){
+
+	    // should have this ... need to rework how as_usedids is filled (only after contig is made)
+	    //&& !AS_used_ids[*rI]){
+
+	    takecluster=false;
+	    break;
+	  }
+	}
+      }
+      if(!takecluster){
+	CEBUG("Killing cluster: " << ricli);
+	list<int32>::const_iterator rI=readinclusterlist[ricli].begin();
+	for(; rI != readinclusterlist[ricli].end(); ++rI) {
+	  CEBUG(" " << *rI);
+	  AS_isdebris[*rI]=1;
+	  AS_used_ids[*rI]=1;
+	  ++totaldebris;
+	}
+	CEBUG('\n');
       }
     }
   }
-  if(allok){
-    // checks?
-  }else{
-    MIRANOTIFY(Notify::FATAL, "Error while reading file " << filename << ". Is the file present and correct? Are permissions right?");
+
+  // clusterUnassembledReads() did not return orphans as cluster list
+  // therefore, look for unused read ids with no cluster number and also 
+  //  put them into debris
+
+  for(size_t uid=0; uid<AS_used_ids.size(); ++uid){
+    if(AS_used_ids[uid]==0 && clusteridperread[uid]==-1){
+      CEBUG("Killing orphan: " << uid << endl);
+      AS_isdebris[uid]=1;
+      AS_used_ids[uid]=1;
+      ++totaldebris;
+    }
   }
+
+  cout << "\nDone. " << totaldebris << " reads moved to debris.\n";
+
+  return;
 }
 
 
+
 /*************************************************************************
  *
- *
- *
+ * Checks if Contig meets specified requirements (atm: num of reads)
+ * 
+ * If not, mark the reads in the contig as debris and empty the contig
  *
  *************************************************************************/
 
-void Assembly::saveResumeDataMA(int32 version, const string & prefix, const string & postfix)
+bool Assembly::bfc_checkIfContigMeetsRequirements(Contig & con)
 {
-  FUNCSTART("void Assembly::saveResumeDataMA()");
-
-  //  need to save current overlap bans to tmp as makeAlignments could have created new ones
-  ssdBannedOverlaps(buildFileName(version, "", "_pass",
-				  AS_miraparams[0].getAssemblyParams().as_tmpf_banned_overlaps,
-				  ".txt"));
-
-  string filename(buildFileName(version, "", "_pass",
-				AS_miraparams[0].getAssemblyParams().as_tmpf_istroublemaker,
-				".bin"));
-  bool allok=false;
-  if(saveVector(AS_istroublemaker,filename)){
-    filename=buildFileName(version, "", "_pass",
-			   AS_miraparams[0].getAssemblyParams().as_tmpf_needalloverlaps,
-			   ".bin");
-    if(saveVector(AS_needalloverlaps,filename)){
-      filename=buildFileName(version, "", "_pass",
-			     AS_miraparams[0].getAssemblyParams().as_tmpf_multicopies,
-			     ".bin");
-      if(saveVector(AS_multicopies,filename)){
-	filename=buildFileName(version, "", "_pass",
-			       AS_miraparams[0].getAssemblyParams().as_tmpf_hasmcoverlap,
-			       ".bin");
-	if(saveVector(AS_hasmcoverlaps,filename)){
-	  allok=true;
+  bool contigok=false;
+
+  vector<uint32> numreadsperst(Read::getNumSequencingTypes(),0);
+  const vector<Contig::contigread_t> & conreads=con.getContigReads();
+  uint32 totalreadsincon=0;
+  {
+    vector<Contig::contigread_t>::const_iterator crI = conreads.begin();
+    for(;crI != conreads.end(); crI++){
+      if(crI->orpid >= 0){
+	if(crI->read.isBackbone()){
+	  contigok=true;
+	  break;
 	}
+	++numreadsperst[crI->read.getSequencingType()];
+	++totalreadsincon;
       }
     }
   }
-  if(!allok){
-    MIRANOTIFY(Notify::FATAL, "Error while writing file " << filename << ". Is the disk full? Are permissions right?");
+
+  if(!contigok){
+    for(size_t st=0; st<numreadsperst.size(); ++st){
+      if(numreadsperst[st]>0
+	 && totalreadsincon>=AS_miraparams[st].getAssemblyParams().as_minimum_readspercontig){
+	contigok=true;
+      }
+    }
   }
+
+  if(!contigok){
+    cout << "\nContig does not meet requirement of minimum reads per contig."
+      "\nMoving " << totalreadsincon << " reads to debris.\n";
+    vector<Contig::contigread_t>::const_iterator crI = conreads.begin();
+    for(;crI != conreads.end(); crI++){
+      if(crI->orpid >= 0){
+	AS_isdebris[crI->orpid]=1;
+	AS_used_ids[crI->orpid]=1;
+      }
+    }
+    con.discard();
+  }
+
+
+  return contigok;
 }
 
+
 /*************************************************************************
  *
  *
  *
- *
  *************************************************************************/
 
-void Assembly::loadResumeDataMA(int32 version, const string & prefix, const string & postfix)
+void Assembly::bfc_markRepReads(Contig & con)
 {
-  FUNCSTART("void Assembly::loadResumeDataMA()");
-  //  need to load banned overlaps
-  lsdBannedOverlaps(buildFileName(version, "", "_pass",
-				  AS_miraparams[0].getAssemblyParams().as_tmpf_banned_overlaps,
-				  ".txt"));
-
-  string filename(buildFileName(version, "", "_pass",
-				AS_miraparams[0].getAssemblyParams().as_tmpf_istroublemaker,
-				".bin"));
-  bool allok=false;
-  AS_istroublemaker.clear();
-  AS_needalloverlaps.clear();
-  AS_multicopies.clear();
-  AS_hasmcoverlaps.clear();
-  if(loadVector(AS_istroublemaker,filename,0)){
-    filename=buildFileName(version, "", "_pass",
-			   AS_miraparams[0].getAssemblyParams().as_tmpf_needalloverlaps,
-			   ".bin");
-    if(loadVector(AS_needalloverlaps,filename,0)){
-      filename=buildFileName(version, "", "_pass",
-			     AS_miraparams[0].getAssemblyParams().as_tmpf_multicopies,
-			     ".bin");
-      if(loadVector(AS_multicopies,filename,0)){
-	filename=buildFileName(version, "", "_pass",
-			       AS_miraparams[0].getAssemblyParams().as_tmpf_hasmcoverlap,
-			       ".bin");
-	if(loadVector(AS_hasmcoverlaps,filename,0)){
-	  allok=true;
-	}
-      }
+  const vector<Contig::contigread_t> & conreads=con.getContigReads();
+  vector<Contig::contigread_t>::const_iterator crI = conreads.begin();
+
+  for(;crI != conreads.end(); crI++){
+    if(crI->orpid >= 0
+      && AS_multicopies[crI->orpid]) {
+      cout << "xxxxxxxxxxxx mark " << crI->orpid << endl;
+      Read & nonconstread = const_cast<Read &>(crI->read);
+      int32 rc=nonconstread.getRightClipoff()-1;
+      if(rc<nonconstread.getLeftClipoff()) rc=nonconstread.getLeftClipoff();
+      nonconstread.addTag(nonconstread.getLeftClipoff(),
+			  rc,
+			  "tstR",
+			  "");
     }
   }
-  if(allok){
-    // checks?
-  }else{
-    MIRANOTIFY(Notify::FATAL, "Error while reading file " << filename << ". Is the file present and correct? Are permissions right?");
-  }
 }
 
 
@@ -2161,48 +3177,240 @@ void Assembly::loadResumeDataMA(int32 version, const string & prefix, const stri
  *
  *
  *
- *
  *************************************************************************/
 
-void Assembly::makeNewReadPoolFromContigs()
+void Assembly::bfc_storeContig(Contig & con, uint32 & numcontigs, const bool mustmarkrepeats, const int32 passnr, const bool lastpass)
 {
-  FUNCSTART("void Assembly::makeNewReadPoolFromContigs()");
+  assembly_parameters const & as_fixparams= AS_miraparams[0].getAssemblyParams();
+  const vector<Contig::contigread_t> & conreads=con.getContigReads();
 
+  // look whether we store singlets in contig or not
 
-  int32 ccounter=0;
-  for(auto cI=AS_contigs.begin(); cI!=AS_contigs.end(); ++cI, ++ccounter){
+  bool storecontig=true;
 
-    auto & cr = cI->getContigReads();
+  if(con.getNumReadsInContig()==1){
+    const assembly_parameters & as_rt_params = AS_miraparams[conreads[0].read.getSequencingType()].getAssemblyParams();
 
-    for(auto crI = cr.begin(); crI!=cr.end(); ++crI){
-      if(crI.getORPID() >= 0){
-	if(crI->checkRead()){
-	  cout << "Precheck failed: " << endl;
-	  cout << *crI;
-	  MIRANOTIFY(Notify::FATAL, crI->checkRead()) ;
+    storecontig=as_rt_params.as_savesimplesingletsinproject;
+    if(conreads[0].read.hasTag(Read::REA_tagentry_idSRMr)
+       || conreads[0].read.hasTag(Read::REA_tagentry_idCRMr)
+       || conreads[0].read.hasTag(Read::REA_tagentry_idWRMr)
+       || conreads[0].read.hasTag(Read::REA_tagentry_idSROr)
+       || conreads[0].read.hasTag(Read::REA_tagentry_idSAOr)
+       || conreads[0].read.hasTag(Read::REA_tagentry_idSIOr)) {
+      storecontig|=as_fixparams.as_savetaggedsingletsinproject;
+      if(conreads[0].orpid>=0) AS_needalloverlaps[conreads[0].orpid]=true;
+     }
+  }
+
+  // TODO: U13 hat 0 werte im ASCII?
+  //Contig::setCoutType(Contig::AS_DEBUG);
+  //cout << "Debug in bfc_storeContig()\n" << con;
+
+  if(storecontig){
+    if(as_fixparams.as_mark_repeats&&mustmarkrepeats){
+      vector<bool> dummy;
+      markRepeats(con, dummy);
+    }
+
+    //bfc_markRepReads(con);
+
+    cout << "Storing contig ... "; cout.flush();
+    cout << as_fixparams.as_mark_repeats << mustmarkrepeats;
+    if(as_fixparams.as_keepcontigsinmem){
+      con.markFeaturesByConsensus(true, true, true);
+      con.updateStatsFromConsensusTags(true,true,true,true,true);
+      // store the contig information
+      AS_assemblyinfo.storeContigStats(con.getStats());
+      con.saveMem();
+      AS_contigs.push_back(con);
+    }else{
+      if(as_fixparams.as_loadbackbone){
+	con.removeRails();
+
+	// TODO: ask contig whether it has mappings
+	//if(as_fixparams.as_loadSOLEXA || as_fixparams.as_loadSOLID){
+	if(AS_miraparams[Read::SEQTYPE_SOLEXA].getAssemblyParams().as_load_sequencedata 
+	   || AS_miraparams[Read::SEQTYPE_ABISOLID].getAssemblyParams().as_load_sequencedata) {
+	  cout << "Transforming CER mappings." << endl;
+	  con.transformCERMappingsToCoverageReads();
+	  cout << "done transforming CER mappings." << endl;
+	  //assout::saveAsMAF(con, getMAFFilename()+".bla", AS_deleteoldresultfiles);
+	}
+      }
+
+      con.markFeaturesByConsensus(true, true, true);
+      // transfer important tags to readpool
+      transferContigReadTagsToReadpool(con,AS_bbcontigs.end());
+
+      con.updateStatsFromConsensusTags(true,true,true,true,true);
+      // store the contig information
+      AS_assemblyinfo.storeContigStats(con.getStats());
+
+
+      if(lastpass) {
+	assout::saveStatistics(con,
+			       getStatisticsFilename(),
+			       AS_deleteoldresultfiles);
+	assout::saveReadTagList(con,
+				getReadTagListFilename(),
+				AS_deleteoldresultfiles);
+	assout::saveConsensusTagList(con,
+				     getConsensusTagListFilename(),
+				     AS_deleteoldresultfiles);
+	assout::saveContigReadList(con,
+				   getContigReadListFilename(),
+				   AS_deleteoldresultfiles);
+	if(as_fixparams.as_output_gff3){
+	  // store sequence for later
+	  AS_gff3defer_names.push_back(con.getContigName());
+//TODO: weiterhier	  
+//	  assout::saveTagsAsGFF3(con, getGFF3Filename(), AS_deleteoldresultfiles);
+	}
+	if(as_fixparams.as_output_caf){
+	  cout << "Saving CAF ... "; cout.flush();
+	  assout::saveAsCAF(con, getCAFFilename(), AS_deleteoldresultfiles);
+	  cout << "done.\n";
+	}
+	if(as_fixparams.as_output_maf){
+	  cout << "Saving MAF ... "; cout.flush();
+	  assout::saveAsMAF(con, getMAFFilename(), AS_deleteoldresultfiles);
+	  cout << "done.\n";
+	}
+	if(as_fixparams.as_output_gap4da){
+	  cout << "Saving gap4 direct assembly ... "; cout.flush();
+	  assout::saveAsGAP4DA(con,getGAP4DAFilename(),AS_deleteoldresultfiles);
+	  cout << "done.\n";
+	}
+	if(as_fixparams.as_output_fasta) {
+	  cout << "Saving FASTA ... "; cout.flush();
+	  assout::saveAsFASTA(con,
+			      getFASTAFilename(),
+			      getFASTAPaddedFilename(),
+			      AS_deleteoldresultfiles);
+
+	  cout << "done.\n";
+	  
+	  // TODO: enable these functions for incremental write
+	  //if(AS_readpool.getNumOfStrainInReadpool()>1){
+	  //  saveStrainsAsFASTAQUAL();
+	  //}
 	}
-
-	AS_readpool[crI.getORPID()]=*crI;
-
-	if(AS_readpool[crI.getORPID()].checkRead()){
-	  cout << "Postcheck1 failed: " << endl;
-	  cout << AS_readpool[crI.getORPID()];
-	  MIRANOTIFY(Notify::FATAL, AS_readpool[crI.getORPID()].checkRead()) ;
+	if(as_fixparams.as_output_tcs) {
+	  cout << "Saving TCS ... "; cout.flush();
+	  assout::saveAsTCS(con, getTCSFilename(),AS_deleteoldresultfiles);
+	  cout << "done.\n";
 	}
-
-	const_cast<Read &>(*crI).discard();
-
-	if(AS_readpool[crI.getORPID()].checkRead()){
-	  cout << "Postcheck2 failed: " << endl;
-	  cout << AS_readpool[crI.getORPID()];
-	  MIRANOTIFY(Notify::FATAL, AS_readpool[crI.getORPID()].checkRead()) ;
+	if(as_fixparams.as_output_wiggle) {
+	  cout << "Saving Wiggle ... "; cout.flush();
+	  assout::saveAsWiggle(con, getWiggleFilename(),AS_deleteoldresultfiles);
+	  cout << "done.\n";
+	}
+	// TODO: enable these functions for incremental write
+	//saveSNPAnalysis();
+	//saveFeatureAnalysis();
+	if(as_fixparams.as_output_txt){
+	  cout << "Saving text ... "; cout.flush();
+	  assout::saveAsTXT(con,getTXTFilename(),AS_deleteoldresultfiles);
+	  cout << "done.\n";
+	}
+	if(as_fixparams.as_output_ace){
+	  cout << "Saving ACE ... "; cout.flush();
+	  assout::saveAsACE(con,getACEFilename(),AS_deleteoldresultfiles);
+	  cout << "done.\n";
+	}
+	if(as_fixparams.as_output_html) {
+	  cout << "Saving HTML ... "; cout.flush();
+	  assout::dumpContigAsHTML(con,
+				   getHTMLFilename(),
+				   AS_deleteoldresultfiles,
+				   AS_miraparams[0].getAssemblyParams().as_projectname_out);
+	  cout << "done.\n";
+	}
+      }else{
+	assout::saveStatistics(con,
+			       getStatisticsFilename(passnr, "", "_pass"),
+			       AS_deleteoldresultfiles);
+	assout::saveReadTagList(con, 
+				getReadTagListFilename(passnr),
+				AS_deleteoldresultfiles);
+	assout::saveConsensusTagList(con,getConsensusTagListFilename(passnr),
+				     AS_deleteoldresultfiles);
+	assout::saveContigReadList(con,
+				   getContigReadListFilename(passnr, "", "_pass"),
+				   AS_deleteoldresultfiles);
+	    
+	if(as_fixparams.as_output_tmp_caf) {
+	  cout << "Saving temp CAF ... "; cout.flush();
+	  assout::saveAsCAF(con, 
+			    getCAFFilename(passnr, "", "_pass"),
+			    AS_deleteoldresultfiles);
+	  cout << "done.\n";
+	}
+	if(as_fixparams.as_output_tmp_maf) {
+	  cout << "Saving temp MAF ... "; cout.flush();
+	  assout::saveAsMAF(con, 
+			    getMAFFilename(passnr, "", "_pass"),
+			    AS_deleteoldresultfiles);
+	  cout << "done.\n";
+	}
+	if(as_fixparams.as_output_tmp_gap4da) {
+	  cout << "Saving temp gap4 direct assembly ... "; cout.flush();
+	  assout::saveAsGAP4DA(con,
+			       getGAP4DAFilename(passnr, "", "_pass"),
+			       AS_deleteoldresultfiles);
+	  cout << "done.\n";
+	}
+	if(as_fixparams.as_output_tmp_fasta){
+	  cout << "Saving temp FASTA ... "; cout.flush();
+	  assout::saveAsFASTA(con,
+			      getFASTAFilename(passnr, "", "_pass"),
+			      getFASTAPaddedFilename(passnr, "", "_pass"),
+			      AS_deleteoldresultfiles);
+	  cout << "done.\n";
+	}
+	if(as_fixparams.as_output_tmp_txt){
+	  cout << "Saving temp text ... "; cout.flush();
+	  assout::saveAsTXT(con,
+			    getTXTFilename(passnr, "", "_pass"),
+			    AS_deleteoldresultfiles);
+	  cout << "done.\n";
+	}
+	if(as_fixparams.as_output_tmp_ace) {
+	  cout << "Saving temp ACE ... "; cout.flush();
+	  assout::saveAsACE(con,
+			    getACEFilename(passnr, "", "_pass"),
+			    AS_deleteoldresultfiles);
+	  cout << "done.\n";
+	}
+	if(as_fixparams.as_output_tmp_tcs) {
+	  cout << "Saving temp TCS ... "; cout.flush();
+	  assout::saveAsTCS(con,
+			    getTCSFilename(passnr, "", "_pass"),
+			    AS_deleteoldresultfiles);
+	  cout << "done.\n";
+	}
+	//if(as_fixparams.as_output_tmp_html) saveAsHTML(passnr, "", "_pass");
+	if(as_fixparams.as_output_tmp_html) {
+	  cout << "Saving temp HTML ... "; cout.flush();
+	  assout::dumpContigAsHTML(con,
+				   getHTMLFilename(passnr, "", "_pass"),
+				   AS_deleteoldresultfiles,
+				   AS_miraparams[0].getAssemblyParams().as_projectname_out);
+	  cout << "done.\n";
 	}
       }
     }
+    cout << "done." << endl;
+  }else{
+    // store the contig information
+    AS_assemblyinfo.storeContigStats(con.getStats());
+
+    if(conreads[0].orpid>=0) AS_isdebris[conreads[0].orpid]=1;
+    numcontigs--;
   }
-  AS_contigs.clear();
 
-  FUNCEND();
+  AS_deleteoldresultfiles=false;
 }
 
 
@@ -2215,15 +3423,14 @@ void Assembly::makeNewReadPoolFromContigs()
  *************************************************************************/
 
 
-bool Assembly::markRepeats(Contig & con, vector<bool> & readsmarkedsrm, Contig::repeatmarker_stats_t & repstats)
+bool Assembly::markRepeats(Contig & con, vector<bool> & readsmarkedsrm)
 {
   FUNCSTART("void Assembly::markRepeats(Contig & con)");
 
-  repstats.init();
-
   cout << "Marking possibly misassembled repeats: ";
   cout.flush();
-
+  
+  Contig::repeatmarker_stats_t repstats;
   con.newMarkPossibleRepeats(repstats, readsmarkedsrm);
   cout << "done step 1, starting step 2:";
   con.codonSingleBaseRepeatMarker(6,repstats, readsmarkedsrm);
@@ -2252,95 +3459,6 @@ bool Assembly::markRepeats(Contig & con, vector<bool> & readsmarkedsrm, Contig::
  *
  *************************************************************************/
 
-////#define CEBUG(bla)   {cout << bla; cout.flush(); }
-//void Assembly::transferContigReadsToReadpool(const Contig & buildcon, list<Contig::pbdse_t> & pbdsev, int32 passnr)
-//{
-//  FUNCSTART("void Assembly::transferContigReadsToReadpool(const Contig & buildcon, vector<Contig::pbdse_t> & pbdsev)");
-//
-//  cout << "Transfering reads to readpool." << endl;
-//
-//  BUGIFTHROW(true,"need redo for PlacedContigReads");
-//
-//  const vector<Contig::contigread_t> & cr = buildcon.getContigReads();
-//
-//  // split one list pbdsev into sublists for each contigread if needed
-//
-//  CEBUG("tCRTR 1" << endl);
-//  vector<list<Contig::pbdse_t> > vpbdsev;
-//  if(!pbdsev.empty()){
-//    vpbdsev.resize(AS_readpool.size());
-//    for(; pbdsev.begin() != pbdsev.end(); ){
-//      //cout << "ls: " << pbdsev.size() << "\tSplicing: " << pbdsev.front();
-//      size_t trid=pbdsev.front().rid;
-//      vpbdsev[trid].splice(vpbdsev[trid].begin(),pbdsev,pbdsev.begin());
-//      //cout << "ts: " << vpbdsev[trid].size() << endl;
-//    }
-//
-//    //for(uint32 vi=0;vi<vpbdsev.size(); ++vi){
-//    //  cout << "vi: " << vi << endl;
-//    //  list<Contig::pbdse_t>::const_iterator pI=vpbdsev[vi].begin();
-//    //  for(; pI!=vpbdsev[vi].end(); ++pI){
-//    //	cout << "\t" << *pI;
-//    //  }
-//    //}
-//  }
-//
-//  CEBUG("tCRTR 2" << endl);
-//  // create a temporary read with enough capacity to hold the
-//  //  largest of the reads to transfer (to prevent re-allocation)
-//  //
-//  // used for PacBio where elastic N stretches need to
-//  //  be corrected
-//  // also used to remove the gaps from the reads
-//  vector<Contig::contigread_t>::const_iterator crI = cr.begin();
-//  Read tmpr;
-//  {
-//    uint32 reservelen=0;
-//    for(;crI!=cr.end();crI++){
-//      if(crI->orpid>=0){
-//	reservelen=max(reservelen,crI->read.getLenSeq());
-//      }
-//    }
-//    tmpr.reserve(reservelen);
-//  }
-//
-//  CEBUG("tCRTR 3" << endl);
-//  // now copy all contig reads to read pool, one by one, using the tmp read
-//  //  and performing edits on this tmp read, leaving contig reads untouched
-//  crI = cr.begin();
-//  for(;crI!=cr.end();crI++){
-//    if(crI->orpid>=0){
-//      tmpr=crI->read;
-//
-//      // carefull, maybe there is nothing in the vpbdsev vector!
-//      //  then one would get segfaults
-//      if(tmpr.isSequencingType(ReadGroupLib::SEQTYPE_PACBIOHQ) && !vpbdsev.empty()){
-//	list<Contig::pbdse_t>::const_iterator pRI=vpbdsev[crI->orpid].begin();
-//	for(; pRI != vpbdsev[crI->orpid].end(); ++pRI){
-//	  CEBUG("Apply: " << *pRI);
-//	  BUGIFTHROW(pRI->rid >= AS_readpool.size(), "pRI->rid (" << pRI->rid << ") >= AS_readpool.size() ?");
-//	  //Read::setCoutType(Read::AS_TEXT);
-//	  //cout << CON_reads[pRI->cri].read;
-//	  tmpr.correctNStretch(pRI->rposs,
-//			       pRI->rpose,
-//			       pRI->changeestim);
-//	}
-//
-//	if(passnr==4){
-//	  tmpr.transformGapsToNs();
-//	}
-//      }
-//
-//      tmpr.removeGapsFromRead();
-//      AS_readpool[crI->orpid]=tmpr;
-//    }
-//  }
-//
-//  FUNCEND();
-//}
-////#define CEBUG(bla)
-
-
 //#define CEBUG(bla)   {cout << bla; cout.flush(); }
 void Assembly::transferContigReadsToReadpool(const Contig & buildcon, list<Contig::pbdse_t> & pbdsev, int32 passnr)
 {
@@ -2348,18 +3466,44 @@ void Assembly::transferContigReadsToReadpool(const Contig & buildcon, list<Conti
 
   cout << "Transfering reads to readpool." << endl;
 
+  const vector<Contig::contigread_t> & cr = buildcon.getContigReads();
+
+  // split one list pbdsev into sublists for each contigread if needed
+
+  CEBUG("tCRTR 1" << endl);
+  vector<list<Contig::pbdse_t> > vpbdsev;
+  if(!pbdsev.empty()){
+    vpbdsev.resize(AS_readpool.size());
+    for(; pbdsev.begin() != pbdsev.end(); ){
+      //cout << "ls: " << pbdsev.size() << "\tSplicing: " << pbdsev.front();
+      size_t trid=pbdsev.front().rid;
+      vpbdsev[trid].splice(vpbdsev[trid].begin(),pbdsev,pbdsev.begin());
+      //cout << "ts: " << vpbdsev[trid].size() << endl;
+    }
+    
+    //for(uint32 vi=0;vi<vpbdsev.size(); ++vi){
+    //  cout << "vi: " << vi << endl;
+    //  list<Contig::pbdse_t>::const_iterator pI=vpbdsev[vi].begin();
+    //  for(; pI!=vpbdsev[vi].end(); ++pI){
+    //	cout << "\t" << *pI;
+    //  }
+    //}
+  }
+
+  CEBUG("tCRTR 2" << endl);
   // create a temporary read with enough capacity to hold the
   //  largest of the reads to transfer (to prevent re-allocation)
   //
   // used for PacBio where elastic N stretches need to
   //  be corrected
   // also used to remove the gaps from the reads
+  vector<Contig::contigread_t>::const_iterator crI = cr.begin();
   Read tmpr;
   {
     uint32 reservelen=0;
-    for(auto pcrI=buildcon.getContigReads().begin(); pcrI!=buildcon.getContigReads().end(); ++pcrI){
-      if(pcrI.getORPID() >= 0){
-	reservelen=max(reservelen,pcrI->getLenSeq());
+    for(;crI!=cr.end();crI++){
+      if(crI->orpid>=0){
+	reservelen=max(reservelen,crI->read.getLenSeq());
       }
     }
     tmpr.reserve(reservelen);
@@ -2368,11 +3512,32 @@ void Assembly::transferContigReadsToReadpool(const Contig & buildcon, list<Conti
   CEBUG("tCRTR 3" << endl);
   // now copy all contig reads to read pool, one by one, using the tmp read
   //  and performing edits on this tmp read, leaving contig reads untouched
-  for(auto pcrI=buildcon.getContigReads().begin(); pcrI!=buildcon.getContigReads().end(); ++pcrI){
-    if(pcrI.getORPID() >= 0){
-      tmpr=*pcrI;
+  crI = cr.begin();
+  for(;crI!=cr.end();crI++){
+    if(crI->orpid>=0){
+      tmpr=crI->read;
+
+      // carefull, maybe there is nothing in the vpbdsev vector!
+      //  then one would get segfaults
+      if(tmpr.isSequencingType(Read::SEQTYPE_PACBIO) && !vpbdsev.empty()){
+	list<Contig::pbdse_t>::const_iterator pRI=vpbdsev[crI->orpid].begin();
+	for(; pRI != vpbdsev[crI->orpid].end(); ++pRI){
+	  CEBUG("Apply: " << *pRI);
+	  BUGIFTHROW(pRI->rid >= AS_readpool.size(), "pRI->rid (" << pRI->rid << ") >= AS_readpool.size() ?");
+	  //Read::setCoutType(Read::AS_TEXT);
+	  //cout << CON_reads[pRI->cri].read;
+	  tmpr.correctNStretch(pRI->rposs,
+			       pRI->rpose,
+			       pRI->changeestim);
+	}
+
+	if(passnr==4){
+	  tmpr.transformGapsToNs();
+	}
+      }
+
       tmpr.removeGapsFromRead();
-      AS_readpool[pcrI.getORPID()]=tmpr;
+      AS_readpool[crI->orpid]=tmpr;
     }
   }
 
@@ -2381,8 +3546,6 @@ void Assembly::transferContigReadsToReadpool(const Contig & buildcon, list<Conti
 //#define CEBUG(bla)
 
 
-
-
 /*************************************************************************
  *
  *
@@ -2395,54 +3558,50 @@ void Assembly::transferContigReadTagsToReadpool(const Contig & con, const list<C
   FUNCSTART("void Assembly::transferContigReadTagsToReadpool(const Contig & con, const list<Contig>::const_iterator bbContigI)");
 
   cout << "Transfering tags to readpool.\n";
-
-  auto & cr = con.getContigReads();
-  auto pcrI = cr.begin();
+  
+  const vector<Contig::contigread_t> & cr = con.getContigReads();
+  vector<Contig::contigread_t>::const_iterator crI = cr.begin();
   uint32 tagnumber=0;
 
-  multitag_t tmpmt;
-
   try{
     // Transfer the contigread RMB tags into the readpool only!
     // Go through all the contigreads, if they have SRMr or WRMr tags,
     //  check if they are at an edited place.
     // If not, transfer the tag to the readpool (if not already present
     //  there)
-    for(;pcrI!=cr.end(); ++pcrI){
-      if(pcrI.getORPID()==-1) continue;
-      uint32 numtags=pcrI->getNumOfTags();
-
-      //CEBUGF(pcrI->getName() << " has " << numtags << " tags.\n");
-
+    for(;crI!=cr.end(); crI++){
+      if(crI->orpid==-1) continue;
+      uint32 numtags=crI->read.getNumOfTags();
+      
+      //CEBUGF(crI->read.getName() << " has " << numtags << " tags.\n");
+      
       for(tagnumber=0; tagnumber < numtags; tagnumber++) {
-	const multitag_t & acttag=pcrI->getTag(tagnumber);
+	const multitag_t & acttag=crI->read.getTag(tagnumber);
 	if(acttag.identifier==Read::REA_tagentry_idSRMr
 	   ||acttag.identifier==Read::REA_tagentry_idWRMr
 	   ||acttag.identifier==Read::REA_tagentry_idSROr
 	   ||acttag.identifier==Read::REA_tagentry_idSIOr
 	   ||acttag.identifier==Read::REA_tagentry_idSAOr
 	  ) {
-
-	  tmpmt=acttag;
-
+	  
 	  //CEBUGF("Tag " << tagnumber << " at " << acttag.from << " is " << acttag.identifier << endl);
-
+	  
 	  bool foundedit=false;
 	  for(uint32 i=0; i<numtags; i++) {
-	    if(pcrI->getTag(i).from==acttag.from
-	       && (pcrI->getTag(i).identifier==Read::REA_defaulttag_ED_C.identifier
-		   || pcrI->getTag(i).identifier==Read::REA_defaulttag_ED_I.identifier
-		   || pcrI->getTag(i).identifier==Read::REA_defaulttag_ED_D.identifier
+	    if(crI->read.getTag(i).from==acttag.from
+	       && (crI->read.getTag(i).identifier==Read::REA_tagentry_idED_C
+		   || crI->read.getTag(i).identifier==Read::REA_tagentry_idED_I
+		   || crI->read.getTag(i).identifier==Read::REA_tagentry_idED_D
 		 )
 	      ) {
-	      //CEBUGF("Found " << pcrI->getTag(i).identifier << " at that position, skipping!");
+	      //CEBUGF("Found " << crI->read.getTag(i).identifier << " at that position, skipping!");
 	      foundedit=true;
 	      break;
 	    }
 	  }
 	  if(foundedit) continue;
-
-
+	  
+	  
 	  // the next if is true for tags at gap bases;
 	  //if(adj_tagpos < 0 ) {
 	  //  cout << "Tag at gap base!!!!!\n";
@@ -2450,11 +3609,11 @@ void Assembly::transferContigReadTagsToReadpool(const Contig & con, const list<C
 	  //}
 
 	  if(bbContigI!=AS_bbcontigs.end()){
-	    if(pcrI->isBackbone() || pcrI->isRail()) {
+	    if(crI->read.isBackbone() || crI->read.isRail()) {
 	      //cout << "IsBackbone or read\n";
-
-	      int32 adj_tagposl=pcrI->getAdjustmentPosOfReadPos(acttag.from);
-	      int32 adj_tagposu=pcrI->getAdjustmentPosOfReadPos(acttag.to);
+	      
+	      int32 adj_tagposl=crI->read.getAdjustmentPosOfReadPos(acttag.from);
+	      int32 adj_tagposu=crI->read.getAdjustmentPosOfReadPos(acttag.to);
 	      // don't do that for gaps in backbones or reads
 	      if(adj_tagposl < 0 && adj_tagposu < 0) continue;
 	      if(adj_tagposl < 0) {
@@ -2462,85 +3621,76 @@ void Assembly::transferContigReadTagsToReadpool(const Contig & con, const list<C
 		if(adj_tagposl<0) adj_tagposl=0;
 	      }else if(adj_tagposu < 0) {
 		adj_tagposu=adj_tagposl+(acttag.to-acttag.from);
-		if(adj_tagposu > static_cast<int32>(pcrI->getLenSeq()-1)) adj_tagposu=pcrI->getLenSeq()-1;
+		if(adj_tagposu > static_cast<int32>(crI->read.getLenSeq()-1)) adj_tagposu=crI->read.getLenSeq()-1;
 	      }
-
+	      
 	      // This is an ugly, ugly hack: we set the P|WRMB tag in
-	      //  the read of the backbonecontig.
+	      //  the read of the backbonecontig. 
 	      // This should be a no no, but it's needed to work
 	      //  with backbones
-
-	      int32 bbcrtagposl=pcrI->getReadPosOfAdjustmentPos(adj_tagposl);
-	      int32 bbcrtagposu=pcrI->getReadPosOfAdjustmentPos(adj_tagposu);
+	      Read & nonconstread = const_cast<Read &>(bbContigI->getReadWithID(crI->orpid));
+	      
+	      //int32 adj_tagposl=crI->read.getAdjustmentPosOfReadPos(acttag.from);
+	      //int32 adj_tagposu=crI->read.getAdjustmentPosOfReadPos(acttag.to);
+	      int32 bbcrtagposl=nonconstread.getReadPosOfAdjustmentPos(adj_tagposl);
+	      int32 bbcrtagposu=nonconstread.getReadPosOfAdjustmentPos(adj_tagposu);
 	      if(bbcrtagposl >= 0 && bbcrtagposu>=0) {
 		try {
-		  tmpmt.from=bbcrtagposl;
-		  tmpmt.to=bbcrtagposu;
-		  const_cast<Read &>(*pcrI).addTagO(tmpmt);
+		  nonconstread.addTag(bbcrtagposl, 
+				      bbcrtagposu,
+				      acttag.identifier,
+				      acttag.comment);
 		}
 		catch (Notify n) {
 		  cout << "Tried to transfer tags to bbackbone contig read from:\n";
 		  Read::setCoutType(Read::AS_TEXT);
-		  cout << *pcrI;
+		  cout << crI->read;
 		  cout << "Exiting.\n";
 		  n.handleError(THISFUNC);
 		}
 	      }
 	    }
 	  }
-
-	  Read & rpr=AS_readpool.getRead(pcrI.getORPID());
-
+	    
+	  Read & rpr=AS_readpool.getRead(crI->orpid);
+		  
 	  // TODO: FIXME
-	  // The whole thing is botched for reads without adjustment
-	  // One should perform a Smith-Waterman of contig read against readpool read
-	  //  and calculate new adjustments
-	  // Not sure whether worth the effort atm
-	  //
-	  // Simple foolguard atm: transfer only if lengths are equal
-
-	  // TODO: bad fix
-	  // in assemblies with higher coverage and different variant, that is
-	  //  essentially always untrue, hence no tag transposition at all. *sigh*
-	  // if(rpr.getLenClippedSeq()==pcrI->getLenClippedSeq()) {
-
-	  if(true) {
-	    // this is wrong for reads without adjustments.
-	    //  -> no way to detect deletions in those reads!
-	    int32 adj_tagposl=pcrI->getLowerNonGapAdjustmentPosOfReadPos(acttag.from);
-	    int32 adj_tagposu=pcrI->getUpperNonGapAdjustmentPosOfReadPos(acttag.to);
-	    int32 rprtagposl=rpr.getReadPosOfAdjustmentPos(adj_tagposl);
-	    int32 rprtagposu=rpr.getReadPosOfAdjustmentPos(adj_tagposu);
-
-	    try {
-	      //cout << "Transfering tag for " << rpr.getName()
-	      //	 << "\t" << rprtagposl << " " << rprtagposu
-	      //	 << "\tadj " << adj_tagposl << " " << adj_tagposu << endl;
-	      //CEBUGF("Transfering tag for " << rpr.getName() << "\t" << rprtagposl << " " << rprtagposu << endl);
-	      //Read::setCoutType(Read::AS_TEXT);
-	      //CEBUGF("Before:\n" << rpr << endl);
-
-	      // add tag only when both positions are >=0 (i.e. not starting/stopping
-	      //  on an inserted base, else addTag() would understandably barf
-	      if(rprtagposl>=0 && rprtagposu>=0){
-		tmpmt.from=rprtagposl;
-		tmpmt.to=rprtagposu;
-		rpr.addTagO(tmpmt);
-	      }
-	      //CEBUGF("After:\n" << rpr << endl);
+	  // this is wrong for reads without adjustments. 
+	  //  -> no way to detect deletions in those reads!
+	  int32 adj_tagposl=crI->read.getLowerNonGapAdjustmentPosOfReadPos(acttag.from);
+	  int32 adj_tagposu=crI->read.getUpperNonGapAdjustmentPosOfReadPos(acttag.to);
+	  int32 rprtagposl=rpr.getReadPosOfAdjustmentPos(adj_tagposl);
+	  int32 rprtagposu=rpr.getReadPosOfAdjustmentPos(adj_tagposu);
+
+	  try {
+	    //cout << "Transfering tag for " << rpr.getName()
+	    //	 << "\t" << rprtagposl << " " << rprtagposu 
+	    //	 << "\tadj " << adj_tagposl << " " << adj_tagposu << endl;
+	    //CEBUGF("Transfering tag for " << rpr.getName() << "\t" << rprtagposl << " " << rprtagposu << endl);
+	    //Read::setCoutType(Read::AS_TEXT);
+	    //CEBUGF("Before:\n" << rpr << endl);
+		    
+	    // add tag only when both positions are >=0 (i.e. not starting/stopping
+	    //  on an inserted base, else addTag() would understandably barf
+	    if(rprtagposl>=0 && rprtagposu>=0){
+	      rpr.addTag(rprtagposl,
+			 rprtagposu, 
+			 acttag.identifier, 
+			 acttag.comment);
 	    }
-	    catch (Notify n) {
-	      // care about errors only if we have adjustments in the read
-	      //  if not, the whole thing is more or less wrong anyway
-	      if(rpr.usesAdjustments()){
-		cout << "Tried to transfer tags to readpool read from:\n";
-		Read::setCoutType(Read::AS_TEXT);
-		cout << *pcrI;
-		cout << "Exiting." << endl;
-		n.handleError(THISFUNC);
-	      }else{
-		cout << "Dbg: wrong tag transfer for " << rpr.getName() << '\n';
-	      }
+	    //CEBUGF("After:\n" << rpr << endl);
+	  }
+	  catch (Notify n) {
+	    // care about errors only if we have adjustments in the read
+	    //  if not, the whole thing is more or less wrong anyway
+	    if(rpr.usesAdjustments()){
+	      cout << "Tried to transfer tags to readpool read from:\n";
+	      Read::setCoutType(Read::AS_TEXT);
+	      cout << crI->read;
+	      cout << "Exiting." << endl;
+	      n.handleError(THISFUNC);
+	    }else{
+	      cout << "Dbg: wrong tag transfer for " << rpr.getName() << '\n';
 	    }
 	  }
 	}
@@ -2550,7 +3700,7 @@ void Assembly::transferContigReadTagsToReadpool(const Contig & con, const list<C
   catch(Notify n) {
     cout << "General error while transfering tag " << tagnumber << " to readpool read from:\n";
     Read::setCoutType(Read::AS_TEXT);
-    cout << *pcrI;
+    cout << crI->read;
     cout << "Exiting.\n";
     n.handleError(THISFUNC);
   }
@@ -2580,26 +3730,26 @@ void Assembly::huntSpoilSports(Contig & chkcon)
 {
   cout << "Hunting join spoiler" << endl;
 
-  auto & cr=chkcon.getContigReads();
+  const vector<Contig::contigread_t> & cr=chkcon.getContigReads();
 
   const uint32 endrange=30;
 
-  auto pcrI=cr.begin();
-  for(; pcrI != cr.end() ; ++pcrI){
-    const Read & actread=*pcrI;
+  vector<Contig::contigread_t>::const_iterator crI=cr.begin();
+  for(; crI != cr.end() ; crI++){
+    const Read & actread=crI->read;
     bool atfront=false;
     bool atback=false;
-    if(pcrI.getReadStartOffset()<=endrange) atfront=true;
-    if(pcrI.getReadStartOffset()+actread.getLenClippedSeq() > chkcon.getContigLength()-endrange) atback=true;
+    if(crI->offset<=endrange) atfront=true;
+    if(crI->offset+actread.getLenClippedSeq() > chkcon.getContigLength()-endrange) atback=true;
     if(atfront || atback){
       cout << "HSS At end: " << atfront << ' ' << atback << '\t' << actread.getName() << endl;
 
-      if(pcrI.getORPID()>=0){
+      if(crI->orpid>=0){
 	// currently: always remove
 
 	// if it has >2 permbans, remove
-	//cout << "HSS Permbans: " << AS_permanent_overlap_bans[pcrI.getORPID()].size() << endl;
-	//if(AS_permanent_overlap_bans[pcrI.getORPID()].size()>3) {
+	//cout << "HSS Permbans: " << AS_permanent_overlap_bans[crI->orpid].size() << endl;
+	//if(AS_permanent_overlap_bans[crI->orpid].size()>3) {
 	//  if(!actread.hasTag(Read::REA_tagentry_idSRMr)
 	//     && !actread.hasTag(Read::REA_tagentry_idCRMr)){
 	//    //if(true){
@@ -2610,14 +3760,14 @@ void Assembly::huntSpoilSports(Contig & chkcon)
 	//      bool clipfront=false;
 	//      bool clipback=false;
 	//      if(atfront){
-	//	if(pcrI->direction>0){
+	//	if(crI->direction>0){
 	//	  clipfront=true;
 	//	}else{
 	//	  clipback=true;
 	//	}
 	//      }
 	//      if(atback){
-	//	if(pcrI->direction>0){
+	//	if(crI->direction>0){
 	//	  clipback=true;
 	//	}else{
 	//	  clipfront=true;
@@ -2642,9 +3792,9 @@ void Assembly::huntSpoilSports(Contig & chkcon)
 	//	    bposfrom=actread.getLeftClipoff()+50;
 	//	    if(bposfrom>=actread.getLenSeq()) bposfrom=actread.getLenSeq()-1;
 	//	  }
-	//	  cout << "HSS moving left " <<  AS_readpool[pcrI.getORPID()].getLQClipoff();
-	//	  AS_readpool[pcrI.getORPID()].setLQClipoff(bposfrom);
-	//	  cout << " to " << AS_readpool[pcrI.getORPID()].getLQClipoff()
+	//	  cout << "HSS moving left " <<  AS_readpool[crI->orpid].getLQClipoff();
+	//	  AS_readpool[crI->orpid].setLQClipoff(bposfrom);
+	//	  cout << " to " << AS_readpool[crI->orpid].getLQClipoff() 
 	//	       << "\t" << actread.getName() << endl;
 	//	}
 	//      }
@@ -2667,170 +3817,347 @@ void Assembly::huntSpoilSports(Contig & chkcon)
 	//	      bposto=actread.getRightClipoff()-50;
 	//	    }
 	//	  }
-	//	  cout << "HSS moving right " <<  AS_readpool[pcrI.getORPID()].getRQClipoff();
-	//	  AS_readpool[pcrI.getORPID()].setRQClipoff(bposto);
-	//	  cout << " to " << AS_readpool[pcrI.getORPID()].getRQClipoff()
+	//	  cout << "HSS moving right " <<  AS_readpool[crI->orpid].getRQClipoff();
+	//	  AS_readpool[crI->orpid].setRQClipoff(bposto);
+	//	  cout << " to " << AS_readpool[crI->orpid].getRQClipoff() 
 	//	       << "\t" << actread.getName() << endl;
 	//	}
 	//      }
 	//    }
 	//  }
 	//}
-	AS_istroublemaker[pcrI.getORPID()]=true;
+	AS_istroublemaker[crI->orpid]=true;
       }
     }
   }
 }
 
 
-
-
 /*************************************************************************
  *
+ * This should catch chimeras as well as vector leftovers that were
+ *  too long to be clipped away earlier
+ *  
+ * go through each contig; look at reads aligning with end reads 
+ *  and see whether those have edges to reads in other contigs to 
+ *  which the end read has no edges
  *
+ * Catches situations like these (grinch is 1st read)
  *
+ * Contig1
+ * ...................................XXXXmismatchesXXXX
+ * ........................
+ *
+ * Contig2
+ *                ......................................................
+ *                     .................................................
  *
  *************************************************************************/
 
-void Assembly::findPossibleOverlaps(int32 version, const string prefix, const string postfix, const string tmpfname)
+//#define CEBUG(bla)   {cout << bla; cout.flush(); }
+//#define CEBUGF(bla)  {cout << bla; cout.flush(); }
+
+void Assembly::huntPossibleContigJoinGrinches(int32 version, const string prefix, const string postfix, const string tmpfname)
 {
-  FUNCSTART("void Assembly::findPossibleOverlaps(int32 version, const string prefix, const string postfix, const string tmpfname)");
+  FUNCSTART("void Assembly::huntPossibleContigJoinGrinches(int32 version, const string prefix, const string postfix, const string tmpfname)");
 
-  string signalfilename(buildFileName(version,
-				  prefix,
-				  postfix,
-				  AS_miraparams[0].getAssemblyParams().as_tmpf_signal_findpossibleoverlaps,
-				  ".ok"));
+  cout << "\n\n";
+  if(AS_miraparams[0].getAssemblyParams().as_dateoutput) dateStamp(cout);
+  cout << "Hunting contig join spoiler ... "; cout.flush();
 
-  if(!AS_resumeasembly || !AS_resumeisok || !fileExists(signalfilename)){
-    cout << "AS_resumeasembly " << AS_resumeasembly << endl;
-    cout << "AS_resumeisok " << AS_resumeisok << endl;
-    cout << "fileExists(" << signalfilename << ") " << fileExists(signalfilename) << endl;
+  string filename;
+  if(tmpfname.size()){
+    filename=buildFileName(version, prefix, postfix, tmpfname, ".txt");
+  }else{
+    filename=buildFileName(version, prefix, postfix, 
+			   AS_miraparams[0].getAssemblyParams().as_tmpf_spoiler,
+			   ".txt");
+  }
 
-    AS_resumeisok=false;
-    fpo_main(version,prefix,postfix,tmpfname);
+  ofstream logout(filename.c_str(), ios::out | ios::trunc);
 
-    // initialiase well connected with overlap criterion levels
-    // log overlap criterion levels if wanted
 
-    AS_wellconnected.clear();
-    AS_wellconnected.resize(AS_readpool.size(),false);
+  list<Contig>::iterator I=AS_contigs.begin();
+  vector<int32> contigidofendreads(AS_readpool.size(),-1);
 
-    {
-      ofstream fout;
-      //AS_logflag_oclevel=true;
-      if(AS_logflag_oclevel){
-	string filename=buildFileName(version, "", "",
-				      "elog.oclevel_pass",
-				      ".lst");
-	fout.open(filename.c_str(), ios::out);
+  //TODO: +/- fehler rausholen, aufr�umen, konfigurierbar machen
+
+  {
+    vector<int32> tmpreadids;
+    vector<int32>::const_iterator J;
+    uint32 contigid;
+    int32 tmplen=0;
+    for(;I!=AS_contigs.end();I++){
+      //      if(I->getNumReadsInContig()==1
+      //	 || I->getContigLength() <= 500) continue;
+      if(I->getNumReadsInContig()==1) continue;
+
+      contigid=I->getContigID();
+      tmplen=I->getContigLength();
+      if(tmplen>500) tmplen=500;
+      I->getReadIDsAtContigPosition(tmpreadids,0,tmplen);
+      for(J=tmpreadids.begin();J!=tmpreadids.end();J++){
+	contigidofendreads[*J]=contigid;
       }
 
-      for(uint32 i=0; i<AS_readpool.size();++i){
-	if(AS_logflag_oclevel){
-	  fout << AS_readpool[i].getName()
-	       << '\t' << static_cast<uint16>(AS_overlapcritlevelvl[0][i])
-	       << '\t' << static_cast<uint16>(AS_overlapcritlevelvr[0][i])
-	       << '\t' << static_cast<uint16>(AS_overlapcritlevelvl[1][i])
-	       << '\t' << static_cast<uint16>(AS_overlapcritlevelvr[1][i])
-	       << '\n';
+      tmplen=I->getContigLength()-500;
+      if(tmplen<0) tmplen=0;
+      I->getReadIDsAtContigPosition(tmpreadids,tmplen,I->getContigLength());
+      for(J=tmpreadids.begin();J!=tmpreadids.end();J++){
+	contigidofendreads[*J]=contigid;
+      }
+    }
+  }
+
+  for(uint32 i=0; i<contigidofendreads.size(); i++){
+    CEBUG("CEndread " << i << " :\t");
+    if(contigidofendreads[i]>=0) {
+      CEBUG(contigidofendreads[i] << '\n');
+    }else{
+      CEBUG("none\n");
+    }
+  }
+
+  //for(uint32 i=0; i<contigidofendreads.size(); i++){
+  //  cout << "read " << AS_readpool[i].getName() << " " << i << " in " << contigidofendreads[i] << endl;
+  //}
+
+  uint32 actcontigid;
+  for(I=AS_contigs.begin();I!=AS_contigs.end();I++){
+    if(I->getNumReadsInContig()==1) continue;
+    CEBUG("Checking " << I->getContigName() << " " << endl);
+    actcontigid=I->getContigID();
+    vector<int32> endreads;
+    int32 xfirstcov=0;
+    I->getReadIDsAtContigPosition(endreads,xfirstcov,xfirstcov);
+    if(endreads.size()==1) {
+      xfirstcov++;
+      int32 endreadid=endreads[0];
+      CEBUG("readid at front end: " << endreadid << endl);
+      while(endreads.size()==1) {
+	I->getReadIDsAtContigPosition(endreads,xfirstcov,xfirstcov);
+	xfirstcov++;
+      }
+      int32 xendcov=xfirstcov+300;
+      CEBUG("range after 1 cov at front: " << xfirstcov << " " << xendcov<<endl);
+      if(xendcov >= static_cast<int32>(I->getContigLength())) xendcov=I->getContigLength()-1;
+      CEBUG("adjusted range after 1 cov at front: " << xfirstcov << " " << xendcov<<endl);
+      I->getReadIDsAtContigPosition(endreads,xfirstcov,xendcov);
+      
+      if(isReadGrinch(endreadid, actcontigid, endreads, contigidofendreads)){
+	CEBUG("Looks like a grinch.\n");
+	const vector<Contig::contigread_t> & creads= I->getContigReads();
+	vector<Contig::contigread_t>::const_iterator crI=creads.begin();
+	int32 direction=0;
+	for(;crI!=creads.end();crI++){
+	  if(crI->orpid == endreadid) {
+	    direction=crI->direction;
+	    break;
+	  }
 	}
-	// for Solexa, critlevel 0 is too harsch (because of special rule to calc
-	//  Solexa critlevels in Skim)
-	for(uint32 ocvi=0; ocvi<2;++ocvi){
-	  if(AS_readpool[i].isSequencingType(ReadGroupLib::SEQTYPE_SOLEXA)){
-	    if(AS_overlapcritlevelvl[ocvi][i] <= 2 && AS_overlapcritlevelvr[ocvi][i] <= 2 ){
-	      AS_wellconnected[i]=true;
-	    }
-	  }else if(AS_overlapcritlevelvl[ocvi][i] == 0 && AS_overlapcritlevelvr[ocvi][i] == 0 ){
-	    AS_wellconnected[i]=true;
+	// add another 20 bases as safety net
+	xfirstcov+=20;
+	BUGIFTHROW(direction==0, "direction == 0???");
+	logout << "Spoiler " << AS_readpool.getRead(endreadid).getName() << " " << xfirstcov << " ";
+	uint32 tagstart=0;
+	uint32 tagend=0;
+	if(direction>0){
+	  try{
+	    AS_readpool.getRead(endreadid).setLQClipoff(AS_readpool.getRead(endreadid).getLQClipoff()+xfirstcov-1);
+	    logout << "on left side.\n";
+	    tagstart=AS_readpool.getRead(endreadid).getLQClipoff()-(xfirstcov-1);
+	    tagend=AS_readpool.getRead(endreadid).getLQClipoff();
+	    AS_readpool.getRead(endreadid).addTag(tagstart, tagend,
+						  "CJSP","");
+	  }
+	  catch(...) {
+	  }
+	} else {
+	  try{
+	    AS_readpool.getRead(endreadid).setRQClipoff(AS_readpool.getRead(endreadid).getRQClipoff()-xfirstcov+1);
+	    logout << "on right side.\n";
+	    tagstart=AS_readpool.getRead(endreadid).getRQClipoff();
+	    tagend=AS_readpool.getRead(endreadid).getRQClipoff()+(xfirstcov-1);
+	    AS_readpool.getRead(endreadid).addTag(tagstart, tagend,
+						  "CJSP","");
+	  }
+	  catch(...) {
 	  }
 	}
       }
     }
-    // save some needed data
-    saveResumeDataFPO(version,prefix,postfix);
 
-    reduceSkimHits4(version, prefix, postfix, tmpfname);
 
-    ofstream fout(signalfilename.c_str());  // create checkpoint signal file for findPossibleOverlaps
-  }else{
-    cout << "Resume assembly: skim and skim reduction already present, good.\n";
-    // set AS_pos?match_filename*
-    fpo_buildFileNames(version,prefix,postfix,tmpfname);
-    AS_posfmatch_full_filename=AS_posfmatch_filename+".reduced";
-    AS_poscmatch_full_filename=AS_poscmatch_filename+".reduced";
 
-    loadResumeDataFPO(version,prefix,postfix);
+
+    xfirstcov=I->getContigLength()-1;
+    I->getReadIDsAtContigPosition(endreads,xfirstcov,xfirstcov);
+    if(endreads.size()==1) {
+      xfirstcov--;
+      int32 endreadid=endreads[0];
+      CEBUG("readid at back end: " << endreadid << endl);
+      while(endreads.size()==1) {
+	I->getReadIDsAtContigPosition(endreads,xfirstcov,xfirstcov);
+	xfirstcov--;
+      }
+      int32 xendcov=xfirstcov-300;
+      if(xendcov <0) xendcov=0;
+      CEBUG("range after 1 cov at front: " << xendcov << " " << xfirstcov << endl);
+      I->getReadIDsAtContigPosition(endreads,xendcov,xfirstcov);
+      
+      if(isReadGrinch(endreadid, actcontigid, endreads, contigidofendreads)){
+	CEBUG("Looks like a grinch.\n");
+
+	const vector<Contig::contigread_t> & creads= I->getContigReads();
+	vector<Contig::contigread_t>::const_iterator crI=creads.begin();
+	int32 direction=0;
+	for(;crI!=creads.end();crI++){
+	  if(crI->orpid == endreadid) {
+	    direction=crI->direction;
+	    break;
+	  }
+	}
+	// add another 20 bases as safety net
+	xfirstcov-=20;
+	BUGIFTHROW(direction==0, "direction == 0???");
+	logout << "Spoiler " << AS_readpool.getRead(endreadid).getName() << " " << (I->getContigLength()-xfirstcov) << " ";
+	uint32 tagstart=0;
+	uint32 tagend=0;
+	if(direction>0){
+	  try{
+	    AS_readpool.getRead(endreadid).setRQClipoff(AS_readpool.getRead(endreadid).getRQClipoff()-(I->getContigLength()-xfirstcov+1));
+	    logout << "on right side.\n";
+	    tagstart=AS_readpool.getRead(endreadid).getRQClipoff();
+	    tagend=AS_readpool.getRead(endreadid).getRQClipoff()+(I->getContigLength()-xfirstcov)-1;
+	    AS_readpool.getRead(endreadid).addTag(tagstart, tagend,
+						  "CJSP","");
+	  }
+	  catch(...) {
+	  }
+	} else {
+	  try{
+	    AS_readpool.getRead(endreadid).setLQClipoff(AS_readpool.getRead(endreadid).getLQClipoff()+(I->getContigLength()-xfirstcov-1));
+	    logout << "on left side.\n";
+	    tagstart=AS_readpool.getRead(endreadid).getLQClipoff()-(I->getContigLength()-xfirstcov)+1;
+	    tagend=AS_readpool.getRead(endreadid).getLQClipoff()-1;
+	    AS_readpool.getRead(endreadid).addTag(tagstart, tagend,
+						  "CJSP","");
+	  }
+	  catch(...) {
+	  }
+	}
+      }
+    }
   }
+
+  logout.close();
+
+  cout << "done.\n";
+  if(AS_miraparams[0].getAssemblyParams().as_dateoutput) dateStamp(cout);
+
+  FUNCEND();
+  return;
+}
+//#define CEBUG(bla)
+//#define CEBUGF(bla)
+
+
+/*************************************************************************
+ *
+ * thereadid is an endread (the one having the end-coverage of 1
+ * incontigid is the id of the contig it is in
+ * readstocheck are the read at the beginning of a contig that overlap
+ *  "thereadid"
+ * contigidofendreads is a vector in which each read (that is an endread)
+ *  has the id of the contig it is in
+ *
+ * returns whether "thereadid" matches more than one other read in 
+ *  another contig
+ *
+ *************************************************************************/
+
+bool Assembly__compareNewEdges_t_(const newedges_t & a, 
+				    const newedges_t & b);
+bool Assembly__compareNewEdges_t_(const newedges_t & a, const newedges_t & b)
+{
+  return a.rid1 < b.rid1;
 }
 
-void Assembly::fpo_buildFileNames(int32 version, const string prefix, const string postfix, const string tmpfname)
+bool Assembly::isReadGrinch(int32 thereadid, int32 incontigid, vector<int32> & readstocheck, vector<int32> & contigidofendreads)
 {
-  assembly_parameters const & as_fixparams= AS_miraparams[0].getAssemblyParams();
-  if(tmpfname.size()){
-    AS_posfmatch_filename=buildFileName(version,
-					prefix,
-					postfix,
-					tmpfname+"f",
-					".bin");
-    AS_poscmatch_filename=buildFileName(version,
-					prefix,
-					postfix,
-					tmpfname+"c",
-					".bin");
-    // the following two only to also automatically remove
-    //  older versions of the reduced skim files
-    buildFileName(version,
-		  prefix,
-		  postfix,
-		  tmpfname+"f",
-		  ".bin.reduced");
-    buildFileName(version,
-		  prefix,
-		  postfix,
-		  tmpfname+"c",
-		  ".bin.reduced");
-  }else{
-    AS_posfmatch_filename=buildFileName(version,
-					prefix,
-					postfix,
-					as_fixparams.as_tmpf_posmatch+"f",
-					".bin");
-    AS_poscmatch_filename=buildFileName(version,
-					prefix,
-					postfix,
-					as_fixparams.as_tmpf_posmatch+"c",
-					".bin");
-    // the following two only to also automatically remove
-    //  older versions of the reduced skim files
-    buildFileName(version,
-		  prefix,
-		  postfix,
-		  as_fixparams.as_tmpf_posmatch+"f",
-		  ".bin.reduced");
-    buildFileName(version,
-		  prefix,
-		  postfix,
-		  as_fixparams.as_tmpf_posmatch+"c",
-		  ".bin.reduced");
+  CEBUG("Checking if " << thereadid << " (" << AS_readpool.getRead(thereadid).getName() << ") in " << incontigid << " is grinch.\n");
+  vector<uint32> possiblecontigmate(AS_readpool.size(),0);
+  vector<int32>::const_iterator J=readstocheck.begin();
+  newedges_t tmp;
+  for(;J!=readstocheck.end(); J++){
+    CEBUG("Read to check: " << *J << "   ( " << AS_readpool.getRead(*J).getName() << " )\n");
+    //overlap_edges_t::iterator Mrun=AS_edges_forward.lower_bound(*J);
+    tmp.rid1=*J;
+    vector<newedges_t>::iterator Mrun=lower_bound(AS_confirmed_edges.begin(),
+						  AS_confirmed_edges.begin(),
+						  tmp,
+						  Assembly__compareNewEdges_t_);
+    for(;Mrun != AS_confirmed_edges.end() && Mrun->rid1 == *J; Mrun++) {
+      if(contigidofendreads[Mrun->linked_with] != incontigid
+	 && contigidofendreads[Mrun->linked_with] >= 0) {
+	possiblecontigmate[contigidofendreads[Mrun->linked_with]]++;
+	CEBUG("  Hit with " << Mrun->linked_with << "  ( " << AS_readpool.getRead(Mrun->linked_with).getName() << " ) in contig " << contigidofendreads[Mrun->linked_with] << endl);
+      }
+    }
+  }
+  
+  for(uint32 i=0; i<possiblecontigmate.size(); i++){
+    if(possiblecontigmate[i]>1 && static_cast<int32>(i) != incontigid) {
+      CEBUG("Possible contig mate " << i << endl);
+      return true;
+    }
   }
+
+  return false;
 }
 
-void Assembly::fpo_main(int32 version, const string prefix, const string postfix, const string tmpfname)
+
+//#undef CEBUG
+
+
+
+
+
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+
+void Assembly::findPossibleOverlaps(int32 version, const string prefix, const string postfix, const string tmpfname)
 {
-  FUNCSTART("void Assembly::fpo_main(int32 version, const string prefix, const string postfix, const string tmpfname)");
+  FUNCSTART("void Assembly::findPossibleOverlaps(int32 version, const string prefix, const string postfix, const string tmpfname)");
 
   //directory_parameters const & dir_params= AS_miraparams->getDirectoryParams();
   assembly_parameters const & as_fixparams= AS_miraparams[0].getAssemblyParams();
   skim_parameters const & skim_params= AS_miraparams[0].getSkimParams();
 
   if(as_fixparams.as_dateoutput) dateStamp(cout);
+  cout << '\n';
+
+//  if(AS_needsskimfornastyrepeats && skim_params.sk_masknastyrepeats){
+//    AS_needsskimfornastyrepeats=false;
+//    markNastyReapeatsWithSkim(version, prefix, postfix, tmpfname);
+//
+//    // test strategy: reads with MRMr must get all overlaps
+//    // BaCh 14.03.2009: BAD STRATEGY 
+//    //  for high coverage (100x +), too many reads may get that set,
+//    //  leading to long run times and high memory usage
+//    //for(uint32 i=0; i<AS_readpool.size(); i++) {
+//    //  if(AS_readpool[i].hasTag(Read::REA_tagMRMr)) AS_needalloverlaps[i]=1;
+//    //}
+//  }
 
-  cout << "\n\nSearching for possible overlaps";
+  cout << "\nSearching for possible overlaps";
 
 
-#if TRACKMEMUSAGE
+#if TRACKMEMUSAGE 
     cout << "\ndmi fpo 00\n";
     dumpMemInfo();
 #endif
@@ -2845,7 +4172,7 @@ void Assembly::fpo_main(int32 version, const string prefix, const string postfix
   nukeSTLContainer(AS_readhmcovered);
   nukeSTLContainer(AS_count_rhm);
 
-#if TRACKMEMUSAGE
+#if TRACKMEMUSAGE 
     cout << "\ndmi fpo 05\n";
     dumpMemInfo();
 #endif
@@ -2857,12 +4184,12 @@ void Assembly::fpo_main(int32 version, const string prefix, const string postfix
     //rawhashhitcounter.resize(AS_readpool.size(),0);
 
     bool onlyagainstrails=false;
-
+    
 
     // very first call will be with version=0 ... pre_assembly
     //  don't set to true there as this analysis is then needed
     //  for multicopy analysis
-    if(AS_hasbackbones
+    if(as_fixparams.as_loadbackbone
        && version >= as_fixparams.as_startbackboneusage_inpass
        && ! as_fixparams.as_backbone_alsobuildnewcontigs){
       onlyagainstrails=true;
@@ -2874,24 +4201,76 @@ void Assembly::fpo_main(int32 version, const string prefix, const string postfix
     //string rawhitsfilename;
     string megahubtmpfname;
     {
-      fpo_buildFileNames(version,prefix,postfix,tmpfname);
-      AS_posfmatch_full_filename=AS_posfmatch_filename;
-      AS_poscmatch_full_filename=AS_poscmatch_filename;
-
       if(tmpfname.size()){
-	megahubtmpfname=buildFileName(version,
-				      prefix,
-				      postfix,
-				      tmpfname+"_megahubs",
-				      ".lst");
+	AS_posfmatch_filename=buildFileName(version, 
+					    prefix,
+					    postfix, 
+					    tmpfname+"f", 
+					    ".bin");
+	AS_poscmatch_filename=buildFileName(version, 
+					    prefix,
+					    postfix,
+					    tmpfname+"c",
+					    ".bin");
+	// the following two only to also automatically remove
+	//  older versions of the reduced skim files
+	buildFileName(version,
+		      prefix,
+		      postfix, 
+		      tmpfname+"f", 
+		      ".bin.reduced");
+	buildFileName(version, 
+		      prefix,
+		      postfix,
+		      tmpfname+"c",
+		      ".bin.reduced");
+	//rawhitsfilename=buildFileName(version, 
+	//			      prefix,
+	//			      postfix,
+	//			      tmpfname+"_rawhashhits",
+	//			      ".lst");
+	megahubtmpfname=buildFileName(version, 
+				     prefix,
+				     postfix,
+				     tmpfname+"_megahubs",
+				     ".lst");
       }else{
+	AS_posfmatch_filename=buildFileName(version, 
+					    prefix,
+					    postfix, 
+					    as_fixparams.as_tmpf_posmatch+"f",
+					    ".bin");
+	AS_poscmatch_filename=buildFileName(version,
+					    prefix,
+					    postfix, 
+					    as_fixparams.as_tmpf_posmatch+"c",
+					    ".bin");
+	// the following two only to also automatically remove
+	//  older versions of the reduced skim files
+	buildFileName(version, 
+		      prefix,
+		      postfix, 
+		      as_fixparams.as_tmpf_posmatch+"f",
+		      ".bin.reduced");
+	buildFileName(version,
+		      prefix,
+		      postfix, 
+		      as_fixparams.as_tmpf_posmatch+"c",
+		      ".bin.reduced");
+	//rawhitsfilename=buildFileName(version,
+	//			      prefix,
+	//			      postfix, 
+	//			      AS_miraparams[0].getAssemblyParams().as_tmpf_posmatch+"_rawhashhits",
+	//			      ".lst");
 	megahubtmpfname=buildFileName(version,
-				      prefix,
-				      postfix,
-				      as_fixparams.as_tmpf_posmatch+"_megahubs",
-				      ".lst");
+				     prefix,
+				     postfix, 
+				     as_fixparams.as_tmpf_posmatch+"_megahubs",
+				     ".lst");
       }
-
+      AS_posfmatch_full_filename=AS_posfmatch_filename;
+      AS_poscmatch_full_filename=AS_poscmatch_filename;
+      
       //cout << "Only against rails? " << onlyagainstrails << endl;
 
       if(!onlyagainstrails) {
@@ -2899,7 +4278,7 @@ void Assembly::fpo_main(int32 version, const string prefix, const string postfix
 	   || (skim_params.sk_basesperhash <=14
 	       && skim_params.sk_hashsavestepping <3)){
 	  cout << "\n\nWARNING!!!!!!\nYou are not performing a 'mapping only' assembly and the parameters"
-	    "\n -SK:bph=" << skim_params.sk_basesperhash << " and -SK:hss="
+	    "\n -SK:bph=" << static_cast<uint16>(skim_params.sk_basesperhash) << " and -SK:hss="
 	       << static_cast<uint16>(skim_params.sk_hashsavestepping)
 	       << "\nare quite low. If SKIM takes ages, stop this assembly and restart while"
 	    "\nincreasing these parameters.\n\n";
@@ -2908,7 +4287,7 @@ void Assembly::fpo_main(int32 version, const string prefix, const string postfix
 
       vector<int32> overlaplenrequired;
       vector<int32> prrequired;
-      for(uint32 i=0;i<ReadGroupLib::getNumSequencingTypes(); i++){
+      for(uint32 i=0;i<Read::getNumSequencingTypes(); i++){
 	overlaplenrequired.push_back(AS_miraparams[i].getAlignParams().al_min_overlap);
 	prrequired.push_back(AS_miraparams[i].getSkimParams().sk_percentrequired);
       }
@@ -2926,168 +4305,61 @@ void Assembly::fpo_main(int32 version, const string prefix, const string postfix
 
       AS_chimeracutflag.clear();
 
-      vector<uint8> * megahubsptr=nullptr;
-      if(skim_params.sk_filtermegahubs){
-	megahubsptr=&AS_skimmegahubs;
-      }
-
-      // force taking strong good overlaps only for denovo genome
-      // TODO: currently not active in skim.
-      bool forcetakestronggood=!as_fixparams.as_assemblyjob_mapping & AS_miraparams[0].getPathfinderParams().paf_use_genomic_algorithms;
-
-
-      uint32 nummegahubs=0;
-      if(skim_params.sk_basesperhash <= 32){
-	Skim<vhash64_t> s2;
-	s2.setExtendedLog(AS_miraparams[0].getSpecialParams().mi_extended_log);
-	nummegahubs=s2.skimGo(AS_readpool,
-			      AS_posfmatch_filename,
-			      AS_poscmatch_filename,
-			      AS_permanent_overlap_bans,
-			      overlapcounter,
-			      AS_writtenskimhitsperid,
-			      chuntleftcut,
-			      chuntrightcut,
-			      AS_overlapcritlevelvl,
-			      AS_overlapcritlevelvr,
-			      megahubsptr,
-			      skim_params.sk_numthreads,
-			      skim_params.sk_maxhashesinmem,
-			      onlyagainstrails,
-			      skim_params.sk_alsoskimrevcomp,
-			      skim_params.sk_basesperhash,
-			      skim_params.sk_hashsavestepping,
-			      prrequired,
-			      overlaplenrequired,
-			      skim_params.sk_maxhitsperread,
-			      skim_params.sk_megahubcap,
-			      forcetakestronggood
-	  );
-      }else if(skim_params.sk_basesperhash <= 64){
-	Skim<vhash128_t> s2;
-	s2.setExtendedLog(AS_miraparams[0].getSpecialParams().mi_extended_log);
-	nummegahubs=s2.skimGo(AS_readpool,
-			      AS_posfmatch_filename,
-			      AS_poscmatch_filename,
-			      AS_permanent_overlap_bans,
-			      overlapcounter,
-			      AS_writtenskimhitsperid,
-			      chuntleftcut,
-			      chuntrightcut,
-			      AS_overlapcritlevelvl,
-			      AS_overlapcritlevelvr,
-			      megahubsptr,
-			      skim_params.sk_numthreads,
-			      skim_params.sk_maxhashesinmem,
-			      onlyagainstrails,
-			      skim_params.sk_alsoskimrevcomp,
-			      skim_params.sk_basesperhash,
-			      skim_params.sk_hashsavestepping,
-			      prrequired,
-			      overlaplenrequired,
-			      skim_params.sk_maxhitsperread,
-			      skim_params.sk_megahubcap,
-			      forcetakestronggood
-	  );
-      }else if(skim_params.sk_basesperhash <= 128){
-	Skim<vhash256_t> s2;
-	s2.setExtendedLog(AS_miraparams[0].getSpecialParams().mi_extended_log);
-	nummegahubs=s2.skimGo(AS_readpool,
-			      AS_posfmatch_filename,
-			      AS_poscmatch_filename,
-			      AS_permanent_overlap_bans,
-			      overlapcounter,
-			      AS_writtenskimhitsperid,
-			      chuntleftcut,
-			      chuntrightcut,
-			      AS_overlapcritlevelvl,
-			      AS_overlapcritlevelvr,
-			      megahubsptr,
-			      skim_params.sk_numthreads,
-			      skim_params.sk_maxhashesinmem,
-			      onlyagainstrails,
-			      skim_params.sk_alsoskimrevcomp,
-			      skim_params.sk_basesperhash,
-			      skim_params.sk_hashsavestepping,
-			      prrequired,
-			      overlaplenrequired,
-			      skim_params.sk_maxhitsperread,
-			      skim_params.sk_megahubcap,
-			      forcetakestronggood
-	  );
-      }else if(skim_params.sk_basesperhash <= 256){
-	Skim<vhash512_t> s2;
-	s2.setExtendedLog(AS_miraparams[0].getSpecialParams().mi_extended_log);
-	nummegahubs=s2.skimGo(AS_readpool,
-			      AS_posfmatch_filename,
-			      AS_poscmatch_filename,
-			      AS_permanent_overlap_bans,
-			      overlapcounter,
-			      AS_writtenskimhitsperid,
-			      chuntleftcut,
-			      chuntrightcut,
-			      AS_overlapcritlevelvl,
-			      AS_overlapcritlevelvr,
-			      megahubsptr,
-			      skim_params.sk_numthreads,
-			      skim_params.sk_maxhashesinmem,
-			      onlyagainstrails,
-			      skim_params.sk_alsoskimrevcomp,
-			      skim_params.sk_basesperhash,
-			      skim_params.sk_hashsavestepping,
-			      prrequired,
-			      overlaplenrequired,
-			      skim_params.sk_maxhitsperread,
-			      skim_params.sk_megahubcap,
-			      forcetakestronggood
-	  );
-      }else{
-	MIRANOTIFY(Notify::FATAL,"Cannot perform a skim analysis with -SK:bph > 256 (you used " << skim_params.sk_basesperhash << "), though MIRA should've failed earlier, I admit.\n");
-      }
+      Skim s2;
+      s2.setExtendedLog(AS_miraparams[0].getSpecialParams().mi_extended_log);
+      uint32 nummegahubs=s2.skimGo(AS_readpool,
+				   AS_posfmatch_filename,
+				   AS_poscmatch_filename,
+				   megahubtmpfname,
+				   AS_permanent_overlap_bans,
+				   overlapcounter,
+				   AS_writtenskimhitsperid,
+				   chuntleftcut,
+				   chuntrightcut,
+				   AS_overlapcritlevell,
+				   AS_overlapcritlevelr,
+				   skim_params.sk_numthreads,
+				   skim_params.sk_maxhashesinmem,
+				   onlyagainstrails,
+				   skim_params.sk_alsoskimrevcomp,
+				   static_cast<uint8>(skim_params.sk_basesperhash),
+				   static_cast<uint8>(skim_params.sk_hashsavestepping),
+				   prrequired,
+				   overlaplenrequired,
+				   skim_params.sk_maxhitsperread
+	);
 
       cout << "Total megahubs: " << nummegahubs << endl;
 
-#if TRACKMEMUSAGE
+#if TRACKMEMUSAGE 
     cout << "\ndmi fpo 10\n";
     dumpMemInfo();
 #endif
 
       if(nummegahubs){
-
-	{
-	  ofstream mout;
-	  mout.open(megahubtmpfname, ios::out| ios::trunc);
-	  for(uint32 mhi=0; mhi<AS_skimmegahubs.size(); mhi++){
-	    if(AS_skimmegahubs[mhi]>0) {
-	      mout << AS_readpool[mhi].getName() << '\n';
-	    }
-	  }
-	}
-
 	cout << "\n\nMIRA has detected megahubs in your data."
 	  "This may not be a problem, but most probably is, especially for eukaryotes.\n\n";
 	if(100.0/AS_num_reads_valid*nummegahubs > skim_params.sk_maxmegahubratio){
 	  cout << "\n\nYou have more than " << skim_params.sk_maxmegahubratio << "% of your reads found to be megahubs."
-	    "\n\nYou should check the following:\n\n"
+	    "\n\nYou should sheck the following:\n\n"
 	    "\t1) for Sanger sequences: are all the sequencing vectors masked / clipped?\n"
 	    "\t2) for 454 sequences: are all the adaptors masked / clipped?\n\n";
-	  if(AS_miraparams[0].getHashStatisticsParams().hs_repeatlevel_in_infofile){
+	  if(skim_params.sk_masknastyrepeats){
 	    cout << "You will find in the info directory a file called\n"
 	      "    '*_info_readrepeats.lst',\n"
 	      "consult the MIRA manual on how to extract repeat information from there.\n\n";
 	  }else{
 	    cout << "To learn more on the types of repeats you have and how MIRA\n"
 	      " can help you to find them, please consult the manual on the\n"
-	      " usage of -HS:rliif and the tmp files they create.\n";
+	      " usage of -SK:mnr and the tmp files they create.\n";
 	  }
 	  cout << "*ONLY* when you are sure that no (or only a very negligible number) of sequencing"
 	    "\nvector / adaptor sequence is remaining, try this:\n\n"
 	    "\t3) for organisms with complex repeats (eukaryots & some bacteria):\n";
-	  if(!AS_miraparams[0].getHashStatisticsParams().hs_masknastyrepeats) cout << "\t\t- use -HS:mnr=yes\n";
-	  cout << "\t\t- reduce the -HS:nrr parameter (divide by 2)\n"
-	    // huh?
-	    //"4) for EST projects, -SK:nrr will not really work, use -SK:nrr (start at\n"
-	    //"   10 and increase in steps of of 10)\n"
+	  if(!skim_params.sk_masknastyrepeats) cout << "\t\t- use -SK:mnr=yes\n";
+	  cout << "\t\t- reduce the -SK:nrr parameter (divide by 2)\n"
+	    "4) for EST projects, -SK:nrr will not really work, use -SK:nrr (start at\n"
+	    "   10 and increase in steps of of 10)\n"
 	    "\n"
 	    "*ONLY* if the above fails, try increasing the -SK:mmhr parameter\n"
 	    "Note that the number of present megahubs will increase computation time in\n"
@@ -3098,7 +4370,6 @@ void Assembly::fpo_main(int32 version, const string prefix, const string postfix
 	  cout << "\n\nYou have " << 100.0/AS_readpool.size()*nummegahubs
 	       << "% of your reads as megahubs.\n"
 	       << "You have set a maximum allowed ratio of: " << skim_params.sk_maxmegahubratio
-	       << "\nTo change this ratio, read the text above (it's kind of important) and also see -SK:mmhr at multiple location in the docs\n"
 	       << "\n\nEnding the assembly because the maximum ratio has been reached/surpassed.\n";
 	  exit(10);
 	}
@@ -3106,24 +4377,52 @@ void Assembly::fpo_main(int32 version, const string prefix, const string postfix
 
       if(chuntleftcut.size()){
 	string cltmpfname;
-	cltmpfname=buildFileName(0,"","",
+	cltmpfname=buildFileName(0,"","", 
 				as_fixparams.as_tmpf_clippings,
-				 ".txt",
-				 "",
-				 false);
+				".txt");
 	string logprefix="skim detect: ";
 	AS_chimeracutflag.resize(1);
 	cutBackPossibleChimeras(cltmpfname, logprefix, chuntleftcut,chuntrightcut,AS_chimeracutflag);
+	performSnapshot(0);
       }
 
     }
 
     // in mapping assemblies, correct the matches not being 100%
     if(AS_miraparams[0].getSkimParams().sk_swcheckonbackbones
-       && AS_hasbackbones){
+       && as_fixparams.as_loadbackbone){
       recalcNonPerfectSkimMappingsBySW(version);
     }
 
+    // initialiase well connected with overlap criterion levels
+    // log overlap criterion levels if wanted
+
+    AS_wellconnected.clear();
+    AS_wellconnected.resize(AS_readpool.size(),false);
+
+    {
+      ofstream fout;
+
+      if(AS_logflag_oclevel){
+	string filename=buildFileName(version, "", "",
+				      "elog.oclevel",
+				      ".lst");
+	fout.open(filename.c_str(), ios::out);
+      }
+
+      for(uint32 i=0; i<AS_readpool.size();++i){
+	if(AS_logflag_oclevel){
+	  fout << AS_readpool[i].getName() 
+	       << '\t' << static_cast<uint16>(AS_overlapcritlevell[i])
+	       << '\t' << static_cast<uint16>(AS_overlapcritlevelr[i])
+	       << '\n';
+	}
+	if(AS_overlapcritlevell[i] == 0 && AS_overlapcritlevelr[i] == 0 ){
+	  AS_wellconnected[i]=true;
+	}
+      }
+    }
+
 
     //// log the raw hash hits
     //{
@@ -3136,14 +4435,14 @@ void Assembly::fpo_main(int32 version, const string prefix, const string postfix
     //}
 
     // Do this only once
-    // TODO: check if ok to do more, i.e. if skim can be adapted to
+    // TODO: check if ok to do more, i.e. if skim can be adapted to 
     //       still count banned overlaps.
     if(AS_multicopies.size()==0){
       string filename;
       if(tmpfname.size()){
 	filename=buildFileName(version, prefix, postfix, tmpfname+"_multicopystat", ".txt");
       }else{
-	filename=buildFileName(version, prefix, postfix,
+	filename=buildFileName(version, prefix, postfix, 
 			       AS_miraparams[0].getAssemblyParams().as_tmpf_posmatch+"_multicopystat",
 			       ".txt");
       }
@@ -3152,7 +4451,7 @@ void Assembly::fpo_main(int32 version, const string prefix, const string postfix
       fout.close();
       //flagMulticopyReads(overlapcounter, filename);
     }
-
+    
     //if(AS_miraparams[0].getAssemblyParams().as_dateoutput) dateStamp(cout);
     //cout << '\n';
     //exit(0);
@@ -3160,7 +4459,6 @@ void Assembly::fpo_main(int32 version, const string prefix, const string postfix
 
 
 // TODO: adapt to data in files instead of the old posXmatch multimaps
-/*
 #if 0
   {
     vector<int32> cluster;
@@ -3184,7 +4482,7 @@ void Assembly::fpo_main(int32 version, const string prefix, const string postfix
 	  // uh oh ... we have to merge both these clusters
 	  // simply change all cnum1 into cnum2 in cluster vector
 	  for(uint32 j=0; j<AS_readpool.size(); j++) {
-	    if(cluster[j]==cnum1) cluster[j]=cnum2;
+	    if(cluster[j]==cnum1) cluster[j]=cnum2; 
 	  }
 	}
       }
@@ -3209,7 +4507,7 @@ void Assembly::fpo_main(int32 version, const string prefix, const string postfix
 	  // uh oh ... we have to merge both these clusters
 	  // simply change all cnum1 into cnum2 in cluster vector
 	  for(uint32 j=0; j<AS_readpool.size(); j++) {
-	    if(cluster[j]==cnum1) cluster[j]=cnum2;
+	    if(cluster[j]==cnum1) cluster[j]=cnum2; 
 	  }
 	}
       }
@@ -3221,7 +4519,7 @@ void Assembly::fpo_main(int32 version, const string prefix, const string postfix
     if(tmpfname.size()){
       filename=buildFileName(version, prefix, postfix, tmpfname+"_pcluster", ".lst");
     }else{
-      filename=buildFileName(version, prefix, postfix,
+      filename=buildFileName(version, prefix, postfix, 
 			     AS_miraparams->getAssemblyParams().as_tmpf_posmatch+"_pcluster",
 			     ".lst");
     }
@@ -3246,15 +4544,21 @@ void Assembly::fpo_main(int32 version, const string prefix, const string postfix
     }
   }
 #endif
-*/
 
-#if TRACKMEMUSAGE
+#if TRACKMEMUSAGE 
     cout << "\ndmi fpo 20\n";
     dumpMemInfo();
 #endif
 
   AS_steps[ASADSLISTOK]=0;
 
+  reduceSkimHits4(version, prefix, postfix, tmpfname);
+
+#if TRACKMEMUSAGE 
+    cout << "\ndmi fpo 30\n";
+    dumpMemInfo();
+#endif
+
   FUNCEND();
 }
 
@@ -3266,18 +4570,17 @@ void Assembly::fpo_main(int32 version, const string prefix, const string postfix
  *
  *************************************************************************/
 
-/*
 void Assembly::flagMulticopyReads(const vector<uint32> & overlapcounter, const string & tmpfilename)
 {
   AS_multicopies.clear();
   AS_multicopies.resize(AS_readpool.size(),0);
-
+    
   ofstream fout;
   fout.open(tmpfilename.c_str(), ios::out);
 
   //cout << "Searching for multicopy reads:\n";
 
-  for(uint8 actseqtype=0; actseqtype<ReadGroupLib::SEQTYPE_END; actseqtype++){
+  for(uint8 actseqtype=0; actseqtype<Read::SEQTYPE_END; actseqtype++){
     vector<uint32> sortedoverlapcounter=overlapcounter;
 
     // set overlapcounter of backbones and railreads and read that are
@@ -3285,7 +4588,7 @@ void Assembly::flagMulticopyReads(const vector<uint32> & overlapcounter, const s
     //  count them
     uint32 numreadsinactseqtype=0;
     for(uint32 i=0; i<overlapcounter.size(); i++){
-      if(AS_readpool[i].isRail()
+      if(AS_readpool[i].isRail() 
 	 || AS_readpool[i].isBackbone()
 	 || AS_readpool[i].getSequencingType()!=actseqtype) {
 	sortedoverlapcounter[i]=0;
@@ -3304,7 +4607,7 @@ void Assembly::flagMulticopyReads(const vector<uint32> & overlapcounter, const s
     uint32 ifrom=0;
     // well, start the 5% quantil only at reads which have at least
     //  1 overlap
-    while(ifrom<sortedoverlapcounter.size()
+    while(ifrom<sortedoverlapcounter.size() 
 	  && sortedoverlapcounter[ifrom]==0) ifrom++;
 
     ifrom+=quantilnumber;
@@ -3322,21 +4625,21 @@ void Assembly::flagMulticopyReads(const vector<uint32> & overlapcounter, const s
       nonsinglets++;
     }
 
-
+      
     if(nonsinglets==0) nonsinglets=1;
     uint32 avgoverlaps=static_cast<uint32>(.5+static_cast<double>(totaloverlaps)/static_cast<double>(nonsinglets));
     // strictly speaking, this is not median. But close enough.
     uint32 medianoverlaps=sortedoverlapcounter[ifrom+((ito-ifrom)/2)];
     //uint32 multicopythreshold=avgoverlaps*2;
     uint32 multicopythreshold=medianoverlaps*2;
-
-    fout << "Hitstatistics (" << ReadGroupLib::getShortNameOfSequencingType(actseqtype) << "): nonsinglets:" << nonsinglets << "\ttotaloverlaps: " << totaloverlaps << "\tavgoverlaps: " << avgoverlaps << "\tmedianoverlaps: " << medianoverlaps << endl;
+      
+    fout << "Hitstatistics (" << Read::getShortNameOfSequencingType(actseqtype) << "): nonsinglets:" << nonsinglets << "\ttotaloverlaps: " << totaloverlaps << "\tavgoverlaps: " << avgoverlaps << "\tmedianoverlaps: " << medianoverlaps << endl;
 
     // now set multicopy flags for affected reads of this sequencing type
     for(uint32 i=0; i<overlapcounter.size(); i++){
-      if(AS_readpool[i].isRail()
+      if(AS_readpool[i].isRail() 
 	 || AS_readpool[i].isBackbone()
-	 || AS_readpool[i].getSequencingType()!=actseqtype) continue;
+	 || AS_readpool[i].getSequencingType()!=actseqtype) continue; 
       if(overlapcounter[i]>multicopythreshold) {
 	AS_multicopies[i]=static_cast<uint8>(actseqtype+1);
 	if(overlapcounter[i]>multicopythreshold*10) {
@@ -3347,8 +4650,8 @@ void Assembly::flagMulticopyReads(const vector<uint32> & overlapcounter, const s
   }
 
   for(uint32 i=0; i<overlapcounter.size(); i++){
-    if(AS_readpool[i].isRail()
-       || AS_readpool[i].isBackbone()) continue;
+    if(AS_readpool[i].isRail() 
+       || AS_readpool[i].isBackbone()) continue; 
     fout << i << "\t" << AS_readpool[i].getName() << "\t" << overlapcounter[i];
     if(AS_multicopies[i]>100) {
       fout << "\tst: " << static_cast<uint16>(AS_multicopies[i]-101);
@@ -3361,7 +4664,7 @@ void Assembly::flagMulticopyReads(const vector<uint32> & overlapcounter, const s
   }
   fout.close();
 }
-*/
+
 
 
 
@@ -3397,20 +4700,14 @@ const Read & Assembly::getRead(uint32 index)
  *
  *************************************************************************/
 
-void Assembly::refreshContigAndReadpoolValuesAfterLoading(ReadPool & rp, list<Contig> & contigs, uint8 nagwarn_templateproblems)
+void Assembly::refreshContigAndReadpoolValuesAfterLoading(ReadPool & rp, list<Contig> & contigs)
 {
-  FUNCSTART("void Assembly::refreshContigAndReadpoolValuesAfterLoading(ReadPool & rp, list<Contig> & contigs, uint8 nagwarn_templateproblems)");
-
-  try{
-    rp.makeTemplateIDs(nagwarn_templateproblems);
+  rp.makeTemplateIDs();
+  rp.makeStrainIDs();
 
-    // Not needed anymore for readgroup approach: RG keeps track of this
-    //rp.makeStrainIDs();
-
-    for(auto & cle : contigs) cle.recalcTemplateIDsAndStrainPresent();
-  }
-  catch(Notify n){
-    n.handleError(THISFUNC);
+  list<Contig>::iterator I=contigs.begin();
+  for(; I!=contigs.end(); I++){
+    I->recalcTemplateAndStrainIDsPresent();
   }
 }
 
@@ -3493,7 +4790,7 @@ void Assembly::refreshContigAndReadpoolValuesAfterLoading(ReadPool & rp, list<Co
 //	}
 //	Irun++;
 //      }
-//
+// 
 //      // .. then in the other one
 //      //Irun=AS_edges_forward.lower_bound(id2);
 //      tmpegde.rid1=id2;
@@ -3526,3 +4823,175 @@ void Assembly::refreshContigAndReadpoolValuesAfterLoading(ReadPool & rp, list<Co
 /////////////////////////////////////////////////////////////////////////
 ////////////////////        Dead since a while         //////////////////
 /////////////////////////////////////////////////////////////////////////
+
+
+/////*************************************************************************
+//// *
+//// *
+//// *
+//// *
+//// *************************************************************************/
+////
+////void Assembly::flagMulticopyReads(const vector<uint32> & overlapcounter, const string & tmpfilename)
+////{
+////  AS_multicopies.clear();
+////  AS_multicopies.resize(AS_readpool.size(),0);
+////    
+////  ofstream fout;
+////  fout.open(tmpfilename.c_str(), ios::out);
+////
+////
+////  for(uint32 actid=0; actid<AS_readpool.size(); actid++){
+////    Read & r=AS_readpool.getRead(actid);
+////    
+////    //Read::setCoutType(Read::AS_TEXT);
+////    //cout << r;
+////
+////    if(r.hasValidData()
+////       && r.hasBaseFlags()){
+////
+////      int32 lpos=r.getLeftClipoff();
+////      for(; lpos<static_cast<int32>(r.getLenSeq());lpos++){
+////	if(r.hasTheseBaseFlagsSet(Read::BFLAGS_PROBABLE_MULTICOPY,lpos)){
+////	  AS_multicopies[actid]=1;
+////	  break;
+////	}
+////      }
+////    }
+////  }
+////
+////  for(uint32 i=0; i<overlapcounter.size(); i++){
+////    if(AS_readpool[i].isRail() 
+////       || AS_readpool[i].isBackbone()) continue; 
+////    fout << i << "\t" << AS_readpool[i].getName() << "\t" << overlapcounter[i];
+////    if(AS_multicopies[i]>100) {
+////      fout << "\tst: " << static_cast<uint16>(AS_multicopies[i]-101);
+////      fout << "\tmulticopy / insane (forgotten clone vector?)";
+////    }else if(AS_multicopies[i]>0) {
+////      fout << "\tst: " << static_cast<uint16>(AS_multicopies[i]-1);
+////      fout << "\tmulticopy";
+////    }
+////    fout << '\n';
+////  }
+////  fout.close();
+////}
+//
+//
+//
+/////*************************************************************************
+//// *
+//// *
+//// *
+//// *************************************************************************/
+////
+//////#define CEBUG(bla)   {cout << bla; cout.flush(); }
+////void Assembly::transferContigReadsToReadpool(const Contig & buildcon, vector<Contig::pbdse_t> & pbdsev, int32 passnr)
+////{
+////  FUNCSTART("void Assembly::transferContigReadsToReadpool(const Contig & buildcon, vector<Contig::pbdse_t> & pbdsev)");
+////
+////  cout << "Transfering reads to readpool." << endl;
+////
+////  const vector<Contig::contigread_t> & cr = buildcon.getContigReads();
+////  vector<Contig::contigread_t>::const_iterator crI = cr.begin();
+////  
+////  for(;crI!=cr.end();crI++){
+////    if(crI->orpid>=0){
+////      AS_readpool[crI->orpid]=crI->read;
+////      //AS_readpool[crI->orpid].removeGapsFromRead();
+////    }
+////  }
+////  
+////  vector<Contig::pbdse_t>::const_reverse_iterator pRI=pbdsev.rbegin();
+////  
+////  for(; pRI != pbdsev.rend(); pRI++){
+////    CEBUG("Apply: " << *pRI);
+////    BUGIFTHROW(pRI->rid >= AS_readpool.size(), "pRI->rid (" << pRI->rid << ") >= AS_readpool.size() ?");
+////    //Read::setCoutType(Read::AS_TEXT);
+////    //cout << CON_reads[pRI->cri].read;
+////    AS_readpool[pRI->rid].correctNStretch(pRI->rposs,
+////					  pRI->rpose,
+////					  pRI->changeestim);
+////  }
+////  
+////  crI = cr.begin();
+////  for(;crI!=cr.end();crI++){
+////    if(crI->orpid>=0){
+////      if(passnr==4 && AS_readpool[crI->orpid].isSequencingType(Read::SEQTYPE_PACBIO)){
+////	AS_readpool[crI->orpid].transformGapsToNs();
+////      }
+////      AS_readpool[crI->orpid].removeGapsFromRead();
+////    }
+////  }
+////
+////  FUNCEND();
+////}
+//
+//
+//
+/////*************************************************************************
+//// *
+//// *
+//// *
+//// *
+//// *************************************************************************/
+////
+////void Assembly::markNastyReapeatsWithSkim(int32 version, const string prefix, const string postfix, const string tmpfname)
+////{
+////  assembly_parameters const & as_fixparams= AS_miraparams[0].getAssemblyParams();
+////  skim_parameters const & skim_params= AS_miraparams[0].getSkimParams();
+////
+////  string filename;
+////
+////  {
+////    if(tmpfname.size()){
+////      filename=buildFileName(version, prefix, postfix, tmpfname+"_hist", "");
+////    }else{
+////      filename=buildFileName(version, prefix, postfix, 
+////			     as_fixparams.as_tmpf_skimmarknastyrepeats+"_hist",
+////			     ".lst");
+////    }
+////
+////    ofstream fout;
+////    fout.open(filename.c_str(), ios::out|ios::trunc);
+////    Skim s2;
+////    s2.maskNastyRepeats(AS_readpool, 
+////			skim_params.sk_nastyrepeatsthreshold,
+////			&fout);
+////    fout.close();
+////    if(as_fixparams.as_dateoutput) {
+////      dateStamp(cout);
+////      cout << '\n';
+////    }
+////  }
+////
+////  {
+////    if(tmpfname.size()){
+////      filename=buildFileName(version, prefix, postfix, tmpfname+"_nastyseq", "");
+////    }else{
+////      filename=buildFileName(version, prefix, postfix, 
+////			     as_fixparams.as_tmpf_skimmarknastyrepeats+"_nastyseq",
+////			     ".lst");
+////    }
+////
+////    ofstream fout;
+////    fout.open(filename.c_str(), ios::out|ios::trunc);
+////    for(uint32 rpi=0; rpi<AS_readpool.size(); rpi++){
+////      Read & actread= AS_readpool.getRead(rpi);
+////      if(!actread.hasValidData()
+////	 || !actread.isUsedInAssembly()) continue;
+////      if(actread.hasTag(Read::REA_tagMRMr,-1)){
+////	for(uint32 tn=0; tn<actread.getNumOfTags(); tn++){
+////	  const tag_t & acttag=actread.getTag(tn);
+////	  if(acttag.identifier==Read::REA_tagMRMr){
+////	    fout << actread.getName() << '\t';
+////	    for(uint32 readpos=acttag.from; readpos<=acttag.to; readpos++){
+////	      fout << actread.getBaseInSequence(readpos);
+////	    }
+////	    fout << '\n';
+////	  }
+////	}
+////      }
+////    }
+////  }
+////      
+////}
diff --git a/src/mira/assembly.H b/src/mira/assembly.H
index 2bd4b1f..93c7c93 100644
--- a/src/mira/assembly.H
+++ b/src/mira/assembly.H
@@ -11,37 +11,42 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
+// 	$Id$	
+
 #ifndef _assembly_h_
 #define _assembly_h_
 
+#include "mira/assembly_info.H"
+#include "mira/assembly_output.H"
+
+
+
 #include "stdinc/defines.H"
 #include "stdinc/stlincludes.H"
 
-#include "mira/assembly_info.H"
-#include "mira/assembly_output.H"
-#include "mira/dataprocessing.H"
-#include "mira/manifest.H"
-#include "mira/overlapedges.H"
 #include "mira/parameters.H"
 #include "mira/readpool.H"
-#include "mira/readlotstat.H"
-#include "mira/skim.H"              // only for bannedoverlappairs_t ??? see if this can be improved
-#include "mira/warnings.H"
+#include "mira/skim.H"
+
+
+
+
+//#include "mira/dna_sand32.H"
+//#include "mira/blocksearch.H"
 
-class PPathfinder;
 
 
 #ifdef MIRA_HAS_EDIT
@@ -53,100 +58,124 @@ typedef bool EDITParameters;
 
 
 
-enum { ASREADPOOLOK=1, ASMATCHTABLEOK, ASADSLISTOK, ASCONTIGSOK,
+enum { ASREADPOOLOK=1, ASMATCHTABLEOK, ASADSLISTOK, ASCONTIGSOK, 
        ASUSEDIDSOK, ASVECTORSCLIPPED,
        ASNUMOFSTEPS};
 
 
+
+struct newedges_t{
+  int32 rid1;                   // number of read in seqpool
+  int32 linked_with;                   // number of read in seqpool
+  uint32 best_weight;                   // score ratio^2*score. Make sure it is >0 !!! (for pathfinder)
+  uint32 adsfindex;              // index of adsfacts elements this refers to
+  int16 direction;
+
+  bool pf_allowquickoverlap:1;   // if AS_allowquickoverlap for bot rids is true
+
+  bool pf_banned:1;              // temp use by pathfinder: banned overlap
+
+  bool ol_stronggood:1;  // frequency: 2*bph-1 pos at 3, thereof bph-1 contiguous
+  bool ol_weakgood:1;   // frequency: bph-1 positions contiguous at 3
+  bool ol_belowavgfreq:1; // frequency: bph-1 positions contiguous at <=3
+  bool ol_norept:1;      // nothing >3 (but can contain 1 (single hashes == errors)
+  bool ol_rept:1;      // bph-1 positions >=5
+
+  friend ostream & operator<<(ostream &ostr, const newedges_t & e){
+    ostr << "NE:\t" << e.rid1
+	 << '\t' << e.linked_with
+	 << '\t' << e.best_weight
+	 << '\t' << e.adsfindex
+	 << "\tdir " << e.direction
+	 << "\tban " << e.pf_banned
+	 << "\tsg  " << e.ol_stronggood
+	 << "\twg  " << e.ol_weakgood
+	 << "\tbaf " << e.ol_belowavgfreq
+	 << "\tnrp " << e.ol_norept
+	 << "\trep " << e.ol_rept
+	 << '\n';
+    return ostr;
+  }
+};
+
+
+struct skimedges_t{
+  int32  rid1;                   // number of read in seqpool
+  int32  linked_with;                   // number of read in seqpool
+  int32  eoffset;
+
+  uint32 skimweight;                   // score ratio^2*score
+  size_t skimindex;         // index of line in original skim file
+
+  int8   rid1dir;  // new for reduceSkimHits2
+  int8   rid2dir;
+  uint8  scoreratio;
+
+  bool ol_stronggood:1;  // frequency: 2*bph-1 pos at 3, thereof bph-1 contiguous
+  bool ol_weakgood:1;   // frequency: bph-1 positions contiguous at 3
+  bool ol_belowavgfreq:1; // frequency: bph-1 positions contiguous at <=3
+  bool ol_norept:1;      // nothing >3 (but can contain 1 (single hashes == errors)
+  bool ol_rept:1;      // bph-1 positions >= 5 freq
+
+  friend ostream & operator<<(ostream &ostr, const skimedges_t & e){
+    ostr << "SE:\t" << e.rid1
+	 << '\t' << e.linked_with
+	 << '\t' << e.eoffset
+	 << '\t' << e.skimweight
+	 << '\t' << e.skimindex
+	 << '\t' << static_cast<int16>(e.rid1dir)
+	 << '\t' << static_cast<int16>(e.rid2dir)
+	 << '\t' << static_cast<uint16>(e.scoreratio)
+	 << '\t' << e.ol_stronggood
+	 << '\t' << e.ol_weakgood
+	 << '\t' << e.ol_belowavgfreq
+	 << '\t' << e.ol_norept
+	 << '\t' << e.ol_rept
+	 << '\n';
+    return ostr;
+  }
+};
+
+
+#include "mira/newpathfinder.H"
+
+
 class Assembly
 {
-public:
-  enum { DEBRIS_NOTDEBRIS=0,
-	 DEBRIS_UNSPECIFIED,
-	 DEBRIS_NOOVERLAP,
-	 DEBRIS_MEGAHUB,
-	 DEBRIS_MASKEDNASTYREPEAT,
-	 DEBRIS_MASKEDHAF7REPEAT,
-	 DEBRIS_MASKEDHAF6REPEAT,
-	 DEBRIS_NOTMAPPED,
-	 DEBRIS_ABORTEDCONTIGCREATION,
-	 DEBRIS_TINYCONTIG,
-	 DEBRIS_TINYCLUSTER,
-	 DEBRIS_TINYCLUSTERORPHAN,
-	 DEBRIS_UNSAVEDSINGLET,
-	 DEBRIS_DIGITAL_NORMALISATION,
-	 DEBRIS_SHORTONLOAD,
-	 DEBRIS_CLIP_BADSOLEXAEND,
-	 DEBRIS_CLIP_KNOWNADAPTORRIGHT,
-	 DEBRIS_CLIP_QUALMINTHRESHOLD,
-	 DEBRIS_CLIP_LOWERCASEFRONT,
-	 DEBRIS_CLIP_LOWERCASEBACK,
-	 DEBRIS_CLIP_QUALCLIPS,
-	 DEBRIS_CLIP_MASKEDBASES,
-	 DEBRIS_CLIP_BADSEQUENCESERACH,
-	 DEBRIS_CLIP_POLYBASEATEND,
-	 DEBRIS_CLIP_POLYAT,
-	 DEBRIS_CLIP_MINLEFTCLIP,
-	 DEBRIS_CLIP_MINRIGHTCLIP,
-	 DEBRIS_CLIP_PHIX174,
-	 DEBRIS_CLIP_PROPOSEDENDCLIP,
-	 DEBRIS_CLIP_CHIMERA,
-	 DEBRIS_CLIP_TERMINALLYINCORRECTIBLEORCHIMERA,
-	 DEBRIS_CLIP_INCORRECTIBLEENDORCHIMERA
-  };
-
 private:
 
   struct usedtmpfiles_t {
-    std::string basename;
-    std::string filename;
+    string basename;
+    string filename;
 
     size_t estimateMemoryUsage() const
       {
 	size_t components=0;
 	size_t cnum,cbytes,freecap,clba;
-
+  
 	components+=estimateMemoryUsageOfContainer(basename,false,cnum,cbytes,freecap,clba);
 	components+=estimateMemoryUsageOfContainer(filename,false,cnum,cbytes,freecap,clba);
 	return components;
       }
   };
 
-  // no dedicated save, but reconstruct from command line save / manifest?
-  std::vector<MIRAParameters> AS_miraparams;
-  Manifest AS_manifest;
-
-  Warnings AS_warnings;
 
   AssemblyInfo AS_assemblyinfo;
 
-  DataProcessing AS_dataprocessing;
-
-  std::list<Contig>   AS_contigs;
+  list<Contig>   AS_contigs;
 
   // backbonecontigs
-  std::list<Contig>   AS_bbcontigs;
+  list<Contig>   AS_bbcontigs;
 
   void (*AS_contigbuilt_callbackfunc)(Contig &, const ReadPool &);
 
 
   /***********************************************************************************
    *
-   * important for checkpointing and resuming
+   * important for checkpointing
    *
    ***********************************************************************************/
 
-  // if true, then tries to resume an assembly from checkpoint files.
-  // set through class constructor
-  bool AS_resumeasembly;
-
-  // even more resume:
-  // if true, loads existing temp data at different stages of a pass if
-  // if false, does not load temp data even if it exists, recomputes
-  // set to "true" when doing an assembly which "resumes", set to false as soon as
-  //  in a resume assembly a data file is missing
-  bool AS_resumeisok;
-
   /** Needs saving *******************************************************************/
 
   // this holds the reads
@@ -155,20 +184,15 @@ private:
   // which read pairs are banned from overlap
   bannedoverlappairs_t AS_permanent_overlap_bans;  // no load/save done yet
 
-  std::vector<uint32> AS_maxcoveragereached; /* the max coverage each read has
+  // no dedicated save, but reconstruct from command line save?
+  vector<MIRAParameters> AS_miraparams;
+
+  vector<uint32> AS_maxcoveragereached; /* the max coverage each read has
 					    attained throughout the whole
 					    assembly.  Helps to refine the
 					    definition of multicopies.
 					 */
 
-  /** Needs saving for resume of skim results ****************************************/
-  // if a read is well connected, i.e. has long overlaps (>50% of read)
-  // currently initialised with false
-  // set to true if AS_overlapcritlevell & -r both < 255
-  // cleared and rebuilt in each call of findPossibleOverlaps()
-  //
-  // this could be a std::vector<bool> if only I found a way to save that beast to disk efficiently
-  std::vector<uint8> AS_wellconnected;
 
   /** May need saving ****************************************************************/
   // this one is slightly different to readpool.size():
@@ -177,96 +201,40 @@ private:
   uint32     AS_num_reads_valid;
   uint32     AS_num_reads_too_small;
 
-  // reads categorised as having incorrectible end or chimera
-  // currently 0 or 1;
-  // set by data processing search for incorrectible ends or chimera
-  std::vector<uint8>  AS_incorchim;
-
-  // reads categorised by SKIM as megahubs
-  // currently 0 or 1; maybe later also 2 for "true" megahubs (and 1 for saved megahubs);
-  // vector is empty when skim should not filter for megahubs
-  std::vector<uint8>  AS_skimmegahubs;
-
-  // Why was a read sorted away
-  // Never cleared, to be used as template for AS_isdebris
-  std::vector<uint8>  AS_debrisreason;
-
-  //////////// not a big problem if not saved, but results are different //////////
-  // TODO: maybe consolidate into one byte, using defined enums & class for accessing?
-
-  // has info whether a read is a troublemaker
-  std::vector<uint8>  AS_istroublemaker;
-
-  // has info whether a read once was not in contig
-  //  (throughout all assembly) and hence all overlaps should be
-  //  taken to ensure it has all possibilities to get back into a
-  //  contig (no skim edge reduction)
-  std::vector<uint8>  AS_needalloverlaps;
-
-  std::vector<uint8>  AS_multicopies;   /* reads with more overlaps than
-				      expected on average have 1 here
-				      pathfinder will start building
-				      elsewhere, and include those
-				      last
-				   */
-
-  std::vector<uint8>  AS_hasmcoverlaps;  /* reads that overlap with a read
-				       that is categorised as multi-
-				       copy get 1 here
-				       initialised by pathfinder if
-				       vector is empty (==once
-				       every pass of MIRA)
-				    */
-  std::vector<uint8> AS_hasreptoverlap; /* reads that have ol_rept overlaps
-					   init by pathfinder if empty (once every pass)
-					   maybe unused atm
-					*/
-  std::vector<uint8> AS_hasnoreptoverlap; /* reads that have ol_norept overlaps
-					     init by pathfinder if empty (once every pass)
-					  */
-
-  std::vector<uint8> AS_maybespoilsport; /* reads that are not well connected and have no
-					    valid kmers at one end (or both)
-					     init by pathfinder if empty (once every pass)
-					  */
-
-  std::vector<uint8> AS_estnochimerakill; /* atm: reads that have kmer <=64 without gaps in
-					     valid hash status get a true here.
-					     do not clear between passes.
-					     TODO: should be saved
-					  */
-
 
   /***********************************************************************************/
   /***********************************************************************************/
 
   // these hold the filenames of the "full" skim searches
-  std::string AS_posfmatch_full_filename;
-  std::string AS_poscmatch_full_filename;
+  string AS_posfmatch_full_filename;
+  string AS_poscmatch_full_filename;
 
   // these hold the filenames of the working set of skim searches
   // these might be a full or a reduced set
-  std::string AS_posfmatch_filename;
-  std::string AS_poscmatch_filename;
+  string AS_posfmatch_filename;
+  string AS_poscmatch_filename;
 
 
-  std::vector<skimedges_t> AS_skim_edges;  // block with x elements
-  std::vector<bool> AS_skimstaken;         // size of total skims in file
-
-  std::vector<bool>   AS_readmaytakeskim;     // size of readpool
-  std::vector<uint32> AS_numskimoverlaps;     // size of readpool
-  std::vector<uint32> AS_numleftextendskims;  // size of readpool
-  std::vector<uint32> AS_numrightextendskims; // size of readpool
+  vector<skimedges_t> AS_skim_edges;  // block with x elements
+  vector<bool> AS_skimstaken;         // size of total skims in file
+  
+  vector<bool>   AS_readmaytakeskim;     // size of readpool
+  vector<uint32> AS_numskimoverlaps;     // size of readpool
+  vector<uint32> AS_numleftextendskims;  // size of readpool
+  vector<uint32> AS_numrightextendskims; // size of readpool
 
   // minimum score ratio hits must have to be taken
-  std::vector<uint8> AS_skimleftextendratio; // size of readpool
-  std::vector<uint8> AS_skimrightextendratio; // size of readpool
+  vector<uint8> AS_skimleftextendratio; // size of readpool
+  vector<uint8> AS_skimrightextendratio; // size of readpool
+
+
 
-  std::ofstream AS_CUMADSLofstream;
+  ofstream AS_CUMADSLofstream;
+  vector<AlignedDualSeqFacts> AS_adsfacts;
+  vector<newedges_t> AS_confirmed_edges;
 
-  // adsfcontainer_t / necontainer_t defined in overlapedges.H
-  adsfcontainer_t AS_adsfacts;
-  necontainer_t   AS_confirmed_edges;
+  // TODO
+  //vector<bool> AS_allowquickoverlap;
 
   uint32 AS_numADSFacts_fromalignments;
   uint32 AS_numADSFacts_fromshreds;
@@ -274,252 +242,235 @@ private:
 // temporarily used
 // emptied at each Skim pass, set when cutBackPossibleChimeras() called
 //  queried in ...
-  std::vector<bool> AS_chimeracutflag;
+  vector<bool> AS_chimeracutflag;
   bool AS_doneskimchimera;
 
   // Skim will say how many hits it has written to disk per read id
   //  used for reducing skim hits afterwards
-  std::vector<uint32> AS_writtenskimhitsperid;
+  vector<uint32> AS_writtenskimhitsperid;
 
   // Skim will also give back info what the best overlap criterion levels
   //  are for left and right overlaps
   // also used to reduce skim hits by getting rid of unnecessary matches
-  // [0] is for norept overlaps, [1] for rept
-  std::vector<std::vector<uint8>> AS_overlapcritlevelvl;
-  std::vector<std::vector<uint8>> AS_overlapcritlevelvr;
+  vector<uint8> AS_overlapcritlevell;
+  vector<uint8> AS_overlapcritlevelr;
+
+  // if a read is well connected, i.e. has long overlaps (>50% of read)
+  // currently initialised with false
+  // set to true if AS_overlapcritlevell & -r both < 255
+  vector<bool> AS_wellconnected;
 
 
   /* temporary use for vector clipping
      holds space for clipped! sequence, more is not needed */
-  std::vector<std::vector<uint32> > AS_readhitmiss;
-  std::vector<std::vector<uint32> > AS_readhmcovered;
-  std::vector<uint32>          AS_count_rhm;
+  vector<vector<uint32> > AS_readhitmiss;
+  vector<vector<uint32> > AS_readhmcovered;
+  vector<uint32>          AS_count_rhm;
 
 
-  std::vector<int32>           AS_clipleft;       // holds result of clipping
-  std::vector<int32>           AS_clipright;      //  until can be applied
+  vector<int32>           AS_clipleft;       // holds result of clipping
+  vector<int32>           AS_clipright;      //  until can be applied
 
 
-  std::vector<int8>   AS_used_ids;         /* IDs which have been already
-					  put into a contig are marked
+  vector<int8>   AS_used_ids;         /* IDs which have been already
+					  put into a contig are marked 
 					  with 1
 					 IDs wich could not have been loaded
 					  or are too small are marked -1
 					 IDs not used yet are marked 0 */
 
+  vector<uint8>  AS_multicopies;   /* reads with more overlaps than 
+				      expected on average have 1 here
+				      pathfinder will start building
+				      elsewhere, and include those
+				      last
+				   */
+
+  vector<uint8>  AS_hasmcoverlaps;  /* reads that overlap with a read
+				       that is categorised as multi-
+				       copy get 1 here
+				       initialised by pathfinder if
+				       vector is empty (==once
+				       every pass of MIRA)
+				    */
+
 
-  uint32 AS_hashstat_avghashfreq; // rough coverage estimator; if >0 then was set by performHashAnalysis()
 
-  std::vector<uint32> AS_coverageperseqtype; /* This stores the median of all
-					   average coverages encountered in
-					   contigs at the end of the current round (per
+  vector<uint32> AS_coverageperseqtype; /* This stores the median of all
+					   average coverages envountered in
+					   contigs of the last round (per
 					   sequencing type) Used for contig
 					   bulding in next round. Also used to
 					   analyse contig coverage and refine
 					   AS_multicopies
 					*/
-  uint32 AS_coveragetotal; // as above, but avg. total coverage of all seqtypes
+  
 
+  // has info whether a read is a troublemaker
+  vector<uint8>  AS_istroublemaker;
 
   // has info whether a read is not in a contig
-  //  (per pass: initialised with AS_debrisreason)
-  std::vector<uint8>  AS_isdebris;
+  //  (per pass)
+  vector<uint8>  AS_isdebris;
 
+  // has info whether a read once was not in contig
+  //  (throughout all assembly) and hence all overlaps should be
+  //  taken to ensure it has all possibilities to get back into a
+  //  contig (no skim edge reduction)
+  vector<bool>   AS_needalloverlaps;
 
   // this vector is for the repeat resolver after the building
-  //  of contigs. if true, all overlaps with the read in question will
+  //  of contigs. if true, all overlaps with the read in question will 
   //  be computed
   // it's only temporarily filled
-  std::vector<bool>   AS_readsforrepeatresolve;
+  vector<bool>   AS_readsforrepeatresolve;
 
   // the following three vectors are for computing troublemakers
   // they are only temporarily filled
-  std::vector<uint32> AS_allrmbsok;
-  std::vector<uint32> AS_probablermbsnotok;
-  std::vector<uint32> AS_weakrmbsnotok; /* three vectors together define a ratio
+  vector<uint32> AS_allrmbsok;
+  vector<uint32> AS_probablermbsnotok;
+  vector<uint32> AS_weakrmbsnotok; /* three vectors together define a ratio
 				      with which a given read has problems
 				      with weak rmb mismatches
 				      if notok > ok, then the weights
 				      of a read in the overlap graph will be
 				      reduced */
 
-  std::vector<int8>   AS_steps;    // 0 not done, 1 done, -1 need reeval
-
-
-  std::vector<bool>   AS_seqtypespresent;
-  bool                AS_hasbackbones;
+  vector<int8>   AS_steps;    // 0 not done, 1 done, -1 need reeval
 
-  std::list<usedtmpfiles_t> AS_usedtmpfiles;
+  
+  vector<bool>   AS_seqtypespresent;
 
-  ///////////////
+  list<usedtmpfiles_t> AS_usedtmpfiles;
 
-  // stats for buildfirstcontigs;
-  struct bfcstats_t {
-    uint32 numnewsrm;
-    uint32 numeditovercall;
-    uint32 numedithashfreq;
-    uint32 numdisassemblies;
+  // saved data for deferred save in GFF3 format
+  // TODO: not functional yet
+  list<string> AS_gff3defer_names;           // contig names
+  list<string> AS_gff3defer_paddedcons;      // padded contig cons
+  list<string> AS_gff3defer_unpadded_cons;   // unpadded contig cons
 
-    bfcstats_t() : numnewsrm(0), numeditovercall(0), numedithashfreq(0), numdisassemblies(0) {};
-  };
-  std::vector<bfcstats_t> AS_bfcstats;  // vector of size 2: 0 for non-rep contigs, 1 for rep
-
-  ///////////////
-
-  bool AS_donequickdenovocoveragecheck;
-
-  ///////////////
-
-  int32 AS_maxtemplateid;
-  std::vector<Contig::templateguessinfo_t> AS_templateguesses;
-
-  bool AS_guessedtemplatevalues;
-
-  // readgroup template guess
-  struct rgtguess_t {
-    uint32 count=0;
-    Contig::templateguessinfo_t tg;
-    double mean=0;
-    double stdev=0;
-    double skewness=0;
-    int32 deduced_min=-1;
-    int32 deduced_max=-1;
-
-    friend std::ostream & operator<<(std::ostream &ostr, const rgtguess_t & atgt){
-      ostr << "rgid: " << atgt.tg.rgid.getLibId()
-	   << "\tc: " << atgt.count
-	   << "\tsp: " << static_cast<int16>(atgt.tg.splace_seen)
-	   << " (" << ReadGroupLib::getNameOfSegmentplacement(atgt.tg.splace_seen)
-	   << ")\tm: " << atgt.mean
-	   << "\td: " << atgt.stdev
-	   << "\ts: " << atgt.skewness
-	   << "\t-: " << atgt.deduced_min
-	   << "\t+: " << atgt.deduced_max;
-      return ostr;
-    }
-  };
-
-  // AAAAAAAAAAAAAAAAAAARRRRRRRRRRRRRRRGGGGGGGGGGGGGGGG!
-  // rgstinfo_t and readlotstats are somehow duplicated functionality
-  //
-  // TODO: fix that
-  //
-  // rg statistics + template info
-  struct rgstinfo_t {
-    uint64 total_bases_unclipped=0;
-    uint64 total_bases_clipped=0;
-    uint32 numreads=0;
-    uint32 numreadsclipped=0;
-    rgtguess_t rgtguess;
-  };
-
-  std::vector<rgstinfo_t> AS_rgstinfo;
-
-  std::vector<ReadLotStat> AS_current_rls_bytype;  // will be set to size ReadGroupLib::SEQTYPE_END
-  std::vector<ReadLotStat> AS_current_rls_byrg;    // will be set to size ReadGroupLib::getNumReadGroups();
-
-  // copy of the above as snapshot just before the assembly enters pass 1
-  std::vector<ReadLotStat> AS_fixed_rls_bytype;
-  std::vector<ReadLotStat> AS_fixed_rls_byrg;
-
-  ///////////////
 
   int64 AS_systemmemory; // initialised by constructor: how much mem the system has
                           // is 0 if info not available
 
-  uint32 AS_applydiginorminpass=0; // set dynamically
 
+  bool AS_454dosimpleedit;
+  bool AS_needsskimfornastyrepeats;
 
-  //
+  // 
   bool AS_deleteoldresultfiles;
 
+  // if true, then tries to resume an assembly from checkpoint files
+  bool AS_resumeasembly;
 
   bool AS_shouldrun_nfs_check;
 
-  bool AS_logflag_dumprailreads=false;
-  bool AS_logflag_dumphashanalysis=false;
-  bool AS_logflag_oclevel=false;
-  bool AS_logflag_swbbcheck=false;
-  bool AS_logflag_adsdump=false;
-
-  bool AS_logflag_loadedoverlaps=false;
-
-  bool AS_logflag_dumpusedids=false;
-
-
-  // temp objects, so as not to create them a couple of million times
-  multitag_t AS_tmptag_CRMr;
-
-  // to be set by outside caller
-  bool AS_everythingwentfine;
-
+  bool AS_logflag_dumprailreads;
+  bool AS_logflag_dumphashanalysis;
+  bool AS_logflag_oclevel;
+  bool AS_logflag_swbbcheck;
+  bool AS_logflag_adsdump;
+  bool AS_logflag_dumpusedids;
 
   //Functions
 
 /*************************************************************************
  *
- *  assembly_misc
+ *  assembly_dataprocessing
  *
  *************************************************************************/
 private:
-//  void mergeTemplateInfo(const std::string & tifile,
-//			 const std::string & logname,
-//			 const std::string & logprefix);
-  template<class TVHASH_T>
-  void priv_phahelper(const std::string & kmerfilename,
-		      const std::string & signalfile,
-		      uint32 basesperhash,
-		      bool rarekmerfinalkill,
-		      int32 version,
-		      const std::string prefix,
-		      const std::string postfix,
-		      const std::string logname);
-  void priv_performHashAnalysis(const std::string & kmerfilename,
-				bool usesignal,
-				bool rarekmerfinalkill,
-				int32 version,
-				const std::string prefix="",
-				const std::string postfix="",
-				const std::string logname="");
-  uint64 performNewProposedCutbackClips(const std::string & tmpname,
-					const std::string & tmpprefix);
-  void cutBackPossibleChimeras(const std::string & tmpname,
-			       const std::string & tmpprefix,
-			       const std::vector<int32> & chuntleftcut,
-			       const std::vector<int32> & chuntrightcut,
-			       std::vector<bool> & chimeracutflag);
-
+  void mergeSSAHA2SMALTVecScreenData(const string & ssahafile,
+				     bool issmalt,
+				     const string & tmpname,
+				     const string & tmpprefix);
+  void mergeTemplateInfo(const string & tifile,
+			 const string & logname,
+			 const string & logprefix);
+  void performHashAnalysis(int32 version, 
+			   const string prefix="", 
+			   const string postfix="", 
+			   const string tmpname="");
+  uint64 performNewProposedCutbackClips(const string & tmpname,
+					const string & tmpprefix);
+  static void buntifyHelper(uint8 allowedfreq, 
+			    uint8 basesperhash,
+			    vector<Read::bposhashstat_t>::const_iterator bhsI,
+			    vector<Read::bposhashstat_t>::const_iterator bhsE,
+			    vector<uint8>::iterator tfI,
+			    vector<uint8>::iterator tfE);
+  void cutBackPossibleChimeras(const string & tmpname,
+			       const string & tmpprefix,
+			       const vector<int32> & chuntleftcut,
+			       const vector<int32> & chuntrightcut,
+			       vector<bool> & chimeracutflag);
+  void clipBadSolexaEnds(const string & tmpname,
+			 const string & tmpprefix);
+  void performLowerCaseClipping(const string & tmpname, 
+				const string & tmpprefix);
+  void performQualAndMaskClips(const string & tmpname,
+			       const string & tmpprefix);
+  void performPool_MinimumQualityThreshold(const string & tmpname,
+					   const string & tmpprefix);
+  bool performRead_MinimumQualityThreshold(Read & actread,
+					   base_quality_t minqual,
+					   uint32 minnum);
+  void performPool_AdaptorRightClip(const string & tmpname,
+				    const string & tmpprefix,
+				    const uint8 seqtype);
+  void performMinimumLeftClips(bool onsltag, bool onmaskchar,
+			       const string & tmpname,
+			       const string & tmpprefix);
+  void performMinimumRightClips(const string & tmpname,
+				const string & tmpprefix);
+  void performBadSequenceSearch(const string & tmpname,
+				const string & tmpprefix);
   void correctContigs();               // TODO: have a look whether here?
-  void calcPossibleSeqVectorClipoffs(int32 version=-1,
-				     const std::string prefix="",
-				     const std::string postfix="",
-				     const std::string tmpname="");
+  void calcPossibleSeqVectorClipoffs(int32 version=-1, 
+				     const string prefix="", 
+				     const string postfix="", 
+				     const string tmpname="");
   void performSeqVectorClippings();
-
-  void extendADS(int32 version=-1,
-		 const std::string prefix="",
-		 const std::string postfix="",
-		 const std::string tmpname="");
-
+  void performSRMRightClippings();
+
+  void extendADS(int32 version=-1, 
+		 const string prefix="", 
+		 const string postfix="", 
+		 const string tmpname="");
+
+  void clipPolyATAtEnds(const string & tmpname,
+			const string & tmpprefix);
+  void clipPolyBaseAtEnd(const string & tmpname, 
+			 const string & tmpprefix);
+  bool searchPolyBaseFrom5Prime(Read & actread,
+				const char polybase,
+				int32 & lpolystart, 
+				int32 & rpolyend, 
+				const uint32 mincount, 
+				const uint32 maxbad,
+				int32 grace);
+  bool searchPolyBaseFrom3Prime(Read & actread,
+				const char polybase,
+				int32 & lpolystart, 
+				int32 & rpolyend, 
+				const uint32 mincount, 
+				const uint32 maxbad,
+				int32 grace);
   void shredReadsIntoReadPool(ReadPool & sourcepool,
-			      uint32 shredlen,
+			      uint32 shredlen, 
 			      uint32 shredoffset,
 			      uint8 shredreadtype,
-			      const std::string & shredstrain);
-  void analyseOverlapHashProfile(std::vector<uint8> & profile,
-				 std::vector<skimedges_t>::const_iterator seI,
+			      const string & shredstrain);
+  void analyseOverlapHashProfile(vector<uint8> & profile,
+				 vector<skimedges_t>::const_iterator seI,
 				 ADSEstimator & adse);
-  void analyseTemplateGuesses();
-
-  bool warnAtSmileCoverage();
-  bool warnChimeraContent();
-  bool warnAtHighCoverages(uint32 measuredcov);
-
-  void priv_removePotentiallyWrongBaseInserts(Contig & con);
-
   //void clipTo200();
   //void performHashEditing();
 
+public:
+  static void buntifyReadsByHashFreq(uint8 basesperhash,
+				     ReadPool & rp);
+ 
 
 /*************************************************************************
  *
@@ -527,7 +478,7 @@ private:
  *
  *************************************************************************/
 public:
-  std::vector<std::string> assembleESTs();
+  vector<string> assembleESTs();
 
 
 /*************************************************************************
@@ -537,121 +488,94 @@ public:
  *************************************************************************/
 private:
   void reduceSkimHits4(int32 version=-1,
-		       const std::string prefix="",
-		       const std::string postfix="",
-		       const std::string tmpname="");
+		       const string prefix="", 
+		       const string postfix="", 
+		       const string tmpname="");
   void rsh4_countTotalSkimsTaken();
-  void rsh4_denormaliseSkimHits(const std::string & dnsfile,
-				std::list<int64> & idblocks,
-				std::vector<uint64> & blockpos,
-				std::vector<size_t> & blocklen);
-  size_t rsh4_getNextNormalisedSkimBlock(std::list<int64> & idblocks,
-					 int64 & blockstartid,
+  void rsh4_denormaliseSkimHits(const string & dnsfile,
+				list<int64> & idblocks, 
+				vector<uint64> & blockpos,
+				vector<size_t> & blocklen);
+  size_t rsh4_getNextNormalisedSkimBlock(list<int64> & idblocks, 
+					 int64 & blockstartid, 
 					 int64 & blockendid);
-  size_t rsh4_loadNormalisedSkimHitBlock(const std::string & filename,
-					 uint64 skimindex,
+  size_t rsh4_loadNormalisedSkimHitBlock(const string & filename, 
+					 size_t skimindex, 
 					 int64 blockstartid, int64 blockendid,
 					 int8 rid1dir, int8 rid2dir);
-  void rsh4_filterSkimHits(const std::string & oldfilename,
-			   const std::string & newfilename,
-			   uint64 & skimindex);
-  void rsh4_takeThisSkim(std::vector<skimedges_t>::const_iterator seI,
+  void rsh4_filterSkimHits(const string & oldfilename, 
+			   const string & newfilename,
+			   size_t & skimindex);
+  void rsh4_takeThisSkim(vector<skimedges_t>::const_iterator seI,
 			 ADSEstimator & adse,
 			 bool calcadse);
-  void rsh4_getNextSkimBlock(const std::string & dnsfile,
+  void rsh4_getNextSkimBlock(const string & dnsfile, 
 			     uint32 blocki,
-			     const std::vector<uint64> & blockpos,
-			     const std::vector<size_t> & blocklen);
-  void rsh4_purgeSkimsOfReadsCutByChimera(std::string & filename);
-  void rsh4_takeRailHits(const std::string & dnsfile,
-			       const std::vector<uint64> & blockpos,
-			       const std::vector<size_t> & blocklen);
-  void rsh4_flagMulticopyReads(const std::string & dnsfile,
-			       const std::vector<uint64> & blockpos,
-			       const std::vector<size_t> & blocklen);
-  void rsh4_weedOutBadHits(const std::string & dnsfile,
-			   const std::vector<uint64> & blockpos,
-			   const std::vector<size_t> & blocklen);
-  void rsh4_take100PCMappingHits(const std::string & dnsfile,
-				 const std::vector<uint64> & blockpos,
-				 const std::vector<size_t> & blocklen);
+			     const vector<uint64> & blockpos,
+			     const vector<size_t> & blocklen);
+  void rsh4_purgeSkimsOfReadsCutByChimera(string & filename);
+  void rsh4_takeRailHits(const string & dnsfile, 
+			       const vector<uint64> & blockpos,
+			       const vector<size_t> & blocklen);
+  void rsh4_flagMulticopyReads(const string & dnsfile, 
+			       const vector<uint64> & blockpos,
+			       const vector<size_t> & blocklen);
+  void rsh4_weedOutBadHits(const string & dnsfile, 
+			   const vector<uint64> & blockpos,
+			   const vector<size_t> & blocklen);
+  void rsh4_take100PCMappingHits(const string & dnsfile, 
+				 const vector<uint64> & blockpos, 
+				 const vector<size_t> & blocklen);
   void rsh4_takeNonReptHitsThatExtend(uint32 nbest,
-				      std::vector<uint32> & nbestl,
-				      std::vector<uint32> & nbestr,
 				      uint8 minscoreratio,
-				      const std::string & dnsfile,
-				      const std::vector<uint64> & blockpos,
-				      const std::vector<size_t> & blocklen);
-  void rsh4_takeReptNonReptBorders(uint8 minscoreratio,
-				   const std::string & dnsfile,
-				   const std::vector<uint64> & blockpos,
-				   const std::vector<size_t> & blocklen);
-  void rsh4_takeReptPEPEHitsThatExtend(uint32 nbest,
+				      const string & dnsfile,
+				      const vector<uint64> & blockpos,
+				      const vector<size_t> & blocklen);
+  void rsh4_takeReptPEPEHitsThatExtend(uint32 nbest, 
 				       uint8 minscoreratio,
-				       const std::string & dnsfile,
-				       const std::vector<uint64> & blockpos,
-				       const std::vector<size_t> & blocklen);
-  void rsh4_takeReptNPENPEHitsThatExtend(uint32 nbest,
+				      const string & dnsfile,
+				      const vector<uint64> & blockpos,
+				      const vector<size_t> & blocklen);
+  void rsh4_takeReptNPENPEHitsThatExtend(uint32 nbest, 
 					 uint8 minscoreratio,
-					 const std::string & dnsfile,
-					 const std::vector<uint64> & blockpos,
-					 const std::vector<size_t> & blocklen);
-  void rsh4_takeReptPENPEHitsThatExtend(uint32 nbest,
+				      const string & dnsfile,
+				      const vector<uint64> & blockpos,
+				      const vector<size_t> & blocklen);
+  void rsh4_takeReptPENPEHitsThatExtend(uint32 nbest, 
 					uint8 minscoreratio,
-					const std::string & dnsfile,
-					const std::vector<uint64> & blockpos,
-					const std::vector<size_t> & blocklen);
-  void rsh4_takeNonTakenReadsWithHitsThatExtend(uint32 nbest,
-						std::vector<uint32> & nbestl,
-						std::vector<uint32> & nbestr,
+				      const string & dnsfile,
+				      const vector<uint64> & blockpos,
+				      const vector<size_t> & blocklen);
+  void rsh4_takeNonTakenReadsWithHitsThatExtend(uint32 nbest, 
 						uint8 minscoreratio,
-						const std::string & dnsfile,
-						const std::vector<uint64> & blockpos,
-						const std::vector<size_t> & blocklen);
-  void rsh4_take100PC100bpHitsThatExtend(uint32 nbest,
-					 std::vector<uint32> & nbestl,
-					 std::vector<uint32> & nbestr,
-					 const std::string & dnsfile,
-					 const std::vector<uint64> & blockpos,
-					 const std::vector<size_t> & blocklen);
-  void rsh4_takeWellconnected(uint32 nbest,
-			      std::vector<uint32> & nbestl,
-			      std::vector<uint32> & nbestr,
-			      const std::string & dnsfile,
-			      const std::vector<uint64> & blockpos,
-			      const std::vector<size_t> & blocklen);
-  void rsh4_takeNonTakenSideExtends(uint32 nbest,
+						const string & dnsfile,
+						const vector<uint64> & blockpos,
+						const vector<size_t> & blocklen);
+  void rsh4_takeNonTakenSideExtends(uint32 nbest, 
 				    uint8 minscoreratio,
-				    const std::string & dnsfile,
-				    const std::vector<uint64> & blockpos,
-				    const std::vector<size_t> & blocklen);
-  void rsh4_takeIdenticalReadHits(uint32 nbest,
-				  const std::string & dnsfile,
-				  const std::vector<uint64> & blockpos,
-				  const std::vector<size_t> & blocklen);
-  void rsh4_takeNonTakenReadsWithHits(uint32 nbest,
-				      const std::string & dnsfile,
-				      const std::vector<uint64> & blockpos,
-				      const std::vector<size_t> & blocklen);
+				    const string & dnsfile,
+				    const vector<uint64> & blockpos,
+				    const vector<size_t> & blocklen);
+  void rsh4_takeNonTakenReadsWithHits(uint32 nbest, 
+				      const string & dnsfile,
+				      const vector<uint64> & blockpos,
+				      const vector<size_t> & blocklen);
   size_t rsh4_tNTSEhelper(uint32 nbest,
 			  ADSEstimator & adse,
-			  std::vector<std::vector<skimedges_t>::const_iterator> & sev);
-  void rsh4_takeAll(const std::string & dnsfile,
-		    const std::vector<uint64> & blockpos,
-		    const std::vector<size_t> & blocklen);
-  void rsh4_takeNeedAllOverlaps_weakgood(const std::string & dnsfile,
-					 const std::vector<uint64> & blockpos,
-					 const std::vector<size_t> & blocklen);
-  void rsh4_takeSolexaByCritLevel(uint32 ocvi,
-				  uint32 nbest,
-				  std::vector<uint32> & nbestl,
-				  std::vector<uint32> & nbestr,
-				  const std::string & dnsfile,
-				  const std::vector<uint64> & blockpos,
-				  const std::vector<size_t> & blocklen);
-  void rsh4_takeTemplateOverlaps(const std::string & dnsfile,
-				 const std::vector<uint64> & blockpos,
-				 const std::vector<size_t> & blocklen);
+			  vector<vector<skimedges_t>::const_iterator> & sev);
+  void rsh4_takeAll(const string & dnsfile,
+		    const vector<uint64> & blockpos,
+		    const vector<size_t> & blocklen);
+  void rsh4_takeNeedAllOverlaps_weakgood(const string & dnsfile,
+					 const vector<uint64> & blockpos,
+					 const vector<size_t> & blocklen);
+  void rsh4_takeSolexaByCritLevel(uint32 nbest,
+				  const string & dnsfile,
+				  const vector<uint64> & blockpos,
+				  const vector<size_t> & blocklen);
+  void rsh4_takeTemplateOverlaps(const string & dnsfile,
+				 const vector<uint64> & blockpos,
+				 const vector<size_t> & blocklen);
 
 
 /*************************************************************************
@@ -662,220 +586,222 @@ private:
 private:
   void loadSequenceData_resume();
   void loadSequenceData_new();
-  void basicDataChecks();
-  void basicReadGroupChecks();
-  void checkForReadNameLength(uint32 stoplength, bool stop);
-  //void loadExternalSCFQualities();
-
-  void loadSequenceDataFromManifest();
-  static void streamSequenceDataFromManifest(std::vector<MIRAParameters> & miraparams,
-					     Manifest & man,
-					     ReadPool & readpool,
-					     std::list<Contig> * contigsptr,
-					     std::vector<readid_t> * readsasbackbonecontigs
-    );
-
+  void checkForReadNameLength(uint32 stoplength);
+  void loadExternalSCFQualities();
+
+  size_t loadFOFNEXP(const string & fofn,
+		     const uint8 seqtype,
+		     const uint8 loadaction,
+		     uint32 & longestread);
+  size_t loadFASTA(const string & fastafile, 
+		   const string & fastaqualfile,
+		   const uint8 seqtype,
+		   const uint8 loadaction,
+		   uint32 & longestread);
+  size_t loadFASTQ(const string & fastqfile, 
+		   const uint8 seqtype,
+		   const uint8 loadaction,
+		   uint32 & longestread);
+  size_t loadPHD(const string & phdfile,
+		 const uint8 loadaction,
+		 uint32 & longestread);
+  size_t loadCAF(const string& caffile,
+		 const uint8 seqtype,
+		 const uint8 loadaction,
+		 vector<uint32> & lrperseqtype);
+  size_t loadMAF(const string& caffile,
+		 const uint8 seqtype,
+		 const uint8 loadaction,
+		 vector<uint32> & lrperseqtype);
+ 
+  void loadBackboneMAF(const string & maffile);
+  void loadBackboneCAF(const string & caffile);
+  void loadBackboneGFF3(const string & gff3file);
+  void loadBackboneGBF(const string & gbffile);
+  void loadBackboneFASTA(const string & fastafile, 
+			 const string & fastaqualfile);
   void postLoadBackbone();
-  void clipsAfterLoad();
-  void addRailsToBackbones();
+  size_t addRailsToBackbones(const bool simulateonly);
 
-  void loadStrainData(const std::string & sdfile);
+  void loadStrainData(const string & sdfile);
 
   void postLoad();
   void dumpSomeStatistics();
 
-  void saveExtTmpContig(Contig & con, std::string basename);
-
+  void saveExtTmpContig(Contig & con, string basename);
+ 
 
 
 public:
   void dumpContigs();
   void loadSequenceData();
-  void dumpRailReads(std::ofstream & fout);
-
-  std::string buildDefaultCheckpointFileName(const std::string & filename);
-  std::string buildDefaultInfoFileName(int32 version,
-				       const std::string & prefix,
-				       const std::string & postfix,
-				       const std::string & basename,
-				       const std::string & defaultname,
-				       const std::string & defaultextension,
-				       bool removeold=false);
-  std::string buildDefaultResultsFileName(int32 version,
-					  const std::string & prefix,
-					  const std::string & postfix,
-					  const std::string & basename,
-					  const std::string & defaultname,
-					  const std::string & defaultextension,
-					  bool removeold=false);
-  std::string getContigReadListFilename(int32 version=-1,
-					const std::string & prefix="",
-					const std::string & postfix="",
-					const std::string & crlname="");
-  void saveContigReadList(int32 version=-1,
-			  const std::string & prefix="",
-			  const std::string & postfix="",
-			  const std::string & crlname="",
+  void dumpRailReads(ofstream & fout);
+
+  string buildDefaultCheckpointFileName(const string & filename);
+  string buildDefaultInfoFileName(int32 version, 
+				  const string & prefix, 
+				  const string & postfix, 
+				  const string & basename, 
+				  const string & defaultname, 
+				  const string & defaultextension,
+				  bool removeold=false);
+  string buildDefaultResultsFileName(int32 version, 
+				     const string & prefix, 
+				     const string & postfix, 
+				     const string & basename, 
+				     const string & defaultname, 
+				     const string & defaultextension,
+				     bool removeold=false);
+  string getContigReadListFilename(int32 version=-1, 
+				   const string & prefix="", 
+				   const string & postfix="", 
+				   const string & crlname="");
+  void saveContigReadList(int32 version=-1, 
+			  const string & prefix="", 
+			  const string & postfix="", 
+			  const string & crlname="",
 			  bool deleteoldfile=false);
-  std::string getStatisticsFilename(int32 version=-1,
-				    const std::string & prefix="",
-				    const std::string & postfix="",
-				    const std::string & statname="");
-  void saveStatistics(int32 version=-1,
-		      const std::string & prefix="",
-		      const std::string & postfix="",
-		      const std::string & statname="",
+  string getStatisticsFilename(int32 version=-1, 
+			       const string & prefix="", 
+			       const string & postfix="", 
+			       const string & statname="");
+  void saveStatistics(int32 version=-1, 
+		      const string & prefix="", 
+		      const string & postfix="", 
+		      const string & statname="",
 		      bool deleteoldfile=false);
-  std::string getAssemblyInfoFilename(int32 version=-1,
-				      const std::string & prefix="",
-				      const std::string & postfix="",
-				      const std::string & statname="");
-  void saveAssemblyInfo(int32 version=-1,
-			const std::string & prefix="",
-			const std::string & postfix="",
-			const std::string & statname="",
+  string getAssemblyInfoFilename(int32 version=-1, 
+			       const string & prefix="", 
+			       const string & postfix="", 
+			       const string & statname="");
+  void saveAssemblyInfo(int32 version=-1, 
+			const string & prefix="", 
+			const string & postfix="", 
+			const string & statname="",
 			bool deleteoldfile=false);
-  std::string getLargeContigsInfoFilename(int32 version=-1,
-					  const std::string & prefix="",
-					  const std::string & postfix="",
-					  const std::string & statname="");
-  void saveLargeContigsInfo(int32 version=-1,
-			    const std::string & prefix="",
-			    const std::string & postfix="",
-			    const std::string & statname="",
-			    bool deleteoldfile=false);
-  std::string getRGSTInfoFilename(int32 version=-1,
-				  const std::string & prefix="",
-				  const std::string & postfix="",
-				  const std::string & statname="");
-  void saveRGSTInfo(int32 version=-1,
-		    const std::string & prefix="",
-		    const std::string & postfix="",
-		    const std::string & statname="",
-		    bool deleteoldfile=false);
-  void saveDebrisList(int32 version=-1,
-		      const std::string & prefix="",
-		      const std::string & postfix="",
-		      const std::string & debrisname="");
-  std::string getReadTagListFilename(int32 version=-1,
-				     const std::string & prefix="",
-				     const std::string & postfix="",
-				     const std::string & rtlname="");
-  void saveReadTagList(int32 version=-1,
-		       const std::string & prefix="",
-		       const std::string & postfix="",
-		       const std::string & rtlname="",
+  void saveDebrisList(int32 version=-1, 
+		      const string & prefix="", 
+		      const string & postfix="", 
+		      const string & debrisname="");
+  string getReadTagListFilename(int32 version=-1,
+				const string & prefix="", 
+				const string & postfix="", 
+				const string & rtlname="");
+  void saveReadTagList(int32 version=-1, 
+		       const string & prefix="", 
+		       const string & postfix="", 
+		       const string & rtlname="",
 		       bool deleteoldfile=false);
-  std::string getConsensusTagListFilename(int32 version=-1,
-					  const std::string & prefix="",
-					  const std::string & postfix="",
-					  const std::string & ctlname="");
-  void saveConsensusTagList(int32 version=-1,
-			    const std::string & prefix="",
-			    const std::string & postfix="",
-			    const std::string & ctlname="",
+  string getConsensusTagListFilename(int32 version=-1, 
+				     const string & prefix="", 
+				     const string & postfix="", 
+				     const string & ctlname="");
+  void saveConsensusTagList(int32 version=-1, 
+			    const string & prefix="", 
+			    const string & postfix="", 
+			    const string & ctlname="",
 			    bool deleteoldfile=false);
-  void saveSNPList(int32 version=-1,
-		   const std::string & prefix="",
-		   const std::string & postfix="",
-		   const std::string & saname="",
+  void saveSNPList(int32 version=-1, 
+		   const string & prefix="", 
+		   const string & postfix="", 
+		   const string & saname="",
 		   bool deleteoldfile=false);
-  void saveFeatureAnalysis(int32 version=-1,
-			   const std::string & prefix="",
-			   const std::string & postfix="",
-			   const std::string & faname="",
-			   const std::string & fsname="",
-			   const std::string & fcname="",
+  void saveFeatureAnalysis(int32 version=-1, 
+			   const string & prefix="", 
+			   const string & postfix="", 
+			   const string & faname="",
+			   const string & fsname="",
+			   const string & fcname="",
 			   bool deleteoldfile=false);
-  std::string getFASTAFilename(int32 version=-1,
-			       const std::string & prefix="",
-			       const std::string & postfix="",
-			       const std::string & fastaname="");
-  std::string getFASTAPaddedFilename(int32 version=-1,
-				     const std::string & prefix="",
-				     const std::string & postfix="",
-				     const std::string & fastaname="");
-  void saveAsFASTA(int32 version=-1,
-		   const std::string & prefix="",
-		   const std::string & postfix="",
-		   const std::string & fastaname="",
+  string getFASTAFilename(int32 version=-1,
+			  const string & prefix="", 
+			  const string & postfix="", 
+			  const string & fastaname="");
+  string getFASTAPaddedFilename(int32 version=-1,
+				const string & prefix="", 
+				const string & postfix="", 
+				const string & fastaname="");
+  void saveAsFASTA(int32 version=-1, 
+		   const string & prefix="", 
+		   const string & postfix="", 
+		   const string & fastaname="",
 		   bool deleteoldfile=false);
   void saveStrainsAsFASTAQUAL(int32 version=-1,
-			      const std::string & prefix="",
-			      const std::string & postfix="",
-			      const std::string & fastaname="",
+			      const string & prefix="",
+			      const string & postfix="",
+			      const string & fastaname="",
 			      bool deleteoldfile=false);
-  std::string getTCSFilename(int32 version=-1,
-			     const std::string & prefix="",
-			     const std::string & postfix="",
-			     const std::string & txtname="");
-  void saveAsTCS(int32 version=-1,
-		 const std::string & prefix="",
-		 const std::string & postfix="",
-		 const std::string & tcsname="",
+  string getTCSFilename(int32 version=-1, 
+			const string & prefix="", 
+			const string & postfix="", 
+			const string & txtname="");
+  void saveAsTCS(int32 version=-1, 
+		 const string & prefix="", 
+		 const string & postfix="", 
+		 const string & tcsname="",
 		 bool deleteoldfile=false);
-  std::string getCAFFilename(int32 version=-1,
-			     const std::string & prefix="",
-			     const std::string & postfix="",
-			     const std::string & cafname="");
-  void saveAsCAF(int32 version=-1,
-		 const std::string & prefix="",
-		 const std::string & postfix="",
-		 const std::string & cafname="",
+  string getCAFFilename(int32 version=-1, 
+			const string & prefix="", 
+			const string & postfix="", 
+			const string & cafname="");
+  void saveAsCAF(int32 version=-1, 
+		 const string & prefix="", 
+		 const string & postfix="", 
+		 const string & cafname="",
 		 bool deleteoldfile=false);
-  std::string getMAFFilename(int32 version=-1,
-			     const std::string & prefix="",
-			     const std::string & postfix="",
-			     const std::string & cafname="");
-  void saveAsMAF(int32 version=-1,
-		 const std::string & prefix="",
-		 const std::string & postfix="",
-		 const std::string & cafname="",
+  string getMAFFilename(int32 version=-1, 
+			const string & prefix="", 
+			const string & postfix="", 
+			const string & cafname="");
+  void saveAsMAF(int32 version=-1, 
+		 const string & prefix="", 
+		 const string & postfix="", 
+		 const string & cafname="",
 		 bool deleteoldfile=false);
-  std::string getTXTFilename(int32 version=-1,
-			     const std::string & prefix="",
-			     const std::string & postfix="",
-			     const std::string & txtname="");
-  void saveAsTXT(int32 version=-1,
-		 const std::string & prefix="",
-		 const std::string & postfix="",
-		 const std::string & txtname="",
+  string getTXTFilename(int32 version=-1, 
+			const string & prefix="", 
+			const string & postfix="", 
+			const string & txtname="");
+  void saveAsTXT(int32 version=-1, 
+		 const string & prefix="", 
+		 const string & postfix="", 
+		 const string & txtname="",
 		 bool deleteoldfile=false);
-  std::string getACEFilename(int32 version=-1,
-			     const std::string & prefix="",
-			     const std::string & postfix="",
-			     const std::string & txtname="");
-  void saveAsACE(int32 version=-1,
-		 const std::string & prefix="",
-		 const std::string & postfix="",
-		 const std::string & acename="",
+  string getACEFilename(int32 version=-1, 
+			const string & prefix="", 
+			const string & postfix="", 
+			const string & txtname="");
+  void saveAsACE(int32 version=-1, 
+		 const string & prefix="", 
+		 const string & postfix="", 
+		 const string & acename="",
 		 bool deleteoldfile=false);
-  std::string getWiggleFilename(int32 version=-1,
-				const std::string & prefix="",
-				const std::string & postfix="",
-				const std::string & txtname="");
-  void saveAsWiggle(int32 version=-1,
-		    const std::string & prefix="",
-		    const std::string & postfix="",
-		    const std::string & acename="",
+  string getWiggleFilename(int32 version=-1, 
+			   const string & prefix="", 
+			   const string & postfix="", 
+			   const string & txtname="");
+  void saveAsWiggle(int32 version=-1, 
+		    const string & prefix="", 
+		    const string & postfix="", 
+		    const string & acename="",
 		    bool deleteoldfile=false);
-  std::string getGAP4DAFilename(int32 version=-1,
-				const std::string & prefix="",
-				const std::string & postfix="",
-				const std::string & dirname="");
+  string getGAP4DAFilename(int32 version=-1,
+			   const string & prefix="", 
+			   const string & postfix="", 
+			   const string & dirname="");
   void saveAsGAP4DA(int32 version=-1,
-		    const std::string & prefix="",
-		    const std::string & postfix="",
-		    const std::string & dirname="",
+		    const string & prefix="", 
+		    const string & postfix="", 
+		    const string & dirname="",
 		    bool deleteoldfile=false);
-  std::string getHTMLFilename(int32 version=-1,
-			      const std::string & prefix="",
-			      const std::string & postfix="",
-			      const std::string & txtname="");
-  void saveAsHTML(int32 version=-1,
-		  const std::string & prefix="",
-		  const std::string & postfix="",
-		  const std::string & htmlname="",
+  string getHTMLFilename(int32 version=-1, 
+			const string & prefix="", 
+			const string & postfix="", 
+			const string & txtname="");
+  void saveAsHTML(int32 version=-1, 
+		  const string & prefix="", 
+		  const string & postfix="", 
+		  const string & htmlname="",
 		  bool deleteoldfile=false);
 
 
@@ -897,22 +823,22 @@ public:
  *
  *************************************************************************/
 private:
-  void setupAlignCache(std::vector<Align> & aligncache);
-  void makeAlignmentsFromPosMatchFile(const std::string & filename,
-				      const int32 version,
-				      const int8 direction,
-				      const bool trans100percent,
-				      bool (* checkfunction)(Assembly&,int32,int32),
-				      std::ofstream & matchfout,
-				      std::ofstream & rejectfout);
-
-  void computeSWAlign(std::list<AlignedDualSeq> & madsl,
+  void setupAlignCache(vector<Align> & aligncache);
+  void makeAlignmentsFromPosMatchFile(
+    const string & filename,
+    const int32 version,
+    const int8 direction,
+    const bool trans100percent, 
+    bool (* checkfunction)(Assembly&,int32,int32),
+    ofstream & matchfout, 
+    ofstream & rejectfout);
+
+  void computeSWAlign(list<AlignedDualSeq> & madsl,
 		      uint32 rid1,
 		      uint32 rid2,
 		      int32 eoffset,
 		      int8 direction,
-		      std::vector<Align> & chkalign,
-		      int32 hintbandwidth);
+		      vector<Align> & chkalign);
 
   static bool ma_takeall(Assembly & as, int32 rid1, int32 rid2);
   static bool ma_needRRFlag(Assembly & as, int32 rid1, int32 rid2);
@@ -921,34 +847,29 @@ private:
 
   void makeAlignments(bool (* checkfunction)(Assembly&,int32,int32),
 		      bool takefullskimfilenames,
-		      const bool trans100percent,
-		      int32 version=-1,
-		      const std::string prefix="",
-		      const std::string postfix="",
-		      const std::string tmpname="");
-  void priv_loadAlignmentsFromFile(int32 version=-1,
-				   const std::string prefix="",
-				   const std::string postfix="",
-				   const std::string tmpname="");
-  void priv_laffhelper(const std::string & fn,
-		       ProgressIndicator<int64> & P,
-		       uint64 & runningADSFactnumber,
-		       uint64 & numbannedADSFacts);
-
+		      const bool trans100percent, 
+		      int32 version=-1, 
+		      const string prefix="", 
+		      const string postfix="", 
+		      const string tmpname="");
+  void loadAlignmentsFromFile(int32 version=-1, 
+			      const string prefix="", 
+			      const string postfix="", 
+			      const string tmpname="");
   uint32 getOverlapMalusDivider(int32 id1, int32 id2);
 
-  void clusterUnassembledReads(std::vector<int32> & clusteridperread,
-			       std::vector<std::list<int32> > & readinclusterlist,
-			       const std::vector<int8> & usedids);
+  void clusterUnassembledReads(vector<int32> & clusteridperread,
+			       vector<list<int32> > & readinclusterlist,
+			       const vector<int8> & usedids);
 
-  void minimiseMADSL(std::list<AlignedDualSeq> & madsl);
-  void cleanupMADSL(std::list<AlignedDualSeq> & madsl,
+  void minimiseMADSL(list<AlignedDualSeq> & madsl);
+  void cleanupMADSL(list<AlignedDualSeq> & madsl,
 		    uint32 i,
 		    uint32 j,
 		    int8 direction,
 		    bool flag_stronggood,
-		    bool flag_weakgood,
-		    bool flag_belowavgfreq,
+		    bool flag_weakgood, 
+		    bool flag_belowavgfreq, 
 		    bool flag_norept,
 		    bool flag_rept);
 
@@ -957,207 +878,12 @@ private:
   void transcribeHits(AlignedDualSeq & anads);
 
   void recalcNonPerfectSkimMappingsBySW(int32 version=-1);
-  void rnpskmbs_helper(const std::string & filename, const int32 version, const int8 direction);
-
-
-/*************************************************************************
- *
- *  assembly_pbcorrect
- *
- *************************************************************************/
-
-public:
-  uint32 correctPBMain();
-private:
-  struct pbcounts_t {
-    struct insertafter_t {
-      std::string what;
-      uint32 count;
-      insertafter_t() : count(0) {};
-      insertafter_t(const std::string & s) : what(s), count(1) {};
-    };
-
-    std::vector<insertafter_t> cxia; // after this base, one might want to insert one of the vector what-strings
-                                     //  (which preferably contains only one element)
-
-    uint32 cxa;       // count how many times that base should rather be exchanged against an 'A'
-    uint32 cxc;       //  ... 'C'
-    uint32 cxg;       //  ... 'G'
-    uint32 cxt;       //  ... 'T'
-    uint32 cxgap;     //  ... a gap
-
-    uint32 cqsafe;    // count how often base was in a safe align (alignment region flanked by k-error-free sub-aligns
-
-    pbcounts_t() : cxa(0),cxc(0),cxg(0),cxt(0),cxgap(0),cqsafe(0) {};
-
-    friend std::ostream & operator<<(std::ostream &ostr, const pbcounts_t & p){
-      ostr << p.cxa
-	   << '\t' << p.cxc
-	   << '\t' << p.cxg
-	   << '\t' << p.cxt
-	   << '\t' << p.cxgap
-	   << '\t' << p.cqsafe
-	   << '\t' << p.cxia.size();
-      for(auto & iae : p.cxia){
-	ostr << '\t' << iae.what << '(' << iae.count << ')';
-      }
-      return ostr;
-    }
-  };
-
-  struct pbc_timing_t {
-    suseconds_t hashanalysis;
-    suseconds_t killnonhaf;
-    suseconds_t possibleoverlaps;
-    suseconds_t trypbcorrect;
-    suseconds_t tpbc_setup;
-    suseconds_t tpbc_sw;
-
-    pbc_timing_t() : hashanalysis(0), killnonhaf(0), possibleoverlaps(0),trypbcorrect(0), tpbc_setup(0), tpbc_sw(0) {};
-
-    friend std::ostream & operator<<(std::ostream &ostr, const pbc_timing_t & t){
-      ostr << "Timing PBC hasha: " << t.hashanalysis
-	   << "\nTiming PBC killnonhaf: " << t.killnonhaf
-	   << "\nTiming PBC possibleoverlaps: " << t.possibleoverlaps
-	   << "\nTiming PBC trypbcorrect: " << t.trypbcorrect
-	   << "\nTiming PBC tpbc setup: " << t.tpbc_setup
-	   << "\nTiming PBC tpbc SW: " << t.tpbc_sw
-	   << std::endl;
-      return ostr;
-    }
-  };
-
-  // sequence to sequence aligninfo
-  // this stores for every alignment of a PB to a PB sequence the values used / computed
-  //  by Dynamic && Align for effectively used bandwidth and the minimum distance the align
-  //  was from the bands
-  // Subsequent alignment of the same sequences can use this information to optimise speed
-  //
-  // The key of the unordered_map is an uint64 which is made by concatenation of the two read
-  // ids (which should stay int32 for the foreseeable future)
-
-  struct s2saligninfo_t {
-    int32 bandwidthused;
-    int32 minbanddistance;
-
-    bool alreadyaligned;
-
-    s2saligninfo_t(int32 bwu, int32 mbd) : bandwidthused(bwu), minbanddistance(mbd), alreadyaligned(false) {};
-  };
-  std::unordered_map<uint64_t,s2saligninfo_t>  AS_s2saligninfo;
-
-  // vectors containing proposed clips (to be applied after a PB correct pass)
-  std::vector<int32> AS_naclipl;
-  std::vector<int32> AS_naclipr;
-
-
-
-  uint32 correctPBMainLight(uint32 startpass);
-  uint32 correctPBMainNormal(uint32 startpass);
-
-  uint32 cpbm_passHelper(uint32 actpass,
-			 float ratioacceptvalue,
-			 int32 additionalbelieveborder,
-			 uint8 minbk,
-			 bool tweakbkmar,
-			 bool killnonhafstretches,
-			 bool generatenaclips,
-			 bool generaterleedits,
-			 bool generatebaseedits,
-			 pbc_timing_t & timing);
-
-  uint32 tryPBCorrect(uint32 actpass,
-		      float ratioacceptvalue,
-		      int32 additionalbelieveborder,
-		      uint8 minbk,
-		      bool tweakbkmar,
-		      bool generatenaclips,
-		      bool generaterleedits,
-		      bool generatebaseedits,
-		      pbc_timing_t & timing);
-  void tpbc_checkRead(Read & actread);
-
-  void tpbc_fillCorrector(readid_t actrid,
-			  readid_t otherrid,
-			  AlignedDualSeq & ads,
-			  std::vector<pbcounts_t> & correctorcounts,
-			  std::vector<uint8> & bkmar,
-			  std::vector<uint8> & bkmor);
-  void tpbc_fillRLECorrector(readid_t actrid,
-			     readid_t otherrid,
-			     AlignedDualSeq & ads,
-			     std::vector<std::vector<uint32> > & correctorcounts,
-			     std::vector<uint8> & bkmar,
-			     std::vector<uint8> & bkmor);
-
-
-  void   tpbc_fc_makeBelieveKMERMap(readid_t arid,
-				    readid_t orid,
-				    AlignedDualSeq & ads,
-				    std::vector<uint8> & bkmm,
-				    int32 kmersizeused,
-				    int32 additionalbelieveborder);
-  void tpbc_fc_minimumBelieveKMerMap(std::vector<uint8> & bkmm, uint8 minbk);
-  void tpbc_tweakBKMAR(readid_t actrid,
-		       readid_t otherrid,
-		       AlignedDualSeq & ads,
-		       std::vector<uint8> & bkmar,
-		       std::vector<uint8> & bkmor);
-
-  uint32 tpbc_generateBaseEdits(uint32 actpass,
-				readid_t actrid,
-				std::vector<pbcounts_t> & correctorcounts);
-  uint32 tpbc_generateRLEEdits(uint32 actpass,
-			       readid_t actrid,
-			       std::vector<std::vector<uint32>> & rlecc);
-  void tpbc_generateNonAlignClips(readid_t actrid,
-			     std::vector<pbcounts_t> & correctorcounts);
-  void killNonHAFCoveredStretchesInReads();
-  void colourReadsByRLE();
-
-public:
-  static void findDegeneratePolymerases(ReadPool & rp);
-
-/*************************************************************************
- *
- *  assembly_buildcontigs
- *
- *************************************************************************/
-
-private:
-
-  bool buildFirstContigs(const int32 loopnr,
-			 const EDITParameters & eparams,
-			 const bool lastloop);
-  void bfc_sanityCheckASUSEDIDS(uint32 numexpected, uint32 numcontigs);
-  void bfc_callPathfinder(const int32 passnr,
-			  const uint32 iter,
-			  uint32 & trackingunused,
-			  bool shouldmovesmallclusterstodebris,
-			  Contig & buildcon,
-			  PPathfinder & qaf);
-  void bfc_cp_mapWithSolexa(Contig & buildcon, PPathfinder & qaf);
-  uint32 bfc_moveSmallClustersToDebris();
-  bool bfc_checkIfContigMeetsRequirements(Contig & con);
-  void bfc_markRepReads(Contig & con);
-  bool bfc_trimDenovoIfNecessary(Contig & buildcon,
-				 bool foundSRMs,
-				 const std::string & basename_forextsave,
-				 uint32 & trackingunused);
-  void bfc_storeContig(Contig & con,
-		       uint32 & numcontigs,
-		       const bool mustmarkrepeats,
-		       const int32 passnr,
-		       const bool lastpass);
-
-  void bfc_savePersistentSmallOverlaps(Contig & con, const int32 passnr, std::ostream & fout);
-
-  void priv_tmpcheckroutine(Contig & bc);
+  void rnpskmbs_helper(const string & filename, const int32 version, const int8 direction);
 
 
 /*************************************************************************
  *
- *  assembly
+ *  assembly_repeatresolve
  *
  *************************************************************************/
 
@@ -1170,52 +896,42 @@ private:
 
   void ensureStandardDirectories(bool purge);
 
-//  void markNastyReapeatsWithSkim(int32 version=-1,
-//			    const std::string prefix="",
-//			    const std::string postfix="",
-//			    const std::string tmpname="");
-  void findPossibleOverlaps(int32 version=-1,
-			    const std::string prefix="",
-			    const std::string postfix="",
-			    const std::string tmpname="");
-  void fpo_main(int32 version,
-		const std::string prefix,
-		const std::string postfix,
-		const std::string tmpname);
-  void fpo_buildFileNames(int32 version,
-			  const std::string prefix,
-			  const std::string postfix,
-			  const std::string tmpname);
-  void flagMulticopyReads(const std::vector<uint32> & overlapcounter,
-			  const std::string & tmpfilename);
+//  void markNastyReapeatsWithSkim(int32 version=-1, 
+//			    const string prefix="", 
+//			    const string postfix="", 
+//			    const string tmpname="");
+  void findPossibleOverlaps(int32 version=-1, 
+			    const string prefix="", 
+			    const string postfix="", 
+			    const string tmpname="");
+  void flagMulticopyReads(const vector<uint32> & overlapcounter,
+			  const string & tmpfilename);
 
 
 
   void performSnapshot(uint32 actpass);
-  void ssdReadPool(const std::string & filename);
-  void ssdPassInfo(const std::string & filename, uint32 actpass);
-  void ssdMaxCovReached(const std::string & filename);
-  void ssdBannedOverlaps(const std::string & filename);
-
-  void loadSnapshotData(uint32 & actpass);
-  uint32 lsdPassInfo(const std::string & filename);
-  void lsdMaxCovReached(const std::string & filename);
-  void lsdBannedOverlaps(const std::string & filename);
-
-  void loadResumeDataFPO(int32 version, const std::string & prefix, const std::string & postfix);
-  void saveResumeDataFPO(int32 version, const std::string & prefix, const std::string & postfix);
-  void loadResumeDataMA(int32 version, const std::string & prefix, const std::string & postfix);
-  void saveResumeDataMA(int32 version, const std::string & prefix, const std::string & postfix);
 
+  bool buildFirstContigs(const int32 loopnr, 
+			 const EDITParameters & eparams,
+			 const bool lastloop);
+  uint32 bfc_killIntermediateSinglets();
+  void bfc_moveSmallClustersToDebris();
+  bool bfc_checkIfContigMeetsRequirements(Contig & con);
+  void bfc_markRepReads(Contig & con);
+  void bfc_storeContig(Contig & con, 
+		       uint32 & numcontigs, 
+		       const bool mustmarkrepeats, 
+		       const int32 passnr, 
+		       const bool lastpass);
   void transferContigReadsToReadpool(const Contig & buildcon,
-				     std::list<Contig::pbdse_t> & pbdsev,
+				     list<Contig::pbdse_t> & pbdsev,
 				     int32 passnr);
   void transferContigReadTagsToReadpool(const Contig & con,
-					const std::list<Contig>::const_iterator bbContigI);
+					const list<Contig>::const_iterator bbContigI);
 
   void makeNewReadPoolFromContigs();
 
-  bool checkPossibleMatch(const possible_overlaps_t & poverl,
+  bool checkPossibleMatch(const possible_overlaps_t & poverl, 
 			  const uint32 i,
 			  const uint32 j) const;
 
@@ -1223,77 +939,71 @@ private:
   void dump454OvercallsArrays();
   uint32 perform454OvercallEdits(bool qualonly);
 
+  void huntPossibleContigJoinGrinches(int32 version=-1, 
+				      const string prefix="", 
+				      const string postfix="", 
+				      const string tmpname="");
   void huntSpoilSports(Contig & chkcon);
 
-  bool isReadGrinch(int32 thereadid,
-		    int32 incontigid,
-		    std::vector<int32> & readstocheck,
-		    std::vector<int32> & contigidofendreads);
+  bool isReadGrinch(int32 thereadid, 
+		    int32 incontigid, 
+		    vector<int32> & readstocheck, 
+		    vector<int32> & contigidofendreads);
   void transferContigRMBTagsToPermanentOverlapBans(Contig & con);
-  void banReadPairGroups(const std::vector<int32> & g1, const std::vector<int32> & g2);
+  void banReadPairGroups(const vector<int32> & g1, const vector<int32> & g2);
 
 
   void editSimple454Overcalls(const uint32 pass);
-
-  uint32 priv_calcBasesPerHashOnPass(uint32 passnr) const;
-  void   priv_hackMergeTwoResultMAFs();
+  
 
   //-----------------------------------------------------------------
 
 
-  void dmi_dumpALine(std::ostream & ostr, const char * desc,
-		     size_t numelem,
-		     size_t bytes_size,
-		     size_t freecapacity,
+  void dmi_dumpALine(ostream & ostr, const char * desc, 
+		     size_t numelem, 
+		     size_t bytes_size, 
+		     size_t freecapacity, 
 		     size_t lostbyalign);
 
 
 
   void preassembleTasks(bool usereadextension, bool clipvectorleftovers);
-  void priv_setupAutoPasses();
 
   bool checkTerminationRequest();
 
 public:
-  Assembly(Manifest & manifest, std::vector<MIRAParameters> & params, bool resumeassembly);
+  Assembly(vector<MIRAParameters> & params, bool resumeassembly);
   ~Assembly();
 
-  Assembly(Assembly const &other) = delete;
-  Assembly const & operator=(Assembly const & other) = delete;
-
   void discard();
   void dumpMemInfo();
 
-  inline void setContigBuiltCallback(void (*cbfunc)(Contig &, const ReadPool &) = nullptr){
+  inline void setContigBuiltCallback(void (*cbfunc)(Contig &, const ReadPool &) = NULL){
     AS_contigbuilt_callbackfunc=cbfunc;
   }
   void assemble();
-  void setEverythingWentFine(bool b) { AS_everythingwentfine=b; };
+  void saveResults();
 
-  static bool markRepeats(Contig & con,
-			  std::vector<bool> & readsmarkedsrm,
-			  Contig::repeatmarker_stats_t & repstats);
+  static bool markRepeats(Contig & con, vector<bool> & readsmarkedsrm);
 
   static void refreshContigAndReadpoolValuesAfterLoading(
     ReadPool & rp,
-    std::list<Contig> & contigs,
-    uint8 nagwarn_templateproblems
-    );
+    list<Contig> & contigs);
 
   const Read & getRead(uint32 index);
-  std::list<Contig> & getContigs() {return AS_contigs;};
+  list<Contig> & getContigs() {return AS_contigs;};
   ReadPool & getReadPool() {return AS_readpool;};
 
   void checkForNFSMountOnTmpDir();
 
-  uint32 cleanupOldFile(const std::string & basename, const std::string & filename);
-  std::string buildFileName(int32 version=-1,
-			    const std::string & prefix="",
-			    const std::string & postfix="",
-			    const std::string & basename="",
-			    const std::string & suffix="",
-			    const std::string & dirname="",
-			    bool removeold=true);
+  uint32 cleanupOldFile(const string & basename, const string & filename);
+  string buildFileName(int32 version=-1, 
+		       const string & prefix="", 
+		       const string & postfix="", 
+		       const string & basename="",
+		       const string & suffix="",
+		       const string & dirname="",
+		       bool removeold=true);
 
 
   void test();
@@ -1305,11 +1015,12 @@ public:
     AS_logflag_swbbcheck=f;
     AS_logflag_adsdump=f;
     AS_logflag_dumpusedids=f;
-    AS_logflag_loadedoverlaps=f;
   }
 
-  void sortReadPool(std::vector<uint32> & dummy);
 };
 
 
 #endif
+
+
+
diff --git a/src/mira/assembly_buildcontigs.C b/src/mira/assembly_buildcontigs.C
deleted file mode 100644
index 5d70c53..0000000
--- a/src/mira/assembly_buildcontigs.C
+++ /dev/null
@@ -1,2260 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
- *   Krebsforschungszentrum, DKFZ Heidelberg) and Bastien Chevreux
- * Copyright (C) 2000 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-
-#include "mira/assembly.H"
-
-#include "mira/align.H"
-#include "mira/ppathfinder.H"
-
-// BOOST
-//#include <boost/algorithm/string.hpp>
-#include <boost/lexical_cast.hpp>
-//#include <boost/filesystem.hpp>
-
-#ifdef MIRAMEMORC
-#include "memorc/memorc.H"
-#endif
-
-#if 0
-#include <valgrind/memcheck.h>
-#define VALGRIND_LEAKCHECK
-#endif
-
-
-using namespace std;
-
-#define CEBUG(bla)
-
-// cs1 for normal clocking ('user compatible' as is does not disturb)
-//  cs2 for extensive clocking output, more for analysis of MIRA behaviour
-//  during development
-
-#ifndef PUBLICQUIET
-#define CLOCK_STEPS2
-#endif
-#define CLOCK_STEPS2
-
-
-//#define TRACKMEMUSAGE 1
-#define TRACKMEMUSAGE 0
-
-
-
-
-/*************************************************************************
- *
- * returns whether new strong repeat markers (SRMs) were found for
- *  any contig built in any stage
- *
- *************************************************************************/
-
-#define CEBUG(bla)   {cout << bla; cout.flush(); }
-
-bool Assembly::buildFirstContigs(const int32 passnr, const EDITParameters & eparams, const bool lastpass)
-{
-  FUNCSTART("void Assembly::buildFirstContigs()");
-
-  CEBUG("BFC: " << passnr << "\t" << lastpass << endl);
-
-  assembly_parameters const & as_fixparams= AS_miraparams[0].getAssemblyParams();
-  directory_parameters const & dir_params= AS_miraparams[0].getDirectoryParams();
-  edit_parameters const & ed_params= AS_miraparams[0].getEditParams();
-
-  ofstream fout_povl(buildDefaultCheckpointFileName(AS_miraparams[0].getFileParams().chkpt_persistentoverlaps),ios::out|ios::app|ios::ate);
-
-  AS_deleteoldresultfiles=true;
-
-  AS_bfcstats.clear();
-  AS_bfcstats.resize(2); // 0 for non-rep contigs, 1 for rep contigs
-
-  AS_contigs.clear();
-  Contig::setIDCounter(1);
-  Contig::resetCERNumbering();
-
-  AS_assemblyinfo.zeroInfo();
-
-  AS_templateguesses.clear();
-  if(AS_maxtemplateid>=0){
-    AS_templateguesses.resize(AS_maxtemplateid+1);
-    cout << "TGS: " << AS_templateguesses.size() << endl;
-  }
-
-  vector<Align> aligncache;
-  setupAlignCache(aligncache);
-
-  // AS_hasmcoverlaps will be initialised by Pathfinder
-  AS_hasmcoverlaps.clear();
-
-  // Keep track of coverage information for contigs so to be able to make
-  //  average contig coverage predictions
-  vector<vector<uint32> > covperstpercon(ReadGroupLib::SEQTYPE_END);
-  vector<uint32> covtotalpercon;
-
-  // initially, overlaps of every read can be reduced
-  if(AS_needalloverlaps.size()==0){
-    AS_needalloverlaps.resize(AS_readpool.size(),false);
-  }
-
-  // filter out all reads that have no overlap at this stage
-  // for this, first set all reads to "used" and "singlet", then
-  //   re-allow those that have at least one SW ovelap
-
-  AS_used_ids.clear();
-  AS_used_ids.resize(AS_readpool.size(),1);
-  AS_isdebris.clear();
-  AS_isdebris.resize(AS_readpool.size(),DEBRIS_NOOVERLAP);
-
-  // overlay AS_debrisreason
-  {
-    auto dstI=AS_isdebris.begin();
-    auto srcI=AS_debrisreason.begin();
-    for(; srcI!=AS_debrisreason.end(); ++dstI, ++srcI){
-      if(*srcI) *dstI=*srcI;
-    }
-  }
-
-  // take back all reads with overlaps
-  for(const auto & cee : AS_confirmed_edges){
-    AS_isdebris[cee.rid1]=0;
-    AS_used_ids[cee.rid1]=0;
-  }
-
-  // Now, go through all the singlets and take them back into
-  //  assembly if they have special MIRA tags attached
-  // Also remove backbones & rails from the debris list
-  //  and set them to unused
-  {
-    for(uint32 i=0; i< AS_readpool.size(); i++){
-      if(AS_readpool[i].isUsedInAssembly()
-	 && AS_readpool[i].getLenClippedSeq()>0
-	 && (AS_readpool[i].hasTag(Read::REA_tagentry_idSRMr)
-	     || AS_readpool[i].hasTag(Read::REA_tagentry_idCRMr)
-	     || AS_readpool[i].hasTag(Read::REA_tagentry_idWRMr)
-	     || AS_readpool[i].hasTag(Read::REA_tagentry_idSAOr)
-	     || AS_readpool[i].hasTag(Read::REA_tagentry_idSROr)
-	     || AS_readpool[i].hasTag(Read::REA_tagentry_idSIOr))) {
-	AS_isdebris[i]=0;
-	AS_used_ids[i]=0;
-      }
-      if(AS_readpool[i].isBackbone()
-	 || AS_readpool[i].isRail()) {
-	AS_used_ids[i]=0;
-	AS_isdebris[i]=0;
-      }
-    }
-  }
-
-  // rollback digitally normalised reads to "used, debris"
-  for(uint32 rpi=0; rpi< AS_readpool.size(); ++rpi){
-    if(AS_debrisreason[rpi]==DEBRIS_DIGITAL_NORMALISATION){
-      AS_isdebris[rpi]=DEBRIS_DIGITAL_NORMALISATION;
-      AS_used_ids[rpi]=1;
-    }
-  }
-
-
-  // get total length of backbones (if any)
-  uint32 totalbblen=0;
-  for(list<Contig>::const_iterator cI=AS_bbcontigs.begin(); cI!=AS_bbcontigs.end(); cI++){
-    totalbblen+=cI->getContigLength();
-  }
-
-  ofstream fout;
-  if(as_fixparams.as_tmpf_unused_ids.size()!=0){
-    fout.open((dir_params.dir_tmp+"/"+as_fixparams.as_tmpf_unused_ids).c_str(), ios::out);
-    fout.close();
-  }
-
-  // outside precomputed lowerbound of oedges, for PathFinder
-  // is used lateron in constructStepByStep() of the Pathfinder
-  //
-  // however, every once in a while (every 10k to 100k reads used from
-  //  the pool), the overlap edges vector will be compressed (unecessary
-  //  edges thrown out) and therefore this vector will be emptied (to be reconstructed
-  //  by pathfinder)
-  //
-  // On mapping 8m Solexas to 70 contigs (4MB), time goes down from 234 minutes to
-  //  221 minutes (Core i940)
-  //
-  // effect of compression not as big as hoped for, but every little bit helps
-
-  vector<necontainer_t::iterator> tmp_lowerbound_oedges;
-
-  // TODO: currently filled by pathfinder, maybe good to have that already in skim?
-  AS_hasreptoverlap.clear();
-  AS_hasnoreptoverlap.clear();
-
-  // this one really filled by pathfinder
-  AS_maybespoilsport.clear();
-
-  // PathFinder object can be created ouside loop and re-used
-
-  PPathfinder qaf(&AS_miraparams,
-		  &AS_readpool,
-		  &AS_confirmed_edges,
-		  &AS_adsfacts,
-		  &aligncache,
-		  &AS_used_ids,
-		  &AS_multicopies,
-		  &AS_hasmcoverlaps,
-		  &AS_hasreptoverlap,
-		  &AS_hasnoreptoverlap,
-		  &AS_istroublemaker,
-		  &AS_incorchim,
-		  &AS_maybespoilsport,
-		  &AS_wellconnected,
-		  &tmp_lowerbound_oedges,
-		  &AS_templateguesses);
-
-  // this vector will hold the read IDs added by pathfinder to contig
-  // + backbone + rail IDs
-  // used after call to *_constructStepByStep() to set AS_used_ids[] elements
-  vector<int32> tmp_ids_in_contig;
-
-  uint32 overlapcompressstepping=AS_readpool.size()/5;
-  if(overlapcompressstepping<10000) overlapcompressstepping=10000;
-  //if(overlapcompressstepping<100) overlapcompressstepping=100;
-  if(overlapcompressstepping>100000) overlapcompressstepping=100000;
-  if(overlapcompressstepping>AS_readpool.size()) overlapcompressstepping=AS_readpool.size();
-  uint32 nextoverlapcompress=overlapcompressstepping;
-  cout << "overlapcompressstepping: " << overlapcompressstepping
-       << "\nnextoverlapcompress: " << nextoverlapcompress << endl;
-
-  bool foundSRMs=false;
-  uint32 numsingletssincecleanup=0;
-
-  bool maykillintermediatesinmglets=true;
-  bool shouldmovesmallclusterstodebris=false;
-  for(uint32 st=0;st < AS_miraparams.size(); st++){
-    if(AS_miraparams[st].getAssemblyParams().as_savesimplesingletsinproject) maykillintermediatesinmglets=false;
-    if(AS_miraparams[st].getAssemblyParams().as_minimum_readspercontig>1) shouldmovesmallclusterstodebris=true;
-  }
-
-  if(shouldmovesmallclusterstodebris) bfc_moveSmallClustersToDebris();
-
-
-#ifdef CLOCK_STEPS2
-  timeval tv;
-  timeval tvloop;
-  timeval tvtotal;
-  gettimeofday(&tvtotal,nullptr);
-#endif
-
-  //uint32 countingunused=AS_used_ids.size();
-
-  uint32 trackingunused=AS_used_ids.size();
-  for(uint32 i=0; i<AS_used_ids.size(); i++){
-    if(AS_used_ids[i]) --trackingunused;
-  }
-
-  uint32 numcontigs=1;
-  // bug: if someone specifically sets as_maxcontigsperpass to 2^32-1, then
-  //  this loop never runs.
-  for(;trackingunused>0; ++numcontigs){
-    CEBUG("bfc 1\n");
-    if(as_fixparams.as_dateoutput) dateStamp(cout);
-    cout << '\n';
-
-    bfc_sanityCheckASUSEDIDS(trackingunused,numcontigs);
-
-
-//    // REMOVEME: paranoia check
-//    for(uint32 ri=0; ri<AS_used_ids.size(); ++ri){
-//      BUGIFTHROW(AS_isdebris[ri] && AS_used_ids[ri]==0, "AS_isdebris[ri] && AS_used_ids[ri]==0  for ri " << ri << "\t" << AS_readpool[ri].getName());
-//    }
-
-
-
-    // jump out of for loop if max number of contigs was reached
-    if(as_fixparams.as_maxcontigsperpass>0 && numcontigs==as_fixparams.as_maxcontigsperpass+1) break;
-
-    CEBUG("bfc 2\n");
-    if(trackingunused>0){
-
-#ifdef CLOCK_STEPS2
-      gettimeofday(&tv,nullptr);
-      tvloop=tv;
-#endif
-
-      //// compress the overlap edges when needed
-      //if(AS_readpool.size()-unused > nextoverlapcompress){
-      //	if(AS_miraparams[0].getAssemblyParams().as_dateoutput) dateStamp(cout);
-      //	cout << "Compressing overlap edges ..."; cout.flush();
-      //	necontainer_t::const_iterator srcI=AS_confirmed_edges.begin();
-      //	necontainer_t::iterator dstI=AS_confirmed_edges.begin();
-      //	for(; srcI != AS_confirmed_edges.end(); ++srcI){
-      //	  if(AS_used_ids[srcI->rid1] == 0
-      //	     || AS_used_ids[srcI->linked_with] == 0){
-      //	    *dstI=*srcI;
-      //	    ++dstI;
-      //	  }
-      //	}
-      //	AS_confirmed_edges.resize(dstI-AS_confirmed_edges.begin());
-      //	nextoverlapcompress=AS_readpool.size()-unused+overlapcompressstepping;
-      //	cout << "done.\n";
-      //	if(AS_miraparams[0].getAssemblyParams().as_dateoutput) dateStamp(cout);
-      //}
-
-      Contig::setIDCounter(numcontigs);
-      // TODO: change wrt multiple MIRAparams
-      Contig buildcon(&AS_miraparams, AS_readpool);
-
-      //vector<int8> tmpused=AS_used_ids;
-
-#ifdef CLOCK_STEPS2
-      cout << "Timing BFC prelim1: " << diffsuseconds(tv) << endl;
-#endif
-
-      CEBUG("bfc 3\n");
-      list<Contig>::const_iterator bbContigI=AS_bbcontigs.begin();
-      if(numcontigs <= AS_bbcontigs.size()){
-	advance(bbContigI,numcontigs-1);
-      } else {
-	bbContigI=AS_bbcontigs.end();
-      }
-
-      CEBUG("bfc 4\n");
-      // set newreptmarked to true just to get into the for pass
-      //  value is changed within pass
-      bool newreptmarked=true;
-      bool wasovercalledited=false;
-      bool wasmajorovercalledited=false;
-
-      bool mastermayeditovercalls=ed_params.ed_mira_automatic_contic_editing; // may be changed in one of the iter
-      bool mayeditovercalls=mastermayeditovercalls; // recomputed after each contig build, just default init here
-
-      // build a contig, repetitively until
-      //  ... maximum number of iterations has passed
-      //  ... or no now repeats were marked
-      //  ... or no 454 edits happened in last iteration
-
-      // Note: if we�re in last pass, iterate at least once if
-      //  454 edits were made! (disregarding as_fixparams.as_numrmbbreakloops,
-      //  maxiter gets adapted in loop then
-
-      uint32 maxiter=as_fixparams.as_numrmbbreakloops;
-
-      // Note: assemblies with a lot of passes (>=4) will
-      //  get only one loop in the first pass. The reason: first pass already
-      //  discovers a lot of repeats that are dealt with later on
-      //  in makeAlignments(). It's faster to let makeAlignments() deal
-      //  with "discovering" and marking reads than to loop here.
-
-      if(as_fixparams.as_mark_repeats){
-	if(as_fixparams.as_numpasses >= 4 && passnr==1){
-	  maxiter=1;
-	}
-	// same thing: passes >= 6, pass 2 leads to maxiter = 2
-	if(as_fixparams.as_numpasses >= 6 && passnr==2
-	  && maxiter > 2){
-	  maxiter=2;
-	}
-      }
-
-      list<Contig::pbdse_t> pbdsev;
-
-      bool markrepeatsduringstore=true;
-      bool contignotok=false;
-      bool continueiter=true;
-
-#ifdef CLOCK_STEPS2
-      gettimeofday(&tv,nullptr);
-#endif
-      buildcon.discard();
-#ifdef CLOCK_STEPS2
-      cout << "Timing BFC discard con: " << diffsuseconds(tv) << endl;
-#endif
-
-      string basename_forextsave;
-      {
-	ostringstream ostr;
-	ostr << dir_params.dir_tmp << "/miratmp.pass_" << passnr << "_cb" << numcontigs << "_";
-
-	basename_forextsave=ostr.str();
-      }
-
-      bool contigtrimmed=false;
-      CEBUG("bfc 5\n");
-      //for(uint32 iter=0; iter < maxiter && continueiter; ++iter){
-      uint32 iter=0;
-      do{
-	string basename_forextsave_iter;
-	{
-	  ostringstream ostr;
-	  ostr << basename_forextsave << "i" << iter << "_";
-
-	  basename_forextsave_iter=ostr.str();
-	}
-
-	CEBUG("bfc 6/"<<iter << '\n');
-	if(iter>0) bfc_sanityCheckASUSEDIDS(trackingunused,numcontigs);
-
-	if(AS_hasbackbones
-	   && passnr>=as_fixparams.as_startbackboneusage_inpass
-	   && bbContigI != AS_bbcontigs.end()) {
-
-#ifdef CLOCK_STEPS2
-	  gettimeofday(&tv,nullptr);
-#endif
-
-	  // if we're in an iter>0, the contig is not empty
-	  // as, we're re-initialising with fresh bb contig,
-	  //  we need to do some housekeeping
-	  if(buildcon.getContigLength()>0){
-	    // release all reads
-	    //Contig::setCoutType(Contig::AS_TEXT);
-	    //cout << "Throwing away\n" << buildcon;
-	    auto & cr=buildcon.getContigReads();
-	    for(auto pcrI=cr.begin(); pcrI!=cr.end(); ++pcrI){
-	      if(pcrI.getORPID()>=0){
-		BUGIFTHROW(!AS_used_ids[pcrI.getORPID()],"bbrebuild ! AS_used_ids[...] ???");
-		AS_used_ids[pcrI.getORPID()]=0;
-		++trackingunused;
-	      }
-	    }
-	  }
-
-	  // new contig: initialise what's needed
-	  buildcon=*bbContigI;
-	  buildcon.setContigID(numcontigs);
-
-	  {
-	    //Contig::setCoutType(Contig::AS_TEXT);
-	    //cout << "registering \n" << buildcon;
-
-	    // track the reads
-	    auto & cr=buildcon.getContigReads();
-	    for(auto pcrI=cr.begin(); pcrI!=cr.end(); ++pcrI){
-	      if(pcrI.getORPID()>=0){
-		BUGIFTHROW(AS_used_ids[pcrI.getORPID()],"register AS_used_ids[" << pcrI.getORPID() << "]==" << static_cast<uint16>(AS_used_ids[pcrI.getORPID()]) << " ???");
-		AS_used_ids[pcrI.getORPID()]=1;
-		//--trackingunused;
-	      }
-	    }
-	  }
-
-#ifdef CLOCK_STEPS2
-	  cout << "Timing BFC copy bbcon: " << diffsuseconds(tv) << endl;
-	  gettimeofday(&tv,nullptr);
-#endif
-
-	  // re-initialising the baselocks is necessary as reads might
-	  //  have got new SRMc/WRMc tags in previous iterations
-	  //  these are not known in the initial backbone contig, so
-	  //  they must be made known
-	  // TODO: 11.10.2012 not sure whether still good
-	  buildcon.initialiseBaseLocks();
-
-	  // tell contig to use backbone characters when possible for
-	  //  tmp consensus
-	  // TODO: make configurable?
-	  buildcon.useBackbone4TmpConsensus(true);
-
-	  // and by default try to merge short reads (Solexa, SOLiD)
-	  buildcon.mergeNewSRReads(true);
-#ifdef CLOCK_STEPS2
-	  cout << "Timing BFC bbsetup remain: " << diffsuseconds(tv) << endl;
-#endif
-
-	} else {
-	  // do nothing
-	}
-
-	CEBUG("bfc 7/"<<iter << '\n');
-
-	buildcon.setContigNamePrefix(
-	  AS_miraparams[0].getContigParams().con_nameprefix);
-
-	if(iter==0){
-	  cout << "Building new contig " << numcontigs;
-	  if(buildcon.getNumBackbones()) cout << " from backbone " << buildcon.getContigName();
-	  cout << endl;
-	}else{
-	  cout << "Rebuilding contig " << numcontigs << endl;
-	}
-
-	//Contig::setCoutType(Contig::AS_DEBUG);
-	//cout << con;
-
-	if(!AS_coverageperseqtype.empty()){
-	  cout << "Setting contig coverage targets to: ";
-	  for(uint8 ii=0; ii<AS_coverageperseqtype.size(); ii++){
-	    cout << '\t' << AS_coverageperseqtype[ii];
-	  }
-	  cout << endl;
-	  buildcon.setContigCoverageTarget(AS_coverageperseqtype);
-	}
-
-	if(as_fixparams.as_dateoutput) dateStamp(cout);
-
-	cout << "Unused reads: " << trackingunused << endl;
-	cout.flush();
-
-	CEBUG("bfc 8/"<<iter << '\n');
-
-	bfc_callPathfinder(passnr,iter,trackingunused,shouldmovesmallclusterstodebris,
-			   buildcon,qaf);
-
-	CEBUG("bfc 9/"<<iter << '\n');
-
-	if(buildcon.getNumReadsInContig()==0){
-	  cout << "WARNING WARNING WARNING! no reads in contig?!?!?!" << endl;
-	  trackingunused=0;
-	  break;
-	}
-
-	bool contigmeetsrequirements=bfc_checkIfContigMeetsRequirements(buildcon);
-	if(!contigmeetsrequirements){
-
-	  // we're going to throw away this contig
-	  // however, save the small overlaps or else they might be completely lost!
-#if 1
-#ifdef CLOCK_STEPS2
-	  gettimeofday(&tv,nullptr);
-#endif
-	  bfc_savePersistentSmallOverlaps(buildcon,passnr,fout_povl);
-#ifdef CLOCK_STEPS2
-	  cout << "Timing BFC persistent small overlaps1: " << diffsuseconds(tv) << endl;
-#endif
-#endif
-
-	  newreptmarked=false;
-
-	  // this contig won't be taken, but contig numbering would
-	  //  go up in next loop.
-	  // Countermeasure: decrease contig number by one to have the
-	  //  loop increase it afterwards, effectivly re-using same contig number
-	  --numcontigs;
-
-	  uint32 numdebs=0;
-	  for(auto crI=buildcon.getContigReads().begin();crI!=buildcon.getContigReads().end();++crI){
-	    if(crI.getORPID() >= 0){
-	      BUGIFTHROW(AS_isdebris[crI.getORPID()]>0,"Ooooops, read is already debris? " << crI.getORPID() << " " << AS_readpool[crI.getORPID()].getName() << endl);
-	      BUGIFTHROW(!AS_used_ids[crI.getORPID()]>0,"Debris from an unused read in contig? " << crI.getORPID() << " " << AS_readpool[crI.getORPID()].getName() << endl);
-	      ++numdebs;
-	      AS_isdebris[crI.getORPID()]=DEBRIS_TINYCONTIG;
-	    }
-	  }
-	  cout << "Discarding" << endl;
-	  buildcon.discard();
-
-	  cout << "\nContig does not meet requirement of minimum reads per contig."
-	    "\nMoved " << numdebs << " reads to debris." << endl;
-
-	  // break out of the iter loop
-	  break;
-	}
-
-	cout << "\n\nFinished building." << endl;
-
-	if(buildcon.getContigLength()>5 && buildcon.getNumReadsInContig()>1){
-	  if(as_fixparams.as_put_asswithmira_tags){
-	    buildcon.addTagToConsensus(0,
-				       4,
-				       '=',
-				       "MIRA",
-				       "Assembled with MIRA",
-				       false);
-	  }
-	}
-
-	try {
-	  if(buildcon.getNumReadsInContig()>1){
-	    if(as_fixparams.as_dateoutput) dateStamp(cout);
-	    if(buildcon.getContigLength()>100000){
-	      cout << "Calculating statistics (this may take a while)." << endl;
-	    }
-
-#ifdef CLOCK_STEPS2
-	    gettimeofday(&tv,nullptr);
-#endif
-	    // see whether we can define new multicopies
-	    if(as_fixparams.as_automatic_repeat_detection){
-	      buildcon.analyseReadCoverage(AS_maxcoveragereached,
-				      AS_multicopies,
-				      AS_coverageperseqtype);
-	    }
-#ifdef CLOCK_STEPS2
-	    cout << "Timing BFC analysereadcov: " << diffsuseconds(tv) << endl;
-	    gettimeofday(&tv,nullptr);
-#endif
-
-	    buildcon.setCoutType(Contig::AS_TEXT);
-	    buildcon.dumpStats(cout);
-
-#ifdef CLOCK_STEPS2
-	    cout << "Timing BFC cout constats: " << diffsuseconds(tv) << endl;
-#endif
-	    if(as_fixparams.as_dateoutput) dateStamp(cout);
-	  }
-	}
-	catch (Notify n) {
-	  n.setGravity(Notify::FATAL);
-	  n.handleError(n.tif);
-	}
-	catch (...) {
-	  cerr << "Darn, error with that contig. See darn.fasta.\n";
-	  Read::setCoutType(Read::AS_CLIPPEDFASTA);
-	  for(auto & cre : buildcon.getContigReads()) {
-	    cout << cre;
-	  }
-	  abort();
-	}
-
-	CEBUG("bfc 10/"<<iter << '\n');
-
-	// saving pre-edit
-	saveExtTmpContig(buildcon,(basename_forextsave_iter+"pre"));
-
-	bool wasedited=false;
-	newreptmarked=false;
-
-#ifdef CLOCK_STEPS2
-	gettimeofday(&tv,nullptr);
-#endif
-
-
-	bool goforit=true;
-/*
-  PacBio trials with strobed reads ... MIRA throws on real, non-strobed data
-  furthermore, not sure whether this is really doable (accuracy ~85% *sigh*)
-
-	pbdsev.clear();
-	if(buildcon.hasSeqTypeData(ReadGroupLib::SEQTYPE_PACBIOHQ) && !(lastpass && iter==maxiter-1)){
-	  uint32 maxcorrect=buildcon.createPacBioDarkStrobeEdits(pbdsev);
-
-	  CEBUG("PacBio maxcorrect: " << maxcorrect << endl);
-
-	  if(maxcorrect>5) {
-	    goforit=false;
-	    wasmajorovercalledited=true;
-	  }
-
-	  // another iteration is needed to get a valid contig
-	  //if(maxiter<2) maxiter=2;
-	}
-*/
-
-	mayeditovercalls= mastermayeditovercalls & buildcon.hasEditableOvercallData();
-
-	if(goforit){
-	  // handling of tricky overcalls (normally 454 & Ion)
-	  vector<bool> readsmarkedsrm;
-
-	  // mark areas with tricky overcalls
-	  // in those areas, no repeat marker may be set
-	  // do this always
-	  if(mayeditovercalls && buildcon.getNumReadsInContig() >1){
-	    cout << "P " << passnr << ", marked " << buildcon.editTrickyOvercalls(true,false,readsmarkedsrm) << " reads.\n";
-	  }
-
-#ifdef CLOCK_STEPS2
-	  cout << "Timing BFC edit tricky1: " << diffsuseconds(tv) << endl;
-	  gettimeofday(&tv,nullptr);
-#endif
-
-	  markrepeatsduringstore=true;
-	  if(as_fixparams.as_mark_repeats
-	     && !as_fixparams.as_mark_repeats_onlyinresult
-	     && buildcon.getNumReadsInContig() >1){
-	    Contig::repeatmarker_stats_t contigrepstats;
-	    newreptmarked=markRepeats(buildcon, readsmarkedsrm, contigrepstats);
-	    AS_bfcstats[buildcon.getLongRepeatStatus()].numnewsrm+=contigrepstats.numSRMs;
-	    foundSRMs|=newreptmarked;
-	    markrepeatsduringstore=false;
-	  }
-
-#ifdef CLOCK_STEPS2
-	  cout << "Timing BFC mark reps: " << diffsuseconds(tv) << endl;
-	  gettimeofday(&tv,nullptr);
-#endif
-
-	  CEBUG("bfc 11/"<<iter << '\n');
-
-	  // edit only when no misassembled repeats found
-	  //  this is to prevent the editor to try something foolish on
-	  //  misassembled things
-	  // same applies to overcall editing
-	  //
-
-	  wasovercalledited=false;
-
-//	  if(buildcon.getNumReadsInContig() <= 8) mayeditovercalls=false;
-//	  cout << "\nXXXXXXXXXXXXXX " << newreptmarked
-//	       << " " << mayeditovercalls
-//	       << " " << buildcon.getNumReadsInContig() << endl;
-	  if(!newreptmarked && mayeditovercalls && buildcon.getNumReadsInContig() >1){
-	    uint32 nummarks=buildcon.editTrickyOvercalls(false,false,readsmarkedsrm);
-	    cout << "Edited " << nummarks << " reads.\n";
-	    AS_bfcstats[buildcon.getLongRepeatStatus()].numeditovercall+=nummarks;
-	    wasovercalledited=nummarks>0;
-
-	    // major edit is edits in >=5% of the reads
-	    wasmajorovercalledited=(nummarks>0 && nummarks >= buildcon.getNumReadsInContig()/20);
-
-	    if(wasovercalledited){
-	      if(as_fixparams.as_dateoutput) dateStamp(cout);
-	      cout << "Deleting superfluous gap columns (1) ... ";
-	      cout.flush();
-	      auto tmpnumdel=buildcon.deleteStarOnlyColumns(0, buildcon.getContigLength()-1);
-	      cout << "done, deleted " << tmpnumdel << " columns.\n";
-	      if(as_fixparams.as_dateoutput) dateStamp(cout);
-	    }
-#ifdef CLOCK_STEPS2
-	    cout << "Timing BFC edit tricky2: " << diffsuseconds(tv) << endl;
-	    gettimeofday(&tv,nullptr);
-#endif
-	  }
-
-	  // BaCh 29.04.2011
-	  // However, editSingleDiscrepancyNoHAFTag() is conservative enough to allow
-	  //  that kind of edits all the time
-	  //
-
-	  if(ed_params.ed_mira_automatic_contic_editing
-	     && ed_params.ed_kmer_singlets
-	     && buildcon.getNumReadsInContig() >4){
-	    // editmode: increasingly less conservative (but still conservative enough)
-	    uint32 editmode=passnr-1;
-	    if(editmode>3) editmode=3;
-	    // careful, editmode 3 not suited for EST/RNASeq!
-	    if(!AS_miraparams[0].getPathfinderParams().paf_use_genomic_algorithms
-	       && editmode>2) {
-	      editmode=2;
-	    }
-	    uint32 numedits=buildcon.editSingleDiscrepancyNoHAFTag(readsmarkedsrm,editmode);
-	    cout << "\nEdited " << numedits << " positions.\n";
-	    if(numedits>0){
-	      AS_bfcstats[buildcon.getLongRepeatStatus()].numedithashfreq+=numedits;
-	      if(as_fixparams.as_dateoutput) dateStamp(cout);
-	      cout << "Deleting superfluous gap columns (2) ... ";
-	      cout.flush();
-	      auto tmpnumdel=buildcon.deleteStarOnlyColumns(0, buildcon.getContigLength()-1);
-	      cout << "done, deleted " << tmpnumdel << " columns.\n";
-	      if(as_fixparams.as_dateoutput) dateStamp(cout);
-	    }
-#ifdef CLOCK_STEPS2
-	    cout << "Timing BFC edit single discrepancy, no HAF: " << diffsuseconds(tv) << endl;
-	    gettimeofday(&tv,nullptr);
-#endif
-	  }
-
-
-/*
-  Trials with original, raw PB reads (non-CCS, non-CLR), currently on hold
-
-	  // PacBio LQ edits
-	  if(buildcon.getNumReadsInContig() >4 && buildcon.hasSeqTypeData(ReadGroupLib::SEQTYPE_PACBIOLQ)){
-	    uint32 numcoledits=0;
-	    uint32 numreadedits=0;
-	    buildcon.editPBSledgeHammer(readsmarkedsrm,numcoledits,numreadedits);
-	    //buildcon.deleteStarOnlyColumns(0,I->getContigLength());
-	    if(numreadedits){
-	      cout << "PacBio low quality SledgeHammer edits: " << numcoledits << " c-edits, " << numreadedits << " r-edits.\n";
-	    }
-	  }
-*/
-
-	  // if we're in last pass and 454 / pacbio dark strobe edits were made, loop at least
-	  //  once (switching off the 454 / pacbio edits for next pass)
-	  if(lastpass
-	     && wasovercalledited
-	     && iter==maxiter-1){
-	    if(maxiter>=1) {
-	      mastermayeditovercalls=false;
-	    }
-	    maxiter++;
-	  }
-
-	  CEBUG("bfc 12/"<<iter << '\n');
-
-#ifdef CLOCK_STEPS2
-	  gettimeofday(&tv,nullptr);
-#endif
-	  // get rid of all PSHP tags
-	  buildcon.deleteTagsInReads(Read::REA_defaulttag_PSHP.identifier);
-#ifdef CLOCK_STEPS2
-	  cout << "Timing BFC delPSHP: " << diffsuseconds(tv) << endl;
-#endif
-
-	  CEBUG("bfc 13/"<<iter << '\n');
-
-#ifdef MIRA_HAS_EDIT
-	  if(!newreptmarked && ed_params.ed_automatic_contic_editing!=0){
-	    cout << "Editing temporary contig: ";
-	    if (buildcon.getNumReadsInContig() >1) {
-	      cout << endl;
-#ifdef CLOCK_STEPS2
-	      gettimeofday(&tv,nullptr);
-#endif
-	      wasedited=true;
-
-	      editContigBack(buildcon, const_cast<EDITParameters &>(eparams));
-
-	      //ScfBuffer::statistics();
-	      //ScfBuffer::show();
-	      //ScfBuffer::discard();
-	      //ScfBuffer::statistics();
-	      //ScfBuffer::show();
-
-	      cout << "done.\n";
-	      if(as_fixparams.as_dateoutput) dateStamp(cout);
-	      cout << "Deleting superfluous gap columns ... ";
-	      cout.flush();
-	      buildcon.deleteStarOnlyColumns(0, buildcon.getContigLength()-1);
-	      cout << "done.\n";
-
-#ifdef CLOCK_STEPS2
-	      cout << "Timing BFC editconback and more: " << diffsuseconds(tv) << endl;
-#endif
-	      Contig::setCoutType(Contig::AS_TEXT);
-	      if(as_fixparams.as_dateoutput) dateStamp(cout);
-	      buildcon.stats(cout);
-	      if(as_fixparams.as_dateoutput) dateStamp(cout);
-	    } else {
-	      cout << "(only 1 read in contig, no editing)\n";
-	    }
-	  }
-#endif
-
-
-	  CEBUG("bfc 14/"<<iter << '\n');
-
-	  // saving again if rept-marked or edited
-	  if(newreptmarked || wasedited || wasovercalledited) {
-	    if(wasovercalledited) {
-	      saveExtTmpContig(buildcon,(basename_forextsave_iter+"post454"));
-	    } else {
-	      saveExtTmpContig(buildcon,(basename_forextsave_iter+"post"));
-	    }
-	  } else {
-	    if ( as_fixparams.as_output_exttmp_fasta
-		 || as_fixparams.as_output_exttmp_ace
-		 || as_fixparams.as_output_exttmp_gap4da
-		 || as_fixparams.as_output_exttmp_caf) {
-	      cout << "No edit and no new repeat found, not saving extra temporary contig again.\n";
-	    }
-	  }
-	}
-
-
-	CEBUG("bfc 15/"<<iter << '\n');
-
-	CEBUG("bfc 16/"<<iter << '\n');
-
-	// Transfer all the reads fron the new contig into readpool
-	//  if no misassembly was detected (or 454 editing happened)
-#ifdef CLOCK_STEPS2
-	gettimeofday(&tv,nullptr);
-#endif
-	if(!newreptmarked || wasovercalledited || !pbdsev.empty()) {
-	  transferContigReadsToReadpool(buildcon, pbdsev, passnr);
-
-#ifdef CLOCK_STEPS2
-	  cout << "Timing BFC rp transfer: " << diffsuseconds(tv) << endl;
-#endif
-	} else {
-	  cout << " Transfering read tags to readpool." << endl;
-	  transferContigReadTagsToReadpool(buildcon, bbContigI);
-#ifdef CLOCK_STEPS2
-	  cout << "Timing BFC crtag2rp transfer: " << diffsuseconds(tv) << endl;
-#endif
-	}
-	cout << "Done." << endl;
-
-	CEBUG("bfc 17/"<<iter << '\n');
-
-	contigtrimmed=false;
-	if(passnr>1){
-	  // reason: on highly repetitive data, reads trimmed away have SRMr tags,
-	  // leading to long assembly times in later contigs. Not trimming away the
-	  // reads in first pass makes the 1st pass finish quicker and arrive to the
-	  // Smith-Waterman repeat disambiguation stage (SRMr->CRMr tags)
-	  contignotok=bfc_trimDenovoIfNecessary(buildcon,foundSRMs,basename_forextsave_iter,trackingunused);
-	  if(contignotok) ++AS_bfcstats[buildcon.getLongRepeatStatus()].numdisassemblies;
-	  contigtrimmed=true;
-	}
-
-	++iter;
-
-	continueiter=(iter < maxiter) && (newreptmarked | wasmajorovercalledited | contignotok);
-
-	CEBUG("I have newreptmarked " << newreptmarked << " wasmajorovercalledited " << wasmajorovercalledited << " contignotok " << contignotok << "\tcontinueiter: " << continueiter << endl);
-
-	bool nukeexistingcontig=false;
-	if(newreptmarked){
-	  cout << "Identified misassembled reads in contig.\n";
-	}
-	if(wasmajorovercalledited){
-	  cout << "Had many overcall edits in reads.\n";
-	  nukeexistingcontig=true;
-	}
-	if(!contigmeetsrequirements){
-	  BUGIFTHROW(true,"We should never be here: contigmeetsrequirements");
-	}
-
-	if(continueiter && buildcon.getNumBackbones()>0){
-	  cout << "Has backbones, no additional iteration allowed.\n";
-	  continueiter=false;
-	}
-
-	if(lastpass) nukeexistingcontig=false;
-
-	if(continueiter){
-	  cout << "Need to loop contig building\n";
-	  if(nukeexistingcontig){
-	    cout << "Iteration will nuke contig built so far.\n";
-	    //auto & cr=buildcon.getContigReads();
-	    //for(auto pcrI=cr.begin(); pcrI!=cr.end(); ++pcrI){
-	    //  if(pcrI.getORPID()>=0){
-	    //	BUGIFTHROW(!AS_used_ids[pcrI.getORPID()],"nec ! AS_used_ids[...] ???");
-	    //	AS_used_ids[pcrI.getORPID()]=0;
-	    //	trackingunused+=1;
-	    //  }
-	    //}
-
-	    for(auto & rid : qaf.getRIDsKnownInContig()){
-	      if(rid>=0
-		 && !AS_readpool[rid].isBackbone()
-		 && !AS_readpool[rid].isRail()){
-		if(AS_used_ids[rid]){
-		  trackingunused+=1;
-		  AS_used_ids[rid]=0;
-		}
-	      }
-	    }
-
-	    buildcon.discard();
-	  }else{
-	    cout << "Iteration will keep contig built so far.\n";
-	  }
-	}
-
-      }while(continueiter);
-
-      bfc_sanityCheckASUSEDIDS(trackingunused,numcontigs);
-
-      // no contig? Then it was discarded, restart building one completely anew
-      if(buildcon.getNumReadsInContig() == 0) continue;
-
-      // this here to handle cases repeats should be marked only in results
-      // TODO: check whether not to remove this parameter / option at all
-      if(pbdsev.empty()
-	 && lastpass
-	 && as_fixparams.as_mark_repeats
-	 && as_fixparams.as_mark_repeats_onlyinresult
-	 && buildcon.getNumReadsInContig() >1){
-	CEBUG("bfc 18\n");
-#ifdef CLOCK_STEPS2
-	gettimeofday(&tv,nullptr);
-#endif
-	vector<bool> dummy;
-
-	Contig::repeatmarker_stats_t contigrepstats;
-	newreptmarked=markRepeats(buildcon, dummy,contigrepstats);
-	AS_bfcstats[buildcon.getLongRepeatStatus()].numnewsrm+=contigrepstats.numSRMs;
-	foundSRMs|=newreptmarked;
-	markrepeatsduringstore=false;
-#ifdef CLOCK_STEPS2
-	cout << "Timing BFC markrep during store: " << diffsuseconds(tv) << endl;
-#endif
-      }
-
-      if(buildcon.getNumReadsInContig() >0){
-	if(newreptmarked){
-	  cout << "\nAccepting probably misassembled contig, ";
-	  if(contigtrimmed) {
-	    cout << " but kept only best, non-problematic part.\n";
-	  }else{
-	    cout << " keeping as is.\n";
-	  }
-	}
-
-	CEBUG("bfc 19\n");
-
-#if 1
-#ifdef CLOCK_STEPS2
-	gettimeofday(&tv,nullptr);
-#endif
-	bfc_savePersistentSmallOverlaps(buildcon,passnr,fout_povl);
-#ifdef CLOCK_STEPS2
-	cout << "Timing BFC persistent small overlaps2: " << diffsuseconds(tv) << endl;
-#endif
-#endif
-
-	CEBUG("bfc 20\n");
-
-#ifdef CLOCK_STEPS2
-	gettimeofday(&tv,nullptr);
-#endif
-	bfc_storeContig(buildcon,numcontigs,markrepeatsduringstore,passnr,lastpass);
-#ifdef CLOCK_STEPS2
-	cout << "Timing BFC store con: " << diffsuseconds(tv) << endl;
-#endif
-
-
-	{
-	  if(buildcon.getContigLength()>=5000){
-	    cout << "Contig coverage analysis ";
-	    if(buildcon.getContigLength()>=100000){
-	      cout << "(this may take a while) ";
-	    }
-	    cout << "... "; cout.flush();
-	    const Contig::constats_t & cs=buildcon.getStats();
-	    for(uint32 st=0; st<ReadGroupLib::SEQTYPE_END; st++){
-	      covperstpercon[st].push_back(static_cast<uint32>(cs.avg_covperst[st]+.5));
-	      //cout << "cccccccccccc: " << covperstpercon[st].back() << endl;
-	    }
-	    covtotalpercon.push_back(static_cast<uint32>(cs.avg_coverage+.5));
-	  }
-	}
-
-	// did the caller to assemble() ask for a callback for each contig built?
-	// if we're on the last past, then call it
-	if(lastpass && AS_contigbuilt_callbackfunc!=nullptr){
-	  (*AS_contigbuilt_callbackfunc)(buildcon, AS_readpool);
-	}
-
-	if(as_fixparams.as_spoilerdetection) {
-	  if(!as_fixparams.as_spdetect_lastpassonly
-	     || passnr==as_fixparams.as_numpasses-1) {
-	    huntSpoilSports(buildcon);
-	  }
-	}
-      }
-
-      // if we were in mapping mode, on the last contig and not also building
-      //  new contigs, move all remaining reads to debris
-
-      if( !as_fixparams.as_backbone_alsobuildnewcontigs
-	  && bbContigI != AS_bbcontigs.end()){
-	++bbContigI;  // don't bother to decrease after using this ... will be re-init in next loop anyway
-	if(bbContigI == AS_bbcontigs.end()){
-	  uint32 adddebris=0;
-	  for(size_t uid=0; uid<AS_used_ids.size(); ++uid){
-	    if(AS_used_ids[uid]==0){
-	      ++adddebris;
-	      --trackingunused;
-	      AS_isdebris[uid]=DEBRIS_NOTMAPPED;
-	      AS_used_ids[uid]=1;
-	    }
-	  }
-	  cout << "Last backbone mapped, not building new ones.\nMoved " << adddebris << " remaining reads to debris.\n";
-	}
-      }
-
-
-    }  // if(trackingunused>0) ...
-
-
-    //unused=0;
-#ifdef CLOCK_STEPS2
-    cout << "Timing BFC loop total: " << diffsuseconds(tvloop) << endl;
-#endif
-  }   //for(;trackingunused>0; ++numcontigs) ...
-
-
-  // force a sanity check
-  bfc_sanityCheckASUSEDIDS(trackingunused,0);
-
-  // unused reads? we jumped out of contig creation
-  // define unused reads as debris
-
-  if(trackingunused>0){
-    for(size_t uid=0; uid<AS_used_ids.size(); ++uid){
-      if(AS_used_ids[uid]==0){
-	AS_isdebris[uid]=DEBRIS_ABORTEDCONTIGCREATION;
-	AS_used_ids[uid]=1;
-      }
-    }
-  }
-
-  // Adapt debris
-  // - DEBRIS_NOOVERLAP with MNRr tag changed to DEBRIS_MASKEDNASTYREPEAT
-  // - DEBRIS_NOOVERLAP with megahub flag changed to DEBRIS_MEGAHUB
-  //
-  // Also create warning if needed
-  {
-    uint32 numnasty=0;
-    uint32 nummega=0;
-    for(size_t uid=0; uid<AS_isdebris.size(); ++uid){
-      if(AS_isdebris[uid]==DEBRIS_NOOVERLAP){
-	if(AS_readpool[uid].hasTag(Read::REA_tagentry_idMNRr)){
-	  AS_isdebris[uid]=DEBRIS_MASKEDNASTYREPEAT;
-	  ++numnasty;
-	}else if(AS_readpool[uid].hasTag(Read::REA_tagentry_idHAF7)){
-	  AS_isdebris[uid]=DEBRIS_MASKEDHAF7REPEAT;
-	}else if(AS_readpool[uid].hasTag(Read::REA_tagentry_idHAF6)){
-	  AS_isdebris[uid]=DEBRIS_MASKEDHAF6REPEAT;
-	}else if(!AS_skimmegahubs.empty() && AS_skimmegahubs[uid]==1){
-	  AS_isdebris[uid]=DEBRIS_MEGAHUB;
-	  ++nummega;
-	}
-      }
-    }
-    if(nummega){
-      string wstr("There are ");
-      auto dummypercent=static_cast<uint32>((static_cast<double>(AS_readpool.size())/nummega)+.5);
-      wstr+=boost::lexical_cast<string>(nummega)+" of your reads (~" + boost::lexical_cast<string>(dummypercent) + "%) declared as megahubs (too many possible connections to other reads) and where the SKIM fast overlap finder did not return enough results.\nIf you want those reads to be found (and subsequently assembled), you need to either\n- switch off filtering of megahubs (-SK:fmh=no)\n- increase the size of the megahub cap (-SK:mhc=...)\nBeware! Megahubs are the first defense mechan [...]
-      if(nummega<1000) {
-	wstr+=" Fortunately, the number of meguhbs is low enough to safely switch off filtering.";
-      }else{
-	wstr+=" With this number of megahubs, the assembly is expected to ";
-	if(nummega<10000){
-	  wstr+="take a couple of minutes longer per pass, switching off filtering should be OK.";
-	}else if(nummega<100000){
-	  wstr+="take some 30 minutes to 1 hour longer per pass when switching off filtering, if you want to wait for that, OK.";
-	}else if(nummega<500000){
-	  wstr+="take some 1 to 5 hours longer per pass when switching off filtering, that can get long.";
-	}else{
-	  wstr+="take >= 5 hours to several days longer per pass when switching off filtering, only for die-hards.";
-	}
-      }
-      AS_warnings.setWarning("UNASSEMBLED_MEGAHUBS",2,"Megahub reads landed in debris file",wstr);
-    }
-    if(numnasty){
-      string wstr("There are ");
-      auto dummypercent=static_cast<uint32>((static_cast<double>(AS_readpool.size())/numnasty)+.5);
-      wstr+=boost::lexical_cast<string>(nummega)+" of your reads (~" + boost::lexical_cast<string>(dummypercent) + "%) containing so many bases masked as nasty repeats that the SKIM fast overlap finder did not return enough results.\nIf you want those reads to be found (and subsequently assembled), you need to either\n- switch off masking of nasty repeats (-HS:mnr=no)\n- increase the the nasty repeat ratio (-HS:nrr=...) (consult the hash statistics in the output log of MIRA to find a goo [...]
-      if(!AS_miraparams[0].getPathfinderParams().paf_use_genomic_algorithms){
-	wstr+="\n- as you do EST/RNASeq assembly, lossless digital normalisation (-HS:ldn=yes) may also be an option";
-	if(AS_miraparams[0].getHashStatisticsParams().hs_apply_digitalnormalisation) {
-	  wstr+=", but you already had it on";
-	}
-      }
-      wstr+="\nBeware! Masking of nasty repeats is the second defense mechanism of MIRA (after megahubs) to keep assembly times reasonable. Changing the defaults will increase the time needed.";
-      if(numnasty<1000) {
-	wstr+=" Fortunately, the number of completely masked reads is low enough to safely switch off masking.";
-      }else{
-	wstr+=" With this number of masked reads, the assembly is expected to ";
-	if(numnasty<10000){
-	  wstr+="take a couple of minutes longer per pass, switching off masking should be OK.";
-	}else if(numnasty<100000){
-	  wstr+="take some 30 minutes to 1 hour longer per pass when switching off masking, if you want to wait for that, OK.";
-	}else if(numnasty<500000){
-	  wstr+="take some 1 to 5 hours longer per pass when switching off masking, that can get long.";
-	}else{
-	  wstr+="take >= 5 hours to several days longer per pass when switching off masking, only for die-hards.";
-	}
-      }
-      AS_warnings.setWarning("UNASSEMBLED_NASTYREPEATS",2,"Reads with masked nasty repeats landed in debris file",wstr);
-    }
-  }
-
-  cout << "\nBuildstats - RM positions        :\t"
-       << AS_bfcstats[0].numnewsrm << '\t' << AS_bfcstats[1].numnewsrm
-       << "\nBuildstats - overcall edits      :\t"
-       << AS_bfcstats[0].numeditovercall << '\t' << AS_bfcstats[1].numeditovercall
-       << "\nBuildstats - hash edits          :\t"
-       << AS_bfcstats[0].numedithashfreq << '\t' << AS_bfcstats[1].numedithashfreq
-       << "\nBuildstats - contig disassemblies:\t"
-       << AS_bfcstats[0].numdisassemblies << '\t' << AS_bfcstats[1].numdisassemblies
-       << endl << endl;
-
-  analyseTemplateGuesses();
-  if(lastpass && passnr==1){
-    analyseTemplateGuesses();
-  }
-
-  if(lastpass) {
-    saveDebrisList();
-  }else{
-    saveDebrisList(passnr, "", "_pass");
-  }
-
-  // reads that are debris or singlets apparently need every chance
-  //  they can get to align, therefore subsequent passes should not
-  //  reduce the overlaps
-  // Change: for Solexa and Ion reads ... sorry, we'll just miss out
-  {
-    for(uint32 i=0; i<AS_needalloverlaps.size(); i++){
-      if(AS_isdebris[i] && AS_readpool[i].getSequencingType() != ReadGroupLib::SEQTYPE_SOLEXA
-	 && AS_isdebris[i] && AS_readpool[i].getSequencingType() != ReadGroupLib::SEQTYPE_IONTORRENT) AS_needalloverlaps[i]=true;
-    }
-
-    list<Contig>::const_iterator clI=AS_contigs.begin();
-    vector<int32> contigids;
-    for(; clI!=AS_contigs.end(); clI++){
-      if(clI->getNumReadsInContig()==1){
-	clI->getReadORPIDsAtContigPosition(contigids,0,0);
-	AS_needalloverlaps[contigids[0]]=true;
-      }
-    }
-  }
-
-  // calculate median of average contig coverage
-  // TODO: this is calculated only once because of problems
-  //  with decreasing average/median in subsequent passes
-  //  see if it can be improved
-  if(as_fixparams.as_uniform_read_distribution
-     && passnr+1>=as_fixparams.as_urd_startinpass
-     && !covperstpercon[0].empty() && AS_coverageperseqtype.empty()){
-    AS_coverageperseqtype.clear();
-
-    cout << "Setting coverage analysis values for uniform read distribution:\n";
-    for(uint32 st=0; st<ReadGroupLib::SEQTYPE_END; st++){
-      sort(covperstpercon[st].begin(),covperstpercon[st].end());
-      AS_coverageperseqtype.push_back(covperstpercon[st][covperstpercon[st].size()/2]);
-      cout << '\t' << ReadGroupLib::getNameOfSequencingType(st) << " coverage:\t" << AS_coverageperseqtype.back() << '\n';
-    }
-    sort(covtotalpercon.begin(),covtotalpercon.end());
-    AS_coveragetotal=covtotalpercon[covtotalpercon.size()/2];
-  }
-
-  AS_steps[ASCONTIGSOK]=1;
-
-  AS_used_ids.clear();
-
-  //  saveAsCAF();
-
-  FUNCEND();
-
-  return foundSRMs;
-}
-#define CEBUG(bla)
-
-
-
-/*************************************************************************
- *
- * numexpected: number of reads expected to be unused
- * numcontigs is a simple "don't do that all the time" switch, but every 100th contig
- *
- *************************************************************************/
-
-void Assembly::bfc_sanityCheckASUSEDIDS(uint32 numexpected, uint32 numcontigs)
-{
-  // REMOVEME from production code once stable
-
-  FUNCSTART("void Assembly::bfc_sanityCheckASUSEDIDS(uint32 numexpected)");
-
-  if(AS_miraparams[0].getSpecialParams().mi_extra_flag1 || numcontigs%100==0){
-#ifdef CLOCK_STEPS2
-    timeval tv;
-    gettimeofday(&tv,nullptr);
-#endif
-
-    uint32 count=0;
-    for(auto a : AS_used_ids) if(!a) ++count;
-
-#ifdef CLOCK_STEPS2
-    cout << "Timing BFC unused: " << diffsuseconds(tv) << endl;
-    cout << "CUnused: " << count << endl;
-    cout << "TUnused: " << numexpected << endl;
-    cout << "AS_used_ids.size(): " << AS_used_ids.size() << endl;
-#endif
-
-    BUGIFTHROW(count!=numexpected,"count " << count << " != expected " << numexpected);
-  }
-}
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-#define CEBUG(bla)   {cout << bla; cout.flush(); }
-void Assembly::bfc_callPathfinder(const int32 passnr, const uint32 iter, uint32 & trackingunused, bool shouldmovesmallclusterstodebris,Contig & buildcon, PPathfinder & qaf)
-{
-  FUNCSTART("void Assembly::bfc_callPathfinder(const int32 passnr, const uint32 iter, uint32 trackingunused, bool shouldmovesmallclusterstodebris,Contig & buildcon, PPathfinder & qaf)");
-
-  assembly_parameters const & as_fixparams= AS_miraparams[0].getAssemblyParams();
-
-#ifdef CLOCK_STEPS2
-  timeval tv;
-#endif
-
-  // in which mode are we? de-novo or mapping?
-  bool assemblymode_mapping=false;
-  if(AS_hasbackbones
-     && passnr >= AS_miraparams[0].getAssemblyParams().as_startbackboneusage_inpass
-     && ! AS_miraparams[0].getAssemblyParams().as_backbone_alsobuildnewcontigs){
-    assemblymode_mapping=true;
-  }
-
-  cout << iter << "\tKnown 1: " << qaf.getRIDsKnownInContig().size() << endl;
-  if(iter==0
-     || buildcon.getContigReads().size()==0
-     || buildcon.getContigLength()==0){
-    CEBUG("iter 0, PF init new contig\n");
-    qaf.prepareForNewContig(buildcon);
-  }else if(assemblymode_mapping){
-    CEBUG("iter n, mapping, PF resync contig\n");
-    qaf.resyncContig();
-  }
-  cout << "Known 2: " << qaf.getRIDsKnownInContig().size() << endl;
-
-  CEBUG("assemblymode_mapping: " << assemblymode_mapping << '\n');
-
-  bool wantbootstrap=false;
-  //if(assemblymode_mapping){
-  //  for(uint32 st=0; st<AS_seqtypespresent.size(); ++st){
-  //    if(AS_seqtypespresent[st] && AS_miraparams[st].getAssemblyParams().as_backbone_bootstrapnewbackbone) wantbootstrap=true;
-  //  }
-  //}
-  if(AS_seqtypespresent[ReadGroupLib::SEQTYPE_SOLEXA] && AS_miraparams[ReadGroupLib::SEQTYPE_SOLEXA].getAssemblyParams().as_backbone_bootstrapnewbackbone) wantbootstrap=true;
-
-  if(assemblymode_mapping && AS_seqtypespresent[ReadGroupLib::SEQTYPE_SOLEXA]){
-    if(wantbootstrap){
-      CEBUG("mapping & solexa bootstrap\n");
-      bfc_cp_mapWithSolexa(buildcon,qaf);
-
-      //{
-      //	ofstream fout("aftermap.maf");
-      //	fout << "@Version\t2\t0\n";
-      //	Contig::setCoutType(Contig::AS_MAF);
-      //	Contig::setOutputRails(true);
-      //	ReadGroupLib::dumpAllReadGroupsAsMAF(fout);
-      //	fout << buildcon;
-      //	Contig::setOutputRails(false);
-      //}
-
-      cout << "Looking at what to throw away ... "; cout.flush();
-      priv_removePotentiallyWrongBaseInserts(buildcon);
-
-      cout << "stripping ... ";cout.flush();
-      buildcon.stripToBackbone();
-      for(auto & rid : qaf.getRIDsKnownInContig()){
-	if(rid>=0
-	   && !AS_readpool[rid].isBackbone()
-	   && !AS_readpool[rid].isRail()){
-	  AS_used_ids[rid]=0;
-	}
-      }
-      // chomp is needed here:
-      //  removing reads from the contig may leave overhangs at the ends which are not
-      //  covered by backbone. The alignment routines in Contig::addRead_wrapped() will not
-      //  cope well with that as the calculation of the expected offset is then wrong
-      //  (correct for indels *in* the reference, but not made for pseudo-indels at the
-      //  ends of the contig)
-      cout << "done, chomping ... ";cout.flush();
-      buildcon.chompFront(-1);
-      buildcon.chompBack(-1);
-
-      cout << "done, synching ... ";cout.flush();
-      qaf.resyncContig();
-      cout << "done\n";
-    }
-
-    bfc_cp_mapWithSolexa(buildcon,qaf);
-
-    // TODO: hack until there's a routine that only clears tags set by the
-    //  makeIntelligentConsensus() functions.
-    buildcon.clearConsensusTags();
-
-    CEBUG("TU before " << trackingunused << endl);
-    CEBUG("RIDs known " << qaf.getRIDsKnownInContig().size() << endl);
-    trackingunused-=qaf.getRIDsKnownInContig().size();
-    CEBUG("TU after " << trackingunused << endl);
-
-  }else if(assemblymode_mapping){
-    CEBUG("bfccp2" << endl);
-    qaf.map();
-    buildcon.coutAddReadTimings();
-    cout << "Known 3: " << qaf.getRIDsKnownInContig().size() << endl;
-    trackingunused-=qaf.getRIDsKnownInContig().size();
-  }else{
-#ifdef CLOCK_STEPS2
-    gettimeofday(&tv,nullptr);
-#endif
-
-    CEBUG("use general pathfinder: " << AS_miraparams[0].getPathfinderParams().paf_use_genomic_algorithms << '\n');
-
-    bfc_sanityCheckASUSEDIDS(trackingunused, buildcon.getContigID());
-
-    auto hacktracking=buildcon.getNumReadsInContig();
-    if(buildcon.getNumReadsInContig()==0){
-      CEBUG("bfccp3" << endl);
-    }else{
-      CEBUG("no bfccp3" << endl);
-	  // so if the contig has some reads already? We're in an iter loop
-	  // bump trackingunused by number of reads because after calling PPathfinder,
-	  //  they'll be in the number of reads the pathfinder knows of.
-    }
-
-    qaf.denovo();
-
-#ifdef CLOCK_STEPS2
-    cout << "Timing BFC paf construct: " << diffsuseconds(tv) << endl;
-#endif
-    buildcon.coutAddReadTimings();
-
-    cout << iter << "\tKnown 3: " << qaf.getRIDsKnownInContig().size() << endl;
-    trackingunused+=hacktracking;
-    trackingunused-=qaf.getRIDsKnownInContig().size();
-
-    bfc_sanityCheckASUSEDIDS(trackingunused, buildcon.getContigID());
-
-    // Trigger moving small clusters to debris if the pathfinder had to refill its
-    //  start cache or when the start cache containes only singlets
-    if(shouldmovesmallclusterstodebris
-       && (qaf.startCacheRanDry() || qaf.startCacheHasSinglets())){
-      cout << "Triggering additional cluster check:";
-      if(shouldmovesmallclusterstodebris) cout << " shouldmovesmallclusterstodebris";
-      if(qaf.startCacheRanDry()) cout << " startCacheRanDry";
-      if(qaf.startCacheHasSinglets()) cout << " startCacheHasSinglets";
-      cout << '\n';
-      trackingunused-=bfc_moveSmallClustersToDebris();
-    }
-  }
-
-  bfc_sanityCheckASUSEDIDS(trackingunused, buildcon.getContigID());
-
-  // REMOVEME: paranoia check
-  for(auto crI=buildcon.getContigReads().begin();crI!=buildcon.getContigReads().end();++crI){
-    if(crI.getORPID() >= 0){
-      BUGIFTHROW(!AS_used_ids[crI.getORPID()],"Ooooops, read is in contig but not used? " << crI.getORPID() << " " << AS_readpool[crI.getORPID()].getName() << endl);
-    }
-  }
-}
-#define CEBUG(bla)
-
-
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-#define CEBUG(bla)   {cout << bla; cout.flush(); }
-void Assembly::bfc_cp_mapWithSolexa(Contig & buildcon, PPathfinder & qaf)
-{
-  FUNCSTART("void Assembly::bfc_cp_mapWithSolexa(Contig & buildcon, PPathfinder & qaf)");
-
-  assembly_parameters const & as_fixparams= AS_miraparams[0].getAssemblyParams();
-
-  bool hasotherst=false;
-  //AS_seqtypespresent[ReadGroupLib::SEQTYPE_SOLEXA]){
-  for(uint8 st=0; st<AS_seqtypespresent.size(); ++st){
-    if(st!=ReadGroupLib::SEQTYPE_SOLEXA && AS_seqtypespresent[st]) hasotherst=true;
-  }
-
-  if(AS_miraparams[0].getAlignParams().al_solexahack_maxerrors>0){
-    // -AL:shme is set ... do it the (hopefully better) long and painful way
-
-    buildcon.setSpecialSRAddConditions(AS_miraparams[0].getAlignParams().al_solexahack_maxerrors,-1,-1);
-    qaf.setAllowedSeqTypeForMapping(ReadGroupLib::SEQTYPE_SOLEXA);
-    for(uint32 coel=28; coel>=4; coel-=4){
-      cout << "Gogo: coel " << coel << endl;
-      qaf.setWantsCleanOverlapEnds(coel);
-      qaf.setMinTotalNonMatches(1);
-      qaf.map();
-      buildcon.updateBackboneConsensus();
-    }
-    qaf.setWantsCleanOverlapEnds(0);
-    qaf.setMinTotalNonMatches(0);
-
-    CEBUG("bfccp1" << endl);
-
-    cout << "Gogo: 100% mapping\n";
-    buildcon.setSpecialSRAddConditions(0,0,0);
-    qaf.map();
-    buildcon.coutAddReadTimings();
-
-    if(hasotherst){
-      cout << "Gogo: add others clean ends\n";
-      qaf.setAllowedSeqTypeForMapping(ReadGroupLib::SEQTYPE_END);
-      qaf.setWantsCleanOverlapEnds(16);
-      qaf.setMinTotalNonMatches(0);
-      // SRAddcondition is still 0,0,0 and cleanOverlap of 16 was also
-      //  already done for Solexas, so no new Solexa should get added here
-      qaf.map();
-    }
-
-    qaf.setAllowedSeqTypeForMapping(ReadGroupLib::SEQTYPE_SOLEXA);
-    qaf.setWantsCleanOverlapEnds(0);
-    qaf.setMinTotalNonMatches(0);
-    if(AS_miraparams[0].getAlignParams().al_solexahack_maxerrors>0 && qaf.getReadAddAttempts()>0) {
-      cout << "Gogo: mapping 1 mismatch\n";
-      if(as_fixparams.as_dateoutput) dateStamp(cout);
-      buildcon.setSpecialSRAddConditions(1,0,1);
-      qaf.map();
-      buildcon.coutAddReadTimings();
-      buildcon.updateBackboneConsensus();
-
-      cout << "Gogo: mapping 1 gap\n";
-      if(as_fixparams.as_dateoutput) dateStamp(cout);
-      buildcon.setSpecialSRAddConditions(1,-1,0);
-      qaf.map();
-      buildcon.coutAddReadTimings();
-      buildcon.updateBackboneConsensus();
-    }
-
-    if(AS_miraparams[0].getAlignParams().al_solexahack_maxerrors>1 && qaf.getReadAddAttempts()>0) {
-      cout << "Gogo: mapping 2 mismatches\n";
-      if(as_fixparams.as_dateoutput) dateStamp(cout);
-      buildcon.setSpecialSRAddConditions(2,0,2);
-      qaf.map();
-      buildcon.coutAddReadTimings();
-      buildcon.updateBackboneConsensus();
-
-      cout << "Gogo: mapping 1 gap, 1 mismatch\n";
-      if(as_fixparams.as_dateoutput) dateStamp(cout);
-      buildcon.setSpecialSRAddConditions(2,1,1);
-      qaf.map();
-      buildcon.coutAddReadTimings();
-      buildcon.updateBackboneConsensus();
-
-      cout << "Gogo: mapping 2 errors (==remaining 2 gaps (and maybe new mismatches))\n";
-      if(as_fixparams.as_dateoutput) dateStamp(cout);
-      buildcon.setSpecialSRAddConditions(2,2,2);
-      qaf.map();
-      buildcon.coutAddReadTimings();
-      buildcon.updateBackboneConsensus();
-    }
-
-    for(uint32 numerr=3; ; ){
-      if(qaf.getReadAddAttempts()==0) break;
-      cout << "Gogo: mapping all " << numerr << " errors\n";
-      if(as_fixparams.as_dateoutput) dateStamp(cout);
-      buildcon.setSpecialSRAddConditions(numerr,-1,-1);
-      qaf.map();
-      buildcon.coutAddReadTimings();
-      buildcon.updateBackboneConsensus();
-      if(numerr==AS_miraparams[0].getAlignParams().al_solexahack_maxerrors) break;
-      if(numerr<16){
-	++numerr;
-      }else if(numerr<32){
-	numerr+=2;
-      }else{
-	numerr+=4;
-      }
-      if(numerr>AS_miraparams[0].getAlignParams().al_solexahack_maxerrors) numerr=AS_miraparams[0].getAlignParams().al_solexahack_maxerrors;
-    }
-  }else{
-    // -AL:shme=0 means "quick mapping"
-    // we did not go through the long and painful process above but now
-    // have to force to map "whatever left" (which is all)
-    hasotherst=true;
-  }
-
-  if(hasotherst){
-    cout << "Gogo: mapping whatever left\n";
-    qaf.setAllowedSeqTypeForMapping(ReadGroupLib::SEQTYPE_END);
-    // just for good measure. Is default anyway of objects, but maybe things will change in the future
-    buildcon.setSpecialSRAddConditions(-1,-1,-1);  // no max error nowhere
-    qaf.setWantsCleanOverlapEnds(0);  // no clean end wanted
-    qaf.setMinTotalNonMatches(0);  // no min total matches
-
-    qaf.map();
-    buildcon.updateBackboneConsensus();
-  }
-
-}
-#define CEBUG(bla)
-
-
-
-/*************************************************************************
- *
- * Move clusters smaller than wished minimum number of reads per contig
- *  to debris
- * However, not rails and not backbones!
- *
- * returns number of reads pushed to debris
- *
- *************************************************************************/
-
- //#define CEBUG(bla)   {cout << bla; cout.flush(); }
-uint32 Assembly::bfc_moveSmallClustersToDebris()
-{
-
-  cout << "Moving small clusters to debris:\n";
-
-  uint32 totaldebris=0;
-
-  vector<uint32> numreadsperst(ReadGroupLib::getNumSequencingTypes(),0);
-  vector<int32> clusteridperread;
-  vector<list<int32> > readinclusterlist;
-
-  clusterUnassembledReads(clusteridperread,readinclusterlist, AS_used_ids);
-
-  uint32 clustercount=0;
-
-  for(size_t ricli=0; ricli<readinclusterlist.size(); ricli++){
-    if(!readinclusterlist[ricli].empty()){
-      uint32 totalreadsincluster=0;
-      numreadsperst.clear();
-      numreadsperst.resize(ReadGroupLib::getNumSequencingTypes(),0);
-      {
-	list<int32>::const_iterator rI=readinclusterlist[ricli].begin();
-	for(; rI != readinclusterlist[ricli].end(); ++rI) {
-	  numreadsperst[AS_readpool[*rI].getSequencingType()]++;
-	  totalreadsincluster++;
-	}
-      }
-      bool takecluster=false;
-      for(size_t st=0; st<numreadsperst.size(); ++st){
-	if(numreadsperst[st]>0
-	   && totalreadsincluster>=AS_miraparams[st].getAssemblyParams().as_minimum_readspercontig){
-	  takecluster=true;
-	}
-      }
-      // the above also kill mapping reads
-      // therefore, first check whether an unsued rail is part of that cluster
-      //  if yes, then don't kill cluster
-      if(!takecluster){
-	list<int32>::const_iterator rI=readinclusterlist[ricli].begin();
-	for(; rI != readinclusterlist[ricli].end(); ++rI) {
-	  if(AS_readpool[*rI].isRail()
-	     || AS_readpool[*rI].isBackbone()){
-
-	    // should have this ... need to rework how as_usedids is filled (only after contig is made)
-	    //&& !AS_used_ids[*rI]){
-
-	    takecluster=false;
-	    break;
-	  }
-	}
-      }
-      if(!takecluster){
-	CEBUG("Killing cluster: " << ricli);
-	list<int32>::const_iterator rI=readinclusterlist[ricli].begin();
-	for(; rI != readinclusterlist[ricli].end(); ++rI) {
-	  CEBUG(" " << *rI << AS_readpool[*rI].getName());
-	  AS_isdebris[*rI]=DEBRIS_TINYCLUSTER;
-	  AS_used_ids[*rI]=1;
-	  ++totaldebris;
-	}
-	CEBUG('\n');
-      }
-    }
-  }
-
-  // clusterUnassembledReads() did not return orphans as cluster list
-  // therefore, look for unused read ids with no cluster number and also
-  //  put them into debris
-
-  for(size_t uid=0; uid<AS_used_ids.size(); ++uid){
-    if(AS_used_ids[uid]==0 && clusteridperread[uid]==-1
-       && !AS_readpool[uid].isRail()
-       && !AS_readpool[uid].isBackbone()){
-      CEBUG("Killing orphan: " << uid << endl);
-      AS_isdebris[uid]=DEBRIS_TINYCLUSTERORPHAN;
-      AS_used_ids[uid]=1;
-      ++totaldebris;
-    }
-  }
-
-  cout << "\nDone. " << totaldebris << " reads moved to debris.\n";
-
-  return totaldebris;
-}
-//#define CEBUG(bla)
-
-
-
-/*************************************************************************
- *
- * Checks if Contig meets specified requirements (atm: num of reads)
- *
- * If not, mark the reads in the contig as debris and empty the contig
- *
- *************************************************************************/
-
-bool Assembly::bfc_checkIfContigMeetsRequirements(Contig & con)
-{
-  FUNCSTART("bool Assembly::bfc_checkIfContigMeetsRequirements(Contig & con)");
-
-  bool contigok=false;
-
-  vector<uint32> numreadsperst(ReadGroupLib::getNumSequencingTypes(),0);
-  uint32 totalreadsincon=0;
-
-  auto crI=con.getContigReads().begin();
-  for(; crI!=con.getContigReads().end(); ++crI){
-    if(crI.getORPID() >= 0){
-      if(crI->isBackbone()){
-	contigok=true;
-	break;
-      }
-      ++numreadsperst[crI->getSequencingType()];
-      ++totalreadsincon;
-    }
-  }
-
-  if(!contigok){
-    for(size_t st=0; st<numreadsperst.size(); ++st){
-      if(numreadsperst[st]>0
-	 && totalreadsincon>=AS_miraparams[st].getAssemblyParams().as_minimum_readspercontig){
-	contigok=true;
-      }
-    }
-  }
-
-  return contigok;
-}
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-void Assembly::bfc_markRepReads(Contig & con)
-{
-  multitag_t tagtstR;
-  tagtstR.setIdentifierStr("tstR");
-  tagtstR.source=multitag_t::MT_tagsrcentry_idMIRA;
-
-  auto & conreads=con.getContigReads();
-  auto crI = conreads.begin();
-
-  for(;crI != conreads.end(); crI++){
-    if(crI.getORPID() >= 0
-       && AS_multicopies[crI.getORPID()]) {
-      cout << "xxxxxxxxxxxx mark " << crI.getORPID() << endl;
-      Read & nonconstread = const_cast<Read &>(*crI);
-      int32 rc=nonconstread.getRightClipoff()-1;
-      if(rc<nonconstread.getLeftClipoff()) rc=nonconstread.getLeftClipoff();
-      tagtstR.from=nonconstread.getLeftClipoff();
-      tagtstR.to=rc;
-      nonconstread.addTagO(tagtstR);
-    }
-  }
-}
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-void Assembly::priv_tmpcheckroutine(Contig & buildcon)
-{
-  uint32 index=1;
-  cout << "ptcr AS_used_ids[" << index << "]=" << static_cast<uint16>(AS_used_ids[index]) << endl;
-  auto & cr=buildcon.getContigReads();
-  bool foundidx=false;
-  for(auto pcrI=cr.begin(); pcrI!=cr.end(); ++pcrI){
-    if(pcrI.getORPID()==index) {
-      foundidx=true;
-      break;
-    }
-  }
-  cout << "Found idx: " << foundidx << endl;
-}
-
-/*************************************************************************
- *
- * return true if trimmed due to misassembly
- *
- *************************************************************************/
-
-bool Assembly::bfc_trimDenovoIfNecessary(Contig & buildcon, bool foundSRMs, const string & basename_forextsave, uint32 & trackingunused)
-{
-  FUNCSTART("bool Assembly::bfc_trimDenovoIfNecessary(Contig & buildcon, bool foundSRMs, uint32 & trackingunused)");
-
-  bool trimmedmisassembly=false;
-
-  // if we have not been mapping:
-  //  1) get misassembled parts out by looking at SRMc tags and trimming back to best range
-  //  2) for genome assemblies with pairs: pair analysis and break contig at misassembled sites
-  //  3) for genome assemblies: coverage analysis and remove reads in overcovered areas
-  if(buildcon.getNumBackbones()==0){
-
-    //priv_tmpcheckroutine(buildcon);
-    if(foundSRMs){
-      auto range=buildcon.findBestNonMisassembledRange();
-      if(range.first>=0){
-	cout<<"Found misassembly by repeat marker. Best range: " << range.first << ".." << range.second << '\t' << range.second-range.first << endl;
-	trimmedmisassembly=true;
-	auto & cr=buildcon.getContigReads();
-	for(auto pcrI=cr.begin(); pcrI!=cr.end(); ++pcrI){
-	  if(pcrI.getORPID()>=0){
-	    BUGIFTHROW(!AS_used_ids[pcrI.getORPID()],"srm ! AS_used_ids[...] ???");
-	    AS_used_ids[pcrI.getORPID()]=0;
-	  }
-	}
-
-	saveExtTmpContig(buildcon,(basename_forextsave+"_pretrimsrm"));
-
-	cout << "Old trackingunused: " << trackingunused<< endl;
-	trackingunused+=cr.size();
-	cout << "Intermediate trackingunused: " << trackingunused<< endl;
-
-	buildcon.trimContigToRange(range.first,range.second);
-
-	// rewrite the AS_used_ids with the shortened
-	for(auto pcrI=cr.begin(); pcrI!=cr.end(); ++pcrI){
-	  if(pcrI.getORPID()>=0){
-	    AS_used_ids[pcrI.getORPID()]=1;
-	    --trackingunused;
-	  }
-	}
-	cout << "New trackingunused: " << trackingunused<< endl;
-
-	saveExtTmpContig(buildcon,(basename_forextsave+"_posttrimsrm"));
-      }
-    }
-
-    //priv_tmpcheckroutine(buildcon);
-
-    // pair consistency analysis and contig breaking for genome assemblies, denovo
-    if(AS_miraparams[0].getPathfinderParams().paf_use_genomic_algorithms
-       && AS_miraparams[0].getSpecialParams().mi_extra_flag3
-       && (!AS_hasbackbones || AS_miraparams[0].getAssemblyParams().as_backbone_alsobuildnewcontigs)){
-      auto range=buildcon.findBestPairConsistencyRange();
-      if(range.first>0 || range.second < buildcon.getContigLength()){
-	cout<<"Found misassembly by pair consistency. Best range: " << range.first << ".." << range.second << '\t' << range.second-range.first << endl;
-	trimmedmisassembly=true;
-	auto & cr=buildcon.getContigReads();
-	for(auto pcrI=cr.begin(); pcrI!=cr.end(); ++pcrI){
-	  if(pcrI.getORPID()>=0){
-	    BUGIFTHROW(!AS_used_ids[pcrI.getORPID()],"pair consistency ! AS_used_ids[...] ???");
-	    AS_used_ids[pcrI.getORPID()]=0;
-	  }
-	}
-
-	saveExtTmpContig(buildcon,(basename_forextsave+"_pretrimpair"));
-
-	cout << "Old trackingunused: " << trackingunused<< endl;
-	trackingunused+=cr.size();
-	cout << "Intermediate trackingunused: " << trackingunused<< endl;
-
-	buildcon.trimContigToRange(range.first,range.second);
-
-	// rewrite the AS_used_ids with the shortened
-	for(auto pcrI=cr.begin(); pcrI!=cr.end(); ++pcrI){
-	  if(pcrI.getORPID()>=0){
-	    AS_used_ids[pcrI.getORPID()]=1;
-	    --trackingunused;
-	  }
-	}
-	cout << "New trackingunused: " << trackingunused<< endl;
-
-	saveExtTmpContig(buildcon,(basename_forextsave+"_posttrimpair"));
-      }
-    }
-
-    // priv_tmpcheckroutine(buildcon);
-
-    // coverage analysis and coverage reduction for genome assemblies, denovo
-    // note:
-    // has a bug for data which was digitally normalised ...
-    //  ... and besides, does absolutely not make sense to do this on
-    //  digitally normalised data. Therefore, not done if diginorm active.
-    if(AS_miraparams[0].getPathfinderParams().paf_use_genomic_algorithms
-       && AS_miraparams[0].getSpecialParams().mi_extra_flag2
-       && !AS_miraparams[0].getHashStatisticsParams().hs_apply_digitalnormalisation
-       && (!AS_hasbackbones || AS_miraparams[0].getAssemblyParams().as_backbone_alsobuildnewcontigs)){
-      saveExtTmpContig(buildcon,(basename_forextsave+"_prered"));
-
-      Contig::ccctype_t avgcovused=AS_coveragetotal;  // may be 0
-      coverageinfo_t cinfo;
-      vector<uint64> covvals;
-      buildcon.collectCoverage(covvals);
-      buildcon.calcStatsOnContainer(cinfo,covvals);
-      cout << "1st covnum: " << cinfo << endl;
-
-      // TODO: perhaps make this dependend of ratio mean vs stddev ?
-      buildcon.calcSecondOrderStatsOnContainer(cinfo,covvals);
-      cout << "2nd covnum: " << cinfo << endl;
-      if(cinfo.median>2*avgcovused) avgcovused=cinfo.median;
-      cout << "Using: " << avgcovused << endl;
-
-      vector<uint8> peakindicator;
-      buildcon.findPeaks(avgcovused,peakindicator);
-      unordered_set<readid_t> readsremoved;
-      buildcon.reduceReadsAtCoveragePeaks(avgcovused,peakindicator,readsremoved);
-      cout << "Coverageremove: " << readsremoved.size() << endl;
-
-      // if reads were removed, get the tracking corrected
-      if(!readsremoved.empty()){
-	for(auto & rid : readsremoved){
-	  BUGIFTHROW(!AS_used_ids[rid],"rere ! AS_used_ids[rid] ???");
-	  AS_used_ids[rid]=0;
-	}
-	cout << "Old trackingunused: " << trackingunused<< endl;
-	trackingunused+=readsremoved.size();
-	cout << "Intermediate trackingunused: " << trackingunused<< endl;
-
-	saveExtTmpContig(buildcon,(basename_forextsave+"_postred"));
-      }
-    }
-    //priv_tmpcheckroutine(buildcon);
-  }
-
-  return trimmedmisassembly;
-}
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush(); }
-
-void Assembly::bfc_savePersistentSmallOverlaps(Contig & thiscon, const int32 passnr, ostream & fout)
-{
-  FUNCSTART("void Assembly::bfc_savePersistentSmallOverlaps(Contig & thiscon, const int32 passnr, ostream & fout)");
-
-  CEBUG("bfc_savePersistentSmallOverlaps\n");
-
-  // we'll save all overlaps between min and max
-  auto minbph=priv_calcBasesPerHashOnPass(passnr);
-  auto maxbph=priv_calcBasesPerHashOnPass(passnr+1);
-
-  CEBUG("min " << minbph << " max " << maxbph << endl);
-
-  if(minbph==maxbph) return;
-
-  CEBUG("Needs persistent SO consideration. min " << minbph << " max " << maxbph << "\n");
-  newedges_t tmpedge;
-
-  auto pcrE=thiscon.getContigReads().end();
-  for(auto pcrI=thiscon.getContigReads().begin(); pcrI!=pcrE; ++pcrI){
-    auto orpid=pcrI.getOriginalReadPoolID();
-    CEBUG("VVV orpid " << orpid << endl);
-    tmpedge.rid1=orpid;
-    auto runI=lower_bound(AS_confirmed_edges.begin(),
-			  AS_confirmed_edges.end(),
-			  tmpedge,
-			  newedges_t::sortComparatorByRIDUp);
-
-    // rare, but may happen: singlets with no overlaps
-    // user may have asked to include them, but they did not have any overlaps
-    // so, need to account for this.
-    if(runI==AS_confirmed_edges.end()
-       || runI->rid1 > orpid) continue;
-
-    if(runI->rid1!=orpid){
-      cout << "\n\nGaaaaaahhhhhhhh!\n"
-	   << "runI->rid1 " << runI->rid1 << " != orpid " << orpid << endl;
-      cout << "confedges.size() " << AS_confirmed_edges.size() << endl;
-      cout << "runI dist: " << runI-AS_confirmed_edges.begin() << endl;
-      cout << "runI -1 ->rid1: " << (runI-1)->rid1 << endl;
-      BUGIFTHROW(runI->rid1!=orpid,"runI->rid1!=orpid ... really???");
-    }
-
-    for(;runI!=AS_confirmed_edges.end() && runI->rid1==orpid; ++runI){
-      // save each pair of read-links only once, leave out the other half
-      // (it's duplicated again in Assembly::loadAlignmentsFromFile())
-      CEBUG("VVV " << AS_adsfacts[runI->adsfindex] << "VVV minmax " << minbph << " " << maxbph << "\n");
-      if(runI->rid1 <= runI->linked_with){
-	CEBUG("VVV consider\n");
-	auto & actadsf = AS_adsfacts[runI->adsfindex];
-	CEBUG(*runI << "\tovl: " << actadsf.getOverlapLen() << endl);
-	if(actadsf.getOverlapLen() >= minbph
-	   && actadsf.getOverlapLen() < maxbph
-	  ){
-	  CEBUG("VVV save\n");
-	  fout << runI->best_weight
-	       << '\t' << runI->direction
-	       << '\t' << runI->ol_stronggood
-	       << '\t' << runI->ol_weakgood
-	       << '\t' << runI->ol_belowavgfreq
-	       << '\t' << runI->ol_norept
-	       << '\t' << runI->ol_rept
-	       << '\t';
-	  actadsf.serialiseOut(fout);
-	  fout << '\n';
-	}
-      }
-    }
-  }
-
-  fout.flush();
-}
-//#define CEBUG(bla)
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-void Assembly::bfc_storeContig(Contig & con, uint32 & numcontigs, const bool mustmarkrepeats, const int32 passnr, const bool lastpass)
-{
-  FUNCSTART("void Assembly::bfc_storeContig(Contig & con, uint32 & numcontigs, const bool mustmarkrepeats, const int32 passnr, const bool lastpass)");
-
-  assembly_parameters const & as_fixparams= AS_miraparams[0].getAssemblyParams();
-  auto & conreads=con.getContigReads();
-
-  // look whether we store singlets in contig or not
-
-  bool storecontig=true;
-
-  if(con.getNumReadsInContig()==1){
-    const assembly_parameters & as_rt_params = AS_miraparams[conreads.begin()->getSequencingType()].getAssemblyParams();
-
-    storecontig=as_rt_params.as_savesimplesingletsinproject;
-    if(conreads.begin()->hasTag(Read::REA_tagentry_idSRMr)
-       || conreads.begin()->hasTag(Read::REA_tagentry_idCRMr)
-       || conreads.begin()->hasTag(Read::REA_tagentry_idWRMr)
-       || conreads.begin()->hasTag(Read::REA_tagentry_idSROr)
-       || conreads.begin()->hasTag(Read::REA_tagentry_idSAOr)
-       || conreads.begin()->hasTag(Read::REA_tagentry_idSIOr)) {
-      if(conreads.begin().getORPID() >= 0) AS_needalloverlaps[conreads.begin().getORPID()]=true;
-      storecontig|=as_fixparams.as_savetaggedsingletsinproject;
-     }
-  }
-
-  if(as_fixparams.as_backbone_trimoverhangingreads){
-    con.trimMapOverhang();
-  }
-
-  // store contig names only for de-novo genome assemblies
-  // used for listing large contigs at end of assembly
-  string cnameforstore;
-  if(!as_fixparams.as_assemblyjob_mapping
-     && AS_miraparams[0].getPathfinderParams().paf_use_genomic_algorithms){
-    cnameforstore=con.getContigName();
-  }
-
-  // TODO: U13 hat 0 werte im ASCII?
-  //Contig::setCoutType(Contig::AS_DEBUG);
-  //cout << "Debug in bfc_storeContig()\n" << con;
-
-  if(storecontig){
-    if(as_fixparams.as_mark_repeats&&mustmarkrepeats){
-      vector<bool> dummy;
-      Contig::repeatmarker_stats_t contigrepstats;
-      markRepeats(con, dummy,contigrepstats);
-      AS_bfcstats[con.getLongRepeatStatus()].numnewsrm+=contigrepstats.numSRMs;
-    }
-
-    //bfc_markRepReads(con);
-
-    cout << "Storing contig ... "; cout.flush();
-    cout << as_fixparams.as_mark_repeats << mustmarkrepeats;
-    if(AS_hasbackbones){
-      con.removeRails();
-
-      // TODO: ask contig whether it has mappings
-      //if(as_fixparams.as_loadSOLEXA || as_fixparams.as_loadSOLID){
-      if(AS_seqtypespresent[ReadGroupLib::SEQTYPE_SOLEXA]
-	 || AS_seqtypespresent[ReadGroupLib::SEQTYPE_ABISOLID]) {
-	cout << "Transforming CER mappings." << endl;
-	con.transformCERMappingsToCoverageReads();
-	cout << "done transforming CER mappings." << endl;
-	//assout::saveAsMAF(con, getMAFFilename()+".bla", AS_deleteoldresultfiles);
-      }
-    }
-
-    con.markFeaturesByConsensus(true, true, true);
-    // transfer important tags to readpool
-    transferContigReadTagsToReadpool(con,AS_bbcontigs.end());
-
-    con.updateStatsFromConsensusTags(true,true,true,true,true);
-
-    // remove HAF tags if not wished
-    if(!as_fixparams.as_buntify_reads){
-      for(auto & pcre : con.getContigReads()){
-	for(uint32 i=0; i<Read::REA_allhaftags.size(); ++i){
-	  const_cast<Read &>(pcre).deleteTag(Read::REA_allhaftags[i]);    // we know what we do ... *cough*
-	}
-      }
-    }
-
-    // store the contig information
-    AS_assemblyinfo.storeContigStats(con.getStats(),cnameforstore);
-
-
-    if(lastpass) {
-      assout::saveStatistics(con,
-			     getStatisticsFilename(),
-			     AS_deleteoldresultfiles);
-      assout::saveReadTagList(con,
-			      getReadTagListFilename(),
-			      AS_deleteoldresultfiles);
-      assout::saveConsensusTagList(con,
-				   getConsensusTagListFilename(),
-				   AS_deleteoldresultfiles);
-      assout::saveContigReadList(con,
-				 getContigReadListFilename(),
-				 AS_deleteoldresultfiles);
-      if(as_fixparams.as_output_gff3){
-	// store sequence for later
-//	  AS_gff3defer_names.push_back(con.getContigName());
-//TODO: weiterhier
-//	  assout::saveTagsAsGFF3(con, getGFF3Filename(), AS_deleteoldresultfiles);
-      }
-      if(as_fixparams.as_output_caf){
-	cout << "Saving CAF ... "; cout.flush();
-	assout::saveAsCAF(con, getCAFFilename(), AS_deleteoldresultfiles);
-	cout << "done.\n";
-      }
-      if(as_fixparams.as_output_maf){
-	cout << "Saving MAF ... "; cout.flush();
-	assout::saveAsMAF(con, getMAFFilename(), AS_deleteoldresultfiles);
-	cout << "done.\n";
-      }
-      if(as_fixparams.as_output_gap4da){
-	cout << "Saving gap4 direct assembly ... "; cout.flush();
-	assout::saveAsGAP4DA(con,getGAP4DAFilename(),AS_deleteoldresultfiles);
-	cout << "done.\n";
-      }
-      if(as_fixparams.as_output_fasta) {
-	if(ReadGroupLib::getNumOfStrains()>1){
-	  cout << "Saving strains as FASTA ... "; cout.flush();
-	  assout::saveStrainsAsFASTAQ(con, AS_readpool,
-				      buildDefaultResultsFileName(
-					-1,"","", "",
-					AS_miraparams[0].getAssemblyParams().as_outfile_FASTA,
-					""),
-				      false,
-				      0,0,
-				      AS_deleteoldresultfiles,false);
-	}else{
-	  cout << "Saving FASTA ... "; cout.flush();
-	  assout::saveAsFASTA(con,
-			      getFASTAFilename(),
-			      getFASTAPaddedFilename(),
-			      AS_deleteoldresultfiles);
-	}
-	cout << "done.\n";
-
-      }
-      if(as_fixparams.as_output_tcs) {
-	cout << "Saving TCS ... "; cout.flush();
-	assout::saveAsTCS(con, getTCSFilename(),AS_deleteoldresultfiles);
-	cout << "done.\n";
-      }
-      if(as_fixparams.as_output_wiggle) {
-	cout << "Saving Wiggle ... "; cout.flush();
-	assout::saveAsWiggle(con, getWiggleFilename(),AS_deleteoldresultfiles, false);
-	cout << "done.\n";
-      }
-      // TODO: enable these functions for incremental write
-      //saveSNPAnalysis();
-      //saveFeatureAnalysis();
-      if(as_fixparams.as_output_txt){
-	cout << "Saving text ... "; cout.flush();
-	assout::saveAsTXT(con,getTXTFilename(),AS_deleteoldresultfiles);
-	cout << "done.\n";
-      }
-      if(as_fixparams.as_output_ace){
-	cout << "Saving ACE ... "; cout.flush();
-	assout::saveAsACE(con,getACEFilename(),AS_deleteoldresultfiles);
-	cout << "done.\n";
-      }
-      if(as_fixparams.as_output_html) {
-	cout << "Saving HTML ... "; cout.flush();
-	assout::dumpContigAsHTML(con,
-				 getHTMLFilename(),
-				 AS_deleteoldresultfiles,
-				 AS_miraparams[0].getAssemblyParams().as_projectname_out);
-	cout << "done.\n";
-      }
-    }else{
-      assout::saveStatistics(con,
-			     getStatisticsFilename(passnr, "", "_pass"),
-			     AS_deleteoldresultfiles);
-      assout::saveReadTagList(con,
-			      getReadTagListFilename(passnr),
-			      AS_deleteoldresultfiles);
-      assout::saveConsensusTagList(con,getConsensusTagListFilename(passnr),
-				   AS_deleteoldresultfiles);
-      assout::saveContigReadList(con,
-				 getContigReadListFilename(passnr, "", "_pass"),
-				 AS_deleteoldresultfiles);
-
-      if(as_fixparams.as_output_tmp_caf) {
-	cout << "Saving temp CAF ... "; cout.flush();
-	assout::saveAsCAF(con,
-			  getCAFFilename(passnr, "", "_pass"),
-			  AS_deleteoldresultfiles);
-	cout << "done.\n";
-      }
-      if(as_fixparams.as_output_tmp_maf) {
-	cout << "Saving temp MAF ... "; cout.flush();
-	assout::saveAsMAF(con,
-			  getMAFFilename(passnr, "", "_pass"),
-			  AS_deleteoldresultfiles);
-	cout << "done.\n";
-      }
-      if(as_fixparams.as_output_tmp_gap4da) {
-	cout << "Saving temp gap4 direct assembly ... "; cout.flush();
-	assout::saveAsGAP4DA(con,
-			     getGAP4DAFilename(passnr, "", "_pass"),
-			     AS_deleteoldresultfiles);
-	cout << "done.\n";
-      }
-      if(as_fixparams.as_output_tmp_fasta){
-	cout << "Saving temp FASTA ... "; cout.flush();
-	assout::saveAsFASTA(con,
-			    getFASTAFilename(passnr, "", "_pass"),
-			    getFASTAPaddedFilename(passnr, "", "_pass"),
-			    AS_deleteoldresultfiles);
-	cout << "done.\n";
-      }
-      if(as_fixparams.as_output_tmp_txt){
-	cout << "Saving temp text ... "; cout.flush();
-	assout::saveAsTXT(con,
-			  getTXTFilename(passnr, "", "_pass"),
-			  AS_deleteoldresultfiles);
-	cout << "done.\n";
-      }
-      if(as_fixparams.as_output_tmp_ace) {
-	cout << "Saving temp ACE ... "; cout.flush();
-	assout::saveAsACE(con,
-			  getACEFilename(passnr, "", "_pass"),
-			  AS_deleteoldresultfiles);
-	cout << "done.\n";
-      }
-      if(as_fixparams.as_output_tmp_tcs) {
-	cout << "Saving temp TCS ... "; cout.flush();
-	assout::saveAsTCS(con,
-			  getTCSFilename(passnr, "", "_pass"),
-			  AS_deleteoldresultfiles);
-	cout << "done.\n";
-      }
-      //if(as_fixparams.as_output_tmp_html) saveAsHTML(passnr, "", "_pass");
-      if(as_fixparams.as_output_tmp_html) {
-	cout << "Saving temp HTML ... "; cout.flush();
-	assout::dumpContigAsHTML(con,
-				 getHTMLFilename(passnr, "", "_pass"),
-				 AS_deleteoldresultfiles,
-				 AS_miraparams[0].getAssemblyParams().as_projectname_out);
-	cout << "done.\n";
-      }
-    }
-    cout << "done." << endl;
-  }else{
-    // store the contig information
-    AS_assemblyinfo.storeContigStats(con.getStats(),cnameforstore);
-
-    if(conreads.begin().getORPID() >= 0) AS_isdebris[conreads.begin().getORPID()]=DEBRIS_UNSAVEDSINGLET;
-    numcontigs--;
-  }
-
-  AS_deleteoldresultfiles=false;
-
-  return;
-}
-
-
diff --git a/src/mira/assembly_info.C b/src/mira/assembly_info.C
index 1048270..d942fca 100644
--- a/src/mira/assembly_info.C
+++ b/src/mira/assembly_info.C
@@ -9,27 +9,34 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
+// 	$Id$	
 
-#include "version.H"
+#ifndef lint
+static char vcid[] = "$Id$";
+#endif /* lint */
 
 #include "mira/assembly_info.H"
 #include "errorhandling/errorhandling.H"
 
 
-using namespace std;
+
+void AssemblyInfo::foolCompiler()
+{
+#include "stdinc/foolcompiler.C"
+}
 
 // Plain vanilla constructor
 AssemblyInfo::AssemblyInfo()
@@ -40,9 +47,8 @@ AssemblyInfo::AssemblyInfo()
 
   ASI_conf_large_mincontigsize=0;
   ASI_conf_large_consize4stats=5000;
-  ASI_conf_large_totalcov4stats=0;
   ASI_conf_large_mintotalcov=0;
-  ASI_conf_large_minavgcov_perst.resize(ReadGroupLib::SEQTYPE_END,0);
+  ASI_conf_large_minavgcov_perst.resize(Read::SEQTYPE_END,0);
 
   FUNCEND();
 }
@@ -110,8 +116,6 @@ ostream & operator<<(ostream &ostr, AssemblyInfo & asi)
 void AssemblyInfo::zeroInfo()
 {
   ASI_contigstats.clear();
-  ASI_nameslargecontigs.clear();
-  ASI_contignames.clear();
 
   zeroStats();
 }
@@ -120,13 +124,13 @@ void AssemblyInfo::zeroStats()
 {
   ASI_numreads_total=0;
   ASI_numbases_total=0;
-
+  
   ASI_numreads_assembled=0;
   ASI_numbases_assembled=0;
-
+  
   ASI_numreads_singlets=0;
   ASI_numbases_singlets=0;
-
+  
   for(uint32 i=0; i<2; i++){
     ASI_numcontigs[i]=0;
     ASI_sizeconsensus[i]=0;
@@ -136,14 +140,12 @@ void AssemblyInfo::zeroStats()
     ASI_numSNPs[i]=0;
     ASI_numSTMS[i]=0;
     ASI_numSTMU[i]=0;
-
+    
     ASI_maxcoverage[i]=0;
-    ASI_maxcoverage_perst[i].clear();
-    ASI_maxcoverage_perst[i].resize(ReadGroupLib::SEQTYPE_END,0);
+    ASI_maxcoverage_perst[i].resize(Read::SEQTYPE_END,0);
     ASI_avgcoverage[i]=0;
-    ASI_avgcoverage_perst[i].clear();
-    ASI_avgcoverage_perst[i].resize(ReadGroupLib::SEQTYPE_END,0);
-
+    ASI_avgcoverage_perst[i].resize(Read::SEQTYPE_END,0);
+    
     ASI_largestconsize[i]=0;
     ASI_n50consize[i]=0;
     ASI_n90consize[i]=0;
@@ -158,21 +160,18 @@ void AssemblyInfo::zeroStats()
 }
 
 
-void AssemblyInfo::storeContigStats(const Contig::constats_t & cs, const string & cname)
+void AssemblyInfo::storeContigStats(const Contig::constats_t & cs)
 {
   ASI_contigstats.push_back(cs);
-  if(!cname.empty()){
-    ASI_contignames.push_back(cname);
-  }
 }
 
 void AssemblyInfo::setLargeContigCovPerST(uint32 cov, uint8 seqtype)
 {
   FUNCSTART("void AssemblyInfo::setLargeContigCovPerST(uint32 cov, uint8 seqtype)");
 
-  BUGIFTHROW(seqtype>=ReadGroupLib::SEQTYPE_END, "Illegal sequence type?");
+  BUGIFTHROW(seqtype>=Read::SEQTYPE_END, "Illegal sequence type?");
 
-  ASI_conf_large_minavgcov_perst.resize(ReadGroupLib::SEQTYPE_END);
+  ASI_conf_large_minavgcov_perst.resize(Read::SEQTYPE_END);
   ASI_conf_large_minavgcov_perst[seqtype]=cov;
 
   FUNCEND();
@@ -187,21 +186,15 @@ void AssemblyInfo::calcCurrentInfo()
 
   vector<double> avgtotalcov[2];
   vector<vector<vector<double> > > avgcovperst(2);
-  avgcovperst[0].resize(ReadGroupLib::SEQTYPE_END);
-  avgcovperst[1].resize(ReadGroupLib::SEQTYPE_END);
+  avgcovperst[0].resize(Read::SEQTYPE_END);
+  avgcovperst[1].resize(Read::SEQTYPE_END);
 
   vector<uint32> consizes[2];
   vector<uint32> conquals[2];
 
-  ASI_nameslargecontigs.clear();
-  auto cnI=ASI_contignames.cend();
-  if(ASI_contignames.size()==ASI_contigstats.size()){
-    cnI=ASI_contignames.cbegin();
-  }
-
-  auto csI=ASI_contigstats.begin();
-  for(; csI != ASI_contigstats.end(); ++csI){
-    // 0 == all contigs, 1 == large contigs: when minsize and cov have been reached
+  list<Contig::constats_t>::const_iterator csI=ASI_contigstats.begin();
+  for(; csI != ASI_contigstats.end(); csI++){
+    // 0 == all contigs, 1 == when minsize and cov have been reached
     uint32 coninfooffset=0;
     if(csI->conlength_nogap >= ASI_conf_large_mincontigsize){
       bool avgcovfound=false;
@@ -209,7 +202,7 @@ void AssemblyInfo::calcCurrentInfo()
 	 && csI->avg_coverage >= ASI_conf_large_mintotalcov){
 	avgcovfound=true;
       }else{
-	for(uint32 st=0; st<ReadGroupLib::SEQTYPE_END; st++){
+	for(uint32 st=0; st<Read::SEQTYPE_END; st++){
 	  if(ASI_conf_large_minavgcov_perst[st]>0
 	     && csI->avg_covperst[st] >= ASI_conf_large_minavgcov_perst[st]){
 	    avgcovfound=true;
@@ -219,48 +212,13 @@ void AssemblyInfo::calcCurrentInfo()
       }
       if(avgcovfound) coninfooffset=1;
     }
-
-    // for bacteria in growth phase / projects with very uneven coverage across genome,
-    //  the above may fail (contigs with several kb below 50% of avg. coverage)
-    // try a rescue strategy:
-    // - non-rep contigs with twice the needed min size and with 2/3 of needed coverage are also taken
-    // TODO: this could probably be merged with loop above, but kept apart atm in case logic needs to change
-    if(coninfooffset==0                     // not taken yet
-       && !csI->contains_long_repeats_only  // non reps
-       && csI->conlength_nogap >= 2*ASI_conf_large_mincontigsize){   // 2x min length large contigs
-      bool avgcovfound=false;
-      if(ASI_conf_large_mintotalcov>0
-	 && csI->avg_coverage>= ASI_conf_large_mintotalcov*(static_cast<double>(2.0)/3)){
-	avgcovfound=true;
-      }else{
-	for(uint32 st=0; st<ReadGroupLib::SEQTYPE_END; st++){
-	  if(ASI_conf_large_minavgcov_perst[st]>0
-	     && csI->avg_covperst[st] >= ASI_conf_large_minavgcov_perst[st]*(static_cast<double>(2.0)/3)){
-	    avgcovfound=true;
-	    break;
-	  }
-	}
-      }
-      if(avgcovfound) coninfooffset=1;
-    }
-
-    if(coninfooffset && cnI!=ASI_contignames.end()){
-      ASI_nameslargecontigs.push_back(*cnI);
-      csI->islargecontig=1;
-    }else{
-      csI->islargecontig=-1;
-    }
-
-    if(cnI!=ASI_contignames.end()){
-      ++cnI;
-    }
-
+    
     ASI_numreads_assembled+=csI->total_reads;
     //ASI_numbases_assembled+=...
 
     // store stats for all contigs and also for large contigs
     //  in second loop if we have a large contig
-    for(uint32 i=0; i<=coninfooffset; ++i){
+    for(uint32 i=0; i<=coninfooffset; i++){
       consizes[i].push_back(csI->conlength_nogap);
       conquals[i].push_back(csI->avg_conqual);
 
@@ -284,14 +242,14 @@ void AssemblyInfo::calcCurrentInfo()
       ASI_sizeconsensus[i]+=csI->conlength_nogap;
       ASI_largestconsize[i]=max(ASI_largestconsize[i],csI->conlength_nogap);
       ASI_maxcoverage[i]=max(ASI_maxcoverage[i],csI->max_coverage);
-      if(csI->conlength_nogap>=ASI_conf_large_consize4stats && csI->avg_coverage>= ASI_conf_large_totalcov4stats) {
+      if(csI->conlength_nogap>=ASI_conf_large_consize4stats) {
 	avgtotalcov[i].push_back(csI->avg_coverage);
       }
-      for(uint32 st=0; st<ReadGroupLib::SEQTYPE_END; st++){
+      for(uint32 st=0; st<Read::SEQTYPE_END; st++){
 	ASI_maxcoverage_perst[i][st]=max(
 	  ASI_maxcoverage_perst[i][st],csI->max_covperst[st]
 	  );
-	if(csI->conlength_nogap>=ASI_conf_large_consize4stats && csI->avg_coverage>= ASI_conf_large_totalcov4stats) {
+	if(csI->conlength_nogap>=ASI_conf_large_consize4stats) {
 	  avgcovperst[i][st].push_back(csI->avg_covperst[st]);
 	}
       }
@@ -299,7 +257,7 @@ void AssemblyInfo::calcCurrentInfo()
   }
 
   for(uint32 i=0; i<2; i++){
-    for(uint32 st=0; st<ReadGroupLib::SEQTYPE_END; st++){
+    for(uint32 st=0; st<Read::SEQTYPE_END; st++){
       if(avgcovperst[i].size()){
 	sort(avgcovperst[i][st].begin(),avgcovperst[i][st].end());
 	vector<double>::iterator acI=avgcovperst[i][st].begin();
@@ -351,13 +309,6 @@ void AssemblyInfo::calcCurrentInfo()
 }
 
 
-void AssemblyInfo::dumpLargeContigNames(ostream & ostr)
-{
-  for(auto & lce : ASI_nameslargecontigs){
-    ostr << lce << '\n';
-  }
-}
-
 void AssemblyInfo::dumpCurrentInfo(ostream & ostr)
 {
   calcCurrentInfo();
@@ -365,9 +316,6 @@ void AssemblyInfo::dumpCurrentInfo(ostream & ostr)
   ostr << "Assembly information:\n"
        << "=====================\n\n";
 
-  dateStamp(ostr);
-  ostr << "MIRA version: " << MIRAVERSION << "\n\n";
-
   ostr << "Num. reads assembled: " << ASI_numreads_assembled << '\n';
   ostr << "Num. singlets: " << ASI_numreads_singlets << '\n';
 
@@ -377,22 +325,21 @@ void AssemblyInfo::dumpCurrentInfo(ostream & ostr)
 
   for(int32 i=1; i>=0; i--){
     if(i==1){
-      ostr << "\n\nCoverage assessment (calculated from contigs >= "
-	   << ASI_conf_large_consize4stats
-	   << " with coverage >= " << ASI_conf_large_totalcov4stats
+      ostr << "\n\nCoverage assessment (calculated from contigs >= " 
+	   << ASI_conf_large_consize4stats 
 	   << "):\n=========================================================\n";
       ostr << "  Avg. total coverage: " << ASI_avgcoverage[i];
       ostr << "\n  Avg. coverage per sequencing technology";
-      for(uint32 st=0; st<ReadGroupLib::SEQTYPE_END; st++){
-	ostr << "\n\t" << ReadGroupLib::getNameOfSequencingType(st)
+      for(uint32 st=0; st<Read::SEQTYPE_END; st++){
+	ostr << "\n\t" << Read::getNameOfSequencingType(st) 
 	     << ":\t" << ASI_avgcoverage_perst[i][st];
       }
-
+      
       ostr << "\n\n\nLarge contigs (makes less sense for EST assemblies):\n"
 	   << "====================================================\nWith\tContig size\t\t>= " << ASI_conf_large_mincontigsize
 	   << "\n\tAND (Total avg. Cov\t>= " << ASI_conf_large_mintotalcov;
-      for(uint32 st=0; st<ReadGroupLib::SEQTYPE_END; st++){
-	ostr << "\n\t     OR Cov(" << ReadGroupLib::getShortNameOfSequencingType(st)
+      for(uint32 st=0; st<Read::SEQTYPE_END; st++){
+	ostr << "\n\t     OR Cov(" << Read::getShortNameOfSequencingType(st) 
 	     << ")\t>= " << ASI_conf_large_minavgcov_perst[st];
       }
       ostr << "\n\t    )\n\n";
@@ -412,18 +359,18 @@ void AssemblyInfo::dumpCurrentInfo(ostream & ostr)
 	 << "  Max coverage (total):\t"
 	 << ASI_maxcoverage[i];
     ostr << "\n  Max coverage per sequencing technology";
-    for(uint32 st=0; st<ReadGroupLib::SEQTYPE_END; st++){
-      ostr << "\n\t" << ReadGroupLib::getNameOfSequencingType(st)
+    for(uint32 st=0; st<Read::SEQTYPE_END; st++){
+      ostr << "\n\t" << Read::getNameOfSequencingType(st) 
 	   << ":\t" << ASI_maxcoverage_perst[i][st];
     }
-//    ostr << "\n  Avg. total coverage (size >= "
+//    ostr << "\n  Avg. total coverage (size >= " 
 //	 << ASI_conf_large_consize4stats << "): " << ASI_avgcoverage[i];
 //    ostr << "\n  Avg. coverage (contig size >= "<< ASI_conf_large_consize4stats << ")";
-//    for(uint32 st=0; st<ReadGroupLib::SEQTYPE_END; st++){
-//      ostr << "\n\t" << Read::getNameOfSequencingType(st)
+//    for(uint32 st=0; st<Read::SEQTYPE_END; st++){
+//      ostr << "\n\t" << Read::getNameOfSequencingType(st) 
 //	   << ":\t" << ASI_avgcoverage_perst[i][st];
 //    }
-
+    
     ostr << "\n\n  Quality assessment:\n  -------------------";
     ostr << "\n  Average consensus quality:\t\t\t" << ASI_avgconqual[i];
     checkThesePrinter(ostr, ASI_numIUPACs[i],
@@ -451,73 +398,3 @@ void AssemblyInfo::checkThesePrinter(ostream & ostr, uint32 val, const char * s)
     ostr << "\t(you might want to check these)";
   }
 }
-
-
-
-/*************************************************************************
- *
- * return warning level of smile coverage, 0== no warning
- *
- *************************************************************************/
-uint32 AssemblyInfo::huntForSmileCoverage(string & warntext)
-{
-  FUNCSTART("uint32 AssemblyInfo::huntForSmileCoverage(string & warntext)");
-  uint32 retvalue=0;
-
-  auto covtotake=ASI_avgcoverage[1];
-  if(covtotake==0.0) covtotake=ASI_avgcoverage[0];
-
-  auto thmin=covtotake*static_cast<double>(.75);
-  auto thmax=covtotake*static_cast<double>(1.25);
-
-  uint32 num_lnr=0;   // lnr= large, non-rep contigs
-  uint32 num_below=0;
-  uint32 num_above=0;
-
-  uint64 sumsize_lnr=0;
-  uint64 sumsize_below=0;
-  uint64 sumsize_above=0;
-
-  for(const auto & cse : ASI_contigstats){
-    BUGIFTHROW(cse.islargecontig==0,"cse.islargecontig==0 ???");
-    if(!cse.contains_long_repeats_only && cse.islargecontig>0){
-      ++num_lnr;
-      sumsize_lnr+=cse.conlength_nogap;
-      if(cse.avg_coverage<thmin){
-	++num_below;
-	sumsize_below+=cse.conlength_nogap;
-      }else if(cse.avg_coverage>thmax){
-	++num_above;
-	sumsize_above+=cse.conlength_nogap;
-      }
-    }
-  }
-
-  std::ostringstream wmsg;
-
-  // test for proportion of contigs below ...
-  if(sumsize_below >= sumsize_lnr*static_cast<double>(0.15)){
-    ++retvalue;
-    wmsg << "- " << num_below << " contig(s) with a total of " << sumsize_below << " bases (= " << 100.0/sumsize_lnr*sumsize_below << "% of bases in all non-repetitive large contigs) have an average coverage less than 75% of the average coverage of all non-repetitive large contigs.\n";
-  }
-  // test for proportion of contigs above ...
-  if(sumsize_above >= sumsize_lnr*static_cast<double>(0.15)){
-    ++retvalue;
-    wmsg << "- " << num_above << " contig(s) with a total of " << sumsize_above << " bases (= " << 100.0/sumsize_lnr*sumsize_above << "% of bases in all non-repetitive contigs) have an average coverage more than 125% of the average coverage of all non-repetitive large contigs.\n";
-  }
-
-  // test for proportion of contigs above ...
-  if(sumsize_above+sumsize_below >= sumsize_lnr*static_cast<double>(0.3)){
-    ++retvalue;
-    wmsg << "- " << num_above+num_below << " contig(s) with a total of " << sumsize_above+sumsize_below << " bases (= " << 100.0/sumsize_lnr*(sumsize_above+sumsize_below) << "% of bases in all non-repetitive contigs) have an average coverage 25% above or below the average coverage of all non-repetitive large contigs.\n";
-  }
-
-  warntext.clear();
-  if(retvalue){
-    wmsg << "Summary: found " << retvalue << " indicator(s) for coverage problem(s).\n\nIf the DNA you are assembling is bacterial, this could indicate that you sampled and sequenced DNA from exponential or late exponential phase of a bacterial population. This leads to a coverage bias toward the origin of replication, hence false positive detection of repeats, hence an assembly which is more fragmented than it could be or may have misassemblies in regions located toward the opposite of  [...]
-      "\nOnly available countermeasure: for your next sequencing project, do not sample in exponential phase but sample in stationary phase (if possible).\n";
-    warntext=wmsg.str();
-  }
-
-  return retvalue;
-}
diff --git a/src/mira/assembly_info.H b/src/mira/assembly_info.H
index fb364df..f1cb2f6 100644
--- a/src/mira/assembly_info.H
+++ b/src/mira/assembly_info.H
@@ -9,17 +9,17 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
 #ifndef _mira_assemblyinfo_h_
@@ -32,35 +32,31 @@
 
 #include "mira/contig.H"
 
+
 class AssemblyInfo
 {
 //Variables
 public:
   uint32         ASI_conf_large_consize4stats; /* min size to calc statistics
 						  for large contigs */
-  uint32         ASI_conf_large_totalcov4stats; /* min total cov to calc statistics
-						   for large contigs */
 
   // this is what user considers as large contig
   uint32         ASI_conf_large_mincontigsize; // minimum size of large contigs
   uint32         ASI_conf_large_mintotalcov; // minimum totcov of large contigs
-  std::vector<uint32> ASI_conf_large_minavgcov_perst; /* minimum coverage per
+  vector<uint32> ASI_conf_large_minavgcov_perst; /* minimum coverage per
 						       sequencing type for
 						       large contigs */
-  std::deque<Contig::constats_t> ASI_contigstats;
-  std::deque<std::string> ASI_contignames;
-
-  std::deque<std::string> ASI_nameslargecontigs;
-
+  list<Contig::constats_t> ASI_contigstats;
+  
   uint32 ASI_numreads_total;
   uint32 ASI_numbases_total;
-
+  
   uint32 ASI_numreads_assembled;     // all reads in contigs
   uint32 ASI_numbases_assembled;     // all bases of reads in contrigs
-
+  
   uint32 ASI_numreads_singlets;      // numsinglets (+debris)
   uint32 ASI_numbases_singlets;
-
+  
   // 0 = all contigs, 1 = large contigs
   // some values not used for all contigs
   uint32 ASI_numcontigs[2];
@@ -71,19 +67,19 @@ public:
   uint32 ASI_numSNPs[2];            // sum SROc, SAOc, SIOc
   uint32 ASI_numSTMU[2];
   uint32 ASI_numSTMS[2];
-
+  
   uint32 ASI_maxcoverage[2];
-  std::vector<uint32> ASI_maxcoverage_perst[2];
+  vector<uint32> ASI_maxcoverage_perst[2];
   double ASI_avgcoverage[2];
-  std::vector<double> ASI_avgcoverage_perst[2];
-
+  vector<double> ASI_avgcoverage_perst[2];
+  
   uint32 ASI_largestconsize[2];
   uint32 ASI_n50consize[2];
   uint32 ASI_n90consize[2];
   uint32 ASI_n95consize[2];
   uint32 ASI_avgconsize[2];
   uint32 ASI_avgconqual[2];
-
+  
   uint32 ASI_numcon_noqualread[2];
   uint32 ASI_numcon_somequalreadmissing[2];
 
@@ -93,8 +89,8 @@ private:
   void discard();
 
   void zeroStats();
-  void checkThesePrinter(std::ostream & ostr, uint32 val, const char * s);
-  void dumpCurrentInfo(std::ostream & ostr);
+  void checkThesePrinter(ostream & ostr, uint32 val, const char * s);
+  void dumpCurrentInfo(ostream & ostr);
 
 public:
   AssemblyInfo();
@@ -102,7 +98,7 @@ public:
   ~AssemblyInfo();
 
   AssemblyInfo const & operator=(AssemblyInfo const & other);
-  friend std::ostream & operator<<(std::ostream &ostr, AssemblyInfo &asi);
+  friend ostream & operator<<(ostream &ostr, AssemblyInfo &asi);
 
   void zeroInfo();
   void calcCurrentInfo();
@@ -110,14 +106,9 @@ public:
   inline void setLargeContigSize(uint32 s) { ASI_conf_large_mincontigsize=s;};
   inline void setLargeTotalCov(uint32 s) { ASI_conf_large_mintotalcov=s;};
   void setLargeContigCovPerST(uint32 cov, uint8 seqtype);
-
   void setLargeContigSizeForStats(uint32 s) { ASI_conf_large_consize4stats=s;};
-  void setLargeContigCovForStats(uint32 s) { ASI_conf_large_totalcov4stats=s;};
-
-  void storeContigStats(const Contig::constats_t & cs, const std::string & cname);
-  void dumpLargeContigNames(std::ostream & ostr);
 
-  uint32 huntForSmileCoverage(std::string & warntext);
+  void storeContigStats(const Contig::constats_t & cs);
 };
 
 
diff --git a/src/mira/assembly_io.C b/src/mira/assembly_io.C
index 8f82852..9104810 100644
--- a/src/mira/assembly_io.C
+++ b/src/mira/assembly_io.C
@@ -11,39 +11,31 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
 
-#include "util/fileanddisk.H"
+#ifndef lint
+static char vcid[] = "$Id$";
+#endif /* lint */
 
-#include "mira/assembly.H"
-#include "mira/maf_parse.H"
-#include "mira/readpool_io.H"
 
+#include "assembly.H"
+#include "maf_parse.H"
 
-#ifdef MIRAMEMORC
-#include "memorc/memorc.H"
-#endif
+#include "caf/caf.H"
 
-#include <boost/lexical_cast.hpp>
 #include <boost/regex.hpp>
-#include <boost/tokenizer.hpp>
-#include <boost/format.hpp>
-
-
-using namespace std;
-
 
 #define CEBUG(bla)
 #define CEBUGF(bla)
@@ -61,6 +53,8 @@ using namespace std;
 
 void Assembly::dumpContigs()
 {
+  (void) vcid;
+
   cout << "The assembled project has " << AS_contigs.size() << " objects.\n";
 
   Contig::setCoutType(Contig::AS_TEXT);
@@ -88,50 +82,21 @@ void Assembly::loadSequenceData()
 #ifdef TIMERESTRICTED
   if(AS_timesup) {
     cerr << "\n\nThis version of MIRA is old, please get a newer version of the assembler.\n";
-    cerr << "\nCanonical download page: http://sourceforge.net/projects/mira-assembler/\n";
+    cerr << "\nCanonical download page: http://www.chevreux.org/mira_downloads.html\n";
     exit(0);
   }
 #endif
 
-#ifdef MIRAMEMORC
-  MemORC::statistics();
-#endif
-
   discard();
 
-#ifdef MIRAMEMORC
-  MemORC::statistics();
-#endif
-
   if(AS_miraparams[0].getAssemblyParams().as_dateoutput) dateStamp(cout);
   cout << "\n";
 
   if(AS_resumeasembly){
-    if(AS_miraparams[0].getAssemblyParams().as_assemblyjob_mapping){
-      MIRANOTIFY(Notify::FATAL,"Resume is currently possible only for de-novo assemblies, sorry.");
-    }
     loadSequenceData_resume();
   }else{
-    //loadSequenceData_new();
-    loadSequenceDataFromManifest();
-    if(AS_miraparams[0].getAssemblyParams().as_rle_reads){
-      cout << "RLE reads ... "; cout.flush();
-      for(uint32 ri=0; ri<AS_readpool.size(); ++ri){
-	AS_readpool[ri].rleRead();
-	//cout << AS_readpool[ri] << endl;
-      }
-      cout << "done." << endl;
-      cout << "Tagging reads by RLE ... "; cout.flush();
-      //colourReadsByRLE();
-      cout << "done." << endl;
-    }
+    loadSequenceData_new();
   }
-
-  AS_warnings.dumpWarnings();
-
-#ifdef MIRAMEMORC
-  MemORC::statistics();
-#endif
 }
 
 
@@ -146,151 +111,324 @@ void Assembly::loadSequenceData_resume()
 {
   FUNCSTART("void Assembly::loadSequenceData_resume()");
 
-//  cout << "Assembly::loadSequenceData_resume() must be adapted to readgroups\n"; exit(0);
-
-  ReadGroupLib::discard();
-
-  MAFParse mafp(&AS_readpool, nullptr, &AS_miraparams);
-  vector<uint32> dummy;
-  mafp.load(buildDefaultCheckpointFileName(AS_miraparams[0].getFileParams().chkpt_readpool),
-	    ReadGroupLib::SEQTYPE_SANGER,
-	    1,
-	    dummy,
-	    false,
-	    nullptr
-	  );
-
-  bool templatesusable=AS_readpool.makeTemplateIDs(AS_miraparams[0].getNagAndWarnParams().nw_check_templateproblems);
-  if(!templatesusable) {
-    cout << "No useful template information found.\n";
-  }
+  assembly_parameters const & as_fixparams= AS_miraparams[0].getAssemblyParams();
 
-//  assembly_parameters const & as_fixparams= AS_miraparams[0].getAssemblyParams();
-//
-//  vector<uint32> lrperseqtype(ReadGroupLib::SEQTYPE_END,0);
-//
-//  size_t seqsloaded=loadMAF(buildDefaultCheckpointFileName(as_fixparams.as_infile_chkptMAF),
-//			    ReadGroupLib::SEQTYPE_SANGER,
-//			    1,                    // load directly
-//			    lrperseqtype);
-//
+  vector<uint32> lrperseqtype(Read::SEQTYPE_END,0);
+  
+  size_t seqsloaded=loadMAF(buildDefaultCheckpointFileName(as_fixparams.as_infile_chkptMAF),
+			    Read::SEQTYPE_SANGER,
+			    1,                    // load directly
+			    lrperseqtype);
 
   dumpSomeStatistics();
 
   FUNCEND();
 }
 
-
-
 /*************************************************************************
  *
  *
  *
  *
  *************************************************************************/
+
 //#define CEBUG(bla)   {cout << bla; cout.flush(); }
-void Assembly::loadSequenceDataFromManifest()
+void Assembly::loadSequenceData_new()
 {
-  FUNCSTART("void Assembly::loadSequenceDataFromManifest()");
+  FUNCSTART("void Assembly::loadSequenceData_new()");
 
-  vector<Manifest::manifestloadentry_t> & manifestdata2load=AS_manifest.MAN_manifestdata2load;
+  assembly_parameters const & as_fixparams= AS_miraparams[0].getAssemblyParams();
 
-  // quick consistency check for mapping
-  {
-    bool seenbb=false;
-    bool seennotbb=false;
-    for(const auto & mle : manifestdata2load){
-      if(mle.loadasbackbone) {
-	seenbb=true;
-      }else{
-	seennotbb=true;
+  bool foundsomethingtoload=false;
+  for(uint32 i=0; i<Read::SEQTYPE_END; i++){
+    if(AS_miraparams[i].getAssemblyParams().as_load_sequencedata) foundsomethingtoload=true;
+  }
+  if(!foundsomethingtoload){
+    throw Notify(Notify::FATAL, THISFUNC, "You did not specify any sequence technology as input to be loaded\neither via --job=... or via -LR:lsd.") ;
+  }
+
+
+  CEBUG("AS_readpool.capacity(): " << AS_readpool.capacity() << endl);
+  CEBUG("AS_readpool.size(): " << AS_readpool.size() << endl);
+
+  if(as_fixparams.as_loadbackbone){
+    if(as_fixparams.as_infile_backbone_which=="caf"){
+      loadBackboneCAF(as_fixparams.as_infile_backbone_CAF);
+    }else if(as_fixparams.as_infile_backbone_which=="fasta"){
+      loadBackboneFASTA(as_fixparams.as_infile_backbone_FASTA,
+			as_fixparams.as_infile_backbone_FASTAQUAL);
+    }else if(as_fixparams.as_infile_backbone_which=="gbf"){
+      loadBackboneGBF(as_fixparams.as_infile_backbone_GBF);
+    }else if(as_fixparams.as_infile_backbone_which=="maf"){
+      loadBackboneMAF(as_fixparams.as_infile_backbone_MAF);
+    }else if(as_fixparams.as_infile_backbone_which=="gff3"){
+      loadBackboneGFF3(as_fixparams.as_infile_backbone_GFF3);
+    }else{
+      MIRANOTIFY(Notify::FATAL, "wrong type (" << as_fixparams.as_infile_backbone_which << ") of file to load for backbone, sorry") ;
+    }
+
+    CEBUG("AS_readpool.capacity(): " << AS_readpool.capacity() << endl);
+    CEBUG("AS_readpool.size(): " << AS_readpool.size() << endl);
+    postLoadBackbone();
+    CEBUG("AS_readpool.capacity(): " << AS_readpool.capacity() << endl);
+    CEBUG("AS_readpool.size(): " << AS_readpool.size() << endl);
+
+
+  }
+
+
+  vector<uint32> lrperseqtype(Read::SEQTYPE_END,0);
+  uint32 longestread=0;
+
+  // loadaction:
+  //  0 = count only
+  //  1 = count, adjust readpool capacity and load
+  //  2 = load only
+  // (implemented by readpool and CAF loading routines)
+
+  size_t totalseqstoload=0;
+  for(uint8 loadaction=0; loadaction < 3; loadaction+=2){
+    totalseqstoload=0;
+    for(uint32 seqtype=0; seqtype<Read::SEQTYPE_END; seqtype++){
+      size_t seqstoload=0;
+      uint32 lread=1;
+      assembly_parameters const & as_rtparams= AS_miraparams[seqtype].getAssemblyParams();
+      //cout << "ST: " << seqtype << endl;
+      if(as_rtparams.as_load_sequencedata){
+	if(as_rtparams.as_infile_which=="fofnexp"){
+	  //if(seqtype!=0){
+	  //  MIRANOTIFY(Notify::FATAL, "Cannot load 'fofnexp' with anything else than Sanger at the moment.");
+	  //}
+	  seqstoload=loadFOFNEXP(as_rtparams.as_infile_FOFNEXP, seqtype, loadaction, lread);
+	}else if(as_rtparams.as_infile_which=="fasta"){
+	  seqstoload=loadFASTA(as_rtparams.as_infile_FASTA,
+				     as_rtparams.as_infile_FASTAQUAL,
+				     seqtype,
+				     loadaction, 
+				lread);
+	}else if(as_rtparams.as_infile_which=="fastq"){
+	  seqstoload=loadFASTQ(as_rtparams.as_infile_FASTQ,
+			       seqtype,
+			       loadaction,
+			       lread);
+	}else if(as_rtparams.as_infile_which=="maf"){
+	  MIRANOTIFY(Notify::INTERNAL, "Need to write code for loading MAF.\n");
+	}else if(as_rtparams.as_infile_which=="caf"){
+	  vector<uint32> lrpst(Read::SEQTYPE_END,0);
+	  seqstoload=loadCAF(as_rtparams.as_infile_CAF,
+			     seqtype,
+			     loadaction,
+			     lrpst);
+	  lread=0;
+	  for(uint32 i=0; i<lrpst.size(); i++){
+	    lrperseqtype[i]+=lrpst[i];
+	    lread=max(lread,lrpst[i]);
+	  }
+	}else if(as_rtparams.as_infile_which=="phd"){
+	  if(seqtype!=0){
+	    MIRANOTIFY(Notify::FATAL, "Cannot load 'phd' with anything else than Sanger at the moment.");
+	  }
+	  seqstoload=loadPHD(as_rtparams.as_infile_PHD,
+			     loadaction,
+			     lread);
+	}else{
+	  MIRANOTIFY(Notify::FATAL, "While trying to load sequence data: type '" << as_rtparams.as_infile_which << "' is unknown (is there a typo?)") ;
+	}
+	if(loadaction==0) {
+	  cout << Read::getNameOfSequencingType(seqtype) << " will load " << seqstoload << " reads.\n";
+	}else{
+	  cout << "Loaded " << seqstoload << " " << Read::getNameOfSequencingType(seqtype) << " reads.\n";
+	}
+	totalseqstoload+=seqstoload;
+
+	lrperseqtype[seqtype]=lread;
+	longestread=max(longestread,lread);
+
+	CEBUG("AS_readpool.capacity(): " << AS_readpool.capacity() << endl);
+	CEBUG("AS_readpool.size(): " << AS_readpool.size() << endl);
       }
     }
-    if(AS_miraparams[0].getAssemblyParams().as_assemblyjob_mapping){
-      if(!seenbb){
-	MIRANOTIFY(Notify::FATAL,"The \"job=...\" definition of the manifest says you want a mapping assembly, but no backbone sequence was given in the readgroups.\n\nDid you forget an 'is_reference' in one of the readgroups?");
+
+    if(loadaction<2){
+      for(uint32 i=0; i<Read::SEQTYPE_END; i++){
+#ifdef HIDEPACBIO
+	if(i==Read::SEQTYPE_PACBIO) continue;
+#endif
+	cout << "Longest " << Read::getNameOfSequencingType(i) << ": " << lrperseqtype[i] << endl;
       }
+      cout << "Longest overall: " << longestread << endl;
+    }
+
+    if(loadaction==0) {
+      cout << "Total reads to load: " << totalseqstoload << endl;
     }else{
-      if(seenbb){
-	MIRANOTIFY(Notify::FATAL,"The \"job=...\" definition of the manifest says you want a de-novo assembly, but there is a backbone/reference sequence given in the readgroups.\n\nThis is a slight contradiction, make up your mind please.");
-      }
+      cout << "Total reads loaded: " << totalseqstoload << endl;
     }
-  }
 
-  // for delayed transformation reads to contigs
-  // needed to simplify life when loading .fna and .gff3 with annotations
-  // this gives the Readpool loader the opportunity to load the sequence,
-  //  then the annotation, map the annotation to the sequence
-  // then only make the contigs
-  //
-  // if this were not done this way, one would have to annotate both the readpool read
-  //   AND search contigs for this read and annotate that one too
-  // TODO: might be an idea for "re-annotation"
-  vector<readid_t> readsasbackbonecontigs;
-
-  // this loads the data completely (no contig or read callbacks given)
-  streamSequenceDataFromManifest(AS_miraparams,
-				 AS_manifest,
-				 AS_readpool,
-				 &AS_bbcontigs,
-				 &readsasbackbonecontigs);
-
-  checkForReadNameLength(AS_miraparams[0].getNagAndWarnParams().nw_check_mrnlvalue,
-			 AS_miraparams[0].getNagAndWarnParams().nw_check_maxreadnamelength==NWSTOP);
-
-  bool hassomeerror=false;
-  {
-    string logname(buildFileName(0,"","",
-				 AS_miraparams[0].getAssemblyParams().as_tmpf_clippings,
-				 ".txt","",false));
-    string logprefix("load ancillary: ");
-
-  for(const auto & mle : manifestdata2load){
-    for(auto & fnfte : mle.ancillaryfilesfoundfordata){
-      cout << "Merging ancillary data " << fnfte.fn << " type " << fnfte.ft << endl;
-	if(fnfte.ft=="xml"){
-	  AS_readpool.mergeXMLTraceInfo(fnfte.fn,AS_miraparams[0].getNagAndWarnParams().nw_check_templateproblems);
-	}else if(fnfte.ft=="ssaha2"){
-	  AS_readpool.mergeSSAHA2SMALTVecScreenData(fnfte.fn,
-						    false,
-						    AS_miraparams,
-						    logname,
-						    logprefix);
-	}else if(fnfte.ft=="smalt"){
-	  AS_readpool.mergeSSAHA2SMALTVecScreenData(fnfte.fn,
-						    true,
-						    AS_miraparams,
-						    logname,
-						    logprefix);
-	}else{
-	  BUGIFTHROW(true, "Unknown ancillary file type '" << fnfte.fn << "' for data '" << fnfte.ft << "'\n");
+    if(totalseqstoload==0){
+      MIRANOTIFY(Notify::FATAL, "No input to load or no sequences in input files? Did you provide data to load?");
+    }
+    if(longestread==0){
+      MIRANOTIFY(Notify::FATAL, "No read with sequence length >0 present? Did you provide data to load?");
+    }
+
+    if(as_fixparams.as_loadbackbone){
+      // if wanted, determine solexahack parameter automatically
+      if(AS_miraparams[0].getAlignParams().al_solexahack_maxerrors==0
+	 && lrperseqtype[Read::SEQTYPE_SOLEXA]){
+	cout << "-AL:shme is 0, automatically determining optimal value.\n"; 
+	AS_miraparams[0].getNonConstAlignParams().al_solexahack_maxerrors=
+	  lrperseqtype[Read::SEQTYPE_SOLEXA]*15/100;
+	cout << "set -AL:shme " 
+	     << AS_miraparams[0].getAlignParams().al_solexahack_maxerrors
+	     << '\n';
+      }
+      
+      // if wanted, determine rail length and overlap automatically
+      if(AS_miraparams[0].getAssemblyParams().as_backbone_raillength == 0){
+	cout << "-SB:brl is 0, automatically determining optimal value.\n"; 
+	
+	// add 15% to longest read (so accomodate insertion), then times 2
+	uint32 newraillength=(longestread*115/100) * 2;
+	if(newraillength > 18000){
+	  cout << "Optimal rail would be longer than 18k, adjusting down to 18k.\n";
+	  newraillength=18000;
 	}
+	AS_miraparams[0].getNonConstAssemblyParams().as_backbone_raillength=newraillength;
+	cout << "brl: " 
+	     << AS_miraparams[0].getNonConstAssemblyParams().as_backbone_raillength
+	     << '\n';
+      }
+      if(AS_miraparams[0].getAssemblyParams().as_backbone_railoverlap == 0){
+	cout << "-SB:bro is 0, automatically determining optimal value.\n"; 
+	AS_miraparams[0].getNonConstAssemblyParams().as_backbone_railoverlap=
+	  AS_miraparams[0].getNonConstAssemblyParams().as_backbone_raillength/2;
+	cout << "bro: " 
+	     << AS_miraparams[0].getNonConstAssemblyParams().as_backbone_railoverlap
+	     << '\n';
+      }
+      if(AS_miraparams[0].getAssemblyParams().as_backbone_railoverlap >=
+	 AS_miraparams[0].getAssemblyParams().as_backbone_raillength){
+	cout << "-SB:bro is >= -SB:brl ... adjusting -SB:bro to (-SB:brl)-1\n";
+	AS_miraparams[0].getNonConstAssemblyParams().as_backbone_railoverlap=
+	  AS_miraparams[0].getNonConstAssemblyParams().as_backbone_raillength-1;
+      }
+    }
+
+    uint32 bbrailstoreserve=0;
+    if(as_fixparams.as_loadbackbone && loadaction<2){
+      CEBUG("AS_readpool.capacity(): " << AS_readpool.capacity() << endl);
+      CEBUG("AS_readpool.size(): " << AS_readpool.size() << endl);
+      CEBUG("Simulating adding reads...\n" << endl);
+      bbrailstoreserve=addRailsToBackbones(true);
+      CEBUG("bbrailstoreserve: " << bbrailstoreserve << endl);
+      CEBUG("AS_readpool.capacity(): " << AS_readpool.capacity() << endl);
+      CEBUG("AS_readpool.size(): " << AS_readpool.size() << endl);
+    }
+
+    CEBUG("AS_readpool.capacity(): " << AS_readpool.capacity() << endl);
+    CEBUG("AS_readpool.size(): " << AS_readpool.size() << endl);
+
+    if(loadaction==0){
+      // add 10 as safety
+      uint32 totalreserve=AS_readpool.size()+totalseqstoload+bbrailstoreserve+10;
+
+      cout << "Reserving space for reads";
+      if(totalreserve >=500000){
+	cout << " (this may take a while)";
+      }
+      cout << endl;
+      AS_readpool.reserve(totalreserve);
+      cout << "Reserved space for " << AS_readpool.capacity() << " reads";
+      if(as_fixparams.as_loadbackbone){
+	cout << " (including backbone rails)";
+      }
+      cout << '.' << endl;
+
+      // at the moment, we have to insert rails before the real reads as skim
+      //  won't work if they are after (*sigh* too much optimising)
+      if(as_fixparams.as_loadbackbone){
+	CEBUG("AS_readpool.capacity(): " << AS_readpool.capacity() << endl);
+	CEBUG("AS_readpool.size(): " << AS_readpool.size() << endl);
+	addRailsToBackbones(false);
+	CEBUG("AS_readpool.capacity(): " << AS_readpool.capacity() << endl);
+	CEBUG("AS_readpool.size(): " << AS_readpool.size() << endl);
       }
     }
+
   }
 
-  if(hassomeerror){
-    MIRANOTIFY(Notify::FATAL,"While looking at or loading ancillary files named in the manifest, some errors occured. Please check the log.");
+  CEBUG("AS_readpool.capacity(): " << AS_readpool.capacity() << endl);
+  CEBUG("AS_readpool.size(): " << AS_readpool.size() << endl);
+
+#if DEVELOPMENTVERSION != 0 
+  dumpMemInfo();
+#endif
+
+  checkForReadNameLength(AS_miraparams[0].getSpecialParams().mi_stop_readnamelength);
+
+  if(as_fixparams.as_load_sequencedata){
+    loadExternalSCFQualities();
   }
 
-  // delayed creation of backbone contigs from single reads
-  if(!readsasbackbonecontigs.empty()){
-    Contig con(&AS_miraparams, AS_readpool);
-    for(auto & rpi : readsasbackbonecontigs){
-      AS_bbcontigs.push_back(con);
-      AS_bbcontigs.back().addFirstRead(rpi,1);
+  for(uint32 i=0; i<Read::SEQTYPE_END; i++){
+    assembly_parameters const & as_rtparams= AS_miraparams[i].getAssemblyParams();
+    try{
+      if(as_rtparams.as_load_sequencedata && as_rtparams.as_mergexmltraceinfo){
+	if(as_fixparams.as_dateoutput) dateStamp(cout);
+	cout << "\n";
+	AS_readpool.mergeXMLTraceInfo(as_rtparams.as_infile_xmltraceinfo);
+	cout << "\n\n";
+      }
+    }
+    catch(Notify n){
+      cout << "Error while loading XML data from the traceainfo file.\n\n";
+      n.handleError(THISFUNC);
     }
   }
 
-  if(!AS_bbcontigs.empty()){
-    postLoadBackbone();
+
+  // TODO:
+  // Temporary hack. Put a 'N' in front of SOLEXA reads
+  //  set the minimum clipoff and adjust values
+  {
+    CEBUG("Temp sxa hack: add N" << endl);
+    for(uint32 ri=0; ri<AS_readpool.size(); ri++){
+      if(AS_readpool[ri].isSequencingType(Read::SEQTYPE_SOLEXA)){
+	if(AS_readpool[ri].getLenSeq()){
+	  if(AS_readpool[ri].getLSClipoff()<1){
+	    if(toupper(AS_readpool[ri].getSeqAsChar()[0])!='N'){
+	      AS_readpool[ri].insertBaseInSequence('n',0,0,true);
+	    }
+	    // do not use LSClipoff(): SEQVEC has influence on quality readings
+	    //  during the consensus calculation
+	    AS_readpool[ri].setLQClipoff(1);
+	  }
+	}
+      }
+    }
+
+    AS_miraparams[Read::SEQTYPE_SOLEXA].getNonConstAssemblyParams().as_clip_minslrequired++;
+    AS_miraparams[Read::SEQTYPE_SOLEXA].getNonConstAssemblyParams().as_clip_minqlsetto++;
+    CEBUG("done" << endl);
   }
 
+  if(as_fixparams.as_loadstraindata){
+    if(AS_miraparams[0].getAssemblyParams().as_dateoutput) dateStamp(cout);
+    cout << "\n";
+    loadStrainData(as_fixparams.as_infile_straindata);
+    cout << "\n\n";
+  }
 
-  // small sanity check (because things may go wrong somewhere without me knowing ...)
-  for(uint32 rgi=1; rgi< ReadGroupLib::getNumReadGroups(); ++rgi){
-    auto rgid=ReadGroupLib::getReadGroupID(rgi);
-    BUGIFTHROW(rgid.getSequencingType() >= ReadGroupLib::SEQTYPE_END, "readgroup with impossible sequencing type found: st="<<static_cast<uint16>(rgid.getSequencingType()) << " for readgroup\n" << rgid);
+  // find out what we have in the pool
+  AS_seqtypespresent.clear();
+  AS_seqtypespresent.resize(Read::SEQTYPE_END,false);
+  for(uint32 i=0; i< AS_readpool.size(); i++){
+    if(AS_readpool.getRead(i).hasValidData()){
+      if(!AS_readpool.getRead(i).isBackbone() && !AS_readpool.getRead(i).isRail()){
+	AS_seqtypespresent[AS_readpool.getRead(i).getSequencingType()]=true;
+      }
+    }
   }
 
   // special handling for 454 data (20.09.2008)
@@ -303,34 +441,24 @@ void Assembly::loadSequenceDataFromManifest()
   // E.g.
   //  ACCGTCAGTCAGTCAGTGTTGACGTGTCAccctgagacacgcaacaggggatagacaaggca
   //  ACCGTACGTCAG*CAGTGTTGACGTGTCAccctgagacacgcaacaggggatagacaaggca
-  //
+  // 
   // Two possible worarounds
   // 1) instruct extendADS() not to extend into lower case (bad, relies
   //    on case information)
-  // 2) transform the right qual clip into a vec clip if there is no
+  // 2) transform the right qual clip into a vec clip if there is no 
   //    vec clip
-  //
+  // 
   // we'll do number 2 here
 
-  // find out what we have in the pool
-  AS_seqtypespresent.clear();
-  AS_seqtypespresent.resize(ReadGroupLib::SEQTYPE_END,false);
-  for(uint32 rgi=1; rgi< ReadGroupLib::getNumReadGroups(); ++rgi){
-    auto rgid=ReadGroupLib::getReadGroupID(rgi);
-    if(!rgid.isRail() && !rgid.isBackbone()){
-      AS_seqtypespresent[rgid.getSequencingType()]=true;
-    }
-  }
-
-#if CPP_READ_SEQTYPE_END != 8
+#if CPP_READ_SEQTYPE_END != 6
 #error "Check if new seqtype needs same workaround."
 #endif
-  if(AS_seqtypespresent[ReadGroupLib::SEQTYPE_454GS20]){
+  if(AS_seqtypespresent[Read::SEQTYPE_454GS20]){
     uint32 changecount=0;
     for(uint32 rnr=0; rnr<AS_readpool.size(); rnr++){
       if(!AS_readpool.getRead(rnr).isBackbone() && !AS_readpool.getRead(rnr).isRail()){
 	if(AS_readpool.getRead(rnr).hasValidData()){
-	  // if no right seq vec but a right clip
+	  // if no right seq vec but a right clip 
 	  if(AS_readpool.getRead(rnr).getRSClipoff() == static_cast<int32>(AS_readpool.getRead(rnr).getLenSeq())
 	     && AS_readpool.getRead(rnr).getRQClipoff() != static_cast<int32>(AS_readpool.getRead(rnr).getLenSeq())){
 	    // make right seq vec = right clip
@@ -352,172 +480,317 @@ void Assembly::loadSequenceDataFromManifest()
 
   dumpSomeStatistics();
 
-  basicDataChecks();
-  basicReadGroupChecks();
+  //Read::setCoutType(Read::AS_TEXTCLIPS);
+  //cout << AS_readpool.getRead(0);
+
+  {
+    // Perform clippings
+
+    string logname;
+    logname=buildFileName(0,"","", 
+			  AS_miraparams[0].getAssemblyParams().as_tmpf_clippings,
+			  ".txt");
+    string logprefix="load: ";
+    
+    bool sc=false;
+    bool qc=false;
+    bool mc=false;
+    bool llc=false;
+    bool mlc=false;
+    bool mrc=false;
+    bool bss=false;
+    bool cpae=false;
+    bool c3pp=false;
+    bool qt=false;
+    bool ckar=false;
+    bool bse=false;
+    for(uint32 st=0; st<Read::SEQTYPE_END; st++){
+      if(AS_seqtypespresent[st]){
+	sc|=AS_miraparams[st].getAssemblyParams().as_clip_mergessahavectorscreen;
+	qc|=AS_miraparams[st].getAssemblyParams().as_clip_quality;
+	mc|=AS_miraparams[st].getAssemblyParams().as_clip_maskedbases;
+	llc|=AS_miraparams[st].getAssemblyParams().as_clip_lowercase;
+	mlc|=AS_miraparams[st].getAssemblyParams().as_clip_ensureminimumleftclipoff;
+	mrc|=AS_miraparams[st].getAssemblyParams().as_clip_ensureminimumrightclipoff;
+	bss|=AS_miraparams[st].getAssemblyParams().as_clip_badstretchquality;
+	cpae|=AS_miraparams[st].getAssemblyParams().as_clip_polyat;
+	c3pp|=AS_miraparams[st].getAssemblyParams().as_clip_3ppolybase;
+	qt|=AS_miraparams[st].getAssemblyParams().as_clip_quality_minthreshold;
+	ckar|=AS_miraparams[st].getAssemblyParams().as_clip_knownadaptorsright;
+      }
+    }
+    // these to are currently not per seqtype, but set as COMMON_SETTINGS
+    bse|=AS_miraparams[0].getAssemblyParams().as_clip_badsolexaends;
 
-  clipsAfterLoad();
+    if(bse && AS_seqtypespresent[Read::SEQTYPE_SOLEXA]) clipBadSolexaEnds(logname,logprefix);
 
-  dumpSomeStatistics();
+    if(ckar){
+      for(uint8 st=0; st< AS_seqtypespresent.size(); ++st) {
+	if(AS_seqtypespresent[st]) performPool_AdaptorRightClip(logname,logprefix,st);
+      }
+    }
 
-  vector<uint32> dummy;
-  if(AS_bbcontigs.empty()) {
-    sortReadPool(dummy);
-  }else{
-    addRailsToBackbones();
-    sortReadPool(dummy);
-
-    vector<uint32> reversemap;
-    list<Contig>::iterator bbcI=AS_bbcontigs.begin();
-    for(; bbcI!=AS_bbcontigs.end(); ++bbcI){
-      bbcI->exchangeReadIDs(dummy,reversemap);
-      // a few things to be redone
-      //bbcI->setupAsBackBoneContig();
+    if(qt) performPool_MinimumQualityThreshold(logname,logprefix);
+    if(llc) performLowerCaseClipping(logname,logprefix);
+    if(qc||mc) performQualAndMaskClips(logname,logprefix);
+    
+    if(bss){
+      if(mlc){
+	// if bad sequence search, the minimum left clip must be done before
+	cout << "Clipping: requested bad sequence search clip and a minimum left clip"
+	  "\nNeed to perform minimum left clip before bad sequence search clip.\n";
+	performMinimumLeftClips(true,false,logname,logprefix);
+	// but don't do a second minleftclip later
+	mlc=false;
+      }
+      performBadSequenceSearch(logname,logprefix);
+    }
+    if(sc){
+      if(AS_miraparams[0].getAssemblyParams().as_dateoutput) dateStamp(cout);
+      cout << "\n";
+      
+      bool present;
+      {
+	ifstream my_file(as_fixparams.as_infile_ssahavectorscreen.c_str());
+	present=my_file.good();
+      }
+      if(present){
+	mergeSSAHA2SMALTVecScreenData(as_fixparams.as_infile_ssahavectorscreen,
+				      false,
+				      logname,
+				      logprefix);
+      }
+      {
+	ifstream my_file(as_fixparams.as_infile_smaltvectorscreen.c_str());
+	present=my_file.good();
+      }
+      if(present){
+	mergeSSAHA2SMALTVecScreenData(as_fixparams.as_infile_smaltvectorscreen,
+				      true,
+				      logname,
+				      logprefix);
+      }
+      cout << "\n\n";
+    }
+    if(c3pp){
+      clipPolyBaseAtEnd(logname,logprefix);
+    }
+    if(cpae){
+      clipPolyATAtEnds(logname,logprefix);
+    }
+    if(mlc){
+      performMinimumLeftClips(true,false,logname,logprefix);
+    }
+    if(mrc){
+      performMinimumRightClips(logname,logprefix);
     }
-    dumpSomeStatistics();
   }
 
-  ofstream fout;
-  fout.open((AS_miraparams[0].getDirectoryParams().dir_tmp+'/'+AS_miraparams[0].getAssemblyParams().as_tmpf_poolinfo+".lst").c_str(), ios::out| ios::trunc);
-  AS_readpool.dumpPoolInfo(fout);
-  fout.close();
+  dumpSomeStatistics();
+
+  {
+    ofstream fout;
+    fout.open((AS_miraparams[0].getDirectoryParams().dir_tmp+'/'+as_fixparams.as_tmpf_poolinfo+".lst").c_str(), ios::out| ios::trunc);
+    
+    AS_readpool.dumpPoolInfo(fout);
+
+    fout.close();
+  }
+
+  if(AS_logflag_dumprailreads){
+    ofstream fout;
+    fout.open((AS_miraparams[0].getDirectoryParams().dir_tmp+"/elog.load.railreads.fasta").c_str(), ios::out| ios::trunc);
+    dumpRailReads(fout);
+    fout.close();
+  }
 
   FUNCEND();
-  return;
 }
 
+//#define CEBUG(bla)
+
+
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
 
-void Assembly::sortReadPool(vector<uint32> & dummy)
+void Assembly::dumpRailReads(ofstream & fout)
 {
-  FUNCSTART("void Assembly::sortReadPool()");
-
-  AS_readpool.checkTemplateIDs("Before sorting: template partners have template mismatch!");
-
-  dummy.clear();
-  cout << "Sorting reads ... "; cout.flush();
-  AS_readpool.sortPoolToMIRAStandard(dummy);
-  cout << "done."<<endl;
-
-  if(AS_debrisreason.size()){
-    BUGIFTHROW(AS_debrisreason.size() != dummy.size(),"AS_debrisreason.size() != dummy.size()");
-    vector<uint8> tmp;
-    tmp.resize(AS_debrisreason.size());
-    auto dstI=tmp.begin();
-    auto srcI=dummy.begin();
-    for(; dstI!=tmp.end(); ++srcI, ++dstI){
-      *dstI=AS_debrisreason[*srcI];
+  Read::setCoutType(Read::AS_FASTA);
+  for(uint32 i=0; i<AS_readpool.size(); ++i){
+    if(AS_readpool[i].isRail()){
+      fout << AS_readpool[i].isRail();
     }
-    AS_debrisreason.swap(tmp);
   }
+}
 
-  // The reads have Template Partner IDs internally which are now wrong
-  // Get them corrected
-  {
-    vector<uint32> backmap(dummy.size(),-1);
-    for(uint32 ri=0;ri<backmap.size(); ++ri){
-      backmap[dummy[ri]]=ri;
-    }
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+void Assembly::checkForReadNameLength(uint32 stoplength)
+{
+  FUNCSTART("void Assembly::checkForReadNameLength(uint32 stoplength)");
 
-    for(uint32 ri=0;ri<AS_readpool.size(); ++ri){
-      CEBUG(cout << AS_readpool[ri].getName() << "\t" << AS_readpool[ri].getTemplatePartnerID());
-      if(AS_readpool[ri].getTemplatePartnerID()>=0){
-	CEBUG("\t" << AS_readpool[AS_readpool[ri].getTemplatePartnerID()].getName());
-	AS_readpool[ri].setTemplatePartnerID(backmap[AS_readpool[ri].getTemplatePartnerID()]);
-	CEBUG("\t" << AS_readpool[AS_readpool[ri].getTemplatePartnerID()].getName());
-      }else{
-	CEBUG("\t-");
+  if(stoplength==0) return;
+
+  uint32 count=0;
+  for(uint32 ri=0; ri<AS_readpool.size(); ri++){
+    if(AS_readpool[ri].getName().size()>stoplength){
+      if(count==0) {
+	cout << "List of read names which have problems with name length:\n";
       }
-      CEBUG("\n");
+      cout << "Name too long: " << AS_readpool[ri].getName() << '\n';
+      ++count;
     }
+  }
+  if(count>0){
+    MIRANOTIFY(Notify::FATAL,
+	       "\nSome read names were detected with more than " << stoplength << " characters.\n"
+	       "While MIRA and many other programs have no problem with that, some older\n"
+	       "programs have restrictions concerning the length of the read name.\n"
+	       "\nExample given: the pipeline\n"
+	       "     CAF -> caf2gap -> gap2caf\n"
+	       "will stop working at the gap2caf stage if there are read names having > 40 characters\n"
+	       "where the names differ only at >40 characters.\n"
+	       "\nThis is a warning only, but as a couple of people were bitten by this, the default\n"
+	       "behaviour of MIRA is to stop when it sees that potential problem.\n"
+	       "\nYou might want to rename your reads to have <= " << stoplength << " characters.\n"
+	       "\nOn the other hand, you also can ignore this potential problem and force MIRA to\n"
+	       "continue by using the parameter: '-MI:somrnl=0'\n");
+  }
+  FUNCEND();
+  return;
+}
+
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
 
-    AS_readpool.checkTemplateIDs("After sorting: template partners have template mismatch!");
+void Assembly::loadExternalSCFQualities()
+{
+  assembly_parameters const & as_fixparams= AS_miraparams[0].getAssemblyParams();
+  if(as_fixparams.as_external_qual==E_QUAL_SCF){
+    if(AS_miraparams[0].getAssemblyParams().as_dateoutput) dateStamp(cout);
+    cout << "\n";
+    string log1=buildFileName(0, "", "", as_fixparams.as_tmpf_scfreadfail, "");
+    string log2=buildFileName(0, "", "", as_fixparams.as_tmpf_scfreadfatallywrong, "");
+    
+    AS_readpool.loadQualitiesFromSCF(as_fixparams.as_external_qual_override, true, log1, log2);
   }
+  return;
 }
 
 /*************************************************************************
  *
- * All pointer parameters may be nullptr
- * - if contigsptr is nullptr, then the CAF and MAF loading routines will
- *   know they do not need to build contig structures, saves time and
- *   memory
- * - readsasbackbonecontigs will contain a list of readpool ids of those
- *   *single reads!* which were not embedded in a contig but should be
- *   seen as backbone sequence (like e.g., loaded from FASTA, GFF3, FASTQ,
- *   etc.pp
+ *
+ *
  *
  *************************************************************************/
-//#define CEBUG(bla)   {cout << bla; cout.flush(); }
-void Assembly::streamSequenceDataFromManifest(std::vector<MIRAParameters> & miraparams, Manifest & man, ReadPool & readpool, list<Contig> * contigsptr, vector<readid_t> * readsasbackbonecontigs)
+
+size_t Assembly::loadFOFNEXP(const string & fofn, const uint8 seqtype, const uint8 loadaction, uint32 & longestread)
 {
-  FUNCSTART("void Assembly::streamSequenceDataFromManifest(std::vector<MIRAParameters> & miraparams, Manifest & man, ReadPool & readpool, list<Contig> * contigsptr, vector<readid_t> * readsasbackbonecontigs)");
+  FUNCSTART("size_t Assembly::loadFOFNEXP(const string & fofn, const uint8 loadaction, uint32 & longestread, const uint8 seqtype)");
 
-  ReadPoolIO rpio(readpool);
-  rpio.setAttributeProgressIndicator(true);
-  rpio.setAttributeFASTQQualOffset(0); // in case we load FASTQs, we want to adapt ourselves
+  cout << "Loading project as file of EXP filenames." << endl;
 
-  auto & manifestdata2load=man.MAN_manifestdata2load;
+  size_t numseqsloaded=0;
 
-  bool hassomeerror=false;
-  for(const auto & mle : manifestdata2load){
-    for(auto & fnfte : mle.mainfilesfoundfordata){
-      // should have already been set by the manifest parser, just in case
-      BUGIFTHROW(mle.loadasbackbone && !mle.rgid.isBackbone(),"manifest entry says to load as backbone, but readgroup is not backbone?");
+  //assembly_parameters const & as_fixparams= AS_miraparams[0].getAssemblyParams();
+  try{
+    numseqsloaded+=AS_readpool.loadEXPs(fofn.c_str(), loadaction, longestread, seqtype);
+    if(loadaction!=0) loadExternalSCFQualities();
+  }
+  catch(Notify n){
+    n.handleError(THISFUNC);
+  }
 
-      string fn2;
+  AS_steps[ASREADPOOLOK]=1;
 
-      if(fnfte.ft=="fasta"){
-	fn2=fnfte.fn+".qual";
-	rpio.setAttributeFASTAQualFileWanted(true);
-      }else if(fnfte.ft=="fna"){
-	rpio.setAttributeFASTAQualFileWanted(false);
-      }
+  FUNCEND();
+  return numseqsloaded;
+}
 
-      size_t oldrpsize=readpool.size();
-      size_t oldbbsize=0;
-      if(contigsptr!=nullptr) oldbbsize=contigsptr->size();
-
-      if(((mle.loadasbackbone && contigsptr!=nullptr) || contigsptr!=nullptr)
-	 && (fnfte.ft=="maf" || fnfte.ft=="caf")){
-	// Note: this branch really only if we want contigs or load as backbone (may be
-	//  two different usages from the caller function)
-	rpio.setAttributesForContigs(contigsptr,&miraparams);
-	cout << "Loading reads or assembled contigs ";
-	if(mle.loadasbackbone) cout << "as reference backbone ";
-	cout << "from " << fnfte.fn << " type " << fnfte.ft << endl;
-      }else{
-	rpio.setAttributesForContigs(nullptr,&miraparams);
-	if(mle.loadasbackbone){
-	  cout << "Loading reference backbone from " << fnfte.fn << " type " << fnfte.ft << endl;
-	  rpio.setAttributeFASTAQualFileWanted(false);
-	}else{
-	  cout << "Loading reads from " << fnfte.fn << " type " << fnfte.ft << endl;
-	}
-      }
-      rpio.registerFile(fnfte.ft,fnfte.fn,fn2,mle.rgid,false);
-      rpio.loadNextSeqs(-1,-1); // load all
-      if(fnfte.ft=="fastq"){
-	readpool.adaptFASTQQualValues(oldrpsize,readpool.size(),0,true);
-      }
 
-      if(contigsptr!=nullptr && contigsptr->size() != oldbbsize){
-	cout << "contained " << contigsptr->size()-oldbbsize << " contigs. Only the contigs will be added as backbone.\n";
-      }else if(mle.loadasbackbone){
-	// there were no contigs in this file: set qualities (if needed) and mark the reads to be added as contigs later
-	for(size_t rpi=oldrpsize; rpi<readpool.size(); ++rpi) {
-	  if(readpool[rpi].hasValidData()){
-	    if(!readpool[rpi].hasQuality()){
-	      readpool[rpi].setQualities(readpool[rpi].getReadGroupID().getDefaultQual());
-	      readpool[rpi].setQualityFlag(false);
-	    }
-	    if(readsasbackbonecontigs!=nullptr) readsasbackbonecontigs->push_back(static_cast<readid_t>(rpi));
-	  }
-	}
-      }
-    }
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+
+size_t Assembly::loadFASTA(const string & fastafile, const string & fastaqualfile, const uint8 seqtype, const uint8 loadaction, uint32 & longestread)
+{
+  FUNCSTART("Assembly::loadFASTA(const string & fastafile, const string & fastaqualfile, const uint8 seqtype, const uint8 loadaction)");
+
+  bool generatefilenames=false;
+  bool sxa_mustconvert=false;
+
+  size_t numseqsloaded=0;
+
+  cout << "Loading data (" << Read::getNameOfSequencingType(seqtype)
+       << ") from FASTA files,\n";
+
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
+#endif
+  switch(seqtype){
+  case Read::SEQTYPE_SANGER : {
+    generatefilenames=true;
+    break;
+  }
+  case Read::SEQTYPE_454GS20 : {
+    break;
+  }
+  case Read::SEQTYPE_IONTORRENT : {
+    break;
+  }
+  case Read::SEQTYPE_PACBIO : {
+    break;
+  }
+  case Read::SEQTYPE_SOLEXA : {
+    sxa_mustconvert=AS_miraparams[0].getAssemblyParams().as_loadSOLEXA_solexa_scores_in_qual_files;
+    break;
+  }
+  case Read::SEQTYPE_ABISOLID : {
+    break;
+  }
+  default: {
+    throw Notify(Notify::FATAL, THISFUNC, "unknown type of FASTA file to load") ;
+  }
   }
 
-  if(hassomeerror){
-    MIRANOTIFY(Notify::FATAL,"While looking at or loading data files named in the manifest, some errors occured. Please check the log.");
+  try{
+    numseqsloaded+=AS_readpool.loadDataFromFASTA(
+      fastafile.c_str(), 
+      loadaction,
+      longestread,
+      AS_miraparams[seqtype].getAssemblyParams().as_wants_qualityfile,
+      fastaqualfile.c_str(),
+      generatefilenames,
+      seqtype,
+      sxa_mustconvert);
+    if(seqtype == Read::SEQTYPE_SANGER) {
+      loadExternalSCFQualities();
+    }
+  }
+  catch(Notify n){
+    n.handleError(THISFUNC);
   }
+
+
+  AS_steps[ASREADPOOLOK]=1;
+
+  FUNCEND();
+  return numseqsloaded;
 }
 
 
@@ -528,106 +801,103 @@ void Assembly::streamSequenceDataFromManifest(std::vector<MIRAParameters> & mira
  *
  *************************************************************************/
 
-void Assembly::addRailsToBackbones()
+size_t Assembly::loadFASTQ(const string & fastqfile, const uint8 seqtype, const uint8 loadaction, uint32 & longestread)
 {
-  FUNCSTART("void Assembly::addRailsToBackbones()");
-  vector<uint32> lrperseqtype(ReadGroupLib::SEQTYPE_END,0);
-  uint32 longestread=0;
+  FUNCSTART("Assembly::loadFASTQ(const string & fastqfile, const string & fastaqualfile, const uint8 seqtype, const uint8 loadaction)");
 
-  for(uint32 i=0; i<AS_readpool.size(); ++i){
-    if(AS_readpool[i].isRail()
-       || AS_readpool[i].isBackbone()
-       || AS_readpool[i].isCoverageEquivalentRead()) continue;
-    if(AS_readpool[i].getLenClippedSeq()>longestread) longestread=AS_readpool[i].getLenClippedSeq();
-    if(AS_readpool[i].getLenClippedSeq()>lrperseqtype[AS_readpool[i].getSequencingType()]) lrperseqtype[AS_readpool[i].getSequencingType()]=AS_readpool[i].getLenClippedSeq();
-  }
+  bool generatefilenames=false;
+  bool sxa_mustconvert=false;
+  size_t numseqsloaded=0;
 
-  if(longestread==0){
-    MIRANOTIFY(Notify::FATAL, "No read with sequence length >0 present? Did you provide data to load?");
+
+  cout << "Loading data (" << Read::getNameOfSequencingType(seqtype)
+       << ") from FASTQ files,\n";
+
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
+#endif
+  switch(seqtype){
+  case Read::SEQTYPE_SANGER : {
+    generatefilenames=true;
+    break;
+  }
+  case Read::SEQTYPE_454GS20 : {
+    break;
+  }
+  case Read::SEQTYPE_IONTORRENT : {
+    break;
+  }
+  case Read::SEQTYPE_PACBIO : {
+    break;
+  }
+  case Read::SEQTYPE_SOLEXA : {
+    sxa_mustconvert=AS_miraparams[0].getAssemblyParams().as_loadSOLEXA_solexa_scores_in_qual_files;
+    break;
+  }
+  case Read::SEQTYPE_ABISOLID : {
+    break;
+  }
+  default: {
+    throw Notify(Notify::FATAL, THISFUNC, "unknown type of FASTA file to load") ;
+  }
   }
 
-  // if wanted, determine solexahack parameter automatically
-  if(AS_miraparams[0].getAlignParams().al_solexahack_maxerrors<0
-     && lrperseqtype[ReadGroupLib::SEQTYPE_SOLEXA]){
-    cout << "-AL:shme is < 0, automatically determining optimal value.\n";
-    AS_miraparams[0].getNonConstAlignParams().al_solexahack_maxerrors=
-      lrperseqtype[ReadGroupLib::SEQTYPE_SOLEXA]*15/100;
-    cout << "set -AL:shme "
-	 << AS_miraparams[0].getAlignParams().al_solexahack_maxerrors
-	 << '\n';
+  try{
+    numseqsloaded+=AS_readpool.loadDataFromFASTQ(fastqfile.c_str(), 
+						 loadaction,
+						 longestread,
+						 generatefilenames,
+						 seqtype,
+						 sxa_mustconvert);
+    if(seqtype == Read::SEQTYPE_SANGER) {
+      loadExternalSCFQualities();
+    }
+  }
+  catch(Notify n){
+    n.handleError(THISFUNC);
   }
 
-  // if wanted, determine rail length and overlap automatically
-  if(AS_miraparams[0].getAssemblyParams().as_backbone_raillength == 0){
-    cout << "-SB:brl is 0, automatically determining optimal value.\n";
 
-    // add 15% to longest read (so accomodate insertion), then times 2
-    uint32 newraillength=(longestread*115/100) * 2;
-    if(newraillength > 32760){
-      cout << "Optimal rail would be longer than 32k, adjusting down to 32k.\n";
-      newraillength=32760;
-    }
-    AS_miraparams[0].getNonConstAssemblyParams().as_backbone_raillength=newraillength;
-    cout << "brl: "
-	 << AS_miraparams[0].getNonConstAssemblyParams().as_backbone_raillength
-	 << '\n';
-  }
-  if(AS_miraparams[0].getAssemblyParams().as_backbone_railoverlap == 0){
-    cout << "-SB:bro is 0, automatically determining optimal value.\n";
-    AS_miraparams[0].getNonConstAssemblyParams().as_backbone_railoverlap=
-      AS_miraparams[0].getNonConstAssemblyParams().as_backbone_raillength/2;
-    cout << "bro: "
-	 << AS_miraparams[0].getNonConstAssemblyParams().as_backbone_railoverlap
-	 << '\n';
-  }
-  if(AS_miraparams[0].getAssemblyParams().as_backbone_railoverlap >=
-     AS_miraparams[0].getAssemblyParams().as_backbone_raillength){
-    cout << "-SB:bro is >= -SB:brl ... adjusting -SB:bro to (-SB:brl)-1\n";
-    AS_miraparams[0].getNonConstAssemblyParams().as_backbone_railoverlap=
-      AS_miraparams[0].getNonConstAssemblyParams().as_backbone_raillength-1;
-  }
-
-  // TODO: see whether rails need strains!!!
-  // Answer: yes, it helps. E.g.: markFeaturesByConsensus() and other routines do not
-  //  need to work around a strain which says "I have 3 strains" (backbone, rails (==empty) and
-  //  reads).
-  // Set the strain name to be equal to the strain name of the first backbone read encountered
+  AS_steps[ASREADPOOLOK]=1;
 
-  size_t numrailscreated=0;
+  FUNCEND();
+  return numseqsloaded;
+}
 
-  for(auto & bbc : AS_bbcontigs){
-    bbc.recalcTemplateIDsAndStrainPresent();
 
-    string strainname;
-    bool foundbbread=false;
-    for(auto & cr : bbc.getContigReads()){
-      if(cr.isBackbone()){
-	strainname=cr.getStrainName();
-	foundbbread=true;
-	break;
-      }
-    }
-    BUGIFTHROW(foundbbread==false,"no backbone read found in backbone???");
 
-    bool bbvalue=true;
 
-    // add the rails
-    if(bbvalue) {
-      numrailscreated+=bbc.addRails(
-	AS_miraparams[0].getAssemblyParams().as_backbone_raillength,
-	AS_miraparams[0].getAssemblyParams().as_backbone_railoverlap,
-	strainname,
-	AS_miraparams[0].getAssemblyParams().as_backbone_strainname_forceforall,
-	AS_miraparams[0].getAssemblyParams().as_backbone_rail_fromstrain,
-	false);
-    }
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+
+size_t Assembly::loadPHD(const string & phdfile, const uint8 loadaction, uint32 & longestread)
+{
+  FUNCSTART("void Assembly::loadPHD(const string & phdfile, const uint8 loadaction)");
+
+  cout << "Loading project from PHD file." << endl;
+  size_t numseqsloaded=0;
+
+  try{
+    numseqsloaded+=AS_readpool.loadPHD(phdfile, loadaction, longestread);
+    loadExternalSCFQualities();
+  }
+  catch(Notify n){
+    n.handleError(THISFUNC);
   }
 
-  AS_debrisreason.resize(AS_readpool.size(),DEBRIS_NOTDEBRIS);
+  AS_steps[ASREADPOOLOK]=1;
+
+  FUNCEND();
+  return numseqsloaded;
 }
 
 
 
+
 /*************************************************************************
  *
  *
@@ -635,40 +905,26 @@ void Assembly::addRailsToBackbones()
  *
  *************************************************************************/
 
-void Assembly::clipsAfterLoad()
+size_t Assembly::loadCAF(const string & caffile, const uint8 seqtype, const uint8 loadaction, vector<uint32> & lrperseqtype)
 {
-  AS_debrisreason.clear();
-  AS_debrisreason.resize(AS_readpool.size(),DEBRIS_NOTDEBRIS);
+  FUNCSTART("Assembly::loadCAF(const char * caffile, const uint8 seqtype, const uint8 loadaction, vector<uint32> & lrperseqtype)");
 
-  vector<unique_ptr<DataProcessing>> dpv(AS_miraparams[0].getAssemblyParams().as_numthreads);
+  cout << "Loading project from CAF file: " << caffile << endl;
+  size_t numseqsloaded=0;
 
-  for(uint32 ti=0; ti<dpv.size(); ++ti){
-    dpv[ti]=unique_ptr<DataProcessing>(new DataProcessing(&AS_miraparams));
-    string logname(buildFileName(0,"","",
-				 AS_miraparams[0].getAssemblyParams().as_tmpf_clippings
-				 + "_t" + boost::lexical_cast<string>(ti),
-				 ".txt","",false));
-    cout << logname << endl;
-    dpv[ti]->startLogging(logname,false);
-  }
+  CAF tcaf(AS_readpool, AS_contigs, &AS_miraparams);
+  numseqsloaded=tcaf.load(caffile.c_str(), seqtype, loadaction, lrperseqtype);
 
-  string logprefix("loadclip: ");
-  cout << "Post-load clips:\n";
+  AS_contigs.clear();
 
-  DataProcessing::stdTreatmentPool_MultiThread(AS_miraparams,AS_dataprocessing,dpv,AS_readpool,&AS_debrisreason,logprefix,true);
+  AS_steps[ASREADPOOLOK]=1;
 
-  cout << endl;
-  if(AS_dataprocessing.DP_stats.cphix174){
-    cout << "SEARCH MSG: PhiX 174 found: " << AS_dataprocessing.DP_stats.cphix174 << endl;
-  }
-  if(AS_dataprocessing.DP_stats.cadapright){
-    cout << "CLIP MSG: Adaptor right found: " << AS_dataprocessing.DP_stats.cadapright << endl;
-  }
-  if(AS_dataprocessing.DP_stats.cadaprightpartial){
-    cout << "CLIP MSG: Partial adaptor right found: " << AS_dataprocessing.DP_stats.cadaprightpartial << endl;
-  }
+  FUNCEND();
+
+  return numseqsloaded;
 }
 
+
 /*************************************************************************
  *
  *
@@ -676,58 +932,84 @@ void Assembly::clipsAfterLoad()
  *
  *************************************************************************/
 
-void Assembly::dumpRailReads(ofstream & fout)
+size_t Assembly::loadMAF(const string & maffile, const uint8 seqtype, const uint8 loadaction, vector<uint32> & lrperseqtype)
 {
-  Read::setCoutType(Read::AS_FASTA);
-  for(uint32 i=0; i<AS_readpool.size(); ++i){
-    if(AS_readpool[i].isRail()){
-      fout << AS_readpool[i].isRail();
-    }
-  }
+  FUNCSTART("Assembly::loadCAF(const char * caffile, const uint8 seqtype, const uint8 loadaction, vector<uint32> & lrperseqtype)");
+
+  cout << "Loading project from MAF file: " << maffile << endl;
+  size_t numseqsloaded=0;
+
+  MAFParse mafp(AS_readpool, AS_contigs, &AS_miraparams);
+  numseqsloaded=mafp.load(maffile, Read::SEQTYPE_SANGER, loadaction, lrperseqtype);
+
+  AS_contigs.clear();
+
+  AS_steps[ASREADPOOLOK]=1;
+
+  FUNCEND();
+
+  return numseqsloaded;
 }
 
+
+
 /*************************************************************************
  *
  *
  *
  *
  *************************************************************************/
-void Assembly::basicDataChecks()
+
+void Assembly::loadBackboneMAF(const string & maffile)
 {
-  FUNCSTART("void Assembly::basicDataChecks()");
-
-  uint32 nummsglr=0;
-  uint32 nummsgqual=0;
-  for(uint32 ri=0; ri<AS_readpool.size(); ++ri){
-    if(AS_readpool[ri].getLenClippedSeq() > 29990
-       && !AS_readpool[ri].isBackbone()){
-      if(++nummsglr<=10){
-	cout << "Read " << AS_readpool[ri].getName() << " has " << AS_readpool[ri].getLenClippedSeq() << " bases (clipped). Too long (>29990)\n";
-	if(nummsglr==10) cout << "More long reads may exist, but stopping output here.\n";
-      }
-    }
-    bool bahqual=false;
-    for(auto q : AS_readpool[ri].getQualities()){
-      if(q>=100){
-	bahqual=true;
-	break;
-      }
-    }
-    if(bahqual){
-      if(++nummsgqual<=10){
-	cout << "Read " << AS_readpool[ri].getName() << " has quality values >100, this is illegal.\n";
-	if(nummsgqual==10) cout << "More reads with bad quals may exist, but stopping output here.\n";
+  FUNCSTART("Assembly::loadBackboneMAF(const char * maffile)");
+
+  cout << "Loading backbone from MAF file: " << maffile << endl;
+
+  vector<uint32> lrperseqtype;
+  size_t numseqsloaded=0;
+
+  MAFParse mafp(AS_readpool, AS_bbcontigs, &AS_miraparams);
+  numseqsloaded=mafp.load(maffile, Read::SEQTYPE_SANGER, 1, lrperseqtype);
+
+  AS_readpool.makeStrainIDs();
+
+  // MAF file may have contigs or have only single reads
+  // if only single reads, move all reads to contigs (like backbone from
+  //  GBF)
+  if(AS_bbcontigs.size()==0) {
+    cout << "MAF contains no contigs. Adding single reads as backbones ... ";
+    cout.flush();
+   
+    Contig con(&AS_miraparams, AS_readpool);
+
+    for(uint32 i=0; i<AS_readpool.size(); i++) {
+      AS_readpool[i].setReadNamingScheme(SCHEME_NONE);
+      if(AS_readpool[i].hasValidData()){
+	if(!AS_readpool[i].hasQuality()){
+	  if(AS_miraparams[0].getAssemblyParams().as_backbone_basequals>0) {
+	    AS_readpool[i].setQualities(AS_miraparams[0].getAssemblyParams().as_backbone_basequals);
+	    AS_readpool[i].setQualityFlag(false);
+
+	  }
+	}
+	
+	AS_bbcontigs.push_back(con);
+	AS_bbcontigs.back().addFirstRead(i,1);    
       }
     }
+    cout << "done.\n";
+  } else {
+    cout << "MAF contained " << AS_bbcontigs.size() << " contigs. Only the contigs will be added as backbone.\n";
   }
 
-  if(nummsglr){
-    MIRANOTIFY(Notify::FATAL,"MIRA found " << nummsglr << " very long reads (too long for normal reads), see log above.");
-  }
-  if(nummsgqual){
-    MIRANOTIFY(Notify::FATAL,"MIRA found " << nummsgqual << " reads with illegal qualities, see log above.");
+  list<Contig>::iterator I=AS_bbcontigs.begin();
+  for(; I!=AS_bbcontigs.end(); I++){
+    I->deleteStarOnlyColumns(0,I->getContigLength());
   }
 
+  cout << "Done.\n";
+
   FUNCEND();
 }
 
@@ -737,145 +1019,189 @@ void Assembly::basicDataChecks()
  *
  *
  *************************************************************************/
-void Assembly::basicReadGroupChecks()
+
+void Assembly::loadBackboneCAF(const string & caffile)
 {
-  FUNCSTART("void Assembly::basicReadGroupChecks()");
-
-  bool haserror_ep=false; // expected pair
-  bool haserror_sra=false; // unexpected sra names
-
-  for(uint32 rglid=1; rglid<ReadGroupLib::getNumReadGroups(); ++rglid){
-    auto rgid = ReadGroupLib::getReadGroupID(rglid);
-
-    uint32 numsra=0;
-    uint32 numnotsra=0;
-    for(uint32 rid=0; rid<AS_readpool.size(); ++rid){
-      if(AS_readpool[rid].getReadGroupID()!=rgid) continue;
-      auto & rname=AS_readpool[rid].getName();
-      if(Read::checkStringForSRANamingScheme(rname)){
-	++numsra;
-	if(numsra<=10
-	   && rgid.getReadNamingScheme() != ReadGroupLib::SCHEME_SRARAW
-	   && AS_miraparams[0].getNagAndWarnParams().nw_check_readnamesra != NWNONE){
-	  cout <<"Read " << rname << " is in SRA naming scheme, that is unexpected.\n";
-	  if(numsra==10) cout << "More may be present but will not be shown anymore.\n";
-	}
-      }else{
-	++numnotsra;
-      }
-    }
-    if(numsra && rgid.getReadNamingScheme() != ReadGroupLib::SCHEME_SRARAW
-      && AS_miraparams[0].getNagAndWarnParams().nw_check_readnamesra != NWNONE){
-      string wstr("In readgroup ");
-      wstr+=boost::lexical_cast<string>(rgid.getLibId())+" (named: '"+rgid.getGroupName()+"'), reads names were found which seem to follow the SRA naming scheme but the readgroup does have the naming scheme 'sra'. In case your reads were downloaded from the SRA, it is strongly suggested to tell MIRA that your read names use the corresponding naming scheme (use 'segment_naming=sra' in the manifest).";
-      string tmpstr("READGROUP_UNEXPECTED_SRANAMES_"+boost::lexical_cast<string>(rgid.getLibId()));
-      AS_warnings.setWarning(tmpstr.c_str(),2,"Read names in SRA naming scheme unexpected in readgroup",wstr);
-      haserror_sra=true;
-    }
+  FUNCSTART("Assembly::loadBackboneCAF(const char * caffile)");
+
+  cout << "Loading backbone from CAF file: " << caffile << endl;
+
+  vector<uint32> lrperseqtype;
+  CAF tcaf(AS_readpool, AS_bbcontigs, &AS_miraparams);
+
+  tcaf.load(caffile.c_str(),Read::SEQTYPE_SANGER,1,lrperseqtype);
+
+  AS_readpool.makeStrainIDs();
 
-    cout << "Checking pairs of readgroup " << rglid << " (named: '" << rgid.getGroupName() << "'): ";
+  // CAF file may have contigs or have only single reads
+  // if only single reads, move all reads to contigs (like backbone from
+  //  GBF)
+  if(AS_bbcontigs.size()==0) {
+    cout << "CAF contains no contigs. Adding single reads as backbones ... ";
     cout.flush();
-    uint32 numreadswithtpids=0;
-    uint32 numreads=0;
-    for(uint32 rid=0; rid<AS_readpool.size(); ++rid){
-      if(AS_readpool[rid].getReadGroupID()==rgid){
-	++numreads;
-	if(AS_readpool[rid].getTemplatePartnerID()>=0) ++numreadswithtpids;
-      }
-    }
-    cout << " found " << numreadswithtpids<<endl;
-    if(rgid.expectsReadPairs()){
-      if(numreads && numreadswithtpids==0) {
-	cout << "WARNING: in the above readgroup, no read is paired although the manifest says there should be pairs. This is fishy!\n";
-	haserror_ep=true;
-      }
-    }else{
-      if(numreadswithtpids>0) {
-	string wstr("In readgroup ");
-	wstr+=boost::lexical_cast<string>(rgid.getLibId())+" (named: '"+rgid.getGroupName()+"') paired reads were found but no pairing information given in the manifest. MIRA will estimate 'template_size' and 'segment_placement'.\nYou can suppress this warning by using the keyword 'autopairing' in the readgroup definition of the manifest file.";
-	if(numsra && rgid.getReadNamingScheme() != ReadGroupLib::SCHEME_SRARAW){
-	  wstr+="\nNote that this may be caused by reads following the SRA naming scheme but you having not set the naming scheme of the readgroup to be 'sra'.";
+    
+    Contig con(&AS_miraparams, AS_readpool);
+
+    for(uint32 i=0; i<AS_readpool.size(); i++) {
+      AS_readpool[i].setReadNamingScheme(SCHEME_NONE);
+      if(AS_readpool[i].hasValidData()){
+	if(!AS_readpool[i].hasQuality()){
+	  if(AS_miraparams[0].getAssemblyParams().as_backbone_basequals>0) {
+	    AS_readpool[i].setQualities(AS_miraparams[0].getAssemblyParams().as_backbone_basequals);
+	    AS_readpool[i].setQualityFlag(false);
+
+	  }
 	}
-	AS_warnings.setWarning("READGROUP_UNEXPECTED_PAIRS",2,"Unexpected pairs in readgroup",wstr);
+	
+	AS_bbcontigs.push_back(con);
+	AS_bbcontigs.back().addFirstRead(i,1);    
       }
     }
+    cout << "done.\n";
+  } else {
+    cout << "CAF contained " << AS_bbcontigs.size() << " contigs. Only the contigs will be added as backbone.\n";
   }
 
-  if(haserror_ep){
-    MIRANOTIFY(Notify::FATAL,"MIRA found readgroups where pairs are expected but no read has a partner. See log above and then check your input please (either manifest file or data files loaded or segment_naming scheme).");
+  list<Contig>::iterator I=AS_bbcontigs.begin();
+  for(; I!=AS_bbcontigs.end(); I++){
+    I->deleteStarOnlyColumns(0,I->getContigLength());
   }
 
-  if(haserror_sra
-     && AS_miraparams[0].getNagAndWarnParams().nw_check_readnamesra == NWSTOP){
-    MIRANOTIFY(Notify::FATAL,"MIRA found readgroups where read names follow the SRA naming scheme, but that was not expected, please see log above.\nRemedies: use 'segment_naming=sra' in manifest file for this readgroup or switch off this warning via -NW:csrn=none or warn only with -NW:csrn=warn'");
+  cout << "Done.\n";
+
+  FUNCEND();
+}
+
+
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+
+void Assembly::loadBackboneGFF3(const string & gff3file)
+{
+  FUNCSTART("Assembly::loadBackboneGBF(const char * gbffile)");
+
+  cout << "Loading backbone from GFF3 file: " << gff3file << endl;
+  cout.flush();
+
+  AS_readpool.loadDataFromGFF3(gff3file);
+
+  AS_readpool.makeStrainIDs();
+
+  cout << "Done.\nAdding sequences as backbones ... ";
+  cout.flush();
+
+  Contig con(&AS_miraparams, AS_readpool);
+
+  for(uint32 i=0; i<AS_readpool.size(); i++) {
+    AS_readpool[i].setReadNamingScheme(SCHEME_NONE);
+    if(AS_readpool.getRead(i).hasValidData()){
+      if(AS_miraparams[0].getAssemblyParams().as_backbone_basequals>0) {
+	AS_readpool.getRead(i).setQualities(AS_miraparams[0].getAssemblyParams().as_backbone_basequals);
+	AS_readpool[i].setQualityFlag(false);
+      }
+      
+      AS_bbcontigs.push_back(con);
+      AS_bbcontigs.back().addFirstRead(i,1);    
+
+      //cout << "Hello " << con.getContigName() << endl;
+      //abort();
+    }
   }
 
+  cout << " done." << endl;
+
   FUNCEND();
 }
 
+
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+
+void Assembly::loadBackboneGBF(const string & gbffile)
+{
+  FUNCSTART("Assembly::loadBackboneGBF(const char * gbffile)");
+
+  cout << "Loading backbone from GBF file: " << gbffile << endl;
+  cout.flush();
+
+  AS_readpool.loadDataFromGBF(gbffile);
+
+  AS_readpool.makeStrainIDs();
+
+  cout << "Done.\nAdding sequences as backbones ... ";
+  cout.flush();
+
+  Contig con(&AS_miraparams, AS_readpool);
+
+  for(uint32 i=0; i<AS_readpool.size(); i++) {
+    AS_readpool[i].setReadNamingScheme(SCHEME_NONE);
+    if(AS_readpool.getRead(i).hasValidData()){
+      if(AS_miraparams[0].getAssemblyParams().as_backbone_basequals>0) {
+	AS_readpool.getRead(i).setQualities(AS_miraparams[0].getAssemblyParams().as_backbone_basequals);
+	AS_readpool[i].setQualityFlag(false);
+      }
+      
+      AS_bbcontigs.push_back(con);
+      AS_bbcontigs.back().addFirstRead(i,1);    
+
+      //cout << "Hello " << con.getContigName() << endl;
+      //abort();
+    }
+  }
+
+  cout << " done." << endl;
+
+  FUNCEND();
+}
+
+
 /*************************************************************************
  *
  *
  *
  *
  *************************************************************************/
-void Assembly::checkForReadNameLength(uint32 stoplength, bool stop)
+
+void Assembly::loadBackboneFASTA(const string & fastafile, const string & fastaqualfile)
 {
-  FUNCSTART("void Assembly::checkForReadNameLength(uint32 stoplength)");
+  FUNCSTART("Assembly::loadBackboneCAF(const char * fastafile)");
 
-  if(stoplength==0) return;
+  cout << "Loading backbone from FASTA file: " << fastafile << " (quality: " << fastaqualfile << ")" << endl;
+
+  uint32 longestread=0;
+  AS_readpool.loadDataFromFASTA(fastafile, 1, longestread, false, fastaqualfile);
 
-  // if names are too long, print out only the first 20 of each read group
-  vector<uint32> countperrg(ReadGroupLib::getNumReadGroups(),20);
+  AS_readpool.makeStrainIDs();
 
-  uint32 count=0;
-  bool maybemore=false;
-  for(uint32 ri=0; ri<AS_readpool.size(); ++ri){
-    if(AS_readpool[ri].getName().size()>stoplength){
-      if(countperrg[AS_readpool[ri].getReadGroupID().getLibId()]){
-	if(--countperrg[AS_readpool[ri].getReadGroupID().getLibId()] == 0) maybemore=true;
-	if(count==0) {
-	  cout << "List of read names which have problems with name length:\n";
+  Contig con(&AS_miraparams, AS_readpool);
+
+  for(uint32 i=0; i<AS_readpool.size(); i++) {
+    AS_readpool[i].setReadNamingScheme(SCHEME_NONE);
+    if(AS_readpool.getRead(i).hasValidData()){
+      if(!AS_readpool[i].hasQuality()){
+	if(AS_miraparams[0].getAssemblyParams().as_backbone_basequals>0) {
+	  AS_readpool[i].setQualities(AS_miraparams[0].getAssemblyParams().as_backbone_basequals);
+	  AS_readpool[i].setQualityFlag(false);
 	}
-	cout << "Name too long: " << AS_readpool[ri].getName() << '\n';
       }
-      ++count;
-    }
-  }
-  if(maybemore){
-    cout << count << " reads had a long name length, for brevity's sake not all were listed.\n";
-  }
-  if(count>0){
-    string emsg=boost::lexical_cast<string>(count)+
-      " reads were detected with names longer than "
-      +boost::lexical_cast<string>(stoplength)+
-      " characters (see output log for more details).\n\n"
-      "While MIRA and many other programs have no problem with that, some older "
-      "programs have restrictions concerning the length of the read name.\n"
-      "\nExample given: the pipeline\n"
-      "     CAF -> caf2gap -> gap2caf\n"
-      "will stop working at the gap2caf stage if there are read names having > 40 characters "
-      "where the names differ only at >40 characters.\n"
-      "\nThis is a warning only, but as a couple of people were bitten by this, the default "
-      "behaviour of MIRA is to stop when it sees that potential problem.\n"
-      "\nYou might want to rename your reads to have <= "
-      +boost::lexical_cast<string>(stoplength) +
-      " characters. Instead of renaming reads in the input files, maybe the 'rename_prefix' functionality of manifest files is useful for you there.\n"
-      "\nOn the other hand, you also can ignore this potential problem and force MIRA to "
-      "continue by using the parameter: '-NW:cmrnl=warn'  or  '-NW:cmrnl=no'\n";
-    if(stop){
-      MIRANOTIFY(Notify::FATAL,emsg);
-    }else{
-      cout << "WARNING!\n" << endl;
-      AS_warnings.setWarning("READ_NAME_TOO_LONG",2,"Long read names",emsg);
+      
+      AS_bbcontigs.push_back(con);
+      AS_bbcontigs.back().addFirstRead(i,1);    
     }
   }
+
   FUNCEND();
-  return;
 }
 
 
-
 /*************************************************************************
  *
  *
@@ -887,15 +1213,7 @@ void Assembly::postLoadBackbone()
 {
   FUNCSTART("void Assembly::postLoadBackbone()");
 
-  AS_hasbackbones=true;
-
-  cout << "Deleting gap columns in backbones ... "; cout.flush();
-  for(auto I=AS_bbcontigs.begin(); I!=AS_bbcontigs.end(); I++){
-    I->deleteStarOnlyColumns(0,I->getContigLength());
-  }
-
   cout << "Postprocessing backbone(s) ... this may take a while."<< endl;
-
   // mark all reads loaded in backbone as backbone
   // check that they are not named "ContigX"
   // set the strain to "backbone"
@@ -906,7 +1224,7 @@ void Assembly::postLoadBackbone()
   //return regex_match(s, e);
 
   // set MFSM tags
-  if(0){
+  if(1){
     vector<multitag_t::mte_id_t> idstoreplace;
     {
       string tmp="FLTR";
@@ -916,16 +1234,16 @@ void Assembly::postLoadBackbone()
     }
     string mfsm="MFSM";
     multitag_t::mte_id_t mtid=Read::getTagID(mfsm);
-    for(auto & ce : AS_bbcontigs){
-      auto & conreads=ce.getContigReads();
-      for(auto & cre : conreads){
-	for(uint32 it=0; it<cre.getNumOfTags(); ++it){
-	  multitag_t tmp=cre.getTag(it);
+    list<Contig>::iterator I=AS_bbcontigs.begin();
+    for(; I!=AS_bbcontigs.end(); ++I){
+      vector<Contig::contigread_t> & conreads=const_cast<vector<Contig::contigread_t>&>(I->getContigReads());
+      vector<Contig::contigread_t>::iterator crI=conreads.begin();
+      for(; crI != conreads.end(); ++crI){
+	for(uint32 it=0; it<crI->read.getNumOfTags(); ++it){
+	  multitag_t tmp=crI->read.getTag(it);
 	  if(find(idstoreplace.begin(),idstoreplace.end(),tmp.identifier)!=idstoreplace.end()){
 	    tmp.identifier=mtid;
-	    tmp.source=multitag_t::MT_tagsrcentry_idMIRA;
-	    Read & ncr=const_cast<Read &>(cre);
-	    ncr.addTagO(tmp);
+	    crI->read.addTag(tmp);
 	  }
 	}
       }
@@ -934,28 +1252,25 @@ void Assembly::postLoadBackbone()
 
 
   bool contignamesok=true;
+  uint32 bbnum=1;
   {
-    uint32 bbnum=0;
     cout << AS_bbcontigs.size() << " to process\n";
-    for(auto & ce : AS_bbcontigs){
-      ++bbnum;
+    list<Contig>::iterator I=AS_bbcontigs.begin();
+    for(; I!=AS_bbcontigs.end(); ++I, ++bbnum){
       // first, find a name for that contig
 
-      auto & conreads=ce.getContigReads();
+      const vector<Contig::contigread_t> & conreads=I->getContigReads();
 
       // if it is a single read contig,
       //  set the name for that contig to be the name of the read
       if(conreads.size()==1) {
-	if(conreads.begin()->getName().size()){
-	  if(conreads.begin()->getName()[0]=='C'){
-// BOOST: regex not compatible with _GLIBCXX_DEBUG
-#ifndef _GLIBCXX_DEBUG
-	    if(regex_match(conreads.begin()->getName(), badseqnameexp)){
-	      cout << "Bad name for backbone sequence " << bbnum << ": " << conreads.begin()->getName() << '\n';
+	if(conreads.front().read.getName().size()){
+	  if(conreads.front().read.getName()[0]=='C'){
+	    if(regex_match(conreads.front().read.getName(), badseqnameexp)){
+	      cout << "Bad name for backbone sequence " << bbnum << ": " << conreads.front().read.getName() << '\n';
 	      cout << "Backbone sequences may NOT be name 'ContigX' with 'X' being any number.\n";
 	      contignamesok=false;
 	    }
-#endif
 	  }
 	}else{
 	  cout << "There's a backbone sequence (number " << bbnum << ") without a name? Too bad, not allowed.\n";
@@ -967,21 +1282,22 @@ void Assembly::postLoadBackbone()
 	                    dump an error.
 			    Solution: ...?
 	*/
-	ce.setContigName(conreads.begin()->getName()+"_bb");
+	I->setContigName(conreads.front().read.getName()+"_bb");
 
+	//I->setContigName(conreads.front().read.getName());
       }
 
-      cout << ce.getContigName() << "\t" << ce.getContigLength() << endl;
+      cout << I->getContigName() << "\t" << I->getContigLength() << endl;
 
       //bool bbvalue=true;
 
       ////  except singlets?!
       //if(conreads.size()==1 && I->getContigLength()<4000) {
       //	bbvalue=false;
-      //}
+      //} 
 
       // now let the contig do the rest of the setup
-      ce.setupAsBackBoneContig();
+      I->setupAsBackBoneContig();
     }
   }
 
@@ -989,10 +1305,53 @@ void Assembly::postLoadBackbone()
     MIRANOTIFY(Notify::FATAL,"Some backbones had either no names or a bad name (see log above). Stopping here, fix your sequence names.\n")
   }
 
-  ReadGroupLib::dumpStrainIDSummary();
+  AS_readpool.dumpStrainIDSummary();
 }
 
 
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+
+size_t Assembly::addRailsToBackbones(const bool simulateonly)
+{
+  FUNCSTART("size_t Assembly::addRailsToBackbones(const bool simulateonly)");
+
+  if(!simulateonly) {
+    cout << "Adding rails to " << AS_bbcontigs.size() << " contigs (this may take a while)." << endl;
+  }
+
+  const string strainname=AS_miraparams[0].getAssemblyParams().as_backbone_strainname;
+
+  size_t numrailscreated=0;
+
+  list<Contig>::iterator I=AS_bbcontigs.begin();
+  for(; I!=AS_bbcontigs.end(); I++){
+    I->recalcTemplateAndStrainIDsPresent();
+    
+    bool bbvalue=true;
+    //if(conreads.size()==1 && I->getContigLength()<4000) {
+    //	bbvalue=false;
+    //} 
+    
+    // add the rails
+    if(bbvalue) {
+      numrailscreated+=I->addRails(
+	AS_miraparams[0].getAssemblyParams().as_backbone_raillength,
+	AS_miraparams[0].getAssemblyParams().as_backbone_railoverlap,
+	strainname,
+	AS_miraparams[0].getAssemblyParams().as_backbone_strainname_forceforall,
+	AS_miraparams[0].getAssemblyParams().as_backbone_rail_fromstrain,
+	simulateonly);
+    }
+  }
+
+  FUNCEND();
+  return numrailscreated;
+}
 
 /*************************************************************************
  *
@@ -1001,13 +1360,33 @@ void Assembly::postLoadBackbone()
  *
  *************************************************************************/
 
-void Assembly::postLoad()
+void Assembly::loadStrainData(const string & sdfile)
 {
-  FUNCSTART("void Assembly::postLoad()");
+  FUNCSTART("Assembly::loadStrainData(const string & sdfile)");
+
+  cout << "Loading straindata." << endl;
 
-  if(!AS_readpool.checkForDuplicateReadNames(AS_miraparams[0].getNagAndWarnParams().nw_check_duplicatereadnames)){
-    MIRANOTIFY(Notify::FATAL,"MIRA found duplicate read names in your data (see log above for more info).\n\nThis should never, never be!\n\nYou may have loaded a file more than once in the manifest or\nreads may be present multiple times across your input file(s).\nEither way: fix that!\n");
+  try{
+    AS_readpool.loadStrainData(sdfile.c_str());
   }
+  catch(Notify n){
+    n.handleError(THISFUNC);
+  }
+
+  FUNCEND();
+}
+
+
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+
+void Assembly::postLoad()
+{
+  FUNCSTART("void Assembly::postLoad()");
 
   directory_parameters const & dir_params= AS_miraparams[0].getDirectoryParams();
   assembly_parameters const & as_fixparams= AS_miraparams[0].getAssemblyParams();
@@ -1019,7 +1398,7 @@ void Assembly::postLoad()
   // count how many have SCF data: if none, switch off editing.
 
   {
-    cout << "Checking reads for trace data (loading qualities if needed):\n";
+    cout << "Checking reads for trace data:\n";
 
     ProgressIndicator<int32> P (0, AS_readpool.size());
 
@@ -1032,9 +1411,6 @@ void Assembly::postLoad()
       P.progress(i);
       if(AS_readpool.getRead(i).hasValidData()){
 	AS_num_reads_valid++;
-	if(AS_readpool[i].isBackbone()){
-	  AS_hasbackbones=true;
-	}
 	AS_readpool.getRead(i).removeGapsFromRead();
 	if(AS_readpool.getRead(i).hasSCFData(true)){
 	  can_edit=true;
@@ -1053,8 +1429,8 @@ void Assembly::postLoad()
     cout << endl;
 
     if(!can_edit) {
-      cout << "No SCF data present in any read, EdIt automatic contig editing for Sanger data is now switched off.\n";
-      const_cast<edit_parameters &>(AS_miraparams[0].getEditParams()).ed_edit_automatic_contic_editing=false;
+      cout << "No SCF data present in any read, automatic contig editing for Sanger data is now switched off.\n";
+      AS_miraparams[0].setEditAutomaticContigEditing(false);
     }
     fout.close();
   }
@@ -1062,46 +1438,63 @@ void Assembly::postLoad()
   cout << AS_num_reads_valid << " reads with valid data for assembly.\n";
 
   if(!AS_num_reads_valid){
-    MIRANOTIFY(Notify::FATAL, "No valid read in assembly?");
+    throw Notify(Notify::FATAL, THISFUNC, "No valid read in assembly?");
   }
 
 
-  bool templatesusable=AS_readpool.makeTemplateIDs(AS_miraparams[0].getNagAndWarnParams().nw_check_templateproblems);
+  bool templatesusable=AS_readpool.makeTemplateIDs();
   if(!templatesusable) {
-    cout << "No useful template information found.\n";
+    cout << "No useful template information found, template routines will not be used.\n";
+    AS_miraparams[0].setAssemblyUseTemplateInformation(false);
   }
 
 
+  // assign default strains, if wanted, to all non-backbone, non-rail reads
+  //  which do not have strain info yet
+  {
+    for(uint32 i=0;i<AS_readpool.size();i++){
+      Read & actread=AS_readpool.getRead(i);
+      if(actread.isBackbone() 
+	 || actread.isRail()) continue;
+      if(AS_miraparams[actread.getSequencingType()].getAssemblyParams().as_assigndefaultstrain
+	 && actread.getStrain().empty()){
+	actread.setStrain(AS_miraparams[actread.getSequencingType()].getAssemblyParams().as_default_strainname);
+      }
+    }
+  }  
+
+  // now make and assign strain IDs
+  AS_readpool.makeStrainIDs();
+  
   //re-adjust bbcontigs template and strain ids in contig reads
-  if(AS_hasbackbones){
+  if(as_fixparams.as_loadbackbone){
     list<Contig>::iterator I=AS_bbcontigs.begin();
     for(; I!=AS_bbcontigs.end(); I++){
-      I->recalcTemplateIDsAndStrainPresent();
+      I->recalcTemplateAndStrainIDsPresent();
     }
   }
-
-  ReadGroupLib::dumpStrainIDSummary();
+  
+  AS_readpool.dumpStrainIDSummary();
 
   // look for quality values in reads
   {
     bool stopall=false;
     for(uint32 i=0;i<AS_readpool.size();i++){
       Read & actread=AS_readpool.getRead(i);
-      if(actread.isBackbone()
+      if(actread.isBackbone() 
 	 || actread.isRail()) continue;
       if(AS_miraparams[actread.getSequencingType()].getAssemblyParams().as_enforce_qualsinreads
 	 && actread.hasValidData()
-	 && actread.hasQuality()==false
-	 && !actread.hasUserDefaultQuality()){
-	cout << "No quality data found: (" << ReadGroupLib::getNameOfSequencingType(actread.getSequencingType()) << ") " << actread.getName() << '\n';
+	 && actread.hasQuality()==false){
+	cout << "No quality data found: (" << Read::getNameOfSequencingType(actread.getSequencingType()) << ") " << actread.getName() << '\n';
 	stopall=true;
       }
     }
-#if CPP_READ_SEQTYPE_END != 8
-#error "This code is made for 8 sequencing types, adapt!"
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
 #endif
     if(stopall) {
-      MIRANOTIFY(Notify::FATAL,"Some reads had no quality values given (see log above),\nplease check your input data.\nIf sure that this is ok for your data, switch off this check with -AS:epoq=no\nfor any sequencing type you wish (Sanger, 454, IonTorrent, PacbioLQ, PacbioHQ, Text, Solexa, ...).\nAlso consider the '--noqualities' parameter setting.\nAlternatively, you can force to switch off this check for specific readgroups by using the 'default_qual' setting in the manifest.")
+      MIRANOTIFY(Notify::FATAL,"Some reads had no quality values given (see log above),\nplease check your input data.\nIf sure that this is ok for your data, switch off this check with -AS:epoq=no\nfor any sequencing type you wish (Sanger, 454, IonTorrent, PacBio, Solexa, ...)")
     }
 
   }
@@ -1110,7 +1503,7 @@ void Assembly::postLoad()
   FUNCEND();
   return;
 }
-
+  
 
 
 /*************************************************************************
@@ -1140,7 +1533,7 @@ void Assembly::dumpSomeStatistics()
 
       //AS_ok_for_assembly[i]=1;
       actread.setUsedInAssembly(true);
-
+      
       if(actread.hasValidData()==false){
 	cout << actread.getName() << ": unable to load or other reason for invalid data.\n";
 	//AS_ok_for_assembly[i]=0;
@@ -1154,15 +1547,15 @@ void Assembly::dumpSomeStatistics()
 	}else{
 	  // throw out on minumum length if no template partner is present
 	  if(actread.getLenClippedSeq() < AS_miraparams[actread.getSequencingType()].getAssemblyParams().as_minimum_readlength){
-	    //cout << "Short length: "
-	    //	 << actread.getName() << " ("
-	    //	 << actread.getShortNameOfSequencingType(actread.getSequencingType())
-	    //	 << "): only " << actread.getLenClippedSeq()
+	    //cout << "Short length: " 
+	    //	 << actread.getName() << " (" 
+	    //	 << actread.getShortNameOfSequencingType(actread.getSequencingType()) 
+	    //	 << "): only " << actread.getLenClippedSeq() 
 	    //	 << " good bases, ";
 	    fout << actread.getName();
 	    if(actread.getTemplatePartnerID() == -1){
-	      //cout << "need: "
-	      //	   << AS_miraparams[actread.getSequencingType()].getAssemblyParams().as_minimum_readlength
+	      //cout << "need: " 
+	      //	   << AS_miraparams[actread.getSequencingType()].getAssemblyParams().as_minimum_readlength 
 	      //	   << ". No paired end partner, rejected.\n";
 	      fout << " too small and no paired end\n";
 	      AS_num_reads_too_small++;
@@ -1186,7 +1579,7 @@ void Assembly::dumpSomeStatistics()
     }
     fout.close();
   }
-
+  
   if(AS_logflag_dumpusedids){
     ofstream fout;
     fout.open((dir_params.dir_tmp+"/elog.usedids.lst").c_str(), ios::out | ios::trunc);
@@ -1199,13 +1592,16 @@ void Assembly::dumpSomeStatistics()
   }
 
   // TODO: also take reads too short into statistics
-  //
+  //  
 
+  vector<int32> straindatabytype(Read::SEQTYPE_END,0);
+  vector<int32> withoutclipsbytype(Read::SEQTYPE_END,0);
+  vector<int32> readcountbytype(Read::SEQTYPE_END,0);
+  vector<int32> readusedbytype(Read::SEQTYPE_END,0);
+  vector<int32> numnoqualbytype(Read::SEQTYPE_END,0);
 
-  AS_current_rls_byrg.clear();
-  AS_current_rls_byrg.resize(ReadGroupLib::getNumReadGroups());
-  AS_current_rls_bytype.clear();
-  AS_current_rls_bytype.resize(ReadGroupLib::SEQTYPE_END);
+  vector<uint64_t> meanlengthbytype(Read::SEQTYPE_END,0);
+  vector<uint64_t> meantlengthbytype(Read::SEQTYPE_END,0);
 
   //remove("log.noqualities");
   ofstream fout;
@@ -1214,142 +1610,189 @@ void Assembly::dumpSomeStatistics()
     Read & actread=AS_readpool.getRead(i);
     if(actread.isBackbone() == false
        && actread.isRail() == false){
-
-      auto rgi=actread.getReadGroupID().getLibId();
-
-      BUGIFTHROW(rgi==0,"Read " << actread.getName() << " has rgid of 0??? Ouch.");
-      BUGIFTHROW(rgi>=ReadGroupLib::getNumReadGroups(),"Read " << actread.getName() << " has rgid of " << rgi << " and num of readgroups is " << ReadGroupLib::getNumReadGroups() << "??? Ouch.");
-
-      auto st=actread.getSequencingType();
-
       if(actread.hasQuality()==false){
-	++AS_current_rls_bytype[st].RLS_count_noqual;
-	++AS_current_rls_byrg[rgi].RLS_count_noqual;
+	numnoqualbytype[actread.getSequencingType()]++;
 	fout << actread.getName() << endl;
       }
-      ++AS_current_rls_bytype[st].RLS_count_all;
-      ++AS_current_rls_byrg[rgi].RLS_count_all;
-      AS_current_rls_bytype[st].RLS_len_all+=actread.getLenSeq();
-      AS_current_rls_byrg[rgi].RLS_len_all+=actread.getLenSeq();
+      readcountbytype[actread.getSequencingType()]++;
+      meantlengthbytype[actread.getSequencingType()]+=actread.getLenSeq();
       if(actread.isUsedInAssembly()){
-	++AS_current_rls_bytype[st].RLS_count_used;
-	++AS_current_rls_byrg[rgi].RLS_count_used;
-	AS_current_rls_bytype[st].RLS_len_used+=actread.getLenClippedSeq();
-	AS_current_rls_byrg[rgi].RLS_len_used+=actread.getLenClippedSeq();
+	readusedbytype[actread.getSequencingType()]++;
+	meanlengthbytype[actread.getSequencingType()]+=actread.getLenClippedSeq();
+      }
+      if(!actread.getStrain().empty()){
+	straindatabytype[actread.getSequencingType()]++;
       }
-#if CPP_READ_SEQTYPE_END != 8
-#error "This code is made for 8 sequencing types, adapt!"
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
 #endif
       switch(actread.getSequencingType()){
-      case ReadGroupLib::SEQTYPE_TEXT :
-      case ReadGroupLib::SEQTYPE_SANGER :
-      case ReadGroupLib::SEQTYPE_PACBIOHQ :
-      case ReadGroupLib::SEQTYPE_PACBIOLQ :
-      case ReadGroupLib::SEQTYPE_IONTORRENT :
-      case ReadGroupLib::SEQTYPE_454GS20 :
-      case ReadGroupLib::SEQTYPE_SOLEXA : {
-	if(actread.getLenClippedSeq() == actread.getLenSeq()){
-	  ++AS_current_rls_bytype[st].RLS_count_withoutclips;
-	  ++AS_current_rls_byrg[rgi].RLS_count_withoutclips;
+      case Read::SEQTYPE_SANGER : {
+	break;
+      }
+      case Read::SEQTYPE_PACBIO : {
+	break;
+      }
+      case Read::SEQTYPE_IONTORRENT : {
+	if(actread.getLQClipoff()<1 ||
+	   (actread.getLQClipoff()==1 && actread.getRightClipoff()==static_cast<int32>(actread.getLenSeq()))){
+	  withoutclipsbytype[actread.getSequencingType()]++;
+	}
+	break;
+      }
+      case Read::SEQTYPE_454GS20 : {
+	if(actread.getRightClipoff()==static_cast<int32>(actread.getLenSeq())
+	   && (actread.getLQClipoff()<1 ||
+	       actread.getLQClipoff()==4)){
+	  withoutclipsbytype[actread.getSequencingType()]++;
+	}
+	break;
+      }
+      case Read::SEQTYPE_SOLEXA : {
+	if(actread.getLQClipoff()<1 ||
+	   (actread.getLQClipoff()==1 && actread.getRightClipoff()==static_cast<int32>(actread.getLenSeq()))){
+	  withoutclipsbytype[actread.getSequencingType()]++;
 	}
 	break;
       }
-      case ReadGroupLib::SEQTYPE_ABISOLID : {
-	MIRANOTIFY(Notify::INTERNAL, "Type ABI SOLiD needs more support 20a.");
+      case Read::SEQTYPE_ABISOLID : {
+	throw Notify(Notify::INTERNAL, THISFUNC, "Type ABI SOLiD needs more support 20a.");
 	break;
       }
       default : {
 	cerr << "Sequencing type " << actread.getSequencingType() << " unknown?\n";
-	MIRANOTIFY(Notify::FATAL, "Found unknown sequencing type in read.");
+	throw Notify(Notify::FATAL, THISFUNC, "Found unknown sequencing type in read.");
       }
       }
     }
-  }
+  }  
   fout.close();
 
-#if CPP_READ_SEQTYPE_END != 8
-#error "This code is made for 8 sequencing types, adapt!"
-#endif
-  cout << "\n===========================================================================\n";
-  cout << "Backbones: " << backbonereads << "\tBackbone rails: " << railreads << "\n";
-
-  static vector<uint8> displayst= {
-    ReadGroupLib::SEQTYPE_SANGER,
-    ReadGroupLib::SEQTYPE_454GS20,
-    ReadGroupLib::SEQTYPE_IONTORRENT,
-    ReadGroupLib::SEQTYPE_PACBIOHQ,
-    ReadGroupLib::SEQTYPE_PACBIOLQ,
-    ReadGroupLib::SEQTYPE_TEXT,
-    ReadGroupLib::SEQTYPE_SOLEXA,
-    ReadGroupLib::SEQTYPE_ABISOLID
-  };
-
-  cout << "Sequencing technology statistics:\n";
-  cout << "\n\t";
-  //cout << "\tSanger\t454\tIonTor\tPcBioHQ\tPcBioLQ\tText\tSolexa\tSOLiD\n";
-  for(auto st : displayst){
-    cout << "\t" << ReadGroupLib::getNameOfSequencingType(st);
-  }
-  cout << '\n';
-
-  cout << "\t\t------------------------------------------------------------\n";
-  cout << "Total reads";
-  for(auto st : displayst){
-    cout << "\t" << AS_current_rls_bytype[st].RLS_count_all;
-  }
-  cout << '\n';
-
-  cout << "Reads wo qual";
-  for(auto st : displayst){
-    cout << "\t" << AS_current_rls_bytype[st].RLS_count_noqual;
-  }
-  cout << '\n';
+  vector<uint64_t> totallengthbytype=meanlengthbytype;
+  vector<uint64_t> totaltlengthbytype=meantlengthbytype;
 
-  cout << "Used reads";
-  for(auto st : displayst){
-    cout << "\t" << AS_current_rls_bytype[st].RLS_count_used;
+  for(uint32 i=0; i<meantlengthbytype.size(); i++){
+    if(readcountbytype[i]) meantlengthbytype[i]/=readcountbytype[i];
+    if(readusedbytype[i]) meanlengthbytype[i]/=readusedbytype[i];
   }
-  cout << '\n';
 
-  cout << "Avg. tot rlen";
-  for(auto st : displayst){
-    cout << "\t" << AS_current_rls_bytype[st].getAvgLenAll();
-  }
-  cout << '\n';
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
+#endif
+  cout << "\n===========================================================================\n";
+  cout << "Pool statistics:\n";
+  cout << "Backbones: " << backbonereads << "\tBackbone rails: " << railreads << "\n";
 
-  cout << "Avg. used rlen";
-  for(auto st : displayst){
-    cout << "\t" << AS_current_rls_bytype[st].getAvgLenUsed();
-  }
-  cout << '\n';
+#ifdef HIDEPACBIO
+  cout << "\n\t\tSanger\t454\tIonTor\tSolexa\tSOLiD\n";
+  cout << "\t\t---------------------------------\n";
+  cout << "Total reads\t" << readcountbytype[Read::SEQTYPE_SANGER];
+  cout << '\t' << readcountbytype[Read::SEQTYPE_454GS20];
+  cout << '\t' << readcountbytype[Read::SEQTYPE_IONTORRENT];
+  cout << '\t' << readcountbytype[Read::SEQTYPE_SOLEXA];
+  cout << '\t' << readcountbytype[Read::SEQTYPE_ABISOLID] << '\n';
+  cout << "Reads wo qual\t" << numnoqualbytype[Read::SEQTYPE_SANGER];
+  cout << '\t' << numnoqualbytype[Read::SEQTYPE_454GS20];
+  cout << '\t' << numnoqualbytype[Read::SEQTYPE_IONTORRENT];
+  cout << '\t' << numnoqualbytype[Read::SEQTYPE_SOLEXA];
+  cout << '\t' << numnoqualbytype[Read::SEQTYPE_ABISOLID] << '\n';
+  cout << "Used reads\t" << readusedbytype[Read::SEQTYPE_SANGER];
+  cout << '\t' << readusedbytype[Read::SEQTYPE_454GS20];
+  cout << '\t' << readusedbytype[Read::SEQTYPE_IONTORRENT];
+  cout << '\t' << readusedbytype[Read::SEQTYPE_SOLEXA];
+  cout << '\t' << readusedbytype[Read::SEQTYPE_ABISOLID] << '\n';
+  cout << "Avg tot rlen\t" << meantlengthbytype[Read::SEQTYPE_SANGER];
+  cout << '\t' << meantlengthbytype[Read::SEQTYPE_454GS20];
+  cout << '\t' << meantlengthbytype[Read::SEQTYPE_IONTORRENT];
+  cout << '\t' << meantlengthbytype[Read::SEQTYPE_SOLEXA];
+  cout << '\t' << meantlengthbytype[Read::SEQTYPE_ABISOLID] << '\n';
+  cout << "Avg rlen used\t" << meanlengthbytype[Read::SEQTYPE_SANGER];
+  cout << '\t' << meanlengthbytype[Read::SEQTYPE_454GS20];
+  cout << '\t' << meanlengthbytype[Read::SEQTYPE_IONTORRENT];
+  cout << '\t' << meanlengthbytype[Read::SEQTYPE_SOLEXA];
+  cout << '\t' << meanlengthbytype[Read::SEQTYPE_ABISOLID] << '\n';
+  cout << "\nWith strain\t" << straindatabytype[Read::SEQTYPE_SANGER];
+  cout << '\t' << straindatabytype[Read::SEQTYPE_454GS20];
+  cout << '\t' << straindatabytype[Read::SEQTYPE_IONTORRENT];
+  cout << '\t' << straindatabytype[Read::SEQTYPE_SOLEXA];
+  cout << '\t' << straindatabytype[Read::SEQTYPE_ABISOLID] << '\n';
+  cout << "W/o clips\t" << withoutclipsbytype[Read::SEQTYPE_SANGER];
+  cout << '\t' << withoutclipsbytype[Read::SEQTYPE_454GS20];
+  cout << '\t' << withoutclipsbytype[Read::SEQTYPE_IONTORRENT];
+  cout << '\t' << withoutclipsbytype[Read::SEQTYPE_SOLEXA];
+  cout << '\t' << withoutclipsbytype[Read::SEQTYPE_ABISOLID] << '\n';
+#else
+  cout << "\n\t\tSanger\t454\tIonTor\tPacBio\tSolexa\tSOLiD\n";
+  cout << "\t\t----------------------------------------\n";
+  cout << "Total reads\t" << readcountbytype[Read::SEQTYPE_SANGER];
+  cout << '\t' << readcountbytype[Read::SEQTYPE_454GS20];
+  cout << '\t' << readcountbytype[Read::SEQTYPE_IONTORRENT];
+  cout << '\t' << readcountbytype[Read::SEQTYPE_PACBIO];
+  cout << '\t' << readcountbytype[Read::SEQTYPE_SOLEXA];
+  cout << '\t' << readcountbytype[Read::SEQTYPE_ABISOLID] << '\n';
+  cout << "Reads wo qual\t" << numnoqualbytype[Read::SEQTYPE_SANGER];
+  cout << '\t' << numnoqualbytype[Read::SEQTYPE_454GS20];
+  cout << '\t' << numnoqualbytype[Read::SEQTYPE_IONTORRENT];
+  cout << '\t' << numnoqualbytype[Read::SEQTYPE_PACBIO];
+  cout << '\t' << numnoqualbytype[Read::SEQTYPE_SOLEXA];
+  cout << '\t' << numnoqualbytype[Read::SEQTYPE_ABISOLID] << '\n';
+  cout << "Used reads\t" << readusedbytype[Read::SEQTYPE_SANGER];
+  cout << '\t' << readusedbytype[Read::SEQTYPE_454GS20];
+  cout << '\t' << readusedbytype[Read::SEQTYPE_IONTORRENT];
+  cout << '\t' << readusedbytype[Read::SEQTYPE_PACBIO];
+  cout << '\t' << readusedbytype[Read::SEQTYPE_SOLEXA];
+  cout << '\t' << readusedbytype[Read::SEQTYPE_ABISOLID] << '\n';
+  cout << "Avg tot rlen\t" << meantlengthbytype[Read::SEQTYPE_SANGER];
+  cout << '\t' << meantlengthbytype[Read::SEQTYPE_454GS20];
+  cout << '\t' << meantlengthbytype[Read::SEQTYPE_IONTORRENT];
+  cout << '\t' << meantlengthbytype[Read::SEQTYPE_PACBIO];
+  cout << '\t' << meantlengthbytype[Read::SEQTYPE_SOLEXA];
+  cout << '\t' << meantlengthbytype[Read::SEQTYPE_ABISOLID] << '\n';
+  cout << "Avg rlen used\t" << meanlengthbytype[Read::SEQTYPE_SANGER];
+  cout << '\t' << meanlengthbytype[Read::SEQTYPE_454GS20];
+  cout << '\t' << meanlengthbytype[Read::SEQTYPE_IONTORRENT];
+  cout << '\t' << meanlengthbytype[Read::SEQTYPE_PACBIO];
+  cout << '\t' << meanlengthbytype[Read::SEQTYPE_SOLEXA];
+  cout << '\t' << meanlengthbytype[Read::SEQTYPE_ABISOLID] << '\n';
+  cout << "\nWith strain\t" << straindatabytype[Read::SEQTYPE_SANGER];
+  cout << '\t' << straindatabytype[Read::SEQTYPE_454GS20];
+  cout << '\t' << straindatabytype[Read::SEQTYPE_IONTORRENT];
+  cout << '\t' << straindatabytype[Read::SEQTYPE_PACBIO];
+  cout << '\t' << straindatabytype[Read::SEQTYPE_SOLEXA];
+  cout << '\t' << straindatabytype[Read::SEQTYPE_ABISOLID] << '\n';
+  cout << "W/o clips\t" << withoutclipsbytype[Read::SEQTYPE_SANGER];
+  cout << '\t' << withoutclipsbytype[Read::SEQTYPE_454GS20];
+  cout << '\t' << withoutclipsbytype[Read::SEQTYPE_IONTORRENT];
+  cout << '\t' << withoutclipsbytype[Read::SEQTYPE_PACBIO];
+  cout << '\t' << withoutclipsbytype[Read::SEQTYPE_SOLEXA];
+  cout << '\t' << withoutclipsbytype[Read::SEQTYPE_ABISOLID] << '\n';
+#endif
 
-  cout << "W/o clips";
-  for(auto st : displayst){
-    cout << "\t" << AS_current_rls_bytype[st].RLS_count_withoutclips;
-  }
   cout << '\n';
-
-  cout << "\n\nReadgroup statistics:\n";
-  for(uint32 rgi=1; rgi<ReadGroupLib::getNumReadGroups(); ++rgi){
-    if(AS_current_rls_byrg[rgi].RLS_count_all){
-      cout << "RG " << rgi << "\t" << ReadGroupLib::getReadGroupID(rgi).getNameOfSequencingType()
-	   << "\tavg total len: " << AS_current_rls_byrg[rgi].getAvgLenAll()
-	   << "\tavg clip len: " << AS_current_rls_byrg[rgi].getAvgLenUsed()
-	   << "\ttotal bases: " << AS_current_rls_byrg[rgi].RLS_len_all
-	   << "\tused bases: " << AS_current_rls_byrg[rgi].RLS_len_used
-	   << '\n';
-    }
+  for(uint32 i=0; i<totallengthbytype.size(); i++){
+    cout << Read::getNameOfSequencingType(i) << "\ttotal bases:" << totaltlengthbytype[i]
+	 << "\tused bases in used reads: " << totallengthbytype[i] << '\n';
   }
 
   cout << "===========================================================================\n\n";
 
+  
+  //for(uint32 i=0; i<meanlengthbytype.size(); i++){
+  //  if(readcountbytype[i] >0 
+  //     && readcountbytype[i] == numnoqualbytype[i]){
+  //    cout << "No qualities for " << Read::getNameOfSequencingType(i)
+  //	   << " reads, forcing usage of non-IUPAC consensus base for these reads.\n";
+  //    AS_miraparams[i].getNonConstContigParams().con_force_nonIUPACconsensus_perseqtype=true;
+  //  }
+  //}
+
 
   if(AS_readpool.size()-AS_num_reads_too_small-backbonereads-railreads<=0) {
-    //MIRANOTIFY(Notify::FATAL, "No read can be used for assembly.");
+    throw Notify(Notify::FATAL, THISFUNC, "No read can be used for assembly.");
   }
 
   cout << endl;
-
+  
   FUNCEND();
 }
 
@@ -1378,30 +1821,30 @@ void Assembly::saveExtTmpContig(Contig & con, string basename)
       string filename=basename+".caf";
 
       cout << "Logging this contig to file: " << filename << endl;
-
+    
       ofstream cafout(filename.c_str(), ios::out | ios::trunc);
       Contig::setCoutType(Contig::AS_CAF);
       cafout << con;
       cafout.close();
     }
-
+  
     if (as_fixparams.as_output_exttmp_ace) {
       string filename=basename+".ace";
       cout << "Logging this contig to file: " << filename << endl;
-
+    
       ofstream aceout(filename.c_str(), ios::out | ios::trunc);
       Contig::setCoutType(Contig::AS_ACE);
       aceout << con;
       aceout.close();
     }
-
-
+  
+  
     if (as_fixparams.as_output_exttmp_fasta) {
       string filename=basename+".fasta";
       string qualname=filename+".qual";
-
+    
       cout << "Logging this contig to files: " << filename << "  and  " << qualname << endl;
-
+    
       ofstream fastaout(filename.c_str(), ios::out | ios::trunc);
       Contig::setCoutType(Contig::AS_FASTA);
       fastaout << con;
@@ -1411,16 +1854,16 @@ void Assembly::saveExtTmpContig(Contig & con, string basename)
       qualout << con;
       qualout.close();
     }
-
-
+  
+  
     if (as_fixparams.as_output_exttmp_gap4da) {
       string dirname=basename+".gap4da";
 
       cout << "Logging this contig to directory: " << dirname << endl;
-      if(ensureDirectory(dirname,true)){
+      if(purgeCreateDir(dirname,true)){
 	MIRANOTIFY(Notify::FATAL, "Cannot make sure the directory exist? Aborting.");
       }
-
+    
       Contig::setCoutType(Contig::AS_GAP4DA);
       ofstream fofnout((dirname+"/fofn").c_str(), ios::out | ios::trunc);
       con.saveAsGAP4DA(dirname, fofnout);
@@ -1465,17 +1908,17 @@ string Assembly::buildDefaultInfoFileName(int32 version, const string & prefix,
 
   string filename;
   if(basename.size()){
-    filename=buildFileName(version, prefix, postfix,
+    filename=buildFileName(version, prefix, postfix, 
 			   basename, defaultextension,
 			   "",
 			   removeold);
   }else{
-    filename=buildFileName(version, prefix, postfix,
+    filename=buildFileName(version, prefix, postfix, 
 			   defaultname, defaultextension,
 			   dirname,
 			   removeold);
   }
-
+  
   return filename;
 }
 
@@ -1498,17 +1941,17 @@ string Assembly::buildDefaultResultsFileName(int32 version, const string & prefi
 
   string filename;
   if(basename.size()){
-    filename=buildFileName(version, prefix, postfix,
+    filename=buildFileName(version, prefix, postfix, 
 			   basename, defaultextension,
 			   "",
 			   removeold);
   }else{
-    filename=buildFileName(version, prefix, postfix,
+    filename=buildFileName(version, prefix, postfix, 
 			   defaultname, defaultextension,
 			   dirname,
 			   removeold);
   }
-
+  
   return filename;
 }
 
@@ -1577,90 +2020,6 @@ void Assembly::saveAssemblyInfo(int32 version, const string & prefix, const stri
   assout::saveAssemblyInfo(AS_assemblyinfo,filename, deleteoldfile);
 }
 
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-string Assembly::getLargeContigsInfoFilename(int32 version, const string & prefix, const string & postfix, const string & basename)
-{
-  return buildDefaultInfoFileName(
-    version, prefix, postfix, basename,
-    AS_miraparams[0].getAssemblyParams().as_outfile_stats_largecontigs,
-    ".txt");
-}
-
-void Assembly::saveLargeContigsInfo(int32 version, const string & prefix, const string & postfix, const string & basename, bool deleteoldfile)
-{
-  string filename(getLargeContigsInfoFilename(version, prefix, postfix, basename));
-  assout::saveLargeContigsInfo(AS_assemblyinfo,filename, deleteoldfile);
-}
-
-/*************************************************************************
- *
- * readgroup stat & template info
- *
- *
- *************************************************************************/
-
-string Assembly::getRGSTInfoFilename(int32 version, const string & prefix, const string & postfix, const string & basename)
-{
-  return buildDefaultInfoFileName(
-    version, prefix, postfix, basename,
-    AS_miraparams[0].getAssemblyParams().as_outfile_stats_rgstinfo,
-    ".txt");
-}
-
-void Assembly::saveRGSTInfo(int32 version, const string & prefix, const string & postfix, const string & basename, bool deleteoldfile)
-{
-  string filename(getRGSTInfoFilename(version, prefix, postfix, basename));
-
-  cout << "Saving readgroup info to file: " << filename << endl;
-  ofstream fout(filename.c_str(), ios::out | ios::trunc);
-
-  for(uint32 rgi=1; rgi<ReadGroupLib::getNumReadGroups(); ++rgi){
-    auto rgid=ReadGroupLib::getReadGroupID(rgi);
-    fout << "Readgroup " << rgi;
-    if(rgid.getGroupName().empty()){
-      fout << " (unnamed)\n";
-    }else{
-      fout << " (" << rgid.getGroupName() << ")\n";
-    }
-    fout << "------------------------------------------\n";
-    fout << "Technology: " << ReadGroupLib::getNameOfSequencingType(rgid.getSequencingType()) << '\n';
-    fout << "Num. reads: " << AS_current_rls_byrg[rgi].RLS_count_all << '\n';
-    fout << "  thereof chimera: "
-	 << AS_current_rls_byrg[rgi].RLS_count_chimera
-	 << " (";
-    if(AS_current_rls_byrg[rgi].RLS_count_chimera==0){
-      fout << "maybe not searched for?";
-    }else{
-      auto tmpratio=100.0/AS_current_rls_byrg[rgi].RLS_count_all*AS_current_rls_byrg[rgi].RLS_count_chimera;
-      fout << boost::str(boost::format("%.2f") % tmpratio);
-      fout << "%, " << AS_current_rls_byrg[rgi].RLS_verdict_chimera;
-    }
-    fout << ")\n";
-    fout << "\nLibrary type: ";
-    if(rgid.hasTemplateInfo()) {
-      fout << "paired "
-	   << ReadGroupLib::getNameOfSegmentplacement(AS_rgstinfo[rgi].rgtguess.tg.splace_seen)
-	   << "\n    mean: " << AS_rgstinfo[rgi].rgtguess.mean
-	   << " stdev: " << AS_rgstinfo[rgi].rgtguess.stdev
-	   << " skewness: " << AS_rgstinfo[rgi].rgtguess.skewness
-	   << "\n    min: " << rgid.getInsizeFrom()
-	   << "\tmax: " << rgid.getInsizeTo()
-	   << endl;
-    }else{
-      fout << "shotgun\n";
-    }
-    fout << "\n\n";
-  }
-}
-
-
 /*************************************************************************
  *
  *
@@ -1671,155 +2030,22 @@ void Assembly::saveRGSTInfo(int32 version, const string & prefix, const string &
 void Assembly::saveDebrisList(int32 version, const string & prefix, const string & postfix, const string & basename)
 {
   FUNCSTART("void Assembly::saveDebrisInfo(int32 version, const string & prefix, const string & postfix, const string & debrisfilename)");
-
+  
   string filename(buildDefaultInfoFileName(
 		    version, prefix, postfix, basename,
-		    AS_miraparams[0].getAssemblyParams().as_outfile_stats_debrislist,
+		    AS_miraparams[0].getAssemblyParams().as_outfile_stats_debrislist, 
 		    ".txt"));
 
   cout << "Saving debris list to file: " << filename << endl;
   ofstream fout(filename.c_str(), ios::out | ios::trunc);
-
+  
   for(uint32 i=0; i< AS_readpool.size(); i++){
     if(AS_isdebris[i]) {
-      fout << AS_readpool.getRead(i).getName();
-      switch(AS_isdebris[i]) {
-      case DEBRIS_NOTDEBRIS : {
-	// NOP, can never happen but quieten compiler warning
-	break;
-      }
-      case DEBRIS_SHORTONLOAD : {
-	fout << "\tSHORTONLOAD\n";
-	break;
-      }
-      case DEBRIS_UNSPECIFIED : {
-	fout << "\tUNSPECIFIED\n";
-	break;
-      }
-      case DEBRIS_NOOVERLAP : {
-	fout << "\tNO_OVERLAP\n";
-	break;
-      }
-      case DEBRIS_MEGAHUB : {
-	fout << "\tFILTER_MEGAHUB\n";
-	break;
-      }
-      case DEBRIS_MASKEDNASTYREPEAT : {
-	fout << "\tMASKED_NASTY_REPEAT\n";
-	break;
-      }
-      case DEBRIS_MASKEDHAF7REPEAT : {
-	fout << "\tMASKED_HAF7_REPEAT\n";
-	break;
-      }
-      case DEBRIS_MASKEDHAF6REPEAT : {
-	fout << "\tMASKED_HAF6_REPEAT\n";
-	break;
-      }
-      case DEBRIS_NOTMAPPED : {
-	fout << "\tNOT_MAPPED\n";
-	break;
-      }
-      case DEBRIS_ABORTEDCONTIGCREATION : {
-	fout << "\tABORTED_CONTIG_CREATION\n";
-	break;
-      }
-      case DEBRIS_TINYCONTIG : {
-	fout << "\tTINY_CONTIG\n";
-	break;
-      }
-      case DEBRIS_TINYCLUSTER : {
-	fout << "\tTINY_CLUSTER\n";
-	break;
-      }
-      case DEBRIS_TINYCLUSTERORPHAN : {
-	fout << "\tTINY_CLUSTER_ORPHAN\n";
-	break;
-      }
-      case DEBRIS_UNSAVEDSINGLET : {
-	fout << "\tUNSAVED_SINGLET\n";
-	break;
-      }
-      case DEBRIS_DIGITAL_NORMALISATION : {
-	fout << "\tDIGITAL_NORMALISATION\n";
-	break;
-      }
-      case DEBRIS_CLIP_BADSOLEXAEND : {
-	fout << "\tCLIP_BAD_SOLEXA_END\n";
-	break;
-      }
-      case DEBRIS_CLIP_KNOWNADAPTORRIGHT : {
-	fout << "\tCLIP_KNOWNADAPTORRIGHT\n";
-	break;
-      }
-      case DEBRIS_CLIP_QUALMINTHRESHOLD : {
-	fout << "\tCLIP_QUALMINTHRESHOLD\n";
-	break;
-      }
-      case DEBRIS_CLIP_LOWERCASEFRONT : {
-	fout << "\tCLIP_LOWERCASEFRONT\n";
-	break;
-      }
-      case DEBRIS_CLIP_LOWERCASEBACK : {
-	fout << "\tCLIP_LOWERCASEBACK\n";
-	break;
-      }
-      case DEBRIS_CLIP_QUALCLIPS : {
-	fout << "\tCLIP_QUALCLIPS\n";
-	break;
-      }
-      case DEBRIS_CLIP_MASKEDBASES : {
-	fout << "\tCLIP_MASKEDBASES\n";
-	break;
-      }
-      case DEBRIS_CLIP_BADSEQUENCESERACH : {
-	fout << "\tCLIP_BADSEQUENCESERACH\n";
-	break;
-      }
-      case DEBRIS_CLIP_POLYBASEATEND : {
-	fout << "\tCLIP_POLYBASEATEND\n";
-	break;
-      }
-      case DEBRIS_CLIP_POLYAT : {
-	fout << "\tCLIP_POLYAT\n";
-	break;
-      }
-      case DEBRIS_CLIP_MINLEFTCLIP : {
-	fout << "\tCLIP_MINLEFTCLIP\n";
-	break;
-      }
-      case DEBRIS_CLIP_MINRIGHTCLIP : {
-	fout << "\tCLIP_MINRIGHTCLIP\n";
-	break;
-      }
-      case DEBRIS_CLIP_PHIX174 : {
-	fout << "\tCLIP_PHIX174\n";
-	break;
-      }
-      case DEBRIS_CLIP_PROPOSEDENDCLIP : {
-	fout << "\tCLIP_PROPOSEDENDCLIP\n";
-	break;
-      }
-      case DEBRIS_CLIP_CHIMERA : {
-	fout << "\tCLIP_CHIMERA\n";
-	break;
-      }
-      case DEBRIS_CLIP_TERMINALLYINCORRECTIBLEORCHIMERA : {
-	fout << "\tCLIP_TERMINALLYINCORRECTIBLEORCHIMERA\n";
-	break;
-      }
-      case DEBRIS_CLIP_INCORRECTIBLEENDORCHIMERA : {
-	fout << "\tCLIP_INCORRECTIBLEENDORCHIMERA\n";
-	break;
-      }
-      default : {
-	fout << "\tNO_CODE_YET?_" << static_cast<uint16>(AS_isdebris[i]) << "\n";
-      }
-      }
+      fout << AS_readpool.getRead(i).getName() << '\n';
     }
   }
   fout.close();
-
+  
   FUNCEND();
 }
 
@@ -1837,7 +2063,7 @@ string Assembly::getReadTagListFilename(int32 version, const string & prefix, co
 {
   return buildDefaultInfoFileName(
     version, prefix, postfix, basename,
-    AS_miraparams[0].getAssemblyParams().as_outfile_stats_readtags,
+    AS_miraparams[0].getAssemblyParams().as_outfile_stats_readtags, 
     ".txt");
 }
 
@@ -1859,7 +2085,7 @@ string Assembly::getConsensusTagListFilename(int32 version, const string & prefi
 {
    return buildDefaultInfoFileName(
      version, prefix, postfix, basename,
-     AS_miraparams[0].getAssemblyParams().as_outfile_stats_contigtags,
+     AS_miraparams[0].getAssemblyParams().as_outfile_stats_contigtags, 
      ".txt");
 }
 
@@ -1883,7 +2109,7 @@ void Assembly::saveSNPList(int32 version, const string & prefix, const string &
 {
   string filename(buildDefaultInfoFileName(
 		    version, prefix, postfix, basename,
-		    AS_miraparams[0].getAssemblyParams().as_outfile_stats_snpanalysis,
+		    AS_miraparams[0].getAssemblyParams().as_outfile_stats_snpanalysis, 
 		    ".txt"));
   assout::saveSNPList(AS_contigs,filename,deleteoldfile);
 }
@@ -1911,8 +2137,8 @@ void Assembly::saveFeatureAnalysis(int32 version, const string & prefix, const s
   if(faname.size()){
     filenamea=buildFileName(version, prefix, postfix, faname, ".txt");
   }else{
-    filenamea=buildFileName(version, prefix, postfix,
-			    AS_miraparams[0].getAssemblyParams().as_outfile_stats_featureanalysis,
+    filenamea=buildFileName(version, prefix, postfix, 
+			    AS_miraparams[0].getAssemblyParams().as_outfile_stats_featureanalysis, 
 			    ".txt",
 			   dirname);
   }
@@ -1921,8 +2147,8 @@ void Assembly::saveFeatureAnalysis(int32 version, const string & prefix, const s
   if(fsname.size()){
     filenames=buildFileName(version, prefix, postfix, fsname, ".txt");
   }else{
-    filenames=buildFileName(version, prefix, postfix,
-			    AS_miraparams[0].getAssemblyParams().as_outfile_stats_featuresummary,
+    filenames=buildFileName(version, prefix, postfix, 
+			    AS_miraparams[0].getAssemblyParams().as_outfile_stats_featuresummary, 
 			    ".txt",
 			   dirname);
   }
@@ -1931,8 +2157,8 @@ void Assembly::saveFeatureAnalysis(int32 version, const string & prefix, const s
   if(fcname.size()){
     filenamec=buildFileName(version, prefix, postfix, fcname, ".txt");
   }else{
-    filenamec=buildFileName(version, prefix, postfix,
-			    AS_miraparams[0].getAssemblyParams().as_outfile_stats_featuresequences,
+    filenamec=buildFileName(version, prefix, postfix, 
+			    AS_miraparams[0].getAssemblyParams().as_outfile_stats_featuresequences, 
 			    ".txt",
 			   dirname);
   }
@@ -1956,7 +2182,7 @@ string Assembly::getFASTAFilename(int32 version, const string & prefix, const st
 {
   return buildDefaultResultsFileName(
     version, prefix, postfix, basename,
-    AS_miraparams[0].getAssemblyParams().as_outfile_FASTAUNPADDED,
+    AS_miraparams[0].getAssemblyParams().as_outfile_FASTA,
     ".fasta");
 }
 string Assembly::getFASTAPaddedFilename(int32 version, const string & prefix, const string & postfix, const string & basename)
@@ -1994,7 +2220,7 @@ void Assembly::saveStrainsAsFASTAQUAL(int32 version, const string & prefix, cons
 			      filename,
 			      false,0,0,
 			      deleteoldfile);
-
+  
   FUNCEND();
 }
 
@@ -2136,7 +2362,7 @@ void Assembly::saveAsWiggle(int32 version, const string & prefix, const string &
   FUNCSTART("void Assembly::saveAsWiggle(int32 version, const string & prefix, const string & postfix, const string & basename, bool deleteoldfile)");
 
   string filename(getWiggleFilename(version, prefix, postfix, basename));
-  assout::saveAsWiggle(AS_contigs,filename,deleteoldfile,false);
+  assout::saveAsWiggle(AS_contigs,filename,deleteoldfile);
 
   FUNCEND();
 }
@@ -2196,3 +2422,6 @@ void Assembly::saveAsHTML(int32 version, const string & prefix, const string & p
 
   FUNCEND();
 }
+
+
+
diff --git a/src/mira/assembly_misc.C b/src/mira/assembly_misc.C
deleted file mode 100644
index ddd7520..0000000
--- a/src/mira/assembly_misc.C
+++ /dev/null
@@ -1,2373 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
- *   Krebsforschungszentrum, DKFZ Heidelberg) and Bastien Chevreux
- * Copyright (C) 2000 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-// functions to process reads
-// currently in namespace and object assembly
-
-
-#include <boost/regex.hpp>
-#include <boost/filesystem.hpp>
-#include <boost/algorithm/string.hpp>
-#include <boost/lexical_cast.hpp>
-
-#include <boost/format.hpp>
-
-
-#include "util/progressindic.H"
-
-#include "mira/assembly.H"
-#include "mira/align.H"
-#include "mira/ads.H"
-#include "mira/dataprocessing.H"
-#include "mira/hashstats.H"
-
-
-using namespace std;
-
-
-//#define CEBUG(bla)   {if(CEBUGFLAG) {cout << bla; cout.flush();}}
-#define CEBUG(bla)
-
-
-
-
-//#define CEBUG(bla)   {if(id1==2282 && id2==342) {cout << bla; cout.flush();}}
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-//#define CEBUG(bla)   {cout << bla;}
-
-
-
-
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-
-template<class TVHASH_T>
-void Assembly::priv_phahelper(const string & filenameforkms, const string & signalfile, uint32 basesperhash, bool rarekmerfinalkill, int32 version, const string prefix, const string postfix, const string logname)
-{
-  FUNCSTART("void Assembly::priv_phahelper(uint32 basesperhash, bool rarekmerfinalkill, int32 version, const string prefix, const string postfix, const string logname)");
-
-  assembly_parameters const & as_fixparams= AS_miraparams[0].getAssemblyParams();
-  skim_parameters const & skim_params= AS_miraparams[0].getSkimParams();
-  hashstatistics_parameters const & hs_params= AS_miraparams[0].getHashStatisticsParams();
-
-  // BaCh 22.04.2013: MNR tags are now always deleted by assignReadBaseStatistics(), so must be also re-set
-  uint32 nastyrepeatratio=hs_params.hs_nastyrepeatratio;;
-  uint32 nastyrepeatcoverage=hs_params.hs_nastyrepeatcoverage;
-  bool masknastyrepeats=hs_params.hs_masknastyrepeats;
-  // but no masking if diginorm had already been applied
-  if(nastyrepeatratio>0
-     && hs_params.hs_masknastyrepeats
-     && hs_params.hs_apply_digitalnormalisation
-     && version>AS_applydiginorminpass){
-    nastyrepeatratio=0;
-    nastyrepeatcoverage=0;
-    masknastyrepeats=false;
-    cout << "Masking of nasty repeats switched of as diginorm already ran.\n";
-  }
-
-  HashStatistics<TVHASH_T> s3;
-  string loadhsfn;
-  {
-    bool dosdbgchimera=AS_miraparams[0].getAssemblyParams().as_clip_sdbg_chimeradetection && basesperhash>25;
-    bool dosdbgedit=AS_miraparams[0].getEditParams().ed_sdbg_readedit;
-
-    s3.setHashFrequencyRatios(hs_params.hs_freqest_minnormal,
-			      hs_params.hs_freqest_maxnormal,
-			      hs_params.hs_freqest_repeat,
-			      hs_params.hs_freqest_heavyrepeat,
-			      hs_params.hs_freqest_crazyrepeat,
-			      2,                                  // rare kmer count: occurence <= that can be masked away later by rare kmer masking
-			      nastyrepeatratio,
-			      nastyrepeatcoverage);
-
-    s3.setAvgHashFreqMinimum(hs_params.hs_freq_covestmin);
-
-    bool havestats=false;
-    if(!signalfile.empty() && fileExists(signalfile)){
-      //cout << "XXX signal file exists " << signalfile << ", loading " << filenameforkms << endl;
-      s3.loadHashStatistics(filenameforkms);
-      loadhsfn=filenameforkms;
-      havestats=true;
-    }
-
-    if(!havestats){
-      loadhsfn=filenameforkms;
-      //cout << "XXX no stats, setting " << loadhsfn << endl;
-
-      uint32 rkfkval=0;
-      if(rarekmerfinalkill) rkfkval=hs_params.hs_rare_kmer_final_kill;
-
-      // if we do a chimera search OR some SDBG edits, do NOT take rails in to the
-      //  calculation of hash statistics! These rails could have come from a "wrong"
-      //  backbone and therefore led to wrong chimera recognition or read edits!
-      // if neither is done, we can take the rails as "maybe, possibly true" to help in
-      //  areas difficult for sequencing (e.g. GGCxG in Illuminas)
-      bool alsorailsinhs=!(dosdbgchimera | dosdbgedit);
-
-      s3.prepareHashStatistics(AS_readpool,
-			       true,
-			       alsorailsinhs,
-			       true,
-			       as_fixparams.as_clip_pec_mkfr,   // TODO: ok to misuse pec_mkfr or needs own parameter?
-			       rkfkval, // TODO: setting it here also influences SDBG routines. TODO: check if not wanted: filter afterwards
-			       basesperhash,
-			       hs_params.hs_million_hashes_per_buffer,
-			       filenameforkms,
-			       AS_miraparams[0].getDirectoryParams().dir_tmp
-	);
-      if(!signalfile.empty()){
-	ofstream sout(signalfile);
-      }
-    }
-    s3.showHashStatisticsInfo();
-
-    if(dosdbgchimera){
-      uint32 trimfreq=3;
-      auto avghashfreq=s3.getAvgHashFreqRaw();
-      if(avghashfreq>60) trimfreq=4;
-      if(avghashfreq>80) trimfreq=5;
-      // version is pass ... have at least trimfreq = 4 on third pass and after
-      if(version>=3 && trimfreq<4) trimfreq=4;
-
-      if(basesperhash<25 && trimfreq<5) trimfreq=1;
-
-      string tmpfname;
-      tmpfname=buildFileName(0,"","",
-			    as_fixparams.as_tmpf_clippings,
-			     ".txt","",false);
-      AS_dataprocessing.startLogging(tmpfname,false);
-      cout << "Hunting down chimeras:\n";
-      auto hits=AS_dataprocessing.performSDBGChimeraSearch_Pool(AS_readpool,s3,trimfreq,&AS_debrisreason,"HA-"+boost::lexical_cast<string>(basesperhash));
-      cout << "\nHA-" << basesperhash << " chimera trophy count: " << hits << endl;
-
-      cout << "Reloading statistics 1 " << loadhsfn << " ... "; cout.flush();
-      s3.discard();
-      s3.loadHashStatistics(loadhsfn);
-      cout << "done.\n";
-    }
-    if(dosdbgedit){
-      cout << "Performing HA SDBG edits:\n";
-      auto trimfreq=1;  // trimfreq==1 -> very conservative
-      if(version>=2) trimfreq=2;
-
-      // more liberal edits not for EST/RNASEq (low coverage variants!)
-      if(!AS_miraparams[0].getPathfinderParams().paf_use_genomic_algorithms){
-	if(version>=4) trimfreq=3;
-	if(version>=5) trimfreq=4;
-      }
-      auto hits=AS_dataprocessing.performSDBGEdits_Pool(AS_readpool,s3,trimfreq);
-      cout << "\nHA SDBG edited reads: " << hits << endl;
-      cout << "Reloading statistics 2 " << loadhsfn << " ... "; cout.flush();
-      s3.discard();
-      s3.loadHashStatistics(loadhsfn);
-      cout << "done.\n";
-    }
-
-    // for EST (especially RNASeq): way to be less harsh for chimerakilling
-    if(dosdbgchimera
-       && basesperhash>=17 && basesperhash<=64
-       && !AS_miraparams[0].getPathfinderParams().paf_use_genomic_algorithms){
-
-      if(AS_estnochimerakill.empty()){
-	AS_estnochimerakill.resize(AS_readpool.size(),0);
-      }
-
-      auto oldhssize=s3.getNumHashEntries();
-      s3.trimHashStatsByFrequencyANDOR(3,3,3); // trim for "at least three values" (fwd/rev don't care)
-
-      cout << "Assigning statistics values (2):\n";
-      if(AS_miraparams[0].getAssemblyParams().as_dateoutput) dateStamp(cout);
-      s3.assignReadBaseStatistics_MultiThread(AS_readpool,skim_params.sk_numthreads, false,
-					      0,     // kmerforks: minkmer=0, so take everything!
-					      false  // kmerforks: we don't need fwd/rev, relaxed
-	);
-      if(AS_miraparams[0].getAssemblyParams().as_dateoutput) dateStamp(cout);
-
-      // method: look for gaps in valid status (excluding endgaps)
-      // if none, perfect, set flag so that read will not be killed via invalid kmer ends
-      for(size_t rpi=0; rpi<AS_readpool.size(); ++rpi){
-	auto & actread=AS_readpool[rpi];
-	CEBUG("noestkill check " << actread.getName() << endl);
-	if(actread.getLenClippedSeq() < basesperhash) continue;
-
-	int32 xpos=actread.getLeftClipoff();
-	bool hasvalid=false;
-	bool hasgap=false;
-	auto bhsI=actread.getBPosHashStats().cbegin();
-	bhsI+=xpos;
-	auto bhsE=bhsI+actread.getLenClippedSeq()-basesperhash+1;
-	// look for first valid
-	for(; bhsI!=bhsE; ++bhsI){
-	  if(bhsI->fwd.isValid()) {
-	    hasvalid=true;
-	    CEBUG("noestkill valid1 at " << (bhsI-actread.getBPosHashStats().cbegin()) << endl);
-	    break;
-	  }
-	}
-	// look for first non-valid
-	for(; bhsI!=bhsE; ++bhsI){
-	  if(!bhsI->fwd.isValid()) {
-	    CEBUG("noestkill invalid at " << (bhsI-actread.getBPosHashStats().cbegin()) << endl);
-	    ++bhsI;
-	    break;
-	  }
-	}
-	// look for first valid
-	for(; bhsI!=bhsE; ++bhsI){
-	  if(bhsI->fwd.isValid()) {
-	    hasgap=true;
-	    CEBUG("noestkill gap end detect at " << (bhsI-actread.getBPosHashStats().cbegin()) << endl);
-	    break;
-	  }
-	}
-	CEBUG("noestkill check result " << hasvalid << " " << hasgap << endl);
-	CEBUG(""; Read::setCoutType(Read::AS_TEXT); cout << actread);
-	if(hasvalid && !hasgap){
-	  CEBUG("noestkill OK " << AS_readpool[rpi].getName() << endl);
-	  AS_estnochimerakill[rpi]=1;
-	}
-      }
-
-      if(AS_miraparams[0].getAssemblyParams().as_dateoutput) dateStamp(cout);
-
-      if(s3.getNumHashEntries() != oldhssize){
-	cout << "Reloading statistics 3 " << loadhsfn << " ... "; cout.flush();
-	s3.discard();
-	s3.loadHashStatistics(loadhsfn);
-	cout << "done.\n";
-	if(AS_miraparams[0].getAssemblyParams().as_dateoutput) dateStamp(cout);
-      }
-    }
-
-    // very rough estimator of coverage for contigs
-    if(basesperhash>=15){
-      AS_hashstat_avghashfreq=s3.getAvgHashFreqRaw();
-      cout << "Estimator of average coverage: " << (AS_hashstat_avghashfreq+basesperhash)/3 << endl;
-      AS_assemblyinfo.setLargeContigCovForStats((AS_hashstat_avghashfreq+basesperhash)/3);
-    }
-
-    cout << "Assigning statistics values (3):\n";
-    if(AS_miraparams[0].getAssemblyParams().as_dateoutput) dateStamp(cout);
-    {
-      uint32 mincountkmerforks=3;
-      if(AS_miraparams[0].getPathfinderParams().paf_use_genomic_algorithms){
-	mincountkmerforks=AS_hashstat_avghashfreq/6; // /6 to conservative?? TODO: check as HashStat now does fwd and rev separately!
-	if(mincountkmerforks<3) mincountkmerforks=3;
-      }
-      s3.assignReadBaseStatistics_MultiThread(AS_readpool, skim_params.sk_numthreads, masknastyrepeats,
-					      mincountkmerforks,
-					      true                   // kmerforks: need fwd/rev
-	);
-    }
-    if(AS_miraparams[0].getAssemblyParams().as_dateoutput) dateStamp(cout);
-
-    AS_dataprocessing.buntifyReadsByHashFreq_Pool(AS_readpool,basesperhash);
-    if(basesperhash>=17){
-      AS_dataprocessing.addKMerForkTags_Pool(AS_readpool,basesperhash);
-    }
-  }
-
-  if(0){
-    cout << "AFTER\n";
-    for(uint32 actid=0; actid<AS_readpool.size(); ++actid){
-      Read & r=AS_readpool[actid];
-      Read::setCoutType(Read::AS_TEXT);
-      if(1 || r.getName()=="mictbac_bg:1:2101:20987:13472"
-         ){
-        cout << r;
-      }
-    }
-    exit(999);
-  }
-
-  //if(nastyrepeatratio){
-  if(hs_params.hs_repeatlevel_in_infofile){
-    string filename;
-
-    if(logname.size()){
-      filename=buildFileName(version, prefix, postfix, logname, "");
-    }else{
-      //filename=buildFileName(version, prefix, postfix,
-      //			     as_fixparams.as_outfile_stats_readrepeats,
-      //			     ".lst");
-
-      //filename=buildDefaultInfoFileName(version, prefix, postfix,
-      filename=buildDefaultInfoFileName(-1, "", "",
-					"",
-					as_fixparams.as_outfile_stats_readrepeats,
-					".lst",
-					true);
-    }
-
-    cout << "Writing read repeat info to: " << filename << " ... ";
-    cout.flush();
-
-    uint32 howmanys=0;
-    uint32 howmanyt=0;
-    uint32 repanalysislevel=hs_params.hs_repeatlevel_in_infofile;
-    if(repanalysislevel<5) repanalysislevel=5;
-    if(repanalysislevel>8) repanalysislevel=8;
-
-    ofstream fout;
-    fout.open(filename.c_str(), ios::out|ios::trunc);
-    for(uint32 rpi=0; rpi<AS_readpool.size(); rpi++){
-      Read & actread= AS_readpool.getRead(rpi);
-      if(!actread.hasValidData()
-	 || !actread.isUsedInAssembly()) continue;
-      bool mustshow=false;
-      if(actread.hasTag(Read::REA_tagentry_idHAF5,-1)) {
-	if(repanalysislevel==5) mustshow=true;
-      }else if(actread.hasTag(Read::REA_tagentry_idHAF6,-1)) {
-	if(repanalysislevel<=6) mustshow=true;
-      }else if(actread.hasTag(Read::REA_tagentry_idHAF7,-1)) {
-	if(repanalysislevel<=7) mustshow=true;
-      }else if(actread.hasTag(Read::REA_tagentry_idMNRr,-1)) {
-	if(repanalysislevel<=8) mustshow=true;
-      }
-      if(mustshow){
-	bool countedthisseq=false;
-	for(uint32 tn=0; tn<actread.getNumOfTags(); tn++){
-	  const multitag_t & acttag=actread.getTag(tn);
-	  if(acttag.to-acttag.from +1 >= basesperhash){
-	    mustshow=false;
-	    if(acttag.identifier==Read::REA_tagentry_idHAF5) {
-	      if(repanalysislevel==5) mustshow=true;
-	    }else if(acttag.identifier==Read::REA_tagentry_idHAF6) {
-	      if(repanalysislevel<=6) mustshow=true;
-	    }else if(acttag.identifier==Read::REA_tagentry_idHAF7) {
-	      if(repanalysislevel<=7) mustshow=true;
-	    }else if(acttag.identifier==Read::REA_tagentry_idMNRr) {
-	      if(repanalysislevel<=8) mustshow=true;
-	    }
-	    if(mustshow){
-	      if(!countedthisseq){
-		countedthisseq++;
-		++howmanys;
-	      }
-	      ++howmanyt;
-	      fout << actread.getName() << '\t'
-		   << acttag.getIdentifierStr() << '\t';
-	      for(uint32 readpos=acttag.from; readpos<=acttag.to; readpos++){
-		fout << static_cast<char>(toupper(actread.getBaseInSequence(readpos)));
-	      }
-	      fout << '\n';
-	    }
-	  }
-	}
-      }
-    }
-
-    cout << howmanys << " sequences with " << howmanyt << " masked stretches." << endl;
-  }
-
-  // quick check for estimated coverage in genome data
-  if(!AS_donequickdenovocoveragecheck){
-    // atm only for de-novo, think about doing it for mapping
-    // (though there may be good reasons for high coverage in mappings)
-    if(basesperhash>=17
-       && warnAtHighCoverages(AS_hashstat_avghashfreq)
-       && AS_miraparams[0].getNagAndWarnParams().nw_check_coverage==NWSTOP){
-      MIRANOTIFY(Notify::FATAL,"High average coverage detected, see output log above respectively the 'WARNING' files in the info directory for more information. In case you wish to force MIRA to disregard this safety check, consider using '-NW:cac=warn' or '-NW:cac=no'");
-    }
-    AS_donequickdenovocoveragecheck=true;
-  }
-
-  if(0){
-    AS_dataprocessing.performKMERRepeatTagging_Pool(AS_readpool,basesperhash);
-  }
-
-  if(0){
-    Read::setCoutType(Read::AS_TEXT);
-    cout << "AFTER2\n";
-    for(uint32 actid=0; actid<AS_readpool.size(); ++actid){
-      Read & r=AS_readpool.getRead(actid);
-      cout << r;
-    }
-    exit(999);
-  }
-
-  if(hs_params.hs_masknastyrepeats && hs_params.hs_apply_digitalnormalisation){
-    if(version==AS_applydiginorminpass){
-      if(as_fixparams.as_dateoutput) dateStamp(cout);
-      cout << "Performing digital normalisation: "; cout.flush();
-      AS_dataprocessing.performDigitalNormalisation_Pool(AS_readpool,s3,&AS_debrisreason);
-      cout << "done\n";
-      if(as_fixparams.as_dateoutput) dateStamp(cout);
-    }
-    // also for later steps: if a read has diginorm data, throw out MNRr tags
-    for(uint32 rpi=0; rpi<AS_readpool.size(); ++rpi){
-      auto & actread=AS_readpool[rpi];
-      if(actread.hasTag(Read::REA_tagentry_idDGNr)) actread.deleteTag(Read::REA_tagentry_idMNRr);
-    }
-  }
-
-  return;
-}
-//#define CEBUG(bla)
-
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-void Assembly::priv_performHashAnalysis(const string & kmerfilename, bool usesignal, bool rarekmerfinalkill, int32 version, const string prefix, const string postfix, const string logname)
-{
-  FUNCSTART("void Assembly::performHashAnalysis()");
-
-  uint32 basesperhash=AS_miraparams[0].getSkimParams().sk_basesperhash;
-
-  string filenameforkms;
-  string signalfile;
-  if(kmerfilename.empty()){
-    filenameforkms=buildFileName(version, prefix, postfix,
-				 AS_miraparams[0].getAssemblyParams().as_tmpf_kmerstatistics,
-				 ".mhs.gz");
-  }else{
-    filenameforkms=kmerfilename;
-  }
-
-  if(usesignal){
-    signalfile=buildFileName(version, prefix, postfix,
-			     AS_miraparams[0].getAssemblyParams().as_tmpf_signal_kmerstats,
-			     ".ok");
-  }
-
-  if(basesperhash<=32){
-    priv_phahelper<vhash64_t>(filenameforkms,signalfile,basesperhash,rarekmerfinalkill,version,prefix,postfix,logname);
-  }else if(basesperhash<=64){
-    priv_phahelper<vhash128_t>(filenameforkms,signalfile,basesperhash,rarekmerfinalkill,version,prefix,postfix,logname);
-  }else if(basesperhash<=128){
-    priv_phahelper<vhash256_t>(filenameforkms,signalfile,basesperhash,rarekmerfinalkill,version,prefix,postfix,logname);
-  }else if(basesperhash<=256){
-    priv_phahelper<vhash512_t>(filenameforkms,signalfile,basesperhash,rarekmerfinalkill,version,prefix,postfix,logname);
-  }else{
-    MIRANOTIFY(Notify::FATAL,"Cannot perform a hash analysis with -SK:bph > 256 (you used " << basesperhash << "), though MIRA should've failed earlier, I admit.\n");
-  }
-
-  //CEBUG("BEFORE\n");
-  //for(uint32 actid=0; actid<AS_readpool.size(); actid++){
-  //  Read & r=AS_readpool.getRead(actid);
-  //  r.integrityCheck();
-  //  Read::setCoutType(Read::AS_TEXT);
-  //  cout << r;
-  //}
-
-
-  if(AS_logflag_dumphashanalysis){
-    string logfilename=buildFileName(version, "", "",
-				     "elog.dp.hashanalysis_pass",
-				     ".lst");
-    //string logfilename=AS_miraparams[0].getDirectoryParams().dir_tmp+"/elog.dp.hashanalysis.lst";
-
-    cout << "elog hashan: " << logfilename << endl;
-    ofstream logfout;
-    logfout.open(logfilename.c_str(), ios::out|ios::trunc);
-
-    for(uint32 rpi=0; rpi<AS_readpool.size(); rpi++){
-      Read::setCoutType(Read::AS_TEXT);
-      logfout << AS_readpool[rpi];
-    }
-  }
-
-  FUNCEND();
-  return;
-}
-
-
-
-
-
-
-
-
-
-/*************************************************************************
- *
- * expects reads to have baseflags set  (by performHashAnalysis())
- *
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-
-// switch left/right?
-// perform twice, then look for better?
-//rs_pecimp2 rs:2108:4766:166384/1
-
-
-
-uint64 Assembly::performNewProposedCutbackClips(const string & logname, const string & logprefix)
-{
-  FUNCSTART("void Assembly::performProposedCutbackClips(const string & logname, const string & logprefix)");
-
-  bool dopec=false;
-  bool dorarekmermask=false;
-  for(auto mpi=1; mpi < AS_miraparams.size(); ++mpi){
-    dopec|=AS_seqtypespresent[mpi] && AS_miraparams[mpi].getAssemblyParams().as_clip_proposeendclips;
-    dorarekmermask|=AS_seqtypespresent[mpi] && AS_miraparams[mpi].getAssemblyParams().as_clipmask_rarekmers;
-  }
-
-  bool dosdbgchimera=AS_miraparams[0].getAssemblyParams().as_clip_sdbg_chimeradetection;
-  bool dosdbgedit=AS_miraparams[0].getEditParams().ed_sdbg_readedit;
-
-  if(!dopec && !dosdbgchimera&& !dosdbgedit && !dorarekmermask) return 0;
-
-  cout << "Hash analysis for ";
-  {
-    bool needand=false;;
-    if(dopec) {
-      cout << "proposed cutbacks";
-      needand=true;
-    }
-    if(dosdbgchimera) {
-      if(needand) cout << " and ";
-      needand=true;
-      cout << "chimera search";
-    }
-    if(dosdbgedit) {
-      if(needand) cout << " and ";
-      needand=true;
-      cout << "read editing";
-    }
-    if(dorarekmermask) {
-      if(needand) cout << " and ";
-      cout << "rare kmer masking";
-    }
-    cout << ":\n";
-  }
-
-  ofstream logfout;
-  if(!logname.empty()){
-    logfout.open(logname.c_str(), ios::out|ios::app);
-    if(!logfout){
-      MIRANOTIFY(Notify::FATAL, "Could not open log for appending: " << logname << "\nPossible causes: Disk full? Changed permissions? Directory deleted?");
-    }
-  }
-
-  skim_parameters const & skim_params= AS_miraparams[0].getSkimParams();
-  assembly_parameters const & as_fixparams= AS_miraparams[0].getAssemblyParams();
-  hashstatistics_parameters const & hs_params= AS_miraparams[0].getHashStatisticsParams();
-
-  uint32 basesperhash=as_fixparams.as_clip_pec_basesperhash;
-  if(basesperhash > 32) {
-    MIRANOTIFY(Notify::FATAL,"-CL:pecbph can run only with up to 32, you set it to " << basesperhash << ". MIRA should've warned earlier though.\n");
-  }
-
-  {
-    string merfile(AS_miraparams[0].getDirectoryParams().dir_tmp+"/peckmerstat.mhs.gz");
-    HashStatistics<vhash64_t> s3;
-
-    s3.setHashFrequencyRatios(hs_params.hs_freqest_minnormal,
-			      hs_params.hs_freqest_maxnormal,
-			      hs_params.hs_freqest_repeat,
-			      hs_params.hs_freqest_heavyrepeat,
-			      hs_params.hs_freqest_crazyrepeat,
-			      2,                                  // rare kmer count: occurence <= that can be masked away later by rare kmer masking
-			      hs_params.hs_nastyrepeatratio,
-			      hs_params.hs_nastyrepeatcoverage);
-
-    string filenameforks(merfile);
-
-    // if we do a chimera search OR some SDBG edits, do NOT take rails in to the
-    //  calculation of hash statistics! These rails could have come from a "wrong"
-    //  backbone and therefore led to wrong chimera recognition or read edits!
-    // if neither is done, we can take the rails as "maybe, possibly true" to help in
-    //  areas difficult for sequencing (e.g. GGCxG in Illuminas)
-    bool alsorailsinhs=!(dosdbgchimera | dosdbgedit);
-
-    s3.prepareHashStatistics(AS_readpool,
-			     true,
-			     alsorailsinhs,
-			     true,
-			     as_fixparams.as_clip_pec_mkfr,
-			     as_fixparams.as_clip_pec_mtk, // rare kmer early kill
-			     basesperhash,
-			     hs_params.hs_million_hashes_per_buffer,
-			     filenameforks,
-			     AS_miraparams[0].getDirectoryParams().dir_tmp
-      );
-    s3.showHashStatisticsInfo();
-
-    auto avghashfreq=s3.getAvgHashFreqRaw();
-
-    // do this before assigning read statistics
-    // chimera would be OK after, but performing SDBG edits currently trashes *ALL* read tags!
-    if(dosdbgchimera || dosdbgedit){
-      if(dosdbgchimera){
-	uint32 trimfreq=3;
-	if(avghashfreq>60) trimfreq=4;
-	if(avghashfreq>80) trimfreq=5;
-
-	string tmpfname;
-	tmpfname=buildFileName(0,"","",
-			       as_fixparams.as_tmpf_clippings,
-			       ".txt","",false);
-	AS_dataprocessing.startLogging(tmpfname,false);
-	cout << "Hunting down chimeras:\n";
-	auto hits=AS_dataprocessing.performSDBGChimeraSearch_Pool(AS_readpool,s3,trimfreq,&AS_debrisreason,"PEC");
-	cout << "\nPEC chimera trophy count: " << hits << endl;
-	AS_dataprocessing.stopLogging();
-
-	BUGIFTHROW(AS_current_rls_byrg.size() != ReadGroupLib::getNumReadGroups(), "AS_current_rls_byrg.size() " << AS_current_rls_byrg.size() << " != ReadGroupLib::getNumReadGroups() " << ReadGroupLib::getNumReadGroups() << " ???");
-	BUGIFTHROW(AS_current_rls_bytype.size() != ReadGroupLib::getNumSequencingTypes(), "AS_current_rls_bytype.size() " << AS_current_rls_bytype.size() << " != ReadGroupLib::getNumSequencingTypes() " << ReadGroupLib::getNumSequencingTypes() << " ???");
-
-	for(auto & rls : AS_current_rls_bytype){
-	  rls.RLS_count_chimera=0;
-	}
-	for(auto & rls : AS_current_rls_byrg){
-	  rls.RLS_count_chimera=0;
-	}
-	for(uint32 rid=0; rid<AS_readpool.size(); ++rid){
-	  if(AS_debrisreason[rid]==DEBRIS_CLIP_CHIMERA){
-	    auto rgid=AS_readpool[rid].getReadGroupID().getLibId();
-	    ++AS_current_rls_byrg[rgid].RLS_count_chimera;
-	    ++AS_current_rls_bytype[AS_readpool[rid].getSequencingType()].RLS_count_chimera;
-	  }
-	}
-
-	if(AS_miraparams[0].getAssemblyParams().as_dateoutput) dateStamp(cout);
-	cout << "Reloading statistics 3 " << merfile << " ... "; cout.flush();
-	s3.discard();
-	s3.loadHashStatistics(merfile);
-	cout << "done.\n";
-	if(AS_miraparams[0].getAssemblyParams().as_dateoutput) dateStamp(cout);
-      }
-      if(dosdbgedit){
-	cout << "Performing PEC SDBG edits:\n";
-	auto hits=AS_dataprocessing.performSDBGEdits_Pool(AS_readpool,s3,1); // trimfreq==1 -> very conservative
-	cout << "\nPEC SDBG edited reads: " << hits << endl;
-	if(AS_miraparams[0].getAssemblyParams().as_dateoutput) dateStamp(cout);
-	cout << "Reloading statistics 4 " << merfile << " ... "; cout.flush();
-	s3.discard();
-	s3.loadHashStatistics(merfile);
-	cout << "done.\n";
-	if(AS_miraparams[0].getAssemblyParams().as_dateoutput) dateStamp(cout);
-      }
-    }
-
-    cout << "Assigning statistics values (1):\n";
-    if(AS_miraparams[0].getAssemblyParams().as_dateoutput) dateStamp(cout);
-    s3.assignReadBaseStatistics_MultiThread(AS_readpool,skim_params.sk_numthreads, false,
-					    0,     // kmerforks: minkmer=0, so take everything!
-					    false  // kmerforks: we don't need fwd/rev, relaxed
-      );
-    if(AS_miraparams[0].getAssemblyParams().as_dateoutput) dateStamp(cout);
-
-    if(basesperhash>=17
-       && as_fixparams.as_clip_pec_mkfr <2){
-      if(AS_miraparams[0].getPathfinderParams().paf_use_genomic_algorithms
-	 && AS_seqtypespresent[ReadGroupLib::SEQTYPE_SOLEXA] && avghashfreq >=50){
-	// BaCh 11.04.2015: bad idea for projects with quite uneven coverage
-        //cout << "Detected probable higher coverage in Illumina genome project, setting: -CL:pmkfr=2\n";
-	//const_cast<assembly_parameters &>(as_fixparams).as_clip_pec_mkfr=2;
-      }
-    }
-
-    // quick check for estimated coverage in genome data
-    if(!AS_donequickdenovocoveragecheck){
-      // atm only for de-novo, think about doing it for mapping
-      // (though there may be good reasons for high coverage in mappings)
-      if(basesperhash>=17
-	 && warnAtHighCoverages(avghashfreq)
-	 && AS_miraparams[0].getNagAndWarnParams().nw_check_coverage==NWSTOP){
-	MIRANOTIFY(Notify::FATAL,"High average coverage detected, see output log above respectively the 'WARNING' files in the info directory for more information. In case you wish to force MIRA to disregard this safety check, consider using '-NW:cac=warn' or '-NW:cac=no'");
-      }
-      // Nope, do not set that here. The hash statistics of the main loop have the final word!
-      // AS_donequickdenovocoveragecheck=true;
-    }
-  }
-
-  if(as_fixparams.as_dateoutput) dateStamp(cout);
-  cout << '\n';
-
-  uint64 numbasesclipped=0;
-  if(dopec){
-    const static string ggcproblem("ggc");
-
-    cout << "Looking for proposed cutbacks ... "; cout.flush();
-    Read::setCoutType(Read::AS_TEXT);
-
-    uint32 cbleft=0;
-    uint32 cbright=0;
-    uint32 killed=0;
-    for(uint32 actid=0; actid<AS_readpool.size(); actid++){
-      Read & r=AS_readpool.getRead(actid);
-
-      if(r.hasValidData()
-	 && AS_miraparams[r.getSequencingType()].getAssemblyParams().as_clip_proposeendclips
-	 && r.hasBaseHashStats()
-	 && !(r.isBackbone()
-	      || r.isRail())){
-
-	CEBUG("lar " << r.getName() << " ");
-
-	bool hasbeenclipped=false;
-
-	uint32 oldlen=r.getLenClippedSeq();
-
-	{
-	  int32 lpos=r.getLeftClipoff();
-	  vector<Read::bposhashstat_t>::const_iterator bhsI=r.getBPosHashStats().begin();
-	  advance(bhsI,lpos);
-	  for(int32 lend=static_cast<int32>(r.getLenClippedSeq()); lpos<lend; ++lpos, ++bhsI) {
-	    CEBUG("lpos tst " << lpos << "\t" << *bhsI << endl);
-	    CEBUG("1: " << AS_miraparams[r.getSequencingType()].getAssemblyParams().as_clip_pec_ffreq
-		  << "\t2: " << static_cast<uint16>(bhsI->fwd.getFrequency())
-		  << "\t3: " << static_cast<uint16>(bhsI->rev.getFrequency()) << endl);
-	    if(AS_miraparams[r.getSequencingType()].getAssemblyParams().as_clip_pec_ffreq >0
-	       && (bhsI->fwd.getFrequency() > AS_miraparams[r.getSequencingType()].getAssemblyParams().as_clip_pec_ffreq
-		   || bhsI->rev.getFrequency() > AS_miraparams[r.getSequencingType()].getAssemblyParams().as_clip_pec_ffreq)) {
-	      CEBUG("ffreq stop at " << lpos << "\n");
-	      break;
-	    }
-	    CEBUG("4: " << AS_miraparams[r.getSequencingType()].getAssemblyParams().as_clip_pec_ffr
-		  << "\t5: " << static_cast<uint16>(bhsI->fwd.hasConfirmedFwdRev())
-		  << "\t6: " << static_cast<uint16>(bhsI->rev.hasConfirmedFwdRev()) << endl);
-	    if(AS_miraparams[r.getSequencingType()].getAssemblyParams().as_clip_pec_ffr
-	       && ( bhsI->fwd.hasConfirmedFwdRev()
-		    || bhsI->rev.hasConfirmedFwdRev())) {
-	      CEBUG("ffore stop at " << lpos << "\n");
-	      break;
-	    }
-	    CEBUG("7: " << AS_miraparams[r.getSequencingType()].getAssemblyParams().as_clip_pec_fcmst
-		  << "\t8: " << static_cast<uint16>(bhsI->fwd.hasConfirmedMultipleSeqType())
-		  << "\t9: " << static_cast<uint16>(bhsI->rev.hasConfirmedMultipleSeqType()) << endl);
-	    if(AS_miraparams[r.getSequencingType()].getAssemblyParams().as_clip_pec_fcmst
-	       && ( bhsI->fwd.hasConfirmedMultipleSeqType()
-		    || bhsI->rev.hasConfirmedMultipleSeqType())) {
-	      CEBUG("fcmst stop at " << lpos << "\n");
-	      break;
-	    }
-	    CEBUG("A: " << AS_miraparams[r.getSequencingType()].getAssemblyParams().as_clip_pec_fsalp
-		  << "\tB: " << static_cast<uint16>(bhsI->fwd.hasSeenAtLowPos())
-		  << "\tC: " << static_cast<uint16>(bhsI->rev.hasSeenAtLowPos()) << endl);
-	    if(AS_miraparams[r.getSequencingType()].getAssemblyParams().as_clip_pec_fsalp
-	       && ( bhsI->fwd.hasSeenAtLowPos()
-		    || bhsI->rev.hasSeenAtLowPos())) {
-	      CEBUG("fsalp stop at " << lpos << "\n");
-	      break;
-	    }
-	  }
-
-	  // trying to save things
-	  // on high GC, some contigs end due to lousy good coverage in both directions,
-	  // bit there would be enough coverage in one direction
-	  // So, we try to go back the clipping as long as there's
-	  //  - no singlet
-	  //  - no kmer fork
-	  // in that direction, back to the original lclip at most
-
-	  CEBUG("l+ " << lpos << "\trco " << r.getRightClipoff() << endl);
-	  if(lpos != r.getLeftClipoff()){
-
-	    CEBUG("trying to save\n");
-	    int32 xpos=lpos+basesperhash-1;
-	    if(xpos>=r.getRightClipoff()){
-	      xpos=r.getRightClipoff()-1;
-	      if(xpos<0) xpos=0;
-	      lpos=xpos-(basesperhash-1);
-	      if(lpos<0) lpos=0;
-	    }
-	    bhsI=r.getBPosHashStats().begin();
-	    advance(bhsI,xpos);
-
-	    CEBUG("xpos: " << xpos << "\tlpos now: " << lpos << endl);
-	    for(;lpos > r.getLeftClipoff() && bhsI->rev.isValid() && bhsI->rev.getFrequency() < 2 && !bhsI->rev.isKMerFork(); --lpos, --bhsI){}
-	    CEBUG("lpos after jump: " << lpos << endl);
-
-	    bool advanced=false;
-	    for(;lpos > r.getLeftClipoff(); --lpos, --bhsI){
-	      CEBUG((bhsI->rev.getFrequency() < 2) << " " << bhsI->rev.isKMerFork());
-	      if(bhsI->rev.getFrequency() < 2
-		 || bhsI->rev.isKMerFork()){
-		if(advanced) ++lpos; // go back one if we went too far
-		CEBUG(" nonfork lext stop at " << lpos << "\n");
-		break;
-	      }
-	      CEBUG(" back\n");
-	      advanced=true;
-	    }
-	    if(lpos<r.getLeftClipoff()) lpos=r.getLeftClipoff();
-	    CEBUG("saved to " << lpos << endl);
-	  }
-
-	  if(lpos != r.getLeftClipoff()){
-	    hasbeenclipped=true;
-
-	    if(lpos>0 && lpos>r.getLenSeq()) lpos=r.getLenSeq();
-	    CEBUG("pcb l: " << r.getName() << " " << r.getLeftClipoff()
-		  << " " << lpos << endl);
-	    logfout << logprefix << " left "
-		    << r.getName() << '\t'
-		    << r.getLeftClipoff() << " -> ";
-	    if(lpos==r.getLenSeq()){
-	      r.setRQClipoff(r.getLeftClipoff());
-	      logfout << "killed\n";
-	    }else{
-	      r.setLQClipoff(lpos);
-	      logfout << r.getLeftClipoff() << '\n';
-	    }
-	    cbleft++;
-	  }
-	}
-
-	{
-	  int32 rpos=r.getRightClipoff();
-	  vector<Read::bposhashstat_t>::const_iterator bhsI=r.getBPosHashStats().begin();
-	  advance(bhsI,rpos);
-
-	  for(int32 rend=r.getLeftClipoff(); rpos >rend; --rpos){
-	    --bhsI;
-	    CEBUG("rpos tst " << rpos << "\t" << *bhsI << endl);
-	    if(AS_miraparams[r.getSequencingType()].getAssemblyParams().as_clip_pec_bfreq
-	       && (bhsI->fwd.getFrequency() > AS_miraparams[r.getSequencingType()].getAssemblyParams().as_clip_pec_bfreq
-		   || bhsI->rev.getFrequency() > AS_miraparams[r.getSequencingType()].getAssemblyParams().as_clip_pec_bfreq)) {
-	      CEBUG("bfreq stop at " << rpos << "\n");
-	      break;
-	    }
-	    if(AS_miraparams[r.getSequencingType()].getAssemblyParams().as_clip_pec_bfr
-	       && ( bhsI->fwd.hasConfirmedFwdRev()
-		    || bhsI->rev.hasConfirmedFwdRev())) {
-	      CEBUG("bfore stop at " << rpos << "\n");
-	      break;
-	    }
-	    if(AS_miraparams[r.getSequencingType()].getAssemblyParams().as_clip_pec_bcmst
-	       && ( bhsI->fwd.hasConfirmedMultipleSeqType()
-		    || bhsI->rev.hasConfirmedMultipleSeqType())) {
-	      CEBUG("bcmst stop at " << rpos << "\n");
-	      break;
-	    }
-	    if(AS_miraparams[r.getSequencingType()].getAssemblyParams().as_clip_pec_bsalp
-	       && ( bhsI->fwd.hasSeenAtLowPos()
-		    || bhsI->rev.hasSeenAtLowPos())) {
-	      CEBUG("fsalp stop at " << rpos << "\n");
-	      break;
-	    }
-	  }
-
-	  // trying to save things
-	  // on high GC, some contigs end due to lousy good coverage in both directions,
-	  // bit there would be enough coverage in one direction
-	  // So, we try to go back the clipping as long as there's
-	  //  - no singlet
-	  //  - no kmer fork
-	  // in that direction, back to the original rclip at most
-	  if(rpos != r.getRightClipoff()){
-	    CEBUG("trying to save\n");
-	    int32 xpos=rpos-(basesperhash-1);
-	    if(xpos<r.getLeftClipoff()){
-	      xpos=r.getLeftClipoff();
-	      rpos=xpos+(basesperhash-1);
-	      if(rpos>r.getRightClipoff()) rpos=r.getRightClipoff();
-	    }
-
-	    bhsI=r.getBPosHashStats().begin();
-	    advance(bhsI,xpos);
-
-	    CEBUG("rpos now: " << rpos << endl);
-	    for(;rpos < r.getRightClipoff() && bhsI->fwd.isValid() && bhsI->fwd.getFrequency() < 2 && !bhsI->fwd.isKMerFork(); ++rpos, ++bhsI){}
-	    CEBUG("after jump: " << rpos << endl);
-
-	    for(;rpos < r.getRightClipoff(); ++rpos, ++bhsI){
-	      CEBUG("rext " << rpos << "\n");
-	      if(bhsI->fwd.getFrequency() < 2
-		 || bhsI->fwd.isKMerFork()){
-		CEBUG("nonfork rext stop at " << rpos << "\n");
-		break;
-	      }
-	    }
-	    if(rpos>r.getRightClipoff()) rpos=r.getRightClipoff();
-	    CEBUG("saved to " << rpos << endl);
-	  }
-
-	  if(rpos != r.getRightClipoff()){
-	    hasbeenclipped=true;
-
-	    CEBUG("pcb r: " << r.getName() << " " << r.getRightClipoff()
-		  << " " << rpos << endl);
-	    logfout << logprefix << " right "
-		    << r.getName() << '\t'
-		    << r.getRightClipoff() << " -> ";
-
-	    BUGIFTHROW(rpos>r.getRightClipoff(),"rpos>r.getRightClipoff() ???");
-
-	    r.setRQClipoff(rpos);
-	    cbright++;
-	    logfout << r.getRightClipoff() << '\n';
-
-	    // special handling of Solexa GGC.G error
-	    // from point of right clip, 15 bases backwards:
-	    //  search for first ggc.g and clip there
-	    if(r.getSequencingType()==ReadGroupLib::SEQTYPE_SOLEXA
-	       && as_fixparams.as_clip_pec_sxaggcxg
-	       && r.getLenClippedSeq() >=15){
-	      //Read::setCoutType(Read::AS_TEXTSHORT);
-	      //cout << r;
-	      string searchstr=r.getSeqAsChar();
-	      boost::to_lower(searchstr);
-	      int64 searchstart=r.getRightClipoff()-15;
-	      if(searchstart<0) searchstart=0;
-	      size_t found;
-	      do{
-		found=searchstr.find(ggcproblem,searchstart);
-		if (found!=string::npos){
-		  searchstart=found+1;
-		  if(found < r.getRightClipoff()
-		     && found+4<r.getRightClipoff()
-		     && searchstr[found+4]=='g'){
-		    logfout << logprefix << "possible Solexa GGC.G problem "
-			    << r.getName() << '\t' << r.getRQClipoff() << " -> ";
-		    r.setRQClipoff(static_cast<int32>(found+4));
-		    logfout << r.getRQClipoff() << '\n';
-		    found=string::npos; // stop the loop
-		  }
-		}
-	      }while(found!=string::npos);
-	    }
-	  }
-	}
-
-	if(hasbeenclipped){
-	  CEBUG("clipstat yes\n" << r << endl);
-	  numbasesclipped+=oldlen-r.getLenClippedSeq();
-	  if(oldlen
-	     && (r.getLenClippedSeq() < AS_miraparams[r.getSequencingType()].getAssemblyParams().as_minimum_readlength )){
-	    killed++;
-	    logfout << logprefix << " "
-		    << r.getName() << " killed, remaining length ("
-		    << r.getLenClippedSeq() << ")\n";
-	    if(actid < AS_debrisreason.size()
-	       && AS_debrisreason[actid]==DEBRIS_NOTDEBRIS){
-	      AS_debrisreason[actid]=DEBRIS_CLIP_PROPOSEDENDCLIP;
-	    }
-	  }
-	}else{
-	  CEBUG("clipstat no\n" << r << endl);
-	}
-      }
-    }
-
-    logfout.close();
-
-    cout << "done.\nPerformed clips:"
-	 << "\n\tNum reads cliped left: " << cbleft
-	 << "\n\tNum reads cliped right: " << cbright
-	 << "\n\tNum reads completely killed: " << killed
-	 << "\n\tTotal bases clipped         : " << numbasesclipped
-	 << "\n\n";
-  }
-
-  if(1){
-    AS_dataprocessing.startLogging(logname,false);
-
-    AS_dataprocessing.performRareKMERMasking_Pool(AS_readpool,basesperhash,logprefix);
-    AS_dataprocessing.stopLogging();
-  }
-
-  AS_dataprocessing.clipPolyBaseAtEnd_Pool(AS_readpool,logprefix);
-
-  FUNCEND();
-
-  return numbasesclipped;
-}
-//#define CEBUG(bla)
-
-
-
-
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-void Assembly::cutBackPossibleChimeras(const string & logname, const string & logprefix, const vector<int32> & chuntleftcut, const vector<int32> & chuntrightcut, vector<bool> & chimeracutflag)
-{
-  FUNCSTART("void Assembly::cutBackPossibleChimeras(const string & logname, const string & logprefix, const vector<int32> & chuntleftcut, const vector<int32> & chuntrightcut)");
-
-  BUGIFTHROW(chuntleftcut.size()!=chuntrightcut.size() && chuntleftcut.size() != AS_readpool.size(),"Arrays mismatch? chuntleftcut.size()!=chuntrightcut.size && chuntleftcut.size() != AS_readpool.size()");
-
-  ofstream logfout;
-  if(!logname.empty()){
-    logfout.open(logname.c_str(), ios::out|ios::app);
-    if(!logfout){
-      MIRANOTIFY(Notify::FATAL, "Could not open log for appending: " << logname << "\nPossible causes: Disk full? Changed permissions? Directory deleted?");
-    }
-  }
-
-  cout << "Cutting back possible chimeras ... "; cout.flush();
-
-  if(!chimeracutflag.empty()){
-    chimeracutflag.clear();
-    chimeracutflag.resize(chuntleftcut.size(),false);
-  }
-
-  assembly_parameters const & as_fixparams= AS_miraparams[0].getAssemblyParams();
-
-  for(uint32 actreadid=0;actreadid<chuntleftcut.size();actreadid++){
-    Read & actread=AS_readpool.getRead(actreadid);
-    if(actread.hasValidData()
-       && !(actread.isBackbone()
-	    || actread.isRail())){
-      bool didcut=false;
-      if(as_fixparams.as_clip_skimchimeradetection
-	 && (chuntleftcut[actreadid]>0
-	     || chuntrightcut[actreadid]>0)){
-	logfout << logprefix << " possible chimera: " << actread.getName()
-		<< "\t["
-		<< actread.getLeftClipoff()
-		<< ","
-		<< actread.getRightClipoff()
-		<< "[ using cfrag " << chuntleftcut[actreadid] << ":" << chuntrightcut[actreadid]
-		<< " cut back to ";
-
-	actread.setLSClipoff(actread.getLeftClipoff()+chuntleftcut[actreadid]);
-	actread.setRSClipoff(actread.getLeftClipoff()+(chuntrightcut[actreadid]-chuntleftcut[actreadid])+1);
-	didcut=true;
-	if(!chimeracutflag.empty()){
-	  chimeracutflag[actreadid]=true;
-	}
-
-	logfout << '['
-		<< actread.getLeftClipoff()
-		<< ","
-		<< actread.getRightClipoff()
-		<< "[\n";
-      }
-
-      if(!didcut
-	 && (chuntleftcut[actreadid]<0
-	     || chuntrightcut[actreadid]<0)){
-	if(as_fixparams.as_clip_skimjunkdetection){
-	  logfout << logprefix << " removed possible junk: " ;
-	}else{
-	  logfout << logprefix << " untouched possible junk: " ;
-	}
-	logfout << actread.getName()
-		<< "\t["
-		<< -chuntleftcut[actreadid]
-		<< ","
-		<< -chuntrightcut[actreadid]
-		<< '\n';
-	if(as_fixparams.as_clip_skimjunkdetection){
-	  actread.setLSClipoff(actread.getLeftClipoff()-chuntleftcut[actreadid]);
-	  actread.setRSClipoff(actread.getRightClipoff()+chuntrightcut[actreadid]);
-	  if(!chimeracutflag.empty()){
-	    chimeracutflag[actreadid]=true;
-	  }
-	}
-      }
-    }
-  }
-
-  cout << "done.\n";
-}
-
-
-
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-/*
-void Assembly::performPool_AdaptorRightClip(const string & logname, const string & logprefix, const uint8 seqtype)
-{
-  FUNCSTART("void Assembly::performPool_SolexaAdaptorRightClip(const string & logname, const string & logprefix, const uint8 seqtype);)");
-
-// BOOST: regex not compatible with _GLIBCXX_DEBUG
-#ifdef _GLIBCXX_DEBUG
-  cout << "_GLIBCXX_DEBUG not compatible with BOOST::regex :-(\n";
-  return;
-#endif
-
-  BUGIFTHROW(seqtype>=ReadGroupLib::SEQTYPE_END,"Unknown seqtype " << static_cast<uint16>(seqtype) << "given.");
-
-#if CPP_READ_SEQTYPE_END != 8
-#error "This code is made for 8 sequencing types, adapt!"
-#endif
-
-  struct masterslavere_t {
-    boost::regex masterre;
-    std::list<boost::regex> slaveres;
-    bool hasmaster;
-
-    masterslavere_t(): hasmaster(false) {};
-  };
-
-  // prepare regular expressions
-  list<masterslavere_t> adapres;
-  {
-    istringstream tmpis;
-    if(seqtype==ReadGroupLib::SEQTYPE_SOLEXA){
-      static const char regexfile[] = {
-#include "adaptorsregex.solexa.xxd.H"
-	,0
-      };
-      tmpis.str(regexfile);
-    }else if(seqtype==ReadGroupLib::SEQTYPE_IONTORRENT){
-      static const char regexfile[] = {
-#include "adaptorsregex.iontor.xxd.H"
-	,0
-      };
-      tmpis.str(regexfile);
-    }
-
-    masterslavere_t tmpmsre;
-    string line;
-
-    while(true){
-      getline(tmpis,line);
-      if(tmpis.eof()) break;
-      if(line[0]=='>'){
-	adapres.push_back(tmpmsre);
-	line.erase(0,1);         // get away the ">"
-	boost::trim(line);
-	if(!line.empty()){
-	  boost::to_upper(line);
-	  adapres.back().masterre=boost::regex(line);
-	  adapres.back().hasmaster=true;
-	}
-      }else{
-	BUGIFTHROW(adapres.empty(),"Oooops, found no master expression?");
-	boost::to_upper(line);
-	adapres.back().slaveres.push_back(boost::regex(line));
-      }
-    }
-  }
-
-  ReadPool adappool(&AS_miraparams);
-  {
-    istringstream tmpis;
-
-    if(seqtype==ReadGroupLib::SEQTYPE_SOLEXA){
-      static const char adapfile[] = {
-#include "adaptorsforclip.solexa.xxd.H"
-	,0
-      };
-      tmpis.str(adapfile);
-    }else if(seqtype==ReadGroupLib::SEQTYPE_IONTORRENT){
-      static const char adapfile[] = {
-#include "adaptorsforclip.iontor.xxd.H"
-	,0
-      };
-      tmpis.str(adapfile);
-    }else if(seqtype==ReadGroupLib::SEQTYPE_454GS20){
-      static const char adapfile[] = {
-#include "adaptorsforclip.454.xxd.H"
-	,0
-      };
-      tmpis.str(adapfile);
-    }
-
-    string line;
-    while(true){
-      getline(tmpis,line);
-      if(tmpis.eof()) break;
-      line.erase(0,1);         // get away the ">"
-      if(!line.empty()){
-	size_t ereadidx=adappool.provideEmptyRead();
-	Read & actread=adappool[ereadidx];
-	actread.disallowAdjustments();
-	actread.setName(line);
-	getline(tmpis,line);
-	if(tmpis.eof()) break;
-	actread.setSequenceFromString(line);
-      }
-    }
-  }
-
-  //adappool.dumpPoolInfo(cout);
-
-  // Go back if nothing to be searched
-  if(adappool.size()==0 && adapres.size()==0) return;
-
-  cout << "Starting " << ReadGroupLib::getNameOfSequencingType(seqtype) << " known adaptor right clip ... "; cout.flush();
-
-  Skim adapskim;
-  adapskim.skimStreamPrepare(adappool,7,1);
-
-  if(AS_miraparams[0].getAssemblyParams().as_dateoutput) dateStamp(cout);
-  cout << "Searching multithread now ... \n"; cout.flush();
-
-  cout << static_cast<int16>(AS_miraparams[0].getSkimParams().sk_numthreads) << endl;
-
-  vector<int32> clipres;
-  adapskim.findAdaptorRightClip(AS_readpool,clipres,seqtype,9,AS_miraparams[0].getSkimParams().sk_numthreads);
-  //adapskim.findAdaptorRightClip(AS_readpool,clipres,seqtype,9,1);
-  //adapskim.findAdaptorRightClip(AS_readpool,clipres,seqtype,9,8);
-
-  BUGIFTHROW(clipres.size()!=AS_readpool.size(),"clipres.size()!=AS_readpool.size()???");
-
-  ofstream logfout;
-  if(!logname.empty()){
-    logfout.open(logname.c_str(), ios::out|ios::app);
-    if(!logfout){
-      MIRANOTIFY(Notify::FATAL, "Could not open log for appending: " << logname << "\nPossible causes: Disk full? Changed permissions? Directory deleted?");
-    }
-  }
-
-  uint32 numclipped=0;
-
-  if(AS_miraparams[0].getAssemblyParams().as_dateoutput) dateStamp(cout);
-  cout << "Searching for " <<  ReadGroupLib::getNameOfSequencingType(seqtype) << " partial end adaptors ... \n"; cout.flush();
-  ProgressIndicator<int64> P(0, AS_readpool.size());
-  for(uint32 actid=0; actid < AS_readpool.size(); actid++){
-    P.progress(actid);
-    Read & actread = AS_readpool.getRead(actid);
-    if(actread.hasValidData()
-       && actread.getSequencingType()==seqtype
-       && !(actread.isBackbone() || actread.isRail())){
-
-      auto oldrsclip=actread.getRSClipoff();
-      if(clipres[actid]>=0){
-	if(clipres[actid] < oldrsclip){
-	  ++numclipped;
-	  actread.setRSClipoff(clipres[actid]);
-	  logfout << logprefix << " "
-		  << ReadGroupLib::getNameOfSequencingType(seqtype)
-		  << " adaptor: " << actread.getName()
-		  << " changed right clip from " << oldrsclip << " to " << clipres[actid] << "\n";
-	}
-      }else if(!adapres.empty()){
-	string seq(actread.getSeqAsChar());
-	boost::to_upper(seq);
-
-	boost::match_results<std::string::const_iterator> what;
-	boost::match_flag_type flags = boost::match_default;
-	std::string::const_iterator start, end;
-
-	for(auto & msre : adapres){
-	  bool dosearch=true;
-	  if(msre.hasmaster){
-	    if(!regex_search(start, end, what, msre.masterre, flags)) {
-	      dosearch=false;
-	    }
-	  }
-	  bool breakit=false;
-	  if(dosearch){
-	    for(auto & thisre : msre.slaveres){
-	      start = seq.begin();
-	      end = seq.end();
-	      if(regex_search(start, end, what, thisre, flags)) {
-		if(what.position()< oldrsclip){
-		  actread.setRSClipoff(what.position());
-		  logfout << logprefix << " "
-			  << ReadGroupLib::getNameOfSequencingType(actread.getSequencingType())
-			  << " partial end adaptor: " << actread.getName()
-			  << " changed right clip from " << oldrsclip << " to " << what.position() << "\n";
-		  breakit=true;
-		  break;
-		}
-	      }
-	    }
-	  }
-	  if(breakit) break;
-	}
-
-      }
-    }
-  }
-
-  P.finishAtOnce();
-
-  if(!logname.empty()){
-    logfout.close();
-  }
-
-  cout << "done. Clipped " << numclipped << " reads.\n";
-
-  if(AS_miraparams[0].getAssemblyParams().as_dateoutput) dateStamp(cout);
-
-  FUNCEND();
-  return;
-}
-
-*/
-
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-void Assembly::correctContigs()
-{
-#ifdef MIRA_HAS_EDIT
-  FUNCSTART("void Assembly::correctContigs()");
-
-  if(AS_miraparams[0].getAssemblyParams().as_dateoutput) dateStamp(cout);
-  cout << "\nEditing contigs:" << endl;
-
-  EDITParameters eparams;
-
-  //  eparams.setDoEval();
-  eparams.setStrictEvaluation(false);
-  eparams.setConfirmationThreshold(0.5);
-  eparams.setShowProgress(true);
-  eparams.setVerbose(0);
-  eparams.setShowProgress(true);
-
-
-  list<Contig>::iterator I = AS_contigs.begin();
-  int32 ccounter=0;
-  ProgressIndicator<int64> P(0, AS_contigs.size());
-
-  while(I!=AS_contigs.end()){
-    P.progress(ccounter);
-    try {
-      //	CEBUG("Editing contig:" << ccounter << endl);
-      //	CEBUG(*I);
-      cout << "Editing contig:" << ccounter << endl;
-      editContigBack(*I, eparams);
-      ScfBuffer::discard();
-      cout << "deleting star columns" << ccounter << endl;
-      I->deleteStarOnlyColumns(0, I->getContigLength()-1);
-      cout << "marking repeats" << ccounter << endl;
-
-      Contig::repeatmarker_stats_t repstats;
-      vector<bool> readsmarkedsrm;
-      I->newMarkPossibleRepeats(repstats, readsmarkedsrm);
-
-      //	CEBUG("Corrected contig:" << endl);
-      //	CEBUG(*I);
-    }
-    catch(Notify n){
-      n.handleError("Error while examining fault-region");
-    }
-
-    I++;ccounter++;
-  }
-
-  P.finishAtOnce();
-
-  cout << endl;
-
-  FUNCEND();
-#endif
-  return;
-}
-
-
-
-
-
-
-/*************************************************************************
- *
- * Calculates possible sequence vector leftovers at the left side of a read
- * Reads that get a clip must be of Sanger type
- *
- * Does not clip backbone reads, rail reads, multicopyreads
- *  AND not areas protected by Staden GenBank Feature tags
- *
- * Clipping itself must be done afterwards in the performSeqVectorClippings()
- *  function. This was split in two parts to allow releasing of the
- *  big memory chunks AS_readhmcovered, AS_readhitmiss, etc.
- *
- *************************************************************************/
-
-
-void Assembly::calcPossibleSeqVectorClipoffs(int32 version, const string prefix, const string postfix, const string logname)
-{
-  FUNCSTART("void Assembly::calcPossibleSeqVectorClipoffs(int32 version, const string prefix, const string postfix, const string logname)");
-
-  if(AS_readhmcovered.size()==0 || AS_readhitmiss.size()==0) {
-    cout << "\nNo vector clipping information available, aborting vector clip.\n";
-    FUNCEND();
-    return;
-  }
-
-  if(AS_miraparams[0].getAssemblyParams().as_dateoutput) dateStamp(cout);
-  cout << "\nCalculating possible vector leftovers ... ";
-  cout.flush();
-  //ProgressIndicator P (0, AS_readhmcovered.size()-1);
-
-  AS_clipleft.clear();
-  AS_clipright.clear();
-  AS_clipleft.resize(AS_readhmcovered.size(),-1);
-  AS_clipright.resize(AS_readhmcovered.size(),-1);
-
-  string filename;
-  if(logname.size()){
-    filename=buildFileName(version, prefix, postfix, logname, ".txt");
-  }else{
-    filename=buildFileName(version, prefix, postfix,
-			   AS_miraparams[0].getAssemblyParams().as_tmpf_vectorclip,
-			   ".txt");
-  }
-
-  ofstream logout(filename.c_str(), ios::out | ios::trunc);
-
-  for(uint32 id=0; id<AS_readhmcovered.size(); id++) {
-    if(AS_readpool.getRead(id).getSequencingType() != ReadGroupLib::SEQTYPE_SANGER
-       || AS_readpool.getRead(id).isBackbone()
-       || AS_readpool.getRead(id).isRail()
-       || AS_multicopies[id]>0
-      ) continue;
-
-
-    //P.progress(id);
-
-    uint32 clippos=0;
-    bool mustclip=false;
-    for(uint32 actpos=0; actpos<AS_readhmcovered[id].size(); actpos++) {
-      if(actpos-clippos > 5) break;
-      if(AS_readhmcovered[id][actpos]>=4) {
-	if(AS_readhitmiss[id][actpos]) {
-	  if(100.0/static_cast<double>(AS_readhmcovered[id][actpos])*static_cast<double>(AS_readhitmiss[id][actpos]) >= 30.0) {
-	    clippos=actpos;
-	    mustclip=true;
-	  }
-	}
-      }
-    }
-    clippos++;
-
-    // check that no GenBank Feature tags protect the area, else clip less
-    {
-
-      // FIXME: put all checks for that into read.C (*sigh*)
-
-      for(uint32 i=0; i<AS_readpool.getRead(id).getNumOfTags(); i++){
-	const multitag_t & acttag=AS_readpool.getRead(id).getTag(i);
-	if(!acttag.isSourceMIRA()){
-	  if(acttag.from<clippos) clippos=acttag.from;
-	  if(acttag.to<=clippos) clippos=0;
-	}
-      }
-    }
-
-    // auf clip verzichten wenn nur 1 base betroffen (sieht zu doof aus)
-    if(mustclip && clippos>1) {
-      uint32 maxcliplenallowed=AS_miraparams[AS_readpool.getRead(id).getSequencingType()].getAssemblyParams().as_clip_vector_maxlenallowed;
-      if(maxcliplenallowed == 0 || clippos <= maxcliplenallowed) {
-	//AS_readpool.getRead(id).setClipoffs(AS_readpool.getRead(id).getLeftClipoff()+clippos,
-	//				    AS_readpool.getRead(id).getRightClipoff(),
-	//				    false);
-
-	//AS_clipleft[id]=AS_readpool.getRead(id).getLeftClipoff()+clippos;
-
-	AS_clipleft[id]=clippos;
-
-	logout << "Clipped " << clippos << " bases on the left of " << AS_readpool.getRead(id).getName() << "\n";
-
-      } else {
-	if(clippos > maxcliplenallowed) {
-	  logout << "Not clipped " << clippos << " bases on the left of " << AS_readpool.getRead(id).getName() << " , too long.\n";
-	}
-      }
-    }
-  }
-
-  logout.close();
-
-  //P.progress(AS_readhmcovered.size());
-  cout << "done.\n";
-
-  AS_steps[ASVECTORSCLIPPED]=1;
-  AS_steps[ASADSLISTOK]=0;
-
-  FUNCEND();
-}
-
-
-
-
-/*************************************************************************
- *
- * Reads must be Sanger type
- *
- *
- *************************************************************************/
-
-void Assembly::performSeqVectorClippings()
-{
-  FUNCSTART("void Assembly::performSeqVectorClippings()");
-
-  cout << "\nPerforming vector clipping ... ";
-  cout.flush();
-
-  for(uint32 id=0; id<AS_clipleft.size(); id++) {
-    if(AS_clipleft[id]>=0
-       && AS_readpool.getRead(id).isSequencingType(ReadGroupLib::SEQTYPE_SANGER)) {
-      AS_readpool.getRead(id).setClipoffs(AS_readpool.getRead(id).getLeftClipoff()+AS_clipleft[id],
-					  AS_readpool.getRead(id).getRightClipoff(),
-					  false);
-    }
-  }
-  FUNCEND();
-
-  AS_clipleft.clear();
-
-  cout << "done." << endl;
-
-  return;
-}
-
-
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-struct cliplen_t{
-  int32 len;
-  bool changed;
-};
-
-
-//#define CEBUGFLAG 1
-void Assembly::extendADS(int32 version, const string prefix, const string postfix, const string logname)
-{
-  FUNCSTART("void Assembly::extendADS(int32 version, const string prefix, const string postfix, const string logname)");
-
-//  if(AS_steps[ASADSLISTOK]==0){
-//    makeAlignments();
-//  }
-
-
-#if CPP_READ_SEQTYPE_END != 8
-#error "This code is made for 8 sequencing types, adapt!"
-#endif
-
-  // TODO: change to use different Aligns / MIRAparams depending
-  //   on Sanger / 454 (/ PacBio ???) reads
-
-  // TODO: what about PacBio? currently not used, but should it?
-
-  MIRAParameters tmpparams = AS_miraparams[0];
-
-  const_cast<align_parameters &>(tmpparams.getAlignParams()).al_min_relscore=5;
-
-  assembly_parameters const & as_params= tmpparams.getAssemblyParams();
-
-  string filename;
-  if(logname.size()){
-    filename=buildFileName(version, prefix, postfix, logname, ".txt");
-  }else{
-    filename=buildFileName(version, prefix, postfix,
-			   as_params.as_tmpf_adsextend,
-			   ".txt");
-  }
-
-  ofstream logout(filename.c_str(), ios::out | ios::trunc);
-
-
-  vector<cliplen_t> clips(AS_readpool.size());
-  for(uint32 i=0; i<clips.size(); i++){
-    clips[i].len=0;
-    clips[i].changed=false;
-  }
-
-  list<AlignedDualSeq> madsl;
-
-  try{
-    // true for using memcache
-    Align bla(&tmpparams);
-
-    cout << "\n";
-    if(as_params.as_dateoutput) dateStamp(cout);
-    cout << "\nSearching possible read extensions (for Sanger and/or 454):\n";
-
-    ProgressIndicator<int32> P(0, static_cast<int32>(AS_adsfacts.size())-1);
-    uint32 pindic=0;
-
-    for(auto I = AS_adsfacts.cbegin(); I!=AS_adsfacts.cend(); ++I){
-      P.progress(pindic++);
-      // first try: prolongate to end.
-      int32 id1=I->getID1();
-      int32 id2=I->getID2();
-
-      // no sense to calc read extensions for reads where both seqtypes are said
-      //  not to use extensions
-      if(AS_miraparams[AS_readpool.getRead(id1).getSequencingType()].getAssemblyParams().as_use_read_extension == false
-	 && AS_miraparams[AS_readpool.getRead(id2).getSequencingType()].getAssemblyParams().as_use_read_extension == false) continue;
-
-      if(AS_permanent_overlap_bans.checkIfBanned(id1,id2)) {
-	CEBUG("PermBan for: " << id1 << " " << id2 <<"\tskipping\n");
-	continue;
-      }
-
-      CEBUG("\n\nid1: " << id1 << "\t" << AS_readpool.getRead(id1).getName() <<endl);
-      CEBUG("id2: " << id2 << "\t" << AS_readpool.getRead(id2).getName() <<endl);
-
-      // normally the sequences should have a length >0
-      // but due to some clipping being done after SKIM (chimera etc.), it
-      //  may happen they are 0 now. If that's the case, don't bother
-      //  looking at.
-      if(AS_readpool[id1].getLenClippedSeq() == 0
-	 || AS_readpool[id2].getLenClippedSeq() == 0) continue;
-
-      // check for sequencing types
-      if( AS_readpool.getRead(id1).isSequencingType(ReadGroupLib::SEQTYPE_PACBIOLQ)
-	  || AS_readpool.getRead(id2).isSequencingType(ReadGroupLib::SEQTYPE_PACBIOLQ)) continue;
-      // let's allow PacBio HQ
-
-      if( AS_readpool.getRead(id1).isSequencingType(ReadGroupLib::SEQTYPE_IONTORRENT)
-	  || AS_readpool.getRead(id2).isSequencingType(ReadGroupLib::SEQTYPE_IONTORRENT)) continue;
-
-      if( AS_readpool.getRead(id1).isSequencingType(ReadGroupLib::SEQTYPE_SOLEXA)
-	  || AS_readpool.getRead(id2).isSequencingType(ReadGroupLib::SEQTYPE_SOLEXA)) continue;
-
-      if( AS_readpool.getRead(id1).isSequencingType(ReadGroupLib::SEQTYPE_TEXT)
-	  || AS_readpool.getRead(id2).isSequencingType(ReadGroupLib::SEQTYPE_TEXT)) continue;
-
-      if( AS_readpool.getRead(id1).isSequencingType(ReadGroupLib::SEQTYPE_ABISOLID)
-	  || AS_readpool.getRead(id2).isSequencingType(ReadGroupLib::SEQTYPE_ABISOLID)) continue;
-
-      //if(clips[id1].changed && clips[id2].changed){
-      //	CEBUG(id1 << " and " << id2 <<" already changed.\n");
-      //	continue;
-      //}
-
-      madsl.clear();
-
-#if CEBUGFLAG > 0
-      //Read::setCoutType(Read::AS_TEXT);
-      Read::setCoutType(Read::AS_TEXTCLIPS);
-      CEBUG(AS_readpool.getRead(id1));
-      CEBUG(AS_readpool.getRead(id2));
-#endif
-
-      if(I->getSequenceDirection(id1) * I->getSequenceDirection(id2) > 0){
-
-	CEBUG("doalign\n");
-
-	// evil hack warning
-	// the &(* ...) construction is needed for gcc3 as it cannot convert
-	//  a vector<char> iterator to char *   (*sigh*)
-
-	int32 extendlen1=AS_readpool.getRead(id1).getRightExtend();
-	int32 extendlen2=AS_readpool.getRead(id2).getRightExtend();
-
-	if(AS_miraparams[AS_readpool.getRead(id1).getSequencingType()].getAssemblyParams().as_use_read_extension == false) {
-	  extendlen1=0;
-	}
-	if(AS_miraparams[AS_readpool.getRead(id2).getSequencingType()].getAssemblyParams().as_use_read_extension == false){
-	  extendlen2=0;
-	}
-
-	CEBUG("l1: " <<AS_readpool.getRead(id1).getLenClippedSeq() << endl);
-	CEBUG("e1: " <<extendlen1 << endl);
-	CEBUG("l2: " <<AS_readpool.getRead(id2).getLenClippedSeq() << endl);
-	CEBUG("e2: " <<extendlen2 << endl);
-
-	if(extendlen1 >= 10 || extendlen2 >= 10){
-	  bla.acquireSequences(
-	    &(*AS_readpool.getRead(id1).getActualSequence().begin())
-	    +AS_readpool.getRead(id1).getLeftClipoff(),
-	    AS_readpool.getRead(id1).getLenClippedSeq()+extendlen1,
-	    &(*AS_readpool.getRead(id2).getActualSequence().begin())
-	    +AS_readpool.getRead(id2).getLeftClipoff(),
-	    AS_readpool.getRead(id2).getLenClippedSeq()+extendlen2,
-	    id1, id2, 1, 1, true, I->getOffsetInAlignment(id2));
-	  bla.fullAlign(&madsl,false,false);
-
-	  if(madsl.size()==0){
-	    CEBUG("No results, less radical try.\n");
-
-	    int32 tryseqlen1=0;
-	    if(AS_miraparams[AS_readpool.getRead(id1).getSequencingType()].getAssemblyParams().as_use_read_extension) {
-	      if(clips[id1].changed){
-		extendlen1-=clips[id1].len;
-	      }
-	      extendlen1/=2;
-	      tryseqlen1=AS_readpool.getRead(id1).getLenClippedSeq()+extendlen1;
-	      if(clips[id1].changed){
-		tryseqlen1+=clips[id1].len;
-	      }
-	      if(AS_readpool.getRead(id1).getLeftClipoff()+tryseqlen1 >= static_cast<int32>(AS_readpool.getRead(id1).getLenSeq())) {
-		CEBUG("t1o: " <<tryseqlen1 << endl);
-		tryseqlen1=AS_readpool.getRead(id1).getLenClippedSeq()+AS_readpool.getRead(id1).getRightExtend();
-		CEBUG("t1n: " <<tryseqlen1 << endl);
-	      }
-	    }
-
-	    int32 tryseqlen2=0;
-	    if(AS_miraparams[AS_readpool.getRead(id2).getSequencingType()].getAssemblyParams().as_use_read_extension) {
-	      if(clips[id2].changed){
-		extendlen2-=clips[id2].len;
-	      }
-	      extendlen2/=2;
-	      tryseqlen2=AS_readpool.getRead(id2).getLenClippedSeq()+extendlen2;
-	      if(clips[id2].changed){
-		tryseqlen2+=clips[id2].len;
-	      }
-	      if(AS_readpool.getRead(id2).getLeftClipoff()+tryseqlen2 >= static_cast<int32>(AS_readpool.getRead(id2).getLenSeq())) {
-		CEBUG("t2o: " <<tryseqlen2 << endl);
-		tryseqlen2=AS_readpool.getRead(id2).getLenClippedSeq()+AS_readpool.getRead(id2).getRightExtend();
-		CEBUG("t2n: " <<tryseqlen2 << endl);
-	      }
-	    }
-
-	    CEBUG("cc1: " <<clips[id1].changed << endl);
-	    CEBUG("cl1: " <<clips[id1].len << endl);
-	    CEBUG("l1: " <<AS_readpool.getRead(id1).getLenClippedSeq() << endl);
-	    CEBUG("t1: " <<tryseqlen1 << endl);
-	    CEBUG("cc2: " <<clips[id2].changed << endl);
-	    CEBUG("cl2: " <<clips[id2].len << endl);
-	    CEBUG("l2: " <<AS_readpool.getRead(id2).getLenClippedSeq() << endl);
-	    CEBUG("t2: " <<tryseqlen2 << endl);
-	    if(extendlen1 < 5 && extendlen2 < 5) {
-	      CEBUG("skip" << endl);
-	      continue;
-	    }
-
-	    if(tryseqlen1>0 && tryseqlen2>0){
-	      bla.acquireSequences(
-		&(*AS_readpool.getRead(id1).getActualSequence().begin())
-		+AS_readpool.getRead(id1).getLeftClipoff(),
-		tryseqlen1,
-		&(*AS_readpool.getRead(id2).getActualSequence().begin())
-		+AS_readpool.getRead(id2).getLeftClipoff(),
-		tryseqlen2,
-		id1, id2, 1, 1, true, I->getOffsetInAlignment(id2));
-	    }
-	  }
-	}
-      }else{
-	if(I->getSequenceDirection(id2)>0){
-	}else{
-	}
-      }
-
-      if(madsl.size()==0){
-	CEBUG("No results\n");
-      }else{
-	int32 bestweight=0;
-	list<AlignedDualSeq>::iterator J;
-	for(J= madsl.begin(); J!=madsl.end(); ){
-	  if(J->isValid()==false){
-	    J=madsl.erase(J);
-	  }else{
-	    if(J->getWeight()>bestweight) bestweight=J->getWeight();
-	    J++;
-	  }
-	}
-	// take only the best
-	for(J= madsl.begin(); J!=madsl.end();){
-	  if(J->getWeight() != bestweight){
-	    J=madsl.erase(J);
-	  } else {
-	    J++;
-	  }
-	}
-//	  cout << "Ext. 1st success: " << id1 << "\t" << id2 << "\n";
-//	  cout << *I;
-//	  cout << *(madsl.begin());
-
-	int32 lens1=0;
-	int32 lens2=0;
-	if(madsl.begin()->clipper(as_params.as_readextension_window_len,
-				  as_params.as_readextension_window_maxerrors,
-				  lens1, lens2)){
-//	    cout << "Lalala\n";
-
-	  lens1-=AS_readpool.getRead(id1).getLenClippedSeq();
-	  lens2-=AS_readpool.getRead(id2).getLenClippedSeq();
-	  CEBUG("o1: " << AS_readpool.getRead(id1).getLenClippedSeq() << "\tn: " << lens1);
-	  CEBUG("\no2: " << AS_readpool.getRead(id2).getLenClippedSeq() << "\tn: " << lens2<<endl);
-
-
-	  if(AS_miraparams[AS_readpool.getRead(id1).getSequencingType()].getAssemblyParams().as_use_read_extension){
-	    if(lens1>5 && lens1>clips[id1].len){
-	      clips[id1].len=lens1;
-	      clips[id1].changed=true;
-	    }
-	  }
-
-	  if(AS_miraparams[AS_readpool.getRead(id2).getSequencingType()].getAssemblyParams().as_use_read_extension){
-	    if(lens2>5 && lens2>clips[id2].len){
-	      clips[id2].len=lens2;
-	      clips[id2].changed=true;
-	    }
-	  }
-	}
-      }
-    }
-    P.finishAtOnce();
-  }
-  catch(Notify n){
-    n.handleError(THISFUNC);
-  }
-
-  int32 lenplus=0;
-  int32 numchanged=0;
-  for(uint32 rid=0; rid<clips.size(); rid++){
-    if(AS_readpool.getRead(rid).isBackbone()
-       || AS_readpool.getRead(rid).isRail()) continue;
-    // contig join spoiler! do not extend back again!
-    if(AS_readpool.getRead(rid).hasTag(Read::REA_defaulttag_CJSP.identifier)) continue;
-    if(AS_miraparams[AS_readpool.getRead(rid).getSequencingType()].getAssemblyParams().as_use_read_extension) continue;
-
-    if(clips[rid].changed){
-      CEBUG("ID: " << rid << "\t" << AS_readpool.getRead(rid).getName() << "\toldlen: " << AS_readpool.getRead(rid).getLenClippedSeq());
-      CEBUG("\tgained: " << clips[rid].len << endl);
-      numchanged++;
-      lenplus+=clips[rid].len;
-
-      logout << AS_readpool.getRead(rid).getName() << "\t" << clips[rid].len << "\n";
-
-      AS_readpool.getRead(rid).setClipoffs(AS_readpool.getRead(rid).getLeftClipoff(),
-					 AS_readpool.getRead(rid).getLeftClipoff()+AS_readpool.getRead(rid).getLenClippedSeq()+clips[rid].len-1,
-					 false);
-
-      if(AS_readpool.getRead(rid).checkRead()){
-	cout << AS_readpool.getRead(rid);
-	MIRANOTIFY(Notify::INTERNAL, AS_readpool.getRead(rid).checkRead()) ;
-      }
-    }
-  }
-
-  cout << "\nChanged length of " << numchanged << " sequences."<< endl;
-  if(numchanged!=0){
-    cout << "Mean length gained in these sequences: " << static_cast<double>(lenplus)/ static_cast<double>(numchanged) << " bases." << endl;
-  }
-
-  logout.close();
-
-  AS_steps[ASADSLISTOK]=0;
-
-  FUNCEND();
-  return;
-}
-//#define CEBUGFLAG 0
-
-
-
-
-#define CEBUG(bla)   {cout << bla; cout.flush();}
-
-void Assembly::analyseOverlapHashProfile(vector<uint8> & profile, vector<skimedges_t>::const_iterator seI, ADSEstimator & adse)
-{
-  vector<uint32> longeststretch(7,0);
-  vector<uint32> currentstretch(7,0);
-
-  for(size_t pi=0; pi<profile.size(); pi++){
-    //CEBUG(pi << '\t' << static_cast<uint16>(profile[pi]) << '\n');
-    for(size_t si=0; si<7; si++){
-      if(si==profile[pi]){
-	currentstretch[si]++;
-	if(currentstretch[si]>longeststretch[si]) longeststretch[si]=currentstretch[si];
-      }else{
-	currentstretch[si]=0;
-      }
-    }
-  }
-
-  if(longeststretch[3]<5){
-    if(AS_skimstaken[seI->skimindex]==true){
-      cout << "Remove seI: " << *seI;
-      cout << "stretches:\n";
-      for(size_t si=0; si<7; si++){
-	cout << si << ' ' << longeststretch[si] << endl;
-      }
-
-      AS_skimstaken[seI->skimindex]=false;
-      AS_numskimoverlaps[seI->rid1]--;
-      AS_numskimoverlaps[seI->linked_with]--;
-    }
-  }
-}
-
-#define CEBUG(bla)
-
-
-
-/*************************************************************************
- *
- * sorter to sort Contig::templateguessinfo_t from low to high
- *  first on readgroup id
- *  then segment_placement
- *  then on template size
- *
- *************************************************************************/
-
-inline bool Assembly__sortTemplateGuessInfo_(const Contig::templateguessinfo_t & a,
-					     const Contig::templateguessinfo_t & b);
-inline bool Assembly__sortTemplateGuessInfo_(const Contig::templateguessinfo_t & a,
-					     const Contig::templateguessinfo_t & b)
-{
-  if(a.rgid==b.rgid){
-    if(a.splace_seen==b.splace_seen){
-      return a.tsize_seen<b.tsize_seen;
-    }
-    return a.splace_seen<b.splace_seen;
-  }
-  return a.rgid<b.rgid;
-}
-
-/*************************************************************************
- *
- * Destroys AS_templateguesses by sorting it, therefore cleared at end of func
- *
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-void Assembly::analyseTemplateGuesses()
-{
-//  cout << "tgs: " << AS_templateguesses.size() << endl;
-  if(AS_templateguesses.empty()) return;
-  sort(AS_templateguesses.begin(),AS_templateguesses.end(),Assembly__sortTemplateGuessInfo_);
-
-
-  {
-    uint32 ind=0;
-    for(auto & tge : AS_templateguesses){
-      CEBUG(ind
-	    << "\trgid: " << tge.rgid.getLibId()
-	    << "\tspl: " << static_cast<int16>(tge.splace_seen)
-	    << "\tts: " << tge.tsize_seen
-	    << '\n'; ++ind);
-    }
-  }
-
-
-  vector<rgtguess_t> atgpred;
-
-  // collapse AS_templateguesses into predictions grouped by rgid and segment_placement
-  auto tgI=AS_templateguesses.cbegin();
-  for(; tgI!=AS_templateguesses.cend() && tgI->rgid.isDefaultNonValidReadGroupID(); ++tgI) {}
-  if(tgI!=AS_templateguesses.cend()){
-    while(tgI!=AS_templateguesses.cend()){
-      auto tgS=tgI;
-      // search end iterator for that grouping
-      for(; tgI!=AS_templateguesses.cend() && tgI->rgid==tgS->rgid && tgI->splace_seen == tgS->splace_seen; ++tgI) {};
-      auto tgE=tgI;
-      auto numvals=tgI-tgS;
-      if(numvals>=100){
-	atgpred.resize(atgpred.size()+1);
-	atgpred.back().count=numvals;
-	atgpred.back().tg=*tgS;
-
-	uint64 sum=0;
-	for(tgI=tgS; tgI!=tgE; ++tgI) sum+=tgI->tsize_seen;
-	double mean=static_cast<double>(sum)/static_cast<double>(numvals);
-	double sp2sum=0;
-	for(tgI=tgS; tgI!=tgE; ++tgI) {
-	  auto m1=static_cast<double>(tgI->tsize_seen - mean);
-	  sp2sum+=m1*m1;    // for stdev
-	}
-	double stdev=sqrt(sp2sum/(numvals-1));
-	// skewness, see
-	//   http://www.itl.nist.gov/div898/handbook/eda/section3/eda35b.htm
-	//   http://www.tc3.edu/instruct/sbrown/stat/shape.htm
-	//
-	// skewness >0 left skew
-	// skewness <0 right skew
-	// abs skewness >= 1 very skewed
-	//     skewness >= .5 mildly skewed
-	//     skewness >= .25 slightly skewed (own definition as we're working with higher number of measurements
-	//
-	// but for large data sets with tens or hundreds of thousands of measurement, even a few outliers (<1%) on one side
-	//  (like happens in misassembled contigs) can induce a skew >1
-	// Solution: recalc skew on a subset of values which takes only values at 3*stdev
-	// also recalc new stdev on this subset
-
-	sp2sum=0;
-	double sp3sum=0;
-	double sxstdev=stdev*3;
-	uint64 numvals2=0;
-	for(tgI=tgS; tgI!=tgE; ++tgI) {
-	  auto m1=static_cast<double>(tgI->tsize_seen - mean);
-	  if(abs(m1)<=sxstdev){
-	    sp2sum+=m1*m1;    // for stdev
-	    sp3sum+=m1*m1*m1; // for skewness
-	    ++numvals2;
-	  }
-	}
-	stdev=sqrt(sp2sum/(numvals2-1));
-	double skewness=0;
-	if(stdev>0) skewness=sp3sum/((numvals2-1)*stdev*stdev*stdev);
-
-	// homebrew
-	double lefttailfactor=static_cast<double>(2.0);
-	double righttailfactor=static_cast<double>(2.0);
-	if(skewness<=static_cast<double>(-1.0)){
-	  lefttailfactor=static_cast<double>(2.4);
-	  righttailfactor=static_cast<double>(1.6);
-	}else if(skewness<=static_cast<double>(-0.5)){
-	  lefttailfactor=static_cast<double>(2.2);
-	  righttailfactor=static_cast<double>(1.8);
-	}else if(skewness<=static_cast<double>(-0.25)){
-	  lefttailfactor=static_cast<double>(2.1);
-	  righttailfactor=static_cast<double>(1.9);
-	}else if(skewness>=static_cast<double>(1.0)){
-	  lefttailfactor=static_cast<double>(1.6);
-	  righttailfactor=static_cast<double>(2.4);
-	}else if(skewness>=static_cast<double>(0.5)){
-	  lefttailfactor=static_cast<double>(1.8);
-	  righttailfactor=static_cast<double>(2.2);
-	}else if(skewness>=static_cast<double>(0.25)){
-	  lefttailfactor=static_cast<double>(1.9);
-	  righttailfactor=static_cast<double>(2.1);
-	}
-
-	atgpred.back().count=numvals2;
-	atgpred.back().mean=mean;
-	atgpred.back().stdev=stdev;
-	atgpred.back().skewness=skewness;
-	if(stdev>0){
-	  atgpred.back().deduced_min=(mean-lefttailfactor*stdev > 0) ? (mean-lefttailfactor*stdev) : 0;
-	  atgpred.back().deduced_max=mean+righttailfactor*stdev;
-	}else{
-	  atgpred.back().deduced_min=mean-mean/10;
-	  atgpred.back().deduced_max=mean+mean/10;
-	}
-      }
-    }
-  }
-
-  cout << "ATG PREDICTIONS\n";
-  cout << std::fixed << std::setprecision(10);
-  for(auto & ae : atgpred){
-    cout << ae << endl;
-  }
-
-  if(AS_rgstinfo.size()<=ReadGroupLib::getNumReadGroups()){
-    AS_rgstinfo.resize(ReadGroupLib::getNumReadGroups()+1);
-  }
-
-  // per readgroup, search the prediction with the highest count: that's going to be our final prediction
-  auto atgpI=atgpred.cbegin();
-  while(atgpI!=atgpred.cend()){
-    auto best=*atgpI;
-    for(; atgpI!=atgpred.cend() && atgpI->tg.rgid==best.tg.rgid; ++atgpI){
-      if(atgpI->count >best.count) best=*atgpI;
-    }
-    cout << "Final prediction: " << best << endl;
-    bool changedsomething=false;
-    if(best.tg.rgid.wantSegmentPlacementEstimate()){
-      best.tg.rgid.setSegmentPlacementCode(best.tg.splace_seen);
-      best.tg.rgid.setWantSegmentPlacementEstimate(false);
-      cout << "Set segment placement code.\n";
-      AS_guessedtemplatevalues=true;
-      changedsomething=true;
-    } else if(best.tg.rgid.wantTemplateInfoEstimate()){
-      best.tg.rgid.setInsizeFrom(best.deduced_min);
-      best.tg.rgid.setInsizeTo(best.deduced_max);
-      best.tg.rgid.setWantTemplateSizeEstimate(false);
-      cout << "Set template size.\n";
-      AS_guessedtemplatevalues=true;
-      changedsomething=true;
-    }
-    if(changedsomething){
-      AS_rgstinfo[best.tg.rgid.getLibId()].rgtguess=best;
-    }
-  }
-
-  AS_templateguesses.clear();
-}
-//#define CEBUG(bla)
-
-
-bool Assembly::warnChimeraContent()
-{
-  FUNCSTART("bool Assembly::warnChimeraContent()");
-  BUGIFTHROW(AS_current_rls_byrg.size() != ReadGroupLib::getNumReadGroups(), "AS_current_rls_byrg.size() " << AS_current_rls_byrg.size() << " != ReadGroupLib::getNumReadGroups() " << ReadGroupLib::getNumReadGroups() << " ???");
-
-  bool retval=false;
-
-  vector<double> ratios;
-  ratios.resize(ReadGroupLib::getNumReadGroups());
-
-  uint32 warnlevel=2;
-
-  string maxverdict;
-  double maxratio=0.0;
-
-  for(uint32 rgi=1; rgi<ReadGroupLib::getNumReadGroups(); ++rgi){
-    AS_current_rls_byrg[rgi].RLS_count_chimera=0;
-    if(AS_current_rls_byrg[rgi].RLS_count_all){
-      for(uint32 rid=0; rid<AS_readpool.size(); ++rid){
-	if(AS_debrisreason[rid]==DEBRIS_CLIP_CHIMERA) ++AS_current_rls_byrg[rgi].RLS_count_chimera;
-      }
-
-      ratios[rgi]=100.0/AS_current_rls_byrg[rgi].RLS_count_all*AS_current_rls_byrg[rgi].RLS_count_chimera;
-
-      if(ratios[rgi] > 0.0){
-	retval=true;
-	if(ratios[rgi] < 0.1){
-	  AS_current_rls_byrg[rgi].RLS_verdict_chimera="still excellent, no need to worry";
-	}else if(ratios[rgi] < 0.25){
-	  AS_current_rls_byrg[rgi].RLS_verdict_chimera="ok, but could be better";
-	}else if(ratios[rgi] < 0.5){
-	  warnlevel=1;
-	  AS_current_rls_byrg[rgi].RLS_verdict_chimera="not good";
-	}else if(ratios[rgi] < 1.0){
-	  warnlevel=1;
-	  AS_current_rls_byrg[rgi].RLS_verdict_chimera="mediocre";
-	}else if(ratios[rgi] < 2.0){
-	  warnlevel=0;
-	  AS_current_rls_byrg[rgi].RLS_verdict_chimera="inacceptable";
-	}else if(ratios[rgi] < 4.0){
-	  warnlevel=0;
-	  AS_current_rls_byrg[rgi].RLS_verdict_chimera="absolutely appalling";
-	}else if(ratios[rgi] < 8.0){
-	  warnlevel=0;
-	  AS_current_rls_byrg[rgi].RLS_verdict_chimera="a complete catastrophe";
-	}else{
-	  AS_current_rls_byrg[rgi].RLS_verdict_chimera="a reason to shoot the harddisk containing this data";
-	  warnlevel=0;
-	}
-      }
-      if(ratios[rgi]>maxratio){
-	maxratio=ratios[rgi];
-	maxverdict=AS_current_rls_byrg[rgi].RLS_verdict_chimera;
-      }
-    }
-  }
-
-  if(maxratio>0.0){
-    string wstr("MIRA detected chimeric sequences in (at least) one of your readgroups. The maximum percentage found was ");
-    if(maxratio<0.005){
-      wstr+="<0.005";
-    }else{
-      wstr+=boost::str(boost::format("%.2f") % maxratio);
-    }
-    wstr+=+"%, which is "+maxverdict+".";
-    if(maxratio>=0.25){
-      if(maxratio>=4.0){
-	wstr+="\n\nYour sequencing provider absolutely needs to get lower numbers, talk to them about it.";
-      }else{
-	wstr+="\n\nI suggest you ask your sequencing provider about this.";
-      }
-    }
-    if(maxratio>=0.5){
-      if(AS_miraparams[0].getPathfinderParams().paf_use_genomic_algorithms){
-	wstr+="\n\nAs this is a genome assembly, you should be able to get away with it. But should you use the same library protocols for sequencing of RNASeq/EST data, this will create problems.";
-      }else{
-	wstr+="\n\nUsing a library with this amount of chimeric reads is very, very dangerous in RNASeq/EST projects.";
-      }
-    }
-    wstr+="\n\nThe reads detected as chimeric are denoted in the 'debris' file in the info directory, the code they are marked with is CLIP_CHIMERA";
-    AS_warnings.setWarning("CHIMERIC_READS",warnlevel,"Readgroup with chimeric reads",wstr);
-  }
-  return retval;
-}
-
-bool Assembly::warnAtSmileCoverage()
-{
-  string wstr;
-  if(AS_assemblyinfo.huntForSmileCoverage(wstr)){
-    AS_warnings.setWarning("CONCOV_SUSPICIOUS_DISTRIBUTION",0,"Suspicious distribution of contig coverages",wstr);
-  }
-  return !wstr.empty();
-}
-
-bool Assembly::warnAtHighCoverages(uint32 measuredcov)
-{
-  bool retval=false;
-  if(AS_miraparams[0].getNagAndWarnParams().nw_check_coverage!=NWNONE
-     && AS_miraparams[0].getPathfinderParams().paf_use_genomic_algorithms
-     && measuredcov>AS_miraparams[0].getNagAndWarnParams().nw_check_covvalue){
-    string wstr("You are running a genome ");
-    if(AS_miraparams[0].getAssemblyParams().as_assemblyjob_mapping){
-      wstr+="mapping";
-    }else{
-      wstr+="de-novo";
-    }
-    wstr+=" assembly and the current best estimation for average coverage is "
-      +boost::lexical_cast<string>(measuredcov)
-      +"x (note that this number can be +/- 20% off the real value). This is ";
-    if(measuredcov>=80) wstr+="a pretty high coverage,";
-    wstr+="higher than the current warning threshold of "
-      +boost::lexical_cast<string>(AS_miraparams[0].getNagAndWarnParams().nw_check_covvalue)
-      +"x."
-      "\n\nYou should try to get the average coverage not higher than, say, 60x to 100x for Illumina data or 40x to 60x for 454 and Ion Torrent data. Hybrid assemblies should target a total coverage of 80x to 100x as upper bound. For that, please downsample your input data."
-      "\n\nThis warning has two major reasons:"
-      "\n- for MIRA and other overlap based assemblers, the runtime and memory requirements for ultra-high coverage projects grow exponentially, so reducing the data helps you there"
-      "\n- for all assemblers, the contiguity of an assembly can also suffer if the coverage is too high, i.e. you get more contigs than you would otherwise. Causes for this effect can be non-random sequencing errors or low frequency sub-populations with SNPs which become strong enough to be mistaken for possible repeats.";
-    if(measuredcov>=150){
-      if(measuredcov>=300){
-	wstr+="\nA coverage of >300x ... no really, are you kidding me? *sigh*";
-      }
-      wstr+="\nWith the coverage you currently have, you *really* should downsample your data. You. Have. Been. Warned!";
-    }
-    AS_warnings.setWarning("ASCOV_VERY_HIGH",1,"Very high average coverage",wstr);
-    retval=true;
-  }
-  return retval;
-}
-
-
-
-/*************************************************************************
- *
- * mean function, with side-effect and definetely to be used only where
- *  it is currently called from
- *
- * Used to guess which inserts in a contigs are wrong after a first
- *  mapping round and makes sure they get removed
- *
- * E.g.:
- *        bb    cagtcatga***ctgcatgca
- *        r1    cag*catga***ctgcatgca
- *        r2    cag*catga***ctgcatgca
- *        r3    cag*catga***ctgcatgca
- *        ...
- *        rX    cag*catgaTTTctgcatgca
- *
- * with rX being some weird read (maybe low frequency variant, or sequencing
- *  error, or ...)
- *
- * Normally, the two stage mapping would calculate an intermediate new backbone
- *  to be
- *
- *        bbi   cag*catga***ctgcatgca
- *
- * but that is obviously not really the best guess and currently leads to
- *  misalignments with reads ending in this area. E.g.:
- *
- *        bbi   cag*catga***ctgcatgca
- *        rY               actgcatgca
- *
- * instead of
- *
- *        bbi   cag*catga***ctgcatgca
- *        rY            a***ctgcatgca
- *
- * This function will fake the contig CON_counts structure to enable
- *  Contig::deleteStarOnlyColumns() to remove the probably wrong inserts, so
- *  that the new intermediate contig looks like this:
- *
- *        bbi   cag*catgactgcatgca
- *
- * Side-effects:
- *  - CON_counts of contig is probably not reflecting truth anymore
- *  - reads of the contig also get edited, but this routine
- *    is currently used just before all the reads are discarded anyway.
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-void Assembly::priv_removePotentiallyWrongBaseInserts(Contig & con)
-{
-  FUNCSTART("void Assembly::priv_removePotentiallyWrongBaseInserts(Contig & con)");
-
-  // try to look for strains which are only not in backbone
-  vector<string> straincons(ReadGroupLib::getNumOfStrains());
-  vector<base_quality_t> dummyqual;
-
-  for(uint32 sid=0; sid<ReadGroupLib::getNumOfStrains(); ++sid){
-    bool takesid=false;
-    for(uint32 rgid=1; rgid<ReadGroupLib::getNumReadGroups();++rgid){
-      auto rg=ReadGroupLib::getReadGroupID(rgid);
-      if(rg.getStrainID()==sid
-	 && !rg.isBackbone()
-	 && !rg.isRail()){
-	takesid=true;
-	break;
-      }
-    }
-    if(takesid){
-      CEBUG("Taking sid " << sid << " " << ReadGroupLib::getStrainOfStrainID(sid) << endl);
-      con.newConsensusGet(straincons[sid],dummyqual,sid);
-    }
-  }
-
-  // look if we have *any* consensus made (meaning we'd have same strain backbone AND mapped reads).
-  //  If not, recalc consensi for all strains
-  {
-    bool needrecalc=true;
-    for(auto & s : straincons){
-      if(!s.empty()) {
-	needrecalc=false;
-	break;
-      }
-    }
-    if(needrecalc){
-      CEBUG("Recalc all consensi\n");
-      for(uint32 sid=0; sid<ReadGroupLib::getNumOfStrains(); ++sid){
-	con.newConsensusGet(straincons[sid],dummyqual,sid);
-      }
-    }
-  }
-
-  {
-    bool stillnocons=true;
-    for(auto & s : straincons){
-      if(!s.empty()) {
-	stillnocons=false;
-	break;
-      }
-    }
-    BUGIFTHROW(stillnocons,"Ummmm ... no cons built???");
-  }
-
-  // fill up empty consensi
-  for(auto & s : straincons){
-    if(s.empty()) s.resize(con.getContigLength(),'*');
-  }
-
-  Contig::cccontainer_t & cc = const_cast<Contig::cccontainer_t &>(con.getConsensusCounts());
-
-  auto ccI=cc.begin();
-  for(uint32 actcontigpos=0; actcontigpos<straincons[0].size(); ++actcontigpos, ++ccI){
-    // obviously, we should remove a gap backbone position only if it is not a valid IUPAC base
-    //  or else we would actually edit bases of the backbone away (not good)
-    if(!dptools::isValidIUPACBase(ccI->i_backbonecharorig)){
-      bool maydelete=true;
-      CEBUG("acp: " << actcontigpos << " : ");
-      for(auto & s : straincons){
-	CEBUG(s[actcontigpos]<<'#');
-	if(s[actcontigpos]!='*'){
-	  maydelete=false;
-	  //break;
-	}
-      }
-      CEBUG("\n");
-      if(maydelete){
-	CEBUG("rpwbi will delete " << actcontigpos << endl);
-	ccI->total_cov=65535;
-	ccI->star=65535;
-      }
-    }
-  }
-  con.deleteStarOnlyColumns(0,con.getContigLength(),false,65535);
-}
-//#define CEBUG(bla)
diff --git a/src/mira/assembly_output.C b/src/mira/assembly_output.C
index 0ae33a8..e19d5ad 100644
--- a/src/mira/assembly_output.C
+++ b/src/mira/assembly_output.C
@@ -11,17 +11,17 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
 /*
@@ -30,26 +30,32 @@
  */
 
 
+#ifndef lint
+static char vcid3[] = "$Id$";
+#endif /* lint */
+
+
 #include "assembly_output.H"
 
+#include <iomanip>
 
-#include <boost/lexical_cast.hpp>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+// for getting username etc
+#include <pwd.h>
 
+// getting time in GBF output
+#include <time.h>
 
-#include "io/annotationmappings.H"
-#include "util/fileanddisk.H"
-#include "util/dptools.H"
-#include "mira/gff_parse.H"
+#include <boost/lexical_cast.hpp>
 
 
-using namespace std;
 
-#define CEBUG(bla)
-#define CEBUGF(bla)
 
 #ifndef PUBLICQUIET
 //#define CEBUGNPQ(bla)  {cout << bla; cout.flush();}
-#define CEBUGNPQ(bla)
+#define CEBUGNPQ(bla)  
 #else
 #define CEBUGNPQ(bla)
 #endif
@@ -59,58 +65,30 @@ using namespace std;
 
 
 
+namespace assout {
 
 
 /*************************************************************************
  *
- *
+ * returns true if file already existed and we can append
+ * opens the ofstream
  *
  *
  *************************************************************************/
 
-void assout::saveContigReadList(list<Contig> & clist, const string & filename, bool deleteoldfile)
-{
-  FUNCSTART("void saveContigReadList(list<Contig> & clist, const string & filename, bool deleteoldfile)");
-
-  ofstream fout;
-  if(!openFileForAppend(filename,fout,deleteoldfile)){
-    Contig::dumpContigReadList_Head(fout);
-  }
-
-  for(uint32 savewhat=0; savewhat<2; savewhat++){
-    for(auto & cle : clist){
-      bool saveme=false;
-      if(savewhat==0 && cle.getNumReadsInContig()>1) saveme=true;
-      if(savewhat==1 && cle.getNumReadsInContig()==1) saveme=true;
-      if(saveme){
-	try{
-	  cle.dumpContigReadList_Body(fout);
-	}
-	catch (Notify n) {
-	  cerr << "Error while dumping " << cle.getContigName() << ".\n";
-	  n.handleError(THISFUNC);
-	}
-      }
+  bool openFileForAppend(const string & filename, ofstream & fout, bool deleteanyway)
+  {
+    struct stat st;
+    if(deleteanyway || stat(filename.c_str(),&st)) {
+      CEBUG("Opening " << filename << " and truncating.\n");
+      fout.open(filename.c_str(), ios::out | ios::trunc);
+      return false;
     }
+    CEBUG("Opening " << filename << " and appending.\n");
+    fout.open(filename.c_str(), ios::out | ios::app);
+    return true;
   }
-  fout.close();
-
-  FUNCEND();
-}
-
-void assout::saveContigReadList(Contig & con, const string & filename, bool deleteoldfile)
-{
-  FUNCSTART("void saveContigReadList(Contig & con, const string & filename)");
-
-  ofstream fout;
-  if(!openFileForAppend(filename,fout,deleteoldfile)){
-    Contig::dumpContigReadList_Head(fout);
-  }
-  con.dumpContigReadList_Body(fout);
-  fout.close();
 
-  FUNCEND();
-}
 
 
 /*************************************************************************
@@ -120,59 +98,59 @@ void assout::saveContigReadList(Contig & con, const string & filename, bool dele
  *
  *************************************************************************/
 
-void assout::saveStatistics(list<Contig> & clist, const string & filename, bool deleteoldfile)
-{
-  FUNCSTART("void saveStatistics(list<Contig> & clist, const string & filename, bool deleteoldfile)");
+  void saveContigReadList(list<Contig> & clist, const string & filename, bool deleteoldfile)
+  {
+    FUNCSTART("void saveContigReadList(list<Contig> & clist, const string & filename, bool deleteoldfile)");
 
-  //cout << "Saving project statistics to file: " << filename << endl;
+    // The next line is here to fool the compiler to also
+    // include the CVS string into the binary
+    // line has no effect and will put optimised away anyway
+    (void) vcid3;
 
-  ofstream statout;
-  if(!openFileForAppend(filename,statout, deleteoldfile)){
-    Contig::dumpContigStatistics_Head(statout);
-  }
 
-  for(uint32 savewhat=0; savewhat<2; savewhat++){
-    list<Contig>::iterator contigI=clist.begin();
-    for(auto & cle : clist){
-      bool saveme=false;
-      if(savewhat==0 && cle.getNumReadsInContig()>1) saveme=true;
-      if(savewhat==1 && cle.getNumReadsInContig()==1) saveme=true;
-      if(saveme){
-	try{
-	  cle.dumpContigStatistics_Body(statout);
-	}
-	catch (Notify n) {
-	  cerr << "Error while dumping " << cle.getContigName() << ".\n";
-	  n.handleError(THISFUNC);
+    // cout << "Saving project contig<->read list to file: " << filename << endl;
+
+    ofstream fout;
+    if(!openFileForAppend(filename,fout,deleteoldfile)){
+      Contig::dumpContigReadList_Head(fout);
+    }
+
+    for(uint32 savewhat=0; savewhat<2; savewhat++){
+      list<Contig>::iterator contigI=clist.begin();
+      for(;contigI!=clist.end(); contigI++){
+	bool saveme=false;
+	if(savewhat==0 && contigI->getNumReadsInContig()>1) saveme=true;
+	if(savewhat==1 && contigI->getNumReadsInContig()==1) saveme=true;
+	if(saveme){
+	  try{
+	    contigI->dumpContigReadList_Body(fout);
+	  }
+	  catch (Notify n) {
+	    cerr << "Error while dumping " << contigI->getContigName() << ".\n";
+	    n.handleError(THISFUNC);
+	  }
 	}
       }
     }
-  }
+    fout.close();
 
-  statout.close();
-
-  FUNCEND();
-}
+    FUNCEND();
+  }
 
-void assout::saveStatistics(Contig & con, const string & filename, bool deleteoldfile)
-{
-  FUNCSTART("void saveStatistics(Contig & con, const string & filename)");
+  void saveContigReadList(Contig & con, const string & filename, bool deleteoldfile)
+  {
+    FUNCSTART("void saveContigReadList(Contig & con, const string & filename)");
 
-  ofstream statout;
-  try{
-    if(!openFileForAppend(filename,statout, deleteoldfile)){
-      Contig::dumpContigStatistics_Head(statout);
+    ofstream fout;
+    if(!openFileForAppend(filename,fout,deleteoldfile)){
+      Contig::dumpContigReadList_Head(fout);
     }
-    con.dumpContigStatistics_Body(statout);
-  }
-  catch (Notify n) {
-    cerr << "Error while dumping " << con.getContigName() << ".\n";
-    n.handleError(THISFUNC);
+    con.dumpContigReadList_Body(fout);
+    fout.close();
+
+    FUNCEND();
   }
-  statout.close();
 
-  FUNCEND();
-}
 
 /*************************************************************************
  *
@@ -181,19 +159,58 @@ void assout::saveStatistics(Contig & con, const string & filename, bool deleteol
  *
  *************************************************************************/
 
-void assout::saveAssemblyInfo(AssemblyInfo & asi, const string & filename, bool deleteoldfile)
-{
-  FUNCSTART("void saveAssemblyInfo(AssemblyInfo & asi, const string & filename, bool deleteoldfile)");
+  void saveStatistics(list<Contig> & clist, const string & filename, bool deleteoldfile)
+  {
+    FUNCSTART("void saveStatistics(list<Contig> & clist, const string & filename, bool deleteoldfile)");
 
-  (void) deleteoldfile;
+    //cout << "Saving project statistics to file: " << filename << endl;
 
-  ofstream infoout;
-  openFileForAppend(filename,infoout, true);
-  dateStamp(infoout);
-  infoout << '\n' << asi;
+    ofstream statout;
+    if(!openFileForAppend(filename,statout, deleteoldfile)){
+      Contig::dumpContigStatistics_Head(statout);
+    }
 
-  FUNCEND();
-}
+    for(uint32 savewhat=0; savewhat<2; savewhat++){
+      list<Contig>::iterator contigI=clist.begin();
+      for(;contigI!=clist.end(); contigI++){
+	bool saveme=false;
+	if(savewhat==0 && contigI->getNumReadsInContig()>1) saveme=true;
+	if(savewhat==1 && contigI->getNumReadsInContig()==1) saveme=true;
+	if(saveme){
+	  try{
+	    contigI->dumpContigStatistics_Body(statout);
+	  }
+	  catch (Notify n) {
+	    cerr << "Error while dumping " << contigI->getContigName() << ".\n";
+	    n.handleError(THISFUNC);
+	  }
+	}
+      }
+    }
+
+    statout.close();
+
+    FUNCEND();
+  }
+  void saveStatistics(Contig & con, const string & filename, bool deleteoldfile)
+  {
+    FUNCSTART("void saveStatistics(Contig & con, const string & filename)");
+
+    ofstream statout;
+    try{
+      if(!openFileForAppend(filename,statout, deleteoldfile)){
+	Contig::dumpContigStatistics_Head(statout);
+      }
+      con.dumpContigStatistics_Body(statout);
+    }
+    catch (Notify n) {
+      cerr << "Error while dumping " << con.getContigName() << ".\n";
+      n.handleError(THISFUNC);
+    }
+    statout.close();
+
+    FUNCEND();
+  }
 
 /*************************************************************************
  *
@@ -202,18 +219,20 @@ void assout::saveAssemblyInfo(AssemblyInfo & asi, const string & filename, bool
  *
  *************************************************************************/
 
-void assout::saveLargeContigsInfo(AssemblyInfo & asi, const string & filename, bool deleteoldfile)
-{
-  FUNCSTART("void saveLargeContigsInfo(AssemblyInfo & asi, const string & filename, bool deleteoldfile)");
+  void saveAssemblyInfo(AssemblyInfo & asi, const string & filename, bool deleteoldfile)
+  {
+    FUNCSTART("void saveAssemblyInfo(AssemblyInfo & asi, const string & filename, bool deleteoldfile)");
 
-  (void) deleteoldfile;
+    (void) deleteoldfile;
 
-  ofstream infoout;
-  openFileForAppend(filename,infoout, true);
-  asi.dumpLargeContigNames(infoout);
+    ofstream infoout;
+    openFileForAppend(filename,infoout, true);
+    dateStamp(infoout);
+    infoout << '\n' << asi;
+    infoout.close();
 
-  FUNCEND();
-}
+    FUNCEND();
+  }
 
 
 /*************************************************************************
@@ -223,58 +242,58 @@ void assout::saveLargeContigsInfo(AssemblyInfo & asi, const string & filename, b
  *
  *************************************************************************/
 
-void assout::saveReadTagList(list<Contig> & clist, const string & filename, bool deleteoldfile)
-{
-  FUNCSTART("void saveReadTagList(list<Contig> & clist, const string & filename)");
+  void saveReadTagList(list<Contig> & clist, const string & filename, bool deleteoldfile)
+  {
+    FUNCSTART("void saveReadTagList(list<Contig> & clist, const string & filename)");
 
-  //cout << "Saving read tag list to file: " << filename << endl;
+    //cout << "Saving read tag list to file: " << filename << endl;
 
-  ofstream rtout;
-  if(!openFileForAppend(filename,rtout, deleteoldfile)){
-    Contig::dumpReadTagList_Head(rtout);
-  }
+    ofstream rtout;
+    if(!openFileForAppend(filename,rtout, deleteoldfile)){
+      Contig::dumpReadTagList_Head(rtout);
+    }
 
-  for(uint32 savewhat=0; savewhat<2; savewhat++){
-    for(auto & cle : clist){
-      bool saveme=false;
-      if(savewhat==0 && cle.getNumReadsInContig()>1) saveme=true;
-      if(savewhat==1 && cle.getNumReadsInContig()==1) saveme=true;
-      if(saveme){
-	try{
-	  cle.dumpReadTagList_Body(rtout);
-	}
-	catch (Notify n) {
-	  cerr << "Error while dumping " << cle.getContigName() << ".\n";
-	  n.handleError(THISFUNC);
+    for(uint32 savewhat=0; savewhat<2; savewhat++){
+      list<Contig>::iterator contigI=clist.begin();
+      for(;contigI!=clist.end(); contigI++){
+	bool saveme=false;
+	if(savewhat==0 && contigI->getNumReadsInContig()>1) saveme=true;
+	if(savewhat==1 && contigI->getNumReadsInContig()==1) saveme=true;
+	if(saveme){
+	  try{
+	    contigI->dumpReadTagList_Body(rtout);
+	  }
+	  catch (Notify n) {
+	    cerr << "Error while dumping " << contigI->getContigName() << ".\n";
+	    n.handleError(THISFUNC);
+	  }
 	}
       }
     }
-  }
-
-  rtout.close();
 
-  FUNCEND();
-}
+    rtout.close();
 
-void assout::saveReadTagList(Contig & con, const string & filename, bool deleteoldfile)
-{
-  FUNCSTART("void saveReadTagList(Contig & con, const string & filename)");
+    FUNCEND();
+  }
+  void saveReadTagList(Contig & con, const string & filename, bool deleteoldfile)
+  {
+    FUNCSTART("void saveReadTagList(Contig & con, const string & filename)");
 
-  ofstream rtout;
-  try{
-    if(!openFileForAppend(filename,rtout,deleteoldfile)){
-      Contig::dumpReadTagList_Head(rtout);
+    ofstream rtout;
+    try{
+      if(!openFileForAppend(filename,rtout,deleteoldfile)){
+	Contig::dumpReadTagList_Head(rtout);
+      }
+      con.dumpReadTagList_Body(rtout);
     }
-    con.dumpReadTagList_Body(rtout);
-  }
-  catch (Notify n) {
-    cerr << "Error while dumping " << con.getContigName() << ".\n";
-    n.handleError(THISFUNC);
-  }
-  rtout.close();
+    catch (Notify n) {
+      cerr << "Error while dumping " << con.getContigName() << ".\n";
+      n.handleError(THISFUNC);
+    }
+    rtout.close();
 
-  FUNCEND();
-}
+    FUNCEND();
+  }
 
 
 /*************************************************************************
@@ -284,58 +303,59 @@ void assout::saveReadTagList(Contig & con, const string & filename, bool deleteo
  *
  *************************************************************************/
 
-void assout::saveConsensusTagList(list<Contig> & clist, const string & filename, bool deleteoldfile)
-{
-  FUNCSTART("void saveConsensusTagList(list<Contig> & clist, const string & filename, bool deleteoldfile)");
+  void saveConsensusTagList(list<Contig> & clist, const string & filename, bool deleteoldfile)
+  {
+    FUNCSTART("void saveConsensusTagList(list<Contig> & clist, const string & filename, bool deleteoldfile)");
 
-  //cout << "Saving contig tag list to file: " << filename << endl;
+    //cout << "Saving contig tag list to file: " << filename << endl;
 
-  ofstream ctout;
-  if(!openFileForAppend(filename,ctout,deleteoldfile)){
-    Contig::dumpConsensusTagList_Head(ctout);
-  }
+    ofstream ctout;
+    if(!openFileForAppend(filename,ctout,deleteoldfile)){
+      Contig::dumpConsensusTagList_Head(ctout);
+    }
 
-  for(uint32 savewhat=0; savewhat<2; savewhat++){
-    for(auto & cle : clist){
-      bool saveme=false;
-      if(savewhat==0 && cle.getNumReadsInContig()>1) saveme=true;
-      if(savewhat==1 && cle.getNumReadsInContig()==1) saveme=true;
-      if(saveme){
-	try{
-	  cle.dumpConsensusTagList_Body(ctout);
-	}
-	catch (Notify n) {
-	  cerr << "Error while dumping " << cle.getContigName() << ".\n";
-	  n.handleError(THISFUNC);
+    for(uint32 savewhat=0; savewhat<2; savewhat++){
+      list<Contig>::iterator contigI=clist.begin();
+      for(;contigI!=clist.end(); contigI++){
+	bool saveme=false;
+	if(savewhat==0 && contigI->getNumReadsInContig()>1) saveme=true;
+	if(savewhat==1 && contigI->getNumReadsInContig()==1) saveme=true;
+	if(saveme){
+	  try{
+	    contigI->dumpConsensusTagList_Body(ctout);
+	  }
+	  catch (Notify n) {
+	    cerr << "Error while dumping " << contigI->getContigName() << ".\n";
+	    n.handleError(THISFUNC);
+	  }
 	}
       }
     }
-  }
 
-  ctout.close();
+    ctout.close();
 
-  FUNCEND();
-}
+    FUNCEND();
+  }
 
-void assout::saveConsensusTagList(Contig & con, const string & filename, bool deleteoldfile)
-{
-  FUNCSTART("void saveConsensusTagList(Con & con, const string & filename)");
+  void saveConsensusTagList(Contig & con, const string & filename, bool deleteoldfile)
+  {
+    FUNCSTART("void saveConsensusTagList(Con & con, const string & filename)");
 
-  ofstream ctout;
-  try{
-    if(!openFileForAppend(filename,ctout,deleteoldfile)){
-      Contig::dumpConsensusTagList_Head(ctout);
+    ofstream ctout;
+    try{
+      if(!openFileForAppend(filename,ctout,deleteoldfile)){
+	Contig::dumpConsensusTagList_Head(ctout);
+      }
+      con.dumpConsensusTagList_Body(ctout);
     }
-    con.dumpConsensusTagList_Body(ctout);
-  }
-  catch (Notify n) {
-    cerr << "Error while dumping " << con.getContigName() << ".\n";
-    n.handleError(THISFUNC);
-  }
-  ctout.close();
+    catch (Notify n) {
+      cerr << "Error while dumping " << con.getContigName() << ".\n";
+      n.handleError(THISFUNC);
+    }
+    ctout.close();
 
-  FUNCEND();
-}
+    FUNCEND();
+  }
 
 
 
@@ -347,53 +367,53 @@ void assout::saveConsensusTagList(Contig & con, const string & filename, bool de
  *
  *************************************************************************/
 
-void assout::getPreviousLocusTag(const list<gbfsummary_t> & gbfs, list<gbfsummary_t>::const_iterator gbfsI, string & locustag, string & gene)
-{
-  locustag=gbfsI->locustag;
-  gene.clear();
-  bool found=false;
-  for(;!found;){
-    if(gbfsI == gbfs.begin()) break;
-    gbfsI--;
-    if(gbfsI->locustag != locustag){
-      found=true;
-      locustag=gbfsI->locustag;
-      gene=gbfsI->gene;
-      while(gene.empty()){
-	if(gbfsI == gbfs.begin()) break;
-	gbfsI--;
-	if(gbfsI->locustag==locustag) {
-	  gene=gbfsI->gene;
-	}else{
-	  break;
+  void getPreviousLocusTag(const list<gbfsummary_t> & gbfs, list<gbfsummary_t>::const_iterator gbfsI, string & locustag, string & gene)
+  {
+    locustag=gbfsI->locustag;
+    gene.clear();
+    bool found=false;
+    for(;!found;){
+      if(gbfsI == gbfs.begin()) break;
+      gbfsI--;
+      if(gbfsI->locustag != locustag){
+	found=true;
+	locustag=gbfsI->locustag;
+	gene=gbfsI->gene;
+	while(gene.empty()){
+	  if(gbfsI == gbfs.begin()) break;
+	  gbfsI--;
+	  if(gbfsI->locustag==locustag) {
+	    gene=gbfsI->gene;
+	  }else{
+	    break;
+	  }
 	}
       }
     }
+    if(!found) locustag.clear();
   }
-  if(!found) locustag.clear();
-}
 
-void assout::getNextLocusTag(const list<gbfsummary_t> & gbfs, list<gbfsummary_t>::const_iterator gbfsI, string & locustag, string & gene)
-{
-  locustag=gbfsI->locustag;
-  gene.clear();
-  bool found=false;
-  for(;!found;){
-    gbfsI++;
-    if(gbfsI == gbfs.end()) break;
-    if(gbfsI->locustag != locustag){
-      found=true;
-      locustag=gbfsI->locustag;
-      gene=gbfsI->gene;
-      while(gene.empty()){
-	gbfsI++;
-	if(gbfsI == gbfs.end() || gbfsI->locustag != locustag) break;
+  void getNextLocusTag(const list<gbfsummary_t> & gbfs, list<gbfsummary_t>::const_iterator gbfsI, string & locustag, string & gene)
+  {
+    locustag=gbfsI->locustag;
+    gene.clear();
+    bool found=false;
+    for(;!found;){
+      gbfsI++;
+      if(gbfsI == gbfs.end()) break;
+      if(gbfsI->locustag != locustag){
+	found=true;
+	locustag=gbfsI->locustag;
 	gene=gbfsI->gene;
+	while(gene.empty()){
+	  gbfsI++;
+	  if(gbfsI == gbfs.end() || gbfsI->locustag != locustag) break;
+	  gene=gbfsI->gene;
+	}
       }
     }
+    if(!found) locustag.clear();
   }
-  if(!found) locustag.clear();
-}
 
 /*************************************************************************
  *
@@ -402,344 +422,217 @@ void assout::getNextLocusTag(const list<gbfsummary_t> & gbfs, list<gbfsummary_t>
  *
  *************************************************************************/
 
-//#define CEBUG(bla) {cout << bla; cout.flush();}
-void assout::saveSNPList(list<Contig> & clist, const string & filename, bool deleteoldfile)
-{
-  FUNCSTART("void saveSNPList(list<Contig> & clist, const string & filename, bool deleteoldfile)");
-
-  cout << "Saving SNP list to file: " << filename << endl;
-
-  ofstream saout;
-  if(!openFileForAppend(filename,saout,deleteoldfile)){
-    saout << "#Note: this file is only useful when having assembled with data"
-      "\n#containing GenBank features."
-      "\n#A list of all SNP tags (SROc, SIOc, SAOc and eventually MCVc is"
-      "\n#in the 'consensustaglist' file."
-      "\n# Contig\t"
-      "Contig position\t"
-      "Reference\t"
-      "Reference position\t"
-      "Reference map position\t"
-      "SNP type\t"
-      "countAf\t"
-      "countAr\t"
-      "countCf\t"
-      "countCr\t"
-      "countGf\t"
-      "countGr\t"
-      "countTf\t"
-      "countTr\t"
-      "count*f\t"
-      "count*r\t"
-      "Feature type\t"
-      "Hit locus\t"
-      "Gene name\t"
-      "EC num\t"
-      "Product\t"
-      "Function\t"
-      "Note\n";
-  }
-
-  saout << setprecision(1) << fixed;
-
-  // to get reference positions right for consensus bases, we need to get
-  // the reference sequence
-  string refseq;
-  vector<base_quality_t> refqual;
+  void saveSNPList(list<Contig> & clist, const string & filename, bool deleteoldfile)
+  {
+    FUNCSTART("void saveSNPList(list<Contig> & clist, const string & filename, bool deleteoldfile)");
+    
+    cout << "Saving SNP list to file: " << filename << endl;
+
+    ofstream saout;
+    if(!openFileForAppend(filename,saout,deleteoldfile)){
+      saout << "#Note: this file is only useful whan having assembled with data\n"
+	"\n#containing GenBank features."
+	"\n#A list of all SNP tags (SROc, SIOc, SAOc and eventually MCVc is"
+	"\n#in the 'consensustaglist' file.\n"
+	"# Contig\t"
+	"Contig position\t"
+	"Reference\t"
+	"Reference position\t"
+	"Reference map position\t"
+	"SNP type\t"
+	"Feature type\t"
+	"Hit locus\t"
+	"Gene name\t"
+	"EC num\t"
+	"Product\t"
+	"Function\t"
+	"Note\n";
+    }
 
-  // search for the rg id with the refernce in it (may be not present)
-  uint32 refid=1;
-  for(; refid<ReadGroupLib::getNumReadGroups(); ++refid){
-    auto rgid=ReadGroupLib::getReadGroupID(refid);
-    if(rgid.isBackbone() && !rgid.isRail()) break;
-  }
-  // and refpos as re-usable vector for the loop further down;
-  vector<uint32> refpos;
+    saout << setprecision(1) << fixed;
 
-  for(auto & cle : clist){
-    cle.sortConsensusTags();
-    const PlacedContigReads & pcr = cle.getContigReads();
-    for(auto & cr : pcr) {
-      const_cast<Read &>(cr).sortTags();
+    list<Contig>::iterator cI=clist.begin();
+    for(;cI!=clist.end(); cI++){
+      cI->sortConsensusTags();
+      vector<Contig::contigread_t>::const_iterator R=cI->getContigReads().begin();
+      for(; R != cI->getContigReads().end() ; R++) {
+	const_cast<Read &>(R->read).sortTags();
+      }
     }
-  }
 
-  // we will look at all GBF features (empty allowed)
-  vector<multitag_t::mte_id_t> allowedfeatures;
-  // but not at Fsrc
-  vector<multitag_t::mte_id_t> forbiddenfeatures;
-  forbiddenfeatures.push_back(Read::REA_tagentry_idSOFAdatabank_entry);
-  //forbiddenfeatures.push_back("FCDS");
+    // we will look at all GBF features (empty allowed)
+    vector<multitag_t::mte_id_t> allowedfeatures;
+    // but not at Fsrc
+    vector<multitag_t::mte_id_t> forbiddenfeatures;
+    forbiddenfeatures.push_back(Read::REA_tagentry_idFsrc);
+    //forbiddenfeatures.push_back("FCDS");
 
-  string gene;
-  string function;
-  string ecnumber;
-  string product;
-  string note;
+    string gene;
+    string function;
+    string ecnumber;
+    string product;
+    string note;
 
-  for(auto & cle : clist){
     try{
-      // generate contig pos to reference translations
-      // remember, the output is with 1 as first base!
-      refpos.clear();
-      refpos.resize(cle.getContigLength());
-      if(refid==ReadGroupLib::getNumReadGroups()){
-	// default translations
-	uint32 count=1;
-	for(auto & x : refpos) x=count++;
-      }else{
-	// translations if we HAVE a reference
-	cle.newConsensusGet(refseq, refqual, refid);
-	uint32 count=1;
-	{
-	  auto rsI=refseq.begin();
-	  auto rpI=refpos.begin();
-	  // jump over first Xs which mark non-covered reference sequence
-	  for(;rsI!=refseq.end() && toupper(*rsI)=='X'; ++rsI, ++rpI){
-	    *rpI=count;
-	  }
-	  // calc positions, gaps do not increase pos-count
-	  for(;rsI!=refseq.end(); ++rsI, ++rpI){
-	    *rpI=count;
-	    if(*rsI!='*') ++count;
-	  }
-	}
-	{
-	  // and simulate a jump at the end of the sequence which might consist of Xs.
-	  --count;
-	  auto rsI=refseq.rbegin();
-	  auto rpI=refpos.rbegin();
-	  for(;rsI!=refseq.rend() && toupper(*rsI)=='X'; ++rsI, ++rpI){
-	    *rpI=count;
-	  }
-	}
-      }
-
-      list<gbfsummary_t> allGBfeatures;
-      cle.getGBFSummary(allGBfeatures,allowedfeatures,forbiddenfeatures, true, true);
-
-      for(auto & cont : cle.getConsensusTags()) {
-	if(!(cont.identifier==Contig::CON_tagentry_idSAOc
-	     || cont.identifier==Contig::CON_tagentry_idSIOc
-	     || cont.identifier==Contig::CON_tagentry_idSROc
-	     )) continue;
-	bool infeature=false;
+      for(cI=clist.begin();cI!=clist.end(); cI++){
+	list<gbfsummary_t> allGBfeatures;
+	cI->getGBFSummary(allGBfeatures,allowedfeatures,forbiddenfeatures, true);
 
-	CEBUG("cont ID: " << cont.getIdentifierStr() << '\t' << cont.from << '\t' << cont.to << endl);
+	vector<Contig::consensustag_t>::const_iterator consT=cI->getConsensusTags().begin();
+	for(; consT != cI->getConsensusTags().end() ; consT++) {
 
-	list<gbfsummary_t>::const_iterator gbfsI=allGBfeatures.begin();
-	for(; gbfsI != allGBfeatures.end(); gbfsI++){
-	  if(gbfsI->identifier == multitag_t::getIdentifierStr(Read::REA_tagentry_idSOFACDS)) continue;
-	  CEBUG(' ' << gbfsI->identifier << '\t' << gbfsI->locustag << '\t' << gbfsI->cfrom << '\t' << gbfsI->cto << '\n');
+	  if(!(consT->identifier==Contig::CON_tagentry_idSAOc
+	       || consT->identifier==Contig::CON_tagentry_idSIOc
+	       || consT->identifier==Contig::CON_tagentry_idSROc
+	       )) continue;
+	  bool infeature=false;
+	
+	  CEBUG("consT ID: " << consT->identifier << '\t' << consT->from << '\t' << consT->to << endl);
 
-	  if(gbfsI->cfrom <= cont.from && gbfsI->cto >= cont.to){
-	    CEBUG("Hit! cont ID: " << cont.getIdentifierStr() << '\t' << cont.from << '\t' << cont.to << endl);
+	  list<gbfsummary_t>::const_iterator gbfsI=allGBfeatures.begin();
 
-	    int32 adjposfroml=cont.from;
-	    int32 adjposfromr=adjposfroml;
+	  for(; gbfsI != allGBfeatures.end(); gbfsI++){
+	    if(gbfsI->identifier == multitag_t::getIdentifierStr(Read::REA_tagentry_idFCDS)) continue;
+	    CEBUG(' ' << gbfsI->identifier << '\t' << gbfsI->locustag << '\t' << gbfsI->cfrom << '\t' << gbfsI->cto << '\n');
 
-	    string wherename;
-	    int32 wherelen=cle.getContigLength();
-	    if(gbfsI->pcrI != cle.getContigReads().end()){
-	      const Read & featureread=*(gbfsI->pcrI);
+	    if(gbfsI->cfrom <= consT->from && gbfsI->cto >= consT->to){
+	      const Read & featureread=cI->getReadAtIndex(gbfsI->readindex);
 	      CEBUG("is in read: " << featureread.getName() << '\n');
-	      //CEBUG(featureread);
-	      wherename=featureread.getName();
-	      int32 rreadposfrom=cle.getRealReadPos(cont.from,gbfsI->pcrI);
-	      CEBUG("rreadposfrom: " << rreadposfrom << endl);
-	      if(rreadposfrom>=0 && rreadposfrom<featureread.getLenClippedSeq()){
-		adjposfroml=featureread.getLowerNonGapAdjustmentPosOfReadPos(rreadposfrom)+1;
-		adjposfromr=featureread.getUpperNonGapAdjustmentPosOfReadPos(rreadposfrom)+1;
-	      }
-	    }else{
-	      CEBUG("Is in consensus\n");
-	      wherename="on consensus";
-	      // get the positions from the reference reconstruction done earlier
-	      for(; adjposfroml>0 && refseq[adjposfroml]=='*'; --adjposfroml);
-	      adjposfroml=refpos[adjposfroml];
-	      for(; adjposfromr<refseq.size()-1 && refseq[adjposfromr]=='*'; ++adjposfromr);
-	      adjposfromr=refpos[adjposfromr];
+	      CEBUG(featureread);
+	      //CEBUG("Hit!\n");
+	      string serialc;
+	      infeature=true;
+
+	      CEBUG("#1" << endl);
+
+	      cI->concatAllGBFInfoForLocus(allGBfeatures, gbfsI, "; ", gene, function, ecnumber, product, note);
+
+	      CEBUG("#2" << endl);
+
+	      int32 freadposfrom=cI->getRealReadPos(consT->from,gbfsI->readindex);
+	      CEBUG("#3" << endl);
+	      int32 adjposfroml=featureread.getLowerNonGapAdjustmentPosOfReadPos(freadposfrom)+1;
+	      CEBUG("#4" << endl);
+	      int32 adjposfromr=featureread.getUpperNonGapAdjustmentPosOfReadPos(freadposfrom)+1;
+	      CEBUG("#5" << endl);
+
+	      //<< '\t' << I->paddedPos2UnpaddedPos(consT->from)
+	      saout << cI->getContigName()
+		    << '\t' << consT->from
+		    << '\t' << featureread.getName()
+		    << '\t' << adjposfroml;
+	      if(adjposfroml!=adjposfromr) saout << ':' << adjposfromr;
+	      saout << '\t' << (1.0/featureread.getLenSeq()*adjposfroml*360)
+		    << '\t' << consT->getIdentifierStr()
+		    << '\t' << gbfsI->identifier
+		    << '\t' << gbfsI->locustag
+		    << '\t' << gene
+		    << '\t' << ecnumber
+		    << '\t' << product
+		    << '\t' << function
+		    << '\t' << note
+		    << endl;
+	      //<< '\n';
 	    }
+	  }
 
-	    string serialc;
-	    infeature=true;
-
-	    CEBUG("#1" << endl);
-
-	    cle.concatAllGBFInfoForLocus(allGBfeatures, gbfsI, "; ", gene, function, ecnumber, product, note);
-
-	    CEBUG("#2" << endl);
-
-	    //<< '\t' << I->paddedPos2UnpaddedPos(cont.from)
-	    saout << cle.getContigName()
-		  << '\t' << cont.from
-		  << '\t' << wherename
-		  << '\t' << adjposfroml;
-	    if(adjposfroml!=adjposfromr) saout << ':' << adjposfromr;
-	    saout << '\t' << (1.0/wherelen*adjposfroml*360)
-		  << '\t' << cont.getIdentifierStr()
-		  << '\t' << cont.countACGTGapf[0]
-		  << '\t' << cont.countACGTGapr[0]
-		  << '\t' << cont.countACGTGapf[1]
-		  << '\t' << cont.countACGTGapr[1]
-		  << '\t' << cont.countACGTGapf[2]
-		  << '\t' << cont.countACGTGapr[2]
-		  << '\t' << cont.countACGTGapf[3]
-		  << '\t' << cont.countACGTGapr[3]
-		  << '\t' << cont.countACGTGapf[4]
-		  << '\t' << cont.countACGTGapr[4]
-		  << '\t' << gbfsI->identifier
-		  << '\t' << gbfsI->locustag
-		  << '\t' << gene
-		  << '\t' << ecnumber
-		  << '\t' << product
-		  << '\t' << function
-		  << '\t' << note
+	  if(!infeature) {
+	    saout << cI->getContigName()
+		  << '\t' << consT->from
+		  << "\tn/a"
+		  << "\tn/a"
+		  << "\tn/a"
+		  << '\t' << consT->getIdentifierStr()
+		  << '\t' 
+		  << '\t'
+		  << '\t'
+		  << '\t'
+		  << '\t'
+		  << '\t'
+		  << "\tNot covered by any GenBank feature"
 		  << endl;
-	    //<< '\n';
 	  }
 	}
-
-	if(!infeature) {
-	  saout << cle.getContigName()
-		<< '\t' << cont.from
-		<< "\tn/a"
-		<< "\tn/a"
-		<< "\tn/a"
-		<< '\t' << cont.getIdentifierStr()
-		<< '\t' << cont.countACGTGapf[0]
-		<< '\t' << cont.countACGTGapr[0]
-		<< '\t' << cont.countACGTGapf[1]
-		<< '\t' << cont.countACGTGapr[1]
-		<< '\t' << cont.countACGTGapf[2]
-		<< '\t' << cont.countACGTGapr[2]
-		<< '\t' << cont.countACGTGapf[3]
-		<< '\t' << cont.countACGTGapr[3]
-		<< '\t' << cont.countACGTGapf[4]
-		<< '\t' << cont.countACGTGapr[4]
-		<< '\t'
-		<< '\t'
-		<< '\t'
-		<< '\t'
-		<< '\t'
-		<< '\t'
-		<< "\tNot covered by any GenBank feature"
-		<< endl;
-	}
       }
     }
     catch (Notify n) {
-      cerr << "Error while dumping " << cle.getContigName() << ".\n";
+      cerr << "Error while dumping " << cI->getContigName() << ".\n";
       n.handleError(THISFUNC);
     }
     FUNCEND();
   }
-}
-//#define CEBUG(bla) {cout << bla; cout.flush();}
 
 
 
 
 
-/*************************************************************************
- *
- * this function relies on tags having SO feature names
- *
- *************************************************************************/
+  struct shortgbfinfo_t {
+    string identifier;
+    string locustag;
 
-void assout::saveCoverageInfo(list<Contig> & clist, const string & filename, bool deleteoldfile)
-{
-  FUNCSTART("void saveCoverageInfo(list<Contig> & clist, const string & filename, bool deleteoldfile)");
-
-  cout << "Saving coverage info to file: " << filename << endl;
-
-  ofstream saout;
-  if(!openFileForAppend(filename,saout,deleteoldfile)){
-    saout << "#Note: this file is only useful when having assembled with data"
-      "\n#containing SequenceOntology features."
-      "\n# Contig\t"
-      "Feature ID\t"
-      "Feature name\t"
-      "Feature type\t"
-      "Feature from\t"
-      "Feature to\t"
-      "Cov Min\t"
-      "Cov Max\t"
-      "Cov Mean\t"
-      "Cov Median\t"
-      "Cov StdDev\t"
-      "Cov Status\t"
-      "Cov Factor\t"
-      "Product\t"
-      "Function\t"
-      "GO component\t"
-      "GO function\t"
-      "GO process\t"
-      "Note\t"
-      "GFF3-attributes\t"
-      "\n"
-      ;
-  }
+    string gene;
+    string function;
+    string ecnumber;
+    string product;
+    string note;
 
-  list<contigSOtag_t> allSOtags;
-  list<tagcoverageinfo_t> tagcovinfo;
-
-  static const string idstring("ID");
-  static const string locusstring("locus_tag");
-  static const string prodstring("product");
-  static const string funcstring("function");
-  static const string gocostring("gO_component");
-  static const string gofustring("gO_function");
-  static const string goprstring("gO_process");
-  static const string notestring("Note");
-  static const string notestring2("note");
-
-  for(auto & cle : clist){
-    cle.getSeqOntTags(allSOtags);
-    cle.calcSOTagCoverage(allSOtags,tagcovinfo);
-    const tagcoverageinfo_t & contig_tci=tagcovinfo.front();
-
-    for(auto & tce : tagcovinfo){
-      saout << setprecision(1) << fixed;
-
-      string id(GFFParse::extractKeytag(idstring,tce.csot.multitag.getCommentStr()));
-      if(id.empty()){
-	// no ID? Maybe because we loaded a GenBank file. Take locus_tag instead.
-	id=GFFParse::extractKeytag(locusstring,tce.csot.multitag.getCommentStr());
+    friend ostream & operator<<(ostream &ostr, const shortgbfinfo_t & sgi){
+      ostr << "identifier: " << sgi.identifier
+	   << "\nlocustag  : " << sgi.locustag
+	   << "\ngene      : " << sgi.gene
+	   << "\nfunction  : " << sgi.function
+	   << "\necnumber  : " << sgi.ecnumber
+	   << "\nproduct   : " << sgi.product
+	   << "\nnote      : " << sgi.note
+	   << endl;
+      return ostr;
+    }
+  };
+
+  struct snpenv_t {
+    list<Contig>::iterator cI;
+    string snpjumpname;
+
+    list<gbfsummary_t> gbfslist;
+    list<shortgbfinfo_t> sgilist;
+    
+    uint32 from;
+    uint32 to;
+    uint32 numsnps;   
+
+    friend ostream & operator<<(ostream &ostr, const snpenv_t & se){
+      ostr << "Contig: " << se.cI->getContigName()
+	   << "\njumpname: " << se.snpjumpname
+	   << "\nfrom      : " << se.from
+	   << "\nto        : " << se.to
+	   << "\nnumsnps   : " << se.numsnps
+	   << endl;
+
+      ostr << "gbfslist: ";
+      if(se.gbfslist.empty()){
+	ostr << "empty\n";
+      }else{
+	ostr << "\n";
+	list<gbfsummary_t>::const_iterator gbfsI=se.gbfslist.begin();
+	for(; gbfsI!=se.gbfslist.end(); gbfsI++){
+	  ostr << *gbfsI;
+	}
       }
-      string cname(GFFParse::extractCommonName(tce.csot.multitag.getCommentStr()));
-      if(cname==id) cname.clear();
-      string thisnote(GFFParse::extractKeytag(notestring,tce.csot.multitag.getCommentStr()));
-      if(thisnote.empty()){
-	// *sigh* Some files have "note=" instead of "Note="
-	thisnote=GFFParse::extractKeytag(notestring2,tce.csot.multitag.getCommentStr());
+      ostr << "sgilist: ";
+      if(se.sgilist.empty()){
+	ostr << "empty\n";
+      }else{
+	ostr << "\n";
+	list<shortgbfinfo_t>::const_iterator sgI=se.sgilist.begin();
+	for(; sgI!=se.sgilist.end(); sgI++){
+	  ostr << *sgI;
+	}
       }
 
-      saout << cle.getContigName()
-	    << "\t" << id
-	    << "\t" << replaceEmptyString(cname)
-	    << "\t" << replaceEmptyString(tce.csot.multitag.getIdentifierStr())
-	    << "\t" << tce.csot.multitag.from+1
-	    << "\t" << tce.csot.multitag.to+1
-	    << "\t" << tce.ccinfo.min
-	    << "\t" << tce.ccinfo.max
-	    << "\t" << tce.ccinfo.mean
-	    << "\t" << tce.ccinfo.median
-	    << "\t" << tce.ccinfo.stddev
-	    << "\t" << replaceEmptyString(tce.comparator_text)
-	    << "\t" << setprecision(2) << fixed << tce.comparator_factor
-	    << "\t" << htmlCode(replaceEmptyString(GFFParse::extractKeytag(prodstring,tce.csot.multitag.getCommentStr())))
-	    << "\t" << htmlCode(replaceEmptyString(GFFParse::extractKeytag(funcstring,tce.csot.multitag.getCommentStr())))
-	    << "\t" << htmlCode(replaceEmptyString(GFFParse::extractKeytag(gocostring,tce.csot.multitag.getCommentStr())))
-	    << "\t" << htmlCode(replaceEmptyString(GFFParse::extractKeytag(gofustring,tce.csot.multitag.getCommentStr())))
-	    << "\t" << htmlCode(replaceEmptyString(GFFParse::extractKeytag(goprstring,tce.csot.multitag.getCommentStr())))
-	    << "\t" << htmlCode(replaceEmptyString(thisnote))
-	    << "\t" << tce.csot.multitag.getCommentStr()
-	    << "\n";
+      return ostr;
     }
-  }
-}
 
+  };
 
 
 
@@ -752,216 +645,246 @@ void assout::saveCoverageInfo(list<Contig> & clist, const string & filename, boo
 
 //#define CEBUG(bla) {cout << bla; cout.flush();}
 
-void assout::saveSNPSurroundingAsHTML(list<Contig> & clist, const string & filename, bool deleteoldfile)
-{
-  FUNCSTART("void saveSNPList(list<Contig> & clist, const string & filename, bool deleteoldfile)");
-
-  cout << "Saving SNP surroundings as HTML to file: " << filename << endl;
-
-  ofstream htmlout;
-  if(!openFileForAppend(filename,htmlout,deleteoldfile)){
-    dumpHTMLHeader("SOME PROJECT NAME",htmlout);
-  }
-  htmlout << "<p>";
-
-  //htmlout << setprecision(1) << fixed;
+  void saveSNPSurroundingAsHTML(list<Contig> & clist, const string & filename, bool deleteoldfile)
+  {
+    FUNCSTART("void saveSNPList(list<Contig> & clist, const string & filename, bool deleteoldfile)");
+    
+    cout << "Saving SNP surroundings as HTML to file: " << filename << endl;
 
-  for(auto & cle : clist){
-    cle.sortConsensusTags();
-    for(auto & cr : cle.getContigReads()) {
-      const_cast<Read &>(cr).sortTags();
+    ofstream htmlout;
+    if(!openFileForAppend(filename,htmlout,deleteoldfile)){
+      dumpHTMLHeader("SOME PROJECT NAME",htmlout);
     }
-  }
+    htmlout << "<p>";
 
-  CEBUG("Num contigs: " << clist.size() << '\n');
-
-  uint32 surrounding=39;
-  uint32 maxdistformerge=5;
+    //htmlout << setprecision(1) << fixed;
 
+    list<Contig>::iterator cI=clist.begin();
+    for(;cI!=clist.end(); cI++){
+      cI->sortConsensusTags();
+      vector<Contig::contigread_t>::const_iterator R=cI->getContigReads().begin();
+      for(; R != cI->getContigReads().end() ; R++) {
+	const_cast<Read &>(R->read).sortTags();
+      }
+    }
+    
+   CEBUG("Num contigs: " << clist.size() << '\n');
 
-  // we will look at all GBF features (empty allowed)
-  vector<multitag_t::mte_id_t> allowedfeatures;
-  // but not at Fsrc
-  vector<multitag_t::mte_id_t> forbiddenfeatures;
-  forbiddenfeatures.push_back(Read::REA_tagentry_idSOFAdatabank_entry);
+    uint32 surrounding=39;
+    uint32 maxdistformerge=5;
 
-  list<gbfsummary_t> allGBfeatures;
 
-  // two loops: first to collect all names, then to
-  //  print out navigation and snps
+    // we will look at all GBF features (empty allowed)
+    vector<multitag_t::mte_id_t> allowedfeatures;
+    // but not at Fsrc
+    vector<multitag_t::mte_id_t> forbiddenfeatures;
+    forbiddenfeatures.push_back(Read::REA_tagentry_idFsrc);
 
-  list<snpenv_t> snpenvironments;
-  uint32 snpjumpnamenr=0;
+    list<gbfsummary_t> allGBfeatures;
 
-  snpenv_t dummysnpenv;
-  dummysnpenv.from=0;
-  dummysnpenv.to=0;
-  dummysnpenv.numsnps=1;
-  for(auto cI=clist.begin(); cI!=clist.end(); ++cI){
-    cI->getGBFSummary(allGBfeatures,allowedfeatures,forbiddenfeatures, true, true);
-    for(auto & cont : cI->getConsensusTags()) {
-      if(!(cont.identifier==Contig::CON_tagentry_idSAOc
-	   || cont.identifier==Contig::CON_tagentry_idSIOc
-	   || cont.identifier==Contig::CON_tagentry_idSROc
-	   || cont.identifier==Contig::CON_tagentry_idMCVc
-	   )) continue;
-      //
-      CEBUG("Found tag: " << cont.getIdentifierStr() << "\t" << cont.from << '\n');
-      if(snpenvironments.empty()){
-	dummysnpenv.cI=cI;
-	dummysnpenv.from=cont.from;
-	dummysnpenv.to=cont.to;
-	snpenvironments.push_back(dummysnpenv);
-      }else{
-	if(snpenvironments.back().cI == cI
-	   && cont.to <= snpenvironments.back().to+maxdistformerge){
-	  snpenvironments.back().to=cont.to;
-	  snpenvironments.back().numsnps+=1;
-	}else{
+    // two loops: first to collect all names, then to 
+    //  print out navigation and snps
+
+    list<snpenv_t> snpenvironments;
+    uint32 snpjumpnamenr=0;
+    
+    snpenv_t dummysnpenv;
+    dummysnpenv.from=0;
+    dummysnpenv.to=0;
+    dummysnpenv.numsnps=1;
+    for(cI=clist.begin();cI!=clist.end(); cI++){
+      cI->getGBFSummary(allGBfeatures,allowedfeatures,forbiddenfeatures, true);
+      vector<Contig::consensustag_t>::const_iterator consT=cI->getConsensusTags().begin();
+      for(; consT != cI->getConsensusTags().end() ; consT++) {
+	if(!(consT->identifier==Contig::CON_tagentry_idSAOc
+	     || consT->identifier==Contig::CON_tagentry_idSIOc
+	     || consT->identifier==Contig::CON_tagentry_idSROc
+	     || consT->identifier==Contig::CON_tagentry_idMCVc
+	     )) continue;
+	// 
+	CEBUG("Found tag: " << consT->identifier << "\t" << consT->from << '\n');
+	if(snpenvironments.empty()){
 	  dummysnpenv.cI=cI;
-	  dummysnpenv.from=cont.from;
-	  dummysnpenv.to=cont.to;
-	  snpenvironments.push_back(dummysnpenv);
+	  dummysnpenv.from=consT->from;
+	  dummysnpenv.to=consT->to;
+	  snpenvironments.push_back(dummysnpenv);	  
+	}else{
+	  if(snpenvironments.back().cI == cI 
+	     && consT->to <= snpenvironments.back().to+maxdistformerge){
+	    snpenvironments.back().to=consT->to;
+	    snpenvironments.back().numsnps+=1;
+	  }else{
+	    dummysnpenv.cI=cI;
+	    dummysnpenv.from=consT->from;
+	    dummysnpenv.to=consT->to;
+	    snpenvironments.push_back(dummysnpenv);	  
+	  }
 	}
       }
     }
-  }
 
-  CEBUG("SNP environments: " << snpenvironments.size() << '\n');
-
-  {
-    for(auto & see : snpenvironments){
-      CEBUG("Checking seI: " << see);
-
-      ostringstream snpcoordostr;
-      string firstlocus="";
-      string lastlocus="";
-      int32 lowestpos=0x7fffffff;
-      int32 highestpos=0;
-
-      bool featurefound=false;
-      list<gbfsummary_t>::const_iterator gbfsI=allGBfeatures.begin();
-      for(; gbfsI != allGBfeatures.end() && !featurefound; gbfsI++){
-	// careful, snpenv from/to is [...[ while gbfsI is [...] !
-	if(see.to<=gbfsI->cfrom
-	   || see.from > gbfsI->cto) continue;
-//	  if((see.from >= gbfsI->cfrom && see.from <= gbfsI->cto)
-//	     || (see.to >= gbfsI->cfrom && see.to <= gbfsI->cto)
-//	     || (see.from <= gbfsI->cfrom && see.to >= gbfsI->cto)){
-	{
-	  CEBUG(' ' << gbfsI->identifier << '\t' << gbfsI->locustag << '\t' << gbfsI->cfrom << '\t' << gbfsI->cto << ' ' << gbfsI->note << endl);
-	  CEBUG("gbfsI: " << *gbfsI);
-	  CEBUG("Hit!\n");
+    CEBUG("SNP environments: " << snpenvironments.size() << '\n');
+
+//    list<snpenv_t>::iterator seI=snpenvironments.begin();
+//    for(; seI != snpenvironments.end(); seI++){
+//      ostringstream snpcoordostr;      
+//      
+//      bool featurefound=false;
+//      list<gbfsummary_t>::const_iterator gbfsI=allGBfeatures.begin();
+//      for(; gbfsI != allGBfeatures.end() && !featurefound; gbfsI++){
+//	if(gbfsI->cfrom <= seI->from && gbfsI->cto >= seI->to){
+//	  CEBUG(' ' << gbfsI->identifier << '\t' << gbfsI->locustag << '\t' << gbfsI->cfrom << '\t' << gbfsI->cto << endl);
+//	  CEBUG("Hit!\n");
+//	  featurefound=true;
+//
+//	  seI->identifier=gbfsI->identifier;
+//	  seI->locustag=gbfsI->locustag;
+//	  cI=seI->cI;
+//	  const Read & featureread=cI->getReadAtIndex(gbfsI->readindex);
+//	  
+//	  cI->concatAllGBFInfoForLocus(allGBfeatures, gbfsI, "; ", seI->gene, seI->function, seI->ecnumber, seI->product, seI->note);
+//	  
+//	  int32 freadposfrom=cI->getRealReadPos(seI->from,gbfsI->readindex);
+//	  CEBUG("#b1" << endl);
+//	  int32 adjposfroml=featureread.getLowerNonGapAdjustmentPosOfReadPos(freadposfrom)+1;
+//	  CEBUG("#b2" << endl);
+//	  int32 adjposfromr=featureread.getUpperNonGapAdjustmentPosOfReadPos(freadposfrom)+1;
+//	  
+//	  snpcoordostr << gbfsI->locustag << '_' << adjposfroml;
+//	  if(adjposfroml!=adjposfromr) snpcoordostr << ':' << adjposfromr;
+//	  
+//	  seI->snpjumpname=snpcoordostr.str();
+//
+//	  CEBUG("jumpname: " << seI->snpjumpname << endl);
+//	}
+//      }
+//      if(!featurefound) {
+//	CEBUG("WARNING: No feature found???\n" << *seI << endl);
+//      }
+//    }
+
+    list<snpenv_t>::iterator seI=snpenvironments.begin();
+    {
+      for(; seI != snpenvironments.end(); seI++){
+	CEBUG("Checking seI: " << *seI);
 
-	  //// we can stop if we find a Fgen
-	  //if(gbfsI->identifier == "Fgen"){
-	  //  featurefound=true;
-	  //}
+	ostringstream snpcoordostr;
+	string firstlocus="";
+	string lastlocus="";
+	int32 lowestpos=0x7fffffff;
+	int32 highestpos=0;
 
-	  see.gbfslist.push_back(*gbfsI);
-
-	  shortgbfinfo_t sgitmp;
-	  sgitmp.identifier=gbfsI->identifier;
-	  sgitmp.locustag=gbfsI->locustag;
-	  auto cI=see.cI;
-	  cI->concatAllGBFInfoForLocus(allGBfeatures, gbfsI, "; ", sgitmp.gene, sgitmp.function, sgitmp.ecnumber, sgitmp.product, sgitmp.note);
-	  see.sgilist.push_back(sgitmp);
-
-	  int32 adjposfroml=see.from;
-	  int32 adjposfromr=adjposfroml;
-
-	  // careful, gbfsummary_t may have been made by a consensus tag,
-	  //  therefore having a pcrI of end()
-	  if(gbfsI->pcrI != cI->getContigReads().end()){
-	    const Read & featureread=*(gbfsI->pcrI);
-	    int32 rreadposfrom=cI->getRealReadPos(see.from,gbfsI->pcrI);
-	    CEBUG("rreadposfrom: " << rreadposfrom << endl);
-	    if(rreadposfrom>=0 && rreadposfrom<featureread.getLenClippedSeq()){
-	      adjposfroml=featureread.getLowerNonGapAdjustmentPosOfReadPos(rreadposfrom)+1;
-	      adjposfromr=featureread.getUpperNonGapAdjustmentPosOfReadPos(rreadposfrom)+1;
+	bool featurefound=false;
+	list<gbfsummary_t>::const_iterator gbfsI=allGBfeatures.begin();
+	for(; gbfsI != allGBfeatures.end() && !featurefound; gbfsI++){
+	  //if(gbfsI->cfrom <= seI->from && gbfsI->cto >= seI->to){
+	  if((seI->from >= gbfsI->cfrom && seI->from <= gbfsI->cto)
+	     || (seI->to >= gbfsI->cfrom && seI->to <= gbfsI->cto)
+	     || (seI->from <= gbfsI->cfrom && seI->to >= gbfsI->cto)){
+	    
+	    CEBUG(' ' << gbfsI->identifier << '\t' << gbfsI->locustag << '\t' << gbfsI->cfrom << '\t' << gbfsI->cto << endl);
+	    CEBUG("Hit!\n");
+	    
+	    //// we can stop if we find a Fgen
+	    //if(gbfsI->identifier == "Fgen"){
+	    //  featurefound=true;
+	    //}
+	    
+	    seI->gbfslist.push_back(*gbfsI);
+	    
+	    shortgbfinfo_t sgitmp;
+	    sgitmp.identifier=gbfsI->identifier;
+	    sgitmp.locustag=gbfsI->locustag;
+	    cI=seI->cI;
+	    cI->concatAllGBFInfoForLocus(allGBfeatures, gbfsI, "; ", sgitmp.gene, sgitmp.function, sgitmp.ecnumber, sgitmp.product, sgitmp.note);
+	    seI->sgilist.push_back(sgitmp);
+	    
+	    const Read & featureread=cI->getReadAtIndex(gbfsI->readindex);
+	    int32 freadposfrom=cI->getRealReadPos(seI->from,gbfsI->readindex);
+	    int32 adjposfroml=featureread.getLowerNonGapAdjustmentPosOfReadPos(freadposfrom)+1;
+	    int32 adjposfromr=featureread.getUpperNonGapAdjustmentPosOfReadPos(freadposfrom)+1;
+	    
+	    if(adjposfroml<lowestpos){
+	      lowestpos=adjposfroml;
+	    }
+	    if(adjposfromr>highestpos){
+	      highestpos=adjposfromr;
+	    }
+	    if(!gbfsI->locustag.empty()){
+	      if(firstlocus.empty()) firstlocus=gbfsI->locustag;
+	      lastlocus=gbfsI->locustag;
 	    }
-	    CEBUG("yo" << endl);
-	  }
-	  if(adjposfroml<lowestpos){
-	    lowestpos=adjposfroml;
-	  }
-	  if(adjposfromr>highestpos){
-	    highestpos=adjposfromr;
-	  }
-	  if(!gbfsI->locustag.empty()){
-	    if(firstlocus.empty()) firstlocus=gbfsI->locustag;
-	    lastlocus=gbfsI->locustag;
 	  }
 	}
-      }
-      if(firstlocus.empty()){
-	snpcoordostr << "nodesc_" << lowestpos;
-      }else{
-	if(firstlocus==lastlocus){
-	  snpcoordostr << firstlocus << '_' << lowestpos;
+	if(firstlocus.empty()){
+	  snpcoordostr << "nodesc_" << lowestpos;
 	}else{
-	  snpcoordostr << firstlocus << '-' << lastlocus << '_' << lowestpos;
+	  if(firstlocus==lastlocus){
+	    snpcoordostr << firstlocus << '_' << lowestpos;
+	  }else{
+	    snpcoordostr << firstlocus << '-' << lastlocus << '_' << lowestpos;
+	  }
 	}
-      }
-      if(lowestpos!=highestpos) snpcoordostr << ':' << highestpos;
-      see.snpjumpname=snpcoordostr.str();
-      CEBUG("jumpname: " << see.snpjumpname << endl);
+	if(lowestpos!=highestpos) snpcoordostr << ':' << highestpos;
+	seI->snpjumpname=snpcoordostr.str();
+	CEBUG("jumpname: " << seI->snpjumpname << endl);
 
-      if(see.gbfslist.empty()) {
-	CEBUG("WARNING: No feature found???\n" << see << endl);
+	if(seI->gbfslist.empty()) {
+	  CEBUG("WARNING: No feature found???\n" << *seI << endl);
+	}
       }
     }
-  }
 
-  // for each snpenvironment:
-  //  if there were gene or CDS: keep just those entries with the same locus tags
-  //  else if there were entries with locus tags, just keep those entries
-  {
-    for(auto & see : snpenvironments){
-      list<gbfsummary_t>::iterator gbfslI=see.gbfslist.begin();
-      bool hasGENE=false;
-      bool hasCDS=false;
-      bool hasLOCUS=false;
-      for(; gbfslI != see.gbfslist.end(); gbfslI++){
-	if(!gbfslI->locustag.empty()){
-	  hasLOCUS=true;
-	  if(gbfslI->identifier=="Fgen"){
-	    hasGENE=true;
-	  }else if(gbfslI->identifier=="FCDS") {
-	    hasCDS=true;
+    // for each snpenvironment: 
+    //  if there were gene or CDS: keep just those entries with the same locus tags
+    //  else if there were entries with locus tags, just keep those entries
+    {
+      seI=snpenvironments.begin();
+      for(; seI != snpenvironments.end(); seI++){
+	list<gbfsummary_t>::iterator gbfslI=seI->gbfslist.begin();
+	bool hasGENE=false;
+	bool hasCDS=false;
+	bool hasLOCUS=false;
+	for(; gbfslI != seI->gbfslist.end(); gbfslI++){
+	  if(!gbfslI->locustag.empty()){
+	    hasLOCUS=true;
+	    if(gbfslI->identifier=="Fgen"){
+	      hasGENE=true;
+	    }else if(gbfslI->identifier=="FCDS") {
+	      hasCDS=true;
+	    }
 	  }
 	}
-      }
 
-      if(hasGENE || hasCDS || hasLOCUS){
-	CEBUG("SOMETHING TO DELETE? " << hasGENE << hasCDS << hasLOCUS << see);
-	gbfslI=see.gbfslist.begin();
-	list<shortgbfinfo_t>::iterator sgiI=see.sgilist.begin();
-	for(; gbfslI != see.gbfslist.end(); gbfslI++, sgiI++){
-	  bool deleteit=false;
-	  if(hasGENE){
-	    if(gbfslI->identifier != "Fgen") deleteit=true;
-	  }else if(hasCDS){
-	    if(gbfslI->identifier != "FCDS") deleteit=true;
-	  }else if(hasLOCUS){
-	    if(gbfslI->locustag.empty()) deleteit=true;
-	  }
-	  if(deleteit){
-	    CEBUG("DELETE gbfs: " << *gbfslI);
-	    gbfslI=see.gbfslist.erase(gbfslI);
-	    CEBUG("DELETE sgi: " << *sgiI);
-	    sgiI=see.sgilist.erase(sgiI);
+	if(hasGENE || hasCDS || hasLOCUS){
+	  CEBUG("SOMETHING TO DELETE? " << hasGENE << hasCDS << hasLOCUS << *seI);
+	  gbfslI=seI->gbfslist.begin();
+	  list<shortgbfinfo_t>::iterator sgiI=seI->sgilist.begin();
+	  for(; gbfslI != seI->gbfslist.end(); gbfslI++, sgiI++){
+	    bool deleteit=false;
+	    if(hasGENE){
+	      if(gbfslI->identifier != "Fgen") deleteit=true;
+	    }else if(hasCDS){
+	      if(gbfslI->identifier != "FCDS") deleteit=true;
+	    }else if(hasLOCUS){
+	      if(gbfslI->locustag.empty()) deleteit=true;
+	    }
+	    if(deleteit){
+	      CEBUG("DELETE gbfs: " << *gbfslI);
+	      gbfslI=seI->gbfslist.erase(gbfslI);
+	      CEBUG("DELETE sgi: " << *sgiI);
+	      sgiI=seI->sgilist.erase(sgiI);
+	    }
 	  }
+	  CEBUG("AFTER DELETE: " << *seI);
+	}else{
+	  CEBUG("NOTHING TO DELETE: " << *seI);
 	}
-	CEBUG("AFTER DELETE: " << see);
-      }else{
-	CEBUG("NOTHING TO DELETE: " << see);
       }
     }
-  }
 
 
-  // perfect, create jumpcoord strings etc.
+    // perfect, create jumpcoord strings etc.
 
 
 
@@ -973,190 +896,189 @@ void assout::saveSNPSurroundingAsHTML(list<Contig> & clist, const string & filen
 
 
 
-  {
-    string currentcontig;
-    for(auto & see : snpenvironments){
-      auto cI=see.cI;
-      CEBUG("New seI. Contig: " << cI->getContigName() << endl);
-      CEBUG(see);
-      if(currentcontig != cI->getContigName()) {
-	if(!currentcontig.empty()){
-	  htmlout << "</table><p>";
-	}
-	currentcontig = cI->getContigName();
-	htmlout << "<H1>Difference regions for " << currentcontig << "</H1>\n";
+    {
+      string currentcontig;
+      for(seI=snpenvironments.begin(); seI != snpenvironments.end(); seI++){
+	cI=seI->cI;
+	CEBUG("New seI. Contig: " << cI->getContigName() << endl);
+	CEBUG(*seI);
+	if(currentcontig != cI->getContigName()) {
+	  if(!currentcontig.empty()){
+	    htmlout << "</table><p>";
+	  }
+	  currentcontig = cI->getContigName();
+	  htmlout << "<H1>Difference regions for " << currentcontig << "</H1>\n";
 
-	{
-	  uint32 numbbstrains=0;
-	  vector<bool> seenstrains(cI->getContigReads().size(),false);
-	  auto crI=cI->getContigReads().begin();
-	  auto crE=cI->getContigReads().end();
-	  for(; crI != crE; crI++){
-	    if(crI.getORPID()>=0 && crI->isBackbone()){
-	      if(!seenstrains[crI->getStrainID()]){
-		numbbstrains++;
-		seenstrains[crI->getStrainID()]=true;
+	  {
+	    uint32 numbbstrains=0;
+	    vector<bool> seenstrains(cI->getContigReads().size(),false);
+	    vector<Contig::contigread_t>::const_iterator crI=cI->getContigReads().begin();
+	    vector<Contig::contigread_t>::const_iterator crE=cI->getContigReads().end();
+	    for(; crI != crE; crI++){
+	      if(crI->orpid>=0 && crI->read.isBackbone()){
+		if(!seenstrains[crI->read.getStrainID()]){
+		  numbbstrains++;
+		  seenstrains[crI->read.getStrainID()]=true;
+		}
 	      }
 	    }
-	  }
-	  if(numbbstrains>0){
-	    if(numbbstrains==1) {
-	      htmlout << "Backbone strain: ";
-	    }else{
-	      htmlout << "Backbone strains: ";
+	    if(numbbstrains>0){
+	      if(numbbstrains==1) {
+		htmlout << "Backbone strain: ";
+	      }else{
+		htmlout << "Backbone strains: ";
+	      }
+	      crI=cI->getContigReads().begin();
+	      for(; crI != crE; crI++){
+		if(crI->orpid>=0){
+		  if(seenstrains[crI->read.getStrainID()]){
+		    seenstrains[crI->read.getStrainID()]=false;
+		    htmlout << crI->read.getStrain() << ' ';
+		  }
+		}
+	      }
+	      htmlout << "<p>\n";
 	    }
+
+	    uint32 numstrains=0;
 	    crI=cI->getContigReads().begin();
 	    for(; crI != crE; crI++){
-	      if(crI.getORPID()>=0){
-		if(seenstrains[crI->getStrainID()]){
-		  seenstrains[crI->getStrainID()]=false;
-		  htmlout << crI->getStrainName() << ' ';
+	      if(crI->orpid>=0 && crI->read.isBackbone()==false){
+		if(!seenstrains[crI->read.getStrainID()]){
+		  numstrains++;
+		  seenstrains[crI->read.getStrainID()]=true;
 		}
 	      }
 	    }
-	    htmlout << "<p>\n";
-	  }
-
-	  uint32 numstrains=0;
-	  crI=cI->getContigReads().begin();
-	  for(; crI != crE; crI++){
-	    if(crI.getORPID()>=0 && crI->isBackbone()==false){
-	      if(!seenstrains[crI->getStrainID()]){
-		numstrains++;
-		seenstrains[crI->getStrainID()]=true;
+	    if(numstrains>0){
+	      if(numbbstrains==1) {
+		htmlout << "Mapped strain: ";
+	      }else{
+		htmlout << "Mapped strains: ";
 	      }
-	    }
-	  }
-	  if(numstrains>0){
-	    if(numbbstrains==1) {
-	      htmlout << "Mapped strain: ";
-	    }else{
-	      htmlout << "Mapped strains: ";
-	    }
-	    crI=cI->getContigReads().begin();
-	    for(; crI != crE; crI++){
-	      if(crI.getORPID()>=0){
-		if(seenstrains[crI->getStrainID()]){
-		  seenstrains[crI->getStrainID()]=false;
-		  htmlout << crI->getStrainName() << ' ';
+	      crI=cI->getContigReads().begin();
+	      for(; crI != crE; crI++){
+		if(crI->orpid>=0){
+		  if(seenstrains[crI->read.getStrainID()]){
+		    seenstrains[crI->read.getStrainID()]=false;
+		    htmlout << crI->read.getStrain() << ' ';
+		  }
 		}
 	      }
+	      htmlout << "<p>\n";
 	    }
-	    htmlout << "<p>\n";
 	  }
-	}
-
 
-	htmlout << "<table BORDER=\"0\" CELLSPACING=\"10\" CELLPADDING=\"0\">\n";
-      }
 
-      htmlout << "<tr align=\"left\">"
-	      << "<td CLASS=\"jtable1\"><a href=\"#"
-	      << see.snpjumpname << "\">"
-	      << see.snpjumpname << "</a></td>"
-	      << "<td  CLASS=\"jtable2\">";
-      uint32 num=0;
-      for(auto sgiI=see.sgilist.begin(); sgiI!=see.sgilist.end(); sgiI++, num++){
-	if(!(sgiI->gene).empty()){
-	  if(num>0) htmlout << "; ";
-	  htmlout << sgiI->gene;
-	}
-      }
-      htmlout << "</td>"
-	      << "<td  CLASS=\"jtable3\">";
-      if(see.sgilist.size()==0) {
-	// valid if left or right of annotated backbone
-	//htmlout << "0 locus hit??? Strange.";
-      } else if(see.sgilist.size()>1) {
-	htmlout << "Multiple locus hit";
-      }else{
-	bool mustbr=false;
-	if(!see.sgilist.begin()->function.empty()){
-	  htmlout << see.sgilist.begin()->function;
-	  mustbr=true;
+	  htmlout << "<table BORDER=\"0\" CELLSPACING=\"10\" CELLPADDING=\"0\">\n";
 	}
-	if(!see.sgilist.begin()->product.empty()){
-	  if(mustbr) htmlout << "<br>";
-	  htmlout << see.sgilist.begin()->product;
-	  mustbr=true;
-	}
-	if(!see.sgilist.begin()->note.empty()){
-	  if(mustbr) htmlout << "<br>";
-	  htmlout << see.sgilist.begin()->note;
+	
+	htmlout << "<tr align=\"left\">"
+		<< "<td CLASS=\"jtable1\"><a href=\"#" 
+		<< seI->snpjumpname << "\">" 
+		<< seI->snpjumpname << "</a></td>"
+		<< "<td  CLASS=\"jtable2\">";
+	uint32 num=0;
+	list<shortgbfinfo_t>::const_iterator sgiI=seI->sgilist.begin();
+	for(; sgiI!=seI->sgilist.end(); sgiI++, num++){
+	  if(!(sgiI->gene).empty()){
+	    if(num>0) htmlout << "; ";
+	    htmlout << sgiI->gene;
+	  }
 	}
+	htmlout << "</td>"
+		<< "<td  CLASS=\"jtable3\">";
+	if(seI->sgilist.size()==0) {
+	  // valid if left or right of annotated backbone
+	  //htmlout << "0 locus hit??? Strange.";
+	} else if(seI->sgilist.size()>1) {
+	  htmlout << "Multiple locus hit";
+	}else{
+	  bool mustbr=false;
+	  if(!seI->sgilist.begin()->function.empty()){
+	    htmlout << seI->sgilist.begin()->function;
+	    mustbr=true;
+	  }
+	  if(!seI->sgilist.begin()->product.empty()){
+	    if(mustbr) htmlout << "<br>";
+	    htmlout << seI->sgilist.begin()->product;
+	    mustbr=true;
+	  }
+	  if(!seI->sgilist.begin()->note.empty()){
+	    if(mustbr) htmlout << "<br>";
+	    htmlout << seI->sgilist.begin()->note;
+	  }
 
-	//if(!see.sgilist.begin()->function.empty()){
-	//  htmlout << see.sgilist.begin()->function;
-	//}else{
-	//  htmlout << see.sgilist.begin()->note;
-	//}
+	  //if(!seI->sgilist.begin()->function.empty()){
+	  //  htmlout << seI->sgilist.begin()->function;
+	  //}else{
+	  //  htmlout << seI->sgilist.begin()->note;
+	  //}
+	}
+	htmlout << "</td></tr>\n";
+      }
+      if(!currentcontig.empty()){
+	htmlout << "</table><p>";
       }
-      htmlout << "</td></tr>\n";
-    }
-    if(!currentcontig.empty()){
-      htmlout << "</table><p>";
     }
-  }
 
-  for(auto seI=snpenvironments.begin(); seI!=snpenvironments.end(); ++seI){
-    auto cI=seI->cI;
+    for(seI=snpenvironments.begin(); seI != snpenvironments.end(); seI++){
+      cI=seI->cI;
 
-    htmlout << "<H1>"
-	    << "<a NAME=\"" << seI->snpjumpname << "\"></a>"
-	    << seI->snpjumpname << "</H1>\n";
-    if(seI != snpenvironments.begin()){
-      seI--;
-      htmlout << "<a href=\"#" << seI->snpjumpname << "\">";
+      htmlout << "<H1>" 
+	      << "<a NAME=\"" << seI->snpjumpname << "\"></a>"
+	      << seI->snpjumpname << "</H1>\n";
+      if(seI != snpenvironments.begin()){
+	seI--;
+	htmlout << "<a href=\"#" << seI->snpjumpname << "\">";
+	seI++;
+      }
+      htmlout << "previous";
+      if(seI != snpenvironments.begin()){
+	htmlout << "</a>";
+      }
+      htmlout << "  ";
       seI++;
-    }
-    htmlout << "previous";
-    if(seI != snpenvironments.begin()){
-      htmlout << "</a>";
-    }
-    htmlout << "  ";
-    seI++;
-    if(seI != snpenvironments.end()){
-      htmlout << "<a href=\"#" << seI->snpjumpname << "\">";
-    }
-    htmlout << "next";
-    if(seI != snpenvironments.end()){
-      htmlout << "</a>";
-    }
-    seI--;
+      if(seI != snpenvironments.end()){
+	htmlout << "<a href=\"#" << seI->snpjumpname << "\">";
+      }
+      htmlout << "next";
+      if(seI != snpenvironments.end()){
+	htmlout << "</a>";
+      }
+      seI--;
 
-    htmlout << "<br/><br/>";
+      htmlout << "<br/><br/>";
 
-    uint32 num=0;
-    for(auto sgiI=seI->sgilist.begin(); sgiI!=seI->sgilist.end(); sgiI++, num++){
-      if(sgiI->identifier != "Figr"
-	 && (!sgiI->locustag.empty() || !sgiI->gene.empty())){
-	htmlout << "Hitting: " << sgiI->locustag;
-	if(!sgiI->gene.empty()){
-	  htmlout << " (" << sgiI->gene << ')';
-	}else{
-	  htmlout << " (" << *sgiI << ')';
+      uint32 num=0;
+      list<shortgbfinfo_t>::const_iterator sgiI=seI->sgilist.begin();
+      for(; sgiI!=seI->sgilist.end(); sgiI++, num++){
+	if(sgiI->identifier != "Figr"){
+	  htmlout << "Hitting: " << sgiI->locustag;
+	  if(!sgiI->gene.empty()){
+	    htmlout << " (" << sgiI->gene << ')';
+	  }
+	  htmlout << "<br>\n";
+	}
+	if(!sgiI->product.empty()){
+	  htmlout << "Product: " << sgiI->product << "<br>\n";
+	}
+	if(!sgiI->function.empty()){
+	  htmlout << "Function: " << sgiI->function << "<br>\n";
+	}
+	if(!sgiI->note.empty()){
+	  htmlout << "Note: " << sgiI->note << "<br>\n";
 	}
-	htmlout << "<br>\n";
-      }
-      if(!sgiI->product.empty()){
-	htmlout << "Product: " << sgiI->product << "<br>\n";
-      }
-      if(!sgiI->function.empty()){
-	htmlout << "Function: " << sgiI->function << "<br>\n";
-      }
-      if(!sgiI->note.empty()){
-	htmlout << "Note: " << sgiI->note << "<br>\n";
       }
-    }
 
 
-    cI->dumpAsHTML(htmlout, seI->from - surrounding, seI->to + surrounding);
-  }
+      cI->dumpAsHTML(htmlout, seI->from - surrounding, seI->to + surrounding);
+    }
 
-  htmlout.close();
+    htmlout.close();
 
-  CEBUG("\nDone with this contig" << endl);
-}
+    CEBUG("\nDone with this contig" << endl);
+  }
 
 #define CEBUG(bla)
 
@@ -1169,79 +1091,75 @@ void assout::saveSNPSurroundingAsHTML(list<Contig> & clist, const string & filen
  *
  *************************************************************************/
 
-void assout::makeAllStrainGenomes(Contig & contigI, base_quality_t minqual, string & consseq, vector<base_quality_t> & consqual, vector<string> & strain_consseq, vector< vector<base_quality_t> > & strain_consqual, strainid2name_t & strainnames_in_contig, bool fillholesinstraingenomes, bool addconstag)
-{
-  FUNCSTART("void makeAllStrainGenomes(Contig & contigI, string & consseq, vector<base_quality_t> & consqual, vector<string> & strain_consseq, vector< vector<base_quality_t> > & strain_consqual, strainid2name_t & strainnames_in_contig, bool fillholesinstraingenomes)");
-
-  CEBUGNPQ("Making main genome consensus\n");
-
-  // make a common consensus for all strains: mincoverage=0, minqual given
-  contigI.calcConsensi(0,minqual,'X',addconstag);
-
-  // fetch the combined consensus
-  contigI.newConsensusGet(consseq, consqual);
-
-  CEBUGNPQ("Making strain genome consensi\n");
-
-  // and make a specific consensus for every strain present in
-  //  this contig
-  // We'll do by fetching the strain specific consensus and apply, if wanted,
-  //  the function to fill in gaps and Ns from the combined consensus
-  strainnames_in_contig.clear();
-
-  //// search the strains present in the contig
-  //// TODO: contig now track strains present ... should use that!
-  //for(auto & cre : contigI.getContigReads()){
-  //  if(strainnames_in_contig.find(cre.getStrainID())==strainnames_in_contig.end()){
-  //	strainnames_in_contig.insert(s_idname_pair_t(cre.getStrainID(),cre.getStrainName()));
-  //	CEBUGNPQ(static_cast<int32>(cre.getStrainID()) << "\t-- " << cre.getStrain() << endl);
-  //  }
-  //}
-
-  // No, take strains from ReadGroupLib
-  for(uint32 id=1; id<ReadGroupLib::getNumReadGroups(); ++id){
-    auto rgid=ReadGroupLib::getReadGroupID(id);
-    if(strainnames_in_contig.find(rgid.getStrainID())==strainnames_in_contig.end()){
-      strainnames_in_contig.insert(s_idname_pair_t(rgid.getStrainID(),rgid.getStrainName()));
-      CEBUGNPQ(static_cast<int32>(rgid.getStrainID()) << "\t-- " << rgid.getStrain() << endl);
+  void makeAllStrainGenomes(Contig & contigI, base_quality_t minqual, string & consseq, vector<base_quality_t> & consqual, vector<string> & strain_consseq, vector< vector<base_quality_t> > & strain_consqual, strainid2name_t & strainnames_in_contig, bool fillholesinstraingenomes)
+  {
+    FUNCSTART("void makeAllStrainGenomes(Contig & contigI, string & consseq, vector<base_quality_t> & consqual, vector<string> & strain_consseq, vector< vector<base_quality_t> > & strain_consqual, strainid2name_t & strainnames_in_contig, bool fillholesinstraingenomes)");
+
+    CEBUGNPQ("Making main genome consensus\n");
+    
+    // make a common consensus for all strains: mincoverage=0, minqual given
+    contigI.calcConsensi(0,minqual);
+
+    // fetch the combined consensus 
+    contigI.newConsensusGet(consseq, consqual);
+    
+    CEBUGNPQ("Making strain genome consensi\n");
+    
+    // and make a specific consensus for every strain present in
+    //  this contig
+    // We'll do by fetching the strain specific consensus and apply, if wanted,
+    //  the function to fill in gaps and Ns from the combined consensus
+    strainnames_in_contig.clear();
+
+    // search the strains present in the contig
+    // TODO: contig now track strains present ... should use that!
+    const vector<Contig::contigread_t> & creads=contigI.getContigReads();
+    {
+      vector<Contig::contigread_t>::const_iterator R=creads.begin();
+      for(; R != creads.end(); R++){
+	//strainids_in_contig.insert(R->read.getStrainID());
+	if(strainnames_in_contig.find(R->read.getStrainID())==strainnames_in_contig.end()){
+	  strainnames_in_contig.insert(s_idname_pair_t(R->read.getStrainID(),R->read.getStrain()));
+	  CEBUGNPQ(static_cast<int32>(R->read.getStrainID()) << "\t-- " << R->read.getStrain() << endl);
+	}
+      }
     }
-  }
-
-  CEBUGNPQ("Number of strains present: " << strainnames_in_contig.size() << endl);
-  strain_consseq.clear();
-  strain_consqual.clear();
-
-  if(strainnames_in_contig.size()>0) {
-    strainid2name_t::const_iterator SI=strainnames_in_contig.end();
-    SI--;
-    int32 largest=(SI->first)+1;
-    strain_consseq.resize(largest);
-    strain_consqual.resize(largest);
-
-    // fill the consensus of the strains present
-    SI=strainnames_in_contig.begin();
-    for(;SI != strainnames_in_contig.end(); SI++) {
-      contigI.newConsensusGet(strain_consseq[SI->first],
-			      strain_consqual[SI->first],
-			      SI->first);
-
-      if(fillholesinstraingenomes) {
-	// now merge the strain consensus:
-	//  fill up N or holes in the strain consensus with bases from
-	//  the main consensus
-	BUGIFTHROW(consseq.size() != strain_consseq[SI->first].size(),"consseq.size() != strain_consseq[SI->first].size())?");
-	//CEBUGNPQ("strain_consseq[" << (uint16) *SI << "]: " <<  strain_consseq[*SI] << endl);
-	for(uint32 i=0; i<consseq.size(); i++){
-	  if(strain_consseq[SI->first][i]=='X'){
-	    strain_consseq[SI->first][i]=static_cast<char>(tolower(consseq[i]));
-	    strain_consqual[SI->first][i]=consqual[i];
+    
+    CEBUGNPQ("Number of strains present: " << strainnames_in_contig.size() << endl);
+    strain_consseq.clear();
+    strain_consqual.clear();
+      
+    if(strainnames_in_contig.size()>0) {
+      strainid2name_t::const_iterator SI=strainnames_in_contig.end();
+      SI--;
+      int32 largest=(SI->first)+1;
+      strain_consseq.resize(largest);
+      strain_consqual.resize(largest);
+      
+      // fill the consensus of the strains present
+      SI=strainnames_in_contig.begin();
+      for(;SI != strainnames_in_contig.end(); SI++) {
+	contigI.newConsensusGet(strain_consseq[SI->first], 
+				strain_consqual[SI->first], 
+				SI->first);
+
+	if(fillholesinstraingenomes) {
+	  // now merge the strain consensus:
+	  //  fill up N or holes in the strain consensus with bases from
+	  //  the main consensus
+	  BUGIFTHROW(consseq.size() != strain_consseq[SI->first].size(),"consseq.size() != strain_consseq[SI->first].size())?");
+	  //CEBUGNPQ("strain_consseq[" << (uint16) *SI << "]: " <<  strain_consseq[*SI] << endl);
+	  for(uint32 i=0; i<consseq.size(); i++){
+	    if(strain_consseq[SI->first][i]=='@'){
+	      strain_consseq[SI->first][i]=static_cast<char>(tolower(consseq[i]));
+	      strain_consqual[SI->first][i]=consqual[i];
+	    }
 	  }
 	}
       }
     }
+    FUNCEND();
   }
-  FUNCEND();
-}
 
 
 /*************************************************************************
@@ -1250,333 +1168,165 @@ void assout::makeAllStrainGenomes(Contig & contigI, base_quality_t minqual, stri
  *
  *
  *************************************************************************/
-struct codoninfo_t {
-  string codon;
-  uint32 count=0;
-  double frequency=0.0;
-  char   aa='?';
-  uint8  index=0;
-
-  friend std::ostream & operator<<(std::ostream &ostr, const codoninfo_t & ci){
-    ostr << static_cast<uint16>(ci.index)
-	 << '\t' << ci.codon
-	 << '\t' << ci.aa
-	 << '\t' << ci.count
-	 << '\t' << ci.frequency;
-    return ostr;
-  }
-  static inline bool sortByAAUpCountDown(const codoninfo_t & i1, const codoninfo_t & i2){
-    if(i1.aa==i2.aa){
-      return i1.count>i2.count;
-    }
-    return i1.aa<i2.aa;
-  }
-  static inline bool sortByIndexUp(const codoninfo_t & i1, const codoninfo_t & i2){
-    return i1.index<i2.index;
-  }
-};
-
-
-//#define CEBUGNPQ(bla) {cout << bla; cout.flush();}
-void assout::saveFeatureAnalysis(list<Contig> & clist, ReadPool & rpool, const string & faname, const string & fsname, const string & fcname, bool deleteoldfile)
-{
-  FUNCSTART("saveFeatureAnalysis(list<Contig> & clist, ReadPool & rpool, const string & faname, const string & faname)");
-
-  cout << "Saving feature analysis to file: " << faname << endl;
-  ofstream faout;
-  if(!openFileForAppend(faname,faout,deleteoldfile)){
-    faout << "# Contig\t"
-      "Reference strain\t"
-      "Mutant strain\t"
-      "Internal contig pos\t"
-      "Position in reference\t"
-      "Map pos in reference\t"
-      "FType\t"
-      "Locus\t"
-      "Direction\t"
-      "Gene name\t"
-      "Distance of SNP\t"
-      "DNA effect\t"
-      "Nucleotide change\t"
-      "Codon in reference\t"
-      "Codon in mutant\t"
-      "Codonfreq in reference\t"
-      "Codonfreq in mutant\t"
-      "Quality reference\t"
-      "Quality mutant\t"
-      "AA change\t"
-      "AA position reference\t"
-      "Codon position reference\t"
-      "AA position mutant\t"
-      "Codon position mutant\t"
-      "Effect of mutation on protein\t"
-      "Product\t"
-      "Function\t"
-      "Note\n";
-  }
-
-  faout << setprecision(1) << fixed;
 
-  cout << "Saving impact summary to file: " << fsname << endl;
-  ofstream fsout;
-  if(!openFileForAppend(fsname,fsout,deleteoldfile)){
-    fsout << "# Locus\t"
-      "Gene name\t"
-      "Feature type\t"
-      "Genome map pos\t"
+  struct proteinchangesummary_t {
+    bool isaffected;
 
-      "Interesting?\t"
-      "Your own filter\t"
+    bool firstcodonisstart;
 
-      "Coverage status\t"
+    bool changedstart;
+    bool destroyedstart;
+    bool changedstop;
+    bool destroyedstop;
+    bool prematurestop;
 
-      "First codon is start\t"
+    uint32 mutinintergenic;
 
-      "Changed start codon\t"
-      "Destroyed start codon\t"
-      "Changed stop codon\t"
-      "Destroyed stop codon\t"
-      "Premature stop codon\t"
+    uint32 insertioninlocus;
+    uint32 deletioninlocus;
+    uint32 silentinlocus;
+    uint32 aachangeinlocus;
 
-      "Intergenic mutation\t"
+    uint32 insertionuntranslated;    //
+    uint32 deletionuntranslated;     //
+    uint32 silentuntranslated;       //
+    uint32 aachangeuntranslated;     //
 
-      "Insertion in locus\t"
-      "Deletion in locus\t"
-      "Silent in locus\t"
-      "AA change in locus\t"
+    uint32 proteinlenchanged;
+    string proteininfeature;
 
-      "Insertion untranslated\t"
-      "Deletion untranslated\t"
-      "Silent untranslated\t"
-      "AA change untranslated\t"
+    string coveragestatus;
+  };
 
-      "Product\tFunction\tNote"
-      "\n";
-  }
-
-  fsout << setprecision(1) << fixed;
-
-  cout << "Saving feature sequences to file: " << fcname << endl;
-  ofstream fcout;
-  if(!openFileForAppend(fcname,fcout,deleteoldfile)){
-    fcout << "# Contig\t"
-      "FType\t"
-      "Locus\t"
-      "Gene name\t"
-      "Feature strain name\t"
-      "Mutant strain name 1 ...\t"
-      "Protein in feature strain\t"
-      "Protein in mutant strain 1 ...\t"
-      "DNA in feature strain\t"
-      "DNA in mutant strain 1 ...\n";
-  }
 
-  cout << "Collecting strain sequences and creating codon usage table" << endl;
 
-  uint8 codontableused=0;
-  vector<codoninfo_t> codoninfo(64);
 
-  uint32 refstrainid=100;
-  for(uint32 rgi=1; rgi<ReadGroupLib::getNumReadGroups(); ++rgi){
-    auto rg=ReadGroupLib::getReadGroupID(rgi);
-    if(rg.isBackbone() && !rg.isRail()){
-      refstrainid=rg.getStrainID();
-      break;
+  void saveFeatureAnalysis(list<Contig> & clist, ReadPool & rpool, const string & faname, const string & fsname, const string & fcname, bool deleteoldfile)
+  {
+    FUNCSTART("saveFeatureAnalysis(list<Contig> & clist, ReadPool & rpool, const string & faname, const string & faname)");
+
+    cout << "Saving feature analysis to file: " << faname << endl;
+    ofstream faout;
+    if(!openFileForAppend(faname,faout,deleteoldfile)){
+      faout << "# Contig\t"
+	    << "Reference strain\t"
+	    << "Mutant strain\t"
+	    << "Internal contig pos\t"
+	    << "Position in reference\t"
+	    << "Map pos in reference\t"
+	    << "Locus\t"
+	    << "Direction\t"
+	    << "Gene name\t"
+	    << "Distance of SNP\t"
+	    << "DNA effect\t"
+	    << "Nucleotide change\t"
+	    << "Codon in reference\t"
+	    << "Codon in mutant\t"
+	    << "Quality reference\t"
+	    << "Quality mutant\t"
+	    << "AA change\t"
+	    << "AA position reference\t"
+	    << "Codon position reference\t"
+	    << "AA position mutant\t"
+	    << "Codon position mutant\t"
+	    << "Effect of mutation on protein\t"
+	    << "Product\t"
+	    << "Function\t"
+	    << "Note\n";
     }
-  }
-  // we will look at all GBF features (empty == all allowed)
-  vector<multitag_t::mte_id_t> allowedfeatures;
-  allowedfeatures.push_back(Read::REA_tagentry_idSOFACDS);
-  vector<multitag_t::mte_id_t> forbiddenfeatures;
-  for(auto & cle : clist){
-    cle.sortConsensusTags();
 
-    // copy first all Genbank features of all reads into one big vector
-    //  (makes the search loop afterwards easier)
+    faout << setprecision(1) << fixed;
+
+    cout << "Saving impact summary to file: " << fsname << endl;
+    ofstream fsout;
+    if(!openFileForAppend(fsname,fsout,deleteoldfile)){
+      fsout << "# Locus\tGene name\tFeature type\tGenome map pos\t"
+	
+	    << "Interesting?\t"
+	    << "Your own filter\t"
+
+	    << "Coverage status\t"
+
+	    << "First codon is start\t"
+
+	    << "Changed start codon\t"
+	    << "Destroyed start codon\t"
+	    << "Changed stop codon\t"
+	    << "Destroyed stop codon\t"
+	    << "Premature stop codon\t"
+
+	    << "Intergenic mutation\t"
+
+	    << "Insertion in locus\t"
+	    << "Deletion in locus\t"
+	    << "Silent in locus\t"
+	    << "AA change in locus\t"
+      
+	    << "Insertion untranslated\t"
+	    << "Deletion untranslated\t"
+	    << "Silent untranslated\t"
+	    << "AA change untranslated\t"
+      
+	    << "Product\tFunction\tNote"
+
+	    << endl;
+    }
 
-    list<gbfsummary_t> allGBfeatures;
-    cle.getGBFSummary(allGBfeatures,allowedfeatures,forbiddenfeatures,true, false);
-
-    // continue with next contig if there are no features in here
-    if(allGBfeatures.empty()) continue;
-
-    string consseq;
-    vector<base_quality_t> consqual;
-    vector<string> strain_consseq;
-    vector< vector<base_quality_t> > strain_consqual;
-    strainid2name_t strainnames_in_contig;
-
-    makeAllStrainGenomes(cle,
-			 0,
-			 consseq,
-			 consqual,
-			 strain_consseq,
-			 strain_consqual,
-			 strainnames_in_contig,
-			 false,
-			 false);
-
-    if(refstrainid!=100){
-      string featuredna;
-      string featureprot;
-
-      bool hascodontablewarning=false;
-      for(auto & feature : allGBfeatures){
-	// unsigned, always true: if(feature.cfrom<0 || feature.cto<0
-	if(feature.cfrom >= consseq.size() || feature.cto >= consseq.size()){
-	  CEBUGNPQ("Out of bounds, next." << endl);
-	  continue;
-	}
+    fsout << setprecision(1) << fixed;
 
-	if(codontableused==0){
-	  codontableused=feature.translationtable;
-
-	  vector<string> dummy1;
-	  vector<bool> dummy2;
-	  vector<char> aaresult;
-
-	  char acgt[]="ACGT";
-	  double unused=-1;
-	  string codon("xxx");
-	  for(int b1=0; b1<4; ++b1){
-	    codon[0]=acgt[b1];
-	    for(int b2=0; b2<4; ++b2){
-	      codon[1]=acgt[b2];
-	      for(int b3=0; b3<4; ++b3){
-		codon[2]=acgt[b3];
-		auto codonindex=dptools::getIndexOfCodon(codon);
-		codoninfo[codonindex].codon=codon;
-		codoninfo[codonindex].index=codonindex;
-
-		dptools::codon2AminoAcids(codontableused,
-					  codon[0],
-					  codon[1],
-					  codon[2],
-					  dummy1,
-					  aaresult,
-					  dummy2);
-		codoninfo[codonindex].aa=aaresult[0];
-	      }
-	    }
-	  }
-	}else{
-	  if(codontableused!=feature.translationtable){
-	    if(!hascodontablewarning){
-	      hascodontablewarning=true;
-	      cout << "WARNING! Contig " << cle.getContigName() << ": first features in annotation used a codon table of " << static_cast<uint16>(codontableused) << ", but now the feature " << " defines a codon table of " << static_cast<uint16>(feature.translationtable) << ". The codon frequency analysis will be completely wrong for this contig.\n";
-	    }
-	  }
-	}
+    cout << "Saving feature sequences to file: " << fcname << endl;
+    ofstream fcout;
+    if(!openFileForAppend(fcname,fcout,deleteoldfile)){
+      fcout << "# Contig\tLocus\tGene name\tFeature strain name\tMutant strain name 1 ...\tProtein in feature strain\tProtein in mutant strain 1 ...\tDNA in feature strain\tDNA in mutant strain 1 ...\n";
+    }
 
-	// look how feature is translated
-	if(feature.direction>0) {
-	  CEBUGNPQ("#x1\n");
-	  dptools::dnaToProtein(strain_consseq[refstrainid],
-				featureprot,
-				featuredna,
-				feature.cfrom,
-				feature.cto,
-				feature.direction,
-				feature.translationtable,
-				feature.codonstart,
-				true);
-	}else{
-	  CEBUGNPQ("#x2\n");
-	  dptools::dnaToProtein(strain_consseq[refstrainid],
-				featureprot,
-				featuredna,
-				feature.cto,
-				feature.cfrom,
-				feature.direction,
-				feature.translationtable,
-				feature.codonstart,
-				true);
-	}
-	CEBUGNPQ("Protein for ref " << refstrainid << ": " << featureprot << endl);
-	CEBUGNPQ("DNA for ref " << refstrainid << ": " << featuredna << endl);
+    // we will look at all GBF features (empty == all allowed)
+    vector<multitag_t::mte_id_t> allowedfeatures;
+    //allowedfeatures.push_back("Fgen");
+    allowedfeatures.push_back(Read::REA_tagentry_idFCDS);
+    allowedfeatures.push_back(Read::REA_tagentry_idFexn);
+    allowedfeatures.push_back(Read::REA_tagentry_idFint);
+    allowedfeatures.push_back(Read::REA_tagentry_idFmRN);
+    allowedfeatures.push_back(Read::REA_tagentry_idFm_R);
+    allowedfeatures.push_back(Read::REA_tagentry_idFpRN);
+    allowedfeatures.push_back(Read::REA_tagentry_idFrRN);
+    allowedfeatures.push_back(Read::REA_tagentry_idFscR);
+    allowedfeatures.push_back(Read::REA_tagentry_idFsnR);
+    allowedfeatures.push_back(Read::REA_tagentry_idFtRN);
+
+    // but not at Fsrc and Fgen
+    vector<multitag_t::mte_id_t> forbiddenfeatures;
+    //forbiddenfeatures.push_back("Fsrc");
+    //forbiddenfeatures.push_back("Fgen");
+    //forbiddenfeatures.push_back("Fcon");
+    //forbiddenfeatures.push_back("Fmod");
+    //forbiddenfeatures.push_back("Fold");
+    //forbiddenfeatures.push_back("Frpr");
+    //forbiddenfeatures.push_back("Frpu");
+    //forbiddenfeatures.push_back("F???");
+    //forbiddenfeatures.push_back("Fvar");
+    
+    // now, go through each contig and analyse the effect of SNPs on feature
+    //  sequences
 
-	for(uint32 protpos=0; protpos<featureprot.size(); ++protpos){
-	  auto codonindex=dptools::getIndexOfCodon(featuredna[3*protpos],featuredna[3*protpos+1],featuredna[3*protpos+2]);
-	  if(codonindex<64){
-	    codoninfo[codonindex].count+=1;
-	  }
-	}
-      }
-    }
-  }
+    list<Contig>::iterator contigI=clist.begin();
+    for(;contigI!=clist.end(); contigI++){
+      contigI->sortConsensusTags();
 
-  std::sort(codoninfo.begin(), codoninfo.end(), codoninfo_t::sortByAAUpCountDown);
-  {
-    auto ciS=codoninfo.begin();
-    while(ciS!=codoninfo.end()){
-      auto ciE=ciS;
-      uint64 tcount=0;
-      for(; ciE!=codoninfo.end() && ciS->aa == ciE->aa; ++ciE) {tcount+=ciE->count;}
-      if(tcount>0){
-	for(auto ciI=ciS; ciI!=ciE; ++ciI){
-	  ciI->frequency=static_cast<double>(100)/tcount*ciI->count;
-	}
-      }
-      ciS=ciE;
-    }
-  }
-  cout << "Codon table:\n";
-  for(auto & cie : codoninfo){
-    cout << cie << endl;
-  }
-  std::sort(codoninfo.begin(), codoninfo.end(), codoninfo_t::sortByIndexUp);
-
-  // we will look at all GBF features (empty == all allowed)
-  allowedfeatures.clear();
-  //allowedfeatures.push_back("Fgen");
-  allowedfeatures.push_back(Read::REA_tagentry_idSOFACDS);
-  allowedfeatures.push_back(Read::REA_tagentry_idSOFAexon);
-  allowedfeatures.push_back(Read::REA_tagentry_idSOFAintron);
-  allowedfeatures.push_back(Read::REA_tagentry_idSOFAmRNA);
-  allowedfeatures.push_back(Read::REA_tagentry_idSOFAtranscript);
-  allowedfeatures.push_back(Read::REA_tagentry_idSOFAprimary_transcript);
-  allowedfeatures.push_back(Read::REA_tagentry_idSOFArRNA);
-  allowedfeatures.push_back(Read::REA_tagentry_idSOFAscRNA);
-  allowedfeatures.push_back(Read::REA_tagentry_idSOFAsnRNA);
-  allowedfeatures.push_back(Read::REA_tagentry_idSOFAtRNA);
-
-  // but not at Fsrc and Fgen
-  forbiddenfeatures.clear();
-  //forbiddenfeatures.push_back("Fsrc");
-  //forbiddenfeatures.push_back("Fgen");
-  //forbiddenfeatures.push_back("Fcon");
-  //forbiddenfeatures.push_back("Fmod");
-  //forbiddenfeatures.push_back("Fold");
-  //forbiddenfeatures.push_back("Frpr");
-  //forbiddenfeatures.push_back("Frpu");
-  //forbiddenfeatures.push_back("F???");
-  //forbiddenfeatures.push_back("Fvar");
-
-  // now, go through each contig and analyse the effect of SNPs on feature
-  //  sequences
-
-  for(auto & cle : clist){
-    cle.sortConsensusTags();
-
-    // copy first all Genbank features of all reads into one big vector
-    //  (makes the search loop afterwards easier)
+      // copy first all Genbank features of all reads into one big vector
+      //  (makes the search loop afterwards easier)
 
-    list<gbfsummary_t> allGBfeatures;
-    // BaCh 11.09.2013: don't take consensus features into analysis
-    // MIRA tags showing up (don't want to filter them atm) and gene /CDS features
-    //  in consensus are not set by MIRA anyway. Therefore: save work, implement
-    //  only if need arises (i.e. probably never)
-    cle.getGBFSummary(allGBfeatures,allowedfeatures,forbiddenfeatures,true, false);
+      list<gbfsummary_t> allGBfeatures;
+      contigI->getGBFSummary(allGBfeatures,allowedfeatures,forbiddenfeatures,true);
 
-    // continue with next contig if there are no features in here
-    if(allGBfeatures.empty()) continue;
+      // continue with next contig if there are no features in here
+      if(allGBfeatures.empty()) continue;
 
-    CEBUGNPQ("Preparing statistics\n");
+      CEBUGNPQ("Preparing statistics\n");
 
-    vector<proteinchangesummary_t> allproteinchanges;
-    allproteinchanges.reserve(allGBfeatures.size());
-    {
-      static const proteinchangesummary_t pcs = {
+      vector<proteinchangesummary_t> allproteinchanges;
+      allproteinchanges.reserve(allGBfeatures.size());
+      proteinchangesummary_t pcs = {
 	false,
 	false,
 	false,
@@ -1590,869 +1340,707 @@ void assout::saveFeatureAnalysis(list<Contig> & clist, ReadPool & rpool, const s
 	0,"",
 	""
       };
-      allproteinchanges.resize(allGBfeatures.size(),pcs);
-    }
-
-    // idee: nicht nur einen Consensus generieren, sondern f�r jeden
-    //       strain einen eigenen. Dann kann man einfach strainweise
-    //       die auswirkungen bei Proteinen absch�tzen
-    //  contig.C um�ndern.
-    //  dann nicht abgedeckte stellen in einem strain (N's) jeweils durch
-    //    IUPAC consensus anderer strains auff�llen
-
-    string consseq;
-    vector<base_quality_t> consqual;
-    vector<string> strain_consseq;
-    vector< vector<base_quality_t> > strain_consqual;
-    strainid2name_t strainnames_in_contig;
-
-    makeAllStrainGenomes(cle,
-			 0,
-			 consseq,
-			 consqual,
-			 strain_consseq,
-			 strain_consqual,
-			 strainnames_in_contig,
-			 false,
-			 false);
-
-    CEBUGNPQ("Going through SNPs\n");
-
-    // make a quick lookup vector for which position is intergenic
-    vector<uint8> intergeniclookup(consseq.size(),0);
-    {
-      //list<gbfsummary_t>::const_iterator F=allGBfeatures.begin();
-      for(auto & f : allGBfeatures){
-	if(f.identifier == "Figr"){
-	  for(uint32 iglpos=f.cfrom; iglpos <= f.cto; iglpos++){
-	    if(iglpos<intergeniclookup.size()) intergeniclookup[iglpos]=1;
-	  }
+      {
+	list<gbfsummary_t>::const_iterator F=allGBfeatures.begin();
+	for(; F!=allGBfeatures.end(); F++){
+	  allproteinchanges.push_back(pcs);
 	}
       }
-    }
-
-    // Now, go through each GB features and analyse the impact
-    //  of SNPs to it
-    // Also calculate the "real" dna and protein sequence for every
-    //  strain on the fly
-
-    vector< vector<string> > strain_featuredna;
-    vector< vector<string> > strain_featureprot;
-    strain_featuredna.resize(allGBfeatures.size());
-    strain_featureprot.resize(allGBfeatures.size());
-    for(uint32 i=0; i<allGBfeatures.size(); i++){
-      strain_featuredna[i].resize(strain_consseq.size());
-      strain_featureprot[i].resize(strain_consseq.size());
-    }
-
-    list<gbfsummary_t>::const_iterator fI=allGBfeatures.begin();
-    vector<proteinchangesummary_t>::iterator pI=allproteinchanges.begin();
-    for(uint32 featurecount=0; fI!=allGBfeatures.end(); ++fI, ++pI, ++featurecount){
-      if(cle.getConsensusTags().begin() == cle.getConsensusTags().end()) continue;
-
-      //CEBUGNPQ("We're looking at " << fI->identifier << "\t" << fI->locustag << '\t' << fI->cfrom << '\t' << fI->cto << endl);
-      CEBUGNPQ("We're looking at " << *fI);
-      // unsigned, always true: if(fI->cfrom<0 || fI->cto<0
-      if(fI->cfrom >= consseq.size() || fI->cto >= consseq.size()){
-	CEBUGNPQ("Out of bounds, next." << endl);
-	pI->coveragestatus="out of contig";
-	continue;
-      }
-
-      // featuredir is also the increment
-      int8 featuredir=fI->direction;;
-      CEBUGNPQ("Increment/featuredir is: " << static_cast<int16>(featuredir) << endl);
-
-      pI->coveragestatus="ok";
-      pI->firstcodonisstart=true;
-
-      // collect information on the DNA and protein sequences
-      for(uint32 strainid=0; strainid<strain_consseq.size(); ++strainid){
-	if(strain_consseq[strainid].size()){
 
-	  // check whether we have non covered bases in this strain
-	  bool missingcompletely=false;
-	  {
-	    uint32 basesnocov=0;
-
-	    const char * dnap=strain_consseq[strainid].c_str();
-	    dnap+=fI->cfrom;
-	    for(uint32 ii=fI->cfrom; ii<= fI->cto; dnap++, ii++){
-	      if(toupper(*dnap)=='X') basesnocov++;
-	    }
 
-	    CEBUGNPQ("basesnocov: " << basesnocov << '\n');
-	    if(basesnocov >= (fI->cto - fI->cfrom)){
-	      pI->coveragestatus="completely missing?";
-	      missingcompletely=true;
-	    }else if(basesnocov > 0
-		     && pI->coveragestatus =="ok"){
-	      pI->coveragestatus="partly missing?";
+      // idee: nicht nur einen Consensus generieren, sondern f�r jeden
+      //       strain einen eigenen. Dann kann man einfach strainweise
+      //       die auswirkungen bei Proteinen absch�tzen
+      //  contig.C um�ndern.
+      //  dann nicht abgedeckte stellen in einem strain (N's) jeweils durch 
+      //    IUPAC consensus anderer strains auff�llen
+      
+      string consseq;
+      vector<base_quality_t> consqual;
+      vector<string> strain_consseq;
+      vector< vector<base_quality_t> > strain_consqual;
+      strainid2name_t strainnames_in_contig;
+      
+      makeAllStrainGenomes(*contigI,
+			   0,
+			   consseq,
+			   consqual,
+			   strain_consseq,
+			   strain_consqual,
+			   strainnames_in_contig,
+			   false);
+
+      CEBUGNPQ("Going through SNPs\n");
+
+      // make a quick lookup vector for which position is intergenic
+      vector<uint8> intergeniclookup(consseq.size(),0);
+      {
+	list<gbfsummary_t>::const_iterator F=allGBfeatures.begin();
+	for(; F != allGBfeatures.end(); F++){
+	  if(F->identifier == "Figr"){
+	    for(uint32 iglpos=F->cfrom; iglpos <= F->cto; iglpos++){
+	      if(iglpos<intergeniclookup.size()) intergeniclookup[iglpos]=1;
 	    }
 	  }
-
-	  // look how feature is translated
-	  if(featuredir>0) {
-	    CEBUGNPQ("#x1\n");
-	    uint32 translateto=fI->cto;
-	    if(fI->mustbetranslated) translateto=fI->cfrom;
-	    dptools::dnaToProtein(strain_consseq[strainid],
-				  strain_featureprot[featurecount][strainid],
-				  strain_featuredna[featurecount][strainid],
-				  fI->cfrom,
-				  translateto,
-				  featuredir,
-				  fI->translationtable,
-				  fI->codonstart,
-				  fI->mustbetranslated);
-	  }else{
-	    CEBUGNPQ("#x2\n");
-	    uint32 translateto=fI->cfrom;
-	    if(fI->mustbetranslated) translateto=fI->cto;
-	    dptools::dnaToProtein(strain_consseq[strainid],
-				  strain_featureprot[featurecount][strainid],
-				  strain_featuredna[featurecount][strainid],
-				  fI->cto,
-				  translateto,
-				  featuredir,
-				  fI->translationtable,
-				  fI->codonstart,
-				  fI->mustbetranslated);
-	  }
-	  CEBUGNPQ("Protein for strain " << strainid << ": " << strain_featureprot[featurecount][strainid] << endl);
-	  CEBUGNPQ("DNA for strain " << strainid << ": " << strain_featuredna[featurecount][strainid] << endl);
-
-	  // clear "protein" of features that are not to be translated
-	  //  or where the coverage is completely missing
-	  if(!fI->mustbetranslated
-	     || missingcompletely){
-	    strain_featureprot[featurecount][strainid].clear();
-	    pI->firstcodonisstart=false;
-	  }else if(strain_featuredna[featurecount][strainid].size() >= 3
-		   && pI->firstcodonisstart){
-	    pI->firstcodonisstart=dptools::isCodonStart(fI->translationtable,
-						       strain_featuredna[featurecount][strainid][0],
-						       strain_featuredna[featurecount][strainid][1],
-						       strain_featuredna[featurecount][strainid][2]);
-	    CEBUGNPQ("firstcodonisstart: " << pI->firstcodonisstart << '\n');
-	  }
 	}
       }
 
-
-
-      // go through each SNP consensustag
-      vector<Contig::consensustag_t>::const_iterator CTact;
-      vector<Contig::consensustag_t>::const_iterator CTlast;
-
-      CTact=cle.getConsensusTags().begin();
-      CTlast=cle.getConsensusTags().end();
-      CTlast--;
-      if(featuredir<0) {
-	std::swap(CTact,CTlast);
+      // Now, go through each GB features and analyse the impact 
+      //  of SNPs to it
+      // Also calculate the "real" dna and protein sequence for every
+      //  strain on the fly
+
+      vector< vector<string> > strain_featuredna;
+      vector< vector<string> > strain_featureprot;
+      strain_featuredna.resize(allGBfeatures.size());
+      strain_featureprot.resize(allGBfeatures.size());
+      for(uint32 i=0; i<allGBfeatures.size(); i++){
+	strain_featuredna[i].resize(strain_consseq.size());
+	strain_featureprot[i].resize(strain_consseq.size());
       }
 
-      bool lastconstagreached=false;
-      for(; !lastconstagreached; CTact+=featuredir){
-	if(CTact==CTlast) lastconstagreached=true;
-
-	if(CTact->identifier == Contig::CON_tagentry_idSAOc
-	   || CTact->identifier == Contig::CON_tagentry_idSIOc
-	   || CTact->identifier == Contig::CON_tagentry_idSROc) {
+      list<gbfsummary_t>::const_iterator F=allGBfeatures.begin();
+      vector<proteinchangesummary_t>::iterator P=allproteinchanges.begin();
+      for(uint32 featurecount=0; F!=allGBfeatures.end(); F++, P++, featurecount++){
+	if(contigI->getConsensusTags().begin() == contigI->getConsensusTags().end()) continue;
 
-	  bool mustconsider=false;
-	  int32 reldistance=0;
-	  //int8 updownlocation=0;
-	  // look where the SNP is located: in the feature (location =0),
-	  //  upstream (-1) or downstream (1)
+	CEBUGNPQ("We're looking at " << F->locustag << '\t' << F->cfrom << '\t' << F->cto << endl);
+	// unsigned, always true: if(F->cfrom<0 || F->cto<0
+	if(F->cfrom >= consseq.size() || F->cto >= consseq.size()){
+	  CEBUGNPQ("Out of bounds, next." << endl);
+	  P->coveragestatus="out of contig";
+	  continue;
+	}
 
-	  //CEBUGNPQ("Testing F " << fI->cfrom << " " << fI->cto << "\t");
-	  //CEBUGNPQ(CTact->getIdentifierStr() << " " << CTact->from << " " << CTact->to << endl);
+	const Read & featureread=contigI->getReadAtIndex(F->readindex);
 
-	  // In dubio pro reo. To counter
-	  //   - wrong annotation in initial genome or
-	  //   - SNPs in mutant strain
-	  // we look at the coordinates as dictated by the protein lengths
-	  //  and decide upon these whether a SNP is inlocus,
-	  //  up- or downstream
+	// featuredir is also the increment
+	int8 featuredir=F->direction;;
+	CEBUGNPQ("Increment/featuredir is: " << static_cast<int16>(featuredir) << endl);
 
+	P->coveragestatus="ok";
+	P->firstcodonisstart=true;
 
-	  int32 realfcfrom=fI->cfrom;
-	  int32 realfcto=fI->cto;
-	  {
-	    // first, get max protein length
+	// collect information on the DNA and protein sequences
+	for(uint32 strainid=0; strainid<strain_consseq.size(); strainid++){
+	  if(strain_consseq[strainid].size()){
 
-	    int32 newgenelen=0;
+	    // check whether we have non covered bases in this strain
+	    bool missingcompletely=false;
 	    {
-	      size_t maxprotlen=0;
-	      for(uint32 strainid=0; strainid<strain_consseq.size(); strainid++){
-		maxprotlen=max(maxprotlen,strain_featureprot[featurecount][strainid].size());
+	      uint32 basesnocov=0;
+	      
+	      const char * dnap=strain_consseq[strainid].c_str();
+	      dnap+=F->cfrom;
+	      for(uint32 ii=F->cfrom; ii<= F->cto; dnap++, ii++){
+		if(*dnap=='@') basesnocov++;
 	      }
-	      newgenelen=static_cast<int32>(maxprotlen*3);
-	    }
-
-	    if(newgenelen > static_cast<int32>(fI->cto - fI->cfrom)){
-	      CEBUG("Must adapt gene length to: " << newgenelen << '\n');
-	      if(featuredir>0){
-		realfcto=fI->cfrom+newgenelen;
-	      }else{
-		realfcfrom=fI->cto-newgenelen;
+	      
+	      CEBUGNPQ("basesnocov: " << basesnocov << '\n');
+	      if(basesnocov >= (F->cto - F->cfrom)){
+		P->coveragestatus="completely missing?";
+		missingcompletely=true;
+	      }else if(basesnocov > 0
+		       && P->coveragestatus =="ok"){
+		P->coveragestatus="partly missing?";
 	      }
 	    }
-	  }
 
-	  bool taginintergenic=false;
-	  // always >=0: CTact->from >=0
-	  if(CTact->from < consseq.size()
-	     && intergeniclookup[CTact->from]){
-	    taginintergenic=true;
-	  }
-
-	  if(static_cast<int32>(CTact->from) >= realfcfrom
-	     && static_cast<int32>(CTact->from) <= realfcto){
-	    mustconsider=true;
-	    if(featuredir>0){
-	      reldistance=CTact->from - (realfcfrom);
+	    // look how feature is translated
+	    if(featuredir>0) {
+	      uint32 translateto=F->cto;
+	      if(F->mustbetranslated) translateto=F->cfrom;
+	      dptools::dnaToProtein(strain_consseq[strainid],
+				    strain_featureprot[featurecount][strainid],
+				    strain_featuredna[featurecount][strainid],
+				    F->cfrom,
+				    translateto,
+				    featuredir,
+				    F->translationtable,
+				    F->codonstart);
 	    }else{
-	      reldistance=(realfcto)-(CTact->from);
+	      uint32 translateto=F->cfrom;
+	      if(F->mustbetranslated) translateto=F->cto;
+	      dptools::dnaToProtein(strain_consseq[strainid],
+				    strain_featureprot[featurecount][strainid],
+				    strain_featuredna[featurecount][strainid],
+				    F->cto,
+				    translateto,
+				    featuredir,
+				    F->translationtable,
+				    F->codonstart);
+	    }
+	    CEBUGNPQ("Protein for strain " << strainid << ": " << strain_featureprot[featurecount][strainid] << endl);
+	    CEBUGNPQ("DNA for strain " << strainid << ": " << strain_featuredna[featurecount][strainid] << endl);
+
+	    // clear "protein" of features that are not to be translated 
+	    //  or where the coverage is completely missing
+	    if(!F->mustbetranslated
+	      || missingcompletely){
+	      strain_featureprot[featurecount][strainid].clear();
+	      P->firstcodonisstart=false;
+	    }else if(strain_featuredna[featurecount][strainid].size() >= 3
+	      && P->firstcodonisstart){
+	      P->firstcodonisstart=dptools::isCodonStart(F->translationtable,
+							 strain_featuredna[featurecount][strainid][0],
+							 strain_featuredna[featurecount][strainid][1],
+							 strain_featuredna[featurecount][strainid][2]);
+	      CEBUGNPQ("firstcodonisstart: " << P->firstcodonisstart << '\n');
 	    }
 	  }
+	}
 
-	  if(mustconsider){
-	    CEBUGNPQ("Possible candidate for: " << *fI << endl);
-	    CEBUGNPQ("CTact: " << *CTact << endl);
 
-	    auto * constouse = &consseq;
-	    auto * qualtouse = &consqual;
-	    if(fI->strainid >= 0
-	       && fI->strainid < strain_consseq.size()){
-	      constouse=&strain_consseq[fI->strainid];
-	      qualtouse=&strain_consqual[fI->strainid];
-	    }
 
-	    char baseinfeaturestrain='?';
-	    if(fI->pcrI != cle.getContigReads().end()){
-	      baseinfeaturestrain=static_cast<char>(toupper(cle.getBaseInRead(CTact->from,fI->pcrI)));
-	      if(featuredir<0) baseinfeaturestrain=dptools::getComplementIUPACBase(baseinfeaturestrain);
-	    }else{
-	      baseinfeaturestrain=(*constouse)[CTact->from];
-	    }
+	// go through each SNP consensustag
+	vector<Contig::consensustag_t>::const_iterator CTact;
+	vector<Contig::consensustag_t>::const_iterator CTlast;
 
-	    CEBUGNPQ("  baseinfeaturestrain: " << baseinfeaturestrain << "\n");
-
-	    // compile some information on the position in the strain
-	    //  containing the feature
-	    string codoninfeature;
-	    vector<string> codonvariantsinfeature;
-	    vector<char> aainfeature;
-	    vector<bool> isstartinfeature;
-	    int32 aanumberinfeature=0;
-	    int8  posinaainfeature=0;
-
-	    if(fI->mustbetranslated){
-	      if(featuredir>0) {
-		dptools::infoOnAAatDNAPos(*constouse,
-					  CTact->from,
-					  realfcfrom,
-					  featuredir,
-					  fI->translationtable,
-					  fI->codonstart,
-					  codoninfeature,
-					  codonvariantsinfeature,
-					  aainfeature,
-					  isstartinfeature,
-					  aanumberinfeature,
-					  posinaainfeature);
-	      }else{
-		dptools::infoOnAAatDNAPos(*constouse,
-					  CTact->from,
-					  realfcto,
-					  featuredir,
-					  fI->translationtable,
-					  fI->codonstart,
-					  codoninfeature,
-					  codonvariantsinfeature,
-					  aainfeature,
-					  isstartinfeature,
-					  aanumberinfeature,
-					  posinaainfeature);
-	      }
+	CTact=contigI->getConsensusTags().begin();
+	CTlast=contigI->getConsensusTags().end();
+	CTlast--;
+	if(featuredir<0) {
+	  std::swap(CTact,CTlast);
+	}
 
-	      //BUGIFTHROW(aainfeature.size()==0,"aainfeature.size()==0?");
-	      //BUGIFTHROW(isstartinfeature.size()==0,"isstartinfeature.size()==0?");
-	      if(aainfeature.empty()) aainfeature.push_back('?');
-	      if(isstartinfeature.empty()) isstartinfeature.push_back(false);
-	    } else {
-	      aainfeature.push_back('/');
-	      isstartinfeature.push_back(false);
-	    }
+	bool lastconstagreached=false;
+	for(; !lastconstagreached; CTact+=featuredir){
+	  if(CTact==CTlast) lastconstagreached=true;
 
-	    double reffreq=-1.0;
-	    if(codonvariantsinfeature.size()==1){
-	      reffreq=codoninfo[dptools::getIndexOfCodon(codonvariantsinfeature[0])].frequency;
-	    }
+	  if(CTact->identifier == Contig::CON_tagentry_idSAOc
+	     || CTact->identifier == Contig::CON_tagentry_idSIOc
+	     || CTact->identifier == Contig::CON_tagentry_idSROc) {
 
-	    CEBUGNPQ("\nLooking for strains ...");
+	    bool mustconsider=false;
+	    int32 reldistance=0;
+	    //int8 updownlocation=0;
+	    // look where the SNP is located: in the feature (location =0), 
+	    //  upstream (-1) or downstream (1) 
 
-	    strainid2name_t::const_iterator SIC=strainnames_in_contig.begin();
-	    for(auto & snic : strainnames_in_contig){
+	    CEBUGNPQ("Testing F " << F->cfrom << " " << F->cto << "\t");
+	    CEBUGNPQ(CTact->getIdentifierStr() << " " << CTact->from << " " << CTact->to << endl);
 
-	      //for(uint32 actstrainid=0; actstrainid<strain_consseq.size();actstrainid++){
-	      int32 actstrainid=snic.first;
-	      CEBUGNPQ("Strainid: " << actstrainid << " ... ");
-	      // do not look in own strain of feature
-	      if(actstrainid==fI->strainid) continue;
-	      // do not look in empty strains when inlocus
-	      if(strain_featuredna[featurecount][actstrainid].size()==0) continue;
+	    // In dubio pro reo. To counter 
+	    //   - wrong annotation in initial genome or 
+	    //   - SNPs in mutant strain
+	    // we look at the coordinates as dictated by the protein lengths
+	    //  and decide upon these whether a SNP is inlocus, 
+	    //  up- or downstream
 
-	      CEBUGNPQ("CHECK!\n");
 
-	      char baseinstrain='?';
-	      if(featuredir>0){
-		baseinstrain=static_cast<char>(toupper(strain_consseq[actstrainid][CTact->from]));
-	      }else{
-		baseinstrain=static_cast<char>(toupper(dptools::getComplementIUPACBase(strain_consseq[actstrainid][CTact->from])));
+	    int32 realfcfrom=F->cfrom;
+	    int32 realfcto=F->cto;
+	    {
+	      // first, get max protein length
+	      
+	      int32 newgenelen=0;
+	      {
+		size_t maxprotlen=0;
+		for(uint32 strainid=0; strainid<strain_consseq.size(); strainid++){
+		  maxprotlen=max(maxprotlen,strain_featureprot[featurecount][strainid].size());
+		}
+		newgenelen=static_cast<int32>(maxprotlen*3);
 	      }
-	      CEBUGNPQ("baseinfeaturestrain : " << baseinfeaturestrain<<endl);
-	      CEBUGNPQ("baseinstrain " << actstrainid << ": " << baseinstrain<<endl);
-	      if(baseinstrain==baseinfeaturestrain) continue;
 
-	      CEBUGNPQ("Ok, base in strain different from feature.\n");
-
-	      pI->isaffected=true;
-
-	      bool makesframeshift=false;
-	      string dnaeffect="basechange";
-	      if(baseinfeaturestrain=='*' || baseinstrain=='*'){
-		makesframeshift=true;
-		if(baseinstrain=='*'){
-		  dnaeffect="deletion";
+	      if(newgenelen > static_cast<int32>(F->cto - F->cfrom)){
+		CEBUG("Must adapt gene length to: " << newgenelen << '\n');
+		if(featuredir>0){
+		  realfcto=F->cfrom+newgenelen;
 		}else{
-		  dnaeffect="insertion";
+		  realfcfrom=F->cto-newgenelen;
 		}
 	      }
+	    }
+
+	    bool taginintergenic=false;
+	    // always >=0: CTact->from >=0
+	    if(CTact->from < consseq.size()
+	       && intergeniclookup[CTact->from]){
+	      taginintergenic=true;
+	    }
+
+	    if(static_cast<int32>(CTact->from) >= realfcfrom 
+	       && static_cast<int32>(CTact->from) <= realfcto){
+	      mustconsider=true;
+	      if(featuredir>0){
+		reldistance=CTact->from - (realfcfrom);
+	      }else{
+		reldistance=(realfcto)-(CTact->from);
+	      }
+	    }
 
-	      CEBUGNPQ("Makes frame shift: " << makesframeshift << '\n');
-	      CEBUGNPQ("Effect on DNA: " << dnaeffect << '\n');
+	    if(mustconsider){
+	      CEBUGNPQ("Possible candidate for: " << F->locustag << " (" << F->gene << ")\n");
+	      CEBUGNPQ("  Location: " << CTact->from << endl);
 
+	      char baseinfeaturestrain=static_cast<char>(toupper(contigI->getBaseInRead(CTact->from,F->readindex)));
+	      if(featuredir<0) baseinfeaturestrain=dptools::getComplementIUPACBase(baseinfeaturestrain);
+	    
+	      CEBUGNPQ("  baseinfeaturestrain: " << baseinfeaturestrain << "\n");
+	    
 	      // compile some information on the position in the strain
-	      //  we are looking at
-	      string codoninstrain;
-	      vector<string> codonvariantsinstrain;
-	      vector<string> codonvariantsinstrainnewonly;
-
-	      // aainstrain is original. e.g.: "TI"
-	      vector<char> aainstrain;
-
-	      // aainstrainnewonly is the above MINUS amino acids which were also in feature strain
-	      // E.g.: feature has "T" and aainstrain has "TI", then aainstrainnewonly has "I"
-	      vector<char> aainstrainnewonly;  // only "new" aminoacids
-	      vector<bool> isstartinstrain;
-	      int32 aanumberinstrain=0;
-	      int8  posinaainstrain=0;
-	      if(fI->mustbetranslated){
-		CEBUGNPQ("must be translated.\n");
+	      //  containing the feature
+	      string codoninfeature;
+	      vector<char> aainfeature;
+	      vector<bool> isstartinfeature;
+	      int32 aanumberinfeature=0;
+	      int8  posinaainfeature=0;
+
+	      if(F->mustbetranslated){
 		if(featuredir>0) {
-		  dptools::infoOnAAatDNAPos(strain_consseq[actstrainid],
+		  dptools::infoOnAAatDNAPos(strain_consseq[F->strainid],
 					    CTact->from,
 					    realfcfrom,
 					    featuredir,
-					    fI->translationtable,
-					    fI->codonstart,
-					    codoninstrain,
-					    codonvariantsinstrain,
-					    aainstrain,
-					    isstartinstrain,
-					    aanumberinstrain,
-					    posinaainstrain);
+					    F->translationtable,
+					    F->codonstart,
+					    codoninfeature,
+					    aainfeature,
+					    isstartinfeature,
+					    aanumberinfeature,
+					    posinaainfeature);
 		}else{
-		  dptools::infoOnAAatDNAPos(strain_consseq[actstrainid],
+		  dptools::infoOnAAatDNAPos(strain_consseq[F->strainid],
 					    CTact->from,
 					    realfcto,
 					    featuredir,
-					    fI->translationtable,
-					    fI->codonstart,
-					    codoninstrain,
-					    codonvariantsinstrain,
-					    aainstrain,
-					    isstartinstrain,
-					    aanumberinstrain,
-					    posinaainstrain);
+					    F->translationtable,
+					    F->codonstart,
+					    codoninfeature,
+					    aainfeature,
+					    isstartinfeature,
+					    aanumberinfeature,
+					    posinaainfeature);
 		}
-		//BUGIFTHROW(aainstrain.size()==0,"aainstrain.size()==0?");
-		//BUGIFTHROW(isstartinstrain.size()==0,"isstartinstrain.size()==0?");
-		if(aainstrain.empty()) aainstrain.push_back('?');
-		if(isstartinstrain.empty()) isstartinstrain.push_back(false);
-	      }else{
-		CEBUGNPQ("not translated.\n");
-		aainstrain.push_back('/');
-		isstartinstrain.push_back(false);
-	      }
 
-	      CEBUGNPQ("\naainstrain: '");
-	      for(auto & tmpc : aainstrain){
-		CEBUGNPQ(tmpc);
+		//BUGIFTHROW(aainfeature.size()==0,"aainfeature.size()==0?");
+		//BUGIFTHROW(isstartinfeature.size()==0,"isstartinfeature.size()==0?");
+		if(aainfeature.empty()) aainfeature.push_back('?');
+		if(isstartinfeature.empty()) isstartinfeature.push_back(false);
+	      } else {
+		aainfeature.push_back('/');
+		isstartinfeature.push_back(false);
 	      }
-	      CEBUGNPQ("'\n");
 
-	      // create aainstrainnewonly
-	      {
-		for(auto & aais : aainstrain){
-		  bool found=false;
-		  for(auto & aaif : aainfeature){
-		    if(aaif == aais) {
-		      found=true;
-		      break;
-		    }
-		  }
-		  if(!found) {
-		    aainstrainnewonly.push_back(aais);
-		  }
-		}
-	      }
-	      CEBUGNPQ("\naainstrainnewonly: '");
-	      for(auto & tmpc : aainstrainnewonly){
-		CEBUGNPQ(tmpc);
-	      }
-	      CEBUGNPQ("'\n");
 
-	      // create aainstrainnewonly
-	      {
-		for(auto & cvis : codonvariantsinstrain){
-		  bool found=false;
-		  for(auto & cvif : codonvariantsinfeature){
-		    if(cvif == cvis) {
-		      found=true;
-		      break;
-		    }
-		  }
-		  if(!found) {
-		    codonvariantsinstrainnewonly.push_back(cvis);
-		  }
-		}
-	      }
-	      CEBUGNPQ("\ncv strain: '");
-	      for(auto & tmpc : codonvariantsinstrain){
-		CEBUGNPQ(tmpc << ' ');
-	      }
-	      CEBUGNPQ("'\n");
-	      CEBUGNPQ("\ncv strainnewonly: '");
-	      for(auto & tmpc : codonvariantsinstrainnewonly){
-		CEBUGNPQ(tmpc << ' ');
-	      }
-	      CEBUGNPQ("'\n");
+	      CEBUGNPQ("\nLooking for strains ...");
 
-	      double strainfreq=-1.0;
-	      if(codonvariantsinstrainnewonly.empty() && codonvariantsinstrain.size()==1){
-		strainfreq=codoninfo[dptools::getIndexOfCodon(codonvariantsinstrain[0])].frequency;
-	      }else if(codonvariantsinstrainnewonly.size()==1){
-		strainfreq=codoninfo[dptools::getIndexOfCodon(codonvariantsinstrainnewonly[0])].frequency;
-	      }
+	      strainid2name_t::const_iterator SIC=strainnames_in_contig.begin();
+	      for(; SIC!= strainnames_in_contig.end(); SIC++){
 
-	      // untranslated SNPs are SNPs that occur within the
-	      //  feature, but where the protein still ended earlier
-	      string effectonprot="none";
-	      if(fI->mustbetranslated){
-		bool untranslated=false;
-		if(aanumberinstrain>=static_cast<int32>(strain_featureprot[featurecount][actstrainid].size())) {
-		  untranslated=true;
+		//for(uint32 actstrainid=0; actstrainid<strain_consseq.size();actstrainid++){
+		int32 actstrainid=SIC->first;
+		CEBUGNPQ("Strainid: " << actstrainid << " ... ");
+		// do not look in own strain of feature
+		if(actstrainid==F->strainid) continue;
+		// do not look in empty strains when inlocus
+		if(strain_featuredna[featurecount][actstrainid].size()==0) continue;
 
-		  CEBUGNPQ("Untranslated!\tAAnumberinstrain: " << aanumberinstrain << "\tAAnumberinfeatureprot: " << strain_featureprot[featurecount][actstrainid].size() << endl);
+		CEBUGNPQ("CHECK!\n");
 
+		char baseinstrain='?';
+		if(featuredir>0){
+		  baseinstrain=static_cast<char>(toupper(strain_consseq[actstrainid][CTact->from]));
+		}else{
+		  baseinstrain=static_cast<char>(toupper(dptools::getComplementIUPACBase(strain_consseq[actstrainid][CTact->from])));
 		}
+		CEBUGNPQ("baseinfeaturestrain : " << baseinfeaturestrain<<endl);
+		CEBUGNPQ("baseinstrain " << actstrainid << ": " << baseinstrain<<endl);
+		if(baseinstrain==baseinfeaturestrain) continue;
 
-		// frameshift, aa changes and silents
-		if(makesframeshift) {
-		  CEBUGNPQ("#1\n");
-		  effectonprot="frameshift";
-		  // corrective measures for "untranslated"
-		  if(untranslated){
-		    CEBUGNPQ("#2a\n");
-		    if(baseinstrain=='*') {
-		      CEBUGNPQ("#3a\n");
-		      pI->deletionuntranslated+=1;
-		    }else{
-		      CEBUGNPQ("#4a\n");
-		      pI->insertionuntranslated+=1;
-		    }
+		CEBUGNPQ("Ok, base in strain different from feature.\n");
+
+		P->isaffected=true;
+
+		bool makesframeshift=false;
+		string dnaeffect="basechange";
+		if(baseinfeaturestrain=='*' || baseinstrain=='*'){
+		  makesframeshift=true;
+		  if(baseinstrain=='*'){
+		    dnaeffect="deletion";
 		  }else{
-		    CEBUGNPQ("#2b\n");
-		    if(baseinstrain=='*') {
-		      CEBUGNPQ("#3b\n");
-		      pI->deletioninlocus+=1;
-		    }else{
-		      CEBUGNPQ("#4b\n");
-		      pI->insertioninlocus+=1;
-		    }
+		    dnaeffect="insertion";
+		  }
+		}
+
+		CEBUGNPQ("Makes frame shift: " << makesframeshift << '\n');
+		CEBUGNPQ("Effect on DNA: " << dnaeffect << '\n')
+		
+		// compile some information on the position in the strain
+		//  we are looking at
+		string codoninstrain;
+		vector<char> aainstrain;
+		vector<bool> isstartinstrain;
+		int32 aanumberinstrain=0;
+		int8  posinaainstrain=0;
+		if(F->mustbetranslated){
+		  CEBUGNPQ("must be translated.\n");
+		  if(featuredir>0) {
+		    dptools::infoOnAAatDNAPos(strain_consseq[actstrainid],
+					      CTact->from,
+					      realfcfrom,
+					      featuredir,
+					      F->translationtable,
+					      F->codonstart,
+					      codoninstrain,
+					      aainstrain,
+					      isstartinstrain,
+					      aanumberinstrain,
+					      posinaainstrain);
+		  }else{
+		    dptools::infoOnAAatDNAPos(strain_consseq[actstrainid],
+					      CTact->from,
+					      realfcto,
+					      featuredir,
+					      F->translationtable,
+					      F->codonstart,
+					      codoninstrain,
+					      aainstrain,
+					      isstartinstrain,
+					      aanumberinstrain,
+					      posinaainstrain);
+		  }
+		  //BUGIFTHROW(aainstrain.size()==0,"aainstrain.size()==0?");
+		  //BUGIFTHROW(isstartinstrain.size()==0,"isstartinstrain.size()==0?");
+		  if(aainstrain.empty()) aainstrain.push_back('?');
+		  if(isstartinstrain.empty()) isstartinstrain.push_back(false);
+		}else{
+		  CEBUGNPQ("not translated.\n");
+		  aainstrain.push_back('/');
+		  isstartinstrain.push_back(false);
+		}
+
+		string effectonprot="none";
+		if(F->mustbetranslated){
+		  // untranslated SNPs are SNPs that occur within the
+		  //  feature, but where the protein still ended earlier
+		  bool untranslated=false;
+		  if(aanumberinstrain>=static_cast<int32>(strain_featureprot[featurecount][actstrainid].size())) {
+		    untranslated=true;
+		    
+		    CEBUGNPQ("Untranslated!\tAAnumberinstrain: " << aanumberinstrain << "\tAAnumberinfeatureprot: " << strain_featureprot[featurecount][actstrainid].size() << endl);
+		    
 		  }
-		}else if(!aainstrainnewonly.empty()){
-		  effectonprot.clear();
-		  for(auto & aais : aainstrainnewonly){
-		    if(!effectonprot.empty()) effectonprot+=" / ";
-		    if(aainfeature[0]!=aais){
-		      CEBUGNPQ("#5\n");
-		      effectonprot+="aa change";
-		      if(untranslated){
-			CEBUGNPQ("#6\n");
-			pI->aachangeuntranslated+=1;
+		  
+		  // frameshift, aa changes and silents
+		  if(makesframeshift) {
+		    CEBUGNPQ("#1\n");
+		    effectonprot="frameshift";
+		    // corrective measures for "untranslated"
+		    if(untranslated){
+		      CEBUGNPQ("#2a\n");
+		      if(baseinstrain=='*') {
+			CEBUGNPQ("#3a\n");
+			P->deletionuntranslated+=1;
 		      }else{
-			CEBUGNPQ("#7\n");
-			pI->aachangeinlocus+=1;
+			CEBUGNPQ("#4a\n");
+			P->insertionuntranslated+=1;
 		      }
 		    }else{
-		      CEBUGNPQ("#8\n");
-		      effectonprot+="none";
-		      if(untranslated){
-			CEBUGNPQ("#9\n");
-			pI->silentuntranslated+=1;
+		      CEBUGNPQ("#2b\n");
+		      if(baseinstrain=='*') {
+			CEBUGNPQ("#3b\n");
+			P->deletioninlocus+=1;
 		      }else{
-			CEBUGNPQ("#10\n");
-			pI->silentinlocus+=1;
+			CEBUGNPQ("#4b\n");
+			P->insertioninlocus+=1;
 		      }
 		    }
-		  }
-		}
-		if(aainfeature[0]!='*'){
-		  CEBUGNPQ("#11\n");
-		  for(auto & aais : aainstrainnewonly){
-		    if(aais=='*') {
-		      effectonprot+=" / creates new stop codon";
-		      pI->prematurestop=true;
-		      break;
+		  }else if(aainfeature[0]!=aainstrain[0]){
+		    CEBUGNPQ("#5\n");
+		    effectonprot="aa change";
+		    
+		    if(untranslated){
+		      CEBUGNPQ("#6\n");
+		      P->aachangeuntranslated+=1;
+		    }else{
+		      CEBUGNPQ("#7\n");
+		      P->aachangeinlocus+=1;
 		    }
-		  }
-		}
-
-		// destroy/change Start/Stop
-		if(aanumberinfeature==0 && isstartinfeature[0]) {
-		  CEBUGNPQ("#12\n");
-		  if(!isstartinstrain[0]){
-		    CEBUGNPQ("#13\n");
-		    effectonprot+=" / destroys start codon";
-		    pI->destroyedstart=true;
 		  }else{
-		    CEBUGNPQ("#14\n");
-		    effectonprot+=" / switches to another start codon";
-		    pI->changedstart=true;
+		    CEBUGNPQ("#8\n");
+		    effectonprot="silent";
+		    if(untranslated){
+		      CEBUGNPQ("#9\n");
+		      P->silentuntranslated+=1;
+		    }else{
+		      CEBUGNPQ("#10\n");
+		      P->silentinlocus+=1;
+		    }
 		  }
-		}
-		if(aainfeature[0]=='*'){
-		  CEBUGNPQ("#15\n");
-		  for(auto & aais : aainstrainnewonly){
-		    if(aais!='*'){
+		  if(aainfeature[0]!='*' && aainstrain[0]=='*'){
+		    CEBUGNPQ("#11\n");
+		    effectonprot+=" / creates new stop codon";
+		    P->prematurestop=true;
+		  }
+		  
+		  // destroy/change Start/Stop
+		  if(aanumberinfeature==0 && isstartinfeature[0]) {
+		    CEBUGNPQ("#12\n");
+		    if(!isstartinstrain[0]){
+		      CEBUGNPQ("#13\n");
+		      effectonprot+=" / destroys start codon";
+		      P->destroyedstart=true;
+		    }else{
+		      CEBUGNPQ("#14\n");
+		      effectonprot+=" / switches to another start codon";
+		      P->changedstart=true;
+		    }
+		  }
+		  if(aainfeature[0]=='*'){
+		    CEBUGNPQ("#15\n");
+		    if(aainstrain[0]!='*'){
 		      CEBUGNPQ("#16\n");
 		      effectonprot+=" / destroys stop codon";
-		      pI->destroyedstop=true;
+		      P->destroyedstart=true;
 		    }else{
 		      CEBUGNPQ("#17\n");
 		      effectonprot+=" / switches to another stop codon";
-		      pI->changedstop=true;
+		      P->changedstart=true;
 		    }
 		  }
-		}
-		if(untranslated){
-		  CEBUGNPQ("#18\n");
-		  effectonprot+=" :: untranslated, protein ended earlier";
-		}
-	      }else{
-		CEBUGNPQ("#19\n");
-		effectonprot="unknown";
+		  if(untranslated){
+		    CEBUGNPQ("#18\n");
+		    effectonprot+=" :: untranslated, protein ended earlier";
+		  }
+		}else{
+		  CEBUGNPQ("#19\n");
+		  effectonprot="unknown";
 
-		if(taginintergenic){
-		  CEBUGNPQ("#20\n");
-		  pI->mutinintergenic+=1;
+		  if(taginintergenic){
+		    CEBUGNPQ("#20\n");
+		    P->mutinintergenic+=1;
+		  }
 		}
-	      }
 
 
-	      // for the feature analysis, only print out inlocus
-	      int32 adjposfroml=CTact->from;
-	      int32 adjposfromr=adjposfroml;
-	      if(fI->pcrI != cle.getContigReads().end()){
-		const Read & featureread=*(fI->pcrI);
-		int32 rreadposfrom=cle.getRealReadPos(CTact->from,fI->pcrI);
-		if(rreadposfrom>=0){
-		  CEBUGNPQ("#c1" << endl);
-		  adjposfroml=featureread.getLowerNonGapAdjustmentPosOfReadPos(rreadposfrom)+1;
-		  CEBUGNPQ("#c2" << endl);
-		  adjposfromr=featureread.getUpperNonGapAdjustmentPosOfReadPos(rreadposfrom)+1;
-		}
-	      }
-	      CEBUGNPQ("#21\n");
-	      faout << cle.getContigName() << "\t";
-	      if(fI->pcrI != cle.getContigReads().end()){
-		faout << ReadGroupLib::getStrainOfStrainID(fI->pcrI->getStrainID()) << "\t";
-	      }else{
-		if(fI->strainid>=0 && fI->strainid<strain_consseq.size()){
-		  faout << ReadGroupLib::getStrainOfStrainID(fI->strainid) << "\t";
-		}else{
-		  faout << "NA\t";
-		}
-	      }
-	      CEBUGNPQ("#22\n");
-	      faout << ReadGroupLib::getStrainOfStrainID(actstrainid) << "\t";
-	      faout << CTact->from << "\t" << adjposfroml;
-	      if(adjposfroml!=adjposfromr) faout << ':' << adjposfromr;
-	      faout << '\t' << (1.0/cle.getContigLength()*adjposfroml*360);
-	      faout << '\t' << fI->identifier;
-	      faout << '\t' << fI->locustag << '\t';
-	      if(featuredir<0) {
-		faout << "complement\t";
-	      }else{
-		faout << "forward\t";
-	      }
-	      faout << fI->gene << "\t";
-	      faout.flush();
-
-	      CEBUGNPQ("#23\n");
-
-	      //hitother not used as this is pure biology
-	      //faout << "hitsother?" << "\t";
-	      //faout.flush();
-	      faout << reldistance << "\t";
-	      faout.flush();
-	      faout << dnaeffect << "\t";
-	      faout.flush();
-	      faout << baseinfeaturestrain << "->"; // << baseinstrain
-	      for(auto & tmpc : dptools::getNucleicAcidFromIUPAC(baseinstrain)) faout << tmpc;
-	      faout << '\t' << codoninfeature << "\t" << codoninstrain << "\t";
-	      faout.flush();
-
-	      if(reffreq>=0) faout << reffreq;
-	      faout << "\t";
-	      if(strainfreq>=0) faout << strainfreq;
-	      faout << "\t";
-
-	      CEBUGNPQ("#24\n");
-	      if(fI->pcrI != cle.getContigReads().end()){
-		faout << static_cast<uint16>(cle.getQualityInRead(CTact->from,fI->pcrI)) << "\t";
-	      }else{
-		faout << static_cast<uint16>((*qualtouse)[CTact->from]) << "\t";
-	      }
-	      CEBUGNPQ("#25\n");
-	      faout << static_cast<uint16>(consqual[CTact->from]) << "\t";
-
-	      faout.flush();
-
-	      for(auto & tmpf : aainfeature) faout << tmpf;
-	      faout << "->";
-	      for(auto & tmps : aainstrain) {
-		bool found=false;
-		for(auto & tmpsn : aainstrainnewonly) {
-		  if(tmps==tmpsn){
-		    found=true;
-		    break;
-		  }
-		}
-		if(found) {
-		  faout << tmps;
+		// for the feature analysis, only print out inlocus
+		int32 freadposfrom=contigI->getRealReadPos(CTact->from,F->readindex);
+		CEBUG("#c1" << endl);
+		int32 adjposfroml=featureread.getLowerNonGapAdjustmentPosOfReadPos(freadposfrom)+1;
+		CEBUG("#c2" << endl);
+		int32 adjposfromr=featureread.getUpperNonGapAdjustmentPosOfReadPos(freadposfrom)+1;
+		
+		faout << contigI->getContigName() << "\t";
+		//faout << contigI->getReadAtIndex(F->readindex).getName() << "\t";
+		faout << rpool.getStrainOfStrainID(contigI->getReadAtIndex(F->readindex).getStrainID()) << "\t";
+		faout << rpool.getStrainOfStrainID(actstrainid) << "\t";
+		//faout << CTact->from << "\t" << contigI->paddedPos2UnpaddedPos(CTact->from) << "\t";
+		faout << CTact->from << "\t" << adjposfroml;
+		if(adjposfroml!=adjposfromr) faout << ':' << adjposfromr;
+		faout << '\t' << (1.0/contigI->getContigLength()*adjposfroml*360);
+		faout << '\t' << F->locustag << "\t";
+		if(featuredir<0) {
+		  faout << "complement\t";
 		}else{
-		  faout << static_cast<char>(tolower(tmps));
+		  faout << "forward\t";
 		}
+		faout << F->gene << "\t";
+		faout.flush();
+		
+		//hitother not used as this is pure biology
+		//faout << "hitsother?" << "\t";
+		//faout.flush();
+		faout << reldistance << "\t";
+		faout.flush();
+		faout << dnaeffect << "\t";
+		faout.flush();
+		faout << baseinfeaturestrain << "->" << baseinstrain << "\t";
+		faout << codoninfeature << "\t" << codoninstrain << "\t";
+		faout.flush();
+		
+		faout << static_cast<uint16>(contigI->getQualityInRead(CTact->from,F->readindex)) << "\t";
+		faout << static_cast<uint16>(consqual[CTact->from]) << "\t";
+		
+		faout.flush();
+		
+		faout << aainfeature[0] << "->" << aainstrain[0] << "\t";
+		
+		faout << aanumberinfeature << "\t";
+		faout << static_cast<int16>(posinaainfeature) << "\t";
+		faout << aanumberinstrain << "\t";
+		faout << static_cast<int16>(posinaainstrain) << "\t";
+		
+		faout.flush();
+		
+		faout << effectonprot << "\t";
+		faout << F->product << "\t";
+		faout << F->function << "\t";
+		faout << F->note << "\t";
+		
+		faout << endl;
 	      }
-	      faout << "\t";
-
-	      CEBUGNPQ("#26\n");
-
-	      faout << aanumberinfeature << "\t";
-	      faout << static_cast<int16>(posinaainfeature) << "\t";
-	      faout << aanumberinstrain << "\t";
-	      faout << static_cast<int16>(posinaainstrain) << "\t";
-
-	      faout.flush();
-
-	      faout << effectonprot << "\t";
-	      faout << fI->product << "\t";
-	      faout << fI->function << "\t";
-	      faout << fI->note << "\t";
-
-	      faout << endl;
-	      CEBUGNPQ("#27\n");
 	    }
 	  }
 	}
       }
-    }
-
-    // went through all features of contig
-    // now print summary for each interesting feature
 
-    cout << "Summary of changes:\n";
+      // went through all features of contig
+      // now print summary for each interesting feature
 
-    fI=allGBfeatures.begin();
-    pI=allproteinchanges.begin();
-    for(uint32 featurecount=0; fI!=allGBfeatures.end(); ++fI, ++pI, ++featurecount){
-      if(AnnotationMappings::isMIRAEntry(fI->identifier)) continue;
+      cout << "Summary of changes:\n";
 
-      CEBUGNPQ("Summary for " << fI->locustag << '\t' << fI->cfrom << '\t' << fI->cto << endl);
+      F=allGBfeatures.begin();
+      P=allproteinchanges.begin();
+      for(uint32 featurecount=0; F!=allGBfeatures.end(); F++, P++, featurecount++){
+	CEBUGNPQ("Summary for " << F->locustag << '\t' << F->cfrom << '\t' << F->cto << endl);
 
-      int32 adjposfroml=fI->cfrom;
-      if(fI->pcrI != cle.getContigReads().end()){
-	int32 rreadposfrom=cle.getRealReadPos(fI->cfrom,fI->pcrI);
+	int32 freadposfrom=contigI->getRealReadPos(F->cfrom,F->readindex);
 	CEBUG("#d1" << endl);
-	if(rreadposfrom>=0){
-	  adjposfroml=fI->pcrI->getLowerNonGapAdjustmentPosOfReadPos(rreadposfrom)+1;
-	  CEBUG("#d2" << endl);
-	}
-      }
+	int32 adjposfroml=contigI->getReadAtIndex(F->readindex).getLowerNonGapAdjustmentPosOfReadPos(freadposfrom)+1;
+	CEBUG("#d2" << endl);
 
-      fsout << fI->locustag << '\t' << fI->gene;
+	fsout << F->locustag << '\t' << F->gene;
 
-      fsout << '\t' << fI->identifier;
+	fsout << '\t' << F->identifier;
 
-      fsout << '\t' << (1.0/cle.getContigLength()*adjposfroml*360) << '\t';
+	fsout << '\t' << (1.0/contigI->getReadAtIndex(F->readindex).getLenSeq()*adjposfroml*360) << '\t';
 
-      // make a quick summary whether one should look at this protein
-      {
-	// interestlevel 0 = no, 1 = perhaps, 2 = yes
-	uint32 interestlevel=0;
-	if(
-	  pI->changedstart
-	  || pI->changedstop
+	// make a quick summary whether one should look at this protein
+	{
+	  // interestlevel 0 = no, 1 = perhaps, 2 = yes
+	  uint32 interestlevel=0;
+	  if(
+	    P->changedstart
+	    || P->changedstop
 
-	  || pI->silentinlocus > 0
+	    || P->silentinlocus > 0
 
-	  || pI->silentuntranslated    > 0
+	    || P->silentuntranslated    > 0
 
-	  ){
-	  CEBUGNPQ("Interest 1\n");
-	  interestlevel=1;
-	}
-	if(
-	  pI->destroyedstart
-	  || pI->destroyedstop
-	  || pI->prematurestop
-
-	  || pI->insertioninlocus > 0
-	  || pI->deletioninlocus  > 0
-	  || pI->aachangeinlocus  > 0
-
-	  || pI->insertionuntranslated > 0           // in dubio pro reo
-	  || pI->deletionuntranslated  > 0           // in dubio pro reo
-	  || pI->aachangeuntranslated  > 0           // in dubio pro reo
-
-	  || (pI->coveragestatus!="ok"
-	      && pI->coveragestatus!="out of contig")
-	  ){
-	  CEBUGNPQ("Interest 2/std\n");
-	  interestlevel=2;
-	}
+	    ){
+	    CEBUGNPQ("Interest 1\n");
+	    interestlevel=1;
+	  }
+	  if(
+	    P->destroyedstart
+	    || P->destroyedstop
+	    || P->prematurestop
+	    
+	    || P->insertioninlocus > 0
+	    || P->deletioninlocus  > 0
+	    || P->aachangeinlocus  > 0
+	    
+	    || P->insertionuntranslated > 0           // in dubio pro reo
+	    || P->deletionuntranslated  > 0           // in dubio pro reo
+	    || P->aachangeuntranslated  > 0           // in dubio pro reo
+
+	    || (P->coveragestatus!="ok"
+		&& P->coveragestatus!="out of contig")
+	    ){
+	    CEBUGNPQ("Interest 2/std\n");
+	    interestlevel=2;
+	  }
 
-	// account for wrong annotation
-	if(!pI->firstcodonisstart
-	   &&	(pI->silentinlocus >0
-		 || pI->insertionuntranslated > 0           // in dubio pro reo
-		 || pI->deletionuntranslated  > 0           // in dubio pro reo
-		 || pI->aachangeuntranslated  > 0           // in dubio pro reo
-	     )){
-	  CEBUGNPQ("Interest 2/account wrong anno\n");
-	  interestlevel=2;
-	}
+	  // account for wrong annotation
+	  if(!P->firstcodonisstart
+	     &&	(P->silentinlocus >0 
+		 || P->insertionuntranslated > 0           // in dubio pro reo
+		 || P->deletionuntranslated  > 0           // in dubio pro reo
+		 || P->aachangeuntranslated  > 0           // in dubio pro reo
+	       )){
+	    CEBUGNPQ("Interest 2/account wrong anno\n");
+	    interestlevel=2;
+	  }
 
-	// intergenics are always interesting
-	if(fI->identifier == "Figr"
-	   && pI->mutinintergenic){
-	  interestlevel=2;
-	  CEBUGNPQ("Interest 2/intergenic\n");
-	}
+	  // intergenics are always interesting
+	  if(F->identifier == "Figr"
+	     && P->mutinintergenic){
+	    interestlevel=2;
+	    CEBUGNPQ("Interest 2/intergenic\n");
+	  }
 
 
-	if(interestlevel==0){
-	  fsout << "no\t";
-	}else if(interestlevel==1){
-	  fsout << "perhaps\t";
-	}else{
-	  fsout << "yes\t";
+	  if(interestlevel==0){
+	    fsout << "no\t";
+	  }else if(interestlevel==1){
+	    fsout << "perhaps\t";
+	  }else{
+	    fsout << "yes\t";
+	  }
 	}
-      }
 
-      fsout << '\t';       // own filter
+	fsout << '\t';       // own filter
 
-      fsout << pI->coveragestatus << '\t';
+	fsout << P->coveragestatus << '\t';
 
-      if(fI->identifier == "FCDS"){
-	if(pI->firstcodonisstart) {fsout << "yes\t";}else{fsout << "no\t";}
-	if(pI->changedstart) {fsout << "yes\t";}else{fsout << "no\t";}
-	if(pI->destroyedstart) {fsout << "yes\t";}else{fsout << "no\t";}
-	if(pI->changedstop) {fsout << "yes\t";}else{fsout << "no\t";}
-	if(pI->destroyedstop) {fsout << "yes\t";}else{fsout << "no\t";}
-	if(pI->prematurestop) {fsout << "yes\t";}else{fsout << "no\t";}
-      }else{
-	fsout << "n/a\t"
-	      << "n/a\t"
-	      << "n/a\t"
-	      << "n/a\t"
-	      << "n/a\t"
-	      << "n/a\t";
-      }
-
-      fsout << pI->mutinintergenic << "\t";
+	if(F->identifier == "FCDS"){
+	  if(P->firstcodonisstart) {fsout << "yes\t";}else{fsout << "no\t";}
+	  if(P->changedstart) {fsout << "yes\t";}else{fsout << "no\t";}
+	  if(P->destroyedstart) {fsout << "yes\t";}else{fsout << "no\t";}
+	  if(P->changedstop) {fsout << "yes\t";}else{fsout << "no\t";}
+	  if(P->destroyedstop) {fsout << "yes\t";}else{fsout << "no\t";}
+	  if(P->prematurestop) {fsout << "yes\t";}else{fsout << "no\t";}
+	}else{
+	  fsout << "n/a\t"
+		<< "n/a\t"
+		<< "n/a\t"
+		<< "n/a\t"
+		<< "n/a\t"
+		<< "n/a\t";
+	}
 
-      fsout << pI->insertioninlocus << "\t";
-      fsout << pI->deletioninlocus << "\t";
-      fsout << pI->silentinlocus << "\t";
-      fsout << pI->aachangeinlocus << "\t";
+	fsout << P->mutinintergenic << "\t";
 
-      fsout << pI->insertionuntranslated << "\t";
-      fsout << pI->deletionuntranslated << "\t";
-      fsout << pI->silentuntranslated << "\t";
-      fsout << pI->aachangeuntranslated << "\t";
+	fsout << P->insertioninlocus << "\t";
+	fsout << P->deletioninlocus << "\t";
+	fsout << P->silentinlocus << "\t";
+	fsout << P->aachangeinlocus << "\t";
 
-      fsout << fI->product << "\t";
-      fsout << fI->function << "\t";
-      fsout << fI->note;
+	fsout << P->insertionuntranslated << "\t";
+	fsout << P->deletionuntranslated << "\t";
+	fsout << P->silentuntranslated << "\t";
+	fsout << P->aachangeuntranslated << "\t";
 
-      fsout << endl;
+	fsout << F->product << "\t";
+	fsout << F->function << "\t";
+	fsout << F->note;
 
+	fsout << endl;
 
-      fcout << cle.getContigName() << '\t' <<  fI->identifier << '\t' << fI->locustag << '\t' << fI->gene;
-      if(fI->strainid>=0 && fI->strainid<strain_consseq.size()){
-	fcout << "\t" << ReadGroupLib::getStrainOfStrainID(fI->strainid);
-      }else{
-	fcout << "\tNA";
-      }
 
-      for(uint32 strainid=0; strainid<strain_consseq.size(); strainid++){
-	if(strainid!=static_cast<uint32>(fI->strainid)){
-	  fcout << "\t" << ReadGroupLib::getStrainOfStrainID(strainid);
+	fcout << contigI->getContigName() << "\t" <<  F->locustag << "\t" << F->gene;
+	fcout << "\t" << rpool.getStrainOfStrainID(F->strainid); 
+	// always start with strainid=1 as strainid 0 is "default", which
+	//  we do not want
+	for(uint32 strainid=1; strainid<strain_consseq.size(); strainid++){
+	  if(strainid!=static_cast<uint32>(F->strainid)){
+	    fcout << "\t" << rpool.getStrainOfStrainID(strainid);
+	  }
 	}
-      }
 
-      if(fI->strainid>=0 && fI->strainid<strain_featureprot.size()){
-	string reference=strain_featureprot[featurecount][fI->strainid];
+	string reference=strain_featureprot[featurecount][F->strainid];
 	adjustCaseOfSequences(reference, strain_featureprot[featurecount]);
 
 	fcout << "\t" << reference;
 
-	for(uint32 strainid=0; strainid<strain_consseq.size(); strainid++){
-	  if(strainid!=static_cast<uint32>(fI->strainid)){
+	for(uint32 strainid=1; strainid<strain_consseq.size(); strainid++){
+	  if(strainid!=static_cast<uint32>(F->strainid)){
 	    fcout << "\t" << strain_featureprot[featurecount][strainid];
 	  }
 	}
 
-	reference=strain_featuredna[featurecount][fI->strainid];
+	reference=strain_featuredna[featurecount][F->strainid];
 	adjustCaseOfSequences(reference, strain_featuredna[featurecount]);
 
 	fcout << "\t" << reference;
 
-	for(uint32 strainid=0; strainid<strain_consseq.size(); strainid++){
-	  if(strainid!=static_cast<uint32>(fI->strainid)){
+	for(uint32 strainid=1; strainid<strain_consseq.size(); strainid++){
+	  if(strainid!=static_cast<uint32>(F->strainid)){
 	    fcout << "\t" << strain_featuredna[featurecount][strainid];
 	  }
 	}
+	fcout << endl;
       }
-      fcout << endl;
     }
-  }
 
-  fcout.close();
-  fsout.close();
-  faout.close();
+    fcout.close();
+    fsout.close();
+    faout.close();
 
-  cout << "Done with feature analysis." << endl;
+    cout << "Done with feature analysis." << endl;
 
-}
-//#define CEBUGNPQ(bla)
+  }
 
 
 
@@ -2465,155 +2053,51 @@ void assout::saveFeatureAnalysis(list<Contig> & clist, ReadPool & rpool, const s
  *
  *************************************************************************/
 
-void assout::adjustCaseOfSequences(string & reference, vector<string> & mutants)
-{
-  size_t maxstring=reference.size();
-  for(uint32 m=0; m<mutants.size(); m++) maxstring=max(maxstring,mutants[m].size());
-
-  CEBUG("maxstring: " << maxstring << endl);
-
-  for(size_t i=0; i<maxstring; i++){
-    if(i<reference.size()) {
-      reference[i]=static_cast<char>(tolower(reference[i]));
-      bool ismutant=false;
-      for(size_t m=0; m<mutants.size(); m++) {
-	if(i<mutants[m].size()){
-	  mutants[m][i]=static_cast<char>(tolower(mutants[m][i]));
-	  CEBUG("r[i] / m[m][i] 1: " << reference[i] << ' ' << mutants[m][i] << '\n');
-
-	  if(reference[i] != mutants[m][i]){
-	    CEBUG("r[i] / m[m][i] 1.6: " << reference[i] << ' ' << mutants[m][i] << '\n');
-	    mutants[m][i]=static_cast<char>(toupper(mutants[m][i]));
-	  }
-	  CEBUG("r[i] / m[m][i] 2: " << reference[i] << ' ' << mutants[m][i] << '\n');
-	}else if(m!=0 || mutants[m].size()!=0){
-	  // the above is for catching the "default" strain which might be
-	  //  completely empty in assemblies where each read has a strain attached
-
-	  // this mutant has ended, uppercase reference
-	  ismutant=true;
-	}
-      }
-      if(ismutant) reference[i]=static_cast<char>(toupper(reference[i]));
-    }else{
-      // reference string has already ended, uppercase mutants
-      for(size_t m=0; m<mutants.size(); m++) {
-	if(i<mutants[m].size()) mutants[m][i]=static_cast<char>(toupper(mutants[m][i]));
-      }
-    }
-  }
-
-  CEBUG("refstr: " << reference << '\n');
-  for(uint32 m=0; m<mutants.size(); m++) {
-    CEBUG("mutstr: " << mutants[m] << '\n');
-  }
-
-}
-
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-void assout::saveAsFASTA(list<Contig> & clist, const string & filename, const string & paddedfilename, bool deleteoldfile)
-{
-  FUNCSTART("void saveAsFASTA(list<Contig> & clist, const string & filename, const string & paddedfilename)");
-
-  ofstream fastaout;
-  ofstream fastapaddedout;
-  ofstream qualout;
-  ofstream qualpaddedout;
-
-  string qualname;
-  string paddedqualname;
-  if(filename.size()) {
-    qualname=filename+".qual";
-    paddedqualname=paddedfilename+".qual";
-  }
+  void adjustCaseOfSequences(string & reference, vector<string> & mutants)
+  {
+    size_t maxstring=reference.size();
+    for(uint32 m=0; m<mutants.size(); m++) maxstring=max(maxstring,mutants[m].size());
+
+    CEBUG("maxstring: " << maxstring << endl);
+
+    for(size_t i=0; i<maxstring; i++){
+      if(i<reference.size()) {
+	reference[i]=static_cast<char>(tolower(reference[i]));
+	bool ismutant=false;
+	for(size_t m=0; m<mutants.size(); m++) {
+	  if(i<mutants[m].size()){
+	    mutants[m][i]=static_cast<char>(tolower(mutants[m][i]));
+	    CEBUG("r[i] / m[m][i] 1: " << reference[i] << ' ' << mutants[m][i] << '\n');
+
+	    if(reference[i] != mutants[m][i]){
+	      CEBUG("r[i] / m[m][i] 1.6: " << reference[i] << ' ' << mutants[m][i] << '\n');
+	      mutants[m][i]=static_cast<char>(toupper(mutants[m][i]));
+	    }
+	    CEBUG("r[i] / m[m][i] 2: " << reference[i] << ' ' << mutants[m][i] << '\n');
+	  }else if(m!=0 || mutants[m].size()!=0){
+	    // the above is for catching the "default" strain which might be
+	    //  completely empty in assemblies where each read has a strain attached
 
-  openFileForAppend(filename.c_str(), fastaout, deleteoldfile);
-  openFileForAppend(paddedfilename.c_str(), fastapaddedout, deleteoldfile);
-  openFileForAppend(qualname.c_str(), qualout, deleteoldfile);
-  openFileForAppend(paddedqualname.c_str(), qualpaddedout, deleteoldfile);
-
-  // Save contigs first, then singlets
-  for(uint32 savewhat=0; savewhat<2; savewhat++){
-    for(auto & cle : clist){
-      bool saveme=false;
-      if(savewhat==0 && cle.getNumReadsInContig()>1) saveme=true;
-      if(savewhat==1 && cle.getNumReadsInContig()==1) saveme=true;
-      if(saveme){
-	try{
-	  Contig::setCoutType(Contig::AS_FASTAPADDED);
-	  fastapaddedout << cle;
-	  Contig::setCoutType(Contig::AS_FASTAPADDEDQUAL);
-	  qualpaddedout << cle;
-	  Contig::setCoutType(Contig::AS_FASTA);
-	  fastaout << cle;
-	  Contig::setCoutType(Contig::AS_FASTAQUAL);
-	  qualout << cle;
+	    // this mutant has ended, uppercase reference
+	    ismutant=true;
+	  }
 	}
-	catch (Notify n) {
-	  cerr << "Error while dumping " << cle.getContigName() << ".\n";
-	  n.handleError(THISFUNC);
+	if(ismutant) reference[i]=static_cast<char>(toupper(reference[i]));
+      }else{
+	// reference string has already ended, uppercase mutants
+	for(size_t m=0; m<mutants.size(); m++) {
+	  if(i<mutants[m].size()) mutants[m][i]=static_cast<char>(toupper(mutants[m][i]));
 	}
       }
     }
-  }
-
-  fastaout.close();
-  qualout.close();
-
-  FUNCEND();
-}
-
-void assout::saveAsFASTA(Contig & con, const string & filename, const string & paddedfilename, bool deleteoldfile)
-{
-  FUNCSTART("void saveAsFASTA(Contig & con, const string & filename, const string & paddedfilename)");
 
-  ofstream fastaout;
-  ofstream fastapaddedout;
-  ofstream qualout;
-  ofstream qualpaddedout;
+    CEBUG("refstr: " << reference << '\n');
+    for(uint32 m=0; m<mutants.size(); m++) {
+      CEBUG("mutstr: " << mutants[m] << '\n');
+    }
 
-  string qualname;
-  string paddedqualname;
-  if(filename.size()) {
-    qualname=filename+".qual";
-    paddedqualname=paddedfilename+".qual";
   }
 
-  openFileForAppend(filename.c_str(), fastaout, deleteoldfile);
-  openFileForAppend(paddedfilename.c_str(), fastapaddedout, deleteoldfile);
-  openFileForAppend(qualname.c_str(), qualout, deleteoldfile);
-  openFileForAppend(paddedqualname.c_str(), qualpaddedout, deleteoldfile);
-
-  try{
-    Contig::setCoutType(Contig::AS_FASTAPADDED);
-    fastapaddedout << con;
-    Contig::setCoutType(Contig::AS_FASTAPADDEDQUAL);
-    qualpaddedout << con;
-    Contig::setCoutType(Contig::AS_FASTA);
-    fastaout << con;
-    Contig::setCoutType(Contig::AS_FASTAQUAL);
-    qualout << con;
-  }
-  catch (Notify n) {
-    cerr << "Error while dumping " << con.getContigName() << ".\n";
-    n.handleError(THISFUNC);
-  }
-
-  fastaout.close();
-  fastapaddedout.close();
-  qualout.close();
-  qualpaddedout.close();
-
-  FUNCEND();
-}
-
 
 /*************************************************************************
  *
@@ -2622,29 +2106,102 @@ void assout::saveAsFASTA(Contig & con, const string & filename, const string & p
  *
  *************************************************************************/
 
-void assout::saveStrainsAsFASTAQ(list<Contig> & clist, const ReadPool & rp, const string & paddedfilename, bool asfastq, uint32 mincoverage, base_quality_t minqual, bool deleteoldfile, bool fillholesinstrain)
-{
-  FUNCSTART("void saveAsFASTAQ(list<Contig> & clist, const string & paddedfilename)");
-
-  cout << "Saving padded strain contigs to FASTA file: " << paddedfilename << "_<strainname>.fasta" << endl;
-  //cout << "(qualities have .qual appended)" << endl;
-
-  // Save contigs first, then singlets
-  for(uint32 savewhat=0; savewhat<2; savewhat++){
-    for(auto & cle : clist){
-      bool saveme=false;
-      if(savewhat==0 && cle.getNumReadsInContig()>1) saveme=true;
-      if(savewhat==1 && cle.getNumReadsInContig()==1) saveme=true;
-      if(saveme){
-	saveStrainsAsFASTAQ(cle,rp,paddedfilename,asfastq,mincoverage,minqual,deleteoldfile,fillholesinstrain);
+  void saveAsFASTA(list<Contig> & clist, const string & filename, const string & paddedfilename, bool deleteoldfile)
+  {
+    FUNCSTART("void saveAsFASTA(list<Contig> & clist, const string & filename, const string & paddedfilename)");
+
+    ofstream fastaout;
+    ofstream fastapaddedout;
+    ofstream qualout;
+    ofstream qualpaddedout;
+
+    string qualname;
+    string paddedqualname;
+    if(filename.size()) {
+      qualname=filename+".qual";
+      paddedqualname=paddedfilename+".qual";
+    }
+
+    openFileForAppend(filename.c_str(), fastaout, deleteoldfile);
+    openFileForAppend(paddedfilename.c_str(), fastapaddedout, deleteoldfile);
+    openFileForAppend(qualname.c_str(), qualout, deleteoldfile);
+    openFileForAppend(paddedqualname.c_str(), qualpaddedout, deleteoldfile);
+
+    // Save contigs first, then singlets
+    for(uint32 savewhat=0; savewhat<2; savewhat++){
+      list<Contig>::iterator contigI=clist.begin();
+      for(;contigI!=clist.end();contigI++){
+	bool saveme=false;
+	if(savewhat==0 && contigI->getNumReadsInContig()>1) saveme=true;
+	if(savewhat==1 && contigI->getNumReadsInContig()==1) saveme=true;
+	if(saveme){
+	  try{
+	    Contig::setCoutType(Contig::AS_FASTAPADDED);
+	    fastapaddedout << *contigI;
+	    Contig::setCoutType(Contig::AS_FASTAPADDEDQUAL);
+	    qualpaddedout << *contigI;
+	    Contig::setCoutType(Contig::AS_FASTA);
+	    fastaout << *contigI;
+	    Contig::setCoutType(Contig::AS_FASTAQUAL);
+	    qualout << *contigI;
+	  }
+	  catch (Notify n) {
+	    cerr << "Error while dumping " << contigI->getContigName() << ".\n";
+	    n.handleError(THISFUNC);
+	  }
+	}
       }
     }
+
+    fastaout.close();
+    qualout.close();
+
+    FUNCEND();
   }
 
-  FUNCEND();
-}
+  void saveAsFASTA(Contig & con, const string & filename, const string & paddedfilename, bool deleteoldfile)
+  {
+    FUNCSTART("void saveAsFASTA(Contig & con, const string & filename, const string & paddedfilename)");
+
+    ofstream fastaout;
+    ofstream fastapaddedout;
+    ofstream qualout;
+    ofstream qualpaddedout;
+
+    string qualname;
+    string paddedqualname;
+    if(filename.size()) {
+      qualname=filename+".qual";
+      paddedqualname=paddedfilename+".qual";
+    }
+
+    openFileForAppend(filename.c_str(), fastaout, deleteoldfile);
+    openFileForAppend(paddedfilename.c_str(), fastapaddedout, deleteoldfile);
+    openFileForAppend(qualname.c_str(), qualout, deleteoldfile);
+    openFileForAppend(paddedqualname.c_str(), qualpaddedout, deleteoldfile);
 
+    try{
+      Contig::setCoutType(Contig::AS_FASTAPADDED);
+      fastapaddedout << con;
+      Contig::setCoutType(Contig::AS_FASTAPADDEDQUAL);
+      qualpaddedout << con;
+      Contig::setCoutType(Contig::AS_FASTA);
+      fastaout << con;
+      Contig::setCoutType(Contig::AS_FASTAQUAL);
+      qualout << con;
+    }
+    catch (Notify n) {
+      cerr << "Error while dumping " << con.getContigName() << ".\n";
+      n.handleError(THISFUNC);
+    }
 
+    fastaout.close();
+    fastapaddedout.close();
+    qualout.close();
+    qualpaddedout.close();
+    
+    FUNCEND();
+  }
 
 
 /*************************************************************************
@@ -2654,81 +2211,97 @@ void assout::saveStrainsAsFASTAQ(list<Contig> & clist, const ReadPool & rp, cons
  *
  *************************************************************************/
 
-void assout::saveStrainsAsFASTAQ(Contig & outcon, const ReadPool & rp, const string & paddedfilename, bool asfastq, uint32 mincoverage, base_quality_t minqual, bool deleteoldfile, bool fillholesinstrain)
-{
-  FUNCSTART("void assout::saveStrainsAsFASTAQ(Contig & outcon, const ReadPool & rp, const string & paddedfilename, bool asfastq, uint32 mincoverage, base_quality_t minqual, bool deleteoldfile, bool fillholesinstrain)");
+  void saveStrainsAsFASTAQ(list<Contig> & clist, const ReadPool & rp, const string & paddedfilename, bool asfastq, uint32 mincoverage, base_quality_t minqual, bool deleteoldfile, bool fillholesinstrain)
+  {
+    FUNCSTART("void saveAsFASTA(list<Contig> & clist, const string & paddedfilename)");
+
+    //cout << "Saving padded strain contigs to FASTA file: " << paddedfilename << "_<strainname>.fasta" << endl;
+    //cout << "(qualities have .qual appended)" << endl;
 
-  // make sure to dump "AllStrains" only if we have more than one strain
-  int32 startid=-1;
-  if(ReadGroupLib::getNumOfStrains()==1) startid=0;
+    vector<bool> allowtrunc(rp.getNumOfStrainInReadpool()+1,true);
 
-  for(int32 strainid=startid; strainid<static_cast<int32>(ReadGroupLib::getNumOfStrains()); ++strainid){
-    //if(outcon.getNumReadsPerStrain(strainid)==0) continue;
-    string strainfilename;
-    if(strainid>=0){
-      strainfilename=ReadGroupLib::getStrainOfStrainID(strainid);
-    }else{
-      strainfilename="AllStrains";
-    }
-    cout << "### calc " << strainfilename << " with strainid " << strainid << endl;
-    try{
-      if(asfastq){
-	ofstream fastqpaddedout;
-	openFileForAppend((paddedfilename+"_"+strainfilename+".padded.fastq").c_str(), fastqpaddedout, deleteoldfile);
-	outcon.dumpStrainAsFASTQ(fastqpaddedout,
-				 mincoverage,
-				 minqual,
-				 strainid,
-				 true,
-				 fillholesinstrain);
-
-	fastqpaddedout.close();
-	openFileForAppend((paddedfilename+"_"+strainfilename+".unpadded.fastq").c_str(), fastqpaddedout, deleteoldfile);
-	outcon.dumpStrainAsFASTQ(fastqpaddedout,
-				 mincoverage,
-				 minqual,
-				 strainid,
-				 false,
-				 fillholesinstrain);
-
-	fastqpaddedout.close();
-      }else{
-	ofstream fastapaddedout;
-	ofstream qualpaddedout;
-	openFileForAppend((paddedfilename+"_"+strainfilename+".padded.fasta").c_str(), fastapaddedout, deleteoldfile);
-	openFileForAppend((paddedfilename+"_"+strainfilename+".padded.fasta.qual").c_str(), qualpaddedout, deleteoldfile);
-
-	outcon.dumpStrainAsFASTAQUAL(fastapaddedout,
-				     qualpaddedout,
-				     mincoverage,
-				     minqual,
-				     strainid,
-				     true,
-				     fillholesinstrain);
-
-	fastapaddedout.close();
-	qualpaddedout.close();
-
-	openFileForAppend((paddedfilename+"_"+strainfilename+".unpadded.fasta").c_str(), fastapaddedout,deleteoldfile);
-	openFileForAppend((paddedfilename+"_"+strainfilename+".unpadded.fasta.qual").c_str(), qualpaddedout, deleteoldfile);
-
-	outcon.dumpStrainAsFASTAQUAL(fastapaddedout,
-				     qualpaddedout,
-				     mincoverage,
-				     minqual,
-				     strainid,
-				     false,
-				     fillholesinstrain);
-	fastapaddedout.close();
-	qualpaddedout.close();
+    // Save contigs first, then singlets
+    for(uint32 savewhat=0; savewhat<2; savewhat++){
+      list<Contig>::iterator contigI=clist.begin();
+      for(;contigI!=clist.end(); contigI++){
+	bool saveme=false;
+	if(savewhat==0 && contigI->getNumReadsInContig()>1) saveme=true;
+	if(savewhat==1 && contigI->getNumReadsInContig()==1) saveme=true;
+	if(saveme){
+	  for(int32 strainid=-1; strainid<static_cast<int32>(rp.getNumOfStrainInReadpool()); strainid++){
+	  //for(int32 strainid=2; strainid<=2; strainid++){
+	    string strainfilename;
+	    if(strainid>=0){
+	      strainfilename=rp.getStrainOfStrainID(strainid);
+	    }else{
+	      strainfilename="AllStrains";
+	    }
+	    try{
+	      if(asfastq){
+		ofstream fastqpaddedout;
+		openFileForAppend((paddedfilename+"_"+strainfilename+".padded.fastq").c_str(), fastqpaddedout, deleteoldfile & allowtrunc[1+strainid]);
+		contigI->dumpStrainAsFASTQ(fastqpaddedout, 
+					   mincoverage,
+					   minqual,
+					   strainid,
+					   true,
+					   fillholesinstrain);
+		
+		fastqpaddedout.close();
+		openFileForAppend((paddedfilename+"_"+strainfilename+".unpadded.fastq").c_str(), fastqpaddedout, deleteoldfile & allowtrunc[1+strainid]);
+		contigI->dumpStrainAsFASTQ(fastqpaddedout, 
+					   mincoverage,
+					   minqual,
+					   strainid,
+					   false,
+					   fillholesinstrain);
+		
+		fastqpaddedout.close();
+		allowtrunc[1+strainid]=false;
+	      }else{
+		ofstream fastapaddedout;
+		ofstream qualpaddedout;
+		openFileForAppend((paddedfilename+"_"+strainfilename+".padded.fasta").c_str(), fastapaddedout, deleteoldfile & allowtrunc[1+strainid]);
+		openFileForAppend((paddedfilename+"_"+strainfilename+".padded.fasta.qual").c_str(), qualpaddedout, deleteoldfile & allowtrunc[1+strainid]);
+		
+		contigI->dumpStrainAsFASTAQUAL(fastapaddedout, 
+					       qualpaddedout, 
+					       mincoverage,
+					       minqual,
+					       strainid,
+					       true,
+					       fillholesinstrain);
+		
+		fastapaddedout.close();
+		qualpaddedout.close();
+		
+		openFileForAppend((paddedfilename+"_"+strainfilename+".unpadded.fasta").c_str(), fastapaddedout, deleteoldfile & allowtrunc[1+strainid]);
+		openFileForAppend((paddedfilename+"_"+strainfilename+".unpadded.fasta.qual").c_str(), qualpaddedout, deleteoldfile & allowtrunc[1+strainid]);
+		
+		contigI->dumpStrainAsFASTAQUAL(fastapaddedout, 
+					       qualpaddedout, 
+					       mincoverage,
+					       minqual,
+					       strainid,
+					       false,
+					       fillholesinstrain);
+		fastapaddedout.close();
+		qualpaddedout.close();
+		allowtrunc[1+strainid]=false;
+	      }
+	    }
+	    catch (Notify n) {
+	      cerr << "Error while dumping " << contigI->getContigName() << " for strain " << strainfilename << ".\n";
+	      n.handleError(THISFUNC);
+	    }
+	  }
+	}
       }
     }
-    catch (Notify n) {
-      cerr << "Error while dumping " << outcon.getContigName() << " for strain " << strainfilename << ".\n";
-      n.handleError(THISFUNC);
-    }
+
+    FUNCEND();
   }
-}
+  
 
 
 
@@ -2739,78 +2312,78 @@ void assout::saveStrainsAsFASTAQ(Contig & outcon, const ReadPool & rp, const str
  *
  *************************************************************************/
 
-void assout::saveStrainsAsGBF(list<Contig> & clist, const ReadPool & rp, const string & gbfbasename, base_quality_t minqual, bool fillholesinstraingenomes, bool deleteoldfile)
-{
-  // Save contigs first, then singlets
-  for(uint32 savewhat=0; savewhat<2; savewhat++){
-    for(auto & cle : clist){
-      bool saveme=false;
-      if(savewhat==0 && cle.getNumReadsInContig()>1) saveme=true;
-      if(savewhat==1 && cle.getNumReadsInContig()==1) saveme=true;
-      if(saveme){
-	string consseq;
-	vector<base_quality_t> consqual;
-	vector<string> strain_consseq;
-	vector< vector<base_quality_t> > strain_consqual;
-	strainid2name_t strainnames_in_contig;
-
-	makeAllStrainGenomes(cle,
-			     minqual,
-			     consseq,
-			     consqual,
-			     strain_consseq,
-			     strain_consqual,
-			     strainnames_in_contig,
-			     false,
-			     false);
-
-	if(!fillholesinstraingenomes){
-	  consseq.clear();
-	  consqual.clear();
-	}
-
-	// we will look at all GBF features (empty allowed)
-	vector<multitag_t::mte_id_t> allowedfeatures;
-	// but not at Fsrc and Fgen
-	vector<multitag_t::mte_id_t> forbiddenfeatures;
-	forbiddenfeatures.push_back(Read::REA_tagentry_idSOFAdatabank_entry);
-
-	// copy first all Genbank features of all reads into one big vector
-	//  (makes the search loop afterwards easier)
+  void saveStrainsAsGBF(list<Contig> & clist, const ReadPool & rp, const string & gbfbasename, base_quality_t minqual, bool fillholesinstraingenomes, bool deleteoldfile)
+  {
+    // Save contigs first, then singlets
+    for(uint32 savewhat=0; savewhat<2; savewhat++){
+      list<Contig>::iterator contigI=clist.begin();
+      for(;contigI!=clist.end(); contigI++){
+	bool saveme=false;
+	if(savewhat==0 && contigI->getNumReadsInContig()>1) saveme=true;
+	if(savewhat==1 && contigI->getNumReadsInContig()==1) saveme=true;
+	if(saveme){
+	  string consseq;
+	  vector<base_quality_t> consqual;
+	  vector<string> strain_consseq;
+	  vector< vector<base_quality_t> > strain_consqual;
+	  strainid2name_t strainnames_in_contig;
+	  
+	  makeAllStrainGenomes(*contigI,
+			       minqual,
+			       consseq,
+			       consqual,
+			       strain_consseq,
+			       strain_consqual,
+			       strainnames_in_contig,
+			       false);
+	  
+	  if(!fillholesinstraingenomes){
+	    consseq.clear();
+	    consqual.clear();
+	  }
 
-	list<gbfsummary_t> allGBfeatures;
-	cle.getGBFSummary(allGBfeatures,
-			  allowedfeatures,
-			  forbiddenfeatures,
-			  false,
-			  true);
-
-	//// dump contigs only for strains that are in this contig
-
-	for(auto & snic : strainnames_in_contig){
-	  int32 actstrainid=snic.first;
-	  CEBUGNPQ("Strainid: " << actstrainid << "\tStrainname:" << snic.second << endl);
-
-	  ofstream gbfout;
-	  openFileForAppend((gbfbasename+"_"+ReadGroupLib::getStrainOfStrainID(actstrainid)+".gbf").c_str(),
-			    gbfout,
-			    deleteoldfile);
-
-	  // beware! strain_consseq[actstrainid] will be different after call
-	  dumpSequenceAsGBF_priv(cle.getContigName(),
-				 snic.second,
-				 strain_consseq[actstrainid],
-				 consseq,
-				 allGBfeatures,
-				 gbfout);
-
-	  gbfout.close();
+	  // we will look at all GBF features (empty allowed)
+	  vector<multitag_t::mte_id_t> allowedfeatures;
+	  // but not at Fsrc and Fgen
+	  vector<multitag_t::mte_id_t> forbiddenfeatures;
+	  forbiddenfeatures.push_back(Read::REA_tagentry_idFsrc);
+	  
+	  // copy first all Genbank features of all reads into one big vector
+	  //  (makes the search loop afterwards easier)
+	  
+	  list<gbfsummary_t> allGBfeatures;
+	  contigI->getGBFSummary(allGBfeatures,
+				 allowedfeatures,
+				 forbiddenfeatures,
+				 false);
+	  
+	  //// dump contigs only for strains that are in this contig
+	  
+	  strainid2name_t::const_iterator SIC=strainnames_in_contig.begin();
+	  for(; SIC!= strainnames_in_contig.end(); SIC++){
+	    int32 actstrainid=SIC->first;
+	    CEBUGNPQ("Strainid: " << actstrainid << "\tStrainname:" << SIC->second << endl);
+	    
+	    ofstream gbfout;
+	    openFileForAppend((gbfbasename+"_"+rp.getStrainOfStrainID(actstrainid)+".gbf").c_str(), 
+			      gbfout,
+			      deleteoldfile);
+	    
+	    // beware! strain_consseq[actstrainid] will be different after call
+	    dumpSequenceAsGBF_priv(contigI->getContigName(),
+				   SIC->second,
+				   strain_consseq[actstrainid],
+				   consseq,
+				   allGBfeatures,
+				   gbfout);
+	    
+	    gbfout.close();
+	  }
 	}
       }
     }
-  }
 
-}
+  }
 
 
 /*************************************************************************
@@ -2823,159 +2396,158 @@ void assout::saveStrainsAsGBF(list<Contig> & clist, const ReadPool & rp, const s
 
 //#define CEBUG(bla)  {cout << bla; cout.flush();}
 
-void assout::dumpSequenceAsGBF_priv(const string & seqname, const string & strainname, string & seq, const string & consseq, const list<gbfsummary_t> & allGBfeatures, ostream & fout)
-{
-  // position mapping of consensus: padded (in memory) vs unpadded
-  // positions with a * get position of last non-* assigned
-  uint32 actdepadpos=0;
-  vector<uint32> depadposmap;
-  depadposmap.resize(seq.size(),0);
-  for(uint32 seqi=0; seqi < seq.size();++seqi){
-    depadposmap[seqi]=actdepadpos;
-    if(seq[seqi]!='*') ++actdepadpos;
-  }
-
-  CEBUGF("depadposmap.size(): " << depadposmap.size() << endl);
-
-  fout << "LOCUS       ";
-  // dummy
-  fout.width(16);
-  fout << left << seqname << "  ";
-  fout << actdepadpos << " bp    DNA     ENV    ";
-
+  void dumpSequenceAsGBF_priv(const string & seqname, const string & strainname, string & seq, const string & consseq, const list<gbfsummary_t> & allGBfeatures, ostream & fout)
   {
-    char timestr[80];
-    struct tm *timepoint;
-    time_t t;
+    // position mapping of consensus: padded (in memory) vs unpadded
+    // positions with a * get position of last non-* assigned
+    uint32 actdepadpos=0;
+    vector<uint32> depadposmap;
+    depadposmap.resize(seq.size(),0);
+    for(uint32 seqi=0; seqi < seq.size();seqi++){
+      depadposmap[seqi]=actdepadpos;
+      char actbase=static_cast<char>(tolower(seq[seqi]));
+      if((actbase=='n' || actbase=='@') && !consseq.empty()) actbase=static_cast<char>(toupper(consseq[seqi]));
+      seq[seqi]=actbase;
+      if(actbase!='*') actdepadpos++;
+    }
 
-    time(&t);
-    timepoint=localtime(&t);
+    CEBUGF("depadposmap.size(): " << depadposmap.size() << endl);
 
-    strftime(&timestr[0],60,"%d-%b-%Y",timepoint);
+    fout << "LOCUS       ";
+    // dummy
+    fout.width(16);
+    fout << left << seqname << "  ";
+    fout << actdepadpos << " bp    DNA     ENV    ";
 
-    fout << timestr << "\n";
-  }
+    {
+      char timestr[80];
+      struct tm *timepoint;
+      time_t t;
 
-  fout << "SOURCE      " <<
-    "DNA, strain: "<< strainname <<
-    "\nACCESSION   " << seqname <<
-    "\nCOMMENT     Generated by the MIRA assembler\n"
-    "FEATURES             Location/Qualifiers\n"
-    "     source          1.." << actdepadpos << endl <<
-    "                     /strain=\"" << strainname << "\"\n";
+      time(&t);
+      timepoint=localtime(&t);
 
-  for(auto & gbkf : allGBfeatures){
-    CEBUGF("\n" << gbkf.locustag << "\t" << gbkf.cfrom << "\t" << gbkf.cto << "\t");
-    if(gbkf.cfrom >= depadposmap.size() || gbkf.cto >= depadposmap.size()) continue;
+      strftime(&timestr[0],60,"%d-%b-%Y",timepoint);
+	
+      fout << timestr << "\n";
+    }
 
-    const string & gbfstring=AnnotationMappings::translateSOfeat2GenBankfeat(gbkf.identifier);
-    if(gbfstring.empty()) continue;
+    fout << "SOURCE      " <<
+      "DNA, strain: "<< strainname <<
+      "\nACCESSION   " << seqname << 
+      "\nCOMMENT     Generated by the MIRA assembler\n"
+      "FEATURES             Location/Qualifiers\n"
+      "     source          1.." << actdepadpos << endl <<
+      "                     /strain=\"" << strainname << "\"\n";
+
+    list<gbfsummary_t>::const_iterator F=allGBfeatures.begin();
+    for(; F!=allGBfeatures.end(); F++){
+      CEBUGF("\n" << F->locustag << "\t" << F->cfrom << "\t" << F->cto << "\t");
+      if(F->cfrom >= depadposmap.size() || F->cto >= depadposmap.size()) continue;
+
+      fout << "     ";
+      fout.width(16);
+
+      fout << left << GBF::translateGAP4GBFfeat2GBFfeat(F->identifier);
+      CEBUGF("0");
+      if(F->direction >=0) {
+	fout << depadposmap[F->cfrom]+1 << ".." << depadposmap[F->cto]+1 << "\n";
+      }else{
+	fout << "complement(" << depadposmap[F->cfrom]+1 << ".." << depadposmap[F->cto]+1 << ")\n";
+      }
 
-    fout << "     ";
-    fout.width(16);
+      CEBUGF("1");
 
-    fout << left << gbfstring;
-    CEBUGF("0");
-    if(gbkf.direction >=0) {
-      fout << depadposmap[gbkf.cfrom]+1 << ".." << depadposmap[gbkf.cto]+1 << "\n";
-    }else{
-      fout << "complement(" << depadposmap[gbkf.cfrom]+1 << ".." << depadposmap[gbkf.cto]+1 << ")\n";
-    }
-
-    CEBUGF("1");
-
-    if(!gbkf.gene.empty()){
-      dumpTextAsGBFValueLine_priv("/gene",gbkf.gene,fout);
-    }
-    if(!gbkf.locustag.empty()){
-      dumpTextAsGBFValueLine_priv("/locus_tag",gbkf.locustag,fout);
-    }
-    if(!gbkf.function.empty()){
-      dumpTextAsGBFValueLine_priv("/function",gbkf.function,fout);
-    }
-    if(!gbkf.ecnumber.empty()){
-      dumpTextAsGBFValueLine_priv("/EC_number",gbkf.ecnumber,fout);
-    }
-    CEBUGF("3");
-    if(!gbkf.product.empty()){
-      dumpTextAsGBFValueLine_priv("/product",gbkf.product,fout);
-    }
-    CEBUGF("4");
-    if(!gbkf.note.empty()){
-      dumpTextAsGBFValueLine_priv("/note",gbkf.note,fout);
-    }
-    CEBUGF("5");
-    if(gbkf.mustbetranslated){
-      // dump translation
-      string featureprot;
-      string featuredna;
-      if(gbkf.direction >=0) {
-	dptools::dnaToProtein(seq,
-			      featureprot,
-			      featuredna,
-			      gbkf.cfrom,
-			      gbkf.cfrom,
-			      1,
-			      gbkf.translationtable,
-			      gbkf.codonstart,
-			      gbkf.mustbetranslated);
-      }else{
-	dptools::dnaToProtein(seq,
-			      featureprot,
-			      featuredna,
-			      gbkf.cto,
-			      gbkf.cto,
-			      -1,
-			      gbkf.translationtable,
-			      gbkf.codonstart,
-			      gbkf.mustbetranslated);
+      if(!F->gene.empty()){
+	dumpTextAsGBFValueLine_priv("/gene",F->gene,fout);
+      }
+      if(!F->locustag.empty()){
+	dumpTextAsGBFValueLine_priv("/locus_tag",F->locustag,fout);
       }
-      CEBUGF("6");
-      if(!featureprot.empty()){
-	// dnaToProtein includes the * stop codon, remove that before output
-	featureprot.resize(featureprot.size()-1);
-	dumpTextAsGBFValueLine_priv("/translation",featureprot,fout);
+      if(!F->function.empty()){
+	dumpTextAsGBFValueLine_priv("/function",F->function,fout);
+      }
+      if(!F->ecnumber.empty()){
+	dumpTextAsGBFValueLine_priv("/EC_number",F->ecnumber,fout);
+      }
+      CEBUGF("3");
+      if(!F->product.empty()){
+	dumpTextAsGBFValueLine_priv("/product",F->product,fout);
+      }
+      CEBUGF("4");
+      if(!F->note.empty()){
+	dumpTextAsGBFValueLine_priv("/note",F->note,fout);
+      }
+      CEBUGF("5");
+      if(F->mustbetranslated){
+	// dump translation
+	string featureprot;
+	string featuredna;
+	if(F->direction >=0) {
+	  dptools::dnaToProtein(seq,
+				featureprot,
+				featuredna,
+				F->cfrom,
+				F->cfrom,
+				1,
+				F->translationtable,
+				F->codonstart);
+	}else{
+	  dptools::dnaToProtein(seq,
+				featureprot,
+				featuredna,
+				F->cto,
+				F->cto,
+				-1,
+				F->translationtable,
+				F->codonstart);
+	}
+	CEBUGF("6");
+	if(!featureprot.empty()){
+	  // dnaToProtein includes the * stop codon, remove that before output
+	  featureprot.resize(featureprot.size()-1);
+	  dumpTextAsGBFValueLine_priv("/translation",featureprot,fout);
+	}
+	CEBUGF("7");
       }
-      CEBUGF("7");
     }
-  }
 
-  fout << "ORIGIN\n";
-
-  uint8 posinline=0;
-  uint32 depadpos=1;
-  bool isnewline=true;
-  bool addspace=false;
-  for(uint32 seqi=0; seqi<seq.size(); ++seqi){
-    if(isnewline) {
-      isnewline=false;
-      fout.width(9);
-      fout << right << depadpos;
-    }
-    if(posinline%10 == 0){
-      addspace=true;
-    }
-    if(seq[seqi]!='*'){
-      if(addspace) {
-	addspace=false;
-	fout << " ";
+    fout << "ORIGIN\n";
+
+    uint8 posinline=0;
+    uint32 depadpos=1;
+    bool isnewline=true;
+    bool addspace=false;
+    for(uint32 seqi=0; seqi<seq.size(); seqi++){
+      if(isnewline) {
+	isnewline=false;
+	fout.width(9);
+	fout << right << depadpos;
       }
-      fout << seq[seqi];
-      ++depadpos;
-      ++posinline;
-      if(posinline==60) {
-	fout << "\n";
-	posinline=0;
-	isnewline=true;
+      if(posinline%10 == 0){
+	addspace=true;
+      }
+      if(seq[seqi]!='*'){
+	if(addspace) {
+	  addspace=false;
+	  fout << " ";
+	}
+	fout << seq[seqi];
+	depadpos++;
+	posinline++;
+	if(posinline==60) {
+	  fout << "\n";
+	  posinline=0;
+	  isnewline=true;
+	}
       }
     }
-  }
-  if(!isnewline){
-    fout << "\n";
-  }
-  fout << "//\n";
+    if(!isnewline){
+      fout << "\n";
+    }
+    fout << "//\n";
 
-}
+  }
 
 //#define CEBUGF(bla)
 
@@ -2986,82 +2558,82 @@ void assout::dumpSequenceAsGBF_priv(const string & seqname, const string & strai
  *
  *
  *************************************************************************/
-void assout::dumpTextAsGBFValueLine_priv(const string & key, const string & value, ostream & fout)
-{
-  //fout << "                     /gene=\"" << fI->gene << "\"\n";
+  void dumpTextAsGBFValueLine_priv(const string & key, const string & value, ostream & fout)
+  {
+    //fout << "                     /gene=\"" << F->gene << "\"\n";
 
-  fout << "                     " << key << "=\"";
-  //fout << value;
+    fout << "                     " << key << "=\"";
+    //fout << value;
 
-  fout.flush();
+    fout.flush();
 
-  string::size_type posinline=21+key.size()+2;
+    string::size_type posinline=21+key.size()+2;
 
-  string::size_type fpos=0;
-  string::size_type tpos=0;
+    string::size_type fpos=0;
+    string::size_type tpos=0;
 
-  bool firstwordinline=true;
+    bool firstwordinline=true;
 
-  int32 runawaystop=100000;
+    int32 runawaystop=100000;
 
-  // print out "words" until the end of the string
-  while(fpos<value.size()){
+    // print out "words" until the end of the string
+    while(fpos<value.size()){
 
-    if(--runawaystop==0) {
-      cout << "Abort: runawaystop\n";
-      exit(1);
-    }
+      if(--runawaystop==0) {
+	cout << "Abort: runawaystop\n";
+	exit(1);
+      }
 
-    bool splitit=false;
-    bool onnextline=false;
+      bool splitit=false;
+      bool onnextline=false;
 
-    // find next space (or end of string)
-    tpos=value.find(" ",fpos);
-    if(tpos==string::npos){
-      tpos=value.size();
-    }
+      // find next space (or end of string)
+      tpos=value.find(" ",fpos);
+      if(tpos==string::npos){
+	tpos=value.size();
+      }
 
-    string::size_type spaceneeded=tpos-fpos;
-    if(!firstwordinline) spaceneeded++;
+      string::size_type spaceneeded=tpos-fpos;
+      if(!firstwordinline) spaceneeded++;
 
-    // see whether there is enough place remaining in the line
-    //  (careful for space when not firstword??)
-    if(posinline+spaceneeded > 79) onnextline=true;
+      // see whether there is enough place remaining in the line
+      //  (careful for space when not firstword??)
+      if(posinline+spaceneeded > 79) onnextline=true;
 
-    // max 58 chars in one line, if greater, we�ll have to split anyways
-    if(spaceneeded > 58) splitit=true;
+      // max 58 chars in one line, if greater, we�ll have to split anyways
+      if(spaceneeded > 58) splitit=true;
 
-    if(splitit) {
-      for(; fpos<value.size() && posinline<79; fpos++,posinline++) {
-	fout << static_cast<char>(value[fpos]);
-      }
-      if(posinline==79){
-	fout << "\n                     ";
-	posinline=21;
-	firstwordinline=true;
-      }
-    } else {
-      if (onnextline) {
-	fout << "\n                     ";
-	posinline=21;
-	firstwordinline=true;
-      }
-      // there is enough place for this word, simply print it
-      if(!firstwordinline) {
-	fout << " ";
-	posinline++;
+      if(splitit) {
+	for(; fpos<value.size() && posinline<79; fpos++,posinline++) {
+	  fout << static_cast<char>(value[fpos]);
+	}
+	if(posinline==79){
+	  fout << "\n                     ";
+	  posinline=21;
+	  firstwordinline=true;
+	}
+      } else {
+	if (onnextline) {
+	  fout << "\n                     ";
+	  posinline=21;
+	  firstwordinline=true;
+	}
+	// there is enough place for this word, simply print it
+	if(!firstwordinline) {
+	  fout << " ";
+	  posinline++;
+	}
+	fout << value.substr(fpos, tpos-fpos);
+	posinline+=tpos-fpos;
+	fpos+=tpos-fpos+1;  // NOT spaceneeded, +1 to jump over space
+	firstwordinline=false;
       }
-      fout << value.substr(fpos, tpos-fpos);
-      posinline+=tpos-fpos;
-      fpos+=tpos-fpos+1;  // NOT spaceneeded, +1 to jump over space
-      firstwordinline=false;
+
     }
+    if(posinline>=79) fout << "\n                     ";
 
+    fout << "\"\n";
   }
-  if(posinline>=79) fout << "\n                     ";
-
-  fout << "\"\n";
-}
 
 
 
@@ -3072,27 +2644,28 @@ void assout::dumpTextAsGBFValueLine_priv(const string & key, const string & valu
  *
  *************************************************************************/
 
-void assout::dumpContigs(list<Contig> & clist, ostream & fout)
-{
-  FUNCSTART("void dumpContigs(list<Contig> & clist, ostream & fout)");
-  for(uint32 savewhat=0; savewhat<2; savewhat++){
-    for(auto & cle : clist){
-      bool saveme=false;
-      if(savewhat==0 && cle.getNumReadsInContig()>1) saveme=true;
-      if(savewhat==1 && cle.getNumReadsInContig()==1) saveme=true;
-      try{
-	if(saveme) {
-	  fout << cle;
+  void dumpContigs(list<Contig> & clist, ostream & fout)
+  {
+    FUNCSTART("void dumpContigs(list<Contig> & clist, ostream & fout)");
+    for(uint32 savewhat=0; savewhat<2; savewhat++){
+      list<Contig>::iterator contigI=clist.begin();
+      for(;contigI!=clist.end(); contigI++){
+	bool saveme=false;
+	if(savewhat==0 && contigI->getNumReadsInContig()>1) saveme=true;
+	if(savewhat==1 && contigI->getNumReadsInContig()==1) saveme=true;
+	try{
+	  if(saveme) {
+	    fout << *contigI;
+	  }
+	}
+	catch (Notify n) {
+	  cerr << "Error while dumping " << contigI->getContigName() << ".\n";
+	  n.handleError(THISFUNC);
 	}
-      }
-      catch (Notify n) {
-	cerr << "Error while dumping " << cle.getContigName() << ".\n";
-	n.handleError(THISFUNC);
       }
     }
+    FUNCEND();
   }
-  FUNCEND();
-}
 
 
 /*************************************************************************
@@ -3102,54 +2675,52 @@ void assout::dumpContigs(list<Contig> & clist, ostream & fout)
  *
  *************************************************************************/
 
-void assout::saveAs_TYPE(list<Contig> & clist, const string & filename, const uint8 type, bool deleteoldfile)
-{
-  FUNCSTART("void saveAs_TYPE(list<Contig> & clist, const string & filename, const uint8 type, bool deleteoldfile)");
+  void saveAs_TYPE(list<Contig> & clist, const string & filename, const uint8 type, bool deleteoldfile)
+  {
+    FUNCSTART("void saveAs_TYPE(list<Contig> & clist, const string & filename, const uint8 type, bool deleteoldfile)");
+
+    ofstream fout;
 
-  ofstream fout;
+    // nope, this doesn't speed up simple output
+    //
+    // char mybuf[1024*1024];
+    // fout.rdbuf()->pubsetbuf(mybuf,1024*1024);
 
-  // nope, this doesn't speed up simple output
-  //
-  // char mybuf[1024*1024];
-  // fout.rdbuf()->pubsetbuf(mybuf,1024*1024);
+    if(!openFileForAppend(filename,fout, deleteoldfile)){
+      if(type==Contig::AS_TCS) Contig::dumpTCS_Head(fout);
+    }
+    Contig::setCoutType(type);
+    dumpContigs(clist,fout);
+    fout.close();
 
-  if(!openFileForAppend(filename,fout, deleteoldfile)){
-    if(type==Contig::AS_TCS) Contig::dumpTCS_Head(fout);
-    if(type==Contig::AS_MAF) Contig::dumpMAF_Head(fout);
+    FUNCEND();
   }
-  Contig::setCoutType(type);
-  dumpContigs(clist,fout);
-  fout.close();
+  void saveAs_TYPE(Contig & con, const string & filename, const uint8 type, bool deleteoldfile)
+  {
+    FUNCSTART("void saveAs_TYPE(Contig & con, const string & filename, const uint8 type)");
 
-  FUNCEND();
-}
-void assout::saveAs_TYPE(Contig & con, const string & filename, const uint8 type, bool deleteoldfile)
-{
-  FUNCSTART("void saveAs_TYPE(Contig & con, const string & filename, const uint8 type)");
+    ofstream fout;
 
-  ofstream fout;
+    // nope, this doesn't speed up simple output
+    //
+    // char mybuf[1024*1024];
+    // fout.rdbuf()->pubsetbuf(mybuf,1024*1024);
 
-  // nope, this doesn't speed up simple output
-  //
-  // char mybuf[1024*1024];
-  // fout.rdbuf()->pubsetbuf(mybuf,1024*1024);
+    if(!openFileForAppend(filename,fout, deleteoldfile)){
+      if(type==Contig::AS_TCS) Contig::dumpTCS_Head(fout);
+    }
+    Contig::setCoutType(type);
+    try{
+      fout << con;
+    }
+    catch (Notify n) {
+      cerr << "Error while dumping " << con.getContigName() << ".\n";
+      n.handleError(THISFUNC);
+    }
+    fout.close();
 
-  if(!openFileForAppend(filename,fout, deleteoldfile)){
-    if(type==Contig::AS_TCS) Contig::dumpTCS_Head(fout);
-    if(type==Contig::AS_MAF) Contig::dumpMAF_Head(fout);
-  }
-  Contig::setCoutType(type);
-  try{
-    fout << con;
-  }
-  catch (Notify n) {
-    cerr << "Error while dumping " << con.getContigName() << ".\n";
-    n.handleError(THISFUNC);
+    FUNCEND();
   }
-  fout.close();
-
-  FUNCEND();
-}
 
 
 
@@ -3160,24 +2731,26 @@ void assout::saveAs_TYPE(Contig & con, const string & filename, const uint8 type
  *
  *************************************************************************/
 
-void assout::dumpAsACE(list<Contig> & clist, ostream & aceout)
-{
-  FUNCSTART("void dumpAsACE(list<Contig> & clist, ostream & aceout)");
-
-  aceout << "AS " << clist.size();
+  void dumpAsACE(list<Contig> & clist, ostream & aceout)
   {
-    uint32 sum=0;
-    for(auto & cle : clist){
-      sum+=cle.getNumReadsInContig();
+    FUNCSTART("void dumpAsACE(list<Contig> & clist, ostream & aceout)");
+
+    aceout << "AS " << clist.size();
+    {
+      uint32 sum=0;
+      list<Contig>::iterator contigI=clist.begin();
+      while(contigI!=clist.end()){
+	sum+=contigI->getNumReadsInContig();
+	contigI++;
+      }
+      aceout << " " << sum << endl << endl;
     }
-    aceout << " " << sum << endl << endl;
-  }
 
-  Contig::setCoutType(Contig::AS_ACE);
-  dumpContigs(clist, aceout);
+    Contig::setCoutType(Contig::AS_ACE);
+    dumpContigs(clist, aceout);
 
-  FUNCEND();
-}
+    FUNCEND();
+  }
 
 
 /*************************************************************************
@@ -3187,110 +2760,114 @@ void assout::dumpAsACE(list<Contig> & clist, ostream & aceout)
  *
  *************************************************************************/
 
-void assout::saveAsACE(list<Contig> & clist, const string & filename, bool deleteoldfile)
-{
-  //declare a new file object for appending and overwriting
-  fstream fio;
-
-  uint32 oldnumcontigs=0;
-  uint32 oldnumreads=0;
-  saveAsACE_openACE(fio,
-		    filename,
-		    deleteoldfile,
-		    oldnumcontigs,
-		    oldnumreads);
-
-  Contig::setCoutType(Contig::AS_ACE);
-  dumpContigs(clist, fio);
-
-  uint32 newnumreads=oldnumreads;
-  for(auto & cle : clist){
-    newnumreads+=cle.getNumReadsInContig();
-  }
+  void saveAsACE(list<Contig> & clist, const string & filename, bool deleteoldfile)
+  {
+    //declare a new file object for appending and overwriting
+    fstream fio;
+
+    uint32 oldnumcontigs=0;
+    uint32 oldnumreads=0;
+    saveAsACE_openACE(fio, 
+		      filename,
+		      deleteoldfile,
+		      oldnumcontigs, 
+		      oldnumreads);
+
+    Contig::setCoutType(Contig::AS_ACE);
+    dumpContigs(clist, fio);
+    
+    uint32 newnumreads=oldnumreads;
+    {
+      list<Contig>::iterator contigI=clist.begin();
+      while(contigI!=clist.end()){
+	newnumreads+=contigI->getNumReadsInContig();
+	contigI++;
+      }
+    }
 
-  saveAsACE_rewriteHeader(fio,
-			  oldnumcontigs+static_cast<uint32>(clist.size()),
-			  newnumreads);
+    saveAsACE_rewriteHeader(fio, 
+			    oldnumcontigs+static_cast<uint32>(clist.size()),
+			    newnumreads);
 
-  fio.close();
-}
+    fio.close();
+  }
 
-void assout::saveAsACE(Contig & con, const string & filename, bool deleteoldfile)
-{
-  FUNCSTART("void saveAsACE(Contig & con, const string & filename, bool deleteoldfile)");
+  void saveAsACE(Contig & con, const string & filename, bool deleteoldfile)
+  {
+    FUNCSTART("void saveAsACE(Contig & con, const string & filename, bool deleteoldfile)");
 
-  //declare a new file object for appending and overwriting
-  fstream fio;
+    //declare a new file object for appending and overwriting
+    fstream fio;
 
-  uint32 oldnumcontigs=0;
-  uint32 oldnumreads=0;
+    uint32 oldnumcontigs=0;
+    uint32 oldnumreads=0;
 
-  saveAsACE_openACE(fio,
-		    filename,
-		    deleteoldfile,
-		    oldnumcontigs,
-		    oldnumreads);
-  Contig::setCoutType(Contig::AS_ACE);
-  try{
-    fio << con;
-  }
-  catch (Notify n) {
-    cerr << "Error while dumping " << con.getContigName() << ".\n";
-    n.handleError(THISFUNC);
+    saveAsACE_openACE(fio, 
+		      filename,
+		      deleteoldfile,
+		      oldnumcontigs,
+		      oldnumreads);
+    Contig::setCoutType(Contig::AS_ACE);
+    try{
+      fio << con;
+    }
+    catch (Notify n) {
+      cerr << "Error while dumping " << con.getContigName() << ".\n";
+      n.handleError(THISFUNC);
+    }
+    saveAsACE_rewriteHeader(fio,
+			    oldnumcontigs+1,
+			    oldnumreads+con.getNumReadsInContig());
+    fio.close();
+    FUNCEND();
   }
-  saveAsACE_rewriteHeader(fio,
-			  oldnumcontigs+1,
-			  oldnumreads+con.getNumReadsInContig());
-  fio.close();
-  FUNCEND();
-}
 
-void assout::saveAsACE_openACE(fstream & fio, const string & filename, bool deleteoldfile, uint32 & numcontigs, uint32 & numreads)
-{
-  FUNCSTART("void saveAsACE_openACE(fstream & fio, const string & filename, uint32 & numcontigs, uint32 & numreads)");
+  void saveAsACE_openACE(fstream & fio, const string & filename, bool deleteoldfile, uint32 & numcontigs, uint32 & numreads)
+  {
+    FUNCSTART("void saveAsACE_openACE(fstream & fio, const string & filename, uint32 & numcontigs, uint32 & numreads)");
+
+    numcontigs=0;
+    numreads=0;
+
+    struct stat st;
+    if(deleteoldfile || stat(filename.c_str(),&st)) {
+      // oh, new file
+      fio.open(filename.c_str(), ios::out | ios::in | ios::trunc);
+      // write a long empty line to reserve space for header
+      fio << "                                                                                                                                                                           \n\n";
+      return;
+    }
+    fio.open(filename.c_str(), ios::ate | ios::out | ios::in);
 
-  numcontigs=0;
-  numreads=0;
+    long fiosize = fio.tellp();
+    fio.seekp(0);
 
-  struct stat st;
-  if(deleteoldfile || stat(filename.c_str(),&st)) {
-    // oh, new file
-    fio.open(filename.c_str(), ios::out | ios::in | ios::trunc);
-    // write a long empty line to reserve space for header
-    fio << "                                                                                                                                                                           \n\n";
-    return;
+    string dummy;
+    if(fio.eof()){ 
+      MIRANOTIFY(Notify::INTERNAL, "the ace file is present but seems to be empty: " << filename);
+    }
+    getline(fio,dummy);
+    if(dummy.size()<50){
+      MIRANOTIFY(Notify::INTERNAL, "first line is too short for rewriting: " << filename);
+    }
+    fio.seekp(0);
+    fio >> dummy >> numcontigs >> numreads;
+    fio.seekp(fiosize);
   }
-  fio.open(filename.c_str(), ios::ate | ios::out | ios::in);
 
-  long fiosize = fio.tellp();
-  fio.seekp(0);
+  void saveAsACE_rewriteHeader(fstream & fio, const uint32 numcontigs, const uint32 numreads)
+  {
+    fio.seekp(0);
+    //fio << "AS " << numcontigs << ' ' << numreads << 
+    //  "                                                  ";
 
-  string dummy;
-  if(fio.eof()){
-    MIRANOTIFY(Notify::INTERNAL, "the ace file is present but seems to be empty: " << filename);
-  }
-  getline(fio,dummy);
-  if(dummy.size()<50){
-    MIRANOTIFY(Notify::INTERNAL, "first line is too short for rewriting: " << filename);
+    string tmp="AS ";
+    tmp+=boost::lexical_cast<string>(numcontigs);
+    tmp+=" ";
+    tmp+=boost::lexical_cast<string>(numreads);
+    while(tmp.size()<50) tmp+=" ";
+    fio << tmp;
   }
-  fio.seekp(0);
-  fio >> dummy >> numcontigs >> numreads;
-  fio.seekp(fiosize);
-}
-
-void assout::saveAsACE_rewriteHeader(fstream & fio, const uint32 numcontigs, const uint32 numreads)
-{
-  fio.seekp(0);
-  //fio << "AS " << numcontigs << ' ' << numreads <<
-  //  "                                                  ";
-
-  string tmp="AS ";
-  tmp+=boost::lexical_cast<string>(numcontigs);
-  tmp+=" ";
-  tmp+=boost::lexical_cast<string>(numreads);
-  while(tmp.size()<50) tmp+=" ";
-  fio << tmp;
-}
 
 /*************************************************************************
  *
@@ -3299,61 +2876,62 @@ void assout::saveAsACE_rewriteHeader(fstream & fio, const uint32 numcontigs, con
  *
  *************************************************************************/
 
-void assout::saveAsGAP4DA(list<Contig> & clist, const string & dirname, bool deleteolddir)
-{
-  FUNCSTART("void saveAsGAP4DA(list<Contig> & clist, const string & dirname)");
+  void saveAsGAP4DA(list<Contig> & clist, const string & dirname, bool deleteolddir)
+  {
+    FUNCSTART("void saveAsGAP4DA(list<Contig> & clist, const string & dirname)");
 
-  if(ensureDirectory(dirname, deleteolddir)){
-    MIRANOTIFY(Notify::FATAL, "Could not make sure that directory '" << dirname << "' exists, aborting MIRA.");
-  }
+    if(ensureDirectory(dirname, deleteolddir)){
+      MIRANOTIFY(Notify::FATAL, "Could not make sure that directory '" << dirname << "' exists, aborting MIRA.");
+    }
 
-  Contig::setCoutType(Contig::AS_GAP4DA);
-  ofstream fofnout((dirname+"/fofn").c_str(), ios::out | ios::app);
+    Contig::setCoutType(Contig::AS_GAP4DA);
+    ofstream fofnout((dirname+"/fofn").c_str(), ios::out | ios::app);
 
-  for(uint32 savewhat=0; savewhat<2; savewhat++){
-    for(auto & cle : clist){
-      bool saveme=false;
-      if(savewhat==0 && cle.getNumReadsInContig()>1) saveme=true;
-      if(savewhat==1 && cle.getNumReadsInContig()==1) saveme=true;
-      if(saveme){
-	try{
-	  cle.saveAsGAP4DA(dirname, fofnout);
-	}
-	catch (Notify n) {
-	  cerr << "Error while dumping " << cle.getContigName() << ".\n";
-	  n.handleError(THISFUNC);
+    for(uint32 savewhat=0; savewhat<2; savewhat++){
+      list<Contig>::iterator contigI=clist.begin();
+      for(;contigI!=clist.end();contigI++){
+	bool saveme=false;
+	if(savewhat==0 && contigI->getNumReadsInContig()>1) saveme=true;
+	if(savewhat==1 && contigI->getNumReadsInContig()==1) saveme=true;
+	if(saveme){
+	  try{
+	    contigI->saveAsGAP4DA(dirname, fofnout);
+	  }
+	  catch (Notify n) {
+	    cerr << "Error while dumping " << contigI->getContigName() << ".\n";
+	    n.handleError(THISFUNC);
+	  }
 	}
       }
     }
+    fofnout.close();
+
+    FUNCEND();
+    return;
   }
-  fofnout.close();
 
-  FUNCEND();
-  return;
-}
+  void saveAsGAP4DA(Contig & con, const string & dirname, bool deleteolddir)
+  {
+    FUNCSTART("void saveAsGAP4DA(Contig & con, const string & dirname)");
 
-void assout::saveAsGAP4DA(Contig & con, const string & dirname, bool deleteolddir)
-{
-  FUNCSTART("void saveAsGAP4DA(Contig & con, const string & dirname)");
+    if(ensureDirectory(dirname, deleteolddir)){
+      MIRANOTIFY(Notify::FATAL, "Could not make sure that directory '" << dirname << "' exists, aborting MIRA.");
+    }
 
-  if(ensureDirectory(dirname, deleteolddir)){
-    MIRANOTIFY(Notify::FATAL, "Could not make sure that directory '" << dirname << "' exists, aborting MIRA.");
-  }
+    Contig::setCoutType(Contig::AS_GAP4DA);
+    ofstream fofnout((dirname+"/fofn").c_str(), ios::out | ios::app);
+    try{
+      con.saveAsGAP4DA(dirname, fofnout);
+    }
+    catch (Notify n) {
+      cerr << "Error while dumping " << con.getContigName() << ".\n";
+      n.handleError(THISFUNC);
+    }
+    fofnout.close();
 
-  Contig::setCoutType(Contig::AS_GAP4DA);
-  ofstream fofnout((dirname+"/fofn").c_str(), ios::out | ios::app);
-  try{
-    con.saveAsGAP4DA(dirname, fofnout);
-  }
-  catch (Notify n) {
-    cerr << "Error while dumping " << con.getContigName() << ".\n";
-    n.handleError(THISFUNC);
+    FUNCEND();
+    return;
   }
-  fofnout.close();
-
-  FUNCEND();
-  return;
-}
 
 
 
@@ -3364,71 +2942,76 @@ void assout::saveAsGAP4DA(Contig & con, const string & dirname, bool deleteolddi
  *
  *************************************************************************/
 
-void assout::saveAsWiggle(list<Contig> & clist, const string & filename, bool deleteoldfile, bool gcinsteadcov)
-{
-  FUNCSTART("void saveAsWiggle(list<Contig> & clist, const string & filename, bool deleteoldfile)");
+  void saveAsWiggle(list<Contig> & clist, const string & filename, bool deleteoldfile)
+  {
+    FUNCSTART("void saveAsWiggle(list<Contig> & clist, const string & filename, bool deleteoldfile)");
+
+    ofstream fout;
+    openFileForAppend(filename,fout, deleteoldfile);
+    fout.close();
+
+    for(uint32 savewhat=0; savewhat<2; savewhat++){
+      list<Contig>::iterator contigI=clist.begin();
+      for(;contigI!=clist.end(); contigI++){
+	bool saveme=false;
+	if(savewhat==0 && contigI->getNumReadsInContig()>1) saveme=true;
+	if(savewhat==1 && contigI->getNumReadsInContig()==1) saveme=true;
+	try{
+	  if(saveme){
+	    saveAsWiggle(*contigI, filename, false);
+	  }
 
-  ofstream fout;
-  openFileForAppend(filename,fout, deleteoldfile);
-  fout.close();
 
-  for(uint32 savewhat=0; savewhat<2; savewhat++){
-    for(auto & cle : clist){
-      bool saveme=false;
-      if(savewhat==0 && cle.getNumReadsInContig()>1) saveme=true;
-      if(savewhat==1 && cle.getNumReadsInContig()==1) saveme=true;
-      try{
-	if(saveme){
-	  saveAsWiggle(cle, filename, false, gcinsteadcov);
 	}
-
-
-      }
-      catch (Notify n) {
-	cerr << "Error while dumping " << cle.getContigName() << ".\n";
-	n.handleError(THISFUNC);
+	catch (Notify n) {
+	  cerr << "Error while dumping " << contigI->getContigName() << ".\n";
+	  n.handleError(THISFUNC);
+	}
       }
     }
-  }
-
-  FUNCEND();
-}
-
-void assout::saveAsWiggle(Contig & con, const string & filename, bool deleteoldfile, bool gcinsteadcov)
-{
-  FUNCSTART("void saveAsWiggle(Contig & con, const string & filename, bool deleteoldfile)");
 
-  ofstream fout;
-  openFileForAppend(filename,fout, deleteoldfile);
-
-  try{
-    vector<int32> strainidsofbackbone;
-    con.getStrainsOfBackbone(strainidsofbackbone);
-    int32 bbstrainid=-1;
-    if(strainidsofbackbone.size()==1) bbstrainid=strainidsofbackbone.front();
+    FUNCEND();
+  }
 
-    string consseq;
-    vector<base_quality_t> dummy;
+  void saveAsWiggle(Contig & con, const string & filename, bool deleteoldfile)
+  {
+    FUNCSTART("void saveAsWiggle(Contig & con, const string & filename, bool deleteoldfile)");
+  
+    ofstream fout;
+    openFileForAppend(filename,fout, deleteoldfile);
 
-    con.calcConsensi();
-    con.newConsensusGet(consseq,
-			dummy,
-			bbstrainid);
+    try{
+      // we just want to know which strain has the GB features
+      vector<multitag_t::mte_id_t> allowedfeatures;
+      allowedfeatures.push_back(Read::REA_tagentry_idFsrc);
+      // but not at Fsrc
+      vector<multitag_t::mte_id_t> forbiddenfeatures;
+      
+      list<gbfsummary_t> allGBfeatures;
+      con.getGBFSummary(allGBfeatures,allowedfeatures,forbiddenfeatures, true);
+      
+      int32 featurestrainid=0;
+      if(!allGBfeatures.empty()) featurestrainid=allGBfeatures.front().strainid;
+      
+      string consseq;
+      vector<base_quality_t> dummy;
+      
+      con.calcConsensi();
+      con.newConsensusGet(consseq, 
+			  dummy, 
+			  featurestrainid);
+
+      con.dumpWiggle_Body(fout, consseq);
 
-    if(gcinsteadcov){
-      con.dumpGCWiggle_Body(fout, consseq);
-    }else{
-      con.dumpWiggle_Body(fout, consseq, true);
     }
+    catch (Notify n) {
+      cerr << "Error while saving " << con.getContigName() << " as wiggle.\n";
+      n.handleError(THISFUNC);
+    }
+    fout.close();
+  
+    FUNCEND();
   }
-  catch (Notify n) {
-    cerr << "Error while saving " << con.getContigName() << " as wiggle.\n";
-    n.handleError(THISFUNC);
-  }
-  fout.close();
-
-  FUNCEND();
-}
 
 
 
@@ -3439,59 +3022,59 @@ void assout::saveAsWiggle(Contig & con, const string & filename, bool deleteoldf
  *
  *************************************************************************/
 
-void assout::dumpHTMLHeader(const string & projectname, ostream & htmlout)
-{
-  htmlout << "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\">\n\
+  void dumpHTMLHeader(const string & projectname, ostream & htmlout)
+  {
+    htmlout << "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\">\n\
 <html>\n\
 <head>\n\
    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n\
    <meta name=\"GENERATOR\" content=\"MIRA (c) Bastien Chevreux & EdIt (c) Thomas Pfisterer;\">\n\
    <meta name=\"Author\" content=\"";
 
-  //char * logname= getenv("LOGNAME");
-  //htmlout << getlogin() << "\">\n
-
-  {
-    // REMARK:
-    // GCC 3.4 tells this
-    // : warning: Using 'getpwuid' in statically linked applications
-    //   requires at runtime the shared libraries from the glibc version
-    //   used for linking
-    //
-    //  This might also be the reason for a reported crash of
-    //   miraconvert on a 2.6 kernel (with another glibc than my
-    //   home machine
-    //
-    // Resolve: get back to getlogin() even if manual says it can be
-    //  easily "fooled". This application is not security critical.
-
-    //struct passwd * pws = getpwuid(getuid());
-    //bool noname=true;
-    //if(pws != nullptr) {
-    //	if(pws->pw_name != nullptr && pws->pw_gecos != nullptr) {
-    //	  htmlout << pws->pw_name << " (" << pws->pw_gecos << ")";
-    //	  noname=false;
-    //	}
-    //}
+    //char * logname= getenv("LOGNAME");
+    //htmlout << getlogin() << "\">\n
 
-    char * namestr=getlogin();
-    if(namestr==nullptr) {
-      namestr=getenv("LOGNAME");
-      if(namestr==nullptr) {
-	namestr=getenv("USER");
+    {
+      // REMARK:
+      // GCC 3.4 tells this
+      // : warning: Using 'getpwuid' in statically linked applications 
+      //   requires at runtime the shared libraries from the glibc version
+      //   used for linking
+      //
+      //  This might also be the reason for a reported crash of
+      //   convert_project on a 2.6 kernel (with another glibc than my
+      //   home machine
+      //
+      // Resolve: get back to getlogin() even if manual says it can be
+      //  easily "fooled". This application is not security critical.
+
+      //struct passwd * pws = getpwuid(getuid());
+      //bool noname=true;
+      //if(pws != NULL) {
+      //	if(pws->pw_name != NULL && pws->pw_gecos != NULL) {
+      //	  htmlout << pws->pw_name << " (" << pws->pw_gecos << ")";
+      //	  noname=false;
+      //	}
+      //}
+
+      char * namestr=getlogin();
+      if(namestr==NULL) {
+	namestr=getenv("LOGNAME");
+	if(namestr==NULL) {
+	  namestr=getenv("USER");
+	}
+      }
+    
+      if(namestr!=NULL){
+	htmlout << namestr;
+      }else{
+	htmlout << "unknown";
       }
     }
 
-    if(namestr!=nullptr){
-      htmlout << namestr;
-    }else{
-      htmlout << "unknown";
-    }
-  }
-
-  htmlout << "\">\n<meta name=\"Description\" content=\"Assembled shotgun project\">\n\
+    htmlout << "\">\n<meta name=\"Description\" content=\"Assembled shotgun project\">\n\
    <title>";
-  htmlout << "Project " << projectname << " </title>\n\
+    htmlout << "Project " << projectname << " </title>\n\
   <STYLE TYPE=\"text/css\">\n\
   <!--\n\
   \n\
@@ -3560,34 +3143,34 @@ BODY  { font-family: sans-serif;\n\
 </head>\n\
 <body TEXT=\"#000000\" BGCOLOR=\"#FFFFFF\" LINK=\"#FF0000\" VLINK=\"#551A8B\" ALINK=\"#000088\">\n";
 
-  //   .ALUS {color:black;  background-color:#90ee90;}\n
-  // #66ffff = azure (pi*daumen)
-
-  htmlout << "<h1><center>Tag legend</center></h1>\n";
-
-  htmlout << "<center>\n";
-  htmlout << "<table CELLSPACING=0 CELLPADDING=0 NOSAVE >\n";
-
-  htmlout << "<tr align=\"left\"><td><tt><SPAN CLASS=\"FCDS\"> </SPAN> = FCDS;</tt></td><td>Feature CDS (coding sequence)</td></tr>\n";
-  htmlout << "<tr align=\"left\"><td><tt><SPAN CLASS=\"FtRN\"> </SPAN> = FtRN;</tt></td><td>tRNA</td></tr>\n";
-  htmlout << "<tr align=\"left\"><td><tt><SPAN CLASS=\"FrRN\"> </SPAN> = FrRN;</tt></td><td>rRNA</td></tr>\n";
-  htmlout << "<tr align=\"left\"><td><tt><SPAN CLASS=\"FmxR\"> </SPAN> = Fm-R;</tt></td><td>misc. RNA</td></tr>\n";
-  htmlout << "<tr align=\"left\"><td><tt><SPAN CLASS=\"MISM\"> </SPAN> = MISM;</tt></td><td>Mismatch (discrepancy) between reads and consensus</td></tr>\n";
-  //htmlout << "<tr><td><tt><SPAN CLASS=\"ALUS\"> </SPAN> = ALUS;</tt> Repetitive ALU sequence</td></tr>\n";
-  htmlout << "<tr align=\"left\"><td><tt><SPAN CLASS=\"SRMr\"> </SPAN> = SRMx;</tt></td><td>Strong Repeat Marker Base set by MIRA</td></tr>\n";
-  htmlout << "<tr align=\"left\"><td><tt><SPAN CLASS=\"WRMr\"> </SPAN> = WRMx;</tt></td><td>Weak Repeat Marker Base set by MIRA</td></tr>\n";
-  htmlout << "<tr align=\"left\"><td><tt><SPAN CLASS=\"SROr\"> </SPAN> = SROx;</tt></td><td>SNP inteR Organism (Read/Consensus) set by MIRA</td></tr>\n";
-  htmlout << "<tr align=\"left\"><td><tt><SPAN CLASS=\"SAOr\"> </SPAN> = SAOx;</tt></td><td>SNP intrA Organism (Read/Consensus) set by MIRA</td></tr>\n";
-  htmlout << "<tr align=\"left\"><td><tt><SPAN CLASS=\"SIOr\"> </SPAN> = SIOx;</tt></td><td>SNP Inter- and intra-Organism (Read/Consensus) set by MIRA</td></tr>\n";
-  htmlout << "<tr align=\"left\"><td><tt><SPAN CLASS=\"MCVc\"> </SPAN> = MCVc;</tt></td><td>Missing CoVerage in Consensus (set by MIRA)</td></tr>\n";
-  htmlout << "<tr align=\"left\"><td><tt><SPAN CLASS=\"POLY\"> </SPAN> = POLY;</tt></td><td>Poly-A signal</td></tr>\n";
-  htmlout << "<tr align=\"left\"><td><tt><SPAN CLASS=\"EDxD\"> </SPAN> = EDxD;</tt></td><td>Delete operation set by EdIt</td></tr>\n";
-  htmlout << "<tr align=\"left\"><td><tt><SPAN CLASS=\"EDxI\"> </SPAN> = EDxI;</tt></td><td>Insert operation set by EdIt</td></tr>\n";
-  htmlout << "<tr align=\"left\"><td><tt><SPAN CLASS=\"EDxC\"> </SPAN> = EDxC;</tt></td><td>Change operation set by EdIt</td></tr>\n";
-  htmlout << "<tr align=\"left\"><td><tt><SPAN CLASS=\"IUPC\"> </SPAN> = IUPAC;</tt></td><td> IUPAC base (shows only in HTML output)</td></tr>\n";
-
-  htmlout<< "</table></center>\n";
-}
+    //   .ALUS {color:black;  background-color:#90ee90;}\n
+    // #66ffff = azure (pi*daumen)
+    
+    htmlout << "<h1><center>Tag legend</center></h1>\n"; 
+    
+    htmlout << "<center>\n";
+    htmlout << "<table CELLSPACING=0 CELLPADDING=0 NOSAVE >\n";
+    
+    htmlout << "<tr align=\"left\"><td><tt><SPAN CLASS=\"FCDS\"> </SPAN> = FCDS;</tt></td><td>Feature CDS (coding sequence)</td></tr>\n";
+    htmlout << "<tr align=\"left\"><td><tt><SPAN CLASS=\"FtRN\"> </SPAN> = FtRN;</tt></td><td>tRNA</td></tr>\n";
+    htmlout << "<tr align=\"left\"><td><tt><SPAN CLASS=\"FrRN\"> </SPAN> = FrRN;</tt></td><td>rRNA</td></tr>\n";
+    htmlout << "<tr align=\"left\"><td><tt><SPAN CLASS=\"FmxR\"> </SPAN> = Fm-R;</tt></td><td>misc. RNA</td></tr>\n";
+    htmlout << "<tr align=\"left\"><td><tt><SPAN CLASS=\"MISM\"> </SPAN> = MISM;</tt></td><td>Mismatch (discrepancy) between reads and consensus</td></tr>\n";
+    //htmlout << "<tr><td><tt><SPAN CLASS=\"ALUS\"> </SPAN> = ALUS;</tt> Repetitive ALU sequence</td></tr>\n";
+    htmlout << "<tr align=\"left\"><td><tt><SPAN CLASS=\"SRMr\"> </SPAN> = SRMx;</tt></td><td>Strong Repeat Marker Base set by MIRA</td></tr>\n";
+    htmlout << "<tr align=\"left\"><td><tt><SPAN CLASS=\"WRMr\"> </SPAN> = WRMx;</tt></td><td>Weak Repeat Marker Base set by MIRA</td></tr>\n";
+    htmlout << "<tr align=\"left\"><td><tt><SPAN CLASS=\"SROr\"> </SPAN> = SROx;</tt></td><td>SNP inteR Organism (Read/Consensus) set by MIRA</td></tr>\n";
+    htmlout << "<tr align=\"left\"><td><tt><SPAN CLASS=\"SAOr\"> </SPAN> = SAOx;</tt></td><td>SNP intrA Organism (Read/Consensus) set by MIRA</td></tr>\n";
+    htmlout << "<tr align=\"left\"><td><tt><SPAN CLASS=\"SIOr\"> </SPAN> = SIOx;</tt></td><td>SNP Inter- and intra-Organism (Read/Consensus) set by MIRA</td></tr>\n";
+    htmlout << "<tr align=\"left\"><td><tt><SPAN CLASS=\"MCVc\"> </SPAN> = MCVc;</tt></td><td>Missing CoVerage in Consensus (set by MIRA)</td></tr>\n";
+    htmlout << "<tr align=\"left\"><td><tt><SPAN CLASS=\"POLY\"> </SPAN> = POLY;</tt></td><td>Poly-A signal</td></tr>\n";
+    htmlout << "<tr align=\"left\"><td><tt><SPAN CLASS=\"EDxD\"> </SPAN> = EDxD;</tt></td><td>Delete operation set by EdIt</td></tr>\n";
+    htmlout << "<tr align=\"left\"><td><tt><SPAN CLASS=\"EDxI\"> </SPAN> = EDxI;</tt></td><td>Insert operation set by EdIt</td></tr>\n";
+    htmlout << "<tr align=\"left\"><td><tt><SPAN CLASS=\"EDxC\"> </SPAN> = EDxC;</tt></td><td>Change operation set by EdIt</td></tr>\n";
+    htmlout << "<tr align=\"left\"><td><tt><SPAN CLASS=\"IUPC\"> </SPAN> = IUPAC;</tt></td><td> IUPAC base (shows only in HTML output)</td></tr>\n";
+    
+    htmlout<< "</table></center>\n";
+  }
 
 
 /*************************************************************************
@@ -3597,81 +3180,84 @@ BODY  { font-family: sans-serif;\n\
  *
  *************************************************************************/
 
-void assout::dumpContigListAsHTML(list<Contig> & clist, const string & filename, bool deleteoldfile, const string & projectname)
-{
-  FUNCSTART("void dumpContigListAsHTML(list<Contig> & clist, const string & filename, bool deleteoldfile, const string & projectname)");
+  void dumpContigListAsHTML(list<Contig> & clist, const string & filename, bool deleteoldfile, const string & projectname)
+  {
+    FUNCSTART("void dumpContigListAsHTML(list<Contig> & clist, const string & filename, bool deleteoldfile, const string & projectname)");
 
-  ofstream fout;
-  if(!openFileForAppend(filename,fout, deleteoldfile)){
-    dumpHTMLHeader(projectname, fout);
-  }
+    ofstream fout;
+    if(!openFileForAppend(filename,fout, deleteoldfile)){
+      dumpHTMLHeader(projectname, fout);
+    }
 
-  // A contig list at the top of the file is currently not possible
-  //  anymore *sigh*
-  // maybe splitting into two files and then concatenate at the of the process?
-  //
-  //list<Contig>::iterator I=clist.begin();
-  //htmlout << "<h1><center>Contig List</center></h1>\n";
-  //while(I!=clist.end()){
-  //
-  //  if(I->getContigReads().size() > 1) {
-  //	htmlout << "<a href=\"#" << I->getContigName() << "\">Contig " <<  I->getContigID();
-  //  }else{
-  //	htmlout << "<a href=\"#" << I->getContigName() << "\">Singlet " <<  I->getContigID();
-  //  }
-  //  htmlout << " (" << I->getContigLength() << ")</a>";
-  //  I++;
-  //  if(I!=clist.end()){
-  //	htmlout << ", ";
-  //  }else{
-  //	htmlout << "\n<p>\n";
-  //  }
-  //}
-
-  Contig::setCoutType(Contig::AS_HTML);
-  dumpContigs(clist,fout);
-
-  // This is also bad ... when should the HTML be closed?
-  //fout << "\n</body></html>";
-
-  fout.close();
-
-  return;
-
-  FUNCEND();
-}
+    // A contig list at the top of the file is currently not possible 
+    //  anymore *sigh*
+    // maybe splitting into two files and then concatenate at the of the process?
+    //
+    //list<Contig>::iterator I=clist.begin();
+    //htmlout << "<h1><center>Contig List</center></h1>\n"; 
+    //while(I!=clist.end()){
+    //  
+    //  if(I->getContigReads().size() > 1) {
+    //	htmlout << "<a href=\"#" << I->getContigName() << "\">Contig " <<  I->getContigID();
+    //  }else{
+    //	htmlout << "<a href=\"#" << I->getContigName() << "\">Singlet " <<  I->getContigID();
+    //  }
+    //  htmlout << " (" << I->getContigLength() << ")</a>";
+    //  I++;
+    //  if(I!=clist.end()){
+    //	htmlout << ", ";
+    //  }else{
+    //	htmlout << "\n<p>\n";
+    //  }
+    //}
+    
+    Contig::setCoutType(Contig::AS_HTML);
+    dumpContigs(clist,fout);
+    
+    // This is also bad ... when should the HTML be closed?
+    //fout << "\n</body></html>";
+
+    fout.close();
+    
+    return;
 
+    FUNCEND();
+  }
 
-void assout::dumpContigAsHTML(Contig & con, const string & filename, bool deleteoldfile, const string & projectname)
-{
-  FUNCSTART("void dumpContigAsHTML(Contig & con, const string & filename, bool deleteoldfile, const string & projectname)");
 
-  ofstream fout;
-  if(!openFileForAppend(filename,fout, deleteoldfile)){
-    dumpHTMLHeader(projectname, fout);
-  }
+  void dumpContigAsHTML(Contig & con, const string & filename, bool deleteoldfile, const string & projectname)
+  {
+    FUNCSTART("void dumpContigAsHTML(Contig & con, const string & filename, bool deleteoldfile, const string & projectname)");
 
-  // A contig list at the top of the file is currently not possible
-  //  anymore *sigh*
-  // maybe splitting into two files and then concatenate at the of the process?
+    ofstream fout;
+    if(!openFileForAppend(filename,fout, deleteoldfile)){
+      dumpHTMLHeader(projectname, fout);
+    }
 
-  Contig::setCoutType(Contig::AS_HTML);
-  try{
-    fout << con;
-  }
-  catch (Notify n) {
-    cerr << "Error while dumping " << con.getContigName() << " as HTML.\n";
-    n.handleError(THISFUNC);
-  }
-  fout.close();
+    // A contig list at the top of the file is currently not possible 
+    //  anymore *sigh*
+    // maybe splitting into two files and then concatenate at the of the process?
+    
+    Contig::setCoutType(Contig::AS_HTML);
+    try{
+      fout << con;
+    }
+    catch (Notify n) {
+      cerr << "Error while dumping " << con.getContigName() << " as HTML.\n";
+      n.handleError(THISFUNC);
+    }
+    fout.close();
 
+    
+    // This is also bad ... when should the HTML be closed?
+    //fout << "\n</body></html>";
 
-  // This is also bad ... when should the HTML be closed?
-  //fout << "\n</body></html>";
+    fout.close();
+    
+    return;
 
-  fout.close();
+    FUNCEND();
+  }
 
-  return;
 
-  FUNCEND();
 }
diff --git a/src/mira/assembly_output.H b/src/mira/assembly_output.H
index c047b21..7a0a633 100644
--- a/src/mira/assembly_output.H
+++ b/src/mira/assembly_output.H
@@ -11,19 +11,21 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
+// 	$Id$	
+
 
 #ifndef _mira_assout_h_
 #define _mira_assout_h_
@@ -36,104 +38,6 @@
 
 namespace assout {
 
-  struct shortgbfinfo_t {
-    std::string identifier;
-    std::string locustag;
-
-    std::string gene;
-    std::string function;
-    std::string ecnumber;
-    std::string product;
-    std::string note;
-
-    friend std::ostream & operator<<(std::ostream &ostr, const shortgbfinfo_t & sgi){
-      ostr << "identifier: " << sgi.identifier
-	   << "\nlocustag  : " << sgi.locustag
-	   << "\ngene      : " << sgi.gene
-	   << "\nfunction  : " << sgi.function
-	   << "\necnumber  : " << sgi.ecnumber
-	   << "\nproduct   : " << sgi.product
-	   << "\nnote      : " << sgi.note
-	   << std::endl;
-      return ostr;
-    }
-  };
-
-  struct snpenv_t {
-    std::list<Contig>::iterator cI;
-    std::string snpjumpname;
-
-    std::list<gbfsummary_t> gbfslist;
-    std::list<shortgbfinfo_t> sgilist;
-
-    uint32 from;
-    uint32 to;
-    uint32 numsnps;
-
-    friend std::ostream & operator<<(std::ostream &ostr, const snpenv_t & se){
-      ostr << "Contig: " << se.cI->getContigName()
-	   << "\njumpname: " << se.snpjumpname
-	   << "\nfrom      : " << se.from
-	   << "\nto        : " << se.to
-	   << "\nnumsnps   : " << se.numsnps
-	   << std::endl;
-
-      ostr << "gbfslist: ";
-      if(se.gbfslist.empty()){
-	ostr << "empty\n";
-      }else{
-	ostr << "\n";
-	for(auto & gbfs : se.gbfslist){
-	  ostr << gbfs;
-	}
-      }
-      ostr << "sgilist: ";
-      if(se.sgilist.empty()){
-	ostr << "empty\n";
-      }else{
-	ostr << "\n";
-	std::list<shortgbfinfo_t>::const_iterator sgI=se.sgilist.begin();
-	for(auto & sg : se.sgilist){
-	  ostr << sg;
-	}
-      }
-
-      return ostr;
-    }
-
-  };
-
-
-  struct proteinchangesummary_t {
-    bool isaffected;
-
-    bool firstcodonisstart;
-
-    bool changedstart;
-    bool destroyedstart;
-    bool changedstop;
-    bool destroyedstop;
-    bool prematurestop;
-
-    uint32 mutinintergenic;
-
-    uint32 insertioninlocus;
-    uint32 deletioninlocus;
-    uint32 silentinlocus;
-    uint32 aachangeinlocus;
-
-    uint32 insertionuntranslated;    //
-    uint32 deletionuntranslated;     //
-    uint32 silentuntranslated;       //
-    uint32 aachangeuntranslated;     //
-
-    uint32 proteinlenchanged;
-    std::string proteininfeature;
-
-    std::string coveragestatus;
-  };
-
-
 /*************************************************************************
  *
  *
@@ -141,232 +45,218 @@ namespace assout {
  *
  *************************************************************************/
 
-  typedef std::map<int32, std::string> strainid2name_t;
+  typedef map<int32, string> strainid2name_t;
   typedef strainid2name_t::value_type s_idname_pair_t;
 
-  void saveContigReadList(std::list<Contig> & clist,
-			  const std::string & filename,
+  void saveContigReadList(list<Contig> & clist, 
+			  const string & filename,
 			  bool deleteoldfile);
-  void saveContigReadList(Contig & con,
-			  const std::string & filename,
+  void saveContigReadList(Contig & con, 
+			  const string & filename,
 			  bool deleteoldfile);
-  void saveStatistics(std::list<Contig> & clist,
-		      const std::string & filename,
+  void saveStatistics(list<Contig> & clist, 
+		      const string & filename,
 		      bool deleteoldfile);
   void saveStatistics(Contig & con,
-		      const std::string & filename,
+		      const string & filename,
 		      bool deleteoldfile);
   void saveAssemblyInfo(AssemblyInfo & asi,
-		      const std::string & filename,
+		      const string & filename,
 		      bool deleteoldfile);
-  void saveLargeContigsInfo(AssemblyInfo & asi,
-			    const std::string & filename,
-			    bool deleteoldfile);
-  void saveReadTagList(std::list<Contig> & clist,
-		       const std::string & filename,
+  void saveReadTagList(list<Contig> & clist,
+		       const string & filename,
 		       bool deleteoldfile);
-  void saveReadTagList(Contig & con,
-		       const std::string & filename,
+  void saveReadTagList(Contig & con, 
+		       const string & filename,
 		       bool deleteoldfile);
-  void saveConsensusTagList(std::list<Contig> & clist,
-			    const std::string & filename,
+  void saveConsensusTagList(list<Contig> & clist,
+			    const string & filename,
 			    bool deleteoldfile);
-  void saveConsensusTagList(Contig & con,
-			    const std::string & filename,
+  void saveConsensusTagList(Contig & con, 
+			    const string & filename,
 			    bool deleteoldfile);
-  void getPreviousLocusTag(const std::list<gbfsummary_t> & gbfs,
-			   std::list<gbfsummary_t>::const_iterator gbfsI,
-			   std::string & locustag,
-			   std::string & gene);
-  void getNextLocusTag(const std::list<gbfsummary_t> & gbfs,
-		       std::list<gbfsummary_t>::const_iterator gbfsI,
-		       std::string & locustag,
-		       std::string & gene);
-  void saveSNPList(std::list<Contig> & clist,
-		   const std::string & filename,
+  void getPreviousLocusTag(const list<gbfsummary_t> & gbfs,
+			   list<gbfsummary_t>::const_iterator gbfsI, 
+			   string & locustag, 
+			   string & gene);
+  void getNextLocusTag(const list<gbfsummary_t> & gbfs,
+		       list<gbfsummary_t>::const_iterator gbfsI, 
+		       string & locustag, 
+		       string & gene);
+  void saveSNPList(list<Contig> & clist,
+		   const string & filename,
 		   bool deleteoldfile);
-  void saveCoverageInfo(std::list<Contig> & clist,
-			const std::string & filename,
-			bool deleteoldfile);
-  void saveSNPSurroundingAsHTML(std::list<Contig> & clist,
-				const std::string & filename,
+  void saveSNPSurroundingAsHTML(list<Contig> & clist, 
+				const string & filename, 
 				bool deleteoldfile);
-  void makeAllStrainGenomes(Contig & contigI,
+  void makeAllStrainGenomes(Contig & contigI, 
 			    base_quality_t minqual,
-			    std::string & consseq,
-			    std::vector<base_quality_t> & consqual,
-			    std::vector<std::string> & strain_consseq,
-			    std::vector< std::vector<base_quality_t> > & strain_consqual,
+			    string & consseq,
+			    vector<base_quality_t> & consqual, 
+			    vector<string> & strain_consseq, 
+			    vector< vector<base_quality_t> > & strain_consqual,
 			    strainid2name_t & strainnames_in_contig,
-			    bool fillholesinstraingenomes,
-			    bool addconstag);
-  void saveFeatureAnalysis(std::list<Contig> & clist,
-			   ReadPool & rpool,
-			   const std::string & faname,
-			   const std::string & fsname,
-			   const std::string & fcname,
+			    bool fillholesinstraingenomes);
+  void saveFeatureAnalysis(list<Contig> & clist, 
+			   ReadPool & rpool, 
+			   const string & faname,
+			   const string & fsname,
+			   const string & fcname,
 			   bool deleteoldfile);
-  void adjustCaseOfSequences(std::string & reference,
-			     std::vector<std::string> & mutants);
+  void adjustCaseOfSequences(string & reference, 
+			     vector<string> & mutants);
 
-  void saveStrainsAsFASTAQ(std::list<Contig> & clist,
+  void saveStrainsAsFASTAQ(list<Contig> & clist, 
 			   const ReadPool & rp,
-			   const std::string & paddedfilename,
-			   bool asfastq,
-			   uint32 mincoverage=0,
-			   base_quality_t minqual=0,
-			   bool deleteoldfile=false,
-			   bool fillholesinstrain=false);
-  void saveStrainsAsFASTAQ(Contig & outcon,
-			   const ReadPool & rp,
-			   const std::string & paddedfilename,
+			   const string & paddedfilename,
 			   bool asfastq,
 			   uint32 mincoverage=0,
 			   base_quality_t minqual=0,
 			   bool deleteoldfile=false,
 			   bool fillholesinstrain=false);
 
-  void saveStrainsAsGBF(std::list<Contig> & clist,
+  void saveStrainsAsGBF(list<Contig> & clist,
 			const ReadPool & rp,
-			const std::string & paddedfilename,
+			const string & paddedfilename,
 			base_quality_t minqual,
 			bool fillholesinstraingenomes,
 			bool deleteoldfile);
-
-  void saveAs_TYPE(std::list<Contig> & clist,
-		   const std::string & filename,
+	  
+  void saveAs_TYPE(list<Contig> & clist, 
+		   const string & filename, 
 		   const uint8 type,
 		   bool deleteoldfile);
-  void saveAs_TYPE(Contig & con,
-		   const std::string & filename,
+  void saveAs_TYPE(Contig & con, 
+		   const string & filename, 
 		   const uint8 type,
 		   bool deleteoldfile);
-  inline void saveAsTCS(std::list<Contig> & clist,
-			const std::string & filename,
+  inline void saveAsTCS(list<Contig> & clist, 
+			const string & filename,
 			bool deleteoldfile){
     saveAs_TYPE(clist,filename,Contig::AS_TCS, deleteoldfile);
   };
-  inline void saveAsTCS(Contig & con,
-			const std::string & filename,
+  inline void saveAsTCS(Contig & con, 
+			const string & filename,
 			bool deleteoldfile){
     saveAs_TYPE(con,filename,Contig::AS_TCS, deleteoldfile);
   };
-  inline void saveAsCAF(std::list<Contig> & clist,
-			const std::string & filename,
+  inline void saveAsCAF(list<Contig> & clist, 
+			const string & filename,
 			bool deleteoldfile){
     saveAs_TYPE(clist,filename,Contig::AS_CAF, deleteoldfile);
   };
-  inline void saveAsCAF(Contig & con,
-			const std::string & filename,
+  inline void saveAsCAF(Contig & con, 
+			const string & filename,
 			bool deleteoldfile){
     saveAs_TYPE(con,filename,Contig::AS_CAF,deleteoldfile);
   };
-  inline void saveAsMAF(std::list<Contig> & clist,
-			const std::string & filename,
+  inline void saveAsMAF(list<Contig> & clist, 
+			const string & filename,
 			bool deleteoldfile){
     saveAs_TYPE(clist,filename,Contig::AS_MAF, deleteoldfile);
   };
-  inline void saveAsMAF(Contig & con,
-			const std::string & filename,
+  inline void saveAsMAF(Contig & con, 
+			const string & filename,
 			bool deleteoldfile){
     saveAs_TYPE(con,filename,Contig::AS_MAF,deleteoldfile);
   };
-  inline void saveAsTXT(std::list<Contig> & clist,
-			const std::string & filename,
+  inline void saveAsTXT(list<Contig> & clist,
+			const string & filename,
 			bool deleteoldfile){
     saveAs_TYPE(clist,filename,Contig::AS_TEXT,deleteoldfile);
   };
-  inline void saveAsTXT(Contig & con,
-			const std::string & filename,
+  inline void saveAsTXT(Contig & con, 
+			const string & filename,
 			bool deleteoldfile){
     saveAs_TYPE(con,filename,Contig::AS_TEXT, deleteoldfile);
   };
-  void saveAsGAP4DA(std::list<Contig> & clist,
-		    const std::string & dirname,
+  void saveAsGAP4DA(list<Contig> & clist, 
+		    const string & dirname,
 		    bool deleteoldfile);
   void saveAsGAP4DA(Contig & con,
-		    const std::string & dirname,
+		    const string & dirname,
 		    bool deleteoldfile);
-  void saveAsFASTA(std::list<Contig> & clist,
-		   const std::string & filename,
-		   const std::string & paddedfilename,
+  void saveAsFASTA(list<Contig> & clist,
+		   const string & filename, 
+		   const string & paddedfilename,
 		   bool deleteoldfile);
   void saveAsFASTA(Contig & con,
-		   const std::string & filename,
-		   const std::string & paddedfilename,
+		   const string & filename, 
+		   const string & paddedfilename,
 		   bool deleteoldfile);
-  void saveAsACE(std::list<Contig> & clist,
-		 const std::string & filename,
+  void saveAsACE(list<Contig> & clist, 
+		 const string & filename,
 		 bool deleteoldfile);
-  void saveAsACE(Contig & con,
-		 const std::string & filename,
+  void saveAsACE(Contig & con, 
+		 const string & filename,
 		 bool deleteoldfile);
-  void saveAsWiggle(std::list<Contig> & clist,
-		    const std::string & filename,
-		    bool deleteoldfile,
-		    bool gcinsteadcov);
-  void saveAsWiggle(Contig & con,
-		    const std::string & filename,
-		    bool deleteoldfile,
-		    bool gcinsteadcov);
+  void saveAsWiggle(list<Contig> & clist, 
+		   const string & filename, 
+		   bool deleteoldfile);
+  void saveAsWiggle(Contig & con, 
+		    const string & filename, 
+		    bool deleteoldfile);
 
 
-  void dumpContigs(std::list<Contig> & clist, std::ostream & fout);
-  inline void dumpAsTCS(std::list<Contig> & clist, std::ostream & fout){
+  void dumpContigs(list<Contig> & clist, ostream & fout);
+  inline void dumpAsTCS(list<Contig> & clist, ostream & fout){
     Contig::setCoutType(Contig::AS_TCS);
     dumpContigs(clist,fout);
   };
-  inline void dumpAsTCS(Contig & con, std::ostream & fout){
+  inline void dumpAsTCS(Contig & con, ostream & fout){
     Contig::setCoutType(Contig::AS_TCS);
     fout << con;
   };
-  inline void dumpAsCAF(std::list<Contig> & clist, std::ostream & fout){
+  inline void dumpAsCAF(list<Contig> & clist, ostream & fout){
     Contig::setCoutType(Contig::AS_CAF);
     dumpContigs(clist,fout);
   };
-  inline void dumpAsCAF(Contig & con, std::ostream & fout){
+  inline void dumpAsCAF(Contig & con, ostream & fout){
     Contig::setCoutType(Contig::AS_CAF);
     fout << con;
   };
-  inline void dumpAsTXT(std::list<Contig> & clist, std::ostream & fout){
+  inline void dumpAsTXT(list<Contig> & clist, ostream & fout){
     Contig::setCoutType(Contig::AS_TEXT);
     dumpContigs(clist,fout);
   };
-  inline void dumpAsTXT(Contig & con, std::ostream & fout){
+  inline void dumpAsTXT(Contig & con, ostream & fout){
     Contig::setCoutType(Contig::AS_TEXT);
     fout << con;
   };
-  void dumpAsACE(std::list<Contig> & clist, std::ostream & fout);
+  void dumpAsACE(list<Contig> & clist, ostream & fout);
 
 
-  void dumpHTMLHeader(const std::string & projectname, std::ostream & htmlout);
-  void dumpContigListAsHTML(std::list<Contig> & clist,
-			    const std::string & filename,
-			    bool deleteoldfile,
-			    const std::string & projectname);
+  void dumpHTMLHeader(const string & projectname, ostream & htmlout);
+  void dumpContigListAsHTML(list<Contig> & clist,
+			    const string & filename, 
+			    bool deleteoldfile, 
+			    const string & projectname);
   void dumpContigAsHTML(Contig & con,
-			const std::string & filename,
-			bool deleteoldfile,
-			const std::string & projectname);
+			const string & filename, 
+			bool deleteoldfile, 
+			const string & projectname);
 
 
   // ---------------------- internals
-  void dumpSequenceAsGBF_priv(const std::string & seqname,
-			      const std::string & strainname,
-			      std::string & seq,
-			      const std::string & consseq,
-			      const std::list<gbfsummary_t> & featurelist,
-			      std::ostream & fout);
-  void dumpTextAsGBFValueLine_priv(const std::string & key,
-				   const std::string & value,
-				   std::ostream & fout);
-
-  void saveAsACE_openACE(std::fstream & fio,
-			 const std::string & filename,
+  bool openFileForAppend(const string & filename, 
+			 ofstream & fout,
+			 bool deleteanyway);
+  void dumpSequenceAsGBF_priv(const string & seqname,
+			      const string & strainname,
+			      string & seq,
+			      const string & consseq,
+			      const list<gbfsummary_t> & featurelist, 
+			      ostream & fout);
+  void dumpTextAsGBFValueLine_priv(const string & key, 
+				   const string & value,
+				   ostream & fout);
+
+  void saveAsACE_openACE(fstream & fio, 
+			 const string & filename, 
 			 bool deleteoldfile,
 			 uint32 & numcontigs,
 			 uint32 & numreads);
-  void saveAsACE_rewriteHeader(std::fstream & fio, const uint32 numcontigs, const uint32 numreads);
+  void saveAsACE_rewriteHeader(fstream & fio, const uint32 numcontigs, const uint32 numreads);
 
 }
 
diff --git a/src/mira/assembly_pbcorrect.C b/src/mira/assembly_pbcorrect.C
deleted file mode 100644
index f104b20..0000000
--- a/src/mira/assembly_pbcorrect.C
+++ /dev/null
@@ -1,2126 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 2013 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-
-#include "mira/assembly.H"
-
-// BOOST
-#include <boost/algorithm/string.hpp>
-#include <boost/lexical_cast.hpp>
-
-#include "errorhandling/errorhandling.H"
-#include "util/progressindic.H"
-#include "util/dptools.H"
-#include "util/fileanddisk.H"
-#include "caf/caf.H"
-#include "mira/align.H"
-
-#include "mira/ads.H"
-#include "mira/simple_2Dsignalprocessing.H"
-
-using namespace std;
-
-#define CEBUG(bla)
-
-// cs1 for normal clocking ('user compatible' as is does not disturb)
-//  cs2 for extensive clocking output, more for analysis of MIRA behaviour
-//  during development
-
-#ifndef PUBLICQUIET
-#define CLOCK_STEPS2
-#endif
-#define CLOCK_STEPS2
-
-//ecopbownH5_31561
-
-
-#define CEBUG(bla) { if(docebug) {cout << bla; cout.flush();}}
-
-
-string readofinterest1="ecopbownH5_38629a";
-string readofinterest2="ecopbownH5_25312a";
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-uint32 Assembly::correctPBMain()
-{
-  FUNCSTART("Assembly::correctPBMain()");
-
-  uint32 startpass=1;
-
-  uint32 totaleditsmade=0;
-
-  basicDataChecks();
-  ensureStandardDirectories(false);
-
-  AS_miraparams[0].getNonConstAssemblyParams().as_dateoutput=false;
-  AS_miraparams[0].getNonConstAssemblyParams().as_clip_skimchimeradetection=false;  // needs to be off?
-  AS_miraparams[0].getNonConstAssemblyParams().as_clip_skimjunkdetection=false;  // needs to be off?
-
-  assembly_parameters const & as_fixparams= AS_miraparams[0].getAssemblyParams();
-
-  // fill quick lookup which sequencing types are present as well as whether backbones are there
-  AS_seqtypespresent.clear();
-  AS_seqtypespresent.resize(ReadGroupLib::SEQTYPE_END,false);
-  for(uint32 rgi=0; rgi< ReadGroupLib::getNumReadGroups(); ++rgi){
-    auto rgid=ReadGroupLib::getReadGroupID(rgi);
-    if(rgid.isBackbone()){
-      AS_hasbackbones=true;
-    }
-    if(!rgid.isRail() && !rgid.isBackbone()){
-      AS_seqtypespresent[rgid.getSequencingType()]=true;
-    }
-  }
-
-  AS_permanent_overlap_bans.resize(AS_readpool.size());
-  AS_used_ids.resize(AS_readpool.size(),0);
-  AS_needalloverlaps.resize(AS_readpool.size(),false);   // not really used, but computeSWAlign() needs it
-
-  if(startpass==1){
-    findDegeneratePolymerases(AS_readpool);
-  }
-
-  cout << "RLEing reads\n";
-  Read::setCoutType(Read::AS_TEXT);
-  for(uint32 ri=0; ri<AS_readpool.size(); ++ri){
-    AS_readpool[ri].rleRead();
-    //cout << AS_readpool[ri] << endl;
-  }
-
-/*
-  {
-    string tmpfname;
-    tmpfname=buildFileName(0,"","",
-			  as_fixparams.as_tmpf_clippings,
-			  ".txt");
-
-    // doing it twice catches a few outliers missed the first time
-    string logprefix="proposed cutback 1a: ";
-    uint64 numclipped=performNewProposedCutbackClips(tmpfname,logprefix);
-    if(numclipped>0){
-      logprefix="proposed cutback 1b: ";
-      performNewProposedCutbackClips(tmpfname,logprefix);
-    }else{
-      cout << "No bases clipped in first pec round, skipping second round.\n";
-    }
-    dumpSomeStatistics();
-  }
-*/
-
-  totaleditsmade+=correctPBMainNormal(startpass);
-  //totaleditsmade+=correctPBMainLight(startpass);
-
-  cout << "Hard trim" << endl;
-  for(uint32 ri=0; ri<AS_readpool.size(); ++ri){
-    AS_readpool[ri].performHardTrim();
-  }
-  cout << "Hard trim done" << endl;
-
-  {
-    ofstream ostr("corrected_intermediate_f.fastq",ios::out);
-    AS_readpool.dumpAs(ostr,Read::AS_FASTQ,true);
-  }
-
-  //colourReadsByRLE();
-
-  cout << "derle" << endl;
-  for(uint32 ri=0; ri<AS_readpool.size(); ++ri){
-    // carefull: hard trim will have completely discarded empty reads
-    if(AS_readpool[ri].getRLEValues() != nullptr){
-      AS_readpool[ri].deRLERead();
-    }
-  }
-  cout << "derle done" << endl;
-
-  {
-    ofstream ostr("corrected.maf",ios::out);
-    AS_readpool.dumpAs(ostr,Read::AS_MAF,true);
-  }
-  {
-    ofstream ostr("corrected.fastq",ios::out);
-    AS_readpool.dumpAs(ostr,Read::AS_FASTQ,true);
-  }
-
-  AS_naclipl.clear();
-  AS_naclipr.clear();
-
-  return totaleditsmade;
-}
-
-//ecopbownH5_31561
-
-
-
-uint32 Assembly::correctPBMainLight(uint32 startpass)
-{
-  FUNCSTART("Assembly::correctPBMainLight()");
-  uint32 totaleditsmade=0;
-
-  pbc_timing_t timing;
-
-  // pass 1
-  uint32 actpass=startpass;
-  int32 additionalbelieveborder=0;
-  // later passes: already larger kmer and borders, but still problems at microrepeat sites
-  //  so, in later passes ... very rare things: don't believe
-  uint8 minbk=0;
-  bool tweakbkmar=false;
-  bool killnonhafstretches=false;
-  bool generatenaclips=false;
-  bool generaterleedits=false;
-  bool generatebaseedits=true;
-
-  float ratioacceptvalue=0.0072; // ratio < .72 % not accepted
-
-  // using mkfr=4 (instead of 1) here considerably increases the quality of the resulting sequences
-  //  (assemblies have less homopolymer problems) at the expense of worse resolving of low coverage
-  //  regions, hence more data clipped
-  AS_miraparams[0].getNonConstAssemblyParams().as_clip_pec_mkfr=4;
-
-  if(actpass==1){
-    totaleditsmade+=cpbm_passHelper(actpass,ratioacceptvalue,additionalbelieveborder,minbk,tweakbkmar,killnonhafstretches,
-				    generatenaclips,generaterleedits,generatebaseedits,timing);
-    ++actpass;
-  }
-
-  // pass 2
-  ratioacceptvalue=0.013;
-  AS_miraparams[0].getNonConstSkimParams().sk_basesperhash=29;
-  if(actpass==2){
-    totaleditsmade+=cpbm_passHelper(actpass,ratioacceptvalue,additionalbelieveborder,minbk,tweakbkmar,killnonhafstretches,
-				    generatenaclips,generaterleedits,generatebaseedits,timing);
-    ++actpass;
-  }
-
-  timeval tv;
-  gettimeofday(&tv,nullptr);
-
-  priv_performHashAnalysis("",false,actpass==1, actpass, "", "_pass");
-
-  timing.hashanalysis+=diffsuseconds(tv);
-
-  gettimeofday(&tv,nullptr);
-  killNonHAFCoveredStretchesInReads();
-  timing.killnonhaf+=diffsuseconds(tv);
-
-  for(uint32 ri=0; ri<AS_readpool.size(); ++ri){
-    auto & actread=AS_readpool[ri];
-    if(actread.getLenClippedSeq()>0){
-      auto cI=actread.getClippedSeqAsChar();
-      uint32 numn=0;
-      for(uint32 csl=0; csl<actread.getLenClippedSeq(); ++csl, ++cI){
-	if(toupper(*cI)=='N') ++numn;
-      }
-      float maskratio=100.0/actread.getLenClippedSeq()*numn;
-      cout << "LPerc: " << maskratio << " " << actread.getName() << endl;
-    }else{
-      cout << "LPerc: out " << actread.getName() << endl;
-    }
-  }
-
-  cout << "Saving final results ..." << endl;
-  // TODO: gcc version 4.6.1 (GCC)
-  // oooooops: src/tcmalloc.cc:390] Attempt to free invalid pointer: 0x7a54a0
-  //ofstream ostr("corrected_intermediate_"+boost::lexical_cast<string>(actpass)+".fastq",ios::out);
-  string fname("corrected_intermediate_f.fastq");
-  ofstream ostr(fname,ios::out);
-  Read::setCoutType(Read::AS_FASTQ);
-  for(uint32 ri=0; ri<AS_readpool.size(); ++ri){
-    auto tmpread=AS_readpool[ri];
-    tmpread.performHardTrim();
-    if(tmpread.getRLEValues() != nullptr){
-      tmpread.deRLERead();
-    }
-    ostr << tmpread;
-  }
-
-
-
-  return totaleditsmade;
-}
-
-
-uint32 Assembly::correctPBMainNormal(uint32 startpass)
-{
-  FUNCSTART("Assembly::correctPBMainNormal()");
-
-  uint32 totaleditsmade=0;
-
-  pbc_timing_t timing;
-
-  // pass 1
-  uint32 actpass=startpass;
-  int32 additionalbelieveborder=0;
-  // later passes: already larger kmer and borders, but still problems at microrepeat sites
-  //  so, in later passes ... very rare things: don't believe
-  uint8 minbk=0;
-  bool tweakbkmar=false;
-  bool killnonhafstretches=false;
-  bool generatenaclips=false;
-  bool generaterleedits=false;
-  bool generatebaseedits=true;
-
-  float ratioacceptvalue=0.0072; // ratio < .72 % not accepted
-
-  // using mkfr=4 (instead of 1) here considerably increases the quality of the resulting sequences
-  //  (assemblies have less homopolymer problems) at the expense of worse resolving of low coverage
-  //  regions, hence more data clipped
-  AS_miraparams[0].getNonConstAssemblyParams().as_clip_pec_mkfr=4;
-
-  if(actpass==1){
-    totaleditsmade+=cpbm_passHelper(actpass,ratioacceptvalue,additionalbelieveborder,minbk,tweakbkmar,killnonhafstretches,
-				    generatenaclips,generaterleedits,generatebaseedits,timing);
-    ++actpass;
-  }
-
-  // pass 2
-  ratioacceptvalue=0.013;
-  if(actpass==2){
-    totaleditsmade+=cpbm_passHelper(actpass,ratioacceptvalue,additionalbelieveborder,minbk,tweakbkmar,killnonhafstretches,
-				    generatenaclips,generaterleedits,generatebaseedits,timing);
-    ++actpass;
-  }
-
-  // mkfr=1 at this place counterbalances mkfr=4 above (if set to that high) by resolving again a little bit
-  //  better areas with less coverage. Less data clipped. But seems to have more indels even in good coverage
-  //AS_miraparams[0].getNonConstAssemblyParams().as_clip_pec_mkfr=1;
-
-  // pass 3
-  ratioacceptvalue=0.033;
-  if(actpass==3){
-    totaleditsmade+=cpbm_passHelper(actpass,ratioacceptvalue,additionalbelieveborder,minbk,tweakbkmar,killnonhafstretches,
-				    generatenaclips,generaterleedits,generatebaseedits,timing);
-    ++actpass;
-  }
-
-
-  // optional pass 4
-  // see above, to get better resolution in low cov areas
-  AS_miraparams[0].getNonConstAssemblyParams().as_clip_pec_mkfr=1;
-  if(actpass==4){
-    totaleditsmade+=cpbm_passHelper(actpass,ratioacceptvalue,additionalbelieveborder,minbk,tweakbkmar,killnonhafstretches,
-				    generatenaclips,generaterleedits,generatebaseedits,timing);
-    ++actpass;
-  }
-
-  // ?
-  AS_miraparams[0].getNonConstAssemblyParams().as_clip_pec_mkfr=4;
-
-
-  // pass 5:
-  //  - replace with N (which will hopefully be edited away lateron)
-  //  - non-align clips
-  ratioacceptvalue=0.036;
-  AS_miraparams[0].getNonConstSkimParams().sk_basesperhash=29;
-  additionalbelieveborder=6;
-  killnonhafstretches=true;
-  generatenaclips=true;
-
-  if(actpass==5){
-    totaleditsmade+=cpbm_passHelper(actpass,ratioacceptvalue,additionalbelieveborder,minbk,tweakbkmar,killnonhafstretches,
-				    generatenaclips,generaterleedits,generatebaseedits,timing);
-    ++actpass;
-  }
-
-  // ?
-  AS_miraparams[0].getNonConstAssemblyParams().as_clip_pec_mkfr=1;
-
-  // pass 6 polishing
-  ratioacceptvalue=0.0625;
-  minbk=4;
-  tweakbkmar=true;
-  killnonhafstretches=false;
-  //generatenaclips=false; // ?
-  generatenaclips=false;
-  if(actpass==6){
-    totaleditsmade+=cpbm_passHelper(actpass,ratioacceptvalue,additionalbelieveborder,minbk,tweakbkmar,killnonhafstretches,
-				    generatenaclips,generaterleedits,generatebaseedits,timing);
-    ++actpass;
-  }
-
-//*
-  // pass 7: RLE edits
-  ratioacceptvalue=0.073;
-  generaterleedits=true;
-  generatebaseedits=false;
-  additionalbelieveborder=0;
-  minbk=0;
-  if(actpass==7){
-    totaleditsmade+=cpbm_passHelper(actpass,ratioacceptvalue,additionalbelieveborder,minbk,tweakbkmar,killnonhafstretches,
-				    generatenaclips,generaterleedits,generatebaseedits,timing);
-    ++actpass;
-  }
-
-//*/
-
-  cout << "Total edits made: " << totaleditsmade << '\n';
-
-  cout << timing;
-
-  return totaleditsmade;
-}
-
-
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-uint32 Assembly::cpbm_passHelper(uint32 actpass, float ratioacceptvalue, int32 additionalbelieveborder, uint8 minbk, bool tweakbkmar, bool killnonhafstretches, bool generatenaclips, bool generaterleedits, bool generatebaseedits, pbc_timing_t & timing)
-{
-  cout << "\n\nPB correct pass: " << actpass << " / " << AS_miraparams[0].getAssemblyParams().as_numpasses << '\n';
-
-  if(generatenaclips){
-    AS_naclipl.clear();
-    AS_naclipl.resize(AS_readpool.size(),-1);
-    AS_naclipr.clear();
-    AS_naclipr.resize(AS_readpool.size(),-1);
-  }
-
-  timeval tv;
-  gettimeofday(&tv,nullptr);
-
-  priv_performHashAnalysis("",false,actpass==1, actpass, "", "_pass");
-
-  timing.hashanalysis+=diffsuseconds(tv);
-
-  if(killnonhafstretches) {
-    gettimeofday(&tv,nullptr);
-    killNonHAFCoveredStretchesInReads();
-    timing.killnonhaf+=diffsuseconds(tv);
-
-    for(uint32 ri=0; ri<AS_readpool.size(); ++ri){
-      auto & actread=AS_readpool[ri];
-      if(actread.getLenClippedSeq()>0){
-	auto cI=actread.getClippedSeqAsChar();
-	uint32 numn=0;
-	for(uint32 csl=0; csl<actread.getLenClippedSeq(); ++csl, ++cI){
-	  if(toupper(*cI)=='N') ++numn;
-	}
-	float maskratio=100.0/actread.getLenClippedSeq()*numn;
-	cout << "KPerc: " << maskratio << " " << actread.getName() << endl;
-      }else{
-	cout << "KPerc: out " << actread.getName() << endl;
-      }
-    }
-
-  }
-
-  gettimeofday(&tv,nullptr);
-  findPossibleOverlaps(actpass, "", "_pass");
-  timing.possibleoverlaps+=diffsuseconds(tv);
-
-  gettimeofday(&tv,nullptr);
-  auto editsmade=tryPBCorrect(actpass,
-			      ratioacceptvalue,
-			      additionalbelieveborder,minbk,tweakbkmar,
-			      generatenaclips,generaterleedits,generatebaseedits,
-			      timing);
-  timing.trypbcorrect+=diffsuseconds(tv);
-
-  cout << "Edits made in pass " << actpass << ": " << editsmade << '\n';
-
-  if(AS_miraparams[0].getAssemblyParams().as_dateoutput) dateStamp(cout);
-
-
-  // apply non-align clips
-  // IMPORTANT: do this *before* somehow changing the length of the sequences,
-  //            e.g. before removing gap bases (below)
-  if(generatenaclips){
-    for(uint32 ri=0; ri<AS_readpool.size(); ++ri){
-      if(AS_naclipl[ri]>0){
-	AS_readpool[ri].setLQClipoff(AS_naclipl[ri]);
-      }
-      if(AS_naclipr[ri]>0){
-	AS_readpool[ri].setRQClipoff(AS_naclipr[ri]);
-      }
-    }
-    AS_naclipl.clear();
-    AS_naclipr.clear();
-  }
-
-  cout << "Removing gap bases ..."; cout.flush();
-  for(uint32 ri=0; ri<AS_readpool.size(); ++ri){
-    AS_readpool[ri].removeGapsFromRead();
-  }
-  cout << "done.\n";
-
-  cout << "Saving intermediate results ..." << endl;
-  // TODO: gcc version 4.6.1 (GCC)
-  // oooooops: src/tcmalloc.cc:390] Attempt to free invalid pointer: 0x7a54a0
-  //ofstream ostr("corrected_intermediate_"+boost::lexical_cast<string>(actpass)+".fastq",ios::out);
-  string fname("corrected_intermediate_");
-  fname+=boost::lexical_cast<string>(actpass);
-  fname+=".fastq";
-  ofstream ostr(fname,ios::out);
-  Read::setCoutType(Read::AS_FASTQ);
-  for(uint32 ri=0; ri<AS_readpool.size(); ++ri){
-    auto tmpread=AS_readpool[ri];
-    tmpread.performHardTrim();
-    if(tmpread.getRLEValues() != nullptr){
-      tmpread.deRLERead();
-    }
-    ostr << tmpread;
-  }
-
-  for(uint32 ri=0; ri<AS_readpool.size(); ++ri){
-    auto & actread=AS_readpool[ri];
-    if(actread.getLenClippedSeq()>0){
-      auto cI=actread.getClippedSeqAsChar();
-      uint32 numn=0;
-      for(uint32 csl=0; csl<actread.getLenClippedSeq(); ++csl, ++cI){
-	if(toupper(*cI)=='N') ++numn;
-      }
-      float maskratio=100.0/actread.getLenClippedSeq()*numn;
-      cout << "NPerc: " << maskratio << " " << actread.getName();
-      if(maskratio>25.0){
-	cout << " complete kill";
-	//for(uint32 hcpos=0; hcpos<hafcov.size(); ++hcpos){
-	//	actread.changeBaseInClippedSequence('n',0,hcpos);
-	//}
-	actread.setRQClipoff(actread.getLeftClipoff());
-      }
-      cout << endl;
-     }else{
-      cout << "NPerc: out " << actread.getName() << endl;
-    }
-  }
-
-  return editsmade;
-}
-
-/*************************************************************************
- *
- * Degenerate polymerases lead to bases being sequenced multiple times
- *  instead of the correct number of times, leading to sequences like this
- *  xxxxxxxxxxxAAAAAAAACCCGGGGGGGGTTTTTTTTCCGTTTTTTTTAAATTGGGGGGGGGGGG...
- *
- * While in RLE space the bases may match quite well to other reads, they
- *  obviously have totally wrong base counts which could make RLE correction
- *  less accurate. Therefore, simply cut away the degenerate part of a read
- *
- * Method: Count number of base changes of a non-RLE(!) read in a given
- *  window (I'm using 96 bases). Then a simple cutoff at 48 to create a
- *  basic map of what is 'good', then a bit of 2D signal signal processing,
- *  then look for large 'non-good' areas, done.
- *
- *************************************************************************/
-
-void Assembly::findDegeneratePolymerases(ReadPool & rp)
-{
-  FUNCSTART("void Assembly::findDegeneratePolymerases()");
-
-  //bool docebug=true;
-  bool docebug=false;
-
-  vector<uint32> bchanges;
-  bchanges.reserve(50000);
-
-  vector<uint8> goodmap;
-  goodmap.reserve(50000);
-
-  uint32 bandsize=48;
-
-  cout << "Looking for degenerate polymerases:\n";
-
-  ProgressIndicator<int64> P(0,rp.size());
-  uint32 numdegen=0;
-  for(uint32 ri=0; ri<rp.size(); ++ri){
-    P.increaseprogress();
-    auto & actread=rp[ri];
-
-    CEBUG("FDP " << actread.getName() << endl);
-    if(actread.getLenClippedSeq()<bandsize+10) continue;
-
-    bchanges.clear();
-    bchanges.resize(actread.getLenClippedSeq(),0);
-    goodmap.clear();
-    goodmap.resize(actread.getLenClippedSeq(),255);
-
-
-    auto bI=bchanges.begin()+bandsize;
-    auto * seq = actread.getClippedSeqAsChar()+bandsize;
-    auto * send = seq + actread.getLenClippedSeq()-bandsize;
-    for(;seq < send; ++seq, ++bI){
-      auto * wseq = seq-bandsize;
-      auto * eseq = seq+bandsize;
-      char currbase=0;
-      char numchanges=0;
-      for(; wseq<eseq; ++wseq){
-	if(toupper(*wseq)!=currbase) ++numchanges;
-	currbase=toupper(*wseq);
-      }
-      *bI=numchanges;
-    }
-
-    bI=bchanges.begin();
-    auto gI=goodmap.begin();
-    for(; bI!=bchanges.end(); ++bI, ++gI){
-      if(*bI<48) *gI=0;
-    }
-    // close small holes len 40
-    dilate(goodmap.begin(),goodmap.end(),20);
-    dilate(goodmap.rbegin(),goodmap.rend(),20);
-    // undo the above and additionally eliminate small peaks len 40
-    erode(goodmap.begin(),goodmap.end(),20+20);
-    erode(goodmap.rbegin(),goodmap.rend(),20+20);
-    // back to start
-    dilate(goodmap.begin(),goodmap.end(),20);
-    dilate(goodmap.rbegin(),goodmap.rend(),20);
-
-    bI=bchanges.begin();
-    gI=goodmap.begin();
-    for(; bI!=bchanges.end(); ++bI, ++gI){
-      CEBUG("fdpi: " << bI-bchanges.begin() << "\t" << *bI << "\t" << static_cast<uint16>(*gI) << endl);
-    }
-
-    gI=goodmap.begin()+bandsize;
-    while(gI!=goodmap.end()){
-      if(*gI==0){
-	auto hI=gI;
-	for(; hI!=goodmap.end() && *hI==0; ++hI){}
-	if(hI-gI>100){
-	  CEBUG(actread.getName() << " found degen polymerase: " << gI-goodmap.begin() << endl);
-	  actread.setRQClipoff(gI-goodmap.begin());
-	  ++numdegen;
-	  break;
-	}else{
-	  gI=hI;
-	}
-      }else{
-	++gI;
-      }
-    }
-  }
-
-  P.finishAtOnce();
-
-  cout << "\nClipped " << numdegen << " reads with degenerated polymerases.\n";
-
-  CEBUG("FDPOUT" << endl);
-}
-
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-void Assembly::tpbc_checkRead(Read & actread)
-{
-  FUNCSTART("void Assembly::tpbc_checkRead(Read & actread)");
-
-  auto * ptr= actread.getClippedComplementSeqAsChar();
-  for(uint32 ri=0; ri<actread.getLenClippedSeq(); ++ri, ++ptr){
-    if(!dptools::isValidIUPACStarBase(*ptr)){
-      Read::setCoutType(Read::AS_MAF);
-      cout << actread;
-      BUGIFTHROW(true,"Ouchi X for " << actread.getName() << " with " << *ptr << " (" << static_cast<uint16>(*ptr) << ")");
-    }
-  }
-}
-
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-//#define CEBUG(bla) { cout << bla; cout.flush();}
-uint32 Assembly::tryPBCorrect(uint32 actpass, float ratioacceptvalue, int32 additionalbelieveborder, uint8 minbk, bool tweakbkmar, bool generatenaclips, bool generaterleedits, bool generatebaseedits, pbc_timing_t & timing)
-{
-  FUNCSTART("uint32 Assembly::tryPBCorrect(uint32 actpass, int32 additionalbelieveborder)");
-
-  bool docebug=false;
-
-  uint32 editsmade=0;
-
-  timeval tv;
-  gettimeofday(&tv,nullptr);
-
-  uint64 tsizeneeded=getFileSize(AS_posfmatch_filename)+getFileSize(AS_poscmatch_filename);
-  tsizeneeded/=sizeof(skimhitforsave_t);
-  tsizeneeded*=2;
-
-  vector<skimhitforsave_t> vsh;
-  vsh.reserve(tsizeneeded);
-
-
-//*
-  loadVector(vsh,AS_posfmatch_filename,0);
-
-  // denormalise this part (forward / forward)
-  // also set fwd / rev directions (not done atm by skim)
-  {
-    auto vI=vsh.begin();
-    for(auto nume=vsh.size(); nume>0; --nume, ++vI){
-      vI->setRID1Dir(1);
-      vI->setRID2Dir(1);
-      vsh.push_back(*vI);
-      swap(vsh.back().rid1,vsh.back().rid2);
-      vsh.back().eoffset=-vsh.back().eoffset;
-    }
-  }
-//*/
-
-//*
-  auto oldsize=vsh.size();
-  loadVector(vsh,AS_poscmatch_filename,0);
-
-  // denormalise this part (forward / reverse)
-  // some bits of magic here:
-  //   r1    ------>
-  //   r2        <-----
-  // first becomes
-  //   r2        <-----
-  //   r1    ------>
-  // and this is conceptually identical to
-  //   r2    ------>
-  //   r1        <-----
-  // The added bonus is that the align object will always get the "interesting" read
-  //  in the same, forward direction
-
-  ADSEstimator adse;
-  auto vI=vsh.begin()+oldsize;
-  for(auto nume=vsh.size()-oldsize; nume>0; --nume, ++vI){
-    adse.calcNewEstimateFromSkim(
-      vI->eoffset,
-      AS_readpool[vI->rid1].getLenClippedSeq(),
-      AS_readpool[vI->rid2].getLenClippedSeq(),
-      vI->rid1,
-      vI->rid2,
-      1,
-      -1);
-
-    vI->setRID1Dir(1);
-    vI->setRID2Dir(-1);
-    vsh.push_back(*vI);
-
-    vsh.back().eoffset=adse.getEstimatedRightExpand(vsh.back().rid1);
-    swap(vsh.back().rid1,vsh.back().rid2);
-  }
-
-  //BUGIFTHROW(vsh.size() != vsh.capacity(),"vsh.size() != vsh.capacity() ???");
-
-//*/
-
-  // TODO: maybe sort differently: have longest reads sorted to front? Hmmmm.
-  sort(vsh.begin(),vsh.end(), skimhitforsave_t::stdSortCmp);
-
-  cout << "VSH:\n";
-  for(auto & vshe : vsh){
-    CEBUG(vshe.rid1 << '\t' << vshe.rid2 << '\n');
-  }
-
-  for(auto & s2se : AS_s2saligninfo){
-    s2se.second.alreadyaligned=false;
-  }
-
-  auto lmax=AS_readpool[0].getLenClippedSeq();
-  for(auto ri=1; ri<AS_readpool.size(); ++ri){
-    lmax=max(lmax,AS_readpool[ri].getLenClippedSeq());
-  }
-
-  vector<pbcounts_t> correctorcounts;
-  vector<vector<uint32> > rlecorrectorcounts;
-  correctorcounts.reserve(lmax);
-  rlecorrectorcounts.reserve(lmax);
-
-  vector<Align> chkalign;
-  setupAlignCache(chkalign);
-
-  list<AlignedDualSeq> madsl;
-
-  // these two taken out of tpbc_fillCorrector() as also used in new RLE corrector routines
-  vector<uint8> bkmar;  // believe kmer actrid
-  vector<uint8> bkmor;  // believe kmer otherrid
-  int32 kmersizeused=AS_miraparams[0].getNonConstSkimParams().sk_basesperhash;
-
-  timing.tpbc_setup+=diffsuseconds(tv);
-
-
-  cout << "Correcting " << AS_readpool.size() << " reads via " << vsh.size() << " potential matches:\n";
-  ProgressIndicator<int64> P(0,vsh.size());
-  readid_t actrid=-1;
-  for(auto vI=vsh.cbegin(); vI!=vsh.cend(); ++vI){
-    P.increaseprogress();
-    if(vI->rid1 != actrid){
-      if(actrid != -1){
-	if(generatenaclips) tpbc_generateNonAlignClips(actrid,correctorcounts);
-	if(generaterleedits) tpbc_generateRLEEdits(actpass,actrid,rlecorrectorcounts);
-	if(generatebaseedits) editsmade+=tpbc_generateBaseEdits(actpass,actrid,correctorcounts);
-	tpbc_checkRead(AS_readpool[actrid]);
-      }
-      actrid=vI->rid1;
-      correctorcounts.clear();
-      correctorcounts.resize(AS_readpool[actrid].getLenClippedSeq());
-      rlecorrectorcounts.clear();
-      rlecorrectorcounts.resize(AS_readpool[actrid].getLenClippedSeq());
-    }
-    BUGIFTHROW(vI->getRID1Dir()<0,"vI->getRID1Dir()<0 ???");
-
-    int32 hintbandwidth=-1;
-    uint64 uomapkey=vI->rid1;
-    uomapkey<<=32;
-    uomapkey+=vI->rid2;
-
-    int32 safetydist=35;
-    auto s2sI=AS_s2saligninfo.find(uomapkey);
-    if(s2sI!=AS_s2saligninfo.end()){
-      if(s2sI->second.minbanddistance>=safetydist){
-	hintbandwidth=s2sI->second.bandwidthused/2 - (s2sI->second.minbanddistance-safetydist);
-      }
-    }
-
-    adse.calcNewEstimateFromSkim(
-      vI->eoffset,
-      AS_readpool[vI->rid1].getLenClippedSeq(),
-      AS_readpool[vI->rid2].getLenClippedSeq(),
-      vI->rid1,
-      vI->rid2,
-      vI->getRID1Dir(),
-      vI->getRID2Dir());
-
-    auto estimovl=adse.getEstimatedOverlap();
-    CEBUG("RL pos: " << vI-vsh.begin() << endl);
-    CEBUG("astats bsw " << AS_readpool[vI->rid1].getName() << "\t" << AS_readpool[vI->rid2].getName() << '\t');
-
-    if(actpass>1 && hintbandwidth<0) hintbandwidth=200;
-    if(hintbandwidth<0) hintbandwidth=400;
-
-    if(hintbandwidth>=0) CEBUG("hint ");
-    CEBUG(hintbandwidth << '\t' << estimovl << '\t' << *vI);
-    if(s2sI != AS_s2saligninfo.end() && s2sI->second.alreadyaligned){
-      CEBUG("astats already aligned\n");
-    }else{
-      gettimeofday(&tv,nullptr);
-      computeSWAlign(madsl,vI->rid1,vI->rid2,vI->eoffset,vI->getRID1Dir()*vI->getRID2Dir(),chkalign,hintbandwidth);
-      timing.tpbc_sw+=diffsuseconds(tv);
-
-      if(!madsl.empty()){
-	if(s2sI!=AS_s2saligninfo.end()){
-	  s2sI->second.bandwidthused=madsl.front().getBandwidthUsed();
-	  s2sI->second.minbanddistance=madsl.front().getMinBandDistance();
-	}else{
-	  // gaaaaaaaah, insert() does not give back the correct iterator, need to ...
-	  AS_s2saligninfo.insert(pair<uint64,s2saligninfo_t>(uomapkey,
-							     s2saligninfo_t(madsl.front().getBandwidthUsed(),
-									    madsl.front().getMinBandDistance())));
-	  // ... find it again
-	  s2sI=AS_s2saligninfo.find(uomapkey);
-	}
-	s2sI->second.alreadyaligned=true;
-	CEBUG("astats aar " << vI->rid1 << " " << vI->rid2 << "\tbwu: " << madsl.front().getBandwidthUsed()
-	      << "\tmbd: " << madsl.front().getMinBandDistance()
-	      << endl);
-      }else{
-	// ooooooops? what to do? Let's double the hint via bandwidth used
-	// and set the minbanddistance to a low value so that in the next pass
-	//  we maybe get again an alignment
-	CEBUG("astats missed!\n");
-	s2sI->second.bandwidthused*=2;
-	s2sI->second.minbanddistance=5;
-      }
-
-      if(!madsl.empty()){
-	bkmar.clear();
-	bkmar.resize(madsl.front().getOverlapLen(),0);
-	tpbc_fc_makeBelieveKMERMap(actrid,vI->rid2, madsl.front(), bkmar, kmersizeused, additionalbelieveborder);
-	if(minbk>1) tpbc_fc_minimumBelieveKMerMap(bkmar,minbk);
-
-	bkmor.clear();
-	bkmor.resize(madsl.front().getOverlapLen(),0);
-	tpbc_fc_makeBelieveKMERMap(vI->rid2,actrid, madsl.front(), bkmor, kmersizeused, additionalbelieveborder);
-	if(minbk>1) tpbc_fc_minimumBelieveKMerMap(bkmor,minbk);
-
-	if(tweakbkmar) tpbc_tweakBKMAR(actrid,vI->rid2,madsl.front(),bkmar,bkmor);
-
-	tpbc_fillCorrector(actrid,vI->rid2,madsl.front(),correctorcounts,bkmar,bkmor);
-	tpbc_fillRLECorrector(actrid,vI->rid2,madsl.front(),rlecorrectorcounts,bkmar,bkmor);
-      }
-    }
-  }
-  // catch edits of last read
-  if(actrid != -1){
-    if(generatenaclips) tpbc_generateNonAlignClips(actrid,correctorcounts);
-    if(generaterleedits) tpbc_generateRLEEdits(actpass,actrid,rlecorrectorcounts);
-    if(generatebaseedits) editsmade+=tpbc_generateBaseEdits(actpass,actrid,correctorcounts);
-    tpbc_checkRead(AS_readpool[actrid]);
-  }
-
-  P.finishAtOnce();
-  cout << endl;
-
-  return editsmade;
-}
-//#define CEBUG(bla)
-
-
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-//#define CEBUG(bla) { cout << bla; cout.flush();}
-void Assembly::tpbc_fillRLECorrector(readid_t actrid, readid_t otherrid, AlignedDualSeq & ads, vector<vector<uint32> > & rlecc,std::vector<uint8> & bkmar,std::vector<uint8> & bkmor)
-{
-  FUNCSTART("void Assembly::tpbc_fillRLECorrector(readid_t actrid, readid_t otherrid, AlignedDualSeq & ads, vector<vector<uint32> > & rlecc,std::vector<uint8> & bkmar,std::vector<uint8> & bkmor)");
-
-  BUGIFTHROW(AS_readpool[otherrid].getRLEValues()==nullptr,"AS_readpool[otherrid].getRLEValues()==nullptr");
-
-  bool docebug=false;
-  if(false
-     || AS_readpool[actrid].getName()==readofinterest1
-     || AS_readpool[actrid].getName()==readofinterest2) docebug=true;
-  if(false
-     || AS_readpool[otherrid].getName()==readofinterest1
-     || AS_readpool[otherrid].getName()==readofinterest2) docebug=true;
-
-  CEBUG("fillrle " << AS_readpool[actrid].getName() << " " << AS_readpool[otherrid].getName() << endl);
-
-  auto & oread=AS_readpool[otherrid];
-
-  auto & orlev= *(oread.getRLEValues());
-
-  //if(AS_readpool[otherrid].getName()!="ecopbownH5_15338"){
-  //  CEBUG("SHOWME RLE:\n");
-  //  for(uint32 pi=0; pi<orlev.size(); ++pi){
-  //    cout << "pi: " << pi << "\tv: " << static_cast<uint16>(orlev[pi]) << endl;
-  //  }
-  //}
-
-  bool waaaaahseen=false;
-
-  auto posor=oread.getLeftClipoff();
-  int32 deltaposor=1;
-  if(ads.getSequenceDirection(otherrid)<0){
-    posor=oread.getRightClipoff()-1;
-    deltaposor=-1;
-  }
-  posor+=deltaposor*ads.getOffsetInAlignment(actrid);
-  auto aseq = ads.getSequenceAtOverlapStart(actrid);
-  auto oseq = ads.getSequenceAtOverlapStart(otherrid);
-  auto rccI = rlecc.begin() + ads.getOffsetInAlignment(otherrid);
-  for(uint32 ovli=0; ovli<ads.getOverlapLen(); ++ovli, ++aseq, ++oseq){
-    BUGIFTHROW(rccI==rlecc.end(),"rccI==rlecc.end() ???");
-    BUGIFTHROW(posor<0,"posor<0");
-    BUGIFTHROW(posor>=oread.getLenSeq(),"posor " << posor << " >= oread.getLenSeq() " << oread.getLenSeq());
-    CEBUG("rp: " << rccI-rlecc.begin() << "\tarp: " << AS_readpool[actrid].getAdjustmentPosOfReadPos(rccI-rlecc.begin()) << "\tovli: " << ovli << "\tposor: " << posor << '\t' << *aseq << '\t' << *oseq << '\t');
-
-    char check='/';
-    if(deltaposor>0){
-      check=toupper(oread.getBaseInSequence(posor));
-    }else{
-      check=toupper(dptools::getComplementIUPACBase(oread.getBaseInSequence(posor)));
-    }
-    CEBUG(check);
-    if(*oseq!='*' && *oseq!='#'){
-      if(*oseq==check){
-	CEBUG(" OK");
-      }else{
-	waaaaahseen=true;
-	CEBUG(" waaaaaah!");
-      }
-    }
-
-
-    if(*aseq!=*oseq){
-      CEBUG("\td");
-    }else{
-      CEBUG("\t ");
-    }
-
-
-    CEBUG('\t' << static_cast<int16>(bkmar[ovli]));
-    CEBUG('\t' << static_cast<int16>(bkmor[ovli]));
-    if(*aseq!=*oseq
-       && bkmar[ovli]>0
-       && bkmor[ovli]>0){
-      CEBUG("\touch");
-    }
-
-    CEBUG("\t" << rlecc[rccI-rlecc.begin()].size());
-
-    if(*aseq==*oseq
-       && dptools::isValidACGTBase(*oseq)
-       && bkmar[ovli]>1
-       && bkmor[ovli]>1){
-      // check case and qual! no lower case, no 0 qual as these would be from already corrected/inserted bases
-
-      if(isupper(oread.getBaseInSequence(posor))
-	 && (oread.getQualities())[posor]>0){
-	 // adjustment vector must match!!!   {pos-1, pos, pos+1}
-	 //       if deletion occured next to it, don't take. E.g. {pos-1, pos, pos+2}
-	 //
-	 //       Rationale: e.g.     xATAAAAx   ->  xATAx  (RLE: 114) ->   xAx    (RLE: 1)     -> ouch!
-	 //                           xAAAAAAx   ->  xA**x  (RLE: 5--) ->   xAx    (RLE: 5)     -> OK
-	 //
-	 //       TODO: check what to do on inserted bases: E.g. {pos-1, pos, -1}
-
-	// so, first check whether we're not at the border of the other read ...
-	if(posor>0 && posor<oread.getLenSeq()-1){
-	  // and now for the adjacent adjustment values
-	  if(oread.getAdjustmentPosOfReadPos(posor)-1 == oread.getAdjustmentPosOfReadPos(posor-1)
-	     && oread.getAdjustmentPosOfReadPos(posor)+1 == oread.getAdjustmentPosOfReadPos(posor+1)){
-	    rlecc[rccI-rlecc.begin()].push_back(orlev[posor]);
-	    CEBUG(" plus1 " << static_cast<uint16>(orlev[posor]));
-	    if(orlev[posor]>1) {
-	      CEBUG(" yeah");
-	    }
-	  }
-	}
-      }
-    }
-
-    CEBUG(endl);
-
-    if(*aseq != '*') ++rccI;               // careful: not '#' as this is an gap edited false base of this round
-    if(*oseq != '*') posor+=deltaposor;    // careful: not '#' as this is an gap edited false base of this round
-  }
-
-  BUGIFTHROW(waaaaahseen,"waaaaahseen");
-}
-
-
-
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-//#define CEBUG(bla) { cout << bla; cout.flush();}
-void Assembly::tpbc_fillCorrector(readid_t actrid, readid_t otherrid, AlignedDualSeq & ads, vector<pbcounts_t> & correctorcounts,std::vector<uint8> & bkmar,std::vector<uint8> & bkmor)
-{
-  FUNCSTART("void Assembly::tpbc_fillCorrector(readid_t actrid, AlignedDualSeq & ads, vector<pbcounts_t> & correctorcounts)");
-  BUGIFTHROW(ads.getSequenceDirection(actrid)<0,"ads.getSequenceDirection(actrid)<0");
-
-  bool docebug=false;
-  if(false
-     || AS_readpool[actrid].getName()==readofinterest1
-     || AS_readpool[actrid].getName()==readofinterest2) docebug=true;
-  if(false
-     || AS_readpool[otherrid].getName()==readofinterest1
-     || AS_readpool[otherrid].getName()==readofinterest2) docebug=true;
-
-  CEBUG("belief " << AS_readpool[actrid].getName() << " " << AS_readpool[otherrid].getName() << '\n');
-  auto aseq = ads.getSequenceAtOverlapStart(actrid);
-  auto oseq = ads.getSequenceAtOverlapStart(otherrid);
-  auto ccI = correctorcounts.begin() + ads.getOffsetInAlignment(otherrid);
-  auto ccssI = ccI;  // cc safe start
-  for(uint32 ovli=0; ovli<ads.getOverlapLen(); ++ovli, ++aseq, ++oseq){
-    // beware: no 'continue' in this loop! because of  "if(*aseq != '*') ++ccI;" at end
-
-    BUGIFTHROW(ccI==correctorcounts.end(),"ccI==correctorcounts.end() ???");
-    CEBUG("rp: " << ccI-correctorcounts.begin() << "\tarp: " << AS_readpool[actrid].getAdjustmentPosOfReadPos(ccI-correctorcounts.begin()) << "\tovli: " << ovli << '\t' << *aseq << '\t' << *oseq << '\t');
-    if(*aseq!=*oseq){
-      CEBUG('d');
-    }else{
-      CEBUG(' ');
-    }
-
-    CEBUG('\t' << static_cast<int16>(bkmar[ovli]));
-    CEBUG('\t' << static_cast<int16>(bkmor[ovli]));
-    if(*aseq!=*oseq
-       && bkmar[ovli]>0
-       && bkmor[ovli]>0){
-      CEBUG("\touch");
-    }
-
-    if(*aseq!=*oseq || ovli+1==ads.getOverlapLen()){
-      // yeah, well, the ovli+1 above will be, strictly speaking, wrong if the last characters
-      //  of an alignment did not match. Then again: does not really matter for the purpose
-      //  whether the length of the match was n or n-1
-      // but at leas we save ourselves a post-loop check
-      if(ccI-ccssI>=40){
-	for(; ccssI!=ccI; ++ccssI) ++ccssI->cqsafe;
-      }
-      ccssI=ccI+1;
-    }
-
-
-    bool cancorrect=true;
-    bool isbasechange=false;
-    bool isinsert=false;
-    if(*aseq!=*oseq
-       && bkmar[ovli]==0
-       && bkmor[ovli]>0){
-      // make sure that if we are in an indel situation, that the bkmor are set for the whole
-      //  run +/-1 position
-      if(dptools::isValidACGTNBase(*aseq) && dptools::isValidACGTBase(*oseq)){
-	isbasechange=true;
-      }else if(*oseq=='*' && dptools::isValidACGTNBase(*aseq)){
-	cancorrect=false;
-	auto * checkptr=oseq;
-	uint32 dx=0;
-	// move to begin of run
-	while(ovli-dx>=0 && (*checkptr=='*' || *checkptr==*aseq)) {--dx; --checkptr;}
-	// check front set?
-	if(ovli-dx>=0 && bkmor[ovli-dx]){
-	  checkptr=oseq;
-	  dx=0;
-	  // move to end of run
-	  while(ovli+dx<ads.getOverlapLen() && (*checkptr=='*' || *checkptr==*aseq)) {++dx; ++checkptr;}
-	  if(ovli+dx<ads.getOverlapLen() && bkmor[ovli+dx]){
-	    cancorrect=true;
-	  }
-	}
-	if(cancorrect){
-	  isbasechange=true;
-	}else{
-	  CEBUG("\trunnocorrect");
-	}
-      }else if(ovli>0 && *aseq=='*' && *(aseq-1)!='*' && dptools::isValidACGTNBase(*oseq)){
-	// above ... ovli >0 means: even if we had a gap at the first place (which will hopefully never
-	//  happen anyway, do not try to correct
-	// above ... *(aseq-1)!='*' means: if we already were in a run, do not try to correct (first gap
-	//  of run will have done it's job already. Can use aseq-1 directly because of ovli>0, so we're
-	//  not at the beginning of the sequence anyway
-
-	// TODO: check bkmor in acteq gap-run for full belief (bit like for dx check above)
-
-	isinsert=true;
-	string potential_insert;
-	auto * iaptr=aseq;
-	auto * ioptr=oseq;
-	for(; *iaptr=='*'; ++iaptr, ++ioptr){
-	  // careful here: earlier reads may have been corrected toward a gap, in the Align sequences
-	  //  those show up as '#' and we do not want these!
-	  if(*ioptr!='#') potential_insert+=*ioptr;
-	}
-	// should always be true, but you never know ...
-	if(!potential_insert.empty()){
-	  bool foundinsert=false;
-	  for(auto & ie : ccI->cxia){
-	    if(ie.what==potential_insert){
-	      foundinsert=true;
-	      ++ie.count;
-	      break;
-	    }
-	  }
-	  if(!foundinsert){
-	    ccI->cxia.push_back(pbcounts_t::insertafter_t(potential_insert));
-	  }
-	}
-      }
-
-      if(cancorrect){
-	if(isbasechange){
-	  CEBUG("\tcancorrect_bc");
-	  if(*aseq != '*'){
-	    switch(*oseq){
-	    case 'A' :
-	      ccI->cxa+=1;
-	      break;
-	    case 'C' :
-	      ccI->cxc+=1;
-	      break;
-	    case 'G' :
-	      ccI->cxg+=1;
-	      break;
-	    case 'T' :
-	      ccI->cxt+=1;
-	      break;
-	    case '*' :
-	      ccI->cxgap+=1;
-	      break;
-	    case '#' :
-	      // 'oldgap' marker from AlignedDualSeq ... well, rather newly inserted gap in already edited read
-	      // intentionally do nothing atm
-	      break;
-	    default :
-	      // bug if not IUPAC (for IUPAC we don't do anything)
-	      BUGIFTHROW(!dptools::isValidIUPACBase(*oseq),"Uh oh ... " << *oseq << "(" << static_cast<uint16>(*oseq) << ") is not a IUPAC base. At this stage???\n" << ads);
-	    }
-	  }
-	}else if(isinsert){
-	  CEBUG("\tcancorrect_is");
-	}
-      }
-    }
-
-    CEBUG(endl);
-
-    if(*aseq != '*') ++ccI;  // careful: not '#' as this is an gap edited false base of this round
-  }
-}
-//#define CEBUG(bla)
-
-
-
-/*************************************************************************
- *
- * ecopbownH5_38193, around RLE pos 280 (nonRLE 390)
- *
- * CTGCTCACGCATACGCACG   reality
- * CTGCTC  GCATA GCACG   read
- *
- * CTGCT*  *CA*AcGCACG   after pass 1
- *
- * Gaaah ... the deleted bases are from "spurious" misalignments with other reads, reaching
- * the threshold level of 2 minedits to support the edit. This continues to:
- *
- * CTGCTCACGCATACGCACG   reality
- * CTGCTC******AcGCACG   pass 5
- *       rrrrr rrrrr     <--- microrepeat
- *
- * The microrepeat ACGAtACGAc then creates the belief map (against a 'true' read)
- *
- * rp: 233 arp: 226        ovli: 233       C       C               5       14
- * rp: 234 arp: 227        ovli: 234       T       T               5       14
- * rp: 235 arp: 228        ovli: 235       G       G               5       14
- * rp: 236 arp: 229        ovli: 236       C       C               5       14
- * rp: 237 arp: 230        ovli: 237       T       T               5       14
- * rp: 238 arp: 231        ovli: 238       C       C               5       14
- * rp: 239 arp: 232        ovli: 239       *       A       d       4       14      ouch
- * rp: 239 arp: 232        ovli: 240       *       C       d       3       14      ouch
- * rp: 239 arp: 232        ovli: 241       *       G       d       2       14      ouch
- * rp: 239 arp: 232        ovli: 242       *       C       d       1       14      ouch
- * rp: 239 arp: 232        ovli: 243       *       A       d       0       14
- * rp: 239 arp: 232        ovli: 244       *       T       d       0       14
- * rp: 239 arp: 232        ovli: 245       A       A               0       14
- * rp: 240 arp: 233        ovli: 246       C       C               0       14
- *
- * respectively
- *
- * rp: 233 arp: 226        ovli: 233       C       C               5       14
- * rp: 234 arp: 227        ovli: 234       T       T               5       14
- * rp: 235 arp: 228        ovli: 235       G       G               5       14
- * rp: 236 arp: 229        ovli: 236       C       C               5       14
- * rp: 237 arp: 230        ovli: 237       T       T               5       14
- * rp: 238 arp: 231        ovli: 238       C       C               5       14
- * rp: 239 arp: 232        ovli: 239       *       A       d       4       14      ouch
- * rp: 239 arp: 232        ovli: 240       *       C       d       0       14
- * rp: 239 arp: 232        ovli: 241       *       G       d       0       14
- * rp: 239 arp: 232        ovli: 242       *       C       d       0       14
- * rp: 239 arp: 232        ovli: 243       *       A       d       0       14
- * rp: 239 arp: 232        ovli: 244       *       T       d       0       14
- * rp: 239 arp: 232        ovli: 245       A       A               0       14
- * rp: 240 arp: 233        ovli: 246       C       C               0       14
- *
- * when using a minimum belief value of 4 in pass 5.
- *
- * minedits 3 solves the problem, but at the price of
- * - slightly more coverage needed
- * - and worse performance in lower coverage areas (14x and lower)
- *
- * minimum belief value of 5 would also solve the problem (in this case),
- *  but not for slightly longer microrepeats. Also would worsen performance in
- *  lower coverage areas.
- *
- *
- * So, try the following: in polishing passes (>=5), search for gap / base
- *  discrepancies where at least one position in the bkmar is 0 (maybe also
- *  one pos before or behind the stretch?) and all the  bkmor are >= 6 (or
- *  other, higher value?)
- * If that is the case, set all bkmar positions in the affected gap / base stretch to 0
- * Like so:
- *
- * rp: 237 arp: 230        ovli: 237       T       T               5       14
- * rp: 238 arp: 231        ovli: 238       C       C               5       14
- * rp: 239 arp: 232        ovli: 239       *       A       d       0       14      // newly set to 0, no ouch!
- * rp: 239 arp: 232        ovli: 240       *       C       d       0       14
- * rp: 239 arp: 232        ovli: 241       *       G       d       0       14
- * rp: 239 arp: 232        ovli: 242       *       C       d       0       14
- * rp: 239 arp: 232        ovli: 243       *       A       d       0       14
- * rp: 239 arp: 232        ovli: 244       *       T       d       0       14
- * rp: 239 arp: 232        ovli: 245       A       A               0       14
- * rp: 240 arp: 233        ovli: 246       C       C               0       14
- *
- * Then the normal fillCorrector routines should be able to handle this correctly
- *************************************************************************/
-
-//#define CEBUG(bla) { cout << bla; cout.flush();}
-void Assembly::tpbc_tweakBKMAR(readid_t actrid, readid_t otherrid, AlignedDualSeq & ads, vector<uint8> & bkmar,vector<uint8> & bkmor)
-{
-  FUNCSTART("void Assembly::tpbc_tweakBKMAR(readid_t actrid, readid_t otherrid, AlignedDualSeq & ads, vector<uint8> & bkmar,vector<uint8> & bkmor)");
-  BUGIFTHROW(ads.getSequenceDirection(actrid)<0,"ads.getSequenceDirection(actrid)<0");
-
-  bool docebug=false;
-  if(false
-     || AS_readpool[actrid].getName()==readofinterest1
-     || AS_readpool[actrid].getName()==readofinterest2) docebug=true;
-  if(false
-     || AS_readpool[otherrid].getName()==readofinterest1
-     || AS_readpool[otherrid].getName()==readofinterest2) docebug=true;
-
-  CEBUG("tweak " << AS_readpool[actrid].getName() << " " << AS_readpool[otherrid].getName() << '\n');
-  auto aseq = ads.getSequenceAtOverlapStart(actrid);
-  auto oseq = ads.getSequenceAtOverlapStart(otherrid);
-  for(uint32 ovli=0; ovli<ads.getOverlapLen(); ++ovli, ++aseq, ++oseq){
-    // beware: no 'continue' in this loop! because of  "if(*aseq != '*') ++ccI;" at end
-
-    CEBUG("ovli: " << ovli << '\t' << *aseq << '\t' << *oseq << '\t');
-    if(*aseq!=*oseq){
-      CEBUG('d');
-    }else{
-      CEBUG(' ');
-    }
-
-    CEBUG('\t' << static_cast<int16>(bkmar[ovli]));
-    CEBUG('\t' << static_cast<int16>(bkmor[ovli]));
-
-    const uint8 minbkmor=6;
-
-    // this will run for every pos of a gap / base stretch ... I don't care atm
-    if(*aseq!=*oseq
-       && *aseq=='*'
-       && bkmar[ovli]==0
-       && bkmor[ovli]>=minbkmor){
-      CEBUG("\tptweak");
-      auto * checkptr=aseq;
-      uint32 dx=0;
-      // move to begin of run
-      while(ovli-dx>=0 && *checkptr=='*' && bkmor[ovli-dx]>=minbkmor) {--dx; --checkptr;}
-      checkptr=aseq;
-      uint32 dy=0;
-      // move to end of run
-      while(ovli+dy<ads.getOverlapLen() && *checkptr=='*' && bkmor[ovli+dy]>=minbkmor) {++dy; ++checkptr;}
-
-      CEBUG(" " << ovli-dx << " - " << ovli+dy);
-      // eliminate bkmar values
-      for(uint32 ei=ovli-dx; ei<ovli+dy; ++ei) bkmar[ei]=0;
-    }
-
-    CEBUG(endl);
-  }
-}
-//#define CEBUG(bla)
-
-
-
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-//#define CEBUG(bla) { cout << bla; cout.flush();}
-void Assembly::tpbc_fc_makeBelieveKMERMap(readid_t arid, readid_t orid, AlignedDualSeq & ads, vector<uint8> & bkmm, int32 kmersizeused, int32 additionalbelieveborder)
-{
-  FUNCSTART("void Assembly::tpbc_fc_makeBelieveKMERMap(readid_t arid, readid_t orid, AlignedDualSeq & ads, vector<uint8> & bkmm, int32 kmersizeused, int32 additionalbelieveborder)");
-
-  // may have been reason for an error dumped:
-  // because of for loop below: for(int32 ovli=0; ovli<ads.getOverlapLen()-kmersizeused; ...)
-  if(kmersizeused>=ads.getOverlapLen()) return;
-
-  try{
-    bool docebug=false;
-    if(false
-       || AS_readpool[arid].getName()==readofinterest1
-       || AS_readpool[arid].getName()==readofinterest2) docebug=true;
-    if(false
-       || AS_readpool[orid].getName()==readofinterest1
-       || AS_readpool[orid].getName()==readofinterest2) docebug=true;
-
-    CEBUG("makeBelieve " << AS_readpool[arid].getName() << "\t" << arid << " " << orid << '\n' << ads << '\n' << "adsend" << '\n');
-
-    auto offsettooverlap=ads.getOffsetInAlignment(orid);
-    if(offsettooverlap==0) offsettooverlap=ads.getOffsetInAlignment(arid);
-
-    CEBUG("offsettooverlap: " << offsettooverlap << '\n');
-
-    int32 offsetintoread=0;
-    int32 deltax=1;
-    bool isfwd=ads.getSequenceDirection(arid)>0;
-    if(isfwd){
-      offsetintoread=AS_readpool[arid].getLeftClipoff()+ads.getOffsetInAlignment(orid);
-    }else{
-      deltax=-1;
-      offsetintoread=AS_readpool[arid].getRightClipoff()-1-ads.getOffsetInAlignment(orid);
-    }
-
-    auto & actread=AS_readpool[arid];
-
-    //Read::setCoutType(Read::AS_TEXT);
-    //CEBUG(actread << '\n');
-
-    auto * seq=ads.getSequenceAtOverlapStart(arid);
-    for(int32 ovli=0; ovli<ads.getOverlapLen()-kmersizeused; ++ovli, ++seq){
-      CEBUG("ovli " << ovli << "\toir " << offsetintoread << "\tarp: " << AS_readpool[arid].getAdjustmentPosOfReadPos(offsetintoread) << "\tseq: " << *seq);
-      if(*seq != '*'){
-	bool isok=true;
-	if(isfwd){
-	  if(!actread.getBPosHashStats(offsetintoread).fwd.isValid()
-	     || actread.getBPosHashStats(offsetintoread).fwd.getFrequency()<2
-	     || !actread.getBPosHashStats(offsetintoread).fwd.hasConfirmedFwdRev()){
-	    isok=false;
-	  }
-	}else{
-	  if(!actread.getBPosHashStats(offsetintoread).rev.isValid()
-	     || actread.getBPosHashStats(offsetintoread).rev.getFrequency()<2
-	     || !actread.getBPosHashStats(offsetintoread).rev.hasConfirmedFwdRev()){
-	    isok=false;
-	  }
-	}
-	if(isok){
-	  // first need to find out how many bases we will really need to cover as
-	  //  the overlap string can be AA*********ACGATACATATATCCTA which is significantly
-	  //  different from 'kmersizeused'
-	  uint32 checklen=0;
-	  {
-	    auto * cseq=seq;
-	    for(uint32 seenbases=0; seenbases<kmersizeused && ovli+checklen < ads.getOverlapLen(); ++checklen, ++cseq){
-	      if(*cseq != '*' && *cseq != '#') {
-		++seenbases;
-	      }
-	    }
-	  }
-
-	  if(checklen>1){
-	    uint32 leftborder=1;
-	    for(;leftborder<checklen && (*(seq+leftborder)=='*' || *(seq+leftborder)=='#'); ++leftborder) {}
-	    char bseq=*(seq+leftborder);
-	    for(; leftborder<checklen && *(seq+leftborder) == bseq; ++leftborder) {}
-	    uint32 rightborder=checklen-1;
-	    for(;rightborder>0 && (*(seq+rightborder)=='*' || *(seq+rightborder)=='#'); --rightborder) {}
-	    bseq=*(seq+rightborder);
-	    for(; rightborder>0 && *(seq+rightborder) == bseq; --rightborder) {}
-	    CEBUG("\tlen " << rightborder-leftborder);
-	    CEBUG("\tfrom " << leftborder+ovli << "\tto " << rightborder+ovli);
-	    leftborder+=additionalbelieveborder;
-	    rightborder-=additionalbelieveborder;
-	    for(; leftborder<=rightborder; ++leftborder){
-	      BUGIFTHROW(ovli+leftborder>=bkmm.size(),"ovli " << ovli << " + leftborder " << leftborder << " >= bkmm.size() " << bkmm.size() << " ???");
-	      bkmm[ovli+leftborder]+=1;
-	    }
-	  }
-	}
-	offsetintoread+=deltax;
-      }
-      CEBUG(endl);
-    }
-  }
-  catch(Notify n){
-    cout << "Houston, we have a problem.\n";
-    cout << "arid: " << arid << "\torid: " << orid << endl;
-    cout << "bkmm.size(): " << bkmm.size()
-	 << "\tkmersizeused:" << kmersizeused
-	 << "\tadditionalbelieveborder:" << additionalbelieveborder << endl;
-    Read::setCoutType(Read::AS_FASTQ);
-    cout << AS_readpool[arid] << endl;
-    cout << AS_readpool[orid] << endl;
-    cout << "ADS:\n" << ads << endl;
-  }
-}
-
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-void Assembly::tpbc_fc_minimumBelieveKMerMap(vector<uint8> & bkmm, uint8 minbk)
-{
-  for(auto & bke : bkmm){
-    if(bke<minbk) bke=0;
-  }
-}
-
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-//#define CEBUG(bla) { cout << bla; cout.flush();}
-uint32 Assembly::tpbc_generateRLEEdits(uint32 actpass, readid_t actrid, vector<vector<uint32>> & rlecc)
-{
-  FUNCSTART("uint32 Assembly::tpbc_generateRLEEdits(uint32 actpass, readid_t actrid, vector<vector<uint32>> & rlecc)");
-
-  BUGIFTHROW(AS_readpool[actrid].getRLEValues()==nullptr,"AS_readpool[actrid].getRLEValues()==nullptr");
-
-  bool docebug=false;
-  //bool docebug=true;
-  if(false
-     || AS_readpool[actrid].getName()==readofinterest1
-     || AS_readpool[actrid].getName()==readofinterest2) docebug=true;
-
-  auto & actread=AS_readpool[actrid];
-
-  CEBUG("ccr " << actread.getName() << "\tlc: " << actread.getLeftClipoff() << "\trc: " << actread.getRightClipoff() << '\n');
-
-  // first, add our own RLE values to the lot
-  {
-    auto * aseq=actread.getClippedSeqAsChar();
-    auto * eptr=aseq+actread.getLenClippedSeq();
-    auto rvI=(actread.getRLEValues())->begin()+actread.getLeftClipoff();
-    auto rqI=actread.getQualities().begin()+actread.getLeftClipoff();
-    auto rccI=rlecc.begin();
-    uint32 actpos=actread.getLeftClipoff();
-    for(; aseq!=eptr; ++aseq, ++rvI, ++rqI, ++rccI, ++actpos){
-      BUGIFTHROW(rccI==rlecc.end(),"rccI==rlecc.end()");
-      if(dptools::isValidACGTBase(*aseq) && isupper(*aseq) && *rqI!=0){
-	// same rule as for filling RLE corrector: need to have adjustments left and right concur
-	if(actpos>0 && actpos<actread.getLenClippedSeq()-1){
-	  if(actread.getAdjustmentPosOfReadPos(actpos)-1 == actread.getAdjustmentPosOfReadPos(actpos-1)
-	     && actread.getAdjustmentPosOfReadPos(actpos)+1 == actread.getAdjustmentPosOfReadPos(actpos+1)){
-	    rccI->push_back(*rvI);
-	  }
-	}
-      }
-    }
-    BUGIFTHROW(rccI!=rlecc.end(),"rccI!=rlecc.end()");
-  }
-
-  // get to the fun stuff: if all RLE values the same, perfect. If not, then let's make a choice.
-  {
-    auto * aseq=actread.getClippedSeqAsChar();
-    uint32 actpos=actread.getLeftClipoff();
-    auto rvI=(const_cast<vector<uint8> *>(actread.getRLEValues()))->begin()+actread.getLeftClipoff();
-    for(auto rccI=rlecc.begin(); rccI!=rlecc.end(); ++rccI, ++actpos, ++aseq, ++rvI){
-      CEBUG("rpos: " << rccI-rlecc.begin() << '\t' << rccI->size() << '\t' << *aseq << "\tRLE" << static_cast<uint16>(*rvI));
-      if(rccI->empty()){
-	CEBUG("\tempty\n");
-      }else{
-	bool allsame=true;
-	auto firstval=rccI->front();
-	for(auto & rval : *rccI){
-	  if(rval!=firstval){
-	    allsame=false;
-	    break;
-	  }
-	}
-	uint32 choice=0;
-	if(allsame){
-	  CEBUG("\tall same: " << firstval);
-	  choice=firstval;
-	}else{
-	  CEBUG("\tnot same {");
-	  sort(rccI->begin(), rccI->end());
-	  uint32 currval=rccI->front();
-	  uint32 maxval=currval;
-	  uint32 currcount=0;
-	  uint32 maxcount=0;
-	  uint64 totalval=0;
-	  bool istie=false;
-	  for(auto & rval : *rccI){
-	    CEBUG(" " << rval);
-	    if(rval==currval){
-	      ++currcount;
-	    }else{
-	      if(maxcount==currcount){
-		istie=true;
-	      }else if(currcount>maxcount){
-		maxcount=currcount;
-		maxval=currval;
-		istie=false;
-	      }
-	      currval=rval;
-	      currcount=1;
-	    }
-	    totalval+=rval;
-	  }
-	  if(maxcount==currcount){
-	    istie=true;
-	  }else if(currcount>maxcount){
-	    maxcount=currcount;
-	    maxval=currval;
-	    istie=false;
-	  }
-	  float avg=static_cast<float>(totalval)/rccI->size();
-	  uint32 avgi=avg+0.5f;
-	  uint32 median=0;
-	  if(rccI->size() % 2){
-	    median=(*rccI)[rccI->size()/2];
-	  }else{
-	    median=static_cast<uint32>(static_cast<float>((*rccI)[rccI->size()/2]+(*rccI)[rccI->size()/2-1])/2+0.5f);
-	  }
-	  CEBUG(" }");
-	  CEBUG("\tmxc: " << maxcount << "/" << maxval << " med: " << median << " avg: " << avg);
-
-	  if(avgi==median && median == maxval){
-	    CEBUG(" uni");
-	    choice=avgi;
-	  }else{
-	    CEBUG(" shoot");
-	    if(avgi==median ||
-	       avgi==maxval){
-	      choice=avgi;
-	    }else if(median==maxval){
-	      choice=median;
-	    }else{
-	      // ooooops, all three are different???
-	      // atm take median
-	      CEBUG("wtf");
-	      choice=median;
-	    }
-	  }
-	}
-	CEBUG("\tch: " << choice);
-	if(choice!=*rvI){
-	  CEBUG(" rlech!");
-	  *rvI=choice;
-	}
-	CEBUG(endl);
-      }
-    }
-  }
-
-  return 0;
-}
-
-
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-//#define CEBUG(bla) { cout << bla; cout.flush();}
-uint32 Assembly::tpbc_generateBaseEdits(uint32 actpass, readid_t actrid, vector<pbcounts_t> & correctorcounts)
-{
-  FUNCSTART("uint32 Assembly::generateBaseEdits(readid_t actrid, vector<pbcounts_t> & correctorcounts)");
-
-  bool docebug=false;
-  //bool docebug=true;
-  if(false
-     || AS_readpool[actrid].getName()==readofinterest1
-     || AS_readpool[actrid].getName()==readofinterest2) docebug=true;
-
-  uint32 editsmade=0;
-
-  auto & actread=AS_readpool[actrid];
-
-//*
-  // get rid of conflict positions (+/-1) as this could be a clear sign of 'problems'
-  // well, except in n-stretches, where alignment uncertainties may lead to disagreements
-
-  //if(actpass!=5)
-
-  uint32 numminedits=3;
-  bool prekillconflict=true;
-  bool preremovelower=false;
-
-  if(actpass>=5) {
-    preremovelower=true;
-    numminedits=4;
-  }
-
-  CEBUG("ccu vector for " << actrid << '\t' << actread.getName() << '\n');
-  {
-    pbcounts_t pbczero;
-    auto * aseq=actread.getClippedSeqAsChar();
-    uint32 actcpos=0;
-    for(auto ccI=correctorcounts.begin(); ccI != correctorcounts.end(); ++ccI, ++aseq, ++actcpos){
-      CEBUG("acp: " << actcpos << '\t' << actread.getAdjustmentPosOfReadPos(actread.calcClippedPos2RawPos(actcpos)) << '\t' << actread.getBaseInClippedSequence(actcpos) << '\t' << *ccI << '\t');
-      if(toupper(*aseq)!='N'){
-
-	if(preremovelower){
-	  if(ccI->cxa && ccI->cxa<numminedits){
-	    ccI->cxa=0;
-	    CEBUG(" prlA");
-	  }
-	  if(ccI->cxc && ccI->cxc<numminedits){
-	    ccI->cxc=0;
-	    CEBUG(" prlC");
-	  }
-	  if(ccI->cxg && ccI->cxg<numminedits){
-	    ccI->cxg=0;
-	    CEBUG(" prlG");
-	  }
-	  if(ccI->cxt && ccI->cxt<numminedits){
-	    ccI->cxt=0;
-	    CEBUG(" prlT");
-	  }
-	  if(ccI->cxgap && ccI->cxgap<numminedits){
-	    ccI->cxgap=0;
-	    CEBUG(" prl*");
-	  }
-	  if(ccI->cxia.size()>1){
-	    auto iI=ccI->cxia.begin();
-	    while(iI!=ccI->cxia.end()){
-	      if(iI->count < 4){
-		CEBUG(" prlI " << iI->what);
-		iI=ccI->cxia.erase(iI);
-	      }else{
-		++iI;
-	      }
-	    }
-	  }
-	}
-
-	uint8 epos=0;
-	epos+=ccI->cxa>=numminedits;
-	epos+=ccI->cxc>=numminedits;
-	epos+=ccI->cxg>=numminedits;
-	epos+=ccI->cxt>=numminedits;
-	epos+=ccI->cxgap>=numminedits;
-	// Nope, can have good inserts with good edits!
-	// epos+=(ccI->cxia.size()==1 && ccI->cxia.front().count>4);
-	if(epos>1){
-	  if(ccI!=correctorcounts.begin()) *(ccI-1)=pbczero;
-	  *ccI=pbczero;
-	  if(ccI+1!=correctorcounts.end()) *(ccI+1)=pbczero;
-	}
-      }
-      CEBUG(endl);
-    }
-  }
-//*/
-
-  CEBUG("cc vector for " << actrid << '\t' << actread.getName() << '\n');
-
-  uint32 actcpos=correctorcounts.size()-1;
-  for(auto ccI=correctorcounts.rbegin(); ccI != correctorcounts.rend(); ++ccI, --actcpos){
-    CEBUG("acp: " << actcpos << '\t' << actread.getAdjustmentPosOfReadPos(actread.calcClippedPos2RawPos(actcpos)) << '\t' << actread.getBaseInClippedSequence(actcpos) << '\t' << *ccI);
-
-    uint8 epos=0;
-    char cchar=toupper(actread.getBaseInClippedSequence(actcpos));
-
-    // due to the 'N'-stretch uncertainty, we need to act with a detour
-    auto maxvotes=max(ccI->cxa,max(ccI->cxc,max(ccI->cxg,max(ccI->cxt,ccI->cxgap))));
-    if(maxvotes>=numminedits){
-      if(ccI->cxa == maxvotes){
-	++epos;
-	actread.changeBaseInClippedSequence('a',0,actcpos);
-
-	// TODO: bang here, kill the RLE values, too!
-
-	CEBUG("\tccedit A");
-      }
-      if(ccI->cxc == maxvotes){
-	++epos;
-	actread.changeBaseInClippedSequence('c',0,actcpos);
-	CEBUG("\tccedit C");
-      }
-      if(ccI->cxg == maxvotes){
-	++epos;
-	actread.changeBaseInClippedSequence('g',0,actcpos);
-	CEBUG("\tccedit G");
-      }
-      if(ccI->cxt == maxvotes){
-	++epos;
-	actread.changeBaseInClippedSequence('t',0,actcpos);
-	CEBUG("\tccedit T");
-      }
-      if(ccI->cxgap >= maxvotes){
-	++epos;
-	actread.changeBaseInClippedSequence('*',0,actcpos);
-	CEBUG("\tccedit newgap");
-      }
-      if(epos>1){
-	if(cchar=='N'){
-	  // whoooops, shouldn't happen all to often. But if it does, undo the edit
-	  actread.changeBaseInClippedSequence('n',0,actcpos);
-	  CEBUG(" ccedit UNDO");
-	  // make sure the potential insert does not happen
-	  cchar='Z';
-	}else{
-	  BUGIFTHROW(true,"epos>1, no N ???");
-	}
-      }
-    }
-
-    // do we need to insert something?
-    // it is perfectly valid to have a change of a base plus insert,
-    //  but for everything else, no inserts please
-    if(ccI->cxia.size() == 1 && ccI->cxia.front().count >= 4){
-      CEBUG("\tccedit insert " << ccI->cxia.front().what);
-      for(auto sI=ccI->cxia.front().what.rbegin(); sI!=ccI->cxia.front().what.rend(); ++sI){
-	actread.insertBaseInClippedSequence(tolower(*sI),0,actcpos,false);
-      }
-      ++epos;
-    }
-    editsmade+=epos;
-
-    CEBUG(endl);
-  }
-
-  return editsmade;
-}
-
-// ecopbownH5_26908  at ~ 550 ... probably due to ecopbownH5_15286 low complexity errors at end
-
-// small_assembly_orig: gap4 @ 13340 ... some TGGT reads miscorrected to T*GT after 5 rounds :-(((
-//    +15 ecopbownH5_25906
-//    +16 ecopbownH5_29223
-//    -17 ecopbownH5_38640
-
-
-
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-void Assembly::killNonHAFCoveredStretchesInReads()
-{
-  FUNCSTART("void Assembly::killNonHAFCoveredStretchesInReads()");
-
-  vector<uint8> hafcov;
-  for(uint32 ri=0; ri<AS_readpool.size();++ri){
-    auto & actread=AS_readpool[ri];
-    hafcov.clear();
-    hafcov.resize(actread.getLenClippedSeq(),0);
-    for(auto & te : actread.getTags()){
-      if(te.identifier==Read::REA_tagentry_idHAF2
-	 || te.identifier==Read::REA_tagentry_idHAF3
-	 || te.identifier==Read::REA_tagentry_idHAF4
-	 || te.identifier==Read::REA_tagentry_idHAF5
-	 || te.identifier==Read::REA_tagentry_idHAF6
-	 || te.identifier==Read::REA_tagentry_idHAF7){
-	int32 from=te.from;
-	from-=actread.getLeftClipoff();
-	int32 to=te.to;
-	to-=actread.getLeftClipoff();
-	for(; from<=to; ++from){
-	  if(from>=0 && from<hafcov.size()) hafcov[from]=1;
-	}
-      }
-    }
-
-    uint32 nummasked=0;
-    for(uint32 hcpos=0; hcpos<hafcov.size(); ++hcpos){
-      if(hafcov[hcpos]==0) {
-	++nummasked;
-	actread.changeBaseInClippedSequence('n',0,hcpos);
-
-	// TODO: bang here, kill the RLE values, too!
-
-      }
-    }
-    float maskratio=100.0/hafcov.size()*nummasked;
-    cout << "NMask: " << ri << '\t' << actread.getName() << '\t' << nummasked << " / " << hafcov.size()
-	 << " (" << maskratio << "%)";
-    if(maskratio>50.0){
-      cout << " complete kill";
-      //for(uint32 hcpos=0; hcpos<hafcov.size(); ++hcpos){
-      //	actread.changeBaseInClippedSequence('n',0,hcpos);
-      //}
-      actread.setRQClipoff(actread.getLeftClipoff());
-    }
-    cout << endl;
-  }
-}
-
-
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-//#define CEBUG(bla) { cout << bla; cout.flush();}
-void Assembly::tpbc_generateNonAlignClips(readid_t actrid, vector<pbcounts_t> & correctorcounts)
-{
-  FUNCSTART("uint32 Assembly::generateNonAlignClips(readid_t actrid, vector<pbcounts_t> & correctorcounts)");
-
-
-  BUGIFTHROW(AS_naclipl.size()!=AS_readpool.size(),"AS_naclipl.size() " << AS_naclipl.size() << " != AS_readpool.size() " << AS_readpool.size());
-  BUGIFTHROW(AS_naclipr.size()!=AS_readpool.size(),"AS_naclipr.size() " << AS_naclipr.size() << " != AS_readpool.size() " << AS_readpool.size());
-
-  // *sigh* through indels occuring in the generatePBEdits() call prior to the call to this function,
-  //  things may be slightly out of sync
-  // just make sure this is called late in the whole correction proces, ideally (next to) last pass
-
-  //bool docebug=true;
-  bool docebug=false;
-
-  CEBUG("generateNonAlignClips GNA\n");
-
-  auto & actread=AS_readpool[actrid];
-
-  // signal processing tmp vector
-  // we need this tmp vectory as the erode/dilate operations further down below may
-  //  temporarily expand into "non-existing" space left and right of a vector
-  //  just of size correctorcounts.size(), and then this gives wrong results at
-  //  the borders in the subsequent operation
-  //
-  // we could get away with just using one vector without copying, but atm this is
-  //  prototype code anyway. Should this ever become bottleneck in the PacBio correction
-  //  process (I don't think so), re-engineer.
-
-  uint32 borderpad=100;
-  vector<uint32> sptmpv(correctorcounts.size()+2*borderpad,0);
-
-//#define GIMMEWIG
-#ifdef GIMMEWIG
-  string wigname=actread.getName();
-  vector<uint32> cqtmpv(correctorcounts.size()+2*borderpad,0);
-#endif
-
-  {
-
-    {
-      auto scI=sptmpv.begin()+borderpad;
-      auto ccI=correctorcounts.begin();
-#ifdef GIMMEWIG
-      auto qcI=cqtmpv.begin();
-      for(; ccI!=correctorcounts.end(); ++scI, ++ccI, ++qcI){
-	if(ccI->cqsafe>=2) *scI=1;
-	*qcI=ccI->cqsafe;
-      }
-#else
-      for(; ccI!=correctorcounts.end(); ++scI, ++ccI){
-	if(ccI->cqsafe>=2) *scI=1;
-      }
-#endif
-    }
-
-#ifdef GIMMEWIG
-    dbgContainerToWiggle(cqtmpv,wigname+"_cq",wigname+"_cq");
-    dbgContainerToWiggle(sptmpv,wigname+"_raw",wigname+"_raw");
-#endif
-
-    erode(sptmpv.begin(),sptmpv.end(),20);
-    erode(sptmpv.rbegin(),sptmpv.rend(),20);
-    dilate(sptmpv.begin(),sptmpv.end(),70);
-    dilate(sptmpv.rbegin(),sptmpv.rend(),70);
-    erode(sptmpv.begin(),sptmpv.end(),200);
-    erode(sptmpv.rbegin(),sptmpv.rend(),200);
-    dilate(sptmpv.begin(),sptmpv.end(),150);
-    dilate(sptmpv.rbegin(),sptmpv.rend(),150);
-
-#ifdef GIMMEWIG
-    dbgContainerToWiggle(sptmpv,wigname+"_sp",wigname+"_sp");
-#endif
-  }
-
-  // create safecounts from really used subpart of sptmpv
-  // atm as copy, maybe need sptmpv later?
-  vector<uint32> safecounts(sptmpv.begin()+borderpad,sptmpv.end()-borderpad);
-  sptmpv.clear();
-
-  {
-    CEBUG("dsp for " << actread.getName() << endl);
-    auto scI=safecounts.begin();
-    auto ccI=correctorcounts.begin();
-    for(; ccI!=correctorcounts.end(); ++scI, ++ccI){
-      CEBUG(scI-safecounts.begin()
-	    << '\t' << ccI->cqsafe
-	    << '\t' << *scI
-	    << endl);
-    }
-  }
-
-  int32 numlclips=0;
-  {
-    auto scI=safecounts.begin();
-    for(; scI!=safecounts.end() && *scI<1; ++scI) {}
-
-    numlclips=scI-safecounts.begin();
-    AS_naclipl[actrid]=actread.getLeftClipoff()+numlclips;
-    CEBUG("GNA clip left " << actread.getName() << ": " << numlclips << "\tnl: " << AS_naclipl[actrid] << endl);
-  }
-
-  int32 numrclips=0;
-  {
-    auto scI=safecounts.rbegin();
-    for(; scI!=safecounts.rend() && *scI<1; ++scI) {}
-    numrclips=scI-safecounts.rbegin();
-    AS_naclipr[actrid]=actread.getRightClipoff()-numrclips;
-    CEBUG("GNA clip right " << actread.getName() << ": " << numrclips  << "\tnr: " << AS_naclipr[actrid] << endl);
-  }
-
-  // can happen, if whole read is potentially killed above
-  if(AS_naclipr[actrid]<AS_naclipl[actrid]){
-    AS_naclipl[actrid]=0;
-    AS_naclipr[actrid]=0;
-    CEBUG("GNA killed " << actread.getName() << endl);
-  }
-
-
-  // check for holes remaining and eventually choose longest stretch
-  // TODO: later, not choose longest, but create subreads for stretches >=500bp
-  if(AS_naclipl[actrid]<AS_naclipr[actrid]){
-    auto scI=safecounts.begin()+numlclips;
-    auto scE=safecounts.end()-numrclips;
-
-    CEBUG("Checking " << scI-safecounts.begin() << ' ' << scE-safecounts.begin() << endl);
-    uint32 longesthole=0;
-    uint32 holelen=0;
-    uint32 longeststretch=0;
-    uint32 stretchlen=0;
-    auto lsscE=scE;
-
-    bool instretch=*scI>0;
-    for(; scI<scE; ++scI){
-      if(*scI>0){
-	if(instretch){
-	  // stretchcont
-	  ++stretchlen;
-	}else{
-	  // hole2stretch
-	  longesthole=max(longesthole,holelen);
-	  stretchlen=1;
-	  instretch=true;
-	}
-      }else{
-	if(!instretch){
-	  // hole cont
-	  ++holelen;
-	}else{
-	  // stretch2hole
-	  longeststretch=max(longeststretch,stretchlen);
-	  if(stretchlen==longeststretch){
-	    lsscE=scI;
-	  }
-	  holelen=1;
-	  instretch=false;
-	}
-      }
-    }
-    if(instretch) {
-      longeststretch=max(longeststretch,stretchlen);
-      lsscE=scI;
-    }else{
-      longesthole=max(longesthole,holelen);
-    }
-
-    CEBUG("LH: " << longesthole << "\tLS: " << longeststretch << endl);
-
-    if(longesthole>250){
-      AS_naclipr[actrid]=actread.getLeftClipoff()+(lsscE-safecounts.begin());
-      AS_naclipl[actrid]=AS_naclipr[actrid]-longeststretch;
-      CEBUG("GNA: Has hole, using subread " << AS_naclipl[actrid] << ' ' << AS_naclipr[actrid] << endl);
-      CEBUG("raw: " << lsscE-safecounts.begin()-longeststretch << " - " << lsscE-safecounts.begin() << endl);
-    }
-  }
-}
-//#define CEBUG(bla)
-
-
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-void Assembly::colourReadsByRLE()
-{
-  FUNCSTART("void Assembly::colourReadsByRLE()");
-
-  multitag_t mt;
-  for(uint32 rid=0; rid<AS_readpool.size(); ++rid){
-    auto & actread=AS_readpool[rid];
-    if(actread.getRLEValues()==nullptr) continue;
-
-    auto rvI=actread.getRLEValues()->begin();
-    for(uint32 rp=0; rp<actread.getLenSeq(); ++rp, ++rvI){
-      mt.identifier=Read::REA_tagentry_idMINF;
-      switch(*rvI){
-      case 0:
-	break;
-      case 1:
-	mt.identifier=Read::REA_tagentry_idRLE1;
-	break;
-      case 2:
-	mt.identifier=Read::REA_tagentry_idRLE2;
-	break;
-      case 3:
-	mt.identifier=Read::REA_tagentry_idRLE3;
-	break;
-      case 4:
-	mt.identifier=Read::REA_tagentry_idRLE4;
-	break;
-      case 5:
-	mt.identifier=Read::REA_tagentry_idRLE5;
-	break;
-      case 6:
-	mt.identifier=Read::REA_tagentry_idRLE6;
-	break;
-      case 7:
-	mt.identifier=Read::REA_tagentry_idRLE7;
-	break;
-      default:
-	// 8 or higher
-	mt.identifier=Read::REA_tagentry_idRLE8;
-	break;
-      }
-      if(mt.identifier!=Read::REA_tagentry_idMINF){
-	mt.from=rp;
-	mt.to=rp;
-	actread.addTagO(mt);
-      }
-    }
-  }
-}
-
-/*
-
-PacBio Bell adaptor:
-ATCTCTCTCttttcctcctcctccgttgttgttgttGAGAGAGAT
-
----------
-
-!!! ecopbownH5_19195: typical case of sequenced around the adapter ... without adapter! *sigh*
-
-Blasted at NCBI:
-
-Xuzhou 21: 498120 - 497938
-... TACGGTAATTCAAGGGGTGAGACCGAATGAGTCCCTTGCCCGCAGTCAGTCGGAACGTTAAATGGCAAATCAAGAACAATCAGGACAACCTTCACGGAAAGTCAATGTGCAGATCCAATGATAATGCCCCTGCCAACGTCCCTCCGCGCCCAGCGGAGTTGTGATATTCGTTACAGTTAAAGGAGTTTCGGTG
-
-Xuzhou 21: 497913 - 497973
-GGATACGTACCAAGCCTAACTGATCCACAGAAATCCCCTTTAACGTAACGGAAATCAACATCGCGGGCGAGACCGGCAGGGGCCATT
-AATCAATTGATTCTGCAACATGATTTCCTGAATTGTCCTATTGCCCTGAATTTGCCCATATTCAACAGTTCCGCGTGCCGGTGAATGCGGGCAAGATCATACGACTCACCCTGAAACGTAGT...
-
-I.e., a simple jump on the genome (25 bases ... length of inner core/loop of adapter?) and started in the other direction:
-                         497938 <------------------------------------------------------------------------------
-497913 ---------------------------------------------------------------------------------->
-
----------
-
-//*/
diff --git a/src/mira/assembly_reduceskimhits.C b/src/mira/assembly_reduceskimhits.C
index 971476d..6f455d4 100644
--- a/src/mira/assembly_reduceskimhits.C
+++ b/src/mira/assembly_reduceskimhits.C
@@ -11,41 +11,52 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
+// 	$Id$	
+
+
+#ifndef lint
+static char vcid[] = "$Id$";
+#endif /* lint */
+
+
 #include "assembly.H"
 
+// for time measurements
+#include <sys/times.h>
+#include <sys/time.h>
+#include <limits.h>
+#include <unistd.h>
+
 // BOOST
-#include <boost/algorithm/string.hpp>
+#include <boost/algorithm/string.hpp> 
+
+// for checking time restrictions
+#include <time.h>
+#include "mira/timerestrict.H"
 
 #include "errorhandling/errorhandling.H"
 #include "util/progressindic.H"
-#include "util/machineinfo.H"
-#include "util/fileanddisk.H"
+#include "mira/structs.H"
 
-#include "mira/ads.H"
 
 #if 0
 #include <valgrind/memcheck.h>
 #define VALGRIND_LEAKCHECK
 #endif
 
-
-using namespace std;
-
-#define CEBUG(bla)
-
 // cs1 for normal clocking ('user compatible' as is does not disturb)
 //  cs2 for extensive clocking output, more for analysis of MIRA behaviour
 //  during development
@@ -56,8 +67,12 @@ using namespace std;
 #define CLOCK_STEPS2
 
 
+#if DEVELOPMENTVERSION != 0 
 //#define TRACKMEMUSAGE 1
 #define TRACKMEMUSAGE 0
+#else
+#define TRACKMEMUSAGE 0
+#endif
 
 
 //#define FUNCSTART(bla)  static const char * THISFUNC = bla"  "; {cout << THISFUNC << "enter.\n"; cout.flush();}
@@ -76,11 +91,13 @@ using namespace std;
  *
  *************************************************************************/
 
-// sort id1 low to high,
+// sort id1 low to high, 
 //  on same id1 by skimweight high to low,
 //  on same skimweight by id2 low to high
 //  on same id2 by eoffset low to high
-bool skimedges_t::stdSortCmp(const skimedges_t & a, const skimedges_t & b)
+bool Assembly__sortskim_edges_t_(const skimedges_t & a, 
+				 const skimedges_t & b);
+bool Assembly__sortskim_edges_t_(const skimedges_t & a, const skimedges_t & b)
 {
   if(a.rid1 == b.rid1){
     if(a.skimweight == b.skimweight){
@@ -112,10 +129,6 @@ void Assembly::reduceSkimHits4(int32 version, const string prefix, const string
   FUNCSTART("void Assembly::reduceSkimHits4(int32 version, const string prefix, const string postfix, const string logname)");
   assembly_parameters const & as_fixparams= AS_miraparams[0].getAssemblyParams();
 
-  //saveVector(AS_writtenskimhitsperid,"as_wshpi.bin");
-  //saveVector(AS_overlapcritlevell,"as_ocll.bin");
-  //saveVector(AS_overlapcritlevelr,"as_oclr.bin");
-
   if(!AS_chimeracutflag.empty()){
     cout << "Chimeras were searched for ... looking for hits to purge.\n";
     AS_writtenskimhitsperid.clear();
@@ -131,7 +144,7 @@ void Assembly::reduceSkimHits4(int32 version, const string prefix, const string
 
   {
     skim_parameters const & skim_params= AS_miraparams[0].getSkimParams();
-    // 512MiB as default max memory for the skim edges
+    // 512MiB as default max memory for the skim edges 
     int64 memtouse=static_cast<int64>(skim_params.sk_memcaphitreduction)*1024*1024;
 
     // either reuse existing AS_skim_edges size or (if wished) calc from scratch if not present
@@ -139,7 +152,7 @@ void Assembly::reduceSkimHits4(int32 version, const string prefix, const string
       memtouse=AS_skim_edges.capacity()*sizeof(skimedges_t);
     }else if(as_fixparams.as_automemmanagement && AS_systemmemory > 0 ){
       int64 onegig=1024*1024*1024;
-      int64 memusedbymira=MachineInfo::getVMSize();
+      int64 memusedbymira=grepMemSizeFromProcFS("/proc/self/status","VmSize:");
 
       int64 mem2keepfree=0;
 
@@ -158,7 +171,7 @@ void Assembly::reduceSkimHits4(int32 version, const string prefix, const string
 	   << "\nMem avail: " << memavail << endl;
       if(memavail>memtouse) {
 	memtouse=memavail;
-
+	
 	cout << "rsh increased memtouse to: " << memtouse << endl;
       }else{
 	cout << "rsh not increased.\n";
@@ -180,30 +193,17 @@ void Assembly::reduceSkimHits4(int32 version, const string prefix, const string
     // if that's not possible, try to allocate less and less until even
     //  allocation of 1 million skim edges fails and in that case, give up
     uint64 maxnumskimedges=static_cast<uint64>(memtouse/sizeof(skimedges_t));
-    //maxnumskimedges=1;
-
-    // try circumventing the "would extend AS_skim_edges" error by faking less available space
-    // really ugly, memory wasting hack
-    if(AS_skim_edges.capacity()>0){
-      if(maxnumskimedges>100000){
-	maxnumskimedges-=5000;
-      }else if(maxnumskimedges>10000){
-	maxnumskimedges-=2000;
-      }else{
-	maxnumskimedges-=maxnumskimedges/10;
-	if(maxnumskimedges<10) maxnumskimedges=10;
-      }
-    }
-
-
+    
+    //maxnumskimedges=65;
+    
     while(AS_skim_edges.empty()){
       totalskimhits=0;
       idblocks.clear();
       maxseenblock=0;
-
+      
       uint64 thisblock=0;
       for(size_t i=0; i<AS_readpool.size(); i++){
-	CEBUG("DBG: AS_wshpid[" << i << "]\t" << AS_writtenskimhitsperid[i] << '\n');
+	//CEBUG("DBG: AS_wshpid[" << i << "]\t" << AS_writtenskimhitsperid[i] << '\n');
 	thisblock+=AS_writtenskimhitsperid[i];
 	totalskimhits+=AS_writtenskimhitsperid[i];
 	if(i!=0 && i+1!=AS_readpool.size()){
@@ -219,11 +219,11 @@ void Assembly::reduceSkimHits4(int32 version, const string prefix, const string
 	if(thisblock>maxseenblock) maxseenblock=thisblock;
 	idblocks.push_back(AS_readpool.size());
       }
-
+      
       CEBUG("DBG: TSH " << totalskimhits << endl);
       CEBUG("Max seen block 1: " << maxseenblock << '\n');
       CEBUG("Max num skim edges: " << maxnumskimedges << '\n');
-
+      
       try{
 	// no space reserved yet? Good, first pass. Looks like that due to chimera clipping and some
 	//  editing in the pass, the memory needed in the first pass is slightly lower than in the next.
@@ -231,8 +231,7 @@ void Assembly::reduceSkimHits4(int32 version, const string prefix, const string
 	if(AS_skim_edges.capacity()==0){
 	  maxseenblock+=maxseenblock/20;
 	}
-	// again, ugly hack to prevent "would extend AS_skim_edges" error by reserving more space than actually computed
-	AS_skim_edges.reserve(maxseenblock+5000);
+	AS_skim_edges.reserve(maxseenblock);
 	// on successful reserve, break the while loop
 	break;
       }
@@ -259,21 +258,15 @@ void Assembly::reduceSkimHits4(int32 version, const string prefix, const string
 	}
       }
     }
-    cout << "Edge vector capacity: " << AS_skim_edges.capacity() << "\n";
     cout << "Can load up to " << maxseenblock << " skim edges at once.\n";
   }
 
-  cout << "Partitioning into " << idblocks.size() << " blocks.\nBlocks: ";
-  for(auto ibe : idblocks){
-    cout << ibe << "\t";
-  }
-  cout << endl;
-
+  cout << "Partitioning into " << idblocks.size() << " blocks.\n";
   CEBUG("Max seen block 2: " << maxseenblock << '\n');
 
   cout << "We have " << totalskimhits << " skims in file.\n";
 
-#if TRACKMEMUSAGE
+#if TRACKMEMUSAGE 
     cout << "\ndmi rsh2 10\n";
     dumpMemInfo();
 #endif
@@ -281,7 +274,7 @@ void Assembly::reduceSkimHits4(int32 version, const string prefix, const string
   AS_skimstaken.clear();
   AS_skimstaken.resize(totalskimhits,false);
 
-#if TRACKMEMUSAGE
+#if TRACKMEMUSAGE 
     cout << "\ndmi rsh2 20\n";
     dumpMemInfo();
 #endif
@@ -289,7 +282,7 @@ void Assembly::reduceSkimHits4(int32 version, const string prefix, const string
   AS_readmaytakeskim.clear();
   AS_readmaytakeskim.resize(AS_readpool.size(),true);
 
-#if TRACKMEMUSAGE
+#if TRACKMEMUSAGE 
     cout << "\ndmi rsh2 30\n";
     dumpMemInfo();
 #endif
@@ -297,7 +290,7 @@ void Assembly::reduceSkimHits4(int32 version, const string prefix, const string
   AS_numskimoverlaps.clear();
   AS_numskimoverlaps.resize(AS_readpool.size(),0);
 
-#if TRACKMEMUSAGE
+#if TRACKMEMUSAGE 
     cout << "\ndmi rsh2 40\n";
     dumpMemInfo();
 #endif
@@ -305,7 +298,7 @@ void Assembly::reduceSkimHits4(int32 version, const string prefix, const string
   AS_numleftextendskims.clear();
   AS_numleftextendskims.resize(AS_readpool.size(),0);
 
-#if TRACKMEMUSAGE
+#if TRACKMEMUSAGE 
     cout << "\ndmi rsh2 40\n";
     dumpMemInfo();
 #endif
@@ -313,7 +306,7 @@ void Assembly::reduceSkimHits4(int32 version, const string prefix, const string
   AS_numrightextendskims.clear();
   AS_numrightextendskims.resize(AS_readpool.size(),0);
 
-#if TRACKMEMUSAGE
+#if TRACKMEMUSAGE 
     cout << "\ndmi rsh2 50\n";
     dumpMemInfo();
 #endif
@@ -321,7 +314,7 @@ void Assembly::reduceSkimHits4(int32 version, const string prefix, const string
   AS_skimleftextendratio.clear();
   AS_skimleftextendratio.resize(AS_readpool.size(),0);
 
-#if TRACKMEMUSAGE
+#if TRACKMEMUSAGE 
     cout << "\ndmi rsh2 60\n";
     dumpMemInfo();
 #endif
@@ -329,12 +322,12 @@ void Assembly::reduceSkimHits4(int32 version, const string prefix, const string
   AS_skimrightextendratio.clear();
   AS_skimrightextendratio.resize(AS_readpool.size(),0);
 
-#if TRACKMEMUSAGE
+#if TRACKMEMUSAGE 
     cout << "\ndmi rsh2 70\n";
     dumpMemInfo();
 #endif
 
-  bool hasshortreads=AS_seqtypespresent[ReadGroupLib::SEQTYPE_SOLEXA] | AS_seqtypespresent[ReadGroupLib::SEQTYPE_ABISOLID];
+  bool hasshortreads=AS_seqtypespresent[Read::SEQTYPE_SOLEXA] | AS_seqtypespresent[Read::SEQTYPE_ABISOLID];
 
   CEBUG("Has short reads: " << hasshortreads << '\n');
 
@@ -342,7 +335,7 @@ void Assembly::reduceSkimHits4(int32 version, const string prefix, const string
   // very first call will be with version=0 ... pre_assembly
   //  don't set to true there as this analysis is then needed
   //  for multicopy analysis
-  if(AS_hasbackbones
+  if(as_fixparams.as_loadbackbone
      && version >= as_fixparams.as_startbackboneusage_inpass
      && ! as_fixparams.as_backbone_alsobuildnewcontigs){
     onlyagainstrails=true;
@@ -351,7 +344,7 @@ void Assembly::reduceSkimHits4(int32 version, const string prefix, const string
   vector<uint64> blockpos;
   vector<size_t> blocklen;
 
-  string fskimname=buildFileName(version, prefix, postfix,
+  string fskimname=buildFileName(version, prefix, postfix, 
 			     as_fixparams.as_tmpf_normalisedskim,
 			     ".bin");
 
@@ -360,14 +353,14 @@ void Assembly::reduceSkimHits4(int32 version, const string prefix, const string
   if(as_fixparams.as_dateoutput) dateStamp(cout);
 
 
-#if TRACKMEMUSAGE
+#if TRACKMEMUSAGE 
     cout << "\ndmi rsh2 80\n";
     dumpMemInfo();
 #endif
 
   rsh4_flagMulticopyReads(fskimname, blockpos, blocklen);
 
-#if TRACKMEMUSAGE
+#if TRACKMEMUSAGE 
     cout << "\ndmi rsh2 90\n";
     dumpMemInfo();
 #endif
@@ -376,13 +369,13 @@ void Assembly::reduceSkimHits4(int32 version, const string prefix, const string
 
   CEBUG("Only against rails: " << onlyagainstrails << '\n');
 
-  if(AS_hasbackbones) {
+  if(as_fixparams.as_loadbackbone) {
     cout << "Step rail\n";
     rsh4_takeRailHits(fskimname, blockpos, blocklen);
     if(as_fixparams.as_dateoutput) dateStamp(cout);
     rsh4_countTotalSkimsTaken();
 
-#if TRACKMEMUSAGE
+#if TRACKMEMUSAGE 
     cout << "\ndmi rsh2 a0\n";
     dumpMemInfo();
 #endif
@@ -390,172 +383,103 @@ void Assembly::reduceSkimHits4(int32 version, const string prefix, const string
 
   //rsh2_takeNeedAllOverlaps(idblocks);
 
-#if CPP_READ_SEQTYPE_END != 8
-#error "This code is made for 8 sequencing types, adapt!"
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
 #endif
   if(!onlyagainstrails){
-
-    // temporary vectors for counting "nbest" in some of rsh4_* routines below
-    vector<uint32> nbestl;
-    vector<uint32> nbestr;
-    nbestl.reserve(AS_readpool.size());
-    nbestr.reserve(AS_readpool.size());
-
     cout << "Step 0\n";
     rsh4_weedOutBadHits(fskimname, blockpos, blocklen);
     if(as_fixparams.as_dateoutput) dateStamp(cout);
-
-    if(AS_miraparams[0].getPathfinderParams().paf_use_genomic_algorithms){
-      if(0){
-	cout << "Step cheat, not for any master/development release!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n";
-	exit(999);
-	rsh4_takeAll(fskimname, blockpos, blocklen);
-      }else
-      if(!hasshortreads){
-	cout << "Only long reads\n";
-	cout << "Step 10\n";
-	rsh4_takeNonReptHitsThatExtend(3,nbestl,nbestr,0,fskimname, blockpos, blocklen);
-	rsh4_countTotalSkimsTaken();
-	cout << "Step 20\n";
-	rsh4_takeReptPEPEHitsThatExtend(20,0,fskimname, blockpos, blocklen);
-	rsh4_countTotalSkimsTaken();
-	cout << "Step 30\n";
-	rsh4_takeReptNPENPEHitsThatExtend(2,0,fskimname, blockpos, blocklen);
-	rsh4_countTotalSkimsTaken();
-	cout << "Step 40\n";
-	rsh4_takeReptPENPEHitsThatExtend(2,0,fskimname, blockpos, blocklen);
-	rsh4_countTotalSkimsTaken();
-	cout << "Step 50\n";
-	rsh4_take100PC100bpHitsThatExtend(3,nbestl,nbestr,fskimname, blockpos, blocklen);
-	rsh4_countTotalSkimsTaken();
-	cout << "Step 53\n";
-	rsh4_takeNonTakenReadsWithHitsThatExtend(5,nbestl,nbestr,0,fskimname, blockpos, blocklen);
-	rsh4_countTotalSkimsTaken();
-	cout << "Step 55\n";
-	rsh4_takeNonTakenSideExtends(5,0,fskimname, blockpos, blocklen);
-	rsh4_countTotalSkimsTaken();
-	cout << "Step 57\n";
-	rsh4_takeIdenticalReadHits(3,fskimname, blockpos, blocklen);
-	rsh4_countTotalSkimsTaken();
-	cout << "Step 60\n";
-	rsh4_takeNonTakenReadsWithHits(5,fskimname, blockpos, blocklen);
-	rsh4_countTotalSkimsTaken();
-      }else if(AS_seqtypespresent[ReadGroupLib::SEQTYPE_SANGER]
-	       || AS_seqtypespresent[ReadGroupLib::SEQTYPE_454GS20]
-	       || AS_seqtypespresent[ReadGroupLib::SEQTYPE_TEXT]
-	       || AS_seqtypespresent[ReadGroupLib::SEQTYPE_PACBIOHQ]
-	       || AS_seqtypespresent[ReadGroupLib::SEQTYPE_PACBIOLQ]
-	){
-	// mixed: long and short reads
-	// TODO: optimise
-	cout << "Mixed long/short reads\n";
-	cout << "Step 01\n";
-	rsh4_take100PCMappingHits(fskimname, blockpos, blocklen);
-	rsh4_countTotalSkimsTaken();
+    if(!hasshortreads){
+      cout << "Only long reads\n";
+      cout << "Step 10\n";
+      rsh4_takeNonReptHitsThatExtend(3,0,fskimname, blockpos, blocklen);
+      rsh4_countTotalSkimsTaken();
+      cout << "Step 20\n";
+      rsh4_takeReptPEPEHitsThatExtend(20,0,fskimname, blockpos, blocklen);
+      rsh4_countTotalSkimsTaken();
+      cout << "Step 30\n";
+      rsh4_takeReptNPENPEHitsThatExtend(2,0,fskimname, blockpos, blocklen);
+      rsh4_countTotalSkimsTaken();
+      cout << "Step 40\n";
+      rsh4_takeReptPENPEHitsThatExtend(2,0,fskimname, blockpos, blocklen);
+      rsh4_countTotalSkimsTaken();
+      cout << "Step 50\n";
+      rsh4_takeNonTakenReadsWithHitsThatExtend(5,0,fskimname, blockpos, blocklen);
+      rsh4_countTotalSkimsTaken();
+      cout << "Step 55\n";
+      rsh4_takeNonTakenSideExtends(5,0,fskimname, blockpos, blocklen);
+      rsh4_countTotalSkimsTaken();
+      cout << "Step 60\n";
+      rsh4_takeNonTakenReadsWithHits(5,fskimname, blockpos, blocklen);
+      rsh4_countTotalSkimsTaken();
+    }else if(AS_seqtypespresent[Read::SEQTYPE_SANGER]
+	     || AS_seqtypespresent[Read::SEQTYPE_454GS20]
+	     || AS_seqtypespresent[Read::SEQTYPE_PACBIO]
+      ){
+      // mixed: long and short reads
+      // TODO: optimise
+      cout << "Mixed long/short reads\n";
+      cout << "Step 01\n";
+      rsh4_take100PCMappingHits(fskimname, blockpos, blocklen);
+      rsh4_countTotalSkimsTaken();
+      cout << "Step 10\n";
+      rsh4_takeNonReptHitsThatExtend(3,0,fskimname, blockpos, blocklen);
+      rsh4_countTotalSkimsTaken();
+      cout << "Step 20\n";
+      rsh4_takeReptPEPEHitsThatExtend(20,0,fskimname, blockpos, blocklen);
+      rsh4_countTotalSkimsTaken();
+      cout << "Step 30\n";
+      rsh4_takeReptNPENPEHitsThatExtend(2,0,fskimname, blockpos, blocklen);
+      rsh4_countTotalSkimsTaken();
+      cout << "Step 40\n";
+      rsh4_takeReptPENPEHitsThatExtend(2,0,fskimname, blockpos, blocklen);
+      rsh4_countTotalSkimsTaken();
+      cout << "Step 50\n";
+      rsh4_takeNonTakenReadsWithHitsThatExtend(5,0,fskimname, blockpos, blocklen);
+      rsh4_countTotalSkimsTaken();
+      cout << "Step 55\n";
+      rsh4_takeNonTakenSideExtends(5,0,fskimname, blockpos, blocklen);
+      rsh4_countTotalSkimsTaken();
+      cout << "Step 60\n";
+      rsh4_takeNonTakenReadsWithHits(5,fskimname, blockpos, blocklen);
+      rsh4_countTotalSkimsTaken();
+    }else{
+      // short only
+      // TODO: optimise
+      cout << "Only short reads\n";
+      if(1){
 	cout << "Step 10\n";
-	rsh4_takeNonReptHitsThatExtend(3,nbestl,nbestr,0,fskimname, blockpos, blocklen);
+	rsh4_takeNonReptHitsThatExtend(3,100,fskimname, blockpos, blocklen);
 	rsh4_countTotalSkimsTaken();
 	cout << "Step 20\n";
-	rsh4_takeReptPEPEHitsThatExtend(20,0,fskimname, blockpos, blocklen);
+	rsh4_takeReptPEPEHitsThatExtend(20,100,fskimname, blockpos, blocklen);
 	rsh4_countTotalSkimsTaken();
 	cout << "Step 30\n";
-	rsh4_takeReptNPENPEHitsThatExtend(2,0,fskimname, blockpos, blocklen);
+	rsh4_takeReptNPENPEHitsThatExtend(2,100,fskimname, blockpos, blocklen);
 	rsh4_countTotalSkimsTaken();
 	cout << "Step 40\n";
-	rsh4_takeReptPENPEHitsThatExtend(2,0,fskimname, blockpos, blocklen);
+	rsh4_takeReptPENPEHitsThatExtend(2,100,fskimname, blockpos, blocklen);
 	rsh4_countTotalSkimsTaken();
 	cout << "Step 50\n";
-	rsh4_take100PC100bpHitsThatExtend(3,nbestl,nbestr,fskimname, blockpos, blocklen);
-	rsh4_countTotalSkimsTaken();
-	cout << "Step 53\n";
-	rsh4_takeNonTakenReadsWithHitsThatExtend(5,nbestl,nbestr,0,fskimname, blockpos, blocklen);
+	rsh4_takeNonTakenReadsWithHitsThatExtend(5,100,fskimname, blockpos, blocklen);
 	rsh4_countTotalSkimsTaken();
 	cout << "Step 55\n";
-	rsh4_takeNonTakenSideExtends(5,0,fskimname, blockpos, blocklen);
+	rsh4_takeNonTakenSideExtends(5,100,fskimname, blockpos, blocklen);
 	rsh4_countTotalSkimsTaken();
-	cout << "Step 57\n";
-	rsh4_takeIdenticalReadHits(3,fskimname, blockpos, blocklen);
+	cout << "Step 56\n";
+	rsh4_takeNonTakenSideExtends(5,95,fskimname, blockpos, blocklen);
 	rsh4_countTotalSkimsTaken();
 	cout << "Step 60\n";
 	rsh4_takeNonTakenReadsWithHits(5,fskimname, blockpos, blocklen);
 	rsh4_countTotalSkimsTaken();
       }else{
-	// short only
-	// TODO: optimise
-	cout << "Only short reads\n";
-	if(1){
-	  cout << "Step 10\n";
-	  rsh4_takeNonReptHitsThatExtend(3,nbestl,nbestr,100,fskimname, blockpos, blocklen);
-	  rsh4_countTotalSkimsTaken();
-	  cout << "Step 15\n";
-	  rsh4_takeReptNonReptBorders(98,fskimname, blockpos, blocklen);
-	  rsh4_countTotalSkimsTaken();
-	  cout << "Step 20\n";
-	  rsh4_takeReptPEPEHitsThatExtend(20,100,fskimname, blockpos, blocklen);
-	  rsh4_countTotalSkimsTaken();
-	  cout << "Step 30\n";
-	  rsh4_takeReptNPENPEHitsThatExtend(2,100,fskimname, blockpos, blocklen);
-	  rsh4_countTotalSkimsTaken();
-	  cout << "Step 40\n";
-	  rsh4_takeReptPENPEHitsThatExtend(2,100,fskimname, blockpos, blocklen);
-	  rsh4_countTotalSkimsTaken();
-	  cout << "Step 50\n";
-	  rsh4_take100PC100bpHitsThatExtend(3,nbestl,nbestr,fskimname, blockpos, blocklen);
-	  rsh4_countTotalSkimsTaken();
-	  cout << "Step 53\n";
-	  rsh4_takeNonTakenReadsWithHitsThatExtend(5,nbestl,nbestr,100,fskimname, blockpos, blocklen);
-	  rsh4_countTotalSkimsTaken();
-	  cout << "Step 55\n";
-	  rsh4_takeNonTakenSideExtends(5,100,fskimname, blockpos, blocklen);
-	  rsh4_countTotalSkimsTaken();
-	  cout << "Step 56\n";
-	  rsh4_takeNonTakenSideExtends(5,95,fskimname, blockpos, blocklen);
-	  rsh4_countTotalSkimsTaken();
-	  cout << "Step 57\n";
-	  rsh4_takeIdenticalReadHits(3,fskimname, blockpos, blocklen);
-	  rsh4_countTotalSkimsTaken();
-	  cout << "Step 60\n";
-	  rsh4_takeNonTakenReadsWithHits(5,fskimname, blockpos, blocklen);
-	  rsh4_countTotalSkimsTaken();
-	}else{
-	  cout << "Step cheat\n";
-	  rsh4_takeAll(fskimname, blockpos, blocklen);
-	}
+	cout << "Step cheat\n";
+	rsh4_takeAll(fskimname, blockpos, blocklen);
       }
-    }else{
-      // EST / RNASeq
-      cout << "Step 05\n";
-      rsh4_takeWellconnected(3,nbestl,nbestr,fskimname, blockpos, blocklen);
-      rsh4_countTotalSkimsTaken();
-      cout << "Step 10\n";
-      rsh4_take100PC100bpHitsThatExtend(3,nbestl,nbestr,fskimname, blockpos, blocklen);
-      rsh4_countTotalSkimsTaken();
-      cout << "Step 20\n";
-      rsh4_takeReptPEPEHitsThatExtend(12,0,fskimname, blockpos, blocklen);
-      rsh4_countTotalSkimsTaken();
-      cout << "Step 30\n";
-      rsh4_takeNonTakenReadsWithHitsThatExtend(5,nbestl,nbestr,100,fskimname, blockpos, blocklen);
-      rsh4_countTotalSkimsTaken();
-      cout << "Step 40\n";
-      rsh4_takeNonTakenReadsWithHitsThatExtend(5,nbestl,nbestr,80,fskimname, blockpos, blocklen);
-      rsh4_countTotalSkimsTaken();
-      cout << "Step 50\n";
-      rsh4_takeNonTakenReadsWithHitsThatExtend(5,nbestl,nbestr,0,fskimname, blockpos, blocklen);
-      rsh4_countTotalSkimsTaken();
-      cout << "Step 60\n";
-      rsh4_takeNonTakenSideExtends(5,0,fskimname, blockpos, blocklen);
-      rsh4_countTotalSkimsTaken();
-      cout << "Step 70\n";
-      rsh4_takeIdenticalReadHits(3,fskimname, blockpos, blocklen);
-      rsh4_countTotalSkimsTaken();
-      cout << "Step 80\n";
-      rsh4_takeNonTakenReadsWithHits(5,fskimname, blockpos, blocklen);
-      rsh4_countTotalSkimsTaken();
     }
-
     cout << "Step solexa by critlevel\n";
-    rsh4_takeSolexaByCritLevel(0,3,nbestl,nbestr,fskimname, blockpos, blocklen);
-    rsh4_takeSolexaByCritLevel(1,3,nbestl,nbestr,fskimname, blockpos, blocklen);
+    rsh4_takeSolexaByCritLevel(3,fskimname, blockpos, blocklen);
 
     cout << "Step template overlaps\n";
     rsh4_takeTemplateOverlaps(fskimname, blockpos, blocklen);
@@ -565,34 +489,25 @@ void Assembly::reduceSkimHits4(int32 version, const string prefix, const string
   rsh4_takeNeedAllOverlaps_weakgood(fskimname, blockpos, blocklen);
 
   {
-    uint64 counter=0;
-    for(uint64 stid=0; stid < AS_skimstaken.size(); stid++){
+    size_t counter=0;
+    for(size_t stid=0; stid < AS_skimstaken.size(); stid++){
       if(AS_skimstaken[stid]) counter++;
     }
     cout << "Total skims taken: " << counter << '\n';
 
-#if 0
-    // not yet
-    // newedges_t has a 32 bit adsfindex ... not sure I want to change
-    if(counter>0xffffffffffff){
-      MIRANOTIFY(Notify::FATAL, "More than 2^48 skim hits would be taken ... this was not foreseen yet. Please contact the author.");
-#else
-    if(counter>0xffffffff){
-      MIRANOTIFY(Notify::FATAL, "More than 2^32-1 skim hits would be taken ... this was not foreseen yet. Please contact the author.");
-#endif
-    }
+    BUGIFTHROW(counter>0x7fffffff, "More than 2^31 skim hits would be taken ... this was not foreseen yet. Please contact the author.");
   }
 
-#if TRACKMEMUSAGE
+#if TRACKMEMUSAGE 
   cout << "\ndmi rsh2 b0\n";
   dumpMemInfo();
 #endif
 
   cout << "\nFiltering forward skims." << endl;
   if(as_fixparams.as_dateoutput) dateStamp(cout);
-
+  
   string newname=AS_posfmatch_filename+".reduced";
-  uint64 skimindex=0;
+  size_t skimindex=0;
   rsh4_filterSkimHits(AS_posfmatch_filename,
 		      newname,
 		      skimindex);
@@ -607,63 +522,63 @@ void Assembly::reduceSkimHits4(int32 version, const string prefix, const string
   cout << "Done all filtering." << endl;
   if(as_fixparams.as_dateoutput) dateStamp(cout);
 
-#if TRACKMEMUSAGE
+#if TRACKMEMUSAGE 
     cout << "\ndmi rsh2 c0\n";
     dumpMemInfo();
 #endif
-
+  
   CEBUG("Nuking AS_skimrightextendratio" << endl);
   nukeSTLContainer(AS_skimrightextendratio);
-#if TRACKMEMUSAGE
+#if TRACKMEMUSAGE 
     cout << "\ndmi rsh2 d0\n";
     dumpMemInfo();
 #endif
 
   CEBUG("Nuking AS_skimleftextendratio" << endl);
   nukeSTLContainer(AS_skimleftextendratio);
-#if TRACKMEMUSAGE
+#if TRACKMEMUSAGE 
     cout << "\ndmi rsh2 e0\n";
     dumpMemInfo();
 #endif
 
   CEBUG("Nuking AS_numrightextendskims" << endl);
   nukeSTLContainer(AS_numrightextendskims);
-#if TRACKMEMUSAGE
+#if TRACKMEMUSAGE 
     cout << "\ndmi rsh2 f0\n";
     dumpMemInfo();
 #endif
 
   CEBUG("Nuking AS_numleftextendskims" << endl);
   nukeSTLContainer(AS_numleftextendskims);
-#if TRACKMEMUSAGE
+#if TRACKMEMUSAGE 
     cout << "\ndmi rsh2 g0\n";
     dumpMemInfo();
 #endif
 
   CEBUG("Nuking AS_numskimoverlaps" << endl);
   nukeSTLContainer(AS_numskimoverlaps);
-#if TRACKMEMUSAGE
+#if TRACKMEMUSAGE 
     cout << "\ndmi rsh2 h0\n";
     dumpMemInfo();
 #endif
 
   CEBUG("Nuking AS_readmaytakeskim" << endl);
   nukeSTLContainer(AS_readmaytakeskim);
-#if TRACKMEMUSAGE
+#if TRACKMEMUSAGE 
     cout << "\ndmi rsh2 i0\n";
     dumpMemInfo();
 #endif
 
   CEBUG("Nuking AS_skimstaken" << endl);
   nukeSTLContainer(AS_skimstaken);
-#if TRACKMEMUSAGE
+#if TRACKMEMUSAGE 
     cout << "\ndmi rsh2 j0\n";
     dumpMemInfo();
 #endif
 
     // BaCh 05.11.2010
     // clear, don't nuke AS_skim_edges, will be re-used as is in the next pass.
-    // cause: the memory allocator may or may not give back the memory to the
+    // cause: the memory allocator may or may not give back the memory to the 
     //  OS memory pool. If not, then in the next pass the calculation will be
     //  completely wrong. Better to get a grip on that memory and hold on tight
 
@@ -677,7 +592,7 @@ void Assembly::reduceSkimHits4(int32 version, const string prefix, const string
 
 //  CEBUG("Nuking AS_skim_edges" << endl);
 //  nukeSTLContainer(AS_skim_edges);
-//#if TRACKMEMUSAGE
+//#if TRACKMEMUSAGE 
 //    cout << "\ndmi rsh2 k0\n";
 //    dumpMemInfo();
 //#endif
@@ -715,9 +630,9 @@ void Assembly::rsh4_countTotalSkimsTaken()
  *
  *************************************************************************/
 
-void Assembly::rsh4_filterSkimHits(const string & oldfilename, const string & newfilename, uint64 & skimindex)
+void Assembly::rsh4_filterSkimHits(const string & oldfilename, const string & newfilename, size_t & skimindex)
 {
-  FUNCSTART("void Assembly::rsh4_filterSkimHits(const string & oldfilename, const string & newfilename, uint64 & skimindex)");
+  FUNCSTART("uint32 Assembly::filterSkimHits(const string & filename)");
 
   char buf[10000];
 
@@ -725,15 +640,15 @@ void Assembly::rsh4_filterSkimHits(const string & oldfilename, const string & ne
   FILE * fout;
 
   fin = fopen(oldfilename.c_str(),"r");
-  if(fin == nullptr) {
+  if(fin == NULL) {
     MIRANOTIFY(Notify::FATAL, "File not found: " << oldfilename);
   }
-  myFSeek(fin, 0, SEEK_END);
-  streamsize finsize=myFTell(fin);
+  fseek(fin, 0, SEEK_END);
+  streamsize finsize=ftell(fin);
   rewind(fin);
 
   fout = fopen(newfilename.c_str(),"w");
-  if(fout == nullptr) {
+  if(fout == NULL) {
     fclose(fin);
     MIRANOTIFY(Notify::FATAL, "Could not open file: " << newfilename);
   }
@@ -745,7 +660,7 @@ void Assembly::rsh4_filterSkimHits(const string & oldfilename, const string & ne
     string logfilename=path+"/elog.rsh4.filter."+justfilename;
     logfout.open(logfilename.c_str(), ios::out|ios::app|ios::ate);
   }
-
+  
 
   skimhitforsave_t tmpshfs;
 
@@ -754,9 +669,9 @@ void Assembly::rsh4_filterSkimHits(const string & oldfilename, const string & ne
   CEBUG("Starting at skimindex: " << skimindex << endl);
 
   ProgressIndicator<streamsize> P(0, finsize-1);
-
+  
   while(!feof(fin)){
-    auto numread=myFRead(&tmpshfs,sizeof(tmpshfs),1,fin);
+    int numread=fread(&tmpshfs,sizeof(tmpshfs),1,fin);
     if(numread){
       if(AS_skimstaken[skimindex]){
 	if(AS_miraparams[0].getSpecialParams().mi_extended_log){
@@ -764,7 +679,7 @@ void Assembly::rsh4_filterSkimHits(const string & oldfilename, const string & ne
 		  << '\t' << AS_readpool[tmpshfs.rid2].getName()
 		  << '\t' << tmpshfs;
 	}
-	myFWrite(&tmpshfs, sizeof(tmpshfs), 1, fout);
+	fwrite(&tmpshfs, sizeof(tmpshfs), 1, fout);
 	if(ferror(fout)){
 	  fclose(fout);
 	  fclose(fin);
@@ -777,11 +692,11 @@ void Assembly::rsh4_filterSkimHits(const string & oldfilename, const string & ne
       }
       ++skimindex;
     }
-    if(skimindex%1000 == 0 ) P.progress(myFTell(fin));
+    if(skimindex%1000 == 0 ) P.progress(ftell(fin));
   }
 
   P.finishAtOnce();
-
+  
   fclose(fout);
   fclose(fin);
 
@@ -798,7 +713,7 @@ void Assembly::rsh4_filterSkimHits(const string & oldfilename, const string & ne
  *
  *************************************************************************/
 
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
+#define CEBUG(bla)   {cout << bla; cout.flush();}
 size_t Assembly::rsh4_getNextNormalisedSkimBlock(list<int64> & idblocks, int64 & blockstartid, int64 & blockendid)
 {
 
@@ -844,7 +759,7 @@ size_t Assembly::rsh4_getNextNormalisedSkimBlock(list<int64> & idblocks, int64 &
     rsh4_loadNormalisedSkimHitBlock(AS_poscmatch_filename,
 				    skimindex, blockstartid, blockendid,
 				    1,-1);
-
+    
     if(AS_miraparams[0].getAssemblyParams().as_dateoutput) dateStamp(cout);
     CEBUG("Loaded " <<  AS_skim_edges.size() << " elements.\nSorting ... ");
     cout.flush();
@@ -860,18 +775,10 @@ size_t Assembly::rsh4_getNextNormalisedSkimBlock(list<int64> & idblocks, int64 &
       }
     }
 
-    sort(AS_skim_edges.begin(),
-	 AS_skim_edges.end(),
-	 skimedges_t::stdSortCmp);
+    sort(AS_skim_edges.begin(), 
+	 AS_skim_edges.end(), 
+	 Assembly__sortskim_edges_t_);
     CEBUG("done.\n")
-
-//    {
-//      vector<skimedges_t>::iterator seI=AS_skim_edges.begin();
-//      for(; seI != AS_skim_edges.end(); seI++){
-//	CEBUG(*seI);
-//      }
-//    }
-
     return static_cast<uint32>(AS_skim_edges.size());
   }else{
     // nothing more to load, we'll stop
@@ -890,20 +797,19 @@ size_t Assembly::rsh4_getNextNormalisedSkimBlock(list<int64> & idblocks, int64 &
  *
  *************************************************************************/
 
-size_t Assembly::rsh4_loadNormalisedSkimHitBlock(const string & filename, uint64 skimindex, int64 blockstartid, int64 blockendid, int8 rid1dir, int8 rid2dir)
+size_t Assembly::rsh4_loadNormalisedSkimHitBlock(const string & filename, size_t skimindex, int64 blockstartid, int64 blockendid, int8 rid1dir, int8 rid2dir)
 {
-  FUNCSTART("size_t Assembly::rsh4_loadNormalisedSkimHitBlock(const string & filename, uint64 skimindex, int64 blockstartid, int64 blockendid, int8 rid1dir, int8 rid2dir)");
-
+  FUNCSTART("uint32 Assembly::rsh4_loadSkimHitBlock(const string & filename, int32 blockstartid, int32 blockendid, int8 rid1dir, int8 rid2dir)");
 
   FILE * fin;
   fin = fopen(filename.c_str(),"r");
-  if(fin == nullptr) {
+  if(fin == NULL) {
     MIRANOTIFY(Notify::FATAL, "File not found: " << filename);
   }
 
   skimedges_t tmpsedge;
-  tmpsedge.setRID1dir(rid1dir);
-  tmpsedge.setRID2dir(rid2dir);
+  tmpsedge.rid1dir=rid1dir;
+  tmpsedge.rid2dir=rid2dir;
 
   uint64 lineno=0;
   uint32 bannedoverlapsfound=0;
@@ -912,11 +818,11 @@ size_t Assembly::rsh4_loadNormalisedSkimHitBlock(const string & filename, uint64
   skimhitforsave_t tmpshfs;
 
   CEBUG("Starting at " << skimindex << endl);
-
+  
   while(!feof(fin)){
     lineno++;
 
-    auto numread=myFRead(&tmpshfs,sizeof(tmpshfs),1,fin);
+    int numread=fread(&tmpshfs,sizeof(tmpshfs),1,fin);
 
     if(!feof(fin)) {
       if(numread==0) {
@@ -925,69 +831,71 @@ size_t Assembly::rsh4_loadNormalisedSkimHitBlock(const string & filename, uint64
       tmpsedge.rid1=tmpshfs.rid1;
       tmpsedge.linked_with=tmpshfs.rid2;
       if((tmpsedge.rid1>=blockstartid && tmpsedge.rid1<blockendid)
-	 || (tmpsedge.linked_with>=blockstartid && tmpsedge.linked_with<blockendid)){
-	// insert only where the reads are not permanently banned
-	//  from overlapping
-	if(!AS_permanent_overlap_bans.checkIfBanned(tmpsedge.rid1,tmpsedge.linked_with)){
-	  tmpsedge.eoffset=tmpshfs.eoffset;
+	 || (tmpsedge.linked_with>=blockstartid 
+	     && tmpsedge.linked_with<blockendid)){
+	tmpsedge.eoffset=tmpshfs.eoffset;
 
-	  tmpsedge.skimweight=tmpshfs.numhashes*tmpshfs.percent_in_overlap*tmpshfs.percent_in_overlap;
-	  tmpsedge.scoreratio=tmpshfs.percent_in_overlap;
+	tmpsedge.skimweight=tmpshfs.numhashes*tmpshfs.percent_in_overlap*tmpshfs.percent_in_overlap;
+	tmpsedge.scoreratio=tmpshfs.percent_in_overlap;
 
-	  tmpsedge.ol_stronggood  = tmpshfs.ol_stronggood  ;
-	  tmpsedge.ol_weakgood    = tmpshfs.ol_weakgood    ;
-	  tmpsedge.ol_belowavgfreq= tmpshfs.ol_belowavgfreq;
-	  tmpsedge.ol_norept      = tmpshfs.ol_norept      ;
-	  tmpsedge.ol_rept        = tmpshfs.ol_rept        ;
+	tmpsedge.ol_stronggood  = tmpshfs.ol_stronggood  ;
+	tmpsedge.ol_weakgood    = tmpshfs.ol_weakgood    ;
+	tmpsedge.ol_belowavgfreq= tmpshfs.ol_belowavgfreq;
+	tmpsedge.ol_norept      = tmpshfs.ol_norept      ;
+	tmpsedge.ol_rept        = tmpshfs.ol_rept        ;
 
+	// insert only where the reads are not permanently banned 
+	//  from overlapping
+	if(!AS_permanent_overlap_bans.checkIfBanned(tmpsedge.rid1,tmpsedge.linked_with)){
 	  tmpsedge.skimindex=skimindex;
 	  //cout << "tmpse: " << tmpsedge;
-
-	  if(AS_skim_edges.size()+1 >= AS_skim_edges.capacity()){
-	    cout << "there's gonna be a problem ..." << endl;
-	    cout << AS_writtenskimhitsperid.size() << endl;
-	    cout << AS_skim_edges.size() << endl;
-
-	    vector<uint32> tmpperid(AS_writtenskimhitsperid.size(),0);
-	    vector<skimedges_t>::const_iterator asseI=AS_skim_edges.begin();
-	    for(; asseI != AS_skim_edges.end(); ++asseI){
-	      ++tmpperid[min(asseI->rid1,asseI->linked_with)];
+	  
+	  if(tmpsedge.rid1>=blockstartid
+	     && tmpsedge.linked_with>=blockstartid
+	     && ((tmpsedge.rid1>=blockstartid && tmpsedge.rid1<blockendid)
+		  || (tmpsedge.linked_with>=blockstartid && tmpsedge.linked_with<blockendid))) {
+	      
+	    // Emacs doesn't get the indentation right here, don't auto-indent! *sigh*
+
+	    if(AS_skim_edges.size()+1 >= AS_skim_edges.capacity()){
+	      cout << "there's gonna be a problem ..." << endl;
+	      cout << AS_writtenskimhitsperid.size() << endl;
+	      cout << AS_skim_edges.size() << endl;
+
+	      vector<uint32> tmpperid(AS_writtenskimhitsperid.size(),0);
+	      vector<skimedges_t>::const_iterator asseI=AS_skim_edges.begin();
+	      for(; asseI != AS_skim_edges.end(); ++asseI){
+		++tmpperid[min(asseI->rid1,asseI->linked_with)];
+	      }
+
+	      ++tmpperid[min(tmpsedge.rid1, tmpsedge.linked_with)];
+
+	      for(size_t tmpi=0; tmpi<tmpperid.size(); ++tmpi){
+		if(tmpperid[tmpi]>AS_writtenskimhitsperid[tmpi]){
+		  cout << "FAIL: "
+		       << tmpi << "\t" 
+		       << AS_writtenskimhitsperid[tmpi]
+		       << '\t'
+		       << tmpperid[tmpi]
+		       << endl;
+		}else{
+		  cout << "GOOD: "
+		       << tmpi << "\t" 
+		       << AS_writtenskimhitsperid[tmpi]
+		       << '\t'
+		       << tmpperid[tmpi]
+		       << endl;
+		}
+	      }
+	      BUGIFTHROW(true, "Would extend memory of AS_skim_edges? Shouldn't be. File: " << filename << "\tLine: " << lineno << '\n' << tmpsedge << endl);
 	    }
+	    AS_skim_edges.push_back(tmpsedge);
 
-	    ++tmpperid[min(tmpsedge.rid1, tmpsedge.linked_with)];
-
-//	    for(size_t tmpi=0; tmpi<tmpperid.size(); ++tmpi){
-//	      if(tmpperid[tmpi]>AS_writtenskimhitsperid[tmpi]){
-//		cout << "FAIL: "
-//		     << tmpi << "\t"
-//		     << AS_writtenskimhitsperid[tmpi]
-//		     << '\t'
-//		     << tmpperid[tmpi]
-//		     << endl;
-//	      }else{
-//		cout << "GOOD: "
-//		     << tmpi << "\t"
-//		     << AS_writtenskimhitsperid[tmpi]
-//		     << '\t'
-//		     << tmpperid[tmpi]
-//		     << endl;
-//	      }
-//	    }
-	    BUGIFTHROW(true, "Would extend memory of AS_skim_edges? Shouldn't be. File: " << filename << "\tLine: " << lineno << '\n' << tmpsedge << endl);
+	    swap(tmpsedge.rid1,tmpsedge.linked_with);
+	    swap(tmpsedge.rid1dir,tmpsedge.rid2dir);
+	    tmpsedge.eoffset=-tmpsedge.eoffset;
+	    AS_skim_edges.push_back(tmpsedge);
 	  }
-	  // DO NOT insert ids from past or future blocks as rid1, this leads to wrong interpretation of the block
-	  //  and wrong/superfluous/not-intended selection of overlaps in the rsh_* routines if
-	  //  the skim table is partitioned in multiple blocks
-	  if(tmpsedge.rid1>=blockstartid  && tmpsedge.rid1<blockendid) AS_skim_edges.push_back(tmpsedge);
-
-	  swap(tmpsedge.rid1,tmpsedge.linked_with);
-	  tmpsedge.swapRID12dirs();
-	  tmpsedge.eoffset=-tmpsedge.eoffset;
-	  // DO NOT insert ids from past or future blocks as rid1, this leads to wrong interpretation of the block
-	  //  and wrong/superfluous/not-intended selection of overlaps in the rsh_* routines if
-	  //  the skim table is partitioned in multiple blocks
-	  if(tmpsedge.rid1>=blockstartid && tmpsedge.rid1<blockendid) AS_skim_edges.push_back(tmpsedge);
-
 	  totalhits++;
 	} else {
 	  bannedoverlapsfound++;
@@ -1035,8 +943,8 @@ void Assembly::rsh4_takeThisSkim(vector<skimedges_t>::const_iterator seI, ADSEst
       AS_readpool[seI->linked_with].getLenClippedSeq(),
       seI->rid1,
       seI->linked_with,
-      seI->getRID1dir(),
-      seI->getRID2dir());
+      seI->rid1dir,
+      seI->rid2dir);
   }
   if(adse.getEstimatedLeftExpand(seI->rid1)){
     AS_numleftextendskims[seI->rid1]++;
@@ -1070,7 +978,7 @@ void Assembly::rsh4_denormaliseSkimHits(const string & targetfile, list<int64> &
   FUNCSTART("void Assembly::rsh4_denormaliseSkimHits(string & targetfile, list<int64> & idblocks, vector<uint64> & blockpos, vector<size_t> & blocklen)");
 
   cout << "De-normalising SKIM hits ... (this will take a while)" << endl;
-
+  
   FILE * fout=fopen(targetfile.c_str(), "w");
 
   blockpos.clear();
@@ -1079,10 +987,10 @@ void Assembly::rsh4_denormaliseSkimHits(const string & targetfile, list<int64> &
   int64 blockstartid=0;
   int64 blockendid=0;
   while(rsh4_getNextNormalisedSkimBlock(idblocks, blockstartid, blockendid)>0) {
-
-    blockpos.push_back(myFTell(fout));
+    
+    blockpos.push_back(ftell(fout));
     blocklen.push_back(AS_skim_edges.size());
-
+    
     if(AS_miraparams[0].getAssemblyParams().as_dateoutput) dateStamp(cout);
     {
       ostringstream ostrstr;
@@ -1090,10 +998,10 @@ void Assembly::rsh4_denormaliseSkimHits(const string & targetfile, list<int64> &
       cout << "Writing normalised skimblock " << blockstartid << " (" << setw(12) << ostrstr.str() << ") ... "; cout.flush();
     }
 
-    if(myFWrite(&AS_skim_edges[0],
-		sizeof(skimedges_t),
-		AS_skim_edges.size(),
-		fout) != AS_skim_edges.size()){
+    if(fwrite(&AS_skim_edges[0],
+	      sizeof(skimedges_t),
+	      AS_skim_edges.size(),
+	      fout) != AS_skim_edges.size()){
       MIRANOTIFY(Notify::FATAL, "Could not write anymore to normalised skim file. Disk full? Changed permissions?");
     }
     cout << "done." << endl;
@@ -1129,14 +1037,14 @@ void Assembly::rsh4_getNextSkimBlock(const string & dnsfile, uint32 blocki, cons
 
   FILE * fin;
   fin=fopen(dnsfile.c_str(), "r");
-
-  if(myFSeek(fin, blockpos[blocki],SEEK_SET)) {
+  
+  if(fseek(fin, blockpos[blocki],SEEK_SET)) {
     MIRANOTIFY(Notify::FATAL, "Could not seek " << blockpos[blocki] << " bytes in file " << dnsfile << ". Was the file deleted? Disk full?");
   }
 
   AS_skim_edges.resize(blocklen[blocki]);
 
-  if(myFRead(&AS_skim_edges[0],sizeof(skimedges_t),blocklen[blocki],fin) != blocklen[blocki]) {
+  if(fread(&AS_skim_edges[0],sizeof(skimedges_t),blocklen[blocki],fin) != blocklen[blocki]) {
       MIRANOTIFY(Notify::FATAL, "Expected to read " << blocklen[blocki] << " elements in file " << dnsfile << " but read less. Was the file deleted? Disk full?");
   }
   fclose(fin);
@@ -1180,12 +1088,12 @@ void Assembly::rsh4_purgeSkimsOfReadsCutByChimera(string & filename)
 
   FILE * finfout;
   finfout = fopen(filename.c_str(),"r+");
-  if(finfout == nullptr) {
+  if(finfout == NULL) {
     MIRANOTIFY(Notify::FATAL, "File not found: " << filename);
   }
 
-  myFSeek(finfout, 0, SEEK_END);
-  streamsize finsize=myFTell(finfout);
+  fseek(finfout, 0, SEEK_END);
+  streamsize finsize=ftell(finfout);
   rewind(finfout);
 
   uint64 lineno=0;
@@ -1197,15 +1105,15 @@ void Assembly::rsh4_purgeSkimsOfReadsCutByChimera(string & filename)
 
   while(!feof(finfout)){
     tsc.resize(500000);
-    myFSeek(finfout, freadpos, SEEK_SET);
-
-    auto numread=myFRead(&tsc[0],sizeof(skimhitforsave_t),tsc.capacity(),finfout);
+    fseek(finfout, freadpos, SEEK_SET);
+    
+    size_t numread=fread(&tsc[0],sizeof(skimhitforsave_t),tsc.capacity(),finfout);
 
     if(numread==0) break;
     CEBUG("rsh4_pSOFRCBC read " << numread << endl;)
     lineno+=numread;
 
-    freadpos=myFTell(finfout);
+    freadpos=ftell(finfout);
     CEBUG("new freadpos: " << freadpos << endl);
 
     if(numread<tsc.capacity()) tsc.resize(numread);
@@ -1226,40 +1134,51 @@ void Assembly::rsh4_purgeSkimsOfReadsCutByChimera(string & filename)
 	--writeI;
 	CEBUG("Has chimera: " << *readI);
       }else{
-	++AS_writtenskimhitsperid[readI->rid1];
-	++AS_writtenskimhitsperid[readI->rid2];
+	AS_writtenskimhitsperid[min(readI->rid1,readI->rid2)]+=2;
       }
     }
 
-    // the resize thing is really not optimal ... one could write to file only a
+    // the resize thing is really not optimal ... one could write to file only a 
     //  subset. However, at the moment just keep it for 100% safety
     //cout << "Purge skim data. Old size: " << tsc.size() << endl;
     tsc.resize(tsc.size()-(readI-writeI));
     //cout << "New size: " << tsc.size() << endl;
 
     if(!tsc.empty()){
-      myFSeek(finfout, fwritepos, SEEK_SET);
-      if(myFWrite(&tsc[0],
-		  sizeof(skimhitforsave_t),
-		  tsc.size(),
-		  finfout) != tsc.size()){
+      fseek(finfout, fwritepos, SEEK_SET);
+      if(fwrite(&tsc[0],
+		sizeof(skimhitforsave_t),
+		tsc.size(),
+		finfout) != tsc.size()){
 	MIRANOTIFY(Notify::FATAL, "Could not write anymore to normalised skim file. Disk full? Changed permissions?");
       }
-      fwritepos=myFTell(finfout);
+      fwritepos=ftell(finfout);
       CEBUG("new fwritepos: " << fwritepos << endl);
     }
   }
 
   fclose(finfout);
 
+//  {
+//    int tmp=system(system_lsdir.c_str()); 
+//    // don't complain about unused variable
+//    (void) tmp;
+//  }
+
   cout << "truncating " << filename << " from " << finsize << " to " << fwritepos << endl;
   if(truncate(filename.c_str(),fwritepos)){
     MIRANOTIFY(Notify::FATAL, "Could not truncate normalised skim file? Strange ...");
   }
 
+//  {
+//    int tmp=system(system_lsdir.c_str()); 
+//    // don't complain about unused variable
+//    (void) tmp;
+//  }
+//
 //  tsc.resize(500000);
 //  finfout = fopen(filename.c_str(),"r+");
-//  size_t numread=myFRead(&tsc[0],sizeof(skimhitforsave_t),500000,finfout);
+//  size_t numread=fread(&tsc[0],sizeof(skimhitforsave_t),500000,finfout);
 //  CEBUG("Read anew: " << numread << endl);
 //  tsc.resize(numread);
 //  for(uint32 i=0;i < numread; i++){
@@ -1290,22 +1209,9 @@ void Assembly::rsh4_takeRailHits(const string & dnsfile, const vector<uint64> &
   ADSEstimator adse;
 
   // first, look which reads are completely covered by one rail
-  //  as for those, we'll disallow overlaps with partial rails
-  //  ...
+  // for those, we'll disallow overlaps with partial rails
   vector<uint8> fullycovered(AS_readpool.size(),0);
 
-  /* ...
-   BUT: status fullycovered can be achieved only for Skims where the
-    skimweight is at least 10% (or 50%?)  of the best available Skim or else
-    some spurious hits (without real alignment) in a contig may turn on the
-    "fully covered" status whereas there may be a perfect hit at one of the
-    contig ends
-  */
-  // best skim weight encountered by a read
-  //  should be searched normally in two-pass loop, but as reads in MIRA
-  //  are sorted by rails first, then other reads, we can do this is one loop
-  vector<uint32> bestskimweight(AS_readpool.size(),0);
-
   for(uint32 bi=0; bi<blockpos.size(); bi++){
     rsh4_getNextSkimBlock(dnsfile, bi, blockpos, blocklen);
 
@@ -1313,10 +1219,7 @@ void Assembly::rsh4_takeRailHits(const string & dnsfile, const vector<uint64> &
     vector<skimedges_t>::const_iterator seI=AS_skim_edges.begin();
 
     for(; seI != AS_skim_edges.end(); ++seI){
-      CEBUG("eSEd " << AS_readpool[seI->rid1].getName() << "\t" << AS_readpool[seI->linked_with].getName() << "\t" << *seI);
-      if(seI->skimweight > bestskimweight[seI->rid1]) bestskimweight[seI->rid1]=seI->skimweight;
-      if(seI->skimweight > bestskimweight[seI->linked_with]) bestskimweight[seI->linked_with]=seI->skimweight;
-
+      CEBUG(*seI);
       // we want first non rail
       if(AS_readpool.getRead(seI->rid1).isRail()) continue;
 
@@ -1326,16 +1229,11 @@ void Assembly::rsh4_takeRailHits(const string & dnsfile, const vector<uint64> &
 	AS_readpool[seI->linked_with].getLenClippedSeq(),
 	seI->rid1,
 	seI->linked_with,
-	seI->getRID1dir(),
-	seI->getRID2dir());
-
-      // fully covered only for skim weights >= 50% of best weight
-      if(seI->skimweight >= bestskimweight[seI->rid1]/2
-	 // getEstimated*Expand() should be evaluated >= 0, but as the estimated expand
-	 //  may not be 100% accurate anyway, this builds in a (small) security buffer
-	 && adse.getEstimatedLeftExpand(seI->rid1) > 0
-	 && adse.getEstimatedRightExpand(seI->rid1) > 0){
-	CEBUG("Set fully cover " << AS_readpool[seI->rid1].getName() << endl);
+	seI->rid1dir,
+	seI->rid2dir);
+
+      if(adse.getEstimatedLeftExpand(seI->rid1) > 0
+	 && adse.getEstimatedRightExpand(seI->rid1)>0){
 	fullycovered[seI->rid1]=1;
       }
     }
@@ -1350,14 +1248,11 @@ void Assembly::rsh4_takeRailHits(const string & dnsfile, const vector<uint64> &
     }
   }
 
-  // reuse now unneeded bestskimweight for potentialmapcounter
-  vector<uint32> & potentialmapcounter=bestskimweight;
-  potentialmapcounter.clear();
-  potentialmapcounter.resize(AS_readpool.size(),0);
+  vector<uint32> potentialmapcounter(AS_readpool.size(),0);
   vector<uint32> hasmapcounter(AS_readpool.size(),0);
   uint32 counter=0;
 
-  // then, count how many reads map to each rail
+  // then, count how many reads map to each rail 
 
   cout << "Count mappings:\n";
 
@@ -1378,11 +1273,11 @@ void Assembly::rsh4_takeRailHits(const string & dnsfile, const vector<uint64> &
 	thisrid1=seS->rid1;
 	//bestweight=seS->skimweight;
       }
-      CEBUG("seS " << AS_readpool[seS->rid1].getName() << "\t" << AS_readpool[seS->linked_with].getName() << "\t" << *seS);
+      CEBUG(*seS);
       // we want first non rail
       if(AS_readpool.getRead(seS->rid1).isRail()) continue;
 
-      // if read has full coverage by a rail, make sure this rail is
+      // if read has full coverage by a rail, make sure this rail is 
       //  covering fully, too
       if(fullycovered[seS->rid1]){
 	adse.calcNewEstimateFromSkim(
@@ -1391,8 +1286,8 @@ void Assembly::rsh4_takeRailHits(const string & dnsfile, const vector<uint64> &
 	  AS_readpool[seS->linked_with].getLenClippedSeq(),
 	  seS->rid1,
 	  seS->linked_with,
-	  seS->getRID1dir(),
-	  seS->getRID2dir());
+	  seS->rid1dir,
+	  seS->rid2dir);
 	// if containment-level == 0, then some sequence has an overhang
 	//  and we don't want that
 	if(adse.getContainmentLevel() == 0){
@@ -1402,7 +1297,7 @@ void Assembly::rsh4_takeRailHits(const string & dnsfile, const vector<uint64> &
       }
 
       CEBUG("Passed fully covered check\n");
-
+      
       // search best weight of link with a rail
       // (and at the same time set seS as endpoint for [seS-seS[ range)
       uint32 bestrailweight=0;
@@ -1418,7 +1313,7 @@ void Assembly::rsh4_takeRailHits(const string & dnsfile, const vector<uint64> &
 
       vector<skimedges_t>::const_iterator seI=seS;
       for(; seI != seE; seI++){
-	if(seI->skimweight == bestrailweight
+	if(seI->skimweight == bestrailweight 
 	   && !AS_skimstaken[seI->skimindex]
 	   && AS_readpool.getRead(seI->linked_with).isRail()){
 	  potentialmapcounter[seI->linked_with]++;
@@ -1467,7 +1362,7 @@ void Assembly::rsh4_takeRailHits(const string & dnsfile, const vector<uint64> &
       if(AS_readpool.getRead(seS->rid1).isRail()) continue;
       CEBUG("Dubido\n");
 
-      // if read has full coverage by a rail, make sure this rail is
+      // if read has full coverage by a rail, make sure this rail is 
       //  covering fully, too
       if(fullycovered[seS->rid1]){
 	adse.calcNewEstimateFromSkim(
@@ -1476,8 +1371,8 @@ void Assembly::rsh4_takeRailHits(const string & dnsfile, const vector<uint64> &
 	  AS_readpool[seS->linked_with].getLenClippedSeq(),
 	  seS->rid1,
 	  seS->linked_with,
-	  seS->getRID1dir(),
-	  seS->getRID2dir());
+	  seS->rid1dir,
+	  seS->rid2dir);
 	// if containment-level == 0, then some sequence has an overhang
 	//  and we don't want that
 	if(adse.getContainmentLevel() == 0){
@@ -1494,7 +1389,7 @@ void Assembly::rsh4_takeRailHits(const string & dnsfile, const vector<uint64> &
 	if(AS_readpool.getRead(seE->linked_with).isRail()
 	   && !AS_skimstaken[seE->skimindex]){
 
-	  // if read has full coverage by a rail, make sure this rail is
+	  // if read has full coverage by a rail, make sure this rail is 
 	  //  covering fully, too
 	  if(fullycovered[seE->rid1]){
 	    adse.calcNewEstimateFromSkim(
@@ -1503,8 +1398,8 @@ void Assembly::rsh4_takeRailHits(const string & dnsfile, const vector<uint64> &
 	      AS_readpool[seE->linked_with].getLenClippedSeq(),
 	      seE->rid1,
 	      seE->linked_with,
-	      seE->getRID1dir(),
-	      seE->getRID2dir());
+	      seE->rid1dir,
+	      seE->rid2dir);
 	    // if containment-level == 0, then some sequence has an overhang
 	    //  and we don't want that
 	    if(adse.getContainmentLevel() == 0){
@@ -1517,19 +1412,19 @@ void Assembly::rsh4_takeRailHits(const string & dnsfile, const vector<uint64> &
 	}
       }
 
-      //
-
+      // 
+      
       uint32 lowestnummapped=0xffffffff;
       uint32 lowestpotentialmapped=0xffffffff;
       vector<skimedges_t>::const_iterator seI=seS;
       vector<skimedges_t>::const_iterator seC=AS_skim_edges.end();
       for(; seI != seE; seI++){
-	if(seI->skimweight == bestrailweight
+	if(seI->skimweight == bestrailweight 
 	   && AS_readmaytakeskim[seI->rid1]
 	   && !AS_skimstaken[seI->skimindex]
 	   && AS_readpool.getRead(seI->linked_with).isRail()){
 
-	  // if read has full coverage by a rail, make sure this rail is
+	  // if read has full coverage by a rail, make sure this rail is 
 	  //  covering fully, too
 	  if(fullycovered[seI->rid1]){
 	    adse.calcNewEstimateFromSkim(
@@ -1538,8 +1433,8 @@ void Assembly::rsh4_takeRailHits(const string & dnsfile, const vector<uint64> &
 	      AS_readpool[seI->linked_with].getLenClippedSeq(),
 	      seI->rid1,
 	      seI->linked_with,
-	      seI->getRID1dir(),
-	      seI->getRID2dir());
+	      seI->rid1dir,
+	      seI->rid2dir);
 	    // if containment-level == 0, then some sequence has an overhang
 	    //  and we don't want that
 	    if(adse.getContainmentLevel() == 0){
@@ -1560,7 +1455,7 @@ void Assembly::rsh4_takeRailHits(const string & dnsfile, const vector<uint64> &
 	  }
 	}
       }
-
+      
       if(seC!=AS_skim_edges.end()){
 	CEBUG("!!!chosen: " << *seC);
 	potentialmapcounter[seC->linked_with]--;
@@ -1627,9 +1522,18 @@ void Assembly::rsh4_flagMulticopyReads(const string & dnsfile, const vector<uint
 
 /*************************************************************************
  *
+ * Two functions!
+ *
  * The match with the best score which extends to either side is taken as
  *  reference (-5%) for the minimum score ratio other matches should have
  *
+ * Setup vector allowquickoverlap for pathfinder
+ *  Rules: 
+ *    - Sanger, 454, PacBio: true for all reads
+ *    - Solexa: true for reads which have 
+ *                  - extends to *both* sides with overlap length of 80%
+ *                  - AND these overlaps have score ration of 100%
+ *
  *************************************************************************/
 
 //#define CEBUG(bla)   {cout << bla; cout.flush();}
@@ -1641,6 +1545,10 @@ void Assembly::rsh4_weedOutBadHits(const string & dnsfile, const vector<uint64>
   vector<bool> hasleft80100extend(AS_readpool.size(),false);
   vector<bool> hasright80100extend(AS_readpool.size(),false);
 
+  // TODO
+  //AS_allowquickoverlap.clear();
+  //AS_allowquickoverlap.resize(AS_readpool.size(),true);
+
   for(uint32 bi=0; bi<blockpos.size(); bi++){
     rsh4_getNextSkimBlock(dnsfile, bi, blockpos, blocklen);
 
@@ -1660,10 +1568,10 @@ void Assembly::rsh4_weedOutBadHits(const string & dnsfile, const vector<uint64>
 	AS_readpool[seI->linked_with].getLenClippedSeq(),
 	seI->rid1,
 	seI->linked_with,
-	seI->getRID1dir(),
-	seI->getRID2dir());
+	seI->rid1dir,
+	seI->rid2dir);
 
-      if(AS_skimleftextendratio[seI->rid1]== 0
+      if(AS_skimleftextendratio[seI->rid1]== 0 
 	 || AS_skimrightextendratio[seI->rid1]== 0){
 	CEBUG("check!\n");
 
@@ -1682,8 +1590,8 @@ void Assembly::rsh4_weedOutBadHits(const string & dnsfile, const vector<uint64>
 	  }
 	}
 	CEBUG('\n');
-
-	if(AS_readpool[seI->rid1].getSequencingType()==ReadGroupLib::SEQTYPE_SOLEXA && seI->scoreratio==100){
+	
+	if(AS_readpool[seI->rid1].getSequencingType()==Read::SEQTYPE_SOLEXA && seI->scoreratio==100){
 	  if(adse.getEstimatedOverlap() >= (AS_readpool[seI->rid1].getLenClippedSeq()*8)/10){
 	    if(adse.getEstimatedLeftExpand(seI->rid1)>0){
 	      hasleft80100extend[seI->rid1]=true;
@@ -1704,6 +1612,18 @@ void Assembly::rsh4_weedOutBadHits(const string & dnsfile, const vector<uint64>
 	  << '\t' << static_cast<uint16>(AS_skimrightextendratio[i])
 	  << '\n');
   }
+//TODO
+//set  pf_allowquickoverlap in newedges on loading
+//define rules in pathfinder
+//
+//  for(size_t actrid=0; actrid<AS_readpool.size(); ++actrid){
+//    if(AS_readpool[actrid].getSequencingType()==Read::SEQTYPE_SOLEXA){
+//      if(!hasleft80100extend[actrid] || !hasright80100extend[actrid]){
+//	AS_allowquickoverlap[actrid]=false;
+//      }
+//    }
+//  }
+
 }
 //#define CEBUG(bla)
 
@@ -1737,8 +1657,8 @@ void Assembly::rsh4_take100PCMappingHits(const string & dnsfile, const vector<ui
   FUNCSTART("void Assembly::rsh4_take100PCMappingHits(const string & dnsfile, const vector<uint64> & blockpos, const vector<size_t> & blocklen)");
   CEBUG("rsh4 Take 100% mapping hits." << endl);
 
-#if CPP_READ_SEQTYPE_END != 8
-#error "This code is made for 8 sequencing types, adapt!"
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
 #endif
 
   assembly_parameters const & as_fixparams= AS_miraparams[0].getAssemblyParams();
@@ -1752,7 +1672,7 @@ void Assembly::rsh4_take100PCMappingHits(const string & dnsfile, const vector<ui
   vector<uint32> hasmapcounter(AS_readpool.size(),0);
   size_t counter=0;
 
-  // first, count how many short reads map to each long read
+  // first, count how many short reads map to each long read 
 
   for(uint32 bi=0; bi<blockpos.size(); bi++){
     rsh4_getNextSkimBlock(dnsfile, bi, blockpos, blocklen);
@@ -1771,7 +1691,7 @@ void Assembly::rsh4_take100PCMappingHits(const string & dnsfile, const vector<ui
 
       // we want first short and linked with a long read,
       //  i.e. continue if not the case
-      if(!AS_readpool[seS->rid1].isSequencingType(ReadGroupLib::SEQTYPE_SOLEXA)
+      if(!AS_readpool[seS->rid1].isSequencingType(Read::SEQTYPE_SOLEXA)
 	 || !AS_readmaytakeskim[seS->rid1]) continue;
       CEBUG("s1\n");
 
@@ -1780,7 +1700,7 @@ void Assembly::rsh4_take100PCMappingHits(const string & dnsfile, const vector<ui
       uint32 bestmapweight=0;
       seE=seS;
       for(; seE != AS_skim_edges.end() && seE->rid1==thisrid1; seE++){
-	if(!AS_readpool.getRead(seE->linked_with).isSequencingType(ReadGroupLib::SEQTYPE_SOLEXA)
+	if(!AS_readpool.getRead(seE->linked_with).isSequencingType(Read::SEQTYPE_SOLEXA)
 	   && seE->scoreratio == 100
 	   && seE->ol_stronggood
 	   && !AS_skimstaken[seE->skimindex]){
@@ -1791,17 +1711,17 @@ void Assembly::rsh4_take100PCMappingHits(const string & dnsfile, const vector<ui
       CEBUG("rid1: " << thisrid1 << "\tbmw: " << bestmapweight << '\n');
 
       // take an edge only if it's the best weight
-
+      
       vector<skimedges_t>::const_iterator seI=seS;
       for(; seI != seE; seI++){
- 	CEBUG((seI->skimweight == bestmapweight)
-	      << ' ' << !AS_readpool.getRead(seI->linked_with).isSequencingType(ReadGroupLib::SEQTYPE_SOLEXA)
+ 	CEBUG((seI->skimweight == bestmapweight) 
+	      << ' ' << !AS_readpool.getRead(seI->linked_with).isSequencingType(Read::SEQTYPE_SOLEXA)
 	      << ' ' << (seI->scoreratio == 100)
 	      << ' ' << seI->ol_stronggood
 	      << ' ' << !AS_skimstaken[seI->skimindex] << endl);
 
- 	if(seI->skimweight == bestmapweight
-	   && !AS_readpool.getRead(seI->linked_with).isSequencingType(ReadGroupLib::SEQTYPE_SOLEXA)
+ 	if(seI->skimweight == bestmapweight 
+	   && !AS_readpool.getRead(seI->linked_with).isSequencingType(Read::SEQTYPE_SOLEXA)
 	   && seI->scoreratio == 100
 	   && seI->ol_stronggood
 	   && !AS_skimstaken[seI->skimindex]){
@@ -1841,7 +1761,7 @@ void Assembly::rsh4_take100PCMappingHits(const string & dnsfile, const vector<ui
 	thisrid1=seS->rid1;
       }
       // we want first to be Solexa
-      if(!AS_readpool[seS->rid1].isSequencingType(ReadGroupLib::SEQTYPE_SOLEXA)
+      if(!AS_readpool[seS->rid1].isSequencingType(Read::SEQTYPE_SOLEXA)
 	 || !AS_readmaytakeskim[seS->rid1]) continue;
 
       // search best 100% map weight of this short read with a long read
@@ -1849,7 +1769,7 @@ void Assembly::rsh4_take100PCMappingHits(const string & dnsfile, const vector<ui
       uint32 bestmapweight=0;
       seE=seS;
       for(; seE != AS_skim_edges.end() && seE->rid1==thisrid1; seE++){
-	if(!AS_readpool.getRead(seE->linked_with).isSequencingType(ReadGroupLib::SEQTYPE_SOLEXA)
+	if(!AS_readpool.getRead(seE->linked_with).isSequencingType(Read::SEQTYPE_SOLEXA)
 	   && seE->scoreratio == 100
 	   && seE->ol_stronggood
 	   && !AS_skimstaken[seE->skimindex]){
@@ -1863,8 +1783,8 @@ void Assembly::rsh4_take100PCMappingHits(const string & dnsfile, const vector<ui
 	vector<skimedges_t>::const_iterator seI=seS;
 	vector<skimedges_t>::const_iterator seC=AS_skim_edges.end();
 	for(; seI != seE; seI++){
-	  if(seI->skimweight == bestmapweight
-	     && !AS_readpool.getRead(seI->linked_with).isSequencingType(ReadGroupLib::SEQTYPE_SOLEXA)
+	  if(seI->skimweight == bestmapweight 
+	     && !AS_readpool.getRead(seI->linked_with).isSequencingType(Read::SEQTYPE_SOLEXA)
 	     && seI->scoreratio == 100
 	     && seI->ol_stronggood
 	     && !AS_skimstaken[seI->skimindex]){
@@ -1880,7 +1800,7 @@ void Assembly::rsh4_take100PCMappingHits(const string & dnsfile, const vector<ui
 	    }
 	  }
 	}
-
+	
 	if(seC!=AS_skim_edges.end()){
 	  CEBUG("!!!chosen: " << *seC);
 	  potentialmapcounter[seC->linked_with]--;
@@ -1917,34 +1837,29 @@ void Assembly::rsh4_take100PCMappingHits(const string & dnsfile, const vector<ui
 
 
 //#define CEBUG(bla)   {cout << bla; cout.flush();}
-void Assembly::rsh4_takeNonReptHitsThatExtend(uint32 nbest, vector<uint32> & nbestl, vector<uint32> & nbestr, uint8 minscoreratio, const string & dnsfile, const vector<uint64> & blockpos, const vector<size_t> & blocklen)
+void Assembly::rsh4_takeNonReptHitsThatExtend(uint32 nbest, uint8 minscoreratio, const string & dnsfile, const vector<uint64> & blockpos, const vector<size_t> & blocklen)
 {
   CEBUG("rsh4_takeAvgFreqHitsThatExtend." << endl);
-
-  nbestl.clear();
-  nbestl.resize(AS_readpool.size(),nbest);
-  nbestr.clear();
-  nbestr.resize(AS_readpool.size(),nbest);
-
   ADSEstimator adse;
+
   size_t counter=0;
 
   for(uint32 bi=0; bi<blockpos.size(); bi++){
     rsh4_getNextSkimBlock(dnsfile, bi, blockpos, blocklen);
 
     int32 lastrid1=-1;
-    //uint32 needlextend=nbest;
-    //uint32 needrextend=nbest;
+    uint32 needlextend=nbest;
+    uint32 needrextend=nbest;
     bool takeskim=false;
     vector<skimedges_t>::const_iterator seI=AS_skim_edges.begin();
     for(; seI != AS_skim_edges.end(); seI++){
       if(seI->rid1 != lastrid1){
 	CEBUG("New rid1: " << seI->rid1 << '\n');
 	lastrid1=seI->rid1;
-	//needlextend=nbest;
-	//needrextend=nbest;
+	needlextend=nbest;
+	needrextend=nbest;
       }
-      //CEBUG("nle: " << needlextend << " nre: " << needrextend << '\n');
+      CEBUG("nle: " << needlextend << " nre: " << needrextend << '\n');
       CEBUG(*seI);
       CEBUG("AS_readmaytakeskim[seI->rid1]: " << AS_readmaytakeskim[seI->rid1]);
       CEBUG("\nAS_readmaytakeskim[seI->linked_with]: " << AS_readmaytakeskim[seI->linked_with]);
@@ -1952,7 +1867,7 @@ void Assembly::rsh4_takeNonReptHitsThatExtend(uint32 nbest, vector<uint32> & nbe
       CEBUG('\n');
       if((!seI->ol_rept || seI->ol_weakgood)
 	 && seI->scoreratio >= minscoreratio
-	 && (nbestl[seI->rid1]>0 || nbestr[seI->rid1]>0)
+	 && (needlextend > 0 || needrextend>0)
 	 && AS_readmaytakeskim[seI->rid1]
 	 && AS_readmaytakeskim[seI->linked_with]
 	 && AS_wellconnected[seI->rid1]
@@ -1966,23 +1881,23 @@ void Assembly::rsh4_takeNonReptHitsThatExtend(uint32 nbest, vector<uint32> & nbe
 	  AS_readpool[seI->linked_with].getLenClippedSeq(),
 	  seI->rid1,
 	  seI->linked_with,
-	  seI->getRID1dir(),
-	  seI->getRID2dir());
+	  seI->rid1dir,
+	  seI->rid2dir);
 
 	takeskim=false;
-	if(nbestl[seI->rid1]>0
+	if(needlextend>0 
 	   && adse.getEstimatedLeftExpand(seI->rid1)>0
 	   && seI->scoreratio >= AS_skimleftextendratio[seI->rid1]){
 	  CEBUG(" lextend");
-	  --nbestl[seI->rid1];
 	  takeskim=true;
+	  needlextend--;
 	}
-	if(nbestr[seI->rid1]>0
+	if(needrextend>0
 	   && adse.getEstimatedRightExpand(seI->rid1)>0
 	   && seI->scoreratio >= AS_skimrightextendratio[seI->rid1]){
 	  CEBUG(" rextend");
-	  --nbestr[seI->rid1];
 	  takeskim=true;
+	  needrextend--;
 	}
 	if(takeskim){
 	  CEBUG(" takeskim");
@@ -1999,37 +1914,6 @@ void Assembly::rsh4_takeNonReptHitsThatExtend(uint32 nbest, vector<uint32> & nbe
 
 
 
-/*************************************************************************
- *
- * New 14.10.2014 to get rept/nonrept borders covered as best as possible
- * (for scaffolding)
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-void Assembly::rsh4_takeReptNonReptBorders(uint8 minscoreratio, const string & dnsfile, const vector<uint64> & blockpos, const vector<size_t> & blocklen)
-{
-  CEBUG("rsh4_takeReptNonReptBorders()" << endl);
-  uint32 counter=0;
-  for(uint32 bi=0; bi<blockpos.size(); ++bi){
-    rsh4_getNextSkimBlock(dnsfile, bi, blockpos, blocklen);
-    auto seI=AS_skim_edges.cbegin();
-    for(; seI != AS_skim_edges.end(); ++seI){
-      if(seI->ol_stronggood
-	 && seI->ol_rept
-	 && seI->scoreratio >= minscoreratio
-	 && AS_skimstaken[seI->skimindex] == false){
-	// a "silent" take skim:
-	// does not appear in AS_numskimoverlaps and AS_numleft/rightextends
-	// so that other thresholds are not disturbed by this
-	CEBUG(" takeskim");
-	AS_skimstaken[seI->skimindex]=true;
-	++counter;
-      }
-    }
-  }
-  CEBUG("Taken " << counter << " hits." << endl);
-}
 
 //#define CEBUG(bla)   {cout << bla; cout.flush();}
 void Assembly::rsh4_takeReptPEPEHitsThatExtend(uint32 nbest, uint8 minscoreratio, const string & dnsfile, const vector<uint64> & blockpos, const vector<size_t> & blocklen)
@@ -2085,14 +1969,14 @@ void Assembly::rsh4_takeReptPEPEHitsThatExtend(uint32 nbest, uint8 minscoreratio
 	  AS_readpool[seI->linked_with].getLenClippedSeq(),
 	  seI->rid1,
 	  seI->linked_with,
-	  seI->getRID1dir(),
-	  seI->getRID2dir());
+	  seI->rid1dir,
+	  seI->rid2dir);
 
 	takeskim=false;
 
 	int32 bin=adse.getEstimatedLeftExpand(seI->rid1)/10;
 	if(bin>=lextendbins.size()) bin=lextendbins.size()-1;
-	if(lextendbins[bin]>0
+	if(lextendbins[bin]>0 
 	   && seI->scoreratio >= AS_skimleftextendratio[seI->rid1]){
 	  CEBUG(" lextend");
 	  lextendbins[bin]--;
@@ -2169,8 +2053,8 @@ void Assembly::rsh4_takeReptNPENPEHitsThatExtend(uint32 nbest, uint8 minscorerat
 	  AS_readpool[seI->linked_with].getLenClippedSeq(),
 	  seI->rid1,
 	  seI->linked_with,
-	  seI->getRID1dir(),
-	  seI->getRID2dir());
+	  seI->rid1dir,
+	  seI->rid2dir);
 
 	takeskim=false;
 
@@ -2258,8 +2142,8 @@ void Assembly::rsh4_takeReptPENPEHitsThatExtend(uint32 nbest, uint8 minscorerati
 	  AS_readpool[seI->linked_with].getLenClippedSeq(),
 	  seI->rid1,
 	  seI->linked_with,
-	  seI->getRID1dir(),
-	  seI->getRID2dir());
+	  seI->rid1dir,
+	  seI->rid2dir);
 
 	takeskim=false;
 
@@ -2296,15 +2180,9 @@ void Assembly::rsh4_takeReptPENPEHitsThatExtend(uint32 nbest, uint8 minscorerati
 
 
 //#define CEBUG(bla)   {cout << bla; cout.flush();}
-void Assembly::rsh4_takeNonTakenReadsWithHitsThatExtend(uint32 nbest, vector<uint32> & nbestl, vector<uint32> & nbestr, uint8 minscoreratio, const string & dnsfile, const vector<uint64> & blockpos, const vector<size_t> & blocklen)
+void Assembly::rsh4_takeNonTakenReadsWithHitsThatExtend(uint32 nbest, uint8 minscoreratio, const string & dnsfile, const vector<uint64> & blockpos, const vector<size_t> & blocklen)
 {
   CEBUG("rsh4_takeNonTakenReadsWithHitsThatExtend." << endl);
-
-  nbestl.clear();
-  nbestl.resize(AS_readpool.size(),nbest);
-  nbestr.clear();
-  nbestr.resize(AS_readpool.size(),nbest);
-
   ADSEstimator adse;
 
   size_t counter=0;
@@ -2313,20 +2191,18 @@ void Assembly::rsh4_takeNonTakenReadsWithHitsThatExtend(uint32 nbest, vector<uin
     rsh4_getNextSkimBlock(dnsfile, bi, blockpos, blocklen);
 
     int32 lastrid1=-1;
-    //uint32 needlextend=nbest;
-    //uint32 needrextend=nbest;
+    uint32 needlextend=nbest;
+    uint32 needrextend=nbest;
     bool takeskim=false;
     vector<skimedges_t>::const_iterator seI=AS_skim_edges.begin();
     for(; seI != AS_skim_edges.end(); seI++){
       if(seI->rid1 != lastrid1){
 	CEBUG("New rid1: " << seI->rid1 << '\n');
 	lastrid1=seI->rid1;
-	//needlextend=nbest;
-	//needrextend=nbest;
+	needlextend=nbest;
+	needrextend=nbest;
       }
-      if(!AS_skimstaken[seI->skimindex]
-	 && (nbestl[seI->rid1]>0
-	     || nbestr[seI->rid1]>0)){
+      if(!AS_skimstaken[seI->skimindex]){
 	CEBUG("nle: " << needlextend << " nre: " << needrextend << '\n');
 	CEBUG(*seI);
 	CEBUG("AS_readmaytakeskim[seI->rid1]: " << AS_readmaytakeskim[seI->rid1]);
@@ -2335,13 +2211,14 @@ void Assembly::rsh4_takeNonTakenReadsWithHitsThatExtend(uint32 nbest, vector<uin
 	CEBUG('\n');
 	if((!seI->ol_rept || seI->ol_weakgood)
 	   && seI->scoreratio >= minscoreratio
+	   && (needlextend > 0 || needrextend>0)
 	   && AS_readmaytakeskim[seI->rid1]
 	   && AS_readmaytakeskim[seI->linked_with]
 // Too dangerous for low cov projects (U13)
 //	   && AS_wellconnected[seI->rid1]
 //	   && AS_wellconnected[seI->linked_with]
 	  ){
-
+	  
 	  CEBUG("check!\n");
 	  adse.calcNewEstimateFromSkim(
 	    seI->eoffset,
@@ -2349,23 +2226,23 @@ void Assembly::rsh4_takeNonTakenReadsWithHitsThatExtend(uint32 nbest, vector<uin
 	    AS_readpool[seI->linked_with].getLenClippedSeq(),
 	    seI->rid1,
 	    seI->linked_with,
-	    seI->getRID1dir(),
-	    seI->getRID2dir());
-
+	    seI->rid1dir,
+	    seI->rid2dir);
+	  
 	  takeskim=false;
-	  if(nbestl[seI->rid1]>0
+	  if(needlextend>0
 	     && adse.getEstimatedLeftExpand(seI->rid1)>0
 	     && seI->scoreratio >= AS_skimleftextendratio[seI->rid1]){
 	    CEBUG(" lextend");
-	    --nbestl[seI->rid1];
 	    takeskim=true;
+	    needlextend--;
 	  }
-	  if(nbestr[seI->rid1]>0
+	  if(needrextend>0
 	     && adse.getEstimatedRightExpand(seI->rid1)>0
 	     && seI->scoreratio >= AS_skimrightextendratio[seI->rid1]){
 	    CEBUG(" rextend");
-	    --nbestr[seI->rid1];
 	    takeskim=true;
+	    needrextend--;
 	  }
 	  if(takeskim){
 	    CEBUG(" takeskim");
@@ -2384,164 +2261,6 @@ void Assembly::rsh4_takeNonTakenReadsWithHitsThatExtend(uint32 nbest, vector<uin
 
 
 
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-void Assembly::rsh4_take100PC100bpHitsThatExtend(uint32 nbest, vector<uint32> & nbestl, vector<uint32> & nbestr, const string & dnsfile, const vector<uint64> & blockpos, const vector<size_t> & blocklen)
-{
-  return;
-  CEBUG("rsh4_take100PC100bpHitsThatExtend\n");
-
-  nbestl.clear();
-  nbestl.resize(AS_readpool.size(),nbest);
-  nbestr.clear();
-  nbestr.resize(AS_readpool.size(),nbest);
-
-  ADSEstimator adse;
-
-  size_t counter=0;
-
-  for(uint32 bi=0; bi<blockpos.size(); bi++){
-    rsh4_getNextSkimBlock(dnsfile, bi, blockpos, blocklen);
-
-    int32 lastrid1=-1;
-    bool takeskim=false;
-    vector<skimedges_t>::const_iterator seI=AS_skim_edges.begin();
-    for(; seI != AS_skim_edges.end(); seI++){
-      if(seI->rid1 != lastrid1){
-	CEBUG("New rid1: " << seI->rid1 << '\n');
-	lastrid1=seI->rid1;
-	//needlextend=nbest;
-	//needrextend=nbest;
-      }
-      CEBUG(*seI);
-      CEBUG("AS_skimstaken[seI->skimindex]: " << AS_skimstaken[seI->skimindex]);
-      CEBUG("\nnbl: " << nbestl[seI->rid1] << "\tnbr: " << nbestr[seI->rid1] << '\n');
-      if(seI->scoreratio == 100
-	 && (nbestl[seI->rid1]>0
-	     || nbestr[seI->rid1]>0)
-	 && !AS_skimstaken[seI->skimindex]){
-	adse.calcNewEstimateFromSkim(
-	  seI->eoffset,
-	  AS_readpool[seI->rid1].getLenClippedSeq(),
-	  AS_readpool[seI->linked_with].getLenClippedSeq(),
-	  seI->rid1,
-	  seI->linked_with,
-	  seI->getRID1dir(),
-	  seI->getRID2dir());
-
-	CEBUG(AS_readpool[seI->rid1].getName() << "\t" <<AS_readpool[seI->linked_with].getName() << "\n");
-
-	CEBUG("ele: " << adse.getEstimatedLeftExpand(seI->rid1) << "\tere: " << adse.getEstimatedRightExpand(seI->rid1) << "\teov: " << adse.getEstimatedOverlap() << '\n');
-
-	takeskim=false;
-	if(adse.getEstimatedOverlap()>=95){
-	  if(nbestl[seI->rid1]>0
-	     && adse.getEstimatedLeftExpand(seI->rid1)>0){
-	    CEBUG(" lextend");
-	    --nbestl[seI->rid1];
-	    takeskim=true;
-	  }
-	  if(nbestr[seI->rid1]>0
-	     && adse.getEstimatedRightExpand(seI->rid1)>0){
-	    CEBUG(" rextend");
-	    --nbestr[seI->rid1];
-	    takeskim=true;
-	  }
-	}
-	if(takeskim){
-	  CEBUG(" takeskim");
-	  rsh4_takeThisSkim(seI,adse,false);
-	  counter++;
-	}
-	CEBUG('\n');
-      }
-    }
-  }
-
-  CEBUG("Taken " << counter << " hits." << endl);
-}
-//#define CEBUG(bla)
-
-
-
-
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-void Assembly::rsh4_takeWellconnected(uint32 nbest, vector<uint32> & nbestl, vector<uint32> & nbestr, const string & dnsfile, const vector<uint64> & blockpos, const vector<size_t> & blocklen)
-{
-  CEBUG("rsh4_take100PC100bpHitsThatExtend\n");
-
-  nbestl.clear();
-  nbestl.resize(AS_readpool.size(),nbest);
-  nbestr.clear();
-  nbestr.resize(AS_readpool.size(),nbest);
-
-  ADSEstimator adse;
-
-  size_t counter=0;
-
-  for(uint32 bi=0; bi<blockpos.size(); bi++){
-    rsh4_getNextSkimBlock(dnsfile, bi, blockpos, blocklen);
-
-    int32 lastrid1=-1;
-    bool takeskim=false;
-    vector<skimedges_t>::const_iterator seI=AS_skim_edges.begin();
-    for(; seI != AS_skim_edges.end(); seI++){
-      if(seI->rid1 != lastrid1){
-	CEBUG("New rid1: " << seI->rid1 << '\n');
-	lastrid1=seI->rid1;
-	//needlextend=nbest;
-	//needrextend=nbest;
-      }
-      CEBUG(*seI);
-      CEBUG("AS_skimstaken[seI->skimindex]: " << AS_skimstaken[seI->skimindex]);
-      CEBUG("\nnbl: " << nbestl[seI->rid1] << "\tnbr: " << nbestr[seI->rid1] << '\n');
-      if((nbestl[seI->rid1]>0
-	  || nbestr[seI->rid1]>0)
-	 && AS_wellconnected[seI->rid1]
-	 && AS_wellconnected[seI->linked_with]
-	 && !AS_skimstaken[seI->skimindex]){
-	adse.calcNewEstimateFromSkim(
-	  seI->eoffset,
-	  AS_readpool[seI->rid1].getLenClippedSeq(),
-	  AS_readpool[seI->linked_with].getLenClippedSeq(),
-	  seI->rid1,
-	  seI->linked_with,
-	  seI->getRID1dir(),
-	  seI->getRID2dir());
-
-	CEBUG(AS_readpool[seI->rid1].getName() << "\t" <<AS_readpool[seI->linked_with].getName() << "\n");
-
-	CEBUG("ele: " << adse.getEstimatedLeftExpand(seI->rid1) << "\tere: " << adse.getEstimatedRightExpand(seI->rid1) << "\teov: " << adse.getEstimatedOverlap() << '\n');
-
-	takeskim=false;
-	if(nbestl[seI->rid1]>0
-	   && adse.getEstimatedLeftExpand(seI->rid1)>0){
-	  CEBUG(" lextend");
-	  --nbestl[seI->rid1];
-	  takeskim=true;
-	}
-	if(nbestr[seI->rid1]>0
-	   && adse.getEstimatedRightExpand(seI->rid1)>0){
-	  CEBUG(" rextend");
-	  --nbestr[seI->rid1];
-	  takeskim=true;
-	}
-
-	if(takeskim){
-	  CEBUG(" takeskim");
-	  rsh4_takeThisSkim(seI,adse,false);
-	  counter++;
-	}
-	CEBUG('\n');
-      }
-    }
-  }
-
-  CEBUG("Taken " << counter << " hits." << endl);
-}
-//#define CEBUG(bla)
-
-
 
 
 //#define CEBUG(bla)   {cout << bla; cout.flush();}
@@ -2614,9 +2333,9 @@ void Assembly::rsh4_takeNonTakenSideExtends(uint32 nbest, uint8 minscoreratio, c
 	    AS_readpool[seI->linked_with].getLenClippedSeq(),
 	    seI->rid1,
 	    seI->linked_with,
-	    seI->getRID1dir(),
-	    seI->getRID2dir());
-
+	    seI->rid1dir,
+	    seI->rid2dir);
+	  
 	  takeskim=false;
 	  if(needlextend>0
 	     && adse.getEstimatedLeftExpand(seI->rid1)>0){
@@ -2687,56 +2406,6 @@ size_t Assembly::rsh4_tNTSEhelper(uint32 nbest, ADSEstimator & adse, vector<vect
 
 
 
-/*************************************************************************
- *
- * Sometimes, identical reads end up as singlets as they were not linked
- *  by previous "takes" (they do not extend each other). This happens for
- *  reads linking to a cluster of similar reads with very high coverage
- *  where other filters say "we have enough".
- * This helps to counterbalance.
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-void Assembly::rsh4_takeIdenticalReadHits(uint32 nbest, const string & dnsfile, const vector<uint64> & blockpos, const vector<size_t> & blocklen)
-{
-  CEBUG("rsh4_takeIdenticalReadHits." << endl);
-
-  ADSEstimator adse;
-
-  size_t counter=0;
-
-  for(uint32 bi=0; bi<blockpos.size(); bi++){
-    rsh4_getNextSkimBlock(dnsfile, bi, blockpos, blocklen);
-
-    int32 lastrid1=-1;
-    uint32 ncounter=0;
-    vector<skimedges_t>::const_iterator seI=AS_skim_edges.begin();
-    for(; seI != AS_skim_edges.end(); seI++){
-      if(seI->rid1 != lastrid1){
-	CEBUG("New rid1: " << seI->rid1 << '\n');
-	lastrid1=seI->rid1;
-	ncounter=0;
-      }
-      CEBUG(*seI);
-      CEBUG("AS_skimstaken[seI->skimindex]: " << AS_skimstaken[seI->skimindex]);
-      CEBUG("\nnbl: " << nbestl[seI->rid1] << "\tnbr: " << nbestr[seI->rid1] << '\n');
-      if(seI->eoffset==0
-	 && seI->scoreratio==100
-	 && ncounter<nbest
-	 && !AS_skimstaken[seI->skimindex]
-	 && AS_readpool[seI->rid1].getLenClippedSeq() == AS_readpool[seI->linked_with].getLenClippedSeq()
-	){
-	CEBUG(" takeskim\n");
-	rsh4_takeThisSkim(seI,adse,true);
-	++ncounter;
-	++counter;
-      }
-    }
-  }
-  CEBUG("Taken " << counter << " hits." << endl);
-}
-
 //#define CEBUG(bla)   {cout << bla; cout.flush();}
 void Assembly::rsh4_takeNonTakenReadsWithHits(uint32 nbest, const string & dnsfile, const vector<uint64> & blockpos, const vector<size_t> & blocklen)
 {
@@ -2781,7 +2450,7 @@ void Assembly::rsh4_takeNonTakenReadsWithHits(uint32 nbest, const string & dnsfi
 //#define CEBUG(bla)
 
 
-#define CEBUG(bla)   {cout << bla; cout.flush();}
+//#define CEBUG(bla)   {cout << bla; cout.flush();}
 void Assembly::rsh4_takeAll(const string & dnsfile, const vector<uint64> & blockpos, const vector<size_t> & blocklen)
 {
   CEBUG("rsh4_takeAll." << endl);
@@ -2800,7 +2469,7 @@ void Assembly::rsh4_takeAll(const string & dnsfile, const vector<uint64> & block
   }
   CEBUG("Taken " << counter << " hits." << endl);
 }
-#define CEBUG(bla)
+//#define CEBUG(bla)
 
 
 
@@ -2810,38 +2479,27 @@ void Assembly::rsh4_takeNeedAllOverlaps_weakgood(const string & dnsfile, const v
 {
   CEBUG("rsh4_takeNeedAllOverlaps." << endl);
 
-  bool foundnao=false;
-  for(auto & naoe : AS_needalloverlaps){
-    if(naoe){
-      foundnao=true;
-      break;
-    }
-  }
-  if(!foundnao){
-    CEBUG("None needed.\n");
-  }else{
-    ADSEstimator adse;
-    size_t counter=0;
-
-    for(uint32 bi=0; bi<blockpos.size(); bi++){
-      rsh4_getNextSkimBlock(dnsfile, bi, blockpos, blocklen);
+  ADSEstimator adse;
+  size_t counter=0;
 
-      vector<skimedges_t>::const_iterator seI=AS_skim_edges.begin();
-      for(; seI != AS_skim_edges.end(); seI++){
-	// have a look only at reads who had no overlaps yet
-	if(AS_needalloverlaps[seI->rid1]
-	   || AS_needalloverlaps[seI->linked_with]){
+  for(uint32 bi=0; bi<blockpos.size(); bi++){
+    rsh4_getNextSkimBlock(dnsfile, bi, blockpos, blocklen);
 
-	  if(seI->ol_weakgood
-	     && AS_skimstaken[seI->skimindex] == false){
-	    rsh4_takeThisSkim(seI,adse,true);
-	    counter++;
-	  }
+    vector<skimedges_t>::const_iterator seI=AS_skim_edges.begin();
+    for(; seI != AS_skim_edges.end(); seI++){
+      // have a look only at reads who had no overlaps yet
+      if(AS_needalloverlaps[seI->rid1]
+	 || AS_needalloverlaps[seI->linked_with]){
+	 
+	if(seI->ol_weakgood
+	   && AS_skimstaken[seI->skimindex] == false){
+	  rsh4_takeThisSkim(seI,adse,true);
+	  counter++;
 	}
       }
     }
-    CEBUG("Taken " << counter << " hits." << endl);
   }
+  CEBUG("Taken " << counter << " hits." << endl);
 }
 
 #define CEBUG(bla)
@@ -2851,77 +2509,67 @@ void Assembly::rsh4_takeNeedAllOverlaps_weakgood(const string & dnsfile, const v
 
 #define CEBUG(bla)   {cout << bla; cout.flush();}
 
-void Assembly::rsh4_takeSolexaByCritLevel(uint32 ocvi, uint32 nbest, vector<uint32> & nbestl, vector<uint32> & nbestr, const string & dnsfile, const vector<uint64> & blockpos, const vector<size_t> & blocklen)
+void Assembly::rsh4_takeSolexaByCritLevel(uint32 nbest, const string & dnsfile, const vector<uint64> & blockpos, const vector<size_t> & blocklen)
 {
   CEBUG("rsh4_takeSolexaByCritLevel." << endl);
 
-  nbestl.clear();
-  nbestl.resize(AS_readpool.size(),nbest);
-  nbestr.clear();
-  nbestr.resize(AS_readpool.size(),nbest);
-
   ADSEstimator adse;
   size_t counter=0;
 
   uint8 ocll=255;
   uint8 oclr=255;
-
+    
   for(uint32 bi=0; bi<blockpos.size(); bi++){
     rsh4_getNextSkimBlock(dnsfile, bi, blockpos, blocklen);
 
     int32 lastrid1=-1;
-    //uint32 needlextend=nbest;
-    //uint32 needrextend=nbest;
+    uint32 needlextend=nbest;
+    uint32 needrextend=nbest;
     vector<skimedges_t>::const_iterator seI=AS_skim_edges.begin();
     for(; seI != AS_skim_edges.end(); seI++){
       if(seI->rid1 != lastrid1){
-      	lastrid1=seI->rid1;
-      //	needlextend=nbest;
-      //	needrextend=nbest;
+	lastrid1=seI->rid1;
+	needlextend=nbest;
+	needrextend=nbest;
       }
-      if(!AS_skimstaken[seI->skimindex]
-	 && (nbestl[seI->rid1]>0
-	     || nbestr[seI->rid1]>0)){
-	if((AS_readpool.getRead(seI->rid1).isSequencingType(ReadGroupLib::SEQTYPE_SOLEXA)
-	    && (AS_overlapcritlevelvl[ocvi][seI->rid1] != 0
-		|| AS_overlapcritlevelvr[ocvi][seI->rid1] != 0))
-	   || (AS_readpool.getRead(seI->linked_with).isSequencingType(ReadGroupLib::SEQTYPE_SOLEXA)
-	       && (AS_overlapcritlevelvl[ocvi][seI->linked_with] != 0
-		   || AS_overlapcritlevelvr[ocvi][seI->linked_with] != 0))){
+      if((AS_readpool.getRead(seI->rid1).isSequencingType(Read::SEQTYPE_SOLEXA)
+	  && (AS_overlapcritlevell[seI->rid1] != 0
+	      || AS_overlapcritlevelr[seI->rid1] != 0))
+	 || (AS_readpool.getRead(seI->linked_with).isSequencingType(Read::SEQTYPE_SOLEXA)
+	     && (AS_overlapcritlevell[seI->linked_with] != 0
+		 || AS_overlapcritlevell[seI->linked_with] != 0))){
 
-	  adse.calcNewEstimateFromSkim(
-	    seI->eoffset,
-	    AS_readpool[seI->rid1].getLenClippedSeq(),
-	    AS_readpool[seI->linked_with].getLenClippedSeq(),
-	    seI->rid1,
-	    seI->linked_with,
-	    seI->getRID1dir(),
-	    seI->getRID2dir());
-
-	  // templated call, but function does not need to be different anyway, so take the vhash64_t version
-	  Skim<vhash64_t>::getOverlapCriterionLevel(seI->rid1,
-						    AS_readpool[seI->rid1].getSequencingType(),
-						    adse,seI->scoreratio,
-						    ocll,oclr);
-	  bool takeit=false;
-	  if(nbestl[seI->rid1]>0
-	     && ocll <= 29
-	     && AS_overlapcritlevelvl[ocvi][seI->rid1] != 0
-	     && adse.getEstimatedLeftExpand(seI->rid1)>0){
-	    --nbestl[seI->rid1];
-	    takeit=true;
-	  }else if(nbestr[seI->rid1]>0
-		   && oclr <= 29
-		   && AS_overlapcritlevelvr[ocvi][seI->rid1] != 0
-		   && adse.getEstimatedRightExpand(seI->rid1)>0){
-	    --nbestr[seI->rid1];;
-	    takeit=true;
-	  }
+	adse.calcNewEstimateFromSkim(
+	  seI->eoffset,
+	  AS_readpool[seI->rid1].getLenClippedSeq(),
+	  AS_readpool[seI->linked_with].getLenClippedSeq(),
+	  seI->rid1,
+	  seI->linked_with,
+	  seI->rid1dir,
+	  seI->rid2dir);
+	
+	Skim::getOverlapCriterionLevel(seI->rid1,
+				       AS_readpool[seI->rid1].getSequencingType(),
+				       adse,seI->scoreratio,
+				       ocll,oclr);
+	bool takeit=false;
+	if(needlextend>0
+	   && ocll <= 29
+	   && AS_overlapcritlevell[seI->rid1] != 0
+	   && adse.getEstimatedLeftExpand(seI->rid1)>0){
+	  --needlextend;
+	  takeit=true;
+	}else if(needrextend>0
+		 && oclr <= 29
+		 && AS_overlapcritlevelr[seI->rid1] != 0
+		 && adse.getEstimatedRightExpand(seI->rid1)>0){
+	  --needrextend;
+	  takeit=true;
+	}
 
-	  if(takeit){
-	    rsh4_takeThisSkim(seI,adse,true);
-	    counter++;
-	  }
+	if(takeit && AS_skimstaken[seI->skimindex] == false){
+	  rsh4_takeThisSkim(seI,adse,true);
+	  counter++;
 	}
       }
     }
diff --git a/src/mira/assembly_repeatresolve.C b/src/mira/assembly_repeatresolve.C
new file mode 100644
index 0000000..506bbc2
--- /dev/null
+++ b/src/mira/assembly_repeatresolve.C
@@ -0,0 +1,532 @@
+/*
+ * Written by Bastien Chevreux (BaCh)
+ *
+ * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
+ *   Krebsforschungszentrum, DKFZ Heidelberg) and Bastien Chevreux
+ * Copyright (C) 2000 and later by Bastien Chevreux
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ * 
+ */
+
+// 	$Id$	
+
+
+#ifndef lint
+static char vcid[] = "$Id$";
+#endif /* lint */
+
+
+#include "assembly.H"
+
+
+#define CEBUG(bla)
+#define CEBUGF(bla)
+
+
+
+#if 1
+
+
+/*************************************************************************
+ *
+ *
+ *
+ *************************************************************************/
+void Assembly::prework()
+{
+  (void) vcid;
+
+  FUNCSTART("Assembly::prework()");
+
+  ensureStandardDirectories(false);
+
+  assembly_parameters const & as_fixparams= AS_miraparams[0].getAssemblyParams();
+
+  if (as_fixparams.as_numrmbbreakloops <1) {
+    AS_miraparams[0].setAssemblyNumRMBBreakLoops(1);
+    cout << "Number of RMB break loops <1, setting to 1\n";
+  }
+
+  if (as_fixparams.as_loadbackbone){
+    cout << "Backbone not used for pre-assembly repeat resolving, switching off load.\n";
+    AS_miraparams[0].setAssemblyLoadBackbone(false);
+  }
+
+  // find out whether we have 454 reads in the data set
+  // also find out whether there are SRMr or CRMr tags that need attention
+  AS_seqtypespresent.clear();
+  AS_seqtypespresent.resize(Read::SEQTYPE_END,false);
+  AS_454dosimpleedit=false;
+  for(uint32 i=0; i< AS_readpool.size(); i++){
+    if(AS_readpool.getRead(i).isUsedInAssembly()){
+      AS_seqtypespresent[AS_readpool.getRead(i).getSequencingType()]=true;
+      if(AS_readpool.getRead(i).getSequencingType()==Read::SEQTYPE_454GS20){
+	AS_454dosimpleedit=true;
+      }
+    }
+  }
+
+  // allocate or reserve memory that is quite static from the size,
+  //  reducing memory fragmentations at least a bit
+  {
+    AS_permanent_overlap_bans.nuke();
+    AS_permanent_overlap_bans.resize(AS_readpool.size());
+
+    AS_used_ids.reserve(AS_readpool.size());
+    AS_clipleft.reserve(AS_readpool.size());
+    AS_clipright.reserve(AS_readpool.size());
+    AS_multicopies.reserve(AS_readpool.size());
+    AS_hasmcoverlaps.reserve(AS_readpool.size());
+    AS_istroublemaker.reserve(AS_readpool.size());
+
+    // these 3 only temp filled, but block anyway to reduce fragmentation
+    AS_allrmbsok.reserve(AS_readpool.size());
+    AS_probablermbsnotok.reserve(AS_readpool.size());
+    AS_weakrmbsnotok.reserve(AS_readpool.size());
+  }
+
+
+  findPossibleOverlaps(0, "", "_preassembly");
+
+  //if(AS_454dosimpleedit) editSimple454Overcalls(0);
+ 
+  if(as_fixparams.as_clip_possible_vectors
+    || (as_fixparams.as_use_read_extension && as_fixparams.as_readextension_firstpassnum == 0)){
+    cout << "Pre-assembly alignment search for read extension and / or vector clipping:\n";
+    makeAlignments(Assembly::ma_takeall,
+		   false,
+		   false,
+		   0,
+		   "", 
+		   "_preassembly");
+    loadAlignmentsFromFile(0, "", "_preassembly");
+    if(as_fixparams.as_use_read_extension) {
+      cout << "Pre-assembly read extension:\n";
+      extendADS(0, "", "_preassembly1");
+    }
+    if(as_fixparams.as_clip_possible_vectors) {
+      cout << "Pre-assembly vector clipping\n";
+      performSeqVectorClippings();
+    }
+
+    //nukeSTLContainer(AS_adsfacts);
+    //nukeSTLContainer(AS_confirmed_edges);
+    AS_adsfacts.clear();
+    AS_confirmed_edges.clear();
+
+    postLoad();
+  }
+
+
+  bool exitearly=false;
+  for(uint32 actpass=1; !exitearly && actpass<=as_fixparams.as_numpasses; actpass++){
+    cout << "\n\nPass: " << actpass << endl;
+
+    AS_contigs.clear();
+
+    findPossibleOverlaps(actpass, "", "_pass");
+    //if(actpass!=1 && AS_454dosimpleedit) editSimple454Overcalls(actpass);
+
+    makeAlignments(Assembly::ma_takeMCandOverlapWMC, 
+		   false,
+		   false,
+		   actpass,
+		   "", 
+		   "_pass");
+
+    bool newreptfound=true;
+    // maximum of three subloops, might be useful for genome sized projects
+    for(uint32 subloop=0; subloop<3 && newreptfound; subloop++){
+      loadAlignmentsFromFile(actpass, "", "_pass");
+      
+      newreptfound=buildRepeatContigs(actpass);
+
+      cout << "Done building contigs.\n";
+
+      if(newreptfound){
+	cout << "New repeats found during contig building, adding additional alignment iteration\nfor quick repeat resolving.\n";
+	AS_steps[ASADSLISTOK]=0;
+
+	size_t oldnumbans=0;
+	size_t oldnumsets=0;
+	AS_permanent_overlap_bans.getNumBans(oldnumbans,oldnumsets);
+
+	cout << "Old number of bans: " << oldnumbans << '\n';
+	makeAlignments(Assembly::ma_needSRMrOrTwoCRMr, 
+		       true, 
+		       false,
+		       actpass, 
+		       "", 
+		       "", 
+		       "repeat_resolve");
+
+	size_t newnumbans=0;
+	size_t newnumsets=0;
+	AS_permanent_overlap_bans.getNumBans(newnumbans,newnumsets);
+
+	cout << "New number of bans: " << newnumbans << '\n';
+	if(oldnumbans==newnumbans){
+	  cout << "No new bans appeared, next pass.\n";
+	  newreptfound=false;
+	}
+      }
+    }
+
+    if(!newreptfound){
+      if(actpass>=3 && actpass <as_fixparams.as_numpasses) exitearly=true;
+
+      //// if we have 454 data that can be edited, we want at least 
+      ////  3 passes (for the simple 454 editing)
+      //if(AS_454dosimpleedit){
+      //	if(actpass>=3 && actpass <as_fixparams.as_numpasses) exitearly=true;
+      //}else{
+      //	if(actpass<as_fixparams.as_numpasses) exitearly=true;
+      //}
+    }
+
+    //saveStatistics(actpass, "", "_pass");
+    //saveDebrisList(actpass, "", "_pass");
+    //saveReadTagList(actpass);
+    //saveContigReadList(actpass, "", "_pass");
+    if(as_fixparams.as_output_tmp_caf) saveAsCAF(actpass, "", "_pass");
+  }
+
+  if(exitearly){
+    cout << "No new repeats found in previous pass, stopping early.\n";
+  }
+
+  FUNCEND();
+  return;
+}
+
+
+/*************************************************************************
+ *
+ * either a multicopy, troublemaker or has SRMr or CRMr
+ *
+ *************************************************************************/
+
+bool Assembly::ma_takeMCandOverlapWMC(Assembly & as, int32 rid1, int32 rid2)
+{
+  if(as.AS_multicopies[rid1]
+     || as.AS_istroublemaker[rid1]
+     || as.AS_multicopies[rid2]
+     || as.AS_istroublemaker[rid2]) return true;
+  if(Assembly::ma_needSRMrOrTwoCRMr(as, rid1, rid2)) return true;
+  return false;
+}
+
+
+
+/*************************************************************************
+ *
+ * returns whether new strong repeat markers (SRMs) were found for
+ *  any contig built in any stage
+ *
+ *************************************************************************/
+
+bool Assembly::buildRepeatContigs(const int32 passnr)
+{
+  FUNCSTART("void Assembly::buildRepeatContigs()");
+
+  assembly_parameters const & as_fixparams= AS_miraparams[0].getAssemblyParams();
+  contig_parameters const & con_params= AS_miraparams[0].getContigParams();
+  directory_parameters const & dir_params= AS_miraparams[0].getDirectoryParams();
+
+  AS_contigs.clear();
+  Contig::setIDCounter(1);
+
+  vector<Align> aligncache;
+  setupAlignCache(aligncache);
+
+
+  // when using short reads (Solexa, SOLiD), the contig might propose
+  //  new right clips to squeeze the data in. This vector holds
+  //  the info.
+  // -1 says: no proposed new right clip
+  AS_clipright.clear();
+  AS_clipright.resize(AS_readpool.size(),-1);
+
+  // filter out all reads that have no overlap at this stage
+  // for this, first set all reads to "used" and "singlet", then
+  //   re-allow those that have at least one SW ovelap of a read
+  //   which is MULTICOPY!
+
+  AS_used_ids.clear();
+  AS_used_ids.resize(AS_readpool.size(),1);
+  AS_isdebris.clear();
+  AS_isdebris.resize(AS_readpool.size(),1);
+
+  if(!AS_confirmed_edges.empty()){
+    // search for singlets
+    vector<newedges_t>::const_iterator ceI=AS_confirmed_edges.begin();
+    for(;ceI!=AS_confirmed_edges.end();){
+      int32 actrid=ceI->rid1;
+      uint32 numoverlaps=0;
+      //cout << actrid << endl;
+
+      bool hasmcoverlap= AS_multicopies[actrid]>0;
+      for(;ceI!=AS_confirmed_edges.end() && ceI->rid1 == actrid;ceI++){
+	numoverlaps++;
+	hasmcoverlap|=AS_multicopies[ceI->linked_with]>0;
+      }
+      if(numoverlaps && hasmcoverlap){
+	AS_isdebris[actrid]=0;
+	AS_used_ids[actrid]=0;
+      }
+    }
+  }
+
+  // Now, go through all the singlets and take them back into
+  //  assembly if they have special MIRA tags attached
+  // Also remove backbones & rails from the debris list
+  {
+    for(uint32 i=0; i< AS_readpool.size(); i++){
+      if(AS_readpool.getRead(i).hasTag(Read::REA_tagentry_idSRMr)
+	 || AS_readpool.getRead(i).hasTag(Read::REA_tagentry_idCRMr)
+	 || AS_readpool.getRead(i).hasTag(Read::REA_tagentry_idWRMr)
+	 || AS_readpool.getRead(i).hasTag(Read::REA_tagentry_idSAOr)
+	 || AS_readpool.getRead(i).hasTag(Read::REA_tagentry_idSROr)
+	 || AS_readpool.getRead(i).hasTag(Read::REA_tagentry_idSIOr)) {
+	AS_isdebris[i]=0;
+	AS_used_ids[i]=0;
+      }
+      if(AS_readpool.getRead(i).isBackbone()
+	 || AS_readpool.getRead(i).isRail()) {
+	AS_isdebris[i]=0;
+      }
+    }
+  }
+
+  // get out reads that are
+  //  - invalid or not used in assembly
+  //  - or backbone or rail
+  {
+    for(uint32 i=0; i< AS_readpool.size(); i++){
+      if(AS_readpool.getRead(i).hasValidData()== false
+	|| AS_readpool.getRead(i).isUsedInAssembly()==false){
+	AS_used_ids[i]=-1;
+      } else if(AS_readpool.getRead(i).isBackbone()
+		|| AS_readpool.getRead(i).isRail()) {
+	AS_used_ids[i]=1;
+      } 
+    }
+  }
+
+  uint32 unused;
+  uint32 numcontigs=0;
+  ofstream fout;
+  if(as_fixparams.as_tmpf_unused_ids.size()!=0){
+    fout.open((dir_params.dir_tmp+"/"+as_fixparams.as_tmpf_unused_ids).c_str(), ios::out);
+    fout.close();
+  }
+
+  // outside precomputed lowerbound of oedges, for PathFinder
+  // is used lateron in constructStepByStep()
+  vector<vector<newedges_t>::iterator> tmp_lowerbound_oedges;
+
+  // PathFinder object can be created ouside loop and re-used
+  //  (constructor needs to do a lot of lower_bound() searches.
+  // Saves a lot of time in the endgame (singlets) of big projects
+  Pathfinder paf(&AS_miraparams,
+		 AS_readpool,
+		 AS_confirmed_edges,
+		 AS_adsfacts);
+  vector<int32> pf_ids_in_contig;
+
+  bool foundSRMs=false;
+
+  do{
+    if(AS_miraparams[0].getAssemblyParams().as_dateoutput) dateStamp(cout);
+    cout << "\n";
+
+    numcontigs++;
+    if(as_fixparams.as_tmpf_unused_ids.size()!=0){
+      fout.open((dir_params.dir_tmp+"/"+as_fixparams.as_tmpf_unused_ids).c_str(), ios::out|ios::app);
+      fout << "\nUnused for contig" << numcontigs << endl;
+    }
+    unused=0;
+    for(uint32 i=0; i<AS_used_ids.size(); i++){
+      if(AS_used_ids[i]==0){
+	unused++;
+	if(as_fixparams.as_tmpf_unused_ids.size()!=0){
+	  fout << AS_readpool.getRead(i).getName();
+	  fout << "\t" << AS_readpool.getRead(i).getSCFName() << endl;;
+	}
+      }
+    }
+    if(as_fixparams.as_tmpf_unused_ids.c_str()!=0){
+      fout.close();
+    }
+
+    if(unused>0){
+      Contig::setIDCounter(numcontigs);
+      Contig con(&AS_miraparams, AS_readpool);
+
+      // set newreptmarked to true just to get into the for pass
+      //  value is changed within pass
+      bool newreptmarked=true;
+
+      // in contrast to buildFirstContigs(), build a contig once
+
+      con.setContigNamePrefix(con_params.con_nameprefix);
+
+      cout << "Building new contig " << numcontigs << endl;
+
+      if(AS_miraparams[0].getAssemblyParams().as_dateoutput) dateStamp(cout);
+
+      cout << "Unused reads: " << unused << endl;
+      cout.flush();
+	
+      paf.constructStepByStep(aligncache,
+			      &AS_used_ids,
+			      &pf_ids_in_contig,
+			      &AS_multicopies,
+			      &AS_hasmcoverlaps,
+			      &AS_istroublemaker,
+			      &tmp_lowerbound_oedges,
+			      &AS_clipright,
+			      con);
+
+      cout << "\n\nFinished building the contig." << endl;
+
+      try {
+	if(AS_miraparams[0].getAssemblyParams().as_dateoutput) dateStamp(cout);
+	if(con.getContigLength()>100000){
+	  cout << "Calculating statistics (this may take a while)." << endl;
+	}
+	con.stats(cout);
+	if(AS_miraparams[0].getAssemblyParams().as_dateoutput) dateStamp(cout);
+      }
+      catch (...) {
+	cerr << "Darn, error with that contig. See darn.fasta.\n";
+	vector<Contig::contigread_t>::const_iterator I=con.getContigReads().begin(); 
+	while(I != con.getContigReads().end()) {
+	  Read::setCoutType(Read::AS_CLIPPEDFASTA);
+	  cout << I->read;
+	  I++;
+	}
+	exit(0);
+      }
+
+      string basename_forextsave;
+      {
+	ostringstream ostr;
+	ostr << dir_params.dir_tmp << "/miralog.pass_" << passnr << "_cb" << numcontigs << "_";
+	
+	basename_forextsave=ostr.str();
+      }
+      // saving pre-edit
+      saveExtTmpContig(con,(basename_forextsave+"pre"));
+
+      newreptmarked=false;
+      
+      {
+	cout << "Marking possibly misassembled repeats ...";
+	cout.flush();
+	Contig::repeatmarker_stats_t repstats;
+	vector<bool> readsmarkedsrm;
+	con.newMarkPossibleRepeats(repstats, readsmarkedsrm);
+	if(repstats.numSRMs>0 || repstats.numWRMs>0 || repstats.numSNPs>0){
+	  if(repstats.numSRMs>0) {
+	    newreptmarked=true;
+	    foundSRMs=true;
+	  }
+	  cout << "done. Found\n";
+	  cout << " - " << repstats.numSRMs << " new Strong RMB (SRMc)\n";
+	  cout << " - " << repstats.numWRMs << " new Weak RMB (WRMc)\n";
+	  cout << " - " << repstats.numSNPs << " SNP\npositions tagged.";
+	}else{
+	  cout << "done. Found none." << endl;
+	}
+      }
+      
+      // saving again if rept-marked or edited
+      if(newreptmarked){
+	saveExtTmpContig(con,(basename_forextsave+"post"));
+      } else {
+	if ( as_fixparams.as_output_exttmp_fasta
+	     || as_fixparams.as_output_exttmp_ace
+	     || as_fixparams.as_output_exttmp_gap4da
+	     || as_fixparams.as_output_exttmp_caf) {
+	  cout << "No edit and no new repeat found, not saving extra temporary contig again.\n";
+	}
+      }
+      
+      // Transfer all the reads fron the new contig into readpool
+      //  (we can do that because no editing is done while assembling
+      //  repeats)
+
+      cout << "Transfering reads to readpool.\n";
+      
+      const vector<Contig::contigread_t> & cr = con.getContigReads();
+      vector<Contig::contigread_t>::const_iterator crI = cr.begin();
+      
+      for(;crI!=cr.end(); crI++){
+	if(crI->orpid>=0){
+	  AS_readpool.getRead(crI->orpid)=crI->read;
+	  AS_readpool.getRead(crI->orpid).removeGapsFromRead();
+	}
+      }
+      
+      // don't store 454 singlets in contigs
+      // except if they have special MIRA tags
+      bool storecontig=true;
+      if(con.getNumReadsInContig()==1){
+	const vector<Contig::contigread_t> conreads=con.getContigReads();
+	if(conreads[0].read.getSequencingType()==Read::SEQTYPE_454GS20
+	   && !conreads[0].read.hasTag(Read::REA_tagentry_idSRMr)
+	   && !conreads[0].read.hasTag(Read::REA_tagentry_idCRMr)
+	   && !conreads[0].read.hasTag(Read::REA_tagentry_idWRMr)
+	   && !conreads[0].read.hasTag(Read::REA_tagentry_idSAOr)
+	   && !conreads[0].read.hasTag(Read::REA_tagentry_idSROr)
+	   && !conreads[0].read.hasTag(Read::REA_tagentry_idSIOr)) {
+	  if(conreads[0].orpid>=0) AS_isdebris[conreads[0].orpid]=1;
+	  storecontig=false;
+	}
+      }
+      if(storecontig){
+	AS_contigs.push_back(con);
+	AS_contigs.back().saveMem();
+      }else{
+	numcontigs--;
+      }
+    }
+    //unused=0;
+
+  }while(unused>0);
+  
+  AS_steps[ASCONTIGSOK]=1;
+
+  AS_used_ids.clear();
+
+  //  saveAsCAF();
+
+  FUNCEND();
+
+  return foundSRMs;
+}
+
+
+
+
+
+
+
+#endif
diff --git a/src/mira/assembly_swalign.C b/src/mira/assembly_swalign.C
index e1f34c4..076fbe3 100644
--- a/src/mira/assembly_swalign.C
+++ b/src/mira/assembly_swalign.C
@@ -11,33 +11,46 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
+// 	$Id$	
+
+
+#ifndef lint
+static char vcid[] = "$Id$";
+#endif /* lint */
+
 
-#include "mira/assembly.H"
+#include "assembly.H"
+
+// for time measurements
+#include <sys/times.h>
+#include <sys/time.h>
+#include <limits.h>
+#include <unistd.h>
 
 // BOOST
-#include <boost/algorithm/string.hpp>
+#include <boost/algorithm/string.hpp> 
 
 #include "errorhandling/errorhandling.H"
+#include "mira/dynamic.H"
+#include "mira/ads.H"
 #include "util/progressindic.H"
 #include "util/dptools.H"
-#include "util/fileanddisk.H"
 #include "caf/caf.H"
-
-#include "mira/align.H"
-#include "mira/ads.H"
+#include "mira/structs.H"
+#include "mira/contig.H"
 
 
 #if 0
@@ -45,11 +58,6 @@
 #define VALGRIND_LEAKCHECK
 #endif
 
-
-using namespace std;
-
-#define CEBUG(bla)
-
 // cs1 for normal clocking ('user compatible' as is does not disturb)
 //  cs2 for extensive clocking output, more for analysis of MIRA behaviour
 //  during development
@@ -60,9 +68,12 @@ using namespace std;
 #define CLOCK_STEPS2
 
 
+#if DEVELOPMENTVERSION != 0 
 //#define TRACKMEMUSAGE 1
 #define TRACKMEMUSAGE 0
-
+#else
+#define TRACKMEMUSAGE 0
+#endif
 
 
 
@@ -75,7 +86,7 @@ using namespace std;
 
 void Assembly::setupAlignCache(vector<Align> & aligncache)
 {
-  for(uint32 i=0; i<ReadGroupLib::SEQTYPE_END; i++) {
+  for(uint32 i=0; i<Read::SEQTYPE_END; i++) {
     Align a(&AS_miraparams[i]);
     aligncache.push_back(a);
   }
@@ -103,11 +114,10 @@ void Assembly::makeAlignmentsFromPosMatchFile(const string & filename, const int
 {
   FUNCSTART("void Assembly::makeAlignmentsFromPosMatchFile(const string & filename)");
 
-  BUGIFTHROW(filename.empty(),"filename.empty() ???");
   CEBUG("makeAlignmentsFromPosMatchFile: " << filename << "\ttrans100percent=" << trans100percent << endl);
 
-#if CPP_READ_SEQTYPE_END != 8
-#error "This code is made for 8 sequencing types, adapt! Also adapt if other aligns are used."
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt! Also adapt if other aligns are used."
 #endif
 
   vector<Align> chkalign;
@@ -129,14 +139,14 @@ void Assembly::makeAlignmentsFromPosMatchFile(const string & filename, const int
   if(!posffin){
     MIRANOTIFY(Notify::FATAL, "File not found. This should have been written earlier by MIRA: " << filename);
   }
-
+  
 
   ProgressIndicator<streamsize> P (0, posffin.tellg(),2000);
 
   posffin.seekg(0, ios::beg);
 
 #ifdef ALIGNCHECK
-  Align checkbla(&AS_miraparams[ReadGroupLib::SEQTYPE_SANGER]);
+  Align checkbla(&AS_miraparams[Read::SEQTYPE_SANGER]);
   // true for using memcache
   //Align checkbla(AS_miraparams, true);
 #endif
@@ -170,7 +180,7 @@ void Assembly::makeAlignmentsFromPosMatchFile(const string & filename, const int
       continue;
     }
 
-    if(AS_readpool.getRead(posmatch.rid1).isRail()
+    if(AS_readpool.getRead(posmatch.rid1).isRail() 
        && AS_readpool.getRead(posmatch.rid2).isRail()) {
       CEBUG("Both are rails: " << posmatch.rid1 << " " << posmatch.rid2<<"\tskipping\n");
       continue;
@@ -213,7 +223,7 @@ void Assembly::makeAlignmentsFromPosMatchFile(const string & filename, const int
     if(canuse100perctrans){
       CEBUG("100% trans rule.\n");
       if(matchfout.is_open()){
-	matchfout << AS_readpool.getRead(posmatch.rid1).getName() << "\t" <<AS_readpool.getRead(posmatch.rid2).getName() << DEBUGEND_L;
+	matchfout << AS_readpool.getRead(posmatch.rid1).getName() << "\t" <<AS_readpool.getRead(posmatch.rid2).getName() << DEBUGEND_L; 
       }
 
       //AS_CUMADSLofstream << madsl.begin()->getWeight() << '\t'
@@ -223,9 +233,6 @@ void Assembly::makeAlignmentsFromPosMatchFile(const string & filename, const int
 
       bool swapped=false;
       if(posmatch.eoffset<0){
-	// swap if this
-	//   1             --------
-	//   2      -----------
 	swap(posmatch.rid1, posmatch.rid2);
 	posmatch.eoffset=-posmatch.eoffset;
 	swapped=true;
@@ -233,9 +240,8 @@ void Assembly::makeAlignmentsFromPosMatchFile(const string & filename, const int
 
       int32 overlaplen;
       int32 totallen;
-
+      
       int32 rdls=AS_readpool.getRead(posmatch.rid1).getLenClippedSeq()-posmatch.eoffset-AS_readpool.getRead(posmatch.rid2).getLenClippedSeq();
-      // only two cases left due to swapping of ids above
       if(rdls>=0) {
 	//   1      -----------------
 	//   2           ----------
@@ -249,11 +255,9 @@ void Assembly::makeAlignmentsFromPosMatchFile(const string & filename, const int
       }
 
       // overlap must be >= smallest allowed minimal overlap
-      // ... or simply >= 17
-      // BaCh: 06.02.2015; nope, not "or >= 17" as this does not reflect the wish of the user!
-      if(overlaplen >= AS_miraparams[AS_readpool[posmatch.rid1].getSequencingType()].getAlignParams().al_min_overlap
-	 || overlaplen >= AS_miraparams[AS_readpool[posmatch.rid2].getSequencingType()].getAlignParams().al_min_overlap){
-
+      if(!(overlaplen < AS_miraparams[AS_readpool.getRead(posmatch.rid1).getSequencingType()].getAlignParams().al_min_overlap
+	   && overlaplen < AS_miraparams[AS_readpool.getRead(posmatch.rid2).getSequencingType()].getAlignParams().al_min_overlap)){
+	
 	AS_CUMADSLofstream << overlaplen*10000 << '\t'
 			   << static_cast<int16>(direction) << '\t'
 			   << posmatch.ol_stronggood << '\t'
@@ -262,9 +266,8 @@ void Assembly::makeAlignmentsFromPosMatchFile(const string & filename, const int
 			   << posmatch.ol_norept << '\t'
 			   << posmatch.ol_rept << '\t';
 
-	AS_CUMADSLofstream << posmatch.rid1
-			   << '\t' << posmatch.rid2;
-
+	AS_CUMADSLofstream << posmatch.rid1;
+	AS_CUMADSLofstream << '\t' << posmatch.rid2;
 	if(swapped){
 	  AS_CUMADSLofstream << '\t' << static_cast<int16>(direction);
 	  AS_CUMADSLofstream << "\t1";
@@ -273,7 +276,7 @@ void Assembly::makeAlignmentsFromPosMatchFile(const string & filename, const int
 	  AS_CUMADSLofstream << '\t' << static_cast<int16>(direction);
 	}
 	AS_CUMADSLofstream << '\t' << posmatch.eoffset;
-
+	
 	if(rdls>=0) {
 	  //   1      -----------------
 	  //   2           ----------
@@ -285,32 +288,11 @@ void Assembly::makeAlignmentsFromPosMatchFile(const string & filename, const int
 	  AS_CUMADSLofstream << '\t' << -rdls;
 	  AS_CUMADSLofstream << '\t' << 0;
 	}
-	AS_CUMADSLofstream << '\t' << overlaplen
-			   << '\t' << totallen
-			   << '\t' << static_cast<uint16>(posmatch.percent_in_overlap);
-
-	if(rdls>=0) {
-	  //   1      -----------------
-	  //   2           ----------
-	  AS_CUMADSLofstream << "\t0\t0\t0\t7\t7";
-	}else{
-	  //   1      -----------------
-	  //   2           --------------
-	  if(direction>0){
-	    AS_CUMADSLofstream << "\t0\t0\t7\t7\t0";
-	  }else if(swapped){
-	    AS_CUMADSLofstream << "\t0\t7\t0\t7\t0";
-	  }else{
-	    AS_CUMADSLofstream << "\t0\t0\t7\t0\t7";
-	  }
-	}
-
-	AS_CUMADSLofstream << '\n';
-
-	if(AS_CUMADSLofstream.bad()){
-	  MIRANOTIFY(Notify::FATAL, "Could not write anymore to disk (at 100%trans). Disk full? Changed permissions?");
-	}
-
+	AS_CUMADSLofstream << '\t' << overlaplen;
+	AS_CUMADSLofstream << '\t' << totallen;
+	
+	AS_CUMADSLofstream << '\t' << static_cast<uint16>(posmatch.percent_in_overlap) << '\n';
+	
 	AS_numADSFacts_fromalignments++;
 	trans100saved++;
       }else{
@@ -319,7 +301,7 @@ void Assembly::makeAlignmentsFromPosMatchFile(const string & filename, const int
       }
     }else{
 
-      computeSWAlign(madsl, posmatch.rid1, posmatch.rid2, posmatch. eoffset, direction, chkalign, -1);
+      computeSWAlign(madsl, posmatch.rid1, posmatch.rid2, posmatch. eoffset, direction, chkalign);
 
       totalseqsaligned++;
 
@@ -339,7 +321,7 @@ void Assembly::makeAlignmentsFromPosMatchFile(const string & filename, const int
 	    cout <<*Itmp; Itmp++;
 	  }
 	}
-
+	    
 	cout << " ----------------------------------------------------- \n";
 
       }else{
@@ -367,35 +349,35 @@ void Assembly::makeAlignmentsFromPosMatchFile(const string & filename, const int
 	    1,
 	    -1);
 	}
-	checkbla.fullAlign(&tadsl,false,true);
-
+	checkbla.fullAlign(&tadsl,enforce_clean_ends);
+	  
 	if(tadsl.size()!=0){
 	  cout << "Dammit, Offset-BSW lost a solution!\n";
 	  cout << "predicted offset: " << posmatch.eoffset << endl;
 	  cout <<" ----------------------------------------------------- \n";
 	  cout <<"# solutions found: "<< tadsl.size() << endl;
-
-
+	    
+	    
 	  {
 	    list<AlignedDualSeq>::const_iterator Itmp=tadsl.begin();
 	    while(Itmp!=tadsl.end()){
 	      cout <<*Itmp; Itmp++;
 	    }
 	  }
-
+	    
 	  cout << " ----------------------------------------------------- \n";
-	}
+	} 
       }
 #endif
       if(as_fixparams.as_tmpf_ads.size()!=0){
 	if(madsl.size()!=0){
 	  //matchfout << posmatch.rid1 << " " << posmatch.rid2 << "\t" << I->second.eoffset << endl;
 	  if(matchfout.is_open()){
-	    matchfout << AS_readpool.getRead(posmatch.rid1).getName() << "\t" <<AS_readpool.getRead(posmatch.rid2).getName() << DEBUGEND_L;
+	    matchfout << AS_readpool.getRead(posmatch.rid1).getName() << "\t" <<AS_readpool.getRead(posmatch.rid2).getName() << DEBUGEND_L; 
 	  }
 	}else{
 	  if(rejectfout.is_open()){
-	    rejectfout << AS_readpool.getRead(posmatch.rid1).getName() << "\t" << static_cast<int16>(direction) << "\t" <<AS_readpool.getRead(posmatch.rid2).getName() << DEBUGEND_L;
+	    rejectfout << AS_readpool.getRead(posmatch.rid1).getName() << "\t" << static_cast<int16>(direction) << "\t" <<AS_readpool.getRead(posmatch.rid2).getName() << DEBUGEND_L; 
 	  }
 	}
       }
@@ -414,7 +396,7 @@ void Assembly::makeAlignmentsFromPosMatchFile(const string & filename, const int
       //	    cout <<*Itmp; Itmp++;
       //	  }
       //	}
-      //
+      //	    
       //	cout << " ----------------------------------------------------- \n";
       //}
 
@@ -443,63 +425,46 @@ void Assembly::makeAlignmentsFromPosMatchFile(const string & filename, const int
 
   cout << "\n\n";
 }
-//#define CEBUG(bla)
+//#define CEBUG(bla) 
 //#define CEBUGF(bla)
 
 
-/*************************************************************************
- *
- * TODO: handling of hintbandwidth is a cludge atm and will not work for
- *  parallel Smith-Watermans (for that Align, Dynamic and AlignedDualSeq
- *  will need to use not pointer to MIRAParameters, but pointers to their
- *  own params which can be changed on the fly)
- *
- * But we're not there yet.
- *
- *************************************************************************/
-
-void Assembly::computeSWAlign(list<AlignedDualSeq> & madsl, uint32 rid1, uint32 rid2, int32 eoffset, int8 direction, vector<Align> & chkalign, int32 hintbandwidth)
+void Assembly::computeSWAlign(list<AlignedDualSeq> & madsl, uint32 rid1, uint32 rid2, int32 eoffset, int8 direction, vector<Align> & chkalign)
 {
   FUNCSTART("void Assembly::computeSWAlign(list<AlignedDualSeq> & madsl, uint32 rid1, uint32 rid2, int32 eoffset, int8 direction, vector<Align> & chkalign)");
 
-  BUGIFTHROW(AS_needalloverlaps.size()!=AS_readpool.size(),"AS_needalloverlaps.size()!=AS_readpool.size() ???");
-
-  CEBUG("Acquiring: " << rid1 << " "
-	<< rid2<< "\teofset: " << eoffset
+  CEBUG("Acquiring: " << rid1 << " " 
+	<< rid2<< "\teofset: " << eoffset 
 	<< "\tdirection: " << static_cast<int16>(direction) << '\n');
-
-
-#if CPP_READ_SEQTYPE_END != 8
-#error "This code is made for 8 sequencing types, adapt! Also adapt if other aligns are used."
+  
+  
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt! Also adapt if other aligns are used."
 #endif
   // use the sanger align as default
-  uint8 usealign=ReadGroupLib::SEQTYPE_SANGER;
+  uint8 usealign=Read::SEQTYPE_SANGER;
 
-  // if any of the reads is PacBioLQ, use the PacBioLQ align
+  // if any of the reads is SOLiD, use the SOLiD align
   // else if any of the reads is SOLEXA, use the SOLEXA align
-  // else if any of the reads is PacBioHQ, use the PacBioHQ align
+  // else if any of the reads is PacBio, use the PacBio align
   // else if any of the reads is 454, use the 454 align
-  // else if any of the reads is Text, use the Text align
-  if(AS_readpool.getRead(rid1).isSequencingType(ReadGroupLib::SEQTYPE_PACBIOLQ)
-     || AS_readpool.getRead(rid2).isSequencingType(ReadGroupLib::SEQTYPE_PACBIOLQ)){
-    usealign=ReadGroupLib::SEQTYPE_PACBIOLQ;
-  } else if(AS_readpool.getRead(rid1).isSequencingType(ReadGroupLib::SEQTYPE_SOLEXA)
-	    || AS_readpool.getRead(rid2).isSequencingType(ReadGroupLib::SEQTYPE_SOLEXA)){
-    usealign=ReadGroupLib::SEQTYPE_SOLEXA;
-  }else if(AS_readpool.getRead(rid1).isSequencingType(ReadGroupLib::SEQTYPE_PACBIOHQ)
-	   || AS_readpool.getRead(rid2).isSequencingType(ReadGroupLib::SEQTYPE_PACBIOHQ)){
-    usealign=ReadGroupLib::SEQTYPE_PACBIOHQ;
-  }else if(AS_readpool.getRead(rid1).isSequencingType(ReadGroupLib::SEQTYPE_IONTORRENT)
-	   || AS_readpool.getRead(rid2).isSequencingType(ReadGroupLib::SEQTYPE_IONTORRENT)){
-    usealign=ReadGroupLib::SEQTYPE_IONTORRENT;
-  }else if(AS_readpool.getRead(rid1).isSequencingType(ReadGroupLib::SEQTYPE_454GS20)
-	   || AS_readpool.getRead(rid2).isSequencingType(ReadGroupLib::SEQTYPE_454GS20)){
-    usealign=ReadGroupLib::SEQTYPE_454GS20;
-  }else if(AS_readpool.getRead(rid1).isSequencingType(ReadGroupLib::SEQTYPE_TEXT)
-	   || AS_readpool.getRead(rid2).isSequencingType(ReadGroupLib::SEQTYPE_TEXT)){
-    usealign=ReadGroupLib::SEQTYPE_TEXT;
+  if(AS_readpool.getRead(rid1).isSequencingType(Read::SEQTYPE_ABISOLID)
+     || AS_readpool.getRead(rid2).isSequencingType(Read::SEQTYPE_ABISOLID)){
+    usealign=Read::SEQTYPE_ABISOLID;
+      } else if(AS_readpool.getRead(rid1).isSequencingType(Read::SEQTYPE_SOLEXA)
+		|| AS_readpool.getRead(rid2).isSequencingType(Read::SEQTYPE_SOLEXA)){
+    usealign=Read::SEQTYPE_SOLEXA;
+  }else if(AS_readpool.getRead(rid1).isSequencingType(Read::SEQTYPE_PACBIO)
+	   || AS_readpool.getRead(rid2).isSequencingType(Read::SEQTYPE_PACBIO)){
+    usealign=Read::SEQTYPE_PACBIO;
+  }else if(AS_readpool.getRead(rid1).isSequencingType(Read::SEQTYPE_IONTORRENT)
+	   || AS_readpool.getRead(rid2).isSequencingType(Read::SEQTYPE_IONTORRENT)){
+    usealign=Read::SEQTYPE_IONTORRENT;
+      }else if(AS_readpool.getRead(rid1).isSequencingType(Read::SEQTYPE_454GS20)
+	       || AS_readpool.getRead(rid2).isSequencingType(Read::SEQTYPE_454GS20)){
+    usealign=Read::SEQTYPE_454GS20;
   }
-
+  
   bool enforce_clean_ends=AS_miraparams[usealign].getAlignParams().ads_enforce_clean_ends;
   // if any read is a rail or backbone, do not use the clean ends
   //  requirement. This is to align reads that contain true SNP in
@@ -510,23 +475,13 @@ void Assembly::computeSWAlign(list<AlignedDualSeq> & madsl, uint32 rid1, uint32
      || AS_readpool.getRead(rid2).isRail()){
     enforce_clean_ends=false;
   }
-
+  
   bool dontpenalisengaps=false;
-  if(AS_readpool[rid1].isSequencingType(ReadGroupLib::SEQTYPE_PACBIOLQ)
-     || AS_readpool[rid1].isSequencingType(ReadGroupLib::SEQTYPE_PACBIOHQ)
-     || AS_readpool[rid2].isSequencingType(ReadGroupLib::SEQTYPE_PACBIOLQ)
-     || AS_readpool[rid2].isSequencingType(ReadGroupLib::SEQTYPE_PACBIOHQ)){
-    // TODO: PacBio check whether to really apply (was thought for strobed reads)
+  if(AS_readpool[rid1].isSequencingType(Read::SEQTYPE_PACBIO)
+     || AS_readpool[rid1].isSequencingType(Read::SEQTYPE_PACBIO)){
     dontpenalisengaps=true;
   }
-
-  auto & aparams=AS_miraparams[usealign].getNonConstAlignParams();
-  int32 savealkmin=aparams.al_kmin;
-  int32 savealkmax=aparams.al_kmax;
-  if(hintbandwidth>0){
-    aparams.al_kmin=hintbandwidth;
-    aparams.al_kmax=hintbandwidth;
-  }
+  
 
   try{
     if(direction>0){
@@ -535,11 +490,11 @@ void Assembly::computeSWAlign(list<AlignedDualSeq> & madsl, uint32 rid1, uint32
 	AS_readpool.getRead(rid1).getLenClippedSeq(),
 	static_cast<const char *> (AS_readpool.getRead(rid2).getClippedSeqAsChar()),
 	AS_readpool.getRead(rid2).getLenClippedSeq(),
-	rid1,
+	rid1, 
 	rid2,
 	1,
 	1,
-	true,
+	true, 
 	eoffset);
     }else{
       chkalign[usealign].acquireSequences(
@@ -550,14 +505,14 @@ void Assembly::computeSWAlign(list<AlignedDualSeq> & madsl, uint32 rid1, uint32
 	rid1,
 	rid2,
 	1,
-	-1,
-	true,
+	-1, 
+	true, 
 	eoffset);
     }
   }
   catch(Notify n) {
     Read::setCoutType(Read::AS_TEXT);
-    cout << "Ouch, having a problem here. Tried to acquire the following reads:\n"
+    cout << "Ouch, having a problem here. Tried to acquire the following reads:\n" 
 	 << AS_readpool.getRead(rid1)
 	 << endl
 	 << AS_readpool.getRead(rid2)
@@ -569,10 +524,10 @@ void Assembly::computeSWAlign(list<AlignedDualSeq> & madsl, uint32 rid1, uint32
     n.handleError(THISFUNC);
   }
   madsl.clear();
-
+  
   CEBUG("usealign: " << static_cast<uint16>(usealign) << endl);
   //chkalign[usealign].coutWhatWasGiven();
-  if(AS_needalloverlaps[rid1] || AS_needalloverlaps[rid2]){
+  if(AS_needalloverlaps[rid1] || AS_needalloverlaps[rid2]){	
     CEBUG("go down with requirements\n");
     chkalign[usealign].useSpecialMinRelScore(50);
     chkalign[usealign].fullAlign(&madsl,false,dontpenalisengaps);
@@ -582,11 +537,6 @@ void Assembly::computeSWAlign(list<AlignedDualSeq> & madsl, uint32 rid1, uint32
     chkalign[usealign].fullAlign(&madsl,enforce_clean_ends,dontpenalisengaps);
   }
 
-  if(hintbandwidth>0){
-    aparams.al_kmin=savealkmin;
-    aparams.al_kmax=savealkmax;
-  }
-
   FUNCEND();
 }
 
@@ -598,10 +548,10 @@ void Assembly::computeSWAlign(list<AlignedDualSeq> & madsl, uint32 rid1, uint32
  *  candidates and check them with the Smith-Waterman.
  * Save the results into these variables:
  *   AS_global_adslist     a list of all dual aligned sequences which
- *                         have been retained by the Align
+ *                         have been retained by the Align 
  *   AS_edges_forward      for forward reads.
  *                         a multimap. key is the number of the read
- *                         in the sequencepool, value is a struct
+ *                         in the sequencepool, value is a struct 
  *                         showing the destination read and 1 or more
  *                         ADS objects. Best score ratio and pointer to
  *                         ADS element in global_adslist is also stored.
@@ -612,6 +562,18 @@ void Assembly::computeSWAlign(list<AlignedDualSeq> & madsl, uint32 rid1, uint32
 //#define CEBUGF(bla)  {cout << bla; cout.flush();}
 
 
+// sort rid1 from low to high
+// on equality, sort on bestweight from high to low
+bool Assembly__sortconfirmed_edges_t_(const newedges_t & a, 
+				      const newedges_t & b);
+bool Assembly__sortconfirmed_edges_t_(const newedges_t & a, const newedges_t & b)
+{
+  if(a.rid1 == b.rid1){
+    return a.best_weight > b.best_weight;
+  }
+  return a.rid1 < b.rid1;
+}
+
 
 /*************************************************************************
  *
@@ -650,7 +612,7 @@ bool Assembly::ma_needRRFlagAndBothCRMr(Assembly & as, int32 rid1, int32 rid2)
   return false;
 }
 
-// is this one used anymore since the introduction of
+// is this one used anymore since the introduction of 
 //  AS_readsforrepeatresolve???
 bool Assembly::ma_needSRMrOrTwoCRMr(Assembly & as, int32 rid1, int32 rid2)
 {
@@ -675,7 +637,7 @@ void Assembly::makeAlignments(bool (* checkfunction)(Assembly & as,int32,int32),
   if(tmpfname.size()){
     adsfacts_fn=buildFileName(version, prefix, postfix, tmpfname, ".adsfacts");
   }else{
-    adsfacts_fn=buildFileName(version, prefix, postfix,
+    adsfacts_fn=buildFileName(version, prefix, postfix, 
 			      as_fixparams.as_tmpf_ads,
 			      ".adsfacts");
   }
@@ -683,7 +645,7 @@ void Assembly::makeAlignments(bool (* checkfunction)(Assembly & as,int32,int32),
   if(tmpfname.size()){
     adsf_fn=buildFileName(version, prefix, postfix, tmpfname, ".forward");
   }else{
-    adsf_fn=buildFileName(version, prefix, postfix,
+    adsf_fn=buildFileName(version, prefix, postfix, 
 			  "elog.ads",
 			  ".forward");
   }
@@ -691,7 +653,7 @@ void Assembly::makeAlignments(bool (* checkfunction)(Assembly & as,int32,int32),
   if(tmpfname.size()){
     adsc_fn=buildFileName(version, prefix, postfix, tmpfname, ".complement");
   }else{
-    adsc_fn=buildFileName(version, prefix, postfix,
+    adsc_fn=buildFileName(version, prefix, postfix, 
 			  "elog.ads",
 			  ".complement");
   }
@@ -699,7 +661,7 @@ void Assembly::makeAlignments(bool (* checkfunction)(Assembly & as,int32,int32),
   if(tmpfname.size()){
     adsr_fn=buildFileName(version, prefix, postfix, tmpfname, ".reject");
   }else{
-    adsr_fn=buildFileName(version, prefix, postfix,
+    adsr_fn=buildFileName(version, prefix, postfix, 
 			  "elog.ads",
 			  ".reject");
   }
@@ -718,9 +680,9 @@ void Assembly::makeAlignments(bool (* checkfunction)(Assembly & as,int32,int32),
   nukeSTLContainer(AS_readhitmiss);
   nukeSTLContainer(AS_readhmcovered);
   nukeSTLContainer(AS_count_rhm);
-
+  
   bool cpvwanted=false;
-  for(uint32 i=0; i < ReadGroupLib::SEQTYPE_END; i++){
+  for(uint32 i=0; i < Read::SEQTYPE_END; i++){
     if(AS_miraparams[i].getAssemblyParams().as_clip_possible_vectors
        && AS_seqtypespresent[i]) cpvwanted=true;
   }
@@ -730,7 +692,7 @@ void Assembly::makeAlignments(bool (* checkfunction)(Assembly & as,int32,int32),
     if(!AS_steps[ASVECTORSCLIPPED]){
       CEBUG("No vectors clipped so far.\n");
 
-#if TRACKMEMUSAGE
+#if TRACKMEMUSAGE 
       cout << "\ndmi ma 00\n";
       dumpMemInfo();
 #endif
@@ -739,7 +701,7 @@ void Assembly::makeAlignments(bool (* checkfunction)(Assembly & as,int32,int32),
       AS_readhmcovered.resize(AS_readpool.size());
       AS_count_rhm.resize(AS_readpool.size());
 
-#if TRACKMEMUSAGE
+#if TRACKMEMUSAGE 
       cout << "\ndmi ma 10\n";
       dumpMemInfo();
 #endif
@@ -748,7 +710,7 @@ void Assembly::makeAlignments(bool (* checkfunction)(Assembly & as,int32,int32),
 	AS_readhmcovered[i].resize(AS_readpool[i].getLenClippedSeq(),0);
       }
 
-#if TRACKMEMUSAGE
+#if TRACKMEMUSAGE 
   cout << "\ndmi ma 20\n";
   dumpMemInfo();
 #endif
@@ -781,7 +743,7 @@ void Assembly::makeAlignments(bool (* checkfunction)(Assembly & as,int32,int32),
   AS_CUMADSLofstream.open(adsfacts_fn.c_str(), ios::out|ios::ate);
   AS_numADSFacts_fromalignments=AS_numADSFacts_fromshreds;
 
-#if TRACKMEMUSAGE
+#if TRACKMEMUSAGE 
   cout << "\ndmi ma 30\n";
   dumpMemInfo();
 #endif
@@ -798,13 +760,13 @@ void Assembly::makeAlignments(bool (* checkfunction)(Assembly & as,int32,int32),
 	ourskimfilename.c_str(),
 	version,
 	1,
-	trans100percent,
+	trans100percent, 
 	checkfunction,
 	ffout,
 	rfout);
     }
 
-#if TRACKMEMUSAGE
+#if TRACKMEMUSAGE 
   cout << "\ndmi ma 40\n";
   dumpMemInfo();
 #endif
@@ -823,29 +785,29 @@ void Assembly::makeAlignments(bool (* checkfunction)(Assembly & as,int32,int32),
 	ourskimfilename.c_str(),
 	version,
 	-1,
-	trans100percent,
+	trans100percent, 
 	checkfunction,
 	cfout,
 	rfout);
     }
-
-#if TRACKMEMUSAGE
+    
+#if TRACKMEMUSAGE 
     cout << "\ndmi ma 50\n";
     dumpMemInfo();
 #endif
 
     if(AS_miraparams[0].getAssemblyParams().as_dateoutput) dateStamp(cout);
-
+    
     // calculate possible vectorclips and store them,
     //  release big chunk of memory that is otherwise wasted
     if(AS_readhitmiss.size()) {
-      calcPossibleSeqVectorClipoffs(version, "", "_pass");
+      calcPossibleSeqVectorClipoffs(version, "", "_pass");    
     }
     nukeSTLContainer(AS_readhitmiss);
     nukeSTLContainer(AS_readhmcovered);
     nukeSTLContainer(AS_count_rhm);
 
-#if TRACKMEMUSAGE
+#if TRACKMEMUSAGE 
     cout << "\ndmi ma 60\n";
     dumpMemInfo();
 #endif
@@ -855,8 +817,8 @@ void Assembly::makeAlignments(bool (* checkfunction)(Assembly & as,int32,int32),
     // Find troublemakers
     // Later on, when hits are loaded again, reduce the weight of overlaps
     //  of troublemakers that are in in the overlap graph
-    // Troublemakers are reads that have more overlaps with mismatches
-    //  in WRMr tagged positions with other reads than overlaps with
+    // Troublemakers are reads that have more overlaps with mismatches 
+    //  in WRMr tagged positions with other reads than overlaps with 
     //  no problems.
     // huntSpoilSports also tags reads at contig ends as troublemakers
 
@@ -876,7 +838,7 @@ void Assembly::makeAlignments(bool (* checkfunction)(Assembly & as,int32,int32),
     nukeSTLContainer(AS_probablermbsnotok);
     // do not clear AS_istroublemaker!
 
-#if TRACKMEMUSAGE
+#if TRACKMEMUSAGE 
   cout << "\ndmi ma 70\n";
   dumpMemInfo();
 #endif
@@ -895,7 +857,7 @@ void Assembly::makeAlignments(bool (* checkfunction)(Assembly & as,int32,int32),
       }
     }
 #endif
-
+   
 #if 0
     // output of RHM vector
     cout << "RHM vectors:\n";
@@ -946,52 +908,42 @@ void Assembly::makeAlignments(bool (* checkfunction)(Assembly & as,int32,int32),
  *
  *************************************************************************/
 
-void Assembly::priv_loadAlignmentsFromFile(int32 version, const string prefix, const string postfix, const string tmpfname)
+void Assembly::loadAlignmentsFromFile(int32 version, const string prefix, const string postfix, const string tmpfname)
 {
   FUNCSTART("void Assembly::loadAlignmentsFromFile(int32 version, const string prefix, const string postfix, const string tmpfname)");
 
   assembly_parameters const & as_fixparams= AS_miraparams[0].getAssemblyParams();
-
+    
   string adsfacts_fn;
   if(tmpfname.size()){
     adsfacts_fn=buildFileName(version, prefix, postfix, tmpfname, ".adsfacts");
   }else{
-    adsfacts_fn=buildFileName(version, prefix, postfix,
+    adsfacts_fn=buildFileName(version, prefix, postfix, 
 			      as_fixparams.as_tmpf_ads,
 			      ".adsfacts");
   }
 
-  string fnpovl(buildDefaultCheckpointFileName(AS_miraparams[0].getFileParams().chkpt_persistentoverlaps));
-  if(!fileExists(fnpovl)){
-    fnpovl.clear();
-  }
-
   try{
     if(as_fixparams.as_dateoutput) dateStamp(cout);
-    cout << "Counting number of alignments in files ...";
+    cout << "Counting number of alignments in file ...";
     cout .flush();
 //TODO add ProgressIndic
     uint64 totaladsfacts=countLinesInFile(adsfacts_fn);
-    if(!fnpovl.empty()){
-      totaladsfacts+=countLinesInFile(fnpovl);
-    }
     cout << " done.\nExpecting " << totaladsfacts << " alignments.\n";
 
 
     if(as_fixparams.as_dateoutput) dateStamp(cout);
-    cout << "Loading confirmed " << totaladsfacts << " overlaps from disk (will need approximately ";
+    cout << "Loading confirmed overlaps from disk (will need approximately ";
     byteToHumanReadableSize(
       static_cast<double>(sizeof(AlignedDualSeqFacts))*totaladsfacts
       +static_cast<double>(sizeof(newedges_t))*totaladsfacts*2,
       cout );
     cout << " RAM):" << endl;
-
+      
     // Reduce memory fragmentation, keep these two buggers all time
     //  reserved in memory (do NOT nuke under normal circumstances!)
     AS_adsfacts.clear();
     AS_confirmed_edges.clear();
-
-#ifdef MIRA_ADSSTORE_CAPACITY
     if(AS_adsfacts.capacity() < totaladsfacts){
       // if current capacity is not enough, nuke and reserve with
       //  15% additional capacity
@@ -1011,21 +963,20 @@ void Assembly::priv_loadAlignmentsFromFile(int32 version, const string prefix, c
 
       AS_adsfacts.reserve(totaladsfacts + (totaladsfacts/100*15));
 
-#if TRACKMEMUSAGE
+#if TRACKMEMUSAGE 
       cout << "\ndmi laff  omg 10\n";
       dumpMemInfo();
 #endif
 
       AS_confirmed_edges.reserve(totaladsfacts*2 + (totaladsfacts*2/100*15));
 
-#if TRACKMEMUSAGE
+#if TRACKMEMUSAGE 
       cout << "\ndmi laff  omg 20\n";
       dumpMemInfo();
 #endif
     }
-#endif //MIRA_ADSSTORE_CAPACITY
 
-#if TRACKMEMUSAGE
+#if TRACKMEMUSAGE 
     cout << "\ndmi laff 00\n";
     dumpMemInfo();
 #endif
@@ -1033,27 +984,110 @@ void Assembly::priv_loadAlignmentsFromFile(int32 version, const string prefix, c
     AS_adsfacts.resize(totaladsfacts);
     AS_confirmed_edges.resize(totaladsfacts*2);
 
-#if TRACKMEMUSAGE
+#if TRACKMEMUSAGE 
   cout << "\ndmi laff 10\n";
   dumpMemInfo();
 #endif
 
     // TODO: *sigh* try to save even more space .... somehow?
-
-    uint64 runningADSFactnumber=0;
-    uint64 numbannedADSFacts=0;
-
-    ProgressIndicator<int64> P(0, AS_adsfacts.size());
-    priv_laffhelper(adsfacts_fn,
-		    P,runningADSFactnumber,numbannedADSFacts);
-    if(!fnpovl.empty()){
-      priv_laffhelper(fnpovl,
-		      P,runningADSFactnumber,numbannedADSFacts);
+      
+    uint32 runningADSFactnumber=0;
+    uint32 numbannedADSFacts=0;
+
+    ifstream finfin;
+    finfin.open(adsfacts_fn.c_str(), ios::in|ios::ate);
+    if(!finfin){
+      MIRANOTIFY(Notify::FATAL, "File not found? MIRA read it a few moments ago, it MUST exist: " << adsfacts_fn);
+    }
+    ProgressIndicator<streamsize> P(0, finfin.tellg(),2000);
+    finfin.seekg(0, ios::beg);
+
+    while(!finfin.eof()){
+      uint32 bestweight;
+      int16 direction;
+      finfin >> bestweight;
+      if(finfin.eof()) break;
+      finfin >> direction;
+      if(runningADSFactnumber >= AS_adsfacts.size()) {
+	MIRANOTIFY(Notify::INTERNAL, "Error while loading adsfacts, more facts in file than calculated earlier! (" << runningADSFactnumber << ")");
+      }
+      bool flag_stronggood;
+      bool flag_weakgood; 
+      bool flag_belowavgfreq; 
+      bool flag_norept;
+      bool flag_rept;
+
+      finfin >> flag_stronggood;
+      finfin >> flag_weakgood;
+      finfin >> flag_belowavgfreq;
+      finfin >> flag_norept;
+      finfin >> flag_rept;
+
+      AS_adsfacts[runningADSFactnumber].serialiseIn(finfin);
+	
+      // reduce the hit weights of troublemakers
+      // AND
+      // set the score ratio to below the one for pathfinder
+      //  quickrules
+      if(AS_istroublemaker[AS_adsfacts[runningADSFactnumber].getID1()]
+	 || AS_istroublemaker[AS_adsfacts[runningADSFactnumber].getID2()]){
+	if(bestweight>=100){
+	  bestweight/=100;
+	}else if(bestweight>=10){
+	  bestweight/=10;
+	}else{
+	  bestweight/=2;
+	}
+	uint8 st=AS_readpool[AS_adsfacts[runningADSFactnumber].getID1()].getSequencingType();
+	int8 minsr=AS_miraparams[st].getPathfinderParams().paf_quickrule_minsim1;
+	minsr=min(minsr,AS_miraparams[st].getPathfinderParams().paf_quickrule_minsim2);
+	st=AS_readpool[AS_adsfacts[runningADSFactnumber].getID2()].getSequencingType();
+	minsr=min(minsr,AS_miraparams[st].getPathfinderParams().paf_quickrule_minsim1);
+	minsr=min(minsr,AS_miraparams[st].getPathfinderParams().paf_quickrule_minsim2);
+	if(minsr>0) --minsr;
+	AS_adsfacts[runningADSFactnumber].setScoreRatio(minsr);
+      }
+      
+      // insert only ADSFacts where the reads are not permanently banned 
+      //  from overlapping
+      if(!AS_permanent_overlap_bans.checkIfBanned(AS_adsfacts[runningADSFactnumber].getID1(),AS_adsfacts[runningADSFactnumber].getID2())){
+	AS_confirmed_edges[runningADSFactnumber*2].rid1=AS_adsfacts[runningADSFactnumber].getID1();
+	AS_confirmed_edges[runningADSFactnumber*2].linked_with=AS_adsfacts[runningADSFactnumber].getID2();
+	AS_confirmed_edges[runningADSFactnumber*2].best_weight=bestweight;
+	AS_confirmed_edges[runningADSFactnumber*2].adsfindex=runningADSFactnumber;
+	AS_confirmed_edges[runningADSFactnumber*2].direction=direction;
+	AS_confirmed_edges[runningADSFactnumber*2].ol_stronggood=flag_stronggood;
+	AS_confirmed_edges[runningADSFactnumber*2].ol_weakgood=flag_weakgood;
+	AS_confirmed_edges[runningADSFactnumber*2].ol_belowavgfreq=flag_belowavgfreq;
+	AS_confirmed_edges[runningADSFactnumber*2].ol_norept=flag_norept;
+	AS_confirmed_edges[runningADSFactnumber*2].ol_rept=flag_rept;
+	AS_confirmed_edges[runningADSFactnumber*2].pf_allowquickoverlap=
+	  AS_wellconnected[AS_adsfacts[runningADSFactnumber].getID1()]
+	  && AS_wellconnected[AS_adsfacts[runningADSFactnumber].getID2()];
+
+	AS_confirmed_edges[runningADSFactnumber*2+1].rid1=AS_adsfacts[runningADSFactnumber].getID2();
+	AS_confirmed_edges[runningADSFactnumber*2+1].linked_with=AS_adsfacts[runningADSFactnumber].getID1();
+	AS_confirmed_edges[runningADSFactnumber*2+1].best_weight=bestweight;
+	AS_confirmed_edges[runningADSFactnumber*2+1].adsfindex=runningADSFactnumber;
+	AS_confirmed_edges[runningADSFactnumber*2+1].direction=direction;
+	AS_confirmed_edges[runningADSFactnumber*2+1].ol_stronggood=flag_stronggood;
+	AS_confirmed_edges[runningADSFactnumber*2+1].ol_weakgood=flag_weakgood;
+	AS_confirmed_edges[runningADSFactnumber*2+1].ol_belowavgfreq=flag_belowavgfreq;
+	AS_confirmed_edges[runningADSFactnumber*2+1].ol_rept=flag_rept;
+	AS_confirmed_edges[runningADSFactnumber*2+1].pf_allowquickoverlap=
+	  AS_wellconnected[AS_adsfacts[runningADSFactnumber].getID1()]
+	  && AS_wellconnected[AS_adsfacts[runningADSFactnumber].getID2()];
+
+	runningADSFactnumber++;
+      }else{
+	numbannedADSFacts++;
+      }
+      if(P.delaytrigger()) P.progress(finfin.tellg());
     }
     P.finishAtOnce();
-
+    
     if(runningADSFactnumber+numbannedADSFacts != AS_adsfacts.size()) {
-      MIRANOTIFY(Notify::INTERNAL, "Error while loading adsfacts, less facts in file than calculated earlier:" << AS_adsfacts.size() << " vs. " << runningADSFactnumber << " + " << numbannedADSFacts);
+      MIRANOTIFY(Notify::INTERNAL, "Error while loading adsfacts, less facts in file than calculated earlier!");
     }
     if(numbannedADSFacts){
       cout << "Found " << numbannedADSFacts << " banned facts.\n";
@@ -1075,27 +1109,31 @@ void Assembly::priv_loadAlignmentsFromFile(int32 version, const string prefix, c
   }
 
   // Apply malus to overlaps we do not want to be taken early
-  for(auto & cee : AS_confirmed_edges){
-    uint32 malus=getOverlapMalusDivider(cee.rid1, cee.linked_with);
-//      cout << "Malus\t" << AS_readpool[cee.rid1].getName()
-//	   << "\t" << AS_readpool[cee.linked_with].getName()
-//	   << "\t" << malus << endl;
-    if(malus>1){
-      cee.best_weight/=malus;
+  {
+    vector<newedges_t>::iterator neI=AS_confirmed_edges.begin();
+    for(; neI != AS_confirmed_edges.end(); neI++){
+      uint32 malus=getOverlapMalusDivider(neI->rid1, neI->linked_with);
+      if(malus>1){
+	neI->best_weight/=malus;
+	neI->pf_allowquickoverlap=false;
+      }
     }
   }
 
   // Make sure there's no overlap with a best_weight of "0"
   // (pathfinder is not prepared for this)
-  for(auto & cee : AS_confirmed_edges){
-    if(cee.best_weight==0) cee.best_weight=1;
+  {
+    vector<newedges_t>::iterator neI=AS_confirmed_edges.begin();
+    for(; neI != AS_confirmed_edges.end(); neI++){
+      if(neI->best_weight==0) neI->best_weight=1;
+    }
   }
 
   // Sort overlaps
 
   cout << "\n\nSorting confirmed overlaps (this may take a while) ... ";
   cout.flush();
-  sort(AS_confirmed_edges.begin(), AS_confirmed_edges.end(), newedges_t::sortComparatorByRIDUpByWeightDown);
+  sort(AS_confirmed_edges.begin(), AS_confirmed_edges.end(), Assembly__sortconfirmed_edges_t_);
   cout << "done.\n" << endl;
 
   if(as_fixparams.as_dateoutput) dateStamp(cout);
@@ -1104,7 +1142,7 @@ void Assembly::priv_loadAlignmentsFromFile(int32 version, const string prefix, c
   {
     vector<newedges_t>::const_iterator iceI=AS_confirmed_edges.begin();
     for(; iceI!=AS_confirmed_edges.end(); iceI++){
-      cout << AS_readpool[iceI->rid1].getName() << '\t' << AS_readpool[iceI->linked_with].getName() << '\t' << *iceI;
+      cout << *iceI;
     }
   }
 #endif
@@ -1119,7 +1157,7 @@ void Assembly::priv_loadAlignmentsFromFile(int32 version, const string prefix, c
     if(tmpfname.size()){
       pclusters_fn=buildFileName(version, prefix, postfix, tmpfname, ".adsfacts.pclusters");
     }else{
-      pclusters_fn=buildFileName(version, prefix, postfix,
+      pclusters_fn=buildFileName(version, prefix, postfix, 
 				as_fixparams.as_tmpf_ads,
 				".adsfacts.pclusters");
     }
@@ -1137,7 +1175,7 @@ void Assembly::priv_loadAlignmentsFromFile(int32 version, const string prefix, c
     clusterUnassembledReads(clusteridperread,readinclusterlist, dummy);
 
     {
-      // sort is not needed, but might be easier to understand what is
+      // sort is not needed, but might be easier to understand what is 
       //  happening when looking at the file. And it's quick enough.
 
       cout << "\nSorting clusters:\n";
@@ -1188,23 +1226,8 @@ void Assembly::priv_loadAlignmentsFromFile(int32 version, const string prefix, c
       cout << "done.\n";
     }
     pfout.close();
-  }
-
-  if(AS_logflag_loadedoverlaps){
-    string elfn(buildFileName(version, prefix, postfix,
-			      "elog.overlapsinmem",
-			      ".txt"));
-    cout << "Logging overlaps in mem to " << elfn << endl;
-    ofstream eout(elfn, ios::out);
-
-    for(auto & cee : AS_confirmed_edges){
-      eout << AS_readpool[cee.rid1].getName()
-	   << "\t" << AS_readpool[cee.linked_with].getName()
-	   << "\t" << cee
-	   << "\n";
-    }
-  }
-
+ }
+    
   FUNCEND();
 }
 
@@ -1215,148 +1238,31 @@ void Assembly::priv_loadAlignmentsFromFile(int32 version, const string prefix, c
  *
  *************************************************************************/
 
-void Assembly::priv_laffhelper(const string & fn, ProgressIndicator<int64> & P, uint64 & runningADSFactnumber, uint64 & numbannedADSFacts)
-{
-  FUNCSTART("void Assembly::priv_laffhelper(const string & fn, ProgressIndicator<int64> & P, uint64 & runningADSFactnumber, uint64 & numbannedADSFacts)");
-
-  ifstream finfin;
-  finfin.open(fn, ios::in);
-  if(!finfin){
-    MIRANOTIFY(Notify::FATAL, "File not found? MIRA read it a few moments ago, it MUST exist: " << fn);
-  }
-
-  while(!finfin.eof()){
-    uint32 bestweight;
-    int16 direction;
-    finfin >> bestweight;
-    if(finfin.eof()) break;
-    finfin >> direction;
-    if(runningADSFactnumber >= AS_adsfacts.size()) {
-      MIRANOTIFY(Notify::INTERNAL, "Error while loading adsfacts, more facts in file than calculated earlier. Calc: " << AS_adsfacts.size() << "\tNow at " << runningADSFactnumber);
-    }
-    bool flag_stronggood;
-    bool flag_weakgood;
-    bool flag_belowavgfreq;
-    bool flag_norept;
-    bool flag_rept;
-
-    finfin >> flag_stronggood;
-    finfin >> flag_weakgood;
-    finfin >> flag_belowavgfreq;
-    finfin >> flag_norept;
-    finfin >> flag_rept;
-
-    AS_adsfacts[runningADSFactnumber].serialiseIn(finfin);
-
-    auto rid1=AS_adsfacts[runningADSFactnumber].getID1();
-    auto rid2=AS_adsfacts[runningADSFactnumber].getID2();
-    // reduce the hit weights of troublemakers
-    // AND
-    // set the score ratio to below the one for pathfinder
-    //  quickrules
-    if(AS_istroublemaker[rid1]
-       || AS_istroublemaker[rid2]){
-      if(bestweight>=100){
-	bestweight/=100;
-      }else if(bestweight>=10){
-	bestweight/=10;
-      }else{
-	bestweight/=2;
-      }
-      uint8 st=AS_readpool[rid1].getSequencingType();
-      int8 minsr=AS_miraparams[st].getPathfinderParams().paf_quickrule_minsim1;
-      minsr=min(minsr,AS_miraparams[st].getPathfinderParams().paf_quickrule_minsim2);
-      st=AS_readpool[rid2].getSequencingType();
-      minsr=min(minsr,AS_miraparams[st].getPathfinderParams().paf_quickrule_minsim1);
-      minsr=min(minsr,AS_miraparams[st].getPathfinderParams().paf_quickrule_minsim2);
-      if(minsr>0) --minsr;
-      AS_adsfacts[runningADSFactnumber].setScoreRatio(minsr);
-    }
-
-    // insert only ADSFacts where the reads are not permanently banned
-    //  from overlapping
-    // BaCh 14.11.2014: OR, this is new, check here whether that read might have fallen into
-    //  disgrace. E.g., a chimera search in a later pass kicking away a read which has
-    //  saved short overlaps
-    // Let's hope the isUsedInAssembly() flag of a read tells the truth here and we did not
-    //  forget to set it right.
-    bool banned=!(AS_readpool[rid1].isUsedInAssembly() & AS_readpool[rid2].isUsedInAssembly());
-    // well, and as I do not trust myself: check if one of the reads has length 0 ...
-    //   ... a clear indicator that it has been sorted out earlier but not flagged as such
-    // at the latest the contig would moan if it had to add a read of length 0
-    if(likely(!banned)){
-      if(AS_readpool[rid1].getLenClippedSeq()==0){
-	banned=true;
-	AS_readpool[rid1].setUsedInAssembly(false);
-      }
-      if(AS_readpool[rid2].getLenClippedSeq()==0){
-	banned=true;
-	AS_readpool[rid2].setUsedInAssembly(false);
-      }
-    }
-    if(likely(!banned)){
-      banned|=AS_permanent_overlap_bans.checkIfBanned(rid1,rid2);
-    }
-    if(likely(!banned)){
-      AS_confirmed_edges[runningADSFactnumber*2].rid1=rid1;
-      AS_confirmed_edges[runningADSFactnumber*2].linked_with=rid2;
-      AS_confirmed_edges[runningADSFactnumber*2].best_weight=bestweight;
-      AS_confirmed_edges[runningADSFactnumber*2].adsfindex=runningADSFactnumber;
-      AS_confirmed_edges[runningADSFactnumber*2].direction=direction;
-      AS_confirmed_edges[runningADSFactnumber*2].ol_stronggood=flag_stronggood;
-      AS_confirmed_edges[runningADSFactnumber*2].ol_weakgood=flag_weakgood;
-      AS_confirmed_edges[runningADSFactnumber*2].ol_belowavgfreq=flag_belowavgfreq;
-      AS_confirmed_edges[runningADSFactnumber*2].ol_norept=flag_norept;
-      AS_confirmed_edges[runningADSFactnumber*2].ol_rept=flag_rept;
-
-      AS_confirmed_edges[runningADSFactnumber*2+1]=AS_confirmed_edges[runningADSFactnumber*2];
-      AS_confirmed_edges[runningADSFactnumber*2+1].rid1=rid2;
-      AS_confirmed_edges[runningADSFactnumber*2+1].linked_with=rid1;
-
-      ++runningADSFactnumber;
-    }else{
-      ++numbannedADSFacts;
-    }
-    P.increaseprogress();
-  }
-}
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
 //#define CEBUG(bla)   {cout << bla; cout.flush();}
 
 uint32 Assembly::getOverlapMalusDivider(int32 id1, int32 id2)
 {
   FUNCSTART("uint32 Assembly::getOverlapMalusDivider(int32 id1, int32 id2)");
 
-  if(AS_overlapcritlevelvl.empty()) return 1;
+  if(AS_overlapcritlevell.empty()) return 1;
 
-  BUGIFTHROW(id1>=AS_overlapcritlevelvl[1].size(),"id1>=AS_overlapcritlevell.size() ?");
-  BUGIFTHROW(id2>=AS_overlapcritlevelvl[1].size(),"id2>=AS_overlapcritlevell.size() ?");
+  BUGIFTHROW(id1>=AS_overlapcritlevell.size(),"id1>=AS_overlapcritlevell.size() ?");
+  BUGIFTHROW(id2>=AS_overlapcritlevell.size(),"id2>=AS_overlapcritlevell.size() ?");
 
-  auto ocll1=min(AS_overlapcritlevelvl[0][id1],AS_overlapcritlevelvl[1][id1]);
-  auto oclr1=min(AS_overlapcritlevelvr[0][id1],AS_overlapcritlevelvr[1][id1]);
-  auto ocll2=min(AS_overlapcritlevelvl[0][id2],AS_overlapcritlevelvl[1][id2]);
-  auto oclr2=min(AS_overlapcritlevelvr[0][id2],AS_overlapcritlevelvr[1][id2]);
+  if(AS_overlapcritlevell[id1]==0
+     && AS_overlapcritlevelr[id1]==0
+     && AS_overlapcritlevell[id2]==0
+     && AS_overlapcritlevelr[id2]==0) return 1;
 
-  if(ocll1==0
-     && oclr1==0
-     && ocll2==0
-     && oclr2==0) return 1;
+  if(AS_overlapcritlevell[id1]==255
+     || AS_overlapcritlevelr[id1]==255
+     || AS_overlapcritlevell[id2]==255
+     || AS_overlapcritlevelr[id2]==255) return 1000;
 
-  if(ocll1==255
-     || oclr1==255
-     || ocll2==255
-     || oclr2==255) return 1000;
-
-  if(ocll1==240
-     || oclr1==240
-     || ocll2==240
-     || oclr2==240) return 100;
+  if(AS_overlapcritlevell[id1]==240
+     || AS_overlapcritlevelr[id1]==240
+     || AS_overlapcritlevell[id2]==240
+     || AS_overlapcritlevelr[id2]==240) return 100;
 
   FUNCEND();
   return 10;
@@ -1376,7 +1282,7 @@ uint32 Assembly::getOverlapMalusDivider(int32 id1, int32 id2)
  *    Warning: if vector usedids was used, then orphans (singlets with
  *      with overlaps only to reads already used) will not appear as
  *      own cluster
- *    Warning: will contain empty clusters with no associated reads.
+ *    Warning: will contain empty clusters with no associated reads. 
  *      Getting them out would mean recalc, and is not needed if callers
  *      know that this may happen.
  *
@@ -1404,8 +1310,8 @@ void Assembly::clusterUnassembledReads(vector<int32> & clusteridperread, vector<
   {
     ProgressIndicator<int32> P(0,
 			       static_cast<int32>(AS_confirmed_edges.end()-AS_confirmed_edges.begin()));
-    auto I=AS_confirmed_edges.cbegin();
-    for(;I != AS_confirmed_edges.cend(); I++) {
+    vector<newedges_t>::const_iterator I=AS_confirmed_edges.begin();
+    for(;I != AS_confirmed_edges.end(); I++) {
       if(!usedids.empty() && (usedids[I->rid1] || usedids[I->linked_with])) continue;
       int32 cnum1=clusteridperread[I->rid1];
       int32 cnum2=clusteridperread[I->linked_with];
@@ -1429,10 +1335,10 @@ void Assembly::clusterUnassembledReads(vector<int32> & clusteridperread, vector<
       } else {
 	if (cnum1 != cnum2) {
 	  // uh oh ... we have to merge both these clusters
-
+	  
 	  int32 killed=max(cnum1,cnum2);
 	  int32 survive=min(cnum1,cnum2);
-
+	  
 	  //cout << "merge. Kill cluster " << killed << "\tsurvive " << survive;
 	  //
 	  //cout << "\nSize(killed): " << readinclusterlist[killed].size();
@@ -1446,7 +1352,7 @@ void Assembly::clusterUnassembledReads(vector<int32> & clusteridperread, vector<
 	  readinclusterlist[survive].splice(readinclusterlist[survive].end(),
 					    readinclusterlist[killed]);
 	  //cout << "\nSize(killed): " << readinclusterlist[killed].size();
-	  //cout << "\nSize(survive): " << readinclusterlist[survive].size();
+	  //cout << "\nSize(survive): " << readinclusterlist[survive].size();	    
 	}
       }
       //cout << '\n';
@@ -1466,7 +1372,7 @@ void Assembly::clusterUnassembledReads(vector<int32> & clusteridperread, vector<
 //  }
 
   return;
-}
+} 
 
 
 
@@ -1478,7 +1384,7 @@ void Assembly::clusterUnassembledReads(vector<int32> & clusteridperread, vector<
  *************************************************************************/
 
 void Assembly::minimiseMADSL(list<AlignedDualSeq> & madsl)
-{
+{ 
   list<AlignedDualSeq>::iterator I;
 
   CEBUG("minimiseMADSL() 1 madsl.size(): " << madsl.size() << endl);
@@ -1519,10 +1425,7 @@ void Assembly::minimiseMADSL(list<AlignedDualSeq> & madsl)
 //#define CEBUG(bla)   {if(rid1==9078 || rid2==9078) cout << bla; cout.flush(); }
 
 void Assembly::cleanupMADSL(list<AlignedDualSeq> & madsl, uint32 rid1, uint32 rid2, int8 direction, bool flag_stronggood, bool flag_weakgood, bool flag_belowavgfreq, bool flag_norept, bool flag_rept)
-{
-  FUNCSTART("void Assembly::cleanupMADSL(list<AlignedDualSeq> & madsl, uint32 rid1, uint32 rid2, int8 direction, bool flag_stronggood, bool flag_weakgood, bool flag_belowavgfreq, bool flag_norept, bool flag_rept)");
-
-  CEBUG("calling minimise\n");
+{ 
   minimiseMADSL(madsl);
 
   CEBUG("cleanupMADSL() 3 madsl.size(): " << madsl.size() << endl);
@@ -1530,29 +1433,29 @@ void Assembly::cleanupMADSL(list<AlignedDualSeq> & madsl, uint32 rid1, uint32 ri
   if(madsl.size()==0){
     // put both ids in permanent overlap banlist so that they
     //  won't make it through skim the next pass
-    CEBUG("Banning " << AS_readpool[rid1].getName() << " & " << AS_readpool[rid2].getName() << endl);
+
     AS_permanent_overlap_bans.insertBan(rid1,rid2);
   }else{
     //cout << madsl.front();
     //CEBUG(madsl.front());
-
+    
     // From here on, we'll take only the first solution anyway!
-
+    
     // ok, check for mismatches in RMB regions
-    if(AS_readpool.getRead(rid1).getNumOfTags() >0
+    if(AS_readpool.getRead(rid1).getNumOfTags() >0 
        || AS_readpool.getRead(rid2).getNumOfTags() >0) {
 
       int32 adscheck=checkADSForRepeatMismatches(*madsl.begin());
       if (adscheck<0) {
-
+	
 	// ban all except template partners
 	if(static_cast<uint32>(AS_readpool.getRead(rid1).getTemplatePartnerID())!=rid2) {
 	  CEBUG("ADS RMB banning: " << rid1 << ": " << AS_readpool.getRead(rid1).getName() << "\t" << rid2 << ": " << AS_readpool.getRead(rid2).getName() << endl);
 	  //cout << "ADS RMB banning: " << rid1 << ": " << AS_readpool.getRead(rid1).getName() << "\t" << rid2 << ": " << AS_readpool.getRead(rid2).getName() << endl;
-
+	  
 	  // put both ids in permanent overlap banlist
 	  AS_permanent_overlap_bans.insertBan(rid1,rid2);
-
+	  
 	  AS_probablermbsnotok[rid1]++;
 	  AS_probablermbsnotok[rid2]++;
 	  // and get out of here
@@ -1569,11 +1472,9 @@ void Assembly::cleanupMADSL(list<AlignedDualSeq> & madsl, uint32 rid1, uint32 ri
     }
 
 
-    if(AS_miraparams[0].getAssemblyParams().as_clip_possible_vectors
+    if(AS_miraparams[0].getAssemblyParams().as_clip_possible_vectors 
        && ! AS_steps[ASVECTORSCLIPPED]) {
-      CEBUG("transcribing hits\n");
       transcribeHits(*madsl.begin());
-      CEBUG("th done\n");
     }
 
     // if changing something here, do not forget to change at the 100%
@@ -1587,13 +1488,8 @@ void Assembly::cleanupMADSL(list<AlignedDualSeq> & madsl, uint32 rid1, uint32 ri
 		       << flag_rept << '\t';
     madsl.begin()->serialiseOut(AS_CUMADSLofstream);
     AS_CUMADSLofstream << '\n';
-    if(AS_CUMADSLofstream.bad()){
-      MIRANOTIFY(Notify::FATAL, "Could not write anymore to disk (at SWcomp). Disk full? Changed permissions?");
-    }
     AS_numADSFacts_fromalignments++;
   }
-
-  FUNCEND();
 }
 //#define CEBUG(bla)
 
@@ -1609,7 +1505,7 @@ void Assembly::cleanupMADSL(list<AlignedDualSeq> & madsl, uint32 rid1, uint32 ri
  * Gives back 1 for WRMr/WRMr mismatches
  * Else gives back 0 for no problem
  *
- * also gives back 1 for SIOr against SRMr/WRMr mismatches if the
+ * also gives back 1 for SIOr against SRMr/WRMr mismatches if the 
  *  strains are the same and we are not in "assumeSNP" mode
  *
  * Sets CRMr (Carbon-copy Repeat Marker) for reads that have no SRMr
@@ -1700,7 +1596,7 @@ int32 Assembly::checkADSForRepeatMismatches_wrapped(AlignedDualSeq & ads, bool &
   }else {
     cons+=ads.getOffsetInAlignment(id1);
     alseq2+=ads.getOffsetInAlignment(id1);
-
+    
     r1index+=ads.getOffsetInAlignment(id1)*r1delta;
     r2index+=ads.getOffsetInAlignment(id1)*r2delta;
   }
@@ -1716,9 +1612,7 @@ int32 Assembly::checkADSForRepeatMismatches_wrapped(AlignedDualSeq & ads, bool &
   int32 r2newctagto=-1;
 
   bool problemoccured=false;
-
-  // keep count in this loop forward, is used further downward!
-  for(uint32 count=0; count<ads.getOverlapLen(); ++count, ++cons, r1index+=r1delta, r2index+=r2delta, ++alseq1, ++alseq2){
+  for(uint32 count=ads.getOverlapLen(); count; count--, cons++, r1index+=r1delta, r2index+=r2delta, alseq1++, alseq2++){
 
     if(*alseq1=='*') {
       r1index-=r1delta;
@@ -1745,7 +1639,7 @@ int32 Assembly::checkADSForRepeatMismatches_wrapped(AlignedDualSeq & ads, bool &
     }
     if(problemoccured){
       cout << "ADSfrm: (" << id1 << ") " << AS_readpool.getRead(id1).getName() << " (" << id2 << ") " << AS_readpool.getRead(id2).getName() << endl << endl;
-
+      
       Read::setCoutType(Read::AS_CAF);
       cout << AS_readpool.getRead(id1) << endl << endl;
       cout << AS_readpool.getRead(id2) << endl << endl;
@@ -1759,7 +1653,7 @@ int32 Assembly::checkADSForRepeatMismatches_wrapped(AlignedDualSeq & ads, bool &
     BUGIFTHROW(r1index >= static_cast<int32>(AS_readpool.getRead(id1).getLenSeq()), "r1index >= length of read ???");
     BUGIFTHROW(r2index < 0, "r2index < 0 ???");
     BUGIFTHROW(r2index >= static_cast<int32>(AS_readpool.getRead(id2).getLenSeq()), "r2index >= length of read ???");
-
+    
     CEBUG("\t" << AS_readpool.getRead(id1).getBaseInSequence(r1index) << " " << AS_readpool.getRead(id2).getBaseInSequence(r2index));
     if(toupper(AS_readpool.getRead(id1).getBaseInSequence(r1index)) != toupper(AS_readpool.getRead(id2).getBaseInSequence(r2index))) {
       CEBUG(" !");
@@ -1770,39 +1664,39 @@ int32 Assembly::checkADSForRepeatMismatches_wrapped(AlignedDualSeq & ads, bool &
     //  //CEBUG("\tStarbase r1index & r2index not valid!" << endl);
     //  //continue;
     //}
-
-
+    
+    
     // now the real check whether the bases differ.
     // This gets a bit more difficult than initially thought,
     //  as the alignment objects convert gaps into "N" bases
 
     // FIXME: now alignments keep gaps, rethink this!
-    //  So until this is fixed (never?), we need to check
+    //  So until this is fixed (never?), we need to check 
     //  the complicated way
 
     // First, none of the bases may be a "X"
-
+    
     if(!(toupper(*alseq1)=='X'
 	 // TODO: check whether take N back into consideration
 //	 || toupper(*alseq1)=='N'
 //	 || toupper(*alseq2)=='N'
 	 || toupper(*alseq2)=='X')){
-
+      
       // if needed, carbon copy existing SRMr tags at this place
 
       bool tagr1p=AS_readpool.getRead(id1).hasTag(Read::REA_tagentry_idSRMr, r1index);
       bool tagr2p=AS_readpool.getRead(id2).hasTag(Read::REA_tagentry_idSRMr, r2index);
       bool tagr1pc=AS_readpool.getRead(id1).hasTag(Read::REA_tagentry_idCRMr, r1index);
       bool tagr2pc=AS_readpool.getRead(id2).hasTag(Read::REA_tagentry_idCRMr, r2index);
-
+	
       // if both reads are from same strain
       //  AND only one read has SRMr at this position (tagr1p XOR tagr2p)
       // then try to create CRMr tag
       bool mustctagr1=false;
       bool mustctagr2=false;
-      if((AS_readpool.getRead(id1).getStrainID()
+      if((AS_readpool.getRead(id1).getStrainID() 
 	  == AS_readpool.getRead(id2).getStrainID())
-	 && (tagr1p  || tagr2p)
+	 && (tagr1p  || tagr2p) 
 	 && ((tagr1p  && !tagr2p && !tagr2pc)
 	     || (tagr2p  && !tagr1p && !tagr1pc))){
 
@@ -1820,7 +1714,7 @@ int32 Assembly::checkADSForRepeatMismatches_wrapped(AlignedDualSeq & ads, bool &
 //	    CEBUG(static_cast<char>(toupper(*(alseq1+checki))) << static_cast<char>(toupper(*(alseq2+checki))) << " ");
 //	    if(checki==0) continue;
 //	    if(toupper(*(alseq1+checki)) != toupper(*(alseq2+checki))){
-//	      isclean=false;
+//	      isclean=false; 
 //	      break;
 //	    }
 //	  }
@@ -1852,7 +1746,7 @@ int32 Assembly::checkADSForRepeatMismatches_wrapped(AlignedDualSeq & ads, bool &
 	  // are we in overlap? (==in the non-clipped area of the reads)
 	  if(runvar>=0 && runvar < ads.getOverlapLen()){
 	    if(toupper(*(alseq1+checki)) != toupper(*(alseq2+checki))){
-	      isclean=false;
+	      isclean=false; 
 	      break;
 	    }
 	  }
@@ -1883,9 +1777,9 @@ int32 Assembly::checkADSForRepeatMismatches_wrapped(AlignedDualSeq & ads, bool &
 	}else{
 	  // deferred setting of tags
 	  if(r1newctagfrom>r1newctagto) swap(r1newctagfrom,r1newctagto);
-	  AS_tmptag_CRMr.from=r1newctagfrom;
-	  AS_tmptag_CRMr.to=r1newctagto;
-	  AS_readpool.getRead(id1).addTagO(AS_tmptag_CRMr);
+	  AS_readpool.getRead(id1).addTag(r1newctagfrom,r1newctagto,
+					  Read::REA_tagentry_idCRMr,
+					  Read::REA_tagentry_coEmpty);
 	  need2ndpass=true;
 	  r1newctagfrom=-1;
 	  r1newctagto=-1;
@@ -1905,9 +1799,9 @@ int32 Assembly::checkADSForRepeatMismatches_wrapped(AlignedDualSeq & ads, bool &
 	}else{
 	  // deferred setting of tags
 	  if(r2newctagfrom>r2newctagto) swap(r2newctagfrom,r2newctagto);
-	  AS_tmptag_CRMr.from=r2newctagfrom;
-	  AS_tmptag_CRMr.to=r2newctagto;
-	  AS_readpool.getRead(id2).addTagO(AS_tmptag_CRMr);
+	  AS_readpool.getRead(id2).addTag(r2newctagfrom,r2newctagto,
+					  Read::REA_tagentry_idCRMr,
+					  Read::REA_tagentry_coEmpty);
 	  need2ndpass=true;
 	  r2newctagfrom=-1;
 	  r2newctagto=-1;
@@ -1916,7 +1810,7 @@ int32 Assembly::checkADSForRepeatMismatches_wrapped(AlignedDualSeq & ads, bool &
 
       // simpler, both bases are some IUPAC base != N and != *
       // do  not check for "equal" bases, but for "contained"
-
+      
       if(!dptools::areBasesContained(*alseq1,*alseq2)){
 	//// BaCh 23.03.2009
 	//// NEW and test: check on hash frequency
@@ -1934,7 +1828,7 @@ int32 Assembly::checkADSForRepeatMismatches_wrapped(AlignedDualSeq & ads, bool &
 	//  }else{
 	//    freq2=AS_readpool.getRead(id2).getBPosHashStats(r2index).rev.getFrequency();
 	//  }
-	//
+	//  
 	//  CEBUG("\tfreq1: " << static_cast<uint16>(freq1) << "\tfreq2: " << static_cast<uint16>(freq2));
 	//  if(freq1>=3 && freq2>=3){
 	//    numfrequencymismatch++;
@@ -1949,7 +1843,7 @@ int32 Assembly::checkADSForRepeatMismatches_wrapped(AlignedDualSeq & ads, bool &
 	//tagr2p|=AS_readpool.getRead(id2).hasTag(Read::REA_tagentry_idCRMr, r2index);
 	tagr1p|=tagr1pc;
 	tagr2p|=tagr2pc;
-
+	
 	CEBUG("\t TRMr?p:" << tagr1p << " " << tagr2p);
 
 	// weak mismatches set if only one of the reads has a SRMr / CRMr
@@ -1994,24 +1888,25 @@ int32 Assembly::checkADSForRepeatMismatches_wrapped(AlignedDualSeq & ads, bool &
     }
 
     CEBUG(endl);
-
+    
   }
+  
 
   // deferred setting of tags
   // read1
   if(r1newctagfrom>=0){
     if(r1newctagfrom>r1newctagto) swap(r1newctagfrom,r1newctagto);
-    AS_tmptag_CRMr.from=r1newctagfrom;
-    AS_tmptag_CRMr.to=r1newctagto;
-    AS_readpool.getRead(id1).addTagO(AS_tmptag_CRMr);
+    AS_readpool.getRead(id1).addTag(r1newctagfrom,r1newctagto,
+				    Read::REA_tagentry_idCRMr,
+				    Read::REA_tagentry_coEmpty);
     need2ndpass=true;
   }
   // read2
   if(r2newctagfrom>=0){
     if(r2newctagfrom>r2newctagto) swap(r2newctagfrom,r2newctagto);
-    AS_tmptag_CRMr.from=r2newctagfrom;
-    AS_tmptag_CRMr.to=r2newctagto;
-    AS_readpool.getRead(id2).addTagO(AS_tmptag_CRMr);
+    AS_readpool.getRead(id2).addTag(r2newctagfrom,r2newctagto,
+				    Read::REA_tagentry_idCRMr,
+				    Read::REA_tagentry_coEmpty);
     need2ndpass=true;
   }
 
@@ -2059,7 +1954,7 @@ void Assembly::transcribeHits(AlignedDualSeq & ads)
 
   AS_count_rhm[id1]++;
   AS_count_rhm[id2]++;
-
+  
   int32 r1index, r2index, r1delta, r2delta;
   char const * alseq1, * alseq2, * rs1, * rs2;
   char c1, c2;
@@ -2082,29 +1977,29 @@ void Assembly::transcribeHits(AlignedDualSeq & ads)
     if(ads.getSequenceDirection(id1)<0) {
       r1index=static_cast<int32>(AS_readhitmiss[id1].size())+ads.getOffsetInAlignment(id1);
       r2index=-(ads.getOffsetInAlignment(id2));
-
+      
       rs1=AS_readpool.getRead(id1).getClippedComplementSeqAsChar();
       rs2=AS_readpool.getRead(id2).getClippedSeqAsChar();
-
+      
       r1delta=-1;
       r2delta=1;
-
+      
       //cout << "Dong1!\n";
     } else {
       r1index=-(ads.getOffsetInAlignment(id1));
       // TODO: warum zum ... ist hier -1 notwendig???
       r2index=static_cast<int32>(AS_readhitmiss[id2].size())+ads.getOffsetInAlignment(id2)-1;
-
+      
       rs1=AS_readpool.getRead(id1).getClippedSeqAsChar();
       rs2=AS_readpool.getRead(id2).getClippedComplementSeqAsChar();
-
+      
       r1delta=1;
       r2delta=-1;
-
+      
       //cout << "Dong2!\n";
     }
   }
-
+  
   //cout << "r1index: " << r1index << endl;
   //cout << "r2index: " << r2index << endl;
   //cout << "rs1: " << rs1[0] << rs1[1] << rs1[2] << rs1[3] << endl;
@@ -2129,7 +2024,7 @@ void Assembly::transcribeHits(AlignedDualSeq & ads)
       r2index+=r2delta;
       continue;
     }
-    if (r1index >= static_cast<int32>(AS_readhitmiss[id1].size())
+    if (r1index >= static_cast<int32>(AS_readhitmiss[id1].size()) 
 	|| r2index >= static_cast<int32>(AS_readhitmiss[id2].size())) {
       if(r1index < static_cast<int32>(AS_readhitmiss[id1].size())) {
 	alseq1++;
@@ -2143,13 +2038,13 @@ void Assembly::transcribeHits(AlignedDualSeq & ads)
       r2index+=r2delta;
       continue;
     }
-
+    
     c1=static_cast<char>(toupper(*alseq1));
     alseq1++;
     c2=static_cast<char>(toupper(*alseq2));
     alseq2++;
     //cout << "\t" << c1 << "\t" << c2;
-    if(c1==c2
+    if(c1==c2 
        || (c1=='N' || c2=='N' || c1=='X' || c2=='X')) {
       //cout << '\n';
       AS_readhmcovered[id1][r1index]++;
@@ -2199,7 +2094,7 @@ void Assembly::transcribeHits(AlignedDualSeq & ads)
  *  true reference sequence, this can lead to reads being mapped to a
  *  completely wrong copy of the repetitive element.
  *
- * E.g.:
+ * E.g.: 
  *  a read
  *           .......................*...................
  *  with a homopolymer indel error may map to
@@ -2208,7 +2103,7 @@ void Assembly::transcribeHits(AlignedDualSeq & ads)
  *   different number of bases in homopolymer
  *
  * Therefore, for matches pf a read against a rail, go through a SW align
- *  to calculate the real score ration (and save that as
+ *  to calculate the real score ration (and save that as 
  *  percent_in_overlap)
  *
  * Always work on the the full posfmatch files, immediately after skim
@@ -2259,48 +2154,45 @@ void Assembly::rnpskmbs_helper(const string & filename, const int32 version, con
 
   // temporary skim container
   vector<skimhitforsave_t> tsc;
-  tsc.reserve(500000);
 
   FILE * finfout;
   finfout = fopen(filename.c_str(),"r+");
-  if(finfout == nullptr) {
+  if(finfout == NULL) {
     MIRANOTIFY(Notify::FATAL, "File not found: " << filename);
   }
-  myFSeek(finfout, 0, SEEK_END);
-  auto finsize=myFTell(finfout);
+  fseek(finfout, 0, SEEK_END);
+  streamsize finsize=ftell(finfout);
   rewind(finfout);
 
-  uint64 numrecalc=0;
-
-  int64 skimsprocessed=0;
-  int64 numskims=finsize/sizeof(skimhitforsave_t);
-  ProgressIndicator<streamsize> P (0, numskims, 2000);
-
   long freadpos=0;
   long fwritepos=0;
 
+  uint64 lineno=0;
+
   skim_parameters const & skim_params= AS_miraparams[0].getSkimParams();
 
   while(!feof(finfout)){
-    tsc.resize(tsc.capacity());
-    myFSeek(finfout, freadpos, SEEK_SET);
-    size_t numread=myFRead(&tsc[0],sizeof(skimhitforsave_t),tsc.capacity(),finfout);
+    tsc.resize(500000);
+    fseek(finfout, freadpos, SEEK_SET);
+    size_t numread=fread(&tsc[0],sizeof(skimhitforsave_t),tsc.capacity(),finfout);
 
     if(numread==0) break;
     CEBUG("rnpskmbs_helper: read " << numread << endl;)
+    lineno+=numread;
 
-    freadpos=myFTell(finfout);
+    freadpos=ftell(finfout);
     CEBUG("new freadpos: " << freadpos << endl);
 
     if(numread<tsc.capacity()) tsc.resize(numread);
 
-    for(auto readI=tsc.begin(); readI != tsc.end(); ++readI, ++skimsprocessed){
-      P.progress(skimsprocessed);
+    vector<skimhitforsave_t>::iterator readI=tsc.begin();
+
+    for(; readI != tsc.end(); ++readI){
       if(readI->percent_in_overlap != 100
 	 && (AS_readpool[readI->rid1].isRail()
 	     || AS_readpool[readI->rid2].isRail())){
 	// don't check if both are rails
-	if(AS_readpool[readI->rid1].isRail()
+	if(AS_readpool[readI->rid1].isRail() 
 	   && AS_readpool[readI->rid2].isRail()) {
 	  continue;
 	}
@@ -2313,8 +2205,7 @@ void Assembly::rnpskmbs_helper(const string & filename, const int32 version, con
 	   || AS_readpool[readI->rid2].getLenClippedSeq() == 0) continue;
 
 	// OK, looks like we need to recompute that one and update the estimations
-	++numrecalc;
-	computeSWAlign(madsl,readI->rid1,readI->rid2,readI->eoffset,direction,chkalign, -1);
+	computeSWAlign(madsl,readI->rid1,readI->rid2,readI->eoffset,direction,chkalign);
 	//{
 	//  list<AlignedDualSeq>::const_iterator mI=madsl.begin();
 	//  uint32 i=0;
@@ -2342,24 +2233,20 @@ void Assembly::rnpskmbs_helper(const string & filename, const int32 version, con
       }
     }
     if(!tsc.empty()){
-      myFSeek(finfout, fwritepos, SEEK_SET);
-      if(myFWrite(&tsc[0],
-		  sizeof(skimhitforsave_t),
-		  tsc.size(),
-		  finfout) != tsc.size()){
+      fseek(finfout, fwritepos, SEEK_SET);
+      if(fwrite(&tsc[0],
+		sizeof(skimhitforsave_t),
+		tsc.size(),
+		finfout) != tsc.size()){
 	MIRANOTIFY(Notify::FATAL, "Could not overwrite part of file. Changed permissions?");
       }
-      fwritepos=myFTell(finfout);
+      fwritepos=ftell(finfout);
       CEBUG("new fwritepos: " << fwritepos << endl);
     }
   }
 
-  P.finishAtOnce();
-
   fclose(finfout);
 
-  cout << "\nHad to recalculate " << numrecalc << " skims (out of " << numskims << ") with Smith-Waterman.\n";
-
   FUNCEND();
 }
 
@@ -2377,3 +2264,8 @@ void Assembly::rnpskmbs_helper(const string & filename, const int32 version, con
 /////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////
+
+
+
+
+
diff --git a/src/mira/contig.C b/src/mira/contig.C
old mode 100644
new mode 100755
index 40ff341..7124bb2
--- a/src/mira/contig.C
+++ b/src/mira/contig.C
@@ -11,36 +11,27 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
+#ifndef lint
+static char vcid[] = "$Id$";
+#endif /* lint */
 
 #include "contig.H"
-
 #include "util/misc.H"
 #include "assembly_output.H"
 
-#include "mira/align.H"
-#include "mira/ads.H"
-#include "mira/readpool.H"
-
-#include <unordered_set>
-
-
-using namespace std;
-
-#define CEBUG(bla)
-
 
 //#define PARANOIABUGTRACKFLAG
 #ifdef PARANOIABUGTRACKFLAG
@@ -58,11 +49,12 @@ enum { CON_CONSTARTSIZE=4000,
        CON_READSSTARTSIZE=100,
        CON_READSINCSIZE=100};
 
-bool Contig::CON_mastercebugflag=false;
+
 
 bool Contig::CON_abortflag=false;
 
 uint32 Contig::CON_id_counter=1;
+uint32 Contig::CON_static_ok=0;
 
 uint32 Contig::CON_railcounter=0;
 
@@ -70,60 +62,63 @@ uint32 Contig::CON_cer_idcounter=0;
 
 
 
+vector<multitag_t::mte_id_t> Contig::CON_danger_zones_ids;
+vector<multitag_t::mte_id_t> Contig::CON_baselock_ids;
+vector<multitag_t::mte_id_t> Contig::CON_snplock_ids;
 
 
-#if CPP_READ_SEQTYPE_END != 8
-#error "This code is made for 8 sequencing types, adapt!"
+
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
 #endif
 const Contig::consensus_counts_t Contig::CON_concounts_zero=
-{0,0,0,0,0,0,0, {0,0,0,0,0,0,0,0}, 0,0,0,
- 0,{0,0},{0,0},{0,0},'@','@',0};
+{0,0,0,0,0,0,0, {0,0,0,0,0,0}, 0,0,0,
+ 0,{0,0},{0,0},{0,0},'@'};
 const Contig::consensus_counts_t Contig::CON_concounts_zero_nobb=
-{0,0,0,0,0,0,0, {0,0,0,0,0,0,0,0}, 0,0,0};
+{0,0,0,0,0,0,0, {0,0,0,0,0,0}, 0,0,0};
 
 
 uint8 Contig::CON_outtype=AS_TEXT;
 
 
+#ifdef DEVELOPMENTVERSION
 //bool  Contig::CON_outputRails=true;
-bool  Contig::CON_outputrails=false;
-
-
-bool Contig::CON_static_ok=false;
+bool  Contig::CON_outputRails=false;
+#else
+bool  Contig::CON_outputRails=false;
+#endif
 
+void Contig::foolCompiler()
+{
+#include "stdinc/foolcompiler.C"
+}
 
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
 
-void Contig::setCEBUGFlag(int32 id1, int32 id2)
-{
-  CON_cebugflag=false;
-  return;
+//void Contig::addConsensusSequenceAsReadToContig(int32 strainid)
+//{
+//  string consseq;
+//  vector<base_quality_t> consqual;
+//  
+//  getConsensus(consseq, consqual, false,0,0, strainid);
+//
+//  contigread_t newread;
+//  newread.orpid=-1;
+//  newread.direction=1;
+//  newread.offset=0;
+//  // newread.read=CON_readpool->getRead(id); // NO! we don't copy it twice
+//
+//  // now insert the read into the readpool of the contig 
+//  CON_reads.push_back(newread);
+//
+//  CON_reads.back().read.setName("bla");
+//  CON_reads.back().read.setSequenceFromString(consseq.getSequence());
+//
+//  hier weiter 
+//
+//
+//}
 
-  if(!CON_mastercebugflag) return;
-  if(CON_reads.size()>=9736
-     && CON_reads.size()<=18874) CON_cebugflag=true;
-  return;
 
-  if(CON_cebugnames.empty()){
-//CON_cebugnames.insert("G8BUD:1800:2515");
-//...
-  }
-  if(!CON_cebugnames.empty()){
-    if(id1>=0){
-      if(CON_cebugnames.find(CON_readpool->getRead(id1).getName())
-	 != CON_cebugnames.end()) CON_cebugflag=true;
-    }
-    if(id2>=0){
-      if(CON_cebugnames.find(CON_readpool->getRead(id2).getName())
-	 != CON_cebugnames.end()) CON_cebugflag=true;
-    }
-  }
-}
 
 /*************************************************************************
  *
@@ -134,25 +129,10 @@ void Contig::setCEBUGFlag(int32 id1, int32 id2)
 
 
 // Plain vanilla constructor
-Contig::Contig(vector<MIRAParameters> * params, ReadPool & readpool) : CON_reads(readpool)
+Contig::Contig(vector<MIRAParameters> * params, ReadPool & readpool)
 {
   FUNCSTART("Contig::Contig(MIRAParameters * params, ReadPool & readpool)");
 
-  if(!CON_static_ok){
-    // cannot use a real static initialiser because of the static
-    //  initialisation fiasco which would happen otherwise with
-    //  multitag_t string container
-    CON_danger_zones_ids.push_back(multitag_t::newIdentifier("ALUS"));
-    CON_danger_zones_ids.push_back(multitag_t::newIdentifier("REPT"));
-
-    CON_baselock_ids.push_back(multitag_t::newIdentifier("SRMr"));
-    CON_baselock_ids.push_back(multitag_t::newIdentifier("CRMr"));
-    CON_baselock_ids.push_back(multitag_t::newIdentifier("WRMr"));
-
-    CON_snplock_ids.push_back(multitag_t::newIdentifier("SIOr"));
-    CON_static_ok=true;
-  }
-
   CON_miraparams=params;
 
   //CON_aligncache = new Align(params, true);
@@ -168,8 +148,6 @@ Contig::Contig(vector<MIRAParameters> * params, ReadPool & readpool) : CON_reads
 
 
 
-
-
 /*************************************************************************
  *
  *
@@ -179,6 +157,33 @@ Contig::Contig(vector<MIRAParameters> * params, ReadPool & readpool) : CON_reads
 
 void Contig::init()
 {
+  if(CON_static_ok==0){
+    CON_static_ok=1;
+
+    //CON_danger_zones_ids.push_back(CON_tagALUS);
+    //CON_danger_zones_ids.push_back(CON_tagREPT);
+    //
+    //CON_baselock_ids.push_back(Read::REA_tagSRMr);
+    //CON_baselock_ids.push_back(Read::REA_tagCRMr);
+    //CON_baselock_ids.push_back(Read::REA_tagWRMr);
+    //
+    //CON_snplock_ids.push_back(Read::REA_tagSIOr);
+
+    // TODO: need to use some strings here
+    CON_danger_zones_ids.push_back(multitag_t::newIdentifier("ALUS"));
+    CON_danger_zones_ids.push_back(multitag_t::newIdentifier("REPT"));
+
+    CON_baselock_ids.push_back(multitag_t::newIdentifier("SRMr"));
+    CON_baselock_ids.push_back(multitag_t::newIdentifier("CRMr"));
+    CON_baselock_ids.push_back(multitag_t::newIdentifier("WRMr"));
+
+    CON_snplock_ids.push_back(multitag_t::newIdentifier("SIOr"));
+
+    CON_cer_idcounter=0;
+  }
+
+  CON_valid=CON_VALID;
+
   zeroVars();
 
   CON_tmpcons_from_backbone=false;
@@ -206,12 +211,14 @@ void Contig::discard()
   //CON_aligncache->discard();
 
   nukeSTLContainer(CON_counts);
-  CON_reads.clear();
+  nukeSTLContainer(CON_reads);
   nukeSTLContainer(CON_templates_present);
   nukeSTLContainer(CON_consensus_tags);
   nukeSTLContainer(CON_fixedconsseq);
   nukeSTLContainer(CON_fixedconsqual);
+  nukeSTLContainer(CON_outputorder);
   nukeSTLContainer(CON_last_dangerous_overlaps);
+  nukeSTLContainer(CON_maprpids_to_conreadsids);
   nukeSTLContainer(CON_targetcoverageperst);
 //  nukeSTLContainer(CON_cheat_intelcons);
 //  nukeSTLContainer(CON_cheat_intelconsqual);
@@ -234,22 +241,15 @@ void Contig::zeroVars()
 {
 
   CON_readsperstrain.clear();
-  CON_readsperreadgroup.clear();
-
-  CON_markerpositions.clear();
-  CON_mpindex_msrkceu_left=-1;
-  CON_mpindex_msrkceu_right=-1;
-
-  CON_longestreadseen=0;
-  CON_longestrailseen=0;
-  CON_longestnonbbreadseen=0;
-
-  CON_conscalc_mincov=0;
-  CON_conscalc_minqual=0;
-  CON_conscalc_missingchar='X';
-  CON_conscalc_assumediploid=false;
-  CON_conscalc_allowiupac=true;
-  CON_conscalc_addconstag=true;
+
+//  CON_cheat_intelcons_markspecials=false;
+//  CON_cheat_intelcons_mincov=999999;
+//  CON_cheat_intelcons_minqual=99;
+//  CON_cheat_intelcons_strainidtotake=999999;
+
+  CON_conscalc_mincov=999999;
+  CON_conscalc_minqual=101;
+  CON_conscalc_missingchar=0;
   zeroStats();
 
   CON_specialsraddconditions=false;
@@ -261,25 +261,14 @@ void Contig::zeroVars()
     CON_nummergedreads_perseqtype[i]=0;
   }
 
+  CON_index_leftestbbread=0;
+  CON_index_rightestbbread=0;
+
   CON_nameprefix="stdname";
   CON_outtype=AS_TEXT;
 
   CON_contains_long_repeats_only=false;
-  CON_contains_majority_digitallynormalised_reads=0;
-
-  CON_us_steps.clear();
-  CON_us_steps.resize(USCLO_END,0);
-  CON_us_steps_iric.clear();
-  CON_us_steps_iric.resize(USCLOIRIC_END,0);
-  CON_us_steps_drfc.clear();
-  CON_us_steps_drfc.resize(USCLODRFC_END,0);
-  CON_us_steps_cons.clear();
-  CON_us_steps_cons.resize(USCLOCONS_END,0);
-  CON_track_numins=0;
-  CON_track_numdels=0;
-
-  CON_isbackbonecontig=false;
-
+  
   definalise();
 }
 
@@ -306,6 +295,84 @@ Contig::~Contig()
 
 /*************************************************************************
  *
+ * Dump some internal things on the contig
+ *
+ * note: incomplete
+ *
+ *************************************************************************/
+
+void Contig::dumpStatus(ostream & ostr)
+{
+  ostr << "ContigDump: " << CON_id << " " << CON_nameprefix << " " << CON_name << endl
+       << "CON_finalised: " << CON_finalised << endl;
+  if(CON_readpool==NULL){
+    ostr << "CON_readpool: NULL !\n";
+  }else{
+    ostr << "CON_readpool: set\n";
+  }
+  ostr << "CON_reads: " << CON_reads.size() << endl
+       << "CON_counts: " << CON_counts.size() << endl
+       << "CON_templates_present: " << CON_templates_present.size() << endl
+       << "CON_consensus_tags: " << CON_consensus_tags.size() << endl
+       << "CON_targetcoverageperst: " << CON_targetcoverageperst.size();
+  for(uint32 i=0; i<CON_targetcoverageperst.size();++i){
+    ostr << "\t" << CON_targetcoverageperst[i] << endl;
+  }
+
+  ostr << "CON_maprpids_to_conreadsids: " << CON_maprpids_to_conreadsids.size() << endl
+       << "CON_allowedrefids: " << CON_allowedrefids.size() << endl
+       << "CON_2tmpcons: " << CON_2tmpcons.size() << endl
+       << "CON_tmpcons_from_backbone: " <<  CON_tmpcons_from_backbone << endl
+       << "CON_specialsraddconditions: " << CON_specialsraddconditions << endl
+       << "CON_ssrc_maxtotalerrors: " << CON_ssrc_maxtotalerrors << endl
+       << "CON_ssrc_maxgaps: " << CON_ssrc_maxgaps << endl
+       << "CON_ssrc_maxmismatches: " << CON_ssrc_maxmismatches << endl;
+
+  for(uint32 i=0; i<NUMMERGESEQTYPES; ++i){
+    ostr << "CON_nummergedreads_perseqtype[" << i << "]: " << CON_nummergedreads_perseqtype[i] << endl;
+  }
+
+  ostr << "CON_fixedconsseq: " << CON_fixedconsseq.size() << endl
+       << "CON_fixedconsqual: " << CON_fixedconsqual.size() << endl
+       << "CON_conscalc_mincov: " << CON_conscalc_mincov << endl
+       << "CON_strainconsqual: " <<  CON_strainconsqual.size() << endl;
+
+  for(uint32 i=0; i<CON_strainconsqual.size(); ++i){
+    ostr << "\t" << i << " " << CON_strainconsqual[i].size() << endl;
+  }
+
+  ostr << "CON_strainadjustments: " << CON_strainadjustments.size() << endl;
+  for(uint32 i=0; i<CON_strainadjustments.size(); ++i){
+    ostr << "\t" << i << " " << CON_strainadjustments[i].size() << endl;
+  }
+
+  ostr << "CON_readsperstrain: " << CON_readsperstrain.size() << endl;
+  for(uint32 i=0; i<CON_readsperstrain.size(); ++i){
+    ostr << "\t" << i << " " << CON_readpool->getStrainOfStrainID(i) << "\t" << CON_readsperstrain[i] << endl;
+  }
+
+  ostr << "CON_outputorder: " << CON_outputorder.size() << endl
+       << "CON_last_dangerous_overlaps: " << CON_last_dangerous_overlaps.size() << endl
+       << "CON_contains_long_repeats_only: " << CON_contains_long_repeats_only << endl;
+
+}
+
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+
+void Contig::reserveCapacity(uint32 expectedlen, uint32 expectedreads)
+{
+  //CON_counts.reserve(expectedlen);
+  CON_reads.reserve(expectedreads);
+}
+
+
+/*************************************************************************
+ *
  *
  *
  *
@@ -315,7 +382,7 @@ void Contig::definalise()
 {
 //  CON_cheat_intelcons.clear();
 //  CON_cheat_intelconsqual.clear();
-
+  
   CON_allconsseq.clear();
   CON_allconsqual.clear();
   CON_alladjustments.clear();
@@ -342,6 +409,7 @@ void Contig::saveMem()
   //CON_aligncache->discard();
 
   nukeSTLContainer(CON_2tmpcons);
+  nukeSTLContainer(CON_outputorder);
 
   definalise();
 //  nukeSTLContainer(CON_cheat_intelcons);
@@ -354,6 +422,8 @@ void Contig::saveMem()
   nukeSTLContainer(CON_strainconsqual);
   nukeSTLContainer(CON_strainadjustments);
 
+  nukeSTLContainer(CON_maprpids_to_conreadsids);
+
   nukeSTLContainer(CON_allowedrefids);
 
   FUNCEND();
@@ -364,7 +434,7 @@ void Contig::saveMem()
 // Copy constructor
 //  no discard needed as this object will be freshly created when
 //  called through this constructor
-Contig::Contig(Contig const &other) : CON_reads(*(other.CON_readpool))
+Contig::Contig(Contig const &other)
 {
   FUNCSTART("Contig::Contig(Contig const &other)");
 
@@ -391,8 +461,11 @@ Contig const & Contig::operator=(Contig const & other)
   FUNCSTART("Contig const & Contig::operator=(Contig const & other)");
 
   if(this != &other){
+    TRACE("copying\n");
     discard();
 
+    // CON_maprpids_to_conreadsids not copied on purpose
+
     CON_cebugflag=other.CON_cebugflag;
 
     CON_miraparams=other.CON_miraparams;
@@ -410,6 +483,8 @@ Contig const & Contig::operator=(Contig const & other)
 
     CON_targetcoverageperst=other.CON_targetcoverageperst;
 
+    CON_maprpids_to_conreadsids.clear();
+
     CON_2tmpcons=other.CON_2tmpcons;
 
     CON_tmpcons_from_backbone=other.CON_tmpcons_from_backbone;
@@ -424,30 +499,17 @@ Contig const & Contig::operator=(Contig const & other)
     for(uint32 i=0; i<NUMMERGESEQTYPES; i++){
       CON_nummergedreads_perseqtype[i]=other.CON_nummergedreads_perseqtype[i];
     }
-
-    CON_longestreadseen=other.CON_longestreadseen;
-    CON_longestrailseen=other.CON_longestrailseen;
-    CON_longestnonbbreadseen=other.CON_longestnonbbreadseen;
-
-    CON_isbackbonecontig=other.CON_isbackbonecontig;
-
-    CON_readsperstrain=other.CON_readsperstrain;
-    CON_readsperreadgroup=other.CON_readsperreadgroup;
-
-    CON_markerpositions=other.CON_markerpositions;
-    CON_mpindex_msrkceu_left=other.CON_mpindex_msrkceu_left;
-    CON_mpindex_msrkceu_right=other.CON_mpindex_msrkceu_right;
+    
+    CON_index_leftestbbread=other.CON_index_leftestbbread;
+    CON_index_rightestbbread=other.CON_index_rightestbbread;
 
     CON_fixedconsseq=other.CON_fixedconsseq;
     CON_fixedconsqual=other.CON_fixedconsqual;
 
-    //
+    // 
     CON_conscalc_mincov=other.CON_conscalc_mincov;
     CON_conscalc_minqual=other.CON_conscalc_minqual;
     CON_conscalc_missingchar=other.CON_conscalc_missingchar;
-    CON_conscalc_assumediploid=other.CON_conscalc_assumediploid;
-    CON_conscalc_allowiupac=other.CON_conscalc_allowiupac;
-    CON_conscalc_addconstag=other.CON_conscalc_addconstag;
     CON_allconsseq=other.CON_allconsseq;
     CON_allconsqual=other.CON_allconsqual;
     CON_alladjustments=other.CON_alladjustments;
@@ -455,18 +517,31 @@ Contig const & Contig::operator=(Contig const & other)
     CON_strainconsqual=other.CON_strainconsqual;
     CON_strainadjustments=other.CON_strainadjustments;
 
+    //// TODO: phase out this block
+    //CON_cheat_intelcons=other.CON_cheat_intelcons;
+    //CON_cheat_intelconsqual=other.CON_cheat_intelconsqual;
+    //CON_cheat_intelcons_markspecials=other.CON_cheat_intelcons_markspecials;
+    //CON_cheat_intelcons_mincov=other.CON_cheat_intelcons_mincov;
+    //CON_cheat_intelcons_minqual=other.CON_cheat_intelcons_minqual;
+    //CON_cheat_intelcons_strainidtotake=other.CON_cheat_intelcons_strainidtotake;
+
+
     CON_allconsseq=other.CON_allconsseq;
     CON_allconsqual=other.CON_allconsqual;
     CON_strainconsseq=other.CON_strainconsseq;
     CON_strainconsqual=other.CON_strainconsqual;
+    CON_readsperstrain=other.CON_readsperstrain;
 
+
+    CON_outputorder=other.CON_outputorder;
     CON_last_dangerous_overlaps=other.CON_last_dangerous_overlaps;
 
     CON_contains_long_repeats_only=other.CON_contains_long_repeats_only;
-    CON_contains_majority_digitallynormalised_reads=other.CON_contains_majority_digitallynormalised_reads;
 
     CON_stats=other.CON_stats;
 
+    CON_valid=other.CON_valid;
+
   }
 
   FUNCEND();
@@ -500,10 +575,25 @@ int32 Contig::paddedPos2UnpaddedPos(uint32 padpos)
 {
   FUNCSTART("int32 Contig::paddedPos2UnpaddedPos(uint32 padpos)");
 
+  BUGIFTHROW(CON_alladjustments.empty(),"CON_alladjustments.empty()?");
+
   ensureConsensus(-1);
 
-  BUGIFTHROW(CON_alladjustments.empty(),"CON_alladjustments.empty()?");
+//  if( CON_finalised == false || CON_adjustments.size()!=CON_counts.size()){
+//    finalise();
+//    makeIntelligentConsensus(CON_cheat_intelcons,
+//			     CON_cheat_intelconsqual,
+//			     0,
+//			     CON_counts.size(),
+//			     false,
+//			     0,
+//			     0,
+//			     -1,
+//			     '@',
+//			     NULL);
+//  }
 
+  BUGIFTHROW(CON_alladjustments.empty(),"CON_alladjustments.empty()?");
   if(padpos>=CON_alladjustments.size()) padpos=CON_alladjustments.size()-1;
 
   FUNCEND();
@@ -513,78 +603,269 @@ int32 Contig::paddedPos2UnpaddedPos(uint32 padpos)
 
 
 
-
 /*************************************************************************
  *
- * builds a vector which shows at which positions in the consensus there
- *  are reads that have a given tag
- *
- *   .........TTTTTTTT..................
- *      ...........TTTTTTT.................  <- reads
- *
- *   00000000011111111111100000000000000000  <- maskshadow
  *
- * returns true if anything set, else false.
  *
- * 24.06.2012 Had newMarkPossibleRepeats() routine once dump
- *  Marking possibly misassembled repeats: tcmalloc: large alloc 0 bytes == (nil) @
- *  Ouch, out of memory detected.
- * on me. Almost impossible, additional checks inserted.
  *
  *************************************************************************/
 
+//#define CEBUG(bla) {if(CON_cebugflag) cout << bla;} 
 
-bool Contig::buildMaskShadow(vector <int8> & maskshadow, vector<multitag_t::mte_id_t> & masktagstrings, bool onlybackbone)
+
+// new ... calculate main consensus and cache it
+// consensus for strains: moved as "on-demand" calulation to getConsensus()
+
+//#define CEBUG(bla) {cout << bla;} 
+void Contig::calcConsensi(int32 mincoverage, base_quality_t minqual, char missingcoveragechar)
 {
-  FUNCSTART("void Contig::buildMaskShadow(vector <int8> & maskshadow, vector<string> & masktagstrings)");
 
-  bool retvalue=false;
+  FUNCSTART("void Contig::calcConsensi(int32 mincoverage, base_quality_t minqual, char missingcoveragechar)");
+
+  //CON_cebugflag=true;
+
+  CEBUG("calcConsensi(). mincov: " << mincoverage << "\tminqual: " << static_cast<uint16>(minqual) << "\tmissingcchar: " << missingcoveragechar << endl);
+
+  // loading from different files (backbones reads etc) make the number of strain change over time
+  // i.e., contigs loaded earlier may have a smaller CON_readsperstrain.size() than is good
+  if(CON_readsperstrain.size() < CON_readpool->getNumOfStrainInReadpool()){
+    CON_readsperstrain.resize(CON_readpool->getNumOfStrainInReadpool(),0);
+  }
+
+  CEBUG("Rebuild for " << CON_readsperstrain.size() << " strain in readpool\n");
+
+  if(CON_conscalc_mincov!=mincoverage
+     || CON_conscalc_minqual!=minqual
+     || CON_conscalc_missingchar!=missingcoveragechar
+     || CON_strainconsseq.size()==0
+     || CON_readsperstrain.size() >= CON_strainconsseq.size()){
+
+    CEBUG("need recalc. old values: " << CON_conscalc_mincov << " " << static_cast<uint16>(CON_conscalc_minqual) << " " << CON_conscalc_missingchar << endl);
+
+    CON_conscalc_mincov=mincoverage;
+    CON_conscalc_minqual=minqual;
+    CON_conscalc_missingchar=missingcoveragechar;
+
+    // make a common consensus for all strains
+    // cache them in CON_allconsseq and *qual
+    makeIntelligentConsensus(CON_allconsseq,
+			     CON_allconsqual,
+			     &CON_alladjustments,
+			     NULL,
+			     0,
+			     CON_counts.size(),
+			     0,
+			     0,
+			     -1,
+			     missingcoveragechar);
+    
+    CEBUG("CON_readsperstrain.size(): " << CON_readsperstrain.size() << endl);
+
+    CON_strainconsseq.clear();
+    CON_strainconsqual.clear();
+    CON_strainadjustments.clear();
+    CON_strainconsseq.resize(CON_readsperstrain.size());
+    CON_strainconsqual.resize(CON_readsperstrain.size());
+    CON_strainadjustments.resize(CON_readsperstrain.size());
+
+    uint32 numstrains=0;
+    for(uint32 si=0; si<CON_readsperstrain.size(); si++){
+      if(CON_readsperstrain[si]>0) numstrains++;
+    }
+    
+    // now for all strains.
+    // strains not present in contig will have sequence, quality and adjustments 
+    //  pre-filled with default values (@, 0 and -1)
+    // strains present will have empty seq+qual+adj ... to be claulated on demand
+
+    // Change: no precalculated strains, only pre-filled for clear cases!
+    // Should getConsensus() ask for them later, they
+    //  will be calculated on demand (using CON_conscalc_* values)
+    for(uint32 si=0; si<CON_readsperstrain.size(); si++){
+      if(CON_readsperstrain[si]==0) {
+	CON_strainconsseq[si].resize(CON_allconsseq.size(),'@');
+	CON_strainconsqual[si].resize(CON_allconsqual.size(),0);
+	CON_strainadjustments[si].resize(CON_allconsqual.size(),-1);
+      }else{
+	if(numstrains==1 && mincoverage==0 && minqual==0){
+	  // take over from allstrains in this very special case
+	  CON_strainconsseq[si]=CON_allconsseq;
+	  CON_strainconsqual[si]=CON_allconsqual;
+	  CON_strainadjustments[si]=CON_alladjustments;
+	}
+      }
+    }
+  }else{
+  }
 
-  //cout << "MASK #############" << endl;
+  FUNCEND();
 
-  BUGIFTHROW(CON_counts.size()==0,"CON_counts.size()==0 ???");
+  return;
+}  
+//#define CEBUG(bla)
 
-  maskshadow.clear();
-  maskshadow.resize(CON_counts.size(),0);
-  auto pcrI=CON_reads.begin();
-  for( ; pcrI!=CON_reads.end(); ++pcrI) {
-    if(onlybackbone && !pcrI->isBackbone()) continue;
-    const Read & actread = *pcrI;
-    for(uint32 tagnum=0; tagnum<actread.getNumOfTags(); tagnum++) {
-      const multitag_t & acttag=actread.getTag(tagnum);
-      vector<multitag_t::mte_id_t>::const_iterator I= masktagstrings.begin();
-      for( ; I!=masktagstrings.end(); I++) {
-	if(acttag.identifier == *I) {
-	  // ok, this tag is one of those we search
-	  // get the consensusposition from the read tag positions
-	  //  (may be outside of bounds as tags can be in clipped parts!)
-	  int32 cfrom=pcrI.unclippedReadPos2ContigPos(acttag.from);
-	  int32 cto=pcrI.unclippedReadPos2ContigPos(acttag.to);
 
-	  // positions may be reverse, swap then
-	  if(cfrom > cto) swap(cfrom,cto);
+// makes sure consensus and all adjoining structures are calculated and valid
+// works like newConsensusGet() below, but does not return the consensus nor qualities
+//
+// trick: calling newConsensusGet() with the src==target will make sure things are not
+//  unnecessarily copied
+void Contig::ensureConsensus(int32 strainidtotake)
+{
+  FUNCSTART("void Contig::ensureConsensus(int32 strainidtotake)");
 
-	  //cout << actread.getName() << "\t" << acttag.from << "\t" << acttag.to << "\t" << cfrom << "\t" << cto << endl;
+  CEBUG("ensureConsensus(): " << strainidtotake << endl);
+  if(CON_allconsseq.empty() || CON_strainconsseq.empty()){
+    CEBUG("ensureConsensus(): cons empty, need recalc" << endl);
+    calcConsensi();
+  }
+  if(strainidtotake<0){
+    newConsensusGet(CON_allconsseq, CON_allconsqual, strainidtotake);
+  }else{
+    newConsensusGet(CON_strainconsseq[strainidtotake], CON_strainconsqual[strainidtotake], strainidtotake);
+  }
+  FUNCEND();
+}
 
-	  // if both positions are left, right out of bounds, next tag
-	  if(cfrom <0 && cto<0) continue;
-	  if(cfrom >= CON_counts.size() && cto>=CON_counts.size()) continue;
-	  // those positions ot of bounds -> set to bounds
-	  if(cfrom < 0) cfrom=0;
-	  if(cto >= CON_counts.size()) cto=CON_counts.size()-1;
-	  // Tag from .. to are INCLUDING!
-	  for(int32 i=cfrom; i<=cto; ++i) {
-	    maskshadow[i]=1;
-	    retvalue=true;
-	  }
+void Contig::newConsensusGet(string & target, vector<base_quality_t> & qual, int32 strainidtotake)
+{
+  FUNCSTART("void Contig::newConsensusGet(string & target, vector<base_quality_t> & qual, int32 strainidtotake)");
+
+//  if(CON_abortflag) {
+//    uint16 * bombme=NULL;
+//    *bombme=0xdead;
+//    cout << bombme;
+//  }
+
+  CEBUG("newConsensusGet(): gimme strain " << strainidtotake << endl);
+
+  // loading from different files (backbones reads etc) make the number of strain change over time
+  // i.e., contigs loaded earlier may have a smaller CON_readsperstrain.size() than is good
+  if(CON_readsperstrain.size() < CON_readpool->getNumOfStrainInReadpool()){
+    CON_readsperstrain.resize(CON_readpool->getNumOfStrainInReadpool(),0);
+  }
+  //BUGIFTHROW(CON_readsperstrain.size() < CON_readpool->getNumOfStrainInReadpool(), "CON_readsperstrain.size() (" << CON_readsperstrain.size() << ") < CON_readpool->getNumOfStrainInReadpool() (" << CON_readpool->getNumOfStrainInReadpool() << ") ?");
+
+  BUGIFTHROW(strainidtotake>=static_cast<int32>(CON_readsperstrain.size()),"strainidtotake>=CON_readsperstrain.size() ?");
+
+  if(CON_fixedconsseq.size() && CON_fixedconsqual.size() && strainidtotake<0){
+    CEBUG("newConsensusGet(): get fixed" << endl);
+    target=CON_fixedconsseq;
+    qual=CON_fixedconsqual;
+  }else{
+    CEBUG("CON_allconsseq.size(): " << CON_allconsseq.size() << endl);
+    CEBUG("CON_strainconsseq.size(): " << CON_strainconsseq.size() << endl);
+    if(CON_allconsseq.empty() || CON_strainconsseq.empty()
+       || (strainidtotake>=0 && strainidtotake>=CON_strainconsseq.size())){
+      CEBUG("something's empty, need recalc" << endl);
+      calcConsensi();
+    }
+    if(strainidtotake<0){
+      CEBUG("newConsensusGet(): get allcons" << endl);
+      CEBUG("CON_allconsseq.size(): " << CON_allconsseq.size() << endl);
+      CEBUG("CON_allconsqual.size(): " << CON_allconsqual.size() << endl);
+      target=CON_allconsseq;
+      qual=CON_allconsqual;
+    }else{
+      CEBUG("newConsensusGet(): get strain " << strainidtotake << endl);
+      BUGIFTHROW(strainidtotake>=CON_strainconsseq.size(),"something's utterly wrong: strainidtotake>=CON_strainconsseq.size() ???");
+      // on demand calculation
+      if(CON_strainconsseq[strainidtotake].empty()){
+	CEBUG("check on demand calculation\n");
+	uint32 numstrains=0;
+	for(uint32 si=0; si<CON_readsperstrain.size(); si++){
+	  if(CON_readsperstrain[si]>0) numstrains++;
 	}
+	if(numstrains==1){
+	  CEBUG("only 1 strain, can take main consensus\n");
+	  CON_strainconsseq[strainidtotake]=CON_allconsseq;
+	  CON_strainconsqual[strainidtotake]=CON_allconsqual;
+	  CON_strainadjustments[strainidtotake]=CON_alladjustments;
+	}else{
+	  CEBUG("must do calculation\n");
+	  makeIntelligentConsensus(CON_strainconsseq[strainidtotake],
+				   CON_strainconsqual[strainidtotake],
+				   &CON_strainadjustments[strainidtotake],
+				   NULL,
+				   0,
+				   CON_counts.size(),
+				   CON_conscalc_mincov,
+				   CON_conscalc_minqual,
+				   strainidtotake,
+				   CON_conscalc_missingchar);
+	}
+      }else{
+	CEBUG("take cached\n");
       }
+      target=CON_strainconsseq[strainidtotake];
+      qual=CON_strainconsqual[strainidtotake];
     }
   }
 
   FUNCEND();
-  return retvalue;
 }
+//#define CEBUG(bla)
+
+
+//void Contig::OLDgetConsensus1(string & target, vector<base_quality_t> & qual, bool markspecials, int32 mincoverage, base_quality_t minqual, int32 strainidtotake, char missingcoveragechar, ostream * ostr, bool contagsintcs)
+//{
+//  FUNCSTART("void Contig::getConsensus(string & target, vector<base_quality_t> & qual, bool markspecials, int32 mincoverage, int32 strainidtotake, ostream * ostr, bool contagsintcs)");
+//
+//  CEBUG("getCons()\n");
+//
+//  CON_cebugflag=true;
+//
+//  if(CON_cheat_intelcons.empty() 
+//     || CON_cheat_intelcons_markspecials!=markspecials 
+//     || CON_cheat_intelcons_mincov!=mincoverage
+//     || CON_cheat_intelcons_minqual!=minqual
+//     || CON_cheat_intelcons_strainidtotake!=strainidtotake
+//     || ostr != NULL) {
+//    bool mustcompute=true;
+//    if(!CON_cheat_intelcons.empty() 
+//       && CON_cheat_intelcons_mincov==mincoverage
+//       && CON_cheat_intelcons_minqual==minqual
+//       && CON_cheat_intelcons_strainidtotake == strainidtotake) {
+//      if(markspecials) {
+//	if(CON_cheat_intelcons_markspecials) {
+//	  mustcompute=false;
+//	}
+//      } else {
+//	mustcompute=false;
+//	if(CON_cheat_intelcons_markspecials) {
+//	  // just make the sequence make uppercase
+//	  for(uint32 i=0; i<CON_cheat_intelcons.size(); i++) {
+//	    CON_cheat_intelcons[i]=toupper(CON_cheat_intelcons[i]);
+//	  }
+//	} 
+//      }
+//    } 
+//    if(mustcompute || ostr != NULL) {
+//      makeIntelligentConsensus(CON_cheat_intelcons,
+//			       CON_cheat_intelconsqual,
+//			       0,
+//			       CON_counts.size(),
+//			       markspecials,
+//			       mincoverage,
+//			       minqual,
+//			       strainidtotake,
+//			       missingcoveragechar,
+//			       ostr,
+//			       contagsintcs);
+//    }
+//    CON_cheat_intelcons_markspecials=markspecials;
+//    CON_cheat_intelcons_mincov=mincoverage;
+//    CON_cheat_intelcons_minqual=minqual;
+//    CON_cheat_intelcons_strainidtotake=strainidtotake;
+//  }
+//
+//  target=CON_cheat_intelcons;
+//  qual=CON_cheat_intelconsqual;
+//
+//  FUNCEND();
+//
+//  return;
+//}  
 
 
 
@@ -593,21 +874,38 @@ bool Contig::buildMaskShadow(vector <int8> & maskshadow, vector<multitag_t::mte_
 
 /*************************************************************************
  *
+ * if the routines to decide for a base (helper2 routines) could not get 
+ *  clear base but the user wants one, this is doing a shootout based on
+ *  majority vote.
  *
+ * groups with forward and reverse count double in the read count
  *
+ * if majority vote still does not work (all the same), then the last
+ *  one wins. I.e., * takes precedence over T, this over G, over C, over A
  *
  *************************************************************************/
 
-void Contig::zeroStats()
+void Contig::makeIntelligentConsensus_helper3(char & thisbase, base_quality_t & thisqual, const vector<nngroups_t> & groups, const vector<char> & IUPACbasegroups)
 {
-  CON_stats=constats_t();
-
-  for(uint32 i=0; i<ReadGroupLib::SEQTYPE_END; ++i){
-    CON_stats.readsperst[i]=0;
-    CON_stats.totalbasesperst[i]=0;
-    CON_stats.max_covperst[i]=0;
-    CON_stats.avg_covperst[i]=0.0;
+  uint32 maxcount=0;
+
+  for(uint32 actgroup=0; actgroup<groups.size(); actgroup++){
+    for(uint32 actbase=0; actbase<IUPACbasegroups.size(); actbase++){
+      if(IUPACbasegroups[actbase]==groups[actgroup].base){
+	uint32 groupcount=groups[actgroup].ids.size();
+	if(groups[actgroup].forwarddircounter>0
+	   && groups[actgroup].complementdircounter>0){
+	  groupcount*=2;
+	}
+	if(groupcount>=maxcount){
+	  maxcount=groupcount;
+	  thisbase=groups[actgroup].base;
+	  thisqual=groups[actgroup].groupquality;
+	}
+      }
+    }
   }
+
 }
 
 
@@ -617,66 +915,2447 @@ void Contig::zeroStats()
  *
  *
  *************************************************************************/
+//#define FUNCSTART(bla)  static const char * THISFUNC = bla"  "; {cout << "enter " << THISFUNC << "\n"; cout.flush();}
+//#define FUNCEND() {cout << "exit " << THISFUNC << "\n"; cout.flush();}
 
-void Contig::calcStats()
+
+//#define CEBUG(bla) {cout << bla;} 
+void Contig::makeIntelligentConsensus_helper2_calcSOLEXA(char & thisbase, base_quality_t & thisqual, const uint32 actcontigpos, cccontainer_t::const_iterator ccI, const vector<nngroups_t> & groups, vector<char> & IUPACbasegroups, const base_quality_t maxqual, const uint32 maxcount, int32 strainidtotake)
 {
-  FUNCSTART("void Contig::calcStats()");
+  FUNCSTART("void Contig::makeIntelligentConsensus_helper2_calcSOLEXA(char & thisbase, base_quality_t & thisqual, const uint32 actcontigpos, cccontainer_t::const_iterator ccI, const vector<nngroups_t> & groups, vector<char> & IUPACbasegroups, const base_quality_t maxqual, const uint32 maxcount, int32 strainidtotake)");
+
+  //makeIntelligentConsensus_helper3(thisbase,
+  //				   thisqual,
+  //				   groups,
+  //				   IUPACbasegroups);
+  //return;
+
+  IUPACbasegroups.clear();
+
+
+  // TODO: clarify whether to fill IUPACbasegroups also with merged base??
+
+  bool hasmergedbases=(ccI->backbonechar!='@') & (ccI->bbcounts[0]>0);
+  bool mergedalsogroup=false;
+  bool mergedisvalid=false;
+
+  CEBUG("bbchar: " << ccI->backbonechar << "\tbbcounts: " << ccI->bbcounts[0] << "\tbbbestquals: " << static_cast<uint16>(ccI->bbbestquals[0]) << "\tbbstrains: " << hex << static_cast<uint16>(ccI->bbstrains[0]) << dec << "\tHasmergedb: " << hasmergedbases <<'\n');
+
+  // Ok, check whether the merged bases belong to this strain
+  //  if not, well then no merged bases exist
+  uint8 strainmask=255;
+
+  CEBUG("Strainidtotake: " << strainidtotake << '\n');
+  if(strainidtotake>=0) strainmask=getBBStrainMask(strainidtotake);
+  if(!(ccI->bbstrains[0] & strainmask)) hasmergedbases=false;
+
+  uint32 numgroups=0;
+  base_quality_t lastseengroupqual=0;
+  char lastseenbase='&';
+
+  bool groupschosen[groups.size()];
+
+  // search for excellent groups
+  for(uint32 i=0; i<groups.size(); i++){
+    groupschosen[i]=false;
+    CEBUG("Lookatgroup: " << groups[i] << '\n');
+    if(hasmergedbases && ccI->backbonechar == groups[i].base){
+      if((groups[i].ids.size() + ccI->bbcounts[0]) >= 10
+	 && (ccI->bbbestquals[0] >=35
+	     || (groups[i].groupquality >40
+		 && groups[i].forwarddircounter>0
+		 && groups[i].complementdircounter>0))){
+	// >= 6 solexa reads with qual >=30
+	CEBUG("Excellent1: " << groups[i].base << '\n');
+	numgroups++;
+	groupschosen[i]=true;
+	lastseengroupqual=groups[i].groupquality;
+	lastseenbase=groups[i].base;
+	mergedisvalid=true;
+	if(!groups[i].ids.empty()) mergedalsogroup=true;
+      }
+    }else{
+      // or >=10 normal reads, gqual>=40 and forward/reverse directions
+      //  are at least 25% of all reads
+      if(groups[i].ids.size()>=10
+	 && groups[i].groupquality >=40
+	 && groups[i].forwarddircounter>=groups[i].ids.size()/4
+	 && groups[i].complementdircounter>=groups[i].ids.size()/4) {
+	CEBUG("Excellent2: " << groups[i].base << '\n');
+	numgroups++;
+	groupschosen[i]=true;
+	lastseengroupqual=groups[i].groupquality;
+	lastseenbase=groups[i].base;
+      }
+    }
+  }
+  CEBUG("Numgroups excel: " << numgroups << '\n');
+  CEBUG("Hasmergedbases: " << hasmergedbases << "\tMergedalsogroup: " << mergedalsogroup << '\n');
+
+
+  // search for high groups
+  if(numgroups==0){
+    for(uint32 i=0; i<groups.size(); i++){
+      CEBUG("Lookatgroup: " << groups[i] << '\n');
+      if(hasmergedbases && ccI->backbonechar == groups[i].base){
+	if((groups[i].ids.size() + ccI->bbcounts[0]) >= 6
+	   && (ccI->bbbestquals[0] >=30
+	       || (groups[i].groupquality >=30
+		   && groups[i].forwarddircounter>0
+		   && groups[i].complementdircounter>0))){
+	  // >= 6 solexa reads with qual >=30
+	  CEBUG("High1: " << groups[i].base << '\n');
+	  numgroups++;
+	  groupschosen[i]=true;
+	  lastseengroupqual=groups[i].groupquality;
+	  lastseenbase=groups[i].base;
+	  mergedisvalid=true;
+	  if(!groups[i].ids.empty()) mergedalsogroup=true;
+	}
+      }else{
+	// or >=10 normal reads, gqual>=30 and forward/reverse
+	if(groups[i].ids.size()>=6
+	   && groups[i].groupquality >=30
+	   && groups[i].forwarddircounter>0
+	   && groups[i].complementdircounter>0) {
+	  CEBUG("High2: " << groups[i].base << '\n');
+	  numgroups++;
+	  groupschosen[i]=true;
+	  lastseengroupqual=groups[i].groupquality;
+	  lastseenbase=groups[i].base;
+	}
+      }
+    }
+    CEBUG("Numgroups high: " << numgroups << '\n');
+    CEBUG("Hasmergedbases: " << hasmergedbases << "\tMergedalsogroup: " << mergedalsogroup << '\n');
+  }
+
+  // TODO: insert good. fwd/rev and qual vs non-fwd/rev and qual
+
+  // search for good groups. Same as high, but without mincount
+  if(numgroups==0){
+    for(uint32 i=0; i<groups.size(); i++){
+      CEBUG("Lookatgroup: " << groups[i] << '\n');
+      if(hasmergedbases && ccI->backbonechar == groups[i].base){
+	if(ccI->bbbestquals[0] >=30
+	    || (groups[i].groupquality >=30
+		&& groups[i].forwarddircounter>0
+		&& groups[i].complementdircounter>0)){
+	  // >= 6 solexa reads with qual >=30
+	  CEBUG("Good1: " << groups[i].base << '\n');
+	  numgroups++;
+	  groupschosen[i]=true;
+	  lastseengroupqual=groups[i].groupquality;
+	  lastseenbase=groups[i].base;
+	  mergedisvalid=true;
+	  if(!groups[i].ids.empty()) mergedalsogroup=true;
+	}
+      }else{
+	// or gqual>=30 and forward/reverse
+	if(groups[i].groupquality >=30
+	   && groups[i].forwarddircounter>0
+	   && groups[i].complementdircounter>0) {
+	  CEBUG("Good2: " << groups[i].base << '\n');
+	  numgroups++;
+	  groupschosen[i]=true;
+	  lastseengroupqual=groups[i].groupquality;
+	  lastseenbase=groups[i].base;
+	}
+      }
+    }
+    CEBUG("Numgroups good: " << numgroups << '\n');
+    CEBUG("Hasmergedbases: " << hasmergedbases << "\tMergedalsogroup: " << mergedalsogroup << '\n');
+  }
+
+  // search for medium groups
+  if(numgroups==0){
+    for(uint32 i=0; i<groups.size(); i++){
+      if(!groups[i].ids.empty() && groups[i].groupquality >=30) {
+	numgroups++;
+	groupschosen[i]=true;
+	lastseengroupqual=groups[i].groupquality;
+	lastseenbase=groups[i].base;
+	if(hasmergedbases 
+	   && ccI->backbonechar == groups[i].base
+	   && ccI->bbbestquals[0] >=30) {
+	  mergedisvalid=true;
+	  mergedalsogroup=true;
+	}
+      }else{
+	if(hasmergedbases && ccI->backbonechar == groups[i].base
+	   && ccI->bbbestquals[0] >=30){
+	  mergedisvalid=true;
+	  numgroups++;
+	  groupschosen[i]=true;
+	}
+      }
+    }
+    CEBUG("Numgroups medium: " << numgroups << '\n');
+    CEBUG("Hasmergedbases: " << hasmergedbases << "\tMergedalsogroup: " << mergedalsogroup << '\n');
+  }
+
+  bool badquals=false;
+  if(numgroups==0){
+    // no read in the groups? still might be ... but with bad quals.
+    CEBUG("No group first time, redo without qual.\n");
+
+    for(uint32 i=0; i<groups.size(); i++){
+      if(!groups[i].ids.empty()) {
+	numgroups++;
+	groupschosen[i]=true;
+	lastseengroupqual=groups[i].groupquality;
+	lastseenbase=groups[i].base;
+	if(hasmergedbases 
+	   && ccI->backbonechar == groups[i].base) {
+	  mergedisvalid=true;
+	  mergedalsogroup=true;
+	}
+      }else{
+	if(hasmergedbases && ccI->backbonechar == groups[i].base) {
+	  mergedisvalid=true;
+	  numgroups++;
+	  groupschosen[i]=true;
+	}
+      }
+    }
+    badquals=true;
 
-  if(CON_stats.statsvalid) return;
+    CEBUG("Numgroups: " << numgroups << "\tbadquals: " << badquals << '\n');
+    CEBUG("Hasmergedbases: " << hasmergedbases << "\tMergedalsogroup: " << mergedalsogroup << '\n');
+  }
 
-  zeroStats();
-  finalise();
+  char maxcount_base='%';
+  base_quality_t maxcount_qual=0;
 
-  string consseq;
-  vector<base_quality_t> consqual;
+  if(numgroups==1){
+    // just one group
+    // see whether it is a valid merged base
+    if(hasmergedbases && mergedisvalid) {
+      // if merged, is it also covered by a readgroup?
+      if(mergedalsogroup){
+	// yes
+	thisbase=ccI->backbonechar;
+	thisqual=max(lastseengroupqual, ccI->bbbestquals[0]);
+      }else{
+	// no, only a merged base
+	thisbase=ccI->backbonechar;
+	thisqual=ccI->bbbestquals[0];
+      }
+    }else{
+      // no, it's only one normal read group
+      thisbase=lastseenbase;
+      IUPACbasegroups.push_back(thisbase);
+      thisqual=lastseengroupqual;
+    }
+  } else if(numgroups==0){
+    thisbase='N';
+    thisqual=0;
+  } else {
+    // let the fun begin ... *sigh*
+    // at least two groups were detected, which means any combination of
+    //  normal read groups (1-5) and eventually also a merged base
+    // the groups were either detected all at good qual or all at bad qual
+
+    // first decision taken on counts of bases
+    vector<uint32> counts(groups.size());
+    vector<base_quality_t> quals(groups.size());
+    uint32 maxcounts=0;
+    base_quality_t maxquals=0;      // carefull, this is not maxqual 
+    // from the parameter (rename that)
+    uint32 totalcounts=0;
+    bool hasgapchosen=false;
+
+    for(uint32 i=0; i<groups.size(); i++){
+      counts[i]=groups[i].ids.size();
+      quals[i]=groups[i].groupquality;
+      if(groupschosen[i] && groups[i].base == '*') hasgapchosen=true;
+      if(hasmergedbases
+	 && ccI->backbonechar == groups[i].base) {
+	counts[i]+=ccI->bbcounts[0];
+	quals[i]=max(quals[i],ccI->bbbestquals[0]);
+      }
+      totalcounts+=counts[i];
+      maxcounts=max(maxcounts,counts[i]);
+      maxquals=max(maxquals,quals[i]);
+      if(maxcounts==counts[i]){
+	maxcount_base=groups[i].base;
+	maxcount_qual=quals[i];
+      }
+    }
 
+    CEBUG("Maxcounts: " << maxcounts << "\ttotalcounts: " << totalcounts << '\n');
+
+    thisbase=' ';
+    thisqual=0;
+    uint32 numtaken=0;
+    for(uint32 i=0; i<groups.size(); i++){
+      if(groupschosen[i]){
+	numtaken++;
+	if(thisbase==' ') {
+	  thisbase=groups[i].base;
+	  thisqual=quals[i];
+	}else{
+	  // take different approaches depending on whether user forces
+	  //  a non-IUPAC or not
+	  //  or whether a gap is part of the best groups
+	  if(counts[i] == maxcounts
+	     && (hasgapchosen
+		 || (*CON_miraparams)[Read::SEQTYPE_SOLEXA].getContigParams().con_force_nonIUPACconsensus_perseqtype)) {
+	    thisbase=groups[i].base;
+	    thisqual=quals[i];
+	    numtaken=1;
+	  }else{
+	    thisbase=dptools::calcIUPACConsensus(thisbase, groups[i].base);
+	    thisqual+=quals[i];
+	  }
+	}
+	if(!groups[i].ids.empty()) IUPACbasegroups.push_back(thisbase);
+      }
+    }
+    if(numtaken) thisqual/=numtaken;
+  }
+
+  CEBUG("Settled on: '" << thisbase << "' " << static_cast<uint16>(thisqual) << '\n');
+
+  if(!dptools::isValidACGTStarBase(thisbase)
+     && maxcount_base!='%'
+     && (*CON_miraparams)[Read::SEQTYPE_SOLEXA].getContigParams().con_force_nonIUPACconsensus_perseqtype) {
+    thisbase=maxcount_base;
+    thisqual=maxcount_qual;
+    CEBUG("User forced non-IUPAC per seqtype: '" << thisbase << "' " << static_cast<uint16>(thisqual) << '\n');
+  }
+
+  FUNCEND();
+  return;
+}
+//#define CEBUG(bla)
+
+
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+
+void Contig::makeIntelligentConsensus_helper2_calcPACBIO(char & thisbase, base_quality_t & thisqual, const uint32 actcontigpos, const vector<nngroups_t> & groups, vector<char> & IUPACbasegroups)
+{
+
+  // no info. atm, same as 454 without 40:60 rule
+
+  // Idea: pure coverage, maximum wins.
+  //       if two or more with same maximum: 
+  //          IUPAC (star goes under, sorry) or
+  //          if non-IUPAC is wished, take the last
+  // TODO: is there a better way?
+
+  IUPACbasegroups.clear();
+
+  int32 maxsize=0;
+  int32 maxsize_i=-1;
+  base_quality_t maxqual=0;
+  int32 runnerup=0;
+  int32 runnerup_i=-1;
+  base_quality_t runnerupqual=0;
+
+  size_t totalsize=0;
+
+  for(uint32 i=0; i<groups.size(); i++){
+    totalsize+=groups[i].ids.size();
+    if(static_cast<int32>(groups[i].ids.size())>=maxsize){
+      runnerup=maxsize;
+      runnerup_i=maxsize_i;
+      runnerupqual=maxqual;
+      maxsize=static_cast<int32>(groups[i].ids.size());
+      maxsize_i=i;
+      maxqual=groups[i].groupquality;
+    }else if(static_cast<int32>(groups[i].ids.size())>=runnerup){
+      runnerup=static_cast<int32>(groups[i].ids.size());
+      runnerup_i=i;
+      runnerupqual=groups[i].groupquality;
+    }
+  }
+
+  int32 avgqual=0;
+  for(uint32 i=0; i<groups.size(); i++){
+    if(maxsize==static_cast<int32>(groups[i].ids.size())){
+      IUPACbasegroups.push_back(groups[i].base);
+      avgqual+=groups[i].groupquality;
+    }
+  }
+
+  if(totalsize==0 || IUPACbasegroups.empty()){
+    /// Oooops? just an N???
+    thisbase='N';
+    thisqual=0;
+    return;
+  }
+
+  if(IUPACbasegroups.size()==1) {
+    thisbase=IUPACbasegroups[0];
+    // reduce quality if there are doubts
+    if(runnerup>0 && maxsize-runnerup < 10){
+      avgqual-=runnerupqual;
+      if(avgqual<0) avgqual=max(abs(avgqual),10);
+    }
+    thisqual=static_cast<base_quality_t>(avgqual);
+  }else{
+    if((*CON_miraparams)[Read::SEQTYPE_PACBIO].getContigParams().con_force_nonIUPACconsensus_perseqtype) {
+      thisbase=IUPACbasegroups[IUPACbasegroups.size()-1];
+      thisqual=static_cast<base_quality_t>(avgqual/IUPACbasegroups.size());
+    }else{
+      thisbase=dptools::calcIUPACConsensus(IUPACbasegroups);
+      thisqual=static_cast<base_quality_t>(avgqual/IUPACbasegroups.size());
+    }
+  }
+
+  return;
+}
+
+
+
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+
+void Contig::makeIntelligentConsensus_helper2_calc454GS20(char & thisbase, base_quality_t & thisqual, const uint32 actcontigpos, const vector<nngroups_t> & groups, vector<char> & IUPACbasegroups)
+{
+  // Idea: pure coverage, maximum wins.
+  //       if two or more with same maximum: 
+  //          IUPAC (star goes under, sorry) or
+  //          if non-IUPAC is wished, take the last
+  // TODO: is there a better way?
+
+  IUPACbasegroups.clear();
+
+  int32 maxsize=0;
+  int32 maxsize_i=-1;
+  base_quality_t maxqual=0;
+  int32 runnerup=0;
+  int32 runnerup_i=-1;
+  base_quality_t runnerupqual=0;
+
+  size_t totalsize=0;
+
+  for(uint32 i=0; i<groups.size(); i++){
+    totalsize+=groups[i].ids.size();
+    if(static_cast<int32>(groups[i].ids.size())>=maxsize){
+      runnerup=maxsize;
+      runnerup_i=maxsize_i;
+      runnerupqual=maxqual;
+      maxsize=static_cast<int32>(groups[i].ids.size());
+      maxsize_i=i;
+      maxqual=groups[i].groupquality;
+    }else if(static_cast<int32>(groups[i].ids.size())>=runnerup){
+      runnerup=static_cast<int32>(groups[i].ids.size());
+      runnerup_i=i;
+      runnerupqual=groups[i].groupquality;
+    }
+  }
+
+  // if max count is gap, but there are other bases
+  if(maxsize_i==4 && runnerup>0){
+    // apply 40:60 rule
+    if(100*runnerup/(maxsize+runnerup) >= 40){
+      swap(maxsize,runnerup);
+      swap(maxsize_i,runnerup_i);
+      swap(maxqual,runnerupqual);
+    }
+  }
+
+  int32 avgqual=0;
+  for(uint32 i=0; i<groups.size(); i++){
+    if(maxsize==static_cast<int32>(groups[i].ids.size())){
+      IUPACbasegroups.push_back(groups[i].base);
+      avgqual+=groups[i].groupquality;
+    }
+  }
+
+  if(totalsize==0 || IUPACbasegroups.empty()){
+    /// Oooops? just an N???
+    thisbase='N';
+    thisqual=0;
+    return;
+  }
+
+  if(IUPACbasegroups.size()==1) {
+    thisbase=IUPACbasegroups[0];
+    // reduce quality if there are doubts
+    if(runnerup>0 && maxsize-runnerup < 10){
+      avgqual-=runnerupqual;
+      if(avgqual<0) avgqual=max(abs(avgqual),10);
+    }
+    thisqual=static_cast<base_quality_t>(avgqual);
+  }else{
+    if((*CON_miraparams)[Read::SEQTYPE_454GS20].getContigParams().con_force_nonIUPACconsensus_perseqtype) {
+      thisbase=IUPACbasegroups[IUPACbasegroups.size()-1];
+      thisqual=static_cast<base_quality_t>(avgqual/IUPACbasegroups.size());
+    }else{
+      thisbase=dptools::calcIUPACConsensus(IUPACbasegroups);
+      thisqual=static_cast<base_quality_t>(avgqual/IUPACbasegroups.size());
+    }
+  }
+
+  //// TODO: testing
+  //if(maxsize_i>=0 && runnerup_i>=0){
+  //  if(maxsize+runnerup == 0){
+  //    //addTagToConsensus(actcontigpos, actcontigpos,'=',"P454","DOH?");
+  //  }else if(100*runnerup/(maxsize+runnerup) >= 30){
+  //    //ostringstream ostr;
+  //    //ostr << static_cast<char>(groups[maxsize_i].base) << ": " << maxsize;
+  //    //ostr << " " << static_cast<char>(groups[runnerup_i].base) << ": " << runnerup;
+  //    //ostr << "  -  " << 100*runnerup/(maxsize+runnerup) << "%";
+  //    //
+  //    //addTagToConsensus(actcontigpos, actcontigpos,'=',"P454",ostr.str().c_str());
+  //  }
+  //}
+
+  return;
+}
+
+
+
+/*************************************************************************
+ *
+ * atm a pure copy of 454
+ *
+ *
+ *************************************************************************/
+
+void Contig::makeIntelligentConsensus_helper2_calcIonTorrent(char & thisbase, base_quality_t & thisqual, const uint32 actcontigpos, const vector<nngroups_t> & groups, vector<char> & IUPACbasegroups)
+{
+  // Idea: pure coverage, maximum wins.
+  //       if two or more with same maximum: 
+  //          IUPAC (star goes under, sorry) or
+  //          if non-IUPAC is wished, take the last
+  // TODO: is there a better way?
+
+  IUPACbasegroups.clear();
+
+  int32 maxsize=0;
+  int32 maxsize_i=-1;
+  base_quality_t maxqual=0;
+  int32 runnerup=0;
+  int32 runnerup_i=-1;
+  base_quality_t runnerupqual=0;
+
+  size_t totalsize=0;
+
+  for(uint32 i=0; i<groups.size(); i++){
+    totalsize+=groups[i].ids.size();
+    if(static_cast<int32>(groups[i].ids.size())>=maxsize){
+      runnerup=maxsize;
+      runnerup_i=maxsize_i;
+      runnerupqual=maxqual;
+      maxsize=static_cast<int32>(groups[i].ids.size());
+      maxsize_i=i;
+      maxqual=groups[i].groupquality;
+    }else if(static_cast<int32>(groups[i].ids.size())>=runnerup){
+      runnerup=static_cast<int32>(groups[i].ids.size());
+      runnerup_i=i;
+      runnerupqual=groups[i].groupquality;
+    }
+  }
+
+  // if max count is gap, but there are other bases
+  // Test, maybe IonTorrent is a bit different.
+  // Actually, it's almost the best rule there is ...
+  //  35 perhaps better, but needs to be verified.
+  // Astonishing
+  if(maxsize_i==4 && runnerup>0){
+    // apply 40:60 rule
+    if(100*runnerup/(maxsize+runnerup) >= 40){
+      swap(maxsize,runnerup);
+      swap(maxsize_i,runnerup_i);
+      swap(maxqual,runnerupqual);
+    }
+  }
+
+  int32 avgqual=0;
+  for(uint32 i=0; i<groups.size(); i++){
+    if(maxsize==static_cast<int32>(groups[i].ids.size())){
+      IUPACbasegroups.push_back(groups[i].base);
+      avgqual+=groups[i].groupquality;
+    }
+  }
+
+  if(totalsize==0 || IUPACbasegroups.empty()){
+    /// Oooops? just an N???
+    thisbase='N';
+    thisqual=0;
+    return;
+  }
+
+  if(IUPACbasegroups.size()==1) {
+    thisbase=IUPACbasegroups[0];
+    // reduce quality if there are doubts
+    if(runnerup>0 && maxsize-runnerup < 10){
+      avgqual-=runnerupqual;
+      if(avgqual<0) avgqual=max(abs(avgqual),10);
+    }
+    thisqual=static_cast<base_quality_t>(avgqual);
+  }else{
+    if((*CON_miraparams)[Read::SEQTYPE_454GS20].getContigParams().con_force_nonIUPACconsensus_perseqtype) {
+      thisbase=IUPACbasegroups[IUPACbasegroups.size()-1];
+      thisqual=static_cast<base_quality_t>(avgqual/IUPACbasegroups.size());
+    }else{
+      thisbase=dptools::calcIUPACConsensus(IUPACbasegroups);
+      thisqual=static_cast<base_quality_t>(avgqual/IUPACbasegroups.size());
+    }
+  }
+
+  //// TODO: testing
+  //if(maxsize_i>=0 && runnerup_i>=0){
+  //  if(maxsize+runnerup == 0){
+  //    //addTagToConsensus(actcontigpos, actcontigpos,'=',"P454","DOH?");
+  //  }else if(100*runnerup/(maxsize+runnerup) >= 30){
+  //    //ostringstream ostr;
+  //    //ostr << static_cast<char>(groups[maxsize_i].base) << ": " << maxsize;
+  //    //ostr << " " << static_cast<char>(groups[runnerup_i].base) << ": " << runnerup;
+  //    //ostr << "  -  " << 100*runnerup/(maxsize+runnerup) << "%";
+  //    //
+  //    //addTagToConsensus(actcontigpos, actcontigpos,'=',"P454",ostr.str().c_str());
+  //  }
+  //}
+
+  return;
+}
+
+
+
+
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+
+void Contig::makeIntelligentConsensus_helper2_calcSangerQual(char & thisbase, base_quality_t & thisqual, const uint32 actcontigpos, const vector<nngroups_t> & groups, vector<char> & IUPACbasegroups, const vector<char> & columnbases, const base_quality_t maxqual, const uint32 maxcount)
+{
+  // Idea: all groups with qual >= 30
+  //    or groups with qual within (X) (with X==5 now) of maxqual
+  //    or groups with count >= 3 and quality >=20 and forward/reverse
+
+  IUPACbasegroups.clear();
+  int32 avgqual=0;
+  int32 groupstaken=0;
+  int32 verygoodgroups=0;
+
+  // New: if force non-IUPAC consensus is wished
+  // decrease the level with which we look at the groups
+  // gradually until we have to find something (qual == 0)
+  base_quality_t goodgroupqual=35;
+  base_quality_t lessergroupqual=goodgroupqual;
+  if(lessergroupqual>=10) lessergroupqual-=10;
+
+  do{
+    if(goodgroupqual>=5) goodgroupqual-=5;
+    if(lessergroupqual>=5) lessergroupqual-=5;
+    for(uint32 i=0; i<groups.size(); i++){
+      if(groups[i].ids.size() 
+	 &&(groups[i].groupquality >= goodgroupqual
+	    || groups[i].groupquality+5 >= maxqual
+	    || (groups[i].ids.size() >= 3          // TODO: check 2 or 3 (was 3, testing with 2)
+		&& groups[i].groupquality >= lessergroupqual
+		&& groups[i].forwarddircounter>0
+		&& groups[i].complementdircounter>0))) {
+	avgqual+=groups[i].groupquality;
+	IUPACbasegroups.push_back(groups[i].base);
+	groupstaken++;
+	
+	if(groups[i].groupquality >= goodgroupqual
+	   && groups[i].forwarddircounter>0
+	   && groups[i].complementdircounter>0) {
+	  verygoodgroups++;
+	}
+      }
+    }
+  } while((*CON_miraparams)[Read::SEQTYPE_SANGER].getContigParams().con_force_nonIUPACconsensus_perseqtype
+	  && groupstaken==0 && goodgroupqual>0);
+  
+  CEBUG("groups taken: " << groupstaken << "\t");
+#ifdef CEBUGFLAG
+  {
+    for(uint32 i=0; i< IUPACbasegroups.size(); i++){
+      CEBUG(IUPACbasegroups[i]);
+    }
+  }
+#endif
+  CEBUG(endl);
+  if(groupstaken == 0) {
+    // this can still happen if we do not force a non-IUPAC
+    // or if it's a column entirely made of N (or X) (or both)
+
+    // well, calculate the base from all columnbases
+    thisbase=dptools::calcIUPACConsensus(columnbases);
+    avgqual=0;
+    int32 n=0;
+    uint32 totalids=0;
+    for(uint32 i=0; i<groups.size()-1; i++){
+      if(groups[i].ids.size()) {
+	totalids+=groups[i].ids.size();
+	avgqual+=groups[i].groupquality;
+	n++;
+      }
+    }
+    // test if there are more stars than other bases
+    if(groups[groups.size()-1].ids.size() > totalids) {
+      // oh well, more stars than bases, make it a star
+      thisbase='*';
+      thisqual=groups[groups.size()-1].groupquality;
+    } else if(n) {
+      thisqual=avgqual/n;
+    } else {
+      thisqual=0;
+    }
+  } else if(groupstaken == 1) {
+    // only one group taken (perfect)
+    thisbase=IUPACbasegroups.front();
+    int32 bahqual=maxqual;
+    for(uint32 i=0; i<groups.size(); i++){
+      if(groups[i].base!=thisbase) {
+	bahqual-=groups[i].groupquality;
+      }
+    }
+    if(bahqual<0) bahqual=0;
+    thisqual=bahqual;
+  } else {
+    // ouch, more than one group was taken as good
+
+    bool needIUPACconsensus=true;
+
+    CEBUG("cpos: " << actcontigpos << "\tpossible IUPAC\tvgg: " << verygoodgroups << endl);
+    //for(uint32 i=0; i< groups.size(); i++){
+    //  cout << groups[i] << endl;
+    //}
+
+    // First, check whether we have a very good group
+    //  as searched for above
+    if(verygoodgroups==1){
+      // if yes, rebuild IUPACbasegroups with very good groups
+      // then, if only one group remains, perfect. Else it'll be
+      //  a IUPAC
+
+      CEBUG("recheck group: ");
+
+      vector<char> newIUPACbasegroups;
+      int32 newavgqual=0;
+      int32 newgroupstaken=0;
+      for(uint32 i=0; i<groups.size(); i++){
+	if(groups[i].ids.size() 
+	   && (groups[i].groupquality >= goodgroupqual
+	       && groups[i].forwarddircounter>0
+	       && groups[i].complementdircounter>0)){
+	  newavgqual+=groups[i].groupquality;
+	  newIUPACbasegroups.push_back(groups[i].base);
+	  newgroupstaken++;
+	}
+      }
+      
+      if(newgroupstaken == 1) {
+	CEBUG("success!");
+	needIUPACconsensus=false;
+
+	IUPACbasegroups=newIUPACbasegroups;
+	avgqual=newavgqual;
+	groupstaken=newgroupstaken;
+
+	// only one group taken (perfect)
+	thisbase=IUPACbasegroups.front();
+	int32 bahqual=maxqual;
+	for(uint32 i=0; i<groups.size(); i++){
+	  if(groups[i].base!=thisbase) {
+	    bahqual-=groups[i].groupquality;
+	  }
+	}
+	if(bahqual<0) bahqual=0;
+	thisqual=bahqual;
+      }
+    }
+    CEBUG(endl);
+
+    if(needIUPACconsensus){
+      if((*CON_miraparams)[Read::SEQTYPE_SANGER].getContigParams().con_force_nonIUPACconsensus_perseqtype){
+	// well, can't get a good decision, but user wants a non-IUPAC
+	// make a majority-vote shootout among the chosen
+	//   groups
+	makeIntelligentConsensus_helper3(thisbase,
+					 thisqual,
+					 groups,
+					 IUPACbasegroups);
+      }else{
+	// we'll have to make 
+	//  a IUPAC consensus here. Alas, if a star (*) is part of this group,
+	//  it will 'go under' (the good bases always win). So check if the star
+	//  has max quality.
+	bool isstar=false;
+	if(groups[groups.size()-1].groupquality == maxqual) {
+	  // yep, now check if one of the bases has the same qual
+	  isstar=true;
+	  for(uint32 i=0; i<groups.size()-1; i++){
+	    if(groups[i].groupquality == maxqual) {
+	      // in dubio pro reo: it could be a base 
+	      isstar=false;
+	    }
+	  }
+	}
+	CEBUG("isstar: " << isstar << endl);
+	if(isstar) {
+	  thisbase='*';
+	  thisqual=groups[groups.size()-1].groupquality;
+	} else {
+	  // really several different good bases.
+	  thisqual=avgqual/groupstaken;
+	  thisbase=dptools::calcIUPACConsensus(IUPACbasegroups);
+	}
+      }
+    }
+  }
+}
+
+
+
+/*************************************************************************
+ *
+ * For a given readtype, return thisbase and thisqual as result for this
+ *  position in the contig
+ * Also return the potential number of solutions (bases), the one which
+ *  was chosen plus the ones which were not
+ *
+ * all other arguments are passovers from the main function (saving STL
+ *  setup and memory allocation time)
+ *
+ * Side effects: manifold. Most notably: all the passovers from the
+ *  main function which are not const will be overwritten with values
+ *  reflecting the calculation of base and quality of this read type
+ *
+ * E.g.: the bases that were considered to make the consensus are in 
+ *  IUPACbasegroups, the base-groups in groups etc.
+ *
+ *************************************************************************/
+
+//#define CEBUG(bla) {cout << bla;} 
+
+void Contig::makeIntelligentConsensus_helper1(char & thisbase, base_quality_t & thisqual, const uint32 actcontigpos, cccontainer_t::const_iterator ccI, const int32 mincoverage, vector<nngroups_t> & groups, vector<nngroups_t> & maskedshadowgroups, vector<char> & IUPACbasegroups, vector<char> & columnbases, const vector<int32> & read_ids_in_col, vector<int8> & maskshadow, uint8 actreadtype, int32 strainidtotake, char missingcoveragechar)
+{
+  FUNCSTART("void Contig::makeIntelligentConsensus_helper1(char & thisbase, base_quality_t & thisqual, const uint32 actcontigpos, cccontainer_t::const_iterator ccI, const int32 mincoverage, vector<nngroups_t> & groups, vector<nngroups_t> & maskedshadowgroups, vector<char> & IUPACbasegroups, vector<char> & columnbases, const vector<int32> & read_ids_in_col, vector<int8> & maskshadow, uint8 actreadtype, char missingcoveragechar)");
+
+#if 0
+  if(read_ids_in_col.empty()){
+    thisbase='!';
+    FUNCEND();
+    return;
+  }
+  if(CON_counts[actcontigpos].total_cov < mincoverage){
+    thisbase='N';
+    FUNCEND();
+    return;
+  }
+
+#else
+
+  size_t nummapped=0;
+  if(actreadtype == Read::SEQTYPE_SOLEXA){
+    // Ok, check whether the merged bases belong to this strain
+    //  if not, well then no merged bases exist
+    if(ccI->bbcounts[0]){
+      uint8 strainmask=255;
+      if(strainidtotake>=0) strainmask=getBBStrainMask(strainidtotake);
+      if(ccI->bbstrains[0] & strainmask){
+	nummapped=ccI->bbcounts[0];
+//      cout << "looked at: " << *ccI << endl
+//	   << "nummapped: " << nummapped << endl;
+	//nummapped=0;
+      }
+    }
+  }
+  if(read_ids_in_col.size()+nummapped == 0){
+    thisbase='!';
+    FUNCEND();
+    return;
+  }
+  if(read_ids_in_col.size()+nummapped < mincoverage){
+    thisbase='N';
+    FUNCEND();
+    return;
+  }
+#endif
+
+  const contig_parameters & con_rt_params = (*CON_miraparams)[actreadtype].getContigParams();
+
+  CEBUG("conpos: " << actcontigpos << "\tnumreads: " << read_ids_in_col.size() << endl);
+  columnbases.clear();
+    
+  /* 
+     slowwwwwwwwwwwwwwwwwwwwwww
+       
+     on a 170MB CAF file, caf2fasta goes from 1:46 to 1:40 when
+     replacing these two lines with the loop below (from 49s for
+     output down to 43s)
+
+     groups=emptygroups;
+     maskedshadowgroups=emptygroups;
+       
+  */
+    
+  for(uint32 groupi=0; groupi < groups.size(); groupi++){
+    groups[groupi].groupquality=0;
+    groups[groupi].valid=false;
+    groups[groupi].forwarddircounter=0;
+    groups[groupi].complementdircounter=0;
+    groups[groupi].ids.clear();
+    groups[groupi].quals.clear();
+    groups[groupi].directions.clear();
+    //groups[groupi].strainids.clear();
+    //groups[groupi].ids_sorted.clear();
+    //groups[groupi].uniqstrainids.clear();
+    //groups[groupi].countstrainids.clear();
+      
+    maskedshadowgroups[groupi].groupquality=0;
+    maskedshadowgroups[groupi].valid=false;
+    maskedshadowgroups[groupi].forwarddircounter=0;
+    maskedshadowgroups[groupi].complementdircounter=0;
+    maskedshadowgroups[groupi].ids.clear();
+    maskedshadowgroups[groupi].quals.clear();
+    maskedshadowgroups[groupi].directions.clear();
+    //maskedshadowgroups[groupi].strainids.clear();
+    //maskedshadowgroups[groupi].ids_sorted.clear();
+    //maskedshadowgroups[groupi].uniqstrainids.clear();
+    //maskedshadowgroups[groupi].countstrainids.clear();
+  }
+    
+    
+  bool xonly=true;
+
+  if(nummapped>0 && ccI->backbonechar != 'X') xonly=false;
+
+  for(int32 readnr=0; static_cast<int32>(readnr<read_ids_in_col.size()); readnr++){
+    char           base;
+    base_quality_t qual;
+    int32          actreadid=read_ids_in_col[readnr];
+    contigread_t & ric =CON_reads[actreadid];
+
+    //if(ric.read.isShortReadMapping()) continue;
+    
+    int32 readpos=contigPosToUnclippedReadPos(actcontigpos, ric);
+      
+    CEBUG("read: " << ric.read.getName());
+      
+    //if(actcontigpos==682){
+    //  int32 lenit=ric.read.getLenClippedSeq();
+    //  cout << ric.read.getName() << "\t" << ric.offset << "\t"  << readpos << endl;
+    //  //if(readnr==49) cout << ric.read << endl;
+    //  if(lenit != ric.read.getLenClippedSeq()) {
+    //    cout << "newlen??? " << ric.read.getLenClippedSeq();
+    //    exit(0);
+    //  }
+    //}
+      
+    int32 realreadpos;
+    if(ric.direction>0){
+      base=toupper(ric.read.getBaseInSequence(readpos));
+      qual=ric.read.getQualityInSequence(readpos);
+      realreadpos=readpos;
+    }else{
+      base=toupper(ric.read.getBaseInComplementSequence(readpos));
+      qual=ric.read.getQualityInComplementSequence(readpos);
+      realreadpos=ric.read.calcComplPos(readpos);
+    }
+      
+    columnbases.push_back(base);
+      
+    // this one gives a problem 
+    //   if(base != 'X' && base != '*') xonly=false;
+    // when one retrieves the consensus of a single strain in multiple
+    //  strain assemblies: it may well be only a star!
+    // preliminary fix: back to checking of X only
+      
+    if(base != 'X') xonly=false;
+      
+    CEBUG("\t" << base << "\t" << (uint16) qual << endl);
+      
+    // bases near start/end of reads might be dangerous because 
+    //  of possible vector leftovers or still bad quality
+    // so, if there is more than one read in this column, 
+    // ...
+    // - if within 10 bases of vector clip, max quality = 2*distance to svec 
+    // - if not, lower the quality values of the bases that are near ends
+    //   (con_endreadmarkexclusionarea bases) of (eventually clipped) reads
+    // must be regular read (i.e. not backbone, rail or shortreadmapping
+
+    if(!ric.read.isRail()
+       && !ric.read.isBackbone()
+       && !ric.read.isCoverageEquivalentRead()){
+      if(read_ids_in_col.size() >1) {
+	if((ric.read.getLSClipoff() >0
+	    && realreadpos < ric.read.getLSClipoff()+10)
+	   || (ric.read.getRSClipoff() < ric.read.getLenSeq()
+	       && realreadpos > ric.read.getRSClipoff()-10)){
+	  CEBUG(ric.read.getName()<< ": near seq vec in read, lowering the quality.\n");
+	  int32 distance;
+	  if(realreadpos < ric.read.getLSClipoff()+10){
+	    distance=realreadpos-ric.read.getLSClipoff();
+	  }else{
+	    distance=ric.read.getRSClipoff()-realreadpos;
+	  }
+	  if(qual > distance*2){
+	    qual=distance*2;
+	  }
+	} else if(realreadpos <= ric.read.getLeftClipoff()+con_rt_params.con_endreadmarkexclusionarea
+		  || realreadpos >= ric.read.getRightClipoff()-con_rt_params.con_endreadmarkexclusionarea) {
+	  CEBUG(ric.read.getName()<< ": near end of read, lowering the quality.\n");
+
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
+#endif
+	  switch(ric.read.getSequencingType()){
+	  case Read::SEQTYPE_SANGER :
+	  case Read::SEQTYPE_454GS20 :
+	  case Read::SEQTYPE_IONTORRENT:
+	  case Read::SEQTYPE_PACBIO : {
+	    if(qual>=10) {
+	      qual-=10;
+	    } else {
+	      qual=5;
+	    }
+	    if(qual<5) qual=5;
+	    break;
+	  }
+	  case Read::SEQTYPE_SOLEXA :
+	  case Read::SEQTYPE_ABISOLID : {
+	    // decrease by one
+	    if(qual) qual--;
+	    break;
+	  }
+	  default: {
+	  }
+	  }
+	}
+      }
+    }
+      
+    // No railreads at all, have been taken out earlier!
+    //// Quality of bases from railreads are set to 0 so as not 
+    ////  to be counted twice (as bases are the same as in backbone)
+    //if(ric.read.isRail()) qual=0;
+      
+      
+      
+    bool maskedset=false;
+
+
+    // TODO: rework the if(...hasTag(Read::REA_tagFpAS,realreadpos))
+    //  to check for all mask taks in a masktagstring vector
+
+//    if(maskshadow[actcontigpos]) {
+//      // remember that the readpos computing routine doesn't take care
+//      //  of direction, so we have to complement that position in reverse cases
+//      int32 realreadpos=readpos;
+//      if(ric.direction<0){
+//	realreadpos=ric.read.calcComplPos(readpos);
+//      }
+//	
+//      CEBUG("MASKED: " << actcontigpos << "\t");
+//      CEBUG(ric.read.getName() << "\t" << realreadpos << "\t");
+//      if(ric.read.hasTag(Read::REA_tagFpAS,realreadpos)) {
+//	CEBUG("in" << endl);
+//	for(uint32 bindex=0; bindex<maskedshadowgroups.size(); bindex++) {
+//	  if(maskedshadowgroups[bindex].base==base) {
+//	    maskedshadowgroups[bindex].ids.push_back(actreadid);
+//	    maskedshadowgroups[bindex].quals.push_back(qual);
+//	    maskedshadowgroups[bindex].directions.push_back(ric.direction);
+//	    if(ric.direction>0){
+//	      maskedshadowgroups[bindex].hasforwarddir=true;
+//	    }else{
+//	      maskedshadowgroups[bindex].hascomplementdir=true;
+//	    }
+//	    // special case: treat short read mapping as both forward and reverse
+//	    if(ric.read.isCoverageEquivalentRead()){
+//	      maskedshadowgroups[bindex].hasforwarddir=true;
+//	      maskedshadowgroups[bindex].hascomplementdir=true;
+//	    }
+//	    maskedset=true;
+//	    break;
+//	  }
+//	}
+//      }
+//    }
+
+
+    if(maskedset==false) {
+      CEBUG("out" << endl);
+      for(uint32 bindex=0; bindex<groups.size(); bindex++) {
+	if(groups[bindex].base==base) {
+	  groups[bindex].ids.push_back(actreadid);
+	  groups[bindex].quals.push_back(qual);
+	  groups[bindex].directions.push_back(ric.direction);
+	  if(ric.direction>0){
+	    groups[bindex].forwarddircounter++;
+	  }else{
+	    groups[bindex].complementdircounter++;
+	  }
+
+	  // special case: treat short read mapping as both forward and reverse
+	  if(ric.read.isCoverageEquivalentRead()){
+	    // we already counted forward
+	    //groups[bindex].forwarddircounter++;
+	    groups[bindex].complementdircounter++;
+	  }
+	  break;
+	}
+      }
+    }
+  }
+      
+  {
+    // check whether there is anything in groups 
+    //  and maskedshadowgroups selected
+    // if groups emty and masked not, copy masked to groups
+    bool groupsempty=true;
+    bool maskedempty=true;
+    for(uint32 bindex=0; bindex<groups.size(); bindex++) {
+      if( groups[bindex].ids.size()) groupsempty=false;
+      if( maskedshadowgroups[bindex].ids.size()) maskedempty=false;
+    }
+    if(groupsempty && maskedempty==false) {
+      CEBUG("EMPTY: " << actcontigpos << endl);
+      groups=maskedshadowgroups;
+    }
+  }
+
+
+  //{
+  //  // Cheat!
+  //  bool hasmergedbases=(ccI->backbonechar!='@') & (ccI->bbcounts[0]>0);
+  //  bool mergedalsogroup=false;
+  //  
+  //  // Ok, check whether the merged bases belong to this strain
+  //  //  if not, well then no merged bases exist
+  //  uint8 strainmask=255;
+  //
+  //  if(strainidtotake>=0) strainmask=getBBStrainMask(strainidtotake);
+  //  if(!(ccI->bbstrains[0] & strainmask)) hasmergedbases=false;
+  //
+  //
+  //}
+
+
+
+
+
+  if(xonly) {
+    thisbase='X';
+  } else {
+    base_quality_t maxqual=0;
+    uint32 maxcount=0;
+    for(uint32 i=0; i<groups.size(); i++){
+      calcGroupQual(groups[i]);
+      if(groups[i].groupquality>maxqual){
+	maxqual=groups[i].groupquality;
+      }
+      if(groups[i].ids.size()>maxcount){
+	maxcount=groups[i].ids.size();
+      }
+      //if(actcontigpos>830 && actcontigpos <920) {
+      CEBUG(actcontigpos << "\tb: " << groups[i].base << "\tgq: " << (uint16) groups[i].groupquality << "\ts: " << groups[i].ids.size() << endl);
+      //}
+    }
+    //if(actcontigpos>830 && actcontigpos <920) {
+    CEBUG(actcontigpos << "maxqual: " << (uint16) maxqual << "\t" << "maxcount: " << maxcount << endl);
+    //}
+    
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
+#endif
+
+    switch(actreadtype) {
+    case Read::SEQTYPE_SANGER : {
+      makeIntelligentConsensus_helper2_calcSangerQual(thisbase,
+						      thisqual,
+						      actcontigpos,
+						      groups,
+						      IUPACbasegroups,
+						      columnbases,
+						      maxqual,
+						      maxcount);
+      break;
+    }
+    case Read::SEQTYPE_454GS20 : {
+      makeIntelligentConsensus_helper2_calc454GS20(thisbase,
+						   thisqual,
+						   actcontigpos,
+						   groups,
+						   IUPACbasegroups);
+      break;
+    }
+    case Read::SEQTYPE_IONTORRENT : {
+      makeIntelligentConsensus_helper2_calcIonTorrent(thisbase,
+						      thisqual,
+						      actcontigpos,
+						      groups,
+						      IUPACbasegroups);
+      break;
+    }
+    case Read::SEQTYPE_PACBIO : {
+      makeIntelligentConsensus_helper2_calcPACBIO(thisbase,
+						  thisqual,
+						  actcontigpos,
+						  groups,
+						  IUPACbasegroups);
+      break;
+    }
+    case Read::SEQTYPE_SOLEXA : {
+      // the static cast for the strain id 
+//TODO: hier weiter
+      makeIntelligentConsensus_helper2_calcSOLEXA(
+	thisbase,
+	thisqual,
+	actcontigpos,
+	ccI,
+	groups,
+	IUPACbasegroups,
+	maxqual,
+	maxcount,
+	strainidtotake
+	);
+      break;
+    }
+    case Read::SEQTYPE_ABISOLID : {
+      cout << "Actreadtype: " << static_cast<uint16>(actreadtype) << endl;
+      throw Notify(Notify::INTERNAL, THISFUNC, "Type ABI SOLiD needs more support.");
+      break;
+    }
+    default: {
+      cout << "Actreadtype: " << static_cast<uint16>(actreadtype) << endl;
+      throw Notify(Notify::INTERNAL, THISFUNC, "Unknown read type.");
+    }
+    }
+
+    if(!dptools::isValidIUPACStarBase(thisbase)){
+      CEBUG("ALERT! This is not a valid base: '" << thisbase << "'\t: " << static_cast<uint16>(thisbase) << '\n');
+    }
+
+  }
+
+
+  FUNCEND();
+}
+
+
+
+
+
+
+/*************************************************************************
+ *
+ * Calculate the 'true' consensus and gives back a string with consensus
+ *  and a vector with the base quality of each base
+ *
+ * strainidtotake: <0 means "all", >=0 means "exactly those reads with that id"
+ *
+ * If the ostream parameter is != NULL, also writes a .tcs live file
+ *  to it
+ *
+ *************************************************************************/
+
+//#define CEBUG(bla) {cout << bla;} 
+
+void Contig::makeIntelligentConsensus(string & target, vector<base_quality_t> & qual, vector<int32> * targetadjustments, vector<int32> * targetadjustments_bla, int32 from, int32 to, int32 mincoverage, base_quality_t minqual, int32 strainidtotake, char missingcoveragechar)//, ostream * ostr, bool contagsintcs)
+{
+  FUNCSTART("void Contig::makeIntelligentConsensus(string & target, vector<base_quality_t> & qual, int32 from, int32 to, int32 mincoverage, base_quality_t minqual, int32 strainidtotake)");//, ostream * ostr, bool contagsintcs)");
+
+  cout << "makeIntelligentConsensus() complete calc\n";
+
+  //CON_cebugflag=true;
+
+  CEBUG("MIC\n");
+  CEBUG("from " << from << endl);
+  CEBUG("to " << to << endl);
+  CEBUG("mincoverage " << mincoverage << endl);
+  CEBUG("minqual " << static_cast<uint16>(minqual) << endl);
+  CEBUG("missingcovchar " << missingcoveragechar << endl);
+  CEBUG("strainidtotake " << strainidtotake << endl);
+
+
+  BUGIFTHROW(from>to,"from>to?");
+  BUGIFTHROW(from<0, "from < 0 ?");
+
+
+  // Finalising the contig initialises the output order structure vector
+  finalise();
+
+  //const contig_parameters & con_params = CON_miraparams->getContigParams();
+
+  if( to > static_cast<int32>(CON_counts.size())) to=CON_counts.size();
+  int32 len_target=to-from;
+  
+  //target.resize(len_target);
+  target.clear();
+  target.reserve(len_target+10);
+  qual.clear();
+  qual.reserve(len_target+10);
+
+  // for calculating the adjustments, only to this when whole
+  //  consensus is calculated
+  if(targetadjustments != NULL && from==0 && to==CON_counts.size()) {
+    targetadjustments->clear();
+    targetadjustments->reserve(len_target+10);
+  }
+  int32 unpaddedposcounter=0;
+
+
+  nngroups_t emptygroup;
+  emptygroup.base='!';
+  emptygroup.valid=false;
+  // TODO: make also use of bothdirectionspresent in this routine?
+  emptygroup.forwarddircounter=0;
+  emptygroup.complementdircounter=0;
+  emptygroup.groupquality=0;
+  vector<nngroups_t> emptygroups;
+  for(uint32 i=0; i<5; i++) {
+    emptygroups.push_back(emptygroup);
+    emptygroups[i].base= "ACGT*"[i];
+  }
+
+/*
+  // if there's a stream, we're dumping TCS
+  // initialise a quick lookup vector to point at the positions in the
+  //  consensus that have a tag
+  // a for any tag
+  // d for dangerous tag
+  vector<bool> tcs_aconstagpositions;
+  vector<bool> tcs_dconstagpositions;
+  if(ostr != NULL && contagsintcs){
+    tcs_aconstagpositions.resize(CON_counts.size(),false);
+    tcs_dconstagpositions.resize(CON_counts.size(),false);
+    vector<consensustag_t>::const_iterator I=CON_consensus_tags.begin();
+    for(; I!=CON_consensus_tags.end(); I++) {
+      for(uint32 i=I->from; i<=I->to; i++) tcs_aconstagpositions[i]=true;
+      if(I->identifier == CON_tagentry_idSRMc
+	 || I->identifier == CON_tagentry_idWRMc
+	 || I->identifier == CON_tagentry_idDGPc
+	 || I->identifier == CON_tagentry_idUNSc
+	 || I->identifier == CON_tagentry_idIUPc){
+	for(uint32 i=I->from; i<=I->to; i++) tcs_dconstagpositions[i]=true;
+      }
+    }
+  }
+  // temporary vectors for TCS
+  vector<int32> tcs_totalgroupcount;
+  tcs_totalgroupcount.reserve(emptygroups.size());
+  vector<int32> tcs_totalgroupqual;
+  tcs_totalgroupqual.reserve(emptygroups.size());
+*/
+
+
+  vector<nngroups_t> maskedshadowgroups=emptygroups;
+
+  vector<char> IUPACbasegroups;
+  IUPACbasegroups.reserve(10);
+
+  vector<char> columnbases;
+  columnbases.reserve(1000);
+
+  // for each read type, we will predict a base and quality and such
+  vector<char> predictedbases(Read::getNumSequencingTypes());
+  vector<base_quality_t> predictedquality(Read::getNumSequencingTypes());
+
+  // as well as the possible alternative bases
+  vector<vector<char> > possiblebases;
+  possiblebases.resize(Read::getNumSequencingTypes());
+
+  // as well as a goodness level estimate of the prediction
+  vector<int8> predictlevel(Read::getNumSequencingTypes());
+  vector<int8> predictlevelused(10);
+
+
+  // for each read type a vector<nngroups_t> to hold all estimates
+  //  regarding bases and qualities
+  vector<vector<nngroups_t> > groupsvec;
+  groupsvec.reserve(Read::getNumSequencingTypes());
+
+  // a vector (read_ids_in_col) keeps the ids of the reads that are
+  //  covering a specific position of the contig
+  // reserving 1000 position should be enough 99.9% of all cases,
+  //  is automatically extended by STL if needed.
+
+  // now with different read types (sanger, 454 etc, we need a vector
+  //  of read_ids_in_col
+
+  vector<vector<int32> > read_ids_in_col;
+  read_ids_in_col.resize(Read::getNumSequencingTypes());
+
+  // ok, fill in some
+  for(uint32 i=0; i<Read::getNumSequencingTypes(); i++){
+    read_ids_in_col[i].reserve(1000);
+    groupsvec.push_back(emptygroups);
+  }
+
+  // fill the vector in case we are starting within the contig
+  if(from>0) {
+    // TODO: this is wrong when going only after specific strainids!
+    // correct that ASAN (as soon as needed)
+
+    throw Notify(Notify::INTERNAL, THISFUNC, "starting with from > 0 not available yet.");
+
+    //getReadIDsAtContigPosition(read_ids_in_col,from);
+  }
+
+
+  vector<int8> maskshadow;
+  vector<multitag_t::mte_id_t> masktagstrings;
+
+  // Bach: 17.08.2008
+  // the new strategy of tagging poly-AT sites and keeping them in 
+  //  the read (no clipping) makes it necessary to keep sequence
+  //  under FpAS tags as full valid member of consensus somputation
+  // Therefore, FpAS may NOT be put into the masktagstrings anymore!
+  // masktagstrings.push_back(Read::REA_tagFpAS);
+
+  buildMaskShadow(maskshadow,masktagstrings,false);
+
+  vector<out_order_t>::const_iterator outorderI = CON_outputorder.begin();
+
+  cccontainer_t::const_iterator ccI=CON_counts.begin();
+  advance(ccI,from);
+
+  // this is the loop that updates the vector that 
+  //  keeps track of the reads that are
+  //  covering a specific position of the contig
+  // works quite simple: reads in the vector that are ending get
+  //  thrown out, new reads starting are entered.
+
+  CEBUG("CON_counts.size(): " << CON_counts.size() << endl);
+
+  for(uint32 actcontigpos=from; actcontigpos<to ;actcontigpos++, ccI++){
+
+    //cout << "conposx: " << actcontigpos << endl;
+    //if(actcontigpos>1000000 && strainidtotake == 1){
+    //  cout << "profile exit" << endl;
+    //  exit(0);
+    //}
+    //if(actcontigpos >= 2698850
+    //   && actcontigpos <= 2698870){
+    //  CON_cebugflag=true;
+    //}else{
+    //  CON_cebugflag=false;
+    //}
+  
+    {
+      // updating the ids of the reads at that position
+
+      // first delete those who fall out at this new position
+      for(uint32 actreadtype=0; actreadtype<Read::getNumSequencingTypes(); actreadtype++){ 
+	vector<int32>::iterator Ifrom=read_ids_in_col[actreadtype].begin();
+	vector<int32>::iterator Ito=Ifrom;
+	for(;Ifrom != read_ids_in_col[actreadtype].end(); Ifrom++){
+	  *Ito=*Ifrom;
+	  if(CON_reads[*Ifrom].offset+CON_reads[*Ifrom].read.getLenClippedSeq() > actcontigpos) {
+	    Ito++;
+	  }
+	}
+	if(Ito != Ifrom) {
+	  read_ids_in_col[actreadtype].resize(Ito-read_ids_in_col[actreadtype].begin());
+	}
+      }
+
+      // now insert ids of reads that have newly started at this position
+      // Don't take railreads, backbone is there.
+      for(;outorderI != CON_outputorder.end() && outorderI->offset_start == actcontigpos; outorderI++){
+	if( ! CON_reads[outorderI->original_index].read.isRail()) {
+	  
+	  // new! one can also make a choice which strains to take into account
+	  // either all (strainidtotake<0 or exactly the one chosen)
+	  if(strainidtotake < 0
+	     || CON_reads[outorderI->original_index].read.getStrainID() == strainidtotake) {
+	    read_ids_in_col[CON_reads[outorderI->original_index].read.getSequencingType()].push_back(outorderI->original_index);
+	  }
+	}
+      }
+    }
+  
+    // for each read type, predict a base and a quality,
+    //  but also get back the potential solutions and number thereof
+
+    //vector<uint32> numsolutionsvec(Read::getNumSequencingTypes(),0);
+
+    uint32 numreadtypeswithsolution=0;
+    for(uint32 actreadtype=0; actreadtype<Read::getNumSequencingTypes(); actreadtype++){
+      predictedbases[actreadtype]='!';
+      predictedquality[actreadtype]=0;
+      makeIntelligentConsensus_helper1(predictedbases[actreadtype],
+				       predictedquality[actreadtype],
+				       actcontigpos,
+				       ccI,
+				       mincoverage,
+				       groupsvec[actreadtype],
+				       maskedshadowgroups,
+				       IUPACbasegroups,
+				       columnbases,
+				       read_ids_in_col[actreadtype],
+				       maskshadow,
+				       actreadtype,
+				       strainidtotake,
+				       missingcoveragechar
+	);
+
+      possiblebases[actreadtype]=IUPACbasegroups;
+
+      //numsolutionsvec[actreadtype]=IUPACbasegroups.size();
+      //if(numsolutionsvec[actreadtype] > 0) numreadtypeswithsolution++;
+      if(predictedbases[actreadtype] != '!') numreadtypeswithsolution++;
+    }
+
+    /* after the previous loop, we have the following important things
+       per read type (other things too, less important at the moment):
+       - the picked base and quality in predictedbases[] and 
+         predictedquality[]
+       - possible alternatives (including picked one) in possiblebases[]
+       - all group calculations for all read types in groupsvec[]
+     */
+
+    CEBUG("preda: ");
+    for(uint32 actreadtype=0; actreadtype<Read::getNumSequencingTypes(); actreadtype++){
+      CEBUG(predictedbases[actreadtype]);
+    }
+    CEBUG('\n');
+
+    bool mismatchesintyperesults=false;
+    if(numreadtypeswithsolution>1) {
+      CEBUG("numreadtypes: " << numreadtypeswithsolution << endl);
+      char basepick='!';
+      for(uint32 actreadtype=0; actreadtype<Read::getNumSequencingTypes(); actreadtype++){
+	CEBUG("pred[" << actreadtype << "]: " << predictedbases[actreadtype] << endl);
+	if(predictedbases[actreadtype] != '!'){
+	  if(basepick == '!'){
+	    basepick=toupper(predictedbases[actreadtype]);
+	  }else if(toupper(predictedbases[actreadtype]) != basepick){
+	    if(basepick=='X'){
+	      if(dptools::isValidIUPACStarBase(predictedbases[actreadtype])){
+		basepick=toupper(predictedbases[actreadtype]);
+	      }
+	    }else if(basepick=='N'){
+	      if(toupper(predictedbases[actreadtype]) != 'X'){
+		basepick=toupper(predictedbases[actreadtype]);
+	      }
+	    }else{
+	      if(toupper(predictedbases[actreadtype]) != 'X'
+		 && toupper(predictedbases[actreadtype]) != 'N'){
+		mismatchesintyperesults=true;
+	      }
+	    }
+	  }
+	}
+      }
+      CEBUG("Mismatch1: " << mismatchesintyperesults << endl);
+    }
+
+
+    // Party time, let's find out which base we take
+    char thisbase='@';
+    base_quality_t thisqual=0;
+
+    bool hasSOLiD=false;
+    if(hasSOLiD){
+      throw Notify(Notify::INTERNAL, THISFUNC, "Type ABI SOLiD needs more support 2.");
+      break;
+    }
+
+    // if we have a mismatch: shootout
+    if(mismatchesintyperesults){
+
+      CEBUG("Mismatch. ");
+
+      // look first at at uniqueness and quality
+
+      // set default level 100 (not used) for all seqtypes
+      predictlevel.clear();
+      predictlevel.resize(Read::getNumSequencingTypes(),100);
+      
+      // count how many predictions of each level are present
+      predictlevelused.clear();
+      predictlevelused.resize(10,0);
+
+      int8 bestpred=100;
+      for(uint32 actseqtype=0; actseqtype<Read::getNumSequencingTypes(); actseqtype++){
+	// just do this for sanger, 454, PacBio, solexa, solid equally (might change later)
+
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
+#endif
+
+	switch(actseqtype){
+	case Read::SEQTYPE_SANGER :
+	case Read::SEQTYPE_454GS20 :
+	case Read::SEQTYPE_IONTORRENT :
+	case Read::SEQTYPE_PACBIO :
+	case Read::SEQTYPE_SOLEXA : 
+	case Read::SEQTYPE_ABISOLID : {
+	  if(predictedbases[actseqtype] != '!') {
+	    // TODO: still not optimal, should perhaps test all
+	    //  goups of IUPAC *sigh*
+	    if(dptools::isValidACGTStarBase(predictedbases[actseqtype])){
+	      predictlevel[actseqtype]=rateGoodnessLevelOfConsensus(
+		ccI,
+		groupsvec[actseqtype][dptools::getIndexOfBase(predictedbases[actseqtype])],
+		possiblebases[actseqtype].size(),
+		actseqtype
+		);
+	      BUGIFTHROW(predictlevel[actseqtype]<0, "problem in hybrid cons calc: level < 0");
+	      BUGIFTHROW(predictlevel[actseqtype]>=predictlevelused.size(), "level > expected maxiumum of 9");
+	    }else{
+	      predictlevel[actseqtype]=5;
+	    }
+	    predictlevelused[predictlevel[actseqtype]]++;
+	    if(predictlevel[actseqtype] < bestpred) bestpred=predictlevel[actseqtype];
+	    CEBUG("plevel " << predictedbases[actseqtype] << " [" << actseqtype << "]: " << static_cast<int16>(predictlevel[actseqtype]) << '\n');
+	  }
+	  break;
+	}
+	default: {
+	  //throw Notify(Notify::INTERNAL, THISFUNC, "unexpected sequencing type 1");
+	}
+	}
+      }
+
+      CEBUG("bestpred: " << static_cast<int16>(bestpred) << '\n');
+
+      ostringstream tagstr;
+      ostringstream tmdstr; // tag method details
+      
+      // if there's more than one prediction with quality level of best
+      //  prediction or one after, it's unresolved
+      // else we'll take the best prediction
+      if(predictlevelused[bestpred]+predictlevelused[bestpred+1] >= 2){
+	/* if this happens, we have different base predictions for each
+	   sequencing type. That's bad. Could be due to sequencing or 
+	   alignment or assembly error. Or when the strain sequenced
+	   with one sequencing type was not 100% identical to the sequenced 
+	   strain with the other sequencing type(s).
+
+	   But there's one saving attempt: if one is a normal base and the other(s)
+	   an IUPAC and the normal base is contained in the IUPAC, then we'll
+	   take this base as result and not the IUPAC. (gaps kill the saving
+	   process, sorry)
+	*/
+
+
+	// saving attempt, pre-check
+	thisbase = '!';
+	bool canbesaved=true;
+	for(uint32 actseqtype=0; actseqtype<Read::getNumSequencingTypes(); actseqtype++){
+	  if(predictlevel[actseqtype]==bestpred
+	     || predictlevel[actseqtype]==bestpred-1) {
+	    // make sure that gaps kill the whole saving process
+	    if(predictedbases[actseqtype]=='*') canbesaved=false;
+
+	    if(dptools::isValidBase(predictedbases[actseqtype])){
+	      tmdstr << " / " << Read::getShortNameOfSequencingType(actseqtype) 
+		     << " (" << static_cast<uint16>(predictlevel[actseqtype])
+		     << ") " << predictedbases[actseqtype]
+		     << " " << static_cast<uint16>(predictedquality[actseqtype]);
+
+	      if(thisbase=='!'){
+		thisbase=predictedbases[actseqtype];
+	      }else{
+		thisbase=dptools::calcIUPACConsensus(thisbase,
+						     predictedbases[actseqtype]);
+	      }
+	    }
+	  }
+	}
+
+	canbesaved&=dptools::isValidBase(thisbase);
+
+	// saving attempt, post-check (does the base fit in all IUPACs)
+	if(canbesaved) {
+	  tmdstr << "  is in  ";
+	  for(uint32 actseqtype=0; actseqtype<Read::getNumSequencingTypes(); actseqtype++){
+	    if(predictlevel[actseqtype]==bestpred
+	       || predictlevel[actseqtype]==bestpred-1) {
+	      if(!dptools::isValidBase(predictedbases[actseqtype])){
+		if(!dptools::hasNucleicAcidInIUPAC(thisbase,predictedbases[actseqtype])){
+		  canbesaved=false;
+		} else {
+		  tmdstr << " / " << Read::getShortNameOfSequencingType(actseqtype) 
+			 << " (" << static_cast<uint16>(predictlevel[actseqtype])
+			 << ") " << predictedbases[actseqtype]
+			 << " " << static_cast<uint16>(predictedquality[actseqtype]);
+		}
+	      }
+	    }
+	  }
+	}
+
+	CEBUG("TMDstr: " << tmdstr.str() << '\n');
+
+	multitag_t::mte_id_t tagtype=CON_tagentry_idSTMU;
+	if(canbesaved){
+	  tagtype=CON_tagentry_idSTMS;
+	  tagstr << "Solved vote: " << tmdstr.str();
+	  // TODO: refine this: other quality and tell which sequencing types with which
+	  //  results were taken into account
+	  thisqual=10;
+	}else{
+	  tagstr << "Unresolved mismatch in seq. type consensus";
+	  
+	  thisbase = '!';
+	  thisqual=0;
+	  for(uint32 actseqtype=0; actseqtype<Read::getNumSequencingTypes(); actseqtype++){
+	    if(predictlevel[actseqtype]==bestpred
+	       || predictlevel[actseqtype]==bestpred-1) {
+	      tagstr << " / " << Read::getShortNameOfSequencingType(actseqtype)
+		     << ": (";
+	      if(thisbase=='!'){
+		thisbase=predictedbases[actseqtype];
+	      }else{
+		thisbase=dptools::calcIUPACConsensus(thisbase,
+						     predictedbases[actseqtype]);
+	      }
+	      tagstr << static_cast<uint16>(predictlevel[actseqtype])
+		     << ") " << predictedbases[actseqtype]
+		     << " " << static_cast<uint16>(predictedquality[actseqtype]);
+	    }
+	  }
+	  tagstr << " || " << thisbase << " " << static_cast<uint16>(thisqual);
+	}
+	CEBUG("TAGstr1: " << tagstr.str() << '\n');
+	addTagToConsensus(actcontigpos,
+			  actcontigpos,
+			  '=',
+			  multitag_t::getIdentifierStr(tagtype).c_str(),
+			  tagstr.str().c_str(),
+			  true);
+      }else{
+	// well, shootout: take the best one
+	tagstr << "Solved mismatch: ";
+
+	for(uint32 actseqtype=0; actseqtype<Read::getNumSequencingTypes(); actseqtype++){
+	  if(predictlevel[actseqtype]==bestpred) {
+	    tagstr << ' ' << Read::getShortNameOfSequencingType(actseqtype)
+		   << ": (";
+	    thisbase=predictedbases[actseqtype];
+	    thisqual=predictedquality[actseqtype];
+
+	    tagstr << static_cast<uint16>(predictlevel[actseqtype])
+		   << ") " << thisbase
+		   << ' ' << static_cast<uint16>(thisqual);
+
+	    break;
+	  }
+	}
+	CEBUG("TAGstr2: " << tagstr.str() << '\n');
+	addTagToConsensus(actcontigpos,
+			  actcontigpos,
+			  '=',
+			  multitag_t::getIdentifierStr(CON_tagentry_idSTMS).c_str(),
+			  tagstr.str().c_str(),
+			  true);
+      }
+    }else{
+      // no mismatch in type results, good
+      // quality = sum(.75*quality of each seqtype) or best qual
+      CEBUG("No mismatch. ");
+
+      uint32 compqual=0;
+      uint32 bestqual=0;
+      bool hassomething=false;
+      bool has_n=false;
+      bool has_x=false;
+      for(uint32 actseqtype=0; actseqtype<Read::getNumSequencingTypes(); actseqtype++){
+	if(predictedbases[actseqtype] == 'N') {
+	  has_n=true;
+	  continue;
+	}
+	if(predictedbases[actseqtype] == 'X') {
+	  has_x=true;
+	  continue;
+	}
+	if(predictedbases[actseqtype] != '!') {
+
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
+#endif
+	  switch(actseqtype){
+	  case Read::SEQTYPE_SANGER : 
+	  case Read::SEQTYPE_454GS20 :
+	  case Read::SEQTYPE_IONTORRENT :
+	  case Read::SEQTYPE_PACBIO :
+	  case Read::SEQTYPE_SOLEXA :
+	  case Read::SEQTYPE_ABISOLID: {
+	    hassomething=true;
+	    thisbase=predictedbases[actseqtype];
+	    compqual+=(static_cast<uint32>(predictedquality[actseqtype])*75)/100;
+	    if(predictedquality[actseqtype]>bestqual) bestqual=predictedquality[actseqtype];
+	    break;
+	  }
+	  default: {
+	    // do nothing???
+	    //thisbase='x';
+	  }
+	  }
+	}
+      }
+
+      if(!hassomething){
+	if(has_x) {
+	  thisbase='x';
+	  hassomething=true;
+	}
+	if(has_n) {
+	  thisbase='N';
+	  hassomething=true;
+	}
+      }
+
+      if(hassomething){
+	BUGIFTHROW(thisbase=='@',"Coverage present but base is '@' ... this is not healthy.\n");
+      }else{
+	BUGIFTHROW(thisbase!='@',"No coverage present but base is not '@' ... this is not healthy.\n");
+	thisbase=missingcoveragechar;
+	thisqual=0;
+      }
+
+      if(bestqual>compqual) compqual=bestqual;
+      if(compqual>90) compqual=90;
+      thisqual=static_cast<base_quality_t>(compqual);
+    }
+
+    CEBUG("thisbase " << thisbase << "\tthisqual " << (uint16) thisqual << endl);
+
+    thisbase=tolower(thisbase);
+
+    if(thisqual<minqual && thisbase!=missingcoveragechar){
+      thisbase='N';
+      thisqual=0;
+      CEBUG("Minqual not reached, changed to: thisbase " << thisbase << "\tthisqual " << (uint16) thisqual << endl);
+    }
+
+    if(thisqual>90) thisqual=90;
+
+    target+=thisbase;
+    qual.push_back(thisqual);
+
+    // calc the adjustments
+    if(targetadjustments!= NULL && from==0 && to==CON_counts.size()) {
+      if(thisbase=='*') {
+	targetadjustments->push_back(-1);
+      }else{
+	targetadjustments->push_back(unpaddedposcounter);
+	unpaddedposcounter++;
+      }
+
+      BUGIFTHROW(targetadjustments->size()!=target.size(), "gna1");
+      BUGIFTHROW(targetadjustments->size()!=qual.size(), "gna2");
+
+    }
+
+/*
+    // dump out .tcs file to ostr if given
+    if(ostr!=NULL) {
+      //throw Notify(Notify::INTERNAL, THISFUNC, "must be adapted to multiple read types");
+
+      // name and position
+      // don't call paddedPos2UnpaddedPos as this would lead to recursion!
+      *ostr << setw(20) << left << getContigName() 
+	    << setw(9) << right << actcontigpos
+	    << setw(9) << CON_adjustments.back()
+	    << " | " << thisbase
+	    << setw(3) << static_cast<uint16>(thisqual)
+	    << " |" << setw(5) << read_ids_in_col.size();
+
+      tcs_totalgroupcount.clear();
+      tcs_totalgroupcount.resize(emptygroups.size(),0);
+      tcs_totalgroupqual.clear();
+      tcs_totalgroupqual.resize(emptygroups.size(),0);
+      for(uint32 actseqtype=0; actseqtype<groupsvec.size(); actseqtype++){
+	for(uint32 grpi=0; grpi<groupsvec[actseqtype].size(); grpi++){
+	  tcs_totalgroupcount[grpi]+=groupsvec[actseqtype][grpi].ids.size();
+	  tcs_totalgroupqual[grpi]+=groupsvec[actseqtype][grpi].groupquality;
+	  if(tcs_totalgroupqual[grpi]>90) tcs_totalgroupqual[grpi]=90;
+	}
+      }
+      for(uint32 grpi=0; grpi<tcs_totalgroupcount.size(); grpi++){
+	*ostr << setw(5) << tcs_totalgroupcount[grpi];
+      }
+
+      *ostr << " |";
+      uint32 numgroupswithqual=0;
+      for(uint32 grpi=0; grpi<tcs_totalgroupcount.size(); grpi++){
+	if(tcs_totalgroupcount[grpi]) {
+	  *ostr << setw(3) << tcs_totalgroupqual[grpi];
+	  numgroupswithqual++;
+	}else{
+	  *ostr << " --";
+	}
+      }
+
+      // TODO: different characters for different cases?
+      char bstatus='?';
+      if(!dptools::isValidBase(thisbase)
+	 && dptools::isValidIUPACBase(thisbase)){
+	bstatus='M';
+      }else if(thisbase=='*'){
+	if(thisqual>=40){
+	  bstatus=':';
+	}else if(thisqual<30){
+	  bstatus='m';
+	}else if(numgroupswithqual>2){
+	  bstatus='m';
+	}else{
+	  bstatus=':';
+	}
+      }else if(thisqual<30 && numgroupswithqual>1){
+	bstatus='m';
+      }else{
+	bstatus=':';
+      }
+      if(!tcs_aconstagpositions.empty() && tcs_dconstagpositions[actcontigpos]){
+	bstatus='$';
+      }
+      if(bstatus!=':'){
+	*ostr << " | !" << bstatus << " |";
+      }else{
+	*ostr << " |  : |";
+      }
+
+      if(!tcs_aconstagpositions.empty() && tcs_aconstagpositions[actcontigpos]){
+	vector<consensustag_t>::const_iterator I=CON_consensus_tags.begin();
+	bool doneoutput=false;
+	for(; I!=CON_consensus_tags.end(); I++) {
+	  if((I->from <= actcontigpos) && ((I->to) >= actcontigpos)) {
+	    if(doneoutput){
+	      *ostr << ' ' << I->getIdentifierStr();
+	    }else{
+	      *ostr << " \"" << I->getIdentifierStr();
+	      doneoutput=true;
+	    }
+	  }
+	}
+	if(doneoutput) *ostr << "\"";
+
+      }
+      *ostr << "\n";
+    }
+*/
+
+  }
+
+
+  CEBUG("target (first 100): " << target.substr(0,100) << endl);
+
+  FUNCEND();
+
+  return;
+}
+//#define CEBUG(bla)
+
+
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *
+ *************************************************************************/
+
+int8 Contig::rateGoodnessLevelOfConsensus(cccontainer_t::const_iterator ccI, nngroups_t & group, uint32 numpossiblebases, uint8 seqtype)
+{
+  FUNCSTART("int8 Contig::rateGoodnessLevelOfConsensus(cccontainer_t::const_iterator ccI, nngroups_t & group, uint32 numpossiblebases, uint8 seqtype)");
+
+  // basically, we'll prefer read types that have forward and
+  //  complement direction present.
+
+  CEBUG("predicting level for " << group.base << " seqtype " << static_cast<uint16>(seqtype) << '\n' << group << '\n');
+  int8 level=-1;
+
+  if(seqtype==Read::SEQTYPE_ABISOLID){
+    throw Notify(Notify::INTERNAL, THISFUNC, "Type ABI SOLiD needs more support 3.");
+  }
+
+
+  bool hasfr=(group.forwarddircounter>0) && (group.complementdircounter>0);
+
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
+#endif
+
+  switch(seqtype) {
+  case Read::SEQTYPE_SANGER :{
+    if(hasfr &&
+       group.groupquality >= 35){
+      level=0;
+    }else if(hasfr
+	     && group.groupquality >= 25){
+      level=1;
+    } else if(hasfr){
+      level=2;
+    } else if(group.ids.size()>=3
+	      && numpossiblebases == 1){
+      level=3;
+    } else {
+      level=4;
+    }
+    break;
+  }
+  case Read::SEQTYPE_454GS20 :{
+    if(hasfr
+       && group.ids.size() >= 12
+       && group.groupquality >= 35){
+      level=0;
+    } else if(hasfr
+	      && group.ids.size() >= 8
+	      && group.groupquality >= 25){
+      level=1;
+    } else if(hasfr){
+      level=2;
+    } else if(group.ids.size()>=6
+	      && numpossiblebases == 1){
+      level=3;
+    } else {
+      level=4;
+    }
+    break;
+  }
+  case Read::SEQTYPE_IONTORRENT :{
+    if(hasfr
+       && group.ids.size() >= 8
+       && group.groupquality >= 35){
+      level=0;
+    } else if(hasfr
+	      && group.ids.size() >= 6
+	      && group.groupquality >= 25){
+      level=1;
+    } else if(hasfr){
+      level=2;
+    } else if(group.ids.size()>=4
+	      && numpossiblebases == 1){
+      level=3;
+    } else {
+      level=4;
+    }
+    break;
+  }
+  case Read::SEQTYPE_PACBIO :{
+    // No info. atm use same as 454
+    if(hasfr
+       && group.ids.size() >= 12
+       && group.groupquality >= 35){
+      level=0;
+    } else if(hasfr
+	      && group.ids.size() >= 8
+	      && group.groupquality >= 25){
+      level=1;
+    } else if(hasfr){
+      level=2;
+    } else if(group.ids.size()>=6
+	      && numpossiblebases == 1){
+      level=3;
+    } else {
+      level=4;
+    }
+    break;
+  }
+  case Read::SEQTYPE_SOLEXA :{
+    // Solexa special case: we need to take the merged reads
+    //  into account
+    uint32 realsize=group.ids.size();
+    if(ccI->backbonechar==group.base){
+      realsize+=ccI->bbcounts[0];
+      if(ccI->bbcounts[0]>=6){
+	hasfr=true;
+      }
+    }
+    if(hasfr
+       && realsize >= 12
+       && group.groupquality >= 35){
+      level=0;
+    } else if(hasfr
+	      && realsize >= 8
+	      && group.groupquality >= 30){
+      level=1;
+    } else if(hasfr 
+	      && group.groupquality >= 25){
+      level=2;
+    } else if(group.groupquality >= 20
+	      && realsize>=4
+	      && numpossiblebases == 1){
+      level=3;
+    } else if(group.groupquality >= 10){
+      level=4;
+    } else {
+      level=5;
+    }
+    break;
+  }
+  default : {
+    cout << "seqtype: " << seqtype << endl;
+    throw Notify(Notify::INTERNAL, THISFUNC, "Uknown seqtype to rate?");
+  }
+  }
+
+  FUNCEND();
+  return level;
+}
+
+//#define CEBUG(bla)
+
+
+
+
+
+/*************************************************************************
+ *
+ * builds a vector which shows at which positions in the consensus there
+ *  are reads that have a given tag 
+ *
+ *   .........TTTTTTTT..................
+ *      ...........TTTTTTT.................  <- reads
+ *
+ *   00000000011111111111100000000000000000  <- maskshadow
+ *
+ *************************************************************************/
+
+void Contig::buildMaskShadow(vector <int8> & maskshadow, vector<multitag_t::mte_id_t> & masktagstrings, bool onlybackbone)
+{
+  FUNCSTART("void Contig::buildMaskShadow(vector <int8> & maskshadow, vector<string> & masktagstrings)");
+
+  //cout << "MASK #############" << endl;
+  
+  maskshadow.clear();
+  maskshadow.resize(CON_counts.size(),0);
+  vector<contigread_t>::const_iterator ACR=CON_reads.begin();
+  for( ; ACR!=CON_reads.end(); ACR++) {
+    if(onlybackbone && !ACR->read.isBackbone()) continue;
+    const Read & actread = ACR->read;
+    for(uint32 tagnum=0; tagnum<actread.getNumOfTags(); tagnum++) {
+      const multitag_t & acttag=actread.getTag(tagnum);
+      vector<multitag_t::mte_id_t>::const_iterator I= masktagstrings.begin();
+      for( ; I!=masktagstrings.end(); I++) {
+	if(acttag.identifier == *I) {
+	  // ok, this tag is one of those we search
+	  // get the consensusposition from the read tag positions
+	  //  (may be outside of bounds as tags can be in clipped parts!)
+	  int32 cfrom=unclippedReadPosToContigPos(acttag.from, *ACR);
+	  int32 cto=unclippedReadPosToContigPos(acttag.to, *ACR);
+
+	  // positions may be reverse, swap then
+	  if(cfrom > cto) swap(cfrom,cto);
+
+	  //cout << actread.getName() << "\t" << acttag.from << "\t" << acttag.to << "\t" << cfrom << "\t" << cto << endl;
+
+	  // if both positions are left, right out of bounds, next tag
+	  if(cfrom <0 && cto<0) continue;
+	  if(cfrom >= CON_counts.size() && cto>=CON_counts.size()) continue;
+	  // those positions ot of bounds -> set to bounds
+	  if(cfrom < 0) cfrom=0;
+	  if(cto >= CON_counts.size()) cto=CON_counts.size()-1;
+	  // Tag from .. to are INCLUDING!
+	  for(int32 i=cfrom; i<=cto; i++) {
+	    maskshadow[i]=1;
+	  }
+	}
+      }
+    }
+  }
+
+  FUNCEND();
+  return;
+}
+
+
+
+
+
+
+
+///*************************************************************************
+// *
+// * g must be a valid group structure
+// *
+// *************************************************************************/
+//#if 1
+//
+//void Contig::calcGroupQual(const groups_t & g)
+//{
+//  if(g.ids.empty()){
+//    const_cast<nngroups_t &>(g).groupquality=0;
+//    return;
+//  }
+//
+//  /* errorrate for this group is computed as follows:
+//     Best quality for a base in a direction makes basic rate = 100%
+//     add to this: 10% of next best base quality
+//     
+//     Same procedure for other direction, then add both qualities
+//
+//     In general, the values are almost the same (mostly a tad higher) as
+//     with the more complicated (and time consuming) old variant.
+//     
+//     Cap at 90
+//     
+//     e.g.
+//     + A 30     -> 30       \
+//     + A 20     ->  2        \
+//     + A 20                  /+ = 32    \
+//     + A 20                 /            \
+//     .                                    > + = 60
+//     - A 26     -> 26     \              /
+//     - A 20     ->  2      >  + = 28    /
+//     - A 15               /
+//  */
+//
+//  base_quality_t max1f=0;
+//  base_quality_t max2f=0;
+//  base_quality_t max1r=0;
+//  base_quality_t max2r=0;
+//
+//  // find two highest values for each direction
+//
+//  for(uint32 j=0; j<g.ids.size(); j++) {
+//    if(CON_reads[g.ids[j]].read.isRail()) continue;
+//    if(g.directions[j]>0) {
+//      if(g.quals[j] >= max1f){
+//	max2f=max1f;
+//	max1f=g.quals[j];
+//      }else if(g.quals[j] > max2f){
+//	max2f=g.quals[j];
+//      }
+//    } else {
+//      if(g.quals[j] >= max1r){
+//	max2r=max1r;
+//	max1r=g.quals[j];
+//      }else if(g.quals[j] > max2r){
+//	max2r=g.quals[j];
+//      }
+//    }
+//  }
+//
+//  // compute quality
+//
+//  const_cast<nngroups_t &>(g).groupquality=max1f+max1r+(max2f+max2r)/10;
+//  if((g).groupquality>90) const_cast<nngroups_t &>(g).groupquality=90;
+//}
+//
+//
+//#else
+//
+///*************************************************************************
+// *
+// * g must be a valid group structure
+// * errorvector must just be an vector<vector<double> >, holding this vector
+// *   external saves _a lot_ of time for subsequent calls to calcGroupQual
+// *   (eliminates zilliions of memory allocations)
+// *
+// *************************************************************************/
+//
+//void Contig::calcGroupQual(const groups_t & g,  vector<vector<double> > & errorvector)
+//{
+//  base_quality_t bq=0;
+//
+//  // compute the group quality
+//  if(!g.ids.empty()){
+//    if(errorvector.size()!=2) errorvector.resize(2);
+//    errorvector[0].clear();
+//    errorvector[1].clear();
+//
+//    // first, collect the error probabilities of each group for forward
+//    //  and complement direction
+//    // Leave out rails here!
+//
+//    for(uint32 j=0; j<g.ids.size(); j++) {
+//      if(CON_reads[g.ids[j]].read.isRail()) continue;
+//      if(g.directions[j]>0) {
+//	errorvector[0].push_back(Read::qualityToErrorRate(g.quals[j]));
+//	//cout << "ErrRate + " << errorvector[0].back() << endl;
+//      } else {
+//	errorvector[1].push_back(Read::qualityToErrorRate(g.quals[j]));
+//	//cout << "ErrRate - " << errorvector[1].back() << endl;
+//      }
+//    }
+//
+//    /* errorrate for this group is computed as follows:
+//       Best probability for a base in a direction makes basic rate = 100%
+//       add to this: the other rates of the same direction each - 10% from
+//         the previous, that is: 2nd = 90%, 3rd = 80% etc.
+//       Same procedure for other direction, then multiply both errorrates
+//       e.g.
+//       + A 30    1000       ->          \
+//       + A 20     100 \                  \
+//       + A 20     100  >(90+80+70)       /+ = 1240  \
+//       + A 20     100 /                 /            \
+//       .                                              >* = 636120; log10(636120)*10
+//       - A 26     398       ->        \              /               = 58
+//       - A 20     100 \                >398+115=513 /
+//       - A 15      32 / (90+25)= 115  /
+//    */
+//    double errorrate=1.0;
+//    for(uint32 j=0;j<2; j++){
+//      //cout << "  " << j << ") "; 
+//      if(!errorvector[j].empty()){
+//	sort(errorvector[j].begin(),errorvector[j].end(),greater<double>());
+//	
+//	double tmperrorrate=1.0;
+//	uint32 multiplier=10;
+//	for(uint32 k=0; k<errorvector[j].size() && multiplier>0; k++, multiplier--) {
+//	  tmperrorrate+=(errorvector[j][k]*static_cast<double>(multiplier))/10.0;
+//	  //cout << " " << errorvector[j][0];
+//	}
+//	errorrate*=tmperrorrate;
+//	//cout << "erate: " << errorrate;
+//      }
+//    }
+//    if(errorrate>1.0){
+//      bq=Read::errorRateToQuality(errorrate);;
+//      if(bq>95) bq=95;
+//    }
+//  }
+//
+//  const_cast<nngroups_t &>(g).groupquality=bq;
+//}
+//
+//#endif
+
+
+
+
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+
+void Contig::zeroStats()
+{
+  CON_stats.statsvalid=false;
+
+  CON_stats.conlength=0;
+  CON_stats.conlength_nogap=0;
+
+  CON_stats.AinC=0;
+  CON_stats.CinC=0;
+  CON_stats.GinC=0;
+  CON_stats.TinC=0;
+  CON_stats.NinC=0;
+  CON_stats.XinC=0;
+  CON_stats.starInC=0;
+  CON_stats.IUPACinC=0;
+  CON_stats.FunnyInC=0;
+  CON_stats.starInR=0;
+  CON_stats.NinR=0;
+
+  CON_stats.gccontent=0.0;
+
+  CON_stats.numSRMc=0;
+  CON_stats.numWRMc=0;
+  CON_stats.numSTMU=0;
+  CON_stats.numSTMS=0;
+
+  CON_stats.avg_coverage=0.0;
+  CON_stats.avg_conqual=0;
+
+  CON_stats.numnocoverage=0;
+
+  CON_stats.max_coverage=0;
+
+  CON_stats.total_reads=0;
+  CON_stats.numreads_withqual=0;
+  CON_stats.numreads_noqual=0;
+
+  for(uint32 i=0; i<Read::SEQTYPE_END; i++){
+    CON_stats.max_covperst[i]=0;
+    CON_stats.avg_covperst[i]=0.0;
+    CON_stats.readsperst[i]=0;
+    CON_stats.readlenperst[i]=0;
+  }
+}
+
+
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+
+void Contig::calcStats()
+{
+  FUNCSTART("void Contig::calcStats()");
+
+  if(CON_valid==0){
+    throw Notify(Notify::INTERNAL, THISFUNC, "Object not valid.");
+  }
+  if(CON_valid!=CON_VALID){
+    throw Notify(Notify::INTERNAL, THISFUNC, "Object probably trashed.");
+  }
+
+  if(CON_stats.statsvalid) return;
+
+  zeroStats();
+  finalise();
+
+  string consseq;
+  vector<base_quality_t> consqual;
+  
   newConsensusGet(consseq, consqual);
 
   CON_stats.conlength=CON_counts.size();
 
-  // using a pointer to CON_counts is (a lot) faster than accessing it
+  // avg. coverage of solexa and solid must be made differently than 
+  //  for sanger & 454 (because of merged reads)
+  uint64 actcovsxa=0;
+  uint64 sumcovsxa=0;
+  uint64 actcovsid=0;
+  uint64 sumcovsid=0;
+
+  // using a pointer to CON_counts is (a lot) faster than accessing it 
   //  via [] each time
-  auto ccI=CON_counts.begin();
+  cccontainer_t::iterator ccI=CON_counts.begin();
 
   //cout << "tililili! " << CON_name << '\n';
-  for(uint32 ci=0; ci<CON_counts.size(); ++ci, ++ccI){
-    if(consseq[ci]!='*') ++CON_stats.conlength_nogap;
+  for(uint32 ci=0; ci<CON_counts.size(); ci++, ccI++){
+    if(consseq[ci]!='*') CON_stats.conlength_nogap++;
     //cout << ci << '\t' << consseq[ci] << '\n';
     switch(toupper(consseq[ci])){
     case 'A':{
-      ++CON_stats.AinC;
+      CON_stats.AinC++;
       break;
     }
     case 'C':{
-      ++CON_stats.CinC;
+      CON_stats.CinC++;
       break;
     }
     case 'G':{
-      ++CON_stats.GinC;
+      CON_stats.GinC++;
       break;
     }
     case 'T':{
-      ++CON_stats.TinC;
+      CON_stats.TinC++;
       break;
     }
     case '*':{
-      ++CON_stats.starInC;
+      CON_stats.starInC++;
       break;
     }
     case '-':
     case 'N': {
-      ++CON_stats.NinC;
+      CON_stats.NinC++;
       break;
     }
     case 'X':{
-      ++CON_stats.XinC;
+      CON_stats.XinC++;
       break;
     }
     default: {
       if(dptools::isValidIUPACBase(toupper(consseq[ci]))){
-	++CON_stats.IUPACinC;
+	CON_stats.IUPACinC++;
       }else{
-	++CON_stats.FunnyInC;
+	CON_stats.FunnyInC++;
       }
     }
     }
@@ -685,36 +3364,45 @@ void Contig::calcStats()
     // this is only good for backbones with one read, but cannot
     //   be helped at the moment
     // alternative would be a pre-analysis: use array size of CON_counts,
-    //   go thorugh all reads (non backbone, non rail) and set to 1
+    //   go thorugh all reads (non backbone, non rail) and set to 1 
     //   for position covered
-    if(ccI->getBBChar()!='@' && ccI->total_cov==1){
-      ++CON_stats.numnocoverage;
+    if(ccI->backbonechar!='@' && ccI->total_cov==1){
+      CON_stats.numnocoverage++;
     }
 
     CON_stats.max_coverage=max(CON_stats.max_coverage,
 			       static_cast<uint32>(ccI->total_cov));
-    for(uint32 i=0; i<ReadGroupLib::SEQTYPE_END; ++i){
-      CON_stats.totalbasesperst[i]+=static_cast<uint64>(ccI->seqtype_cov[i]);
+    for(uint32 i=0; i<Read::SEQTYPE_END; i++){
       CON_stats.max_covperst[i]=max(CON_stats.max_covperst[i],
 				    static_cast<uint32>(ccI->seqtype_cov[i]));
     }
 
+    // 100% mapped Solexa/SOLiD reads must be accounted for a bit differently
+
+    actcovsxa=static_cast<uint64>(ccI->seqtype_cov[Read::SEQTYPE_SOLEXA]);
+    sumcovsxa+=actcovsxa;
+
+    CON_stats.max_covperst[Read::SEQTYPE_SOLEXA]=
+      max(CON_stats.max_covperst[Read::SEQTYPE_SOLEXA],static_cast<uint32>(actcovsxa));
+	  
+    actcovsid=static_cast<uint64>(ccI->seqtype_cov[Read::SEQTYPE_ABISOLID]);
+    sumcovsid+=actcovsid;
+
+    CON_stats.max_covperst[Read::SEQTYPE_ABISOLID]=
+      max(CON_stats.max_covperst[Read::SEQTYPE_ABISOLID],static_cast<uint32>(actcovsid));
+
     CON_stats.starInR+=ccI->star;
     CON_stats.NinR+=ccI->N;
   }
 
-  // ok, in the section above, rail reads would have been also counted in
+  // ok, in the section above, rail reads would have been also counted in 
   //  (in .coverage)
-  // compute reads statistics and remove rail bases from base statistics
+  // compute reads numbers
 
   {
-    auto cI=CON_reads.begin();
-    for(;cI!=CON_reads.end();++cI){
-      if(cI->isRail()){
-	CEBUG("Rail: " << cI->getName() << ": " << CON_stats.totalbasesperst[cI->getSequencingType()]);
-	CON_stats.totalbasesperst[cI->getSequencingType()]-=cI->getLenClippedSeq();
-	CEBUG(" -> " << CON_stats.totalbasesperst[cI->getSequencingType()] << endl);
-      }else{
+    vector<contigread_t>::const_iterator cI=CON_reads.begin();
+    for(;cI!=CON_reads.end();cI++){
+      if(!cI->read.isRail()){
 
 	// Nono, backbones must be counted in!
 	// Scenario: assembly at 6x used as backbone, assembled further 1x
@@ -723,30 +3411,42 @@ void Contig::calcStats()
 	//  would want
 	// && !cI->read.isBackbone()) {
 
-	++CON_stats.total_reads;
-	CON_stats.readsperst[cI->getSequencingType()]++;
-	if(cI->hasQuality()){
-	  CON_stats.numreads_withqual++;
+	CON_stats.total_reads++;
+	CON_stats.readsperst[cI->read.getSequencingType()]++;
+	if(cI->orpid>=0){
+	  CON_stats.readlenperst[cI->read.getSequencingType()]+=CON_readpool->getRead(cI->orpid).getLenClippedSeq();
+	  if(cI->read.hasQuality()){
+	    CON_stats.numreads_withqual++;
+	  }else{
+	    CON_stats.numreads_noqual++;
+	  }
 	}else{
-	  CON_stats.numreads_noqual++;
+	  CON_stats.readlenperst[cI->read.getSequencingType()]+=cI->read.getLenClippedSeq();
 	}
       }
     }
   }
 
-  CON_stats.avg_coverage=0.0;
+  CON_stats.readlenperst[Read::SEQTYPE_SOLEXA]=static_cast<uint32>(sumcovsxa);
+  CON_stats.readlenperst[Read::SEQTYPE_ABISOLID]=static_cast<uint32>(sumcovsid);
+
   if(!CON_counts.empty()){
-    uint64 totalbases=0;
-    for(uint32 sti=0; sti<ReadGroupLib::SEQTYPE_END; ++sti){
-      CON_stats.avg_covperst[sti]=static_cast<double>(CON_stats.totalbasesperst[sti])/CON_counts.size();
-      totalbases+=CON_stats.totalbasesperst[sti];
+    CON_stats.avg_coverage=0.0;
+    for(uint32 i=0; i<Read::SEQTYPE_END; i++){
+      if(CON_stats.readlenperst[i]>0.0){
+	CON_stats.avg_covperst[i]=static_cast<double>(CON_stats.readlenperst[i])/(CON_counts.size()- CON_stats.numnocoverage);
+	CON_stats.avg_coverage+=CON_stats.avg_covperst[i];
+      }
     }
-    CON_stats.avg_coverage=static_cast<double>(totalbases)/CON_counts.size();
   }
 
   {
+    vector<base_quality_t>::const_iterator I=consqual.begin();
     double qual=0.0;
-    for(auto & cqe : consqual) qual+=static_cast<double>(cqe);
+    while(I!=consqual.end()){
+      qual+=static_cast<double>(*I);
+      I++;
+    }
     CON_stats.avg_conqual=static_cast<uint16>((qual/consseq.size())+.5);
   }
 
@@ -757,9 +3457,6 @@ void Contig::calcStats()
   // IUPACs are perhaps not set yet
   updateStatsFromConsensusTags(true, true, false, true, true);
 
-  CON_stats.contains_long_repeats_only=CON_contains_long_repeats_only;
-  CON_stats.islargecontig=0; // undefined, to be set by assembly_info
-
   CON_stats.statsvalid=true;
 
   FUNCEND();
@@ -788,6 +3485,7 @@ void Contig::updateStatsFromConsensusTags(bool countSRMcs, bool countWRMcs, bool
     if(countSTMUs && ctI->identifier == CON_tagentry_idSTMU) CON_stats.numSTMU++;
     if(countSTMSs && ctI->identifier == CON_tagentry_idSTMS) CON_stats.numSTMS++;
   }
+  
 }
 
 
@@ -801,7 +3499,7 @@ void Contig::updateStatsFromConsensusTags(bool countSRMcs, bool countWRMcs, bool
 void Contig::setContigName(const string & name)
 {
   FUNCSTART("void Contig::setContigName(const string & name)");
-
+  
   CON_name=name;
 
   FUNCEND();
@@ -836,14 +3534,6 @@ const string & Contig::getContigName() const
     ostr << "contig";
   }
 
-  if(CON_contains_majority_digitallynormalised_reads==0){
-    const_cast<Contig *>(this)->priv_calcNumDigitallyNormalisedReads();
-  }
-
-  if(CON_contains_majority_digitallynormalised_reads>0){
-    ostr << "_dn";
-  }
-
   if(CON_reads.size()>1) {
     if(CON_contains_long_repeats_only){
       ostr << "_rep_c" << CON_id;
@@ -856,89 +3546,11 @@ const string & Contig::getContigName() const
 
   //string cname=ostr.str();
   CON_name=ostr.str();
-
+  
   FUNCEND();
   return CON_name;
 }
 
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-void Contig::priv_calcNumDigitallyNormalisedReads()
-{
-  CON_contains_majority_digitallynormalised_reads=-1;
-
-  //if(CON_reads.size()>6){
-  //  auto crI=CON_reads.begin();
-  //  uint64 numdn=0;
-  //  for(; crI!=CON_reads.end(); ++crI){
-  //    if(crI->hasTag(Read::REA_tagentry_idDGNr)) ++numdn;
-  //  }
-  //  if(numdn*10000/CON_reads.size() > 3000){
-  //    CON_contains_majority_digitallynormalised_reads=1;
-  //  }
-  //}
-
-  auto crI=CON_reads.begin();
-  uint64 numdn=0;
-  for(; crI!=CON_reads.end(); ++crI){
-    if(crI->getDigiNormMultiplier()>1){
-      CON_contains_majority_digitallynormalised_reads=1;
-      break;
-    }
-  }
-}
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-uint32 Contig::getNumBackbones() const
-{
-  uint32 ret=0;
-  for(uint32 rgi=0; rgi<CON_readsperreadgroup.size(); ++rgi){
-    if(CON_readsperreadgroup[rgi]>0
-       && ReadGroupLib::getReadGroupID(rgi).isBackbone()) ret+=CON_readsperreadgroup[rgi];
-  }
-  return ret;
-}
-
-
-/*************************************************************************
- *
- * Returns strain IDs of backbone reads
- * if no bb read in contig, an empty vector
- *
- *
- *************************************************************************/
-
-void Contig::getStrainsOfBackbone(vector<int32> & sob) const
-{
-  sob.clear();
-  for(uint32 rgi=0; rgi<CON_readsperreadgroup.size(); ++rgi){
-    if(CON_readsperreadgroup[rgi]) {
-      auto rgid=ReadGroupLib::getReadGroupID(rgi);
-      if(rgid.isBackbone()){
-	sob.push_back(rgid.getStrainID());
-      }
-    }
-  }
-
-  // multiple read groups may be present for the same strain ...
-  if(sob.size()>1){
-    sort(sob.begin(),sob.end());
-    unique(sob.begin(),sob.end());
-  }
-
-  return;
-}
 
 ///*************************************************************************
 // *
@@ -1018,11 +3630,13 @@ void Contig::setSpecialSRAddConditions(const int32 maxtotalerrors, const int32 m
  *
  *************************************************************************/
 
-void Contig::addFirstRead(int32 id, int8 direction)
+void Contig::addFirstRead(int32 id, uint32 direction)
 {
-  FUNCSTART("void Contig::addFirstRead(uint32 id, int8 direction)");
+  FUNCSTART("void Contig::addFirstRead(uint32 id, uint32 direction)");
 
-  BUGIFTHROW(!CON_reads.empty(), "used addFirstRead while there are already reads in contig.");
+  if(!CON_reads.empty()){
+    throw Notify(Notify::INTERNAL, THISFUNC, "used addFirstRead while there are already reads in contig.");
+  }
 
   definalise();
   CON_last_dangerous_overlaps.clear();
@@ -1031,53 +3645,42 @@ void Contig::addFirstRead(int32 id, int8 direction)
   CEBUG("Len of clipped read: " << len << endl);
 
   CON_counts.resize(len,CON_concounts_zero);
+  CON_reads.reserve(CON_READSSTARTSIZE);
 
   //check in this first read
-  CON_reads.placeRead(CON_readpool->getRead(id),id,0,direction);
+  {
+    contigread_t tmp;
 
-  if(CON_readpool->getRead(id).getTemplateID()>=0){
-    CON_templates_present.insert(CON_readpool->getRead(id).getTemplateID());
+    tmp.offset=0;
+    tmp.orpid=id;
+    tmp.direction=direction;
+    
+    CON_reads.push_back(tmp);
+
+    CON_reads[0].read=CON_readpool->getRead(id);
   }
 
-  auto coveragemultiplier=CON_readpool->getRead(id).getDigiNormMultiplier();
+  if(CON_reads[0].read.getTemplateID()>=0){
+    CON_templates_present.insert(CON_reads[0].read.getTemplateID());
+  }
 
   if(direction>0){
     updateCountVectors(0,
 		       len,
 		       CON_readpool->getRead(id).getClippedSeqIterator(),
 		       CON_readpool->getRead(id).getSequencingType(),
-		       true,
-		       coveragemultiplier);
+		       true);
     // Put base locks in CON_counts that this read produces
     initialiseBaseLocks();
   }else{
-    MIRANOTIFY(Notify::INTERNAL, "untested direction < 0");
-  }
-
-  //cout << "JJJJJJJ " << CON_readsperstrain.size() << " " << static_cast<uint32>(ReadGroupLib::getNumOfStrains()) << endl;
-  if(CON_readsperstrain.size() < ReadGroupLib::getNumOfStrains()){
-    CON_readsperstrain.resize(ReadGroupLib::getNumOfStrains(),0);
+    throw Notify(Notify::INTERNAL, THISFUNC, "untested direction < 0");
   }
-  CON_readsperstrain[CON_readpool->getRead(id).getStrainID()]=coveragemultiplier;
-  //cout << "JJJJJJJ " << CON_readsperstrain.size() << " " << static_cast<uint32>(ReadGroupLib::getNumOfStrains()) << endl;
 
-  if(CON_readsperreadgroup.size() < ReadGroupLib::getNumReadGroups()){
-    CON_readsperreadgroup.resize(ReadGroupLib::getNumReadGroups(),0);
-  }
-  CON_readsperreadgroup[CON_readpool->getRead(id).getReadGroupID().getLibId()]=coveragemultiplier;
-
-  if(CON_readpool->getRead(id).getLenClippedSeq() > CON_longestreadseen){
-    CON_longestreadseen=static_cast<int32>(CON_readpool->getRead(id).getLenClippedSeq());
-  }
-  if(!CON_readpool->getRead(id).isBackbone() && CON_readpool->getRead(id).getLenClippedSeq() > CON_longestnonbbreadseen){
-    CON_longestnonbbreadseen=static_cast<int32>(CON_readpool->getRead(id).getLenClippedSeq());
-  }
-  // should never happen as rails should be added in a different manner ... but one never knows
-  // maybe in future?
-  if(CON_readpool->getRead(id).isRail() && CON_readpool->getRead(id).getLenClippedSeq() > CON_longestrailseen){
-    CON_longestrailseen=static_cast<int32>(CON_readpool->getRead(id).getLenClippedSeq());
+  //cout << "JJJJJJJ " << CON_readsperstrain.size() << " " << CON_readpool->getNumOfStrainInReadpool() << endl;
+  if(CON_readsperstrain.size() < CON_readpool->getNumOfStrainInReadpool()){
+    CON_readsperstrain.resize(CON_readpool->getNumOfStrainInReadpool(),0);
   }
-
+  CON_readsperstrain[CON_readpool->getRead(id).getStrainID()]=1;
   if(CON_fixedconsseq.size()){
     nukeSTLContainer(CON_fixedconsseq);
     nukeSTLContainer(CON_fixedconsqual);
@@ -1089,34 +3692,28 @@ void Contig::addFirstRead(int32 id, int8 direction)
 
 
 
+
+
+
 /*************************************************************************
  *
  * addRead_wrapped might change some alignment parameters
- *
- * returns:
- *   errstat for communicating errors
- *   templateguess for communicating measure template info
- *
  * as it returns from a number of different points within the loop,
- *  setting back original this function takes care to set everything back
+ *  setting back original this function takes care to set everything back 
  *  to normal if needed.
  *
  *************************************************************************/
 
 //#define BUGHUNT
 
-void Contig::addRead(vector<Align> & aligncache, const AlignedDualSeqFacts * initialadsf, int32 refid, int32 newid, int32 direction_frnid, bool newid_ismulticopy, int32 forcegrow, templateguessinfo_t & templateguess, errorstatus_t & errstat)
+void Contig::addRead(vector<Align> & aligncache, const AlignedDualSeqFacts * initialads, int32 refid, int32 newid, int32 direction_frnid, bool newid_ismulticopy, int32 forcegrow, errorstatus_t & errstat)
 {
-  FUNCSTART("void Contig::addRead(vector<Align> & aligncache, const AlignedDualSeqFacts * initialadsf, int32 refid, int32 newid, int32 direction_frnid, bool newid_ismulticopy, int32 forcegrow, templateguess_t & templateguess, errorstatus_t & errstat)");
-
-  //setCEBUGFlag(newid,refid);
-
-  paranoiaBUGIF(aligncache.size()!=ReadGroupLib::SEQTYPE_END,
-		MIRANOTIFY(Notify::INTERNAL, "aligncache is not size of available sequencing types???"));
+  FUNCSTART("void Contig::addRead(vector<Align> & aligncache, const AlignedDualSeqFacts * initialads, int32 refid, int32 newid, int32 direction_frnid, errorstatus_t & errstat)");
 
-  templateguess.rgid.resetLibId();
+  paranoiaBUGIF(aligncache.size()!=Read::SEQTYPE_END, 
+		throw Notify(Notify::INTERNAL, THISFUNC, "aligncache is not size of available sequencing types???"));
 
-  // this is ugly: save the align params because
+  // this is ugly: save the align parames because
   //  addRead_wrapped() might change some *sigh*
   align_parameters oldalignparams=
     (*CON_miraparams)[CON_readpool->getRead(newid).getSequencingType()].getAlignParams();
@@ -1126,78 +3723,87 @@ void Contig::addRead(vector<Align> & aligncache, const AlignedDualSeqFacts * ini
     {
       //rotate
       string system_rmdir = static_cast<string>("mv addRead_debug_pre.log addRead_debug_pre.log1");
-      int tmp=system(system_rmdir.c_str());
+      int tmp=system(system_rmdir.c_str()); 
       system_rmdir = static_cast<string>("mv addRead_debug_post.log addRead_debug_post.log1");
-      tmp=system(system_rmdir.c_str());
+      tmp=system(system_rmdir.c_str()); 
       (void) tmp;
 
       ofstream eout("addRead_debug_pre.log", ios::out | ios::trunc);
+      Read::setCoutType(Read::AS_MAF);
+      setCoutType(AS_MAF);
       eout << "This file is for debugging and should never be seen by users!\n\n"
 	"If you do see it, contact the author (bach at chevreux.org) immediately\n\n"
 	"addRead_debug_pre.log!\n\n";
-      priv_dumpReplay(eout,initialadsf,refid,newid,direction_frnid,newid_ismulticopy,forcegrow);
+      if(initialads!=NULL) eout << "\n\n\ninitialads:\n" << *initialads;
+      eout << "\n\nrefid: " << refid << " (" << CON_readpool->getRead(refid).getName()
+	   << ")\nnewid: " << newid << " (" << CON_readpool->getRead(newid).getName()
+	   << ")\ndirection_frnid: " << direction_frnid
+	   << "\nnewid_ismulticopy: " << newid_ismulticopy
+	   << "\nforcegrow: " << forcegrow
+	   << "\n\nTrying read :\n" << CON_readpool->getRead(newid)
+	   << endl
+	   << "\nCurrent contig:\n" << *this
+	   << endl;
     }
 #endif
 
     addRead_wrapped(aligncache,
-		    initialadsf,
+		    initialads,
 		    refid,
 		    newid,
 		    direction_frnid,
 		    newid_ismulticopy,
 		    forcegrow,
-		    templateguess,
 		    errstat);
 
-    if(errstat.code!=ENOERROR){
-      // remove an eventual guess for template placement
-      templateguess.rgid.resetLibId();
-      templateguess.splace_seen=ReadGroupLib::SPLACE_UNKNOWN;
-      templateguess.tsize_seen=0;
-
-      // check if refid has been put into reads_affected by the contig
-      // if not, warn and dump
-      bool isin=false;
-      for(auto raid : errstat.reads_affected){
-	if(raid == refid){
-	  isin=true;
-	  break;
-	}
-      }
-      if(!isin){
-	// TODO: revert back to throwing at some point
-	cout << "\nWARNING/ERROR: ignored a missing refid" << endl;
-	errstat.reads_affected.push_back(refid);
-	//cout << "whooops, no refid? I see:\n";
-	//for(auto raid : errstat.reads_affected){
-	//  cout << CON_readpool->getRead(raid).getName() << endl;
-	//}
-	//BUGIFTHROW(true,"WARNING/ERROR: contig did not put refid into affected reads. Please file a bug report to\n\thttps://sourceforge.net/apps/trac/mira-assembler/\nand please send a mail to\n\tmira_talk at freelists.org\n");
-      }
-    }
-
 #ifdef BUGHUNT
     {
       ofstream eout("addRead_debug_post.log", ios::out | ios::trunc);
+      Read::setCoutType(Read::AS_MAF);
+      setCoutType(AS_MAF);
       eout << "This file is for debugging and should never be seen by users!\n\n"
 	"If you do see it, contact the author (bach at chevreux.org) immediately\n\n"
 	"addRead_debug_post.log!\n\n";
-      dumpReplay(eout,initialadsf,refid,newid,direction_frnid,newid_ismulticopy,forcegrow);
+      if(initialads!=NULL) eout << "\n\n\ninitialads:\n" << *initialads;
+      eout << "\n\nrefid: " << refid << " (" << CON_readpool->getRead(refid).getName()
+	   << ")\nnewid: " << newid << " (" << CON_readpool->getRead(newid).getName()
+	   << ")\ndirection_frnid: " << direction_frnid
+	   << "\nnewid_ismulticopy: " << newid_ismulticopy
+	   << "\nforcegrow: " << forcegrow
+	   << "\n\nUsed read :\n" << CON_readpool->getRead(newid)
+	   << endl
+	   << "\nNew contig:\n" << *this
+	   << endl;
     }
 #endif
 
   }
   catch(Notify n){
     ofstream eout("addReaderror_REPLAY_do_not_delete.log", ios::out | ios::trunc);
-    priv_dumpReplay(eout,initialadsf,refid,newid,direction_frnid,newid_ismulticopy,forcegrow);
+    Read::setCoutType(Read::AS_MAF);
+    setCoutType(AS_MAF);
+    eout << "This file allows to replay an error that MIRA just encountered\n\n"
+      "Please do not delete but contact the author (bach at chevreux.org) immediately\n\n"
+      "addRead_Error!\n\n"
+	 << "\n\n\ninitialads:\n" << *initialads
+	 << "\n\nrefid: " << refid << " (" << CON_readpool->getRead(refid).getName()
+	 << ")\nnewid: " << newid << " (" << CON_readpool->getRead(newid).getName()
+	 << ")\ndirection_frnid: " << direction_frnid
+	 << "\nnewid_ismulticopy: " << newid_ismulticopy
+	 << "\nforcegrow: " << forcegrow
+	 << "\n\nOffending read:" << CON_readpool->getRead(newid)
+	 << endl
+	 << "\nOffending contig: " << *this
+	 << endl;
+    eout.close();
+
     cout << "\n\n\nA file named 'addReaderror_REPLAY_do_not_delete.log' has been written"
       "\nto the working directory. Please send it to the author to get that bug fixed!\n\n\n";
     n.handleError(THISFUNC);
   }
 
   //CON_miraparams->setAlignParams(oldalignparams);
-  //(*CON_miraparams)[CON_readpool->getRead(newid).getSequencingType()].setAlignParams(oldalignparams);
-  (*CON_miraparams)[CON_readpool->getRead(newid).getSequencingType()].getNonConstAlignParams()=oldalignparams;
+  (*CON_miraparams)[CON_readpool->getRead(newid).getSequencingType()].setAlignParams(oldalignparams);
 
   FUNCEND();
 }
@@ -1208,43 +3814,54 @@ void Contig::addRead(vector<Align> & aligncache, const AlignedDualSeqFacts * ini
  *
  *
  *************************************************************************/
+//#define CLOCK_STEPS
+#ifdef CLOCK_STEPS
+  enum{USCLO_PRE=0,
+	 USCLO_DIR, USCLO_XCUT, USCLO_TEMPL1, USCLO_SWALIGN,
+	 USCLO_PREINSCHK, 
+	 USCLO_INSCON, 
+	 USCLO_UPDBLOCKS, USCLO_DELREAD,
+	 USCLO_ANRMBZ, USCLO_END};
+#endif
 
-//#define CEBUGFLAG
 //#define CEBUG(bla)   {cout << bla; cout.flush();}
 //#define CEBUGF(bla)  {cout << bla; cout.flush();}
+//#define CEBUGFLAG
 
 //#define CEBUG(bla)   {if(docebug) {cout << bla; cout.flush();}}
 
-#define CEBUG(bla)
-
-void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFacts * initialadsf, int32 refid, int32 newid, int32 direction_frnid, bool newid_ismulticopy, int32 forcegrow, templateguessinfo_t & templateguess, errorstatus_t & errstat)
+void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFacts * initialads, int32 refid, int32 newid, int32 direction_frnid, bool newid_ismulticopy, int32 forcegrow, errorstatus_t & errstat)
 {
-  FUNCSTART("void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFacts * initialadsf, int32 refid, int32 newid, int32 direction_frnid, bool newid_ismulticopy, int32 forcegrow, errorstatus_t & errstat)");
+  FUNCSTART("void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFacts * initialads, int32 refid, int32 newid, int32 direction_frnid, bool newid_ismulticopy, int32 forcegrow, errorstatus_t & errstat)");
 
-  //BUGIFTHROW(CON_cebugflag && CON_readpool->getRead(newid).getName()=="G8BUD:102:933","gna");
+#ifdef CLOCK_STEPS
+  vector<suseconds_t> us_steps(USCLO_END,0);
+  timeval us_start;
+  gettimeofday(&us_start,NULL);
+#endif
 
 //#define ALIGNCHECK
 //#define EXTRATRACEHELP
 
-  //bool docebug=false;
-  //if(CON_readpool->getRead(newid).getName()=="MISEQ:5:000000000-A1BMW:1:1101:25577:9445/1") {
-  //  docebug=true;
-  //}
+//  bool docebug=false;
+//  if(CON_readpool->getRead(newid).getName()=="E0K6C4E02GJT3U") {
+//    docebug=true;
+//    assout::saveAsCAF(*this, "debug_co_addread.caf", true);
+//  }
 
-  timeval us_start;
-  gettimeofday(&us_start,nullptr);
+  if(!CON_reads.empty() && CON_reads[0].read.isBackbone()) CON_tmpcons_from_backbone=true;
 
-  if(CON_readpool->getRead(newid).getLenClippedSeq()==0){
-    cout << "Gaaaaaah! Trying to add a read of length 0???\n";
-    Read::setCoutType(Read::AS_TEXT);
-    cout << CON_readpool->getRead(newid) << endl;
-    MIRANOTIFY(Notify::INTERNAL, "Gaaaaaah! Trying to add a read of length 0???");
-  }
+  bool docebug=false;
 
-  if(getNumBackbones()>0) CON_tmpcons_from_backbone=true;
+//  docebug=true;
+//  if(CON_id>=195) {
+//    docebug=true;
+//  }
 
   errstat.code=ENOERROR;
   errstat.reads_affected.clear();
+  errstat.srmb_reads_affected.clear();
+  errstat.proposed_cutback=-1;
 
   uint8 newreadseqtype=CON_readpool->getRead(newid).getSequencingType();
   MIRAParameters & rt_params=(*CON_miraparams)[newreadseqtype];
@@ -1254,32 +3871,30 @@ void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFac
 
 #ifndef PUBLICQUIET
   cout << "###Adding: " <<CON_readpool->getRead(newid).getName() << " ("
-       << ReadGroupLib::getShortNameOfSequencingType(newreadseqtype)
+       << Read::getShortNameOfSequencingType(newreadseqtype)
        << "," << newid << ")\t"
-       << static_cast<uint16>(CON_readpool->getRead(newid).getStrainID()) << " (" << CON_readpool->getRead(newid).getStrainName() << ") ";
+       << static_cast<uint16>(CON_readpool->getRead(newid).getStrainID()) << " (" << CON_readpool->getRead(newid).getStrain() << ") ";
 #endif
 
-#if CPP_READ_SEQTYPE_END != 8
-#error "This code is made for 8 sequencing types, adapt!"
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
 #endif
 
   switch(newreadseqtype){
-  case ReadGroupLib::SEQTYPE_SANGER :
-  case ReadGroupLib::SEQTYPE_454GS20 :
-  case ReadGroupLib::SEQTYPE_IONTORRENT :
-  case ReadGroupLib::SEQTYPE_PACBIOHQ :
-  case ReadGroupLib::SEQTYPE_PACBIOLQ :
-  case ReadGroupLib::SEQTYPE_TEXT :
-  case ReadGroupLib::SEQTYPE_SOLEXA : {
+  case Read::SEQTYPE_SANGER : 
+  case Read::SEQTYPE_454GS20 :
+  case Read::SEQTYPE_IONTORRENT :
+  case Read::SEQTYPE_PACBIO :
+  case Read::SEQTYPE_SOLEXA : {
     break;
   }
-  case ReadGroupLib::SEQTYPE_ABISOLID : {
-    MIRANOTIFY(Notify::INTERNAL, "Type ABI SOLiD needs more support 4.");
+  case Read::SEQTYPE_ABISOLID : {
+    throw Notify(Notify::INTERNAL, THISFUNC, "Type ABI SOLiD needs more support 4.");
     break;
   }
   default : {
     cout << "\nSeqtype: " << newreadseqtype << endl;
-    MIRANOTIFY(Notify::INTERNAL, "Trying to add unknown seqtype? Needs more code 4.");
+    throw Notify(Notify::INTERNAL, THISFUNC, "Trying to add unknown seqtype? Needs more code 4.");
   }
   }
 
@@ -1290,12 +3905,12 @@ void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFac
   cout << "Warning: PARANOIABUGTRACKFLAG is compiled!";
   if(CON_readpool->getRead(newid).hasValidData()==false){
     cout << "Read has no valid data???";
-    MIRANOTIFY(Notify::INTERNAL, "Read has no valid data???") ;
+    throw Notify(Notify::INTERNAL, THISFUNC, "Read has no valid data???") ;
   }
   if(CON_readpool->getRead(newid).checkRead()){
     cout << "Read " << newid << " in readpool is trashed\n";
     cout << CON_readpool->getRead(newid);
-    MIRANOTIFY(Notify::INTERNAL, "*sigh* read trashed") ;
+    throw Notify(Notify::INTERNAL, THISFUNC, "*sigh* read trashed") ;
   }
 #endif
 
@@ -1312,66 +3927,54 @@ void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFac
 	return;
   }
   // should be set by addFirstRead
-  BUGIFTHROW(CON_readsperstrain.size() < ReadGroupLib::getNumOfStrains(), "after addFirstRead: CON_readsperstrain.size() " << CON_readsperstrain.size() << " < ReadGroupLib::getNumOfStrains(() " << static_cast<uint16>(ReadGroupLib::getNumOfStrains()) << " ?");
-
-  //// do not check readsperreadgroup
-  //// Legal scenario: load two backbone, do a mapping, once first contig is done it will get CER reads
-  ////  and contig 2 does not know anything of that
-  //if(CON_readsperreadgroup.size() < ReadGroupLib::getNumReadGroups()){
-  //  ReadGroupLib::debugDumpReadGroupInfo(cout);
-  //  MIRANOTIFY(Notify::FATAL,"after addFirsRead: CON_readsperreadgroup.size() " << CON_readsperreadgroup.size() << " < CON_readpool->getNumReadGroups() " <<  ReadGroupLib::getNumReadGroups() << " ?");
-  //}
+  BUGIFTHROW(CON_readsperstrain.size() < CON_readpool->getNumOfStrainInReadpool(), "CON_readsperstrain.size() < CON_readpool->getNumOfStrainInReadpool() ?");
 
 #ifndef PUBLICQUIET
   cout << "From: " <<CON_readpool->getRead(refid).getName() << " ("
-       << ReadGroupLib::getShortNameOfSequencingType(CON_readpool->getRead(refid).getSequencingType())
+       << Read::getShortNameOfSequencingType(CON_readpool->getRead(refid).getSequencingType())
        << "," << refid << ")\t";
 
-  cout << initialadsf->getOverlapLen() << '/';
-  cout << static_cast<uint16>(initialadsf->getScoreRatio()) << "%\t";
+  cout << initialads->getOverlapLen() << '/';
+  cout << static_cast<uint16>(initialads->getScoreRatio()) << "%\t";
 #endif
 
-  BUGIFTHROW(CON_readpool->getRead(newid).isRail(),"Tried to add a rail???");
-
   {
     bool strangeerror=false;
-    if( !(initialadsf->getID1() == refid
-	  || initialadsf->getID2() == refid)) {
-      cout << "refid not in initialadsf???\n";
+    if( !(initialads->getID1() == refid
+	  || initialads->getID2() == refid)) {
+      cout << "refid not in initialads???\n";
       strangeerror=true;
     }
-    if( !(initialadsf->getID1() == newid
-	  || initialadsf->getID2() == newid)) {
-      cout << "newid not in initialadsf???\n";
+    if( !(initialads->getID1() == newid
+	  || initialads->getID2() == newid)) {
+      cout << "newid not in initialads???\n";
       strangeerror=true;
     }
     if(strangeerror){
-      MIRANOTIFY(Notify::INTERNAL,"Impossible error while adding read, investigate! This may be due faulty RAM.");
+      MIRANOTIFY(Notify::INTERNAL,"Strange error while adding read, investigate!");
     }
   }
 
 
-#if CPP_READ_SEQTYPE_END != 8
-#error "This code is made for 8 sequencing types, adapt!"
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
 #endif
 
   switch(CON_readpool->getRead(refid).getSequencingType()){
-  case ReadGroupLib::SEQTYPE_SANGER :
-  case ReadGroupLib::SEQTYPE_454GS20 :
-  case ReadGroupLib::SEQTYPE_IONTORRENT :
-  case ReadGroupLib::SEQTYPE_PACBIOHQ :
-  case ReadGroupLib::SEQTYPE_PACBIOLQ :
-  case ReadGroupLib::SEQTYPE_TEXT :
-  case ReadGroupLib::SEQTYPE_SOLEXA : {
+  case Read::SEQTYPE_SANGER :
+  case Read::SEQTYPE_454GS20 :
+  case Read::SEQTYPE_IONTORRENT :
+  case Read::SEQTYPE_PACBIO :
+  case Read::SEQTYPE_SOLEXA : {
     break;
   }
-  case ReadGroupLib::SEQTYPE_ABISOLID : {
-    MIRANOTIFY(Notify::INTERNAL, "Type ABI SOLiD needs more support 4a.");
+  case Read::SEQTYPE_ABISOLID : {
+    throw Notify(Notify::INTERNAL, THISFUNC, "Type ABI SOLiD needs more support 4a.");
     break;
   }
   default : {
     cout << "\nSeqtype: " << CON_readpool->getRead(refid).getSequencingType() << endl;
-    MIRANOTIFY(Notify::INTERNAL, "Having unknown seqtype as reference? Needs more code 4a.");
+    throw Notify(Notify::INTERNAL, THISFUNC, "Having unknown seqtype as reference? Needs more code 4a.");
   }
   }
 
@@ -1388,7 +3991,7 @@ void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFac
       dumpConReads();
       Read::setCoutType(Read::AS_TEXTSHORT);
       cout << CON_readpool->getRead(newid);
-      MIRANOTIFY(Notify::INTERNAL, "new ID already in contig???");
+      throw Notify(Notify::INTERNAL, THISFUNC, "new ID already in contig???");
     }
   }
 
@@ -1404,7 +4007,7 @@ void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFac
       dumpConReads();
       Read::setCoutType(Read::AS_TEXTSHORT);
       cout << CON_readpool->getRead(newid);
-      MIRANOTIFY(Notify::INTERNAL, "ref ID not in contig???");
+      throw Notify(Notify::INTERNAL, THISFUNC, "ref ID not in contig???");
     }
   }
 #endif
@@ -1413,18 +4016,52 @@ void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFac
   CEBUG("Newid len:" << CON_readpool->getRead(newid).getLenClippedSeq() << '\n');
 
   CEBUG("Refid: " << refid << endl);
-  CEBUG('\n'<< *initialadsf);
+  CEBUG('\n'<< *initialads);
 
 
-  CON_us_steps[USCLO_PRE]+=diffsuseconds(us_start);
-  gettimeofday(&us_start,nullptr);
+  //int32 offsetrefid=-1;
+  //int32 direction_refid=0;
+  //{
+  //  for(uint32 i=0;i<CON_reads.size(); i++){
+  //    if(CON_reads[i].id==refid){
+  //	offsetrefid=CON_reads[i].offset;
+  //	direction_refid=CON_reads[i].direction;
+  //	break;
+  //    }
+  //  }
+  //  if(offsetrefid==-1){
+  //    throw Notify(Notify::INTERNAL, THISFUNC, "RefID not found on contig?");
+  //  }
+  //}
 
-  auto conrefreadI = CON_reads.getIteratorOfReadpoolID(refid);
-  BUGIFTHROW(conrefreadI==CON_reads.end(),"RefID " << refid << " (" << CON_readpool->getRead(refid).getName() << ") not found on contig?");
-  int32 offsetrefid=conrefreadI.getReadStartOffset();
+  // initialise CON_maprpids_to_conreadsids if it's dirty (==empty)
+  if(CON_maprpids_to_conreadsids.empty()){
+    CON_maprpids_to_conreadsids.resize(CON_readpool->size(),-1);
+    for(int32 i=0;i<CON_reads.size(); i++){
+      if(CON_reads[i].orpid>=0){
+	CON_maprpids_to_conreadsids[CON_reads[i].orpid]=i;
+      }
+    }
+  }
 
-  //gna if(errstat.reads_affected.empty())
+#ifdef CLOCK_STEPS
+  us_steps[USCLO_PRE]=diffsuseconds(us_start);
+  gettimeofday(&us_start,NULL);
+#endif
+
+  contigread_t & conactrefread=CON_reads[CON_maprpids_to_conreadsids[refid]];
+  int32 offsetrefid=conactrefread.offset;
+  if(offsetrefid==-1){
+    throw Notify(Notify::INTERNAL, THISFUNC, "RefID not found on contig?");
+  }
+
+  //Read::setCoutType(Read::AS_FASTA);
+  //cout << conactrefread.read;
 
+
+
+  //gna if(errstat.reads_affected.empty())
+  
   if(!CON_allowedrefids.empty()){
     if(!CON_allowedrefids[refid]){
       errstat.code=EREFIDNOTALLOWED;
@@ -1432,9 +4069,9 @@ void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFac
 	// we did not compute xcut and ycut yet.
 	// to save time, we already stop here and take the positions
 	//  of the refid rail as xcut and ycut
-	priv_arw_getReadsAffected(refid, newid, errstat.reads_affected,
-				  conrefreadI.getReadStartOffset(),
-				  conrefreadI.getReadStartOffset()+conrefreadI->getLenClippedSeq());
+	getRailsAsReadsAffected(refid, errstat.reads_affected,
+				conactrefread.offset,
+				conactrefread.offset+conactrefread.read.getLenClippedSeq());
       }else{
 	errstat.reads_affected.push_back(refid);
       }
@@ -1445,20 +4082,21 @@ void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFac
 
 
 
-  int32 direction_refid=conrefreadI.getReadDirection();
+  int32 direction_refid=conactrefread.direction;
 
 
-  CON_us_steps[USCLO_DIR]+=diffsuseconds(us_start);
-  gettimeofday(&us_start,nullptr);
+#ifdef CLOCK_STEPS
+  us_steps[USCLO_DIR]=diffsuseconds(us_start);
+#endif
 
 
   int32 direction_newid_incontig=direction_refid*direction_frnid;
 
   CEBUG("dir_frnid: " << direction_frnid);
   CEBUG("\tdir_refid: " << direction_refid<< endl;);
-  CEBUG("Offset Refid:" << offsetrefid << " - " << offsetrefid+conrefreadI->getLenClippedSeq() <<endl;);
+  CEBUG("Offset Refid:" << offsetrefid<<endl;);
 
-  list<AlignedDualSeq>::const_iterator adsI;
+  list<AlignedDualSeq>::const_iterator I;
   //Align bla(CON_miraparams);
   list<AlignedDualSeq> madsl;
 
@@ -1468,7 +4106,7 @@ void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFac
   // xcut and ycut are defined [...[  (xcut including, ycut excluding)
 
   // the ycut is less critical, but also influences slightly the
-  //  speed of the banded SW ... there might be a little bit more to
+  //  speed of the banded SW ... there might be a little bit more to 
   //  compute
 
   int32 xcut=offsetrefid; // will be adapted
@@ -1476,24 +4114,24 @@ void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFac
   int32 xcutinc=1;
   int32 deltax;
   // same direction in contig and reference ads?
-  if(direction_refid*initialadsf->getSequenceDirection(refid)>0){
+  if(direction_refid*initialads->getSequenceDirection(refid)>0){
     // yes
-    if(initialadsf->getOffsetInAlignment(refid)==0){
+    if(initialads->getOffsetInAlignment(refid)==0){
       CEBUG("R1 offset.\n");
-      deltax=initialadsf->getOffsetInAlignment(newid);
+      deltax=initialads->getOffsetInAlignment(newid);
 
     }else{
       CEBUG("R2 offset.\n");
-      deltax=initialadsf->getOffsetInAlignment(refid);
+      deltax=initialads->getOffsetInAlignment(refid);
       xcutinc=-1;
     }
   }else{
-    if(initialadsf->getRightOffsetInAlignment(refid)==0){
+    if(initialads->getRightOffsetInAlignment(refid)==0){
       CEBUG("R3 offset.\n");
-      deltax=initialadsf->getRightOffsetInAlignment(newid);
+      deltax=initialads->getRightOffsetInAlignment(newid);
     }else{
       CEBUG("R4 offset.\n");
-      deltax=initialadsf->getRightOffsetInAlignment(refid);
+      deltax=initialads->getRightOffsetInAlignment(refid);
       xcutinc=-1;
     }
   }
@@ -1501,16 +4139,11 @@ void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFac
   CEBUG("deltax: " << deltax << '\n');
   CEBUG("xcutinc: " << xcutinc << '\n');
 
+#ifdef CLOCK_STEPS
+  gettimeofday(&us_start,NULL);
+#endif
 
   int32 runlength=CON_readpool->getRead(newid).getLenClippedSeq();
-  // BaCh 14.11.2012
-  // to accomodate for read mappings which have a lot of inserts, runlength must be increased
-  //  it may be that the length of the overlap is significantly larger than the initial read length
-  //  e.g. Illumina 100bp with a clean 15bp insert makes for a 115bp overlap
-  if(runlength < initialadsf->getOverlapLen()){
-    runlength=initialadsf->getOverlapLen();
-  }
-
   int32 ycut;
 
   // search for xcut: use refread sequence when possible,
@@ -1520,76 +4153,44 @@ void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFac
     const char * refseq;
     {
       if(direction_refid>0){
-	refseq=conrefreadI->getClippedSeqAsChar();
+	refseq=conactrefread.read.getClippedSeqAsChar();
       }else{
-	refseq=conrefreadI->getClippedComplementSeqAsChar();
+	refseq=conactrefread.read.getClippedComplementSeqAsChar();
       }
-      auto ccI=CON_counts.begin();
+      cccontainer_t::iterator ccI=CON_counts.begin();
       BOUNDCHECK(xcut, 0, CON_counts.size()+1);
       if(xcutinc<0 && xcut>0) xcut--;
       advance(ccI, xcut);
-      int32 refgaps=0;
-      bool refnotrail=!CON_readpool->getRead(refid).isRail();
       for(;deltax>=0; xcut+=xcutinc, refpos+=xcutinc, refseq+=xcutinc){
 	CEBUG("deltax: " << deltax << "\txcut: " << xcut);
-	if(refnotrail && refpos>=0 && refpos<conrefreadI->getLenClippedSeq()){
-	  //if(0){
-	  // BaCh 14.11.2012: hmmm ... I suppose I forgot to kill this branch (like in the similar loop below)
-	  // BaCh 2013-03-08: NO! I did not forget to kill that branch, it should actually survive
-	  //                  de-novo assemblies!!!
-	  //                  There are therefore two conflicting requirements: de-novo which needs to be as
-	  //                  exact as possible with regards to the reference sequence, and mapping which
-	  //                  "in the second mapping round" should try to adhere to the intermediate
-	  //                  consensus. Solution: take refread as long as possible if refread is not rail.
+	if(refpos>=0 && refpos<conactrefread.read.getLenClippedSeq()){
 	  CEBUG("\tRead: " << *refseq << '\n');
 	  if(*refseq!='*'){
 	    deltax--;
 	  }
 	  ccI+=xcutinc;
 	}else{
-	  // BaCh 06.12.2012 ; error reported by "Kris" on 26.11.2012
-	  //    "Trying to dereference an hditer pointing to end()???"
-	  //    ->Thrown: inline TT & HDeque::hditer::dereference() const
-	  //
-	  // I am mystified: where did the "+1" below come from?
-	  //     if(xcut>=0 && xcut<CON_counts.size()+1){
-	  // even more mystifying: how did it survive so long after switching to hdeque???
-	  //
-	  // extremely vexing: see comment from 16.05.2010 "Why on earth did I have +1"
-	  //  some 100 line below :-(((
-	  if(xcut>=0 && xcut<CON_counts.size()){
+	  if(xcut>=0 && xcut<CON_counts.size()+1){
 	    // this part mimicks the makeTmpConsenus() behaviour of calling stars
 	    if(CON_tmpcons_from_backbone
-	       && ccI->getOriginalBBChar()!='N'
-	       && ccI->getOriginalBBChar()!='X'
-	       && ccI->getOriginalBBChar()!='@'){
-	      if(ccI->getOriginalBBChar()!='*') {
-		CEBUG("\toBB1: (base) ");
+	       && ccI->backbonechar!='N'
+	       && ccI->backbonechar!='X'
+	       && ccI->backbonechar!='@'){
+	      if(ccI->backbonechar!='*') {
+		CEBUG("\tBB: (base)\n");
 		deltax--;
 	      }else{
-		CEBUG("\tBB1: * ");
-		++refgaps;
+		CEBUG("\tBB: *\n");
 	      }
-	      CEBUG(ccI->i_backbonecharorig << " " << ccI->i_backbonecharupdated << '\n');
 	    }else{
 	      ccctype_t maximum= max(ccI->A, max(ccI->C, max(ccI->G, ccI->T)));
-	      if(unlikely(ccI->total_cov==0)){
-		// BaCh 30.11.2012
-		// should normally never happen, certainly not in de-novo
-		// but the two-pass mapping may have this at the end of the contigs after first pass
-		//  (should I decide not to go the chompFront() / chompBack() after 1st pass)
-		//
-		// treat it like a base (well, will be N)
-		CEBUG("\tno read\n");
-		deltax--;
-	      }else if(maximum >0 && maximum > ccI->star) {
+	      if(maximum >0 && maximum > ccI->star) {
 		//if(maximum/4 >= ccI->star) {
 		if(maximum/4 >= (ccI->star)*2) {
 		  deltax--;
 		  CEBUG("\tCON: (base)\n");
 		}else{
 		  CEBUG("\tCON: *\n");
-		  ++refgaps;
 		}
 	      }else{
 		if(!((ccI->star >= ccI->X)
@@ -1598,7 +4199,6 @@ void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFac
 		  CEBUG("\tCON: (base)\n");
 		}else{
 		  CEBUG("\tCON: *\n");
-		  ++refgaps;
 		}
 	      }
 	    }
@@ -1611,36 +4211,21 @@ void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFac
 	  }
 	}
       }
-
-      // Bach 14.11.2012
-      // only important for mapping assemblies, and then only when ref sequence is from backbone, do not apply on de-novo!
-      if(CON_tmpcons_from_backbone){
-	// Step 1: have we landed in a gap? If yes, get the full length of the gap
-	while(xcut>=0 && xcut<CON_counts.size()+1){
-	  if(ccI->getOriginalBBChar()!='*') break;
-	  ++refgaps;
-	  xcut+=xcutinc;
-	  ccI+=xcutinc;
-	}
-      }
     }
-
+    
     CEBUG("xcut 1: " << xcut <<'\n');
-
+    
     // xcut, and therefore the initial ycut, may be way negative, beware!
     ycut=xcut;
     if(ycut<0) ycut=0;
-
+    
     {
-      auto ccI=CON_counts.begin();
+      cccontainer_t::iterator ccI=CON_counts.begin();
       if(ycut>0) advance(ccI, ycut);
-      int32 refgaps=0;
-      bool refnotrail=!CON_readpool->getRead(refid).isRail();
       for(;runlength>=0; ycut++, refpos++, refseq++){
 	CEBUG("runlength: " << runlength << "\tycut: " << ycut);
-	if(refnotrail && refpos>=0 && refpos<conrefreadI->getLenClippedSeq()){
-	  // also see comment in loop above regarding refnotrail and the whole if statement
-	  //if(0){
+	if(0){
+	  //if(refpos>=0 && refpos<conactrefread.read.getLenClippedSeq()){
 	  CEBUG("\tRead: " << *refseq << '\n');
 	  if(*refseq!='*'){
 	    runlength--;
@@ -1648,41 +4233,29 @@ void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFac
 	}else{
 	  // Changed 16.05.2010:
 	  // Found by using IndexedDeque segfaulting due to out of bounds
-	  // Why on earth did I have +1
+	  // Why on earth did I have +1 
 	  //  if(ycut>=0 && ycut<CON_counts.size()+1){
 	  if(ycut>=0 && ycut<CON_counts.size()){
 	    // this part mimicks the makeTmpConsenus() behaviour of calling stars
-	    if(CON_tmpcons_from_backbone
-	       && ccI->getBBChar()!='@'
-	       && ccI->getBBChar()!='N'
-	       && ccI->getBBChar()!='X'){
-	      if(ccI->getBBChar()!='*') {
-		CEBUG("\tBB2: (base) ");
+	    if(CON_tmpcons_from_backbone 
+	       && ccI->backbonechar!='@'
+	       && ccI->backbonechar!='N'
+	       && ccI->backbonechar!='X'){
+	      if(ccI->backbonechar!='*') {
+		CEBUG("\tBB: (base)\n");
 		runlength--;
 	      }else{
-		CEBUG("\tBB2: * ");
-		++refgaps;
+		CEBUG("\tBB: *\n");
 	      }
-	      CEBUG(ccI->i_backbonecharorig << " " << ccI->i_backbonecharupdated << '\n');
 	    }else{
 	      ccctype_t maximum= max(ccI->A, max(ccI->C, max(ccI->G, ccI->T)));
-	      	      if(unlikely(ccI->total_cov==0)){
-		// BaCh 30.11.2012
-		// should normally never happen, certainly not in de-novo
-		// but the two-pass mapping may have this at the end of the contigs after first pass
-		//  (should I decide not to go the chompFront() / chompBack() after 1st pass)
-		//
-		// treat it like a base (well, will be N)
-		CEBUG("\tno read\n");
-		--runlength;
-	      }else if(maximum >0 && maximum > ccI->star) {
+	      if(maximum >0 && maximum > ccI->star) {
 		//if(maximum/4 >= ccI->star) {
 		if(maximum/4 >= (ccI->star)*2) {
 		  runlength--;
 		  CEBUG("\tCON1: (base): " << *ccI << endl);
 		}else{
 		  CEBUG("\tCON1: *: " << *ccI << endl);
-		++refgaps;
 		}
 	      }else{
 		if(!((ccI->star >= ccI->X)
@@ -1691,7 +4264,6 @@ void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFac
 		  CEBUG("\tCON2: (base): " << *ccI << endl);
 		}else{
 		  CEBUG("\tCON2: *: " << *ccI << endl);
-		  ++refgaps;
 		}
 	      }
 	    }
@@ -1702,24 +4274,6 @@ void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFac
 	  }
 	}
       }
-
-      // Revised: 16.01.2013: Only for mapping where sequence comes from backbone!
-      // corrector for larger gaps where skim might not have told the whole truth by giving alignment
-      //  offset for right part of the alignment ... xcut would be to far right, too.
-      if(CON_tmpcons_from_backbone && refgaps){
-	CEBUG("refgaps? " << direction_frnid << "\t" << initialadsf->get5pLenContiguousMatch(newid) << "\t" << initialadsf->get3pLenContiguousMatch(newid) << "\n");
-	if(direction_frnid>0){
-	  if(initialadsf->get5pLenContiguousMatch(newid)==0 && initialadsf->get3pLenContiguousMatch(newid)>0){
-	    xcut-=refgaps;
-	    CEBUG("refgaps xcut corrector f: " << refgaps << '\n');
-	  }
-	}else{
-	  if(initialadsf->get5pLenContiguousMatch(newid)>0 && initialadsf->get3pLenContiguousMatch(newid)==0){
-	    xcut-=refgaps;
-	    CEBUG("refgaps xcut corrector r: " << refgaps << '\n');
-	  }
-	}
-      }
     }
   }
 
@@ -1731,28 +4285,28 @@ void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFac
   xcut-=2;
 
   CEBUG("xcut 2: " << xcut <<'\n');
-  CEBUG("ycut 2: " << ycut <<'\n');
 
 
   // in some cases, xcut may be > size of contig (and ycut anyway)
   //  or ycut < 0 (and xcut anyway)
-  // this can happen when a read is edited over and over again during
+  // this can happen when a read is edited over and over again during 
   //  contig assembly and then the expected offset in the adsfact
   //  is way off target
   // occurs with short matches at end of reads.
   //
   // only possibility to handle this at this stage: reject alignment
 
-  if(xcut >= static_cast<int32>(CON_counts.size()) || ycut < 0){
+  if(xcut> static_cast<int32>(CON_counts.size()) || ycut < 0){
 #ifndef PUBLICQUIET
     cout << "rej: no align found (bounds 1)\t";
     cout.flush();
 #endif
     errstat.code=ENOALIGN;
     errstat.reads_affected.push_back(refid);
-
-    CON_us_steps[USCLO_XCUT]+=diffsuseconds(us_start);
-
+#ifdef CLOCK_STEPS
+    us_steps[USCLO_XCUT]=diffsuseconds(us_start);
+    coutAddReadClocks(us_steps);
+#endif
     FUNCEND();
     return;
   }
@@ -1762,10 +4316,8 @@ void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFac
   //  if yes, go back as far as needed to find a non-gap
   // Can happen because of the xcut-=2 above:
   if(xcut>0){
-    auto ccI=CON_counts.begin();
+    cccontainer_t::iterator ccI=CON_counts.begin();
     BOUNDCHECK(xcut, 0, CON_counts.size()+1);
-    // we should not be out of bounds (see "bounds 1" check just above), but just in case
-    if(xcut==CON_counts.size()) --xcut;
     advance(ccI, xcut);
     while(xcut>0){
       ccctype_t maximum= max(ccI->A, max(ccI->C, max(ccI->G, ccI->T)));
@@ -1781,310 +4333,192 @@ void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFac
   	  break;
   	}
       }
-      --ccI;
-      --xcut;
+      ccI--;
+      xcut--;
     }
   }
 
-  CEBUG("xcut 3: " << xcut <<'\n');
-
-  // especially in mapping alignments with many SNPs/indels and partial
-  //  overlaps with the rail reads, we might have landed completely
-  //  outside the reference rail. Darn.
-  //
-  // let's deal with that. It's a hack, and a bad one.
-
-  // static_cast needed or gcc will convert RHS to unsigned, then LHS to unsigned ... and as xcut may be
-  //  negative, hilarity ensues.
-  if(xcut >= static_cast<int32>(offsetrefid + conrefreadI->getLenClippedSeq())){
-    xcut=offsetrefid + conrefreadI->getLenClippedSeq()-10;
-    if(xcut<0) xcut=0;
-  }
-  if(ycut <= offsetrefid){
-    ycut=offsetrefid+10;
-    if(ycut>CON_counts.size()) ycut=CON_counts.size();
-  }
-
-
   CEBUG("xcut final: " << xcut <<'\n');
   CEBUG("ycut final: " << ycut <<'\n');
 
-  BUGIFTHROW(xcut>ycut,"final: xcut " << xcut << " > ycut " << ycut);
+#ifdef CLOCK_STEPS
+  us_steps[USCLO_XCUT]=diffsuseconds(us_start);
+#endif
+
+  
 
-  CON_us_steps[USCLO_XCUT]+=diffsuseconds(us_start);
-  gettimeofday(&us_start,nullptr);
+#ifdef CLOCK_STEPS
+  gettimeofday(&us_start,NULL);
+#endif
 
 
   // Template handling1
 
   bool havematchingtemplatepartner=false;
 
-  if(CON_readpool->getRead(newid).getTemplatePartnerID() != -1){
-    // 1st: direction
-#ifndef PUBLICQUIET
-    cout << " tmplhand1 ";
-    cout << CON_readpool->getRead(newid).getTemplatePartnerID() << " ";
-    cout.flush();
-#endif
-    auto tppcrI=CON_reads.getIteratorOfReadpoolID(CON_readpool->getRead(newid).getTemplatePartnerID());
-   // is partner already in contig?
-    if(tppcrI==CON_reads.end()){
+  if(rt_params.getContigParams().con_use_template_information > 0){
+    int32 acttid=CON_readpool->getRead(newid).getTemplateID();
+    if(acttid >=0){
 #ifndef PUBLICQUIET
-      cout << "nic("
-	   << CON_readpool->getRead(newid).getTemplatePartnerID();
-      if(CON_readpool->getRead(newid).getTemplatePartnerID()>=0){
-	cout << " - " << CON_readpool->getRead(CON_readpool->getRead(newid).getTemplatePartnerID()).getName();
-      }
-      cout << ") ";
+      cout << " tmplhand1...";
       cout.flush();
 #endif
-    }else{
-      // assume the template matches
-      // if not, the checks below will correct for that
-      havematchingtemplatepartner=true;
-
-      // ** Check for direction **
-      if(CON_readpool->getRead(newid).getReadGroupID().getSegmentPlacementCode() != ReadGroupLib::SPLACE_UNKNOWN){
-#ifndef PUBLICQUIET
-	cout << "dir";
-	cout.flush();
-#endif
+      int32 tidcount=CON_templates_present.count(acttid);
+      // get that out ... strobed reads can have more than two reads per template
+      //  Sanger multiple sequencing of template too
+      //if(tidcount>1){
+      //	cout << *this;
+      //	throw Notify(Notify::INTERNAL, THISFUNC, "Template handling error, already present twice.");
+      //}
+      if(tidcount>0){
+	vector<contigread_t>::const_iterator I=CON_reads.begin();
+	while(I != CON_reads.end() && I->read.getTemplateID() != acttid) I++;
+	if(I==CON_reads.end()){
+	  cout << *this;
+	  throw Notify(Notify::INTERNAL, THISFUNC, "Another template handling error *sigh*.");
+	}
 
-	// ok, we found the read with the template which corresponds to the newly
-	//  to insert read. Now check if they meet the constraints.
+	// ok, we found the read with the template which corresponds to the newly 
+	//  to insert read. Now check if they meet the constraints. 
 	//  If not, do not insert
 
-#ifndef PUBLICQUIET
-	cout << "\ndni: " << static_cast<int32>(direction_newid_incontig);
-	cout << "\npdi: " << static_cast<int32>(tppcrI.getReadDirection());
-	cout << "\ntbd: " << static_cast<int32>(CON_readpool->getRead(newid).getTemplateBuildDirection());
-#endif
-	if(direction_newid_incontig*tppcrI.getReadDirection() != CON_readpool->getRead(newid).getTemplateBuildDirection()){
+	if(direction_newid_incontig*I->direction != CON_readpool->getRead(newid).getTemplateBuildDirection()){
 	  // not direction wanted, not good
 #ifndef PUBLICQUIET
 	  cout << "templ in wrong dir";
 #endif
-	  havematchingtemplatepartner=false;
-	  if(!CON_readpool->getRead(newid).getReadGroupID().getSPInfoOnly()){
-	    errstat.code=ETEMPLATEDIRECTION;
-	    if(xcut<0) xcut=0;
-	    if(static_cast<uint32>(ycut)>CON_counts.size()){
-	      ycut=CON_counts.size();
-	    }
-	    priv_arw_getReadsAffected(refid, newid, errstat.reads_affected, xcut, ycut);
-	    FUNCEND();
-	    return;
-	  }
-	}
-      }
-
-      // for segment placement and template size check, we need the positions in the contig
-
-      bool newreadisleft=true;
-
-      // Note: play it safe while adding right extend ... take only
-      //  part of it
-      int32 leftrx=xcut;
-      int32 leftry=ycut;
-      if(direction_newid_incontig>0) {
-	leftry+=CON_readpool->getRead(newid).getRightExtend()*2/3;
-      }else{
-	leftrx-=CON_readpool->getRead(newid).getRightExtend()*2/3;
-      }
-
-      int32 rightrx=tppcrI.getReadStartOffset();
-      int32 rightry=tppcrI.getReadStartOffset()+tppcrI->getLenClippedSeq();
-      if(direction_refid>0) {
-	rightry+=tppcrI->getRightExtend()*2/3;
-      }else{
-	rightrx-=tppcrI->getRightExtend()*2/3;
-      }
-
-      if(rightrx<leftrx) {
-	swap(rightrx,leftrx);
-	swap(rightry,leftry);
-	newreadisleft=false;  // well, yeah, it is on the right
-      }
-
-      int32 actinsertsize=rightry - leftrx;
-      if(rightry<leftry) actinsertsize=leftry - leftrx;
-
-      // we now have all info needed for storing measured template info
-      bool guesstemplatesegplace=true;
-      templateguess.tsize_seen=0; // just as default
-      templateguess.splace_seen=ReadGroupLib::SPLACE_UNKNOWN; // just as default
-
-      // Due to clipping at ends of reads,
-      // E.g.:
-      //         ----------->
-      //             <----------
-      // which can become
-      //                ---->
-      //             <----
-      //
-      // one should only guess on disjunct (non-overlapping) reads
-      // or if overlapping, the right read must start >= 10 bp
-      //  later than the left read
-      if(leftry<rightrx){
-	// if overlapping
-	if(leftrx+10>=rightrx){
-	  // and start of reads <= 10bp
-	  guesstemplatesegplace=false;
-	}
-      }
+	  errstat.code=ETEMPLATEDIRECTION;
+	  //errstat.reads_affected.push_back(refid);
 
-#ifndef PUBLICQUIET
-      cout << "GUESS TEMPLATE? " << guesstemplatesegplace << endl;
-#endif
+	  if(xcut<0) xcut=0;
+	  if(static_cast<uint32>(ycut)>CON_counts.size()){
+	    ycut=CON_counts.size();
+	  }
 
-      if(guesstemplatesegplace){
-	templateguess.rgid=CON_readpool->getRead(newid).getReadGroupID();  // this validates the entry (else its  rgid: 0)
-	templateguess.tsize_seen=actinsertsize;
-	// placement code is hardest
-	if(direction_newid_incontig*tppcrI.getReadDirection() < 0){
-#ifndef PUBLICQUIET
-	  cout << "TEMPLATE FR/RF\n";
-#endif
-	  // FR or RF
-	  if(newreadisleft){
-	    if(direction_newid_incontig>0){
-	      templateguess.splace_seen=ReadGroupLib::SPLACE_FR;
-	    }else{
-	      templateguess.splace_seen=ReadGroupLib::SPLACE_RF;
-	    }
+	  if(CON_readpool->getRead(refid).isRail())  {
+	    getRailsAsReadsAffected(refid, errstat.reads_affected, xcut, ycut);
 	  }else{
-	    if(direction_newid_incontig>0){
-	      templateguess.splace_seen=ReadGroupLib::SPLACE_RF;
-	    }else{
-	      templateguess.splace_seen=ReadGroupLib::SPLACE_FR;
-	    }
+	    getReadIDsAtContigPosition(errstat.reads_affected, xcut, ycut);
 	  }
-	}else{
-#ifndef PUBLICQUIET
-	  cout << "TEMPLATE SAME DIR\n";
+#ifdef CLOCK_STEPS
+	  coutAddReadClocks(us_steps);
 #endif
-	  // same direction ...
-	  //
-	  // I'm sure that some boolean logic could get through this, but I'm not inclined to think about it now
-	  templateguess.splace_seen=ReadGroupLib::SPLACE_SU; // just as default
-	  if((direction_newid_incontig>0 && newreadisleft==true)
-	     || (direction_newid_incontig<0 && newreadisleft==false)){
-	    if(CON_readpool->getRead(newid).getTemplateSegment()==1){
-	      templateguess.splace_seen=ReadGroupLib::SPLACE_SF;
-	    }else{
-	      templateguess.splace_seen=ReadGroupLib::SPLACE_SB;
-	    }
-	  }else{
-	    if(CON_readpool->getRead(newid).getTemplateSegment()==1){
-	      templateguess.splace_seen=ReadGroupLib::SPLACE_SB;
-	    }else{
-	      templateguess.splace_seen=ReadGroupLib::SPLACE_SF;
-	    }
-	  }
+	  FUNCEND();
+	  return;
 	}
-      }
-#ifndef PUBLICQUIET
-      cout << " nril " << newreadisleft
-	   << " " << leftrx << "-" << leftry
-	   << " " << rightrx << "-" << rightry
-	   << " " << templateguess;
-      cout.flush();
-#endif
-
 
-      // ** Check for segment placement **
-      // unknown does obviously need no check, "samedir unknown" already checked implicitly by direction check above
-      {
-	auto spc=CON_readpool->getRead(newid).getReadGroupID().getSegmentPlacementCode();
-	if(spc != ReadGroupLib::SPLACE_UNKNOWN
-	   && spc != ReadGroupLib::SPLACE_SU
-	   && templateguess.splace_seen != ReadGroupLib::SPLACE_UNKNOWN
-	   && templateguess.splace_seen != ReadGroupLib::SPLACE_SU){
-#ifndef PUBLICQUIET
-	  cout << " spl";
-	  cout.flush();
-#endif
-	  // if reads overlap, stay cool and don't check as it could be that sequencing errors and clipping
-	  //  muddy the picture
-	  // That is: the +10 bp criterion of above is not taken into account here, only the non-overlapping part
 
-	  bool hasplacementerror=false;
-	  if(leftry<rightrx){
-#ifndef PUBLICQUIET
-	    cout << " chk";
-	    cout.flush();
-#endif
-	    if(spc!=templateguess.splace_seen) hasplacementerror=true;
-	  }
+	// Note: play it safe while adding right extend ... take only 
+	//  part of it
+	int32 leftrx=xcut;
+	int32 leftry=ycut;
+	if(direction_newid_incontig>0) {
+	  leftry+=CON_readpool->getRead(newid).getRightExtend()*3/2;
+	}else{
+	  leftrx-=CON_readpool->getRead(newid).getRightExtend()*3/2;
+	}
 
-	  if(hasplacementerror){
-	    errstat.code=ESEGMENTPLACEMENT;
+	int32 rightrx=I->offset;
+	int32 rightry=I->offset+I->read.getLenClippedSeq();
+	if(direction_refid>0) {
+	  rightry+=CON_readpool->getRead(newid).getRightExtend()*3/2;
+	}else{
+	  rightrx-=CON_readpool->getRead(newid).getRightExtend()*3/2;
+	}
 
-	    if(xcut<0) xcut=0;
-	    if(static_cast<uint32>(ycut)>CON_counts.size()){
-	      ycut=CON_counts.size();
-	    }
-	    priv_arw_getReadsAffected(refid, newid, errstat.reads_affected, xcut, ycut);
-	    FUNCEND();
-	    return;
-	  }
+	if(rightrx<leftrx) {
+	  swap(rightrx,leftrx);
+	  swap(rightry,leftry);
 	}
-      }
 
-      // ** Check for template size **
-      if(CON_readpool->getRead(newid).getInsizeFrom() >= 0
-	 || CON_readpool->getRead(newid).getInsizeTo() >= 0){
-#ifndef PUBLICQUIET
-	cout << " dist";
-	cout.flush();
-#endif
+	int32 actinsertsize=rightry - leftrx;
+	if(rightry<leftry) actinsertsize=leftry - leftrx;
 
 	// allow 15% error in calculated insert size
 	int32 aisp10=actinsertsize+actinsertsize*15/100;
 	int32 aism10=actinsertsize-actinsertsize*15/100;
 
-	int32 tif=tppcrI->getInsizeFrom();
-	int32 tit=tppcrI->getInsizeTo();
+	int32 tif=I->read.getInsizeFrom();
+	int32 tit=I->read.getInsizeTo();
+
+	// Not anymore
+	//// allow 10% error in given insert sizes, but at least 1kb
+	//int32 tif=I->read.getInsizeFrom();
+	//if(tif/10 >= 1000){
+	//  tif-=tif/10;
+	//} else {
+	//  tif-=1000;
+	//}
+	//if(tit/10 >= 1000){
+	//  tit+=tit/10;
+	//} else {
+	//  tit+=1000;
+	//}
+
 
-	if(tppcrI->getInsizeFrom() >=0 && aisp10 < tif){
-	// distance too small
+	if(I->read.getInsizeFrom() >=0 && aisp10 < tif){
+	  // distance too small
 #ifndef PUBLICQUIET
-	  cout << "templ too small: " << tif << " min allowed, got " << aism10 << "-" << aisp10;
+	  cout << "templ too small: " << tif << " min allowed, got " << aisp10;
 #endif
-	  havematchingtemplatepartner=false;
-	  if(!CON_readpool->getRead(newid).getReadGroupID().getTSInfoOnly()){
-	    errstat.code=ETEMPLATESIZELT;
+	  errstat.code=ETEMPLATESIZE;
+	  //errstat.reads_affected.push_back(refid);
+
+	  if(xcut<0) xcut=0;
+	  if(static_cast<uint32>(ycut)>CON_counts.size()){
+	    ycut=CON_counts.size();
+	  }
+	  if(CON_readpool->getRead(refid).isRail()) {
+	    getRailsAsReadsAffected(refid, errstat.reads_affected, xcut, ycut);
+	  }else{
+	    getReadIDsAtContigPosition(errstat.reads_affected, xcut, ycut);
 	  }
+
+#ifdef CLOCK_STEPS
+	  coutAddReadClocks(us_steps);
+#endif
+	  FUNCEND();
+	  return;
 	}
-	if(errstat.code == ENOERROR && tppcrI->getInsizeTo() >=0 && aism10 > tit){
+	if(I->read.getInsizeTo() >=0 && aism10 > tit){
 	  // distance too big
 #ifndef PUBLICQUIET
-	  cout << "templ too big: " << tit << " max allowed, got " << aism10 << "-" << aisp10;
+	  cout << "templ too big: " << tit << " max allowed, got " << aism10;
 #endif
-	  havematchingtemplatepartner=false;
-	  if(!CON_readpool->getRead(newid).getReadGroupID().getTSInfoOnly()){
-	    errstat.code=ETEMPLATESIZEGT;
-	  }
-	}
-	if(errstat.code != ENOERROR){
+
+	  errstat.code=ETEMPLATESIZE;
+	  //errstat.reads_affected.push_back(refid);
+
 	  if(xcut<0) xcut=0;
 	  if(static_cast<uint32>(ycut)>CON_counts.size()){
 	    ycut=CON_counts.size();
 	  }
-	  priv_arw_getReadsAffected(refid, newid, errstat.reads_affected, xcut, ycut);
+	  if(CON_readpool->getRead(refid).isRail())  {
+	    getRailsAsReadsAffected(refid, errstat.reads_affected, xcut, ycut);
+	  }else{
+	    getReadIDsAtContigPosition(errstat.reads_affected, xcut, ycut);
+	  }
+#ifdef CLOCK_STEPS
+	  coutAddReadClocks(us_steps);
+#endif
 	  FUNCEND();
 	  return;
 	}
+
+	// ok, we have a matching template partner
+	havematchingtemplatepartner=true;
       }
-    }
 #ifndef PUBLICQUIET
-    cout << " done\n";
-    cout.flush();
+      cout << "done";
+      cout.flush();
 #endif
+    }
   }
 
-  CON_us_steps[USCLO_TEMPL1]+=diffsuseconds(us_start);
-  gettimeofday(&us_start,nullptr);
+#ifdef CLOCK_STEPS
+  us_steps[USCLO_TEMPL1]=diffsuseconds(us_start);
+  gettimeofday(&us_start,NULL);
+#endif
 
 
   bool doneit;
@@ -2095,12 +4529,12 @@ void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFac
 #ifdef ALIGNCHECK
   Align checkbla(CON_miraparams);
 #endif
-
+  
   do{
     CEBUG("xcut: " << xcut << "\t");
     CEBUG("ycut: " << ycut << endl);
     CEBUG("CON_counts size: " << CON_counts.size() << endl);
-
+	
     int32 eoffset=0;
     if(xcut<0){
       eoffset=xcut;
@@ -2113,11 +4547,11 @@ void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFac
     CEBUG("xcut: " << xcut << "\t");
     CEBUG("ycut: " << ycut << endl);
     CEBUG("eoffset: " << eoffset << "\t");
-
+	
     // The following should happen only very, very rarely
     // Normally almost impossible, but maybe triggered in projects where
     //  reads get edited over and over again
-    if(xcut> static_cast<int32>(CON_counts.size())
+    if(xcut> static_cast<int32>(CON_counts.size()) 
        || ycut < 0
        || ycut <= xcut){
 #ifndef PUBLICQUIET
@@ -2126,16 +4560,17 @@ void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFac
 #endif
       errstat.code=ENOALIGN;
       errstat.reads_affected.push_back(refid);
-
-      CON_us_steps[USCLO_XCUT]+=diffsuseconds(us_start);
-
+#ifdef CLOCK_STEPS
+      us_steps[USCLO_XCUT]=diffsuseconds(us_start);
+      coutAddReadClocks(us_steps);
+#endif
       FUNCEND();
       return;
     }
 
     // if makeTmpConsenus() returns true, a N or X was encountered in the consensus
     //  and we may not map this read
-    maymapthisread=!(makeTmpConsensus(xcut, ycut,CON_tmpcons_from_backbone));
+    maymapthisread=!(makeTmpConsensus(xcut, ycut));
 
     if(CON_2tmpcons.size()==0){
       // This should never happen here (the above checks should have made sure of that)
@@ -2158,7 +4593,7 @@ void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFac
       //	if(CON_readpool->getRead(refid).isRail())  {
       //	  getRailsAsReadsAffected(refid, errstat.reads_affected, xcut, ycut);
       //	}else{
-      //	  getReadORPIDsAtContigPosition(errstat.reads_affected, xcut, ycut);
+      //	  getReadIDsAtContigPosition(errstat.reads_affected, xcut, ycut);
       //	}
       //}
       //catch (Notify n) {
@@ -2167,9 +4602,10 @@ void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFac
       //	errstat.reads_affected.clear();
       //	errstat.reads_affected.push_back(refid);
       //}
-
-      CON_us_steps[USCLO_XCUT]+=diffsuseconds(us_start);
-
+#ifdef CLOCK_STEPS
+      us_steps[USCLO_XCUT]=diffsuseconds(us_start);
+      coutAddReadClocks(us_steps);
+#endif
       FUNCEND();
       return;
     }
@@ -2212,7 +4648,7 @@ void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFac
 	    CON_readpool->getRead(newid).getClippedComplementSeqAsChar(),
 	    CON_readpool->getRead(newid).getLenClippedSeq(),
 	    -1, newid, 1, -1, true, eoffset);
-
+	
 	  //if(xcut == 468 && ycut == 1251) {
 	  //  cout << "Read sequence:\n";
 	  //  for(uint32 qwer=0; qwer<CON_readpool->getRead(newid).getLenClippedSeq();qwer++){
@@ -2230,7 +4666,7 @@ void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFac
 	    CON_readpool->getRead(newid).getLenClippedSeq(),
 	    -1, newid, 1, -1);
 #endif
-	}
+	}    
       }else{
 	if(direction_refid>=0){
 	  CEBUG("C3 align.\n");
@@ -2286,7 +4722,7 @@ void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFac
 	  cout << endl;
 	  cpl=0;
 	}
-	cout << CON_2tmpcons[qwer];
+	cout << CON_tmpcons[qwer];
       }
       cout << endl;
 #endif
@@ -2305,8 +4741,8 @@ void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFac
 	  enforcing clean ends here is ... dangerous.
           reads is a contig that contain a sequencing error
           otherwise prevent the correct extension of the contig
-
-                  |    .    |    .    |    .    |
+          
+                  |    .    |    .    |    .    |   
           ID1:-1  GGGCATTGTCTGCCACCTCTAACTCTACCTAA
           ID2:500 GGGCATTGTCTGCCAGCTCTAAC
           480-                   X
@@ -2314,16 +4750,31 @@ void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFac
 	 where the -1 contig is a single read with a sequencing error
 	 near the end (C instead of G)
 
-	 In general, enforce_clean_ends should be off in de-novo (genome, EST),
-	 but on if one wants to do a clustering of transcript contigs.
-
-	 USE AT OWN RISK!
+	 Possible ways out:
+	  - enforcing clean ends needs at least k mismatches
+	    IMPLEMENTED.  (presently k = 5 in ads.C)
+	  - enforce clean ends only when overlap contains
+	    above avg frequencies (to reduce false positives due to
+	    really too many sequencing erros near an end). 
+	    IMPLEMENTED (a bit differently: switch off if refid or
+	    newid does not have repeat frequencies)
+	  - performing hash based correction of obvious sequencing
+	    errors (replacing wrong bases with N). Problematic for
+	    "low coverage" Sanger cases or when different strains are 
+	    used.
+	    This would also need the contig editor to perform "obvious"
+	    corrections in an alignment (replacing gaps with a base or N).
+	    NOT IMPLEMENTED yet, quite some work.
+
+	  CURRENTLY SWITCHED OFF! more harm than good
       */
 
+      if(!(CON_readpool->getRead(newid).hasFreqRept()
+	   || CON_readpool->getRead(refid).hasFreqRept())) enforce_clean_ends=false;
+
       bool dontpenalisengaps=false;
-      // TODO: PacBio HQ / LQ ???
-      if(CON_readpool->getRead(newid).isSequencingType(ReadGroupLib::SEQTYPE_PACBIOHQ)
-	 || CON_readpool->getRead(newid).isSequencingType(ReadGroupLib::SEQTYPE_PACBIOHQ)){
+      if(CON_readpool->getRead(newid).isSequencingType(Read::SEQTYPE_PACBIO)
+	 || CON_readpool->getRead(newid).isSequencingType(Read::SEQTYPE_PACBIO)){
 	dontpenalisengaps=true;
       }
 
@@ -2360,16 +4811,16 @@ void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFac
 //    }
 //#endif
 
-
+	
 #ifdef ALIGNCHECK
     CEBUG("ALC");
     if(madsl.empty()){
 
       // scrap this, AlignedDualSeqFacts does not drag this along
       //  (saving memory)
-      //if(initialadsf->getOverlap()>50) {
+      //if(initialads->getOverlap()>50) {
       //	cout << "Missed badly?\n";
-      //	cout << *initialadsf;
+      //	cout << *initialads;
       //	cout << "Tmp cons.: \n" << CON_tmpcons << endl;
       //	cout << *this;
       //}
@@ -2393,14 +4844,14 @@ void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFac
 #ifdef CEBUGFLAG
 	  CEBUG(" ----------------------------------------------------- \n");
 	  CEBUG("# solutions found: "<< tadsl.size() << endl);
-
+	
 	  {
 	    list<AlignedDualSeq>::const_iterator Itmp=tadsl.begin();
 	    while(Itmp!=tadsl.end()){
 	      CEBUG(*Itmp<<endl<<endl<<endl); Itmp++;
 	    }
 	  }
-
+	
 	  CEBUG(" ----------------------------------------------------- \n");
 #endif
       }
@@ -2410,72 +4861,78 @@ void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFac
 #ifdef CEBUGFLAG
     CEBUG(" ----------------------------------------------------- \n");
     CEBUG("# solutions found: "<< madsl.size() << endl);
-
-
+	  
+	  
     {
 	list<AlignedDualSeq>::const_iterator Itmp=madsl.begin();
 	while(Itmp!=madsl.end()){
 	  CEBUG(*Itmp); Itmp++;
 	}
     }
-
+	  
     CEBUG(" ----------------------------------------------------- \n");
 #endif
-
+	
     if(madsl.empty()){
-      //    throw Notify(Notify::INTERNAL, THISFUNC, "No solution?!? At least one expected.\n");
-
-      CON_us_steps[USCLO_SWALIGN]+=diffsuseconds(us_start);
+      //    throw Notify(Notify::INTERNAL, THISFUNC, "No solution?!? At least one expected.\n");    
 
 #ifndef PUBLICQUIET
       cout << "rej: no align found";
       if(aligncache[newreadseqtype].wasBandHit()) cout << " BH";
       cout << '\t';
-      //cout << "Ov: " << initialadsf->getOverlap() << "\t";
-      //cout << "ESR: " << static_cast<uint16>(initialadsf->getScoreRatio()) << "\t";
-      //cout << "S: " << initialadsf->getScore() << "\t";
-      //cout << "ES: " << initialadsf->getExpectedScore() << "\t";
+      //cout << "Ov: " << initialads->getOverlap() << "\t";
+      //cout << "ESR: " << static_cast<uint16>(initialads->getScoreRatio()) << "\t";
+      //cout << "S: " << initialads->getScore() << "\t";
+      //cout << "ES: " << initialads->getExpectedScore() << "\t";
       cout.flush();
 #endif
       errstat.code=ENOALIGN;
-      priv_arw_getReadsAffected(refid, newid, errstat.reads_affected, xcut, ycut);
-
+      //errstat.reads_affected.push_back(refid);
+      if(CON_readpool->getRead(refid).isRail())  {
+	getRailsAsReadsAffected(refid, errstat.reads_affected, xcut, ycut);
+      }else{
+	getReadIDsAtContigPosition(errstat.reads_affected, xcut, ycut);
+      }
+#ifdef CLOCK_STEPS
+      us_steps[USCLO_SWALIGN]=diffsuseconds(us_start);
+      coutAddReadClocks(us_steps);
+#endif
       FUNCEND();
       return;
     }
 
-    adsI=madsl.begin();
-
+    I=madsl.begin();
+	
     // TODO: was tun?
     // z.Zt. erst einmal den besten nehmen. wird wahrsch. der richtige sein.
     // darauf achten, dass, wenn m�glich, offset==0 ist
     {
-      list<AlignedDualSeq>::const_iterator Ibest=adsI;
+      list<AlignedDualSeq>::const_iterator Ibest=I;
       int32 bestratio=0;
       int32 bestweight=0;
       int32 offset=10000;
 
-      while(adsI!=madsl.end()){
-	if(adsI->getScoreRatio()>=bestratio){
-	  CEBUG(offset << "\t" << adsI->getOffsetInAlignment(newid));
-	  if(adsI->getScoreRatio()>=bestratio){
+      while(I!=madsl.end()){
+	if(I->getScoreRatio()>=bestratio){
+	  CEBUG(offset << "\t" << I->getOffsetInAlignment(newid));
+	  if(I->getScoreRatio()>=bestratio){
 	    //|| (offset>0 && I->getOffsetInAlignment(newid)<offset)){
-	    if(adsI->getWeight() > bestweight) {
-	      offset=adsI->getOffsetInAlignment(newid);
-	      bestratio=adsI->getScoreRatio();
-	      bestweight=adsI->getWeight();
-	      Ibest=adsI;
+	    if(I->getWeight() > bestweight) {
+	      offset=I->getOffsetInAlignment(newid);
+	      bestratio=I->getScoreRatio();
+	      bestweight=I->getWeight();
+	      Ibest=I;
 	    }
 	  }
 	}
-	++adsI;
-      }
-      adsI=Ibest;
+	I++;
+      }    
+      I=Ibest;
     }
 
     CEBUG(" ----------------------------------------------------- \n");
     CEBUG("# solution chosen: " << endl);
-    CEBUG(*adsI);
+    CEBUG(*I);
     CEBUG(" ----------------------------------------------------- \n");
 
     doneit=true;
@@ -2487,11 +4944,11 @@ void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFac
     // IF we're in the last foolsaferedone loop, make sure we still go another
     //  loop
     if(xcut >0){
-      if(adsI->getOffsetInAlignment(-1)!=0){
+      if(I->getOffsetInAlignment(-1)!=0){
 	CEBUG("Redo because of wrong left cut. Too far right.\n");
 	doneit=false;
 	if(foolsafe==5) foolsafe--;
-	xcut-=adsI->getOffsetInAlignment(-1)+7;
+	xcut-=I->getOffsetInAlignment(-1)+7;
       }
       //else if(I->getOffsetInAlignment(newid) > 5){
       //	// TODO: check whether we could accept this regardless of
@@ -2502,18 +4959,18 @@ void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFac
       //}
     }
 
-    if(adsI->getRightOffsetInAlignment(-1)!=0
+    if(I->getRightOffsetInAlignment(-1)!=0
        && ycut < CON_counts.size()+1){
       CEBUG("Redo because of wrong right cut. Not taken enough cons.\n");
       doneit=false;
       if(foolsafe==5) foolsafe--;
-      ycut+=adsI->getRightOffsetInAlignment(-1)+10;
+      ycut+=I->getRightOffsetInAlignment(-1)+10;
     }
     if(aligncache[newreadseqtype].wasBandHit()){
       CEBUG("Redo because of band hit in banded SW.\n");
-      const_cast<align_parameters &>(rt_params.getAlignParams()).al_kmin=200;
-      const_cast<align_parameters &>(rt_params.getAlignParams()).al_kmin=400;
-      const_cast<align_parameters &>(rt_params.getAlignParams()).al_kpercent=80;
+      rt_params.setAlignBandwidthMin(200);
+      rt_params.setAlignBandwidthMax(400);
+      rt_params.setAlignBandwidthInPercent(80);
       doneit=false;
     }
 
@@ -2527,16 +4984,18 @@ void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFac
 #ifndef PUBLICQUIET
       cout << "already 5 iterations to find optimum ads and still not found, using suboptimum.\n";
       cout.flush();
-
-      CEBUG(*adsI);
+      
+      CEBUG(*I);
 #endif
       doneit=true;
     }
 
   }while(doneit==false);
 
-  CON_us_steps[USCLO_SWALIGN]+=diffsuseconds(us_start);
-  gettimeofday(&us_start,nullptr);
+#ifdef CLOCK_STEPS
+  us_steps[USCLO_SWALIGN]=diffsuseconds(us_start);
+  gettimeofday(&us_start,NULL);
+#endif
 
   // need this, because if foolsafe kicks in, xcut may be <0 and ycut > size
   if(xcut<0){
@@ -2548,40 +5007,36 @@ void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFac
 
 
   CEBUG("CON_specialsraddconditions: " << CON_specialsraddconditions << endl);
-  CEBUG("newreadseqtype: " << ReadGroupLib::getNameOfSequencingType(newreadseqtype) << endl);
-
-#ifndef PUBLICQUIET
-  cout << "RRRR 5p: " << adsI->get5pLenContiguousMatch(newid) << "\t3p: " << adsI->get3pLenContiguousMatch(newid) << endl;
-#endif
+  CEBUG("newreadseqtype: " << Read::getNameOfSequencingType(newreadseqtype) << endl);
 
   // check for short reads whether we are violating against special rules for mismatch numbers
   if(CON_specialsraddconditions
-    && (newreadseqtype==ReadGroupLib::SEQTYPE_SOLEXA
-	|| newreadseqtype==ReadGroupLib::SEQTYPE_ABISOLID)){
+    && (newreadseqtype==Read::SEQTYPE_SOLEXA
+	|| newreadseqtype==Read::SEQTYPE_ABISOLID)){
     CEBUG("CON_ssrc_maxtotalerrors: " << CON_ssrc_maxtotalerrors << endl);
     if(CON_ssrc_maxtotalerrors >=0){
-      if(static_cast<int32>(adsI->getNumMismatches())
-	 + static_cast<int32>(adsI->getNumGaps()) > CON_ssrc_maxtotalerrors){
+      if(static_cast<int32>(I->getNumMismatches()) 
+	 + static_cast<int32>(I->getNumGaps()) > CON_ssrc_maxtotalerrors){
 #ifndef PUBLICQUIET
-	cout << "saf:mte " << (static_cast<int32>(adsI->getNumMismatches()) + static_cast<int32>(adsI->getNumGaps())) << ">" << CON_ssrc_maxtotalerrors;
+	cout << "saf:mte " << (static_cast<int32>(I->getNumMismatches()) + static_cast<int32>(I->getNumGaps())) << ">" << CON_ssrc_maxtotalerrors;
 #endif
 	errstat.code=ESPECIALSRADDFAIL;
       }
     }
     CEBUG("CON_ssrc_maxmismatches: " << CON_ssrc_maxmismatches << endl);
     if(CON_ssrc_maxmismatches >=0){
-      if(static_cast<int32>(adsI->getNumMismatches()) > CON_ssrc_maxmismatches){
+      if(static_cast<int32>(I->getNumMismatches()) > CON_ssrc_maxmismatches){
 #ifndef PUBLICQUIET
-	cout << " saf:mnm " << adsI->getNumMismatches() << ">" << CON_ssrc_maxmismatches;
+	cout << " saf:mnm " << I->getNumMismatches() << ">" << CON_ssrc_maxmismatches;
 #endif
 	errstat.code=ESPECIALSRADDFAIL;
       }
     }
     CEBUG("CON_ssrc_maxgaps: " << CON_ssrc_maxgaps << endl);
     if(CON_ssrc_maxgaps >=0){
-      if(static_cast<int32>(adsI->getNumGaps()) > CON_ssrc_maxgaps){
+      if(static_cast<int32>(I->getNumGaps()) > CON_ssrc_maxgaps){
 #ifndef PUBLICQUIET
-	cout << " saf:mng " << static_cast<int32>(adsI->getNumGaps()) << ">" << CON_ssrc_maxgaps;
+	cout << " saf:mng " << static_cast<int32>(I->getNumGaps()) << ">" << CON_ssrc_maxgaps;
 #endif
 	errstat.code=ESPECIALSRADDFAIL;
       }
@@ -2589,10 +5044,25 @@ void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFac
     if(errstat.code==ESPECIALSRADDFAIL){
 #ifndef PUBLICQUIET
       cout << " specialsradd failed\t";
-      //cout << *adsI;
+      //cout << *I;
 #endif
 
-      priv_arw_getReadsAffected(refid, newid, errstat.reads_affected, xcut, ycut);
+      try{
+	errstat.proposed_cutback=analyseADSForCuttingBackCERMap(*I, direction_frnid);
+      }
+      catch (Notify n){
+	cout << *I;
+	// throw again so that addRead() catches and we get info to replay
+	throw Notify(n);
+      }
+      if(CON_readpool->getRead(refid).isRail())  {
+	getRailsAsReadsAffected(refid, errstat.reads_affected, xcut, ycut);
+      }else{
+	getReadIDsAtContigPosition(errstat.reads_affected, xcut, ycut);
+      }
+#ifdef CLOCK_STEPS
+      coutAddReadClocks(us_steps);
+#endif
 
       FUNCEND();
       return;
@@ -2602,29 +5072,29 @@ void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFac
 //      cout << "maxtotal: " << CON_ssrc_maxtotalerrors;
 //      cout << "maxmis: " << CON_ssrc_maxmismatches;
 //      cout << "maxgap: " << CON_ssrc_maxgaps;
-//      cout << *adsI;
+//      cout << *I;
 //    }
   }
 
 #ifndef PUBLICQUIET
-    cout << "\tASR: " << static_cast<uint16>(adsI->getScoreRatio()) << '\t';
+    cout << "\tASR: " << static_cast<uint16>(I->getScoreRatio()) << '\t';
     //cout << *I;
 #endif
 
   // First check on rodirs: relaxed parameters (rodirs*2)
   // Reason: we haven't checked template restriction yet
   //  if we lateron see that we do not have a matching template,
-  //  then we'll use the 'stricter' rodirs and cmrs value
-  if(initialadsf->getScoreRatio() >
-     adsI->getScoreRatio()+(2*rt_params.getContigParams().con_reject_on_drop_in_relscore)){
+  //  then we'll use the 'stricter' rodirs value
+  if(initialads->getScoreRatio() > 
+     I->getScoreRatio()+(2*rt_params.getContigParams().con_reject_on_drop_in_relscore)){
     // REMOVEME
 #ifndef PUBLICQUIET
     cout << "Dead end (even lax)\t";
-    cout << "ESR: " << static_cast<uint16>(initialadsf->getScoreRatio());
-    cout << "\tASR: " << static_cast<uint16>(adsI->getScoreRatio()) << '\t';
-    //cout << *adsI;
+    cout << "ESR: " << static_cast<uint16>(initialads->getScoreRatio());
+    cout << "\tASR: " << static_cast<uint16>(I->getScoreRatio()) << '\t';
+    //cout << *I;
 #endif
-    //    cout << *adsI;
+    //    cout << *I;
 
     errstat.code=EDROPINRELSCORE;
     //errstat.reads_affected.push_back(refid);
@@ -2633,9 +5103,16 @@ void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFac
     //  denn es kann sein, dass ein potentiell guter match auch dieselben
     //  Fehler hatte wie dieses Align.
     // falsch!? ist legitim? diese bans werden ja nicht auf permbans uebertragen,
-    //  weshalb es fuer _diesen_ Contig ja stimmen wuerde.
+    //  weshalb es fuer _diesen_ Contig ja stimmen wuerde. 
 
-    priv_arw_getReadsAffected(refid, newid, errstat.reads_affected, xcut, ycut);
+    if(CON_readpool->getRead(refid).isRail())  {
+      getRailsAsReadsAffected(refid, errstat.reads_affected, xcut, ycut);
+    }else{
+      getReadIDsAtContigPosition(errstat.reads_affected, xcut, ycut);
+    }
+#ifdef CLOCK_STEPS
+    coutAddReadClocks(us_steps);
+#endif
 
     FUNCEND();
     return;
@@ -2646,41 +5123,53 @@ void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFac
 
   // check left side
   int32 expect_growleft=0;
-  if(adsI->getOffsetInAlignment(newid)==0 && adsI->getOffsetInAlignment(-1)!=0){
-    expect_growleft=-(xcut-adsI->getOffsetInAlignment(-1));
+  if(I->getOffsetInAlignment(newid)==0 && I->getOffsetInAlignment(-1)!=0){
+    expect_growleft=-(xcut-I->getOffsetInAlignment(-1));
     if(expect_growleft<0) expect_growleft=0;
   }
   int32 expect_growright=0;
   if(ycut==CON_counts.size()
-     && adsI->getRightOffsetInAlignment(newid)==0
-     && adsI->getRightOffsetInAlignment(-1)!=0){
-    expect_growright=adsI->getRightOffsetInAlignment(-1);
+     && I->getRightOffsetInAlignment(newid)==0
+     && I->getRightOffsetInAlignment(-1)!=0){
+    expect_growright=I->getRightOffsetInAlignment(-1);
   }
 
   if(forcegrow>0
      && max(expect_growleft, expect_growright) < forcegrow){
     errstat.code=EFORCEDGROWTHNOTREACHED;
 
-    priv_arw_getReadsAffected(refid, newid, errstat.reads_affected, xcut, ycut);
+    if(CON_readpool->getRead(refid).isRail())  {
+      getRailsAsReadsAffected(refid, errstat.reads_affected, xcut, ycut);
+    }else{
+      getReadIDsAtContigPosition(errstat.reads_affected, xcut, ycut);
+    }
+#ifdef CLOCK_STEPS
+    coutAddReadClocks(us_steps);
+#endif
 
     FUNCEND();
     return;
   }
 
-  // look whether the contig may grow
-  // no matter what the pathfinder says: if the new read has a mate in this contig and passed
-  //  all template tests, then the contig will allow growth
-  if(!havematchingtemplatepartner
-     && forcegrow<0
+  if(forcegrow<0
      && (expect_growleft > 0
 	 || expect_growright > 0)){
     errstat.code=EGROWTHNOTALLOWED;
-    priv_arw_getReadsAffected(refid, newid, errstat.reads_affected, xcut, ycut);
+
+    if(CON_readpool->getRead(refid).isRail())  {
+      getRailsAsReadsAffected(refid, errstat.reads_affected, xcut, ycut);
+    }else{
+      getReadIDsAtContigPosition(errstat.reads_affected, xcut, ycut);
+    }
+#ifdef CLOCK_STEPS
+    coutAddReadClocks(us_steps);
+#endif
+
     FUNCEND();
     return;
   }
 
-  // now check whether we're aligning in an area where we already
+  // now check whether we're aligning in an area where we already 
   //  reached max coverage
   //
   // New 14.12.2008: if contig grows, skip that as we will very
@@ -2688,13 +5177,13 @@ void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFac
   //  so much coverage that maxcoverage allowed is reached,
   //  the building stops (which is bad).
   // TODO: do better, perhaps before the alignment?
-  //  furthermore, change reduceSKim() and Pathfinder to
+  //  furthermore, change reduceSKim() and Pathfinder to 
   //  select links where multicopy is involved to have at least
   //  20 to 30 bases extension!
   // New 03.01.2009: scrap the above, leads to heavy overcompression
   // New 29.04.2011:
   // taken out unconditional check:
-  //  old routine always gave back "true" anyway except if coverage
+  //  old routine always gave back "true" anyway except if coverage 
   //  reached 16384
   //  with new 32 bit counters, will never be really reached anyway
 
@@ -2705,196 +5194,228 @@ void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFac
      && (*CON_miraparams)[0].getAssemblyParams().as_uniform_read_distribution
      && !checkFreeCoverageForAddingRead(newreadseqtype, xcut, ycut)){
     errstat.code=EMAXCOVERAGEREACHED;
-    priv_arw_getReadsAffected(refid, newid, errstat.reads_affected, xcut, ycut);
+
+    if(CON_readpool->getRead(refid).isRail())  {
+      getRailsAsReadsAffected(refid, errstat.reads_affected, xcut, ycut);
+    }else{
+      getReadIDsAtContigPosition(errstat.reads_affected, xcut, ycut);
+    }
+#ifdef CLOCK_STEPS
+    coutAddReadClocks(us_steps);
+#endif
+
     FUNCEND();
     return;
   }
 
-  CON_us_steps[USCLO_PREINSCHK]+=diffsuseconds(us_start);
-  gettimeofday(&us_start,nullptr);
+#ifdef CLOCK_STEPS
+  us_steps[USCLO_PREINSCHK]=diffsuseconds(us_start);
+  gettimeofday(&us_start,NULL);
+#endif
 
-  auto coveragemultiplier=CON_readpool->getRead(newid).getDigiNormMultiplier();
 
-  if(CON_readpool->getRead(refid).isRail()
+  // forcemerge: for reads not mapping 100%
+  bool forcemerge=false;
+  if(CON_hasforcemergeareas
      && CON_mergenewsrreads
-     && newreadseqtype==ReadGroupLib::SEQTYPE_SOLEXA
+     && newreadseqtype==Read::SEQTYPE_SOLEXA
      && rt_params.getContigParams().con_mergeshortreads){
-    // forcemerge: for reads not mapping 100%
-    bool forcemerge=false;
-    // first force merge: reads < 100% but <= -CO:msrme errors
-    if(CON_hasforcemergeareas){
-      //// for testing
-      //forcemerge=true;
-
-      // TODO: is using xcut & ycut OK? Probably yes.
-      //  (especially ycut is not 100% on the end of the alignment!)
-      auto ccI=CON_counts.begin();
-      advance(ccI,xcut);
-      for(uint32 ii=xcut; ii<ycut; ++ii, ++ccI){
-	if(ccI->forcemergearea) {
-	  forcemerge=true;
-	  break;
-	}
-      }
-    }
+    //// for testing
+    //forcemerge=true;
 
-    if(adsI->getNumMismatches()+adsI->getNumGaps() > rt_params.getContigParams().con_msr_maxerrors){
-      maymapthisread=false;
+    // TODO: is using xcut & ycut OK? Probably yes.
+    cccontainer_t::iterator ccI=CON_counts.begin();
+    advance(ccI,xcut);
+    for(uint32 ii=xcut; ii<ycut; ++ii, ++ccI){
+      if(ccI->forcemergearea) {
+	forcemerge=true;
+	break;
+      }
     }
+  }
 
-    // now check whether we can merge this read
-    // if we want to map, we need 100% score ratio
-    CEBUG("CON_mergenewsrreads: " << CON_mergenewsrreads << endl);
-    CEBUG("maymapthisread: " << maymapthisread << endl);
-    CEBUG("adsI->getScoreRatio() == 100: " << (adsI->getScoreRatio() == 100) << endl);
+  // now check whether we can merge this read
+  // if we want to map, we need 100% score ratio
+  CEBUG("CON_mergenewsrreads: " << CON_mergenewsrreads << endl);
+  CEBUG("maymapthisread: " << maymapthisread << endl);
+  CEBUG("newreadseqtype==Read::SEQTYPE_SOLEXA: " << (newreadseqtype==Read::SEQTYPE_SOLEXA) << endl);
+  CEBUG("rt_params.getContigParams().con_mergeshortreads: " << rt_params.getContigParams().con_mergeshortreads << endl);
+  CEBUG("I->getScoreRatio() == 100: " << (I->getScoreRatio() == 100) << endl);
 
-    if(forcemerge
-       || (maymapthisread && adsI->getScoreRatio() == 100)){
+  if(forcemerge 
+     || (CON_mergenewsrreads
+	 && maymapthisread
+	 && newreadseqtype==Read::SEQTYPE_SOLEXA
+	 && rt_params.getContigParams().con_mergeshortreads
+	 && I->getScoreRatio() == 100)){
 
-      CEBUG("Try map.\n");
+    CEBUG("Try map.\n");
 
-      bool canmap=true;
+    bool canmap=true;
 
-      // sometimes the 100% matches have some weirdnesses against N's
-      // ADS should nowadays take care of this, but just to be sure:
-      if(!forcemerge){
-	if(canmap &&
-	   (adsI->getNumMismatches()>0
-	    || adsI->getNumGaps()>0)){
+    // sometimes the 100% matches have some weirdnesses against N's
+    // ADS should nowadays take care of this, but just to be sure:
+    if(!forcemerge){
+      if(canmap &&
+	 (I->getNumMismatches()>0
+	  || I->getNumGaps()>0)){
 #ifndef PUBLICQUIET
-	  cout << " has mismatches";
+	cout << " has mismatches";
 #endif
-	  canmap=false;
-	}
+	canmap=false;
       }
+    }
 
-      // after this point, "canmap" is the only deciding variable left, "forcemerge" not looked
-      //  at anymore!
-
-      // furthermore, we may not be extending the contig left or right
+    // furthermore, we may not be extending the contig left or right
 
-      if(expect_growleft>0) {
-	canmap=false;
+    if(expect_growleft>0) {
+      canmap=false;
 #ifndef PUBLICQUIET
-	cout << " growl";
+      cout << " growl";
 #endif
-      }
-      if(expect_growright>0) {
-	canmap=false;
+    }
+    if(expect_growright>0) {
+      canmap=false;
 #ifndef PUBLICQUIET
-	cout << " growr";
+      cout << " growr";
 #endif
-      }
-
-// TODO: check whether can be taken out as should be taken care of by makeTmpConsensus()
-//
-//      // ok, consensus does not grow ... but it might be in a part
-//      //  that initially was not in the contig.
-//      if(canmap &&
-//	 (CON_counts[xcut].getBBChar()=='@'
-//	  || CON_counts[ycut-1].getBBChar()=='@')) {
-//#ifndef PUBLICQUIET
-////      cout << "xcut: " << xcut << "\tycut: " << ycut << endl;
-////      dumpAsDebug(cout);
-//	cout << " ingrown";
-//#endif
-//	canmap=false;
-//      }
-
-      //cout << "\ncanmap2: " << canmap << endl;
-
-      // maybe we'd like to have reads at contig ends not mapped (e.g.
-      //  for scaffolding)
-      if(canmap
-	 && rt_params.getContigParams().con_msr_keependsunmapped!=0
-	 && CON_mpindex_msrkceu_left>=0  // are we using markerpositions anyway?
-	 && CON_readpool->getRead(newid).getTemplatePartnerID() >= 0){
+    }
 
-	// this method is susceptible to be less than optimal for data with lots of gap columns
-	//  (high coverage 454 & Ion)
-	// TODO: see whether I need to take countermeasures like if in 2*dist, then count
-	//  gap-columns to get a much better true distance (left and right)
+    // ok, consensus does not grow ... but it might be in a part
+    //  that initially was not in the contig.
+    if(canmap &&
+       (CON_counts[xcut].backbonechar=='@'
+	|| CON_counts[ycut-1].backbonechar=='@')) {
+#ifndef PUBLICQUIET
+//      cout << "xcut: " << xcut << "\tycut: " << ycut << endl;
+//      dumpAsDebug(cout);
+      cout << " ingrown";
+#endif
+      canmap=false;
+    }
 
-	int32 dist=rt_params.getContigParams().con_msr_keependsunmapped;
-	if(dist<0){
-	  dist=CON_readpool->getRead(newid).getInsizeTo();
-	}
+    // maybe we'd like to have reads at contig ends not mapped (e.g.
+    //  for scaffolding)
+    if(canmap
+       && rt_params.getContigParams().con_msr_keependsunmapped!=0){
+      int32 dist=rt_params.getContigParams().con_msr_keependsunmapped;
+      if(dist<0){
+	dist=CON_readpool->getRead(newid).getInsizeTo();
+      }
 
-	//cout << "mpl: " << CON_markerpositions[CON_mpindex_msrkceu_left]
-	//     << "\tmpr: " << CON_markerpositions[CON_mpindex_msrkceu_right]
-	//     << "\nxcut: " << xcut
-	//     << "\tycut: " << ycut
-	//     << "\tdist: " << dist
-	//     << "\nl: " << dist+CON_markerpositions[CON_mpindex_msrkceu_left]
-	//     << "\tl: " << CON_markerpositions[CON_mpindex_msrkceu_right]-dist
-	//  ;
-
-	// if no distance or when read has no paired-end partner, we could map
-	//  anyway and would not need to check further
-	if(dist>0){
-	  // check whether we are in boundaries, if yes, do not map
-	  if(xcut <= dist+CON_markerpositions[CON_mpindex_msrkceu_left]
-	     || ycut >= CON_markerpositions[CON_mpindex_msrkceu_right]-dist){
-	    canmap=false;
-	  }
+//      cout << "lri: " << CON_index_leftestbbread
+//	   << "\trri: " << CON_index_rightestbbread
+//	   << "\nxcut: " << xcut
+//	   << "\tycut: " << ycut
+//	   << "\tdist: " << dist
+//	   << "\nr: " << dist+CON_reads[CON_index_leftestbbread].offset
+//	   << "\tl: " << (CON_reads[CON_index_rightestbbread].offset
+//			+ CON_reads[CON_index_rightestbbread].read.getLenClippedSeq())-dist
+//	;
+
+      // if no distance or when read has no paired-end partner, we could map
+      //  anyway and would not need to check further
+      if(dist>0 && CON_readpool->getRead(newid).getTemplatePartnerID() >= 0){
+	// check whether we are in boundaries, if yes, do not map
+	if(xcut <= dist+CON_reads[CON_index_leftestbbread].offset 
+	   || ycut >= (CON_reads[CON_index_rightestbbread].offset
+		       + CON_reads[CON_index_rightestbbread].read.getLenClippedSeq())-dist){
+	  canmap=false;
 	}
-
-	//cout << "\ncanmap2: " << canmap << endl;
       }
 
-      // map if possible, else the read will be normally added
-      if(canmap){
+      //cout << "\ncanmap: " << canmap << endl;
+    }
+
+    // map if possible, else the read will be normally added
+    if(canmap){
 #ifndef PUBLICQUIET
-	cout << " mapping ...";
-	cout.flush();
+      cout << " mapping ...";
+      cout.flush();
 #endif
 
-	bool wasmapped=true;
-	try{
-	  wasmapped=insertMappedReadInContig(*adsI, newreadseqtype, xcut, direction_frnid,coveragemultiplier,forcemerge);
-	}
-	catch (Notify n){
-	  cout << "Uh oh ... not good\n";
-	  cout << "forcemerge " << forcemerge << endl;
-	  cout << "CON_mergenewsrreads " << CON_mergenewsrreads << endl;
-	  cout << "maymapthisread " << maymapthisread << endl;
-	  cout << "newreadseqtype " << static_cast<uint16>(newreadseqtype);
-	  cout << "rt_params.getContigParams().con_mergeshortreads " << rt_params.getContigParams().con_mergeshortreads << endl;
-	  cout << "adsI->getScoreRatio() " << static_cast<uint16>(adsI->getScoreRatio()) << endl;
-	  cout << "canmap " << canmap << endl;
-	  cout << *adsI;
-	  // throw again so that addRead() catches and we get info to replay
-	  throw Notify(n);
-	}
-
-	CON_us_steps[USCLO_INSCONM]+=diffsuseconds(us_start);
-
-	if(wasmapped){
-	  // count this in the readsperstrain statistics
-	  CON_readsperstrain[CON_readpool->getRead(newid).getStrainID()]+=coveragemultiplier;
+      bool wasmapped=true;
+      try{
+	wasmapped=insertMappedReadInContig(*I, newreadseqtype, xcut, direction_frnid,forcemerge);
+      }
+      catch (Notify n){
+	cout << *I;
+	// throw again so that addRead() catches and we get info to replay
+	throw Notify(n);
+      }
 
-	  if(CON_readsperreadgroup.size() < ReadGroupLib::getNumReadGroups()){
-	    CON_readsperreadgroup.resize(ReadGroupLib::getNumReadGroups(),0);
-	  }
-	  CON_readsperreadgroup[CON_readpool->getRead(newid).getReadGroupID().getLibId()]+=coveragemultiplier;
-	  return;
-	}else{
-#ifndef PUBLICQUIET
-	  cout << " failedmap";
-	  cout.flush();
+      if(wasmapped){
+#ifdef CLOCK_STEPS
+	us_steps[USCLO_INSCON]=diffsuseconds(us_start);
+	coutAddReadClocks(us_steps);
 #endif
-	}
+
+	// count this in the readsperstrain statistics
+	++CON_readsperstrain[CON_readpool->getRead(newid).getStrainID()];
+	return;
       }else{
 #ifndef PUBLICQUIET
-	cout << " cantmap";
+	cout << " failedmap";
 	cout.flush();
-#endif
+#endif	
       }
+    }else{
+#ifndef PUBLICQUIET
+      cout << " cantmap";
+      cout.flush();
+#endif
     }
   }
 
   //cout << *I;
 
+#ifndef PUBLICQUIET
+  cout << " inscon...";
+  cout.flush();
+#endif
+#ifdef CLOCK_STEPS
+  gettimeofday(&us_start,NULL);
+#endif
+  insertReadInContig(*I, xcut,direction_frnid, direction_refid);
+#ifdef CLOCK_STEPS
+  us_steps[USCLO_INSCON]=diffsuseconds(us_start);
+#endif
+#ifndef PUBLICQUIET
+  cout << "done";
+  cout.flush();
+#endif
+  CON_maprpids_to_conreadsids[newid]=CON_reads.size()-1;
+  
+  
+#ifdef CLOCK_STEPS
+  gettimeofday(&us_start,NULL);
+#endif
+#ifndef PUBLICQUIET
+  cout << " updbasloc...";
+  cout.flush();
+#endif
+  // Put base locks in CON_counts that this read produces
+  updateBaseLocks(CON_reads.back(), true);
+#ifndef PUBLICQUIET
+  cout << "done";
+  cout.flush();
+#endif
+#ifdef CLOCK_STEPS
+  us_steps[USCLO_UPDBLOCKS]=diffsuseconds(us_start);
+#endif
+  
+#ifndef PUBLICQUIET
+  cout << " chkcon...";
+  cout.flush();
+#endif
+  paranoiaBUGSTAT(checkContig());
+#ifndef PUBLICQUIET
+  cout << "done";
+  cout.flush();
+#endif
+  
+  
+  
   // Template handling, part 2
 
   if(!havematchingtemplatepartner){
@@ -2902,27 +5423,29 @@ void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFac
     cout << " tmplhand2...";
     cout.flush();
 #endif
-
-    // Second check on rodirs and cmrs: strict parameters (rodirs)
+  
+    // Second check on rodirs: strict parameters (rodirs)
     // Reason: if there was no matching tpartner, apply strict parameter
 
-    auto checkmrs=rt_params.getContigParams().con_min_relscore;
-    if(checkmrs<0) checkmrs=rt_params.getAlignParams().al_min_relscore;
-    if(initialadsf->getScoreRatio() > adsI->getScoreRatio()+rt_params.getContigParams().con_reject_on_drop_in_relscore
-       || initialadsf->getScoreRatio() < checkmrs){
+    if(initialads->getScoreRatio()>I->getScoreRatio()+rt_params.getContigParams().con_reject_on_drop_in_relscore){
       // REMOVEME
-
+      
 #ifndef PUBLICQUIET
       cout << "Dead end (strict)\t";
-      cout << "ESR: " << static_cast<uint16>(initialadsf->getScoreRatio());
-      cout << "\tASR: " << static_cast<uint16>(adsI->getScoreRatio()) << '\t';
+      cout << "ESR: " << static_cast<uint16>(initialads->getScoreRatio());
+      cout << "\tASR: " << static_cast<uint16>(I->getScoreRatio()) << '\t';
       // cout << *I;
 #endif
+      
+#ifdef CLOCK_STEPS
+      gettimeofday(&us_start,NULL);
+#endif
+      deleteRead(newid);
+#ifdef CLOCK_STEPS
+      us_steps[USCLO_DELREAD]=diffsuseconds(us_start);
+#endif
 
       errstat.code=EDROPINRELSCORE;
-      if(initialadsf->getScoreRatio() < checkmrs){
-	errstat.code=EALIGNREJECTMRS;
-      }
 
       //errstat.reads_affected.push_back(refid);
 
@@ -2930,196 +5453,140 @@ void Contig::addRead_wrapped(vector<Align> & aligncache, const AlignedDualSeqFac
       //  denn es kann sein, dass ein potentiell guter match auch dieselben
       //  Fehler hatte wie dieses Align.
       // falsch!? ist legitim? diese bans werden ja nicht auf permbans uebertragen,
-      //  weshalb es fuer _diesen_ Contig ja stimmen wuerde.
-
-      priv_arw_getReadsAffected(refid, newid, errstat.reads_affected, xcut, ycut);
+      //  weshalb es fuer _diesen_ Contig ja stimmen wuerde. 
+      if(CON_readpool->getRead(refid).isRail())  {
+	getRailsAsReadsAffected(refid, errstat.reads_affected, xcut, ycut);
+      }else{
+	getReadIDsAtContigPosition(errstat.reads_affected, xcut, ycut);
+      }
+#ifdef CLOCK_STEPS
+      coutAddReadClocks(us_steps);
+#endif
 
       FUNCEND();
       return;
     }
   }
 
-
-
-
-#ifndef PUBLICQUIET
-  cout << " inscon...";
-  cout.flush();
+#ifdef CLOCK_STEPS
+  gettimeofday(&us_start,NULL);
 #endif
-
-  gettimeofday(&us_start,nullptr);
-  auto nprI=insertReadInContig(*adsI, xcut,direction_frnid, direction_refid, coveragemultiplier);
-  CON_us_steps[USCLO_INSCON]+=diffsuseconds(us_start);
-
-  // count this in the readsperstrain statistics
-  CON_readsperstrain[CON_readpool->getRead(newid).getStrainID()]+=coveragemultiplier;
-
-  if(CON_readsperreadgroup.size() < ReadGroupLib::getNumReadGroups()){
-    CON_readsperreadgroup.resize(ReadGroupLib::getNumReadGroups(),0);
-  }
-  CON_readsperreadgroup[CON_readpool->getRead(newid).getReadGroupID().getLibId()]+=coveragemultiplier;
-
-
 #ifndef PUBLICQUIET
-  cout << "done";
+  cout << " ansrmbzone...";
   cout.flush();
 #endif
-
-
+  if(analyseRMBZones(CON_reads.back(), errstat.srmb_reads_affected) == true){
+#ifdef CLOCK_STEPS
+    us_steps[USCLO_ANRMBZ]=diffsuseconds(us_start);
+#endif
 #ifndef PUBLICQUIET
-  cout << " updbasloc...";
-  cout.flush();
+    cout << "rej: srmb zone\t";
+#endif
+    //if(CON_reads.back().read.getName()=="GBIBI26TF") {
+    //  cout << "\nMUSTSAVE!\n";
+    //  saveAsGAP4DA("error_out.gap4da", cout);
+    //  exit(0);
+    //}
+    // remove the read from the contig as we don't want it
+#ifdef CLOCK_STEPS
+    gettimeofday(&us_start,NULL);
+#endif
+    deleteRead(newid);
+#ifdef CLOCK_STEPS
+    us_steps[USCLO_DELREAD]=diffsuseconds(us_start);
 #endif
 
-  // Put base locks in CON_counts that this read produces
-  gettimeofday(&us_start,nullptr);
-  updateBaseLocks(nprI, true);
-  CON_us_steps[USCLO_UPDBLOCKS]+=diffsuseconds(us_start);
-
-#ifndef PUBLICQUIET
-  cout << "done";
-  cout.flush();
+    errstat.code=ESRMBMISMATCH;
+    if(CON_readpool->getRead(refid).isRail())  {
+      getRailsAsReadsAffected(refid, errstat.reads_affected, xcut, ycut);
+    }else{
+      getReadIDsAtContigPosition(errstat.reads_affected, xcut, ycut);
+    }
+#ifdef CLOCK_STEPS
+    coutAddReadClocks(us_steps);
 #endif
 
-#ifndef PUBLICQUIET
-  cout << " chkcon...";
-  cout.flush();
+    // errstat.srmb_reads_affected will already contains the ids of the reads
+    //  that have RMB mismatches with that read
+    FUNCEND();
+    return;
+  }
+#ifdef CLOCK_STEPS
+  us_steps[USCLO_ANRMBZ]=diffsuseconds(us_start);
 #endif
-  paranoiaBUGSTAT(checkContig());
 #ifndef PUBLICQUIET
   cout << "done";
   cout.flush();
 #endif
 
-
 #ifndef PUBLICQUIET
-  cout << " ansrmbzone...";
+  cout << " andngrzone...";
   cout.flush();
 #endif
+  if(analyseDangerZones(CON_reads.back()) == true){
+    // TODO: in ALUS & co strengere Kriterien.
+    // remove the read from the contig as we don't want it
 
-  {
-    gettimeofday(&us_start,nullptr);
-    auto arz=analyseRMBZones(nprI);
-    CON_us_steps[USCLO_ANRMBZ]+=diffsuseconds(us_start);
-
-    if(arz == true){
 #ifndef PUBLICQUIET
-      cout << "rej: srmb zone\t";
+    cout << "rej: danger zone\t";
 #endif
-      //if(CON_reads.back().read.getName()=="GBIBI26TF") {
-      //  cout << "\nMUSTSAVE!\n";
-      //  saveAsGAP4DA("error_out.gap4da", cout);
-      //  exit(0);
-      //}
-      // remove the read from the contig as we don't want it
-
-      gettimeofday(&us_start,nullptr);
-      deleteRead(nprI);
-      CON_us_steps[USCLO_DELREAD]+=diffsuseconds(us_start);
-
-      errstat.code=ESRMBMISMATCH;
-      priv_arw_getReadsAffected(refid, newid, errstat.reads_affected, xcut, ycut);
 
-      FUNCEND();
-      return;
+#ifdef CLOCK_STEPS
+    gettimeofday(&us_start,NULL);
+#endif
+    deleteRead(newid);
+#ifdef CLOCK_STEPS
+    us_steps[USCLO_DELREAD]=diffsuseconds(us_start);
+#endif
+    
+    errstat.code=EDANGERZONE;
+    if(CON_readpool->getRead(refid).isRail())  {
+      getRailsAsReadsAffected(refid, errstat.reads_affected, xcut, ycut);
+    }else{
+      getReadIDsAtContigPosition(errstat.reads_affected, xcut, ycut);
     }
-  }
+#ifdef CLOCK_STEPS
+    coutAddReadClocks(us_steps);
+#endif
 
+    FUNCEND();
+    return;
+  }
 #ifndef PUBLICQUIET
   cout << "done";
   cout.flush();
 #endif
 
-#ifndef PUBLICQUIET
-  cout << " andngrzone...";
-  cout.flush();
-#endif
 
-  {
-////++++//// Skip this as currently not really used by anyone
-////++++////    BUGIFTHROW(true,"need redo 4 for PlacedContigReads");
-////++++////    if(analyseDangerZones(CON_reads.back()) == true){
-////++++////      // TODO: in ALUS & co strengere Kriterien.
-////++++////      // remove the read from the contig as we don't want it
-////++++////
-////++++////#ifndef PUBLICQUIET
-////++++////      cout << "rej: danger zone\t";
-////++++////#endif
-////++++////
-////++++////#ifdef CLOCK_STEPS
-////++++////      gettimeofday(&us_start,nullptr);
-////++++////#endif
-////++++////      deleteRead(newid);
-////++++////#ifdef CLOCK_STEPS
-////++++////      CON_us_steps[USCLO_DELREAD]=diffsuseconds(us_start);
-////++++////#endif
-////++++////
-////++++////      errstat.code=EDANGERZONE;
-////++++////
-////++++////#ifdef CLOCK_STEPS
-////++++////      gettimeofday(&us_start,nullptr);
-////++++////#endif
-////++++////      if(CON_readpool->getRead(refid).isRail())  {
-////++++////	getRailsAsReadsAffected(refid, errstat.reads_affected, xcut, ycut);
-////++++////      }else{
-////++++////	getReadORPIDsAtContigPosition(errstat.reads_affected, xcut, ycut);
-////++++////      }
-////++++////#ifdef CLOCK_STEPS
-////++++////      CON_us_steps[USCLO_GRACP]=diffsuseconds(us_start);
-////++++////#endif
-////++++////
-////++++////      FUNCEND();
-////++++////      return;
-////++++////    }
-  }
 
-#ifndef PUBLICQUIET
-  cout << "done";
-  cout.flush();
-#endif
+//  //TODO: parametrieren!
+//  if(analyseAllZones(CON_reads.back()) == true){
+//    // todo: in ALUS & co strengere Kriterien.
+//    // remove the read from the contig as we don't want it
+//
+//    deleteRead(newid);
+//    
+//    throw Flow(Flow::POSSIBLE_DEAD_END);
+//  }
+
+  // count this in the readsperstrain statistics
+  ++CON_readsperstrain[CON_readpool->getRead(newid).getStrainID()];
 
   if(CON_fixedconsseq.size()){
     nukeSTLContainer(CON_fixedconsseq);
     nukeSTLContainer(CON_fixedconsqual);
   }
 
-  CON_contains_majority_digitallynormalised_reads=0;
+#ifdef CLOCK_STEPS
+  coutAddReadClocks(us_steps);
+#endif
 
   FUNCEND();
   return;
 }
-#define CEBUG(bla)
-#define CEBUGF(bla)
-#undef CEBUGFLAG
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-void Contig::priv_arw_getReadsAffected(const readid_t refid, const readid_t newid, std::vector<readid_t> & reads_affected, const int32 xcut, const int32 ycut)
-{
-  timeval us_start;
-  gettimeofday(&us_start,nullptr);
-  if(CON_readpool->getRead(refid).isRail())  {
-    // in mapping this can get quite slow for large contigs with hundreds of thousands of reads
-    // workaround: for "small" reads just push the refid.
-    // This may lead to a second / third alignment attempt if the pathfinder has also hits to neighbouring
-    //  rails, but that is still a lot faster that the call to getRailsAsReadsAffected()
-    if(CON_readpool->getRead(newid).getLenClippedSeq()<600)  {
-      reads_affected.push_back(refid);
-    }else{
-      getRailsAsReadsAffected(refid, reads_affected, xcut, ycut);
-    }
-  }else{
-    getReadORPIDsAtContigPosition(reads_affected, xcut, ycut);
-  }
-  if(CON_us_steps.size()>USCLO_GRACP) CON_us_steps[USCLO_GRACP]+=diffsuseconds(us_start);
-  return;
-}
-
+//#define CEBUG(bla)
+//#define CEBUGF(bla)
+//#undef CEBUGFLAG
 
 /*************************************************************************
  *
@@ -3128,61 +5595,22 @@ void Contig::priv_arw_getReadsAffected(const readid_t refid, const readid_t newi
  *
  *************************************************************************/
 
-void Contig::coutAddReadTimings()
+// coffset:  the offset of the contig part in the contig used in the ads
+void Contig::coutAddReadClocks(const vector<suseconds_t> & suv)
 {
-  if(CON_us_steps.size()){
-    cout << "\nccon timings: "
-	 << "\ncct pre\t" << CON_us_steps[USCLO_PRE]
-	 << "\ncct dir\t" << CON_us_steps[USCLO_DIR]
-	 << "\ncct xcu\t" << CON_us_steps[USCLO_XCUT]
-	 << "\ncct tmp\t" << CON_us_steps[USCLO_TEMPL1]
-	 << "\ncct sw \t" << CON_us_steps[USCLO_SWALIGN]
-	 << "\ncct pic\t" << CON_us_steps[USCLO_PREINSCHK]
-	 << "\ncct ico\t" << CON_us_steps[USCLO_INSCON]
-	 << "\ncct icm\t" << CON_us_steps[USCLO_INSCONM]
-	 << "\ncct upd\t" << CON_us_steps[USCLO_UPDBLOCKS]
-	 << "\ncct del\t" << CON_us_steps[USCLO_DELREAD]
-	 << "\ncct rmz\t" << CON_us_steps[USCLO_ANRMBZ]
-	 << "\ncct gcp\t" << CON_us_steps[USCLO_GRACP]
-	 << '\n';
-  }
-  if(CON_us_steps_iric.size()){
-    cout << "\nccon i timings (" << CON_track_numins << "): "
-	 << "\nccit insglcc\t" << CON_us_steps_iric[USCLOIRIC_INSGLCC]
-	 << "\nccit insglaro\t" << CON_us_steps_iric[USCLOIRIC_INSGLARO]
-	 << "\nccit insglact\t" << CON_us_steps_iric[USCLOIRIC_INSGLACT]
-	 << "\nccit insgltot\t" << CON_us_steps_iric[USCLOIRIC_INSGLTOT]
-	 << "\nccit pr\t\t" << CON_us_steps_iric[USCLOIRIC_PR]
-	 << "\nccit templ\t" << CON_us_steps_iric[USCLOIRIC_TEMPL]
-	 << "\nccit index\t" << CON_us_steps_iric[USCLOIRIC_INDEX]
-	 << "\nccit biglccins\t" << CON_us_steps_iric[USCLOIRIC_BIGLCCINS]
-	 << "\nccit biglinterpol\t" << CON_us_steps_iric[USCLOIRIC_BIGLINTERPOL]
-	 << "\nccit biglupdtags\t" << CON_us_steps_iric[USCLOIRIC_BIGLUPDTAGS]
-	 << "\nccit biglfpcri\t" << CON_us_steps_iric[USCLOIRIC_BIGLFPCRI]
-	 << "\nccit bigllgap\t" << CON_us_steps_iric[USCLOIRIC_BIGLLIGAPINREADS]
-	 << "\nccit biglshiftread\t" << CON_us_steps_iric[USCLOIRIC_BIGLSHIFTREADS]
-	 << "\nccit bigltot\t" << CON_us_steps_iric[USCLOIRIC_BIGLTOT]
-	 << "\nccit insgr\t" << CON_us_steps_iric[USCLOIRIC_INSGR]
-	 << "\nccit ucv\t" << CON_us_steps_iric[USCLOIRIC_UCV]
-	 << "\n";
-  }
-  if(CON_us_steps_drfc.size()){
-    cout << "\nccon d timings (" << CON_track_numdels << "): "
-	 << "\nccdt ubl\t"   << setw(14) << CON_us_steps_drfc[USCLODRFC_UBL]
-	 << "\nccdt ucv\t"   << setw(14) << CON_us_steps_drfc[USCLODRFC_UCV]
-	 << "\nccdt itf\t"   << setw(14) << CON_us_steps_drfc[USCLODRFC_ITF]
-	 << "\nccdt itb\t"   << setw(14) << CON_us_steps_drfc[USCLODRFC_ITB]
-	 << "\nccdt ccef\t"  << setw(14) << CON_us_steps_drfc[USCLODRFC_CCEF]
-	 << "\nccdt cceb\t"  << setw(14) << CON_us_steps_drfc[USCLODRFC_CCEB]
-	 << "\nccdt sdt\t"   << setw(14) << CON_us_steps_drfc[USCLODRFC_SDT]
-	 << "\nccdt sr\t\t"  << setw(14) << CON_us_steps_drfc[USCLODRFC_SR]
-	 << "\nccdt smp\t"   << setw(14) << CON_us_steps_drfc[USCLODRFC_SMP]
-	 << "\nccdt dt\t\t"  << setw(14) << CON_us_steps_drfc[USCLODRFC_DT]
-	 << "\nccdt rr\t\t"  << setw(14) << CON_us_steps_drfc[USCLODRFC_RR]
-	 << "\nccdt dsoc\t"  << setw(14) << CON_us_steps_drfc[USCLODRFC_DSOC]
-	 << "\nccdt total\t" << setw(14) << CON_us_steps_drfc[USCLODRFC_TOTAL]
-	 << "\n";
-  }
+#ifdef CLOCK_STEPS
+  cout << "\nctimings: " << 
+    suv[USCLO_PRE] << " / " <<
+    suv[USCLO_DIR] << " / " <<
+    suv[USCLO_XCUT] << " / " <<
+    suv[USCLO_TEMPL1] << " / " <<
+    suv[USCLO_SWALIGN] << " / " <<
+    suv[USCLO_PREINSCHK] << " / " <<
+    suv[USCLO_INSCON] << " / " <<
+    suv[USCLO_UPDBLOCKS] << " / " <<
+    suv[USCLO_DELREAD] << " / " <<
+    suv[USCLO_ANRMBZ] << '\n';
+#endif
 }
 
 
@@ -3197,11 +5625,11 @@ void Contig::coutAddReadTimings()
 void Contig::setContigCoverageTarget(vector<uint32> covtarget)
 {
   FUNCSTART("void Contig::setContigCoverageTarget(vector<uint32)");
-
+  
   CON_targetcoverageperst.clear();
   if(covtarget.empty()) return;
 
-  BUGIFTHROW(covtarget.size()!=ReadGroupLib::SEQTYPE_END, "covtarget.size()!=ReadGroupLib::SEQTYPE_END ??");
+  BUGIFTHROW(covtarget.size()!=Read::SEQTYPE_END, "covtarget.size()!=Read::SEQTYPE_END ??");
   for(uint32 i=0; i<covtarget.size(); i++){
     CON_targetcoverageperst.push_back(static_cast<uint16>(covtarget[i]));
   }
@@ -3233,15 +5661,15 @@ bool Contig::checkFreeCoverageForAddingRead(const uint8 newreadseqtype, const in
     maxcovallowed=max(tmp,maxcovallowed);
   }
 
-  auto ccI=CON_counts.begin();
+  cccontainer_t::const_iterator ccI=CON_counts.begin();
   advance(ccI,xcut);
-
+  
   if(maxcovallowed<10) maxcovallowed=10;
 
   // The 16383 number stems from the 16 bit base counters in CON_concounts[]
-  //  which use increments by 4
+  //  which use increments by 4 
   // 1073741823 is for 32 bit counters (== 2^32 / 4 -1)
-  for(int32 ci=xcut; ci<ycut && ccI!=CON_counts.end(); ++ccI, ++ci){
+  for(int32 ci=xcut; ci<ycut && ccI!=CON_counts.end(); ci++, ccI++){
     CEBUG("ci: " << ci << '\t' << ccI->seqtype_cov[0] << '\t' << ccI->seqtype_cov[1] << '\t' << ccI->seqtype_cov[2] << '\t' << ccI->seqtype_cov[3] << "\tc: " << ccI->total_cov);
     if(ccI->seqtype_cov[newreadseqtype]>maxcovallowed
       || ccI->total_cov == 1073741823) {
@@ -3257,6 +5685,65 @@ bool Contig::checkFreeCoverageForAddingRead(const uint8 newreadseqtype, const in
 
 
 
+/*************************************************************************
+ *
+ * Starting from a reference id that is a rail, takes reads in readpool 
+ *  before and after that are rails and that fall into the same xcut,
+ *  ycut region as given and pushed them into the vector
+ *
+ *************************************************************************/
+
+//#define CEBUG(bla)   {cout << bla; cout.flush();}
+void Contig::getRailsAsReadsAffected(const int32 refid, vector<int32> & reads_affected, const int32 xcut, const int32 ycut)
+{
+  FUNCSTART("void Contig::getRailsAsReadsAffected(const int32 refid, vector<int32> & reads_affected)");
+
+  if(CON_readpool->getRead(refid).isRail()){
+    CEBUG("Ref Rail: " << CON_readpool->getRead(refid).getName() << '\n');
+    reads_affected.push_back(refid);
+
+    // initialise CON_maprpids_to_conreadsids if it's dirty (==empty)
+    if(CON_maprpids_to_conreadsids.empty()){
+      CON_maprpids_to_conreadsids.resize(CON_readpool->size(),-1);
+      for(int32 i=0;i<CON_reads.size(); i++){
+	if(CON_reads[i].orpid>=0){
+	  CON_maprpids_to_conreadsids[CON_reads[i].orpid]=i;
+	}
+      }
+    }
+
+    int32 rpid_refid=CON_maprpids_to_conreadsids[refid];
+    if(rpid_refid==-1){
+      throw Notify(Notify::INTERNAL, THISFUNC, "RefID not found on contig?");
+    }
+
+    for(int32 actid=rpid_refid-1; actid>=0 && CON_reads[actid].orpid>=0 && CON_reads[actid].read.isRail(); actid--){
+      if((xcut>=CON_reads[actid].offset && xcut <CON_reads[actid].offset+CON_reads[actid].read.getLenClippedSeq())
+	 || (ycut>=CON_reads[actid].offset && ycut <CON_reads[actid].offset+CON_reads[actid].read.getLenClippedSeq())){
+	CEBUG("also rail-: " << CON_readpool->getRead(CON_reads[actid].orpid).getName() << '\n');
+	reads_affected.push_back(CON_reads[actid].orpid);
+      }else{
+	// get out, we won't find more downstream anyway
+	break;
+      }
+    }
+    for(int32 actid=rpid_refid+1; actid<CON_reads.size() && CON_reads[actid].orpid>=0 && CON_reads[actid].read.isRail(); actid++){
+      if((xcut>=CON_reads[actid].offset && xcut <CON_reads[actid].offset+CON_reads[actid].read.getLenClippedSeq())
+	 || (ycut>=CON_reads[actid].offset && ycut <CON_reads[actid].offset+CON_reads[actid].read.getLenClippedSeq())){
+	CEBUG("also rail+: " << CON_readpool->getRead(CON_reads[actid].orpid).getName() << '\n');
+	reads_affected.push_back(CON_reads[actid].orpid);
+      }else{
+	// get out, we won't find more upstream anyway
+	break;
+      }
+    }
+  }
+
+  FUNCEND();
+  return;
+}
+//#define CEBUG(bla)
+
 
 /*************************************************************************
  *
@@ -3284,12 +5771,12 @@ int32 Contig::analyseADSForCuttingBackCERMap(const AlignedDualSeq & ads, int32 d
   // This is a read that claims it wants to be mapped but has too many errors
   int32 id=ads.getOtherID(-1);
 
-  if(CON_readpool->getRead(id).getSequencingType() != ReadGroupLib::SEQTYPE_SOLEXA
-     && CON_readpool->getRead(id).getSequencingType() != ReadGroupLib::SEQTYPE_ABISOLID){
-    MIRANOTIFY(Notify::INTERNAL, "Trying to cut back other than Solexa / SOLiD ?");
+  if(CON_readpool->getRead(id).getSequencingType() != Read::SEQTYPE_SOLEXA
+     && CON_readpool->getRead(id).getSequencingType() != Read::SEQTYPE_ABISOLID){
+    throw Notify(Notify::INTERNAL, THISFUNC, "Trying to cut back other than Solexa / SOLiD ?");
   }
 
-  // get pointer to the aligned contig
+  // get pointer to the aligned contig 
   const char * contigptr;
   const char * readptr;
   //int32 indexincontig;
@@ -3404,11 +5891,11 @@ int32 Contig::analyseADSForCuttingBackCERMap(const AlignedDualSeq & ads, int32 d
 
 //#define CEBUG(bla)   {cout << bla; cout.flush();}
 
-bool Contig::insertMappedReadInContig(const AlignedDualSeq & ads, const uint8 newreadseqtype, const uint32 coffset, const int32 direction_frnid, int32 coveragemultiplier, bool forcemerge)
+bool Contig::insertMappedReadInContig(const AlignedDualSeq & ads, const uint8 newreadseqtype, const uint32 coffset, const int32 direction_frnid, bool forcemerge)
 {
   //hier weiter: gaps anders behandeln (mitzaehlen) desgleichen auch in insertRead()
 
-  FUNCSTART("bool Contig::insertMappedReadInContig(const AlignedDualSeq & ads, const uint8 newreadseqtype, const uint32 coffset, const int32 direction_frnid, int32 coveragemultiplier, bool forcemerge)");
+  FUNCSTART("void Contig::insertMappedReadInContig(AlignedDualSeq & ads, uint32 coffset, int32 direction_frnid)");
 
   CEBUG("CON_reads:" << CON_reads.size() << endl);
   CEBUG("CON_counts:" << CON_counts.size() << endl);
@@ -3421,15 +5908,15 @@ bool Contig::insertMappedReadInContig(const AlignedDualSeq & ads, const uint8 ne
   // TODO: do we need that?
   definalise();
 
-  // precalculate the offset into CON_counts.bbcounts[] according to
+  // precalculate the offset into CON_counts.bbcounts[] according to 
   //  sequencing type
   unsigned int sr_seqtypeoffset=0;
-  if(newreadseqtype == ReadGroupLib::SEQTYPE_SOLEXA){
+  if(newreadseqtype == Read::SEQTYPE_SOLEXA){
     sr_seqtypeoffset=0;
-  }else if(newreadseqtype == ReadGroupLib::SEQTYPE_ABISOLID){
+  }else if(newreadseqtype == Read::SEQTYPE_ABISOLID){
     sr_seqtypeoffset=1;
   }else{
-    MIRANOTIFY(Notify::INTERNAL, "Trying to map other than Solexa / SOLiD ?");
+    throw Notify(Notify::INTERNAL, THISFUNC, "Trying to map other than Solexa / SOLiD ?");
   }
 
   //// precalculate the bbstrains bitmask
@@ -3446,7 +5933,7 @@ bool Contig::insertMappedReadInContig(const AlignedDualSeq & ads, const uint8 ne
 
   // precalculate the bbstrains bitmask
   uint8 strainmask=0;
-  if(newreadseqtype==ReadGroupLib::SEQTYPE_SOLEXA){
+  if(newreadseqtype==Read::SEQTYPE_SOLEXA){
     strainmask=getBBStrainMask(CON_readpool->getRead(id).getStrainID());
   }
 
@@ -3468,7 +5955,7 @@ bool Contig::insertMappedReadInContig(const AlignedDualSeq & ads, const uint8 ne
 
     CEBUG("loopi: " << loopi << endl);
 
-    // get pointer to the aligned contig
+    // get pointer to the aligned contig 
     const char * contigptr;
     const char * readptr;
     int32 indexincontig;
@@ -3482,7 +5969,7 @@ bool Contig::insertMappedReadInContig(const AlignedDualSeq & ads, const uint8 ne
     indexincontig= offsetnewread;
     indexinread=0;
 
-    auto ccI=CON_counts.begin();
+    cccontainer_t::iterator ccI=CON_counts.begin();
     advance(ccI,offsetnewread);
 
     // get the qualities for this read and position a pointer on the first
@@ -3503,21 +5990,21 @@ bool Contig::insertMappedReadInContig(const AlignedDualSeq & ads, const uint8 ne
       CEBUG("\t*qvI: " << (uint16) *qvI);
       CEBUG("\t*cptr: " << *contigptr);
 
-//      /* WARNING!!!!!!!!!!!!!!!!!!!!!!!!!
-//
-//	 These two checks below which look at the boundaries of the quality
-//	 iterator only work because at the moment MIRA enforces a left clip of 1 on
-//	 all short reads to hide the tag in GAP4
-//
-//	 rethink that strategy should this change one day!
-//      */
-//      if(forcemerge){
-//	// on forced merge, do everything so that we don't stop
-//	if(qvI==qv.begin() || qvI==qv.end()) qvI-=direction_frnid;
-//      }else{
-//	BUGIFTHROW(qvI==qv.begin(),"quality out of bounds? 1");
-//	BUGIFTHROW(qvI==qv.end(),"quality out of bounds? 2");
-//      }
+      /* WARNING!!!!!!!!!!!!!!!!!!!!!!!!!
+       
+	 These two checks below which look at the boundaries of the quality
+	 iterator only work because at the moment MIRA enforces a left clip of 1 on
+	 all short reads to hide the tag in GAP4
+    
+	 rethink that strategy should this change one day!
+      */
+      if(forcemerge){
+	// on forced merge, do everything so that we don't stop
+	if(qvI==qv.begin() || qvI==qv.end()) qvI-=direction_frnid;
+      }else{
+	BUGIFTHROW(qvI==qv.begin(),"quality out of bounds? 1");
+	BUGIFTHROW(qvI==qv.end(),"quality out of bounds? 2");
+      }
 
       if(indexincontig<0 || indexincontig >= CON_counts.size()+1) {
 	// force it ... somehow ... to continue the for loop;
@@ -3525,24 +6012,24 @@ bool Contig::insertMappedReadInContig(const AlignedDualSeq & ads, const uint8 ne
 
 	cout << "indexincontig: " << indexincontig << endl;
 	cout << "\nCON_counts.size()+1: " << CON_counts.size()+1;
-
+      
 	cout << "\n\n" << ads << endl;
-
+      
 	setCoutType(AS_CAF);
 	cout << *this;
 	setCoutType(AS_TEXT);
 	cout << *this;
-	MIRANOTIFY(Notify::INTERNAL, "BOUNDCHECK error");
+	throw Notify(Notify::INTERNAL, THISFUNC, "BOUNDCHECK error");
       }
 
       if(loopi){
-	ccI->seqtype_cov[newreadseqtype]+=coveragemultiplier;
-	ccI->total_cov+=coveragemultiplier;
+	ccI->seqtype_cov[newreadseqtype]++;
+	ccI->total_cov++;
       }
 
       BUGIFTHROW(!forcemerge && *contigptr=='*',"!forcemerge && *contigptr=='*' ?");
 
-      // we may have a gap in the read, this is ok as long as the
+      // we may have a gap in the read, this is ok as long as the 
       //   consensus has the code for "old gap" ('#')
       if(*readptr=='*'){
 	if(!forcemerge && *contigptr!='#'){
@@ -3554,50 +6041,44 @@ bool Contig::insertMappedReadInContig(const AlignedDualSeq & ads, const uint8 ne
 	  //cout << "\tcontig has " << static_cast<char>(*contigptr);
 	  //cout << "\nio: " << ioverlap << "\ti_c: " << indexincontig;
 	  //cout << "\ti_r: " << indexinread;
-	  //cout << "\n";
+	  //cout << "\n"; 
 	  //throw Notify(Notify::INTERNAL, THISFUNC, "logical error");
-
+	  
 	  return false;
 	}else{
+	  // in the mean time, the qvI iterator must be decreased/increased as
+	  //  no quality value exists at the moment in the read and we must counter
+	  //  the increase/decrease in the for loop
+	  qvI-=direction_frnid;
+
 	  if(loopi){
 	    // increase the gap count
-	    ccI->bbcounts[sr_seqtypeoffset]+=coveragemultiplier;
-
+	    ccI->bbcounts[sr_seqtypeoffset]+=1;
+	    
 	    // set the strain bitmask
 	    ccI->bbstrains[sr_seqtypeoffset]|=strainmask;
-
-	    BUGIFTHROW(qvI-qv.begin()<0 || qvI-qv.begin() >= qv.size(),"chk 1 qvI " << qvI-qv.begin() << " out of bounds wrt " << qv.size());
+	    
 	    // see whether we need to adapt the gap quality
 	    uint16 gapqual=*qvI;
 	    // move the quality pointer back by one to counterbalance
 	    //  the for loop (illegally) munching up one quality value
 	    //  as this was a *new* gap in the read
 	    qvI-=direction_frnid;
-	    BUGIFTHROW(qvI-qv.begin()<0 || qvI-qv.begin() >= qv.size(),"chk 2 qvI " << qvI-qv.begin() << " out of bounds wrt " << qv.size());
 	    if(qvI!=qv.end()) gapqual=(gapqual+(*qvI))/2;
 	    if(gapqual>ccI->bbbestquals[sr_seqtypeoffset]){
 	      ccI->bbbestquals[sr_seqtypeoffset]=static_cast<base_quality_t>(gapqual);
-	      BUGIFTHROW(ccI->bbbestquals[sr_seqtypeoffset]>100,"qualchk 1 >100");
 	    }
-	  }else{
-	    // in the mean time, the qvI iterator must be decreased/increased as
-	    //  no quality value exists at the moment in the read and we must counter
-	    //  the increase/decrease in the for loop
-	    qvI-=direction_frnid;
-
 	  }
 	}
       }else{
 	if(forcemerge
-	   || toupper(*readptr) == ccI->getOriginalBBChar()
+	   || toupper(*readptr) == ccI->backbonechar
 	   || toupper(*readptr) == 'N'){            // in dubio pro reo
 	  if(loopi){
-	    ccI->bbcounts[sr_seqtypeoffset]+=coveragemultiplier;
+	    ccI->bbcounts[sr_seqtypeoffset]+=1;
 	    ccI->bbstrains[sr_seqtypeoffset]|=strainmask;
-	    BUGIFTHROW(qvI-qv.begin()<0 || qvI-qv.begin() >= qv.size(),"chk 3 qvI " << qvI-qv.begin() << " out of bounds wrt " << qv.size());
 	    if(*qvI > ccI->bbbestquals[sr_seqtypeoffset]){
 	      ccI->bbbestquals[sr_seqtypeoffset]=*qvI;
-	      BUGIFTHROW(ccI->bbbestquals[sr_seqtypeoffset]>100,"qualchk 2 >100");
 	    }
 	  }
 	}else if(!forcemerge && *contigptr!='#'){
@@ -3607,7 +6088,7 @@ bool Contig::insertMappedReadInContig(const AlignedDualSeq & ads, const uint8 ne
 	  //cout << "\tcontig has " << static_cast<char>(*contigptr);
 	  //cout << "\nio: " << ioverlap << "\ti_c: " << indexincontig;
 	  //cout << "\ti_r: " << indexinread;
-	  //cout << "\nbackbone has: " << static_cast<char>(ccI->getBBChar()) << endl;
+	  //cout << "\nbackbone has: " << static_cast<char>(ccI->backbonechar) << endl;
 	  //throw Notify(Notify::INTERNAL, THISFUNC, "logical error 2");
 
 	  // return only if we do not try to force the merge
@@ -3615,10 +6096,10 @@ bool Contig::insertMappedReadInContig(const AlignedDualSeq & ads, const uint8 ne
 	  return false;
 	}
       }
-    }
+    }    
   }
 
-  CON_nummergedreads_perseqtype[sr_seqtypeoffset]+=coveragemultiplier;
+  CON_nummergedreads_perseqtype[sr_seqtypeoffset]++;
 
   return true;
 }
@@ -3636,23 +6117,19 @@ bool Contig::insertMappedReadInContig(const AlignedDualSeq & ads, const uint8 ne
 
 //#define CEBUG(bla)   {cout << bla; cout.flush();}
 
+//#define CLOCK_STEPS
 //#define IRICTRACE
 
 // coffset:  the offset of the contig part in the contig used in the ads
-PlacedContigReads::const_iterator Contig::insertReadInContig(const AlignedDualSeq & ads, uint32 coffset, int32 direction_frnid, int32 direction_refid, int32 coveragemultiplier)
+void Contig::insertReadInContig(const AlignedDualSeq & ads, uint32 coffset, int32 direction_frnid, int32 direction_refid)
 {
-  FUNCSTART("void Contig::insertReadInContig(AlignedDualSeq & ads, uint32 coffset, int32 direction_frnid, int32 direction_refid, int32 coveragemultiplier)");
+  FUNCSTART("void Contig::insertReadInContig(AlignedDualSeq & ads, uint32 coffset, int32 direction_frnid, int32 direction_refid)");
 
-#ifdef CLOCK_STEPS_IRIC
+#ifdef CLOCK_STEPS
   timeval us_start;
-  timeval us_tmpstart;
-  gettimeofday(&us_start,nullptr);
-  uint32 numgapsincon=0;
-  uint32 numreadinserts=0;
+  gettimeofday(&us_start,NULL);
 #endif
 
-  ++CON_track_numins;
-
   CEBUG("CON_reads:" << CON_reads.size() << endl);
   CEBUG("CON_counts:" << CON_counts.size() << endl);
 
@@ -3667,7 +6144,7 @@ PlacedContigReads::const_iterator Contig::insertReadInContig(const AlignedDualSe
 #endif
 
 
-  int32 newrid=ads.getOtherID(-1);
+  int32 id=ads.getOtherID(-1);
 
   //if(CON_readpool->getRead(id).getName()=="125691_2930_3355"){
   //  cout << "Dingodong\n";
@@ -3681,16 +6158,16 @@ PlacedContigReads::const_iterator Contig::insertReadInContig(const AlignedDualSe
   // compute the offset of this read in the contig.
   //  it might change later if the contig has grown to the left, but
   //  basically it's like this:
-  int32 offsetnewread;
-  offsetnewread=coffset+ads.getOffsetInAlignment(newrid);
+  uint32 offsetnewread;
+  offsetnewread=coffset+ads.getOffsetInAlignment(id);
 
   BUGIFTHROW(coffset > CON_counts.size(),"Something is wrong with coffset: " << coffset);
-  BUGIFTHROW(ads.getOffsetInAlignment(newrid) > CON_counts.size(),"Something is wrong with that ADS!\n" << ads);
+  BUGIFTHROW(ads.getOffsetInAlignment(id) > CON_counts.size(),"Something is wrong with that ADS!\n" << ads);
   BUGIFTHROW(offsetnewread>CON_counts.size(),"offsetnewread>CON_counts.size() ???");
 
   // Has the consensus grown to the left?
   int32 grownleft=0;
-  if(ads.getOffsetInAlignment(newrid)==0 && ads.getOffsetInAlignment(-1)!=0){
+  if(ads.getOffsetInAlignment(id)==0 && ads.getOffsetInAlignment(-1)!=0){
     grownleft=-(coffset-ads.getOffsetInAlignment(-1));
     CEBUG("Grown left: " << grownleft << endl);
 
@@ -3701,27 +6178,19 @@ PlacedContigReads::const_iterator Contig::insertReadInContig(const AlignedDualSe
     // No big deal, this ain't an error.
 
     if(grownleft>0){
-      // Yes, it has. So insert the needed positions into the
+      // Yes, it has. So insert the needed positions into the 
       //  contig and ...
-
-      gettimeofday(&us_tmpstart,nullptr);
+	
       CON_counts.insert(CON_counts.begin(), grownleft, CON_concounts_zero);
-      CON_us_steps_iric[USCLOIRIC_INSGLCC]+=diffsuseconds(us_tmpstart);
-      gettimeofday(&us_tmpstart,nullptr);
 
       // ... this new read is the (an) anchor in the contig, so offset=0 ...
       offsetnewread=0;
 
-      //// ... and adjust the beginning of the reads which are behind.
-      //for(uint32 k=0; k<CON_reads.size(); k++){
-      //	CON_reads[k].offset+=grownleft;
-      //	CEBUG("========" << CON_reads[k].offset);
-      //}
-      CON_reads.shiftReads(0,grownleft);
-      shiftMarkerPositions(0,grownleft);
-
-      CON_us_steps_iric[USCLOIRIC_INSGLARO]+=diffsuseconds(us_tmpstart);
-      gettimeofday(&us_tmpstart,nullptr);
+      // ... and adjust the beginning of the reads which are behind.
+      for(uint32 k=0; k<CON_reads.size(); k++){
+	CON_reads[k].offset+=grownleft;
+	CEBUG("========" << CON_reads[k].offset);
+      }
 
       // ... and adjust the consensus tags which are behind.
       for(uint32 k=0; k<CON_consensus_tags.size(); k++){
@@ -3729,9 +6198,6 @@ PlacedContigReads::const_iterator Contig::insertReadInContig(const AlignedDualSe
 	CON_consensus_tags[k].to+=grownleft;
       }
 
-      CON_us_steps_iric[USCLOIRIC_INSGLACT]+=diffsuseconds(us_tmpstart);
-      gettimeofday(&us_tmpstart,nullptr);
-
     }else{
       grownleft=0;
     }
@@ -3741,39 +6207,108 @@ PlacedContigReads::const_iterator Contig::insertReadInContig(const AlignedDualSe
   cout << "postl1 "; cout.flush();
 #endif
 
-  CON_us_steps_iric[USCLOIRIC_INSGLTOT]+=diffsuseconds(us_start);
-  gettimeofday(&us_start,nullptr);
+#ifdef CLOCK_STEPS
+  cout << "\nirictimings 1: " << diffsuseconds(us_start) << endl;
+  gettimeofday(&us_start,NULL);
+#endif
 
-  // now place the read into the PlacedContigReads of the contig
-  auto nprI=CON_reads.placeRead(CON_readpool->getRead(newrid),
-			       newrid,
-			       offsetnewread,
-			       direction_frnid*direction_refid);
+  // template for new read (initialise what we already know,
+  //  except the read itself, because we don't want it to be copied
+  //  twice :)
+  contigread_t newread;
+  newread.orpid=id;
+  newread.direction=direction_frnid*direction_refid;
+  newread.offset=offsetnewread;
+  // newread.read=CON_readpool->getRead(id); // NO! we don't copy it twice
 
-  CON_us_steps_iric[USCLOIRIC_PR]+=diffsuseconds(us_start);
+  // now insert the read into the readpool of the contig 
+  CON_reads.push_back(newread);
 
 #ifdef IRICTRACE
-  cout << "postreadplace "; cout.flush();
+  cout << "postreadpush "; cout.flush();
+#endif
+
+// Superceded by Read strategy of moderate growth
+//  // insertions and / or deletions may very well occur in that read 
+//  //  due to other reads in the contig at that position.
+//  // therefore, reserve some additional space in the read for these
+//  //  insertions so that the internal containers don't double at the first 
+//  //  insertion
+//  // 
+//  // for that, set the adjustment flag of the newread because reserve()
+//  //  uses that too
+//
+//  {
+//    if(!CON_readpool->getRead(id).usesAdjustments()){
+//      CON_reads.back().read.disallowAdjustments();
+//    }
+//
+//    // TODO: perhaps as parameter?
+//#if CPP_READ_SEQTYPE_END != 5
+//#error "This code is made for 5 sequencing types, adapt!"
+//#endif
+//
+//    uint32 lenclipped=CON_readpool->getRead(id).getLenClippedSeq();
+//    uint32 additionalreserve=0;
+//    switch(CON_readpool->getRead(id).getSequencingType()){
+//    case Read::SEQTYPE_SANGER : {
+//      // 10% for Sanger
+//      additionalreserve=lenclipped/10;
+//      break;
+//    }
+//    case Read::SEQTYPE_454GS20 : {
+//      // 20% for 454 (better safe than sorry for high coverage projects)
+//      additionalreserve=lenclipped/15;
+//      break;
+//    }
+//    case Read::SEQTYPE_PACBIO : {
+//      // 20% for PacBio (strobed reads, dark strobe editing)
+//      additionalreserve=lenclipped/10;
+//      break;
+//    }
+//    case Read::SEQTYPE_SOLEXA : {
+//      // 6% for Solexa as overwhelming majority has no indel
+//      additionalreserve=lenclipped/15;
+//    }
+//    case Read::SEQTYPE_ABISOLID : {
+//      throw Notify(Notify::INTERNAL, THISFUNC, "Type ABI SOLiD needs more support c1.");
+//    }
+//    default: {
+//      throw Notify(Notify::INTERNAL, THISFUNC, "Whoooooops? Unknown sequencing type?");
+//    }
+//    }
+//
+//    CON_reads.back().read.reserve(CON_readpool->getRead(id).getLenSeq()+additionalreserve);
+//  }
+  
+
+#ifdef CLOCK_STEPS
+  cout << "irictimings 2: " << diffsuseconds(us_start) << endl;
+  gettimeofday(&us_start,NULL);
 #endif
 
+  // ... and set the read object itself.
+  CON_reads.back().read=CON_readpool->getRead(id);
+
+#ifdef CLOCK_STEPS
+  cout << "irictimings 3: " << diffsuseconds(us_start) << endl;
+  gettimeofday(&us_start,NULL);
+#endif
 
   // add template if any
-  if(CON_readpool->getRead(newrid).getTemplateID()>=0){
-    gettimeofday(&us_start,nullptr);
-    CON_templates_present.insert(CON_readpool->getRead(newrid).getTemplateID());
-    CON_us_steps_iric[USCLOIRIC_TEMPL]+=diffsuseconds(us_start);
+  if(CON_reads.back().read.getTemplateID()>=0){
+    CON_templates_present.insert(CON_reads.back().read.getTemplateID());
   }
 
 #ifdef IRICTRACE
   cout << "postti "; cout.flush();
 #endif
 
-  gettimeofday(&us_start,nullptr);
 
   CEBUG("Offset of new read: " << offsetnewread << endl);
-  CEBUG("Direction: " << direction_frnid*direction_refid << endl);
+  CEBUG("Direction: " << newread.direction << endl);
 
-  // get pointer to the aligned contig
+  // get pointer to the aligned contig 
   const char * contigptr;
   const char * readptr;
   int32 indexincontig;
@@ -3781,13 +6316,13 @@ PlacedContigReads::const_iterator Contig::insertReadInContig(const AlignedDualSe
 
   // ... and advance it to the beginning of the overlap
   if(ads.getOffsetInAlignment(-1) == 0){
-    contigptr= ads.getAlignedSequence(-1)+ads.getOffsetInAlignment(newrid);
-    readptr= ads.getAlignedSequence(newrid);
-    indexincontig= offsetnewread;
+    contigptr= ads.getAlignedSequence(-1)+ads.getOffsetInAlignment(id);
+    readptr= ads.getAlignedSequence(id);
+    indexincontig= newread.offset;
     indexinread=0;
   }else{
     contigptr= ads.getAlignedSequence(-1);
-    readptr= ads.getAlignedSequence(newrid)+ads.getOffsetInAlignment(-1);
+    readptr= ads.getAlignedSequence(id)+ads.getOffsetInAlignment(-1);
     //WRONG! causes Heisenbug
     // indexincontig=newread.offset+ads.getOffsetInAlignment(-1);
 
@@ -3795,9 +6330,9 @@ PlacedContigReads::const_iterator Contig::insertReadInContig(const AlignedDualSe
     //indexincontig=newread.offset;
 
     if(grownleft>0) {
-      indexincontig=offsetnewread+ads.getOffsetInAlignment(-1);
+      indexincontig=newread.offset+ads.getOffsetInAlignment(-1);
     }else{
-      indexincontig=offsetnewread;
+      indexincontig=newread.offset;
     }
 
     indexinread=ads.getOffsetInAlignment(-1);
@@ -3808,56 +6343,53 @@ PlacedContigReads::const_iterator Contig::insertReadInContig(const AlignedDualSe
   BUGIFTHROW(indexinread<0, "indexinread < 0 ?");
   BUGIFTHROW(indexincontig<0, "indexincontig < 0 ?");
 
-  CON_us_steps_iric[USCLOIRIC_INDEX]+=diffsuseconds(us_start);
-  gettimeofday(&us_start,nullptr);
+  cccontainer_t::iterator ccI;
+
+#ifdef CLOCK_STEPS
+  cout << "irictimings 4: " << diffsuseconds(us_start) << endl;
+  gettimeofday(&us_start,NULL);
+#endif
 
   // Now go through the aligned contig and read base per base
   //  and see whether there must be inserted a gap in either one
 
-  // TODO: in case this loop is still a major time eater, think of possible
-  //  ways around
-  // 1) either collect from the ADS all edits and then make the inserts in CON_reads
-  //    looping through only once
-  // 2) probably better: track "longest read" in contig, then start CON_reads loop
-  //    not from begin(), but from read at nrpI.getReadStartOffset()-"len(longestread)"
-  //    (eventually treat backbones differently???)
-  // 3) combine 1+2 ???
-
   {
-    // will be initialised the first time a gap must be inserted in
-    //  reads. Once initialised, needs not to be searched again for
-    auto quickfirstpcrI(CON_reads.end());
+#ifdef CLOCK_STEPS
+    suseconds_t cs_ccinsert=0;
+    suseconds_t cs_rloop=0;
+
+    timeval us_loop;
+#endif
 
     base_quality_t gapqual;
 
-    cccontainer_t::iterator ccI=CON_counts.begin();
-    for(int32 olli=0; olli<ads.getOverlapLen(); ++contigptr, ++readptr, ++indexincontig, ++indexinread, ++olli){
-      CEBUG("olli: " << olli << "\ti_c: " << indexincontig);
+    for(int32 i=0; i<ads.getOverlapLen(); i++, contigptr++, readptr++, indexincontig++, indexinread++){
+      CEBUG("i: " << i << "\ti_c: " << indexincontig);
       CEBUG("\ti_r: " << indexinread);
       CEBUG("\t*rptr: " << *readptr);
       CEBUG("\t*cptr: " << *contigptr);
 
 
       //BOUNDCHECK(indexincontig, 0, CON_counts.size()+1);
-
+      
       if(indexincontig<0 || indexincontig >= CON_counts.size()+1) {
 	cout << "indexincontig: " << indexincontig << endl;
 	cout << "\nCON_counts.size()+1: " << CON_counts.size()+1;
-
+	
 	cout << "\n\n" << ads << endl;
 
 	setCoutType(AS_CAF);
 	cout << *this;
 	setCoutType(AS_TEXT);
 	cout << *this;
-	MIRANOTIFY(Notify::INTERNAL, "BOUNDCHECK error");
+	throw Notify(Notify::INTERNAL, THISFUNC, "BOUNDCHECK error");
       }
-//      CEBUG(" CC: " << CON_counts[indexincontig].A << "\t"
-//	    <<CON_counts[indexincontig].C << "\t"
-//	    <<CON_counts[indexincontig].G << "\t"
-//	    <<CON_counts[indexincontig].T << "\t"
-//	    <<CON_counts[indexincontig].star << "\t"
-//	    <<CON_counts[indexincontig].coverage << endl);
+      CEBUG(" CC: " << CON_counts[indexincontig].A << "\t" 
+	    <<CON_counts[indexincontig].C << "\t" 
+	    <<CON_counts[indexincontig].G << "\t" 
+	    <<CON_counts[indexincontig].T << "\t" 
+	    <<CON_counts[indexincontig].star << "\t" 
+	    <<CON_counts[indexincontig].coverage << endl);
 
 
       // is there a gap in the contig?
@@ -3867,9 +6399,8 @@ PlacedContigReads::const_iterator Contig::insertReadInContig(const AlignedDualSe
 	BUGIFTHROW(*readptr=='*',"Both strands in ads have a '*' ?");
 	CEBUG("\t* in con\n");
 
-#ifdef CLOCK_STEPS_IRIC
-	++numgapsincon;
-	gettimeofday(&us_tmpstart,nullptr);
+#ifdef CLOCK_STEPS
+	gettimeofday(&us_loop,NULL);
 #endif
 
 	// luckily (well, this should really be the normal case), only
@@ -3882,25 +6413,22 @@ PlacedContigReads::const_iterator Contig::insertReadInContig(const AlignedDualSe
 	advance(ccI, indexincontig);
 	ccI=CON_counts.insert(ccI, CON_concounts_zero);
 
-	CON_us_steps_iric[USCLOIRIC_BIGLCCINS]+=diffsuseconds(us_tmpstart);
-	gettimeofday(&us_tmpstart,nullptr);
+#ifdef CLOCK_STEPS
+	cs_ccinsert+=diffsuseconds(us_loop);
+	gettimeofday(&us_start,NULL);
+#endif
 
-	// CON_concounts_zero has '@' as standard backbone char, change to *
-	ccI->i_backbonecharorig='*';
-	ccI->i_backbonecharupdated='*';
+	// CON_concounts_zero has 'N' as standard backbone char, change to *
+	ccI->backbonechar='*';
 	interpolateSRMValuesInCONcounts(ccI);
-	CON_us_steps_iric[USCLOIRIC_BIGLINTERPOL]+=diffsuseconds(us_tmpstart);
-	gettimeofday(&us_tmpstart,nullptr);
 
 	CEBUG("\t" << CON_counts.size() << endl);
-
+	
 #ifdef IRICTRACE
 	cout << "preuTBI "; cout.flush();
 #endif
 	// push up the consensus tags
 	updateTagBaseInserted(indexincontig);
-	CON_us_steps_iric[USCLOIRIC_BIGLUPDTAGS]+=diffsuseconds(us_tmpstart);
-	gettimeofday(&us_tmpstart,nullptr);
 
 #ifdef IRICTRACE
 	cout << "postuTBI "; cout.flush();
@@ -3912,91 +6440,81 @@ PlacedContigReads::const_iterator Contig::insertReadInContig(const AlignedDualSe
 	//  that's what the -1 is for as the new read has been inserted at
 	//  the back) ...
 
-	auto lastpostocheck=nprI.getReadStartOffset()+nprI->getLenClippedSeq();
-	if(quickfirstpcrI==CON_reads.end()){
-	  quickfirstpcrI=getFirstPCRIForReadsCoveringPosition(indexincontig);
-	  CON_us_steps_iric[USCLOIRIC_BIGLFPCRI]+=diffsuseconds(us_tmpstart);
-	  gettimeofday(&us_tmpstart,nullptr);
-	}
-	// as PlacedContigReads::iterator is sorted by offset, we can stop the loop
-	//  once we left the area covered by the newly inserted read
-	for(auto pcrI=quickfirstpcrI; pcrI!=CON_reads.end() && pcrI.getReadStartOffset() <= lastpostocheck; ++pcrI) {
-	  // we don't want to work on the newly inserted read;
-	  if(pcrI.getORPID() == newrid) continue;
-	  // ... and insert a * in those reads covering this position ...
-	  if(indexincontig > pcrI.getReadStartOffset() &&
-	     indexincontig < pcrI.getReadStartOffset()+pcrI->getLenClippedSeq()){ // checked: <!, not <=
-#ifdef CLOCK_STEPS_IRIC
-	    ++numreadinserts;
-#endif
-	    CEBUG("Read id: " << pcrI.getORPID());
-	    CEBUG("\tfrom: " << pcrI.getReadStartOffset());
-	    CEBUG("\tto: " << pcrI.getReadStartOffset()+pcrI->getLenClippedSeq());
+#ifdef CLOCK_STEPS
+	gettimeofday(&us_loop,NULL);
+#endif
+//#define CEBUG(bla)   {cout << bla; cout.flush();}
+
+	vector<contigread_t>::iterator rI=CON_reads.begin();
+	for(uint32 k=0; k<CON_reads.size()-1; k++, rI++) {
+
+	  // ... and insert a * in those covering this position ...
+	  if(indexincontig > rI->offset &&                   // TODO: >, >=?
+	     indexincontig < rI->offset+rI->read.getLenClippedSeq()){ // checked: <!, not <=
+	    CEBUG("Read id: " << rI->orpid);
+	    CEBUG("\tfrom: " << rI->offset);
+	    CEBUG("\tto: " << rI->offset+rI->read.getLenClippedSeq());
 	    CEBUG("\tin!");
 	    CEBUG(ccI->A << "\t" <<ccI->C << "\t" <<ccI->G << "\t" <<ccI->T << "\t" <<ccI->star << "\t" <<ccI->total_cov << endl);
-	    ccI->star+=coveragemultiplier;
-	    ccI->total_cov+=coveragemultiplier;
-	    ccI->seqtype_cov[pcrI->getSequencingType()]+=coveragemultiplier;
+	    ccI->star+=1;
+	    ccI->total_cov+=1;
+	    ccI->seqtype_cov[rI->read.getSequencingType()];
 	    CEBUG(ccI->A << "\t" <<ccI->C << "\t" <<ccI->G << "\t" <<ccI->T << "\t" <<ccI->star << "\t" <<ccI->total_cov << endl);
 
 	    int32 posinread;
-	    posinread= indexincontig - pcrI.getReadStartOffset();
+	    posinread= indexincontig - rI->offset;
 	    CEBUG("posinread: " << posinread);
 
-#if CPP_READ_SEQTYPE_END != 8
-#error "This code is made for 8 sequencing types, adapt!"
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
 #endif
-	    // TODO: what are gapquals for PacBio??? different depending HQ /LQ ...
-	    if(pcrI.getReadDirection()>0){
-	      if(pcrI->isSequencingType(ReadGroupLib::SEQTYPE_454GS20)
-		 || pcrI->isSequencingType(ReadGroupLib::SEQTYPE_IONTORRENT)) {
+	    // TODO: what are gapquals for PacBio???
+	    if(rI->direction>0){
+	      if(rI->read.isSequencingType(Read::SEQTYPE_454GS20)
+		 || rI->read.isSequencingType(Read::SEQTYPE_IONTORRENT)) {
 		gapqual=1;
 	      }else{
 		CEBUG("preqAQICS1 ");
-		gapqual=pcrI->queryAverageQualInClippedSequence(posinread-1, posinread, false, true);
+		gapqual=rI->read.queryAverageQualInClippedSequence(posinread-1, posinread, false, true);
 		CEBUG("postqAQICS2 ");
 	      }
 	      CEBUG("preqiBICS ");
-	      const_cast<Read &>(*pcrI).insertBaseInClippedSequence('*', gapqual, posinread, true);
+	      rI->read.insertBaseInClippedSequence('*', gapqual, posinread, true);
 	      CEBUG("postiBICS ");
 	    }else{
-	      if(pcrI->isSequencingType(ReadGroupLib::SEQTYPE_454GS20)
-		 || pcrI->isSequencingType(ReadGroupLib::SEQTYPE_IONTORRENT)) {
+	      if(rI->read.isSequencingType(Read::SEQTYPE_454GS20)
+		 || rI->read.isSequencingType(Read::SEQTYPE_IONTORRENT)) {
 		gapqual=1;
 	      }else{
 		CEBUG("preqAQICS2 ");
-		gapqual=pcrI->queryAverageQualInClippedComplementSequence(posinread-1, posinread, false, true);
+		gapqual=rI->read.queryAverageQualInClippedComplementSequence(posinread-1, posinread, false, true);
 		CEBUG("postqAQICS2 ");
 	      }
 	      CEBUG("preqiBICCS ");
-	      const_cast<Read &>(*pcrI).insertBaseInClippedComplementSequence('*', gapqual, posinread, true);
+	      rI->read.insertBaseInClippedComplementSequence('*', gapqual, posinread, true);
 	      CEBUG("postqiBICCS ");
 	    }
-	    if(pcrI->getLenClippedSeq() > CON_longestreadseen) CON_longestreadseen=pcrI->getLenClippedSeq();
-	    if(!pcrI->isBackbone() && pcrI->getLenClippedSeq() > CON_longestnonbbreadseen) CON_longestnonbbreadseen=pcrI->getLenClippedSeq();
-	    // should never happen as rails should be added in a different manner ... but one never knows
-	    // maybe in future?
-	    if(pcrI->isRail() && pcrI->getLenClippedSeq() > CON_longestrailseen){
-	      CON_longestrailseen=static_cast<int32>(pcrI->getLenClippedSeq());
-	    }
+	  }
+
+//#define CEBUG(bla)
+	  // ... and push the reads being behind this position one up
+	  // >= tested
+	  if(rI->offset >= indexincontig){
+	    CEBUG("\tpushed up.");
+	    rI->offset+=1;
 	  }
 	  CEBUG(endl);
 	}
-	CON_us_steps_iric[USCLOIRIC_BIGLLIGAPINREADS]+=diffsuseconds(us_tmpstart);
-	gettimeofday(&us_tmpstart,nullptr);
-
-	// ... and push the reads being at or behind this position one up
-	CON_reads.shiftReads(indexincontig,1);
-	// same thing for contig marker positions
-	shiftMarkerPositions(indexincontig,1);
-	CON_us_steps_iric[USCLOIRIC_BIGLSHIFTREADS]+=diffsuseconds(us_tmpstart);
-	gettimeofday(&us_tmpstart,nullptr);
 
 #ifdef IRICTRACE
 	cout << "postfl1 "; cout.flush();
 #endif
 
-	CEBUG(ccI->A << "\t" <<ccI->C << "\t" <<ccI->G << "\t" <<ccI->T << "\t" <<ccI->star << "\t" <<ccI->total_cov << endl);
+#ifdef CLOCK_STEPS
+	cs_rloop+=diffsuseconds(us_loop);
+#endif
+
+	CEBUG(ccI->A << "\t" <<ccI->C << "\t" <<ccI->G << "\t" <<ccI->T << "\t" <<ccI->star << "\t" <<ccI->coverage << endl);
       }else{
 	// No gap in the contig. Could there be one in the read?
 	// If not, do nothing ...
@@ -4005,101 +6523,105 @@ PlacedContigReads::const_iterator Contig::insertReadInContig(const AlignedDualSe
 	  CEBUG("\t* in rea");
 	  // if yes, we must insert a gap exactly in this read
 	  int32 posinread;
-	  posinread= indexincontig - nprI.getReadStartOffset();
+	  vector<contigread_t>::iterator rI=CON_reads.end();
+	  rI--;
+	  posinread= indexincontig - rI->offset;
 
-#if CPP_READ_SEQTYPE_END != 8
-#error "This code is made for 8 sequencing types, adapt!"
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
 #endif
 
-	  // TODO: what are gapquals for PacBio??? different depending HQ / LQ
-	  if(nprI.getReadDirection()>0){
-	    if(nprI->isSequencingType(ReadGroupLib::SEQTYPE_454GS20)
-	      || nprI->isSequencingType(ReadGroupLib::SEQTYPE_IONTORRENT)) {
+	  // TODO: what are gapquals for PacBio???
+	  if(rI->direction>0){
+	    if(rI->read.isSequencingType(Read::SEQTYPE_454GS20)
+	      || rI->read.isSequencingType(Read::SEQTYPE_IONTORRENT)) {
 	      gapqual=1;
 	    }else{
-	      gapqual=nprI->queryAverageQualInClippedSequence(posinread-1, posinread, false, true);
+	      gapqual=rI->read.queryAverageQualInClippedSequence(posinread-1, posinread, false, true);
 	    }
-	    const_cast<Read &>(*nprI).insertBaseInClippedSequence('*', gapqual, posinread, true);
+	    rI->read.insertBaseInClippedSequence('*', gapqual, posinread, true);
 	  }else{
-	    if(nprI->isSequencingType(ReadGroupLib::SEQTYPE_454GS20)
-	       || nprI->isSequencingType(ReadGroupLib::SEQTYPE_IONTORRENT)) {
+	    if(rI->read.isSequencingType(Read::SEQTYPE_454GS20)
+	       || rI->read.isSequencingType(Read::SEQTYPE_IONTORRENT)) {
 	      gapqual=1;
 	    }else{
-	      gapqual=nprI->queryAverageQualInClippedComplementSequence(posinread-1, posinread, false, true);
+	      gapqual=rI->read.queryAverageQualInClippedComplementSequence(posinread-1, posinread, false, true);
 	    }
-	    const_cast<Read &>(*nprI).insertBaseInClippedComplementSequence('*', gapqual, posinread, true);
+	    rI->read.insertBaseInClippedComplementSequence('*', gapqual, posinread, true);
 	  }
 	}
       }
       CEBUG("\n");
     }
+
+#ifdef CLOCK_STEPS
+    cout << "irictimings 4a ccinsert: " << cs_ccinsert << endl;    
+    cout << "irictimings 4b rloop: " << cs_rloop << endl;    
+#endif
   }
 
-  CON_us_steps_iric[USCLOIRIC_BIGLTOT]+=diffsuseconds(us_start);
-  gettimeofday(&us_start,nullptr);
+#ifdef CLOCK_STEPS
+  cout << "irictimings 5: " << diffsuseconds(us_start) << endl;
+  gettimeofday(&us_start,NULL);
+#endif
 
 #ifdef IRICTRACE
   cout << "prex1 "; cout.flush();
 #endif
   // good, now see if we have to add something to the right of the contig
   //  (happens when the read grows over the right of the contig)
-  CEBUG("nprI.getReadStartOffset(): " << nprI.getReadStartOffset());
-  CEBUG("\tnprI->getLenClippedSeq(): " << nprI->getLenClippedSeq());
+  CEBUG("CON_reads.back().offset: " << CON_reads.back().offset);
+  CEBUG("\tCON_reads.back().read.getLenClippedSeq(): " << CON_reads.back().read.getLenClippedSeq());
   CEBUG("\tCON_counts.size(): " << CON_counts.size() << endl);
-
-  int32 offset=nprI.getReadStartOffset();
-  int32 nrlen=static_cast<int32>(nprI->getLenClippedSeq());
-  int32 grownright=offset+nrlen-CON_counts.size();
+  int32 grownright=CON_reads.back().offset
+    +CON_reads.back().read.getLenClippedSeq()
+    -CON_counts.size();
   if(grownright>0){
     CEBUG("Grown right: " << grownright << endl);
     CON_counts.resize(CON_counts.size()+grownright,CON_concounts_zero);
   }
-  CON_us_steps_iric[USCLOIRIC_INSGR]+=diffsuseconds(us_start);
-  gettimeofday(&us_start,nullptr);
 
-  if(nrlen > CON_longestreadseen){
-    CON_longestreadseen=nrlen;
-  }
-  if(!nprI->isBackbone() && (nrlen > CON_longestnonbbreadseen)){
-    CON_longestnonbbreadseen=nrlen;
-  }
-  // should never happen as rails should be added in a different manner ... but one never knows
-  // maybe in future?
-  if(nprI->isRail() && (nrlen > CON_longestrailseen)){
-    CON_longestrailseen=nrlen;
-  }
 
 #ifdef IRICTRACE
   cout << "prex2 "; cout.flush();
 #endif
 
+  vector<contigread_t>::iterator D= CON_reads.end();
+  D--;
+  int32 offset=D->offset;
+  int32 len=D->read.getLenClippedSeq();
   vector<char>::const_iterator sI;
-  if(nprI.getReadDirection() > 0){
-    sI=nprI->getClippedSeqIterator();
+  if(D->direction > 0){
+    sI=D->read.getClippedSeqIterator();
   }else{
-    sI=nprI->getClippedComplementSeqIterator();
+    sI=D->read.getClippedComplementSeqIterator();
   }
 
+#ifdef CLOCK_STEPS
+  cout << "irictimings 6: " << diffsuseconds(us_start) << endl;
+  gettimeofday(&us_start,NULL);
+#endif
+
 #ifdef IRICTRACE
   cout << "preuCV "; cout.flush();
 #endif
 
   updateCountVectors(offset,
-		     nrlen,
+		     len,
 		     sI,
-		     nprI->getSequencingType(),
-		     true,
-		     coveragemultiplier);
-
-  CON_us_steps_iric[USCLOIRIC_UCV]+=diffsuseconds(us_start);
-  gettimeofday(&us_start,nullptr);
-
+		     D->read.getSequencingType(),
+		     true);
 
 #ifdef IRICTRACE
   cout << "postuCV "; cout.flush();
 #endif
 
-  return nprI;
+#ifdef CLOCK_STEPS
+  cout << "irictimings 7: " << diffsuseconds(us_start) << endl;
+  gettimeofday(&us_start,NULL);
+#endif
+
+  return;
 }
 //#define CEBUG(bla)
 //#define CEBUG(bla)
@@ -4143,14 +6665,14 @@ void Contig::interpolateSRMValuesInCONcounts(cccontainer_t::iterator ccI)
     }else{
       // should never happen (reads of size 1???), but anyway
       ccI->bbcounts[actsrtype]=0;
-      MIRANOTIFY(Notify::INTERNAL, "I'm on a branch I shouldn't be. Really!");
+      throw Notify(Notify::INTERNAL, THISFUNC, "I'm on a branch I shouldn't be. Really!");
     }
 
 
     // theoretically, the "if" should not be needed
     if(ccI != CON_counts.begin()
        && (ccI+1) != CON_counts.end()){
-      ccI->bbstrains[actsrtype]=((ccI-1)->bbstrains[actsrtype])
+      ccI->bbstrains[actsrtype]=((ccI-1)->bbstrains[actsrtype]) 
 	& ((ccI+1)->bbstrains[actsrtype]);
     }
 
@@ -4162,43 +6684,43 @@ void Contig::interpolateSRMValuesInCONcounts(cccontainer_t::iterator ccI)
 }
 
 
-///*************************************************************************
-// *
-// *
-// *
-// *
-// *************************************************************************/
-//
-//void Contig::updateReadTagsFromReadPool()
-//{
-//  FUNCSTART("void Contig::updateReadTagsFromReadPool()");
-//
-//  vector<contigread_t>::const_iterator crI=CON_reads.begin();
-//  for(;crI != CON_reads.end(); crI++){
-//    if(crI->orpid<0 &&
-//       (crI->read.isRail() || crI->read.isBackbone())){
-//      BUGIFTHROW(crI->direction < 0, "Backbone or rail read in reverse direction ... rather unexpected. Really.");
-//      Read & rpread=CON_readpool->getRead(crI->orpid);
-//      BUGIFTHROW(crI->read.getName() != rpread.getName(),"different read names? not good.");
-//      for(uint32 tagnr=0; tagnr<rpread.getNumOfTags(); tagnr++){
-//	const multitag_t & acttagrpread=rpread.getTag(tagnr);
-//	if(acttagrpread.identifier == Read::REA_tagentry_idSRMr
-//	   || acttagrpread.identifier == Read::REA_tagentry_idCRMr
-//	   || acttagrpread.identifier == Read::REA_tagentry_idWRMr
-//	   || acttagrpread.identifier == Read::REA_tagentry_idSAOr
-//	   || acttagrpread.identifier == Read::REA_tagentry_idSROr
-//	   || acttagrpread.identifier == Read::REA_tagentry_idSIOr) {
-//
-//	  //hier weiter
-//
-//
-//	}
-//      }
-//    }
-//  }
-//
-//  FUNCEND();
-//}
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+
+void Contig::updateReadTagsFromReadPool()
+{
+  FUNCSTART("void Contig::updateReadTagsFromReadPool()");
+
+  vector<contigread_t>::const_iterator crI=CON_reads.begin();
+  for(;crI != CON_reads.end(); crI++){
+    if(crI->orpid<0 &&
+       (crI->read.isRail() || crI->read.isBackbone())){
+      BUGIFTHROW(crI->direction < 0, "Backbone or rail read in reverse direction ... rather unexpected. Really.");
+      Read & rpread=CON_readpool->getRead(crI->orpid);
+      BUGIFTHROW(crI->read.getName() != rpread.getName(),"different read names? not good.");
+      for(uint32 tagnr=0; tagnr<rpread.getNumOfTags(); tagnr++){
+	const multitag_t & acttagrpread=rpread.getTag(tagnr);
+	if(acttagrpread.identifier == Read::REA_tagentry_idSRMr 
+	   || acttagrpread.identifier == Read::REA_tagentry_idCRMr 
+	   || acttagrpread.identifier == Read::REA_tagentry_idWRMr 
+	   || acttagrpread.identifier == Read::REA_tagentry_idSAOr 
+	   || acttagrpread.identifier == Read::REA_tagentry_idSROr
+	   || acttagrpread.identifier == Read::REA_tagentry_idSIOr) {
+
+	  //hier weiter
+
+
+	}
+      }
+    }
+  }
+
+  FUNCEND();
+}
 
 
 /*************************************************************************
@@ -4212,13 +6734,15 @@ void Contig::initialiseBaseLocks()
 {
   FUNCSTART("void Contig::initialiseBaseLocks()");
 
-  for(auto & cce : CON_counts){
-    cce.baselock=0;
-    cce.snplock=0;
+  cccontainer_t::iterator ccI=CON_counts.begin();
+  for(; ccI != CON_counts.end(); ccI++){
+    ccI->baselock=0;
+    ccI->snplock=0;
   }
 
-  for(auto pcrI=CON_reads.begin();pcrI != CON_reads.end(); ++pcrI){
-    updateBaseLocks(pcrI,true);
+  vector<contigread_t>::const_iterator crI=CON_reads.begin();
+  for(;crI != CON_reads.end(); crI++){
+    updateBaseLocks(*crI,true);
   }
 
   FUNCEND();
@@ -4232,35 +6756,33 @@ void Contig::initialiseBaseLocks()
  *
  *************************************************************************/
 
-//#define CEBUG(bla)   {if(dodebug) {cout << bla; cout.flush();}}
-void Contig::updateBaseLocks(PlacedContigReads::const_iterator pcrI, bool addiftrue)
+void Contig::updateBaseLocks(const contigread_t & ric, bool addiftrue)
 {
 
-  FUNCSTART("void Contig::updateBaseLocks(PlacedContigReads::const_iterator pcrI, bool addiftrue)");
+  FUNCSTART("void Contig::updateBaseLocks(const contigread_t & ric, bool addiftrue)");
 
-  //bool dodebug=pcrI->getName()=="...";
-
-  // one = 1 seems ... oh well
-  // but might want to change the icrement of baselocks in the future
-  uint16 one=1;
   if(addiftrue){
-    CEBUG("Adding base locks in " << pcrI->getName() << endl);
+    CEBUG("Adding base locks in " << ric.read.getName() << endl);
   }else{
-    CEBUG("Removing base locks in " << pcrI->getName() << endl);
+    CEBUG("Removing base locks in " << ric.read.getName() << endl);
+  }
+
+  int32 one=1;
+  if(addiftrue==false){
     one=-one;
   }
 
-  for(int32 tagi=0; tagi<pcrI->getNumOfTags(); ++tagi){
-    const multitag_t & acttag=pcrI->getTag(tagi);
+  for(int32 i=0; i<ric.read.getNumOfTags(); i++){
+    multitag_t acttag=ric.read.getTag(i);
     bool baselock=false;
     bool snplock=false;
-    for(int32 j=0; j<CON_baselock_ids.size(); ++j){
+    for(int32 j=0; j<CON_baselock_ids.size(); j++){
       if(acttag.identifier==CON_baselock_ids[j]){
 	baselock=true;
 	break;
       }
     }
-    for(int32 j=0; j<CON_snplock_ids.size(); ++j){
+    for(int32 j=0; j<CON_snplock_ids.size(); j++){
       if(acttag.identifier==CON_snplock_ids[j]){
 	snplock=true;
 	break;
@@ -4268,38 +6790,29 @@ void Contig::updateBaseLocks(PlacedContigReads::const_iterator pcrI, bool addift
     }
 
     if(baselock || snplock){
-      CEBUG("Tag #" << tagi << "\tfrom: " << acttag.from << "\tto: " << acttag.to << "\t" << acttag.getIdentifierStr());
-      int32 contigpos=pcrI.unclippedReadPos2ContigPos(acttag.from);
+      CEBUG("Tag #" << i << "\tfrom: " << acttag.from << "\tto: " << acttag.to << "\t" << acttag.identifier);
+      int32 contigpos=unclippedReadPosToContigPos(acttag.from, ric);
       CEBUG("\tconpos: " << contigpos << endl);
       // no, bad, it _might_ really be outside the contig
       //  e.g. if tags are in clipped part
       //BOUNDCHECK(contigpos, 0, CON_counts.size());
       if(contigpos>=0 && contigpos<CON_counts.size()){
-	auto ccI=CON_counts.begin();
-	advance(ccI, contigpos);
-	auto readstart=pcrI.getReadStartOffset();
-	auto readend=readstart+pcrI->getLenClippedSeq();
-	CEBUG("readstart: " << readstart << "\treadend: " << readend << endl);
-	for(int32 j=0; j<=acttag.to-acttag.from; ++contigpos, ++ccI, ++j){
-	  CEBUG("cpos: " << contigpos << "\t" << *ccI << endl);
+	cccontainer_t::iterator C=CON_counts.begin();
+	advance(C, contigpos);
+	for(int32 j=0; j<=acttag.to-acttag.from; j++, contigpos++, C++){
 	  // We mind only for the parts of the lock in the used read
-	  if(contigpos>=readstart && contigpos < readend){
-	    CEBUG("Incr!\n");
-	    if(baselock) ccI->baselock+=one;
-	    if(snplock) ccI->snplock+=one;
-	  }else{
-	    CEBUG("nop\n");
+	  if(contigpos>=ric.offset && contigpos < ric.offset+ric.read.getLenClippedSeq()){
+	    if(baselock) C->baselock+=one;
+	    if(snplock) C->snplock+=one;
 	  }
 	}
       }
     }
   }
 
-  CEBUG("done updbl\n");
-
   FUNCEND();
+
 }
-//#define CEBUG(bla)
 
 
 /*************************************************************************
@@ -4311,89 +6824,270 @@ void Contig::updateBaseLocks(PlacedContigReads::const_iterator pcrI, bool addift
  * updateI is the sequence which updates into the contig
  * seqtype is the seqtype of the read that is added
  *
- * coveragemultiplier>0 : adding to contig
- * coveragemultiplier<0 : removing to contig
- *
  * Does NOT update the baselock! This is done in updateBaseLocks
  *
  *************************************************************************/
 
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-
-void Contig::updateCountVectors(const int32 from, const int32 len, vector<char>::const_iterator updateI, const uint32 seqtype, const bool addiftrue, int32 coveragemultiplier)
+void Contig::updateCountVectors(const int32 from, const int32 len, vector<char>::const_iterator updateI, const uint32 seqtype, const bool addiftrue)
 {
 
-  FUNCSTART("void Contig::updateCountVectors(const int32 from, const int32 len, vector<char>::const_iterator updateI, const uint32 seqtype, const bool addiftrue, int32 coveragemultiplier)");
+  FUNCSTART("void Contig::updateCountVectors(uint32 from, uint32 len, vector<char>::const_iterator updateI, bool addiftrue)");
 
   CEBUG("From: "<<from<<"\tLen: "<<len<<"\tCON_counts.size():" << CON_counts.size() << endl);
 
-  BUGIFTHROW(from<0, "from " << from << " < 0 ?");
+
+  if(from<0){
+    throw Notify(Notify::INTERNAL, THISFUNC, "from <0 ?");
+  }
 
   if(from+len>CON_counts.size()){
     cout << "Error:\n";
     cout << "from: " << from << endl;
     cout << "len: " << len << endl;
     cout << "size of contig: " << CON_counts.size() << endl;
-    MIRANOTIFY(Notify::INTERNAL, "from + len > size of contig?");
+    throw Notify(Notify::INTERNAL, THISFUNC, "from + len > size of contig?");
   }
 
-  auto ccI=CON_counts.begin();
+  cccontainer_t::iterator I= CON_counts.begin();
   BOUNDCHECK(from, 0, CON_counts.size());
-  advance(ccI, from);
-  CEBUG("ccI " << ccI << endl);
+  advance(I, from);
 
-  int32 one=1*coveragemultiplier;
-  int32 two=2*coveragemultiplier;
-  int32 four=4*coveragemultiplier;
+  int32 one=1;
+  int32 two=2;
+  int32 four=4;
+
+  if(addiftrue==false){
+    one=-one;
+    four=-four;
+  }
 
-  for(int32 i=0; i<len; ++ccI, ++updateI, ++i){
-    CEBUG("i " << i << "\tccI: " << ccI << endl);
+  for(int32 i=0; i<len; i++, I++, updateI++){
     char thechar=*updateI;
     switch(toupper(thechar)){
     case '-':
     case 'N': {
-      ccI->A+=one;
-      ccI->C+=one;
-      ccI->G+=one;
-      ccI->T+=one;
-      ccI->N+=one;
+      I->A+=one;
+      I->C+=one;
+      I->G+=one;
+      I->T+=one;
+      I->N+=one;
       break;
     }
-    case 'X': {ccI->X+=one; break;}
-    case 'A': {ccI->A+=four; break;}
-    case 'C': {ccI->C+=four; break;}
-    case 'G': {ccI->G+=four; break;}
-    case 'T': {ccI->T+=four; break;}
-
-    case 'M': {ccI->A+=two; ccI->C+=two; break;}
-    case 'R': {ccI->A+=two; ccI->G+=two; break;}
-    case 'W': {ccI->A+=two; ccI->T+=two; break;}
-    case 'S': {ccI->C+=two; ccI->G+=two; break;}
-    case 'Y': {ccI->C+=two; ccI->T+=two; break;}
-    case 'K': {ccI->G+=two; ccI->T+=two; break;}
-
-    case 'V': {ccI->A+=one; ccI->C+=one; ccI->G+=one; break;}
-    case 'H': {ccI->A+=one; ccI->C+=one; ccI->T+=one; break;}
-    case 'D': {ccI->A+=one; ccI->G+=one; ccI->T+=one; break;}
-    case 'B': {ccI->C+=one; ccI->G+=one; ccI->T+=one; break;}
-
-    case '*': {ccI->star+=one; break;}
+    case 'X': {I->X+=one; break;}
+    case 'A': {I->A+=four; break;}
+    case 'C': {I->C+=four; break;}
+    case 'G': {I->G+=four; break;}
+    case 'T': {I->T+=four; break;}
+
+    case 'M': {I->A+=two; I->C+=two; break;}
+    case 'R': {I->A+=two; I->G+=two; break;}
+    case 'W': {I->A+=two; I->T+=two; break;}
+    case 'S': {I->C+=two; I->G+=two; break;}
+    case 'Y': {I->C+=two; I->T+=two; break;}
+    case 'K': {I->G+=two; I->T+=two; break;}
+
+    case 'V': {I->A+=one; I->C+=one; I->G+=one; break;}
+    case 'H': {I->A+=one; I->C+=one; I->T+=one; break;}
+    case 'D': {I->A+=one; I->G+=one; I->T+=one; break;}
+    case 'B': {I->C+=one; I->G+=one; I->T+=one; break;}
+      
+
+    case '*': {I->star+=one; break;}
     default: {
       cout << "WHY? Illegal char: " << (uint16) thechar << " >>" << thechar << "<<\n";
-      MIRANOTIFY(Notify::FATAL, "Unexpected base.");
+      throw Notify(Notify::FATAL, THISFUNC, "Unexpected base.");
+    }
     }
+    I->total_cov+=one;
+    I->seqtype_cov[seqtype]+=one;
+  }
+  
+  FUNCEND();
+}
+
+
+/*************************************************************************
+ *
+ * makes a temporary char * of a portion of the consensus
+ * from and to positions in the consensus
+ * from inclusive
+ * to exclusive
+ * appending a 0 char
+ *
+ * returns whether an N or X has been put in the tmp consensus
+ *
+ *************************************************************************/
+
+bool Contig::makeTmpConsensus(int32 from, int32 to)
+{
+//#define CEBUG(bla)   {cout << bla; cout.flush();}
+
+  FUNCSTART("void Contig::makeTmpConsensus(int32 from, int32 to)");
+
+  definalise();
+  CEBUG("\nFrom: " << from << "\tTo: " << to<<"\tCON_counts.size(): "<<CON_counts.size());
+
+  BUGIFTHROW(from>to,"from>to?");
+  BUGIFTHROW(from<0, "from < 0 ?");
+
+  if(to>CON_counts.size()) to=CON_counts.size();
+  uint32 len_tmpcons=to-from;
+
+  if(CON_2tmpcons.capacity()<2000 || CON_2tmpcons.capacity()<len_tmpcons){
+    CON_2tmpcons.reserve(max(len_tmpcons,static_cast<uint32>(2000)));
+  }
+  CON_2tmpcons.resize(len_tmpcons);
+
+  bool hasNorX=false;
+  {
+    string::iterator toptr=CON_2tmpcons.begin();
+
+    // using a pointer to CON_counts is (a lot) faster than accessing it 
+    //  via [] each time
+    cccontainer_t::iterator ccI=CON_counts.begin();
+    BOUNDCHECK(from, 0, CON_counts.size()+1);
+    advance(ccI, from);
+    
+    for(uint32 i=from; i<to ;i++, toptr++, ccI++){
+      *toptr=0;
+      if(CON_tmpcons_from_backbone && ccI->backbonechar!='@'){
+	*toptr=ccI->backbonechar;
+	if(toupper(*toptr)=='N' || toupper(*toptr)=='X'){
+	  hasNorX=true;
+	}
+      }else{
+	ccctype_t maximum= max(ccI->A, max(ccI->C, max(ccI->G, ccI->T)));
+	uint8 counts=0;
+	//CEBUGF(ccI->A << "\t" << ccI->C << "\t" << ccI->G << "\t" << ccI->T << "\t" << ccI->N << "\t" << ccI->star << "\n"); 
+      
+	// is any ACGT set?
+	if(maximum >0 && maximum > ccI->star) {
+#if 0
+// Somehow U13 does not like this, recheck
+	  if(ccI->A==maximum){
+	    counts++;
+	    *toptr='A';
+	  }
+	  if(ccI->C==maximum){
+	    counts++;
+	    if(counts>1){
+	      *toptr=dptools::calcIUPACConsensus(*toptr,'C');
+	    }else{
+	      *toptr='C';
+	    }
+	  }
+	  if(ccI->G==maximum){
+	    counts++;
+	    if(counts>1){
+	      *toptr=dptools::calcIUPACConsensus(*toptr,'G');
+	    }else{
+	      *toptr='G';
+	    }
+	  }
+	  if(ccI->T==maximum){
+	    counts++;
+	    if(counts>1){
+	      *toptr=dptools::calcIUPACConsensus(*toptr,'T');
+	    }else{
+	      *toptr='T';
+	    }
+	  }
+	  //if(counts>1) *toptr='N';
+#else
+	  if(ccI->A==maximum){
+	    counts++;
+	    *toptr='A';
+	  }
+	  if(ccI->C==maximum){
+	    counts++;
+	    *toptr='C';
+	  }
+	  if(ccI->G==maximum){
+	    counts++;
+	    *toptr='G';
+	  }
+	  if(ccI->T==maximum){
+	    counts++;
+	    *toptr='T';
+	  }
+	  if(counts>1) {
+	    *toptr='N';
+	    hasNorX=true;
+	  }
+#endif
+	  //// can be somewhat problematic with 454 data
+	  //// calls the base until 50/50, then the gap
+	  //if(maximum/4 < ccI->star) *toptr='*';
+
+	  // this prefers to call gaps
+	  // calls the base until 1/3 base, 2/3 gap, then the gap
+	  // this should help, together with the "expected gap" # in
+	  //  alignments, to further reduce to a maximum this kind of 
+	  //  base jiggling in homopolymers
+	  //
+	  //     ...*AAAAAAAAA...
+	  //     ...*AAAAAAAAA...
+	  //     ...AAAAAAAAA*...
+	  //     ...AAAAAAAAA*...
+	  //     ...AAAAAAAAA*...
+	  //     ...*AAAAAAAAA...
+	  //     ...*AAAAAAAAA...
+	  //     ...AAAAAAAAA*...
+	  //     ...*AAAAAAAAA...
+
+	  if(maximum/4 < (ccI->star)*2) {
+	    switch(*toptr){
+	    case 'A': {
+	      *toptr='1';
+	      break;
+	    }
+	    case 'C': {
+	      *toptr='2';
+	      break;
+	    }
+	    case 'G': {
+	      *toptr='3';
+	      break;
+	    }
+	    case 'T': {
+	      *toptr='4';
+	      break;
+	    }
+	    default: {
+	      *toptr='*';
+	    }
+	    }
+	  }
+	} else {
+	  if((ccI->star >= ccI->X)
+	     && (ccI->star >= ccI->X)){
+	    *toptr='*';
+	  } else if(ccI->N){
+	    *toptr='N';
+	    hasNorX=true;
+	  }else{
+	    *toptr='X';
+	    hasNorX=true;
+	  }
+	}
+      }
+      if(*toptr==0){
+	MIRANOTIFY(Notify::INTERNAL,"Ooooops? makeTmpConsensus encountered the unexpected situation of an uncalled base? Please contact the author immediately.");
+      }
     }
-    ccI->total_cov+=one;
-    ccI->seqtype_cov[seqtype]+=one;
+    // not needed for string, terminated by 0 anyway
+    //*(toptr)=0;
   }
+  CEBUG("Tmp_cons: >>>" <<CON_2tmpcons << "<<<" << endl);
 
   FUNCEND();
+
+  return hasNorX;
 }
 //#define CEBUG(bla)
 
 
 
-
 /*************************************************************************
  *
  *
@@ -4408,8 +7102,32 @@ void Contig::finalise()
   //checkContig();
 
   if(CON_finalised==false){
-    makeTmpConsensus(0, CON_counts.size(),CON_tmpcons_from_backbone);
+    makeTmpConsensus(0, CON_counts.size());
+    
+    CON_outputorder.resize(CON_reads.size());
+
+    CEBUG("finalise sizes: " <<CON_reads.size() << " " <<CON_outputorder.size() << endl) 
+
+    CEBUG("offset\tindex\tread_id\tt_id\ttempl\n");
+    for(uint32 i=0; i<CON_reads.size(); i++){
+      CON_outputorder[i].offset_start=CON_reads[i].offset;
+      CON_outputorder[i].original_index=i;
+      CON_outputorder[i].orpid=CON_reads[i].orpid;
+      
+      CEBUG(CON_reads[i].offset);
+      CEBUG("\t" << i);
+      CEBUG("\t" << CON_reads[i].id);
+      CEBUG("\t" << CON_reads[i].read.getTemplateID());
+      //CEBUG("\t" << CON_reads[i].read.getTemplate());
+      CEBUG("\n");
+      BUGIFTHROW(CON_outputorder[i].offset_start<0, "offset_start < 0 ?");
+
+    }
+    
+    BUGIFTHROW(CON_outputorder.size()!=CON_reads.size(), "CON_outputorder.size()!=CON_reads.size()???");
 
+    sort(CON_outputorder.begin(), CON_outputorder.end(), Contig::out_order_t_comparator);
+    
     CON_finalised=true;
   }
 
@@ -4424,22 +7142,12 @@ void Contig::finalise()
  *
  *************************************************************************/
 
-PlacedContigReads::const_iterator Contig::deleteRead(PlacedContigReads::const_iterator pcrI)
+void Contig::deleteRead(int32 id)
 {
   //TODO: What happens, when a contig breaks? (no more coverage in the middle)
 
   FUNCSTART("void Contig::deleteRead(uint32 id)");
 
-  CEBUG("before deleteRead():\n"; setCoutType(AS_TEXT); cout << *this << endl);
-
-#ifdef CLOCK_STEPS_DRFC
-  timeval us_tv;
-  gettimeofday(&us_tv,nullptr);
-  timeval us_tvtotal=us_tv;
-#endif
-
-  ++CON_track_numdels;
-
   if(CON_fixedconsseq.size()){
     nukeSTLContainer(CON_fixedconsseq);
     nukeSTLContainer(CON_fixedconsqual);
@@ -4452,39 +7160,41 @@ PlacedContigReads::const_iterator Contig::deleteRead(PlacedContigReads::const_it
 
   paranoiaBUGSTAT(checkContig());
 
-  auto coveragemultiplier=pcrI->getDigiNormMultiplier();
+  vector<contigread_t>::iterator D= CON_reads.begin();
 
-  // update of internal contig statistics
-  CON_readsperstrain[pcrI->getStrainID()]-=coveragemultiplier;
-  CON_readsperreadgroup[pcrI->getReadGroupID().getLibId()]-=coveragemultiplier;
+  if(CON_maprpids_to_conreadsids.empty()){
+    uint32 i;
+    for(i=0; i<CON_reads.size(); i++, D++){
+      if(D->orpid==id) break;
+    }
+    if(i==CON_reads.size()){
+      throw Notify(Notify::INTERNAL, THISFUNC, "ID not in contig.");
+    }
+  }else{
+    advance(D,CON_maprpids_to_conreadsids[id]);
+  }
 
   // Remove the base locks in CON_counts that this read produced
-  gettimeofday(&us_tv,nullptr);
-  updateBaseLocks(pcrI, false);
-  CON_us_steps_drfc[USCLODRFC_UBL]+=diffsuseconds(us_tv);
-
-  gettimeofday(&us_tv,nullptr);
+  updateBaseLocks(*D, false);
 
   // Remove the read from the CON_counts
-  auto offset=pcrI.getReadStartOffset();
-  int32 rlen=pcrI->getLenClippedSeq();
+  int32 offset=D->offset;
+  int32 len=D->read.getLenClippedSeq();
   vector<char>::const_iterator sI;
-  if(pcrI.getReadDirection() > 0){
-    sI=pcrI->getClippedSeqIterator();
+  if(D->direction > 0){
+    sI=D->read.getClippedSeqIterator();
   }else{
-    sI=pcrI->getClippedComplementSeqIterator();
+    sI=D->read.getClippedComplementSeqIterator();
   }
 
   CEBUG("Offset: " << offset);
-  CEBUG("\nrlen: " << rlen);
+  CEBUG("\nlen: " << len);
 
   updateCountVectors(offset,
-		     rlen,
+		     len,
 		     sI,
-		     pcrI->getSequencingType(),
-		     false,
-		     -coveragemultiplier);
-  CON_us_steps_drfc[USCLODRFC_UCV]+=diffsuseconds(us_tv);
+		     D->read.getSequencingType(),
+		     false);
 
   CEBUG(*this);
 
@@ -4496,337 +7206,150 @@ PlacedContigReads::const_iterator Contig::deleteRead(PlacedContigReads::const_it
 
     // Readjust front
     //   readjust the offsets if needed
-    int32 maxchecklen=rlen;
+    int32 maxchecklen=len;
     BUGIFTHROW(maxchecklen<0, "front: maxchecklen < 0 ?");
-    if(maxchecklen>0 && offset==0){
-      frontdeletions=chompFront(maxchecklen);
-    }
+    if(maxchecklen>0){
+      if(D->offset==0){
+	cccontainer_t::iterator I= CON_counts.begin();
+	if(I->total_cov==0){
+	  CEBUG("CONTIG-- delread at beginning!\n");
+	  while(I->total_cov==0 &&
+		frontdeletions<maxchecklen){
+	    frontdeletions++;
+	    I++;
+	  }
+	  if(frontdeletions>0){
+	    // ok, we've got to delete bases at the front of the consensus
+	    CON_counts.erase(CON_counts.begin(), I);
+	    CEBUG("Deleted << " << frontdeletions << " at front.\n");
+
+	    // push consensus tags down, deleting all those which are completely 
+	    //  in the deleted part, adjusting others.
+	    {
+	      vector<consensustag_t>::iterator ctI=CON_consensus_tags.begin();
+	      while(ctI!=CON_consensus_tags.end()){
+		ctI->from-=frontdeletions;
+		ctI->to-=frontdeletions;
+		if(ctI->to < 0){
+		  ctI=CON_consensus_tags.erase(ctI);
+		}else{
+		  if(ctI->from < 0) ctI->from=0;
+		  ctI++;
+		}
+	      }
+	    }
 
+	    // push down the offsets of the other reads
+	    for(uint32 i=0; i<CON_reads.size(); i++){
+	      // Safetycheck
+	      if(CON_reads[i].offset<frontdeletions){
+		if(CON_reads[i].orpid!=id){
+		  cout << "i: " << i << "\tfrontdeletions: " << frontdeletions << "\treads[i].offset: " << CON_reads[i].offset << "\n";
+		  throw Notify(Notify::INTERNAL, THISFUNC, "Offset wrong: too low.");
+		}
+	      }
+	      if(CON_reads[i].orpid!=id) CON_reads[i].offset-=frontdeletions;
+	    }
+	  }
+	}
+      }
+    }
+    
     BUGIFTHROW(frontdeletions<0, "frontdeletions < 0 ?");
 
     if(offset>0){
       offset=offset-frontdeletions;
-      BUGIFTHROW(offset<0, "offset >0 and offset-frontdeletions < 0 ?");
+      if(offset<0){
+	throw Notify(Notify::INTERNAL, THISFUNC, "offset >0 and offset-frontdeletions < 0 ?");
+      }
     }
-
+    
     BUGIFTHROW(offset<0, "offset < 0 ?");
 
     // Readjust end
     {
-      maxchecklen=rlen-frontdeletions;
+      maxchecklen=len-frontdeletions;
       BUGIFTHROW(maxchecklen<0, "end: maxchecklen< 0 ?");
       if(maxchecklen>0){
-	enddeletions=chompBack(maxchecklen);
+	cccontainer_t::iterator I= CON_counts.end();
+	I--;
+	if(I->total_cov==0){
+	  CEBUG("CONTIG-- delread at end!\n");
+	  while(I->total_cov==0 &&
+		enddeletions<maxchecklen){
+	    CEBUG(".");
+	    enddeletions++;
+	    I--;
+	  }
+	  if(enddeletions>0){
+	    I++;
+	    CEBUG("Counts.size() before: " << CON_counts.size() << endl);
+	    CON_counts.erase(I,CON_counts.end());
+	    CEBUG("Counts.size() after: " << CON_counts.size() << endl);
+	    CEBUG("Deleted << " << enddeletions << " at end.\n");
+
+	    // and delete consensus tags there
+	    int32 newsize=CON_counts.size()-1;
+	    vector<consensustag_t>::iterator ctI=CON_consensus_tags.begin();
+	    while(ctI!=CON_consensus_tags.end()){
+	      if((ctI->from > newsize)){
+		ctI=CON_consensus_tags.erase(ctI);
+	      }else{
+		if(ctI->to > newsize) ctI->to=newsize;
+		ctI++;
+	      }
+	    }
+	  }
+	}
       }
     }
   }
 
   BUGIFTHROW(enddeletions<0, "enddeletions < 0 ?");
 
-  // delete template if any
+  // remove template if any
   {
-    int32 tid=pcrI->getTemplateID();
+    int32 tid=D->read.getTemplateID();
     if(tid>=0){
-      gettimeofday(&us_tv,nullptr);
       multiset<int32>::iterator msI=CON_templates_present.find(tid);
       if(msI==CON_templates_present.end()){
-	MIRANOTIFY(Notify::INTERNAL, "Template not present in list though read has one?");
+	throw Notify(Notify::INTERNAL, THISFUNC, "Template not present in list though read has one?");
       }
       CON_templates_present.erase(msI);
-      CON_us_steps_drfc[USCLODRFC_DT]+=diffsuseconds(us_tv);
     }
   }
 
   // Remove read
-  gettimeofday(&us_tv,nullptr);
-  auto retI=CON_reads.removeRead(pcrI);
-  CON_us_steps_drfc[USCLODRFC_RR]+=diffsuseconds(us_tv);
+  D=CON_reads.erase(D);
 
-  CEBUG("after removeRead:\n" << *this << endl);
+  // remove mapping
+  if(!CON_maprpids_to_conreadsids.empty()){
+    // instead of clear, recalc the maps for the reads after
+    // the deleted one
+    //CON_maprpids_to_conreadsids.clear();
 
-#if 1
-  CEBUG("deleteStarOnlyColumns(" << offset << ", " << offset+rlen-frontdeletions-enddeletions << ")\n");
-  gettimeofday(&us_tv,nullptr);
-  deleteStarOnlyColumns(offset, offset+rlen-frontdeletions-enddeletions);
-  CON_us_steps_drfc[USCLODRFC_DSOC]+=diffsuseconds(us_tv);
-#endif
+    int32 conreadid=CON_maprpids_to_conreadsids[id];
+    CON_maprpids_to_conreadsids[id]=-1;
+    for(; D != CON_reads.end(); D++, conreadid++){
+      CON_maprpids_to_conreadsids[D->orpid]=conreadid;
+    }
+  }
 
-  CON_us_steps_drfc[USCLODRFC_TOTAL]+=diffsuseconds(us_tvtotal);
+#if 1
+  deleteStarOnlyColumns(offset, offset+len-frontdeletions-enddeletions);
+#endif 
 
   paranoiaBUGSTAT(checkContig());
-
+  
   CEBUG("Contig after:\n" << *this);
 
   FUNCEND();
 
-  return retI;
-}
-
-
-
-
-
-
-/*************************************************************************
- *
- * "doshiftreads==false" is a hack for trimMapOverhang() which needs
- *  chompFront() functionality WITHOUT shifting reads
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-int32 Contig::chompFront(int32 maxchecklen, bool doshiftreads)
-{
-  FUNCSTART("int32 Contig::chompFront(int32 maxchecklen, bool doshiftreads)");
-
-#ifdef CLOCK_STEPS_DRFC
-  timeval us_tv;
-#endif
-
-  gettimeofday(&us_tv,nullptr);
-
-  if(maxchecklen<0) maxchecklen=static_cast<int32>(CON_counts.size());
-  int32 frontdeletions=0;
-  auto ccI= CON_counts.begin();
-  while(ccI!=CON_counts.end()
-	&& ccI->total_cov==0
-	&& frontdeletions<maxchecklen){
-    ++frontdeletions;
-    ++ccI;
-  }
-  if(CON_us_steps_drfc.size()) CON_us_steps_drfc[USCLODRFC_ITF]+=diffsuseconds(us_tv);
-
-  if(frontdeletions>0){
-    CEBUG("CONTIG-- delread at beginning!\n");
-    // ok, we've got to delete bases at the front of the consensus
-    gettimeofday(&us_tv,nullptr);
-    CON_counts.erase(CON_counts.begin(), ccI);
-    if(CON_us_steps_drfc.size()) CON_us_steps_drfc[USCLODRFC_CCEF]+=diffsuseconds(us_tv);
-    CEBUG("Deleted << " << frontdeletions << " at front.\n");
-
-    // push consensus tags down, deleting all those which are completely
-    //  in the deleted part, adjusting others.
-    gettimeofday(&us_tv,nullptr);
-    {
-      vector<consensustag_t>::iterator ctI=CON_consensus_tags.begin();
-      while(ctI!=CON_consensus_tags.end()){
-	ctI->from-=frontdeletions;
-	ctI->to-=frontdeletions;
-	// static casts are mean trick as the multitag variables are uint32!
-	if(static_cast<int32>(ctI->to) < 0){
-	  ctI=CON_consensus_tags.erase(ctI);
-	}else{
-	  if(static_cast<int32>(ctI->from) < 0) ctI->from=0;
-	  ++ctI;
-	}
-      }
-    }
-    if(CON_us_steps_drfc.size()) CON_us_steps_drfc[USCLODRFC_SDT]+=diffsuseconds(us_tv);
-    // push down the offsets of the other reads
-    if(doshiftreads){
-      gettimeofday(&us_tv,nullptr);
-      CON_reads.shiftReads(1,-frontdeletions);
-      if(CON_us_steps_drfc.size()) CON_us_steps_drfc[USCLODRFC_SR]+=diffsuseconds(us_tv);
-    }
-    // same thing for contig marker positions
-    gettimeofday(&us_tv,nullptr);
-    shiftMarkerPositions(1,-frontdeletions);
-    if(CON_us_steps_drfc.size()) CON_us_steps_drfc[USCLODRFC_SMP]+=diffsuseconds(us_tv);
-  }
-
-  if(frontdeletions>0) definalise();
-
-  return frontdeletions;
-}
-//#define CEBUG(bla)
-
-
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-int32 Contig::chompBack(int32 maxchecklen)
-{
-  FUNCSTART("int32 Contig::chompBack(int32 maxchecklen)");
-
-  if(CON_counts.begin()==CON_counts.end()) return 0;
-
-#ifdef CLOCK_STEPS_DRFC
-  timeval us_tv;
-#endif
-
-  gettimeofday(&us_tv,nullptr);
-
-  if(maxchecklen<0) maxchecklen=static_cast<int32>(CON_counts.size());
-  int32 enddeletions=0;
-  auto ccI= CON_counts.end();
-  --ccI;
-  if(ccI->total_cov==0){
-    CEBUG("CONTIG-- delread at end!\n");
-    gettimeofday(&us_tv,nullptr);
-    while(ccI->total_cov==0 &&
-	  enddeletions<maxchecklen){
-      CEBUG(".");
-      ++enddeletions;
-      if(ccI==CON_counts.begin()) break;
-      --ccI;
-    }
-    if(CON_us_steps_drfc.size()) CON_us_steps_drfc[USCLODRFC_ITB]+=diffsuseconds(us_tv);
-    if(enddeletions>0){
-      ++ccI;
-      CEBUG("Counts.size() before: " << CON_counts.size() << endl);
-      gettimeofday(&us_tv,nullptr);
-      CON_counts.erase(ccI,CON_counts.end());
-      if(CON_us_steps_drfc.size()) CON_us_steps_drfc[USCLODRFC_CCEB]+=diffsuseconds(us_tv);
-      CEBUG("Counts.size() after: " << CON_counts.size() << endl);
-      CEBUG("Deleted << " << enddeletions << " at end.\n");
-
-      // and delete consensus tags there
-      gettimeofday(&us_tv,nullptr);
-      int32 newsize=CON_counts.size()-1;
-      auto ctI=CON_consensus_tags.begin();
-      while(ctI!=CON_consensus_tags.end()){
-	if((ctI->from > newsize)){
-	  ctI=CON_consensus_tags.erase(ctI);
-	}else{
-	  if(ctI->to > newsize) ctI->to=newsize;
-	  ++ctI;
-	}
-      }
-      if(CON_us_steps_drfc.size()) CON_us_steps_drfc[USCLODRFC_SDT]+=diffsuseconds(us_tv);
-    }
-  }
-
-  if(enddeletions>0) definalise();
-
-  return enddeletions;
 }
-#define CEBUG(bla)
-
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-void Contig::trimMapOverhang()
-{
-  FUNCSTART("void Contig::trimMapOverhang()");
-
-  //cout << "MMMMMMMMMM\n";
-  //CON_reads.debugDump(false);
-
-  if(getNumBackbones()==0) return;
-
-  int32 firstknownbbpos=-1;
-  int32 lastknownbbpos=-1;
-  for(auto crI= CON_reads.begin(); crI!=CON_reads.end(); ++crI){
-    if(crI->isBackbone()){
-      if(static_cast<int32>(crI.getReadStartOffset()+crI->getLenClippedSeq()) > lastknownbbpos){
-	lastknownbbpos=crI.getReadStartOffset()+crI->getLenClippedSeq();
-      }
-      if(firstknownbbpos<0){
-	firstknownbbpos=crI.getReadStartOffset();
-      }
-    }
-  }
-
-  CEBUG("fkbb: " << firstknownbbpos << endl);
-  CEBUG("lkbb: " << lastknownbbpos << endl);
-  CEBUG("gcl: " << getContigLength() << endl);
-
-  BUGIFTHROW(firstknownbbpos<0,"firstknownbbpos " << firstknownbbpos << " <0 ???");
-  BUGIFTHROW(lastknownbbpos<0,"lastknownbbpos " << lastknownbbpos << " <0 ???");
-
-  // check: are there reads completely outside the backbone? if yes: no-can-do
-  for(auto crI= CON_reads.begin(); crI!=CON_reads.end(); ++crI){
-    if(!crI->isBackbone()){
-      if(crI.getReadStartOffset() < firstknownbbpos
-	 && crI.getReadStartOffset()+crI->getLenClippedSeq() <= firstknownbbpos){
-	// oooops, impossible at front
-	return;
-      }
-      if(crI.getReadStartOffset() >= lastknownbbpos){
-	// oooops, impossible at end
-	return;
-      }
-    }
-  }
-
-  bool docorrect=false;
-  // we're fine, now get things rolling
-  //
-  // first, the back of the contig if needed
-  if(lastknownbbpos < getContigLength()){
-    docorrect=true;
-    // zero out CON_counts
-    auto ccI=CON_counts.end(); // cannot use rbegin, not implemented in HDeque
-    CEBUG("numdelsteps: " << getContigLength()-lastknownbbpos << endl);
-    for(auto numdelsteps=getContigLength()-lastknownbbpos; numdelsteps!=0; --numdelsteps){
-      --ccI;
-      *ccI=CON_concounts_zero;
-    }
-
-    // shorten overhanging reads
-    for(auto crI= CON_reads.begin(); crI!=CON_reads.end(); ++crI){
-      int32 shorten=static_cast<int32>(crI.getReadStartOffset()+crI->getLenClippedSeq())-lastknownbbpos;
-      CEBUG(crI->getName() << " shortenb " << shorten << endl);
-      if(shorten>0){
-	// very hacky, but we're forcing our hand on the reads of the PCR container here
-	Read & ncr=const_cast<Read &>(*crI);
-	if(crI.getReadDirection()>0){
-	  ncr.setRQClipoff(crI->getRightClipoff()-shorten);
-	}else{
-	  ncr.setLQClipoff(crI->getLeftClipoff()+shorten);
-	}
-      }
-    }
-  }
 
-  // now the front of the contig if needed
-  if(firstknownbbpos>0){
-    docorrect=true;
-    // zero out CON_counts
-    auto ccI=CON_counts.begin();
-    for(auto numdelsteps=firstknownbbpos; numdelsteps!=0; --numdelsteps, ++ccI){
-      *ccI=CON_concounts_zero;
-    }
 
-    // shorten overhanging reads
-    for(auto crI= CON_reads.begin(); crI!=CON_reads.end(); ++crI){
-      int32 shorten=firstknownbbpos-static_cast<int32>(crI.getReadStartOffset());
-      CEBUG(crI->getName() << "\tfkbbp: " << firstknownbbpos << "\trso: " << crI.getReadStartOffset() <<"\tshortenf " << shorten << endl);
-      if(shorten>0){
-	// very hacky, but we're forcing our hand on the reads of the PCR container here
-	Read & ncr=const_cast<Read &>(*crI);
-	if(crI.getReadDirection()>0){
-	  ncr.setLQClipoff(crI->getLeftClipoff()+shorten);
-	}else{
-	  ncr.setRQClipoff(crI->getRightClipoff()-shorten);
-	}
-      }
-    }
-  }
 
-  if(docorrect){
-    chompBack(-1);
 
-    if(firstknownbbpos>0){
-      // hacky thing
-      chompFront(-1,false);
-      // hacky thing
-      CON_reads.shiftReadsBounceZero(0,-firstknownbbpos);
-    }
-  }
-}
-//#define CEBUG(bla)
 
 
 /*************************************************************************
@@ -4848,41 +7371,57 @@ void Contig::checkContig()
   vector<contigread_t>::iterator D= CON_reads.begin();
   for(i=0; i<CON_reads.size(); i++, D++){
     if(D->offset<0){
-      MIRANOTIFY(Notify::INTERNAL, "offset < 0?");
+      throw Notify(Notify::INTERNAL, THISFUNC, "offset < 0?");
     }
     if(!CON_counts.empty()){
       if(D->offset>=static_cast<int32>(CON_counts.size())){
 	cout << "Error. Contig_id: " << CON_id << endl;
 	cout << "First read: " << CON_reads[0].read;
-	MIRANOTIFY(Notify::INTERNAL, "offset >= contigsize?");
+	throw Notify(Notify::INTERNAL, THISFUNC, "offset >= contigsize?");
       }
       if(D->offset+D->read.getLenClippedSeq()>CON_counts.size()){
-	MIRANOTIFY(Notify::INTERNAL, "offset+readlen > contigsize?");
+	throw Notify(Notify::INTERNAL, THISFUNC, "offset+readlen > contigsize?");
       }
     }
   }
 
   if(CON_miraparams->size() != Contig::SEQTYPE_END){
-    MIRANOTIFY(Notify::INTERNAL, "CON_miraparams->size() != Contig::SEQTYPE_END");
+    throw Notify(Notify::INTERNAL, THISFUNC, "CON_miraparams->size() != Contig::SEQTYPE_END");
   }
 
+  //#ifndef CEBUGFLAG
 #if 1
+//  if(CON_counts.size()>0 &&
+//     CON_counts.back().A == 0 &&
+//     CON_counts.back().C == 0 &&
+//     CON_counts.back().G == 0 &&
+//     CON_counts.back().T == 0
+//     ){
+//    throw Notify(Notify::INTERNAL, THISFUNC, "0-0-0-0 N at end?");
+//  }
   if(!CON_counts.empty() &&
      CON_counts.front().coverage == 0
      ){
-    MIRANOTIFY(Notify::INTERNAL, "0-0-0-0-0 N (zero coverage) at front?");
+    throw Notify(Notify::INTERNAL, THISFUNC, "0-0-0-0-0 N (zero coverage) at front?");
   }
   if(!CON_counts.empty() &&
      CON_counts.back().coverage == 0
      ){
-    MIRANOTIFY(Notify::INTERNAL, "0-0-0-0-0 N (zero coverage) at end?");
+    throw Notify(Notify::INTERNAL, THISFUNC, "0-0-0-0-0 N (zero coverage) at end?");
   }
 #endif
 
 #ifdef CEBUGFLAG
-  for(auto ccI=CON_counts.begin(); ccI != CON_counts.end(); ++ccI){
-    if(ccI->A + ccI->C + ccI->G + ccI->T + (ccI->star)*4 != (ccI->coverage)*4){
-      MIRANOTIFY(Notify::INTERNAL, "Gna, error in Con_counts :/.");
+  {
+    cccontainer_t::iterator I=CON_counts.begin();
+    while(I!=CON_counts.end()){
+      if(I->A + I->C + I->G + I->T + (I->star)*4 != (I->coverage)*4){
+	throw Notify(Notify::INTERNAL, THISFUNC, "Gna, error in Con_counts :/.");
+      }
+//	if(I->star>10){
+//	  throw Notify(Notify::INTERNAL, THISFUNC, "Gna, suspect coverage:/.");
+//	}
+      I++;
     }
   }
 #endif
@@ -4904,13 +7443,14 @@ void Contig::checkContig()
 
 //#define CEBUG(bla)   {cout << bla; cout.flush();}
 
-void Contig::initialiseContig(const list<contig_init_read_t> & rlist,
-			      vector<multitag_t> & tags,
+void Contig::initialiseContig(uint32 contig_length,
+			      const list<contig_init_read_t> & rlist, 
+			      vector<tag_t> & tags,
 			      const string & contigname,
 			      string & fixedseq,
 			      vector<base_quality_t> & fixedqual)
 {
-  FUNCSTART("void Contig::initialiseContig(const list<contig_init_read_t> & rlist, vector<multitag_t> & tags, const string & contigname, string & fixedseq, vector<base_quality_t> & fixedqual)");
+  FUNCSTART("void Contig::initialiseContig(uint32 contig_length, const list<contig_init_read_t> & rlist, vector<tag_t> & tags)");
 
   discard();
 
@@ -4920,15 +7460,17 @@ void Contig::initialiseContig(const list<contig_init_read_t> & rlist,
 
   CEBUG("::initC1 fixed " << CON_fixedconsseq.size() << endl);
 
-  CON_counts.clear();
+  CON_counts.resize(contig_length, CON_concounts_zero);
+
+  CEBUG("Contig ini-size: " << contig_length << endl);
+
+  // make space for reads
+  CON_reads.reserve(rlist.size()+5);
 
   //cout << "KKKKKKKKK " << CON_readpool->getNumOfStrainInReadpool() << endl;
   // ... and strain tracking
-  BUGIFTHROW(ReadGroupLib::getNumOfStrains()==0,"CON_readpool->getNumOfStrainInReadpool()==0 ???");
-  CON_readsperstrain.resize(ReadGroupLib::getNumOfStrains(),0);
-
-  BUGIFTHROW(ReadGroupLib::getNumReadGroups==0,"CON_readpool->getNumReadGroups()==0 ???");
-  CON_readsperreadgroup.resize(ReadGroupLib::getNumReadGroups(),0);
+  BUGIFTHROW(CON_readpool->getNumOfStrainInReadpool()==0,"CON_readpool->getNumOfStrainInReadpool()==0 ???");
+  CON_readsperstrain.resize(CON_readpool->getNumOfStrainInReadpool(),0);
 
   // Correct for weird things:
   // 1) joining contigs in gap5 inserts gap bases having a quality of 0, leading to the possibility
@@ -4936,78 +7478,79 @@ void Contig::initialiseContig(const list<contig_init_read_t> & rlist,
   //    Counterstrategy: in reads, re-assign quality to gap bases with quality 0
   // 2) no "two" atm
 
-  CEBUG("Fixing zero-gap qualities\n");
-  for(auto & rle : rlist){
-    CON_readpool->getRead(rle.id).fixZeroGapQuals();
+  {
+    CEBUG("Fixing zero-gap qualities\n");
+    list<contig_init_read_t>::const_iterator rlI=rlist.begin();
+    for(;rlI!=rlist.end();rlI++){
+      CON_readpool->getRead(rlI->id).fixZeroGapQuals();
+    }
   }
 
 
-  //
+  // 
   CEBUG("Going through list (size " << rlist.size() << "):\n");
-  uint32 computedclen=0;
-  for(auto & rle : rlist){
+  list<contig_init_read_t>::const_iterator rlI=rlist.begin();
+  for(;rlI!=rlist.end();rlI++){
+    
     CEBUG("New element:\t");
-    CEBUG("Offset: " << rle.offset_in_contig << "\tID: " << rle.id);
-    CEBUG("\tDir: " << rle.direction << endl);
-    CEBUG("Read: " << CON_readpool->getRead(rle.id).getName() << endl);
-
-    auto pcrI=CON_reads.placeRead(CON_readpool->getRead(rle.id),
-				  rle.id,
-				  rle.offset_in_contig,
-				  rle.direction);
-    computedclen=max(computedclen,static_cast<uint32>(pcrI.getReadStartOffset())+static_cast<uint32>(pcrI->getLenClippedSeq()));
-
-    auto coveragemultiplier=CON_readpool->getRead(rle.id).getDigiNormMultiplier();
-    CON_readsperstrain[pcrI->getStrainID()]+=coveragemultiplier;
-    CON_readsperreadgroup[pcrI->getReadGroupID().getLibId()]+=coveragemultiplier;
-    if(pcrI->getLenClippedSeq() > CON_longestreadseen) CON_longestreadseen=pcrI->getLenClippedSeq();
-    if(pcrI->isBackbone()) CON_isbackbonecontig=true;
-    if(!pcrI->isBackbone() && pcrI->getLenClippedSeq() > CON_longestnonbbreadseen) CON_longestnonbbreadseen=pcrI->getLenClippedSeq();
-    if(pcrI->isRail() && pcrI->getLenClippedSeq() > CON_longestrailseen) CON_longestrailseen=pcrI->getLenClippedSeq();
+    {
+      contigread_t tmp;
+      
+      tmp.offset=rlI->offset_in_contig;
+      tmp.orpid=rlI->id;
+      tmp.direction=rlI->direction;
+      
+      CON_reads.push_back(tmp);
+      
+      CON_reads.back().read=CON_readpool->getRead(tmp.orpid);
+
+      CEBUG("Offset: " << tmp.offset << "\tID: " << tmp.orpid);
+      CEBUG("\tDir: " << tmp.direction << endl);
+      CEBUG("Read:\n" << CON_reads.back().read);
+    }
+
+    // track strain IDs
+    ++CON_readsperstrain[CON_reads.back().read.getStrainID()];
+
+    // TODO: check this. Took it out because when assembling a project
+    //  without base qualities, then doing a convert_project from caf to caf,
+    //  all the reads got a base quality of 0
+    //
+    // what would this setting of base qualities be for anyway? what did I
+    //  have in mind?
+    //
+    //// set default quality if read has no qual
+    //if(!CON_reads.back().read.hasQuality()){
+    //  CON_reads.back().read.setQualities((*CON_miraparams)[0].getAssemblyParams().as_backbone_basequals);
+    //}
 
     // add template if any
-    if(pcrI->getTemplateID()>=0){
-      CON_templates_present.insert(pcrI->getTemplateID());
+    if(CON_reads.back().read.getTemplateID()>=0){
+      CON_templates_present.insert(CON_reads.back().read.getTemplateID());
     }
-  }
-
-  CEBUG("end of list" << endl);
-
-  // CAF as written by gap5 may start at another offset than 0
-  // MIRA expects the first read to have an offset of 0, therefore correct for that
-  int32 shiftoffset=-CON_reads.begin().getReadStartOffset();
-  if(shiftoffset != 0){
-    computedclen+=shiftoffset;
-    CON_reads.shiftReads(0,shiftoffset);
-  }
-
-  CEBUG("Computed contig length: " << computedclen << endl);
 
-  BUGIFTHROW(computedclen<=0,"Contig has size " << computedclen << " which is <= 0 ???");
-  CON_counts.resize(computedclen, CON_concounts_zero);
+    //CEBUG("Setting clipoffs: " << rlI->read_lclip << "\t" << rlI->read_rclip << endl);
+    //CON_reads.back().read.setClipoffs(rlI->read_lclip, rlI->read_rclip, true);
+    //    CEBUG("done. Read is now:\n" << CON_reads.back().read);
 
-  for(auto pcrI=CON_reads.begin(); pcrI != CON_reads.end(); ++pcrI){
-    auto coveragemultiplier=pcrI->getDigiNormMultiplier();
     try{
-      if(pcrI.getReadDirection() > 0){
-	updateCountVectors(pcrI.getReadStartOffset(),
-			   pcrI->getLenClippedSeq(),
-			   pcrI->getClippedSeqIterator(),
-			   pcrI->getSequencingType(),
-			   true,
-			   coveragemultiplier);
+      if(rlI->direction>0){
+	updateCountVectors(rlI->offset_in_contig,
+			   CON_reads.back().read.getLenClippedSeq(),
+			   CON_readpool->getRead(rlI->id).getClippedSeqIterator(),
+			   CON_readpool->getRead(rlI->id).getSequencingType(),
+			   true);
       }else{
-	updateCountVectors(pcrI.getReadStartOffset(),
-			   pcrI->getLenClippedSeq(),
-			   pcrI->getClippedComplementSeqIterator(),
-			   pcrI->getSequencingType(),
-			   true,
-			   coveragemultiplier);
+	updateCountVectors(rlI->offset_in_contig,
+			   CON_reads.back().read.getLenClippedSeq(),
+			   CON_readpool->getRead(rlI->id).getClippedComplementSeqIterator(),
+			   CON_readpool->getRead(rlI->id).getSequencingType(),
+			   true);
       }
     }
     catch(Notify n){
-      cout << "Readpool id: " << pcrI.getORPID() << endl;
-      cout << "Error while adding this read (1):\n" << *pcrI;
+      cout << "Readpool id: " << rlI->id << endl;
+      cout << "Error while adding this read (1):\n" << CON_reads.back().read;
       cout << "In this contig (output might crash):" << endl << *this << endl;
       n.handleError(THISFUNC);
     }
@@ -5015,71 +7558,35 @@ void Contig::initialiseContig(const list<contig_init_read_t> & rlist,
 
     // initialise backbone and short read mapping structures if this read was used as a
     //  backbone
-    if(pcrI->isBackbone()){
-      auto ccI=CON_counts.begin();
-      auto rso=pcrI.getReadStartOffset();
-      advance(ccI,rso);
-      const char * consb=pcrI->getSeqAsChar();
-      const base_quality_t * qptr=&(pcrI->getQualities()[rso]);
-	for(uint32 ci=0; ci < pcrI->getLenClippedSeq(); ++ccI, ++consb, ++ci, ++qptr){
+    if(CON_reads.back().read.isBackbone()){
+      cccontainer_t::iterator ccI=CON_counts.begin();
+      advance(ccI,CON_reads.back().offset);
+      const char * consb=CON_reads.back().read.getSeqAsChar();
+      for(uint32 ci=0; ci<CON_reads.back().read.getLenClippedSeq(); ccI++, consb++, ++ci){
 	BUGIFTHROW(ccI == CON_counts.end(), "ccI == CON_counts.end() ???");
 	BUGIFTHROW(*consb == 0, "*consb == 0 ?");
 	// Don't init bbcounts[], bbbestquals[] and bbstrains[] as they
-	//  might already have been initialised by CER reads ... well,
+	//  might already have been initialised by CER reads ... well, 
 	//  will be when this functionality is implemented.
 	// So, only initialise backbone chars
-	ccI->i_backbonecharorig=toupper(*consb);
-	ccI->i_backbonecharupdated='@';
-	ccI->i_backbonequalorig=*qptr;
+	ccI->backbonechar=toupper(*consb);
       }
     }
   }
 
-  CEBUG("CON_counts before trimming: " << CON_counts.size() << endl);
-
-  // trim end of contig if needed
-  uint64 numpops=0;
-  while(!CON_counts.empty() &&
-	CON_counts.back().total_cov == 0
-	){
-    CON_counts.pop_back();
-    ++numpops;
-  }
-  if(numpops){
-    CON_fixedconsseq.resize(CON_fixedconsseq.size()-numpops);
-    CON_fixedconsqual.resize(CON_fixedconsseq.size());
-  }
-  CEBUG("Numpops front: " << numpops << endl);
-
-  // trim start of contig if needed
-  numpops=0;
-  while(!CON_counts.empty() &&
-	CON_counts.front().total_cov == 0
-	){
-    CON_counts.pop_front();
-    ++numpops;
-  }
-  if(numpops){
-    CON_fixedconsseq.erase(CON_fixedconsseq.begin(),CON_fixedconsseq.begin()+numpops);
-    CON_fixedconsqual.erase(CON_fixedconsqual.begin(),CON_fixedconsqual.begin()+numpops);
-  }
-  CEBUG("Numpops back: " << numpops << endl);
-
-  BUGIFTHROW(CON_counts.empty(),"After trimming, contig has zero length?");
-
+  trimEnds();
+    
   // must copy each tag as we have to "upgrade" a tag_t to a consensustag_t
   {
-    CON_consensus_tags.clear();
-    CON_consensus_tags.resize(tags.size());
-    for(uint32 i=0;i!=tags.size();++i){
-      CON_consensus_tags[i]=tags[i];
-      CON_consensus_tags[i].from+=shiftoffset;
-      CON_consensus_tags[i].to+=shiftoffset;
+    for(uint32 i=0;i!=tags.size();i++){
+      CON_consensus_tags.push_back(tags[i]);
+      //cout << "copied ";
+      //tags[i] << endl;
     }
   }
 
-  //CEBUG(*this);
-
+  CEBUG(*this);
+  
   try{
     checkContig();
   }
@@ -5089,16 +7596,6 @@ void Contig::initialiseContig(const list<contig_init_read_t> & rlist,
 
   definalise();
 
-  CEBUG("CON_fixedconsseq.size(): " << CON_fixedconsseq.size() << " CON_counts.size(): " << CON_counts.size() << endl);
-  if(!CON_fixedconsseq.empty()
-     && CON_fixedconsseq.size() != CON_counts.size()) {
-    // broken initialisation??? (seen in MAF of contig with error in align)
-    // force recalc
-    CON_fixedconsseq.clear();
-    CON_fixedconsqual.clear();
-    cout << "\nMinor problem with contig " << getContigName() << ", fixing.\n";
-  }
-
   if(CON_fixedconsseq.size() != CON_fixedconsqual.size()
      || CON_fixedconsseq.empty()
      || CON_fixedconsqual.empty()){
@@ -5108,6 +7605,7 @@ void Contig::initialiseContig(const list<contig_init_read_t> & rlist,
   }
 
   CEBUG("::initC2 fixed " << CON_fixedconsqual.size() << endl);
+
   FUNCEND();
 }
 //#define CEBUG(bla)
@@ -5121,50 +7619,41 @@ void Contig::initialiseContig(const list<contig_init_read_t> & rlist,
  *
  *************************************************************************/
 
-vector<int32> &
-Contig::getCRIndicesAtContigPosition(vector<int32> & vec, int32 pos1, int32 pos2) const
+void Contig::trimEnds()
 {
-  FUNCSTART("vector<int32> & Contig::getCRIndicesAtContigPosition(vector<int32> & vec, int32 pos1, int32 pos2) const");
-
-  BUGIFTHROW(true,"Redo for PlacedContigReads");
-
-////++++////  BUGIFTHROW(pos1 < 0, "pos1 < 0?");
-////++++////  BUGIFTHROW(pos1 >= static_cast<int32>(CON_counts.size()), "pos1 > size of contig?");
-////++++////
-////++++////  if(pos2==-1) pos2=pos1;
-////++++////
-////++++////  BUGIFTHROW(pos2 < pos1, "pos2 < pos1");
-////++++////
-////++++////  if(pos2 > static_cast<int32>(CON_counts.size())) pos2=static_cast<int32>(CON_counts.size()-1);
-////++++////
-////++++////  vec.clear();
-////++++////  vec.reserve(100);
-////++++////
-////++++////  int32 i=0;
-////++++////  vector<contigread_t>::const_iterator I= CON_reads.begin();
-////++++////
-////++++////  for(I= CON_reads.begin(); I != CON_reads.end(); I++, i++){
-////++++////    if(I->offset > pos2
-////++++////       || static_cast<int32>(I->offset+I->read.getLenClippedSeq()) <= pos1) continue;
-////++++////    vec.push_back(i);
-////++++////  }
+  FUNCSTART("void Contig::trimEnds()");
 
-  FUNCEND();
+  // trim end of contig if needed
+  while(!CON_counts.empty() &&
+	CON_counts.back().total_cov == 0
+	){
+    CON_counts.pop_back();
+  }
 
-  return vec;
+  // trim start of contig if needed
+  while(!CON_counts.empty() &&
+	CON_counts.back().total_cov == 0
+	){
+    CON_counts.pop_front();
+  }
+
+  definalise();
+
+  FUNCEND();
 }
 
 
 /*************************************************************************
  *
- * TODO: make intelligent version which does not start from begin()
- *   (needs contig to know length of longest read)
+ *
+ *
  *
  *************************************************************************/
 
-void Contig::getPCRIteratorsAtContigPosition(vector<PlacedContigReads::const_iterator> & vec, int32 pos1, int32 pos2) const
+vector<int32> &
+Contig::getCRIndicesAtContigPosition(vector<int32> & vec, int32 pos1, int32 pos2) const
 {
-  FUNCSTART("void Contig::getPCRIteratorsAtContigPosition(vector<PlacedContigReads::const_iterator> & vec, int32 pos1, int32 pos2) const");
+  FUNCSTART("vector<int32> & getReadIDsAtContigPosition(vector<int32> & vec, int32 pos1, int32 pos2) const");
 
   BUGIFTHROW(pos1 < 0, "pos1 < 0?");
   BUGIFTHROW(pos1 >= static_cast<int32>(CON_counts.size()), "pos1 > size of contig?");
@@ -5176,16 +7665,20 @@ void Contig::getPCRIteratorsAtContigPosition(vector<PlacedContigReads::const_ite
   if(pos2 > static_cast<int32>(CON_counts.size())) pos2=static_cast<int32>(CON_counts.size()-1);
 
   vec.clear();
+  vec.reserve(100);
+
+  int32 i=0;
+  vector<contigread_t>::const_iterator I= CON_reads.begin();
 
-  auto pcrI(getFirstPCRIForReadsCoveringPosition(pos1));
-  for(; pcrI != CON_reads.end() && pcrI.getReadStartOffset() <= pos2; ++pcrI){
-    int32 endpoint=static_cast<int32>(pcrI.getReadStartOffset()+pcrI->getLenClippedSeq())-1;
-    if(endpoint >= pos1) vec.push_back(pcrI);
+  for(I= CON_reads.begin(); I != CON_reads.end(); I++, i++){
+    if(I->offset > pos2 
+       || static_cast<int32>(I->offset+I->read.getLenClippedSeq()) <= pos1) continue;
+    vec.push_back(i);
   }
 
   FUNCEND();
 
-  return;
+  return vec;
 }
 
 
@@ -5198,199 +7691,149 @@ void Contig::getPCRIteratorsAtContigPosition(vector<PlacedContigReads::const_ite
  *
  *************************************************************************/
 
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-void Contig::getReadORPIDsAtContigPosition(vector<int32> & vec, int32 pos1, int32 pos2) const
+vector<int32> &
+Contig::getReadIDsAtContigPosition(vector<int32> & vec, int32 pos1, int32 pos2) const
 {
-  FUNCSTART("void Contig::getReadORPIDsAtContigPosition(vector<int32> & vec, int32 pos1, int32 pos2) const");
+  FUNCSTART("vector<int32> & getReadIDsAtContigPosition(vector<int32> & vec, int32 pos1, int32 pos2) const");
+
+  //cout << "getReadIDsAtContigPosition(): search between: " << pos1 << "\t" << pos2 << '\n';
 
-  BUGIFTHROW(pos1 < 0, "pos1 (" << pos1 << ") < 0?");
-  BUGIFTHROW(pos1 >= static_cast<int32>(CON_counts.size()), "pos1 (" << pos1 << ") > size of contig (" << CON_counts.size() << ") ?");
+  BUGIFTHROW(pos1 < 0, "pos1 < 0?");
+  BUGIFTHROW(pos1 >= static_cast<int32>(CON_counts.size()), "pos1 (" << pos1 << ") >= size of contig (" << CON_counts.size() << ")?");
 
   if(pos2==-1) pos2=pos1;
 
-  BUGIFTHROW(pos2 < pos1, "pos2 (" << pos2 << ") < pos1 (" << pos1 << ")");
+  BUGIFTHROW(pos2 < pos1, "pos2 < pos1");
 
   if(pos2 > static_cast<int32>(CON_counts.size())) pos2=static_cast<int32>(CON_counts.size()-1);
 
   vec.clear();
 
-  CEBUG("gROACP: from " << pos1 << '\t' << pos2 <<endl);
+  vector<contigread_t>::const_iterator I;
 
-  auto pcrI(getFirstPCRIForReadsCoveringPosition(pos1));
-  for(; pcrI != CON_reads.end() && pcrI.getReadStartOffset() <= pos2; ++pcrI){
-    int32 endpoint=static_cast<int32>(pcrI.getReadStartOffset()+pcrI->getLenClippedSeq())-1;
-    CEBUG(pcrI->getName() << '\t' << pcrI.getReadStartOffset() << '\t' << pcrI->getLenClippedSeq() << '\t' << endpoint << '\t');
-    if(endpoint >= pos1){
-      CEBUG("taken\n");
-      vec.push_back(pcrI.getORPID());
-    }else{
-      CEBUG("dropped\n");
-    }
+  for(I= CON_reads.begin(); I != CON_reads.end(); I++){
+    if(I->offset > pos2 
+       || static_cast<int32>(I->offset+I->read.getLenClippedSeq()) < pos1) continue;
+    if(I->orpid>=0) vec.push_back(I->orpid);
   }
 
-  return;
+  FUNCEND();
+
+  //cout << "Searched between: " << pos1 << "\t" << pos2 << "\nFound: " << vec.size();
+  //cout << endl;
+  //for(uint32 i=0; i<vec.size(); i++) {
+  //  cout << vec[i] << endl;
+  //}
+
+  return vec;
 }
-//#define CEBUG(bla)
+
+
 
 
 
 
 /*************************************************************************
  *
- * Starting from a reference id that is a rail, takes reads in readpool
- *  before and after that are rails and that fall into the same xcut,
- *  ycut region as given and pushed them into the vector
- * xcut, ycut =   [...[
+ *
+ *
  *
  *************************************************************************/
 
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-void Contig::getRailsAsReadsAffected(const int32 refid, vector<int32> & reads_affected, const int32 xcut, const int32 ycut)
+void Contig::deleteBaseInRead(int32 contigposition, int32 readindex)
 {
-  FUNCSTART("void Contig::getRailsAsReadsAffected(const int32 refid, vector<int32> & reads_affected)");
-
-  BUGIFTHROW(!CON_readpool->getRead(refid).isRail(),"!CON_readpool->getRead(refid).isRail() ???");
-  BUGIFTHROW(CON_longestrailseen==0,"CON_longestrailseen==0???");
-
-  CEBUG("grara xcut " << xcut << "\tycut " << ycut << endl);
-
-  bool refisin=false;
-  reads_affected.clear();
-  auto pcrI=getFirstPCRIForRailsCoveringPosition(xcut);
-  CEBUG("grara 1st: " << pcrI << endl);
-  for(; pcrI != CON_reads.end() && pcrI.getReadStartOffset() < ycut; ++pcrI){
-    CEBUG("grara check " << pcrI << endl);
-    if(pcrI.getReadStartOffset()+pcrI->getLenClippedSeq() < xcut) continue;
-    if(pcrI->isRail()){
-      CEBUG("pushed back" << endl);
-      reads_affected.push_back(pcrI.getORPID());
-      if(pcrI.getORPID()==refid) refisin=true;
-    }
-  }
-  CEBUG("grara rasize: " << reads_affected.size() << endl);
+  FUNCSTART("void Contig::deleteBaseInRead(int32 contigposition, int32 readindex)");
 
-  if(!refisin){
-    cout << "BUG BUG BUG BUG BUG\n";
-    cout << "Searched for range " << xcut << " " << ycut << endl;
-    cout << "CON_longestrailseen: " << CON_longestrailseen << endl;
-    cout << "First PCRI: " << getFirstPCRIForRailsCoveringPosition(xcut) << endl;
-    for(auto tpcrI= CON_reads.begin(); tpcrI != CON_reads.end(); ++tpcrI){
-      cout << tpcrI << endl;
-    }
-    MIRANOTIFY(Notify::FATAL, "*sigh*");
-  }
+  paranoiaBUGSTAT(checkContig());
 
-  FUNCEND();
-  return;
-}
-//#define CEBUG(bla)
+  BUGIFTHROW((readindex<0 || readindex>=CON_reads.size()),
+	     "Readindex <0 || >= CON_reads.size() -> Read not in this contig!");
 
+  contigread_t & theread=CON_reads[readindex];
 
+  BUGIFTHROW((contigposition < theread.offset ||
+	      contigposition >= theread.offset+theread.read.getLenClippedSeq()),
+	     "Read does not cover given contigposition");
 
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
+  definalise();
 
-void Contig::deleteBaseInRead(int32 contigposition, int32 readindex)
-{
-  FUNCSTART("void Contig::deleteBaseInRead(int32 contigposition, int32 readindex)");
+  int32 posinread=contigposition-theread.offset;
+  int32 updatelen=theread.read.getLenClippedSeq()-posinread;
+  
+  CEBUG("contigpos: " << contigposition);
+  CEBUG("\nPPPosinread: " << posinread);
+  CEBUG("\nupdatelen: " << updatelen<<endl);
+
+  bool deletein=false;
+  bool deleteend=false;
+
+  // now only clip contig when size is affected, never ever at all move
+  // other reads around ---> this may lead to a contig break :(
+  if(theread.offset+theread.read.getLenClippedSeq()==CON_counts.size()
+     && CON_counts.back().total_cov==1) deleteend=true;
+
+  CEBUG("deletein: " << deletein << endl);
+  CEBUG("deleteend: " << deleteend << endl);
+
+  vector<char>::const_iterator I;
+
+  if(theread.direction>0){
+    I=theread.read.getClippedSeqIterator();
+    BOUNDCHECK(posinread, 0, theread.read.getLenClippedSeq());
+    advance(I, posinread);
+    updateCountVectors(contigposition, 
+		       updatelen, 
+		       I,
+		       theread.read.getSequencingType(),
+		       false);
+    theread.read.deleteBaseFromClippedSequence(posinread);
+    I=theread.read.getClippedSeqIterator();
+  }else{
+    I=theread.read.getClippedComplementSeqIterator();
+    BOUNDCHECK(posinread, 0, theread.read.getLenClippedSeq());
+    advance(I, posinread);
+    updateCountVectors(contigposition, 
+		       updatelen, 
+		       I, 
+		       theread.read.getSequencingType(),
+		       false);
+    theread.read.deleteBaseFromClippedComplementSequence(posinread);
+    I=theread.read.getClippedComplementSeqIterator();
+  }
+
+  if(deletein==true){
+    cccontainer_t::iterator cI=CON_counts.begin();
+    BOUNDCHECK(contigposition, 0, CON_counts.size());
+    advance(cI, contigposition);
+    CON_counts.erase(cI);
+    for(uint32 i=0; i<CON_reads.size(); i++){
+      if(CON_reads[i].offset>contigposition) CON_reads[i].offset--;
+    }
+    // adjust tags in consensus
+    // TODO: untested (ok?)
+    updateTagBaseDeleted(contigposition);
+  }
+  if(deleteend==true){
+    CON_counts.pop_back();
+    // adjust tags in consensus
+    // TODO: untested (ok?)
+    updateTagBaseDeleted(contigposition);
+  }
 
-  BUGIFTHROW(true,"Redo for PlacedContigReads");
-
-////++++////  paranoiaBUGSTAT(checkContig());
-////++++////
-////++++////  BUGIFTHROW((readindex<0 || readindex>=CON_reads.size()),
-////++++////	     "Readindex <0 || >= CON_reads.size() -> Read not in this contig!");
-////++++////
-////++++////  contigread_t & theread=CON_reads[readindex];
-////++++////
-////++++////  BUGIFTHROW((contigposition < theread.offset ||
-////++++////	      contigposition >= theread.offset+theread.read.getLenClippedSeq()),
-////++++////	     "Read does not cover given contigposition");
-////++++////
-////++++////  definalise();
-////++++////
-////++++////  int32 posinread=contigposition-theread.offset;
-////++++////  int32 updatelen=theread.read.getLenClippedSeq()-posinread;
-////++++////
-////++++////  CEBUG("contigpos: " << contigposition);
-////++++////  CEBUG("\nPPPosinread: " << posinread);
-////++++////  CEBUG("\nupdatelen: " << updatelen<<endl);
-////++++////
-////++++////  bool deletein=false;
-////++++////  bool deleteend=false;
-////++++////
-////++++////  // now only clip contig when size is affected, never ever at all move
-////++++////  // other reads around ---> this may lead to a contig break :(
-////++++////  if(theread.offset+theread.read.getLenClippedSeq()==CON_counts.size()
-////++++////     && CON_counts.back().total_cov==1) deleteend=true;
-////++++////
-////++++////  CEBUG("deletein: " << deletein << endl);
-////++++////  CEBUG("deleteend: " << deleteend << endl);
-////++++////
-////++++////  vector<char>::const_iterator I;
-////++++////
-////++++////  if(theread.direction>0){
-////++++////    I=theread.read.getClippedSeqIterator();
-////++++////    BOUNDCHECK(posinread, 0, theread.read.getLenClippedSeq());
-////++++////    advance(I, posinread);
-////++++////    updateCountVectors(contigposition,
-////++++////		       updatelen,
-////++++////		       I,
-////++++////		       theread.read.getSequencingType(),
-////++++////		       false);
-////++++////    theread.read.deleteBaseFromClippedSequence(posinread);
-////++++////    I=theread.read.getClippedSeqIterator();
-////++++////  }else{
-////++++////    I=theread.read.getClippedComplementSeqIterator();
-////++++////    BOUNDCHECK(posinread, 0, theread.read.getLenClippedSeq());
-////++++////    advance(I, posinread);
-////++++////    updateCountVectors(contigposition,
-////++++////		       updatelen,
-////++++////		       I,
-////++++////		       theread.read.getSequencingType(),
-////++++////		       false);
-////++++////    theread.read.deleteBaseFromClippedComplementSequence(posinread);
-////++++////    I=theread.read.getClippedComplementSeqIterator();
-////++++////  }
-////++++////
-////++++////  if(deletein==true){
-////++++////    auto cI=CON_counts.begin();
-////++++////    BOUNDCHECK(contigposition, 0, CON_counts.size());
-////++++////    advance(cI, contigposition);
-////++++////    CON_counts.erase(cI);
-////++++////    for(uint32 i=0; i<CON_reads.size(); i++){
-////++++////      if(CON_reads[i].offset>contigposition) CON_reads[i].offset--;
-////++++////    }
-////++++////    // adjust tags in consensus
-////++++////    // TODO: untested (ok?)
-////++++////    updateTagBaseDeleted(contigposition);
-////++++////  }
-////++++////  if(deleteend==true){
-////++++////    CON_counts.pop_back();
-////++++////    // adjust tags in consensus
-////++++////    // TODO: untested (ok?)
-////++++////    updateTagBaseDeleted(contigposition);
-////++++////  }
-////++++////
-////++++////  // BOUNDS checked above
-////++++////  advance(I, posinread);
-////++++////  updateCountVectors(contigposition,
-////++++////		     updatelen-1,
-////++++////		     I,
-////++++////		     theread.read.getSequencingType(),
-////++++////		     true);
-////++++////
-////++++////  paranoiaBUGSTAT(checkContig());
-////++++////
-////++++//////  if(contigposition==4711){
-////++++//////    cout << *this;
-////++++//////  }
+  // BOUNDS checked above
+  advance(I, posinread);
+  updateCountVectors(contigposition, 
+		     updatelen-1, 
+		     I, 
+		     theread.read.getSequencingType(),
+		     true);
+
+  paranoiaBUGSTAT(checkContig());
 
+//  if(contigposition==4711){
+//    cout << *this;
+//  }
+  
   FUNCEND();
 
 }
@@ -5408,16 +7851,28 @@ void Contig::adjustReadOffsets(int32 contigposition, int32 offset)
 {
   FUNCSTART("void Contig::adjustReadOffsets(int32 contigposition, int32 offset)");
 
+  //  if(contigposition==3713) cout << *this;
+
   paranoiaBUGSTAT(checkContig());
 
   BUGIFTHROW(contigposition<0,"contigposition<0 ?");
 
+  //  bool resizeit=false;
+  
   if(offset!=0){
-    CON_reads.shiftReads(contigposition,offset);
-    shiftMarkerPositions(contigposition,offset);
-    priv_rebuildConCounts();
+    uint32 maxsize=0;
+    for(uint32 i=0; i<CON_reads.size(); i++){
+      if(CON_reads[i].offset>contigposition) {
+	CON_reads[i].offset+=offset;
+      }
+      if(CON_reads[i].offset+CON_reads[i].read.getLenClippedSeq()>maxsize) maxsize=CON_reads[i].offset+CON_reads[i].read.getLenClippedSeq();
+    }
+    if(maxsize!=CON_counts.size()) CON_counts.resize(maxsize);
+    rebuildConCounts();
   }
 
+  //if(contigposition==3713) cout << *this;
+
   paranoiaBUGSTAT(checkContig());
 
   FUNCEND();
@@ -5425,15 +7880,6 @@ void Contig::adjustReadOffsets(int32 contigposition, int32 offset)
 }
 
 
-void Contig::shiftMarkerPositions(int32 contigposition, int32 offset)
-{
-  for(auto & mp : CON_markerpositions){
-    if(mp>=contigposition) mp+=offset;
-  }
-}
-
-
-
 
 /*************************************************************************
  *
@@ -5442,12 +7888,14 @@ void Contig::shiftMarkerPositions(int32 contigposition, int32 offset)
  *
  *************************************************************************/
 
-void Contig::priv_rebuildConCounts()
+void Contig::rebuildConCounts()
 {
   FUNCSTART("void Contig::rebuildConsensus()");
-
-  // do NOT clear the entire element! ... just what's needed: the counters and locks
-  for(auto ccI=CON_counts.begin(); ccI != CON_counts.end(); ++ccI){
+  
+  // using a pointer to CON_counts is (a lot) faster than accessing it 
+  //  via [] each time
+  cccontainer_t::iterator ccI=CON_counts.begin();
+  for(;ccI!=CON_counts.end();ccI++){
     ccI->A=0;             // ACGT are extended counters
     ccI->C=0;             // ccctype_t is enough for a coverage of 16k reads.
     ccI->G=0;
@@ -5458,34 +7906,32 @@ void Contig::priv_rebuildConCounts()
     ccI->total_cov=0;
     ccI->baselock=0;     // if > 0 then only one of A, C, T, G may be set, otherwise it's a misassembly
     ccI->snplock=0;
-    for(uint32 i=0; i<ReadGroupLib::SEQTYPE_END; ++i){
+    for(uint32 i=0; i<Read::SEQTYPE_END; ++i){
       ccI->seqtype_cov[i]=0;
     };
   }
-
-  for(auto pcrI=CON_reads.begin(); pcrI!=CON_reads.end(); pcrI++){
-    auto coveragemultiplier=pcrI->getDigiNormMultiplier();
-    if(pcrI.getReadDirection()>0){
-      updateCountVectors(pcrI.getReadStartOffset(),
-			 pcrI->getLenClippedSeq(),
-			 pcrI->getClippedSeqIterator(),
-			 pcrI->getSequencingType(),
-			 true,
-			 coveragemultiplier);
+  
+  for(uint32 i=0;i<CON_reads.size(); i++){
+    if(CON_reads[i].direction>0){
+      updateCountVectors(CON_reads[i].offset, 
+			 CON_reads[i].read.getLenClippedSeq(), 
+			 CON_reads[i].read.getClippedSeqIterator(), 
+			 CON_reads[i].read.getSequencingType(),
+			 true);
     }else{
-      updateCountVectors(pcrI.getReadStartOffset(),
-			 pcrI->getLenClippedSeq(),
-			 pcrI->getClippedComplementSeqIterator(),
-			 pcrI->getSequencingType(),
-			 true,
-			 coveragemultiplier);
+      updateCountVectors(CON_reads[i].offset, 
+			 CON_reads[i].read.getLenClippedSeq(), 
+			 CON_reads[i].read.getClippedComplementSeqIterator(), 
+			 CON_reads[i].read.getSequencingType(),
+			 true);
     }
   }
-
-  for(auto ccI=CON_counts.begin(); ccI != CON_counts.end(); ++ccI){
-    ccI->seqtype_cov[ReadGroupLib::SEQTYPE_SOLEXA]+=ccI->bbcounts[0];
+  
+  ccI=CON_counts.begin();
+  for(;ccI!=CON_counts.end();ccI++){
+    ccI->seqtype_cov[Read::SEQTYPE_SOLEXA]+=ccI->bbcounts[0];
     ccI->total_cov+=ccI->bbcounts[0];
-    ccI->seqtype_cov[ReadGroupLib::SEQTYPE_ABISOLID]+=ccI->bbcounts[1];
+    ccI->seqtype_cov[Read::SEQTYPE_ABISOLID]+=ccI->bbcounts[1];
     ccI->total_cov+=ccI->bbcounts[1];
   }
 
@@ -5512,113 +7958,111 @@ void Contig::insertBaseInRead(char base,
 //  if(contigposition==4709){
 //    cout << *this;
 //  }
-
+  
 
   FUNCSTART("void Contig::insertBaseInRead(char base, base_quality_t quality, int32 contigposition, int32 readindex)");
 
-  BUGIFTHROW(true,"Redo for PlacedContigReads");
-
-////++++////  paranoiaBUGSTAT(checkContig());
-////++++////
-////++++////  BUGIFTHROW((readindex<0 || readindex>=CON_reads.size()),
-////++++////	     "Readindex <0 || >= CON_reads.size() -> Read not in this contig!");
-////++++////
-////++++////  contigread_t & theread=CON_reads[readindex];
-////++++////
-////++++////  BUGIFTHROW((contigposition < theread.offset ||
-////++++////	      contigposition >= theread.offset+theread.read.getLenClippedSeq()),
-////++++////	     "Read does not cover given contigposition");
-////++++////
-////++++////  definalise();
-////++++////
-////++++////  int32 posinread=contigposition-theread.offset;
-////++++////  int32 updatelen=theread.read.getLenClippedSeq()-posinread;
-////++++////
-////++++////
-////++++////  bool insertin=false;
-////++++////  bool insertend=false;
-////++++////
-////++++////  // now only extend contig when size is affected, never ever at all move
-////++++////  // other reads around
-////++++////  if(theread.offset+theread.read.getLenClippedSeq()==CON_counts.size()
-////++++////     //    FALSCH!!!  && CON_counts.back().coverage==1)
-////++++////     ) insertend=true;
-////++++////
-////++++////
-////++++////  CEBUG("insertin: " << insertin << endl);
-////++++////  CEBUG("insertend: " << insertend << endl);
-////++++////
-////++++////  base_quality_t rqual=0;
-////++++////
-////++++////  vector<char>::const_iterator I;
-////++++////
-////++++////  if(theread.direction>0){
-////++++////    if(quality==BQ_UNDEFINED || quality>100){
-////++++////      quality=theread.read.queryAverageQualInClippedSequence(posinread-1, posinread, false, true);
-////++++////    }
-////++++////    rqual=quality;
-////++++////
-////++++////    I=theread.read.getClippedSeqIterator();
-////++++////    BOUNDCHECK(posinread, 0, theread.read.getLenClippedSeq()+1);
-////++++////    advance(I, posinread);
-////++++////    updateCountVectors(contigposition,
-////++++////		       updatelen,
-////++++////		       I,
-////++++////		       theread.read.getSequencingType(),
-////++++////		       false);
-////++++////    theread.read.insertBaseInClippedSequence(base, rqual, posinread,true);
-////++++////    I=theread.read.getClippedSeqIterator();
-////++++////  }else{
-////++++////    if(quality==BQ_UNDEFINED || quality>100){
-////++++////      quality=theread.read.queryAverageQualInClippedComplementSequence(posinread-1, posinread, false, true);
-////++++////    }
-////++++////    rqual=quality;
-////++++////
-////++++////    I=theread.read.getClippedComplementSeqIterator();
-////++++////    BOUNDCHECK(posinread, 0, theread.read.getLenClippedSeq()+1);
-////++++////    advance(I, posinread);
-////++++////    updateCountVectors(contigposition,
-////++++////		       updatelen,
-////++++////		       I,
-////++++////		       theread.read.getSequencingType(),
-////++++////		       false);
-////++++////    theread.read.insertBaseInClippedComplementSequence(base, rqual, posinread,true);
-////++++////    I=theread.read.getClippedComplementSeqIterator();
-////++++////  }
-////++++////
-////++++////  if(insertin==true){
-////++++////    auto ccI=CON_counts.begin();
-////++++////    BOUNDCHECK(contigposition, 0, CON_counts.size()+1);
-////++++////    advance(ccI, contigposition);
-////++++////    ccI=CON_counts.insert(ccI,CON_concounts_zero);
-////++++////    ccI->getBBChar()='*';
-////++++////    interpolateSRMValuesInCONcounts(ccI);
-////++++////
-////++++////    for(uint32 i=0; i<CON_reads.size(); i++){
-////++++////      if(CON_reads[i].offset>contigposition) CON_reads[i].offset++;
-////++++////    }
-////++++////    // adjust tags in consensus
-////++++////    // TODO: untested (ok?)
-////++++////    updateTagBaseInserted(contigposition);
-////++++////  }
-////++++////  if(insertend==true){
-////++++////    CON_counts.push_back(CON_concounts_zero);
-////++++////  }
-////++++////
-////++++////  advance(I, posinread);
-////++++////  updateCountVectors(contigposition,
-////++++////		     updatelen+1,
-////++++////		     I,
-////++++////		     theread.read.getSequencingType(),
-////++++////		     true);
-////++++////
-////++++////  paranoiaBUGSTAT(checkContig());
-////++++////
-////++++//////  if(contigposition==4709){
-////++++//////    cout << *this;
-////++++//////  }
-////++++////
-////++++////
+  paranoiaBUGSTAT(checkContig());
+
+  BUGIFTHROW((readindex<0 || readindex>=CON_reads.size()),
+	     "Readindex <0 || >= CON_reads.size() -> Read not in this contig!");
+
+  contigread_t & theread=CON_reads[readindex];
+
+  BUGIFTHROW((contigposition < theread.offset ||
+	      contigposition >= theread.offset+theread.read.getLenClippedSeq()),
+	     "Read does not cover given contigposition");
+
+  definalise();
+
+  int32 posinread=contigposition-theread.offset;
+  int32 updatelen=theread.read.getLenClippedSeq()-posinread;
+
+
+  bool insertin=false;
+  bool insertend=false;
+
+  // now only extend contig when size is affected, never ever at all move
+  // other reads around
+  if(theread.offset+theread.read.getLenClippedSeq()==CON_counts.size()
+     //    FALSCH!!!  && CON_counts.back().coverage==1)
+     ) insertend=true;
+
+
+  CEBUG("insertin: " << insertin << endl);
+  CEBUG("insertend: " << insertend << endl);
+
+  base_quality_t rqual=0;
+
+  vector<char>::const_iterator I;
+
+  if(theread.direction>0){
+    if(quality==BQ_UNDEFINED || quality>100){
+      quality=theread.read.queryAverageQualInClippedSequence(posinread-1, posinread, false, true);
+    }
+    rqual=quality;
+
+    I=theread.read.getClippedSeqIterator();
+    BOUNDCHECK(posinread, 0, theread.read.getLenClippedSeq()+1);
+    advance(I, posinread);
+    updateCountVectors(contigposition, 
+		       updatelen, 
+		       I,
+		       theread.read.getSequencingType(),
+		       false);
+    theread.read.insertBaseInClippedSequence(base, rqual, posinread,true);
+    I=theread.read.getClippedSeqIterator();
+  }else{
+    if(quality==BQ_UNDEFINED || quality>100){
+      quality=theread.read.queryAverageQualInClippedComplementSequence(posinread-1, posinread, false, true);
+    }
+    rqual=quality;
+
+    I=theread.read.getClippedComplementSeqIterator();
+    BOUNDCHECK(posinread, 0, theread.read.getLenClippedSeq()+1);
+    advance(I, posinread);
+    updateCountVectors(contigposition, 
+		       updatelen,
+		       I,
+		       theread.read.getSequencingType(),
+		       false);
+    theread.read.insertBaseInClippedComplementSequence(base, rqual, posinread,true);
+    I=theread.read.getClippedComplementSeqIterator();
+  }
+
+  if(insertin==true){
+    cccontainer_t::iterator ccI=CON_counts.begin();
+    BOUNDCHECK(contigposition, 0, CON_counts.size()+1);
+    advance(ccI, contigposition);
+    ccI=CON_counts.insert(ccI,CON_concounts_zero);
+    ccI->backbonechar='*';
+    interpolateSRMValuesInCONcounts(ccI);
+
+    for(uint32 i=0; i<CON_reads.size(); i++){
+      if(CON_reads[i].offset>contigposition) CON_reads[i].offset++;
+    }
+    // adjust tags in consensus
+    // TODO: untested (ok?)
+    updateTagBaseInserted(contigposition);
+  }
+  if(insertend==true){
+    CON_counts.push_back(CON_concounts_zero);
+  }
+
+  advance(I, posinread);
+  updateCountVectors(contigposition, 
+		     updatelen+1,
+		     I,
+		     theread.read.getSequencingType(),
+		     true);
+
+  paranoiaBUGSTAT(checkContig());
+
+//  if(contigposition==4709){
+//    cout << *this;
+//  }
+  
+
 
   FUNCEND();
 
@@ -5640,22 +8084,31 @@ void Contig::insertBaseInRead(char base,
  *************************************************************************/
 // untested, should work
 
-char Contig::getBaseInRead(const int32 contigposition, const PlacedContigReads::const_iterator & pcrI) const
+char Contig::getBaseInRead(int32 contigposition,
+			   int32 readindex) const
 {
-  FUNCSTART("char Contig::getBaseInRead(const int32 contigposition, const PlacedContigReads::const_iterator & pcrI) const");
+  FUNCSTART("char Contig::getBaseInRead(int32 contigposition, int32 readindex)");
+
+  BUGIFTHROW((readindex<0 || readindex>=CON_reads.size()),
+	     "Readindex <0 || >= CON_reads.size() -> Read not in this contig!");
 
-  BUGIFTHROW((contigposition < pcrI.getReadStartOffset() ||
-	      contigposition >= pcrI.getReadStartOffset() + pcrI->getLenClippedSeq()),
+  //  Read & ric=CON_reads[readindex].read;
+  const contigread_t & ric=CON_reads[readindex];
+
+  BUGIFTHROW((contigposition < ric.offset ||
+	      contigposition >= ric.offset+ric.read.getLenClippedSeq()),
 	     "Read does not cover given contigposition");
 
-  int32 readpos=pcrI.contigPos2UnclippedReadPos(contigposition);
+
+  //int32 posinread=contigposition-CON_reads[readindex].offset;
+
+  int32 readpos=contigPosToUnclippedReadPos(contigposition, ric);
   FUNCEND();
-  if(pcrI.getReadDirection() > 0){
-    return toupper(pcrI->getBaseInSequence(readpos));
+  if(ric.direction>0){
+    return toupper(ric.read.getBaseInSequence(readpos));
   }else{
-    return toupper(pcrI->getBaseInComplementSequence(readpos));
+    return toupper(ric.read.getBaseInComplementSequence(readpos));
   }
-  return '$';
 }
 
 
@@ -5667,21 +8120,31 @@ char Contig::getBaseInRead(const int32 contigposition, const PlacedContigReads::
  *************************************************************************/
 // untested, should work
 
-base_quality_t Contig::getQualityInRead(int32 contigposition, const PlacedContigReads::const_iterator & pcrI) const
+base_quality_t Contig::getQualityInRead(int32 contigposition,
+			   int32 readindex) const
 {
   FUNCSTART("char Contig::getQualityInRead(int32 contigposition, int32 readindex)");
 
-  BUGIFTHROW((contigposition < pcrI.getReadStartOffset() ||
-	      contigposition >= pcrI.getReadStartOffset() + pcrI->getLenClippedSeq()),
+  BUGIFTHROW((readindex<0 || readindex>=CON_reads.size()),
+	     "Readindex <0 || >= CON_reads.size() -> Read not in this contig!");
+
+  //  Read & ric=CON_reads[readindex].read;
+  const contigread_t & ric=CON_reads[readindex];
+
+  BUGIFTHROW((contigposition < ric.offset ||
+	      contigposition >= ric.offset+ric.read.getLenClippedSeq()),
 	     "Read does not cover given contigposition");
 
-  int32 readpos=pcrI.contigPos2UnclippedReadPos(contigposition);
+
+  //int32 posinread=contigposition-CON_reads[readindex].offset;
+
+  int32 readpos=contigPosToUnclippedReadPos(contigposition, ric);
   FUNCEND();
-  if(pcrI.getReadDirection() > 0){
-    return pcrI->getQualityInSequence(readpos);
+  if(ric.direction>0){
+    return ric.read.getQualityInSequence(readpos);
+  }else{
+    return ric.read.getQualityInComplementSequence(readpos);
   }
-
-  return pcrI->getQualityInComplementSequence(readpos);
 }
 
 
@@ -5700,69 +8163,112 @@ void Contig::changeBaseInRead(char base,
 {
   FUNCSTART("void Contig::changeBaseInRead(char base, base_quality_t quality, int32 contigposition, int32 readindex)");
 
-  BUGIFTHROW(true,"Redo for PlacedContigReads");
-
-////++++////  BUGIFTHROW((readindex<0 || readindex>=CON_reads.size()),
-////++++////	     "Readindex <0 || >= CON_reads.size() -> Read not in this contig!");
-////++++////
-////++++////  //  Read & theread=CON_reads[readindex].read;
-////++++////  contigread_t & theread=CON_reads[readindex];
-////++++////
-////++++////  BUGIFTHROW((contigposition < theread.offset ||
-////++++////	      contigposition >= theread.offset+theread.read.getLenClippedSeq()),
-////++++////	     "Read does not cover given contigposition");
-////++++////
-////++++////
-////++++////  definalise();
-////++++////
-////++++////  base_quality_t rqual=0;
-////++++////
-////++++////  int32 posinread=contigposition-CON_reads[readindex].offset;
-////++++////  vector<char>::const_iterator I;
-////++++////
-////++++////  if(theread.direction>0){
-////++++////    if(quality==BQ_UNDEFINED || quality>100){
-////++++////      quality=theread.read.queryAverageQualInClippedSequence(posinread-1, posinread+1, true, true);
-////++++////    }
-////++++////    rqual=quality;
-////++++////
-////++++////    I=theread.read.getClippedSeqIterator();
-////++++////    BOUNDCHECK(posinread, 0, theread.read.getLenClippedSeq());
-////++++////    advance(I, posinread);
-////++++////    updateCountVectors(contigposition,
-////++++////		       1 ,
-////++++////		       I,
-////++++////		       theread.read.getSequencingType(),
-////++++////		       false);
-////++++////    theread.read.changeBaseInClippedSequence(base, rqual, posinread);
-////++++////  }else{
-////++++////    if(quality==BQ_UNDEFINED || quality>100){
-////++++////      quality=theread.read.queryAverageQualInClippedComplementSequence(posinread-1, posinread+1, true, true);
-////++++////    }
-////++++////    rqual=quality;
-////++++////
-////++++////    I=theread.read.getClippedComplementSeqIterator();
-////++++////    BOUNDCHECK(posinread, 0, theread.read.getLenClippedSeq());
-////++++////    advance(I, posinread);
-////++++////    updateCountVectors(contigposition,
-////++++////		       1,
-////++++////		       I,
-////++++////		       theread.read.getSequencingType(),
-////++++////		       false);
-////++++////    theread.read.changeBaseInClippedComplementSequence(base, rqual, posinread);
-////++++////  }
-////++++////
-////++++////  updateCountVectors(contigposition,
-////++++////		     1,
-////++++////		     I,
-////++++////		     theread.read.getSequencingType(),
-////++++////		     true);
-////++++////
+  BUGIFTHROW((readindex<0 || readindex>=CON_reads.size()),
+	     "Readindex <0 || >= CON_reads.size() -> Read not in this contig!");
+
+  //  Read & theread=CON_reads[readindex].read;
+  contigread_t & theread=CON_reads[readindex];
+
+  BUGIFTHROW((contigposition < theread.offset ||
+	      contigposition >= theread.offset+theread.read.getLenClippedSeq()),
+	     "Read does not cover given contigposition");
+
+
+  definalise();
+
+  base_quality_t rqual=0;
+
+  int32 posinread=contigposition-CON_reads[readindex].offset;
+  vector<char>::const_iterator I;
+
+  if(theread.direction>0){
+    if(quality==BQ_UNDEFINED || quality>100){
+      quality=theread.read.queryAverageQualInClippedSequence(posinread-1, posinread+1, true, true);
+    }
+    rqual=quality;
+
+    I=theread.read.getClippedSeqIterator();
+    BOUNDCHECK(posinread, 0, theread.read.getLenClippedSeq());
+    advance(I, posinread);
+    updateCountVectors(contigposition, 
+		       1 ,
+		       I,
+		       theread.read.getSequencingType(),
+		       false);
+    theread.read.changeBaseInClippedSequence(base, rqual, posinread);
+  }else{
+    if(quality==BQ_UNDEFINED || quality>100){
+      quality=theread.read.queryAverageQualInClippedComplementSequence(posinread-1, posinread+1, true, true);
+    }
+    rqual=quality;
+
+    I=theread.read.getClippedComplementSeqIterator();
+    BOUNDCHECK(posinread, 0, theread.read.getLenClippedSeq());
+    advance(I, posinread);
+    updateCountVectors(contigposition,
+		       1,
+		       I,
+		       theread.read.getSequencingType(),
+		       false);
+    theread.read.changeBaseInClippedComplementSequence(base, rqual, posinread);
+  }
+
+  updateCountVectors(contigposition, 
+		     1,
+		     I,
+		     theread.read.getSequencingType(),
+		     true);
+  
+  FUNCEND();
+}
+
+
+
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+
+const Read & Contig::getReadAtIndex(int32 index) const
+{
+  FUNCSTART("void Contig::getReadAtIndex(int32 index)");
+
+  BUGIFTHROW((index<0 || index>=CON_reads.size()),
+	     "index <0 || >= CON_reads.size() -> Read not in this contig!");
+
   FUNCEND();
+
+  return CON_reads[index].read;
 }
 
 
 
+
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+
+const Read & Contig::getReadWithID(int32 readid) const
+{
+  FUNCSTART("int32 Contig::getReadWithID(int32 readid) const");
+
+  vector<contigread_t>::const_iterator crI=CON_reads.begin();
+
+  for(;crI!=CON_reads.end(); crI++){
+    if(crI->orpid == readid) {
+      FUNCEND();
+      return crI->read;
+    }
+  }
+  throw Notify(Notify::INTERNAL, THISFUNC, "id of read not found in contig?");
+}
+
+
 /*************************************************************************
  *
  *
@@ -5773,54 +8279,71 @@ void Contig::changeBaseInRead(char base,
 void Contig::addTagToRead(uint32 contigpositionfrom,
 			  uint32 contigpositionto,
 			  int32 readindex,
-			  multitag_t & mt)
+			  const string & identifier,
+			  const string & comment)
 {
-  FUNCSTART("void Contig::addTagToRead(int32 contigpositionfrom, int32 contigpositionto, int32 readindex, const multitag & mt)");
-
-  BUGIFTHROW(true,"Redo for PlacedContigReads");
-
-////++++////  BUGIFTHROW((readindex<0 || readindex>=CON_reads.size()),
-////++++////	     "Readindex <0 || >= CON_reads.size() -> Read not in this contig!");
-////++++////
-////++++////  //  Read & theread=CON_reads[readindex].read;
-////++++////  contigread_t & theread=CON_reads[readindex];
-////++++////
-////++++////  BUGIFTHROW((contigpositionfrom < theread.offset ||
-////++++////	      contigpositionfrom > theread.offset+theread.read.getLenClippedSeq()),
-////++++////	     "Read does not cover given contigposition (from)");
-////++++////  BUGIFTHROW((contigpositionto < static_cast<uint32>(theread.offset) ||
-////++++////	      contigpositionto > theread.offset+theread.read.getLenClippedSeq()),
-////++++////	     "Read does not cover given contigposition (to)");
-////++++////
-////++++////
-////++++////  definalise();
-////++++////
-////++++////  if(contigpositionto < contigpositionfrom) swap(contigpositionfrom,
-////++++////						 contigpositionto);
-////++++////
-////++++////  //TODO: use contigPos2UnclippedReadPos or similar???
-////++++////
-////++++////  uint32 posinreadfrom;
-////++++////  uint32 posinreadto;
-////++++////  uint32 len=(contigpositionto-contigpositionfrom);
-////++++////  if(CON_reads[readindex].direction>0){
-////++++////    posinreadfrom=contigpositionfrom-theread.offset+theread.read.getLeftClipoff();
-////++++////    posinreadto=posinreadfrom+len;
-////++++////  }else{
-////++++////    posinreadto=theread.read.getLenClippedSeq()-(contigpositionfrom-theread.offset)+theread.read.getLeftClipoff()-1;
-////++++////    posinreadfrom=posinreadto-len;
-////++++////  }
-////++++////
-////++++////  mt.from=posinreadfrom;
-////++++////  mt.to=posinreadto;
-////++++////
-////++++////  theread.read.addTagO(mt);
+  FUNCSTART("void Contig::addTagToRead(int32 contigpositionfrom, int32 contigpositionto, int32 readindex, const string & identifier, const string & comment)");
+
+  BUGIFTHROW((readindex<0 || readindex>=CON_reads.size()),
+	     "Readindex <0 || >= CON_reads.size() -> Read not in this contig!");
+
+  //  Read & theread=CON_reads[readindex].read;
+  contigread_t & theread=CON_reads[readindex];
+
+  BUGIFTHROW((contigpositionfrom < theread.offset ||
+	      contigpositionfrom > theread.offset+theread.read.getLenClippedSeq()),
+	     "Read does not cover given contigposition (from)");
+  BUGIFTHROW((contigpositionto < static_cast<uint32>(theread.offset) ||
+	      contigpositionto > theread.offset+theread.read.getLenClippedSeq()),
+	     "Read does not cover given contigposition (to)");
+
+
+  definalise();
+  
+  //TODO: check
+
+  if(contigpositionto < contigpositionfrom) swap(contigpositionfrom,
+						 contigpositionto);
+
+  uint32 posinreadfrom;
+  uint32 posinreadto;
+  uint32 len=(contigpositionto-contigpositionfrom);
+  if(CON_reads[readindex].direction>0){
+    posinreadfrom=contigpositionfrom-theread.offset+theread.read.getLeftClipoff();
+    posinreadto=posinreadfrom+len;
+  }else{
+    posinreadto=theread.read.getLenClippedSeq()-(contigpositionfrom-theread.offset)+theread.read.getLeftClipoff()-1;
+    posinreadfrom=posinreadto-len;
+  }
+
+  theread.read.addTag(posinreadfrom,
+		      posinreadto,
+		      identifier,
+		      comment);
 
   FUNCEND();
 }
 
 
 
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+
+void Contig::addTagToRead(const uint32 contigpositionfrom,
+			  const uint32 contigpositionto,
+			  const int32 readindex,
+			  const char * identifier,
+			  const char * comment)
+{
+  string id=identifier;
+  string co=comment;
+  addTagToRead(contigpositionfrom, contigpositionto, readindex, id, co);
+}
+
 
 // TODO: write version with multitag_t::mte_id_t??
 
@@ -5831,13 +8354,19 @@ void Contig::addTagToRead(uint32 contigpositionfrom,
  *
  *************************************************************************/
 
-Contig::consensustag_t & Contig::addTagToConsensus(const uint32 contigposfrom,
-						   const uint32 contigposto,
-						   const char strand,
-						   const char * identifier,
-						   const char * comment,
-						   const bool doublecheck
-  )
+void Contig::addTagToConsensus(const uint32 contigposfrom,
+			       const uint32 contigposto,
+			       const char strand, 
+			       const char * identifier,
+			       const char * comment,
+			       const bool doublecheck,
+			       const bool additionalinfo,
+			       const base_quality_t qualA,
+			       const base_quality_t qualC,
+			       const base_quality_t qualG,
+			       const base_quality_t qualT,
+			       const base_quality_t qualStar
+			       )
 {
   FUNCSTART("void Contig::addTagToConsensus(int32 contigposfrom, int32 contigposto, const char * identifier, const char * comment)");
 
@@ -5855,41 +8384,43 @@ Contig::consensustag_t & Contig::addTagToConsensus(const uint32 contigposfrom,
   BUGIFTHROW(!(strand=='+' || strand=='-' || strand=='='),
 	     "strand is not +, - or =");
 
-  // TODO: commented out 22.04.2007, check whether ok
+  // TODO: commented out 22.04.2007, check whether ok 
   // not needed? and disturbs setting tags in makeIntelligentConsensus()
   // definalise();
 
-  consensustag_t tmptag;
-  tmptag.identifier=multitag_t::newIdentifier(identifier);
-  tmptag.comment=multitag_t::newComment(comment);
-  tmptag.from=contigposfrom;
-  tmptag.to=contigposto;
-  tmptag.setStrand(strand);
-  tmptag.additionalinfo_initialised=false;
-
-  auto ctI = CON_consensus_tags.begin();
-
+  consensustag_t thetag;
+
+  thetag.identifier=multitag_t::newIdentifier(identifier);
+  thetag.comment=multitag_t::newComment(comment);
+  thetag.from=contigposfrom;
+  thetag.to=contigposto;
+  thetag.strand=strand;
+  thetag.additionalinfo_initialised=additionalinfo;
+  thetag.qualACGTStar[0]=qualA;
+  thetag.qualACGTStar[1]=qualC;
+  thetag.qualACGTStar[2]=qualG;
+  thetag.qualACGTStar[3]=qualT;
+  thetag.qualACGTStar[4]=qualStar;
+
+  bool found=false;
   if(doublecheck){
-    for(; ctI!=CON_consensus_tags.end(); ++ctI){
-      if(ctI->from==tmptag.from
-	 && ctI->to==tmptag.to
-	 && ctI->getStrand()==tmptag.getStrand()
-	 && ctI->identifier==tmptag.identifier
+    for(uint32 i=0; i<CON_consensus_tags.size(); i++){
+      if(CON_consensus_tags[i].from==thetag.from
+	 && CON_consensus_tags[i].to==thetag.to
+	 && CON_consensus_tags[i].strand==thetag.strand
+	 && CON_consensus_tags[i].identifier==thetag.identifier
 	) {
-	break;
+	found=true;
+	
+	// replace with new comments and additional info
+	CON_consensus_tags[i]=thetag;
       }
     }
   }
 
-  if(ctI==CON_consensus_tags.end()) {
-    CON_consensus_tags.push_back(tmptag);
-    return CON_consensus_tags.back();
-  }
-
-  *ctI=tmptag;
+  if(!found) CON_consensus_tags.push_back(thetag);  
 
   FUNCEND();
-  return *ctI;
 }
 
 
@@ -5918,7 +8449,7 @@ void Contig::updateTagBaseDeleted(uint32 contigpos)
       I++;
     }
   }
-
+  
   FUNCEND();
 }
 
@@ -5953,24 +8484,75 @@ void Contig::updateTagBaseInserted(uint32 contigpos)
 
 
 
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
+
+// *******************************************************************
+//  unclippedReadPosToContigPos
+//  We have a position in an UNCLIPPED read and we want to know the corresponding
+//  position in the contig
+//
+//  ******************************************************************        
+
+int32 Contig::unclippedReadPosToContigPos(const int32 readpos, const contigread_t &ric) const
+{
+  if (ric.direction > 0) {
+    return readpos - ric.read.getLeftClipoff() + ric.offset ;
+  } else {
+    // doch richtig? FALSCH return ric.offset + ric.read.getRightClipoff() -1 - readpos;
+    // FALSCH, das ist unclipped?return readpos+ric.offset-(ric.read.getLenSeq()-ric.read.getRightClipoff());
+    return ric.read.getRightClipoff()-readpos+ric.offset -1 ;
+  }
+}
+
+
+//  ******************************************************************        
+//  contigPosToUnclippedReadPos
+//  We have a contig position and we want to know which position in the
+//  UNCLIPPED FORWARD read corresponds to the contig position
+//
+//  ******************************************************************        
+
+int32 Contig::contigPosToUnclippedReadPos(const int32 contigpos, const contigread_t &ric) const
+{
+  if (ric.direction > 0) {
+    return contigpos - ric.offset + ric.read.getLeftClipoff();
+  } else {
+    // FALSCH return ric.offset + ric.read.getRightClipoff() -1 - contigpos;
+    return ric.read.getLenSeq()-ric.read.getRightClipoff()+contigpos-ric.offset;
+  }
+}
 
 
-int32 Contig::getRealReadPos(const uint32 contigpos, const PlacedContigReads::const_iterator & pcrI) const
+int32 Contig::getRealReadPos(const int32 contigpos, const uint32 readindex) const
 {
-  if(pcrI.getReadDirection() > 0){
-    return pcrI.contigPos2UnclippedReadPos(contigpos);
+  FUNCSTART("int32 Contig::getRealReadPos(const int32 contigpos, const uint32 readindex) const");
+  BUGIFTHROW(readindex>=CON_reads.size(),"readindex>=CON_reads.size()?");
+  FUNCEND();
+  return getRealReadPos(contigpos,CON_reads[readindex]);
+}
+
+int32 Contig::getRealReadPos(const int32 contigpos, const contigread_t &ric) const
+{
+  if(ric.direction>0){
+    return contigPosToUnclippedReadPos(contigpos, ric);
   }
-  return pcrI->calcComplPos(pcrI.contigPos2UnclippedReadPos(contigpos));
+  return ric.read.calcComplPos(contigPosToUnclippedReadPos(contigpos, ric));
 }
 
 
 
+//int32 Contig::contigPosToComplReadPos(const int32 contigpos, const contigread_t &ric)
+//{
+//  if (ric.direction > 0) {
+//    return ric.read.getLenSeq() -1 - (contigpos - ric.offset + ric.read.getLeftClipoff());   
+//  } else {
+//    return ric.read.getLenSeq() -1 - (ric.offset + ric.read.getRightClipoff() -1 - contigpos);
+//    // return contigpos-ric.offset+ric.read.getLenSeq()-ric.read.getRightClipoff();
+//  }
+//}
+//
+
+
+
 
 
 /*************************************************************************
@@ -5983,57 +8565,55 @@ void Contig::transposeReadSRMTagsToContig()
 {
   FUNCSTART("void Contig::transposeReadSRMTagsToContig()");
 
-  BUGIFTHROW(true,"Redo for PlacedContigReads");
-
-////++++////  //cout << "We are in contig: " << getContigName() << endl;
-////++++////
-////++++////  vector<contigread_t>::const_iterator rI=CON_reads.begin();
-////++++////  for(;rI!=CON_reads.end();rI++){
-////++++////
-////++++////    const contigread_t & ric =*rI;
-////++++////
-////++++////    //cout << "We are in read: " << ric.read.getName() << endl;
-////++++////
-////++++////    for(uint32 i=0; i<ric.read.getNumOfTags(); i++){
-////++++////      multitag_t acttag=ric.read.getTag(i);
-////++++////      //cout << "Tag #" << i << "\tfrom: " << acttag.from << "\tto: " << acttag.to << "\t" << acttag.identifier[0] << acttag.identifier[1] << acttag.identifier[2] << acttag.identifier[3] << endl;
-////++++////      if(acttag.identifier==Read::REA_tagentry_idSRMr
-////++++////	 || acttag.identifier==Read::REA_tagentry_idWRMr ) {
-////++++////
-////++++////	int32 tleftbound;
-////++++////	int32 trightbound;
-////++++////
-////++++////	if(ric.direction>0){
-////++++////	  tleftbound=acttag.from-ric.read.getLeftClipoff();
-////++++////	  trightbound=acttag.to-ric.read.getLeftClipoff();
-////++++////	}else{
-////++++////	  tleftbound=ric.read.getRightClipoff()-acttag.to-1;
-////++++////	  trightbound=ric.read.getRightClipoff()-acttag.from-1;
-////++++////	}
-////++++////	if(tleftbound<0) tleftbound=0;
-////++++////	if(trightbound<0) trightbound=0;
-////++++////
-////++++////	int32 lpos=ric.offset+tleftbound;
-////++++////	int32 rpos=ric.offset+trightbound;
-////++++////	//cout << "Tagging bounds " << ric.offset+tleftbound << "\t" << ric.offset+trightbound << endl;
-////++++////	// this is needed as some RMB tags might be in presently clipped
-////++++////	//  parts of a read
-////++++////	if(lpos < static_cast<int32>(CON_counts.size())
-////++++////	   && rpos>=0 ) {
-////++++////	  // adjust for partly present tags
-////++++////	  if(lpos<0) lpos=0;
-////++++////	  if(rpos >= static_cast<int32>(CON_counts.size())) rpos=CON_counts.size()-1;
-////++++////	  //cout << "Tagging bounds cleaned" << lpos << "\t" << rpos << endl;
-////++++////	  addTagToConsensus(lpos,
-////++++////			    rpos,
-////++++////			    '=',
-////++++////			    "ORMB",
-////++++////			    "Old repeat marker base",
-////++++////			    true);
-////++++////	}
-////++++////      }
-////++++////    }
-////++++////  }
+  //cout << "We are in contig: " << getContigName() << endl;
+
+  vector<contigread_t>::const_iterator rI=CON_reads.begin();
+  for(;rI!=CON_reads.end();rI++){
+
+    const contigread_t & ric =*rI;
+
+    //cout << "We are in read: " << ric.read.getName() << endl;
+
+    for(uint32 i=0; i<ric.read.getNumOfTags(); i++){
+      multitag_t acttag=ric.read.getTag(i);
+      //cout << "Tag #" << i << "\tfrom: " << acttag.from << "\tto: " << acttag.to << "\t" << acttag.identifier[0] << acttag.identifier[1] << acttag.identifier[2] << acttag.identifier[3] << endl;
+      if(acttag.identifier==Read::REA_tagentry_idSRMr
+	 || acttag.identifier==Read::REA_tagentry_idWRMr ) {
+	
+	int32 tleftbound;
+	int32 trightbound;
+	
+	if(ric.direction>0){
+	  tleftbound=acttag.from-ric.read.getLeftClipoff();
+	  trightbound=acttag.to-ric.read.getLeftClipoff();
+	}else{
+	  tleftbound=ric.read.getRightClipoff()-acttag.to-1;
+	  trightbound=ric.read.getRightClipoff()-acttag.from-1;
+	}
+	if(tleftbound<0) tleftbound=0;
+	if(trightbound<0) trightbound=0;
+	
+	int32 lpos=ric.offset+tleftbound;
+	int32 rpos=ric.offset+trightbound;
+	//cout << "Tagging bounds " << ric.offset+tleftbound << "\t" << ric.offset+trightbound << endl;
+	// this is needed as some RMB tags might be in presently clipped 
+	//  parts of a read 
+	if(lpos < static_cast<int32>(CON_counts.size())
+	   && rpos>=0 ) {
+	  // adjust for partly present tags
+	  if(lpos<0) lpos=0;
+	  if(rpos >= static_cast<int32>(CON_counts.size())) rpos=CON_counts.size()-1;
+	  //cout << "Tagging bounds cleaned" << lpos << "\t" << rpos << endl;
+	  addTagToConsensus(lpos,
+			    rpos,
+			    '=',
+			    "ORMB",
+			    "Old repeat marker base",
+			    true);
+	}
+      }
+    }
+  }
 
   FUNCEND();
 }
@@ -6042,7 +8622,7 @@ void Contig::transposeReadSRMTagsToContig()
 
 /*************************************************************************
  *
- * actualises template ids in the contig reads from the readpool
+ * actualises template and strain ids in the contig reads from the readpool
  * also refills the template ids present vector of the contig
  * also refills the CON_readsperstrain vector
  *
@@ -6051,33 +8631,29 @@ void Contig::transposeReadSRMTagsToContig()
  *
  *************************************************************************/
 
-void Contig::recalcTemplateIDsAndStrainPresent()
+void Contig::recalcTemplateAndStrainIDsPresent()
 {
-  FUNCSTART("void Contig::recalcTemplateIDsAndStrainPresent()");
+  FUNCSTART("void Contig::recalcTemplateAndStrainIDsPresent()");
 
   CON_templates_present.clear();
   CON_readsperstrain.clear();
-  CON_readsperstrain.resize(ReadGroupLib::getNumOfStrains(),0);
-
-  try{
-    auto pcrI=CON_reads.begin();
-    for(; pcrI != CON_reads.end(); ++pcrI){
-      if(pcrI.getOriginalReadPoolID() >= 0){
-	Read & actread = const_cast<Read &>(*pcrI);
-	actread.setTemplateID(CON_readpool->getRead(pcrI.getOriginalReadPoolID()).getTemplateID());
-	actread.setTemplatePartnerID(CON_readpool->getRead(pcrI.getOriginalReadPoolID()).getTemplatePartnerID());
-	actread.setTemplate(CON_readpool->getRead(pcrI.getOriginalReadPoolID()).getTemplate());
-	if(actread.getTemplateID()>=0){
-	  CON_templates_present.insert(actread.getTemplateID());
-	}
-
-	++CON_readsperstrain[CON_readpool->getRead(pcrI.getOriginalReadPoolID()).getStrainID()];
+  CON_readsperstrain.resize(CON_readpool->getNumOfStrainInReadpool(),0);
+
+  vector<contigread_t>::iterator I=CON_reads.begin();
+  for(; I!=CON_reads.end(); I++){
+    if(I->orpid>=0){
+      I->read.setTemplateID(CON_readpool->getRead(I->orpid).getTemplateID());
+      I->read.setTemplatePartnerID(CON_readpool->getRead(I->orpid).getTemplatePartnerID());
+      I->read.setTemplate(CON_readpool->getRead(I->orpid).getTemplate());
+      if(I->read.getTemplateID()>=0){
+	CON_templates_present.insert(I->read.getTemplateID());
       }
+      I->read.setStrainID(CON_readpool->getRead(I->orpid).getStrainID());
+      I->read.setStrain(CON_readpool->getRead(I->orpid).getStrain());
+
+      ++CON_readsperstrain[CON_readpool->getRead(I->orpid).getStrainID()];
     }
   }
-  catch(Notify n){
-    n.handleError(THISFUNC);
-  }
 
   FUNCEND();
   return;
@@ -6105,12 +8681,12 @@ void Contig::recalcTemplateIDsAndStrainPresent()
  *                                             4444444444444
  *
  *   Aims:
- *    - allow backbones at all :-)
+ *    - allow backbones at all :-) 
  *    - reduce the work for the assembler a lot
  *    - hold back automatic editor to insert or delete whole
  *      columns
  *
- * Also inserts rails as reads into the readpool (not when simulateonly
+ * Also inserts rails as reads into the readpool (not when simulateonly 
  *  is true)
  *
  * Returns number of rails inserted (or simulated to insert)
@@ -6132,9 +8708,9 @@ size_t Contig::addRails(const uint32 raillength, const uint32 railoverlap, const
     cout << "Adding rails: length " << raillength << " and overlap " << railoverlap << endl;
   }
 
-  return addSubsequences(raillength,
+  return addSubsequences(raillength, 
 			 railoverlap,
-			 straintxt,
+			 straintxt, 
 			 forcestrainset,
 			 railfromstrain,
 			 false, "", tmp, "", true,
@@ -6146,46 +8722,6 @@ size_t Contig::addSubsequences(const uint32 raillength, const uint32 railoverlap
 {
   FUNCSTART("void Contig::addRails()");
 
-  size_t numrailsinserted=0;
-
-  // find a readgroup which is (backbone|rail) and has the chosen strain
-  // if there is none, create one
-
-  ReadGroupLib::ReadGroupID rgid;
-  {
-    bool foundrgid=false;
-    for(size_t ri=0;ri<ReadGroupLib::getNumReadGroups();++ri){
-      rgid=ReadGroupLib::getReadGroupID(ri);
-      if((asbackbone && rgid.isBackbone())
-	 || (!asbackbone && rgid.isRail())){
-	if(rgid.getStrainName()==straintxt){
-	  foundrgid=true;
-	  break;
-	}
-      }
-    }
-    if(!foundrgid) {
-      CEBUG("rgid not found, creating new one\n");
-      rgid=ReadGroupLib::newReadGroup();
-      rgid.setStrainName(straintxt);
-      if(asbackbone){
-	rgid.setBackbone(true);
-      }else{
-	rgid.setRail(true);
-      }
-      rgid.setSequencingType(ReadGroupLib::SEQTYPE_TEXT);
-      CEBUG("RGID is now " << rgid << endl);
-    }
-  }
-
-  // This can happen with multiple backbone sequences! First backbone might create a new readgroup
-  //  which the following ones do not know (yet).
-  // In that case, expand!
-  if(ReadGroupLib::getNumReadGroups() >= CON_readsperreadgroup.size()){
-    CEBUG("expanding CON_readsperreadgroup to " << ReadGroupLib::getNumReadGroups() << endl);
-    CON_readsperreadgroup.resize(ReadGroupLib::getNumReadGroups(),0);
-  }
-
   // make sure we get the latest consensus
   definalise();
 
@@ -6194,6 +8730,7 @@ size_t Contig::addSubsequences(const uint32 raillength, const uint32 railoverlap
   CEBUG("overlap: " << railoverlap << endl);
 
 
+  size_t numrailsinserted=0;
   string consseq;
   vector<base_quality_t> consqual;
 
@@ -6204,10 +8741,10 @@ size_t Contig::addSubsequences(const uint32 raillength, const uint32 railoverlap
     //getConsensus(consseq, consqual, true,0,0);
     if(!railfromstrain.empty()){
       int32 strainidtotake=0;
-      if(!ReadGroupLib::getStrainIDOfStrain(railfromstrain,strainidtotake)){
+      if(!CON_readpool->getStrainIDOfStrain(railfromstrain,strainidtotake)){
 	cout.flush();
 	cout << "Error: did not find strain \"" << railfromstrain << "\" in readpool." << endl;
-	MIRANOTIFY(Notify::FATAL, "Have been asked to use non-existing strain for building rails.");
+	throw Notify(Notify::FATAL, THISFUNC, "Have been asked to use non-existing strain for building rails.");
       }
       //string strainseq;
       //vector<base_quality_t> strainqual;
@@ -6217,7 +8754,7 @@ size_t Contig::addSubsequences(const uint32 raillength, const uint32 railoverlap
       CEBUG(">>>> strainidtotake: " << strainidtotake << endl);
 
       newConsensusGet(consseq, consqual, strainidtotake);
-
+      
       // TODO: eventually "merge" strainseq with consseq
       //hier weiter: strainseq und consseq mergen nach consseq
 
@@ -6236,16 +8773,16 @@ size_t Contig::addSubsequences(const uint32 raillength, const uint32 railoverlap
 
   // init the CON_counts backbone values if needed
   if(initccbbvalues && !simulateonly){
+    cccontainer_t::iterator ccI=CON_counts.begin();
     const char * consb=&consseq[0];
-    for(auto ccI=CON_counts.begin(); ccI != CON_counts.end(); ++consb, ++ccI){
+    for(; ccI != CON_counts.end(); ccI++, consb++){
       ccI->bbcounts[0]=0;
       ccI->bbcounts[1]=0;
       ccI->bbbestquals[0]=0;
       ccI->bbbestquals[1]=0;
       ccI->bbstrains[0]=0;
       ccI->bbstrains[1]=0;
-      ccI->i_backbonecharorig=toupper(*consb);
-      ccI->i_backbonecharupdated='@';
+      ccI->backbonechar=toupper(*consb);
     }
   }
 
@@ -6258,11 +8795,11 @@ size_t Contig::addSubsequences(const uint32 raillength, const uint32 railoverlap
     cutseq.reserve(raillength+10);
     vector<base_quality_t> cutqual;
     cutqual.reserve(raillength+10);
-
+    
     uint32 transi=0;
     uint32 actoffset=0;
     char tmpcons;
-    for(;transi<consseq.size(); ++transi){
+    for(;transi<consseq.size(); transi++){
       tmpcons=consseq[transi];
       if(tmpcons=='@') tmpcons='N';
       cutseq+=tmpcons;
@@ -6273,13 +8810,13 @@ size_t Contig::addSubsequences(const uint32 raillength, const uint32 railoverlap
       if((cutseq.size()==raillength && consseq.size()-transi>raillength)
 	 || cutseq.size()>=29900
 	 || transi==consseq.size()-1){
-
+	
 	numrailsinserted++;
-
+	
 	if(!simulateonly){
 	  CON_railcounter++;
 	  ostringstream ostr;
-
+	  
 	  if(asbackbone) {
 	    ostr << "bb_" << CON_railcounter << "_" << backbonename;
 	  } else {
@@ -6292,19 +8829,24 @@ size_t Contig::addSubsequences(const uint32 raillength, const uint32 railoverlap
 	    cout << getContigName() << " first rail: " << readname << endl;
 	  }
 
-	  Read & newread=CON_readpool->getRead(CON_readpool->provideEmptyRead());
-	  CEBUG("C::aSs 1"<< endl);
-	  newread.setReadGroupID(rgid);
-	  CEBUG("C::aSs 2"<< endl);
-
+	  CON_readpool->addNewEmptyRead();
+	  
+	  Read & newread=CON_readpool->back();
+	  
 	  try{
 	    //newread.setFileNamesFromFASTAName(readname);
-	    CEBUG("C::aSs 3"<< endl);
 	    newread.setName(readname);
-	    CEBUG("C::aSs 4"<< endl);
 	    newread.setSequenceFromString(cutseq);
-	    CEBUG("C::aSs 5"<< endl);
 	    newread.setQualities(cutqual);
+	    newread.setStrain(straintxt.c_str());
+	    
+	    if(asbackbone){
+	      newread.setBackbone(true);
+	      newread.setRail(false);
+	    }else{
+	      newread.setBackbone(false);
+	      newread.setRail(true);
+	    }
 	  }
 	  catch(Notify n){
 	    cout << "\nOuch ... error while adding subsequence.\n";
@@ -6316,16 +8858,46 @@ size_t Contig::addSubsequences(const uint32 raillength, const uint32 railoverlap
 	    cout << "seq: " << cutseq << endl;
 	    n.handleError(THISFUNC);
 	  }
-	  // set CON_longestrailseen as last rail may be longer!
-	  if(!asbackbone
-	     && newread.getLenClippedSeq() > CON_longestrailseen) CON_longestrailseen=newread.getLenClippedSeq();
-
-	  //CON_reads.debugDump(false);
-	  CEBUG("C::aSs 6 "<< CON_readpool->size()-1 << " ao: " << actoffset << endl);
-	  CON_reads.placeRead(newread,CON_readpool->size()-1,actoffset,1);
-	  CEBUG("C::aSs 7"<< endl);
-	  ++CON_readsperreadgroup[rgid.getLibId()];
-	  CEBUG("C::aSs 8"<< endl);
+	  
+	  //CEBUG("New element:\t");
+	  {
+	    contigread_t tmp;
+	    
+	    tmp.offset=actoffset;
+	    tmp.orpid=CON_readpool->size()-1;
+	    tmp.direction=1;
+	    
+	    CON_reads.push_back(tmp);
+	    
+	    CON_reads.back().read=newread;
+	    
+	    CEBUG(readname << "\t" << tmp.offset << '\t' << newread.getLenClippedSeq() << endl);
+	    
+	    //CEBUG(tmp.offset << endl);
+	    //CEBUG(tmp.id << endl);
+	    //CEBUG(tmp.direction << endl);
+	    //CEBUG(CON_reads.back().read << endl);
+	  }
+	  
+	  //try{
+	  //  updateCountVectors(actoffset,
+	  //		     CON_reads.back().read.getLenClippedSeq(),
+	  //		     newread.getClippedSeqIterator(),
+	  //		     true);
+	  //}
+	  //catch(Notify n){
+	  //  cout << "Readpool id: " << CON_reads.back().id << endl;
+	  //  cout << "Error while adding this read (2):\n" << CON_reads.back().read;
+	  //  cout << "In this contig (output might crash):" << endl << *this << endl;
+	  //  n.handleError(THISFUNC);
+	  //}
+	  
+	  
+	  //definalise();
+	  //cout << "tada: " << CON_reads.size() << endl;
+	  //setCoutType(AS_TEXT);
+	  //cout << *this;
+	  
 	}
 	cutseq.clear();
 	cutqual.clear();
@@ -6360,40 +8932,31 @@ void Contig::removeRails()
 {
   FUNCSTART("void Contig::removeRails()");
 
-  for(auto pcrI=CON_reads.begin(); pcrI!=CON_reads.end();){
-    if(pcrI->isRail()){
-      pcrI=CON_reads.removeRead(pcrI);
+  vector<contigread_t>::iterator cfromI=CON_reads.begin();
+  vector<contigread_t>::iterator ctoI=cfromI;
+
+  for(; cfromI!=CON_reads.end(); cfromI++){
+    if(cfromI->read.isRail()){
+//      updateCountVectors(cfromI->offset,
+//			 cfromI->read.getLenClippedSeq(),
+//			 cfromI->read.getClippedSeqIterator(),
+//			 false);
     }else{
-      ++pcrI;
+      // TODO: it'd be better so collect all index of reads that
+      //  get freed and at the end copy from back of vector
+      //  into the free places. Then again, I currently don't care:
+      // It's done only once per contig before output.
+      // Perhaps once we reach 10 mio reads or so.
+
+      if(ctoI!=cfromI){
+	*ctoI=*cfromI;
+      }
+      ctoI++;
     }
   }
 
-  priv_rebuildConCounts();
-  definalise();
-
-  FUNCEND();
-  return;
-}
-
-
-/*************************************************************************
- *
- * Remove all non-backbone, non-rails from contig
- *
- *************************************************************************/
-
-void Contig::stripToBackbone()
-{
-  FUNCSTART("void Contig::stripToBackbone()");
+  CON_reads.resize(ctoI-CON_reads.begin());
 
-  for(auto pcrI=CON_reads.begin(); pcrI!=CON_reads.end();){
-    if(!pcrI->isRail() && !pcrI->isBackbone()){
-      pcrI=CON_reads.removeRead(pcrI);
-    }else{
-      ++pcrI;
-    }
-  }
-  priv_rebuildConCounts();
   definalise();
 
   FUNCEND();
@@ -6413,8 +8976,6 @@ void Contig::transformCERMappingsToCoverageReads()
 {
   FUNCSTART("void Contig::transformCERMappingsToCoverageReads()");
 
-  CON_readsperreadgroup.resize(ReadGroupLib::getNumReadGroups(),0);
-
   // go through all short read types
   // srtype==0 Solexa, 1==SOLiD
 
@@ -6426,10 +8987,7 @@ void Contig::transformCERMappingsToCoverageReads()
 
   vector<int32> strainsinsrm;
 
-  Read dummyread;
-
-  // note: change to actsrtype<2 to support SOLiD (if ever)
-  for(unsigned int actsrtype=0; actsrtype<1; actsrtype++){
+  for(unsigned int actsrtype=0; actsrtype<2; actsrtype++){
     // go through complete CON_counts, looking for areas which have a
     //  a short read coverage of the actsrtype
 
@@ -6437,66 +8995,56 @@ void Contig::transformCERMappingsToCoverageReads()
     uint32 passnum=0;
 
     while(needanotherpass){
-      /*
-      {
-	cout << "DBG CON_counts:\n";
-	uint32 pos=0;
-	for(auto & cce : CON_counts){
-	  cout << pos << ":\t" << cce << '\n';
-	  ++pos;
-	  if(pos==150) break;
-	}
-      }
-      */
       passnum++;
       needanotherpass=false;
       srmseq.clear();
       srmqual.clear();
+      cccontainer_t::iterator ccI=CON_counts.begin();
       int32 rangestart=-1;       // -1, not inrange
       int32 ccpos=0;
       uint8 thisstrainmask=0;
-      bool hasnongap=false;
       bool needsave=true;
       uint32 rangesthispass=0;
-      for(auto ccI=CON_counts.begin(); ccI!=CON_counts.end(); ++ccpos, ++ccI){
+      for(; ccI!=CON_counts.end(); ccI++, ccpos++){
 	CEBUG("ccpos: " << ccpos << '\t' << *ccI << '\n');
 	if(rangestart>=0){
 	  // do we need to finish?
 	  if(ccI->bbstrains[actsrtype]!= thisstrainmask
-	     || ccI->bbcounts[actsrtype]==0
-	     || ccI->getOriginalBBChar()=='@'
+	     || ccI->bbcounts[actsrtype]==0 
+	     || ccI->backbonechar=='@'
 	     || ccpos+1==CON_counts.size()){
-	    // yes, look whether stretch is long enough or we need to
+	    // yes, look whether stretch is long enough or we need to 
 	    //  save this part
-	    // the first line (hasnongap) is a fix to prevent almost empty reads
-	    //  (only gaps) being added (with no strain): e.g. "X*******"
-	    if(hasnongap
+	    // FIXME:
+	    // the first line (>5) is a lame fix for almost empty reads
+	    //  (only a gap) being added (with no strain): "N*"
+	    if(ccpos-rangestart>5
 	       && ((needsave && ccpos-rangestart>0) || ccpos-rangestart>30)){
 	      CEBUG("Would add: " << rangestart << "\t" <<ccpos);
 	      CEBUG("\n" << srmseq << "\n");
-
+	      
 	      ostringstream ostr;
 	      if(actsrtype==0){
 		ostr << "_cer_sxa_" << CON_cer_idcounter << '_';
 	      }else{
-		MIRANOTIFY(Notify::FATAL,"SOLiD not supported atm");
 		ostr << "_cer_sid_" << CON_cer_idcounter << '_';
 	      }
 
 	      definalise();
 
-//	      CON_reads.resize(CON_reads.size()+1);
-//	      CON_reads.back().offset=-1;
-//	      CON_reads.back().orpid=-1;
-//	      CON_reads.back().direction=1;
-//	      CON_reads.back().offset=rangestart;
-//  	      CEBUG("Adding:\n" << ostr.str() << '\n');
-//	      CEBUG("Orpid: " << CON_reads.back().orpid);
-//	      CEBUG("\nOffset: " << CON_reads.back().offset);
-//	      CEBUG("\nDirection: " << CON_reads.back().direction);
-//	      Read & newread=CON_reads.back().read;
+	      CON_reads.resize(CON_reads.size()+1);
+
+	      CON_reads.back().offset=-1;
+	      CON_reads.back().orpid=-1;
+	      CON_reads.back().direction=1;	      
+	      CON_reads.back().offset=rangestart;
+  
+	      CEBUG("Adding:\n" << ostr.str() << '\n');
+	      CEBUG("Orpid: " << CON_reads.back().orpid);
+	      CEBUG("\nOffset: " << CON_reads.back().offset);
+	      CEBUG("\nDirection: " << CON_reads.back().direction);
 
-	      Read & newread=const_cast<Read &>(*(CON_reads.placeRead(dummyread,-1,rangestart,1)));
+	      Read & newread=CON_reads.back().read;
 
 	      // we won't need adjustments, let's save some memory
 	      newread.disallowAdjustments();
@@ -6504,7 +9052,15 @@ void Contig::transformCERMappingsToCoverageReads()
 	      newread.setName(ostr.str());
 	      newread.setSequenceFromString(srmseq);
 	      newread.setLQClipoff(1);
-
+	      if(actsrtype==0){
+		newread.setSequencingType(Read::SEQTYPE_SOLEXA);
+	      }else if(actsrtype==1){
+		newread.setSequencingType(Read::SEQTYPE_ABISOLID);
+	      }else{
+		throw Notify(Notify::INTERNAL, THISFUNC, "Unknown actsrtype? Do we have more than Solexa and SOLiD?.");
+	      }
+	      newread.setCoverageEquivalentRead(true);
+	      //newread.setStrain(straintxt.c_str());
 	      if(srmqual.empty()){
 		newread.setQualities(1);
 		newread.setQualityFlag(false);
@@ -6518,53 +9074,17 @@ void Contig::transformCERMappingsToCoverageReads()
 	      // set a strain, if possible
 	      getMappedBBStrainIDsFromMask(strainsinsrm,thisstrainmask);
 
-	      // find a readgroup which is CoverageEquivalent and has the chosen strain
-	      // if there is none, create one
-
-	      ReadGroupLib::ReadGroupID rgid;
-	      {
-		string nameofsis0;
-		if(!strainsinsrm.empty()){
-		  nameofsis0=ReadGroupLib::getStrainOfStrainID(strainsinsrm[0]);
-		}
-		bool foundrgid=false;
-		for(size_t ri=0;ri<ReadGroupLib::getNumReadGroups();++ri){
-		  rgid=ReadGroupLib::getReadGroupID(ri);
-		  if(rgid.getSequencingType()==ReadGroupLib::SEQTYPE_SOLEXA
-		     && actsrtype!=0) continue;
-		  if(rgid.getSequencingType()==ReadGroupLib::SEQTYPE_ABISOLID
-		     && actsrtype!=1) continue;
-		  if(rgid.isCoverageEquivalentRead()){
-		    if(nameofsis0.empty() && rgid.getStrainName().empty()){
-		      foundrgid=true;
-		      break;
-		    }else if(!nameofsis0.empty() && rgid.getStrainName()==nameofsis0){
-		      foundrgid=true;
-		      break;
-		    }
-		  }
-		}
-		if(!foundrgid) {
-		  rgid=ReadGroupLib::newReadGroup();
-		  rgid.setCoverageEquivalentRead(true);
-		  if(!strainsinsrm.empty()) rgid.setStrainName(nameofsis0);
-
-		  if(actsrtype==0){
-		    rgid.setSequencingType(ReadGroupLib::SEQTYPE_SOLEXA);
-		  }else if(actsrtype==1){
-		    rgid.setSequencingType(ReadGroupLib::SEQTYPE_ABISOLID);
-		  }else{
-		    MIRANOTIFY(Notify::INTERNAL, "Unknown actsrtype? Do we have more than Solexa and SOLiD?.");
-		  }
-		  CON_readsperreadgroup.resize(ReadGroupLib::getNumReadGroups(),0);
-		}
+	      // TODO: think of something for several strains
+	      if(!strainsinsrm.empty()){
+		CON_reads.back().read.setStrainID(strainsinsrm[0]);
+		CON_reads.back().read.setStrain(
+		  CON_readpool->getStrainOfStrainID(strainsinsrm[0])
+		  );
 	      }
 
-	      newread.setReadGroupID(rgid);
-	      ++CON_readsperreadgroup[rgid.getLibId()];
-
 	      //assout::saveAsCAF(*this, "transfsrmdebug.caf", true);
 
+	      //CON_reads.back().read.exchangeNsWithGaps();
 	      CON_cer_idcounter++;
 	      rangesthispass++;
 	      needanotherpass=true;
@@ -6575,20 +9095,12 @@ void Contig::transformCERMappingsToCoverageReads()
 	    needsave=true;
 	    srmseq.clear();
 	    srmqual.clear();
-	    hasnongap=false;
 	  }else{
 	    //// no, just append current bb char to sequence
-	    if(ccI->getOriginalBBChar() != '*') hasnongap=true;
-	    srmseq.push_back(tolower(ccI->getOriginalBBChar()));
-	    if(passnum==1) srmqual.push_back(ccI->bbbestquals[actsrtype]);
-	    BUGIFTHROW(ccI->bbbestquals[actsrtype]>=100,"Whooops 1, qual " << static_cast<uint16>(ccI->bbbestquals[actsrtype]) << " is >= 100. Position " << ccI-CON_counts.begin());
-
-	    // while thisstrainmask is set by the first position of the CER, it might be that we
-	    //  started in a gap region (very unlikely, but not impossible)
-	    //  Therefore, OR the current mask to thisstrainmask
-	    thisstrainmask|=ccI->bbstrains[actsrtype];
+	    srmseq.push_back(tolower(ccI->backbonechar));
+	    //srmseq.push_back('n');
 
-	    if(ccI->bbcounts[actsrtype]>0) ccI->bbcounts[actsrtype]--;
+	    if(passnum==1) srmqual.push_back(ccI->bbbestquals[actsrtype]);
 	  }
 	}else{
 	  if(ccI->bbcounts[actsrtype]>0){
@@ -6597,36 +9109,21 @@ void Contig::transformCERMappingsToCoverageReads()
 	    srmseq.clear();
 	    srmqual.clear();
 	    srmseq.push_back('X');
-	    srmseq.push_back(tolower(ccI->getOriginalBBChar()));
+	    srmseq.push_back(tolower(ccI->backbonechar));
 	    //srmseq.push_back('n');
 	    if(passnum==1) {
 	      srmqual.push_back(0);
 	      srmqual.push_back(ccI->bbbestquals[actsrtype]);
-	      BUGIFTHROW(ccI->bbbestquals[actsrtype]>=100,"Whooops 2, qual " << static_cast<uint16>(ccI->bbbestquals[actsrtype]) << " is >= 100. Position " << ccI-CON_counts.begin());
 	    }
 	  }else{
-	    //if(rangesthispass>0)
+	    //if(rangesthispass>0) 
 	    needsave=false;
 	  }
-	  if(ccI->bbcounts[actsrtype]>0) ccI->bbcounts[actsrtype]--;
 	}
-	//if(ccI->bbcounts[actsrtype]>0) ccI->bbcounts[actsrtype]--;
+	if(ccI->bbcounts[actsrtype]>0) ccI->bbcounts[actsrtype]--;
       }
     }
   }
-
-  /*
-  {
-    cout << "DBG CON_counts end:\n";
-    uint32 pos=0;
-    for(auto & cce : CON_counts){
-      cout << pos << ":\t" << cce << '\n';
-      ++pos;
-      if(pos==150) break;
-    }
-  }
-  */
-
   FUNCEND();
   return;
 }
@@ -6634,67 +9131,390 @@ void Contig::transformCERMappingsToCoverageReads()
 //#define CEBUG(bla)
 
 
+/*************************************************************************
+ *
+ *
+ *
+ *************************************************************************/
+
+void Contig::getMappedBBStrainIDsFromMask(vector<int32> & strains, uint8 mask)
+{
+  strains.clear();
+  for(uint8 i=0; i<8; i++){
+    if(mask & 1) strains.push_back(i);
+    mask=mask>>1;
+  }
+  return;
+}
 
 /*************************************************************************
  *
- * should the readpool outside have been reordered, the contig must
- *  know about this
- * If reversemap is empty, it is recalculated ... basically the caller
- *  does not need to care about it
+ * copy first all Genbank features of all reads into one big vector
+ *  if allowedfeatures not empty: only the features named there
+ *  if forbiddenfeatures not empty: do not take features named there
+ *
+ * reads that have  Fsrc, Fgen, FCDS, Fexn, or Fint can get additional
+ *  intergenic regions simulated if wished
+ *
+ * list is sorted ascending before given back by contigfrom, to and lastly
+ *  by identifier (Fsrc, Fgen, FCDS, rest)
  *
  *************************************************************************/
+//#define CEBUGF2(bla)  {cout << bla; cout.flush();}
+#define CEBUGF2(bla)
 
-void Contig::exchangeReadIDs(vector<uint32> & newids, vector<uint32> & reversemap)
+void Contig::getGBFSummary(list<gbfsummary_t> & allGBfeatures, const vector<multitag_t::mte_id_t> & allowedfeatures, const vector<multitag_t::mte_id_t> & forbiddenfeatures, bool simulateintergenics) const
 {
-  FUNCSTART("void Contig::exchangeReadIDs(vector<uint32> & newids)");
+  allGBfeatures.clear();
+
+  vector<contigread_t>::const_iterator R=CON_reads.begin();
+  vector<int8> featuremask;
+  uint32 igrcounter=0;
+
+  for(; R != CON_reads.end(); R++){
+    featuremask.clear();
+
+    //Read::setCoutType(Read::AS_TEXTCLIPS);
+    //CEBUGF2(R->read);
+    bool mustsimulateigr=false;
+    for(uint32 t=0; t<R->read.getNumOfTags(); t++){
+      const multitag_t & thetag=R->read.getTag(t);
+      if(thetag.identifier==Read::REA_tagentry_idFsrc
+    	 || thetag.identifier==Read::REA_tagentry_idFgen
+    	 || thetag.identifier==Read::REA_tagentry_idFCDS
+    	 || thetag.identifier==Read::REA_tagentry_idFexn
+    	 || thetag.identifier==Read::REA_tagentry_idFint) mustsimulateigr=simulateintergenics;
+    }
+
+    for(uint32 t=0; t<R->read.getNumOfTags(); t++){
+      const multitag_t & thetag=R->read.getTag(t);
+      if(!GBF::checkIfGAP4GBFfeaure(thetag.getIdentifierStr())) continue;
+
+      // next tag if tag is completely outside of the good read part
+      if(!((thetag.from >= R->read.getLeftClipoff()
+	    && thetag.from < R->read.getRightClipoff())
+	   || (thetag.to >= R->read.getLeftClipoff()
+	       && thetag.to < R->read.getRightClipoff()))) continue;	
+
+      bool musttakeit=true;
+      if(!allowedfeatures.empty()) {
+	musttakeit=false;
+	for(uint32 i=0;i<allowedfeatures.size();i++){
+	  if(thetag.identifier == allowedfeatures[i]){
+	    musttakeit=true;
+	    break;
+	  }
+	}
+      }
 
-  definalise();
-  CON_templates_present.clear();
-  CON_allowedrefids.clear();
 
-  if(reversemap.empty()){
-    reversemap.resize(newids.size(),-1);
-    for(uint32 ni=0; ni<newids.size(); ++ni){
-      //cout << "newids[" <<i << "]:\t" << newids[i] << endl;
-      BUGIFTHROW(newids[ni]>= reversemap.size(),"newids[ni]>= reversemap.size() ???");
-      reversemap[newids[ni]]=ni;
-    }
-  }
+      if(!forbiddenfeatures.empty()) {
+	for(uint32 i=0;i<forbiddenfeatures.size();i++){
+	  if(thetag.identifier == forbiddenfeatures[i]){
+	    musttakeit=false;
+	    break;
+	  }
+	}
+      }
+
+      bool isgene=false;
+      if(thetag.identifier==Read::REA_tagentry_idFgen
+	 || thetag.identifier==Read::REA_tagentry_idFCDS
+	 || thetag.identifier==Read::REA_tagentry_idFexn
+	 || thetag.identifier==Read::REA_tagentry_idFint
+	 || thetag.identifier==Read::REA_tagentry_idFmRN
+	 || thetag.identifier==Read::REA_tagentry_idFm_R
+	 || thetag.identifier==Read::REA_tagentry_idFpRN
+	 || thetag.identifier==Read::REA_tagentry_idFrRN
+	 || thetag.identifier==Read::REA_tagentry_idFscR
+	 || thetag.identifier==Read::REA_tagentry_idFsnR
+	 || thetag.identifier==Read::REA_tagentry_idFtRN
+	){
+	isgene=true;
+      }
+
+      if(musttakeit) {
+	gbfsummary_t onefeature;
+	string extracted;
+
+	CEBUG("Have this:\n"<<thetag<<endl);
+
+	onefeature.identifier=thetag.getIdentifierStr();
+
+	onefeature.mustbetranslated=false;
+	if(thetag.identifier==Read::REA_tagentry_idFCDS){
+	  onefeature.mustbetranslated=true;
+	}
+	onefeature.cfrom=unclippedReadPosToContigPos(thetag.from,*R);
+	onefeature.cto=unclippedReadPosToContigPos(thetag.to, *R);
+	if(thetag.strand=='-'){
+	  onefeature.direction=-1;
+	} else {
+	  onefeature.direction=1;
+	}
+	onefeature.readindex=R-CON_reads.begin();
+	onefeature.strainid=R->read.getStrainID();
+	if(thetag.extractGenBankKeyValueFromComment("/locus_tag",extracted)) {
+	  onefeature.locustag=extracted;
+	}
+	if(thetag.extractGenBankKeyValueFromComment("/gene",extracted)) {
+	  onefeature.gene=extracted;
+	}
+	if(thetag.extractGenBankKeyValueFromComment("/function",extracted)) {
+	  onefeature.function=extracted;
+	}
+	if(thetag.extractGenBankKeyValueFromComment("/EC_number",extracted)) {
+	  onefeature.ecnumber=extracted;
+	}
+	if(thetag.extractGenBankKeyValueFromComment("/product",extracted)) {
+	  onefeature.product=extracted;
+	}
+	if(thetag.extractGenBankKeyValueFromComment("/note",extracted)) {
+	  onefeature.note=extracted;
+	}
+	onefeature.translationtable=11;
+	if(thetag.extractGenBankKeyValueFromComment("/transl_table",extracted)) {
+	  onefeature.translationtable=static_cast<int8>(atoi(extracted.c_str()));
+	}
+	onefeature.codonstart=1;
+	if(thetag.extractGenBankKeyValueFromComment("/codon_start",extracted)) {
+	  onefeature.codonstart=static_cast<int8>(atoi(extracted.c_str()));
+	}
 
-  for(auto pcrI=CON_reads.begin(); pcrI!=CON_reads.end(); ++pcrI){
-    if(pcrI.getORPID() >= 0) {
-      BUGIFTHROW(pcrI.getORPID() >= reversemap.size(),"crI->orpid >= newids.size() ???");
-      pcrI.setORPID(reversemap[pcrI.getORPID()]);
+	onefeature.isgene=isgene;
+
+	CEBUGF2("Extracted feature:\n" << onefeature);
+	
+	allGBfeatures.push_back(onefeature);
+      }
+
+      // preparing for intergenic regions: mask away this feature from read 
+      if(isgene){
+	if(featuremask.empty()) featuremask.resize(R->read.getLenSeq(),1);
+	for(uint32 pos=thetag.from; pos<=thetag.to; pos++){
+	  if(pos<R->read.getLenSeq()) featuremask[pos]=0;
+	}
+      }
     }
-    if(pcrI->getTemplatePartnerID()>=0){
-      const_cast<Read &>(*pcrI).setTemplatePartnerID(reversemap[pcrI->getTemplatePartnerID()]);
+
+    // if there were GenBank features in this read, simulate intergenic
+    //  features
+    if(!featuremask.empty() && mustsimulateigr){
+      CEBUGF2("mustsimulateigr: " << mustsimulateigr << '\n');
+      CEBUGF2("Simulate IGR for " << R->read.getName() << '\n');
+      bool inintergenic=false;
+      uint32 runstart=0;
+      for(uint32 pos=0; pos <= R->read.getLenSeq(); pos++){
+	if(pos < R->read.getLenSeq()){
+	  CEBUGF2("featuremask[" << pos << "]:\t" << static_cast<uint16>(featuremask[pos]) << endl);
+	}
+	if(pos == R->read.getLenSeq() || featuremask[pos]==0){
+	  if(inintergenic){
+	    gbfsummary_t onefeature;
+	    
+	    onefeature.identifier="Figr";
+	    
+	    onefeature.mustbetranslated=false;
+	    int32 tmp=unclippedReadPosToContigPos(runstart,*R);
+	    if(tmp<0) tmp=0;
+	    onefeature.cfrom=tmp;
+	    if(pos == R->read.getLenSeq()){
+	      // carefull: if at end of sequence, we must take -1
+	      //  or else the tag will be one too long
+	      onefeature.cto=unclippedReadPosToContigPos(pos-1,*R);
+	    }else{
+	      onefeature.cto=unclippedReadPosToContigPos(pos,*R);
+	    }
+	    onefeature.direction=1;
+	    onefeature.readindex=R-CON_reads.begin();
+	    onefeature.strainid=R->read.getStrainID();
+	    onefeature.isgene=false;
+	    allGBfeatures.push_back(onefeature);
+
+	    CEBUGF2("Made IGR:\n" << onefeature);
+	    
+	    inintergenic=false;
+	    runstart=0;
+	  }
+	}else{
+	  if(!inintergenic){
+	    inintergenic=true;
+	    runstart=pos;
+	  }
+	}
+      }
     }
-    if(pcrI->getTemplateID()>=0){
-      CON_templates_present.insert(pcrI->getTemplateID());
+  }
+
+  CEBUGF2("going to sort\n");
+  allGBfeatures.sort(Contig::gbfsummary_t_comparator);
+  CEBUGF2("sorted\n");
+
+  // assign names to the intergenic regions
+  if(simulateintergenics){
+    string gene;
+    string function;
+    string ecnumber;
+    string product;
+    string note;
+
+    string concatstring="; ";
+
+    list<gbfsummary_t>::iterator gbfsI=allGBfeatures.begin();
+    for(; gbfsI != allGBfeatures.end(); gbfsI++){
+      if(gbfsI->identifier == "Figr"){
+      	ostringstream newlocusostr;
+      	ostringstream newnoteostr;
+      
+      	newlocusostr << "IGR_";
+      	newnoteostr << "Intergenic between ";
+
+CEBUGF2("#1\n");
+
+      	bool foundprevious=false;
+      	if(gbfsI != allGBfeatures.begin()){
+	  list<gbfsummary_t>::iterator gbfsImm=gbfsI;
+
+CEBUGF2("#2\n");
+	  while (gbfsImm != allGBfeatures.begin()
+		 && gbfsI->readindex == gbfsImm->readindex
+		 && (gbfsImm == gbfsI || gbfsImm->isgene==false)) gbfsImm--;
+
+CEBUGF2("#3\n");
+	  if(gbfsI->readindex == gbfsImm->readindex) {
+	    newlocusostr << gbfsImm->locustag << '_';
+CEBUGF2("#4\n");
+	    concatAllGBFInfoForLocus(allGBfeatures, gbfsImm, concatstring, gene, function, ecnumber, product, note);
+CEBUGF2("#5\n");
+	    if(gene.empty()){
+	      newnoteostr << gbfsImm->locustag << " and ";
+	    }else{
+	      newnoteostr << gene << " and ";
+	    }
+CEBUGF2("#6\n");
+	    foundprevious=true;
+	  }
+	}
+CEBUGF2("#7\n");
+      	if(!foundprevious){
+      	  newlocusostr << "seqstart_";
+      	  newnoteostr << "sequence start and ";
+      	}
+      	
+      	if(gbfsI != allGBfeatures.end()) {
+CEBUGF2("#8\n");
+	  list<gbfsummary_t>::iterator gbfsImm=gbfsI;
+	  while (gbfsImm != allGBfeatures.end()
+		 && gbfsI->readindex == gbfsImm->readindex
+		 && (gbfsImm == gbfsI || gbfsImm->isgene==false)) gbfsImm++;
+
+CEBUGF2("#9\n");
+	  foundprevious=false;
+	  if(gbfsImm != allGBfeatures.end()
+	     && gbfsI->readindex == gbfsImm->readindex) {
+CEBUGF2("#a\n");
+	    newlocusostr << gbfsImm->locustag;
+CEBUGF2("#b\n");
+	    concatAllGBFInfoForLocus(allGBfeatures, gbfsImm, concatstring, gene, function, ecnumber, product, note);
+CEBUGF2("#c\n");
+	    if(gene.empty()){
+	      newnoteostr << gbfsImm->locustag;
+	    }else{
+	      newnoteostr << gene;
+	    }
+CEBUGF2("#d\n");
+	    foundprevious=true;
+	  }
+	}
+	if(!foundprevious){
+      	  newlocusostr << "seqend";
+      	  newnoteostr << "sequence end";
+      	}
+      	
+CEBUGF2("#e\n");
+      	gbfsI->locustag=newlocusostr.str();
+      	gbfsI->note = newnoteostr.str();
+CEBUGF2("#f\n");
+      }
     }
-    //cout << "exchrid: a\t" << *crI;
   }
 }
+//#define CEBUGF2(bla)
 
 
 /*************************************************************************
  *
+ * append b to a if b != a;
+ * if a was not empty, also add a concat string inbetween
+ *
+ *************************************************************************/
+
+void Contig::myappend(string & a, const string & b, const string & concatstring) const
+{
+  if(!b.empty() && b != a) {
+    if(!a.empty()) a+=concatstring;
+    a+=b;
+  }
+}
+
+
+/*************************************************************************
  *
+ * GenBank annotations are sometimes scattered across different identifiers
+ *  of a locus. Starting from a known locus, this function collects
+ *  all information for gene, function, ecnumber, product and note
+ * 
+ * Expects the list to be sorted
  *
  *************************************************************************/
 
-void Contig::getMappedBBStrainIDsFromMask(vector<int32> & strains, uint8 mask)
+void Contig::concatAllGBFInfoForLocus(const list<gbfsummary_t> & allGBfeatures, list<gbfsummary_t>::const_iterator gbelementI, const string & concatstring, string & gene, string & function, string & ecnumber, string & product, string & note) const
 {
-  strains.clear();
-  for(uint8 i=0; i<8; i++){
-    if(mask & 1) strains.push_back(i);
-    mask=mask>>1;
+  gene.clear();
+  function.clear();
+  ecnumber.clear();
+  product.clear();
+  note.clear();
+
+  if(gbelementI == allGBfeatures.end()) return;
+
+//  list<gbfsummary_t>::const_iterator gbfsI=gbelementI;
+//  // search first element with that locus
+//  while (gbfsI != allGBfeatures.begin() && gbfsI->locustag == gbelementI->locustag) gbfsI--;
+//  gbfsI++;
+//
+//  for(; gbfsI != allGBfeatures.end() && gbfsI->locustag == gbelementI->locustag; gbfsI++){
+//    myappend(gene, gbfsI->gene, concatstring);
+//    myappend(function, gbfsI->function, concatstring);
+//    myappend(ecnumber, gbfsI->ecnumber, concatstring);
+//    myappend(product, gbfsI->product, concatstring);
+//    myappend(note, gbfsI->note, concatstring);
+//  }
+
+
+  list<gbfsummary_t>::const_iterator gbfsI=gbelementI;
+  // search first element with that locus
+  while (gbfsI != allGBfeatures.begin() && gbfsI->cfrom >= gbelementI->cfrom) gbfsI--;
+  gbfsI++;
+  list<gbfsummary_t>::const_iterator gbfsE=gbfsI;
+  while (gbfsE != allGBfeatures.end() && gbfsE->cfrom <= gbelementI->cto) gbfsE++;
+
+  for(; gbfsI != gbfsE; gbfsI++){
+    if(gbfsI->locustag == gbelementI->locustag
+      && gbfsI->cfrom == gbelementI->cfrom
+      && gbfsI->cto == gbelementI->cto) {
+      myappend(gene, gbfsI->gene, concatstring);
+      myappend(function, gbfsI->function, concatstring);
+      myappend(ecnumber, gbfsI->ecnumber, concatstring);
+      myappend(product, gbfsI->product, concatstring);
+      myappend(note, gbfsI->note, concatstring);
+    }
   }
+
   return;
 }
 
 
-
 /*************************************************************************
  *
  * Helper functions to iterate through the contig in forward direction
@@ -6705,209 +9525,114 @@ void Contig::getMappedBBStrainIDsFromMask(vector<int32> & strains, uint8 mask)
  *
  *************************************************************************/
 
-void Contig::rcci_t::init(const vector<int32> * allowedstrainidsptr, const vector<uint8> * allowedreadtypesptr, bool takerails, bool takebackbones, bool takereadswithoutreadpool)
+void Contig::readColContigIteratorInit(rcci_t & rcci, const vector<int32> & allowedstrainids, const vector<uint8> & allowedreadtypes, bool takerails, bool takebackbones, bool takereadswithoutreadpool)
 {
-  FUNCSTART("void Contig::rcci_t::init(const vector<int32> * allowedstrainidsptr, const vector<uint8> * allowedreadtypesptr, bool takerails, bool takebackbones, bool takereadswithoutreadpool)");
+  FUNCSTART("void Contig::readColContigIteratorInit(rcci_t & rcci, const vector<int32> & allowedstrainids, const vector<uint8> & allowedreadtypes, bool takerails, bool takebackbones, bool takereadswithoutreadpool)");
+
+  rcci.actcontigpos=0;
+  rcci.allowedstrainids=allowedstrainids;
+  rcci.allowedreadtypes=allowedreadtypes;
+  rcci.takerails=takerails;
+  rcci.takebackbones=takebackbones;
+  rcci.takereadswithoutreadpool=takereadswithoutreadpool;
 
-  RCCI_actcontigpos=0;
-  RCCI_allowedstrainids.clear();
-  RCCI_allowedreadtypes.clear();
-  if(allowedstrainidsptr != nullptr) RCCI_allowedstrainids=*allowedstrainidsptr;
-  if(allowedreadtypesptr != nullptr) RCCI_allowedreadtypes=*allowedreadtypesptr;
-  RCCI_takerails=takerails;
-  RCCI_takebackbones=takebackbones;
-  RCCI_takereadswithoutreadpool=takereadswithoutreadpool;
+  // Finalising the contig initialises the output order structure vector
+  finalise();
 
   // a vector (read_ids_in_col) keeps the ids of the reads that are
   //  covering a specific position of the contig
   // reserving 1000 position should be enough for 99.9% of all cases,
   //  but is automatically extended by STL if needed.
-  RCCI_pcrIs_in_col.clear();
-  RCCI_pcrIs_in_col.reserve(1000);
-  RCCI_newPCRIsonlastupdate=RCCI_pcrIs_in_col.end();
+  rcci.read_ids_in_col.clear();
+  rcci.read_ids_in_col.reserve(1000);
 
-  RCCI_mpcrI = RCCI_contig->CON_reads.begin();
+  rcci.outorderI = CON_outputorder.begin();
 
-  update();
+  readColContigIteratorUpdate(rcci);
 
   FUNCEND();
 }
 
-void Contig::rcci_t::update()
+void Contig::readColContigIteratorUpdate(rcci_t & rcci)
 {
   FUNCSTART("void Contig::readColContigIteratorUpdate(rcci_t & rcci)");
 
-  CEBUG("rccit pos " << RCCI_actcontigpos << endl);
-
-  // update the vector that
+  // update the vector that 
   //  keeps track of the reads that are
   //  covering a specific position of the contig
   // works quite simple: reads in the vector that are ending get
   //  thrown out, new reads starting are entered.
 
   // first delete those who fall out at this new position
-  auto Ifrom=RCCI_pcrIs_in_col.begin();
-  auto Ito=Ifrom;
-  for(;Ifrom != RCCI_pcrIs_in_col.end(); ++Ifrom){
+  vector<int32>::iterator Ifrom=rcci.read_ids_in_col.begin();
+  vector<int32>::iterator Ito=Ifrom;
+  for(;Ifrom != rcci.read_ids_in_col.end(); Ifrom++){
     *Ito=*Ifrom;
-    if((*Ifrom).getReadStartOffset() + (*Ifrom)->getLenClippedSeq() > RCCI_actcontigpos) {
-      ++Ito;
-    }else{
-      CEBUG("rccit upd thrown out " << *Ito << endl);
+    if(CON_reads[*Ifrom].offset+CON_reads[*Ifrom].read.getLenClippedSeq() > rcci.actcontigpos) {
+      Ito++;
     }
   }
   if(Ito != Ifrom) {
-    RCCI_pcrIs_in_col.resize(Ito-RCCI_pcrIs_in_col.begin(),
-			     RCCI_contig->CON_reads.end());      /* the resize() will always reduce the vector,
-								    but the template needs a default value anyway */
-
+    rcci.read_ids_in_col.resize(Ito-rcci.read_ids_in_col.begin());
   }
-
-  auto oldnumel=RCCI_pcrIs_in_col.size();
+  
   // now insert ids of reads that have newly started at this position
   // Don't take railreads or backbones on demand
-  for(;RCCI_mpcrI != RCCI_contig->CON_reads.end() && RCCI_mpcrI.getReadStartOffset() == RCCI_actcontigpos; ++RCCI_mpcrI){
+  for(;rcci.outorderI != CON_outputorder.end() && (rcci.outorderI)->offset_start == static_cast<int32>(rcci.actcontigpos); (rcci.outorderI)++){
     bool takeit=true;
-    if(RCCI_mpcrI->isRail()){
-      if(!RCCI_takerails) takeit=false;
-    }else if(RCCI_mpcrI->isBackbone()){
-      if(!RCCI_takebackbones) takeit=false;
-    }else if(!RCCI_allowedstrainids.empty()){
+    if(CON_reads[(rcci.outorderI)->original_index].read.isRail()){ 
+      if(!rcci.takerails) takeit=false;
+    }else if(CON_reads[(rcci.outorderI)->original_index].read.isBackbone()){
+      if(!rcci.takebackbones) takeit=false;
+    }else if(!rcci.allowedstrainids.empty()){
       takeit=false;
-      for(auto asie : RCCI_allowedstrainids){
-	if(RCCI_mpcrI->getStrainID() == asie){
+      vector<int32>::const_iterator I=rcci.allowedstrainids.begin();
+      for(;I!=rcci.allowedstrainids.end(); I++){
+	if(CON_reads[(rcci.outorderI)->original_index].read.getStrainID() == *I){
 	  takeit=true;
 	  break;
 	}
       }
-    }else if(!RCCI_allowedreadtypes.empty()){
+    }else if(!rcci.allowedreadtypes.empty()){
       takeit=false;
-      for(auto arte : RCCI_allowedreadtypes){
-	if(RCCI_mpcrI->getSequencingType() == arte){
+      vector<uint8>::const_iterator I=rcci.allowedreadtypes.begin();
+      for(;I!=rcci.allowedreadtypes.end(); I++){
+	if(CON_reads[(rcci.outorderI)->original_index].read.getSequencingType() == *I){
 	  takeit=true;
 	  break;
 	}
       }
     }
     if(takeit){
-      RCCI_pcrIs_in_col.push_back(RCCI_mpcrI);
-      CEBUG("rccit upd taken " << *Ito << endl);
-    }
-  }
-
-  // compute the iterator to the newly inserted elements
-  RCCI_newPCRIsonlastupdate=RCCI_pcrIs_in_col.begin();
-  std::advance(RCCI_newPCRIsonlastupdate,oldnumel);
-
-  FUNCEND();
-  return;
-}
-
-
-
-
-/*************************************************************************
- *
- * ercci is like a rcci, but instead of holding only the read ids of
- *  allowed strains & sequencing types, it holds all read ids
- *  differentiated per sequencing type per strain
- *
- *************************************************************************/
-
-void Contig::ercci_t::init(bool takerails, bool takebackbones, uint32 numstrains)
-{
-  FUNCSTART("void Contig::ercci_t::init(bool takerails, bool takebackbones, uint32 numstrains)");
-
-  BUGIFTHROW(numstrains==0,"numstrains==0???");
-
-  ERCCI_actcontigpos=0;
-  ERCCI_takebackbones=takebackbones;
-  ERCCI_takerails=takerails;
-  ERCCI_mpcrI = ERCCI_contig->CON_reads.begin();
-
-  // per sequencing type and per strain ids,
-  //  a vector keeps the ids of the reads that are
-  //  covering a specific position of the contig
-  // reserving 1000 position should be enough 99.9% of all cases,
-  //  is automatically extended by STL if needed.
-
-  ERCCI_pcrI_st_st.clear();
-  ERCCI_pcrI_st_st.resize(ReadGroupLib::getNumSequencingTypes());
-  for(uint32 seqtype=0; seqtype<ReadGroupLib::getNumSequencingTypes(); seqtype++){
-    ERCCI_pcrI_st_st[seqtype].resize(numstrains);
-    for(uint32 strainid=0; strainid<numstrains; ++strainid){
-      ERCCI_pcrI_st_st[seqtype][strainid].clear();
-      ERCCI_pcrI_st_st[seqtype][strainid].reserve(1000);
-    }
-  }
-
-  update();
-
-  FUNCEND();
-  return;
-}
-
-void Contig::ercci_t::update()
-{
-  FUNCSTART("void Contig::ercci_t::update()");
-
-  // update the vector that
-  //  keeps track of the reads that are
-  //  covering a specific position of the contig
-  // works quite simple: reads in the vector that are ending get
-  //  thrown out, new reads starting are entered.
-
-  // first delete those who fall out at this new position
-
-  CEBUG("rccite pos " << ERCCI_actcontigpos << endl);
-
-  for(uint32 seqtype=0; seqtype<ReadGroupLib::getNumSequencingTypes(); ++seqtype){
-    for(uint32 strainid=0; strainid<ERCCI_pcrI_st_st[seqtype].size(); ++strainid){
-      auto Ifrom=ERCCI_pcrI_st_st[seqtype][strainid].begin();
-      auto Ito=Ifrom;
-      for(;Ifrom != ERCCI_pcrI_st_st[seqtype][strainid].end(); ++Ifrom){
-	*Ito=*Ifrom;
-	if((*Ifrom).getReadStartOffset()+(*Ifrom)->getLenClippedSeq() > ERCCI_actcontigpos) {
-	  ++Ito;
-	}else{
-	  CEBUG("rccite upd thrown out " << *Ito << endl);
-	}
-      }
-      if(Ito != Ifrom) {
-	ERCCI_pcrI_st_st[seqtype][strainid].resize(Ito-ERCCI_pcrI_st_st[seqtype][strainid].begin(),
-						   ERCCI_contig->CON_reads.end());    /* the resize() will always reduce the vector,
-											 but the template needs a default value anyway */
-      }
+      rcci.read_ids_in_col.push_back((rcci.outorderI)->original_index);
     }
   }
 
-  // add in the ones which are arriving anew
-  for(;ERCCI_mpcrI != ERCCI_contig->CON_reads.end() && ERCCI_mpcrI.getReadStartOffset() == ERCCI_actcontigpos; ++ERCCI_mpcrI){
-    if(ERCCI_mpcrI->isRail() && !ERCCI_takerails) continue;
-    if(ERCCI_mpcrI->isBackbone() && !ERCCI_takebackbones) continue;
-    uint32 seqtype=ERCCI_mpcrI->getSequencingType();
-    uint32 strainid=static_cast<uint32>(ERCCI_mpcrI->getStrainID());
-    // better safe than sorry: the following two BUGIFTHROW should not trigger, never ever at all
-    //  but due to an upstream error with strain ids ... this seg fault took two freaking weeks to pin down :-(((((((((
-    BUGIFTHROW(seqtype>=ERCCI_pcrI_st_st.size(),"seqtype " << seqtype << " >=ERCCI_pcrI_st_st.size() " << ERCCI_pcrI_st_st.size() << " ???");
-    BUGIFTHROW(strainid>=ERCCI_pcrI_st_st[seqtype].size(),"strainid " << strainid << " >=ERCCI_pcrI_st_st[seqtype].size() " << ERCCI_pcrI_st_st[seqtype].size() << " ???");
-    ERCCI_pcrI_st_st[seqtype][strainid].push_back(ERCCI_mpcrI);
-    CEBUG("rccite upd taken " << ERCCI_mpcrI << endl);
-  }
-
   FUNCEND();
   return;
 }
 
-
-void Contig::ercci_t::advance()
+void Contig::readColContigIteratorAdvance(rcci_t & rcci)
 {
-  ++ERCCI_actcontigpos;
-  update();
+  rcci.actcontigpos++;
+  readColContigIteratorUpdate(rcci);
 }
 
 
-
+///*************************************************************************
+// *
+// * Simply go through all reads and delet tags with specified tagid
+// *
+// *
+// *************************************************************************/
+//
+//void Contig::deleteTagsInReads(const string & identifier)
+//{
+//  for(uint32 i=0; i<CON_reads.size(); i++){
+//    CON_reads[i].read.deleteTag(identifier);
+//  }
+//  return;
+//}
 
 
 /*************************************************************************
@@ -6919,10 +9644,9 @@ void Contig::ercci_t::advance()
 
 void Contig::deleteTagsInReads(const multitag_t::mte_id_t identifier)
 {
-  for(auto & pcre : CON_reads){
-    const_cast<Read &>(pcre).deleteTag(identifier);
+  for(uint32 i=0; i<CON_reads.size(); i++){
+    CON_reads[i].read.deleteTag(identifier);
   }
-
   return;
 }
 
@@ -6936,73 +9660,59 @@ void Contig::deleteTagsInReads(const multitag_t::mte_id_t identifier)
 
 void Contig::setupAsBackBoneContig()
 {
-  FUNCSTART("void Contig::setupAsBackBoneContig()");
-
   // first, trash all consensus caches so that MIRA uses newly computed consensus
   //  sequences later on. Especially important when working with several strains
   trashConsensusCache(false);
 
-  vector<bool> readgroupspresent(ReadGroupLib::getNumReadGroups(),false);
-  vector<bool> bbreadgroupspresent(readgroupspresent);
-  unordered_set<string> strainnamesinbb;
+  const string & strainname=(*CON_miraparams)[0].getAssemblyParams().as_backbone_strainname;
 
-  CON_isbackbonecontig=true;
+  vector<Contig::contigread_t>::iterator J=CON_reads.begin();
+  for(; J!=CON_reads.end(); ++J){
+    if(J->orpid==-1) continue;
+    
+    CON_readpool->getRead(J->orpid).setBackbone(true);
+    J->read.setBackbone(true);
 
-  for(auto pcrI=CON_reads.begin(); pcrI!=CON_reads.end(); ++pcrI){
-    if(pcrI.getORPID()==-1
-       || CON_readpool->getRead(pcrI.getORPID()).isRail()
-       || CON_readpool->getRead(pcrI.getORPID()).isCoverageEquivalentRead()) continue;
-    readgroupspresent[static_cast<uint32>(CON_readpool->getRead(pcrI.getORPID()).getReadGroupID().getLibId())]=true;
-    readgroupspresent[static_cast<uint32>(pcrI->getReadGroupID().getLibId())]=true;
-
-    if(!pcrI->getStrainName().empty()){
-      strainnamesinbb.insert(pcrI->getStrainName());
+    //Read::setCoutType(Read::AS_TEXTSHORT);
+    //cout << AS_readpool.getRead(J->orpid);
+    
+    if((*CON_miraparams)[0].getAssemblyParams().as_backbone_strainname_forceforall
+       || CON_readpool->getRead(J->orpid).getStrain().empty()){
+      CON_readpool->getRead(J->orpid).setStrain(strainname.c_str());
+      J->read.setStrain(strainname.c_str());
     }
   }
 
-  if(strainnamesinbb.empty()){
-    MIRANOTIFY(Notify::FATAL,"Contig " << getContigName() << " has no strainnames given it its data. Not good, make sure one is present (try putting 'strainname=' in manifest file).");
-  }
-
-  for(auto & sne : strainnamesinbb){
-    cout << "Contig " << getContigName() << " has strain " << sne << endl;
-  }
-
-//  if(strainnamesinbb.size()>1){
-//    MIRANOTIFY(Notify::FATAL,"Contig " << getContigName() << " has " << strainnamesinbb.size() << " strainnames. Not good, make sure only one is present (put 'strainname=' in manifest file).");
-//  }
 
-  const string & strainname=*strainnamesinbb.begin();
+  // setup quick lookup for -CO:msrkceu (keep contig ends unmerged)
+  int32 leftestoff=0xffffffff;
+  int32 rightestoff=-1;
 
-  for(auto pcrI=CON_reads.begin(); pcrI!=CON_reads.end(); ++pcrI){
-    if(pcrI.getORPID()==-1
-       || CON_readpool->getRead(pcrI.getORPID()).isRail()
-       || CON_readpool->getRead(pcrI.getORPID()).isCoverageEquivalentRead()) continue;
-    CON_readpool->getRead(pcrI.getORPID()).getReadGroupID().setBackbone(true);
-    pcrI->getReadGroupID().setBackbone(true);
+  CON_index_leftestbbread=0;
+  CON_index_rightestbbread=0;
 
-    if(pcrI->getStrainName().empty()){
-      CON_readpool->getRead(pcrI.getORPID()).getReadGroupID().setStrainName(strainname);
-      pcrI->getReadGroupID().setStrainName(strainname);
+  J=CON_reads.begin();
+  for(uint32 ri=0; J!=CON_reads.end(); ++J, ++ri){
+    if(J->offset + J->read.getLenClippedSeq() > rightestoff) {
+      rightestoff=J->offset + J->read.getLenClippedSeq();
+      CON_index_rightestbbread=ri;
+    }
+    if(J->offset < leftestoff) {
+      leftestoff=J->offset;
+      CON_index_leftestbbread=ri;
     }
   }
 
 
-  // setup quick lookup for -CO:msrkceu (keep contig ends unmerged)
-  CON_mpindex_msrkceu_left=CON_markerpositions.size();
-  CON_markerpositions.push_back(0);
-  CON_mpindex_msrkceu_right=CON_markerpositions.size();
-  CON_markerpositions.push_back(getContigLength());
-
-
-  // setup data for areas in genome where we want to force merge
+  // setup data for areas in genome were we want to force merge
   // how memory-inefficient having it done by buildMaskShadow()
   //  instead of writing directly to CON_counts
   // but I don't care atm
   CON_hasforcemergeareas=false;
   {
-    for(auto & cce : CON_counts){
-      cce.forcemergearea=0;
+    cccontainer_t::iterator ccI=CON_counts.begin();
+    for(; ccI != CON_counts.end(); ++ccI){
+      ccI->forcemergearea=0;
     }
 
     vector<int8> maskshadow;
@@ -7010,8 +9720,9 @@ void Contig::setupAsBackBoneContig()
     masktagstrings.push_back(Read::REA_tagentry_idMFSM);
 
     buildMaskShadow(maskshadow,masktagstrings,true);
-    auto mI=maskshadow.cbegin();
-    for(auto ccI=CON_counts.begin(); ccI != CON_counts.end(); ++mI, ++ccI){
+    ccI=CON_counts.begin();
+    vector<int8>::const_iterator mI=maskshadow.begin();
+    for(; ccI != CON_counts.end(); ++ccI, ++mI){
       ccI->forcemergearea=*mI;
       CON_hasforcemergeareas|=*mI;
     }
@@ -7021,165 +9732,27 @@ void Contig::setupAsBackBoneContig()
 }
 
 
+
 /*************************************************************************
  *
  *
  *
- *
  *************************************************************************/
-void Contig::errorstatus_t::dumpStatus(bool longmsg, const char * additionalmsg)
+
+void Contig::blindContig()
 {
-  FUNCSTART("void Contig::errorstatus_t::dumpStatus(const char * additionalmsg)");
+  FUNCSTART("void Contig::blindContig()");
 
-  if(additionalmsg != nullptr) cout << additionalmsg;
+  definalise();
 
-  switch(code) {
-  case Contig::ENOERROR : {
-    if(longmsg){
-      cout << "\t+\n";
-    }else{
-      cout << '+';
-    }
-    break;
-  }
-  case Contig::ENOTCALLED : {
-    if(longmsg){
-      cout << "\t-\tnot called\n";
-    }else{
-      cout << '*';
-    }
-    break;
-  }
-  case Contig::ENOALIGN : {
-    if(longmsg){
-      cout << "\t-\tno align found\n";
-    }else{
-      cout << 'a';
-    }
-    break;
-  }
-  case Contig::EDROPINRELSCORE : {
-    if(longmsg){
-      cout << "\t-\tdrop in relscore too high\n";
-    }else{
-      cout << 'd';
-    }
-    break;
-  }
-  case Contig::EALIGNREJECTMRS : {
-    if(longmsg){
-      cout << "\t-\talign rejected by mrs\n";
-    }else{
-      cout << 'A';
-    }
-    break;
-  }
-  case Contig::ETEMPLATEDIRECTION : {
-    if(longmsg){
-      cout << "\t-\ttemplate in wrong direction\n";
-    }else{
-      cout << 'T';
-    }
-    break;
-  }
-  case Contig::ESEGMENTPLACEMENT : {
-    if(longmsg){
-      cout << "\t-\tplacement of segment wrong\n";
-    }else{
-      cout << 'P';
-    }
-    break;
-  }
-  case Contig::ETEMPLATESIZELT : {
-    if(longmsg){
-      cout << "\t-\tmismatch in template size (<)\n";
-    }else{
-      cout << '<';
-    }
-    break;
-  }
-  case Contig::ETEMPLATESIZEGT : {
-    if(longmsg){
-      cout << "\t-\tmismatch in template size (>)\n";
-    }else{
-      cout << '>';
-    }
-    break;
-  }
-  case Contig::ESRMBMISMATCH : {
-    if(longmsg){
-      cout << "\t-\tmismatch in SRMB zone\n";
-    }else{
-      cout << 'R';
-    }
-    break;
-  }
-  case Contig::ESPECIALSRADDFAIL : {
-    if(longmsg){
-      cout << "\t-\tfailed special SR add rules\n";
-    }else{
-      cout << 'c';
-    }
-    break;
-  }
-  case Contig::EREFIDNOTALLOWED : {
-    if(longmsg){
-      cout << "\t-\trefid not allowed\n";
-    }else{
-      cout << 'r';
-    }
-    break;
-  }
-  case Contig::EMAXCOVERAGEREACHED : {
-    if(longmsg){
-      cout << "\t-\tmaxcoverage reached\n";
-    }else{
-      cout << 'x';
-    }
-    break;
-  }
-  case Contig::EDANGERZONE : {
-    if(longmsg){
-      cout << "\t-\ttoo many mismatches in danger zone(s)\n";
-    }else{
-      cout << 'z';
-    }
-    break;
-  }
-  case Contig::EFORCEDGROWTHNOTREACHED : {
-    if(longmsg){
-      cout << "\t-\tforced growth not reached\n";
-    }else{
-      cout << 'g';
-    }
-    break;
-  }
-  case Contig::EGROWTHNOTALLOWED : {
-    if(longmsg){
-      cout << "\t-\tgrowth not allowed\n";
-    }else{
-      cout << 'G';
-    }
-    break;
-  }
-  case Contig::ERELEGATEDBYPP : { // actually set by pathfinder
-    if(longmsg){
-      cout << "\t-\trelegated\n";
-    }else{
-      cout << '\\';
-    }
-    break;
-  }
-  case Contig::EUNSPECIFIED : {
-    if(longmsg){
-      cout << "\t-\tunspecified reject\n";
+  vector<contigread_t>::iterator cI=CON_reads.begin();
+  for(; cI != CON_reads.end(); ++cI){
+    if(cI->direction>0){
+      cI->read.blindSeqData('c');
     }else{
-      cout << '?';
+      cI->read.blindSeqData('g');
     }
-    break;
-  }
-  default : {
-    MIRANOTIFY(Notify::INTERNAL, "Unknown errorcode from the contig object.");
-  }
   }
+
+  FUNCEND();
 }
diff --git a/src/mira/contig.H b/src/mira/contig.H
index dcbc3c9..2a980df 100644
--- a/src/mira/contig.H
+++ b/src/mira/contig.H
@@ -11,70 +11,80 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
+// 	$Id$	
+
 
 #ifndef _mira_contig_h_
 #define _mira_contig_h_
 
+#include <assert.h>
+
+#include <strings.h>
+
 #include <iostream>
 #include <iomanip>
-
 #include <string>
-#include <unordered_set>
 
 #include "stdinc/stlincludes.H"
 
 #include "stdinc/defines.H"
+#include "errorhandling/errorhandling.H"
+
+// for checking time restrictions
+#include <time.h>
+#include "mira/timerestrict.H"
+
+//#include "mira/indexed_deque.H"
+#include "mira/parameters.H"
+#include "mira/readpool.H"
+#include "mira/align.H"
+#include "mira/ads.H"
+#include "io/exp.H"
+#include "io/gbf.H"
+
+#include "util/dptools.H"
+
 
-#include "mira/hdeque.H"
-#include "mira/pcrcontainer.H"
-#include "mira/readseqtypes.H"
 
-class Align;
-class AlignedDualSeq;
-class AlignedDualSeqFacts;
-class MIRAParameters;
-class ReadPool;
-class SAMCollect;
 
 
 // structure used to give back information on GenBank tags in the contig
 struct gbfsummary_t {
-  PlacedContigReads::const_iterator pcrI;          // pcrI of read with this feature
-
   uint32 cfrom;              // position of feature in contig
   uint32 cto;
+  int32  readindex;          // index of read with this feature in CON_reads
 
   int32  strainid;
-  std::string identifier;  // TODO: switch that to multitag_t::mte_id_t ??
-  std::string locustag;
-  std::string gene;
-  std::string function;
-  std::string ecnumber;
-  std::string product;
-  std::string note;
+  string identifier;  // TODO: switch that to multitag_t::mte_id_t ??
+  string locustag;
+  string gene;
+  string function;
+  string ecnumber;
+  string product;
+  string note;
   int8   translationtable;
   int8   codonstart;
   int8   direction;
   bool   mustbetranslated;
   bool   isgene;             // Fgen, FCDS or one of the main RNAs
 
-  friend std::ostream & operator<<(std::ostream &ostr, const gbfsummary_t & gbfs){
+  friend ostream & operator<<(ostream &ostr, const gbfsummary_t & gbfs){
     ostr << "cfrom: " << gbfs.cfrom
 	 << "\ncto: " << gbfs.cto
-	 << "\npcrI: " << gbfs.pcrI
+	 << "\nreadindex: " << gbfs.readindex
 	 << "\nstrainid: " << gbfs.strainid
 	 << "\nidentifier: " << gbfs.identifier
 	 << "\nlocustag: " << gbfs.locustag
@@ -87,72 +97,24 @@ struct gbfsummary_t {
 	 << "\ncodonstart: " << static_cast<uint16>(gbfs.codonstart)
 	 << "\ndirection: " << static_cast<uint16>(gbfs.direction)
 	 << "\nmustbetranslated: " << gbfs.mustbetranslated
-	 << "\nisgene: " << gbfs.isgene << std::endl;
+	 << "\nisgene: " << gbfs.isgene << endl;
     return ostr;
   }
-
-  gbfsummary_t(PlacedContigReads::const_iterator & pcrIp) : pcrI(pcrIp), cfrom(-1), cto(-1), strainid(-1),translationtable(11),codonstart(1),direction(0),mustbetranslated(false),isgene(false) {};
-};
-
-
-// structure used to give back information on SequenceOntology tags in the contig
-struct contigSOtag_t {
-  multitag_t multitag;                // positions are now contig positions!!!
-  int32  readindex;          // index of read with this feature in CON_reads
-
-  friend std::ostream & operator<<(std::ostream &ostr, const contigSOtag_t & csot){
-    ostr << "mt: " << csot.multitag
-	 << "readindex: " << csot.readindex << std::endl;
-    return ostr;
-  }
-};
-
-
-struct coverageinfo_t {
-  uint64  min;
-  uint64  max;
-  double  mean;
-  double  median;
-  double  stddev;
-
-  coverageinfo_t() {clear();}
-  void clear() {min=0xffffffffffffffff; max=0; mean=0; median=0; stddev=0;}
-
-  friend std::ostream & operator<<(std::ostream &ostr, const coverageinfo_t & ci){
-    ostr << "CINFO: " << ci.min << '\t' << ci.max
-	 << '\t' << ci.mean
-	 << '\t' << ci.median
-	 << '\t' << ci.stddev
-	 << std::endl;
-    return ostr;
-  }
-};
-
-struct tagcoverageinfo_t {
-  contigSOtag_t  csot;
-  coverageinfo_t ccinfo;
-
-  std::string comparator_text;
-  double comparator_factor;
 };
 
 
 class Contig
 {
 public:
-  enum{AS_TEXT=0, AS_HTML, AS_CAF, AS_MAF, AS_ACE, AS_FASTA, AS_FASTAQUAL,
+  enum{AS_TEXT=0, AS_HTML, AS_CAF, AS_MAF, AS_SAM, AS_ACE, AS_FASTA, AS_FASTAQUAL, 
 	 AS_FASTAPADDED, AS_FASTAPADDEDQUAL, AS_GAP4DA, AS_TCS,
 	 AS_DEBUG};
 
-  enum addreadcode{ENOERROR=0,
-		   ENOTCALLED,
+  enum addreadcode{ENOERROR=0, 
 		   ENOALIGN,
-		   EALIGNREJECTMRS,
 		   EDROPINRELSCORE,
 		   ETEMPLATEDIRECTION,
-		   ETEMPLATESIZELT,
-		   ETEMPLATESIZEGT,
-		   ESEGMENTPLACEMENT,
+		   ETEMPLATESIZE,
 		   ESRMBMISMATCH,
 		   EDANGERZONE,
 		   ESPECIALSRADDFAIL,
@@ -160,7 +122,6 @@ public:
 		   EMAXCOVERAGEREACHED,
 		   EFORCEDGROWTHNOTREACHED,
 		   EGROWTHNOTALLOWED,
-		   ERELEGATEDBYPP,     // code actually set by pathfinder
 		   EUNSPECIFIED
   };
 
@@ -175,13 +136,92 @@ public:
     int32 read_rclip;
     int32 direction;
   };
+  
+  
+  
+  
+  struct contigread_t{
+    int32 orpid;              /* id of the original read in the readpool
+				 can be < 0, then this means it is not
+				 in the readpool.
+				 At the moment this happens for coverage
+				 mapping of short read */
+    int32 offset;             // offset of good, clipped part in the read
+    int32 direction;          // >0 forward, <0 complement
+    Read  read;               /* read (might be modified and not be quite the
+				 same as in the readpool) */
+
+  friend ostream & operator<<(ostream &ostr, const contigread_t & cr){
+    ostr << "CR: " << cr.orpid << "\t" << cr.offset << "\t" << cr.direction << "\t" << cr.read.getName() << endl;
+    return ostr;
+  }
 
+//  ******************************************************************        
+//  contigPosToUnclippedReadPos
+//  We have a contig position and we want to know which position in the
+//  UNCLIPPED FORWARD read corresponds to the contig position
+//
+//  ******************************************************************        
+
+    inline int32 contigPos2UnclippedReadPos(const int32 contigpos) const
+      {
+	if (direction > 0) {
+	  return contigpos - offset + read.getLeftClipoff();
+	} else {
+	  // FALSCH return ric.offset + ric.read.getRightClipoff() -1 - contigpos;
+	  return read.getLenSeq() - read.getRightClipoff() + contigpos - offset;
+	}
+      };
+
+    inline int32 contigPos2RawReadPos(const int32 contigpos) const
+      {
+	if (direction > 0) {
+	  return contigPos2UnclippedReadPos(contigpos);
+	} else {
+	  return read.calcComplPos(contigPos2UnclippedReadPos(contigpos));
+	}
+      };
+
+
+// *******************************************************************
+//  unclippedReadPosToContigPos
+//  We have a position in an UNCLIPPED read and we want to know the corresponding
+//  position in the contig
+//
+//  ******************************************************************        
+//weiter damit
+    inline int32 unclippedReadPos2ContigPos(const int32 readpos) const
+      {
+	if (direction > 0) {
+	  return readpos - read.getLeftClipoff() + offset ;
+	} else {
+	  return read.getRightClipoff()-readpos+offset -1 ;
+	}
+      }
+    inline char getBase(const int32 contigpos) const
+      {
+	if(direction>0){
+	  return read.getBaseInSequence(contigPos2UnclippedReadPos(contigpos));
+	}else{
+	  return read.getBaseInComplementSequence(contigPos2UnclippedReadPos(contigpos));
+	}
+      }
+    inline base_quality_t getQuality(const int32 contigpos) const
+      {
+	if(direction>0){
+	  return read.getQualityInSequence(contigPos2UnclippedReadPos(contigpos));
+	}else{
+	  return read.getQualityInComplementSequence(contigPos2UnclippedReadPos(contigpos));
+	}
+      }
 
+  };
+  
 
 // we can currently merge 2 seqtypes: SOlexa, SOLiD
 // SOLiD currently not used
 #define NUMMERGESEQTYPES 2
-
+  
   typedef uint32 ccctype_t;  // consensus_counts_count_type
 
   struct consensus_counts_t{
@@ -189,32 +229,32 @@ public:
     ccctype_t C;             // ccctype_t is enough for a coverage of 16k reads.
     ccctype_t G;
     ccctype_t T;
-
+    
     ccctype_t N;             // N, X, star and coverage are normal counters.
     ccctype_t X;
     ccctype_t star;
-
-    ccctype_t seqtype_cov[ReadGroupLib::SEQTYPE_END];  /* for each seqtype, count the
+    
+    ccctype_t seqtype_cov[Read::SEQTYPE_END];  /* for each seqtype, count the
 					     * coverage at this position. This
 					     * number also includes the 100%
 					     * mapped reads!
 					     */
     ccctype_t total_cov;
-
+    
     uint16 baselock;     // if > 0 then only one of A, C, T, G may be set, otherwise it's a misassembly
-
+    
     uint16 snplock;
 
     // New for Short read mappings, but will also be used for normal
     //  backbone mappings
-    //
+    // 
 
     uint8 forcemergearea;  /* if >0, short reads falling in this area will always
 			      be merged, even if not mapping at 100% */
-
+    
 
     // Currently, these MUST be at the end of this struct:
-    //  MIRA depends on it by using CON_concounts_zero and
+    //  MIRA depends on it by using CON_concounts_zero and 
     //  CON_concounts_zero_nobb to initialise quickly or rebuilding
     //  a consensus
     ccctype_t bbcounts[NUMMERGESEQTYPES];    /* coverage of reads supporting 100%
@@ -228,29 +268,13 @@ public:
 					    at this pos max. 8 strains
 					    possible. Strains are in 76543210
 					    order */
-    char   i_backbonecharorig;  /* original backbone consensus character (uppercase)
-				   gaps are *, positions not initially covered by backbone
-				   '@' */
-    char   i_backbonecharupdated;  /* updated backbone consensus character (uppercase)
-				      if '@', take i_backbonecharorig, else this */
-    base_quality_t  i_backbonequalorig;  /* original backbone consensus qual */
-    // need updated???
-
-
-    inline char getBBChar() const {
-      if(i_backbonecharupdated!='@') return i_backbonecharupdated;
-      return i_backbonecharorig;
-    }
-    inline char getOriginalBBChar() const {
-      return i_backbonecharorig;
-    }
-    inline base_quality_t getOriginalBBQual() const {
-      return i_backbonequalorig;
-    }
+    char   backbonechar;  /* original backbone consensus character (uppercase)
+			     gaps are *, positions not initially covered by backbone
+			     '@' */
 
     // that's more for debugging
-    friend std::ostream & operator<<(std::ostream &ostr, const consensus_counts_t & cc){
-      std::cout << "A: " << cc.A
+    friend ostream & operator<<(ostream &ostr, const consensus_counts_t & cc){
+      cout << "A: " << cc.A
 	   << "\tC: " << cc.C
 	   << "\tG: " << cc.G
 	   << "\tT: " << cc.T
@@ -261,19 +285,16 @@ public:
 	   << "\tblock: " << cc.baselock
 	   << "\tslock: " << cc.snplock
 	//<< "\n  arr"
-	   << "\tbbco: " << cc.i_backbonecharorig
-	   << "\tbbcu: " << cc.i_backbonecharupdated
-#if CPP_READ_SEQTYPE_END != 8
-#error "This code is made for 8 sequencing types, adapt!"
+	   << "\tbbc: " << cc.backbonechar
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
 #endif
-	   << "\tcSAN: " << cc.seqtype_cov[ReadGroupLib::SEQTYPE_SANGER]
-	   << "\tc454: " << cc.seqtype_cov[ReadGroupLib::SEQTYPE_454GS20]
-	   << "\tcION: " << cc.seqtype_cov[ReadGroupLib::SEQTYPE_IONTORRENT]
-	   << "\tcPBH: " << cc.seqtype_cov[ReadGroupLib::SEQTYPE_PACBIOHQ]
-	   << "\tcPBL: " << cc.seqtype_cov[ReadGroupLib::SEQTYPE_PACBIOLQ]
-	   << "\tcTXT: " << cc.seqtype_cov[ReadGroupLib::SEQTYPE_TEXT]
-	   << "\tcSXA: " << cc.seqtype_cov[ReadGroupLib::SEQTYPE_SOLEXA]
-	   << "\tcSID: " << cc.seqtype_cov[ReadGroupLib::SEQTYPE_ABISOLID]
+	   << "\tcSAN: " << cc.seqtype_cov[Read::SEQTYPE_SANGER]
+	   << "\tc454: " << cc.seqtype_cov[Read::SEQTYPE_454GS20]
+	   << "\tcION: " << cc.seqtype_cov[Read::SEQTYPE_IONTORRENT]
+	   << "\tcPBS: " << cc.seqtype_cov[Read::SEQTYPE_PACBIO]
+	   << "\tcSXA: " << cc.seqtype_cov[Read::SEQTYPE_SOLEXA]
+	   << "\tcSID: " << cc.seqtype_cov[Read::SEQTYPE_ABISOLID]
 	   << "\tbcSXA: " << cc.bbcounts[0]
 	   << "\tbcSID: " << cc.bbcounts[1]
 	   << "\tbqSXA: " << static_cast<ccctype_t>(cc.bbbestquals[0])
@@ -287,133 +308,22 @@ public:
   // Contig exports the container with consensus_counts_t
   //  as type:  Contig::cccontainer_t
 
-  typedef HDeque<consensus_counts_t> cccontainer_t;
+  typedef deque<consensus_counts_t> cccontainer_t;
   //typedef IndexedDeque<consensus_counts_t> cccontainer_t;
 
 
-/*************************************************************************
- *
- * iterators through the reads of a contig per contig position
- *
- * Warning: after initialising the (e)rcci_t, never ever perform contig
- *  changing operations which change the number of reads or its length:
- *  this will invalidate the (e)rcci and lead to undefined behaviour!
- *
- *************************************************************************/
-
-public:
-  class rcci_t {
-    // ReadColContigIterator
-    //
-    // a vector (read_ids_in_col) keeps the ids of the CON_reads that are
-    //  covering a specific position of the contig
-    // reserving 1000 position should be enough 99.9% of all cases,
-    //  is automatically extended by STL if needed.
-
-    Contig * RCCI_contig;
-
-    // read pcrI per sequencing type per strain
-    std::vector<PlacedContigReads::const_iterator> RCCI_pcrIs_in_col;
-    // iteraor to the new PCRIs which appeared while calling
-    //  the last update().
-    // in conjunction with advance, works only if advance(n=...) has
-    //  n==1
-    std::vector<PlacedContigReads::const_iterator>::iterator RCCI_newPCRIsonlastupdate;
-
-    //std::vector<out_order_t>::const_iterator outorderI;
-    PlacedContigReads::const_iterator RCCI_mpcrI;
-    uint32 RCCI_actcontigpos;
-
-    std::vector<int32> RCCI_allowedstrainids;
-    std::vector<uint8> RCCI_allowedreadtypes;
-
-    bool RCCI_takerails;
-    bool RCCI_takebackbones;
-    bool RCCI_takereadswithoutreadpool;
-
-  public:
-    rcci_t(Contig * cptr) : RCCI_contig(cptr), RCCI_mpcrI(cptr->CON_reads.begin()) {init(nullptr,nullptr,true,true,true);}
-    rcci_t(Contig * cptr,
-	   const std::vector<int32> * allowedstrainids,
-	   const std::vector<uint8> * allowedsequencingtypes,
-	   bool takerails,
-	   bool takebackbones,
-	   bool takereadswithoutreadpool) : RCCI_contig(cptr), RCCI_mpcrI(cptr->CON_reads.begin()) {
-      init(allowedstrainids,allowedsequencingtypes,takerails,takebackbones,takereadswithoutreadpool);
-    }
-    rcci_t(Contig * cptr,
-	   const std::vector<int32> & allowedstrainids,
-	   const std::vector<uint8> & allowedsequencingtypes,
-	   bool takerails,
-	   bool takebackbones,
-	   bool takereadswithoutreadpool) : RCCI_contig(cptr), RCCI_mpcrI(cptr->CON_reads.begin()) {
-      init(&allowedstrainids,&allowedsequencingtypes,takerails,takebackbones,takereadswithoutreadpool);
-    }
-
-    void init(const std::vector<int32> * allowedstrainids,
-	      const std::vector<uint8> * allowedsequencingtypes,
-	      bool takerails,
-	      bool takebackbones,
-	      bool takereadswithoutreadpool);
-    void init(const std::vector<int32> & allowedstrainids,
-	      const std::vector<uint8> & allowedsequencingtypes,
-	      bool takerails,
-	      bool takebackbones,
-	      bool takereadswithoutreadpool) {
-      init(&allowedstrainids,&allowedsequencingtypes,takerails,takebackbones,takereadswithoutreadpool);
-    }
-    void update();
-    inline void advance(uint32 dist=1) {
-      for(auto disti=dist; disti>0; --disti){
-	++RCCI_actcontigpos;
-	update();
-      }
-      if(dist!=1) RCCI_newPCRIsonlastupdate=RCCI_pcrIs_in_col.end();
-    }
-
-    inline const std::vector<PlacedContigReads::const_iterator> & getPCRIsInCol() const { return RCCI_pcrIs_in_col;}
-    inline std::vector<PlacedContigReads::const_iterator>::iterator getItToNewPCRIs() const { return RCCI_newPCRIsonlastupdate;}
-    inline uint32 getContigPos() const { return RCCI_actcontigpos;}
-  };
-
-  class ercci_t {
-    // extendedReadColContigIterator
-    //
-    // per sequencing type and per strain ids,
-    //  a vector keeps the ids of the reads that are
-    //  covering a specific position of the contig
-    // reserving 1000 position should be enough 99.9% of all cases,
-    //  is automatically extended by STL if needed.
-
-    Contig * ERCCI_contig;
-
-    // read pcrI per sequencing type per strain
-    std::vector<std::vector<std::vector<PlacedContigReads::const_iterator> > > ERCCI_pcrI_st_st;
-
-    //std::vector<out_order_t>::const_iterator outorderI;
-    PlacedContigReads::const_iterator ERCCI_mpcrI;    // main pcrI
-    uint32 ERCCI_actcontigpos;
-
-    bool ERCCI_takerails;
-    bool ERCCI_takebackbones;
-
-  public:
-    ercci_t(Contig * cptr) : ERCCI_contig(cptr), ERCCI_mpcrI(cptr->CON_reads.begin()) {};
-
-    void init(bool takerails,
-	      bool takebackbones,
-	      uint32 numstrains);
-    void update();
-    void advance();
-
-    inline const std::vector<std::vector<std::vector<PlacedContigReads::const_iterator>>> & getPCRIstst() const { return ERCCI_pcrI_st_st;}
-    inline uint32 getContigPos() const { return ERCCI_actcontigpos;}
-  };
+// Structure used for temporarily sorting read (needed for the << operator)
+// also needed in other funcs for quick access to the contig 
+struct out_order_t {
+  int32 offset_start;
+  int32 original_index;
+  int32 orpid;
+};
 
 
 
 
-// we need an own tag type for the consensus as additional data must be
+// we need an own tag type for the consensus as additional data must be 
 //  stored
 // lets use simple inheritance for that (first time for MIRA where
 //  it is useful :-)
@@ -423,170 +333,107 @@ public:
 //  due to the copy operator for "upgrading" normal tags
 // Lazy: no good constructors/destructors
 // Contrary to the groups_t struct (farther below), only bases
-//  which form a valid group have their counts / quality set >0 here.
+//  which form a valid group have their quality set >0 here.
 
   class consensustag_t: public multitag_t {
   public:
     bool additionalinfo_initialised;
 
-    base_quality_t qualACGTGap[5];  // qualities for A, C, G, T, *
-    uint32 countACGTGapf[5]; // dito for counts forward
-    uint32 countACGTGapr[5]; // dito for counts reverse
-
-  private:
-    void init() {
+    base_quality_t qualACGTStar[5];  // qualities for A, C, G, T, *
+
+    //base_quality_t qualA;
+    //base_quality_t qualC;
+    //base_quality_t qualG;
+    //base_quality_t qualT;
+    //base_quality_t qualStar;
+
+    // TODO: find out where used, multitag_t???
+    // upgrading copy operator: when copying a tag_t to contigtag_t
+    Contig::consensustag_t const & operator=(tag_t const & other){
+      from=other.from;
+      to=other.to;
+      strand=other.strand;
+      identifier=multitag_t::newIdentifier(other.identifier);
+      comment=multitag_t::newComment(other.comment);
       additionalinfo_initialised=false;
 
-      qualACGTGap[0]=0;
-      qualACGTGap[1]=0;
-      qualACGTGap[2]=0;
-      qualACGTGap[3]=0;
-      qualACGTGap[4]=0;
-
-      countACGTGapf[0]=0;
-      countACGTGapf[1]=0;
-      countACGTGapf[2]=0;
-      countACGTGapf[3]=0;
-      countACGTGapf[4]=0;
-      countACGTGapr[0]=0;
-      countACGTGapr[1]=0;
-      countACGTGapr[2]=0;
-      countACGTGapr[3]=0;
-      countACGTGapr[4]=0;
-    }
-  public:
-    // lazy constructor (need to define as copy-constructor is defined)
-    consensustag_t() {init();}
-
-    void addAdditionalInfo(const uint32 countAf,
-			   const uint32 countCf,
-			   const uint32 countGf,
-			   const uint32 countTf,
-			   const uint32 countGapf,
-			   const uint32 countAr,
-			   const uint32 countCr,
-			   const uint32 countGr,
-			   const uint32 countTr,
-			   const uint32 countGapr,
-			   const base_quality_t qualA,
-			   const base_quality_t qualC,
-			   const base_quality_t qualG,
-			   const base_quality_t qualT,
-			   const base_quality_t qualGap) {
-      additionalinfo_initialised=true;
-      qualACGTGap[0]=qualA;
-      qualACGTGap[1]=qualC;
-      qualACGTGap[2]=qualG;
-      qualACGTGap[3]=qualT;
-      qualACGTGap[4]=qualGap;
-      countACGTGapf[0]=countAf;
-      countACGTGapf[1]=countCf;
-      countACGTGapf[2]=countGf;
-      countACGTGapf[3]=countTf;
-      countACGTGapf[4]=countGapf;
-      countACGTGapr[0]=countAr;
-      countACGTGapr[1]=countCr;
-      countACGTGapr[2]=countGr;
-      countACGTGapr[3]=countTr;
-      countACGTGapr[4]=countGapr;
-    }
-    // assigning multitag to consensustag
-    Contig::consensustag_t const & operator=(multitag_t const & other){
-      multitag_t::operator=(other);
-      init();
-      return *this;
-    }
+      qualACGTStar[0]=0;
+      qualACGTStar[1]=0;
+      qualACGTStar[2]=0;
+      qualACGTStar[3]=0;
+      qualACGTStar[4]=0;
 
-   friend std::ostream & operator<<(std::ostream &ostr, const consensustag_t & ct){
-     ostr << static_cast<multitag_t>(ct)
-	  << "ai: " << ct.additionalinfo_initialised
-	  << "\ncAf: " << ct.countACGTGapf[0]
-	  << "\tcAr: " << ct.countACGTGapr[0]
-	  << "\ncCf: " << ct.countACGTGapf[1]
-	  << "\tcCr: " << ct.countACGTGapr[1]
-	  << "\ncGf: " << ct.countACGTGapf[2]
-	  << "\tcGr: " << ct.countACGTGapr[2]
-	  << "\ncTf: " << ct.countACGTGapf[3]
-	  << "\tcTr: " << ct.countACGTGapr[3]
-	  << "\nc*f: " << ct.countACGTGapf[4]
-	  << "\tc*r: " << ct.countACGTGapr[4]
-	  << std::endl;
-     return ostr;
-   }
-  };
+      //qualA=0;
+      //qualC=0;
+      //qualG=0;
+      //qualT=0;
+      //qualStar=0;
 
-  struct constats_t {
-    bool statsvalid=false;
-
-    bool contains_long_repeats_only=false;  // copy of CON_contains_long_repeats_only for saving
-    int8 islargecontig=false; // -1=no; 0=undefined; 1=yes
-
-    uint32 conlength=0;
-    uint32 conlength_nogap=0;
-
-    uint32 AinC=0;
-    uint32 CinC=0;
-    uint32 GinC=0;
-    uint32 TinC=0;
-    uint32 NinC=0;
-    uint32 XinC=0;
-    uint32 starInC=0;
-    uint32 IUPACinC=0;
-    uint32 FunnyInC=0;
-    uint32 NinR=0;
-    uint32 XinR=0;
-    uint32 starInR=0;
-
-    double gccontent=0.0;
-
-    uint32 numSRMc=0;
-    uint32 numWRMc=0;
-    uint32 numSTMU=0;
-    uint32 numSTMS=0;
-
-    uint32 total_reads=0;
-    uint32 readsperst[ReadGroupLib::SEQTYPE_END];    // EXCLUDING rail reads!!!
-    uint64 totalbasesperst[ReadGroupLib::SEQTYPE_END];
-    uint32 numreads_noqual=0;
-    uint32 numreads_withqual=0;
+      return *this;
+    }
 
-    uint32 numnocoverage=0;
+    // lazy constructor (need to define as copy-constructor is defined)
+    consensustag_t() {}
 
-    uint32 max_coverage=0;
-    uint32 max_covperst[ReadGroupLib::SEQTYPE_END];
+    // upgrading copy constructor
+    consensustag_t(tag_t const &other) {*this=other;}
 
-    double avg_coverage=0.0;
-    double avg_covperst[ReadGroupLib::SEQTYPE_END];
+  };
 
-    uint32 avg_conqual=0;
+  struct constats_t {
+    bool statsvalid;
+
+    uint32 conlength;
+    uint32 conlength_nogap;
+
+    uint32 AinC;
+    uint32 CinC;
+    uint32 GinC;
+    uint32 TinC;
+    uint32 NinC;
+    uint32 XinC;
+    uint32 starInC;
+    uint32 IUPACinC;
+    uint32 FunnyInC;
+    uint32 NinR;
+    uint32 XinR;
+    uint32 starInR;
+
+    double gccontent;
+
+    uint32 numSRMc;
+    uint32 numWRMc;
+    uint32 numSTMU;
+    uint32 numSTMS;
+
+    uint32 total_reads;
+    uint32 readsperst[Read::SEQTYPE_END];    // EXCLUDING rail reads!!!
+    uint32 readlenperst[Read::SEQTYPE_END];
+    uint32 numreads_noqual;
+    uint32 numreads_withqual;
+
+    uint32 numnocoverage;
+
+    uint32 max_coverage;
+    uint32 max_covperst[Read::SEQTYPE_END];
+
+    double avg_coverage;
+    double avg_covperst[Read::SEQTYPE_END];
+
+    uint32 avg_conqual;
   };
 
 
   struct errorstatus_t {
     int32         code;                   // the addread error code
-    std::vector<int32> reads_affected;
-
-    inline errorstatus_t() : code(ENOERROR) {};
-    inline void reset() { code=ENOERROR; reads_affected.clear(); }
-    void dumpStatus(bool longmsg=false, const char * additionalmsg=nullptr);
-  };
-
-
-  struct templateguessinfo_t {
-    uint32 tsize_seen=0;   // outer template size seen
-    int8  splace_seen=SPLACE_UNKNOWN;  // segment placement deduced
-    ReadGroupLib::ReadGroupID rgid;
-
-    friend std::ostream & operator<<(std::ostream &ostr, const templateguessinfo_t & tgi){
-      ostr << "tgi rgid: " << tgi.rgid.getLibId()
-	   << "\t" << ReadGroupLib::getNameOfSegmentplacement(tgi.splace_seen)
-	   << "\t" << tgi.tsize_seen;
-      return ostr;
-    }
+    vector<int32> reads_affected;
+    vector<int32> srmb_reads_affected;
+    /* for mapping short reads: the contig proposes to cut back
+       right quality clip to this position */
+    int32         proposed_cutback;
   };
 
 
-
   // pacbio dark strobe edit
   struct pbdse_t {
     uint32 rid;               // rid in readpool
@@ -594,8 +441,8 @@ public:
     int32  rpose;              // and read pos
     int32  changeestim;        // >0: insert Ns; <0 delete Ns
 
-    friend std::ostream & operator<<(std::ostream &ostr, const pbdse_t & pbdse){
-      ostr << "rid: " << pbdse.rid << "\trposs: " << pbdse.rposs << "\trpose: " << pbdse.rpose << "\tce: " << pbdse.changeestim << std::endl;
+    friend ostream & operator<<(ostream &ostr, const pbdse_t & pbdse){
+      ostr << "rid: " << pbdse.rid << "\trposs: " << pbdse.rposs << "\trpose: " << pbdse.rpose << "\tce: " << pbdse.changeestim << endl;
       return ostr;
     }
   };
@@ -613,6 +460,7 @@ public:
   static const multitag_t::mte_id_t CON_tagentry_idSAOc;
   static const multitag_t::mte_id_t CON_tagentry_idSROc;
   static const multitag_t::mte_id_t CON_tagentry_idSIOc;
+  static const multitag_t::mte_id_t CON_tagentry_idFpAS;
   static const multitag_t::mte_id_t CON_tagentry_idPSHP;
   static const multitag_t::mte_id_t CON_tagentry_idED_D;
   static const multitag_t::mte_id_t CON_tagentry_idED_C;
@@ -625,8 +473,6 @@ public:
   static const multitag_t::mte_id_t CON_tagentry_idMCVc;
   static const multitag_t::mte_id_t CON_tagentry_idDGPc;
 
-  static const multitag_t::mte_id_t CON_tagentry_idSOFApolyA_signal_sequence;
-
   static const multitag_t::mte_co_t CON_tagentry_coEmpty;
 
   // special flag for debugging sessions. If set, the code should
@@ -640,39 +486,43 @@ private:
   static const consensus_counts_t CON_concounts_zero_nobb;
 
   static uint32 CON_id_counter;
-  static bool CON_static_ok;
+  static uint32 CON_static_ok;
 
   static uint32 CON_railcounter;
 
   static uint32 CON_cer_idcounter;     // Coverage Equivalent Read id counter
 
-  //static std::vector< std::string >   CON_danger_zones_ids;
-  //static std::vector< std::string >   CON_baselock_ids;
-  //static std::vector< std::string >   CON_snplock_ids;
+  //static vector< string >   CON_danger_zones_ids;
+  //static vector< string >   CON_baselock_ids;
+  //static vector< string >   CON_snplock_ids;
 
-  static std::vector<multitag_t::mte_id_t>   CON_danger_zones_ids;
-  static std::vector<multitag_t::mte_id_t>   CON_baselock_ids;
-  static std::vector<multitag_t::mte_id_t>   CON_snplock_ids;
+  static vector<multitag_t::mte_id_t>   CON_danger_zones_ids;
+  static vector<multitag_t::mte_id_t>   CON_baselock_ids;
+  static vector<multitag_t::mte_id_t>   CON_snplock_ids;
 
 
 
   static uint8 CON_outtype;
 
-  static bool  CON_outputrails;
+  static bool  CON_outputRails;
 
-  static std::unordered_set<std::string> CON_cebugnames;
-  static bool CON_mastercebugflag;
   //Variables
 private:
+#define CON_VALID (((static_cast<uint32>('C')<<8)\
+                     +static_cast<uint32>('O)'<<8)\
+                     +static_cast<uint32>('N')<<8)\
+                     +static_cast<uint32>('V'))
+  uint32 CON_valid;
+
   bool CON_cebugflag; // only for special debugging in getConsensus() etc.
 
-  std::vector<MIRAParameters> * CON_miraparams;
+  vector<MIRAParameters> * CON_miraparams;
 
 
   uint32 CON_id;
-  std::string CON_nameprefix;
+  string CON_nameprefix;
 
-  mutable std::string CON_name;  /* if this string is non-empty, then it's the name of
+  mutable string CON_name;  /* if this string is non-empty, then it's the name of
 			       the contig. If it is empty, the name is made out of
 			       the name prefix, some characters and the id.
 			       see getContigName() for exact name scheme */
@@ -680,33 +530,42 @@ private:
   bool CON_finalised;
 
   ReadPool * CON_readpool;
-  PlacedContigReads         CON_reads;
+  vector<contigread_t>      CON_reads;
   cccontainer_t             CON_counts;
-  std::multiset<int32>           CON_templates_present;
-  std::vector<consensustag_t>    CON_consensus_tags;
+  multiset<int32>           CON_templates_present;
+  vector<consensustag_t>    CON_consensus_tags;
 
   // if set and if an element >0, use this for checking free coverage
   //  when trying to add a read
-  std::vector<ccctype_t>            CON_targetcoverageperst;
+  vector<ccctype_t>            CON_targetcoverageperst;
 
+  /*
+    This vector is here to save time in addRead() (other functions
+    perhaps later)
+    If active, it has the size of the readpool (CON_readpool) and 
+    it maps the readpool ids of the reads to the ids of the reads
+    in the CON_reads vector.
+    If dirty, size is 0.
+   */
+  vector<int32> CON_maprpids_to_conreadsids;
 
   /*
     This vector is here to allow selective beef up the contig when mapping
     short reads.
-    If active, it has the size of the readpool (CON_readpool) and each
+    If active, it has the size of the readpool (CON_readpool) and each 
     element is either 1 (allowed) or 0 (not allowed), telling which
     reads are allowed or not to be a reference read when adding new
     reads to a contig.
     If dirty, size is 0.
    */
-  std::vector<bool> CON_allowedrefids;
+  vector<bool> CON_allowedrefids;
 
 
   //// fast cons function cached
   //uint32 CON_len_tmpcons;
   //char * CON_tmpcons;
 
-  std::string CON_2tmpcons;
+  string CON_2tmpcons;
 
   /* Two flags that tell the contig how to add new reads:
    */
@@ -718,8 +577,6 @@ private:
   bool CON_hasforcemergeareas;      /* if true, some areas in the backbone
 				       ask for forced merging */
 
-  bool CON_isbackbonecontig; // quick flag for checking whether it is a backbone
-
   // Special conditions when aligning short reads (Solexa, SOLiD)
   bool CON_specialsraddconditions;   /* if true, applies special checks
 					when adding short reads */
@@ -733,48 +590,19 @@ private:
 
   uint32 CON_nummergedreads_perseqtype[NUMMERGESEQTYPES];
 
-  //
-  // tracker for (clipped) longest non-rail read which was ever added to contig
-  //
-  // needed for efficient finding of lower_bound pcrIs in the CON_reads PlacedContigReads
-  //
-  // Note: should reads in the future be removed via a call to deleteRead() outside
-  //  of the whole addRead() functionality, this value might not track the longest
-  //  clipped read in the contig, but the longest reads which was ever added.
-  //
-  int32 CON_longestreadseen;
-  int32 CON_longestrailseen;  // same, but only for rails
-  int32 CON_longestnonbbreadseen;  // same as longestreadseee, but without backbones
-
-  // counter for num reads per strain. kept up to date by contig
-  //
-  // BaCh 21.01.2012: with the new readsperreadgroup below, this has become
-  //  a bit redundant. Keep for the time being, maybe faster in queries
-  std::vector<uint32> CON_readsperstrain;
-
-  // counter for num reads per readgroup. kept up to date by contig
-  std::vector<uint32> CON_readsperreadgroup;
-
-  // tracker for marker positions
-  // MPs are positions which can be freely defined and where the contig will adjust
-  //  the positions while growing the contig
-  // Used atm only for con_msr_keependsunmapped (left and right MP), so simplistic version
-  std::vector<int32> CON_markerpositions;
-  // these two point into CON_markerpositions for initial positions 0 (left) and
-  //  and "contigsize" (right)
-  int32         CON_mpindex_msrkceu_left;     // a value of -1 equals to "unused"
-  int32         CON_mpindex_msrkceu_right;    //
+  uint32 CON_index_leftestbbread;
+  uint32 CON_index_rightestbbread;
 
   /*
     The "fixed" consensus is a consensus that the contig gets initialised with
     (e.g. loading from CAF). If set, then fetching consensus sequence and
     qualities will yield this instead of dynamically generated values from the
-    CON_allcons* and CON_straincons* variables below.
+    CON_allcons* and CON_straincons* variables below. 
 
     Gets trashed when the contig changes)
    */
-  std::string                 CON_fixedconsseq;
-  std::vector<base_quality_t> CON_fixedconsqual;
+  string                 CON_fixedconsseq;
+  vector<base_quality_t> CON_fixedconsqual;
 
   // new
   // when consenus is calculated, store here for every strain
@@ -787,136 +615,55 @@ private:
   base_quality_t CON_conscalc_minqual;
   char           CON_conscalc_missingchar;
 
-  bool           CON_conscalc_assumediploid;
-  bool           CON_conscalc_allowiupac;
-  bool           CON_conscalc_addconstag;
+  string                  CON_allconsseq;
+  vector<base_quality_t>  CON_allconsqual;
+  vector<int32>           CON_alladjustments;
 
-  std::string                  CON_allconsseq;
-  std::vector<base_quality_t>  CON_allconsqual;
-  std::vector<int32>           CON_alladjustments;
+  vector<string>                  CON_strainconsseq;
+  vector<vector<base_quality_t> > CON_strainconsqual;
+  vector<vector<int32> >          CON_strainadjustments;
 
-  std::vector<std::string>                  CON_strainconsseq;
-  std::vector<std::vector<base_quality_t> > CON_strainconsqual;
-  std::vector<std::vector<int32> >          CON_strainadjustments;
+//  // TODO: old! to be phases out asap
+//  // ---
+//  string CON_cheat_intelcons;
+//  vector<base_quality_t> CON_cheat_intelconsqual;
+//  bool CON_cheat_intelcons_markspecials;
+//  int32 CON_cheat_intelcons_mincov;
+//  base_quality_t CON_cheat_intelcons_minqual;
+//  int32 CON_cheat_intelcons_strainidtotake;
+//  // ---
 
 
+  // counter for num reads per strain. kept up to date by contig
+  vector<uint32>                  CON_readsperstrain;
+
+
+  //
+  vector<out_order_t> CON_outputorder;
 
-  std::vector<int32> CON_last_dangerous_overlaps;
+  vector<int32> CON_last_dangerous_overlaps;
 
 
   constats_t CON_stats;
 
 
   struct edit454command_t {
-    PlacedContigReads::const_iterator pcrI;
-    uint32 urdid;                            // just needed for comparator
-    uint32 readpos;
+    uint32 conreadid;
     char base;
-
-    inline edit454command_t(PlacedContigReads::const_iterator & pcrIp, uint32 urdidp, uint32 readposp, char basep) :
-      pcrI(pcrIp), urdid(urdidp), readpos(readposp), base(basep) {};
+    uint32 readpos;
   };
 
 
-  // set by pathfinder if the assembly mode is genome to keep long repeats
+  // set by pathfinder if the assembly mode is to keep long repeats 
   //  separated and this contig started with a multicopy read
-  // used for definig contig name
   bool CON_contains_long_repeats_only;
 
-  // I don't think I'll include a tribool for that :-)
-  // -1 = no, 0=unknown, 1=yes
-  int8 CON_contains_majority_digitallynormalised_reads;
-
-  enum{USCLO_PRE=0,
-       USCLO_DIR,
-       USCLO_XCUT,
-       USCLO_TEMPL1,
-       USCLO_SWALIGN,
-       USCLO_PREINSCHK,
-       USCLO_INSCON,
-       USCLO_INSCONM,
-       USCLO_UPDBLOCKS,
-       USCLO_DELREAD,
-       USCLO_ANRMBZ,
-       USCLO_GRACP,
-       USCLO_END};
-
-  // track timing
-  std::vector<suseconds_t> CON_us_steps;
-
-#define CLOCK_STEPS_IRIC
-  enum{USCLOIRIC_INSGLCC=0,
-       USCLOIRIC_INSGLARO,
-       USCLOIRIC_INSGLACT,
-       USCLOIRIC_INSGLTOT,
-       USCLOIRIC_PR,
-       USCLOIRIC_TEMPL,
-       USCLOIRIC_INDEX,
-       USCLOIRIC_BIGLCCINS,
-       USCLOIRIC_BIGLINTERPOL,
-       USCLOIRIC_BIGLUPDTAGS,
-       USCLOIRIC_BIGLFPCRI,
-       USCLOIRIC_BIGLLIGAPINREADS,
-       USCLOIRIC_BIGLSHIFTREADS,
-       USCLOIRIC_BIGLTOT,
-       USCLOIRIC_INSGR,
-       USCLOIRIC_UCV,
-       USCLOIRIC_END
-  };
-
-#define CLOCK_STEPS_DRFC
-  enum{
-    USCLODRFC_UBL,
-    USCLODRFC_UCV,
-    USCLODRFC_ITF,
-    USCLODRFC_ITB,
-    USCLODRFC_CCEF,
-    USCLODRFC_CCEB,
-    USCLODRFC_SDT, // shift delete tags
-    USCLODRFC_SR,
-    USCLODRFC_SMP,
-    USCLODRFC_DT,
-    USCLODRFC_RR,
-    USCLODRFC_DSOC,
-    USCLODRFC_TOTAL,
-    USCLODRFC_END
-  };
-
-
-//#define CLOCK_STEPS_CONS  // careful with this one, 30% speed impact
-  enum{
-    USCLOCONS_H1_MGROUPS,
-    USCLOCONS_H1_PL_1,
-    USCLOCONS_H1_PL_2,
-    USCLOCONS_H1_PL_3,
-    USCLOCONS_H1_PL_4,
-    USCLOCONS_H1_PCRI,
-    USCLOCONS_H1_countPCRI,
-    USCLOCONS_H1_EGROUP,
-    USCLOCONS_H1_GQUAL,
-    USCLOCONS_H1_CALLH2,
-    USCLOCONS_H1_TOTAL,
-    USCLOCONS_END
-  };
-
-
-  // track timing for insert read in contig
-  std::vector<suseconds_t> CON_us_steps_iric;
-  // track timing for delete read from contig
-  std::vector<suseconds_t> CON_us_steps_drfc;
-  // track timing for consensus generation
-  std::vector<suseconds_t> CON_us_steps_cons;
-
-  // track number of delete calls
-  size_t CON_track_numins;
-  size_t CON_track_numdels;
 
 public:
 
 
   //Functions
 private:
-  void setCEBUGFlag(int32 id1, int32 id2);
   void foolCompiler();
   void init();
   void zeroVars();
@@ -924,34 +671,37 @@ private:
 
   //bool outputOrderSortCmp_(const out_order_t & a, const out_order_t & b);
 
-  void addRead_wrapped(
-    std::vector<Align> & aligncache,
-    const AlignedDualSeqFacts * initialadsf,
-    int32 refid,
-    int32 newid,
-    int32 direction_frnid,
-    bool  newid_ismulticopy,
-    int32 forcegrow,
-    templateguessinfo_t & templateguess,
-    errorstatus_t & errstat);
-
+  void buildFASTAHeader(ostringstream & ostr) const;
+
+  void dumpAsTextOrHTML(ostream &ostr, 
+			const uint8 outtype, 
+			const string & consseq, 
+			const vector<base_quality_t> & consqual, 
+			const int32 frompos, 
+			const int32 topos);
+  void dumpAsDebug(ostream & ostr);
+  void dumpAsCAF(ostream & ostr);
+  void dumpAsMAF(ostream & ostr);
+  void dumpAsSAM(ostream & ostr);
+  int32 helper_dumpAsACE_BSLines(string & consseq, bool alsodump, ostream & ostr);
+  void dumpAsACE(ostream & ostr);
+  void dumpAsTCS(ostream & ostr);
+  void dumpAsFASTA(ostream & ostr, bool padded);
+  void dumpAsFASTAQUAL(ostream & ostr, bool padded);
+
+  bool makeTmpConsensus(int32 from, int32 to);
   void updateCountVectors(const int32 from,
 			  const int32 len,
-			  std::vector<char>::const_iterator updateseq,
+			  vector<char>::const_iterator updateseq,
 			  const uint32 seqtype,
-			  bool bla,
-			  int32 coveragemultiplier);
-  void priv_rebuildConCounts();
-  PlacedContigReads::const_iterator insertReadInContig(const AlignedDualSeq & ads,
-						       uint32 coffset,
-						       int32 direction_frnid,
-						       int32 direction_refid,
-						       int32 coveragemultiplier);
-  bool insertMappedReadInContig(const AlignedDualSeq & ads,
+			  bool addiftrue);
+  void rebuildConCounts();
+  void insertReadInContig(const AlignedDualSeq & ads, uint32 coffset,
+			  int32 direction_frnid, int32 direction_global);
+  bool insertMappedReadInContig(const AlignedDualSeq & ads, 
 				const uint8 newreadseqtype,
-				const uint32 coffset,
+				const uint32 coffset, 
 				const int32 direction_frnid,
-				const int32 coveragemultiplier,
 				const bool forcemerge);
   int32 analyseADSForCuttingBackCERMap(const AlignedDualSeq & ads, int32 direction_frnid);
 
@@ -960,11 +710,26 @@ private:
   void updateTagBaseInserted(uint32 contigpos);
   void updateTagBaseDeleted(uint32 contigpos);
 
+  int deepThought(const contigread_t &aRead, int offset, char base);
+		  //		  SCF_buffer &theBuffer);
+  bool analyseRMBZones(const contigread_t & ric, vector<int32> & RMBdangeroverlaps);
+  bool analyseDangerZones(const contigread_t & ric);
+  bool analyseAllZones(const contigread_t & ric);
+
+  void checkForLockedBase(const uint32 readpos,
+			  const contigread_t ric,
+			  int32 & baselock,
+			  int32 & snplock);
+  void checkForLockedBaseComplement(const uint32 readpos,
+				    const contigread_t ric,
+				    int32 & baselock,
+				    int32 & snplock);
+
+  void trimEnds();
 
-  void shiftMarkerPositions(int32 pos, int32 offset);
 
   // TODO: see whether can be replace by the looking at sorted multitag_t vector?
-  static bool consensustag_t_comparator(const consensustag_t & t1,
+  static bool consensustag_t_comparator(const consensustag_t & t1, 
 					const consensustag_t & t2)
     {
       if(t1.from < t2.from) return true;
@@ -976,7 +741,7 @@ private:
 
 
   // rid high to low, within rid startpos high to low
-  static bool pbdse_t_comparator(const pbdse_t & p1,
+  static bool pbdse_t_comparator(const pbdse_t & p1, 
 				 const pbdse_t & p2)
     {
       if(p1.rid == p2.rid){
@@ -985,9 +750,21 @@ private:
       return p1.rid < p2.rid;
     };
 
+  /* Sort ascending by offset start
+     if equal, subsort by read_id */
+  static bool out_order_t_comparator(const out_order_t & a, 
+				     const out_order_t & b)
+    {
+      if(a.offset_start == b.offset_start){
+	return (a.orpid < b.orpid);
+      }
+      return a.offset_start < b.offset_start;
+    };
+
+
   // sort ascending, first by contigfrom, then to
-  //  then sort by identifier: Fsrc, Fgen, FCDS, rest
-  static bool gbfsummary_t_comparator(const gbfsummary_t & a,
+  //  then by identifier: Fsrc, Fgen, FCDS, rest
+  static bool gbfsummary_t_comparator(const gbfsummary_t & a, 
 				      const gbfsummary_t & b)
     {
       if(a.cfrom!=b.cfrom) return (a.cfrom<b.cfrom);
@@ -1006,14 +783,15 @@ private:
     };
 
 
-  static bool edit454command_t_comparator(const edit454command_t & a,
+  static bool edit454command_t_comparator(const edit454command_t & a, 
 					  const edit454command_t & b)
     {
-      if(a.urdid == b.urdid) {
-	// sort within a read by DESCENDING! readpos order
+      if(a.conreadid == b.conreadid) {
+	// sort within a conreadid by DESCENDING! readpos order
 	return a.readpos > b.readpos;
+      }else{
+	return a.conreadid < b.conreadid;
       }
-      return a.urdid < b.urdid;
     };
 
   ///////////////////////////////////////////////////////
@@ -1024,26 +802,22 @@ private:
     base_quality_t groupquality;
 
     bool valid;
-
+    
     uint32 forwarddircounter;
     uint32 complementdircounter;
 
     // these vectors are 'linked': nth element of one corresponds to nth of another
+    vector<int32> ids;
+    vector<base_quality_t> quals;
+    vector<int8>  directions;
 
-    // OUCH: PlacedContigReads need rethinking IDs! (maybe export unsorted ids of
-    //  ReadContainer in PlacedContigReads?
-
-    std::vector<int32> urdids;
-    std::vector<base_quality_t> quals;
-    std::vector<int8>  directions;
-
-    friend std::ostream & operator<<(std::ostream &ostr, const nngroups_t &nngroup){
+    friend ostream & operator<<(ostream &ostr, const nngroups_t &nngroup){
       ostr << "    base " <<  nngroup.base << '\n';
       ostr << "    valid " <<  nngroup.valid << '\n';
       ostr << "    forwarddircounter " <<  nngroup.forwarddircounter << '\n';
       ostr << "    complementdircounter " <<  nngroup.complementdircounter << '\n';
       ostr << "    groupquality " <<  static_cast<uint32>(nngroup.groupquality) << '\n';
-      ostr << "    urdids.size " <<  nngroup.urdids.size() << '\n';
+      ostr << "    ids.size " <<  nngroup.ids.size() << '\n';
       ostr << "    quals.size " <<  nngroup.quals.size() << '\n';
       ostr << "    directions.size " <<  nngroup.directions.size() << '\n';
       return ostr;
@@ -1055,9 +829,9 @@ private:
   struct pos_rep_col_t {
     int32 contigpos;
     int32 numvalidgroups;
-    std::vector<nngroups_t> groups;
-    //std::vector<int32> allids;   not needed anyway (just for lazy debugging output)
-    std::string type;
+    vector<nngroups_t> groups;
+    //vector<int32> allids;   not needed anyway (just for lazy debugging output)
+    string type;
 
     bool is_dangerous;
     bool tagged;
@@ -1068,26 +842,157 @@ private:
 
   //void calcGroupQual(const groups_t & g);
 
+  void makeIntelligentConsensus_helper3(
+    char & thisbase, 
+    base_quality_t & thisqual,
+    const vector<nngroups_t> & groups, 
+    const vector<char> & IUPACbasegroups);
+
+  void makeIntelligentConsensus_helper2_calcSangerQual(
+    char & thisbase,
+    base_quality_t & thisqual,
+    const uint32 actcontigpos,
+    const vector<nngroups_t> & groups,
+    vector<char> & IUPACbasegroups,
+    const vector<char> & columnbases,
+    const base_quality_t maxqual,
+    const uint32 maxcount);
+
+  void makeIntelligentConsensus_helper2_calcSOLEXA(
+    char & thisbase, 
+    base_quality_t & thisqual, 
+    const uint32 actcontigpos,
+    cccontainer_t::const_iterator ccI,
+    const vector<nngroups_t> & groups, 
+    vector<char> & IUPACbasegroups, 
+    const base_quality_t maxqual,
+    const uint32 maxcount,
+    int32 strainidtotake);
+
+  void makeIntelligentConsensus_helper2_calc454GS20(
+    char & thisbase, 
+    base_quality_t & thisqual, 
+    const uint32 actcontigpos,
+    const vector<nngroups_t> & groups, 
+    vector<char> & IUPACbasegroups);
+
+  void makeIntelligentConsensus_helper2_calcIonTorrent(
+    char & thisbase, 
+    base_quality_t & thisqual, 
+    const uint32 actcontigpos,
+    const vector<nngroups_t> & groups, 
+    vector<char> & IUPACbasegroups);
+
+  void makeIntelligentConsensus_helper2_calcPACBIO(
+    char & thisbase, 
+    base_quality_t & thisqual, 
+    const uint32 actcontigpos,
+    const vector<nngroups_t> & groups, 
+    vector<char> & IUPACbasegroups);
+
+  void makeIntelligentConsensus_helper1(
+    char & thisbase, 
+    base_quality_t & thisqual,
+    const uint32 actcontigpos, 
+    cccontainer_t::const_iterator ccI,
+    const int32 mincoverage, 
+    vector<nngroups_t> & groups,
+    vector<nngroups_t> & maskedshadowgroups, 
+    vector<char> & IUPACbasegroups, 
+    vector<char> & columnbases, 
+    const vector<int32> & read_ids_in_col, 
+    vector<int8> & maskshadow,
+    uint8 actreadtype,
+    int32 strainidtotake,
+    char missingcoveragechar
+    );
+  void makeIntelligentConsensus(string & target, 
+				vector<base_quality_t> & qual, 
+				vector<int32> * targetadjustments, 
+				vector<int32> * targetadjustments_bla, 
+				int32 from, 
+				int32 to, 
+				int32 mincoverage=0,
+				base_quality_t minqual=0,
+				int32 strainidtotake=-1,
+				char missingcoveragechar='@');
+//				ostream * ostr=NULL,
+//				bool contagsintcs=true);
+  
+  int8 rateGoodnessLevelOfConsensus(cccontainer_t::const_iterator ccI, 
+				    nngroups_t & groups, 
+				    uint32 numpossiblebases, 
+				    uint8 seqtype);
 
-  bool buildMaskShadow(std::vector<int8> & maskshaddow,
-		       std::vector<multitag_t::mte_id_t> & masktagtypes,
+
+  void buildMaskShadow(vector <int8> & maskshaddow, 
+		       vector<multitag_t::mte_id_t> & masktagtypes,
 		       bool onlybackbone);
   void zeroStats();
   void calcStats();
-  void priv_calcNumDigitallyNormalisedReads();
+
+
+  // ReadColContigIterator structure
+  struct rcci_t {
+    // a vector (read_ids_in_col) keeps the ids of the CON_reads that are
+    //  covering a specific position of the contig
+    // reserving 1000 position should be enough 99.9% of all cases,
+    //  is automatically extended by STL if needed.
+    vector<int32> read_ids_in_col; /* these are the CON_read[] indexes
+				    */
+
+    vector<out_order_t>::const_iterator outorderI;
+    uint32 actcontigpos;
+
+    vector<int32> allowedstrainids;
+    vector<uint8> allowedreadtypes;
+    bool takerails;
+    bool takebackbones;
+    bool takereadswithoutreadpool;
+  };
+  void readColContigIteratorInit(rcci_t & rcci, 
+				 const vector<int32> & allowedstrainids,
+				 const vector<uint8> & allowedsequencingtypes,
+				 bool takerails,
+				 bool takebackbones,
+				 bool takereadswithoutreadpool);
+  void readColContigIteratorUpdate(rcci_t & rcci);
+  void readColContigIteratorAdvance(rcci_t & rcci);
+
+  struct ercci_t {
+    // per sequencing type and per strain ids,
+    //  a vector keeps the ids of the reads that are
+    //  covering a specific position of the contig
+    // reserving 1000 position should be enough 99.9% of all cases,
+    //  is automatically extended by STL if needed.
+    
+    // read ids per sequencing type per strain
+    vector<vector<vector<uint32> > > rids_st_st;
+
+    vector<out_order_t>::const_iterator outorderI;
+    uint32 actcontigpos;
+
+    bool takerails;
+    bool takebackbones;
+
+  };
+  void extendedReadColContigIteratorInit(ercci_t & ercci, 
+					 bool takerails,
+					 bool takebackbones,
+					 uint32 numstrains);
+  void extendedReadColContigIteratorUpdate(ercci_t & ercci);
+  void extendedReadColContigIteratorAdvance(ercci_t & ercci);
 
 
   ////////////////////////////////////////////////////////////////////////
   struct nnpos_rep_col_t {
-    // the next four are linked, i.e., 1st value of each must
+    // the next two are linked, i.e., 1st value of each must
     //  be seen together, 2nd ... etc.
-    std::string groupbases;
-    std::vector<base_quality_t> groupquals;
-    std::vector<uint32> groupcountsfwd;
-    std::vector<uint32> groupcountsrev;
+    string groupbases;
+    vector<base_quality_t> groupquals;
 
-    // which urdids are in these groups
-    std::vector<uint32> urdids;
+    // which ids are in these groups
+    vector<uint32> ids;
 
     multitag_t::mte_id_t type;       // fille with Read::REA_tagentry_id...
     int32 contigpos;
@@ -1095,7 +1000,7 @@ private:
     bool is_dangerous;
     bool tagged;
 
-    friend std::ostream & operator<<(std::ostream &ostr, const nnpos_rep_col_t & prc){
+    friend ostream & operator<<(ostream &ostr, const nnpos_rep_col_t & prc){
       ostr << "PRC:\n";
       ostr << "    is_dangerous: " <<  prc.is_dangerous << '\n';
       ostr << "    tagged: " <<  prc.tagged << '\n';
@@ -1111,379 +1016,160 @@ public:
     uint32 numSRMs;
     uint32 numWRMs;
     uint32 numSNPs;
-
-    void init() {numSRMs=0;numWRMs=0;numSNPs=0;}
-    repeatmarker_stats_t() {init();}
   };
 private:
   ////////////////////////////////////////////////////////////////////////
 
-
-
-  bool checkFreeCoverageForAddingRead(
-    const uint8 newreadseqtype,
-    const int32 xcut,
-    const int32 ycut);
-
-  typedef uint8 bbstrainmask_t; // this restricts to 8 strains in mapping, enough for now
-  inline bbstrainmask_t getBBStrainMask(int32 strainid) {
-    uint32 strainmask=0;
-    if(strainid>7 || strainid<0) {
-      throw Notify(Notify::FATAL, "uint8 Contig::getBBStrainMask(int32 strainid)", "Mapping >=8 Solexa strains? Sorry, not possible yet.");
-    }
-    BITSET(strainid, strainmask);
-    return static_cast<bbstrainmask_t>(strainmask);
-  }
-  void getMappedBBStrainIDsFromMask(std::vector<int32> & strains, bbstrainmask_t mask);
-
-
-  /****************************************************
-   * contig_output.C
-   ****************************************************/
-
-  void priv_dumpAsTextOrHTML(std::ostream &ostr,
-			     const uint8 outtype,
-			     const std::string & consseq,
-			     const std::vector<base_quality_t> & consqual,
-			     const int32 frompos,
-			     const int32 topos);
-
-  void priv_dumpAsDebug(std::ostream & ostr);
-  void priv_dumpAsTCS(std::ostream & ostr);
-  std::string priv_buildFASTAQHeaderComment(uint32 len, bool alsoavgcov);
-  void priv_getStrainSeqQualForFASTAQ(std::string & strainseq,
-				      std::vector<base_quality_t> & strainqual,
-				      uint32 mincoverage,
-				      base_quality_t minqual,
-				      int32 strainidtotake,
-				      bool padded,
-				      bool fillholesinstrain);
-  void priv_depadSeqQual(std::string & seq, std::vector<base_quality_t> * qual);
-  void priv_dumpAsFASTA(std::ostream & ostr, bool padded);
-  void priv_dumpAsFASTAQUAL(std::ostream & ostr, bool padded);
-  void priv_dumpAsCAF(std::ostream & ostr);
-  void priv_dumpAsMAF(std::ostream & ostr);
-  int32 priv_helper_dumpAsACE_BSLines(std::string & consseq, bool alsodump, std::ostream & ostr);
-  void priv_dumpAsACE(std::ostream & ostr);
-
-  void priv_dumpReplay(std::ofstream & eout,
-		       const AlignedDualSeqFacts * initialadsf,
-		       int32 refid,
-		       int32 newid,
-		       int32 direction_frnid,
-		       bool newid_ismulticopy,
-		       int32 forcegrow);
-
-  /****************************************************
-   * contig_covanalysis.C
-   ****************************************************/
-
-  void findPeaks_helper(ccctype_t avgcov, ccctype_t threshold, std::vector<uint8> & peakindicator);
-
-  /****************************************************
-   * contig_featureinfo.C
-   ****************************************************/
-
-  void myappend(std::string & a, const std::string & b, const std::string & concatstring) const;
-  void calcSOTagCoverage_helper(const contigSOtag_t & csot,
-				tagcoverageinfo_t & tci,
-				std::vector<uint64> & covvals,
-				const tagcoverageinfo_t & ctci);
-
-  /****************************************************
-   * contig_analysis.C
-   ****************************************************/
-
-  bool analyseRMBZones(PlacedContigReads::const_iterator pcrI);
-  void checkForLockedBase(const uint32 readpos,
-			  PlacedContigReads::const_iterator pcrI,
-			  int32 & baselock,
-			  int32 & snplock);
-  void checkForLockedBaseComplement(const uint32 readpos,
-				    PlacedContigReads::const_iterator pcrI,
-				    int32 & baselock,
-				    int32 & snplock);
-
-  void calcGroupQual(const nngroups_t & g);
-  void nmpr_firstfillin(const ercci_t & ercci,
-			const std::vector<int8> & maskshaddow,
-			const std::vector<multitag_t::mte_id_t> & masktagtypes,
-			std::vector<std::vector<std::vector<nngroups_t> > > & groups_st_st);
-  void nmpr_rategroups(std::vector<std::vector<std::vector<nngroups_t> > > & groups_st_st,
+  void nmpr_firstfillin(const ercci_t & ercci, 
+			const vector <int8> & maskshaddow,
+			const vector<multitag_t::mte_id_t> & masktagtypes,
+			vector<vector<vector <nngroups_t> > > & groups_st_st);
+  void nmpr_rategroups(vector<vector<vector <nngroups_t> > > & groups_st_st,
 		       cccontainer_t::const_iterator ccI);
-  void nmpr_secondfillin(const ercci_t & ercci,
-			 const std::vector<int8> & maskshaddow,
-			 const std::vector<multitag_t::mte_id_t> & masktagtypes,
-			 std::vector<std::vector<std::vector<nngroups_t> > > & groups_st_st);
+  void calcGroupQual(const nngroups_t & g);
+  void nmpr_secondfillin(const ercci_t & ercci, 
+			 const vector <int8> & maskshaddow,
+			 const vector<multitag_t::mte_id_t> & masktagtypes, 
+			 vector<vector<vector <nngroups_t> > > & groups_st_st);
   void nmpr_cautiousMultiSeqTypeTagging(const ercci_t & ercci,
 					const rcci_t & rcci,
-					const std::vector<std::vector<std::vector<nngroups_t> > > & groups_st_st,
+					const vector<vector<vector <nngroups_t> > > & groups_st_st,
 					const nnpos_rep_col_t & emptyprc,
-					std::vector<bool> & readsmarkedsrm,
+					vector<bool> & readsmarkedsrm,
 					repeatmarker_stats_t & repstats);
   void nmpr_evaluateOneSeqType(const uint32 actseqtype,
-			       const ercci_t & ercci,
-  			       const std::vector<std::vector<nngroups_t> > & groups_st,
-			       std::vector<nnpos_rep_col_t> & newprc,
+			       const ercci_t & ercci, 
+  			       const vector<vector <nngroups_t> > & groups_st,
+			       vector<nnpos_rep_col_t> & newprc,
 			       const nnpos_rep_col_t & emptyprc);
   uint32 nmpr_appendPRCFieldsWithGroupsOfOneStrain(
-    const std::vector<nngroups_t> & groups,
+    const vector <nngroups_t> & groups,
     nnpos_rep_col_t & newprc);
-  void nmpr_tagColumn(nnpos_rep_col_t & prc,
+
+  void nmpr_tagColumn(nnpos_rep_col_t & prc, 
 		      const rcci_t & rcci,
-		      std::vector<bool> & readsmarkedsrm,
+		      vector<bool> & readsmarkedsrm,
 		      repeatmarker_stats_t & repstats);
-  void csbrm_fillin_groups_stst(
-    const ercci_t & ercci,
-    const std::vector<int8> & maskshadow,
-    const std::vector<multitag_t::mte_id_t> & masktagtypes,
-    std::vector<std::vector<std::vector<nngroups_t> > > & groups_st_st);
-  bool csbrm_checkReadsForHomopolymers(uint32 actcontigpos,
-				       uint32 maxrunallowed,
-				       const std::vector<int32> & checkthesereads);
-  bool csbrm_checkForCleanBlock(cccontainer_t::iterator ccI);
-  uint32 getBaseRunLength(const Read & read,
-			  const uint32 readpos,
-			  const char base,
-			  uint32 & from,
-			  uint32 & to,
-			  uint32 & zeroqualcounts,
-			  bool useclipsasends=false);
-  void reduceConsensusTags(const std::vector<multitag_t::mte_id_t> & mastertags,
-			   const std::vector<multitag_t::mte_id_t> & deletecandidates);
-
-
-  /****************************************************
-   * contig_edit.C
-   ****************************************************/
-  void priv_rratcp_collectReadsToDelete(ccctype_t minthresh,
-					std::vector<uint8> & peakindicator,
-					std::vector<ccctype_t> & virtcoverage,
-					bool remunpaired,
-					bool pairmustbeincontig,
-					std::unordered_set<readid_t> & readsremoved);
-  bool priv_rratcp_checkDeletable(PlacedContigReads::const_iterator pcrI,
-				  ccctype_t minthresh,
-				  std::vector<uint8> & peakindicator,
-				  std::vector<ccctype_t> & virtcoverage);
-
-
-  /****************************************************
-   * contig_consensus.C
-   ****************************************************/
-
-  bool makeTmpConsensus(int32 from, int32 to, bool tmpconsfrombackbone);
-
-  void makeIntelligentConsensus_helper3(
-    char & thisbase,
-    base_quality_t & thisqual,
-    const std::vector<nngroups_t> & groups,
-    const std::vector<char> & IUPACbasegroups);
 
-  void makeIntelligentConsensus_helper2_calcSangerQual(
-    char & thisbase,
-    base_quality_t & thisqual,
-    const uint32 actcontigpos,
-    const std::vector<nngroups_t> & groups,
-    std::vector<char> & IUPACbasegroups,
-    const base_quality_t maxqual,
-    const uint32 maxcount);
 
-  void makeIntelligentConsensus_helper2_calcSOLEXA(
-    char & thisbase,
-    base_quality_t & thisqual,
-    const uint32 actcontigpos,
-    cccontainer_t::const_iterator ccI,
-    const std::vector<nngroups_t> & groups,
-    std::vector<char> & IUPACbasegroups,
-    const bbstrainmask_t strainmask);
-
-  void makeIntelligentConsensus_helper2_calc454GS20(
-    char & thisbase,
-    base_quality_t & thisqual,
-    const uint32 actcontigpos,
-    const std::vector<nngroups_t> & groups,
-    std::vector<char> & IUPACbasegroups);
-
-  void makeIntelligentConsensus_helper2_calcText(
-    char & thisbase,
-    base_quality_t & thisqual,
-    const uint32 actcontigpos,
-    const std::vector<nngroups_t> & groups,
-    std::vector<char> & IUPACbasegroups);
+  void coutAddReadClocks(const vector<suseconds_t> & suv);
+  void getRailsAsReadsAffected(const int32 refid, 
+			       vector<int32> & reads_affected,
+			       const int32 xcut,
+			       const int32 ycut);
 
-  void makeIntelligentConsensus_helper2_calcIonTorrent(
-    char & thisbase,
-    base_quality_t & thisqual,
-    const uint32 actcontigpos,
-    const std::vector<nngroups_t> & groups,
-    std::vector<char> & IUPACbasegroups);
+  bool checkFreeCoverageForAddingRead(
+    const uint8 newreadseqtype, 
+    const int32 xcut, 
+    const int32 ycut);
 
-  void makeIntelligentConsensus_helper2_calcPACBIOHQ(
-    char & thisbase,
-    base_quality_t & thisqual,
-    const uint32 actcontigpos,
-    const std::vector<nngroups_t> & groups,
-    std::vector<char> & IUPACbasegroups);
-
-  // method to save on hundreds of calls to contigPos2UnclippedReadPos(): cache it
-  struct rpicsocache_t {
-    PlacedContigReads::const_iterator pcrI;
-    int32 readstartpos;
-    int32 urdid;
-    int32 leftclip;
-    int32 rightclip;
-    uint32 lenseq;
-    uint32 lenclippedseq;
-
-    int8  dir;
-    uint8  seqtype;
-    bool   israil;
-    bool   isbackbone;
-    bool   iscer;
-
-    rpicsocache_t(PlacedContigReads::const_iterator & p, int32 rso, int32 u, int8 d, int32 lc, int32 rc, uint32 ls, uint32 lcs, uint8 st, bool rail, bool bb, bool cer) : pcrI(p), readstartpos(rso), urdid(u), dir(d), leftclip(lc), rightclip(rc), lenseq(ls), lenclippedseq(lcs), seqtype(st), israil(rail), isbackbone(bb), iscer(cer) {};
-
-    friend std::ostream & operator<<(std::ostream &ostr, const rpicsocache_t & rpic){
-      ostr << "rpic ";
-      if(rpic.dir>0) {
-	ostr << '+';
-      }else{
-	ostr << '-';
-      }
-      ostr << rpic.pcrI->getName()
-	   << '\t' << rpic.readstartpos
-	   << '\t' << rpic.urdid
-	   << '\t' << rpic.lenclippedseq;
-      return ostr;
+  inline uint8 getBBStrainMask(int32 strainid) {
+    int32 strainmask=0;
+    if(strainid>7 || strainid<0) {
+      throw Notify(Notify::FATAL, "uint8 Contig::getBBStrainMask(int32 strainid)", "Mapping >=8 Solexa strains? Sorry, not possible yet.");
     }
-  };
-  void makeIntelligentConsensus_helper1(
-    char & thisbase, base_quality_t & thisqual,
-    std::vector<char> & IUPACbasegroups,
-    const uint32 actcontigpos,
-    cccontainer_t::const_iterator ccI,
-    const int32 mincoverage,
-    std::vector<nngroups_t> & groups,
-    std::vector<nngroups_t> & maskedshadowgroups,
-    const std::vector<rpicsocache_t> & read_pcrIs_in_col,
-    std::vector<int8> & maskshadow,
-    uint8 actreadtype,
-    int32 strainidtotake,
-    const bbstrainmask_t strainmask,
-    char missingcoveragechar
-    );
-  void priv_mic_helper_chooseOneBase(char & thisbase,
-				     base_quality_t & thisqual,
-				     const std::vector<uint32> & allstpossiblebases,
-				     const std::vector<std::vector<nngroups_t>> & groups);
-  void priv_mic_helper_chooseMultiBase(char & thisbase,
-				       base_quality_t & thisqual,
-				       const std::vector<uint32> & allstpossiblebases,
-				       const std::vector<std::vector<nngroups_t>> & groups);
-  int8 priv_mic_helper_rateGoodnessLevelOfAllGroups(cccontainer_t::const_iterator ccI,
-						    const std::vector<std::vector<nngroups_t>> & allgroups,
-						    std::vector<std::vector<int8>> & predictlevels,
-						    const std::vector<std::vector<char>> & possiblebases);
-  int8 priv_mic_helper_rateGoodnessLevelOfGroup(cccontainer_t::const_iterator ccI,
-						const nngroups_t & groups,
-						uint32 numpossiblebases,
-						uint8 seqtype);
-  void priv_mic_helper_filterGoodnessLevels(cccontainer_t::const_iterator ccI,
-					    int8 maxacceptlevel,
-					    std::vector<std::vector<int8>> & predictlevels,
-					    std::vector<std::vector<nngroups_t>> & allgroups,
-					    std::vector<uint32> & allstpossiblebases,
-					    uint8 & numpossiblebases);
-
-//  void priv_mic_helper_chooseDiploidBase(char & thisbase,
-//					 base_quality_t & thisqual,
-//					 const std::vector<uint8> & allstpossiblebases,
-//					 const std::vector<std::vector<nngroups_t>> & groups,
-//					 uint8 numpossiblebases);
-
-  void makeIntelligentConsensus(std::string & target,
-				std::vector<base_quality_t> & qual,
-				std::vector<int32> * targetadjustments,
-				int32 from,
-				int32 to,
-				int32 strainidtotake=-1,
-				int32 mincoverage=0,
-				base_quality_t minqual=0,
-				char missingcoveragechar='@',
-				bool assumediploid=false,
-				bool allowiupac=true,
-				bool addconstag=true);
-//				std::ostream * ostr=nullptr,
-//				bool contagsintcs=true);
-
-
-
-
-/* TODO: reactivate with PlacedContigReads
-  int deepThought(const contigread_t &aRead, int offset, char base);
-		  //		  SCF_buffer &theBuffer);
-  bool analyseRMBZones(const contigread_t & ric, std::vector<int32> & RMBdangeroverlaps);
-  bool analyseDangerZones(const contigread_t & ric);
-  //bool analyseAllZones(const contigread_t & ric);
-*/
+    BITSET(strainid, strainmask);
+    return static_cast<uint8>(strainmask);
+  }
+  void getMappedBBStrainIDsFromMask(vector<int32> & strains, uint8 mask);
 
+  void myappend(string & a, const string & b, const string & concatstring) const;
 
-/*************************************************************************
- *
- *
- *  PUBLIC
- *
- *
- *************************************************************************/
 
 public:
-  Contig(std::vector<MIRAParameters> * params, ReadPool & readpool);
+  Contig(vector<MIRAParameters> * params, ReadPool & readpool);
   Contig(Contig const &other);
   ~Contig();
 
-  static void setMasterCEBUGFlag(bool f) {CON_mastercebugflag=f;};
+  void reserveCapacity(uint32 expectedlen, uint32 expectedreads);
+  
+  void dumpStatus(ostream & ostr);
+  void dumpAsText(ostream &ostr, 
+//		  const string & consseq, 
+//		  const vector<base_quality_t> & consqual, 
+		  const int32 frompos = -1, 
+		  const int32 topos = -1);
+  void dumpAsHTML(ostream &ostr, 
+//		  const string & consseq, 
+//		  const vector<base_quality_t> & consqual, 
+		  const int32 frompos = -1, 
+		  const int32 topos = -1);
+
+  void dumpStrainAsFASTAQUAL(ostream & fout,
+			     ostream & qout, 
+			     uint32 mincoverage,
+			     base_quality_t minqual, 
+			     int32 strainidtotake,
+			     bool padded,
+			     bool fillholesinstrain);
+  void dumpStrainAsFASTQ(ostream & fout,
+			 uint32 mincoverage,
+			 base_quality_t minqual, 
+			 int32 strainidtotake,
+			 bool padded,
+			 bool fillholesinstrain);
+
+  void dumpConReads();
+
+  static void dumpContigStatistics_Head(ostream &ostr);
+  void dumpContigStatistics_Body(ostream &ostr);
+  static void dumpContigReadList_Head(ostream &ostr);
+  void dumpContigReadList_Body(ostream &ostr);
+  static void dumpReadTagList_Head(ostream &ostr);
+  void dumpReadTagList_Body(ostream &ostr);
+  static void dumpConsensusTagList_Head(ostream &ostr);
+  void dumpConsensusTagList_Body(ostream &ostr);
+  static void dumpTCS_Head(ostream &ostr);
+  void dumpTCS_Body(ostream &ostr);
+  static void dumpWiggle_Head(ostream &ostr);
+  void dumpWiggle_Body(ostream &ostr, string & cons);
 
   Contig const & operator=(Contig const & other);
-  friend std::ostream & operator<<(std::ostream &ostr, Contig const &con);
+  friend ostream & operator<<(ostream &ostr, Contig const &con);
+  void saveAsGAP4DA(const string & dirname, ostream & fofnstr);
 
   void saveMem();
 
+  void stats(ostream &ostr);
   const constats_t & getStats() { calcStats(); return CON_stats; };
 
-  void setParams(std::vector<MIRAParameters> * params);
+  void setParams(vector<MIRAParameters> * params);
+
+  static void setCoutType(uint8 type);
 
   uint32 getContigID() const {return CON_id;};
   void   setContigID(uint32 id) {CON_id=id;};
-  void   setContigNamePrefix(const std::string & pname) {CON_nameprefix=pname;};
-  const std::string & getContigName() const;
-  void   setContigName(const std::string & name);
-
-  uint32  getNumBackbones() const;
-  inline bool isBackBoneContig() const {return CON_isbackbonecontig;}
+  void   setContigNamePrefix(const string & pname) {CON_nameprefix=pname;};
+  const string & getContigName() const;
+  void   setContigName(const string & name);
 
   void trashConsensusCache(bool qualonly) {
     nukeSTLContainer(CON_fixedconsqual);
     if(!qualonly) nukeSTLContainer(CON_fixedconsseq);
   };
+//  void OLDgetConsensus1(string & target, 
+//		    vector<base_quality_t> & qual, 
+//		    bool markspecials,
+//		    int32 mincoverage=0,
+//		    base_quality_t minqual=0,
+//		    int32 strainidtotake=-1,
+//		    char missingcoveragechar='@',
+//		    ostream * ostr=NULL,
+//		    bool contagsintcs=true);
 
-  uint32 getNumReadsPerReadGroup(uint32 rgnum) const {
-    if(rgnum>=CON_readsperreadgroup.size()) return 0;
-    return CON_readsperreadgroup[rgnum];
-  }
-  uint32 getNumReadsPerStrain(uint32 sid) const {
-    if(sid>=CON_readsperstrain.size()) return 0;
-    return CON_readsperstrain[sid];
-  }
+  void calcConsensi(int32 mincoverage=0,
+		    base_quality_t minqual=0,
+		    char missingcoveragechar='@');
+  void newConsensusGet(string & target, 
+		       vector<base_quality_t> & qual, 
+		       int32 strainidtotake=-1);
+  void ensureConsensus(int32 strainidtotake=-1);
 
   uint32 getNumReadsInContig() const {return static_cast<uint32>(CON_reads.size());};
   uint32 getContigLength() const {return static_cast<uint32>(CON_counts.size());};
 
-  bool getLongRepeatStatus() const {return CON_contains_long_repeats_only;}
-  void setLongRepeatStatus(bool b) {CON_contains_long_repeats_only=b;}
-  void calcDigitalNormalisationStatus();
-
-  void getStrainsOfBackbone(std::vector<int32> & sob) const;
+  bool getLongReapeatStatus() const {return CON_contains_long_repeats_only;}
+  void setLongReapeatStatus(bool b) {CON_contains_long_repeats_only=b;}
 
   void discard();
 
@@ -1492,40 +1178,86 @@ public:
   void setSpecialSRAddConditions(const int32 maxtotalerrors,
 				 const int32 maxgaps,
 				 const int32 maxmismatches);
-
-  void setContigCoverageTarget(std::vector<uint32>);
+  void allowedRefIDs_forbidAll();
+  void allowedRefIDs_allowAll();
+  void allowedRefIDs_allowSomeRailsOnShortReadCoverage(
+    int32 belowcoverage, 
+    int32 strainid,
+    uint8 seqtype);
+  const vector<bool> & getAllowedRefIDs() {return CON_allowedrefids;};
+
+  void setContigCoverageTarget(vector<uint32>);
+  void addFirstRead(int32 id, uint32 direction);
   void addRead(
-    std::vector<Align> & aligncache,
-    const AlignedDualSeqFacts * initialadsf,
+    vector<Align> & aligncache,
+    const AlignedDualSeqFacts * ads,
+    int32 refid,
+    int32 newid,
+    int32 direction_frnid,
+    bool  newid_ismulticopy,
+    int32 forcegrow,
+    errorstatus_t & errstat);
+  void addRead_wrapped(
+    vector<Align> & aligncache,
+    const AlignedDualSeqFacts * ads,
     int32 refid,
     int32 newid,
     int32 direction_frnid,
     bool  newid_ismulticopy,
     int32 forcegrow,
-    templateguessinfo_t & templateguess,
     errorstatus_t & errstat);
-  void addFirstRead(int32 id, int8 direction);
-  void coutAddReadTimings();
-
 
   void addConsensusSequenceAsReadToContig(int32 strainid);
 
-  PlacedContigReads::const_iterator deleteRead(PlacedContigReads::const_iterator pcrI);
-  const std::vector<int32> & getLastDangerzoneOverlapIDS() const {return CON_last_dangerous_overlaps;};
+  void deleteRead(int32 id);
+  const vector<int32> & getLastDangerzoneOverlapIDS() const {return CON_last_dangerous_overlaps;};
 
-  void initialiseContig(const std::list<contig_init_read_t> & rlist,
-			std::vector<multitag_t> & tags,
-			const std::string & contigname,
-			std::string & fixedseq,
-			std::vector<base_quality_t> & fixedqual);
+  void initialiseContig(uint32 contig_length, 
+			const list<contig_init_read_t> & rlist,
+			vector<tag_t> & tags,
+			const string & contigname,
+			string & fixedseq,
+			vector<base_quality_t> & fixedqual);
+
+  void markPossibleRepeats(uint32 & numSRMBs, 
+			   uint32 & numWRMBs, 
+			   uint32 & numSNPs);
+  //void markMissedSNPs();
+  void markFeaturesByConsensus(bool markSROs, bool markUNSs, bool markIUPACs);
+
+  void newMarkPossibleRepeats(repeatmarker_stats_t & repstats, 
+			      vector<bool> & readsmarkedsrm);
+
+  uint32 getBaseRunLength(const Read & read, 
+			  const uint32 readpos, 
+			  const char base,
+			  uint32 & from, 
+			  uint32 & to, 
+			  uint32 & zeroqualcounts,
+			  bool useclipsasends=false);
+  void largeGapRepeatMarker(uint32 mingaplen,
+			    uint32 mingroupsize,
+			    bool needbothstrands);
+  void codonSingleBaseRepeatMarker(uint32 mingroupsize,
+				   repeatmarker_stats_t & repstats, 
+				   vector<bool> & readsmarkedsrm);
+  void csbrm_fillin_groups_stst(
+    const ercci_t & ercci,
+    const vector<int8> & maskshadow,
+    const vector<multitag_t::mte_id_t> & masktagtypes,
+    vector<vector<vector <nngroups_t> > > & groups_st_st);
+  bool csbrm_checkReadsForHomopolymers(uint32 actcontigpos,
+				       uint32 maxrunallowed,
+				       const vector<int32> & checkthesereads);
+  bool csbrm_checkForCleanBlock(cccontainer_t::iterator ccI);
 
   char getBaseInRead(int32 contigposition,
-		     const PlacedContigReads::const_iterator & pcrI) const;
+		     int32 readindex) const;
   base_quality_t getQualityInRead(int32 contigposition,
-				  const PlacedContigReads::const_iterator & pcrI) const;
+		     int32 readindex) const;
   void changeBaseInRead(char base,
 			int32 contigposition,
-			int32 readindex,
+			int32 readindex, 			
 			base_quality_t quality=BQ_UNDEFINED);
   void insertBaseInRead(char base,
 			int32 contigposition,
@@ -1533,321 +1265,159 @@ public:
 			base_quality_t quality=BQ_UNDEFINED);
   void deleteBaseInRead(int32 contigposition, int32 readindex);
 
-  int32 chompFront(int32 maxchecklen, bool doshiftreads=true);
-  int32 chompBack(int32 maxchecklen);
-  void trimMapOverhang();
 
   void adjustReadOffsets(int32 contigposition, int32 offset);
-
-  void addTagToRead(uint32 contigpositionfrom,
-		    uint32 contigpositionto,
-		    int32 readindex,
-		    multitag_t & mt);
-
-  consensustag_t & addTagToConsensus(const uint32 contigpositionfrom,
-				     const uint32 contigpositionto,
-				     const char strand,
-				     const char * identifier,
-				     const char * comment,
-				     const bool doublecheck);
-
+  void deleteStarOnlyColumns(int32 from, 
+			     int32 to,
+			     bool alsononly=false,
+			     uint32 mincov=1,
+			     bool updateconcounts=true);
+  uint32 createPacBioDarkStrobeEdits(list<pbdse_t> & pbdsev);
+
+  void addTagToRead(const uint32 contigpositionfrom,
+		    const uint32 contigpositionto,
+		    const int32 readindex,
+		    const string & identifier,
+		    const string & comment);
+  void addTagToRead(const uint32 contigpositionfrom,
+		    const uint32 contigpositionto,
+		    const int32 readindex,
+		    const char * identifier,
+		    const char * comment);
+
+  void addTagToConsensus(const uint32 contigpositionfrom,
+			 const uint32 contigpositionto,
+			 const char strand, 
+			 const char * identifier,
+			 const char * comment,
+			 const bool doublecheck,
+			 const bool additionalinfo=false,
+			 const base_quality_t qualA=0,
+			 const base_quality_t qualC=0,
+			 const base_quality_t qualG=0,
+			 const base_quality_t qualT=0,
+			 const base_quality_t qualStar=0);
+
+  // first function to use strings
+  //bool hasConsensusTag(const string & identifier) const;
   bool hasConsensusTag(const multitag_t::mte_id_t identifier) const;
 
   void sortConsensusTags() {sort(CON_consensus_tags.begin(),CON_consensus_tags.end(),consensustag_t_comparator);};
-  const std::vector<consensustag_t> & getConsensusTags() const {return CON_consensus_tags;};
+  const vector<consensustag_t> & getConsensusTags() const {return CON_consensus_tags;};
   void clearConsensusTags() {CON_consensus_tags.clear();};
+  //void deleteTagsInReads(const string & identifier);
   void deleteTagsInReads(const multitag_t::mte_id_t identifier);
+  void reduceConsensusTags(const vector<multitag_t::mte_id_t> & mastertags,
+			   const vector<multitag_t::mte_id_t> & deletecandidates);
 
   void updateStatsFromConsensusTags(bool countSRMcs,
-				    bool countWRMcs,
+				    bool countWRMcs, 
 				    bool countIUPACs,
 				    bool countSTMUs,
 				    bool countSTMSs);
 
+  const Read & getReadAtIndex(int32 index) const;
+  const Read & getReadWithID(int32 readid) const;
+
   static void setIDCounter(uint32 num) { CON_id_counter=num;}
   const cccontainer_t & getConsensusCounts() const
     { return CON_counts;}
-  const PlacedContigReads & getContigReads() const
+  const vector<contigread_t> & getContigReads() const
     { return CON_reads;}
-
-  inline PlacedContigReads::const_iterator getFirstPCRIForReadsCoveringPosition(int32 pos1) const
-    {
-      auto pcrI(CON_reads.begin());
-      if(pos1>=CON_longestreadseen+1) {
-	pcrI=CON_reads.getPCRIForReadsStartingAtPos(pos1-CON_longestreadseen-1);
-      }
-      return pcrI;
-    }
-  inline PlacedContigReads::const_iterator getFirstPCRIForNonBBReadsCoveringPosition(int32 pos1) const
-    {
-      auto pcrI(CON_reads.begin());
-      auto mv=std::max(CON_longestnonbbreadseen,CON_longestrailseen)+1;
-      if(pos1>=mv) {
-	pcrI=CON_reads.getPCRIForReadsStartingAtPos(pos1-mv);
-      }
-      return pcrI;
-    }
-  inline PlacedContigReads::const_iterator getFirstPCRIForRailsCoveringPosition(int32 pos1) const
-    {
-      auto pcrI(CON_reads.begin());
-      if(pos1>=CON_longestrailseen+1) {
-	pcrI=CON_reads.getPCRIForReadsStartingAtPos(pos1-CON_longestrailseen-1);
-      }
-      return pcrI;
-    }
-
-
-  void priv_arw_getReadsAffected(const readid_t refid,
-				 const readid_t newid,
-				 std::vector<readid_t> & reads_affected,
-				 const int32 xcut,
-				 const int32 ycut);
-  void getReadORPIDsAtContigPosition(std::vector<int32> & vec,
-						int32 pos1,
-						int32 pos2=-1) const;
-  void getRailsAsReadsAffected(const int32 refid,
-			       std::vector<int32> & reads_affected,
-			       const int32 xcut,
-			       const int32 ycut);
-
-
-  void getPCRIteratorsAtContigPosition(std::vector<PlacedContigReads::const_iterator> & vec,
-				       int32 pos1,
-				       int32 pos2=-1) const;
-  // TODO: obsolete!
-  // This is present in EdIt only now, need to change EdIt
-  //
-  std::vector<int32> & getCRIndicesAtContigPosition(std::vector<int32> & vec,
+  vector<int32> & getCRIndicesAtContigPosition(vector<int32> & vec,
                                                int32 pos1,
                                                int32 pos2=-1) const;
-  //
-  //
-  //
-
-
+  vector<int32> & getReadIDsAtContigPosition(vector<int32> & vec, 
+					     int32 pos1, 
+					     int32 pos2=-1) const;
 
+  //  int32 getContigPosAtReadPos(int32 readpos, int32 readindex) const;
 
-
-  int32 getRealReadPos(const uint32 contigpos, const PlacedContigReads::const_iterator & pcrI) const;
+  int32 unclippedReadPosToContigPos(const int32 readpos, const contigread_t &ric) const;
+  int32 contigPosToUnclippedReadPos(const int32 contigpos, const contigread_t &ric) const;
+  int32 getRealReadPos(const int32 contigpos, const uint32 readindex) const;
+  int32 getRealReadPos(const int32 contigpos, const contigread_t &ric) const;
 
   int32 paddedPos2UnpaddedPos(uint32 padpos);
 
   void interpolateSRMValuesInCONcounts(cccontainer_t::iterator ccI);
   void initialiseBaseLocks();
   void updateReadTagsFromReadPool();
-  void updateBaseLocks(PlacedContigReads::const_iterator pcrI, bool addiftrue);
-
+  void updateBaseLocks(const contigread_t & ric, bool addiftrue);
   void transposeReadSRMTagsToContig();
 
-  void setupAsBackBoneContig();
-
-  size_t addRails(const uint32 raillength,
+  size_t addRails(const uint32 raillength, 
 		const uint32 railoverlap,
-		const std::string & straintxt,
+		const string & straintxt,
 		const bool forcestrainset,
-		const std::string & railfromstrain,
+		const string & railfromstrain,
 		const bool simulateonly);
 
-  size_t addSubsequences(const uint32 raillength,
+  size_t addSubsequences(const uint32 raillength, 
 			 const uint32 railoverlap,
-			 const std::string & straintxt,
+			 const string & straintxt,
 			 const bool forcestrainset,
-			 const std::string & railfromstrain,
+			 const string & railfromstrain,
 			 const bool asbackbone,
-			 const std::string & bbseq,
-			 const std::vector<base_quality_t> & bbqualvec,
-			 const std::string & backbonename,
+			 const string & bbseq, 
+			 const vector<base_quality_t> & bbqualvec, 
+			 const string & backbonename,
 			 const bool initccbbvalues,
 			 const bool simulateonly);
 
+//  void addRails(const uint32 raillength, 
+//		const string & straintxt, 
+//		const int32 bbquals, 
+//		const bool asbackbone = false,
+//		const string & backbonename = "");
+
   void removeRails();
-  void stripToBackbone();
   static void resetCERNumbering() {CON_cer_idcounter=0;};
   void transformCERMappingsToCoverageReads();
-  void recalcTemplateIDsAndStrainPresent();
-
-  void exchangeReadIDs(std::vector<uint32> & newids, std::vector<uint32> & reversemap);
-
-  /****************************************************
-   * contig_output.C
-   ****************************************************/
-
-  static void setCoutType(uint8 type);
-
-  void dumpStats(std::ostream &ostr);
-  void dumpAsText(std::ostream &ostr,
-		  const int32 frompos = -1,
-		  const int32 topos = -1);
-  void dumpAsHTML(std::ostream &ostr,
-		  const int32 frompos = -1,
-		  const int32 topos = -1);
-
-  void dumpConReads();
-
-  void dumpStrainAsFASTAQUAL(std::ostream & fout,
-			     std::ostream & qout,
-			     uint32 mincoverage,
-			     base_quality_t minqual,
-			     int32 strainidtotake,
-			     bool padded,
-			     bool fillholesinstrain);
-  void dumpStrainAsFASTQ(std::ostream & fout,
-			 uint32 mincoverage,
-			 base_quality_t minqual,
-			 int32 strainidtotake,
-			 bool padded,
-			 bool fillholesinstrain);
-
-  void dumpAsSAM(std::ostream & ostr, const SAMCollect & samc, bool alsobackbone);
-  void saveAsGAP4DA(const std::string & dirname, std::ostream & fofnstr);
-
-  static void dumpContigReadList_Head(std::ostream &ostr);
-  void dumpContigReadList_Body(std::ostream &ostr);
-  static void dumpContigStatistics_Head(std::ostream &ostr);
-  void dumpContigStatistics_Body(std::ostream &ostr);
-  static void dumpReadTagList_Head(std::ostream &ostr);
-  void dumpReadTagList_Body(std::ostream &ostr);
-  static void dumpConsensusTagList_Head(std::ostream &ostr);
-  void dumpConsensusTagList_Body(std::ostream &ostr);
-  static void dumpMAF_Head(std::ostream &ostr);
-  static void dumpTCS_Head(std::ostream &ostr);
-  void dumpTCS_Body(std::ostream &ostr);
-  static void dumpWiggle_Head(std::ostream &ostr);
-  void dumpWiggle_Body(std::ostream &ostr, std::string & cons, bool aspadded);
-  void dumpGCWiggle_Body(std::ostream &ostr, std::string & cons);
-
-  void dumpTagsAsGFF3(std::ostream & ostr, std::string & padcons);
-  void dumpTagsAsGFF3(std::ostream & ostr) {std::string dummy; dumpTagsAsGFF3(ostr,dummy);};
-
-  void dumpStatus(std::ostream & ostr);
-  void debugDump();
-
-  static void setOutputRails(bool b) {CON_outputrails=b;}
-
-
-  /****************************************************
-   * contig_edit.C
-   ****************************************************/
-  void reduceReadsAtCoveragePeaks(ccctype_t avgcov, std::vector<uint8> & peakindicator, std::unordered_set<readid_t> & readsremoved);
+  void recalcTemplateAndStrainIDsPresent();
+
+  void getGBFSummary(list<gbfsummary_t> & allGBfeatures, 
+		     const vector<multitag_t::mte_id_t> & allowedfeatures, 
+		     const vector<multitag_t::mte_id_t> & forbiddenfeatures,
+		     bool simulateintergenics) const; 
+  void concatAllGBFInfoForLocus(const list<gbfsummary_t> & allGBfeatures,
+				list<gbfsummary_t>::const_iterator gbfsI,
+				const string & concatstring,
+				string & gene,
+				string & function,
+				string & ecnumber,
+				string & product,
+				string & note) const;
 
   bool hasEditableOvercallData() const;
-  bool hasSeqTypeData(uint8 seqtype) const;
+  bool hasPacBioData() const;
 
-  uint32 createPacBioDarkStrobeEdits(std::list<pbdse_t> & pbdsev);
-  uint32 deleteStarOnlyColumns() { return deleteStarOnlyColumns(0,CON_counts.size(),false,1);}
-  uint32 deleteStarOnlyColumns(int32 from,
-			     int32 to,
-			     bool alsononly=false,
-			     uint32 mincov=1);
   uint32 editTrickyOvercalls(const bool onlysetPSHPtags,
 				const bool noSRMreadsallowed,
-				std::vector<bool> & readsmarkedsrm);
-  uint32 edit454checkTrickies(const char basehypo,
-			      const uint32 actcontigpos,
-			      const std::vector<PlacedContigReads::const_iterator> & pcrIs_in_col,
-			      std::vector<edit454command_t> & editcommands,
+				vector<bool> & readsmarkedsrm);
+  uint32 edit454checkTrickies(const char basehypo, 
+			      const uint32 actcontigpos, 
+			      const vector<int32> & read_ids_in_col,
+			      vector<edit454command_t> & editcommands,
 			      const bool onlysetPSHPtags,
 			      const bool noSRMreadsallowed);
-  uint32 editSingleDiscrepancyNoHAFTag(std::vector<bool> & readsmarkedsrm, uint8 editmode);
-  void editPBSledgeHammer(std::vector<bool> & readsmarkedsrm,
-			  uint32 & numcoledits,
-			  uint32 & numreadedits);
+  uint32 editSingleDiscrepancyNoHAFTag(vector<bool> & readsmarkedsrm);
 
-  void blindContig();
-  void upDownCase(base_quality_t threshold);
-
-
-  /****************************************************
-   * contig_featureinfo.C
-   ****************************************************/
-
-  void getGBFSummary(std::list<gbfsummary_t> & allGBfeatures,
-		     const std::vector<multitag_t::mte_id_t> & allowedfeatures,
-		     const std::vector<multitag_t::mte_id_t> & forbiddenfeatures,
-		     bool simulateintergenics,
-		     bool alsomiraconstags) const;
-  void concatAllGBFInfoForLocus(const std::list<gbfsummary_t> & allGBfeatures,
-				std::list<gbfsummary_t>::const_iterator gbfsI,
-				const std::string & concatstring,
-				std::string & gene,
-				std::string & function,
-				std::string & ecnumber,
-				std::string & product,
-				std::string & note) const;
-
-  void getSeqOntTags(std::list<contigSOtag_t> & allSOfeatures);
-  void calcSOTagCoverage(const std::list<contigSOtag_t> & features, std::list<tagcoverageinfo_t> & result);
-
-
-  /****************************************************
-   * contig_analysis.C
-   ****************************************************/
-
-  std::pair<int32,int32> findBestNonMisassembledRange();
-  void trimContigToRange(uint32 from, uint32 to);
-  bool tctr_helper1(uint32 from, uint32 to, bool simulateonly);
-  void tctr_helper2();
-  void tctr_helper3();
-
-  void allowedRefIDs_forbidAll();
-  void allowedRefIDs_allowAll();
-  void allowedRefIDs_allowSomeRailsOnShortReadCoverage(int32 belowcoverage,
-						       int32 strainid,
-						       uint8 seqtype);
-  const std::vector<bool> & getAllowedRefIDs() const {return CON_allowedrefids;};
-  void newMarkPossibleRepeats(repeatmarker_stats_t & repstats,
-			      std::vector<bool> & readsmarkedsrm);
-  void markFeaturesByConsensus(bool markSROs, bool markUNSs, bool markIUPACs);
-  bool analyseReadCoverage(std::vector<uint32> & maxcovperread,
-			   std::vector<uint8> & multicopies,
-			   std::vector<uint32> covperst);    // no reference here!
-  void largeGapRepeatMarker(uint32 mingaplen,
-			    uint32 mingroupsize,
-			    bool needbothstrands);
-  void codonSingleBaseRepeatMarker(uint32 mingroupsize,
-				   repeatmarker_stats_t & repstats,
-				   std::vector<bool> & readsmarkedsrm);
-  bool shouldHaveTPartnerInContig(PlacedContigReads::const_iterator pcrI,
-				  PlacedContigReads::const_iterator opcrI);
-
-
-  /****************************************************
-   * contig_pairconsistency.C
-   ****************************************************/
-  std::pair<int32,int32> findBestPairConsistencyRange();
-  void priv_cprForRGID(ReadGroupLib::ReadGroupID rgid,
-		       std::vector<uint64> & spanner,
-		       std::vector<uint64> & spanner12,
-		       std::vector<uint64> & nonspanner);
 
-  /****************************************************
-   * contig_covanalysis.C
-   ****************************************************/
+  bool analyseReadCoverage(vector<uint32> & maxcovperread, 
+			   vector<uint8> & multicopies,
+			   vector<uint32> covperst);    // no reference here!
 
-  void collectCoverage(uint32 from, uint32 to, std::vector<uint64> & covvals);
-  void collectCoverage(std::vector<uint64> & covvals) {collectCoverage(0,CON_counts.size()-1,covvals); }
-  void calcStatsOnContainer(coverageinfo_t & tci, std::vector<uint64> & covvals) const;
-  void calcSecondOrderStatsOnContainer(coverageinfo_t & tci, const std::vector<uint64> & covvals) const;
-  void findPeaks(ccctype_t avgcov, std::vector<uint8> & peakindicator);
+  void setupAsBackBoneContig();
 
+  void blindContig();
+};
 
-  /****************************************************
-   * contig_consensus.C
-   ****************************************************/
 
-  void calcConsensi(int32 mincoverage=0,
-		    base_quality_t minqual=0,
-		    char missingcoveragechar='X',
-		    bool addconstag=true);
-  void newConsensusGet(std::string & target,
-		       std::vector<base_quality_t> & qual,
-		       int32 strainidtotake=-1);
-  void ensureConsensus(int32 strainidtotake=-1);
+#include "examine/scf_look.H"
 
-  void updateBackboneConsensus();
 
+#endif
 
-};
 
 
-#endif
diff --git a/src/mira/contig_analysis.C b/src/mira/contig_analysis.C
index 1c9c4b6..51866ee 100644
--- a/src/mira/contig_analysis.C
+++ b/src/mira/contig_analysis.C
@@ -11,34 +11,28 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
+// 	$Id$	
 
-#include "mira/contig.H"
+#ifndef lint
+static char vcid2[] = "$Id$";
+#endif /* lint */
 
-#include "util/dptools.H"
-#include "util/progressindic.H"
+#include "contig.H"
 #include "util/misc.H"
 
-#ifdef MIRA_HAS_EDIT
-#include "examine/scf_look.H"
-#endif
-
-
-using namespace std;
-
-
 //#define CEBUGFLAG
 #ifdef CEBUGFLAG
 #define CEBUG(bla)   {cout << bla; cout.flush();}
@@ -52,390 +46,112 @@ using namespace std;
 
 
 
-
-
-/*************************************************************************
- *
- * Gives back the "best" range which should be free of misassemblies
- * needs SRMc marked
- *
- * 1. collect all ranges free of SRMc
- * 2. ...
- *
- *************************************************************************/
-
-std::pair<int32,int32> Contig::findBestNonMisassembledRange()
-{
-  FUNCSTART("void Contig::findBestNonMisassembledRange()");
-
-  pair<int32,int32> ret(-1,-1);
-
-  // we might have been called with a contig which has been discarded (empty)
-  //  -> bail out before posset(CON_counts.size(),0) creates a segfault
-  // or has no consensus tags set, then we can return anyway
-  if(CON_counts.empty()
-     || CON_consensus_tags.empty()){
-    return ret;
-  }
-
-  cout << "Looking for best SRM free range in contig " << endl;
-
-  // just in case we have data not generated by MIRA with SRMc tags of length >1
-  //  or with overlapping SRMc, do it the the complicated way
-  vector<uint8> posset(CON_counts.size(),0);
-  for(auto & cte : CON_consensus_tags){
-    BUGIFTHROW(cte.from<0 || cte.to>=CON_counts.size(),"Ooops for a tag?\n" << cte << "\ncte.from " << cte.from << "<0 || cte.to " << cte.to << " >=CON_counts.size() " << CON_counts.size());
-    if(cte.identifier==CON_tagentry_idSRMc){
-      for(auto pos=cte.from; pos<=cte.to; ++pos){
-	posset[pos]=1;
-      }
-    }
-  }
-
-  vector<int32> ranges;
-  uint32 pos=0;
-  while(posset[pos] && pos<posset.size()) ++pos;
-  while(pos < posset.size()){
-    ranges.push_back(pos);
-    for(;posset[pos]==0 && pos<posset.size(); ++pos) {}
-    ranges.push_back(pos);
-    // if we're at end of contig, then the range (being [ [) must end one after
-    if(pos==posset.size()) ++ranges.back();
-
-    for(;posset[pos] && pos<posset.size(); ++pos) {}
-  }
-
-  if(ranges.size()>2){
-    int32 largest=0;
-    uint32 lindex=0;
-    uint32 rindex=0;
-    for(uint32 ri=0; ri<ranges.size()-1; ++ri){
-      cout << "Range " << ranges[ri] << '\t' << ranges[ri+1] << endl;
-      if(ranges[ri+1]-ranges[ri] > largest){
-	lindex=ri;
-	rindex=ri+1;
-	largest=ranges[rindex]-ranges[lindex];
-      }
-    }
-    cout << "Largest OK: " << ranges[lindex] << '\t' << ranges[rindex] << '\t' << getContigName() << endl;
-    ret=make_pair(ranges[lindex],ranges[rindex]);
-    //trimContigToRange(ranges[lindex],ranges[rindex]);
-  }else{
-    cout << "Full contig OK.\n";
-  }
-  return ret;
-}
-
-
-
-/*************************************************************************
- *
- * Given a range, trims down the contig so that just reads in the range
- *  stay
- *
- * from[ to[
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-void Contig::trimContigToRange(uint32 frompos, uint32 topos)
-{
-  FUNCSTART("void Contig::trimContigToRange(uint32 frompos, uint32 topos)");
-  try{
-    CEBUG("trimContigToRange clen: " << getContigLength() << endl);
-    if(tctr_helper1(frompos,topos,true)){
-      tctr_helper1(frompos,topos,false);
-
-      // the above may resulted in holes in the contig (no coverage), this can
-      //  happen when reads are of very different sizes
-      //
-      //  ----------------------------------------------------
-      //       -----------------------------------------------
-      //            -----------
-      //                                 ---------------------
-      //         ^
-      //         cut here
-      // leads to:  xxxxxxxxxxx0000000000xxxxxxxxxxxxxxxxxxxxx
-      //
-      // Note that the 0 coverage area might have a 0 length when reads
-      //  are adjacent but not overlapping or overlapped by other reads
-      //            -----------
-      //                       ---------------------
-      // Both reads are removed then
-
-      // remove coverage-1 reads
-      tctr_helper2();
-
-      // we still can have holes
-      //    -----------          ------------
-      //        ------------       --------
-      tctr_helper3();
-
-      deleteStarOnlyColumns();
-    }
-  }
-  catch(Notify n) {
-    n.handleError(THISFUNC);
-  }
-}
-//#define CEBUG(bla)
-
-/*************************************************************************
- *
- * Helper, count or remove contigs outside of range
- *
- * from[ to[
- *
- * but keep at least one read
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-bool Contig::tctr_helper1(uint32 frompos, uint32 topos, bool simulateonly)
-{
-  FUNCSTART("bool Contig::tctr_helper1(uint32 frompos, uint32 topos, bool simulateonly)");
-
-  CEBUG("tctr_helper1\n");
-  if(!simulateonly)  CEBUG("Cutting down " << getContigName() << " down to " << frompos << " " << topos << endl);
-
-  size_t numremoved=0;
-  bool readskept=false;
-  auto pcrI=CON_reads.begin();
-  while(pcrI!=CON_reads.end()){
-    if(pcrI.getReadStartOffset() < frompos
-       || pcrI.getReadStartOffset() + pcrI->getLenClippedSeq() >= topos){
-      ++numremoved;
-      if(!simulateonly){
-	if(CON_reads.size()>1){
-	  // update of internal contig statistics
-	  --CON_readsperstrain[pcrI->getStrainID()];
-	  --CON_readsperreadgroup[pcrI->getReadGroupID().getLibId()];
-	  CEBUG("Removing " << pcrI->getName() << endl);
-	  pcrI=CON_reads.removeRead(pcrI);
-	}else{
-	  --numremoved;
-	  ++pcrI;
-	}
-      }else{
-	++pcrI;
-      }
-    }else{
-      readskept=true;
-      ++pcrI;
-    }
-  }
-
-  BUGIFTHROW(CON_reads.begin() == CON_reads.end(),"Oooops, deleted everything?");
-
-  if(!simulateonly && numremoved){
-    definalise();
-    priv_rebuildConCounts();
-    chompFront(-1);
-    chompBack(-1);
-  }
-
-  return readskept;
-}
-//#define CEBUG(bla)
-
-
-/*************************************************************************
- *
- * Removes all reads covering positions of the contig where coverage == 1
- *
- * but keep at least one read
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-void Contig::tctr_helper2()
-{
-  CEBUG("tctr_helper2\n");
-
-  if(CON_reads.size()<=1) return;
-
-  uint32 numremoved=0;
-
-  auto pcrI=CON_reads.begin();
-  while(pcrI!=CON_reads.end() && CON_reads.size()>1){
-    auto ccI=CON_counts.begin();
-    ccI.advance(pcrI.getReadStartOffset());
-    bool greaterone=false;
-    for(auto x=0; x<pcrI->getLenClippedSeq(); ++x, ++ccI){
-      CEBUG(pcrI->getName() << "\t" << pcrI.getReadStartOffset()+x << "\t" << *ccI << endl);
-      if(ccI->total_cov>1) {
-	greaterone=true;
-	break;
-      }
-    }
-    if(!greaterone){
-      ++numremoved;
-      // update of internal contig statistics
-      --CON_readsperstrain[pcrI->getStrainID()];
-      --CON_readsperreadgroup[pcrI->getReadGroupID().getLibId()];
-      CEBUG("Removing 1cov " << pcrI->getName() << endl);
-      pcrI=CON_reads.removeRead(pcrI);
-    }else{
-      ++pcrI;
-    }
-  }
-  CEBUG("Done removing\n");
-  if(numremoved){
-    CEBUG("#1\n");
-    definalise();
-    CEBUG("#2\n");
-    priv_rebuildConCounts();
-    CEBUG("#3\n");
-    chompFront(-1);
-    CEBUG("#4\n");
-    chompBack(-1);
-  }
-}
-//#define CEBUG(bla)
-
-
-/*************************************************************************
- *
- * Cut the contig at the first coverage hole
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-void Contig::tctr_helper3()
-{
-  CEBUG("tctr_helper3\n");
-
-  if(CON_reads.size()<=1) return;
-
-  auto ccI=CON_counts.begin();
-  for(; ccI!=CON_counts.end(); ++ccI){
-    if(ccI->total_cov==0) break;
-  }
-  if(ccI==CON_counts.end()) return;
-
-  uint32 delpos=ccI-CON_counts.begin();
-  uint32 numremoved=0;
-  auto pcrI=CON_reads.begin();
-  while(pcrI!=CON_reads.end()){
-    if(pcrI.getReadStartOffset()>=delpos){
-      ++numremoved;
-      // update of internal contig statistics
-      --CON_readsperstrain[pcrI->getStrainID()];
-      --CON_readsperreadgroup[pcrI->getReadGroupID().getLibId()];
-      CEBUG("Removing hole " << pcrI->getName() << endl);
-      pcrI=CON_reads.removeRead(pcrI);
-    }else{
-      ++pcrI;
-    }
-  }
-  if(numremoved){
-    definalise();
-    priv_rebuildConCounts();
-    chompFront(-1);
-    chompBack(-1);
-  }
-}
-//#define CEBUG(bla)
-
-
-
 /*************************************************************************
  *
  * Checks a (newly entered at call time, but might be used for other means)
  *  read whether it has mismatches occuring at SRMB or WRMB position
  *
- * Gives back 'true' if a certain level of danger is attained
+ * Gives back 'true' if a certain level of danger is attained and the
+ *  RMBdangeroverlaps (sorted) vector will contain the ids of the reads 
+ *  with which the checked read collides.
+ *
+ * Returns 'false' and an empty vector if dangerlevel is not attained.
  *
  * Dangerlevel is currently 4. Each SRMB/SRMB or SRMB/WRMB mismatch counts 4,
  *  WRMB/WRMB mismatches count for 1 if both basequalities are below 35,
- *  or 2 if one of the qualities is > 35. Or 1 if WRMB/WRMB and one of the
+ *  or 2 if one of the qualities is > 35. Or 1 if WRMB/WRMB and one of the 
  *  bases is a gap.
  *
- * TODO: 07.09.2012
- *  Gahhhhh, extremely inefficient for extreme contigs (RNASeq, metagenome
- *  with outlier coverage) where contig build times of >= 30 minutes can
- *  be >= 80% due to this routine.
- *
  *************************************************************************/
 
 //#define CEBUG(bla)   {cout << bla; cout.flush();}
 //#define CEBUGF(bla)  {cout << bla; cout.flush();}
 //#define CEBUGFLAG
 
-//#define CEBUG(bla)   {if(dodebug) {cout << bla; cout.flush();}}
+//#define CEBUG(bla)   {if(ric.read.getName()=="356638_2895_1163" || ric.read.getName()=="079614_1792_1814") cout << bla; cout.flush();}
 
-bool Contig::analyseRMBZones(PlacedContigReads::const_iterator pcrI)
+bool Contig::analyseRMBZones(const contigread_t & ric, vector<int32> & RMBdangeroverlaps)
 {
-  FUNCSTART("bool Contig::analyseRMBZones(PlacedContigReads::const_iterator pcrI)");
-
-  //bool dodebug=pcrI->getName()=="...";
+  FUNCSTART("bool Contig::analyseRMBZones(const contigread_t & ric)");
 
-  CEBUG("Analysing pcrI: " << pcrI->getName()<<endl);
+  CEBUG("Analysing ric: " << ric.read.getName()<<endl);
 
   //CEBUG(*this);
 
-  if(pcrI.getORPID()==-1) return false;
-
-  BOUNDCHECK(pcrI.getReadStartOffset(), 0, static_cast<uint32>(CON_counts.size()));
+  if(ric.orpid==-1) return false;
 
   contig_parameters const & con_params= (*CON_miraparams)[0].getContigParams();
 
+  RMBdangeroverlaps.clear();
+
   // ok, we need to do this only if the read has baselock tags
   // *sigh* effect on time used to build large contigs is NIL!
-  bool haslocktag=false;
-  if(pcrI->getNumOfTags()){
-    for(auto & blie : CON_baselock_ids){
-      CEBUG("Checking " << multitag_t::getIdentifierStr(blie) << '\n');
-      if(pcrI->hasTag(blie)) {
+  {
+    bool haslocktag=false;
+    for(uint32 j=0; j < CON_baselock_ids.size(); j++){
+      CEBUG("Checking " << multitag_t::getIdentifierStr(CON_baselock_ids[j]) << '\n');
+      if(ric.read.hasTag(CON_baselock_ids[j])) {
 	haslocktag=true;
 	break;
       }
     }
+    if(!haslocktag) return false;
   }
-  if(!haslocktag) return false;
+
 
   bool isdangerous=false;
   int32 dangerlevel=0;
 
-  auto ccI=CON_counts.begin();
-  advance(ccI, pcrI.getReadStartOffset());
-  int32 actcontigpos=pcrI.getReadStartOffset();
+  uint32 analysemode=con_params.con_danger_analyse_mode;
+
+  // if analyse mode = NONE then put it to text for this function
+  if(analysemode==0) {
+    analysemode=1;
+  }
+
+  // if mode = Signal but the signal is not available, fall back to TEXTmode
+  if(analysemode==2 && (const_cast<contigread_t &>(ric)).read.hasSCFData()==false) analysemode=1;
+
+  cccontainer_t::iterator C=CON_counts.begin();
+  BOUNDCHECK(ric.offset, 0, static_cast<int32>(CON_counts.size()));
+  advance(C, ric.offset);
 
-  CEBUG("Need check\n");
 
   // taken out of loop to save constructor time
-  vector<PlacedContigReads::const_iterator> overlappcrIs;
-  auto chklen=pcrI->getLenClippedSeq();
-  for(uint32 readpos=0; readpos<chklen; ++actcontigpos, ++ccI, ++readpos){
-    CEBUG("acp: " << actcontigpos << "\trp: " << readpos << "\tisdangerous " << isdangerous << endl);
-    CEBUG(*ccI << endl);
+  vector<int32> overlapids;
+  for(uint32 readpos=0; readpos<ric.read.getLenClippedSeq(); readpos++, C++){
     if(isdangerous) break;
-    if(ccI->baselock > 0 || ccI->snplock > 0){
+    CEBUG("readpos: " << readpos << endl);
+    if(C->baselock > 0 || C->snplock > 0){
       CEBUG("Base locked at pos " << readpos << endl);
       uint32 numbaseset=0;
-      if(ccI->A > ccI->N) numbaseset++;
-      if(ccI->C > ccI->N) numbaseset++;
-      if(ccI->G > ccI->N) numbaseset++;
-      if(ccI->T > ccI->N) numbaseset++;
-      if(ccI->star > 0) numbaseset++;
+      if(C->A > C->N) numbaseset++;
+      if(C->C > C->N) numbaseset++;
+      if(C->G > C->N) numbaseset++;
+      if(C->T > C->N) numbaseset++;
+      if(C->star > 0) numbaseset++;
       CEBUG(numbaseset << " different bases set\n");
       if(numbaseset>1){
-	int32 actcontigpos=pcrI.getReadStartOffset()+readpos;
+	int32 actcontigpos=ric.offset+readpos;
 
 	// 0 fuer nichts, 1 fuer weak,
 	//  3 fuer stark.
 	// Nicht gleich bei einem weak schmeissen (konfigurierbar)
 	int32 ricbaselock;
 	int32 ricsnplock;
-	int32 ricpos=pcrI.contigPos2UnclippedReadPos(actcontigpos);
-	if(pcrI.getReadDirection()>0){
-	  checkForLockedBase(ricpos, pcrI, ricbaselock, ricsnplock);
+	int32 ricpos=ric.contigPos2UnclippedReadPos(actcontigpos);
+	if(ric.direction>0){
+	  checkForLockedBase(ricpos, ric, ricbaselock, ricsnplock);
+	  //ricbase=toupper(ric.read.getBaseInSequence(ricpos));
+	  //ricqual=ric.read.getQualityInSequence(ricpos);
 	}else{
-	  checkForLockedBaseComplement(ricpos, pcrI, ricbaselock, ricsnplock);
+	  checkForLockedBaseComplement(ricpos, ric, ricbaselock, ricsnplock);
+	  //ricbase=toupper(ric.read.getBaseInComplementSequence(ricpos));
+	  //ricqual=ric.read.getQualityInComplementSequence(ricpos);
 	}
 
-	char ricbase=toupper(pcrI.getBase(actcontigpos));
-	base_quality_t ricqual=pcrI.getQuality(actcontigpos);
+	char ricbase=toupper(ric.getBase(actcontigpos));
+	base_quality_t ricqual=ric.getQuality(actcontigpos);
 
 
 	CEBUG("Ricbaselock: " << ricbaselock << endl);
@@ -458,50 +174,48 @@ bool Contig::analyseRMBZones(PlacedContigReads::const_iterator pcrI)
 	  ricbaselock++;
 	}
 
-	overlappcrIs.clear();
-	getPCRIteratorsAtContigPosition(overlappcrIs, actcontigpos);
+	overlapids.clear();
+	getCRIndicesAtContigPosition(overlapids, actcontigpos);
 
 	int32 localdanger=0;
-	//for(uint32 actoid=0; actoid<overlappcrIs.size(); actoid++){
-	for(auto & opcrIe : overlappcrIs){
-	  // BaCh 07.09.12
-	  // quick break for contigs with huge coverage
-	  if(localdanger>=4) break;
-
-	  //contigread_t & actread=*opcrIe;
-	  if(opcrIe.getORPID()==pcrI.getORPID()) continue;
-	  if(opcrIe.getORPID()==-1) continue;
-
-	  // ar == actread == *opcrIe
-
-	  char arbase=toupper(opcrIe.getBase(actcontigpos));
-	  CEBUG("arbase in " << opcrIe->getName()<<": " << arbase << endl);
-
-	  // change 20.06.05: gap bases are now fully counted
-	  // we don't care if base is a N or X (in dubio pro reo)
-	  if(arbase=='N'|| arbase=='X') continue;
-
-	  // bases should differ, really :-)
-	  if(ricbase==arbase) continue;
-
+	for(uint32 actoid=0; actoid<overlapids.size(); actoid++){
+	  contigread_t & actread=CON_reads[overlapids[actoid]];
+	  if(actread.orpid==ric.orpid) continue;
+	  if(actread.orpid==-1) continue;
+	  // ar == actread
 	  int32 arbaselock;
 	  int32 arsnplock;
-	  int32 arpos=opcrIe.contigPos2UnclippedReadPos(actcontigpos);
-	  if(opcrIe.getReadDirection()>0){
-	    checkForLockedBase(arpos, opcrIe, arbaselock, arsnplock);
+	  int32 arpos=actread.contigPos2UnclippedReadPos(actcontigpos);
+	  if(actread.direction>0){
+	    checkForLockedBase(arpos, actread, arbaselock, arsnplock);
+	    //arbase=toupper(actread.read.getBaseInSequence(arpos));
+            //arqual=actread.read.getQualityInSequence(arpos);
 	  }else{
-	    checkForLockedBaseComplement(arpos, opcrIe, arbaselock, arsnplock);
+	    checkForLockedBaseComplement(arpos,actread,arbaselock,arsnplock);
+	    //arbase=toupper(actread.read.getBaseInComplementSequence(arpos));
+            //arqual=actread.read.getQualityInComplementSequence(arpos);
 	  }
 
+	  char arbase=toupper(actread.getBase(actcontigpos));
+	  base_quality_t arqual=actread.getQuality(actcontigpos);
+
+
 	  CEBUG("arbaselock: " << arbaselock << endl);
 	  CEBUG("arsnplock: " << arsnplock << endl);
+	  CEBUG("arbase in " << actread.read.getName()<<": " << arbase << endl);
 	  // no need to check further if base is not locked
 	  //  == in dubio pro reo
 	  // -> markRepeats() will mark this newly added sequence
 	  //  if it is wrong
 	  if(arbaselock==0 && arsnplock==0) continue;
+	  
 
-	  base_quality_t arqual=opcrIe.getQuality(actcontigpos);
+	  // change 20.06.05: gap bases are now fully counted
+	  // we don't care if base is a N or X (in dubio pro reo)
+	  if(arbase=='N'|| arbase=='X') continue;
+
+	  // bases should differ, really :-)
+	  if(ricbase==arbase) continue;
 
 	  // if it is a WRMB (weak repeat), look at the qual: if it is
 	  //  >= 35, inrease the danger up a notch
@@ -518,35 +232,35 @@ bool Contig::analyseRMBZones(PlacedContigReads::const_iterator pcrI)
 	  }
 
 	  CEBUG("Performing checks");
-	  // check for RMB danger in
+	  // check for RMB danger in 
 	  if(arbaselock>0){
 	    // here, we must differ between (ric)RMB/(ar)RMB
 	    //  and (ric)SIO/(ar)RMB
 	    CEBUG(" RMB");
 	    if(ricbaselock>0){
 	      // RMB/RMB case
-	      // do the bases differ and are they recognised as locked
+	      // do the bases differ and are they recognised as locked 
 	      /// (RMB etc.)?  if yes -> danger
 	      // if no: in dubio pro reo, the non-locked have not been recognised as dangerous
 	      int32 maxlock= max(ricbaselock, arbaselock);
 	      if(maxlock > localdanger) localdanger=maxlock;
 	    }else{
-	      // SIO/RMB case, here we must check that the strains are
+	      // SIO/RMB case, here we must check that the strains are 
 	      //  the same for both before saying it's dangerous
-	      if(pcrI->getStrainID() == opcrIe->getStrainID()){
+	      if(ric.read.getStrainID() == actread.read.getStrainID()){
 		int32 maxlock= max(ricbaselock, arbaselock);
 		if(maxlock > localdanger) localdanger=maxlock;
 	      }
 	    }
 	  }
-
+	  
 	  // check for SNP danger
 	  if(arsnplock>0){
 	    // TODO: also differ RMB/RMB and RMB/SIO ?
 	    CEBUG(" SNP");
 	    // here we must first look at the strain IDs, only if they are
 	    //  the same we must react
-	    if(pcrI->getStrainID() == opcrIe->getStrainID()){
+	    if(ric.read.getStrainID() == actread.read.getStrainID()){
 	      // so, we have a SIOr tag in reads of the same strain, if
 	      //  the bases differ -> treat it as RMB!
 	      int32 maxlock= max(ricsnplock, arsnplock);
@@ -557,7 +271,16 @@ bool Contig::analyseRMBZones(PlacedContigReads::const_iterator pcrI)
 	}
 
 	CEBUG("localdanger: " << localdanger << endl);
-
+	// if it might be a dangerous SRMB/WRMB position, save the read-ids into
+	//  a vector
+	if(localdanger) {
+	  for(uint32 i=0; i<overlapids.size(); i++){
+	    contigread_t & actread=CON_reads[overlapids[i]];
+	    if(actread.orpid==ric.orpid) continue;
+	    RMBdangeroverlaps.push_back(actread.orpid);
+	    CEBUG("Pushing back : " << i << "\t" << actread.orpid << "\tfor " << overlapids[i] << endl);
+	  }
+	}
 	dangerlevel+=localdanger;
 	if(dangerlevel>=4) isdangerous=true;
 	CEBUG("dangerlevel now: " << dangerlevel << endl);
@@ -566,6 +289,15 @@ bool Contig::analyseRMBZones(PlacedContigReads::const_iterator pcrI)
   }
 
   CEBUG("isdangerous: " << isdangerous << endl);
+  // some read ids will probably have been put more than once into the vector,
+  //  get them out if the read is dangerous
+  // if not, empty the vector altogether
+  if(isdangerous) {
+    sort(RMBdangeroverlaps.begin(),RMBdangeroverlaps.end());
+    unique(RMBdangeroverlaps.begin(),RMBdangeroverlaps.end());
+  }else{
+    RMBdangeroverlaps.clear();
+  }
 
   FUNCEND();
 
@@ -586,43 +318,43 @@ bool Contig::analyseRMBZones(PlacedContigReads::const_iterator pcrI)
  * Also return 4 for SIOr tag if we're not in assume_snp mode
  *
  *************************************************************************/
-void Contig::checkForLockedBase(const uint32 readpos, PlacedContigReads::const_iterator pcrI, int32 & baselock, int32 & snplock)
+void Contig::checkForLockedBase(const uint32 readpos, const contigread_t ric, int32 & baselock, int32 & snplock)
 {
-  FUNCSTART("void Contig::checkForLockedBase(const uint32 readpos, PlacedContigReads::const_iterator pcrI, int32 & baselock, int32 & snplock)");
+  FUNCSTART("bool Contig::isLockedBase(int32 readpos, const contigread_t ric)");
 
-  CEBUG("Searching for lock tag in " << pcrI->getName() << " at pos " << readpos<< endl);
+  CEBUG("Searching for lock tag in " << ric.read.getName() << " at pos " << readpos<< endl);
   //Read::setCoutType(Read::AS_TEXTCLIPS);
-  CEBUG(*pcrI);
+  CEBUG(ric.read);
 
-  // checks all tags until it found PRMB (because a WRMB might be shadowed by a PRMB)
-  // TODO: maybe make more "intelligent" by sorting all tags prioro to assembly?
-  //  maybe dangerous and error prone for little gain
+  // TODO: with this tactic, MIRA should clean up reads after each pass
+  //  wrt tags in reads, i.e., a WRMB and PRMB at the same position 
+  //  should lead to deletion of the WRMB
 
-  BUGIFTHROW(readpos >= pcrI->getLenSeq(), "readpos " << readpos << " >= " << pcrI->getLenSeq() << " not in read " << pcrI->getName() << " ???");
+  BUGIFTHROW(readpos >= ric.read.getLenSeq(), "readpos not in read?");
 
   baselock=0;
   snplock=0;
 
-  //for(uint32 i=0; i<pcrI->getNumOfTags(); i++){
-  for(auto & acttag : pcrI->getTags()){
+  for(uint32 i=0; i<ric.read.getNumOfTags(); i++){
+    const multitag_t & acttag=ric.read.getTag(i);
     if(readpos >= acttag.from
        && readpos <= acttag.to){
       CEBUG("Pos matches, must check tag " << multitag_t::getIdentifierStr(acttag.identifier) << endl);
-      for(auto & blie : CON_baselock_ids){
-	CEBUG("Checking " << multitag_t::getIdentifierStr(blie) << '\n');
-	if(acttag.identifier==blie){
+      for(uint32 j=0; j < CON_baselock_ids.size(); j++){
+	CEBUG("Checking " << multitag_t::getIdentifierStr(CON_baselock_ids[j]) << '\n');
+	if(acttag.identifier==CON_baselock_ids[j]){
 	  baselock=1;
 	  if(acttag.identifier==Read::REA_tagentry_idSRMr
 	    || acttag.identifier==Read::REA_tagentry_idCRMr) {
 	    baselock=4;
-	    FUNCEND();
-	    return;
 	  }
+	  FUNCEND();
+	  return;
 	}
       }
       if(!(*CON_miraparams)[0].getContigParams().con_assume_snp_insteadof_rmb){
-	for(auto & slie : CON_snplock_ids){
-	  if(acttag.identifier==slie){
+	for(uint32 j=0; j < CON_snplock_ids.size(); j++){
+	  if(acttag.identifier==CON_snplock_ids[j]){
 	    snplock=4;
 	    FUNCEND();
 	    return;
@@ -645,10 +377,10 @@ void Contig::checkForLockedBase(const uint32 readpos, PlacedContigReads::const_i
  * lockbase-tag
  *
  *************************************************************************/
-void Contig::checkForLockedBaseComplement(const uint32 readpos, PlacedContigReads::const_iterator pcrI, int32 & baselock, int32 & snplock)
+void Contig::checkForLockedBaseComplement(const uint32 readpos, const contigread_t ric, int32 & baselock, int32 & snplock)
 {
-  return checkForLockedBase(pcrI->getLenSeq()-1-readpos,
-			    pcrI,
+  return checkForLockedBase(ric.read.getLenSeq()-1-readpos,
+			    ric,
 			    baselock,
 			    snplock);
 }
@@ -663,266 +395,266 @@ void Contig::checkForLockedBaseComplement(const uint32 readpos, PlacedContigRead
  *
  *************************************************************************/
 
-////++++////bool Contig::analyseDangerZones(const contigread_t & ric)
-////++++////{
-////++++////  FUNCSTART("bool Contig::analyseDangerZones(const contigread_t & ric)");
-////++++////
-////++++////  //  cout << "dandan";
-////++++////
-////++++////  contig_parameters const & con_params= (*CON_miraparams)[0].getContigParams();
-////++++////
-////++++////  bool isdangerous=false;
-////++++////
-////++++////  uint32 analysemode=con_params.con_danger_analyse_mode;
-////++++////
-////++++////  // if analyse mode = NONE then return
-////++++////  if(analysemode==0) {
-////++++////    return isdangerous;
-////++++////  }
-////++++////
-////++++////  // if mode = Signal but the signal is not available, fall back to TEXTmode
-////++++////  if(analysemode==2 && (const_cast<contigread_t &>(ric)).read.hasSCFData()==false) analysemode=1;
-////++++////
-////++++////  // if mode = Signal but the EDIT lib is not available, fall back to TEXTmode
-////++++////#ifndef MIRA_HAS_EDIT
-////++++////  analysemode=1;
-////++++////#endif
-////++++////
-////++++////  uint32 checklen=0;
-////++++////  uint32 totalchecklen=0;
-////++++////  uint32 errorcount=0;
-////++++////
-////++++////  for(uint32 i=0; i<ric.read.getNumOfTags(); i++){
-////++++////    multitag_t acttag=ric.read.getTag(i);
-////++++////    //CEBUG("Tag #" << i << "\tfrom: " << acttag.from << "\tto: " << acttag.to << "\t" << acttag.identifier[0] << acttag.identifier[1] << acttag.identifier[2] << acttag.identifier[3] << endl);
-////++++////    for(uint32 j=0; j<CON_danger_zones_ids.size(); j++){
-////++++////      if(acttag.identifier==CON_danger_zones_ids[j]){
-////++++////
-////++++////#ifdef MIRA_HAS_EDIT
-////++++////	// must make once this as thomas buffer might contain reads that do not match mine
-////++++////	if(totalchecklen==0) ScfBuffer::discard();
-////++++////#endif
-////++++////
-////++++////	// check for danger
-////++++////	int32 tleftbound;
-////++++////	int32 trightbound;
-////++++////	int32 contigpos;
-////++++////	vector<char>::const_iterator rI;
-////++++////	vector<char>::const_iterator rIb;
-////++++////
-////++++////	// TODO: alles ungetestet!
-////++++////	if(ric.direction>0){
-////++++////	  tleftbound=acttag.from-ric.read.getLeftClipoff();
-////++++////	  trightbound=acttag.to-ric.read.getLeftClipoff();
-////++++////	  rI=ric.read.getClippedSeqIterator();
-////++++////	}else{
-////++++////	  tleftbound=ric.read.getRightClipoff()-acttag.to-1;
-////++++////	  trightbound=ric.read.getRightClipoff()-acttag.from-1;
-////++++////
-////++++//////	    int32 tmpoffset=ric.read.getLenSeq()-ric.read.getRightClipoff();
-////++++//////	    tleftbound=ric.read.getLenSeq()-acttag.to-tmpoffset;
-////++++//////	    trightbound=ric.read.getLenSeq()-acttag.from-tmpoffset;
-////++++////	  rI=ric.read.getClippedComplementSeqIterator();
-////++++////	}
-////++++////	rIb=rI;
-////++++////	if(tleftbound<0) tleftbound=0;
-////++++////	if(tleftbound>static_cast<int32>(ric.read.getLenClippedSeq())) tleftbound=ric.read.getLenClippedSeq();
-////++++////	if(trightbound<0) trightbound=0;
-////++++////	if(trightbound>static_cast<int32>(ric.read.getLenClippedSeq())) trightbound=ric.read.getLenClippedSeq();
-////++++////
-////++++////	contigpos=ric.offset+tleftbound;
-////++++////	// sparen, wird durch die 4 ifs oben gemach:
-////++++////	// BOUNDCHECK(tleftbound, 0, ric.read.getLenClippedSeq()+1);
-////++++////	advance(rI, tleftbound);
-////++++////
-////++++////	checklen=trightbound-tleftbound;
-////++++////	totalchecklen+=checklen;
-////++++////
-////++++////	for(int32 k=tleftbound; k<trightbound; k++,contigpos++, rI++){
-////++++////#if 0
-////++++////	  cout << CON_counts[contigpos].A;
-////++++////	  cout << "\t" << CON_counts[contigpos].C;
-////++++////	  cout << "\t" << CON_counts[contigpos].G;
-////++++////	  cout << "\t" << CON_counts[contigpos].T;
-////++++////	  cout << "\t:" << *rI << endl;
-////++++////#endif
-////++++////
-////++++////	  if(contigpos>=static_cast<int32>(CON_counts.size())){
-////++++////	    MIRANOTIFY(Notify::INTERNAL, "contigpos>=CON_counts.size()?");
-////++++////	  }
-////++++////
-////++++////	  uint16 maximum= max(CON_counts[contigpos].A, max(CON_counts[contigpos].C, max(CON_counts[contigpos].G, CON_counts[contigpos].T)));
-////++++////	  uint8 counts=0;
-////++++////	  char base=0;
-////++++////	  //CEBUG(CON_counts[i].A << "\t" << CON_counts[i].C << "\t" << CON_counts[i].G << "\t" << CON_counts[i].T << "\n");
-////++++////	  if(CON_counts[contigpos].A==maximum){
-////++++////	    counts++;
-////++++////	    base='A';
-////++++////	  }
-////++++////	  if(CON_counts[contigpos].C==maximum){
-////++++////	    counts++;
-////++++////	    base='C';
-////++++////	  }
-////++++////	  if(CON_counts[contigpos].G==maximum){
-////++++////	    counts++;
-////++++////	    base='G';
-////++++////	  }
-////++++////	  if(CON_counts[contigpos].T==maximum){
-////++++////	    counts++;
-////++++////	    base='T';
-////++++////	  }
-////++++////	  if(counts>1) base='N';
-////++++////
-////++++//////#ifdef CEBUGFLAG
-////++++//////	    if(base==0){
-////++++//////	      cout << "Gnargl!" << endl;
-////++++//////	      cout << *this;
-////++++//////	      cout << "tleftbound: " << tleftbound<< endl;
-////++++//////	      cout << "trightbound: " << trightbound<< endl;
-////++++//////	      cout << "contigpos: " << contigpos<< endl;
-////++++//////	      cout << "*rI: " << *rI << (uint16) *rI << endl;
-////++++//////	    }
-////++++//////#endif
-////++++////
-////++++////	  // Now, look if there is a problem
-////++++////	  if(base!=toupper(*rI)){
-////++++////	    CEBUG("bah");
-////++++////	    // uh, yes, there is
-////++++////
-////++++////	    //	  Kaputt: was ist, wenn keine Datenfiles da?
-////++++////
-////++++////	    if(analysemode==1){
-////++++////	      // Text mode analyse routines
-////++++////	      if(*rI=='*'){
-////++++////		if(CON_counts[contigpos].star<=1){
-////++++////		  CEBUG("MMMStars: " << CON_counts[contigpos].star << endl);
-////++++////		  CEBUG("MMMCover: " << CON_counts[contigpos].total_cov << endl);
-////++++////		  // treat it as error only if there isn't another star
-////++++////		  //  already in the contig.
-////++++////		  errorcount++;
-////++++////		}
-////++++////		// This was wrong: N in consensus means probably error!
-////++++////		//	      }else if(base!='N' && *rI!='N'){
-////++++////	      }else if(!(toupper(*rI)=='N' || toupper(*rI)=='X')){
-////++++////		errorcount++;
-////++++////	      }
-////++++////	    }else{
-////++++////	      // Signal mode analyse routines.
-////++++////	      int32 dt=666;
-////++++////	      CEBUG("SSSignalanalysis: ");
-////++++////	      if(base=='N' || base=='X'){
-////++++////		if(CON_counts[contigpos].total_cov==2){
-////++++////		  char alternatebase='*';
-////++++////		  switch(toupper(*rI)){
-////++++////		  case 'A':{
-////++++////		    if(CON_counts[contigpos].C!=0) alternatebase='C';
-////++++////		    if(CON_counts[contigpos].G!=0) alternatebase='G';
-////++++////		    if(CON_counts[contigpos].T!=0) alternatebase='T';
-////++++////		    break;
-////++++////		  }
-////++++////		  case 'C':
-////++++////		    if(CON_counts[contigpos].A!=0) alternatebase='A';
-////++++////		    if(CON_counts[contigpos].G!=0) alternatebase='G';
-////++++////		    if(CON_counts[contigpos].T!=0) alternatebase='T';
-////++++////		    break;
-////++++////		  case 'G':
-////++++////		    if(CON_counts[contigpos].A!=0) alternatebase='A';
-////++++////		    if(CON_counts[contigpos].C!=0) alternatebase='C';
-////++++////		    if(CON_counts[contigpos].T!=0) alternatebase='T';
-////++++////		    break;
-////++++////		  case 'T':
-////++++////		    if(CON_counts[contigpos].A!=0) alternatebase='A';
-////++++////		    if(CON_counts[contigpos].C!=0) alternatebase='C';
-////++++////		    if(CON_counts[contigpos].G!=0) alternatebase='G';
-////++++////		    break;
-////++++////		  case 'N':
-////++++////		  case 'X':
-////++++////		  case '*':
-////++++////		    if(CON_counts[contigpos].A!=0) alternatebase='A';
-////++++////		    if(CON_counts[contigpos].C!=0) alternatebase='C';
-////++++////		    if(CON_counts[contigpos].G!=0) alternatebase='G';
-////++++////		    if(CON_counts[contigpos].T!=0) alternatebase='T';
-////++++////		    break;
-////++++////		  default : {}
-////++++////		  }
-////++++////		  // if alternatebase still == '*' then we have two reads with
-////++++////		  //  a '*' each, do nothing, no error
-////++++////		  if(alternatebase!='*'){
-////++++////		    // N in cons with 2 reads: check if base could be alternate base:
-////++++////#ifdef MIRA_HAS_EDIT
-////++++////		    dt=deepThought(ric, rI-rIb, alternatebase);
-////++++////#else
-////++++////		    dt=-1;
-////++++////#endif
-////++++////		    if(dt<0){
-////++++////		      errorcount++;
-////++++////		    }
-////++++////		  }
-////++++////		}else{
-////++++////		  // N in consensus with more than 2 reads means probably error!
-////++++////		  errorcount++;
-////++++////		}
-////++++////	      }else if(!(toupper(*rI)=='N' || toupper(*rI)=='X')){
-////++++////#ifdef MIRA_HAS_EDIT
-////++++////		dt=deepThought(ric, rI-rIb, base);
-////++++////#else
-////++++////		dt=-1;
-////++++////#endif
-////++++////		if(dt<0){
-////++++////		  errorcount++;
-////++++////		}
-////++++////	      }
-////++++////#ifdef CEBUGFLAG
-////++++////	      if(dt==666){
-////++++////		cout << "TTSignal: not analysed" << endl;
-////++++////	      }else if(dt <0){
-////++++////		cout << "TTSignal: rejected" << endl;
-////++++////	      }else if(dt==0){
-////++++////		cout << "TTNo SCF Signal" << endl;
-////++++////	      }else{
-////++++////		cout << "TTSignal: accepted" << endl;
-////++++////	      }
-////++++////#endif
-////++++////	    }
-////++++////	  }
-////++++////	}
-////++++////      }
-////++++////    }
-////++++////  }
-////++++////
-////++++////
-////++++////  // if more than x% errors in length of all danger zones -> reject it
-////++++////  if(totalchecklen>0
-////++++////     && static_cast<int32>((100*errorcount)/totalchecklen)>con_params.con_danger_max_error_rate){
-////++++////    //  if(errorcount>0) {
-////++++////    CEBUG("MMreject: " << errorcount << endl);
-////++++////    isdangerous=true;
-////++++////
-////++++////
-////++++////    CON_last_dangerous_overlaps.clear();
-////++++////
-////++++////    int32 i=0;
-////++++////    vector<contigread_t>::const_iterator I= CON_reads.begin();
-////++++////
-////++++////    int32 rstart=ric.offset;
-////++++////    int32 rend=rstart+ric.read.getLenClippedSeq();
-////++++////
-////++++////    while(I!=CON_reads.end()){
-////++++////      if( ((I->offset >= rstart) && (I->offset < rend))
-////++++////	  || ((I->offset+I->read.getLenClippedSeq() >= rstart)
-////++++////	      && (I->offset+I->read.getLenClippedSeq() < rend))){
-////++++////	CON_last_dangerous_overlaps.push_back(i);
-////++++////      }
-////++++////      I++;i++;
-////++++////    }
-////++++////  }
-////++++////
-////++++////  FUNCEND();
-////++++////
-////++++////  //  debugOff();
-////++++////
-////++++////  return isdangerous;
-////++++////}
+bool Contig::analyseDangerZones(const contigread_t & ric)
+{
+  FUNCSTART("bool Contig::analyseDangerZones(const contigread_t & ric)");
+
+  //  cout << "dandan";
+
+  contig_parameters const & con_params= (*CON_miraparams)[0].getContigParams();
+
+  bool isdangerous=false;
+
+  uint32 analysemode=con_params.con_danger_analyse_mode;
+
+  // if analyse mode = NONE then return
+  if(analysemode==0) {
+    return isdangerous;
+  }
+
+  // if mode = Signal but the signal is not available, fall back to TEXTmode
+  if(analysemode==2 && (const_cast<contigread_t &>(ric)).read.hasSCFData()==false) analysemode=1;
+
+  // if mode = Signal but the EDIT lib is not available, fall back to TEXTmode
+#ifndef MIRA_HAS_EDIT
+  analysemode=1;
+#endif
+
+  uint32 checklen=0;
+  uint32 totalchecklen=0;
+  uint32 errorcount=0;
+
+  for(uint32 i=0; i<ric.read.getNumOfTags(); i++){
+    multitag_t acttag=ric.read.getTag(i);
+    //CEBUG("Tag #" << i << "\tfrom: " << acttag.from << "\tto: " << acttag.to << "\t" << acttag.identifier[0] << acttag.identifier[1] << acttag.identifier[2] << acttag.identifier[3] << endl);
+    for(uint32 j=0; j<CON_danger_zones_ids.size(); j++){
+      if(acttag.identifier==CON_danger_zones_ids[j]){
+
+#ifdef MIRA_HAS_EDIT
+	// must make once this as thomas buffer might contain reads that do not match mine
+	if(totalchecklen==0) ScfBuffer::discard();
+#endif
+
+	// check for danger
+	int32 tleftbound;
+	int32 trightbound;
+	int32 contigpos;
+	vector<char>::const_iterator rI;
+	vector<char>::const_iterator rIb;
+
+	// TODO: alles ungetestet!
+	if(ric.direction>0){
+	  tleftbound=acttag.from-ric.read.getLeftClipoff();
+	  trightbound=acttag.to-ric.read.getLeftClipoff();
+	  rI=ric.read.getClippedSeqIterator();
+	}else{
+	  tleftbound=ric.read.getRightClipoff()-acttag.to-1;
+	  trightbound=ric.read.getRightClipoff()-acttag.from-1;
+
+//	    int32 tmpoffset=ric.read.getLenSeq()-ric.read.getRightClipoff();
+//	    tleftbound=ric.read.getLenSeq()-acttag.to-tmpoffset;
+//	    trightbound=ric.read.getLenSeq()-acttag.from-tmpoffset;
+	  rI=ric.read.getClippedComplementSeqIterator();
+	}
+	rIb=rI;
+	if(tleftbound<0) tleftbound=0;
+	if(tleftbound>static_cast<int32>(ric.read.getLenClippedSeq())) tleftbound=ric.read.getLenClippedSeq();
+	if(trightbound<0) trightbound=0;
+	if(trightbound>static_cast<int32>(ric.read.getLenClippedSeq())) trightbound=ric.read.getLenClippedSeq();
+
+	contigpos=ric.offset+tleftbound;
+	// sparen, wird durch die 4 ifs oben gemach:
+	// BOUNDCHECK(tleftbound, 0, ric.read.getLenClippedSeq()+1);
+	advance(rI, tleftbound);
+
+	checklen=trightbound-tleftbound;
+	totalchecklen+=checklen;
+
+	for(int32 k=tleftbound; k<trightbound; k++,contigpos++, rI++){
+#if 0
+	  cout << CON_counts[contigpos].A;
+	  cout << "\t" << CON_counts[contigpos].C;
+	  cout << "\t" << CON_counts[contigpos].G;
+	  cout << "\t" << CON_counts[contigpos].T;
+	  cout << "\t:" << *rI << endl;
+#endif
+
+	  if(contigpos>=static_cast<int32>(CON_counts.size())){
+	    throw Notify(Notify::INTERNAL, THISFUNC, "contigpos>=CON_counts.size()?");
+	  }
+
+	  uint16 maximum= max(CON_counts[contigpos].A, max(CON_counts[contigpos].C, max(CON_counts[contigpos].G, CON_counts[contigpos].T)));
+	  uint8 counts=0;
+	  char base=0;
+	  //CEBUG(CON_counts[i].A << "\t" << CON_counts[i].C << "\t" << CON_counts[i].G << "\t" << CON_counts[i].T << "\n"); 
+	  if(CON_counts[contigpos].A==maximum){
+	    counts++;
+	    base='A';
+	  }
+	  if(CON_counts[contigpos].C==maximum){
+	    counts++;
+	    base='C';
+	  }
+	  if(CON_counts[contigpos].G==maximum){
+	    counts++;
+	    base='G';
+	  }
+	  if(CON_counts[contigpos].T==maximum){
+	    counts++;
+	    base='T';
+	  }
+	  if(counts>1) base='N';
+
+//#ifdef CEBUGFLAG
+//	    if(base==0){
+//	      cout << "Gnargl!" << endl;
+//	      cout << *this;
+//	      cout << "tleftbound: " << tleftbound<< endl;
+//	      cout << "trightbound: " << trightbound<< endl;
+//	      cout << "contigpos: " << contigpos<< endl;
+//	      cout << "*rI: " << *rI << (uint16) *rI << endl;
+//	    }
+//#endif
+
+	  // Now, look if there is a problem
+	  if(base!=toupper(*rI)){
+	    CEBUG("bah");
+	    // uh, yes, there is 
+
+	    //	  Kaputt: was ist, wenn keine Datenfiles da?
+
+	    if(analysemode==1){
+	      // Text mode analyse routines
+	      if(*rI=='*'){
+		if(CON_counts[contigpos].star<=1){
+		  CEBUG("MMMStars: " << CON_counts[contigpos].star << endl);
+		  CEBUG("MMMCover: " << CON_counts[contigpos].total_cov << endl);
+		  // treat it as error only if there isn't another star
+		  //  already in the contig.
+		  errorcount++;
+		}
+		// This was wrong: N in consensus means probably error!
+		//	      }else if(base!='N' && *rI!='N'){
+	      }else if(!(toupper(*rI)=='N' || toupper(*rI)=='X')){
+		errorcount++;
+	      }
+	    }else{
+	      // Signal mode analyse routines.
+	      int32 dt=666;
+	      CEBUG("SSSignalanalysis: ");
+	      if(base=='N' || base=='X'){
+		if(CON_counts[contigpos].total_cov==2){
+		  char alternatebase='*';
+		  switch(toupper(*rI)){
+		  case 'A':{
+		    if(CON_counts[contigpos].C!=0) alternatebase='C';
+		    if(CON_counts[contigpos].G!=0) alternatebase='G';
+		    if(CON_counts[contigpos].T!=0) alternatebase='T';		    
+		    break;
+		  }
+		  case 'C':
+		    if(CON_counts[contigpos].A!=0) alternatebase='A';
+		    if(CON_counts[contigpos].G!=0) alternatebase='G';
+		    if(CON_counts[contigpos].T!=0) alternatebase='T';		    
+		    break;
+		  case 'G':
+		    if(CON_counts[contigpos].A!=0) alternatebase='A';
+		    if(CON_counts[contigpos].C!=0) alternatebase='C';
+		    if(CON_counts[contigpos].T!=0) alternatebase='T';		    
+		    break;
+		  case 'T':
+		    if(CON_counts[contigpos].A!=0) alternatebase='A';		    
+		    if(CON_counts[contigpos].C!=0) alternatebase='C';
+		    if(CON_counts[contigpos].G!=0) alternatebase='G';
+		    break;
+		  case 'N':
+		  case 'X':
+		  case '*':
+		    if(CON_counts[contigpos].A!=0) alternatebase='A';		    
+		    if(CON_counts[contigpos].C!=0) alternatebase='C';
+		    if(CON_counts[contigpos].G!=0) alternatebase='G';
+		    if(CON_counts[contigpos].T!=0) alternatebase='T';		    
+		    break;
+		  default : {}
+		  }
+		  // if alternatebase still == '*' then we have two reads with 
+		  //  a '*' each, do nothing, no error
+		  if(alternatebase!='*'){
+		    // N in cons with 2 reads: check if base could be alternate base:
+#ifdef MIRA_HAS_EDIT
+		    dt=deepThought(ric, rI-rIb, alternatebase);
+#else
+		    dt=-1;
+#endif
+		    if(dt<0){
+		      errorcount++;
+		    }
+		  }
+		}else{
+		  // N in consensus with more than 2 reads means probably error!
+		  errorcount++;
+		}
+	      }else if(!(toupper(*rI)=='N' || toupper(*rI)=='X')){
+#ifdef MIRA_HAS_EDIT
+		dt=deepThought(ric, rI-rIb, base);
+#else
+		dt=-1;
+#endif
+		if(dt<0){
+		  errorcount++;
+		}
+	      }
+#ifdef CEBUGFLAG
+	      if(dt==666){
+		cout << "TTSignal: not analysed" << endl;
+	      }else if(dt <0){
+		cout << "TTSignal: rejected" << endl;
+	      }else if(dt==0){
+		cout << "TTNo SCF Signal" << endl;
+	      }else{
+		cout << "TTSignal: accepted" << endl;
+	      }
+#endif
+	    }
+	  }
+	}
+      }
+    }
+  }
+  
+  
+  // if more than x% errors in length of all danger zones -> reject it
+  if(totalchecklen>0 
+     && static_cast<int32>((100*errorcount)/totalchecklen)>con_params.con_danger_max_error_rate){
+    //  if(errorcount>0) {
+    CEBUG("MMreject: " << errorcount << endl);
+    isdangerous=true;
+    
+    
+    CON_last_dangerous_overlaps.clear();
+    
+    int32 i=0;
+    vector<contigread_t>::const_iterator I= CON_reads.begin();
+    
+    int32 rstart=ric.offset;
+    int32 rend=rstart+ric.read.getLenClippedSeq();
+    
+    while(I!=CON_reads.end()){
+      if( ((I->offset >= rstart) && (I->offset < rend))
+	  || ((I->offset+I->read.getLenClippedSeq() >= rstart)
+	      && (I->offset+I->read.getLenClippedSeq() < rend))){
+	CON_last_dangerous_overlaps.push_back(i);
+      }
+      I++;i++;
+    }
+  }
+  
+  FUNCEND();
+
+  //  debugOff();
+
+  return isdangerous;
+}
 
 
 /*************************************************************************
@@ -932,219 +664,219 @@ void Contig::checkForLockedBaseComplement(const uint32 readpos, PlacedContigRead
  *
  *************************************************************************/
 
-//bool Contig::analyseAllZones(const contigread_t & ric)
-//{
-//  FUNCSTART("bool Contig::analyseAllZones(const contigread_t & ric)");
-//
-//  cout << "alai";
-//
-//  // must make this as thomas' buffer might contain reads that do not match mine
-//#ifdef MIRA_HAS_EDIT
-//  ScfBuffer::discard();
-//#endif
-//
-//  contig_parameters const & con_params= (*CON_miraparams)[0].getContigParams();
-//
-//  bool isdangerous=false;
-//
-//  uint32 analysemode=con_params.con_danger_analyse_mode;
-//
-//  // if analyse mode = NONE then return
-//  if(analysemode==0) return isdangerous;
-//
-//  // if mode = Signal but the signal is not available, fall back to TEXTmode
-//  if(analysemode==2 && (const_cast<contigread_t &>(ric)).read.hasSCFData()==false) analysemode=1;
-//
-//  // if mode = Signal but the EDIT lib is not available, fall back to TEXTmode
-//#ifndef MIRA_HAS_EDIT
-//  analysemode=1;
-//#endif
-//
-//
-//  uint32 checklen=0;
-//  uint32 totalchecklen=0;
-//  uint32 errorcount=0;
-//
-//  int32 contigpos;
-//  vector<char>::const_iterator rI;
-//  vector<char>::const_iterator rIb;
-//
-//  // TODO: alles ungetestet!
-//  if(ric.direction>0){
-//    rI=ric.read.getClippedSeqIterator();
-//  }else{
-//    rI=ric.read.getClippedComplementSeqIterator();
-//  }
-//  rIb=rI;
-//
-//  contigpos=ric.offset;
-//
-//  checklen=ric.read.getLenClippedSeq();
-//  totalchecklen+=checklen;
-//
-//  for(uint32 k=0; k<checklen; k++,contigpos++, rI++){
-//    if(contigpos>=static_cast<int32>(CON_counts.size())){
-//      MIRANOTIFY(Notify::INTERNAL, "contigpos>=CON_counts.size()?");
-//    }
-//
-//    uint16 maximum= max(CON_counts[contigpos].A, max(CON_counts[contigpos].C, max(CON_counts[contigpos].G, CON_counts[contigpos].T)));
-//    uint8 counts=0;
-//    char base='N';
-//    //	  CEBUG(CON_counts[i].A << "\t" << CON_counts[i].C << "\t" << CON_counts[i].G << "\t" << CON_counts[i].T << "\n");
-//    if(CON_counts[contigpos].A==maximum){
-//      counts++;
-//      base='A';
-//    }
-//    if(CON_counts[contigpos].C==maximum){
-//      counts++;
-//      base='C';
-//    }
-//    if(CON_counts[contigpos].G==maximum){
-//      counts++;
-//      base='G';
-//    }
-//    if(CON_counts[contigpos].T==maximum){
-//      counts++;
-//      base='T';
-//    }
-//
-//    // Now, look if there is a problem
-//    if(base!=toupper(*rI)){
-//      CEBUG("bah");
-//      // uh, yes, there is
-//
-//      //	  Kaputt: was ist, wenn keine Datenfiles da?
-//
-//      if(analysemode==1){
-//	// Text mode analyse routines
-//	if(*rI=='*'){
-//	  if(CON_counts[contigpos].star<=1){
-//	    CEBUG("MMMStars: " << CON_counts[contigpos].star << endl);
-//	    CEBUG("MMMCover: " << CON_counts[contigpos].total_cov << endl);
-//	    // treat it as error only if there isn't another star
-//	    //  already in the contig.
-//	    errorcount++;
-//	  }
-//	  // This was wrong: N in consensus means probably error!
-//	  //	      }else if(base!='N' && *rI!='N'){
-//	}else if(!(toupper(*rI)=='N' || toupper(*rI)=='X')){
-//	  errorcount++;
-//	}
-//      }else{
-//	// Signal mode analyse routines.
-//	int32 dt=666;
-//	CEBUG("SSSignalanalysis: ");
-//	if(base=='N' || base=='X'){
-//	  if(CON_counts[contigpos].total_cov==2){
-//	    char alternatebase='*';
-//	    switch(toupper(*rI)){
-//	    case 'A':{
-//	      if(CON_counts[contigpos].C!=0) alternatebase='C';
-//	      if(CON_counts[contigpos].G!=0) alternatebase='G';
-//	      if(CON_counts[contigpos].T!=0) alternatebase='T';
-//	      break;
-//	    }
-//	    case 'C': {
-//	      if(CON_counts[contigpos].A!=0) alternatebase='A';
-//	      if(CON_counts[contigpos].G!=0) alternatebase='G';
-//	      if(CON_counts[contigpos].T!=0) alternatebase='T';
-//	      break;
-//	    }
-//	    case 'G': {
-//	      if(CON_counts[contigpos].A!=0) alternatebase='A';
-//	      if(CON_counts[contigpos].C!=0) alternatebase='C';
-//	      if(CON_counts[contigpos].T!=0) alternatebase='T';
-//	      break;
-//	    }
-//	    case 'T': {
-//	      if(CON_counts[contigpos].A!=0) alternatebase='A';
-//	      if(CON_counts[contigpos].C!=0) alternatebase='C';
-//	      if(CON_counts[contigpos].G!=0) alternatebase='G';
-//	      break;
-//	    }
-//	    case 'N':
-//	    case 'X':
-//	    case '*': {
-//	      if(CON_counts[contigpos].A!=0) alternatebase='A';
-//	      if(CON_counts[contigpos].C!=0) alternatebase='C';
-//	      if(CON_counts[contigpos].G!=0) alternatebase='G';
-//	      if(CON_counts[contigpos].T!=0) alternatebase='T';
-//	      break;
-//	    }
-//	    default : {}
-//	    }
-//	    // if alternatebase still == '*' then we have two reads with
-//	    //  a '*' each, do nothing, no error
-//	    if(alternatebase!='*'){
-//	      // N in cons with 2 reads: check if base could be alternate base:
-//#ifdef MIRA_HAS_EDIT
-//	      dt=deepThought(ric, rI-rIb, alternatebase);
-//#else
-//	      dt=-1;
-//#endif
-//	      if(dt<0){
-//		errorcount++;
-//	      }
-//	    }
-//	  }else{
-//	    // N in consensus with more than 2 reads means probably error!
-//	    errorcount++;
-//	  }
-//	}else if(!(toupper(*rI)=='N' || toupper(*rI)=='X')){
-//#ifdef MIRA_HAS_EDIT
-//	  dt=deepThought(ric, rI-rIb, base);
-//#else
-//	  dt=-1;
-//#endif
-//	  if(dt<0){
-//	    errorcount++;
-//	  }
-//	}
-//#ifdef CEBUGFLAG
-//	if(dt==666){
-//	  cout << "TTSignal: not analysed" << endl;
-//	}else if(dt <0){
-//	  cout << "TTSignal: rejected" << endl;
-//	}else if(dt==0){
-//	  cout << "TTNo SCF Signal" << endl;
-//	}else{
-//	  cout << "TTSignal: accepted" << endl;
-//	}
-//#endif
-//      }
-//    }
-//  }
-//
-//
-//  // if more than x% errors in length of read, reject
-//  //TODO: parametrieren
-//  if(totalchecklen>0 && (100*errorcount)/totalchecklen>  3  ){
-//    //  if(errorcount>0) {
-//    CEBUG("MMreject: " << errorcount << endl);
-//    isdangerous=true;
-//
-//
-//    CON_last_dangerous_overlaps.clear();
-//
-//    int32 i=0;
-//    vector<contigread_t>::const_iterator I= CON_reads.begin();
-//
-//    int32 rstart=ric.offset;
-//    int32 rend=rstart+ric.read.getLenClippedSeq();
-//
-//    while(I!=CON_reads.end()){
-//      if( ((I->offset >= rstart) && (I->offset < rend))
-//	  || ((I->offset+I->read.getLenClippedSeq() >= rstart)
-//	      && (I->offset+I->read.getLenClippedSeq() < rend))){
-//	CON_last_dangerous_overlaps.push_back(i);
-//      }
-//      I++;i++;
-//    }
-//  }
-//
-//  FUNCEND();
-//  return isdangerous;
-//}
+bool Contig::analyseAllZones(const contigread_t & ric)
+{
+  FUNCSTART("bool Contig::analyseAllZones(const contigread_t & ric)");
+
+  cout << "alai";
+
+  // must make this as thomas' buffer might contain reads that do not match mine
+#ifdef MIRA_HAS_EDIT
+  ScfBuffer::discard();
+#endif
+
+  contig_parameters const & con_params= (*CON_miraparams)[0].getContigParams();
+
+  bool isdangerous=false;
+
+  uint32 analysemode=con_params.con_danger_analyse_mode;
+
+  // if analyse mode = NONE then return
+  if(analysemode==0) return isdangerous;
+
+  // if mode = Signal but the signal is not available, fall back to TEXTmode
+  if(analysemode==2 && (const_cast<contigread_t &>(ric)).read.hasSCFData()==false) analysemode=1;
+
+  // if mode = Signal but the EDIT lib is not available, fall back to TEXTmode
+#ifndef MIRA_HAS_EDIT
+  analysemode=1;
+#endif
+
+
+  uint32 checklen=0;
+  uint32 totalchecklen=0;
+  uint32 errorcount=0;
+
+  int32 contigpos;
+  vector<char>::const_iterator rI;
+  vector<char>::const_iterator rIb;
+  
+  // TODO: alles ungetestet!
+  if(ric.direction>0){
+    rI=ric.read.getClippedSeqIterator();
+  }else{
+    rI=ric.read.getClippedComplementSeqIterator();
+  }
+  rIb=rI;
+  
+  contigpos=ric.offset;
+  
+  checklen=ric.read.getLenClippedSeq();
+  totalchecklen+=checklen;
+  
+  for(uint32 k=0; k<checklen; k++,contigpos++, rI++){
+    if(contigpos>=static_cast<int32>(CON_counts.size())){
+      throw Notify(Notify::INTERNAL, THISFUNC, "contigpos>=CON_counts.size()?");
+    }
+    
+    uint16 maximum= max(CON_counts[contigpos].A, max(CON_counts[contigpos].C, max(CON_counts[contigpos].G, CON_counts[contigpos].T)));
+    uint8 counts=0;
+    char base='N';
+    //	  CEBUG(CON_counts[i].A << "\t" << CON_counts[i].C << "\t" << CON_counts[i].G << "\t" << CON_counts[i].T << "\n"); 
+    if(CON_counts[contigpos].A==maximum){
+      counts++;
+      base='A';
+    }
+    if(CON_counts[contigpos].C==maximum){
+      counts++;
+      base='C';
+    }
+    if(CON_counts[contigpos].G==maximum){
+      counts++;
+      base='G';
+    }
+    if(CON_counts[contigpos].T==maximum){
+      counts++;
+      base='T';
+    }
+    
+    // Now, look if there is a problem
+    if(base!=toupper(*rI)){
+      CEBUG("bah");
+      // uh, yes, there is 
+      
+      //	  Kaputt: was ist, wenn keine Datenfiles da?
+      
+      if(analysemode==1){
+	// Text mode analyse routines
+	if(*rI=='*'){
+	  if(CON_counts[contigpos].star<=1){
+	    CEBUG("MMMStars: " << CON_counts[contigpos].star << endl);
+	    CEBUG("MMMCover: " << CON_counts[contigpos].total_cov << endl);
+	    // treat it as error only if there isn't another star
+	    //  already in the contig.
+	    errorcount++;
+	  }
+	  // This was wrong: N in consensus means probably error!
+	  //	      }else if(base!='N' && *rI!='N'){
+	}else if(!(toupper(*rI)=='N' || toupper(*rI)=='X')){
+	  errorcount++;
+	}
+      }else{
+	// Signal mode analyse routines.
+	int32 dt=666;
+	CEBUG("SSSignalanalysis: ");
+	if(base=='N' || base=='X'){
+	  if(CON_counts[contigpos].total_cov==2){
+	    char alternatebase='*';
+	    switch(toupper(*rI)){
+	    case 'A':{
+	      if(CON_counts[contigpos].C!=0) alternatebase='C';
+	      if(CON_counts[contigpos].G!=0) alternatebase='G';
+	      if(CON_counts[contigpos].T!=0) alternatebase='T';		    
+	      break;
+	    }
+	    case 'C': {
+	      if(CON_counts[contigpos].A!=0) alternatebase='A';
+	      if(CON_counts[contigpos].G!=0) alternatebase='G';
+	      if(CON_counts[contigpos].T!=0) alternatebase='T';		    
+	      break;
+	    }
+	    case 'G': {
+	      if(CON_counts[contigpos].A!=0) alternatebase='A';
+	      if(CON_counts[contigpos].C!=0) alternatebase='C';
+	      if(CON_counts[contigpos].T!=0) alternatebase='T';		    
+	      break;
+	    }
+	    case 'T': {
+	      if(CON_counts[contigpos].A!=0) alternatebase='A';		    
+	      if(CON_counts[contigpos].C!=0) alternatebase='C';
+	      if(CON_counts[contigpos].G!=0) alternatebase='G';
+	      break;
+	    }
+	    case 'N':
+	    case 'X':
+	    case '*': {
+	      if(CON_counts[contigpos].A!=0) alternatebase='A';		    
+	      if(CON_counts[contigpos].C!=0) alternatebase='C';
+	      if(CON_counts[contigpos].G!=0) alternatebase='G';
+	      if(CON_counts[contigpos].T!=0) alternatebase='T';		    
+	      break;
+	    }
+	    default : {}
+	    }
+	    // if alternatebase still == '*' then we have two reads with 
+	    //  a '*' each, do nothing, no error
+	    if(alternatebase!='*'){
+	      // N in cons with 2 reads: check if base could be alternate base:
+#ifdef MIRA_HAS_EDIT
+	      dt=deepThought(ric, rI-rIb, alternatebase);
+#else
+	      dt=-1;
+#endif
+	      if(dt<0){
+		errorcount++;
+	      }
+	    }
+	  }else{
+	    // N in consensus with more than 2 reads means probably error!
+	    errorcount++;
+	  }
+	}else if(!(toupper(*rI)=='N' || toupper(*rI)=='X')){
+#ifdef MIRA_HAS_EDIT
+	  dt=deepThought(ric, rI-rIb, base);
+#else
+	  dt=-1;
+#endif
+	  if(dt<0){
+	    errorcount++;
+	  }
+	}
+#ifdef CEBUGFLAG
+	if(dt==666){
+	  cout << "TTSignal: not analysed" << endl;
+	}else if(dt <0){
+	  cout << "TTSignal: rejected" << endl;
+	}else if(dt==0){
+	  cout << "TTNo SCF Signal" << endl;
+	}else{
+	  cout << "TTSignal: accepted" << endl;
+	}
+#endif
+      }
+    }
+  }
+  
+  
+  // if more than x% errors in length of read, reject
+  //TODO: parametrieren
+  if(totalchecklen>0 && (100*errorcount)/totalchecklen>  3  ){
+    //  if(errorcount>0) {
+    CEBUG("MMreject: " << errorcount << endl);
+    isdangerous=true;
+    
+    
+    CON_last_dangerous_overlaps.clear();
+    
+    int32 i=0;
+    vector<contigread_t>::const_iterator I= CON_reads.begin();
+    
+    int32 rstart=ric.offset;
+    int32 rend=rstart+ric.read.getLenClippedSeq();
+    
+    while(I!=CON_reads.end()){
+      if( ((I->offset >= rstart) && (I->offset < rend))
+	  || ((I->offset+I->read.getLenClippedSeq() >= rstart)
+	      && (I->offset+I->read.getLenClippedSeq() < rend))){
+	CON_last_dangerous_overlaps.push_back(i);
+      }
+      I++;i++;
+    }
+  }
+  
+  FUNCEND();
+  return isdangerous;
+}
 
 
 
@@ -1158,7 +890,7 @@ void Contig::checkForLockedBaseComplement(const uint32 readpos, PlacedContigRead
  *************************************************************************/
 
 #ifdef MIRA_HAS_EDIT
-int32 Contig::deepThought(const contigread_t &aRead, int offset, char newbase)
+int32 Contig::deepThought(const contigread_t &aRead, int offset, char newbase) 
 {
   FUNCSTART("int32 Contig::deepThought(const contigread_t &aRead, int offset, char newbase)");
 #if 1
@@ -1177,16 +909,16 @@ int32 Contig::deepThought(const contigread_t &aRead, int offset, char newbase)
   if(!aRead.read.usesAdjustments()) return 0;
 
   int32 returnit=0;
-
+    
   vector<char>::const_iterator seqIt;
   int dbpos;
   int question;
   SCF_look *theScfLook;
 
-  //  ofstream devNull;
+  //  ofstream devNull;  
   //  devNull.open("/dev/null", ios::out);
 
-  try{
+  try{ 
     theScfLook = ScfBuffer::bufferRead(aRead.read, aRead.direction);
     char si1='N', si2='N', si3='N';
     if (aRead.direction > 0) {
@@ -1203,9 +935,9 @@ int32 Contig::deepThought(const contigread_t &aRead, int offset, char newbase)
     si2=*seqIt;
 
     //    cout << "seqIt(s): " << si1 << " " <<  si2 << " " <<  si3 << "\n";
-
+    
     question = findFaultClass( si1, si2, si3, newbase);
-
+    
     const vector <int32> & adjust=aRead.read.getAdjustments();
     int32 scfpos;
     if(aRead.direction<0){
@@ -1214,19 +946,19 @@ int32 Contig::deepThought(const contigread_t &aRead, int offset, char newbase)
       scfpos=adjust[dbpos];
     }
     //  theProblem->setProblem(question, dbpos, -1,
-    //			  aRead.read.getLeftClipoff(),
+    //			  aRead.read.getLeftClipoff(), 
     //			  aRead.read.getRightClipoff(),
     //			  base );
-
+    
     //    cout << "Start: Call: scfpos: " << scfpos << " dbpos: " << dbpos << endl;
 
-//    float result = evaluate(scfpos, dbpos, question,
+//    float result = evaluate(scfpos, dbpos, question, 
 //			      newbase, theScfLook, cout);
-    float result = evaluate(scfpos, dbpos, question,
+    float result = evaluate(scfpos, dbpos, question, 
 			    newbase, theScfLook);
 
     //  cout << "Succeed" << endl;
-
+    
     if(result>0.6) {
       returnit=1;
     }else{
@@ -1234,16 +966,16 @@ int32 Contig::deepThought(const contigread_t &aRead, int offset, char newbase)
     }
 
     ScfBuffer::bufferDelete(theScfLook);
-
+    
   }
   catch (Notify n){
     return 0; // SCF could not be loaded
   }
-
+  
   FUNCEND();
   return returnit;
 #else
-
+  
   cout << "Internal error: if you see this, immediately contact the authors: a compile configuration error happened.\nContig::deepThought\nFatal warning: Signal libs not included." << endl;
   exit(1000);
   return 0;
@@ -1257,109 +989,207 @@ int32 Contig::deepThought(const contigread_t &aRead, int offset, char newbase)
 
 
 
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+
+void Contig::allowedRefIDs_forbidAll()
+{
+  CON_allowedrefids.clear();
+  CON_allowedrefids.resize(CON_readpool->size(),false);
+}
+
+void Contig::allowedRefIDs_allowAll()
+{
+  CON_allowedrefids.clear();
+  CON_allowedrefids.resize(CON_readpool->size(),true);
+}
+
+//#define CEBUG(bla)   {cout << bla; cout.flush();}
+void Contig::allowedRefIDs_allowSomeRailsOnShortReadCoverage(int32 belowcoverage, int32 strainid, uint8 seqtype)
+{
+  FUNCSTART("void Contig::allowedRefIDs_allowSomeRailsOnShortReadCoverage(int32 belowcoverage, int32 strainid, uint8 seqtype)");
+  
+  if(CON_allowedrefids.empty()) allowedRefIDs_forbidAll();
+
+  unsigned int sr_seqtypeoffset=0;
+  if(seqtype == Read::SEQTYPE_SOLEXA){
+    sr_seqtypeoffset=0;
+  }else if(seqtype == Read::SEQTYPE_ABISOLID){
+    sr_seqtypeoffset=1;
+  }else{
+    throw Notify(Notify::INTERNAL, THISFUNC, "not called with seqtype SOLEXA or SOLiD?");
+  }
+
+  // this rcci has only rails in it 
+  rcci_t rcci_rails;
+  {
+    vector<int32> allowedstrainids; 
+    // empty would be all ids, pushing back an "impossible" strain id
+    //  makes it equal to "no normal reads"
+    allowedstrainids.push_back(10000);
+    vector<uint8> allowedreadtypes;
+    allowedreadtypes.push_back(100);
+    readColContigIteratorInit(rcci_rails, 
+			      allowedstrainids, 
+			      allowedreadtypes, 
+			      true,           // take rails
+			      false,          // no backbones
+			      false);   // no reads without readpool-reads
+  }
+
+  // this rcci has only the reads of seqtype/strainid in it
+  rcci_t rcci_reads;
+  {
+    vector<int32> allowedstrainids; 
+    allowedstrainids.push_back(strainid);
+    vector<uint8> allowedreadtypes;
+    allowedreadtypes.push_back(seqtype);
+    readColContigIteratorInit(rcci_reads, 
+			      allowedstrainids, 
+			      allowedreadtypes, 
+			      false,           // no rails
+			      false,          // no backbones
+			      false);   // no reads without readpool-reads
+  }
+  
+  uint8 strainmask=255;
+
+  CEBUG("Strainidtotake: " << strainid << '\n');
+  if(strainid>=0) strainmask=getBBStrainMask(strainid);
+
+  cccontainer_t::iterator ccI=CON_counts.begin();
+  for(uint32 actcontigpos=0; actcontigpos<CON_counts.size() ;actcontigpos++, ccI++, readColContigIteratorAdvance(rcci_rails), readColContigIteratorAdvance(rcci_reads)){
+    
+    CEBUG("acp: " << actcontigpos);
+    CEBUG("\tstrains: " << static_cast<uint16>(ccI->bbstrains[sr_seqtypeoffset]));
+    CEBUG("\tbbcount: " << ccI->bbcounts[sr_seqtypeoffset]);
+    CEBUG("\treadcov: " << static_cast<uint16>(rcci_reads.read_ids_in_col.size()));
+    CEBUG('\n');
+    if((ccI->bbstrains[sr_seqtypeoffset] & strainmask == 0)
+       || rcci_reads.read_ids_in_col.size()+ ccI->bbcounts[sr_seqtypeoffset]<=belowcoverage){
+      for(uint32 i=0;i<rcci_rails.read_ids_in_col.size(); i++){
+	CEBUG("Allowing " << CON_readpool->getRead(rcci_rails.read_ids_in_col[i]).getName() << '\n');
+	CON_allowedrefids[rcci_rails.read_ids_in_col[i]]=true;
+      }
+    }
+  }
+  FUNCEND();
+
+  uint32 numallowed=0;
+  for(uint32 i=0; i<CON_allowedrefids.size(); i++){
+    if(CON_allowedrefids[i]) numallowed++;
+  }
+  cout << "Allowed RefIDs: "  << numallowed << endl;
+
+  FUNCEND();
+}
+//#define CEBUG(bla)
+
+
+
+
+
+/*************************************************************************
+ *
+ * ercci is like a rcci, but instead of holding only the read ids of
+ *  allowed strains & sequencing types, it holds all read ids 
+ *  differentiated per sequencing type per strain
+ *
+ *************************************************************************/
+
+void Contig::extendedReadColContigIteratorInit(ercci_t & ercci, 
+				       bool takerails,
+				       bool takebackbones,
+				       uint32 numstrains)
+{
+  FUNCSTART("");
+
+  ercci.actcontigpos=0;
+  ercci.takebackbones=takebackbones;
+  ercci.takerails=takerails;
+
+  // Finalising the contig initialises the output order structure vector
+  finalise();
+
+  // per sequencing type and per strain ids,
+  //  a vector keeps the ids of the reads that are
+  //  covering a specific position of the contig
+  // reserving 1000 position should be enough 99.9% of all cases,
+  //  is automatically extended by STL if needed.
+
+  ercci.rids_st_st.clear();
+  ercci.rids_st_st.resize(Read::getNumSequencingTypes());
+  for(uint32 seqtype=0; seqtype<Read::getNumSequencingTypes(); seqtype++){
+    ercci.rids_st_st[seqtype].resize(numstrains);
+    for(uint32 strainid=0; strainid<numstrains; strainid++){
+      ercci.rids_st_st[seqtype][strainid].clear();
+      ercci.rids_st_st[seqtype][strainid].reserve(1000);
+    }
+  }
+
+  ercci.outorderI = CON_outputorder.begin();
+
+  extendedReadColContigIteratorUpdate(ercci);
 
-void Contig::allowedRefIDs_forbidAll()
-{
-  CON_allowedrefids.clear();
-  CON_allowedrefids.resize(CON_readpool->size(),false);
+  FUNCEND();
+  return;
 }
 
-void Contig::allowedRefIDs_allowAll()
+void Contig::extendedReadColContigIteratorUpdate(ercci_t & ercci)
 {
-  CON_allowedrefids.clear();
-  CON_allowedrefids.resize(CON_readpool->size(),true);
-}
+  FUNCSTART("");
+
+  // update the vector that 
+  //  keeps track of the reads that are
+  //  covering a specific position of the contig
+  // works quite simple: reads in the vector that are ending get
+  //  thrown out, new reads starting are entered.
+
+  // first delete those who fall out at this new position
+
+  for(uint32 seqtype=0; seqtype<Read::getNumSequencingTypes(); seqtype++){
+    for(uint32 strainid=0; strainid<ercci.rids_st_st[seqtype].size(); strainid++){
+      vector<uint32>::iterator Ifrom=ercci.rids_st_st[seqtype][strainid].begin();
+      vector<uint32>::iterator Ito=Ifrom;
+      for(;Ifrom != ercci.rids_st_st[seqtype][strainid].end(); Ifrom++){
+	*Ito=*Ifrom;
+	if(CON_reads[*Ifrom].offset+CON_reads[*Ifrom].read.getLenClippedSeq() > ercci.actcontigpos) {
+	  Ito++;
+	}
+      }
+      if(Ito != Ifrom) {
+	ercci.rids_st_st[seqtype][strainid].resize(Ito-ercci.rids_st_st[seqtype][strainid].begin());
+      }
+    }
+  }
 
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-void Contig::allowedRefIDs_allowSomeRailsOnShortReadCoverage(int32 belowcoverage, int32 strainid, uint8 seqtype)
-{
-  FUNCSTART("void Contig::allowedRefIDs_allowSomeRailsOnShortReadCoverage(int32 belowcoverage, int32 strainid, uint8 seqtype)");
+  for(;ercci.outorderI != CON_outputorder.end() && (ercci.outorderI)->offset_start == static_cast<int32>(ercci.actcontigpos); (ercci.outorderI)++){
+
+    if(CON_reads[(ercci.outorderI)->original_index].read.isRail() 
+       && !ercci.takerails) continue;
 
-  BUGIFTHROW(true,"need redo ca1 for PlacedContigReads");
-
-////++++////  if(CON_allowedrefids.empty()) allowedRefIDs_forbidAll();
-////++++////
-////++++////  unsigned int sr_seqtypeoffset=0;
-////++++////  if(seqtype == ReadGroupLib::SEQTYPE_SOLEXA){
-////++++////    sr_seqtypeoffset=0;
-////++++////  }else if(seqtype == ReadGroupLib::SEQTYPE_ABISOLID){
-////++++////    sr_seqtypeoffset=1;
-////++++////  }else{
-////++++////    MIRANOTIFY(Notify::INTERNAL, "not called with seqtype SOLEXA or SOLiD?");
-////++++////  }
-////++++////
-////++++////  // this rcci has only rails in it
-////++++////  rcci_t rcci_rails;
-////++++////  {
-////++++////    vector<int32> allowedstrainids
-////++++////    // empty would be all ids, pushing back an "impossible" strain id
-////++++////    //  makes it equal to "no normal reads"
-////++++////    allowedstrainids.push_back(10000);
-////++++////    vector<uint8> allowedreadtypes;
-////++++////    allowedreadtypes.push_back(100);
-////++++////    readColContigIteratorInit(rcci_rails,
-////++++////			      allowedstrainids,
-////++++////			      allowedreadtypes,
-////++++////			      true,           // take rails
-////++++////			      false,          // no backbones
-////++++////			      false);   // no reads without readpool-reads
-////++++////  }
-////++++////
-////++++////  // this rcci has only the reads of seqtype/strainid in it
-////++++////  rcci_t rcci_reads;
-////++++////  {
-////++++////    vector<int32> allowedstrainids;
-////++++////    allowedstrainids.push_back(strainid);
-////++++////    vector<uint8> allowedreadtypes;
-////++++////    allowedreadtypes.push_back(seqtype);
-////++++////    readColContigIteratorInit(rcci_reads,
-////++++////			      allowedstrainids,
-////++++////			      allowedreadtypes,
-////++++////			      false,           // no rails
-////++++////			      false,          // no backbones
-////++++////			      false);   // no reads without readpool-reads
-////++++////  }
-////++++////
-////++++////  uint8 strainmask=255;
-////++++////
-////++++////  CEBUG("Strainidtotake: " << strainid << '\n');
-////++++////  if(strainid>=0) strainmask=getBBStrainMask(strainid);
-////++++////
-////++++////  auto ccI=CON_counts.begin();
-////++++////  for(uint32 actcontigpos=0; actcontigpos<CON_counts.size() ;actcontigpos++, ccI++, readColContigIteratorAdvance(rcci_rails), readColContigIteratorAdvance(rcci_reads)){
-////++++////
-////++++////    CEBUG("acp: " << actcontigpos);
-////++++////    CEBUG("\tstrains: " << static_cast<uint16>(ccI->bbstrains[sr_seqtypeoffset]));
-////++++////    CEBUG("\tbbcount: " << ccI->bbcounts[sr_seqtypeoffset]);
-////++++////    CEBUG("\treadcov: " << static_cast<uint16>(rcci_reads.read_ids_in_col.size()));
-////++++////    CEBUG('\n');
-////++++////    if((ccI->bbstrains[sr_seqtypeoffset] & strainmask == 0)
-////++++////       || rcci_reads.read_ids_in_col.size()+ ccI->bbcounts[sr_seqtypeoffset]<=belowcoverage){
-////++++////      for(uint32 i=0;i<rcci_rails.read_ids_in_col.size(); i++){
-////++++////	CEBUG("Allowing " << CON_readpool->getRead(rcci_rails.read_ids_in_col[i]).getName() << '\n');
-////++++////	CON_allowedrefids[rcci_rails.read_ids_in_col[i]]=true;
-////++++////      }
-////++++////    }
-////++++////  }
-////++++////  FUNCEND();
-////++++////
-////++++////  uint32 numallowed=0;
-////++++////  for(uint32 i=0; i<CON_allowedrefids.size(); i++){
-////++++////    if(CON_allowedrefids[i]) numallowed++;
-////++++////  }
-////++++////  cout << "Allowed RefIDs: "  << numallowed << endl;
+    if(CON_reads[(ercci.outorderI)->original_index].read.isBackbone()
+       && !ercci.takebackbones) continue;
+    uint32 seqtype=CON_reads[(ercci.outorderI)->original_index].read.getSequencingType();
+    uint32 strainid=static_cast<uint32>(CON_reads[(ercci.outorderI)->original_index].read.getStrainID());
+    ercci.rids_st_st[seqtype][strainid].push_back((ercci.outorderI)->original_index);
+  }
 
   FUNCEND();
+  return;
 }
-//#define CEBUG(bla)
 
 
+void Contig::extendedReadColContigIteratorAdvance(ercci_t & ercci)
+{
+  ercci.actcontigpos++;
+  extendedReadColContigIteratorUpdate(ercci);
+}
+
 
 
 
@@ -1369,11 +1199,6 @@ void Contig::allowedRefIDs_allowSomeRailsOnShortReadCoverage(int32 belowcoverage
  * New repeat marker that works with different sequencing types and
  *  strains
  *
- * 24.06.2012 Had routine once dump
- *  Marking possibly misassembled repeats: tcmalloc: large alloc 0 bytes == (nil) @
- *  Ouch, out of memory detected.
- * on me. Almost impossible, additional checks inserted.
- *
  *************************************************************************/
 
 
@@ -1387,27 +1212,30 @@ void Contig::newMarkPossibleRepeats(repeatmarker_stats_t & repstats, vector<bool
   repstats.numWRMs=0;
   repstats.numSNPs=0;
 
-  BUGIFTHROW(CON_readpool->size()==0,"CON_readpool->size()==0 ???");    // should never be, hunt for tcmalloc 0 alloc message
   readsmarkedsrm.clear();
   readsmarkedsrm.resize(CON_readpool->size(),false);
 
-  // early return on empty contig
-  if(CON_counts.size()==0) return;
-
   checkContig();
 
-  // get highest ID of strain with reads as number of strains in contig
-  // this is formally wrong as a contig may contain some strain IDs but not others
-  //  e.g.  (1 0 0 0 25 0 0 0) contains two strains, but has the highest ID=4
-  // but the routines below just need a correctly size vector
+  // get number of strains in this contig
   uint32 numstrains=0;
-  for(uint32 nsi=0; nsi<CON_readsperstrain.size(); ++nsi){
-    if(CON_readsperstrain[nsi]>0) numstrains=nsi;
+  for(uint32 i=0; i<CON_reads.size(); i++){
+    if(static_cast<uint32>(CON_reads[i].read.getStrainID()) > numstrains){
+      numstrains=CON_reads[i].read.getStrainID();
+    }
   }
-  // strain numbering starts at 0, so add 1
-  ++numstrains;
+  // remember: default strain has ID =0, so we have +1 strains
+  numstrains++;
+
+  //contig_parameters const & con_params= CON_miraparams->getContigParams();
 
-  static const string groupbases("ACGT*");
+  string groupbases;
+  //if(con_params.con_also_mark_gap_bases){
+  //  groupbases="ACGT*";
+  //}else{
+  //  groupbases="ACGT";
+  //}
+  groupbases="ACGT*";
 
   nngroups_t emptygroup;
   emptygroup.base='!';
@@ -1419,13 +1247,11 @@ void Contig::newMarkPossibleRepeats(repeatmarker_stats_t & repstats, vector<bool
   // groups per seqtype per strain, empty template
   vector<vector<vector <nngroups_t> > > emptygroups_st_st;
 
-  BUGIFTHROW(ReadGroupLib::getNumSequencingTypes()==0,"ReadGroupLib::getNumSequencingTypes()==0 ???");    // should never be, hunt for tcmalloc 0 alloc message
-  emptygroups_st_st.resize(ReadGroupLib::getNumSequencingTypes());
-  for(uint32 seqtype=0; seqtype<ReadGroupLib::getNumSequencingTypes(); ++seqtype){
-    BUGIFTHROW(numstrains==0,"numstrains==0 ???");    // should never be, hunt for tcmalloc 0 alloc message
+  emptygroups_st_st.resize(Read::getNumSequencingTypes());
+  for(uint32 seqtype=0; seqtype<Read::getNumSequencingTypes(); seqtype++){
     emptygroups_st_st[seqtype].resize(numstrains);
     for(uint32 strainid=0; strainid<numstrains; strainid++){
-      for(uint32 actgroup=0; actgroup<groupbases.size(); ++actgroup){
+      for(uint32 actgroup=0; actgroup<groupbases.size(); actgroup++){
 	emptygroups_st_st[seqtype][strainid].push_back(emptygroup);
 	emptygroups_st_st[seqtype][strainid].back().base=groupbases[actgroup];
       }
@@ -1437,11 +1263,9 @@ void Contig::newMarkPossibleRepeats(repeatmarker_stats_t & repstats, vector<bool
 
 
   nnpos_rep_col_t emptyprc;
-  emptyprc.urdids.clear();
+  emptyprc.ids.clear();
   emptyprc.groupbases.clear();
   emptyprc.groupquals.clear();
-  emptyprc.groupcountsfwd.clear();
-  emptyprc.groupcountsrev.clear();
   emptyprc.type=Read::REA_tagentry_idEmpty;
   emptyprc.contigpos=0;
   emptyprc.is_dangerous=false;
@@ -1451,40 +1275,42 @@ void Contig::newMarkPossibleRepeats(repeatmarker_stats_t & repstats, vector<bool
 
   vector<int8> maskshadow;
   vector<multitag_t::mte_id_t> masktagtypes;
-  //masktagtypes.push_back(Read::REA_tagentry_idSOFApolyA_sequence);
-  masktagtypes.push_back(Read::REA_defaulttag_PSHP.identifier);
+  masktagtypes.push_back(Read::REA_tagentry_idFpAS);
+  masktagtypes.push_back(Read::REA_tagentry_idPSHP);
   buildMaskShadow(maskshadow,masktagtypes,false);
 
   CEBUGF2("Start." << endl);
 
   // the ercci is for the analysis of the bases themselves
   //
-  ercci_t ercci(this);
-  ercci.init(false,        // don't take rails
-	     true,        // take backbone
-	     numstrains);
+  ercci_t ercci;
+  extendedReadColContigIteratorInit(ercci,
+				    false,        // don't take rails
+				    true,        // take backbone
+				    numstrains);
 
   // this rcci has only rails and backbones in it (to set tags also
   //  in them as they're not contained in th ercci
-  rcci_t rcci(this);
+  rcci_t rcci;
   {
-    vector<int32> allowedstrainids;
+    vector<int32> allowedstrainids; 
     // empty would be all ids, pushing back an "impossible" strain id
     //  makes it equal to "no normal reads"
     allowedstrainids.push_back(1000000);
     vector<uint8> allowedreadtypes;
-    allowedreadtypes.push_back(ReadGroupLib::SEQTYPE_454GS20);
-    rcci.init(allowedstrainids,
-	      allowedreadtypes,
-	      true,           // take rails
-	      true,           // and backbones
-	      false);   // no reads without readpool-reads
+    allowedreadtypes.push_back(Read::SEQTYPE_454GS20);
+    readColContigIteratorInit(rcci, 
+			      allowedstrainids, 
+			      allowedreadtypes, 
+			      true,           // take rails
+			      true,           // and backbones
+			      false);   // no reads without readpool-reads
   }
 
 
   ProgressIndicator<int32> P(0, CON_counts.size());
-  auto ccI=CON_counts.cbegin();
-  for(uint32 actcontigpos=0; actcontigpos<CON_counts.size(); ++actcontigpos, ++ccI, ercci.advance(), rcci.advance()){
+  cccontainer_t::iterator ccI=CON_counts.begin();
+  for(uint32 actcontigpos=0; actcontigpos<CON_counts.size() ;actcontigpos++, ccI++, extendedReadColContigIteratorAdvance(ercci),readColContigIteratorAdvance(rcci)){
     P.progress(actcontigpos);
 
     CEBUGF2("acp: " << actcontigpos << endl);
@@ -1504,24 +1330,24 @@ void Contig::newMarkPossibleRepeats(repeatmarker_stats_t & repstats, vector<bool
     //  ostr << static_cast<char>(basecounter[maxsize_i].base) << ": " << maxsize;
     //  ostr << " " << static_cast<char>(basecounter[runnerup_i].base) << ": " << runnerup;
     //  ostr << "  -  " << 100*runnerup/(maxsize+runnerup) << "%";
-    //
+    //  
     //  addTagToConsensus(actcontigpos, actcontigpos,'=',"T454",ostr.str().c_str());
     //}
 
     // calc some values (not needed now, but later perhaps
     {
       uint32 seqtypesaffected=0;
-      for(uint32 seqtype=0; seqtype<ReadGroupLib::getNumSequencingTypes(); ++seqtype){
+      for(uint32 seqtype=0; seqtype<Read::getNumSequencingTypes(); seqtype++){
 	uint32 strainsaffected=0;
-	for(uint32 strainid=0; strainid<numstrains; ++strainid){
-	  if(ercci.getPCRIstst()[seqtype][strainid].size()) {
+	for(uint32 strainid=0; strainid<numstrains; strainid++){
+	  if(ercci.rids_st_st[seqtype][strainid].size()) {
 	    CEBUGF2("Seqtype: " << seqtype << "\tStrainid: " << strainid);
-	    CEBUGF2("\tNum reads: " << ercci.getPCRIstst()[seqtype][strainid].size() << '\n');
-	    ++strainsaffected;
+	    CEBUGF2("\tNum reads: " << ercci.rids_st_st[seqtype][strainid].size() << '\n');
+	    strainsaffected++;
 	  }
 	}
 	if(strainsaffected) {
-	  ++seqtypesaffected;
+	  seqtypesaffected++;
 	  CEBUGF2("Strains affected in seqtype " << seqtype << ": " << strainsaffected << '\n');
 	}
       }
@@ -1539,16 +1365,16 @@ void Contig::newMarkPossibleRepeats(repeatmarker_stats_t & repstats, vector<bool
     uint32 numvalidgroups=0;
     {
       vector<bool> validgroupmask(groupbases.size(),false);
-      for(uint32 seqtype=0; seqtype<ReadGroupLib::getNumSequencingTypes(); ++seqtype){
-	for(uint32 strainid=0; strainid<numstrains; ++strainid){
+      for(uint32 seqtype=0; seqtype<Read::getNumSequencingTypes(); seqtype++){
+	for(uint32 strainid=0; strainid<numstrains; strainid++){
 	  CEBUGF2("seqt: " << seqtype << "\tstrid: " << strainid << '\n');
-	  for(uint32 actgroupid=0; actgroupid<groupbases.size(); ++actgroupid){
-	    if(groups_st_st[seqtype][strainid][actgroupid].valid){
-	      CEBUGF2("Valid possible group " << actgroupid << '\n');
-	      CEBUGF2(groups_st_st[seqtype][strainid][actgroupid]);
-	      if(!validgroupmask[actgroupid]){
-		validgroupmask[actgroupid]=true;
-		++numvalidgroups;
+	  for(uint32 actgroup=0; actgroup<groupbases.size(); actgroup++){
+	    if(groups_st_st[seqtype][strainid][actgroup].valid){
+	      CEBUGF2("Valid possible group " << actgroup << '\n');
+	      CEBUGF2(groups_st_st[seqtype][strainid][actgroup]);
+	      if(!validgroupmask[actgroup]){
+		validgroupmask[actgroup]=true;
+		numvalidgroups++;
 	      }
 	    }
 	  }
@@ -1560,31 +1386,32 @@ void Contig::newMarkPossibleRepeats(repeatmarker_stats_t & repstats, vector<bool
       CEBUGF2("Bingo! " << actcontigpos << '\n');
 
       nmpr_secondfillin(ercci, maskshadow, masktagtypes, groups_st_st);
-
+ 
       // num valid groups per sequencing type per strain
       vector<vector<uint32> > numvalids_st_st;
-      numvalids_st_st.resize(ReadGroupLib::getNumSequencingTypes());
-      for(uint32 seqtype=0; seqtype<ReadGroupLib::getNumSequencingTypes(); ++seqtype){
+      numvalids_st_st.resize(Read::getNumSequencingTypes());
+      for(uint32 seqtype=0; seqtype<Read::getNumSequencingTypes(); seqtype++){
 	numvalids_st_st[seqtype].resize(numstrains,0);
       }
-
-      for(uint32 seqtype=0; seqtype<ReadGroupLib::getNumSequencingTypes(); ++seqtype){
-	for(uint32 strainid=0; strainid<numstrains; ++strainid){
+	
+      for(uint32 seqtype=0; seqtype<Read::getNumSequencingTypes(); seqtype++){
+	for(uint32 strainid=0; strainid<numstrains; strainid++){
 	  CEBUGF2("seqt: " << seqtype << "\tstrid: " << strainid << '\n');
-	  for(auto & actgroup : groups_st_st[seqtype][strainid]){
-	    if(actgroup.valid){
+	  for(uint32 actgroup=0; actgroup<groupbases.size(); actgroup++){
+	    if(groups_st_st[seqtype][strainid][actgroup].valid){
+	      CEBUGF2("Valid updated group " << actgroup << '\n');
+	      CEBUGF2(groups_st_st[seqtype][strainid][actgroup]);
 	      numvalids_st_st[seqtype][strainid]++;
-	      CEBUGF2("Valid updated group\n" << actgroup << '\n');
 	    }
 	  }
 	}
       }
 
       uint32 numseqtypeswithvalids=0;
-      for(uint32 seqtype=0; seqtype<ReadGroupLib::getNumSequencingTypes(); ++seqtype){
-	for(uint32 strainid=0; strainid<numstrains; ++strainid){
+      for(uint32 seqtype=0; seqtype<Read::getNumSequencingTypes(); seqtype++){
+	for(uint32 strainid=0; strainid<numstrains; strainid++){
 	  if(numvalids_st_st[seqtype][strainid]>0){
-	    ++numseqtypeswithvalids;
+	    numseqtypeswithvalids++;
 	    break;
 	  }
 	}
@@ -1594,27 +1421,27 @@ void Contig::newMarkPossibleRepeats(repeatmarker_stats_t & repstats, vector<bool
 
       if(numseqtypeswithvalids==0) {
 	cout << "ehhhhhhh .... ?\n";
-	MIRANOTIFY(Notify::INTERNAL, "no seq type with valid groups at this place? Impossible.");
+	throw Notify(Notify::INTERNAL, THISFUNC, "no seq type with valid groups at this place? Impossible.");
       }else if(numseqtypeswithvalids==1){
 	CEBUGF2("Just one sequencing type, good.\n");
-	// could be multiple strains, but that's dealt with in
+	// could be multiple strains, but that's dealt with in 
 	//  nmpr_evaluateOneSeqType(), we just need to tag
 	//  the prc we get back
-	for(uint32 seqtype=0; seqtype<ReadGroupLib::getNumSequencingTypes(); ++seqtype){
-	  for(uint32 strainid=0; strainid<numstrains; ++strainid){
+	for(uint32 seqtype=0; seqtype<Read::getNumSequencingTypes(); seqtype++){
+	  for(uint32 strainid=0; strainid<numstrains; strainid++){
 	    if(numvalids_st_st[seqtype][strainid]>0){
 	      vector<nnpos_rep_col_t> newprcs;
 	      // find out what it is
 	      nmpr_evaluateOneSeqType(seqtype,
-				      ercci,
+				      ercci, 
 				      groups_st_st[seqtype],
 				      newprcs,
 				      emptyprc);
 	      // and tag column accordingly
-	      for(uint32 ni=0; ni< newprcs.size(); ++ni){
-		nmpr_tagColumn(newprcs[ni],
+	      for(uint32 i=0; i< newprcs.size(); i++){
+		nmpr_tagColumn(newprcs[i], 
 			       rcci,
-			       readsmarkedsrm,
+			       readsmarkedsrm, 
 			       repstats);
 	      }
 	    }
@@ -1623,7 +1450,7 @@ void Contig::newMarkPossibleRepeats(repeatmarker_stats_t & repstats, vector<bool
       }else{
 	nmpr_cautiousMultiSeqTypeTagging(ercci,
 					 rcci,
-					 groups_st_st,
+					 groups_st_st, 
 					 emptyprc,
 					 readsmarkedsrm,
 					 repstats);
@@ -1662,8 +1489,8 @@ void Contig::nmpr_cautiousMultiSeqTypeTagging(const ercci_t & ercci, const rcci_
   vector<bool> seqtypewithSRM(groups_st_st.size(),false);
   vector<bool> seqtypewithWRM(groups_st_st.size(),false);
 
-#if CPP_READ_SEQTYPE_END != 8
-#error "This code is made for 8 sequencing types, adapt!"
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
 #endif
 
   bool hasvalidgapinsanger=false;
@@ -1672,7 +1499,7 @@ void Contig::nmpr_cautiousMultiSeqTypeTagging(const ercci_t & ercci, const rcci_
   bool hasSRM=false;
 
   // ok, first determine what we have per sequencing type (per strain)
-  for(uint32 actseqtype=0; actseqtype < newprcs_st.size(); ++actseqtype){
+  for(uint32 actseqtype=0; actseqtype < newprcs_st.size(); actseqtype++){
 
     // TODO: remove if once solexa and abi are tested
     if(groups_st_st[actseqtype].size()){
@@ -1689,19 +1516,23 @@ void Contig::nmpr_cautiousMultiSeqTypeTagging(const ercci_t & ercci, const rcci_
 //      }
 
       nmpr_evaluateOneSeqType(actseqtype,
-			      ercci,
+			      ercci, 
 			      groups_st_st[actseqtype],
 			      newprcs_st[actseqtype],
 			      emptyprc);
     }
 
     uint32 hasgapasvalidgroup=false;
-    for(uint32 actprci=0; actprci<newprcs_st[actseqtype].size(); ++actprci){
+    for(uint32 actprci=0; actprci<newprcs_st[actseqtype].size(); actprci++){
       // no |= operator accepted by GCC 4 here
 
       if(newprcs_st[actseqtype][actprci].groupbases.size() > 0){
-	if(actseqtype == ReadGroupLib::SEQTYPE_ABISOLID){
-	  MIRANOTIFY(Notify::INTERNAL, "Type ABI SOLiD needs more support 10.");
+	// TODO: check this!!!
+	//if(actseqtype == Read::SEQTYPE_SOLEXA){
+	//  throw Notify(Notify::INTERNAL, THISFUNC, "Type Solexa needs more support 10.");
+	//}
+	if(actseqtype == Read::SEQTYPE_ABISOLID){
+	  throw Notify(Notify::INTERNAL, THISFUNC, "Type ABI SOLiD needs more support 10.");
 	}
       }
 
@@ -1710,24 +1541,22 @@ void Contig::nmpr_cautiousMultiSeqTypeTagging(const ercci_t & ercci, const rcci_
       seqtypewithWRM[actseqtype]= seqtypewithWRM[actseqtype] | (newprcs_st[actseqtype][actprci].type == Read::REA_tagentry_idWRMr);
       hasSRM|=(newprcs_st[actseqtype][actprci].type == Read::REA_tagentry_idSRMr);
 
-      for(uint32 actbasei=0; actbasei<newprcs_st[actseqtype][actprci].groupbases.size(); ++actbasei){
+      for(uint32 actbasei=0; actbasei<newprcs_st[actseqtype][actprci].groupbases.size(); actbasei++){
 	if(newprcs_st[actseqtype][actprci].groupbases[actbasei] == '*') hasgapasvalidgroup=true;
       }
     }
 
-    // TODO: PacBio LQ /HQ ???
-
     if(hasgapasvalidgroup){
       switch(actseqtype) {
-      case ReadGroupLib::SEQTYPE_SANGER: {
+      case Read::SEQTYPE_SANGER: {
 	hasvalidgapinsanger=true;
 	break;
       }
-      case ReadGroupLib::SEQTYPE_454GS20:{
+      case Read::SEQTYPE_454GS20:{
 	hasvalidgapin454=true;
 	break;
       }
-      case ReadGroupLib::SEQTYPE_IONTORRENT:{
+      case Read::SEQTYPE_IONTORRENT:{
 	hasvalidgapinion=true;
 	break;
       }
@@ -1740,22 +1569,22 @@ void Contig::nmpr_cautiousMultiSeqTypeTagging(const ercci_t & ercci, const rcci_
   CEBUGF2("hasvalidgapinsanger: " << hasvalidgapinsanger << "\thasvalidgapin454: " << hasvalidgapin454 << "\thasvalidgapinion: " << hasvalidgapinion);
   CEBUGF2("\thasSRM: " << hasSRM << '\n');
 
-  if(hasvalidgapinsanger
-     && (seqtypewithSRM[ReadGroupLib::SEQTYPE_SANGER]
-	 || seqtypewithWRM[ReadGroupLib::SEQTYPE_SANGER])){
+  if(hasvalidgapinsanger 
+     && (seqtypewithSRM[Read::SEQTYPE_SANGER] 
+	 || seqtypewithWRM[Read::SEQTYPE_SANGER])){
     // special case: tag only sanger
-    for(uint32 ni=0; ni< newprcs_st[ReadGroupLib::SEQTYPE_SANGER].size(); ++ni){
-      nmpr_tagColumn(newprcs_st[ReadGroupLib::SEQTYPE_SANGER][ni],
+    for(uint32 i=0; i< newprcs_st[Read::SEQTYPE_SANGER].size(); i++){
+      nmpr_tagColumn(newprcs_st[Read::SEQTYPE_SANGER][i],
 		     rcci,
 		     readsmarkedsrm,
 		     repstats);
     }
   } else if(hasSRM){
     // special case: tag all prcs with SRMs
-    for(uint32 actseqtype=0; actseqtype < newprcs_st.size(); ++actseqtype){
-      for(uint32 ni=0; ni< newprcs_st[actseqtype].size(); ++ni){
-	if(newprcs_st[actseqtype][ni].type == Read::REA_tagentry_idSRMr) {
-	  nmpr_tagColumn(newprcs_st[actseqtype][ni],
+    for(uint32 actseqtype=0; actseqtype < newprcs_st.size(); actseqtype++){
+      for(uint32 i=0; i< newprcs_st[actseqtype].size(); i++){
+	if(newprcs_st[actseqtype][i].type == Read::REA_tagentry_idSRMr) {
+	  nmpr_tagColumn(newprcs_st[actseqtype][i],
 			 rcci,
 			 readsmarkedsrm,
 			 repstats);
@@ -1765,10 +1594,10 @@ void Contig::nmpr_cautiousMultiSeqTypeTagging(const ercci_t & ercci, const rcci_
   } else {
     // tag all
     CEBUGF2("Tagging all\n");
-    for(uint32 actseqtype=0; actseqtype < newprcs_st.size(); ++actseqtype){
+    for(uint32 actseqtype=0; actseqtype < newprcs_st.size(); actseqtype++){
       CEBUGF2("newprcs_st[actseqtype].size(): " << newprcs_st[actseqtype].size() << '\n');
-      for(uint32 ni=0; ni< newprcs_st[actseqtype].size(); ++ni){
-	nmpr_tagColumn(newprcs_st[actseqtype][ni],
+      for(uint32 i=0; i< newprcs_st[actseqtype].size(); i++){
+	nmpr_tagColumn(newprcs_st[actseqtype][i],
 		       rcci,
 		       readsmarkedsrm,
 		       repstats);
@@ -1794,12 +1623,12 @@ void Contig::nmpr_evaluateOneSeqType(const uint32 actseqtype, const ercci_t & er
 {
   FUNCSTART("void Contig::nmpr_evaluateOneSeqType(const ercci_t & ercci, vector<vector <nngroups_t> > & groups_st, nnpos_rep_col_t & newprc)");
 
-  bool assumesnpinsteadrmb= (*CON_miraparams)[0].getContigParams().con_assume_snp_insteadof_rmb;
+  contig_parameters const & con_params= (*CON_miraparams)[actseqtype].getContigParams();
 
   newprcvec.clear();
 
   nnpos_rep_col_t templateprc=emptyprc;
-  templateprc.contigpos=ercci.getContigPos();
+  templateprc.contigpos=ercci.actcontigpos;
 
 
   // count some numbers
@@ -1814,21 +1643,21 @@ void Contig::nmpr_evaluateOneSeqType(const uint32 actseqtype, const ercci_t & er
   bool hasweakgap=false;
 
   bool maybestrong=false;
-  for(uint32 strainid=0; strainid<groups_st.size(); ++strainid){
+  for(uint32 strainid=0; strainid<groups_st.size(); strainid++){
     uint32 groupsinstrain=0;
     uint32 groupmaybestrong=0;
-    for(auto & actgroup : groups_st[strainid]) {
-      if(actgroup.valid){
+    for(uint32 actgroup=0; actgroup<groups_st[strainid].size(); actgroup++){
+      if(groups_st[strainid][actgroup].valid){
 	if(groupsinstrain==0) numstrainswithvalids++;
-	++groupsinstrain;
+	groupsinstrain++;
 
-	if(actseqtype == ReadGroupLib::SEQTYPE_SANGER
-	   && actgroup.base=='*'
+	if(actseqtype == Read::SEQTYPE_SANGER
+	   && groups_st[strainid][actgroup].base=='*'
 	   && groupsinstrain == 2){
 	  hasweakgap=true;
-	  if(actgroup.forwarddircounter + actgroup.complementdircounter >= 8
-	     && actgroup.forwarddircounter >= 4
-	     && actgroup.complementdircounter >= 4){
+	  if(groups_st[strainid][actgroup].forwarddircounter + groups_st[strainid][actgroup].complementdircounter >= 8
+	     && groups_st[strainid][actgroup].forwarddircounter >= 4
+	     && groups_st[strainid][actgroup].complementdircounter >= 4){
 	    ++groupmaybestrong;
 	  }
 	}
@@ -1836,13 +1665,13 @@ void Contig::nmpr_evaluateOneSeqType(const uint32 actseqtype, const ercci_t & er
 	// Solexa also needs weak gaps at SRM positions
 	// but ... if there are really too many gaps/non-gaps, this seems pretty strong
 	// prepare to change that later
-	if(actseqtype == ReadGroupLib::SEQTYPE_SOLEXA){
-	  if(actgroup.forwarddircounter + actgroup.complementdircounter >= 10
-	     && actgroup.forwarddircounter >= 5
-	     && actgroup.complementdircounter >= 5){
+	if(actseqtype == Read::SEQTYPE_SOLEXA){
+	  if(groups_st[strainid][actgroup].forwarddircounter + groups_st[strainid][actgroup].complementdircounter >= 10
+	     && groups_st[strainid][actgroup].forwarddircounter >= 5
+	     && groups_st[strainid][actgroup].complementdircounter >= 5){
 	    ++groupmaybestrong;
 	  }
-	  if(actgroup.base=='*'
+	  if(groups_st[strainid][actgroup].base=='*'
 	     && groupsinstrain == 2){
 	    hasweakgap=true;
 	  }
@@ -1854,13 +1683,17 @@ void Contig::nmpr_evaluateOneSeqType(const uint32 actseqtype, const ercci_t & er
   }
 
   // It was a strong solexa gap/nogap SNP ... no weak tagging here!
-  if(actseqtype == ReadGroupLib::SEQTYPE_SOLEXA && maybestrong){
+  if(actseqtype == Read::SEQTYPE_SOLEXA && maybestrong){
     hasweakgap=false;
   }
 
   if(numstrainswithvalids){
-    if(actseqtype == ReadGroupLib::SEQTYPE_ABISOLID){
-      MIRANOTIFY(Notify::INTERNAL, "Type ABI SOLiD needs more support 11.");
+    // TODO: check whether this is ok and Solexa really does not need additional support
+    //if(actseqtype == Read::SEQTYPE_SOLEXA){
+    //  throw Notify(Notify::INTERNAL, THISFUNC, "Type Solexa needs more support 11.");
+    //}
+    if(actseqtype == Read::SEQTYPE_ABISOLID){
+      throw Notify(Notify::INTERNAL, THISFUNC, "Type ABI SOLiD needs more support 11.");
     }
   }
 
@@ -1878,7 +1711,7 @@ void Contig::nmpr_evaluateOneSeqType(const uint32 actseqtype, const ercci_t & er
     // Repeat Marker Base, treat each strain by itself, i.e.,
     //  return one prc per strain which has >=2 groups
     // just check whether they should be treated as SNP
-    if(assumesnpinsteadrmb){
+    if(con_params.con_assume_snp_insteadof_rmb) {
       if(numstrainswithvalids>1){
 	templateprc.type=Read::REA_tagentry_idSIOr;
       }else{
@@ -1889,7 +1722,7 @@ void Contig::nmpr_evaluateOneSeqType(const uint32 actseqtype, const ercci_t & er
       if(hasweakgap) templateprc.type=Read::REA_tagentry_idWRMr;
     }
     CEBUGF2("Determined type: " << multitag_t::getIdentifierStr(templateprc.type) << '\n');
-    for(uint32 strainid=0; strainid<groups_st.size(); ++strainid){
+    for(uint32 strainid=0; strainid<groups_st.size(); strainid++){
       nnpos_rep_col_t tmpprc=templateprc;
       if(nmpr_appendPRCFieldsWithGroupsOfOneStrain(groups_st[strainid],
 						   tmpprc) >1){
@@ -1898,7 +1731,7 @@ void Contig::nmpr_evaluateOneSeqType(const uint32 actseqtype, const ercci_t & er
     }
   }else if(maxgroupsinonestrain>0 && numstrainswithvalids>0){
     // SNP between strains, look at everything together
-    //
+    // 
     templateprc.type=Read::REA_tagentry_idSROr;
     CEBUGF2("Determined type: " << multitag_t::getIdentifierStr(templateprc.type) << '\n');
     nnpos_rep_col_t tmpprc=templateprc;
@@ -1929,18 +1762,20 @@ uint32 Contig::nmpr_appendPRCFieldsWithGroupsOfOneStrain(const vector <nngroups_
   FUNCSTART("void Contig::nmpr_appendPRCFieldsWithGroupsOfOneStrain(const vector <nngroups_t> & groups, nnpos_rep_col_t & newprc)");
 
   uint32 numgroupswithvalids=0;
-  for(auto & actgroup : groups){
-    if(actgroup.valid){
-      ++numgroupswithvalids;
-      CEBUGF2("Valid group:\n" << actgroup);
-
-      newprc.groupbases.push_back(actgroup.base);
-      newprc.groupquals.push_back(actgroup.groupquality);
-      newprc.groupcountsfwd.push_back(actgroup.forwarddircounter);
-      newprc.groupcountsrev.push_back(actgroup.complementdircounter);
-      copy(actgroup.urdids.begin(),
-	   actgroup.urdids.end(),
-	   back_inserter(newprc.urdids));
+  for(uint32 actgroup=0; actgroup<groups.size(); actgroup++){
+    if(groups[actgroup].valid){
+      numgroupswithvalids++;
+      CEBUGF2("Valid group:\n" << groups[actgroup]);
+
+      newprc.groupbases.push_back(groups[actgroup].base);
+      newprc.groupquals.push_back(groups[actgroup].groupquality);
+      copy(groups[actgroup].ids.begin(),
+	   groups[actgroup].ids.end(),
+	   back_inserter(newprc.ids));
+// That's plain wrong!
+//      copy(groups[actgroup].quals.begin(),
+//	   groups[actgroup].quals.end(),
+//	   back_inserter(newprc.groupquals));
     }
   }
   CEBUGF2("Filled data for " << numgroupswithvalids << " valid groups.\n");
@@ -1957,7 +1792,7 @@ uint32 Contig::nmpr_appendPRCFieldsWithGroupsOfOneStrain(const vector <nngroups_
  * Helper for new repeat marker
  *
  * First fill in of groups (per sequencing type per strain). Depending
- *  on sequencing type, look at different
+ *  on sequencing type, look at different 
  *
  *************************************************************************/
 
@@ -1967,115 +1802,117 @@ void Contig::nmpr_firstfillin(const ercci_t & ercci, const vector<int8> & masksh
 {
   FUNCSTART("void Contig::nmpr_firstfillin(const ercci_t & ercci, const vector<int8> & maskshadow)");
 
-  auto & pcri_st_st=ercci.getPCRIstst();
-
-  for(uint32 seqtype=0; seqtype<ReadGroupLib::getNumSequencingTypes(); ++seqtype){
+  for(uint32 seqtype=0; seqtype<Read::getNumSequencingTypes(); seqtype++){
     contig_parameters const & con_rt_params= (*CON_miraparams)[seqtype].getContigParams();
 
+    //if(seqtype == Read::SEQTYPE_SOLEXA){
+    //  throw Notify(Notify::INTERNAL, THISFUNC, "Type Solexa needs more support 12.");
+    //}
+    //if(seqtype == Read::SEQTYPE_ABISOLID){
+    //  throw Notify(Notify::INTERNAL, THISFUNC, "Type ABI SOLiD needs more support 12.");
+    //}
+
+
     int32 endreadmarkexclusionarea=con_rt_params.con_endreadmarkexclusionarea;
     BUGIFTHROW(endreadmarkexclusionarea<1, "endreadmarkexclusionarea may not be < 1");
 
-    for(uint32 strainid=0; strainid < pcri_st_st[0].size(); ++strainid){
-      for(const auto & tpcrI : pcri_st_st[seqtype][strainid]){
+    for(uint32 strainid=0; strainid<ercci.rids_st_st[0].size(); strainid++){
+      for(uint32 readnr=0; readnr < ercci.rids_st_st[seqtype][strainid].size(); readnr++){
 	char           base='?';
 	base_quality_t qual=0;
-
-	int32 readpos=tpcrI.contigPos2UnclippedReadPos(ercci.getContigPos());
+	int32          actreadid=ercci.rids_st_st[seqtype][strainid][readnr];
+	contigread_t & ric =CON_reads[actreadid];
+	  
+	int32 readpos=ric.contigPos2UnclippedReadPos(ercci.actcontigpos);
 
 	// reads that start or end in that region are dangerous as some
 	//  spurious false bases might influence the result. Skip those.
-	if(tpcrI.getReadDirection() > 0){
-	  if(readpos < tpcrI->getLeftClipoff()+endreadmarkexclusionarea
-	     || readpos > tpcrI->getRightClipoff()-endreadmarkexclusionarea) {
-	    CEBUGF2(tpcrI->getName()<< ": readposition too near to start or end of read.\n");
+	if(ric.direction>0){
+	  if(readpos < ric.read.getLeftClipoff()+endreadmarkexclusionarea
+	     || readpos > ric.read.getRightClipoff()-endreadmarkexclusionarea) {
+	    CEBUGF2(ric.read.getName()<< ": readposition too near to start or end of read.\n");
 	    continue;
 	  }
 	}else{
-	  if(tpcrI->calcComplPos(readpos) < tpcrI->getLeftClipoff()+endreadmarkexclusionarea
-	     || tpcrI->calcComplPos(readpos) > tpcrI->getRightClipoff()-endreadmarkexclusionarea) {
-	    CEBUGF2(tpcrI->getName()<< ": readposition too near to start or end of read.\n");
+	  if(ric.read.calcComplPos(readpos) < ric.read.getLeftClipoff()+endreadmarkexclusionarea 
+	     || ric.read.calcComplPos(readpos) > ric.read.getRightClipoff()-endreadmarkexclusionarea) {
+	    CEBUGF2(ric.read.getName()<< ": readposition too near to start or end of read.\n");
 	    continue;
 	  }
 	}
 
-	CEBUGF2("Looking at " << ercci.getContigPos() << " " << readpos << " " << tpcrI->getName()<< " ");
+	CEBUGF2("Looking at " << ercci.actcontigpos << " " << readpos << " " << ric.read.getName()<< " ");
 
 	// check whether this read has a tag that prohibits searching for repeats here
-	// (only PSHP for the time being)
-	if(maskshadow[ercci.getContigPos()]) {
+	// (only FpAS & PSHP for the time being)
+	if(maskshadow[ercci.actcontigpos]) {
 	  // remember that the readpos computing routine doesn't take care
 	  //  of direction, so we have to complement that position in reverse cases
 	  int32 rawreadpos=readpos;
-	  if(tpcrI.getReadDirection() < 0){
-	    rawreadpos=tpcrI->calcComplPos(readpos);
+	  if(ric.direction<0){
+	    rawreadpos=ric.read.calcComplPos(readpos);
 	  }
-
-	  CEBUGF2("MASKED: " << ercci.getContigPos() << endl);
-	  CEBUGF2(tpcrI->getName() << "\t" << rawreadpos << "\t");
+	    
+	  CEBUGF2("MASKED: " << ercci.actcontigpos << endl);
+	  CEBUGF2(ric.read.getName() << "\t" << rawreadpos << "\t");
 	  bool maskfound=false;
-	  for(uint32 mtti=0; mtti<masktagtypes.size(); ++mtti){
-	    if(tpcrI->hasTag(masktagtypes[mtti],rawreadpos)) {
-	      CEBUGF2("Masked with " << multitag_t::getIdentifierStr(masktagtypes[mtti]) << ", next read.\n");
+	  for(uint32 i=0; i<masktagtypes.size(); i++){
+	    if(ric.read.hasTag(masktagtypes[i],rawreadpos)) {
+	      CEBUGF2("Masked with " << multitag_t::getIdentifierStr(masktagtypes[i]) << ", next read.\n");
 	      maskfound=true;
 	      break;
 	    }
 	  }
 	  if(maskfound) continue;
 	}
-
-	// ok, we know that we are at least con_endreadmarkexclusionarea away from
+	  
+	// ok, we know that we are at least con_endreadmarkexclusionarea away from 
 	//  the limits.
 	// we now check if:
 	//  1) a base left or right is a *
 	//  2) there's a masked base (X) within the con_endreadmarkexclusionarea
 	//      left and right
 	// if yes: in dubio pro reo, do not mark and skip
-
+	  
 	// untested, but should work
-
-#if CPP_READ_SEQTYPE_END != 8
-#error "This code is made for 8 sequencing types, adapt!"
+	  
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
 #endif
 	if(con_rt_params.con_endreadmarkexclusionarea >0
-	   && readpos > 0 && readpos+1 < tpcrI->getLenSeq() ) {
+	   && readpos >0 && readpos+1<ric.read.getLenSeq() ) {
 	  vector<char>::const_iterator B,S,E;
-	  if(tpcrI.getReadDirection()>0){
-	    B=tpcrI->getSeqIteratorBegin();
+	  if(ric.direction>0){
+	    B=ric.read.getSeqIteratorBegin();
 	    S=B;
-	    E=tpcrI->getSeqIteratorEnd();
+	    E=ric.read.getSeqIteratorEnd();
 	  }else{
-	    B=tpcrI->getComplementSeqIteratorBegin();
+	    B=ric.read.getComplementSeqIteratorBegin();
 	    S=B;
-	    E=tpcrI->getComplementSeqIteratorEnd();
+	    E=ric.read.getComplementSeqIteratorEnd();
 	  }
 	  advance(S,readpos);
-
+	    
 	  // if we do not mark gap bases, check whether we have a gap
 	  //  beside the actual position. If yes, then stop looking at this
 	  //  read.
 	  bool stopsearch=false;
 	  if(*(S-1) == '*' || *(S+1)=='*') {
 	    switch(seqtype) {
-	    case ReadGroupLib::SEQTYPE_IONTORRENT:
-	    case ReadGroupLib::SEQTYPE_454GS20: {
-	    //case ReadGroupLib::SEQTYPE_454GS20CONS:
-	    //case ReadGroupLib::SEQTYPE_454GS20CONSSHRED:{
+	    case Read::SEQTYPE_IONTORRENT:
+	    case Read::SEQTYPE_454GS20: {
+	    //case Read::SEQTYPE_454GS20CONS: 
+	    //case Read::SEQTYPE_454GS20CONSSHRED:{
 	      stopsearch=true;
 	      break;
 	    }
-	    case ReadGroupLib::SEQTYPE_ABISOLID: {
-	      MIRANOTIFY(Notify::INTERNAL, "Type ABI SOLiD needs more support 12a.");
+	    case Read::SEQTYPE_ABISOLID: {
+	      throw Notify(Notify::INTERNAL, THISFUNC, "Type ABI SOLiD needs more support 12a.");
 	      break;
 	    }
-	    case ReadGroupLib::SEQTYPE_PACBIOHQ:
-	    case ReadGroupLib::SEQTYPE_PACBIOLQ: {
-	      // TODO: PacBio HQ / LQ
-
-	      // at the moment, fall through to Solexa / Sanger
-	    }
-	    case ReadGroupLib::SEQTYPE_TEXT:
-	    case ReadGroupLib::SEQTYPE_SOLEXA:
-	    case ReadGroupLib::SEQTYPE_SANGER: {
+	    case Read::SEQTYPE_PACBIO:
+	    case Read::SEQTYPE_SOLEXA:
+	    case Read::SEQTYPE_SANGER: {
 	      // with SANGER and Solexa, check with parameters
 	      if(con_rt_params.con_also_mark_gap_bases==false
 		 || (con_rt_params.con_also_mark_gap_bases==true
@@ -2087,14 +1924,14 @@ void Contig::nmpr_firstfillin(const ercci_t & ercci, const vector<int8> & masksh
 	    default : {
 	      cout.flush();
 	      cerr << "Seqtype: " << seqtype << endl;
-	      MIRANOTIFY(Notify::INTERNAL, "Unknown seqtype?.");
+	      throw Notify(Notify::INTERNAL, THISFUNC, "Unknown seqtype?.");
 	    }
 	    }
 	    if(stopsearch) {
-	      CEBUGF2(tpcrI->getName()<< ": there's a * beside me, I won't count.\n");
+	      CEBUGF2(ric.read.getName()<< ": there's a * beside me, I won't count.\n");
 	      continue;
 	    }
-
+	    
             // now check whether we have masked bases (X) within reach
 	    // this would mean that we are still in the endread exclusion
 	    //  area (not best tactic, as Xed out bases may be within read,
@@ -2136,75 +1973,73 @@ void Contig::nmpr_firstfillin(const ercci_t & ercci, const vector<int8> & masksh
 	  uint32 rocksolid=0;            // special for Solexa and perhaps SOLiD
 	  const static base_quality_t rsthreshold=37;  // threshold for rock solid qual
 
-#if CPP_READ_SEQTYPE_END != 8
-#error "This code is made for 8 sequencing types, adapt!"
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
 #endif
 	  base_quality_t minqual;
 	  switch(seqtype) {
-	  case ReadGroupLib::SEQTYPE_SANGER:
-	  case ReadGroupLib::SEQTYPE_454GS20:
-	  case ReadGroupLib::SEQTYPE_IONTORRENT:
-	  case ReadGroupLib::SEQTYPE_PACBIOHQ:
-	  case ReadGroupLib::SEQTYPE_PACBIOLQ:
-	  case ReadGroupLib::SEQTYPE_TEXT:
-	  case ReadGroupLib::SEQTYPE_SOLEXA: {
+	  case Read::SEQTYPE_SANGER:
+	  case Read::SEQTYPE_454GS20:
+	  case Read::SEQTYPE_IONTORRENT:
+	  case Read::SEQTYPE_PACBIO:
+	  case Read::SEQTYPE_SOLEXA: {
 	    minqual=con_rt_params.con_minrmbneighbourqual;
 	    break;
 	  }
-	  case ReadGroupLib::SEQTYPE_ABISOLID: {
-	    MIRANOTIFY(Notify::INTERNAL, "Type ABI SOLiD needs more support 14.");
+	  case Read::SEQTYPE_ABISOLID: {
+	    throw Notify(Notify::INTERNAL, THISFUNC, "Type ABI SOLiD needs more support 14.");
 	    break;
 	  }
 	  default : {
 	    cout.flush();
 	    cerr << "Seqtype: " << seqtype << endl;
-	    MIRANOTIFY(Notify::INTERNAL, "Unknown seqtype? 14");
+	    throw Notify(Notify::INTERNAL, THISFUNC, "Unknown seqtype? 14");
 	  }
 	  }
 
-	  if(tpcrI.getReadDirection()>0){
+	  if(ric.direction>0){
 	    CEBUGF2(" + ");
-	    base=toupper(tpcrI->getBaseInSequence(readpos));
-	    qual=tpcrI->getQualityInSequence(readpos);
+	    base=toupper(ric.read.getBaseInSequence(readpos));
+	    qual=ric.read.getQualityInSequence(readpos);
 	    if(readpos-1<0){
 	      CEBUGF2(" <oob");
 	      skipit=true;
-	    }else if(tpcrI->getQualityInSequence(readpos-1) < minqual) {
+	    }else if(ric.read.getQualityInSequence(readpos-1) < minqual) {
 	      CEBUGF2(" <fail_minqual");
 	      skipit=true;
 	    }else if(qual>=rsthreshold){
-	      ++rocksolid;
+	      rocksolid++;
 	    }
-	    if(readpos+1 >= tpcrI->getLenSeq()){
+	    if(readpos+1 >= ric.read.getLenSeq()){
 	      CEBUGF2(" >oob");
 	      skipit=true;
-	    }else if(tpcrI->getQualityInSequence(readpos+1) < minqual) {
+	    }else if(ric.read.getQualityInSequence(readpos+1) < minqual) {
 	      CEBUGF2(" >fail_minqual");
 	      skipit=true;
 	    }else if(qual>=rsthreshold){
-	      ++rocksolid;
+	      rocksolid++;
 	    }
 	  }else{
 	    CEBUGF2(" - ");
-	    base=toupper(tpcrI->getBaseInComplementSequence(readpos));
-	    qual=tpcrI->getQualityInComplementSequence(readpos);
+	    base=toupper(ric.read.getBaseInComplementSequence(readpos));
+	    qual=ric.read.getQualityInComplementSequence(readpos);
 	    if(readpos-1<0){
 	      CEBUGF2(" <oob");
 	      skipit=true;
-	    }else if(tpcrI->getQualityInComplementSequence(readpos-1) < minqual) {
+	    }else if(ric.read.getQualityInComplementSequence(readpos-1) < minqual) {
 	      skipit=true;
 	      CEBUGF2(" <fail_minqual");
 	    }else if(qual>=rsthreshold){
-	      ++rocksolid;
+	      rocksolid++;
 	    }
-	    if(readpos+1 >= tpcrI->getLenSeq()){
+	    if(readpos+1 >= ric.read.getLenSeq()){
 	      CEBUGF2(" >oob");
 	      skipit=true;
-	    }else if(tpcrI->getQualityInComplementSequence(readpos+1) < minqual) {
+	    }else if(ric.read.getQualityInComplementSequence(readpos+1) < minqual) {
 	      CEBUGF2(" >fail_minqual");
 	      skipit=true;
 	    }else if(qual>=rsthreshold){
-	      ++rocksolid;
+	      rocksolid++;
 	    }
 	  }
 	  if(!skipit){
@@ -2212,13 +2047,13 @@ void Contig::nmpr_firstfillin(const ercci_t & ercci, const vector<int8> & masksh
 	      CEBUGF2(" qual below threshold " << base << " " << static_cast<uint16>(qual) << endl);
 	      skipit=true;
 	    }else if(qual>=rsthreshold){
-	      ++rocksolid;
+	      rocksolid++;
 	    }
 	  }
 	  if(skipit) {
 	    // special rule for solexa: we'll also go with two out of the three bases,
 	    //  if they have a rock solid quality
-	    if(seqtype==ReadGroupLib::SEQTYPE_SOLEXA){
+	    if(seqtype==Read::SEQTYPE_SOLEXA){
 	      if(rocksolid>=2) skipit=false;
 	    }
 	    if(skipit) {
@@ -2227,34 +2062,35 @@ void Contig::nmpr_firstfillin(const ercci_t & ercci, const vector<int8> & masksh
 	    }
 	  }
 	}
-
+	  
 	CEBUGF2(base << " " << static_cast<uint16>(qual) << endl);
 
-	// Quality of bases from railreads are set to 0 so as not
+	// Quality of bases from railreads are set to 0 so as not 
 	//  to be counted twice (as bases are the same as in backbone)
 	//
-	if(tpcrI->isRail()) {
+	if(ric.read.isRail()) {
 	  qual=0;
 	}
 
-	for(auto & actgroup : groups_st_st[seqtype][strainid]) {
-	  if(actgroup.base==base) {
-	    actgroup.urdids.push_back(tpcrI.getURDID());
-	    actgroup.quals.push_back(qual);
-	    actgroup.directions.push_back(tpcrI.getReadDirection());
+	
+	for(uint32 actgroup=0; actgroup<groups_st_st[seqtype][strainid].size(); actgroup++) {
+	  if(groups_st_st[seqtype][strainid][actgroup].base==base) {
+	    groups_st_st[seqtype][strainid][actgroup].ids.push_back(actreadid);
+	    groups_st_st[seqtype][strainid][actgroup].quals.push_back(qual);
+	    groups_st_st[seqtype][strainid][actgroup].directions.push_back(ric.direction);
 
 	    // if it is a rail or a backbone, the info counts for
 	    //  both forward and complement direction
 	    // else only for it's given direction
-	    if(tpcrI->isRail() || tpcrI->isBackbone()) {
+	    if(ric.read.isRail() || ric.read.isBackbone()) {
 	      // TODO: not sure whether this is really good! (May05)
-	      //actgroup.hasforwarddir=true;
-	      //actgroup.hascomplementdir=true;
+	      //groups_st_st[seqtype][strainid][actgroup].hasforwarddir=true;
+	      //groups_st_st[seqtype][strainid][actgroup].hascomplementdir=true;
 	    }else{
-	      if(tpcrI.getReadDirection()>0){
-		++actgroup.forwarddircounter;
+	      if(ric.direction>0){
+		groups_st_st[seqtype][strainid][actgroup].forwarddircounter++;
 	      }else{
-		++actgroup.complementdircounter;
+		groups_st_st[seqtype][strainid][actgroup].complementdircounter++;
 	      }
 	    }
 	    break;
@@ -2262,9 +2098,9 @@ void Contig::nmpr_firstfillin(const ercci_t & ercci, const vector<int8> & masksh
 	}
       }
 
-      // compute the groups quality
-      for(auto & actgroup : groups_st_st[seqtype][strainid]) {
-	calcGroupQual(actgroup);
+      // compute the group quality
+      for(uint32 actgroup=0; actgroup<groups_st_st[seqtype][strainid].size(); actgroup++) {
+	calcGroupQual(groups_st_st[seqtype][strainid][actgroup]);
       }
     }
   }
@@ -2300,59 +2136,68 @@ void Contig::nmpr_secondfillin(const ercci_t & ercci, const vector<int8> & masks
   validgroups['G']=0;
   validgroups['T']=0;
   validgroups['*']=0;
-  for(uint32 seqtype=0; seqtype < ReadGroupLib::getNumSequencingTypes(); ++seqtype){
-    for(uint32 strainid=0; strainid < groups_st_st[0].size(); ++strainid){
+  for(uint32 seqtype=0; seqtype<Read::getNumSequencingTypes(); seqtype++){
+    for(uint32 strainid=0; strainid<groups_st_st[0].size(); strainid++){
       bool involvesagap=false;
-      for(auto & actgroup : groups_st_st[seqtype][strainid]) {
-	if(actgroup.valid==false) continue;
-	validgroups[actgroup.base]=1;
-	if(actgroup.base=='*') involvesagap=true;
+      for(uint32 actgroup=0; actgroup<groups_st_st[seqtype][strainid].size(); actgroup++) {
+	if(groups_st_st[seqtype][strainid][actgroup].valid==false) continue;
+	validgroups[groups_st_st[seqtype][strainid][actgroup].base]=1;
+	if(groups_st_st[seqtype][strainid][actgroup].base=='*') involvesagap=true;
       }
     }
   }
 
-  auto & pcri_st_st=ercci.getPCRIstst();
-
-  for(uint32 seqtype=0; seqtype < ReadGroupLib::getNumSequencingTypes(); ++seqtype){
-    for(uint32 strainid=0; strainid < groups_st_st[0].size(); ++strainid){
-      for(auto & actgroup : groups_st_st[seqtype][strainid]) {
-	if(validgroups[actgroup.base]==0) continue;
-	actgroup.forwarddircounter=0;
-	actgroup.complementdircounter=0;
-	actgroup.urdids.clear();
-	actgroup.quals.clear();
-	actgroup.directions.clear();
-	CEBUGF2("group " << actgroup.base << " will be refilled.\n");
-	if(actgroup.base=='*') involvesagap=true;
+  for(uint32 seqtype=0; seqtype<Read::getNumSequencingTypes(); seqtype++){
+    for(uint32 strainid=0; strainid<groups_st_st[0].size(); strainid++){
+
+      for(uint32 actgroup=0; actgroup<groups_st_st[seqtype][strainid].size(); actgroup++) {
+	if(validgroups[groups_st_st[seqtype][strainid][actgroup].base]==0) continue;
+	groups_st_st[seqtype][strainid][actgroup].forwarddircounter=0;
+	groups_st_st[seqtype][strainid][actgroup].complementdircounter=0;
+	groups_st_st[seqtype][strainid][actgroup].ids.clear();
+	groups_st_st[seqtype][strainid][actgroup].quals.clear();
+	groups_st_st[seqtype][strainid][actgroup].directions.clear();
+	CEBUGF2("group " << actgroup << " will be refilled.\n");
+	if(groups_st_st[seqtype][strainid][actgroup].base=='*') involvesagap=true;
       }
 
-      for(const auto & tpcrI : pcri_st_st[seqtype][strainid]){
-	int32 readpos=tpcrI.contigPos2UnclippedReadPos(ercci.getContigPos());
-
+      for(uint32 readnr=0; readnr < ercci.rids_st_st[seqtype][strainid].size(); readnr++){
+	int32          actreadid=ercci.rids_st_st[seqtype][strainid][readnr];
+	contigread_t & ric =CON_reads[actreadid];
+	int32 readpos=ric.contigPos2UnclippedReadPos(ercci.actcontigpos);
+	
 	// get base and basequal
-	char           base=toupper(tpcrI.getBase(ercci.getContigPos()));
-	base_quality_t qual=tpcrI.getQuality(ercci.getContigPos());
-
-	uint32 actgroupid;
+	char           base=toupper(ric.getBase(ercci.actcontigpos));
+	base_quality_t qual=ric.getQuality(ercci.actcontigpos);
+
+	//if(ric.direction>0){
+	//  base=toupper(ric.read.getBaseInSequence(readpos));
+	//  qual=ric.read.getQualityInSequence(readpos);
+	//}else{
+	//  base=toupper(ric.read.getBaseInComplementSequence(readpos));
+	//  qual=ric.read.getQualityInComplementSequence(readpos);
+	//}
+
+	uint32 actgroup;
 	switch(base){
 	case 'A': {
-	  actgroupid=0;
+	  actgroup=0;
 	  break;
 	}
 	case 'C': {
-	  actgroupid=1;
+	  actgroup=1;
 	  break;
 	}
 	case 'G': {
-	  actgroupid=2;
+	  actgroup=2;
 	  break;
 	}
 	case 'T': {
-	  actgroupid=3;
+	  actgroup=3;
 	  break;
 	}
 	case '*': {
-	  actgroupid=4;
+	  actgroup=4;
 	  break;
 	}
 	default: {
@@ -2361,9 +2206,9 @@ void Contig::nmpr_secondfillin(const ercci_t & ercci, const vector<int8> & masks
 	}
 	}
 
-	// if this base in this read is not in a valid group, continue
-	if(groups_st_st[seqtype][strainid][actgroupid].valid==false) continue;
-
+	// if this base in this read is not in a valid group, continue 
+	if(groups_st_st[seqtype][strainid][actgroup].valid==false) continue;
+	
 	// still care about a read end exclusion area,
 	//  but this time a fixed one, not sequencing type dependent
 	int32 endreadmarkexclusionarea=2;
@@ -2376,42 +2221,42 @@ void Contig::nmpr_secondfillin(const ercci_t & ercci, const vector<int8> & masks
 	// comeback of the sequencing type dependend area
 	// as I do not have time atm to check the above TODO, I'll define
 	//  that only for Solexas, the area is 0
-	if(seqtype == ReadGroupLib::SEQTYPE_SOLEXA){
+	if(seqtype == Read::SEQTYPE_SOLEXA){
 	  endreadmarkexclusionarea=0;
 	}
 
-	if(tpcrI.getReadDirection()>0){
-	  if(readpos < tpcrI->getLeftClipoff()+endreadmarkexclusionarea
-	     || readpos > tpcrI->getRightClipoff()-endreadmarkexclusionarea) {
-	    CEBUGF2(tpcrI->getName()<< ": readposition too near to start or end of read.\n");
+	if(ric.direction>0){
+	  if(readpos < ric.read.getLeftClipoff()+endreadmarkexclusionarea
+	     || readpos > ric.read.getRightClipoff()-endreadmarkexclusionarea) {
+	    CEBUGF2(ric.read.getName()<< ": readposition too near to start or end of read.\n");
 	    continue;
 	  }
 	}else{
-	  if(tpcrI->calcComplPos(readpos) < tpcrI->getLeftClipoff()+endreadmarkexclusionarea
-	     || tpcrI->calcComplPos(readpos) > tpcrI->getRightClipoff()-endreadmarkexclusionarea) {
-	    CEBUGF2(tpcrI->getName()<< ": readposition too near to start or end of read.\n");
+	  if(ric.read.calcComplPos(readpos) < ric.read.getLeftClipoff()+endreadmarkexclusionarea 
+	     || ric.read.calcComplPos(readpos) > ric.read.getRightClipoff()-endreadmarkexclusionarea) {
+	    CEBUGF2(ric.read.getName()<< ": readposition too near to start or end of read.\n");
 	    continue;
 	  }
 	}
-
-	CEBUGF2("Looking at " << tpcrI->getName()<< " ");
-
-	// check whether this read has a tag that prohibits searching
+	
+	CEBUGF2("Looking at " << ric.read.getName()<< " ");
+	
+	// check whether this read has a tag that prohibits searching 
 	//  or tagging repeats here
-	// (only PSHP for the time being)
-	if(maskshadow[ercci.getContigPos()]) {
+	// (only FpAS & PSHP for the time being)
+	if(maskshadow[ercci.actcontigpos]) {
 	  // remember that the readpos computing routine doesn't take care
 	  //  of direction, so we have to complement that position in reverse cases
 	  int32 rawreadpos=readpos;
-	  if(tpcrI.getReadDirection()<0){
-	    rawreadpos=tpcrI->calcComplPos(readpos);
+	  if(ric.direction<0){
+	    rawreadpos=ric.read.calcComplPos(readpos);
 	  }
-
-	  CEBUGF2("MASKED: " << ercci.getContigPos() << endl);
-	  CEBUGF2(tpcrI->getName() << "\t" << rawreadpos << "\t");
+	  
+	  CEBUGF2("MASKED: " << ercci.actcontigpos << endl);
+	  CEBUGF2(ric.read.getName() << "\t" << rawreadpos << "\t");
 	  bool maskfound=false;
 	  for(uint32 i=0; i<masktagtypes.size(); i++){
-	    if(tpcrI->hasTag(masktagtypes[i],rawreadpos)) {
+	    if(ric.read.hasTag(masktagtypes[i],rawreadpos)) {
 	      CEBUGF2("Masked with " << multitag_t::getIdentifierStr(masktagtypes[i]) << ", next read.\n");
 	      maskfound=true;
 	      break;
@@ -2419,55 +2264,55 @@ void Contig::nmpr_secondfillin(const ercci_t & ercci, const vector<int8> & masks
 	  }
 	  if(maskfound) continue;
 	}
-
+	
 	// ok, we know that we are at least endreadmarkexclusionarea
 	//  away from the read ends and are in a valid group
-
+	  
 	CEBUGF2(base << " " << static_cast<uint16>(qual) << "\trefill.\n");
-
-	// Quality of bases from railreads are set to 0 so as not
+	
+	// Quality of bases from railreads are set to 0 so as not 
 	//  to be counted twice (as bases are the same as in backbone)
 	//
-	if(tpcrI->isRail()) {
+	if(ric.read.isRail()) {
 	  qual=0;
 	}
 
-	groups_st_st[seqtype][strainid][actgroupid].urdids.push_back(tpcrI.getURDID());
-	groups_st_st[seqtype][strainid][actgroupid].quals.push_back(qual);
-	groups_st_st[seqtype][strainid][actgroupid].directions.push_back(tpcrI.getReadDirection());
+	groups_st_st[seqtype][strainid][actgroup].ids.push_back(actreadid);
+	groups_st_st[seqtype][strainid][actgroup].quals.push_back(qual);
+	groups_st_st[seqtype][strainid][actgroup].directions.push_back(ric.direction);
 
 	// if it is a rail or a backbone, the info counts for
 	//  both forward and complement direction
 	// else only for it's given direction
-	if(tpcrI->isRail() || tpcrI->isBackbone()) {
+	if(ric.read.isRail() || ric.read.isBackbone()) {
 	}else{
-	  if(tpcrI.getReadDirection() > 0){
-	    ++groups_st_st[seqtype][strainid][actgroupid].forwarddircounter;
+	  if(ric.direction>0){
+	    groups_st_st[seqtype][strainid][actgroup].forwarddircounter++;
 
 	    // TODO: test
 	    // if it is a merged short read, count it also as reverse
-	    if(tpcrI->isCoverageEquivalentRead()
-	       && (seqtype==ReadGroupLib::SEQTYPE_SOLEXA
-		   || seqtype==ReadGroupLib::SEQTYPE_ABISOLID)){
-	      ++groups_st_st[seqtype][strainid][actgroupid].complementdircounter;
+	    if(ric.read.isCoverageEquivalentRead()
+	       && (seqtype==Read::SEQTYPE_SOLEXA
+		   || seqtype==Read::SEQTYPE_ABISOLID)){
+	      groups_st_st[seqtype][strainid][actgroup].complementdircounter++;
 	    }
 	  }else{
-	    ++groups_st_st[seqtype][strainid][actgroupid].complementdircounter;
+	    groups_st_st[seqtype][strainid][actgroup].complementdircounter++;
 	  }
 	}
       }
 
-      // compute the groups quality and set valid flag
-      for(auto & actgroup : groups_st_st[seqtype][strainid]) {
-	if(actgroup.forwarddircounter
-	   || actgroup.complementdircounter){
-	  actgroup.valid=true;
+      // compute the group quality
+      for(uint32 actgroup=0; actgroup<groups_st_st[seqtype][strainid].size(); actgroup++) {
+	if(groups_st_st[seqtype][strainid][actgroup].forwarddircounter
+	   || groups_st_st[seqtype][strainid][actgroup].complementdircounter){
+	  groups_st_st[seqtype][strainid][actgroup].valid=true;
 	}
-	calcGroupQual(actgroup);
+	calcGroupQual(groups_st_st[seqtype][strainid][actgroup]);
       }
     }
   }
-
+  
   FUNCEND();
   return;
 }
@@ -2497,107 +2342,96 @@ void Contig::nmpr_rategroups(vector<vector<vector <nngroups_t> > > & groups_st_s
 {
   FUNCSTART("void Contig::nmpr_rategroups(vector<vector<vector <nngroups_t> > > & groups_st_st, cccontainer_t::const_iterator ccI)");
 
-  // compute group quality and check the groups: valid or not?
 
-  for(uint32 seqtype=0; seqtype<ReadGroupLib::getNumSequencingTypes(); ++seqtype){
+  // compute group quality and check the groups: valid or not?
+  
+  for(uint32 seqtype=0; seqtype<Read::getNumSequencingTypes(); seqtype++){
     contig_parameters const & con_rt_params= (*CON_miraparams)[seqtype].getContigParams();
 
-    for(uint32 strainid=0; strainid<groups_st_st[0].size(); ++strainid){
-
+    for(uint32 strainid=0; strainid<groups_st_st[0].size(); strainid++){
+      
       uint32 maxreadingroupcount=0;
       uint32 minreadingroupcount=10000000;
+  
+      for(uint32 actgroup=0; actgroup<groups_st_st[seqtype][strainid].size(); actgroup++) {
+	CEBUGF2("Comp group: seqt(" << seqtype << ")\tstrain(" << strainid << ")\t" << static_cast<char>(groups_st_st[seqtype][strainid][actgroup].base) << " ");
 
-      for(auto & actgroup : groups_st_st[seqtype][strainid]) {
-	CEBUGF2("Comp group: seqt(" << seqtype << ")\tstrain(" << strainid << ")\t" << static_cast<char>(actgroup.base) << " ");
-
-	CEBUGF2(static_cast<uint16>(actgroup.groupquality));
-	CEBUGF2('\t' << actgroup.urdids.size());
+	CEBUGF2(static_cast<uint16>(groups_st_st[seqtype][strainid][actgroup].groupquality));
+	CEBUGF2('\t' << groups_st_st[seqtype][strainid][actgroup].ids.size());
+	
+	// TODO: configure if check by character only or if qualities are also taken 
 
-	// TODO: configure if check by character only or if qualities are also taken
-
-	actgroup.valid=false;
+	groups_st_st[seqtype][strainid][actgroup].valid=false;
 
 	//// continue if no base is present
 
-	if(actgroup.urdids.empty()) {
+	if(groups_st_st[seqtype][strainid][actgroup].ids.empty()) {
 	  CEBUGF2("empty\n");
-	}else if(actgroup.base=='*' && !con_rt_params.con_also_mark_gap_bases){
-	  CEBUGF2("gap group and no gap marking wished\n");
+	  groups_st_st[seqtype][strainid][actgroup].valid=false;
 	}else{
 	  // basically give every group a valid=true if reads are present
 	  // set valid back to false later on for each sequencing type
-	  actgroup.valid=true;
-
-#if CPP_READ_SEQTYPE_END != 8
-#error "This code is made for 8 sequencing types, adapt!"
+	  groups_st_st[seqtype][strainid][actgroup].valid=true;
+    
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
 #endif
 	  switch(seqtype) {
-	  case ReadGroupLib::SEQTYPE_SANGER: {
+	  case Read::SEQTYPE_SANGER: {
 	    // groups with Sanger reads need a minimum quality in group and minimum number
 	    //  of reads per group as set in preferences
-	    if(static_cast<int32>(actgroup.urdids.size()) < con_rt_params.con_minreadspergroup
-	       || actgroup.groupquality<con_rt_params.con_mingroupqualforrmbtagging){
-	      actgroup.valid=false;
+	    if(static_cast<int32>(groups_st_st[seqtype][strainid][actgroup].ids.size()) < con_rt_params.con_minreadspergroup
+	       || groups_st_st[seqtype][strainid][actgroup].groupquality<con_rt_params.con_mingroupqualforrmbtagging){
+	      groups_st_st[seqtype][strainid][actgroup].valid=false;
 	    }
 	    break;
 	  }
-	  case ReadGroupLib::SEQTYPE_454GS20: {
+	  case Read::SEQTYPE_454GS20: {
 	    // groups with 454 reads need forward & reverse directions in group
-	    // AND a minimum quality in group
+	    // AND a minimum quality in group 
 	    // AND and minimum number of reads per group as set in preferences
-	    if(actgroup.forwarddircounter==0
-	       || actgroup.complementdircounter==0
-	       || actgroup.groupquality<con_rt_params.con_mingroupqualforrmbtagging
-	       || static_cast<int32>(actgroup.urdids.size()) < con_rt_params.con_minreadspergroup){
-	      actgroup.valid=false;
+	    if(groups_st_st[seqtype][strainid][actgroup].forwarddircounter==0
+	       || groups_st_st[seqtype][strainid][actgroup].complementdircounter==0
+	       || groups_st_st[seqtype][strainid][actgroup].groupquality<con_rt_params.con_mingroupqualforrmbtagging
+	       || static_cast<int32>(groups_st_st[seqtype][strainid][actgroup].ids.size()) < con_rt_params.con_minreadspergroup){
+	      groups_st_st[seqtype][strainid][actgroup].valid=false;
 	    }
 	    break;
 	  }
-	  case ReadGroupLib::SEQTYPE_IONTORRENT: {
+	  case Read::SEQTYPE_IONTORRENT: {
 	    // currently a copy of 454, but looks good so far
 	    // groups with IonTorrent reads need forward & reverse directions in group
-	    // AND a minimum quality in group
+	    // AND a minimum quality in group 
 	    // AND and minimum number of reads per group as set in preferences
-	    if(actgroup.forwarddircounter==0
-	       || actgroup.complementdircounter==0
-	       || actgroup.groupquality<con_rt_params.con_mingroupqualforrmbtagging
-	       || static_cast<int32>(actgroup.urdids.size()) < con_rt_params.con_minreadspergroup){
-	      actgroup.valid=false;
+	    if(groups_st_st[seqtype][strainid][actgroup].forwarddircounter==0
+	       || groups_st_st[seqtype][strainid][actgroup].complementdircounter==0
+	       || groups_st_st[seqtype][strainid][actgroup].groupquality<con_rt_params.con_mingroupqualforrmbtagging
+	       || static_cast<int32>(groups_st_st[seqtype][strainid][actgroup].ids.size()) < con_rt_params.con_minreadspergroup){
+	      groups_st_st[seqtype][strainid][actgroup].valid=false;
 	    }
 	    break;
 	  }
-	  case ReadGroupLib::SEQTYPE_PACBIOLQ:
-	  case ReadGroupLib::SEQTYPE_PACBIOHQ: {
-	    // TODO: PacBio LQ / HQ
-
+	  case Read::SEQTYPE_PACBIO: {
 	    // groups with PacBio reads need forward & reverse directions in group
-	    // AND a minimum quality in group
+	    // AND a minimum quality in group 
 	    // AND and minimum number of reads per group as set in preferences
-	    if(actgroup.forwarddircounter==0
-	       || actgroup.complementdircounter==0
-	       || actgroup.groupquality<con_rt_params.con_mingroupqualforrmbtagging
-	       || static_cast<int32>(actgroup.urdids.size()) < con_rt_params.con_minreadspergroup){
-	      actgroup.valid=false;
-	    }
-	    break;
-	  }
-	  case ReadGroupLib::SEQTYPE_TEXT: {
-	    // groups with Text "reads" need a minimum number
-	    //  of reads per group as set in preferences
-	    if(static_cast<int32>(actgroup.urdids.size()) < con_rt_params.con_minreadspergroup){
-	      actgroup.valid=false;
+	    if(groups_st_st[seqtype][strainid][actgroup].forwarddircounter==0
+	       || groups_st_st[seqtype][strainid][actgroup].complementdircounter==0
+	       || groups_st_st[seqtype][strainid][actgroup].groupquality<con_rt_params.con_mingroupqualforrmbtagging
+	       || static_cast<int32>(groups_st_st[seqtype][strainid][actgroup].ids.size()) < con_rt_params.con_minreadspergroup){
+	      groups_st_st[seqtype][strainid][actgroup].valid=false;
 	    }
 	    break;
 	  }
-	  case ReadGroupLib::SEQTYPE_SOLEXA: {
+	  case Read::SEQTYPE_SOLEXA: {
 	    // No good
 	    //// groups with Solexa reads need forward & reverse directions in group
 	    ////  AND at least 4 per group
-	    //if(actgroup.forwarddircounter==0
-	    //   || actgroup.complementdircounter==0
-	    //   || (actgroup.forwarddircounter
-	    //	 +actgroup.complementdircounter) < 4){
-	    //  actgroup.valid=false;
+	    //if(groups_st_st[seqtype][strainid][actgroup].forwarddircounter==0
+	    //   || groups_st_st[seqtype][strainid][actgroup].complementdircounter==0
+	    //   || (groups_st_st[seqtype][strainid][actgroup].forwarddircounter 
+	    //	 +groups_st_st[seqtype][strainid][actgroup].complementdircounter) < 4){
+	    //  groups_st_st[seqtype][strainid][actgroup].valid=false;
 	    //}
 
 	    // groups with Solexa reads need a minimum quality in group and minimum number
@@ -2606,15 +2440,15 @@ void Contig::nmpr_rategroups(vector<vector<vector <nngroups_t> > > & groups_st_s
 	    //  match, it also need at least two reads in each direction (to get
 	    //  rid of these pesky Solexa GGC-triggered errors
 
-	    actgroup.valid=false;
+	    groups_st_st[seqtype][strainid][actgroup].valid=false;
 
-	    int32 numreadsatpos=static_cast<int32>(actgroup.urdids.size());
-	    base_quality_t gqual=actgroup.groupquality;
+	    int32 numreadsatpos=static_cast<int32>(groups_st_st[seqtype][strainid][actgroup].ids.size());
+	    base_quality_t gqual=groups_st_st[seqtype][strainid][actgroup].groupquality;
 
 	    CEBUGF2(" mrpg: " << con_rt_params.con_minreadspergroup);
-	    CEBUGF2(" nrat: " << numreadsatpos << " bbc: " << ccI->getBBChar() << ' ');
+	    CEBUGF2(" nrat: " << numreadsatpos << " bbc: " << ccI->backbonechar << ' ');
 
-	    if(CON_isbackbonecontig && ccI->getBBChar() == actgroup.base){
+	    if(ccI->backbonechar == groups_st_st[seqtype][strainid][actgroup].base){
 	      CEBUGF2("bbmatch! ");
 	      if(ccI->bbcounts[0] & getBBStrainMask(strainid)){
 		CEBUGF2("strainmatch! ");
@@ -2632,7 +2466,7 @@ void Contig::nmpr_rategroups(vector<vector<vector <nngroups_t> > > & groups_st_s
 	      }
 	      if(numreadsatpos >= con_rt_params.con_minreadspergroup
 		 && gqual >=con_rt_params.con_mingroupqualforrmbtagging){
-		actgroup.valid=true;
+		groups_st_st[seqtype][strainid][actgroup].valid=true;
 	      }
 	    }else{
 	      if(numreadsatpos >= con_rt_params.con_minreadspergroup
@@ -2642,66 +2476,63 @@ void Contig::nmpr_rategroups(vector<vector<vector <nngroups_t> > > & groups_st_s
 		//  size
 		// this should prevent the worst false positives
 		int minreadsperdir=1+numreadsatpos/12;
-		if(actgroup.forwarddircounter>minreadsperdir
-		   && actgroup.complementdircounter>minreadsperdir){
-		  actgroup.valid=true;
+		if(groups_st_st[seqtype][strainid][actgroup].forwarddircounter>minreadsperdir
+		   && groups_st_st[seqtype][strainid][actgroup].complementdircounter>minreadsperdir){
+		  groups_st_st[seqtype][strainid][actgroup].valid=true;
 		}
 	      }
 	    }
 	    break;
 	  }
-	  case ReadGroupLib::SEQTYPE_ABISOLID: {
-	    actgroup.valid=false;
-	    if(!actgroup.urdids.empty()) {
-	      MIRANOTIFY(Notify::INTERNAL, "Type ABI SOLiD needs more support 12b.");
+	  case Read::SEQTYPE_ABISOLID: {
+	    groups_st_st[seqtype][strainid][actgroup].valid=false;
+	    if(!groups_st_st[seqtype][strainid][actgroup].ids.empty()) {
+	      throw Notify(Notify::INTERNAL, THISFUNC, "Type ABI SOLiD needs more support 12b.");
 	    }
 	    break;
 	  }
 	  default : {
-	    MIRANOTIFY(Notify::INTERNAL, "Unknown seqtype? 12b.");
-	  }
+	    throw Notify(Notify::INTERNAL, THISFUNC, "Unknown seqtype? 12b.");
 	  }
-
-	  if(actgroup.base=='*'
-	     && con_rt_params.con_also_mark_gap_bases
-	     && con_rt_params.con_also_mark_gap_bases_needbothstrands
-	     && (actgroup.forwarddircounter==0
-		 || actgroup.complementdircounter==0)){
-	    actgroup.valid=false;
-	    CEBUGF2(" gap group, not on both strand");
 	  }
 	}
-	CEBUGF2("\tvalid1: " << actgroup.valid << '\n');
+	CEBUGF2("\tvalid1: " << groups_st_st[seqtype][strainid][actgroup].valid << '\n');
+
 
-	maxreadingroupcount=max(maxreadingroupcount,static_cast<uint32>(actgroup.urdids.size()));
-	minreadingroupcount=min(minreadingroupcount,static_cast<uint32>(actgroup.urdids.size()));
+	maxreadingroupcount=max(maxreadingroupcount,static_cast<uint32>(groups_st_st[seqtype][strainid][actgroup].ids.size()));
+	minreadingroupcount=min(minreadingroupcount,static_cast<uint32>(groups_st_st[seqtype][strainid][actgroup].ids.size()));
       }
 
-      // Try to get rid of spurious mismatches
+      // Try to get rid of spurious mismatches 
 
       // see whether we have something at all
       if(maxreadingroupcount>0){
 
-#if CPP_READ_SEQTYPE_END != 8
-#error "This code is made for 8 sequencing types, adapt!"
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
 #endif
 
 	switch(seqtype) {
-	case ReadGroupLib::SEQTYPE_SANGER: {
+	case Read::SEQTYPE_SANGER: {
 	  // new: only if groupquality is lower 40
 	  // TODO didum 40 config
 	  //  bad idea! single reads never are >35-37 in base qual!
 	  //  testing: lower 30 -> scrap
-
+	  //           30 - 35 -> make it weak
+	
+	  multitag_t::mte_id_t possibleRMBtype=Read::REA_tagentry_idSRMr;
+	
 	  if(con_rt_params.con_disregard_spurious_rmb_mismatches
 	     || con_rt_params.con_also_mark_gap_bases_needbothstrands){
 	    if(con_rt_params.con_disregard_spurious_rmb_mismatches){
 	      if(minreadingroupcount==1 && maxreadingroupcount>=10){
-		for(auto & actgroup : groups_st_st[seqtype][strainid]) {
-		  if(actgroup.valid==true
-		     && actgroup.urdids.size()==1){
-		    if(actgroup.groupquality < 30){
-		      actgroup.valid=false;
+		for(uint32 actgroup=0; actgroup<groups_st_st[seqtype][strainid].size(); actgroup++) {
+		  if(groups_st_st[seqtype][strainid][actgroup].valid==true 
+		     && groups_st_st[seqtype][strainid][actgroup].ids.size()==1){
+		    if(groups_st_st[seqtype][strainid][actgroup].groupquality < 30){
+		      groups_st_st[seqtype][strainid][actgroup].valid=false;
+		    }else if(groups_st_st[seqtype][strainid][actgroup].groupquality < 35){
+		      possibleRMBtype=Read::REA_tagentry_idWRMr;
 		    }
 		  }
 		}
@@ -2717,8 +2548,8 @@ void Contig::nmpr_rategroups(vector<vector<vector <nngroups_t> > > & groups_st_s
 	       && groups_st_st[seqtype][strainid].back().complementdircounter>0){
 	      // we still could have two valid base groups
 	      uint32 numvalids=0;
-	      for(auto & actgroup : groups_st_st[seqtype][strainid]) {
-		if(actgroup.valid) ++numvalids;
+	      for(uint32 actgroup=0; actgroup<groups_st_st[seqtype][strainid].size()-1; actgroup++) {
+		if(groups_st_st[seqtype][strainid][actgroup].valid) numvalids++;
 	      }
 	      if(numvalids>1) {
 		// yes, two valid base groups. Ok, let's be conservative
@@ -2728,10 +2559,10 @@ void Contig::nmpr_rategroups(vector<vector<vector <nngroups_t> > > & groups_st_s
 	      }else{
 		// just one other base group
 		// make sure it's double stranded. If not, it's not valid.
-		for(auto & actgroup : groups_st_st[seqtype][strainid]) {
-		  if(actgroup.forwarddircounter==0
-		     || actgroup.complementdircounter==0){
-		    actgroup.valid=false;
+		for(uint32 actgroup=0; actgroup<groups_st_st[seqtype][strainid].size(); actgroup++) {
+		  if(groups_st_st[seqtype][strainid][actgroup].forwarddircounter==0
+		     || groups_st_st[seqtype][strainid][actgroup].complementdircounter==0){
+		    groups_st_st[seqtype][strainid][actgroup].valid=false;
 		  }
 		}
 	      }
@@ -2740,63 +2571,24 @@ void Contig::nmpr_rategroups(vector<vector<vector <nngroups_t> > > & groups_st_s
 	  }
 	  break;
 	}
-	case ReadGroupLib::SEQTYPE_454GS20: {
+	case Read::SEQTYPE_454GS20: {
 	  // with 454 data, gap groups are presently not valid
 	  // that's too ... unsure.
 	  groups_st_st[seqtype][strainid].back().valid=false;
 	  break;
 	}
-	case ReadGroupLib::SEQTYPE_IONTORRENT: {
+	case Read::SEQTYPE_IONTORRENT: {
 	  // with IonTorrent data, gap groups are presently not valid
 	  // that's too ... unsure.
 	  groups_st_st[seqtype][strainid].back().valid=false;
 	  break;
 	}
-	case ReadGroupLib::SEQTYPE_PACBIOLQ:
-	case ReadGroupLib::SEQTYPE_PACBIOHQ: {
-	  // TODO: PacBio LQ / HQ
-
+	case Read::SEQTYPE_PACBIO: {
 	  // no info atm, say it's invalid (so that I can have a look)
 	  groups_st_st[seqtype][strainid].back().valid=false;
 	  break;
 	}
-	case ReadGroupLib::SEQTYPE_TEXT: {
-	  // a bit like Sanger, but only working with fwd/rev
-	  // TODO: check a bit more if really a good idea
-	  if(con_rt_params.con_disregard_spurious_rmb_mismatches
-	     || con_rt_params.con_also_mark_gap_bases_needbothstrands){
-
-	    // look if we need to have two strand when a gap group is present
-	    if(con_rt_params.con_also_mark_gap_bases_needbothstrands
-	       && groups_st_st[seqtype][strainid].back().valid==true
-	       && groups_st_st[seqtype][strainid].back().forwarddircounter>1
-	       && groups_st_st[seqtype][strainid].back().complementdircounter>1){
-	      // we still could have two valid base groups
-	      uint32 numvalids=0;
-	      for(auto & actgroup : groups_st_st[seqtype][strainid]) {
-		if(actgroup.valid) ++numvalids;
-	      }
-	      if(numvalids > 1) {
-		// yes, two valid base groups. Ok, let's be conservative
-		//  and first resolve the two valid base groups.
-		// the gap group will probably be dealt with in a later iteration
-		groups_st_st[seqtype][strainid].back().valid=false;
-	      }else{
-		// just one other base group
-		// make sure it's double stranded. If not, it's not valid.
-		for(auto & actgroup : groups_st_st[seqtype][strainid]) {
-		  if(actgroup.forwarddircounter==0
-		     || actgroup.complementdircounter==0){
-		    actgroup.valid=false;
-		  }
-		}
-	      }
-	      //CEBUGF2("numvalidgroups gap both strands: " << newprc.numvalidgroups << endl);
-	    }
-	  }
-	  break;
-	}
-	case ReadGroupLib::SEQTYPE_SOLEXA: {
+	case Read::SEQTYPE_SOLEXA: {
 	  // Solexa ... hmmm, everything is valid atm
 
 	  // TODO: on higher coverages, perhaps need at least 3?
@@ -2805,12 +2597,12 @@ void Contig::nmpr_rategroups(vector<vector<vector <nngroups_t> > > & groups_st_s
 	  //throw Notify(Notify::INTERNAL, THISFUNC, "Type Solexa needs more support 12c.");
 	  break;
 	}
-	case ReadGroupLib::SEQTYPE_ABISOLID: {
-	  MIRANOTIFY(Notify::INTERNAL, "Type ABI SOLiD needs more support 12c.");
+	case Read::SEQTYPE_ABISOLID: {
+	  throw Notify(Notify::INTERNAL, THISFUNC, "Type ABI SOLiD needs more support 12c.");
 	  break;
 	}
 	default : {
-	  MIRANOTIFY(Notify::INTERNAL, "Unknown seqtype? 12c.");
+	  throw Notify(Notify::INTERNAL, THISFUNC, "Unknown seqtype? 12c.");
 	}
 	}
       }
@@ -2830,9 +2622,7 @@ void Contig::nmpr_rategroups(vector<vector<vector <nngroups_t> > > & groups_st_s
 
 void Contig::calcGroupQual(const nngroups_t & g)
 {
-  FUNCSTART("void Contig::calcGroupQual(const nngroups_t & g)");
-
-  if(g.urdids.empty()){
+  if(g.ids.empty()){
     const_cast<nngroups_t &>(g).groupquality=0;
     return;
   }
@@ -2840,14 +2630,14 @@ void Contig::calcGroupQual(const nngroups_t & g)
   /* errorrate for this group is computed as follows:
      Best quality for a base in a direction makes basic rate = 100%
      add to this: 10% of next best base quality
-
+     
      Same procedure for other direction, then add both qualities
 
      In general, the values are almost the same (mostly a tad higher) as
      with the more complicated (and time consuming) old variant.
-
+     
      Cap at 90
-
+     
      e.g.
      + A 30     -> 30       \
      + A 20     ->  2        \
@@ -2865,14 +2655,9 @@ void Contig::calcGroupQual(const nngroups_t & g)
   base_quality_t max2r=0;
 
   // find two highest values for each direction
-  // using iterators in the loop below brings exactly nothing
-
-  for(uint32 j=0; j<g.urdids.size(); ++j) {
-    // testing for rails practically doubles the time needed in this loop, so let's go
-    //  without. In practice, rails shouldn't have any quality at all anyway ... or a very low one
-    //
-    //if(CON_reads.getReadAtURDID(g.urdids[j]).isRail()) continue;
 
+  for(uint32 j=0; j<g.ids.size(); j++) {
+    if(CON_reads[g.ids[j]].read.isRail()) continue;
     if(g.directions[j]>0) {
       if(g.quals[j] >= max1f){
 	max2f=max1f;
@@ -2894,8 +2679,6 @@ void Contig::calcGroupQual(const nngroups_t & g)
 
   const_cast<nngroups_t &>(g).groupquality=max1f+max1r+(max2f+max2r)/10;
   if((g).groupquality>90) const_cast<nngroups_t &>(g).groupquality=90;
-
-  return;
 }
 
 
@@ -2935,23 +2718,25 @@ void Contig::nmpr_tagColumn(nnpos_rep_col_t & prc, const rcci_t & rcci, vector<b
     prc.tagged=true;
     CEBUGF2("Need a tag. " << multitag_t::getIdentifierStr(prc.type) << " adding tag to consensus at " << prc.contigpos << endl);
 
-    multitag_t tmpmt(Read::REA_defaulttag_UNSr);
-    tmpmt.identifier=prc.type;
-
-    // First checking whether there are reads in the rcci that have a base
-    //  like one of groupbases on the prc.
-    //for(uint32 idsrcci=0; idsrcci < rcci.read_ids_in_col.size(); idsrcci++){
-    for(const auto & pcrI : rcci.getPCRIsInCol()){
-      if(pcrI.getORPID()==-1) continue;
-      char base=pcrI.getBase(rcci.getContigPos());
-
-      for(uint32 gbi=0; gbi<prc.groupbases.size(); ++gbi){
+    // First checking whether there are reads in the rcci that have a
+    //  like the one in groupbases on the prc
+    for(uint32 idsrcci=0; idsrcci < rcci.read_ids_in_col.size(); idsrcci++){
+
+      int32          actreadid=rcci.read_ids_in_col[idsrcci];
+      contigread_t & ric =CON_reads[actreadid];
+      if(CON_reads[actreadid].orpid==-1) continue;
+      
+      // get base
+      char           base=ric.getBase(rcci.actcontigpos);
+      
+      for(uint32 gbi=0; gbi<prc.groupbases.size(); gbi++){
 	if(base==prc.groupbases[gbi]){
-	  prc.urdids.push_back(pcrI.getURDID());
+	  prc.ids.push_back(actreadid);
 	}
       }
     }
 
+
     if(prc.type == Read::REA_tagentry_idSRMr){
       repstats.numSRMs++;
     }else if(prc.type == Read::REA_tagentry_idWRMr){
@@ -2962,53 +2747,33 @@ void Contig::nmpr_tagColumn(nnpos_rep_col_t & prc, const rcci_t & rcci, vector<b
       repstats.numSNPs++;
     }
 
-    uint32 countAf=0;
-    uint32 countCf=0;
-    uint32 countGf=0;
-    uint32 countTf=0;
-    uint32 countGapf=0;
-    uint32 countAr=0;
-    uint32 countCr=0;
-    uint32 countGr=0;
-    uint32 countTr=0;
-    uint32 countGapr=0;
     base_quality_t qualA=0;
     base_quality_t qualC=0;
     base_quality_t qualG=0;
     base_quality_t qualT=0;
-    base_quality_t qualGap=0;
+    base_quality_t qualStar=0;
 
     bool hasgapinprc=false;
-    for(uint32 gbi=0; gbi<prc.groupbases.size(); ++gbi){
-      switch(prc.groupbases[gbi]) {
+    for(uint32 i=0; i<prc.groupbases.size(); i++){
+      switch(prc.groupbases[i]) {
       case 'A': {
-	countAf=prc.groupcountsfwd[gbi];
-	countAr=prc.groupcountsrev[gbi];
-	qualA=prc.groupquals[gbi];
+	qualA=prc.groupquals[i];
 	break;
       }
       case 'C': {
-	countCf=prc.groupcountsfwd[gbi];
-	countCr=prc.groupcountsrev[gbi];
-	qualC=prc.groupquals[gbi];
+	qualC=prc.groupquals[i];
 	break;
       }
       case 'G': {
-	countGf=prc.groupcountsfwd[gbi];
-	countGr=prc.groupcountsrev[gbi];
-	qualG=prc.groupquals[gbi];
+	qualG=prc.groupquals[i];
 	break;
       }
       case 'T': {
-	countTf=prc.groupcountsfwd[gbi];
-	countTr=prc.groupcountsrev[gbi];
-	qualT=prc.groupquals[gbi];
+	qualT=prc.groupquals[i];
 	break;
       }
       case '*': {
-	countGapf=prc.groupcountsfwd[gbi];
-	countGapr=prc.groupcountsrev[gbi];
-	qualGap=prc.groupquals[gbi];
+	qualStar=prc.groupquals[i];
 	hasgapinprc=true;
 	break;
       }
@@ -3020,97 +2785,103 @@ void Contig::nmpr_tagColumn(nnpos_rep_col_t & prc, const rcci_t & rcci, vector<b
     vector<char> runbases;
     runbases.reserve(4);
     if(hasgapinprc) {
-      for(uint32 gbi=0; gbi<prc.groupbases.size(); ++gbi){
-	if(prc.groupbases[gbi]!='*') runbases.push_back(prc.groupbases[gbi]);
+      for(uint32 i=0; i<prc.groupbases.size(); i++){
+	if(prc.groupbases[i]!='*') runbases.push_back(prc.groupbases[i]);
       }
     }
 
     bool shorttagcomments=(*CON_miraparams)[0].getContigParams().con_shorttagcomments;
 
-    if(prc.type==Read::REA_tagentry_idSRMr){
-      tmpmt.comment=Read::REA_tagentry_coSRMr;
-    }else if(prc.type== Read::REA_tagentry_idWRMr) {
-      tmpmt.comment=Read::REA_tagentry_coWRMr;
-    }else if(prc.type==Read::REA_tagentry_idSROr) {
-      tmpmt.comment=Read::REA_tagentry_coSROr;
-    }else if(prc.type==Read::REA_tagentry_idSAOr) {
-      tmpmt.comment=Read::REA_tagentry_coSAOr;
-    }else if(prc.type==Read::REA_tagentry_idSIOr) {
-      tmpmt.comment=Read::REA_tagentry_coSIOr;
-    }else{
-      tmpmt.comment=Read::REA_tagentry_coUnknown;
-    }
-
-    if(shorttagcomments && tmpmt.comment != Read::REA_tagentry_coUnknown){
-      tmpmt.comment=Read::REA_tagentry_coEmpty;
-    }
+    multitag_t::mte_co_t scomment=Read::REA_tagentry_coEmpty;
 
-    //for(uint32 idsj=0; idsj < prc.ids.size(); idsj++){
-    for(auto & urdid : prc.urdids){
-      if(CON_reads.getReadORPIDAtURDID(urdid) == -1) continue;
-      auto pcrI =CON_reads.getIteratorOfReadpoolID(CON_reads.getReadORPIDAtURDID(urdid));
+    for(uint32 idsj=0; idsj < prc.ids.size(); idsj++){
+      int32 actreadid=prc.ids[idsj];
+      contigread_t & ric =CON_reads[actreadid];
 
-      int32 rawreadpos=pcrI.contigPos2RawReadPos(prc.contigpos);
+      if(CON_reads[actreadid].orpid==-1) continue;
 
-      CEBUGF2("\tfor read " << pcrI->getName() << " at " << rawreadpos << endl);
+      int32 rawreadpos=ric.contigPos2RawReadPos(prc.contigpos);
+      
+      CEBUGF2("\tfor read " << ric.read.getName() << " at " << rawreadpos << endl);
 
-      readsmarkedsrm[CON_reads.getReadORPIDAtURDID(urdid)]=true;
+      readsmarkedsrm[ric.orpid]=true;
 
       try {
-	if(hasgapinprc &&
-	   (prc.type==Read::REA_tagentry_idSRMr
-	    ||prc.type==Read::REA_tagentry_idWRMr)){
-
-	  for(uint8 i=0; i<runbases.size(); i++){
-	    // logic for the tagging of gapped groups
-	    // this is somewhat sick ...
-	    char searchbase=runbases[i];
-	    if(CON_reads.getReadDirectionAtURDID(urdid) < 0) searchbase=dptools::getComplementBase(searchbase);
-	    int32 arpu=0;
-	    int32 arpl=0;
-
-	    // tag the front of potential homopolymer
-	    if(CON_reads.getReadDirectionAtURDID(urdid)<0){
-	      arpu=pcrI->getUpperBoundPosOfBaseRun(rawreadpos,searchbase,true);
-	      if(arpu > static_cast<int32>(pcrI->getLenSeq())-1) arpu=static_cast<int32>(pcrI->getLenSeq())-1;
-	      arpl=pcrI->getLowerNonGapPosOfReadPos(arpu);
-	      if(arpl<0) arpl=0;
-	      ++arpu;
-	      if(arpu > static_cast<int32>(pcrI->getLenSeq())-1) arpu=static_cast<int32>(pcrI->getLenSeq())-1;
-	    }else{
-	      arpl=pcrI->getLowerBoundPosOfBaseRun(rawreadpos,searchbase,true);
-	      if(arpl<0) arpl=0;
-	      arpu=pcrI->getUpperNonGapPosOfReadPos(arpl);
-	      if(arpu > static_cast<int32>(pcrI->getLenSeq())-1) arpu=static_cast<int32>(pcrI->getLenSeq())-1;
-	      if(arpl>0) --arpl;
-	    }
-	    tmpmt.from=arpl;
-	    tmpmt.to=arpu;
-	    const_cast<Read &>(*pcrI).addTagO(tmpmt);
-
-	    // tag the back of potential homopolymer
-	    if(CON_reads.getReadDirectionAtURDID(urdid) < 0){
-	      arpl=pcrI->getLowerBoundPosOfBaseRun(rawreadpos,searchbase,true);
-	      if(arpl<0) arpl=0;
-	      arpu=pcrI->getUpperNonGapPosOfReadPos(arpl);
-	      if(arpu > static_cast<int32>(pcrI->getLenSeq())-1) arpu=static_cast<int32>(pcrI->getLenSeq())-1;
-	      if(arpl> 0) --arpl;
-	    }else{
-	      arpu=pcrI->getUpperBoundPosOfBaseRun(rawreadpos,searchbase,true);
-	      if(arpu > static_cast<int32>(pcrI->getLenSeq())-1) arpu=static_cast<int32>(pcrI->getLenSeq())-1;
-	      arpl=pcrI->getLowerNonGapPosOfReadPos(arpu);
-	      if(arpl<0) arpl=0;
-	      ++arpu;
-	      if(arpu > static_cast<int32>(pcrI->getLenSeq())-1) arpu=static_cast<int32>(pcrI->getLenSeq())-1;
+	if(prc.type==Read::REA_tagentry_idSRMr
+	   ||prc.type==Read::REA_tagentry_idWRMr) {
+
+	  if(!shorttagcomments){
+	    scomment=Read::REA_tagentry_coSRMr;
+	    if(prc.type==Read::REA_tagentry_idWRMr) scomment=Read::REA_tagentry_coWRMr;
+	  }
+	  if(hasgapinprc) {
+	    for(uint8 i=0; i<runbases.size(); i++){ 
+	      // logic for the tagging of gapped groups
+	      // this is somewhat sick ...
+	      char searchbase=runbases[i];
+	      if(ric.direction<0) searchbase=dptools::getComplementBase(searchbase);
+	      int32 arpu=0;
+	      int32 arpl=0;
+
+	      // tag the front of potential homopolymer
+ 	      if(ric.direction<0){
+	      	arpu=ric.read.getUpperBoundPosOfBaseRun(rawreadpos,searchbase,true);
+	      	if(arpu > static_cast<int32>(ric.read.getLenSeq())-1) arpu=static_cast<int32>(ric.read.getLenSeq())-1;
+	      	arpl=ric.read.getLowerNonGapPosOfReadPos(arpu);
+	      	if(arpl<0) arpl=0;
+	      	++arpu;
+	      	if(arpu > static_cast<int32>(ric.read.getLenSeq())-1) arpu=static_cast<int32>(ric.read.getLenSeq())-1; 
+	      	ric.read.addTag(arpl, arpu, prc.type, scomment);
+	      }else{
+	      	arpl=ric.read.getLowerBoundPosOfBaseRun(rawreadpos,searchbase,true);
+	      	if(arpl<0) arpl=0;
+	      	arpu=ric.read.getUpperNonGapPosOfReadPos(arpl);
+	      	if(arpu > static_cast<int32>(ric.read.getLenSeq())-1) arpu=static_cast<int32>(ric.read.getLenSeq())-1;
+	      	if(arpl>0) --arpl;
+	      	ric.read.addTag(arpl, arpu, prc.type, scomment);
+	      }
+
+	      // tag the back of potential homopolymer
+ 	      if(ric.direction<0){
+	      	arpl=ric.read.getLowerBoundPosOfBaseRun(rawreadpos,searchbase,true);
+	      	if(arpl<0) arpl=0;
+	      	arpu=ric.read.getUpperNonGapPosOfReadPos(arpl);
+	      	if(arpu > static_cast<int32>(ric.read.getLenSeq())-1) arpu=static_cast<int32>(ric.read.getLenSeq())-1;
+	      	if(arpl> 0) --arpl;
+	      	ric.read.addTag(arpl, arpu, prc.type, scomment);
+	      }else{
+	      	arpu=ric.read.getUpperBoundPosOfBaseRun(rawreadpos,searchbase,true);
+	      	if(arpu > static_cast<int32>(ric.read.getLenSeq())-1) arpu=static_cast<int32>(ric.read.getLenSeq())-1;
+	      	arpl=ric.read.getLowerNonGapPosOfReadPos(arpu);
+	      	if(arpl<0) arpl=0;
+	      	++arpu;
+	      	if(arpu > static_cast<int32>(ric.read.getLenSeq())-1) arpu=static_cast<int32>(ric.read.getLenSeq())-1; 
+	      	ric.read.addTag(arpl, arpu, prc.type, scomment);
+	      }
 	    }
-	    tmpmt.from=arpl;
-	    tmpmt.to=arpu;
+	  }else{
+	    ric.read.addTag(rawreadpos, rawreadpos, prc.type, scomment);
 	  }
-	}else{
-	  tmpmt.from=rawreadpos;
-	  tmpmt.to=rawreadpos;
+	} else if(prc.type==Read::REA_tagentry_idSROr) {
+	  if(!shorttagcomments){
+	    scomment=Read::REA_tagentry_coSROr;
+	  }
+	  ric.read.addTag(rawreadpos, rawreadpos, prc.type, scomment);
+	} else if(prc.type==Read::REA_tagentry_idSAOr) {
+	  if(!shorttagcomments){
+	    scomment=Read::REA_tagentry_coSROr;
+	  }
+	  ric.read.addTag(rawreadpos, rawreadpos, prc.type, scomment);
+	} else if(prc.type==Read::REA_tagentry_idSIOr) {
+	  if(!shorttagcomments){
+	    scomment=Read::REA_tagentry_coSROr;
+	  }
+	  ric.read.addTag(rawreadpos, rawreadpos, prc.type, scomment);
+//	} else if(prc.type=="ARGL") {
+//	  ric.read.addTag(rawreadpos, rawreadpos, prc.type, "*ARGL* MIRA didn't know what to do with that.");
+	} else {
+	  ric.read.addTag(rawreadpos, rawreadpos, prc.type, Read::REA_tagentry_coUnknown);
 	}
-	const_cast<Read &>(*pcrI).addTagO(tmpmt);
       }
       catch (...) {
 	cout << "Tag failed?!?\n";
@@ -3118,15 +2889,14 @@ void Contig::nmpr_tagColumn(nnpos_rep_col_t & prc, const rcci_t & rcci, vector<b
     }
 
     string contigtype=multitag_t::getIdentifierStr(prc.type).substr(0,3)+'c';
-    auto & newtag = addTagToConsensus(prc.contigpos,
-				      prc.contigpos,
-				      '=',
-				      contigtype.c_str(),
-				      "",
-				      true);
-    newtag.addAdditionalInfo(countAf, countCf, countGf, countTf, countGapf,
-			     countAr, countCr, countGr, countTr, countGapr,
-			     qualA, qualC, qualG, qualT, qualGap);
+    addTagToConsensus(prc.contigpos, 
+		      prc.contigpos,
+		      '=', 
+		      contigtype.c_str(), 
+		      "",
+		      true,
+		      true,
+		      qualA, qualC, qualG, qualT, qualStar);
   }
 
   FUNCEND();
@@ -3159,49 +2929,36 @@ void Contig::markFeaturesByConsensus(bool markSNPs, bool markUNSs, bool markIUPA
   }
 
   cout << ", preparing needed data: sorting tags ... "; cout.flush();
-
+  
   const contig_parameters & con_params=(*CON_miraparams)[0].getContigParams();
   sortConsensusTags();
-  cout << "done" << endl;
 
   //CEBUG("fetching overall consensus\n");
   //string consseq;
   //vector<base_quality_t> consqual;
   //getConsensus(consseq, consqual, false, 1,0);
 
-  vector<string> strainseq(ReadGroupLib::getNumOfStrains());
-  vector<vector<base_quality_t> > strainqual(ReadGroupLib::getNumOfStrains());
-  vector<bool> straininbackbone(ReadGroupLib::getNumOfStrains(),false);
+  vector<string> strainseq(CON_readpool->getNumOfStrainInReadpool());
+  vector<vector<base_quality_t> > strainqual(CON_readpool->getNumOfStrainInReadpool());
 
-  for(uint32 sid=0; sid<ReadGroupLib::getNumOfStrains(); ++sid){
+  for(uint32 sid=0; sid<CON_readpool->getNumOfStrainInReadpool(); sid++){
     strainseq[sid].reserve(getContigLength());
     strainqual[sid].reserve(getContigLength());
   }
 
   calcConsensi();
-  for(uint32 sid=0; sid<ReadGroupLib::getNumOfStrains(); ++sid){
+  for(uint32 sid=0; sid<CON_readpool->getNumOfStrainInReadpool(); sid++){
     cout << "fetching consensus for strain" << sid << " ...";cout.flush();
     newConsensusGet(strainseq[sid], strainqual[sid], sid);
     //cout << "I'm back" << endl;
 
-    // look for whether strain is in backbone
-    for(uint32 rgi=1;rgi<ReadGroupLib::getNumReadGroups(); ++rgi){
-      auto rgid=ReadGroupLib::getReadGroupID(rgi);
-      if(rgid.getStrainID()==sid
-	 && (rgid.isBackbone()
-	     || rgid.isRail())){
-	straininbackbone[sid]=true;
-	CEBUG("bbSID " << sid << " is backbone.\n");
-      }
-    }
-
     // it's possible that the sequences we got are entirely made out
-    //  of X and *... when they are never covered by the given strain
+    //  of @ and *... when they are never covered by the given strain
     // In this case, just set the whole sequence to "?"
 
     bool hasseq=false;
-    for(uint32 acp=0; acp<strainseq[sid].size(); ++acp){
-      if(strainseq[sid][acp]!='X' && strainseq[sid][acp]!='*' ) {
+    for(uint32 acp=0; acp<strainseq[sid].size(); acp++){
+      if(strainseq[sid][acp]!='@' && strainseq[sid][acp]!='*' ) {
 	hasseq=true;
 	break;
       }
@@ -3211,7 +2968,7 @@ void Contig::markFeaturesByConsensus(bool markSNPs, bool markUNSs, bool markIUPA
 
     if(!hasseq){
       cout << "(strain " << sid << " empty.) ..."; cout.flush();
-      for(uint32 acp=0; acp<strainseq[sid].size(); ++acp){
+      for(uint32 acp=0; acp<strainseq[sid].size(); acp++){
 	strainseq[sid][acp]='?';
       }
     }
@@ -3220,19 +2977,22 @@ void Contig::markFeaturesByConsensus(bool markSNPs, bool markUNSs, bool markIUPA
   vector<uint8> cacheIUPctag(getContigLength(),0);
   vector<uint8> cacheSROSIOSAOcctags(getContigLength(),0);
 
-  for(const auto & ctag : CON_consensus_tags){
-    if(ctag.identifier==Contig::CON_tagentry_idIUPc
-       || ctag.identifier==Contig::CON_tagentry_idSROc
-       || ctag.identifier==Contig::CON_tagentry_idSIOc
-       || ctag.identifier==Contig::CON_tagentry_idSAOc){
-      for(uint32 ctp=ctag.from; ctp<=ctag.to; ++ctp){
-	if(ctag.identifier==Contig::CON_tagentry_idIUPc){
-	  cacheIUPctag[ctp]=1;
-	}
-	if(ctag.identifier==Contig::CON_tagentry_idSROc
-	   || ctag.identifier==Contig::CON_tagentry_idSIOc
-	   || ctag.identifier==Contig::CON_tagentry_idSAOc){
-	  cacheSROSIOSAOcctags[ctp]=1;
+  {
+    vector<consensustag_t>::const_iterator ctI=CON_consensus_tags.begin();
+    for(;ctI != CON_consensus_tags.end(); ctI++){
+      if(ctI->identifier==Contig::CON_tagentry_idIUPc
+	 || ctI->identifier==Contig::CON_tagentry_idSROc
+	 || ctI->identifier==Contig::CON_tagentry_idSIOc
+	 || ctI->identifier==Contig::CON_tagentry_idSAOc){
+	for(uint32 ctp=ctI->from; ctp<=ctI->to; ctp++){
+	  if(ctI->identifier==Contig::CON_tagentry_idIUPc){
+	    cacheIUPctag[ctp]=1;
+	  }
+	  if(ctI->identifier==Contig::CON_tagentry_idSROc
+	     || ctI->identifier==Contig::CON_tagentry_idSIOc
+	     || ctI->identifier==Contig::CON_tagentry_idSAOc){
+	    cacheSROSIOSAOcctags[ctp]=1;
+	  }
 	}
       }
     }
@@ -3240,40 +3000,45 @@ void Contig::markFeaturesByConsensus(bool markSNPs, bool markUNSs, bool markIUPA
 
   cout << "done.\nStarting search:" << endl;
 
-  // std constructor means:  all strains, all seqtypes, take rails, backbones and reads
-  // and also reads without readpool-reads like the merged solexa reads
-  rcci_t rcci(this);
+  rcci_t rcci;
+  {
+    vector<int32> allowedstrainids; 
+    // empty is == all ids
+    vector<uint8> allowedreadtypes;
+    readColContigIteratorInit(rcci,
+			      allowedstrainids, 
+			      allowedreadtypes, 
+			      true,           // take rails
+			      true,           // take backbones
+			      true);   /* and also reads without readpool-reads like
+					   the merged solexa reads */
+  }
 
+  
+  string strengthcomment;
   string straincomment;
   int32 mcfrom=-1;
   int32 mcto=-1;
 
-  multitag_t tmpmt(Read::REA_defaulttag_UNSr);
-
-  for(uint32 acp=0; acp<strainseq[0].size(); rcci.advance(), ++acp){
+  for(uint32 acp=0; acp<strainseq[0].size(); acp++, readColContigIteratorAdvance(rcci)){
     bool foundsomething=false;
     //bool foundsomethingweak=false;
     bool hasSNP=false;
     bool missingcov=false;
     bool makeitUNS=false;
-    bool makeitSIO=false;
     bool hadoutput=false;
 
-    straincomment.clear();
+    strengthcomment.clear();
 
-    CEBUG("acp: " << acp << '\n');
-    for(uint32 sid1=0; sid1<ReadGroupLib::getNumOfStrains(); ++sid1){
-      if(foundsomething) break;
+    for(uint32 sid1=0; sid1<CON_readpool->getNumOfStrainInReadpool(); sid1++){
       char sid1b=toupper(strainseq[sid1][acp]);
       if(sid1b=='?') continue;
-      CEBUG("sid1 " << sid1 << "\tsid1b: " << sid1b << " (" << static_cast<uint16>(strainqual[sid1][acp]) << ")\n");
-      char uppersid1b=toupper(sid1b);
-      if(markIUPACs && uppersid1b!='X' && !dptools::isValidStarBase(uppersid1b)){
+      if(markIUPACs && sid1b!='@' && !dptools::isValidStarBase(sid1b)){
 
 	if(!cacheIUPctag[acp]){
-	  straincomment="Strain '"+ReadGroupLib::getStrainOfStrainID(sid1)+"': "+sid1b;
-	  addTagToConsensus(rcci.getContigPos(),
-			    rcci.getContigPos(),
+	  straincomment="Strain '"+CON_readpool->getStrainOfStrainID(sid1)+"': "+sid1b;
+	  addTagToConsensus(rcci.actcontigpos,
+			    rcci.actcontigpos,
 			    '=',
 			    multitag_t::getIdentifierStr(CON_tagentry_idIUPc).c_str(),
 			    straincomment.c_str(),
@@ -3281,14 +3046,14 @@ void Contig::markFeaturesByConsensus(bool markSNPs, bool markUNSs, bool markIUPA
 	  CEBUG("IUPAC Tag: " << straincomment << '\n');
 	}
       }
-      if(uppersid1b=='N' || !(markUNSs||markSNPs)) continue;
-      for(uint32 sid2=sid1+1; sid2<ReadGroupLib::getNumOfStrains(); ++sid2){
-	char sid2b=strainseq[sid2][acp];
-	char uppersid2b=toupper(sid2b);
-	if(sid2b=='?' || uppersid2b=='N') continue;
-	CEBUG("sid2 " << sid2 << "\tsid2b: " << sid2b << " (" << static_cast<uint16>(strainqual[sid2][acp]) << ")\n");
-	if((uppersid1b=='X' && !straininbackbone[sid1])
-	   || (uppersid2b=='X' && !straininbackbone[sid2])){
+      if(sid1b=='N' || !(markUNSs||markSNPs)) continue;
+      for(uint32 sid2=sid1+1; sid2<CON_readpool->getNumOfStrainInReadpool(); sid2++){
+	char sid2b=toupper(strainseq[sid2][acp]);
+	if(sid2b=='?' || sid2b=='N') continue;
+	//CEBUG("acp: " << acp << "\tstrain[" << sid1 << "] <-> strain[" << sid2 << "]: ");
+	//CEBUG(sid1b << " (" << static_cast<uint16>(strainqual[sid1][acp]) << ")\t");
+	//CEBUG(sid2b << " (" << static_cast<uint16>(strainqual[sid2][acp]) << ")\n");
+	if(sid1b=='@' || sid2b=='@'){
 	  CEBUG("acp: " << acp << "\tmissing cov [" << sid1 << "] <-> strain[" << sid2 << "]: ");
 	  CEBUG(sid1b << " (" << static_cast<uint16>(strainqual[sid1][acp]) << ")\t");
 	  CEBUG(sid2b << " (" << static_cast<uint16>(strainqual[sid2][acp]) << ")");
@@ -3303,88 +3068,45 @@ void Contig::markFeaturesByConsensus(bool markSNPs, bool markUNSs, bool markIUPA
 	  hadoutput=true;
 	  hasSNP=true;
 
-	  bool s1clean=true;
-	  if(false // BaCh 21.04.2015 why did I have: uppersid1b!=sid1b ???
-	     || !dptools::isValidStarBase(sid1b)) s1clean=false;
-	  bool s2clean=true;
-	  if(false // BaCh 21.04.2015 why did I have: uppersid2b!=sid2b ???
-	     || !dptools::isValidStarBase(sid2b)) s2clean=false;
-
-	  CEBUG("s1clean && s2clean " << s1clean << s2clean << endl);
-	  if(s1clean && s2clean){
-	    // a real snp
-	  }else{
-	    makeitSIO=true;
-	  }
-
-/*
-	  // if it's not a clean thing (ACGT or *),
+	  // if it's not a clean thing (ACGT or *), 
 	  //  it's probably a repeat where the
 	  //  backbone does not have all the copies resolved.
 	  if(!dptools::isValidStarBase(sid1b)
-	     || !dptools::isValidStarBase(sid2b)) {
-	    if(straininbackbone[sid1]){
-	      if(dptools::isValidStarBase(sid1b)){
-		makeitSIO=true;
-	      }else{
-		if(!dptools::isValidStarBase(sid2b)){
-		  makeitSIO=true;
-		}
-	      }
-	    }else if(straininbackbone[sid2]){
-	      if(dptools::isValidStarBase(sid2b)){
-		makeitSIO=true;
-	      }else{
-		if(!dptools::isValidStarBase(sid1b)){
-		  makeitSIO=true;
-		}
-	      }
-	    }else{
-	      makeitUNS=true;
-	    }
-	  }
-*/
+	     || !dptools::isValidStarBase(sid2b)) makeitUNS=true;
 
-	  if(uppersid1b=='N' || uppersid1b=='X'
-	     || uppersid2b=='N' || uppersid2b=='X'){
-	    CEBUG("\tsomething NX");
-	    foundsomething=true;
-	    straincomment="Low confidence base definition ";
-	  }else if(strainqual[sid1][acp]>=con_params.con_mingroupqualforrmbtagging
+	  if(strainqual[sid1][acp]>=con_params.con_mingroupqualforrmbtagging
 	     && strainqual[sid2][acp]>=con_params.con_mingroupqualforrmbtagging){
 	    CEBUG("\tsomething");
 	    foundsomething=true;
-	    straincomment="High confidence ";
-	  } else if(strainqual[sid1][acp]>=con_params.con_mingroupqualforrmbtagging/2
+	    strengthcomment="high";
+	    break;
+	  }
+	  if(strainqual[sid1][acp]>=con_params.con_mingroupqualforrmbtagging/2
 	     && strainqual[sid2][acp]>=con_params.con_mingroupqualforrmbtagging/2){
 	    CEBUG("\tsomething medium");
 	    foundsomething=true;
-	    straincomment="Medium confidence ";
-	  }else{
-	    // TODO: testing
-	    // Looks like a weak difference
-	    CEBUG("\tsomething weak");
-	    foundsomething=true;
-	    straincomment="Low confidence ";
+	    strengthcomment="medium";
+	    break;
 	  }
-	  straincomment+="variant between '"+ReadGroupLib::getStrainOfStrainID(sid1)+"' and '"+ReadGroupLib::getStrainOfStrainID(sid2)+"': "+sid1b+string(" vs ")+sid2b;
-	  CEBUG("\nSC: " << straincomment << endl);
-	  if(foundsomething) break;
+	  // TODO: testing
+	  // Looks like a weak difference
+	  CEBUG("\tsomething weak");
+	  foundsomething=true;
+	  strengthcomment="weak";
+	  break;
 	}
       }
     }
 
-    CEBUG("FINAL SC: " << straincomment << endl);
-
     if(foundsomething){
       if(hasSNP){
 	//vector<consensustag_t>::const_iterator ctI=CON_consensus_tags.begin();
-
+	
 	bool hasconsSNPtag=false;
 	bool hasconsUNStag=false;
 	if(cacheSROSIOSAOcctags[acp]) hasconsSNPtag=true;
 	if(cacheIUPctag[acp]) hasconsUNStag=true;
-
+	
 	if(!markSNPs){
 	  CEBUG("forcing UNS");
 	  makeitUNS=true;
@@ -3392,62 +3114,46 @@ void Contig::markFeaturesByConsensus(bool markSNPs, bool markUNSs, bool markIUPA
 	if(!hasconsSNPtag && !hasconsUNStag){
 	  if(makeitUNS){
 	    CEBUG("\ttag new UNS");
-	  }else if(makeitSIO){
-	    CEBUG("\ttag new SIO");
 	  }else{
 	    CEBUG("\ttag new SROc");
 	  }
 	}
-
-	//for(uint32 idsj=0; idsj < rcci.read_ids_in_col.size(); idsj++){
-	for(auto & pcrI : rcci.getPCRIsInCol()){
-	  //int32 actreadid=rcci.read_ids_in_col[idsj];
-	  //contigread_t & ric =CON_reads[actreadid];
-
-	  int32 rawreadpos=pcrI.contigPos2RawReadPos(rcci.getContigPos());
-
-	  tmpmt.from=rawreadpos;
-	  tmpmt.to=rawreadpos;
-	  tmpmt.setCommentStr("");
+	
+	for(uint32 idsj=0; idsj < rcci.read_ids_in_col.size(); idsj++){
+	  int32 actreadid=rcci.read_ids_in_col[idsj];
+	  contigread_t & ric =CON_reads[actreadid];
+	  
+	  int32 rawreadpos=ric.contigPos2RawReadPos(rcci.actcontigpos);
+	  
 	  if(makeitUNS){
-	    tmpmt.identifier=Read::REA_defaulttag_UNSr.identifier;
-	  }else if(makeitSIO){
-	    tmpmt.identifier=Read::REA_defaulttag_SIOr.identifier;
+	    ric.read.addTag(rawreadpos, rawreadpos, Read::REA_tagentry_idUNSr, strengthcomment);
 	  }else{
-	    tmpmt.identifier=Read::REA_defaulttag_SROr.identifier;
+	    ric.read.addTag(rawreadpos, rawreadpos, Read::REA_tagentry_idSROr, strengthcomment);
 	  }
-	  const_cast<Read &>(*pcrI).addTagO(tmpmt);
 	}
 	if(!hasconsSNPtag && !hasconsUNStag){
 	  if(makeitUNS){
-	    addTagToConsensus(rcci.getContigPos(),
-			      rcci.getContigPos(),
+	    addTagToConsensus(rcci.actcontigpos,
+			      rcci.actcontigpos,
 			      '=',
 			      multitag_t::getIdentifierStr(CON_tagentry_idUNSc).c_str(),
-			      straincomment.c_str(),
+			      strengthcomment.c_str(),
 			      false);
-	  }else if(makeitSIO){
-	    addTagToConsensus(rcci.getContigPos(),
-			      rcci.getContigPos(),
-			      '=',
-			      multitag_t::getIdentifierStr(CON_tagentry_idSIOc).c_str(),
-			      straincomment.c_str(),
-			      true);
 	  }else{
-	    addTagToConsensus(rcci.getContigPos(),
-			      rcci.getContigPos(),
+	    addTagToConsensus(rcci.actcontigpos, 
+			      rcci.actcontigpos,
 			      '=',
 			      multitag_t::getIdentifierStr(CON_tagentry_idSROc).c_str(),
-			      straincomment.c_str(),
+			      strengthcomment.c_str(),
 			      true);
 	  }
 	}
       }else if(missingcov){
 	if(mcfrom<0){
-	  mcfrom=static_cast<int32>(rcci.getContigPos());
+	  mcfrom=static_cast<int32>(rcci.actcontigpos);
 	  mcto=mcfrom;
-	}else if(static_cast<int32>(rcci.getContigPos()) == mcto+1){
-	  mcto=static_cast<int32>(rcci.getContigPos());
+	}else if(static_cast<int32>(rcci.actcontigpos) == mcto+1){
+	  mcto=static_cast<int32>(rcci.actcontigpos);
 	}else{
 	  addTagToConsensus(mcfrom,
 			    mcto,
@@ -3455,7 +3161,7 @@ void Contig::markFeaturesByConsensus(bool markSNPs, bool markUNSs, bool markIUPA
 			    multitag_t::getIdentifierStr(CON_tagentry_idMCVc).c_str(),
 			    "",
 			    false);
-	  mcfrom=static_cast<int32>(rcci.getContigPos());
+	  mcfrom=static_cast<int32>(rcci.actcontigpos);
 	  mcto=mcfrom;
 	}
       }
@@ -3476,7 +3182,7 @@ void Contig::markFeaturesByConsensus(bool markSNPs, bool markUNSs, bool markIUPA
   {
     vector<multitag_t::mte_id_t> master;
     vector<multitag_t::mte_id_t> unwanted;
-
+    
     master.push_back(Contig::CON_tagentry_idSROc);
     master.push_back(Contig::CON_tagentry_idSIOc);
     master.push_back(Contig::CON_tagentry_idSAOc);
@@ -3573,10 +3279,10 @@ void Contig::reduceConsensusTags(const vector<multitag_t::mte_id_t> & mastertags
  *    whether the coverage of that sequencing type reaches a threshold
  *    (must have an initial start of minimum length, can have grace
  *    length of bases below once started
- * 2) If maxcovperread not empty: also set multicopies[] to 1 if
+ * 2) If maxcovperread not empty: also set multicopies[] to 1 if 
  *    maxcoverage of read exceeds covperst[straintype] * -AS:ardct
  *    (in the multicopies array)
- * 3) Stores the maximum coverage reached by each read
+ * 3) Stores the maxiumum coverage reached by each read
  *  involved with into the array. It does this on a per seqtype basis
  *
  *
@@ -3590,46 +3296,44 @@ bool Contig::analyseReadCoverage(vector<uint32> & maxcovperread, vector<uint8> &
 {
   FUNCSTART("void Contig::analyseReadCoverage(vector<uint32> & maxcov)");
 
-  bool somethingchanged=false;
-
   CEBUG("Additional coverage analysis.\n");
 
   BUGIFTHROW(maxcovperread.size() != CON_readpool->size(), "maxcovperread.size() != CON_readpool->size() ???");
 
-  vector< vector<uint8> > newmulticopies_perst(ReadGroupLib::SEQTYPE_END);
-  for(auto & nmps : newmulticopies_perst){
-    nmps.resize(CON_counts.size(),0);
+  vector< vector<uint8> > newmulticopies_perst(Read::SEQTYPE_END);
+  for(uint32 st=0; st<Read::SEQTYPE_END; st++){
+    newmulticopies_perst[st].resize(CON_counts.size(),0);
   }
 
   // transform covperseqtype effectively in a threshold for detection
   //  of multicopies
-  for(uint32 cpsi=0; cpsi < covperst.size(); ++cpsi){
-    covperst[cpsi]=static_cast<uint32>(
-      static_cast<double>(covperst[cpsi])*((*CON_miraparams)[cpsi]).getAssemblyParams().as_ard_multicopythreshold
+  for(uint32 i=0; i<covperst.size(); i++){
+    covperst[i]=static_cast<uint32>(
+      static_cast<double>(covperst[i])*((*CON_miraparams)[i]).getAssemblyParams().as_ard_multicopythreshold
       );
-    CEBUG("threshold(" << cpsi << "): " << covperst[cpsi] << endl);
+    CEBUG("threshold(" << i << "): " << covperst[i] << endl);
   }
 
   if(!covperst.empty()){
-    for(uint32 seqtype=0; seqtype<ReadGroupLib::SEQTYPE_END; ++seqtype){
+    for(uint32 st=0; st<Read::SEQTYPE_END; st++){
       int32 actlen=0;
       int32 actgrace=0;
-
+      
       int32 mcstart=-1;
       int32 mcend=-1;
       bool hasvalidmc=false;
-
-      auto ccI=CON_counts.begin();
-      for(uint32 actcontigpos=0; actcontigpos<CON_counts.size(); ++ccI, ++actcontigpos){
-
-	CEBUG("acp: " << actcontigpos << "\tac: " << ccI->seqtype_cov[seqtype] << '\n');
-	if(covperst[seqtype]>0 && ccI->seqtype_cov[seqtype] >= covperst[seqtype]) {
+      
+      cccontainer_t::iterator ccI=CON_counts.begin();
+      for(uint32 actcontigpos=0; actcontigpos<CON_counts.size() ;actcontigpos++, ccI++){
+	
+	CEBUG("acp: " << actcontigpos << "\tac: " << ccI->seqtype_cov[st] << '\n');
+	if(covperst[st]>0 && ccI->seqtype_cov[st] >= covperst[st]) {
 	  if(mcstart>=0) {
 	    CEBUG("\t#1\n");
 	    mcend=1+static_cast<int32>(actcontigpos);
 	    actgrace=0;
 	    actlen++;
-	    if(actlen>=((*CON_miraparams)[seqtype]).getAssemblyParams().as_ard_multicopyminlen) hasvalidmc=true;
+	    if(actlen>=((*CON_miraparams)[st]).getAssemblyParams().as_ard_multicopyminlen) hasvalidmc=true;
 	  } else {
 	    CEBUG("\t#2\n");
 	    mcstart=static_cast<int32>(actcontigpos);
@@ -3641,13 +3345,13 @@ bool Contig::analyseReadCoverage(vector<uint32> & maxcovperread, vector<uint8> &
 	  if(hasvalidmc){
 	    CEBUG("\t#3\n");
 	    actgrace++;
-	    if(actgrace>=((*CON_miraparams)[seqtype]).getAssemblyParams().as_ard_multicopygrace){
+	    if(actgrace>=((*CON_miraparams)[st]).getAssemblyParams().as_ard_multicopygrace){
 	      CEBUG("\t#4\n");
-	      if(mcend-mcstart>=((*CON_miraparams)[seqtype]).getAssemblyParams().as_ard_multicopyminlen){
+	      if(mcend-mcstart>=((*CON_miraparams)[st]).getAssemblyParams().as_ard_multicopyminlen){
 		CEBUG("\t#5\n");
 		for(int32 cp=mcstart; cp<mcend; cp++){
 		  CEBUG("new mc pos: " << cp << '\n');
-		  newmulticopies_perst[seqtype][cp]=1;
+		  newmulticopies_perst[st][cp]=1;
 		}
 	      }
 	      mcstart=-1;
@@ -3667,11 +3371,11 @@ bool Contig::analyseReadCoverage(vector<uint32> & maxcovperread, vector<uint8> &
 	}
       }
       if(hasvalidmc){
-	if(mcend-mcstart>=((*CON_miraparams)[seqtype]).getAssemblyParams().as_ard_multicopyminlen){
+	if(mcend-mcstart>=((*CON_miraparams)[st]).getAssemblyParams().as_ard_multicopyminlen){
 	  CEBUG("\t#7\n");
 	  for(int32 cp=mcstart; cp<mcend; cp++){
 	    CEBUG("new mc pos: " << cp << '\n');
-	    newmulticopies_perst[seqtype][cp]=1;
+	    newmulticopies_perst[st][cp]=1;
 	  }
 	}
       }
@@ -3679,52 +3383,56 @@ bool Contig::analyseReadCoverage(vector<uint32> & maxcovperread, vector<uint8> &
   }
 
 
+  bool somethingchanged=false;
+
   // now go through the vector and mark all reads at positions
   //  with new mc values
 
-  for(uint32 seqtype=0; seqtype<ReadGroupLib::SEQTYPE_END; ++seqtype){
-    rcci_t rcci(this);
+  for(uint32 st=0; st<Read::SEQTYPE_END; st++){
+    rcci_t rcci;
     {
-      vector<int32> dummy;
-      vector<uint8> allowedseqtypes;
-      allowedseqtypes.push_back(seqtype);
-      rcci.init(dummy,            // empty vector == all strainids
-		allowedseqtypes,  // only this seqtype
-		false,           // no rails
-		false,          // no backbones
-		false);   // no reads without readpool-reads
+      vector<int32> allowedstrainids; // empty == all
+      vector<uint8> allowedreadtypes; // empty == all
+      allowedreadtypes.push_back(st);
+      readColContigIteratorInit(rcci, 
+				allowedstrainids, 
+				allowedreadtypes, 
+				false,           // no rails
+				false,          // no backbones
+				false);   // no reads without readpool-reads
     }
 
-    auto ccI=CON_counts.begin();
-    for(uint32 actcontigpos=0; actcontigpos<CON_counts.size(); ++ccI, rcci.advance(), ++actcontigpos){
-      //for(uint32 idsrcci=0; idsrcci < rcci.read_ids_in_col.size(); idsrcci++){
-      for(auto & pcrI : rcci.getPCRIsInCol()){
-	if(pcrI.getORPID() == -1) continue;
-	if(ccI->seqtype_cov[seqtype]>maxcovperread[pcrI.getORPID()]){
-	  maxcovperread[pcrI.getORPID()]=ccI->seqtype_cov[seqtype];
-	  CEBUG(pcrI->getName() << " new maxcov: " << maxcovperread[pcrI.getORPID()] << '\n');
+    cccontainer_t::iterator ccI=CON_counts.begin();
+    for(uint32 actcontigpos=0; actcontigpos<CON_counts.size() ;actcontigpos++, ccI++, readColContigIteratorAdvance(rcci)){
+      for(uint32 idsrcci=0; idsrcci < rcci.read_ids_in_col.size(); idsrcci++){
+	int32          actreadid=rcci.read_ids_in_col[idsrcci];
+	contigread_t & ric =CON_reads[actreadid];
+	if(ric.orpid==-1) continue;
+	if(ccI->seqtype_cov[st]>maxcovperread[ric.orpid]){
+	  maxcovperread[ric.orpid]=ccI->seqtype_cov[st];
+	  CEBUG(ric.read.getName() << " new maxcov: " << maxcovperread[ric.orpid] << '\n');
 	  if(covperst.empty()){
 	    somethingchanged=true;
 	  }
 	}
-	if(pcrI->getSequencingType() != seqtype) continue;
-	if(newmulticopies_perst[seqtype][actcontigpos]){
-	  if(multicopies[pcrI.getORPID()]) {
-	    //CEBUG(pcrI->getName() << " again multicopy " << maxcovperread[pcrI.getORPID()] << '\n');
+	if(ric.read.getSequencingType() != st) continue;
+	if(newmulticopies_perst[st][actcontigpos]){
+	  if(multicopies[ric.orpid]) {
+	    //CEBUG(ric.read.getName() << " again multicopy " << maxcovperread[ric.orpid] << '\n');
 	  }else{
-	    CEBUG(pcrI->getName() << " new multicopy " << maxcovperread[pcrI.getORPID()] << '\n');
+	    CEBUG(ric.read.getName() << " new multicopy " << maxcovperread[ric.orpid] << '\n');
 	  }
-	  multicopies[pcrI.getORPID()]=1;
+	  multicopies[ric.orpid]=1;
 	  somethingchanged=true;
 	}
       }
     }
   }
-
+  
   CEBUG("Done (Additional coverage analysis).\n");
 
   FUNCEND();
-
+  
   return somethingchanged;
 }
 
@@ -3732,13 +3440,13 @@ bool Contig::analyseReadCoverage(vector<uint32> & maxcovperread, vector<uint8> &
 
 
 
-// given a read, a pos and a base, returns as return value
-//  - how long the poly base stretch is (in real number of bases)
+// given a read, a pos and a base, returns as return value 
+//  - how long the poly base stretch is (in real number of bases) 
 // in a reference var
 //  - the span of the stretch including gaps in "span"
-//  - zeroqualcounts counts bases with a quality of 0,
+//  - zeroqualcounts counts bases with a quality of 0,  
 
-// Remark: jumps over gaps!
+// Remark: jumps over gaps! 
 // Result can also be 0:
 //  - when run arrives at one of the ends
 //  - when there is no run of this base at that position
@@ -3753,28 +3461,22 @@ uint32 Contig::getBaseRunLength(const Read & read, const uint32 readpos, const c
   from=0;
   to=0;
 
-  // is the base at that position what we need to check for?
-  // if not, well, return
-  char checkbase=toupper(read.getBaseInSequence(readpos));
-  if((dptools::isValidACGTBase(checkbase) && checkbase!=base)){
-    CEBUG("getBaseRunLength(): not on base\n");
-    return 0;
-  }
-
   // should be zero, 2 for testing!
   uint8 zeroqual=0;
 
-  // check how long the stretch of char base is to the left
+  // check how long the stretch of char base is to the left 
   uint32 leftruncounter=0;
+
   {
     int32 rrpi=readpos-1;
-
-    for(; rrpi>=0; --rrpi, ++leftruncounter){
+    //while(rrpi>0 && read.getBaseInSequence(rrpi) == '*') rrpi--;
+    
+    for(; rrpi>=0; rrpi--, leftruncounter++){
       if(read.getBaseInSequence(rrpi) == '*'){
-	--leftruncounter;
+	leftruncounter--;
       }else{
 	if(toupper(read.getBaseInSequence(rrpi)) != base) break;
-	if(read.getQualityInSequence(rrpi)<=zeroqual) ++zeroqualcounts;
+	if(read.getQualityInSequence(rrpi)<=zeroqual) zeroqualcounts++;
       }
     }
 
@@ -3782,7 +3484,6 @@ uint32 Contig::getBaseRunLength(const Read & read, const uint32 readpos, const c
     if((useclipsasends && rrpi<=read.getLeftClipoff())
        || (!useclipsasends && rrpi<0)){
       zeroqualcounts=0;
-      CEBUG("getBaseRunLength(): left border\n");
       return 0;
     }
 
@@ -3793,12 +3494,16 @@ uint32 Contig::getBaseRunLength(const Read & read, const uint32 readpos, const c
   uint32 rightruncounter=0;
   {
     int32 rrpi=readpos;
-    for(; static_cast<uint32>(rrpi)<read.getLenSeq(); ++rrpi, ++rightruncounter){
+    // if we are on a star, go one right
+    //while(rrpi<read.getLenSeq()
+    //  && read.getBaseInSequence(rrpi) == '*') rrpi++;
+    
+    for(; static_cast<uint32>(rrpi)<read.getLenSeq(); rrpi++, rightruncounter++){
       if(read.getBaseInSequence(rrpi) == '*'){
-	--rightruncounter;
+	rightruncounter--;
       }else{
 	if(toupper(read.getBaseInSequence(rrpi)) != base) break;
-	if(read.getQualityInSequence(rrpi)<=zeroqual) ++zeroqualcounts;
+	if(read.getQualityInSequence(rrpi)<=zeroqual) zeroqualcounts++;
       }
     }
     // don't count when this run was on border of read
@@ -3806,7 +3511,6 @@ uint32 Contig::getBaseRunLength(const Read & read, const uint32 readpos, const c
        || (!useclipsasends && static_cast<uint32>(rrpi)>=read.getLenSeq())) {
       zeroqualcounts=0;
       from=0;
-      CEBUG("getBaseRunLength(): right border\n");
       return 0;
     }
 
@@ -3815,7 +3519,7 @@ uint32 Contig::getBaseRunLength(const Read & read, const uint32 readpos, const c
   }
 
   uint32 totalruncounter=leftruncounter+rightruncounter;
-
+  
   CEBUG("left run: " << leftruncounter << endl);
   CEBUG("right run: " << rightruncounter << endl);
   CEBUG("total run: " << totalruncounter << endl);
@@ -3844,7 +3548,7 @@ uint32 Contig::getBaseRunLength(const Read & read, const uint32 readpos, const c
  *       .........xxxxxxxxxxxxxxxxx.............
  *       .........xxxxxxxxxxxxxxxxx.............
  *       .........xxxxxx******xxxxx.............
- *
+ *  
  * Really tricky due to those damn homopolymers of 454 which can vary up to
  *  5 or more bses for longer runs.
  *
@@ -3864,13 +3568,18 @@ void Contig::largeGapRepeatMarker(uint32 mingaplen, uint32 mingroupsize, bool ne
   if(mingroupsize==0) mingroupsize=1;
   if(mingaplen==0) mingaplen=1;
 
-  rcci_t rcci(this,
-	      nullptr,          // all strainids
-	      nullptr,          // all seqtypes
-	      false,           // no rails
-	      false,          // no backbones
-	      false);   // no reads without readpool-reads
-
+  rcci_t rcci;
+  {
+    vector<int32> allowedstrainids; // empty == all
+    vector<uint8> allowedreadtypes; // empty == all
+    readColContigIteratorInit(rcci, 
+			      allowedstrainids, 
+			      allowedreadtypes, 
+			      false,           // no rails
+			      false,          // no backbones
+			      false);   // no reads without readpool-reads
+  }
+  
   vector<uint32> gapruns;
   gapruns.reserve(1000);
 
@@ -3881,23 +3590,23 @@ void Contig::largeGapRepeatMarker(uint32 mingaplen, uint32 mingroupsize, bool ne
   checkbases.push_back('G');
   checkbases.push_back('T');
 
-
+    
   uint32 jumpover=0;  // once a gap are was found, loop through the for loop until after the gap area when >0
-  auto ccI=CON_counts.begin();
-  for(uint32 actcontigpos=0; actcontigpos<CON_counts.size(); ++actcontigpos, ++ccI, rcci.advance()){
+  cccontainer_t::iterator ccI=CON_counts.begin();
+  for(uint32 actcontigpos=0; actcontigpos<CON_counts.size() ;actcontigpos++, ccI++, readColContigIteratorAdvance(rcci)){
     CEBUGF2("lgrm acp: " << actcontigpos << '\n');
     if(jumpover) {
-      --jumpover;
+      jumpover--;
       continue;
     }
     CEBUGF2(*ccI);
     if(ccI->total_cov < 2*mingroupsize) continue;
     if(ccI->star < 4*mingroupsize) continue;
     uint32 numvalidgroups=1;
-    if(ccI->A >= 4*mingroupsize) ++numvalidgroups;
-    if(ccI->C >= 4*mingroupsize) ++numvalidgroups;
-    if(ccI->G >= 4*mingroupsize) ++numvalidgroups;
-    if(ccI->T >= 4*mingroupsize) ++numvalidgroups;
+    if(ccI->A >= 4*mingroupsize) numvalidgroups++;
+    if(ccI->C >= 4*mingroupsize) numvalidgroups++;
+    if(ccI->G >= 4*mingroupsize) numvalidgroups++;
+    if(ccI->T >= 4*mingroupsize) numvalidgroups++;
     if(numvalidgroups<2) continue;
 
     CEBUG("lgrm check: " << actcontigpos << '\n');
@@ -3907,20 +3616,22 @@ void Contig::largeGapRepeatMarker(uint32 mingaplen, uint32 mingroupsize, bool ne
     vector<vector<uint32> > hpruncount(checkbases.size());
     vector<uint32> mostfrequenthprun(checkbases.size(),0);
     vector<bool> ishomopolymer;
-    for(auto & tpcrI : rcci.getPCRIsInCol()){
-      if(tpcrI.getORPID() == -1
-	 || tpcrI->isBackbone()
-	 || tpcrI->isRail()) continue;
+    for(uint32 idsrcci=0; idsrcci < rcci.read_ids_in_col.size(); idsrcci++){
+      int32          actreadid=rcci.read_ids_in_col[idsrcci];
+      contigread_t & ric =CON_reads[actreadid];
+      if(ric.orpid==-1
+	 || ric.read.isBackbone() 
+	 || ric.read.isRail()) continue;
 
-      int32 rawrpos=tpcrI.contigPos2RawReadPos(actcontigpos);
-      char ricbase=tpcrI.getBase(actcontigpos);
-      CEBUG("rn " << tpcrI->getName()<< "\t" << ricbase << '\n');
+      int32 rawrpos=ric.contigPos2RawReadPos(actcontigpos);
+      char ricbase=ric.getBase(actcontigpos);
+      CEBUG("rn " << ric.read.getName()<< "\t" << ricbase << '\n');
 
       for(uint32 cbi=0; cbi<checkbases.size(); cbi++){
 	uint32 from,to,zeroqualcounts;
 	char checkbase=checkbases[cbi];
-	if(tpcrI.getReadDirection() < 0) checkbase=dptools::getComplementBase(checkbase);
-	uint32 runlen=getBaseRunLength(*tpcrI,
+	if(ric.direction<0) checkbase=dptools::getComplementBase(checkbase);
+	uint32 runlen=getBaseRunLength(ric.read,
 				       rawrpos,
 				       checkbase,
 				       from,to,zeroqualcounts);
@@ -3929,16 +3640,16 @@ void Contig::largeGapRepeatMarker(uint32 mingaplen, uint32 mingroupsize, bool ne
 	  CEBUGF2("Extend to " << runlen << '\n');
 	  for(uint32 i=0; i<checkbases.size(); i++) hpruncount[i].resize(runlen+1,0);
 	}
-	++hpruncount[cbi][runlen];
+	hpruncount[cbi][runlen]++;
 	CEBUGF2("hpruncount[cbi][runlen]: " << hpruncount[cbi][runlen] << '\n');
 	CEBUGF2("mostfrequenthprun[cbi]: " << mostfrequenthprun[cbi] << '\n');
 	if(hpruncount[cbi][runlen]>hpruncount[cbi][mostfrequenthprun[cbi]]){
 	  mostfrequenthprun[cbi]=runlen;
 	}
       }
-    }
+    }    
 
-    for(uint32 cbi=0; cbi<checkbases.size(); ++cbi){
+    for(uint32 cbi=0; cbi<checkbases.size(); cbi++){
       CEBUG("mostfrequenthprun[" << cbi << "]: " << mostfrequenthprun[cbi]);
       CEBUG("\tfrequency: " << hpruncount[cbi][mostfrequenthprun[cbi]] << '\n');
 
@@ -3958,9 +3669,9 @@ void Contig::largeGapRepeatMarker(uint32 mingaplen, uint32 mingroupsize, bool ne
     //  larger length
 
     uint32 gapcorrector=0;
-    for(uint32 hplen=hpruncount[0].size()-1; hplen>0; --hplen){
+    for(uint32 hplen=hpruncount[0].size()-1; hplen>0; hplen--){
       bool docorrect=false;
-      for(uint32 cbi=0; cbi<checkbases.size(); ++cbi){
+      for(uint32 cbi=0; cbi<checkbases.size(); cbi++){
 	//if(ishomopolymer[cbi]){
 	  if(hpruncount[cbi][hplen]>0 && hpruncount[cbi][hplen]<hpruncount[cbi][mostfrequenthprun[cbi]]/10){
 	    CEBUG("Correcting because of " << hplen << ", " << cbi << '\t' << hpruncount[cbi][hplen] << '\n');
@@ -3970,7 +3681,7 @@ void Contig::largeGapRepeatMarker(uint32 mingaplen, uint32 mingroupsize, bool ne
 	  //}
       }
       if(docorrect) {
-	++gapcorrector;
+	gapcorrector++;
       }else{
 	break;
       }
@@ -3980,7 +3691,7 @@ void Contig::largeGapRepeatMarker(uint32 mingaplen, uint32 mingroupsize, bool ne
 
     // find out how many reads have at least the minimum gap size
     // if there's a gap, the reads must also have the minimum homopolymer
-    //  size which is the one of the most frequent from above
+    //  size which is the one of the most frequent from above 
 
     uint32 readswithgaps=0;
     uint32 readswithnogaps=0;
@@ -3989,44 +3700,46 @@ void Contig::largeGapRepeatMarker(uint32 mingaplen, uint32 mingroupsize, bool ne
     bool hasgapsreverse=false;
     gapruns.resize(1);
     gapruns[0]=0;
+    
+    for(uint32 idsrcci=0; idsrcci < rcci.read_ids_in_col.size(); idsrcci++){
+      int32          actreadid=rcci.read_ids_in_col[idsrcci];
+      contigread_t & ric =CON_reads[actreadid];
+      if(ric.orpid==-1) continue;
 
-    for(auto & tpcrI : rcci.getPCRIsInCol()){
-      if(tpcrI.getORPID() == -1) continue;
-
-      int32 rawrpos=tpcrI.contigPos2RawReadPos(actcontigpos);
-      char ricbase=tpcrI.getBase(actcontigpos);
-      CEBUG("rn " << tpcrI->getName()<< "\t" << ricbase << '\n');
+      int32 rawrpos=ric.contigPos2RawReadPos(actcontigpos);
+      char ricbase=ric.getBase(actcontigpos);
+      CEBUG("rn " << ric.read.getName()<< "\t" << ricbase << '\n');
 
       if(ricbase=='*'){
 	bool cantake=true;
 
 	// if it's categorised as homopolymer and the length is lower
 	//  than the average estimate, don't take
-	// if it's not categorised as homopolymer and the length is
+	// if it's not categorised as homopolymer and the length is 
 	//  is larger than avg len +2, don't take
-	for(uint32 cbi=0; cbi< checkbases.size(); ++cbi){
-	  char base =checkbases[cbi];
-	  if(tpcrI.getReadDirection() < 0) base=dptools::getComplementBase(base);
+	for(uint32 i=0; i< checkbases.size(); i++){
+	  char base =checkbases[i];
+	  if(ric.direction<0) base=dptools::getComplementBase(base);
 	  uint32 from,to,zeroqualcounts;
-	  uint32 hprunlen=getBaseRunLength(*tpcrI,
+	  uint32 hprunlen=getBaseRunLength(ric.read,
 					   rawrpos,
 					   base,
 					   from,to,zeroqualcounts);
-	  CEBUG("hprunlen[" << cbi << "]: " << hprunlen << '\n');
-	  if(ishomopolymer[cbi]){
-	    if(hprunlen<mostfrequenthprun[cbi]) {
+	  CEBUG("hprunlen[" << i << "]: " << hprunlen << '\n');
+	  if(ishomopolymer[i]){
+	    if(hprunlen<mostfrequenthprun[i]) {
 	      cantake=false;
 	      CEBUG("Homopolymer to short\n");
 	    }
 	  }else{
-	    if(hprunlen>mostfrequenthprun[cbi] + 2) {
+	    if(hprunlen>mostfrequenthprun[i] + 2) {
 	      cantake=false;
 	      CEBUG("Too many new homoplymer bases.\n");
 	    }
 	  }
 	}
 	if(cantake){
-	  uint32 gaprunlen=tpcrI->getLenOfGapRun(rawrpos);
+	  uint32 gaprunlen=ric.read.getLenOfGapRun(rawrpos);
 	  CEBUG("grl " << gaprunlen << '\n');
 	  if(gapcorrector>gaprunlen) {
 	    gaprunlen=0;
@@ -4034,30 +3747,30 @@ void Contig::largeGapRepeatMarker(uint32 mingaplen, uint32 mingroupsize, bool ne
 	    gaprunlen-=gapcorrector;
 	  }
 	  CEBUG("grlc " << gaprunlen << '\n');
-
+	  
 	  if(gaprunlen>=gapruns.size()) gapruns.resize(gaprunlen+1,0);
-	  ++gapruns[gaprunlen];
+	  gapruns[gaprunlen]++;
 	  if(gapruns[gaprunlen]>gapruns[mostfrequentgapsize]) mostfrequentgapsize=gaprunlen;
-
+	  
 	  if(gaprunlen>=mingaplen) {
-	    ++readswithgaps;
-	    if(tpcrI.getReadDirection() > 0) {
+	    readswithgaps++;
+	    if(ric.direction>0) {
 	      hasgapsforward=true;
 	    }else{
 	      hasgapsreverse=true;
 	    }
 	  }
 	}else{
-	  ++readswithnogaps;
+	  readswithnogaps++;
 	}
       }
     }
-
+    
 
     uint32 maxgaprunlen=gapruns.size();
-    if(maxgaprunlen>0) --maxgaprunlen;
+    if(maxgaprunlen>0) maxgaprunlen--;
 
-    CEBUG("readsincol: " << rcci.getPCRIsInCol().size() << '\n');
+    CEBUG("readsincol: " << rcci.read_ids_in_col.size() << '\n');
     CEBUG("readswithgaps: " << readswithgaps << "\treadswithnogaps: " << readswithnogaps << '\n');
     CEBUG("hasgapsforward: " << hasgapsforward << "\thasgapsreverse: " << hasgapsreverse << '\n');
     CEBUG("maxgaprunlen: " << maxgaprunlen << '\n');
@@ -4066,14 +3779,16 @@ void Contig::largeGapRepeatMarker(uint32 mingaplen, uint32 mingroupsize, bool ne
     if(readswithgaps<mingroupsize) continue;
     if(needbothstrands && !(hasgapsforward && hasgapsreverse)) continue;
 
+    
+
 
     // so, basically this looks like a good place to mark
 
     CEBUG("Tagging: " << actcontigpos << " to " << actcontigpos+maxgaprunlen << '\n');
-
+    
     addTagToConsensus(actcontigpos,actcontigpos+maxgaprunlen,
     		      '=',"Fcon","",true);
-
+    
     jumpover=maxgaprunlen;
 
   }
@@ -4100,16 +3815,16 @@ void Contig::csbrm_fillin_groups_stst(const ercci_t & ercci, const vector<int8>
 {
   FUNCSTART("void Contig::csbrm_fillin_groups_stst(const ercci_t & ercci, const vector<int8> & maskshadow, const vector<string> & masktagtypes, vector<vector<vector <nngroups_t> > > & groups_st_st)");
 
-  for(uint32 seqtype=0; seqtype<ReadGroupLib::getNumSequencingTypes(); ++seqtype){
+  for(uint32 seqtype=0; seqtype<Read::getNumSequencingTypes(); seqtype++){
     contig_parameters const & con_rt_params= (*CON_miraparams)[seqtype].getContigParams();
 
     // TODO: check whether use the one from parameters???
     int32 endreadmarkexclusionarea=5;
     //switch(seqtype) {
-    //case ReadGroupLib::SEQTYPE_SANGER:
-    //case ReadGroupLib::SEQTYPE_454GS20:
-    //case ReadGroupLib::SEQTYPE_SOLEXA:
-    //case ReadGroupLib::SEQTYPE_ABISOLID: {
+    //case Read::SEQTYPE_SANGER:
+    //case Read::SEQTYPE_454GS20:
+    //case Read::SEQTYPE_SOLEXA:
+    //case Read::SEQTYPE_ABISOLID: {
     //  endreadmarkexclusionarea=1;
     //  break;
     //}
@@ -4119,50 +3834,52 @@ void Contig::csbrm_fillin_groups_stst(const ercci_t & ercci, const vector<int8>
     //}
 
     BUGIFTHROW(endreadmarkexclusionarea<1, "endreadmarkexclusionarea may not be < 1");
-
-    auto & pcri_st_st=ercci.getPCRIstst();
-    for(uint32 strainid=0; strainid < pcri_st_st[0].size(); ++strainid){
-      for(const auto & tpcrI : pcri_st_st[seqtype][strainid]){
-	if(tpcrI->isRail()
-	  || tpcrI->isBackbone()) {
+    
+    for(uint32 strainid=0; strainid<ercci.rids_st_st[0].size(); strainid++){
+      for(uint32 readnr=0; readnr < ercci.rids_st_st[seqtype][strainid].size(); readnr++){
+	int32          actreadid=ercci.rids_st_st[seqtype][strainid][readnr];
+	contigread_t & ric =CON_reads[actreadid];
+
+	if(ric.read.isRail()
+	  || ric.read.isBackbone()) {
 	  continue;
 	}
 
-	int32 readpos=tpcrI.contigPos2UnclippedReadPos(ercci.getContigPos());
+	int32 readpos=ric.contigPos2UnclippedReadPos(ercci.actcontigpos);
 
 	// reads that start or end in that region are dangerous as some
 	//  spurious false bases might influence the result. Skip those.
-	if(tpcrI.getReadDirection() > 0){
-	  if(readpos < tpcrI->getLeftClipoff()+endreadmarkexclusionarea
-	     || readpos > tpcrI->getRightClipoff()-endreadmarkexclusionarea) {
-	    CEBUGF2(tpcrI->getName()<< ": readposition too near to start or end of read.\n");
+	if(ric.direction>0){
+	  if(readpos < ric.read.getLeftClipoff()+endreadmarkexclusionarea
+	     || readpos > ric.read.getRightClipoff()-endreadmarkexclusionarea) {
+	    CEBUGF2(ric.read.getName()<< ": readposition too near to start or end of read.\n");
 	    continue;
 	  }
 	}else{
-	  if(tpcrI->calcComplPos(readpos) < tpcrI->getLeftClipoff()+endreadmarkexclusionarea
-	     || tpcrI->calcComplPos(readpos) > tpcrI->getRightClipoff()-endreadmarkexclusionarea) {
-	    CEBUGF2(tpcrI->getName()<< ": readposition too near to start or end of read.\n");
+	  if(ric.read.calcComplPos(readpos) < ric.read.getLeftClipoff()+endreadmarkexclusionarea 
+	     || ric.read.calcComplPos(readpos) > ric.read.getRightClipoff()-endreadmarkexclusionarea) {
+	    CEBUGF2(ric.read.getName()<< ": readposition too near to start or end of read.\n");
 	    continue;
 	  }
 	}
 
-	CEBUGF2("\nLooking at " << tpcrI->getName()<< " ");
+	CEBUGF2("\nLooking at " << ric.read.getName()<< " ");
 
 	// check whether this read has a tag that prohibits searching for repeats here
-	// (only PSHP for the time being)
-	if(maskshadow[ercci.getContigPos()]) {
+	// (only FpAS & PSHP for the time being)
+	if(maskshadow[ercci.actcontigpos]) {
 	  // remember that the readpos computing routine doesn't take care
 	  //  of direction, so we have to complement that position in reverse cases
 	  int32 rawreadpos=readpos;
-	  if(tpcrI.getReadDirection() < 0){
-	    rawreadpos=tpcrI->calcComplPos(readpos);
+	  if(ric.direction<0){
+	    rawreadpos=ric.read.calcComplPos(readpos);
 	  }
-
-	  CEBUGF2("MASKED: " << ercci.getContigPos() << endl);
-	  CEBUGF2(tpcrI->getName() << "\t" << rawreadpos << "\t");
+	    
+	  CEBUGF2("MASKED: " << ercci.actcontigpos << endl);
+	  CEBUGF2(ric.read.getName() << "\t" << rawreadpos << "\t");
 	  bool maskfound=false;
 	  for(uint32 i=0; i<masktagtypes.size(); i++){
-	    if(tpcrI->hasTag(masktagtypes[i],rawreadpos)) {
+	    if(ric.read.hasTag(masktagtypes[i],rawreadpos)) {
 	      CEBUGF2("Masked with " << multitag_t::getIdentifierStr(masktagtypes[i]) << ", next read.\n");
 	      maskfound=true;
 	      break;
@@ -4170,34 +3887,33 @@ void Contig::csbrm_fillin_groups_stst(const ercci_t & ercci, const vector<int8>
 	  }
 	  if(maskfound) continue;
 	}
-
-	// ok, we know that we are at least con_endreadmarkexclusionarea away from
-
-	char           base=tpcrI.getBase(ercci.getContigPos());
-	base_quality_t qual=tpcrI.getQuality(ercci.getContigPos());
-
-	CEBUGF2('\t' << tpcrI.getReadDirection() << '\t' << base << ' ' << static_cast<uint16>(qual));
-
-	//for(uint32 actgroup=0; actgroup<groups_st_st[seqtype][strainid].size(); actgroup++) {
-	for(auto & actgroup : groups_st_st[seqtype][strainid]){
-	  if(actgroup.base==base) {
-	    actgroup.urdids.push_back(tpcrI.getURDID());
-	    actgroup.quals.push_back(qual);
-	    actgroup.directions.push_back(tpcrI.getReadDirection());
-
-	    if(tpcrI.getReadDirection() > 0){
-	      ++actgroup.forwarddircounter;
+	  
+	// ok, we know that we are at least con_endreadmarkexclusionarea away from 
+	
+	char           base=ric.getBase(ercci.actcontigpos);
+	base_quality_t qual=ric.getQuality(ercci.actcontigpos);
+	
+	CEBUGF2('\t' << ric.direction << '\t' << base << ' ' << static_cast<uint16>(qual));
+
+	for(uint32 actgroup=0; actgroup<groups_st_st[seqtype][strainid].size(); actgroup++) {
+	  if(groups_st_st[seqtype][strainid][actgroup].base==base) {
+	    groups_st_st[seqtype][strainid][actgroup].ids.push_back(actreadid);
+	    groups_st_st[seqtype][strainid][actgroup].quals.push_back(qual);
+	    groups_st_st[seqtype][strainid][actgroup].directions.push_back(ric.direction);
+
+	    if(ric.direction>0){
+	      groups_st_st[seqtype][strainid][actgroup].forwarddircounter++;
 	    }else{
-	      ++actgroup.complementdircounter;
+	      groups_st_st[seqtype][strainid][actgroup].complementdircounter++;
 	    }
 	    break;
 	  }
 	}
       }
 
-      // TODO: I think I don't need that at the moment, check that when time
-      for(auto & actgroup : groups_st_st[seqtype][strainid]){
-	calcGroupQual(actgroup);
+      // TODO: I think I don't need that at the moment
+      for(uint32 actgroup=0; actgroup<groups_st_st[seqtype][strainid].size(); actgroup++) {
+	calcGroupQual(groups_st_st[seqtype][strainid][actgroup]);
       }
     }
   }
@@ -4213,17 +3929,16 @@ void Contig::csbrm_fillin_groups_stst(const ercci_t & ercci, const vector<int8>
  *
  *************************************************************************/
 
-bool Contig::csbrm_checkReadsForHomopolymers(uint32 actcontigpos, uint32 maxrunallowed, const vector<int32> & checktheseurdids)
+bool Contig::csbrm_checkReadsForHomopolymers(uint32 actcontigpos, uint32 maxrunallowed, const vector<int32> & checkthesereads)
 {
-  FUNCSTART("void Contig::csbrm_checkReadsForHomopolymers(uint32 actcontigpos, vector<int32> & checktheseurdids)");
+  FUNCSTART("void Contig::csbrm_checkReadsForHomopolymers(uint32 actcontigpos, vector<int32> & checkthesereads)");
 
-  //for(uint32 xid=0; xid<checktheseurdids.size(); xid++){
-  for(auto & urdid : checktheseurdids){
-    auto pcrI=CON_reads.getIteratorOfReadpoolID(CON_reads.getReadORPIDAtURDID(urdid));
+  for(uint32 xid=0; xid<checkthesereads.size(); xid++){
+    contigread_t & ric =CON_reads[checkthesereads[xid]];
 
-    CEBUGF2("\ncsbrm hp look " << pcrI->getName());
+    CEBUGF2("\ncsbrm hp look " << ric.read.getName());
 
-    int32 checkpos=pcrI.contigPos2RawReadPos(actcontigpos);
+    int32 checkpos=ric.contigPos2RawReadPos(actcontigpos);
     int32 rightcheck=checkpos+5;
     checkpos-=5;
 
@@ -4231,19 +3946,19 @@ bool Contig::csbrm_checkReadsForHomopolymers(uint32 actcontigpos, uint32 maxruna
     //  cause for some problems may be in the clipped part
     //  Check whether this is really the right strategy (should be)
     for(; checkpos < rightcheck; checkpos++){
-      if(checkpos>=0 && checkpos < pcrI->getLenSeq()){
-	char base=pcrI->getBaseInSequence(checkpos);
+      if(checkpos>=0 && checkpos < ric.read.getLenSeq()){
+	char base=ric.read.getBaseInSequence(checkpos);
 	if(base != '*'){
-	  uint32 lowerposofrun=pcrI->getLowerBoundPosOfBaseRun(checkpos,
+	  uint32 lowerposofrun=ric.read.getLowerBoundPosOfBaseRun(checkpos,
 								  base,
 								  true);
-	  uint32 upperposofrun=1+pcrI->getUpperBoundPosOfBaseRun(checkpos,
+	  uint32 upperposofrun=1+ric.read.getUpperBoundPosOfBaseRun(checkpos,
 								    base,
 								    true);
 	  // now count how many bases there are really (without gaps)
 	  uint32 count=0;
 	  for(;lowerposofrun<upperposofrun; lowerposofrun++){
-	    if(pcrI->getBaseInSequence(lowerposofrun)==base) count++;
+	    if(ric.read.getBaseInSequence(lowerposofrun)==base) count++;
 	  }
 	  CEBUGF2("\t" << base << " " << count);
 	  if(count > maxrunallowed){
@@ -4264,7 +3979,7 @@ bool Contig::csbrm_checkReadsForHomopolymers(uint32 actcontigpos, uint32 maxruna
 
 /*************************************************************************
  *
- * Around given contigpos, checks that there's at max one position
+ * Around given contigpos, checks that there's at max one position 
  *  where a (and only one) read has a gap character
  *
  * If all ok, return true. False if not.
@@ -4275,20 +3990,20 @@ bool Contig::csbrm_checkForCleanBlock(cccontainer_t::iterator ccI)
   CEBUGF2("cfcb 1\n");
 
   // while going 5 backwards, if we're at contig begin return
-  for(uint32 i=0; i<5; --ccI, ++i ){
+  for(uint32 i=0; i<5; i++, ccI--){
     if(ccI==CON_counts.begin()) return false;
   }
 
   CEBUGF2("cfcb 2\n");
 
   uint32 readwithgapcount=0;
-  for(uint32 i=0; i<11; ccI++, ++i){
+  for(uint32 i=0; i<11; i++, ccI++){
     CEBUGF2("i: " << i << "\t" << readwithgapcount << '\n');
     if(ccI==CON_counts.end()) return false;
     if(ccI->star>0) {
       if(readwithgapcount
 	 || ccI->star > 1) return false;
-      ++readwithgapcount;
+      readwithgapcount++;
     }
   }
 
@@ -4306,7 +4021,7 @@ bool Contig::csbrm_checkForCleanBlock(cccontainer_t::iterator ccI)
  *
  * Searches and marks for places in the contig where new mark possible repeats
  *  may have missed repeats (especially in 454 data). Takes only Sanger or 454
- *  sequences to do so, Solexa leads to too many false positives (SOLiD probably
+ *  sequences to do so, Solexa leads to too many false positives (SOLiD probably 
  *  too) and the repeats in Solexa should have been caught by the normal
  *  repeat marker anyway.
  *
@@ -4326,28 +4041,40 @@ bool Contig::csbrm_checkForCleanBlock(cccontainer_t::iterator ccI)
 
 void Contig::codonSingleBaseRepeatMarker(uint32 mingroupsize, repeatmarker_stats_t & repstats, vector<bool> & readsmarkedsrm)
 {
-  FUNCSTART("void Contig::codonSingleBaseRepeatMarker(uint32 mingroupsize, repeatmarker_stats_t & repstats, vector<bool> & readsmarkedsrm)");
+  FUNCSTART("void Contig::largeGapRepeatMarker(uint32 mingaplen, uint32 mingroupsize, bool needbothstrands)");
 
   if(mingroupsize==0) mingroupsize=1;
 
   vector<int8> maskshadow;
   vector<multitag_t::mte_id_t> masktagtypes;
-  //masktagtypes.push_back(Read::REA_tagentry_idSOFApolyA_sequence);
-  masktagtypes.push_back(Read::REA_defaulttag_PSHP.identifier);
+  masktagtypes.push_back(Read::REA_tagentry_idFpAS);
+  masktagtypes.push_back(Read::REA_tagentry_idPSHP);
   buildMaskShadow(maskshadow,masktagtypes,false);
 
-  // get highest ID of strain with reads as number of strains in contig
-  // this is formally wrong as a contig may contain some strain IDs but not others
-  //  e.g.  (1 0 0 0 25 0 0 0) contains two strains, but has the highest ID=4
-  // but the routines below just need a correctly size vector
+  // get number of strains in this contig
   uint32 numstrains=0;
-  for(uint32 nsi=0; nsi<CON_readsperstrain.size(); ++nsi){
-    if(CON_readsperstrain[nsi]>0) numstrains=nsi;
+  for(uint32 i=0; i<CON_reads.size(); i++){
+    if(static_cast<uint32>(CON_reads[i].read.getStrainID()) > numstrains){
+      numstrains=CON_reads[i].read.getStrainID();
+    }
   }
-  // strain numbering starts at 0, so add 1
-  ++numstrains;
+  // remember: default strain has ID =0, so we have +1 strains
+  numstrains++;
+
+  ercci_t ercci;
+  extendedReadColContigIteratorInit(ercci,
+				    false,        // don't take rails
+				    false,        // take backbone
+				    numstrains);
 
-  static const string groupbases("ACGT*");
+
+  string groupbases;
+  //if(con_params.con_also_mark_gap_bases){
+  //  groupbases="ACGT*";
+  //}else{
+  //  groupbases="ACGT";
+  //}
+  groupbases="ACGT*";
 
   nngroups_t emptygroup;
   emptygroup.base='!';
@@ -4359,11 +4086,11 @@ void Contig::codonSingleBaseRepeatMarker(uint32 mingroupsize, repeatmarker_stats
   // groups per seqtype per strain, empty template
   vector<vector<vector <nngroups_t> > > emptygroups_st_st;
 
-  emptygroups_st_st.resize(ReadGroupLib::getNumSequencingTypes());
-  for(uint32 seqtype=0; seqtype<ReadGroupLib::getNumSequencingTypes(); seqtype++){
+  emptygroups_st_st.resize(Read::getNumSequencingTypes());
+  for(uint32 seqtype=0; seqtype<Read::getNumSequencingTypes(); seqtype++){
     emptygroups_st_st[seqtype].resize(numstrains);
-    for(uint32 strainid=0; strainid<numstrains; ++strainid){
-      for(uint32 actgroup=0; actgroup<groupbases.size(); ++actgroup){
+    for(uint32 strainid=0; strainid<numstrains; strainid++){
+      for(uint32 actgroup=0; actgroup<groupbases.size(); actgroup++){
 	emptygroups_st_st[seqtype][strainid].push_back(emptygroup);
 	emptygroups_st_st[seqtype][strainid].back().base=groupbases[actgroup];
       }
@@ -4374,23 +4101,15 @@ void Contig::codonSingleBaseRepeatMarker(uint32 mingroupsize, repeatmarker_stats
   vector<vector<vector <nngroups_t> > > groups_st_st;
 
   // which reads to mark
-  vector<uint32> urdidstomark;
-  urdidstomark.reserve(1024);
+  vector<int32> readstomark;
+  readstomark.reserve(1024);
 
   // bool vector
   vector<uint8> strainswithgroups;
   strainswithgroups.reserve(numstrains);
 
-  ercci_t ercci(this);
-  ercci.init(false,        // don't take rails
-	     false,        // take backbone
-	     numstrains);
-
-  auto ccI=CON_counts.begin();
-
-  multitag_t tmpmt;
-
-  for(uint32 actcontigpos=0; actcontigpos<CON_counts.size() ; ++actcontigpos, ++ccI, ercci.advance()){
+  cccontainer_t::iterator ccI=CON_counts.begin();
+  for(uint32 actcontigpos=0; actcontigpos<CON_counts.size() ;actcontigpos++, ccI++, extendedReadColContigIteratorAdvance(ercci)){
     CEBUGF2("\ncsbrm acp: " << actcontigpos << '\n');
     CEBUGF2(*ccI);
 
@@ -4416,66 +4135,65 @@ void Contig::codonSingleBaseRepeatMarker(uint32 mingroupsize, repeatmarker_stats
     groups_st_st=emptygroups_st_st;
 
     // put the bases of the different reads into groups
-    csbrm_fillin_groups_stst(ercci,
-			     maskshadow,
-			     masktagtypes,
+    csbrm_fillin_groups_stst(ercci, 
+			     maskshadow, 
+			     masktagtypes, 
 			     groups_st_st);
 
     bool foundsomething=false;
 
-#if CPP_READ_SEQTYPE_END != 8
-#error "This code is made for 8 sequencing types, adapt!"
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
 #endif
 
     // TODO: check what to do with PacBio
 
-    urdidstomark.clear();
+    readstomark.clear();
     strainswithgroups.clear();
     strainswithgroups.resize(numstrains,0);
-    for(uint32 seqtype=0; seqtype<ReadGroupLib::getNumSequencingTypes(); seqtype++){
+    for(uint32 seqtype=0; seqtype<Read::getNumSequencingTypes(); seqtype++){
       // next sequencing type if sequencing type is not Sanger or 454 or IonTorrent
-      if(seqtype != ReadGroupLib::SEQTYPE_SANGER
-	 && seqtype != ReadGroupLib::SEQTYPE_454GS20
-	 && seqtype != ReadGroupLib::SEQTYPE_IONTORRENT
-	 && seqtype != ReadGroupLib::SEQTYPE_TEXT) continue;
-      for(uint32 strainid=0; strainid<numstrains; ++strainid){
+      if(seqtype != Read::SEQTYPE_SANGER
+	 && seqtype != Read::SEQTYPE_454GS20
+	 && seqtype != Read::SEQTYPE_IONTORRENT) continue;
+      for(uint32 strainid=0; strainid<numstrains; strainid++){
 	CEBUG("seqt: " << seqtype << "\tstrid: " << strainid << '\n');
 	uint32 numgroups=0;
-	vector<uint32> tmpurdids2mark;
-	//for(uint32 actgroup=0; actgroup<groupbases.size(); ++actgroup){
-	for(auto & actgroup : groups_st_st[seqtype][strainid]){
-	  if(actgroup.urdids.size() >= mingroupsize){
+	vector<int32> tmpreads2mark;
+	for(uint32 actgroup=0; actgroup<groupbases.size(); actgroup++){
+	  if(groups_st_st[seqtype][strainid][actgroup].ids.size() >= mingroupsize){
 	    // minimum size is there
 	    // now: either the group has + and - direction and no homoplymer >5
 	    //  or it is in a clean block, has +/- reads and no homopolymer
 	    //  with more than 3 bases in sourrounding
-	    if((actgroup.forwarddircounter>0
-		&& actgroup.complementdircounter>0
+	    if((groups_st_st[seqtype][strainid][actgroup].forwarddircounter>0
+		&& groups_st_st[seqtype][strainid][actgroup].complementdircounter>0
 		&& csbrm_checkReadsForHomopolymers(actcontigpos,
 						   5,
-						   actgroup.urdids))
-	       || (actgroup.forwarddircounter>0
-		   && actgroup.complementdircounter>0
+						   groups_st_st[seqtype][strainid][actgroup].ids))
+	       || (groups_st_st[seqtype][strainid][actgroup].forwarddircounter>0
+		   && groups_st_st[seqtype][strainid][actgroup].complementdircounter>0
 		   && cleanblock
 		   && csbrm_checkReadsForHomopolymers(actcontigpos,
 						      3,
-						      actgroup.urdids))){
+						      groups_st_st[seqtype][strainid][actgroup].ids))){
 	      CEBUG("Possible group " << actgroup << '\n');
-	      ++numgroups;
-	      tmpurdids2mark.insert(
-		tmpurdids2mark.end(),
-		actgroup.urdids.begin(),
-		actgroup.urdids.end());
+	      numgroups++;
+	      tmpreads2mark.insert(
+		tmpreads2mark.end(),
+		groups_st_st[seqtype][strainid][actgroup].ids.begin(),
+		groups_st_st[seqtype][strainid][actgroup].ids.end());
+	      //for(uint32 yid=0; yid<
 	    }
 	  }
 	}
 	if(numgroups>=2) {
 	  foundsomething=true;
 	  strainswithgroups[strainid]=1;
-	  urdidstomark.insert(
-	    urdidstomark.end(),
-	    tmpurdids2mark.begin(),
-	    tmpurdids2mark.end());
+	  readstomark.insert(
+	    readstomark.end(),
+	    tmpreads2mark.begin(),
+	    tmpreads2mark.end());
 	}
       }
     }
@@ -4488,79 +4206,42 @@ void Contig::codonSingleBaseRepeatMarker(uint32 mingroupsize, repeatmarker_stats
     CEBUG("Found something in group analysis.\n");
 
     uint32 numstrainswithgroups=0;
-    for(auto swge : strainswithgroups){
-      if(swge) ++numstrainswithgroups;
+    for(uint32 i=0; i<strainswithgroups.size(); ++i){
+      if(strainswithgroups[i]) ++numstrainswithgroups;
     }
     BUGIFTHROW(numstrainswithgroups==0, "Ooooops?! numstrainswithgroups==0?");
 
-    bool assnp=false;
+    multitag_t::mte_id_t tagtoset=Read::REA_tagentry_idSRMr;
     if((*CON_miraparams)[0].getContigParams().con_assume_snp_insteadof_rmb){
-      CEBUG("Assume SNPs.\n");
       if(numstrainswithgroups==1) {
-	tmpmt=Read::REA_defaulttag_SAOr;
+	tagtoset=Read::REA_tagentry_idSAOr;
       }else{
-	tmpmt=Read::REA_defaulttag_SROr;
+	tagtoset=Read::REA_tagentry_idSROr;
       }
-      assnp=true;
-      ++repstats.numSNPs;
-    }else{
-      CEBUG("No SNPing.\n");
-      tmpmt=Read::REA_defaulttag_SRMr;
-      ++repstats.numSRMs;
     }
 
-    //for(uint32 ids=0; ids < urdidstomark.size(); ++ids){
-    for(auto urdid : urdidstomark){
-      auto orpid=CON_reads.getReadORPIDAtURDID(urdid);
-      if(orpid==-1) continue;
-      if(!assnp) readsmarkedsrm[orpid]=true;
-      auto pcrI=CON_reads.getIteratorOfReadpoolID(orpid);
+    for(uint32 ids=0; ids < readstomark.size(); ids++){
+      int32 actreadid=readstomark[ids];
+      contigread_t & ric =CON_reads[actreadid];
 
-      int32 rawreadpos=pcrI.contigPos2RawReadPos(actcontigpos);
+      if(ric.orpid==-1) continue;
+      readsmarkedsrm[ric.orpid]=true;
 
-      CEBUG("Mark read " << pcrI->getName() << " at " << rawreadpos << endl);
+      int32 rawreadpos=ric.contigPos2RawReadPos(actcontigpos);
+      
+      CEBUG("Mark read " << ric.read.getName() << " at " << rawreadpos << endl);
 
-      //pcrI->addTag(rawreadpos, rawreadpos, tagtoset, Read::REA_tagentry_coSRMr);
-      tmpmt.from=rawreadpos;
-      tmpmt.to=rawreadpos;
-      const_cast<Read &>(*pcrI).addTagO(tmpmt);
-    }
+      ric.read.addTag(rawreadpos, rawreadpos, tagtoset, Read::REA_tagentry_coSRMr);
 
+      //readsmarkedsrm[CON_reads[actreadid].orpid]=true;
+    }
+    
+    repstats.numSRMs++;
     CEBUG("Mark consensus\n");
     addTagToConsensus(actcontigpos,actcontigpos,
 		      '=',"Fcon","",true);
-    if(assnp){
-      if(tmpmt.identifier==Read::REA_defaulttag_SAOr.identifier){
-	addTagToConsensus(actcontigpos,actcontigpos,
-			  '=',
-			  multitag_t::getIdentifierStr(CON_tagentry_idSAOc).c_str(),"",true);
-      }else{
-	addTagToConsensus(actcontigpos,actcontigpos,
-			  '=',
-			  multitag_t::getIdentifierStr(CON_tagentry_idSROc).c_str(),"",true);
-      }
-    }else{
-      addTagToConsensus(actcontigpos,actcontigpos,
-			'=',
-			multitag_t::getIdentifierStr(CON_tagentry_idSRMc).c_str(),"",true);
-    }
+    addTagToConsensus(actcontigpos,actcontigpos,
+		      '=',
+		      multitag_t::getIdentifierStr(CON_tagentry_idSRMc).c_str(),"",true);
   }
 }
-
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-//#define CEBUG(bla)  {cout << bla; cout.flush();}
-//#define CEBUGF2(bla)  {cout << bla; cout.flush();}
-
-bool Contig::shouldHaveTPartnerInContig(PlacedContigReads::const_iterator pcrI, PlacedContigReads::const_iterator opcrI)
-{
-  FUNCSTART("bool Contig::shouldHaveTPartnerInContig(PlacedContigReads::const_iterator pcrI, PlacedContigReads::const_iterator opcrI)");
-  return true;
-
-}
diff --git a/src/mira/contig_consensus.C b/src/mira/contig_consensus.C
deleted file mode 100644
index 79f133f..0000000
--- a/src/mira/contig_consensus.C
+++ /dev/null
@@ -1,2774 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
- *   Krebsforschungszentrum, DKFZ Heidelberg) and Bastien Chevreux
- * Copyright (C) 2000 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-#include "contig.H"
-
-#include "util/dptools.H"
-#include "util/timer.H"
-
-#include <boost/lexical_cast.hpp>
-
-
-using namespace std;
-
-
-#define CEBUG(bla)
-
-//#define PARANOIABUGTRACKFLAG
-#ifdef PARANOIABUGTRACKFLAG
-#define paranoiaBUGSTAT(statement) { statement;}
-#define paranoiaBUGIF(ifcond, statement) { if(ifcond) {statement;}}
-#else
-#define paranoiaBUGSTAT(statement)
-#define paranoiaBUGIF(ifcond, statement)
-#endif
-
-
-// atm this slows down execution a bit
-//#define CLOCK_STEPS_CONS
-// atm this slows down execution ... a lot
-//#define CLOCK_STEPS_CONSSUB
-
-
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-//#define CEBUG(bla) {if(CON_cebugflag) cout << bla;}
-
-
-// new ... calculate main consensus and cache it
-// consensus for strains: moved as "on-demand" calulation to getConsensus()
-
-//#define CEBUG(bla) {cout << bla;}
-void Contig::calcConsensi(int32 mincoverage, base_quality_t minqual, char missingcoveragechar, bool addconstag)
-{
-  FUNCSTART("void Contig::calcConsensi(int32 mincoverage, base_quality_t minqual, char missingcoveragechar)");
-
-  //bool assumediploid=true;
-  bool assumediploid=false;
-  CON_conscalc_assumediploid=assumediploid;
-  bool allowiupac=!(*CON_miraparams)[0].getContigParams().con_force_nonIUPACconsensus;
-  CON_conscalc_allowiupac=allowiupac;
-
-  //CON_cebugflag=true;
-
-  CEBUG("calcConsensi(). mincov: " << mincoverage << "\tminqual: " << static_cast<uint16>(minqual) << "\tmissingcchar: " << missingcoveragechar << endl);
-
-  // loading from different files (backbones reads etc) make the number of strain change over time
-  // i.e., contigs loaded earlier may have a smaller CON_readsperstrain.size() than is good
-  if(CON_readsperstrain.size() < ReadGroupLib::getNumOfStrains()){
-    CON_readsperstrain.resize(ReadGroupLib::getNumOfStrains(),0);
-  }
-
-  CEBUG("Rebuild for " << CON_readsperstrain.size() << " strains in readpool\n");
-
-  if(CON_conscalc_mincov!=mincoverage
-     || CON_conscalc_minqual!=minqual
-     || CON_conscalc_missingchar!=missingcoveragechar
-     || CON_strainconsseq.size()==0
-     || CON_readsperstrain.size() > CON_strainconsseq.size()){    // BaCh 17.09.2013: bugfix ">=" into ">", else always needless recalcs
-
-    CEBUG("need recalc.:\n");
-    CEBUG("old values: " << CON_conscalc_mincov << " " << static_cast<uint16>(CON_conscalc_minqual) << " " << CON_conscalc_missingchar << " " << CON_strainconsseq.size() << " " << CON_readsperstrain.size() << endl);
-    CON_conscalc_mincov=mincoverage;
-    CON_conscalc_minqual=minqual;
-    CON_conscalc_missingchar=missingcoveragechar;
-    CEBUG("new values: " << CON_conscalc_mincov << " " << static_cast<uint16>(CON_conscalc_minqual) << " " << CON_conscalc_missingchar << " " << CON_strainconsseq.size() << " " << CON_readsperstrain.size() << endl);
-
-    // make a consensus for every strain
-    // cache them in CON_allconsseq and *qual
-    makeIntelligentConsensus(CON_allconsseq,
-			     CON_allconsqual,
-			     &CON_alladjustments,
-			     0,
-			     CON_counts.size(),
-			     -1,                   // strainid
-			     CON_conscalc_mincov,
-			     CON_conscalc_minqual,
-			     missingcoveragechar,
-			     assumediploid,
-			     allowiupac,
-			     addconstag);
-
-    CEBUG("CON_readsperstrain.size(): " << CON_readsperstrain.size() << endl);
-
-    CON_strainconsseq.clear();
-    CON_strainconsqual.clear();
-    CON_strainadjustments.clear();
-    CON_strainconsseq.resize(CON_readsperstrain.size());
-    CON_strainconsqual.resize(CON_readsperstrain.size());
-    CON_strainadjustments.resize(CON_readsperstrain.size());
-
-    uint32 numstrains=0;
-    for(uint32 si=0; si<CON_readsperstrain.size(); ++si){
-      if(CON_readsperstrain[si]>0) ++numstrains;
-    }
-
-    // now for all strains.
-    // strains not present in contig will have sequence, quality and adjustments
-    //  pre-filled with default values (@, 0 and -1)
-    // strains present will have empty seq+qual+adj ... to be calculated on demand
-
-    // Change: no precalculated strains, only pre-filled for clear cases!
-    // Should getConsensus() ask for them later, they
-    //  will be calculated on demand (using CON_conscalc_* values)
-    for(uint32 si=0; si<CON_readsperstrain.size(); ++si){
-      if(CON_readsperstrain[si]==0) {
-	CON_strainconsseq[si].resize(CON_allconsseq.size(),missingcoveragechar);
-	CON_strainconsqual[si].resize(CON_allconsqual.size(),0);
-	CON_strainadjustments[si].resize(CON_allconsqual.size(),-1);
-      }else{
-	if(numstrains==1 && mincoverage==0 && minqual==0){
-	  // take over from allstrains in this very special case
-	  CON_strainconsseq[si]=CON_allconsseq;
-	  CON_strainconsqual[si]=CON_allconsqual;
-	  CON_strainadjustments[si]=CON_alladjustments;
-	}
-      }
-    }
-  }else{
-  }
-
-  FUNCEND();
-
-  return;
-}
-//#define CEBUG(bla)
-
-
-// makes sure consensus and all adjoining structures are calculated and valid
-// works like newConsensusGet() below, but does not return the consensus nor qualities
-//
-// trick: calling newConsensusGet() with the src==target will make sure things are not
-//  unnecessarily copied
-void Contig::ensureConsensus(int32 strainidtotake)
-{
-  FUNCSTART("void Contig::ensureConsensus(int32 strainidtotake)");
-
-  CEBUG("ensureConsensus(): " << strainidtotake << endl);
-  if(CON_allconsseq.empty() || CON_strainconsseq.empty()){
-    CEBUG("ensureConsensus(): cons empty, need recalc" << endl);
-    calcConsensi();
-  }
-  if(strainidtotake<0){
-    newConsensusGet(CON_allconsseq, CON_allconsqual, strainidtotake);
-  }else{
-    newConsensusGet(CON_strainconsseq[strainidtotake], CON_strainconsqual[strainidtotake], strainidtotake);
-  }
-  FUNCEND();
-}
-
-void Contig::newConsensusGet(string & target, vector<base_quality_t> & qual, int32 strainidtotake)
-{
-  FUNCSTART("void Contig::newConsensusGet(string & target, vector<base_quality_t> & qual, int32 strainidtotake)");
-
-//  if(CON_abortflag) {
-//    uint16 * bombme=nullptr;
-//    *bombme=0xdead;
-//    cout << bombme;
-//  }
-
-  CEBUG("newConsensusGet(): gimme strain " << strainidtotake << endl);
-
-  // loading from different files (backbones reads etc) make the number of strain change over time
-  // i.e., contigs loaded earlier may have a smaller CON_readsperstrain.size() than is good
-  if(CON_readsperstrain.size() < ReadGroupLib::getNumOfStrains()){
-    CON_readsperstrain.resize(ReadGroupLib::getNumOfStrains(),0);
-  }
-
-  BUGIFTHROW(strainidtotake>=static_cast<int32>(CON_readsperstrain.size()),"strainidtotake>=CON_readsperstrain.size() ?");
-
-  if(CON_fixedconsseq.size() && CON_fixedconsqual.size() && strainidtotake<0){
-    CEBUG("newConsensusGet(): get fixed" << endl);
-    target=CON_fixedconsseq;
-    qual=CON_fixedconsqual;
-  }else{
-    CEBUG("CON_allconsseq.size(): " << CON_allconsseq.size() << endl);
-    CEBUG("CON_strainconsseq.size(): " << CON_strainconsseq.size() << endl);
-    if(CON_allconsseq.empty() || CON_strainconsseq.empty()
-       || (strainidtotake>=0 && strainidtotake>=CON_strainconsseq.size())){
-      CEBUG("something's empty, need recalc" << endl);
-      calcConsensi();
-    }
-    if(strainidtotake<0){
-      CEBUG("newConsensusGet(): get allcons" << endl);
-      CEBUG("CON_allconsseq.size(): " << CON_allconsseq.size() << endl);
-      CEBUG("CON_allconsqual.size(): " << CON_allconsqual.size() << endl);
-      target=CON_allconsseq;
-      qual=CON_allconsqual;
-    }else{
-      CEBUG("newConsensusGet(): get strain " << strainidtotake << endl);
-      BUGIFTHROW(strainidtotake>=CON_strainconsseq.size(),"something's utterly wrong: strainidtotake>=CON_strainconsseq.size() ???");
-      // on demand calculation
-      if(CON_strainconsseq[strainidtotake].empty()){
-	CEBUG("check on demand calculation\n");
-	uint32 numstrains=0;
-	for(uint32 si=0; si<CON_readsperstrain.size(); si++){
-	  if(CON_readsperstrain[si]>0) numstrains++;
-	}
-	if(numstrains==1){
-	  CEBUG("only 1 strain, can take main consensus\n");
-	  CON_strainconsseq[strainidtotake]=CON_allconsseq;
-	  CON_strainconsqual[strainidtotake]=CON_allconsqual;
-	  CON_strainadjustments[strainidtotake]=CON_alladjustments;
-	}else{
-	  CEBUG("must do calculation\n");
-	  makeIntelligentConsensus(CON_strainconsseq[strainidtotake],
-				   CON_strainconsqual[strainidtotake],
-				   &CON_strainadjustments[strainidtotake],
-				   0,
-				   CON_counts.size(),
-				   strainidtotake,
-				   CON_conscalc_mincov,
-				   CON_conscalc_minqual,
-				   CON_conscalc_missingchar,
-				   CON_conscalc_assumediploid,
-				   CON_conscalc_allowiupac);
-	}
-      }else{
-	CEBUG("take cached\n");
-      }
-      target=CON_strainconsseq[strainidtotake];
-      qual=CON_strainconsqual[strainidtotake];
-    }
-  }
-
-  BUGIFTHROW(target.size() != CON_counts.size(),"strainidtotake " << strainidtotake << ": target.size() " << target.size() << " != CON_counts.size() " << CON_counts.size());
-
-  FUNCEND();
-}
-//#define CEBUG(bla)
-
-
-//void Contig::OLDgetConsensus1(string & target, vector<base_quality_t> & qual, bool markspecials, int32 mincoverage, base_quality_t minqual, int32 strainidtotake, char missingcoveragechar, ostream * ostr, bool contagsintcs)
-//{
-//  FUNCSTART("void Contig::getConsensus(string & target, vector<base_quality_t> & qual, bool markspecials, int32 mincoverage, int32 strainidtotake, ostream * ostr, bool contagsintcs)");
-//
-//  CEBUG("getCons()\n");
-//
-//  CON_cebugflag=true;
-//
-//  if(CON_cheat_intelcons.empty()
-//     || CON_cheat_intelcons_markspecials!=markspecials
-//     || CON_cheat_intelcons_mincov!=mincoverage
-//     || CON_cheat_intelcons_minqual!=minqual
-//     || CON_cheat_intelcons_strainidtotake!=strainidtotake
-//     || ostr != nullptr) {
-//    bool mustcompute=true;
-//    if(!CON_cheat_intelcons.empty()
-//       && CON_cheat_intelcons_mincov==mincoverage
-//       && CON_cheat_intelcons_minqual==minqual
-//       && CON_cheat_intelcons_strainidtotake == strainidtotake) {
-//      if(markspecials) {
-//	if(CON_cheat_intelcons_markspecials) {
-//	  mustcompute=false;
-//	}
-//      } else {
-//	mustcompute=false;
-//	if(CON_cheat_intelcons_markspecials) {
-//	  // just make the sequence make uppercase
-//	  for(uint32 i=0; i<CON_cheat_intelcons.size(); i++) {
-//	    CON_cheat_intelcons[i]=toupper(CON_cheat_intelcons[i]);
-//	  }
-//	}
-//      }
-//    }
-//    if(mustcompute || ostr != nullptr) {
-//      makeIntelligentConsensus(CON_cheat_intelcons,
-//			       CON_cheat_intelconsqual,
-//			       0,
-//			       CON_counts.size(),
-//			       markspecials,
-//			       mincoverage,
-//			       minqual,
-//			       strainidtotake,
-//			       missingcoveragechar,
-//			       ostr,
-//			       contagsintcs);
-//    }
-//    CON_cheat_intelcons_markspecials=markspecials;
-//    CON_cheat_intelcons_mincov=mincoverage;
-//    CON_cheat_intelcons_minqual=minqual;
-//    CON_cheat_intelcons_strainidtotake=strainidtotake;
-//  }
-//
-//  target=CON_cheat_intelcons;
-//  qual=CON_cheat_intelconsqual;
-//
-//  FUNCEND();
-//
-//  return;
-//}
-
-
-
-
-
-
-/*************************************************************************
- *
- * if the routines to decide for a base (helper2 routines) could not get
- *  clear base but the user wants one, this is doing a shootout based on
- *  majority vote.
- *
- * groups with forward and reverse count double in the read count
- *
- * if majority vote still does not work (all the same), then the last
- *  one wins. I.e., * takes precedence over T, this over G, over C, over A
- *
- *************************************************************************/
-
-// MIC all CEBUG start
-//#define CEBUG(bla) {cout << bla;}
-
-void Contig::makeIntelligentConsensus_helper3(char & thisbase, base_quality_t & thisqual, const vector<nngroups_t> & groups, const vector<char> & IUPACbasegroups)
-{
-  uint32 maxcount=0;
-
-  for(uint32 actgroup=0; actgroup<groups.size(); actgroup++){
-    for(uint32 actbase=0; actbase<IUPACbasegroups.size(); actbase++){
-      if(IUPACbasegroups[actbase]==groups[actgroup].base){
-	uint32 groupcount=groups[actgroup].urdids.size();
-	if(groups[actgroup].forwarddircounter>0
-	   && groups[actgroup].complementdircounter>0){
-	  groupcount*=2;
-	}
-	if(groupcount>=maxcount){
-	  maxcount=groupcount;
-	  thisbase=groups[actgroup].base;
-	  thisqual=groups[actgroup].groupquality;
-	}
-      }
-    }
-  }
-
-}
-
-
-/*************************************************************************
- *
- * Return by value:
- *  num valid groups
- * Return by variable:
- *  thisbase/qual: chosen base/gap (one of ACGT*) and its qual if single choice were to be made
- *  iupacbasegroups: contains all bases (any combination of ACGT*) which could be valid
- *
- *************************************************************************/
-
-//#define CEBUG(bla) {cout << bla;}
-void Contig::makeIntelligentConsensus_helper2_calcSOLEXA(char & thisbase, base_quality_t & thisqual, const uint32 actcontigpos, cccontainer_t::const_iterator ccI, const vector<nngroups_t> & groups, vector<char> & IUPACbasegroups, const bbstrainmask_t strainmask)
-{
-  FUNCSTART("uint8 Contig::makeIntelligentConsensus_helper2_calcSOLEXA(char & thisbase, base_quality_t & thisqual, const uint32 actcontigpos, cccontainer_t::const_iterator ccI, const vector<nngroups_t> & groups, vector<char> & IUPACbasegroups, const bbstrainmask_t strainmask)");
-
-  thisbase=' ';
-  thisqual=0;
-  IUPACbasegroups.clear();
-
-  bool hasmergedbases=false;
-  if(CON_isbackbonecontig){
-    // Ok, check whether the merged bases belong to this strain
-    //  if not, well then no merged bases exist
-    hasmergedbases=(ccI->getOriginalBBChar()!='@') & (ccI->bbcounts[0]>0);
-    if(!(ccI->bbstrains[0] & strainmask)) hasmergedbases=false;
-  }
-
-  CEBUG("bbchar: " << ccI->getOriginalBBChar() << "\tbbcounts: " << ccI->bbcounts[0] << "\tbbbestquals: " << static_cast<uint16>(ccI->bbbestquals[0]) << "\tbbstrains: " << hex << static_cast<uint16>(ccI->bbstrains[0]) << dec << "\tHasmergedb: " << hasmergedbases <<'\n');
-  CEBUG("Strainmask: " << static_cast<uint64>(strainmask) << '\n');
-
-  bool groupschosen[groups.size()];  // init in for loop below
-  uint32 groupcounts[groups.size()]; // init in for loop below
-  uint32 maxcount=0;
-
-  for(uint32 actgroup=0; actgroup<groups.size(); ++actgroup){
-    uint32 groupcount=groups[actgroup].urdids.size();
-    if(hasmergedbases && ccI->getOriginalBBChar() == groups[actgroup].base) groupcount+=ccI->bbcounts[0];
-    if(groups[actgroup].forwarddircounter>=1
-       && groups[actgroup].complementdircounter>=1){
-      if(groups[actgroup].forwarddircounter>=2
-	 && groups[actgroup].complementdircounter>=2){
-	groupcount*=2;
-      }else{
-	groupcount*=3;
-	groupcount/=2;
-      }
-    }
-    if(groupcount>=maxcount){
-      maxcount=groupcount;
-    }
-    groupcounts[actgroup]=groupcount;
-    groupschosen[actgroup]=false;
-  }
-
-  CEBUG("GROUPCOUNTS: ");
-  for(uint32 i=0;i<5;++i){
-    CEBUG(groupcounts[i] << " ");
-  }
-  CEBUG(endl);
-
-  for(uint32 actgroup=0; actgroup<groups.size(); ++actgroup){
-    if(groupcounts[actgroup]>=maxcount/2
-       || (groups[actgroup].forwarddircounter>=2
-	   && groups[actgroup].complementdircounter>=2)){
-      IUPACbasegroups.push_back(groups[actgroup].base);
-      groupschosen[actgroup]=true;
-    }
-  }
-
-  CEBUG("GROUPSCHOSEN: ");
-  for(uint32 i=0;i<5;++i){
-    CEBUG(groupschosen[i] << " ");
-  }
-  CEBUG(endl);
-
-  BUGIFTHROW(IUPACbasegroups.size()==0,"acp: " << actcontigpos << ": num groups ==0 ???");
-
-  for(uint32 actgroup=0; actgroup<groups.size(); ++actgroup){
-    if(groupcounts[actgroup]==maxcount){
-      thisbase=groups[actgroup].base;
-      thisqual=groups[actgroup].groupquality;
-      break;
-    }
-  }
-
-  BUGIFTHROW(IUPACbasegroups.size()==0,"IUPACbasegroups.size()==0");
-
-  if(IUPACbasegroups.size()==1){
-    // need to do something?
-  }else{
-    uint32 tqual=0;
-    CEBUG("singleding\n");
-    for(uint32 actgroup=0; actgroup<groups.size(); ++actgroup){
-      CEBUG("Newgroup\n" << groups[actgroup]);
-      if(groupschosen[actgroup]==true){
-	CEBUG("CHOSEN!\n\n");
-	tqual+=groups[actgroup].groupquality;
-      }
-    }
-    tqual/=IUPACbasegroups.size();
-    if(tqual>90) tqual=90;
-  }
-
-  FUNCEND();
-  return;
-}
-//#define CEBUG(bla)
-
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-void Contig::makeIntelligentConsensus_helper2_calcPACBIOHQ(char & thisbase, base_quality_t & thisqual, const uint32 actcontigpos, const vector<nngroups_t> & groups, vector<char> & IUPACbasegroups)
-{
-
-  // no info. atm, same as 454 without 40:60 rule
-
-  // Idea: pure coverage, maximum wins.
-  //       if two or more with same maximum:
-  //          IUPAC (star goes under, sorry) or
-  //          if non-IUPAC is wished, take the last
-  // TODO: is there a better way?
-  // TODO: write PacBioLQ/HQ routine
-
-  IUPACbasegroups.clear();
-
-  int32 maxsize=0;
-  int32 maxsize_i=-1;
-  base_quality_t maxqual=0;
-  int32 runnerup=0;
-  int32 runnerup_i=-1;
-  base_quality_t runnerupqual=0;
-
-  size_t totalsize=0;
-
-  for(uint32 i=0; i<groups.size(); i++){
-    totalsize+=groups[i].urdids.size();
-    if(static_cast<int32>(groups[i].urdids.size())>=maxsize){
-      runnerup=maxsize;
-      runnerup_i=maxsize_i;
-      runnerupqual=maxqual;
-      maxsize=static_cast<int32>(groups[i].urdids.size());
-      maxsize_i=i;
-      maxqual=groups[i].groupquality;
-    }else if(static_cast<int32>(groups[i].urdids.size())>=runnerup){
-      runnerup=static_cast<int32>(groups[i].urdids.size());
-      runnerup_i=i;
-      runnerupqual=groups[i].groupquality;
-    }
-  }
-
-  int32 avgqual=0;
-  for(uint32 i=0; i<groups.size(); i++){
-    if(maxsize==static_cast<int32>(groups[i].urdids.size())){
-      IUPACbasegroups.push_back(groups[i].base);
-      avgqual+=groups[i].groupquality;
-    }
-  }
-
-  if(totalsize==0 || IUPACbasegroups.empty()){
-    /// Oooops? just an N???
-    thisbase='N';
-    thisqual=0;
-    return;
-  }
-
-  if(IUPACbasegroups.size()==1) {
-    thisbase=IUPACbasegroups[0];
-    // reduce quality if there are doubts
-    if(runnerup>0 && maxsize-runnerup < 10){
-      avgqual-=runnerupqual;
-      if(avgqual<0) avgqual=max(abs(avgqual),10);
-    }
-    thisqual=static_cast<base_quality_t>(avgqual);
-  }else{
-    if((*CON_miraparams)[ReadGroupLib::SEQTYPE_PACBIOHQ].getContigParams().con_force_nonIUPACconsensus_perseqtype) {
-      thisbase=IUPACbasegroups[IUPACbasegroups.size()-1];
-      thisqual=static_cast<base_quality_t>(avgqual/IUPACbasegroups.size());
-    }else{
-      thisbase=dptools::calcIUPACConsensus(IUPACbasegroups);
-      thisqual=static_cast<base_quality_t>(avgqual/IUPACbasegroups.size());
-    }
-  }
-
-  return;
-}
-
-
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-void Contig::makeIntelligentConsensus_helper2_calc454GS20(char & thisbase, base_quality_t & thisqual, const uint32 actcontigpos, const vector<nngroups_t> & groups, vector<char> & IUPACbasegroups)
-{
-  // Idea: pure coverage, maximum wins.
-  //       if two or more with same maximum:
-  //          IUPAC (star goes under, sorry) or
-  //          if non-IUPAC is wished, take the last
-  // TODO: is there a better way?
-
-  IUPACbasegroups.clear();
-
-  int32 maxsize=0;
-  int32 maxsize_i=-1;
-  base_quality_t maxqual=0;
-  int32 runnerup=0;
-  int32 runnerup_i=-1;
-  base_quality_t runnerupqual=0;
-
-  size_t totalsize=0;
-
-  for(uint32 i=0; i<groups.size(); i++){
-    totalsize+=groups[i].urdids.size();
-    if(static_cast<int32>(groups[i].urdids.size())>=maxsize){
-      runnerup=maxsize;
-      runnerup_i=maxsize_i;
-      runnerupqual=maxqual;
-      maxsize=static_cast<int32>(groups[i].urdids.size());
-      maxsize_i=i;
-      maxqual=groups[i].groupquality;
-    }else if(static_cast<int32>(groups[i].urdids.size())>=runnerup){
-      runnerup=static_cast<int32>(groups[i].urdids.size());
-      runnerup_i=i;
-      runnerupqual=groups[i].groupquality;
-    }
-  }
-
-  // if max count is gap, but there are other bases
-  if(maxsize_i==4 && runnerup>0){
-    // apply 40:60 rule
-    if(100*runnerup/(maxsize+runnerup) >= 40){
-      swap(maxsize,runnerup);
-      swap(maxsize_i,runnerup_i);
-      swap(maxqual,runnerupqual);
-    }
-  }
-
-  int32 avgqual=0;
-  for(uint32 i=0; i<groups.size(); i++){
-    if(maxsize==static_cast<int32>(groups[i].urdids.size())){
-      IUPACbasegroups.push_back(groups[i].base);
-      avgqual+=groups[i].groupquality;
-    }
-  }
-
-  if(totalsize==0 || IUPACbasegroups.empty()){
-    /// Oooops? just an N???
-    thisbase='N';
-    thisqual=0;
-    return;
-  }
-
-  if(IUPACbasegroups.size()==1) {
-    thisbase=IUPACbasegroups[0];
-    // reduce quality if there are doubts
-    if(runnerup>0 && maxsize-runnerup < 10){
-      avgqual-=runnerupqual;
-      if(avgqual<0) avgqual=max(abs(avgqual),10);
-    }
-    thisqual=static_cast<base_quality_t>(avgqual);
-  }else{
-    if((*CON_miraparams)[ReadGroupLib::SEQTYPE_454GS20].getContigParams().con_force_nonIUPACconsensus_perseqtype) {
-      thisbase=IUPACbasegroups[IUPACbasegroups.size()-1];
-      thisqual=static_cast<base_quality_t>(avgqual/IUPACbasegroups.size());
-    }else{
-      thisbase=dptools::calcIUPACConsensus(IUPACbasegroups);
-      thisqual=static_cast<base_quality_t>(avgqual/IUPACbasegroups.size());
-    }
-  }
-
-  //// TODO: testing
-  //if(maxsize_i>=0 && runnerup_i>=0){
-  //  if(maxsize+runnerup == 0){
-  //    //addTagToConsensus(actcontigpos, actcontigpos,'=',"P454","DOH?");
-  //  }else if(100*runnerup/(maxsize+runnerup) >= 30){
-  //    //ostringstream ostr;
-  //    //ostr << static_cast<char>(groups[maxsize_i].base) << ": " << maxsize;
-  //    //ostr << " " << static_cast<char>(groups[runnerup_i].base) << ": " << runnerup;
-  //    //ostr << "  -  " << 100*runnerup/(maxsize+runnerup) << "%";
-  //    //
-  //    //addTagToConsensus(actcontigpos, actcontigpos,'=',"P454",ostr.str().c_str());
-  //  }
-  //}
-
-  return;
-}
-
-
-
-/*************************************************************************
- *
- * atm a pure copy of 454
- *
- *
- *************************************************************************/
-
-void Contig::makeIntelligentConsensus_helper2_calcIonTorrent(char & thisbase, base_quality_t & thisqual, const uint32 actcontigpos, const vector<nngroups_t> & groups, vector<char> & IUPACbasegroups)
-{
-  // Idea: pure coverage, maximum wins.
-  //       if two or more with same maximum:
-  //          IUPAC (star goes under, sorry) or
-  //          if non-IUPAC is wished, take the last
-  // TODO: is there a better way?
-
-  IUPACbasegroups.clear();
-
-  int32 maxsize=0;
-  int32 maxsize_i=-1;
-  base_quality_t maxqual=0;
-  int32 runnerup=0;
-  int32 runnerup_i=-1;
-  base_quality_t runnerupqual=0;
-
-  size_t totalsize=0;
-
-  for(uint32 i=0; i<groups.size(); i++){
-    totalsize+=groups[i].urdids.size();
-    if(static_cast<int32>(groups[i].urdids.size())>=maxsize){
-      runnerup=maxsize;
-      runnerup_i=maxsize_i;
-      runnerupqual=maxqual;
-      maxsize=static_cast<int32>(groups[i].urdids.size());
-      maxsize_i=i;
-      maxqual=groups[i].groupquality;
-    }else if(static_cast<int32>(groups[i].urdids.size())>=runnerup){
-      runnerup=static_cast<int32>(groups[i].urdids.size());
-      runnerup_i=i;
-      runnerupqual=groups[i].groupquality;
-    }
-  }
-
-  // if max count is gap, but there are other bases
-  // Test, maybe IonTorrent is a bit different.
-  // Actually, it's almost the best rule there is ...
-  //  35 perhaps better, but needs to be verified.
-  // Astonishing
-  if(maxsize_i==4 && runnerup>0){
-    // apply 40:60 rule
-    if(100*runnerup/(maxsize+runnerup) >= 40){
-      swap(maxsize,runnerup);
-      swap(maxsize_i,runnerup_i);
-      swap(maxqual,runnerupqual);
-    }
-  }
-
-  int32 avgqual=0;
-  for(uint32 i=0; i<groups.size(); i++){
-    if(maxsize==static_cast<int32>(groups[i].urdids.size())){
-      IUPACbasegroups.push_back(groups[i].base);
-      avgqual+=groups[i].groupquality;
-    }
-  }
-
-  if(totalsize==0 || IUPACbasegroups.empty()){
-    /// Oooops? just an N???
-    thisbase='N';
-    thisqual=0;
-    return;
-  }
-
-  if(IUPACbasegroups.size()==1) {
-    thisbase=IUPACbasegroups[0];
-    // reduce quality if there are doubts
-    if(runnerup>0 && maxsize-runnerup < 10){
-      avgqual-=runnerupqual;
-      if(avgqual<0) avgqual=max(abs(avgqual),10);
-    }
-    thisqual=static_cast<base_quality_t>(avgqual);
-  }else{
-    if((*CON_miraparams)[ReadGroupLib::SEQTYPE_IONTORRENT].getContigParams().con_force_nonIUPACconsensus_perseqtype) {
-      thisbase=IUPACbasegroups[IUPACbasegroups.size()-1];
-      thisqual=static_cast<base_quality_t>(avgqual/IUPACbasegroups.size());
-    }else{
-      thisbase=dptools::calcIUPACConsensus(IUPACbasegroups);
-      thisqual=static_cast<base_quality_t>(avgqual/IUPACbasegroups.size());
-    }
-  }
-
-  //// TODO: testing
-  //if(maxsize_i>=0 && runnerup_i>=0){
-  //  if(maxsize+runnerup == 0){
-  //    //addTagToConsensus(actcontigpos, actcontigpos,'=',"P454","DOH?");
-  //  }else if(100*runnerup/(maxsize+runnerup) >= 30){
-  //    //ostringstream ostr;
-  //    //ostr << static_cast<char>(groups[maxsize_i].base) << ": " << maxsize;
-  //    //ostr << " " << static_cast<char>(groups[runnerup_i].base) << ": " << runnerup;
-  //    //ostr << "  -  " << 100*runnerup/(maxsize+runnerup) << "%";
-  //    //
-  //    //addTagToConsensus(actcontigpos, actcontigpos,'=',"P454",ostr.str().c_str());
-  //  }
-  //}
-
-  return;
-}
-
-
-
-
-/*************************************************************************
- *
- * adapted copy of new solexa routine
- *
- *************************************************************************/
-
-void Contig::makeIntelligentConsensus_helper2_calcText(char & thisbase, base_quality_t & thisqual, const uint32 actcontigpos, const vector<nngroups_t> & groups, vector<char> & IUPACbasegroups)
-{
-  FUNCSTART("void Contig::makeIntelligentConsensus_helper2_calcText(char & thisbase, base_quality_t & thisqual, const uint32 actcontigpos, const vector<nngroups_t> & groups, vector<char> & IUPACbasegroups)");
-
-  // Idea: pure coverage. Every group >= maximum_cov/2  is considered.
-
-  thisbase=' ';
-  thisqual=0;
-  IUPACbasegroups.clear();
-
-  bool groupschosen[groups.size()];  // init in for loop below
-  uint32 groupcounts[groups.size()]; // init in for loop below
-  uint32 maxcount=0;
-
-  for(uint32 actgroup=0; actgroup<groups.size(); ++actgroup){
-    uint32 groupcount=groups[actgroup].urdids.size();
-    if(groupcount>=maxcount){
-      maxcount=groupcount;
-    }
-    groupcounts[actgroup]=groupcount;
-    groupschosen[actgroup]=false;
-  }
-
-  CEBUG("GROUPCOUNTS: ");
-  for(uint32 i=0;i<5;++i){
-    CEBUG(groupcounts[i] << " ");
-  }
-  CEBUG(endl);
-
-  for(uint32 actgroup=0; actgroup<groups.size(); ++actgroup){
-    if(groupcounts[actgroup]>=maxcount/2){
-      IUPACbasegroups.push_back(groups[actgroup].base);
-      groupschosen[actgroup]=true;
-    }
-  }
-
-  CEBUG("GROUPSCHOSEN: ");
-  for(uint32 i=0;i<5;++i){
-    CEBUG(groupschosen[i] << " ");
-  }
-  CEBUG(endl);
-
-  BUGIFTHROW(IUPACbasegroups.size()==0,"acp: " << actcontigpos << ": num groups ==0 ???");
-
-  for(uint32 actgroup=0; actgroup<groups.size(); ++actgroup){
-    if(groupcounts[actgroup]==maxcount){
-      thisbase=groups[actgroup].base;
-      thisqual=groups[actgroup].groupquality;
-      break;
-    }
-  }
-
-  BUGIFTHROW(IUPACbasegroups.size()==0,"IUPACbasegroups.size()==0");
-
-  if(IUPACbasegroups.size()==1){
-    // need to do something?
-  }else{
-    uint32 tqual=0;
-    CEBUG("singleding\n");
-    for(uint32 actgroup=0; actgroup<groups.size(); ++actgroup){
-      CEBUG("Newgroup\n" << groups[actgroup]);
-      if(groupschosen[actgroup]==true){
-	CEBUG("CHOSEN!\n\n");
-	tqual+=groups[actgroup].groupquality;
-      }
-    }
-    tqual/=IUPACbasegroups.size();
-    if(tqual>90) tqual=90;
-  }
-
-  FUNCEND();
-
-
-  return;
-}
-
-
-
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-void Contig::makeIntelligentConsensus_helper2_calcSangerQual(char & thisbase, base_quality_t & thisqual, const uint32 actcontigpos, const vector<nngroups_t> & groups, vector<char> & IUPACbasegroups, const base_quality_t maxqual, const uint32 maxcount)
-{
-  // Idea: all groups with qual >= 30
-  //    or groups with qual within (X) (with X==5 now) of maxqual
-  //    or groups with count >= 3 and quality >=20 and forward/reverse
-
-  IUPACbasegroups.clear();
-  int32 avgqual=0;
-  int32 groupstaken=0;
-  int32 verygoodgroups=0;
-
-  // New: if force non-IUPAC consensus is wished
-  // decrease the level with which we look at the groups
-  // gradually until we have to find something (qual == 0)
-  base_quality_t goodgroupqual=35;
-  base_quality_t lessergroupqual=goodgroupqual;
-  if(lessergroupqual>=10) lessergroupqual-=10;
-
-  do{
-    if(goodgroupqual>=5) goodgroupqual-=5;
-    if(lessergroupqual>=5) lessergroupqual-=5;
-    for(uint32 i=0; i<groups.size(); i++){
-      if(groups[i].urdids.size()
-	 &&(groups[i].groupquality >= goodgroupqual
-	    || groups[i].groupquality+5 >= maxqual
-	    || (groups[i].urdids.size() >= 3          // TODO: check 2 or 3 (was 3, testing with 2)
-		&& groups[i].groupquality >= lessergroupqual
-		&& groups[i].forwarddircounter>0
-		&& groups[i].complementdircounter>0))) {
-	avgqual+=groups[i].groupquality;
-	IUPACbasegroups.push_back(groups[i].base);
-	groupstaken++;
-
-	if(groups[i].groupquality >= goodgroupqual
-	   && groups[i].forwarddircounter>0
-	   && groups[i].complementdircounter>0) {
-	  verygoodgroups++;
-	}
-      }
-    }
-  } while((*CON_miraparams)[ReadGroupLib::SEQTYPE_SANGER].getContigParams().con_force_nonIUPACconsensus_perseqtype
-	  && groupstaken==0 && goodgroupqual>0);
-
-  CEBUG("groups taken: " << groupstaken << "\t");
-#ifdef CEBUGFLAG
-  {
-    for(uint32 i=0; i< IUPACbasegroups.size(); i++){
-      CEBUG(IUPACbasegroups[i]);
-    }
-  }
-#endif
-  CEBUG(endl);
-  if(groupstaken == 0) {
-    // this can still happen if we do not force a non-IUPAC
-    // or if it's a column entirely made of N (or X) (or both)
-
-    // well, calculate the base from all columnbases
-    thisbase=' ';
-    for(auto & ge : groups){
-      if(ge.urdids.size() && ge.base != '*') thisbase=dptools::calcIUPACConsensus(thisbase,ge.base);
-    }
-
-    avgqual=0;
-    int32 n=0;
-    uint32 totalids=0;
-    for(uint32 i=0; i<groups.size()-1; i++){
-      if(groups[i].urdids.size()) {
-	totalids+=groups[i].urdids.size();
-	avgqual+=groups[i].groupquality;
-	n++;
-      }
-    }
-    // test if there are more stars than other bases
-    if(groups[groups.size()-1].urdids.size() > totalids) {
-      // oh well, more stars than bases, make it a star
-      thisbase='*';
-      thisqual=groups[groups.size()-1].groupquality;
-    } else if(n) {
-      thisqual=avgqual/n;
-    } else {
-      thisqual=0;
-    }
-  } else if(groupstaken == 1) {
-    // only one group taken (perfect)
-    thisbase=IUPACbasegroups.front();
-    int32 bahqual=maxqual;
-    for(uint32 i=0; i<groups.size(); i++){
-      if(groups[i].base!=thisbase) {
-	bahqual-=groups[i].groupquality;
-      }
-    }
-    if(bahqual<0) bahqual=0;
-    thisqual=bahqual;
-  } else {
-    // ouch, more than one group was taken as good
-
-    bool needIUPACconsensus=true;
-
-    CEBUG("cpos: " << actcontigpos << "\tpossible IUPAC\tvgg: " << verygoodgroups << endl);
-    //for(uint32 i=0; i< groups.size(); i++){
-    //  cout << groups[i] << endl;
-    //}
-
-    // First, check whether we have a very good group
-    //  as searched for above
-    if(verygoodgroups==1){
-      // if yes, rebuild IUPACbasegroups with very good groups
-      // then, if only one group remains, perfect. Else it'll be
-      //  a IUPAC
-
-      CEBUG("recheck group: ");
-
-      vector<char> newIUPACbasegroups;
-      int32 newavgqual=0;
-      int32 newgroupstaken=0;
-      for(uint32 i=0; i<groups.size(); i++){
-	if(groups[i].urdids.size()
-	   && (groups[i].groupquality >= goodgroupqual
-	       && groups[i].forwarddircounter>0
-	       && groups[i].complementdircounter>0)){
-	  newavgqual+=groups[i].groupquality;
-	  newIUPACbasegroups.push_back(groups[i].base);
-	  newgroupstaken++;
-	}
-      }
-
-      if(newgroupstaken == 1) {
-	CEBUG("success!");
-	needIUPACconsensus=false;
-
-	IUPACbasegroups=newIUPACbasegroups;
-	avgqual=newavgqual;
-	groupstaken=newgroupstaken;
-
-	// only one group taken (perfect)
-	thisbase=IUPACbasegroups.front();
-	int32 bahqual=maxqual;
-	for(uint32 i=0; i<groups.size(); i++){
-	  if(groups[i].base!=thisbase) {
-	    bahqual-=groups[i].groupquality;
-	  }
-	}
-	if(bahqual<0) bahqual=0;
-	thisqual=bahqual;
-      }
-    }
-    CEBUG(endl);
-
-    if(needIUPACconsensus){
-      if((*CON_miraparams)[ReadGroupLib::SEQTYPE_SANGER].getContigParams().con_force_nonIUPACconsensus_perseqtype){
-	// well, can't get a good decision, but user wants a non-IUPAC
-	// make a majority-vote shootout among the chosen
-	//   groups
-	makeIntelligentConsensus_helper3(thisbase,
-					 thisqual,
-					 groups,
-					 IUPACbasegroups);
-      }else{
-	// we'll have to make
-	//  a IUPAC consensus here. Alas, if a star (*) is part of this group,
-	//  it will 'go under' (the good bases always win). So check if the star
-	//  has max quality.
-	bool isstar=false;
-	if(groups[groups.size()-1].groupquality == maxqual) {
-	  // yep, now check if one of the bases has the same qual
-	  isstar=true;
-	  for(uint32 i=0; i<groups.size()-1; i++){
-	    if(groups[i].groupquality == maxqual) {
-	      // in dubio pro reo: it could be a base
-	      isstar=false;
-	    }
-	  }
-	}
-	CEBUG("isstar: " << isstar << endl);
-	if(isstar) {
-	  thisbase='*';
-	  thisqual=groups[groups.size()-1].groupquality;
-	} else {
-	  // really several different good bases.
-	  thisqual=avgqual/groupstaken;
-	  thisbase=dptools::calcIUPACConsensus(IUPACbasegroups);
-	}
-      }
-    }
-  }
-}
-
-
-
-/*************************************************************************
- *
- * For a given readtype, return thisbase and thisqual as result for this
- *  position in the contig
- * Also return the potential number of solutions (bases), the one which
- *  was chosen plus the ones which were not
- *
- * all other arguments are passovers from the main function (saving STL
- *  setup and memory allocation time)
- *
- * Side effects: manifold. Most notably: all the passovers from the
- *  main function which are not const will be overwritten with values
- *  reflecting the calculation of base and quality of this read type
- *
- * E.g.: the bases that were considered to make the consensus are in
- *  IUPACbasegroups, the base-groups in groups etc.
- *
- *************************************************************************/
-
-//#define CEBUG(bla) {cout << bla;}
-
-void Contig::makeIntelligentConsensus_helper1(char & thisbase, base_quality_t & thisqual, vector<char> & IUPACbasegroups, const uint32 actcontigpos, cccontainer_t::const_iterator ccI, const int32 mincoverage, vector<nngroups_t> & groups, vector<nngroups_t> & maskedshadowgroups, const vector<rpicsocache_t> & read_pcrIs_in_col, vector<int8> & maskshadow, uint8 actreadtype, int32 strainidtotake, const bbstrainmask_t strainmask, char missingcoveragechar)
-{
-  FUNCSTART("void Contig::makeIntelligentConsensus_helper1(char & thisbase, base_quality_t & thisqual, const uint32 actcontigpos, cccontainer_t::const_iterator ccI, const int32 mincoverage, vector<nngroups_t> & groups, vector<nngroups_t> & maskedshadowgroups, vector<char> & IUPACbasegroups, const vector<int32> & read_pcrIs_in_col, vector<int8> & maskshadow, uint8 actreadtype, char missingcoveragechar)");
-
-#if 0
-  if(read_pcrIs_in_col.empty()){
-    thisbase='!';
-    FUNCEND();
-    return;
-  }
-  if(CON_counts[actcontigpos].total_cov < mincoverage){
-    thisbase='N';
-    FUNCEND();
-    return;
-  }
-
-#else
-
-  size_t nummapped=0;
-  if(actreadtype == ReadGroupLib::SEQTYPE_SOLEXA && CON_isbackbonecontig){
-    // Ok, check whether the merged bases belong to this strain
-    //  if not, well then no merged bases exist
-    if(ccI->bbcounts[0]){
-      if(ccI->bbstrains[0] & strainmask){
-	nummapped=ccI->bbcounts[0];
-      }
-    }
-  }
-  if(read_pcrIs_in_col.size()+nummapped == 0
-     || read_pcrIs_in_col.size()+nummapped < mincoverage){
-    thisbase='N';
-    thisqual=0;
-    FUNCEND();
-    return;
-  }
-#endif
-
-  const contig_parameters & con_rt_params = (*CON_miraparams)[actreadtype].getContigParams();
-
-  CEBUG("conpos: " << actcontigpos << "\tnumreads: " << read_pcrIs_in_col.size() << endl);
-
-  /*
-     slowwwwwwwwwwwwwwwwwwwwwww
-
-     on a 170MB CAF file, caf2fasta goes from 1:46 to 1:40 when
-     replacing these two lines with the loop below (from 49s for
-     output down to 43s)
-
-     groups=emptygroups;
-     maskedshadowgroups=emptygroups;
-
-  */
-
-#ifdef CLOCK_STEPS_CONS
-  MIRATimer timerh1total;
-  MIRATimer timeract;
-#endif
-#ifdef CLOCK_STEPS_CONSSUB
-  MIRATimer timersub;
-#endif
-
-  for(auto & ge : groups){
-    ge.groupquality=0;
-    ge.valid=false;
-    ge.forwarddircounter=0;
-    ge.complementdircounter=0;
-    ge.urdids.clear();
-    ge.quals.clear();
-    ge.directions.clear();
-  }
-
-  if(!maskshadow.empty()){
-    for(auto & ge : maskedshadowgroups){
-      ge.groupquality=0;
-      ge.valid=false;
-      ge.forwarddircounter=0;
-      ge.complementdircounter=0;
-      ge.urdids.clear();
-      ge.quals.clear();
-      ge.directions.clear();
-    }
-  }
-
-#ifdef CLOCK_STEPS_CONS
-  CON_us_steps_cons[USCLOCONS_H1_MGROUPS]+=timeract.diffAndReset();
-#endif
-
-  bool xonly=true;
-  bool hasmaskedset=false;
-
-  if(nummapped>0 && ccI->getOriginalBBChar() != 'X') xonly=false;
-
-  uint32 numcerreads=0;
-  uint32 cergroupindex=0;
-
-  // taking these out of the for loop apparently makes it slightly faster
-  char           base;
-  base_quality_t qual;
-  int32 realreadpos;
-  base_quality_t maxqual;
-  uint32 maxcount;
-
-  for(auto & rpice : read_pcrIs_in_col){
-
-    //if(ric.read.isShortReadMapping()) continue;
-
-    // yup, looks like this is better than using "pcrI->" all the time
-    //  it is at least faster
-    // maybe too hard for GCC to optimise across whole function
-
-#ifdef CLOCK_STEPS_CONSSUB
-    timersub.reset();
-#endif
-
-    auto & actread=*(rpice.pcrI);
-
-    // this is not too slow when called hundreds of times per read
-    //     int32 readpos=rpice.pcrI.contigPos2UnclippedReadPos(actcontigpos);
-    // as trial: replicate contigPos2UnclippedReadPos() here, but using
-    //  the cached value of the read start position
-    if (rpice.dir > 0) {
-      realreadpos = actcontigpos - rpice.readstartpos + rpice.leftclip;
-      base=toupper(actread.nocheckGetBaseInSequence(realreadpos));
-      qual=actread.nocheckGetQualityInSequence(realreadpos);
-    } else {
-      int32 readpos = rpice.lenseq - rpice.rightclip + actcontigpos - rpice.readstartpos;
-      base=toupper(actread.nocheckGetBaseInComplementSequence(readpos));
-
-      //realreadpos=actread.calcComplPos(readpos);
-      realreadpos=rpice.lenseq-1-readpos;
-      qual=actread.nocheckGetQualityInSequence(realreadpos);
-
-    }
-
-#ifdef CLOCK_STEPS_CONSSUB
-    CON_us_steps_cons[USCLOCONS_H1_PL_2]+=timersub.diffAndReset();
-#endif
-
-    // this one gives a problem
-    //   if(base != 'X' && base != '*') xonly=false;
-    // when one retrieves the consensus of a single strain in multiple
-    //  strain assemblies: it may well be only a star!
-    // preliminary fix: back to checking of X only
-
-    if(base != 'X') xonly=false;
-
-    CEBUG("\t" << base << "\t" << (uint16) qual << endl);
-
-    if(rpice.iscer){
-      ++numcerreads;
-    }
-
-    // bases near start/end of reads might be dangerous because
-    //  of possible vector leftovers or still bad quality
-    // so, if there is more than one read in this column,
-    // ...
-    // - if within 10 bases of vector clip, max quality = 2*distance to svec
-    // - if not, lower the quality values of the bases that are near ends
-    //   (con_endreadmarkexclusionarea bases) of (eventually clipped) reads
-    // must be regular read (i.e. not backbone, rail or shortreadmapping
-
-    if(likely(!rpice.israil
-	      && !rpice.isbackbone
-	      && !rpice.iscer)){
-      if(likely(read_pcrIs_in_col.size() >1)) {
-	if((actread.getLSClipoff() >0
-	    && realreadpos < actread.getLSClipoff()+10)
-	   || (actread.getRSClipoff() < rpice.lenseq
-	       && realreadpos > actread.getRSClipoff()-10)){
-	  CEBUG(actread.getName()<< ": near seq vec in read, lowering the quality.\n");
-	  int32 distance;
-	  if(realreadpos < actread.getLSClipoff()+10){
-	    distance=realreadpos-actread.getLSClipoff();
-	  }else{
-	    distance=actread.getRSClipoff()-realreadpos;
-	  }
-	  if(qual > distance*2){
-	    qual=distance*2;
-	  }
-	} else if(realreadpos <= rpice.leftclip+con_rt_params.con_endreadmarkexclusionarea
-		  || realreadpos >= rpice.rightclip-con_rt_params.con_endreadmarkexclusionarea) {
-	  CEBUG(actread.getName()<< ": near end of read, lowering the quality.\n");
-
-#if CPP_READ_SEQTYPE_END != 8
-#error "This code is made for 8 sequencing types, adapt!"
-#endif
-
-	  if(rpice.seqtype==ReadGroupLib::SEQTYPE_SOLEXA){
-	    // decrease by one
-	    if(likely(qual)) --qual;
-	  }else{
-	    // all other atm
-	    if(qual>=10) {
-	      qual-=10;
-	    } else {
-	      qual=5;
-	    }
-	    if(unlikely(qual<5)) qual=5;
-	  }
-	}
-      }
-    }
-
-#ifdef CLOCK_STEPS_CONSSUB
-    CON_us_steps_cons[USCLOCONS_H1_PL_3]+=timersub.diffAndReset();
-#endif
-
-
-    // No railreads at all, have been taken out earlier!
-    //// Quality of bases from railreads are set to 0 so as not
-    ////  to be counted twice (as bases are the same as in backbone)
-    //if(rpice.israil) qual=0;
-
-
-
-    bool maskedset=false;
-
-
-    // TODO: rework the if(...hasTag(Read::REA_tagFpas,realreadpos))
-    //  to check for all mask taks in a masktagstring vector
-
-//    if(maskshadow[actcontigpos]) {
-//      // remember that the readpos computing routine doesn't take care
-//      //  of direction, so we have to complement that position in reverse cases
-//      int32 realreadpos=readpos;
-//      if(rpice.dir<0){
-//	realreadpos=actread.calcComplPos(readpos);
-//      }
-//
-//      CEBUG("MASKED: " << actcontigpos << "\t");
-//      CEBUG(actread.getName() << "\t" << realreadpos << "\t");
-//      if(actread.hasTag(Read::REA_tagFpas,realreadpos)) {
-//	CEBUG("in" << endl);
-//	for(uint32 bindex=0; bindex<maskedshadowgroups.size(); bindex++) {
-//	  if(maskedshadowgroups[bindex].base==base) {
-//	    maskedshadowgroups[bindex].urdids.push_back(actreadid);
-//	    maskedshadowgroups[bindex].quals.push_back(qual);
-//	    maskedshadowgroups[bindex].directions.push_back(rpice.dir);
-//	    if(rpice.dir>0){
-//	      maskedshadowgroups[bindex].hasforwarddir=true;
-//	    }else{
-//	      maskedshadowgroups[bindex].hascomplementdir=true;
-//	    }
-//	    // special case: treat short read mapping as both forward and reverse
-//	    if(rpice.iscer){
-//	      maskedshadowgroups[bindex].hasforwarddir=true;
-//	      maskedshadowgroups[bindex].hascomplementdir=true;
-//	    }
-//	    maskedset=true;
-//	    hasmaskedset=true;
-//	    break;
-//	  }
-//	}
-//      }
-//    }
-
-
-    if(likely(maskedset==false)) {
-      CEBUG("out" << endl);
-      //for(uint32 bindex=0; bindex<groups.size(); bindex++) {
-      uint32 tmpgi=0;
-      for(auto & groupe : groups){
-	if(groupe.base==base) {
-	  groupe.urdids.push_back(rpice.urdid);
-	  groupe.quals.push_back(qual);
-	  groupe.directions.push_back(rpice.dir);
-	  if(rpice.dir>0){
-	    groupe.forwarddircounter++;
-	  }else{
-	    groupe.complementdircounter++;
-	  }
-
-	  // special case: treat short read mapping as both forward and reverse
-	  if(rpice.iscer){
-	    // we already counted forward
-	    //groupe.forwarddircounter++;
-	    groupe.complementdircounter++;
-	    cergroupindex=tmpgi;
-	  }
-	  break;
-	}
-	++tmpgi;
-      }
-
-#ifdef CLOCK_STEPS_CONSSUB
-      CON_us_steps_cons[USCLOCONS_H1_PL_4]+=timersub.diff();
-#endif
-    }
-  }
-
-  // basically, the loop above counted bases for CER reads twice: fwd and reverse
-  // now correct the counters to reflect true coverage
-  // if number of CER reads is uneven, forward direction gets one more than complement direction
-  if(numcerreads>0){
-    groups[cergroupindex].complementdircounter-=numcerreads/2;
-    groups[cergroupindex].forwarddircounter-=numcerreads-numcerreads/2;
-  }
-
-#ifdef CLOCK_STEPS_CONS
-  CON_us_steps_cons[USCLOCONS_H1_countPCRI]+=read_pcrIs_in_col.size();
-  CON_us_steps_cons[USCLOCONS_H1_PCRI]+=timeract.diffAndReset();
-#endif
-
-  if(hasmaskedset){
-    // check whether there is anything in groups
-    //  and maskedshadowgroups selected
-    // if groups empty and masked not, copy masked to groups
-    bool groupsempty=true;
-    bool maskedempty=true;
-    for(uint32 bindex=0; bindex<groups.size(); ++bindex) {
-      if( groups[bindex].urdids.size()) groupsempty=false;
-      if( maskedshadowgroups[bindex].urdids.size()) maskedempty=false;
-    }
-    if(groupsempty && maskedempty==false) {
-      CEBUG("EMPTY: " << actcontigpos << endl);
-      groups=maskedshadowgroups;
-    }
-#ifdef CLOCK_STEPS_CONS
-    CON_us_steps_cons[USCLOCONS_H1_EGROUP]+=timeract.diffAndReset();
-#endif
-  }
-
-  if(xonly) {
-    thisbase='X';
-  } else {
-    maxqual=0;
-    maxcount=0;
-    for (auto & groupe : groups){
-      calcGroupQual(groupe);
-      if(groupe.groupquality>maxqual){
-	maxqual=groupe.groupquality;
-      }
-      if(groupe.urdids.size()>maxcount){
-	maxcount=groupe.urdids.size();
-      }
-      //if(actcontigpos>830 && actcontigpos <920) {
-      CEBUG(actcontigpos << "\tb: " << groupe.base << "\tgq: " << (uint16) groupe.groupquality << "\ts: " << groupe.urdids.size() << endl);
-      //}
-    }
-
-#ifdef CLOCK_STEPS_CONS
-    CON_us_steps_cons[USCLOCONS_H1_GQUAL]+=timeract.diffAndReset();
-#endif
-
-    //if(actcontigpos>830 && actcontigpos <920) {
-    CEBUG(actcontigpos << "maxqual: " << (uint16) maxqual << "\t" << "maxcount: " << maxcount << endl);
-    //}
-
-#if CPP_READ_SEQTYPE_END != 8
-#error "This code is made for 8 sequencing types, adapt!"
-#endif
-
-    // replacing switch() with if-else cascade showed no improvement
-    switch(actreadtype) {
-    case ReadGroupLib::SEQTYPE_SANGER : {
-      makeIntelligentConsensus_helper2_calcSangerQual(thisbase,
-						      thisqual,
-						      actcontigpos,
-						      groups,
-						      IUPACbasegroups,
-						      maxqual,
-						      maxcount);
-      break;
-    }
-    case ReadGroupLib::SEQTYPE_454GS20 : {
-      makeIntelligentConsensus_helper2_calc454GS20(thisbase,
-						   thisqual,
-						   actcontigpos,
-						   groups,
-						   IUPACbasegroups);
-      break;
-    }
-    case ReadGroupLib::SEQTYPE_IONTORRENT : {
-      makeIntelligentConsensus_helper2_calcIonTorrent(thisbase,
-						      thisqual,
-						      actcontigpos,
-						      groups,
-						      IUPACbasegroups);
-      break;
-    }
-    case ReadGroupLib::SEQTYPE_PACBIOHQ :
-    case ReadGroupLib::SEQTYPE_PACBIOLQ : {
-      // TODO: eventually two different for hq and lq ?
-      makeIntelligentConsensus_helper2_calcPACBIOHQ(thisbase,
-						    thisqual,
-						    actcontigpos,
-						    groups,
-						    IUPACbasegroups);
-      break;
-    }
-    case ReadGroupLib::SEQTYPE_TEXT : {
-      makeIntelligentConsensus_helper2_calcText(thisbase,
-						thisqual,
-						actcontigpos,
-						groups,
-						IUPACbasegroups);
-      break;
-    }
-    case ReadGroupLib::SEQTYPE_SOLEXA : {
-      makeIntelligentConsensus_helper2_calcSOLEXA(
-	thisbase,
-	thisqual,
-	actcontigpos,
-	ccI,
-	groups,
-	IUPACbasegroups,
-	strainmask
-	);
-      break;
-    }
-    case ReadGroupLib::SEQTYPE_ABISOLID : {
-      cout << "Actreadtype: " << static_cast<uint16>(actreadtype) << endl;
-      MIRANOTIFY(Notify::INTERNAL, "Type ABI SOLiD needs more support.");
-      break;
-    }
-    default: {
-      cout << "Actreadtype: " << static_cast<uint16>(actreadtype) << endl;
-      MIRANOTIFY(Notify::INTERNAL, "Unknown read type.");
-    }
-    }
-
-#ifdef CLOCK_STEPS_CONS
-    CON_us_steps_cons[USCLOCONS_H1_CALLH2]+=timeract.diffAndReset();
-#endif
-
-    if(!dptools::isValidIUPACStarBase(thisbase)){
-      CEBUG("ALERT! This is not a valid base: '" << thisbase << "'\t: " << static_cast<uint16>(thisbase) << '\n');
-    }
-
-  }
-
-#ifdef CLOCK_STEPS_CONS
-  CON_us_steps_cons[USCLOCONS_H1_TOTAL]+=timerh1total.diff();
-#endif
-
-
-  FUNCEND();
-}
-
-
-
-
-
-///*************************************************************************
-// *
-// *
-// *
-// *************************************************************************/
-//
-//void Contig::priv_mic_helper_chooseDiploidBase(char & thisbase, base_quality_t & thisqual,const vector<uint8> & allstpossiblebases, const vector<vector<nngroups_t>> & groups, uint8 numpossiblebases)
-//{
-//  FUNCSTART("void Contig::priv_mic_helper_chooseDiploidBase(char & thisbase, base_quality_t & thisqual,const vector<uint8> & allstpossiblebases, const vector<vector<nngroups_t>> & groups, uint8 numpossiblebases)");
-//
-//  if(numpossiblebases==2){
-//    if(allstpossiblebases['A']) thisbase='A';
-//    thisbase=dptools::calcIUPACConsensus(thisbase,allstpossiblebases['C']);
-//    thisbase=dptools::calcIUPACConsensus(thisbase,allstpossiblebases['G']);
-//    thisbase=dptools::calcIUPACConsensus(thisbase,allstpossiblebases['T']);
-//    thisqual=22; // TODO: continue here
-//  }else{
-//    // now what???
-//    BUGIFTHROW(true,"need to cont here");
-//  }
-//  if(allstpossiblebases['*']) {
-//    thisbase=tolower(thisbase);
-//  }
-//}
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-void Contig::priv_mic_helper_chooseOneBase(char & thisbase, base_quality_t & thisqual,const vector<uint32> & allstpossiblebases, const vector<vector<nngroups_t>> & groups)
-{
-  if(allstpossiblebases['A']){
-    thisbase='A';
-  }else if(allstpossiblebases['C']){
-    thisbase='C';
-  }else if(allstpossiblebases['G']){
-    thisbase='G';
-  }else if(allstpossiblebases['T']){
-    thisbase='T';
-  }else{
-    thisbase='*';
-  }
-  uint32 totalqual=0;
-  for(auto & stgroup : groups){
-    for(auto & groupe : stgroup){
-      if(groupe.base==thisbase && groupe.urdids.size()) {
-	totalqual+=groupe.groupquality;
-	thisqual=max(thisqual,groupe.groupquality);
-      }
-    }
-  }
-  // quality = 75% of sum of group quals ... or maxqual if higher
-  totalqual=totalqual*75/100;
-  thisqual=static_cast<uint8>(max(static_cast<uint32>(thisqual),totalqual));
-}
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-//#define CEBUG(bla) {cout << bla;}
-void Contig::priv_mic_helper_chooseMultiBase(char & thisbase, base_quality_t & thisqual,const vector<uint32> & allstpossiblebases, const vector<vector<nngroups_t>> & groups)
-{
-  FUNCSTART("void Contig::priv_mic_helper_chooseMultiBase(char & thisbase, base_quality_t & thisqual,const vector<uint32> & allstpossiblebases, const vector<vector<nngroups_t>> & groups)");
-
-  thisbase='!';
-  uint8 seenbases=0;
-  if(allstpossiblebases['A']) {
-    thisbase='A';
-    seenbases=1;
-  }
-  if(allstpossiblebases['C']) {
-    thisbase=dptools::calcIUPACConsensus(thisbase,'C');
-    ++seenbases;
-  }
-  if(allstpossiblebases['G']) {
-    thisbase=dptools::calcIUPACConsensus(thisbase,'G');
-    ++seenbases;
-  }
-  if(allstpossiblebases['T']) {
-    thisbase=dptools::calcIUPACConsensus(thisbase,'T');
-    ++seenbases;
-  }
-  if(allstpossiblebases['*']) {
-    ++seenbases;
-  }
-
-  if(seenbases==0){
-    thisbase='N';
-    thisqual=0;
-  }else{
-    uint32 totalqual=0;
-    seenbases=0;
-    for(auto & stgroup : groups){
-      for(auto & groupe : stgroup){
-	if(groupe.urdids.size()) {
-	  CEBUG("abc: " << groupe.base << " " << thisbase << " -> " << dptools::areBasesContained(groupe.base,thisbase) << endl);
-	  if(dptools::areBasesContainedWithN(groupe.base,thisbase) || groupe.base=='*'){
-	    totalqual+=groupe.groupquality;
-	    ++seenbases;
-	  }
-	}
-      }
-    }
-    BUGIFTHROW(seenbases==0,"seenbases==0??? No group set? Strange.");
-    thisqual=totalqual/seenbases;
-  }
-}
-//#define CEBUG(bla)
-
-/*************************************************************************
- *
- * Calculate the 'true' consensus and gives back a string with consensus
- *  and a vector with the base quality of each base
- *
- * strainidtotake: <0 means "all", >=0 means "exactly those reads with that id"
- *
- * If the ostream parameter is != nullptr, also writes a .tcs live file
- *  to it
- *
- *************************************************************************/
-
-//#define CEBUG(bla) {cout << bla;}
-
-void Contig::makeIntelligentConsensus(string & target, vector<base_quality_t> & qual, vector<int32> * targetadjustments, int32 from, int32 to, int32 strainidtotake, int32 mincoverage, base_quality_t minqual, char missingcoveragechar, bool assumediploid, bool allowiupac, bool addconstag)//, ostream * ostr, bool contagsintcs)
-{
-  FUNCSTART("void Contig::makeIntelligentConsensus(string & target, vector<base_quality_t> & qual, int32 from, int32 to, int32 mincoverage, base_quality_t minqual, int32 strainidtotake)");//, ostream * ostr, bool contagsintcs)");
-
-  static const char acgtgapbases[]="ACGT*";
-
-  cout << "makeIntelligentConsensus() complete calc .. "; cout.flush();
-
-  //CON_cebugflag=true;
-
-  CEBUG("MIC\n");
-  CEBUG("from " << from << endl);
-  CEBUG("to " << to << endl);
-  CEBUG("mincoverage " << mincoverage << endl);
-  CEBUG("minqual " << static_cast<uint16>(minqual) << endl);
-  CEBUG("missingcovchar " << missingcoveragechar << endl);
-  CEBUG("strainidtotake " << strainidtotake << endl);
-  CEBUG("addconstag " << addconstag << endl);
-
-
-  BUGIFTHROW(from>to,"from>to?");
-  BUGIFTHROW(from<0, "from < 0 ?");
-
-  suseconds_t mict_fin=0;
-  suseconds_t mict_pre=0;
-  suseconds_t mict_shadow=0;
-  suseconds_t mict_fallout=0;
-  suseconds_t mict_newin=0;
-  suseconds_t mict_helper1=0;
-  suseconds_t mict_restofloop=0;
-  suseconds_t mict_totalloop=0;
-
-  timeval us_start;
-  gettimeofday(&us_start,nullptr);
-
-  bool strainisreference=false;
-  for(uint32 rgi=1; rgi<ReadGroupLib::getNumReadGroups(); ++rgi){
-    auto rgid=ReadGroupLib::getReadGroupID(rgi);
-    if(rgid.getStrainID()==strainidtotake
-       && rgid.isBackbone()) strainisreference=true;
-  }
-  CEBUG("strainisreference " << strainisreference << endl);
-
-
-  // Finalising the contig initialises the output order structure vector
-  finalise();
-  mict_fin+=diffsuseconds(us_start);
-  gettimeofday(&us_start,nullptr);
-
-  //const contig_parameters & con_params = CON_miraparams->getContigParams();
-
-  if( to > static_cast<int32>(CON_counts.size())) to=CON_counts.size();
-  int32 len_target=to-from;
-
-  //target.resize(len_target);
-  target.clear();
-  target.reserve(len_target+10);
-  qual.clear();
-  qual.reserve(len_target+10);
-
-  // for calculating the adjustments, only do this when whole
-  //  consensus is calculated
-  if(targetadjustments != nullptr && from==0 && to==CON_counts.size()) {
-    targetadjustments->clear();
-    targetadjustments->reserve(len_target+10);
-  }
-  int32 unpaddedposcounter=0;
-
-
-  nngroups_t emptygroup;
-  emptygroup.base='!';
-  emptygroup.valid=false;
-  // TODO: make also use of bothdirectionspresent in this routine?
-  emptygroup.forwarddircounter=0;
-  emptygroup.complementdircounter=0;
-  emptygroup.groupquality=0;
-  vector<nngroups_t> emptygroups;
-  for(uint32 i=0; i<5; i++) {
-    emptygroups.push_back(emptygroup);
-    emptygroups[i].base= acgtgapbases[i];
-  }
-
-/*
-  // if there's a stream, we're dumping TCS
-  // initialise a quick lookup vector to point at the positions in the
-  //  consensus that have a tag
-  // a for any tag
-  // d for dangerous tag
-  vector<bool> tcs_aconstagpositions;
-  vector<bool> tcs_dconstagpositions;
-  if(ostr != nullptr && contagsintcs){
-    tcs_aconstagpositions.resize(CON_counts.size(),false);
-    tcs_dconstagpositions.resize(CON_counts.size(),false);
-    vector<consensustag_t>::const_iterator I=CON_consensus_tags.begin();
-    for(; I!=CON_consensus_tags.end(); I++) {
-      for(uint32 i=I->from; i<=I->to; i++) tcs_aconstagpositions[i]=true;
-      if(I->identifier == CON_tagentry_idSRMc
-	 || I->identifier == CON_tagentry_idWRMc
-	 || I->identifier == CON_tagentry_idDGPc
-	 || I->identifier == CON_tagentry_idUNSc
-	 || I->identifier == CON_tagentry_idIUPc){
-	for(uint32 i=I->from; i<=I->to; i++) tcs_dconstagpositions[i]=true;
-      }
-    }
-  }
-  // temporary vectors for TCS
-  vector<int32> tcs_totalgroupcount;
-  tcs_totalgroupcount.reserve(emptygroups.size());
-  vector<int32> tcs_totalgroupqual;
-  tcs_totalgroupqual.reserve(emptygroups.size());
-*/
-
-
-  vector<char> seqtypepicks;
-
-  vector<nngroups_t> maskedshadowgroups=emptygroups;
-
-  // for each read type, we will predict a base and quality and such
-  vector<char> pred_baseperst(ReadGroupLib::getNumSequencingTypes());
-  vector<base_quality_t> pred_qualperst(ReadGroupLib::getNumSequencingTypes());
-
-  // as well as the possible alternative bases
-  vector<vector<char>> possiblebases(ReadGroupLib::getNumSequencingTypes());
-  vector<uint32> allstpossiblebases(256,0); // used flag wheter ACGT* was seen and count occurrences
-  vector<uint32> allstpossiblebasesf(256,0); // same, forward only
-  vector<uint32> allstpossiblebasesr(256,0); // same, reverse only
-
-  vector<uint32> countsofpossiblebases; // just counts, for sorting later
-
-
-  // as well as a goodness level estimate of the prediction
-  vector<vector<int8>> predictlevels(ReadGroupLib::getNumSequencingTypes());
-
-  // for each read type a vector<nngroups_t> to hold all estimates
-  //  regarding bases and qualities
-  vector<vector<nngroups_t>> groupsvec;
-  groupsvec.reserve(ReadGroupLib::getNumSequencingTypes());
-
-  // a vector (read_ids_in_col) keeps the ids of the reads that are
-  //  covering a specific position of the contig
-  // reserving 1000 position should be enough 99.9% of all cases,
-  //  is automatically extended by STL if needed.
-
-  // now with different read types (sanger, 454 etc), we need a vector
-  //  of iterators to the PCR. Was formerly a vector of read-ids, but
-  //  not possible anymore
-
-  // and now we cache the read start offsets, thus using a struct
-
-  vector<vector<rpicsocache_t> > read_pcrIs_in_col;
-  read_pcrIs_in_col.resize(ReadGroupLib::getNumSequencingTypes());
-
-  // ok, fill in some
-  for(auto & rpice : read_pcrIs_in_col){
-    rpice.reserve(1000);
-    groupsvec.push_back(emptygroups);
-  }
-
-  // fill the vector in case we are starting within the contig
-  if(from>0) {
-    // TODO: this is wrong when going only after specific strainids!
-    // correct that ASAN (as soon as needed)
-
-    MIRANOTIFY(Notify::INTERNAL, "starting with from > 0 not available yet.");
-
-    //getReadIDsAtContigPosition(read_pcrIs_in_col,from);
-  }
-
-
-  mict_pre=diffsuseconds(us_start);
-  gettimeofday(&us_start,nullptr);
-
-  vector<int8> maskshadow;
-  vector<multitag_t::mte_id_t> masktagstrings;
-
-  // Bach: 17.08.2008
-  // the new strategy of tagging poly-AT sites and keeping them in
-  //  the read (no clipping) makes it necessary to keep sequence
-  //  under Fpas tags as full valid member of consensus somputation
-  // Therefore, Fpas may NOT be put into the masktagstrings anymore!
-  // masktagstrings.push_back(Read::REA_tagFpas);
-
-  if(!buildMaskShadow(maskshadow,masktagstrings,false)) maskshadow.clear();
-
-  mict_shadow=diffsuseconds(us_start);
-  gettimeofday(&us_start,nullptr);
-
-  vector<uint8> cached_contigseqtypes(ReadGroupLib::getNumSequencingTypes(),0);
-  for(uint32 actseqtype=0; actseqtype<ReadGroupLib::getNumSequencingTypes(); ++actseqtype){
-    cached_contigseqtypes[actseqtype]=hasSeqTypeData(actseqtype);
-  }
-
-  auto pcrI=CON_reads.begin();
-  auto ccI=CON_counts.cbegin();
-  advance(ccI,from);
-
-  // this is the loop that updates the vector that
-  //  keeps track of the reads that are
-  //  covering a specific position of the contig
-  // works quite simple: reads in the vector that are ending get
-  //  thrown out, new reads starting are entered.
-
-  CEBUG("CON_counts.size(): " << CON_counts.size() << endl);
-
-  bbstrainmask_t strainmask=-1;
-  if(strainidtotake>=0) strainmask=getBBStrainMask(strainidtotake);
-
-  timeval us_loop;
-
-  for(uint32 actcontigpos=from; actcontigpos<to; ++ccI, ++actcontigpos){
-    gettimeofday(&us_loop,nullptr);
-    // updating the pcrIs of the reads at that position
-    CEBUG("cc acp: " << actcontigpos << endl);
-    // first delete those who fall out at this new position
-    for(uint32 actseqtype=0; actseqtype<cached_contigseqtypes.size(); ++actseqtype){
-      if(cached_contigseqtypes[actseqtype]){
-	CEBUG("cc art " << actseqtype << " rpic " << read_pcrIs_in_col[actseqtype].size() << endl);
-	auto Ifrom=read_pcrIs_in_col[actseqtype].begin();
-	auto Ito=Ifrom;
-	// pcrIs are expensive on copy: by not blindly copying every iterator but only when needed,
-	//  we save between 30% and 40% time (maybe 5% total in a total cons. calc, but still)
-	bool needcopy=false;
-	for(;Ifrom != read_pcrIs_in_col[actseqtype].end(); ++Ifrom){
-	  if(needcopy) *Ito=*Ifrom;
-	  if(Ifrom->readstartpos+Ifrom->lenclippedseq > actcontigpos) {
-	    ++Ito;
-	  }else{
-	    needcopy=true;
-	    CEBUG("cc thrown out " << *Ito << endl);
-	  }
-	}
-	//if(Ito != Ifrom) {
-	//  read_pcrIs_in_col[actseqtype].resize(Ito-read_pcrIs_in_col[actseqtype].begin());
-	//}
-	// PlacedContigReads::const_iterator has no default constructor,
-	//  i.e., resize cannot be used because it wants a default constructor
-	//  though we always reduce the vector here
-	// but we can use erase()
-	CEBUG("loopend" << endl);
-	if(needcopy){
-	  CEBUG("cc popping " << Ito - Ifrom << " elements\n");
-	  read_pcrIs_in_col[actseqtype].erase(Ito,Ifrom);
-	}
-      }
-    }
-    mict_fallout+=diffsuseconds(us_loop);
-    gettimeofday(&us_loop,nullptr);
-
-    // now insert ids of reads that have newly started at this position
-    // Don't take railreads, backbone is there.
-    for(;pcrI != CON_reads.end() && pcrI.getReadStartOffset() == actcontigpos; ++pcrI){
-      if( ! pcrI->isRail()) {
-
-	// new! one can also make a choice which strains to take into account
-	// either all (strainidtotake<0 or exactly the one chosen)
-	if(strainidtotake < 0
-	   || pcrI->getStrainID() == strainidtotake) {
-	  read_pcrIs_in_col[pcrI->getSequencingType()].emplace_back(rpicsocache_t(pcrI,
-										  pcrI.getReadStartOffset(),
-										  pcrI.getURDID(),
-										  pcrI.getReadDirection(),
-										  pcrI->getLeftClipoff(),
-										  pcrI->getRightClipoff(),
-										  pcrI->getLenSeq(),
-										  pcrI->getLenClippedSeq(),
-										  pcrI->getSequencingType(),
-										  pcrI->isRail(),
-										  pcrI->isBackbone(),
-										  pcrI->isCoverageEquivalentRead()));
-	  CEBUG("cc taken " << pcrI << endl);
-	}
-      }
-    }
-    mict_newin+=diffsuseconds(us_loop);
-    gettimeofday(&us_loop,nullptr);
-
-    // for each read type, predict a base and a quality,
-    //  but also get back the potential solutions and number thereof
-
-    //vector<uint32> numsolutionsvec(ReadGroupLib::getNumSequencingTypes(),0);
-
-    allstpossiblebases['A']=0;
-    allstpossiblebases['C']=0;
-    allstpossiblebases['G']=0;
-    allstpossiblebases['T']=0;
-    allstpossiblebases['*']=0;
-    allstpossiblebasesf['A']=0;
-    allstpossiblebasesf['C']=0;
-    allstpossiblebasesf['G']=0;
-    allstpossiblebasesf['T']=0;
-    allstpossiblebasesf['*']=0;
-    allstpossiblebasesr['A']=0;
-    allstpossiblebasesr['C']=0;
-    allstpossiblebasesr['G']=0;
-    allstpossiblebasesr['T']=0;
-    allstpossiblebasesr['*']=0;
-    uint32 numreadtypeswithsolution=0;
-    for(uint32 actseqtype=0; actseqtype<cached_contigseqtypes.size(); ++actseqtype){
-      pred_baseperst[actseqtype]='!';
-      pred_qualperst[actseqtype]=0;
-      possiblebases[actseqtype].clear();
-      if(!cached_contigseqtypes[actseqtype]) continue;
-      if(unlikely(read_pcrIs_in_col[actseqtype].empty())) continue;
-
-      makeIntelligentConsensus_helper1(pred_baseperst[actseqtype],
-				       pred_qualperst[actseqtype],
-				       possiblebases[actseqtype],
-				       actcontigpos,
-				       ccI,
-				       mincoverage,
-				       groupsvec[actseqtype],
-				       maskedshadowgroups,
-				       read_pcrIs_in_col[actseqtype],
-				       maskshadow,
-				       actseqtype,
-				       strainidtotake,
-				       strainmask,
-				       missingcoveragechar
-	);
-
-      // Count num occurrences for ACGT*
-      if(!possiblebases[actseqtype].empty()){
-	++numreadtypeswithsolution;
-	for(auto & pbe : possiblebases[actseqtype]){
-	  for(auto & groupe : groupsvec[actseqtype]){
-	    if(groupe.base==pbe){
-	      allstpossiblebasesf[pbe]+=groupe.forwarddircounter;
-	      allstpossiblebasesr[pbe]+=groupe.complementdircounter;
-	      allstpossiblebases[pbe]+=groupe.forwarddircounter+groupe.complementdircounter;
-	      if(actseqtype==ReadGroupLib::SEQTYPE_SOLEXA
-		 && CON_isbackbonecontig
-		 && toupper(ccI->getOriginalBBChar())==pbe){
-		allstpossiblebases[pbe]+=ccI->bbcounts[0];
-	      }
-	      break; // found, we can break innner loop
-	    }
-	  }
-	}
-      }
-    }
-
-    CEBUG("PB-A: " << allstpossiblebases['A'] << " PB-C: " << allstpossiblebases['C'] << " PB-G: " << allstpossiblebases['G'] << " PB-T: " << allstpossiblebases['T'] << " PB-*: " << allstpossiblebases['*'] << endl);
-
-#ifndef CLOCK_STEPS_CONS
-    mict_helper1+=diffsuseconds(us_loop);
-#endif
-    gettimeofday(&us_loop,nullptr);
-
-
-    /* after the previous loop, we have the following important things
-       per read type (other things too, less important at the moment):
-       - the picked base and quality in pred_baseperst[] and
-         pred_qualperst[]
-       - the same for iupac (base, qual, and whether gap is involved)
-       - possible alternatives (including picked one) in possiblebases[]
-       - all group calculations for all read types in groupsvec[]
-       - count of possible bases in allstpossiblebases['ACGT*']
-     */
-
-    // see how many seq types made a prediction
-    // what a lazy, lazy way with a vector, push_back, sort and unique ...
-    seqtypepicks.clear();
-    CEBUG("pred_b:        ");
-    for(auto & pb : pred_baseperst) {
-      CEBUG(pb);
-      if(dptools::isValidACGTStarBase(pb)) {
-	seqtypepicks.push_back(pb);
-      }
-    }
-    if(seqtypepicks.size()>1){
-      sort(seqtypepicks.begin(), seqtypepicks.end());
-      unique(seqtypepicks.begin(), seqtypepicks.end());
-    }
-    CEBUG('\n');
-
-    // Party time: let's find out which base we take
-    char thisbase='@';
-    base_quality_t thisqual=0;
-
-    uint8 numpossiblebases=(allstpossiblebases['A']>0)+(allstpossiblebases['C']>0)+(allstpossiblebases['G']>0)+(allstpossiblebases['T']>0)+(allstpossiblebases['*']>0);
-
-    CEBUG("numpossiblebases 1: " << static_cast<uint16>(numpossiblebases) << endl);
-
-    int8 bestpredictlevel=127;
-    if(numpossiblebases>1){
-      bestpredictlevel=priv_mic_helper_rateGoodnessLevelOfAllGroups(ccI,groupsvec,predictlevels,possiblebases);
-      // careful: recalcs allstpossiblebases and numpossiblebases!
-      priv_mic_helper_filterGoodnessLevels(ccI,bestpredictlevel+2, predictlevels, groupsvec, allstpossiblebases, numpossiblebases);
-    }
-
-    // if still more than one picked base and when IUPACs are allowed (but not diploid),
-    //  be a bit stricter and filter at +1 level
-    if(numpossiblebases>1
-       && allowiupac
-       && !assumediploid){
-      // careful: recalcs allstpossiblebases and numpossiblebases!
-      priv_mic_helper_filterGoodnessLevels(ccI, bestpredictlevel+1, predictlevels, groupsvec, allstpossiblebases, numpossiblebases);
-    }
-
-    CEBUG("final numpossiblebases: " << static_cast<uint16>(numpossiblebases) << endl);
-
-    if(numpossiblebases==1){
-      priv_mic_helper_chooseOneBase(thisbase, thisqual, allstpossiblebases, groupsvec);
-    }else if(unlikely(numpossiblebases==0)){
-      if(strainisreference){
-	// if we are in the reference strain, and could not get a good base
-	//   back, it's probably a IUPAC reference base we could not resolve
-	// in that case, simply take the reference base we have
-	thisbase=ccI->getOriginalBBChar();
-	thisqual=ccI->getOriginalBBQual();
-      }else{
-	// if not, tough luck. probably an uncovered base.
-	thisbase='X';
-      }
-    }else{
-      if(assumediploid || allowiupac){
-	priv_mic_helper_chooseMultiBase(thisbase, thisqual, allstpossiblebases, groupsvec);
-      }else{
-	// careful: recalcs allstpossiblebases and numpossiblebases!
-	priv_mic_helper_filterGoodnessLevels(ccI, bestpredictlevel, predictlevels, groupsvec, allstpossiblebases, numpossiblebases);
-	if(numpossiblebases>1){
-	  if(seqtypepicks.size()==1) {
-	    // pick the one from the seqtype prediction
-	    for(uint8 xi=0; xi<5; ++xi){
-	      if(acgtgapbases[xi]!=seqtypepicks[0]) allstpossiblebases[acgtgapbases[xi]]=0;
-	    }
-	  }else{
-	    // what's too much is too much: simply take the one with the most calls
-	    // reverse loop to prefer * over T over G, C, A
-	    uint32 tmpmax=0;
-	    for(int8 xi=4; xi>=0; --xi){
-	      if(allstpossiblebases[acgtgapbases[xi]]>tmpmax){
-		tmpmax=allstpossiblebases[acgtgapbases[xi]];
-	      }else{
-		allstpossiblebases[acgtgapbases[xi]]=0;
-	      }
-	    }
-	  }
-	  numpossiblebases=1; // we WILL take only one at any rate
-	}
-	priv_mic_helper_chooseOneBase(thisbase, thisqual, allstpossiblebases, groupsvec);
-      }
-    }
-
-
-/*
-    TODO what about STMU / STMS tags?
-    rewrite calc for that
-    addTagToConsensus(actcontigpos,
-		      actcontigpos,
-		      '=',
-		      multitag_t::getIdentifierStr(CON_tagentry_idSTMS).c_str(),
-		      tagstr.str().c_str(),
-		      true);
-*/
-
-
-//    if(hassomething){
-//      BUGIFTHROW(thisbase=='@',"Coverage present but base is '@' ... this is not healthy.\n");
-//    }else{
-//      BUGIFTHROW(thisbase!='@',"No coverage present but base is not '@' ... this is not healthy.\n");
-//      thisbase=missingcoveragechar;
-//      thisqual=0;
-//    }
-
-    if(numpossiblebases>1 && allstpossiblebases['*']){
-      thisbase=tolower(thisbase);
-      CEBUG("gapasgroup, tolower: " << actcontigpos << endl);
-    }
-
-    CEBUG("thisbase " << thisbase << "\tthisqual " << (uint16) thisqual << endl);
-
-    if(thisqual<minqual && thisbase!=missingcoveragechar){
-      thisbase='N';
-      thisqual=0;
-      CEBUG("Minqual not reached, changed to: thisbase " << thisbase << "\tthisqual " << (uint16) thisqual << endl);
-    }
-
-    if(thisqual>90) thisqual=90;
-
-    if(addconstag && strainidtotake >= 0
-       && numpossiblebases>1){
-
-      countsofpossiblebases.clear();
-      for(auto & labase : acgtgapbases){
-	countsofpossiblebases.push_back(allstpossiblebases[labase]);
-      }
-      std::sort(countsofpossiblebases.begin(),countsofpossiblebases.end(),std::greater<uint32>());
-      auto sumcounts=std::accumulate(countsofpossiblebases.begin(),countsofpossiblebases.end(),0);
-
-      //cout << "ACP: " << actcontigpos << "\t" << sumcounts << "\t" << countsofpossiblebases[0] << "\t" << countsofpossiblebases[1] << "\t" << 100.0/sumcounts*countsofpossiblebases[1] << endl;
-
-      // TODO: change that 0.0 to a configurable number
-      if(100.0/sumcounts*countsofpossiblebases[1] >= 0.0){
-	string consastr("Variants within "+ReadGroupLib::getStrainOfStrainID(strainidtotake)+": ");
-	bool firstentry=true;
-	for(auto & labase : acgtgapbases){
-	  if(allstpossiblebases[labase]){
-	    if(!firstentry) consastr+=" / ";
-	    firstentry=false;
-	    consastr+=labase;
-	    consastr+=" (";
-	    consastr+=boost::lexical_cast<string>(allstpossiblebases[labase]);
-	    consastr+=')';
-	  }
-	}
-	auto & newtag = addTagToConsensus(actcontigpos,
-					  actcontigpos,
-					  '=',
-					  multitag_t::getIdentifierStr(CON_tagentry_idSAOc).c_str(),
-					  consastr.c_str(),
-					  true);
-	newtag.addAdditionalInfo(allstpossiblebasesf['A'],
-				 allstpossiblebasesf['C'],
-				 allstpossiblebasesf['G'],
-				 allstpossiblebasesf['T'],
-				 allstpossiblebasesf['*'],
-				 allstpossiblebasesr['A'],
-				 allstpossiblebasesr['C'],
-				 allstpossiblebasesr['G'],
-				 allstpossiblebasesr['T'],
-				 allstpossiblebasesr['*'],
-				 0,0,0,0,0
-	  );
-      }
-    }
-
-    target+=thisbase;
-    qual.push_back(thisqual);
-
-    // calc the adjustments
-    if(targetadjustments!= nullptr && from==0 && to==CON_counts.size()) {
-      if(thisbase=='*') {
-	targetadjustments->push_back(-1);
-      }else{
-	targetadjustments->push_back(unpaddedposcounter);
-	unpaddedposcounter++;
-      }
-
-      BUGIFTHROW(targetadjustments->size()!=target.size(), "gna1");
-      BUGIFTHROW(targetadjustments->size()!=qual.size(), "gna2");
-
-    }
-
-/*
-    // dump out .tcs file to ostr if given
-    if(ostr!=nullptr) {
-      //throw Notify(Notify::INTERNAL, THISFUNC, "must be adapted to multiple read types");
-
-      // name and position
-      // don't call paddedPos2UnpaddedPos as this would lead to recursion!
-      *ostr << setw(20) << left << getContigName()
-	    << setw(9) << right << actcontigpos
-	    << setw(9) << CON_adjustments.back()
-	    << " | " << thisbase
-	    << setw(3) << static_cast<uint16>(thisqual)
-	    << " |" << setw(5) << read_pcrIs_in_col.size();
-
-      tcs_totalgroupcount.clear();
-      tcs_totalgroupcount.resize(emptygroups.size(),0);
-      tcs_totalgroupqual.clear();
-      tcs_totalgroupqual.resize(emptygroups.size(),0);
-      for(uint32 actseqtype=0; actseqtype<groupsvec.size(); actseqtype++){
-	for(uint32 grpi=0; grpi<groupsvec[actseqtype].size(); grpi++){
-	  tcs_totalgroupcount[grpi]+=groupsvec[actseqtype][grpi].urdids.size();
-	  tcs_totalgroupqual[grpi]+=groupsvec[actseqtype][grpi].groupquality;
-	  if(tcs_totalgroupqual[grpi]>90) tcs_totalgroupqual[grpi]=90;
-	}
-      }
-      for(uint32 grpi=0; grpi<tcs_totalgroupcount.size(); grpi++){
-	*ostr << setw(5) << tcs_totalgroupcount[grpi];
-      }
-
-      *ostr << " |";
-      uint32 numgroupswithqual=0;
-      for(uint32 grpi=0; grpi<tcs_totalgroupcount.size(); grpi++){
-	if(tcs_totalgroupcount[grpi]) {
-	  *ostr << setw(3) << tcs_totalgroupqual[grpi];
-	  numgroupswithqual++;
-	}else{
-	  *ostr << " --";
-	}
-      }
-
-      // TODO: different characters for different cases?
-      char bstatus='?';
-      if(!dptools::isValidBase(thisbase)
-	 && dptools::isValidIUPACBase(thisbase)){
-	bstatus='M';
-      }else if(thisbase=='*'){
-	if(thisqual>=40){
-	  bstatus=':';
-	}else if(thisqual<30){
-	  bstatus='m';
-	}else if(numgroupswithqual>2){
-	  bstatus='m';
-	}else{
-	  bstatus=':';
-	}
-      }else if(thisqual<30 && numgroupswithqual>1){
-	bstatus='m';
-      }else{
-	bstatus=':';
-      }
-      if(!tcs_aconstagpositions.empty() && tcs_dconstagpositions[actcontigpos]){
-	bstatus='$';
-      }
-      if(bstatus!=':'){
-	*ostr << " | !" << bstatus << " |";
-      }else{
-	*ostr << " |  : |";
-      }
-
-      if(!tcs_aconstagpositions.empty() && tcs_aconstagpositions[actcontigpos]){
-	vector<consensustag_t>::const_iterator I=CON_consensus_tags.begin();
-	bool doneoutput=false;
-	for(; I!=CON_consensus_tags.end(); I++) {
-	  if((I->from <= actcontigpos) && ((I->to) >= actcontigpos)) {
-	    if(doneoutput){
-	      *ostr << ' ' << I->getIdentifierStr();
-	    }else{
-	      *ostr << " \"" << I->getIdentifierStr();
-	      doneoutput=true;
-	    }
-	  }
-	}
-	if(doneoutput) *ostr << "\"";
-
-      }
-      *ostr << "\n";
-    }
-*/
-
-    mict_restofloop+=diffsuseconds(us_loop);
-  }
-  mict_totalloop=diffsuseconds(us_start);
-
-  cout << "mict_fin        " << mict_fin << endl;
-  cout << "mict_pre        " << mict_pre << endl;
-  cout << "mict_shadow     " << mict_shadow << endl;
-  cout << "mict_fallout    " << mict_fallout << endl;
-  cout << "mict_newin      " << mict_newin << endl;
-#ifndef CLOCK_STEPS_CONS
-  cout << "mict_helper1    " << mict_helper1 << endl;
-#else
-  cout << "mict_helper1    " << CON_us_steps_cons[USCLOCONS_H1_TOTAL] << endl;
-  cout << "  H1_MGROUPS    " << CON_us_steps_cons[USCLOCONS_H1_MGROUPS] << endl;
-  cout << "  H1_PCRI       " << CON_us_steps_cons[USCLOCONS_H1_PCRI] << endl;
-  cout << "    H1_PL_1     " << CON_us_steps_cons[USCLOCONS_H1_PL_1] << endl;
-  cout << "    H1_PL_2     " << CON_us_steps_cons[USCLOCONS_H1_PL_2] << endl;
-  cout << "    H1_PL_3     " << CON_us_steps_cons[USCLOCONS_H1_PL_3] << endl;
-  cout << "    H1_PL_4     " << CON_us_steps_cons[USCLOCONS_H1_PL_4] << endl;
-  cout << "    count       " << CON_us_steps_cons[USCLOCONS_H1_countPCRI] << endl;
-  cout << "  H1_EGROUP     " << CON_us_steps_cons[USCLOCONS_H1_EGROUP] << endl;
-  cout << "  H1_GQUAL      " << CON_us_steps_cons[USCLOCONS_H1_GQUAL] << endl;
-  cout << "  H1_CALLH2     " << CON_us_steps_cons[USCLOCONS_H1_CALLH2] << endl;
-#endif
-  cout << "mict_newin      " <<   mict_newin << endl;
-  cout << "mict_restofloop " <<   mict_restofloop << endl;
-  cout << "mict_totalloop  " <<   mict_totalloop << endl;
-
-  // seconds on contig with ~4m reads
-  //mict_pre                  55
-  //mict_shadow           536072
-  //mict_fallout        5 855515
-  //mict_newin            330100
-  //mict_helper1       28 934855
-  //mict_restofloop       288773
-  //mict_totalloop     35 875607
-
-
-  CEBUG("target (first 100): " << target.substr(0,100) << endl);
-
-  cout << "done." << endl;
-
-  FUNCEND();
-
-  return;
-}
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-void Contig::priv_mic_helper_filterGoodnessLevels(cccontainer_t::const_iterator ccI, int8 maxacceptlevel, vector<vector<int8>> & predictlevels, vector<vector<nngroups_t>> & allgroups, vector<uint32> & allstpossiblebases, uint8 & numpossiblebases)
-{
-  allstpossiblebases['A']=0;
-  allstpossiblebases['C']=0;
-  allstpossiblebases['G']=0;
-  allstpossiblebases['T']=0;
-  allstpossiblebases['*']=0;
-  for(uint32 actseqtype=0; actseqtype<ReadGroupLib::getNumSequencingTypes(); ++actseqtype){
-    for(uint32 gi=0; gi<predictlevels[actseqtype].size(); ++gi){
-      if(predictlevels[actseqtype][gi]>maxacceptlevel) {
-	predictlevels[actseqtype][gi]=127;
-      }else{
-	allstpossiblebases["ACGT*"[gi]]+=allgroups[actseqtype][gi].urdids.size();
-	if(actseqtype==ReadGroupLib::SEQTYPE_SOLEXA
-	   && CON_isbackbonecontig
-	   && toupper(ccI->getOriginalBBChar())==allgroups[actseqtype][gi].base){
-	  allstpossiblebases["ACGT*"[gi]]+=ccI->bbcounts[0];
-	}
-      }
-    }
-  }
-  numpossiblebases=(allstpossiblebases['A']>0)+(allstpossiblebases['C']>0)+(allstpossiblebases['G']>0)+(allstpossiblebases['T']>0)+(allstpossiblebases['*']>0);
-
-  CEBUG("PB-A: " << static_cast<uint16>(allstpossiblebases['A']) << " PB-C: " << static_cast<uint16>(allstpossiblebases['C']) << " PB-G: " << static_cast<uint16>(allstpossiblebases['G']) << " PB-T: " << static_cast<uint16>(allstpossiblebases['T']) << " PB-*: " << static_cast<uint16>(allstpossiblebases['*']) << endl);
-  CEBUG("numpossiblebases after filter " << static_cast<int16>(maxacceptlevel) << ": " << static_cast<uint16>(numpossiblebases) << endl);
-
-  return;
-}
-//#define CEBUG(bla)
-
-/*************************************************************************
- *
- * returns by value: best level encountered
- * implicitly: predictlevels
- *
- *************************************************************************/
-
-int8 Contig::priv_mic_helper_rateGoodnessLevelOfAllGroups(cccontainer_t::const_iterator ccI, const vector<vector<nngroups_t>> & allgroups, vector<vector<int8>> & predictlevels, const vector<vector<char>> & possiblebases)
-{
-  FUNCSTART("int8 Contig::priv_mic_helper_rateGoodnessLevelOfAllGroups(cccontainer_t::const_iterator ccI, const vector<vector<nngroups_t>> & allgroups, vector<vector<int8>> & predictlevels, const vector<vector<char>> & possiblebases)");
-
-  int8 minlevel=127;
-  for(uint32 actseqtype=0; actseqtype<ReadGroupLib::getNumSequencingTypes(); ++actseqtype){
-    predictlevels[actseqtype].clear();
-    predictlevels[actseqtype].resize(5,127);
-    for(uint32 gi=0; gi<allgroups[actseqtype].size(); ++gi){
-      predictlevels[actseqtype][gi]=priv_mic_helper_rateGoodnessLevelOfGroup(
-	ccI,
-	allgroups[actseqtype][gi],
-	possiblebases[actseqtype].size(),
-	actseqtype);
-      BUGIFTHROW(predictlevels[actseqtype][gi]<0, "problem in hybrid cons calc: level < 0");
-      minlevel=min(minlevel,predictlevels[actseqtype][gi]);
-    }
-  }
-  return minlevel;
-}
-
-/*************************************************************************
- *
- *
- *
- *
- *
- *************************************************************************/
-
-int8 Contig::priv_mic_helper_rateGoodnessLevelOfGroup(cccontainer_t::const_iterator ccI, const nngroups_t & group, uint32 numpossiblebases, uint8 seqtype)
-{
-  FUNCSTART("int8 Contig::rateGoodnessLevelOfGroup(cccontainer_t::const_iterator ccI, nngroups_t & group, uint32 numpossiblebases, uint8 seqtype)");
-
-  // empty group? quick dispatch
-  if(group.urdids.empty()) return 127;
-
-  // basically, we'll prefer read types that have forward and
-  //  complement direction present.
-
-  CEBUG("predicting level for " << group.base << " seqtype " << static_cast<uint16>(seqtype) << '\n' << group);
-  int8 level=127;
-
-  if(seqtype==ReadGroupLib::SEQTYPE_ABISOLID){
-    MIRANOTIFY(Notify::INTERNAL, "Type ABI SOLiD needs more support 3.");
-  }
-
-
-  bool hasfr=(group.forwarddircounter>0) && (group.complementdircounter>0);
-
-#if CPP_READ_SEQTYPE_END != 8
-#error "This code is made for 8 sequencing types, adapt!"
-#endif
-
-  switch(seqtype) {
-  case ReadGroupLib::SEQTYPE_SANGER :{
-    if(hasfr &&
-       group.groupquality >= 35){
-      level=0;
-    }else if(hasfr
-	     && group.groupquality >= 25){
-      level=1;
-    } else if(hasfr){
-      level=2;
-    } else if(group.urdids.size()>=3
-	      && numpossiblebases == 1){
-      level=3;
-    } else {
-      level=4;
-    }
-    break;
-  }
-  case ReadGroupLib::SEQTYPE_454GS20 :{
-    if(hasfr
-       && group.urdids.size() >= 12
-       && group.groupquality >= 35){
-      level=0;
-    } else if(hasfr
-	      && group.urdids.size() >= 8
-	      && group.groupquality >= 25){
-      level=1;
-    } else if(hasfr){
-      level=2;
-    } else if(group.urdids.size()>=6
-	      && numpossiblebases == 1){
-      level=3;
-    } else {
-      level=4;
-    }
-    break;
-  }
-  case ReadGroupLib::SEQTYPE_IONTORRENT :{
-    if(hasfr
-       && group.urdids.size() >= 8
-       && group.groupquality >= 35){
-      level=0;
-    } else if(hasfr
-	      && group.urdids.size() >= 6
-	      && group.groupquality >= 25){
-      level=1;
-    } else if(hasfr){
-      level=2;
-    } else if(group.urdids.size()>=4
-	      && numpossiblebases == 1){
-      level=3;
-    } else {
-      level=4;
-    }
-    break;
-  }
-  case ReadGroupLib::SEQTYPE_PACBIOHQ :
-  case ReadGroupLib::SEQTYPE_PACBIOLQ :{
-    // No info. atm use same as 454
-    // TODO: change that for pacbio hq and lq
-    if(hasfr
-       && group.urdids.size() >= 12
-       && group.groupquality >= 35){
-      level=0;
-    } else if(hasfr
-	      && group.urdids.size() >= 8
-	      && group.groupquality >= 25){
-      level=1;
-    } else if(hasfr){
-      level=2;
-    } else if(group.urdids.size()>=6
-	      && numpossiblebases == 1){
-      level=3;
-    } else {
-      level=4;
-    }
-    break;
-  }
-  case ReadGroupLib::SEQTYPE_TEXT :{
-    // TODO: that's just a first shot at atm, would need to refine
-    if(hasfr
-       && group.urdids.size() >= 8
-       && group.groupquality >= 35){
-      level=0;
-    } else if(hasfr
-	      && group.urdids.size() >= 6
-	      && group.groupquality >= 25){
-      level=1;
-    } else if(hasfr){
-      level=2;
-    } else if(group.urdids.size()>=4
-	      && numpossiblebases == 1){
-      level=3;
-    } else {
-      level=4;
-    }
-    break;
-  }
-  case ReadGroupLib::SEQTYPE_SOLEXA :{
-    // Solexa special case: we need to take the merged reads
-    //  into account
-    uint32 realsize=group.urdids.size();
-    if(ccI->getOriginalBBChar()==group.base){
-      realsize+=ccI->bbcounts[0];
-      if(ccI->bbcounts[0]>=6){
-	hasfr=true;
-      }
-    }
-    if(hasfr
-       && realsize >= 12
-       && group.groupquality >= 35){
-      level=0;
-    } else if(hasfr
-	      && realsize >= 8
-	      && group.groupquality >= 30){
-      level=1;
-    } else if(hasfr
-	      && realsize >= 6
-	      && group.groupquality >= 25){
-      level=2;
-    } else if(group.groupquality >= 20
-	      && realsize >= 4
-	      && numpossiblebases == 1){
-      level=3;
-    } else if(group.groupquality >= 10){
-      level=4;
-    } else {
-      level=5;
-    }
-    break;
-  }
-  default : {
-    cout << "seqtype: " << seqtype << endl;
-    MIRANOTIFY(Notify::INTERNAL, "Uknown seqtype to rate?");
-  }
-  }
-
-  FUNCEND();
-
-  CEBUG("Level predicted: " << static_cast<uint16>(level) << '\n');
-
-  return level;
-}
-
-// MIC all CEBUG end
-//#define CEBUG(bla)
-
-
-
-
-/*************************************************************************
- *
- * makes a temporary char * of a portion of the consensus
- * from and to positions in the consensus
- * from inclusive
- * to exclusive
- * appending a 0 char
- *
- * returns whether a base not defined by *original* backbone or, if backbone,
- *  non-ACGT* was put into consensus
- *  Used to define whether read can be mapped or not.
- *
- *************************************************************************/
-
-bool Contig::makeTmpConsensus(int32 from, int32 to, bool tmpconsfrombackbone)
-{
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-
-  FUNCSTART("void Contig::makeTmpConsensus(int32 from, int32 to)");
-
-  definalise();
-  CEBUG("\nFrom: " << from << "\tTo: " << to<<"\tCON_counts.size(): "<<CON_counts.size());
-
-  BUGIFTHROW(from>to,"from>to?");
-  BUGIFTHROW(from<0, "from < 0 ?");
-
-  if(to>CON_counts.size()) to=CON_counts.size();
-  uint32 len_tmpcons=to-from;
-
-  if(CON_2tmpcons.capacity()<2000 || CON_2tmpcons.capacity()<len_tmpcons){
-    CON_2tmpcons.reserve(max(len_tmpcons,static_cast<uint32>(2000)));
-  }
-  CON_2tmpcons.resize(len_tmpcons);
-
-  bool hasNonBBMappable=!tmpconsfrombackbone;
-  {
-    auto toptr=CON_2tmpcons.begin();
-    auto ccI=CON_counts.cbegin();
-    BOUNDCHECK(from, 0, CON_counts.size()+1);
-    advance(ccI, from);
-
-    for(uint32 i=from; i<to ;++i, ++toptr, ++ccI){
-      *toptr=0;
-      if(tmpconsfrombackbone && ccI->getOriginalBBChar()!='@'){
-	*toptr=ccI->getBBChar();
-	hasNonBBMappable |= !dptools::isValidACGTStarBase(ccI->getOriginalBBChar());
-	if(ccI->i_backbonecharupdated!='@'
-	   && ccI->i_backbonecharorig != ccI->i_backbonecharupdated) hasNonBBMappable=true;
-      }else{
-	hasNonBBMappable=true;
-
-	ccctype_t maximum= max(ccI->A, max(ccI->C, max(ccI->G, ccI->T)));
-	uint8 counts=0;
-	//CEBUGF(ccI->A << "\t" << ccI->C << "\t" << ccI->G << "\t" << ccI->T << "\t" << ccI->N << "\t" << ccI->star << "\n");
-
-	// is any ACGT set?
-	if(maximum >0 && maximum > ccI->star) {
-	  if(ccI->A==maximum){
-	    counts++;
-	    *toptr='A';
-	  }
-	  if(ccI->C==maximum){
-	    counts++;
-	    *toptr='C';
-	  }
-	  if(ccI->G==maximum){
-	    counts++;
-	    *toptr='G';
-	  }
-	  if(ccI->T==maximum){
-	    counts++;
-	    *toptr='T';
-	  }
-	  if(counts>1) {
-	    *toptr='N';
-	  }
-
-	  //// can be somewhat problematic with 454 data
-	  //// calls the base until 50/50, then the gap
-	  //if(maximum/4 < ccI->star) *toptr='*';
-
-	  // this prefers to call gaps
-	  // calls the base until 1/3 base, 2/3 gap, then the gap
-	  // this should help, together with the "expected gap" # in
-	  //  alignments, to further reduce to a maximum this kind of
-	  //  base jiggling in homopolymers
-	  //
-	  //     ...*AAAAAAAAA...
-	  //     ...*AAAAAAAAA...
-	  //     ...AAAAAAAAA*...
-	  //     ...AAAAAAAAA*...
-	  //     ...AAAAAAAAA*...
-	  //     ...*AAAAAAAAA...
-	  //     ...*AAAAAAAAA...
-	  //     ...AAAAAAAAA*...
-	  //     ...*AAAAAAAAA...
-
-	  if(maximum/4 < (ccI->star)*2) {
-	    switch(*toptr){
-	    case 'A': {
-	      *toptr='1';
-	      break;
-	    }
-	    case 'C': {
-	      *toptr='2';
-	      break;
-	    }
-	    case 'G': {
-	      *toptr='3';
-	      break;
-	    }
-	    case 'T': {
-	      *toptr='4';
-	      break;
-	    }
-	    default: {
-	      *toptr='*';
-	    }
-	    }
-	  }
-	} else {
-	  if(unlikely(ccI->total_cov==0)){
-	    // BaCh 30.11.2012
-	    // should normally never happen, certainly not in de-novo
-	    // but the two-pass mapping may have this at the end of the contigs after first pass
-	    //  (should I decide not to go the chompFront() / chompBack() after 1st pass)
-	    //
-	    // treat it like a base (well, will be X)
-	    *toptr='N';
-	  }else if((ccI->star >= ccI->X)
-	     && (ccI->star >= ccI->N)){
-	    *toptr='*';
-	  } else if(ccI->N){
-	    *toptr='N';
-	  }else{
-	    *toptr='X';
-	  }
-	}
-      }
-      if(*toptr==0){
-	MIRANOTIFY(Notify::INTERNAL,"Ooooops? makeTmpConsensus encountered the unexpected situation of an uncalled base? Please contact the author immediately.");
-      }
-    }
-  }
-  CEBUG("Tmp_cons: >>>" <<CON_2tmpcons << "<<<" << endl);
-
-  FUNCEND();
-
-  return hasNonBBMappable;
-}
-//#define CEBUG(bla)
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-void Contig::updateBackboneConsensus()
-{
-  makeTmpConsensus(0,CON_counts.size(),false);
-  auto ccI=CON_counts.begin();
-  auto c2tc=CON_2tmpcons.c_str();
-
-  // TODO: check for coverage, check for fwd,rev
-  rcci_t rcci(this,
-	      nullptr,  // all strainids
-	      nullptr,  // all seqtypes
-	      false,            // don't take rails
-	      false,           // nor backbones
-	      false);   // nor reads without readpool-reads
-
-  for(; ccI != CON_counts.end(); ++ccI, ++c2tc, rcci.advance()){
-    if(rcci.getPCRIsInCol().size()>=6){
-      uint32 fwd=0;
-      uint32 rev=0;
-      for(auto & pcrI : rcci.getPCRIsInCol()){
-	if(pcrI.getReadDirection()>0){
-	  ++fwd;
-	}else{
-	  ++rev;
-	}
-      }
-      if(fwd>=2 && rev>=2){
-	if(ccI->i_backbonecharorig!='@'){
-	  ccI->i_backbonecharupdated=*c2tc;
-	}
-      }
-    }
-  }
-}
diff --git a/src/mira/contig_covanalysis.C b/src/mira/contig_covanalysis.C
deleted file mode 100644
index d85b16d..0000000
--- a/src/mira/contig_covanalysis.C
+++ /dev/null
@@ -1,287 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 2012 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-
-#include "contig.H"
-#include "simple_2Dsignalprocessing.H"
-
-#include <boost/lexical_cast.hpp>
-
-using namespace std;
-
-
-
-
-
-template <class PI>
-void mergePeaks(PI hbegin, PI hend, PI lbegin, PI lend)
-{
-  while(hbegin!=hend){
-    if(*hbegin){
-      while(hbegin != hend && *hbegin){
-	++hbegin;
-	++lbegin;
-      }
-      while(lbegin != lend && *lbegin){
-	*hbegin=1;
-	++hbegin;
-	++lbegin;
-      }
-    }else{
-      ++hbegin;
-      ++lbegin;
-    }
-  }
-}
-
-// simple, dumb downslope
-template <class PI, class CI>
-void extendPeaks(PI pbegin, PI pend, CI cbegin, CI cend, Contig::ccctype_t minthresh, Contig::ccctype_t maxthresh)
-{
-  while(pbegin!=pend){
-    if(*pbegin){
-      while(pbegin!=pend && *pbegin) {
-	++pbegin;
-	++cbegin;
-      }
-      if(pbegin!=pend) {
-	auto oldval=(cbegin-1)->total_cov;
-	while(pbegin!=pend && ! *pbegin) {
-	  if(cbegin->total_cov < minthresh
-	     || cbegin->total_cov <= oldval) break;
-	  oldval=cbegin->total_cov;
-	  *pbegin=1;
-	  ++pbegin;
-	  ++cbegin;
-	}
-      }
-    }else{
-      ++pbegin;
-      ++cbegin;
-    }
-  }
-}
-
-
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   //{cout << bla; cout.flush();}
-#define CEBUG(bla)
-void Contig::findPeaks(ccctype_t avgcov, vector<uint8> & peakindicator200)
-{
-  peakindicator200.clear();
-  if(CON_counts.empty()) return;
-
-  vector<uint8> peakindicator150;
-  findPeaks_helper(avgcov,avgcov*2,peakindicator200);
-  findPeaks_helper(avgcov,avgcov+avgcov/2,peakindicator150);
-  mergePeaks(peakindicator200.begin(),peakindicator200.end(),
-	     peakindicator150.begin(),peakindicator150.end());
-  CEBUG(""; dbgContainerToWiggle(peakindicator200,getContigName(),"07a_merged"));
-  mergePeaks(peakindicator200.rbegin(),peakindicator200.rend(),
-	     peakindicator150.rbegin(),peakindicator150.rend());
-  CEBUG(""; dbgContainerToWiggle(peakindicator200,getContigName(),"07b_merged"));
-}
-#undef CEBUG
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   //{cout << bla; cout.flush();}
-#define CEBUG(bla)
-void Contig::findPeaks_helper(ccctype_t avgcov, ccctype_t threshold, vector<uint8> & peakindicator)
-{
-  peakindicator.clear();
-  peakindicator.resize(CON_counts.size(),0);
-
-  if(CON_counts.empty()) return;
-
-  string tstr=boost::lexical_cast<string>(threshold);
-  //CEBUG(threshold << "\t" << tstr << endl);
-
-  auto piI=peakindicator.begin();
-  for(auto & cce: CON_counts){
-    if(cce.total_cov>=threshold) *piI=1;
-    ++piI;
-  }
-  CEBUG(""; dbgContainerToWiggle(peakindicator,getContigName(),"01_piraw_"+tstr));
-
-  erode(peakindicator.begin(),peakindicator.end(),20);
-  erode(peakindicator.rbegin(),peakindicator.rend(),20);
-  CEBUG(""; dbgContainerToWiggle(peakindicator,getContigName(),"02_erode1_"+tstr));
-
-  dilate(peakindicator.begin(),peakindicator.end(),40);
-  dilate(peakindicator.rbegin(),peakindicator.rend(),40);
-  CEBUG(""; dbgContainerToWiggle(peakindicator,getContigName(),"03_dilate_"+tstr));
-
-  erode(peakindicator.begin(),peakindicator.end(),20);
-  erode(peakindicator.rbegin(),peakindicator.rend(),20);
-  CEBUG(""; dbgContainerToWiggle(peakindicator,getContigName(),"04_erode2_"+tstr));
-
-  removeSmallPeaks(peakindicator,50);
-  CEBUG(""; dbgContainerToWiggle(peakindicator,getContigName(),"05_remsmallp_"+tstr));
-
-  // peak >= threshold found, but extend the peak area downslope to ~1x (avgcov)
-  extendPeaks(peakindicator.begin(),peakindicator.end(),
-	      CON_counts.begin(), CON_counts.end(),
-	      avgcov, threshold);
-  CEBUG(""; dbgContainerToWiggle(peakindicator,getContigName(),"06a_extendp_"+tstr));
-  // hdeque (CON_counts) has no reverse iterators yet ... :-(
-  // workaround (if I don't want to duplicate extendPeaks()):
-  //   reverse the container
-  // what a waste
-  reverse(CON_counts.begin(),CON_counts.end());
-  extendPeaks(peakindicator.rbegin(),peakindicator.rend(),
-	      CON_counts.begin(), CON_counts.end(),
-	      avgcov, threshold);
-  reverse(CON_counts.begin(),CON_counts.end());
-  CEBUG(""; dbgContainerToWiggle(peakindicator,getContigName(),"06b_extendp_"+tstr));
-
-  return;
-}
-#undef CEBUG
-
-
-
-/*************************************************************************
- *
- * Note: currently cannot constify as CON_counts, when using hdeque, has no "real" const_iterator
- *
- *************************************************************************/
-
-void Contig::collectCoverage(uint32 from, uint32 to, vector<uint64> & covvals)
-{
-  FUNCSTART("void Contig::collectCoverage(uint32 from, uint32 to, vector<uint64> & covvals)");
-
-  covvals.clear();
-  if(CON_counts.empty()) return;
-
-  BUGIFTHROW(from>to,"from " << from << " > to " << to << " ???");
-  BUGIFTHROW(from>=CON_counts.size(),"from " << from << " >= CON_counts.size() " << CON_counts.size() << " ???");
-  BUGIFTHROW(to>=CON_counts.size(),"to " << to << " >= CON_counts.size() " << CON_counts.size() << " ???");
-  BUGIFTHROW(CON_counts.empty() && (from!=0 || to!=0),"empty contig, but from " << from << " and to " << to);
-
-  uint64 numvals=to - from+1;
-  if(numvals>0){
-    auto ccI=CON_counts.cbegin();
-    advance(ccI,from);
-    for(uint64 cci=0; cci<numvals; ++cci, ++ccI){
-      covvals.push_back(ccI->total_cov);
-    }
-  }
-
-}
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-void Contig::calcStatsOnContainer(coverageinfo_t & cinfo, vector<uint64> & covvals) const
-{
-  FUNCSTART("void Contig::calcStatsOnContainer(coverageinfo_t & cinfo, vector<uint64> & covvals)");
-
-  cinfo.clear();
-
-  if(covvals.empty()) return;
-
-  uint64 sum=0;
-  for(auto cve : covvals){
-    sum+=cve;
-    cinfo.min=min(cinfo.min,static_cast<uint64>(cve));
-    cinfo.max=max(cinfo.max,static_cast<uint64>(cve));
-  }
-
-  cinfo.mean=static_cast<double>(sum)/static_cast<double>(covvals.size());
-  sort(covvals.begin(),covvals.end());
-  if(covvals.size()%2==0){
-    cinfo.median=static_cast<double>(covvals[covvals.size()/2]+covvals[covvals.size()/2-1])/2;
-  }else{
-    cinfo.median=static_cast<double>(covvals[covvals.size()/2]);
-  }
-
-  double sqsum=0.0;
-  for(auto cvI=covvals.begin(); cvI!=covvals.end(); ++cvI){
-    sqsum+=(static_cast<double>(*cvI)-cinfo.mean)*(static_cast<double>(*cvI)-cinfo.mean);
-  }
-
-  cinfo.stddev=sqrt(static_cast<double>(sqsum)/static_cast<double>(covvals.size()));
-}
-
-/*************************************************************************
- *
- * precondition: covvals must be sorted ascending
- *
- *
- *
- *************************************************************************/
-
-void Contig::calcSecondOrderStatsOnContainer(coverageinfo_t & tci, const vector<uint64> & covvals) const
-{
-
-  int64 lowerb=static_cast<int64>(tci.mean/3);
-  int64 upperb=static_cast<int64>(tci.mean*3);
-
-  auto cvS=covvals.begin();
-
-  // advance to beginning of area
-  for(; cvS != covvals.end() && static_cast<int64>(*cvS) < lowerb; ++cvS) {};
-
-  auto cvE=cvS;
-
-  uint64 sum=0;
-  for(; cvE != covvals.end() && static_cast<int64>(*cvE) <= upperb; ++cvE){
-    sum+=*cvE;
-  }
-
-  int64 numvals=cvE-cvS;
-
-  if(numvals>0){
-    tci.mean=static_cast<double>(sum)/static_cast<double>(numvals);
-    if(numvals%2==0){
-      tci.median=static_cast<double>(*(cvS+numvals/2)+(*(cvS+(numvals/2-1))))/2.0;
-    }else{
-      tci.median=static_cast<double>(*(cvS+numvals/2));
-    }
-
-    double sqsum=0.0;
-    for(auto cvI=cvS; cvI!=cvE; ++cvI){
-      sqsum+=(static_cast<double>(*cvI)-tci.mean)*(static_cast<double>(*cvI)-tci.mean);
-    }
-
-    tci.stddev=sqrt(static_cast<double>(sqsum)/static_cast<double>(covvals.size()));
-  }
-
-  return;
-}
diff --git a/src/mira/contig_edit.C b/src/mira/contig_edit.C
index 8c62dfa..e1e8e54 100644
--- a/src/mira/contig_edit.C
+++ b/src/mira/contig_edit.C
@@ -9,26 +9,26 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
-#include "contig.H"
-
-#include "util/progressindic.H"
-#include "util/dptools.H"
+// 	$Id$	
 
-using namespace std;
+#ifndef lint
+static char vcid3[] = "$Id$";
+#endif /* lint */
 
+#include "contig.H"
 
 //#define CEBUGFLAG
 
@@ -54,27 +54,28 @@ using namespace std;
 
 bool Contig::hasEditableOvercallData() const
 {
-  FUNCSTART("bool Contig::hasEditableOvercallData() const");
+  (void) vcid3;
 
-#if CPP_READ_SEQTYPE_END != 8
-#error "This code is made for 8 sequencing types, adapt!"
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
 #endif
 
-  for(uint32 rgid=0; rgid<CON_readsperreadgroup.size(); ++rgid){
-    if(CON_readsperreadgroup[rgid]>0
-       && ((*CON_miraparams)[ReadGroupLib::getReadGroupID(rgid).getSequencingType()].getEditParams().ed_homopolymer_overcalls)) return true;
+  // TODO: PacBio???
+  for(uint32 readnr=0; readnr<CON_reads.size(); readnr++){
+    if(CON_reads[readnr].read.isSequencingType(Read::SEQTYPE_454GS20)) return true;
+    if(CON_reads[readnr].read.isSequencingType(Read::SEQTYPE_IONTORRENT)) return true;
+    //if(CON_reads[readnr].read.isSequencingType(Read::SEQTYPE_SOLEXA)) return true;
   }
 
   return false;
 }
 
-bool Contig::hasSeqTypeData(uint8 seqtype) const
+bool Contig::hasPacBioData() const
 {
-  FUNCSTART("bool Contig::hasSeqTypeData(uint8 seqtype) const");
+  (void) vcid3;
 
-  for(uint32 rgid=0; rgid<CON_readsperreadgroup.size(); ++rgid){
-    if(CON_readsperreadgroup[rgid]>0
-       && ReadGroupLib::getReadGroupID(rgid).getSequencingType() == seqtype) return true;
+  for(uint32 readnr=0; readnr<CON_reads.size(); readnr++){
+    if(CON_reads[readnr].read.isSequencingType(Read::SEQTYPE_PACBIO)) return true;
   }
 
   return false;
@@ -96,170 +97,166 @@ uint32 Contig::createPacBioDarkStrobeEdits(list<pbdse_t> & pbdsev)
 {
   FUNCSTART("uint32 Contig::createPacBioDarkStrobeEdits(list<pbdse_t> & pbdse)");
 
-  BUGIFTHROW(true,"need redo ce1 for PlacedContigReads");
-
-////++++////  pbdsev.clear();
-////++++////
-////++++////  int32 maxce=0;
-////++++////
-////++++////  string consseq;
-////++++////  vector<base_quality_t> consqual;
-////++++////
-////++++////  newConsensusGet(consseq, consqual);
-////++++////
-////++++////  vector<contigread_t>::const_iterator crI=CON_reads.begin();
-////++++////
-////++++////    int32 dbg_goodestim=0;
-////++++////    int32 dbg_medestim=0;
-////++++////    int32 dbg_badestim=0;
-////++++////    int32 dbg_sumgoodestim=0;
-////++++////    int32 dbg_summedestim=0;
-////++++////    int32 dbg_sumbadestim=0;
-////++++////
-////++++////  for(; crI != CON_reads.end(); crI++){
-////++++////    if(crI->orpid<0
-////++++////       // TODO: what aboutPacBioLQ ?
-////++++////       || !crI->read.isSequencingType(ReadGroupLib::SEQTYPE_PACBIOHQ)) continue;
-////++++////
-////++++////    const Read & actread = crI->read;
-////++++////
-////++++////    BUGIFTHROW(actread.getLenClippedSeq() == 0, "Read: " << actread.getName() << " has 0 length?");
-////++++////
-////++++////    int32 cpos=crI->offset;
-////++++////    int32 cposincr=1;
-////++++////    if(crI->direction < 0) {
-////++++////      cposincr=-1;
-////++++////      cpos+=actread.getLenClippedSeq()-1;
-////++++////    }
-////++++////    int32 arpos=crI->contigPos2RawReadPos(cpos);
-////++++////
-////++++////    auto ccI=CON_counts.begin();
-////++++////    advance(ccI,cpos);
-////++++////
-////++++////    char rbase;
-////++++////    char cbase;
-////++++////    int32 runcounter=0;
-////++++////    int32 ncounter=0;
-////++++////    int32 gapcounter=0;
-////++++////    int32 changeestim=0;
-////++++////
-////++++////    bool runend=false;
-////++++////
-////++++////    // start/stop of run in read (unclipped read pos)
-////++++////    int32 arposs=0;
-////++++////    int32 arpose=0;
-////++++////    for(uint32 ri=0; ri<actread.getLenClippedSeq(); ri++, arpos++, cpos+=cposincr, ccI+=cposincr){
-////++++////      if(crI->direction < 0) {
-////++++////	//rbase=actread.getBaseInComplementSequence(arpos);
-////++++////	rbase=actread.getBaseInSequence(arpos);
-////++++////      }else{
-////++++////	rbase=actread.getBaseInSequence(arpos);
-////++++////      }
-////++++////      //cout << actread.getName() << " " << arpos << " " << rbase << "\t" << cpos << '\t' << consseq[cpos] << '\t' << changeestim << endl;
-////++++////
-////++++////      cbase=consseq[cpos];
-////++++////      if(cbase == '*'){
-////++++////	if(ccI->N > ccI->star) cbase ='N';
-////++++////      }
-////++++////
-////++++////      if(runcounter>0){
-////++++////	if(rbase=='*'){
-////++++////	  runcounter++;
-////++++////	  gapcounter++;
-////++++////	  if(cbase!='*'){
-////++++////	    changeestim++;
-////++++////	  }
-////++++////	}else if(rbase=='N' ||rbase=='n'){
-////++++////	  runcounter++;
-////++++////	  ncounter++;
-////++++////	  if(cbase=='*'){
-////++++////	    changeestim--;
-////++++////	  }
-////++++////	}else{
-////++++////	  runend=true;
-////++++////	  arpose=arpos-1;
-////++++////	}
-////++++////      }else{
-////++++////	if(rbase=='*'){
-////++++////	  arposs=arpos;
-////++++////	  runcounter++;
-////++++////	  gapcounter++;
-////++++////	  if(cbase!='*'){
-////++++////	    changeestim++;
-////++++////	  }
-////++++////	}else if(rbase=='N' ||rbase=='n'){
-////++++////	  arposs=arpos;
-////++++////	  runcounter++;
-////++++////	  ncounter++;
-////++++////	  if(cbase=='*'){
-////++++////	    changeestim--;
-////++++////	  }
-////++++////	}
-////++++////      }
-////++++////      if(runend){
-////++++////	CEBUG("runend. rc: " << runcounter << "\tgc: " << gapcounter << "\tnc: " << ncounter << "\tce: " << changeestim << "\ts: " << arposs << "\te: " << arpose << endl);
-////++++////	if(ncounter>=5 && changeestim !=0){
-////++++////	  // on 100/100 data
-////++++////	  //direction good in 80% of the time when using 2/3 of change estimate
-////++++////	  // on 100/100 data
-////++++////	  // looks like 3/5 is sweet spot
-////++++////
-////++++////	  //if(abs(changeestim)>2) {
-////++++////	  //  changeestim=changeestim*3/5;
-////++++////	  //} else if(abs(changeestim)==2) {
-////++++////	  //  changeestim/=2;
-////++++////	  //}
-////++++////	  if(abs(changeestim)>3) {
-////++++////	    changeestim=changeestim*3/5;
-////++++////	  } else if(abs(changeestim)!=1) {
-////++++////	    changeestim/=2;
-////++++////	  }
-////++++////
-////++++////	  {
-////++++////	    pbdse_t ptmp;
-////++++////	    ptmp.rid=crI->orpid;
-////++++////	    ptmp.rposs=arposs;
-////++++////	    ptmp.rpose=arpose;
-////++++////	    ptmp.changeestim=changeestim;
-////++++////	    pbdsev.push_back(ptmp);
-////++++////	  }
-////++++////	  CEBUG("Stored " << actread.getName() << "\tce: " << changeestim << endl);
-////++++////
-////++++////	  maxce=max(abs(changeestim),maxce);
-////++++////	  int32 newestim=ncounter+changeestim;
-////++++////	  if(abs(100-ncounter) > abs(100-newestim)){
-////++++////	    dbg_goodestim++;
-////++++////	    dbg_sumgoodestim+=changeestim;
-////++++////	  }else if(abs(100-ncounter) == abs(100-newestim)){
-////++++////	    dbg_medestim++;
-////++++////	    dbg_summedestim+=changeestim;
-////++++////	  }else{
-////++++////	    dbg_badestim++;
-////++++////	    dbg_sumbadestim+=changeestim;
-////++++////	  }
-////++++////	}
-////++++////	runcounter=0;
-////++++////	gapcounter=0;
-////++++////	ncounter=0;
-////++++////	changeestim=0;
-////++++////	arposs=0;
-////++++////	arpose=0;
-////++++////	runend=false;
-////++++////      }
-////++++////    }
-////++++////  }
-////++++////
-////++++////  CEBUG("Good: " << dbg_goodestim << "\tSum: " << dbg_sumgoodestim
-////++++////	<< "\nMed : " << dbg_medestim << "\tSum: " << dbg_summedestim
-////++++////	<< "\nBad : " << dbg_badestim << "\tSum: " << dbg_sumbadestim
-////++++////	<< "\nMax : " << maxce
-////++++////	<< endl);
-////++++////
-////++++////  //pbdsev.sort(Contig::pbdse_t_comparator);
-////++++////
-////++++////  FUNCEND();
-////++++////  return static_cast<uint32>(maxce);
-  return 0;
+  pbdsev.clear();
+
+  int32 maxce=0;
+
+  string consseq;
+  vector<base_quality_t> consqual;
+
+  newConsensusGet(consseq, consqual);
+
+  vector<contigread_t>::const_iterator crI=CON_reads.begin();
+
+    int32 dbg_goodestim=0;
+    int32 dbg_medestim=0;
+    int32 dbg_badestim=0;
+    int32 dbg_sumgoodestim=0;
+    int32 dbg_summedestim=0;
+    int32 dbg_sumbadestim=0;
+
+  for(; crI != CON_reads.end(); crI++){
+    if(crI->orpid<0
+       || !crI->read.isSequencingType(Read::SEQTYPE_PACBIO)) continue;
+
+    const Read & actread = crI->read;
+
+    BUGIFTHROW(actread.getLenClippedSeq() == 0, "Read: " << actread.getName() << " has 0 length?");
+
+    int32 cpos=crI->offset;
+    int32 cposincr=1;
+    if(crI->direction < 0) {
+      cposincr=-1;
+      cpos+=actread.getLenClippedSeq()-1;
+    }
+    int32 arpos=crI->contigPos2RawReadPos(cpos);
+
+    cccontainer_t::const_iterator ccI=CON_counts.begin();
+    advance(ccI,cpos);
+
+    char rbase;
+    char cbase;
+    int32 runcounter=0;
+    int32 ncounter=0;
+    int32 gapcounter=0;
+    int32 changeestim=0;
+
+    bool runend=false;
+
+    // start/stop of run in read (unclipped read pos)
+    int32 arposs=0;
+    int32 arpose=0;
+    for(int32 ri=0; ri<actread.getLenClippedSeq(); ri++, arpos++, cpos+=cposincr, ccI+=cposincr){
+      if(crI->direction < 0) {
+	//rbase=actread.getBaseInComplementSequence(arpos);
+	rbase=actread.getBaseInSequence(arpos);
+      }else{
+	rbase=actread.getBaseInSequence(arpos);
+      }
+      //cout << actread.getName() << " " << arpos << " " << rbase << "\t" << cpos << '\t' << consseq[cpos] << '\t' << changeestim << endl;
+
+      cbase=consseq[cpos];
+      if(cbase == '*'){
+	if(ccI->N > ccI->star) cbase ='N';
+      }
+
+      if(runcounter>0){
+	if(rbase=='*'){
+	  runcounter++;
+	  gapcounter++;
+	  if(cbase!='*'){
+	    changeestim++;
+	  }
+	}else if(rbase=='N' ||rbase=='n'){
+	  runcounter++;
+	  ncounter++;
+	  if(cbase=='*'){
+	    changeestim--;
+	  }
+	}else{
+	  runend=true;
+	  arpose=arpos-1;
+	}
+      }else{
+	if(rbase=='*'){
+	  arposs=arpos;
+	  runcounter++;
+	  gapcounter++;
+	  if(cbase!='*'){
+	    changeestim++;
+	  }
+	}else if(rbase=='N' ||rbase=='n'){
+	  arposs=arpos;
+	  runcounter++;
+	  ncounter++;
+	  if(cbase=='*'){
+	    changeestim--;
+	  }
+	}
+      }
+      if(runend){
+	CEBUG("runend. rc: " << runcounter << "\tgc: " << gapcounter << "\tnc: " << ncounter << "\tce: " << changeestim << "\ts: " << arposs << "\te: " << arpose << endl);
+	if(ncounter>=5 && changeestim !=0){
+	  // on 100/100 data
+	  //direction good in 80% of the time when using 2/3 of change estimate
+	  // on 100/100 data
+	  // looks like 3/5 is sweet spot
+
+	  //if(abs(changeestim)>2) {
+	  //  changeestim=changeestim*3/5;
+	  //} else if(abs(changeestim)==2) {
+	  //  changeestim/=2;
+	  //}
+	  if(abs(changeestim)>3) {
+	    changeestim=changeestim*3/5;
+	  } else if(abs(changeestim)!=1) {
+	    changeestim/=2;
+	  }
+
+	  {
+	    pbdse_t ptmp;
+	    ptmp.rid=crI->orpid;
+	    ptmp.rposs=arposs;
+	    ptmp.rpose=arpose;
+	    ptmp.changeestim=changeestim;
+	    pbdsev.push_back(ptmp);
+	  }
+	  CEBUG("Stored " << actread.getName() << "\tce: " << changeestim << endl);
+
+	  maxce=max(abs(changeestim),maxce);
+	  int32 newestim=ncounter+changeestim;
+	  if(abs(100-ncounter) > abs(100-newestim)){
+	    dbg_goodestim++;
+	    dbg_sumgoodestim+=changeestim;
+	  }else if(abs(100-ncounter) == abs(100-newestim)){
+	    dbg_medestim++;
+	    dbg_summedestim+=changeestim;
+	  }else{
+	    dbg_badestim++;
+	    dbg_sumbadestim+=changeestim;
+	  }
+	}
+	runcounter=0;
+	gapcounter=0;
+	ncounter=0;
+	changeestim=0;
+	arposs=0;
+	arpose=0;
+	runend=false;
+      }
+    }
+  }
+
+  CEBUG("Good: " << dbg_goodestim << "\tSum: " << dbg_sumgoodestim
+	<< "\nMed : " << dbg_medestim << "\tSum: " << dbg_summedestim
+	<< "\nBad : " << dbg_badestim << "\tSum: " << dbg_sumbadestim
+	<< "\nMax : " << maxce
+	<< endl);
+
+  //pbdsev.sort(Contig::pbdse_t_comparator);
+
+  FUNCEND();
+  return static_cast<uint32>(maxce);
 }
 //#define CEBUG(bla)
 
@@ -269,43 +266,16 @@ uint32 Contig::createPacBioDarkStrobeEdits(list<pbdse_t> & pbdsev)
  *
  * check stars only / N only columns and remove them
  * readjust the offsets if needed
- * from = including, to= excluding! (normal C like interval)
- *
- * returns number of deleted columns
  *
  *************************************************************************/
 
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-uint32 Contig::deleteStarOnlyColumns(int32 from, int32 to, bool alsononly, uint32 mincov)
+void Contig::deleteStarOnlyColumns(int32 from, int32 to, bool alsononly, uint32 mincov, bool updateconcounts)
 {
-  FUNCSTART("void Contig::deleteStarOnlyColumns(int32 from, int32 to, bool alsononly, uint32 mincov, bool updateconcounts)");
-
-  // Problem: mapping assemblies with lots of gap columns (Ion!)
-  // For "normal" mapping assemblies, one reference read covers everything
-  // Which means: the for loop over the reads will always start at the first read
-  //  and sift over a lot of non-interesting reads before hitting the ones which
-  //  are covering a gap column. Lots of time wastage, especially in high
-  //  coverage contigs.
-  //
-  // Resolution:
-  // For contigs with just one backbone read, cheat. Find the backbone read beforehand,
-  //  and in the for loop, do not use getFirstPCRIForReadsCoveringPosition() but
-  //  getFirstPCRIForNonBBReadsCoveringPosition().
-  //  Handle the backbone read separately.
-  //
-  // Contigs with >1 bb read are rare (would have needed to use CAF/MAF alignment mapping
-  //  with one long grand-parent reference as reference, not many users do that), but these
-  //  have to bite the bullet and go through reads normally.
-
-  int32 checklen=to-from;
-  if(checklen==0) return 0;
-  uint32 numdel=0;
+  FUNCSTART("void Contig::deleteStarOnlyColumns(int32 from, int32 to)");
 
   paranoiaBUGSTAT(checkContig());
 
-  BUGIFTHROW(from>=CON_counts.size(), "from>=CON_counts.size() ???");
-  if(to>CON_counts.size()) to=CON_counts.size();
-  BUGIFTHROW(to<from, "to " << to << " < from " << from << " ?");
+  BUGIFTHROW(to<from, "to < from ?");
 
   if(CON_fixedconsseq.size()){
     nukeSTLContainer(CON_fixedconsseq);
@@ -313,122 +283,100 @@ uint32 Contig::deleteStarOnlyColumns(int32 from, int32 to, bool alsononly, uint3
   }
   definalise();
 
-  CEBUG("Starcheck from: " << from << " to " << to << " (excluding)\nAlso N only" << alsononly <<endl);
-
-  PlacedContigReads::const_iterator firstbbI(CON_reads.end());
-  PlacedContigReads::const_iterator pcrJ=firstbbI;
-
-  auto numbbreads=getNumBackbones();
-  if(numbbreads>0){
-    for(auto pcrI=CON_reads.begin(); pcrI!=CON_reads.end(); ++pcrI){
-      if(pcrI->isBackbone()) {
-	firstbbI=pcrI;
-	break;
-      }
-    }
-  }
+  int32 checklen=to-from;
 
-  CEBUG("Num bb reads: " << numbbreads << endl);
-
-  CEBUG("Going in with:\n"; dumpAsText(cout,from,to));
-
-  auto ccI= CON_counts.begin();
-  BOUNDCHECK(from, 0, CON_counts.size());
-  advance(ccI, from);
-
-  // take care if inserting "continue" statements into this loop
-  // ++ccI and ++actread are at end of loop!!!
-  for(int32 actcontigpos=from; actcontigpos < to; ){
-    bool todelete=false;
-    CEBUG("dsoc acp: " << actcontigpos << endl);// << *ccI << endl);
-    if(ccI->total_cov >= mincov
-       && (ccI->getBBChar() == '*'
-	   || ccI->getBBChar() == '@')){
-      if(ccI->star==ccI->total_cov){
-	CEBUG("Complete star row. Deleting star in consensus and in other reads.\n");
-	todelete=true;
-      } else if(alsononly){
-	if(ccI->A == ccI->N
-	   && ccI->C == ccI->N
-	   && ccI->G == ccI->N
-	   && ccI->T == ccI->N
-	   && ccI->X == 0){
-	  CEBUG("Complete N row. Deleting in consensus and in other reads.\n");
+  if(checklen>0){
+    if(from+checklen>CON_counts.size()) checklen=CON_counts.size()-from;
+
+
+    CEBUG("Starcheck from: " << from << " to " << from+checklen << "Also N only" << alsononly <<endl);
+
+    //{
+    //  // give out the reads for debuging purposes
+    //  vector<contigread_t>::iterator J=CON_reads.begin();
+    //  for(uint32 j=0; j<CON_reads.size(); j++, J++){
+    //	CEBUG("J->id "<< J->id << "      J->offset " << J->offset << "\n");
+    //  }
+    //}
+    
+    cccontainer_t::iterator I= CON_counts.begin();
+    BOUNDCHECK(from+checklen-1, 0, CON_counts.size());
+    advance(I, from+checklen-1);
+    for(int32 actcontigpos=checklen-1; actcontigpos >= 0; --actcontigpos, --I){
+      bool todelete=false;
+      CEBUG("dsoc acp: " << actcontigpos << endl);// << *I << endl;
+      if(I->total_cov >= mincov
+	 && (I->backbonechar == '*'
+	     || I->backbonechar == '@')){
+	if(I->star==I->total_cov){
+	  CEBUG("Complete star row. Deleting star in consensus and in other reads.\n");
 	  todelete=true;
-	}
-      }
-    }
-
-    if(todelete){
-      ++numdel;
-      if(numbbreads==1){
-	pcrJ=getFirstPCRIForNonBBReadsCoveringPosition(actcontigpos);
-
-	// delete gaps / N in backbone read
-	if(actcontigpos >= firstbbI.getReadStartOffset()
-	   && actcontigpos < (firstbbI.getReadStartOffset() + firstbbI->getLenClippedSeq())){
-	  CEBUG("BB in range, deleting.");
-	  // internaloffset is the offset of the * / N in this read
-	  int32 internaloffset= actcontigpos-firstbbI.getReadStartOffset();
-	  CEBUG("\tInternal offset: " << internaloffset);
-	  if(firstbbI.getReadDirection() > 0){
-	    const_cast<Read &>(*firstbbI).deleteBaseFromClippedSequence(internaloffset);
-	  }else{
-	    const_cast<Read &>(*firstbbI).deleteBaseFromClippedComplementSequence(internaloffset);
+	} else if(alsononly){
+	  if(I->A == I->N
+	     && I->C == I->N
+	     && I->G == I->N
+	     && I->T == I->N
+	     && I->X == 0){
+	    CEBUG("Complete N row. Deleting in consensus and in other reads.\n");
+	    todelete=true;
 	  }
 	}
-      }else{
-	pcrJ=getFirstPCRIForReadsCoveringPosition(actcontigpos);
       }
-
-      CEBUG("TODELETE! " << actcontigpos << "\npcrJ points at " << pcrJ->getName() << endl);
-      // Deleting stars / Ns in other reads
-      for(; pcrJ != CON_reads.end() && pcrJ.getReadStartOffset() <= actcontigpos; ++pcrJ){
-	if(!(numbbreads == 1 && pcrJ->isBackbone()) // remember: 1 bb read -> already handled
-	   && actcontigpos >= pcrJ.getReadStartOffset()
-	   && actcontigpos < (pcrJ.getReadStartOffset() + pcrJ->getLenClippedSeq())){
-	  CEBUG("In range " << pcrJ->getName() << " at " << pcrJ.getReadStartOffset() << " to " << pcrJ.getReadStartOffset() + pcrJ->getLenClippedSeq());
-	  // internaloffset is the offset of the * / N in this read
-	  int32 internaloffset= actcontigpos-pcrJ.getReadStartOffset();
-	  CEBUG("\tInternal offset: " << internaloffset << '\n');
-	  if(pcrJ.getReadDirection() > 0){
-	    const_cast<Read &>(*pcrJ).deleteBaseFromClippedSequence(internaloffset);
-	  }else{
-	    const_cast<Read &>(*pcrJ).deleteBaseFromClippedComplementSequence(internaloffset);
+      
+      if(todelete){
+	vector<contigread_t>::iterator J=CON_reads.begin();
+      
+	// Deleting stars / Ns in other reads
+	for(; J != CON_reads.end(); J++){
+	  CEBUG("i " << i << "\tJ->id "<< J->id << "\tJ->offset " << J->offset << "\tJ->offset+J->read.getLenClippedSeq() " << J->offset+J->read.getLenClippedSeq());
+	  // TODO: >, >=, <, <=, +1, -1?
+	  if(from+actcontigpos >= J->offset&&
+	     from+actcontigpos < J->offset+J->read.getLenClippedSeq()){
+	    CEBUG("In range, deleting.");
+	    // internaloffset is the offset of the * / N in this read
+	    int32 internaloffset= (from-J->offset)+actcontigpos;
+	    CEBUG("\tInternal offset: " << internaloffset);
+	    
+	    if(J->direction > 0){
+	      J->read.deleteBaseFromClippedSequence(internaloffset);
+	    }else{
+	      J->read.deleteBaseFromClippedComplementSequence(internaloffset);
+	    }
+	    
+	    //		vector<char>::iterator K=J->corrected.begin();
+	    //		advance(K, internaloffset);
+	    //		J->corrected.erase(K);
 	  }
+	  // Adjust start of reads beginning after the pos.
+	  if(J->offset > from+actcontigpos) {
+	    CEBUG("\tComes after. Down 1.");
+	    J->offset-=1;
+	  }
+	  CEBUG(endl);
 	}
-      }
 
-      CEBUG("shiftReads(" << actcontigpos << ",-1)\n");
-      CON_reads.shiftReads(actcontigpos,-1);
-      shiftMarkerPositions(actcontigpos,-1);
+	// push down consensus tags
+	updateTagBaseDeleted(from+actcontigpos);
 
-      // push down consensus tags
-      updateTagBaseDeleted(actcontigpos);
-
-      // erase the place in CON_counts
-      CEBUG("counts_offset: " << (ccI-CON_counts.begin()) << endl);
-      CEBUG("ccI before: " << ccI << endl);
-      ccI=CON_counts.erase(ccI);
-      CEBUG("ccI after: " << ccI << endl);
-      CEBUG("After DEL " << actcontigpos << ":\n"; dumpAsText(cout,from,to));
-
-      // do not increase actcontigpos and ccI here, we stay at the same position
-      //  as the old gap column disappeared
-      // But: "to" needs to be decreased
-      --to;
-    }else{
-      ++ccI;
-      ++actcontigpos;
+	if(updateconcounts){
+	  // erase the place in CON_counts
+	  CEBUG("counts_offset: " << (I-CON_counts.begin()) << endl);
+	  CON_counts.erase(I);
+	  I= CON_counts.begin();
+	  BOUNDCHECK(from+1, 0, static_cast<int32>(CON_counts.size()));
+	  advance(I, from+actcontigpos);
+	}
+      }
     }
   }
 
-  paranoiaBUGSTAT(checkContig());
+  // if CON_counts wasn't updated, this contig is pretty much invalid anyway
+  if(updateconcounts) {paranoiaBUGSTAT(checkContig());}
 
   FUNCEND();
-  return numdel;
+
 }
-//#define CEBUG(bla)
+
 
 
 
@@ -452,31 +400,13 @@ uint32 Contig::editTrickyOvercalls(const bool onlysetPSHPtags, const bool noSRMr
 {
   FUNCSTART("uint32 Contig::editTrickyOvercalls(const bool onlysetPSHPtags, const bool noSRMreadsallowed, vector<bool> & readsmarkedsrm)");
 
-  if(onlysetPSHPtags){
-    cout << "Marking";
-  }else{
-    cout << "Editing";
-    definalise();
-  }
-  cout << " tricky overcalls (";
-  if(noSRMreadsallowed){
-    cout << "no ";
-  }
-  cout << "SRMs allowed):\n";
+  cout << "\nSearching for tricky 454 overcalls:\n";
 
-  bool needcheckSRM=false;
+  // if we were called with an incorrectly sized readsmarkedsrm vector
+  //  (empty or whatever), assume no SRM frshly set
   if(readsmarkedsrm.size() != CON_readpool->size()){
-    // if we were called with an incorrectly sized readsmarkedsrm vector
-    //  (empty or whatever), assume no SRM freshly set
     readsmarkedsrm.clear();
     readsmarkedsrm.resize(CON_readpool->size(),false);
-  }else{
-    for(uint32 i=0; i<readsmarkedsrm.size(); ++i){
-      if(readsmarkedsrm[i]){
-	needcheckSRM=true;
-	break;
-      }
-    }
   }
 
   // reserve enough space for one edit every 10th base in the consensus
@@ -484,78 +414,101 @@ uint32 Contig::editTrickyOvercalls(const bool onlysetPSHPtags, const bool noSRMr
   all454editcommands.reserve(CON_counts.size()/10);
 
   // initialise the iterator for getting through the contig
-  rcci_t rcci(this,
-	      nullptr,  // all strainids
-	      nullptr,  // all seqtypes
-	      false,            // don't take rails
-	      false,           // nor backbones
-	      false);   // nor reads without readpool-reads
+  rcci_t rcci;
+  {
+    vector<int32> allowedstrainids; // empty would be all ids
+    vector<uint8> allowedreadtypes;
+    //allowedreadtypes.push_back(Read::SEQTYPE_454GS20);
+    readColContigIteratorInit(rcci, 
+			      allowedstrainids, 
+			      allowedreadtypes, 
+			      false,            // don't take rails
+			      false,           // nor backbones
+			      false);   // nor reads without readpool-reads
+  }
+
+  cccontainer_t::iterator ccI=CON_counts.begin();
+  
+  ProgressIndicator<int32> P(0, static_cast<int32>(CON_counts.size())-1);
+
 
   vector<simplebasecounter_t> basecounter(5);
   {
-    static string bases("ACGT*");
+    string bases="ACGT*";
     for(uint32 i=0;i<basecounter.size(); i++){
       basecounter[i].base=bases[i];
       basecounter[i].counter=0;
     }
   }
 
-  uint32 editlock=0;
 
-  auto ccI=CON_counts.begin();
-  ProgressIndicator<int32> P(0, static_cast<int32>(CON_counts.size())-1);
+  uint32 editlock=0;
 
-  for(uint32 actcontigpos=0; actcontigpos<CON_counts.size(); ++ccI, rcci.advance(), ++actcontigpos){
+  for(uint32 actcontigpos=0; actcontigpos<CON_counts.size() ;actcontigpos++, ccI++, readColContigIteratorAdvance(rcci)){
 
     P.progress(actcontigpos);
 
     if(editlock>0) {
-      --editlock;
+      editlock--;
       continue;
     }
 
+    {
+      // have a look at all reads at this position: if one of them was 
+      //  marked in this pass with a SRM, we don't do the 454 edit here
+      //  (because some "corrections" might be due to misassemblies and 
+      //  would be plain wrong)
+      vector<int32>::const_iterator I=rcci.read_ids_in_col.begin();
+      bool readfreshlymarkedsrm=false;
+      for(;I!=rcci.read_ids_in_col.end();I++){
+	if(readsmarkedsrm[CON_reads[*I].orpid]){
+	  readfreshlymarkedsrm=true;
+	  break;
+	}
+      }
+      if(readfreshlymarkedsrm) {
+	continue;
+      }
+    }
+
     // check for disagreement in this column
     uint32 setcount=0;
 
-    if(ccI->A > 0) ++setcount;
-    if(ccI->C > 0) ++setcount;
-    if(ccI->G > 0) ++setcount;
-    if(ccI->T > 0) ++setcount;
-    if(ccI->star > 0) ++setcount;
+    if(ccI->A > 0) setcount++;
+    if(ccI->C > 0) setcount++;
+    if(ccI->G > 0) setcount++;
+    if(ccI->T > 0) setcount++;
+    if(ccI->star > 0) setcount++;
 
     // if more than 1, then there are bases in this column which disagree
     //  (caution: this might be also just an "N", or some other IUPACs)
     // tricky == those with * in column
     if(setcount>1 && ccI->star > 0) {
-      if(needcheckSRM){
-	// have a look at all reads at this position: if one of them was
-	//  marked in this pass with a SRM, we don't do the 454 edit here
-	//  (because some "corrections" might be due to misassemblies and
-	//  would be plain wrong)
-	bool readfreshlymarkedsrm=false;
-	for(auto & pcrI : rcci.getPCRIsInCol()){
-	  if(readsmarkedsrm[pcrI.getORPID()]){
-	    readfreshlymarkedsrm=true;
-	    break;
-	  }
-	}
-	if(readfreshlymarkedsrm) {
-	  continue;
-	}
-      }
-
       CEBUG("cpos: " << actcontigpos << "\t" << ccI->A << " " << ccI->C << " " << ccI->G << " " << ccI->T << " " << ccI->star << endl);
 
-      for(auto & bce : basecounter){
-	bce.counter=0;
+      for(uint32 i=0;i<basecounter.size(); i++){
+	basecounter[i].counter=0;
       }
-      for(auto & pcrI : rcci.getPCRIsInCol()){
-	CEBUG("read: " << pcrI->getName());
-	char  base=pcrI.getBase(actcontigpos);
-	CEBUG("\t" << base << endl);
-
-	for(auto & bce : basecounter){
-	  if(bce.base==base) ++bce.counter;
+      for(uint32 readnr=0; readnr<rcci.read_ids_in_col.size(); readnr++){
+	char           base;
+	int32          actreadid=rcci.read_ids_in_col[readnr];
+	contigread_t & ric =CON_reads[actreadid];
+	
+	int32 readpos=contigPosToUnclippedReadPos(actcontigpos, ric);
+	
+	CEBUG("read: " << ric.read.getName() << '\n');
+	
+	//int32 realreadpos;
+	if(ric.direction>0){
+	  base=static_cast<char>(toupper(ric.read.getBaseInSequence(readpos)));
+	  //realreadpos=readpos;
+	}else{
+	  base=static_cast<char>(toupper(ric.read.getBaseInComplementSequence(readpos)));
+	  //realreadpos=ric.read.calcComplPos(readpos);
+	}
+	
+	for(uint32 i=0;i<basecounter.size(); i++){
+	  if(basecounter[i].base==base) basecounter[i].counter++;
 	}
       }
 
@@ -565,23 +518,23 @@ uint32 Contig::editTrickyOvercalls(const bool onlysetPSHPtags, const bool noSRMr
 	int32 maxsize_i=-1;
 	size_t runnerup=0;
 	int32 runnerup_i=-1;
-
-	for(uint32 bci=0; bci < basecounter.size(); ++bci){
-	  CEBUG("ACGT*"[bci] << "\t" << basecounter[bci].counter << " ");
-	  if(basecounter[bci].counter>=maxsize){
+	
+	for(uint32 i=0; i<basecounter.size(); i++){
+	  CEBUG("ACGT*"[i] << "\t" << basecounter[i].counter << " ");
+	  if(basecounter[i].counter>=maxsize){
 	    runnerup=maxsize;
 	    runnerup_i=maxsize_i;
-	    maxsize=basecounter[bci].counter;
-	    maxsize_i=bci;
-	  }else if(basecounter[bci].counter>=runnerup){
-	    runnerup=basecounter[bci].counter;
-	    runnerup_i=bci;
+	    maxsize=basecounter[i].counter;
+	    maxsize_i=i;
+	  }else if(basecounter[i].counter>=runnerup){
+	    runnerup=basecounter[i].counter;
+	    runnerup_i=i;
 	  }
 	}
 
 	CEBUG("\nmaxsize: " << maxsize << "\ti: " << maxsize_i << "\n");
 	CEBUG("runnerup: " << runnerup << "\ti: " << runnerup_i << "\n");
-
+	
 
 	// index==4 is gap
 	if((maxsize_i==4 && runnerup_i>=0)
@@ -589,12 +542,13 @@ uint32 Contig::editTrickyOvercalls(const bool onlysetPSHPtags, const bool noSRMr
 	  if(maxsize+runnerup == 0){
 	    //addTagToConsensus(actcontigpos, actcontigpos,'=',"T454","DOH?");
 	  }else{
+
 	    if(100*runnerup/(maxsize+runnerup) >= 40){
 	      ostringstream ostr;
 	      ostr << static_cast<char>(basecounter[maxsize_i].base) << ": " << maxsize;
 	      ostr << " " << static_cast<char>(basecounter[runnerup_i].base) << ": " << runnerup;
 	      ostr << "  -  " << 100*runnerup/(maxsize+runnerup) << "%";
-	      addTagToConsensus(actcontigpos,
+	      addTagToConsensus(actcontigpos, 
 				actcontigpos,
 				'=',
 				multitag_t::getIdentifierStr(CON_tagentry_idDGPc).c_str(),
@@ -607,14 +561,14 @@ uint32 Contig::editTrickyOvercalls(const bool onlysetPSHPtags, const bool noSRMr
 	    if(basecounter[maxsize_i].base=='*'){
 	      editlock=edit454checkTrickies(basecounter[runnerup_i].base,
 					    actcontigpos,
-					    rcci.getPCRIsInCol(),
+					    rcci.read_ids_in_col,
 					    all454editcommands,
 					    onlysetPSHPtags,
 					    noSRMreadsallowed);
 	    }else{
 	      editlock=edit454checkTrickies(basecounter[maxsize_i].base,
 					    actcontigpos,
-					    rcci.getPCRIsInCol(),
+					    rcci.read_ids_in_col,
 					    all454editcommands,
 					    onlysetPSHPtags,
 					    noSRMreadsallowed);
@@ -627,77 +581,58 @@ uint32 Contig::editTrickyOvercalls(const bool onlysetPSHPtags, const bool noSRMr
   }
   P.finishAtOnce();
 
-  CEBUG("Generated " << all454editcommands.size() << " tricky mark/edit commands.\n");
-
-  uint32 retval=all454editcommands.size();
+  CEBUG("Generated " << all454editcommands.size() << " 454 edit commands.\n");
   if(all454editcommands.size()) {
-    uint32 numwedits=0;
-    static multitag_t tagPSHP;
-    tagPSHP.setIdentifierStr("PSHP");
-    tagPSHP.source=multitag_t::MT_tagsrcentry_idMIRA;
-    static multitag_t tagR454;
-    tagR454.setIdentifierStr("R454");
-    tagR454.source=multitag_t::MT_tagsrcentry_idMIRA;
-
     if(onlysetPSHPtags){
-      cout << "Marking tricky overcall runs in " << all454editcommands.size() << " cases.\n";
+      cout << "Marking tricky 454 runs in " << all454editcommands.size() << " cases.\n\n";
     }else{
-      cout << "Checking for allowed edits in " << all454editcommands.size() << " cases.\n";
+      cout << "Performing 454 edits in " << all454editcommands.size() << " cases.\n\n";
     }
     sort(all454editcommands.begin(),
 	 all454editcommands.end(), Contig::edit454command_t_comparator);
 
-    for(uint32 aeci=0; aeci<all454editcommands.size(); ++aeci){
-      auto & pcrI =all454editcommands[aeci].pcrI;
-
+    for(uint32 i=0; i<all454editcommands.size(); i++){
+      contigread_t & ric =CON_reads[all454editcommands[i].conreadid];
+    
       if(onlysetPSHPtags){
-	CEBUG("Mark read: " << pcrI->getName());
+	CEBUG("Mark read: " << ric.read.getName());
       }else{
-	if(((*CON_miraparams)[pcrI->getSequencingType()].getEditParams().ed_homopolymer_overcalls)){
-	  CEBUG("EDIT read: " << pcrI->getName());
-	}else{
-	  // user does not want edits in this type of reads
-	  continue;
-	}
+	CEBUG("EDIT read: " << ric.read.getName());
       }
-      CEBUG("\tbase: " << all454editcommands[aeci].base);
-      CEBUG("\tpos: " << all454editcommands[aeci].readpos << endl);
+      CEBUG("\tbase: " << all454editcommands[i].base);
+      CEBUG("\tpos: " << all454editcommands[i].readpos << endl);
 
       if(onlysetPSHPtags){
 	uint32 zeroqualcounts=0;
 	uint32 runfrom=0;
 	uint32 runto=0;
 	try{
-	  uint32 runlength=getBaseRunLength(*pcrI,
-					    all454editcommands[aeci].readpos,
-					    all454editcommands[aeci].base,
+	  uint32 runlength=getBaseRunLength(ric.read,
+					    all454editcommands[i].readpos,
+					    all454editcommands[i].base,
 					    runfrom,
 					    runto,
 					    zeroqualcounts,
 					    true);
 	  if(runlength){
-	    if(runfrom > 0) --runfrom;
-	    if(runto < pcrI->getLenSeq()-1) ++runto;
-	    tagPSHP.from=runfrom;
-	    tagPSHP.to=runto;
-	    const_cast<Read &>(*pcrI).addTagO(tagPSHP);
+	    if(runfrom>0) runfrom--;
+	    if(runto<ric.read.getLenSeq()-1) runto++;
+	    ric.read.addTag(runfrom,runto, "PSHP", "");
 	  }
 	}
 	catch(...){
 	}
       }else{
-	const_cast<Read &>(*pcrI).deleteWeakestBaseInRun(all454editcommands[aeci].base,
-							 all454editcommands[aeci].readpos,
-							 true);
-
-	++numwedits;
-
-	// just in case addTag decided to throw ...
+	ric.read.deleteWeakestBaseInRun(all454editcommands[i].base,
+					all454editcommands[i].readpos,
+					true);
+	
+	// just in case addTag decided to throw ... 
 	// too lazy to do it right at the moment
 	try{
-	  tagR454.from=all454editcommands[aeci].readpos-1;
-	  tagR454.to=all454editcommands[aeci].readpos+1;
-	  const_cast<Read &>(*pcrI).addTagO(tagR454);
+	  ric.read.addTag(all454editcommands[i].readpos-1,
+			  all454editcommands[i].readpos+1,
+			  "R454","");
 	}
 	catch(...){
 	}
@@ -705,10 +640,6 @@ uint32 Contig::editTrickyOvercalls(const bool onlysetPSHPtags, const bool noSRMr
 
     }
 
-    if(!onlysetPSHPtags){
-      //cout << "Performed " << numwedits << " edits.\n";
-      retval=numwedits;
-    }
   }
 
   cout << "\n";
@@ -716,15 +647,15 @@ uint32 Contig::editTrickyOvercalls(const bool onlysetPSHPtags, const bool noSRMr
 
   FUNCEND();
 
-  return retval;
+  return static_cast<uint32>(all454editcommands.size());
 }
 
 
 
 struct trickyrunshistogram_t {
-  vector<PlacedContigReads::const_iterator> seen_pcrIs;
-  vector<uint32> realreadpos_of_reads;
-  vector<char> realbasehypo_of_reads;
+  vector<uint32> seen_ids;
+  vector<uint32> realreadpos_of_ids;
+  vector<char> realbasehypo_of_ids;
   uint32 count_zeroqualadjusted;
   uint32 count_havezeroqual;
 };
@@ -733,15 +664,15 @@ struct trickyrunshistogram_t {
 
 // returns length of base run that is looked at if edited
 // else 0
-uint32 Contig::edit454checkTrickies(const char basehypo, const uint32 actcontigpos, const vector<PlacedContigReads::const_iterator> & pcrIs_in_col, vector<edit454command_t> & editcommands, const bool onlysetPSHPtags, const bool noSRMreadsallowed)
+uint32 Contig::edit454checkTrickies(const char basehypo, const uint32 actcontigpos, const vector<int32> & read_ids_in_col,vector<edit454command_t> & editcommands, const bool onlysetPSHPtags, const bool noSRMreadsallowed)
 {
-  FUNCSTART("uint32 Contig::edit454checkTrickies(const char basehypo, const uint32 actcontigpos, const vector<PlacedContigReads::const_iterator> & pcrIs_in_col, vector<edit454command_t> & editcommands, const bool onlysetPSHPtags, const bool noSRMreadsallowed)");
+  FUNCSTART("void Contig::edit454checkTrickies(const char basehypo, const uint32 actcontigpos, const vector<int32> & read_ids_in_col)");
 
   CEBUG("Checking tricky hypothesis: " << basehypo << " " << actcontigpos << endl);
 
   if(noSRMreadsallowed){
-    for(auto & pcrI : pcrIs_in_col){
-      if(pcrI->hasTag(Read::REA_tagentry_idSRMr)){
+    for(uint32 readnr=0; readnr<read_ids_in_col.size(); readnr++){
+      if(CON_reads[read_ids_in_col[readnr]].read.hasTag(Read::REA_tagentry_idSRMr)){
 	CEBUG("Read with SRM found, but this is presently not allowed at this stage.\n");
 	FUNCEND();
 	return 0;
@@ -759,37 +690,34 @@ uint32 Contig::edit454checkTrickies(const char basehypo, const uint32 actcontigp
 
   uint32 maxspan=0;
 
-  auto & ed_params = (*CON_miraparams)[ReadGroupLib::SEQTYPE_PACBIOLQ].getContigParams();
-  bool lookedatread=false;
-  for(auto & pcrI : pcrIs_in_col){
+  for(uint32 readnr=0; readnr<read_ids_in_col.size(); readnr++){
+    int32          actreadid=read_ids_in_col[readnr];
+    contigread_t & ric =CON_reads[actreadid];
+    
     // do not analyse backbones and rails
-    // look also at reads the user does not want to have edited ... they can tilt the balance toward the
-    //  right number for those which need an edit!
-    if(pcrI->isBackbone()
-       || pcrI->isRail()) continue;
-    //|| !((*CON_miraparams)[pcrI->getSequencingType()].getEditParams().ed_homopolymer_overcalls)) continue;
-
-    lookedatread=true;
-
-    int32 readpos=pcrI.contigPos2UnclippedReadPos(actcontigpos);
-
-    CEBUG("read: " << pcrI->getName()) ; cout.flush();
-
+    if(ric.read.isBackbone() 
+       || ric.read.isRail()) continue;
+    // or reads that are not from 454
+    //|| !ric.read.isSequencingType(Read::SEQTYPE_454GS20)) continue;
+
+    int32 readpos=contigPosToUnclippedReadPos(actcontigpos, ric);
+    
+    CEBUG("read: " << ric.read.getName()) ; cout.flush();
+    
     // to simplify life, we�re going to have this routine
     //  only work with the forward direction of reads
-    // for reads in reverse direction in contig, calculate the "real" values
+    // for reads in reverse direction in contig, calculate the "real" values 
     int32 realreadpos=readpos;
     char realbasehypo=basehypo;
-    if(pcrI.getReadDirection() < 0){
+    if(ric.direction<0){
       realbasehypo=dptools::getComplementBase(realbasehypo);
-      realreadpos=pcrI->calcComplPos(readpos);
+      realreadpos=ric.read.calcComplPos(readpos);
     }
 
+    CEBUG(" " << ric.read.getBaseInSequence(realreadpos) << endl);
 
-    CEBUG(" " << pcrI->getBaseInSequence(realreadpos) << " rbh: " << realbasehypo << " rrp: " << realreadpos << endl);
-
-    if(pcrI->getBaseInSequence(realreadpos) != '*'
-       && pcrI->getBaseInSequence(realreadpos) != realbasehypo){
+    if(ric.read.getBaseInSequence(realreadpos) != '*'
+       && ric.read.getBaseInSequence(realreadpos) != realbasehypo){
       cleanbasehypocolumn=false;
     }
 
@@ -797,14 +725,14 @@ uint32 Contig::edit454checkTrickies(const char basehypo, const uint32 actcontigp
     uint32 runfrom=0;
     uint32 runto=0;
     CEBUG("search runlength" << endl);
-    uint32 runlength=getBaseRunLength(*pcrI,
+    uint32 runlength=getBaseRunLength(ric.read,
 				      realreadpos,
 				      realbasehypo,
 				      runfrom,
 				      runto,
 				      zeroqualcounts,
 				      true);
-    CEBUG("RL " << pcrI->getName() << ": " << runlength << " " << zeroqualcounts << endl);
+    CEBUG("RL " << ric.read.getName() << ": " << runlength << " " << zeroqualcounts << endl);
 
     uint32 span=runto-runfrom;
     if(span>maxspan) maxspan=span;
@@ -819,9 +747,9 @@ uint32 Contig::edit454checkTrickies(const char basehypo, const uint32 actcontigp
       }
     }
     CEBUG("rl in histogramm" << endl);
-    trh[runlength].seen_pcrIs.push_back(pcrI);
-    trh[runlength].realreadpos_of_reads.push_back(realreadpos);
-    trh[runlength].realbasehypo_of_reads.push_back(realbasehypo);
+    trh[runlength].seen_ids.push_back(actreadid);
+    trh[runlength].realreadpos_of_ids.push_back(realreadpos);
+    trh[runlength].realbasehypo_of_ids.push_back(realbasehypo);
     if(zeroqualcounts>0) trh[runlength].count_havezeroqual++;;
 
     // we will delete only one zeroqual base
@@ -832,144 +760,136 @@ uint32 Contig::edit454checkTrickies(const char basehypo, const uint32 actcontigp
     }
     CEBUG("done" << endl);
   }
-
-  bool edit=false;
-  if(lookedatread){
-    CEBUG("Cleanbasehypocolumn: " << cleanbasehypocolumn);
-    CEBUG("\nsearch zqa\n");
-
-    // search for maximum count_zeroqualadjusted in trh
-    //  (but not in the zero-length counts)
-    uint32 maxcountzqa=0;
-    uint32 maxcountzqa_index=0;
-    for(uint32 i=0; i<trh.size(); i++){
-      CEBUG(i << "\t" << trh[i].seen_pcrIs.size() << "\t" << trh[i].count_zeroqualadjusted<< "\t" << trh[i].count_havezeroqual << endl);
-      // changing > to >= favours longer runs with the exact same prediction
-      //  of adjusted reads
-      if(trh[i].count_zeroqualadjusted>=maxcountzqa){
-	maxcountzqa=trh[i].count_zeroqualadjusted;
-	maxcountzqa_index=i;
-      }
+  
+  CEBUG("Cleanbasehypocolumn: " << cleanbasehypocolumn);
+  CEBUG("\nsearch zqa\n");
+
+  // search for maximum count_zeroqualadjusted in trh 
+  //  (but not in the zero-length counts)
+  uint32 maxcountzqa=0;
+  uint32 maxcountzqa_index=0;
+  for(uint32 i=0; i<trh.size(); i++){
+    CEBUG(i << "\t" << trh[i].seen_ids.size() << "\t" << trh[i].count_zeroqualadjusted<< "\t" << trh[i].count_havezeroqual << endl);
+    // changing > to >= favours longer runs with the exact same prediction
+    //  of adjusted reads
+    if(trh[i].count_zeroqualadjusted>=maxcountzqa){
+      maxcountzqa=trh[i].count_zeroqualadjusted;
+      maxcountzqa_index=i;
     }
+  }
 
-    CEBUG("search higher" << endl);
+  CEBUG("search higher" << endl);
 
-    uint32 runsatmczqa=static_cast<uint32>(trh[maxcountzqa_index].seen_pcrIs.size());
-    uint32 runslargermczqa=0;
-    uint32 runswillingtoshorten=0;
-    uint32 expectedlarger=0;
-    for(uint32 i=maxcountzqa_index+1; i<trh.size(); i++){
-      runslargermczqa+=static_cast<uint32>(trh[i].seen_pcrIs.size());
-      expectedlarger+=trh[i].count_zeroqualadjusted;
-      runswillingtoshorten+=trh[i].count_havezeroqual;
-    }
+  uint32 runsatmczqa=static_cast<uint32>(trh[maxcountzqa_index].seen_ids.size());
+  uint32 runslargermczqa=0;
+  uint32 runswillingtoshorten=0;
+  uint32 expectedlarger=0;
+  for(uint32 i=maxcountzqa_index+1; i<trh.size(); i++){
+    runslargermczqa+=static_cast<uint32>(trh[i].seen_ids.size());
+    expectedlarger+=trh[i].count_zeroqualadjusted;
+    runswillingtoshorten+=trh[i].count_havezeroqual;
+  }
 
-    ostringstream ostr;
-
-    const uint32 ratiomultiplier=10;
-    //cout << "TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO \n";
-    //cout << "TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO \n";
-    //cout << "TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO \n";
-    //cout << "Change multiplier back to 10!\n";
-
-    // General routines destined to get out most annoying things
-    // start them if edit not triggered previously
-    if(!edit){
-      CEBUG("General rules.\n");
-      CEBUG("trh.size(): " << trh.size());
-      CEBUG("\nmaxcountzqa_index: " << maxcountzqa_index);
-      CEBUG("\ncleanbasehypocolumn: " << cleanbasehypocolumn);
-      CEBUG("\npcrIs_in_col.size(): " << pcrIs_in_col.size());
-      CEBUG("\nrunsatmczqa: " << runsatmczqa);
-      CEBUG('\n');
-
-      if(trh.size()>maxcountzqa_index+2) {
-	CEBUG("Funny looking histogram, no edit!\n");
-	ostr << "Funny histogram ";
-      }else{
-	if(runslargermczqa>0){
-	  // we have some kind of overcalls
-	  if(runsatmczqa >= runslargermczqa*5){
-	    /* if number of runs of probable length > 10x of the higher runs,
-	       edit. E.g.
-	       .....aAAA.....
-	       .....*AAA.....
-	       .....*AAA.....
-	       .....*AAA.....
-	       .....*AAA.....
-	       etc.
-	    */
-	    edit=true;
-	    ostr << "Smoking gun  ";
-	  }
-	} else if(maxcountzqa_index==1 && cleanbasehypocolumn
-		  && pcrIs_in_col.size() >= runsatmczqa*5){
-	  /* if it's a some unmotivated bases hanging around, being all
-	     the same and less than 10% of the column. E.g.
-
-	     Edit             Edit               No edit
-	     ....TaGGG.....   ....TaGGG..... 	....TaGGG.....
-	     ....T*GGG.....   ....TaGGG..... 	....TcGGG.....
-	     ....T*GGG.....   ....T*GGG..... 	....T*GGG.....
-	     ....T*GGG.....   ....T*GGG..... 	....T*GGG.....
-	     ....T*GGG.....   ....T*GGG..... 	....T*GGG.....
-	     etc.             etc.               etc.
+  bool edit=false;
+  ostringstream ostr;
+
+
+  // General routines destined to get out most annoying things
+  // start them if edit not triggered previously
+  if(!edit){
+    CEBUG("General rules.\n");
+    CEBUG("trh.size(): " << trh.size());
+    CEBUG("\nmaxcountzqa_index: " << maxcountzqa_index);
+    CEBUG("\ncleanbasehypocolumn: " << cleanbasehypocolumn);
+    CEBUG("\nread_ids_in_col.size(): " << read_ids_in_col.size());
+    CEBUG("\nrunsatmczqa: " << runsatmczqa);
+    CEBUG('\n');
+    
+    if(trh.size()>maxcountzqa_index+2) {
+      CEBUG("Funny looking histogram, no edit!\n");
+      ostr << "Funny histogram ";
+    }else{
+      if(runslargermczqa>0){
+	// we have some kind of overcalls
+	if(runsatmczqa >= runslargermczqa*10){
+	  /* if number of runs of probable length > 10x of the higher runs,
+	     edit. E.g.
+	     .....aAAA.....
+	     .....*AAA.....
+	     .....*AAA.....
+	     .....*AAA.....
+	     .....*AAA.....
+	     etc.
 	  */
 	  edit=true;
-	  ostr << "Lone ranger  ";
-	  maxcountzqa_index=0;
+	  ostr << "Smoking gun  ";
 	}
+      } else if(maxcountzqa_index==1 && cleanbasehypocolumn
+		&& read_ids_in_col.size() >= runsatmczqa*10){
+	/* if it's a some unmotivated bases hanging around, being all
+	   the same and less than 10% of the column. E.g.
+	   
+	   Edit             Edit               No edit   
+	   ....TaGGG.....   ....TaGGG..... 	....TaGGG.....
+	   ....T*GGG.....   ....TaGGG..... 	....TcGGG.....
+	   ....T*GGG.....   ....T*GGG..... 	....T*GGG.....
+	   ....T*GGG.....   ....T*GGG..... 	....T*GGG.....
+	   ....T*GGG.....   ....T*GGG..... 	....T*GGG.....
+	   etc.             etc.               etc.
+	*/
+	edit=true;
+	ostr << "Lone ranger  ";
+	maxcountzqa_index=0;
       }
     }
-    if(edit) {
-      CEBUG("Editing!\n");
-      ostr << "Edit: " << basehypo;
-      if(trh.size()>maxcountzqa_index+2) {
-	/* ??? strategie leicht �ndern in: wenn auch edits bei
-	   maxcountzqa_index+2, dann erst die */
-	ostr << " Caution!";
-	CEBUG("CAUTION!\n");
-	maxcountzqa_index++;
-      }
-    }else{
-      ostr << "No edit.";
+  }
+  if(edit) {
+    CEBUG("Editing!\n");
+    ostr << "Edit: " << basehypo;
+    if(trh.size()>maxcountzqa_index+2) {
+      /* ??? strategie leicht �ndern in: wenn auch edits bei 
+	 maxcountzqa_index+2, dann erst die */
+      ostr << " Caution!";
+      CEBUG("CAUTION!\n");
+      maxcountzqa_index++;
     }
-    ostr << " PL: " << maxcountzqa_index;      // probable length
-    ostr << " RS: " << runsatmczqa;            // reads that are this length
-    ostr << " RL: " << runslargermczqa;        // reads that are larger
-    ostr << " RWTS: " << runswillingtoshorten; // reads willing to shorten
-    ostr << " EL: " << expectedlarger;         // reads expected to be larger
-    //  after editing
-
-    addTagToConsensus(actcontigpos, actcontigpos,'=',"H454",ostr.str().c_str(),true);
-
-    CEBUG(ostr.str() << '\n');
-
-    if(edit){
-      // current strategy:
-      // now that we know that we need to shorten a few reads at this
-      //  position, shorten *all* reads larger than the length we determined
-      //  (maxcountzqa_index) by one base (the weakest base). However, the
-      //  base quality of the weakest base now does not need to be 0.
-
-      uint32 acttrh=maxcountzqa_index+1;
-
-      // addition: if only marking PSHP runs, mark all reads at that position
-      if(onlysetPSHPtags){
-	acttrh=0;
-      }
-
-      for(; acttrh<trh.size(); ++acttrh){
-	uint32 readnr=0;
-	for(auto & pcrI : trh[acttrh].seen_pcrIs){
-	  CEBUG("Saving EDIT: read: " << pcrI->getName() << " " << pcrI->getBaseInSequence(trh[acttrh].realreadpos_of_reads[readnr]) << " (" << trh[acttrh].realbasehypo_of_reads[readnr] << ") at " << trh[acttrh].realreadpos_of_reads[readnr] << endl);
-	  editcommands.push_back(edit454command_t(pcrI,
-						  pcrI.getURDID(),
-						  trh[acttrh].realreadpos_of_reads[readnr], //realreadpos
-						  trh[acttrh].realbasehypo_of_reads[readnr]) //realbasehypo
-	    );
-	  ++readnr;
-	}
+  }else{
+    ostr << "No edit.";
+  }
+  ostr << " PL: " << maxcountzqa_index;      // probable length
+  ostr << " RS: " << runsatmczqa;            // reads that are this length
+  ostr << " RL: " << runslargermczqa;        // reads that are larger
+  ostr << " RWTS: " << runswillingtoshorten; // reads willing to shorten
+  ostr << " EL: " << expectedlarger;         // reads expected to be larger
+                                             //  after editing
+  
+  addTagToConsensus(actcontigpos, actcontigpos,'=',"H454",ostr.str().c_str(),true);
+
+  CEBUG(ostr.str() << '\n');
+
+  if(edit){
+    // current strategy:
+    // now that we know that we need to shorten a few reads at this
+    //  position, shorten *all* reads larger than the length we determined
+    //  (maxcountzqa_index) by one base (the weakest base). However, the
+    //  base quality of the weakest base now does not need to be 0.
+
+    uint32 acttrh=maxcountzqa_index+1;
+
+    // addition: if only marking PSHP runs, mark all reads at that position
+    if(onlysetPSHPtags){
+      acttrh=0;
+    }
+    
+    for(; acttrh<trh.size(); acttrh++){
+      for(uint32 readnr=0; readnr<trh[acttrh].seen_ids.size(); readnr++){
+	CEBUG("Saving EDIT: read: " << CON_reads[trh[acttrh].seen_ids[readnr]].read.getName() << " " << CON_reads[trh[acttrh].seen_ids[readnr]].read.getBaseInSequence(trh[acttrh].realreadpos_of_ids[readnr]) << endl; cout.flush());
+	//ric.read.deleteWeakestBaseInRun(realbasehypo, realreadpos);
+
+	editcommands.resize(editcommands.size()+1);
+	editcommands.back().conreadid=trh[acttrh].seen_ids[readnr]; //actreadid;
+	editcommands.back().base=trh[acttrh].realbasehypo_of_ids[readnr]; //realbasehypo;
+	editcommands.back().readpos=trh[acttrh].realreadpos_of_ids[readnr]; //realreadpos
       }
     }
   }
@@ -985,97 +905,80 @@ uint32 Contig::edit454checkTrickies(const char basehypo, const uint32 actcontigp
 
 
 
+
+
+
+
+
+
+
+
 /*************************************************************************
  *
- * Performs edits on bases in reads which lack a HAF2-7 (or HAF3-7) tag
  *
- * editmode:
- *  0 : very conservative, only columns with a single discrepancy
- *  1 : conservative, only columns where non-consensus bases occur once
- *  2 : slightly less conservative: edits where consensus base 8 times more
- *      frequent than non-cons base
- *  3 : like 2, but also edits bases with count <=2 and a HAF2 tag which
- *      is directly bordered by HAF3-7 tags
- *      Mode 3 is NOT SUITED FOR EST/RNASEQ assemblies!!!
+ *
  *
  *************************************************************************/
 
 
 //#define CEBUG(bla)   {cout << bla; cout.flush();}
 
-uint32 Contig::editSingleDiscrepancyNoHAFTag(vector<bool> & readsmarkedsrm, uint8 editmode)
+uint32 Contig::editSingleDiscrepancyNoHAFTag(vector<bool> & readsmarkedsrm)
 {
   FUNCSTART("uint32 Contig::editSingleDiscrepancyNoHAFTag(vector<bool> & readsmarkedsrm)");
 
-  if(editmode>3) editmode=3;
-
   cout << "\nSearching for single discr. without HAF tags:\n";
 
   uint32 numedits=0;
 
-  // with new increasing kmer sizes per pass, sometimes reads will get no HAF tags anymore
-  //  (e.g., mixing hiseqs 150bp with miseqs 300)
-  // However, the reads without any HAF tag should not be edited.
-  // Keep that info in this vector, will be sorted and then used with binary search search
-  //  for lookup
-  vector<readid_t> readswithhafs;
-
   // see whether we have some HAF tags at all (if not -> no edit!)
   {
     bool foundhaf=false;
-    for(auto pcrI=CON_reads.begin(); pcrI!=CON_reads.end(); ++pcrI){
-      if(pcrI.getORPID() < 0
-	 || pcrI->isBackbone()
-	 || pcrI->isRail()) continue;
-
-      foundhaf=pcrI->hasTag(Read::REA_tagentry_idHAF3);
-      if(!foundhaf) foundhaf=pcrI->hasTag(Read::REA_tagentry_idHAF5);
-      if(!foundhaf) foundhaf=pcrI->hasTag(Read::REA_tagentry_idHAF4);
-      if(!foundhaf) foundhaf=pcrI->hasTag(Read::REA_tagentry_idHAF6);
-      if(!foundhaf) foundhaf=pcrI->hasTag(Read::REA_tagentry_idHAF7);
-      if(!foundhaf) foundhaf=pcrI->hasTag(Read::REA_tagentry_idHAF2);
-      if(foundhaf){
-	if(readswithhafs.size()<CON_reads.size()){
-	  readswithhafs.reserve(CON_reads.size());
-	}
-	readswithhafs.push_back(pcrI.getORPID());
-      }
+    vector<contigread_t>::const_iterator crI=CON_reads.begin();
+    for(; crI != CON_reads.end() && !foundhaf; ++crI){
+      if(crI->orpid<0
+	 || crI->read.isBackbone()
+	 || crI->read.isRail()) continue;
+
+      foundhaf=crI->read.hasTag(Read::REA_tagentry_idHAF3);
+      if(!foundhaf) foundhaf=crI->read.hasTag(Read::REA_tagentry_idHAF5);
+      if(!foundhaf) foundhaf=crI->read.hasTag(Read::REA_tagentry_idHAF4);
+      if(!foundhaf) foundhaf=crI->read.hasTag(Read::REA_tagentry_idHAF6);
+      if(!foundhaf) foundhaf=crI->read.hasTag(Read::REA_tagentry_idHAF7);
+      if(!foundhaf) foundhaf=crI->read.hasTag(Read::REA_tagentry_idHAF2);
     }
     if(!foundhaf){
-      cout << "No read with HAF tags found.\n";
       FUNCEND();
       return 0;
     }
   }
 
-  sort(readswithhafs.begin(),readswithhafs.end());
-
-  definalise();
-
-  bool needcheckSRM=false;
+  // if we were called with an incorrectly sized readsmarkedsrm vector
+  //  (empty or whatever), assume no SRM frshly set
   if(readsmarkedsrm.size() != CON_readpool->size()){
-    // if we were called with an incorrectly sized readsmarkedsrm vector
-    //  (empty or whatever), assume no SRM freshly set
     readsmarkedsrm.clear();
     readsmarkedsrm.resize(CON_readpool->size(),false);
-  }else{
-    for(uint32 i=0; i<readsmarkedsrm.size(); ++i){
-      if(readsmarkedsrm[i]){
-	needcheckSRM=true;
-	break;
-      }
-    }
   }
 
   // initialise the iterator for getting through the contig
-  rcci_t rcci(this,
-	      nullptr,  // all strainids
-	      nullptr,  // all seqtypes
-	      false,            // don't take rails
-	      false,           // nor backbones
-	      false);   // nor reads without readpool-reads
-
-  vector<uint8> allowededits(6);
+  rcci_t rcci;
+  {
+    vector<int32> allowedstrainids; // empty would be all ids
+    vector<uint8> allowedreadtypes;
+    //allowedreadtypes.push_back(Read::SEQTYPE_454GS20);
+    readColContigIteratorInit(rcci, 
+			      allowedstrainids, 
+			      allowedreadtypes, 
+			      false,            // don't take rails
+			      false,           // nor backbones
+			      false);   // nor reads without readpool-reads
+  }
+
+  cccontainer_t::iterator ccI=CON_counts.begin();
+  
+  ProgressIndicator<int32> P(0, static_cast<int32>(CON_counts.size())-1);
+
+
   vector<simplebasecounter_t> basecounter(6);
   {
     static const string bases="ACGT*N";
@@ -1085,751 +988,158 @@ uint32 Contig::editSingleDiscrepancyNoHAFTag(vector<bool> & readsmarkedsrm, uint
     }
   }
 
-  ProgressIndicator<int32> P(0, static_cast<int32>(CON_counts.size())-1);
-  auto ccI=CON_counts.begin();
 
-  for(uint32 actcontigpos=0; actcontigpos<CON_counts.size(); ++actcontigpos, ++ccI, rcci.advance()){
+  for(uint32 actcontigpos=0; actcontigpos<CON_counts.size() ;actcontigpos++, ccI++, readColContigIteratorAdvance(rcci)){
 
     P.progress(actcontigpos);
 
     // must be at least at coverage 5
     if(ccI->total_cov<5) continue;
 
+    {
+      // have a look at all reads at this position: if one of them was 
+      //  marked in this pass with a SRM, we don't do the 454 edit here
+      //  (because some "corrections" might be due to misassemblies and 
+      //  would be plain wrong)
+      vector<int32>::const_iterator I=rcci.read_ids_in_col.begin();
+      bool readfreshlymarkedsrm=false;
+      for(;I!=rcci.read_ids_in_col.end();I++){
+	if(readsmarkedsrm[CON_reads[*I].orpid]){
+	  readfreshlymarkedsrm=true;
+	  break;
+	}
+      }
+      if(readfreshlymarkedsrm) {
+	continue;
+      }
+    }
+
     // check for disagreement in this column
     uint32 setcount=0;
 
-    if(ccI->A > 0) ++setcount;
-    if(ccI->C > 0) ++setcount;
-    if(ccI->G > 0) ++setcount;
-    if(ccI->T > 0) ++setcount;
-    if(ccI->N > 0) ++setcount;
-    if(ccI->star > 0) ++setcount;
+    if(ccI->A > 0) setcount++;
+    if(ccI->C > 0) setcount++;
+    if(ccI->G > 0) setcount++;
+    if(ccI->T > 0) setcount++;
+    if(ccI->N > 0) setcount++;
+    if(ccI->star > 0) setcount++;
 
     // if more than 1, then there are bases in this column which disagree
     //  (caution: this might be also just an "N", or some other IUPACs)
     if(setcount>1) {
-      if(needcheckSRM){
-	// have a look at all reads at this position: if one of them was
-	//  marked in this pass with a SRM, we don't do the edit here
-	//  (because some "corrections" might be due to misassemblies and
-	//  would be plain wrong)
-	bool readfreshlymarkedsrm=false;
-	for(auto & tpcrI : rcci.getPCRIsInCol()){
-	  if(tpcrI.getORPID() >=0 && readsmarkedsrm[tpcrI.getORPID()]){
-	    readfreshlymarkedsrm=true;
-	    break;
-	  }
-	}
-	if(readfreshlymarkedsrm) {
-	  continue;
-	}
-      }
-
-
       CEBUG("cpos: " << actcontigpos << "\t" << ccI->A << " " << ccI->C << " " << ccI->G << " " << ccI->T << " " << ccI->N << " " << ccI->star << endl);
 
-      for(auto & bce : basecounter){
-	bce.counter=0;
+      for(uint32 i=0;i<basecounter.size(); i++){
+	basecounter[i].counter=0;
       }
-      for(auto & tpcrI : rcci.getPCRIsInCol()){
-	char base;
-	int32 readpos=tpcrI.contigPos2UnclippedReadPos(actcontigpos);
-
-	//CEBUG("read: " << tpcrI->getName() << '\n');
-
-	//int32 realreadpos;
-	if(tpcrI.getReadDirection() > 0){
-	  base=static_cast<char>(toupper(tpcrI->getBaseInSequence(readpos)));
-	  //realreadpos=readpos;
+      for(uint32 readnr=0; readnr<rcci.read_ids_in_col.size(); readnr++){
+	char           base;
+	int32          actreadid=rcci.read_ids_in_col[readnr];
+	contigread_t & ric =CON_reads[actreadid];
+	
+	int32 readpos=contigPosToUnclippedReadPos(actcontigpos, ric);
+	
+	CEBUG("read: " << ric.read.getName() << '\n');
+	
+	int32 realreadpos;
+	if(ric.direction>0){
+	  base=static_cast<char>(toupper(ric.read.getBaseInSequence(readpos)));
+	  realreadpos=readpos;
 	}else{
-	  base=static_cast<char>(toupper(tpcrI->getBaseInComplementSequence(readpos)));
-	  //realreadpos=tpcrI->calcComplPos(readpos);
+	  base=static_cast<char>(toupper(ric.read.getBaseInComplementSequence(readpos)));
+	  realreadpos=ric.read.calcComplPos(readpos);
 	}
-
-	for(auto & bce : basecounter){
-	  if(bce.base==base) ++bce.counter;
+	
+	for(uint32 i=0;i<basecounter.size(); i++){
+	  if(basecounter[i].base==base) basecounter[i].counter++;
 	}
       }
 
       uint32 maxcount=0;
-      for(uint32 bci=0; bci<basecounter.size(); ++bci){
-	maxcount=max(maxcount,basecounter[bci].counter);
-	CEBUG("bc["<<bci<<"]: " << basecounter[bci].base << " " << basecounter[bci].counter << endl);
+      for(uint32 i=0;i<basecounter.size(); i++){
+	maxcount=max(maxcount,basecounter[i].counter);
+	CEBUG("bc["<<i<<"]: " << basecounter[i].base << " " << basecounter[i].counter << endl);
       }
 
-      if(maxcount<3) continue;
-
-      for(auto & aee : allowededits) aee=0;
-
       // maxi = index of consensus base if >=0
       int32 maxi=-1;
-
-      uint32 nddb=0; // num different discrepancy bases
-      for(uint32 bci=0; bci<basecounter.size(); ++bci){
-	if(basecounter[bci].counter==maxcount) {
+      // singlei = index of single base if >=0
+      int32 singlei=-1;
+      for(uint32 i=0;i<basecounter.size(); i++){
+	if(basecounter[i].counter==maxcount) {
 	  if(maxi>=0){
 	    maxi=-1;
 	    break;
 	  }
-	  maxi=bci;
+	  maxi=i;
 	}
-	if(editmode <=1){
-	  if(basecounter[bci].counter==1) {
-	    allowededits[bci]=1;
-	    ++nddb;
-	  }
-	}else if(editmode==2){
-	  if(basecounter[bci].counter>0 && basecounter[bci].counter*8 < maxcount) {
-	    allowededits[bci]=1;
-	    ++nddb;
-	  }
-	}else if(editmode==3){
-	  if(basecounter[bci].counter>0 && basecounter[bci].counter<=2 && basecounter[bci].counter*8 < maxcount) {
-	    allowededits[bci]=1;
-	    ++nddb;
+	if(basecounter[i].counter==1) {
+	  if(singlei>=0){
+	    singlei=-1;
+	    break;
 	  }
-	}else{
-	  MIRANOTIFY(Notify::INTERNAL,"unknown editmode " << static_cast<uint16>(editmode));
+	  singlei=i;
 	}
       }
 
-      CEBUG("mc: " << maxcount << "\tmi: " << maxi << "\tnddb: " << nddb << '\t');
-      for(uint32 bci=0;bci<basecounter.size(); ++bci){
-	CEBUG(basecounter[bci].base << static_cast<uint16>(allowededits[bci]) << ' ');
-      }
-      CEBUG(endl);
-
-      if(maxi<0
-	 || (editmode==0 && nddb>1)) continue;
-
-      char repbase=static_cast<char>(tolower(basecounter[maxi].base));
-
-      for(auto & tpcrI : rcci.getPCRIsInCol()){
-	if(tpcrI->isSequencingType(ReadGroupLib::SEQTYPE_PACBIOLQ)) continue;
-	if(!binary_search(readswithhafs.begin(), readswithhafs.end(), tpcrI.getORPID())) continue; // no edit if no HAF tag at all
-
-	int32 readpos=tpcrI.contigPos2UnclippedReadPos(actcontigpos);
-
-	CEBUG("read: " << tpcrI->getName());
-
-	char base;
-	int32 realreadpos;
-	if(tpcrI.getReadDirection() > 0){
-	  base=static_cast<char>(toupper(tpcrI->getBaseInSequence(readpos)));
-	  realreadpos=readpos;
-	}else{
-	  base=static_cast<char>(toupper(tpcrI->getBaseInComplementSequence(readpos)));
-	  realreadpos=tpcrI->calcComplPos(readpos);
-	}
-
-	CEBUG('\t' << base);
-
-	// not optimal regarding speed, but let's not care atm
-	bool docheck=false;
-	for(uint32 bci=0;bci<basecounter.size(); ++bci){
-	  if(basecounter[bci].base==base){
-	    if(allowededits[bci]) docheck=true;
+      CEBUG("mc: " << maxcount << "\tsi: " << singlei << "\tmi: " << maxi << endl);
+
+      if(maxi>=0 && singlei>=0){
+	char repbase=static_cast<char>(tolower(basecounter[maxi].base));
+	
+	for(uint32 readnr=0; readnr<rcci.read_ids_in_col.size(); readnr++){
+	  char           base;
+	  int32          actreadid=rcci.read_ids_in_col[readnr];
+	  contigread_t & ric =CON_reads[actreadid];
+	  
+	  int32 readpos=contigPosToUnclippedReadPos(actcontigpos, ric);
+	  
+	  CEBUG("read: " << ric.read.getName() << '\n');
+	  
+	  int32 realreadpos;
+	  if(ric.direction>0){
+	    base=static_cast<char>(toupper(ric.read.getBaseInSequence(readpos)));
+	    realreadpos=readpos;
+	  }else{
+	    base=static_cast<char>(toupper(ric.read.getBaseInComplementSequence(readpos)));
+	    realreadpos=ric.read.calcComplPos(readpos);
 	  }
-	}
 
-	if(docheck){
-	  CEBUG("\tcheck");
-
-	  bool doedit=false;
-	  // not optimal regarding speed, but let's not care atm
-	  bool foundtag=tpcrI->hasTag(Read::REA_tagentry_idHAF3,realreadpos);
-	  if(!foundtag) foundtag=tpcrI->hasTag(Read::REA_tagentry_idHAF4,realreadpos);
-	  if(!foundtag) foundtag=tpcrI->hasTag(Read::REA_tagentry_idHAF5,realreadpos);
-	  if(!foundtag) foundtag=tpcrI->hasTag(Read::REA_tagentry_idHAF6,realreadpos);
-	  if(!foundtag) foundtag=tpcrI->hasTag(Read::REA_tagentry_idHAF7,realreadpos);
-
-	  bool foundtag2=tpcrI->hasTag(Read::REA_tagentry_idHAF2,realreadpos);
-
-	  if(!(foundtag||foundtag2)){
-	    // no HAF tag at all
-	    doedit=true;
-	  }else if(editmode==3 && !foundtag && foundtag2){
-	    // HAF2 tag, check left and right for HAF3-7
-	    CEBUG("\tcheckh2");
-	    bool h2ok=false;
-	    if(realreadpos>0){
-	      auto rrp2=realreadpos-1;
-	      foundtag=tpcrI->hasTag(Read::REA_tagentry_idHAF3,rrp2);
-	      if(!foundtag) foundtag=tpcrI->hasTag(Read::REA_tagentry_idHAF4,rrp2);
-	      if(!foundtag) foundtag=tpcrI->hasTag(Read::REA_tagentry_idHAF5,rrp2);
-	      if(!foundtag) foundtag=tpcrI->hasTag(Read::REA_tagentry_idHAF6,rrp2);
-	      if(!foundtag) foundtag=tpcrI->hasTag(Read::REA_tagentry_idHAF7,rrp2);
-
-	      rrp2+=2;
-	      if(foundtag && rrp2 < tpcrI->getLenSeq()){
-		foundtag=tpcrI->hasTag(Read::REA_tagentry_idHAF3,rrp2);
-		if(!foundtag) foundtag=tpcrI->hasTag(Read::REA_tagentry_idHAF4,rrp2);
-		if(!foundtag) foundtag=tpcrI->hasTag(Read::REA_tagentry_idHAF5,rrp2);
-		if(!foundtag) foundtag=tpcrI->hasTag(Read::REA_tagentry_idHAF6,rrp2);
-		if(!foundtag) foundtag=tpcrI->hasTag(Read::REA_tagentry_idHAF7,rrp2);
-
-		if(foundtag){
-		  doedit=true;
-		}
+	  if(base==basecounter[singlei].base){
+	    // not optimal regarding speed, but let's not care atm
+	    bool foundtag=ric.read.hasTag(Read::REA_tagentry_idHAF3,realreadpos);
+	    if(!foundtag) foundtag=ric.read.hasTag(Read::REA_tagentry_idHAF4,realreadpos);
+	    if(!foundtag) foundtag=ric.read.hasTag(Read::REA_tagentry_idHAF5,realreadpos);
+	    if(!foundtag) foundtag=ric.read.hasTag(Read::REA_tagentry_idHAF6,realreadpos);
+	    if(!foundtag) foundtag=ric.read.hasTag(Read::REA_tagentry_idHAF7,realreadpos);
+
+	    if(!foundtag) foundtag=ric.read.hasTag(Read::REA_tagentry_idHAF2,realreadpos);
+
+	    if(!foundtag){
+	      if(ric.direction>0){
+		ric.read.changeBaseInSequence(repbase,0,realreadpos);
+	      }else{
+		ric.read.changeBaseInSequence(dptools::getComplementIUPACBase(repbase),0,realreadpos);
 	      }
+	      // replacing with a gap? technically, it's a deletion followed by an insertion
+	      // therefore, the adjustment must be ... errr ... adjusted
+	      if(repbase=='*' && ric.read.usesAdjustments()){
+		ric.read.changeAdjustment(realreadpos,-1);
+	      }
+	      addTagToConsensus(actcontigpos, actcontigpos,'=',"ESDN","",true);
+	      ++numedits;
+	      break;
 	    }
 	  }
-	  if(doedit){
-	    CEBUG("\tdoedit");
-	    if(tpcrI.getReadDirection() > 0){
-	      const_cast<Read &>(*tpcrI).changeBaseInSequence(repbase,0,realreadpos);
-	    }else{
-	      const_cast<Read &>(*tpcrI).changeBaseInSequence(dptools::getComplementIUPACBase(repbase),0,realreadpos);
-	    }
-	    // replacing with a gap? technically, it's a deletion followed by an insertion
-	    // therefore, the adjustment must be ... errr ... adjusted
-	    if(repbase=='*' && tpcrI->usesAdjustments()){
-	      const_cast<Read &>(*tpcrI).changeAdjustment(realreadpos,-1);
-	    }
-	    addTagToConsensus(actcontigpos, actcontigpos,'=',"ESDN","",true);
-	    ++numedits;
-	  }
 	}
-	CEBUG(endl);
       }
     }
   }
 
   P.finishAtOnce();
 
-  if(numedits) priv_rebuildConCounts();
+  if(numedits) rebuildConCounts();
 
   FUNCEND();
   return numedits;
 }
-//#define CEBUG(bla)
-
-
-
-
-
-
-#define CEBUGF2(bla)  {cout << bla; cout.flush();}
-//#define CEBUGF2(bla)
-
-// looks very much like newMarkPossibleRepeats()
-
-
-void Contig::editPBSledgeHammer(vector<bool> & readsmarkedsrm, uint32 & numcoledits, uint32 & numreadedits)
-{
-  FUNCSTART("void Contig::editPBSledgeHammer(vector<bool> & readsmarkedsrm)");
-
-  BUGIFTHROW(true,"need redo ce2 for PlacedContigReads");
-
-  definalise();
-
-////++++////  CEBUGF2("SledgeHammer" << endl;);
-////++++////
-////++++////  numcoledits=0;
-////++++////  numreadedits=0;
-////++++////
-////++++////  bool needcheckSRM=false;
-////++++////  if(readsmarkedsrm.size() != CON_readpool->size()){
-////++++////    // if we were called with an incorrectly sized readsmarkedsrm vector
-////++++////    //  (empty or whatever), assume no SRM freshly set
-////++++////    readsmarkedsrm.clear();
-////++++////    readsmarkedsrm.resize(CON_readpool->size(),false);
-////++++////  }else{
-////++++////    for(uint32 i=0; i<readsmarkedsrm.size(); ++i){
-////++++////      if(readsmarkedsrm[i]){
-////++++////	needcheckSRM=true;
-////++++////	break;
-////++++////      }
-////++++////    }
-////++++////  }
-////++++////
-////++++////  checkContig();
-////++++////
-////++++////  // this is "the truth"
-////++++////  string concons;
-////++++////  {
-////++++////    vector<base_quality_t> dummy;
-////++++////    newConsensusGet(concons,dummy,-1);
-////++++////  }
-////++++////
-////++++////  // get number of strains in this contig
-////++++////  uint32 numstrains=0;
-////++++////  for(uint32 i=0; i<CON_reads.size(); i++){
-////++++////    if(static_cast<uint32>(CON_reads[i].read.getStrainID()) > numstrains){
-////++++////      numstrains=CON_reads[i].read.getStrainID();
-////++++////    }
-////++++////  }
-////++++////  // remember: default strain has ID =0, so we have +1 strains
-////++++////  numstrains++;
-////++++////
-////++++////  //contig_parameters const & con_params= CON_miraparams->getContigParams();
-////++++////
-////++++////  static const string groupbases("ACGT*");
-////++++////
-////++++////  nngroups_t emptygroup;
-////++++////  emptygroup.base='!';
-////++++////  emptygroup.valid=false;
-////++++////  emptygroup.forwarddircounter=0;
-////++++////  emptygroup.complementdircounter=0;
-////++++////  emptygroup.groupquality=0;
-////++++////
-////++++////  // groups per seqtype per strain, empty template
-////++++////  vector<vector<vector <nngroups_t> > > emptygroups_st_st;
-////++++////
-////++++////  emptygroups_st_st.resize(ReadGroupLib::getNumSequencingTypes());
-////++++////  for(uint32 seqtype=0; seqtype<ReadGroupLib::getNumSequencingTypes(); seqtype++){
-////++++////    emptygroups_st_st[seqtype].resize(numstrains);
-////++++////    for(uint32 strainid=0; strainid<numstrains; strainid++){
-////++++////      for(uint32 actgroup=0; actgroup<groupbases.size(); actgroup++){
-////++++////	emptygroups_st_st[seqtype][strainid].push_back(emptygroup);
-////++++////	emptygroups_st_st[seqtype][strainid].back().base=groupbases[actgroup];
-////++++////      }
-////++++////    }
-////++++////  }
-////++++////
-////++++////  // groups per seqtype per strain, the real thing
-////++++////  vector<vector<vector <nngroups_t> > > groups_st_st;
-////++++////
-////++++////
-////++++////  nnpos_rep_col_t emptyprc;
-////++++////  emptyprc.ids.clear();
-////++++////  emptyprc.groupbases.clear();
-////++++////  emptyprc.groupquals.clear();
-////++++////  emptyprc.type=Read::REA_tagentry_idEmpty;
-////++++////  emptyprc.contigpos=0;
-////++++////  emptyprc.is_dangerous=false;
-////++++////  emptyprc.tagged=false;
-////++++////
-////++++////
-////++++////
-////++++////  vector<int8> maskshadow;
-////++++////  vector<multitag_t::mte_id_t> masktagtypes;
-////++++////  buildMaskShadow(maskshadow,masktagtypes,false);
-////++++////
-////++++////  CEBUGF2("Start." << endl);
-////++++////
-////++++////  // the ercci is for the analysis of the bases themselves
-////++++////  //
-////++++////  ercci_t ercci;
-////++++////  extendedReadColContigIteratorInit(ercci,
-////++++////				    false,        // don't take rails
-////++++////				    true,        // take backbone
-////++++////				    numstrains);
-////++++////
-////++++////  // initialise the iterator for getting through the contig
-////++++////  rcci_t rcci;
-////++++////  {
-////++++////    vector<int32> allowedstrainids; // empty would be all ids
-////++++////    vector<uint8> allowedreadtypes;
-////++++////    allowedreadtypes.push_back(ReadGroupLib::SEQTYPE_PACBIOLQ);
-////++++////    readColContigIteratorInit(rcci,
-////++++////			      allowedstrainids,
-////++++////			      allowedreadtypes,
-////++++////			      false,            // don't take rails
-////++++////			      false,           // nor backbones
-////++++////			      false);   // nor reads without readpool-reads
-////++++////  }
-////++++////
-////++++////
-////++++////
-////++++////  // evil hack:
-////++++////  // we use nmpr_firstfillin (or maybe csbrm_fillin_groups_stst()?) and
-////++++////  //  nmpr_rategroups, but need some slightly different parameters for PacBio.
-////++++////  // Therefore, save the original values and swap them
-////++++////  //  back at the end of the function
-////++++////
-////++++////  contig_parameters orig_pbl_con_params = (*CON_miraparams)[ReadGroupLib::SEQTYPE_PACBIOLQ].getContigParams();
-////++++////  contig_parameters & nc_pbl_con_params = const_cast<contig_parameters &>((*CON_miraparams)[ReadGroupLib::SEQTYPE_PACBIOLQ].getContigParams());
-////++++////  // for nmpr_firstfillin
-////++++////  nc_pbl_con_params.con_endreadmarkexclusionarea=10;
-////++++////  nc_pbl_con_params.con_minrmbneighbourqual=0;
-////++++////  // for nmpr_rategroups
-////++++////  nc_pbl_con_params.con_mingroupqualforrmbtagging=10;
-////++++////  nc_pbl_con_params.con_minreadspergroup=4;
-////++++////
-////++++////  ProgressIndicator<int32> P(0, static_cast<int32>(CON_counts.size()));
-////++++////  auto ccI=CON_counts.begin();
-////++++////  for(uint32 actcontigpos=0; actcontigpos<CON_counts.size() ;actcontigpos++, ccI++, extendedReadColContigIteratorAdvance(ercci), readColContigIteratorAdvance(rcci)){
-////++++////    P.progress(actcontigpos);
-////++++////    //if(actcontigpos>6000) continue;
-////++++////    CEBUGF2("acp: " << actcontigpos << endl);
-////++++////
-////++++////    // check for disagreement in this column
-////++++////    if((ccI->A > 0)+(ccI->C > 0)+(ccI->G > 0)+(ccI->T > 0)+(ccI->N > 0)+(ccI->star > 0) <= 1) continue;
-////++++////
-////++++////    // ok, there are some disagreements
-////++++////    CEBUGF2("Disagreement pos " << actcontigpos << ' ' << *ccI << endl);
-////++++////
-////++++////    if(needcheckSRM){
-////++++////      // have a look at all reads at this position: if one of them was
-////++++////      //  marked in this pass with a SRM, we don't do the edit here
-////++++////      //  (because some "corrections" might be due to misassemblies and
-////++++////      //  would be plain wrong)
-////++++////      vector<int32>::const_iterator I=rcci.read_ids_in_col.begin();
-////++++////      bool readfreshlymarkedsrm=false;
-////++++////      for(;I!=rcci.read_ids_in_col.end();I++){
-////++++////	if(readsmarkedsrm[CON_reads[*I].orpid]){
-////++++////	  readfreshlymarkedsrm=true;
-////++++////	  break;
-////++++////	}
-////++++////      }
-////++++////      if(readfreshlymarkedsrm) {
-////++++////	continue;
-////++++////      }
-////++++////    }
-////++++////
-////++++////
-////++++////    // TODO: continue here
-////++++////    groups_st_st=emptygroups_st_st;
-////++++////
-////++++////    // put the bases of the different reads into groups
-////++++////    nmpr_firstfillin(ercci, maskshadow, masktagtypes, groups_st_st);
-////++++////    nmpr_rategroups(groups_st_st, ccI);
-////++++////
-////++++////    // nmpr_rategroups will always set gap base groups to non valid
-////++++////    //  therefore, need to "correct that" for PacBioLQ
-////++++////    //
-////++++////    // at the same time, count how many different groups are set altogether
-////++++////    uint32 numvalidgroups=0;
-////++++////    vector<bool> validgroupmask(groupbases.size(),false);
-////++++////    {
-////++++////      for(uint32 seqtype=0; seqtype<ReadGroupLib::getNumSequencingTypes(); seqtype++){
-////++++////	for(uint32 strainid=0; strainid<numstrains; strainid++){
-////++++////	  CEBUGF2("seqt: " << seqtype << "\tstrid: " << strainid << '\n');
-////++++////	  for(uint32 actgroup=0; actgroup<groupbases.size(); actgroup++){
-////++++////	    if(seqtype==ReadGroupLib::SEQTYPE_PACBIOLQ){
-////++++////	      CEBUGF2("Group " << actgroup << '\n');
-////++++////	      CEBUGF2(groups_st_st[seqtype][strainid][actgroup]);
-////++++////	    }
-////++++////	    if(seqtype==ReadGroupLib::SEQTYPE_PACBIOLQ && actgroup==4){
-////++++////	      if(groups_st_st[seqtype][strainid][actgroup].forwarddircounter>2
-////++++////		 && groups_st_st[seqtype][strainid][actgroup].complementdircounter>2
-////++++////		 && groups_st_st[seqtype][strainid][actgroup].groupquality>=nc_pbl_con_params.con_mingroupqualforrmbtagging
-////++++////		 && static_cast<int32>(groups_st_st[seqtype][strainid][actgroup].ids.size()) >= nc_pbl_con_params.con_minreadspergroup){
-////++++////	        groups_st_st[seqtype][strainid][actgroup].valid=true;
-////++++////	      }
-////++++////	    }
-////++++////	    if(groups_st_st[seqtype][strainid][actgroup].valid){
-////++++////	      CEBUGF2("Valid possible group " << actgroup << '\n');
-////++++////	      CEBUGF2(groups_st_st[seqtype][strainid][actgroup]);
-////++++////	      if(!validgroupmask[actgroup]){
-////++++////		validgroupmask[actgroup]=true;
-////++++////		numvalidgroups++;
-////++++////	      }
-////++++////	    }
-////++++////	  }
-////++++////	}
-////++++////      }
-////++++////    }
-////++++////
-////++++////    CEBUGF2("numvalidgroups: " << numvalidgroups <<endl);
-////++++////
-////++++////    // OK, make it only for clear cases
-////++++////    if(numvalidgroups==1){
-////++++////      char validbase='?';
-////++++////      for(uint32 vgbcounter=0; vgbcounter<validgroupmask.size(); ++vgbcounter){
-////++++////	if(validgroupmask[vgbcounter]){
-////++++////	  validbase=groupbases[vgbcounter];
-////++++////	  break;
-////++++////	}
-////++++////      }
-////++++////      char consbase=static_cast<char>(toupper(concons[actcontigpos]));
-////++++////      CEBUGF2("vb: " << validbase << "\tcb: " << consbase <<endl);
-////++++////      if(consbase==validbase){
-////++++////	// Good, good. Consensus and only valid base group agree
-////++++////	// That is ... edit away everything else (within boundaries)
-////++++////
-////++++////	char lvalidbase=static_cast<char>(tolower(validbase));
-////++++////	bool hasreadedit=false;
-////++++////	for(uint32 strainid=0; strainid<groups_st_st[0].size(); strainid++){
-////++++////	  for(uint32 readnr=0; readnr < rcci.read_ids_in_col.size(); readnr++){
-////++++////	    int32    actreadid =rcci.read_ids_in_col[readnr];
-////++++////	    if(CON_reads[actreadid].read.isSequencingType(ReadGroupLib::SEQTYPE_PACBIOLQ)){
-////++++////	      contigread_t & ric =CON_reads[actreadid];
-////++++////	      char          base =toupper(ric.getBase(rcci.actcontigpos));
-////++++////	      if(base!=validbase){
-////++++////		//ric.setBase(rcci.actcontigpos,'n',0);
-////++++////		ric.setBase(rcci.actcontigpos,lvalidbase,0);
-////++++////		hasreadedit=true;
-////++++////		++numreadedits;
-////++++////	      }
-////++++////	    }
-////++++////	  }
-////++++////	}
-////++++////	if(hasreadedit) ++numcoledits;
-////++++////      }
-////++++////    }
-////++++////  }
-////++++////
-////++++////  // put back the original PacBio LQ contig params
-////++++////  nc_pbl_con_params=orig_pbl_con_params;
-////++++////
-////++++////if(numreadedits) rebuildConCounts();
-
-  FUNCEND();
-}
-
-// check ec55989_70815+ near start   aaagccgcgXcac
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-void Contig::blindContig()
-{
-  FUNCSTART("void Contig::blindContig()");
-
-  definalise();
-
-  auto cI=CON_reads.begin();
-  for(; cI != CON_reads.end(); ++cI){
-    if(cI.getReadDirection() > 0){
-      const_cast<Read &>(*cI).blindSeqData('c');
-    }else{
-      const_cast<Read &>(*cI).blindSeqData('g');
-    }
-  }
-
-  FUNCEND();
-}
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-void Contig::upDownCase(base_quality_t threshold)
-{
-  FUNCSTART("void Contig::upDownCase(base_quality_t threshold)");
-
-  definalise();
-
-  for(auto & pcre : CON_reads){
-    const_cast<Read &>(pcre).upDownCase(threshold);
-  }
-
-  FUNCEND();
-}
-
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-//#define CEBUG(bla)
-
-//#define WIGGLETRACK
-//void Contig::reduceReadsAtCoveragePeaks(ccctype_t avgcov, vector<uint8> & peakindicator, deque<readid_t> & readsremoved)
-void Contig::reduceReadsAtCoveragePeaks(ccctype_t avgcov, vector<uint8> & peakindicator, unordered_set<readid_t> & readsremoved)
-{
-  FUNCSTART("void Contig::reduceReadsAtCoveragePeaks(ccctype_t avgcov, vector<uint8> & peakindicator, unordered_set<readid_t> & readsremoved)");
-
-  CEBUG("rRATCO: " << avgcov << endl);
-
-  BUGIFTHROW(peakindicator.size()!=CON_counts.size(),"peakindicator.size()!=CON_counts.size()");
-  readsremoved.clear();
-
-#ifdef WIGGLETRACK
-  {
-    ccctype_t maxc=0;
-    for(auto & cce : CON_counts) maxc=max(maxc,cce.total_cov);
-    ofstream ofs;
-    dbgOpenWiggle(ofs,"cov.wig",getContigName(),"cov",maxc);
-    for(auto & cce : CON_counts) ofs << cce.total_cov << '\n';
-  }
-#endif
-
-  // First, make a copy of the total coverage, we'll work on that copy to track
-  //  coverage when first virtually removing reads
-  vector<ccctype_t> virtcoverage(CON_counts.size());
-  {
-    auto vI=virtcoverage.begin();
-    for(auto & cce : CON_counts){
-      *vI=cce.total_cov;
-      ++vI;
-    }
-  }
-
-  // collect single mates in peaks which *should* have a mate in this contig
-  // virtually remove them down to a coverage of 100% of avg coverage
-  //  do not remove those which would make the coverage fall below that value
-  priv_rratcp_collectReadsToDelete(avgcov,peakindicator,virtcoverage,false,false,readsremoved);
-#ifdef WIGGLETRACK
-  dbgContainerToWiggle(virtcoverage,getContigName(),"vcovms");
-#endif
-
-  // collect paired mates in peaks of this contig
-  // virtually remove them down to a coverage of 90% of avg coverage
-  //  do not remove those which would make the coverage fall below that value
-  priv_rratcp_collectReadsToDelete((avgcov*9)/10,peakindicator,virtcoverage,false,true,readsremoved);
-#ifdef WIGGLETRACK
-  dbgContainerToWiggle(virtcoverage,getContigName(),"vcovmp");
-#endif
-
-  // now collect unpaired reads which contribute to overcoverage (of still existing)
-  // but only down to 66% of avg coverage
-  priv_rratcp_collectReadsToDelete((avgcov*2)/3,peakindicator,virtcoverage,true,false,readsremoved);
-#ifdef WIGGLETRACK
-  dbgContainerToWiggle(virtcoverage,getContigName(),"vcovsr");
-#endif
-
-  // if reads were virtually removed, remove them now from the contig
-  if(!readsremoved.empty()){
-    uint32 numr=0;
-    auto pcrI=CON_reads.begin();
-    while(pcrI!=CON_reads.end()){
-      if(readsremoved.find(pcrI.getORPID()) != readsremoved.end()) {
-	pcrI=deleteRead(pcrI);
-	++numr;
-      }else{
-	++pcrI;
-      }
-    }
-    CEBUG("Removed " << numr << " reads, " << readsremoved.size() << " planned.\n");
-  }
-
-  //    check for contig without coverage -> error!
-  {
-    for(auto ccI=CON_counts.begin(); ccI!=CON_counts.end(); ++ccI){
-      BUGIFTHROW(ccI->total_cov==0,"Ouch: found 0 coverage in " << getContigName() << " at position " << ccI-CON_counts.begin());
-    }
-  }
-}
-#undef CEBUG
-#undef WIGGLETRACK
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-#define CEBUG(bla)
-void Contig::priv_rratcp_collectReadsToDelete(ccctype_t minthresh, vector<uint8> & peakindicator, vector<ccctype_t> & virtcoverage, bool remunpaired, bool pairmustbeincontig, unordered_set<readid_t> & readsremoved)
-{
-  FUNCSTART("void Contig::priv_rratcp_helper(ccctype_t minthresh, vector<uint8> & peakindicator, vector<ccctype_t> & virtcoverage, bool checktprid, unordered_set<readid_t> & readsremoved)");
-
-  BUGIFTHROW(remunpaired&&pairmustbeincontig,"remunpaired&&pairmustbeincontig ???");
-
-  // careful with minthresh==1 as we might encounter the following situation: overlapping
-  //  paired-end at a coverage of 2. These would be both removed and then ... bang.
-  // Two possible solutions:
-  //  1) force minthreshold of 2
-  //  2) make priv_rratcp_checkDeletable() check what it does (small time penalty)
-  // let's choose 1) here
-  if(minthresh<2) return;  // coverage too low anyway
-
-  CEBUG("Collecting at minthresh " << minthresh << "\t" << remunpaired << "\t" << pairmustbeincontig << endl);
-
-  auto pcrI=CON_reads.begin();
-  auto opcrI=pcrI;
-  auto crE=CON_reads.end();
-  for(; pcrI != crE; ++pcrI){
-    CEBUG("Looking at " << pcrI.getORPID() << "\t" << pcrI->getName() << endl);
-    opcrI=CON_reads.getIteratorOfReadpoolID(pcrI->getTemplatePartnerID());
-    bool tpartnerincontig=opcrI!=crE;
-    CEBUG(pcrI->isBackbone() << '\t' << pcrI->isRail() << '\t' << pcrI->isCoverageEquivalentRead() << '\t' << remunpaired << '\t' << pairmustbeincontig << '\t' << pcrI->hasTemplateInfo()  << '\t' << pcrI->getTemplatePartnerID() << '\t' << tpartnerincontig << endl);
-    if(!pcrI->isBackbone()
-       && !pcrI->isRail()
-       && !pcrI->isCoverageEquivalentRead()){
-      bool checkthis=false;
-      bool checktp=false;
-      if(!pcrI->hasTemplateInfo()){
-	if(remunpaired) checkthis=true;
-      }else{
-	if(pairmustbeincontig){
-	  if(tpartnerincontig){
-	    checkthis=true;
-	    checktp=true;
-	  }
-	}else{
-	  if(!tpartnerincontig && shouldHaveTPartnerInContig(pcrI,opcrI)){
-	    checkthis=true;
-	  }
-	}
-      }
-
-      bool delthis=false;
-      if(checkthis && priv_rratcp_checkDeletable(pcrI,minthresh,peakindicator,virtcoverage)){
-	delthis=true;
-      }
-      bool deltp=false;
-      if(delthis && checktp){
-	if(opcrI!=CON_reads.end() && priv_rratcp_checkDeletable(opcrI,minthresh,peakindicator,virtcoverage)){
-	  deltp=true;
-	}else{
-	  delthis=false;
-	}
-      }
-      // make sure that mates are not deleted twice
-      // pairs of the same length with the same start site will
-      //  also not be deleted, but when will this happen on real data? Almost never,
-      //  so don't care
-      if(delthis && deltp){
-	if(pcrI.getReadStartOffset()>opcrI.getReadStartOffset()
-	   || (pcrI.getReadStartOffset()==opcrI.getReadStartOffset()
-	       && pcrI->getLenClippedSeq() >= opcrI->getLenClippedSeq())){
-	  delthis=false;
-	  deltp=false;
-	}
-      }
-
-      // check whether previously removed
-      if(delthis && readsremoved.find(pcrI.getORPID())!=readsremoved.end()) delthis=false;
-      if(deltp && readsremoved.find(opcrI.getORPID())!=readsremoved.end()) deltp=false;
-
-      if(delthis){
-	CEBUG("PR removing " << pcrI->getName() << '\t' << pcrI.getReadStartOffset() << endl);
-	auto vcI=virtcoverage.begin()+pcrI.getReadStartOffset();
-	auto vcE=vcI+pcrI->getLenClippedSeq();
-	for(; vcI!=vcE; ++vcI) *vcI-=1;;
-	readsremoved.insert(pcrI.getORPID());
-	if(deltp){
-	  CEBUG("PR removing TP " << opcrI->getName() << '\t' << opcrI.getReadStartOffset() << endl);
-	  vcI=virtcoverage.begin()+opcrI.getReadStartOffset();
-	  vcE=vcI+opcrI->getLenClippedSeq();
-	  for(; vcI!=vcE; ++vcI) *vcI-=1;;
-	  readsremoved.insert(opcrI.getORPID());
-	}
-      }
-    }
-  }
-}
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-#define CEBUG(bla)
-bool Contig::priv_rratcp_checkDeletable(PlacedContigReads::const_iterator pcrI, ccctype_t minthresh, vector<uint8> & peakindicator, vector<ccctype_t> & virtcoverage)
-{
-  FUNCSTART("bool Contig::priv_rratcp_checkDeletable(PlacedContigReads::const_iterator pcrI, ccctype_t minthresh, vector<uint8> & peakindicator, vector<ccctype_t> & virtcoverage)");
-
-  // careful here because of overlapping paired-end at coverage 2
-  // instead of complicated checking, just make sure we bail out if we encounter
-  //  a situation which should not be (and should have been handled earlier)
-  BUGIFTHROW(minthresh<2,"minthresh<2 ???");
-
-  CEBUG("Checking " << pcrI.getORPID() << "\t" << pcrI->getName() << endl);
-  {
-    auto piI=peakindicator.begin()+pcrI.getReadStartOffset();
-    auto piE=piI+pcrI->getLenClippedSeq();
-    for(; piI!=piE && *piI; ++piI);
-    // not completely covered by peak? forget it, next read
-    if(piI != piE){
-      CEBUG("No peak coverage " << pcrI->getName() << '\t' << pcrI.getReadStartOffset() << endl);
-      return false;
-    }
-  }
-  {
-    auto vcI=virtcoverage.begin()+pcrI.getReadStartOffset();
-    auto vcE=vcI+pcrI->getLenClippedSeq();
-    for(; vcI!=vcE && *vcI>minthresh; ++vcI);
-    // coverage somewhere below threshold? forget it, next read
-    if(vcI != vcE) {
-      CEBUG("Would like to remove, but coverage drop " << pcrI->getName() << '\t' << pcrI.getReadStartOffset() << endl);
-      return false;
-    }
-  }
-  return true;
-}
-#undef CEBUG
diff --git a/src/mira/contig_featureinfo.C b/src/mira/contig_featureinfo.C
deleted file mode 100644
index 908ad2d..0000000
--- a/src/mira/contig_featureinfo.C
+++ /dev/null
@@ -1,623 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
- *   Krebsforschungszentrum, DKFZ Heidelberg) and Bastien Chevreux
- * Copyright (C) 2000 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-
-#include "contig.H"
-
-#include "io/annotationmappings.H"
-#include "mira/gff_parse.H"
-
-
-using namespace std;
-
-
-/*************************************************************************
- *
- * copy first all Genbank features of all reads into one big vector
- *  if allowedfeatures not empty: only the features named there
- *  if forbiddenfeatures not empty: do not take features named there
- *
- * reads that have  Fsrc, Fgen, FCDS, Fexn, or Fint can get additional
- *  intergenic regions simulated if wished
- *
- * list is sorted ascending before given back by contigfrom, to and lastly
- *  by identifier (Fsrc, Fgen, FCDS, rest)
- *
- *************************************************************************/
-//#define CEBUGF2(bla)  {cout << bla; cout.flush();}
-#define CEBUGF2(bla)
-
-void Contig::getGBFSummary(list<gbfsummary_t> & allGBfeatures, const vector<multitag_t::mte_id_t> & allowedfeatures, const vector<multitag_t::mte_id_t> & forbiddenfeatures, bool simulateintergenics, bool alsomiraconstags) const
-{
-  FUNCSTART("void Contig::getGBFSummary(list<gbfsummary_t> & allGBfeatures, const vector<multitag_t::mte_id_t> & allowedfeatures, const vector<multitag_t::mte_id_t> & forbiddenfeatures, bool simulateintergenics) const");
-
-  allGBfeatures.clear();
-
-  vector<int8> featuremask;
-  uint32 igrcounter=0;
-
-  gff3attributes_t gff3a;
-
-  for(auto pcrI=CON_reads.begin(); pcrI != CON_reads.end(); ++pcrI){
-    featuremask.clear();
-
-    //CEBUGF2(pcrI->read);
-    bool mustsimulateigr=false;
-    if(simulateintergenics){
-      for(auto & thetag : pcrI->getTags()){
-	// with or without databank entry???
-	if(thetag.identifier==Read::REA_tagentry_idSOFAdatabank_entry
-	   || thetag.identifier==Read::REA_tagentry_idSOFAgene
-	   || thetag.identifier==Read::REA_tagentry_idSOFACDS
-	   || thetag.identifier==Read::REA_tagentry_idSOFAexon
-	   || thetag.identifier==Read::REA_tagentry_idSOFAintron
-	   || thetag.identifier==Read::REA_tagentry_idSOFAmRNA
-	   || thetag.identifier==Read::REA_tagentry_idSOFAtranscript
-	   || thetag.identifier==Read::REA_tagentry_idSOFAprimary_transcript
-	   || thetag.identifier==Read::REA_tagentry_idSOFArRNA
-	   || thetag.identifier==Read::REA_tagentry_idSOFAscRNA
-	   || thetag.identifier==Read::REA_tagentry_idSOFAsnRNA
-	   || thetag.identifier==Read::REA_tagentry_idSOFAtRNA
-	  ){
-	  mustsimulateigr=true;
-	  break;
-	}
-      }
-    }
-
-    for(auto & thetag : pcrI->getTags()){
-      CEBUGF2("la this: " << thetag << endl);
-      if(thetag.isSourceMIRA()) continue;
-
-      // next tag if tag is completely outside of the good read part
-      if(!((thetag.from >= pcrI->getLeftClipoff()
-	    && thetag.from < pcrI->getRightClipoff())
-	   || (thetag.to >= pcrI->getLeftClipoff()
-	       && thetag.to < pcrI->getRightClipoff()))) continue;
-
-      bool musttakeit=true;
-      if(!allowedfeatures.empty()) {
-	musttakeit=false;
-	for(uint32 i=0;i<allowedfeatures.size();i++){
-	  if(thetag.identifier == allowedfeatures[i]){
-	    musttakeit=true;
-	    break;
-	  }
-	}
-      }
-
-
-      if(!forbiddenfeatures.empty()) {
-	for(uint32 i=0;i<forbiddenfeatures.size();i++){
-	  if(thetag.identifier == forbiddenfeatures[i]){
-	    musttakeit=false;
-	    break;
-	  }
-	}
-      }
-
-      bool isgene=false;
-      if(thetag.identifier==Read::REA_tagentry_idSOFAgene
-	 || thetag.identifier==Read::REA_tagentry_idSOFACDS
-	 || thetag.identifier==Read::REA_tagentry_idSOFAexon
-	 || thetag.identifier==Read::REA_tagentry_idSOFAintron
-	 || thetag.identifier==Read::REA_tagentry_idSOFAmRNA
-	 || thetag.identifier==Read::REA_tagentry_idSOFAtranscript
-	 || thetag.identifier==Read::REA_tagentry_idSOFAprimary_transcript
-	 || thetag.identifier==Read::REA_tagentry_idSOFArRNA
-	 || thetag.identifier==Read::REA_tagentry_idSOFAscRNA
-	 || thetag.identifier==Read::REA_tagentry_idSOFAsnRNA
-	 || thetag.identifier==Read::REA_tagentry_idSOFAtRNA
-	){
-	isgene=true;
-      }
-
-      if(musttakeit) {
-	gbfsummary_t onefeature(pcrI);
-	string extracted;
-
-	CEBUGF2("Have this:\n"<<thetag<<endl);
-
-	onefeature.identifier=thetag.getIdentifierStr();
-
-	onefeature.mustbetranslated=false;
-	if(thetag.identifier==Read::REA_tagentry_idSOFACDS){
-	  onefeature.mustbetranslated=true;
-	}
-	onefeature.cfrom=pcrI.unclippedReadPos2ContigPos(thetag.from);
-	onefeature.cto=pcrI.unclippedReadPos2ContigPos(thetag.to);
-
-	onefeature.direction=thetag.getStrandDirection();
-	onefeature.strainid=pcrI->getStrainID();
-
-	if(thetag.commentisgff3){
-	  CEBUGF2("Tag is GFF3, parsing attributes\n");
-	  GFFParse::parseGFF3Attributes(thetag.getCommentStr(),gff3a);
-	  onefeature.translationtable=11;
-	  onefeature.codonstart=1;
-
-	  for(auto & gfe : gff3a){
-	    if(!gfe.values.empty()){
-	      if(gfe.tag=="locus_tag"){
-		onefeature.locustag=gfe.values[0];
-	      }else if(gfe.tag=="function"){
-		onefeature.function=gfe.values[0];
-	      }else if(gfe.tag=="eC_number"){
-		onefeature.ecnumber=gfe.values[0];
-	      }else if(gfe.tag=="product"){
-		onefeature.product=gfe.values[0];
-	      }else if(gfe.tag=="note"){
-		onefeature.note=gfe.values[0];
-	      }else if(gfe.tag=="Note"){
-		onefeature.note=gfe.values[0];
-	      }else if(gfe.tag=="transl_table"){
-		onefeature.translationtable=static_cast<int8>(atoi(gfe.values[0].c_str()));
-	      }else if(gfe.tag=="codon_start"){
-		onefeature.codonstart=static_cast<int8>(atoi(gfe.values[0].c_str()));
-	      }
-	    }
-	  }
-	  if(thetag.phase!=3) onefeature.codonstart+=thetag.phase;
-	  onefeature.gene=GFFParse::extractCommonName(thetag.getCommentStr(),true);
-	}else{
-	  CEBUGF2("Tag is not GFF3, simply adding\n");
-	  onefeature.note="Note="+thetag.getCommentStr();
-	}
-
-	onefeature.isgene=isgene;
-
-	CEBUGF2("Extracted feature:\n" << onefeature);
-
-	allGBfeatures.push_back(onefeature);
-      }
-
-      // preparing for intergenic regions: mask away this feature from read
-      if(isgene){
-	if(featuremask.empty()) featuremask.resize(pcrI->getLenSeq(),1);
-	for(uint32 pos=thetag.from; pos<=thetag.to; pos++){
-	  if(pos<pcrI->getLenSeq()) featuremask[pos]=0;
-	}
-      }
-    }
-
-    // if there were GenBank features in this read, simulate intergenic
-    //  features
-    if(!featuremask.empty() && mustsimulateigr){
-      CEBUGF2("mustsimulateigr: " << mustsimulateigr << '\n');
-      CEBUGF2("Simulate IGR for " << pcrI->getName() << '\n');
-      bool inintergenic=false;
-      uint32 runstart=0;
-      for(uint32 pos=0; pos <= pcrI->getLenSeq(); pos++){
-	if(pos < pcrI->getLenSeq()){
-	  CEBUGF2("featuremask[" << pos << "]:\t" << static_cast<uint16>(featuremask[pos]) << endl);
-	}
-	if(pos == pcrI->getLenSeq() || featuremask[pos]==0){
-	  if(inintergenic){
-	    gbfsummary_t onefeature(pcrI);
-
-	    onefeature.identifier="Figr";
-
-	    onefeature.mustbetranslated=false;
-	    int32 tmp=pcrI.unclippedReadPos2ContigPos(runstart);
-	    if(tmp<0) tmp=0;
-	    onefeature.cfrom=tmp;
-	    if(pos == pcrI->getLenSeq()){
-	      // carefull: if at end of sequence, we must take -1
-	      //  or else the tag will be one too long
-	      onefeature.cto=pcrI.unclippedReadPos2ContigPos(pos-1);
-	    }else{
-	      onefeature.cto=pcrI.unclippedReadPos2ContigPos(pos);
-	    }
-	    onefeature.direction=1;
-	    onefeature.strainid=pcrI->getStrainID();
-	    onefeature.isgene=false;
-	    allGBfeatures.push_back(onefeature);
-
-	    CEBUGF2("Made IGR:\n" << onefeature);
-
-	    inintergenic=false;
-	    runstart=0;
-	  }
-	}else{
-	  if(!inintergenic){
-	    inintergenic=true;
-	    runstart=pos;
-	  }
-	}
-      }
-    }
-  }
-
-  CEBUGF2("going to sort 1\n");
-  allGBfeatures.sort(Contig::gbfsummary_t_comparator);
-  CEBUGF2("sorted\n");
-
-  // assign names to the intergenic regions
-  if(simulateintergenics){
-    string gene;
-    string function;
-    string ecnumber;
-    string product;
-    string note;
-
-    string concatstring="; ";
-
-    for(auto gbfsI=allGBfeatures.begin(); gbfsI != allGBfeatures.end(); ++gbfsI){
-      if(gbfsI->identifier == "Figr"){
-      	ostringstream newlocusostr;
-      	ostringstream newnoteostr;
-
-      	newlocusostr << "IGR_";
-      	newnoteostr << "Intergenic between ";
-
-CEBUGF2("#1\n");
-
-      	bool foundprevious=false;
-      	if(gbfsI != allGBfeatures.begin()){
-	  auto gbfsImm=gbfsI;
-
-CEBUGF2("#2\n");
-	  while (gbfsImm != allGBfeatures.begin()
-		 && gbfsI->pcrI == gbfsImm->pcrI
-		 && (gbfsImm == gbfsI || gbfsImm->isgene==false)) gbfsImm--;
-
-CEBUGF2("#3\n");
-	  if(gbfsI->pcrI == gbfsImm->pcrI) {
-	    newlocusostr << gbfsImm->locustag << '_';
-CEBUGF2("#4\n");
-	    concatAllGBFInfoForLocus(allGBfeatures, gbfsImm, concatstring, gene, function, ecnumber, product, note);
-CEBUGF2("#5\n");
-	    if(gene.empty()){
-	      newnoteostr << gbfsImm->locustag << " and ";
-	    }else{
-	      newnoteostr << gene << " and ";
-	    }
-CEBUGF2("#6\n");
-	    foundprevious=true;
-	  }
-	}
-CEBUGF2("#7\n");
-      	if(!foundprevious){
-      	  newlocusostr << "seqstart_";
-      	  newnoteostr << "sequence start and ";
-      	}
-
-      	if(gbfsI != allGBfeatures.end()) {
-CEBUGF2("#8\n");
-	  auto gbfsImm=gbfsI;
-	  while (gbfsImm != allGBfeatures.end()
-		 && gbfsI->pcrI == gbfsImm->pcrI
-		 && (gbfsImm == gbfsI || gbfsImm->isgene==false)) gbfsImm++;
-
-CEBUGF2("#9\n");
-	  foundprevious=false;
-	  if(gbfsImm != allGBfeatures.end()
-	     && gbfsI->pcrI == gbfsImm->pcrI) {
-CEBUGF2("#a\n");
-	    newlocusostr << gbfsImm->locustag;
-CEBUGF2("#b\n");
-	    concatAllGBFInfoForLocus(allGBfeatures, gbfsImm, concatstring, gene, function, ecnumber, product, note);
-CEBUGF2("#c\n");
-	    if(gene.empty()){
-	      newnoteostr << gbfsImm->locustag;
-	    }else{
-	      newnoteostr << gene;
-	    }
-CEBUGF2("#d\n");
-	    foundprevious=true;
-	  }
-	}
-	if(!foundprevious){
-      	  newlocusostr << "seqend";
-      	  newnoteostr << "sequence end";
-      	}
-
-CEBUGF2("#e\n");
-      	gbfsI->locustag=newlocusostr.str();
-      	gbfsI->note = newnoteostr.str();
-CEBUGF2("#f\n");
-      }
-    }
-    CEBUGF2("going to sort 2\n");
-    allGBfeatures.sort(Contig::gbfsummary_t_comparator);
-    CEBUGF2("sorted\n");
-  }
-
-  {
-    // silly gcc 4.6.x does not do "gbfsummary_t onefeature(CON_reads.end());" *sigh*
-    auto tmp=CON_reads.end();
-    bool hasnewtag=false;
-    for(auto & cte : CON_consensus_tags){
-      if((!cte.getSourceStr().empty() && !cte.isSourceMIRA())
-	 || (alsomiraconstags)){
-//	     (AnnotationMappings::isMIRAEntry(cte.getIdentifierStr())
-//	      || AnnotationMappings::isValidGAP4Entry(cte.getIdentifierStr())))){
-	gbfsummary_t onefeature(tmp);
-	if(cte.identifier == CON_tagentry_idSAOc
-	   || cte.identifier == CON_tagentry_idSIOc
-	   || cte.identifier == CON_tagentry_idSROc
-	   || cte.identifier == CON_tagentry_idSRMc
-	   || cte.identifier == CON_tagentry_idIUPc
-	   || cte.identifier == CON_tagentry_idUNSc) {
-	  onefeature.identifier="sequence_variant";
-	}else if(cte.identifier == CON_tagentry_idMCVc) {
-	  onefeature.identifier="gap";
-	}else{
-	  //onefeature.identifier="region";
-	}
-	if(onefeature.identifier.empty()) continue;
-	onefeature.cfrom=cte.from;
-	onefeature.cto=cte.to;
-	onefeature.direction=1;
-	if(cte.commentisgff3){
-	  onefeature.note=GFFParse::extractKeytag("Note",cte.getCommentStr());
-	}else{
-	  onefeature.note=cte.getCommentStr();
-	}
-	allGBfeatures.push_back(onefeature);
-	hasnewtag=true;
-
-	//cout << "Seen: " << cte << endl;
-	//cout << "Pushed back: " << onefeature << endl;
-      }
-    }
-
-    if(hasnewtag) {
-      CEBUGF2("going to sort 3\n");
-      allGBfeatures.sort(Contig::gbfsummary_t_comparator);
-      CEBUGF2("sorted\n");
-    }
-  }
-}
-//#define CEBUGF2(bla)
-
-
-/*************************************************************************
- *
- * append b to a if b != a;
- * if a was not empty, also add a concat string inbetween
- *
- *************************************************************************/
-
-void Contig::myappend(string & a, const string & b, const string & concatstring) const
-{
-  if(!b.empty() && b != a) {
-    if(!a.empty()) a+=concatstring;
-    a+=b;
-  }
-}
-
-
-/*************************************************************************
- *
- * GenBank annotations are sometimes scattered across different identifiers
- *  of a locus. Starting from a known locus, this function collects
- *  all information for gene, function, ecnumber, product and note
- *
- * Expects the list to be sorted
- *
- *************************************************************************/
-
-void Contig::concatAllGBFInfoForLocus(const list<gbfsummary_t> & allGBfeatures, list<gbfsummary_t>::const_iterator gbelementI, const string & concatstring, string & gene, string & function, string & ecnumber, string & product, string & note) const
-{
-  gene.clear();
-  function.clear();
-  ecnumber.clear();
-  product.clear();
-  note.clear();
-
-  if(gbelementI == allGBfeatures.end()) return;
-
-//  list<gbfsummary_t>::const_iterator gbfsI=gbelementI;
-//  // search first element with that locus
-//  while (gbfsI != allGBfeatures.begin() && gbfsI->locustag == gbelementI->locustag) gbfsI--;
-//  gbfsI++;
-//
-//  for(; gbfsI != allGBfeatures.end() && gbfsI->locustag == gbelementI->locustag; gbfsI++){
-//    myappend(gene, gbfsI->gene, concatstring);
-//    myappend(function, gbfsI->function, concatstring);
-//    myappend(ecnumber, gbfsI->ecnumber, concatstring);
-//    myappend(product, gbfsI->product, concatstring);
-//    myappend(note, gbfsI->note, concatstring);
-//  }
-
-
-  list<gbfsummary_t>::const_iterator gbfsI=gbelementI;
-  // search first element with that locus
-  while (gbfsI != allGBfeatures.begin() && gbfsI->cfrom >= gbelementI->cfrom) gbfsI--;
-  gbfsI++;
-  list<gbfsummary_t>::const_iterator gbfsE=gbfsI;
-  while (gbfsE != allGBfeatures.end() && gbfsE->cfrom <= gbelementI->cto) gbfsE++;
-
-  for(; gbfsI != gbfsE; gbfsI++){
-    if(gbfsI->locustag == gbelementI->locustag
-      && gbfsI->cfrom == gbelementI->cfrom
-      && gbfsI->cto == gbelementI->cto) {
-      myappend(gene, gbfsI->gene, concatstring);
-      myappend(function, gbfsI->function, concatstring);
-      myappend(ecnumber, gbfsI->ecnumber, concatstring);
-      myappend(product, gbfsI->product, concatstring);
-      myappend(note, gbfsI->note, concatstring);
-    }
-  }
-
-  return;
-}
-
-
-
-/*************************************************************************
- *
- * go through reads of a contig and and fetch all SequenceOntology
- *  tags to the return list
- *
- * position of tags in list will be positions in the contig
- *
- * // HMMM list is sorted ascending before given back by contigfrom, to and lastly
- *  by identifier (Fsrc, Fgen, FCDS, rest)
- *
- *************************************************************************/
-//#define CEBUGF2(bla)  {cout << bla; cout.flush();}
-
-#define CEBUGF2(bla)
-void Contig::getSeqOntTags(list<contigSOtag_t> & allSOfeatures)
-{
-  FUNCSTART("void Contig::getSeqOntTags(list<contigSOtag_t> & allSOfeatures)");
-
-  allSOfeatures.clear();
-
-  contigSOtag_t emptycsot;
-
-  for(auto pcrI=CON_reads.begin(); pcrI != CON_reads.end(); ++pcrI){
-    if(pcrI.getORPID() < 0) continue;
-    // for testing:
-    // pcrI->sortTagsForGFF3();
-    for(uint32 ti=0; ti < pcrI->getNumOfTags(); ++ti){
-      const multitag_t & acttag=pcrI->getTag(ti);
-
-      if(!acttag.identifierIsValidGFF3SOEntry()) continue;
-
-      // next tag if tag is completely outside of the good read part
-      if(!((acttag.from >= pcrI->getLeftClipoff()
-	    && acttag.from < pcrI->getRightClipoff())
-	   || (acttag.to >= pcrI->getLeftClipoff()
-	       && acttag.to < pcrI->getRightClipoff()))) continue;
-      allSOfeatures.push_back(emptycsot);
-      allSOfeatures.back().multitag=acttag;
-      allSOfeatures.back().multitag.from=pcrI.unclippedReadPos2ContigPos(acttag.from);
-      allSOfeatures.back().multitag.to=pcrI.unclippedReadPos2ContigPos(acttag.to);
-      // our tags might be on reads which are reversed (e.g. when on assembled reads instead the backbone),
-      //  which would lead to the multitag "to" < "from". Not good.
-      // Therefore take care that the multitag gets those positions right
-      // TODO: this is too fragile. Multitag should have accessor set/get functions which check that
-      if(allSOfeatures.back().multitag.to < allSOfeatures.back().multitag.from){
-	swap(allSOfeatures.back().multitag.to,allSOfeatures.back().multitag.from);
-      }
-      BUGIFTHROW(allSOfeatures.back().multitag.from>=CON_counts.size(),"allSOfeatures.back().multitag.from>=CON_counts.size() ???");
-      BUGIFTHROW(allSOfeatures.back().multitag.to>=CON_counts.size(),"allSOfeatures.back().multitag.from>toCON_counts.size() ???");
-    }
-  }
-}
-#define CEBUGF2
-
-
-
-/*************************************************************************
- *
- * return in "result":
- *   first in list: values for whole contig
- *   then:          values for each feature
- *
- *
- *************************************************************************/
-
-void Contig::calcSOTagCoverage(const list<contigSOtag_t> & features, list<tagcoverageinfo_t> & result)
-{
-  static tagcoverageinfo_t emptytci;
-
-  tagcoverageinfo_t wholecontig_tci;
-  vector<uint64> covvals;
-
-  result.clear();
-  covvals.reserve(100000);
-
-  {
-    // calc values for whole contig;
-    contigSOtag_t tmp;
-    tmp.multitag.from=0;
-    tmp.multitag.to=static_cast<uint32>(CON_counts.size()-1);
-    tmp.multitag.identifier=Read::REA_tagentry_idSOFAcontig;
-    tmp.multitag.source=multitag_t::MT_tagsrcentry_idMIRA;
-    tmp.multitag.setCommentStr("Note=MIRA: second order coverage values for whole contig");
-    calcSOTagCoverage_helper(tmp, wholecontig_tci, covvals, wholecontig_tci);
-  }
-  calcSecondOrderStatsOnContainer(wholecontig_tci.ccinfo, covvals);
-  result.push_back(wholecontig_tci);
-
-  for(auto fI=features.begin(); fI!=features.end(); ++fI){
-    result.push_back(emptytci);
-    calcSOTagCoverage_helper(*fI, result.back(), covvals, wholecontig_tci);
-  }
-
-  return;
-}
-
-
-/*************************************************************************
- *
- * ftci : feature tci
- * ctci : comparator tci (usually whole contig)
- *
- *
- *************************************************************************/
-
-void Contig::calcSOTagCoverage_helper(const contigSOtag_t & csot, tagcoverageinfo_t & ftci, vector<uint64> & covvals, const tagcoverageinfo_t & ctci)
-{
-  ftci.csot=csot;
-
-  uint64 numvals=csot.multitag.to - csot.multitag.from+1;
-  if(numvals>0){
-    collectCoverage(csot.multitag.from, csot.multitag.to, covvals);
-    calcStatsOnContainer(ftci.ccinfo, covvals);
-
-    if(ctci.ccinfo.median > ftci.ccinfo.median){
-      ftci.comparator_factor=-ctci.ccinfo.median/ftci.ccinfo.median;
-    }else{
-      ftci.comparator_factor=ftci.ccinfo.median/ctci.ccinfo.median;
-    }
-
-    if(static_cast<int64>(ftci.ccinfo.median + 1*ftci.ccinfo.stddev)
-       < static_cast<int64>(ctci.ccinfo.median)-1*static_cast<int64>(ctci.ccinfo.stddev)){
-      if(static_cast<int64>(ftci.ccinfo.median + 2*ftci.ccinfo.stddev)
-	 < static_cast<int64>(ctci.ccinfo.median)-2*static_cast<int64>(ctci.ccinfo.stddev)){
-	ftci.comparator_text="probable";
-      }else{
-	ftci.comparator_text="possible";
-      }
-      if(ftci.ccinfo.median < ctci.ccinfo.stddev) {
-	ftci.comparator_text+="_deletion";
-      }else{
-	ftci.comparator_text+="_CNV_down";
-      }
-    }else if(static_cast<int64>(ftci.ccinfo.median - 1*ftci.ccinfo.stddev)
-	     > static_cast<int64>(ctci.ccinfo.median)+1*static_cast<int64>(ctci.ccinfo.stddev)){
-      if(static_cast<int64>(ftci.ccinfo.median - 2*ftci.ccinfo.stddev)
-	 > static_cast<int64>(ctci.ccinfo.median)+1*static_cast<int64>(ctci.ccinfo.stddev)){
-	ftci.comparator_text="probable";
-      }else{
-	ftci.comparator_text="possible";
-      }
-      ftci.comparator_text+="_CNV_up";
-    }else{
-      ftci.comparator_text="normal";
-    }
-  }
-
-  return;
-}
-
-
-
diff --git a/src/mira/contig_output.C b/src/mira/contig_output.C
index fa4899d..704cff0 100644
--- a/src/mira/contig_output.C
+++ b/src/mira/contig_output.C
@@ -11,31 +11,26 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
 
-#include "mira/contig.H"
+#ifndef lint
+static char vcid3[] = "$Id$";
+#endif /* lint */
 
-#include "util/dptools.H"
+#include "contig.H"
 #include "util/misc.H"
-#include "mira/ads.H"
-#include "mira/gff_parse.H"
-#include "mira/sam_collect.H"
-
-#include <boost/format.hpp>
-
-using namespace std;
 
 
 //#define CEBUGFLAG
@@ -56,9 +51,11 @@ using namespace std;
  *
  *************************************************************************/
 
-void Contig::dumpStats(ostream &ostr)
+void Contig::stats(ostream &ostr)
 {
-  FUNCSTART("ostream & Contig::dumpStats(ostream &ostr, Contig const  &con)");
+  (void) vcid3;
+
+  FUNCSTART("ostream & Contig::stats(ostream &ostr, Contig const  &con)");
 
   calcStats();
 
@@ -86,55 +83,77 @@ void Contig::dumpStats(ostream &ostr)
   }else{
     ostr << "\n-------------- Contig statistics ----------------\n";
     ostr << "Contig id: " << CON_id << '\n';;
-
+    
     ostr << "Contig length: " << CON_counts.size() << "\n\n";
 
     ostr << "\t\t";
-    for(uint32 i=0;i<ReadGroupLib::SEQTYPE_END; i++){
-      ostr << setw(12) << ReadGroupLib::getNameOfSequencingType(i);
+    for(uint32 i=0;i<Read::SEQTYPE_END; i++){
+#ifdef HIDEPACBIO
+      if(i==Read::SEQTYPE_PACBIO) continue;
+#endif
+      ostr << setw(12) << Read::getNameOfSequencingType(i);
     }
     ostr << "\nNum. reads\t";
-    for(uint32 i=0;i<ReadGroupLib::SEQTYPE_END; i++){
+    for(uint32 i=0;i<Read::SEQTYPE_END; i++){
+#ifdef HIDEPACBIO
+      if(i==Read::SEQTYPE_PACBIO) continue;
+#endif
       ostr << setw(12) << CON_stats.readsperst[i];
     }
 
-#if CPP_READ_SEQTYPE_END != 8
-#error "This code is made for 8 sequencing types, adapt!"
-#endif
-
     ostr << "\n100% merged reads\t"
-	 << setw(4) << "-" << setw(12) << "-" << setw(12) << "-" << setw(12) << "-" << setw(12) << "-" << setw(12) << "-"
+	 << setw(4) << "-" << setw(12) << "-" << setw(12) << "-" << setw(12) << "-"
 	 << setw(12) << CON_nummergedreads_perseqtype[0]
 	 << setw(12) << CON_nummergedreads_perseqtype[1];
 
+    ostr << "\nAvg. read len\t";
+    for(uint32 i=0;i<Read::SEQTYPE_END; i++){
+#ifdef HIDEPACBIO
+      if(i==Read::SEQTYPE_PACBIO) continue;
+#endif
+      if(CON_stats.readsperst[i]>0){
+	if(i==Read::SEQTYPE_SOLEXA){
+	  ostr << setw(12) << CON_stats.readlenperst[i]/(CON_stats.readsperst[i]+CON_nummergedreads_perseqtype[0]);
+	}else if(i==Read::SEQTYPE_ABISOLID){
+	  ostr << setw(12) << CON_stats.readlenperst[i]/(CON_stats.readsperst[i]+CON_nummergedreads_perseqtype[1]);
+	}else{
+	  ostr << setw(12) << CON_stats.readlenperst[i]/CON_stats.readsperst[i];
+	}
+      }else{
+	ostr << setw(12) << 0;
+      }
+    }
+
     ostr << "\nMax. coverage\t";
-    for(uint32 i=0;i<ReadGroupLib::SEQTYPE_END; i++){
+    for(uint32 i=0;i<Read::SEQTYPE_END; i++){
+#ifdef HIDEPACBIO
+      if(i==Read::SEQTYPE_PACBIO) continue;
+#endif
       ostr << setw(12) << CON_stats.max_covperst[i];
     }
 
     ostr << "\nAvg. coverage\t";
-    for(uint32 i=0;i<ReadGroupLib::SEQTYPE_END; i++){
+    for(uint32 i=0;i<Read::SEQTYPE_END; i++){
+#ifdef HIDEPACBIO
+      if(i==Read::SEQTYPE_PACBIO) continue;
+#endif
       ostr << setw(12) << setprecision(3) << CON_stats.avg_covperst[i];
     }
 
     ostr << "\n\nMax. contig coverage: " << CON_stats.max_coverage << '\n';
     ostr << "Avg. contig coverage: " << setprecision(3) << CON_stats.avg_coverage << '\n';
-
+    
     ostr << "\nConsensus contains:\tA: " << CON_stats.AinC << "\tC: " << CON_stats.CinC << "\tG: " << CON_stats.GinC << "\tT: " << CON_stats.TinC << "\tN: " << CON_stats.NinC << "\n\t\t\tIUPAC: " << CON_stats.IUPACinC << "\tFunny: " << CON_stats.FunnyInC << "\t*: " << CON_stats.starInC << "\n";
-
+    
     ostr << "GC content: ";
     if(CON_stats.CinC+CON_stats.GinC>0){
       ostr << 100.0/(CON_stats.AinC+CON_stats.CinC+CON_stats.GinC+CON_stats.TinC)*(CON_stats.CinC+CON_stats.GinC) << "%\n";
     }else{
       ostr << "0%\n";
     }
-
-    if(CON_stats.numnocoverage>=0){
-      ostr << "\nContig positions with coverage: " << CON_stats.numnocoverage << '\n';
-    }
-
+    
     //ostr << "\nReads contain " << CON_stats.total_readlen-CON_stats.starInR-CON_stats.NinR << " bases, " << CON_stats.NinR << " Ns and " << CON_stats.starInR << " gaps.\n";
-
+    
     ostr << "-------------------------------------------------\n";
   }
 
@@ -153,29 +172,28 @@ void Contig::dumpStats(ostream &ostr)
 
 void Contig::setCoutType(uint8 type)
 {
-  FUNCSTART("void Contig::setCoutType(uint8 type)");
   switch(type){
-  case AS_TEXT:
-  case AS_DEBUG:
-  case AS_FASTA:
-  case AS_FASTAQUAL:
-  case AS_FASTAPADDED:
-  case AS_FASTAPADDEDQUAL:
-  case AS_HTML:
-  case AS_CAF:
-  case AS_MAF:
-  case AS_ACE:
-  case AS_TCS:
+  case AS_TEXT: 
+  case AS_DEBUG: 
+  case AS_FASTA: 
+  case AS_FASTAQUAL: 
+  case AS_FASTAPADDED: 
+  case AS_FASTAPADDEDQUAL: 
+  case AS_HTML: 
+  case AS_CAF: 
+  case AS_MAF: 
+  case AS_SAM:
+  case AS_ACE: 
+  case AS_TCS: 
   case AS_GAP4DA: {
     CON_outtype=type;
     break;
   }
   default:{
-    MIRANOTIFY(Notify::INTERNAL, "Wrong type is not one of TEXT, HTML, CAF. ACE or GAP4DA.");
+    throw Notify(Notify::INTERNAL, "void Contig::setCoutType(uint8 type)", "Wrong type is not one of TEXT, HTML, CAF. ACE or GAP4DA.");
   }
   }
 
-  FUNCEND();
   return;
 }
 
@@ -197,48 +215,55 @@ ostream & operator<<(ostream &ostr, Contig const  &con)
   //nonconstcon.definalise();
   nonconstcon.finalise();
 
+  if(con.CON_valid==0){
+    throw Notify(Notify::INTERNAL, THISFUNC, "Object not valid.");
+  }
+  if(con.CON_valid!=CON_VALID){
+    throw Notify(Notify::INTERNAL, THISFUNC, "Object probably trashed.");
+  }
+
   if(con.CON_outtype==Contig::AS_DEBUG){
-    nonconstcon.priv_dumpAsDebug(ostr);
+    nonconstcon.dumpAsDebug(ostr);
     FUNCEND();
     return ostr;
   }
   if(con.CON_outtype==Contig::AS_CAF){
-    nonconstcon.priv_dumpAsCAF(ostr);
+    nonconstcon.dumpAsCAF(ostr);
     FUNCEND();
     return ostr;
   }
   if(con.CON_outtype==Contig::AS_MAF){
-    nonconstcon.priv_dumpAsMAF(ostr);
+    nonconstcon.dumpAsMAF(ostr);
     FUNCEND();
     return ostr;
   }
   if(con.CON_outtype==Contig::AS_ACE){
-    nonconstcon.priv_dumpAsACE(ostr);
+    nonconstcon.dumpAsACE(ostr);
     FUNCEND();
     return ostr;
   }
   if(con.CON_outtype==Contig::AS_TCS){
-    nonconstcon.priv_dumpAsTCS(ostr);
+    nonconstcon.dumpAsTCS(ostr);
     FUNCEND();
     return ostr;
   }
   if(con.CON_outtype==Contig::AS_FASTA){
-    nonconstcon.priv_dumpAsFASTA(ostr,false);
+    nonconstcon.dumpAsFASTA(ostr,false);
     FUNCEND();
     return ostr;
   }
   if(con.CON_outtype==Contig::AS_FASTAQUAL){
-    nonconstcon.priv_dumpAsFASTAQUAL(ostr,false);
+    nonconstcon.dumpAsFASTAQUAL(ostr,false);
     FUNCEND();
     return ostr;
   }
   if(con.CON_outtype==Contig::AS_FASTAPADDED){
-    nonconstcon.priv_dumpAsFASTA(ostr,true);
+    nonconstcon.dumpAsFASTA(ostr,true);
     FUNCEND();
     return ostr;
   }
   if(con.CON_outtype==Contig::AS_FASTAPADDEDQUAL){
-    nonconstcon.priv_dumpAsFASTAQUAL(ostr,true);
+    nonconstcon.dumpAsFASTAQUAL(ostr,true);
     FUNCEND();
     return ostr;
   }
@@ -249,7 +274,7 @@ ostream & operator<<(ostream &ostr, Contig const  &con)
     ostr << "<h1><center>" << con.getContigName() << "</center></h1>\n";
   }
 
-  nonconstcon.dumpStats(ostr);
+  nonconstcon.stats(ostr);
 
   string consseq;
   vector<base_quality_t> consqual;
@@ -262,7 +287,7 @@ ostream & operator<<(ostream &ostr, Contig const  &con)
 
 
   if(con.CON_finalised==true){
-    nonconstcon.priv_dumpAsTextOrHTML(ostr, con.CON_outtype, consseq, consqual, 0, nonconstcon.getContigLength());
+    nonconstcon.dumpAsTextOrHTML(ostr, con.CON_outtype, consseq, consqual, 0, nonconstcon.getContigLength());
   }else{
     ostr << "Consensus not finalised, no more information to output.\n";
   }
@@ -282,32 +307,27 @@ ostream & operator<<(ostream &ostr, Contig const  &con)
 
 void Contig::dumpAsText(ostream &ostr, int32 frompos, int32 topos)
 {
-  if(topos < frompos || frompos > static_cast<int32>(CON_counts.size())) return;
-
   string consseq;
   vector<base_quality_t> consqual;
   newConsensusGet(consseq, consqual);
-  priv_dumpAsTextOrHTML(ostr, Contig::AS_TEXT, consseq, consqual, frompos, topos);
+  dumpAsTextOrHTML(ostr, Contig::AS_TEXT, consseq, consqual, frompos, topos);
 }
 
 void Contig::dumpAsHTML(ostream &ostr, int32 frompos, int32 topos)
 {
-  if(topos < frompos || frompos > static_cast<int32>(CON_counts.size())) return;
-
   string consseq;
   vector<base_quality_t> consqual;
   newConsensusGet(consseq, consqual);
-  priv_dumpAsTextOrHTML(ostr, Contig::AS_HTML, consseq, consqual, frompos, topos);
+  dumpAsTextOrHTML(ostr, Contig::AS_HTML, consseq, consqual, frompos, topos);
 }
 
-void Contig::priv_dumpAsTextOrHTML(ostream &ostr, const uint8 outtype, const string & consseq, const vector<base_quality_t> & consqual, int32 frompos, int32 topos)
+void Contig::dumpAsTextOrHTML(ostream &ostr, const uint8 outtype, const string & consseq, const vector<base_quality_t> & consqual, int32 frompos, int32 topos)
 {
-  FUNCSTART("void Contig::priv_dumpAsTextOrHTML(ostream &ostr, const uint8 outtype, const string & consseq, const vector<base_quality_t> & consqual, int32 frompos, int32 topos)");
+  FUNCSTART("void Contig::dumpAsTextOrHTML(ostream &ostr, const uint8 outtype, const string & consseq, const vector<base_quality_t> & consqual, int32 frompos, int32 topos)");
 
   (void) consqual;
 
-  if(topos < frompos || frompos > static_cast<int32>(CON_counts.size())) return;
-  if(frompos<0) frompos=0;
+  if(frompos<0 || frompos > static_cast<int32>(CON_counts.size())) frompos=0;
   if(topos<0 || topos > static_cast<int32>(CON_counts.size())) topos=static_cast<int32>(CON_counts.size());
 
   if(outtype==Contig::AS_TEXT){
@@ -328,43 +348,22 @@ void Contig::priv_dumpAsTextOrHTML(ostream &ostr, const uint8 outtype, const str
   if(egfillchar=='\t') egfillchar=' ';
 
   size_t longestnamesize=0;
-  for(auto & cre : CON_reads){
-    longestnamesize=max(longestnamesize,cre.getName().size());
+  for(uint32 ri=0; ri<CON_reads.size(); ri++){
+    longestnamesize=max(longestnamesize,CON_reads[ri].read.getName().size());
   }
   ++longestnamesize;
 
-  string spanid; // for HTML output
+  BUGIFTHROW(CON_reads.size() != CON_outputorder.size(),"CON_reads size != CON_outputorder size?");
 
-  // initialise the iterator for getting through the contig
-  rcci_t rcci(this,
-	      nullptr,  // all strainids
-	      nullptr,  // all seqtypes
-	      CON_outputrails,            // take rails only on demand
-	      true,     // take backbones
-	      true);   // take reads without readpool-reads
-  rcci.advance(frompos);
+  string spanid; // for HTML output
 
   for(int32 conpos=frompos; conpos < topos; conpos+=cpl){
-    // collect all pcrIs which will be in the view of cpl columns
-    // take the pcrIs in the current column ...
-    vector<PlacedContigReads::const_iterator> pcrIsinthisview=rcci.getPCRIsInCol();
-    // ... then advance cpl-1 columns and add to this the newly arrived pcrIs
-    for(int32 aci=0; aci<cpl-1; ++aci){
-      rcci.advance();
-      for(auto pI=rcci.getItToNewPCRIs(); pI!=rcci.getPCRIsInCol().end(); ++pI){
-	pcrIsinthisview.push_back(*pI);
-      }
-    }
-    // we advanced rcci by cpl-1, must got one further for the view
-    //  (next iteration of for loop)
-    rcci.advance();
-
     if(outtype==Contig::AS_HTML) ostr << "<table CELLSPACING=0 CELLPADDING=0 NOSAVE >\n";
     if(outtype==Contig::AS_HTML){
       ostr << "<tr NOSAVE>\n<td NOSAVE><div align=right>";
     }
     if(outtype==Contig::AS_TEXT){
-      ostr << right << setw(static_cast<int>(longestnamesize));
+      ostr << right << setw(longestnamesize);
     }
     ostr << conpos << ' ';
     if(outtype==Contig::AS_HTML) ostr << "</div></td>\n";
@@ -384,86 +383,97 @@ void Contig::priv_dumpAsTextOrHTML(ostream &ostr, const uint8 outtype, const str
       ostr << "</tt></td>\n</tr>\n";
     }
 
-    //for(uint32 i=0; i<CON_reads.size(); i++){
-    for(auto & pcrI : pcrIsinthisview){
-      if(!CON_outputrails && pcrI->isRail()) continue;
-
-      //Read & actread=CON_reads[origindex].read;
-
-      //if((conpos >= CON_outputorder[i].offset_start
-      //	  || conpos+cpl >= CON_outputorder[i].offset_start)
-      //	 && conpos<static_cast<int32>(CON_outputorder[i].offset_start+actread.getLenClippedSeq())){
-      if(1){
+    for(uint32 i=0; i<CON_reads.size(); i++){
+      uint32 origindex=CON_outputorder[i].original_index;
+      if(!CON_outputRails && CON_reads[origindex].read.isRail()) continue;
 
+      Read & actread=CON_reads[origindex].read;
 
+      if((conpos >= CON_outputorder[i].offset_start
+	  || conpos+cpl >= CON_outputorder[i].offset_start)
+	 && conpos<static_cast<int32>(CON_outputorder[i].offset_start+actread.getLenClippedSeq())){
+	       
 #ifdef CEBUGFLAG
-	ostr << "offset: " << pcrI.getReadStartOffset()
-	ostr << "\tsize: " << pcrI->getLenClippedSeq();
-	ostr << "\torpid: " << pcrI.getORPID()
+	ostr << "offset: " << CON_outputorder[i].offset_start;
+	ostr << "\tsize: " << actread.getLenClippedSeq();
+	ostr << "\torpid: " << CON_outputorder[i].orpid;
 	ostr << "\t";
-#endif
+#endif 
 
 	if(outtype==Contig::AS_HTML) {
 	  ostr << "<tr><td>";
 	}else if(outtype==Contig::AS_TEXT){
-	  ostr << left << setw(static_cast<int>(longestnamesize));
+	  ostr << left << setw(longestnamesize);
 	}
-	ostr << pcrI->getName();
+	ostr << actread.getName();
 
 	vector<char>::const_iterator oI;
-	if(pcrI.getReadDirection() > 0){
-	  oI=pcrI->getClippedSeqIterator();
+	if(CON_reads[origindex].direction>=0){
 	  ostr << '+';
+	  //Contig & nonconstcon = const_cast<Contig &>(con);
+	  oI=actread.getClippedSeqIterator();
 	}else{
-	  oI=pcrI->getClippedComplementSeqIterator();
 	  ostr << '-';
+	  //Contig & nonconstcon = const_cast<Contig &>(con);
+	  oI=actread.getClippedComplementSeqIterator();
 	}
 	if(outtype==Contig::AS_TEXT){
+	  //if(actread.getName().size() < 15) ostr << "\t";
 	  ostr << ' ';
 	}else if(outtype==Contig::AS_HTML){
 	  ostr << "</td>\n<td><tt>";
 	}
 
-	int32 index = conpos-pcrI.getReadStartOffset();
+	int32 index = conpos-CON_outputorder[i].offset_start;
+	//	  BOUNDCHECK(index, 0, CON_reads.size());  
 	advance(oI, index);
 
-	for(int32 linej=0; linej<cpl; ++oI, ++linej){
-	  if(index+linej >= 0
-	     && index+linej < static_cast<int32>(pcrI->getLenClippedSeq())){
-	    char tmp=static_cast<char>(tolower(*oI));
-	    if(tmp!=consseq[conpos+linej]) tmp=static_cast<char>(toupper(*oI));
+	for(int32 j=0; j<cpl; j++, oI++){
+	  if(index+j>=0 && 
+	     index+j<static_cast<int32>(actread.getLenClippedSeq())){
+//	      ostr << CON_reads[origindex].corrected[index+j];
+	    char tmp=*oI;
 	    bool setspan=false;
 	    if(outtype==Contig::AS_HTML){
-	      int32 rp=pcrI.contigPos2UnclippedReadPos(conpos+linej);
+	      //Contig & nonconstcon = const_cast<Contig &>(con);
+	      //int32 rp=nonconstcontigPosToUnclippedReadPos(conpos+j, CON_reads[origindex]);	
+	      int32 rp=contigPosToUnclippedReadPos(conpos+j, CON_reads[origindex]);	
 
-	      if(pcrI.getReadDirection() < 0){
-		rp=pcrI->getLenSeq()-rp-1;
+	      if(CON_reads[origindex].direction<0){
+		rp=actread.getLenSeq()-rp-1;
 	      }
+	      //		int32 rp=index+j;
 
 	      spanid.clear();
 	      int32 spanprecedence=9999;
-	      for(uint32 tagi=0; tagi < pcrI->getNumOfTags() && spanprecedence != 0; ++tagi){
-		const multitag_t & thetag=pcrI->getTag(tagi);
+	      for(uint32 k=0;k<actread.getNumOfTags() && spanprecedence != 0;k++){
+		multitag_t thetag=actread.getTag(k);
+//		    if(conpos>=660 && conpos <= 6240){
+//		      cout << actread.getName() << '\n';
+//		      cout << "rp: " << rp << '\n';
+//		      cout << "tt.f: " << thetag.from << '\n';
+//		      cout << "tt.t: " << thetag.to << '\n';
+//		    }
 		if(rp >= static_cast<int32>(thetag.from)
 		   && rp <= static_cast<int32>(thetag.to)){
-		  if(thetag.identifier==Read::REA_defaulttag_ED_D.identifier){
+		  if(thetag.identifier==Read::REA_tagentry_idED_D){
 		    spanid="EDxD";
 		    setspan=true;
 		    spanprecedence=5;
 		  }
-		  if(thetag.identifier==Read::REA_defaulttag_ED_C.identifier){
+		  if(thetag.identifier==Read::REA_tagentry_idED_C){
 		    spanid="EDxC";
 		    setspan=true;
 		    spanprecedence=5;
 		  }
-		  if(thetag.identifier==Read::REA_defaulttag_ED_I.identifier){
+		  if(thetag.identifier==Read::REA_tagentry_idED_I){
 		    spanid="EDxI";
 		    setspan=true;
 		    spanprecedence=5;
 		  }
 		  if(thetag.identifier==Read::REA_tagentry_idSRMr){
-		    if(dptools::isValidStarBase(consseq[conpos+linej])
-		       && toupper(consseq[conpos+linej])!=toupper(tmp)){
+		    if(dptools::isValidStarBase(consseq[conpos+j])
+		       && toupper(consseq[conpos+j])!=toupper(tmp)){
 		      spanid="MISM";
 		    }else{
 		      spanid="SRMr";
@@ -491,27 +501,27 @@ void Contig::priv_dumpAsTextOrHTML(ostream &ostr, const uint8 outtype, const str
 		    setspan=true;
 		    spanprecedence=0;
 		  }
-		  if(thetag.identifier==Read::REA_tagentry_idSOFApolyA_sequence){
+		  if(thetag.identifier==Read::REA_tagentry_idFpAS){
 		    spanid="POLY";
 		    setspan=true;
 		    spanprecedence=3;
 		  }
-		  if(thetag.identifier==Read::REA_tagentry_idSOFACDS){
+		  if(thetag.identifier==Read::REA_tagentry_idFCDS){
 		    spanid="FCDS";
 		    setspan=true;
 		    spanprecedence=3;
 		  }
-		  if(thetag.identifier==Read::REA_tagentry_idSOFAtRNA){
+		  if(thetag.identifier==Read::REA_tagentry_idFtRN){
 		    spanid="FtRNA";
 		    setspan=true;
 		    spanprecedence=3;
 		  }
-		  if(thetag.identifier==Read::REA_tagentry_idSOFArRNA){
+		  if(thetag.identifier==Read::REA_tagentry_idFrRN){
 		    spanid="FrRN";
 		    setspan=true;
 		    spanprecedence=3;
 		  }
-		  if(thetag.identifier==Read::REA_tagentry_idSOFAtranscript){
+		  if(thetag.identifier==Read::REA_tagentry_idFm_R){
 		    spanid="FmxR";
 		    setspan=true;
 		    spanprecedence=3;
@@ -524,7 +534,7 @@ void Contig::priv_dumpAsTextOrHTML(ostream &ostr, const uint8 outtype, const str
 		}
 	      }
 	      if(setspan==false){
-		if(toupper(consseq[conpos+linej])!=toupper(tmp)){
+		if(toupper(consseq[conpos+j])!=toupper(tmp)){
 		  spanid="MISM";
 		  setspan=true;
 		}
@@ -553,13 +563,13 @@ void Contig::priv_dumpAsTextOrHTML(ostream &ostr, const uint8 outtype, const str
 	      }
 	      }
 	    }
-
+	    
 	    // we're already over the limit, oI should point to .end()
 	    // this has absolutely no relevance in normal code, but when compiling
 	    //  in _GLIBCXX_DEBUG mode, we get an error complaining about the
 	    //  fact that we try to increase the iterator past .end()
 	    // therefore, reduce it before the next loop
-	    if(index+linej >= static_cast<int32>(pcrI->getLenClippedSeq())){
+	    if(index+j>=static_cast<int32>(actread.getLenClippedSeq())){
 	      --oI;
 	    }
 	  }
@@ -574,64 +584,64 @@ void Contig::priv_dumpAsTextOrHTML(ostream &ostr, const uint8 outtype, const str
     }
     CEBUG("\t\t\t\t\t\t");
     if(outtype==Contig::AS_TEXT){
-      ostr << setw(static_cast<int>(longestnamesize+2)) << ' ';
-      for(int32 j=0; j<cpl; ++j){
+      ostr << setw(longestnamesize+2) << ' ';
+      for(int32 j=0; j<cpl; j++){
 	ostr << "-";
       }
-      ostr << '\n' << left << setw(static_cast<int>(longestnamesize+2)) << "Consensus:";
+      ostr << '\n' << left << setw(longestnamesize+2) << "Consensus:";
     }else if(outtype==Contig::AS_HTML){
       ostr << "<tr><td>Consensus:</td>\n<td><tt>";
     }
 
     CEBUG("\t\t\t\t\t\t");
 
-    for(int32 conj=0; conj<cpl; ++conj){
-      if(conpos+conj<topos){
+    for(int32 j=0; j<cpl; j++){
+      if(conpos+j<topos){
 	bool setspan=false;
 	if(outtype==Contig::AS_HTML){
-	  for(size_t ctagi=0; ctagi < CON_consensus_tags.size(); ++ctagi){
-	    if(conpos+conj>=static_cast<int32>(CON_consensus_tags[ctagi].from) && conpos+conj<=static_cast<int32>(CON_consensus_tags[ctagi].to)){
-	      if(CON_consensus_tags[ctagi].identifier==CON_tagentry_idMCVc){
+	  for(size_t k=0;k<CON_consensus_tags.size();k++){
+	    if(conpos+j>=static_cast<int32>(CON_consensus_tags[k].from) && conpos+j<=static_cast<int32>(CON_consensus_tags[k].to)){
+	      if(CON_consensus_tags[k].identifier==CON_tagentry_idMCVc){
 		ostr << "<SPAN CLASS=\"MCVc\">";
 		setspan=true;
 		break;
 	      }
-	      if(CON_consensus_tags[ctagi].identifier==CON_tagentry_idED_D){
+	      if(CON_consensus_tags[k].identifier==CON_tagentry_idED_D){
 		ostr << "<SPAN CLASS=\"EDxD\">";
 		setspan=true;
 		break;
 	      }
-	      if(CON_consensus_tags[ctagi].identifier==CON_tagentry_idED_C){
+	      if(CON_consensus_tags[k].identifier==CON_tagentry_idED_C){
 		ostr << "<SPAN CLASS=\"EDxC\">";
 		setspan=true;
 		break;
 	      }
-	      if(CON_consensus_tags[ctagi].identifier==CON_tagentry_idED_I){
+	      if(CON_consensus_tags[k].identifier==CON_tagentry_idED_I){
 		ostr << "<SPAN CLASS=\"EDxI\">";
 		setspan=true;
 		break;
 	      }
-	      if(CON_consensus_tags[ctagi].identifier==CON_tagentry_idSRMc){
+	      if(CON_consensus_tags[k].identifier==CON_tagentry_idSRMc){
 		ostr << "<SPAN CLASS=\"SRMc\">";
 		setspan=true;
 		break;
 	      }
-	      if(CON_consensus_tags[ctagi].identifier==CON_tagentry_idWRMc){
+	      if(CON_consensus_tags[k].identifier==CON_tagentry_idWRMc){
 		ostr << "<SPAN CLASS=\"WRMc\">";
 		setspan=true;
 		break;
 	      }
-	      if(CON_consensus_tags[ctagi].identifier==CON_tagentry_idSROc){
+	      if(CON_consensus_tags[k].identifier==CON_tagentry_idSROc){
 		ostr << "<SPAN CLASS=\"SROc\">";
 		setspan=true;
 		break;
 	      }
-	      if(CON_consensus_tags[ctagi].identifier==CON_tagentry_idSAOc){
+	      if(CON_consensus_tags[k].identifier==CON_tagentry_idSAOc){
 		ostr << "<SPAN CLASS=\"SAOc\">";
 		setspan=true;
 		break;
 	      }
-	      if(CON_consensus_tags[ctagi].identifier==CON_tagentry_idSIOc){
+	      if(CON_consensus_tags[k].identifier==CON_tagentry_idSIOc){
 		ostr << "<SPAN CLASS=\"SIOc\">";
 		setspan=true;
 		break;
@@ -639,14 +649,14 @@ void Contig::priv_dumpAsTextOrHTML(ostream &ostr, const uint8 outtype, const str
 	    }
 	  }
 	}
-	if(outtype==Contig::AS_HTML
-	   && !setspan
-	   && !dptools::isValidBase(consseq[conpos+conj])
-	   && dptools::isValidIUPACBase(consseq[conpos+conj])) {
+	if(outtype==Contig::AS_HTML 
+	   && !setspan 
+	   && !dptools::isValidBase(consseq[conpos+j])
+	   && dptools::isValidIUPACBase(consseq[conpos+j])) {
 	  setspan=true;
 	  ostr << "<SPAN CLASS=\"IUPC\">";
 	}
-	ostr << consseq[conpos+conj];
+	ostr << consseq[conpos+j];
 	if(setspan){
 	  ostr << "</SPAN>";
 	}
@@ -666,7 +676,7 @@ void Contig::priv_dumpAsTextOrHTML(ostream &ostr, const uint8 outtype, const str
 	}
       }
     }
-
+	   
     if(outtype==Contig::AS_TEXT){
       ostr << "\n\n";
     }else if(outtype==Contig::AS_HTML){
@@ -690,12 +700,11 @@ void Contig::priv_dumpAsTextOrHTML(ostream &ostr, const uint8 outtype, const str
 void Contig::dumpConReads()
 {
   cout << "%%% dumping contig reads" << '\n';
-  auto crI=CON_reads.begin();
-  for(uint32 i=0; crI != CON_reads.end(); ++crI, ++i){
-    cout << i << "\t" << crI.getORPID() << "\t" << crI.getReadStartOffset();
-    cout << "\t" << crI.getReadDirection() << "\t" << crI->getName();
-    if(crI->isBackbone()) cout << "\tbb";
-    if(crI->isRail()) cout << "\trail";
+  for(uint32 i=0; i< CON_reads.size(); i++){
+    cout << i << "\t" << CON_reads[i].orpid << "\t" << CON_reads[i].offset;
+    cout << "\t" << CON_reads[i].direction << "\t" << CON_reads[i].read.getName();
+    if(CON_reads[i].read.isBackbone()) cout << "\tbb";
+    if(CON_reads[i].read.isRail()) cout << "\trail";
     cout << '\n';
   }
 }
@@ -708,32 +717,32 @@ void Contig::dumpConReads()
  *
  *************************************************************************/
 
-void Contig::priv_dumpAsDebug(ostream & ostr)
+void Contig::dumpAsDebug(ostream & ostr)
 {
-  FUNCSTART("void Contig::priv_dumpAsDebug(ostream & ostr)");
+  FUNCSTART("void Contig::dumpAsDebug(ostream & ostr)");
 
   // TODO: adapt to new struct
 
   uint32 count=0;
-  for(auto ccI=CON_counts.cbegin(); ccI != CON_counts.cend(); ++count, ++ccI){
-    ostr << count << ":\t" << ccI->A
-	 << '\t' << ccI->C
-	 << '\t' << ccI->G
-	 << '\t' << ccI->T
-	 << '\t' << ccI->N
-	 << '\t' << ccI->X
-	 << '\t' << ccI->star
-	 << '\t' << ccI->total_cov
-	 << '\t' << ccI->baselock
-	 << '\t' << ccI->snplock
-	 << '\t' << static_cast<char>(ccI->i_backbonecharorig)
-	 << '\t' << static_cast<char>(ccI->i_backbonecharupdated)
-	 << '\t' << static_cast<uint16>(ccI->i_backbonequalorig)
-	 << "\t[0] " << ccI->bbcounts[0]
-	 << "\t[1] " << ccI->bbcounts[1]
+  cccontainer_t::const_iterator I=CON_counts.begin();
+  while(I!=CON_counts.end()){
+    ostr << count << ":\t" << I->A 
+	 << '\t' << I->C 
+	 << '\t' << I->G
+	 << '\t' << I->T
+	 << '\t' << I->N
+	 << '\t' << I->X
+	 << '\t' << I->star
+	 << '\t' << I->total_cov
+	 << '\t' << I->baselock
+	 << '\t' << I->snplock
+	 << '\t' << static_cast<char>(I->backbonechar)
+	 << "\t[0] " << I->bbcounts[0]
+	 << "\t[1] " << I->bbcounts[1]
 	 << '\n';
+    I++; count++;
   }
-
+  
   ostr.flush();
   FUNCEND();
 
@@ -748,9 +757,9 @@ void Contig::priv_dumpAsDebug(ostream & ostr)
  *
  *************************************************************************/
 
-void Contig::priv_dumpAsTCS(ostream & ostr)
+void Contig::dumpAsTCS(ostream & ostr)
 {
-  FUNCSTART("void Contig::priv_dumpAsTCS(ostream & ostr)");
+  FUNCSTART("void Contig::dumpAsTCS(ostream & ostr)");
 
   string consseq;
   vector<base_quality_t> consqual;
@@ -758,7 +767,7 @@ void Contig::priv_dumpAsTCS(ostream & ostr)
   //OLDgetConsensus1(consseq, consqual, false, 0, 0, -1, '@', &ostr);
 
   ostr << "TCS output currently not available, please contact the author.\n";
-
+  
   ostr.flush();
   FUNCEND();
 
@@ -773,18 +782,13 @@ void Contig::priv_dumpAsTCS(ostream & ostr)
  *
  *************************************************************************/
 
-string Contig::priv_buildFASTAQHeaderComment(uint32 len, bool alsoavgcov)
+void Contig::buildFASTAHeader(ostringstream & ostr) const
 {
-  string ret("    ");
-  if(!CON_stats.statsvalid) calcStats();
-  if(alsoavgcov) {
-    ret+="cov="+boost::str(boost::format("%.2f") % CON_stats.avg_coverage) + " ";
-  }
-  ret+="len="+boost::str(boost::format("%1i") % len) + " ";
-  ret+="gc="+boost::str(boost::format("%.2f") % CON_stats.gccontent) + " ";
-  ret+="nseq="+boost::str(boost::format("%1i") % CON_reads.size());
-
-  return ret;
+  ostr << ">" << getContigName();
+  // temporarily disabled: IGB 4.56 cannot correctly parse the
+  //  FASTA name if there's more than the name in the line.
+  //ostr << "    nseq=" << CON_reads.size();
+  ostr << '\n';
 }
 
 /*************************************************************************
@@ -794,31 +798,34 @@ string Contig::priv_buildFASTAQHeaderComment(uint32 len, bool alsoavgcov)
  *
  *************************************************************************/
 
-void Contig::priv_dumpAsFASTA(ostream & ostr, bool padded)
+void Contig::dumpAsFASTA(ostream & ostr, bool padded)
 {
-  FUNCSTART("void Contig::priv_dumpAsFASTA(ostream & ostr, bool padded)");
+  FUNCSTART("void Contig::dumpAsFASTA(ostream & ostr, bool padded)");
 
-  string consseq;
-  vector<base_quality_t> consqual;
+  ostringstream tmp;
+  buildFASTAHeader(tmp);
+  ostr << tmp.str();;
 
-  newConsensusGet(consseq, consqual);
+  {
+    string consseq;
+    vector<base_quality_t> consqual;
 
-  // remove pads if wanted
-  if(!padded){
-    priv_depadSeqQual(consseq,nullptr);
-  }
+    newConsensusGet(consseq, consqual);
 
-  ostr << ">" << getContigName() << priv_buildFASTAQHeaderComment(consseq.size(),true) << '\n';
+    const char * cptr = consseq.c_str();
 
-  uint32 cpl=0;
-  for(auto & se : consseq){
-    ostr << se;
-    if(++cpl==80){
-      cpl=0;
-      ostr << "\n";
+    uint32 cpl=0;
+    for(;*cptr;cptr++){
+      if(padded || *cptr!='*') {
+	ostr << *cptr;
+	if(cpl++==59){
+	  cpl=0;
+	  ostr << "\n";
+	}
+      }
     }
+    if(cpl!=0) ostr << "\n";
   }
-  if(cpl!=0) ostr << "\n";
 
   ostr.flush();
   FUNCEND();
@@ -833,43 +840,12 @@ void Contig::priv_dumpAsFASTA(ostream & ostr, bool padded)
  *
  *
  *************************************************************************/
-void Contig::priv_depadSeqQual(std::string & seq, vector<base_quality_t> * qual)
-{
-  auto dstsI=seq.begin();
-  auto srcsI=dstsI;
-  if(qual==nullptr){
-    for(; srcsI!=seq.end(); ++srcsI){
-      *dstsI=*srcsI;
-      if(*srcsI!='*'){
-	++dstsI;
-      }
-    }
-  }else{
-    auto dstqI=qual->begin();
-    auto srcqI=dstqI;
-    for(; srcsI!=seq.end(); ++srcsI, ++srcqI){
-      *dstqI=*srcqI;
-      *dstsI=*srcsI;
-      if(*srcsI!='*'){
-	++dstsI;
-	++dstqI;
-      }
-    }
-    qual->resize(dstsI-seq.begin());
-  }
-  seq.resize(dstsI-seq.begin());
-}
 
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-void Contig::priv_dumpAsFASTAQUAL(ostream & ostr, bool padded)
+void Contig::dumpAsFASTAQUAL(ostream & ostr, bool padded)
 {
-  FUNCSTART("void Contig::priv_dumpAsFASTAQUAL(ostream & ostr, bool padded)");
+  FUNCSTART("void Contig::dumpAsFASTAQUAL(ostream & ostr, bool padded)");
+
+  ostr << ">" << getContigName() << '\n';
 
   string consseq;
   vector<base_quality_t> consqual;
@@ -880,22 +856,21 @@ void Contig::priv_dumpAsFASTAQUAL(ostream & ostr, bool padded)
 
   BUGIFTHROW(consseq.size() != consqual.size(), "sequence size != qual size ???");
 
-  // remove pads if wanted
-  if(!padded){
-    priv_depadSeqQual(consseq, &consqual);
-  }
-
-  ostr << ">" << getContigName() << priv_buildFASTAQHeaderComment(consseq.size(),true) << '\n';
-
-  uint32 cpl=0;
-  for(auto & qe : consqual){
-    ostr << static_cast<uint16>(qe) << " ";
-    if(++cpl==20){
-      cpl=0;
-      ostr << "\n";
+  {
+    const char * cptr = consseq.c_str();
+    vector<base_quality_t>::const_iterator I=consqual.begin();
+    uint32 cpl=0;
+    for(;I!=consqual.end(); I++, cptr++){
+      if(padded || *cptr!='*') {
+	ostr << static_cast<uint16>(*I) << " ";
+	if(cpl++==19){
+	  cpl=0;
+	  ostr << "\n";
+	}
+      }
     }
+    if(cpl!=0) ostr << "\n";
   }
-  if(cpl!=0) ostr << "\n";
 
   ostr.flush();
   FUNCEND();
@@ -910,79 +885,59 @@ void Contig::priv_dumpAsFASTAQUAL(ostream & ostr, bool padded)
  *
  *************************************************************************/
 
-void Contig::priv_getStrainSeqQualForFASTAQ(std::string & strainseq, vector<base_quality_t> & strainqual, uint32 mincoverage, base_quality_t minqual, int32 strainidtotake, bool padded, bool fillholesinstrain)
-{
-  FUNCSTART("void Contig::priv_getStrainSeqQualForFASTAQ(std::string & strainseq, vector<base_quality_t> & strainqual, uint32 mincoverage, base_quality_t minqual, int32 strainidtotake, bool padded, bool fillholesinstrain)");
-
-  calcConsensi(mincoverage,minqual);
-  newConsensusGet(strainseq, strainqual, strainidtotake);
-
-  // fill holes of strainseq with data from consseq if wanted
-  if(fillholesinstrain){
-    calcConsensi(mincoverage,0);
-    string consseq;
-    vector<base_quality_t> consqual;
-    newConsensusGet(consseq, consqual);
-    BUGIFTHROW(consseq.size() != strainseq.size(), "cons size != strain size ???");
-
-    auto csI=consseq.cbegin();
-    auto cqI=consqual.cbegin();
-    auto ssI=strainseq.begin();
-    auto sqI=strainqual.begin();
-    for(; csI!=consseq.cend(); ++csI, ++cqI, ++ssI, ++sqI){
-      if(*ssI=='N' || *ssI=='X') {
-	*ssI=*csI;
-	*sqI=*cqI;
-      }
-    }
-  }
-
-  if(!padded){
-    priv_depadSeqQual(strainseq, &strainqual);
-  }
-
-  FUNCEND();
-}
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
 void Contig::dumpStrainAsFASTAQUAL(ostream & fout,ostream & qout, uint32 mincoverage, base_quality_t minqual, int32 strainidtotake, bool padded, bool fillholesinstrain)
 {
   FUNCSTART("void Contig::dumpAsFASTA(ostream & fout, ostream & qout, base_quality_t minqual, int32 strainidtotake, bool padded, bool fillholesinstrain)");
 
-  string strainseq;
-  vector<base_quality_t> strainqual;
-
-  priv_getStrainSeqQualForFASTAQ(strainseq,strainqual,mincoverage, minqual, strainidtotake, padded, fillholesinstrain);
+  ostringstream tmp;
+  buildFASTAHeader(tmp);
+  fout << tmp.str();
+  qout << tmp.str();
 
   {
-    auto tmp=string(">"+getContigName())+priv_buildFASTAQHeaderComment(strainseq.size(),true);
-    fout << tmp << '\n';
-    qout << tmp << '\n';
-  }
+    string strainseq;
+    vector<base_quality_t> strainqual;
+    calcConsensi(mincoverage,minqual);
+    newConsensusGet(strainseq, strainqual, strainidtotake);
+    const char * sptr = strainseq.c_str();
+    vector<base_quality_t>::const_iterator S=strainqual.begin();
 
-  uint32 cpl=0;
-  uint32 qpl=0;
-  auto qI=strainqual.cbegin();
-  for(auto * sptr=strainseq.c_str(); *sptr; ++sptr,++qI){
-    fout << static_cast<char>(*sptr);
-    qout << static_cast<uint16>(*qI) << ' ';
-    if(++cpl==80){
-      cpl=0;
-      fout << "\n";
+    string consseq;
+    vector<base_quality_t> consqual;
+    const char * cptr = sptr;
+    vector<base_quality_t>::const_iterator C=S;
+    if(fillholesinstrain){
+      calcConsensi(mincoverage,0);
+      newConsensusGet(consseq, consqual);
+      BUGIFTHROW(consseq.size() != strainseq.size(), "cons size != strain size ???");
+      cptr=consseq.c_str();
+      C=consqual.begin();
     }
-    if(++qpl==20){
-      qpl=0;
-      qout << "\n";
+
+    uint32 cpl=0;
+    uint32 qpl=0;
+    for(;*sptr;sptr++,cptr++, S++, C++){
+      if(padded || *sptr!='*') {
+	if(fillholesinstrain && (*sptr=='N' || *sptr=='@')) {
+	  fout << static_cast<char>(tolower(*cptr));
+	  qout << static_cast<uint16>(*C) << ' ';
+	} else {
+	  fout << *sptr;
+	  qout << static_cast<uint16>(*S) << ' ';
+	}
+	if(cpl++==59){
+	  cpl=0;
+	  fout << "\n";
+	}
+	if(qpl++==19){
+	  qpl=0;
+	  qout << "\n";
+	}
+      }
     }
+    if(cpl!=0) fout << "\n";
+    if(qpl!=0) qout << "\n";
   }
-  if(cpl!=0) fout << "\n";
-  if(qpl!=0) qout << "\n";
 
   fout.flush();
   qout.flush();
@@ -1004,19 +959,54 @@ void Contig::dumpStrainAsFASTQ(ostream & fout, uint32 mincoverage, base_quality_
 {
   FUNCSTART("void Contig::dumpAsFASTq(ostream & fout, base_quality_t minqual, int32 strainidtotake, bool padded, bool fillholesinstrain)");
 
-  string strainseq;
-  vector<base_quality_t> strainqual;
 
-  priv_getStrainSeqQualForFASTAQ(strainseq,strainqual,mincoverage, minqual, strainidtotake, padded, fillholesinstrain);
+  fout << '@' << getContigName() << '\n';
 
-  fout << '@' << getContigName() << priv_buildFASTAQHeaderComment(strainseq.size(),true) << '\n';
+  {
+    string strainseq;
+    vector<base_quality_t> strainqual;
+    calcConsensi(mincoverage,minqual);
+    newConsensusGet(strainseq, strainqual, strainidtotake);
+    const char * sptr = strainseq.c_str();
 
-  fout << strainseq << "\n+\n";
+    string consseq;
+    vector<base_quality_t> consqual;
+    const char * cptr=NULL;
+    if(fillholesinstrain){
+      calcConsensi(mincoverage,0);
+      newConsensusGet(consseq, consqual);
+      BUGIFTHROW(consseq.size() != strainseq.size(), "cons size != strain size ???");
+      cptr = consseq.c_str();
+    }
 
-  for(auto & qe : strainqual){
-    fout << static_cast<char>((qe)+33);
+    for(;*sptr;sptr++,cptr++){
+      if(padded || *sptr!='*') {
+	if(fillholesinstrain && (*sptr=='N' || *sptr=='@')) {
+	  fout << static_cast<char>(tolower(*cptr));
+	} else {
+	  fout << *sptr;
+	}
+      }
+    }
+    fout << "\n+\n";
+
+    cptr = consseq.c_str();
+    sptr = strainseq.c_str();
+    vector<base_quality_t>::const_iterator C=consqual.begin();
+    vector<base_quality_t>::const_iterator S=strainqual.begin();
+
+    for(;*sptr;sptr++,cptr++, S++, C++){
+      if(padded || *sptr!='*') {
+	if(fillholesinstrain && (*sptr=='N' || *sptr=='@')) {
+	  fout << (*C)+33;
+	} else {
+	  fout << (*S)+33;
+	}
+      }
+    }
+    fout <<'\n';
   }
-  fout <<'\n';
+
   fout.flush();
 
   FUNCEND();
@@ -1031,12 +1021,12 @@ void Contig::dumpStrainAsFASTQ(ostream & fout, uint32 mincoverage, base_quality_
  *
  *************************************************************************/
 
-void Contig::priv_dumpAsCAF(ostream & ostr)
+void Contig::dumpAsCAF(ostream & ostr)
 {
-  FUNCSTART("void Contig::priv_dumpAsCAF(ostream & ostr)");
+  FUNCSTART("void Contig::dumpAsCAF(ostream & ostr)");
 
   finalise();
-
+  
   // make the consensus here as the routines also may set tags (STRM)
   //  to the contig
   // but first delete the old tags
@@ -1050,38 +1040,65 @@ void Contig::priv_dumpAsCAF(ostream & ostr)
 
   Read::setCoutType(Read::AS_CAF);
 
+  if(CON_reads.size() != CON_outputorder.size()){
+    cerr << "Ouch! CON_reads.size() != CON_outputorder.size():  " << CON_reads.size() << " != " << CON_outputorder.size() << '\n';
+    throw Notify(Notify::INTERNAL,THISFUNC,"Array size expected to be equal!");
+  }
+
   // output rails first
-  if(CON_outputrails){
-    for(auto & cre : CON_reads){
-      if(cre.isRail()) ostr << cre;
+  {
+    for(uint32 ii=0; ii<CON_reads.size(); ii++){
+      int32 origindex=CON_outputorder[ii].original_index;
+      if(CON_outputRails && CON_reads[origindex].read.isRail()){
+	ostr << CON_reads[origindex].read;
+      }
     }
   }
 
   //ostr << "// dubidu" << '\n';
 
   // Reads
-  for(auto & cre : CON_reads){
-    if(!cre.isRail()) ostr << cre;
+  {
+    for(uint32 ii=0; ii<CON_reads.size(); ii++){
+      int32 origindex=CON_outputorder[ii].original_index;
+      if(CON_reads[origindex].read.isRail()) continue;
+      ostr << CON_reads[origindex].read;
+    }
   }
 
-
   ostr << "Sequence : " << getContigName() << '\n';
   ostr << "Is_contig\nPadded\n";
-
+  
   // Assembled from
-  for(auto crI=CON_reads.begin(); crI!=CON_reads.end(); ++crI){
-    if(!CON_outputrails && crI->isRail()) continue;
-    ostr << "Assembled_from " << crI->getName() << " ";
-    if(crI.getReadDirection()>0){
-      ostr << crI.getReadStartOffset()+1 << " " << crI.getReadStartOffset()+crI->getLenClippedSeq() << " ";
-    }else{
-      ostr << crI.getReadStartOffset()+crI->getLenClippedSeq() << " " << crI.getReadStartOffset()+1 << " ";
+  {
+    for(uint32 ii=0; ii<CON_outputorder.size(); ii++){
+      int32 origindex=CON_outputorder[ii].original_index;
+      if(!CON_outputRails && CON_reads[origindex].read.isRail()) continue;
+
+      ostr << "Assembled_from " << CON_reads[origindex].read.getName() << " ";
+      if(CON_reads[origindex].direction>0){
+	ostr << CON_reads[origindex].offset+1 << " " << CON_reads[origindex].offset+CON_reads[origindex].read.getLenClippedSeq() << " ";
+      }else{
+	ostr << CON_reads[origindex].offset+CON_reads[origindex].read.getLenClippedSeq() << " " << CON_reads[origindex].offset+1 << " ";
+      }
+      ostr << CON_reads[origindex].read.getLeftClipoff()+1 << " " << CON_reads[origindex].read.getRightClipoff() << '\n';
     }
-    ostr << crI->getLeftClipoff()+1 << " " << crI->getRightClipoff() << '\n';
   }
 
   // Tags
-  for(auto & cte : CON_consensus_tags) cte.dumpAsCAF(ostr);
+  {
+    vector<consensustag_t>::const_iterator I=CON_consensus_tags.begin();
+    while(I!=CON_consensus_tags.end()){
+      ostr << "Tag " << I->getIdentifierStr() << " ";
+      if(I->strand=='-') {
+	ostr << (I->to)+1 << " " << (I->from)+1 << " \"";
+      }else{
+	ostr << (I->from)+1 << " " << (I->to)+1 << " \"";
+      }
+      ostr << I->getCommentStr() << "\"\n";
+      I++;
+    }
+  }
 
   ostr << "\n";
 
@@ -1112,11 +1129,13 @@ void Contig::priv_dumpAsCAF(ostream & ostr)
   {
     ostr << "BaseQuality : " << getContigName() << '\n';
 
+    vector<base_quality_t>::const_iterator qI=consqual.begin();
+
     //makeTmpConsensus(0, CON_counts.size()+1);
     //char * cptr = CON_tmpcons;
 
     uint32 cpl=0;
-    for(auto qI=consqual.begin(); qI!=consqual.end(); ++qI){
+    for(; qI!=consqual.end(); qI++){
       if(cpl++==24){
 	ostr << static_cast<uint16>(*qI) << '\n';
 	cpl=0;
@@ -1127,6 +1146,7 @@ void Contig::priv_dumpAsCAF(ostream & ostr)
     ostr << "\n\n";
   }
 
+
   ostr.flush();
 
   FUNCEND();
@@ -1141,12 +1161,12 @@ void Contig::priv_dumpAsCAF(ostream & ostr)
  *
  *************************************************************************/
 
-void Contig::priv_dumpAsMAF(ostream & ostr)
+void Contig::dumpAsMAF(ostream & ostr)
 {
-  FUNCSTART("void Contig::priv_dumpAsMAF(ostream & ostr)");
+  FUNCSTART("void Contig::dumpAsMAF(ostream & ostr)");
 
   finalise();
-
+  
   // make the consensus here as the routines also may set tags (STRM)
   //  to the contig
   // but first delete the old tags
@@ -1158,17 +1178,20 @@ void Contig::priv_dumpAsMAF(ostream & ostr)
 
   newConsensusGet(consstring, consqual);
 
-  // for each readgroup present, dump the readgrouplib info
-  // using the "save" so as not to dump readgroups multiple times
-  //
-  // because of SAM conversion woes (the MIRA sam converter does not like
-  //  definition of new readgroups when reads were already defined), do
-  //  this for all know readgroups, not only the ones we have in this contig
-
-  ReadGroupLib::saveAllReadGroupsAsMAF(ostr);
+//  makeIntelligentConsensus(consstring,
+//			   consqual,
+//			   NULL,
+//			   NULL,
+//			   0, static_cast<int32>(CON_counts.size())
+//			   ,false,false);
 
   Read::setCoutType(Read::AS_MAF);
 
+  if(CON_reads.size() != CON_outputorder.size()){
+    cerr << "Ouch! CON_reads.size() != CON_outputorder.size():  " << CON_reads.size() << " != " << CON_outputorder.size() << '\n';
+    throw Notify(Notify::INTERNAL,THISFUNC,"Array size expected to be equal!");
+  }
+
   // CO = contig name
   // NR = num reads (optional)
   // LC = contig length
@@ -1192,44 +1215,82 @@ void Contig::priv_dumpAsMAF(ostream & ostr)
        << "\nLC\t" << consstring.size() << '\n';
 
   // Tags
-  for(auto cte : CON_consensus_tags) cte.dumpAsMAF(ostr,"CT");
+  {
+    vector<consensustag_t>::const_iterator I=CON_consensus_tags.begin();
+    while(I!=CON_consensus_tags.end()){
+      ostr << "CT\t" << I->getIdentifierStr() << " ";
+      if(I->strand=='-') {
+	ostr << (I->to)+1 << " " << (I->from)+1 << " ";
+      }else{
+	ostr << (I->from)+1 << " " << (I->to)+1 << " ";
+      }
+      const string & com=I->getCommentStr();
+      for(uint32 i=0; i<com.size(); i++){
+	if(com[i]=='\n'){
+	  ostr << "\\n";
+	}else if(com[i]=='\\'){
+	  ostr << "\\\\";
+	}else{
+	  ostr << com[i];
+	}
+      }
+      ostr << '\n';
+      I++;
+    }
+  }
 
-  ostr << "CS\t";
-  ostr << consstring << '\n';
+  {
+    ostr << "CS\t";
+    ostr << consstring << '\n';
+  }
 
-  ostr << "CQ\t";
-  for(auto qv : consqual) ostr << static_cast<char>(qv+33);
+  {
+    ostr << "CQ\t";
+    vector<base_quality_t>::const_iterator qI=consqual.begin();
+    for(; qI!=consqual.end(); qI++) ostr << static_cast<char>((*qI) +33);
+    ostr << '\n';
+  }
 
-  ostr << "\n\\\\\n";
+  ostr << "\\\\\n";
 
-  // output first rails (if wanted), then other reads
-  // it==0 -> rails
-  // it==1 -> all other reads
-  int8 it=1;
-  if(CON_outputrails) it=0;
-  for(; it<2; ++it){
-    for(auto pcrI=CON_reads.begin(); pcrI!=CON_reads.end(); ++pcrI){
-      bool outit=false;
-      if(it==0 && pcrI->isRail()) outit=true;
-      if(it==1 && !pcrI->isRail()) outit=true;
-      if(outit){
-	ostr << *pcrI;
+  // output rails first
+  {
+    for(uint32 ii=0; ii<CON_reads.size(); ii++){
+      int32 origindex=CON_outputorder[ii].original_index;
+      if(CON_outputRails && CON_reads[origindex].read.isRail()){
+	ostr << CON_reads[origindex].read;
 
 	// and the AT line
 	ostr << "AT\t";
-	if(pcrI.getReadDirection() > 0){
-	  ostr << pcrI.getReadStartOffset()+1 << '\t' << pcrI.getReadStartOffset()+pcrI->getLenClippedSeq() << '\t';
+	if(CON_reads[origindex].direction>0){
+	  ostr << CON_reads[origindex].offset+1 << " " << CON_reads[origindex].offset+CON_reads[origindex].read.getLenClippedSeq() << " ";
 	}else{
-	  ostr << pcrI.getReadStartOffset()+pcrI->getLenClippedSeq() << '\t' << pcrI.getReadStartOffset()+1 << '\t';
+	  ostr << CON_reads[origindex].offset+CON_reads[origindex].read.getLenClippedSeq() << " " << CON_reads[origindex].offset+1 << " ";
 	}
-	ostr << pcrI->getLeftClipoff()+1 << '\t' << pcrI->getRightClipoff() << '\n';
+	ostr << CON_reads[origindex].read.getLeftClipoff()+1 << " " << CON_reads[origindex].read.getRightClipoff() << '\n';
       }
     }
   }
 
-
   //ostr << "// dubidu" << '\n';
 
+  // Reads
+  {
+    for(uint32 ii=0; ii<CON_reads.size(); ii++){
+      int32 origindex=CON_outputorder[ii].original_index;
+      if(CON_reads[origindex].read.isRail()) continue;
+      ostr << CON_reads[origindex].read;
+      // and the AT line
+      ostr << "AT\t";
+      if(CON_reads[origindex].direction>0){
+	ostr << CON_reads[origindex].offset+1 << " " << CON_reads[origindex].offset+CON_reads[origindex].read.getLenClippedSeq() << " ";
+      }else{
+	ostr << CON_reads[origindex].offset+CON_reads[origindex].read.getLenClippedSeq() << " " << CON_reads[origindex].offset+1 << " ";
+      }
+      ostr << CON_reads[origindex].read.getLeftClipoff()+1 << " " << CON_reads[origindex].read.getRightClipoff() << '\n';
+    }
+  }
+
   ostr << "//\n";
 
   ostr << "EC\n";
@@ -1247,248 +1308,106 @@ void Contig::priv_dumpAsMAF(ostream & ostr)
  *
  *************************************************************************/
 
-void Contig::dumpAsSAM(ostream & ostr, const SAMCollect & samc, bool alsobackbone)
+void Contig::dumpAsSAM(ostream & ostr)
 {
   FUNCSTART("void Contig::dumpAsSAM(ostream & ostr)");
 
   finalise();
+  
+  // make the consensus here as the routines also may set tags (STRM)
+  //  to the contig
+  // but first delete the old tags
 
-/*
-  currently tg_index does not understand this
-
-  // find out which strain should be used for the consensus
-  // i.e., strains which are not backbone nor rails
-  try{
-    vector<int32> sidsnotbackbone;
-    for(uint32 rgint=0; rgint<CON_readsperreadgroup.size(); ++rgint){
-      if(CON_readsperreadgroup[rgint]>0){
-	auto rgid=ReadGroupLib::getReadGroupID(rgint);
-	if(!rgid.isBackbone() && !rgid.isRail()){
-	  //cout << "### Push back sid " << static_cast<int32>(rgid.getStrainID()) << endl;
-	  sidsnotbackbone.push_back(rgid.getStrainID());
-	}
-      }
-    }
-    sort(sidsnotbackbone.begin(),sidsnotbackbone.end());
-    auto lI=unique(sidsnotbackbone.begin(),sidsnotbackbone.end());
-    sidsnotbackbone.resize(lI-sidsnotbackbone.begin());
-    BUGIFTHROW(sidsnotbackbone.empty(),"Ooooops, found no strain? Maybe the input data is at fault, but MIRA should have caught that earlier.");
-    if(sidsnotbackbone.size()>1){
-      cout << "For contig " << getContigName() << ": found " << sidsnotbackbone.size() << " strains with data, but SAM can embedd only one consensus. Will not embedd consensus for this contig.\n";
-    }else{
-      // make the consensus here as the routines also may set tags (STRM)
-      //  to the contig
-      // but first delete the old tags
-
-      deleteTagsInReads(CON_tagentry_idSTMS);
-      deleteTagsInReads(CON_tagentry_idSTMU);
-      string consstring;
-      vector<base_quality_t> consqual;
-      newConsensusGet(consstring, consqual,sidsnotbackbone[0]);
-
-      ostr << getContigName() << "\t516\t" << getContigName() << "\t1\t50\t";
-
-      // CIGAR
-      uint32 mcount=0;
-      uint32 pcount=0;
-      for(auto seqptr=consstring.c_str(); *seqptr; ++seqptr){
-	if(*seqptr != '*'){
-	  if(pcount){
-	    ostr << pcount << "P";
-	    pcount=0;
-	  }
-	  ++mcount;
-	}else{
-	  if(mcount){
-	    ostr << mcount << "M";
-	    mcount=0;
-	  }
-	  ++pcount;
-	}
-      }
-      if(pcount){
-	ostr << pcount << "P";
-      }
-      if(mcount){
-	ostr << mcount << "M";
-      }
-
-      ostr << "\t*\t0\t0\t";
-
-      // SEQ
-      for(auto seqptr=consstring.c_str(); *seqptr; ++seqptr){
-	if(*seqptr!='*') ostr << *seqptr;
-      }
-      // QUAL
-      auto qI=consqual.cbegin();
-      for(auto seqptr=consstring.c_str(); *seqptr; ++seqptr, ++qI){
-	if(*seqptr!='*') ostr << (*qI + 33);
-      }
-    }
-  }
-  catch(Notify n){
-    ReadGroupLib::debugDumpReadGroupInfo(cout);
-    cout << "\nOooops, error while looking for SAM consensus?\n\n";
-    n.handleError(THISFUNC);
-  }
-*/
-
-  auto ctI=CON_consensus_tags.begin();
-  try{
-    string seqstr;
-    string qualstr;
-    SAMCollect::samrinfo_t samri(false);
-    for(auto pcrI=CON_reads.begin(); pcrI!=CON_reads.end(); ++pcrI){
-      if(pcrI->isBackbone() && !alsobackbone) continue;
-
-      // first, contig tags up till position of current read
-      for(; ctI!=CON_consensus_tags.end() && ctI->from <= pcrI.getReadStartOffset(); ++ctI){
-	ctI->dumpAsSAM(ostr,getContigName());
-      }
+  deleteTagsInReads(CON_tagentry_idSTMS);
+  deleteTagsInReads(CON_tagentry_idSTMU);
+  string consstring;
+  vector<base_quality_t> consqual;
 
-      if(pcrI->getTemplate().empty()){
-	MIRANOTIFY(Notify::FATAL,"The read " << pcrI->getName() << " is without a template? This should not be!");
-	ostr << pcrI->getName() << '\t';
-      }else{
-	ostr << pcrI->getTemplate() << '\t';
-      }
+  newConsensusGet(consstring, consqual);
 
-      if(!samc.getSAMRInfo(pcrI->getName(),samri)){
-	MIRANOTIFY(Notify::INTERNAL,"Could not collect samrinfo_t for read " << pcrI->getName() << " ???");
-      }
+  //Read::setCoutType(Read::AS_SAM);
 
-      //cout << "actSI: " << samri;
+  if(CON_reads.size() != CON_outputorder.size()){
+    cerr << "Ouch! CON_reads.size() != CON_outputorder.size():  " << CON_reads.size() << " != " << CON_outputorder.size() << '\n';
+    throw Notify(Notify::INTERNAL,THISFUNC,"Array size expected to be equal!");
+  }
 
-      // OUCH, the FLAG!
-      uint32 flag=samri.samflags;
-      // reverse flag, easier to set here than in SAMCollect for, e.g., single reads
-      if(pcrI.getReadDirection()<0){
-	flag|=0x10;
-      }
-      ostr << flag;
-
-      ostr << '\t' << samc.getContigName(samri) << '\t';
-
-      ostr << pcrI.getReadStartOffset()+1
-	   << '\t' << "255"                  // mapping quality: none, so 255
-	   << '\t';
-
-      // CIGAR, seq & qual string
-      {
-	// Calculate preceeding 'S' statement (if any)
-	// Cannot use the left and right clips as these may contain gaps!
-	//  E.g.: through post alignment clipping
-	// Need to do this the hard way, i.e., walk and count.
-
-	const char * seqptr=nullptr;
-	int32 needwalk=0;
-	if(pcrI.getReadDirection()>0){
-	  seqptr=pcrI->getSeqAsChar();
-	  if(pcrI->getLeftClipoff()){
-	    needwalk=pcrI->getLeftClipoff();
-	  }
+  // make string for tags
+  // they somehow should belong to the contig object, but gap5 imports them in reads *sigh*
+  string constagstr;
+  {
+    ostringstream tmp;
+
+    uint32 numtags=0;
+    vector<consensustag_t>::const_iterator I=CON_consensus_tags.begin();
+    for(; I!=CON_consensus_tags.end(); ++I, ++numtags){
+      if(numtags) tmp << '\t';
+      tmp << "Zc:Z:" << I->getIdentifierStr() 
+	  << "|" << I->strand
+	  << "|" << (I->from)+1
+	  << "|" << (I->to)-(I->from);
+      const string & com=I->getCommentStr();
+      for(uint32 i=0; i<com.size(); i++){
+	if(com[i]=='\n'){
+	  tmp << "\\n";
+	}else if(com[i]=='\\'){
+	  tmp << "\\\\";
 	}else{
-	  seqptr=pcrI->getComplementSeqAsChar();
-	  if(pcrI->getLenSeq()-pcrI->getRightClipoff()>0){
-	    needwalk=pcrI->getLenSeq()-pcrI->getRightClipoff();
-	  }
-	}
-	const char * endptr=seqptr+pcrI->getLenSeq();
-
-	uint32 scount=0;
-	for(; needwalk>0; --needwalk, ++seqptr){
-	  if(*seqptr != '*') ++scount;
-	}
-	if(scount>0) ostr << scount << "S";
-
-	uint32 mcount=0;
-	uint32 dcount=0;
-	for(uint32 counter=0; counter<pcrI->getLenClippedSeq(); ++counter, ++seqptr){
-	  if(*seqptr != '*'){
-	    if(dcount){
-	      ostr << dcount << "D";
-	      dcount=0;
-	    }
-	    ++mcount;
-	  }else{
-	    if(mcount){
-	      ostr << mcount << "M";
-	      mcount=0;
-	    }
-	    ++dcount;
-	  }
+	  tmp << com[i];
 	}
-	if(dcount){
-	  ostr << dcount << "D";
-	}
-	if(mcount){
-	  ostr << mcount << "M";
-	}
-
-	// trailing S (if needed)
-	// again, cannot use clips, must walk.
-	scount=0;
-	for(; seqptr!=endptr; ++seqptr){
-	  if(*seqptr != '*') ++scount;
-	}
-	if(scount>0) ostr << scount << "S";
       }
+    }
 
-      ostr << '\t' << samc.getRNextEntry(samri)
-	   << '\t' << samri.pnext
-	   << '\t' << samri.tlen
-	   << '\t';
-
-      {
-	seqstr.clear();
-	qualstr.clear();
-
-	const char * seqptr=pcrI->getSeqAsChar();
-	int32 qualindex=0;
-	int32 qualincr=1;
-	if(pcrI.getReadDirection()<0){
-	  seqptr=pcrI->getComplementSeqAsChar();
-	  qualindex=pcrI->getLenSeq()-1;
-	  qualincr=-1;
-	}
+    constagstr=tmp.str();
+  }
 
+  ostr << "@SQ\tSN:" << getContigName()
+       << "\tLN:" << consstring.size() << '\n';
 
-	for(uint32 counter=0; counter<pcrI->getLenSeq(); ++counter, ++seqptr, qualindex+=qualincr){
-	  if(*seqptr!='*'){
-	    seqstr+=*seqptr;
-	    qualstr+=static_cast<char>(pcrI->getQualityInSequence(qualindex)+33);
-	  }
-	}
+  {
+    string cigar;
+    for(uint32 ii=0; ii<CON_reads.size(); ii++){
+      int32 origindex=CON_outputorder[ii].original_index;
+
+      uint32 flags=0;
+      if(CON_reads[origindex].direction<0) flags|=0x10;
+      //ostr << CON_reads[origindex].read;
+
+      CON_reads[origindex].read.getCIGARString(cigar);
+      ostr << CON_reads[origindex].read.getName()
+	   << '\t' << flags
+	   << '\t' << getContigName()
+	   << '\t' << CON_reads[origindex].offset+1
+	   << '\t' << 50 //mapping quality
+	   << '\t' << cigar
+	   << "\t*" // TODO: RNEXT
+	   << "\t0" // TODO: PNEXT
+	   << "\t";
+
+      vector<char>::const_iterator bI, eI;
+      if(CON_reads[origindex].direction>0){
+	bI=CON_reads[origindex].read.getSeqIteratorBegin();
+	eI=CON_reads[origindex].read.getSeqIteratorEnd();
+      }else{
+	bI=CON_reads[origindex].read.getComplementSeqIteratorBegin();
+	eI=CON_reads[origindex].read.getComplementSeqIteratorEnd();
       }
+      for(; bI != eI; ++bI) ostr << *bI;
 
-      ostr << seqstr
-	   << '\t' << qualstr
-	   << "\tRG:Z:" << pcrI->getReadGroupID().getLibId();
-
-      if(pcrI->getNumOfTags()){
-	ostr << "\tPT:Z:";
-	bool wantpipe=false;
-	for(auto & readtag : pcrI->getTags()){
-	  if(wantpipe) ostr << '|';
-	  wantpipe=true;
-	  if(pcrI.getReadDirection()>0){
-	    readtag.dumpAsSAM(ostr);
-	  }else{
-	    readtag.dumpAsSAM(ostr,pcrI->getLenSeq());
-	  }
+      ostr << '\t';
+      for(uint32 posi=0; posi < CON_reads[origindex].read.getLenSeq(); ++posi){
+	if(CON_reads[origindex].direction>0){
+	  ostr << static_cast<char>(33+CON_reads[origindex].read.getQualityInSequence(posi));
+	}else{
+	  ostr << static_cast<char>(33+CON_reads[origindex].read.getQualityInComplementSequence(posi));
 	}
       }
       ostr << '\n';
     }
-
-    // we're done, except maybe some trailing consensus tags
-    for(; ctI!=CON_consensus_tags.end(); ++ctI) ctI->dumpAsSAM(ostr,getContigName());
-  }
-  catch(Notify n){
-    cout << "Oooops, error while writing SAM?\n";
-    n.handleError(THISFUNC);
   }
 
+  ostr.flush();
+
   FUNCEND();
 }
 
@@ -1502,9 +1421,9 @@ void Contig::dumpAsSAM(ostream & ostr, const SAMCollect & samc, bool alsobackbon
  *************************************************************************/
 
 //#define CEBUG(bla)   {cout << bla; cout.flush();}
-int32 Contig::priv_helper_dumpAsACE_BSLines(string & consseq, bool alsodump, ostream & ostr)
+int32 Contig::helper_dumpAsACE_BSLines(string & consseq, bool alsodump, ostream & ostr)
 {
-  FUNCSTART("int32 Contig::priv_helper_dumpAsACE_BSLines(string & consseq, bool alsodump, ostream & ostr)");
+  FUNCSTART("int32 Contig::helper_dumpAsACE_BSLines(string & consseq, bool alsodump, ostream & ostr)");
 
   int32 numBSlines=0;
 
@@ -1512,76 +1431,104 @@ int32 Contig::priv_helper_dumpAsACE_BSLines(string & consseq, bool alsodump, ost
 
   const char * cptr = consseq.c_str();
   int32 conpos = 0;
+  int32 bqindex= -1;
+  int32 currentindex= -1;
   int32 stretch_begin=1;
+  vector<int32> readidx;
+
 
-  //vector<out_order_t>::const_iterator outorderI = CON_outputorder.begin();
+  finalise();
+  vector<out_order_t>::const_iterator outorderI = CON_outputorder.begin();
 
   // initialise the iterator for getting through the contig
-  rcci_t rcci(this,
-	      nullptr,  // all strainids
-	      nullptr,  // all seqtypes
-	      false,    // no rails
-	      true,     // take backbones
-	      true);   // take reads without readpool-reads
-
-  auto currentpcrI=rcci.getPCRIsInCol().front();
-  for(;*cptr; ++conpos, rcci.advance(), ++cptr){
+  rcci_t rcci;
+  {
+    vector<int32> allowedstrainids; // empty would be all ids
+    vector<uint8> allowedreadtypes;
+    readColContigIteratorInit(rcci, 
+			      allowedstrainids, 
+			      allowedreadtypes, 
+			      false,            // don't take rails
+			      true,           // backbones
+			      true);   // nor reads without readpool-reads
+  }
+
+
+  for(;*cptr; cptr++, conpos++, readColContigIteratorAdvance(rcci)){    
     char consbase = static_cast<char>(toupper(*cptr));
     base_quality_t bestqual=0;
-    auto bqpcrI=rcci.getPCRIsInCol().front();
+    bqindex=-1;
 
     CEBUG("caa: conpos: " << conpos << '\t' << consbase << '\n');
 
     // look for best qual equal to cons base
     bool foundcurrindexincol=false;
     bool foundaread=false;
-    //for(uint32 i= 0; i<rcci.read_ids_in_col.size(); i++) {
-    for(auto & pcrI : rcci.getPCRIsInCol()){
-      CEBUG("caa: read: " << pcrI->getName());
-      if(pcrI==currentpcrI && toupper(getBaseInRead(conpos,pcrI)) == consbase){
+    for(uint32 i= 0; i<rcci.read_ids_in_col.size(); i++) {
+      CEBUG("caa: read: " << CON_readpool->getRead(rcci.read_ids_in_col[i]).getName());
+      if(i==0) {
+	bqindex=rcci.read_ids_in_col[0];
+	// do not set bestqual
+	if(conpos==0) {
+	  currentindex=rcci.read_ids_in_col[0];
+	}
+      }
+      if(rcci.read_ids_in_col[i]==currentindex && toupper(getBaseInRead(conpos,rcci.read_ids_in_col[i])) == consbase){
 	foundcurrindexincol=true;
       }
-      if(toupper(getBaseInRead(conpos,pcrI)) == consbase
-	 || (toupper(getBaseInRead(conpos,pcrI)) == 'X' && consbase=='N')) {
-	auto q=getQualityInRead(conpos,pcrI);
-	if(q >= bestqual) {
+      if(toupper(getBaseInRead(conpos,rcci.read_ids_in_col[i])) == consbase
+	 || (toupper(getBaseInRead(conpos,rcci.read_ids_in_col[i])) == 'X' && consbase=='N')) {
+	base_quality_t q=getQualityInRead(conpos,rcci.read_ids_in_col[i]);
+	if(q > bestqual) {
 	  bestqual=q;
-	  bqpcrI=pcrI;
-	  foundaread=true;
+	  bqindex=rcci.read_ids_in_col[i];
 	  CEBUG("\tbq");
 	}
       }
       CEBUG('\n');
     }
+    
+    //// if no read chosen, look for best qual IN consbase
+    //for(uint32 i= 0; i<rcci.read_ids_in_col.size(); i++) {
+    //  CEBUG("caa: read: " << CON_readpool->getRead(rcci.read_ids_in_col[i]).getName() << '\n');
+    //  if(toupper(getBaseInRead(conpos,rcci.read_ids_in_col[i])) == consbase
+    //	 || (toupper(getBaseInRead(conpos,rcci.read_ids_in_col[i])) == 'X' && consbase=='N')) {
+    //	base_quality_t q=getQualityInRead(conpos,rcci.read_ids_in_col[i]);
+    //	if(q > bestqual) {
+    //	  bestqual=q;
+    //	  bq=rcci.read_ids_in_col[i];
+    //	}
+    //  }
+    //}
 
     if(!foundaread){
-      bqpcrI=rcci.getPCRIsInCol().front();
-      bestqual=getQualityInRead(conpos,bqpcrI);
+      bqindex=rcci.read_ids_in_col[0];
+      bestqual=getQualityInRead(conpos,bqindex);
     }
 
-    CEBUG("bq: " << static_cast<uint16>(bestqual) << "\nbqpcrI: " << bqpcrI->getName() << '\n');
+    CEBUG("bq: " << static_cast<uint16>(bestqual) << "\nbqindex: " << bqindex << '\n');
 
-    // look if current read index (if set) is not within 5 of best qual
+    // look if current read index (if set) is not within 5 of best qual 
     //  then output bs line
-    if((!foundcurrindexincol || bestqual - getQualityInRead(conpos,currentpcrI) > 80)
-      && bqpcrI != currentpcrI) {
-      CEBUG("Jump new read: " << bqpcrI->getName() << '\n');
-      ++numBSlines;
+    if((!foundcurrindexincol || bestqual - getQualityInRead(conpos,currentindex) > 80)
+      && bqindex != currentindex) {
+      CEBUG("Jump new read: " << CON_readpool->getRead(bqindex).getName() << '\n');
+      numBSlines++;
       if(alsodump){
 	ostr << "BS " << stretch_begin << " " << conpos << " ";
-	BUGIFTHROW(currentpcrI==CON_reads.end(),"currentpcrI==CON_reads.end() ???");
-	ostr << currentpcrI->getName() << '\n';
+	BUGIFTHROW(currentindex<0 || currentindex >= static_cast<int32>(CON_reads.size()),"1 / currentindex<0 || currentindex >= CON_reads.size() ???");
+	ostr << CON_reads[currentindex].read.getName() << '\n';
       }
       stretch_begin=conpos+1;
-      currentpcrI=bqpcrI;
+      currentindex=bqindex;      
     }
   }
 
-  ++numBSlines;
+  numBSlines++;
   if(alsodump) {
     ostr << "BS " << stretch_begin << " " << conpos << " ";
-    BUGIFTHROW(currentpcrI==CON_reads.end(),"currentpcrI==CON_reads.end() ???");
-    ostr << currentpcrI->getName() << "\n\n";
+    BUGIFTHROW(currentindex<0 || currentindex >= static_cast<int32>(CON_reads.size()),"2 / currentindex<0 || currentindex >= CON_reads.size() ???");
+    ostr << CON_reads[currentindex].read.getName() << "\n\n";
   }
 
   FUNCEND();
@@ -1597,9 +1544,9 @@ int32 Contig::priv_helper_dumpAsACE_BSLines(string & consseq, bool alsodump, ost
  *
  *************************************************************************/
 
-void Contig::priv_dumpAsACE(ostream & ostr)
+void Contig::dumpAsACE(ostream & ostr)
 {
-  FUNCSTART("void Contig::priv_dumpAsACE(ostream & ostr)");
+  FUNCSTART("void Contig::dumpAsACE(ostream & ostr)");
 
   // 0 basesegments, don't know if i use the golden path
   //if(CON_reads.size() > 1){
@@ -1609,32 +1556,31 @@ void Contig::priv_dumpAsACE(ostream & ostr)
   //}
   //ostr << CON_reads.size() << " 0 U" << '\n';
 
+
+
   string consseq;
   vector<base_quality_t> consqual;
 
-  finalise();
   newConsensusGet(consseq, consqual);
 
   ostr << "CO " << getContigName() << " " << CON_counts.size() << " ";
-
-  // TODO: check, isn't there some tracking now by the contig?
-  if(!CON_outputrails){
+  if(!CON_outputRails){
     uint32 numreads=0;
-    for(auto read : CON_reads){
-      if(!read.isRail()) ++numreads;
+    for(uint32 i=0; i<CON_reads.size(); i++){
+      if(!CON_reads[i].read.isRail()) numreads++;
     }
     ostr << numreads << " ";
-  }else{
+  }else{ 
     ostr << CON_reads.size() << " ";
   }
-  ostr << priv_helper_dumpAsACE_BSLines(consseq,false,ostr) << " U\n";
+  ostr << helper_dumpAsACE_BSLines(consseq,false,ostr) << " U\n";
 
   {
     const char * cptr = consseq.c_str();
     uint32 cpl=0;
     while(*cptr){
       ostr << *cptr;
-      ++cptr;
+      cptr++;
       if(cpl++==59){
 	cpl=0;
 	ostr << "\n";
@@ -1646,69 +1592,84 @@ void Contig::priv_dumpAsACE(ostream & ostr)
   {
     // qual for pads MUST NOT be output
     ostr << "BQ\n";
+    vector<base_quality_t>::const_iterator I=consqual.begin();
     const char * cptr = consseq.c_str();
     uint32 cpl=0;
-    //while(I!=consqual.end()){
-    for(auto cqI : consqual){
+    while(I!=consqual.end()){
       if(*cptr !='*') {
-	ostr << static_cast<uint16>(cqI) << " ";
+	ostr << static_cast<uint16>(*I) << " ";
 	if(cpl++==19){
 	  cpl=0;
 	  ostr << "\n";
 	}
       }
-      ++cptr;
+      I++;
+      cptr++;
     }
     ostr << "\n\n";
   }
 
   // AF lines
-  for(auto pcrI=CON_reads.begin(); pcrI != CON_reads.end(); ++pcrI){
-    if(!CON_outputrails && pcrI->isRail()) continue;
-    ostr << "AF " << pcrI->getName();
-    if(pcrI.getReadDirection() >0) {
+  for(uint32 i=0; i<CON_reads.size(); i++){
+    if(!CON_outputRails && CON_reads[i].read.isRail()) continue;
+    ostr << "AF " << CON_reads[i].read.getName();
+    if(CON_reads[i].direction >0) {
       ostr << " U ";
-      ostr << (static_cast<int32>(pcrI.getReadStartOffset())+1 - static_cast<int32>(pcrI->getLeftClipoff()) )<< '\n';
+      ostr << (static_cast<int32>(CON_reads[i].offset)+1 - static_cast<int32>(CON_reads[i].read.getLeftClipoff()) )<< '\n';
     } else {
       ostr << " C ";
-      ostr << (static_cast<int32>(pcrI.getReadStartOffset()) + static_cast<int32>(pcrI->getRightClipoff()) - static_cast<int32>(pcrI->getLenSeq()) + 1 )<< '\n';
+      //ostr << (int32) CON_reads[i].offset << " ";
+      //ostr << (int32) CON_reads[i].read.getLenSeq() << " ";
+      //ostr << (int32) CON_reads[i].read.getLeftClipoff() << " ";
+      //ostr << (int32) CON_reads[i].read.getRightClipoff() << " ";
+      ostr << (static_cast<int32>(CON_reads[i].offset) + static_cast<int32>(CON_reads[i].read.getRightClipoff()) - static_cast<int32>(CON_reads[i].read.getLenSeq()) + 1 )<< '\n';
     }
   }
   ostr << "\n";
 
   // BS lines
-  priv_helper_dumpAsACE_BSLines(consseq,true,ostr);
+  helper_dumpAsACE_BSLines(consseq,true,ostr);
 
   // Tags
-  for(auto contag : CON_consensus_tags){
-    ostr << "CT{\n";
-    //ostr << "C" << CON_id;
-    ostr << getContigName() << ' ' << contag.getIdentifierStr();
-    if(contag.getStrandDirection()==-1) {
-      ostr << " MIRA " << (contag.to)+1 << ' ' << (contag.from)+1;
-    }else{
-      ostr << " MIRA " << (contag.from)+1 << ' ' << (contag.to)+1;
-    }
-    ostr << " 020202:121212 NoTrans\n";
-    if(contag.comment != CON_tagentry_coEmpty){
-      ostr << "COMMENT{\n" << contag.getCommentStr() << "\nC}\n";
+  {
+    vector<consensustag_t>::const_iterator I=CON_consensus_tags.begin();
+    while(I!=CON_consensus_tags.end()){
+      ostr << "CT{\n";
+      //ostr << "C" << CON_id;
+      ostr << getContigName() << ' ' << I->getIdentifierStr();
+      if(I->strand=='-') {
+	ostr << " MIRA " << (I->to)+1 << ' ' << (I->from)+1;
+      }else{
+	ostr << " MIRA " << (I->from)+1 << ' ' << (I->to)+1;
+      }
+      ostr << " 020202:121212 NoTrans\n";
+      if(I->comment != CON_tagentry_coEmpty){
+	ostr << "COMMENT{\n" << I->getCommentStr() << "\nC}\n";
+      }
+      ostr << "}\n\n";
+      I++;
     }
-    ostr << "}\n\n";
-  }
+   }
 
   // Reads
-  for(auto pcrI=CON_reads.begin(); pcrI != CON_reads.end(); ++pcrI){
-    if(!CON_outputrails && pcrI->isRail()) continue;
-    if (pcrI.getReadDirection() >0 ) {
-      Read::setCoutType(Read::AS_ACE);
-      ostr << *pcrI;
-    } else {
-      Read::setCoutType(Read::AS_ACE_COMPLEMENT);
-      ostr << *pcrI;
+  {
+    Read::setCoutType(Read::AS_ACE);
+    for(uint32 i=0; i<CON_reads.size(); i++){
+      if(!CON_outputRails && CON_reads[i].read.isRail()) continue;
+      if (CON_reads[i].direction >0 ) {
+	Read::setCoutType(Read::AS_ACE);
+	ostr << CON_reads[i].read;
+      } else {
+	Read::setCoutType(Read::AS_ACE_COMPLEMENT);
+	ostr << CON_reads[i].read;
+      }
     }
   }
 
-  ostr << endl;
+  ostr << '\n';
+
+
+  ostr.flush();
 
   FUNCEND();
 }
@@ -1725,62 +1686,72 @@ void Contig::saveAsGAP4DA(const string & dirname, ostream & fofnstr)
   FUNCSTART("void Contig::saveAsGAP4DA()");
 
   finalise();
-
+  
   // Reads
   {
     string anchor="";
     string APline="";
-    //for(uint32 cooi=0; cooi<CON_outputorder.size(); cooi++){
-    for(auto pcrI=CON_reads.begin(); pcrI != CON_reads.end(); ++pcrI){
-      if(!CON_outputrails && pcrI->isRail()) continue;
+    for(uint32 cooi=0; cooi<CON_outputorder.size(); cooi++){
+      int32 origindex=CON_outputorder[cooi].original_index;
+      if(!CON_outputRails && CON_reads[origindex].read.isRail()) continue;
       if(APline.empty()){
-	if(pcrI.getReadDirection() > 0){
+	if(CON_reads[origindex].direction>0){
 	  APline="*new* +";
 	} else {
 	  APline="*new* -";
 	}
-	anchor=pcrI->getName();
+	anchor=CON_reads[origindex].read.getName();
       } else {
 	ostringstream tmp;
-	if(pcrI.getReadDirection() > 0){
-	  tmp << anchor << " + " << pcrI.getReadStartOffset() << " -1";
+	if(CON_reads[origindex].direction>0){
+	  tmp << anchor << " + " << CON_reads[origindex].offset << " -1";
 	}else{
-	  tmp << anchor << " - " << pcrI.getReadStartOffset() << " -1";
+	  tmp << anchor << " - " << CON_reads[origindex].offset << " -1";
 	}
 	APline=tmp.str();
       }
 
       // we really don't want EXP filenames with a | as part of the filename
-      string expfilename=pcrI->getName()+".exp";
+      string expfilename=CON_reads[origindex].read.getName()+".exp";
       for(uint32 ii=0; ii<expfilename.size(); ii++){
 	if(expfilename[ii]=='|') expfilename[ii]='_';
       }
 
       ofstream expout((dirname+"/"+expfilename).c_str(), ios::out | ios::trunc);
-      const_cast<Read &>(*pcrI).dumpAsGAP4DA(expout, APline);
+      CON_reads[origindex].read.dumpAsGAP4DA(expout, APline);
 
 
       // We're putting consensus tags all in the first exp file
       // james bonfield suggested the last file, but this lead to unexplainable
       //  off by 1,2,3,... shifts.
-      if(pcrI==CON_reads.begin()) {
-	for(const auto & contag : CON_consensus_tags){
-	  expout << "TC   " << contag.getIdentifierStr();
+      if(cooi==0) {
+	vector<consensustag_t>::const_iterator T=CON_consensus_tags.begin();
+	for(;T!=CON_consensus_tags.end();T++) {
+	  expout << "TC   " << T->getIdentifierStr();
 
-	  if(pcrI.getReadDirection() > 0) {
+	  if(CON_reads[origindex].direction>0) {
 	    // if the first read of that contig is saved in + direction,
 	    // we must add the left clippoff of the first read that
 	    //  was written to the file
-	    int32 lq=pcrI->getLeftClipoff();
-	    expout << " = " << (contag.from)+1+lq << ".." << (contag.to)+1+lq;
+	    int32 lq=CON_reads[origindex].read.getLeftClipoff();
+	    expout << " = " << (T->from)+1+lq << ".." << (T->to)+1+lq;
 	  } else {
 	    // if the first read of that contig is saved complemented,
 	    //  save the tag positions also complemented
 	    //  (and take right extend)
-	    int32 lq=pcrI->getRightClipoff();
-	    expout << " = " << lq-static_cast<int32>(contag.to) << ".." << lq-static_cast<int32>(contag.from);
+	    int32 lq=CON_reads[origindex].read.getRightClipoff();
+
+	    expout << " = " << lq-static_cast<int32>(T->to) << ".." << lq-static_cast<int32>(T->from);
+	    //if(lq-((T->to)) > CON_counts.size()) {
+	    //  cout << "PANIC:\t";
+	    //  Read::setCoutType(Read::AS_TEXTCLIPS);
+	    //  cout << CON_reads[origindex].read << '\n' << '\n';
+	    //  cout << "lq: " << lq << '\n';
+	    //  T->dump();
+	    //  cout << "Computed to: " << lq-((T->to)) << '\n';
+	    //}
 	  }
-	  const char * cs=contag.getCommentStr().c_str();
+	  const char * cs=T->getCommentStr().c_str();
 	  if (*cs!=0) expout << "\nTC        ";
 	  while(*cs) {
 	    if(*cs == '\n') expout << "\nTC        ";
@@ -1824,9 +1795,11 @@ void Contig::dumpContigReadList_Head(ostream &ostr)
 
 void Contig::dumpContigReadList_Body(ostream &ostr)
 {
-  for(auto & cre : CON_reads){
+  vector<contigread_t>::const_iterator J=getContigReads().begin(); 
+  while(J != getContigReads().end()) {
     ostr << getContigName() << "\t";
-    ostr << cre.getName() << "\n";
+    ostr << J->read.getName() << "\n";
+    J++;
   }
 }
 
@@ -1840,6 +1813,8 @@ void Contig::dumpContigReadList_Body(ostream &ostr)
 
 void Contig::dumpContigStatistics_Head(ostream &ostr)
 {
+  //ostr << "# name\t\tlength\tav.qual\t#-reads\tmx.cov.\tav.cov\tav.rlen\tAinCn\tCinCn\tGinCn\tTinCn\tIUPACinCn\tFunnyinCn\tNinCn\tXinCn\t*inCn\tNoCovinCn\n";
+  //ostr << "# name\tlength\tav.qual\t#-reads\tmx.cov.\tav.cov\tGC%\tIUPACinCn\tFunnyinCn\tNinCn\tXinCn\t*inCn\tNoCovinCn\n";
   ostr << setw(20) << left << "# name";
   ostr << "\tlength\tav.qual\t#-reads\tmx.cov.\tav.cov\tGC%\tCnIUPAC\tCnFunny\tCnN\tCnX\tCnGap\tCnNoCov\n";
 }
@@ -1871,7 +1846,7 @@ void Contig::dumpContigStatistics_Body(ostream &ostr)
 
   //ostr << s.avg_readlen << '\t';
   //ostr << "--\t";
-
+  
   //ostr << s.AinC << '\t';
   //ostr << s.CinC << '\t';
   //ostr << s.GinC << '\t';
@@ -1883,6 +1858,7 @@ void Contig::dumpContigStatistics_Body(ostream &ostr)
        << s.starInC << '\t'
        << s.numnocoverage
        << '\n';
+
 }
 
 
@@ -1910,16 +1886,15 @@ void Contig::dumpReadTagList_Head(ostream &ostr)
 
 void Contig::dumpReadTagList_Body(ostream &ostr)
 {
-  FUNCSTART("void Contig::dumpReadTagList_Body(ostream &ostr)");
   string serialc;
 
-  for(auto pcrI=CON_reads.begin(); pcrI!=CON_reads.end(); ++pcrI) {
-    if(!pcrI->isBackbone()) const_cast<Read &>(*pcrI).sortTags();
-
-    for(auto & thetag : pcrI->getTags()){
-      //const multitag_t & thetag= cre.getTag(t);
-      int32 cpf=pcrI.unclippedReadPos2ContigPos(thetag.from);
-      int32 cpt=pcrI.unclippedReadPos2ContigPos(thetag.to);
+  vector<contigread_t>::const_iterator R=getContigReads().begin(); 
+  for(; R != getContigReads().end() ; R++) {
+    const_cast<Read &>(R->read).sortTags();
+    for(uint32 t=0; t < R->read.getNumOfTags(); t++){
+      const multitag_t & thetag= R->read.getTag(t);
+      int32 cpf=unclippedReadPosToContigPos(thetag.from, *R);
+      int32 cpt=unclippedReadPosToContigPos(thetag.to, *R);
       ostr << getContigName() << "\t"
 	   << cpf << "\t"
 	   << cpt << "\t";
@@ -1928,11 +1903,11 @@ void Contig::dumpReadTagList_Body(ostream &ostr)
       if(cpt>=0) ostr << paddedPos2UnpaddedPos(cpt);
       ostr << "\t"
 	   << thetag.getIdentifierStr() << "\t"
-	   << pcrI->getName() << "\t"
+	   << R->read.getName() << "\t"
 	   << thetag.from << "\t"
 	   << thetag.to << "\t"
-	   << pcrI->getLowerNonGapAdjustmentPosOfReadPos(thetag.from) << "\t"
-	   << pcrI->getUpperNonGapAdjustmentPosOfReadPos(thetag.to) << "\t";
+	   << R->read.getLowerNonGapAdjustmentPosOfReadPos(thetag.from) << "\t"
+	   << R->read.getUpperNonGapAdjustmentPosOfReadPos(thetag.to) << "\t";
       thetag.serialiseComment(serialc);
       ostr << serialc << "\n";
     }
@@ -1950,7 +1925,7 @@ void Contig::dumpReadTagList_Body(ostream &ostr)
 void Contig::dumpConsensusTagList_Head(ostream &ostr)
 {
   ostr << "#\n"
-    "# conName\tfromPadded\ttoPadded\tfromUnPadded\ttoUnPadded\tlen\ttype\tSNPqual\tqualA\tqualC\tqualG\tqualT\tqual*\tcomment\n"
+    "# conName\tfromPadded\ttoPadded\tfromUnPadded\ttoUnPadded\ttype\tSNPqual\tqualA\tqualC\tqualG\tqualT\tqual*\tcomment\n"
     "#" << endl;
 }
 
@@ -1963,54 +1938,44 @@ void Contig::dumpConsensusTagList_Head(ostream &ostr)
 
 void Contig::dumpConsensusTagList_Body(ostream &ostr)
 {
-  FUNCSTART("void Contig::dumpConsensusTagList_Body(ostream &ostr)");
-
   string serialc;
 
-  // FIXME:
-  //  very tricky. paddedPos2UnpaddedPos() needs an existing consensus. If it does not exist,
-  //   it will recalculate one
-  // But this recalculation may add tags to the consensus!!!
-  // Therefore, force this possible recalc to be done before the anything else, or else hilarity ensues
-  //  in the for loop below as it gets its elements changed away under its ass.
-  paddedPos2UnpaddedPos(0);
-
   sortConsensusTags();
-  for(auto & cte : getConsensusTags()){
+  vector<Contig::consensustag_t>::const_iterator T=getConsensusTags().begin();
+  for(; T != getConsensusTags().end() ; T++) {
     ostr << getContigName() << "\t";
-    ostr << cte.from << "\t";
-    ostr << cte.to << "\t";
-    ostr << paddedPos2UnpaddedPos(cte.from) << "\t";
-    ostr << paddedPos2UnpaddedPos(cte.to) << "\t";
-    ostr << cte.to-cte.from+1 << '\t';
-    ostr << cte.getIdentifierStr() << "\t";
-    if(cte.additionalinfo_initialised) {
+    ostr << T->from << "\t";
+    ostr << T->to << "\t";
+    ostr << paddedPos2UnpaddedPos(T->from) << "\t";
+    ostr << paddedPos2UnpaddedPos(T->to) << "\t";
+    ostr << T->getIdentifierStr() << "\t";
+    if(T->additionalinfo_initialised) {
       base_quality_t snpQual=255;
-      //if((cte.qualA)>0 && cte.qualA<snpQual) snpQual=cte.qualA;
-      //if((cte.qualC)>0 && cte.qualC<snpQual) snpQual=cte.qualC;
-      //if((cte.qualG)>0 && cte.qualG<snpQual) snpQual=cte.qualG;
-      //if((cte.qualT)>0 && cte.qualT<snpQual) snpQual=cte.qualT;
-      //if((cte.qualStar)>0 && cte.qualStar<snpQual) snpQual=cte.qualStar;
-
+      //if((T->qualA)>0 && T->qualA<snpQual) snpQual=T->qualA;
+      //if((T->qualC)>0 && T->qualC<snpQual) snpQual=T->qualC;
+      //if((T->qualG)>0 && T->qualG<snpQual) snpQual=T->qualG;
+      //if((T->qualT)>0 && T->qualT<snpQual) snpQual=T->qualT;
+      //if((T->qualStar)>0 && T->qualStar<snpQual) snpQual=T->qualStar;
+      
       for(uint8 i=0; i<5; i++) {
-	if((cte.qualACGTGap[i])>0 && cte.qualACGTGap[i]<snpQual) snpQual=cte.qualACGTGap[i];
+	if((T->qualACGTStar[i])>0 && T->qualACGTStar[i]<snpQual) snpQual=T->qualACGTStar[i];
       }
-
+      
       if(snpQual==255) snpQual=0;
-
+      
       ostr << static_cast<uint16>(snpQual) << "\t";
       for(uint8 i=0; i<5; i++) {
-	ostr << static_cast<uint16>(cte.qualACGTGap[i]) << "\t";
+	ostr << static_cast<uint16>(T->qualACGTStar[i]) << "\t";
       }
-      //ostr << static_cast<uint16>(cte.qualACGTGap[0]) << "\t";
-      //ostr << static_cast<uint16>(cte.qualACGTGap[1]) << "\t";
-      //ostr << static_cast<uint16>(cte.qualACGTGap[2]) << "\t";
-      //ostr << static_cast<uint16>(cte.qualACGTGap[3]) << "\t";
-      //ostr << static_cast<uint16>(cte.qualACGTGap[4]) << "\t";
+      //ostr << static_cast<uint16>(T->qualACGTStar[0]) << "\t";
+      //ostr << static_cast<uint16>(T->qualACGTStar[1]) << "\t";
+      //ostr << static_cast<uint16>(T->qualACGTStar[2]) << "\t";
+      //ostr << static_cast<uint16>(T->qualACGTStar[3]) << "\t";
+      //ostr << static_cast<uint16>(T->qualACGTStar[4]) << "\t";
     }else{
       ostr << "\t\t\t\t\t\t";
     }
-    cte.serialiseComment(serialc);
+    T->serialiseComment(serialc);
     ostr << serialc << "\n";
   }
 }
@@ -2024,46 +1989,31 @@ void Contig::dumpConsensusTagList_Body(ostream &ostr)
  *
  *************************************************************************/
 
-void Contig::dumpMAF_Head(ostream &ostr)
-{
-  ostr << "@Version\t2\t0\n";
-  ostr << "@Program\tMIRALIB\n";
-}
-
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
 void Contig::dumpTCS_Head(ostream &ostr)
 {
   ostr << "#TCS V1.0\n";
   ostr << "#\n";
   ostr << setw(20) << left << "# contig name"
        << setw(9) << right << "padPos" << setw(9) << "upadPos"
-       << " | B" << "  Q |"
-       << setw(5) << "tcov"
-       << setw(5) << "covA"
-       << setw(5) << "covC"
-       << setw(5) << "covG"
-       << setw(5) << "covT"
+       << " | B" << "  Q |" 
+       << setw(5) << "tcov" 
+       << setw(5) << "covA" 
+       << setw(5) << "covC" 
+       << setw(5) << "covG" 
+       << setw(5) << "covT" 
        << setw(5) << "cov*"
        << " |"
-       << setw(3) << "qA"
-       << setw(3) << "qC"
-       << setw(3) << "qG"
-       << setw(3) << "qT"
-       << setw(3) << "q*"
+       << setw(3) << "qA" 
+       << setw(3) << "qC" 
+       << setw(3) << "qG" 
+       << setw(3) << "qT" 
+       << setw(3) << "q*" 
        << " |"
-       << setw(3) << "S"
+       << setw(3) << "S" 
        << " | Tags\n"
        << "#" << endl;
 }
 
-
 /*************************************************************************
  *
  *
@@ -2073,7 +2023,7 @@ void Contig::dumpTCS_Head(ostream &ostr)
 
 void Contig::dumpTCS_Body(ostream &ostr)
 {
-  priv_dumpAsTCS(ostr);
+  dumpAsTCS(ostr);
 }
 
 
@@ -2099,34 +2049,35 @@ void Contig::dumpWiggle_Head(ostream &ostr)
  *
  *************************************************************************/
 
-void Contig::dumpWiggle_Body(ostream &ostr, string & cons, bool aspadded)
+void Contig::dumpWiggle_Body(ostream &ostr, string & cons)
 {
   FUNCSTART("void Contig::dumpWiggle_Body(ostream &ostr, string & cons)");
   BUGIFTHROW(cons.size() != CON_counts.size(), getContigName() << ": consensus.size() != CON_counts.size() ???");
 
+  cccontainer_t::const_iterator ccI=CON_counts.begin();
   ccctype_t maxcov=0;
-  for(auto & cce : CON_counts){
-    maxcov=max(maxcov, cce.total_cov);
+  for(; ccI!=CON_counts.end(); ccI++){
+    maxcov=max(maxcov, ccI->total_cov);
   }
 
-  uint32 maxstrains=ReadGroupLib::getNumOfStrains();
+  uint32 maxstrains=CON_readpool->getNumOfStrainInReadpool();
   vector<bool> strainlookup(maxstrains,false);
 
 
-  ostr << "track type=wiggle_0 name=\"" << getContigName()
+  ostr << "track type=wiggle_0 name=\"" << getContigName() 
        << "cov\" description=\""
        << getContigName() << " ";
 
-  auto crI=CON_reads.begin();
+  vector<contigread_t>::const_iterator crI=CON_reads.begin();
   uint32 numbackbonestrains=0;
-  for(;crI != CON_reads.end(); ++crI){
-    if(crI.getORPID()>=0 && crI->isBackbone()){
-      if(!strainlookup[crI->getStrainID()]){
-	strainlookup[crI->getStrainID()]=true;
+  for(;crI != CON_reads.end(); crI++){
+    if(crI->orpid>=0 && crI->read.isBackbone()){
+      if(!strainlookup[crI->read.getStrainID()]){
+	strainlookup[crI->read.getStrainID()]=true;
 	if(numbackbonestrains==0){
 	  ostr << "BB strain:";
 	}
-	ostr << ' ' << crI->getStrainName();
+	ostr << ' ' << crI->read.getStrain();
 	++numbackbonestrains;
       }
     }
@@ -2136,10 +2087,10 @@ void Contig::dumpWiggle_Body(ostream &ostr, string & cons, bool aspadded)
   strainlookup.resize(maxstrains,false);
   uint32 numstrains=0;
   crI=CON_reads.begin();
-  for(;crI != CON_reads.end(); ++crI){
-    if(crI.getORPID()>=0 && !crI->isBackbone() && !crI->isRail()){
-      if(!strainlookup[crI->getStrainID()]){
-	strainlookup[crI->getStrainID()]=true;
+  for(;crI != CON_reads.end(); crI++){
+    if(crI->orpid>=0 && !crI->read.isBackbone() && !crI->read.isRail()){
+      if(!strainlookup[crI->read.getStrainID()]){
+	strainlookup[crI->read.getStrainID()]=true;
 	if(numstrains==0){
 	  if(numbackbonestrains>0){
 	    ostr << " Mapped strain(s):";
@@ -2148,7 +2099,7 @@ void Contig::dumpWiggle_Body(ostream &ostr, string & cons, bool aspadded)
 	  }
 	}
 	if(numstrains<10){
-	  ostr << ' ' << crI->getStrainName();
+	  ostr << ' ' << crI->read.getStrain();
 	} else if(numstrains==10){
 	  ostr << "...";
 	}
@@ -2164,22 +2115,23 @@ void Contig::dumpWiggle_Body(ostream &ostr, string & cons, bool aspadded)
   ostr << "\" visibility=full autoScale=off "
        << "viewLimits=0:" << maxcov << " color=0,200,100 "
        << "maxHeightPixels=100:50:20 graphType=bar priority=30\n"
-       << "fixedStep chrom=" << getContigName()
+       << "fixedStep chrom=" << getContigName() 
        << " start=1 step=" << span << " span=" << span << endl;
 
-  auto ccI=CON_counts.begin();
+  ccI=CON_counts.begin();
   for(uint32 cpos=0; cpos<cons.size();){
     uint32 tcov=0;
     uint32 counter=0;
+    uint32 maxto=min(cpos+span, static_cast<uint32>(cons.size()));
     bool haszerovalue=false;
-    for(; counter<span && ccI!=CON_counts.end(); cpos++, ccI++){
-      if(aspadded
-	 || (cons[cpos] != '*'
-	     && (cons[cpos] != 'X'))){ // || (cons[cpos] == 'X' && ccI->total_cov!=0))){
+    for(; cpos<maxto; cpos++, ccI++){
+      if(cons[cpos] != '*'
+	 && (cons[cpos] != '@' || (cons[cpos] == '@' && ccI->total_cov!=0))){
 	if(ccI->total_cov){
 	  tcov+=ccI->total_cov;
 	}else{
-	  haszerovalue=true;
+	  haszerovalue=true; 
+	  break;
 	}
 	counter++;
       }
@@ -2194,351 +2146,3 @@ void Contig::dumpWiggle_Body(ostream &ostr, string & cons, bool aspadded)
   FUNCEND();
 }
 
-
-
-/*************************************************************************
- *
- * dumps the GC content of a strain as wiggle file
- * must give padded consensus to routine (save recalculation)
- *
- *************************************************************************/
-
-void Contig::dumpGCWiggle_Body(ostream &ostr, string & cons)
-{
-  FUNCSTART("void Contig::dumpGCWiggle_Body(ostream &ostr, string & cons)");
-  BUGIFTHROW(cons.size() != CON_counts.size(), getContigName() << ": consensus.size() != CON_counts.size() ???");
-
-  uint32 span=4;
-
-  BUGIFTHROW(span==0, "span for wiggle file cannot be 0");
-
-  ostr << "track type=wiggle_0 name=\"" << getContigName()
-       << "gccont\" description=\""
-       << getContigName() << " GC content"
-       << "\" visibility=full autoScale=off "
-       << "viewLimits=0:100 color=0,100,200 "
-       << "maxHeightPixels=100:50:20 graphType=line priority=30\n"
-       << "fixedStep chrom=" << getContigName()
-       << " start=1 step=" << span << " span=" << span << endl;
-
-  int32 window=50;
-  int32 topos=window/2;
-  int32 frompos=-topos;
-
-  vector<int32> counts(255,0);
-
-  for(int32 i=frompos; i<topos; ++i){
-    if(i>=0 && i<cons.size()){
-      ++counts[toupper(cons[i])];
-    }
-  }
-
-  for(int32 cpos=0; cpos<cons.size();){
-    uint32 counter=0;
-    for(; counter<span && cpos < cons.size(); cpos++){
-      if(cons[cpos] != '*'
-	 && (cons[cpos] != 'X')){ // || (cons[cpos] == 'X' && ccI->total_cov!=0))){
-	if(frompos>=0) --counts[toupper(cons[frompos])];
-	++frompos;
-	++topos;
-	if(topos < cons.size()) ++counts[toupper(cons[topos])];
-	++counter;
-      }
-    }
-    uint32 allcounts=counts['A']+counts['C']+counts['G']+counts['T'];
-    if(allcounts>0){
-      double gc=100*static_cast<double>(counts['C']+counts['G'])/static_cast<double>(allcounts);
-      ostr << static_cast<uint16>(gc) << "\n";
-    }else{
-      ostr << "0\n";
-    }
-  }
-
-  FUNCEND();
-}
-
-
-
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-void Contig::dumpTagsAsGFF3(ostream & ostr, string & padcons)
-{
-  FUNCSTART("void Contig::dumpTagsAsGFF3(ostream & ostr, string & padcons)");
-
-  static const string namestr="Name"; // for comparison later
-  static const string idstr="ID"; // for comparison later
-
-  //  build a mapping for positions from padded sequence to unpadded sequence
-  vector<uint32> depadposmap;
-  if(padcons.empty()){
-    cout << "no padcons\n";
-  }else{
-    BUGIFTHROW(padcons.size() != CON_counts.size(),"padcons.size() != CON_counts.size() ???");
-    cout << "havepadcons " << padcons.size() << endl;
-    uint32 actdepadpos=0;
-    depadposmap.resize(padcons.size(),0);
-    for(uint32 seqi=0; seqi < padcons.size();seqi++){
-      depadposmap[seqi]=actdepadpos;
-      char actbase=static_cast<char>(tolower(padcons[seqi]));
-      if(actbase!='*') actdepadpos++;
-    }
-  }
-
-  deque<multitag_t> tagswithconpos;
-
-  // dump tags from backbone reads ( == initial annotation)
-  multitag_t tmptag;
-  string tmps;
-  for(auto pcrI=CON_reads.begin(); pcrI!=CON_reads.end(); ++pcrI){
-    if(CON_reads.size()==1 || pcrI->isBackbone()){
-      for(uint32 ti=0; ti < pcrI->getNumOfTags(); ++ti){
-	if(pcrI->getTag(ti).identifier == Read::REA_tagentry_idSRMr
-	   || pcrI->getTag(ti).identifier == Read::REA_tagentry_idWRMr
-	   || pcrI->getTag(ti).identifier == Read::REA_tagentry_idSROr
-	   || pcrI->getTag(ti).identifier == Read::REA_tagentry_idSIOr
-	   || pcrI->getTag(ti).identifier == Read::REA_tagentry_idSAOr
-	   || pcrI->getTag(ti).identifier == Read::REA_tagentry_idUNSr
-	   || pcrI->getTag(ti).identifier == Read::REA_tagentry_idESDN
-	  ){
-	  // output them or not? at the moment rather not
-	}else{
-	  if(pcrI->getTag(ti).identifier == Read::REA_tagentry_idSOFAcontig){
-	    // need to rewrite "Name=..." to match the one of the contig
-	    gff3attributes_t tmpa;
-	    GFFParse::parseGFF3Attributes(pcrI->getTag(ti).getCommentStr(),
-					  tmpa);
-	    gff3attributes_t::iterator aI=tmpa.begin();
-	    for(; aI != tmpa.end(); ++aI){
-	      if(aI->tag==namestr
-		 || aI->tag==idstr){
-		aI->values.resize(1);
-		aI->values[0]=getContigName();
-	      }
-	    }
-	    GFFParse::createGFF3AttributeString(tmpa, tmps);
-	    tmptag=pcrI->getTag(ti);
-	    tmptag.setCommentStr(tmps);
-
-	    tagswithconpos.push_back(tmptag);
-	  }else{
-	    tagswithconpos.push_back(pcrI->getTag(ti));
-	  }
-	  // the tags contain read positions. We need to convert these into contig positions,
-	  //  then into depadded sequence positions.
-	  // However, there may be tags (starting/ending/completely) outside the good range of the contig
-	  // resolution:
-	  //  completely outside -> drop
-	  //  partly inside -> adjust start/stop
-	  tagswithconpos.back().from=pcrI.unclippedReadPos2ContigPos(tagswithconpos.back().from);
-	  tagswithconpos.back().to=pcrI.unclippedReadPos2ContigPos(tagswithconpos.back().to);
-
-	  if(!depadposmap.empty()){
-	    // completely outside?
-	    if(tagswithconpos.back().from >= depadposmap.size() &&
-	       tagswithconpos.back().to >= depadposmap.size()) continue;
-
-	    // partly?
-	    if(tagswithconpos.back().from >= depadposmap.size()) tagswithconpos.back().from = 0;
-	    tagswithconpos.back().from=depadposmap[tagswithconpos.back().from];
-	    if(tagswithconpos.back().to >= depadposmap.size()) tagswithconpos.back().to = depadposmap.size()-1;
-	    tagswithconpos.back().to=depadposmap[tagswithconpos.back().to];
-	  }
-	}
-      }
-    }
-  }
-
-  // dump consensus tags ( == SNP and other markers )
-
-  {
-    for(auto & ct : CON_consensus_tags){
-      tmptag=ct;
-      bool saveit=false;
-      if(tmptag.identifier==Contig::CON_tagentry_idSROc){
-	tmptag.identifier=Read::REA_tagentry_idSROm;
-	saveit=true;
-      }else if(tmptag.identifier==Contig::CON_tagentry_idSIOc){
-	tmptag.identifier=Read::REA_tagentry_idSIOm;
-	saveit=true;
-      }else if(tmptag.identifier==Contig::CON_tagentry_idSAOc){
-	tmptag.identifier=Read::REA_tagentry_idSAOm;
-	saveit=true;
-      }else if(tmptag.identifier==Contig::CON_tagentry_idMCVc){
-	tmptag.identifier=Read::REA_tagentry_idMCVm;
-	saveit=true;
-      }else if(tmptag.identifier==Contig::CON_tagentry_idSRMc){
-	tmptag.identifier=Read::REA_tagentry_idSRMm;
-	saveit=true;
-      }else if(tmptag.identifier==Contig::CON_tagentry_idWRMc){
-	tmptag.identifier=Read::REA_tagentry_idWRMm;
-	saveit=true;
-      }
-      // hmmm, the above is a bit restrictive
-      // let's save everything and see whether problems occur
-      saveit=true;
-      if(saveit) {
-	if(!depadposmap.empty()) {
-	  tmptag.from=depadposmap[tmptag.from];
-	  tmptag.to=depadposmap[tmptag.to];
-	}
-	tagswithconpos.push_back(tmptag);
-      }
-    }
-  }
-
-  for(auto & tag : tagswithconpos){
-    tag.dumpAsGFF3(ostr,getContigName());
-  }
-
-  FUNCEND();
-}
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-void Contig::priv_dumpReplay(ofstream & eout, const AlignedDualSeqFacts * initialadsf, int32 refid, int32 newid, int32 direction_frnid, bool newid_ismulticopy, int32 forcegrow)
-{
-  Read::setCoutType(Read::AS_MAF);
-  setCoutType(AS_MAF);
-  setOutputRails(true);
-
-  eout << "This file allows one to replay an error that MIRA just encountered\n\n"
-    "Please do not delete but contact the author (bach at chevreux.org) immediately\n\n"
-    "addRead_Error!\n\n\n\n";
-  if(initialadsf!=nullptr) eout << "\ninitialadsf:\n" << *initialadsf;
-  eout << "\n\nrefid: " << refid << " (" << CON_readpool->getRead(refid).getName()
-       << ")\nnewid: " << newid << " (" << CON_readpool->getRead(newid).getName()
-       << ")\ndirection_frnid: " << direction_frnid
-       << "\nnewid_ismulticopy: " << newid_ismulticopy
-       << "\nforcegrow: " << forcegrow;
-
-  if(initialadsf!=nullptr){
-    eout << "\n\nint8 dirnewid=" << direction_frnid
-	 << ";  // " << static_cast<int16>(initialadsf->getSequenceDirection(newid))
-	 << " " << static_cast<int16>(initialadsf->getSequenceDirection(refid))
-	 << "\nadsf.publicinit(" << initialadsf->getID1()
-	 << "," << initialadsf->getID2()
-	 << "," << initialadsf->getDelta()
-	 << "," << initialadsf->getRightDelta(initialadsf->getID1())
-	 << "," << initialadsf->getRightDelta(initialadsf->getID2())
-	 << "," << initialadsf->getTotalLen()
-	 << "," << static_cast<int16>(initialadsf->getSequenceDirection(initialadsf->getID1()))
-	 << "," << static_cast<int16>(initialadsf->getSequenceDirection(initialadsf->getID2()))
-	 << "," << static_cast<uint16>(initialadsf->getScoreRatio())
-	 << "," << initialadsf->getTotalNonMatches()
-	 << "," << initialadsf->get5pLenContiguousMatch(initialadsf->getID1())
-	 << "," << initialadsf->get3pLenContiguousMatch(initialadsf->getID1())
-	 << "," << initialadsf->get5pLenContiguousMatch(initialadsf->getID2())
-	 << "," << initialadsf->get3pLenContiguousMatch(initialadsf->getID2())
-	 << ");\n";
-  }
-
-  eout << "readgroups known:\n";
-  ReadGroupLib::dumpAllReadGroupsAsMAF(eout);
-
-  eout << "\n\nOffending read:\n" << CON_readpool->getRead(newid)
-       << endl
-       << "\nOffending contig:\n"
-       << "@Version\t2\t0\n" << *this
-       << endl;
-}
-
-
-/*************************************************************************
- *
- * Dump some internal things on the contig
- *
- * note: incomplete
- *
- *************************************************************************/
-
-void Contig::dumpStatus(ostream & ostr)
-{
-  ostr << "ContigDump: " << CON_id << " " << CON_nameprefix << " " << CON_name << endl
-       << "CON_finalised: " << CON_finalised << endl;
-  if(CON_readpool==nullptr){
-    ostr << "CON_readpool: nullptr !\n";
-  }else{
-    ostr << "CON_readpool: set\n";
-  }
-  ostr << "CON_reads: " << CON_reads.size() << endl
-       << "CON_counts: " << CON_counts.size() << endl
-       << "CON_templates_present: " << CON_templates_present.size() << endl
-       << "CON_consensus_tags: " << CON_consensus_tags.size() << endl
-       << "CON_targetcoverageperst: " << CON_targetcoverageperst.size();
-  for(uint32 i=0; i<CON_targetcoverageperst.size();++i){
-    ostr << "\t" << CON_targetcoverageperst[i] << endl;
-  }
-
-  ostr << "CON_allowedrefids: " << CON_allowedrefids.size() << endl
-       << "CON_2tmpcons: " << CON_2tmpcons.size() << endl
-       << "CON_tmpcons_from_backbone: " <<  CON_tmpcons_from_backbone << endl
-       << "CON_specialsraddconditions: " << CON_specialsraddconditions << endl
-       << "CON_ssrc_maxtotalerrors: " << CON_ssrc_maxtotalerrors << endl
-       << "CON_ssrc_maxgaps: " << CON_ssrc_maxgaps << endl
-       << "CON_ssrc_maxmismatches: " << CON_ssrc_maxmismatches << endl
-       << "num backbones: " << getNumBackbones() << endl;
-
-  for(uint32 i=0; i<NUMMERGESEQTYPES; ++i){
-    ostr << "CON_nummergedreads_perseqtype[" << i << "]: " << CON_nummergedreads_perseqtype[i] << endl;
-  }
-
-  ostr << "CON_fixedconsseq: " << CON_fixedconsseq.size() << endl
-       << "CON_fixedconsqual: " << CON_fixedconsqual.size() << endl
-       << "CON_conscalc_mincov: " << CON_conscalc_mincov << endl
-       << "CON_strainconsqual: " <<  CON_strainconsqual.size() << endl;
-
-  for(uint32 i=0; i<CON_strainconsqual.size(); ++i){
-    ostr << "\t" << i << " " << CON_strainconsqual[i].size() << endl;
-  }
-
-  ostr << "CON_strainadjustments: " << CON_strainadjustments.size() << endl;
-  for(uint32 i=0; i<CON_strainadjustments.size(); ++i){
-    ostr << "\t" << i << " " << CON_strainadjustments[i].size() << endl;
-  }
-
-  ostr << "CON_readsperstrain: " << CON_readsperstrain.size() << endl;
-  for(uint32 i=0; i<CON_readsperstrain.size(); ++i){
-    ostr << "\t" << i << " " << ReadGroupLib::getStrainOfStrainID(i) << "\t" << CON_readsperstrain[i] << endl;
-  }
-
-  ostr << "CON_readsperreadgroup: " << CON_readsperreadgroup.size() << endl;
-  for(uint32 i=0; i<CON_readsperreadgroup.size(); ++i){
-    ostr << "\t" << i << " " << ReadGroupLib::getStrainOfStrainID(i) << "\t" << CON_readsperreadgroup[i] << endl;
-  }
-
-  ostr << "CON_last_dangerous_overlaps: " << CON_last_dangerous_overlaps.size() << endl
-       << "CON_contains_long_repeats_only: " << CON_contains_long_repeats_only << endl;
-
-}
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-void Contig::debugDump()
-{
-  FUNCSTART("void Contig::debugDump()");
-
-  cout << "Contig::debugDump()" << endl;
-  uint32 cci=0;
-  for(auto & cce : CON_counts){
-    cout << "cci: " << cci << cce << '\n';
-    ++cci;
-  }
-
-  FUNCEND();
-}
diff --git a/src/mira/contig_pairconsistency.C b/src/mira/contig_pairconsistency.C
deleted file mode 100644
index 27bbf26..0000000
--- a/src/mira/contig_pairconsistency.C
+++ /dev/null
@@ -1,398 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 2012 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-
-#include "contig.H"
-#include "simple_2Dsignalprocessing.H"
-
-using namespace std;
-
-
-
-#define CEBUG(bla)   {cout << bla; cout.flush();}
-std::pair<int32,int32> Contig::findBestPairConsistencyRange()
-{
-  FUNCSTART("void Contig::checkPairConsistency()");
-
-#define MAXINSIZETOCHECK 80000
-
-  pair<int32,int32> retval(0,getContigLength());
-
-  //return retval;
-
-  if(getContigLength()==0) return retval;
-
-  vector<ReadGroupLib::ReadGroupID> rgtocheck;
-  for(uint32 rgi=1; rgi<ReadGroupLib::getNumReadGroups(); ++rgi){
-    auto rgid=ReadGroupLib::getReadGroupID(rgi);
-    if(rgid.hasTemplateInfo()
-       && rgid.getInsizeFrom()>=0
-       && rgid.getInsizeTo()>=0){
-      rgtocheck.push_back(rgid);
-    }
-  }
-
-  if(rgtocheck.size()){
-    CEBUG("Need to check readgroups:\n");
-    vector<uint8> breakmarker(getContigLength(),0);
-    vector<vector<uint64> > spanner(rgtocheck.size());
-    vector<uint64> tmpforstats;
-    vector<vector<int32> > valleydepths(rgtocheck.size());
-    vector<vector<int32> > peakheights(rgtocheck.size());
-
-    bool hascuts=false;
-
-    // create vectors with coverage data
-    auto spanner12=spanner;
-    auto nonspanner=spanner;
-    for(auto rgi=0; rgi<spanner.size(); ++rgi){
-      priv_cprForRGID(rgtocheck[rgi],spanner[rgi],spanner12[rgi],nonspanner[rgi]);
-      //string desc=getContigName();
-      //desc+='_';
-      //desc+=rgtocheck[rgi].getGroupName();
-      //dbgContainerToWiggle(spanner[rgi],getContigName(),desc+"_sp");
-      //dbgContainerToWiggle(spanner12[rgi],getContigName(),desc+"_sp12");
-      //dbgContainerToWiggle(nonspanner[rgi],getContigName(),desc+"_nsp");
-    }
-
-    // calculate peaks
-    for(auto rgi=0; rgi<spanner.size(); ++rgi){
-      // do this only for libraries with small template size
-      if(rgtocheck[rgi].getInsizeTo()>=0 && rgtocheck[rgi].getInsizeTo()<=MAXINSIZETOCHECK){
-	// We won't search here, just need some numbers for the
-	// correct threshold in non-spanner down below
-	tmpforstats=spanner12[rgi];
-
-	coverageinfo_t tci;
-	calcStatsOnContainer(tci,tmpforstats);
-	cout << "spanner12 - normal:\n" << tci << endl;
-	calcSecondOrderStatsOnContainer(tci,tmpforstats);
-	cout << "spanner12 - 2n:\n" << tci << endl;
-
-	uint64 nsthreshold=tci.mean/4;
-
-	tmpforstats=nonspanner[rgi];
-	calcStatsOnContainer(tci,tmpforstats);
-	cout << "nonspanner - normal:\n" << tci << endl;
-	calcSecondOrderStatsOnContainer(tci,tmpforstats);
-	cout << "nonspanner - 2n:\n" << tci << endl;
-
-	bool inpeak=false;
-	auto vsI=nonspanner[rgi].cbegin();
-	uint64 pos=0;
-	uint64 threshold=nsthreshold;
-	if(tci.mean*10>threshold) threshold=tci.mean*10;
-
-	uint64 firsttpos=1;
-	uint64 lasttpos=getContigLength()-1;
-
-	cout << "threshold=" << threshold << endl;
-	cout << "ftp: " << firsttpos << endl;
-	cout << "ltp: " << lasttpos << endl;
-	for(auto sI=nonspanner[rgi].cbegin(); sI!=nonspanner[rgi].cend(); ++sI, ++pos){
-	  bool peakstop=false;
-	  if(pos<firsttpos) continue;
-	  if(pos>=lasttpos){
-	    if(inpeak) {
-	      peakstop=true;
-	    }else{
-	      break;
-	    }
-	  }
-	  if(inpeak){
-	    if(*sI<threshold){
-	      peakstop=true;
-	      inpeak=false;
-	    }
-	  }else{
-	    if(*sI>threshold){
-	      inpeak=true;
-	      vsI=sI;
-	    }
-	  }
-	  if(peakstop){
-	    auto veI=sI;
-	    cout << "Potential peak: " << vsI-nonspanner[rgi].cbegin() << "\t" << veI-nonspanner[rgi].cbegin() << "\t" << veI-vsI << endl;
-	    if(veI-nonspanner[rgi].cbegin() <= rgtocheck[rgi].getInsizeTo()){
-	      cout << "Near front, skip.\n";
-	    }else if(nonspanner[rgi].cend()-vsI <= rgtocheck[rgi].getInsizeTo()){
-	      cout << "Near end, skip.\n";
-	    }else{
-	      auto maxval=*vsI;
-	      for(auto tI=vsI; tI<veI; ++tI){
-		if(*tI>maxval) maxval=*tI;
-	      }
-	      for(auto tI=vsI; tI<veI; ++tI){
-		if(*tI==maxval) {
-		  peakheights[rgi].push_back(tI-nonspanner[rgi].cbegin());
-		  cout << "New peak max " << maxval << " at " << tI-nonspanner[rgi].cbegin() << endl;
-		  hascuts=true;
-		}
-	      }
-	    }
-	  }
-	}
-      }
-    }
-
-    // calculate valley info
-    for(auto rgi=0; rgi<spanner.size(); ++rgi){
-      coverageinfo_t tci;
-      tmpforstats=spanner[rgi];
-      calcStatsOnContainer(tci,tmpforstats);
-      cout << "spanner - normal:\n" << tci << endl;
-      calcSecondOrderStatsOnContainer(tci,tmpforstats);
-      cout << "spanner - 2n:\n" << tci << endl;
-
-      // spanner are searched for valleys in coverage
-      // valley is <= mean cov/3, size >=50
-      if(tci.mean>=9){
-	bool invalley=false;
-	auto vsI=spanner[rgi].cbegin();
-	uint64 pos=0;
-	uint64 threshold=tci.mean/3;
-
-	uint64 firsttpos=getContigLength();
-	uint64 lasttpos=0;
-	{
-	  auto dist=distToFirstThreshold(spanner[rgi].begin(),spanner[rgi].end(),tci.mean/2);
-	  if(dist>=0) firsttpos=dist;
-	  dist=distToFirstThreshold(spanner[rgi].rbegin(),spanner[rgi].rend(),tci.mean/2);
-	  if(dist>=0) lasttpos=getContigLength()-dist;
-	}
-
-	cout << "threshold=" << threshold << endl;
-	cout << "ftp: " << firsttpos << endl;
-	cout << "ltp: " << lasttpos << endl;
-	for(auto sI=spanner[rgi].cbegin(); sI!=spanner[rgi].cend(); ++sI, ++pos){
-	  bool valleystop=false;
-	  if(pos<firsttpos) continue;
-	  if(pos>=lasttpos){
-	    if(invalley) {
-	      valleystop=true;
-	    }else{
-	      break;
-	    }
-	  }
-	  if(invalley){
-	    if(*sI>threshold){
-	      valleystop=true;
-	      invalley=false;
-	    }
-	  }else{
-	    if(*sI<threshold){
-	      invalley=true;
-	      vsI=sI;
-	    }
-	  }
-	  if(valleystop){
-	    auto veI=sI;
-	    int32 vstart=vsI-spanner[rgi].cbegin();
-	    int32 vstop=veI-spanner[rgi].cbegin();
-	    cout << "Potential valley: " << vstart << "\t" << vstop << "\t" << vstop-vstart << endl;
-	    uint32 confirmedbypeak=0;
-	    int32 peakvalleydist=500;
-	    for(auto & phe : peakheights[rgi]){
-	      if((vstart-phe >= 0 && vstart-phe < peakvalleydist)
-		 || (phe >= vstart && phe <= vstop)
-		 || (phe-vstop>=0 && phe-vstop < peakvalleydist)){
-		++confirmedbypeak;
-		cout << "confirmedbypeak " << phe << endl;
-		phe=-1;
-	      }
-	    }
-	    if(confirmedbypeak){
-	      // temove all -1 entries in this area as the valley will give better cutting places
-	      // yeah, remove_if with a lambda, but let's wait a bit more so that newer C++
-	      // compilers get a broader base
-	      for(auto phI=peakheights[rgi].begin(); phI!=peakheights[rgi].end();){
-		if(*phI==-1) {
-		  phI=peakheights[rgi].erase(phI);
-		}else{
-		  ++phI;
-		}
-	      }
-
-	      auto minval=*vsI;
-	      for(auto tI=vsI; tI<veI; ++tI){
-		if(*tI<minval) minval=*tI;
-	      }
-	      for(auto tI=vsI; tI<veI; ++tI){
-		if(*tI==minval) {
-		  valleydepths[rgi].push_back(tI-spanner[rgi].cbegin());
-		  hascuts=true;
-		  cout << "New valley min " << minval << " at " << tI-spanner[rgi].cbegin() << endl;
-		}
-	      }
-	    }
-	  }
-	}
-      }
-    }
-
-    if(hascuts){
-      // now create the break ranges +/-50 from the valleys
-      for(auto rge : valleydepths){
-	for(auto pos : rge){
-	  auto from=pos-50;
-	  if(from<0) from=0;
-	  auto to=pos+50;
-	  if(to>getContigLength()) to=getContigLength();
-	  for(; from<to; ++from) breakmarker[from]=1;
-	}
-      }
-
-      // add in the peak markers
-      for(auto rge : peakheights){
-	for(auto pos : rge){
-	  breakmarker[pos]=1;
-	}
-      }
-
-      // last step: find longest range without problems
-      retval.first=0;
-      retval.second=1;
-      auto tpair=retval;
-      bool inrange=!breakmarker[0];
-      if(inrange) tpair.first=0;
-      for(int32 bmi=0; bmi<breakmarker.size(); ++bmi){
-	//cout << bmi << "\t" << inrange << " " << static_cast<int16>(breakmarker[bmi]);
-	if(inrange){
-	  if(breakmarker[bmi]) {
-	    //cout << " stop range";
-	    tpair.second=bmi;
-	    if(tpair.second-tpair.first > retval.second-retval.first){
-	      retval=tpair;
-	      //cout << " best";
-	    }
-	    inrange=false;
-	  }
-	}else{
-	  if(!breakmarker[bmi]) {
-	    //cout << " starting range";
-	    inrange=true;
-	    tpair.first=bmi;
-	  }
-	}
-	//cout << "\n";
-      }
-      if(inrange){
-	tpair.second=getContigLength();
-	if(tpair.second-tpair.first > retval.second-retval.first){
-	  retval=tpair;
-	}
-      }
-    }
-  }
-
-  CEBUG("returning ret: " << retval.first << "\t" << retval.second << endl);
-  return retval;
-}
-#define CEBUG(bla)
-
-#define CEBUG(bla)   {cout << bla; cout.flush();}
-void Contig::priv_cprForRGID(ReadGroupLib::ReadGroupID rgid, vector<uint64> & spanner, vector<uint64> & spanner12, vector<uint64> & nonspanner)
-{
-  FUNCSTART("void Contig::checkPairConsistency()");
-
-  spanner.clear();
-  spanner.resize(getContigLength(),0);
-  spanner12=spanner;
-  nonspanner=spanner;
-
-  CEBUG("cprForRGID on readgroup:\n" << rgid);
-  auto pcrI=CON_reads.begin();
-  auto opcrI=pcrI;
-  auto crE=CON_reads.end();
-  for(; pcrI != crE; ++pcrI){
-    if(pcrI->getReadGroupID()!=rgid
-       || !pcrI->hasTemplateInfo()
-       || pcrI->isBackbone()
-       || pcrI->isRail()
-       || pcrI->isCoverageEquivalentRead()) continue;
-
-    auto tpid=pcrI->getTemplatePartnerID();
-    opcrI=CON_reads.getIteratorOfReadpoolID(tpid);
-    bool tpartnerincontig=opcrI!=crE;
-    //CEBUG("Looking at " << pcrI.getORPID() << "\t" << pcrI->getName() << endl);
-    //CEBUG(pcrI->isBackbone() << '\t' << pcrI->isRail() << '\t' << pcrI->isCoverageEquivalentRead() << '\t' << pcrI->hasTemplateInfo()  << '\t' << pcrI->getTemplatePartnerID() << '\t' << tpartnerincontig << endl);
-
-    if(tpartnerincontig){
-      auto start1=pcrI.getReadStartOffset();
-      auto end1=start1+pcrI->getLenClippedSeq();
-      auto start2=opcrI.getReadStartOffset();
-      auto end2=start2+opcrI->getLenClippedSeq();
-
-      if(start1<=start2){
-	int64 addval=2;
-	if(start1==start2) addval=1;
-
-	auto start=min(start1,start2);
-	auto end=max(end1,end2);
-
-	for(auto * ptr=&spanner[start]; ptr!=&spanner[end]; ++ptr) *ptr+=addval;
-	for(auto * ptr=&spanner12[start1]; ptr!=&spanner12[end1]; ++ptr) *ptr+=addval;
-	for(auto * ptr=&spanner12[start2]; ptr!=&spanner12[end2]; ++ptr) *ptr+=addval;
-      }
-    }else{
-      // template partner not in contig
-      //
-      // but maybe the template partner was completely clipped away?
-      // then this read would not be a non-spanner, just a paired read
-      //  which became a single read. How to treat this?
-      // TODO: cleanest solution: after loading / clipping, move
-      //  widowed reads into own readgroup
-      //
-      // for the time being, just make a small workaround: if clipped
-      //  length of partner <25, do not treat it as non-spanner
-
-      bool isnonspanner=true;
-
-      if(tpid>=0){
-	if(!CON_readpool->getRead(tpid).hasValidData()
-	   || CON_readpool->getRead(tpid).getLenClippedSeq()<=25){
-	  isnonspanner=false;
-	}
-      }
-
-      if(isnonspanner){
-	auto start=pcrI.getReadStartOffset();
-	auto end=start+pcrI->getLenClippedSeq();
-	for(auto * ptr=&nonspanner[start]; ptr!=&nonspanner[end]; ++ptr) *ptr+=1;
-      }
-    }
-
-  }
-
-  // hacky hack
-  // templates having both reads in a contig should be counted only once and the
-  //  "if(start1<=start2)" takes care of most cases ... but not when templates start
-  //  at the same position.
-  // therefore, in the loop above the standard add is +2 for templates not starting
-  //  at same position and +1 at same position (but these will run twice)
-  // aftererwards (well, here), we divide by 2 and get back what we want
-  for(auto & se : spanner) se/=2;
-  for(auto & se : spanner12) se/=2;
-}
-#define CEBUG(bla)
diff --git a/src/mira/dataprocessing.C b/src/mira/dataprocessing.C
index e77ed7c..fa71e0a 100644
--- a/src/mira/dataprocessing.C
+++ b/src/mira/dataprocessing.C
@@ -11,309 +11,391 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
+// 	$Id$	
+
 // functions to process reads
 // currently in namespace and object assembly
 
 
-#include "mira/dataprocessing.H"
-
-#include "util/dptools.H"
-#include "util/progressindic.H"
-
-#include "mira/assembly.H"
-#include "mira/hashstats.H"
-#include "mira/parameters.H"
-#include "mira/readpool.H"
-#include "mira/skim.H"
-
-#include <boost/regex.hpp>
-#include <boost/lexical_cast.hpp>
-#include <boost/algorithm/string.hpp>
-
+#ifndef lint
+static char vcid2[] = "$Id$";
+#endif /* lint */
 
+#include "boost/unordered_map.hpp" 
+#include <boost/regex.hpp> 
 
-using namespace std;
-
+#include "assembly.H"
+#include <ctype.h>
 
 //#define CEBUG(bla)   {if(CEBUGFLAG) {cout << bla; cout.flush();}}
 #define CEBUG(bla)
 
 
 
-std::vector<DataProcessing::poolskim_t> DataProcessing::DP_adapskims;
-boost::mutex DataProcessing::DP_ps_changemutex;
-
-HashStatistics<vhash64_t> DataProcessing::DP_phix174hashstatistics;
-
-bool DataProcessing::DP_px174hs_init=false;
-boost::mutex DataProcessing::DP_px174hs_changemutex;         // exclusive mutex for write access to hashstatistics, we need that as it's a static variable
-
-
-DataProcessing::poolskim_t::~poolskim_t(){
-  if(poolptr) delete poolptr;
-  if(skimptr) delete skimptr;
-}
-
-
-DataProcessing::DataProcessing(std::vector<MIRAParameters> * params) : DP_miraparams_ptr(params), DP_tmpmtpolyAT(Read::REA_defaulttag_SOFApolyA_sequence)
-{
-  DP_threadid=-1;
-  DP_tmpvu8.reserve(16300); // bit less than 16kb
-
-  // vector with enough capacity so that it does not get reallocated
-  // -> multiple threads won't get their data removed under them during the run
-  DP_adapskims.reserve(1024);
-
-};
 
+//#define CEBUG(bla)   {if(id1==2282 && id2==342) {cout << bla; cout.flush();}}
+//#define CEBUG(bla)   {cout << bla; cout.flush();}
+//#define CEBUG(bla)   {cout << bla;}
 
 
-DataProcessing::~DataProcessing()
-{
-  stopLogging();
 
-//  for(auto & ps : DP_adapskims){
-//    if(ps.poolptr!=nullptr) {
-//      delete ps.poolptr;
-//      delete ps.skimptr;
-//    }
-//  }
-}
 
 
 /*************************************************************************
  *
- * Needs frequencies to be set in reads
- * returns number of reads marked as chimeras
- * if killreads==true: reads killed (length set to 0, isUsedInAssembly()==false)
- *   else only marked in ischimera
- * no kill if nochimerakill[readindex] is set
+ * ugly and slow, but works and is fast enough
+ *
  *
  *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-uint32 DataProcessing::markReadsWithInvalidKMerEndsAsChimeras_Pool(ReadPool & rp, uint32 bph, bool killreads, std::vector<uint8> * debrisreasonptr, std::vector<uint8> & ischimera, std::vector<uint8> & nochimerakill, const std::string & logprefix)
+//#define CEBUG(bla)   {cout << bla; cout.flush(); }
+void Assembly::mergeTemplateInfo(const string & tifile, const string & logname, const string & logprefix)
 {
-  uint32 retvalue=0;
-  for(readid_t rpi=0; rpi<rp.size(); ++rpi){
-    Read & actread=rp[rpi];
+  FUNCSTART("void Assembly::mergeTemplateInfo(const string & tifile, const string & logname, const string & logprefix)");
 
-    CEBUG("CHIMP 1:"
-	  << " " << actread.hasValidData()
-	  << " " << actread.isUsedInAssembly()
-	  << "\t" << actread.getName() << endl);
-    CEBUG(actread);
+  cout << "Merging template info from " << tifile << ":\n";
 
-    if(actread.hasValidData()
-       && actread.isUsedInAssembly()
-       && !(actread.isBackbone()
-	    || actread.isRail())){
-      CEBUG("CHIMP 2 " << actread.getName() << endl);
-      if(checkReadForInvalidKMerEndsAsChimera(actread,bph)){
-	CEBUG("CHIMP 3 " << actread.getName() << endl);
-	++retvalue;
-
-	bool killthis=killreads && (nochimerakill.empty() || !nochimerakill[rpi]);
-	if(killthis){
-	  actread.setRQClipoff(0);
-	  actread.setUsedInAssembly(false);
-	}
+  CEBUG("Building hash table ... "); cout.flush();
+  
+  typedef boost::unordered_map<std::string, int32> strmap;
+  strmap rnmap;
+  strmap::iterator rnI;
 
-	if(!ischimera[rpi]){
-	  // change msg dependend on kill???
-	  DP_logfout << logprefix
-		     << " incorrectible end or chimera. Mark or kill "
-		     << actread.getName() << '\t'
-		     << actread.getRightClipoff() << " -> 0\n";
-	}
-	ischimera[rpi]=true;
+  for(uint32 i=0; i<AS_readpool.size();i++){
+    if(!AS_readpool[i].getName().empty()) {
+      rnmap[AS_readpool[i].getName()]=i;
+    }
+  }
+  CEBUG("done." << endl);
 
-	if(debrisreasonptr!=nullptr) (*debrisreasonptr)[rpi]=Assembly::DEBRIS_CLIP_INCORRECTIBLEENDORCHIMERA;
-      }
+  ofstream logfout;
+  if(!logname.empty()){
+    logfout.open(logname.c_str(), ios::out|ios::app);
+    if(!logfout){
+      MIRANOTIFY(Notify::FATAL, "Could not open log for appending: " << logname);
     }
   }
 
-  return retvalue;
-}
-//#define CEBUG(bla)
+  ifstream tifin;
+  tifin.open(tifile.c_str(), ios::in|ios::ate);
+  if(!tifin){
+    MIRANOTIFY(Notify::FATAL, "File not found: " << tifile);
+  }
+  streampos tifsize=tifin.tellg();
+  tifin.seekg(0, ios::beg);
 
+  ProgressIndicator<streamsize> P (0, tifsize,1000);
 
-/*************************************************************************
- *
- * Needs frequencies to be set in read
- * returns true if considered chimera
- *
- *************************************************************************/
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-bool DataProcessing::checkReadForInvalidKMerEndsAsChimera(Read & actread, uint32 bph)
-{
-  bool retvalue=false;
-  CEBUG("CHIMR 1:"
-	<< " " << actread.hasValidData()
-	<< " " << actread.getLenClippedSeq()
-	<< " " << actread.getRightClipoff()
-	<< " " << actread.hasBaseHashStats()
-	<< "\t" << actread.getName() << endl);
-
-  if(!actread.hasValidData()
-     || actread.getLenClippedSeq()==0
-     || actread.getRightClipoff()==0
-     || !actread.hasBaseHashStats()) return false;
-
-  // no chimera if read < kmer size
-  // or if kmer does not cover at least 50%
-  if(actread.getLenClippedSeq()<bph
-     || 100.0/actread.getLenClippedSeq()*bph < 50.0) return false;
-
-  bool hasvalid=false;
-  auto bphI=actread.getBPosHashStats().begin();
-  bphI+=actread.getLeftClipoff();
-  auto bphE=bphI+actread.getLenClippedSeq()-bph+1;
-  for(; bphI!=bphE; ++bphI){
-    if(bphI->fwd.getFrequency()>1){
-      hasvalid=true;
-      break;
-    }
-  }
+  string token;
 
-  CEBUG("CHIMR 2:"
-	<< " " << hasvalid
-	<< "\t" << actread.getName() << endl);
+  while(!tifin.eof()){
+    tifin >> token;
+    if(tifin.eof()) break;
+    if(P.delaytrigger()) P.progress(tifin.tellg());
 
-  bool maybechimera=false;
-  if(hasvalid){
-    CEBUG("CHIMR 3:"
-	  << " " << static_cast<uint16>(actread.getBPosHashStats()[actread.getLeftClipoff()].fwd.getFrequency())
-	  << " " << static_cast<uint16>(actread.getBPosHashStats()[actread.getRightClipoff()-1].rev.getFrequency())
-	  << "\t" << actread.getName() << endl);
+    //tifin >> sd_score >> sd_readname;
 
-    if(actread.getBPosHashStats()[actread.getLeftClipoff()].fwd.getFrequency()<2
-       || actread.getBPosHashStats()[actread.getRightClipoff()-1].rev.getFrequency()<2){
-      maybechimera=true;
+    if(tifin.eof()) break;
+
+    if(token[0]=='+'){
+      // new lib
     }else{
-      // quick way did not find chimera, do it the tedious way: invalid on fwd/rev at same pos
-      // or maybe not atm ...
+      // existing name
+      bool foundname=false;
+      rnI=rnmap.find(token);
+      if(rnI==rnmap.end()) {
+	CEBUG("Not found: " << token << endl);
+	continue;
+      }
+      uint32 foundreadid=rnI->second;
+      if(!AS_readpool[foundreadid].hasValidData()) continue;
+      
+      Read actread(AS_readpool[foundreadid]);
+      assembly_parameters const & as_params= AS_miraparams[actread.getSequencingType()].getAssemblyParams();
     }
   }
+  P.finishAtOnce();
 
-  if(!hasvalid || maybechimera){
-    retvalue=true;
+  tifin.close();
+
+  if(!logname.empty()){
+    logfout.close();
   }
 
-  return retvalue;
-}
-//#define CEBUG(bla)
+  cout << "\nDone." << endl;
 
 
+  FUNCEND();
+  return;
+}
+//#define CEBUG(bla)
 
 /*************************************************************************
  *
- * Meaner than the version looking just at ends. Should probably be called
- *  only on the last pass
+ * ugly and slow, but works and is fast enough
  *
- * Needs frequencies to be set in reads
- * returns number of reads clipped and marked as chimeras
- * no length check of reads if bph==0
- * no kill if nochimerakill[readindex] is set
  *
  *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-uint32 DataProcessing::markReadsWithRareKMersAsChimeras_Pool(ReadPool & rp, uint32 bph, bool killreads, std::vector<uint8> * debrisreasonptr, std::vector<uint8> & ischimera, std::vector<uint8> & nochimerakill, const std::string & logprefix)
+//#define CEBUG(bla)   {cout << bla; cout.flush(); }
+void Assembly::mergeSSAHA2SMALTVecScreenData(const string & ssahafile, bool issmalt, const string & logname, const string & logprefix)
 {
-  uint32 retvalue=0;
-  for(readid_t rpi=0; rpi<rp.size(); ++rpi){
-    Read & actread=rp[rpi];
+  FUNCSTART("void Assembly::mergeSSAHA2VecScreenData(const string & ssahafile, bool issmalt, const string & logname, const string & logprefix)");
 
-    CEBUG("RKACp 1:"
-	  << " " << actread.hasValidData()
-	  << " " << actread.isUsedInAssembly()
-	  << "\t" << actread.getName() << endl);
-    CEBUG(""; Read::setCoutType(Read::AS_TEXT); cout << actread);
+  cout << "Merging vector screen data from ";
+  if(issmalt){
+    cout << "SMALT";
+  }else{
+    cout << "SSAHA2";
+  }
+  cout << " results file " << ssahafile << ":\n";
 
-    if(actread.hasValidData()
-       && actread.isUsedInAssembly()
-       && !(actread.isBackbone()
-	    || actread.isRail())){
-      CEBUG("RKACp 2 " << actread.getName() << endl);
-      if(checkReadForRareKMersAsChimera(actread,bph)){
-	CEBUG("RKACp 3 " << actread.getName() << endl);
-	++retvalue;
-
-	bool killthis=killreads && (nochimerakill.empty() || !nochimerakill[rpi]);
-	if(killthis){
-	  actread.setRQClipoff(0);
-	  actread.setUsedInAssembly(false);
-	}
+  CEBUG("Building hash table ... "); cout.flush();
+  
+  typedef boost::unordered_map<std::string, int32> strmap;
+  strmap rnmap;
+  strmap::iterator rnI;
+
+  for(uint32 i=0; i<AS_readpool.size();i++){
+    if(!AS_readpool[i].getName().empty()) {
+      rnmap[AS_readpool[i].getName()]=i;
+    }
+  }
+  CEBUG("done." << endl);
+
+  ofstream logfout;
+  if(!logname.empty()){
+    logfout.open(logname.c_str(), ios::out|ios::app);
+    if(!logfout){
+      MIRANOTIFY(Notify::FATAL, "Could not open log for appending: " << logname);
+    }
+  }
+
+  ifstream ssahafin;
+  ssahafin.open(ssahafile.c_str(), ios::in|ios::ate);
+  if(!ssahafin){
+    MIRANOTIFY(Notify::FATAL, "File not found: " << ssahafile);
+  }
+  streampos sfinsize=ssahafin.tellg();
+  ssahafin.seekg(0, ios::beg);
+
+  ProgressIndicator<streamsize> P (0, sfinsize,1000);
+
+  uint32 sd_score;
+  string sd_readname;
+  string sd_vecname;
+  uint32 sd_rfrom;
+  uint32 sd_rto;
+  uint32 sd_vfrom;
+  uint32 sd_vto;
+  string sd_dir;
+  uint32 sd_totalmatchsize;
+  float  sd_percentmatch;
+  uint32 sd_rlen;
+  
+  string token;
+  string alstring;
+  if(issmalt){
+    alstring="alignment:";
+  }else{
+    alstring="ALIGNMENT:";
+  }
+
+  bool haserrors=false;
 
-	if(!ischimera[rpi]){
-	  // change msg dependend on kill???
-	  DP_logfout << logprefix
-		     << " terminally incorrectible or chimera. Mark or kill "
-		     << actread.getName() << '\t'
-		     << actread.getRightClipoff() << " -> 0\n";
+  while(!ssahafin.eof()){
+    ssahafin >> token;
+    if(ssahafin.eof()) break;
+    if(P.delaytrigger()) P.progress(ssahafin.tellg());
+    if(token.compare(0,alstring.size(),alstring) != 0) {
+      getline(ssahafin,token);
+      continue;
+    }
+    ssahafin >> sd_score >> sd_readname;
+
+    if(ssahafin.eof()) break;
+
+    // *sigh* allow for empty names
+    sd_vecname.clear();
+    {
+      bool loopit=true;
+      char tmp;
+
+      ssahafin.get(tmp);
+      loopit=true;
+      do{
+	ssahafin.get(tmp);
+	if(ssahafin.eof()) break;
+	if(tmp==' ' || tmp=='\t'){
+	  loopit=false;
+	}else{
+	  sd_vecname.push_back(tmp);
 	}
-	ischimera[rpi]=true;
+      }while(loopit);
+    }
+
+    if(ssahafin.eof()) break;
+
+    ssahafin >> sd_rfrom
+	     >> sd_rto
+	     >> sd_vfrom
+	     >> sd_vto
+	     >> sd_dir
+	     >> sd_totalmatchsize
+	     >> sd_percentmatch
+	     >> sd_rlen;
+     
+    if(ssahafin.eof()) break;
+
+    CEBUG(sd_readname << '\t' << sd_rfrom << '\t' << sd_rto << '\n');
+
+    bool foundname=false;
+    rnI=rnmap.find(sd_readname);
+    if(rnI==rnmap.end()) {
+      CEBUG("Not found: " << sd_readname << endl);
+      continue;
+    }
+    uint32 foundreadid=rnI->second;
+    if(!AS_readpool[foundreadid].hasValidData()) continue;
+
+    Read actread(AS_readpool[foundreadid]);
+    assembly_parameters const & as_params= AS_miraparams[actread.getSequencingType()].getAssemblyParams();
+
+    if(actread.getLenSeq() != sd_rlen){
+      if(actread.isSequencingType(Read::SEQTYPE_SOLEXA) && actread.getLenSeq() != sd_rlen+1) {
+	cout << "\nError! The length of read " << actread.getName() 
+	     << " (" << actread.getLenSeq() 
+	     << ") does not match the length given in the SSAHA2/SMALT file (" 
+	     << sd_rlen << ")\nSSAHA2 line:"
+	     << ' ' << token
+	     << ' ' << sd_score
+	     << ' ' << sd_readname
+	     << ' ' << sd_vecname
+	     << ' ' << sd_rfrom
+	     << ' ' << sd_rto
+	     << ' ' << sd_vfrom
+	     << ' ' << sd_vto
+	     << ' ' << sd_dir
+	     << ' ' << sd_totalmatchsize
+	     << ' ' << sd_percentmatch
+	     << ' ' << sd_rlen << endl;
+	haserrors=true;
+      }
+    }
 
-	if(debrisreasonptr!=nullptr) (*debrisreasonptr)[rpi]=Assembly::DEBRIS_CLIP_TERMINALLYINCORRECTIBLEORCHIMERA;
+    CEBUG("SSAHA2/SMALT line:"
+	  << ' ' << token
+	  << ' ' << sd_score
+	  << " r: " << sd_readname
+	  << " v: " << sd_vecname
+	  << " # " << sd_rfrom
+	  << ' ' << sd_rto
+	  << ' ' << sd_vfrom
+	  << ' ' << sd_vto
+	  << ' ' << sd_dir
+	  << ' ' << sd_totalmatchsize
+	  << ' ' << sd_percentmatch
+	  << ' ' << sd_rlen << endl);
+
+    //Read::setCoutType(Read::AS_FASTA);
+    //CEBUG(actread);
+    //Read::setCoutType(Read::AS_CLIPPEDFASTA);
+    //CEBUG(actread);
+    
+    // in SSAHA2 output, from rfrom may be > rto for reverse matches
+    // swap in these cases
+    if(sd_rfrom > sd_rto) swap(sd_rfrom,sd_rto);
+
+    for(uint32 i=sd_rfrom-1; i<sd_rto; i++){
+      bool domask=false;
+      if(as_params.as_clip_ssahamerge_strictfrontclip >0
+	 || as_params.as_clip_ssahamerge_strictendclip >0){
+	if(as_params.as_clip_ssahamerge_strictfrontclip >0 
+	   && static_cast<int32>(i)<as_params.as_clip_ssahamerge_strictfrontclip) domask=true;
+	if(as_params.as_clip_ssahamerge_strictendclip>0 
+	   && i>=actread.getLenSeq()-as_params.as_clip_ssahamerge_strictendclip) domask=true;
+      }else{
+	domask=true;
       }
+      if(domask) actread.changeBaseInSequence('X',0,i);
     }
+    //Read::setCoutType(Read::AS_FASTA);
+    //CEBUG(actread);
+    //Read::setCoutType(Read::AS_CLIPPEDFASTA);
+    //CEBUG(actread);
+
+    actread.setClipoffsToMaskedChars(as_params.as_clip_ssahamerge_gapsize,
+				     as_params.as_clip_ssahamerge_maxfrontgap,
+				     as_params.as_clip_ssahamerge_maxendgap,
+				     false);
+    //Read::setCoutType(Read::AS_CLIPPEDFASTA);
+    //CEBUG(actread);
+    
+    if(actread.getLMClipoff() > AS_readpool[foundreadid].getLSClipoff()){
+      AS_readpool[foundreadid].setLSClipoff(actread.getLMClipoff());
+      CEBUG("clippyl\n");
+      if(!logname.empty()){
+	logfout << logprefix << " SSAHA2/SMALT clip left " 
+		<< actread.getName() 
+		<< " to: " 
+		<< AS_readpool[foundreadid].getLSClipoff() << '\n';
+      }
+    }else{
+      if(!logname.empty()){
+	logfout << logprefix << "unchanged SSAHA2/SMALT clip left " 
+		<< actread.getName() 
+		<< " stays: " 
+		<< AS_readpool[foundreadid].getLSClipoff() << '\n';
+      }
+    }
+    if(actread.getRMClipoff() < AS_readpool[foundreadid].getRSClipoff()){
+      AS_readpool[foundreadid].setRSClipoff(actread.getRMClipoff());
+      CEBUG("clippyr\n");
+      if(!logname.empty()){
+	logfout << logprefix << " SSAHA2/SMALT clip right " 
+		<< actread.getName() 
+		<< " to: " 
+		<< AS_readpool[foundreadid].getRSClipoff() << '\n';
+      }
+    }else{
+      if(!logname.empty()){
+	logfout << logprefix << "unchanged SSAHA2/SMALT clip right " 
+		<< actread.getName() 
+		<< " stays: " 
+		<< AS_readpool[foundreadid].getRSClipoff() << '\n';
+      }
+    }
+
+    //Read::setCoutType(Read::AS_TEXTSHORT);
+    //CEBUG(AS_readpool[foundreadid]);
   }
+  P.finishAtOnce();
 
-  return retvalue;
-}
-//#define CEBUG(bla)
+  ssahafin.close();
 
+  if(!logname.empty()){
+    logfout.close();
+  }
 
-/*************************************************************************
- *
- * Needs frequencies to be set in read
- * returns true if chimera
- *
- *************************************************************************/
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-bool DataProcessing::checkReadForRareKMersAsChimera(Read & actread, uint32 bph)
-{
-  CEBUG("RKACr 1:"
-	<< " " << actread.hasValidData()
-	<< " " << actread.getLenClippedSeq()
-	<< " " << actread.getRightClipoff()
-	<< " " << actread.hasBaseHashStats()
-	<< "\t" << actread.getName() << endl);
-
-  if(!actread.hasValidData()
-     || actread.getLenClippedSeq()==0
-     || actread.getRightClipoff()==0
-     || !actread.hasBaseHashStats()) return false;
-
-  // no chimera if read < kmer size
-  if(actread.getLenClippedSeq()<bph) return false;
-
-  bool hasrare=false;
-  auto bphI=actread.getBPosHashStats().begin();
-  bphI+=actread.getLeftClipoff();
-  auto bphE=bphI+actread.getLenClippedSeq()-bph+1;
-  for(; bphI!=bphE; ++bphI){
-    if(!bphI->fwd.isValid() || bphI->fwd.getFrequency()<2){
-      hasrare=true;
-      break;
-    }
+  cout << "\nDone merging SSAHA2 vector screen data." << endl;
+
+  if(haserrors){
+    MIRANOTIFY(Notify::FATAL,"There were errors in the SSAHA2 data, most probably the sequences used to screen are different from\nthe ones loaded now (see log above). Sorry, MIRA has to abort, please check your data.");
   }
 
-  return hasrare;
+  FUNCEND();
+  return;
 }
 //#define CEBUG(bla)
 
@@ -323,652 +405,888 @@ bool DataProcessing::checkReadForRareKMersAsChimera(Read & actread, uint32 bph)
 
 /*************************************************************************
  *
- * Note: hashstatistics will be modified by this if trimfreq>0
+ *
  *
  *
  *************************************************************************/
 
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-template<typename TVHASH_T>
-uint32 DataProcessing::performSDBGChimeraSearch_Pool(ReadPool & rp, HashStatistics<TVHASH_T> & hsd, uint32 trimfreq, vector<uint8> * debrisreasonptr, const string & logprefix)
+void Assembly::performHashAnalysis(int32 version, const string prefix, const string postfix, const string logname)
 {
-  FUNCSTART("void DataProcessing::performSDBGChimeraSearch_Pool(ReadPool & rp, HashStatistics<TVHASH_T> & hsd, uint32 trimfreq, vector<uint8> * debrisreasonptr, const string & logprefix)");
+  FUNCSTART("void Assembly::performHashAnalysis()");
+  //CEBUG("BEFORE\n");
+  //for(uint32 actid=0; actid<AS_readpool.size(); actid++){
+  //  Read & r=AS_readpool.getRead(actid);
+  //  r.integrityCheck();
+  //  Read::setCoutType(Read::AS_TEXT);
+  //  cout << r;
+  //}
 
-  uint32 retvalue=0;
+  assembly_parameters const & as_fixparams= AS_miraparams[0].getAssemblyParams();
+  skim_parameters const & skim_params= AS_miraparams[0].getSkimParams();
 
-  if(debrisreasonptr != nullptr){
-    BUGIFTHROW(debrisreasonptr->size() != rp.size(),"debrisreasonptr->size() != rp.size()");
-  }
+  uint8 basesperhash=skim_params.sk_basesperhash;
+  if(sizeof(uint64) < 8 && basesperhash > 15) basesperhash=15;
 
-  if(trimfreq>0){
-    hsd.trimHashStatsByFrequencyAND(trimfreq,trimfreq,0);
-    hsd.calcKMerForks(trimfreq,true);
+  uint32 nastyrepeatratio=0;
+  if(AS_needsskimfornastyrepeats && skim_params.sk_masknastyrepeats){
+    AS_needsskimfornastyrepeats=false;
+    nastyrepeatratio=skim_params.sk_nastyrepeatratio;
   }
 
-  hsd.buildSDBGraphs();
+  {
+    Skim s3;
+
+    s3.setHashFrequencyRatios(skim_params.sk_freqest_minnormal,
+			      skim_params.sk_freqest_maxnormal,
+			      skim_params.sk_freqest_repeat,
+			      skim_params.sk_freqest_heavyrepeat,
+			      skim_params.sk_freqest_crazyrepeat,
+			      skim_params.sk_nastyrepeatratio);
+
+    s3.analyseHashes(AS_miraparams[0].getDirectoryParams().dir_tmp,
+		     AS_readpool,
+		     true,
+		     false,
+		     false,
+		     true,
+		     1,
+		     basesperhash,
+		     1,
+		     nastyrepeatratio>0);
+
+    if(AS_miraparams[0].getAssemblyParams().as_buntify_reads){
+      buntifyReadsByHashFreq(basesperhash, AS_readpool);
+    }
+  }
 
-  ProgressIndicator<int32>  pi(0,rp.size());
-  for(readid_t rpi=0; rpi<rp.size(); ++rpi){
-    pi.increaseprogress();
-    Read & actread=rp[rpi];
+  //CEBUG("AFTER\n");
+  //for(uint32 actid=0; actid<AS_readpool.size(); actid++){
+  //  Read & r=AS_readpool.getRead(actid);
+  //
+  //  Read::setCoutType(Read::AS_TEXT);
+  //
+  //  if(r.getName()=="FF5UQ0101A62BE.fn"
+  //     || r.getName()=="FFPHEER01DATWZ"
+  //     || r.getName()=="FFPHEER01AK3C0"){
+  //    cout << r;
+  //  }
+  //}
+
+  //if(nastyrepeatratio){
+  if(skim_params.sk_repeatlevel_in_infofile){
+    string filename;
+
+    if(logname.size()){
+      filename=buildFileName(version, prefix, postfix, logname, "");
+    }else{
+      //filename=buildFileName(version, prefix, postfix,
+      //			     as_fixparams.as_outfile_stats_readrepeats,
+      //			     ".lst");
+
+      //filename=buildDefaultInfoFileName(version, prefix, postfix,
+      filename=buildDefaultInfoFileName(-1, "", "",
+					"",
+					as_fixparams.as_outfile_stats_readrepeats,
+					".lst",
+					true);
+    }
 
-    if(actread.hasValidData()
-//	   && AS_miraparams[actread.getSequencingType()].getAssemblyParams().as_clip_proposeendclips
-       && !(actread.isBackbone()
-	    || actread.isRail())){
-      if(performSDBGChimeraSearch_Read(actread,hsd,logprefix)){
-	++retvalue;
-	if(debrisreasonptr!=nullptr) (*debrisreasonptr)[rpi]=Assembly::DEBRIS_CLIP_CHIMERA;
-	actread.setUsedInAssembly(false);
+    cout << "Writing read repeat info to: " << filename << " ... ";
+    cout.flush();
+
+    uint32 howmanys=0;
+    uint32 howmanyt=0;
+    uint32 repanalysislevel=skim_params.sk_repeatlevel_in_infofile;
+    if(repanalysislevel<5) repanalysislevel=5;
+    if(repanalysislevel>8) repanalysislevel=8;
+
+    ofstream fout;
+    fout.open(filename.c_str(), ios::out|ios::trunc);
+    for(uint32 rpi=0; rpi<AS_readpool.size(); rpi++){
+      Read & actread= AS_readpool.getRead(rpi);
+      if(!actread.hasValidData()
+	 || !actread.isUsedInAssembly()) continue;
+      bool mustshow=false;
+      if(actread.hasTag(Read::REA_tagentry_idHAF5,-1)) {
+	if(repanalysislevel==5) mustshow=true;
+      }else if(actread.hasTag(Read::REA_tagentry_idHAF6,-1)) {
+	if(repanalysislevel<=6) mustshow=true;
+      }else if(actread.hasTag(Read::REA_tagentry_idHAF7,-1)) {
+	if(repanalysislevel<=7) mustshow=true;
+      }else if(actread.hasTag(Read::REA_tagentry_idMNRr,-1)) {
+	if(repanalysislevel<=8) mustshow=true;
+      }
+      if(mustshow){
+	bool countedthisseq=false;
+	for(uint32 tn=0; tn<actread.getNumOfTags(); tn++){
+	  const multitag_t & acttag=actread.getTag(tn);
+	  if(acttag.to-acttag.from +1 >= basesperhash){
+	    mustshow=false;
+	    if(acttag.identifier==Read::REA_tagentry_idHAF5) {
+	      if(repanalysislevel==5) mustshow=true;
+	    }else if(acttag.identifier==Read::REA_tagentry_idHAF6) {
+	      if(repanalysislevel<=6) mustshow=true;
+	    }else if(acttag.identifier==Read::REA_tagentry_idHAF7) {
+	      if(repanalysislevel<=7) mustshow=true;
+	    }else if(acttag.identifier==Read::REA_tagentry_idMNRr) {
+	      if(repanalysislevel<=8) mustshow=true;
+	    }
+	    if(mustshow){
+	      if(!countedthisseq){
+		countedthisseq++;
+		++howmanys;
+	      }
+	      ++howmanyt;
+	      fout << actread.getName() << '\t'
+		   << acttag.getIdentifierStr() << '\t';
+	      for(uint32 readpos=acttag.from; readpos<=acttag.to; readpos++){
+		fout << static_cast<char>(toupper(actread.getBaseInSequence(readpos)));
+	      }
+	      fout << '\n';
+	    }
+	  }
+	}
       }
     }
+
+    cout << howmanys << " sequences with " << howmanyt << " masked stretches." << endl;
   }
 
-  pi.finishAtOnce();
-  return retvalue;
-}
+  if(AS_logflag_dumphashanalysis){
+    string logfilename=AS_miraparams[0].getDirectoryParams().dir_tmp+"/elog.dp.hashanalysis.lst";
 
+    cout << "elog hashan: " << logfilename << endl;
+    ofstream logfout;
+    logfout.open(logfilename.c_str(), ios::out|ios::trunc);
 
-template<typename TVHASH_T>
-bool DataProcessing::performSDBGChimeraSearch_Read(Read & actread, HashStatistics<TVHASH_T> & hsd, const string & logprefix)
-{
-  auto res=hsd.checkSequenceForSDBGChimeras(actread.getClippedSeqAsChar(),
-					    actread.getLenClippedSeq(),
-					    actread.getName().c_str());
-  if(res){
-    DP_logfout << logprefix
-	       << " SDBG chimera kill "
-	       << actread.getName() << '\t'
-	       << actread.getRightClipoff() << " -> 0\n";
-    actread.setRQClipoff(0);
-    // TODO: maybe set tags?
-  }
-  return res;
+    for(uint32 rpi=0; rpi<AS_readpool.size(); rpi++){
+      Read::setCoutType(Read::AS_TEXT);
+      logfout << AS_readpool[rpi];
+    }
+  }
+
+  FUNCEND();
+  return;
 }
 
 
 
+
+
+
+
+
+
 /*************************************************************************
  *
- * Note: hashstatistics will be modified by this if trimfreq>0
+ * expects reads to have baseflags set  (by performHashAnalysis())
  *
  *
  *************************************************************************/
 
 //#define CEBUG(bla)   {cout << bla; cout.flush();}
-template<typename TVHASH_T>
-uint32 DataProcessing::performSDBGEdits_Pool(ReadPool & rp, HashStatistics<TVHASH_T> & hsd, uint32 trimfreq)
+
+uint64 Assembly::performNewProposedCutbackClips(const string & logname, const string & logprefix)
 {
-  FUNCSTART("uint32 DataProcessing::performSDBGEdits_Pool(ReadPool & rp, HashStatistics<TVHASH_T> & hsd, uint32 trimfreq)");
+  FUNCSTART("void Assembly::performProposedCutbackClips(const string & logname, const string & logprefix)");
+
+  cout << "Hash analysis for proposed cutbacks:";
 
-  uint32 retvalue=0;
-  uint32 totaledits=0;
-  uint32 numfishyedits=0;
+  skim_parameters const & skim_params= AS_miraparams[0].getSkimParams();
+  assembly_parameters const & as_fixparams= AS_miraparams[0].getAssemblyParams();
 
-  if(trimfreq>0){
-    hsd.trimHashStatsByFrequencyAND(trimfreq,trimfreq,3); // but at least 3 kmers
-    hsd.calcKMerForks(trimfreq,true);
+  {
+    uint8 basesperhash=as_fixparams.as_clip_pec_basesperhash;
+    if(sizeof(uint64) < 8 && basesperhash > 15) basesperhash=15;
+
+    Skim s3;
+
+    s3.setHashFrequencyRatios(skim_params.sk_freqest_minnormal,
+			      skim_params.sk_freqest_maxnormal,
+			      skim_params.sk_freqest_repeat,
+			      skim_params.sk_freqest_heavyrepeat,
+			      skim_params.sk_freqest_crazyrepeat,
+			      skim_params.sk_nastyrepeatratio);
+
+    s3.analyseHashes(AS_miraparams[0].getDirectoryParams().dir_tmp,
+		     AS_readpool,
+		     true,
+		     false,
+		     false,
+		     true,
+		     1,
+		     basesperhash,
+		     1,
+		     false);
+  }
+
+  ofstream logfout;
+  if(!logname.empty()){
+    logfout.open(logname.c_str(), ios::out|ios::app);
+    if(!logfout){
+      MIRANOTIFY(Notify::FATAL, "Could not open log for appending: " << logname);
+    }
   }
 
-  hsd.buildSDBGraphs();
+  if(as_fixparams.as_dateoutput) dateStamp(cout);
+  cout << '\n';
 
-  vector<typename HashStatistics<TVHASH_T>::dbgedits_t> edits;
-  ProgressIndicator<int32>  pi(0,rp.size());
-  for(readid_t rpi=0; rpi<rp.size(); ++rpi){
-    pi.increaseprogress();
-    Read & actread=rp[rpi];
+  string ggcproblem="ggc";
 
-    if(actread.hasValidData()
-//	   && AS_miraparams[actread.getSequencingType()].getAssemblyParams().as_clip_proposeendclips
-       && !(actread.isBackbone()
-	    || actread.isRail())){
+  cout << "Looking for proposed cutbacks ... "; cout.flush();
 
-      hsd.proposeSDBGEditsForSequence(actread.getClippedSeqAsChar(),
-				      actread.getLenClippedSeq(),
-				      actread.getName().c_str(),
-				      edits);
-      bool hasedits=false;
-      if(!edits.empty()){
-	//cout << "Have " << edits.size() << " edits for " << actread.getName() << endl;
-	for(auto erI=edits.rbegin(); erI!=edits.rend(); ++erI){
-	  auto lendiff=static_cast<int32>(erI->len)-static_cast<int32>(erI->replacement.size());
-	  if(abs(lendiff)>2){
-	    // TODO: really stay silent?
-	    //cout << "Fishy edit: length " << lendiff << " " << actread.getName() << " " << erI->pos << " " << erI->pos+erI->len << " " << erI->len;
-	    //string olds(static_cast<string>(actread.getClippedSeqAsChar()).substr(erI->pos,erI->len));
-	    //cout << "\t" << olds
-	    //	 << "\t" << erI->replacement << endl;
-	    ++numfishyedits;
-	  }else{
-	    //cout << "Could correct " << erI-edits.rbegin() << " " << actread.getName() << " " << erI->pos << " " << erI->pos+erI->len << " " << erI->len;
-	    //string olds(static_cast<string>(actread.getClippedSeqAsChar()).substr(erI->pos,erI->len));
-	    //cout << "\n" << olds
-	    //     << "\n" << erI->replacement << endl;
-	    //Read::setCoutType(Read::AS_TEXT);
-	    //cout << "OLD:\n" << actread << endl;
-	    actread.clearTags();
-	    actread.smoothSequenceReplace(erI->pos+actread.getLeftClipoff(),erI->len,erI->replacement);
-	    //cout << "NEW:\n" << actread << endl;
-	    ++totaledits;
-	    hasedits=true;
-	  }
-	}
-	if(hasedits) ++retvalue;
-      }
-    }
-  }
+  uint32 cbleft=0;
+  uint32 cbright=0;
+  uint32 killed=0;
+  uint64 numbasesclipped=0;
+  for(uint32 actid=0; actid<AS_readpool.size(); actid++){
+    Read & r=AS_readpool.getRead(actid);
+    
+    //if(r.getName()=="EZRJ5AL02JMKBG"
+    //   || r.getName()=="E0K6C4E01EE4FA"
+    //   || r.getName()=="E0K6C4E02HKBO6"
+    //   || r.getName()=="E0K6C4E02JD918"
+    //   || r.getName()=="E0K6C4E02F3T1Y"
+    //   || r.getName()=="E0K6C4E02G544S"
+    //  ){
+    //  Read::setCoutType(Read::AS_TEXT);
+    //  cout << r;
+    //}
 
-  pi.finishAtOnce();
+    if(r.hasValidData()
+       && r.hasBaseHashStats()
+       && !(r.isBackbone() 
+	    || r.isRail())){
 
-  cout << "Performed " << totaledits << " edits.\n";
-  cout << "Rejected " << numfishyedits << " fishy edits.\n";
+      bool hasbeenclipped=false;
 
-  return retvalue;
-}
+      uint32 oldlen=r.getLenClippedSeq();
 
+      //if(r.getName()=="FF5UQ0101A62BE.fn"
+      //	 || r.getName()=="FFPHEER01DATWZ"
+      //	 || r.getName()=="FFPHEER01AK3C0"){
+      //	cout << r << endl;
+      //}
 
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
+#endif
 
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
+      {
+	int32 lpos=r.getLeftClipoff();
+	vector<Read::bposhashstat_t>::const_iterator bhsI=r.getBPosHashStats().begin();
+	advance(bhsI,lpos);
+	//Read::baseflags_t bf=Read::BFLAGS_CONFIRMED_MULTIPLEHASH;
+	switch(r.getSequencingType()){
+	case Read::SEQTYPE_SANGER :
+	case Read::SEQTYPE_454GS20 :
+	case Read::SEQTYPE_IONTORRENT :
+	case Read::SEQTYPE_PACBIO :
+	case Read::SEQTYPE_SOLEXA :{
+	  // at the moment same for all
+	  for(; lpos<static_cast<int32>(r.getLenSeq()); lpos++, bhsI++) {
+
+	    //if(r.getName()=="FF5UQ0101A62BE.fn"
+	    //   || r.getName()=="FFPHEER01DATWZ"
+	    //   || r.getName()=="FFPHEER01AK3C0"){
+	    //  cout << r.getName() << '\t' << lpos
+	    //	   << '\t' << (uint16) bhsI->fwd.getFrequency()
+	    //	   << '\t' << (uint16) bhsI->rev.getFrequency()
+	    //	   << endl;
+	    //}
+
+	    if(bhsI->fwd.getFrequency() > 1
+	       || bhsI->rev.getFrequency() > 1) break;
+	  }
+	  break;
+	}
+	default : {
+	  MIRANOTIFY(Notify::INTERNAL, "Don't know how to handle sequencing type '" << r.getNameOfSequencingType(r.getSequencingType()) << "'.\n");
+	}
+	}
 
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-template<typename TVHASH_T>
-void DataProcessing::performDigitalNormalisation_Pool(ReadPool & rp, HashStatistics<TVHASH_T> & hsd, vector<uint8> * debrisreasonptr)
-{
-  FUNCSTART("void DataProcessing::performDigitalNormalisation_Pool(ReadPool & rp, HashStatistics & hsd)");
-
-  uint32 numtaken=0;
-  uint32 numnormout=0;
-
-  vector<bool> normdone(rp.size(),false);
-  vector<bool> normout(rp.size(),false);
-  vector<bool> normthisrg(rp.size(),false);
-
-  // do the normalisation for every readgroup so that we independently get reads from every rg
-  for(auto rgi=1; rgi<ReadGroupLib::getNumReadGroups(); ++rgi){
-    auto rgid=ReadGroupLib::getReadGroupID(rgi);
-
-    hsd.digiNormReset();
-    normthisrg.clear();
-    normthisrg.resize(rp.size(),false);
-    cout << "\nReadgroup " << rgi << ":\n";
-    ProgressIndicator<int32>  pi(0,rp.size()*2);
-
-    // step 0 : only reads with freq >= 2, fwd, rev and no N
-    // step 1 : remaining reads
-    for(uint32 step=0; step<2; ++step){
-      for(uint32 rpi=0; rpi<rp.size(); ++rpi){
-	pi.increaseprogress();
-	if(normdone[rpi]) continue;
-	auto & actread=rp[rpi];
-	if(!actread.hasValidData()
-	   || !actread.isUsedInAssembly()
-	   || actread.isRail()
-	   || actread.isBackbone()) continue;
-	//Read::setCoutType(Read::AS_TEXT);
-	//cout << "### bla\n";
-	//cout << actread << endl;
-	bool lookatread=true;
-	if(step==0){
-	  auto bhsI=actread.getBPosHashStats().begin();
-	  bhsI+=actread.getLeftClipoff();
-	  for(auto ri=0; ri<actread.getLenClippedSeq(); ++ri){
-	    if(bhsI->fwd.getFrequency()<2 || !bhsI->fwd.hasConfirmedFwdRev()) lookatread=false;
+	
+	if(lpos != r.getLeftClipoff()){
+	  hasbeenclipped=true;
+
+	  if(lpos>0 && lpos>=r.getLenSeq()) lpos=r.getLenSeq()-1; 
+	  CEBUG("pcb l: " << r.getName() << " " << r.getLeftClipoff()
+		<< " " << lpos << endl);
+	  logfout << logprefix << " left "
+		  << r.getName() << '\t' 
+		  << r.getLeftClipoff() << " -> ";
+	  r.setLQClipoff(lpos);
+	  cbleft++;
+	  logfout << r.getLeftClipoff() << '\n';
+	}
+      }
+
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
+#endif
+
+      {
+      	int32 rpos=r.getRightClipoff();
+	vector<Read::bposhashstat_t>::const_iterator bhsI=r.getBPosHashStats().begin();
+	advance(bhsI,rpos);
+      
+      	switch(r.getSequencingType()){
+      	case Read::SEQTYPE_SANGER :{
+      	  //Read::baseflags_t bf=Read::BFLAGS_CONFIRMED_MULTIPLEHASH;
+      	  for(; rpos >0; rpos--){
+	    bhsI--;
+	    if(bhsI->fwd.getFrequency() > 1
+	       || bhsI->rev.getFrequency() > 1) break;
 	  }
-	  // getClippedSeqAsChar may throw if the MIRA clipping set the left cutoff to the length of the sequence
-	  // too lazy to get things otherwise;
-	  if(actread.getLenClippedSeq()>0){
-	    auto sptr=actread.getClippedSeqAsChar();
-	    auto eptr=sptr+actread.getLenClippedSeq();
-	    for(; sptr!=eptr; ++sptr){
-	      if(toupper(*sptr)=='N') {
-		lookatread=false;
-		break;
-	      }
-	    }
+      	  break;
+      	}
+      	case Read::SEQTYPE_454GS20 :{
+      	  for(; rpos >0; rpos--){
+	    bhsI--;
+	    if(bhsI->fwd.hasConfirmedFwdRev()
+	       || bhsI->rev.hasConfirmedFwdRev()
+	       || bhsI->fwd.hasConfirmedMultipleSeqType()
+	       || bhsI->rev.hasConfirmedMultipleSeqType()
+// TODO: added 21.01.2010, check whether really better
+	       || bhsI->fwd.hasSeenAtLowPos()
+	       || bhsI->rev.hasSeenAtLowPos()) break;
 	  }
-	}else if(step==1){
-	  // further tests?
-	  lookatread=true;
-	}else{
-	  BUGIFTHROW(true,"Oooops, step " << step << " not foreseen?");
-	}
-	if(lookatread){
-	  auto taken=hsd.digiNormTestRead(actread,false);
-	  if(taken){
-	    ++numtaken;
-	    CEBUG("Kept " << actread.getName() << endl);
-	    auto & tv = const_cast<std::vector<multitag_t> &>(actread.getTags());
-	    bool hasolddgnr=false;
-	    for(auto & te : tv){
-	      if(te.identifier == Read::REA_tagentry_idDGNr
-		 && !te.getCommentStr().empty()){
-		hasolddgnr=true;
-		break;
-	      }
-	    }
-	    if(!hasolddgnr){
-	      normthisrg[rpi]=true;
-	      normdone[rpi]=true;
-	      for(auto & te : tv){
-		if(te.identifier == Read::REA_tagentry_idMNRr){
-		  bool founddouble=false;
-		  for(auto & tf : tv){
-		    if(tf.identifier == Read::REA_tagentry_idDGNr
-		      && tf.from==te.from
-		       && tf.to==te.to){
-		      founddouble=true;
-		      break;
-		    }
-		  }
-		  if(!founddouble) te.identifier = Read::REA_tagentry_idDGNr;
+      	  break;
+      	}
+      	case Read::SEQTYPE_IONTORRENT :{
+//	  // TODO: copied form 454, needs to be checked
+//      	  for(; rpos >0; rpos--){
+//	    bhsI--;
+//	    if(bhsI->fwd.hasConfirmedFwdRev()
+//	       || bhsI->rev.hasConfirmedFwdRev()
+//	       || bhsI->fwd.hasConfirmedMultipleSeqType()
+//	       || bhsI->rev.hasConfirmedMultipleSeqType()
+//	       || bhsI->fwd.hasSeenAtLowPos()
+//	       || bhsI->rev.hasSeenAtLowPos()) break;
+//	  }
+      	  for(; rpos >0; rpos--){
+	    bhsI--;
+	    if(bhsI->fwd.getFrequency() > 1
+	       || bhsI->rev.getFrequency() > 1) break;
+	  }
+      	  break;
+      	}
+      	case Read::SEQTYPE_PACBIO :{
+	  // no info. atm, same as sanger
+	  // TODO: check with real PacBio data
+      	  for(; rpos >0; rpos--){
+	    bhsI--;
+	    if(bhsI->fwd.getFrequency() > 1
+	       || bhsI->rev.getFrequency() > 1) break;
+	  }
+      	  break;
+      	}
+      	case Read::SEQTYPE_SOLEXA :{
+      	  for(; rpos >0; rpos--){
+	    bhsI--;
+	    if(bhsI->fwd.hasConfirmedFwdRev()
+	       || bhsI->rev.hasConfirmedFwdRev()
+	       || bhsI->fwd.hasConfirmedMultipleSeqType()
+	       || bhsI->rev.hasConfirmedMultipleSeqType()
+	       || bhsI->fwd.hasSeenAtLowPos()
+	       || bhsI->rev.hasSeenAtLowPos()) break;
+	  }
+      	  break;
+      	}
+      	default : {
+      	  MIRANOTIFY(Notify::INTERNAL, "Don't know how to handle sequencing type '" << r.getNameOfSequencingType(r.getSequencingType()) << "'.\n");
+      	}
+      	}
+      
+      
+      	if(rpos != r.getRightClipoff()){
+	  hasbeenclipped=true;
+
+      	  CEBUG("pcb r: " << r.getName() << " " << r.getRightClipoff()
+      		<< " " << rpos << endl);
+      	  logfout << logprefix << " right "
+      		  << r.getName() << '\t' 
+      		  << r.getRightClipoff() << " -> ";
+      	  r.setRQClipoff(rpos);
+      	  cbright++;
+      	  logfout << r.getRightClipoff() << '\n';
+
+	  // special handling of Solexa GGC.G error
+	  // from point of right clip, 15 bases backwards:
+	  //  search for first ggc.g and clip there
+	  if(r.getSequencingType()==Read::SEQTYPE_SOLEXA
+	     && AS_miraparams[0].getAssemblyParams().as_clip_pec_sxaggcxg
+	     && r.getLenClippedSeq() >=15){
+	    //Read::setCoutType(Read::AS_TEXTSHORT);
+	    //cout << r;
+	    string searchstr=r.getSeqAsChar();
+	    boost::to_lower(searchstr);
+	    int64 searchstart=r.getRightClipoff()-15;
+	    if(searchstart<0) searchstart=0;
+	    size_t found;
+	    do{
+	      found=searchstr.find(ggcproblem,searchstart);
+	      if (found!=string::npos){
+		searchstart=found+1;
+		if(found < r.getRightClipoff()
+		   && found+4<r.getRightClipoff() 
+		   && searchstr[found+4]=='g'){
+		  logfout << logprefix << "possible Solexa GGC.G problem "
+			  << r.getName() << '\t' << r.getRQClipoff() << " -> ";
+		  r.setRQClipoff(static_cast<int32>(found+4));
+		  logfout << r.getRQClipoff() << '\n';
+		  found=string::npos; // stop the loop
 		}
 	      }
-	    }
-	    actread.deleteTag(Read::REA_tagentry_idMNRr);
-	  }else{
-	    ++numnormout;
-	    CEBUG("NormOut " << actread.getName() << endl);
-	    normout[rpi]=true;
-	    actread.setRQClipoff(0);
-	    actread.setUsedInAssembly(false);
+	    }while(found!=string::npos);
 	  }
-	}
+      	}
       }
-    }
-    pi.finishAtOnce();
-
-    cout << "Calculating replacement coverage";
-    uint32 chkall=0;
-    for(uint32 rpi=0; rpi<rp.size(); ++rpi){
-      if(normthisrg[rpi]){
-	auto & actread=rp[rpi];
-	auto & tv = const_cast<std::vector<multitag_t> &>(actread.getTags());
-	for(auto & te : tv){
-	  if(te.identifier == Read::REA_tagentry_idDGNr){
-	    CEBUG(actread.getName() << "\tDGNr: " << te.to-te.from+1 << "\t" << actread.getLenClippedSeq() << endl);
-	    CEBUG(actread.getName() << "\tLIML: " << actread.getLeftClipoff() << '\t' << te.from << endl;);
-	    CEBUG(actread.getName() << "\tLIMR: " << actread.getRightClipoff() << '\t' << te.to << endl);
-	    //Read::setCoutType(Read::AS_TEXT);
-	    //CEBUG(actread);
-
-	    auto perccovered=static_cast<uint8>(100.0f/actread.getLenClippedSeq()*(te.to-te.from+1));
-	    if(perccovered>=80){
-	      ++chkall;
-	      CEBUG("Next read:\n");
-	      auto repcov=hsd.estimDigiNormCov(actread);
-	      CEBUG("repcov: " << repcov << endl);
-	      if(repcov>1){
-		auto newtag=te;
-		// WARNING: with this we'll probably break the for(auto & te ...) functionality
-		// we MUST get out of the loop afterwards with a "break"!
-		actread.deleteTag(Read::REA_tagentry_idDGNr);
-		string comnum(boost::lexical_cast<string>(repcov));
-		newtag.setCommentStr(comnum);
-		newtag.commentisgff3=false;
-		actread.addTagO(newtag);
-		CEBUG("DGN repcov " << actread.getName() << ": " << repcov << endl; Read::setCoutType(Read::AS_TEXT););
-		CEBUG(actread);
-		break;
-	      }
-	    }
-	  }
+
+      if(hasbeenclipped){
+	numbasesclipped+=oldlen-r.getLenClippedSeq();
+	if(oldlen 
+	   && (r.getLenClippedSeq() < AS_miraparams[r.getSequencingType()].getAssemblyParams().as_minimum_readlength )){
+	  killed++;
+	  logfout << logprefix << " "
+		  << r.getName() << " killed, remaining length ("
+		  << r.getLenClippedSeq() << ")\n";
 	}
       }
     }
-    CEBUG("Chkall: " << chkall << endl);
   }
 
-  cout << "\nDigital normalisation: removed " << numnormout << " reads.\n";
+  logfout.close();
 
-  if(debrisreasonptr != nullptr){
-    auto & db=*debrisreasonptr;
-    BUGIFTHROW(db.size()!=rp.size(),"db.size()!=rp.size() ???");
-    for(auto rpi=0; rpi<rp.size(); ++rpi){
-      if(db[rpi]==0 && normout[rpi]){
-	db[rpi]=Assembly::DEBRIS_DIGITAL_NORMALISATION;
-      }
-    }
+  cout << "done.\nPerformed clips:"
+       << "\n\tNum reads cliped left: " << cbleft
+       << "\n\tNum reads cliped right: " << cbright
+       << "\n\tNum reads completely killed: " << killed
+       << "\n\tTotal bases clipped         : " << numbasesclipped
+       << "\n\n";
+
+  // now, set the align parameters to enforce clean ends
+  for(uint32 st=0; st<Read::SEQTYPE_END; st++){
+    align_parameters & alpar=const_cast<align_parameters &>(AS_miraparams[st].getAlignParams());
+    alpar.ads_enforce_clean_ends=true;
+    alpar.ads_clean_end_distance=AS_miraparams[0].getSkimParams().sk_basesperhash;
   }
 
+
+  clipPolyBaseAtEnd(logname,logprefix);
+
+  FUNCEND();
+
+  return numbasesclipped;
 }
 //#define CEBUG(bla)
 
 
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-void DataProcessing::priv_EnsureAdapRegexes(ReadGroupLib::ReadGroupID rgid)
-{
-  if(DP_adapres.size()>rgid.getLibId()
-     && DP_adapres[rgid.getLibId()].areinit) return;
 
-  if(DP_adapres.size()<=rgid.getLibId()) DP_adapres.resize(rgid.getLibId()+1);
 
-  if(rgid.getSequencingType()==ReadGroupLib::SEQTYPE_SOLEXA){
-    static const char regexfile[] = {
-#include "adaptorsregex.solexa.xxd.H"
-      ,0
-    };
-    addAdapRegexes(rgid,regexfile);
-  }else if(rgid.getSequencingType()==ReadGroupLib::SEQTYPE_IONTORRENT){
-    static const char regexfile[] = {
-#include "adaptorsregex.iontor.xxd.H"
-      ,0
-    };
-    addAdapRegexes(rgid,regexfile);
-  }
-}
 
 /*************************************************************************
  *
- *
+ * expects reads to have baseflags set
  *
  *
  *************************************************************************/
 
 //#define CEBUG(bla)   {cout << bla; cout.flush();}
-void DataProcessing::addAdapRegexes(ReadGroupLib::ReadGroupID rgid, const char * regexfile)
+
+struct tmpbhentry_t{
+  uint32 from;
+  uint32 to;
+  uint8 freq;
+};
+
+void Assembly::buntifyReadsByHashFreq(uint8 basesperhash, ReadPool & rp)
 {
-  FUNCSTART("void priv_constructorAdapRes(uint8 seqtype, const char * regexfile)");
+  FUNCSTART("void Assembly::buntifyReadsByHashFreq()");
 
-  BUGIFTHROW(rgid.getLibId()>=ReadGroupLib::getNumReadGroups(),"Oooops, readgroupid " << static_cast<uint16>(rgid.getLibId()) << " is unknown?");
+  cout << "Buntifying reads";
+  if(rp.size()>500000) cout << " (this may take a while)";
+  cout << " ... "; cout.flush();
 
-  if(DP_adapres.size()<=rgid.getLibId()) DP_adapres.resize(rgid.getLibId()+1);
+  vector<multitag_t::mte_id_t> freqnames;
+  freqnames.push_back(Read::REA_tagentry_idHAF0);
+  freqnames.push_back(Read::REA_tagentry_idHAF1);
+  freqnames.push_back(Read::REA_tagentry_idHAF2);
+  freqnames.push_back(Read::REA_tagentry_idHAF3);
+  freqnames.push_back(Read::REA_tagentry_idHAF4);
+  freqnames.push_back(Read::REA_tagentry_idHAF5);
+  freqnames.push_back(Read::REA_tagentry_idHAF6);
+  freqnames.push_back(Read::REA_tagentry_idHAF7);
+
+  vector<uint8> tmpfreq;
+  tmpfreq.reserve(10000);
+  for(uint32 actid=0; actid<rp.size(); actid++){
+    Read & actread=rp.getRead(actid);
+    
+    //Read::setCoutType(Read::AS_TEXT);
+    //cout << actread;
 
-  CEBUG("prepping regexp for " << rgid.getLibId() << endl);
+    if(actread.hasValidData()
+       && actread.hasBaseHashStats()){
 
-  masterslavere_t tmpmsre;
-  istringstream tmpis(regexfile);
-  string line;
-  while(true){
-    getline(tmpis,line);
-    if(tmpis.eof()) break;
-    if(line[0]=='>'){
-      DP_adapres[rgid.getLibId()].adapres.push_back(tmpmsre);
-      line.erase(0,1);         // get away the ">"
-      boost::trim(line);
-      if(!line.empty()){
-	boost::to_upper(line);
-	DP_adapres[rgid.getLibId()].adapres.back().masterre=boost::regex(line);
-	DP_adapres[rgid.getLibId()].adapres.back().hasmaster=true;
+      // remove old hash frequence tags
+      for(uint32 i=0; i<freqnames.size(); i++){
+	actread.deleteTag(freqnames[i]);
       }
-    }else{
-      BUGIFTHROW(DP_adapres[rgid.getLibId()].adapres.empty(),"Oooops, no master expression found?");
-      boost::to_upper(line);
-      DP_adapres[rgid.getLibId()].adapres.back().slaveres.push_back(boost::regex(line));
-    }
-  }
-  DP_adapres[rgid.getLibId()].areinit=true;
-}
-//#define CEBUG(bla)
-
 
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
+      tmpfreq.clear();
+      tmpfreq.resize(actread.getLenSeq(),0);
 
-void DataProcessing::priv_EnsureAdapSkims(ReadGroupLib::ReadGroupID rgid)
-{
-  if(DP_adapskims.size()>rgid.getLibId()
-     && DP_adapskims[rgid.getLibId()].skimptr) return;
+      vector<Read::bposhashstat_t>::const_iterator bhsI=actread.getBPosHashStats().begin();
+      vector<Read::bposhashstat_t>::const_iterator bhsE=actread.getBPosHashStats().end();
+      vector<uint8>::iterator tfI=tmpfreq.begin();
+      vector<uint8>::iterator tfE=tmpfreq.end();
 
-  if(rgid.getSequencingType()==ReadGroupLib::SEQTYPE_SOLEXA){
-    static const char adapfile[] = {
-#include "adaptorsforclip.solexa.xxd.H"
-      ,0
-    };
-    priv_constructorSkimPool(rgid,DP_adapskims,7,adapfile);
-  }else if(rgid.getSequencingType()==ReadGroupLib::SEQTYPE_IONTORRENT){
-    static const char adapfile[] = {
-#include "adaptorsforclip.iontor.xxd.H"
-      ,0
-    };
-    priv_constructorSkimPool(rgid,DP_adapskims,7,adapfile);
-  }else if(rgid.getSequencingType()==ReadGroupLib::SEQTYPE_454GS20){
-    static const char adapfile[] = {
-#include "adaptorsforclip.454.xxd.H"
-      ,0
-    };
-    priv_constructorSkimPool(rgid,DP_adapskims,7,adapfile);
-  }
-}
+      buntifyHelper(2, basesperhash, bhsI, bhsE, tfI, tfE);
+      buntifyHelper(3, basesperhash, bhsI, bhsE, tfI, tfE);
+      buntifyHelper(4, basesperhash, bhsI, bhsE, tfI, tfE);
+      buntifyHelper(5, basesperhash, bhsI, bhsE, tfI, tfE);
+      buntifyHelper(6, basesperhash, bhsI, bhsE, tfI, tfE);
+      buntifyHelper(7, basesperhash, bhsI, bhsE, tfI, tfE);
 
+      vector<tmpbhentry_t> telist;
+      telist.reserve(20);
 
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
+      //{
+      //	cout << "bfr: " << actread.getName() << endl;
+      //	for(uint32 i=0;i<tmpfreq.size(); i++){
+      //	  cout << "i: " << i << '\t' << static_cast<uint16>(tmpfreq[i]) << endl;
+      //	}
+      //}
 
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-void DataProcessing::priv_constructorSkimPool(ReadGroupLib::ReadGroupID rgid, std::vector<poolskim_t> & skimpool, const uint32 basesperhash, const char * adapfile)
-{
-  FUNCSTART("void DataProcessing::priv_constructorAdapPool(uint8 seqtype, const char * adapfile)");
-  BUGIFTHROW(rgid.getLibId()>=ReadGroupLib::getNumReadGroups(),"Oooops, readgroupid " << static_cast<uint16>(rgid.getLibId()) << " is unknown, have " << ReadGroupLib::getNumReadGroups() << " read groups ?");
-
-  boost::mutex::scoped_lock lock(DP_ps_changemutex);
-  if(skimpool.size()<=rgid.getLibId()) skimpool.resize(rgid.getLibId()+1);
-
-  if(skimpool[rgid.getLibId()].poolptr==nullptr){
-    CEBUG("prepping adappool " << rgid.getLibId() << endl);
-    skimpool[rgid.getLibId()].poolptr= new ReadPool;
-
-    istringstream tmpis(adapfile);
-    string nline,sline;
-    bool addedsomething=false;
-    while(true){
-      getline(tmpis,nline);
-      if(tmpis.eof()) break;
-      boost::trim(nline);
-      nline.erase(0,1);         // get away the ">"
-      if(!nline.empty()){
-	getline(tmpis,sline);
-	boost::trim(sline);
-	boost::to_upper(sline);
-	size_t ereadidx=0;
-	for( ; ereadidx < skimpool[rgid.getLibId()].poolptr->size(); ++ereadidx){
-	  //CEBUG("COMP: " << skimpool[rgid.getLibId()].poolptr->getRead(ereadidx).getName()<< "\t" << skimpool[rgid.getLibId()].poolptr->getRead(ereadidx).getSeqAsChar() << "\t" << sline << endl);
-	  if(skimpool[rgid.getLibId()].poolptr->getRead(ereadidx).getLenSeq() == sline.size()
-	     && strncmp(skimpool[rgid.getLibId()].poolptr->getRead(ereadidx).getSeqAsChar(),sline.c_str(),sline.size())==0) {
-	    //CEBUG("BINGO!\n");
-	    break;
-	  }
+      uint32 from=0;
+      uint32 to=0;
+      for(; from<actread.getLenSeq(); from=to+1){
+	to=from;
+	uint8 actfreq=tmpfreq[to];
+	for(; to<actread.getLenSeq() && tmpfreq[to]==actfreq; to++) {} ;
+	to--;
+	if(actfreq>0){
+	  telist.resize(telist.size()+1);
+	  telist.back().from=from;
+	  telist.back().to=to;
+	  telist.back().freq=actfreq;
 	}
-	if(ereadidx==skimpool[rgid.getLibId()].poolptr->size()){
-	  CEBUG("New for " << nline<<endl);
-	  ereadidx=skimpool[rgid.getLibId()].poolptr->provideEmptyRead();
-	  Read & actread=skimpool[rgid.getLibId()].poolptr->getRead(ereadidx);
-	  actread.disallowAdjustments();
-	  actread.setName(nline);
-	  if(tmpis.eof()) break;
-	  actread.setSequenceFromString(sline);
-	  addedsomething=true;
-	  actread.setUsedInAssembly(false);
-	}else{
-	  Read & actread=skimpool[rgid.getLibId()].poolptr->getRead(ereadidx);
-
-	  CEBUG("Extend for " << actread.getName() << ": " << nline<<endl);
+      }
 
-	  actread.setName(actread.getName()+"_/_"+nline);
-	  //actread.setUsedInAssembly(true);
-	}
+      // for first or last entry, do not put tags for frequencies
+      //  >=2 if their length is < basesperhash
+      // BaCh 03.06.2011: hmmm, why not. OK, makes CAF/MAF bigger, but else?
+      for(uint32 ti=0; ti<telist.size(); ti++){
+	bool settag=true;
+//	if(telist[ti].freq>=2 &&
+//	   (ti==0 || ti==telist.size()-1)){
+//	  if(telist[ti].to - telist[ti].from < basesperhash-1){
+//	    settag=false;
+//	  }
+//	}
+	if(settag) actread.addTag(telist[ti].from,
+				  telist[ti].to,
+				  freqnames[telist[ti].freq], "");
       }
     }
 
-    //for(auto idx=0; idx < skimpool[rgid.getLibId()].poolptr->size(); ++idx){
-    //  Read & actread=skimpool[rgid.getLibId()].poolptr->getRead(idx);
-    //  if(actread.isUsedInAssembly()){
-    //	cout << actread.getName() << endl;
-    //  }
+    //if(actid==273250 || actid==273252){
+    //  Read::setCoutType(Read::AS_TEXT);
+    //  cout << actread;
     //}
-    //exit(0);
-
-    if(addedsomething){
-      CEBUG("prepping skim " << rgid.getLibId() << endl);
-      if(skimpool[rgid.getLibId()].skimptr!=nullptr) delete skimpool[rgid.getLibId()].skimptr;
-
-      // IMPORTANT: keep assignment of skimpool[rgid.getLibId()].skimptr
-      //  as last thing to be done in this branch, i.e., when the Skim is
-      //  completely initialised
-      // Reason: the checks in priv_ensureAdapSkims() do not use any mutexes, just
-      //  the vector size AND the skimptr being nullptr. It could be that
-      //  the constructing thread therefore did not finish constructing
-      //  the Skim but that another thread would jump forward using it because
-      //  everything points to that it's ready
-      auto skimptr = new Skim<vhash64_t>();
-      skimptr->skimStreamPrepare(*skimpool[rgid.getLibId()].poolptr,basesperhash,1);
-      skimptr->prepareForMultithreadFarc((*DP_miraparams_ptr)[0].getSkimParams().sk_numthreads);
-      skimpool[rgid.getLibId()].skimptr = skimptr;
-
-      CEBUG("Done\n");
-    }
+
   }
+
+  cout << "done." << endl;
+
+  FUNCEND();
+
 }
 //#define CEBUG(bla)
 
 
+void Assembly::buntifyHelper(uint8 allowedfreq, uint8 basesperhash, vector<Read::bposhashstat_t>::const_iterator bhsI, vector<Read::bposhashstat_t>::const_iterator bhsE, vector<uint8>::iterator tfI, vector<uint8>::iterator tfE)
+{
+  for(; bhsI!= bhsE; bhsI++, tfI++){
+    uint8 actfreq=bhsI->fwd.getFrequency();
+    if(allowedfreq==actfreq){
+      if(actfreq>0){
+	vector<uint8>::iterator ttfI=tfI;
+	for(uint32 i=0; i<basesperhash && ttfI!=tfE; i++, ttfI++){
+	  *ttfI=actfreq;
+	}
+      }
+    }
+  }
+}
+
 
 /*************************************************************************
  *
- *
- *
+ * 
  *
  *************************************************************************/
 
-void DataProcessing::priv_EnsurePhiX174Statistics()
+void Assembly::cutBackPossibleChimeras(const string & logname, const string & logprefix, const vector<int32> & chuntleftcut, const vector<int32> & chuntrightcut, vector<bool> & chimeracutflag)
 {
-  if(DP_px174hs_init) return;
-
-  static const char adapfile[] = {
-#include "seqforfilter_phix174.solexa.xxd.H"
-    ,0
-  };
-
-
-  boost::mutex::scoped_lock lock(DP_px174hs_changemutex);
-  if(DP_px174hs_init) return;
-
-  ReadPool baitrp;
-
-  istringstream tmpis(adapfile);
-  string line;
-  bool addedsomething=false;
-  while(true){
-    getline(tmpis,line);
-    if(tmpis.eof()) break;
-    line.erase(0,1);         // get away the ">"
-    if(!line.empty()){
-      size_t ereadidx=baitrp.provideEmptyRead();
-      Read & actread=baitrp[ereadidx];
-      actread.disallowAdjustments();
-      actread.setName(line);
-      getline(tmpis,line);
-      //CEBUG("For " << actread.getName() << ": " << line<<endl);
-      if(tmpis.eof()) break;
-      actread.setSequenceFromString(line);
-      addedsomething=true;
+  FUNCSTART("void Assembly::cutBackPossibleChimeras(const string & logname, const string & logprefix, const vector<int32> & chuntleftcut, const vector<int32> & chuntrightcut)");
+
+  BUGIFTHROW(chuntleftcut.size()!=chuntrightcut.size() && chuntleftcut.size() != AS_readpool.size(),"Arrays mismatch? chuntleftcut.size()!=chuntrightcut.size && chuntleftcut.size() != AS_readpool.size()");
+
+  ofstream logfout;
+  if(!logname.empty()){
+    logfout.open(logname.c_str(), ios::out|ios::app);
+    if(!logfout){
+      MIRANOTIFY(Notify::FATAL, "Could not open log for appending: " << logname);
     }
   }
 
-  if(addedsomething){
-    string dummyfn((*DP_miraparams_ptr)[0].getDirectoryParams().dir_tmp+"/phix174.mhs.gz");
-    DP_phix174hashstatistics.prepareHashStatistics(baitrp,false,false,true,1,0,31,1,dummyfn,(*DP_miraparams_ptr)[0].getDirectoryParams().dir_tmp);
-    boost::mutex tmpm;
-    boost::mutex::scoped_lock lock(tmpm);
-    DP_px174hs_init=true;
-    CEBUG("Done\n");
+  cout << "Cutting back possible chimeras ... "; cout.flush();
+
+  if(!chimeracutflag.empty()){
+    chimeracutflag.clear();
+    chimeracutflag.resize(chuntleftcut.size(),false);
   }
 
-}
+  assembly_parameters const & as_fixparams= AS_miraparams[0].getAssemblyParams();
 
+  for(uint32 actreadid=0;actreadid<chuntleftcut.size();actreadid++){
+    Read & actread=AS_readpool.getRead(actreadid);
+    if(actread.hasValidData()
+       && !(actread.isBackbone() 
+	    || actread.isRail())){
+      bool didcut=false;
+      if(as_fixparams.as_clip_skimchimeradetection
+	 && (chuntleftcut[actreadid]>0
+	     || chuntrightcut[actreadid]>0)){
+	logfout << logprefix << " possible chimera: " << actread.getName()
+		<< "\t["
+		<< actread.getLeftClipoff()
+		<< ","
+		<< actread.getRightClipoff()
+		<< "[ using cfrag " << chuntleftcut[actreadid] << ":" << chuntrightcut[actreadid]
+		<< " cut back to ";
+	
+	actread.setLSClipoff(actread.getLeftClipoff()+chuntleftcut[actreadid]);
+	actread.setRSClipoff(actread.getLeftClipoff()+(chuntrightcut[actreadid]-chuntleftcut[actreadid])+1);
+	didcut=true;
+	if(!chimeracutflag.empty()){
+	  chimeracutflag[actreadid]=true;
+	}
 
+	logfout << '[' 
+		<< actread.getLeftClipoff()
+		<< ","
+		<< actread.getRightClipoff()
+		<< "[\n";
+      }
+
+      if(!didcut
+	 && (chuntleftcut[actreadid]<0
+	     || chuntrightcut[actreadid]<0)){
+	if(as_fixparams.as_clip_skimjunkdetection){
+	  logfout << logprefix << " removed possible junk: " ;
+	}else{
+	  logfout << logprefix << " untouched possible junk: " ;
+	}
+	logfout << actread.getName()
+		<< "\t["
+		<< -chuntleftcut[actreadid]
+		<< ","
+		<< -chuntrightcut[actreadid]
+		<< '\n';
+	if(as_fixparams.as_clip_skimjunkdetection){
+	  actread.setLSClipoff(actread.getLeftClipoff()-chuntleftcut[actreadid]);
+	  actread.setRSClipoff(actread.getRightClipoff()+chuntrightcut[actreadid]);
+	  if(!chimeracutflag.empty()){
+	    chimeracutflag[actreadid]=true;
+	  }
+	}
+      }
+    }
+  }
+
+  cout << "done.\n";
+}
 
 
 
 /*************************************************************************
  *
- *
- *
+ * 
  *
  *************************************************************************/
 
-void DataProcessing::startLogging(const string & filename, bool newfile)
+void Assembly::clipBadSolexaEnds(const string & logname, const string & logprefix)
 {
-  FUNCSTART("void DataProcessing::startLogging(const std::string & filename, bool newfile)");
-  stopLogging();
-  if(!filename.empty()){
-    DP_logname=filename;
-    if(newfile){
-      DP_logfout.open(filename, ios::out|ios::trunc);
-    }else{
-      DP_logfout.open(filename, ios::out|ios::app);
-    }
-    if(!DP_logfout){
-      MIRANOTIFY(Notify::FATAL, "Could not open " << filename << " for logging.");
+  FUNCSTART("void Assembly::clipBadSolexaEnds(const string & logname, const string & logprefix)");
+
+  ofstream logfout;
+  if(!logname.empty()){
+    logfout.open(logname.c_str(), ios::out|ios::app);
+    if(!logfout){
+      MIRANOTIFY(Notify::FATAL, "Could not open log for appending: " << logname);
     }
   }
-}
+  
+  // invalidate all Solexa reads that have a stretch of 20 A
+  //  or if has stretch >= 12 and non-A bases < 20%
+  // N in-between do not reset the counter
+  // invalidate by setting left seq vec to length of read
+  for(uint32 i=0;i<AS_readpool.size();i++){
+    Read & actread=AS_readpool.getRead(i);
+    if(actread.hasValidData()
+       && actread.isSequencingType(Read::SEQTYPE_SOLEXA)
+       && !(actread.isBackbone() 
+	    || actread.isRail())){
 
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
+      int32 runindex=actread.getLeftClipoff();
+      char actbase=' ';
+      uint32 bcount=0;
+
+      uint32 arun=0;
+      uint32 maxarun=0;
+      uint32 nona=0;
+
+      uint32 trun=0;
+      uint32 maxtrun=0;
+      uint32 nont=0;
+
+      for(; runindex<actread.getRightClipoff(); runindex++) {
+	actbase=static_cast<char>(toupper(actread.getBaseInSequence(runindex)));
+	if(actbase!='N'){
+	  bcount++;
+	  if(actbase=='A'){
+	    arun++;
+	    if(arun>maxarun) maxarun=arun;
+	    nont++;
+	    trun=0;
+	  }else if(actbase=='T'){
+	    trun++;
+	    if(trun>maxtrun) maxtrun=trun;
+	    nona++;
+	    arun=0;
+	  }else{
+	    nona++;
+	    nont++;
+	    arun=0;
+	    trun=0;
+	  }
+	}
+      }
+      if(maxarun>=20){
+	actread.setLSClipoff(actread.getLenSeq());
+	logfout << logprefix << " bad solexa end: A hard " 
+		<< actread.getName()
+		<< '\n';
+      }else if(maxarun>=12){
+	uint32 ratio= static_cast<uint32>((static_cast<double>(100.0)/bcount)*nona);
+	if(ratio<20) {
+	  actread.setLSClipoff(actread.getLenSeq());
+	  logfout << logprefix << " bad solexa end: A soft " 
+		  << actread.getName() 
+		  << '\n';
+	}
+      }
 
-void DataProcessing::stopLogging()
-{
-  if(DP_logfout.is_open()){
-    DP_logfout.close();
+      if(maxtrun>=20){
+	actread.setLSClipoff(actread.getLenSeq());
+	logfout << logprefix << " bad solexa end: T (hard) " 
+		<< actread.getName() 
+		<< '\n';
+      }else if(maxtrun>=12){
+	uint32 ratio= static_cast<uint32>((static_cast<double>(100.0)/bcount)*nont);
+	if(ratio<20) {
+	  actread.setLSClipoff(actread.getLenSeq());
+	  logfout << logprefix << " bad solexa end: T (soft) " 
+		  << actread.getName() 
+		  << '\n';
+	}
+      }
+    }
   }
+
+  FUNCEND();
 }
 
+
 /*************************************************************************
  *
- *
- *
+ * clip all lowercase at the end of reads 
  *
  *************************************************************************/
 
-void DataProcessing::performRareKMERMasking_Pool(ReadPool & rpool, uint32 basesperhash, const string & logprefix)
+void Assembly::performLowerCaseClipping(const string & logname, const string & logprefix)
 {
-  auto & miraparams = *DP_miraparams_ptr;
+  FUNCSTART("void Assembly::performLowerCaseClipping(const string & logname, const string & logprefix)");
 
-  bool needtomask=false;
-  for(auto & mp : miraparams){
-    if(mp.getAssemblyParams().as_clipmask_rarekmers){
-      needtomask=true;
+  ofstream logfout;
+  if(!logname.empty()){
+    logfout.open(logname.c_str(), ios::out|ios::app);
+    if(!logfout){
+      MIRANOTIFY(Notify::FATAL, "Could not open log for appending: " << logname);
     }
   }
 
-  if(!needtomask) return;
+  uint64 totallen=0;
+  uint64 lowercaselen=0;
+  for(uint32 i=0;i<AS_readpool.size();i++){
+    Read & actread=AS_readpool.getRead(i);
+    if(actread.hasValidData()
+       && AS_miraparams[actread.getSequencingType()].getAssemblyParams().as_clip_lowercase
+       && !(actread.isBackbone() 
+	    || actread.isRail())){
+      totallen+=actread.getLenClippedSeq();
+      int32 runindex=actread.getLeftClipoff();
+      for(; runindex<actread.getRightClipoff(); ++runindex){
+	if(islower(actread.getBaseInSequence(runindex))) lowercaselen++;
+      }
+    }
+  }
 
-  cout << "Rare kmer masking ... ";cout.flush();
-  for(uint32 rpi=0; rpi<rpool.size(); ++rpi){
-    Read & actread= rpool[rpi];
-    if(!actread.hasValidData()
-       || !actread.isUsedInAssembly()
-       || actread.isBackbone()
-       || actread.isRail()
-       || !miraparams[actread.getSequencingType()].getAssemblyParams().as_clipmask_rarekmers ) continue;
-    performRareKMERMasking_Read(actread,basesperhash, logprefix);
+  if(totallen==lowercaselen) {
+    cout << "Lowercase clip: all sequences to be clipped are lowercase?! Failsafe: no clipping performed.\n";
+    return;
+  }
+
+  for(uint32 i=0;i<AS_readpool.size();i++){
+    Read & actread=AS_readpool.getRead(i);
+    if(actread.hasValidData()
+       && AS_miraparams[actread.getSequencingType()].getAssemblyParams().as_clip_lowercase
+       && !(actread.isBackbone() 
+	    || actread.isRail())){
+
+      //Read::setCoutType(Read::AS_CLIPPEDFASTA);
+      //cout << actread;
 
+      int32 runindex=actread.getLeftClipoff();
+      for(; runindex<actread.getRightClipoff(); ++runindex){
+	char ab=actread.getBaseInSequence(runindex);
+	if(!islower(ab)
+	   && ab != 'N'
+	   && ab != 'X') break;
+      }
+      if(runindex!=actread.getLeftClipoff()) {
+	actread.setLSClipoff(runindex);
+	logfout << logprefix << " changed left (lowercase) " 
+		<< actread.getName() << " to " << actread.getLeftClipoff() << '\n';
+      }
+
+      runindex=actread.getRightClipoff()-1;
+      for(; runindex>=actread.getLeftClipoff() && islower(actread.getBaseInSequence(runindex)); --runindex) ;
+      if(runindex!=actread.getRightClipoff()-1) {
+	actread.setRSClipoff(runindex+1);
+	logfout << logprefix << " changed right (lowercase) " 
+		<< actread.getName() <<  " to " << actread.getRightClipoff() << '\n';
+      }
+      //cout << actread;
+    }
   }
 
-  cout << "done\n";
+  logfout.close();
+
+  FUNCEND();
 }
 
 
@@ -979,353 +1297,349 @@ void DataProcessing::performRareKMERMasking_Pool(ReadPool & rpool, uint32 basesp
  *
  *************************************************************************/
 
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-void DataProcessing::performRareKMERMasking_Read(Read & actread, uint32 basesperhash, const string & logprefix)
+void Assembly::performQualAndMaskClips(const string & logname, const string & logprefix)
 {
-  FUNCSTART("void DataProcessing::performRareKMERMasking_Read(Read & actread, uint32 basesperhash, const string & logprefix)");
-
-  if(actread.getLenSeq()==0) return;
+  // The next line is here to fool the compiler to also
+  // include the CVS string into the binary
+  // line has no effect and will put optimised away anyway
+  (void) vcid2;
 
-  if(!actread.hasBaseHashStats()){
-    Read::setCoutType(Read::AS_TEXT);
-    cout << actread << endl;
-    MIRANOTIFY(Notify::FATAL,"!actread.hasBaseHashStats() ??? ");
-  }
-
-  DP_tmpvu8.clear();
+  FUNCSTART("void Assembly::performClips(const string & logname, const string & logprefix)");
 
-  Read::setCoutType(Read::AS_TEXT);
-  CEBUG("rare kmer, bph " << static_cast<uint16>(basesperhash) << " looking at:" << actread << endl);
-  bool mustmask=false;
-
-  if(actread.getLenClippedSeq()<basesperhash){
-    CEBUG("complete kill " << actread.getName() << endl);
-    actread.setRQClipoff(actread.getLQClipoff());
-  }else{
-    DP_tmpvu8.resize(actread.getLenSeq(),0);
+  cout << "Starting clips: ";
 
-    vector<Read::bposhashstat_t>::const_iterator bhsI=actread.getBPosHashStats().begin()+actread.getLeftClipoff();
-    vector<Read::bposhashstat_t>::const_iterator bhsE=actread.getBPosHashStats().end();
+  ofstream logfout;
+  if(!logname.empty()){
+    logfout.open(logname.c_str(), ios::out|ios::app);
+    if(!logfout){
+      MIRANOTIFY(Notify::FATAL, "Could not open log for appending: " << logname);
+    }
+  }
 
-    vector<uint8>::iterator tfI=DP_tmpvu8.begin()+actread.getLeftClipoff();
-    vector<uint8>::iterator tfE=DP_tmpvu8.end();
+  //if(qualclip) {
+  //  cout << "quality";
+  //  cout.flush();
+  //}
+  //if(qualclip && maskcharclip) cout << " and";
+  //if(maskcharclip) {
+  //  cout << " masked characters";
+  //  cout.flush();
+  //}
 
-    for(uint32 readpos=actread.getLeftClipoff(); readpos<actread.getRightClipoff()-(basesperhash-1); ++bhsI, ++tfI, ++readpos){
-      if(bhsI->fwd.getFrequency()==1
-	 || !bhsI->fwd.hasConfirmedFwdRev()){
-	vector<uint8>::iterator ttfI=tfI;
-	uint32 tmpreadpos=readpos;
-	CEBUG("new mask: " << tmpreadpos << "..");
-	for(uint32 i=0; i<basesperhash && ttfI!=tfE; i++, ttfI++, ++tmpreadpos){
-	  if(tmpreadpos>=actread.getLeftClipoff() && tmpreadpos<actread.getRightClipoff()){
-	    mustmask=true;
-	    *ttfI=1;
-	  }
-	}
-	CEBUG(tmpreadpos-1 << endl);
-      }
-    }
+  for(uint32 i=0;i<AS_readpool.size();i++){
+    Read & r=AS_readpool.getRead(i);
+    if(r.hasValidData()
+       && !(r.isBackbone() 
+	    || r.isRail())){
 
-    if(mustmask){
-      // Gnaw away what was masked too much
-      // also turns
-      // .............xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...........
-      // into
-      // .............xxxxx.............................................xxxxx...........
-      if(1){
-	vector<Read::bposhashstat_t>::const_iterator bhsI=actread.getBPosHashStats().begin()+actread.getLeftClipoff();
-	vector<Read::bposhashstat_t>::const_iterator bhsE=actread.getBPosHashStats().end();
-
-	vector<uint8>::iterator tfI=DP_tmpvu8.begin()+actread.getLeftClipoff();
-	vector<uint8>::iterator tfE=DP_tmpvu8.end();
-
-	for(uint32 readpos=actread.getLeftClipoff(); readpos<actread.getRightClipoff()-(basesperhash-1); ++bhsI, ++tfI, ++readpos){
-	  if(!(bhsI->fwd.getFrequency()==1
-	       || !bhsI->fwd.hasConfirmedFwdRev())){
-	    vector<uint8>::iterator ttfI=tfI+1;
-	    uint32 tmpreadpos=readpos+1;
-	    for(uint32 i=0; i<basesperhash-2 && ttfI!=tfE; i++, ttfI++, ++tmpreadpos){
-	      if(tmpreadpos>=actread.getLeftClipoff() && tmpreadpos<actread.getRightClipoff()){
-		CEBUG("cleaner " << tmpreadpos << endl);
-		*ttfI=0;
-	      }
-	    }
+      if(AS_miraparams[r.getSequencingType()].getAssemblyParams().as_clip_quality){
+	int32 oldlq=r.getLQClipoff();
+	int32 oldrq=r.getRQClipoff();
+	r.performQualityClip(
+	  AS_miraparams[r.getSequencingType()].getAssemblyParams().as_clip_quality_minqual,
+	  AS_miraparams[r.getSequencingType()].getAssemblyParams().as_clip_quality_winlen);
+	if(!logname.empty()){
+	  logfout << logprefix;
+	  if(oldlq != r.getLQClipoff()
+	     || oldrq != r.getRQClipoff()){
+	    logfout << " changed";
+	  }else{
+	    logfout << " unchanged";
 	  }
+	  logfout << " qual. " 
+		  << r.getName() 
+		  << "\tLeft: "
+		  << r.getLQClipoff()
+		  << "\tRight: "
+		  << r.getRQClipoff() << '\n';
 	}
       }
-
-      // and log changes
-      bool mustoutputprefix=true;
-      for(uint32 readpos=0; readpos<DP_tmpvu8.size(); ++readpos){
-	if(DP_tmpvu8[readpos]){
-	  auto start=readpos;
-	  while(readpos<DP_tmpvu8.size() && DP_tmpvu8[readpos]) ++readpos;
-	  if(readpos>start) --readpos;
-	  if(mustoutputprefix){
-	    DP_logfout << logprefix
-		       << " rare kmer "
-		       << actread.getName();
-	    mustoutputprefix=false;
+      if(AS_miraparams[r.getSequencingType()].getAssemblyParams().as_clip_maskedbases) {
+	int32 oldlm=r.getLMClipoff();
+	int32 oldrm=r.getRMClipoff();
+	r.setClipoffsToMaskedChars(
+	  AS_miraparams[r.getSequencingType()].getAssemblyParams().as_clip_maskedbase_gapsize,
+	  AS_miraparams[r.getSequencingType()].getAssemblyParams().as_clip_maskedbase_maxfrontgap,
+	  AS_miraparams[r.getSequencingType()].getAssemblyParams().as_clip_maskedbase_maxendgap,
+	  false);
+	r.setClipoffsToMaskedChars(
+	  1,
+	  1,
+	  1,
+	  true);
+	if(!logname.empty()){
+	  logfout << logprefix;
+	  if(oldlm != r.getLMClipoff()
+	     || oldrm != r.getRMClipoff()){
+	    logfout << " changed";
+	  }else{
+	    logfout << " unchanged";
 	  }
-	  DP_logfout << "\t["
-		     << start
-		     << ".."
-		     << readpos
-		     << ']';
+	  logfout << " mask. " 
+		  << r.getName() 
+		  << "\tLeft: "
+		  << r.getLMClipoff()
+		  << "\tRight: "
+		  << r.getRMClipoff() << '\n';
 	}
       }
-      if(!mustoutputprefix) DP_logfout << '\n';
-
-      // masking with 'x'
-
-      for(uint32 readpos=0; readpos<DP_tmpvu8.size(); ++readpos){
-	if(DP_tmpvu8[readpos]) actread.changeBaseInSequence('x',0,readpos);
-      }
-
-      auto gaplen=basesperhash;
-      maskClips_Read(actread, logprefix,gaplen,gaplen,gaplen);
-
-      // TODO: first mask with X so that maskClips_Read() can do it's work, then use 'n' is not
-      //   really elegant. Alternative would be yet another parameter to maskClips_Read()
-      for(uint32 readpos=0; readpos<DP_tmpvu8.size(); ++readpos){
-	if(DP_tmpvu8[readpos]) actread.changeBaseInSequence('n',0,readpos);
-      }
-
-      Read::setCoutType(Read::AS_TEXT);
-      CEBUG("rare kmer result:" << actread << endl);
-    }else{
-      CEBUG("nomask " << actread.getName() << endl);
     }
   }
-}
-//#define CEBUG(bla)
-
-
 
+  if(!logname.empty()){
+    logfout.close();
+  }
 
+  cout << " done." << endl;
 
+  FUNCEND();
+  return;
+}
 
 /*************************************************************************
  *
- * expects reads to have baseflags set
+ *
  *
  *
  *************************************************************************/
 
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-
-struct tmpbhentry_t{
-  uint32 from;
-  uint32 to;
-  uint8 freq;
-};
-
-void DataProcessing::buntifyReadsByHashFreq_Pool(ReadPool & rp, uint32 basesperhash)
+void Assembly::performPool_MinimumQualityThreshold(const string & logname, const string & logprefix)
 {
-  FUNCSTART("void DataProcessing::buntifyReadsByHashFreq()");
+  FUNCSTART("void Assembly::performMinimumLeftClips(bool onsltag, bool onmaskchar)");
 
-  cout << "Buntifying reads";
-  if(rp.size()>500000) cout << " (this may take a while)";
-  cout << " ... "; cout.flush();
+  cout << "Starting minimum quality threshold clip ... "; cout.flush();
 
-  for(uint32 actid=0; actid<rp.size(); actid++){
-    Read & actread=rp[actid];
+  uint32 numkilled=0;
 
-    buntifyReadsByHashFreq_Read(rp[actid],basesperhash);
+  ofstream logfout;
+  if(!logname.empty()){
+    logfout.open(logname.c_str(), ios::out|ios::app);
+    if(!logfout){
+      MIRANOTIFY(Notify::FATAL, "Could not open log for appending: " << logname);
+    }
   }
 
-  cout << "done." << endl;
+  for(uint32 actid=0; actid < AS_readpool.size(); actid++){
+    Read & actread = AS_readpool.getRead(actid);
+    if(actread.hasValidData()
+       && !(actread.isBackbone() || actread.isRail())){
+      
+      assembly_parameters const & as_params= AS_miraparams[actread.getSequencingType()].getAssemblyParams();
+      if(as_params.as_clip_quality_minthreshold==0) continue;
+      
+      if(!performRead_MinimumQualityThreshold(actread,as_params.as_clip_quality_minthreshold,as_params.as_clip_quality_numminthreshold)){
+	++numkilled;
+	actread.setLQClipoff(actread.getLenSeq());
+	actread.setRQClipoff(actread.getLenSeq());
+	logfout << logprefix << " min qual threshold not met, killed\n";
+      }
+    }
+  }
+    
+  if(!logname.empty()){
+    logfout.close();
+  }
+  
+  cout << "done. Killed " << numkilled << " reads.\n";
 
   FUNCEND();
-
+  return;
 }
-//#define CEBUG(bla)
 
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
 
-void DataProcessing::buntifyReadsByHashFreq_Read(Read & actread, uint32 basesperhash)
+bool Assembly::performRead_MinimumQualityThreshold(Read & actread, base_quality_t minqual, uint32 minnum)
 {
-  FUNCSTART("void DataProcessing::buntifyReadsByHashFreq_Read(Read & actread, uint32 basesperhash)");
+  FUNCSTART("void Assembly::performRead_ReadMinimumQualityThreshold(base_quality_t minqual, uin32 minnum)");
 
-  //Read::setCoutType(Read::AS_TEXT);
-  //cout << actread;
-
-  // remove old hash frequence tags
-  //  but only if we will be able to set new HAF tags (read is long enough)
-  if(actread.getLenClippedSeq()>=basesperhash){
-    for(uint32 i=0; i<Read::REA_allhaftags.size(); ++i){
-      actread.deleteTag(Read::REA_allhaftags[i]);
-    }
+  const vector<base_quality_t> & quals=actread.getQualities();
+  vector<base_quality_t>::const_iterator qI=quals.begin();
+  uint32 count=0;
+  for(; qI != quals.end(); ++qI){
+    if(*qI>=minqual
+      && ++count>=minnum) return true;
   }
 
-  if(actread.hasValidData()
-     && actread.hasBaseHashStats()
-     && actread.getLenClippedSeq()>=basesperhash){
-
-    static multitag_t tmpmt("","","MIRA");
-
-    DP_tmpvu8.clear();
-    DP_tmpvu8.resize(actread.getLenSeq(),0);
+  FUNCEND();
+  return false;
+}
 
-    vector<Read::bposhashstat_t>::const_iterator bhsI=actread.getBPosHashStats().begin();
-    vector<Read::bposhashstat_t>::const_iterator bhsE=actread.getBPosHashStats().end();
-    vector<uint8>::iterator tfI=DP_tmpvu8.begin();
-    vector<uint8>::iterator tfE=DP_tmpvu8.end();
 
-    priv_buntifyHelper(2, basesperhash, bhsI, bhsE, tfI, tfE);
-    priv_buntifyHelper(3, basesperhash, bhsI, bhsE, tfI, tfE);
-    priv_buntifyHelper(4, basesperhash, bhsI, bhsE, tfI, tfE);
-    priv_buntifyHelper(5, basesperhash, bhsI, bhsE, tfI, tfE);
-    priv_buntifyHelper(6, basesperhash, bhsI, bhsE, tfI, tfE);
-    priv_buntifyHelper(7, basesperhash, bhsI, bhsE, tfI, tfE);
 
-    vector<tmpbhentry_t> telist;
-    telist.reserve(20);
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+void Assembly::performPool_AdaptorRightClip(const string & logname, const string & logprefix, const uint8 seqtype)
+{
+  FUNCSTART("void Assembly::performPool_SolexaAdaptorRightClip(const string & logname, const string & logprefix, const uint8 seqtype);)");
 
-    //{
-    //	cout << "bfr: " << actread.getName() << endl;
-    //	for(uint32 i=0;i<DP_tmpvu8.size(); i++){
-    //	  cout << "i: " << i << '\t' << static_cast<uint16>(DP_tmpvu8[i]) << endl;
-    //	}
-    //}
+  BUGIFTHROW(seqtype>=Read::SEQTYPE_END,"Unknown seqtype " << static_cast<uint16>(seqtype) << "given.");
 
-    uint32 from=0;
-    uint32 to=0;
-    for(; from<actread.getLenSeq(); from=to+1){
-      to=from;
-      uint8 actfreq=DP_tmpvu8[to];
-      for(; to<actread.getLenSeq() && DP_tmpvu8[to]==actfreq; to++) {} ;
-      to--;
-      if(actfreq>0){
-	telist.resize(telist.size()+1);
-	telist.back().from=from;
-	telist.back().to=to;
-	telist.back().freq=actfreq;
-      }
+  // prepare regular expressions
+  list<boost::regex> adapres;
+  {
+    istringstream tmpis;
+    if(seqtype==Read::SEQTYPE_SOLEXA){
+      static const char regexfile[] = {
+#include "adaptorsregex.solexa.xxd.H"
+	,0
+      };
+      tmpis.str(regexfile);
+    }else if(seqtype==Read::SEQTYPE_IONTORRENT){
+      static const char regexfile[] = {
+#include "adaptorsregex.iontor.xxd.H"
+	,0
+      };
+      tmpis.str(regexfile);
     }
 
-    // for first or last entry, do not put tags for frequencies
-    //  >=2 if their length is < basesperhash
-    // BaCh 03.06.2011: hmmm, why not. OK, makes CAF/MAF bigger, but else?
-    for(uint32 ti=0; ti<telist.size(); ti++){
-      bool settag=true;
-//	if(telist[ti].freq>=2 &&
-//	   (ti==0 || ti==telist.size()-1)){
-//	  if(telist[ti].to - telist[ti].from < basesperhash-1){
-//	    settag=false;
-//	  }
-//	}
-      if(settag) {
-	tmpmt.identifier=Read::REA_allhaftags[telist[ti].freq];
-	tmpmt.from=telist[ti].from;
-	tmpmt.to=telist[ti].to;
-	actread.addTagO(tmpmt);
-      }
+    string line;
+    while(true){
+      getline(tmpis,line);
+      if(tmpis.eof()) break;
+      boost::to_upper(line);
+      adapres.push_back(boost::regex(line));
     }
   }
 
-}
-//#define CEBUG(bla)
+  ReadPool adappool(&AS_miraparams);
+  adappool.reserve(500);
+  {
+    istringstream tmpis;
 
+    if(seqtype==Read::SEQTYPE_SOLEXA){
+      static const char adapfile[] = {
+#include "adaptorsforclip.solexa.xxd.H"
+	,0
+      };
+      tmpis.str(adapfile);
+    }else if(seqtype==Read::SEQTYPE_IONTORRENT){
+      static const char adapfile[] = {
+#include "adaptorsforclip.iontor.xxd.H"
+	,0
+      };
+      tmpis.str(adapfile);
+    }else if(seqtype==Read::SEQTYPE_454GS20){
+      static const char adapfile[] = {
+#include "adaptorsforclip.454.xxd.H"
+	,0
+      };
+      tmpis.str(adapfile);
+    }
 
-void DataProcessing::priv_buntifyHelper(uint8 allowedfreq, uint32 basesperhash, vector<Read::bposhashstat_t>::const_iterator bhsI, vector<Read::bposhashstat_t>::const_iterator bhsE, vector<uint8>::iterator tfI, vector<uint8>::iterator tfE)
-{
-  for(; bhsI!= bhsE; bhsI++, tfI++){
-    uint8 actfreq=bhsI->fwd.getFrequency();
-    if(allowedfreq==actfreq){
-      if(actfreq>0){
-	vector<uint8>::iterator ttfI=tfI;
-	for(uint32 i=0; i<basesperhash && ttfI!=tfE; i++, ttfI++){
-	  *ttfI=actfreq;
-	}
+    string line;
+    while(true){
+      getline(tmpis,line);
+      if(tmpis.eof()) break;
+      line.erase(0,1);         // get away the ">"
+      if(!line.empty()){
+	adappool.addNewEmptyRead();
+	Read & actread=adappool[adappool.size()-1];
+	actread.disallowAdjustments();
+	actread.setName(line);
+	getline(tmpis,line);
+	if(tmpis.eof()) break;
+	actread.setSequenceFromString(line);
       }
     }
   }
-}
 
+  //adappool.dumpPoolInfo(cout);
 
+  // Go back if nothing to be searched
+  if(adappool.size()==0 && adapres.size()==0) return;
 
+  cout << "Starting " << Read::getNameOfSequencingType(seqtype) << " known adaptor right clip ... "; cout.flush();
 
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
+  Skim adapskim;
+  adapskim.skimStreamPrepare(adappool,7,1);
 
+  cout << "Searching multithread now ... \n"; cout.flush();
 
-void DataProcessing::addKMerForkTags_Pool(ReadPool & rp, uint32 basesperhash)
-{
-  FUNCSTART("void DataProcessing::addKMerForkTags_Pool(ReadPool & rp, uint32 basesperhash)");
+  cout << static_cast<int16>(AS_miraparams[0].getSkimParams().sk_numthreads) << endl;
 
-  cout << "Adding fork tags";
-  if(rp.size()>500000) cout << " (this may take a while)";
-  cout << " ... "; cout.flush();
+  vector<int32> clipres;
+  adapskim.findAdaptorRightClip(AS_readpool,clipres,seqtype,9,AS_miraparams[0].getSkimParams().sk_numthreads);
+  //adapskim.findAdaptorRightClip(AS_readpool,clipres,seqtype,9,1);
+  //adapskim.findAdaptorRightClip(AS_readpool,clipres,seqtype,9,8);
 
-  static multitag_t tmpmt("","","MIRA");
-  tmpmt.identifier=Read::REA_tagentry_idKMRF;
+  BUGIFTHROW(clipres.size()!=AS_readpool.size(),"clipres.size()!=AS_readpool.size()???");
 
-  for(uint32 actid=0; actid<rp.size(); actid++){
-    Read & actread=rp[actid];
+  ofstream logfout;
+  if(!logname.empty()){
+    logfout.open(logname.c_str(), ios::out|ios::app);
+    if(!logfout){
+      MIRANOTIFY(Notify::FATAL, "Could not open log for appending: " << logname);
+    }
+  }
 
-    //Read::setCoutType(Read::AS_TEXT);
-    //cout << actread;
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
+#endif
 
-    // remove old KMRF tags
-    actread.deleteTag(tmpmt.identifier);
+  uint32 numclipped=0;
 
+  cout << "Searching for " <<  Read::getNameOfSequencingType(seqtype) << " partial end adaptors ... \n"; cout.flush();
+  ProgressIndicator<int64> P(0, AS_readpool.size());
+  for(uint32 actid=0; actid < AS_readpool.size(); actid++){
+    P.progress(actid);
+    Read & actread = AS_readpool.getRead(actid);
     if(actread.hasValidData()
-       && actread.hasBaseHashStats()){
-
-      DP_tmpvu8.clear();
-      DP_tmpvu8.resize(actread.getLenSeq(),0);
-
-      auto bhsI=actread.getBPosHashStats().cbegin();
-      auto bhsE=actread.getBPosHashStats().cend();
-      auto tfI=DP_tmpvu8.begin();
-      auto tfE=DP_tmpvu8.end();
+       && actread.getSequencingType()==seqtype
+       && !(actread.isBackbone() || actread.isRail())){
 
-      for(; bhsI!= bhsE; bhsI++, tfI++){
-	if(bhsI->fwd.isKMerFork()){
-	  auto ttfI=tfI;
-	  for(uint32 i=0; i<basesperhash && ttfI!=tfE; ++i, ++ttfI){
-	    *ttfI=1;
-	  }
-	}
-	if(bhsI->rev.isKMerFork()){
-	  auto ttfI=tfI;
-	  for(uint32 i=0; i<basesperhash; ++i, --ttfI){
-	    *ttfI=1;
-	    if(ttfI!=DP_tmpvu8.begin()) break;
+      if(clipres[actid]>=0){
+	++numclipped;
+	actread.setRSClipoff(clipres[actid]);
+	logfout << logprefix << " " 
+		<< Read::getNameOfSequencingType(seqtype) 
+		<< " adaptor: " << actread.getName()
+		<< " changed right clip to " << clipres[actid] << "\n";
+      }else if(!adapres.empty()){
+	string seq(actread.getSeqAsChar());
+	boost::to_upper(seq);
+
+	list<boost::regex>::const_iterator areI=adapres.begin();
+	boost::match_results<std::string::const_iterator> what; 
+	boost::match_flag_type flags = boost::match_default; 
+	std::string::const_iterator start, end; 
+	for(; areI != adapres.end(); ++areI){
+	  start = seq.begin(); 
+	  end = seq.end(); 
+	  if(regex_search(start, end, what, *areI, flags)) { 
+	    ++numclipped;
+	    actread.setRSClipoff(what.position());
+	    logfout << logprefix << " "
+		<< Read::getNameOfSequencingType(seqtype) 
+		    << " partial end adaptor: " << actread.getName()
+		    << " changed right clip to " << what.position() << "\n";
+	    break;
 	  }
 	}
       }
-
-      uint32 from=0;
-      uint32 to=0;
-      for(; from<actread.getLenSeq(); from=to+1){
-	to=from;
-	if(DP_tmpvu8[to]){
-	  for(; to<actread.getLenSeq() && DP_tmpvu8[to]; ++to) {} ;
-	  to--;
-	  tmpmt.from=from;
-	  tmpmt.to=to;
-	  actread.addTagO(tmpmt);
-	}
-      }
     }
+  }
 
-    //if(actid==273250 || actid==273252){
-    //  Read::setCoutType(Read::AS_TEXT);
-    //  cout << actread;
-    //}
+  P.finishAtOnce();
 
+  if(!logname.empty()){
+    logfout.close();
   }
-
-  cout << "done." << endl;
+  
+  cout << "done. Clipped " << numclipped << " reads.\n";
 
   FUNCEND();
-
+  return;
 }
-//#define CEBUG(bla)
+
 
 
 
@@ -1333,521 +1647,563 @@ void DataProcessing::addKMerForkTags_Pool(ReadPool & rp, uint32 basesperhash)
  *
  *
  *
+ *
  *************************************************************************/
 
-
-void DataProcessing::performKMERRepeatTagging_Pool(ReadPool & rp, uint32 basesperhash)
+void Assembly::performMinimumLeftClips(bool onsltag, bool onmaskchar, const string & logname, const string & logprefix)
 {
-  FUNCSTART("void DataProcessing::buntifyReadsByHashFreq()");
-
-  cout << "Adding RMB tags by fork";
-  if(rp.size()>500000) cout << " (this may take a while)";
-  cout << " ... "; cout.flush();
-
-  for(uint32 actid=0; actid<rp.size(); actid++){
-    if(1){
-      performKMERRepeatTagging_Read(rp[actid],basesperhash);
-    }
-  }
-
-  cout << "done." << endl;
-
-  FUNCEND();
-
-}
-//#define CEBUG(bla)
-
-void DataProcessing::performKMERRepeatTagging_Read(Read & actread, uint32 basesperhash)
-{
-  FUNCSTART("void DataProcessing::addBla_Read(Read & actread, uint32 basesperhash)");
-  if(actread.hasValidData()
-     && actread.hasBaseHashStats()
-     && actread.getLenSeq() >= 2*basesperhash){
-
-    static multitag_t tmpmt("","addBla","MIRA");
-    tmpmt.identifier=Read::REA_tagentry_idCRMr;
-
-    DP_tmpvu8.clear();
-    DP_tmpvu8.resize(actread.getLenSeq(),0);
-
-    auto bhsE=actread.getBPosHashStats().cend();
-    auto bhsIf=actread.getBPosHashStats().cbegin();
-    uint32 tagpos=basesperhash-1;
-    auto bhsIr=bhsIf+2*tagpos;
-    auto tfI=DP_tmpvu8.begin()+tagpos;
-
-
-    for(; bhsIr!= bhsE; ++bhsIf, ++bhsIr, ++tfI, ++tagpos){
-      if(bhsIf->fwd.isKMerFork()
-	 && bhsIr->rev.isKMerFork()){
-	*tfI=1;
+  FUNCSTART("void Assembly::performMinimumLeftClips(bool onsltag, bool onmaskchar)");
+
+  if(onsltag || onmaskchar){
+    cout << "Starting minimum left clip ... "; cout.flush();
+    
+    ofstream logfout;
+    if(!logname.empty()){
+      logfout.open(logname.c_str(), ios::out|ios::app);
+      if(!logfout){
+	MIRANOTIFY(Notify::FATAL, "Could not open log for appending: " << logname);
       }
     }
 
-    uint32 runcount=0;
-    for(tfI=DP_tmpvu8.begin(); tfI!=DP_tmpvu8.end(); ++tfI){
-      if(*tfI){
-	++runcount;
-      }else{
-	if(runcount==1){
-	  tmpmt.from=tfI-1-DP_tmpvu8.begin();
-	  tmpmt.to=tmpmt.from;
-	  actread.addTagO(tmpmt);
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
+#endif
+
+    for(uint32 i=0;i<AS_readpool.size();i++){
+      Read & r=AS_readpool.getRead(i);
+      if(r.hasValidData()
+	 && (r.isSequencingType(Read::SEQTYPE_SANGER)
+	     || r.isSequencingType(Read::SEQTYPE_454GS20)
+	     || r.isSequencingType(Read::SEQTYPE_IONTORRENT)
+	     || r.isSequencingType(Read::SEQTYPE_PACBIO)
+	     || r.isSequencingType(Read::SEQTYPE_SOLEXA)
+	     || r.isSequencingType(Read::SEQTYPE_ABISOLID))
+	 && !(r.isBackbone() || r.isRail())){
+	
+
+	//cout << "RT: " << (uint16) r.getSequencingType() << endl;
+	//cout << "MIN: " << AS_miraparams[r.getSequencingType()].getAssemblyParams().as_clip_minslrequired << endl;
+	//cout << "SET: " << AS_miraparams[r.getSequencingType()].getAssemblyParams().as_clip_minqlsetto << endl;;
+	//
+	//r.setCoutType(Read::AS_TEXTCLIPS);
+	//cout << "Old:\n" << r;
+
+	if(AS_miraparams[r.getSequencingType()].getAssemblyParams().as_clip_ensureminimumleftclipoff){
+	  int32 oldlq=r.getLQClipoff();
+	  r.setMinimumLeftClipoff(
+	    AS_miraparams[r.getSequencingType()].getAssemblyParams().as_clip_minslrequired,
+	    AS_miraparams[r.getSequencingType()].getAssemblyParams().as_clip_minqlsetto,
+	    onsltag,
+	    onmaskchar
+	    );
+	  if(!logname.empty()){
+	    logfout << logprefix;
+	    if(oldlq!=r.getLQClipoff()){
+	      logfout << " changed";
+	    }else{
+	      logfout << " unchanged";
+	    }
+	    logfout << " minleft. " 
+		    << r.getName() 
+		    << "\tLeft: "
+		    << oldlq
+		    << "\t -> "
+		    << r.getLQClipoff()
+		    << '\n';
+	  }
+	  //cout << "New:\n" << r;
 	}
-	runcount=0;
       }
     }
+    
+    if(!logname.empty()){
+      logfout.close();
+    }
+
+    cout << "done." << endl;
   }
+
+  FUNCEND();
+  return;
 }
 
 
+
 /*************************************************************************
  *
- *
+ * in comparison to left clip:
+ *  
+ *  if seqtype id 454, then the values are adapted:
+ *    *2  for reads >=180  (FLX and XDR)
  *
  *************************************************************************/
 
-void DataProcessing::clipBadSolexaEnds_Pool(ReadPool & rp, const string & logprefix)
+void Assembly::performMinimumRightClips(const string & logname, const string & logprefix)
 {
-  FUNCSTART("void DataProcessing::clipBadSolexaEnds_Pool(ReadPool & rp, const string & logprefix)");
-
-  for(uint32 i=0;i<rp.size();++i){
-    Read & actread=rp[i];
-    if(actread.hasValidData()
-       && actread.isSequencingType(ReadGroupLib::SEQTYPE_SOLEXA)
-       && !(actread.isBackbone()
-	    || actread.isRail())){
-      clipBadSolexaEnds_Read(actread,logprefix);
+  FUNCSTART("void Assembly::performMinimumRightClips(bool onsltag, bool onmaskchar)");
+
+  cout << "Starting minimum right clip ... "; cout.flush();
+  
+  ofstream logfout;
+  if(!logname.empty()){
+    logfout.open(logname.c_str(), ios::out|ios::app);
+    if(!logfout){
+      MIRANOTIFY(Notify::FATAL, "Could not open log for appending: " << logname);
     }
   }
-}
-
-
-/*************************************************************************
- *
- * TODO: not really good, rethink that for eukaryotes
- *
- *************************************************************************/
-
-void DataProcessing::clipBadSolexaEnds_Read(Read & actread, const string & logprefix)
-{
-  FUNCSTART("void DataProcessing::clipBadSolexaEnds_Read(Read & actread, const string & logprefix)");
+  
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
+#endif
 
-  // invalidate all Solexa reads that have a stretch of 20 A (or T)
-  //  or if has stretch >= 12 and non-A (or T) bases < 20%
-  // N in-between do not reset the counter
-  // invalidate by setting left seq vec to length of read
+  for(uint32 i=0;i<AS_readpool.size();i++){
+    Read & r=AS_readpool.getRead(i);
+    BUGIFTHROW(r.getSequencingType() > Read::SEQTYPE_ABISOLID,
+	       r.getName() << ": sequencing type " << r.getSequencingType() << " unknown to this function, must be worked on.\n");
+    if(r.hasValidData()
+       && (r.isSequencingType(Read::SEQTYPE_SANGER)
+	   || r.isSequencingType(Read::SEQTYPE_454GS20)
+	   || r.isSequencingType(Read::SEQTYPE_IONTORRENT)
+	   || r.isSequencingType(Read::SEQTYPE_PACBIO)
+	   || r.isSequencingType(Read::SEQTYPE_SOLEXA)
+	   || r.isSequencingType(Read::SEQTYPE_ABISOLID))
+       && !(r.isBackbone() || r.isRail())){
+      
+      
+      //cout << "RT: " << (uint16) r.getSequencingType() << endl;
+      //cout << "MIN: " << AS_miraparams[r.getSequencingType()].getAssemblyParams().as_clip_minsrrequired << endl;
+      //cout << "SET: " << AS_miraparams[r.getSequencingType()].getAssemblyParams().as_clip_minqrsetto << endl;;
+      //
+      //r.setCoutType(Read::AS_TEXTCLIPS);
+      //cout << "Old:\n" << r;
+      
+      if(AS_miraparams[r.getSequencingType()].getAssemblyParams().as_clip_ensureminimumrightclipoff){
+	// special handling of sequencing types
+	bool clipit=true;
+	switch(r.getSequencingType()) {
+	case Read::SEQTYPE_SANGER : break;
+	case Read::SEQTYPE_PACBIO : break;
+	case Read::SEQTYPE_IONTORRENT : break;
+	case Read::SEQTYPE_454GS20 : {
+	  // for paired end, do clip only forward sequences
+	  // this way, partial reads from paired end also do not
+	  //  get clipped
+	  if(r.getTemplateEnd() != 'F') clipit=false;
+
+	  break;
+	}
+	case Read::SEQTYPE_SOLEXA : {
+	  clipit=false;
+	  break;
+	}
+	case Read::SEQTYPE_ABISOLID : {
+	  clipit=false;
+	  break;
+	}
+	default: {
+	}
+	}
 
-  int32 runindex=actread.getLeftClipoff();
-  char actbase=' ';
-  uint32 bcount=0;
-
-  uint32 arun=0;
-  uint32 maxarun=0;
-  uint32 nona=0;
-
-  uint32 trun=0;
-  uint32 maxtrun=0;
-  uint32 nont=0;
-
-  for(; runindex<actread.getRightClipoff(); runindex++) {
-    actbase=static_cast<char>(toupper(actread.getBaseInSequence(runindex)));
-    if(actbase!='N'){
-      bcount++;
-      if(actbase=='A'){
-	arun++;
-	if(arun>maxarun) maxarun=arun;
-	nont++;
-	trun=0;
-      }else if(actbase=='T'){
-	trun++;
-	if(trun>maxtrun) maxtrun=trun;
-	nona++;
-	arun=0;
-      }else{
-	nona++;
-	nont++;
-	arun=0;
-	trun=0;
+	if(clipit) {
+	  int32 oldrq=r.getRQClipoff();
+	  int32 oldrs=r.getRSClipoff();
+	  int32 minsr=AS_miraparams[r.getSequencingType()].getAssemblyParams().as_clip_minsrrequired;
+	  int32 setto=AS_miraparams[r.getSequencingType()].getAssemblyParams().as_clip_minqrsetto;
+	  if(r.getSequencingType()==Read::SEQTYPE_454GS20){
+	    if(r.getLenSeq()>180){
+	      //minsr*=2;
+	      //setto*=2;
+	      minsr+=minsr/2;
+	      setto+=setto/2;
+	    }
+	  }
+	  
+	  r.setMinimumRightClipoff(minsr,setto);
+	  // if the length of the read falls below the minimum length,
+	  //  put back the original clip
+	  if(r.getLenClippedSeq() < AS_miraparams[r.getSequencingType()].getAssemblyParams().as_minimum_readlength){
+	    r.setRQClipoff(oldrq);
+	    r.setRSClipoff(oldrs);
+	  }
+	  
+	  
+	  if(!logname.empty()){
+	    logfout << logprefix;
+	    if(oldrq!=r.getRQClipoff()){
+	      logfout << " changed";
+	    }else{
+	      logfout << " unchanged";
+	    }
+	    logfout << " minright. " 
+		    << r.getName() 
+		    << "\tRight: "
+		    << oldrq
+		    << "\t-> "
+		    << r.getRQClipoff()
+		    << '\n';
+	  }
+	  //cout << "New:\n" << r;
+	}
       }
     }
   }
-  if(maxarun>=20){
-    actread.setLSClipoff(actread.getLenSeq());
-    DP_logfout << logprefix << " bad solexa end: A hard "
-	       << actread.getName()
-	       << '\n';
-  }else if(maxarun>=12){
-    uint32 ratio= static_cast<uint32>((static_cast<double>(100.0)/bcount)*nona);
-    if(ratio<20) {
-      actread.setLSClipoff(actread.getLenSeq());
-      DP_logfout << logprefix << " bad solexa end: A soft "
-		 << actread.getName()
-		 << '\n';
-    }
-  }
-
-  if(maxtrun>=20){
-    actread.setLSClipoff(actread.getLenSeq());
-    DP_logfout << logprefix << " bad solexa end: T (hard) "
-	       << actread.getName()
-	       << '\n';
-  }else if(maxtrun>=12){
-    uint32 ratio= static_cast<uint32>((static_cast<double>(100.0)/bcount)*nont);
-    if(ratio<20) {
-      actread.setLSClipoff(actread.getLenSeq());
-      DP_logfout << logprefix << " bad solexa end: T (soft) "
-		 << actread.getName()
-		 << '\n';
-    }
+  
+  if(!logname.empty()){
+    logfout.close();
   }
+  
+  cout << "done." << endl;
 
   FUNCEND();
+  return;
 }
 
 
+
+
 /*************************************************************************
  *
- * clip all lowercase at the end of reads
+ *
+ *
  *
  *************************************************************************/
 
-void DataProcessing::lowerCaseClipping_Pool(ReadPool & rp, const string & logprefix)
+void Assembly::performBadSequenceSearch(const string & logname, const string & logprefix)
 {
-  FUNCSTART("void DataProcessing::lowerCaseClipping_Pool(ReadPool & rp, const string & logprefix)");
+  FUNCSTART("void Assembly::performBadSequenceSearch(uint32 winlen, base_quality_t minqual)");
 
-  uint64 totallen=0;
-  uint64 lowercaselen=0;
-  for(uint32 i=0;i<rp.size();i++){
-    Read & actread=rp.getRead(i);
-    if(actread.hasValidData()
-       && ((*DP_miraparams_ptr)[actread.getSequencingType()].getAssemblyParams().as_clip_lowercase_front
-	    || (*DP_miraparams_ptr)[actread.getSequencingType()].getAssemblyParams().as_clip_lowercase_back)
-       && !(actread.isBackbone()
-	    || actread.isRail())){
-      totallen+=actread.getLenClippedSeq();
-      int32 runindex=actread.getLeftClipoff();
-      for(; runindex<actread.getRightClipoff(); ++runindex){
-	if(islower(actread.getBaseInSequence(runindex))) lowercaselen++;
-      }
+  cout << "Performing search for bad sequence quality ... "; cout.flush();
+  
+  ofstream logfout;
+  if(!logname.empty()){
+    logfout.open(logname.c_str(), ios::out|ios::app);
+    if(!logfout){
+      MIRANOTIFY(Notify::FATAL, "Could not open log for appending: " << logname);
     }
   }
-
-  if(totallen==lowercaselen) {
-    cout << "Lowercase clip: all sequences to be clipped are lowercase?! Failsafe: no clipping performed.\n";
-    return;
-  }
-
-  for(uint32 i=0;i<rp.size();i++){
-    Read & actread=rp.getRead(i);
-    if(actread.hasValidData()
-       && !(actread.isBackbone()
-	    || actread.isRail())){
-      if((*DP_miraparams_ptr)[actread.getSequencingType()].getAssemblyParams().as_clip_lowercase_front){
-	lowerCaseClippingFront_Read(actread,logprefix);
+  
+  for(uint32 i=0;i<AS_readpool.size();i++){
+    Read & r=AS_readpool.getRead(i);
+    if(AS_miraparams[r.getSequencingType()].getAssemblyParams().as_clip_badstretchquality
+       && r.hasValidData()
+       && r.hasQuality()
+       && r.isSequencingType(Read::SEQTYPE_SANGER)
+       && !(r.isBackbone() || r.isRail())){
+      
+      uint32 winlen=AS_miraparams[r.getSequencingType()].getAssemblyParams().as_clip_badstretchquality_winlen;
+      base_quality_t minqual=AS_miraparams[r.getSequencingType()].getAssemblyParams().as_clip_badstretchquality_minqual;
+
+      const vector<base_quality_t> & bquals=r.getQualities();
+      int32 runi=r.getLeftClipoff();
+      int32 endi=r.getRightClipoff();
+
+      uint32 qualsbelow=0;
+      bool foundbad=false;
+      for(; runi < endi; runi++){
+	if(bquals[runi] < minqual){
+	  qualsbelow++;
+	  if(qualsbelow >= winlen){
+	    foundbad=true;
+	    break;
+	  }
+	}else{
+	  qualsbelow=0;
+	}
       }
-      if((*DP_miraparams_ptr)[actread.getSequencingType()].getAssemblyParams().as_clip_lowercase_back){
-	lowerCaseClippingBack_Read(actread,logprefix);
+
+      if(foundbad) {
+	int32 newrclip=runi-qualsbelow+1;
+	int32 shortened=r.getRightClipoff()-newrclip;
+	//cout << r.getName() << " has bad stretch, shortening by " << r.getRightClipoff()-newrclip << '\n';
+	if(newrclip < r.getLQClipoff()) newrclip=r.getLQClipoff();
+	r.setRQClipoff(newrclip);
+	if(!logname.empty()){
+	  logfout << logprefix << " bad seq. " 
+		  << r.getName() 
+		  << "\tShortened by " << shortened
+		  << "\tNew right: "
+		  << r.getRQClipoff()
+		  << '\n';
+	}
       }
     }
   }
+  cout << "done." << endl;
+
+  if(!logname.empty()){
+    logfout.close();
+  }
 
   FUNCEND();
+  return;
 }
 
+
+
+
 /*************************************************************************
  *
- * clip all lowercase at the end of reads
+ *
+ * 
  *
  *************************************************************************/
 
-void DataProcessing::lowerCaseClippingFront_Read(Read & actread, const string & logprefix)
+void Assembly::correctContigs()
 {
-  FUNCSTART("void DataProcessing::lowerCaseClippingFront_Read(Read & actread, const string & logprefix)");
-
-  // TODO: for streaming, implement check counter by rgid for all sequence lowercase
-
-  int32 runindex=actread.getLeftClipoff();
-  for(; runindex<actread.getRightClipoff(); ++runindex){
-    char ab=actread.getBaseInSequence(runindex);
-    if(!islower(ab)
-       && ab != 'N'
-       && ab != 'X') break;
-  }
-  // TODO: 01.01.2013 check this, changed != to >
-  if(runindex>actread.getLeftClipoff()) {
-    actread.setLSClipoff(runindex);
-    DP_logfout << logprefix << " changed left (lowercase) "
-	       << actread.getName() << " to " << actread.getLeftClipoff() << '\n';
+#ifdef MIRA_HAS_EDIT
+  FUNCSTART("void Assembly::correctContigs()");
+
+  if(AS_miraparams[0].getAssemblyParams().as_dateoutput) dateStamp(cout);
+  cout << "\nEditing contigs:" << endl;
+
+  EDITParameters eparams;
+
+  //  eparams.setDoEval();
+  eparams.setStrictEvaluation(false);
+  eparams.setConfirmationThreshold(0.5);
+  eparams.setShowProgress(true);
+  eparams.setVerbose(0);
+  eparams.setShowProgress(true);
+
+
+  list<Contig>::iterator I = AS_contigs.begin();
+  int32 ccounter=0;
+  ProgressIndicator<int64> P(0, AS_contigs.size());
+
+  while(I!=AS_contigs.end()){
+    P.progress(ccounter);
+    try {
+      //	CEBUG("Editing contig:" << ccounter << endl);
+      //	CEBUG(*I);
+      cout << "Editing contig:" << ccounter << endl;
+      editContigBack(*I, eparams);
+      ScfBuffer::discard();
+      cout << "deleting star columns" << ccounter << endl;
+      I->deleteStarOnlyColumns(0, I->getContigLength()-1);
+      cout << "marking repeats" << ccounter << endl;
+
+      Contig::repeatmarker_stats_t repstats;
+      vector<bool> readsmarkedsrm;
+      I->newMarkPossibleRepeats(repstats, readsmarkedsrm);
+
+      //	CEBUG("Corrected contig:" << endl);
+      //	CEBUG(*I);
+    }
+    catch(Notify n){
+      n.handleError("Error while examining fault-region");
+    }
+    
+    I++;ccounter++;
   }
-}
+  
+  P.finishAtOnce();
+  
+  cout << endl;
 
+  FUNCEND();
+#endif
+  return;
+}
 
-void DataProcessing::lowerCaseClippingBack_Read(Read & actread, const string & logprefix)
-{
-  FUNCSTART("void DataProcessing::lowerCaseClippingBack_Read(Read & actread, const string & logprefix)");
 
-  // TODO: for streaming, implement check counter by rgid for all sequence lowercase
 
-  int32 runindex=actread.getRightClipoff()-1;
-  for(; runindex>=actread.getLeftClipoff() && islower(actread.getBaseInSequence(runindex)); --runindex) ;
-  // TODO: implement jumping over N,X like for front
-  // TODO: 01.01.2013 really check this, changed != to <
-  if(runindex<actread.getRightClipoff()-1) {
-    actread.setRSClipoff(runindex+1);
-    DP_logfout << logprefix << " changed right (lowercase) "
-	       << actread.getName() <<  " to " << actread.getRightClipoff() << '\n';
-  }
-  //cout << actread;
 
-  FUNCEND();
-}
 
 
 /*************************************************************************
  *
+ * Calculates possible sequence vector leftovers at the left side of a read
+ * Reads that get a clip must be of Sanger type
  *
+ * Does not clip backbone reads, rail reads, multicopyreads
+ *  AND not areas protected by Staden GenBank Feature tags
  *
+ * Clipping itself must be done afterwards in the performSeqVectorClippings()
+ *  function. This was split in two parts to allow releasing of the
+ *  big memory chunks AS_readhmcovered, AS_readhitmiss, etc.
  *
  *************************************************************************/
 
-void DataProcessing::qualClips_Pool(ReadPool & rp, const string & logprefix)
-{
-  FUNCSTART("void DataProcessing::qualClips_Pool(ReadPool & rp, const string & logprefix)");
 
-  cout << "Starting qual clips: ";
+void Assembly::calcPossibleSeqVectorClipoffs(int32 version, const string prefix, const string postfix, const string logname)
+{
+  FUNCSTART("void Assembly::calcPossibleSeqVectorClipoffs(int32 version, const string prefix, const string postfix, const string logname)");
 
-  for(uint32 i=0;i<rp.size();i++){
-    Read & r=rp.getRead(i);
-    if(r.hasValidData()
-       && !(r.isBackbone()
-	    || r.isRail())){
-      if((*DP_miraparams_ptr)[r.getSequencingType()].getAssemblyParams().as_clip_quality) {
-	qualClips_Read(r,logprefix);
-      }
-    }
+  if(AS_readhmcovered.size()==0 || AS_readhitmiss.size()==0) {
+    cout << "\nNo vector clipping information available, aborting vector clip.\n";
+    FUNCEND();
+    return;
   }
-}
 
+  if(AS_miraparams[0].getAssemblyParams().as_dateoutput) dateStamp(cout);
+  cout << "\nCalculating possible vector leftovers ... ";
+  cout.flush();
+  //ProgressIndicator P (0, AS_readhmcovered.size()-1);
+
+  AS_clipleft.clear();
+  AS_clipright.clear();
+  AS_clipleft.resize(AS_readhmcovered.size(),-1);
+  AS_clipright.resize(AS_readhmcovered.size(),-1);
 
-void DataProcessing::qualClips_Read(Read & actread, const string & logprefix)
-{
-  FUNCSTART("void DataProcessing::qualClips_Read(Read & actread, const string & logprefix)");
-
-  int32 oldlq=actread.getLQClipoff();
-  int32 oldrq=actread.getRQClipoff();
-  actread.performQualityClip(
-    (*DP_miraparams_ptr)[actread.getSequencingType()].getAssemblyParams().as_clip_quality_minqual,
-    (*DP_miraparams_ptr)[actread.getSequencingType()].getAssemblyParams().as_clip_quality_winlen);
-  int changed=2;
-  if(oldlq>actread.getLQClipoff()){
-    // old LQ was more conservative, change back
-    actread.setLQClipoff(oldlq);
-    --changed;
-  }
-  if(oldrq<actread.getRQClipoff()){
-    // old RQ was more conservative, change back
-    actread.setRQClipoff(oldrq);
-    --changed;
-  }
-  if(changed){
-    DP_logfout << logprefix
-	       << " changed qual. "
-	       << actread.getName()
-	       << "\tfrom: " << oldlq << ' ' << oldrq << "\tto: "
-	       << actread.getLQClipoff()
-	       << ' '
-	       << actread.getRQClipoff() << '\n';
+  string filename;
+  if(logname.size()){
+    filename=buildFileName(version, prefix, postfix, logname, ".txt");
+  }else{
+    filename=buildFileName(version, prefix, postfix, 
+			   AS_miraparams[0].getAssemblyParams().as_tmpf_vectorclip,
+			   ".txt");
   }
-}
 
+  ofstream logout(filename.c_str(), ios::out | ios::trunc);
 
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
+  for(uint32 id=0; id<AS_readhmcovered.size(); id++) {
+    if(AS_readpool.getRead(id).getSequencingType() != Read::SEQTYPE_SANGER
+       || AS_readpool.getRead(id).isBackbone()
+       || AS_readpool.getRead(id).isRail()
+       || AS_multicopies[id]>0
+      ) continue;
 
-void DataProcessing::maskClips_Pool(ReadPool & rp, const string & logprefix)
-{
-  FUNCSTART("void DataProcessing::maskClips_Pool(ReadPool & rp, const string & logprefix)");
 
-  cout << "Starting qual clips: ";
+    //P.progress(id);
 
-  for(uint32 i=0;i<rp.size();i++){
-    Read & r=rp.getRead(i);
-    if(r.hasValidData()
-       && !(r.isBackbone()
-	    || r.isRail())){
-      if((*DP_miraparams_ptr)[r.getSequencingType()].getAssemblyParams().as_clip_maskedbases) {
-	maskClips_Read(r,logprefix);
+    uint32 clippos=0;
+    bool mustclip=false;
+    for(uint32 actpos=0; actpos<AS_readhmcovered[id].size(); actpos++) {
+      if(actpos-clippos > 5) break;
+      if(AS_readhmcovered[id][actpos]>=4) {
+	if(AS_readhitmiss[id][actpos]) {
+	  if(100.0/static_cast<double>(AS_readhmcovered[id][actpos])*static_cast<double>(AS_readhitmiss[id][actpos]) >= 30.0) {
+	    clippos=actpos;
+	    mustclip=true;
+	  }
+	}
       }
     }
-  }
-}
-
-
-void DataProcessing::maskClips_Read(Read & actread, const string & logprefix, int32 gapsize, int32 maxfrontgap, int32 maxendgap)
-{
-  FUNCSTART("void DataProcessing::maskClips_Read(Read & actread, const string & logprefix, int32 gapsize, int32 maxfrontgap, int32 maxendgap)");
-
-  if(gapsize<0) gapsize=(*DP_miraparams_ptr)[actread.getSequencingType()].getAssemblyParams().as_clip_maskedbase_gapsize;
-  if(maxfrontgap<0) maxfrontgap=(*DP_miraparams_ptr)[actread.getSequencingType()].getAssemblyParams().as_clip_maskedbase_maxfrontgap;
-  if(maxendgap<0) maxendgap=(*DP_miraparams_ptr)[actread.getSequencingType()].getAssemblyParams().as_clip_maskedbase_maxendgap;
-
-  auto oldlm=actread.getLMClipoff();
-  auto oldrm=actread.getRMClipoff();
-  auto oldlc=actread.getLeftClipoff();
-  auto oldrc=actread.getRightClipoff();
-  actread.setClipoffsToMaskedChars(
-    gapsize,
-    maxfrontgap,
-    maxendgap,
-    false);
-  actread.setClipoffsToMaskedChars(
-    1,
-    1,
-    1,
-    true);
-  int changed=2;
-  if(oldlm>=actread.getLMClipoff()){
-    // old LM was more conservative, change back
-    if(oldlm>actread.getLMClipoff()) actread.setLMClipoff(oldlm);
-    --changed;
-  }
-  if(oldrm<=actread.getRMClipoff()){
-    // old RM was more conservative, change back
-    if(oldrm<actread.getRMClipoff()) actread.setRMClipoff(oldrm);
-    --changed;
-  }
-  if(changed){
-    DP_logfout << logprefix
-	       << " changed mask. "
-	       << actread.getName()
-	       << "\tfrom: " << oldlm << ' ' << oldrm << " (" << oldlc << " " << oldrc << ")\tto: "
-	       << actread.getLMClipoff()
-	       << ' '
-	       << actread.getRMClipoff() << " (" << actread.getLeftClipoff() << " " << actread.getRightClipoff() << ")\n";
-  }
-
-  FUNCEND();
-  return;
-}
+    clippos++;
 
+    // check that no GenBank Feature tags protect the area, else clip less
+    {
 
+      // FIXME: put all checks for that into read.C (*sigh*)
 
+      for(uint32 i=0; i<AS_readpool.getRead(id).getNumOfTags(); i++){
+	const multitag_t & acttag=AS_readpool.getRead(id).getTag(i);
+	if(GBF::checkIfGBFfeature(acttag.getIdentifierStr())) {
+	  if(acttag.from<clippos) clippos=acttag.from;
+	  if(acttag.to<=clippos) clippos=0;
+	}
+      }
+    }
 
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-void DataProcessing::minimumQualityThreshold_Pool(ReadPool & rp, const string & logprefix)
-{
-  FUNCSTART("void DataProcessing::minimumQualityThreshold_Pool(ReadPool & rp, const string & logprefix)");
+    // auf clip verzichten wenn nur 1 base betroffen (sieht zu doof aus)
+    if(mustclip && clippos>1) {
+      uint32 maxcliplenallowed=AS_miraparams[AS_readpool.getRead(id).getSequencingType()].getAssemblyParams().as_clip_vector_maxlenallowed; 
+      if(maxcliplenallowed == 0 || clippos <= maxcliplenallowed) {
+	//AS_readpool.getRead(id).setClipoffs(AS_readpool.getRead(id).getLeftClipoff()+clippos,
+	//				    AS_readpool.getRead(id).getRightClipoff(),
+	//				    false);
 
-  cout << "Starting minimum quality threshold clip ... "; cout.flush();
+	//AS_clipleft[id]=AS_readpool.getRead(id).getLeftClipoff()+clippos;
+	
+	AS_clipleft[id]=clippos;
 
-  uint32 numkilled=0;
+	logout << "Clipped " << clippos << " bases on the left of " << AS_readpool.getRead(id).getName() << "\n";
 
-  for(uint32 actid=0; actid < rp.size(); ++actid){
-    Read & actread = rp[actid];
-    if(actread.hasValidData()
-       && !(actread.isBackbone() || actread.isRail())){
-      if(!minimumQualityThreshold_Read(actread,logprefix)){
-	++numkilled;
+      } else {
+	if(clippos > maxcliplenallowed) {
+	  logout << "Not clipped " << clippos << " bases on the left of " << AS_readpool.getRead(id).getName() << " , too long.\n";
+	}
       }
     }
   }
-  cout << "done. Killed " << numkilled << " reads.\n";
+
+  logout.close();
+
+  //P.progress(AS_readhmcovered.size());
+  cout << "done.\n";
+	     
+  AS_steps[ASVECTORSCLIPPED]=1;
+  AS_steps[ASADSLISTOK]=0;
 
   FUNCEND();
 }
 
 
 
+
 /*************************************************************************
  *
- *
+ * Reads must be Sanger type
  *
  *
  *************************************************************************/
 
-bool DataProcessing::minimumQualityThreshold_Read(Read & actread, const string & logprefix)
+void Assembly::performSeqVectorClippings()
 {
-  FUNCSTART("bool DataProcessing::minimumQualityThreshold_Read(Read & actread, const string & logprefix)");
+  FUNCSTART("void Assembly::performSeqVectorClippings()");
 
-  base_quality_t minqual=(*DP_miraparams_ptr)[actread.getSequencingType()].getAssemblyParams().as_clip_quality_minthreshold;
-  uint32 minnum=(*DP_miraparams_ptr)[actread.getSequencingType()].getAssemblyParams().as_clip_quality_numminthreshold;
-  const vector<base_quality_t> & quals=actread.getQualities();
-  vector<base_quality_t>::const_iterator qI=quals.begin();
-  bool mustkill=true;
-  for(; qI != quals.end(); ++qI){
-    if(*qI>=minqual
-       && --minnum==0) {
-      mustkill=false;
-      break;
-    }
-  }
+  cout << "\nPerforming vector clipping ... ";
+  cout.flush();
 
-  if(mustkill){
-    actread.setLQClipoff(actread.getLenSeq());
-    actread.setRQClipoff(actread.getLenSeq());
-    DP_logfout << logprefix << ' ' << actread.getName() << ": min qual threshold not met, killed\n";
+  for(uint32 id=0; id<AS_clipleft.size(); id++) {
+    if(AS_clipleft[id]>=0
+       && AS_readpool.getRead(id).isSequencingType(Read::SEQTYPE_SANGER)) {
+      AS_readpool.getRead(id).setClipoffs(AS_readpool.getRead(id).getLeftClipoff()+AS_clipleft[id],
+					  AS_readpool.getRead(id).getRightClipoff(),
+					  false);
+    }
   }
-
   FUNCEND();
-  return !mustkill;
-}
-
 
+  AS_clipleft.clear();
 
+  cout << "done." << endl;
 
+  return;
+}
 
 
 /*************************************************************************
  *
- *
+ * Short Read Mappings right clip
+ * Reads must be Solexa/SOLiD type
  *
  *
  *************************************************************************/
 
-void DataProcessing::minimumLeftClip_Pool(ReadPool & rp, const string & logprefix, bool qual, bool seqvec, bool mask)
+void Assembly::performSRMRightClippings()
 {
-  for(uint32 ri=0;ri<rp.size();++ri){
-    Read & actread=rp[ri];
-    if(actread.hasValidData()
-       && !(actread.isBackbone() || actread.isRail())){
-      if((*DP_miraparams_ptr)[actread.getSequencingType()].getAssemblyParams().as_clip_ensureminimumleftclipoff){
-	minimumLeftClip_Read(actread,logprefix,qual,seqvec,mask);
-      }
-    }
-  }
-}
+  FUNCSTART("void Assembly::performSRMRightClippings()");
 
-void DataProcessing::minimumLeftClip_Read(Read & actread, const string & logprefix, bool qual, bool seqvec, bool mask)
-{
-  auto oldlc=actread.getLeftClipoff();
-  if(oldlc < (*DP_miraparams_ptr)[actread.getSequencingType()].getAssemblyParams().as_clip_minslrequired){
-    if(qual) actread.setLQClipoff((*DP_miraparams_ptr)[actread.getSequencingType()].getAssemblyParams().as_clip_minqlsetto);
-    if(seqvec) actread.setLSClipoff((*DP_miraparams_ptr)[actread.getSequencingType()].getAssemblyParams().as_clip_minqlsetto);
-    if(mask) actread.setLMClipoff((*DP_miraparams_ptr)[actread.getSequencingType()].getAssemblyParams().as_clip_minqlsetto);
-
-    DP_logfout << logprefix
-	       << " changed minleft. "
-	       << actread.getName()
-	       << "\tLeft: "
-	       << oldlc
-	       << "\t -> "
-	       << actread.getLeftClipoff()
-	       << '\n';
+  cout << "\nPerforming right clipping of unfriendly Solexa reads ... ";
+  cout.flush();
+
+  uint32 counter=0;
+  uint32 howmuch=0;
+  for(uint32 id=0; id<AS_clipright.size(); id++) {
+    if(AS_clipright[id]>=0
+       && (AS_readpool.getRead(id).isSequencingType(Read::SEQTYPE_SOLEXA)
+	   || AS_readpool.getRead(id).isSequencingType(Read::SEQTYPE_ABISOLID))) {
+      counter++;
+      howmuch+=AS_readpool.getRead(id).getRightClipoff()-AS_clipright[id];
+      AS_readpool.getRead(id).setClipoffs(AS_readpool.getRead(id).getLeftClipoff(),
+					  AS_clipright[id],
+					  false);
+    }
   }
+  FUNCEND();
+
+  AS_clipright.clear();
+
+  cout << "done.\n";
+  cout << "Clipped " << howmuch << " bases in " << counter << " reads." << endl;
+
+  return;
 }
 
 
+
+
 /*************************************************************************
  *
  *
@@ -1855,108 +2211,325 @@ void DataProcessing::minimumLeftClip_Read(Read & actread, const string & logpref
  *
  *************************************************************************/
 
-void DataProcessing::minimumRightClip_Pool(ReadPool & rp, const string & logprefix, bool qual, bool seqvec, bool mask)
+struct cliplen_t{
+  int32 len;
+  bool changed;
+};
+
+
+//#define CEBUGFLAG 1
+void Assembly::extendADS(int32 version, const string prefix, const string postfix, const string logname)
 {
-  for(uint32 ri=0;ri<rp.size();++ri){
-    Read & actread=rp[ri];
-    if(actread.hasValidData()
-       && !(actread.isBackbone() || actread.isRail())){
-      if((*DP_miraparams_ptr)[actread.getSequencingType()].getAssemblyParams().as_clip_ensureminimumrightclipoff){
-	minimumRightClip_Read(actread,logprefix,qual,seqvec,mask);
-      }
-    }
+  FUNCSTART("void Assembly::extendADS(int32 version, const string prefix, const string postfix, const string logname)");
+
+//  if(AS_steps[ASADSLISTOK]==0){
+//    makeAlignments();
+//  }
+
+
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
+#endif
+
+  // TODO: change to use different Aligns / MIRAparams depending 
+  //   on Sanger / 454 (/ PacBio ???) reads
+
+  // TODO: what about PacBio? currently not used, but should it?
+
+  MIRAParameters tmpparams = AS_miraparams[0];
+
+  tmpparams.setAlignMinRelScore(5);
+
+  assembly_parameters const & as_params= tmpparams.getAssemblyParams();
+
+  string filename;
+  if(logname.size()){
+    filename=buildFileName(version, prefix, postfix, logname, ".txt");
+  }else{
+    filename=buildFileName(version, prefix, postfix, 
+			   as_params.as_tmpf_adsextend,
+			   ".txt");
   }
-}
 
-void DataProcessing::minimumRightClip_Read(Read & actread, const string & logprefix, bool qual, bool seqvec, bool mask)
-{
-  auto oldrc=actread.getRightClipoff();
-  if(actread.getLenSeq()-oldrc < (*DP_miraparams_ptr)[actread.getSequencingType()].getAssemblyParams().as_clip_minsrrequired){
-    int32 newr=actread.getLenSeq()-(*DP_miraparams_ptr)[actread.getSequencingType()].getAssemblyParams().as_clip_minsrrequired;
-    if(qual) actread.setRQClipoff(newr);
-    if(seqvec) actread.setRSClipoff(newr);
-    if(mask) actread.setRMClipoff(newr);
-
-    DP_logfout << logprefix
-	       << " changed minRight. "
-	       << actread.getName()
-	       << "\tRightt: "
-	       << oldrc
-	       << "\t -> "
-	       << actread.getRightClipoff()
-	       << '\n';
+  ofstream logout(filename.c_str(), ios::out | ios::trunc);
+
+
+  vector<cliplen_t> clips(AS_readpool.size());
+  for(uint32 i=0; i<clips.size(); i++){
+    clips[i].len=0;
+    clips[i].changed=false;
   }
-}
 
+  list<AlignedDualSeq> madsl;
 
+  try{
+    // true for using memcache
+    Align bla(&tmpparams);
+
+    cout << "\n";
+    if(as_params.as_dateoutput) dateStamp(cout);
+    cout << "\nSearching possible read extensions (for Sanger and/or 454):\n";
+    
+    ProgressIndicator<int32> P(0, static_cast<int32>(AS_adsfacts.size())-1);
+    uint32 pindic=0;
+    
+    vector<AlignedDualSeqFacts>::const_iterator I = AS_adsfacts.begin();
+    for(;I!=AS_adsfacts.end();I++){
+      P.progress(pindic++);
+      // first try: prolongate to end.
+      int32 id1=I->getID1();
+      int32 id2=I->getID2();
+      
+      // no sense to calc read extensions for reads where both seqtypes are said
+      //  not to use extensions
+      if(AS_miraparams[AS_readpool.getRead(id1).getSequencingType()].getAssemblyParams().as_use_read_extension == false
+	 && AS_miraparams[AS_readpool.getRead(id2).getSequencingType()].getAssemblyParams().as_use_read_extension == false) continue;
+
+      if(AS_permanent_overlap_bans.checkIfBanned(id1,id2)) {
+	CEBUG("PermBan for: " << id1 << " " << id2 <<"\tskipping\n");
+	continue;
+      }
 
+      CEBUG("\n\nid1: " << id1 << "\t" << AS_readpool.getRead(id1).getName() <<endl);
+      CEBUG("id2: " << id2 << "\t" << AS_readpool.getRead(id2).getName() <<endl);
+
+      // normally the sequences should have a length >0
+      // but due to some clipping being done after SKIM (chimera etc.), it
+      //  may happen they are 0 now. If that's the case, don't bother
+      //  looking at.
+      if(AS_readpool[id1].getLenClippedSeq() == 0
+	 || AS_readpool[id2].getLenClippedSeq() == 0) continue;
+
+      // check for sequencing types
+      if( AS_readpool.getRead(id1).isSequencingType(Read::SEQTYPE_PACBIO)
+	  || AS_readpool.getRead(id2).isSequencingType(Read::SEQTYPE_PACBIO)) continue;
+
+      if( AS_readpool.getRead(id1).isSequencingType(Read::SEQTYPE_IONTORRENT)
+	  || AS_readpool.getRead(id2).isSequencingType(Read::SEQTYPE_SOLEXA)) continue;
+
+      if( AS_readpool.getRead(id1).isSequencingType(Read::SEQTYPE_SOLEXA)
+	  || AS_readpool.getRead(id2).isSequencingType(Read::SEQTYPE_SOLEXA)) continue;
+
+      if( AS_readpool.getRead(id1).isSequencingType(Read::SEQTYPE_ABISOLID)
+	  || AS_readpool.getRead(id2).isSequencingType(Read::SEQTYPE_ABISOLID)) continue;
+
+      //if(clips[id1].changed && clips[id2].changed){
+      //	CEBUG(id1 << " and " << id2 <<" already changed.\n");
+      //	continue;	    
+      //}
+      
+      madsl.clear();
+
+#if CEBUGFLAG > 0
+      //Read::setCoutType(Read::AS_TEXT);
+      Read::setCoutType(Read::AS_TEXTCLIPS);
+      CEBUG(AS_readpool.getRead(id1));
+      CEBUG(AS_readpool.getRead(id2));
+#endif
 
+      if(I->getSequenceDirection(id1) * I->getSequenceDirection(id2) > 0){
+	
+	CEBUG("doalign\n");
 
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
+	// evil hack warning
+	// the &(* ...) construction is needed for gcc3 as it cannot convert 
+	//  a vector<char> iterator to char *   (*sigh*)
+	
+	int32 extendlen1=AS_readpool.getRead(id1).getRightExtend();
+	int32 extendlen2=AS_readpool.getRead(id2).getRightExtend();
 
-void DataProcessing::badSequenceSearch_Pool(ReadPool & rp, const string & logprefix)
-{
-  FUNCSTART("void DataProcessing::badSequenceSearch_Pool(ReadPool & rp, const string & logprefix)");
+	if(AS_miraparams[AS_readpool.getRead(id1).getSequencingType()].getAssemblyParams().as_use_read_extension == false) {
+	  extendlen1=0;
+	}
+	if(AS_miraparams[AS_readpool.getRead(id2).getSequencingType()].getAssemblyParams().as_use_read_extension == false){
+	  extendlen2=0;
+	}
 
-  cout << "Performing search for bad sequence quality ... "; cout.flush();
+	CEBUG("l1: " <<AS_readpool.getRead(id1).getLenClippedSeq() << endl);
+	CEBUG("e1: " <<extendlen1 << endl);
+	CEBUG("l2: " <<AS_readpool.getRead(id2).getLenClippedSeq() << endl);
+	CEBUG("e2: " <<extendlen2 << endl);
+
+	if(extendlen1 >= 10 || extendlen2 >= 10){
+	  bla.acquireSequences(
+	    &(*AS_readpool.getRead(id1).getActualSequence().begin())
+	    +AS_readpool.getRead(id1).getLeftClipoff(),
+	    AS_readpool.getRead(id1).getLenClippedSeq()+extendlen1,
+	    &(*AS_readpool.getRead(id2).getActualSequence().begin())
+	    +AS_readpool.getRead(id2).getLeftClipoff(),
+	    AS_readpool.getRead(id2).getLenClippedSeq()+extendlen2,
+	    id1, id2, 1, 1, true, I->getOffsetInAlignment(id2));
+	  bla.fullAlign(&madsl,false,false);
+	  
+	  if(madsl.size()==0){
+	    CEBUG("No results, less radical try.\n");
+
+	    int32 tryseqlen1=0;
+	    if(AS_miraparams[AS_readpool.getRead(id1).getSequencingType()].getAssemblyParams().as_use_read_extension) {
+	      if(clips[id1].changed){
+		extendlen1-=clips[id1].len;
+	      }
+	      extendlen1/=2;
+	      tryseqlen1=AS_readpool.getRead(id1).getLenClippedSeq()+extendlen1;
+	      if(clips[id1].changed){
+		tryseqlen1+=clips[id1].len;
+	      }
+	      if(AS_readpool.getRead(id1).getLeftClipoff()+tryseqlen1 >= static_cast<int32>(AS_readpool.getRead(id1).getLenSeq())) {
+		CEBUG("t1o: " <<tryseqlen1 << endl);
+		tryseqlen1=AS_readpool.getRead(id1).getLenClippedSeq()+AS_readpool.getRead(id1).getRightExtend();
+		CEBUG("t1n: " <<tryseqlen1 << endl);
+	      }
+	    }
 
-  for(uint32 ri=0;ri<rp.size();++ri){
-    Read & actread=rp[ri];
-    if(actread.hasValidData()
-       && actread.hasQuality()
-       && !(actread.isBackbone() || actread.isRail())){
-      if((*DP_miraparams_ptr)[actread.getSequencingType()].getAssemblyParams().as_clip_badstretchquality){
+	    int32 tryseqlen2=0;
+	    if(AS_miraparams[AS_readpool.getRead(id2).getSequencingType()].getAssemblyParams().as_use_read_extension) {
+	      if(clips[id2].changed){
+		extendlen2-=clips[id2].len;
+	      }
+	      extendlen2/=2;
+	      tryseqlen2=AS_readpool.getRead(id2).getLenClippedSeq()+extendlen2;
+	      if(clips[id2].changed){
+		tryseqlen2+=clips[id2].len;
+	      }
+	      if(AS_readpool.getRead(id2).getLeftClipoff()+tryseqlen2 >= static_cast<int32>(AS_readpool.getRead(id2).getLenSeq())) {
+		CEBUG("t2o: " <<tryseqlen2 << endl);
+		tryseqlen2=AS_readpool.getRead(id2).getLenClippedSeq()+AS_readpool.getRead(id2).getRightExtend();
+		CEBUG("t2n: " <<tryseqlen2 << endl);
+	      }
+	    }
+
+	    CEBUG("cc1: " <<clips[id1].changed << endl);
+	    CEBUG("cl1: " <<clips[id1].len << endl);
+	    CEBUG("l1: " <<AS_readpool.getRead(id1).getLenClippedSeq() << endl);
+	    CEBUG("t1: " <<tryseqlen1 << endl);
+	    CEBUG("cc2: " <<clips[id2].changed << endl);
+	    CEBUG("cl2: " <<clips[id2].len << endl);
+	    CEBUG("l2: " <<AS_readpool.getRead(id2).getLenClippedSeq() << endl);
+	    CEBUG("t2: " <<tryseqlen2 << endl);
+	    if(extendlen1 < 5 && extendlen2 < 5) {
+	      CEBUG("skip" << endl);
+	      continue;
+	    }
+	    
+	    if(tryseqlen1>0 && tryseqlen2>0){
+	      bla.acquireSequences(
+		&(*AS_readpool.getRead(id1).getActualSequence().begin())
+		+AS_readpool.getRead(id1).getLeftClipoff(),
+		tryseqlen1,
+		&(*AS_readpool.getRead(id2).getActualSequence().begin())
+		+AS_readpool.getRead(id2).getLeftClipoff(),
+		tryseqlen2,
+		id1, id2, 1, 1, true, I->getOffsetInAlignment(id2));
+	    }
+	  }
+	}
+      }else{
+	if(I->getSequenceDirection(id2)>0){
+	}else{
+	}
+      }
+      
+      if(madsl.size()==0){
+	CEBUG("No results\n");
+      }else{
+	int32 bestweight=0;
+	list<AlignedDualSeq>::iterator J;
+	for(J= madsl.begin(); J!=madsl.end(); ){
+	  if(J->isValid()==false){
+	    J=madsl.erase(J);
+	  }else{
+	    if(J->getWeight()>bestweight) bestweight=J->getWeight();
+	    J++;
+	  }
+	}
+	// take only the best
+	for(J= madsl.begin(); J!=madsl.end();){
+	  if(J->getWeight() != bestweight){
+	    J=madsl.erase(J);
+	  } else {
+	    J++;
+	  }
+	}    
+//	  cout << "Ext. 1st success: " << id1 << "\t" << id2 << "\n";
+//	  cout << *I;
+//	  cout << *(madsl.begin());
+	
+	int32 lens1=0;
+	int32 lens2=0;
+	if(madsl.begin()->clipper(as_params.as_readextension_window_len,
+				  as_params.as_readextension_window_maxerrors,
+				  lens1, lens2)){
+//	    cout << "Lalala\n";
+
+	  lens1-=AS_readpool.getRead(id1).getLenClippedSeq();
+	  lens2-=AS_readpool.getRead(id2).getLenClippedSeq();
+	  CEBUG("o1: " << AS_readpool.getRead(id1).getLenClippedSeq() << "\tn: " << lens1);
+	  CEBUG("\no2: " << AS_readpool.getRead(id2).getLenClippedSeq() << "\tn: " << lens2<<endl);
+	  
+
+	  if(AS_miraparams[AS_readpool.getRead(id1).getSequencingType()].getAssemblyParams().as_use_read_extension){
+	    if(lens1>5 && lens1>clips[id1].len){
+	      clips[id1].len=lens1;
+	      clips[id1].changed=true;
+	    }
+	  }
+
+	  if(AS_miraparams[AS_readpool.getRead(id2).getSequencingType()].getAssemblyParams().as_use_read_extension){
+	    if(lens2>5 && lens2>clips[id2].len){
+	      clips[id2].len=lens2;
+	      clips[id2].changed=true;
+	    }
+	  }
+	}
       }
     }
+    P.finishAtOnce();
+  }
+  catch(Notify n){
+    n.handleError(THISFUNC);
   }
-}
 
-void DataProcessing::badSequenceSearch_Read(Read & actread, const string & logprefix)
-{
-  uint32 winlen=(*DP_miraparams_ptr)[actread.getSequencingType()].getAssemblyParams().as_clip_badstretchquality_winlen;
-  base_quality_t minqual=(*DP_miraparams_ptr)[actread.getSequencingType()].getAssemblyParams().as_clip_badstretchquality_minqual;
-
-  const vector<base_quality_t> & bquals=actread.getQualities();
-  int32 runi=actread.getLeftClipoff();
-  int32 endi=actread.getRightClipoff();
-
-  uint32 qualsbelow=0;
-  bool foundbad=false;
-  for(; runi < endi; runi++){
-    if(bquals[runi] < minqual){
-      ++qualsbelow;
-      if(qualsbelow >= winlen){
-	foundbad=true;
-	break;
+  int32 lenplus=0;
+  int32 numchanged=0;
+  for(uint32 rid=0; rid<clips.size(); rid++){
+    if(AS_readpool.getRead(rid).isBackbone()
+       || AS_readpool.getRead(rid).isRail()) continue;
+    // contig join spoiler! do not extend back again!
+    if(AS_readpool.getRead(rid).hasTag(Read::REA_tagentry_idCJSP)) continue;
+    if(AS_miraparams[AS_readpool.getRead(rid).getSequencingType()].getAssemblyParams().as_use_read_extension) continue;
+
+    if(clips[rid].changed){
+      CEBUG("ID: " << rid << "\t" << AS_readpool.getRead(rid).getName() << "\toldlen: " << AS_readpool.getRead(rid).getLenClippedSeq());
+      CEBUG("\tgained: " << clips[rid].len << endl);
+      numchanged++;
+      lenplus+=clips[rid].len;
+
+      logout << AS_readpool.getRead(rid).getName() << "\t" << clips[rid].len << "\n";
+
+      AS_readpool.getRead(rid).setClipoffs(AS_readpool.getRead(rid).getLeftClipoff(),
+					 AS_readpool.getRead(rid).getLeftClipoff()+AS_readpool.getRead(rid).getLenClippedSeq()+clips[rid].len-1,
+					 false);
+      
+      if(AS_readpool.getRead(rid).checkRead()){
+	cout << AS_readpool.getRead(rid);
+	throw Notify(Notify::INTERNAL, THISFUNC, AS_readpool.getRead(rid).checkRead()) ;
       }
-    }else{
-      qualsbelow=0;
     }
   }
-
-  if(foundbad) {
-    int32 newrclip=runi-qualsbelow+1;
-    int32 shortened=actread.getRightClipoff()-newrclip;
-    //cout << actread.getName() << " has bad stretch, shortening by " << actread.getRightClipoff()-newrclip << '\n';
-    if(newrclip < actread.getLQClipoff()) newrclip=actread.getLQClipoff();
-    actread.setRQClipoff(newrclip);
-    DP_logfout << logprefix << " bad seq. "
-	       << actread.getName()
-	       << "\tShortened by " << shortened
-	       << "\tNew right: "
-	       << actread.getRQClipoff()
-	       << '\n';
+  
+  cout << "\nChanged length of " << numchanged << " sequences."<< endl;
+  if(numchanged!=0){
+    cout << "Mean length gained in these sequences: " << static_cast<double>(lenplus)/ static_cast<double>(numchanged) << " bases." << endl;
   }
 
+  logout.close();
+
+  AS_steps[ASADSLISTOK]=0;
+
   FUNCEND();
-  return;
+  return;  
 }
-
+//#define CEBUGFLAG 0
 
 
 
@@ -1964,104 +2537,117 @@ void DataProcessing::badSequenceSearch_Read(Read & actread, const string & logpr
 /*************************************************************************
  *
  * clip poly-A in forward and poly-T in reverse direction
- * or: clip only after the poly-stretches, and tag the stretches with Fpas
- *
- * If poly stretches are kept, they are also "cleaned", i.e., bases are
- *  forced to be A (or T) in the detected stretch
+ * or: clip only after the poly-stretches, and tag the stretches with FpAS
  *
  *************************************************************************/
 
-void DataProcessing::clipPolyATAtEnds_Pool(ReadPool & rp, const string & logprefix)
+void Assembly::clipPolyATAtEnds(const string & logname, const string & logprefix)
 {
-  FUNCSTART("void DataProcessing::clipPolyATAtEnds_Pool(ReadPool & rp, const string & logprefix)");
+  FUNCSTART("void Assembly::clipPolyATAtEnds()");
 
   cout << "Clipping or tagging poly A/T stretches at ends of reads ... ";
   cout.flush();
 
-  for(uint32 actid=0; actid < rp.size(); ++actid){
-    Read & actread = rp[actid];
-    if(actread.hasValidData()
-       && !(actread.isBackbone() || actread.isRail())){
-      if((*DP_miraparams_ptr)[actread.getSequencingType()].getAssemblyParams().as_clip_polyat){
-	clipPolyATAtEnds_Read(actread,logprefix);
-      }
+  Read::setCoutType(Read::AS_TEXTSHORT);
+
+  //int32 minlooklen=as_params.as_polybase_start_stretch;
+  //int32 minrunlen=as_params.as_polybase_minimum_count;
+
+  ofstream logfout;
+  if(!logname.empty()){
+    logfout.open(logname.c_str(), ios::out|ios::app);
+    if(!logfout){
+      MIRANOTIFY(Notify::FATAL, "Could not open log for appending: " << logname);
     }
   }
-}
 
-void DataProcessing::clipPolyATAtEnds_Read(Read & actread, const string & logprefix)
-{
-  CEBUG(actread.getName() << endl);
-  CEBUG(actread << endl);
+  for(uint32 actid=0; actid < AS_readpool.size(); actid++){
+    if(AS_readpool.getRead(actid).hasValidData()
+       && !(AS_readpool.getRead(actid).isBackbone() || AS_readpool.getRead(actid).isRail())){
 
-  auto & as_params=(*DP_miraparams_ptr)[actread.getSequencingType()].getAssemblyParams();
-  uint32 mincount=as_params.as_clip_polyat_len;
-  uint32 maxbad=as_params.as_clip_polyat_maxerrors;
-  int32 grace=static_cast<int32>(as_params.as_clip_polyat_maxgap);
-  bool keepstretch=as_params.as_clip_polyat_keeppolystretch;
+      Read & actread = AS_readpool.getRead(actid);
+      assembly_parameters const & as_params= AS_miraparams[actread.getSequencingType()].getAssemblyParams();
+      if(!as_params.as_clip_polyat) continue;
 
-  // search poly-a in forwarddirection
-  {
-    int32 lpolystart=-1;
-    int32 rpolyend=-1;
-    if(searchPolyBaseFrom5Prime(actread,'a',lpolystart,rpolyend,mincount,maxbad,grace)){
-      if(keepstretch){
-	actread.setRMClipoff(rpolyend+1);
-	CEBUG("setting rm " << rpolyend+1 << endl);
-	for(auto i=lpolystart; i<=rpolyend; ++i){
-	  if(toupper(actread.getBaseInSequence(i))!='A'){
-	    actread.changeBaseInSequence('a',0,i);
-	  }
-	}
-      }else{
-	actread.setRMClipoff(lpolystart);
-	CEBUG("setting rm " << lpolystart << endl);
-      }
-      CEBUG("taggingl " << lpolystart << " " << rpolyend << endl);
+      CEBUG(actread.getName() << endl);
+      CEBUG(actread << endl);
 
-      DP_logfout << logprefix << " poly-A fwd. "
-		 << actread.getName()
-		 << "\tMask right: "
-		 << actread.getRMClipoff()
-		 << '\n';
+      uint32 mincount=as_params.as_clip_polyat_len;
+      uint32 maxbad=as_params.as_clip_polyat_maxerrors;
+      int32 grace=static_cast<int32>(as_params.as_clip_polyat_maxgap);
+      bool keepsignal=as_params.as_clip_polyat_keeppolysignal;
 
-      DP_tmpmtpolyAT.from=lpolystart;
-      DP_tmpmtpolyAT.to=rpolyend;
-      actread.addTagO(DP_tmpmtpolyAT);
-    }
-  }
+      //int32 minrunlen=static_cast<int32>(winlen)-static_cast<int32>(maxbad);
 
-  // search poly-t in reverse direction
-  {
-    int32 lpolystart=-1;
-    int32 rpolyend=-1;
-
-    if(searchPolyBaseFrom3Prime(actread,'t',lpolystart,rpolyend,mincount,maxbad,grace)){
-      if(keepstretch){
-	actread.setLMClipoff(lpolystart);
-	CEBUG("setting lm " << lpolystart << endl);
-	for(auto i=lpolystart; i<=rpolyend; ++i){
-	  if(toupper(actread.getBaseInSequence(i))!='T'){
-	    actread.changeBaseInSequence('t',0,i);
+      // search poly-a in forwarddirection
+      {
+	int32 lpolystart=-1;
+	int32 rpolyend=-1;
+	if(searchPolyBaseFrom5Prime(actread,'a',lpolystart,rpolyend,mincount,maxbad,grace)){
+	  if(keepsignal){
+	    actread.setRMClipoff(rpolyend+1);
+	    CEBUG("setting rm " << rpolyend+1 << endl);
+	  }else{
+	    actread.setRMClipoff(lpolystart);
+	    CEBUG("setting rm " << lpolystart << endl);
 	  }
-	}
-      }else{
-	actread.setLMClipoff(rpolyend+1);
-	CEBUG("setting lm " << rpolyend+1 << endl);
+	  CEBUG("taggingl " << lpolystart << " " << rpolyend << endl);
+	  
+	  if(!logname.empty()){
+	    logfout << logprefix << " poly-A fwd. " 
+		    << actread.getName() 
+		    << "\tMask right: "
+		    << actread.getRMClipoff()
+		    << '\n';
+	  }
+	  
+	  actread.addTag(lpolystart,
+			 rpolyend,
+			 Read::REA_tagentry_idFpAS,
+			 Read::REA_tagentry_coFpAS);
+	}	
       }
-      CEBUG("taggingl " << lpolystart << " " << rpolyend << endl);
 
-      DP_logfout << logprefix << " poly-T rev. "
-		 << actread.getName()
-		 << "\tMask left: "
-		 << actread.getLMClipoff()
-		 << '\n';
+      // search poly-t in reverse direction
+      {
+	int32 lpolystart=-1;
+	int32 rpolyend=-1;
+	
+	if(searchPolyBaseFrom3Prime(actread,'t',lpolystart,rpolyend,mincount,maxbad,grace)){
+	  if(keepsignal){
+	    actread.setLMClipoff(lpolystart);
+	    CEBUG("setting lm " << lpolystart << endl);
+	  }else{
+	    actread.setLMClipoff(rpolyend+1);
+	    CEBUG("setting lm " << rpolyend+1 << endl);
+	  }
+	  CEBUG("taggingl " << lpolystart << " " << rpolyend << endl);
+
+	  if(!logname.empty()){
+	    logfout << logprefix << " poly-T rev. " 
+		    << actread.getName() 
+		    << "\tMask left: "
+		    << actread.getLMClipoff()
+		    << '\n';
+	  }
 
-      DP_tmpmtpolyAT.from=lpolystart;
-      DP_tmpmtpolyAT.to=rpolyend;
-      actread.addTagO(DP_tmpmtpolyAT);
+	  actread.addTag(lpolystart,
+			 rpolyend,
+			 Read::REA_tagentry_idFpAS,
+			 Read::REA_tagentry_coFpAS);
+	}	
+      }
     }
   }
+  
+  if(!logname.empty()){
+    logfout.close();
+  }
+    
+  cout << "done." << endl;
+
+  FUNCEND();
+  return;
 }
 
 
@@ -2070,18 +2656,18 @@ void DataProcessing::clipPolyATAtEnds_Read(Read & actread, const string & logpre
 /*************************************************************************
  *
  * Search poly-base (mincount length and maximum maxbad other bases) from left
- *  side of read (with 'grace' length grace if not encountered),
+ *  side of read (with 'grace' length grace if not encountered), 
  *
- *  return:
+ *  return: 
  *    - true if found and return left and right coordinates in lpolystart and
  *      rpolyend
  *    - false if not found (lpolystart and rpolyend undefined)
  *
  *************************************************************************/
 
-bool DataProcessing::searchPolyBaseFrom5Prime(Read & actread, const char polybase, int32 & lpolystart, int32 & rpolyend, const uint32 mincount, const uint32 maxbad, int32 grace)
+bool Assembly::searchPolyBaseFrom5Prime(Read & actread, const char polybase, int32 & lpolystart, int32 & rpolyend, const uint32 mincount, const uint32 maxbad, int32 grace)
 {
-  FUNCSTART("bool DataProcessing::searchPolyBaseFrom5Prime(Read & actread, const char polybase, int32 & lpolystart, int32 & rpolyend, const uint32 mincount, const uint32 maxbad, int32 grace)");
+  FUNCSTART("bool Assembly::searchPolyBaseFrom5Prime(Read & actread, const char polybase, int32 & lpolystart, int32 & rpolyend, const uint32 mincount, const uint32 maxbad, const int32 grace)");
 
 
   BUGIFTHROW(!dptools::isValidACGTBase(polybase),"Ummm ... " << polybase << " is not ACGT?");
@@ -2093,7 +2679,7 @@ bool DataProcessing::searchPolyBaseFrom5Prime(Read & actread, const char polybas
 
   lpolystart=-1;
   rpolyend=-1;
-
+	
   int32 runindex=actread.getLeftClipoff();
   int32 lastgoodrunindex=runindex;
   char actbase=' ';
@@ -2145,21 +2731,18 @@ bool DataProcessing::searchPolyBaseFrom5Prime(Read & actread, const char polybas
 /*************************************************************************
  *
  * Search poly-base (mincount length and maximum maxbad other bases) from left
- *  side of read (with 'grace' length grace if not encountered),
+ *  side of read (with 'grace' length grace if not encountered), 
  *
- *  return:
+ *  return: 
  *    - true if found and return left and right coordinates in lpolystart and
  *      rpolyend
  *    - false if not found (lpolystart and rpolyend undefined)
  *
- * TODO: how dumb to have an own function instead of a templated function
- *       shared with 5p and working on iterators
- *
  *************************************************************************/
 //#define CEBUG(bla)   {cout << bla; cout.flush();}
-bool DataProcessing::searchPolyBaseFrom3Prime(Read & actread, const char polybase, int32 & lpolystart, int32 & rpolyend, const uint32 mincount, const uint32 maxbad, int32 grace)
+bool Assembly::searchPolyBaseFrom3Prime(Read & actread, const char polybase, int32 & lpolystart, int32 & rpolyend, const uint32 mincount, const uint32 maxbad, int32 grace)
 {
-  FUNCSTART("bool DataProcessing::searchPolyBaseFrom3Prime(Read & actread, const char polybase, int32 & lpolystart, int32 & rpolyend, const uint32 mincount, const uint32 maxbad, int32 grace)");
+  FUNCSTART("bool Assembly::searchPolyBaseFrom3Prime(Read & actread, const char polybase, int32 & lpolystart, int32 & rpolyend, const uint32 mincount, const uint32 maxbad, const int32 grace)");
 
 
   BUGIFTHROW(!dptools::isValidACGTBase(polybase),"Ummm ... " << polybase << " is not ACGT?");
@@ -2171,7 +2754,7 @@ bool DataProcessing::searchPolyBaseFrom3Prime(Read & actread, const char polybas
 
   lpolystart=-1;
   rpolyend=-1;
-
+	
 
   int32 runindex=actread.getRightClipoff()-1;
   int32 lastgoodrunindex=runindex;
@@ -2179,7 +2762,7 @@ bool DataProcessing::searchPolyBaseFrom3Prime(Read & actread, const char polybas
   bool found=false;
 
   CEBUG("Reverse " << actread.getName() << '\n');
-
+  
   for(; grace >=0 && runindex>=actread.getLeftClipoff(); --runindex, --grace) {
     actbase=static_cast<char>(tolower(actread.getBaseInSequence(runindex)));
     CEBUG("###1 : " << grace << " " << runindex << "\t" << actbase << endl);
@@ -2248,418 +2831,480 @@ bool DataProcessing::searchPolyBaseFrom3Prime(Read & actread, const char polybas
  *************************************************************************/
 
 //#define CEBUG(bla)   {cout << bla; cout.flush();}
-void DataProcessing::clipPolyBaseAtEnd_Pool(ReadPool & rp, const std::string & logprefix)
+void Assembly::clipPolyBaseAtEnd(const string & logname, const string & logprefix)
 {
-  FUNCSTART("void DataProcessing::clipPolyBaseAtEnd_Pool(ReadPool & rpool, const std::string & logprefix)");
+  FUNCSTART("void Assembly::clipPolyBaseAtEnd(const string & logname, const string & logprefix)");
 
   cout << "Clipping dubious poly-base stretches at end of reads ... ";
   cout.flush();
 
-  for(uint32 actid=0; actid < rp.size(); ++actid){
-    Read & actread = rp[actid];
-    if(actread.hasValidData()
-       && !(actread.isBackbone() || actread.isRail())){
-      if((*DP_miraparams_ptr)[actread.getSequencingType()].getAssemblyParams().as_clip_3ppolybase_len){
-	clipPolyBaseAtEnd_Read(actread,logprefix);
-      }
+  Read::setCoutType(Read::AS_TEXTSHORT);
+
+  ofstream logfout;
+  if(!logname.empty()){
+    logfout.open(logname.c_str(), ios::out|ios::app);
+    if(!logfout){
+      MIRANOTIFY(Notify::FATAL, "Could not open log for appending: " << logname);
     }
   }
-}
-
 
-void DataProcessing::clipPolyBaseAtEnd_Read(Read & actread, const std::string & logprefix)
-{
-  FUNCSTART("void DataProcessing::clipPolyBaseAtEnd_Read(Read & actread, const std::string & logprefix)");
+  vector<uint32> countvec(128,0);
 
-  assembly_parameters const & as_params= (*DP_miraparams_ptr)[actread.getSequencingType()].getAssemblyParams();
-  CEBUG(actread.getName() << endl);
+  for(uint32 actid=0; actid < AS_readpool.size(); actid++){
+    Read & actread = AS_readpool.getRead(actid);
+    if(actread.hasValidData()
+       && !(actread.isBackbone() || actread.isRail())){
 
-  uint32 mincount=as_params.as_clip_3ppolybase_len;
-  if(mincount==0){
-    MIRANOTIFY(Notify::FATAL, "-AS:c3ppmsl may not be 0");
-  }
-  if(actread.getLenClippedSeq() < mincount) return;
+      assembly_parameters const & as_params= AS_miraparams[actread.getSequencingType()].getAssemblyParams();
+      if(!as_params.as_clip_3ppolybase_len) continue;
 
-  uint32 maxbad=as_params.as_clip_3ppolybase_maxerrors;
-  int32 grace=static_cast<int32>(as_params.as_clip_3ppolybase_maxgap);
+      CEBUG(actread.getName() << endl);
 
-  // first guess which base might be a polybase
-  //
-  // count occurences of bases in last (mincount+grace or mincount?) positions of read
-  // the largest count >=30% of real bases (no 'n') wins
+      uint32 mincount=as_params.as_clip_3ppolybase_len;
+      uint32 maxbad=as_params.as_clip_3ppolybase_maxerrors;
+      int32 grace=static_cast<int32>(as_params.as_clip_3ppolybase_maxgap);
 
-  Read::setCoutType(Read::AS_FASTA);
-  CEBUG(actread << endl);
-  Read::setCoutType(Read::AS_TEXTSHORT);
-  CEBUG(actread << endl);
+      if(mincount==0){
+	MIRANOTIFY(Notify::FATAL, "-AS:c3ppmsl may not be 0");
+      }
 
-  DP_tmpau32_128['a']=0;
-  DP_tmpau32_128['c']=0;
-  DP_tmpau32_128['g']=0;
-  DP_tmpau32_128['n']=0;
-  DP_tmpau32_128['t']=0;
+      // first guess which base might be a polybase
+      //
+      // count occurences of bases in last (mincount+grace or mincount?) positions of read
+      // the largest count >=30% of real bases (no 'n') wins 
+
+      if(actread.getLenClippedSeq() < mincount) continue;
+
+      Read::setCoutType(Read::AS_FASTA);
+      CEBUG(actread << endl);
+      Read::setCoutType(Read::AS_TEXTSHORT);
+      CEBUG(actread << endl);
+
+      countvec['a']=0;
+      countvec['c']=0;
+      countvec['g']=0;
+      countvec['n']=0;
+      countvec['t']=0;
+      
+      int32 runindex=actread.getRightClipoff()-1;
+      for(uint32 ri=0; ri<mincount && runindex>=actread.getLeftClipoff(); --runindex, ++ri) {
+	char actbase=static_cast<char>(tolower(actread.getBaseInSequence(runindex)));
+	++countvec[actbase];
+      }
 
-  int32 runindex=actread.getRightClipoff()-1;
-  for(uint32 ri=0; ri<mincount && runindex>=actread.getLeftClipoff(); --runindex, ++ri) {
-    char actbase=static_cast<char>(tolower(actread.getBaseInSequence(runindex)));
-    ++DP_tmpau32_128[actbase];
-  }
+      CEBUG("CV: " << countvec['a'] << " " << countvec['c'] << " " << countvec['g'] << " " << countvec['t'] << endl);
 
-  CEBUG("CV: " << DP_tmpau32_128['a'] << " " << DP_tmpau32_128['c'] << " " << DP_tmpau32_128['g'] << " " << DP_tmpau32_128['t'] << endl);
+      uint32 realbases=countvec['a']+countvec['c']+countvec['g']+countvec['t'];
+      uint32 maxreal=max(countvec['a'],max(countvec['c'],max(countvec['g'],countvec['t'])));
 
-  uint32 realbases=DP_tmpau32_128['a']+DP_tmpau32_128['c']+DP_tmpau32_128['g']+DP_tmpau32_128['t'];
-  uint32 maxreal=max(DP_tmpau32_128['a'],max(DP_tmpau32_128['c'],max(DP_tmpau32_128['g'],DP_tmpau32_128['t'])));
+      CEBUG("RB: " << realbases << "\tMR: " << maxreal << endl);
 
-  CEBUG("RB: " << realbases << "\tMR: " << maxreal << endl);
+      char tentativepolybase='?';
+      if(realbases>0 && 100*maxreal/realbases >= 30){
+	CEBUG("MRThresh\n");
+	for(uint32 testi=0; testi<4; ++testi){
+	  if(countvec["acgt"[testi]]==maxreal){
+	    CEBUG("MRThreshHit\n");
+	    tentativepolybase="acgt"[testi];
+	    break;
+	  }
+	}
+      }
 
-  char tentativepolybase='?';
-  if(realbases>0 && 100*maxreal/realbases >= 30){
-    CEBUG("MRThresh\n");
-    for(uint32 testi=0; testi<4; ++testi){
-      if(DP_tmpau32_128["acgt"[testi]]==maxreal){
-	CEBUG("MRThreshHit\n");
-	tentativepolybase="acgt"[testi];
-	break;
+      // so, if a tentative polybase was found, try to find some clips and clip if found
+
+      if(tentativepolybase!='?') {
+	int32 lpolystart=-1;
+	int32 rpolyend=-1;
+	CEBUG("looking...\n");
+	if(searchPolyBaseFrom3Prime(actread,tentativepolybase,lpolystart,rpolyend,mincount,maxbad,grace)){
+	  actread.setRMClipoff(lpolystart);
+	  CEBUG("setting rm " << lpolystart << endl);
+	  
+	  if(!logname.empty()){
+	    logfout << logprefix << " poly-base " << tentativepolybase << " at end " 
+		    << actread.getName() 
+		    << "\tMask right: "
+		    << actread.getRMClipoff()
+		    << '\n';
+	  }
+	}	
       }
     }
   }
 
-  // so, if a tentative polybase was found, try to find some clips and clip if found
-
-  if(tentativepolybase!='?') {
-    int32 lpolystart=-1;
-    int32 rpolyend=-1;
-    CEBUG("looking...\n");
-    if(searchPolyBaseFrom3Prime(actread,tentativepolybase,lpolystart,rpolyend,mincount,maxbad,grace)){
-      actread.setRMClipoff(lpolystart);
-      CEBUG("setting rm " << lpolystart << endl);
+  cout << "done.\n";
 
-      DP_logfout << logprefix << " poly-base " << tentativepolybase << " at end "
-		 << actread.getName()
-		 << "\tMask right: "
-		 << actread.getRMClipoff()
-		 << '\n';
-    }
-  }
+  FUNCEND();
 }
 //#define CEBUG(bla)
 
 
 /*************************************************************************
  *
+ * splits a sequence into overlapping subsequences
  *
+ * AND
  *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-void DataProcessing::adaptorRightClip_Pool(ReadPool & rp, const std::string & logprefix)
-{
-  FUNCSTART("void DataProcessing::adaptorRightClip_Pool(ReadPool & rpool, const std::string & logprefix)");
-
-  cout << "Searching for sequencing adaptors.\n";
-  cout.flush();
-
-  for(uint32 actid=0; actid < rp.size(); ++actid){
-    Read & actread = rp[actid];
-    if(actread.hasValidData()
-       && !(actread.isBackbone() || actread.isRail())){
-      adaptorRightClip_Read(actread,logprefix);
-    }
-  }
-}
-
-void DataProcessing::adaptorRightClip_Read(Read & actread, const std::string & logprefix)
-{
-  FUNCSTART("void DataProcessing::adaptorRightClip_Read(Read & actread, const std::string & logprefix)");
-
-  priv_EnsureAdapRegexes(actread.getReadGroupID());
-  BUGIFTHROW(actread.getReadGroupID().getLibId()>=DP_adapres.size(),"Huh? no re lib " << actread.getReadGroupID().getLibId());
-
-  priv_EnsureAdapSkims(actread.getReadGroupID());
-
-  //assembly_parameters const & as_params= (*DP_miraparams_ptr)[actread.getSequencingType()].getAssemblyParams();
-  auto oldrsclip=actread.getRSClipoff();
-  auto newclip=-1;
-  if(DP_adapskims[actread.getReadGroupID().getLibId()].skimptr==nullptr){
-    cout << "Bah? nullptr for " << actread.getReadGroupID().getLibId() << "?" << endl;
-    return;
-  }
-  readid_t ridadapfound=-1;
-  if(DP_adapskims[actread.getReadGroupID().getLibId()].skimptr){
-    newclip=DP_adapskims[actread.getReadGroupID().getLibId()].skimptr->findAdaptorRightClip(actread,9,ridadapfound,DP_threadid);
-  }
-  if(newclip>=0){
-    ++DP_stats.cadapright;
-    actread.setRSClipoff(newclip);
-    DP_logfout << logprefix << " "
-	       << ReadGroupLib::getNameOfSequencingType(actread.getSequencingType())
-	       << " adaptor: ";
-    if(ridadapfound>=0) {
-      DP_logfout << DP_adapskims[actread.getReadGroupID().getLibId()].poolptr->getRead(ridadapfound).getName() << " in ";
-    }
-    DP_logfout << actread.getName()
-	       << " changed right clip from " << oldrsclip << " to " << newclip << "\n";
-  }else{
-    string seq(actread.getSeqAsChar());
-    boost::to_upper(seq);
-
-    boost::match_results<std::string::const_iterator> what;
-    boost::match_flag_type flags = boost::match_default;
-    std::string::const_iterator start, end;
-
-    for(auto & msre : DP_adapres[actread.getReadGroupID().getLibId()].adapres){
-      bool dosearch=true;
-      if(msre.hasmaster){
-	if(!regex_search(start, end, what, msre.masterre, flags)) {
-	  dosearch=false;
-	}
-      }
-      bool breakit=false;
-      if(dosearch){
-	for(auto & thisre : msre.slaveres){
-	  start = seq.begin();
-	  end = seq.end();
-	  if(regex_search(start, end, what, thisre, flags)) {
-	    if(what.position()< oldrsclip){
-	      ++DP_stats.cadaprightpartial;
-	      actread.setRSClipoff(what.position());
-	      DP_logfout << logprefix << " "
-			 << ReadGroupLib::getNameOfSequencingType(actread.getSequencingType())
-			 << " partial end adaptor: " << actread.getName()
-			 << " changed right clip from " << oldrsclip << " to " << what.position() << "\n";
-	      breakit=true;
-	      break;
-	    }
-	  }
-	}
-      }
-      if(breakit) break;
-    }
-  }
-}
-
-
-/*************************************************************************
+ * saves pre-computed adsfacts file into log directory for later
+ *  later reading
+ * number of generated adsfacts is put in AS_numADSFacts_fromshreds
  *
  *
+ * This saves enormous amount of time, but is not the "real" thing:
+ *  matches between shreds that are non-overlapping from the start on are
+ *  not made
  *
  *************************************************************************/
 
-void DataProcessing::seqMatchPhiX174_Read(Read & actread, const std::string & logprefix, bool filter)
-{
-  FUNCSTART("void DataProcessing::seqMatchPhiX174_Read(Read & actread, const std::string & logprefix)");
-
-  BUGIFTHROW(!DP_px174hs_init,"Phi X 174 search structure not initialised.");
-
-  auto numbaithits=DP_phix174hashstatistics.checkBaitHit(actread,DP_baiting_singlereadvhraparray,DP_baiting_tagmaskvector,false);
-  if(numbaithits>10){
-    ++DP_stats.cphix174;
-    DP_logfout << logprefix << " "
-	       << ReadGroupLib::getNameOfSequencingType(actread.getSequencingType())
-	       << " phix174 in "
-	       << actread.getName()
-	       << " ... killed read\n";
-    if(filter) actread.setRSClipoff(0);
-  }
-}
-
-
-void DataProcessing::stdTreatmentPool_SingleThread(vector<MIRAParameters> & mp, DataProcessing & dp, ReadPool & rpool, vector<uint8> * debrisreasonptr, std::string & logprefix, bool progress, int32 fromid, int32 toid)
+/*
+void Assembly::shredReadsIntoReadPool(ReadPool & sourcepool, uint32 shredlen, uint32 shredoffsetinc, uint8 shredreadtype, const string & shredstrain)
 {
-  FUNCSTART("void DataProcessing::stdTreatmentPool_SingleThread(vector<MIRAParameters> & mp, DataProcessing & dp, ReadPool & rpool, std::string & logprefix, bool progress, int32 fromid, int32 toid)");
-
-  if(fromid<0) fromid=0;
-  if(toid<0) toid=rpool.size();
-  BUGIFTHROW(fromid>toid,"fromid>toid ?");
-  BUGIFTHROW(toid>rpool.size(),"toid>rpool.size()?");
-
-  unique_ptr<ProgressIndicator<int64> > pi;
-  if(progress) pi=std::unique_ptr<ProgressIndicator<int64>>(new ProgressIndicator<int64>(fromid,toid));
-  for(uint32 actid=fromid; actid < toid; ++actid){
-    if(progress) pi->increaseprogress();
-    Read & actread = rpool[actid];
-    if(actread.hasValidData()
-       && !(actread.isBackbone() || actread.isRail())){
-      priv_stp_helperDebris(mp,rpool,actread,actid,debrisreasonptr,Assembly::DEBRIS_SHORTONLOAD);
-
-      auto & asp = mp[actread.getSequencingType()].getAssemblyParams();
-
-      if(asp.as_search_phix174){
-	dp.seqMatchPhiX174_Read(actread,logprefix,asp.as_filter_phix174);
-	priv_stp_helperDebris(mp,rpool,actread,actid,debrisreasonptr,Assembly::DEBRIS_CLIP_PHIX174);
+  FUNCSTART("void Assembly::shredReadsIntoReadPool(ReadPool & sourcepool, uint32 shredlen, uint32 shredoffsetinc, uint8 shredreadtype, const string & shredstrain)");
+
+  AS_numADSFacts_fromshreds=0;
+  string adsfshredsfilename=AS_miraparams[0].getDirectoryParams().dir_tmp+"/shred.adsfacts";
+  ofstream adsfout;
+  adsfout.open((adsfshredsfilename+".adsfacts").c_str(), ios::out|ios::trunc);
+
+  deque<uint32> overlapfifo;
+
+  string shredseq;
+  shredseq.reserve(shredlen);
+  vector<base_quality_t> shredqual;
+  shredqual.reserve(shredlen+10);
+  string shredname;
+ 
+  for(uint32 actsourceid=0; actsourceid < sourcepool.size(); actsourceid++){
+    Read & sourceread = sourcepool.getRead(actsourceid);
+    if(!sourceread.hasValidData()) continue;
+    if(sourceread.getLenSeq() < shredlen) continue;
+
+    uint32 actoffset=0;
+    uint32 shredcounter=0;
+    for(bool doloop=true; doloop; actoffset+=shredoffsetinc){
+      uint32 fromi=actoffset;
+      uint32 toi=actoffset+shredlen;
+      if(toi>=sourceread.getLenSeq()) {
+	toi=sourceread.getLenSeq();
+	doloop=false;
       }
-      if(asp.as_clip_knownadaptorsright){
-	dp.adaptorRightClip_Read(actread,logprefix);
-	priv_stp_helperDebris(mp,rpool,actread,actid,debrisreasonptr,Assembly::DEBRIS_CLIP_KNOWNADAPTORRIGHT);
+      shredseq.clear();
+      shredqual.clear();
+      for(; fromi<toi; fromi++){
+	shredseq+=sourceread.getBaseInSequence(fromi);
+	shredqual.push_back(sourceread.getQualityInSequence(fromi));
       }
-      // do the clip for bad solexa ends after adaptor clip
-      // reason: in quite a number of illumina reads, one has
-      //     xxxxxxxx - ADAPTOR - AAAAAAAAAAA...AAAAAAAAAAA - junk
-      // removing the adaptor first helps to keep the "xxxxxxxx" part
-      //  as the bad solexa ends kill the reads completely :-(
-      if(asp.as_clip_badsolexaends && actread.isSequencingType(ReadGroupLib::SEQTYPE_SOLEXA)){
-	dp.clipBadSolexaEnds_Read(actread,logprefix);
-	priv_stp_helperDebris(mp,rpool,actread,actid,debrisreasonptr,Assembly::DEBRIS_CLIP_BADSOLEXAEND);
-      }
-      if(asp.as_clip_lowercase_front){
-	dp.lowerCaseClippingFront_Read(actread,logprefix);
-	priv_stp_helperDebris(mp,rpool,actread,actid,debrisreasonptr,Assembly::DEBRIS_CLIP_LOWERCASEFRONT);
-      }
-      if(asp.as_clip_lowercase_back){
-	dp.lowerCaseClippingBack_Read(actread,logprefix);
-	priv_stp_helperDebris(mp,rpool,actread,actid,debrisreasonptr,Assembly::DEBRIS_CLIP_LOWERCASEBACK);
-      }
-      if(asp.as_clip_quality_minthreshold){
-	dp.minimumQualityThreshold_Read(actread,logprefix);
-	priv_stp_helperDebris(mp,rpool,actread,actid,debrisreasonptr,Assembly::DEBRIS_CLIP_QUALMINTHRESHOLD);
-      }
-      if(asp.as_clip_quality){
-	dp.qualClips_Read(actread,logprefix);
-	priv_stp_helperDebris(mp,rpool,actread,actid,debrisreasonptr,Assembly::DEBRIS_CLIP_QUALCLIPS);
-      }
-      if(asp.as_clip_maskedbases){
-	dp.maskClips_Read(actread,logprefix);
-	priv_stp_helperDebris(mp,rpool,actread,actid,debrisreasonptr,Assembly::DEBRIS_CLIP_MASKEDBASES);
-      }
-      bool mlc=asp.as_clip_ensureminimumleftclipoff;
-      if(asp.as_clip_badstretchquality){
-	if(mlc){
-	  dp.maskClips_Read(actread,logprefix);
-	  mlc=false;
-	  priv_stp_helperDebris(mp,rpool,actread,actid,debrisreasonptr,Assembly::DEBRIS_CLIP_MASKEDBASES);
+
+      // if wished: lower quals to max as_cap454consensusqual
+      if(AS_miraparams[0].getAssemblyParams().as_cap454consensusqual>0){
+	vector<base_quality_t>::iterator qI=shredqual.begin();
+	base_quality_t maxqual=AS_miraparams[0].getAssemblyParams().as_cap454consensusqual;
+	for(;qI != shredqual.end(); qI++){
+	  if(*qI>maxqual) *qI=maxqual;
 	}
-	dp.badSequenceSearch_Read(actread,logprefix);
-	priv_stp_helperDebris(mp,rpool,actread,actid,debrisreasonptr,Assembly::DEBRIS_CLIP_BADSEQUENCESERACH);
-      }
-      if(asp.as_clip_3ppolybase){
-	dp.clipPolyBaseAtEnd_Read(actread,logprefix);
-	priv_stp_helperDebris(mp,rpool,actread,actid,debrisreasonptr,Assembly::DEBRIS_CLIP_POLYBASEATEND);
       }
-      if(asp.as_clip_polyat){
-	dp.clipPolyATAtEnds_Read(actread,logprefix);
-	priv_stp_helperDebris(mp,rpool,actread,actid,debrisreasonptr,Assembly::DEBRIS_CLIP_POLYAT);
-      }
-      if(mlc){
-	dp.minimumLeftClip_Read(actread,logprefix,true,false,false);
-	priv_stp_helperDebris(mp,rpool,actread,actid,debrisreasonptr,Assembly::DEBRIS_CLIP_MINLEFTCLIP);
-      }
-      if(asp.as_clip_ensureminimumrightclipoff){
-	dp.minimumRightClip_Read(actread,logprefix,false,true,false);
-	priv_stp_helperDebris(mp,rpool,actread,actid,debrisreasonptr,Assembly::DEBRIS_CLIP_MINRIGHTCLIP);
+
+      ostringstream ostr;
+      ostr << "shred_" << shredcounter << "_" << sourceread.getName();
+      shredname=ostr.str();
+
+      AS_readpool.addNewEmptyRead();
+      uint32 newreadid=AS_readpool.size()-1;
+      Read & newread=AS_readpool.getRead(newreadid);
+      newread.setName(shredname);
+      newread.setSequenceFromString(shredseq);
+      newread.setQualities(shredqual);
+      newread.setStrain(shredstrain.c_str());
+      newread.setSequencingType(shredreadtype);
+
+      //cout << "\n----------------------------------------\nAdded " << shredname << '\n';
+      // now insert the weights
+      {
+	overlapfifo.push_front(newreadid);
+	deque<uint32>::iterator OFI=overlapfifo.begin();
+	OFI++;
+	int32 overlaplen=shredlen-shredoffsetinc;
+	int32 totalshredoffset=shredoffsetinc;
+	uint32 numelements=1;
+	while(OFI != overlapfifo.end()) {
+	  if(overlaplen<=0) break;
+
+	  AlignedDualSeqFacts tmpadsf;
+	  tmpadsf.publicinit(
+	    *OFI,
+	    newreadid,
+	    static_cast<uint16>(totalshredoffset),
+	    static_cast<uint16>(totalshredoffset
+				-(AS_readpool.getRead(*OFI).getLenSeq()
+				  -AS_readpool.getRead(newreadid).getLenSeq())),
+	    0,
+	    static_cast<uint16>((AS_readpool.getRead(*OFI).getLenSeq()+
+				 AS_readpool.getRead(newreadid).getLenSeq()-overlaplen)),
+	    1,
+	    1,
+	    100);
+	  
+	  // output of the ADSfacts to file
+	  // TODO: real ouput
+	  // first weight and direction 
+	  // TODO: reduce weight to favorise real reads in assembly???
+	  adsfout << overlaplen*10000 << "\t1\t";
+	  tmpadsf.serialiseOut(adsfout);
+	  adsfout << '\n';
+
+	  AS_numADSFacts_fromshreds++;
+  
+	  OFI++;
+	  overlaplen-=shredoffsetinc;
+	  totalshredoffset+=shredoffsetinc;
+	  numelements++;
+	}
+	if(overlapfifo.size()>numelements) overlapfifo.resize(numelements);
       }
+      shredcounter++;
     }
+    cout << "Shredded " << sourceread.getName() << " into " << shredcounter << " pieces.\n";
   }
-  if(progress) pi->finishAtOnce();
-}
 
-void DataProcessing::priv_stp_helperDebris(vector<MIRAParameters> & mp, ReadPool & rpool, Read & actread, int32 rid, vector<uint8> * debrisreasonptr, uint8 reason)
-{
-  FUNCSTART("void DataProcessing::priv_stp_helperDebris(ReadPool & rpool, Read & actread, int32 rid, vector<uint8> * debrisreasonptr, uint8 reason)");
+  adsfout.close();
 
-  if(debrisreasonptr == nullptr) return;
-  if(debrisreasonptr->empty()) return;
-  BUGIFTHROW(rid>=debrisreasonptr->size(),"rid " << rid << " >= debrisreasonptr->size() " << debrisreasonptr->size());
-  if(actread.getLenClippedSeq() < mp[actread.getSequencingType()].getAssemblyParams().as_minimum_readlength){
-    if((*debrisreasonptr)[rid]==0) (*debrisreasonptr)[rid]=reason;
-  }
+  FUNCEND();
 }
+*/
 
 
-void DataProcessing::stdTreatmentPool_MultiThread(std::vector<MIRAParameters> & mp, DataProcessing & dpcollector, vector<unique_ptr<DataProcessing>> & dpv, ReadPool & rpool, vector<uint8> * debrisreasonptr, std::string & logprefix, bool progress, int32 fromid, int32 toid)
-{
-  FUNCSTART("void DataProcessing::stdTreatmentPool_MultiThread(vector<DataProcessing> & dpv, ReadPool & rpool, std::string & logprefix, bool progress)");
-
-  if(fromid<0) fromid=0;
-  if(toid<0) toid=rpool.size();
-  BUGIFTHROW(dpv.empty(),"dpv.empty() ?");
-  BUGIFTHROW(fromid>toid,"fromid>toid ?");
-  BUGIFTHROW(toid>rpool.size(),"toid>rpool.size()?");
-
-  dpv[0]->priv_EnsurePhiX174Statistics();
-
-  threadsharecontrol_t tsc;
-
-  tsc.from=fromid;
-  tsc.to=toid;
-  tsc.todo=fromid;
-  tsc.done=fromid;
-  tsc.stepping=1000;
-
-  uint32 numthreads=dpv.size();
-  boost::thread_group workerthreads;
-  for(uint32 ti=0; ti<numthreads;++ti){
-    dpv[ti]->setThreadID(ti);
-    workerthreads.create_thread(boost::bind(&DataProcessing::priv_stdTreatmentThread, ti, &tsc, &mp, &(*dpv[ti]), &rpool, debrisreasonptr, &logprefix));
-  }
+#define CEBUG(bla)   {cout << bla; cout.flush();}
 
-  ProgressIndicator<int64> pi(fromid,toid);
-  while(tsc.done!=toid){
-    pi.progress(tsc.done);
-    sleep(1);
+void Assembly::analyseOverlapHashProfile(vector<uint8> & profile, vector<skimedges_t>::const_iterator seI, ADSEstimator & adse)
+{
+  vector<uint32> longeststretch(7,0);
+  vector<uint32> currentstretch(7,0);
+
+  for(size_t pi=0; pi<profile.size(); pi++){
+    //CEBUG(pi << '\t' << static_cast<uint16>(profile[pi]) << '\n');
+    for(size_t si=0; si<7; si++){
+      if(si==profile[pi]){
+	currentstretch[si]++;
+	if(currentstretch[si]>longeststretch[si]) longeststretch[si]=currentstretch[si];
+      }else{
+	currentstretch[si]=0;
+      }
+    }
   }
-  pi.finishAtOnce(cout);
 
-  // they normally should all have exited at this point, but be nice and play by the rules
-  workerthreads.join_all();
+  if(longeststretch[3]<5){
+    if(AS_skimstaken[seI->skimindex]==true){
+      cout << "Remove seI: " << *seI;
+      cout << "stretches:\n";
+      for(size_t si=0; si<7; si++){
+	cout << si << ' ' << longeststretch[si] << endl;
+      }
 
-  // collect all stats
-  for(auto & dpvp : dpv){
-    dpcollector.DP_stats.cphix174+=dpvp->DP_stats.cphix174;
-    dpcollector.DP_stats.cadapright+=dpvp->DP_stats.cadapright;
-    dpcollector.DP_stats.cadaprightpartial+=dpvp->DP_stats.cadaprightpartial;
+      AS_skimstaken[seI->skimindex]=false;
+      AS_numskimoverlaps[seI->rid1]--;
+      AS_numskimoverlaps[seI->linked_with]--;
+    }
   }
 }
 
+#define CEBUG(bla)
 
-void DataProcessing::priv_stdTreatmentThread(uint32 threadnum, threadsharecontrol_t * tscptr, vector<MIRAParameters> * mpptr, DataProcessing * dpptr, ReadPool * rpoolptr, vector<uint8> * debrisreasonptr, std::string * logprefixptr)
-{
-  FUNCSTART("void DataProcessing::priv_stdTreatmentThread(uint32 threadnum, threadsharecontrol_t * tscptr, DataProcessing * dpptr, ReadPool * rpoolptr, std::string * logprefixptr)");
 
-  try{
-    int32 from;
-    int32 to;
-    while(true){
-      {
-	boost::mutex::scoped_lock lock(tscptr->accessmutex);
-	if(tscptr->todo >= tscptr->to) break;
-	from=tscptr->todo;
-	tscptr->todo+=tscptr->stepping;
-	if(tscptr->todo > tscptr->to) tscptr->todo = tscptr->to;
-	to=tscptr->todo;
-      }
-      stdTreatmentPool_SingleThread(*mpptr, *dpptr,*rpoolptr,debrisreasonptr,*logprefixptr,false,from,to);
-      {
-	boost::mutex::scoped_lock lock(tscptr->accessmutex);
-	tscptr->done+=tscptr->stepping;
-	if(tscptr->done > tscptr->to) tscptr->done=tscptr->to;
-      }
-    }
-  }
-  catch(Notify n){
-    n.handleError(THISFUNC);
-  }
-}
 
 
-// explicit template instantiations needed for the linker to create these for library files
-template void DataProcessing::performDigitalNormalisation_Pool(ReadPool & rp, HashStatistics<vhash64_t> & hsd, vector<uint8> * debrisreasonptr);
-template uint32 DataProcessing::performSDBGChimeraSearch_Pool(ReadPool & rp, HashStatistics<vhash64_t> & hsd, uint32 trimfreq, vector<uint8> * debrisreasonptr, const string & logprefix);
-template bool DataProcessing::performSDBGChimeraSearch_Read(Read & actread, HashStatistics<vhash64_t> & hsd, const string & logprefix);
-template uint32 DataProcessing::performSDBGEdits_Pool(ReadPool & rp, HashStatistics<vhash64_t> & hsd, uint32 trimfreq);
-#ifndef KMER_INTERNALTYPE
-template void DataProcessing::performDigitalNormalisation_Pool(ReadPool & rp, HashStatistics<vhash128_t> & hsd, vector<uint8> * debrisreasonptr);
-template void DataProcessing::performDigitalNormalisation_Pool(ReadPool & rp, HashStatistics<vhash256_t> & hsd, vector<uint8> * debrisreasonptr);
-template void DataProcessing::performDigitalNormalisation_Pool(ReadPool & rp, HashStatistics<vhash512_t> & hsd, vector<uint8> * debrisreasonptr);
 
-template uint32 DataProcessing::performSDBGChimeraSearch_Pool(ReadPool & rp, HashStatistics<vhash128_t> & hsd, uint32 trimfreq, vector<uint8> * debrisreasonptr, const string & logprefix);
-template uint32 DataProcessing::performSDBGChimeraSearch_Pool(ReadPool & rp, HashStatistics<vhash256_t> & hsd, uint32 trimfreq, vector<uint8> * debrisreasonptr, const string & logprefix);
-template uint32 DataProcessing::performSDBGChimeraSearch_Pool(ReadPool & rp, HashStatistics<vhash512_t> & hsd, uint32 trimfreq, vector<uint8> * debrisreasonptr, const string & logprefix);
 
-template bool DataProcessing::performSDBGChimeraSearch_Read(Read & actread, HashStatistics<vhash128_t> & hsd, const string & logprefix);
-template bool DataProcessing::performSDBGChimeraSearch_Read(Read & actread, HashStatistics<vhash256_t> & hsd, const string & logprefix);
-template bool DataProcessing::performSDBGChimeraSearch_Read(Read & actread, HashStatistics<vhash512_t> & hsd, const string & logprefix);
+/////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////
+/////////////////////////        Obsolete         ///////////////////////
+/////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////
+
+
+
+///*************************************************************************
+// *
+// *
+// *
+// *
+// *************************************************************************/
+//
+//void Assembly::clipTo200()
+//{
+//  FUNCSTART("void Assembly::clipTo200()");
+//
+//  cout << "200 clipper. Test function! Mail the authors if you can read this!\n";
+//
+//  for(uint32 i=0;i<AS_readpool.size();i++){
+//    Read & theread = AS_readpool.getRead(i);
+//    if(theread.hasValidData()==true){
+//      //     cout << "Len: " << theread.getLenClippedSeq() << endl;
+//      if(theread.getLenClippedSeq()>250){
+//	theread.setCoutType(Read::AS_TEXT);
+//	//	cout << "Clipping ... \n" << theread;
+//	theread.setClipoffs(theread.getLeftClipoff(), 
+//			    theread.getLeftClipoff()+250, 
+//			    false);
+//	//	cout << "clipped ... \n" << theread;
+//      }
+//    }
+//  }
+//
+//  FUNCEND()
+//}
+//
+//
+//
+///*************************************************************************
+// *
+// * expects reads to have baseflags set  (by performHashAnalysis())
+// *
+// * doesn't seem to be a good idea
+// *
+// *************************************************************************/
+//
+////#define CEBUG(bla)   {cout << bla; cout.flush();}
+//
+//void Assembly::performHashEditing()
+//{
+//  FUNCSTART("void Assembly::performHashEditing()");
+//
+//  cout << "Hash analysis for editing:";
+//
+//  skim_parameters const & skim_params= AS_miraparams[0].getSkimParams();
+//  assembly_parameters const & as_fixparams= AS_miraparams[0].getAssemblyParams();
+//
+//  uint32 basesperhash=as_fixparams.as_clip_pec_basesperhash;
+//  if(sizeof(uint64) < 8 && basesperhash > 15) basesperhash=15;
+//  {
+//
+//    Skim s3;
+//
+//    s3.setHashFrequencyRatios(skim_params.sk_freqest_minnormal,
+//			      skim_params.sk_freqest_maxnormal,
+//			      skim_params.sk_freqest_repeat,
+//			      skim_params.sk_freqest_heavyrepeat,
+//			      skim_params.sk_freqest_crazyrepeat,
+//			      skim_params.sk_nastyrepeatratio);
+//
+//    s3.analyseHashes(AS_miraparams[0].getDirectoryParams().dir_tmp,
+//		     AS_readpool,
+//		     true,
+//		     false,
+//		     false,
+//		     true,
+//		     1,
+//		     basesperhash,
+//		     1,
+//		     false);
+//  }
+//
+//  if(as_fixparams.as_dateoutput) dateStamp(cout);
+//  cout << '\n';
+//
+//  cout << "Looking for proposed edits ... "; cout.flush();
+//
+//  vector<uint8> maxhf;
+//  maxhf.reserve(10000);
+//
+//  uint64 numbaseschanged=0;
+//  uint64 numreadschanged=0;
+//
+//  for(uint32 actid=0; actid<AS_readpool.size(); actid++){
+//    Read & r=AS_readpool.getRead(actid);
+//    
+//    if(r.hasValidData()
+//       && r.hasBaseHashStats()
+//       && !(r.isBackbone() 
+//	    || r.isRail())){
+//
+//      maxhf.clear();
+//      maxhf.resize(r.getLenSeq(),0);
+//
+//      bool wasedited=false;
+//
+//      {
+//	int32 lpos=r.getLeftClipoff();
+//	vector<Read::bposhashstat_t>::const_iterator bhsI=r.getBPosHashStats().begin();
+//	vector<uint8>::iterator mhfI=maxhf.begin();
+//	advance(bhsI,lpos);
+//	advance(mhfI,lpos);
+//
+//	uint32 counter=basesperhash;
+//	for(; lpos<static_cast<int32>(r.getLenSeq()); lpos++, bhsI++, mhfI++) {
+//	  *mhfI=(bhsI->fwd.getFrequency())>1;
+//	  if(*mhfI) counter=basesperhash;
+//	  if(counter) {
+//	    *mhfI=4;
+//	    --counter;
+//	  }
+//	}
+//
+//	lpos=r.getLeftClipoff();
+//	mhfI=maxhf.begin();
+//	advance(mhfI,lpos);
+//
+//	//for(; lpos<static_cast<int32>(r.getLenSeq()); lpos++) {
+//	//  cout << (uint16) maxhf[lpos] << ' ';
+//	//}
+//	//cout << endl;
+//	//lpos=r.getLeftClipoff();
+//	//for(; lpos<static_cast<int32>(r.getLenSeq()); lpos++) {
+//	//  cout << r.getBaseInSequence(lpos) << ' ';
+//	//}
+//	//cout << endl;
+//	//Read::setCoutType(Read::AS_TEXT);
+//	//cout << r;
+//
+//	lpos=r.getLeftClipoff();
+//	for(; lpos<static_cast<int32>(r.getLenSeq()); lpos++, mhfI++) {
+//	  if(*mhfI) break;
+//	}
+//
+//	int32 editstart=-1;
+//	for(; lpos<static_cast<int32>(r.getLenSeq()); lpos++, mhfI++) {
+//	  if(editstart<0){
+//	    if(*mhfI==0) {
+//	      editstart=lpos;
+//	    }
+//	  }else{
+//	    if(*mhfI) {
+//	      for(int32 ii=editstart; ii<lpos; ii++) {
+//		//editpositions.push_back(ii);
+//		r.changeBaseInSequence('n',0,ii);
+//		numbaseschanged++;
+//		wasedited=true;
+//	      }
+//	      editstart=-1;
+//	    }
+//	  }
+//	}
+//
+//      }
+//      if(wasedited) numreadschanged++;
+//
+//      //if(editpositions.size()){
+//      //	cout << r.getName() << ": wants to edit " << editpositions.size() << " positions\n";
+//      //}
+//    }
+//  }
+//
+//  cout << "changed " << numbaseschanged << " bases to 'n' in " << numreadschanged << " reads.\n";
+//
+//  FUNCEND();
+//
+//  return;
+//}
+////#define CEBUG(bla)
+
 
-template uint32 DataProcessing::performSDBGEdits_Pool(ReadPool & rp, HashStatistics<vhash128_t> & hsd, uint32 trimfreq);
-template uint32 DataProcessing::performSDBGEdits_Pool(ReadPool & rp, HashStatistics<vhash256_t> & hsd, uint32 trimfreq);
-template uint32 DataProcessing::performSDBGEdits_Pool(ReadPool & rp, HashStatistics<vhash512_t> & hsd, uint32 trimfreq);
-#endif
diff --git a/src/mira/dataprocessing.H b/src/mira/dataprocessing.H
deleted file mode 100644
index e291ced..0000000
--- a/src/mira/dataprocessing.H
+++ /dev/null
@@ -1,324 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 2013 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-#ifndef _bas_dataprocessing_h_
-#define _bas_dataprocessing_h_
-
-#include <iostream>
-
-#include "stdinc/defines.H"
-#include "errorhandling/errorhandling.H"
-
-#include "mira/hashstats.H"
-#include "mira/multitag.H"
-#include "mira/vhash.H"
-
-class MIRAParameters;
-class ReadPool;
-template<typename TVHASH_T> class Skim;
-
-#include <boost/regex.hpp>
-#include <boost/thread/thread.hpp>
-#include <boost/thread/mutex.hpp>
-
-
-
-// DataProcessing
-// One instatiated object should be used in one thread only, so do not share a DataProcessing
-//  object between several threads unless access is serialised by the threads
-// But each thread having it's own object is fine ... and meant to be that way.
-
-class DataProcessing
-{
-public:
-  struct dpstats_t {
-    uint32 cphix174;
-    uint32 cadapright;
-    uint32 cadaprightpartial;
-
-    dpstats_t() : cphix174(0), cadapright(0), cadaprightpartial(0) {};
-  };
-
-  dpstats_t DP_stats;
-
-  //Variables
-private:
-  struct poolskim_t {
-    ReadPool * poolptr;
-    Skim<vhash64_t> * skimptr;
-
-    poolskim_t() : poolptr(nullptr), skimptr(nullptr) {};
-    ~poolskim_t();
-  };
-
-  static std::vector<poolskim_t> DP_adapskims;
-  static boost::mutex DP_ps_changemutex;         // exclusive mutex for write access to DP_*skims, we need that as it's a static variable
-
-  static HashStatistics<vhash64_t> DP_phix174hashstatistics;
-  static bool DP_px174hs_init;
-  static boost::mutex DP_px174hs_changemutex;         // exclusive mutex for write access to hashstatistics, we need that as it's a static variable
-
-  // while Skim is thread safe in the adaptor search, the boost RegEx are not when using the same objects
-  // therefore, keep those per DataProcessing object and not static
-  // no mutex here as one DataProcessing object is meant to be used by one thread only
-  struct masterslavere_t {
-    boost::regex masterre;
-    std::list<boost::regex> slaveres;
-    bool hasmaster;
-
-    masterslavere_t(): hasmaster(false) {};
-  };
-  struct adapres_t {
-    std::list<masterslavere_t> adapres;
-    bool areinit;
-
-    adapres_t() : areinit(false) {}
-  };
-  std::vector<adapres_t> DP_adapres;
-
-
-
-  std::vector<MIRAParameters> * DP_miraparams_ptr;
-  int32 DP_threadid; // when using multi-threaded versions, this is the thread-id this object uses (-1==non-multi-threaded)
-
-  std::ofstream DP_logfout;
-  std::string DP_logname;
-
-
-  struct threadsharecontrol_t {
-    boost::mutex accessmutex;
-    int32 from;
-    int32 to;
-    int32 todo;
-    int32 done;
-    int32 stepping;
-  };
-
-  // For multithreaded baiting within a single HashStatistics object (e.g. Phi X 174 search)
-
-  typename std::vector<typename HashStatistics<vhash64_t>::vhrap_t> DP_baiting_singlereadvhraparray;
-  std::vector<uint8>   DP_baiting_tagmaskvector;
-
-
-  //
-  // TEMPS
-  //
-
-  // uint8 vector for temporary use
-  std::vector<uint8> DP_tmpvu8;
-
-  // uint32 array with 128 elements for temporary use
-  uint32 DP_tmpau32_128[128];
-
-  // multitag with SOFA poly AT signature for temporary use
-  multitag_t DP_tmpmtpolyAT;
-
-
-public:
-
-
-  //functions
-private:
-  void init();
-  void zeroVars();
-
-  static bool priv_staticInitialiser();
-
-  void priv_EnsureAdapRegexes(ReadGroupLib::ReadGroupID rgid);
-  void addAdapRegexes(ReadGroupLib::ReadGroupID rgid, const char * regexfile);
-
-  void priv_EnsureAdapSkims(ReadGroupLib::ReadGroupID rgid);
-  void priv_EnsurePhiX174Statistics();
-  void priv_constructorSkimPool(ReadGroupLib::ReadGroupID rgid, std::vector<poolskim_t> & skimpool, const uint32 basesperhash, const char * adapfile);
-
-  void priv_buntifyHelper(uint8 allowedfreq,
-			  uint32 basesperhash,
-			  std::vector<Read::bposhashstat_t>::const_iterator bhsI,
-			  std::vector<Read::bposhashstat_t>::const_iterator bhsE,
-			  std::vector<uint8>::iterator tfI,
-			  std::vector<uint8>::iterator tfE);
-
-  bool searchPolyBaseFrom5Prime(Read & actread,
-				const char polybase,
-				int32 & lpolystart,
-				int32 & rpolyend,
-				const uint32 mincount,
-				const uint32 maxbad,
-				int32 grace);
-  bool searchPolyBaseFrom3Prime(Read & actread,
-				const char polybase,
-				int32 & lpolystart,
-				int32 & rpolyend,
-				const uint32 mincount,
-				const uint32 maxbad,
-				int32 grace);
-  static void priv_stdTreatmentThread(uint32 threadnum,
-				      threadsharecontrol_t * tscptr,
-				      std::vector<MIRAParameters> * mpptr,
-				      DataProcessing * dpptr,
-				      ReadPool * rpoolptr,
-				      std::vector<uint8> * debrisreasonptr,
-				      std::string * logprefixptr);
-
-  static void priv_stp_helperDebris(std::vector<MIRAParameters> & mp,
-				    ReadPool & rpool,
-				    Read & actread,
-				    int32 rid,
-				    std::vector<uint8> * debrisreasonptr,
-				    uint8 reason);
-
-public:
-  DataProcessing(std::vector<MIRAParameters> * params);
-  ~DataProcessing();
-
-  DataProcessing(DataProcessing const &other)=delete;
-  DataProcessing const & operator=(DataProcessing const & other)=delete;
-
-  friend std::ostream & operator<<(std::ostream &ostr, DataProcessing const &dp);
-
-  void discard();
-
-  void setThreadID(int32 id) {DP_threadid=id;};
-
-  void startLogging(const std::string & filename, bool newfile);
-  void stopLogging();
-
-  // Pool versions
-  // Take care of everything from MIRA parameters
-  //
-  // Read versions
-  // Perform the task unconditionally on the reads
-
-  void performRareKMERMasking_Pool(ReadPool & rpool, uint32 basesperhash, const std::string & logprefix);
-  void performRareKMERMasking_Read(Read & actread, uint32 basesperhash, const std::string & logprefix);
-
-  void performKMERRepeatTagging_Pool(ReadPool & rpool, uint32 basesperhash);
-  void performKMERRepeatTagging_Read(Read & actread, uint32 basesperhash);
-
-  void buntifyReadsByHashFreq_Pool(ReadPool & rpool, uint32 basesperhash);
-  void buntifyReadsByHashFreq_Read(Read & actread, uint32 basesperhash);
-
-  void addKMerForkTags_Pool(ReadPool & rp, uint32 basesperhash);
-
-  void clipBadSolexaEnds_Pool(ReadPool & rpool, const std::string & logprefix);
-  void clipBadSolexaEnds_Read(Read & actread, const std::string & logprefix);
-
-  void lowerCaseClipping_Pool(ReadPool & rpool, const std::string & logprefix);
-  void lowerCaseClippingFront_Read(Read & actread, const std::string & logprefix);
-  void lowerCaseClippingBack_Read(Read & actread, const std::string & logprefix);
-
-  void qualClips_Pool(ReadPool & rpool, const std::string & logprefix);
-  void qualClips_Read(Read & actread, const std::string & logprefix);
-
-  void maskClips_Pool(ReadPool & rpool, const std::string & logprefix);
-  void maskClips_Read(Read & actread, const std::string & logprefix, int32 gapsize=-1, int32 maxfrontgap=-1, int32 maxendgap=-1);
-
-  void minimumQualityThreshold_Pool(ReadPool & rpool, const std::string & logprefix);
-  bool minimumQualityThreshold_Read(Read & actread, const std::string & logprefix);
-
-  void minimumLeftClip_Pool(ReadPool & rp, const std::string & logprefix,
-			    bool qual, bool seqvec, bool mask);
-  void minimumLeftClip_Read(Read & actread, const std::string & logprefix,
-			    bool qual, bool seqvec, bool mask);
-
-  void minimumRightClip_Pool(ReadPool & rp, const std::string & logprefix,
-			     bool qual, bool seqvec, bool mask);
-  void minimumRightClip_Read(Read & actread, const std::string & logprefix,
-			     bool qual, bool seqvec, bool mask);
-
-  void badSequenceSearch_Pool(ReadPool & rpool, const std::string & logprefix);
-  void badSequenceSearch_Read(Read & actread, const std::string & logprefix);
-
-  void clipPolyATAtEnds_Pool(ReadPool & rpool, const std::string & logprefix);
-  void clipPolyATAtEnds_Read(Read & actread, const std::string & logprefix);
-
-  void clipPolyBaseAtEnd_Pool(ReadPool & rpool, const std::string & logprefix);
-  void clipPolyBaseAtEnd_Read(Read & actread, const std::string & logprefix);
-
-  void adaptorRightClip_Pool(ReadPool & rpool, const std::string & logprefix);
-  void adaptorRightClip_Read(Read & actread, const std::string & logprefix);
-
-  void seqMatchPhiX174_Read(Read & actread, const std::string & logprefix, bool filter);
-
-
-  uint32 markReadsWithInvalidKMerEndsAsChimeras_Pool(ReadPool & rp,
-						     uint32 basesperhash,
-						     bool killreads,
-						     std::vector<uint8> * debrisreasonptr,
-						     std::vector<uint8> & ischimera,
-						     std::vector<uint8> & nochimerakill,
-						     const std::string & logprefix);
-  bool checkReadForInvalidKMerEndsAsChimera(Read & actread,
-					    uint32 basesperhash);
-  uint32 markReadsWithRareKMersAsChimeras_Pool(ReadPool & rp,
-					       uint32 basesperhash,
-					       bool killreads,
-					       std::vector<uint8> * debrisreasonptr,
-					       std::vector<uint8> & ischimera,
-					       std::vector<uint8> & nochimerakill,
-					       const std::string & logprefix);
-  bool checkReadForRareKMersAsChimera(Read & actread,
-				      uint32 basesperhash);
-
-//  static void stdTreatmentPool_MultiThread(ReadPool & rpool);
-  static void stdTreatmentPool_SingleThread(std::vector<MIRAParameters> & mp,
-					    DataProcessing & dp,
-					    ReadPool & rpool,
-					    std::vector<uint8> * debrisreason,
-					    std::string & logprefix,
-					    bool oprogress,
-					    int32 fromid=-1,
-					    int32 toid=-1);
-  static void stdTreatmentPool_MultiThread(std::vector<MIRAParameters> & mp,
-					   DataProcessing & dpcollector,
-					   std::vector<std::unique_ptr<DataProcessing>> & dpv,
-					   ReadPool & rpool,
-					   std::vector<uint8> * debrisreasonptr,
-					   std::string & logprefix,
-					   bool progress,
-					   int32 fromid=-1,
-					   int32 toid=-1);
-
-  template<typename TVHASH_T>
-  static void performDigitalNormalisation_Pool(ReadPool & rp,
-					       HashStatistics<TVHASH_T> & hsd,
-					       std::vector<uint8> * debrisreasonptr);
-
-  template<typename TVHASH_T>
-  uint32 performSDBGChimeraSearch_Pool(ReadPool & rp,
-				       HashStatistics<TVHASH_T> & hsd,
-				       uint32 trimfreq,
-				       std::vector<uint8> * debrisreasonptr,
-				       const std::string & logprefix);
-  template<typename TVHASH_T>
-  bool performSDBGChimeraSearch_Read(Read & actread, HashStatistics<TVHASH_T> & hsd, const std::string & logprefix);
-
-  template<typename TVHASH_T>
-  uint32 performSDBGEdits_Pool(ReadPool & rp,
-			       HashStatistics<TVHASH_T> & hsd,
-			       uint32 trimfreq);
-};
-
-
-#endif
diff --git a/src/mira/dynamic.C b/src/mira/dynamic.C
index c5bb750..c4609bb 100644
--- a/src/mira/dynamic.C
+++ b/src/mira/dynamic.C
@@ -11,31 +11,29 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
+// 	$Id$	
 
-#include "dynamic.H"
-
-#include <mira/parameters.H>
-
-#include <climits>
 
-using namespace std;
+#ifndef lint
+static char vcid[] = "$Id$";
+#endif /* lint */
 
+#include "dynamic.H"
 
 //#define CEBUGFLAG
-#define CLOCK_STEPS1
 
 #ifdef CEBUGFLAG
 #define CEBUG(bla)   {cout << bla; cout.flush();}
@@ -47,6 +45,8 @@ using namespace std;
 
 
 
+
+
 #if __GNUC__ >= 3
 #define prefetchrs(p)     __builtin_prefetch((p), 0, 0)
 #define prefetchws(p)     __builtin_prefetch((p), 1, 0)
@@ -60,12 +60,26 @@ using namespace std;
 #endif
 
 
-uint64 Dynamic::DYN_alloccounts=0;
-uint64 Dynamic::DYN_alloccountm=0;
+
+
+
+
+
+uint64 Dynamic::DYN_alloccount=0;
 int16 Dynamic::DYN_matvalid=0;
 int32 Dynamic::DYN_match_matrix[DYN_MATSIZE][DYN_MATSIZE];
 
 
+//#define FUNCSTART(bla)  static const char * THISFUNC = bla"  ";  {cout << THISFUNC << "enter.\n"; cout.flush();}
+//#define FUNCTRACE(bla) { cout << THISFUNC << bla; cout.flush();}
+//#define FUNCEND()  {cout << THISFUNC << "exit.\n"; cout.flush();}
+
+void Dynamic::foolCompiler()
+{
+#include "stdinc/foolcompiler.C"
+}
+
+
 /*************************************************************************
  *
  *
@@ -121,23 +135,19 @@ void Dynamic::zeroVars()
 {
   FUNCSTART("void Dynamic::zeroVars()");
 
+  DYN_valid=0;
   DYN_maxscore=INT_MIN;
 
-  DYN_sequence1=nullptr;
-  DYN_sequence2=nullptr;
+  DYN_sequence1=NULL;
+  DYN_sequence2=NULL;
   DYN_s1size=0;
   DYN_s2size=0;
   DYN_knowngaps=0;
-  DYN_simmatrix=nullptr;
+  DYN_simmatrix=NULL;
   DYN_smsize=0;
-
-  DYN_validseq=false;
-  DYN_matrixcalculated=false;
   DYN_calcwithoffset=false;
   DYN_eoffset=0;
 
-  DYN_bandwidth=0;
-
   FUNCEND();
 }
 
@@ -508,9 +518,6 @@ void Dynamic::setSequences(const char * seq1, uint32 len1, const char * seq2, ui
 {
   FUNCSTART("Dynamic::setSequences(const char * seq1, uint32 len1, const char * seq2, uint32 len2, bool calcwithoffset, int32 expectedoffset)");
 
-  BUGIFTHROW(len1==0 || len2==0,"len1 (" << len1 << ") or len2 (" << len2 << ") == 0 ?");
-  BUGIFTHROW(len1>40000 || len2>40000,"len1 (" << len1 << ") or len2 (" << len2 << ") >40000 ? Seems unbelievable.");
-
   DYN_calcwithoffset=calcwithoffset;
   DYN_eoffset=expectedoffset;
 
@@ -518,25 +525,32 @@ void Dynamic::setSequences(const char * seq1, uint32 len1, const char * seq2, ui
   DYN_lastrc_maxscore=INT_MIN;
   DYN_knowngaps=0;
 
-  if(DYN_sequence1 == nullptr || DYN_s1size<len1+1){
-    if(DYN_sequence1 != nullptr) delete [] DYN_sequence1;
+  if(DYN_sequence1 == NULL || DYN_s1size<len1+1){
+    if(DYN_sequence1 != NULL) delete [] DYN_sequence1;
     DYN_s1size=len1+1;
     if(DYN_s1size<2000) DYN_s1size=2000;
     DYN_sequence1= new char[DYN_s1size];
-    ++DYN_alloccounts;
+    DYN_alloccount++;
   }
-  if(DYN_sequence2 == nullptr || DYN_s2size<=len2+1){
-    if(DYN_sequence2 != nullptr) delete [] DYN_sequence2;
+  if(DYN_sequence2 == NULL || DYN_s2size<=len2+1){
+    if(DYN_sequence2 != NULL) delete [] DYN_sequence2;
     DYN_s2size=len2+1;
     if(DYN_s2size<2000) DYN_s2size=2000;
     DYN_sequence2= new char[DYN_s2size];
-    ++DYN_alloccounts;
+    DYN_alloccount++;
   }
 
-#ifdef CLOCK_STEPS1
-  timeval tv;
-  gettimeofday(&tv,nullptr);
-#endif
+  if(len1==0 || len2==0){
+    cout << "Len1: " << len1 << endl;
+    cout << "Len2: " << len2 << endl;
+    MIRANOTIFY(Notify::INTERNAL, "len1 or len2 == 0 ?") ;
+  }
+
+  if(len1>=40000 || len2>=40000){
+    cout << "Len1: " << len1 << endl;
+    cout << "Len2: " << len2 << endl;
+    MIRANOTIFY(Notify::INTERNAL, "Ummmm, those lengths >= 40000 seem really unbelievable?!") ;
+  }
 
   // Copy first sequence
   try{
@@ -545,6 +559,7 @@ void Dynamic::setSequences(const char * seq1, uint32 len1, const char * seq2, ui
     DYN_len_seq1=len1;
   }
   catch(Notify n){
+    cerr << "Error while copying sequence 1" << endl;
     cout << "Error while copying sequence 1" << endl;
     //    n.handleError(THISFUNC);
     throw(n);
@@ -557,33 +572,39 @@ void Dynamic::setSequences(const char * seq1, uint32 len1, const char * seq2, ui
     DYN_len_seq2=len2;
   }
   catch(Notify n){
+    cerr << "Error while copying sequence 2" << endl;
     cout << "Error while copying sequence 2" << endl;
     //    n.handleError(THISFUNC);
     throw(n);
   }
 
-#ifdef CLOCK_STEPS1
-  DYN_timing_seqcopy+=diffsuseconds(tv);
-#endif
-
-
   if(DYN_knowngaps<0) DYN_knowngaps=-DYN_knowngaps;
-
+  
   // len+1 to get the 0 row and 0 column into the matrix
   //  +1 at the end ta allow the matrix computation algorithm to be easier
 #if 1
 
+#if 0
+
+  int32 sizeneeded=(len1+1)*(len2+1) +1;
+  if (DYN_simmatrix==NULL) {
+    DYN_simmatrix= new int32[sizeneeded];
+    DYN_smsize=sizeneeded;
+  }
+
+#else
+
   {
-    uint32 sizeneeded=(len1+1)*(len2+1) +1;
+    int32 sizeneeded=(len1+1)*(len2+1) +1;
 
     //cout << "sizeneeded1: " << sizeneeded << endl;
 
-    if (DYN_simmatrix==nullptr) {
+    if (DYN_simmatrix==NULL) {
       // ok, on first use, we're taking at least 1024^2+1 bytes
-      sizeneeded=max(sizeneeded,static_cast<uint32>(1024*1024+1));
-
+      sizeneeded=max(sizeneeded,(1024*1024+1));
+      
       //cout << "DYN_simmatrix: " << DYN_simmatrix << "\tsizeneeded2: " << sizeneeded << endl;
-
+      
       DYN_simmatrix= new int32[sizeneeded];
       DYN_smsize=sizeneeded;
     } else {
@@ -591,18 +612,18 @@ void Dynamic::setSequences(const char * seq1, uint32 len1, const char * seq2, ui
 	delete [] DYN_simmatrix;
 	DYN_simmatrix= new int32[sizeneeded];
 	DYN_smsize=sizeneeded;
-	++DYN_alloccountm;
       }
     }
   }
+#endif
 
 #else
 #define SPECIALCEBUG
-  if (DYN_simmatrix!=nullptr) delete [] DYN_smsize;
+  if (DYN_simmatrix!=NULL) delete [] DYN_smsize;
 
   DYN_simmatrix= new int32[(len1+1)*(len2+1) +1 +2000];
   // Nur wenn +2000 bei Speicheralloziierung
-  {
+  { 
     int32 * ptr= DYN_simmatrix+(len1+1)*(len2+1) +1;
     for(uint32 i=0; i<2000; i++, ptr++){
       *ptr=0xDEADBEEF;
@@ -610,14 +631,27 @@ void Dynamic::setSequences(const char * seq1, uint32 len1, const char * seq2, ui
   }
 #endif
 
-  DYN_validseq=true;
-  DYN_matrixcalculated=false;
+
+  DYN_valid=1;
+
+  // The sequences are known, the memory for the similarity matrix 
+  //  allocated, now compute this matrix
+
+  //if an expected offset of sequence 1 and 2 has been given, use this and
+  // compute a banded matrix, else whole matrix
+  if(calcwithoffset){
+    //    computeSimMatrix();
+    computeBSimMatrix(expectedoffset);
+  }else{
+    computeSimMatrix();
+  }
 
   FUNCEND();
 }
 
 
 
+
 /*************************************************************************
  *
  *
@@ -631,9 +665,9 @@ void Dynamic::discard()
 {
   FUNCSTART("Dynamic::discard()");
 
-  if(DYN_sequence1!=nullptr) delete [] DYN_sequence1;
-  if(DYN_sequence2!=nullptr) delete [] DYN_sequence2;
-  if(DYN_simmatrix!=nullptr) delete [] DYN_simmatrix;
+  if(DYN_sequence1!=NULL) delete [] DYN_sequence1;
+  if(DYN_sequence2!=NULL) delete [] DYN_sequence2;
+  if(DYN_simmatrix!=NULL) delete [] DYN_simmatrix;
 
   FUNCEND();
 }
@@ -648,28 +682,28 @@ void Dynamic::discard()
  * This makes this instance independant from the source sequence as we
  *  modify it!
  *
- *  translate all into uppercase bases
- *  translate undefined bases to N,
+ *  translate all into uppercase bases   
+ *  translate undefined bases to N, 
  *  translate gaps to "#"
- *  add 0 terminator to the sequence
+ *  add 0 terminator to the sequence				       
  *
  *************************************************************************/
 
 int32 Dynamic::sequenceCopy(char * to, const char * from, uint32 len)
 {
   FUNCSTART("void Dynamic::sequenceCopy(char * to, const char * from, uint32 len)");
-
+  
   int32 numgaps=0;
-  auto ofrom=from;
-  for(;from<ofrom+len; ++from, ++to){
+
+  for(uint32 i=0;i<len;i++, from++, to++){
     char base=static_cast<char>(toupper(*from));
-    if(likely(dptools::isValidIUPACBase(base))){
+    if(dptools::isValidIUPACBase(base)){
       *to=base;
     }else{
       switch(base){
       case '*':{
 	*to='#';
-	++numgaps;
+	numgaps++;
 	break;
       }
       case '1':
@@ -677,14 +711,14 @@ int32 Dynamic::sequenceCopy(char * to, const char * from, uint32 len)
       case '3':
       case '4':{
 	*to=base;
-	++numgaps;
+	numgaps++;
 	break;
       }
       case '-':
 	*to='N';
 	break;
       default:{
-	cout << "Position: " << from-ofrom << "\t" << hex << static_cast<uint16>(*from) << "\t" << *from << endl;
+	cout << "Position: " << i << "\t" << hex << static_cast<uint16>(*from) << "\t" << from[i] << endl;
 	MIRANOTIFY(Notify::FATAL, "Unknown base in read: " << from);
       }
       }
@@ -699,33 +733,6 @@ int32 Dynamic::sequenceCopy(char * to, const char * from, uint32 len)
 
 
 
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-  // The sequences are known, the memory for the similarity matrix
-  //  allocated, now compute this matrix
-
-void Dynamic::computeMatrix()
-{
-  FUNCSTART("void Dynamic::computeMatrix()");
-
-  //if an expected offset of sequence 1 and 2 has been given, use this and
-  // compute a banded matrix, else whole matrix
-  if(DYN_calcwithoffset){
-    //    computeSimMatrix();
-    computeBSimMatrix();
-  }else{
-    BUGIFTHROW(true,"computeSimMatrix() not available atm, sorry. use calcwithoffset and large band.");
-    //computeSimMatrix();
-  }
-
-  FUNCEND();
-}
 /*************************************************************************
  *
  *
@@ -734,31 +741,28 @@ void Dynamic::computeMatrix()
  *************************************************************************/
 
 /* expected offset of seq2 to seq1
-       s1 -------                                   s1 -------
-         s2 --------     eoffset =2	          s2 --------     eoffset =-2
-
-            s2				                s2
-          0------			             0-^----
-         0				            0  xpos=2
-	 |				       	    |
-         ypos=2				            |
-	 |				       	    |
-      s1 |				         s1 |
-	 |				       	    |
-	 |				       	    |
-	 |				       	    |
-          -------                                    -------
+       s1 -------
+         s2 --------     eoffset =2
+
+          s2
+          0------
+         0
+	 |
+         ypos=2
+	 |
+      s1 |
+	 |
+	 |
+	 |
+          -------
 
 */
 
-void Dynamic::computeBSimMatrix()
+void Dynamic::computeBSimMatrix(int32 eoffset)
 {
   FUNCSTART("Dynamic::computeBSimMatrix()");
 
-#ifdef CLOCK_STEPS1
-  timeval tv;
-  gettimeofday(&tv,nullptr);
-#endif
+  //eoffset=-1 ;
 
   // xpos and ypos are the offsets computed from the expected overlap
   // xrun and yrun point to the cell in the matrix to be computed next
@@ -770,57 +774,39 @@ void Dynamic::computeBSimMatrix()
   int32 yrun=0;
 
   int32 eoverlap;
-  if(DYN_eoffset>=0){
-    eoverlap=static_cast<int32>(DYN_len_seq1)-DYN_eoffset;
-    if(static_cast<int32>(DYN_len_seq2)<eoverlap) eoverlap=DYN_len_seq2;
-    ypos=DYN_eoffset;
+  if(eoffset>=0){
+    eoverlap=DYN_len_seq1-eoffset;
+    if(DYN_len_seq2<eoverlap) eoverlap=DYN_len_seq2;
+    ypos=eoffset;
   }else{
-    eoverlap=static_cast<int32>(DYN_len_seq2)+DYN_eoffset;
-    if(static_cast<int32>(DYN_len_seq1)<eoverlap) eoverlap=DYN_len_seq1;
-    xpos=-DYN_eoffset;
+    eoverlap=DYN_len_seq2+eoffset;
+    if(DYN_len_seq1<eoverlap) eoverlap=DYN_len_seq1;    
+    xpos=-eoffset;
   }
 
-
-  // I allow % inserts/deletes, so make the
+  // I allow % inserts/deletes, so make the 
   //  band % bases of the expected overlap
   // If band > length of one of the sequences reduce it
   //
-  // kerrors is the number of cells left and right from the
+  // kerrors is the number of cells left and right from the 
   //  idel diagonal that are computed
 
-  int32 kerrors=DYN_knowngaps+static_cast<int32>(eoverlap*static_cast<float>(DYN_miraparams->getAlignParams().al_kpercent)/100.0f);
+  int32 kerrors=DYN_knowngaps+eoverlap*DYN_miraparams->getAlignParams().al_kpercent/100;
 
   if(kerrors<DYN_miraparams->getAlignParams().al_kmin) kerrors=DYN_miraparams->getAlignParams().al_kmin;
   if(kerrors>DYN_miraparams->getAlignParams().al_kmax) {
     kerrors=DYN_miraparams->getAlignParams().al_kmax;
   }
 
-  if(kerrors>static_cast<int32>(max(DYN_len_seq1,DYN_len_seq2))) kerrors=static_cast<int32>(max(DYN_len_seq1,DYN_len_seq2));
+  if(kerrors>DYN_len_seq1) kerrors=DYN_len_seq1;
+  if(kerrors>DYN_len_seq2) kerrors=DYN_len_seq2;
   if(kerrors<5) kerrors=5;
 
   if(kerrors-DYN_knowngaps < 0) kerrors=DYN_miraparams->getAlignParams().al_kmin+DYN_knowngaps;
 
-  const int32 bandwidth=2*kerrors+1;
-
-  DYN_bandwidth=bandwidth;
-
   //cout << "KGAP: " << DYN_knowngaps << endl;
   //cout << "KERR: " << kerrors << endl;
 
-  if(DYN_eoffset>=0){
-    DYN_leftbandx=-ypos-kerrors;
-    DYN_rightbandx=-ypos+kerrors;
-  }else{
-    DYN_leftbandx=xpos-kerrors;
-    DYN_rightbandx=xpos+kerrors;
-  }
-  DYN_bandsafety=eoverlap/100;
-  if(DYN_bandsafety<1){
-    DYN_bandsafety=1;
-  }else if(DYN_bandsafety>15){
-    DYN_bandsafety=15;
-  }
-
   // xpos and ypos are the offsets computed from the expected overlap
   if(ypos>0){
     yrun=ypos-kerrors;
@@ -833,104 +819,73 @@ void Dynamic::computeBSimMatrix()
 
   CEBUG("lens1: " << DYN_len_seq1 << endl);
   CEBUG("lens2: " << DYN_len_seq2 << endl);
-  CEBUG("eoffset: " << DYN_eoffset << endl);
+  CEBUG("eoffset: " << eoffset << endl);
   CEBUG("eoverlap: " << eoverlap << endl);
   CEBUG("kerrors: " << kerrors << endl);
 
   dynamic_parameters const & DYN_params = DYN_miraparams->getDynamicParams();
 
-#ifdef MATRIXDEBUG
+#ifdef CEBUGFLAG
+//#if 1
   {
     // Fill the matrix with 666 for testing and debugging purposes
     int32 * ptr=DYN_simmatrix;
-    for(uint32 i=0; i<(DYN_len_seq1+1)*(DYN_len_seq2+1); ++i, ++ptr) *ptr=666;
+    for(int32 i=0; i<(DYN_len_seq1+1)*(DYN_len_seq2+1); i++, ptr++) *ptr=666;
   }
 #endif
 
-#ifdef CLOCK_STEPS1
-  timeval tl;
-  gettimeofday(&tl,nullptr);
-#endif
-
-  // fill last row with -1
+  // fill last row and first column with -1
   {
     int32 * ptrr=DYN_simmatrix+(DYN_len_seq1)*(DYN_len_seq2+1);
-    for(uint32 i=0; i<=DYN_len_seq2; ++i){
+    for(int32 i=0; i<=DYN_len_seq2;i++){
       *ptrr++= -1;
     }
-    // no measurable effect on PacBio 6k overlap
-    //memset(ptrr,-1,DYN_len_seq2*sizeof(int32));
   }
-  //cout << "###1 " << diffsuseconds(tl) << endl;
+  {
+    int32 * ptrc=DYN_simmatrix+DYN_len_seq2;
+    for(int32 i=0; i<=DYN_len_seq1;i++){
+      *ptrc= -1;
+      ptrc+=DYN_len_seq2+1;
+    }
+  }
 
-  // fill first row terminal gap penalties.
+  // fill first row and first column with terminal gap penalties.
   {
     int32 * ptrr=DYN_simmatrix;
-    for(uint32 i=0; i<=DYN_len_seq2; ++i){
+    for(int32 i=0; i<=DYN_len_seq2;i++){
       *ptrr++= DYN_params.dyn_score_ltermgap*i;
     }
   }
-  //cout << "###2 " << diffsuseconds(tl) << endl;
-
-  // filling first and last column almost certainly will lead to cache misses
-  // on large sequences (pacbio, with 7 or 9 Kb), this is responsible for 1/8
-  //  to 1/4 of the total time spent in banded Smith-Waterman, depending on band-width
-  //
-  // therefore, perform a preloading beforehand so that the values will be
-  //  at least in usual L3 caches, probably even in L2
-  // remember, last column + 1 == first column (next row)
-
-  // Apple MacAir corei7: this is *SO* absolutely, totally, utterly frustrating
-  //  the prefetch below has exactly 0 effect.
-  // putting a prefetch in the main loop also 0 effect, regardless on
-  //  how far I let it prefetch
-  // TODO: check on home Linux box
-
-//  {
-//    int32 * ptrlc=DYN_simmatrix+DYN_len_seq2;
-//    for(uint32 i=0; i<=DYN_len_seq1; ++i, ptrlc+=DYN_len_seq2+1){
-//      __builtin_prefetch (ptrlc);
-//      //prefetchwl(ptrlc);
-//    }
-//  }
-  //cout << "### " << diffsuseconds(tl) << endl;
-
-  // fill first column with terminal gap penalties, last column with -1
   {
-    int32 * ptrfc=DYN_simmatrix;
-    int32 * ptrlc=DYN_simmatrix+DYN_len_seq2;
-    for(uint32 i=0; i<=DYN_len_seq1; ++i, ptrfc+=DYN_len_seq2+1, ptrlc+=DYN_len_seq2+1){
-      *ptrfc= DYN_params.dyn_score_rtermgap*i;
-      *ptrlc= -1;
-      //prefetchwl(ptrlc+100*(DYN_len_seq2+1));
+    int32 * ptrc=DYN_simmatrix;
+    for(int32 i=0; i<=DYN_len_seq1;i++){
+      *ptrc= DYN_params.dyn_score_rtermgap*i;
+      ptrc+=DYN_len_seq2+1;
     }
   }
-  //cout << "###4 " << diffsuseconds(tl) << endl;
 
-#ifdef CLOCK_STEPS1
-  DYN_timing_bswm_setup+=diffsuseconds(tl);
-#endif
-
-  if((xpos==0 && ypos-kerrors>static_cast<int32>(DYN_len_seq1))
-     || (ypos==0 && xpos-kerrors>static_cast<int32>(DYN_len_seq2))){
+  if((xpos==0 && ypos-kerrors>DYN_len_seq1)
+     || (ypos==0 && xpos-kerrors>DYN_len_seq2)){
     DYN_lastrc_maxscore=0;
     DYN_maxscore=0;
     FUNCEND();
     return;
-  }else{
+  }
 
 
-#ifdef MATRIXDEBUG
-    int32 bandlimit=DYN_BANDLIMIT;
+#ifdef CEBUGFLAG
+  int32 bandlimit=10000;
+#else
+  int32 bandlimit=DYN_BANDLIMIT;
 #endif
 
+  {
     // Local variables are faster than class variables
-    const int32 s_sgap=DYN_params.dyn_score_gap;
+    int32   s_sgap=DYN_params.dyn_score_gap;
+
+    int32 bandwidth=2*kerrors+1;
 
 
-#ifdef CLOCK_STEPS1
-    gettimeofday(&tl,nullptr);
-#endif
     {
       // Neu Teil 1
 
@@ -951,16 +906,16 @@ void Dynamic::computeBSimMatrix()
 	  yrun=ypos-kerrors;
 	  dolen=0;
 	  doheight=2*kerrors;
-	  if(yrun+doheight>static_cast<int32>(DYN_len_seq1)) doheight=DYN_len_seq1-yrun;
+	  if(yrun+doheight>DYN_len_seq1) doheight=DYN_len_seq1-yrun;
 	  // xpos=0!
-	  if(xrun+doheight>static_cast<int32>(DYN_len_seq2)) doheight=DYN_len_seq2-xrun;
+	  if(xrun+doheight>DYN_len_seq2) doheight=DYN_len_seq2-xrun;
 	}else{
 	  // oben flaches Dreieck oder recht
 	  xrun=0;
 	  yrun=0;
 	  // ypos-kerrors < 0 !
 	  dolen=-(ypos-kerrors);
-	  if(dolen>=static_cast<int32>(DYN_len_seq2)){
+	  if(dolen>=DYN_len_seq2){
 	    CEBUG("Rechteck\n");
 	    // kein Dreieck, Rechteck. volle Zeile muss berechnet werden, sp�ter
 	    doheight=0;
@@ -968,30 +923,22 @@ void Dynamic::computeBSimMatrix()
 	    CEBUG("Flach\n");
 	    doheight=2*kerrors+(ypos-kerrors);
 
-	    if(yrun+doheight>static_cast<int32>(DYN_len_seq1)) doheight=DYN_len_seq1-yrun;
-	    if(xrun+dolen+doheight>static_cast<int32>(DYN_len_seq2)) doheight=DYN_len_seq2-xrun-dolen;
+	    if(yrun+doheight>DYN_len_seq1) doheight=DYN_len_seq1-yrun;
+	    if(xrun+dolen+doheight>DYN_len_seq2) doheight=DYN_len_seq2-xrun-dolen;
 	  }
 	}
       }else{
 	CEBUG("Rechts");
 	if(xpos-kerrors<0){
 	  dolen=xpos+kerrors;
-	  CEBUG("\ndolentmp: " << dolen<< endl);
-	  if(dolen>=static_cast<int32>(DYN_len_seq2)){
+	  if(dolen>=DYN_len_seq1){
 	    CEBUG("Rechteck\n");
 	    // kein Dreieck, Rechteck. volle Zeile muss berechnet werden, sp�ter
 	    doheight=0;
 	  } else {
 	    doheight=-(xpos-kerrors);
-	    CEBUG("doheighttmp: " << doheight<< endl);
-	    if(yrun+doheight>static_cast<int32>(DYN_len_seq1)) {
-	      CEBUG("p1\n");
-	      doheight=DYN_len_seq1-yrun;
-	    }
-	    if(xrun+dolen+doheight>static_cast<int32>(DYN_len_seq2)) {
-	      CEBUG("p2\n");
-	      doheight=DYN_len_seq2-xrun-dolen;
-	    }
+	    if(yrun+doheight>DYN_len_seq1) doheight=DYN_len_seq1-yrun;
+	    if(xrun+dolen+doheight>DYN_len_seq2) doheight=DYN_len_seq2-xrun-dolen;
 	  }
 	}
       }
@@ -1003,60 +950,44 @@ void Dynamic::computeBSimMatrix()
       CEBUG("yrun: " << yrun<< endl);
       CEBUG("dolen: " << dolen<< endl);
       CEBUG("doheight: " << doheight<< endl);
-
-#ifdef MATRIXDEBUG
+      
       if(yrun>0) *(DYN_simmatrix+yrun*(DYN_len_seq2+1)+1)=bandlimit;
-#endif
-
+      
       int32 * ptrt=DYN_simmatrix+(yrun+1)*(DYN_len_seq2+1)+1;
-      for(int32 zeile=0; zeile<doheight; ++zeile, ++yrun, ++dolen){
-	const int32 * ptrla=DYN_simmatrix+yrun*(DYN_len_seq2+1);
-	const int32 * ptra=ptrla+1;
-	const int32 * ptrl=ptrla+DYN_len_seq2+1;
-	ptrt=const_cast<int32 *>(ptrl+1);
-
-	const char * s_ds2s=DYN_sequence2;
+      for(int32 zeile=0; zeile<doheight; zeile++, yrun++, dolen++){
+	int32 * ptrla=DYN_simmatrix+yrun*(DYN_len_seq2+1);
+	int32 * ptra=ptrla+1;
+	int32 * ptrl=ptrla+DYN_len_seq2+1;
+	ptrt=ptrl+1;
+	
+	char * s_ds2s=DYN_sequence2;
 	CEBUG("1 " << DYN_sequence1[yrun] << ":");
-
-	const int32 * mmp= (int32 *) &DYN_match_matrix+DYN_sequence1[yrun]*DYN_MATSIZE;
-	for(int32 spalte=0; spalte<dolen; ++spalte,
-	      ++s_ds2s,++ptrla,++ptra,++ptrl,++ptrt){
+	
+	int32 * mmp= (int32 *) &DYN_match_matrix+DYN_sequence1[yrun]*DYN_MATSIZE;
+	for(int32 spalte=0; spalte<dolen; spalte++, 
+	      s_ds2s++,ptrla++,ptra++,ptrl++,ptrt++){
 	  //CEBUG(*s_ds2s << "(" << mmp[*s_ds2s] << ")");
 	  CEBUG("1");
-	  *ptrt= max((*ptra)+s_sgap,
+	  *ptrt= max((*ptra)+s_sgap, 
 		     max((*ptrla)+mmp[*s_ds2s], (*ptrl)+s_sgap ));
-	  //prefetchrl(ptra+1);
-	  //prefetchrl(ptrla+1);
-	  //prefetchrl(ptrl+1);
-	  //prefetchwl(ptrt+1);
+	  prefetchrl(ptra+1);
+	  prefetchrl(ptrla+1);
+	  prefetchrl(ptrl+1);
+	  prefetchwl(ptrt+1);
 	}
 	//CEBUG(*s_ds2s << "(" << mmp[*s_ds2s] << ")" << endl);
 	CEBUG(*s_ds2s << "(" << mmp[*s_ds2s] << ")" << endl);
 	*ptrt= max((*ptrla)+mmp[*s_ds2s], (*ptrl)+s_sgap );
-
-#ifdef MATRIXDEBUG
 	*(ptrt+1)=bandlimit;
-#endif
+	
       }
-
-      //if(doheight >0 && xrun+dolen>=static_cast<int32>(DYN_len_seq2)) {
-      //	BUGIFTHROW(true,"Is this dead code? Hopefully, but it was triggered anyway :-( It was");
-      //	*(ptrt+1)=-212;
-      //}
+      if(doheight >0 && xrun+dolen>=DYN_len_seq2) *(ptrt+1)=-212;
     }
-
-#ifdef CLOCK_STEPS1
-    DYN_timing_bswm_p1+=diffsuseconds(tl);
-#endif
-
-#ifdef MATRIXDEBUG
+    
+#ifdef CEBUGFLAG
     cout << "Mathead\n";
     dump();
-#endif
-
-#ifdef CLOCK_STEPS1
-    gettimeofday(&tl,nullptr);
-#endif
+#endif    
 
     {
 /*
@@ -1075,54 +1006,77 @@ void Dynamic::computeBSimMatrix()
      \..
 
  */
+      //int32 len=0;
+      int32 doheight=0;
+      //if(xrun==0){
+      //	if(xpos==0) {
+      //	  // will be cut back later if that's over the array
+      //	  if(kerrors>=DYN_len_seq1) doheight=kerrors;
+      //	}else{
+      //	  doheight=kerrors-xpos;
+      //	}
+      //}
+
+      if(DYN_len_seq2<=DYN_len_seq1){
+	// doheight will be cut back later if that's over the array
+	if(xpos>=0) {
+	  doheight=kerrors-xpos-yrun;
+	}else{
+	  doheight=kerrors;
+	}
+      }else if(bandwidth >= DYN_len_seq2){
+	if(ypos>=0) {
+	  doheight=kerrors;
+	}else{
+	  doheight=kerrors-xpos;
+	}
+      }
+
       CEBUG("\nTeil 2a\n");
-      int32 runtoline=-DYN_leftbandx;
-      if(runtoline>static_cast<int32>(DYN_len_seq1)) runtoline=DYN_len_seq1;
-      if(bandwidth<static_cast<int32>(DYN_len_seq2)) runtoline=-1;
+      CEBUG("doheight-pre: " << doheight<< endl);
+      if(doheight+yrun>DYN_len_seq1) doheight=DYN_len_seq1-yrun;
+      if(yrun>=DYN_len_seq1) doheight=0; // not necessary?
+
 
       CEBUG("xpos: " << xpos<< endl);
       CEBUG("ypos: " << ypos<< endl);
       CEBUG("xrun: " << xrun<< endl);
       CEBUG("yrun: " << yrun<< endl);
-      CEBUG("runtoline: " << runtoline<< endl);
-
-      const int32 * ptrla=DYN_simmatrix+yrun*(DYN_len_seq2+1)+xrun;
-      const int32 * ptra=ptrla+1;
-      const int32 * ptrl=ptrla+DYN_len_seq2+1;
-      int32 * ptrt=const_cast<int32 *>(ptrl+1);
-      for(; yrun<runtoline; ++yrun,
-	    ++ptrla, ++ptra, ++ptrl, ++ptrt){
-	const char * s_ds2s=DYN_sequence2;
-	const int32 * mmp= (int32 *) &DYN_match_matrix+DYN_sequence1[yrun]*DYN_MATSIZE;
-
+      CEBUG("doheight: " << doheight<< endl);
+      
+      int32 * ptrla=DYN_simmatrix+yrun*(DYN_len_seq2+1)+xrun;
+      int32 * ptra=ptrla+1;
+      int32 * ptrl=ptrla+DYN_len_seq2+1;
+      int32 * ptrt=ptrl+1;
+      for(int32 zeile=0; zeile<doheight; zeile++, yrun++){
+	char * s_ds2s=DYN_sequence2;
+	int32 * mmp= (int32 *) &DYN_match_matrix+DYN_sequence1[yrun]*DYN_MATSIZE;
+	
 	CEBUG("2a " << DYN_sequence1[yrun] << ":");
-	for(uint32 spalte=0; spalte<DYN_len_seq2; ++spalte,
-	      ++s_ds2s,++ptrla,++ptra,++ptrl,++ptrt){
+	for(int32 spalte=0; spalte<DYN_len_seq2; spalte++,
+	      s_ds2s++,ptrla++,ptra++,ptrl++,ptrt++){
 	  //CEBUG(*s_ds2s << "(" << mmp[*s_ds2s] << ")");
 	  CEBUG("a");
-	  *ptrt= max((*ptra)+s_sgap,
+	  *ptrt= max((*ptra)+s_sgap, 
 		     max((*ptrla)+mmp[*s_ds2s], (*ptrl)+s_sgap ));
-	  //prefetchrl(ptra+1);
-	  //prefetchrl(ptrla+1);
-	  //prefetchrl(ptrl+1);
-	  //prefetchwl(ptrt+1);
+	  prefetchrl(ptra+1);
+	  prefetchrl(ptrla+1);
+	  prefetchrl(ptrl+1);
+	  prefetchwl(ptrt+1);
 	}
 	CEBUG(endl);
+	ptrla++;
+	ptra++;
+	ptrl++;
+	ptrt++;
       }
     }
 
-#ifdef CLOCK_STEPS1
-  DYN_timing_bswm_p2a+=diffsuseconds(tl);
-#endif
-
-#ifdef MATRIXDEBUG
+#ifdef CEBUGFLAG
     cout << "Matmid 2a\n";
     dump();
 #endif
 
-#ifdef CLOCK_STEPS1
-    gettimeofday(&tl,nullptr);
-#endif
     {
       // Teil 2b
 /*
@@ -1136,200 +1090,142 @@ void Dynamic::computeBSimMatrix()
   ....XXXXX..
   .....XXXXX.
   ......XXXXX
-  .......\
+  .......\   
  */
       CEBUG("\nTeil 2b\n");
 
       int32 doheight=DYN_len_seq1-yrun;
       CEBUG("doheight-pre: " << doheight<< endl);
-      if(xrun+doheight-1+bandwidth>=static_cast<int32>(DYN_len_seq2)){
+      if(xrun+doheight-1+bandwidth>=DYN_len_seq2){
 	doheight= DYN_len_seq2-xrun-bandwidth+1;
       }
-      if(yrun>static_cast<int32>(DYN_len_seq1)) doheight=0;
+      if(yrun>DYN_len_seq1) doheight=0;
       CEBUG("xpos: " << xpos<< endl);
       CEBUG("ypos: " << ypos<< endl);
       CEBUG("xrun: " << xrun<< endl);
       CEBUG("yrun: " << yrun<< endl);
       CEBUG("doheight: " << doheight<< endl);
-
-      const int32 * ptrla=DYN_simmatrix+yrun*(DYN_len_seq2+1)+xrun;
-      const int32 * ptra=ptrla+1;
-      const int32 * ptrl=ptrla+DYN_len_seq2+1;
-      int32 * ptrt=const_cast<int32 *>(ptrl+1);
-      for(int32 zeile=0; zeile<doheight; ++zeile, ++xrun, ++yrun){
-
-	// no effect, maybe even slightly detrimental
-	//{
-	//  auto ptrp=ptrl+2*(DYN_len_seq2+1);
-	//  prefetchrl(ptrp);
-	//  ptrp+=16;
-	//  prefetchrl(ptrp);
-	//  ptrp+=16;
-	//  prefetchrl(ptrp);
-	//  ptrp+=16;
-	//  prefetchrl(ptrp);
-	//  ptrp+=16;
-	//  prefetchrl(ptrp);
-	//  ptrp+=16;
-	//  prefetchrl(ptrp);
-	//  ptrp+=16;
-	//  prefetchrl(ptrp);
-	//  ptrp+=16;
-	//  prefetchrl(ptrp);
-	//  ptrp+=16;
-	//  prefetchrl(ptrp);
-	//  ptrp+=16;
-	//  prefetchrl(ptrp);
-	//  ptrp+=16;
-	//}
-	const char * s_ds2s=DYN_sequence2+xrun;
-	const int32 * mmp= (int32 *) &DYN_match_matrix+DYN_sequence1[yrun]*DYN_MATSIZE;
-
+      
+      int32 * ptrla=DYN_simmatrix+yrun*(DYN_len_seq2+1)+xrun;
+      int32 * ptra=ptrla+1;
+      int32 * ptrl=ptrla+DYN_len_seq2+1;
+      int32 * ptrt=ptrl+1;
+      for(int32 zeile=0; zeile<doheight; zeile++, xrun++, yrun++){
+	char * s_ds2s=DYN_sequence2+xrun;
+	int32 * mmp= (int32 *) &DYN_match_matrix+DYN_sequence1[yrun]*DYN_MATSIZE;
+	
 	CEBUG("2b " << DYN_sequence1[yrun] << ":");
 	CEBUG(*s_ds2s << "(" << mmp[*s_ds2s] << ")");
-
-#ifdef MATRIXDEBUG
+	
 	*(ptrt-1)=bandlimit;
-#endif
 	*ptrt= max((*ptrla)+mmp[*s_ds2s], (*ptra)+s_sgap);
-	++s_ds2s,++ptrla,++ptra,++ptrl,++ptrt;
-
-//*
-	// BaCh 08.08.2013
-	// manual loop unrolling has no measurable effect
-	for(int32 spalte=0; spalte<bandwidth-2; ++spalte,
-	      ++s_ds2s,++ptrla,++ptra,++ptrl,++ptrt){
+	s_ds2s++,ptrla++,ptra++,ptrl++,ptrt++;
+	
+	for(int32 spalte=0; spalte<bandwidth-2; spalte++,
+	      s_ds2s++,ptrla++,ptra++,ptrl++,ptrt++){
 	  //CEBUG(*s_ds2s << "(" << mmp[*s_ds2s] << ")");
 	  CEBUG("b");
-	  *ptrt= max((*ptra)+s_sgap,
+	  *ptrt= max((*ptra)+s_sgap, 
 		     max((*ptrla)+mmp[*s_ds2s], (*ptrl)+s_sgap ));
-	  // BaCh 08.08.2013
-	  // bah! Having these prefetches here makes BSW 3.5 % slower
-	  //  on 6000bp overlap of PacBio raw data
-	  //prefetchrl(ptrla+1);
-	  //prefetchrl(ptra+1);
-	  //prefetchrl(ptrl+1);
-	  //prefetchwl(ptrt+1);
-	  //
-	  // also, prefetching one line in advance has zero effect, two lines is even detrimental
-	  //prefetchrl(ptrla+2*(DYN_len_seq2+1));
+	  prefetchrl(ptra+1);
+	  prefetchrl(ptrla+1);
+	  prefetchrl(ptrl+1);
+	  prefetchwl(ptrt+1);
 	}
-//*/
-
+	
 	CEBUG(*s_ds2s << "(" << mmp[*s_ds2s] << ")" << endl);
 	*ptrt= max((*ptrla)+mmp[*s_ds2s], (*ptrl)+s_sgap );
-
-#ifdef MATRIXDEBUG
 	*(ptrt+1)=bandlimit;
-#endif
-
+	
 	ptrla+=(DYN_len_seq2+1)-2*kerrors+1;
-	// no effect? maybe a very, very slight effect
-	//prefetchrl(ptrla);
 	ptra=ptrla+1;
 	ptrl=ptrla+DYN_len_seq2+1;
-	ptrt=const_cast<int32 *>(ptrl+1);
-	// no effect?
-	//prefetchwl(ptrt-1);
+	ptrt=ptrl+1;
       }
     }
 
-#ifdef CLOCK_STEPS1
-  DYN_timing_bswm_p2b+=diffsuseconds(tl);
-#endif
-
-#ifdef MATRIXDEBUG
+#ifdef CEBUGFLAG
     cout << "Matmid 2b\n";
     dump();
 #endif
 
-#ifdef CLOCK_STEPS1
-    gettimeofday(&tl,nullptr);
-#endif
     {
       // Teil 3
       int32 dolen=DYN_len_seq2-xrun-1;
       int32 doheight=dolen+1;
       // TODO: check     12.08.1999 >=DYN_len_seq1+1 changed to > DYN_len_seq1
-      if(yrun+doheight>static_cast<int32>(DYN_len_seq1)) doheight=DYN_len_seq1-yrun;
-      if(yrun>=static_cast<int32>(DYN_len_seq1)) doheight=0;
-
+      if(yrun+doheight>DYN_len_seq1) doheight=DYN_len_seq1-yrun;
+      if(yrun>=DYN_len_seq1) doheight=0;
+	
       CEBUG("\nTeil 3\n");
       CEBUG("dolen: " << dolen<< endl);
       CEBUG("doheight: " << doheight<< endl);
       CEBUG("xrun: " << xrun<< endl);
       CEBUG("yrun: " << yrun<< endl);
 
-      for(int32 zeile=0; zeile<doheight; ++zeile, ++xrun, ++yrun, --dolen){
-	const int32 * ptrla=DYN_simmatrix+yrun*(DYN_len_seq2+1)+xrun;
-	const int32 * ptra=ptrla+1;
-	const int32 * ptrl=ptrla+DYN_len_seq2+1;
-	int32 * ptrt=const_cast<int32 *>(ptrl+1);
+      for(int32 zeile=0; zeile<doheight; zeile++, xrun++, yrun++, dolen--){
+	int32 * ptrla=DYN_simmatrix+yrun*(DYN_len_seq2+1)+xrun;
+	int32 * ptra=ptrla+1;
+	int32 * ptrl=ptrla+DYN_len_seq2+1;
+	int32 * ptrt=ptrl+1;
 
-	const char * s_ds2s=DYN_sequence2+xrun;
-	const int32 * mmp= (int32 *) &DYN_match_matrix+DYN_sequence1[yrun]*DYN_MATSIZE;
+	char * s_ds2s=DYN_sequence2+xrun;
+	int32 * mmp= (int32 *) &DYN_match_matrix+DYN_sequence1[yrun]*DYN_MATSIZE;
 
 	CEBUG("3 " << DYN_sequence1[kerrors+zeile] << ":");
 	CEBUG(*s_ds2s << "(" << mmp[*s_ds2s] << ")");
-
-#ifdef MATRIXDEBUG
+	  
 	*(ptrt-1)=bandlimit;
-#endif
 	*ptrt= max((*ptrla)+mmp[*s_ds2s], (*ptra)+s_sgap);
-	++s_ds2s,++ptrla,++ptra,++ptrl,++ptrt;
-
-	for(int32 spalte=0; spalte<dolen; ++spalte,
-	      ++s_ds2s,++ptrla,++ptra,++ptrl,++ptrt){
+	s_ds2s++,ptrla++,ptra++,ptrl++,ptrt++;
+	  
+	for(int32 spalte=0; spalte<dolen; spalte++,
+	      s_ds2s++,ptrla++,ptra++,ptrl++,ptrt++){
 	  //CEBUG(*s_ds2s << "(" << mmp[*s_ds2s] << ")");
 	  CEBUG("3");
-	  *ptrt= max((*ptra)+s_sgap,
+	  *ptrt= max((*ptra)+s_sgap, 
 		     max((*ptrla)+mmp[*s_ds2s], (*ptrl)+s_sgap ));
-	  //prefetchrl(ptra+1);
-	  //prefetchrl(ptrla+1);
-	  //prefetchrl(ptrl+1);
-	  //prefetchwl(ptrt+1);
+	  prefetchrl(ptra+1);
+	  prefetchrl(ptrla+1);
+	  prefetchrl(ptrl+1);
+	  prefetchwl(ptrt+1);
 	}
 	CEBUG(endl);
       }
     }
 
-#ifdef CLOCK_STEPS1
-  DYN_timing_bswm_p3+=diffsuseconds(tl);
-#endif
-
 
-#ifdef MATRIXDEBUG
+#ifdef CEBUGFLAG
     cout << "Mattail\n";
     dump();
-#endif
-
-#ifdef CLOCK_STEPS1
-    gettimeofday(&tl,nullptr);
-#endif
+#endif    
 
+    // search for bandlimit occurences in last row and column, replace
+    //  occurences with  -1 (they came in due to less if conditions
+    //  in algorithms above to save time)
     //  search for maximum in last column and row
 
-    int32 tmpmax=0;
+    bandlimit=bandlimit>>1;
+
+    int32 tmpmax=0;    
     {
       int32 * ptrr=DYN_simmatrix+(DYN_len_seq1)*(DYN_len_seq2+1);
-      for(uint32 i=0; i<=DYN_len_seq2; ++i, ++ptrr){
+      for(int32 i=0; i<=DYN_len_seq2;i++, ptrr++){
+	if(*ptrr>=bandlimit) *ptrr= -1;
 	tmpmax= max(tmpmax, *ptrr);
       }
     }
     {
       int32 * ptrc=DYN_simmatrix+DYN_len_seq2;
-      for(uint32 i=0; i<=DYN_len_seq1; ++i, ptrc+=DYN_len_seq2+1){
+      for(int32 i=0; i<=DYN_len_seq1;i++, ptrc+=DYN_len_seq2+1){
+	if(*ptrc>=bandlimit) *ptrc= -1;
 	tmpmax= max(tmpmax, *ptrc);
       }
     }
 
-#ifdef CLOCK_STEPS1
-    DYN_timing_bswm_cleanband+=diffsuseconds(tl);
-#endif
-
     DYN_lastrc_maxscore=tmpmax;
     DYN_maxscore=tmpmax;
-
+    
     //    cout << DYN_maxscore << endl << DYN_lastrc_maxscore << endl;
 
   }
@@ -1337,7 +1233,7 @@ void Dynamic::computeBSimMatrix()
 
 #ifdef SPECIALCEBUG
   // Special debug: activate only when +2000 in memory alloc has been done
-  {
+  { 
     int32 * ptr= DYN_simmatrix+(DYN_len_seq1+1)*(DYN_len_seq2+1) +1;
     bool bangit=false;
     for(uint32 i=0; i<2000; i++, ptr++){
@@ -1357,7 +1253,7 @@ void Dynamic::computeBSimMatrix()
 	    cout << DYN_sequence2[i];
 	  }
 	  cout << endl;
-	  cout << "Expected offset: " << DYN_eoffset << endl;
+	  cout << "Expected offset: " << eoffset << endl;
 	  MIRANOTIFY(Notify::INTERNAL, "Bang, crossed border.") ;
     }
   }
@@ -1365,7 +1261,7 @@ void Dynamic::computeBSimMatrix()
 #endif
 
   // Special debugon();
-//  if(DYN_len_seq1==560
+//  if(DYN_len_seq1==560 
 //     || DYN_len_seq2==560){
 //    {
 //	cout << "Matlastrow:\n";
@@ -1385,10 +1281,6 @@ void Dynamic::computeBSimMatrix()
 //    }
 //  }
 
-#ifdef CLOCK_STEPS1
-  DYN_timing_bswmatrix+=diffsuseconds(tv);
-#endif
-
   FUNCEND();
 }
 
@@ -1403,10 +1295,10 @@ void Dynamic::computeBSimMatrix()
 // Dump the dynamic programming matrix to stdout
 void Dynamic::dump()
 {
-  if(!DYN_matrixcalculated) return;
-  const int32 * ptr=DYN_simmatrix;
-  for(uint32 i=0; i<DYN_len_seq1+1; ++i){
-    for(uint32 j=0; j<DYN_len_seq2+1; ++j){
+  if(!DYN_valid) return;
+  int32 * ptr=DYN_simmatrix;
+  for(int32 i=0; i<DYN_len_seq1+1; i++){
+    for(int32 j=0; j<DYN_len_seq2+1; j++){
       cout << *ptr++ << "\t";
     }
     cout << endl;
@@ -1423,10 +1315,8 @@ void Dynamic::dump()
  *************************************************************************/
 
 // Compute the dynamic programming matrix.
-//
+//  
 // Warning: don't use that one anymore!
-
-/*
 void Dynamic::computeSimMatrix()
 {
   FUNCSTART("Dynamic::computeSimMatrix()");
@@ -1495,7 +1385,7 @@ void Dynamic::computeSimMatrix()
     DYN_maxscore=s_maxscore;
 
     // Now search for the maximum in the last row and last column
-    int32 tmpmax=0;
+    int32 tmpmax=0;    
     for(int32 i=0;i<=DYN_len_seq1;i++){
 	tmpmax= max(tmpmax, DYN_simmatrix[i*(DYN_len_seq2+1)+DYN_len_seq2]);
     }
@@ -1503,13 +1393,13 @@ void Dynamic::computeSimMatrix()
 	tmpmax= max(tmpmax, DYN_simmatrix[((DYN_len_seq1)*(DYN_len_seq2+1)+i)]);
     }
     DYN_lastrc_maxscore=tmpmax;
-
+    
     //    cout << DYN_maxscore << endl << DYN_lastrc_maxscore << endl;
 
   }
 
   // Special debugon();
-//  if(DYN_len_seq1==560
+//  if(DYN_len_seq1==560 
 //     || DYN_len_seq2==560){
 //    {
 //	cout << "Matlastrow:\n";
@@ -1532,29 +1422,23 @@ void Dynamic::computeSimMatrix()
   FUNCEND();
 }
 
-//*/
+
 
 
 void Dynamic::coutWhatWasGiven()
 {
   cout << "Dynamic\n--------\nUh oh ... hunting a bug, aren't you?\n";
-  if(DYN_sequence1 != nullptr) {
+  if(DYN_sequence1 != NULL) {
     cout << "Seq1: " << DYN_sequence1;
   }else{
-    cout << "Seq1: nullptr";
+    cout << "Seq1: NULL";
   }
-  if(DYN_sequence1 != nullptr) {
+  if(DYN_sequence1 != NULL) {
     cout << "\nSeq2: " << DYN_sequence2;
   }else{
-    cout << "\nSeq2: nullptr";
+    cout << "\nSeq2: NULL";
   }
-  cout << "\nvalidseq: " << DYN_validseq
-       << "\nmat calc: " << DYN_matrixcalculated
-       << "\nUse offset? " << DYN_calcwithoffset
-       << "\nExp offset: " << DYN_eoffset
-       << "\nlbx: " << DYN_leftbandx
-       << "\nrbx: " << DYN_rightbandx
-       << "\nbs: " << DYN_bandsafety
-       << "\nbw: " << DYN_bandwidth
-       << "\n";
+  cout << "\nUse offset? " << DYN_calcwithoffset;
+  cout << "\nExp offset: " << DYN_eoffset;
+  cout << "\n";
 }
diff --git a/src/mira/dynamic.H b/src/mira/dynamic.H
index 5ab4694..9276d16 100644
--- a/src/mira/dynamic.H
+++ b/src/mira/dynamic.H
@@ -11,19 +11,20 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
+// 	$Id$	
 
 /*
  * Dynamic programming routines
@@ -51,11 +52,18 @@
 
 #include <stdinc/defines.H>
 
+#include <ctype.h>
+#include <limits.h>
+#include <strings.h>            // C-strings
+
+#include <iostream>
+
+#include <algorithm>                        // STL max template
+
 #include <errorhandling/errorhandling.H>
+#include <mira/parameters.H>
 #include <util/dptools.H>
 
-class MIRAParameters;
-
 #define DYN_MATSIZE 128
 #define DYN_BANDLIMIT 1<<30
 
@@ -63,8 +71,7 @@ class Dynamic
 {
 public:
 
-  static uint64 DYN_alloccounts;
-  static uint64 DYN_alloccountm;
+  static uint64 DYN_alloccount;
 
   int32 DYN_maxscore;          // Max score within simmatrix
   int32 DYN_lastrc_maxscore;   /* Max score within last row and column
@@ -74,47 +81,31 @@ public:
 protected:
   MIRAParameters * DYN_miraparams;
 
+  uint8    DYN_valid;
+
   static int32 DYN_match_matrix[DYN_MATSIZE][DYN_MATSIZE];
   static int16 DYN_matvalid;
 
   char   * DYN_sequence1;         // sequence 1
   char   * DYN_sequence2;         // sequence 2
 
-  uint32   DYN_s1size;            // size of seq1 array
-  uint32   DYN_s2size;            // size of seq2 array
+  int32    DYN_s1size;            // size of seq1 array
+  int32    DYN_s2size;            // size of seq2 array
 
-  uint32   DYN_len_seq1;          //  and its length are the ROWS
-  uint32   DYN_len_seq2;          //  and its length are the COLUMNS
+  int32    DYN_len_seq1;          //  and its length are the ROWS
+  int32    DYN_len_seq2;          //  and its length are the COLUMNS
 
   int32    DYN_knowngaps;         /* number of gaps that need to be additionally
 				     accounted for as these were seen in the
 				     sequences */
 
-  int32  * DYN_simmatrix;        /* Similarity matrix, always big enough to contain at least
-				    (ROWS+1)*(COLUMNS+1) elements */
-  uint32   DYN_smsize;           // size of the matrix;
+  int32  * DYN_simmatrix;        /* Similarity matrix, always
+				    (ROWS+1)*(COLUMNS+1) big */
+  int32    DYN_smsize;           // size of the matrix;
 
-  int32    DYN_leftbandx;        // x coordinate where left band diagonal cuts x axis (or DYN_BANDLIMIT if unused)
-  int32    DYN_rightbandx;       // x coordinate where right band diagonal cuts x axis (or DYN_BANDLIMIT if unused)
-  int32    DYN_bandsafety;       // how much safety buffer to have when looking for band hit
-                                 //  atm: 1% of expected overlap, min 1, max 15
-
-  int32    DYN_bandwidth;        // stored by computeBSimMatrix(): effective bandwidth used in last SW calc
-
-  // deferred calculation of matrix (handled by Align class)
-  bool   DYN_validseq;            // do we have valid sequences?
-  bool   DYN_matrixcalculated;    // has the matrix for the sequences been calulated
-  bool   DYN_calcwithoffset;      // calculate with offset?
-  int32  DYN_eoffset;             // what offset
-
-  suseconds_t DYN_timing_bswmatrix;  // time last bsw took
-  suseconds_t DYN_timing_bswm_setup;
-  suseconds_t DYN_timing_bswm_p1;
-  suseconds_t DYN_timing_bswm_p2a;
-  suseconds_t DYN_timing_bswm_p2b;
-  suseconds_t DYN_timing_bswm_p3;
-  suseconds_t DYN_timing_bswm_cleanband;
-  suseconds_t DYN_timing_seqcopy;
+  // for bug tracking in coutWhatWasGiven()
+  bool   DYN_calcwithoffset;
+  int32  DYN_eoffset;
 
 private:
   void foolCompiler();
@@ -124,16 +115,13 @@ private:
   void matinit(char a, char b, int32 score);
   void init();
 
-  void computeSimMatrix();
-  void computeBSimMatrix();
-
 public:
   Dynamic(MIRAParameters * params);
   Dynamic(MIRAParameters * params,
 	  const char * seq1,
-	  uint32 len1,
+	  uint32 len1, 
 	  const char * seq2,
-	  uint32 len2,
+	  uint32 len2, 
 	  bool calcwithoffset=true,
 	  int32 expectedoffset=0);
   virtual ~Dynamic();
@@ -146,7 +134,9 @@ public:
 		    bool calcwithoffset=true,
 		    int32 expectedoffset=0);
   void dump();
-  void computeMatrix();
+  void computeSimMatrix();
+  void computeBSimMatrix();
+  void computeBSimMatrix(int32 eoffset);
 
   void coutWhatWasGiven();
 };
diff --git a/src/mira/enums.H b/src/mira/enums.H
index 7ed69cf..ed3610e 100644
--- a/src/mira/enums.H
+++ b/src/mira/enums.H
@@ -11,17 +11,17 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
 #ifndef _mira_enums_h_
@@ -32,11 +32,19 @@ enum analysejob {ANALYSE_NONE=0, ANALYSE_TEXT, ANALYSE_SIGNAL};
 enum externalqual {E_QUAL_NONE=0, E_QUAL_SCF};
 enum extendreads {EXTEND_NONE=0, EXTEND_BOLD};
 
+enum readnaming_scheme {SCHEME_SANGER=0,
+			SCHEME_TIGR,
+			SCHEME_FR,          // .f, .r
+			SCHEME_SOLEXA,      // /1, /2
+			SCHEME_STLOUIS,
+			SCHEME_NONE,
+			SCHEME_UNKNOWN};
+
 
 
 #endif
 
 
-// Local Variables:
+// Local Variables: 
 // mode: C++
-// End:
+// End: 
diff --git a/src/mira/estassembly.C b/src/mira/estassembly.C
index 117a1f7..d884842 100644
--- a/src/mira/estassembly.C
+++ b/src/mira/estassembly.C
@@ -9,24 +9,28 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
+// 	$Id$	
+
+#ifndef lint
+static char vcid[] = "$Id$";
+#endif /* lint */
+
 #include "assembly.H"
 
-#define CEBUG(bla)
 
-using namespace std;
 
 /*************************************************************************
  * works a bit like assemble()
@@ -44,18 +48,14 @@ using namespace std;
  *************************************************************************/
 
 //#define CEBUG(bla)   {cout << bla; cout.flush(); }
-
-#if 0
 vector<string> Assembly::assembleESTs()
 {
+  (void) vcid;
+
   FUNCSTART("Assembly::assembleESTs()");
 
   //AS_miraparams[0].setPathfinderuseGenomicAlgorithms(true);
 
-  BUGIFTHROW(true,"need redo for PlacedContigReads");
-
-  vector<string> returns;
-
   assemble();
   saveResults();
 
@@ -68,54 +68,56 @@ vector<string> Assembly::assembleESTs()
       if(cI->getNumReadsInContig()<2) {
 	continue;
       }
-      for(auto pcrI=cI->getContigReads().begin(); pcrI != cI->getContigReads().end(); ++pcrI){
-	if(pcrI.getORPID() >=0 ) goodreads[pcrI.getORPID()]=true;
+      const vector<Contig::contigread_t> & cr= cI->getContigReads();
+      for(uint32 j=0; j<cr.size(); j++){
+	if(cr[j].orpid>=0) goodreads[cr[j].orpid]=true;
       }
     }
-
-    for(uint32 ri=0; ri < AS_readpool.size(); ++ri) {
+    
+    for(uint32 i=0; i<AS_readpool.size(); i++) {
       try {
-	if(AS_readpool[ri].hasTag(Read::REA_tagentry_idSROr)) goodreads[ri]=true;
-	if(AS_readpool[ri].hasTag(Read::REA_tagentry_idSIOr)) goodreads[ri]=true;
-	if(AS_readpool[ri].hasTag(Read::REA_tagentry_idSAOr)) goodreads[ri]=true;
-	if(AS_readpool[ri].hasTag(Read::REA_tagentry_idSRMr)) goodreads[ri]=true;
-	if(AS_readpool[ri].hasTag(Read::REA_tagentry_idWRMr)) goodreads[ri]=true;
+	if(AS_readpool.getRead(i).hasTag(Read::REA_tagentry_idSROr)) goodreads[i]=true;
+	if(AS_readpool.getRead(i).hasTag(Read::REA_tagentry_idSIOr)) goodreads[i]=true;
+	if(AS_readpool.getRead(i).hasTag(Read::REA_tagentry_idSAOr)) goodreads[i]=true;
+	if(AS_readpool.getRead(i).hasTag(Read::REA_tagentry_idSRMr)) goodreads[i]=true;
+	if(AS_readpool.getRead(i).hasTag(Read::REA_tagentry_idWRMr)) goodreads[i]=true;
       }
       catch(...){
-	CEBUG("Caught: " << AS_readpool[ri].getName() << '\n');
+	CEBUG("Caught: " << AS_readpool.getRead(i).getName() << '\n');
       }
-      CEBUG("GR[" << AS_readpool[ri].getName() << "]: " << goodreads[ri] << endl);
+      CEBUG("GR[" << AS_readpool.getRead(i).getName() << "]: " << goodreads[i] << endl);
     }
   }
-
+  
   vector<int32> goodstrainids;
   vector<string> goodstrainnames;
-  for(uint32 ri=0; ri < AS_readpool.size(); ++ri){
-    if(find(goodstrainids.begin(),
+  for(uint32 i=0; i<AS_readpool.size();i++){
+    if(find(goodstrainids.begin(), 
 	    goodstrainids.end(),
-	    AS_readpool[ri].getStrainID()) == goodstrainids.end()) {
-      goodstrainids.push_back(AS_readpool[ri].getStrainID());
-      if(AS_readpool[ri].getStrainName().size()>0){
-	goodstrainnames.push_back(AS_readpool[ri].getStrainName());
+	    AS_readpool.getRead(i).getStrainID()) == goodstrainids.end()) {
+      goodstrainids.push_back(AS_readpool.getRead(i).getStrainID());
+      if(AS_readpool.getRead(i).getStrain().size()>0){
+	goodstrainnames.push_back(AS_readpool.getRead(i).getStrain());
       }else{
 	goodstrainnames.push_back("default");
       }
     }
   }
 
+  vector<string> returns;
   {
     string basename=AS_miraparams[0].getAssemblyParams().as_projectname_out;
     Read::setCoutType(Read::AS_CAF);
-    for(uint32 gsi=0; gsi < goodstrainids.size(); ++gsi){
-      cout << "Writing CAF for reads for strain " << goodstrainnames[gsi] << endl;
-      string filename=basename+"_snpsinSTRAIN_"+goodstrainnames[gsi]+".caf";
+    for(uint32 i=0; i<goodstrainids.size(); i++){
+      cout << "Writing CAF for reads for strain " << goodstrainnames[i] << endl;
+      string filename=basename+"_snpsinSTRAIN_"+goodstrainnames[i]+".caf";
       returns.push_back(filename);
-      returns.push_back(goodstrainnames[gsi]);
+      returns.push_back(goodstrainnames[i]);
       ofstream cafout(filename.c_str(), ios::out | ios::trunc);
-      for(uint32 ri=0; ri<AS_readpool.size(); ++ri){
-	if(goodreads[ri]==true && AS_readpool[ri].getStrainID()==goodstrainids[gsi]){
-	  AS_readpool[ri].removeGapsFromRead();
-	  cafout << AS_readpool[ri];
+      for(uint32 j=0; j<AS_readpool.size(); j++){
+	if(goodreads[j]==true && AS_readpool.getRead(j).getStrainID()==goodstrainids[i]){
+	  AS_readpool.getRead(j).removeGapsFromRead();
+	  cafout << AS_readpool.getRead(j);
 	}
       }
       cafout.close();
@@ -127,10 +129,10 @@ vector<string> Assembly::assembleESTs()
       returns.push_back(filename);
       returns.push_back("remain");
       ofstream cafout(filename.c_str(), ios::out | ios::trunc);
-      for(uint32 ri=0; ri<AS_readpool.size(); ++ri){
-	if(goodreads[ri]==false) {
-	  AS_readpool[ri].removeGapsFromRead();
-	  cafout << AS_readpool[ri];
+      for(uint32 j=0; j<AS_readpool.size(); j++){
+	if(goodreads[j]==false) {
+	  AS_readpool.getRead(j).removeGapsFromRead();
+	  cafout << AS_readpool.getRead(j);
 	}
       }
       cafout.close();
@@ -144,4 +146,3 @@ vector<string> Assembly::assembleESTs()
 }
 //#define CEBUG(bla)   {cout << bla; cout.flush(); }
 
-#endif
diff --git a/src/mira/gbf_parse.H b/src/mira/gbf_parse.H
deleted file mode 100644
index 88b107d..0000000
--- a/src/mira/gbf_parse.H
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 2003 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-#ifndef _bas_gbf_h_
-#define _bas_gbf_h_
-
-
-#include <iostream>
-#include <fstream>
-#include <string>
-
-#include <unordered_map>
-
-#include "stdinc/defines.H"
-#include "errorhandling/errorhandling.H"
-
-class multitag_t;
-
-//// apparently, some systems may lack isblank() although it's part
-////  of C99
-//// patch kindly provided by
-////  Alfredo Jose Hernandez Alvarez <ajhernan at lcg.unam.mx>
-
-#if HAVE_ISBLANK == 0
-#define isblank(c) ((c) == ' ' || (c) == '\t')
-#endif
-
-
-class GBF
-{
-  //Variables
-private:
-  static const bool GBF_staticfeaturesinit;
-
-  uint32 GBF_valid;
-
-  std::vector<std::string>          GBF_sequencenames;
-  std::vector<std::string>          GBF_sequences;
-  std::vector<std::vector<multitag_t> >  GBF_tags;
-
-  static const char * GBF_miragbfscankeys[];        /* keys used by MIRA to check if comments were stored
-							 in "old GenBank" manner */
-
-  static const char * GBF_oldmiragbf2gff3translations[];
-
-  // maps to convert GFF features to "gap4" features"
-  typedef std::unordered_map<std::string, std::string> strstrmap;
-  static strstrmap GBF_mapoldmiragbf2gff3;
-
-
-
-public:
-
-
-  //Functions
-private:
-  void foolCompiler();
-  void init();
-  void zeroVars();
-
-  void loadTheFile(std::ifstream & gbfin, uint64 lentoreserve);
-  void getNextToken(const std::string & line,
-		    std::string::size_type & linepos,
-		    std::string & token,
-		    std::string::size_type & postokenstart) const;
-
-  //const char * getFeatureIdentifier(const std::string & feature) const;
-
-//  void addKeyVal2TagComment(const std::string & actkey,
-//			    const std::string & actval,
-//			    tag_t & thetag) const;
-//  void storeAccumulatedTags(tag_t & acttag, std::vector<int32> & fromto);
-
-  void addKeyVal2TagComment(const std::string & actkey,
-			    const std::string & actval,
-			    std::string & comment) const;
-  void storeAccumulatedTags(const std::string & guessedname,
-			    const std::string & identifier,
-			    const std::string & comment,
-			    std::vector<int32> & fromto);
-
-  void parseGBFLocation(const std::string & location,
-			std::vector<int32> & fromto,
-			int32 direction) const;
-  std::string::size_type getCorrespondingRightBracket(const std::string & chars,
-						 std::string::size_type start) const;
-  void correctForTagPositionErrors(const std::string & gbfname);
-
-  static void fillFeatureTranslationVectors();
-
-  static bool staticInitialiser();
-
-public:
-  GBF();
-  GBF(GBF const &other);
-  ~GBF();
-
-  GBF const & operator=(GBF const & other);
-  friend std::ostream & operator<<(std::ostream &ostr, GBF const & gbf);
-
-  void discard();
-
-  void load(const std::string & gbfname);
-  size_t getNumSequences() const {return GBF_sequences.size();}
-  const std::string & getSequenceName(uint32 i) const;
-  const std::string & getSequence(uint32 i) const;
-  const std::vector<multitag_t> & getTags(uint32 i) const;
-
-  void transferGeneInfoToCDSInfo();
-
-  static bool checkIfCommentInOldMIRAGBFstyle(const std::string & comment);
-
-  static void liftOldMIRAGBFCommentToGFF3(const std::string & src, std::string & dst);
-};
-
-
-#endif
diff --git a/src/mira/gff_parse.C b/src/mira/gff_parse.C
index 7b0203f..6461323 100644
--- a/src/mira/gff_parse.C
+++ b/src/mira/gff_parse.C
@@ -9,55 +9,103 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
+#ifndef lint
+static char vcid[] = "$Id$";
+#endif /* lint */
+
 // for boost::trim, split
 #include <boost/algorithm/string.hpp>
 
 #include "mira/gff_parse.H"
+#include "util/progressindic.H"
 
-#include "io/annotationmappings.H"
-#include "errorhandling/errorhandling.H"
+// do not delete last (empty) entry in field below, it's needed
+//  in GBF::fillFeatureTranslationVectors()
+const char * GFFParse::GFFP_featuretranslations[]= {
+  "MFSM","MFSM",
+
+  "binding_site","Fm-b",
+  "CDS","FCDS",
+  "contig","Fctg",                  // new for gap4!
+  "exon","Fexn",
+  "gap","Fgap",                     // new for gap4!
+  "gene","Fgen",
+  "long_terminal_repeat","FLTR",
+  "mobile_element","Fmel",          // new for gap4!
+  "mRNA","FmRN",
+  "ncRNA","FncR",                   // new for gap4!
+  "origin_of_replication","Frpo",
+  "pseudogene","Fpgn",              // new for gap4!
+  "pseudogenic_exon","Fpxn",        // new for gap4!
+  "pseudogenic_region","Fprg",      // new for gap4!
+  "pseudotRNA","FptR",              // new for gap4!
+  "recombination_feature","Fm-r",
+  "region","Freg",                  // new for gap4!
+  "regulatory_region","Frrg",       // new for gap4!
+  "repeat_region","Frpr",
+  "rRNA","FrRN",
+  "sequence_difference","Fm-d",
+  "tRNA","FtRN",
+  "tmRNA","FtmR",                   // new for gap4!
+  "processed_transcript","Fptr",    // new for gap4
+  ""
+};
+
+GFFParse::strstrmap GFFParse::GFFP_mapgff2gap4;
+GFFParse::strstrmap GFFParse::GFFP_mapgap42gff;
+
+// keep this last
+const bool GFFParse::GFFP_staticfeaturesinit=GFFParse::staticInitialiser();
+
+
+bool GFFParse::staticInitialiser()
+{
+  FUNCSTART("bool GFFParse::staticInitialiser()");
 
-#include "util/progressindic.H"
-#include "mira/readpool.H"
-#include "mira/multitag.H"
+  uint32 i=0;
+  while(strlen(GFFP_featuretranslations[i]) != 0) {
+    GFFParse::GFFP_mapgff2gap4[GFFP_featuretranslations[i]]=GFFParse::GFFP_featuretranslations[i+1];
+    GFFParse::GFFP_mapgap42gff[GFFP_featuretranslations[i+1]]=GFFParse::GFFP_featuretranslations[i];
+    i+=2;;
+  }
 
-using namespace std;
+  FUNCEND();
+  return true;
+}
 
-#define CEBUG(bla)
 
+void GFFParse::foolCompiler()
+{
+#include "stdinc/foolcompiler.C"
+}
 
 // Plain vanilla constructor
-GFFParse::GFFParse(ReadPool * rp)
+GFFParse::GFFParse()
 {
-  FUNCSTART("GFFParse::GFFParse(ReadPool * rp)");
+  FUNCSTART("GFFParse::GFFParse()");
 
   zeroVars();
   init();
 
-  GFFP_readpool=rp;
-
   FUNCEND();
 }
 
 void GFFParse::zeroVars()
 {
   FUNCSTART("void GFFParse::zeroVars()");
-
-  GFFP_readpool=nullptr;
-
   FUNCEND();
 }
 
@@ -135,7 +183,7 @@ const string & GFFParse::getSequenceName(uint32 i) const
   FUNCSTART("const string & GFFParse::getSequenceName(uint32 i) const");
 
   if(i>=GFFP_seqnames.size()){
-    MIRANOTIFY(Notify::WARNING, ": Tried to get out of range sequence name.");
+    throw Notify(Notify::WARNING, THISFUNC, ": Tried to get out of range sequence name.");
   }
 
   FUNCEND();
@@ -154,7 +202,7 @@ const string & GFFParse::getSequence(uint32 i) const
   FUNCSTART("const string & GFFParse::getSequence(uint32 i) const");
 
   if(i>=GFFP_sequences.size()){
-    MIRANOTIFY(Notify::WARNING, ": Tried to get out of range sequence.");
+    throw Notify(Notify::WARNING, THISFUNC, ": Tried to get out of range sequence.");
   }
 
   FUNCEND();
@@ -173,7 +221,7 @@ const vector<multitag_t> & GFFParse::getTags(uint32 i) const
   FUNCSTART("const vector<tag_t> & GFFParse::getTags(uint32 i) const");
 
   if(i>=GFFP_sequencetags.size()){
-    MIRANOTIFY(Notify::WARNING, ": Tried to get out of range tags.");
+    throw Notify(Notify::WARNING, THISFUNC, ": Tried to get out of range tags.");
   }
 
   FUNCEND();
@@ -183,16 +231,9 @@ const vector<multitag_t> & GFFParse::getTags(uint32 i) const
 
 
 
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
 
 
-// substr vector passed by reference: avoid constructing vector n times
+// substr vector passed by reference: avoid constructing vector n times 
 void GFFParse::parseNormalGFFLine(const string & line, const uint64 lineno, vector<string> & substrs)
 {
   substrs.clear();
@@ -208,11 +249,18 @@ void GFFParse::parseNormalGFFLine(const string & line, const uint64 lineno, vect
   if(snI != GFFP_snmap.end()){
     snmindex=snI->second;
   }else{
-    GFFP_snmap[substrs[0]]=GFFP_seqnames.size();
-    snmindex=GFFP_seqnames.size();
-    GFFP_seqnames.push_back(substrs[0]);
-    GFFP_sequences.resize(GFFP_sequences.size()+1);
-    GFFP_sequencetags.resize(GFFP_sequences.size()+1);
+    if(substrs[2]=="contig"){
+      GFFP_snmap[substrs[0]]=GFFP_seqnames.size();
+      snmindex=GFFP_seqnames.size();
+      GFFP_seqnames.push_back(substrs[0]);
+      GFFP_sequences.resize(GFFP_sequences.size()+1);
+      GFFP_sequencetags.resize(GFFP_sequences.size()+1);
+    }else{
+      cout << "Line " << lineno << ": new sequence name " << substrs[0] 
+	   << ", expected 'contig', found '" << substrs[2] << "'\n";
+      if(GFFP_errorstatus<2) GFFP_errorstatus=2;
+      return;
+    }
   }
 
   GFFP_sequencetags[snmindex].resize(GFFP_sequencetags[snmindex].size()+1);
@@ -221,135 +269,84 @@ void GFFParse::parseNormalGFFLine(const string & line, const uint64 lineno, vect
   multitag_t & newtag=GFFP_sequencetags[snmindex].back();
 
   newtag.source=multitag_t::MT_tagsrcentry_idGFF3;
-  if(substrs[1]!="."){
-    newtag.setSourceStr(substrs[1]);
-  }
 
   newtag.from=atoi(substrs[3].c_str());
   newtag.to=atoi(substrs[4].c_str());
 
   if(newtag.from==0){
-    cout << "Line " << lineno
+    cout << "Line " << lineno 
 	 << ": position 'from' (field 4," << newtag.from << ") is 0? Coordinates in GFF files should have 1 as lowest value.\n";
     if(GFFP_errorstatus<2) GFFP_errorstatus=2;
   }else{
     --newtag.from;
   }
   if(newtag.to==0){
-    cout << "Line " << lineno
+    cout << "Line " << lineno 
 	 << ": position 'to' (field 5," << newtag.to << ") is 0? Coordinates in GFF files should have 1 as lowest value.\n";
     if(GFFP_errorstatus<2) GFFP_errorstatus=2;
   }else{
     --newtag.to;
   }
-
-  if(!substrs[2].empty()){
-    newtag.identifier=multitag_t::newIdentifier(substrs[2]);
-    if(!AnnotationMappings::isValidGFF3SOEntry(substrs[2])){
-      if(AnnotationMappings::translateOldSOfeat2SOfeat(substrs[2]).empty()){
-	cout << "Line " << lineno
-	     << ": MIRA does not know type '" << substrs[2] << "' in column 3 of the GFF3 fle\n";
-	if(GFFP_errorstatus<1) GFFP_errorstatus=1;
-      }else{
-	newtag.identifier=multitag_t::newIdentifier(AnnotationMappings::translateOldSOfeat2SOfeat(substrs[2]));
-      }
-    }
-  }
-
+    
   if(substrs[6].empty()){
-    cout << "Line " << lineno
-	 << ": field 7 may only be '+', '-', '.' or '?', but found empty string\n";
-    newtag.setStrand('=');
+    cout << "Line " << lineno 
+	 << ": field 7 may only be '+', '-' or '=', but found empty string\n";
+    newtag.strand='=';
     if(GFFP_errorstatus<2) GFFP_errorstatus=2;
   }else if(substrs[6]!="+" && substrs[6]!="-"){
-    if(substrs[6]!="." && substrs[6]!="?"){
-      cout << "Line " << lineno
-	   << ": direction in field 7 may only be '+', '-', '.' or '?', but found '"
-	   << substrs[6] << "'\n";
-      if(GFFP_errorstatus<2) GFFP_errorstatus=2;
-    }
-    newtag.setStrand('=');
-  }else{
-    newtag.setStrand(substrs[6][0]);
-  }
-
-  if(substrs[7].size() != 1){
-    cout << "Line " << lineno
-	 << ": for CDS, field 8 may only be '0', '1' or '2', but found empty string\n";
+    cout << "Line " << lineno 
+	 << ": direction in field 7 may only be '+', '-' or '=', but found '" 
+	 << substrs[6] << "'\n";
+    newtag.strand='=';
     if(GFFP_errorstatus<2) GFFP_errorstatus=2;
   }else{
-    switch(substrs[7][0]){
-    case '0' : { newtag.phase=0; break; }
-    case '1' : { newtag.phase=1; break; }
-    case '2' : { newtag.phase=2; break; }
-    case '.' : { newtag.phase=3; break; }
-    default : {
-      cout << "Line " << lineno
-	   << ": field 8 may only be '0', '1' , '2' or '.', but found string '"
-	   << substrs[7] << "'\n";
-      if(GFFP_errorstatus<2) GFFP_errorstatus=2;
-    }
-    }
+    newtag.strand=substrs[6][0];
   }
 
-  string setcomment;
-  string tmpcomment;
-
-  if(!substrs[8].empty() || !substrs[5].empty()){
-    if(substrs[5].empty() || substrs[5] == "."){
-      tmpcomment=substrs[8];
+  if(!substrs[2].empty()){
+    string gap4id=translateGFFfeat2GAP4feat(substrs[2]);
+    if(gap4id.empty()){
+      cout << "Line " << lineno 
+	   << ": MIRA does not know type '" << substrs[2] << "'\n";
+      if(GFFP_errorstatus<1) GFFP_errorstatus=1;
+      newtag.identifier=multitag_t::newIdentifier(substrs[2]);
     }else{
-      if(substrs[8].empty()){
-	tmpcomment="gff3sco="+substrs[5];
-      }else{
-	tmpcomment=substrs[8]+";gff3sco="+substrs[5];
-      }
+      newtag.identifier=multitag_t::newIdentifier(gap4id);
     }
   }
-
-  string miraitag;
-  {
-    string g3source;
-    char   g3strand;
-    uint8  g3phase;
-    extractMIRAGFF3InfoFromGFF3Attributes(tmpcomment,
-					  setcomment,
-					  g3source,
-					  g3strand,
-					  g3phase,
-					  miraitag);
+  if(!substrs[8].empty()){
+    newtag.comment=multitag_t::newComment(substrs[8]);
   }
 
-  if(!miraitag.empty()) {
-    newtag.identifier=multitag_t::newIdentifier(miraitag);
+  if(substrs[2]=="CDS"){
+    if(substrs[7].empty()){
+      cout << "Line " << lineno 
+	   << ": for CDS, field 8 may only be '0', '1' or '2', but found empty string\n";
+      if(GFFP_errorstatus<2) GFFP_errorstatus=2;
+    }else if(substrs[7] != "0"
+	     && substrs[7] != "1"
+	     && substrs[7] != "2"){
+      //cout << "Line " << lineno 
+      //	   << ": for CDS, field 8 may only be '0', '1' or '2', but found string '" 
+      //	   << substrs[7] << "'\n";
+      //if(GFFP_errorstatus<2) GFFP_errorstatus=2;
+    }
   }
-
-  newtag.comment=multitag_t::newComment(setcomment);
-
-
-  newtag.commentisgff3=true;
 }
 
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
 void GFFParse::loadFile(const string & filename)
 {
   FUNCSTART("void GFFParse::loadFile(const string & filename)");
 
   ifstream gffin;
-  //size_t numseqsloaded=0;
+  size_t numseqsloaded=0;
   uint64 lineno=0;
 
   GFFP_errorstatus=0;
 
   gffin.open(filename.c_str(), ios::in|ios::ate);
   if(!gffin) {
-    MIRANOTIFY(Notify::FATAL, "GFF file not found for loading:" << filename);
+    MIRANOTIFY(Notify::FATAL, "GFF file not found for loading:" << filename); 
   }
   if(!gffin.tellg() ) {
     MIRANOTIFY(Notify::FATAL, "GFF file empty? " << filename);
@@ -378,9 +375,6 @@ void GFFParse::loadFile(const string & filename)
 	}
       }else{
 	parseNormalGFFLine(actline,lineno,substrs);
-	if(GFFP_errorstatus>0) {
-	  MIRANOTIFY(Notify::FATAL,"Ooops?! Please have a look at that line:\n" << actline << "\n");
-	}
       }
     }
     if(P.delaytrigger()) P.progress(gffin.tellg());
@@ -402,7 +396,6 @@ void GFFParse::loadFile(const string & filename)
 	  // if not, do not save as this is either a protein or a bogus file
 	  if(saveseq){
 	    strintmap::iterator snI=GFFP_snmap.find(tmpsname);
-	    BUGIFTHROW(snI == GFFP_snmap.end(),"snI == GFFP_snmap.end() ???");
 	    //cout << "Must save " << tmpsname << "\t" << snI->second << endl;
 	    GFFP_sequences[snI->second].swap(tmpseq);
 	  }
@@ -411,31 +404,14 @@ void GFFParse::loadFile(const string & filename)
 	  tokenend=actline.find_first_of(blanks,0);
 	  if(tokenend==string::npos) tokenend=actline.size();
 	  tmpsname=actline.substr(1, tokenend-1);
-	  CEBUG("tmpsname: " << tmpsname << endl);
 
 	  saveseq=false;
 	  // see whether we will need to save this sequence
 	  strintmap::iterator snI=GFFP_snmap.find(tmpsname);
 	  if(snI != GFFP_snmap.end()){
 	    saveseq=true;
-	  }else{
-	    // sequence name not found ... yet
-	    // it may be a NCBI format line though, so check for that
-	    if(tmpsname.size() > 3
-	       && tmpsname[0]=='g'
-	       && tmpsname[1]=='i'
-	       && tmpsname[2]=='|'){
-	      // OK, this *might* be a GI line
-	      vector<string> subnames;
-	      boost::split(subnames, tmpsname, boost::is_any_of("|"));
-	      if(subnames.size()==5){
-		// bloody well looks like an NCBI style name line. Extract the real sequence name
-		swap(tmpsname,subnames[3]);
-		saveseq=true;
-	      }
-	    }
 	  }
-	  CEBUG("Seeing new seqname ###"<<tmpsname<<"###\n");
+	  //cout << "Seeing new seqname ###"<<tmpsname<<"###\n";
 	}else{
 	  // only spend time if it's a sequence we will keep
 	  // (and not a protein or something)
@@ -462,12 +438,7 @@ void GFFParse::loadFile(const string & filename)
 
   gffin.close();
 
-  if(GFFP_errorstatus==0) {
-    cout << "Loading finished OK, checking tags\n";
-    checkTagsOnceLoaded();
-  }else{
-    cout << "Loading finished not OK: " << GFFP_errorstatus << endl;
-  }
+  if(GFFP_errorstatus==0) checkTagsOnceLoaded();
 
   if(GFFP_errorstatus > 0){
     if(GFFP_errorstatus == 1){
@@ -480,13 +451,6 @@ void GFFParse::loadFile(const string & filename)
   FUNCEND();
 }
 
-/*************************************************************************
- *
- * Side effect: if readpool given and the GFF had annotations for a read
- *  in that readpool, then a name index is created in the read pool
- *
- *************************************************************************/
-
 void GFFParse::checkTagsOnceLoaded()
 {
   FUNCSTART("void GFFParse::checkTagsOnceLoaded()");
@@ -494,47 +458,29 @@ void GFFParse::checkTagsOnceLoaded()
   bool errorsfound=false;
   for(size_t snmindex=0; snmindex<GFFP_seqnames.size(); ++snmindex){
     if(GFFP_sequences[snmindex].empty() && !GFFP_sequencetags.empty()){
-      if(GFFP_readpool!=nullptr){
-	GFFP_readpool->allowNameIndex(true);
-	auto rid=GFFP_readpool->getReadIndex(GFFP_seqnames[snmindex]);
-	if(rid>=0) continue;
-	cout << "Sequence " << GFFP_seqnames[snmindex] << " has elements defined on sequence, but no sequence and none of the previously loaded sequences matches. Please make sure that files with sequence data belonging to " << GFFP_seqnames[snmindex] << " were loaded before the annotation in this GFF file.\n";
-      }else{
-	cout << "Sequence " << GFFP_seqnames[snmindex] << " has elements defined on sequence, but no sequence?\n";
-      }
+      cout << "Sequence " << GFFP_seqnames[snmindex] << " has elements defined on sequence, but no sequence?\n";
       errorsfound=true;
       if(GFFP_errorstatus<2) GFFP_errorstatus=2;
     }
   }
 
-  if(errorsfound) {
-    if(GFFP_readpool!=nullptr){
-      GFFP_readpool->allowNameIndex(false);
-    }
-    return;
-  }
+  if(errorsfound) return;
 
   for(size_t snmindex=0; snmindex<GFFP_seqnames.size(); ++snmindex){
     vector<multitag_t>::iterator mtI=GFFP_sequencetags[snmindex].begin();
     //cout << "checking " << GFFP_seqnames[snmindex] <<endl;
-    size_t seqsize=GFFP_sequences[snmindex].size();
-    if(seqsize==0){
-      auto rid=GFFP_readpool->getReadIndex(GFFP_seqnames[snmindex]);
-      BUGIFTHROW(rid < 0,"rid < 0 not expected here at this stage");
-      seqsize=GFFP_readpool->getRead(rid).getLenSeq();
-    }
     for(; mtI != GFFP_sequencetags[snmindex].end(); ++mtI){
-      if(mtI->from>=seqsize){
+      if(mtI->from>=GFFP_sequences[snmindex].size()){
 	errorsfound=true;
 	cout << "Sequence " << GFFP_seqnames[snmindex]
-	     << ": position 'from' (field 4, value " << mtI->from+1 << ") is larger than the sequence size (" << seqsize << "," << GFFP_seqnames[snmindex] << "): " << mtI->getCommentStr() << '\n';
+	     << ": position 'from' (field 4," << mtI->from << ") is larger than the sequence size (" << GFFP_sequences[snmindex].size() << "," << GFFP_seqnames[snmindex] << "): " << mtI->getCommentStr() << '\n';
 	if(GFFP_errorstatus<2) GFFP_errorstatus=2;
       }
-
-      if(mtI->to>=seqsize){
+      
+      if(mtI->to>=GFFP_sequences[snmindex].size()){
 	errorsfound=true;
 	cout << "Sequence " << GFFP_seqnames[snmindex]
-	     << ": position 'to' (field 5, value " << mtI->to+1 << ") is larger than the sequence size (" << seqsize << "," << GFFP_seqnames[snmindex] << "): " << mtI->getCommentStr() << '\n';
+	     << ": position 'to' (field 5," << mtI->to << ") is larger than the sequence size (" << GFFP_sequences[snmindex].size() << "," << GFFP_seqnames[snmindex] << "): " << mtI->getCommentStr() << '\n';
 	if(GFFP_errorstatus<2) GFFP_errorstatus=2;
       }
     }
@@ -545,312 +491,18 @@ void GFFParse::checkTagsOnceLoaded()
 
 
 
-///*************************************************************************
-// *
-// *
-// *
-// *
-// *************************************************************************/
-//
-//const string & GFFParse::translateGFFfeat2GAP4feat(const string & feature)
-//{
-//  strstrmap::iterator transI=GFFP_mapgff2gap4.find(feature);
-//  if(transI != GFFP_mapgff2gap4.end()) return transI->second;
-//
-//  return GFFP_emptystring;
-//}
-//
-//const string & GFFParse::translateGAP4feat2GFFfeat(const string & feature)
-//{
-//  strstrmap::iterator transI=GFFP_mapgap42gff.find(feature);
-//  if(transI != GFFP_mapgap42gff.end()) return transI->second;
-//
-//  return GFFP_emptystring;
-//}
-
-
-
-
-/*************************************************************************
- *
- * TODO: better / faster with regex!
- *
- *
- *************************************************************************/
-
-bool GFFParse::checkCommentForGFF3(const string & comment)
-{
-  FUNCSTART("void GFFParse::checkCommentForGFF3(const string & comment)");
-
-  if(comment.empty()) return false;
-
-  for(auto & s : GFFP_gff3scankeys) {
-    string::size_type fpos=comment.find(s);
-    if(fpos!=string::npos) return true;
-  }
-  return false;
-}
-
-
-
-
-/*************************************************************************
- *
- * In:
- *   src = attributes string
- * Out:
- *   dst = attributes string minus the encodes attributes
- *   source, strand, phase
- *
- * Note: attribute score (gff3sco) remains in string!
- * special: if strand info was not found, return value of strand == '*'
- *
- *************************************************************************/
-
-void GFFParse::extractMIRAGFF3InfoFromGFF3Attributes(const string & src, string & dst, string & source, char & strand, uint8 & phase, string & miraitag)
+const char * GFFParse::translateGFFfeat2GAP4feat(const string & feature)
 {
-  FUNCSTART("void GFFParse::extractMIRAGFF3InfoFromGFF3Attributes(const string & src, string & dst, string & source, char & strand, uint8 & phase)");
-
-  dst.clear();
-  source.clear();
-  miraitag.clear();
-  strand='*';
-  phase=3;
-
-  if(src.empty()) return;
-
-//  for(uint32 i=0; GBF_miragbfscankeys[i][0] != 0; ++i) {
-//    string::size_type fpos=comment.find(GBF_miragbfscankeys[i],0);
-//    if(fpos!=string::npos) return true;
-//  }
-
-  CEBUG("Working on " << src << endl);
-  vector<string> attributes;
-  attributes.reserve(20);
-  boost::split(attributes, src, boost::is_any_of(";"),boost::token_compress_on);
-
-  vector<string>::const_iterator aI=attributes.begin();
-  vector<string> keyvalue;
-  keyvalue.reserve(2);
-  for(; aI != attributes.end(); ++aI){
-    CEBUG("Doing " << *aI << endl);
-    keyvalue.clear();
-    boost::split(keyvalue, *aI, boost::is_any_of("="));
-
-    CEBUG("kv:");
-    for(vector<string>::iterator kvI=keyvalue.begin(); kvI != keyvalue.end(); ++kvI){
-      CEBUG(" " << *kvI);
-    }
-    CEBUG(endl);
-
-    BUGIFTHROW(keyvalue.size()>2, "Found " << keyvalue.size()-1 << " '=' signs while trying to parse " << *aI << " in attributes of comment " << src << "\nthis should not be.");
-    if(keyvalue.size()==2){
-      if(keyvalue[0] == "gff3str"){
-	boost::trim(keyvalue[1]);
-	if(!keyvalue[1].empty()) strand=keyvalue[1][0];
-      }else if(keyvalue[0] == "gff3pha"){
-	boost::trim(keyvalue[1]);
-	if(!keyvalue[1].empty()) {
-	  phase=keyvalue[1][0];
-	  switch(phase){
-	  case '0':{
-	    phase=0;
-	    break;
-	  }
-	  case '1':{
-	    phase=1;
-	    break;
-	  }
-	  case '2':{
-	    phase=2;
-	    break;
-	  }
-	  default :{
-	    phase=3;
-	  }
-	  }
-	}
-      }else if(keyvalue[0] == "gff3src"){
-	source.swap(keyvalue[1]);
-      }else if(keyvalue[0] == "miraitag"){
-	miraitag.swap(keyvalue[1]);
-      }else{
-	if(!dst.empty()){
-	  dst+=";";
-	}
-	dst+=*aI;
-      }
-    }
-  }
+  strstrmap::iterator transI=GFFP_mapgff2gap4.find(feature);
+  if(transI != GFFP_mapgff2gap4.end()) return transI->second.c_str();
 
-  FUNCEND();
-  return;
+  return "";
 }
 
-
-
-
-/*************************************************************************
- *
- * In:
- *   attributestr = attributes string
- * Out:
- *   parsed = attributes parsed into gff3attributes_t, the value strings
- *            decoded
- *
- *
- *************************************************************************/
-
-//#define CEBUG(bla)  {cout << bla; cout.flush();}
-void GFFParse::parseGFF3Attributes(const string & attributestr, gff3attributes_t & parsed)
+const char * GFFParse::translateGAP4feat2GFFfeat(const string & feature)
 {
-  parsed.clear();
-  if(attributestr.empty()) return;
-
-  vector<string> splitatts;
-  splitatts.reserve(20);
-  boost::split(splitatts, attributestr, boost::is_any_of(";"),boost::token_compress_on);
-  if(splitatts.empty()) return;
-
-  gff3tagvalue_t tmptv;
-  gff3values_t   tmpvals;
-
-  vector<string>::const_iterator saI=splitatts.begin();
-  vector<string> keyvalue;
-  keyvalue.reserve(2);
-  for(; saI != splitatts.end(); ++saI){
-    CEBUG("Doing " << *saI << endl);
-    keyvalue.clear();
-    boost::split(keyvalue, *saI, boost::is_any_of("="));
-    // there should always be exactly one '='
-    // if not, it's an illegal tag/value in the GFF3 attributes
-    if(keyvalue.size()!=2) {
-      if(keyvalue.size()==0) {
-	cout << "In attributes '" << attributestr << "': empty tag/value? Very strange ...\n";
-      }else if(keyvalue.size()==1) {
-	cout << "In attributes '" << attributestr << "': encountered tag '" << keyvalue[0] << "' but no value? Not allowed by GFF3 standard, skipping.\n";
-      }else{
-	cout << "In attributes '" << attributestr << "': encountered tag '" << keyvalue[0] << "' and the value field behind contains " << keyvalue.size()-1 << " '='-signs. Not allowed by GFF3 standard, skipping.\n";
-      }
-      continue;
-    }
-
-    parsed.push_back(tmptv);
-    parsed.back().tag=keyvalue[0];
-    tmpvals.clear();
-    CEBUG("Whatcha do on: " << keyvalue[1] << endl);
-    boost::split(tmpvals, keyvalue[1], boost::is_any_of(","));
-    CEBUG("tmpvals.size(): " << tmpvals.size() << endl);
-    gff3values_t::iterator tvI=tmpvals.begin();
-    for(; tvI!=tmpvals.end(); ++tvI){
-      parsed.back().values.resize(parsed.back().values.size()+1);
-      gff3Decode(*tvI,parsed.back().values.back());
-      CEBUG("gff3decoded: " << *tvI << "\ninto       : " << parsed.back().values.back());
-    }
-  }
-
-  return;
-}
-//#define CEBUG(bla)
-
-
-/*************************************************************************
- *
- * In:
- *   parsed = attributes as gff3attributes_t
- * Out:
- *   attributestr = attributes string, properly encoded
- *
- *
- *************************************************************************/
-void GFFParse::createGFF3AttributeString(const gff3attributes_t & attributes, string & attributestr)
-{
-  attributestr.clear();
-  string tmpcode;
-  tmpcode.reserve(128);
-
-  gff3attributes_t::const_iterator aI=attributes.begin();
-  for(uint32 acounter=0; aI != attributes.end(); ++aI, ++acounter){
-    if(acounter>0) attributestr+=';';
-    attributestr+=aI->tag;
-    attributestr+='=';
-    gff3values_t::const_iterator vI=aI->values.begin();
-    for(uint32 vcounter=0; vI != aI->values.end(); ++vI, ++vcounter){
-      if(vcounter>0) attributestr+=',';
-      gff3Code(*vI,tmpcode);
-      attributestr+=tmpcode;
-    }
-  }
-}
-
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-string GFFParse::extractCommonName(const string & attributestr, bool extended)
-{
-  static const vector<string> esearches = {
-    "name", "alias"
-  };
-  static const vector<string> ssearches = {
-    "Name", "Alias", "gene", "locus_tag"
-  };
-  static const boost::regex ipmatch("[\\.:]");
-
-  string retvalue;
-  //for(auto sI=searches.begin(); sI!=searches.end(); ++sI){
-
-  for(auto & s : ssearches){
-    retvalue=extractKeytag(s,attributestr);
-    if(!retvalue.empty()) break;
-  }
-  if(retvalue.empty()){
-    for(auto & s : esearches){
-      retvalue=extractKeytag(s,attributestr);
-      if(!retvalue.empty()) break;
-    }
-    if(!retvalue.empty() && !extended){
-      if(boost::regex_search(retvalue, ipmatch)){
-	retvalue.clear();
-      }
-    }
-  }
-
-  return retvalue;
-}
-
-
-/*************************************************************************
- *
- * e.g.: given GFF3 string with ...;Name=XXXXX;...
- *       returns XXXXX (decoded) when queried with key=="Name"
- *
- *************************************************************************/
-
-string GFFParse::extractKeytag(const string & key, const string & attributestr)
-{
-  auto reK=GFFP_regex_extractkeys.find(key);
-  if(reK==GFFP_regex_extractkeys.end()){
-    boost::regex tmp;
-    GFFP_regex_extractkeys[key]=tmp;
-    reK=GFFP_regex_extractkeys.find(key);
-    //reK->second="[^|;]"+key+"=(.*?)[;|$]";
-
-    // Non-capture group
-    // The "?:" in the second parenthesis means that the parenthesis just overrides the
-    //  precedence (the "|" is weak), but does NOT capture
-    reK->second="(?:^|;)"+key+"=(.*?)(?:;|$)";
-  }
-
-  string retvalue;
-  boost::match_results<std::string::const_iterator> matches;
-  if(boost::regex_search(attributestr, matches, reK->second)){
-    gff3Decode(matches[1],retvalue);
-  }
+  strstrmap::iterator transI=GFFP_mapgap42gff.find(feature);
+  if(transI != GFFP_mapgap42gff.end()) return transI->second.c_str();
 
-  return retvalue;
+  return "";
 }
diff --git a/src/mira/gff_parse.H b/src/mira/gff_parse.H
index 74a6bbc..d3124d2 100644
--- a/src/mira/gff_parse.H
+++ b/src/mira/gff_parse.H
@@ -9,17 +9,17 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
 #ifndef _bas_gffparse_h_
@@ -28,47 +28,34 @@
 #include <iostream>
 #include <string>
 
-#include <unordered_map>
-
-#include <boost/regex.hpp>
+#include "boost/unordered_map.hpp" 
 
 #include "stdinc/defines.H"
+#include "errorhandling/errorhandling.H"
 
-class ReadPool;
-class multitag_t;
+#include "mira/multitag.H"
 
-typedef std::vector<std::string> gff3values_t;
-struct gff3tagvalue_t {
-  std::string       tag;
-  gff3values_t values;
-};
-typedef std::list<gff3tagvalue_t> gff3attributes_t;
 
 class GFFParse
 {
   //Variables
 private:
-  static const std::string GFFP_emptystring;
-
   static const bool   GFFP_staticfeaturesinit;
+  static const char * GFFP_featuretranslations[];
 
-  static const std::vector<std::string> GFFP_gff3scankeys;
-
-  // storage for regex already used on GFF strings to extract different key/tags (Name=, Alias=, ...)
-  static std::unordered_map<std::string,boost::regex> GFFP_regex_extractkeys;
+  // maps to convert GFF features to "gap4" features"
+  typedef boost::unordered_map<std::string, std::string> strstrmap;
+  static strstrmap GFFP_mapgff2gap4;
+  static strstrmap GFFP_mapgap42gff;
 
-  std::vector<std::string> GFFP_seqnames;
-  std::vector<std::string> GFFP_sequences;
-  std::vector<std::vector<multitag_t> > GFFP_sequencetags;
+  vector<string> GFFP_seqnames;
+  vector<string> GFFP_sequences;
+  vector<vector<multitag_t> > GFFP_sequencetags;
 
   // map to sequence names (GFFP_seqnames)
-  typedef std::unordered_map<std::string, size_t> strintmap;
+  typedef boost::unordered_map<std::string, size_t> strintmap;
   strintmap GFFP_snmap;
 
-  // in case we deal with GFFs without sequence data, try to find sequences in this pool
-  // (if given)
-  ReadPool * GFFP_readpool;
-
   int32 GFFP_errorstatus;
 
 public:
@@ -81,43 +68,29 @@ private:
   void init();
   void zeroVars();
 
-  void parseNormalGFFLine(const std::string & line,
+  void parseNormalGFFLine(const string & line,
 			  const uint64 lineno,
-			  std::vector<std::string> & substrs);
+			  vector<string> & substrs);
   void checkTagsOnceLoaded();
 
 public:
-  GFFParse(ReadPool * rp=nullptr);
+  GFFParse();
+  GFFParse(GFFParse const &other);
   ~GFFParse();
 
-  GFFParse(GFFParse const &other) = delete;
-  GFFParse const & operator=(GFFParse const & other) = delete;
-
-  friend std::ostream & operator<<(std::ostream &ostr, GFFParse const &gffp);
+  GFFParse const & operator=(GFFParse const & other);
+  friend ostream & operator<<(ostream &ostr, GFFParse const &gffp);
 
   void discard();
 
-  void loadFile(const std::string & filename);
+  void loadFile(const string & filename);
   size_t getNumSequences() const { return GFFP_sequences.size();};
-  const std::string & getSequenceName(uint32 i) const;
-  const std::string & getSequence(uint32 i) const;
-  const std::vector<multitag_t> & getTags(uint32 i) const;
-
-//  static const std::string & translateGFFfeat2GAP4feat(const std::string & feature);
-//  static const std::string & translateGAP4feat2GFFfeat(const std::string & feature);
-
-  static bool checkCommentForGFF3(const std::string & comment);
-  static void extractMIRAGFF3InfoFromGFF3Attributes(const std::string & src,
-						    std::string & dst,
-						    std::string & source,
-						    char & strand,
-						    uint8 & phase,
-						    std::string & miraitag);
-  static void parseGFF3Attributes(const std::string & attributestr, gff3attributes_t & parsed);
-  static void createGFF3AttributeString(const gff3attributes_t & attributes, std::string & attributestr);
-
-  static std::string extractCommonName(const std::string & attributestr, bool extended=false);
-  static std::string extractKeytag(const std::string & key, const std::string & attributestr);
+  const string & getSequenceName(uint32 i) const;
+  const string & getSequence(uint32 i) const;
+  const vector<multitag_t> & getTags(uint32 i) const;
+
+  static const char * translateGFFfeat2GAP4feat(const string & feature);
+  static const char * translateGAP4feat2GFFfeat(const string & feature);
 
 };
 
diff --git a/src/mira/gff_save.C b/src/mira/gff_save.C
deleted file mode 100644
index 1c9f2a8..0000000
--- a/src/mira/gff_save.C
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 2003 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-#include <list>
-
-#include "errorhandling/errorhandling.H"
-
-#include "mira/gff_save.H"
-
-#include "mira/contig.H"
-
-using namespace std;
-
-
-// Plain vanilla constructor
-GFFSave::GFFSave()
-{
-  FUNCSTART("GFFSave::GFFSave()");
-
-  zeroVars();
-
-  FUNCEND();
-}
-
-void GFFSave::zeroVars()
-{
-  FUNCSTART("void GFFSave::zeroVars()");
-
-  GFFS_gff3_names.clear();
-  GFFS_gff3_paddedcons.clear();
-  GFFS_gff3_strainnames.clear();
-
-  GFFS_gff3_strainnames.push_back("AllStrains");
-  GFFS_fouts.clear();
-  GFFS_fouts.push_back(new ofstream);
-
-  FUNCEND();
-}
-
-
-GFFSave::~GFFSave()
-{
-  FUNCSTART("GFFSave::~GFFSave()");
-
-  discard();
-
-  FUNCEND();
-}
-
-
-void GFFSave::discard()
-{
-  FUNCSTART("GFFSave::discard()");
-
-  if(GFFS_foutp.is_open()) close();
-  zeroVars();
-
-  FUNCEND();
-}
-
-void GFFSave::open(const char * filename)
-{
-  FUNCSTART("void GFFSave::open(const char * filename)");
-
-  BUGIFTHROW(GFFS_foutp.is_open(),"GFFSave object already has a file open? ('"<<GFFS_foutname<<"')\n");
-
-  GFFS_foutname=filename;
-  string basename = GFFS_foutname;
-
-  GFFS_foutp.open((basename+"_AllStrains_padded.gff3").c_str(), ios::out);
-
-  GFFS_foutp << "##gff-version 3\n#written by MIRA assembler\n";
-
-  FUNCEND();
-}
-
-void GFFSave::close()
-{
-  FUNCSTART("GFFSave::close()");
-
-  BUGIFTHROW(!is_open(),"GFFSave object not opened ... why the close()?");
-
-  BUGIFTHROW(GFFS_gff3_names.size() != GFFS_gff3_paddedcons.size(),
-	     "Inconsisteny in cached data: " << GFFS_gff3_names.size() << " " << GFFS_gff3_paddedcons.size());
-
-  if(!GFFS_gff3_names.empty()){
-    GFFS_foutp << "##FASTA\n";
-    for(uint32 gffsi=1; gffsi<GFFS_fouts.size(); ++gffsi){
-      *(GFFS_fouts[gffsi]) << "##FASTA\n";
-    }
-    for(uint32 straini=0; straini<GFFS_gff3_strainnames.size(); ++straini){
-      list<string>::const_iterator nI=GFFS_gff3_names.begin();
-      list<vector<string> >::iterator mpcI=GFFS_gff3_paddedcons.begin();
-      for(; nI!=GFFS_gff3_names.end(); ++nI, ++mpcI){
-	vector<string> & vs=*mpcI;
-	if(straini<vs.size()){
-	  bool dooutput=false;
-	  if(!vs[straini].empty()){
-	    string::iterator sI=vs[straini].begin();
-	    for(; sI != vs[straini].end(); ++sI){
-	      if(*sI!='X'){
-		dooutput=true;
-		break;
-	      }
-	    }
-	  }
-	  if(dooutput){
-	    GFFS_foutp << ">" << *nI << ' ' << GFFS_gff3_strainnames[straini] << '\n';
-	    uint32 charcounter=0;
-	    string::iterator sI=vs[straini].begin();
-	    for(; sI != vs[straini].end(); ++sI, ++charcounter){
-	      if(charcounter==1200) {
-		charcounter=0;
-		GFFS_foutp << '\n';
-	      }
-	      GFFS_foutp << *sI;
-	    }
-	    GFFS_foutp << '\n';
-
-	    if(straini>0 && straini < GFFS_fouts.size()){
-	      *(GFFS_fouts[straini]) << ">" << *nI << ' ' << GFFS_gff3_strainnames[straini] << '\n';
-	      sI=vs[straini].begin();
-	      for(; sI != vs[straini].end(); ++sI){
-		if(charcounter==1200) {
-		  charcounter=0;
-		  *(GFFS_fouts[straini]) << '\n';
-		}
-		if(*sI != '*'){
-		  *(GFFS_fouts[straini]) << *sI;
-		  ++charcounter;
-		}
-	      }
-	      *(GFFS_fouts[straini]) << '\n';
-	    }
-	  }
-	}
-      }
-    }
-  }
-
-  GFFS_foutp.close();
-  for(uint32 gffsi=1; gffsi<GFFS_fouts.size(); ++gffsi){
-    GFFS_fouts[gffsi]->close();
-    delete GFFS_fouts[gffsi];
-  }
-  GFFS_fouts.clear();
-
-  zeroVars();
-
-  FUNCEND();
-}
-
-
-void GFFSave::acquireContig(Contig & con, const ReadPool & rp)
-{
-  FUNCSTART("void GFFSave::acquireContig(Contig & con, const ReadPool & rp)");
-
-  BUGIFTHROW(!is_open(),"GFFSave object not opened?");
-
-  // insert strain names newly seen in this readpool into GFFS_gff3_strainnames if needed
-  for(uint32 rpsi=0; rpsi<ReadGroupLib::getNumOfStrains(); ++rpsi){
-    if(con.getNumReadsPerStrain(rpsi)==0) continue;
-    bool found=false;
-    for(uint32 gffsi=0; gffsi < GFFS_gff3_strainnames.size(); ++gffsi){
-      if(GFFS_gff3_strainnames[gffsi] == ReadGroupLib::getStrainOfStrainID(rpsi)){
-	found=true;
-	break;
-      }
-    }
-    if(!found){
-      GFFS_gff3_strainnames.push_back(ReadGroupLib::getStrainOfStrainID(rpsi));
-      // TODO: for unpadded, also open file here
-      GFFS_fouts.push_back(new ofstream);
-      GFFS_fouts.back()->open((GFFS_foutname+"_"+ReadGroupLib::getStrainOfStrainID(rpsi)+"_unpadded.gff3").c_str(), ios::out);
-      *(GFFS_fouts.back()) << "##gff-version 3\n#written by MIRA assembler\n";
-    }
-  }
-
-//  {
-//    cout << "rp strains: " << ReadGroupLib::getNumOfStrains() << endl;
-//    for(uint32 rpsi=0; rpsi<ReadGroupLib::getNumOfStrains(); ++rpsi){
-//     cout << rpsi << "\t" << ReadGroupLib::getStrainOfStrainID(rpsi) << endl;
-//    }
-//
-//    cout << "\nGFFS_gff3_strainnames:" << endl;
-//    for(uint32 i=0; i<GFFS_gff3_strainnames.size(); ++i){
-//      cout << i << "\t" << GFFS_gff3_strainnames[i] << endl;
-//    }
-//    cout << endl;
-//  }
-
-  {
-    vector<string> tmp;
-    GFFS_gff3_paddedcons.push_back(tmp);
-    GFFS_gff3_paddedcons.back().resize(GFFS_gff3_strainnames.size());
-  }
-  GFFS_gff3_names.push_back(con.getContigName());
-
-  // now push back the strain sequences
-  vector<base_quality_t> dummyqual;
-  for(uint32 gffsi=0; gffsi<GFFS_gff3_strainnames.size(); ++gffsi){
-    int32 rpsi=-1;
-    if(gffsi>0){
-      for(rpsi=0; rpsi< static_cast<int32>(ReadGroupLib::getNumOfStrains()); ++rpsi){
-	if(GFFS_gff3_strainnames[gffsi] == ReadGroupLib::getStrainOfStrainID(rpsi)) break;
-      }
-    }
-    if(rpsi < static_cast<int32>(ReadGroupLib::getNumOfStrains())){
-      //cout << "Trying gffsi " << gffsi << " with rpsi " << rpsi << endl;
-      con.newConsensusGet(GFFS_gff3_paddedcons.back()[gffsi], dummyqual, rpsi);
-    }else{
-    }
-  }
-
-  // now print out all the tags of the backbone sequence(s)
-  // and consensus tags
-  con.dumpTagsAsGFF3(GFFS_foutp);
-
-  // TODO: for unpadded seqs
-  // start at 1, as strain "0" is the AllStrains "strain"
-  for(uint32 gffsi=1; gffsi<GFFS_gff3_paddedcons.back().size(); ++gffsi){
-    con.dumpTagsAsGFF3(*(GFFS_fouts[gffsi]), GFFS_gff3_paddedcons.back()[gffsi]);
-  }
-
-
-  FUNCEND();
-}
-
-
-
-void GFFSave::acquireRead(Read & read)
-{
-  FUNCSTART("void GFFSave::acquireRead(Read & read)");
-
-  BUGIFTHROW(!is_open(),"GFFSave object not opened?");
-
-  GFFS_gff3_names.push_back(read.getName());
-
-  {
-    vector<string> tmp;
-    GFFS_gff3_paddedcons.push_back(tmp);
-  }
-  GFFS_gff3_paddedcons.back().resize(1);
-  read.getSeqAsString(GFFS_gff3_paddedcons.back().back());
-
-  read.dumpTagsAsGFF3(GFFS_foutp);
-
-  FUNCEND();
-}
-
-
-
-//// Copy constructor
-////  no discard needed as this object will be freshly created when
-////  called through this constructor
-//GFFSave::GFFSave(GFFSave const &other)
-//{
-//  FUNCSTART("GFFSave::GFFSave(GFFSave const &other)");
-//
-//  ??_valid=0;
-//
-//  *this=other;                               // call the copy operator
-//
-//  FUNCEND();
-//}
-//
-//// Copy operator, needed by copy-constructor
-//GFFSave const & GFFSave::operator=(GFFSave const & other)
-//{
-//  FUNCSTART("GFFSave const & GFFSave::operator=(GFFSave const & other)");
-//  ERROR("Not implemented yet.");
-//  FUNCEND();
-//  return *this;
-//}
-
-//ostream & operator<<(ostream &ostr, GFFSave const &???)
-//{
-//  FUNCSTART("friend ostream & GFFSave::operator<<(ostream &ostr, const  &???)");
-//  ERROR("Not implemented yet.");
-//
-//  FUNCEND();
-//  return ostr;
-//}
diff --git a/src/mira/gff_save.H b/src/mira/gff_save.H
deleted file mode 100644
index 6a53828..0000000
--- a/src/mira/gff_save.H
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 2003 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-#ifndef _bas_gffsave_h_
-#define _bas_gffsave_h_
-
-#include <iostream>
-
-#include "stdinc/defines.H"
-
-class Read;
-class ReadPool;
-class Contig;
-
-class GFFSave
-{
-  //Variables
-private:
-  std::string   GFFS_foutname;
-  std::ofstream GFFS_foutp;      // file out for padded
-
-  std::vector<std::string> GFFS_gff3_strainnames;
-  std::vector<std::ofstream *> GFFS_fouts;      // file out for unpadded strains, size of strainnames, one for each strain
-
-  // saved data for deferred save in GFF3 format
-  std::list<std::string> GFFS_gff3_names;           // contig names
-  std::list<std::vector<std::string>> GFFS_gff3_paddedcons;      // padded contig cons, one list-element per contig, and per contig one sequence for each strain
-
-
-public:
-
-
-  //Functions
-private:
-  void foolCompiler();
-  void zeroVars();
-
-public:
-  GFFSave();
-  GFFSave(GFFSave const &other);
-  ~GFFSave();
-
-  GFFSave const & operator=(GFFSave const & other);
-  friend std::ostream & operator<<(std::ostream &ostr, GFFSave const &gffs);
-
-  void discard();
-
-  void open(const char * filename);
-  void open(const std::string & filename) {open(filename.c_str());}
-  inline bool is_open() const {return GFFS_foutp.is_open();};
-  void close();
-
-  void acquireContig(Contig & con, const ReadPool & rp);
-  void acquireRead(Read & read);
-};
-
-
-#endif
diff --git a/src/mira/hashstats.C b/src/mira/hashstats.C
deleted file mode 100644
index c3df469..0000000
--- a/src/mira/hashstats.C
+++ /dev/null
@@ -1,2894 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- * Copyright (C) 2007 and later by Bastien Chevreux
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- *
- */
-
-
-#include <boost/thread/thread.hpp>
-#include <boost/bind.hpp>
-
-#include <boost/filesystem.hpp>
-#include "boost/format.hpp"
-
-#include "errorhandling/errorhandling.H"
-
-#include "util/machineinfo.H"
-#include "util/dptools.H"
-#include "util/fileanddisk.H"
-#include "util/progressindic.H"
-
-#include "mira/hashstats.H"
-
-#include "mira/skim.H"
-#include "mira/seqtohash.H"
-#include "mira/readgrouplib.H"
-#include "mira/vhash.H"
-
-/* *sigh*
-   This is such a f*cked up construct ... I'm probably doing things wrong, but I see
-   no other way to get it linked on Apple gcc and still have moderate compile
-   turnaround times on Linux.
-   Problem:
-    - HashStatistics needs explicit template instantiation for the class (see end of file)
-    - HashStatistics became big, so the .C was splitted into two files
-    - each .C now needs an explicit template instantiation
-    - the linker on OSX then complains about duplicate symbols *argh*
-
-    Solution:
-     - make explicit template instantiation for every function -> not going to happen
-     - make "interesting" construction which includes the other .C when on OSX gcc
-       but keep it separate otherwise.
-       NOT PRETTY!
-       The #define for this is set in autoconf
- */
-
-#ifdef BOTCHEDEXPLICITINSTANTIATIONLINKER
-#define BOTCHEDEXPLICITINSTANTIATIONLINKER_HELPERDEF
-#include "mira/hashstats_sdbg.C"
-#endif
-
-
-
-using namespace std;
-
-
-//#define CEBUGFLAG
-
-#ifdef CEBUGFLAG
-#define CEBUG(bla)   {cout << bla; cout.flush();}
-#define CEBUGF(bla)  {cout << bla; cout.flush();}
-#else
-#define CEBUG(bla)
-#define CEBUGF(bla)
-#endif
-
-#ifndef PUBLICQUIET
-#define CLOCKSTEPS
-#endif
-
-#ifdef CLOCKSTEPS
-#define TEBUG(bla)   {cout << bla; cout.flush();}
-#else
-#define TEBUG(bla)
-#endif
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-
-
-// for timing a couple of things we need a "global" variable
-// let's cheat and not put that into the class
-
-#ifdef CLOCKSTEPS
-timeval HS_CHEAT_tvfill;
-#endif
-
-
-template<typename TVHASH_T>
-size_t HashStatistics<TVHASH_T>::HS_numelementsperbuffer=0;
-template<typename TVHASH_T>
-uint32 HashStatistics<TVHASH_T>::HS_hsfilemagic=0x4D4C6873;  // magic: "MLhs" MiraLibHashStat
-
-
-#ifdef HSVHM_var
-template<typename TVHASH_T>
-const TVHASH_T HashStatistics<TVHASH_T>::HS_MAXVHASHMASK(0xffffffUL);
-#endif
-
-template<typename TVHASH_T>
-TVHASH_T HashStatistics<TVHASH_T>::HS_vhashmask(0);
-
-
-/*************************************************************************
- *
- * static
- *
- *************************************************************************/
-template<typename TVHASH_T>
-uint32 HashStatistics<TVHASH_T>::byteSizeOfHash(uint32 hashlen)
-{
-  if(hashlen <= 32) return 8;
-  if(hashlen <= 64) return 16;
-  if(hashlen <= 128) return 32;
-  if(hashlen <= 256) return 64;
-  // should never arrive here
-  return -1;
-}
-
-/*************************************************************************
- *
- * for MiraDiff
- *
- *************************************************************************/
-
-template<typename TVHASH_T>
-void HashStatistics<TVHASH_T>::inANotB(HashStatistics & hsa, HashStatistics & hsb)
-{
-  FUNCSTART("void HashStatistics<TVHASH_T>::inANotB(HashStatistics & hsa, HashStatistics & hsb)");
-
-  BUGIFTHROW(hsa.HS_hs_basesperhash!=hsb.HS_hs_basesperhash,"hsa.HS_hs_basesperhash " << hsa.HS_hs_basesperhash << " != hsb.HS_hs_basesperhash " << hsb.HS_hs_basesperhash);
-  HS_hs_basesperhash=hsa.HS_hs_basesperhash;
-
-  if(hsa.HS_hsv_hsshortcuts.empty()) hsa.priv_makeHashStatArrayShortcuts();
-  if(hsb.HS_hsv_hsshortcuts.empty()) hsb.priv_makeHashStatArrayShortcuts();
-
-  HS_hsv_hashstats.clear();
-  HS_hsv_hsshortcuts.clear();
-  for(auto & hsae : hsa.HS_hsv_hashstats){
-    if(hsb.findVHash(hsae)==nullptr){
-      HS_hsv_hashstats.push_back(hsae);
-    }
-  }
-  priv_makeHashStatArrayShortcuts();
-}
-
-template<typename TVHASH_T>
-void HashStatistics<TVHASH_T>::inAAndB(HashStatistics & hsa, HashStatistics & hsb)
-{
-  FUNCSTART("void HashStatistics<TVHASH_T>::inAAndB(HashStatistics & hsa, HashStatistics & hsb)");
-
-  BUGIFTHROW(hsa.HS_hs_basesperhash!=hsb.HS_hs_basesperhash,"hsa.HS_hs_basesperhash " << hsa.HS_hs_basesperhash << " != hsb.HS_hs_basesperhash " << hsb.HS_hs_basesperhash);
-  HS_hs_basesperhash=hsa.HS_hs_basesperhash;
-
-  if(hsa.HS_hsv_hsshortcuts.empty()) hsa.priv_makeHashStatArrayShortcuts();
-  if(hsb.HS_hsv_hsshortcuts.empty()) hsb.priv_makeHashStatArrayShortcuts();
-
-  HS_hsv_hashstats.clear();
-  HS_hsv_hsshortcuts.clear();
-  for(auto & hsae : hsa.HS_hsv_hashstats){
-    if(hsb.findVHash(hsae)!=nullptr){
-      HS_hsv_hashstats.push_back(hsae);
-    }
-  }
-  priv_makeHashStatArrayShortcuts();
-}
-
-
-
-/*************************************************************************
- *
- * hashstats
- *
- *************************************************************************/
-
-template<typename TVHASH_T>
-void HashStatistics<TVHASH_T>::discard()
-{
-  HS_hsv_hashstats.clear();
-  HS_hsv_hashstatnodes.clear();
-  HS_hsv_dbgseqs.clear();
-  HS_hsv_hsshortcuts.clear();
-  HS_hs_basesperhash=0;
-  HS_hs_sortstatus=HSSS_NOTSORTED;
-  HS_avg_freq=avg_freq_t();
-  digiNormReset();
-}
-
-//#define SORTCOUT(bla)   {cout << bla; cout.flush();}
-#define SORTCOUT(bla)
-
-template<typename TVHASH_T>
-void HashStatistics<TVHASH_T>::priv_sorthelper(std::vector<hashstat_t> & hashstats, uint8 * sortstatusptr, uint8 finalstatus, const char * compname, bool (*comparator)(const hashstat_t & a, const hashstat_t & b))
-{
-  SORTCOUT("HSsort: " << compname << " " << &hashstats[0] << " " << static_cast<void *>(sortstatusptr) << " --> ");
-  if(hashstats.empty()){
-    SORTCOUT("not sorted, empty.\n");
-  }else if(sortstatusptr!=nullptr && *sortstatusptr==finalstatus){
-    SORTCOUT("not sorted, already correct final status.\n");
-  }else{
-    SORTCOUT("need sort.\n");
-    std::sort(hashstats.begin(), hashstats.end(), comparator);
-  }
-  if(sortstatusptr!=nullptr){
-    *sortstatusptr=finalstatus;
-    HS_hsv_hsshortcuts.clear();     // TODO: really
-  }
-}
-
-template<typename TVHASH_T>
-void HashStatistics<TVHASH_T>::priv_sortLow24Bit(std::vector<hashstat_t> & hashstats, uint8 * sortstatusptr)
-{
-  priv_sorthelper(hashstats,sortstatusptr,
-		  HSSS_LOW24BIT,"sortLow24Bit",sortHashStatComparatorByLow24bit);
-}
-template<typename TVHASH_T>
-void HashStatistics<TVHASH_T>::priv_sortLexicographicallyUp(std::vector<hashstat_t> & hashstats, uint8 * sortstatusptr)
-{
-  priv_sorthelper(hashstats,sortstatusptr,
-		  HSSS_LEXIUP,"sortLexicographicallyUp",sortHashStatComparatorLexicographicallyUp);
-}
-template<typename TVHASH_T>
-void HashStatistics<TVHASH_T>::priv_sortByCountUp(std::vector<hashstat_t> & hashstats, uint8 * sortstatusptr)
-{
-  priv_sorthelper(hashstats,sortstatusptr,
-		  HSSS_BYCOUNTUP,"sortByCountUp",sortHashStatComparatorByCountUp);
-}
-template<typename TVHASH_T>
-void HashStatistics<TVHASH_T>::priv_sortByCountDown(std::vector<hashstat_t> & hashstats, uint8 * sortstatusptr)
-{
-  priv_sorthelper(hashstats,sortstatusptr,
-		  HSSS_BYCOUNTDOWN,"sortByCountDown",sortHashStatComparatorByCountDown);
-}
-template<typename TVHASH_T>
-void HashStatistics<TVHASH_T>::priv_sortLexByCount(std::vector<hashstat_t> & hashstats, uint8 * sortstatusptr)
-{
-  priv_sorthelper(hashstats,sortstatusptr,
-		  HSSS_LEXBYCOUNT,"sortLexByCount",sortHashStatComparatorLexByCount);
-}
-template<typename TVHASH_T>
-void HashStatistics<TVHASH_T>::priv_sortMaskUp(std::vector<hashstat_t> & hashstats, uint8 * sortstatusptr)
-{
-  // for a mask sort, we need to force that (as the mask could have changed)
-  if(sortstatusptr != nullptr){
-    *sortstatusptr=HSSS_NOTSORTED;
-  }
-  priv_sorthelper(hashstats,sortstatusptr,
-		  HSSS_MASKUP,"sortMaskUp",sortHashStatComparatorByMaskUp);
-}
-
-#undef SORTCOUT
-
-/*************************************************************************
- *
- *
- *************************************************************************/
-
-template<typename TVHASH_T>
-void HashStatistics<TVHASH_T>::hash2string(TVHASH_T hash, uint32 basesperhash, std::string & str)
-{
-  const static TVHASH_T lasttwobits(3);
-  const static char acgtc[4]={'A','C','G','T'};
-
-  str.clear();
-  str.resize(basesperhash,' ');
-  auto srI=str.rbegin();
-  for(auto ci=0; ci<basesperhash; ++ci, ++srI){
-    *srI=acgtc[static_cast<uint64>(hash&lasttwobits)];
-    hash>>=2;
-  }
-}
-
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-template<typename TVHASH_T>
-void HashStatistics<TVHASH_T>::setHashFrequencyRatios(double freqest_minnormal,
-						      double freqest_maxnormal,
-						      double freqest_repeat,
-						      double freqest_heavyrepeat,
-						      double freqest_crazyrepeat,
-						      uint32 rarekmercount,
-						      uint32 nastyrepeatratio,
-						      uint32 nastyrepeatcoverage)
-{
-  HS_freqest_minnormal=freqest_minnormal;
-  HS_freqest_maxnormal=freqest_maxnormal;
-  HS_freqest_repeat=freqest_repeat;
-  HS_freqest_heavyrepeat=freqest_heavyrepeat;
-  HS_freqest_crazyrepeat=freqest_crazyrepeat;
-  HS_rarekmercount=rarekmercount;
-  HS_nastyrepeatratio=nastyrepeatratio;
-  HS_nastyrepeatcoverage=nastyrepeatcoverage;
-}
-
-
-
-
-/*************************************************************************
- *
- * all steps until a usable hash statistics file is in memory
- * Note: does not delete the final hash statistics file on disk (only the
- *  temporary files)
- *
- * Returns explicitly:
- *   nothing
- *
- * Returns implicitly:
- *  - the created hash statistics is in memory, ready to be used
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-template<typename TVHASH_T>
-void HashStatistics<TVHASH_T>::prepareHashStatistics(ReadPool & rp, bool checkusedinassembly, bool alsorails, bool fwdandrev, uint32 fwdrevmin, uint32 rarekmerearlykill, uint32 basesperhash, uint32 millionhashesperbuffer, const string & hashstatfilename, const string & tmpdirectory)
-{
-  FUNCSTART("void HashStatistics<TVHASH_T>::prepareHashStatistics(ReadPool & rp, bool checkusedinassembly, bool alsorails, bool fwdandrev, uint32 fwdrevmin, uint32 rarekmerearlykill, uint32 basesperhash, uint32 millionhashesperbuffer, string & hashstatfilename, const string & directory)");
-
-  fwdrevmin=fwdrevmin;
-  priv_phsCommon(&rp, fwdandrev,fwdrevmin,rarekmerearlykill,basesperhash,millionhashesperbuffer,tmpdirectory);
-  HS_hashstatfilename=hashstatfilename;
-  BUGIFTHROW(HS_hashstatfilename.empty(),"HS_hashstatfilename.empty() ???");
-
-  //if(!HS_hashfilenames.empty()) return;
-
-  cout << "Writing temporary hstat files:\n";
-  priv_hashes2disk(rp,
-		   checkusedinassembly,alsorails,
-		   fwdandrev,fwdrevmin,
-		   basesperhash,
-		   millionhashesperbuffer);
-
-  dateStamp(cout);
-
-  prepareStreamFinalise(fwdrevmin, rarekmerearlykill);
-
-  return;
-}
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-template<typename TVHASH_T>
-void HashStatistics<TVHASH_T>::prepareStreamFinalise(uint32 fwdrevmin, uint32 rarekmerearlykill)
-{
-  cout << "Flushing buffers to disk:\n";
-  ProgressIndicator<int32> P(0, HS_hashfilebuffer.size());
-  for(size_t hbi=0; hbi<HS_hashfilebuffer.size(); ++hbi){
-    P.progress(hbi);
-    HS_elementsperfile[hbi]+=
-      priv_writeCompressedHFB(hbi,
-			      HS_hashfilebuffer[hbi],
-			      fwdrevmin,
-			      0,        // all kmers, don't throw away yet!
-			      HS_hashfiles[hbi],
-			      true);
-    gzclose(HS_hashfiles[hbi]);
-  }
-  HS_hashfiles.clear();
-  P.finishAtOnce();
-  cout << "done\n";
-
-  //dateStamp(cout);
-  //exit(100);
-
-  cout << "\nAnalysing hstat files:\n";
-  size_t numhashstats=
-    priv_createHashStatisticsFile(HS_hashstatfilename,
-				  HS_hashfilenames,
-				  HS_elementsperfile,
-				  fwdrevmin,
-				  rarekmerearlykill
-      );
-
-  cout << "\n";
-
-  dateStamp(cout);
-
-  cout << "clean up temporary stat files..."; cout.flush();
-  // clean up temporary stat files
-  for(uint32 hfni=0; hfni<HS_hashfilenames.size();++hfni){
-    fileRemove(HS_hashfilenames[hfni],true);
-  }
-  // but not this one, needed by mirabait
-  // TODO: make configurable?
-  //fileRemove("hashstat.bin",true);
-
-  dateStamp(cout); cout.flush();
-
-  priv_makeHashStatArrayShortcuts();
-
-  dateStamp(cout);
-
-  return;
-}
-//#define CEBUG(bla)
-
-
-
-/*************************************************************************
- *
- * common part of prepareHashStatistics()
- *
- * ReadPool * rpptr may be nullptr
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-template<typename TVHASH_T>
-void HashStatistics<TVHASH_T>::priv_phsCommon(ReadPool * rpptr, bool fwdandrev, uint32 fwdrevmin, uint32 rarekmerearlykill, uint32 basesperhash, uint32 millionhashesperbuffer, const string & tmpdirectory)
-{
-  FUNCSTART("void HashStatistics<TVHASH_T>::priv_phsCommon(bool alsosavesinglehashes, bool fwdandrev, uint32 fwdrevmin, uint32 basesperhash, uint32 millionhashesperbuffer, bool rarekmerearlykill, const string & tmpdirectory)");
-
-  HS_hs_basesperhash=basesperhash;
-
-  HS_hsv_hashstats.clear();
-  HS_hsv_hsshortcuts.clear();
-
-  HS_hashfilenames.clear();
-  HS_elementsperfile.clear();
-  HS_hashfiles.clear();
-  HS_hashfilebuffer.clear();
-
-  HS_avg_freq.corrected=0;
-  HS_avg_freq.raw=0;
-  HS_avg_freq.taken=0;
-
-  dateStamp(cout);
-
-  const size_t upperbases=2;
-
-  BUGIFTHROW(basesperhash==0,"basesperhash == 0 ???");
-  BUGIFTHROW(upperbases>=basesperhash,"upperbases (" << upperbases << ") >=basesperhash " << basesperhash << ") ???");
-
-  size_t numfiles=1<<(upperbases*2);
-  HS_rightshift=(basesperhash-upperbases)*2;
-
-  CEBUG("bph: " << basesperhash << ".\n");
-  CEBUG("Must create " << numfiles << " files.\n");
-  CEBUG("Rightshift:" << HS_rightshift << '\n');
-  CEBUG("sizeof(TVHASH_T): " << sizeof(TVHASH_T) << '\n');
-
-  // define how many elements to reserve
-  //if(HS_numelementsperbuffer==0){
-  if(1){
-    // default fallback values
-    HS_numelementsperbuffer=millionhashesperbuffer*1048576;    // 16m elements, 16b each, 16 buffers == 4 GiB
-    auto freemem=MachineInfo::getMemAvail();
-    cout << "freemem: " << freemem << endl;
-    if(sizeof(void *)==4){
-      // on 32 bit systems, be careful with memory
-      HS_numelementsperbuffer=1048576/2;
-    }else if(rpptr!=nullptr){
-      if(freemem>0){
-	uint64 tnumhashes=0;
-	for(size_t rpi=0; rpi<rpptr->size(); ++rpi){
-	  auto & actread = rpptr->getRead(rpi);
-	  if(actread.hasValidData()
-	     && !actread.isBackbone()
-	     && !actread.isRail()
-	     && actread.getLenClippedSeq()>=basesperhash){
-	    tnumhashes+=actread.getLenClippedSeq()-basesperhash+1;
-	  }
-	}
-	cout << "TNH: " << tnumhashes << endl;
-	const double fillratio=1.5;
-	double xmillionelem=static_cast<double>(tnumhashes)/(fillratio*1024*1024*sizeof(hashstat_t));
-	cout << "XME 1: " << xmillionelem << endl;
-	if(xmillionelem>millionhashesperbuffer) {
-	  xmillionelem=millionhashesperbuffer;
-	}else if(xmillionelem<0.1){
-	  xmillionelem=0.1;
-	}
-	cout << "XME 2: " << xmillionelem << endl;
-	HS_numelementsperbuffer=xmillionelem*1024*1024;
-      }
-    }
-    cout << "NEPB 1: " << HS_numelementsperbuffer << endl;
-    const uint64 eightgib=8589934592;
-    while(HS_numelementsperbuffer>2*1024*1024){    // equivalent to 512 MB
-      uint64 memneeded=HS_numelementsperbuffer*16*sizeof(hashstat_t);
-      if(freemem-memneeded >= eightgib) break;
-      HS_numelementsperbuffer/=2;
-    }
-    cout << "NEPB 2: " << HS_numelementsperbuffer << endl;
-  }
-
-  HS_hashfilebuffer.resize(numfiles);
-  for(size_t nfi=0; nfi<numfiles; ++nfi){
-    HS_hashfilebuffer[nfi].reserve(HS_numelementsperbuffer);
-  }
-  for(size_t nfi=0; nfi<numfiles; ++nfi){
-    string fname=tmpdirectory+"/stattmp"+str(boost::format("%x") % nfi )+".bin.gz";
-    HS_hashfilenames.push_back(fname);
-    HS_hashfiles.emplace_back(gzopen(fname.c_str(), "wb1"));
-    if(HS_hashfiles.back()==nullptr){
-      MIRANOTIFY(Notify::FATAL,"Could not open " << fname << " for temporary stat file output? Disk full? Wrong path? Access permissions?");
-    }
-  }
-
-  HS_elementsperfile.clear();
-  HS_elementsperfile.resize(numfiles,0);
-}
-//#define CEBUG(bla)
-
-
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-/*
-
-  No Bloom filter. They work exactly as advertised (keep single hashes out of
-  the buffers), but are a major disappointment in terms if speed: influence is
-  negligible (1 to max 2% faster) for Solexa data. The additional memory is
-  not worth it.
-
- */
-
-#if __GNUC__ >= 3
-#define prefetchwrite(p)     __builtin_prefetch((p), 1, 0)
-#else
-#define prefetchwrite(p)
-#endif
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-template<typename TVHASH_T>
-void HashStatistics<TVHASH_T>::priv_hashes2disk(ReadPool & rp, bool checkusedinassembly, bool alsorails, bool fwdandrev, uint32 fwdrevmin, uint32 basesperhash, uint32 millionhashesperbuffer)
-{
-  FUNCSTART("void HashStatistics<TVHASH_T>::priv_hashes2disk(ReadPool & rp, bool checkusedinassembly, bool alsorails, bool fwdandrev, uint32 fwdrevmin, uint32 basesperhash, uint32 millionhashesperbuffer)");
-
-#ifdef CLOCKSTEPS
-  gettimeofday(&HS_CHEAT_tvfill,nullptr);
-#endif
-
-  Read::setCoutType(Read::AS_TEXTSHORT);
-  ProgressIndicator<int32> P(0, rp.size());
-
-  for(uint32 actreadid=0; actreadid<rp.size(); ++actreadid){
-    P.progress(actreadid);
-
-    //if(actreadid>100) return;
-
-    Read & actread= rp.getRead(actreadid);
-
-    if(!actread.getReadGroupID().wantStatisticsCalc()) continue;
-
-    // Has been taken out as hash statistics now also used for mirabait
-    // TODO: check whether this has big influence on "normal" assembly jobs
-    //  !!! it has ... for mapping assemblies !!!
-
-    if(!actread.hasValidData()
-       || actread.isBackbone()
-       || (!alsorails && actread.isRail())
-       || (checkusedinassembly && !actread.isUsedInAssembly())) continue;
-
-    CEBUG("hname: " << actread.getName() << endl);
-    //CEBUG("h2d new read: " << actread << endl);
-
-    prepareStreamAddNextSequence(actread.getClippedSeqAsChar(),
-				 actread.getLenClippedSeq(),
-				 actread.getName().c_str(),
-				 actread.getSequencingType(),
-				 false,
-				 fwdrevmin
-      );
-    if(fwdandrev){
-      prepareStreamAddNextSequence(actread.getClippedComplementSeqAsChar(),
-				   actread.getLenClippedSeq(),
-				   actread.getName().c_str(),
-				   actread.getSequencingType(),
-				   true,
-				   fwdrevmin
-	);
-    }
-
-  }
-
-  P.finishAtOnce();
-  cout << "done\n";
-
-  TEBUG("\nTiming fill HFB: " << diffsuseconds(HS_CHEAT_tvfill) << endl);
-
-  FUNCEND();
-}
-//#define CEBUG(bla)
-
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-template<typename TVHASH_T>
-void HashStatistics<TVHASH_T>::prepareStreamAddNextSequence(const void * seqvoid, uint64 slen, const char * namestr, uint8 seqtype, bool isreverse, uint32 fwdrevmin)
-{
-  FUNCSTART("void HashStatistics<TVHASH_T>::prepareStreamAddNextSequence(const void * seqvoid, uint64 slen, const char * namestr, uint8 seqtype, bool isreverse, uint32 fwdrevmin");
-
-  if(slen<HS_hs_basesperhash) return;
-
-  // We will use prefetch in the loops below, therefore make sure we do not prefetch memory
-  //  which we do not own by making sure the loops flush the buffer before reaching
-  //  the capacity of the buffer
-  const size_t capacityflush=HS_hashfilebuffer[0].capacity()-2;
-  // both memory write prefetches save ~15 to 20% time (well, 1s for 4m Solexa reads at 100bp)
-
-  const auto basesperhash=HS_hs_basesperhash;
-
-  hashstat_t tmpdh;
-  tmpdh.hsc.seqtype=seqtype;
-
-  size_t hashfilesindex;
-
-  const uint8 * seq=static_cast<const uint8 *>(seqvoid);
-
-  if(!isreverse){
-    CEBUG("PSANS fwd " << namestr << endl);
-    tmpdh.hsc.fcount=1;
-    tmpdh.hsc.rcount=0;
-    SEQTOHASH_LOOPSTART(TVHASH_T);
-    {
-      tmpdh.vhash=acthash;
-      tmpdh.hsc.setLowPos(seqi-(basesperhash-1));
-      hashfilesindex=static_cast<uint64>(tmpdh.vhash>>HS_rightshift);
-      CEBUG("Want to write fwd: " << hash2string(acthash,HS_hs_basesperhash) << " " << tmpdh << " to " << hashfilesindex << endl);
-      BUGIFTHROW(hashfilesindex>=HS_hashfiles.size(),"hashfilesindex>=HS_hashfiles.size() ???");
-
-      if(HS_hashfilebuffer[hashfilesindex].size()==capacityflush){
-#ifdef CLOCKSTEPS
-	timeval now;
-	gettimeofday(&now,nullptr);
-#endif
-	HS_elementsperfile[hashfilesindex]+=
-	  priv_writeCompressedHFB(hashfilesindex,
-				  HS_hashfilebuffer[hashfilesindex],
-				  fwdrevmin,
-				  0, // no rarekmerearlykill
-				  HS_hashfiles[hashfilesindex],
-				  false);
-#ifdef CLOCKSTEPS
-	timeval after,diff;
-	gettimeofday(&after,nullptr);
-	timersub(&after,&now,&diff);
-	timeradd(&diff,&HS_CHEAT_tvfill,&now);
-	HS_CHEAT_tvfill=now;
-#endif
-      }
-      HS_hashfilebuffer[hashfilesindex].push_back(tmpdh);
-#ifndef _GLIBCXX_DEBUG
-      // _GLIBCXX_DEBUG will barf on the [size()+1], but in normal operation we are allowed to
-      //   do that as prefetching on non-existent memory is silently ignored
-      prefetchwrite(&(HS_hashfilebuffer[hashfilesindex][HS_hashfilebuffer[hashfilesindex].size()+1]));
-#endif
-    }
-    SEQTOHASH_LOOPEND;
-  }else{
-    CEBUG("PSANS rev " << namestr << endl);
-    tmpdh.hsc.fcount=0;
-    tmpdh.hsc.rcount=1;
-
-    SEQTOHASH_LOOPSTART(TVHASH_T);
-    {
-      tmpdh.vhash=acthash;
-      tmpdh.hsc.setLowPos(slen-seqi+1);
-      hashfilesindex=static_cast<uint64>(tmpdh.vhash>>HS_rightshift);
-      CEBUG("Want to write rev: " << hash2string(acthash,HS_hs_basesperhash) << " " << tmpdh << " to " << hashfilesindex << endl);
-      BUGIFTHROW(hashfilesindex>=HS_hashfiles.size(),"hashfilesindex>=HS_hashfiles.size() ???");
-
-      if(HS_hashfilebuffer[hashfilesindex].size()==capacityflush){
-#ifdef CLOCKSTEPS
-	timeval now;
-	gettimeofday(&now,nullptr);
-#endif
-	HS_elementsperfile[hashfilesindex]+=
-	  priv_writeCompressedHFB(hashfilesindex,
-				  HS_hashfilebuffer[hashfilesindex],
-				  fwdrevmin,
-				  0, // no rarekmerearlykill
-				  HS_hashfiles[hashfilesindex],
-				  false);
-#ifdef CLOCKSTEPS
-	timeval after,diff;
-	gettimeofday(&after,nullptr);
-	timersub(&after,&now,&diff);
-	timeradd(&diff,&HS_CHEAT_tvfill,&now);
-	HS_CHEAT_tvfill=now;
-#endif
-      }
-      HS_hashfilebuffer[hashfilesindex].push_back(tmpdh);
-#ifndef _GLIBCXX_DEBUG
-      // _GLIBCXX_DEBUG will barf on the [size()+1], but in normal operation we are allowed to
-      //   do that as prefetching on non-existent memory is silently ignored
-      prefetchwrite(&(HS_hashfilebuffer[hashfilesindex][HS_hashfilebuffer[hashfilesindex].size()+1]));
-#endif
-    }
-    SEQTOHASH_LOOPEND;
-
-  }
-}
-//#define CEBUG(bla)
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-template<typename TVHASH_T>
-size_t HashStatistics<TVHASH_T>::priv_writeCompressedHFB(size_t hfindex, vector<hashstat_t> & hfb, uint32 fwdrevmin, uint32 rarekmerearlykill, gzFile & gzf, bool force)
-{
-  FUNCSTART("size_t HashStatistics<TVHASH_T>::priv_writeCompressedHFB(size_t hfindex, vector<hashstat_t> & hfb, uint32 fwdrevmin, uint32 rarekmerearlykill, gzFile & gzf, bool force)");
-  size_t retvalue=0;
-  CEBUG("WCHFB " << hfindex << " " << force << " " << hfb.size() << " " << hfb.capacity() << endl);
-  if(hfb.size()){
-    priv_compressHashStatBufferInPlace(hfb, fwdrevmin, rarekmerearlykill);
-    if(force || hfb.size()>=hfb.capacity()*2/3){
-      CEBUG("WCHFB write buffer " << hfindex << " " << 100*hfb.size()/hfb.capacity() << endl);
-      auto writtenbytes=myGZWrite(gzf,&(hfb[0]),sizeof(hashstat_t)*hfb.size());
-      if(writtenbytes != sizeof(hashstat_t)*hfb.size()){
-	MIRANOTIFY(Notify::FATAL, "Could not write anymore to hash file. Disk full? Changed permissions?");
-      }
-      retvalue=hfb.size();
-      hfb.clear();
-    }else{
-      CEBUG("WCHFB no write buffer " << hfindex << " " << 100*hfb.size()/hfb.capacity() << endl);
-    }
-  }
-  return retvalue;
-}
-//#define CEBUG(bla)
-
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-template<typename TVHASH_T>
-void HashStatistics<TVHASH_T>::priv_compressHashStatBufferInPlace(vector<hashstat_t> & hsb, uint32 fwdrevmin, uint32 rarekmerearlykill)
-{
-  FUNCSTART("void HashStatistics<TVHASH_T>::priv_compressHashStatBufferInPlace(vector<hashstat_t> & hsb, uint32 fwdrevmin, bool alsosavesinglehashes)");
-
-  if(hsb.empty()) return;
-
-  CEBUG("CHSBIP\n");
-
-  CEBUG("Sorting " << hsb.size() << " elements ..."); cout.flush();
-
-#ifdef CLOCKSTEPS
-  timeval tv,tvtotal;
-  gettimeofday(&tv,nullptr);
-  tvtotal=tv;
-#endif
-
-  //sort(hsb.begin(), hsb.end(), sortHashStatComparatorLexByCount);
-  priv_sortLexByCount(hsb,nullptr);
-
-  CEBUG("done.\n");
-  TEBUG("\nTiming sort HFB: " << diffsuseconds(tv) << endl);
-
-#ifdef CLOCKSTEPS
-  gettimeofday(&tv,nullptr);
-#endif
-
-  bool haskmerforkf=false;
-  bool haskmerforkr=false;
-  bool hasfrthresholdok=false;
-
-  uint8 thisseqtype=0;
-  uint32 thishashcounter=0;
-  uint32 thishashfcounter=0;
-  uint32 thishashrcounter=0;
-  uint16 thislowpos=0;
-  hashstat_t tmphs;
-  auto srcI=hsb.cbegin();
-  auto dstI=hsb.begin();
-  TVHASH_T thishash=(srcI->vhash);
-  // setting this leads the very first iteration of the main loop
-  //  to set correct values
-  --thishash;
-  for(; srcI!=hsb.cend(); ++srcI){
-    CEBUG("cl " << srcI-hsb.cbegin() << "\t" << srcI->vhash << " " << thishash << endl);
-    if(srcI->vhash != thishash){
-      // save only hashes that appeared at least 'rarekmerearlykill' time
-      if(thishashcounter >0 && thishashcounter>=rarekmerearlykill){
-	tmphs.vhash=thishash;
-	tmphs.hsc.fcount=thishashfcounter;
-	tmphs.hsc.rcount=thishashrcounter;
-	tmphs.hsc.setLowPos(thislowpos);
-	tmphs.hsc.seqtype=thisseqtype;
-	tmphs.hsc.iskmerforkf=haskmerforkf;
-	tmphs.hsc.iskmerforkr=haskmerforkr;
-	tmphs.hsc.hasfwdrevthresholdok=hasfrthresholdok | ((thishashfcounter>=fwdrevmin) & (thishashrcounter>=fwdrevmin));
-	CEBUG("Write mid to " << dstI-hsb.begin() << " from " << srcI-hsb.begin() << ": " << hash2string(tmphs.vhash,HS_hs_basesperhash) << "\t" << tmphs << '\n');
-
-	*dstI=tmphs;
-	++dstI;
-      }
-      thishashfcounter=0;
-      thishashrcounter=0;
-      hasfrthresholdok=false;
-      haskmerforkf=false;
-      haskmerforkr=false;
-      thishash=srcI->vhash;
-      thislowpos=srcI->hsc.getLowPos();
-      thishashcounter=0;
-      thishashfcounter=0;
-      thishashrcounter=0;
-      thisseqtype=srcI->hsc.seqtype;
-      CEBUG("New vhash: " << hash2string(thishash,HS_hs_basesperhash) << "\t" << *srcI << endl);
-    }else{
-      CEBUG("Existing vhash: " << *srcI << endl);
-    }
-    thishashfcounter+=srcI->hsc.fcount;
-    thishashrcounter+=srcI->hsc.rcount;
-    thishashcounter+=srcI->hsc.getCount();
-    if(srcI->hsc.getLowPos() < thislowpos) thislowpos=srcI->hsc.getLowPos();
-    if(srcI->hsc.seqtype != thisseqtype) thisseqtype=MULTISEQTYPE;
-    haskmerforkf|=srcI->hsc.iskmerforkf;
-    haskmerforkr|=srcI->hsc.iskmerforkr;
-    hasfrthresholdok|=srcI->hsc.hasfwdrevthresholdok;
-
-    CEBUG("thc: " << thishashcounter << "\thf: " << thishashfcounter << "\thr: " << thishashrcounter << "\ttlp: " << thislowpos
-	  << "\thfrto: " << hasfrthresholdok << "\t" << rarekmerearlykill << endl);
-  }
-
-  // we're out of the loop, write last elements if there were any
-  if(thishashcounter>0 && thishashcounter>=rarekmerearlykill){
-    tmphs.vhash=thishash;
-    tmphs.hsc.fcount=thishashfcounter;
-    tmphs.hsc.rcount=thishashrcounter;
-    tmphs.hsc.setLowPos(thislowpos);
-    tmphs.hsc.seqtype=thisseqtype;
-    tmphs.hsc.iskmerforkf=haskmerforkf;
-    tmphs.hsc.iskmerforkr=haskmerforkr;
-    tmphs.hsc.hasfwdrevthresholdok=hasfrthresholdok | ((thishashfcounter>=fwdrevmin) & (thishashrcounter>=fwdrevmin));
-    CEBUG("Write end to " << dstI-hsb.begin() << " from " << srcI-hsb.begin() << ": " << hash2string(tmphs.vhash,HS_hs_basesperhash) << "\t" << tmphs << '\n');
-    *dstI=tmphs;
-    ++dstI;
-  }
-
-  TEBUG("Timing compress HFB: " << diffsuseconds(tv) << endl);
-  TEBUG("Timing compressHashStatBufferInPlace: " << diffsuseconds(tvtotal) << endl);
-
-  hsb.resize(dstI-hsb.begin());
-
-  CEBUG("New hsb size: " << hsb.size() << endl);
-
-#ifndef PUBLICQUIET
-  {
-    uint64 numsingle=0;
-    uint64 nummulti=0;
-    auto eI=hsb.cend();
-    for(auto iI=hsb.cbegin(); iI!=eI; ++iI){
-      if(iI->hsc.getCount()==1){
-	++numsingle;
-      }else{
-	++nummulti;
-      }
-    }
-    cout << "\nnumsingle: " << numsingle << "\nnummulti:  " << nummulti << endl;
-  }
-#endif
-
-  return;
-}
-//#define CEBUG(bla)
-
-
-/*************************************************************************
- *
- * 1) sorts every hashfile
- * 2) writes a first hash statistics file hashfile by hashfile
- * 3) loads the above created hash statistics file
- * 4) calculate statistics on that
- * 5) sorts hash statistics by low24 bits (directly usable by
- *    makeHashStatArrayShortcuts())
- * 6) saves final hash statistics file
- *
- * returns:
- *  - by value: number of elements in hash statistics file
- *  - name of the hash statistics file in the call by reference variable
- *  - the created hash statistics is in memory, ready to be used
- *
- *************************************************************************/
-
-#define CEBUG(bla)   {cout << bla; cout.flush();}
-template<typename TVHASH_T>
-size_t HashStatistics<TVHASH_T>::priv_createHashStatisticsFile(const string & hashstatfilename, vector<string> & hashfilenames, vector<size_t> & elementsperfile, uint32 fwdrevmin, uint32 rarekmerearlykill)
-{
-  FUNCSTART("size_t HashStatistics<TVHASH_T>::priv_createHashStatisticsFile(string & hashstatfilename, vector<string> & hashfilenames, vector<size_t> & elementsperfile, uint32 fwdrevmin, bool alsosavesinglehashes)");
-
-  BUGIFTHROW(hashstatfilename.empty(),"hashstatfilename.empty() ???");
-
-  size_t maxelementsperfile=0;
-
-  for(size_t fi=0; fi< elementsperfile.size(); ++fi){
-    maxelementsperfile=max(maxelementsperfile,elementsperfile[fi]);
-  }
-  CEBUG("Max elements per file: " << maxelementsperfile << '\n');
-
-  auto gzf=gzopen(hashstatfilename.c_str(),"wb1");
-  if(gzf==nullptr){
-    MIRANOTIFY(Notify::FATAL,"Could not open " << hashstatfilename << " for writing, is the disk full? Are permissions set right?");
-  }
-
-  auto mhsh=priv_writeHashStatFileHeader(gzf,HS_hs_basesperhash,HSSS_NOTSORTED,-1);
-
-
-  vector<hashstat_t> hashpool;
-  hashpool.reserve(maxelementsperfile+10);
-
-  ProgressIndicator<int32> P(0, static_cast<int32>(elementsperfile.size()));
-
-  uint64 totalelements=0;
-
-  for(size_t fi=0; fi< elementsperfile.size(); fi++){
-    P.increaseprogress();
-
-    CEBUG("Loading " << hashfilenames[fi] << endl);
-    CEBUG("elements in file: " << elementsperfile[fi] << endl);
-
-    if(elementsperfile[fi]==0) continue;
-    hashpool.clear();
-    hashpool.resize(elementsperfile[fi]);
-
-    auto gzhf=gzopen(hashfilenames[fi].c_str(), "rb");
-    if(gzhf==nullptr){
-      MIRANOTIFY(Notify::FATAL,"Could not open " << hashfilenames[fi] << " for reading? It was written just moments ago, something with your machine is broken I think.");
-    }
-
-    auto readbytes=myGZRead(gzhf,&hashpool[0],sizeof(hashstat_t)*elementsperfile[fi]);
-    gzclose(gzhf);
-    if(readbytes != sizeof(hashstat_t)*elementsperfile[fi]) {
-      MIRANOTIFY(Notify::FATAL, "Expected to read " << sizeof(hashstat_t)*elementsperfile[fi] << " bytes in file " << hashfilenames[fi] << " but read " << readbytes << ". Was the file deleted? Disk full?");
-    }
-
-    //for(size_t i=0; i<hashpool.size(); ++i){
-    //  CEBUG(hashpool[i] << '\n');
-    //}
-
-    priv_compressHashStatBufferInPlace(hashpool,fwdrevmin,rarekmerearlykill);
-
-    totalelements+=hashpool.size();
-    CEBUG("after comp: " << hashpool.size() << endl);
-
-   if(!hashpool.empty()){
-     auto writtenbytes=myGZWrite(gzf,
-				 reinterpret_cast<const char *>(&hashpool[0]),
-				 sizeof(hashstat_t)*hashpool.size());
-     if(static_cast<size_t>(writtenbytes) != sizeof(hashstat_t)*hashpool.size()){
-       gzclose(gzf);
-       MIRANOTIFY(Notify::FATAL, "Could not save anymore the hash statistics (1). Disk full? Changed permissions?");
-     }
-   }
-  }
-
-  gzclose(gzf);
-  P.finishAtOnce();
-
-  mhsh.numelem=totalelements;
-
-  // final read to rewrite header with correct number of elements
-  // and to sort the hashstatistics to be directly usable for making shortcuts
-
-  // cannot use loadHashStatistics(), wrong header, need to go by foot
-  CEBUG("opening gz" << endl);
-  gzf=gzopen(hashstatfilename.c_str(),"r");
-  if(gzf==nullptr){
-    MIRANOTIFY(Notify::FATAL,"Could not open " << hashstatfilename << " for reading although it was written just moments ago??? Somethings is broken on your machine.");
-  }
-
-  CEBUG("loading header" << endl);
-  {
-    auto dummy=loadHashStatisticsFileHeader(gzf); // yes, we're throwing away this header
-  }
-  CEBUG("loading main statistics" << endl);
-  loadHashStatistics(mhsh,gzf);
-  gzclose(gzf);
-
-  // calc some statistics
-  CEBUG("some statistics" << endl);
-  HS_hs_sortstatus=HSSS_NOTSORTED; // just to be sure
-  priv_calcAvgHashFreq();
-
-  // Now sort and save
-  HS_hs_sortstatus=HSSS_NOTSORTED; // just to be sure
-  CEBUG("sort low24" << endl);
-  priv_sortLow24Bit();
-  CEBUG("save statistics" << endl);
-  saveHashStatistics(hashstatfilename)
-
-  FUNCEND();
-  return totalelements;
-}
-#define CEBUG(bla)
-
-
-
-/*************************************************************************
- *
- *
- *************************************************************************/
-
-template<typename TVHASH_T>
-void HashStatistics<TVHASH_T>::saveHashStatistics(const string & filename)
-{
-  FUNCSTART("void HashStatistics<TVHASH_T>::saveHashStatistics(const string & filename");
-
-  auto gzf=gzopen(filename.c_str(),"wb1");
-  if(gzf==nullptr){
-    MIRANOTIFY(Notify::FATAL,"Could not open " << filename << ", is the disk full? Are permissions set right?");
-  }
-  try{
-    saveHashStatistics(gzf);
-  }
-  catch(Notify n){
-    gzclose(gzf);
-    cout << "Error for file " << filename << endl;
-    n.handleError(THISFUNC);
-  }
-  gzclose(gzf);
-}
-
-/*************************************************************************
- *
- *
- *************************************************************************/
-
-template<typename TVHASH_T>
-void HashStatistics<TVHASH_T>::saveHashStatistics(gzFile & gzf)
-{
-  FUNCSTART("void HashStatistics<TVHASH_T>::saveHashStatistics(gzFile & gzf)");
-
-  priv_saveHashVStatistics(gzf);
-
-  //if(HSN_hsum_hashstats.empty()){
-  //  saveHashVStatistics(ostr);
-  //}else{
-  //  saveHashMStatistics(ostr);
-  //}
-}
-
-/*************************************************************************
- *
- *
- *************************************************************************/
-
-template<typename TVHASH_T>
-void HashStatistics<TVHASH_T>::priv_saveHashVStatistics(gzFile & gzf)
-{
-  FUNCSTART("void HashStatistics<TVHASH_T>::priv_saveHashVStatistics(gzFile & gzf)");
-
-  auto mhs=priv_writeHashStatFileHeader(gzf,HS_hs_basesperhash,HS_hs_sortstatus,HS_hsv_hashstats.size());
-  if(!HS_hsv_hashstats.empty()){
-    auto writtenbytes=myGZWrite(gzf,
-			      reinterpret_cast<const char *>(&HS_hsv_hashstats[0]),
-			      sizeof(hashstat_t)*HS_hsv_hashstats.size());
-    if(static_cast<size_t>(writtenbytes) != sizeof(hashstat_t)*HS_hsv_hashstats.size()){
-      gzclose(gzf);
-      MIRANOTIFY(Notify::FATAL, "Could not save anymore the hash statistics (1). Disk full? Changed permissions?");
-    }
-  }
-}
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-template<typename TVHASH_T>
-typename HashStatistics<TVHASH_T>::mhsheader_t HashStatistics<TVHASH_T>::priv_writeHashStatFileHeader(std::ostream & ostr, uint32 basesperhash, uint8 sortstatus, uint64 numelem)
-{
-  FUNCSTART("void HashStatistics<TVHASH_T>::priv_writeHashStatFileHeader(std::ostream & ostr, uint32 basesperhash, uint8 sortstatus, uint64 numelem)");
-
-  cout << "This hash save should not be called anymore, aborting.\n";
-  exit(999);
-
-  mhsheader_t mhsh;
-  mhsh.version=3;
-  mhsh.sortstatus=sortstatus;
-  mhsh.basesperhash=basesperhash;
-  mhsh.sizeofhash=sizeof(TVHASH_T);
-  mhsh.numelem=numelem;
-  ostr.write(reinterpret_cast<const char *>(&HS_hsfilemagic),4);
-  ostr.write(reinterpret_cast<const char *>(&mhsh),sizeof(mhsh));
-  CEBUG("Written MHSh " << mhsh << endl);
-  return mhsh;
-}
-
-template<typename TVHASH_T>
-typename HashStatistics<TVHASH_T>::mhsheader_t HashStatistics<TVHASH_T>::priv_writeHashStatFileHeader(gzFile & gzf, uint32 basesperhash, uint8 sortstatus, uint64 numelem)
-{
-  FUNCSTART("void HashStatistics<TVHASH_T>::priv_writeHashStatFileHeader(gzFile & gzf, uint32 basesperhash, uint8 sortstatus, uint64 numelem)");
-
-  mhsheader_t mhsh;
-  mhsh.version=3;
-  mhsh.sortstatus=sortstatus;
-  mhsh.basesperhash=basesperhash;
-  mhsh.sizeofhash=sizeof(TVHASH_T);
-  mhsh.numelem=numelem;
-  mhsh.freq=HS_avg_freq;
-  auto writtenbytes=myGZWrite(gzf,reinterpret_cast<const char *>(&HS_hsfilemagic),4);
-  writtenbytes=myGZWrite(gzf,reinterpret_cast<const char *>(&mhsh),sizeof(mhsh));
-  if(writtenbytes != sizeof(mhsh)) {
-    MIRANOTIFY(Notify::FATAL,"Could not write header information. Is the disk full or quota reached? Changed access permissions?\n");
-  }
-  CEBUG("Written MHSh " << mhsh << endl);
-  return mhsh;
-}
-
-
-
-/*************************************************************************
- *
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-template<typename TVHASH_T>
-const typename HashStatistics<TVHASH_T>::mhsheader_t HashStatistics<TVHASH_T>::loadHashStatisticsFileHeader(const std::string & filename)
-{
-  FUNCSTART("const typename HashStatistics<TVHASH_T>::mhsheader_t HashStatistics<TVHASH_T>::loadHashStatisticsFileHeader(const std::string & fn)");
-  mhsheader_t mhs;
-
-  auto gzf=gzopen(filename.c_str(),"rb");
-  if(gzf==nullptr){
-    MIRANOTIFY(Notify::FATAL,"Could not open " << filename << ", is it present? Are permissions set right?");
-  }
-  try{
-    // 128k larger buffer to speed up decompression
-    // TODO: test whether 64k or 16k is enough for good speedup
-    gzbuffer(gzf,128*1024);
-    mhs=loadHashStatisticsFileHeader(gzf);
-  }
-  catch(Notify n){
-    gzclose(gzf);
-    cout << "Error while loading file " << filename << endl;
-    n.handleError(THISFUNC);
-  }
-  gzclose(gzf);
-  return mhs;
-}
-
-
-
-/*************************************************************************
- *
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-template<typename TVHASH_T>
-const typename HashStatistics<TVHASH_T>::mhsheader_t HashStatistics<TVHASH_T>::loadHashStatisticsFileHeader(gzFile & gzf)
-{
-  FUNCSTART("bool HashStatistics<TVHASH_T>::loadHashStatisticsFileHeader(gzFile & gzf)");
-
-  mhsheader_t ret;
-
-  auto localmagic=HS_hsfilemagic;
-  auto readbytes=myGZRead(gzf,reinterpret_cast<char *>(&localmagic),4);
-  if(readbytes==0) return ret;
-  if(readbytes != 4
-     || localmagic!=HS_hsfilemagic) {
-    MIRANOTIFY(Notify::FATAL,"No magic found or truncated?\n");
-  }
-  readbytes=myGZRead(gzf,reinterpret_cast<char *>(&ret),sizeof(ret));
-
-  if(readbytes != sizeof(ret)) {
-    MIRANOTIFY(Notify::FATAL,"Not enough bytes read for header information. File truncated?\n");
-  }
-
-  CEBUG("Loaded MHSh " << ret << endl);
-
-  if(ret.version!=3) {
-    MIRANOTIFY(Notify::FATAL,"The file looks to be a MIRA HashStatistics file, but version " << static_cast<uint16>(ret.version) << " and not 3?\n");
-  }
-
-  return ret;
-}
-//#define CEBUG(bla)
-
-/*************************************************************************
- *
- * Note: not using boost::iostreams with the gzlib decompressor as that thing
- *  does not automatically detect uncompressed files and gives back
- *  nonsense. I don't want to write a wrapper that does this detection and
- *  then sets up the streams as needed ... boost::iostreams should do that for
- *  me. *sigh*reinterpret_cast<char *>(&localmagic),4);
- *
- *************************************************************************/
-
-template<typename TVHASH_T>
-void HashStatistics<TVHASH_T>::loadHashStatistics(const string & filename)
-{
-  FUNCSTART("void HashStatistics<TVHASH_T>::loadHashStatistics(const string & filename)");
-
-  auto gzf=gzopen(filename.c_str(),"rb");
-  if(gzf==nullptr){
-    MIRANOTIFY(Notify::FATAL,"Could not open " << filename << ", is it present? Are permissions set right?");
-  }
-  try{
-    // 128k larger buffer to speed up decompression
-    // TODO: test whether 64k or 16k is enough for good speedup
-    gzbuffer(gzf,128*1024);
-    loadHashStatistics(gzf);
-  }
-  catch(Notify n){
-    gzclose(gzf);
-    cout << "Error while loading file " << filename << endl;
-    n.handleError(THISFUNC);
-  }
-  gzclose(gzf);
-}
-
-
-/*************************************************************************
- *
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-template<typename TVHASH_T>
-void HashStatistics<TVHASH_T>::loadHashStatistics(gzFile & gzf)
-{
-  FUNCSTART("void HashStatistics<TVHASH_T>::loadHashStatistics(gzFile & gzf)");
-
-  auto mhsh=loadHashStatisticsFileHeader(gzf);
-  loadHashStatistics(mhsh,gzf);
-  HS_avg_freq=mhsh.freq;
-
-  return;
-}
-
-
-/*************************************************************************
- *
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-template<typename TVHASH_T>
-void HashStatistics<TVHASH_T>::loadHashStatistics(const mhsheader_t & mhsh, gzFile & gzf)
-{
-  FUNCSTART("void HashStatistics<TVHASH_T>::loadHashStatistics(const mhsheader_t & mhsh, gzFile & gzf)");
-
-  CEBUG("Got MHSh " << mhsh << endl);
-
-  if(mhsh.sizeofhash > sizeof(TVHASH_T)){
-    MIRANOTIFY(Notify::FATAL,"Hash size " << mhsh.sizeofhash << " does not fit into currently used hash " << sizeof(TVHASH_T) << " ???");
-  }
-  if(HS_hs_basesperhash != 0 && !HS_hsv_hashstats.empty() && mhsh.basesperhash != HS_hs_basesperhash){
-    MIRANOTIFY(Notify::FATAL,"Current hashstat kmer size is " << HS_hs_basesperhash
-	       << ", but kmer size in data to load is " << mhsh.basesperhash
-	       << " ???\n");
-   }else{
-    HS_hs_basesperhash=mhsh.basesperhash;
-  }
-
-  if(!HS_hsv_hashstats.empty()){
-//    HS_hs_sortstatus=HSSS_NOTSORTED;
-//    HS_hs_needsconsolidation=true;
-    MIRANOTIFY(Notify::FATAL,"Appending to existing hashstat not implemented yet\n");
-  }else{
-    HS_hs_sortstatus=mhsh.sortstatus;
-  }
-
-  HS_avg_freq=mhsh.freq;
-
-  if(mhsh.numelem==0) return;
-
-  if(mhsh.numelem){
-//   HS_avg_freq.isvalid=false;
-    HS_avg_freq.corrected=0;
-    HS_avg_freq.raw=0;
-    HS_avg_freq.taken=0;
-    HS_hsv_hsshortcuts.clear();
-
-    auto oldsize=HS_hsv_hashstats.size();
-    CEBUG("Will resize to " << oldsize+mhsh.numelem << endl);
-    HS_hsv_hashstats.resize(oldsize+mhsh.numelem);
-    auto readbytes=myGZRead(gzf,reinterpret_cast<char *>(&HS_hsv_hashstats[oldsize]),mhsh.numelem*sizeof(hashstat_t));
-    if(readbytes != mhsh.numelem*sizeof(hashstat_t)){
-      MIRANOTIFY(Notify::FATAL,"Expected to read " << mhsh.numelem*sizeof(hashstat_t) << " bytes, but got " << readbytes << endl);
-    }
-  }
-}
-
-
-template<typename TVHASH_T>
-void HashStatistics<TVHASH_T>::priv_calcAvgHashFreq(bool verbose)
-{
-  HS_avg_freq=avg_freq_t();
-  priv_sortByCountUp();
-
-  if(HS_hsv_hashstats.empty()) return;
-
-  HS_avg_freq.raw=priv_calcMidHashStatIndex(HS_hsv_hashstats,0);
-  HS_avg_freq.corrected=HS_avg_freq.raw;
-
-  auto hsthreshold=HS_hsv_hashstats.size()-HS_hsv_hashstats.size()/10;
-
-  if(verbose){
-    cout << "Raw MHI: " << HS_avg_freq.raw << endl;
-    cout << "Raw avg. freq. : " << HS_hsv_hashstats[HS_avg_freq.raw].hsc.fcount << " " << HS_hsv_hashstats[HS_avg_freq.raw].hsc.rcount << endl;
-    cout << "HSS " << HS_hsv_hashstats.size() << "\tHSST: " << hsthreshold << endl;
-  }
-
-
-  //// if mh index is in last 10 % of the hashstats, we have a pretty skewed
-  ////  distribution. In that case, recalc without last 10%
-  //// TODO: check whether 40 or 50% wouldn't be better.
-  if(HS_avg_freq.corrected >= hsthreshold){
-    HS_avg_freq.corrected=priv_calcMidHashStatIndex(HS_hsv_hashstats,10);
-    if(verbose){
-      cout << "Corrected MHI: " << HS_avg_freq.corrected << endl;
-      cout << "Corrected avg. freq. : " << HS_hsv_hashstats[HS_avg_freq.corrected].hsc.fcount << " " << HS_hsv_hashstats[HS_avg_freq.corrected].hsc.rcount << endl;
-      cout << "HSS " << HS_hsv_hashstats.size() << "\tHSST: " << (HS_hsv_hashstats.size()-HS_hsv_hashstats.size()/10) << endl;
-    }
-  }
-
-  HS_avg_freq.corrected=HS_hsv_hashstats[HS_avg_freq.corrected].hsc.getCount();
-  HS_avg_freq.raw=HS_hsv_hashstats[HS_avg_freq.raw].hsc.getCount();
-
-  HS_avg_freq.taken=HS_avg_freq.corrected;
-  if(HS_avg_freq.taken < HS_avg_freq.min){
-    HS_avg_freq.taken=HS_avg_freq.min;
-    if(verbose){
-      cout << "Forced avg. freq: " << HS_avg_freq.taken << endl;
-    }
-  }
-
-  FUNCEND();
-  return;
-}
-//#define CEBUG(bla)
-
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-template<typename TVHASH_T>
-size_t HashStatistics<TVHASH_T>::priv_calcMidHashStatIndex(const vector<hashstat_t> & hashstats, size_t dontcarepercent)
-{
-  FUNCSTART("size_t HashStatistics<TVHASH_T>::priv_calcMidHashStatIndex(const vector<hashstat_t> & hashstats, size_t dontcarepercent)");
-
-  if(hashstats.empty()) return 0;
-
-  size_t firsti=0;
-  size_t lasti=hashstats.size();
-  if(dontcarepercent){
-    firsti=hashstats.size()*dontcarepercent/100;
-    lasti-=hashstats.size()*dontcarepercent/100;
-  }else{
-    // 5% default
-    firsti=hashstats.size()/20;
-    lasti-=hashstats.size()/20;
-  }
-
-  size_t sumhashcounts=0;
-  uint32 oldhashcount=hashstats[0].hsc.getCount()-1;
-  size_t oldsumhashcounts=0;
-  for(size_t i=firsti; i<lasti; i++){
-    if(hashstats[i].hsc.getCount() != oldhashcount){
-      BUGIFTHROW(oldhashcount>hashstats[i].hsc.getCount(),"haststat array not sorted by count???");
-      oldhashcount=hashstats[i].hsc.getCount();
-      CEBUG("count: " << oldhashcount << "\tsumhash: " << sumhashcounts << "\tdiff: " << sumhashcounts-oldsumhashcounts << endl);
-      oldsumhashcounts=sumhashcounts;
-    }
-    if(hashstats[i].hsc.hasfwdrevthresholdok) sumhashcounts+=hashstats[i].hsc.getCount();
-  }
-  CEBUG("count: " << oldhashcount << "\tsumhash: " << sumhashcounts << endl);
-
-  // Hmmm, pathological case. Maybe all reads were in the same direction.
-  //  simply recalc without the "has fwd/rev" clause
-  bool dontusefwdrev=false;
-  if(sumhashcounts==0){
-    dontusefwdrev=true;
-    for(size_t i=firsti; i<lasti; i++){
-      sumhashcounts+=hashstats[i].hsc.getCount();
-    }
-    CEBUG("recalc sumhash: " << sumhashcounts << endl);
-  }
-
-  size_t midhashstats=sumhashcounts/2;
-
-  CEBUG("midhashstats: " << midhashstats << endl);
-
-  sumhashcounts=0;
-  for(size_t i=firsti; i<lasti; i++){
-    if(dontusefwdrev || hashstats[i].hsc.hasfwdrevthresholdok) sumhashcounts+=hashstats[i].hsc.getCount();
-    if(sumhashcounts>midhashstats) {
-      return i;
-    }
-  }
-
-  FUNCEND();
-
-  return 0;
-}
-//#define CEBUG(bla)
-
-
-
-
-
-/*************************************************************************
- *
- * Needs:
- *  - the hash statistics vector (sorted by count)
- *
- *************************************************************************/
-
-template<typename TVHASH_T>
-void HashStatistics<TVHASH_T>::showHashStatisticsInfo()
-{
-  FUNCSTART("void HashStatistics<TVHASH_T>::showHashStatisticsInfo()");
-
-  cout << "Kmer statistics:\n"
-       << "=========================================================\n"
-       << "Using kmers of size: " << HS_hs_basesperhash << endl
-       << "Measured avg. raw frequency coverage: " << HS_avg_freq.raw << endl
-       << "Corrected avg. raw frequency coverage: " << HS_avg_freq.corrected;
-
-  if(HS_avg_freq.raw!=HS_avg_freq.corrected){
-    cout << "\tSKEWED DISTRIBUTION!";
-  }
-  cout << '\n';
-
-  if(HS_avg_freq.corrected<HS_avg_freq.min){
-    cout << "Forced minimum average frequency: " << HS_avg_freq.min << endl;
-  }
-
-  cout << "\nFinal average frequency: " << HS_avg_freq.taken << endl;
-
-
-  cout << "\nDeduced thresholds:\n"
-       << "-------------------"
-       << "\nRare freq: " << HS_freqest_minnormal*HS_avg_freq.taken
-       << "\nMin normal freq: " << HS_freqest_minnormal*HS_avg_freq.taken
-       << "\nMax normal freq " << HS_freqest_maxnormal*HS_avg_freq.taken
-       << "\nRepeat freq: " << HS_freqest_repeat*HS_avg_freq.taken
-       << "\nHeavy freq: " << HS_freqest_heavyrepeat*HS_avg_freq.taken
-       << "\nCrazy freq: " << HS_freqest_crazyrepeat*HS_avg_freq.taken
-       << "\nMask freq: " << HS_nastyrepeatratio*HS_avg_freq.taken
-       << "\n\nRepeat ratio histogram:\n"
-       << "-----------------------"
-       << endl;
-
-  vector<size_t> ratiocounts;
-  ratiocounts.reserve(8192);
-  for(size_t i=0; i<HS_hsv_hashstats.size(); i++){
-    uint32 rci=static_cast<uint32>((static_cast<double>(HS_hsv_hashstats[i].hsc.getCount()) / HS_avg_freq.taken) + 0.5);
-    if(rci>=ratiocounts.size()){
-      ratiocounts.resize(rci+1,0);
-    }
-    ratiocounts[rci]++;
-  }
-
-  for(size_t i=0; i<ratiocounts.size(); i++){
-    if(ratiocounts[i]) cout << i << '\t' << ratiocounts[i] << endl;
-  }
-
-  cout << "=========================================================\n\n";
-
-  FUNCEND();
-
-  return;
-}
-
-
-
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-template<typename TVHASH_T>
-void HashStatistics<TVHASH_T>::trimHashStatsByFrequencyAND(uint32 minfwd, uint32 minrev, uint32 mintotal)
-{
-  FUNCSTART("void HashStatistics<TVHASH_T>::trimHashStatsByFrequency(int32 minfwd, int32 minrev, int32 mintotal)");
-
-  priv_trimHashVStatsByFrequencyAND(minfwd,minrev,mintotal);
-
-  //if(HSN_hsum_hashstats.empty()){
-  //  trimHashVStatsByFrequency(minfwd,minrev,mintotal);
-  //}else{
-  //  trimHashMStatsByFrequency(minfwd,minrev,mintotal);
-  //}
-
-}
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-template<typename TVHASH_T>
-void HashStatistics<TVHASH_T>::trimHashStatsByFrequencyANDOR(uint32 minfwd, uint32 minrev, uint32 mintotal)
-{
-  FUNCSTART("void HashStatistics<TVHASH_T>::trimHashStatsByFrequency(int32 minfwd, int32 minrev, int32 mintotal)");
-
-  priv_trimHashVStatsByFrequencyANDOR(minfwd,minrev,mintotal);
-
-  //if(HSN_hsum_hashstats.empty()){
-  //  trimHashVStatsByFrequency(minfwd,minrev,mintotal);
-  //}else{
-  //  trimHashMStatsByFrequency(minfwd,minrev,mintotal);
-  //}
-
-}
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-template<typename TVHASH_T>
-void HashStatistics<TVHASH_T>::priv_trimHashVStatsByFrequencyAND(uint32 minfwd, uint32 minrev, uint32 mintotal)
-{
-  FUNCSTART("void HashStatistics<TVHASH_T>::priv_trimHashVStatsByFrequencyAND(int32 minfwd, int32 minrev, int32 mintotal)");
-
-  auto srcI=HS_hsv_hashstats.begin();
-  auto dstI=srcI;
-
-  for(; srcI!=HS_hsv_hashstats.end(); ++srcI){
-    bool ok=true;
-    if(srcI->hsc.fcount<minfwd
-       || srcI->hsc.rcount<minrev
-       || srcI->hsc.fcount+srcI->hsc.rcount < mintotal){
-      ok=false;
-      CEBUG("rm\t");
-    }else{
-      CEBUG("keep\t");
-    }
-    CEBUG(srcI-HS_hsv_hashstats.begin() << "\t" << *srcI << endl);
-    *dstI=*srcI;
-    if(ok)++dstI;
-  }
-  HS_hsv_hashstats.resize(dstI-HS_hsv_hashstats.begin());
-  HS_hsv_hsshortcuts.clear();
-  //HS_hs_dist.clear();
-}
-
-template<typename TVHASH_T>
-void HashStatistics<TVHASH_T>::priv_trimHashVStatsByFrequencyANDOR(uint32 minfwd, uint32 minrev, uint32 mintotal)
-{
-  FUNCSTART("void HashStatistics<TVHASH_T>::priv_trimHashVStatsByFrequencyANDOR(int32 minfwd, int32 minrev, int32 mintotal)");
-
-  auto srcI=HS_hsv_hashstats.begin();
-  auto dstI=srcI;
-
-  for(; srcI!=HS_hsv_hashstats.end(); ++srcI){
-    bool ok=false;
-    if((srcI->hsc.fcount>=minfwd
-	&& srcI->hsc.rcount>=minrev)
-       || srcI->hsc.fcount+srcI->hsc.rcount >= mintotal){
-      ok=true;
-      CEBUG("keep\t");
-    }else{
-      CEBUG("rm\t");
-    }
-    CEBUG(srcI-HS_hsv_hashstats.begin() << "\t" << *srcI << endl);
-    *dstI=*srcI;
-    if(ok)++dstI;
-  }
-  HS_hsv_hashstats.resize(dstI-HS_hsv_hashstats.begin());
-  HS_hsv_hsshortcuts.clear();
-  //HS_hs_dist.clear();
-}
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-string laberbla;
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-
-template<typename TVHASH_T>
-void HashStatistics<TVHASH_T>::calcKMerForks(uint32 mincount, bool needfwdrev)
-{
-  FUNCSTART("void HashStatistics<TVHASH_T>::calcKMerForks(uint32 mincount, bool needfwdrev)");
-
-  if(HS_hsv_hashstats.empty()) return;
-
-  for(auto & hse : HS_hsv_hashstats) {
-    hse.hsc.iskmerforkf=false;
-    hse.hsc.iskmerforkr=false;
-  }
-
-  HS_vhashmask=1;
-  // *grml* undefined behaviour of left shift for 64 shifts in a 64 bit type makes this cludge necessary
-  // the same for 32 shift in 32 bit types etc.pp
-  if(HS_hs_basesperhash>=sizeof(TVHASH_T)*4){
-    HS_vhashmask=0;
-  }else{
-    auto rollbases=HS_hs_basesperhash-1;
-    HS_vhashmask<<=(rollbases*2);
-  }
-  // vhashmask is now, e.g. for bph=31, 00010000000....
-  --HS_vhashmask;
-  // vhashmask is now, e.g. for bph=31, 000011111....
-
-  // calc the status on ?..............
-  priv_sortMaskUp();
-  laberbla="rev ";
-  CEBUG("KMERFORK REV " << hex << HS_vhashmask << dec << endl);
-  if(needfwdrev){
-    priv_ckmf_helper(HS_vhashmask,mincount);
-  }else{
-    priv_ckmf_relaxed_helper(HS_vhashmask,mincount,false);
-  }
-
-  // calc the status on ..............?
-  HS_vhashmask<<=2;
-  // vhashmask is now, e.g. for bph=31, 0011111....00
-  priv_sortMaskUp();
-
-  laberbla="fwd ";
-  CEBUG("KMERFORK FWD " << hex << HS_vhashmask << dec << endl);
-  if(needfwdrev){
-    priv_ckmf_helper(HS_vhashmask,mincount);
-  }else{
-    priv_ckmf_relaxed_helper(HS_vhashmask,mincount,true);
-  }
-
-  priv_sortLow24Bit();
-
-  return;
-}
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-template<typename TVHASH_T>
-void HashStatistics<TVHASH_T>::priv_ckmf_helper(TVHASH_T hashmask, uint32 mincount)
-{
-  auto hsI=HS_hsv_hashstats.begin();
-  auto hsJ=hsI+1;
-
-  CEBUG("KMER DUMP:\n");
-
-  for(; hsJ!=HS_hsv_hashstats.end(); ++hsI,++hsJ){
-    CEBUG(" b " << (hsI->hsc.hasfwdrevthresholdok));
-    CEBUG(" c " << (hsJ->hsc.hasfwdrevthresholdok));
-    CEBUG(" d " << ((hsI->vhash&hashmask) == (hsJ->vhash&hashmask)));
-    CEBUG(" e " << (hsI->vhash != hsJ->vhash));
-    CEBUG(" f " << (hsI->hsc.fcount >= mincount));
-    CEBUG(" g " << (hsI->hsc.rcount >= mincount));
-    CEBUG(" h " << (hsJ->hsc.fcount >= mincount));
-    CEBUG(" i " << (hsJ->hsc.rcount >= mincount));
-    CEBUG(endl);
-    if(hsI->hsc.hasfwdrevthresholdok
-       && hsJ->hsc.hasfwdrevthresholdok
-       && (hsI->vhash&hashmask) == (hsJ->vhash&hashmask)
-       && hsI->vhash != hsJ->vhash
-       && hsI->hsc.fcount >= mincount
-       && hsI->hsc.rcount >= mincount
-       && hsJ->hsc.fcount >= mincount
-       && hsJ->hsc.rcount >= mincount){
-      CEBUG("ISKMER!\n");
-      hsI->hsc.iskmerforkf=true;
-      hsI->hsc.iskmerforkr=true;
-      hsJ->hsc.iskmerforkf=true;
-      hsJ->hsc.iskmerforkr=true;
-    }
-    CEBUG(laberbla << hash2string(hsI->vhash,HS_hs_basesperhash) << ' ' << *hsI << '\n');
-    CEBUG(laberbla << hash2string(hsJ->vhash,HS_hs_basesperhash) << ' ' << *hsJ << '\n');
-  }
-}
-
-
-template<typename TVHASH_T>
-void HashStatistics<TVHASH_T>::priv_ckmf_relaxed_helper(TVHASH_T hashmask, uint32 mincount, bool isfwd)
-{
-  auto hsI=HS_hsv_hashstats.begin();
-
-  CEBUG("KMER RELAX:\n");
-
-  vector<uint8> iskmer;
-  while(hsI!=HS_hsv_hashstats.end()){
-    // find range with same subhash
-    auto hsE=hsI;
-    for(;hsE!=HS_hsv_hashstats.end() && (hsE->vhash & hashmask) == (hsI->vhash & hashmask); ++hsE) {}
-    if(hsE-hsI > 1){
-      // check for strong kmers
-      iskmer.clear(); iskmer.resize(hsE-hsI,0);
-      uint32 count=0;
-      uint32 runi=0;
-      uint32 maxcount=0;
-      for(auto rI=hsI; rI != hsE; ++rI, ++runi){
-	maxcount=max(maxcount,rI->hsc.getCount());
-	if(rI->hsc.fcount>2 && rI->hsc.rcount>2){
-	  ++count;
-	  iskmer[runi]=1;
-	}
-      }
-      // if no strong, relax a bit: the ones with the highest count is defined as strong kmer
-      if(count==0){
-	runi=0;
-	for(auto rI=hsI; rI != hsE; ++rI, ++runi){
-	  if(rI->hsc.getCount() == maxcount) iskmer[runi]=1;
-	}
-      }
-
-      // now, as this routine is specifically designed for proposed end clip,
-      // set the iskmerfork flag for all non strong kmers, but do not set it for
-      // the strong.
-      // seems a bit illogic, but is really made to fit proposed end clipping
-      //  who stops "saving" when detecting a kmerfork. So the strong, good
-      //  will be saved while weak ones wont.
-
-      CEBUG("KMER DECIDE " << count << " " << maxcount << endl);
-
-      runi=0;
-      for(auto rI=hsI; rI != hsE; ++rI, ++runi){
-	if(!iskmer[runi]) {
-	  if(isfwd) {
-	    rI->hsc.iskmerforkf=true;
-	  }else{
-	    rI->hsc.iskmerforkr=true;
-	  }
-	}
-	CEBUG(laberbla << hash2string(rI->vhash,HS_hs_basesperhash) << ' ' << *rI << '\n');
-      }
-    }
-
-    hsI=hsE;
-  }
-}
-//#define CEBUG(bla)
-
-
-/*************************************************************************
- *
- * needs:
- *  - hashstats filled with entries (can be unsorted, will be re-sorted
- *    anyway)
- *
- * returns:
- *  - hashstats array sorted by low 24 bit (low to high), then by vhash
- *  - hsshortcuts_begin and ..._end pointing to start and end of each
- *    low 24 bit group of same value
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-
-template<typename TVHASH_T>
-void HashStatistics<TVHASH_T>::priv_makeHashStatArrayShortcuts()
-{
-  FUNCSTART("void HashStatistics<TVHASH_T>::priv_makeHashStatArrayShortcuts()");
-
-  CEBUG("makeHashStatArrayShortcuts: basesperhash: " << HS_hs_basesperhash << "\n");
-
-  BUGIFTHROW(HS_hs_basesperhash==0, "HS_hs_basesperhash == 0 ???");
-
-  for(size_t i=0; i<HS_hsv_hashstats.size(); i++){
-    CEBUG(HS_hsv_hashstats[i] << '\n');
-  }
-
-  //cout << "Going on a sort. "; dateStamp(cout);
-
-  //sort(HS_hsv_hashstats.begin(), HS_hsv_hashstats.end(), sortHashStatComparatorByLow24bit);
-  priv_sortLow24Bit();
-
-  //cout << "Sort ended. "; dateStamp(cout);
-
-  HS_hsv_hsshortcuts.clear();
-  {
-    hsvbendit_t tmpb;
-    tmpb.b=HS_hsv_hashstats.end();
-    tmpb.e=HS_hsv_hashstats.end();
-    HS_hsv_hsshortcuts.resize(
-      1<<(min(static_cast<uint32>(12),HS_hs_basesperhash)*2),
-      tmpb
-      );
-  }
-
-  CEBUG("HS_hsv_hsshortcuts.size(): " << HS_hsv_hsshortcuts.size() << endl);
-
-  auto hsI=HS_hsv_hashstats.begin();
-  if(hsI==HS_hsv_hashstats.end()) return;
-
-
-  TVHASH_T acthash= (hsI->vhash & HS_MAXVHASHMASK);
-  while(hsI != HS_hsv_hashstats.end()){
-    CEBUG("begin " << hex << acthash << dec << " is: " << *hsI << endl);
-    HS_hsv_hsshortcuts[static_cast<uint64>(acthash)].b=hsI;
-    for(;(hsI != HS_hsv_hashstats.end()) && ((hsI->vhash & HS_MAXVHASHMASK) == acthash); hsI++) {
-      CEBUG("INC\n")
-    }
-    CEBUG("end " << hex << acthash << dec << " is: " << *hsI << endl);
-    HS_hsv_hsshortcuts[static_cast<uint64>(acthash)].e=hsI;
-    //cout << "vhash: " << hex << acthash << "\t" << dec << HS_hsv_hsshortcuts_end[acthash]-HS_hsv_hsshortcuts_begin[acthash] << '\n';
-    if(hsI != HS_hsv_hashstats.end()) acthash= hsI->vhash & HS_MAXVHASHMASK;
-  }
-
-  //cout << "Done making shortcuts. " << endl; dateStamp(cout);
-
-  FUNCEND();
-}
-//#define CEBUG(bla)
-
-
-/*************************************************************************
- *
- *
- *
- *
- *
- *************************************************************************/
-
- //#define CEBUG(bla)   {cout << bla; cout.flush();}
-
-template<typename TVHASH_T>
-void HashStatistics<TVHASH_T>::assignReadBaseStatistics_MultiThread(ReadPool & rp, uint32 numthreads, bool masknastyrepeats, uint32 mincountkmerforks, bool needfwdrev)
-{
-  FUNCSTART("void HashStatistics<TVHASH_T>::assignReadBaseStatistics_MultiThread(ReadPool & rp, uint32 numthreads, bool masknastyrepeats, uint32 mincountkmerforks, bool needfwdrev)");
-
-  calcKMerForks(mincountkmerforks, needfwdrev);
-
-  // calcKMerForks() uses the hashstat sort function which may have emptied shortcuts
-  // redo them just to be sure
-  priv_makeHashStatArrayShortcuts();
-  if(HS_hsv_hsshortcuts.empty()){
-    MIRANOTIFY(Notify::FATAL,"Tried to assign base statistics (1) though there are no statistics which can be assigned? Something's wrong with your data set.");
-  }
-
-  arbs_threadsharecontrol_t atsc;
-
-  atsc.from=0;
-  atsc.to=rp.size();
-  atsc.todo=0;
-  atsc.done=0;
-  atsc.stepping=1000;
-
-  // TODO: unneeded now as working on HS_* variables, reorganise
-  // vvvvvvvvvvvvvvv
-  atsc.rpptr=&rp;
-  atsc.avghashcov=HS_avg_freq.taken;
-  atsc.hashstatsptr=&HS_hsv_hashstats;
-  atsc.basesperhash=HS_hs_basesperhash;
-  atsc.hsscptr=&HS_hsv_hsshortcuts;
-  // ^^^^^^^^^
-
-  atsc.masknastyrepeats=masknastyrepeats;
-  atsc.truekmerforks=!needfwdrev;
-
-  CEBUG("minnormalhashcov: " << atsc.avghashcov << endl);
-
-
-  //uint32 numthreads=8;
-  boost::thread_group workerthreads;
-  for(uint32 ti=0; ti<numthreads;++ti){
-    workerthreads.create_thread(boost::bind(&HashStatistics<TVHASH_T>::priv_arb_thread, this, ti, &atsc));
-  }
-
-  ProgressIndicator<int64> pi(0,rp.size());
-  while(atsc.done!=rp.size()){
-    pi.progress(atsc.done);
-    sleep(1);
-  }
-  pi.finishAtOnce(cout);
-
-  // they normally should all have exited at this point, but be nice and play by the rules
-  workerthreads.join_all();
-
-}
-//#define CEBUG(bla)
-
-/*************************************************************************
- *
- *
- *************************************************************************/
-
-template<typename TVHASH_T>
-void HashStatistics<TVHASH_T>::priv_arb_thread(uint32 threadnum, arbs_threadsharecontrol_t * tscptr)
-{
-  FUNCSTART("void HashStatistics<TVHASH_T>::priv_arb_thread(uint32 threadnum, arbs_threadsharecontrol_t * tscptr)");
-
-  try{
-    int32 from;
-    int32 to;
-    while(true){
-      {
-	boost::mutex::scoped_lock lock(tscptr->accessmutex);
-	if(tscptr->todo >= tscptr->to) break;
-	from=tscptr->todo;
-	tscptr->todo+=tscptr->stepping;
-	if(tscptr->todo > tscptr->to) tscptr->todo = tscptr->to;
-	to=tscptr->todo;
-      }
-      priv_arb_DoStuff(
-	*(tscptr->rpptr),
-	tscptr->avghashcov,
-	*(tscptr->hashstatsptr),
-	tscptr->basesperhash,
-	*(tscptr->hsscptr),
-	tscptr->masknastyrepeats,
-	from,
-	to,
-	tscptr->truekmerforks
-	);
-      {
-	boost::mutex::scoped_lock lock(tscptr->accessmutex);
-	tscptr->done+=tscptr->stepping;
-	if(tscptr->done > tscptr->to) tscptr->done=tscptr->to;
-      }
-    }
-  }
-  catch(Notify n){
-    n.handleError(THISFUNC);
-  }
-}
-
-
-/*************************************************************************
- *
- * truekmerforks = false; traditional 'assembly' style fwd/rev kmers, for
- *             being cautious in assembly
- * truekmerforks = true; only real kmers in given direction, for pec clipping
- *
- * false
- * aaaaaaaaaaaaaaaaRRRRRRRRRRRRRRRRRRRRbbbbbbbbbbbbbbbbbb
- *               <KKKKKKKK>
- *                             <KKKKKKKK>
- *
- * true
- * aaaaaaaaaaaaaaaaRRRRRRRRRRRRRRRRRRRRbbbbbbbbbbbbbbbbbb
- *               <KKKKKKKK
- *                              KKKKKKKK>
- *
- * The 'true' needs more time as one needs to really go through the reverse
- *  sequence and analyse the kmers for real
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-//#define CEBUG(bla)   {if(docebug) {cout << bla; cout.flush();}}
-template<typename TVHASH_T>
-void HashStatistics<TVHASH_T>::priv_arb_DoStuff(ReadPool & rp, size_t avghashcov, vector<hashstat_t> & hashstats, const uint32 basesperhash, vector<hsvbendit_t> & hsshortcuts, bool masknastyrepeats, int32 fromid, int32 toid, bool truekmerforks)
-{
-  FUNCSTART("HashStatistics<TVHASH_T>::priv_arb_DoStuff(ReadPool & rp, size_t avghashcov, vector<hashstat_t> & hashstats, const uint32 basesperhash, vector<hsvbendit_t> & hsshortcuts, bool masknastyrepeats, int32 fromid, int32 toid, bool truekmerforks)");
-
-  //bool docebug=false;
-
-  BUGIFTHROW(hsshortcuts.empty(),"hsshortcuts.empty() ??? at " << &hsshortcuts);
-
-  auto minnormalhashcov=static_cast<uint32>(static_cast<double>(avghashcov)*HS_freqest_minnormal);
-  auto maxnormalhashcov=static_cast<uint32>(static_cast<double>(avghashcov)*HS_freqest_maxnormal);
-  auto repeathashcov=static_cast<uint32>(static_cast<double>(avghashcov)*HS_freqest_repeat);
-  auto heavyrepthashcov=static_cast<uint32>(static_cast<double>(avghashcov)*HS_freqest_heavyrepeat);
-  auto crazyrepthashcov=static_cast<uint32>(static_cast<double>(avghashcov)*HS_freqest_crazyrepeat);
-  uint32 maskhashcov=0;
-
-  if(masknastyrepeats){
-    maskhashcov=static_cast<uint32>(static_cast<double>(avghashcov)*HS_nastyrepeatratio);
-    if(HS_nastyrepeatcoverage>0 && HS_nastyrepeatcoverage<maskhashcov){
-      maskhashcov=HS_nastyrepeatcoverage;
-    }
-  }
-
-  vector<vhrap_t> singlereadvhraparray;
-  singlereadvhraparray.reserve(10000);
-
-  // we will not use a mask, but
-  //  we need to supply an empty one anyway
-  vector<uint8> tagmaskvector;
-
-  // stores in each read whether the given hash frequency was seen
-  vector<uint8> hasfrequency(8);
-
-  vector<uint8> mcmask;
-  mcmask.reserve(10000);
-
-  multitag_t tmpmt(Read::REA_defaulttag_MNRr);
-
-  CEBUG("dostuff from " << fromid << " to " << toid << endl);
-
-  for(int32 actreadid=fromid; actreadid<toid; ++actreadid){
-    //if(actreadid>100) return;
-
-    Read & actread= rp.getRead(actreadid);
-
-    //if(actread.getName()=="mictbac_bg:1:2101:20987:13472"){
-    //  docebug=true;
-    //}else{
-    //  docebug=false;
-    //}
-
-    CEBUG("dsloop " << fromid << " " << actread.getName() << " " << actread.getLenClippedSeq() << endl);
-
-    // get rid of old values
-    actread.clearAllBPosHashStats();
-    actread.setHasFreqAvg(false);
-    actread.setHasFreqRept(false);
-    actread.setHasKMerFork(false);
-    actread.deleteTag(tmpmt.identifier);
-
-    // whatever happens: this read was looked upon by this routine, so technically we "have" base hashstats
-    actread.setHasBaseHashStats(true);
-
-
-    if(!actread.hasValidData()
-      || !actread.isUsedInAssembly()) continue;
-
-//#define CEBUG(bla)   {if(cebugok) cout << bla; cout.flush();}
-//    bool cebugok=false;
-//    if(actread.getName()=="E0K6C4E01CTNQI") cebugok=true;
-
-    uint32 slen=actread.getLenClippedSeq();
-
-    if(slen<basesperhash) continue;
-
-    if(masknastyrepeats) {
-      mcmask.clear();
-      mcmask.resize(actread.getLenSeq(),0);
-    }
-
-    hasfrequency.clear();
-    hasfrequency.resize(8,0);
-
-    Read::setCoutType(Read::AS_TEXT);
-    CEBUG("### Before ...\n" << actread << endl);
-
-    singlereadvhraparray.resize(slen);
-    tagmaskvector.resize(slen,0);
-
-    auto srvaI=singlereadvhraparray.begin();
-
-    vector<Read::bposhashstat_t> & bposhashstats=const_cast<vector<Read::bposhashstat_t> &>(actread.getBPosHashStats());
-    uint32 hashesmade;
-
-    bool haskmerfork=false;
-
-    // fwd
-    if(true){
-      {
-	int32 bfpos=actread.calcClippedPos2RawPos(0);
-	int32 bfposinc=1;
-
-	hashesmade=Skim<TVHASH_T>::transformSeqToVariableHash(
-	  actreadid,
-	  actread,
-	  actread.getClippedSeqAsChar(),
-	  slen,
-	  basesperhash,
-	  srvaI,
-	  false,
-	  1,
-	  tagmaskvector,
-	  bposhashstats,
-	  bfpos,
-	  bfposinc
-	  );
-      }
-      singlereadvhraparray.resize(hashesmade);
-
-      CEBUG("hashesmade: " << hashesmade << endl);
-      CEBUG("maskhashcov: " << maskhashcov << endl);
-
-      typename vector<hashstat_t>::const_iterator lowerbound;
-
-      typename vector<hashstat_t>::const_iterator hssearchI;
-      srvaI=singlereadvhraparray.begin();
-
-      int32 bfpos1,bfpos2;
-      hashstat_t hstmp;
-      bool foundit=false;
-      for(; srvaI != singlereadvhraparray.end(); srvaI++){
-	CEBUG(*srvaI << '\n');
-
-	foundit=false;
-	lowerbound=hsshortcuts[static_cast<uint64>(srvaI->vhash & HS_MAXVHASHMASK)].b;
-
-	// "HS_empty_vector_hashstat_t.end()" is the "nullptr" replacement
-	if(hashstats.end() != lowerbound){
-	  if(basesperhash>12){
-	    // with more than 12 bases in a hash, the array is subdivided
-	    hstmp.vhash=srvaI->vhash;
-	    hssearchI=lower_bound(lowerbound,
-				  hsshortcuts[static_cast<uint64>(srvaI->vhash & HS_MAXVHASHMASK)].e,
-				  hstmp,
-				  HashStatistics::sortHashStatComparatorLexicographicallyUp);
-	    if(hssearchI != hashstats.end()
-	       && hssearchI->vhash == srvaI->vhash) foundit=true;
-	  }else{
-	    hssearchI=lowerbound;
-	    foundit=true;
-	  }
-	}else{
-	  CEBUG("---------- NO LB HIT??? -------\n");
-	}
-
-	if(foundit) {
-	  CEBUG("VHRAP: " << *srvaI << '\n');
-	  CEBUG("HashStat: " << *hssearchI << '\n');
-	  CEBUG("srvaI->hashpos: " << srvaI->hashpos << '\n');
-
-	  bfpos1=actread.calcClippedPos2RawPos(srvaI->hashpos-(basesperhash-1));
-	  bfpos2=bfpos1+basesperhash-1;
-
-	  CEBUG("b bfpos1: " << bfpos1 << '\t' << bposhashstats[bfpos1] << endl);
-	  CEBUG("b bfpos2: " << bfpos2 << '\t' << bposhashstats[bfpos2] << endl);
-
-	  bposhashstats[bfpos1].fwd.setValid();
-	  bposhashstats[bfpos2].rev.setValid();
-
-	  if(hssearchI->hsc.hasfwdrevthresholdok) {
-	    //bhs|=Read::BFLAGS_CONFIRMED_FWDREV;
-	    CEBUG("Set ConfFWDREV\n");
-	    bposhashstats[bfpos1].fwd.setConfirmedFwdRev();
-	    bposhashstats[bfpos2].rev.setConfirmedFwdRev();
-	  }
-	  if(hssearchI->hsc.iskmerforkf) {
-	    haskmerfork=true;
-	    bposhashstats[bfpos1].fwd.setKMerFork();
-	    if(!truekmerforks) bposhashstats[bfpos2].rev.setKMerFork();
-	  }
-	  if(hssearchI->hsc.getLowPos()<=4){
-	    //bhs|=Read::BFLAGS_SEENATLOWPOS;
-	    CEBUG("Set SeenAtLowPos\n");
-	    bposhashstats[bfpos1].fwd.setSeenAtLowPos();
-	    bposhashstats[bfpos2].rev.setSeenAtLowPos();
-	  }
-	  if(hssearchI->hsc.seqtype==MULTISEQTYPE){
-	    //bhs|=Read::BFLAGS_CONFIRMED_MULTIPLESEQTYPE;
-	    CEBUG("Set ConfMultSeqType\n");
-	    bposhashstats[bfpos1].fwd.setConfirmedMultipleSeqType();
-	    bposhashstats[bfpos2].rev.setConfirmedMultipleSeqType();
-	  }
-	  uint8 frequency=2;
-	  {
-	    auto hgc=hssearchI->hsc.getCount();
-	    if(hgc < minnormalhashcov) {
-	      frequency=2;
-	    }else if(hgc >= minnormalhashcov
-		     && hgc <= maxnormalhashcov) {
-	      frequency=3;
-	      //}else if(hssearchI->count > minnormalhashcov*20){
-	    }else if(hgc > crazyrepthashcov){
-	      frequency=7;
-	    }else if(hgc > heavyrepthashcov){
-	      frequency=6;
-	    }else if(hgc >= repeathashcov){
-	      frequency=5;
-	    }else{
-	      frequency=4;
-	    }
-	    if(hgc == 1){
-	      frequency=0;
-	    }else if(hgc > 0
-		     && hgc <= HS_rarekmercount ){
-	      // maybe additional checks ... ?
-	      frequency=1;
-	    }
-	    CEBUG("Set frequency: " << static_cast<uint16>(frequency) << endl);
-
-	    if(masknastyrepeats && maskhashcov>0 && hgc >= maskhashcov){
-	      CEBUG("mcmask " << bfpos1 << "\t" << bfpos1+basesperhash << '\n');
-	      for(uint32 j=0; j<basesperhash; j++){
-		mcmask[bfpos1+j]=1;
-	      }
-	    }
-	  }
-
-	  CEBUG("a1 bfpos1: " << bfpos1 << '\t' << bposhashstats[bfpos1] << endl);
-	  CEBUG("a1 bfpos2: " << bfpos2 << '\t' << bposhashstats[bfpos2] << endl);
-
-	  bposhashstats[bfpos1].fwd.setFrequency(frequency);
-	  bposhashstats[bfpos2].rev.setFrequency(frequency);
-
-	  CEBUG("a2 bfpos1: " << bfpos1 << '\t' << bposhashstats[bfpos1] << endl);
-	  CEBUG("a2 bfpos2: " << bfpos2 << '\t' << bposhashstats[bfpos2] << endl);
-
-	  hasfrequency[frequency]=1;
-
-	  //cout.flush();
-	  //actread.setBaseFlagsInClippedSequence(bhs,
-	  //				      srvaI->hashpos-(basesperhash-1),
-	  //				      basesperhash);
-	  //actread.setHasBaseFlags(true);
-	}
-      }
-
-      if(hasfrequency[3]){
-	actread.setHasFreqAvg(true);
-      }
-      if(hasfrequency[5] || hasfrequency[6] || hasfrequency[7]){
-	actread.setHasFreqRept(true);
-      }
-
-      //Read::setCoutType(Read::AS_TEXT);
-      //CEBUG("### After ...\n" << actread << endl);
-
-
-      // BaCh 07.04.2009 Bad Idea!!!
-      // BaCh 12.07.2009 Why? Forgot ... :-(
-      //// the fwd/rev of a read now looks like this (e.g.)
-      //// (for better viewing dot == 0)
-      ////
-      //// f   ..........2222222233333....355555....................
-      //// r   ................2222222....33333355555...............
-      ////
-      //// in dubio pro reo and to allow for potential matches,
-      //// do this:
-      ////
-      //// f   ..........2222222233333....355555->..................
-      //// r   ..............<-2222222....33333355555...............
-      ////
-      //// so that this
-      ////
-      //// f   ..........2222222233333....35555555555...............
-      //// r   ..........2222222222222....33333355555...............
-      ////
-      //// is generated
-      ////
-      ////
-      //
-      //{
-      //  uint32 bfposi=0;
-      //  for(; bfposi<bposhashstats.size() && bposhashstats[bfposi].fwd.getFrequency()==0; bfposi++) {};
-      //  uint32 bfpose=bfposi;
-      //  for(; bfpose<bposhashstats.size() && bposhashstats[bfpose].rev.getFrequency()==0; bfpose++) {};
-      //  if(bfposi<bposhashstats.size() && bfpose<bposhashstats.size()){
-      //	for(uint32 i=bfposi; i<bfpose; i++){
-      //	  bposhashstats[i].fwd=bposhashstats[bfpose].rev;
-      //	}
-      //  }
-      //
-      //  bfposi=bposhashstats.size()-1;
-      //  for(; bfposi>0 && bposhashstats[bfposi].rev.getFrequency()==0; bfposi--) {};
-      //  bfpose=bfposi;
-      //  for(; bfpose>0 && bposhashstats[bfpose].fwd.getFrequency()==0; bfpose--) {};
-      //  if(bfposi>0){
-      //	for(uint32 i=bfposi; i>bfpose; i--){
-      //	  bposhashstats[i].fwd=bposhashstats[bfpose].rev;
-      //	}
-      //  }
-      //}
-
-
-      // go through multicopy array and set MNRr tags for
-      //  consecutive positions in read tagged as multicopy
-      if(masknastyrepeats){
-	bool inrun=false;
-	uint32 runstart=0;
-	uint32 pos=0;
-	for(; pos<mcmask.size(); pos++){
-	  CEBUG("pos: " << pos << '\t' << static_cast<uint16>(mcmask[pos]) << '\t' << inrun << '\n');
-	  if(mcmask[pos]){
-	    if(!inrun){
-	      runstart=pos;
-	      inrun=true;
-	    }
-	  }else{
-	    if(inrun){
-	      CEBUG("reprun " << actread.getName() << '\t' << runstart << '\t' << pos-1 << endl);
-	      tmpmt.from=runstart;
-	      tmpmt.to=pos-1;
-	      actread.addTagO(tmpmt);
-	      inrun=false;
-	    }
-	  }
-	}
-	if(inrun){
-	  CEBUG("reprun " << actread.getName() << '\t' << runstart << '\t' << pos-1 << endl);
-	  tmpmt.from=runstart;
-	  tmpmt.to=pos-1;
-	  actread.addTagO(tmpmt);
-	}
-      }
-    }
-
-    // this just sets kmer forks in reverse direction
-    if(truekmerforks){
-      CEBUG("REVkmerforks HWI-ST143:485:D0MR8ACXX:6:2204:4364:1904\n");
-      {
-	int32 bfpos=actread.calcClippedComplPos2RawPos(0);
-	int32 bfposinc=-1;
-
-	srvaI=singlereadvhraparray.begin();
-
-	hashesmade=Skim<TVHASH_T>::transformSeqToVariableHash(
-	  actreadid,
-	  actread,
-	  actread.getClippedComplementSeqAsChar(),
-	  slen,
-	  basesperhash,
-	  srvaI,
-	  false,
-	  1,
-	  tagmaskvector,
-	  bposhashstats,
-	  bfpos,
-	  bfposinc
-	  );
-      }
-      singlereadvhraparray.resize(hashesmade);
-
-      CEBUG("hashesmade: " << hashesmade << endl);
-      CEBUG("maskhashcov: " << maskhashcov << endl);
-
-      typename vector<hashstat_t>::const_iterator lowerbound;
-
-      typename vector<hashstat_t>::const_iterator hssearchI;
-      srvaI=singlereadvhraparray.begin();
-
-      hashstat_t hstmp;
-      bool foundit=false;
-      for(; srvaI != singlereadvhraparray.end(); srvaI++){
-	CEBUG(*srvaI << '\n');
-
-	foundit=false;
-	lowerbound=hsshortcuts[static_cast<uint64>(srvaI->vhash & HS_MAXVHASHMASK)].b;
-
-	// "HS_empty_vector_hashstat_t.end()" is the "nullptr" replacement
-	if(hashstats.end() != lowerbound){
-	  if(basesperhash>12){
-	    // with more than 12 bases in a hash, the array is subdivided
-	    hstmp.vhash=srvaI->vhash;
-	    hssearchI=lower_bound(lowerbound,
-				  hsshortcuts[static_cast<uint64>(srvaI->vhash & HS_MAXVHASHMASK)].e,
-				  hstmp,
-				  HashStatistics::sortHashStatComparatorLexicographicallyUp);
-	    if(hssearchI != hashstats.end()
-	       && hssearchI->vhash == srvaI->vhash) foundit=true;
-	  }else{
-	    hssearchI=lowerbound;
-	    foundit=true;
-	  }
-	}else{
-	  CEBUG("---------- NO LB HIT??? -------\n");
-	}
-
-	if(foundit) {
-	  CEBUG("VHRAP: " << *srvaI << '\n');
-	  CEBUG("HashStat: " << *hssearchI << '\n');
-	  CEBUG("srvaI->hashpos: " << srvaI->hashpos << '\n');
-
-	  if(hssearchI->hsc.iskmerforkr) {
-	    haskmerfork=true;
-
-	    int32 bfpos1=actread.calcClippedComplPos2RawPos(srvaI->hashpos-(basesperhash-1));
-	    CEBUG("-------------------- b bfpos1: " << bfpos1 << '\t' << srvaI->hashpos << '\t' << bposhashstats[bfpos1] << endl);
-
-	    bposhashstats[srvaI->hashpos].rev.setKMerFork();
-	  }
-	}
-      }
-
-    }
-
-    actread.setHasKMerFork(haskmerfork);
-
-    Read::setCoutType(Read::AS_TEXT);
-    CEBUG("### After ...\n" << actread << endl);
-  }
-
-  FUNCEND();
-  return;
-}
-//#define CEBUG(bla)
-
-
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-#define prefetchrl(p)     __builtin_prefetch((p), 0, 3)
-
-template<typename TVHASH_T>
-uint32 HashStatistics<TVHASH_T>::checkBaitHit(Read & actread, std::vector<vhrap_t> & baiting_singlereadvhraparray, std::vector<uint8> & baiting_tagmaskvector, bool changeseqcase)
-{
-  //, const uint32 basesperhash, vector<hashstat_t> & hashstats, vector<vector<hashstat_t>::const_iterator > & hsshortcuts_begin, vector<vector<hashstat_t>::const_iterator > & hsshortcuts_end)
-  FUNCSTART("uint32 HashStatistics<TVHASH_T>::checkBaitHit(Read & actread, std::vector<vhrap_t> & baiting_singlereadvhraparray, std::vector<uint8> & baiting_tagmaskvector, bool changeseqcase)");
-
-  if(changeseqcase) actread.upDownCase(127); // TODO: replace with a real tolower() asap
-
-  if(HS_hsv_hashstats.empty()) return 0;
-  if(!actread.hasValidData()) return 0;
-  uint32 slen=actread.getLenClippedSeq();
-  if(slen<HS_hs_basesperhash) return 0;
-
-  if(unlikely(HS_hsv_hsshortcuts.empty())) priv_makeHashStatArrayShortcuts();
-
-  // don't really need to clear out these re-used vectors
-  //   - tagmask just needs to be empty
-  //   - singlereadvhraparray needs to be big enough to be
-  //     written into by transformSeqToVariableHash(), will be
-  //     resized later on num hashes made
-  baiting_tagmaskvector.clear();
-  if(baiting_singlereadvhraparray.size() < slen){
-    baiting_singlereadvhraparray.resize(slen);
-  }
-
-  auto srvaI=baiting_singlereadvhraparray.begin();
-
-  vector<Read::bposhashstat_t> & bposhashstats=const_cast<vector<Read::bposhashstat_t> &>(actread.getBPosHashStats());
-  uint32 hashesmade;
-
-  {
-    int32 bfpos=0;
-    int32 bfposinc=1;
-
-    uint32 actreadid=0;
-
-    hashesmade=Skim<TVHASH_T>::transformSeqToVariableHash(
-      actreadid,
-      actread,
-      actread.getClippedSeqAsChar(),
-      slen,
-      HS_hs_basesperhash,
-      srvaI,
-      false,
-      1,
-      baiting_tagmaskvector,
-      bposhashstats,
-      bfpos,
-      bfposinc
-      );
-  }
-  baiting_singlereadvhraparray.resize(hashesmade);
-
-  CEBUG("hashesmade: " << hashesmade << endl);
-
-  typename vector<hashstat_t>::const_iterator lowerbound;
-
-  typename vector<hashstat_t>::const_iterator hssearchI;
-  srvaI=baiting_singlereadvhraparray.begin();
-
-  hashstat_t hstmp;
-  bool foundit;
-  uint32 numhits=0;
-  for(; srvaI != baiting_singlereadvhraparray.end(); srvaI++){
-    CEBUG(*srvaI << '\n');
-
-    lowerbound=HS_hsv_hsshortcuts[static_cast<uint64>(srvaI->vhash & HS_MAXVHASHMASK)].b;
-
-    foundit=false;
-
-    if(HS_hsv_hashstats.end() != lowerbound){
-      if(HS_hs_basesperhash>12){
-	// with more than 12 bases in a hash, the array is subdivided
-	hstmp.vhash=srvaI->vhash;
-	hssearchI=lower_bound(lowerbound,
-			      HS_hsv_hsshortcuts[static_cast<uint64>(srvaI->vhash & HS_MAXVHASHMASK)].e,
-			      hstmp,
-			      sortHashStatComparatorLexicographicallyUp);
-	if(hssearchI != HS_hsv_hashstats.end()
-	   && hssearchI->vhash == srvaI->vhash) foundit=true;
-      }else{
-	hssearchI=lowerbound;
-	foundit=true;
-      }
-    }else{
-      CEBUG("---------- NO LB HIT??? -------\n");
-    }
-
-    if(foundit) {
-      ++numhits;
-
-      if(changeseqcase){
-	// TODO: quite inefficient, change ASAP
-	for(uint32 pi=0;pi<HS_hs_basesperhash; ++pi){
-	  auto cpos=pi+srvaI->hashpos-HS_hs_basesperhash+1;
-	  actread.changeBaseInClippedSequence(toupper(actread.getBaseInClippedSequence(cpos)),255,cpos);
-	}
-      }
-    }
-  }
-
-  //cout << "\nskim Needs redo!\n";
-  //exit(0);
-
-  FUNCEND();
-  return numhits;
-}
-
-
-template<typename TVHASH_T>
-const typename HashStatistics<TVHASH_T>::hashstat_t * HashStatistics<TVHASH_T>::findVHash(const hashstat_t & searchval)
-{
-  FUNCSTART("const typename HashStatistics<TVHASH_T>::hashstat_t * HashStatistics<TVHASH_T>::findVHash(const hashstat_t & searchval)");
-
-  const hashstat_t * ret=nullptr;
-
-  if(unlikely(HS_hsv_hsshortcuts.empty())){
-    priv_makeHashStatArrayShortcuts();
-    BUGIFTHROW(unlikely(HS_hsv_hsshortcuts.empty()),"no shortcuts made ... empty hashstats?");
-  }
-
-  auto hsindex=static_cast<uint64>(searchval.vhash & HS_MAXVHASHMASK);
-  if(likely(!HS_hsv_hashstats.empty())
-     && HS_hsv_hashstats.end() != HS_hsv_hsshortcuts[hsindex].b){
-    auto hsI=HS_hsv_hsshortcuts[hsindex].b;
-    // TODO: test with large & diverse data set effect of prefetch
-    prefetchrl(&(*hsI));
-    if(HS_hsv_hsshortcuts[hsindex].e-hsI > 1){
-      // with more than 12 bases in a hash, the array is subdivided
-      // TODO: test with large & diverse data set whether this split in lower_bound
-      //  vs. simple while loop is OK
-      if(HS_hsv_hsshortcuts[hsindex].e-hsI > 4){
-	hsI=lower_bound(hsI,
-			HS_hsv_hsshortcuts[hsindex].e, // upperbound
-			searchval,
-			sortHashStatComparatorLexicographicallyUp);
-      }else{
-	while(hsI!=HS_hsv_hsshortcuts[hsindex].e && hsI->vhash!=searchval.vhash){
-	  ++hsI;
-	}
-      }
-    }
-    if(hsI != HS_hsv_hashstats.end()
-       && hsI->vhash == searchval.vhash) ret=&(*hsI);
-  }
-
-  return ret;
-}
-
-
-
-
-/*************************************************************************
- *
- * test
- *
- * implicit return:
- *  - dn_vhashindexes with indexes to all valid vhashes in sequence
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-//#define CEBUG(bla)   {if(docebug) {cout << bla; cout.flush();}}
-template<typename TVHASH_T>
-bool HashStatistics<TVHASH_T>::priv_dn_TestSingleSeq(Read & actread, vector<uint8> & dn_allow, vector<size_t> & dn_vhashindexes)
-{
-  FUNCSTART("bool HashStatistics<TVHASH_T>::priv_dn_TestSingleSeq(Read & actread, vector<uint8> & dn_allow, vector<size_t> & dn_vhashindexes)");
-
-  //bool docebug=false;
-  BUGIFTHROW(HS_hsv_hsshortcuts.empty(),"no shortcuts made, not ready for searching?");
-
-  const uint8 * seq = reinterpret_cast<const uint8 *>(actread.getClippedSeqAsChar());
-  uint64 slen=actread.getLenClippedSeq();
-
-  if(slen<HS_hs_basesperhash) return false;
-
-  const char *  namestr=actread.getName().c_str();
-
-  dn_vhashindexes.clear();
-  dn_allow.clear();
-  dn_allow.resize(slen,1);
-
-  // TODO: option to have it only on MNRr or given HAFx stretches
-  auto bhsI=actread.getBPosHashStats().begin();
-  bhsI+=actread.getLeftClipoff();
-  for(auto ri=0; ri<slen; ++ri){
-    if(bhsI->fwd.getFrequency()<2 || !bhsI->fwd.hasConfirmedFwdRev()){
-      dn_allow[ri]=0;
-    }
-  }
-
-
-  hashstat_t searchval;
-  bool takeread=false;
-
-  auto basesperhash=HS_hs_basesperhash;
-
-  SEQTOHASH_LOOPSTART(TVHASH_T){
-
-    auto hssi=static_cast<uint64>(acthash & HS_MAXVHASHMASK);
-    if(HS_hsv_hashstats.end() != HS_hsv_hsshortcuts[hssi].b){
-      auto hsI=HS_hsv_hsshortcuts[hssi].b;
-      // TODO: test with large & diverse data set effect of prefetch
-      prefetchrl(&(*hsI));
-      if(HS_hsv_hsshortcuts[hssi].e-hsI > 1){
-	// with more than 12 bases in a hash, the array is subdivided
-	// TODO: test with large & diverse data set whether this split in lower_bound
-	//  vs. simple while loop is OK
-	if(HS_hsv_hsshortcuts[hssi].e-hsI > 4){
-	  searchval.vhash=acthash;
-	  hsI=lower_bound(hsI,
-			  HS_hsv_hsshortcuts[hssi].e, // upperbound
-			  searchval,
-			  sortHashStatComparatorLexicographicallyUp);
-	}else{
-	  while(hsI!=HS_hsv_hsshortcuts[hssi].e && hsI->vhash!=acthash){
-	    ++hsI;
-	  }
-	}
-      }
-
-      if(hsI != HS_hsv_hashstats.end()
-	 && hsI->vhash == acthash) {
-	// hsI on valid valid hash
-	size_t hsindex=hsI-HS_hsv_hashstats.begin();
-	CEBUG("hashfound " << seqi << "\t" << hsindex << endl);
-	dn_vhashindexes.push_back(hsindex);
-	if(dn_allow[seqi] && HS_diginorm_count[hsindex]<10){
-	  takeread=true;
-	}
-      }else{
-	CEBUG("no hash? " << seqi << endl);
-      }
-    }
-
-  }SEQTOHASH_LOOPEND;
-
-  return takeread;
-}
-//#define CEBUG(bla)
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-template<typename TVHASH_T>
-bool HashStatistics<TVHASH_T>::digiNormTestRead(Read & actread, bool forcetake)
-{
-  FUNCSTART("bool HashStatistics<TVHASH_T>::digiNorm(Read & actread)");
-
-  if(unlikely(HS_diginorm_count.empty())){
-    HS_diginorm_count.resize(HS_hsv_hashstats.size(),0);
-  }
-
-  if(!actread.hasTag(Read::REA_defaulttag_MNRr.identifier)) return true;
-
-  bool takeread=priv_dn_TestSingleSeq(actread,HS_diginorm_allow_s1,HS_diginorm_vhashindexes_s1);
-
-  if(forcetake) takeread=true;
-
-  if(takeread){
-    CEBUG("dntr take " << actread.getName() << ": " << HS_diginorm_vhashindexes_s1.size() << endl);
-    for(auto hsi : HS_diginorm_vhashindexes_s1){
-      ++HS_diginorm_count[hsi];
-    }
-  }
-
-  return takeread;
-}
-//#define CEBUG(bla)
-
-
-
-/*************************************************************************
- *
- * test
- *
- *
- *************************************************************************/
-
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-
-template<typename TVHASH_T>
-uint32 HashStatistics<TVHASH_T>::estimDigiNormCov(Read & actread)
-{
-  FUNCSTART("void HashStatistics<TVHASH_T>::estimDigiNormCov(Read & actread)");
-
-  BUGIFTHROW(HS_hsv_hsshortcuts.empty(),"no shortcuts made, not ready for searching?");
-
-  const uint8 * seq = reinterpret_cast<const uint8 *>(actread.getClippedSeqAsChar());
-  uint64 slen=actread.getLenClippedSeq();
-
-  if(slen<HS_hs_basesperhash) return 1;
-
-  const char *  namestr=actread.getName().c_str();
-
-  auto basesperhash=HS_hs_basesperhash;
-
-
-  double dncmin=10000000.0;
-  bool hasnewmin=false;
-  //double dncmax=0.0;
-  double totaladd=0.0;
-  uint32 numtotal=0;
-
-
-  hashstat_t searchval;
-
-  SEQTOHASH_LOOPSTART(TVHASH_T){
-
-    auto hssi=static_cast<uint64>(acthash & HS_MAXVHASHMASK);
-    if(HS_hsv_hashstats.end() != HS_hsv_hsshortcuts[hssi].b){
-      auto hsI=HS_hsv_hsshortcuts[hssi].b;
-      // TODO: test with large & diverse data set effect of prefetch
-      prefetchrl(&(*hsI));
-      if(HS_hsv_hsshortcuts[hssi].e-hsI > 1){
-	// with more than 12 bases in a hash, the array is subdivided
-	// TODO: test with large & diverse data set whether this split in lower_bound
-	//  vs. simple while loop is OK
-	if(HS_hsv_hsshortcuts[hssi].e-hsI > 4){
-	  searchval.vhash=acthash;
-	  hsI=lower_bound(hsI,
-			  HS_hsv_hsshortcuts[hssi].e, // upperbound
-			  searchval,
-			  sortHashStatComparatorLexicographicallyUp);
-	}else{
-	  while(hsI!=HS_hsv_hsshortcuts[hssi].e && hsI->vhash!=acthash){
-	    ++hsI;
-	  }
-	}
-      }
-
-      if(hsI != HS_hsv_hashstats.end()
-	 && hsI->vhash == acthash) {
-	// hsI on valid valid hash
-
-	auto hsindex=hsI-HS_hsv_hashstats.begin();
-
-	// *sigh* this is very well possible
-	// BUGIFTHROW(HS_diginorm_count[hsindex]==0,actread.getName() << " HS_diginorm_count[hsindex]==0 ???");
-	// e.g. in first pass a DGNR tag gets set like so: ...TTTTT
-	// and somewhere the read gets cut back like so: ...
-	// then the tag still may exist.
-	// therefore: if count is 0, then do as if no hash existed
-
-	if(HS_diginorm_count[hsindex]!=0){
-	  double actdnc=static_cast<double>(hsI->hsc.getCount())/HS_diginorm_count[hsindex];
-	  ++numtotal;
-	  totaladd+=actdnc;
-	  //if(actdnc>dncmax) dncmax=actdnc;
-	  if(actdnc<dncmin) {
-	    dncmin=actdnc;
-	    hasnewmin=true;
-	  }
-	  CEBUG(actread.getName() << "\t" << hsI->hsc.getCount() << "\t" << HS_diginorm_count[hsindex] << "\t" << actdnc << endl);
-	}
-      }else{
-	//BUGIFTHROW(true,"Can't be?");
-	// well ... can be, as the haststats does contain only "valid" hashes where we are sure they're present multiple times etc.,
-	//  we might encounter a hash here which is not in hashstats.
-	// therefore, this is a singlet event
-
-	// but singlet events were, by default, not accounted for in digiNormTestRead(), therefore
-	//  we should not return "1" but simply do nothing and continue calculating
-	//return 1;
-      }
-    }
-
-  }SEQTOHASH_LOOPEND;
-
-  CEBUG("dncstats " << actread.getName() << ": " << dncmin);
-  //CEBUG("\t" << dncmax(;
-  CEBUG("\t" << totaladd/numtotal);
-  CEBUG(endl);
-
-  //if(dncmin<=6) return dncmin;
-
-  if(!hasnewmin) {
-    CEBUG("WTH??? " << actread.getName() << " has no dncmin ???\n");
-    return 1;
-  }
-
-  return static_cast<uint32>((totaladd/numtotal)+.5);
-
-  //return static_cast<uint32>(dncmin+0.5);
-}
-//#define CEBUG(bla)
-
-
-/*************************************************************************
- *
- *
- *************************************************************************/
-
-template<typename TVHASH_T>
-void HashStatistics<TVHASH_T>::dump(ostream & ostr)
-{
-  FUNCSTART("void HashStatistics<TVHASH_T>::dump(ostream & ostr)");
-
-  string tmpstr;
-  for(auto & hse : HS_hsv_hashstats){
-    hash2string(hse.vhash,HS_hs_basesperhash,tmpstr);
-    ostr << tmpstr
-	 << '\t' << hse.hsc.fcount
-	 << '\t' << hse.hsc.rcount
-	 << '\t' << hse.hsc.fcount + hse.hsc.rcount
-	 << '\n';
-  }
-}
-
-/*************************************************************************
- *
- *
- *************************************************************************/
-
-template<typename TVHASH_T>
-void HashStatistics<TVHASH_T>::dumpHSDebug(ostream & ostr)
-{
-  FUNCSTART("void HashStatistics<TVHASH_T>::dumpHSDebug(ostream & ostr)");
-
-  string tmpstr;
-  for(auto & hse : HS_hsv_hashstats){
-    hash2string(hse.vhash,HS_hs_basesperhash,tmpstr);
-    ostr << tmpstr
-	 << '\t' << hse
-	 << '\n';
-  }
-}
-
-/*************************************************************************
- *
- *
- *************************************************************************/
-
-template<typename TVHASH_T>
-void HashStatistics<TVHASH_T>::dumpAsFASTA(ostream & ostr)
-{
-  FUNCSTART("void HashStatistics<TVHASH_T>::dumpAsFASTA(ostream & ostr)");
-
-  string tmpstr;
-  uint64 counter=1;
-  for(auto & hse : HS_hsv_hashstats){
-    hash2string(hse.vhash,HS_hs_basesperhash,tmpstr);
-    ostr << ">" << counter++
-	 << ' ' << hse.hsc.fcount
-	 << ' ' << hse.hsc.rcount
-	 << ' ' << hse.hsc.fcount + hse.hsc.rcount
-	 << '\n' << tmpstr
-	 << '\n';
-  }
-}
-
-
-
-// explicit template instantiations needed for the linker to create these for library files
-template class HashStatistics<vhash64_t>;
-#ifndef KMER_INTERNALTYPE
-template class HashStatistics<vhash128_t>;
-template class HashStatistics<vhash256_t>;
-template class HashStatistics<vhash512_t>;
-#endif
-
diff --git a/src/mira/hashstats.H b/src/mira/hashstats.H
deleted file mode 100644
index 9beaed5..0000000
--- a/src/mira/hashstats.H
+++ /dev/null
@@ -1,616 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- * Copyright (C) 2007 by Bastien Chevreux
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-#ifndef _bas_hashstats_h_
-#define _bas_hashstats_h_
-
-#include <unordered_map>
-
-#include <boost/thread/mutex.hpp>
-#include <boost/thread/condition.hpp>
-#include <boost/regex.hpp>
-
-#include "stdinc/defines.H"
-
-#include "mira/readpool.H"
-
-#include <zlib.h>
-
-
-
-template<typename TVHASH_T>
-class HashStatistics
-{
-
-// GRIZZLYBEAR down below to perform timing experiments specific to a
-// comparator used in std::sort()
-// Result: I want to use HS_MAXVHASHMASK as a const static variable :-)
-#if 1
-#define HSVHM_var
-  const static TVHASH_T HS_MAXVHASHMASK;
-//#define GRIZZLYBEAR 0xffffffULL
-#define GRIZZLYBEAR HS_MAXVHASHMASK
-#else
-#define HS_MAXVHASHMASK 0xffffffUL
-#define GRIZZLYBEAR HS_MAXVHASHMASK
-#endif
-
-
-/*************************************************************************
- *
- *  hashstatistics public structs and vars
- *
- *************************************************************************/
-
-public:
-  struct vhrap_t {
-    TVHASH_T vhash;       // vhash,
-    uint32 readid;       // readid
-    uint16 hashpos;      // (hash)position  (lowest pos: basesperhash-1)
-
-    Read::bhashstat_t bhashstats; // baseflags for this hash
-
-    //bool operator<(const vhrap_t & other) const {return vhash < other.vhash;};
-    friend std::ostream & operator<<(std::ostream &ostr, const vhrap_t & v){
-      ostr << "hash: " << std::hex << v.vhash
-	   << "\trid: " <<std::dec << v.readid
-	   << "\thpos: " << v.hashpos
-	   << "\tbhs: " << v.bhashstats;
-      return ostr;
-    }
-  };
-
-  enum {HSSS_NOTSORTED=0, HSSS_LOW24BIT, HSSS_LEXIUP, HSSS_BYCOUNTUP, HSSS_BYCOUNTDOWN, HSSS_LEXBYCOUNT, HSSS_MASKUP};
-
-  static void hash2string(TVHASH_T hash, uint32 basesperhash, std::string & str);
-  static inline std::string hash2string(TVHASH_T hash, uint32 basesperhash) { std::string tmp; hash2string(hash,basesperhash,tmp); return tmp;}
-
-
-#define MULTISEQTYPE 0xf
-
-  // new hashstat
-  class hscounts_t {
-  private:
-    uint8   lowposd4;      // lowest hash position/4 (lowest pos: 0, 255 means >=1020)
-  public:
-    uint32  fcount:24;
-    bool    iskmerforkf:1;
-    bool    iskmerforkr:1;
-    bool    hasfwdrevthresholdok:1; // tempted, temporary solution, delete afterwards
-    bool    b4:1;          // 1 bit, unused atm
-  public:
-    uint8   seqtype:4;     // sequencing type
-    uint32  rcount:24;
-
-  public:
-    hscounts_t() {
-      uint64 * ptr=reinterpret_cast<uint64 *>(&lowposd4);
-      *ptr=0;
-    }
-
-    friend std::ostream & operator<<(std::ostream &ostr, const hscounts_t & v){
-      ostr << "fcount: " << v.fcount
-	   << "\trcount: " << v.rcount
-	   << "\tlowposd4: " << static_cast<uint32>(v.lowposd4)
-	   << "\tseqtype: " << static_cast<uint16>(v.seqtype)
-	   << "\tkmf: " << v.iskmerforkf
-	   << " kmr: " << v.iskmerforkr
-	   << " fr: " << v.hasfwdrevthresholdok
-	;
-      return ostr;
-    }
-
-    inline void setLowPos(uint32 pos) {lowposd4=static_cast<uint8>(std::min(pos/4,static_cast<uint32>(255)));}
-    inline uint32 getLowPos() const {return lowposd4*4;}
-    inline uint32 getCount() const {return fcount+rcount;}
-  };
-
-
-  struct hashstat_t {
-    hscounts_t hsc;
-    TVHASH_T   vhash;       // vhash,
-
-    hashstat_t() {
-      vhash=0;
-    }
-
-    friend std::ostream & operator<<(std::ostream &ostr, const hashstat_t & v){
-      ostr << "hash: " << std::hex << v.vhash << std::dec
-	   << '\t' << v.hsc
-	;
-      return ostr;
-    }
-  };
-
-  // Some avg frequency numbers for the hash statistics
-  struct avg_freq_t {
-    bool valid=false;
-    size_t corrected=0;
-    size_t raw=0;
-    size_t taken=0;
-    size_t min=0;
-  };
-
-  struct mhsheader_t {
-    uint8  version=0;
-    uint8  sortstatus=0;
-    uint32 basesperhash=0;
-    uint32 sizeofhash=0;      // in bytes, as given by sizeof(TVHASH_T)
-    uint64 numelem=0;
-
-    avg_freq_t freq;
-
-    friend std::ostream & operator<<(std::ostream &ostr, const mhsheader_t & mhsh){
-      ostr << "v: " << static_cast<uint16>(mhsh.version)
-	   << "\tss: " << static_cast<uint16>(mhsh.sortstatus)
-	   << "\tbph: " << mhsh.basesperhash
-	   << "\tsoh: " << mhsh.sizeofhash
-	   << "\tne: " << mhsh.numelem
-	   << "\nh.v " << mhsh.freq.valid
-	   << "\th.c " << mhsh.freq.corrected
-	   << "\th.r " << mhsh.freq.raw
-	   << "\th.t " << mhsh.freq.taken
-	   << "\th.m " << mhsh.freq.min
-	;
-      return ostr;
-    }
-  };
-
-
-/*************************************************************************
- *
- * hashstatistics_sdbg
- *
- * All of this is still a little bit brittle ...
- *
- *************************************************************************/
-
-  // -------------------------------------------------------------------------------------
-  // Structs and vars
-
-public:
-  struct dbgedits_t {
-    uint32 pos=0;
-    uint32 len=0;
-    std::string replacement;
-
-    dbgedits_t(uint32 p, uint32 l, std::string & r) : pos(p), len(l), replacement(r) {};
-  };
-
-private:
-  struct hashstatnode_t {
-    int64 next;
-    int64 prev;
-
-    uint32 graphid;
-
-    hashstatnode_t() : next(-1), prev(-1), graphid(-1) {};
-
-    friend std::ostream & operator<<(std::ostream &ostr, const hashstatnode_t & v){
-      ostr << v.next
-	   << '\t' << v.prev
-	   << '\t' << v.graphid
-	;
-      return ostr;
-    }
-  };
-
-  struct dbgseq_t {
-    std::string seq;
-    uint32 medianhashcov;
-
-    uint32 expectedcopynumber;
-
-    int64 hsni_first;  // hashstatnode_t index first (first kmer of sequence)
-    int64 hsni_last;  // hashstatnode_t index last (last kmer of sequence)
-    uint32 graphid;
-
-    dbgseq_t() : medianhashcov(0), expectedcopynumber(0), hsni_first(-1), hsni_last(-1), graphid(-1) {};
-  };
-
-  // for sdg
-  std::vector<hashstatnode_t> HS_hsv_hashstatnodes;  // size of HS_hsv_hashstats
-  std::vector<dbgseq_t> HS_hsv_dbgseqs;  //
-
-  // -------------------------------------------------------------------------------------
-  // Functions
-
-private:
-  void priv_sdbg_populateHashStatNodes();
-  void priv_sdbg_assignGraphIDsMakeSeqsAndCollectStats();
-  void priv_sdbg_calcExpectedCopyNumbers();
-
-  void priv_sdbg_buildSequenceFromPath(int64 hsi1, int64 hsi2, std::string & retseq);
-  bool priv_sdbg_checkPathDistance(int64 hsi1, int64 hsi2, int64 dist);
-
-public:
-  void buildSDBGraphs();
-  void proposeSDBGEditsForSequence(const void * seqvoid, uint64 slen, const char * namestr, std::vector<dbgedits_t> & edits);
-  bool checkSequenceForSDBGChimeras(const void * seqvoid, uint64 slen, const char * namestr);
-
-
-/*************************************************************************
- *
- * hashstatistics
- *
- *************************************************************************/
-
-
-private:
-  static uint32 HS_hsfilemagic;
-
-  struct hsvbendit_t {
-    typename std::vector<hashstat_t>::const_iterator b;
-    typename std::vector<hashstat_t>::const_iterator e;
-  };
-
-  static size_t HS_numelementsperbuffer;
-
-//  ReadPool * HS_readpoolptr;
-
-  double HS_freqest_minnormal=.4;
-  double HS_freqest_maxnormal=1.6;
-  double HS_freqest_repeat=2.0;
-  double HS_freqest_heavyrepeat=8.0;
-  double HS_freqest_crazyrepeat=20.0;
-  uint32 HS_rarekmercount=2;
-  uint32 HS_nastyrepeatratio=100;
-  uint32 HS_nastyrepeatcoverage=0;
-
-  uint32 HS_hs_basesperhash=0;
-
-  std::vector<hashstat_t> HS_hsv_hashstats;
-  std::vector<hsvbendit_t> HS_hsv_hsshortcuts;
-
-
-  // for streaming old hash statistics
-  std::string HS_hashstatfilename;
-  std::vector<std::string> HS_hashfilenames;
-  std::vector<size_t>      HS_elementsperfile;
-  std::vector<gzFile>      HS_hashfiles;
-  std::vector<std::vector<hashstat_t> > HS_hashfilebuffer;
-  size_t HS_rightshift;
-
-  //
-  uint8 HS_hs_sortstatus; // not fully implemented yet!
-
-  avg_freq_t HS_avg_freq;
-
-  // size of ReadGroupLib::getNumSequencingTypes()
-  // kmers having count < given value are marked as frequency 1 (or 0 ???) so that
-  //  they can be masked later on in data processing
-  //
-  // assignReadBaseStatistics() will initialise it to {0, 0, ...} if not of correct size
-  std::vector<uint32> HS_rarekmermasking;
-
-  /*
-    Baiting
-   */
-
-  std::vector<vhrap_t> HS_baiting_singlereadvhraparray;
-  std::vector<uint8>   HS_baiting_tagmaskvector;
-
-  bool HS_logflag_hashcount;
-
-  /*
-    Multithreading assign read base statistics
-  */
-
-  struct arbs_threadsharecontrol_t {
-    boost::mutex accessmutex;
-    int32 from;
-    int32 to;
-    int32 todo;
-    int32 done;
-    int32 stepping;
-
-    // need to go via this as the boost:bind does not like a "ReadPool &" as parameter
-    // and it also cannot have more than 9 parameters in total ... we'd have more with the below
-    ReadPool * rpptr;
-    size_t avghashcov;
-
-    std::vector<hashstat_t> * hashstatsptr;
-    std::vector<hsvbendit_t> * hsscptr;
-
-    uint32 basesperhash;
-    bool masknastyrepeats;
-    bool truekmerforks;
-  };
-
-  //
-  // Digital normalisation
-  //
-
-  std::vector<size_t> HS_diginorm_count;
-
-  std::vector<uint8>  HS_diginorm_allow_s1;
-  std::vector<size_t> HS_diginorm_vhashindexes_s1;
-
-  //
-  // A variable hash mask for the sortHashStatComparatorByMask
-  // atm used by priv_calcKMerForks()
-  //
-  // Careful: due to static nature, cannot be used by multiple threads with different values!!!
-
-  static TVHASH_T HS_vhashmask;
-
-  /*
-    Logging, debugging
-  */
-
-
-public:
-
-
-  //Functions
-private:
-  // old sort & count kmer counting
-  // -------------------------------------------------------------------------------------
-  void priv_hashes2disk(ReadPool & rp,
-			bool checkusedinassembly,
-			bool alsorails,
-			bool fwdandrev,
-			uint32 fwdrevmin,
-			uint32 basesperhash,
-			uint32 millionhashesperbuffer);
-  size_t priv_writeCompressedHFB(size_t hfindex,
-				 std::vector<hashstat_t> & hfb,
-				 uint32 fwdrevmin,
-				 uint32 rarekmerearlykill,
-				 gzFile & gzf,
-				 bool force);
-  void priv_compressHashStatBufferInPlace(std::vector<hashstat_t> & hsb,
-					  uint32 fwdrevmin,
-					  uint32 rarekmerearlykill);
-  size_t priv_createHashStatisticsFile(const std::string & hashstatfilename,
-				       std::vector<std::string> & hashfilenames,
-				       std::vector<size_t> & elementsperfile,
-				       uint32 fwdrevmin,
-				       uint32 rarekmerearlykill);
-  // -------------------------------------------------------------------------------------
-  // HashStatistics comparators
-  inline static bool sortHashStatComparatorByLow24bit(const hashstat_t & a, const hashstat_t & b){
-    if((a.vhash & GRIZZLYBEAR) != (b.vhash & GRIZZLYBEAR)) {
-      return (a.vhash & GRIZZLYBEAR) < (b.vhash & GRIZZLYBEAR);
-    }
-    //if((GRIZZLYBEAR & a.vhash) != (GRIZZLYBEAR & b.vhash)) {
-    //  return (GRIZZLYBEAR & a.vhash) < (GRIZZLYBEAR & b.vhash);
-    //}
-    return a.vhash < b.vhash;
-  }
-
-  inline static bool sortHashStatComparatorLexByCount(const hashstat_t & a, const hashstat_t & b){
-    if(a.vhash==b.vhash){
-      return a.hsc.fcount+a.hsc.rcount < b.hsc.fcount+b.hsc.rcount;
-    }
-    return a.vhash < b.vhash;
-  }
-  inline static bool sortHashStatComparatorLexicographicallyUp(const hashstat_t & a, const hashstat_t & b){
-    return a.vhash < b.vhash;
-  }
-  inline static bool sortHashStatComparatorByCountUp(const hashstat_t & a, const hashstat_t & b){
-    return a.hsc.fcount+a.hsc.rcount < b.hsc.fcount+b.hsc.rcount;
-  }
-  inline static bool sortHashStatComparatorByCountDown(const hashstat_t & a, const hashstat_t & b){
-    return a.hsc.fcount+a.hsc.rcount > b.hsc.fcount+b.hsc.rcount;
-  }
-  inline static bool sortHashStatComparatorByMaskUp(const hashstat_t & a, const hashstat_t & b){
-    if((a.vhash & HS_vhashmask) != (b.vhash & HS_vhashmask)) {
-      return (a.vhash & HS_vhashmask) < (b.vhash & HS_vhashmask);
-    }
-    return a.vhash < b.vhash;
-  }
-
-
-  // -------------------------------------------------------------------------------------
-  // HashStatistics sorter
-  void priv_sorthelper(std::vector<hashstat_t> & hashstats, uint8 * sortstatusptr, uint8 finalstatus, const char * compname, bool (*ccallback)(const hashstat_t & a, const hashstat_t & b));
-
-  void priv_sortLow24Bit(std::vector<hashstat_t> & hashstats, uint8 * sortstatusptr);
-  void priv_sortLexicographicallyUp(std::vector<hashstat_t> & hashstats, uint8 * sortstatusptr);
-  void priv_sortByCountUp(std::vector<hashstat_t> & hashstats, uint8 * sortstatusptr);
-  void priv_sortByCountDown(std::vector<hashstat_t> & hashstats, uint8 * sortstatusptr);
-  void priv_sortLexByCount(std::vector<hashstat_t> & hashstats, uint8 * sortstatusptr);
-  void priv_sortMaskUp(std::vector<hashstat_t> & hashstats, uint8 * sortstatusptr);
-
-  inline void priv_sortLow24Bit() {priv_sortLow24Bit(HS_hsv_hashstats,&HS_hs_sortstatus);}
-  inline void priv_sortLexicographicallyUp() {priv_sortLexicographicallyUp(HS_hsv_hashstats,&HS_hs_sortstatus);}
-  inline void priv_sortByCountUp() {priv_sortByCountUp(HS_hsv_hashstats,&HS_hs_sortstatus);}
-  inline void priv_sortByCountDown() {priv_sortByCountDown(HS_hsv_hashstats,&HS_hs_sortstatus);}
-  inline void priv_sortLexByCount() {priv_sortLexByCount(HS_hsv_hashstats,&HS_hs_sortstatus);}
-  inline void priv_sortMaskUp() {priv_sortMaskUp(HS_hsv_hashstats,&HS_hs_sortstatus);}
-
-  // -------------------------------------------------------------------------------------
-  // ...
-  void priv_makeHashStatArrayShortcuts();
-
-  // -------------------------------------------------------------------------------------
-  // ...
-  void priv_calcAvgHashFreq(bool verbose=false);
-
-  size_t priv_calcMidHashStatIndex(const std::vector<hashstat_t> & hashstats,
-				   size_t dontcarepercent);
-
-  void priv_ckmf_helper(TVHASH_T HashStatistics__vhashmask, uint32 mincount);
-  void priv_ckmf_relaxed_helper(TVHASH_T HashStatistics__vhashmask, uint32 mincount, bool isfwd);
-
-  // assignReadBaseStatistics()
-  void priv_arb_thread(uint32 threadnum, arbs_threadsharecontrol_t * tscptr);
-  void priv_arb_DoStuff(
-    ReadPool & rp,
-    size_t avgcov,
-    std::vector<hashstat_t> & hashstats,
-    const uint32 basesperhash,
-    std::vector<hsvbendit_t> & hsshortcuts,
-    bool masknastyrepeats,
-    int32 fromid,
-    int32 toid,
-    bool truekmerforks
-    );
-
-  bool priv_dn_TestSingleSeq(Read & actread, std::vector<uint8> & dn_allow, std::vector<size_t> & dn_vhashindexes);
-
-  void priv_saveHashVStatistics(gzFile & gzf);
-
-  void priv_trimHashVStatsByFrequencyAND(uint32 minfwd, uint32 minrev, uint32 mintotal);
-  void priv_trimHashVStatsByFrequencyANDOR(uint32 minfwd, uint32 minrev, uint32 mintotal);
-
-  // prepareHashStatistics common part
-  void priv_phsCommon(ReadPool * rpptr,
-		      bool fwdandrev,
-		      uint32 fwdrevmin,
-		      uint32 rarekmerearlykill,
-		      uint32 basesperhash,
-		      uint32 millionhashesperbuffer,
-		      const std::string & tmpdirectory);
-
-public:
-  // TODO: back to non-static private once HSN has been merged
-  static mhsheader_t priv_writeHashStatFileHeader(std::ostream & ostr,
-						  uint32 basesperhash,
-						  uint8 sortstatus,
-						  uint64 numelem);
-
-  mhsheader_t priv_writeHashStatFileHeader(gzFile & gzf,
-					   uint32 basesperhash,
-					   uint8 sortstatus,
-					   uint64 numelem);
-
-  HashStatistics() {
-    HS_logflag_hashcount=false;
-  };
-  HashStatistics(HashStatistics const &other);
-  ~HashStatistics() {};
-
-  HashStatistics const & operator=(HashStatistics const & other);
-
-  static uint32 byteSizeOfHash(uint32 hashlen);
-
-  void discard();
-  bool hasStatistics() const { return !HS_hsv_hashstats.empty();}
-
-  size_t getAvgHashFreqCorrected() const { return HS_avg_freq.corrected;};
-  size_t getAvgHashFreqRaw() const { return HS_avg_freq.raw;};
-
-  void setAvgHashFreqMinimum(size_t m) { HS_avg_freq.min=m;};
-
-  void setHashFrequencyRatios(double freqest_minnormal,
-			      double freqest_maxnormal,
-			      double freqest_repeat,
-			      double freqest_heavyrepeat,
-			      double freqest_crazyrepeat,
-			      uint32 rarekmercount,
-			      uint32 nastyrepeatratio,
-			      uint32 nastyrepeatcoverage);
-
-  // ----------------- One step, complete readpool
-  void prepareHashStatistics(ReadPool & rp,
-			     bool checkusedinassembly,
-			     bool alsorails,
-			     bool fwdandrev,
-			     uint32 fwdrevmin,
-			     uint32 rarekmerearlykill,
-			     uint32 basesperhash,
-			     uint32 millionhashesperbuffer,
-			     const std::string & hashstatfilename,
-			     const std::string & tmpdirectory);
-  // ----------------- Streaming
-  void prepareStreamHashStatistics(ReadPool * rpptr,    // not implemented
-				   bool checkusedinassembly, bool onlyagainstrails,
-				   bool alsosavesinglehashes,
-				   bool fwdandrev,
-				   uint32 fwdrevmin,
-				   uint32 basesperhash,
-				   uint32 millionhashesperbuffer,
-				   bool rarekmerearlykill,
-				   const std::string & hashstatfilename,
-				   const std::string & tmpdirectory);
-  void prepareStreamAddNextSequence(const void * seqvoid, uint64 slen, const char * namestr, uint8 seqtype, bool isreverse,
-				    uint32 fwdrevmin);
-  void prepareStreamFinalise(uint32 fwdrevmin, uint32 rarekmerearlykill);
-  // -----------------------------------------------------------------------
-
-  void assignReadBaseStatistics_MultiThread(ReadPool & rp,
-					    uint32 numthreads,
-					    bool masknastyrepeats,
-					    uint32 mincountkmerforks,
-					    bool needfwdrev
-    );
-
-  //void showHashStatisticsInfo(std::string & filename);
-  void showHashStatisticsInfo();
-
-  void calcKMerForks(uint32 mincount, bool needfwdrev);
-
-  void loadHashStatistics(const std::string & filename);
-  void loadHashStatistics(gzFile & gzf);
-  static const mhsheader_t loadHashStatisticsFileHeader(const std::string & filename);
-  static const mhsheader_t loadHashStatisticsFileHeader(gzFile & gzf);
-  void loadHashStatistics(const mhsheader_t & mhsh, gzFile & gzf);
-
-  void saveHashStatistics(const std::string & filename);
-  void saveHashStatistics(gzFile & gzf);
-
-
-  uint32 getBasesPerHash() const {return HS_hs_basesperhash;}
-  size_t getNumHashEntries() const {return HS_hsv_hashstats.size();}
-  std::vector<hashstat_t> & getHashStats() {return HS_hsv_hashstats;}
-
-  void dump(std::ostream & ostr);
-  void dumpHSDebug(std::ostream & ostr);
-  void dumpAsFASTA(std::ostream & ostr);
-
-  void trimHashStatsByFrequencyAND(uint32 minfwd, uint32 minrev, uint32 mintotal);
-  void trimHashStatsByFrequencyANDOR(uint32 minfwd, uint32 minrev, uint32 mintotal);
-
-  // use this one for multi-thread baiting on the same HashStatistics object
-  uint32 checkBaitHit(Read & actread, std::vector<vhrap_t> & baiting_singlereadvhraparray, std::vector<uint8> & baiting_tagmaskvector, bool changeseqcase);
-  // use this one for single thread baiting on the same HashStatistics object
-  inline uint32 checkBaitHit(Read & actread, bool changeseqcase) {return checkBaitHit(actread,HS_baiting_singlereadvhraparray,HS_baiting_tagmaskvector, changeseqcase);}
-
-  const hashstat_t * findVHash(const hashstat_t & searchval);
-
-  void digiNormReset() { HS_diginorm_count.clear();}
-  bool digiNormTestRead(Read & actread, bool force);
-  uint32 estimDigiNormCov(Read & actread);
-
-  // for MiraDiff
-  void inAAndB(HashStatistics & a, HashStatistics & b);
-  void inANotB(HashStatistics & a, HashStatistics & b);
-
-  inline void sortLow24Bit(){
-    priv_sortLow24Bit(HS_hsv_hashstats, &HS_hs_sortstatus);
-  }
-  inline void sortLexicographicallyUp(){
-    priv_sortLexicographicallyUp(HS_hsv_hashstats, &HS_hs_sortstatus);
-  }
-  inline void sortByCountUp(){
-    priv_sortByCountUp(HS_hsv_hashstats, &HS_hs_sortstatus);
-  }
-  inline void sortByCountDown(){
-    priv_sortByCountDown(HS_hsv_hashstats, &HS_hs_sortstatus);
-  }
-};
-
-
-
-
-#endif
diff --git a/src/mira/hashstats_sdbg.C b/src/mira/hashstats_sdbg.C
deleted file mode 100644
index c83f20a..0000000
--- a/src/mira/hashstats_sdbg.C
+++ /dev/null
@@ -1,693 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- * Copyright (C) 2007 and later by Bastien Chevreux
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- *
- */
-
-#ifdef BOTCHEDEXPLICITINSTANTIATIONLINKER
-// the following define is set by hashstats.C when including this file on OSX gcc configuration
-// so, the helperdef define is NOT set when this file is compiled by itself
-#ifndef BOTCHEDEXPLICITINSTANTIATIONLINKER_HELPERDEF
-#define NOCOMPILE
-#endif
-#endif
-
-#ifdef NOCOMPILE
-// do absolutely nothing
-#else
-
-#include "errorhandling/errorhandling.H"
-
-#include "util/progressindic.H"
-
-#include "util/dptools.H"
-
-#include "mira/seqtohash.H"
-#include "mira/hashstats.H"
-#include "mira/vhash.H"
-
-
-using namespace std;
-
-
-//#define CEBUGFLAG
-
-#ifdef CEBUGFLAG
-#define CEBUG(bla)   {cout << bla; cout.flush();}
-#define CEBUGF(bla)  {cout << bla; cout.flush();}
-#else
-#define CEBUG(bla)
-#define CEBUGF(bla)
-#endif
-
-#ifndef PUBLICQUIET
-#define CLOCKSTEPS
-#endif
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-
-
-
-/*************************************************************************
- *
- * Builds HS_hsv_hashstatnodes and populates .next and .prev, but not
- *  .graphid
- *
- * TODO:
- * kind of dumb to use makeHashStatArrayShortcuts() and low24Bit sorting
- * lexicographical sort would make much more sense (faster inner-4 loop!)
- * but atm: reuse as much as possible
- *
- * Careful here: due to subgraph joining, graphs still may contain
- *  loops at end of this function
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-template<typename TVHASH_T>
-void HashStatistics<TVHASH_T>::priv_sdbg_populateHashStatNodes()
-{
-  FUNCSTART("void HashStatistics<TVHASH_T>::priv_sdbg_populateHashStatNodes()");
-
-  CEBUG("priv_populateHashStatNodes\n");
-
-  HS_hsv_hashstatnodes.clear();
-  if(HS_hsv_hashstats.empty()) return;
-
-  for(auto & hse : HS_hsv_hashstats){
-    CEBUG("HSE0: " << hse << endl);
-  }
-
-  priv_makeHashStatArrayShortcuts();
-
-  for(auto & hse : HS_hsv_hashstats){
-    CEBUG("HSEx: " << hse << " " << hash2string(hse.vhash,HS_hs_basesperhash) << endl);
-  }
-
-  CEBUG("bph: " << HS_hs_basesperhash << endl);
-  HS_hsv_hashstatnodes.resize(HS_hsv_hashstats.size());
-
-  {
-    TVHASH_T maxmask(1);
-    // *grml* undefined behaviour of left shift for 64 shifts in a 64 bit type makes this cludge necessary
-    // the same for 32 shift in 32 bit types etc.pp
-    if(HS_hs_basesperhash>=sizeof(TVHASH_T)*4){
-      maxmask=0;
-    }else{
-      auto rollbases=HS_hs_basesperhash;
-      maxmask<<=(rollbases*2);
-    }
-    --maxmask;
-    CEBUG("maxmask: " << maxmask << "\t" << hash2string(maxmask, HS_hs_basesperhash) << endl);
-
-    uint64 hsi=0;
-    hashstat_t hstmp;
-
-    cout << "Populating HSN:" << endl;
-    ProgressIndicator<int64> P(0, HS_hsv_hashstats.size());
-    for(auto hsI=HS_hsv_hashstats.begin(); hsI!=HS_hsv_hashstats.end(); ++hsI, ++hsi){
-      P.progress(hsi);
-      CEBUG("hsI: " << *hsI << endl);
-      if(HS_hsv_hashstats[hsi].hsc.iskmerforkf) continue;
-      if(HS_hsv_hashstats[hsi].hsc.iskmerforkr) continue;
-
-      // found current start
-      auto currenti=hsi;
-      while(true){
-	  BUGIFTHROW(currenti<0 || currenti>= HS_hsv_hashstats.size(),"Ooops? " << currenti << " currenti<0 || currenti>= HS_hsv_hashstats.size() ???");
-	if(HS_hsv_hashstatnodes[currenti].next >= 0) {
-	  CEBUG("BREAK: NEXT nonnull\n");
-	  break;
-	}
-	auto vhash=HS_hsv_hashstats[currenti].vhash;
-	CEBUG("vh: " << hex << vhash << "\tas: " << hash2string(vhash,HS_hs_basesperhash));
-	vhash<<=2;
-	vhash&=maxmask;
-	CEBUG("\tvh2: " << vhash << "\tas: " << hash2string(vhash,HS_hs_basesperhash) << endl);
-	auto numnext=0;
-	int64 nextfoundi=-1;
-	for(uint8 trials=0;trials<4;++trials,++vhash){
-	  CEBUG("Look for: " << vhash << "\tas: " << hash2string(vhash,HS_hs_basesperhash) << endl);
-	  hstmp.vhash=vhash;
-
-	  auto hsptr=findVHash(hstmp);
-	  if(hsptr!=nullptr) {
-	    CEBUG("foundit\n");
-	    if(!hsptr->hsc.iskmerforkf
-	       && !hsptr->hsc.iskmerforkr){
-	      ++numnext;
-	      nextfoundi=hsptr-&(HS_hsv_hashstats[0]);
-	    }else{
-	      CEBUG("fork\n");
-	    }
-	  }
-	}
-	CEBUG(dec);
-
-	CEBUG("nn: " << numnext << endl);
-	// found exactly 1 successor
-	if(numnext==1){
-	  BUGIFTHROW(nextfoundi<0 || nextfoundi>= HS_hsv_hashstats.size(),"Ooops? " << nextfoundi << " nextfoundi<0 || nextfoundi>= HS_hsv_hashstats.size() ???");
-	  if(HS_hsv_hashstatnodes[nextfoundi].prev >= 0){
-	    // oops, potential next already already linked to a previous?
-	    // must stop this list
-	    numnext=0;
-	    CEBUG("non-null " << nextfoundi << ": " << HS_hsv_hashstatnodes[nextfoundi].prev << "\t" << HS_hsv_hashstatnodes[nextfoundi].next << endl);
-	  }else{
-	    // we don't care whether the .next of the next is already set ... this joins subgraphs :-)
-	    //  (and can create loops, but we'll deal with that somewhere else)
-	    CEBUG("Stored " << currenti << " <-> " << nextfoundi << endl);
-	    HS_hsv_hashstatnodes[nextfoundi].prev=currenti;
-	    HS_hsv_hashstatnodes[currenti].next=nextfoundi;
-	    currenti=nextfoundi;
-	  }
-	}
-	if(numnext!=1) {
-	  CEBUG("BREAKOUT\n");
-	  break; // out of the while(true) loop
-	}
-      }
-    }
-    P.finishAtOnce(); cout << endl;
-  }
-
-  CEBUG("### nodes\n" << dec);
-  for(auto hsnI=HS_hsv_hashstatnodes.cbegin(); hsnI!=HS_hsv_hashstatnodes.cend(); ++hsnI){
-    CEBUG(hsnI-HS_hsv_hashstatnodes.cbegin() << "\t");
-    CEBUG(hsnI->prev << "\t" << hsnI->next);
-    CEBUG(endl);
-  }
-}
-//#define CEBUG(bla)
-
-
-/*************************************************************************
- *
- * Needs priv_sdbg_populateHashStatNodes() to be run before
- *
- * Result:
- * - populates .graphid of HS_hsv_hashstatnodes
- * - builds HS_hsv_dbgseqs: .seq, .medianhashcov,
- *                          .hsni_first, .hsni_last and .graphid
- *                  BUT NOT .expectedcopynumber
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-template<typename TVHASH_T>
-void HashStatistics<TVHASH_T>::priv_sdbg_assignGraphIDsMakeSeqsAndCollectStats()
-{
-  FUNCSTART("void HashStatistics<TVHASH_T>::priv_sdbg_assignGraphIDsMakeSeqsAndCollectStats");
-
-  CEBUG("start ts" << endl);
-  vector<uint8> taken;
-  taken.resize(HS_hsv_hashstatnodes.size(),0);
-  vector<uint8> runvisit; // for breaking loops
-  runvisit.resize(HS_hsv_hashstatnodes.size(),0);
-
-  HS_hsv_dbgseqs.clear();
-
-  hashstat_t hstmp;
-  vector<uint32> count4median;
-  count4median.reserve(512000);
-
-  uint32 graphid=0;
-
-  cout << "Collecting DBG stats:" << endl;
-  ProgressIndicator<int64> P(0, HS_hsv_hashstatnodes.size());
-  for(int64 hsi=0; hsi<HS_hsv_hashstatnodes.size(); ++hsi){
-    P.progress(hsi);
-//    for(auto v : runvisit){
-//      BUGIFTHROW(v,"runvisit not completely empty??? " << hsi);
-//    }
-    hstmp.vhash=nsvhash::reverseComplement(HS_hsv_hashstats[hsi].vhash,HS_hs_basesperhash);
-    size_t revhsi=-1;
-    auto revhsptr=findVHash(hstmp);
-    BUGIFTHROW(revhsptr==nullptr,"1) revhsptr==nullptr ??? for " << hash2string(HS_hsv_hashstats[hsi].vhash,HS_hs_basesperhash) << " versus " << hash2string(hstmp.vhash,HS_hs_basesperhash));
-    revhsi=(revhsptr-(&HS_hsv_hashstats[0]));
-
-    CEBUG("Check1: #" << hsi << "#" << revhsi << "#" << endl);
-    if(!taken[hsi] && !taken[revhsi]){
-      auto acti=hsi;
-      CEBUG("New start: " << hsi << "\t" << HS_hsv_hashstats[acti]);
-      while(HS_hsv_hashstatnodes[acti].prev >= 0
-	    && !taken[HS_hsv_hashstatnodes[acti].prev]
-	    && !runvisit[HS_hsv_hashstatnodes[acti].prev]) {
-	runvisit[acti]=1;
-	acti=HS_hsv_hashstatnodes[acti].prev;
-	CEBUG("\tmoved to " << acti << "\t" << hash2string(HS_hsv_hashstats[acti].vhash, HS_hs_basesperhash) << "\t" << HS_hsv_hashstats[acti] << "\n");
-      }
-      CEBUG("\n");
-      HS_hsv_dbgseqs.resize(HS_hsv_dbgseqs.size()+1);
-      auto & actseq=HS_hsv_dbgseqs.back().seq;
-      HS_hsv_dbgseqs.back().hsni_first=acti;
-      count4median.clear();
-      do{
-	hstmp.vhash=nsvhash::reverseComplement(HS_hsv_hashstats[acti].vhash,HS_hs_basesperhash);
-	revhsptr=findVHash(hstmp);
-	BUGIFTHROW(revhsptr==nullptr,"2) revhsptr==nullptr ???");
-	revhsi=(revhsptr-(&HS_hsv_hashstats[0]));
-
-	CEBUG("Check2: #" << acti << "#" << revhsi << "#" << endl);
-	BUGIFTHROW(taken[acti]!=taken[revhsi],"taken[acti]!=taken[revhsi] ???");
-
-	if(taken[acti]){
-	  // this may indeed be legitimate if a reverse complement of
-	  //  an already taken kmer is in this graph. Tricky.
-	  // in that case ... we end reconstruction of this sequence here
-	  // simply break the for loop
-	  break;
-	}
-	taken[acti]=1;
-	taken[revhsi]=1;
-
-	HS_hsv_hashstatnodes[acti].graphid=graphid;
-	HS_hsv_hashstatnodes[revhsi].graphid=graphid+1;
-
-	HS_hsv_dbgseqs.back().hsni_last=acti;
-
-	CEBUG("gtaken #" << acti << "# (next: " << HS_hsv_hashstatnodes[acti].next << ")\t" << graphid << "\t" << hash2string(HS_hsv_hashstats[acti].vhash,HS_hs_basesperhash) << "\t" << HS_hsv_hashstats[acti] << endl);
-	CEBUG("revtaken #" << revhsi << "#" << endl);
-
-	if(unlikely(actseq.empty())){
-	  actseq=hash2string(HS_hsv_hashstats[acti].vhash, HS_hs_basesperhash);
-	}else{
-	  switch(static_cast<uint64>(HS_hsv_hashstats[acti].vhash) & 3){
-	  case 0 : actseq+='A'; break;
-	  case 1 : actseq+='C'; break;
-	  case 2 : actseq+='G'; break;
-	  case 3 : actseq+='T'; break;
-	  }
-	}
-	count4median.push_back(HS_hsv_hashstats[acti].hsc.getCount());
-
-	acti=HS_hsv_hashstatnodes[acti].next;
-      }while(acti >= 0);
-      CEBUG("slen: " << actseq.size() << endl);
-      BUGIFTHROW(actseq.empty(),"actseq.empty() ???");
-      // use nth_element for partial sorting to get the median
-      nth_element(count4median.begin(), count4median.begin()+count4median.size()/2,count4median.end() );
-      HS_hsv_dbgseqs.back().medianhashcov=count4median[count4median.size()/2];
-      HS_hsv_dbgseqs.back().graphid=graphid;
-      graphid+=2;  // increase graphid for next loop
-
-      // and reset runvisit to all 0 (can't do that in loop above because of break statement
-      acti=hsi;
-      while(HS_hsv_hashstatnodes[acti].prev >= 0
-	    && runvisit[acti]) {
-	runvisit[acti]=0;
-	acti=HS_hsv_hashstatnodes[acti].prev;
-      }
-
-    }
-  }
-  for(auto v : runvisit){
-    BUGIFTHROW(v,"end check runvisit not completely empty???");
-  }
-
-  P.finishAtOnce(); cout << endl;
-}
-//#define CEBUG(bla)
-
-/*************************************************************************
- *
- * Needs priv_sdbg_populateHashStatNodes() and
- *   priv_sdbg_assignGraphIDsMakeSeqsAndCollectStats() to be run before
- *
- * Result:
- * - populates .expectedcopynumber of HS_hsv_dbgseqs
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-template<typename TVHASH_T>
-void HashStatistics<TVHASH_T>::priv_sdbg_calcExpectedCopyNumbers()
-{
-  vector<uint32> count4median;
-  count4median.reserve(HS_hsv_dbgseqs.size());
-
-  vector<uint32> trials{5000,2000,1000,500,200,100};
-  trials.push_back(HS_hs_basesperhash);
-  uint32 medianlengthused;
-  for(auto tn : trials){
-    medianlengthused=tn;
-    for(auto & dse : HS_hsv_dbgseqs){
-      if(dse.seq.size()>=tn){
-	count4median.push_back(dse.medianhashcov);
-      }
-    }
-    if(!count4median.empty()) break;
-  }
-
-  if(count4median.empty()) {
-    for(auto & dse : HS_hsv_dbgseqs){
-      dse.expectedcopynumber=1;
-    }
-  }else{
-    nth_element(count4median.begin(), count4median.begin()+count4median.size()/2,count4median.end() );
-    auto mhc=count4median[count4median.size()/2];
-    cout << "Median >= " << medianlengthused << ": " << mhc << endl;
-
-    for(auto & dse : HS_hsv_dbgseqs){
-      dse.expectedcopynumber=static_cast<uint32>((static_cast<double>(dse.medianhashcov)/mhc)+static_cast<double>(.5));
-      if(dse.expectedcopynumber<1) dse.expectedcopynumber=1;
-      if(dse.expectedcopynumber==1
-	 && (HS_hsv_hashstats[dse.hsni_first].hsc.iskmerforkf
-	     || HS_hsv_hashstats[dse.hsni_first].hsc.iskmerforkr
-	     || HS_hsv_hashstats[dse.hsni_last].hsc.iskmerforkf
-	     || HS_hsv_hashstats[dse.hsni_last].hsc.iskmerforkr)){
-	dse.expectedcopynumber=2;
-      }
-    }
-  }
-}
-//#define CEBUG(bla)
-
-/*************************************************************************
- *
- * Needs:
- * - hashstatistics to be loaded
- * - hs must be already trimmed to needs of user
- * - hs must have kmer forks already marked
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-template<typename TVHASH_T>
-void HashStatistics<TVHASH_T>::buildSDBGraphs()
-{
-  FUNCSTART("void HashStatistics<TVHASH_T>::buildSDBGraphs()");
-
-  cout << "Starting priv_sdbg_populateHashStatNodes" << endl;
-  priv_sdbg_populateHashStatNodes();
-  cout << "Starting priv_sdbg_assignGraphIDsMakeSeqsAndCollectStats" << endl;
-  priv_sdbg_assignGraphIDsMakeSeqsAndCollectStats();
-
-  priv_sdbg_calcExpectedCopyNumbers();
-
-#if 0
-  cout << "###\n";
-  for(auto & dse : HS_hsv_dbgseqs) {
-    cout << ">con_" << dse.graphid << " " << dse.seq.size() << "\t" << dse.medianhashcov
-	 << "\t"
-	 << dse.expectedcopynumber
-	 << "\t"
-	 << HS_hsv_hashstats[dse.hsni_first].hsc.iskmerforkr
-	 << HS_hsv_hashstats[dse.hsni_first].hsc.iskmerforkf
-	 << " "
-	 << HS_hsv_hashstats[dse.hsni_last].hsc.iskmerforkf
-	 << HS_hsv_hashstats[dse.hsni_last].hsc.iskmerforkr
-	 << endl;
-    cout << dse.seq << endl;
-  }
-#endif
-}
-//#define CEBUG(bla)
-
-
-/*************************************************************************
- *
- * Builds sequence as string between hashstatnodes hsi1 and hsi2
- * Returns empty sequence if hsi1 and hsi2 are not on the same graph
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-template<typename TVHASH_T>
-void HashStatistics<TVHASH_T>::priv_sdbg_buildSequenceFromPath(int64 hsi1, int64 hsi2, string & retseq)
-{
-  retseq.clear();
-  if(HS_hsv_hashstatnodes[hsi1].graphid != HS_hsv_hashstatnodes[hsi2].graphid) return;
-
-  int64 acthsi=hsi1;
-  for(;acthsi>=0;){
-    CEBUG("HSN: " << HS_hsv_hashstatnodes[acthsi] << endl);
-    if(unlikely(retseq.empty())){
-      retseq=hash2string(HS_hsv_hashstats[acthsi].vhash,HS_hs_basesperhash);
-    }else{
-      switch(static_cast<uint64>(HS_hsv_hashstats[acthsi].vhash) & 3){
-      case 0 : retseq+='A'; break;
-      case 1 : retseq+='C'; break;
-      case 2 : retseq+='G'; break;
-      case 3 : retseq+='T'; break;
-      }
-    }
-    CEBUG(hsi1 << " " << acthsi << " " << hsi2 << " " << retseq << endl);
-    if(acthsi==hsi2) break;
-    acthsi=HS_hsv_hashstatnodes[acthsi].next;
-  }
-  if(acthsi!=hsi2){
-    // Ooooooops ... not found
-    retseq.clear();
-  }
-
-  return;
-}
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-
-
-/*************************************************************************
- *
- * Propose edits for a sequence, given back in vector 'edits'
- * Edits are sorted high to low in vector, all positions refer to unedited seq
- *
- * Needs:
- * - buildSDBGraphs() must be run before to fill needed sdbg data structures
- *   (HS_hsv_hashstatnodes)
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-template<typename TVHASH_T>
-void HashStatistics<TVHASH_T>::proposeSDBGEditsForSequence(const void * seqvoid, uint64 slen, const char * namestr, vector<dbgedits_t> & edits)
-{
-  FUNCSTART("void HashStatistics<TVHASH_T>::proposeSDBGEdits()");
-
-  edits.clear();
-
-  // while rare and this should not happen for normal data sets, HS_hsv_hashstatnodes may be empty
-  // E.g.: tiny mapping projects
-  if(slen<HS_hs_basesperhash
-     ||HS_hsv_hashstatnodes.empty()) return;
-
-  CEBUG("testStuff2\n");
-
-  const auto basesperhash=HS_hs_basesperhash;
-  const uint8 * seq=static_cast<const uint8 *>(seqvoid);
-
-  int32 lastgoodpos=-1;
-  int64 lastgoodhsi=-1;
-
-  string repstring;
-  repstring.reserve(200);
-
-  hashstat_t hstmp;
-  bool insearch=false;
-  {
-    SEQTOHASH_LOOPSTART(TVHASH_T);
-    {
-      hstmp.vhash=acthash;
-      auto hsptr=findVHash(hstmp);
-
-      {
-	int32 actpos=seqi-(basesperhash-1);
-	CEBUG("si: " << actpos << "\t" << hash2string(acthash,HS_hs_basesperhash) << "\t");
-	if(hsptr==nullptr){
-	  CEBUG("not found\n");
-	}else{
-	  int64 acthsi=hsptr-&(HS_hsv_hashstats[0]);
-	  auto actgid=HS_hsv_hashstatnodes[acthsi].graphid;
-	  CEBUG("ahsi: " << acthsi << "\tagid: " << actgid << "\t" << HS_hsv_hashstats[acthsi] << endl);
-	}
-      }
-
-      if(insearch){
-	if(hsptr==nullptr){
-	  // do nothing?
-	}else{
-	  // new good found ... go on
-	  int64 acthsi=hsptr-&(HS_hsv_hashstats[0]);
-	  int32 actpos=seqi-(basesperhash-1);
-
-	  priv_sdbg_buildSequenceFromPath(lastgoodhsi,acthsi,repstring);
-	  if(!repstring.empty()){
-	    // we could correct!
-	    edits.push_back(dbgedits_t(lastgoodpos,actpos-lastgoodpos+basesperhash,repstring));
-	  }
-
-	  lastgoodhsi=acthsi;
-	  lastgoodpos=actpos;
-	  insearch=false;
-	}
-      }else{
-	if(hsptr==nullptr){
-	  if(lastgoodpos>=0){
-	    insearch=true;
-	  }
-	}else{
-	  lastgoodhsi=hsptr-&(HS_hsv_hashstats[0]);
-	  int32 actpos=seqi-(basesperhash-1);
-	  lastgoodpos=actpos;
-	}
-      }
-    }
-    SEQTOHASH_LOOPEND;
-  }
-}
-//#define CEBUG(bla)
-
-
-/*************************************************************************
- *
- * Checks whether a sequence is a chimera according to SDBG
- * Returns true if yes
- *
- * Needs:
- * - buildSDBGraphs() must be run before to fill needed sdbg data structures
- *   (HS_hsv_hashstatnodes)
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-template<typename TVHASH_T>
-bool HashStatistics<TVHASH_T>::checkSequenceForSDBGChimeras(const void * seqvoid, uint64 slen, const char * namestr)
-{
-  FUNCSTART("void HashStatistics<TVHASH_T>::checkSequenceForSDBGChimeras()");
-
-  // while rare and this should not happen for normal data sets, HS_hsv_hashstatnodes may be empty
-  // E.g.: tiny mapping projects
-  if(slen<HS_hs_basesperhash
-     ||HS_hsv_hashstatnodes.empty()) return false;
-
-  CEBUG("chimcheck on " << namestr << endl);
-
-  bool retvalue=false;
-
-  const auto basesperhash=HS_hs_basesperhash;
-  const uint8 * seq=static_cast<const uint8 *>(seqvoid);
-
-  int32 lastgoodpos=-1;
-  int64 lastgoodhsi=-1;
-
-  string repstring;
-  repstring.reserve(200);
-
-  hashstat_t hstmp;
-  bool insearch=false;
-  {
-    SEQTOHASH_LOOPSTART(TVHASH_T);
-    {
-      hstmp.vhash=acthash;
-      auto hsptr=findVHash(hstmp);
-
-      {
-	int32 actpos=seqi-(basesperhash-1);
-	CEBUG("si: " << actpos << "\t" << hash2string(acthash,HS_hs_basesperhash) << "\t");
-	if(hsptr==nullptr){
-	  CEBUG("not found\n");
-	}else{
-	  int64 acthsi=hsptr-&(HS_hsv_hashstats[0]);
-	  auto actgid=HS_hsv_hashstatnodes[acthsi].graphid;
-	  CEBUG("ahsi: " << acthsi << "\tagid: " << actgid << "\t" << HS_hsv_hashstats[acthsi] << endl);
-	}
-      }
-
-      if(insearch){
-	if(hsptr==nullptr){
-	  // do nothing?
-	}else{
-	  // new good found ... go on
-	  int64 acthsi=hsptr-&(HS_hsv_hashstats[0]);
-	  int32 actpos=seqi-(basesperhash-1);
-
-	  if(!priv_sdbg_checkPathDistance(lastgoodhsi,acthsi,actpos-lastgoodpos+10)){
-	    // we have a chimera, let's stop here
-	    retvalue=true;
-	    break;
-	  }
-
-	  lastgoodhsi=acthsi;
-	  lastgoodpos=actpos;
-	  insearch=false;
-	}
-      }else{
-	if(hsptr==nullptr){
-	  if(lastgoodpos>=0){
-	    insearch=true;
-	  }
-	}else{
-	  lastgoodhsi=hsptr-&(HS_hsv_hashstats[0]);
-	  int32 actpos=seqi-(basesperhash-1);
-	  lastgoodpos=actpos;
-	}
-      }
-    }
-    SEQTOHASH_LOOPEND;
-  }
-  return retvalue;
-}
-//#define CEBUG(bla)
-
-
-/*************************************************************************
- *
- * Checks whether a hashstatsnodes hsi1 and hsi2 are at most maxdist away
- * Returns true if yes or if path ends before maxdist was searched
- *
- * Needs:
- * - buildSDBGraphs() must be run before to fill needed sdbg data structures
- *   (HS_hsv_hashstatnodes)
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-template<typename TVHASH_T>
-bool HashStatistics<TVHASH_T>::priv_sdbg_checkPathDistance(int64 hsi1, int64 hsi2, int64 maxdist)
-{
-  bool retval=false;
-
-  // check fwd
-  int64 acthsi=hsi1;
-  uint32 searchdist=0;
-  for(; searchdist < maxdist && acthsi>=0; ++searchdist){
-    CEBUG("fwalk: " << searchdist << "\t" << hash2string(HS_hsv_hashstats[acthsi].vhash,HS_hs_basesperhash) << "\t" << HS_hsv_hashstats[acthsi] << endl);
-    if(acthsi==hsi2) break;
-    acthsi=HS_hsv_hashstatnodes[acthsi].next;
-  }
-  if(acthsi<0
-     || (searchdist<maxdist && acthsi==hsi2)) retval=true;
-  CEBUG(acthsi << " " << maxdist << " RETVAL " << retval << endl);
-
-  return retval;
-}
-//#define CEBUG(bla)
-
-
-// explicit template instantiations needed for the linker to create these for library files
-// but not with botched linker
-#ifndef BOTCHEDEXPLICITINSTANTIATIONLINKER
-template class HashStatistics<vhash64_t>;
-#ifndef KMER_INTERNALTYPE
-template class HashStatistics<vhash128_t>;
-template class HashStatistics<vhash256_t>;
-template class HashStatistics<vhash512_t>;
-#endif
-#endif
-
-#endif // NOCOMPILE
diff --git a/src/mira/hdeque.H b/src/mira/hdeque.H
deleted file mode 100644
index 62c80aa..0000000
--- a/src/mira/hdeque.H
+++ /dev/null
@@ -1,666 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 2012 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-
-#ifndef _mira_hdeque_h_
-#define _mira_hdeque_h_
-
-#include <deque>
-#include <list>
-#include <vector>
-
-#include <boost/iterator_adaptors.hpp>
-
-#include "stdinc/defines.H"
-#include "errorhandling/errorhandling.H"
-
-#ifndef likely
-#if __GNUC__ >= 4
-#define likely(x) __builtin_expect((x),1)
-#define unlikely(x) __builtin_expect((x),0)
-#else
-#define likely(x) (x)
-#define unlikely(x) (x)
-#endif
-#endif
-
-template <class TT>
-class HDeque
-{
-private:
-
-  typedef std::deque<TT> innercontainer_t ;
-
-  struct mapinfo_t{
-    int64_t  from;
-    typename std::list<innercontainer_t>::iterator icI;       // iterator back to rposbin_t in list
-
-    inline mapinfo_t(size_t afrom, typename std::list<innercontainer_t>::iterator I) : from(afrom),icI(I) {};
-    static inline bool lt_indexfrom(const mapinfo_t & a, const mapinfo_t & b) { return a.from<b.from;}
-  };
-
-/*************************************************************************
- *
- * bins and map are always the same size and never(!) empty
- *
- *************************************************************************/
-
-  std::list<innercontainer_t>  HD_bins;
-  std::deque<mapinfo_t>        HD_map;
-
-  size_t HD_bo_binsize;
-  size_t HD_size;
-
-
-  /*************************************************************************************
-   *
-   *
-   *  Iterators
-   *
-   *
-   *************************************************************************************/
-public:
-  template <class HDIValue>
-  class hditer
-    : public boost::iterator_facade<
-      hditer<HDIValue>                          // Derived
-    , HDIValue             // Value
-    , std::random_access_iterator_tag  //bidirectional_iterator_tag   //random_access_iterator_tag  //boost::forward_traversal_tag    // CategoryOrTraversal
-    > {
-
-  private:
-    HDeque * hdptr;
-    innercontainer_t * icptr;
-    typename innercontainer_t::iterator icI;
-    size_t mapindex;
-
-  public:
-    inline hditer(HDeque * ahdptr, innercontainer_t * aicptr, typename innercontainer_t::iterator aicI, size_t amapindex) : hdptr(ahdptr),icptr(aicptr),icI(aicI),mapindex(amapindex) { };
-
-    template <class OType>
-    hditer(hditer<OType> const & other) : hdptr(other.hdptr), icptr(other.icptr), icI(other.icI), mapindex(other.mapindex) {}
-
-    friend std::ostream & operator<<(std::ostream &ostr, hditer & mI) {
-      ostr << "hdptr: " << mI.hdptr
-	   << "\ticptr: " << mI.icptr
-	   << "\ticsize: " << mI.icptr->size()
-	   << "\ticIpos: " << mI.icI-mI.icptr->begin()
-	   << "\tmapindex: " << mI.mapindex
-	   << std::endl;
-      if(mI==mI.hdptr->end()){
-	ostr << "This is end()" << std::endl;
-      }else{
-	//ostr << *this;
-      }
-      return ostr;
-    }
-
-
-  private:
-    // Everything Boost's iterator facade needs
-    friend class boost::iterator_core_access;
-
-    // friend with itself means that "iterator" and "const_iterator" can access each other
-    template <class> friend class hditer;
-
-    // friend with parent HDeque class so that some quick checks can be performed
-    template <class> friend class HDeque;
-
-    HDIValue & dereference() const
-    {
-      // TODO: eventually remove the BUGIFTHROW if prooves to be to slow (check that
-      //  on projects). Current tests indicate it's really minimal, e.g., in the order of
-      //  a few seconds for a mapping project
-      FUNCSTART("inline TT & HDeque::hditer::dereference() const");
-      BUGIFTHROW(*this==hdptr->end(),"Trying to dereference an hditer pointing to end()???");
-      return *icI;
-    }
-
-    template <class OType>
-    inline bool equal(hditer<OType> const & other) const
-    {
-      //std::cout << "equal? " << mapindex << "\t" << other.mapindex << std::endl;
-      return mapindex == other.mapindex && icI == other.icI;
-    }
-
-    inline void increment(){
-      //if(*this!=hdptr->end()){       // this is 10% slower than the version below
-      if(likely(mapindex<hdptr->HD_map.size())){    // likely() brings ~ 2%
-	++icI;
-	if(unlikely(icI==icptr->end())){
-	  ++mapindex;
-	  if(unlikely(mapindex==hdptr->HD_map.size())){
-	    // special treatment: we're at end
-	    *this=hdptr->end();
-	  }else{
-	    icptr=&(*(hdptr->HD_map[mapindex].icI));
-	    icI=icptr->begin();
-	  }
-	}
-      }
-    }
-
-    inline void decrement(){
-      // are we at end? special treatment
-      if(likely(icI != icptr->begin() && mapindex<hdptr->HD_map.size())){
-	// simple case: not at start of an inner container and not at end()
-	--icI;
-      }else{
-	if(likely(mapindex>0)){
-	  // normal case
-	  --mapindex;
-	  icptr=&(*(hdptr->HD_map[mapindex].icI));
-	  icI=icptr->end();
-	  --icI;
-	}else{
-	  // hmmm, we were at beginning of container anyway
-	  // let's do nothing, that should break the least things
-	}
-      }
-    }
-
-    int64 distance_to(hditer const & other) const {
-      return (other.hdptr->priv_getPosOfIterator(other) - hdptr->priv_getPosOfIterator(*this));
-    }
-
-    // currently used by advance() for larger jumps
-    void setToPos(size_t pos){
-      if(unlikely(pos>=hdptr->HD_size)) {
-	*this=hdptr->end();
-      }else{
-	int64 ipos=static_cast<int64>(pos);
-	ipos+=hdptr->HD_map.front().from;
-	auto mI=lower_bound(hdptr->HD_map.begin(),
-			    hdptr->HD_map.end(),
-			    mapinfo_t(ipos, hdptr->HD_bins.begin()),  // comparator object, only ipos matters
-			    mapinfo_t::lt_indexfrom);
-	// move the returned map iterator to the right position
-	if(likely(mI != hdptr->HD_map.begin()
-		  && (mI == hdptr->HD_map.end()
-		      || mI->from > ipos))){
-	     --mI;
-	}
-	// and now initialise this iterator to now values
-	icptr=&(*(mI->icI));
-	icI=mI->icI->begin()+(ipos-mI->from);
-	mapindex=mI-hdptr->HD_map.begin();
-      }
-    }
-
-  public:
-    void advance(int64 dist){
-      if(abs(dist)>hdptr->HD_bo_binsize){
-	int64 thispos=hdptr->priv_getPosOfIterator(*this);
-	thispos+=dist;
-	setToPos(static_cast<size_t>(thispos));
-      }else if(dist>0){
-	// TODO: perhaps remove the [] operators
-	increment();
-	--dist;
-	if(dist){
-	  bool icivalid=true;
-	  if(dist >= icptr->end()-icI){
-	    dist-=icptr->end()-icI;
-	    ++mapindex;
-	    if(mapindex>=hdptr->HD_map.size()){
-	      icI=hdptr->HD_bins.front().end();
-	      return;
-	    }
-	    icptr=&(*(hdptr->HD_map[mapindex].icI));
-	    icivalid=false;
-	  }
-	  while(dist>=static_cast<int64>(icptr->size())){
-	    dist-=icptr->size();
-	    ++mapindex;
-	    if(mapindex>=hdptr->HD_map.size()){
-	      icI=hdptr->HD_bins.front().end();
-	      return;
-	    }
-	    icptr=&(*(hdptr->HD_map[mapindex].icI));
-	    icivalid=false;
-	  }
-	  if(!icivalid) icI=icptr->begin();
-	  icI+=dist;
-	}
-      }else if(dist<0){
-	// TODO: perhaps remove the [] operators
-	// hack to get end() play nicely
-	decrement();
-	dist=-1-dist;
-	// rest
-	if(dist){
-	  bool icivalid=true;
-	  if(dist>icI-icptr->begin()){
-	    dist-=icI-icptr->begin()+1;
-	    if(mapindex==0){
-	      icI=icptr->begin();
-	      return;
-	    }
-	    --mapindex;
-	    icptr=&(*(hdptr->HD_map[mapindex].icI));
-	    icivalid=false;
-	  }
-	  while(dist>=static_cast<int64>(icptr->size())){
-	    if(mapindex==0){
-	      icI=icptr->begin();
-	      return;
-	    }
-	    dist-=icptr->size();
-	    --mapindex;
-	    icptr=&(*(hdptr->HD_map[mapindex].icI));
-	    icivalid=false;
-	  }
-	  if(!icivalid){
-	    icI=icptr->end();
-	    --icI;
-	  }
-	  icI-=dist;
-	}
-      }
-    }
-
-
-  };
-
-
-  // pure magic to construct "iterator" and "const_iterator" :-)
-  typedef hditer<TT> iterator;
-  typedef hditer<TT const> const_iterator;
-
-
-private:
-
-
-//  vector<offsettile_t>::iterator searchOffsetTileForPlacement(int32 position);
-//  //std::list<PlacedContigReads::rposbin_t>::iterator findReadpositionIterator(int32 position);
-//
-//  void splitBin(uint32 binindex);
-//  std::list<rposbin_t>::iterator placeRead_helper(int32 rpid,
-//					     int32 position,
-//					     int8 direction,
-//					     int32 urdid,
-//					     iterator::raoindex_t & araoindex);
-
-  inline void priv_checksize(){
-    size_t csize=0;
-    for(auto & b : HD_bins){
-      csize+=b.size();
-    }
-    if(csize!=HD_size){
-      std::cout << "csize " << csize << " != HD_size " << HD_size << std::endl;
-      exit(1);
-    }
-  }
-
-  template <class OType>
-  size_t priv_getPosOfIterator(hditer<OType> const & hdI){
-    size_t ipos=HD_size;
-    if(hdI!=end()){
-      ipos=static_cast<size_t>(HD_map[hdI.mapindex].from + (hdI.icI-hdI.icptr->begin()) - HD_map.front().from);
-    }
-    return ipos;
-  }
-
-  inline void priv_resize_shrink(size_t newsize){
-    if(newsize<HD_size){
-      if(newsize==0) {
-	clear();
-      }else{
-	// reduce container
-	// note that bins can have different sizes
-	//
-	// first, try to get rid of complete bins
-	auto diff=HD_size-newsize;
-	while(diff>=HD_bins.back().size()){
-	  diff-=HD_bins.back().size();
-	  HD_size-=HD_bins.back().size();
-	  HD_bins.pop_back();
-	  HD_map.pop_back();
-	}
-	// now reduce last bin
-	// last bin size will never drop to zero, else it would have
-	//  been handled above
-	auto fI=HD_bins.back().end();
-	HD_size-=diff;
-	for(;diff; --fI, --diff) {};
-	HD_bins.back().erase(fI,HD_bins.back().end());
-      }
-    }
-  }
-  inline void priv_resize_grow_back(size_t newsize, const TT & x) {
-    int64 diff=static_cast<int64>(newsize-HD_size);
-    while(diff>0){
-      if(HD_bins.back().size()>=HD_bo_binsize){
-	auto lastsize=HD_bins.back().size();
-	HD_bins.push_back(innercontainer_t());
-	HD_map.push_back(mapinfo_t(HD_map.back().from+lastsize,--(HD_bins.end())));
-      }
-      auto numins=HD_bo_binsize-HD_bins.back().size();
-      if(numins>diff) numins=diff;
-      diff-=numins,
-      HD_bins.back().resize(HD_bins.back().size()+numins,x);
-    }
-    HD_size=newsize;
-  }
-  inline void priv_resize_grow_front(size_t newsize, const TT & x) {
-    auto diff=newsize-HD_size;
-    // fill up first bin first
-    if(HD_bins.front().size()<HD_bo_binsize){
-      auto numins=HD_bo_binsize-HD_bins.front().size();
-      if(numins>diff) numins=diff;
-      HD_size+=numins;
-      diff-=numins;
-      HD_map.front().from-=numins;
-      HD_bins.front().insert(HD_bins.front().begin(),numins,x);
-    }
-    // fill up rest of bins using resize()
-    while(diff){
-      HD_bins.push_front(innercontainer_t());
-      HD_map.push_front(mapinfo_t(HD_map.front().from,HD_bins.begin()));
-      auto numins=HD_bo_binsize;
-      if(diff<HD_bo_binsize) numins=diff;
-      diff-=numins;
-      HD_size+=numins;
-      HD_map.front().from-=numins;
-      HD_bins.front().resize(numins,x);
-    }
-  }
-
-  // for MIRA and the intended use in the CON_counts container, we cheat big time on insert:
-  //  insertion at begin() / end() is done via resize_grow (which is OK), but there is
-  //  currently no "re-distribution" of elements to bins for insertions in the middle of a container
-  // It's probably not necessary, because how many bases will be inserted amidst a contig? Even
-  //  for IonTorrent at very high coverages this will perhaps be 1 base every two or three bases,
-  //  therefore the inner bins should not really grow much more than double the bin size set
-  //  for the HDeque
-  iterator priv_insert(iterator where, size_t num, const TT & x){
-    FUNCSTART("HDeque::insert(iterator where, size_t num, const TT & x)");
-    BUGIFTHROW(where.hdptr!=this,"called with an iterator not belonging to this container?");
-    auto wpos=priv_getPosOfIterator(where);
-    //std::cout << "where " << where << "\tnum: " << num << "\twpos: " << wpos << std::endl;
-    if(wpos>=HD_size){
-      priv_resize_grow_back(HD_size+num,x);
-    }else if(where==where.hdptr->begin()){
-      priv_resize_grow_front(HD_size+num,x);
-    }else{
-      where.icptr->insert(where.icI,num,x);
-      // just need to adjust the map.from values
-      auto mI=HD_map.begin()+(where.mapindex+1);
-      for(; mI!=HD_map.end(); ++mI){
-	mI->from+=num;
-      }
-      HD_size+=num;
-    }
-    return (begin()+wpos);
-  }
-
-
-  iterator priv_erase(iterator from, iterator to){
-    FUNCSTART("iterator priv_erase(iterator from, iterator to)");
-    BUGIFTHROW(from.hdptr!=this,"where called with an iterator not belonging to this container?");
-    BUGIFTHROW(to.hdptr!=this,"to called with an iterator not belonging to this container?");
-    auto frompos=priv_getPosOfIterator(from);
-    int64 diff=static_cast<int64>(priv_getPosOfIterator(to)-frompos);
-    BUGIFTHROW(diff<0,"diff < 0 ... 'from' was > 'to' ???");
-    BUGIFTHROW(diff>static_cast<int64>(HD_size),"diff>HD_size");
-    HD_size-=diff;
-    //std::cout << "diff: " << diff << "\tHD_size " << HD_size << std::endl;
-    if(HD_size==0){
-      clear();
-    }else{
-      // erase in first container
-      // tempmapindex needed to reach the correct "first middle container"
-      //  in case the first container also gets completely erased
-      auto tempmapindex=from.mapindex;
-      if(diff){
-	int64 maxerase=from.icptr->end()-from.icI;
-	size_t thiserase=std::min(diff,maxerase);
-	auto ictoI=from.icI+thiserase;
-	from.icptr->erase(from.icI,ictoI);
-	diff-=thiserase;
-	if(from.icptr->empty()){
-	  HD_bins.erase((HD_map.begin()+tempmapindex)->icI);
-	  HD_map.erase(HD_map.begin()+tempmapindex);
-	  --tempmapindex;
-	}
-      }
-      // erase in middle and end containers
-      if(diff){
-	++tempmapindex;
-	auto mI=HD_map.begin()+tempmapindex;
-	while(diff){
-	  size_t thiserase=std::min(static_cast<int64>(diff),static_cast<int64>(mI->icI->size()));
-	  auto ictoI=mI->icI->begin()+thiserase;
-	  mI->icI->erase(mI->icI->begin(),ictoI);
-	  diff-=thiserase;
-	  if(mI->icI->empty()){
-	    HD_bins.erase(mI->icI);
-	    mI=HD_map.erase(mI);
-	  }else{
-	    ++mI;
-	  }
-	}
-      }
-      // shift down all "from" values in the map which need adjustment
-      auto mI=HD_map.begin();
-      int64 lastfrom=0;
-      int64 lastsize=0;
-      if(from.mapindex){
-	advance(mI,from.mapindex-1);
-	lastfrom=mI->from;
-	lastsize=mI->icI->size();
-	++mI;
-      }
-      for(; mI != HD_map.end(); ++mI){
-	mI->from=lastfrom+lastsize;
-	lastfrom=mI->from;
-	lastsize=mI->icI->size();
-      }
-    }
-    from.setToPos(frompos);
-    return from;
-  }
-
-
-public:
-  //HDeque() : HD_bo_binsize(2048), HD_size(0) { HD_bins.resize(1); HD_map.push_back(mapinfo_t(0,HD_bins.begin()));};
-  HDeque() : HD_bo_binsize(8192), HD_size(0) { HD_bins.resize(1); HD_map.push_back(mapinfo_t(0,HD_bins.begin()));};
-  ~HDeque() {} ;
-
-  inline size_t size() const {return HD_size;};
-  inline bool empty() const {return HD_size==0;};
-
-  // Copy constructor & copy operator
-  HDeque(const HDeque & other){
-    *this=other;
-  }
-  HDeque const & operator=(HDeque const & other) {
-    HD_bins=other.HD_bins;
-    HD_bo_binsize=other.HD_bo_binsize;
-    HD_size=other.HD_size;
-    HD_map=other.HD_map;
-    // of course, need to adapt iterators in map
-    auto iclI=HD_bins.begin();
-    auto mI=HD_map.begin();
-    for(; iclI!=HD_bins.end(); ++iclI, ++mI){
-      mI->icI=iclI;
-    }
-    return *this;
-  }
-  inline void clear() {
-    HD_bins.resize(1);
-    HD_bins.begin()->clear();
-    HD_map.clear();
-    HD_map.push_back(mapinfo_t(0,HD_bins.begin()));
-    HD_size=0;
-  }
-  inline void swap(HDeque & other) {
-    HD_bins.swap(other.HD_bins);
-    HD_map.swap(other.HD_map);
-    std::swap(HD_bo_binsize,other.HD_bo_binsize);
-    std::swap(HD_size,other.HD_size);
-  }
-
-  inline void resize(size_t newsize, const TT & x) {
-    priv_checksize();
-    if(newsize<=HD_size){
-      priv_resize_shrink(newsize);
-    }else{
-      priv_resize_grow_back(newsize,x);
-    }
-  }
-  inline void resize(size_t newsize) {
-    priv_checksize();
-    if(newsize<=HD_size){
-      priv_resize_shrink(newsize);
-    }else{
-      priv_resize_grow_back(newsize,TT());
-    }
-  }
-
-
-  void setBinSize(uint32 bs) {
-    if(bs<2) throw std::out_of_range("internal error HDeque::setBinSize: size may not be < 2");
-    HD_bo_binsize=bs;
-  };
-
-  void debugDump(bool shortdbg) {
-    std::cout << "HD_bins.size(): " << HD_bins.size()
-	 << "\tHD_map.size(): " << HD_map.size()
-	 << "\tHD_bo_binsize: " << HD_bo_binsize
-	 << "\tHD_size: " << HD_size << std::endl;
-    if(!shortdbg){
-      for(size_t imi=0; imi<HD_map.size(); ++imi){
-	std::cout << "Bin " << imi << ": from " << HD_map[imi].from << "\tsize " << HD_map[imi].icI->size() << std::endl;
-      }
-    }
-  }
-  void debugDumpDeep() {
-    debugDump(false);
-    for(size_t imi=0; imi<HD_map.size(); ++imi){
-      std::cout << "Bin " << imi << ": from " << HD_map[imi].from << "\tsize " << HD_map[imi].icI->size() << std::endl;
-      uint32 l=0;
-      for(auto & x : *HD_map[imi].icI){
-	std::cout << "B " << imi << " " << l << " ";
-	++l;
-	std::cout << x << std::endl;
-      }
-    }
-  }
-
-  inline iterator begin() {
-    return iterator(this,
-		    &(*(HD_bins.begin())),
-		    HD_bins.begin()->begin(),
-		    HD_size==0); // is == 1 for empty container (which allows for begin==end()), else == 0
-  }
-  inline iterator end() {
-    return iterator(this,&(*(HD_bins.begin())),HD_bins.begin()->end(),HD_map.size());
-  }
-  inline const_iterator cbegin() {
-    return const_iterator(this,
-		    &(*(HD_bins.begin())),
-		    HD_bins.begin()->begin(),
-		    HD_size==0); // is == 1 for empty container (which allows for begin==end()), else == 0
-  }
-  inline const_iterator cend() {
-    return const_iterator(this,&(*(HD_bins.begin())),HD_bins.begin()->end(),HD_map.size());
-  }
-
-
-  void push_back(const TT & x){
-    if(HD_map.back().icI->size()>=HD_bo_binsize){
-      HD_bins.push_back(innercontainer_t());
-      HD_map.push_back(mapinfo_t(HD_map.back().from+HD_bo_binsize,--(HD_bins.end())));
-    }
-    HD_map.back().icI->push_back(x);
-    ++HD_size;
-  }
-  void pop_back(){
-    if(HD_map.back().icI->size()>1 || HD_size==1){
-      HD_map.back().icI->pop_back();
-    }else{
-      HD_map.pop_back();
-      HD_bins.pop_back();
-    }
-    --HD_size;
-  }
-
-  void push_front(const TT & x){
-    if(HD_map.front().icI->size()>=HD_bo_binsize){
-      HD_bins.push_front(innercontainer_t());
-      HD_map.push_front(mapinfo_t(HD_map.front().from,HD_bins.begin()));
-    }
-    HD_map.front().icI->push_front(x);
-    --HD_map.front().from;
-    ++HD_size;
-  }
-  void pop_front(){
-    if(HD_map.front().icI->size()>1 || HD_size==1){
-      HD_map.front().icI->pop_front();
-      ++HD_map.front().from;
-    }else{
-      HD_map.pop_front();
-      HD_bins.pop_front();
-    }
-    --HD_size;
-  }
-
-  // front() and back() of course crash when used on empty container, but so does
-  //  vectory, deque etc.pp
-  TT & back(){
-    return HD_bins.back().back();
-  }
-  const TT & back() const{
-    return HD_bins.back().back();
-  }
-  TT & front(){
-    return HD_bins.front().front();
-  }
-  const TT & front() const{
-    return HD_bins.front().front();
-  }
-
-  void insert(iterator where, size_t num, const TT & x){
-    priv_insert(where, num, x);
-    return;
-  }
-  iterator insert(iterator where, const TT & x){
-    return priv_insert(where,1,x);
-  }
-
-  iterator erase(iterator from, iterator to){
-    return priv_erase(from,to);
-  }
-
-  iterator erase(iterator elemI){
-    FUNCSTART("HDeque::erase(iterator elemI)");
-    BUGIFTHROW(elemI==end(),"elemi==end()?");
-    return erase(elemI,elemI+1);
-  }
-
-};
-
-
-#endif
diff --git a/src/mira/indexed_deque.H b/src/mira/indexed_deque.H
new file mode 100644
index 0000000..02afc90
--- /dev/null
+++ b/src/mira/indexed_deque.H
@@ -0,0 +1,541 @@
+/*
+ * Written by Bastien Chevreux (BaCh)
+ *
+ * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
+ *   Krebsforschungszentrum, DKFZ Heidelberg) and Bastien Chevreux
+ * Copyright (C) 2008 and later by Bastien Chevreux
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ * 
+ */
+
+
+#ifndef _mira_IndexedDeque_h_
+#define _mira_IndexedDeque_h_
+
+
+
+
+#include <vector>
+#include <algorithm>
+#include <iterator>
+#include <signal.h>
+
+
+// This is a drop-in replacement for the STL deque
+//
+// It replicates most of the functionality of deque, 
+//  but currently not implemented are:
+//   - function variants with InputIterators (constructor, assign(), insert())
+//   - operator==()
+//   - get_allocator()
+//   - probably some iterator comparisons like <, >, etc. (and other ???)
+//
+// Major difference to deque:
+//   - random access: O(1) (albeit using one indirection) instead of O(log N)
+//   - insertion/deletion which are not at front or back: like vector O(N/2) on average,
+//     but 5 to 6 times faster than deque. Could be improved to O(N/4).
+//
+// Class is meant to store *vast* amounts of elements (1 million, 10 million or more)
+//  but still have constant random access and insertion/deletion which is quicker
+//  than deque
+//
+// Iterator validity: unlike deque, iterators remain valid after insertion/deletion
+//  into the IndexedDeque. They may point to deleted items though.
+// However, to permit exchange of IndexedDeque with deque, one should not rely on
+//  these attributes of IndexedDeque iterators
+//
+// What a letdown. While good in synthetic tests, real life with MIRA on a 45x 454
+//  FLX project used 40%-50% more memory. Memory fragmentation even increased?
+// Even with TC malloc there's ~25% more memory used
+// One week-end worth of work down the drain. Oh well, at least I found a small
+//  bug in contig.C which had gone unnoticed with deque.
+
+
+//#define IDCEBUG(bla)   {cout << bla; cout.flush();}
+//#define IDBUGSTAT(statement) { statement;}
+#define IDCEBUG(bla)
+#define IDBUGSTAT(statement)
+
+template <typename T>
+class IndexedDeque
+{
+public:
+  
+  typedef size_t size_type;
+  
+  // Modelled after
+  //  http://www.dreamincode.net/forums/topic/58468-making-your-own-iterators/
+  // and stl_deque.h from STL
+  //
+  // STL magic ...
+  // using 
+  //   typedef std::random_access_iterator_tag iterator_category;
+  // instead of
+  //   typedef std::forward_iterator_tag iterator_category;
+  // 
+  // lets STL algorithms like advance() use iterator operator+=() instead of
+  //  repeated operator++()
+
+  class iterator
+  {
+  public:
+    typedef iterator self_type;
+    typedef T value_type;
+    typedef T& reference;
+    typedef T* pointer;
+    typedef std::random_access_iterator_tag iterator_category;
+    typedef size_type difference_type;
+    inline iterator(vector<T *> * vbase, size_type offset) : vbase_(vbase), index_(offset) { }
+    inline iterator() : vbase_(NULL), index_(0) { }
+    inline self_type operator++() { self_type i = *this; ++index_; return i; }
+    inline self_type operator++(int) { ++index_; return *this; }
+    inline self_type operator--() { self_type i = *this; --index_; return i; }
+    inline self_type operator--(int) { --index_; return *this; }
+    inline self_type & operator+=(difference_type n) { index_+=n; return *this; }
+    inline self_type operator+(difference_type n) const { self_type tmp=*this; return tmp+=n; }
+    inline size_type operator+(iterator rhs) const { return index_+rhs.index_; }
+    inline self_type & operator-=(difference_type n) { index_-=n; return *this; }
+    inline self_type operator-(difference_type n) const { self_type tmp=*this; return tmp-=n; }
+    inline size_type operator-(iterator rhs) const { return index_-rhs.index_; }
+    inline reference operator*() {
+      IDBUGSTAT(cout << "os:\tvb " << vbase_ << "\tvbs: " << vbase_->size() << "\ti: " << index_ << endl;);
+      IDBUGSTAT(if(index_ >= vbase_->size()) { cout << "WARNING! OUT OF BOUNDS." << endl; }
+	);
+      return *((*vbase_)[index_]);
+    }
+    inline pointer operator->() { 
+      IDBUGSTAT(cout << "op:\tvb " << vbase_ << "\tvbs: " << vbase_->size() << "\ti: " << index_ << endl);
+      IDBUGSTAT(if(index_ >= vbase_->size()) {cout << "WARNING! OUT OF BOUNDS." << endl; }
+	);
+      return (*vbase_)[index_];
+    }
+    inline bool operator==(const self_type& rhs) { return index_ == rhs.index_ && vbase_==rhs.vbase_ ;} 
+    inline bool operator!=(const self_type& rhs) { return index_ != rhs.index_ || vbase_!=rhs.vbase_ ;} 
+
+    inline vector<T *> * getVBase() const {return vbase_;}
+    inline size_type getIndex() const {return index_;}
+
+  private:
+    size_type index_;
+    vector<T *> * vbase_;
+  };
+  
+  class const_iterator 
+  {
+  public:
+    typedef const_iterator self_type;
+    typedef T value_type;
+    typedef T& reference;
+    typedef T* pointer;
+    typedef std::random_access_iterator_tag iterator_category;
+    typedef int difference_type;
+    inline const_iterator(vector<T *> * vbase, size_type offset) : vbase_(vbase), index_(offset) { }
+    inline const_iterator() : vbase_(NULL), index_(0) { }
+    inline const_iterator(iterator it) : vbase_(it.getVBase()), index_(it.getIndex()) { }
+    inline self_type operator++() { self_type i = *this; ++index_; return i; }
+    inline self_type operator++(int junk) { ++index_; return *this; }
+    inline self_type operator--() { self_type i = *this; --index_; return i; }
+    inline self_type operator--(int junk) { --index_; return *this; }
+    inline self_type & operator+=(difference_type n) { index_+=n; return *this; }
+    inline self_type operator+(difference_type n) const { self_type tmp=*this; return tmp+=n; }
+    inline size_type operator+(iterator rhs) const { return index_+rhs.index_; }
+    inline self_type & operator-=(difference_type n) { index_-=n; return *this; }
+    inline self_type operator-(difference_type n) const { self_type tmp=*this; return tmp-=n; }
+    inline size_type operator-(iterator rhs) const { return index_-rhs.index_; }
+
+    inline const reference operator*() { 
+      IDBUGSTAT(cout << "cos:\tvb " << vbase_ << "\tvbs: " << vbase_->size() 
+	      << "\ti: " << index_ << endl;
+	      if(index_ >= vbase_->size()) cout << "WARNING! OUT OF BOUNDS." << endl;);
+      return *((*vbase_)[index_]);
+    }
+    inline pointer operator->() { 
+      IDBUGSTAT(cout << "cop:\tvb " << vbase_ << "\tvbs: " << vbase_->size() 
+	      << "\ti: " << index_ << endl;
+	      if(index_ >= vbase_->size()) cout << "WARNING! OUT OF BOUNDS." << endl;);
+      return (*vbase_)[index_]; 
+    }
+
+    inline bool operator==(const self_type& rhs) { return index_ == rhs.index_ && vbase_==rhs.vbase_ ;} 
+    inline bool operator!=(const self_type& rhs) { return index_ != rhs.index_ || vbase_!=rhs.vbase_ ;} 
+    inline size_type getIndex() const {return index_;}
+    inline vector<T *> * getVBase() const {return vbase_;}
+  
+  private:
+    size_type index_;
+    vector<T *> * vbase_;
+  };
+  
+
+
+  class reverse_iterator 
+  {
+  public:
+    typedef reverse_iterator self_type;
+    typedef T value_type;
+    typedef T& reference;
+    typedef T* pointer;
+    typedef std::random_access_iterator_tag iterator_category;
+    typedef size_type difference_type;
+    inline reverse_iterator(vector<T *> * vbase, size_type offset) : vbase_(vbase), index_(offset) { }
+    inline reverse_iterator() : vbase_(NULL), index_(0) { }
+    inline self_type operator++() { self_type i = *this; --index_; return i; }
+    inline self_type operator++(int junk) { --index_; return *this; }
+    inline self_type operator--() { self_type i = *this; ++index_; return i; }
+    inline self_type operator--(int junk) { ++index_; return *this; }
+    inline self_type & operator+=(difference_type n) { index_-=n; return *this; }
+    inline self_type operator+(difference_type n) const { self_type tmp=*this; return tmp-=n; }
+    inline size_type operator+(iterator rhs) const { return index_+rhs.index_; }
+    inline self_type & operator-=(difference_type n) { index_+=n; return *this; }
+    inline self_type operator-(difference_type n) const { self_type tmp=*this; return tmp+=n; }
+    inline size_type operator-(iterator rhs) const { return index_-rhs.index_; }
+    inline reference operator*() {return *((*vbase_)[index_]); }
+    inline pointer operator->() { return (*vbase_)[index_]; }
+    inline bool operator==(const self_type& rhs) { 
+      return index_ == rhs.index_ && vbase_==rhs.vbase_ ;
+    }
+    inline bool operator!=(const self_type& rhs) {
+      return index_ != rhs.index_ || vbase_!=rhs.vbase_ ;
+    }
+    inline size_type getIndex() const {return index_;}
+    inline vector<T *> * getVBase() const {return vbase_;}
+
+  private:
+    size_type index_;
+    vector<T *> * vbase_;
+  };
+  
+  class const_reverse_iterator 
+  {
+  public:
+    typedef const_reverse_iterator self_type;
+    typedef T value_type;
+    typedef T& reference;
+    typedef T* pointer;
+    typedef std::random_access_iterator_tag iterator_category;
+    typedef int difference_type;
+    inline const_reverse_iterator(vector<T *> * vbase, size_type offset) : vbase_(vbase), index_(offset) { }
+    inline const_reverse_iterator() : vbase_(NULL), index_(0) { }
+    inline const_reverse_iterator(reverse_iterator it) : vbase_(it.getVBase()), index_(it.getIndex()) { }
+    inline self_type operator++() { self_type i = *this; --index_; return i; }
+    inline self_type operator++(int junk) { --index_; return *this; }
+    inline self_type operator--() { self_type i = *this; ++index_; return i; }
+    inline self_type operator--(int junk) { ++index_; return *this; }
+    inline self_type & operator+=(difference_type n) { index_-=n; return *this; }
+    inline self_type operator+(difference_type n) const { self_type tmp=*this; return tmp-=n; }
+    inline size_type operator+(iterator rhs) const { return index_+rhs.index_; }
+    inline self_type & operator-=(difference_type n) { index_+=n; return *this; }
+    inline self_type operator-(difference_type n) const { self_type tmp=*this; return tmp+=n; }
+    inline size_type operator-(iterator rhs) const { return index_-rhs.index_; }
+    inline const reference operator*() { return *((*vbase_)[index_]); }
+    inline pointer operator->() { return (*vbase_)[index_]; }
+    inline bool operator==(const self_type& rhs) {
+      return index_ == rhs.index_ && vbase_==rhs.vbase_ ;
+    }
+    inline bool operator!=(const self_type& rhs) {
+      return index_ != rhs.index_ || vbase_!=rhs.vbase_ ;
+    }
+    inline size_type getIndex() const {return index_;}
+    inline vector<T *> * getVBase() const {return vbase_;}
+  
+  private:
+    size_type index_;
+    vector<T *> * vbase_;
+  };
+  reverse_iterator rbegin() {
+    return reverse_iterator(&ID_indexvector,ID_indexvector.size()-1);
+  }
+  
+  const_reverse_iterator rbegin() const {
+    return const_reverse_iterator(&ID_indexvector,ID_indexvector.size()-1);
+  }
+  
+  reverse_iterator rend() {
+    return reverse_iterator(&ID_indexvector,ID_iv_freeelementsatstart-1);
+  }
+
+  const_reverse_iterator rend() const {
+    return reverse_const_iterator(&ID_indexvector,ID_iv_freeelementsatstart-1);
+  }
+  
+
+  
+  T& operator[](size_type index) { 
+    return *(ID_indexvector[index+ID_iv_freeelementsatstart]); 
+  }
+  
+  const T& operator[](size_type index) const {
+    return *(ID_indexvector[index+ID_iv_freeelementsatstart]);
+  }
+  
+  void assign (size_type n, const T& u ){
+    IDBUGSTAT(cout << "assign enter\n"; dumpStats(););
+    clear();
+    if(n>ID_indexvector.capacity()){
+      ID_indexvector.reserve(n);
+    }
+    ID_iv_freeelementsatstart=(ID_indexvector.capacity()-n)/2;
+    ID_indexvector.resize(ID_iv_freeelementsatstart);
+    for(size_type i=0; i<n; ++i){
+      push_back(u);
+    }
+    IDBUGSTAT(cout << "assign at end\n"; dumpStats(); cout << "assign end" << endl;);
+  }
+
+  T& at(size_type index) { 
+    rangeCheck(index);
+    return *(ID_indexvector[index+ID_iv_freeelementsatstart]); 
+  }
+  
+  const T& at(size_type index) const {
+    rangeCheck(index);
+    return *(ID_indexvector[index+ID_iv_freeelementsatstart]);
+  }
+  
+  iterator begin() {
+    return iterator(&ID_indexvector,ID_iv_freeelementsatstart);
+  }
+  
+  const_iterator begin() const {
+    return const_iterator(&ID_indexvector,ID_iv_freeelementsatstart);
+  }
+  
+  iterator end() {
+    return iterator(&ID_indexvector,ID_indexvector.size());
+  }
+
+  const_iterator end() const {
+    return const_iterator(&ID_indexvector,ID_indexvector.size());
+  }
+  
+  T & front() {
+    return *(ID_indexvector[0]);
+  }
+
+  const T & front() const {
+    return *(ID_indexvector[0]);
+  }
+  
+  T & back() {
+    return *(ID_indexvector[ID_indexvector.size()-1]);
+  }
+  
+  const T & back() const {
+    return *(ID_indexvector[ID_indexvector.size()-1]);
+  }
+  
+  T const & operator=(T const & other){
+    if(this != &other){
+      IDBUGSTAT(cout << "op= enter\n"; dumpStats(););
+      clear();
+      ID_indexvector.reserve(other.ID_indexvector.size());
+      ID_iv_freeelementsatstart=0;
+      typename vector<T*>::iterator vI=other.ID_indexvector.begin();
+      for(; vI != other.ID_indexvector.end(); vI++){
+	push_back(*vI);
+      }
+      IDBUGSTAT(cout << "op= at end\n"; dumpStats(); cout << "op= end" << endl;);
+    }
+  }
+
+
+
+  IndexedDeque() : ID_iv_freeelementsatstart(0) {}
+
+  ~IndexedDeque() {
+    IDBUGSTAT(cout << "~ enter\n"; dumpStats(););
+    clear();
+    IDBUGSTAT(cout << "~ at end\n"; dumpStats(); cout << "~ end" << endl;);
+  }
+
+  inline void clear() {
+    IDBUGSTAT(cout << "clear enter\n"; dumpStats(););
+//    typename vector<T*>::reverse_iterator ivRI = ID_indexvector.rbegin();
+//    size_type i=0;
+//    for(; ivRI!=ID_indexvector.rend(); ivRI++){
+    typename vector<T*>::iterator ivRI = ID_indexvector.begin();
+    size_type i=0;
+    for(; ivRI!=ID_indexvector.end(); ivRI++){
+      delete *ivRI;
+      ++i;
+      if(i==ID_indexvector.size()-ID_iv_freeelementsatstart){
+	break;
+      }
+    }
+    ID_iv_freeelementsatstart=ID_indexvector.size()/2;
+    ID_indexvector.resize(ID_iv_freeelementsatstart);
+    IDBUGSTAT(cout << "clear at end\n"; dumpStats(); cout << "clear end" << endl;);
+  }
+
+  inline bool empty() {
+    return (ID_indexvector.size()-ID_iv_freeelementsatstart == 0);
+  }
+
+  iterator erase(const iterator & it){
+    IDBUGSTAT(cout << "erase it enter\n"; dumpStats(););
+    delete ID_indexvector[it.getIndex()];
+      
+    typename vector<T *>::iterator tmpvI=ID_indexvector.begin()+it.getIndex();
+    ID_indexvector.erase(tmpvI);
+    IDBUGSTAT(cout << "erase it at end\n"; dumpStats(); cout << "erase it end" << endl;);
+    return it;
+  }
+
+  iterator erase(const iterator & itf,const iterator & itl){
+    IDBUGSTAT(cout << "erase it it enter\n"; dumpStats(););
+    for(iterator ti=itf; ti!=itl; ++ti){
+      delete ID_indexvector[ti.getIndex()];
+    }
+    typename vector<T *>::iterator tmpvfI=ID_indexvector.begin()+itf.getIndex();
+    typename vector<T *>::iterator tmpvlI=ID_indexvector.begin()+itl.getIndex();
+    ID_indexvector.erase(tmpvfI,tmpvlI);
+    IDBUGSTAT(cout << "erase it it at end\n"; dumpStats(); cout << "erase it it end" << endl;);
+    return itf;
+  }
+
+  inline iterator insert(const iterator & it, const T & elem){
+    if(it.getIndex()-ID_iv_freeelementsatstart==0){
+      push_front(elem);
+    }else if(it.getIndex()==ID_indexvector.size()){
+      push_back(elem);
+    }else{
+      IDBUGSTAT(cout << "insert middle enter\n"; dumpStats(););
+      T * ne=new T(elem);
+      
+      typename vector<T *>::iterator tmpvI=ID_indexvector.begin()+it.getIndex();
+      ID_indexvector.insert(tmpvI,ne);
+      IDBUGSTAT(cout << "insert middle at end\n"; dumpStats(); cout << "insert middle end" << endl;);
+    }
+    return it;
+  }
+
+  inline iterator insert(const iterator & it, size_type n, const T & elem){
+    if(it.getIndex()-ID_iv_freeelementsatstart==0){
+      for(size_type i=0; i<n; ++i){
+	push_front(elem);
+      }
+    }else if(it.getIndex()==ID_indexvector.size()){
+      for(size_type i=0; i<n; ++i){
+	push_back(elem);
+      }
+    }else{
+      IDBUGSTAT(cout << "insert middle n enter\n"; dumpStats(););
+      typename vector<T *>::iterator tmpvI=ID_indexvector.begin()+it.getIndex();
+      ID_indexvector.insert(tmpvI,n,NULL);
+      tmpvI=ID_indexvector.begin()+it.getIndex();
+      for(size_type i=0; i<n; ++i, ++tmpvI){
+	*tmpvI=new T(elem);
+      }
+      IDBUGSTAT(cout << "insert middle n at end\n"; dumpStats(); cout << "insert middle n end" << endl;);
+    }
+    return it;
+  }
+
+  size_type max_size () const {return static_cast<size_type>(-1);}
+
+  inline void push_back(const T & elem) {
+    IDBUGSTAT(cout << "push_back enter\n"; dumpStats(););
+    T * ne=new T(elem);
+    
+    if(ID_indexvector.capacity()==ID_indexvector.size()){
+      ID_indexvector.reserve(calcAdditionalCapacity());
+    }
+    ID_indexvector.push_back(ne);
+    IDBUGSTAT(cout << "push_back at end\n"; dumpStats(); cout << "push_back end" << endl;);
+  }
+
+  void pop_back() {
+    IDBUGSTAT(cout << "pop_back enter\n"; dumpStats(););
+    delete ID_indexvector.back();
+    ID_indexvector.pop_back();
+    IDBUGSTAT(cout << "pop_back at end\n"; dumpStats(); cout << "pop_back end" << endl;);
+  }
+
+  inline void push_front(const T & elem) {
+    IDBUGSTAT(cout << "push_front enter\n"; dumpStats(););
+
+    T * ne=new T(elem);
+    
+    if(ID_iv_freeelementsatstart==0){
+      ID_iv_freeelementsatstart=calcAdditionalCapacity();
+      ID_indexvector.insert(ID_indexvector.begin(),ID_iv_freeelementsatstart,NULL);
+    }
+    --ID_iv_freeelementsatstart;
+    ID_indexvector[ID_iv_freeelementsatstart]=ne;
+    IDBUGSTAT(cout << "push_front at end\n"; dumpStats(); cout << "push_front end" << endl;);
+  }
+
+  void pop_front() {
+    IDBUGSTAT(cout << "pop_front enter\n"; dumpStats(););
+    delete ID_indexvector[ID_iv_freeelementsatstart++];
+    IDBUGSTAT(cout << "pop_front at end\n"; dumpStats(); cout << "pop_front end" << endl;);
+  }
+
+  inline void resize(size_type sz, T c = T()) {
+    IDBUGSTAT(cout << "resize enter\n"; dumpStats(););
+    if(ID_indexvector.size()-ID_iv_freeelementsatstart < sz){
+      for(; ID_indexvector.size()-ID_iv_freeelementsatstart < sz;){
+	push_back(c);
+      }
+    }else{
+      for(; ID_indexvector.size()-ID_iv_freeelementsatstart > sz;){
+	pop_back();
+      }
+    }
+    IDBUGSTAT(cout << "resize at end\n"; dumpStats(); cout << "resize end" << endl;);
+  }
+
+  size_type size() const { return ID_indexvector.size()-ID_iv_freeelementsatstart; }
+  
+  void swap(IndexedDeque<T> & other){
+    if(this != &other){
+      IDBUGSTAT(cout << "swap enter\n"; dumpStats(););
+      std::swap(ID_iv_freeelementsatstart, other.ID_iv_freeelementsatstart);
+      ID_indexvector.swap(other.ID_indexvector);
+      IDBUGSTAT(cout << "swap at end\n"; dumpStats(); cout << "swap end" << endl;);
+    }
+  }
+  
+
+
+private:
+  vector<T*> ID_indexvector;
+  size_type ID_iv_freeelementsatstart;
+
+  inline size_type calcAdditionalCapacity() {
+    return max(static_cast<size_t>(1),(ID_indexvector.size()-ID_iv_freeelementsatstart)/2);
+  }
+
+  void rangeCheck(size_type n){
+    if(n>=size()){
+      __throw_out_of_range("IndexedDeque::rangeCheck"); 
+    }
+  }
+
+  void dumpStats(){
+    cout << "ds: s " << ID_indexvector.size()
+	 << "\tID_iv " << ID_iv_freeelementsatstart
+	 << "\tc " << ID_indexvector.capacity()
+	 << endl;
+  }
+};
+
+
+#endif
+
diff --git a/src/mira/maf_parse.C b/src/mira/maf_parse.C
index 7f1dbf7..59b512f 100644
--- a/src/mira/maf_parse.C
+++ b/src/mira/maf_parse.C
@@ -24,82 +24,55 @@
  */
 
 
-#include "mira/maf_parse.H"
-
-#include <boost/algorithm/string.hpp>
-
+#include "maf_parse.H"
+#include <stdlib.h>
+#include <string.h>
 
 #include "errorhandling/errorhandling.H"
-
-#include "io/annotationmappings.H"
-#include "util/fileanddisk.H"
+#include "util/progressindic.H"
 
 
-using namespace std;
 
+// 	$Id$	
 
-#define CEBUG(bla)
+#ifndef lint
+static char vcid[] = "$Id$";
+#endif /* lint */
 
 
 
-MAFParse::MAFParse(ReadPool * rpool, list<Contig> * clist, vector<MIRAParameters> * mp)
-{
-  FUNCSTART("MAFParse::MAFParse(ReadPool * rpool, list<Contig> * clist, vector<MIRAParameters> * mp)");
-
-  setNewContainers(rpool,clist,mp);
-  MAF_piptr= nullptr;
-
-  reset();
+MAFParse::MAFParse(ReadPool &aPool, list<Contig> &aContiglist, vector<MIRAParameters> * mp) {
+  MAF_readpool    = &aPool;
+  MAF_contiglist = &aContiglist;
+  MAF_miraparams = mp;
 }
 
 
 MAFParse::~MAFParse() {
   //discard();
-  if(MAF_piptr!=nullptr) delete MAF_piptr;
-  if(MAF_fin.is_open()) MAF_fin.close();
-}
-
-void MAFParse::setNewContainers(ReadPool * rpool, list<Contig> * clist, vector<MIRAParameters> * mp)
-{
-  FUNCSTART("void MAFParse::setNewContainers(ReadPool * rpool, list<Contig> * clist, vector<MIRAParameters> * mp)");
-
-  BUGIFTHROW(rpool==nullptr,"rpool==nullptr???");
-  BUGIFTHROW(clist!=nullptr && mp==nullptr,"clist!=nullptr && mp==nullptr???");
-
-  MAF_readpool   = rpool;
-  MAF_contiglist = clist;
-  MAF_miraparams = mp;
 }
 
-void MAFParse::reset()
-{
-  MAF_isinread=false;
-  MAF_isincontig=false;
-  MAF_isinreadgroup=false;
 
-  MAF_haserror=false;
 
-  cleanupHeaderData();
-  cleanupReadData();
-  cleanupContigData();
-}
+//void MAFParse::discard() {
+//}
 
 
-void MAFParse::countElements(const string & fileName, size_t & numreads, size_t & numcontigs)
+size_t MAFParse::countReadsBeforeLoad(const string & fileName, size_t & maxlinelen) 
 {
   FUNCSTART("void MAFParse::countReadsBeforeLoad()");
 
   ifstream mafin;
 
-  numreads=0;
-  numcontigs=0;
+  size_t numseqsloaded=0;
+  maxlinelen=0;
 
   mafin.open(fileName.c_str(), ios::in|ios::ate);
   if(!mafin) {
-    MIRANOTIFY(Notify::FATAL, "MAF file " << fileName << " not found for loading.");
+    throw Notify(Notify::FATAL, fileName.c_str(),"MAF file not found for loading."); 
   }
   if(!mafin.tellg() ) {
-    MIRANOTIFY(Notify::FATAL, "MAF file " << fileName << " is empty.");
+    throw Notify(Notify::FATAL, fileName.c_str(),"MAF file is empty.");
   }
 
   ProgressIndicator<streamsize> P(0, mafin.tellg(),5000);
@@ -115,22 +88,22 @@ void MAFParse::countElements(const string & fileName, size_t & numreads, size_t
     if(mafin.eof()) break;
     getline(mafin,actline);
 
-    if(actline.size()>=2){
-      if(actline[0]=='R'
-	 && actline[1]=='D') {
-	++numreads;
-      }else if(actline[0]=='C'
-	 && actline[1]=='T') {
-	++numcontigs;
-      }
+    if(actline.size()>=2
+       && actline[0]=='R'
+       && actline[1]=='D') {
+      numseqsloaded++;
     }
     if(P.delaytrigger()) P.progress(mafin.tellg());
   }
   P.finishAtOnce();
 
+  mafin.close();
+
+  maxlinelen=actline.capacity();
+
   FUNCEND();
 
-  return;
+  return numseqsloaded;
 }
 
 
@@ -152,6 +125,8 @@ void MAFParse::cleanupContigData()
 
   MAF_contig_numreads=0;
   MAF_contig_len=0;
+  MAF_contig_rawlen=0;
+
 }
 
 void MAFParse::cleanupReadData()
@@ -181,392 +156,247 @@ void MAFParse::cleanupReadData()
   MAF_read_sr=-1;
 
   MAF_read_strand_given='N';
-  MAF_read_tsegment_given=0;
-  MAF_read_seqtype=ReadGroupLib::SEQTYPE_SANGER;
+  MAF_read_seqtype=Read::SEQTYPE_SANGER;
 
   MAF_read_isbackbone=false;
   MAF_read_israil=false;
   MAF_read_isCER=false;
 
-  MAF_read_seenATline=false;
-
   MAF_readpoolid=-1;
 }
 
 
-//void MAFParse::open(const string & fileName)
-//{
-//}
-
-
-void MAFParse::registerFile(const string & fileName)
-{
-  FUNCSTART("void MAFParse::registerFile(const string & fileName)");
-
-  reset();
-
-  MAF_ccallbackfunc=nullptr;
-  MAF_rcallbackfunc=nullptr;
-  MAF_filename=fileName;
-  MAF_recalcconsensus=false; // TODO!
-
-  MAF_linenumber=0;
-
-  if(MAF_fin.is_open()) MAF_fin.close();
-
-  MAF_fin.open(MAF_filename, ios::in);
-  if(!MAF_fin) {
-    MIRANOTIFY(Notify::FATAL, "MAF file " << MAF_filename << " not found for loading.");
-  }
-  if(getFileSize(fileName)==0) {
-    MIRANOTIFY(Notify::FATAL, "MAF file " << MAF_filename << " is empty.");
-  }
-}
-
-void MAFParse::setProgressIndicator(bool b)
-{
-  if(b && MAF_piptr==nullptr){
-    uint64 ms=1;
-    if(MAF_fin.is_open()) ms=getFileSize(MAF_filename);
-    MAF_piptr= new ProgressIndicator<int64>(0, ms,5000);
-  }else if(!b && MAF_piptr!=nullptr){
-    delete MAF_piptr;
-  }
-}
-
-void MAFParse::checkCorrectFileEnd()
-{
-  FUNCSTART("void MAFParse::checkCorrectFileEnd()");
-
-  try{
-    if(MAF_isinread){
-      MIRANOTIFY(Notify::FATAL, "MAF file ends without closing an open read: " << MAF_read_name << " .... file truncated?");
-    }
-    if(MAF_isincontig){
-      MIRANOTIFY(Notify::FATAL, "MAF file ends without closing an open contig: " << MAF_contig_name << " ... file truncated?");
-    }
-    if(MAF_isinreadgroup){
-      MIRANOTIFY(Notify::FATAL, "MAF file ends without closing an open readgroup. File truncated?");
-    }
-  }
-  catch(Notify n){
-    MAF_haserror=true;
-    cout << "\nError at end of file " << MAF_filename << endl;
-    if(!MAF_contig_name.empty()) cout << "Last contig name read: " << MAF_contig_name << endl;
-    if(!MAF_read_name.empty()) cout << "Last read name read: " << MAF_read_name << endl;
-    n.handleError(THISFUNC);
-  }
-}
-
 /*
-  seqtype = default seqtype of sequences if not encoded in the MAF
+  seqtype = default seqtype of sequences if not encoded in the CAF
   loadaction:
     //  0 = count only
-    //  1 = load
+    //  1 = count, adjust readpool capacity and load
+    //  2 = load only
   lrperseqtype = longest read per seqtype
 
   returns:
     1) number of sequences loaded
-    2) when loading: size of longest read per seqtype in lrperseqtype
+    2) a) if loadaction = 0 and lrperseqtype empty: nothing more
+       b) else size of longest read per seqtype in lrperseqtype
  */
+size_t MAFParse::load(const string & fileName, const uint8 seqtype, const uint8 loadaction, vector<uint32> & lrperseqtype, bool recalcconsensus, void  (*callback)(list<Contig> &, ReadPool &), bool isVerbose) 
+{
+  FUNCSTART("void MAFParse::load()");
 
-/*
-  BaCh: 15.06.2014
-  Uhhh ... seqtype & lrperseqtype not used anymore? isverbose also?
-  loadaction also not really useful anymore
+  MAF_callbackfunc=callback;
+  MAF_recalcconsensus=recalcconsensus;
 
-  TODO: default seqtype not used??? Make it like for CAF
- */
+  MAF_simulateloading=false;
 
-//#define CEBUG(bla)   {cout << bla; cout.flush(); }
-size_t MAFParse::load(const string & fileName, const uint8 seqtype, const uint8 loadaction, vector<uint32> & lrperseqtype, bool recalcconsensus, void (*ccallback)(list<Contig> &, ReadPool &), void (*rcallback)(ReadPool &), bool isVerbose)
-{
-  FUNCSTART("void MAFParse::load()");
+  size_t numseqsloaded=0;
+  size_t maxlinelen=0;
+  if(loadaction<2){
+    cout << "First counting reads:\n";
+    numseqsloaded=countReadsBeforeLoad(fileName,maxlinelen);
 
-  BUGIFTHROW(loadaction>1,"loadaction>1??");
+    if(loadaction==0){
+      if(lrperseqtype.empty()) return numseqsloaded;
+      MAF_simulateloading=true;
+    }
 
-  if(loadaction==0){
-    cout << "Counting reads:\n";
-    size_t numreads=0;
-    size_t numcontigs=0;
-    countElements(MAF_filename,numreads,numcontigs);
-    return numreads;
+    if(loadaction==1) MAF_readpool->reserve(MAF_readpool->size()+numseqsloaded+10);
   }
 
-  registerFile(fileName);
+  numseqsloaded=0;
 
-  MAF_ccallbackfunc=ccallback;
-  MAF_rcallbackfunc=rcallback;
-  MAF_recalcconsensus=recalcconsensus;
-
-  cout << "Loading MAF " << MAF_filename << " :\n";
+  if(MAF_simulateloading){
+    cout << "\nNow simulating loading of data:\n";
+  }else{
+    cout << "\nNow loading and processing data:\n";
+  }
 
   MAF_lrperseqtype.clear();
-  MAF_lrperseqtype.resize(ReadGroupLib::SEQTYPE_END,0);
+  MAF_lrperseqtype.resize(Read::SEQTYPE_END,0);
 
-  if(MAF_piptr==nullptr) MAF_piptr= new ProgressIndicator<int64>(0, 1,5000);
-  MAF_piptr->reset(0,getFileSize(MAF_filename));
+  ifstream mafin;
 
-  MAF_actline.reserve(10000);
+  mafin.open(fileName.c_str(), ios::in|ios::ate);
+  if(!mafin) {
+    throw Notify(Notify::FATAL, fileName.c_str(),"CAF file not found for loading."); 
+  }
+  if(!mafin.tellg() ) {
+    throw Notify(Notify::FATAL, fileName.c_str(),"CAF file is empty.");
+  }
 
-  size_t numseqsloaded=loadNextSeqs(-1,-1);
+  ProgressIndicator<streamsize> P(0, mafin.tellg(),5000);
 
-  checkCorrectFileEnd();
+  mafin.seekg(0, ios::beg);
+  
+  string acttoken;
+  string actline;
 
-  lrperseqtype=MAF_lrperseqtype;
+  size_t linenumber=0;
 
-  return numseqsloaded;
-}
+  if(maxlinelen>10000) {
+    actline.reserve(maxlinelen);
+  }else{
+    actline.reserve(10000);
+  }
 
-uint64 MAFParse::loadNextSeqs(uint64 numseqstoload,uint64 numconstoload)
-{
-  FUNCSTART("uint64 MAFParse::loadNextSeqs(uint64 numseqsloaded)");
-
-  static const string cpsHVersion("@Version");
-  static const string cpsHProgram("@Program");
-  static const string cpsHReadGroup("@ReadGroup");
-  static const string cpsHEndReadGroup("@EndReadGroup");
-  static const string cpsHRG("@RG");
-
-  static const string cpsRS("RS");
-  static const string cpsRG("RG");
-  static const string cpsRQ("RQ");
-  static const string cpsRD("RD");
-  static const string cpsLR("LR");
-  static const string cpsSV("SV");
-  static const string cpsTN("TN");
-  static const string cpsDI("DI");
-  static const string cpsTF("TF");
-  static const string cpsTT("TT");
-  static const string cpsTS("TS");
-  static const string cpsSF("SF");
-  static const string cpsBC("BC");
-  static const string cpsSL("SL");
-  static const string cpsSR("SR");
-  static const string cpsQL("QL");
-  static const string cpsQR("QR");
-  static const string cpsCL("CL");
-  static const string cpsCR("CR");
-  static const string cpsAO("AO");
-  static const string cpsRT("RT");
-  static const string cpsST("ST");
-  static const string cpsSN("SN");
-  static const string cpsMT("MT");
-  static const string cpsIB("IB");
-  static const string cpsIC("IC");
-  static const string cpsIR("IR");
-  static const string cpsER("ER");
-  static const string cpsCS("CS");
-  static const string cpsCQ("CQ");
-  static const string cpsCO("CO");
-  static const string cpsNR("NR");
-  static const string cpsLC("LC");
-  static const string cpsCT("CT");
-  static const string cpsSLSL("//");
-  static const string cpsAT("AT");
-  static const string cpsEC("EC");
-  static const string cpsBSBS("\\\\");
-
-  uint64 numseqsloaded=0;
-  uint64 numconsloaded=0;
-  try {
-    while((numconstoload==0 || numconsloaded<numconstoload) && (numseqstoload==0 || numseqsloaded<numseqstoload)){
-      ++MAF_linenumber;
-      MAF_fin >> MAF_acttoken;
-      if(MAF_fin.eof()) break;
-
-      CEBUG("l: " << MAF_linenumber << "\tt: ###" << MAF_acttoken << "###" << endl);
-
-      if(MAF_acttoken.empty()) continue;
+  MAF_isinread=false;
+  MAF_isincontig=false;
 
+  cleanupHeaderData();
+  cleanupReadData();
+  cleanupContigData();
+
+  while(true){
+    linenumber++;
+    mafin >> acttoken;
+    if(mafin.eof()) break;
+
+    CEBUG("l: " << linenumber << "\tt: ###" << acttoken << "###" << endl);
+
+    if(acttoken.empty()) continue;
+
+    if(acttoken=="FV"){
+      // file version
+      parseLineFV(mafin,acttoken,actline);
 
 /* here for read*/
 
-      if(MAF_acttoken==cpsRD){
-	// read name
-	parseLineRD(MAF_acttoken,MAF_actline);
-      }else if(MAF_acttoken==cpsER){
-	// End Read
-	parseLineER(MAF_acttoken,MAF_actline);
-	++numseqsloaded;
-      }else if(MAF_acttoken==cpsRG){
-	// Read Group
-	parseLineRG(MAF_acttoken,MAF_actline);
-      }else if(MAF_acttoken==cpsRS){
-	// Read Sequence
-	parseLineRS(MAF_acttoken,MAF_actline);
-      }else if(MAF_acttoken==cpsRQ){
-	// Read Qualities
-	parseLineRQ(MAF_acttoken,MAF_actline);
-      }else if(MAF_acttoken==cpsLR){
-	// length read
-	parseLineLR(MAF_acttoken,MAF_actline);
-      }else if(MAF_acttoken==cpsSV){
-	// sequencing vector
-	parseLineSV(MAF_acttoken,MAF_actline);
-      }else if(MAF_acttoken==cpsTN){
-	// template name
-	parseLineTN(MAF_acttoken,MAF_actline);
-      }else if(MAF_acttoken==cpsDI){
-	// Direction (strand)
-	parseLineDI(MAF_acttoken,MAF_actline);
-      }else if(MAF_acttoken==cpsTF){
-	// template insize from
-	parseLineTF(MAF_acttoken,MAF_actline);
-      }else if(MAF_acttoken==cpsTT){
-	// template insize to
-	parseLineTT(MAF_acttoken,MAF_actline);
-      }else if(MAF_acttoken==cpsTS){
-	// template segment
-	parseLineTS(MAF_acttoken,MAF_actline);
-      }else if(MAF_acttoken==cpsSF){
-	// Sequencing File
-	parseLineSF(MAF_acttoken,MAF_actline);
-      }else if(MAF_acttoken==cpsBC){
-	// base caller
-	parseLineBC(MAF_acttoken,MAF_actline);
-      }else if(MAF_acttoken==cpsSL){
-	//
-	parseLineSL(MAF_acttoken,MAF_actline);
-      }else if(MAF_acttoken==cpsSR){
-	//
-	parseLineSR(MAF_acttoken,MAF_actline);
-      }else if(MAF_acttoken==cpsQL){
-	//
-	parseLineQL(MAF_acttoken,MAF_actline);
-      }else if(MAF_acttoken==cpsQR){
-	//
-	parseLineQR(MAF_acttoken,MAF_actline);
-      }else if(MAF_acttoken==cpsCL){
-	//
-	parseLineCL(MAF_acttoken,MAF_actline);
-      }else if(MAF_acttoken==cpsCR){
-	//
-	parseLineCR(MAF_acttoken,MAF_actline);
-      }else if(MAF_acttoken==cpsAO){
-	//
-	parseLineAO(MAF_acttoken,MAF_actline);
-      }else if(MAF_acttoken==cpsRT){
-	//
-	parseLineRT(MAF_acttoken,MAF_actline);
-      }else if(MAF_acttoken==cpsST){
-	//
-	parseLineST(MAF_acttoken,MAF_actline);
-      }else if(MAF_acttoken==cpsSN){
-	//
-	parseLineSN(MAF_acttoken,MAF_actline);
-      }else if(MAF_acttoken==cpsMT){
-	//
-	parseLineMT(MAF_acttoken,MAF_actline);
-      }else if(MAF_acttoken==cpsIB){
-	//
-	parseLineIB(MAF_acttoken,MAF_actline);
-      }else if(MAF_acttoken==cpsIC){
-	//
-	parseLineIC(MAF_acttoken,MAF_actline);
-      }else if(MAF_acttoken==cpsIR){
-	//
-	parseLineIR(MAF_acttoken,MAF_actline);
+    }else if(acttoken=="RS"){
+      // Read Sequence
+      parseLineRS(mafin,acttoken,actline);
+    }else if(acttoken=="RQ"){
+      // Read Qualities
+      parseLineRQ(mafin,acttoken,actline);
+    }else if(acttoken=="RD"){
+      // read name
+      parseLineRD(mafin,acttoken,actline);
+    }else if(acttoken=="LR"){
+      // length read
+      parseLineLR(mafin,acttoken,actline);
+    }else if(acttoken=="SV"){
+      // sequencing vector
+      parseLineSV(mafin,acttoken,actline);
+    }else if(acttoken=="TN"){
+      // template name
+      parseLineTN(mafin,acttoken,actline);
+    }else if(acttoken=="DI"){
+      // Direction (strand)
+      parseLineDI(mafin,acttoken,actline);
+    }else if(acttoken=="TF"){
+      // template insize from
+      parseLineTF(mafin,acttoken,actline);
+    }else if(acttoken=="TT"){
+      // template insize to
+      parseLineTT(mafin,acttoken,actline);
+    }else if(acttoken=="SF"){
+      // Sequencing File
+      parseLineSF(mafin,acttoken,actline);
+    }else if(acttoken=="BC"){
+      // base caller
+      parseLineBC(mafin,acttoken,actline);
+    }else if(acttoken=="SL"){
+      //
+      parseLineSL(mafin,acttoken,actline);
+    }else if(acttoken=="SR"){
+      //
+      parseLineSR(mafin,acttoken,actline);
+    }else if(acttoken=="QL"){
+      //
+      parseLineQL(mafin,acttoken,actline);
+    }else if(acttoken=="QR"){
+      //
+      parseLineQR(mafin,acttoken,actline);
+    }else if(acttoken=="CL"){
+      //
+      parseLineCL(mafin,acttoken,actline);
+    }else if(acttoken=="CR"){
+      //
+      parseLineCR(mafin,acttoken,actline);
+    }else if(acttoken=="AO"){
+      //
+      parseLineAO(mafin,acttoken,actline);
+    }else if(acttoken=="RT"){
+      //
+      parseLineRT(mafin,acttoken,actline);
+    }else if(acttoken=="ST"){
+      //
+      parseLineST(mafin,acttoken,actline);
+    }else if(acttoken=="SN"){
+      //
+      parseLineSN(mafin,acttoken,actline);
+    }else if(acttoken=="MT"){
+      //
+      parseLineMT(mafin,acttoken,actline);
+    }else if(acttoken=="IB"){
+      //
+      parseLineIB(mafin,acttoken,actline);
+    }else if(acttoken=="IC"){
+      //
+      parseLineIC(mafin,acttoken,actline);
+    }else if(acttoken=="IR"){
+      //
+      parseLineIR(mafin,acttoken,actline);
+    }else if(acttoken=="ER"){
+      //
+      parseLineER(mafin,acttoken,actline);
 
 /* here for contig*/
-      }else if(MAF_acttoken==cpsCO){
-	// COntig name
-	parseLineCO(MAF_acttoken,MAF_actline);
-      }else if(MAF_acttoken==cpsEC){
-	// end contig
-	parseLineEC(MAF_acttoken,MAF_actline);
-	++numconsloaded;
-      }else if(MAF_acttoken==cpsCS){
-	// Consensus Sequence
-	parseLineCS(MAF_acttoken,MAF_actline);
-      }else if(MAF_acttoken==cpsCQ){
-	// Consensus Qualities
-	parseLineCQ(MAF_acttoken,MAF_actline);
-      }else if(MAF_acttoken==cpsNR){
-	// Num Reads
-	parseLineNR(MAF_acttoken,MAF_actline);
-      }else if(MAF_acttoken==cpsLC){
-	// Length Contig
-	parseLineLC(MAF_acttoken,MAF_actline);
-      }else if(MAF_acttoken==cpsCT){
-	// Contig Tag
-	parseLineCT(MAF_acttoken,MAF_actline);
-      }else if(MAF_acttoken==cpsSLSL){
-	// start of contig reads
-
-      }else if(MAF_acttoken==cpsBSBS){
-	// end of contig reads
-
-      }else if(MAF_acttoken==cpsAT){
-	// Assembled From
-	parseLineAT(MAF_acttoken,MAF_actline);
-
-
-/* here for header*/
-
-      }else if(MAF_acttoken==cpsHVersion){
-	// file version
-	parseLineHeaderVersion(MAF_acttoken,MAF_actline);
-      }else if(MAF_acttoken==cpsHProgram){
-	// simply read the rest of the line and do nothing
-	getline(MAF_fin,MAF_acttoken);
-      }else if(MAF_acttoken==cpsHReadGroup){
-	// file version
-	parseLineHeaderReadGroup(MAF_acttoken,MAF_linenumber);
-      }else if(MAF_acttoken==cpsHEndReadGroup
-	       || MAF_acttoken==cpsHRG){
-	cout << "File " << MAF_filename << ": around line " << MAF_linenumber
-	     << "\n" << MAF_acttoken << " occurred without being in an open read group?\n";
-	MIRANOTIFY(Notify::FATAL, "Error while reading MAF file.");
-      }else{
-	cout << "File " << MAF_filename << ": around line " << MAF_linenumber
-	     << "\ndid not recognize token " << MAF_acttoken << '\n';
-	MIRANOTIFY(Notify::FATAL, "Error while reading MAF file.");
-      }
-
-      if(MAF_piptr!=nullptr){
-	if(MAF_piptr->delaytrigger()) MAF_piptr->progress(MAF_fin.tellg());
-      }
+    }else if(acttoken=="CS"){
+      // Consensus Sequence
+      parseLineCS(mafin,acttoken,actline);
+    }else if(acttoken=="CQ"){
+      // Consensus Qualities
+      parseLineCQ(mafin,acttoken,actline);
+    }else if(acttoken=="CO"){
+      // COntig name
+      parseLineCO(mafin,acttoken,actline);
+    }else if(acttoken=="NR"){
+      // Num Reads
+      parseLineNR(mafin,acttoken,actline);
+    }else if(acttoken=="LC"){
+      // Length Contig
+      parseLineLC(mafin,acttoken,actline);
+    }else if(acttoken=="CT"){
+      // Contig Tag
+      parseLineCT(mafin,acttoken,actline);
+    }else if(acttoken=="//"){
+      // start of contig reads
+
+    }else if(acttoken=="\\\\"){
+      // end of contig reads
+
+    }else if(acttoken=="AT"){
+      // Assembled From
+      parseLineAT(mafin,acttoken,actline);
+    }else if(acttoken=="EC"){
+      // end contig
+      parseLineEC(mafin,acttoken,actline);
+    }else{
+      cout << "File " << fileName << ": around line " << linenumber
+	   << "\ndid not recognize token " << acttoken << '\n';
+      MIRANOTIFY(Notify::FATAL, "Error while reading MAF file.");
     }
-  }
-  catch(Notify n){
-    MAF_haserror=true;
-    cout << "\nError around line " << MAF_linenumber << " of file " << MAF_filename << endl;
-    if(!MAF_contig_name.empty()) cout << "Last contig name read: " << MAF_contig_name << endl;
-    if(!MAF_read_name.empty()) cout << "Last read name read: " << MAF_read_name << endl;
-    n.handleError(THISFUNC);
-  }
 
-  if(checkIfEOF() && MAF_piptr!=nullptr) {
-    MAF_piptr->finishAtOnce();
-    cout << endl;
+    if(P.delaytrigger()) P.progress(mafin.tellg());
   }
 
-  FUNCEND();
+  P.finishAtOnce();
+  cout << endl;
 
-  return numseqsloaded;
-}
-//#define CEBUG(bla)
+  if(MAF_isincontig){
+    MIRANOTIFY(Notify::FATAL, "MAF file ends without closing and open contig. File truncated?");
+  }
+  if(MAF_isinread){
+    MIRANOTIFY(Notify::FATAL, "MAF file ends without closing and open read. File truncated?");
+  }
 
+  lrperseqtype=MAF_lrperseqtype;
 
-void MAFParse::checkParseIsInReadGroup(string & acttoken)
-{
-  FUNCSTART("void MAFParse::checkParseIsInReadGroup(string & acttoken)");
-  if(!MAF_isinreadgroup) {
-    MIRANOTIFY(Notify::FATAL,"Encountered " << acttoken << " line while not in readgroup (@ReadGroup line missing?)");
-  }
   FUNCEND();
-}
 
-void MAFParse::checkParseIsNotInReadGroup(string & acttoken)
-{
-  FUNCSTART("void MAFParse::checkParseIsNotInReadGroup(string & acttoken)");
-  if(MAF_isinreadgroup) {
-    MIRANOTIFY(Notify::FATAL,"Encountered " << acttoken << " line while in readgroup (@EndReadGroup line missing?)");
-  }
-  FUNCEND();
+  return numseqsloaded;
 }
 
+
 void MAFParse::checkParseIsInRead(string & acttoken)
 {
   FUNCSTART("void MAFParse::checkParseIsInRead(string & acttoken)");
@@ -597,42 +427,29 @@ void MAFParse::checkParseIsInContig(string & acttoken)
   FUNCEND();
 }
 
+void MAFParse::parseLineFV(ifstream & mafin, string & acttoken, string & actline)
+{
+  mafin >> MAF_vmajor >> MAF_vminor;
+}
 
 
 
-void MAFParse::parseLineRD(string & acttoken, string & actline)
+void MAFParse::parseLineRD(ifstream & mafin, string & acttoken, string & actline)
 {
-  FUNCSTART("void MAFParse::parseLineRD(string & acttoken, string & actline)");
+  FUNCSTART("void MAFParse::parseLineRD(ifstream & mafin, string & acttoken, string & actline)");
   if(MAF_isinread) {
     MIRANOTIFY(Notify::FATAL,"Encountered new " << acttoken << " line when the previous read " << MAF_read_name << " was not closed with 'ER'");
   }
-  checkParseIsNotInReadGroup(acttoken);
-
   cleanupReadData();
-  MAF_fin >> MAF_read_name;
+  mafin >> MAF_read_name;
   MAF_isinread=true;
 
   FUNCEND();
 }
 
-void MAFParse::parseLineRG(string & acttoken, string & actline)
+void MAFParse::parseLineRS(ifstream & mafin, string & acttoken, string & actline)
 {
-  FUNCSTART("void MAFParse::parseLineRG(string & acttoken, string & actline)");
-  checkParseIsInRead(acttoken);
-
-  MAF_fin >> MAF_tmp_str;
-  int32 dummy=atoi(MAF_tmp_str.c_str());
-  BUGIFTHROW(dummy<0 || dummy >65535,"Line RG: id must be >=0 and <= 65535, but " << dummy << " was given.");
-  BUGIFTHROW(dummy>=MAF_readgroup_externalidmapper.size()+1,"Line RG: id of " << dummy << " was given, but not readgroup with this id was defined (@RG ID)");
-  BUGIFTHROW(MAF_readgroup_externalidmapper[dummy].isDefaultNonValidReadGroupID(),"Line RG: id of " << dummy << " was given, but not readgroup with this id was defined (@RG ID)");
-  MAF_read_rgid=MAF_readgroup_externalidmapper[dummy];
-
-  FUNCEND();
-}
-
-void MAFParse::parseLineRS(string & acttoken, string & actline)
-{
-  FUNCSTART("void MAFParse::parseLineRS(string & acttoken, string & actline)");
+  FUNCSTART("void MAFParse::parseLineRS(ifstream & mafin, string & acttoken, string & actline)");
 
   checkParseIsInRead(acttoken);
 
@@ -640,7 +457,7 @@ void MAFParse::parseLineRS(string & acttoken, string & actline)
     MIRANOTIFY(Notify::FATAL,"Encountered RS line when there already was one for read " << MAF_read_name);
   }
 
-  MAF_fin >> actline;
+  mafin >> actline;
 
   MAF_read_sequence.reserve(actline.size());
   const char * seq=actline.c_str();
@@ -651,9 +468,9 @@ void MAFParse::parseLineRS(string & acttoken, string & actline)
   FUNCEND();
 }
 
-void MAFParse::parseLineRQ(string & acttoken, string & actline)
+void MAFParse::parseLineRQ(ifstream & mafin, string & acttoken, string & actline)
 {
-  FUNCSTART("void MAFParse::parseLineRQ(string & acttoken, string & actline)");
+  FUNCSTART("void MAFParse::parseLineRQ(ifstream & mafin, string & acttoken, string & actline)");
 
   checkParseIsInRead(acttoken);
 
@@ -661,7 +478,7 @@ void MAFParse::parseLineRQ(string & acttoken, string & actline)
     MIRANOTIFY(Notify::FATAL,"Encountered RQ line when there already was one for read " << MAF_read_name);
   }
 
-  MAF_fin >> actline;
+  mafin >> actline;
 
   MAF_read_qualities.reserve(actline.size());
   const char * seq=actline.c_str();
@@ -672,105 +489,97 @@ void MAFParse::parseLineRQ(string & acttoken, string & actline)
   FUNCEND();
 }
 
-void MAFParse::parseLineLR(string & acttoken, string & actline)
+void MAFParse::parseLineLR(ifstream & mafin, string & acttoken, string & actline)
 {
   checkParseIsInRead(acttoken);
-  MAF_fin >> MAF_read_len;
+  mafin >> MAF_read_len;
   if(MAF_read_len>actline.capacity()) actline.reserve(MAF_read_len+10);
 }
 
-void MAFParse::parseLineSV(string & acttoken, string & actline)
+void MAFParse::parseLineSV(ifstream & mafin, string & acttoken, string & actline)
 {
   checkParseIsInRead(acttoken);
-  MAF_fin >> MAF_read_sequencing_vector;
+  mafin >> MAF_read_sequencing_vector;
 }
 
-void MAFParse::parseLineTN(string & acttoken, string & actline)
+void MAFParse::parseLineTN(ifstream & mafin, string & acttoken, string & actline)
 {
   checkParseIsInRead(acttoken);
-  MAF_fin >> MAF_read_template;
+  mafin >> MAF_read_template;
 }
 
-void MAFParse::parseLineDI(string & acttoken, string & actline)
+void MAFParse::parseLineDI(ifstream & mafin, string & acttoken, string & actline)
 {
   checkParseIsInRead(acttoken);
-  MAF_fin >> MAF_read_strand_given;
+  mafin >> MAF_read_strand_given;
 }
 
-void MAFParse::parseLineTF(string & acttoken, string & actline)
+void MAFParse::parseLineTF(ifstream & mafin, string & acttoken, string & actline)
 {
   checkParseIsInRead(acttoken);
-  MAF_fin >> MAF_read_insert_size_min;
+  mafin >> MAF_read_insert_size_min;
 }
 
-void MAFParse::parseLineTT(string & acttoken, string & actline)
+void MAFParse::parseLineTT(ifstream & mafin, string & acttoken, string & actline)
 {
   checkParseIsInRead(acttoken);
-  MAF_fin >> MAF_read_insert_size_max;
+  mafin >> MAF_read_insert_size_max;
 }
 
-void MAFParse::parseLineTS(string & acttoken, string & actline)
+void MAFParse::parseLineSF(ifstream & mafin, string & acttoken, string & actline)
 {
   checkParseIsInRead(acttoken);
-  uint32 dummy;     // sigh ... detour to read a number and NOT a 'char';
-  MAF_fin >> dummy;
-  MAF_read_tsegment_given=static_cast<uint8>(dummy);
+  mafin >> MAF_read_scf_file;
 }
 
-void MAFParse::parseLineSF(string & acttoken, string & actline)
+void MAFParse::parseLineBC(ifstream & mafin, string & acttoken, string & actline)
 {
   checkParseIsInRead(acttoken);
-  MAF_fin >> MAF_read_scf_file;
+  mafin >> MAF_read_base_caller;
 }
 
-void MAFParse::parseLineBC(string & acttoken, string & actline)
+void MAFParse::parseLineSL(ifstream & mafin, string & acttoken, string & actline)
 {
   checkParseIsInRead(acttoken);
-  MAF_fin >> MAF_read_base_caller;
-}
-
-void MAFParse::parseLineSL(string & acttoken, string & actline)
-{
-  checkParseIsInRead(acttoken);
-  MAF_fin >> MAF_read_sl;
+  mafin >> MAF_read_sl;
   MAF_read_sl--;
 }
 
-void MAFParse::parseLineSR(string & acttoken, string & actline)
+void MAFParse::parseLineSR(ifstream & mafin, string & acttoken, string & actline)
 {
   checkParseIsInRead(acttoken);
-  MAF_fin >> MAF_read_sr;
+  mafin >> MAF_read_sr;
 }
 
-void MAFParse::parseLineQL(string & acttoken, string & actline)
+void MAFParse::parseLineQL(ifstream & mafin, string & acttoken, string & actline)
 {
   checkParseIsInRead(acttoken);
-  MAF_fin >> MAF_read_ql;
+  mafin >> MAF_read_ql;
   MAF_read_ql--;
 }
 
-void MAFParse::parseLineQR(string & acttoken, string & actline)
+void MAFParse::parseLineQR(ifstream & mafin, string & acttoken, string & actline)
 {
   checkParseIsInRead(acttoken);
-  MAF_fin >> MAF_read_qr;
+  mafin >> MAF_read_qr;
 }
 
-void MAFParse::parseLineCL(string & acttoken, string & actline)
+void MAFParse::parseLineCL(ifstream & mafin, string & acttoken, string & actline)
 {
   checkParseIsInRead(acttoken);
-  MAF_fin >> MAF_read_cl;
+  mafin >> MAF_read_cl;
   MAF_read_cl--;
 }
 
-void MAFParse::parseLineCR(string & acttoken, string & actline)
+void MAFParse::parseLineCR(ifstream & mafin, string & acttoken, string & actline)
 {
   checkParseIsInRead(acttoken);
-  MAF_fin >> MAF_read_cr;
+  mafin >> MAF_read_cr;
 }
 
-void MAFParse::parseLineAO(string & acttoken, string & actline)
+void MAFParse::parseLineAO(ifstream & mafin, string & acttoken, string & actline)
 {
-  FUNCSTART("void MAFParse::parseLineAO(string & acttoken, string & actline)");
+  FUNCSTART("void MAFParse::parseLineAO(ifstream & mafin, string & acttoken, string & actline)");
 
   checkParseIsInRead(acttoken);
 
@@ -782,10 +591,10 @@ void MAFParse::parseLineAO(string & acttoken, string & actline)
   }
 
   int32 seqfrom, seqto, origfrom, origto;
-  MAF_fin >> seqfrom;
-  MAF_fin >> seqto;
-  MAF_fin >> origfrom;
-  MAF_fin >> origto;
+  mafin >> seqfrom;
+  mafin >> seqto;
+  mafin >> origfrom;
+  mafin >> origto;
 
   //cout << "xxx " << seqfrom << " " << seqto << " " << origfrom << " " << origto << "\n";
 
@@ -802,7 +611,7 @@ void MAFParse::parseLineAO(string & acttoken, string & actline)
   if(origto<origfrom) originc=-1;
 
 
-  if (abs(seqto - seqfrom) != abs(origto - origfrom)) {
+  if (abs(seqto - seqfrom) != abs(origto - origfrom)) { 
     MIRANOTIFY(Notify::FATAL,"While reading AO line for read " << MAF_read_name << ":  distance between seqfrom/to (" << seqfrom << " " << seqto << ") is unequal to originalfrom/to (" << origfrom << " " << origto << ")");
   }
   if (max(seqfrom, seqto) > static_cast<int32>(MAF_read_align_origin.size())) {
@@ -824,310 +633,125 @@ void MAFParse::parseLineAO(string & acttoken, string & actline)
   FUNCEND();
 }
 
-void MAFParse::parseLineRT(string & acttoken, string & actline)
+void MAFParse::parseLineRT(ifstream & mafin, string & acttoken, string & actline)
 {
   checkParseIsInRead(acttoken);
 
   MAF_read_taglist.resize(MAF_read_taglist.size()+1);
-  if(MAF_vmajor<2){
-    parseTagData(acttoken,MAF_read_taglist.back());
-  }else{
-    parseTagDataV2(acttoken,MAF_read_taglist.back());
-  }
+  parseTagData(mafin,acttoken,MAF_read_taglist.back());
 
-  //cout << "Stored Rtag: " << MAF_read_taglist.back();
-  //MAF_read_taglist.back().dumpDebug(cout);
+  //cout << MAF_read_taglist.back();
 }
 
-void MAFParse::parseTagData(string & acttoken, multitag_t & targettag)
+void MAFParse::parseTagData(ifstream & mafin, string & acttoken, tag_t & tag)
 {
-  FUNCSTART("void MAFParse::parseTagData(string & acttoken, multitag_t & tag)");
-
-  multitag_t tmptag;
-
-  MAF_fin >> MAF_tmp_str;
+  FUNCSTART("void MAFParse::parseTagData(ifstream & mafin, string & acttoken, tag_t & tag)");
+  mafin >> tag.identifier;
+  mafin >> tag.from;
+  mafin >> tag.to;
 
-  if(!AnnotationMappings::isValidGFF3SOEntry(MAF_tmp_str)){
-    string soident(AnnotationMappings::translateGAP4feat2SOfeat(MAF_tmp_str));
-    if(soident.empty()){
-      soident=AnnotationMappings::translateXGAP4feat2SOfeat(MAF_tmp_str);
-      if(soident.empty()){
-	tmptag.setIdentifierStr(MAF_tmp_str);
-      }
-    }
-    if(!soident.empty()){
-      tmptag.setIdentifierStr(soident);
-    }
-  }else{
-    tmptag.setIdentifierStr(MAF_tmp_str);
+  if(tag.from<1){
+    MIRANOTIFY(Notify::FATAL, "Error in " << MAF_read_name << " in tag line " << acttoken << ": (" << tag.from << " " << tag.to << ") -> " << tag.from << " is <1, not allowed.");
   }
-
-  MAF_fin >> tmptag.from;
-  MAF_fin >> tmptag.to;
-
-  if(tmptag.from<1){
-    MIRANOTIFY(Notify::FATAL, "Error in " << MAF_read_name << " in tmptag line " << acttoken << ": (" << tmptag.from << " " << tmptag.to << ") -> " << tmptag.from << " is <1, not allowed.");
+  if(tag.to<1){
+    MIRANOTIFY(Notify::FATAL, "Error in " << MAF_read_name << " in tag line " << acttoken << ": (" << tag.from << " " << tag.to << ") -> " << tag.to << " is <1, not allowed.");
   }
-  if(tmptag.to<1){
-    MIRANOTIFY(Notify::FATAL, "Error in " << MAF_read_name << " in tmptag line " << acttoken << ": (" << tmptag.from << " " << tmptag.to << ") -> " << tmptag.to << " is <1, not allowed.");
-  }
-
-  tmptag.from-=1;
-  tmptag.to-=1;
 
+  tag.from-=1;
+  tag.to-=1;
 
-  if(tmptag.from<=tmptag.to){
-    tmptag.setStrand('+');
+  if(tag.from<=tag.to){
+    tag.strand='+';
   }else{
-    tmptag.setStrand('-');
-    swap(tmptag.from, tmptag.to);
+    tag.strand='-';
+    swap(tag.from, tag.to);
   }
 
   // comment may be present or not
   char nextchar;
-  MAF_fin.get(nextchar);
-  if(nextchar=='\n') {
-    targettag=tmptag;
-    return;
-  }
+  mafin.get(nextchar);
+  if(nextchar=='\n') return;
   if(nextchar=='\r') {
     // also eat \n
-    MAF_fin.get(nextchar);
-    targettag=tmptag;
+    mafin.get(nextchar);
     return;
   }
-  getline(MAF_fin,MAF_tmp_str);
-  tmptag.setCommentStr(MAF_tmp_str);
-
-//  cout << "BEFORE: ";
-//  tmptag.dumpDebug(cout);
-  Read::upgradeOldTagToMultitagWithGFF3(tmptag,targettag);
-//  cout << "AFTER: ";
-//  targettag.dumpDebug(cout);
-
-  if(targettag.getSourceStr().empty()){
-    if(AnnotationMappings::translateSOfeat2GAP4feat(targettag.getIdentifierStr()).empty()
-       && AnnotationMappings::translateSOfeat2XGAP4feat(targettag.getIdentifierStr()).empty()){
-      targettag.source = multitag_t::MT_tagsrcentry_idMIRA;
-    }else{
-      targettag.source = multitag_t::MT_tagsrcentry_idGFF3;
-    }
-    targettag.source = multitag_t::MT_tagsrcentry_idGFF3;
-  }else if(targettag.source == multitag_t::MT_tagsrcentry_idMIRA){
-    if(!AnnotationMappings::translateSOfeat2SOID(targettag.getIdentifierStr()).empty()){
-      targettag.source = multitag_t::MT_tagsrcentry_idGFF3;
-    }
-  }
+  getline(mafin,tag.comment);
 
   FUNCEND();
 }
 
-
-
-void MAFParse::parseTagDataV2(string & acttoken, multitag_t & targettag)
+void MAFParse::parseLineST(ifstream & mafin, string & acttoken, string & actline)
 {
-  // Raw speed to parse tab delimited line
-  // both boost::split and boost::tokenizer are 40% to 50% slower.
-  //
-  // Cheating big time: the line string gets rewritten, replacing tabs by 0 and
-  //  writing substring pointer (char *) to a fixed array
-  //
-  // When throwing with MAF_tmp_str in the message, we need to re-tabify beforehand!
-
-  FUNCSTART("void MAFParse::parseTagData(string & acttoken, multitag_t & tag)");
-
-  targettag.commentisgff3=true;
-
-  {
-    char nextchar;
-    MAF_fin.get(nextchar); // eat away the following \t
-  }
-  getline(MAF_fin,MAF_tmp_str);
-
-  static char * sarr[8];
-
-  //////////// Overwrite \t with 0, populate the array pf char * to subparts of line
-  char * sptr=const_cast<char *>(MAF_tmp_str.c_str());
-  char * rptr=sptr;
-
-  uint32 numtabs=0;
-  while(*rptr){
-    if(*rptr=='\t'){
-      *rptr=0;
-      if(numtabs>8){
-	for(auto & x : MAF_tmp_str) if(x==0) x='\t';
-	MIRANOTIFY(Notify::FATAL, "Error in " << MAF_read_name << " for " << acttoken << "\t" << MAF_tmp_str << "\nExpected at between 4 and 7 tab delimited values, but found more");
-      }
-      sarr[numtabs]=sptr;
-      ++numtabs;
-      sptr=rptr+1;
-    }
-    ++rptr;
-  }
-  if(rptr!=MAF_tmp_str.c_str()){
-    sarr[numtabs]=sptr;
-    ++numtabs;
-  }
-
-  if(numtabs<4 || numtabs>7){
-    for(auto & x : MAF_tmp_str) if(x==0) x='\t';
-    MIRANOTIFY(Notify::FATAL, "Error in " << MAF_read_name << " for " << acttoken << "\t" << MAF_tmp_str << "\nExpected at between 4 and 7 tab delimited values, but found " << numtabs);
-  }
-
-  for(;numtabs<8;++numtabs) sarr[numtabs]=nullptr;
-  ///// done
-
-  static string acts;
-  acts=sarr[0];
-
-  if(AnnotationMappings::isMIRAEntry(acts)){
-    targettag.setIdentifierStr(acts);
-  }else{
-    const string * soident=&AnnotationMappings::translateGAP4feat2SOfeat(acts);
-    if(soident->empty()){
-      soident=&AnnotationMappings::translateXGAP4feat2SOfeat(acts);
-    }
-    if(soident->empty()){
-      targettag.setIdentifierStr(acts);
-    }else{
-      targettag.setIdentifierStr(*soident);
-    }
-  }
-
-  targettag.from=atoi(sarr[1]);
-  targettag.to=atoi(sarr[2]);
-
-  if(targettag.from<1){
-    for(auto & x : MAF_tmp_str) if(x==0) x='\t';
-    MIRANOTIFY(Notify::FATAL, "Error in " << MAF_read_name << " in targettag line " << acttoken << ": (" << targettag.from << " " << targettag.to << ") -> " << targettag.from << " is <1, not allowed.");
-  }
-  if(targettag.to<1){
-    for(auto & x : MAF_tmp_str) if(x==0) x='\t';
-    MIRANOTIFY(Notify::FATAL, "Error in " << MAF_read_name << " in targettag line " << acttoken << ": (" << targettag.from << " " << targettag.to << ") -> " << targettag.to << " is <1, not allowed.");
-  }
-
-  targettag.from-=1;
-  targettag.to-=1;
-
-  if(*sarr[3]==0){
-    for(auto & x : MAF_tmp_str) if(x==0) x='\t';
-    MIRANOTIFY(Notify::FATAL, "Error in " << MAF_read_name << " in targettag line " << acttoken << ": the entry for the strand is empty, not allowed.");
-  }
-
-  targettag.setStrand(*sarr[3]);
-
-  if(sarr[4]!=nullptr){
-    targettag.setSourceStr(sarr[4]);
-
-    if(sarr[5]!=nullptr){
-      // hmmmmmm .... something was very wrong with the previous implementation
-      switch(*sarr[5]){
-      case '.':
-      case '3':{
-	targettag.phase=3;
-	break;
-      }
-      case '0':{
-	targettag.phase=0;
-	break;
-      }
-      case '1':{
-	targettag.phase=1;
-	break;
-      }
-      case '2':{
-	targettag.phase=2;
-	break;
-      }
-      default : {
-	for(auto & x : MAF_tmp_str) if(x==0) x='\t';
-	MIRANOTIFY(Notify::FATAL, "Error in " << MAF_read_name << " in targettag line " << acttoken << "\t" << MAF_tmp_str << "\nthe entry for the strand (" << *sarr[5] << ") is not 0, 1, 2, 3 or .");
-      }
-      }
-
-      if(sarr[6]!=nullptr){
-	targettag.setCommentStr(sarr[6]);
-      }
-    }
-  }
-
-  FUNCEND();
-}
-
-
-void MAFParse::parseLineST(string & acttoken, string & actline)
-{
-  FUNCSTART("void MAFParse::parseLineST(string & acttoken, string & actline)");
+  FUNCSTART("void MAFParse::parseLineST(ifstream & mafin, string & acttoken, string & actline)");
   checkParseIsInRead(acttoken);
-  MAF_fin >> actline;
+  mafin >> actline;
 
-  MAF_read_seqtype=ReadGroupLib::stringToSeqType(actline);
+  MAF_read_seqtype=Read::stringToSeqType(actline);
 
-  if(MAF_read_seqtype==ReadGroupLib::SEQTYPE_END){
-    MIRANOTIFY(Notify::FATAL, "Error in " << MAF_read_name << " in tag " << acttoken << ": unknown sequencing type '" << actline << "'?");
+  if(MAF_read_seqtype==Read::SEQTYPE_END){
+    MIRANOTIFY(Notify::FATAL, "Error in " << MAF_read_name << " in tag " << acttoken << ": unkown sequencing type '" << actline << "'?");
   }
   FUNCEND();
 }
 
-void MAFParse::parseLineSN(string & acttoken, string & actline)
+void MAFParse::parseLineSN(ifstream & mafin, string & acttoken, string & actline)
 {
   checkParseIsInRead(acttoken);
-  MAF_fin >> MAF_read_strain;
+  mafin >> MAF_read_strain;
 }
 
-void MAFParse::parseLineMT(string & acttoken, string & actline)
+void MAFParse::parseLineMT(ifstream & mafin, string & acttoken, string & actline)
 {
   checkParseIsInRead(acttoken);
-  MAF_fin >> MAF_read_machinetype;
+  mafin >> MAF_read_machinetype;
 }
 
-void MAFParse::parseLineIB(string & acttoken, string & actline)
+void MAFParse::parseLineIB(ifstream & mafin, string & acttoken, string & actline)
 {
   checkParseIsInRead(acttoken);
-  MAF_fin >> MAF_read_isbackbone;
+  mafin >> MAF_read_isbackbone;
 }
 
-void MAFParse::parseLineIC(string & acttoken, string & actline)
+void MAFParse::parseLineIC(ifstream & mafin, string & acttoken, string & actline)
 {
   checkParseIsInRead(acttoken);
-  MAF_fin >> MAF_read_isCER;
+  mafin >> MAF_read_isCER;
 }
 
-void MAFParse::parseLineIR(string & acttoken, string & actline)
+void MAFParse::parseLineIR(ifstream & mafin, string & acttoken, string & actline)
 {
   checkParseIsInRead(acttoken);
-  MAF_fin >> MAF_read_israil;
+  mafin >> MAF_read_israil;
 }
 
-void MAFParse::parseLineER(string & acttoken, string & actline)
+void MAFParse::parseLineER(ifstream & mafin, string & acttoken, string & actline)
 {
   checkParseIsInRead(acttoken);
   addReadToReadPool();
   MAF_isinread=false;
-  if(!MAF_isincontig && MAF_rcallbackfunc!=nullptr) {
-    (*MAF_rcallbackfunc)(*MAF_readpool);
+  if(!MAF_isincontig  && MAF_callbackfunc!=NULL) {
+    (*MAF_callbackfunc)(*MAF_contiglist, *MAF_readpool);
   }
-  MAF_read_rgid.resetLibId();
 }
 
 
-void MAFParse::parseLineCO(string & acttoken, string & actline)
+void MAFParse::parseLineCO(ifstream & mafin, string & acttoken, string & actline)
 {
-  FUNCSTART("void MAFParse::parseLineCO(string & acttoken, string & actline)");
+  FUNCSTART("void MAFParse::parseLineCO(ifstream & mafin, string & acttoken, string & actline)");
   if(MAF_isincontig){
     MIRANOTIFY(Notify::FATAL, "Seen new CO line while previous CO was not closed by EC");
   }
-  checkParseIsNotInReadGroup(acttoken);
 
   cleanupContigData();
-  MAF_fin >> MAF_contig_name;
+  mafin >> MAF_contig_name;
   MAF_isincontig=true;
   FUNCEND();
 }
 
-void MAFParse::parseLineCS(string & acttoken, string & actline)
+void MAFParse::parseLineCS(ifstream & mafin, string & acttoken, string & actline)
 {
-  FUNCSTART("void MAFParse::parseLineSQ(string & acttoken, string & actline)");
+  FUNCSTART("void MAFParse::parseLineSQ(ifstream & mafin, string & acttoken, string & actline)");
 
   checkParseIsInContig(acttoken);
 
@@ -1135,7 +759,7 @@ void MAFParse::parseLineCS(string & acttoken, string & actline)
     MIRANOTIFY(Notify::FATAL,"Encountered CS line when there already was one for contig " << MAF_contig_name);
   }
 
-  MAF_fin >> actline;
+  mafin >> actline;
 
   MAF_contig_sequence.reserve(actline.size());
   const char * seq=actline.c_str();
@@ -1146,17 +770,17 @@ void MAFParse::parseLineCS(string & acttoken, string & actline)
   FUNCEND();
 }
 
-void MAFParse::parseLineCQ(string & acttoken, string & actline)
+void MAFParse::parseLineCQ(ifstream & mafin, string & acttoken, string & actline)
 {
-  FUNCSTART("void MAFParse::parseLineCQ(string & acttoken, string & actline)");
+  FUNCSTART("void MAFParse::parseLineCQ(ifstream & mafin, string & acttoken, string & actline)");
 
   checkParseIsInContig(acttoken);
 
   if(!MAF_contig_qualities.empty()){
     MIRANOTIFY(Notify::FATAL,"Encountered CQ line when there already was one for contig " << MAF_contig_name);
   }
-
-  MAF_fin >> actline;
+  
+  mafin >> actline;
 
   MAF_contig_qualities.reserve(actline.size());
   const char * seq=actline.c_str();
@@ -1167,41 +791,35 @@ void MAFParse::parseLineCQ(string & acttoken, string & actline)
   FUNCEND();
 }
 
-void MAFParse::parseLineNR(string & acttoken, string & actline)
+void MAFParse::parseLineNR(ifstream & mafin, string & acttoken, string & actline)
 {
   checkParseIsInContig(acttoken);
-  MAF_fin >> MAF_contig_numreads;
+  mafin >> MAF_contig_numreads;
 }
 
-void MAFParse::parseLineLC(string & acttoken, string & actline)
+void MAFParse::parseLineLC(ifstream & mafin, string & acttoken, string & actline)
 {
   checkParseIsInContig(acttoken);
-  MAF_fin >> MAF_contig_len;
+  mafin >> MAF_contig_len;
 
   if(MAF_contig_len>actline.capacity()) actline.reserve(MAF_contig_len+10);
 }
 
-void MAFParse::parseLineCT(string & acttoken, string & actline)
+void MAFParse::parseLineCT(ifstream & mafin, string & acttoken, string & actline)
 {
   checkParseIsInContig(acttoken);
 
   MAF_contig_taglist.resize(MAF_contig_taglist.size()+1);
-  if(MAF_vmajor<2){
-    parseTagData(acttoken,MAF_contig_taglist.back());
-    // for consensus tags, change strand to '='
-    // BaCh 21.01.2012: Why?
-    //MAF_contig_taglist.back().setStrand('=');
-  }else{
-    parseTagDataV2(acttoken,MAF_contig_taglist.back());
-  }
+  parseTagData(mafin,acttoken,MAF_contig_taglist.back());
+  // for consensus tags, change strand to '='
+  MAF_contig_taglist.back().strand='=';
 
-  //cout << "Stored Ctag: ";
-  //MAF_contig_taglist.back().dumpDebug(cout);
+  //cout << MAF_contig_taglist.back();
 }
 
-void MAFParse::parseLineAT(string & acttoken, string & actline)
+void MAFParse::parseLineAT(ifstream & mafin, string & acttoken, string & actline)
 {
-  FUNCSTART("void MAFParse::parseLineAT(string & acttoken, string & actline)");
+  FUNCSTART("void MAFParse::parseLineAT(ifstream & mafin, string & acttoken, string & actline)");
 
   checkParseIsInContig(acttoken);
   checkParseIsNotInRead(acttoken);
@@ -1209,25 +827,27 @@ void MAFParse::parseLineAT(string & acttoken, string & actline)
   if(MAF_readpoolid<0){
     MIRANOTIFY(Notify::FATAL, "Seen AT line but no read in contig defined before? (RD/ER block in a CO block)");
   }
-  if(MAF_read_seenATline){
-    MIRANOTIFY(Notify::FATAL, "Seen AT line, but either no read before or multiple AT lines.");
-  }
-  MAF_read_seenATline=true;
 
   int32 cfrom,cto,rfrom,rto;
   Contig::contig_init_read_t tmpcr;
   int8 direction=1;
 
-  MAF_fin >> cfrom;
-  MAF_fin >> cto;
-  MAF_fin >> rfrom;
-  MAF_fin >> rto;
+  mafin >> cfrom;
+  mafin >> cto;
+  mafin >> rfrom;
+  mafin >> rto;
 
   if(cfrom > cto){
     direction=-1;
     tmpcr.offset_in_contig=cto-1;
+    if (cfrom > MAF_contig_rawlen) {
+      MAF_contig_rawlen = cfrom;
+    }
   }else{
     tmpcr.offset_in_contig=cfrom-1;
+    if (cto > MAF_contig_rawlen) {
+      MAF_contig_rawlen = cto;
+    }
   }
 
   if(rfrom>rto){
@@ -1246,56 +866,45 @@ void MAFParse::parseLineAT(string & acttoken, string & actline)
   FUNCEND();
 }
 
-void MAFParse::parseLineEC(string & acttoken, string & actline)
+void MAFParse::parseLineEC(ifstream & mafin, string & acttoken, string & actline)
 {
-  FUNCSTART("void MAFParse::parseLineEC(string & acttoken, string & actline)");
-
   checkParseIsInContig(acttoken);
   MAF_isincontig=false;
 
-  if(MAF_contiglist!=nullptr){
-    {
-      Contig dummy(MAF_miraparams, *MAF_readpool);
-      MAF_contiglist->push_back(dummy);
-    }
+  {
+    Contig dummy(MAF_miraparams, *MAF_readpool);
+    MAF_contiglist->push_back(dummy);
+  }
 
-    try{
-      if(MAF_recalcconsensus){
-	string dummy1;
-	vector<base_quality_t> dummy2;
-	MAF_contiglist->back().initialiseContig(MAF_contig_assembledfrom,
-						MAF_contig_taglist,
-						MAF_contig_name,
-						dummy1,dummy2);
-      }else{
-	string dummy1;
-	dummy1.reserve(MAF_contig_sequence.size()+2);
-	for(auto dnaI=MAF_contig_sequence.cbegin(); dnaI != MAF_contig_sequence.end(); dnaI++) dummy1+=*dnaI;
-	MAF_contiglist->back().initialiseContig(MAF_contig_assembledfrom,
-						MAF_contig_taglist,
-						MAF_contig_name,
-						dummy1,
-						MAF_contig_qualities);
-      }
-    }
-    catch(Notify n){
-      cout << "Error for contig " << MAF_contig_name << endl;
-      n.handleError(THISFUNC);
-    }
 
-    try{
-      if(MAF_ccallbackfunc!=nullptr) {
-	(*MAF_ccallbackfunc)(*MAF_contiglist, *MAF_readpool);
+  if(MAF_recalcconsensus){
+    string dummy1;
+    vector<base_quality_t> dummy2;
+    MAF_contiglist->back().initialiseContig(MAF_contig_rawlen, 
+					    MAF_contig_assembledfrom, 
+					    MAF_contig_taglist,
+					    MAF_contig_name,
+					    dummy1,dummy2);
+  }else{
+    string dummy1;
+    dummy1.reserve(MAF_contig_sequence.size()+2);
+    {
+      vector<char>::const_iterator dnaI=MAF_contig_sequence.begin();
+      for(; dnaI != MAF_contig_sequence.end(); dnaI++){
+	dummy1+=*dnaI;
       }
     }
-    catch(Notify n){
-      cout << "Error while calling callback!\n";
-      cout << "Error for contig " << MAF_contig_name << endl;
-      n.handleError(THISFUNC);
-    }
+    MAF_contiglist->back().initialiseContig(MAF_contig_rawlen, 
+					    MAF_contig_assembledfrom, 
+					    MAF_contig_taglist,
+					    MAF_contig_name,
+					    dummy1,
+					    MAF_contig_qualities);
   }
 
-  FUNCEND();
+  if(MAF_callbackfunc!=NULL) {
+    (*MAF_callbackfunc)(*MAF_contiglist, *MAF_readpool);
+  }
 }
 
 
@@ -1304,7 +913,7 @@ void MAFParse::checkReadData()
 {
   FUNCSTART("void MAFParse::checkReadData()");
 
-  BUGIFTHROW(MAF_read_seqtype>=ReadGroupLib::SEQTYPE_END, "Illegal seqtype in checkReadData()???");
+  BUGIFTHROW(MAF_read_seqtype>=Read::SEQTYPE_END, "Illegal seqtype in checkReadData()???");
 
   if(MAF_read_len>=0
      && MAF_read_sequence.size() != MAF_read_len){
@@ -1316,11 +925,25 @@ void MAFParse::checkReadData()
     }
   }else{
     // sequence but no qualities ... then fake some according to the sequencing type
-    // give them the standard qual for this sequencing type
-    MAF_read_qualities.resize(MAF_read_sequence.size(),MAF_read_rgid.getDefaultQual());
+
+    // if miraparams is larger than seqtype ... bad luck, just give a qual of 10
+    if(MAF_miraparams->size()>=MAF_read_seqtype){
+      MAF_read_qualities.resize(MAF_read_sequence.size(),10);
+    }else{
+      // everything ok, give them the standard qual for this sequencing type
+      MAF_read_qualities.resize(
+	MAF_read_sequence.size(),
+	(*MAF_miraparams)[MAF_read_seqtype].getAssemblyParams().as_basedefaultqual
+	);
+    }
   }
 
-  if(!MAF_read_align_origin.empty() && MAF_read_align_origin.size() != MAF_read_sequence.size()){
+  if(MAF_read_align_origin.empty()){
+    MAF_read_align_origin.resize(MAF_read_sequence.size());
+    for(size_t ii=0; ii<MAF_read_align_origin.size(); ++ii) MAF_read_align_origin[ii]=ii;
+  }
+
+  if(MAF_read_align_origin.size() != MAF_read_sequence.size()){
     MIRANOTIFY(Notify::FATAL,"Read " << MAF_read_name << ": the align to origin (AO) data led to a larger or smaller array that the length of the sequence?");
   }
 
@@ -1336,77 +959,16 @@ void MAFParse::checkReadData()
 }
 
 
-//#define CEBUG(bla)   {cout << bla; cout.flush(); }
 void MAFParse::addReadToReadPool()
 {
-  FUNCSTART("void MAFParse::addReadToReadPool()");
-
   checkReadData();
 
   MAF_readpoolid=MAF_readpool->size();
-  Read & newread = MAF_readpool->getRead(MAF_readpool->provideEmptyRead());
-
-  ReadGroupLib::ReadGroupID rgid;
-
-  if(MAF_vmajor>=2 && MAF_read_rgid.isDefaultNonValidReadGroupID()){
-    MIRANOTIFY(Notify::FATAL,"Read " << MAF_read_name << " has no RG line to define the read group. This is needed for MAF version 2");
-  }
-  if(MAF_read_rgid.isDefaultNonValidReadGroupID()){
-    string rgname;
-    rgid=ReadGroupLib::searchExactRGMatch(
-      rgname,
-      MAF_read_seqtype,
-      MAF_read_insert_size_min,
-      MAF_read_insert_size_max,
-      ReadGroupLib::SPLACE_UNKNOWN,
-      MAF_read_strain,
-      MAF_read_isbackbone,
-      MAF_read_israil,
-      MAF_read_isCER,
-      MAF_read_sequencing_vector,
-      MAF_read_machinetype,
-      MAF_read_base_caller);
-
-    if(rgid.isDefaultNonValidReadGroupID()){
-      rgid=ReadGroupLib::newReadGroup();
-      rgid.setGroupName(rgname);
-      rgid.setSequencingType(MAF_read_seqtype);
-      rgid.setInsizeFrom(MAF_read_insert_size_min);
-      rgid.setInsizeTo(MAF_read_insert_size_max);
-      rgid.setSegmentPlacement("?");
-      rgid.setStrainName(MAF_read_strain);
-      rgid.setBackbone(MAF_read_isbackbone);
-      rgid.setRail(MAF_read_israil);
-      rgid.setCoverageEquivalentRead(MAF_read_isCER);
-      rgid.setSeqVecName(MAF_read_sequencing_vector);
-      rgid.setMachineType(MAF_read_machinetype);
-      rgid.setBaseCaller(MAF_read_base_caller);
-    }
-  }else{
-    rgid=MAF_read_rgid;
-  }
-
-  //cout << "Setting rgid to:\n" << rgid << endl;
-
-  if(rgid.getSequencingType()==ReadGroupLib::SEQTYPE_SOLEXA
-     || rgid.getSequencingType()==ReadGroupLib::SEQTYPE_IONTORRENT){
-    newread.disallowAdjustments();
-  }
+  Read & newread = MAF_readpool->addNewEmptyRead(); 
 
-  if(newread.usesAdjustments() && MAF_read_align_origin.empty() && !MAF_read_sequence.empty()){
-    // no AO line given, i.e., no insertions/deletions
-    // create vector which represents that
-    MAF_read_align_origin.resize(MAF_read_sequence.size());
-    uint32 num=0;
-    for(auto & x : MAF_read_align_origin){
-      x=num++;
-    }
-  }
-
-  newread.initialiseRead(false,
-			 false,
+  newread.initialiseRead(false, 
+			 false, 
 			 true,     // always padded
-			 rgid,
 			 MAF_read_sequence,
 			 MAF_read_qualities,
 			 MAF_read_align_origin,
@@ -1419,358 +981,40 @@ void MAFParse::addReadToReadPool()
 			 MAF_read_sr,
 			 MAF_read_cl,
 			 MAF_read_cr);
-
-
-  if(MAF_read_tsegment_given!=0){
-    newread.setTemplateSegment(MAF_read_tsegment_given);
-  }else if(MAF_read_strand_given!='N'){
-    if(MAF_read_strand_given=='F'){
-      newread.setTemplateSegment(1);
-    }else{
-      newread.setTemplateSegment(255);
-    }
-  }
-  if (!MAF_read_template.empty()) {
-    newread.setTemplate(MAF_read_template);
-  }
-
-  CEBUG("ER read is:\n" << newread << endl);
-}
-#define CEBUG(bla)
-
-
-
-void MAFParse::parseLineHeaderVersion(string & acttoken, string & actline)
-{
-  MAF_fin >> MAF_tmp_str;
-  MAF_vmajor=atoi(MAF_tmp_str.c_str());
-  MAF_fin >> MAF_tmp_str;
-  MAF_vminor=atoi(MAF_tmp_str.c_str());
-}
-
-void MAFParse::parseLineHeaderReadGroup(string & acttoken, uint64 & linenumber)
-{
-  FUNCSTART("void MAFParse::parseLineHeaderReadGroup(string & acttoken, uint64 & linenumber)");
-
-  checkParseIsNotInReadGroup(acttoken);
-
-  MAF_readgroup_rgid=ReadGroupLib::newReadGroup();
-  parseReadGroup(MAF_fin,MAF_readgroup_rgid,MAF_readgroup_externalidmapper,linenumber);
-  MAF_readgroup_rgid.fillInSensibleDefaults();
-  MAF_readgroup_rgid.resetLibId();
-
-  FUNCEND();
-}
-
-
-//#define CEBUG(bla)   {cout << bla; cout.flush(); }
-void MAFParse::parseReadGroup(ifstream & mafin, ReadGroupLib::ReadGroupID & rgid, vector<ReadGroupLib::ReadGroupID> & externalidmapper, uint64 & linenumber)
-{
-  FUNCSTART("void MAFParse::parseReadGroup(ifstream & mafin, ReadGroupLib::ReadGroupID & rgid, vector<ReadGroupLib::ReadGroupID> & externalidmapper, uint64 & linenumber)");
-
-  string mafline;
-  vector<string> mafsplit;
-
-  while(true){
-    ++linenumber;
-    getline(mafin,mafline);
-    CEBUG("MLRG: " << mafline << endl);
-    if(mafin.eof()) break;
-    if(mafline.empty()) continue;
-    boost::split(mafsplit, mafline, boost::is_any_of("\t"));
-    if(mafsplit.empty()) continue;
-    if(mafsplit.size()==1){
-      if(mafsplit[0]=="@EndReadGroup") break;
-      cout << "\nOuch, erroneous line: " << mafline << endl;
-      MIRANOTIFY(Notify::FATAL,"Did not find a tab character in line " << linenumber << " and keyword is not @EndReadGroup? Something is wrong.");
-    }
-
-    string & rgtoken=mafsplit[1];
-    CEBUG("read rgtoken #" << rgtoken << "#\n");
-
-    if(rgtoken=="isbackbone"){
-      rgid.setBackbone(true);
-      continue;
-    }else if(rgtoken=="israil"){
-      rgid.setRail(true);
-      continue;
-    }else if(rgtoken=="iscoverageequivalent"){
-      rgid.setCoverageEquivalentRead(true);
-      continue;
-    }
-
-    if(mafsplit.size()<3){
-      MIRANOTIFY(Notify::FATAL,"Line " << mafline << "\nexpected at least 3 elements, found " << mafsplit.size() << endl);
-    }
-
-    string & rgval1=mafsplit[2];
-    CEBUG("rgval1 #" << rgval1 << "#\n");
-
-    if(rgtoken=="name"){
-      rgid.setGroupName(rgval1);
-    }else if(rgtoken=="segmentnaming"
-	     || rgtoken=="templatenaming"){
-      //TODO:  implement templatenaming
-    }else if(rgtoken=="ID"){
-      int32 dummy=atoi(rgval1.c_str());
-      if(dummy<0 || dummy >65535){
-	MIRANOTIFY(Notify::FATAL,"Line @RG ID: id must be >=0 and <= 65535, but " << dummy << " was given.");
-      }
-      if(dummy>=externalidmapper.size()){
-	externalidmapper.resize(dummy+1);
-      }
-      externalidmapper[dummy]=rgid;
-    }else if(rgtoken=="technology"){
-      rgid.setSequencingType(rgval1);
-    }else if(rgtoken=="strainname"){
-      rgid.setStrainName(rgval1);
-    }else if(rgtoken=="segmentplacement"
-	     || rgtoken=="templateplacement"){
-      if(!rgid.setSegmentPlacement(rgval1)){
-	MIRANOTIFY(Notify::FATAL,"Line @RG segmentplacement: did not recognise '" << rgval1 << "' as valid placement code.");
-      }
-    }else if(rgtoken=="templatesize"){
-      int32 dummy=atoi(rgval1.c_str());
-      rgid.setInsizeFrom(dummy);
-      dummy=atoi(mafsplit[3].c_str());
-      rgid.setInsizeTo(dummy);
-    }else if(rgtoken=="machinetype"){
-      rgid.setMachineType(rgval1);
-    }else if(rgtoken=="basecaller"){
-      rgid.setBaseCaller(rgval1);
-    }else if(rgtoken=="dye"){
-      rgid.setDye(rgval1);
-    }else if(rgtoken=="primer"){
-      rgid.setPrimer(rgval1);
-    }else if(rgtoken=="clonevecname"){
-      rgid.setCloneVecName(rgval1);
-    }else if(rgtoken=="seqvecname"){
-      rgid.setSeqVecName(rgval1);
-    }else if(rgtoken=="adaptorleft"){
-//    rgid.set(rgval1);
-    }else if(rgtoken=="adaptorright"){
-//    rgid.setSeqVecName(rgval1);
-    }else if(rgtoken=="adaptorsplit"){
-//    rgid.setSeqVecName(rgval1);
-    }else if(rgtoken=="datadir"){
-      rgid.setDataDir(rgval1);
-    }else if(rgtoken=="datafile"){
-      rgid.setDataFile(rgval1);
-    }else{
-      MIRANOTIFY(Notify::FATAL,"For line @RG: did not recognize token " << rgtoken);
-    }
-  }
-
-  FUNCEND();
-}
-
-
-
-
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////        Obsolete        ///////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-/*
-
-void MAFParse::parseTagDataV2(string & acttoken, multitag_t & targettag)
-{
-  FUNCSTART("void MAFParse::parseTagData(string & acttoken, multitag_t & tag)");
-
-  static const auto anyof=boost::is_any_of("\t");
-
-  targettag.commentisgff3=true;
-
-  MAF_tmp_strv.clear();
-  char nextchar;
-  mafin.get(nextchar); // eat away the following \t
-  getline(mafin,MAF_tmp_str);
-
-  boost::split(MAF_tmp_strv, MAF_tmp_str, anyof);
-
-  if(MAF_tmp_strv.size() < 4 || MAF_tmp_strv.size() > 7){
-    MIRANOTIFY(Notify::FATAL, "Error in " << MAF_read_name << " for " << acttoken << "\t" << MAF_tmp_str << "\nExpected at between 4 and 7 tab delimited values, but found " << MAF_tmp_strv.size());
-  }
-
-
-  if(AnnotationMappings::isMIRAEntry(MAF_tmp_strv[0])){
-    targettag.setIdentifierStr(MAF_tmp_strv[0]);
-  }else{
-    const string * soident=&AnnotationMappings::translateGAP4feat2SOfeat(MAF_tmp_strv[0]);
-    if(soident->empty()){
-      soident=&AnnotationMappings::translateXGAP4feat2SOfeat(MAF_tmp_strv[0]);
-    }
-    if(soident->empty()){
-      targettag.setIdentifierStr(MAF_tmp_strv[0]);
-    }else{
-      targettag.setIdentifierStr(*soident);
-    }
+  
+  
+  if (MAF_read_insert_size_max > 0 || MAF_read_insert_size_min > 0) {
+    newread.setInsize(MAF_read_insert_size_min, MAF_read_insert_size_max); 
   }
 
-  targettag.from=atoi(MAF_tmp_strv[1].c_str());
-  targettag.to=atoi(MAF_tmp_strv[2].c_str());
-
-  if(targettag.from<1){
-    MIRANOTIFY(Notify::FATAL, "Error in " << MAF_read_name << " in targettag line " << acttoken << ": (" << targettag.from << " " << targettag.to << ") -> " << targettag.from << " is <1, not allowed.");
-  }
-  if(targettag.to<1){
-    MIRANOTIFY(Notify::FATAL, "Error in " << MAF_read_name << " in targettag line " << acttoken << ": (" << targettag.from << " " << targettag.to << ") -> " << targettag.to << " is <1, not allowed.");
-  }
-
-  targettag.from-=1;
-  targettag.to-=1;
-
-  if(MAF_tmp_strv[3].empty()){
-    MIRANOTIFY(Notify::FATAL, "Error in " << MAF_read_name << " in targettag line " << acttoken << ": the entry for the strand is empty, not allowed.");
-  }
-
-  targettag.setStrand(MAF_tmp_strv[3].front());
-
-  if(MAF_tmp_strv.size() >=5){
-    targettag.setSourceStr(MAF_tmp_strv[4]);
-
-    if(MAF_tmp_strv.size() >=6){
-      if(!MAF_tmp_strv[5].empty()){
-	switch(MAF_tmp_strv[5].front()){
-	case '.':{
-	  targettag.phase=3;
-	  break;
-	}
-	case '1':{
-	  targettag.phase=2;
-	  break;
-	}
-	case '2':{
-	  targettag.phase=1;
-	  break;
-	}
-	case '3':{
-	  targettag.phase=0;
-	  break;
-	}
-	default : {
-	  MIRANOTIFY(Notify::FATAL, "Error in " << MAF_read_name << " in targettag line " << acttoken << "\t" << MAF_tmp_str << "\nthe entry for the strand (" << MAF_tmp_strv[5] << ") is not 1, 2, 3 or .");
-	}
-	}
-      }
-
-      if(MAF_tmp_strv.size() ==7){
-	targettag.setCommentStr(MAF_tmp_strv[6]);
-      }
-    }
+  if(MAF_read_strand_given!='N'){
+    newread.setTemplateEnd(MAF_read_strand_given);
   }
 
-  FUNCEND();
-}
-
-
-
-#include<boost/tokenizer.hpp>
-
-void MAFParse::parseTagDataV2(string & acttoken, multitag_t & targettag)
-{
-  FUNCSTART("void MAFParse::parseTagData(string & acttoken, multitag_t & tag)");
-
-  targettag.commentisgff3=true;
-
-  {
-    char nextchar;
-    mafin.get(nextchar); // eat away the following \t
+  if (!MAF_read_sequencing_vector.empty()) {
+    newread.setSeqvecName(MAF_read_sequencing_vector);
   }
-  getline(mafin,MAF_tmp_str);
-
-  static const boost::char_separator<char> sep("\t", "", boost::keep_empty_tokens);
-  boost::tokenizer<boost::char_separator<char>> tok(MAF_tmp_str,sep);
 
-  auto tokI=tok.begin();
-
-  if(tokI==tok.end()){
-    MIRANOTIFY(Notify::FATAL, "Error in " << MAF_read_name << " for " << acttoken << "\t" << MAF_tmp_str << "\nExpected at between 4 and 7 tab delimited values, but found none");
-  }
-
-
-  if(AnnotationMappings::isMIRAEntry(*tokI)){
-    targettag.setIdentifierStr(*tokI);
-  }else{
-    const string * soident=&AnnotationMappings::translateGAP4feat2SOfeat(*tokI);
-    if(soident->empty()){
-      soident=&AnnotationMappings::translateXGAP4feat2SOfeat(*tokI);
-    }
-    if(soident->empty()){
-      targettag.setIdentifierStr(*tokI);
-    }else{
-      targettag.setIdentifierStr(*soident);
-    }
-  }
-
-  if(++tokI==tok.end()){
-    MIRANOTIFY(Notify::FATAL, "Error in " << MAF_read_name << " for " << acttoken << "\t" << MAF_tmp_str << "\nExpected at between 4 and 7 tab delimited values, but found one");
+  if (!MAF_read_template.empty()) {
+    newread.setTemplate(MAF_read_template);
   }
-  targettag.from=atoi(tokI->c_str());
-  if(++tokI==tok.end()){
-    MIRANOTIFY(Notify::FATAL, "Error in " << MAF_read_name << " for " << acttoken << "\t" << MAF_tmp_str << "\nExpected at between 4 and 7 tab delimited values, but found two");
+  
+  if (!MAF_read_base_caller.empty()) {
+    newread.setBasecaller(MAF_read_base_caller);
   }
-  targettag.to=atoi(tokI->c_str());
 
-  if(targettag.from<1){
-    MIRANOTIFY(Notify::FATAL, "Error in " << MAF_read_name << " in targettag line " << acttoken << ": (" << targettag.from << " " << targettag.to << ") -> " << targettag.from << " is <1, not allowed.");
-  }
-  if(targettag.to<1){
-    MIRANOTIFY(Notify::FATAL, "Error in " << MAF_read_name << " in targettag line " << acttoken << ": (" << targettag.from << " " << targettag.to << ") -> " << targettag.to << " is <1, not allowed.");
+  if (!MAF_read_strain.empty()) {
+    newread.setStrain(MAF_read_strain);
   }
 
-  targettag.from-=1;
-  targettag.to-=1;
-
-  if(++tokI==tok.end()){
-    MIRANOTIFY(Notify::FATAL, "Error in " << MAF_read_name << " for " << acttoken << "\t" << MAF_tmp_str << "\nExpected at between 4 and 7 tab delimited values, but found three");
+  if (!MAF_read_machinetype.empty()) {
+    newread.setMachineType(MAF_read_machinetype);
   }
-  if(tokI->empty()){
-    MIRANOTIFY(Notify::FATAL, "Error in " << MAF_read_name << " in targettag line " << acttoken << ": the entry for the strand is empty, not allowed.");
-  }
-
-  targettag.setStrand(tokI->front());
-
-  if(++tokI!=tok.end()){
-    targettag.setSourceStr(*tokI);
-
-    if(++tokI!=tok.end()){
-      if(!tokI->empty()){
-	switch(tokI->front()){
-	case '.':{
-	  targettag.phase=3;
-	  break;
-	}
-	case '1':{
-	  targettag.phase=2;
-	  break;
-	}
-	case '2':{
-	  targettag.phase=1;
-	  break;
-	}
-	case '3':{
-	  targettag.phase=0;
-	  break;
-	}
-	default : {
-	  MIRANOTIFY(Notify::FATAL, "Error in " << MAF_read_name << " in targettag line " << acttoken << "\t" << MAF_tmp_str << "\nthe entry for the strand (" << *tokI << ") is not 1, 2, 3 or .");
-	}
-	}
-      }
 
-      if(++tokI!=tok.end()){
-	targettag.setCommentStr(*tokI);
-      }
-      // hmmm, cannot really check whether ++tokI is end now, tokenizer throws :-(
-    }
-  }
+  newread.setBackbone(MAF_read_isbackbone);
+  newread.setRail(MAF_read_israil);
+  newread.setCoverageEquivalentRead(MAF_read_isCER);
 
-  FUNCEND();
+  newread.setSequencingType(MAF_read_seqtype);
 }
 
-*/
diff --git a/src/mira/maf_parse.H b/src/mira/maf_parse.H
index a947687..cf50f9a 100644
--- a/src/mira/maf_parse.H
+++ b/src/mira/maf_parse.H
@@ -24,58 +24,57 @@
  */
 
 
+// 	$Id$	
+
+
+
 #ifndef _maf_parse_h
 #define _maf_parse_h
 
 
 #include <string>
-#include <list>
-#include <vector>
-#include <fstream>
 
-#include "util/progressindic.H"
+#include "stdinc/stlincludes.H"
 
+#include "mira/read.H"
+#include "mira/readpool.H"
 #include "mira/contig.H"
 
 
+
 class MAFParse
 {
   // Variables
 private:
-  std::vector<MIRAParameters> *   MAF_miraparams;   // parameters for the contigs
+  vector<MIRAParameters> *   MAF_miraparams;   // parameters for the contigs
 
   // Result Variables
   ReadPool*         MAF_readpool;         // where to store the reads
-  std::list<Contig>*     MAF_contiglist;      //
-  void (*MAF_ccallbackfunc)(std::list<Contig> &, ReadPool &);
-  void (*MAF_rcallbackfunc)(ReadPool &);
+  list<Contig>*     MAF_contiglist;      // 
+  void (*MAF_callbackfunc)(list<Contig> &, ReadPool &);
 
-  std::ifstream MAF_fin;
-  std::string MAF_filename;
-  std::string MAF_acttoken;
-  std::string MAF_actline;
-  uint64 MAF_linenumber;
-  ProgressIndicator<int64> * MAF_piptr;
 
-  std::vector<uint32> MAF_lrperseqtype;  // longest read per seqtype
+  vector<uint32> MAF_lrperseqtype;  // longest read per seqtype
 
+  bool  MAF_simulateloading;
   bool  MAF_recalcconsensus;
 
   int32 MAF_vmajor;
   int32 MAF_vminor;
 
-  ReadGroupLib::ReadGroupID MAF_readgroup_rgid;  // rgid of current readgroup
-  std::vector<ReadGroupLib::ReadGroupID> MAF_readgroup_externalidmapper;
+  string MAF_read_name;
+  string MAF_read_scf_file;
+  string MAF_read_template;
+  string MAF_read_base_caller;
+  string MAF_read_sequencing_vector;
 
-  std::string MAF_read_name;
-  ReadGroupLib::ReadGroupID MAF_read_rgid;  // rgid of current read
-  std::string MAF_read_scf_file;
-  std::string MAF_read_template;
+  string MAF_read_strain;
+  string MAF_read_machinetype;
 
-  std::vector<char>  MAF_read_sequence;
-  std::vector<base_quality_t> MAF_read_qualities;
-  std::vector<int32> MAF_read_align_origin;
-  std::vector<multitag_t> MAF_read_taglist;
+  vector<char>  MAF_read_sequence;
+  vector<base_quality_t> MAF_read_qualities;
+  vector<int32> MAF_read_align_origin;
+  vector<tag_t> MAF_read_taglist;
 
   int32 MAF_read_len;
 
@@ -88,14 +87,6 @@ private:
   int32 MAF_read_sl;
   int32 MAF_read_sr;
 
-  uint8 MAF_read_tsegment_given;
-
-  ///////////////////// V1 ///////////////////////////
-  std::string MAF_read_base_caller;
-  std::string MAF_read_sequencing_vector;
-  std::string MAF_read_strain;
-  std::string MAF_read_machinetype;
-
   char  MAF_read_strand_given;
   int8  MAF_read_seqtype;
 
@@ -103,135 +94,98 @@ private:
   bool  MAF_read_israil;
   bool  MAF_read_isCER;
 
-  bool  MAF_read_seenATline;
-  ////////////////////////////////////////////////////
-
 
 
-  std::list<Contig::contig_init_read_t> MAF_contig_assembledfrom;
-  std::vector<char>  MAF_contig_sequence;
-  std::vector<base_quality_t> MAF_contig_qualities;
-  std::vector<multitag_t> MAF_contig_taglist;
+  list<Contig::contig_init_read_t> MAF_contig_assembledfrom;
+  vector<char>  MAF_contig_sequence;
+  vector<base_quality_t> MAF_contig_qualities;
+  vector<tag_t> MAF_contig_taglist;
 
-  std::string MAF_contig_name;
+  string MAF_contig_name;
 
   int32  MAF_contig_numreads;
   int32  MAF_contig_len;      // read in from LC
+  int32  MAF_contig_rawlen; // deduced from AT lines
 
 
 
   bool   MAF_isinread;
   bool   MAF_isincontig;
-  bool   MAF_isinreadgroup;
-  bool   MAF_haserror;
 
   int32  MAF_readpoolid;
 
-
-  // temp std::string to avoid creating throwaway local std::strings
-  std::string MAF_tmp_str;
-  // temporary vector of std::string to avoid creating throwaway std::vector<std::strings>
-  std::vector<std::string> MAF_tmp_strv;
-
 private:
-  void deescapeString(std::string & s);
+  void deescapeString(string & s);
 
-  void countElements(const std::string & fileName, size_t & numreads, size_t & numcontigs);
+  size_t countReadsBeforeLoad(const string & fileName, size_t & maxlinelen); 
 
 
   void cleanupHeaderData();
   void cleanupReadData();
   void cleanupContigData();
 
-  void checkParseIsInReadGroup(std::string & acttoken);
-  void checkParseIsNotInReadGroup(std::string & acttoken);
-  void checkParseIsInRead(std::string & acttoken);
-  void checkParseIsNotInRead(std::string & acttoken);
-  void checkParseIsInContig(std::string & acttoken);
-
-  void parseLineHeaderVersion(std::string & acttoken, std::string & actline);
-  void parseLineHeaderReadGroup(std::string & acttoken, uint64 & linenumber);
-
-  void parseLineAQ(std::string & acttoken, std::string & actline);
-  void parseLineRG(std::string & acttoken, std::string & actline);
-  void parseLineRS(std::string & acttoken, std::string & actline);
-  void parseLineRQ(std::string & acttoken, std::string & actline);
-  void parseLineCS(std::string & acttoken, std::string & actline);
-  void parseLineCQ(std::string & acttoken, std::string & actline);
-  void parseLineRD(std::string & acttoken, std::string & actline);
-  void parseLineLR(std::string & acttoken, std::string & actline);
-  void parseLineSV(std::string & acttoken, std::string & actline);
-  void parseLineTN(std::string & acttoken, std::string & actline);
-  void parseLineDI(std::string & acttoken, std::string & actline);
-  void parseLineTF(std::string & acttoken, std::string & actline);
-  void parseLineTT(std::string & acttoken, std::string & actline);
-  void parseLineTS(std::string & acttoken, std::string & actline);
-  void parseLineSF(std::string & acttoken, std::string & actline);
-  void parseLineBC(std::string & acttoken, std::string & actline);
-  void parseLineSL(std::string & acttoken, std::string & actline);
-  void parseLineSR(std::string & acttoken, std::string & actline);
-  void parseLineQL(std::string & acttoken, std::string & actline);
-  void parseLineQR(std::string & acttoken, std::string & actline);
-  void parseLineCL(std::string & acttoken, std::string & actline);
-  void parseLineCR(std::string & acttoken, std::string & actline);
-  void parseLineAO(std::string & acttoken, std::string & actline);
-  void parseLineRT(std::string & acttoken, std::string & actline);
-  void parseLineST(std::string & acttoken, std::string & actline);
-  void parseLineSN(std::string & acttoken, std::string & actline);
-  void parseLineMT(std::string & acttoken, std::string & actline);
-  void parseLineIB(std::string & acttoken, std::string & actline);
-  void parseLineIC(std::string & acttoken, std::string & actline);
-  void parseLineIR(std::string & acttoken, std::string & actline);
-  void parseLineAT(std::string & acttoken, std::string & actline);
-  void parseLineER(std::string & acttoken, std::string & actline);
-  void parseLineCO(std::string & acttoken, std::string & actline);
-  void parseLineNR(std::string & acttoken, std::string & actline);
-  void parseLineLC(std::string & acttoken, std::string & actline);
-  void parseLineCT(std::string & acttoken, std::string & actline);
-  void parseLineEC(std::string & acttoken, std::string & actline);
-
-  void parseTagData(std::string & acttoken, multitag_t & tag);
-  void parseTagDataV2(std::string & acttoken, multitag_t & tag);
+  void checkParseIsInRead(string & acttoken);
+  void checkParseIsNotInRead(string & acttoken);
+  void checkParseIsInContig(string & acttoken);
+
+  void parseLineFV(ifstream & mafin, string & acttoken, string & actline);
+  void parseLineAQ(ifstream & mafin, string & acttoken, string & actline);
+  void parseLineRS(ifstream & mafin, string & acttoken, string & actline);
+  void parseLineRQ(ifstream & mafin, string & acttoken, string & actline);
+  void parseLineCS(ifstream & mafin, string & acttoken, string & actline);
+  void parseLineCQ(ifstream & mafin, string & acttoken, string & actline);
+  void parseLineRD(ifstream & mafin, string & acttoken, string & actline);
+  void parseLineLR(ifstream & mafin, string & acttoken, string & actline);
+  void parseLineSV(ifstream & mafin, string & acttoken, string & actline);
+  void parseLineTN(ifstream & mafin, string & acttoken, string & actline);
+  void parseLineDI(ifstream & mafin, string & acttoken, string & actline);
+  void parseLineTF(ifstream & mafin, string & acttoken, string & actline);
+  void parseLineTT(ifstream & mafin, string & acttoken, string & actline);
+  void parseLineSF(ifstream & mafin, string & acttoken, string & actline);
+  void parseLineBC(ifstream & mafin, string & acttoken, string & actline);
+  void parseLineSL(ifstream & mafin, string & acttoken, string & actline);
+  void parseLineSR(ifstream & mafin, string & acttoken, string & actline);
+  void parseLineQL(ifstream & mafin, string & acttoken, string & actline);
+  void parseLineQR(ifstream & mafin, string & acttoken, string & actline);
+  void parseLineCL(ifstream & mafin, string & acttoken, string & actline);
+  void parseLineCR(ifstream & mafin, string & acttoken, string & actline);
+  void parseLineAO(ifstream & mafin, string & acttoken, string & actline);
+  void parseLineRT(ifstream & mafin, string & acttoken, string & actline);
+  void parseLineST(ifstream & mafin, string & acttoken, string & actline);
+  void parseLineSN(ifstream & mafin, string & acttoken, string & actline);
+  void parseLineMT(ifstream & mafin, string & acttoken, string & actline);
+  void parseLineIB(ifstream & mafin, string & acttoken, string & actline);
+  void parseLineIC(ifstream & mafin, string & acttoken, string & actline);
+  void parseLineIR(ifstream & mafin, string & acttoken, string & actline);
+  void parseLineAT(ifstream & mafin, string & acttoken, string & actline);
+  void parseLineER(ifstream & mafin, string & acttoken, string & actline);
+  void parseLineCO(ifstream & mafin, string & acttoken, string & actline);
+  void parseLineNR(ifstream & mafin, string & acttoken, string & actline);
+  void parseLineLC(ifstream & mafin, string & acttoken, string & actline);
+  void parseLineCT(ifstream & mafin, string & acttoken, string & actline);
+  void parseLineEC(ifstream & mafin, string & acttoken, string & actline);
+
+  void parseTagData(ifstream & mafin, string & acttoken, tag_t & tag);
 
   void checkReadData();
   void addReadToReadPool();
 
 public:
-  MAFParse(ReadPool * rpool,
-	   std::list<Contig>  * clist,
-	   std::vector<MIRAParameters> * mp);
+  MAFParse(ReadPool &aPool, 
+      list<Contig>  &theContigs, 
+      vector<MIRAParameters> * mp);
   ~MAFParse();
 
-  MAFParse(MAFParse const &other) = delete;
-  MAFParse const & operator=(MAFParse const & other) = delete;
-
-
-  void reset();
-
-  size_t load(const std::string & fileName,
+  size_t load(const string & fileName,
 	      const uint8 seqtype,
 	      const uint8 loadaction,
-	      std::vector<uint32> & lrperseqtype,
+	      vector<uint32> & lrperseqtype,
 	      bool recalcconsensus = true,
-	      void (*ccallback)(std::list<Contig> &, ReadPool &) = nullptr, // callback after each contig loaded
-	      void (*rcallback)(ReadPool &) = nullptr, // callback after each read loaded
+	      void (*callback)(list<Contig> &, ReadPool &) = NULL, // callback after each contig loaded
 	      bool isVerbose = false);
 
-  void registerFile(const std::string & fileName);
-  uint64 loadNextSeqs(uint64 numseqstoload,uint64 numconsstoload);
-  void checkCorrectFileEnd();
-  void setNewContainers(ReadPool * rpool,
-			std::list<Contig>  * clist,
-			std::vector<MIRAParameters> * mp);
-  bool checkIfEOF() {return (MAF_fin.is_open() && MAF_fin.eof());}
-  void setProgressIndicator(bool b);
-
-  friend std::ostream &operator<<(std::ostream &ostr, MAFParse const &i);
-
-  static void parseReadGroup(std::ifstream & mafin,
-			     ReadGroupLib::ReadGroupID & rgid,
-			     std::vector<ReadGroupLib::ReadGroupID> & externalidmapper,
-			     uint64 & linenumber);
+  friend ostream &operator<<(ostream &ostr, MAFParse const &i);
+
 };
 
 
diff --git a/src/mira/manifest.C b/src/mira/manifest.C
deleted file mode 100644
index 4d55a9f..0000000
--- a/src/mira/manifest.C
+++ /dev/null
@@ -1,590 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 2003 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-#include <fstream>
-
-#include <boost/algorithm/string.hpp>
-#include <boost/tokenizer.hpp>
-#include <boost/regex.hpp>
-
-#include "util/fileanddisk.H"
-#include "mira/enums.H"
-#include "mira/manifest.H"
-
-
-using namespace std;
-
-
-#define CEBUG(bla)
-
-
-// Plain vanilla constructor
-Manifest::Manifest()
-{
-  FUNCSTART("Manifest::Manifest()");
-
-  init();
-
-  FUNCEND();
-}
-
-void Manifest::zeroVars()
-{
-  FUNCSTART("void Manifest::zeroVars()");
-  FUNCEND();
-}
-
-void Manifest::init()
-{
-  FUNCSTART("void Manifest::init()");
-
-  MAN_seentechnology.clear();
-  MAN_seentechnology.resize(ReadGroupLib::getNumSequencingTypes(),false);
-
-  FUNCEND();
-}
-
-
-
-Manifest::~Manifest()
-{
-  FUNCSTART("Manifest::~Manifest()");
-
-  FUNCEND();
-}
-
-
-void Manifest::discard()
-{
-  FUNCSTART("Manifest::discard()");
-
-  zeroVars();
-
-  FUNCEND();
-}
-
-
-
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-/*
-readgroup = Bla0
-file fastq = x1.fastq x2.fastq ...
-file xml = x1.xml ...
-technology = sanger 454 illumina iontorrent pacbio lq|hq
-templatesize = 340 780
-templateordering = >< <> >> strictordering
-templatenaming = solexa fr
-strainname = xxxyyyzzz
-
-include = manifestfile
-
-// TODO: fastq33 fastq...
-
-*/
-
-
-//#define CEBUG(bla)   {cout << bla; cout.flush(); }
-void Manifest::loadManifestFile(const string & mfilename, bool resume)
-{
-  FUNCSTART("void Manifest::loadManifestFile(string & mfilename)");
-
-  ifstream mfin(mfilename.c_str());
-
-  if(!mfin.good()) {
-    cout << "Did not find manifest file " << mfilename << endl;
-    exit(10);
-    return;
-  }
-
-  std::stringstream buffer;
-  buffer << mfin.rdbuf();
-  mfin.close();
-
-  slurpInManifest(buffer,mfilename,resume);
-
-  //cout << "Readgroups after loading manifest:\n";
-  //ReadGroupLib::debugDumpReadGroupInfo(cout);
-
-  if(!resume){
-    cout << "Looking for files named in data ..."; cout.flush();
-    if(provideFileNames()){
-      MIRANOTIFY(Notify::FATAL,"Some 'data' entries named in the manifest file could not be verified, see the log above.\nMaybe some files are missing, not readable or there is a typo in the manifest file?");
-    }
-  }
-
-  FUNCEND();
-}
-
-void Manifest::slurpInManifest(stringstream & mfin, const string & origsource, bool resume)
-{
-  FUNCSTART("void Manifest::slurpInManifest(stringstream & mfin, const string & origsource, bool resume))");
-
-  boost::char_separator<char> separator(" \t");
-
-  string::size_type valuestart=string::npos;
-
-  string lastkeyok;
-  string key;
-  string value;
-
-  string tmpline;
-  string actline;
-  bool foundreadgroup=false;
-  uint32 numbackslashes=0;
-  while(getline(mfin,tmpline)){
-    boost::trim(tmpline);
-    if(tmpline.empty()
-       || tmpline[0]=='#') continue;
-
-    actline=tmpline;
-
-    while(!actline.empty() && actline[actline.size()-1]=='\\'){
-      ++numbackslashes;
-      actline.resize(actline.size()-1);
-      tmpline.clear();
-      if(getline(mfin,tmpline)){
-	boost::trim(tmpline);
-	actline+=' ';
-	actline+=tmpline;
-      }
-    }
-
-    valuestart=actline.find_first_of('=',0);
-    //if(valuestart==string::npos){
-    //  MIRANOTIFY(Notify::FATAL, "In file " << origsource << ": line\n" << actline << "\nhas no equal sign?");
-    //}
-
-    lastkeyok.swap(key);
-    key=actline.substr(0, valuestart);
-    boost::trim(key);
-    if(valuestart!=string::npos){
-      value=actline.substr(valuestart+1);
-      boost::trim(value);
-    }else{
-      value.clear();
-    }
-
-    CEBUG("k: " << key << endl);
-    CEBUG("v: " << value << endl);
-
-    boost::to_lower(key);
-
-    if(key=="include"){
-      loadManifestFile(value,resume);
-    }else if(key=="projectname"
-	     || key=="project_name"
-	     || key=="project"){
-      if(!MAN_projectname.empty()){
-	MIRANOTIFY(Notify::FATAL, "In file " << origsource << ": line\n" << actline << "\nFound keyword 'projectname', but there already has been a job defined previously ('" << MAN_projectname << "')");
-      }
-      MAN_projectname=value;
-    }else if(key=="job"){
-      if(!MAN_job.empty()){
-	MIRANOTIFY(Notify::FATAL, "In file " << origsource << ": line\n" << actline << "\nFound keyword 'job', but there already has been a job defined previously ('" << MAN_job << "')");
-      }
-      MAN_job=value;
-    }else if(key=="parameters"){
-      if(!MAN_parameters.empty()) MAN_parameters+=' ';
-      MAN_parameters+=value;
-    }else if(key=="readgroup"
-	     || key=="read_group"){
-      if(foundreadgroup){
-	// some defaults and checks for previous readgroup
-	MAN_manifestdata2load.back().rgid.fillInSensibleDefaults();
-	MAN_manifestdata2load.back().rgid.checkValidity();
-      }
-      foundreadgroup=true;
-      MAN_manifestdata2load.resize(MAN_manifestdata2load.size()+1);
-      MAN_manifestdata2load.back().rgid=ReadGroupLib::newReadGroup();
-      MAN_manifestdata2load.back().rgid.setGroupName(value);
-      MAN_manifestdata2load.back().loadasbackbone=false;
-    }else{
-      if(!foundreadgroup){
-	if(lastkeyok=="parameters"){
-	  if(numbackslashes==0){
-	    MIRANOTIFY(Notify::FATAL, "In file " << origsource << ": line\n" << actline << "\nhas keyword '" << key << "' which is not recognised.\nThe last recognised keyword was 'parameters', no continuation line was seen. Is this a continuation line and did you eventually forget the backslash in the line above?");
-	  }else{
-	    MIRANOTIFY(Notify::FATAL, "In file " << origsource << ": line\n" << actline << "\nhas keyword '" << key << "' which is not recognised.\nThe last recognised keyword was 'parameters' and there were continuation lines with backslashes. Did you eventually erroneously put a backslash in the last continuation line above?");
-	  }
-	}else{
-	  MIRANOTIFY(Notify::FATAL, "In file " << origsource << ": line\n" << actline << "\nExpected keyword 'readgroup' not found. Maybe you mistyped '" << key << "' and meant something else?\nAccepted keywords at this stage are 'include', 'project', 'job', 'parameters' and 'readgroup'.");
-	}
-      }
-
-      if(key=="as_reference"
-	 || key=="is_reference"){
-	MAN_manifestdata2load.back().loadasbackbone=true;
-	MAN_manifestdata2load.back().rgid.setBackbone(true);
-      }else if(key=="autopairing"
-	       || key=="autopair"
-	       || key=="autotemplate"){
-	MAN_manifestdata2load.back().rgid.setInsizeFrom(-1);
-	MAN_manifestdata2load.back().rgid.setInsizeTo(-1);
-	MAN_manifestdata2load.back().rgid.setWantTemplateSizeEstimate(true);
-	MAN_manifestdata2load.back().rgid.setWantSegmentPlacementEstimate(true);
-	MAN_manifestdata2load.back().rgid.setExpectsReadPairs(true);
-      }else if(key=="nostats"
-	       || key=="nostatistics"){
-	MAN_manifestdata2load.back().rgid.setStatisticsCalc(false);
-      }else if(key=="technology"){
-	try{
-	  MAN_manifestdata2load.back().rgid.setSequencingType(value);
-	}
-	catch(Notify n){
-	  MIRANOTIFY(Notify::FATAL,"In file " << origsource << ": line\n" << actline << "\nUnknown technology '" << value << "' found. Did you make a typo?");
-	}
-	if(MAN_manifestdata2load.back().rgid.getSequencingType()==ReadGroupLib::SEQTYPE_PACBIOLQ){
-	  //MIRANOTIFY(Notify::FATAL,"Sorry, PacBio low quality data currently not supported.\n");
-	}
-      }else if(key=="defaultqual"
-	       || key=="default_qual"){
-	int64 dq=atoll(value.c_str());
-	if(dq<0 || dq>100){
-	  MIRANOTIFY(Notify::FATAL,  "In file " << origsource << ": line\n" << actline << "\nKeyword '" << key << "' values 0 <= x <= 100, found " << dq);
-	}
-	MAN_manifestdata2load.back().rgid.setDefaultQual(static_cast<base_quality_t>(dq));
-      }else if(key=="templatesize"
-	       || key=="template_size"){
-	boost::tokenizer<boost::char_separator<char> > tok(value,separator);
-	boost::tokenizer<boost::char_separator<char> >::iterator tI=tok.begin();
-	if(tI==tok.end()){
-	  MIRANOTIFY(Notify::FATAL,  "In file " << origsource << ": line\n" << actline << "\nKeyword '" << key << "' expects two or three values, found none.");
-	}
-	int32 dummy=atoi(tI->c_str());
-	MAN_manifestdata2load.back().rgid.setInsizeFrom(dummy);
-	MAN_manifestdata2load.back().rgid.setWantTemplateSizeEstimate(false);
-	MAN_manifestdata2load.back().rgid.setExpectsReadPairs(true);
-	++tI;
-	if(tI==tok.end()){
-	  MIRANOTIFY(Notify::FATAL,  "In file " << origsource << ": line\n" << actline << "\nKeyword '" << key << "' expects exactly two or three values, found only one.");
-	}
-	dummy=atoi(tI->c_str());
-	MAN_manifestdata2load.back().rgid.setInsizeTo(dummy);
-	bool foundautorefine=false;
-	while(++tI!=tok.end()){
-	  // oops, 3 or 4 values
-	  string tmpiostring(*tI);
-	  boost::to_lower(tmpiostring);
-	  if(tmpiostring=="infoonly" || tmpiostring=="exclusion_criterion"
-	    || tmpiostring=="autorefine"){
-	    MAN_manifestdata2load.back().ts_infoonlygiven=true;
-	    if(tmpiostring=="autorefine"){
-	      foundautorefine=true;
-	    }else if(tmpiostring=="infoonly"){
-	      MAN_manifestdata2load.back().rgid.setTSInfoOnly(true);
-	    }else{
-	      MAN_manifestdata2load.back().rgid.setTSInfoOnly(false);
-	    }
-	  }else{
-	    MIRANOTIFY(Notify::FATAL,  "In file " << origsource << ": line\n" << actline << "\nKeyword '" << key << "' expects exactly 'infoonly', 'exclusion_criterion' or 'autorefine' as third or fourth value, found '" << tmpiostring << "'");
-	  }
-	}
-	if(foundautorefine){
-	  MAN_manifestdata2load.back().rgid.setWantTemplateSizeEstimate(true);
-	}
-      }else if(key=="prefix_rename"
-	       || key=="rename_prefix"){
-	boost::tokenizer<boost::char_separator<char> > tok(value,separator);
-	boost::tokenizer<boost::char_separator<char> >::iterator tI=tok.begin();
-	if(tI==tok.end()){
-	  MIRANOTIFY(Notify::FATAL,  "In file " << origsource << ": line\n" << actline << "\nKeyword '" << key << "' expects two values, found none.");
-	}
-	auto prefix=*tI;
-	++tI;
-	if(tI==tok.end()){
-	  MIRANOTIFY(Notify::FATAL,  "In file " << origsource << ": line\n" << actline << "\nKeyword '" << key << "' expects exactly two values, found only one.");
-	}
-	MAN_manifestdata2load.back().rgid.addReadRenamePrefix(prefix,*tI);
-      }else if(key=="segmentplacement"
-	       || key=="segment_placement"){
-	// handle "infoonly"/"exclusion_criterion" by parsing it out
-	static boost::regex iostr( "infoonly" ) ;
-	static boost::regex ecstr( "exclusion_criterion" ) ;
-	static boost::regex arstr( "autorefine" ) ;
-	static string iostrrep; // empty
-	auto newval = boost::regex_replace(value, iostr, iostrrep);
-	if(newval!=value){
-	  MAN_manifestdata2load.back().rgid.setSPInfoOnly(true);
-	  MAN_manifestdata2load.back().sp_infoonlygiven=true;
-	  swap(value,newval); // we just want value=newval
-	}else{
-	  newval = boost::regex_replace(value, ecstr, iostrrep);
-	  if(newval!=value){
-	    MAN_manifestdata2load.back().rgid.setSPInfoOnly(false);
-	    MAN_manifestdata2load.back().sp_infoonlygiven=true;
-	    swap(value,newval); // we just want value=newval
-	  }
-	}
-
-	MAN_manifestdata2load.back().rgid.setWantSegmentPlacementEstimate(false);
-	MAN_manifestdata2load.back().rgid.setExpectsReadPairs(true);
-	newval = boost::regex_replace(value, arstr, iostrrep);
-	if(newval!=value){
-	  MAN_manifestdata2load.back().rgid.setWantSegmentPlacementEstimate(true);
-	  swap(value,newval); // we just want value=newval
-	}
-
-	if(!MAN_manifestdata2load.back().rgid.setSegmentPlacement(value)){
-	  MIRANOTIFY(Notify::FATAL,  "In file " << origsource << ": line\n" << actline << "\nUnrecognised value '" << value << "' for key '" << key << "'");
-	}
-	if(MAN_manifestdata2load.back().rgid.getSegmentPlacementCode()!=ReadGroupLib::SPLACE_UNKNOWN
-	   && MAN_manifestdata2load.back().rgid.getSegmentPlacementCode()!=ReadGroupLib::SPLACE_SU
-	   && MAN_manifestdata2load.back().rgid.wantSegmentPlacementEstimate()){
-	  MIRANOTIFY(Notify::FATAL,  "In file " << origsource << ": line\n" << actline << "\nUsing 'autorefine' for segment_placement other than 'unknown' or 'samedir' does not make much sense. Please fix your manifest file.");
-	}
-      }else if(key=="segmentnaming"
-	       || key=="segment_naming"){
-	static boost::regex csstr( "rollcomment" ) ;
-	static string repstr; // empty
-	auto newval = boost::regex_replace(value, csstr, repstr);
-	if(newval!=value){
-	  MAN_manifestdata2load.back().rgid.setUseReadNameFromComment(true);
-	  swap(value,newval); // we just want value=newval
-	  boost::trim(value);
-	}
-	if(!MAN_manifestdata2load.back().rgid.setSegmentNaming(value)){
-	  MIRANOTIFY(Notify::FATAL,  "In file " << origsource << ": line\n" << actline << "\nUnrecognised value '" << value << "' for key '" << key << "'");
-	}
-      }else if(key=="strainname"
-	       || key=="strain_name"
-	       || key=="strain"){
-	boost::trim(value);
-	MAN_manifestdata2load.back().rgid.setStrainName(value);
-      }else if(key=="datadir_scf"){
-	boost::trim(value);
-	MAN_manifestdata2load.back().rgid.setDataDir(value);
-      }else if(key.substr(0,4)=="data"){
-	boost::tokenizer<boost::char_separator<char> > tok(value,separator);
-	boost::tokenizer<boost::char_separator<char> >::iterator tI=tok.begin();
-	for(; tI!= tok.end(); ++tI){
-	  MAN_manifestdata2load.back().datanames.push_back(*tI);
-	}
-      }else{
-	MIRANOTIFY(Notify::FATAL, "In file " << origsource << ": line\n" << actline << "\nhas keyword '" << key << "' which is not recognised.");
-      }
-    }
-  }
-
-  if(foundreadgroup){
-    // check last defined read group for validity
-    MAN_manifestdata2load.back().rgid.fillInSensibleDefaults();
-    MAN_manifestdata2load.back().rgid.checkValidity();
-  }
-
-  // quick consistency checks
-  vector<manifestloadentry_t>::iterator mI=MAN_manifestdata2load.begin();
-  bool seenbb=false;
-  bool seennotbb=false;
-  for(; mI!=MAN_manifestdata2load.end(); ++mI){
-
-    // check for presence of filenames
-    if(mI->datanames.empty()){
-      MIRANOTIFY(Notify::FATAL,"Oooops, the readgroup '" << mI->rgid.getGroupName() << "' has no data defined for loading? Check your manifest.");
-    }
-
-    // check for setting of sequencing tech
-    if(mI->rgid.getSequencingType()==ReadGroupLib::SEQTYPE_END){
-      if(mI->loadasbackbone) {
-	// backbones do not need technolgies (but user can choose so)
-	// by default, they're TEXT
-	mI->rgid.setSequencingType(ReadGroupLib::SEQTYPE_TEXT);
-      }else{
-	cout << "Oooops, the readgroup '" << mI->rgid.getGroupName() << "' has no sequencing technology defined.\n"
-	     << "Files in this readgroup:";
-	for(const auto & fn : mI->datanames){
-	  cout << " " << fn;
-	}
-	cout << endl;
-	MIRANOTIFY(Notify::FATAL,"Error in defining readgroups: missing technology setting. See output above for more info.");
-      }
-    }
-
-    // put together technology string
-    if(!mI->loadasbackbone){
-      seennotbb=true;
-      uint8 st=mI->rgid.getSequencingType();
-      if(!MAN_seentechnology[st]){
-	MAN_seentechnology[st]=true;
-	if(!MAN_technologystring.empty()) MAN_technologystring+=',';
-	MAN_technologystring+=ReadGroupLib::getNameOfSequencingType(st);
-      }
-    }else{
-      seenbb=true;
-    }
-  }
-
-  if(!seennotbb){
-    if(seenbb){
-      MIRANOTIFY(Notify::FATAL,"Error in defining readgroups: there is no readgroup which is not defined as reference/backbone. Basically this says that while you defined a reference, you did not define what data should map to it.");
-    }else{
-      MIRANOTIFY(Notify::FATAL,"Error in defining readgroups: there is no readgroup defined containing data to load? What should MIRA assemble???");
-    }
-  }
-
-  // handle missing "infoonly" for non-backbone readgroups in mapping assemblies:
-  // set default "infoonly"
-  if(seenbb){
-    mI=MAN_manifestdata2load.begin();
-    for(; mI!=MAN_manifestdata2load.end(); ++mI){
-      if(!mI->loadasbackbone){
-	if((mI->rgid.getInsizeFrom()>=0 || mI->rgid.getInsizeTo()>=0)
-	   && !mI->ts_infoonlygiven) {
-	  cout << "For mapping assembly: readgroup " << mI->rgid.getLibId() << " named '" << mI->rgid.getGroupName() << "' has no 'infoonly' or 'exclusion_criterion' set for 'template_segment',\nassuming 'infoonly'.\n";
-	  mI->rgid.setTSInfoOnly(true);
-	}
-	if(mI->rgid.getSegmentPlacementCode()!=ReadGroupLib::SPLACE_UNKNOWN
-	   && !mI->sp_infoonlygiven) {
-	  cout << "For mapping assembly: readgroup " << mI->rgid.getLibId() << " named '" << mI->rgid.getGroupName() << "' has no 'infoonly' or 'exclusion_criterion' set for 'segment_placement',\nassuming 'infoonly'.\n";
-	  mI->rgid.setSPInfoOnly(true);
-	}
-      }
-    }
-  }
-
-  FUNCEND();
-}
-
-
-string Manifest::getFullMIRAParameterString()
-{
-  FUNCSTART("string Manifest::getFullMIRAParameterString()");
-
-  string ret("--job=");
-
-  string::const_iterator jI=MAN_job.begin();
-  uint32 numchars=0;
-  for(; jI!=MAN_job.end(); ++jI){
-    if(!isspace(*jI)) {
-      ret.push_back(*jI);
-      ++numchars;
-    }
-  }
-
-  if(!numchars){
-    MIRANOTIFY(Notify::FATAL,"Found no job description in the manifest loaded.\nYou need to provide MIRA with information what it should do!\nE.g.: job=denovo,genome,accurate");
-  }
-
-  if(MAN_technologystring.empty()){
-    MIRANOTIFY(Notify::FATAL,"Found no technology descriptions in the manifest loaded.\nYou need to provide MIRA with information what type of data it is loading. Although somehow MIRA should have caught this earlier ...");
-  }
-
-  ret+=',';
-  ret+=MAN_technologystring;
-  ret+=' ';
-
-  ret+=MAN_parameters;
-
-  FUNCEND();
-
-  return ret;
-}
-
-
-
-ostream & operator<<(ostream &ostr, Manifest const &m)
-{
-  FUNCSTART("friend ostream & Manifest::operator<<(ostream &ostr, const  &m)");
-
-  cout << "Manifest:\nprojectname: " << m.MAN_projectname
-       << "\njob: " << m.MAN_job
-       << "\nparameters: " << m.MAN_parameters << endl;
-
-  cout << "Manifest load entries: " << m.MAN_manifestdata2load.size() << endl;
-  uint32 mlei=0;
-  for(const Manifest::manifestloadentry_t & mle : m.MAN_manifestdata2load){
-    ++mlei;
-    cout << "MLE " << mlei << ":\n";
-    cout << mle.rgid;
-    for(const auto & fn :  mle.datanames){
-      cout << fn << " ";
-    }
-  }
-  cout << endl;
-
-  FUNCEND();
-  return ostr;
-}
-
-
-
-bool Manifest::provideFileNames()
-{
-  FUNCSTART("bool Manifest::provideFileNames()");
-
-  // for delayed transformation reads to contigs
-  // needed to simplify life when loading .fna and .gff3 with annotations
-  // this gives the Readpool loader the opportunity to load the sequence,
-  //  then the annotation, map the annotation to the sequence
-  // then only make the contigs
-  //
-  // if this wasn't done, one would have to annotate both the readpool read
-  //   AND search contigs for this read and annotate that one too
-  // TODO: might be an idea for "re-annotation"
-
-  list<fnft_t> tmpgff3;
-  bool hassomeerror=false;
-  for(auto & mle : MAN_manifestdata2load){
-    mle.mainfilesfoundfordata.clear();
-    mle.ancillaryfilesfoundfordata.clear();
-
-    list<fnft_t> fnftl;
-    for(const auto & dn : mle.datanames){
-      hassomeerror|=globWalkPath(dn,fnftl);
-    }
-
-    // now fill in maindata and ancillary, leaving out GFF3 file types
-    //  then append the remaining files (well, GFF3) to the main data
-    //  this effectively splits the files into maindata and ancillary AND
-    //  shuffles GFF3 to the end of maindata
-    //  ... and keeps the order of files (not really needed, but good for
-    //  user to see his files get loaded in the order he named them, except
-    //  GFF3 that is)
-
-    auto ntI=fnftl.begin();
-    while(ntI!=fnftl.end()){
-      auto tmpI=ntI;
-      ++ntI;
-      if(tmpI->ft!="gff3"){
-	if(tmpI->ft=="xml"
-	   || tmpI->ft=="ssaha2"
-	   || tmpI->ft=="smalt"){
-	  mle.ancillaryfilesfoundfordata.splice(mle.ancillaryfilesfoundfordata.end(),fnftl,tmpI);
-	}else{
-	  mle.mainfilesfoundfordata.splice(mle.mainfilesfoundfordata.end(),fnftl,tmpI);
-	}
-      }
-    }
-    // what's left over is GFF3
-    mle.mainfilesfoundfordata.splice(mle.mainfilesfoundfordata.end(),fnftl);
-  }
-
-  return hassomeerror;
-}
diff --git a/src/mira/manifest.H b/src/mira/manifest.H
deleted file mode 100644
index 26de30a..0000000
--- a/src/mira/manifest.H
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 2003 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-#ifndef _bas_manifest_h_
-#define _bas_manifest_h_
-
-#include <iostream>
-
-#include "stdinc/defines.H"
-#include "errorhandling/errorhandling.H"
-
-#include "util/fileanddisk.H"
-#include "mira/readgrouplib.H"
-
-
-class Manifest
-{
-private:
-  //Variables
-public:
-  struct manifestloadentry_t {
-    ReadGroupLib::ReadGroupID rgid;
-    std::list<std::string> datanames;
-    bool loadasbackbone;
-    bool sp_infoonlygiven;   // whether infoonly/exclusion_criterion was given by the user
-    bool ts_infoonlygiven;   // whether infoonly/exclusion_criterion was given by the user
-
-    std::list<fnft_t> mainfilesfoundfordata;
-    std::list<fnft_t> ancillaryfilesfoundfordata;
-
-    manifestloadentry_t() : loadasbackbone(false), sp_infoonlygiven(false), ts_infoonlygiven(false) {};
-  };
-
-  std::vector<manifestloadentry_t> MAN_manifestdata2load;
-
-  //std::list<std::string> MAN_ancillary_datanames;
-  //std::list<std::string> MAN_ancillary_datatypes;
-
-
-private:
-  std::string MAN_projectname;
-  std::string MAN_job;
-  std::string MAN_parameters;
-
-  std::vector<bool> MAN_seentechnology;
-  std::string MAN_technologystring;
-
-  //Functions
-private:
-  void init();
-  void zeroVars();
-
-  void slurpInManifest(std::stringstream & mfin, const std::string & origsource, bool resume);
-
-  bool provideFileNames();
-
-public:
-  Manifest();
-  Manifest(Manifest const &other);
-  ~Manifest();
-
-  // use std copy-operator
-  //Manifest const & operator=(Manifest const & other);
-  friend std::ostream & operator<<(std::ostream &ostr, Manifest const &m);
-
-  void discard();
-
-  void loadManifestFile(const std::string & mfilename, bool resume);
-  std::string getFullMIRAParameterString();
-  const std::string & getProjectName() const {return MAN_projectname;}
-  const std::string & getJob() const {return MAN_job;}
-  const std::string & getParameters() const {return MAN_parameters;}
-  const std::string & getTechnologies() const {return MAN_technologystring;}
-
-};
-
-
-#endif
diff --git a/src/mira/multitag.C b/src/mira/multitag.C
index 866653c..79a815d 100644
--- a/src/mira/multitag.C
+++ b/src/mira/multitag.C
@@ -11,309 +11,137 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
 
-#include <io/annotationmappings.H>
+#ifndef lint
+static char vcid[] = "$Id$";
+#endif /* lint */
+
+
 #include <mira/multitag.H>
 #include <mira/read.H>
 #include <mira/contig.H>
-#include <mira/gff_parse.H>
-#include <util/misc.H>
-
-
-using namespace std;
-
-
-/*************************************************************************
- *
- * GFF3
- *
- *
- *************************************************************************/
-
-void multitag_t::dumpAsGFF3(ostream & ostr, const char * seqid) const
-{
-  FUNCSTART("void multitag_t::dumpAsGFF3(ostream & ostr, const char * seqid, const vector<uint32> & poslookup) const");
-  string gff3mnemonic(getIdentifierStr());
-  bool addmiraitag=false;
-  if(!AnnotationMappings::isValidGFF3SOEntry(gff3mnemonic)) {
-    gff3mnemonic="experimental_feature";
-    addmiraitag=true;
-  }
-  ostr << seqid;
-  if(getSourceStr().empty()){
-    ostr << "\tunknown";
-  }else{
-    ostr << '\t' << getSourceStr();
-  }
-//	     << '\t' << getIdentifierStr()
-
-  uint32 ofrom=from;
-  uint32 oto=to;
-//  if(!poslookup.empty()){
-//    BUGIFTHROW(ofrom >= poslookup.size(),"ofrom >= poslookup.size() ???");
-//    BUGIFTHROW(oto >= poslookup.size(),"oto >= poslookup.size() ???");
-//    ofrom=poslookup[ofrom];
-//    oto=poslookup[oto];
-//  }
-  char ostrand=getStrand();
-  switch(ostrand){
-  case '=' : {
-    ostrand='.';
-    break;
-  }
-  case '+' :
-  case '-' :
-  case '?' : {
-    break;
-  }
-  default : {
-    MIRANOTIFY(Notify::FATAL,"unknown strand character " << ostrand << " (" << static_cast<uint16>(ostrand) << ")");
-  }
-  }
-  ostr << '\t' << gff3mnemonic
-       << '\t' << ofrom+1
-       << '\t' << oto+1
-       << "\t."                           // TODO: get score out of comment string and store here
-       <<  "\t" << ostrand;
-  if(phase==3){
-    ostr << "\t.";
-  }else{
-    ostr << "\t" << static_cast<uint16>(phase);
-  }
-  ostr << "\t";
-  bool needsemicolon=false;
-  if(!getCommentStr().empty()){
-    if(!commentisgff3){
-      string tmpstr;
-      gff3Code(getCommentStr(),tmpstr);
-      ostr << "Note="<<tmpstr;
-      needsemicolon=true;
-    }else{
-      ostr << getCommentStr();  // TODO: without score!
-      needsemicolon=true;
-    }
-  }
-  if(addmiraitag){
-    if(needsemicolon) ostr << ";";
-    ostr << "miraitag=" << getIdentifierStr();
-    needsemicolon=true;
-  }
-  ostr << '\n';
-  FUNCEND();
-}
-
-
-/*************************************************************************
- *
- * CAF
- *
- *
- *************************************************************************/
-
-void multitag_t::dumpAsCAF(ostream & ostr) const
-{
-  string xgap4(AnnotationMappings::translateSOfeat2GAP4feat(getIdentifierStr()));
-  if(xgap4.empty()){
-    xgap4=AnnotationMappings::translateSOfeat2XGAP4feat(getIdentifierStr());
-    if(xgap4.empty()){
-      xgap4=getIdentifierStr();
-    }
-  }
-
-  if(getStrandDirection()==-1) {
-    ostr << "Tag " << xgap4 << ' ' << (to)+1 << ' ' << (from)+1;
-  }else{
-    ostr << "Tag " << xgap4 << ' ' << (from)+1 << ' ' << (to)+1;
-  }
-
-  ostr << " \"";
-  dumpCommentAsAttributes(ostr);
-  ostr << "\"\n";
-}
-
-
-void multitag_t::dumpDebug(ostream & ostr) const
-{
-  ostr << "From: " << from <<  endl;
-  ostr << "To: " << to << endl;
-  ostr << "Strand: " << getStrand() << endl;
-  ostr << "Phase: " << static_cast<uint16>(phase) << endl;
-  ostr << "Identifier: (" << static_cast<uint64>(identifier.getSCID());
-  ostr.flush();
-  ostr << ")\t" << getIdentifierStr() << endl;
-  ostr << "Comment: (" << static_cast<uint64>(comment.getSCID());
-  ostr.flush();
-  ostr << ")\t" << getCommentStr() << endl;
-  ostr << "Source: (" << static_cast<uint64>(source.getSCID());
-  ostr.flush();
-  ostr << ")\t" << getSourceStr() << endl;
-  ostr << "Comm is GFF3: " << commentisgff3 << endl;
-}
 
+StringContainer<uint8> multitag_t::MT_sc_mttagsource("multitags tagsource");
+StringContainer<uint16> multitag_t::MT_sc_mtidentifier("multitags identifier");
+StringContainer<uint32> multitag_t::MT_sc_mtcomment("multitags comment");
 
 
-void multitag_t::dumpAsMAF(ostream & ostr, const char * type) const
-{
-  ostr << type << "\t" << getIdentifierStr() << '\t' << (from)+1 << '\t' << (to)+1
-       << '\t' << getStrand()
-       << '\t' << getSourceStr();
-  if(phase==3){
-    ostr << "\t.";
-  }else{
-    ostr << '\t' << static_cast<uint16>(phase);
-  }
-
-  if(getCommentStr().empty()){
-    ostr << '\n';
-  }else{
-    if(!commentisgff3){
-      string tmpstr;
-      gff3Code(getCommentStr(),tmpstr);
-      ostr << "\tNote="<<tmpstr << '\n';
-    }else{
-      ostr << '\t' << getCommentStr() << '\n';
-    }
-  }
-}
-
-
-/*************************************************************************
- *
- * dumps as SAM contig tag line
- *
- *
- *************************************************************************/
-
-void multitag_t::dumpAsSAM(ostream & ostr, const string & contigname) const
-{
-  string xgap4(AnnotationMappings::translateSOfeat2GAP4feat(getIdentifierStr()));
-  if(xgap4.empty()){
-    xgap4=AnnotationMappings::translateSOfeat2XGAP4feat(getIdentifierStr());
-    if(xgap4.empty()){
-      xgap4=getIdentifierStr();
-    }
-  }
-  ostr << "*\t768\t" << contigname
-       << '\t' << from+1
-       << "\t255"
-       << '\t' << to+1-from << "M\t*\t0\t0\t*\t*\tCT:Z:";
-  if(getStrand()=='='){
-    ostr << '.';
-  }else{
-    ostr << getStrand();
-  }
-  ostr << ";" << xgap4
-       << ";";
-
-  if(!getCommentStr().empty()){
-    if(!commentisgff3){
-      string tmpstr;
-      gff3Code(getCommentStr(),tmpstr);
-      ostr << "Note="<<tmpstr;
-    }else{
-      ostr << getCommentStr();
-    }
-  }
-  ostr << '\n';
-}
-
-
-/*************************************************************************
- *
- * dumps as SAM read tag
- *
- * rlen>0 means to dump tags in reverse direction, the positions
- *  then being rlen-pos
- *
- *************************************************************************/
-
-void multitag_t::dumpAsSAM(ostream & ostr, int32 rlen) const
-{
-  if(rlen==0){
-    ostr << from+1 << ';' << to+1 << ';';
-  }else{
-    ostr << rlen-to << ';' << rlen-from << ';';
-  }
-
-  if(getStrand()=='='){
-    ostr << '.';
-  }else{
-    ostr << getStrand();
-  }
-  string xgap4(AnnotationMappings::translateSOfeat2GAP4feat(getIdentifierStr()));
-  if(xgap4.empty()){
-    xgap4=AnnotationMappings::translateSOfeat2XGAP4feat(getIdentifierStr());
-    if(xgap4.empty()){
-      xgap4=getIdentifierStr();
-    }
-  }
-  ostr << ";" << xgap4
-       << ";";
-
-  if(!getCommentStr().empty()){
-    if(!commentisgff3){
-      string tmpstr;
-      gff3Code(getCommentStr(),tmpstr);
-      ostr << "Note="<<tmpstr;
-    }else{
-      ostr << getCommentStr();
-    }
-  }
-}
-
-
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-void multitag_t::dumpCommentAsAttributes(ostream & ostr) const
-{
-  bool needsemicolon=false;
-  if(!getCommentStr().empty()){
-    if(!commentisgff3){
-      string tmpstr;
-      gff3Code(getCommentStr(),tmpstr);
-      ostr << "Note="<<tmpstr;
-    }else{
-      ostr << getCommentStr();
-    }
-    needsemicolon=true;
-  }
+// multitag_t::newIdentifier() and newComment() below will need initialised
+//  static entries in the multitag class. Therefore, make sure we initialised
+//   that before using newIdentifier() or newComment()
 
-  if(getStrand()!='='){
-    if(needsemicolon) ostr << ";";
-    ostr << "gff3str=" << getStrand();
-    needsemicolon=true;
-  }else if(from != to){
-    if(needsemicolon) ostr << ";";
-    ostr << "gff3str=.";
-    needsemicolon=true;
-  }
-  if(phase!=3){
-    if(needsemicolon) ostr << ";";
-    ostr << "gff3pha=" << static_cast<uint16>(phase);
-    needsemicolon=true;
-  }
-  if(!getSourceStr().empty()){
-    if(needsemicolon) ostr << ";";
-    ostr << "gff3src=" << getSourceStr();
-    needsemicolon=true;
-  }
-}
+const multitag_t::mte_src_t multitag_t::MT_tagsrcentry_idEmpty=multitag_t::newSource("");
+const multitag_t::mte_src_t multitag_t::MT_tagsrcentry_idMIRA=multitag_t::newSource("MIRA");
+const multitag_t::mte_src_t multitag_t::MT_tagsrcentry_idGenBank=multitag_t::newSource("GenBank");
+const multitag_t::mte_src_t multitag_t::MT_tagsrcentry_idGFF3=multitag_t::newSource("GFF3");
+
+
+// simplest way to avoid the static initialisation fiasco:
+//  define class variables which use this here.
+
+const multitag_t::mte_id_t Contig::CON_tagentry_idEmpty=multitag_t::newIdentifier("");
+const multitag_t::mte_id_t Contig::CON_tagentry_idALUS=multitag_t::newIdentifier("ALUS");
+const multitag_t::mte_id_t Contig::CON_tagentry_idREPT=multitag_t::newIdentifier("REPT");
+const multitag_t::mte_id_t Contig::CON_tagentry_idSRMc=multitag_t::newIdentifier("SRMc");
+const multitag_t::mte_id_t Contig::CON_tagentry_idWRMc=multitag_t::newIdentifier("WRMc");
+const multitag_t::mte_id_t Contig::CON_tagentry_idSAOc=multitag_t::newIdentifier("SAOc");
+const multitag_t::mte_id_t Contig::CON_tagentry_idSROc=multitag_t::newIdentifier("SROc");
+const multitag_t::mte_id_t Contig::CON_tagentry_idSIOc=multitag_t::newIdentifier("SIOc");
+const multitag_t::mte_id_t Contig::CON_tagentry_idFpAS=multitag_t::newIdentifier("FpAS");
+const multitag_t::mte_id_t Contig::CON_tagentry_idPSHP=multitag_t::newIdentifier("PSHP");
+const multitag_t::mte_id_t Contig::CON_tagentry_idED_D=multitag_t::newIdentifier("ED_D");
+const multitag_t::mte_id_t Contig::CON_tagentry_idED_C=multitag_t::newIdentifier("ED_C");
+const multitag_t::mte_id_t Contig::CON_tagentry_idED_I=multitag_t::newIdentifier("ED_I");
+
+const multitag_t::mte_id_t Contig::CON_tagentry_idESDN=multitag_t::newIdentifier("ESDN");
+
+const multitag_t::mte_id_t Contig::CON_tagentry_idSTMS=multitag_t::newIdentifier("STMS");
+const multitag_t::mte_id_t Contig::CON_tagentry_idSTMU=multitag_t::newIdentifier("STMU");
+const multitag_t::mte_id_t Contig::CON_tagentry_idUNSc=multitag_t::newIdentifier("UNSc");   // UNSure, contig
+
+const multitag_t::mte_id_t Contig::CON_tagentry_idIUPc=multitag_t::newIdentifier("IUPc");   // IUPAC in consensus
+
+const multitag_t::mte_id_t Contig::CON_tagentry_idMCVc=multitag_t::newIdentifier("MCVc");   // missing coverage in consensus
+const multitag_t::mte_id_t Contig::CON_tagentry_idDGPc=multitag_t::newIdentifier("DGPc");   // Dubious Gap Position
+
+const multitag_t::mte_co_t Contig::CON_tagentry_coEmpty=multitag_t::newComment("");
+
+
+
+const multitag_t::mte_id_t Read::REA_tagentry_idEmpty=multitag_t::newIdentifier("");
+
+const multitag_t::mte_id_t Read::REA_tagentry_idMINF=multitag_t::newIdentifier("MINF");
+
+const multitag_t::mte_id_t Read::REA_tagentry_idSRMr=multitag_t::newIdentifier("SRMr");
+const multitag_t::mte_id_t Read::REA_tagentry_idCRMr=multitag_t::newIdentifier("CRMr");
+const multitag_t::mte_id_t Read::REA_tagentry_idWRMr=multitag_t::newIdentifier("WRMr");
+const multitag_t::mte_id_t Read::REA_tagentry_idSAOr=multitag_t::newIdentifier("SAOr"); //  SNP intrA Organism in Read
+const multitag_t::mte_id_t Read::REA_tagentry_idSROr=multitag_t::newIdentifier("SROr"); //  SNP inteR Organism in Read
+const multitag_t::mte_id_t Read::REA_tagentry_idSIOr=multitag_t::newIdentifier("SIOr"); //  SNP Intra- and inter Organism in Read
+const multitag_t::mte_id_t Read::REA_tagentry_idED_D=multitag_t::newIdentifier("ED_D");
+const multitag_t::mte_id_t Read::REA_tagentry_idED_C=multitag_t::newIdentifier("ED_C");
+const multitag_t::mte_id_t Read::REA_tagentry_idED_I=multitag_t::newIdentifier("ED_I");
+
+const multitag_t::mte_id_t Read::REA_tagentry_idESDN=multitag_t::newIdentifier("ESDN");
+
+const multitag_t::mte_id_t Read::REA_tagentry_idPSHP=multitag_t::newIdentifier("PSHP");
+const multitag_t::mte_id_t Read::REA_tagentry_idUNSr=multitag_t::newIdentifier("UNSr");
+const multitag_t::mte_id_t Read::REA_tagentry_idMNRr=multitag_t::newIdentifier("MNRr");      // Masked Nasty Repeat
+const multitag_t::mte_id_t Read::REA_tagentry_idCJSP=multitag_t::newIdentifier("CJSP"); // Contig Join Spoiler
+const multitag_t::mte_id_t Read::REA_tagentry_idHAF0=multitag_t::newIdentifier("HAF0");
+const multitag_t::mte_id_t Read::REA_tagentry_idHAF1=multitag_t::newIdentifier("HAF1");
+const multitag_t::mte_id_t Read::REA_tagentry_idHAF2=multitag_t::newIdentifier("HAF2");
+const multitag_t::mte_id_t Read::REA_tagentry_idHAF3=multitag_t::newIdentifier("HAF3");
+const multitag_t::mte_id_t Read::REA_tagentry_idHAF4=multitag_t::newIdentifier("HAF4");
+const multitag_t::mte_id_t Read::REA_tagentry_idHAF5=multitag_t::newIdentifier("HAF5");
+const multitag_t::mte_id_t Read::REA_tagentry_idHAF6=multitag_t::newIdentifier("HAF6");
+const multitag_t::mte_id_t Read::REA_tagentry_idHAF7=multitag_t::newIdentifier("HAF7");
+
+const multitag_t::mte_id_t Read::REA_tagentry_idMFSM=multitag_t::newIdentifier("MFSM");  // MIRA Force Short-Read Merge
+
+
+const multitag_t::mte_id_t Read::REA_tagentry_idALUS=multitag_t::newIdentifier("ALUS");
+const multitag_t::mte_id_t Read::REA_tagentry_idREPT=multitag_t::newIdentifier("REPT");
+const multitag_t::mte_id_t Read::REA_tagentry_idSVEC=multitag_t::newIdentifier("SVEC");
+
+const multitag_t::mte_id_t Read::REA_tagentry_idFsrc=multitag_t::newIdentifier("Fsrc");
+const multitag_t::mte_id_t Read::REA_tagentry_idFgen=multitag_t::newIdentifier("Fgen");
+const multitag_t::mte_id_t Read::REA_tagentry_idFCDS=multitag_t::newIdentifier("FCDS");
+const multitag_t::mte_id_t Read::REA_tagentry_idFexn=multitag_t::newIdentifier("Fexn");
+const multitag_t::mte_id_t Read::REA_tagentry_idFint=multitag_t::newIdentifier("Fint");
+const multitag_t::mte_id_t Read::REA_tagentry_idFpAS=multitag_t::newIdentifier("FpAS");
+
+const multitag_t::mte_id_t Read::REA_tagentry_idFmRN=multitag_t::newIdentifier("FmRN");
+const multitag_t::mte_id_t Read::REA_tagentry_idFm_R=multitag_t::newIdentifier("Fm-R");
+const multitag_t::mte_id_t Read::REA_tagentry_idFpRN=multitag_t::newIdentifier("FpRN");
+const multitag_t::mte_id_t Read::REA_tagentry_idFrRN=multitag_t::newIdentifier("FrRN");
+const multitag_t::mte_id_t Read::REA_tagentry_idFscR=multitag_t::newIdentifier("FscR");
+const multitag_t::mte_id_t Read::REA_tagentry_idFsnR=multitag_t::newIdentifier("FsnR");
+const multitag_t::mte_id_t Read::REA_tagentry_idFtRN=multitag_t::newIdentifier("FtRN");
+
+
+
+const multitag_t::mte_co_t Read::REA_tagentry_coEmpty=multitag_t::newComment("");
+const multitag_t::mte_co_t Read::REA_tagentry_coUnknown=multitag_t::newComment("UNKNOWN??? Please contact author.");
+const multitag_t::mte_co_t Read::REA_tagentry_coSRMr=multitag_t::newComment("Strong Repeat Marker base found by MIRA");
+const multitag_t::mte_co_t Read::REA_tagentry_coCRMr=multitag_t::newComment("Carbon-copy Repeat Marker base found by MIRA");
+const multitag_t::mte_co_t Read::REA_tagentry_coWRMr=multitag_t::newComment("Weak Repeat Marker base found by MIRA");
+const multitag_t::mte_co_t Read::REA_tagentry_coSAOr=multitag_t::newComment("SNP intrA Organism found by MIRA");
+const multitag_t::mte_co_t Read::REA_tagentry_coSROr=multitag_t::newComment("SNP inteR Organism found by MIRA");
+const multitag_t::mte_co_t Read::REA_tagentry_coSIOr=multitag_t::newComment("SNP Intra- and inter Organism found by MIRA");
+const multitag_t::mte_co_t Read::REA_tagentry_coFpAS=multitag_t::newComment("Poly-A signal set by MIRA");
+const multitag_t::mte_co_t Read::REA_tagentry_coPSHP=multitag_t::newComment("Pyrosequencing Suspicious HomoPolymer (found by MIRA)");
+const multitag_t::mte_co_t Read::REA_tagentry_coUNSr=multitag_t::newComment("Unsure, read");
diff --git a/src/mira/multitag.H b/src/mira/multitag.H
index 50683f5..85883f3 100644
--- a/src/mira/multitag.H
+++ b/src/mira/multitag.H
@@ -11,19 +11,21 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
+// 	$Id$
+
 #ifndef _mira_multitag_h_
 #define _mira_multitag_h_
 
@@ -36,7 +38,6 @@
 #include "errorhandling/errorhandling.H"
 
 #include "io/exp.H"
-#include "io/annotationmappings.H"
 #include "mira/stringcontainer.H"
 
 
@@ -56,10 +57,8 @@ private:
   static StringContainer<uint16> MT_sc_mtidentifier;
   static StringContainer<uint32> MT_sc_mtcomment;
 
-  static const std::vector<uint32> MT_zerosizeuint32v;
-
-
-  static std::vector<int8> MT_cache_identifier_isgff3so_entry;
+  //uint32 MT_rtid;
+  //uint16 MT_order;
 
 
 
@@ -70,148 +69,71 @@ public:
   static const mte_src_t MT_tagsrcentry_idGFF3;
 
 public:
-  uint32    from;                  // including
+  uint32    from;                  // including 
   uint32    to;                    // including
-  mte_co_t  comment;               // comment to that tag (32 bit)
-  mte_id_t  identifier;            // gap4 identifier (extended by mira) (16bit)
-  mte_src_t source;                // where does the tag come from? (8bit)
-
-  uint8 phase:2;    // 0,1,2 and 3 is "don't care"
-  uint8 strandc:2;    // 0== =, 1== +, 2== -, 3== ?, use get/setStrand() to get/set a char
-  bool  commentisgff3:1;
-
-
-private:
-  void dumpCommentAsAttributes(std::ostream & ostr) const;
+  mte_co_t  comment;               // comment to that tag
+  mte_id_t  identifier;            // gap4 identifier (extended by mira)
+  mte_src_t source;                // where does the tag come from?
+  char      strand;                // +, -, = means both
 
 public:
 
-  multitag_t() : from(0),
-		 to(0),
-		 identifier(newIdentifier("")),
-		 comment(newComment("")),
-		 source(newSource("")),
-		 phase(3),
-		 strandc(0),
-		 commentisgff3(false){
+  multitag_t() {
+    from=0;
+    to=0;
+    strand='=';
+    comment=MT_sc_mtcomment.addEntry("");
+    identifier=MT_sc_mtidentifier.addEntry("");
+    source=MT_tagsrcentry_idEmpty;
+    //cout << "mt init" << endl;
   };
 
-  multitag_t(const std::string & pident, const std::string & pcom,
-	     const std::string & psource) : from(0),
-				       to(0),
-				       comment(newComment(pcom)),
-				       identifier(newIdentifier(pident)),
-				       source(newSource(psource)),
-				       phase(3),
-				       strandc(0),
-				       commentisgff3(false){
+  //multitag_t const & operator=(tag_t const & other);
+  multitag_t const & operator=(tag_t const & simpletag) {
+    //MT_rtid=0;
+    //MT_order=0;
+    from=simpletag.from;
+    to=simpletag.to;
+    strand=simpletag.strand;
+    comment=multitag_t::newComment(simpletag.comment);
+    identifier=multitag_t::newIdentifier(simpletag.identifier);
+    // tag_t has no source, set to empty
+    source=MT_tagsrcentry_idEmpty;
+    return *this;
   };
 
-  multitag_t(uint32 pfrom, uint32 pto, const std::string & pident, const std::string & pcom,
-	     const std::string & psource, char pstrand) : from(pfrom),
-						     to(pto),
-						     comment(newComment(pcom)),
-						     identifier(newIdentifier(pident)),
-						     source(newSource(psource)),
-						     phase(3),
-						     commentisgff3(false){
-    setStrand(pstrand);
-  };
-
-  friend std::ostream & operator<<(std::ostream &ostr, const multitag_t &t){
-    t.dumpDebug(ostr);
+  friend ostream & operator<<(ostream &ostr, const multitag_t &t){
+    ostr << "From: " << t.from <<  endl;
+    ostr << "To: " << t.to << endl;
+    ostr << "Strand: " << t.strand << endl;
+    //ostr << "Identifier: " << t.identifier << endl;
+    //ostr << "Comment: " << t.comment << endl;
+    //ostr << "Source: " << t.source << endl;
     return ostr;
   }
 
-  void dumpDebug(std::ostream & ostr) const;
-  void dumpAsCAF(std::ostream & ostr) const;
-  void dumpAsMAF(std::ostream & ostr, const char * type) const;
-  void dumpAsSAM(std::ostream & ostr, int32 rlen=0) const;  // for read tags
-  void dumpAsSAM(std::ostream & ostr, const std::string & contigname) const; // contig tags
-
-  void dumpAsGFF3(std::ostream & ostr, const char * seqid) const;
-  void dumpAsGFF3(std::ostream & ostr, const std::string & seqid) const {dumpAsGFF3(ostr,seqid.c_str());};
-
-
-  inline const std::string & getIdentifierStr() const {return MT_sc_mtidentifier.getEntry(identifier);}
-  inline static const std::string & getIdentifierStr(mte_id_t e) {return MT_sc_mtidentifier.getEntry(e);}
-  inline const std::string & getCommentStr() const {return MT_sc_mtcomment.getEntry(comment);}
-  inline static const std::string & getCommentStr(mte_co_t e) {return MT_sc_mtcomment.getEntry(e);}
-  inline const std::string & getSourceStr() const {return MT_sc_mttagsource.getEntry(source);}
-  inline static const std::string & getSourceStr(mte_src_t e) {return MT_sc_mttagsource.getEntry(e);}
-
-  inline void setIdentifierStr(const std::string & s) {identifier=newIdentifier(s);}
-  inline void setCommentStr(const std::string & s) {comment=newComment(s);}
-  inline void setSourceStr(const std::string & s) {source=newSource(s);}
-
-  inline bool isSourceMIRA() const {return source==MT_tagsrcentry_idMIRA;}
-
-  void setStrand(char s) {
-    FUNCSTART("void setStrand(char s)");
-    switch(s) {
-    case '.' :
-    case '=' : {
-      strandc=0;
-      break;
-    }
-    case '+' : {
-      strandc=1;
-      break;
-    }
-    case '-' : {
-      strandc=2;
-      break;
-    }
-    case '?' : {
-      strandc=3;
-      break;
-    }
-    default : {
-      MIRANOTIFY(Notify::FATAL,"Trying to set illegal strand character " << s << " (" << static_cast<uint16>(s) << ")");
-      break;
-    }
-    }
-    FUNCEND();
-  };
-
-  inline char getStrand() const {
-    switch(strandc){
-    case 0: {
-      return '=';
-    }
-    case 1: {
-      return '+';
-    }
-    case 2: {
-      return '-';
-    }
-    default : {
-      return '?';
-    }
-    }
-  };
-
-  inline int8 getStrandDirection() const {
-    if(strandc==1) return 1;
-    if(strandc==2) return -1;
-    return 0;
-  }
+  inline const string & getIdentifierStr() const {return MT_sc_mtidentifier.getEntry(identifier);}
+  inline static const string & getIdentifierStr(mte_id_t e) {return MT_sc_mtidentifier.getEntry(e);}
+  inline const string & getCommentStr() const {return MT_sc_mtcomment.getEntry(comment);}
+  inline static const string & getCommentStr(mte_co_t e) {return MT_sc_mtcomment.getEntry(e);}
+  inline const string & getSourceStr() const {return MT_sc_mttagsource.getEntry(source);}
+  inline static const string & getSourceStr(mte_src_t e) {return MT_sc_mttagsource.getEntry(e);}
 
   // get that from tag_t
-  inline void serialiseComment(std::string & result) const {
+  inline void serialiseComment(string & result) const {
     tag_t::serialiseComment(getCommentStr(),result);
   }
 
-  inline bool extractGenBankKeyValueFromComment(const std::string & whatkey,
-					 std::string & result) const {
+  inline bool extractGenBankKeyValueFromComment(const string & whatkey,
+					 string & result) const {
     return tag_t::extractGenBankKeyValueFromComment(getCommentStr(), whatkey, result);
   };
 
   inline static mte_id_t newIdentifier(const char * s) {
-    //cout << "nI*: " << s << std::endl;
+    //cout << "nI*: " << s << endl;
     return MT_sc_mtidentifier.addEntry(s);
   };
-  inline static mte_id_t newIdentifier(const std::string & s) {
+  inline static mte_id_t newIdentifier(const string & s) {
     //cout << "nIs: " << s << endl;
     return newIdentifier(s.c_str());
   };
@@ -219,7 +141,7 @@ public:
     //cout << "nI*: " << s << endl;
     return MT_sc_mtidentifier.hasEntry(s);
   };
-  inline static mte_id_t hasIdentifier(const std::string & s) {
+  inline static mte_id_t hasIdentifier(const string & s) {
     //cout << "nIs: " << s << endl;
     return hasIdentifier(s.c_str());
   };
@@ -227,7 +149,7 @@ public:
     //cout << "nC*: " << s << endl;
     return MT_sc_mtcomment.addEntry(s);
   };
-  inline static mte_co_t newComment(const std::string & s) {
+  inline static mte_co_t newComment(const string & s) {
     //cout << "nCs: " << s << endl;
     return newComment(s.c_str());
   };
@@ -235,28 +157,11 @@ public:
     //cout << "nC*: " << s << endl;
     return MT_sc_mttagsource.addEntry(s);
   };
-  inline static mte_src_t newSource(const std::string & s) {
+  inline static mte_src_t newSource(const string & s) {
     //cout << "nCs: " << s << endl;
     return newSource(s.c_str());
   };
-
-  inline bool identifierIsValidGFF3SOEntry() const {
-    if(MT_cache_identifier_isgff3so_entry.size() < MT_sc_mtidentifier.size()){
-      MT_cache_identifier_isgff3so_entry.resize(MT_sc_mtidentifier.size(),0);
-    }
-    if(MT_cache_identifier_isgff3so_entry[identifier.getSCID()]){
-      if(MT_cache_identifier_isgff3so_entry[identifier.getSCID()]>0) return true;
-    }else{
-      if(AnnotationMappings::isValidGFF3SOEntry(getIdentifierStr())){
-	MT_cache_identifier_isgff3so_entry[identifier.getSCID()]=1;
-	return true;
-      }
-      MT_cache_identifier_isgff3so_entry[identifier.getSCID()]=-1;
-    }
-
-    return false;
-  }
-
+  
 };
 
 #endif
diff --git a/src/mira/newpathfinder.C b/src/mira/newpathfinder.C
new file mode 100644
index 0000000..90edabe
--- /dev/null
+++ b/src/mira/newpathfinder.C
@@ -0,0 +1,5018 @@
+/*
+ * Written by Bastien Chevreux (BaCh)
+ *
+ * Copyright (C) 2002 and later by Bastien Chevreux
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ * 
+ */
+
+// 	$Id$	
+
+#ifndef lint
+static char vcid[] = "$Id$";
+#endif /* lint */
+
+
+#include "newpathfinder.H"
+
+#include <iostream>
+
+// for time measurements
+#include <sys/times.h>
+#include <sys/time.h>
+#include <limits.h>
+#include <unistd.h>
+
+#include "errorhandling/errorhandling.H"
+
+
+
+
+//#define CEBUG(bla)   {cout << bla; cout.flush();}
+//#define CEBUGF(bla)  {cout << bla; cout.flush();}
+
+
+// cs1 for normal clocking ('user compatible' as is does not disturb user)
+// cs2 is for extensive clocking output, more for analysis of MIRA behaviour
+//  during development
+
+#define CLOCK_STEPS1
+#ifndef PUBLICQUIET
+#define CLOCK_STEPS2
+#endif
+
+#define CLOCK_STEPS2
+
+void Pathfinder::foolCompiler()
+{
+#include "stdinc/foolcompiler.C"
+}
+
+
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+
+ostream & operator<<(ostream &ostr, nextreadtoadd_t const &nrta)
+{
+#ifndef PUBLICQUIET
+  if(nrta.newid == -1) {
+    ostr << "Invalid / empty nrta.\n";
+    return ostr;
+  }
+#endif
+
+  //ostr <<"RefID : " << nrta.refid << endl;
+  //ostr <<"NewID : " << nrta.newid << endl;
+  //ostr <<"Weight: " << nrta.weight << endl;
+  //ostr <<"Dir: " << nrta.direction_newid << endl;
+  //ostr <<"ADS: " << *(nrta.ads_node) << endl;
+
+#ifndef PUBLICQUIET
+  switch(nrta.foundmethod) {
+  case Pathfinder::FOUND_NORMAL_AND_SRMB : {
+    ostr << "FOUND_NORMAL_AND_SRMB ";
+    break;
+  }
+  case Pathfinder::FOUND_NORMAL : {
+    ostr << "FOUND_NORMAL ";
+    break;
+  }
+  case Pathfinder::FOUND_SPEEDYMAP : {
+    ostr << "FOUND_SPEEDYMAP ";
+    break;
+  }
+  case Pathfinder::FOUND_NONMULTICOPY : {
+    ostr << "FOUND_NONMULTICOPY ";
+    break;
+  }
+  case Pathfinder::FOUND_TEMPLATE_AND_TPARTNER : {
+    ostr << "FOUND_TEMPLATE_AND_TPARTNER ";
+    break;
+  }
+  //case Pathfinder::FOUND_TEMPLATE_AND_OVERLAPPINGTPARTNER : {
+  //  ostr << "FOUND_TEMPLATE_AND_OVERLAPPINGTPARTNER ";
+  //  break;
+  //}
+  case Pathfinder::FOUND_TPARTNER_IN_CONTIG : {
+    ostr << "FOUND_TPARTNER_IN_CONTIG ";
+    break;
+  }
+  case Pathfinder::FOUND_OVERLAPPING_PARTNER : {
+    ostr << "FOUND_OVERLAPPING_PARTNER ";
+    break;
+  }
+  case Pathfinder::FOUND_TEMPLATE_NONMULTICOPY_AND_TPARTNER : {
+    ostr << "FOUND_TEMPLATE_NONMULTICOPY_AND_TPARTNER ";
+    break;
+  }
+  case Pathfinder::FOUND_RAIL_AND_NONMULTICOPY : {
+    ostr << "FOUND_RAIL_AND_NONMULTICOPY ";
+    break;
+  }
+  case Pathfinder::FOUND_RAIL_AND_MULTICOPY : {
+    ostr << "FOUND_RAIL_AND_MULTICOPY ";
+    break;
+  }
+  case Pathfinder::FOUND_STAGE1 : {
+    ostr << "FOUND_STAGE1 ";
+    break;
+  }
+  case Pathfinder::FOUND_STAGE2 : {
+    ostr << "FOUND_STAGE2 ";
+    break;
+  }
+  case Pathfinder::FOUND_STAGE100 : {
+    ostr << "FOUND_STAGE100 ";
+    break;
+  }
+  default : {
+    ostr << "FOUND_??? unknown find method? ";
+  }
+  }
+
+  ostr << nrta.weight << endl;
+
+  ostr.flush();
+#endif
+
+  return ostr;
+}
+
+
+
+
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+
+Pathfinder::Pathfinder(vector<MIRAParameters> * params, ReadPool & readpool, vector<newedges_t> & forward_edges, vector<AlignedDualSeqFacts> & adsfacts)
+{
+  FUNCSTART("");
+
+  PAF_miraparams=params;
+  PAF_forward_edges=&forward_edges;
+  PAF_readpool=&readpool;
+  PAF_adsfacts=&adsfacts;
+
+  // we don't know whether edges were banned ... play it safe
+  //  and say there were so that the pf_banned flags get reset 
+  //  at first call of constructStepByStep()
+  PAF_overlapsbanned=1;
+
+  // give the small store iterators to banned overlaps a capacity of
+  //  50k entries.
+  PAF_overlapsbanned_smallstore.reserve(50000);
+
+  PAF_uiitr_is_clean=false;
+  PAF_usesbeststartcache=false;
+
+  PAF_valid=1;
+
+  FUNCEND();
+}
+
+
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+
+Pathfinder::~Pathfinder()
+{
+  FUNCSTART("Pathfinder::~Pathfinder()");
+
+  discard();
+
+  FUNCEND();
+}
+
+// Copy constructor
+//  no discard needed as this object will be freshly created when
+//  called through this constructor
+//Pathfinder::Pathfinder(Pathfinder const &other)
+//{
+//  FUNCSTART("Pathfinder::Pathfinder(Pathfinder const &other)");
+//
+//  PAF_valid=0;
+//
+//  *this=other;                               // call the copy operator
+//
+//  FUNCEND();
+//}
+
+// Copy operator, needed by copy-constructor
+//Pathfinder const & Pathfinder::operator=(Pathfinder const & other)
+//{
+//  FUNCSTART("Pathfinder const & Pathfinder::operator=(Pathfinder const & other)");
+//  ERROR("Not implemented yet.");
+//  FUNCEND();
+//  return *this;
+//}
+
+//ostream & operator<<(ostream &ostr, Pathfinder const &PAF)
+//{
+//  FUNCSTART("friend ostream & Pathfinder::operator<<(ostream &ostr, const  &PAF)");
+//  ERROR("Not implemented yet.");
+//
+//  FUNCEND();
+//  return ostr;
+//}
+
+void Pathfinder::discard()
+{
+  FUNCSTART("Pathfinder::discard()");
+
+  if(PAF_valid==0){
+  }
+
+  //PAF_lowerbound_oedges.resize(0);
+
+  FUNCEND();
+}
+
+
+
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+bool Pathfinder__compareNewEdges_t_(const newedges_t & a, 
+				    const newedges_t & b);
+bool Pathfinder__compareNewEdges_t_(const newedges_t & a, const newedges_t & b)
+{
+  return a.rid1 < b.rid1;
+}
+
+//#define CEBUG(bla)   {cout << bla; cout.flush(); }
+
+void Pathfinder::constructStepByStep(vector<Align> & aligncache, vector<int8> * used_ids, vector<int32> * ids_in_contig, vector<uint8> * multicopies, vector<uint8> * hasmcoverlaps, vector<uint8> * istroublemaker, vector<vector<newedges_t>::iterator> * lowerbound_oedges_ptr, vector<int32> * proposedSRMrightclips, Contig & con)
+{
+  FUNCSTART("void Pathfinder::constructFast()");
+
+#ifndef PUBLICQUIET
+  cout << "Old constructStepByStep().\n";
+#endif
+
+  PAF_pafparams=(*PAF_miraparams)[0].getPathfinderParams();
+
+  PAF_used_ids_ptr=used_ids;
+  PAF_ids_in_contig_ptr=ids_in_contig;
+  PAF_multicopies_ptr=multicopies;
+  PAF_hasmcoverlap_ptr=hasmcoverlaps,
+  PAF_istroublemaker_ptr=istroublemaker;
+  PAF_proposedSRMrightclips_ptr=proposedSRMrightclips;
+  PAF_lowerbound_oedges_ptr=lowerbound_oedges_ptr;
+
+  PAF_usesbeststartcache=false;
+
+  n3_basicCSBSSetup();
+
+
+  if(con.getContigLength()==0){ 
+    CEBUG("csbs 3a\n");
+    int32 startid=searchBestEnvironment();
+    if(startid>=0) {
+      CEBUG("csbs 3a1\n");
+
+      // if we keep long repeats separated:
+      //   if we start with a non-multicopy read, forbid
+      //    multicopy/multicopy overlaps
+      if((*PAF_multicopies_ptr)[startid]>0) {
+#ifndef PUBLICQUIET
+	cout << "\nStarted with multicopy.\n";
+#endif
+	con.setLongReapeatStatus(true);
+      }else{
+	cout << "\nStarted with non-multicopy.\n";
+	if(PAF_musthonourmcmcflag){
+#ifndef PUBLICQUIET
+	  cout << "\nMay not add mc/mc overlaps.\n";
+#endif
+	  PAF_mayaddmcmcoverlaps=false;
+	}
+      }
+#ifndef PUBLICQUIET
+      cout << "mayaddmcmcoverlaps: " << PAF_mayaddmcmcoverlaps << endl;
+#endif      
+
+      // BaCh. 05.12.2008
+      // gcc version 4.1.2 20061115 (prerelease)
+      // the above if/else is sometimes not executed (neither
+      //  if nor else) when the buildContig() from below is above 
+      //  the if/else
+      // Hunting that down s*cked big time.
+
+      CEBUG("csbs 3a2\n");
+      buildContig(aligncache,startid, con);
+      CEBUG("csbs 3a3\n");
+
+    } else {
+      CEBUG("csbs 3a4\n");
+      cout << "No more reads found to build a new contig!" << endl;
+      FUNCEND();
+      return;
+    }
+  } else {
+    CEBUG("csbs 3b\n");
+    buildContig(aligncache, -1, con);
+  }
+
+  CEBUG("csbs 4\n");
+
+  uint32 numreadspresent=PAF_used_ids_ptr->size();
+
+  bool canloop=true;
+  uint32 searchloop=1;
+  for(;canloop && searchloop <30; searchloop++){
+    cout << "\nRL" << searchloop << endl;
+    PAF_used_ids_in_this_run.clear();
+    PAF_used_ids_in_this_run.resize(numreadspresent,0);
+    PAF_blacklisted_ids.clear();
+    PAF_blacklisted_ids.resize(numreadspresent,1);
+    uint32 numreadsincontig=con.getNumReadsInContig();
+    buildContig(aligncache, -1, con);
+    if(numreadsincontig==con.getNumReadsInContig()) {
+      cout << "\nThat's it for this contig." << endl;
+      canloop=false;
+    } else {
+      cout << "\nGained " << con.getNumReadsInContig()-numreadsincontig << " reads.\n";
+    }
+  }
+
+  if(canloop) {
+    cout << "Stopped because reached maximum iterations allowed.\n";
+  }
+
+  FUNCEND();
+}
+//#define CEBUG(bla)
+
+
+
+
+
+
+
+/*************************************************************************
+ *
+ * some basic setup for constructStepByStep()
+ *
+ * last remnants of n3_* routines ... see whether to rewrite 
+ *  or rename n4_*
+ *
+ *************************************************************************/
+
+
+void Pathfinder::n3_basicCSBSSetup()
+{
+  FUNCSTART("void Pathfinder::constructFast()");
+
+  PAF_pafparams=(*PAF_miraparams)[0].getPathfinderParams();
+
+  uint32 numreadspresent=PAF_used_ids_ptr->size();
+  PAF_used_ids_in_this_run.clear();
+  PAF_used_ids_in_this_run.resize(numreadspresent,0);
+  PAF_blacklisted_ids.clear();
+  PAF_blacklisted_ids.resize(numreadspresent,1);
+  PAF_readaddattempts=0;
+  PAF_nonmulticopiesadded=0;
+
+  PAF_musthonourmcmcflag=(*PAF_miraparams)[0].getAssemblyParams().as_keep_long_repeats_separated;
+  PAF_mayaddmcmcoverlaps=true;
+
+  CEBUG("csbs 1\n");
+
+  // initialise all fields in the newedge_t structure of PAF_forward_edges
+  //  used by the pathfinder
+  // at the moment this is the pf_banned field (set when an overlap is 
+  //  rejected also set for all all reads that are already aligned
+  //  in the contig at the potential insertion position
+
+  if(PAF_overlapsbanned){
+    if(!PAF_overlapsbanned_smallstore.empty()
+       && PAF_overlapsbanned_smallstore.size() < PAF_overlapsbanned_smallstore.capacity()){
+#ifndef PUBLICQUIET
+      cout << "Clear pf_banned quick: " << PAF_overlapsbanned_smallstore.size() << '\n';
+#endif
+      vector<vector<newedges_t>::iterator>::iterator obssI=PAF_overlapsbanned_smallstore.begin();
+      for(; obssI != PAF_overlapsbanned_smallstore.end(); obssI++){
+	(*obssI)->pf_banned=false;
+      }
+    }else{
+#ifndef PUBLICQUIET
+      cout << "Clear pf_banned full: " << PAF_overlapsbanned << '\n';
+#endif
+      vector<newedges_t>::iterator neI=PAF_forward_edges->begin();
+      for(; neI != PAF_forward_edges->end(); neI++){
+	neI->pf_banned=false;
+      }
+    }
+    PAF_overlapsbanned=0;
+    PAF_overlapsbanned_smallstore.clear();
+  }
+
+  CEBUG("csbs 2\n");
+  
+  // initialise the quick lowerbound_oedges lookup vector if not already done
+  if(PAF_lowerbound_oedges_ptr->empty()){
+    vector<vector<newedges_t>::iterator> & lowerbound_oedges=*PAF_lowerbound_oedges_ptr; 
+    lowerbound_oedges.resize(PAF_readpool->size());
+    newedges_t tmp;
+    for(uint32 i=0; i<lowerbound_oedges.size(); i++) {
+      //lowerbound_oedges[i]=PAF_forward_edges->lower_bound(i);
+      tmp.rid1=i;
+      lowerbound_oedges[i]=lower_bound(PAF_forward_edges->begin(),
+				       PAF_forward_edges->end(),
+				       tmp,
+				       Pathfinder__compareNewEdges_t_);
+    }
+  }
+
+  CEBUG("csbs 3\n");
+
+  // initialise the has_multicopies_overlap if not already done
+  if(PAF_hasmcoverlap_ptr->empty()){
+    PAF_hasmcoverlap_ptr->resize(numreadspresent,0);
+    vector<newedges_t>::const_iterator feI=PAF_forward_edges->begin();
+    for(; feI != PAF_forward_edges->end(); feI++){
+      if((*PAF_multicopies_ptr)[feI->rid1] 
+	 || (*PAF_multicopies_ptr)[feI->linked_with]){
+	(*PAF_hasmcoverlap_ptr)[feI->rid1]=1;
+	(*PAF_hasmcoverlap_ptr)[feI->linked_with]=1;
+      }
+    }
+  }
+
+  //PAF_idswithSRMBtags.clear();
+  //PAF_idswithSRMBtags.resize(numreadspresent,0);
+  //
+  //for(uint32 i=0; i < numreadspresent; i++) {
+  //  if(PAF_readpool->getRead(i).hasTag(Read::REA_tagSRMr)) PAF_idswithSRMBtags[i]=1;
+  //}
+
+}
+
+
+
+/*************************************************************************
+ *
+ *
+ *
+ * last remnants of n3_* routines ... see whether to rewrite 
+ *  or rename n4_*
+ *
+ *************************************************************************/
+
+void Pathfinder::n3_handleReadNotAligned(Contig::errorstatus_t & contigerrstat, nextreadtoadd_t const &nrta)
+{
+  FUNCSTART("void Pathfinder::n3_handleReadNotAligned(Contig::errorstatus_t & contigerrstat)");
+
+  switch(contigerrstat.code) {
+  case Contig::ENOALIGN : {
+#ifndef PUBLICQUIET
+    cout << "\t-\tno align found\n";
+#else
+    cout << 'a';
+#endif
+    break;
+  }
+  case Contig::EDROPINRELSCORE : {
+#ifndef PUBLICQUIET
+    cout << "\t-\tdrop in relscore too high\n";
+#else
+    cout << 'd';
+#endif
+    break;
+  }
+  case Contig::ETEMPLATEDIRECTION : {
+#ifndef PUBLICQUIET
+    cout << "\t-\ttemplate in wrong direction\n";
+#else
+    cout << 't';
+#endif
+    break;
+  }
+  case Contig::ETEMPLATESIZE : {
+#ifndef PUBLICQUIET
+    cout << "\t-\tmismatch in template size\n";
+#else
+    cout << 's';
+#endif
+    break;
+  }
+  case Contig::ESRMBMISMATCH : {
+#ifndef PUBLICQUIET
+    cout << "\t-\tmismatch in SRMB zone\n";
+#else
+    cout << 'p';
+#endif
+    break;
+  }
+  case Contig::ESPECIALSRADDFAIL : {
+#ifndef PUBLICQUIET
+    cout << "\t-\tfailed special SR add rules\n";
+#else
+    cout << 'c';
+#endif
+
+    // if read could not be added, propose a new right clip
+    //cout << "SRMClip: " << PAF_readpool->getRead(nrta.newid).getName();
+    //cout << "\nHave: " << (*PAF_proposedSRMrightclips_ptr)[nrta.newid];
+    //cout << "\nPropose: " << contigerrstat.proposed_cutback << '\n';
+    if(contigerrstat.proposed_cutback>(*PAF_proposedSRMrightclips_ptr)[nrta.newid]){
+      //cout << "Newclip!\n";
+      (*PAF_proposedSRMrightclips_ptr)[nrta.newid]=contigerrstat.proposed_cutback;
+    }
+    break;
+  }
+  case Contig::EREFIDNOTALLOWED : {
+#ifndef PUBLICQUIET
+    cout << "\t-\trefid not allowed\n";
+#else
+    cout << 'r';
+#endif
+    break;
+  }
+  case Contig::EMAXCOVERAGEREACHED : {
+#ifndef PUBLICQUIET
+    cout << "\t-\tmaxcoverage reached\n";
+#else
+    cout << 'x';
+#endif
+    break;
+  }
+  case Contig::EDANGERZONE : {
+#ifndef PUBLICQUIET
+    cout << "\t-\ttoo many mismatches in danger zone(s)\n";
+#else
+    cout << 'z';
+#endif
+    break;
+  }
+  case Contig::EFORCEDGROWTHNOTREACHED : {
+#ifndef PUBLICQUIET
+    cout << "\t-\tforced growth not reached\n";
+#else
+    cout << 'g';
+#endif
+    break;
+  }
+  case Contig::EGROWTHNOTALLOWED : {
+#ifndef PUBLICQUIET
+    cout << "\t-\tgrowth not allowed\n";
+#else
+    cout << 'G';
+#endif
+    break;
+  }
+  case Contig::EUNSPECIFIED : {
+#ifndef PUBLICQUIET
+    cout << "\t-\tunspecified reject\n";
+#else
+    cout << '?';
+#endif
+    break;
+  }
+  default : {
+    throw Notify(Notify::INTERNAL, THISFUNC,"Unknown errorcode from the contig object.");
+  }
+  }
+
+#ifndef PUBLICQUIET
+  cout.flush();
+#endif
+  // ban all alignments of that read with other reads that were
+  //  at the same position
+
+  //// debug: show all reads at that pos that the contig gave back
+  //{
+  //  cout << "\nReads affected:\n";
+  //  vector<int32>::const_iterator raI;
+  //  raI=contigerrstat.reads_affected.begin();
+  //  for(; raI != contigerrstat.reads_affected.end(); raI++){
+  //    cout << *raI << '\t' << (*PAF_readpool)[*raI].getName();
+  //    if((*PAF_readpool)[*raI].isBackbone()){
+  //      cout << "\tbackbone\n";
+  //    } else if((*PAF_readpool)[*raI].isRail()){
+  //      cout << "\trail\n";
+  //    }else{
+  //      cout << "\tseqtype: " << static_cast<uint16>((*PAF_readpool)[*raI].getSequencingType()) << '\n';
+  //    }
+  //  }
+  //}
+
+
+  {
+    // First search look at the newedges_t block of nrta,newid overlaps
+    //  and ban those overlaps whose reads are in the vector given back
+    //  by the contig
+
+    vector<newedges_t>::iterator neI = (*PAF_lowerbound_oedges_ptr)[nrta.newid];
+    vector<int32>::const_iterator raI;
+    for(; neI != PAF_forward_edges->end() && neI->rid1 == nrta.newid; neI++){
+      if(!neI->pf_banned){
+	raI=contigerrstat.reads_affected.begin();
+	for(; raI != contigerrstat.reads_affected.end(); raI++){
+	  if(*raI == neI->linked_with){
+	    //cout << "Banning1: " << neI->rid1 << '\t' << neI->linked_with << '\n';
+	    PAF_overlapsbanned++;
+	    neI->pf_banned=true;
+	    if(PAF_overlapsbanned_smallstore.size()<PAF_overlapsbanned_smallstore.capacity()){
+	      PAF_overlapsbanned_smallstore.push_back(neI);
+	    }
+	    break;
+	  }
+	}
+      }
+    }
+
+    // Now look at the blocks of newedges_t whose reads are given
+    //  by by the vector and who overlap with nrta.newid
+    raI=contigerrstat.reads_affected.begin();
+    for(; raI != contigerrstat.reads_affected.end(); raI++){
+      neI = (*PAF_lowerbound_oedges_ptr)[*raI];
+      for(; neI != PAF_forward_edges->end() && neI->rid1 == *raI; neI++){
+	if(!neI->pf_banned){
+	  if(neI->linked_with == nrta.newid){
+	    //cout << "Banning2: " << neI->rid1 << '\t' << neI->linked_with << '\n';
+	    PAF_overlapsbanned++;
+	    neI->pf_banned=true;
+	    if(PAF_overlapsbanned_smallstore.size()<PAF_overlapsbanned_smallstore.capacity()){
+	      PAF_overlapsbanned_smallstore.push_back(neI);
+	    }
+	    break;
+	    // NOTE: should MIRA ever get multiple overlaps between
+	    //  two reads, then the "break;" above must be removed
+	    //  should be safe for now.
+	  }
+	}
+      }
+    }
+  }
+
+  FUNCEND();
+  return;
+}
+
+
+
+
+
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+
+// returns ID of read with best matching env
+// TODO: length >50?
+uint32 Pathfinder::searchBestEnvironment()
+{
+  enum {SINGLE=0, 
+	NORMAL, NORMAL_NONMULTYCOPY, 
+	WITH_TEMPLATE, WITH_TEMPLATE_NONMULTYCOPY, 
+	WITH_TEMPLATE_PARTNER, WITH_TEMPLATE_PARTNER_NONMULTICOPIES,
+	ENUMEND};
+
+  FUNCSTART("void Pathfinder::searchBestEnviron()");
+
+  const vector<int8> & PAF_used_ids = *PAF_used_ids_ptr;
+  const vector<uint8> & PAF_multicopies = *PAF_multicopies_ptr;
+  const vector<uint8> & PAF_istroublemaker = *PAF_istroublemaker_ptr;
+
+  vector<int32> bestid;
+  bestid.resize(ENUMEND,-1);
+  bool foundid=false;
+
+  
+  CEBUG("sbe 1\n");
+
+  {
+    vector<uint32> bestweight;
+    bestweight.resize(ENUMEND,0);
+
+    uint32 ids=0;
+    uint32 elements=0;
+
+    for(int32 actid=0; actid < static_cast<int32>(PAF_used_ids.size()); actid++) {
+      if(PAF_used_ids[actid]!=0) continue;
+      if(PAF_istroublemaker[actid]!=0) continue;
+      vector<newedges_t>::const_iterator I=(*PAF_lowerbound_oedges_ptr)[actid];
+
+      ids++;
+
+      uint32 numids=0;
+      vector<uint32> sumweight;
+      sumweight.resize(ENUMEND,0);
+
+      int32 actidtemplatepartnerid=PAF_readpool->getRead(actid).getTemplatePartnerID();
+      
+      for(;I!=PAF_forward_edges->end() && actid==I->rid1;I++){
+	// don't count known troublemakers
+	if(PAF_istroublemaker[I->linked_with]) continue;
+	// if the linked read is already used, can't count that as
+	//  plus for a new anchor point
+	if(PAF_used_ids[I->linked_with]!=0) continue;
+	
+	numids++;
+	// look if it's the single best overlap so far
+	if(I->best_weight > sumweight[SINGLE]) {
+	  sumweight[SINGLE]=I->best_weight;
+	}
+	
+	// add weight to normal overlaps
+	sumweight[NORMAL]+=I->best_weight;
+	
+	if(PAF_multicopies[actid]==0) {
+	  sumweight[NORMAL_NONMULTYCOPY]+=I->best_weight;
+	}
+	
+	// look if both reads have templatepartnerids
+	if(actidtemplatepartnerid >= 0) {
+	  int32 secondtemplatepartnerid=PAF_readpool->getRead(I->linked_with).getTemplatePartnerID();
+	  if(secondtemplatepartnerid >= 0) {
+	    sumweight[WITH_TEMPLATE]+=I->best_weight;
+	    
+	    if(PAF_multicopies[actid]==0) {
+	      sumweight[WITH_TEMPLATE_NONMULTYCOPY]+=I->best_weight;
+	    }
+	    
+	    // look if they're the same template
+	    if(actid == secondtemplatepartnerid) {
+	      sumweight[WITH_TEMPLATE_PARTNER]+=I->best_weight;
+	      
+	      if(PAF_multicopies[actid]==0
+		 && PAF_multicopies[actidtemplatepartnerid]==0){
+		sumweight[WITH_TEMPLATE_PARTNER_NONMULTICOPIES]+=I->best_weight;
+	      }
+	    }
+	  }
+	}
+      }
+      for(uint32 i=0; i<ENUMEND; i++) {
+	if(sumweight[i]>bestweight[i]){
+	  foundid=true;
+	  bestid[i]=actid;
+	  bestweight[i]=sumweight[i];
+	}
+      }
+      elements+=numids;
+      CEBUG("ID: " << actid << " has " << numids << " elements. Summed weights: Single - " << sumweight[SINGLE] << "\tNormal - " << sumweight[NORMAL] << "\tTempl. - " << sumweight[WITH_TEMPLATE] << "\tTempl.+Partn. - " << sumweight[WITH_TEMPLATE_PARTNER] << "\n");
+      //CEBUGF(" giving an averaged weight of " << (uint32) (sumweight/numids) << endl);
+    }
+
+    if(ids>0) {
+      CEBUG("ID: Average elements per id: " << double(elements)/(double)ids << "\n");
+    }
+  }
+
+  // Catch the reads which do not overlap with any other one to make single
+  //  reads contigs out of them
+  if(foundid==false){
+    uint32 size=PAF_readpool->size();
+    for(uint32 i=0; i<size; i++){
+      if(PAF_used_ids[i]==0){
+  	bestid[SINGLE]=i;
+  	break;
+      }
+    }
+  }
+
+  int32 ret=-1;
+  if(PAF_pafparams.paf_use_genomic_algorithms) {
+    if(bestid[WITH_TEMPLATE_PARTNER_NONMULTICOPIES] >=0) {
+      ret=bestid[WITH_TEMPLATE_PARTNER_NONMULTICOPIES];
+      CEBUG("Using Best-ID (tempart nonMC/genomic): " << ret << "\n");
+    } else if(bestid[WITH_TEMPLATE_NONMULTYCOPY] >=0) {
+      ret=bestid[WITH_TEMPLATE_NONMULTYCOPY];
+      CEBUG("Using Best-ID (temp nonMC/genomic): " << ret << "\n");
+    } else if(bestid[NORMAL_NONMULTYCOPY] >=0) {
+      ret=bestid[NORMAL_NONMULTYCOPY];
+      CEBUG("Using Best-ID (normal nonMC/genomic): " << ret << "\n");
+    } else if(bestid[NORMAL] >=0) {
+      ret=bestid[NORMAL];
+      CEBUG("Using Best-ID (normal/genomic): " << ret << "\n");
+    } else if(bestid[SINGLE] >=0) {
+      ret=bestid[SINGLE];
+      CEBUG("Using Best-ID (single/genomic): " << ret << "\n");
+    } else {
+      CEBUG("No Best-ID genomic found.\n");
+    }
+  } else if(bestid[WITH_TEMPLATE_PARTNER] >=0) {
+    ret=bestid[WITH_TEMPLATE_PARTNER];
+    CEBUG("Using Best-ID with template partner: " << ret << "\n");
+  } else if(bestid[WITH_TEMPLATE] >=0) {
+    ret=bestid[WITH_TEMPLATE];
+    CEBUG("Using Best-ID with template: " << ret << "\n");
+  } else if(bestid[NORMAL] >=0) {
+    ret=bestid[NORMAL];
+    CEBUG("Using Best-ID (normal): " << ret << "\n");
+  } else if(bestid[SINGLE] >=0) {
+    ret=bestid[SINGLE];
+    CEBUG("Using Best-ID (single): " << ret << "\n");
+  } else {
+    CEBUG("No Best-ID found.\n");
+  }
+
+  CEBUG("Returning: " << ret << '\n');
+
+  FUNCEND();
+
+  return ret;
+
+  //  return 0;
+}
+
+
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+
+void Pathfinder::checkindex(int32 index)
+{
+  FUNCSTART("void checkindex(int32 index)");
+
+  if(index <0 || index>=static_cast<int32>(PAF_used_ids_ptr->size())){
+    cout << "Index given: " << index << "\tSize: " << PAF_used_ids_ptr->size() << "\n";
+    throw Notify(Notify::INTERNAL, THISFUNC,"Index overrun.");
+  }
+
+  FUNCEND();
+}
+
+
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+ 
+//#define FUNCTRACE(bla) { cout << THISFUNC << bla; cout.flush();}
+//#define CEBUG(bla)   {cout << bla; cout.flush(); }
+
+void Pathfinder::buildContig(vector<Align> & aligncache, int32 startid, Contig & con)
+{
+  FUNCSTART("void Pathfinder::buildContig(uint32 startid, Contig & con)");
+
+  CEBUG("bc 1" << endl);
+
+#ifndef PUBLICQUIET
+  cout << "mayaddmcmcoverlaps: " << PAF_mayaddmcmcoverlaps << endl;
+  cout << "musthonourmcmcflag: " << PAF_musthonourmcmcflag << endl;
+#endif
+
+  PAF_railoverlapcache.clear();
+
+  // if we�re starting with an existing contig (e.g. when relooping
+  //  or with backbones, the make sure to search whole contig first time)
+  if(startid<0) {
+    PAF_skipwholecontigscan_counter=1;
+  }else{
+    PAF_skipwholecontigscan_counter=PAF_pafparams.paf_skipwholecontigscan;
+  }
+
+  vector<int8> & PAF_used_ids = *PAF_used_ids_ptr;
+
+  Contig::errorstatus_t contigerrstat;
+  // this should speed up things a bit, avoiding copying during extension
+  //  although the 10000 might be not enough for really pathological cases
+  //  with many SRMB regions and huge coverage
+  contigerrstat.reads_affected.reserve(10000);
+  contigerrstat.srmb_reads_affected.reserve(10000);
+
+  // this is a kind of duplicate of PAF_used_ids_in_this_run, but I thought
+  //  that it could give faster access as only the really used ids are in there
+  
+  //vector<int32> ids_in_contig;
+  vector<int32> & ids_in_contig=*PAF_ids_in_contig_ptr;
+  ids_in_contig.clear();
+  ids_in_contig.reserve(PAF_used_ids.size()+10);
+
+  PAF_buildcontig_newlinecounter=0;
+
+
+  CEBUG("bc 2" << endl);
+
+  bool isbackboneassembly=false;
+  // do we start with a fresh contig?
+  if(con.getContigLength()==0) {
+    CEBUG("bc 3a 1" << endl);
+    if(startid<0) {
+      cerr << "Startid: " << startid << endl;
+      throw Notify(Notify::INTERNAL, THISFUNC,"Starting with non-existing read?");
+    }
+    
+    if(startid >= static_cast<int32>(PAF_used_ids.size())) {
+      cerr << "Startid: " << startid << endl;
+      throw Notify(Notify::INTERNAL, THISFUNC,"Starting with read id greater than number iof reads?\n");
+    }
+    
+    if(PAF_used_ids[startid]) {
+      cerr << "Startid: " << startid << endl;
+      throw Notify(Notify::INTERNAL, THISFUNC,"Starting with read that is already used?\n");
+    }
+    
+    CEBUG("Startid: " << startid << endl);
+    
+#ifndef PUBLICQUIET
+    cout << endl;
+#endif
+    
+    ++PAF_readaddattempts;
+    con.addRead(aligncache, 
+		NULL, startid, startid, 1, 
+		(*PAF_multicopies_ptr)[startid],
+		0,
+		contigerrstat);
+
+    CEBUG("bc 3a 2" << endl);
+
+    PAF_used_ids[startid]=1;
+    PAF_used_ids_in_this_run[startid]=1;
+    ids_in_contig.push_back(startid);
+    
+#ifndef PUBLICQUIET
+    cout << endl;
+#else
+    cout << "+";
+#endif
+  }else{
+    // we start with an already made contig,
+    // initialise needed values
+
+    CEBUG("bc 3b" << endl);
+
+    const vector<Contig::contigread_t> & cr=con.getContigReads();
+    vector<Contig::contigread_t>::const_iterator crI=cr.begin();
+
+    for(; crI!=cr.end(); crI++){
+      if(crI->orpid>=0){
+	PAF_used_ids_in_this_run[crI->orpid]=1;
+	ids_in_contig.push_back(crI->orpid);
+	//cout << "In contig:" << PAF_readpool->getRead(crI->id).getName() << endl;
+      }
+    }
+
+    CEBUG("bc 3b 2" << endl);
+
+    // check whether this this is a contig with a backbone (and therefore
+    //  also rails). If yes, we'll use bb assembly later
+    if(cr.front().read.isBackbone()) {
+      isbackboneassembly=true;
+#ifndef PUBLICQUIET
+      cout << "Backbone assembly to " << con.getContigName() << endl;
+#endif
+
+      prepareRailOverlapCache(con.getAllowedRefIDs());
+
+    }
+  }
+
+  CEBUG("bc 4" << endl);
+
+  struct tms mytms;
+  times(&mytms);
+  clock_t baseclocks=mytms.tms_utime+mytms.tms_stime;
+  clock_t actclocks=baseclocks;
+  clock_t maxallowedclocks=baseclocks+PAF_pafparams.paf_maxcontigclockticks;
+
+
+#ifdef CLOCK_STEPS1
+  vector<suseconds_t> us_pfsearch;
+  vector<suseconds_t> us_conadd;
+  vector<suseconds_t> us_overlapban;
+#endif
+
+  nextreadtoadd_t nrta;
+  nrta.newid=0;
+
+  uint32 statscounter=1;
+
+  // findNextBackboneOverlapQuick() uses these
+  bool allowbbqmulticopies=false;
+  bool allowbbqtroublemakers=false;
+  bool allowbbqsmallhits=false;
+
+  while(nrta.newid >= 0) {
+    cout.flush();
+
+    PAF_skipwholecontigscan_counter--;
+
+    if(PAF_skipwholecontigscan_counter<0) PAF_skipwholecontigscan_counter= PAF_pafparams.paf_skipwholecontigscan;
+;
+
+#ifndef PUBLICQUIET
+    if(statscounter % 25 == 0) {
+      cout << "rstatsm: len of c : " << con.getContigLength();
+      cout << "\nrstatsm: ids in c : " << ids_in_contig.size();
+      cout << "\nrstatsi: banned o : " << PAF_overlapsbanned;
+#ifdef CLOCK_STEPS1
+      cout << "\nrtimings: " << ids_in_contig.size();
+      cout << " : " << avg_suseconds(us_pfsearch);
+      cout << " / " << avg_suseconds(us_conadd);
+      cout << " / " << avg_suseconds(us_overlapban);
+#endif
+      cout << '\n';
+    }
+    statscounter++;
+#endif
+
+
+    nrta.refid=-1;
+    nrta.newid=-1;
+    nrta.weight=0;
+    nrta.direction_newid=0;
+    nrta.ads_node=NULL;
+    
+#ifdef CLOCK_STEPS1
+    timeval us_start;
+    gettimeofday(&us_start,NULL);
+#endif
+
+#ifndef PUBLICQUIET
+    cout << "Searching";
+#endif
+    if(nrta.newid < 0) {
+      if(isbackboneassembly){
+#ifndef PUBLICQUIET
+	cout << " (backbone quick) ...";
+	cout.flush();
+#endif
+	findNextBackboneOverlapQuick(nrta, 
+				     con.getAllowedRefIDs(),
+				     allowbbqmulticopies,
+				     allowbbqtroublemakers,
+				     allowbbqsmallhits);
+
+//	if(nrta.newid < 0) {
+//#ifndef PUBLICQUIET
+//	  cout << " (backbone normal) ...";
+//	  cout.flush();
+//#endif
+//	  findNextBackboneOverlapNormal(ids_in_contig, nrta, con.getAllowedRefIDs());
+//	}
+
+	if(nrta.newid < 0) {
+#ifndef PUBLICQUIET
+	  cout << "\nRebuilding overlap cache:";
+	  cout.flush();
+#endif
+	  prepareRailOverlapCache(con.getAllowedRefIDs());
+#ifndef PUBLICQUIET
+	  cout << " (backbone quick 2) ...";
+	  cout.flush();
+#endif
+	  findNextBackboneOverlapQuick(nrta, 
+				       con.getAllowedRefIDs(),
+				       allowbbqmulticopies,
+				       allowbbqtroublemakers,
+				       allowbbqsmallhits);
+
+
+	  if(nrta.newid < 0) {
+#ifndef PUBLICQUIET
+	    cout << "\nNow allowing small hits:";
+	    cout.flush();
+#endif
+	    prepareRailOverlapCache(con.getAllowedRefIDs());
+#ifndef PUBLICQUIET
+	    cout << " (backbone quick 3) ...";
+	    cout.flush();
+#endif
+	    allowbbqmulticopies=true;
+	    allowbbqtroublemakers=true;
+	    allowbbqsmallhits=true;
+	    findNextBackboneOverlapQuick(nrta, 
+					 con.getAllowedRefIDs(),
+					 allowbbqmulticopies,
+					 allowbbqtroublemakers,
+					 allowbbqsmallhits);
+
+	    if(nrta.newid < 0) {
+#ifndef PUBLICQUIET
+	      cout << "\nNow allowing multicopies and troublemakers:";
+	      cout.flush();
+#endif
+	      prepareRailOverlapCache(con.getAllowedRefIDs());
+#ifndef PUBLICQUIET
+	      cout << " (backbone quick 4) ...";
+	      cout.flush();
+#endif
+	    allowbbqmulticopies=true;
+	    allowbbqtroublemakers=true;
+	    findNextBackboneOverlapQuick(nrta, 
+					 con.getAllowedRefIDs(),
+					 allowbbqmulticopies,
+					 allowbbqtroublemakers,
+					 allowbbqsmallhits);
+	    }
+	  }
+	}
+
+
+
+//	if(nrta.newid < 0) {
+//#ifndef PUBLICQUIET
+//	  cout << " (full next bb overlap) ...";
+//	  cout.flush();
+//#endif
+//	  findNextOverlap(ids_in_contig, nrta);
+//	}
+      }else{
+#ifndef PUBLICQUIET
+	cout << " (full next overlap) ...";
+	cout.flush();
+#endif
+	findNextOverlap(ids_in_contig, nrta);
+      }
+    }
+
+#ifndef PUBLICQUIET
+      cout << " done.\n";
+      cout.flush();
+#endif
+
+#ifdef CLOCK_STEPS1
+      us_pfsearch.push_back(diffsuseconds(us_start));
+#endif
+
+
+    if(nrta.newid >= 0) {
+#ifndef PUBLICQUIET
+      cout << nrta;
+#endif
+
+#ifdef CLOCK_STEPS1
+      gettimeofday(&us_start,NULL);
+#endif
+      ++PAF_readaddattempts;
+      con.addRead(aligncache, 
+		  nrta.ads_node, nrta.refid, nrta.newid, nrta.direction_newid, 
+		  (*PAF_multicopies_ptr)[nrta.newid],
+		  0,
+		  contigerrstat);
+#ifdef CLOCK_STEPS1
+      us_conadd.push_back(diffsuseconds(us_start));
+#endif
+      
+      cout.flush();
+
+      //Contig::setCoutType(Contig::AS_TEXT);
+      //cout << ",,,,,,\n" << con << "\n\n";
+
+    
+      if(PAF_buildcontig_newlinecounter==0){
+	cout << "[" << ids_in_contig.size() << "] "; cout.flush();
+      }
+      if(contigerrstat.code == Contig::ENOERROR) {
+	ids_in_contig.push_back(nrta.newid);
+	PAF_used_ids[nrta.newid]=1;
+	PAF_used_ids_in_this_run[nrta.newid]=1;
+
+#ifndef PUBLICQUIET
+	cout << "\t+" << endl;
+#else
+	cout << "+";
+#endif
+
+	FUNCTRACE("bC bla1\n");
+
+	// if read could be added, do not propose a new right clip
+	(*PAF_proposedSRMrightclips_ptr)[nrta.newid]=-1;
+	//cout << "\nSRMClip: disallow " << PAF_readpool->getRead(nrta.newid).getName()<< '\n';
+
+	FUNCTRACE("bC bla2\n");
+
+	if((*PAF_multicopies_ptr)[nrta.newid] == 0) {
+	  PAF_nonmulticopiesadded++;
+	}
+
+	FUNCTRACE("bC bla3\n");
+
+	// if we added >=10 non-multicopies since the last reject
+	//  de-blacklist the reads that the added read links to
+	// TODO: check whether strategy can be improved with
+	//  "minimum number of new bases in contig left or right"
+	// TODO: make configurable?
+	if(PAF_nonmulticopiesadded >= 10) {
+	  vector<newedges_t>::iterator neI = (*PAF_lowerbound_oedges_ptr)[nrta.newid];
+	  for(; neI != PAF_forward_edges->end() && neI->rid1 == nrta.newid; neI++){
+	    if(PAF_blacklisted_ids[nrta.newid]==0) {
+	      PAF_blacklisted_ids[nrta.newid]=1;
+	    }
+	  }
+	}
+
+	FUNCTRACE("bC bla4\n");
+
+      } else {
+	// countdown the blacklist counter (if blacklist is used)
+	//  EXCEPT:
+	//  - when the reference ID is a backbone rail
+	//  - when the template partner is not a multicopy and in the contig
+	if(PAF_pafparams.paf_use_emergency_blacklist){
+	  bool doblacklist=true;
+	  if(PAF_readpool->getRead(nrta.refid).isRail()){
+	    doblacklist=false;
+	  }else if(PAF_readpool->getRead(nrta.refid).getTemplatePartnerID()>=0){
+	    if(! (*PAF_multicopies_ptr)[PAF_readpool->getRead(nrta.refid).getTemplatePartnerID()]
+	       && PAF_used_ids_in_this_run[PAF_readpool->getRead(nrta.refid).getTemplatePartnerID()]){
+	      doblacklist=false;
+	    }
+	  }
+
+	  if(doblacklist && PAF_blacklisted_ids[nrta.newid]){
+	    PAF_blacklisted_ids[nrta.newid]-=1;
+	  }
+	}
+
+	// reset the non-multycopiy counter so that de-blacklisting
+	//  can be performed once the counter will reach a threshold
+	PAF_nonmulticopiesadded=0;
+
+	switch(contigerrstat.code) {
+	case Contig::ENOALIGN : {
+#ifndef PUBLICQUIET
+	  cout << "\t-\tno align found\n";
+#else
+	  cout << 'a';
+#endif
+	  break;
+	}
+	case Contig::EDROPINRELSCORE : {
+#ifndef PUBLICQUIET
+	  cout << "\t-\tdrop in relscore too high\n";
+#else
+	  cout << 'd';
+#endif
+	  break;
+	}
+	case Contig::ETEMPLATEDIRECTION : {
+#ifndef PUBLICQUIET
+	  cout << "\t-\ttemplate in same direction\n";
+#else
+	  cout << 't';
+#endif
+	  break;
+	}
+	case Contig::ETEMPLATESIZE : {
+#ifndef PUBLICQUIET
+	  cout << "\t-\tmismatch in template size\n";
+#else
+	  cout << 's';
+#endif
+	  break;
+	}
+	case Contig::ESRMBMISMATCH : {
+#ifndef PUBLICQUIET
+	  cout << "\t-\tmismatch in SRMB zone\n";
+#else
+	  cout << 'p';
+#endif
+	  break;
+	}
+	case Contig::ESPECIALSRADDFAIL : {
+#ifndef PUBLICQUIET
+	  cout << "\t-\tfailed special SR add rules\n";
+#else
+	  cout << 'c';
+#endif
+
+	  // if read could not be added, propose a new right clip
+	  //cout << "SRMClip: " << PAF_readpool->getRead(nrta.newid).getName();
+	  //cout << "\nHave: " << (*PAF_proposedSRMrightclips_ptr)[nrta.newid];
+	  //cout << "\nPropose: " << contigerrstat.proposed_cutback << '\n';
+	  if(contigerrstat.proposed_cutback>(*PAF_proposedSRMrightclips_ptr)[nrta.newid]){
+	    //cout << "Newclip!\n";
+	    (*PAF_proposedSRMrightclips_ptr)[nrta.newid]=contigerrstat.proposed_cutback;
+	  }
+	  break;
+	}
+	case Contig::EREFIDNOTALLOWED : {
+#ifndef PUBLICQUIET
+	  cout << "\t-\trefid not allowed\n";
+#else
+	  cout << 'r';
+#endif
+	  break;
+	}
+	case Contig::EMAXCOVERAGEREACHED : {
+#ifndef PUBLICQUIET
+	  cout << "\t-\tmaxcoverage reached\n";
+#else
+	  cout << 'x';
+#endif
+	  break;
+	}
+	case Contig::EDANGERZONE : {
+#ifndef PUBLICQUIET
+	  cout << "\t-\ttoo many mismatches in danger zone(s)\n";
+#else
+	  cout << 'z';
+#endif
+	  break;
+	}
+	case Contig::EUNSPECIFIED : {
+#ifndef PUBLICQUIET
+	  cout << "\t-\tunspecified reject\n";
+#else
+	  cout << '?';
+#endif
+	  break;
+	}
+	default : {
+	  throw Notify(Notify::INTERNAL, THISFUNC,"Unknown errorcode from the contig object.");
+	}
+	}
+
+#ifndef PUBLICQUIET
+	cout.flush();
+#endif
+	// ban all alignments of that read with other reads that were
+	//  at the same position
+
+	//// debug: show all reads at that pos that the contig gave back
+	//{
+	//  cout << "\nReads affected:\n";
+	//  vector<int32>::const_iterator raI;
+	//  raI=contigerrstat.reads_affected.begin();
+	//  for(; raI != contigerrstat.reads_affected.end(); raI++){
+	//    cout << *raI << '\t' << (*PAF_readpool)[*raI].getName();
+	//    if((*PAF_readpool)[*raI].isBackbone()){
+	//      cout << "\tbackbone\n";
+	//    } else if((*PAF_readpool)[*raI].isRail()){
+	//      cout << "\trail\n";
+	//    }else{
+	//      cout << "\tseqtype: " << static_cast<uint16>((*PAF_readpool)[*raI].getSequencingType()) << '\n';
+	//    }
+	//  }
+	//}
+
+#ifdef CLOCK_STEPS1
+	gettimeofday(&us_start,NULL);
+#endif
+	{
+	  // First search look at the newedges_t block of nrta,newid overlaps
+	  //  and ban those overlaps whose reads are in the vector given back
+	  //  by the contig
+
+	  vector<newedges_t>::iterator neI = (*PAF_lowerbound_oedges_ptr)[nrta.newid];
+	  vector<int32>::const_iterator raI;
+	  for(; neI != PAF_forward_edges->end() && neI->rid1 == nrta.newid; neI++){
+	    if(!neI->pf_banned){
+	      raI=contigerrstat.reads_affected.begin();
+	      for(; raI != contigerrstat.reads_affected.end(); raI++){
+		if(*raI == neI->linked_with){
+		  //cout << "Banning1: " << neI->rid1 << '\t' << neI->linked_with << '\n';
+		  PAF_overlapsbanned++;
+		  neI->pf_banned=true;
+		  if(PAF_overlapsbanned_smallstore.size()<PAF_overlapsbanned_smallstore.capacity()){
+		    PAF_overlapsbanned_smallstore.push_back(neI);
+		  }
+		  break;
+		}
+	      }
+	    }
+	  }
+
+	  // Now look at the blocks of newedges_t whose reads are given
+	  //  by by the vector and who overlap with nrta.newid
+	  raI=contigerrstat.reads_affected.begin();
+	  for(; raI != contigerrstat.reads_affected.end(); raI++){
+	    neI = (*PAF_lowerbound_oedges_ptr)[*raI];
+	    for(; neI != PAF_forward_edges->end() && neI->rid1 == *raI; neI++){
+	      if(!neI->pf_banned){
+		if(neI->linked_with == nrta.newid){
+		  //cout << "Banning2: " << neI->rid1 << '\t' << neI->linked_with << '\n';
+		  PAF_overlapsbanned++;
+		  neI->pf_banned=true;
+		  if(PAF_overlapsbanned_smallstore.size()<PAF_overlapsbanned_smallstore.capacity()){
+		    PAF_overlapsbanned_smallstore.push_back(neI);
+		  }
+		  break;
+		  // NOTE: should MIRA ever get multiple overlaps between
+		  //  two reads, then the "break;" above must be removed
+		  //  should be safe for now.
+		}
+	      }
+	    }
+	  }
+	}
+
+#ifdef CLOCK_STEPS1
+	us_overlapban.push_back(diffsuseconds(us_start));
+#endif
+      }
+
+#ifndef PUBLICQUIET
+#else
+      PAF_buildcontig_newlinecounter++;
+      if(PAF_buildcontig_newlinecounter==60){
+	PAF_buildcontig_newlinecounter=0;
+	cout << "   " << con.getContigLength();
+#ifdef CLOCK_STEPS1
+	cout << "\t" << avg_suseconds(us_pfsearch);
+	cout << " / " << avg_suseconds(us_conadd);
+	cout << " / " << avg_suseconds(us_overlapban);
+#endif
+	cout << endl;
+      }
+#endif
+
+
+    }
+
+    //if(con.getNumReadsInContig()==1198){
+    //  cout << "\npathfinder debugstop.\n";
+    //  assout::saveAsCAF(con, "test.caf", true);
+    //  abort();
+    //}
+
+    if(PAF_pafparams.paf_use_max_contig_buildtime){
+      times(&mytms);
+      actclocks=mytms.tms_utime+mytms.tms_stime;
+      if(actclocks>maxallowedclocks){
+	// the following should not be necessary, but just to be sure
+	// (had a case where the disk got full and MIRA was stuck in
+	//  endless loop ... calling times()
+	// so I set the loop ending condition manually
+	nrta.newid=-1;
+
+	cout << "\nMaximum build time for this contig reached, aborting build.\n";
+	PAF_railoverlapcache.clear();
+	FUNCEND();
+	return;
+      }
+    }
+  }
+
+  PAF_railoverlapcache.clear();
+
+  FUNCEND();
+}
+//#define FUNCTRACE(bla)
+
+//#define CEBUG(bla)
+
+
+
+
+
+
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+
+//#define CEBUG(bla)   {cout << bla; cout.flush(); }
+
+void Pathfinder::prepareRailOverlapCache(const vector<bool> & allowedrefids)
+{
+  vector<int8> & PAF_used_ids = *PAF_used_ids_ptr;
+
+  // initialise PAF_railoverlapcache
+  // each read that has an overlap with a rail is put into the
+  //  vector once;
+  PAF_railoverlapcache.clear();
+  PAF_railoverlapcache.reserve(PAF_used_ids.size());
+  vector<uint8> tmp_alreadyinvec(PAF_used_ids.size(),0);
+
+  // put first non-sanger types in vector, then sanger types
+  // as vector will be worked backwards, sanger will get first
+  vector<newedges_t>::const_iterator rcI=PAF_forward_edges->begin();
+  for(;rcI!=PAF_forward_edges->end(); rcI++){
+    CEBUG('\n' << *rcI);
+    CEBUG('1');
+    if(rcI->pf_banned
+       || (!allowedrefids.empty() && !allowedrefids[rcI->linked_with])) continue;
+    CEBUG('2');
+    if(PAF_readpool->getRead(rcI->linked_with).isRail()
+       && !PAF_readpool->getRead(rcI->rid1).isRail()){
+      CEBUG('3');
+      if(PAF_used_ids_in_this_run[rcI->linked_with]
+	 && !PAF_used_ids[rcI->rid1]){
+	CEBUG('4');
+	if(!tmp_alreadyinvec[rcI->rid1]
+	   && !PAF_readpool->getRead(rcI->rid1).isSequencingType(Read::SEQTYPE_SANGER)){
+	  CEBUG('5');
+	  tmp_alreadyinvec[rcI->rid1]=1;
+	  PAF_railoverlapcache.push_back(rcI->rid1);
+	}
+      }
+    }
+  }
+
+#ifndef PUBLICQUIET
+  cout << "Backbone overlap cache (non SANGER): " << PAF_railoverlapcache.size() << endl;
+#endif
+
+  rcI=PAF_forward_edges->begin();
+  for(;rcI!=PAF_forward_edges->end(); rcI++){
+    CEBUG('\n' << *rcI);
+    CEBUG('1');
+    if(rcI->pf_banned
+       || (!allowedrefids.empty() && !allowedrefids[rcI->linked_with])) continue;
+    CEBUG('2');
+    if(PAF_readpool->getRead(rcI->linked_with).isRail()
+       && !PAF_readpool->getRead(rcI->rid1).isRail()){
+      CEBUG('3');
+      if(PAF_used_ids_in_this_run[rcI->linked_with]
+	 && !PAF_used_ids[rcI->rid1]){
+	CEBUG('4');
+	if(!tmp_alreadyinvec[rcI->rid1]
+	   && PAF_readpool->getRead(rcI->rid1).isSequencingType(Read::SEQTYPE_SANGER)){
+	  CEBUG('5');
+	  tmp_alreadyinvec[rcI->rid1]=1;
+	  PAF_railoverlapcache.push_back(rcI->rid1);
+	}
+      }
+    }
+  }
+
+
+#ifndef PUBLICQUIET
+  cout << "Backbone overlap cache (non SANGER & SANGER): " << PAF_railoverlapcache.size() << endl;
+#endif
+}
+
+//#define CEBUG(bla) 
+
+
+// Search for overlaps of reads that are in the contig 
+// expects resultread to contain illegal/empty reference
+// version for backbone assembly
+
+//#define CEBUG(bla)   {cout << bla; cout.flush();}
+
+void Pathfinder::findNextBackboneOverlapNormal(const vector<int32> & readsincontig, nextreadtoadd_t & resultread, const vector<bool> & allowedrefids, bool allowmulticopies, bool allowtroublemakers)
+{
+  FUNCSTART("void Pathfinder::findNextBackboneOverlapNormal(vector<int32> & readsincontig, nextreadtoadd_t & resultread, const vector<bool> & allowedrefids, bool allowmulticopies, bool allowtroublemakers)");
+
+  const vector<int8> & PAF_used_ids = *PAF_used_ids_ptr;
+  const vector<uint8> & PAF_multicopies = *PAF_multicopies_ptr;
+  const vector<uint8> & PAF_istroublemaker = *PAF_istroublemaker_ptr;
+
+  if(readsincontig.size()==0) {
+    throw Notify(Notify::INTERNAL, THISFUNC,"No reads present in contig?");
+  }
+
+  vector<int32>::const_iterator rcI=readsincontig.begin();
+  //for(uint32 index=0; index <readsincontig.size() ; index++, rcI++) {
+  //  int32 readid=readsincontig[index];
+  for(; rcI != readsincontig.end() ; rcI++) {
+    //// read in contig is blacklisted (==no more un-assembled partners)?
+    //// -> next loop iteration
+    // are backbones blacklisted???
+    //if(PAF_blacklisted_ids[*rcI] == 0) continue;
+
+    CEBUG("Check: " <<  PAF_readpool->getRead(*rcI).getName() << "\tRail? " << PAF_readpool->getRead(*rcI).isRail() << '\n');
+
+    // read in contig is not rail? next loop iteration
+    if(!PAF_readpool->getRead(*rcI).isRail()) continue;
+
+    // contig has list of allowed refids and read is not allowed? next loop
+    if(!allowedrefids.empty() && !allowedrefids[*rcI]) continue;
+
+    vector<newedges_t>::const_iterator I=(*PAF_lowerbound_oedges_ptr)[*rcI];
+
+    for(;I!=PAF_forward_edges->end() && I->rid1 == *rcI;I++){
+      // the edges are sorted by rid1, then by "bestweight: high to low"
+      //  therefore, if the current bestweight is <= the one we have found already,
+      //  we do not need to check further edges of this read ... all remaining
+      //  edges have lower or equal quality anyway. Therefore, break out of loop
+      //  here if possible
+      if(I->best_weight <= resultread.weight) break;
+
+      // don't bother looking at if overlap is banned
+      if(I->pf_banned) continue;
+
+      //int32 linkedwithid=I->linked_with;
+      
+      CEBUG("  with: " << PAF_readpool->getRead(I->linked_with).getName());
+
+      // don't bother looking at if read linked to is already used 
+      // or read is blacklisted
+      if(PAF_used_ids[I->linked_with] !=0) {
+	CEBUG(" already used!\n");
+	continue;
+      }
+      if(PAF_blacklisted_ids[I->linked_with]==0) {
+	CEBUG(" blacklisted!\n");
+	continue;
+      }
+
+      // if necessary, take into account only reads that are
+      //  - non-multicopies
+      //  - non-troublemakers
+      if((allowmulticopies || PAF_multicopies[I->linked_with]==0)
+	&& (allowtroublemakers || PAF_istroublemaker[I->linked_with] == 0)){
+
+	CEBUG(" non-MC/TM. Ibw:" << I->best_weight << "\trrw: " << resultread.weight << "\toll: " <<(*PAF_adsfacts)[I->adsfindex].getOverlapLen());
+
+	////  - that have overlap length >= min length for quick bb overlap (just to have a good match)
+	//if(I->best_weight > resultread.weight
+	//   && (*PAF_adsfacts)[I->adsfindex].getOverlapLen() >= (*PAF_miraparams)[PAF_readpool->getRead(I->linked_with).getSequencingType()].getPathfinderParams().paf_bbquickoverlap_minlen) {
+	if(I->best_weight > resultread.weight){
+	  CEBUG(" take it.");
+	  resultread.refid=*rcI;
+	  resultread.newid=I->linked_with;
+	  resultread.weight=I->best_weight;
+	  resultread.direction_newid=I->direction;
+	  resultread.ads_node=&(*PAF_adsfacts)[I->adsfindex];
+	  resultread.foundmethod=FOUND_RAIL_AND_NONMULTICOPY;
+	}else{
+	  CEBUG(" don't take.");
+	}
+	CEBUG('\n');
+      }else{
+	CEBUG(" MC or TM.\n");
+      }
+    }
+
+  }
+}
+
+//#define CEBUG(bla)
+
+
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+
+// reverse logic compared to findNextBackboneOverlapNormal()
+// Take one non-rail, find best place for a it in existing contig
+// Disregard multicopies and troublemakers
+
+// expects resultread to contain illegal/empty reference
+void Pathfinder::findNextBackboneOverlapQuick(nextreadtoadd_t & resultread, const vector<bool> & allowedrefids, bool allowmulticopies, bool allowtroublemakers, bool allowsmallhits)
+{
+  FUNCSTART("void Pathfinder::findNextBackboneOverlap(nextreadtoadd_t & resultread, const vector<bool> & allowedrefids, bool allowmulticopies, bool allowtroublemakers)");
+
+  const vector<int8> & PAF_used_ids = *PAF_used_ids_ptr;
+  const vector<uint8> & PAF_multicopies = *PAF_multicopies_ptr;
+  const vector<uint8> & PAF_istroublemaker = *PAF_istroublemaker_ptr;
+
+#ifndef PUBLICQUIET
+  cout << "roc: " << PAF_railoverlapcache.size() << ' ';
+#endif
+
+//#define CEBUG(bla)   {if(readid==17145) {cout << bla; cout.flush();}}
+
+  while(resultread.newid<0){
+    bool continuesearch=true;
+    int32 readid=-1;
+    while(continuesearch && !PAF_railoverlapcache.empty()){
+      readid=PAF_railoverlapcache.back();
+
+      CEBUG("\nfnboq:\n");
+      CEBUG("l: " << PAF_readpool->getRead(readid).getName());
+      CEBUG("\tused: " << (int16) PAF_used_ids[readid]);
+      CEBUG("\tmc: " << (int16) PAF_multicopies[readid]);
+      CEBUG("\ttm: " << (int16) PAF_istroublemaker[readid]);
+      if(!allowedrefids.empty()){
+	CEBUG("\tar: " << (int16) allowedrefids[readid]);
+      }
+
+      PAF_railoverlapcache.pop_back();
+      
+      if(PAF_used_ids[readid]==0
+	 && (allowmulticopies || PAF_multicopies[readid]==0)
+	 && (allowtroublemakers || PAF_istroublemaker[readid]==0)){
+	continuesearch=false;
+//#ifndef PUBLICQUIET
+//	cout << "stopsearch ";
+//#endif
+      }
+//#ifndef PUBLICQUIET
+//      else {
+//	cout << "(* r *)";
+//      }
+//#endif
+    }
+
+
+    if(continuesearch){
+      CEBUG("\tnot taken/found\n");
+      // found nothing in previous loop, exit
+      return;
+    }
+    
+    CEBUG("\ttaken/found\n");
+    
+    // ok, found one. Now search the rail it fits best to *in this contig* 
+    vector<newedges_t>::const_iterator I=(*PAF_lowerbound_oedges_ptr)[readid];
+    
+    for(;I!=PAF_forward_edges->end() && I->rid1 == readid;I++){
+      // don't bother looking at if overlap is banned
+      if(I->pf_banned) continue;
+      // must link to rail
+      if(!PAF_readpool->getRead(I->linked_with).isRail()) continue;
+      // rail must be in this contig!
+      if(!PAF_used_ids_in_this_run[I->linked_with]) continue;
+      // rail must be allowed as refid
+      if((!allowedrefids.empty() && !allowedrefids[I->linked_with])) continue;
+     
+      // if necessary, take into account only rails that are
+      //  - non-multicopies
+      //  - non-troublemakers
+      if((allowmulticopies || PAF_multicopies[I->linked_with]==0)
+	 && (allowtroublemakers || PAF_istroublemaker[I->linked_with] == 0)){
+	//  - that have overlap length >= minim length (just to have 
+	//    good matches first)
+	if(I->best_weight > resultread.weight){
+	  if(allowsmallhits
+	     || (*PAF_adsfacts)[I->adsfindex].getOverlapLen() >= 
+	     (*PAF_miraparams)[PAF_readpool->getRead(readid).getSequencingType()].getPathfinderParams().paf_bbquickoverlap_minlen) {
+	    resultread.refid=I->linked_with;
+	    resultread.newid=readid;
+	    resultread.weight=I->best_weight;
+	    resultread.direction_newid=I->direction;
+	    resultread.ads_node=&(*PAF_adsfacts)[I->adsfindex];
+	    if(PAF_multicopies[readid]==0){
+	      resultread.foundmethod=FOUND_RAIL_AND_NONMULTICOPY;
+	    }else{
+	      resultread.foundmethod=FOUND_RAIL_AND_MULTICOPY;
+	    }
+	    // the edges are sorted by rid1, then by "bestweight: high to low"
+	    // therefore, if we wound something, we do not need to check further
+	    // edges of this read ... all remaining edges have lower or equal
+	    // quality anyway. Therefore, break out of loop here
+	    break;
+	  }
+	}
+      }
+    }
+  }
+}
+
+//#define CEBUG(bla)
+
+
+
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+
+// Search for overlaps of reads that are in the contig 
+// expects resultread to contain illegal/empty reference
+
+//#define CEBUGF(bla)   {cout << bla; cout.flush();}
+
+void Pathfinder::findNextOverlap(const vector<int32> & readsincontig, nextreadtoadd_t & resultread) 
+{
+  FUNCSTART("void Pathfinder::findNextOverlap(vector<int32> & readsincontig, nextreadtoadd_t & resultread)");
+
+  const vector<int8> & PAF_used_ids = *PAF_used_ids_ptr;
+  const vector<uint8> & PAF_multicopies = *PAF_multicopies_ptr;
+  const vector<uint8> & PAF_istroublemaker = *PAF_istroublemaker_ptr;
+
+  if(readsincontig.size()==0) {
+    throw Notify(Notify::INTERNAL, THISFUNC,"No reads present in contig?");
+  }
+
+  vector<nextreadtoadd_t> bestreads(FOUND_ENUMEND,resultread);
+
+  
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
+#endif
+  bool   usetemplateinfo=(*PAF_miraparams)[Read::SEQTYPE_SANGER].getPathfinderParams().paf_use_template_information;
+  usetemplateinfo|=(*PAF_miraparams)[Read::SEQTYPE_454GS20].getPathfinderParams().paf_use_template_information;
+  usetemplateinfo|=(*PAF_miraparams)[Read::SEQTYPE_IONTORRENT].getPathfinderParams().paf_use_template_information;
+  usetemplateinfo|=(*PAF_miraparams)[Read::SEQTYPE_PACBIO].getPathfinderParams().paf_use_template_information;
+  usetemplateinfo|=(*PAF_miraparams)[Read::SEQTYPE_SOLEXA].getPathfinderParams().paf_use_template_information;
+  usetemplateinfo|=(*PAF_miraparams)[Read::SEQTYPE_ABISOLID].getPathfinderParams().paf_use_template_information;
+
+  // this one says: if the read in question is repetitive and its
+  //  partner not, then the partner must be in use (not necessarily
+  //  the same contig)
+  bool usestricttemplatepairrule=usetemplateinfo && true;
+
+
+
+  bool   usequickruleSAN=(*PAF_miraparams)[Read::SEQTYPE_SANGER].getPathfinderParams().paf_use_quick_rule;
+  bool   usequickrule454=(*PAF_miraparams)[Read::SEQTYPE_454GS20].getPathfinderParams().paf_use_quick_rule;
+  bool   usequickruleION=(*PAF_miraparams)[Read::SEQTYPE_IONTORRENT].getPathfinderParams().paf_use_quick_rule;
+  bool   usequickrulePBS=(*PAF_miraparams)[Read::SEQTYPE_PACBIO].getPathfinderParams().paf_use_quick_rule;
+
+  bool   usequickruleSHORTREADS=true;
+
+  bool speedymap=false;
+
+  // counter for how many "insanely high coverage" reads we found
+  //uint32 indigestible=0;
+
+  struct tms mytms;
+  times(&mytms);
+  clock_t baseclocks=mytms.tms_utime+mytms.tms_stime;
+  clock_t actclocks=baseclocks;
+  clock_t maxallowedclocks=baseclocks+PAF_pafparams.paf_nextread_maxcttoess;
+
+  // going backwards through the contglist should be a tick faster than forward
+  //  also helps to retain a bit of flexibility when emergency search stops occur
+  //for(uint32 index=0; index < readsincontig.size() ; index++) {
+
+  // like variable "notfoundyet" below, this speeds up search but
+  //  makes order of checks important
+  bool needsearchnormal=true;
+  bool foundsolution=false;
+
+
+  // make at most two loops: 
+  //  in first try find next read via shortcut (looking at last 50 reads
+  //  added to contig)
+  //  if not found, search all reads of contig for next read to add
+  // start directly with second loop 
+  // TODO: this is ... less than beautiful.
+  int8 searchloops=0;
+  if(PAF_skipwholecontigscan_counter>1) searchloops=1;
+  for(; searchloops>=0 && !foundsolution; searchloops--){
+    
+    // TODO: flexibilisieren? hits < l�nge oder relscore -> reloop?
+
+    int32 dontlookatreads=0;
+    
+    int32 index=readsincontig.size()-1;
+
+    // TODO: check whether 15 is reasonable. Make configurable.
+    // (50 works well, but too slow for assemblies with 454 data)
+    if(searchloops>0){
+      if(PAF_skipwholecontigscan_counter>1) {
+	dontlookatreads=readsincontig.size()-1-15;
+	if(dontlookatreads<0) dontlookatreads=0;
+      }
+    }else{
+      if(PAF_skipwholecontigscan_counter>1){
+	index=readsincontig.size()-1-15-1;
+	if(index<0) index=0;
+      }
+    }
+
+    uint32 numreadschecked=0;
+    for(; index >=dontlookatreads ; index--, numreadschecked++) {
+      int32 readid=readsincontig[index];
+      
+      CEBUGF("fnO: new read " << readid << '\n');
+
+      // read in contig is blacklisted (==no more un-assembled partners)?
+      // -> next loop iteration
+      if(PAF_blacklisted_ids[readid] == 0) continue;
+
+      vector<newedges_t>::const_iterator I=(*PAF_lowerbound_oedges_ptr)[readid];
+
+      uint32 numpotentialpartners=0;
+      
+      for(;I!=PAF_forward_edges->end() && I->rid1 == readid;I++){
+
+	CEBUGF("fNO: " <<  I->rid1 << '\t' << I->linked_with << '\n');
+
+	// don't bother looking at if overlap is banned
+	if(I->pf_banned) continue;
+
+	CEBUGF("#1\n");
+	int32 linkedwithid=I->linked_with;
+
+	CEBUGF("#2\n");
+	// don't bother looking at if read linked to is already used 
+	if(PAF_used_ids[linkedwithid] !=0) continue;
+
+	CEBUGF("#3\n");
+
+	// don't bother looking at if 
+	//  we may add mcmc, do not add non-mc/non-mc overlaps
+	//  we may not add mcmc, do not add mc/mc overlaps
+	if(PAF_musthonourmcmcflag){
+	  if(PAF_mayaddmcmcoverlaps){
+	    if(!(*PAF_multicopies_ptr)[readid]
+	       && !(*PAF_multicopies_ptr)[linkedwithid]) continue;
+	  }else{
+	    if((*PAF_multicopies_ptr)[readid]
+	       && (*PAF_multicopies_ptr)[linkedwithid]) continue;
+	  }
+	}
+
+	CEBUGF("#4\n");
+
+	// increase potential partners before looking at blacklisted ids
+	//  as ids in the blacklist can be removed over time!
+	numpotentialpartners++;
+
+	if(PAF_blacklisted_ids[linkedwithid]==0) continue;
+
+	CEBUGF("#5\n");
+
+	// todo hier weiter erst reads deren template partner im contig ist!
+	// has linked a SRMB tag?
+	int32 otherread_partnerid=PAF_readpool->getRead(linkedwithid).getTemplatePartnerID();
+
+	// do not build in multicopy reads with a paired end partner
+	//  where the partner is not in use
+	if(usestricttemplatepairrule
+	   && otherread_partnerid>=0
+	   && PAF_multicopies[linkedwithid]
+	   && !PAF_multicopies[otherread_partnerid]
+	   && !PAF_used_ids[otherread_partnerid]) continue;
+
+	// IMPORTANT!
+	// notfoundyet is used to save time
+	// use of the "notfoundyet" variable implicits the order
+	//  of evaluation at the end of the function to see which read
+	//  to really take!
+	bool notfoundyet=true;
+
+	CEBUGF("#6\n");
+
+	// if linkedwith is a troublemaker, don't care to look at it here!
+	if(usetemplateinfo && otherread_partnerid>=0){
+	  CEBUGF("#7\n");
+	  if(PAF_istroublemaker[linkedwithid] == 0) {
+	    CEBUGF("#8\n");
+	    // is linked with template partner already in the contig?
+	    if(PAF_used_ids_in_this_run[otherread_partnerid] > 0) {
+	      // yes, excellent
+	      CEBUGF("#9\n");
+	      if(I->best_weight > bestreads[FOUND_TPARTNER_IN_CONTIG].weight) {
+		CEBUGF("#x1\n");
+		bestreads[FOUND_TPARTNER_IN_CONTIG].refid=readid;
+		bestreads[FOUND_TPARTNER_IN_CONTIG].newid=linkedwithid;
+		bestreads[FOUND_TPARTNER_IN_CONTIG].weight=I->best_weight;
+		bestreads[FOUND_TPARTNER_IN_CONTIG].direction_newid=I->direction;
+		bestreads[FOUND_TPARTNER_IN_CONTIG].ads_node=&(*PAF_adsfacts)[I->adsfindex];
+		notfoundyet=false;
+		foundsolution=true;
+		needsearchnormal=false;
+	      }
+	    } else {
+	      CEBUGF("#a\n");
+	      // nope, well, still good
+	      if(I->best_weight > bestreads[FOUND_TEMPLATE_AND_TPARTNER].weight) {
+		CEBUGF("#x2\n");
+		bestreads[FOUND_TEMPLATE_AND_TPARTNER].refid=readid;
+		bestreads[FOUND_TEMPLATE_AND_TPARTNER].newid=linkedwithid;
+		bestreads[FOUND_TEMPLATE_AND_TPARTNER].weight=I->best_weight;
+		bestreads[FOUND_TEMPLATE_AND_TPARTNER].direction_newid=I->direction;
+		bestreads[FOUND_TEMPLATE_AND_TPARTNER].ads_node=&(*PAF_adsfacts)[I->adsfindex];
+		
+		notfoundyet=false;
+		foundsolution=true;
+		needsearchnormal=false;
+		if(PAF_multicopies[linkedwithid]==0){
+		  bestreads[FOUND_TEMPLATE_NONMULTICOPY_AND_TPARTNER]=bestreads[FOUND_TEMPLATE_AND_TPARTNER];
+		}
+	      }
+	    }
+	  }
+	}
+
+	CEBUGF("#b\n");
+
+	if(PAF_readpool->getRead(linkedwithid).isSequencingType(Read::SEQTYPE_SOLEXA)) {
+	  CEBUGF("#c\n");
+	  // temporarily backported and adapted from n4 functions
+	  //
+	  // special rule: if fully contained read with 100% match
+	  //  take that one immediately and break the for loop
+	  // immediately take that read
+	  if((*PAF_adsfacts)[I->adsfindex].getScoreRatio()==100
+	     && (*PAF_adsfacts)[I->adsfindex].getOverlapLen()== PAF_readpool->getRead(linkedwithid).getLenClippedSeq()){
+	    CEBUGF("#x3\n");
+	    bestreads[FOUND_NORMAL].refid=readid;
+	    bestreads[FOUND_NORMAL].newid=linkedwithid;
+	    bestreads[FOUND_NORMAL].weight=I->best_weight;
+	    bestreads[FOUND_NORMAL].direction_newid=I->direction;
+	    bestreads[FOUND_NORMAL].ads_node=&(*PAF_adsfacts)[I->adsfindex];
+	    notfoundyet=false;
+	    foundsolution=true;
+	    speedymap=true;
+	    break;
+	  }
+	}
+
+	CEBUGF("#d\n");
+	if(notfoundyet && needsearchnormal) {
+	  CEBUGF("#e\n");
+	  if(I->best_weight > bestreads[FOUND_NORMAL].weight) {
+	    CEBUGF("#x4\n");
+	    bestreads[FOUND_NORMAL].refid=readid;
+	    bestreads[FOUND_NORMAL].newid=linkedwithid;
+	    bestreads[FOUND_NORMAL].weight=I->best_weight;
+	    bestreads[FOUND_NORMAL].direction_newid=I->direction;
+	    bestreads[FOUND_NORMAL].ads_node=&(*PAF_adsfacts)[I->adsfindex];
+	    notfoundyet=false;
+	    foundsolution=true;
+	  
+	    if(PAF_multicopies[linkedwithid]==0){
+	      //cout << "^^^���";
+	      bestreads[FOUND_NONMULTICOPY]=bestreads[FOUND_NORMAL];
+	    }
+	  }
+	}
+	if(notfoundyet && needsearchnormal) {
+	  CEBUGF("#f\n");
+	  bool linkedhasSRMB=PAF_readpool->getRead(linkedwithid).hasTag(Read::REA_tagentry_idSRMr);
+
+	  if(linkedhasSRMB
+	     && I->best_weight > bestreads[FOUND_NORMAL_AND_SRMB].weight) {
+	    CEBUGF("#x5\n");
+	    bestreads[FOUND_NORMAL_AND_SRMB].refid=readid;
+	    bestreads[FOUND_NORMAL_AND_SRMB].newid=linkedwithid;
+	    bestreads[FOUND_NORMAL_AND_SRMB].weight=I->best_weight;
+	    bestreads[FOUND_NORMAL_AND_SRMB].direction_newid=I->direction;
+	    bestreads[FOUND_NORMAL_AND_SRMB].ads_node=&(*PAF_adsfacts)[I->adsfindex];
+	    notfoundyet=false;
+	    foundsolution=true;
+	  }
+	}
+      }
+
+      // If the read we looked at had absolutely no more (un-assembled)
+      //  partner reads, blacklist it
+      if(numpotentialpartners==0) {
+	PAF_blacklisted_ids[readid]= 0;	
+      }
+
+
+      if(speedymap){
+#ifndef PUBLICQUIET
+	cout << " speedymap (backported)";
+#endif
+	index=-1;
+	break;
+      }
+
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
+#endif
+      // If wished, we'll use quick rules (premature stop of searching)
+      //
+      if((usequickrule454 || usequickruleION || usequickruleSAN || usequickrulePBS || usequickruleSHORTREADS)
+	 && (bestreads[FOUND_NONMULTICOPY].weight > 0
+	     || bestreads[FOUND_TPARTNER_IN_CONTIG].weight >0 )){
+	uint32 index2take=FOUND_NONMULTICOPY;
+	if(bestreads[FOUND_TPARTNER_IN_CONTIG].weight >0){
+	  index2take=FOUND_TPARTNER_IN_CONTIG;
+	}
+
+	bool mayusequick=false;
+	uint8 seqtypenewread=PAF_readpool->getRead(bestreads[index2take].newid).getSequencingType();
+	switch(seqtypenewread){
+	case Read::SEQTYPE_SANGER : {
+	  if(usequickruleSAN) mayusequick=true;
+	  break;
+	}
+	case Read::SEQTYPE_454GS20  : {
+	  if(usequickrule454) mayusequick=true;
+	  break;
+	}
+	case Read::SEQTYPE_IONTORRENT : {
+	  if(usequickruleION) mayusequick=true;
+	  break;
+	}
+	case Read::SEQTYPE_SOLEXA :
+	case Read::SEQTYPE_ABISOLID : {
+	  if(usequickruleSHORTREADS) mayusequick=true;
+	  break;
+	}
+	case Read::SEQTYPE_PACBIO : {
+	  if(usequickrulePBS) mayusequick=true;
+	  break;
+	}
+	default : {
+	  MIRANOTIFY(Notify::INTERNAL, "Oooops? seqtypenewread not handled by switch?" << static_cast<uint16>(seqtypenewread) << endl);
+	}
+	}
+
+	if(mayusequick && n4_checkQuickRules(bestreads[index2take].ads_node,bestreads[index2take].newid)){
+	  index=-1;
+	  break;
+	}
+
+
+	// This thing is a BAD idea, test with GLL 14k were catastrophic
+//	// every 5 reads checked:
+//	// if the score ratio is 100% (regardless of the length) take it
+//	if(numreadschecked>0 && numreadschecked%5 == 0
+//	   && bestreads[FOUND_NONMULTICOPY].ads_node->getScoreRatio() == 100){
+//#ifndef PUBLICQUIET
+//	  cout << " 454 quick rule 2";
+//#endif
+//	  index=-1;
+//	  break;
+//	}
+
+
+      }
+
+
+      // the "used time" foolguard for extremely high coverage areas
+      //  will not search for optimum then
+      if(PAF_pafparams.paf_use_emergency_search_stop){
+	times(&mytms);
+	actclocks=mytms.tms_utime+mytms.tms_stime;
+	//cout << "Actclocks: " << actclocks << "\tmaxallowedclocks: " << maxallowedclocks << endl;
+	if(actclocks>maxallowedclocks){
+	  // the following should not be necessary, but just to be sure
+	  // (had a case where the disk got full and MIRA was stuck in
+	  //  endless loop ... calling times()
+	  // so I set the loop ending condition manually
+	  index=-1;
+
+#ifndef PUBLICQUIET
+	  cout << " max time, ess activated ";
+#else
+	  cout << "*";
+#endif
+	  cout.flush();
+
+	  break;
+	}
+      }
+
+    }
+  }
+
+  // this order is implicitly defined by the order of checks above when 
+  //  using the "notfoundyet" bool variable
+  if(PAF_pafparams.paf_use_genomic_algorithms) {
+
+    CEBUGF("FOUND_RAIL_AND_NONMULTICOPY: ");
+    CEBUGF(bestreads[FOUND_RAIL_AND_NONMULTICOPY].weight << endl);
+    CEBUGF("FOUND_TPARTNER_IN_CONTIG: ");
+    CEBUGF(bestreads[FOUND_TPARTNER_IN_CONTIG].weight << endl);
+    CEBUGF("FOUND_TEMPLATE_NONMULTICOPY_AND_TPARTNER: ");
+    CEBUGF(bestreads[FOUND_TEMPLATE_NONMULTICOPY_AND_TPARTNER].weight << endl);
+    CEBUGF("FOUND_TEMPLATE_AND_TPARTNER: ");
+    CEBUGF(bestreads[FOUND_TEMPLATE_AND_TPARTNER].weight << endl);
+    CEBUGF("FOUND_NONMULTICOPY: ");
+    CEBUGF(bestreads[FOUND_NONMULTICOPY].weight << endl);
+    CEBUGF("FOUND_NORMAL: ");
+    CEBUGF(bestreads[FOUND_NORMAL].weight << endl);
+    CEBUGF("FOUND_NORMAL_AND_SRMB: ");
+    CEBUGF(bestreads[FOUND_NORMAL_AND_SRMB].weight << endl);
+
+    uint32 takewhich=FOUND_NORMAL_AND_SRMB;
+    if(speedymap){
+      resultread=bestreads[FOUND_NORMAL];
+      resultread.foundmethod=FOUND_SPEEDYMAP;
+    }else{
+      if(bestreads[FOUND_NORMAL].refid >= 0) takewhich=FOUND_NORMAL;
+      if(bestreads[FOUND_NONMULTICOPY].weight<<4 >= bestreads[takewhich].weight) takewhich=FOUND_NONMULTICOPY;
+      if(bestreads[FOUND_TEMPLATE_AND_TPARTNER].weight<<4 >= bestreads[takewhich].weight) takewhich=FOUND_TEMPLATE_AND_TPARTNER;
+      if(bestreads[FOUND_TEMPLATE_NONMULTICOPY_AND_TPARTNER].weight<<4 >= bestreads[takewhich].weight) takewhich=FOUND_TEMPLATE_NONMULTICOPY_AND_TPARTNER;
+      if(bestreads[FOUND_TPARTNER_IN_CONTIG].weight<<4 >= bestreads[takewhich].weight) takewhich=FOUND_TPARTNER_IN_CONTIG;
+      if(bestreads[FOUND_RAIL_AND_NONMULTICOPY].weight<<4 >= bestreads[takewhich].weight) takewhich=FOUND_RAIL_AND_NONMULTICOPY;
+      resultread=bestreads[takewhich];
+      resultread.foundmethod=takewhich;
+    }
+
+  } else {
+
+    CEBUGF("FOUND_TPARTNER_IN_CONTIG: ");
+    CEBUGF(bestreads[FOUND_TPARTNER_IN_CONTIG].weight << endl);
+    CEBUGF("FOUND_TEMPLATE_AND_TPARTNER: ");
+    CEBUGF(bestreads[FOUND_TEMPLATE_AND_TPARTNER].weight << endl);
+    CEBUGF("FOUND_NORMAL: ");
+    CEBUGF(bestreads[FOUND_NORMAL].weight << endl);
+    CEBUGF("FOUND_NORMAL_AND_SRMB: ");
+    CEBUGF(bestreads[FOUND_NORMAL_AND_SRMB].weight << endl);
+
+
+    if(speedymap){
+      resultread=bestreads[FOUND_NORMAL];
+      resultread.foundmethod=FOUND_SPEEDYMAP;
+    }else{
+      if(bestreads[FOUND_TPARTNER_IN_CONTIG].refid >= 0){
+	resultread=bestreads[FOUND_TPARTNER_IN_CONTIG];
+	resultread.foundmethod=FOUND_TPARTNER_IN_CONTIG;
+      }else if(bestreads[FOUND_TEMPLATE_AND_TPARTNER].refid >= 0){
+	resultread=bestreads[FOUND_TEMPLATE_AND_TPARTNER];
+	resultread.foundmethod=FOUND_TEMPLATE_AND_TPARTNER;
+      }else if(bestreads[FOUND_NORMAL].refid >= 0){
+	resultread=bestreads[FOUND_NORMAL];
+	resultread.foundmethod=FOUND_NORMAL;
+      }else if(bestreads[FOUND_NORMAL_AND_SRMB].refid >= 0){
+	resultread=bestreads[FOUND_NORMAL_AND_SRMB];
+	resultread.foundmethod=FOUND_NORMAL_AND_SRMB;
+      }
+    }
+  }
+
+  FUNCEND();
+
+  return;
+}
+
+//#define CEBUGF(bla)  
+
+
+
+
+/*************************************************************************
+ *
+ * Returns true if next overlap of next read to add fullfils quickrule
+ *  criteria
+ *
+ *************************************************************************/
+
+bool Pathfinder::n4_checkQuickRules(const AlignedDualSeqFacts * ads_node, uint32 newreadid)
+{
+  // Change: minlen1 & 2 can now also be negative
+  // if positive: absolute value of overlap
+  // if negative: relative value of the overlap to the length of the newly added read 
+  // overlappercentage: percentage the overlap takes from the newly added read
+  uint32 overlapperc=100*ads_node->getOverlapLen()/PAF_readpool->getRead(newreadid).getLenClippedSeq();
+  uint8 seqtypenewread=PAF_readpool->getRead(newreadid).getSequencingType();
+
+  if(ads_node->getScoreRatio() >= (*PAF_miraparams)[seqtypenewread].getPathfinderParams().paf_quickrule_minsim1){
+    if((*PAF_miraparams)[seqtypenewread].getPathfinderParams().paf_quickrule_minlen1 >=0){
+      if(ads_node->getOverlapLen() >= (*PAF_miraparams)[seqtypenewread].getPathfinderParams().paf_quickrule_minlen1){
+#ifndef PUBLICQUIET
+	cout << " quick rule 1 abs";
+#endif
+	return true;
+      }
+    }else{
+      if(overlapperc >= -(*PAF_miraparams)[seqtypenewread].getPathfinderParams().paf_quickrule_minlen1){
+#ifndef PUBLICQUIET
+	cout << " quick rule 1 rel";
+#endif
+	return true;
+      }
+    }
+  }else if(ads_node->getScoreRatio() >= (*PAF_miraparams)[seqtypenewread].getPathfinderParams().paf_quickrule_minsim2){
+    if((*PAF_miraparams)[seqtypenewread].getPathfinderParams().paf_quickrule_minlen2 >=0){
+      if(ads_node->getOverlapLen() >= (*PAF_miraparams)[seqtypenewread].getPathfinderParams().paf_quickrule_minlen2){
+#ifndef PUBLICQUIET
+	cout << " quick rule 2 abs";
+#endif
+	return true;
+      }
+    }else{
+      if(overlapperc >= -(*PAF_miraparams)[seqtypenewread].getPathfinderParams().paf_quickrule_minlen2){
+#ifndef PUBLICQUIET
+	cout << " quick rule 2 rel";
+#endif
+	return true;
+      }
+    }
+  }
+
+  return false;
+}
+
+
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+
+
+//#define CEBUG(bla)   {cout << bla; cout.flush(); }
+
+void Pathfinder::n4_constructStepByStep(vector<Align> & aligncache, vector<int8> * used_ids, vector<int32> * ids_in_contig, vector<uint8> * multicopies, vector<uint8> * hasmcoverlaps, vector<uint8> * istroublemaker, vector<vector<newedges_t>::iterator> * lowerbound_oedges_ptr, vector<int32> * proposedSRMrightclips, vector<bool> * wellconnected, Contig & con)
+{
+  FUNCSTART("void Pathfinder::n4_constructStepByStep(vector<Align> & aligncache, vector<int8> * used_ids, vector<uint8> * multicopies, vector<uint8> * hasmcoverlaps, vector<uint8> * istroublemaker, vector<vector<newedges_t>::iterator> * lowerbound_oedges_ptr, vector<int32> * proposedSRMrightclips, Contig & con)");
+
+  PAF_pafparams=(*PAF_miraparams)[0].getPathfinderParams();
+
+  PAF_used_ids_ptr=used_ids;
+  PAF_ids_in_contig_ptr=ids_in_contig;
+  PAF_multicopies_ptr=multicopies;
+  PAF_wellconnected_ptr=wellconnected;
+  PAF_hasmcoverlap_ptr=hasmcoverlaps,
+  PAF_istroublemaker_ptr=istroublemaker;
+  PAF_proposedSRMrightclips_ptr=proposedSRMrightclips;
+  PAF_lowerbound_oedges_ptr=lowerbound_oedges_ptr;
+
+  PAF_usesbeststartcache=false;
+
+  n4_basicCSBSSetup();
+
+  // we're adding now things to the contig. set 
+  PAF_uiitr_is_clean=false;
+  // and use ids_in_contig before exiting to clean PAF_used_ids_in_this_run up
+  // again
+
+  if(con.getContigLength()==0){ 
+    CEBUG("csbs 3a\n");
+    int32 startid;
+    if(PAF_pafparams.paf_use_genomic_algorithms) {
+      startid=n4_searchBestStrongGoodStartEnvironmentGenome();
+    }else{
+      startid=n4_searchBestStrongGoodStartEnvironmentEST();
+    }
+
+    CEBUG("csbs 3a0\n");
+
+    if(startid<0) return;
+    
+    if(startid >= static_cast<int32>(PAF_used_ids_ptr->size())) {
+      cout << "Startid: " << startid << endl;
+      throw Notify(Notify::INTERNAL, THISFUNC,"n4 Starting with read id greater than number iof reads?\n");
+    }
+    
+    if((*PAF_used_ids_ptr)[startid]) {
+      cout << "Startid: " << startid << endl;
+      throw Notify(Notify::INTERNAL, THISFUNC,"n4 Starting with read that is already used?\n");
+    }
+    
+    CEBUG("Startid: " << startid << endl);
+    
+    // if we keep long repeats separated:
+    //   if we start with a non-multicopy read, forbid
+    //    multicopy/multicopy overlaps
+    if((*PAF_multicopies_ptr)[startid]>0) {
+#ifndef PUBLICQUIET
+      cout << "\nStarted with multicopy.\n";
+#endif
+      con.setLongReapeatStatus(true);
+    }
+
+    switch(PAF_bsccontent){
+    case 0: 
+    case 1: {
+      CEBUG("csbs 3a0\n");
+      // when in genome mode, use best knowledge
+      if(PAF_pafparams.paf_use_genomic_algorithms) {
+	n4_buildContigStartWithStrongGood(aligncache,startid, con);
+      }else{
+	// in EST mode, use older routines
+	// TODO: change ...
+	n4_buildESTContigStartWithStrongGood(aligncache,startid, con);
+	//buildContig(aligncache, startid, con);
+      }
+      break;
+    }
+//    case 1: 
+    case 2: 
+    case 3: {
+      // TODO: make specific n4 routine for not strong good alignments
+      CEBUG("csbs 3a1\n");
+      buildContig(aligncache, startid, con);
+      break;
+    }
+    case 4: {
+      CEBUG("csbs 3a3\n");
+      ++PAF_readaddattempts;
+      Contig::errorstatus_t contigerrstat;
+      con.addRead(aligncache, 
+		  NULL, startid, startid, 1, 
+		  (*PAF_multicopies_ptr)[startid],
+		  0,
+		  contigerrstat);
+
+      (*PAF_used_ids_ptr)[startid]=1;
+      break;
+    }
+    default: {
+      MIRANOTIFY(Notify::INTERNAL, "Oooops? PAF_bsccontent in unknown state: " << PAF_bsccontent << endl);
+    }
+    }
+  } else {
+    // TODO: make specific n4 mapping routine
+    //n4_mapToContig(aligncache, -1, con);
+    CEBUG("csbs 3b\n");
+    buildContig(aligncache, -1, con);
+  }
+
+  BUGIFTHROW(con.getContigLength() == 0, "Contig length == 0 ... hmmm.");
+
+  // before exit, clean PAF_used_ids_in_this_run
+  vector<int32>::const_iterator iicI=PAF_ids_in_contig_ptr->begin();
+  for(;iicI!=PAF_ids_in_contig_ptr->end(); ++iicI){
+    PAF_used_ids_in_this_run[*iicI]=0;
+  }
+  PAF_uiitr_is_clean=true;
+
+  FUNCEND();
+}
+//#define CEBUG(bla)
+
+
+
+
+
+/*************************************************************************
+ *
+ * some basic setup for constructStepByStep()
+ *
+ *
+ *************************************************************************/
+
+
+void Pathfinder::n4_basicCSBSSetup()
+{
+  FUNCSTART("void Pathfinder::n4_basicCSBSSetup()");
+
+  PAF_pafparams=(*PAF_miraparams)[0].getPathfinderParams();
+
+  PAF_readaddattempts=0;
+
+#ifdef CLOCK_STEPS2
+  timeval tv;
+  timeval tvtotal;
+  gettimeofday(&tv,NULL);
+  tvtotal=tv;
+#endif
+
+  //PAF_ids_in_contig_ptr->clear();
+
+  uint32 numreadspresent=PAF_used_ids_ptr->size();
+
+  // re-initialise PAF_used_ids_in_this_run if it is empty or
+  //  probably not correctly initialised
+  if(PAF_used_ids_in_this_run.empty() || ! PAF_uiitr_is_clean){
+    PAF_used_ids_in_this_run.clear();
+    PAF_used_ids_in_this_run.resize(numreadspresent,0);
+    PAF_uiitr_is_clean=true;
+  }
+
+  // these are still needed at the moment if the traditional
+  //  buildcontig routines are called (e.g. for mapping assemblies)
+
+  // is now also needed by n4 for stage 100 mapping, but needs to get
+  //  initialised a bit differently (larger number). Currently done when
+  //  switching to stage 100, can be done here once old routines disappear
+  //  completely
+  PAF_blacklisted_ids.clear();
+  PAF_blacklisted_ids.resize(numreadspresent,1);
+
+#ifdef CLOCK_STEPS2
+  cout << "Timing n4_basicCSBSSetup cleararrays: " << diffsuseconds(tv) << endl;
+  gettimeofday(&tv,NULL);
+#endif
+
+  PAF_nonmulticopiesadded=0;
+
+  PAF_musthonourmcmcflag=(*PAF_miraparams)[0].getAssemblyParams().as_keep_long_repeats_separated;
+  PAF_mayaddmcmcoverlaps=true;
+
+  CEBUG("csbs 1\n");
+
+  // initialise all fields in the newedge_t structure of PAF_forward_edges
+  //  used by the pathfinder
+  // at the moment this is the pf_banned field (set when an overlap is 
+  //  rejected also set for all all reads that are already aligned
+  //  in the contig at the potential insertion position
+
+  if(PAF_overlapsbanned){
+    if(!PAF_overlapsbanned_smallstore.empty()
+       && PAF_overlapsbanned_smallstore.size() < PAF_overlapsbanned_smallstore.capacity()){
+#ifndef PUBLICQUIET
+      cout << "Clear pf_banned quick: " << PAF_overlapsbanned_smallstore.size() << '\n';
+#endif
+      vector<vector<newedges_t>::iterator>::iterator obssI=PAF_overlapsbanned_smallstore.begin();
+      for(; obssI != PAF_overlapsbanned_smallstore.end(); obssI++){
+	(*obssI)->pf_banned=false;
+      }
+    }else{
+#ifndef PUBLICQUIET
+      cout << "Clear pf_banned full: " << PAF_overlapsbanned << '\n';
+#endif
+      vector<newedges_t>::iterator neI=PAF_forward_edges->begin();
+      for(; neI != PAF_forward_edges->end(); neI++){
+	neI->pf_banned=false;
+      }
+    }
+    PAF_overlapsbanned=0;
+    PAF_overlapsbanned_smallstore.clear();
+  }
+
+#ifdef CLOCK_STEPS2
+  cout << "Timing n4_basicCSBSSetup init pf_banned: " << diffsuseconds(tv) << endl;
+  gettimeofday(&tv,NULL);
+#endif
+
+  CEBUG("csbs 2\n");
+  
+  // initialise the quick lowerbound_oedges lookup vector if not already done
+  if(PAF_lowerbound_oedges_ptr->empty()){
+    vector<vector<newedges_t>::iterator> & lowerbound_oedges=*PAF_lowerbound_oedges_ptr; 
+    lowerbound_oedges.resize(PAF_readpool->size(),PAF_forward_edges->end());
+    newedges_t tmp;
+    for(uint32 i=0; i<lowerbound_oedges.size(); i++) {
+      //lowerbound_oedges[i]=PAF_forward_edges->lower_bound(i);
+      tmp.rid1=i;
+      lowerbound_oedges[i]=lower_bound(PAF_forward_edges->begin(),
+				       PAF_forward_edges->end(),
+				       tmp,
+				       Pathfinder__compareNewEdges_t_);
+    }
+#ifdef CLOCK_STEPS2
+    cout << "Timing n4_basicCSBSSetup lowerbound_oedges: " << diffsuseconds(tv) << endl;
+#endif
+  }
+
+  CEBUG("csbs 3\n");
+
+#ifdef CLOCK_STEPS2
+  cout << "Timing n4_basicCSBSSetup total: " << diffsuseconds(tvtotal) << endl;
+#endif
+
+  return;
+}
+//#define CEBUG(bla)
+
+
+
+/*************************************************************************
+ *
+ * 
+ * 
+ *
+ *************************************************************************/
+
+void Pathfinder::n4_handleReadNotAligned(Contig::errorstatus_t & contigerrstat, nextreadtoadd_t const &nrta)
+{
+  FUNCSTART("void Pathfinder::n4_handleReadNotAligned(Contig::errorstatus_t & contigerrstat)");
+
+  switch(contigerrstat.code) {
+  case Contig::ENOALIGN : {
+#ifndef PUBLICQUIET
+    cout << "\t-\tno align found\n";
+#else
+    cout << 'a';
+#endif
+    break;
+  }
+  case Contig::EDROPINRELSCORE : {
+#ifndef PUBLICQUIET
+    cout << "\t-\tdrop in relscore too high\n";
+#else
+    cout << 'd';
+#endif
+    break;
+  }
+  case Contig::ETEMPLATEDIRECTION : {
+#ifndef PUBLICQUIET
+    cout << "\t-\ttemplate in same direction\n";
+#else
+    cout << 't';
+#endif
+    break;
+  }
+  case Contig::ETEMPLATESIZE : {
+#ifndef PUBLICQUIET
+    cout << "\t-\tmismatch in template size\n";
+#else
+    cout << 's';
+#endif
+    break;
+  }
+  case Contig::ESRMBMISMATCH : {
+#ifndef PUBLICQUIET
+    cout << "\t-\tmismatch in SRMB zone\n";
+#else
+    cout << 'p';
+#endif
+    break;
+  }
+  case Contig::ESPECIALSRADDFAIL : {
+#ifndef PUBLICQUIET
+    cout << "\t-\tfailed special SR add rules\n";
+#else
+    cout << 'c';
+#endif
+
+    // if read could not be added, propose a new right clip
+    //cout << "SRMClip: " << PAF_readpool->getRead(nrta.newid).getName();
+    //cout << "\nHave: " << (*PAF_proposedSRMrightclips_ptr)[nrta.newid];
+    //cout << "\nPropose: " << contigerrstat.proposed_cutback << '\n';
+    if(contigerrstat.proposed_cutback>(*PAF_proposedSRMrightclips_ptr)[nrta.newid]){
+      //cout << "Newclip!\n";
+      (*PAF_proposedSRMrightclips_ptr)[nrta.newid]=contigerrstat.proposed_cutback;
+    }
+    break;
+  }
+  case Contig::EREFIDNOTALLOWED : {
+#ifndef PUBLICQUIET
+    cout << "\t-\trefid not allowed\n";
+#else
+    cout << 'r';
+#endif
+    break;
+  }
+  case Contig::EMAXCOVERAGEREACHED : {
+#ifndef PUBLICQUIET
+    cout << "\t-\tmaxcoverage reached\n";
+#else
+    cout << 'x';
+#endif
+    break;
+  }
+  case Contig::EDANGERZONE : {
+#ifndef PUBLICQUIET
+    cout << "\t-\ttoo many mismatches in danger zone(s)\n";
+#else
+    cout << 'z';
+#endif
+    break;
+  }
+  case Contig::EFORCEDGROWTHNOTREACHED : {
+#ifndef PUBLICQUIET
+    cout << "\t-\tforced growth not reached\n";
+#else
+    cout << 'g';
+#endif
+    break;
+  }
+  case Contig::EGROWTHNOTALLOWED : {
+#ifndef PUBLICQUIET
+    cout << "\t-\tgrowth not allowed\n";
+#else
+    cout << 'G';
+#endif
+    break;
+  }
+  case Contig::EUNSPECIFIED : {
+#ifndef PUBLICQUIET
+    cout << "\t-\tunspecified reject\n";
+#else
+    cout << '?';
+#endif
+    break;
+  }
+  default : {
+    throw Notify(Notify::INTERNAL, THISFUNC,"Unknown errorcode from the contig object.");
+  }
+  }
+
+#ifndef PUBLICQUIET
+  cout.flush();
+#endif
+  // ban all alignments of that read with other reads that were
+  //  at the same position
+
+  //// debug: show all reads at that pos that the contig gave back
+  //{
+  //  cout << "\nReads affected:\n";
+  //  vector<int32>::const_iterator raI;
+  //  raI=contigerrstat.reads_affected.begin();
+  //  for(; raI != contigerrstat.reads_affected.end(); raI++){
+  //    cout << *raI << '\t' << (*PAF_readpool)[*raI].getName();
+  //    if((*PAF_readpool)[*raI].isBackbone()){
+  //      cout << "\tbackbone\n";
+  //    } else if((*PAF_readpool)[*raI].isRail()){
+  //      cout << "\trail\n";
+  //    }else{
+  //      cout << "\tseqtype: " << static_cast<uint16>((*PAF_readpool)[*raI].getSequencingType()) << '\n';
+  //    }
+  //  }
+  //}
+
+
+  {
+    // check if refid has been put into reads_affected by the contig
+    // if not, warn and put it in
+    bool isin=false;
+    vector<int32>::const_iterator raI;
+    raI=contigerrstat.reads_affected.begin();
+    for(; raI != contigerrstat.reads_affected.end(); raI++){
+      if(*raI == nrta.refid){
+	isin=true;
+	break;
+      }
+    }
+    if(!isin){
+      cout << "\nWARNING: contig did not put refid into affected reads. Please file a bug report to\n\thttps://sourceforge.net/apps/trac/mira-assembler/\nand please send a mail to\n\tmira_talk at freelists.org\n";
+      cout << "current af size: " << contigerrstat.reads_affected.size() << endl;
+      contigerrstat.reads_affected.push_back(nrta.refid);
+    }
+  }
+
+
+  {
+    // First search look at the newedges_t block of nrta,newid overlaps
+    //  and ban those overlaps whose reads are in the vector given back
+    //  by the contig
+
+    vector<newedges_t>::iterator neI = (*PAF_lowerbound_oedges_ptr)[nrta.newid];
+    vector<int32>::const_iterator raI;
+    for(; neI != PAF_forward_edges->end() && neI->rid1 == nrta.newid; neI++){
+      if(!neI->pf_banned){
+	raI=contigerrstat.reads_affected.begin();
+	for(; raI != contigerrstat.reads_affected.end(); raI++){
+	  if(*raI == neI->linked_with){
+	    //cout << "Banning1: " << neI->rid1 << '\t' << neI->linked_with << '\n';
+	    PAF_overlapsbanned++;
+	    neI->pf_banned=true;
+	    if(PAF_overlapsbanned_smallstore.size()<PAF_overlapsbanned_smallstore.capacity()){
+	      PAF_overlapsbanned_smallstore.push_back(neI);
+	    }
+	    break;
+	  }
+	}
+      }
+    }
+
+    // Now look at the blocks of newedges_t whose reads are given
+    //  by by the vector and who overlap with nrta.newid
+    raI=contigerrstat.reads_affected.begin();
+    for(; raI != contigerrstat.reads_affected.end(); raI++){
+      neI = (*PAF_lowerbound_oedges_ptr)[*raI];
+      for(; neI != PAF_forward_edges->end() && neI->rid1 == *raI; neI++){
+	if(!neI->pf_banned){
+	  if(neI->linked_with == nrta.newid){
+	    //cout << "Banning2: " << neI->rid1 << '\t' << neI->linked_with << '\n';
+	    PAF_overlapsbanned++;
+	    neI->pf_banned=true;
+	    if(PAF_overlapsbanned_smallstore.size()<PAF_overlapsbanned_smallstore.capacity()){
+	      PAF_overlapsbanned_smallstore.push_back(neI);
+	    }
+	    break;
+	    // NOTE: should MIRA ever get multiple overlaps between
+	    //  two reads, then the "break;" above must be removed
+	    //  should be safe for now.
+	  }
+	}
+      }
+    }
+  }
+
+  FUNCEND();
+  return;
+}
+
+
+
+///*************************************************************************
+// *
+// *  returns ID of read with best matching env
+// *
+// *
+// *************************************************************************/
+//
+//
+////#define CEBUG(bla)   {cout << bla; cout.flush(); }
+//
+//int32 Pathfinder::n4_searchBestStrongGoodStartEnvironmentEST()
+//{
+//  FUNCSTART("int32 Pathfinder::n4_searchBestStrongGoodStartEnvironmentEST()");
+//
+//  const vector<int8> & PAF_used_ids = *PAF_used_ids_ptr;
+//  const vector<uint8> & PAF_istroublemaker = *PAF_istroublemaker_ptr;
+//
+//  int32 bestid=-1;
+//  uint64 bestweight=0;
+//  bool foundid=false;
+//
+//  
+//#ifdef CLOCK_STEPS2
+//  timeval tv;
+//  timeval tvtotal;
+//  gettimeofday(&tv,NULL);
+//  tvtotal=tv;
+//#endif
+//
+//  CEBUG("sbe 1\n");
+//
+//  for(int32 actid=0; actid < static_cast<int32>(PAF_used_ids.size()); actid++) {
+//    CEBUG("aid: " << actid);
+//    CEBUG("\tused " << (int16) PAF_used_ids[actid]);
+//    CEBUG("\ttm " <<(uint16) PAF_istroublemaker[actid]);
+//    CEBUG("\n");
+//    if(PAF_used_ids[actid]!=0
+//       || PAF_istroublemaker[actid]!=0) continue;
+//    
+//    vector<newedges_t>::const_iterator I=(*PAF_lowerbound_oedges_ptr)[actid];
+//
+//    uint32 sumweight=0;
+//
+//    for(;I!=PAF_forward_edges->end() && actid==I->rid1;I++){
+//      CEBUG("  lid: " << I->linked_with);
+//      CEBUG("\tused " << (int16) PAF_used_ids[I->linked_with]);
+//      CEBUG("\ttm " <<(uint16) PAF_istroublemaker[I->linked_with]);
+//      CEBUG("\n");
+//      CEBUG("  " << *I);
+//      
+//      if(!I->ol_stronggood
+//	 || PAF_used_ids[I->linked_with]!=0
+//	 || PAF_istroublemaker[I->linked_with]!=0) continue;
+//	
+//      // add weight to normal overlaps
+//      sumweight+=I->best_weight;
+//    }
+//
+//    CEBUG("Sumweight: " << sumweight << '\n');
+//
+//    if(sumweight>bestweight){
+//      foundid=true;
+//      bestid=actid;
+//      bestweight=sumweight;
+//      CEBUG("New best weight: " << bestweight << '\n');
+//    }
+//  }
+//
+//  // we do not try to define singlets or troublemakers as Non-mc/non-mc
+//  //  startpoint here. Let the caller decide what to do.
+//
+//#ifdef CLOCK_STEPS2
+//  cout << "Timing n4_searchBestStrongGoodStartEnvironmentEST total: " << diffsuseconds(tvtotal) << endl;
+//#endif
+//
+//  CEBUG("Returning: " << bestid << '\t' << bestweight << '\n');
+//
+//  FUNCEND();
+//
+//  return bestid;
+//
+//  //  return 0;
+//}
+////#define CEBUG(bla)   {cout << bla; cout.flush(); }
+
+
+
+///*************************************************************************
+// *
+// *  returns ID of read with best matching env
+// *
+// *
+// *************************************************************************/
+//
+//
+////#define CEBUG(bla)   {cout << bla; cout.flush(); }
+//
+//int32 Pathfinder::n4_searchBestStrongGoodStartEnvironmentGenome()
+//{
+//  FUNCSTART("int32 Pathfinder::n4_searchBestStrongGoodStartEnvironmentGenome()");
+//
+//  const vector<int8> & PAF_used_ids = *PAF_used_ids_ptr;
+//  const vector<uint8> & PAF_istroublemaker = *PAF_istroublemaker_ptr;
+//
+//  int32 bestid=-1;
+//  uint64 bestweight=0;
+//
+//  uint32 largestclustersize=0;
+//
+//  bool foundid=false;
+//
+//  
+//#ifdef CLOCK_STEPS2
+//  timeval tv;
+//  timeval tvtotal;
+//  gettimeofday(&tv,NULL);
+//  tvtotal=tv;
+//#endif
+//
+//  vector<bool> uid_in_cluster(PAF_used_ids.size(),false);
+//  vector<int32> unlooked;
+//  unlooked.reserve(PAF_used_ids.size());
+//
+//  CEBUG("sbsgseg 1\n");
+//
+//  for(int32 actid=0; actid < static_cast<int32>(PAF_used_ids.size()); actid++) {
+//    CEBUG("aid: " << actid);
+//    CEBUG("\tused " << (int16) PAF_used_ids[actid]);
+//    CEBUG("\ttm " <<(uint16) PAF_istroublemaker[actid]);
+//    CEBUG("\n");
+//    if(PAF_used_ids[actid]!=0
+//       || PAF_istroublemaker[actid]!=0
+//       || uid_in_cluster[actid]) continue;
+//    
+//    uint32 goodclustersize=0;
+//    uint64 goodclusterbestweight=0;
+//    uint32 goodclusterbestid=0;
+//    unlooked.clear();
+//    unlooked.push_back(actid);
+//
+//    int32 lookid;
+//    while(!unlooked.empty()){
+//      CEBUG("unlooked.size(): " << unlooked.size() << endl);
+//      lookid=unlooked.back();
+//      unlooked.pop_back();
+//
+//      uid_in_cluster[lookid]=true;
+//
+//      vector<newedges_t>::const_iterator I=(*PAF_lowerbound_oedges_ptr)[lookid];
+//
+//      uint64 sumweight=0;
+//      for(;I!=PAF_forward_edges->end() && lookid==I->rid1;I++){
+//	CEBUG("  lid: " << I->linked_with);
+//	CEBUG("\tused " << (int16) PAF_used_ids[I->linked_with]);
+//	CEBUG("\ttm " <<(uint16) PAF_istroublemaker[I->linked_with]);
+//	CEBUG("\n");
+//	CEBUG("  " << *I);
+//      
+//	if(!I->ol_stronggood
+//	   || PAF_used_ids[I->linked_with]!=0
+//	   || PAF_istroublemaker[I->linked_with]!=0
+//	   || uid_in_cluster[I->linked_with]) continue;
+//	//if(goodclustersize==0) ++goodclustersize;
+//	//++goodclustersize;
+//	sumweight+=I->best_weight;
+//	unlooked.push_back(I->linked_with);
+//      }
+//      if(sumweight>0) ++goodclustersize;
+//
+//      if(sumweight>goodclusterbestweight){
+//	goodclusterbestid=lookid;
+//	goodclusterbestweight=sumweight;
+//	CEBUG("goodclusterbestid: " << goodclusterbestid << endl);
+//	CEBUG("goodclusterbestweight: " << goodclusterbestweight << endl);
+//      }
+//    }
+//    if(goodclusterbestweight>0) ++goodclustersize;
+//
+//    if(goodclustersize>largestclustersize){
+//      foundid=true;
+//      bestid=goodclusterbestid;
+//      bestweight=goodclusterbestweight;
+//      largestclustersize=goodclustersize;
+//      CEBUG("New best id: " << bestid << endl);
+//      CEBUG("New best weight: " << bestweight << endl);
+//      CEBUG("New largest cluster: " << largestclustersize << '\n');
+//    }
+//  }
+//
+//  // we do not try to define singlets or troublemakers as Non-mc/non-mc
+//  //  startpoint here. Let the caller decide what to do.
+//
+//#ifdef CLOCK_STEPS2
+//  cout << "Timing n4_searchBestStrongGoodStartEnvironmentGenome total: " << diffsuseconds(tvtotal) << endl;
+//#endif
+//
+//  CEBUG("Best id: " << bestid << endl);
+//  CEBUG("Best weight: " << bestweight << endl);
+//  CEBUG("Largest cluster: " << largestclustersize << '\n');
+//  CEBUG("Returning: " << bestid << '\t' << bestweight << '\n');
+//
+//  FUNCEND();
+//
+//  return bestid;
+//
+//  //  return 0;
+//}
+////#define CEBUG(bla)
+
+
+
+
+//#define CEBUG(bla)   {cout << bla; cout.flush(); }
+
+bool Pathfinder::sortbeststartinfo_t_(const beststartinfo_t & a, const beststartinfo_t & b)
+{
+  return a.bsi_clustersize < b.bsi_clustersize;
+}
+
+/*************************************************************************
+ *
+ * returns ID of read with best matching env for genome/EST assemblies
+ *
+ * ! sets PAF_bsccontent to give assessement of what start sites
+ *    are in the cache:
+ *       0 == best quality, strong good overlaps found
+ *       1 == medium quality, overlaps but not strong good, not multicopy
+ *       2 == medium quality, overlaps but not strong good. multicopy
+ *       3 == singlets
+ *
+ *
+ * As the genome routines became more streamlined, same routines for genome
+ *  and EST and use cache. Now also do not look at different status anymore,
+ *  this has been merged for the time being
+ *
+ *************************************************************************/
+
+
+//#define CEBUG(bla)   {cout << bla; cout.flush(); }
+
+int32 Pathfinder::n4_searchBestStrongGoodStartEnvironmentEST()
+{
+  FUNCSTART("int32 Pathfinder::n4_searchBestStrongGoodStartEnvironmentEST()");
+  FUNCEND();
+
+  return n4_searchBestStrongGoodStartEnvironment_sub();
+}
+
+int32 Pathfinder::n4_searchBestStrongGoodStartEnvironmentGenome()
+{
+  FUNCSTART("int32 Pathfinder::n4_searchBestStrongGoodStartEnvironmentGenome()");
+  FUNCEND();
+  return n4_searchBestStrongGoodStartEnvironment_sub();
+}
+
+
+/*************************************************************************
+ *
+ *  fills the cache for the best start sites
+ *
+ *************************************************************************/
+
+
+void Pathfinder::n4_searchBestStrongGoodStartEnvironment_subFillCache(bool wanttroublemakercheck, bool wantstronggoodcheck, bool wantmulticopycheck, bool wantwellconnectedcheck)
+{
+  FUNCSTART("void Pathfinder::n4_searchBestStrongGoodStartEnvironment_subFillCache(bool trouble, bool stronggood)");
+
+  const vector<int8> & PAF_used_ids = *PAF_used_ids_ptr;
+  const vector<uint8> & PAF_istroublemaker = *PAF_istroublemaker_ptr;
+  const vector<uint8> & PAF_multicopies = *PAF_multicopies_ptr;
+  const vector<bool> & PAF_wellconnected = *PAF_wellconnected_ptr;
+
+  vector<bool> uid_in_cluster(PAF_used_ids.size(),false);
+
+  // in EST / RNASeq projects, things can get *very* ugly ... clusters of
+  //  several million reads (rRNA etc). This takes ages, even on fast processors
+  //  (E.g., 18 minutes for 10m 100bp where 40 to 50% may be rRNA).
+  // Solution: restrict growth of the unlooked vector to (currently) 8000
+  //  elements
+  // Effect: in genome assemblies, may lead to several start sites per
+  //  area. In EST / RNASeq assemblies, leads to several start sites per
+  //  heavy multicopy area.
+  //  Oh, and reduces time *a lot*, especially in conjunction with -PF:mscft
+  //  (see end of function)
+
+  vector<int32> unlooked;
+  unlooked.reserve(8000);
+  bool unlookedaccepts=true;
+  bool unlookthreshreached=false;
+
+  PAF_beststartcache.reserve(10000);
+
+  long int maxsec=PAF_pafparams.paf_max_startcache_filltime;
+  timeval starttv;
+  timeval curtv;
+  gettimeofday(&starttv,NULL);
+
+  for(int32 actid=0; actid < static_cast<int32>(PAF_used_ids.size()); ++actid) {
+    CEBUG("aid: " << actid);
+    CEBUG("\tused " << (int16) PAF_used_ids[actid]);
+    CEBUG("\ttm " <<(uint16) PAF_istroublemaker[actid]);
+    CEBUG("\n");
+    if(PAF_used_ids[actid]!=0
+       || (wanttroublemakercheck && PAF_istroublemaker[actid]!=0)
+       || (wantmulticopycheck && PAF_multicopies[actid]!=0)
+       || (wantwellconnectedcheck && !PAF_wellconnected[actid])
+       || uid_in_cluster[actid]) continue;
+    
+    uint32 goodclustersize=0;
+    uint32 goodclusterbestid=0;
+    uint32 maxconnects=0;
+    unlooked.clear();
+    unlooked.push_back(actid);
+
+    unlookedaccepts=true;
+
+    int32 lookid;
+    while(!unlooked.empty()){
+      CEBUG("unlooked.size(): " << unlooked.size() << endl);
+      lookid=unlooked.back();
+      unlooked.pop_back();
+
+      uid_in_cluster[lookid]=true;
+
+      vector<newedges_t>::const_iterator I=(*PAF_lowerbound_oedges_ptr)[lookid];
+
+      uint32 numconnects=0;
+      for(;I!=PAF_forward_edges->end() && lookid==I->rid1;++I){
+	CEBUG("  lid: " << I->linked_with);
+	CEBUG("\tused " << (int16) PAF_used_ids[I->linked_with]);
+	CEBUG("\ttm " <<(uint16) PAF_istroublemaker[I->linked_with]);
+	CEBUG("\n");
+	CEBUG("  " << *I);
+      
+	if((wantstronggoodcheck && !I->ol_stronggood)
+	   || PAF_used_ids[I->linked_with]!=0
+	   || (wanttroublemakercheck && PAF_istroublemaker[I->linked_with]!=0)
+	   || (wantmulticopycheck && PAF_multicopies[I->linked_with]!=0)
+	   || (wantwellconnectedcheck && !PAF_wellconnected[I->linked_with])
+	   || uid_in_cluster[I->linked_with]) continue;
+	++numconnects;
+	
+	if(unlookedaccepts) {
+	  unlooked.push_back(I->linked_with);
+	  // Check whether to stop looking for more
+	  // Do not do that only when multicopies are also allowed as it may be that
+	  //  people give projects *just* with heavy multicopy clusters and then
+	  //  it would not work (as only a monirity may then be multicopy with
+	  //  regard to the already high copy number)
+	  if(unlooked.size()==unlooked.capacity()){
+	    unlookedaccepts=false;
+	    unlookthreshreached=true;
+	  }
+	}
+      }
+      if(numconnects) ++goodclustersize;
+      if(numconnects>maxconnects){
+	goodclusterbestid=lookid;
+	maxconnects=numconnects;
+	CEBUG("goodclusterbestid: " << goodclusterbestid << endl);
+	CEBUG("goodclusterbestweight: " << goodclusterbestweight << endl);
+      }
+    }
+    
+    if(maxconnects){
+      beststartinfo_t tmp;
+      tmp.bsi_rid=goodclusterbestid;
+      tmp.bsi_clustersize=goodclustersize;
+      tmp.bsi_numconnects=maxconnects;
+      PAF_beststartcache.push_back(tmp);
+    }
+
+    // see whether we need to care about time (-PF:mscft)
+    if(maxsec>=0 && actid%50==0 && !PAF_beststartcache.empty()) {
+      gettimeofday(&curtv,NULL);
+      if(curtv.tv_sec-starttv.tv_sec >= maxsec) {
+	cout << "Non-deterministic behaviour of assembly likely: -PF:mscft threshold hit.\n";
+	break;
+      }
+    }
+
+  }
+
+  if(unlookthreshreached){
+    cout << "hit unlooked threshold\n";
+  }
+
+  FUNCEND();
+}
+
+/*************************************************************************
+ *
+ *  returns ID of read with best matching env
+ *
+ *************************************************************************/
+
+int32 Pathfinder::n4_searchBestStrongGoodStartEnvironment_sub()
+{
+  FUNCSTART("int32 Pathfinder::n4_searchBestStrongGoodStartEnvironment_sub()");
+
+  int32 bestid=-1;
+  const vector<int8> & PAF_used_ids = *PAF_used_ids_ptr;
+
+  PAF_usesbeststartcache=true;
+
+  // if there's something in the cache and 
+  //  the read it points to hasn't been included via other means
+  //  (like jumping over a small repeat), return that cached entry
+  while(!PAF_beststartcache.empty()){
+    CEBUG("Startcache look " << PAF_beststartcache.back());
+    bestid=PAF_beststartcache.back().bsi_rid;
+    PAF_beststartcache.pop_back();
+
+    if(!PAF_used_ids[bestid]){
+      CEBUG("Startcache taken\n");
+      return bestid;
+    }
+  }
+  // else try to find / recompute something else
+  bestid=-1;
+
+  //const vector<uint8> & PAF_istroublemaker = *PAF_istroublemaker_ptr;
+
+  uint32 largestclustersize=0;
+
+#ifdef CLOCK_STEPS2
+  timeval tv;
+  timeval tvtotal;
+  gettimeofday(&tv,NULL);
+  tvtotal=tv;
+#endif
+
+
+  CEBUG("sbsgseg 1\n");
+
+  PAF_bsccontent=0;
+  n4_searchBestStrongGoodStartEnvironment_subFillCache(true,true,true,true);
+
+#ifdef CLOCK_STEPS2
+  cout << "Timing n4_searchBestStrongGoodStartEnvironment 1 1 1 1: " << diffsuseconds(tvtotal) 
+       << "\nStartcache size: " << PAF_beststartcache.size() << endl;
+#endif
+
+  if(PAF_beststartcache.empty()){
+#ifdef CLOCK_STEPS2
+    gettimeofday(&tv,NULL);
+#endif
+    PAF_bsccontent=1;
+    n4_searchBestStrongGoodStartEnvironment_subFillCache(false,false,true,true);
+#ifdef CLOCK_STEPS2
+    cout << "Timing n4_searchBestStrongGoodStartEnvironment 0 0 1 1: " << diffsuseconds(tv) 
+	 << "\nStartcache size: " << PAF_beststartcache.size() << endl;
+#endif
+    if(PAF_beststartcache.empty()){
+#ifdef CLOCK_STEPS2
+      gettimeofday(&tv,NULL);
+#endif
+      PAF_bsccontent=2;
+      n4_searchBestStrongGoodStartEnvironment_subFillCache(false,false,false,true);
+#ifdef CLOCK_STEPS2
+      cout << "Timing n4_searchBestStrongGoodStartEnvironment 0 0 0 1: " << diffsuseconds(tv) 
+	   << "\nStartcache size: " << PAF_beststartcache.size() << endl;
+#endif
+    }
+    if(PAF_beststartcache.empty()){
+#ifdef CLOCK_STEPS2
+      gettimeofday(&tv,NULL);
+#endif
+      PAF_bsccontent=3;
+      n4_searchBestStrongGoodStartEnvironment_subFillCache(false,false,false,false);
+#ifdef CLOCK_STEPS2
+      cout << "Timing n4_searchBestStrongGoodStartEnvironment 0 0 0 0: " << diffsuseconds(tv) 
+	   << "\nStartcache size: " << PAF_beststartcache.size() << endl;
+#endif
+    }
+  }
+
+  if(!PAF_beststartcache.empty()){
+#ifdef CLOCK_STEPS2
+    gettimeofday(&tv,NULL);
+#endif
+    sort(PAF_beststartcache.begin(),
+	 PAF_beststartcache.end(),
+	 Pathfinder::sortbeststartinfo_t_
+      );
+#ifdef CLOCK_STEPS2
+    cout << "Timing n4_searchBestStrongGoodStartEnvironment sort: " << diffsuseconds(tv) << endl;
+#endif
+  }else{
+    // found nothing ... now put singlets into list
+
+#ifdef CLOCK_STEPS2
+    gettimeofday(&tv,NULL);
+#endif
+
+    PAF_bsccontent=4;
+
+    beststartinfo_t tmp;
+    tmp.bsi_clustersize=0;
+    tmp.bsi_numconnects=0;
+
+    uint32 size=PAF_readpool->size();
+    for(uint32 i=0; i<size; i++){
+      if(PAF_used_ids[i]==0){
+	tmp.bsi_rid=i;
+	PAF_beststartcache.push_back(tmp);
+      }
+    }
+    CEBUG("Startcache filled with singlets: " << PAF_beststartcache.size() << '\n');
+#ifdef CLOCK_STEPS2
+    cout << "Timing n4_searchBestStrongGoodStartEnvironment singletfill: " << diffsuseconds(tv) << endl;
+#endif
+  }
+
+  if(!PAF_beststartcache.empty()){
+    CEBUG("Startcache take " << PAF_beststartcache.back());
+    bestid=PAF_beststartcache.back().bsi_rid;
+    largestclustersize=PAF_beststartcache.back().bsi_clustersize;
+    PAF_beststartcache.pop_back();
+  }
+
+#ifdef CLOCK_STEPS2
+  cout << "Timing n4_searchBestStrongGoodStartEnvironment total: " << diffsuseconds(tvtotal) 
+       << "\n";
+#endif
+
+  CEBUG("Best id: " << bestid << endl);
+  CEBUG("Largest cluster: " << largestclustersize << '\n');
+
+  FUNCEND();
+
+  return bestid;
+
+  //  return 0;
+}
+//#define CEBUG(bla)
+
+
+/*************************************************************************
+ *
+ *  returns number of elements in start cache 
+ *  throw if startcache is not used!
+ *
+ *************************************************************************/
+
+size_t Pathfinder::n4_getNumElementsInStartCache()
+{
+  FUNCSTART("size_t Pathfinder::n4_getNumElementsInStartCache()");
+  //BUGIFTHROW(!PAF_usesbeststartcache,"Asked for elements in start cache while not using startcache?");
+
+  // TODO: cludge, until all routines are migrated to n4* and use beststartcache
+  if(!PAF_usesbeststartcache) return 1;
+
+  FUNCEND();
+  return PAF_beststartcache.size();
+}
+
+
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+ 
+//#define CEBUG(bla)   {cout << bla; cout.flush(); }
+void Pathfinder::n4_buildContigStartWithStrongGood(vector<Align> & aligncache, int32 startid, Contig & con)
+{
+  FUNCSTART("void Pathfinder::n4_buildContigStartWithStrongGood(vector<Align> & aligncache, int32 startid, Contig & con)");
+
+#ifndef PUBLICQUIET
+  cout << "n4_buildContigStartWithStrongGood\n";
+#endif
+
+  CEBUG("bc 1\n");
+
+  vector<int8> & PAF_used_ids = *PAF_used_ids_ptr;
+
+  Contig::errorstatus_t contigerrstat;
+  // this should speed up things a bit, avoiding copying during extension
+  //  although the 10000 might be not enough for really pathological cases
+  //  with many SRMB regions and huge coverage
+  contigerrstat.reads_affected.reserve(10000);
+  contigerrstat.srmb_reads_affected.reserve(10000);
+
+  // this is a kind of duplicate of PAF_used_ids_in_this_run (which has
+  //  the size of the readpool)
+  // However, this array holds only those ids that have been built into
+  //  the contig in this call, giving a faster access to the info
+  vector<int32> & ids_in_contig = *PAF_ids_in_contig_ptr;
+  ids_in_contig.clear();
+  ids_in_contig.reserve(PAF_used_ids.size());
+
+  // "duplicate" of ids_in_contig, but gets cleared after each 
+  //  stage1, stage2, ..., stageN round below.
+  // Even faster access to the really newest additions to the contig
+  //vector<int32> PAF_fresh_ids_in_contig;
+  PAF_fresh_ids_in_contig.clear();
+  PAF_fresh_ids_in_contig.reserve(PAF_used_ids.size());
+
+  // "duplicate" of ids_in_contig, but contains ids that have overlaps
+  //  with unassembled reads and therefore can contribute to growth
+  // Once IDs have no open overlap anymore, they become dead ("cork")
+  //  and are removed from the cambium vector (by the n4_find* functions)
+  // On each change of stage, cambium_ids gets refilled with 
+  //  ids_in_contig to be sure that nothing gets lost
+  //vector<int32> & PAF_cambium_ids;
+  PAF_cambium_ids.clear();
+  PAF_cambium_ids.reserve(PAF_used_ids.size());
+
+
+  PAF_buildcontig_newlinecounter=0;
+
+
+  CEBUG("bc 3a 1\n");
+  if(startid<0) {
+    cerr << "Startid: " << startid << endl;
+    throw Notify(Notify::INTERNAL, THISFUNC,"Starting with non-existing read?");
+  }
+    
+  if(startid >= static_cast<int32>(PAF_used_ids.size())) {
+    cerr << "Startid: " << startid << endl;
+    throw Notify(Notify::INTERNAL, THISFUNC,"Starting with read id greater than number iof reads?\n");
+  }
+    
+  if(PAF_used_ids[startid]) {
+    cerr << "Startid: " << startid << endl;
+    throw Notify(Notify::INTERNAL, THISFUNC,"Starting with read that is already used?\n");
+  }
+
+  CEBUG("Startid: " << startid << endl);
+    
+#ifndef PUBLICQUIET
+  cout << endl;
+#endif
+    
+  ++PAF_readaddattempts;
+  con.addRead(aligncache, 
+	      NULL, startid, startid, 1, 
+	      (*PAF_multicopies_ptr)[startid],
+	      0,
+	      contigerrstat);
+  
+  CEBUG("bc 3a 2\n");
+
+  PAF_used_ids[startid]=1;
+  PAF_used_ids_in_this_run[startid]=1;
+  ids_in_contig.push_back(startid);
+  PAF_fresh_ids_in_contig.push_back(startid);
+  PAF_cambium_ids.push_back(startid);
+    
+#ifndef PUBLICQUIET
+  cout << endl;
+#else
+  cout << "+";
+#endif
+
+  struct tms mytms;
+  times(&mytms);
+  clock_t baseclocks=mytms.tms_utime+mytms.tms_stime;
+  clock_t actclocks=baseclocks;
+  clock_t maxallowedclocks=baseclocks+PAF_pafparams.paf_maxcontigclockticks;
+
+#ifdef CLOCK_STEPS1
+  vector<suseconds_t> us_pfsearch;
+  vector<suseconds_t> us_conadd;
+  vector<suseconds_t> us_overlapban;
+#endif
+
+  nextreadtoadd_t nrta;
+  nrta.newid=0;
+
+  uint32 statscounter=1;
+
+  // the forcegrow for addRead()
+  //  will be set to 0 for adding NMC, 10-20? for MC 
+  int32 forcegrow=0;
+
+  // stage 1 : add "strong good" overlaps
+  // stage 2 : add paired-ends only
+  // stage 3 : add overlaps that have frequencies below avg.
+  
+  uint32 stage=1;
+  uint32 readsaddedinstages=0;
+  
+  /* forcenewstage is set by a stage if it explicitly wants to change
+     to a new stage after the current found overlap has been added 
+     value of forcenewstage is the target stage */
+  uint32 forcenewstage=0;
+
+  while(stage < 1000) {
+#ifndef PUBLICQUIET
+    if(statscounter == 25) {
+      cout << "rstatsm: len of c : " << con.getContigLength();
+      cout << "\nrstatsm: ids in c : " << ids_in_contig.size();
+      cout << "\nrstatsm: cids in c : " << PAF_cambium_ids.size();
+      cout << "\nrstatsm: fids in c : " << PAF_fresh_ids_in_contig.size();
+      cout << "\nrstatsi: banned o : " << PAF_overlapsbanned;
+#ifdef CLOCK_STEPS1
+      cout << "\nrstat timings: " << ids_in_contig.size();
+      cout << " : " << avg_suseconds(us_pfsearch);
+      cout << " / " << avg_suseconds(us_conadd);
+      cout << " / " << avg_suseconds(us_overlapban);
+#endif
+      cout << '\n';
+      statscounter=0;
+    }
+#endif
+
+
+    nrta.refid=-1;
+    nrta.newid=-1;
+    nrta.weight=0;
+    nrta.direction_newid=0;
+    nrta.ads_node=NULL;
+    
+#ifdef CLOCK_STEPS1
+    timeval us_start;
+    gettimeofday(&us_start,NULL);
+#endif
+
+#ifndef PUBLICQUIET
+    cout << "Searching";
+#endif
+
+    switch(stage){
+    case 1 : {
+#ifndef PUBLICQUIET
+      cout << " (stage1 overlap) ...";
+      cout.flush();
+#endif
+      forcegrow=0;
+      n4_findNextGoodOverlap(true,false,true,PAF_cambium_ids, nrta, maxallowedclocks);
+
+      break;
+    }
+    case 2 : {
+#ifndef PUBLICQUIET
+      cout << " (stage2 overlap) ...";
+      cout.flush();
+#endif
+      forcegrow=0;
+      n4_findNextPillarCounterpart(PAF_cambium_ids, nrta, maxallowedclocks);
+
+      break;
+    }
+    case 3 : {
+#ifndef PUBLICQUIET
+      cout << " (stage3 overlap) ...";
+      cout.flush();
+#endif
+      forcegrow=0;
+      if(n4_findNextGoodOverlap(true,true,true,PAF_cambium_ids, nrta, maxallowedclocks)){
+	// if function returns true, it has found that a read in the
+	//  contig has a strong good overlap
+	forcenewstage=1;
+      }
+
+      break;
+    }
+    case 100 : {
+      // map to existing, allowing only overlaps with data
+      //  that has a frequency >3
+#ifndef PUBLICQUIET
+      cout << " (stage100 overlap) ...";
+      cout.flush();
+#endif
+      // disallow the contig to grow!
+      forcegrow=-1;
+
+      // At the moment we use the cambium ids anyway as allowed references
+      //if(PAF_cambium_ids.empty()){
+      //	n4_setupAllowedReferences(PAF_cambium_ids,ids_in_contig);
+      //}
+
+      n4_findNextAllowedRefOverlap(PAF_cambium_ids, nrta, maxallowedclocks);
+
+      // nothing found? the clear allowed references
+      if(nrta.newid < 0) {
+	PAF_cambium_ids.clear();
+      }
+      break;
+    }
+    default : {
+      cerr << "\nStage " << stage << '\n';
+      throw Notify(Notify::INTERNAL, THISFUNC, "stage not 1,2,3 ... this should not happen.\n");
+    }
+    }
+#ifndef PUBLICQUIET
+    cout << " done.\n";
+    cout.flush();
+#endif
+
+#ifdef CLOCK_STEPS1
+    us_pfsearch.push_back(diffsuseconds(us_start));
+#endif
+
+
+    if(nrta.newid < 0) {
+      // nothing found
+      // go to next stage and if we went through all stages,
+      //  go back to stage 1 only if there had been a read added
+      //  in the three stages. if not, this contigs is finished
+#ifndef PUBLICQUIET
+      cout << "\nWe were in stage " << stage << ", switching to stage " << stage+1 << endl;
+      cout << "Reads added: " << readsaddedinstages << endl;
+#endif
+      ++stage;
+      if(stage==4){
+	if(readsaddedinstages){
+	  // we added some reads in the stages. Perfect, restart
+	  //  at stage 1 to see whether we could get further.
+	  stage=1;
+	  readsaddedinstages=0;
+	}else{
+	  // nope, so start the beef up loop now
+	  stage=100;
+
+	  uint32 numreadspresent=PAF_used_ids_ptr->size();
+	  // is now also needed by n4 for stage 100 mapping, but needs to get
+	  //  initialised a bit differently (larger number). Currently done here
+	  //  switching to stage 100, can be done in basicSetup once old
+	  //  routines disappear
+	  PAF_blacklisted_ids.clear();
+	  PAF_blacklisted_ids.resize(PAF_used_ids_ptr->size(),5);
+	}
+	PAF_fresh_ids_in_contig.clear();
+      }else if(stage>=100){
+	//stop the loop now
+	stage=1000;
+      }
+      PAF_cambium_ids=ids_in_contig;
+    }else{
+#ifndef PUBLICQUIET
+      cout << nrta;
+#endif
+
+#ifdef CLOCK_STEPS1
+      gettimeofday(&us_start,NULL);
+#endif
+
+      statscounter++;
+      ++PAF_readaddattempts;
+      con.addRead(aligncache, 
+		  nrta.ads_node, nrta.refid, nrta.newid, nrta.direction_newid, 
+		  (*PAF_multicopies_ptr)[nrta.newid],
+		  forcegrow,
+		  contigerrstat);
+#ifdef CLOCK_STEPS1
+      us_conadd.push_back(diffsuseconds(us_start));
+#endif
+      
+      cout.flush();
+
+      //Contig::setCoutType(Contig::AS_TEXT);
+      //cout << ",,,,,,\n" << con << "\n\n";
+
+    
+      if(PAF_buildcontig_newlinecounter==0){
+	cout << "[" << ids_in_contig.size() << "] "; cout.flush();
+      }
+      if(contigerrstat.code == Contig::ENOERROR) {
+	ids_in_contig.push_back(nrta.newid);
+	PAF_fresh_ids_in_contig.push_back(nrta.newid);
+	PAF_cambium_ids.push_back(nrta.newid);
+	++readsaddedinstages;
+	PAF_used_ids[nrta.newid]=1;
+	PAF_used_ids_in_this_run[nrta.newid]=1;
+
+#ifndef PUBLICQUIET
+	cout << "\t+\n";
+#else
+	cout << "+";
+#endif
+      }else{
+#ifdef CLOCK_STEPS1
+	gettimeofday(&us_start,NULL);
+#endif
+	n4_handleReadNotAligned(contigerrstat,nrta);
+
+	// handle blacklisting of failed alignment when refid was a short read
+	//  and newid a long one
+	if(stage==100
+	   && PAF_readpool->getRead(nrta.refid).isSequencingType(Read::SEQTYPE_SOLEXA)
+	   && !PAF_readpool->getRead(nrta.newid).isSequencingType(Read::SEQTYPE_SOLEXA)){
+	  if(PAF_blacklisted_ids[nrta.newid]) PAF_blacklisted_ids[nrta.newid]--;
+	}
+#ifdef CLOCK_STEPS1
+	us_overlapban.push_back(diffsuseconds(us_start));
+#endif
+      }
+
+      if(forcenewstage>0){
+#ifndef PUBLICQUIET
+	cout << "\nWe were in stage " << stage << ", being forced to stage " << stage+1 << endl;
+	cout << "Reads added: " << readsaddedinstages << endl;
+#endif
+	readsaddedinstages=0;
+	stage=forcenewstage;
+	forcenewstage=0;
+	PAF_fresh_ids_in_contig.clear();
+	PAF_cambium_ids=ids_in_contig;
+      }
+
+#ifndef PUBLICQUIET
+#else
+      PAF_buildcontig_newlinecounter++;
+      if(PAF_buildcontig_newlinecounter==60){
+	PAF_buildcontig_newlinecounter=0;
+	cout << "   " << con.getContigLength();
+#ifdef CLOCK_STEPS1
+	cout << "\t" << avg_suseconds(us_pfsearch);
+	cout << " / " << avg_suseconds(us_conadd);
+	cout << " / " << avg_suseconds(us_overlapban);
+#endif
+	cout << endl;
+      }
+#endif
+
+
+    }
+
+    //if(con.getNumReadsInContig()==1198){
+    //  cout << "\npathfinder debugstop.\n";
+    //  assout::saveAsCAF(con, "test.caf", true);
+    //  abort();
+    //}
+
+    if(PAF_pafparams.paf_use_max_contig_buildtime){
+      times(&mytms);
+      actclocks=mytms.tms_utime+mytms.tms_stime;
+      if(actclocks>maxallowedclocks){
+	// the following should not be necessary, but just to be sure
+	// (had a case where the disk got full and MIRA was stuck in
+	//  endless loop ... calling times()
+	// so I set the loop ending condition manually
+	nrta.newid=-1;
+	
+	cout << "\nMaximum build time for this contig reached, aborting build.\n";
+	FUNCEND();
+	return;
+      }
+    }
+  }
+  
+  FUNCEND();
+}
+
+//#define CEBUG(bla)
+
+
+
+
+
+/*************************************************************************
+ *
+ * searches for two types of overlaps:
+ *   allowbelowavgfreq == false -> only overlaps with a ol_strong (ol_weak)
+ *                                 flag
+ *                     == true -> overlaps with a ol_belowavgfreq
+ *                                             or ol_norept flag
+ *
+ * returns whether the overlap chosen also has ol_strong (ol_weak) flag
+ *    set
+ *
+ *************************************************************************/
+
+//#define CEBUGF(bla)   {cout << bla; cout.flush(); }
+bool Pathfinder::n4_findNextGoodOverlap(bool wantfreqcheck, bool allowbelowavgfreq, bool allowspeedypair, vector<int32> & cambiumidsincontig, nextreadtoadd_t & resultread, clock_t & maxallowedclocks) 
+{
+  FUNCSTART("void Pathfinder::n4_findNextStrongGoodOverlap(bool allowbelowavgfreq, const vector<int32> & cambiumidsincontig, nextreadtoadd_t & resultread, clock_t & maxallowedclocks) ");
+
+  if(cambiumidsincontig.size()==0) {
+    return false;
+  }
+
+  bool returnvalue=false;
+
+  // lr_ == local reference
+  const vector<int8> &  lr_used_ids = *PAF_used_ids_ptr;
+  const vector<uint8> & lr_istroublemaker = *PAF_istroublemaker_ptr;
+
+  nextreadtoadd_t bestread=resultread;
+  vector<newedges_t>::const_iterator bestreadI=PAF_forward_edges->end();
+  bool bestreadispaired=false;
+  uint32 peweighttobeat=0;
+  
+  
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
+#endif
+
+  bool   usetemplateinfo=(*PAF_miraparams)[Read::SEQTYPE_SANGER].getPathfinderParams().paf_use_template_information;
+  usetemplateinfo|=(*PAF_miraparams)[Read::SEQTYPE_454GS20].getPathfinderParams().paf_use_template_information;
+  usetemplateinfo|=(*PAF_miraparams)[Read::SEQTYPE_IONTORRENT].getPathfinderParams().paf_use_template_information;
+  usetemplateinfo|=(*PAF_miraparams)[Read::SEQTYPE_PACBIO].getPathfinderParams().paf_use_template_information;
+  usetemplateinfo|=(*PAF_miraparams)[Read::SEQTYPE_SOLEXA].getPathfinderParams().paf_use_template_information;
+  usetemplateinfo|=(*PAF_miraparams)[Read::SEQTYPE_ABISOLID].getPathfinderParams().paf_use_template_information;
+
+
+
+
+  bool   usequickruleSAN=(*PAF_miraparams)[Read::SEQTYPE_SANGER].getPathfinderParams().paf_use_quick_rule;
+  bool   usequickrule454=(*PAF_miraparams)[Read::SEQTYPE_454GS20].getPathfinderParams().paf_use_quick_rule;
+  bool   usequickruleION=(*PAF_miraparams)[Read::SEQTYPE_IONTORRENT].getPathfinderParams().paf_use_quick_rule;
+  bool   usequickrulePBS=(*PAF_miraparams)[Read::SEQTYPE_PACBIO].getPathfinderParams().paf_use_quick_rule;
+
+  bool   usequickruleSHORTREADS=true;
+
+  bool foundquick=false;
+
+  // going backwards through the contglist should be a tick faster than forward
+  //  also helps to retain a bit of flexibility when emergency search stops occur
+  int32 rindex=cambiumidsincontig.size()-1;
+
+  uint32 numreadschecked=0;
+
+
+//#define CEBUGF(bla)   {if(numreadschecked>10000) cout << bla; cout.flush(); }
+
+
+  for(; rindex >=0 ; --rindex, ++numreadschecked) {
+
+    // TODO: not optimal: should perhaps set flag to sort cambium ids according to
+    //  untaken overlaps? (every now and then, perhaps once cambium grows more
+    //  than 1000 since last sort)
+    // Test: stop runaway searches
+    if(numreadschecked>3000
+       && bestread.weight>0){
+      rindex=-1;
+      break;
+    }
+       
+    int32 readid=cambiumidsincontig[rindex];
+
+    // foundcandidate tells whether for this read id there are overlaps
+    //  to unassembled reads
+    // if not, the this read id is "dead" and is removed from the 
+    //  cambiumidsincontig further down (it becomes "cork" :-)
+    bool foundcandidate=false;
+
+    // speedymap: special quickrule for 100% contained reads that map
+    //  100% but are shorter than the quickrule lengths (important for
+    //  hybrid Solexa / other)
+    bool speedymap=false;
+
+    // speedypair: special quickrule for reads which have a partner in 
+    //  the contig
+    bool speedypair=false;
+
+    CEBUGF("fnO: new read " << readid << '\n');
+
+    vector<newedges_t>::const_iterator I=(*PAF_lowerbound_oedges_ptr)[readid];
+    
+    for(;I!=PAF_forward_edges->end() && I->rid1 == readid;I++){
+
+      CEBUGF("edge: " << *I << endl);
+      
+      // don't bother looking at if overlap is banned
+      if(I->pf_banned) continue;
+      
+      CEBUGF("#1\n");
+      int32 linkedwithid=I->linked_with;
+      
+      CEBUGF("#2\n");
+      // don't bother looking at if read linked to is already used 
+      if(lr_used_ids[linkedwithid] !=0) continue;
+      
+      CEBUGF("#3\n");
+
+      bool isstrongmatch=false;
+
+      int32 otherread_partnerid=PAF_readpool->getRead(linkedwithid).getTemplatePartnerID();
+      
+      // if the read has no template partner id or
+      //  template partner is not in contig,, insist that
+      //  overlap must have 
+      //   - either strong good flag (ol_weakgood sufficient at the moment)
+      //   - or, if matches below avg freq are allowed and there is no
+      //     strong match, no rept flag.
+      //     (to prevent sequencing errors in rept regions to generate
+      //     false matches)
+      //
+      // TODO: what about troublemakers? (PAF_istroublemaker)
+
+      if(wantfreqcheck){
+	if(otherread_partnerid <0 
+	   || !PAF_used_ids_in_this_run[otherread_partnerid]){
+	  
+	  if(I->ol_weakgood) isstrongmatch=true;
+	  
+	  if(!isstrongmatch){
+	    if(allowbelowavgfreq){
+	      // ol_rept is not good enough for checking
+	      //   if(!I->ol_belowavgfreq || I->ol_rept) continue;
+	      // this allows "assembly at sequencing error sites"
+	      //  (r = repetitive, b = below avg because of error, * = error)
+	      //
+	      //  s0    rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
+	      //  s1    rrrrrrrrrrrrrrbbbbbb*bbbbbbrrrrrrrrrr
+	      //  s2            rrrrrrbbbbbb*bbbbbbrrrrrrrrrrrrrrrrrrrrr
+	      //
+	      // therefore, if allowing joins in below avg regions, the reads
+	      //  themselves may not have any rept
+	      
+	      // BaCh 15.05.2011: some short overlaps have an avg freq (and not
+	      //  below avg. freq). Therefore take decision on both ol_belowavgfreq
+	      //  or ol_norept flags
+	      
+	      if(!(I->ol_belowavgfreq || I->ol_norept)
+		 || PAF_readpool->getRead(I->rid1).hasFreqRept()
+		 || PAF_readpool->getRead(linkedwithid).hasFreqRept()) continue;
+	      
+	    }else {
+	      continue;
+	    }
+	  }
+	}
+      }
+      
+      CEBUGF("#4\n");
+      
+      foundcandidate=true;
+    
+      // has the potential new read a partner in the contig?
+      // and is it allowed for quick overlap searches?
+      if(otherread_partnerid>=0
+	 && PAF_used_ids_in_this_run[otherread_partnerid]
+	 && I->pf_allowquickoverlap) {
+	CEBUGF("#4a\n");
+
+	if(I->best_weight > bestread.weight) {
+	  bestreadispaired=true;
+	  bestreadI=I;
+	  bestread.refid=readid;
+	  bestread.newid=linkedwithid;
+	  bestread.direction_newid=I->direction;
+	  bestread.ads_node=&(*PAF_adsfacts)[I->adsfindex];
+	  bestread.weight=I->best_weight;
+	  peweighttobeat=I->best_weight + (I->best_weight>>3);
+	  returnvalue=isstrongmatch;
+	  if(allowspeedypair){
+	    // yes, excellent, take it immediately by breaking from the for loop
+	    CEBUGF("#4a1\n");
+	    speedypair=true;
+	    break;
+	  }
+	}
+      } else {
+	// nope, well, still good,
+	CEBUGF("#4b\n");
+	if(bestreadispaired){
+	  CEBUGF("#4b1\n");
+	  if(I->best_weight > peweighttobeat) {
+	    CEBUGF("#4b2\n");
+	    if(I->best_weight > bestread.weight) {
+	      bestreadispaired=false;
+	      bestreadI=I;
+	      bestread.refid=readid;
+	      bestread.newid=linkedwithid;
+	      bestread.direction_newid=I->direction;
+	      bestread.ads_node=&(*PAF_adsfacts)[I->adsfindex];
+	      bestread.weight=I->best_weight;
+	      returnvalue=isstrongmatch;
+	      CEBUGF("#4b3\n");
+	    }
+	  }
+	}else{
+	  CEBUGF("#4c\n");
+	  // special rule: if fully contained read with 100% match
+	  //  take that one immediately and break the for loop
+	  // set the speedymap flag so that quickrule down below also knows
+	  //  about this (rationale: short solexas may be shorter than
+	  //  the quickrule lengths)
+	  if(PAF_readpool->getRead(linkedwithid).isSequencingType(Read::SEQTYPE_SOLEXA)
+	     && !PAF_readpool->getRead(readid).isSequencingType(Read::SEQTYPE_SOLEXA)
+	     && (*PAF_adsfacts)[I->adsfindex].getScoreRatio()==100
+	     && (*PAF_adsfacts)[I->adsfindex].getOverlapLen()== PAF_readpool->getRead(linkedwithid).getLenClippedSeq()){
+	    CEBUGF("#4d\n");
+	    bestreadispaired=false;
+	    bestreadI=I;
+	    bestread.refid=readid;
+	    bestread.newid=linkedwithid;
+	    bestread.direction_newid=I->direction;
+	    bestread.ads_node=&(*PAF_adsfacts)[I->adsfindex];
+	    bestread.weight=I->best_weight;
+	    returnvalue=isstrongmatch;
+	    speedymap=true;
+	    break;
+	  } else if(I->best_weight > bestread.weight) {
+	    CEBUGF("#4e\n");
+	    bestreadispaired=false;
+	    bestreadI=I;
+	    bestread.refid=readid;
+	    bestread.newid=linkedwithid;
+	    bestread.direction_newid=I->direction;
+	    bestread.ads_node=&(*PAF_adsfacts)[I->adsfindex];
+	    bestread.weight=I->best_weight;
+	    returnvalue=isstrongmatch;
+	  }
+	}
+      }
+    }
+
+    CEBUGF("foundcandidate: " << foundcandidate << ' ' << bestread << endl);
+    
+    if((bestreadI!=PAF_forward_edges->end() && bestreadI->pf_allowquickoverlap)
+       && (speedymap || speedypair)){
+#ifndef PUBLICQUIET
+      if(speedymap) cout << " speedymap";
+      if(speedypair) cout << " speedypair";
+#endif
+      rindex=-1;
+      foundquick=true;
+      break;
+    }
+
+    if(foundcandidate){
+
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
+#endif
+
+      // If wished, we'll use quick rules (premature stop of searching)
+      //
+      if((bestreadI!=PAF_forward_edges->end() && bestreadI->pf_allowquickoverlap)
+	 && (usequickrule454 || usequickruleION || usequickruleSAN || usequickrulePBS || usequickruleSHORTREADS)
+	 && bestread.weight > 0){
+	
+
+	bool mayusequick=false;
+	uint8 seqtypenewread=PAF_readpool->getRead(bestread.newid).getSequencingType();
+	switch(seqtypenewread){
+	case Read::SEQTYPE_SANGER : {
+	  if(usequickruleSAN) mayusequick=true;
+	  break;
+	}
+	case Read::SEQTYPE_454GS20  : {
+	  if(usequickrule454) mayusequick=true;
+	  break;
+	}
+	case Read::SEQTYPE_IONTORRENT : {
+	  if(usequickruleION) mayusequick=true;
+	  break;
+	}
+	case Read::SEQTYPE_SOLEXA :
+	case Read::SEQTYPE_ABISOLID : {
+	  if(usequickruleSHORTREADS) mayusequick=true;
+	  break;
+	}
+	case Read::SEQTYPE_PACBIO : {
+	  if(usequickrulePBS) mayusequick=true;
+	  break;
+	}
+	default : {
+	  MIRANOTIFY(Notify::INTERNAL, "Oooops? seqtypenewread not handled by switch?" << static_cast<uint16>(seqtypenewread) << endl);
+	}
+	}
+
+	if(mayusequick && n4_checkQuickRules(bestread.ads_node,bestread.newid)){
+	  rindex=-1;
+	  foundquick=true;
+	  break;
+	}
+
+      }
+
+    } else {
+      // !foundcandidate
+      // basically, this read id has become "cork"
+      // remove it from the cambium ids by moving the last
+      //  id in the vector to this place (can be the same!)
+      //  and then reduce the vector size by 1
+
+      cambiumidsincontig[rindex]=cambiumidsincontig[cambiumidsincontig.size()-1];
+      cambiumidsincontig.resize(cambiumidsincontig.size()-1);
+      CEBUGF("Cambiumcleanup " << cambiumidsincontig.size() << '\n');
+    }
+
+
+    // the "used time" foolguard for extremely high coverage areas
+    //  will not search for optimum then
+    if(PAF_pafparams.paf_use_emergency_search_stop){
+      struct tms mytms;
+      times(&mytms);
+      clock_t actclocks=mytms.tms_utime+mytms.tms_stime;
+      //cout << "Actclocks: " << actclocks << "\tmaxallowedclocks: " << maxallowedclocks << endl;
+      if(actclocks>maxallowedclocks){
+	// the following should not be necessary, but just to be sure
+	// (had a case where the disk got full and MIRA was stuck in
+	//  endless loop ... calling times()
+	// so I set the loop ending condition manually
+	rindex=-1;
+	
+#ifndef PUBLICQUIET
+	cout << " max time, ess activated ";
+#else
+	cout << "*";
+#endif
+	cout.flush();
+	
+	break;
+      }
+    }
+  }
+
+  if(bestread.weight>0){
+    resultread=bestread;
+
+    resultread.foundmethod=FOUND_STAGE1;
+  }else{
+    // not really needed, the resultread itself is invalid anyway
+    returnvalue=false;
+  }
+
+#ifndef PUBLICQUIET
+  cout << "\nnrc_fngo: " << numreadschecked << "\tciic.size(): " << cambiumidsincontig.size();
+#endif
+
+  // cambiumshuffling
+  // if too many reads were checked but the overlap was chosen via quickrule,
+  //  we have too much cruft at the end of the cambium
+  // move that cruft to the beginning of the cambium
+  //  but not if the number of additional ids in cambium is less than 10
+  if(foundquick 
+     && numreadschecked >500 
+     && numreadschecked < static_cast<int64>(cambiumidsincontig.size())-10) {
+    numreadschecked--;
+
+    PAF_tmpcambiumids.clear();
+    PAF_tmpcambiumids.reserve(cambiumidsincontig.capacity());
+    PAF_tmpcambiumids.insert(PAF_tmpcambiumids.end(),
+		      cambiumidsincontig.end()-numreadschecked,
+		      cambiumidsincontig.end());
+    PAF_tmpcambiumids.insert(PAF_tmpcambiumids.end(),cambiumidsincontig.begin(),
+		      cambiumidsincontig.end()-numreadschecked);
+    PAF_tmpcambiumids.swap(cambiumidsincontig);
+    PAF_tmpcambiumids.clear();
+    numreadschecked++;
+
+#ifndef PUBLICQUIET
+    cout << "\tcambiumshuffling";
+#endif
+  }
+
+#ifndef PUBLICQUIET
+  cout << '\n';
+#endif
+
+  FUNCEND();
+
+  return returnvalue;
+}
+#define CEBUGF(bla)
+
+
+
+
+/*************************************************************************
+ *
+ * allow only overlaps where the newid has a template partner in the
+ *  contig
+ *
+ *************************************************************************/
+
+//#define CEBUGF(bla)   {cout << bla; cout.flush(); }
+void Pathfinder::n4_findNextPillarCounterpart(vector<int32> & cambiumidsincontig, nextreadtoadd_t & resultread, clock_t & maxallowedclocks) 
+{
+  FUNCSTART("void Pathfinder::n4_findNextStrongGoodOverlap(const vector<int32> & cambiumidsincontig, nextreadtoadd_t & resultread, clock_t & maxallowedclocks) ");
+
+  // lr_ == local reference
+  const vector<int8> &  lr_used_ids = *PAF_used_ids_ptr;
+  const vector<uint8> & lr_istroublemaker = *PAF_istroublemaker_ptr;
+
+  if(cambiumidsincontig.size()==0) {
+    return;
+  }
+
+  nextreadtoadd_t bestread=resultread;
+  bool bestreadispaired=false;
+  uint32 peweighttobeat=0;
+  
+  
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
+#endif
+
+  bool   usetemplateinfo=(*PAF_miraparams)[Read::SEQTYPE_SANGER].getPathfinderParams().paf_use_template_information;
+  usetemplateinfo|=(*PAF_miraparams)[Read::SEQTYPE_454GS20].getPathfinderParams().paf_use_template_information;
+  usetemplateinfo|=(*PAF_miraparams)[Read::SEQTYPE_IONTORRENT].getPathfinderParams().paf_use_template_information;
+  usetemplateinfo|=(*PAF_miraparams)[Read::SEQTYPE_PACBIO].getPathfinderParams().paf_use_template_information;
+  usetemplateinfo|=(*PAF_miraparams)[Read::SEQTYPE_SOLEXA].getPathfinderParams().paf_use_template_information;
+  usetemplateinfo|=(*PAF_miraparams)[Read::SEQTYPE_ABISOLID].getPathfinderParams().paf_use_template_information;
+
+
+
+
+  bool   usequickruleSAN=(*PAF_miraparams)[Read::SEQTYPE_SANGER].getPathfinderParams().paf_use_quick_rule;
+  bool   usequickrule454=(*PAF_miraparams)[Read::SEQTYPE_454GS20].getPathfinderParams().paf_use_quick_rule;
+  bool   usequickruleION=(*PAF_miraparams)[Read::SEQTYPE_IONTORRENT].getPathfinderParams().paf_use_quick_rule;
+  bool   usequickrulePBS=(*PAF_miraparams)[Read::SEQTYPE_PACBIO].getPathfinderParams().paf_use_quick_rule;
+
+  bool   usequickruleSHORTREADS=true;
+
+  bool foundquick=false;
+
+  // going backwards through the contglist should be a tick faster than forward
+  //  also helps to retain a bit of flexibility when emergency search stops occur
+  int32 rindex=cambiumidsincontig.size()-1;
+
+  uint32 numreadschecked=0;
+  for(; rindex >=0 ; --rindex, ++numreadschecked) {
+    int32 readid=cambiumidsincontig[rindex];
+
+    // foundcandidate tells whether for this read id there are overlaps
+    //  to unassembled reads
+    // if not, the this read id is "dead" and is removed from the 
+    //  cambiumidsincontig further down (it becomes "cork" :-)
+    bool foundcandidate=false;
+
+    CEBUGF("fnO: new read " << readid << '\n');
+
+    vector<newedges_t>::const_iterator I=(*PAF_lowerbound_oedges_ptr)[readid];
+    
+    for(;I!=PAF_forward_edges->end() && I->rid1 == readid;I++){
+      
+      // don't bother looking at if overlap is banned
+      if(I->pf_banned) continue;
+      
+      CEBUGF("#1\n");
+      int32 linkedwithid=I->linked_with;
+      
+      CEBUGF("#2\n");
+      // don't bother looking at if read linked to is already used 
+      if(lr_used_ids[linkedwithid] !=0) continue;
+      
+      CEBUGF("#3\n");
+      
+      int32 otherread_partnerid=PAF_readpool->getRead(linkedwithid).getTemplatePartnerID();
+      
+      // don't bother if the read has no template partner id or
+      //  template partner is not in contig,
+      //
+      // TODO: what about troublemakers? (PAF_istroublemaker)
+      if(otherread_partnerid <0) continue;
+      CEBUGF("#3a\n");
+      if(!PAF_used_ids_in_this_run[otherread_partnerid]) continue;
+      
+      CEBUGF("#4\n");
+      
+      foundcandidate=true;
+
+      // excellent, check whether it's the best overlap we have
+      if(I->best_weight > bestread.weight) {
+	CEBUGF("#6\n");
+      
+	bestreadispaired=true;
+	bestread.refid=readid;
+	bestread.newid=linkedwithid;
+	bestread.direction_newid=I->direction;
+	bestread.ads_node=&(*PAF_adsfacts)[I->adsfindex];
+	bestread.weight=I->best_weight;
+	peweighttobeat=I->best_weight + (I->best_weight>>3);
+      }
+    }
+    
+    // If wished, we'll use quick rules (premature stop of searching)
+    //
+    if(foundcandidate){
+
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
+#endif
+
+      if((usequickrule454 || usequickruleION || usequickrulePBS || usequickruleSAN || usequickruleSHORTREADS)
+	 && bestread.weight > 0){
+
+
+	bool mayusequick=false;
+	uint8 seqtypenewread=PAF_readpool->getRead(bestread.newid).getSequencingType();
+	switch(seqtypenewread){
+	case Read::SEQTYPE_SANGER : {
+	  if(usequickruleSAN) mayusequick=true;
+	  break;
+	}
+	case Read::SEQTYPE_454GS20  : {
+	  if(usequickrule454) mayusequick=true;
+	  break;
+	}
+	case Read::SEQTYPE_IONTORRENT  : {
+	  if(usequickruleION) mayusequick=true;
+	  break;
+	}
+	case Read::SEQTYPE_SOLEXA :
+	case Read::SEQTYPE_ABISOLID : {
+	  if(usequickruleSHORTREADS) mayusequick=true;
+	  break;
+	}
+	case Read::SEQTYPE_PACBIO : {
+	  if(usequickrulePBS) mayusequick=true;
+	  break;
+	}
+	default : {
+	  MIRANOTIFY(Notify::INTERNAL, "Oooops? seqtypenewread not handled by switch?" << static_cast<uint16>(seqtypenewread) << endl);
+	}
+	}
+
+	if(mayusequick && n4_checkQuickRules(bestread.ads_node,bestread.newid)){
+	  rindex=-1;
+	  foundquick=true;
+	  break;
+	}
+
+
+	// the "used time" foolguard for extremely high coverage areas
+	//  will not search for optimum then
+	if(PAF_pafparams.paf_use_emergency_search_stop){
+	  struct tms mytms;
+	  times(&mytms);
+	  clock_t actclocks=mytms.tms_utime+mytms.tms_stime;
+	  //cout << "Actclocks: " << actclocks << "\tmaxallowedclocks: " << maxallowedclocks << endl;
+	  if(actclocks>maxallowedclocks){
+	    // the following should not be necessary, but just to be sure
+	    // (had a case where the disk got full and MIRA was stuck in
+	    //  endless loop ... calling times()
+	    // so I set the loop ending condition manually
+	    rindex=-1;
+
+#ifndef PUBLICQUIET
+	    cout << " max time, ess activated ";
+#else
+	    cout << "*";
+#endif
+	    cout.flush();
+
+	    break;
+	  }
+	}
+      }
+    }else{
+      // !foundcandidate
+      // basically, this read id has become "cork"
+      // remove it from the cambium ids by moving the last
+      //  id in the vector to this place (can be the same!)
+      //  and then reduce the vector size by 1
+
+      cambiumidsincontig[rindex]=cambiumidsincontig[cambiumidsincontig.size()-1];
+      cambiumidsincontig.resize(cambiumidsincontig.size()-1);
+    }
+  }
+
+  if(bestread.weight>0){
+    resultread=bestread;
+
+    resultread.foundmethod=FOUND_STAGE2;
+  }
+
+#ifndef PUBLICQUIET
+  cout << "\nnrc_fnpc: " << numreadschecked << '\n';
+#endif
+
+  FUNCEND();
+
+  return;
+}
+
+
+
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+
+
+
+#define CEBUG(bla)   {cout << bla; cout.flush(); }
+void Pathfinder::n4_setupAllowedReferences(vector<int32> & allowed_references, vector<int32> & ids_in_contig)
+{
+  // temporary test, probably does not harm
+  allowed_references=ids_in_contig;
+}
+#define CEBUG(bla)
+
+
+
+
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+
+//#define CEBUGF(bla)   {cout << bla; cout.flush(); }
+
+void Pathfinder::n4_findNextAllowedRefOverlap(vector<int32> & cambiumidsincontig, nextreadtoadd_t & resultread, clock_t & maxallowedclocks) 
+{
+  FUNCSTART("");
+
+  if(cambiumidsincontig.size()==0) {
+    return;
+  }
+
+  bool usequickruleSHORTREADS=true;
+  bool foundquick=false;
+
+
+  // lr_ == local reference
+  const vector<int8> &  lr_used_ids = *PAF_used_ids_ptr;
+
+  nextreadtoadd_t bestread=resultread;
+  bool bestreadispaired=false;
+  uint32 peweighttobeat=0;
+  
+  
+  int32 rindex=cambiumidsincontig.size()-1;
+
+  uint32 numreadschecked=0;
+  for(; rindex >=0 ; --rindex, ++numreadschecked) {
+    int32 readid=cambiumidsincontig[rindex];
+
+    // foundcandidate tells whether for this read id there are overlaps
+    //  to unassembled reads
+    // if not, the this read id is "dead" and is removed from the 
+    //  cambiumidsincontig further down (it becomes "cork" :-)
+    bool foundcandidate=false;
+
+
+    CEBUGF("fnO: new read " << readid << '\n');
+    CEBUGF("rindex " << rindex << '\n');
+
+    vector<newedges_t>::const_iterator I=(*PAF_lowerbound_oedges_ptr)[readid];
+    
+    for(;I!=PAF_forward_edges->end() && I->rid1 == readid;I++){
+      
+      // don't bother looking at if overlap is banned
+      //  or even whole linked read is banned
+      if(I->pf_banned 
+	 || PAF_blacklisted_ids[I->linked_with]==0) continue;
+      
+      CEBUGF("#1\n");
+      int32 linkedwithid=I->linked_with;
+      
+      CEBUGF("#2\n");
+      // don't bother looking at if read linked to is already used 
+      if(lr_used_ids[linkedwithid] !=0) continue;
+      
+      CEBUGF("#3\n");
+      
+      int32 otherread_partnerid=PAF_readpool->getRead(linkedwithid).getTemplatePartnerID();
+      
+      // if the read has template partner id but
+      //  template partner is not in contig, don't take
+      //
+      // TODO: what about troublemakers? (PAF_istroublemaker)
+      if(otherread_partnerid >0 
+	 && !PAF_used_ids_in_this_run[otherread_partnerid]) continue;
+      
+      CEBUGF("#4\n");
+      
+      foundcandidate=true;
+
+      // has the potential new read a partner in the contig?
+      if(otherread_partnerid>=0
+	 && PAF_used_ids_in_this_run[otherread_partnerid]) {
+	// yes, excellent
+	if(I->best_weight > bestread.weight) {
+	  bestreadispaired=true;
+	  bestread.refid=readid;
+	  bestread.newid=linkedwithid;
+	  bestread.direction_newid=I->direction;
+	  bestread.ads_node=&(*PAF_adsfacts)[I->adsfindex];
+	  bestread.weight=I->best_weight;
+	  peweighttobeat=I->best_weight + (I->best_weight>>3);
+	}
+      } else {
+	// nope, well, still good,
+	if(bestreadispaired){
+	  if(I->best_weight > peweighttobeat) {
+	    if(I->best_weight > bestread.weight) {
+	      bestreadispaired=false;
+	      bestread.refid=readid;
+	      bestread.newid=linkedwithid;
+	      bestread.direction_newid=I->direction;
+	      bestread.ads_node=&(*PAF_adsfacts)[I->adsfindex];
+	      bestread.weight=I->best_weight;
+	    }
+	  }
+	}else{
+	  if(I->best_weight > bestread.weight) {
+	    bestreadispaired=false;
+	    bestread.refid=readid;
+	    bestread.newid=linkedwithid;
+	    bestread.direction_newid=I->direction;
+	    bestread.ads_node=&(*PAF_adsfacts)[I->adsfindex];
+	    bestread.weight=I->best_weight;
+	  }
+	}
+      }
+    }
+
+    if(!foundcandidate){
+      // basically, this read id has become "cork"
+      // remove it from the cambium ids by moving the last
+      //  id in the vector to this place (can be the same!)
+      //  and then reduce the vector size by 1
+
+      cambiumidsincontig[rindex]=cambiumidsincontig[cambiumidsincontig.size()-1];
+      cambiumidsincontig.resize(cambiumidsincontig.size()-1);
+    }else if(usequickruleSHORTREADS){
+      // else, see if we can shorten things a bit for 454 & microreads
+
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
+#endif
+      // TODO: what about PacBio
+      if(PAF_readpool->getRead(bestread.newid).getSequencingType()==Read::SEQTYPE_SOLEXA){
+	
+	if(bestread.ads_node->getOverlapLen() >= (*PAF_miraparams)[Read::SEQTYPE_SOLEXA].getPathfinderParams().paf_quickrule_minlen1
+	   && bestread.ads_node->getScoreRatio() >= (*PAF_miraparams)[Read::SEQTYPE_SOLEXA].getPathfinderParams().paf_quickrule_minsim1){
+#ifndef PUBLICQUIET
+	  cout << " Solexa quick rule 1";
+#endif
+	  rindex=-1;
+	  foundquick=true;
+	  break;
+	}
+	
+	//  if they have an overlap >80 and expected score ratio >=90%, 
+	//  we just stop the search if they are NONMULTICOPY
+	if(bestread.ads_node->getOverlapLen() >= (*PAF_miraparams)[Read::SEQTYPE_SOLEXA].getPathfinderParams().paf_quickrule_minlen2
+	   && bestread.ads_node->getScoreRatio() >= (*PAF_miraparams)[Read::SEQTYPE_SOLEXA].getPathfinderParams().paf_quickrule_minsim2){
+#ifndef PUBLICQUIET
+	  cout << " Solexa quick rule 2";
+#endif
+	  rindex=-1;
+	  foundquick=true;
+	  break;
+	}
+      }else if(PAF_readpool->getRead(bestread.newid).getSequencingType()==Read::SEQTYPE_454GS20){
+	
+	if(bestread.ads_node->getOverlapLen() >= (*PAF_miraparams)[Read::SEQTYPE_454GS20].getPathfinderParams().paf_quickrule_minlen1
+	   && bestread.ads_node->getScoreRatio() >= (*PAF_miraparams)[Read::SEQTYPE_454GS20].getPathfinderParams().paf_quickrule_minsim1){
+#ifndef PUBLICQUIET
+	  cout << " 454 quick rule 1";
+#endif
+	  rindex=-1;
+	  foundquick=true;
+	  break;
+	}
+	
+	//  if they have an overlap >80 and expected score ratio >=90%, 
+	//  we just stop the search if they are NONMULTICOPY
+	if(bestread.ads_node->getOverlapLen() >= (*PAF_miraparams)[Read::SEQTYPE_454GS20].getPathfinderParams().paf_quickrule_minlen2
+	   && bestread.ads_node->getScoreRatio() >= (*PAF_miraparams)[Read::SEQTYPE_454GS20].getPathfinderParams().paf_quickrule_minsim2){
+#ifndef PUBLICQUIET
+	  cout << " 454 quick rule 2";
+#endif
+	  rindex=-1;
+	  foundquick=true;
+	  break;
+	}
+      }else if(PAF_readpool->getRead(bestread.newid).getSequencingType()==Read::SEQTYPE_IONTORRENT){
+	
+	if(bestread.ads_node->getOverlapLen() >= (*PAF_miraparams)[Read::SEQTYPE_IONTORRENT].getPathfinderParams().paf_quickrule_minlen1
+	   && bestread.ads_node->getScoreRatio() >= (*PAF_miraparams)[Read::SEQTYPE_IONTORRENT].getPathfinderParams().paf_quickrule_minsim1){
+#ifndef PUBLICQUIET
+	  cout << " ION quick rule 1";
+#endif
+	  rindex=-1;
+	  foundquick=true;
+	  break;
+	}
+	
+	//  if they have an overlap >80 and expected score ratio >=90%, 
+	//  we just stop the search if they are NONMULTICOPY
+	if(bestread.ads_node->getOverlapLen() >= (*PAF_miraparams)[Read::SEQTYPE_IONTORRENT].getPathfinderParams().paf_quickrule_minlen2
+	   && bestread.ads_node->getScoreRatio() >= (*PAF_miraparams)[Read::SEQTYPE_IONTORRENT].getPathfinderParams().paf_quickrule_minsim2){
+#ifndef PUBLICQUIET
+	  cout << " ION quick rule 2";
+#endif
+	  rindex=-1;
+	  foundquick=true;
+	  break;
+	}
+      }else if(PAF_readpool->getRead(bestread.newid).getSequencingType()==Read::SEQTYPE_ABISOLID){
+	
+	if(bestread.ads_node->getOverlapLen() >= (*PAF_miraparams)[Read::SEQTYPE_ABISOLID].getPathfinderParams().paf_quickrule_minlen1
+	   && bestread.ads_node->getScoreRatio() >= (*PAF_miraparams)[Read::SEQTYPE_ABISOLID].getPathfinderParams().paf_quickrule_minsim1){
+#ifndef PUBLICQUIET
+	  cout << " ABISOLID quick rule 1";
+#endif
+	  rindex=-1;
+	  foundquick=true;
+	  break;
+	}
+	
+	//  if they have an overlap >80 and expected score ratio >=90%, 
+	//  we just stop the search if they are NONMULTICOPY
+	if(bestread.ads_node->getOverlapLen() >= (*PAF_miraparams)[Read::SEQTYPE_ABISOLID].getPathfinderParams().paf_quickrule_minlen2
+	   && bestread.ads_node->getScoreRatio() >= (*PAF_miraparams)[Read::SEQTYPE_ABISOLID].getPathfinderParams().paf_quickrule_minsim2){
+#ifndef PUBLICQUIET
+	  cout << " ABISOLID quick rule 2";
+#endif
+	  rindex=-1;
+	  foundquick=true;
+	  break;
+	}
+      }
+    }
+
+    // the "used time" foolguard for extremely high coverage areas
+    //  will not search for optimum then
+    if(PAF_pafparams.paf_use_emergency_search_stop){
+      struct tms mytms;
+      times(&mytms);
+      clock_t actclocks=mytms.tms_utime+mytms.tms_stime;
+      //cout << "Actclocks: " << actclocks << "\tmaxallowedclocks: " << maxallowedclocks << endl;
+      if(actclocks>maxallowedclocks){
+	// the following should not be necessary, but just to be sure
+	// (had a case where the disk got full and MIRA was stuck in
+	//  endless loop ... calling times()
+	// so I set the loop ending condition manually
+	rindex=-1;
+	
+#ifndef PUBLICQUIET
+	cout << " max time, ess activated ";
+#else
+	cout << "*";
+#endif
+	cout.flush();
+	
+	break;
+      }
+    }
+      
+
+  }
+
+  if(bestread.weight>0){
+    resultread=bestread;
+
+    resultread.foundmethod=FOUND_STAGE100;
+  }
+
+#ifndef PUBLICQUIET
+  cout << "\nnrc_fnro: " << numreadschecked << '\n';
+#endif
+
+  FUNCEND();
+
+  return;
+}
+//#define CEBUGF(bla)   {cout << bla; cout.flush(); }
+
+
+
+
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+ 
+//#define CEBUG(bla)   {cout << bla; cout.flush(); }
+void Pathfinder::n4_buildESTContigStartWithStrongGood(vector<Align> & aligncache, int32 startid, Contig & con)
+{
+  FUNCSTART("void Pathfinder::n4_buildESTContigStartWithStrongGood(vector<Align> & aligncache, int32 startid, Contig & con)");
+
+#ifndef PUBLICQUIET
+  cout << "n4_buildESTContigStartWithStrongGood\n";
+#endif
+
+  CEBUG("bc 1\n");
+
+  vector<int8> & PAF_used_ids = *PAF_used_ids_ptr;
+
+  Contig::errorstatus_t contigerrstat;
+  // this should speed up things a bit, avoiding copying during extension
+  //  although the 10000 might be not enough for really pathological cases
+  //  with many SRMB regions and huge coverage
+  contigerrstat.reads_affected.reserve(10000);
+  contigerrstat.srmb_reads_affected.reserve(10000);
+
+  // this is a kind of duplicate of PAF_used_ids_in_this_run (which has
+  //  the size of the readpool)
+  // However, this array holds only those ids that have been built into
+  //  the contig in this call, giving a faster access to the info
+  vector<int32> & ids_in_contig = *PAF_ids_in_contig_ptr;
+  ids_in_contig.clear();
+  ids_in_contig.reserve(PAF_used_ids.size());
+
+  // "duplicate" of ids_in_contig, but gets cleared after each 
+  //  stage1, stage2, ..., stageN round below.
+  // Even faster access to the really newest additions to the contig
+  //vector<int32> PAF_fresh_ids_in_contig;
+  PAF_fresh_ids_in_contig.clear();
+  PAF_fresh_ids_in_contig.reserve(PAF_used_ids.size());
+
+  // "duplicate" of ids_in_contig, but contains ids that have overlaps
+  //  with unassembled reads and therefore can contribute to growth
+  // Once IDs have no open overlap anymore, they become dead ("cork")
+  //  and are removed from the cambium vector (by the n4_find* functions)
+  // On each change of stage, cambium_ids gets refilled with 
+  //  ids_in_contig to be sure that nothing gets lost
+  //vector<int32> & PAF_cambium_ids;
+  PAF_cambium_ids.clear();
+  PAF_cambium_ids.reserve(PAF_used_ids.size());
+
+
+  PAF_buildcontig_newlinecounter=0;
+
+
+  CEBUG("bc 3a 1\n");
+  if(startid<0) {
+    cerr << "Startid: " << startid << endl;
+    throw Notify(Notify::INTERNAL, THISFUNC,"Starting with non-existing read?");
+  }
+    
+  if(startid >= static_cast<int32>(PAF_used_ids.size())) {
+    cerr << "Startid: " << startid << endl;
+    throw Notify(Notify::INTERNAL, THISFUNC,"Starting with read id greater than number iof reads?\n");
+  }
+    
+  if(PAF_used_ids[startid]) {
+    cerr << "Startid: " << startid << endl;
+    throw Notify(Notify::INTERNAL, THISFUNC,"Starting with read that is already used?\n");
+  }
+
+  CEBUG("Startid: " << startid << endl);
+    
+#ifndef PUBLICQUIET
+  cout << endl;
+#endif
+    
+  ++PAF_readaddattempts;
+  con.addRead(aligncache, 
+	      NULL, startid, startid, 1, 
+	      (*PAF_multicopies_ptr)[startid],
+	      0,
+	      contigerrstat);
+  
+  CEBUG("bc 3a 2\n");
+
+  PAF_used_ids[startid]=1;
+  PAF_used_ids_in_this_run[startid]=1;
+  ids_in_contig.push_back(startid);
+  PAF_fresh_ids_in_contig.push_back(startid);
+  PAF_cambium_ids.push_back(startid);
+    
+#ifndef PUBLICQUIET
+  cout << endl;
+#else
+  cout << "+";
+#endif
+
+  struct tms mytms;
+  times(&mytms);
+  clock_t baseclocks=mytms.tms_utime+mytms.tms_stime;
+  clock_t actclocks=baseclocks;
+  clock_t maxallowedclocks=baseclocks+PAF_pafparams.paf_maxcontigclockticks;
+
+#ifdef CLOCK_STEPS1
+  vector<suseconds_t> us_pfsearch;
+  vector<suseconds_t> us_conadd;
+  vector<suseconds_t> us_overlapban;
+#endif
+
+  nextreadtoadd_t nrta;
+  nrta.newid=0;
+
+  uint32 statscounter=1;
+
+  // the forcegrow for addRead()
+  //  will be set to 0 for adding NMC, 10-20? for MC 
+  int32 forcegrow=0;
+
+  // stage 1 : add best overlaps
+  // stage 2 : add paired-ends only
+  
+  uint32 stage=1;
+  uint32 readsaddedinstages=0;
+  
+  /* forcenewstage is set by a stage if it explicitly wants to change
+     to a new stage after the current found overlap has been added 
+     value of forcenewstage is the target stage */
+  uint32 forcenewstage=0;
+
+  while(stage < 1000) {
+#ifndef PUBLICQUIET
+    if(statscounter == 25) {
+      cout << "rstatsm: len of c : " << con.getContigLength();
+      cout << "\nrstatsm: ids in c : " << ids_in_contig.size();
+      cout << "\nrstatsm: cids in c : " << PAF_cambium_ids.size();
+      cout << "\nrstatsm: fids in c : " << PAF_fresh_ids_in_contig.size();
+      cout << "\nrstatsi: banned o : " << PAF_overlapsbanned;
+#ifdef CLOCK_STEPS1
+      cout << "\nrstat timings: " << ids_in_contig.size();
+      cout << " : " << avg_suseconds(us_pfsearch);
+      cout << " / " << avg_suseconds(us_conadd);
+      cout << " / " << avg_suseconds(us_overlapban);
+#endif
+      cout << '\n';
+      statscounter=0;
+    }
+#endif
+
+
+    nrta.refid=-1;
+    nrta.newid=-1;
+    nrta.weight=0;
+    nrta.direction_newid=0;
+    nrta.ads_node=NULL;
+    
+#ifdef CLOCK_STEPS1
+    timeval us_start;
+    gettimeofday(&us_start,NULL);
+#endif
+
+#ifndef PUBLICQUIET
+    cout << "Searching";
+#endif
+
+    switch(stage){
+    case 1 : {
+#ifndef PUBLICQUIET
+      cout << " (stage1 overlap) ...";
+      cout.flush();
+#endif
+      forcegrow=0;
+      n4_findNextGoodOverlap(false,true,false,PAF_cambium_ids, nrta, maxallowedclocks);
+
+      break;
+    }
+    case 2 : {
+#ifndef PUBLICQUIET
+      cout << " (stage2 overlap) ...";
+      cout.flush();
+#endif
+      forcegrow=0;
+      n4_findNextPillarCounterpart(PAF_cambium_ids, nrta, maxallowedclocks);
+
+      break;
+    }
+    case 100 : {
+      // map to existing, allowing only overlaps with data
+      //  that has a frequency >3
+#ifndef PUBLICQUIET
+      cout << " (stage100 overlap) ...";
+      cout.flush();
+#endif
+      // disallow the contig to grow!
+      forcegrow=-1;
+
+      // At the moment we use the cambium ids anyway as allowed references
+      //if(PAF_cambium_ids.empty()){
+      //	n4_setupAllowedReferences(PAF_cambium_ids,ids_in_contig);
+      //}
+
+      n4_findNextAllowedRefOverlap(PAF_cambium_ids, nrta, maxallowedclocks);
+
+      // nothing found? the clear allowed references
+      if(nrta.newid < 0) {
+	PAF_cambium_ids.clear();
+      }
+      break;
+    }
+    default : {
+      cerr << "\nStage " << stage << '\n';
+      throw Notify(Notify::INTERNAL, THISFUNC, "stage not 1,2,3 ... this should not happen.\n");
+    }
+    }
+#ifndef PUBLICQUIET
+    cout << " done.\n";
+    cout.flush();
+#endif
+
+#ifdef CLOCK_STEPS1
+    us_pfsearch.push_back(diffsuseconds(us_start));
+#endif
+
+
+    if(nrta.newid < 0) {
+      // nothing found
+      // go to next stage and if we went through all stages,
+      //  go back to stage 1 only if there had been a read added
+      //  in the three stages. if not, this contigs is finished
+#ifndef PUBLICQUIET
+      cout << "\nWe were in stage " << stage << ", switching to stage " << stage+1 << endl;
+      cout << "Reads added: " << readsaddedinstages << endl;
+#endif
+      ++stage;
+      if(stage==3){
+	if(readsaddedinstages){
+	  // we added some reads in the stages. Perfect, restart
+	  //  at stage 1 to see whether we could get further.
+	  stage=1;
+	  readsaddedinstages=0;
+	}else{
+	  // nope, so start the beef up loop now
+	  stage=100;
+
+	  uint32 numreadspresent=PAF_used_ids_ptr->size();
+	  // is now also needed by n4 for stage 100 mapping, but needs to get
+	  //  initialised a bit differently (larger number). Currently done here
+	  //  switching to stage 100, can be done in basicSetup once old
+	  //  routines disappear
+	  PAF_blacklisted_ids.clear();
+	  PAF_blacklisted_ids.resize(PAF_used_ids_ptr->size(),5);
+	}
+	PAF_fresh_ids_in_contig.clear();
+      }else if(stage>=100){
+	//stop the loop now
+	stage=1000;
+      }
+      PAF_cambium_ids=ids_in_contig;
+    }else{
+#ifndef PUBLICQUIET
+      cout << nrta;
+#endif
+
+#ifdef CLOCK_STEPS1
+      gettimeofday(&us_start,NULL);
+#endif
+
+      statscounter++;
+      ++PAF_readaddattempts;
+      con.addRead(aligncache, 
+		  nrta.ads_node, nrta.refid, nrta.newid, nrta.direction_newid, 
+		  (*PAF_multicopies_ptr)[nrta.newid],
+		  forcegrow,
+		  contigerrstat);
+#ifdef CLOCK_STEPS1
+      us_conadd.push_back(diffsuseconds(us_start));
+#endif
+      
+      cout.flush();
+
+      //Contig::setCoutType(Contig::AS_TEXT);
+      //cout << ",,,,,,\n" << con << "\n\n";
+
+    
+      if(PAF_buildcontig_newlinecounter==0){
+	cout << "[" << ids_in_contig.size() << "] "; cout.flush();
+      }
+      if(contigerrstat.code == Contig::ENOERROR) {
+	ids_in_contig.push_back(nrta.newid);
+	PAF_fresh_ids_in_contig.push_back(nrta.newid);
+	PAF_cambium_ids.push_back(nrta.newid);
+	++readsaddedinstages;
+	PAF_used_ids[nrta.newid]=1;
+	PAF_used_ids_in_this_run[nrta.newid]=1;
+
+#ifndef PUBLICQUIET
+	cout << "\t+\n";
+#else
+	cout << "+";
+#endif
+      }else{
+#ifdef CLOCK_STEPS1
+	gettimeofday(&us_start,NULL);
+#endif
+	n4_handleReadNotAligned(contigerrstat,nrta);
+
+	// handle blacklisting of failed alignment when refid was a short read
+	//  and newid a long one
+	if(stage==100
+	   && PAF_readpool->getRead(nrta.refid).isSequencingType(Read::SEQTYPE_SOLEXA)
+	   && !PAF_readpool->getRead(nrta.newid).isSequencingType(Read::SEQTYPE_SOLEXA)){
+	  if(PAF_blacklisted_ids[nrta.newid]) PAF_blacklisted_ids[nrta.newid]--;
+	}
+#ifdef CLOCK_STEPS1
+	us_overlapban.push_back(diffsuseconds(us_start));
+#endif
+      }
+
+      if(forcenewstage>0){
+#ifndef PUBLICQUIET
+	cout << "\nWe were in stage " << stage << ", being forced to stage " << stage+1 << endl;
+	cout << "Reads added: " << readsaddedinstages << endl;
+#endif
+	readsaddedinstages=0;
+	stage=forcenewstage;
+	forcenewstage=0;
+	PAF_fresh_ids_in_contig.clear();
+	PAF_cambium_ids=ids_in_contig;
+      }
+
+#ifndef PUBLICQUIET
+#else
+      PAF_buildcontig_newlinecounter++;
+      if(PAF_buildcontig_newlinecounter==60){
+	PAF_buildcontig_newlinecounter=0;
+	cout << "   " << con.getContigLength();
+#ifdef CLOCK_STEPS1
+	cout << "\t" << avg_suseconds(us_pfsearch);
+	cout << " / " << avg_suseconds(us_conadd);
+	cout << " / " << avg_suseconds(us_overlapban);
+#endif
+	cout << endl;
+      }
+#endif
+
+
+    }
+
+    //if(con.getNumReadsInContig()==1198){
+    //  cout << "\npathfinder debugstop.\n";
+    //  assout::saveAsCAF(con, "test.caf", true);
+    //  abort();
+    //}
+
+    if(PAF_pafparams.paf_use_max_contig_buildtime){
+      times(&mytms);
+      actclocks=mytms.tms_utime+mytms.tms_stime;
+      if(actclocks>maxallowedclocks){
+	// the following should not be necessary, but just to be sure
+	// (had a case where the disk got full and MIRA was stuck in
+	//  endless loop ... calling times()
+	// so I set the loop ending condition manually
+	nrta.newid=-1;
+	
+	cout << "\nMaximum build time for this contig reached, aborting build.\n";
+	FUNCEND();
+	return;
+      }
+    }
+  }
+  
+  FUNCEND();
+}
+
+//#define CEBUG(bla)
+
+
+
diff --git a/src/mira/newpathfinder.H b/src/mira/newpathfinder.H
new file mode 100644
index 0000000..1a13ca9
--- /dev/null
+++ b/src/mira/newpathfinder.H
@@ -0,0 +1,405 @@
+/*
+ * Written by Bastien Chevreux (BaCh)
+ *
+ * Copyright (C) 2002 and later by Bastien Chevreux
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ * 
+ */
+
+// 	$Id$	
+
+#ifndef _bas_pathfinder_h_
+#define _bas_pathfinder_h_
+
+
+#include "stdinc/defines.H"
+
+#include <iostream>
+
+#include "mira/assembly.H"
+#include "mira/readpool.H"
+#include "mira/contig.H"
+
+
+
+struct nextreadtoadd_t{
+  int32 refid;
+  int32 newid;                   // number of read in seqpool
+  uint32 weight;
+  int16  direction_newid;
+  const AlignedDualSeqFacts * ads_node;
+
+  uint8 foundmethod;
+
+  friend ostream & operator<<(ostream &ostr, nextreadtoadd_t const &nrta);
+};
+
+
+class Pathfinder
+{
+public:
+  enum {FOUND_NORMAL_AND_SRMB, 
+	FOUND_NORMAL, 
+	FOUND_SPEEDYMAP,
+	FOUND_NONMULTICOPY, 
+
+	FOUND_TEMPLATE_AND_TPARTNER,
+	//FOUND_TEMPLATE_AND_OVERLAPPINGTPARTNER,
+	FOUND_TPARTNER_IN_CONTIG,
+	FOUND_OVERLAPPING_PARTNER,
+
+	FOUND_TEMPLATE_NONMULTICOPY_AND_TPARTNER,
+	FOUND_RAIL_AND_NONMULTICOPY,
+	FOUND_RAIL_AND_MULTICOPY,
+	FOUND_ENUMEND
+  };
+
+  enum {FOUND_STAGE1=100,
+	FOUND_STAGE2,
+	FOUND_STAGE100
+  };
+
+private:
+  //Structures
+
+  struct beststartinfo_t {
+    uint32 bsi_clustersize;
+    uint32 bsi_rid;
+    // don't need to add that one, just for debugging
+    uint32 bsi_numconnects;
+
+    friend ostream & operator<<(ostream &ostr, beststartinfo_t const &bsi){
+      ostr << "BSI: rid " << bsi.bsi_rid 
+	   << "\tcs:" << bsi.bsi_clustersize
+	   << "\tnc: " << bsi.bsi_numconnects << endl;
+      return ostr;
+    }
+  };
+
+  //Variables
+private:
+  uint32 PAF_valid;
+
+  vector<MIRAParameters> * PAF_miraparams;
+  pathfinder_parameters PAF_pafparams;
+
+
+  ReadPool * PAF_readpool;
+  vector<newedges_t>   * PAF_forward_edges;
+
+  vector<int8>  * PAF_used_ids_ptr;
+  vector<int32> * PAF_ids_in_contig_ptr;
+  vector<uint8> * PAF_istroublemaker_ptr;
+  vector<int32> * PAF_proposedSRMrightclips_ptr;
+
+  // size of number of reads in assembly
+  // is cleared on every constructStepByStep()
+  vector<int32>   PAF_fresh_ids_in_contig;
+  vector<int32>   PAF_cambium_ids;
+
+  // temporary object, used to shuffle and compress cambiumids
+  // as class variable to reduce memory allocs
+  vector<int32>   PAF_tmpcambiumids;
+
+  // size of number of reads in assembly
+  // must contain all 0 at begin of constructStepByStep()
+  vector<int8>    PAF_used_ids_in_this_run;
+  bool            PAF_uiitr_is_clean; /* tells whether
+				       * PAF_used_ids_in_this_run is clean
+				       * (i.e. all 0). If not, the setup
+				       * routine should initialise it
+				       *
+				       * used to save cleaning time for big
+				       * assemblies
+				       */
+
+  vector<AlignedDualSeqFacts> * PAF_adsfacts;
+
+  /* in this run read has a counter. Each alignment try decreases
+     by 1, when 0 is reached ->  blacklisted 
+     blacklisting is erased in-between redo-loops
+
+     Also: if a read in the contig has no more potential un-assembled
+     partner-reads -> blacklisted
+
+   */
+  vector<uint8>   PAF_blacklisted_ids;
+
+  // not used yet
+  // vector<uint8>   PAF_hasSRMBtags;     /* cache for quick lookup,
+  // 					  initialised the first time
+  // 					  the pathfinder object is 
+  // 					  started for building a new contig
+  // 				       */
+  vector<uint8> * PAF_multicopies_ptr; /* reads with more overlaps than 
+					  expected on average have 1
+					  provided by assembly class
+					  pathfinder will start building
+					  elsewhere, and include those
+					  last
+				       */
+
+  vector<bool> * PAF_wellconnected_ptr; /* reads having a level 0 overlap
+					   criterion with left extend and
+					   level 0 for right extend are 
+					   well connected
+					   (see skim and assembly for level
+					   settings)
+					 */
+
+  vector<uint8> * PAF_hasmcoverlap_ptr; /* reads that overlap with a read
+					   that is categorised as multi-
+					   copy get 1 here
+					   initialised by pathfinder if
+					   vector is empty (==once
+					   every pass of MIRA)
+					*/
+
+  /* this one is a hack to fasten up different functions
+     lower_bound() is called very often, so caching all
+     possible results (= number of reads in readpool)
+     speeds the things up
+     New from 2.7.4 on: moved outside class as needs "a lot" of time in 
+     constructor.
+     Moved to call of constructStepByStep() so that it can be re-used
+  */
+  vector<vector<newedges_t>::iterator> * PAF_lowerbound_oedges_ptr;
+
+
+  /* 
+     When in backbone assembly, this vector is initialised with
+     all read ids that have an overlap with a rail
+     The initial mapping is the to simply work through this vector
+     and try mapping each read in there once
+     Once the vector is empty, switches to normal backbone assembly.
+   */
+  vector<uint32> PAF_railoverlapcache;
+
+
+  /*
+    For each contig, newpathfinder searches the whole remaining 
+    read space for the then best start site, i.e., having the best chance
+    of having a really long, good and easy assembly stretch.
+
+    For assemblies with millions of reads, this gets slow if the assembly
+    is fragmented (i.e. 20 million reads in 20k contigs) as each search
+    may take up to a second.
+
+    If MIRA is told to use caching of all best chosen start sites (done in 
+    n4_searchBestStrongGoodStartEnvironment*(), this is the structure it uses.
+   */
+  vector<beststartinfo_t> PAF_beststartcache;;
+
+  /* set by n4_searchBestStrongGoodStartEnvironment_sub()
+     says what the startcache contains
+     0 == best quality, strong good overlaps found, well connected reads
+     1 == medium quality, overlaps but not strong good, not multicopy, well connected reads
+     2 == medium quality, overlaps but not strong good. multicopy, well connected reads
+     3 == not well connected
+     4 == singlets
+  */
+  uint8 PAF_bsccontent;
+  bool PAF_usesbeststartcache; // set to true if caching routines were used
+
+  // counter 
+
+  //  when building in public quiet mode, counts how many 
+  //  success/failure characters have been printed out
+  //  if a given limit is reached, a newline has to be printed
+  // avoids overlong lines in the logfile
+  uint16 PAF_buildcontig_newlinecounter;
+
+  int16 PAF_skipwholecontigscan_counter;
+
+  // count how many of the newedges_t elements in the vector are banned
+  //  in the constructStepByStep() run
+  // this allows to save time when starting the next contig
+  //  if no overlaps were banned, the banned flag in the edges does
+  //  not need to be reset
+  // on de-novo 6m Solexa paired-end 36mers, this saves ~60 to 70% time
+  //  in the contig building phase (and 45-50% overall)
+  uint32 PAF_overlapsbanned;
+
+  // small store is a store with a certain capacity (50k?) that takes
+  //  up iterators to all banned overlaps until full.
+  // So when it comes to reset pf_banned flag, if store is not full only
+  //  the overlap edges whose iterators are in this store have to be cleared
+  //  instead of iterating through the complete overlap edges. The latter
+  //  is needed if store is full.
+  // on de-novo 6m Solexa paired-end 36mers, this reduces another
+  //  15% in the contig building phase (38 minutes to 33 minutes)
+  // tradeoff of 5 minutes for 400k RAM is pretty good (160k RAM would
+  //  suffice in that example, but let's plan for a bit more)
+  // influence of mechanism grows with number of overlaps, so 
+  //  assemblies with more reads will profit exponentially
+  vector<vector<newedges_t>::iterator> PAF_overlapsbanned_smallstore;
+
+
+  // counts how many read add attempts there were (contig.addRead())
+  //  in this constructStepByStep() (needed for Solexa mapping assembly,
+  //  where loops can stop if no more adding attempt exists)
+  uint32 PAF_readaddattempts;
+
+  // counts how many non-multicopy reads have been added since the
+  //  last reject from the contig
+  uint32 PAF_nonmulticopiesadded;
+
+  // flag: whether this contig may add multicopy/multicopy overlaps
+  bool PAF_musthonourmcmcflag;
+  bool PAF_mayaddmcmcoverlaps;
+
+
+public:
+
+  //Functions
+private:
+  void foolCompiler();
+
+  uint32 searchBestEnvironment();
+  void buildContig(vector<Align> & aligncache,int32 startid, Contig & con);
+
+  void checkindex(int32);
+
+  void findOverlappingTemplatePartnerID(const vector<int32> & readsincontig, 
+					nextreadtoadd_t & resultread);
+  void findNextOverlap(const vector<int32> & readsincontig, 
+		       nextreadtoadd_t & resultread);
+  void prepareRailOverlapCache(const vector<bool> & allowedrefids);
+  void findNextBackboneOverlapNormal(const vector<int32> & readsincontig, 
+				     nextreadtoadd_t & resultread,
+				     const vector<bool> & allowedrefids,
+				     bool allowmulticopies, 
+				     bool allowtroublemakers);
+  void findNextBackboneOverlapQuick(nextreadtoadd_t & resultread,
+				    const vector<bool> & allowedrefids,
+				    bool allowmulticopies, 
+				    bool allowtroublemakers,
+				    bool allowsmallhits);
+
+
+  void   n3_basicCSBSSetup();
+  void   n3_handleReadNotAligned(Contig::errorstatus_t & contigerrstat,
+				 nextreadtoadd_t const &nrta);
+
+  bool n4_checkQuickRules(const AlignedDualSeqFacts * ads_node, uint32 newreadid);
+
+  void   n4_basicCSBSSetup();
+  void   n4_handleReadNotAligned(Contig::errorstatus_t & contigerrstat,
+				 nextreadtoadd_t const &nrta);
+  int32  n4_searchBestStrongGoodStartEnvironmentEST();
+  int32  n4_searchBestStrongGoodStartEnvironmentGenome();
+  int32  n4_searchBestStrongGoodStartEnvironment_sub();
+  void   n4_searchBestStrongGoodStartEnvironment_subFillCache(bool wanttroublemakercheck, 
+							      bool wantstronggoodcheck,
+							      bool wantmulticopycheck,
+							      bool wantwellconnectedcheck);
+  static bool sortbeststartinfo_t_(const beststartinfo_t & a, 
+				   const beststartinfo_t & b);
+
+  void   n4_buildContigStartWithStrongGood(
+    vector<Align> & aligncache,
+    int32 startid,
+    Contig & con);
+  bool   n4_findNextGoodOverlap(
+    bool wantfreqcheck,
+    bool allowbelowavgfreq,
+    bool allowspeedypair,
+    vector<int32> & cambiumidsincontig,
+    nextreadtoadd_t & resultread,
+    clock_t & maxallowedclocks);
+  void   n4_findNextPillarCounterpart(
+    vector<int32> & cambiumidsincontig, 
+    nextreadtoadd_t & resultread,
+    clock_t & maxallowedclocks);
+  void   n4_setupAllowedReferences(
+    vector<int32> & allowed_references,
+    vector<int32> & ids_in_contig);
+  void   n4_findNextAllowedRefOverlap(
+    vector<int32> & cambiumidsincontig,
+    nextreadtoadd_t & resultread,
+    clock_t & maxallowedclocks);
+
+  void   n4_buildESTContigStartWithStrongGood(
+    vector<Align> & aligncache,
+    int32 startid,
+    Contig & con);
+
+
+public:
+//  Pathfinder(MIRAParameters* params, 
+//	     ReadPool & readpool,
+//	     const overlap_edges_t & forward_edges,
+////	     const slist<AlignedDualSeqFacts> & adslist,
+//	     bannedoverlappairs_t & tmp_srmb_overlap_bans);
+
+  Pathfinder(vector<MIRAParameters> * params, 
+	     ReadPool & readpool,
+	     vector<newedges_t> & forward_edges,
+	     vector<AlignedDualSeqFacts> & adsfacts);
+
+  Pathfinder(Pathfinder const &other);
+  ~Pathfinder();
+
+  Pathfinder const & operator=(Pathfinder const & other);
+  friend ostream & operator<<(ostream &ostr, Pathfinder const &soc);
+
+  void discard();
+
+  void constructStepByStep(
+    vector<Align> & aligncache,
+    vector<int8> * used_ids, 
+    vector<int32> * ids_in_contig, // this is a return value
+    vector<uint8> * multicopies,
+    vector<uint8> * hasmcoverlaps,
+    vector<uint8> * istroublemaker,
+    vector<vector<newedges_t>::iterator > * lowerbound_oedges_ptr,
+    vector<int32> * proposedSRMrightclips,
+    Contig & con);
+
+  uint32 getReadAddAttempts() const {return PAF_readaddattempts;}
+
+//  void n3_constructStepByStep(
+//    vector<Align> & aligncache,
+//    vector<int8> * used_ids, 
+//    vector<uint8> * multicopies,
+//    vector<uint8> * hasmcoverlaps,
+//    vector<uint8> * istroublemaker,
+//    vector<vector<newedges_t>::iterator > * lowerbound_oedges_ptr,
+//    vector<int32> * proposedSRMrightclips,
+//    Contig & con);
+
+
+  void n4_constructStepByStep(
+    vector<Align> & aligncache,
+    vector<int8> * used_ids, 
+    vector<int32> * ids_in_contig, // this is a return value
+    vector<uint8> * multicopies,
+    vector<uint8> * hasmcoverlaps,
+    vector<uint8> * istroublemaker,
+    vector<vector<newedges_t>::iterator > * lowerbound_oedges_ptr,
+    vector<int32> * proposedSRMrightclips,
+    vector<bool> * wellconnected,
+    Contig & con);
+
+  size_t n4_getNumElementsInStartCache();
+
+};
+
+
+#endif
diff --git a/src/mira/overlapedges.H b/src/mira/overlapedges.H
deleted file mode 100644
index e26ae21..0000000
--- a/src/mira/overlapedges.H
+++ /dev/null
@@ -1,143 +0,0 @@
-// to be included by assembly, pathfinder ...
-
-#ifndef _mira_overlapedges_h_
-#define _mira_overlapedges_h_
-
-#include <iostream>
-#include "stdinc/defines.H"
-#include "mira/adsfacts.H"
-
-struct newedges_t{
-  int32 rid1;                   // number of read in seqpool
-  int32 linked_with;                   // number of read in seqpool
-  uint32 best_weight;                   // score ratio^2*score. Make sure it is >0 !!! (for pathfinder)
-  uint32 adsfindex;              // index of adsfacts elements this refers to
-  int16 direction;
-
-  bool pf_banned:1;              // temp use by pathfinder: banned overlap
-
-  bool ol_stronggood:1;  // frequency: 2*bph-1 pos at 3, thereof bph-1 contiguous
-  bool ol_weakgood:1;   // frequency: bph-1 positions contiguous at 3
-  bool ol_belowavgfreq:1; // frequency: bph-1 positions contiguous at <=3
-  bool ol_norept:1;      // nothing >3 (but can contain 1 (single hashes == errors)
-  bool ol_rept:1;      // bph-1 positions >=5
-
-  friend std::ostream & operator<<(std::ostream &ostr, const newedges_t & e){
-    ostr << "NE:\t" << e.rid1
-	 << '\t' << e.linked_with
-	 << '\t' << e.best_weight
-	 << '\t' << e.adsfindex
-	 << "\tdir " << e.direction
-	 << "\tban " << e.pf_banned
-	 << "\tsg  " << e.ol_stronggood
-	 << "\twg  " << e.ol_weakgood
-	 << "\tbaf " << e.ol_belowavgfreq
-	 << "\tnrp " << e.ol_norept
-	 << "\trep " << e.ol_rept
-	 << '\n';
-    return ostr;
-  }
-
-  // sort rid1 from low to high
-  inline static bool sortComparatorByRIDUp(const newedges_t & a, const newedges_t & b){
-    return a.rid1 < b.rid1;
-  };
-
-  // sort rid1 from low to high
-  // on equality, sort on bestweight from high to low
-  inline static bool sortComparatorByRIDUpByWeightDown(const newedges_t & a, const newedges_t & b) {
-    if(a.rid1 == b.rid1){
-      return a.best_weight > b.best_weight;
-    }
-    return a.rid1 < b.rid1;
-  }
-};
-
-
-struct skimedges_t{
-  int32  rid1;                   // number of read in seqpool
-  int32  linked_with;                   // number of read in seqpool
-  int32  eoffset;
-
-  uint32 skimweight;                   // score ratio^2*score
-
-  uint8  scoreratio;
-
-  bool ol_stronggood:1;  // frequency: 2*bph-1 pos at 3, thereof bph-1 contiguous
-  bool ol_weakgood:1;   // frequency: bph-1 positions contiguous at 3
-  bool ol_belowavgfreq:1; // frequency: bph-1 positions contiguous at <=3
-  bool ol_norept:1;      // nothing >3 (but can contain 1 (single hashes == errors)
-  bool ol_rept:1;      // bph-1 positions >= 5 freq
-
-private:
-  bool   rid1dirb:1;  // new for reduceSkimHits2
-  bool   rid2dirb:1;
-
-public:
-  uint64 skimindex:48;    // index of line in original skim file, plenty of space, should never been maxed out
-
-
-public:
-  inline int8 getRID1dir() const { return rid1dirb ? 1 : -1;}
-  inline int8 getRID2dir() const { return rid2dirb ? 1 : -1;}
-  inline void setRID1dir(int8 b) {
-    if(b>0) {
-      rid1dirb=true;
-    }else if(likely(b<0)) {
-      rid1dirb=false;
-    }else{
-      std::cout << "internal error: setRID1dir() b==0???" << std::endl;
-      exit(100);
-    }
-  }
-  inline void setRID2dir(int8 b) {
-    if(b>0) {
-      rid2dirb=true;
-    }else if(likely(b<0)) {
-      rid2dirb=false;
-    }else{
-      std::cout << "internal error: setRID2dir() b==0???" << std::endl;
-      exit(100);
-    }
-  }
-  void swapRID12dirs() { bool tmp=rid1dirb; rid1dirb=rid2dirb; rid2dirb=tmp;}
-
-
-  friend std::ostream & operator<<(std::ostream &ostr, const skimedges_t & e){
-    ostr << "SE:\t" << e.rid1
-	 << '\t' << e.linked_with
-	 << '\t' << e.eoffset
-	 << '\t' << e.skimweight
-	 << '\t' << e.skimindex
-	 << "\td1 " << static_cast<int16>(e.getRID1dir())
-	 << "\td2 " << static_cast<int16>(e.getRID2dir())
-	 << "\tsr " << static_cast<uint16>(e.scoreratio)
-	 << "\tsg  " << e.ol_stronggood
-	 << "\twg  " << e.ol_weakgood
-	 << "\tbaf " << e.ol_belowavgfreq
-	 << "\tnrp " << e.ol_norept
-	 << "\trep " << e.ol_rept
-	 << '\n';
-    return ostr;
-  }
-
-  static bool stdSortCmp(const skimedges_t & a, const skimedges_t & b);
-};
-
-
-// not sure whether worth the effort
-// Eco 1655 2*3m Solexa 100bp: 37 GiB instead of 39 GiB
-// On the other hand: that was on a table size of ~10 GiB!
-//
-// If activated again, need to rework some functions which
-//  currently use [] to use iterators (when possible)
-#if 0
-typedef std::deque<AlignedDualSeqFacts> adsfcontainer_t;
-typedef std::deque<newedges_t> necontainer_t;
-#else
-#define MIRA_ADSSTORE_CAPACITY
-typedef std::vector<AlignedDualSeqFacts> adsfcontainer_t;
-typedef std::vector<newedges_t> necontainer_t;
-#endif
-
-#endif
diff --git a/src/mira/parameters.C b/src/mira/parameters.C
index bbccc02..aa51980 100644
--- a/src/mira/parameters.C
+++ b/src/mira/parameters.C
@@ -11,76 +11,70 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
+#ifndef lint
+static char vcid[] = "$Id$";
+#endif /* lint */
 
-#include <mira/parameters.H>
-
-#include <boost/algorithm/string.hpp>   // trim, split etc.
-#include <boost/lexical_cast.hpp>
-#include <boost/tokenizer.hpp>
 
 #include "mira/parameters_tokens.h"
-#include "mira/read.H"
-#include "util/machineinfo.H"
-#include "util/fmttext.H"
+#include <mira/parameters.H>
+#include <mira/read.H>
 
+// for chdir() in cwd of parameter parsing
+#include <unistd.h>
+// for strerror() in cwd of parameter parsing
+#include <errno.h>
 
-using namespace std;
 
-//#define CEBUG(bla) {cout << bla; cout.flush();}
-#define CEBUG(bla)
+//#define CEBUG(bla)   {cout << bla; cout.flush(); }
 
 
 
+
+string MIRAParameters::MP_currentparametersection;
 bool   MIRAParameters::MP_errorinparams;
+vector<string> MIRAParameters::MP_loadfilename;
+
 
+void MIRAParameters::foolCompiler()
+{
+  (void) vcid;
+
+#ifdef __sgi
+  //(void) iostream_init;
+#endif
+}
 
 
 MIRAParameters::MIRAParameters()
 {
   MP_errorinparams=false;
   MP_parsedsomesettings=false;
-  MP_jobtechsettings=false;
   MP_loadfilename.clear();
   MP_loadfilename.reserve(12);
 
-
-  // force the MIRAParameters object to check for presence of technologies
-  //  in the manifest readgroups if a technology-dependend parameter was used
-  mp_special_params.sp_parse_checktechnologypresence=true;
-
   // start step 0 is not a valid start step for miraSearchESTSNPs
   // but this at least catches errors if they occur
   mp_special_params.sp_est_startstep=0;
+  mp_special_params.mi_stop_on_nfs=true;
   mp_special_params.mi_extended_log=false;
-  mp_special_params.mi_iknowwhatido=false;
   mp_special_params.mi_as_largecontigsize=500;
   mp_special_params.mi_as_largecontigsize4stats=5000;
-  mp_special_params.mi_extra_flag1=false;
-  mp_special_params.mi_extra_flag2=true;
-  mp_special_params.mi_extra_flag3=false;
-
-  mp_nagandwarn_params.nw_check_maxreadnamelength=NWSTOP;
-  mp_nagandwarn_params.nw_check_mrnlvalue=40;
-  mp_nagandwarn_params.nw_check_nfs=NWSTOP;
-  mp_nagandwarn_params.nw_check_templateproblems=NWSTOP;
-  mp_nagandwarn_params.nw_check_duplicatereadnames=NWSTOP;
-  mp_nagandwarn_params.nw_check_readnamesra=NWSTOP;
-  mp_nagandwarn_params.nw_check_multipassmapping=NWSTOP;
-  mp_nagandwarn_params.nw_check_coverage=NWSTOP;
-  mp_nagandwarn_params.nw_check_covvalue=80;
+  mp_special_params.mi_stop_readnamelength=40;
+
 
   mp_assembly_params.as_numthreads=2;
   mp_assembly_params.as_automemmanagement=true;
@@ -89,32 +83,23 @@ MIRAParameters::MIRAParameters()
 
   mp_skim_params.sk_numthreads=mp_assembly_params.as_numthreads;
   mp_skim_params.sk_basesperhash=17;
-  mp_skim_params.sk_bph_max=0;
-  mp_skim_params.sk_bph_increasestep=0;
   mp_skim_params.sk_hashsavestepping=4;
   mp_skim_params.sk_percentrequired=50;
   mp_skim_params.sk_maxhitsperread=2000;
   mp_skim_params.sk_maxhashesinmem=15000000;
   mp_skim_params.sk_memcaphitreduction=1024;
+  mp_skim_params.sk_maxmegahubratio=0.0;  
+  mp_skim_params.sk_masknastyrepeats=true;
   mp_skim_params.sk_alsoskimrevcomp=true;
   mp_skim_params.sk_swcheckonbackbones=true;
-  mp_skim_params.sk_filtermegahubs=true;
-  mp_skim_params.sk_maxmegahubratio=0.0;
-  mp_skim_params.sk_megahubcap=150000;
-
-  mp_hashstatistics_params.hs_freqest_minnormal=0.4;
-  mp_hashstatistics_params.hs_freqest_maxnormal=1.6;
-  mp_hashstatistics_params.hs_freqest_repeat=2.1;
-  mp_hashstatistics_params.hs_freqest_heavyrepeat=8;
-  mp_hashstatistics_params.hs_freqest_crazyrepeat=20;
-  mp_hashstatistics_params.hs_freq_covestmin=0;
-  mp_hashstatistics_params.hs_masknastyrepeats=true;
-  mp_hashstatistics_params.hs_nastyrepeatratio=100;
-  mp_hashstatistics_params.hs_nastyrepeatcoverage=0;
-  mp_hashstatistics_params.hs_repeatlevel_in_infofile=6;
-  mp_hashstatistics_params.hs_apply_digitalnormalisation=false;
-  mp_hashstatistics_params.hs_rare_kmer_final_kill=0;
-  mp_hashstatistics_params.hs_million_hashes_per_buffer=4;
+
+  mp_skim_params.sk_freqest_minnormal=0.4;
+  mp_skim_params.sk_freqest_maxnormal=1.6;
+  mp_skim_params.sk_freqest_repeat=2.1;
+  mp_skim_params.sk_freqest_heavyrepeat=8;
+  mp_skim_params.sk_freqest_crazyrepeat=20;
+  mp_skim_params.sk_nastyrepeatratio=100;
+  mp_skim_params.sk_repeatlevel_in_infofile=6;
 
   mp_pathfinder_params.paf_use_genomic_algorithms=true;
   mp_pathfinder_params.paf_use_emergency_blacklist=true;
@@ -135,14 +120,7 @@ MIRAParameters::MIRAParameters()
   setPathfinderMaxContigTime(mp_pathfinder_params.paf_max_contig_buildtime);
   setPathfinderNextReadMaxTimeToESS(1);
 
-  mp_edit_params.ed_sdbg_readedit=true;
-
-  mp_edit_params.ed_mira_automatic_contic_editing=true;
-  mp_edit_params.ed_kmer_singlets=true;
-  mp_edit_params.ed_homopolymer_overcalls=false;
-
-  // Thomas' editor, currently unused
-  mp_edit_params.ed_edit_automatic_contic_editing=false;
+  mp_edit_params.ed_automatic_contic_editing=true;
   mp_edit_params.ed_strict_editing_mode=false;
   mp_edit_params.ed_confirmation_threshold=50;
 
@@ -151,28 +129,39 @@ MIRAParameters::MIRAParameters()
   mp_assembly_params.as_minimum_readlength=80;
   mp_assembly_params.as_minimum_readspercontig=1;
 
-  mp_assembly_params.as_buntify_reads=true;
-  mp_assembly_params.as_rle_reads=false;
+  mp_assembly_params.as_buntify_reads=true; 
 
+  mp_assembly_params.as_loadbackbone=false; 
+  mp_assembly_params.as_backbone_strainname="ReferenceStrain";
   mp_assembly_params.as_backbone_rail_fromstrain="";
   mp_assembly_params.as_backbone_strainname_forceforall=false;
+  mp_assembly_params.as_infile_backbone_which="fasta";
   mp_assembly_params.as_backbone_raillength=0;
   mp_assembly_params.as_backbone_railoverlap=0;
   mp_assembly_params.as_backbone_outlen=30000;
+  mp_assembly_params.as_backbone_basequals=30;
   mp_assembly_params.as_backbone_alsobuildnewcontigs=true;
-  mp_assembly_params.as_backbone_trimoverhangingreads=true;
-  mp_assembly_params.as_backbone_bootstrapnewbackbone=true;
 
-  mp_assembly_params.as_assemblyjob_accurate=true;
-  mp_assembly_params.as_assemblyjob_mapping=false;
-  mp_assembly_params.as_assemblyjob_preprocessonly=false;
+  mp_assembly_params.as_loadstraindata=false;
+  mp_assembly_params.as_assigndefaultstrain=false;
+  mp_assembly_params.as_default_strainname="StrainX";
 
+  mp_assembly_params.as_mergexmltraceinfo=false;
+
+  mp_assembly_params.as_load_sequencedata=false;
   mp_assembly_params.as_enforce_qualsinreads=true;
   mp_assembly_params.as_wants_qualityfile=true;
+  mp_assembly_params.as_infile_which="fasta";
+
+
+  mp_assembly_params.as_fastq_qualoffset=0;
+  mp_assembly_params.as_loadSOLEXA_solexa_scores_in_qual_files=false;
+
 
   mp_assembly_params.as_cleanup_tmpfiles=0;
   mp_assembly_params.as_spoilerdetection=true;
   mp_assembly_params.as_spdetect_lastpassonly=true;
+  mp_assembly_params.as_keep_long_repeats_separated=true;
   mp_assembly_params.as_automatic_repeat_detection=true;
   mp_assembly_params.as_ard_multicopythreshold=2.0;
   mp_assembly_params.as_ard_multicopyminlen=400;
@@ -180,7 +169,7 @@ MIRAParameters::MIRAParameters()
   mp_assembly_params.as_uniform_read_distribution=true;
   mp_assembly_params.as_urd_startinpass=3;
   mp_assembly_params.as_urd_cutoffmultiplier=1.5;
-  mp_assembly_params.as_numpasses=0;
+  mp_assembly_params.as_numpasses=3;
   mp_assembly_params.as_maxcontigsperpass=0;
   mp_assembly_params.as_numrmbbreakloops=2;
   mp_assembly_params.as_startbackboneusage_inpass=3;
@@ -189,10 +178,14 @@ MIRAParameters::MIRAParameters()
   mp_assembly_params.as_readextension_window_maxerrors=2;
   mp_assembly_params.as_readextension_firstpassnum=0;
   mp_assembly_params.as_readextension_lastpassnum=0;
-  //mp_assembly_params.as_skimeachpass=true;
+  mp_assembly_params.as_skimeachpass=true;
   mp_assembly_params.as_mark_repeats=true;
   mp_assembly_params.as_mark_repeats_onlyinresult=false;
+  mp_assembly_params.as_readnaming_scheme=0;   // should be sanger scheme
 
+  mp_assembly_params.as_basedefaultqual=10;
+  
+  //mp_assembly_params.as_projectname="mira";
   mp_assembly_params.as_projectname_in="mira";
   mp_assembly_params.as_projectname_out=mp_assembly_params.as_projectname_in;
 
@@ -200,14 +193,15 @@ MIRAParameters::MIRAParameters()
 
   mp_assembly_params.as_filecheck_only=false;
 
+  mp_assembly_params.as_keepcontigsinmem=false;
   mp_assembly_params.as_savesimplesingletsinproject=false;
   mp_assembly_params.as_savetaggedsingletsinproject=true;
 
   mp_assembly_params.as_output_caf=true;
   mp_assembly_params.as_output_maf=true;
   mp_assembly_params.as_output_fasta=true;
-  mp_assembly_params.as_output_gap4da=false;
-  mp_assembly_params.as_output_ace=false;
+  mp_assembly_params.as_output_gap4da=true;
+  mp_assembly_params.as_output_ace=true;
   mp_assembly_params.as_output_gff3=false;
   mp_assembly_params.as_output_wiggle=true;
   mp_assembly_params.as_output_html=false;
@@ -233,49 +227,33 @@ MIRAParameters::MIRAParameters()
   mp_assembly_params.as_output_removerollovertmps=true;
   mp_assembly_params.as_output_removetmpdir=false;
 
-  mp_assembly_params.as_clip_sdbg_chimeradetection=true;
-  mp_assembly_params.as_clip_kmer_junkdetection=true;
-  mp_assembly_params.as_clip_kmer_junkkill=true;
-
-  mp_assembly_params.as_clip_skimchimeradetection=false;
-  mp_assembly_params.as_clip_skimjunkdetection=false;
+  mp_assembly_params.as_clip_skimchimeradetection=true;
+  mp_assembly_params.as_clip_skimjunkdetection=true;
   mp_assembly_params.as_clip_proposeendclips=true;
   mp_assembly_params.as_clip_pec_sxaggcxg=true;
   mp_assembly_params.as_clip_pec_basesperhash=17;
-  mp_assembly_params.as_clip_pec_ffreq=0;
-  mp_assembly_params.as_clip_pec_bfreq=0;
-  mp_assembly_params.as_clip_pec_mkfr=1;
-  mp_assembly_params.as_clip_pec_mtk=3;
-  mp_assembly_params.as_clip_pec_ffr=false;
-  mp_assembly_params.as_clip_pec_bfr=false;
-  mp_assembly_params.as_clip_pec_fcmst=false;
-  mp_assembly_params.as_clip_pec_bcmst=false;
-  mp_assembly_params.as_clip_pec_fsalp=false;
-  mp_assembly_params.as_clip_pec_bsalp=false;
 
   mp_assembly_params.as_clip_badsolexaends=false;
   mp_assembly_params.as_clip_knownadaptorsright=false;
-  mp_assembly_params.as_search_phix174=false;
-  mp_assembly_params.as_filter_phix174=false;
 
-  mp_assembly_params.as_clip_lowercase_front=false;
-  mp_assembly_params.as_clip_lowercase_back=false;
+  mp_assembly_params.as_clip_lowercase=false;
 
   mp_assembly_params.as_clip_polyat=false;
-  mp_assembly_params.as_clip_polyat_keeppolystretch=false;
+  mp_assembly_params.as_clip_polyat_keeppolysignal=false;
   mp_assembly_params.as_clip_polyat_len=12;
   mp_assembly_params.as_clip_polyat_maxerrors=1;
   mp_assembly_params.as_clip_polyat_maxgap=9;
 
   mp_assembly_params.as_clip_3ppolybase=false;
-  mp_assembly_params.as_clip_3ppolybase_len=15;
-  mp_assembly_params.as_clip_3ppolybase_maxerrors=3;
+  mp_assembly_params.as_clip_3ppolybase_len=12;
+  mp_assembly_params.as_clip_3ppolybase_maxerrors=2;
   mp_assembly_params.as_clip_3ppolybase_maxgap=9;
 
   mp_assembly_params.as_clip_possible_vectors=true;
   mp_assembly_params.as_clip_quality=true;
   mp_assembly_params.as_clip_badstretchquality=true;
   mp_assembly_params.as_clip_maskedbases=true;
+  mp_assembly_params.as_clip_mergessahavectorscreen=false;
 
   mp_assembly_params.as_clip_quality_minthreshold=0;
   mp_assembly_params.as_clip_quality_numminthreshold=0;
@@ -300,7 +278,9 @@ MIRAParameters::MIRAParameters()
   mp_assembly_params.as_clip_minsrrequired=10;
   mp_assembly_params.as_clip_minqrsetto=20;
 
-  mp_assembly_params.as_clipmask_rarekmers=false;
+  mp_assembly_params.as_external_qual=E_QUAL_SCF;
+  mp_assembly_params.as_external_qual_override=0;
+  mp_assembly_params.as_discard_read_on_eq_error=false;
 
 // Initialise the scoring scheme for the similarity matrix
   mp_dynamic_params.dyn_score_multiplier=10;
@@ -327,22 +307,25 @@ MIRAParameters::MIRAParameters()
   mp_align_params.al_kmin=25;
   mp_align_params.al_kmax=100;
   mp_align_params.al_kpercent=15;
-  mp_align_params.al_solexahack_maxerrors=-1;
+  mp_align_params.al_solexahack_maxerrors=0;
+  mp_align_params.ads_enforce_clean_ends=false;
+  mp_align_params.ads_clean_end_distance=0;
 
   mp_align_params.ads_extra_gap_penalty=false;
-  setAlignGapPenaltyLevel(std::string("0,5,10,20,40,80,100"));
+  setAlignGapPenaltyLevel(0);
   mp_align_params.ads_max_gppercent=100;
   mp_align_params.ads_enforce_clean_ends=false;
   mp_align_params.ads_clean_end_distance=0;
-  mp_align_params.ads_clean_end_mismatchallowed=0;
   //mp_align_params.ads_extra_mismatch_penalty=true;
   //mp_align_params.ads_emp_windowlen=30;
   //mp_align_params.ads_emp_maxmismatches=15;
 
   mp_contig_params.con_reject_on_drop_in_relscore=15;
-  mp_contig_params.con_min_relscore=-1;
   mp_contig_params.con_danger_analyse_mode=ANALYSE_SIGNAL;
   mp_contig_params.con_danger_max_error_rate=1;         // 1% error rate
+  mp_contig_params.con_insertsize_minimum=-1;
+  mp_contig_params.con_insertsize_maximum=-1;
+  mp_contig_params.con_template_build_direction=-1;
 
   mp_contig_params.con_assume_snp_insteadof_rmb=false;
   mp_contig_params.con_disregard_spurious_rmb_mismatches=true;
@@ -359,11 +342,10 @@ MIRAParameters::MIRAParameters()
   mp_contig_params.con_minreadspergroup=2;
   mp_contig_params.con_gap_override_ratio=66;
 
-  mp_contig_params.con_force_nonIUPACconsensus=false;
   mp_contig_params.con_force_nonIUPACconsensus_perseqtype=false;
+  mp_contig_params.con_force_nonIUPACconsensus_amongseqtypes=false;
   mp_contig_params.con_mergeshortreads=false;
   mp_contig_params.con_msr_keependsunmapped=-1;
-  mp_contig_params.con_msr_maxerrors=0;
 
   mp_contig_params.con_output_text_cpl=60;
   mp_contig_params.con_output_html_cpl=60;
@@ -371,6 +353,11 @@ MIRAParameters::MIRAParameters()
   mp_contig_params.con_output_html_gapfill=' ';
 
   mp_directory_params.dir_tmp_redirectedto="";
+  mp_directory_params.dir_scf="";
+  mp_directory_params.dir_exp="";
+  mp_directory_params.dir_fasta="";
+
+  setAssemblyUseTemplateInformation(true);
 }
 
 
@@ -380,71 +367,36 @@ MIRAParameters::~MIRAParameters()
 
 
 
-void MIRAParameters::setupStdMIRAParameters(vector<MIRAParameters> & Pv, bool verbose)
-{
+void MIRAParameters::setupStdMIRAParameters(vector<MIRAParameters> & Pv, bool verbose){
   Pv.clear();
-  Pv.resize(ReadGroupLib::SEQTYPE_END);
+  Pv.resize(Read::SEQTYPE_END);
 
   generateProjectNames(Pv);
 
-#if CPP_READ_SEQTYPE_END != 8
-#error "This code is made for 8 sequencing types, adapt!"
-#endif
-  {
-    auto testPv=Pv;
-    const char * ms_dn_f =
-      "--job=denovo,fragments,accurate,sanger,454,iontor,pcbiolq,pcbiohq,text,solexa,solid"
-      ;
-    const char * ms_dn_g =
-      "--job=denovo,genome,accurate,sanger,454,iontor,pcbiolq,pcbiohq,text,solexa,solid"
-      ;
-    const char ms_dn_e[] =
-      "--job=denovo,est,accurate,sanger,454,iontor,pcbiolq,pcbiohq,text,solexa,solid"
-      ;
-    const char ms_m_g[] =
-      "--job=mapping,genome,accurate,sanger,454,iontor,pcbiolq,pcbiohq,text,solexa,solid"
-      ;
-    const char ms_m_e[] =
-      "--job=mapping,est,accurate,sanger,454,iontor,pcbiolq,pcbiohq,text,solexa,solid"
-      ;
+  const char modestring[] = 
+    "\n--job=denovo,genome,accurate,sanger,454,iontor,pacbio,solexa,solid -SB:lb=no"
+    ;
 
-    const char * apptr=ms_dn_f;
-    try {
-      parseQuickmodeNoTechSettingsChange(apptr,
-					 "Default settings",
-					 testPv, verbose);
-      apptr=ms_dn_g;
-      parseQuickmodeNoTechSettingsChange(apptr,
-					 "Default settings",
-					 testPv, verbose);
-      apptr=ms_dn_e;
-      parseQuickmodeNoTechSettingsChange(apptr,
-					 "Default settings",
-					 testPv, verbose);
-      apptr=ms_m_g;
-      parseQuickmodeNoTechSettingsChange(apptr,
-					 "Default settings",
-					 testPv, verbose);
-      apptr=ms_m_e;
-      parseQuickmodeNoTechSettingsChange(apptr,
-					 "Default settings",
-					 testPv, verbose);
-    }
-    catch (Notify n) {
-      std::ostringstream my__emsg;
-      my__emsg << "Error while parsing MIRA-internal standard parameters:\n"
-	       << apptr
-	       << "\n\nThere is nothing you can do about it, this is a blunder by the author."
-	       << "\nPlease file a bug report immediately.";
-      n.setMsg(my__emsg.str().c_str());
-      n.setGravity(Notify::INTERNAL);
-      n.handleError(n.tif);
-    }
+  // "\n\t-OUT:sssip=no:stsip=no:org=no"
+  
+  try {
+    parseQuickmodeNoTechSettingsChange(modestring, 
+				       "Default settings",
+				       Pv, verbose, NULL);
   }
+  catch (Notify n) {
+    cout << "\nError while parsing MIRA-internal standard parameters!"
+      "\nThere is nothing you can do about it, this is a blunder by the author."
+      "\nPlease immediately file a bug report.\n";
 
-  //for(auto & pve : Pv){
-  //  pve.MP_parsedsomesettings=false;
-  //}
+    n.setGravity(Notify::INTERNAL);
+    n.handleError(n.tif);
+  }
+
+  for(uint32 i=0; i<Read::SEQTYPE_END; i++){
+    Pv[i].MP_parsedsomesettings=false;
+    Pv[i].mp_assembly_params.as_load_sequencedata=false;
+  }
 
 }
 
@@ -455,44 +407,14 @@ void MIRAParameters::postParsingChanges(vector<MIRAParameters> & Pv)
   FUNCSTART("void MIRAParameters::postParsingChanges(vector<MIRAParameters> & Pv)");
   BUGIFTHROW(Pv.empty(), "Empty MIRAParameters vector???");
 
-  assembly_parameters const & as_fixparams= Pv[0].mp_assembly_params;
-
-  if(as_fixparams.as_clip_proposeendclips
+  if(Pv[0].mp_assembly_params.as_clip_proposeendclips
      && Pv[0].mp_contig_params.con_emea_setzero_on_clipping_pec){
     cout << "-CL:pec and -CO:emeas1clpec are set, setting -CO:emea values to 1.\n";
-    for(uint32 i=0; i<ReadGroupLib::SEQTYPE_END; i++){
+    for(uint32 i=0; i<Read::SEQTYPE_END; i++){
       Pv[i].mp_contig_params.con_endreadmarkexclusionarea=1;
     }
   }
 
-  if(Pv[0].mp_nagandwarn_params.nw_check_multipassmapping!=NWNONE
-     && as_fixparams.as_assemblyjob_mapping
-     && (as_fixparams.as_numpasses>1
-	 || as_fixparams.as_numrmbbreakloops>1)){
-    string wmsg="You are running a mapping job with:";
-    if(as_fixparams.as_numpasses>1){
-      wmsg+="\n-AS:nop="+boost::lexical_cast<string>(as_fixparams.as_numpasses);
-    }
-    if(as_fixparams.as_numrmbbreakloops>1){
-      wmsg+="\n-AS:rbl="+boost::lexical_cast<string>(as_fixparams.as_numrmbbreakloops);
-    }
-    wmsg+="\n\nA mapping assembly with the above parameter(s) >1 will probably not"
-      " produce what you expect. For haploid organisms or for simple SNP search in"
-      " multiploid organisms, maybe you should rethink your choice."
-      "\nHowever, certain use cases do benefit from the parameters you have chosen."
-      " E.g., doing clean mappings of multiploid organisms. If you think"
-      " you want this, please use the following parameter to let MIRA continue:"
-      "\n -NW:cmpm=warn"
-      "\nor"
-      "\n -NW:cmpm=no"
-      ;
-    if(Pv[0].mp_nagandwarn_params.nw_check_multipassmapping==NWSTOP){
-      MIRANOTIFY(Notify::FATAL,wmsg);
-    }else{
-      cout << "\nWARNING!\n" << FmtText::wordWrap(wmsg,80) << endl;
-    }
-  }
-
   correctTmpDirectory(Pv);
 
   FUNCEND();
@@ -507,21 +429,15 @@ void MIRAParameters::dumpAllParams(vector<MIRAParameters> & Pv, ostream & ostr)
   BUGIFTHROW(Pv.empty(), "Empty MIRAParameters vector???");
 
   vector<int> indexesInPv;
-  //indexesInPv.push_back(0);
+  indexesInPv.push_back(0);
 
-  for(uint32 i=0; i<ReadGroupLib::SEQTYPE_END; i++){
-    if(Pv[i].MP_jobtechsettings){
+  for(uint32 i=1; i<Read::SEQTYPE_END; i++){
+    if(Pv[i].mp_assembly_params.as_load_sequencedata
+       || Pv[i].MP_parsedsomesettings){
       indexesInPv.push_back(i);
     }
   }
 
-  // What a cludge:
-  // multiParamPrint() uses size of vector to decide whether it is a technology dependent parameter or not
-  // Which, for projects with just one technology, would not print out the "[tech]" qualifier. Not good.
-  // Therefore, add the SEQTYPE_END qualifier (and make sure it's caught later on)
-  // TODO: rethink this whole thing.
-  indexesInPv.push_back(ReadGroupLib::SEQTYPE_END);
-
   dumpAllParams(Pv, indexesInPv, ostr);
 
   FUNCEND();
@@ -530,19 +446,45 @@ void MIRAParameters::dumpAllParams(vector<MIRAParameters> & Pv, ostream & ostr)
 void MIRAParameters::dumpAllParams(vector<MIRAParameters> & Pv, const vector<int> & indexesInPv, ostream & ostr)
 {
   FUNCSTART("void MIRAParameters::dumpAllParams(vector<MIRAParameters> & Pv, const vector<int> & indexesInPv, ostream & ostr)");
-
+  
   BUGIFTHROW(indexesInPv.empty(), "Trying to dump nothing?\n");
+  
+  cout << "------------------------------------------------------------------------------\nParameter settings seen for:\n";
 
-  ostr << "------------------------------------------------------------------------------\nParameter settings seen for:\n";
-
-#if CPP_READ_SEQTYPE_END != 8
-#error "This code is made for 8 sequencing types, adapt!"
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
 #endif
 
   for(uint32 i=0; i<indexesInPv.size(); i++){
-    if(indexesInPv[i] != SEQTYPE_END){
-      if(i>0) ostr << ", ";
-      ostr << ReadGroupLib::getNameOfSequencingType(i) << " data";
+    if(i>0) cout << ", ";
+    switch(indexesInPv[i]){
+    case Read::SEQTYPE_SANGER:{
+      cout << "Sanger data (also common parameters)";
+      break;
+    }
+    case Read::SEQTYPE_454GS20:{
+      cout << "454 data";
+      break;
+    }
+    case Read::SEQTYPE_IONTORRENT:{
+      cout << "IonTorrent data";
+      break;
+    }
+    case Read::SEQTYPE_PACBIO:{
+      cout << "PacBio data";
+      break;
+    }
+    case Read::SEQTYPE_SOLEXA:{
+      cout << "Solexa data";
+      break;
+    }
+    case Read::SEQTYPE_ABISOLID:{
+      cout << "SOLiD data";
+      break;
+    }
+    default: {
+      // intentionally do nothing
+    }
     }
   }
 
@@ -554,13 +496,11 @@ void MIRAParameters::dumpAllParams(vector<MIRAParameters> & Pv, const vector<int
   dumpDataProcessingParams(Pv, indexesInPv, ostr);
   dumpClippingParams(Pv, indexesInPv, ostr);
   dumpSkimParams(Pv, indexesInPv, ostr);
-  dumpHashStatisticsParams(Pv, indexesInPv, ostr);
   dumpPathfinderParams(Pv, indexesInPv, ostr);
   dumpAlignParams(Pv, indexesInPv, ostr);
   dumpContigParams(Pv, indexesInPv, ostr);
   dumpEditParams(Pv, indexesInPv, ostr);
   dumpMiscParams(Pv, indexesInPv, ostr);
-  dumpNagAndWarnParams(Pv, indexesInPv, ostr);
   dumpDirectoryParams(Pv, indexesInPv, ostr);
   dumpFileInParams(Pv, indexesInPv, ostr);
   dumpFileOutParams(Pv, indexesInPv, ostr);
@@ -585,9 +525,9 @@ void MIRAParameters::dumpFileDirectoryOutNamesParams(vector<MIRAParameters> & Pv
   ostr << "\tMAF             : ";
   OUTSTRING(ostr, (Pv[0].mp_assembly_params.as_outfile_MAF+".maf"));
   ostr << "\tFASTA           : ";
-  OUTSTRING(ostr, (Pv[0].mp_assembly_params.as_outfile_FASTAUNPADDED+".fasta"));
+  OUTSTRING(ostr, (Pv[0].mp_assembly_params.as_outfile_FASTA+".fasta"));
   ostr << "\tFASTA quality   : ";
-  OUTSTRING(ostr, (Pv[0].mp_assembly_params.as_outfile_FASTAUNPADDED+".fasta.qual"));
+  OUTSTRING(ostr, (Pv[0].mp_assembly_params.as_outfile_FASTA+".fasta.qual"));
   ostr << "\tFASTA (padded)  : ";
   OUTSTRING(ostr, (Pv[0].mp_assembly_params.as_outfile_FASTAPADDED+".fasta"));
   ostr << "\tFASTA qual.(pad): ";
@@ -623,20 +563,20 @@ void MIRAParameters::dumpOutputCustomisationParams(vector<MIRAParameters> & Pv,
 
   ostr << "\n    Alignment output customisation:\n";
 
-  multiParamPrint(Pv, singlePvIndex, ostr,
+  multiParamPrint(Pv, singlePvIndex, ostr, 
 		  Pv[0].mp_contig_params.con_output_text_cpl,
 		  "\t", "TEXT characters per line (tcpl)",
 		  fieldlength);
-  multiParamPrint(Pv, singlePvIndex, ostr,
+  multiParamPrint(Pv, singlePvIndex, ostr, 
 		  Pv[0].mp_contig_params.con_output_html_cpl,
 		  "\t", "HTML characters per line (hcpl)",
 		  fieldlength);
 
-  multiParamPrint(Pv, singlePvIndex, ostr,
+  multiParamPrint(Pv, singlePvIndex, ostr, 
 		  Pv[0].mp_contig_params.con_output_text_gapfill,
 		  "\t", "TEXT end gap fill character (tegfc)",
 		  fieldlength);
-  multiParamPrint(Pv, singlePvIndex, ostr,
+  multiParamPrint(Pv, singlePvIndex, ostr, 
 		  Pv[0].mp_contig_params.con_output_html_gapfill,
 		  "\t", "HTML end gap fill character (hegfc)",
 		  fieldlength);
@@ -658,62 +598,62 @@ void MIRAParameters::dumpFileTempParams(vector<MIRAParameters> & Pv, const vecto
 
   ostr << "\n    Temporary result files:\n";
 
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
 		      Pv[0].mp_assembly_params.as_output_tmp_caf,
 		      "\t", "Saved as CAF                       (otc)",
 		      fieldlength);
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
 		      Pv[0].mp_assembly_params.as_output_tmp_maf,
 		      "\t", "Saved as MAF                       (otm)",
 		      fieldlength);
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
 		      Pv[0].mp_assembly_params.as_output_tmp_fasta,
 		      "\t", "Saved as FASTA                     (otf)",
 		      fieldlength);
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
 		      Pv[0].mp_assembly_params.as_output_tmp_gap4da,
 		      "\t", "Saved as GAP4 (directed assembly)  (otg)",
 		      fieldlength);
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
 		      Pv[0].mp_assembly_params.as_output_tmp_ace,
 		      "\t", "Saved as phrap ACE                 (ota)",
 		      fieldlength);
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
 		      Pv[0].mp_assembly_params.as_output_tmp_html,
 		      "\t", "Saved as HTML                      (oth)",
 		      fieldlength);
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
 		      Pv[0].mp_assembly_params.as_output_tmp_tcs,
 		      "\t", "Saved as Transposed Contig Summary (ots)",
 		      fieldlength);
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
 		      Pv[0].mp_assembly_params.as_output_tmp_txt,
 		      "\t", "Saved as simple text format        (ott)",
 		      fieldlength);
 
   ostr << "\n    Extended temporary result files:\n";
 
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
 		      Pv[0].mp_assembly_params.as_output_exttmp_caf,
 		      "\t", "Saved as CAF                      (oetc)",
 		      fieldlength);
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
 		      Pv[0].mp_assembly_params.as_output_exttmp_fasta,
 		      "\t", "Saved as FASTA                    (oetf)",
 		      fieldlength);
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
 		      Pv[0].mp_assembly_params.as_output_exttmp_gap4da,
 		      "\t", "Saved as GAP4 (directed assembly) (oetg)",
 		      fieldlength);
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
 		      Pv[0].mp_assembly_params.as_output_exttmp_ace,
 		      "\t", "Saved as phrap ACE                (oeta)",
 		      fieldlength);
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
 		      Pv[0].mp_assembly_params.as_output_exttmp_html,
 		      "\t", "Saved as HTML                     (oeth)",
 		      fieldlength);
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
 		      Pv[0].mp_assembly_params.as_output_exttmp_alsosinglets,
 		      "\t", "Save also singlets               (oetas)",
 		      fieldlength);
@@ -734,22 +674,22 @@ void MIRAParameters::dumpFileOutParams(vector<MIRAParameters> & Pv, const vector
 
   ostr << "\n  Output files (-OUTPUT/-OUT):\n";
 
-  multiParamPrintBool(Pv, indexesInPv, ostr,
+  multiParamPrintBool(Pv, indexesInPv, ostr, 
 		      Pv[0].mp_assembly_params.as_savesimplesingletsinproject,
 		      "\t", "Save simple singlets in project (sssip)",
 		      fieldlength);
-  multiParamPrintBool(Pv, indexesInPv, ostr,
+  multiParamPrintBool(Pv, indexesInPv, ostr, 
 		      Pv[0].mp_assembly_params.as_savetaggedsingletsinproject,
 		      "\t", "Save tagged singlets in project (stsip)",
 		      fieldlength);
 
   ostr << '\n';
 
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
 		      Pv[0].mp_assembly_params.as_output_removerollovertmps,
 		      "\t", "Remove rollover tmps (rrot)",
 		      fieldlength);
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
 		      Pv[0].mp_assembly_params.as_output_removetmpdir,
 		      "\t", "Remove tmp directory (rtd)",
 		      fieldlength);
@@ -757,43 +697,43 @@ void MIRAParameters::dumpFileOutParams(vector<MIRAParameters> & Pv, const vector
 
   ostr << "\n    Result files:\n";
 
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
 		      Pv[0].mp_assembly_params.as_output_caf,
 		      "\t", "Saved as CAF                       (orc)",
 		      fieldlength);
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
 		      Pv[0].mp_assembly_params.as_output_maf,
 		      "\t", "Saved as MAF                       (orm)",
 		      fieldlength);
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
 		      Pv[0].mp_assembly_params.as_output_fasta,
 		      "\t", "Saved as FASTA                     (orf)",
 		      fieldlength);
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
 		      Pv[0].mp_assembly_params.as_output_gap4da,
 		      "\t", "Saved as GAP4 (directed assembly)  (org)",
 		      fieldlength);
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
 		      Pv[0].mp_assembly_params.as_output_ace,
 		      "\t", "Saved as phrap ACE                 (ora)",
 		      fieldlength);
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
 		      Pv[0].mp_assembly_params.as_output_gff3,
 		      "\t", "Saved as GFF3                     (org3)",
 		      fieldlength);
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
 		      Pv[0].mp_assembly_params.as_output_html,
 		      "\t", "Saved as HTML                      (orh)",
 		      fieldlength);
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
 		      Pv[0].mp_assembly_params.as_output_tcs,
 		      "\t", "Saved as Transposed Contig Summary (ors)",
 		      fieldlength);
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
 		      Pv[0].mp_assembly_params.as_output_txt,
 		      "\t", "Saved as simple text format        (ort)",
 		      fieldlength);
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
 		      Pv[0].mp_assembly_params.as_output_wiggle,
 		      "\t", "Saved as wiggle                    (orw)",
 		      fieldlength);
@@ -803,7 +743,6 @@ void MIRAParameters::dumpFileOutParams(vector<MIRAParameters> & Pv, const vector
 // static func
 void MIRAParameters::dumpFileInParams(vector<MIRAParameters> & Pv, const vector<int> & indexesInPv, ostream & ostr)
 {
-  return;
   const int32 fieldlength=46;
 
   vector<int> singlePvIndex;
@@ -814,6 +753,76 @@ void MIRAParameters::dumpFileInParams(vector<MIRAParameters> & Pv, const vector<
   }
 
   ostr << "\n  File names (-FN):\n";
+
+  multiParamPrint(Pv, indexesInPv, ostr, 
+		  Pv[0].mp_assembly_params.as_infile_FASTA,
+		  "\t", "When loading sequences from FASTA",
+		  fieldlength);
+  multiParamPrint(Pv, indexesInPv, ostr, 
+		  Pv[0].mp_assembly_params.as_infile_FASTAQUAL,
+		  "\t", "When loading qualities from FASTA quality",
+		  fieldlength);
+  multiParamPrint(Pv, indexesInPv, ostr, 
+		  Pv[0].mp_assembly_params.as_infile_FASTQ,
+		  "\t", "When loading sequences from FASTQ",
+		  fieldlength);
+  multiParamPrint(Pv, singlePvIndex, ostr, 
+		  Pv[0].mp_assembly_params.as_infile_CAF,
+		  "\t", "When loading project from CAF",
+		  fieldlength);
+  multiParamPrint(Pv, singlePvIndex, ostr, 
+		  Pv[0].mp_assembly_params.as_infile_MAF,
+		  "\t", "When loading project from MAF (disabled)",
+		  fieldlength);
+  multiParamPrint(Pv, singlePvIndex, ostr, 
+		  Pv[0].mp_assembly_params.as_infile_FOFNEXP,
+		  "\t", "When loading EXP fofn",
+		  fieldlength);
+  multiParamPrint(Pv, singlePvIndex, ostr, 
+		  Pv[0].mp_assembly_params.as_infile_PHD,
+		  "\t", "When loading project from PHD",
+		  fieldlength);
+
+  multiParamPrint(Pv, singlePvIndex, ostr, 
+		  Pv[0].mp_assembly_params.as_infile_straindata,
+		  "\t", "When loading strain data",
+		  fieldlength);
+  multiParamPrint(Pv, indexesInPv, ostr, 
+		  Pv[0].mp_assembly_params.as_infile_xmltraceinfo,
+		  "\t", "When loading XML trace info files",
+		  fieldlength);
+  multiParamPrint(Pv, singlePvIndex, ostr, 
+		  Pv[0].mp_assembly_params.as_infile_ssahavectorscreen,
+		  "\t", "When loading SSAHA2 vector screen results",
+		  fieldlength);
+  multiParamPrint(Pv, singlePvIndex, ostr, 
+		  Pv[0].mp_assembly_params.as_infile_smaltvectorscreen,
+		  "\t", "When loading SMALT vector screen results",
+		  fieldlength);
+
+  ostr << '\n';
+
+  multiParamPrint(Pv, singlePvIndex, ostr, 
+		  Pv[0].mp_assembly_params.as_infile_backbone_MAF,
+		  "\t", "When loading backbone from MAF",
+		  fieldlength);
+  multiParamPrint(Pv, singlePvIndex, ostr, 
+		  Pv[0].mp_assembly_params.as_infile_backbone_CAF,
+		  "\t", "When loading backbone from CAF",
+		  fieldlength);
+  multiParamPrint(Pv, singlePvIndex, ostr, 
+		  Pv[0].mp_assembly_params.as_infile_backbone_GBF,
+		  "\t", "When loading backbone from GenBank",
+		  fieldlength);
+  multiParamPrint(Pv, singlePvIndex, ostr, 
+		  Pv[0].mp_assembly_params.as_infile_backbone_GFF3,
+		  "\t", "When loading backbone from GFF3",
+		  fieldlength);
+  multiParamPrint(Pv, singlePvIndex, ostr, 
+		  Pv[0].mp_assembly_params.as_infile_backbone_FASTA,
+		  "\t", "When loading backbone from FASTA",
+		  fieldlength);
+
   ostr << '\n';
 
 }
@@ -833,27 +842,39 @@ void MIRAParameters::dumpDirectoryParams(vector<MIRAParameters> & Pv, const vect
 
   ostr << "\n  Directories (-DI):\n";
 
-  multiParamPrint(Pv, singlePvIndex, ostr,
+  multiParamPrint(Pv, singlePvIndex, ostr, 
+		  Pv[0].mp_directory_params.dir_cwd,
+		  "\t", "Working directory",
+		  fieldlength);
+  multiParamPrint(Pv, singlePvIndex, ostr, 
+		  Pv[0].mp_directory_params.dir_exp,
+		  "\t", "When loading EXP files",
+		  fieldlength);
+  multiParamPrint(Pv, singlePvIndex, ostr, 
+		  Pv[0].mp_directory_params.dir_scf,
+		  "\t", "When loading SCF files",
+		  fieldlength);
+  multiParamPrint(Pv, singlePvIndex, ostr, 
 		  Pv[0].mp_directory_params.dir_top,
 		  "\t", "Top directory for writing files",
 		  fieldlength);
-  multiParamPrint(Pv, singlePvIndex, ostr,
+  multiParamPrint(Pv, singlePvIndex, ostr, 
 		  Pv[0].mp_directory_params.dir_results,
 		  "\t", "For writing result files",
 		  fieldlength);
-  multiParamPrint(Pv, singlePvIndex, ostr,
+  multiParamPrint(Pv, singlePvIndex, ostr, 
 		  Pv[0].mp_directory_params.dir_info,
 		  "\t", "For writing result info files",
 		  fieldlength);
-  multiParamPrint(Pv, singlePvIndex, ostr,
+  multiParamPrint(Pv, singlePvIndex, ostr, 
 		  Pv[0].mp_directory_params.dir_tmp,
 		  "\t", "For writing tmp files",
 		  fieldlength);
-  multiParamPrint(Pv, singlePvIndex, ostr,
+  multiParamPrint(Pv, singlePvIndex, ostr, 
 		  Pv[0].mp_directory_params.dir_tmp_redirectedto,
 		  "\t", "Tmp redirected to (trt)",
 		  fieldlength);
-  multiParamPrint(Pv, singlePvIndex, ostr,
+  multiParamPrint(Pv, singlePvIndex, ostr, 
 		  Pv[0].mp_directory_params.dir_checkpoint,
 		  "\t", "For writing checkpoint files",
 		  fieldlength);
@@ -878,41 +899,21 @@ void MIRAParameters::dumpEditParams(vector<MIRAParameters> & Pv, const vector<in
 
   ostr << "\n  Edit options (-ED):\n";
 
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
-		      Pv[0].mp_edit_params.ed_sdbg_readedit,
-		      "\t", "GB read editing (gbre)",
-		      fieldlength);
-
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
-		      Pv[0].mp_edit_params.ed_mira_automatic_contic_editing,
-		      "\t", "Mira automatic contig editing (mace)",
+  multiParamPrintBool(Pv, indexesInPv, ostr, 
+		      Pv[0].mp_edit_params.ed_automatic_contic_editing,
+		      "\t", "Automatic contig editing (ace)",
 		      fieldlength);
 
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
-		      Pv[0].mp_edit_params.ed_kmer_singlets,
-		      "\t    ", "Edit kmer singlets (eks)",
-		      fieldlength-4);
-
-  multiParamPrintBool(Pv, indexesInPv, ostr,
-		      Pv[0].mp_edit_params.ed_homopolymer_overcalls,
-		      "\t    ", "Edit homopolymer overcalls (ehpo)",
-		      fieldlength-4);
-
+  ostr << "     Sanger only:\n";
 
-//  ostr << "     Sanger only:\n";
-//
-//  multiParamPrintBool(Pv, indexesInPv, ostr,
-//		      Pv[0].mp_edit_params.ed_automatic_contic_editing,
-//		      "\t", "EdIt automatic contig editing (eace)",
-//		      fieldlength);
-//  multiParamPrintBool(Pv, singlePvIndex, ostr,
-//		      Pv[0].mp_edit_params.ed_strict_editing_mode,
-//		      "\t", "Strict editing mode (sem)",
-//		      fieldlength);
-//  multiParamPrint(Pv, singlePvIndex, ostr,
-//		  Pv[0].mp_edit_params.ed_confirmation_threshold,
-//		  "\t", "Confirmation threshold in percent (ct)",
-//		  fieldlength);
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
+		      Pv[0].mp_edit_params.ed_strict_editing_mode,
+		      "\t", "Strict editing mode (sem)",
+		      fieldlength);
+  multiParamPrint(Pv, singlePvIndex, ostr, 
+		  Pv[0].mp_edit_params.ed_confirmation_threshold,
+		  "\t", "Confirmation threshold in percent (ct)",
+		  fieldlength);
 }
 
 
@@ -930,7 +931,7 @@ void MIRAParameters::dumpContigParams(vector<MIRAParameters> & Pv, const vector<
 
   ostr << "\n  Contig parameters (-CO):\n";
 
-  multiParamPrint(Pv, singlePvIndex, ostr,
+  multiParamPrint(Pv, singlePvIndex, ostr, 
 		  Pv[0].mp_contig_params.con_nameprefix,
 		  "\t", "Name prefix (np)",
 		  fieldlength);
@@ -956,92 +957,89 @@ void MIRAParameters::dumpContigParams(vector<MIRAParameters> & Pv, const vector<
 //  }
 
 
-  multiParamPrint(Pv, indexesInPv, ostr,
+  multiParamPrint(Pv, indexesInPv, ostr, 
 		  Pv[0].mp_contig_params.con_reject_on_drop_in_relscore,
 		  "\t", "Reject on drop in relative alignment score in % (rodirs)",
 		  fieldlength);
-  multiParamPrint(Pv, indexesInPv, ostr,
-		  Pv[0].mp_contig_params.con_min_relscore,
-		  "\t", "CMinimum relative score in % (cmrs)",
-		  fieldlength);
 
 // TODO: deprecate?
 //  ostr << "\tMax. error rate in dangerous zones in % (dmer)           : " << mp_contig_params.con_danger_max_error_rate << "\n";
 
 
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
 		      Pv[0].mp_assembly_params.as_mark_repeats,
 		      "\t", "Mark repeats (mr)",
 		      fieldlength);
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
 		      Pv[0].mp_assembly_params.as_mark_repeats_onlyinresult,
 		      "\t    ", "Only in result (mroir)",
 		      fieldlength-4);
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
 		      Pv[0].mp_contig_params.con_assume_snp_insteadof_rmb,
 		      "\t    ", "Assume SNP instead of repeats (asir)",
 		      fieldlength-4);
-  multiParamPrint(Pv, indexesInPv, ostr,
+  multiParamPrint(Pv, indexesInPv, ostr, 
 		  Pv[0].mp_contig_params.con_minreadspergroup,
 		  "\t    ", "Minimum reads per group needed for tagging (mrpg)",
 		  fieldlength-4);
   multiParamPrintNumericChar(
-    Pv, indexesInPv, ostr,
+    Pv, indexesInPv, ostr, 
     Pv[0].mp_contig_params.con_minrmbneighbourqual,
     "\t    ", "Minimum neighbour quality needed for tagging (mnq)",
     fieldlength-4);
   multiParamPrintNumericChar(
-    Pv, indexesInPv, ostr,
+    Pv, indexesInPv, ostr, 
     Pv[0].mp_contig_params.con_mingroupqualforrmbtagging,
     "\t    ", "Minimum Group Quality needed for RMB Tagging (mgqrt)",
     fieldlength-4);
-  multiParamPrint(Pv, indexesInPv, ostr,
+  multiParamPrint(Pv, indexesInPv, ostr, 
 		  Pv[0].mp_contig_params.con_endreadmarkexclusionarea,
 		  "\t    ", "End-read Marking Exclusion Area in bases (emea)",
 		  fieldlength-4);
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
 		      Pv[0].mp_contig_params.con_emea_setzero_on_clipping_pec,
 		      "\t        ", "Set to 1 on clipping PEC (emeas1clpec)",
 		      fieldlength-8);
-  multiParamPrintBool(Pv, indexesInPv, ostr,
+  multiParamPrintBool(Pv, indexesInPv, ostr, 
 		      Pv[0].mp_contig_params.con_also_mark_gap_bases,
 		      "\t    ", "Also mark gap bases (amgb)",
 		      fieldlength-4);
   multiParamPrintBool(
-    Pv, indexesInPv, ostr,
+    Pv, indexesInPv, ostr, 
     Pv[0].mp_contig_params.con_also_mark_gap_bases_evenmc,
     "\t        ", "Also mark gap bases - even multicolumn (amgbemc)",
     fieldlength-8);
   multiParamPrintBool(
-    Pv, indexesInPv, ostr,
+    Pv, indexesInPv, ostr, 
     Pv[0].mp_contig_params.con_also_mark_gap_bases_needbothstrands,
     "\t        ", "Also mark gap bases - need both strands (amgbnbs)",
     fieldlength-8);
 
-  multiParamPrintBool(Pv, indexesInPv, ostr,
-		      Pv[0].mp_contig_params.con_force_nonIUPACconsensus,
-		      "\t", "Force non-IUPAC consensus (fnic)",
+  multiParamPrintBool(Pv, indexesInPv, ostr, 
+		      Pv[0].mp_contig_params.con_force_nonIUPACconsensus_perseqtype,
+		      "\t", "Force non-IUPAC consensus per sequencing type (fnicpst)",
 		      fieldlength);
 
-  multiParamPrintBool(Pv, indexesInPv, ostr,
+  multiParamPrintBool(Pv, indexesInPv, ostr, 
 		      Pv[0].mp_contig_params.con_mergeshortreads,
 		      "\t", "Merge short reads (msr)",
 		      fieldlength);
 
-  multiParamPrint(Pv, indexesInPv, ostr,
-		  Pv[0].mp_contig_params.con_msr_maxerrors,
-		  "\t    ", "Max errors (msrme)",
-		  fieldlength-4);
-
-  multiParamPrint(Pv, indexesInPv, ostr,
+  multiParamPrint(Pv, indexesInPv, ostr, 
 		  Pv[0].mp_contig_params.con_msr_keependsunmapped,
 		  "\t    ", "Keep ends unmerged (msrkeu)",
 		  fieldlength-4);
 
-  multiParamPrint(Pv, indexesInPv, ostr,
+  multiParamPrint(Pv, indexesInPv, ostr, 
 		  Pv[0].mp_contig_params.con_gap_override_ratio,
 		  "\t", "Gap override ratio (gor)",
 		  fieldlength);
+
+  // Not implemented yet
+  //multiParamPrintBool(Pv, singlePvIndex, ostr, 
+  //		      Pv[0].mp_contig_params.con_force_nonIUPACconsensus_amongseqtypes,
+  //		      "\t", "Force non-IUPAC consensus among sequncing types (fnicast)",
+  //		      fieldlength);
 }
 
 
@@ -1060,32 +1058,32 @@ void MIRAParameters::dumpPathfinderParams(vector<MIRAParameters> & Pv, const vec
 
   ostr << "\n  Pathfinder options (-PF):\n";
 
-  multiParamPrintBool(Pv, indexesInPv, ostr,
+  multiParamPrintBool(Pv, indexesInPv, ostr, 
 		      Pv[0].mp_pathfinder_params.paf_use_quick_rule,
 		      "\t", "Use quick rule (uqr)",
 		      fieldlength);
-  multiParamPrint(Pv, indexesInPv, ostr,
+  multiParamPrint(Pv, indexesInPv, ostr, 
 		  Pv[0].mp_pathfinder_params.paf_quickrule_minlen1,
 		  "\t    ", "Quick rule min len 1 (qrml1)",
 		  fieldlength-4);
-  multiParamPrintNumericChar(Pv, indexesInPv, ostr,
+  multiParamPrintNumericChar(Pv, indexesInPv, ostr, 
 			     Pv[0].mp_pathfinder_params.paf_quickrule_minsim1,
 			     "\t    ", "Quick rule min sim 1 (qrms1)",
 			     fieldlength-4);
-  multiParamPrint(Pv, indexesInPv, ostr,
+  multiParamPrint(Pv, indexesInPv, ostr, 
 		  Pv[0].mp_pathfinder_params.paf_quickrule_minlen2,
 		  "\t    ", "Quick rule min len 2 (qrml2)",
 		  fieldlength-4);
-  multiParamPrintNumericChar(Pv, indexesInPv, ostr,
+  multiParamPrintNumericChar(Pv, indexesInPv, ostr, 
 			     Pv[0].mp_pathfinder_params.paf_quickrule_minsim2,
 			     "\t    ", "Quick rule min sim 2 (qrms2)",
 			     fieldlength-4);
-  multiParamPrint(Pv, indexesInPv, ostr,
+  multiParamPrint(Pv, indexesInPv, ostr, 
 		  Pv[0].mp_pathfinder_params.paf_bbquickoverlap_minlen,
 		  "\t", "Backbone quick overlap min len (bqoml)",
 		  fieldlength);
 
-  multiParamPrint(Pv, singlePvIndex, ostr,
+  multiParamPrint(Pv, singlePvIndex, ostr, 
 		  Pv[0].mp_pathfinder_params.paf_max_startcache_filltime,
 		  "\t", "Max. start cache fill time (mscft)",
 		  fieldlength);
@@ -1105,147 +1103,88 @@ void MIRAParameters::dumpSkimParams(vector<MIRAParameters> & Pv, const vector<in
 
   ostr << "\n  Parameters for SKIM algorithm (-SK):\n";
 
-  multiParamPrint(Pv, singlePvIndex, ostr,
+  multiParamPrint(Pv, singlePvIndex, ostr, 
 		  Pv[0].mp_skim_params.sk_numthreads,
 		  "\t", "Number of threads (not)",
 		  fieldlength);
   ostr << '\n';
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
 		      Pv[0].mp_skim_params.sk_alsoskimrevcomp,
 		      "\t", "Also compute reverse complements (acrc)",
 		      fieldlength);
-  multiParamPrint(Pv, singlePvIndex, ostr,
+  multiParamPrint(Pv, singlePvIndex, ostr, 
 		  Pv[0].mp_skim_params.sk_basesperhash,
-		  "\t", "Kmer size (kms)",
+		  "\t", "Bases per hash (bph)",
 		  fieldlength);
-  multiParamPrint(Pv, singlePvIndex, ostr,
-		  Pv[0].mp_skim_params.sk_bph_increasestep,
-		  "\t    ", "Automatic increase per pass (kmsaipp)",
-		  fieldlength-4);
-  multiParamPrint(Pv, singlePvIndex, ostr,
-		  Pv[0].mp_skim_params.sk_bph_max,
-		  "\t    ", "Kmer size max(kmsmax)",
-		  fieldlength-4);
-  multiParamPrint(Pv, singlePvIndex, ostr,
+  multiParamPrint(Pv, singlePvIndex, ostr, 
 		  Pv[0].mp_skim_params.sk_hashsavestepping,
-		  "\t", "Kmer save stepping (kss)",
+		  "\t", "Hash save stepping (hss)",
 		  fieldlength);
-  multiParamPrint(Pv, indexesInPv, ostr,
+  multiParamPrint(Pv, indexesInPv, ostr, 
 		  Pv[0].mp_skim_params.sk_percentrequired,
 		  "\t", "Percent required (pr)",
 		  fieldlength);
   ostr << '\n';
-  multiParamPrint(Pv, singlePvIndex, ostr,
-		  Pv[0].mp_skim_params.sk_maxhitsperread,
+  multiParamPrint(Pv, singlePvIndex, ostr, 
+		      Pv[0].mp_skim_params.sk_maxhitsperread,
 		  "\t", "Max hits per read (mhpr)",
-		  fieldlength);
-  ostr << '\n';
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
-		      Pv[0].mp_skim_params.sk_filtermegahubs,
-		      "\t", "Filter megahubs (fmh)",
 		      fieldlength);
-  multiParamPrint(Pv, singlePvIndex, ostr,
-		  Pv[0].mp_skim_params.sk_megahubcap,
-		  "\t    ", "Megahub cap (mhc)",
-		  fieldlength-4);
-  multiParamPrint(Pv, singlePvIndex, ostr,
+  multiParamPrint(Pv, singlePvIndex, ostr, 
 		  Pv[0].mp_skim_params.sk_maxmegahubratio,
-		  "\t    ", "Max megahub ratio (mmhr)",
-		  fieldlength-4);
+		  "\t", "Max megahub ratio (mmhr)",
+		  fieldlength);
 
   ostr << '\n';
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
 		      Pv[0].mp_skim_params.sk_swcheckonbackbones,
 		      "\t", "SW check on backbones (swcob)",
 		      fieldlength);
 
   ostr << '\n';
-  multiParamPrint(Pv, singlePvIndex, ostr,
-		  Pv[0].mp_skim_params.sk_maxhashesinmem,
-		  "\t", "Max kmers in memory (mkim)",
-		  fieldlength);
-  multiParamPrint(Pv, singlePvIndex, ostr,
-		  Pv[0].mp_skim_params.sk_memcaphitreduction,
-		  "\t", "MemCap: hit reduction (mchr)",
-		  fieldlength);
-
-}
-
-
-
-// static func
-void MIRAParameters::dumpHashStatisticsParams(vector<MIRAParameters> & Pv, const vector<int> & indexesInPv, ostream & ostr)
-{
-  const int32 fieldlength=45;
-
-  vector<int> singlePvIndex;
-  if(indexesInPv.size()==1){
-    singlePvIndex.push_back(indexesInPv.front());
-  }else{
-    singlePvIndex.push_back(0);
-  }
-
-  ostr << "\n  Parameters for Kmer Statistics (-KS):\n";
-
-  multiParamPrint(Pv, singlePvIndex, ostr,
-		  Pv[0].mp_hashstatistics_params.hs_freq_covestmin,
-		  "\t", "Freq. cov. estim. min (fcem)",
-		  fieldlength);
-  multiParamPrint(Pv, singlePvIndex, ostr,
-		  Pv[0].mp_hashstatistics_params.hs_freqest_minnormal,
-		  "\t", "Freq. estim. min normal (fenn)",
+  multiParamPrint(Pv, singlePvIndex, ostr, 
+		  Pv[0].mp_skim_params.sk_freqest_minnormal,
+		  "\t", "Freq. est. min normal (fenn)",
 		  fieldlength);
-  multiParamPrint(Pv, singlePvIndex, ostr,
-		  Pv[0].mp_hashstatistics_params.hs_freqest_maxnormal,
-		  "\t", "Freq. estim. max normal (fexn)",
+  multiParamPrint(Pv, singlePvIndex, ostr, 
+		  Pv[0].mp_skim_params.sk_freqest_maxnormal,
+		  "\t", "Freq. est. max normal (fexn)",
 		  fieldlength);
-  multiParamPrint(Pv, singlePvIndex, ostr,
-		  Pv[0].mp_hashstatistics_params.hs_freqest_repeat,
-		  "\t", "Freq. estim. repeat (fer)",
+  multiParamPrint(Pv, singlePvIndex, ostr, 
+		  Pv[0].mp_skim_params.sk_freqest_repeat,
+		  "\t", "Freq. est. repeat (fer)",
 		  fieldlength);
-  multiParamPrint(Pv, singlePvIndex, ostr,
-		  Pv[0].mp_hashstatistics_params.hs_freqest_heavyrepeat,
-		  "\t", "Freq. estim. heavy repeat (fehr)",
+  multiParamPrint(Pv, singlePvIndex, ostr, 
+		  Pv[0].mp_skim_params.sk_freqest_heavyrepeat,
+		  "\t", "Freq. est. heavy repeat (fehr)",
 		  fieldlength);
-  multiParamPrint(Pv, singlePvIndex, ostr,
-		  Pv[0].mp_hashstatistics_params.hs_freqest_crazyrepeat,
-		  "\t", "Freq. estim. crazy (fecr)",
+  multiParamPrint(Pv, singlePvIndex, ostr, 
+		  Pv[0].mp_skim_params.sk_freqest_crazyrepeat,
+		  "\t", "Freq. est. crazy (fecr)",
 		  fieldlength);
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
-		      Pv[0].mp_hashstatistics_params.hs_masknastyrepeats,
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
+		      Pv[0].mp_skim_params.sk_masknastyrepeats,
 		      "\t", "Mask nasty repeats (mnr)",
 		      fieldlength);
-  multiParamPrint(Pv, singlePvIndex, ostr,
-		  Pv[0].mp_hashstatistics_params.hs_nastyrepeatratio,
+  multiParamPrint(Pv, singlePvIndex, ostr, 
+		  Pv[0].mp_skim_params.sk_nastyrepeatratio,
 		  "\t    ", "Nasty repeat ratio (nrr)",
 		  fieldlength-4);
-  multiParamPrint(Pv, singlePvIndex, ostr,
-		  Pv[0].mp_hashstatistics_params.hs_nastyrepeatcoverage,
-		  "\t    ", "Nasty repeat coverage (nrc)",
-		  fieldlength-4);
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
-		      Pv[0].mp_hashstatistics_params.hs_apply_digitalnormalisation,
-		      "\t    ", "Lossless digital normalisation (ldn)",
-		      fieldlength-4);
-
-  ostr << '\n';
-  multiParamPrint(Pv, singlePvIndex, ostr,
-		  Pv[0].mp_hashstatistics_params.hs_repeatlevel_in_infofile,
+  multiParamPrint(Pv, singlePvIndex, ostr, 
+		  Pv[0].mp_skim_params.sk_repeatlevel_in_infofile,
 		  "\t", "Repeat level in info file (rliif)",
 		  fieldlength);
 
   ostr << '\n';
-  multiParamPrint(Pv, singlePvIndex, ostr,
-		  Pv[0].mp_hashstatistics_params.hs_million_hashes_per_buffer,
-		  "\t", "Million kmers per buffer (mkpb)",
+  multiParamPrint(Pv, singlePvIndex, ostr, 
+		  Pv[0].mp_skim_params.sk_maxhashesinmem,
+		  "\t", "Max hashes in memory (mhim)",
 		  fieldlength);
-  multiParamPrint(Pv, singlePvIndex, ostr,
-		  Pv[0].mp_hashstatistics_params.hs_rare_kmer_final_kill,
-		  "\t", "Rare kmer final kill (rkfk)",
+  multiParamPrint(Pv, singlePvIndex, ostr, 
+		  Pv[0].mp_skim_params.sk_memcaphitreduction,
+		  "\t", "MemCap: hit reduction (mchr)",
 		  fieldlength);
-}
-
 
+}
 
 // static func
 void MIRAParameters::dumpClippingParams(vector<MIRAParameters> & Pv, const vector<int> & indexesInPv, ostream & ostr)
@@ -1260,137 +1199,137 @@ void MIRAParameters::dumpClippingParams(vector<MIRAParameters> & Pv, const vecto
   }
 
   ostr << "\n  Clipping options (-CL):\n";
-  ostr << "\tSSAHA2 or SMALT clipping:\n";
-  multiParamPrint(Pv, indexesInPv, ostr,
+
+  multiParamPrintBool(Pv, indexesInPv, ostr, 
+		      Pv[0].mp_assembly_params.as_clip_mergessahavectorscreen,
+		      "\t", "Merge with SSAHA2/SMALT vector screen (msvs)",
+		      fieldlength);
+  multiParamPrint(Pv, indexesInPv, ostr, 
 		  Pv[0].mp_assembly_params.as_clip_ssahamerge_gapsize,
 		  "\t    ", "Gap size (msvsgs)",
 		  fieldlength-4);
-  multiParamPrint(Pv, indexesInPv, ostr,
+  multiParamPrint(Pv, indexesInPv, ostr, 
 		  Pv[0].mp_assembly_params.as_clip_ssahamerge_maxfrontgap,
 		  "\t    ", "Max front gap (msvsmfg)",
 		  fieldlength-4);
-  multiParamPrint(Pv, indexesInPv, ostr,
+  multiParamPrint(Pv, indexesInPv, ostr, 
 		  Pv[0].mp_assembly_params.as_clip_ssahamerge_maxendgap,
 		  "\t    ", "Max end gap (msvsmeg)",
 		  fieldlength-4);
-  multiParamPrint(Pv, indexesInPv, ostr,
+  multiParamPrint(Pv, indexesInPv, ostr, 
 		  Pv[0].mp_assembly_params.as_clip_ssahamerge_strictfrontclip,
 		  "\t    ", "Strict front clip (msvssfc)",
 		  fieldlength-4);
-  multiParamPrint(Pv, indexesInPv, ostr,
+  multiParamPrint(Pv, indexesInPv, ostr, 
 		  Pv[0].mp_assembly_params.as_clip_ssahamerge_strictendclip,
 		  "\t    ", "Strict end clip (msvssec)",
 		  fieldlength-4);
 
-  multiParamPrintBool(Pv, indexesInPv, ostr,
+  multiParamPrintBool(Pv, indexesInPv, ostr, 
 		      Pv[0].mp_assembly_params.as_clip_possible_vectors,
 		      "\t", "Possible vector leftover clip (pvlc)",
 		      fieldlength);
-  multiParamPrint(Pv, indexesInPv, ostr,
+  multiParamPrint(Pv, indexesInPv, ostr, 
 		  Pv[0].mp_assembly_params.as_clip_vector_maxlenallowed,
 		  "\t    ", "maximum len allowed (pvcmla)",
 		  fieldlength-4);
 
-  multiParamPrintNumericChar(Pv, indexesInPv, ostr,
+  multiParamPrintNumericChar(Pv, indexesInPv, ostr, 
 			     Pv[0].mp_assembly_params.as_clip_quality_minthreshold,
 			     "\t", "Min qual. threshold for entire read (mqtfer)",
 			     fieldlength);
-  multiParamPrint(Pv, indexesInPv, ostr,
+  multiParamPrint(Pv, indexesInPv, ostr, 
 		  Pv[0].mp_assembly_params.as_clip_quality_numminthreshold,
 		  "\t    ", "Number of bases (mqtfernob)",
 		  fieldlength-4);
 
-  multiParamPrintBool(Pv, indexesInPv, ostr,
+  multiParamPrintBool(Pv, indexesInPv, ostr, 
 		      Pv[0].mp_assembly_params.as_clip_quality,
 		      "\t", "Quality clip (qc)",
 		      fieldlength);
-  multiParamPrintNumericChar(Pv, indexesInPv, ostr,
+  multiParamPrintNumericChar(Pv, indexesInPv, ostr, 
 			     Pv[0].mp_assembly_params.as_clip_quality_minqual,
 			     "\t    ", "Minimum quality (qcmq)",
 			     fieldlength-4);
-  multiParamPrint(Pv, indexesInPv, ostr,
+  multiParamPrint(Pv, indexesInPv, ostr, 
 		  Pv[0].mp_assembly_params.as_clip_quality_winlen,
 		  "\t    ", "Window length (qcwl)",
 		  fieldlength-4);
 
 
-  multiParamPrintBool(Pv, indexesInPv, ostr,
+  multiParamPrintBool(Pv, indexesInPv, ostr, 
 		      Pv[0].mp_assembly_params.as_clip_badstretchquality,
 		      "\t", "Bad stretch quality clip (bsqc)",
 		      fieldlength);
-  multiParamPrintNumericChar(Pv, indexesInPv, ostr,
+  multiParamPrintNumericChar(Pv, indexesInPv, ostr, 
 			     Pv[0].mp_assembly_params.as_clip_badstretchquality_minqual,
 			     "\t    ", "Minimum quality (bsqcmq)",
 			     fieldlength-4);
-  multiParamPrint(Pv, indexesInPv, ostr,
+  multiParamPrint(Pv, indexesInPv, ostr, 
 		  Pv[0].mp_assembly_params.as_clip_badstretchquality_winlen,
 		  "\t    ", "Window length (bsqcwl)",
 		  fieldlength-4);
 
 
 
-  multiParamPrintBool(Pv, indexesInPv, ostr,
+  multiParamPrintBool(Pv, indexesInPv, ostr, 
 		      Pv[0].mp_assembly_params.as_clip_maskedbases,
 		      "\t", "Masked bases clip (mbc)",
 		      fieldlength);
-  multiParamPrint(Pv, indexesInPv, ostr,
+  multiParamPrint(Pv, indexesInPv, ostr, 
 		  Pv[0].mp_assembly_params.as_clip_maskedbase_gapsize,
 		  "\t    ", "Gap size (mbcgs)",
 		  fieldlength-4);
-  multiParamPrint(Pv, indexesInPv, ostr,
+  multiParamPrint(Pv, indexesInPv, ostr, 
 		  Pv[0].mp_assembly_params.as_clip_maskedbase_maxfrontgap,
 		  "\t    ", "Max front gap (mbcmfg)",
 		  fieldlength-4);
-  multiParamPrint(Pv, indexesInPv, ostr,
+  multiParamPrint(Pv, indexesInPv, ostr, 
 		  Pv[0].mp_assembly_params.as_clip_maskedbase_maxendgap,
 		  "\t    ", "Max end gap (mbcmeg)",
 		  fieldlength-4);
 
 
-  multiParamPrintBool(Pv, indexesInPv, ostr,
-		      Pv[0].mp_assembly_params.as_clip_lowercase_front,
-		      "\t", "Lower case clip front (lccf)",
-		      fieldlength);
-  multiParamPrintBool(Pv, indexesInPv, ostr,
-		      Pv[0].mp_assembly_params.as_clip_lowercase_back,
-		      "\t", "Lower case clip back (lccb)",
+  multiParamPrintBool(Pv, indexesInPv, ostr, 
+		      Pv[0].mp_assembly_params.as_clip_lowercase,
+		      "\t", "Lower case clip (lcc)",
 		      fieldlength);
 
-  multiParamPrintBool(Pv, indexesInPv, ostr,
+  multiParamPrintBool(Pv, indexesInPv, ostr, 
 		      Pv[0].mp_assembly_params.as_clip_polyat,
 		      "\t", "Clip poly A/T at ends (cpat)",
 		      fieldlength);
-  multiParamPrintBool(Pv, indexesInPv, ostr,
-		      Pv[0].mp_assembly_params.as_clip_polyat_keeppolystretch,
+  multiParamPrintBool(Pv, indexesInPv, ostr, 
+		      Pv[0].mp_assembly_params.as_clip_polyat_keeppolysignal,
 		      "\t    ", "Keep poly-a signal (cpkps)",
 		      fieldlength-4);
-  multiParamPrint(Pv, indexesInPv, ostr,
+  multiParamPrint(Pv, indexesInPv, ostr, 
 		  Pv[0].mp_assembly_params.as_clip_polyat_len,
 		  "\t    ", "Minimum signal length (cpmsl)",
 		  fieldlength-4);
-  multiParamPrint(Pv, indexesInPv, ostr,
+  multiParamPrint(Pv, indexesInPv, ostr, 
 		  Pv[0].mp_assembly_params.as_clip_polyat_maxerrors,
 		  "\t    ", "Max errors allowed (cpmea)",
 		  fieldlength-4);
-  multiParamPrint(Pv, indexesInPv, ostr,
+  multiParamPrint(Pv, indexesInPv, ostr, 
 		  Pv[0].mp_assembly_params.as_clip_polyat_maxgap,
 		  "\t    ", "Max gap from ends (cpmgfe)",
 		  fieldlength-4);
 
 
-  multiParamPrintBool(Pv, indexesInPv, ostr,
+  multiParamPrintBool(Pv, indexesInPv, ostr, 
 		      Pv[0].mp_assembly_params.as_clip_3ppolybase,
 		      "\t", "Clip 3 prime polybase (c3pp)",
 		      fieldlength);
-  multiParamPrint(Pv, indexesInPv, ostr,
+  multiParamPrint(Pv, indexesInPv, ostr, 
 		  Pv[0].mp_assembly_params.as_clip_3ppolybase_len,
 		  "\t    ", "Minimum signal length (c3ppmsl)",
 		  fieldlength-4);
-  multiParamPrint(Pv, indexesInPv, ostr,
+  multiParamPrint(Pv, indexesInPv, ostr, 
 		  Pv[0].mp_assembly_params.as_clip_3ppolybase_maxerrors,
 		  "\t    ", "Max errors allowed (c3ppmea)",
 		  fieldlength-4);
-  multiParamPrint(Pv, indexesInPv, ostr,
+  multiParamPrint(Pv, indexesInPv, ostr, 
 		  Pv[0].mp_assembly_params.as_clip_3ppolybase_maxgap,
 		  "\t    ", "Max gap from ends (c3ppmgfe)",
 		  fieldlength-4);
@@ -1400,23 +1339,23 @@ void MIRAParameters::dumpClippingParams(vector<MIRAParameters> & Pv, const vecto
 		      "\t", "Clip known adaptors right (ckar)",
 		      fieldlength);
 
-  multiParamPrintBool(Pv, indexesInPv, ostr,
+  multiParamPrintBool(Pv, indexesInPv, ostr, 
 		      Pv[0].mp_assembly_params.as_clip_ensureminimumleftclipoff,
 		      "\t", "Ensure minimum left clip (emlc)",
 		      fieldlength);
-  multiParamPrint(Pv, indexesInPv, ostr,
+  multiParamPrint(Pv, indexesInPv, ostr, 
 		  Pv[0].mp_assembly_params.as_clip_minslrequired,
 		  "\t    ", "Minimum left clip req. (mlcr)",
 		  fieldlength-4);
-  multiParamPrint(Pv, indexesInPv, ostr,
+  multiParamPrint(Pv, indexesInPv, ostr, 
 		  Pv[0].mp_assembly_params.as_clip_minqlsetto,
 		  "\t    ", "Set minimum left clip to (smlc)",
 		  fieldlength-4);
-  multiParamPrintBool(Pv, indexesInPv, ostr,
+  multiParamPrintBool(Pv, indexesInPv, ostr, 
 		      Pv[0].mp_assembly_params.as_clip_ensureminimumrightclipoff,
 		      "\t", "Ensure minimum right clip (emrc)",
 		      fieldlength);
-  multiParamPrint(Pv, indexesInPv, ostr,
+  multiParamPrint(Pv, indexesInPv, ostr, 
 		  Pv[0].mp_assembly_params.as_clip_minsrrequired,
 		  "\t    ", "Minimum right clip req. (mrcr)",
 		  fieldlength-4);
@@ -1425,107 +1364,38 @@ void MIRAParameters::dumpClippingParams(vector<MIRAParameters> & Pv, const vecto
 		  "\t    ", "Set minimum right clip to (smrc)",
 		  fieldlength-4);
 
-  ostr << '\n';
-
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
-		      Pv[0].mp_assembly_params.as_clip_sdbg_chimeradetection,
-		      "\t", "GB chimera detection clip (gbcdc)",
-		      fieldlength);
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
-		      Pv[0].mp_assembly_params.as_clip_kmer_junkdetection,
-		      "\t", "KMER junk detection (kjd)",
-		      fieldlength);
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
-		      Pv[0].mp_assembly_params.as_clip_kmer_junkkill,
-		      "\t    ", "KMER junk complete kill (kjck)",
-		      fieldlength-4);
+  cout << '\n';
 
   multiParamPrintBool(Pv, singlePvIndex, ostr,
 		      Pv[0].mp_assembly_params.as_clip_skimchimeradetection,
-		      "\t", "DEPRECATED! Apply SKIM chimera detection clip (ascdc)",
+		      "\t", "Apply SKIM chimera detection clip (ascdc)",
 		      fieldlength);
   multiParamPrintBool(Pv, singlePvIndex, ostr,
 		      Pv[0].mp_assembly_params.as_clip_skimjunkdetection,
-		      "\t", "DEPRECATED! Apply SKIM junk detection clip (asjdc)",
+		      "\t", "Apply SKIM junk detection clip (asjdc)",
 		      fieldlength);
-  ostr << '\n';
+  cout << '\n';
 
-  multiParamPrintBool(Pv, indexesInPv, ostr,
+  multiParamPrintBool(Pv, singlePvIndex, ostr,
 		      Pv[0].mp_assembly_params.as_clip_proposeendclips,
 		      "\t", "Propose end clips (pec)",
 		      fieldlength);
-  multiParamPrint(Pv, singlePvIndex, ostr,
+  multiParamPrint(Pv, singlePvIndex, ostr, 
 		  Pv[0].mp_assembly_params.as_clip_pec_basesperhash,
-		  "\t    ", "Kmer size (peckms)",
+		  "\t    ", "Bases per hash (pecbph)",
 		  fieldlength-4);
-  multiParamPrint(Pv, singlePvIndex, ostr,
-		  Pv[0].mp_assembly_params.as_clip_pec_mkfr,
-		  "\t    ", "Minimum kmer for forward-rev (pmkfr)",
-		  fieldlength-4);
-  multiParamPrint(Pv, singlePvIndex, ostr,
-		  Pv[0].mp_assembly_params.as_clip_pec_mtk,
-		  "\t    ", "Minimum total kmer (pmtk)",
-		  fieldlength-4);
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
 		      Pv[0].mp_assembly_params.as_clip_pec_sxaggcxg,
 		      "\t    ", "Handle Solexa GGCxG problem (pechsgp)",
 		      fieldlength-4);
-  multiParamPrintBool(Pv, indexesInPv, ostr,
-		      Pv[0].mp_assembly_params.as_clipmask_rarekmers,
-		      "\t", "Rare kmer mask (rkm)",
+
+  cout << '\n';
+
+  multiParamPrintBool(Pv, singlePvIndex, ostr,
+		      Pv[0].mp_assembly_params.as_clip_badsolexaends,
+		      "\t", "Clip bad solexa ends (cbse)",
 		      fieldlength);
-
-  ostr << '\n';
-
-  multiParamPrint(Pv, indexesInPv, ostr,
-		  Pv[0].mp_assembly_params.as_clip_pec_ffreq,
-		  "\t    ", "Front freq (pffreq)",
-		  fieldlength-4);
-  multiParamPrint(Pv, indexesInPv, ostr,
-		  Pv[0].mp_assembly_params.as_clip_pec_bfreq,
-		  "\t    ", "Back freq (pbfreq)",
-		  fieldlength-4);
-  multiParamPrintBool(Pv, indexesInPv, ostr,
-		      Pv[0].mp_assembly_params.as_clip_pec_ffr,
-		      "\t    ", "Front forward-rev (pffore)",
-		      fieldlength-4);
-  multiParamPrintBool(Pv, indexesInPv, ostr,
-		      Pv[0].mp_assembly_params.as_clip_pec_bfr,
-		      "\t    ", "Back forward-rev (pbfore)",
-		      fieldlength-4);
-  multiParamPrintBool(Pv, indexesInPv, ostr,
-		      Pv[0].mp_assembly_params.as_clip_pec_fcmst,
-		      "\t    ", "Front conf. multi-seq type (pfcmst)",
-		      fieldlength-4);
-  multiParamPrintBool(Pv, indexesInPv, ostr,
-		      Pv[0].mp_assembly_params.as_clip_pec_bcmst,
-		      "\t    ", "Back conf. multi-seq type (pbcmst)",
-		      fieldlength-4);
-  multiParamPrintBool(Pv, indexesInPv, ostr,
-		      Pv[0].mp_assembly_params.as_clip_pec_fsalp,
-		      "\t    ", "Front seen at low pos (pfsalp)",
-		      fieldlength-4);
-  multiParamPrintBool(Pv, indexesInPv, ostr,
-		      Pv[0].mp_assembly_params.as_clip_pec_bsalp,
-		      "\t    ", "Back seen at low pos (pbsalp)",
-		      fieldlength-4);
-
-  ostr << '\n';
-
-  multiParamPrintBool(Pv, indexesInPv, ostr,
-		      Pv[0].mp_assembly_params.as_clip_badsolexaends,
-		      "\t", "Clip bad solexa ends (cbse)",
-		      fieldlength);
-  multiParamPrintBool(Pv, indexesInPv, ostr,
-		      Pv[0].mp_assembly_params.as_search_phix174,
-		      "\t", "Search PhiX174 (spx174)",
-		      fieldlength);
-  multiParamPrintBool(Pv, indexesInPv, ostr,
-		      Pv[0].mp_assembly_params.as_filter_phix174,
-		      "\t    ", "Filter PhiX174 (fpx174)",
-		      fieldlength-4);
-
-}
+}
 
 
 // static func
@@ -1542,26 +1412,26 @@ void MIRAParameters::dumpDataProcessingParams(vector<MIRAParameters> & Pv, const
 
   ostr << "\n  Dataprocessing options (-DP):\n";
 
-  multiParamPrintBool(Pv, indexesInPv, ostr,
+  multiParamPrintBool(Pv, indexesInPv, ostr, 
 		      Pv[0].mp_assembly_params.as_use_read_extension,
 		      "\t", "Use read extensions (ure)",
 		      fieldlength);
-  multiParamPrint(Pv, indexesInPv, ostr,
+  multiParamPrint(Pv, indexesInPv, ostr, 
 		  Pv[0].mp_assembly_params.as_readextension_window_len,
 		  "\t    ", "Read extension window length (rewl)",
 		  fieldlength-4);
 
-  multiParamPrint(Pv, indexesInPv, ostr,
+  multiParamPrint(Pv, indexesInPv, ostr, 
 		  Pv[0].mp_assembly_params.as_readextension_window_maxerrors,
 		  "\t    ", "Read extension w. maxerrors (rewme)",
 		  fieldlength-4);
 
-  multiParamPrint(Pv, indexesInPv, ostr,
+  multiParamPrint(Pv, indexesInPv, ostr, 
 		  Pv[0].mp_assembly_params.as_readextension_firstpassnum,
 		  "\t    ", "First extension in pass (feip)",
 		  fieldlength-4);
 
-  multiParamPrint(Pv, indexesInPv, ostr,
+  multiParamPrint(Pv, indexesInPv, ostr, 
 		  Pv[0].mp_assembly_params.as_readextension_lastpassnum,
 		  "\t    ", "Last extension in pass (leip)",
 		  fieldlength-4);
@@ -1581,40 +1451,58 @@ void MIRAParameters::dumpStrainBackboneParams(vector<MIRAParameters> & Pv, const
 
   ostr << "\n  Strain and backbone options (-SB):\n";
 
-  multiParamPrintBool(Pv, indexesInPv, ostr,
-		      Pv[0].mp_assembly_params.as_backbone_bootstrapnewbackbone,
-		      "\t", "Bootstrap new backbone (bnb)",
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
+		      Pv[0].mp_assembly_params.as_loadstraindata,
+		      "\t", "Load straindata (lsd)",
 		      fieldlength);
-
-  multiParamPrint(Pv, singlePvIndex, ostr,
+  multiParamPrintBool(Pv, indexesInPv, ostr, 
+		      Pv[0].mp_assembly_params.as_assigndefaultstrain,
+		      "\t", "Assign default strain (ads)",
+		      fieldlength);
+  multiParamPrint(Pv, indexesInPv, ostr, 
+		  Pv[0].mp_assembly_params.as_default_strainname,
+		  "\t    ","Default strain name (dsn)",
+		  fieldlength-4);
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
+		      Pv[0].mp_assembly_params.as_loadbackbone,
+		      "\t", "Load backbone (lb)",
+		      fieldlength);
+  multiParamPrint(Pv, singlePvIndex, ostr, 
 		  Pv[0].mp_assembly_params.as_startbackboneusage_inpass,
-		  "\t","Start backbone usage in pass (sbuip)",
-		  fieldlength);
-//  multiParamPrintBool(Pv, singlePvIndex, ostr,
-//		      Pv[0].mp_assembly_params.as_backbone_strainname_forceforall,
-//		      "\t    ", "Force for all (bsnffa)",
-//		      fieldlength-4);
-  multiParamPrint(Pv, singlePvIndex, ostr,
+		  "\t    ","Start backbone usage in pass (sbuip)",
+		  fieldlength-4);
+  multiParamPrint(Pv, singlePvIndex, ostr, 
+		  Pv[0].mp_assembly_params.as_infile_backbone_which,
+		  "\t    ", "Backbone file type (bft)",
+		  fieldlength-4);
+  multiParamPrintNumericChar(Pv, singlePvIndex, ostr, 
+			     Pv[0].mp_assembly_params.as_backbone_basequals,
+			     "\t    ", "Backbone base quality (bbq)",
+			     fieldlength-4);
+  multiParamPrint(Pv, singlePvIndex, ostr, 
+		  Pv[0].mp_assembly_params.as_backbone_strainname,
+		  "\t    ", "Backbone strain name (bsn)",
+		  fieldlength-4);
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
+		      Pv[0].mp_assembly_params.as_backbone_strainname_forceforall,
+		      "\t        ", "Force for all (bsnffa)",
+		      fieldlength-8);
+  multiParamPrint(Pv, singlePvIndex, ostr, 
 		  Pv[0].mp_assembly_params.as_backbone_rail_fromstrain,
-		  "\t", "Backbone rail from strain (brfs)",
-		  fieldlength);
-  multiParamPrint(Pv, singlePvIndex, ostr,
+		  "\t    ", "Backbone rail from strain (brfs)",
+		  fieldlength-4);
+  multiParamPrint(Pv, singlePvIndex, ostr, 
 		  Pv[0].mp_assembly_params.as_backbone_raillength,
-		  "\t", "Backbone rail length (brl)",
-		  fieldlength);
-  multiParamPrint(Pv, singlePvIndex, ostr,
+		  "\t    ", "Backbone rail length (brl)",
+		  fieldlength-4);
+  multiParamPrint(Pv, singlePvIndex, ostr, 
 		  Pv[0].mp_assembly_params.as_backbone_railoverlap,
-		  "\t", "Backbone rail overlap (bro)",
-		  fieldlength);
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
-		      Pv[0].mp_assembly_params.as_backbone_trimoverhangingreads,
-		      "\t", "Trim overhanging reads (tor)",
-		      fieldlength);
-  ostr << '\n';
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
+		  "\t    ", "Backbone rail overlap (bro)",
+		  fieldlength-4);
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
 		      Pv[0].mp_assembly_params.as_backbone_alsobuildnewcontigs,
-		      "\t", "(Also build new contigs (abnc))",
-		      fieldlength);
+		      "\t    ", "Also build new contigs (abnc)",
+		      fieldlength-4);
 
 }
 
@@ -1632,119 +1520,116 @@ void MIRAParameters::dumpAssemblyParams(vector<MIRAParameters> & Pv, const vecto
 
   ostr << "\n  Assembly options (-AS):\n";
 
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
-		      Pv[0].mp_pathfinder_params.paf_use_genomic_algorithms,
-		      "\t", "Use genomic pathfinder (ugpf)",
-		      fieldlength);
-
-  ostr << '\n';
-
-  multiParamPrint(Pv, singlePvIndex, ostr,
+  multiParamPrint(Pv, singlePvIndex, ostr, 
 		  Pv[0].mp_assembly_params.as_numpasses,
 		  "\t", "Number of passes (nop)",
 		  fieldlength);
-  multiParamPrint(Pv, singlePvIndex, ostr,
-		  Pv[0].mp_assembly_params.as_user_kmerseries,
-		  "\t", "Kmer series (kms)",
-		  fieldlength);
-//  multiParamPrintBool(Pv, singlePvIndex, ostr,
-//		      Pv[0].mp_assembly_params.as_skimeachpass,
-//		      "\t    ", "Skim each pass (sep)",
-//		      fieldlength-4);
-  multiParamPrint(Pv, singlePvIndex, ostr,
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
+		      Pv[0].mp_assembly_params.as_skimeachpass,
+		      "\t    ", "Skim each pass (sep)",
+		      fieldlength-4);
+  multiParamPrint(Pv, singlePvIndex, ostr, 
 		  Pv[0].mp_assembly_params.as_numrmbbreakloops,
 		  "\t", "Maximum number of RMB break loops (rbl)",
 		  fieldlength);
-  multiParamPrint(Pv, singlePvIndex, ostr,
+  multiParamPrint(Pv, singlePvIndex, ostr, 
 		  Pv[0].mp_assembly_params.as_maxcontigsperpass,
 		  "\t", "Maximum contigs per pass (mcpp)",
 		  fieldlength);
 
   ostr << '\n';
 
-  multiParamPrint(Pv, indexesInPv, ostr,
+  multiParamPrint(Pv, indexesInPv, ostr, 
 		  Pv[0].mp_assembly_params.as_minimum_readlength,
 		  "\t", "Minimum read length (mrl)",
 		  fieldlength);
-  multiParamPrint(Pv, indexesInPv, ostr,
+  multiParamPrint(Pv, indexesInPv, ostr, 
 		  Pv[0].mp_assembly_params.as_minimum_readspercontig,
 		  "\t", "Minimum reads per contig (mrpc)",
 		  fieldlength);
-  multiParamPrintBool(Pv, indexesInPv, ostr,
+  multiParamPrintNumericChar(Pv, indexesInPv, ostr, 
+			     Pv[0].mp_assembly_params.as_basedefaultqual,
+			     "\t", "Base default quality (bdq)",
+			     fieldlength);
+  multiParamPrintBool(Pv, indexesInPv, ostr, 
 		      Pv[0].mp_assembly_params.as_enforce_qualsinreads,
 		      "\t", "Enforce presence of qualities (epoq)",
 		      fieldlength);
 
 
-#ifndef PUBLICQUIET
   ostr << '\n';
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
-		      Pv[0].mp_assembly_params.as_rle_reads,
-		  "\t", "Use run length encoding (urle)",
-		  fieldlength);
-#endif
 
-  ostr << '\n';
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
 		  Pv[0].mp_assembly_params.as_automatic_repeat_detection,
 		  "\t", "Automatic repeat detection (ard)",
 		  fieldlength);
-  multiParamPrint(Pv, indexesInPv, ostr,
+  multiParamPrint(Pv, indexesInPv, ostr, 
 		  Pv[0].mp_assembly_params.as_ard_multicopythreshold,
 		  "\t    ", "Coverage threshold (ardct)",
 		  fieldlength-4);
-  multiParamPrint(Pv, indexesInPv, ostr,
+  multiParamPrint(Pv, indexesInPv, ostr, 
 		  Pv[0].mp_assembly_params.as_ard_multicopyminlen,
 		  "\t    ", "Minimum length (ardml)",
 		  fieldlength-4);
-  multiParamPrint(Pv, indexesInPv, ostr,
+  multiParamPrint(Pv, indexesInPv, ostr, 
 		  Pv[0].mp_assembly_params.as_ard_multicopygrace,
 		  "\t    ", "Grace length (ardgl)",
 		  fieldlength-4);
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
 		      Pv[0].mp_assembly_params.as_uniform_read_distribution,
 		      "\t    ", "Use uniform read distribution (urd)",
 		      fieldlength-4);
-  multiParamPrint(Pv, singlePvIndex, ostr,
+  multiParamPrint(Pv, singlePvIndex, ostr, 
 		  Pv[0].mp_assembly_params.as_urd_startinpass,
 		  "\t      ", "Start in pass (urdsip)",
 		  fieldlength-6);
-  multiParamPrint(Pv, indexesInPv, ostr,
+  multiParamPrint(Pv, indexesInPv, ostr, 
 		  Pv[0].mp_assembly_params.as_urd_cutoffmultiplier,
 		  "\t      ", "Cutoff multiplier (urdcm)",
 		  fieldlength-6);
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
+		  Pv[0].mp_assembly_params.as_keep_long_repeats_separated,
+		  "\t", "Keep long repeats separated (klrs)",
+		  fieldlength);
 
   ostr << '\n';
 
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
 		      Pv[0].mp_assembly_params.as_spoilerdetection,
 		      "\t", "Spoiler detection (sd)",
 		      fieldlength);
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
 		      Pv[0].mp_assembly_params.as_spdetect_lastpassonly,
 		      "\t    ", "Last pass only (sdlpo)",
 		      fieldlength-4);
 
   ostr << '\n';
 
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
+		      Pv[0].mp_pathfinder_params.paf_use_genomic_algorithms,
+		      "\t", "Use genomic pathfinder (ugpf)",
+		      fieldlength);
+
+  ostr << '\n';
+
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
 		      Pv[0].mp_pathfinder_params.paf_use_emergency_search_stop,
 		      "\t", "Use emergency search stop (uess)",
 		      fieldlength);
 
-  multiParamPrint(Pv, singlePvIndex, ostr,
+  multiParamPrint(Pv, singlePvIndex, ostr, 
 		  Pv[0].mp_pathfinder_params.paf_ess_depth,
 		  "\t    ", "ESS partner depth (esspd)",
 		  fieldlength-4);
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
 		      Pv[0].mp_pathfinder_params.paf_use_emergency_blacklist,
 		      "\t", "Use emergency blacklist (uebl)",
 		      fieldlength);
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
 		      Pv[0].mp_pathfinder_params.paf_use_max_contig_buildtime,
 		      "\t", "Use max. contig build time (umcbt)",
 		      fieldlength);
-  multiParamPrint(Pv, singlePvIndex, ostr,
+  multiParamPrint(Pv, singlePvIndex, ostr, 
 		  Pv[0].mp_pathfinder_params.paf_max_contig_buildtime,
 		  "\t    ", "Build time in seconds (bts)",
 		  fieldlength-4);
@@ -1767,16 +1652,127 @@ void MIRAParameters::dumpLoadParams(vector<MIRAParameters> & Pv, const vector<in
 
   ostr << "\n  Load reads options (-LR):\n";
 
-  multiParamPrintBool(Pv, indexesInPv, ostr,
+  multiParamPrintBool(Pv, indexesInPv, ostr, 
+		      Pv[0].mp_assembly_params.as_load_sequencedata,
+		      "\t", "Load sequence data (lsd)",
+		      fieldlength);
+
+  multiParamPrint(Pv, indexesInPv, ostr, 
+		  Pv[0].mp_assembly_params.as_infile_which,
+		  "\t    ", "File type (ft)",
+		  fieldlength-4);
+
+
+//  multiParamPrintBool(Pv, singlePvIndex, ostr, 
+//		      Pv[0].mp_assembly_params.as_loadSANGER,
+//		      "\t", "Load Sanger data (lsand)",
+//		      fieldlength);
+
+
+//  multiParamPrint(Pv, singlePvIndex, ostr, 
+//		  Pv[0].mp_assembly_params.as_infile_which,
+//		  "\t    ", "Sanger file type (sanft)",
+//		  fieldlength-4);
+
+
+  ostr << "\t    External quality (eq)                   : ";
+  switch(Pv[0].mp_assembly_params.as_external_qual){
+  case E_QUAL_SCF:{
+    ostr << "from SCF (scf)\n";
+    break;
+  }
+  case E_QUAL_NONE:{
+    ostr << "none (none)\n";
+    break;
+  }
+  default:{
+    ostr << "Unknown??? (please contact the authors)\n";
+  }
+  }
+
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
+		      Pv[0].mp_assembly_params.as_external_qual_override,
+		      "\t        ", 
+		      "Ext. qual. override (eqo)",
+		      fieldlength-8);
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
+		      Pv[0].mp_assembly_params.as_discard_read_on_eq_error,
+		      "\t        ", 
+		      "Discard reads on e.q. error (droeqe)",
+		      fieldlength-8);
+
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
+		      Pv[0].mp_assembly_params.as_loadSOLEXA_solexa_scores_in_qual_files,
+		      "\t    ", "Solexa scores in qual file (ssiqf)",
+		      fieldlength-4);
+
+  multiParamPrintNumericChar(Pv, indexesInPv, ostr, 
+			     Pv[0].mp_assembly_params.as_fastq_qualoffset,
+			     "\t    ", "FASTQ qual offset (fqqo)",
+			     fieldlength-4);
+
+  ostr << '\n';
+
+  multiParamPrintBool(Pv, indexesInPv, ostr, 
 		      Pv[0].mp_assembly_params.as_wants_qualityfile,
 		      "\t", "Wants quality file (wqf)",
 		      fieldlength);
 
   ostr << '\n';
 
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
+  ostr << "\tRead naming scheme (rns)                    :";
+  for(uint32 ipvindex=0; ipvindex<indexesInPv.size(); ipvindex++){
+    if(ipvindex>0) {
+      ostr << "\t";
+      for(int32 pad=fieldlength;pad>0;pad--) ostr << ' ';
+    }
+    if(indexesInPv[ipvindex] >= static_cast<int>(Pv.size())) {
+      cerr << "BARF! MIRAParameters broken, wanted to read elem " << indexesInPv[ipvindex] << " for vector of size " << Pv.size() << "\n";
+      abort();
+    }
+
+    ostr << "  [" << Read::getShortNameOfSequencingType(indexesInPv[ipvindex]) << "] ";
+
+    switch(Pv[indexesInPv[ipvindex]].mp_assembly_params.as_readnaming_scheme){
+    case SCHEME_SANGER:{
+      ostr << "Sanger Institute (sanger)\n";
+      break;
+    }
+    case SCHEME_TIGR:{
+      ostr << "TIGR (tigr)\n";
+      break;
+    }
+    case SCHEME_FR:{
+      ostr << "forward/reverse (fr)\n";
+      break;
+    }
+    case SCHEME_SOLEXA:{
+      ostr << "Solexa (solexa)\n";
+      break;
+    }
+    case SCHEME_STLOUIS:{
+      ostr << "St. Louis (stlouis)\n";
+      break;
+    }
+    default:{
+      ostr << "Unknown??? (please contact the authors)\n";
+    }
+    }
+  }
+
+  ostr << '\n';
+
+  multiParamPrintBool(Pv, indexesInPv, ostr, 
+		      Pv[0].mp_assembly_params.as_mergexmltraceinfo,
+		      "\t", 
+		      "Merge with XML trace info (mxti)",
+		      fieldlength);
+
+  ostr << '\n';
+
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
 		      Pv[0].mp_assembly_params.as_filecheck_only,
-		      "\t",
+		      "\t", 
 		      "Filecheck only (fo)",
 		      fieldlength);
 
@@ -1788,7 +1784,6 @@ void MIRAParameters::dumpGeneralParams(vector<MIRAParameters> & Pv, const vector
 
   vector<int> singlePvIndex;
   if(indexesInPv.size()==1){
-    cout << "Pushing back " << indexesInPv.front() << endl;
     singlePvIndex.push_back(indexesInPv.front());
   }else{
     singlePvIndex.push_back(0);
@@ -1796,39 +1791,58 @@ void MIRAParameters::dumpGeneralParams(vector<MIRAParameters> & Pv, const vector
 
   ostr << "  General (-GE):\n";
 
+  multiParamPrint(Pv, singlePvIndex, ostr, Pv[0].mp_assembly_params.as_projectname_in,
+		  "\t", "Project name in (proin)",
+		  fieldlength);
   multiParamPrint(Pv, singlePvIndex, ostr, Pv[0].mp_assembly_params.as_projectname_out,
-		  "\t", "Project name",
+		  "\t", "Project name out (proout)",
 		  fieldlength);
-  multiParamPrint(Pv, singlePvIndex, ostr,
+  multiParamPrint(Pv, singlePvIndex, ostr, 
 		  Pv[0].mp_assembly_params.as_numthreads,
 		  "\t", "Number of threads (not)",
 		  fieldlength);
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
 		      Pv[0].mp_assembly_params.as_automemmanagement,
 		      "\t", "Automatic memory management (amm)",
 		      fieldlength);
-  multiParamPrint(Pv, singlePvIndex, ostr,
+  multiParamPrint(Pv, singlePvIndex, ostr, 
 		  Pv[0].mp_assembly_params.as_amm_keeppercentfree,
 		  "\t    ", "Keep percent memory free (kpmf)",
 		  fieldlength-4);
-  multiParamPrint(Pv, singlePvIndex, ostr,
+  multiParamPrint(Pv, singlePvIndex, ostr, 
 		  Pv[0].mp_assembly_params.as_amm_maxprocesssize,
 		  "\t    ", "Max. process size (mps)",
 		  fieldlength-4);
-  multiParamPrint(Pv, singlePvIndex, ostr,
+//  multiParamPrintBool(Pv, singlePvIndex, ostr, 
+//		      Pv[0].mp_assembly_params.as_keepcontigsinmem,
+//		      "\t", 
+//		      "Keep contigs in memory (kcim)",
+//		      fieldlength);
+  multiParamPrint(Pv, singlePvIndex, ostr, 
 		  Pv[0].mp_special_params.sp_est_startstep,
-		  "\t",
+		  "\t", 
 		  "EST SNP pipeline step (esps)",
 		  fieldlength);
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
-		      Pv[0].mp_assembly_params.as_buntify_reads,
-		      "\t",
-		      "Colour reads by kmer frequency (crkf)",
+  multiParamPrintBool(Pv, indexesInPv, ostr, 
+		      Pv[0].mp_contig_params.con_use_template_information,
+		      "\t", "Use template information (uti)",
 		      fieldlength);
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
-		      Pv[0].mp_assembly_params.as_assemblyjob_preprocessonly,
-		      "\t",
-		      "Preprocess only (ppo)",
+  multiParamPrint(Pv, indexesInPv, ostr, 
+		  Pv[0].mp_contig_params.con_insertsize_minimum,
+		  "\t    ", "Template insert size minimum (tismin)",
+		  fieldlength-4);
+  multiParamPrint(Pv, indexesInPv, ostr, 
+		  Pv[0].mp_contig_params.con_insertsize_maximum,
+		  "\t    ", "Template insert size maximum (tismax)",
+		  fieldlength-4);
+  multiParamPrint(Pv, indexesInPv, ostr, 
+		  Pv[0].mp_contig_params.con_template_build_direction,
+		  "\t    ", "Template partner build direction (tpbd)",
+		  fieldlength-4);
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
+		      Pv[0].mp_assembly_params.as_buntify_reads,
+		      "\t", 
+		      "Colour reads by hash frequency (crhf)",
 		      fieldlength);
 }
 
@@ -1845,96 +1859,27 @@ void MIRAParameters::dumpMiscParams(vector<MIRAParameters> & Pv, const vector<in
 
   ostr << "\n  Misc (-MI):\n";
 
-  multiParamPrint(Pv, singlePvIndex, ostr,
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
+		      Pv[0].mp_special_params.mi_stop_on_nfs,
+		      "\t", "Stop on NFS (sonfs)",
+		      fieldlength);
+  multiParamPrintBool(Pv, singlePvIndex, ostr, 
+		      Pv[0].mp_special_params.mi_extended_log,
+		      "\t", "Extended log (el)",
+		      fieldlength);
+  multiParamPrint(Pv, singlePvIndex, ostr, 
 		  Pv[0].mp_special_params.mi_as_largecontigsize,
 		  "\t", "Large contig size (lcs)",
 		  fieldlength);
-  multiParamPrint(Pv, singlePvIndex, ostr,
+  multiParamPrint(Pv, singlePvIndex, ostr, 
 		  Pv[0].mp_special_params.mi_as_largecontigsize4stats,
-		  "\t", "Large contig size for stats (lcs4s)",
+		  "\t", "Large contig size for stats(lcs4s)",
 		  fieldlength);
 
-  ostr << '\n';
-
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
-		      Pv[0].mp_special_params.mi_iknowwhatido,
-		      "\t", "I know what I do (ikwid)",
-		      fieldlength);
-
-  ostr << '\n';
-
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
-		      Pv[0].mp_special_params.mi_extra_flag1,
-		      "\t", "Extra flag 1 / sanity track check (ef1)",
-		      fieldlength);
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
-		      Pv[0].mp_special_params.mi_extra_flag2,
-		      "\t", "Extra flag 2 / dnredreadsatpeaks (ef2)",
-		      fieldlength);
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
-		      Pv[0].mp_special_params.mi_extra_flag3,
-		      "\t", "Extra flag 3 / pelibdisassemble (ef3)",
-		      fieldlength);
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
-		      Pv[0].mp_special_params.mi_extended_log,
-		      "\t", "Extended log (el)",
-		      fieldlength);
-}
-
-void MIRAParameters::dumpNagAndWarnParams(vector<MIRAParameters> & Pv, const vector<int> & indexesInPv, ostream & ostr)
-{
-  const int32 fieldlength=45;
-
-  vector<int> singlePvIndex;
-  if(indexesInPv.size()==1){
-    singlePvIndex.push_back(indexesInPv.front());
-  }else{
-    singlePvIndex.push_back(0);
-  }
-
-  ostr << "\n  Nag and Warn (-NW):\n";
-
-  multiParamPrintNagWarn(Pv, singlePvIndex, ostr,
-			 Pv[0].mp_nagandwarn_params.nw_check_nfs,
-			 "\t", "Check NFS (cnfs)",
-			 fieldlength);
-
-  multiParamPrintNagWarn(Pv, singlePvIndex, ostr,
-			 Pv[0].mp_nagandwarn_params.nw_check_multipassmapping,
-			 "\t", "Check multi pass mapping (cmpm)",
-			 fieldlength);
-
-  multiParamPrintNagWarn(Pv, singlePvIndex, ostr,
-			 Pv[0].mp_nagandwarn_params.nw_check_templateproblems,
-			 "\t", "Check template problems (ctp)",
-			 fieldlength);
-
-  multiParamPrintNagWarn(Pv, singlePvIndex, ostr,
-			 Pv[0].mp_nagandwarn_params.nw_check_readnamesra,
-			 "\t", "Check SRA read names (csrn)",
-			 fieldlength);
-
-  multiParamPrintNagWarn(Pv, singlePvIndex, ostr,
-			 Pv[0].mp_nagandwarn_params.nw_check_duplicatereadnames,
-			 "\t", "Check duplicate read names (cdrn)",
-			 fieldlength);
-
-  multiParamPrintNagWarn(Pv, singlePvIndex, ostr,
-			 Pv[0].mp_nagandwarn_params.nw_check_maxreadnamelength,
-			 "\t", "Check max read name length (cmrnl)",
-			 fieldlength);
-  multiParamPrint(Pv, singlePvIndex, ostr,
-		  Pv[0].mp_nagandwarn_params.nw_check_mrnlvalue,
-		  "\t    ", "Max read name length (mrnl)",
-		  fieldlength-4);
-  multiParamPrintNagWarn(Pv, singlePvIndex, ostr,
-			 Pv[0].mp_nagandwarn_params.nw_check_coverage,
-			 "\t", "Check average coverage (cac)",
-			 fieldlength);
-  multiParamPrint(Pv, singlePvIndex, ostr,
-		  Pv[0].mp_nagandwarn_params.nw_check_covvalue,
-		  "\t    ", "Average coverage value (acv)",
-		  fieldlength-4);
+  multiParamPrint(Pv, singlePvIndex, ostr, 
+		  Pv[0].mp_special_params.mi_stop_readnamelength,
+		  "\t", "Stop on max read name length (somrnl)",
+		  fieldlength);
 }
 
 // static func
@@ -1942,155 +1887,187 @@ void MIRAParameters::dumpAlignParams(vector<MIRAParameters> & Pv, const vector<i
 {
   const int32 fieldlength=40;
 
-  vector<int> singlePvIndex;
-  if(indexesInPv.size()==1){
-    singlePvIndex.push_back(indexesInPv.front());
-  }else{
-    singlePvIndex.push_back(0);
-  }
-
   ostr << "\n  Align parameters for Smith-Waterman align (-AL):\n";
-
+  
   multiParamPrint(Pv, indexesInPv, ostr, Pv[0].mp_align_params.al_kpercent,
 		  "\t", "Bandwidth in percent (bip)",
 		  fieldlength);
-  multiParamPrint(Pv, indexesInPv, ostr,
+  multiParamPrint(Pv, indexesInPv, ostr, 
 		  Pv[0].mp_align_params.al_kmax,
-		  "\t",
+		  "\t", 
 		  "Bandwidth max (bmax)",
 		  fieldlength);
-  multiParamPrint(Pv, indexesInPv, ostr,
+  multiParamPrint(Pv, indexesInPv, ostr, 
 		  Pv[0].mp_align_params.al_kmin,
-		  "\t",
+		  "\t", 
 		  "Bandwidth min (bmin)",
 		  fieldlength);
-  multiParamPrint(Pv, indexesInPv, ostr,
+  multiParamPrint(Pv, indexesInPv, ostr, 
 		  Pv[0].mp_align_params.al_min_score,
-		  "\t",
+		  "\t", 
 		  "Minimum score (ms)",
 		  fieldlength);
-  multiParamPrint(Pv, indexesInPv, ostr,
+  multiParamPrint(Pv, indexesInPv, ostr, 
 		  Pv[0].mp_align_params.al_min_overlap,
 		  "\t",
 		  "Minimum overlap (mo)",
 		  fieldlength);
-  multiParamPrint(Pv, indexesInPv, ostr,
+  multiParamPrint(Pv, indexesInPv, ostr, 
 		  Pv[0].mp_align_params.al_min_relscore,
-		  "\t",
+		  "\t", 
 		  "Minimum relative score in % (mrs)",
 		  fieldlength);
-
-  ostr << '\n';
-
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
-		      Pv[0].mp_align_params.ads_enforce_clean_ends,
-		      "\t",
-		      "Enforce clean ends (ece)",
-		      fieldlength);
-  multiParamPrint(Pv, singlePvIndex, ostr,
-		  Pv[0].mp_align_params.ads_clean_end_distance,
-		  "\t    ",
-		  "Clean end distance (ced)",
-		  fieldlength-4);
-
-  multiParamPrint(Pv, singlePvIndex, ostr,
-		  Pv[0].mp_align_params.ads_clean_end_mismatchallowed,
-		  "\t    ",
-		  "Clean end mismatch allowed (cema)",
-		  fieldlength-4);
-
-  multiParamPrintBool(Pv, singlePvIndex, ostr,
+  multiParamPrint(Pv, indexesInPv, ostr, 
+		  Pv[0].mp_align_params.al_solexahack_maxerrors,
+		  "\t", 
+		  "Solexa_hack_max_errors (shme)",
+		  fieldlength);
+  multiParamPrintBool(Pv, indexesInPv, ostr, 
 		      Pv[0].mp_align_params.ads_extra_gap_penalty,
-		      "\t",
+		      "\t", 
 		      "Extra gap penalty (egp)",
 		      fieldlength);
-  multiParamPrint(Pv, singlePvIndex, ostr,
-		  Pv[0].mp_align_params.ads_gp_functionstring,
-		  "\t    ",
-		  "extra gap penalty levels (egpl)",
-		  fieldlength-4);
 
-  multiParamPrint(Pv, singlePvIndex, ostr,
+  ostr << "\t    extra gap penalty level (egpl)     :";
+  for(uint32 ipvindex=0; ipvindex<indexesInPv.size(); ipvindex++){
+    if(ipvindex>0) {
+      ostr << '\t';
+      for(int32 pad=fieldlength;pad>0;pad--) ostr << ' ';
+    }
+    if(indexesInPv[ipvindex] >= static_cast<int>(Pv.size())) {
+      cerr << "BARF! MIRAParameters broken, wanted to read elem " << indexesInPv[ipvindex] << " for vector of size " << Pv.size() << "\n";
+      abort();
+    }
+
+    ostr << "  [" << Read::getShortNameOfSequencingType(indexesInPv[ipvindex]) << "] ";
+
+    switch(Pv[indexesInPv[ipvindex]].mp_align_params.ads_gp_level) {
+    case 0: {
+      ostr << "low\n";
+      break;
+    }
+    case 1: {
+      ostr << "medium\n";
+      break;
+    }
+    case 2: {
+      ostr << "high\n";
+      break;
+    }
+    case 10: {
+      ostr << "reject_codongaps\n";
+      break;
+    }
+    default: {
+      ostr << "Unknown??? (please contact the authors)\n";
+      break;
+    }
+    }
+  }
+    
+
+  multiParamPrint(Pv, indexesInPv, ostr, 
 		  Pv[0].mp_align_params.ads_max_gppercent,
-		  "\t    ",
+		  "\t    ", 
 		  "Max. egp in percent (megpp)",
 		  fieldlength-4);
-
-  ostr << '\n';
-
-  multiParamPrint(Pv, indexesInPv, ostr,
-		  Pv[0].mp_align_params.al_solexahack_maxerrors,
-		  "\t",
-		  "Solexa_hack_max_errors (shme)",
-		  fieldlength);
 }
 
-void MIRAParameters::consistencyCheck(bool verbose)
+void MIRAParameters::consistencyCheck()
 {
   checkMin("-GE:not",mp_assembly_params.as_numthreads,
 	   static_cast<uint32>(1),
-	   static_cast<uint32>(1), verbose);
+	   static_cast<uint32>(1));
   checkMax("-GE:not",mp_assembly_params.as_numthreads,
 	   static_cast<uint32>(256),
-	   static_cast<uint32>(256), verbose);
+	   static_cast<uint32>(256));
   checkMin("-AS:mrl",mp_assembly_params.as_minimum_readlength,
 	   static_cast<uint32>(20),
-	   static_cast<uint32>(20), verbose);
-  checkMin("-AS:bts",mp_pathfinder_params.paf_max_contig_buildtime,60,120, verbose);
+	   static_cast<uint32>(20));
+  checkMin("-AS:bts",mp_pathfinder_params.paf_max_contig_buildtime,1000,2000);
+  checkMax("-AS:bdq",mp_assembly_params.as_basedefaultqual,
+	     static_cast<base_quality_t>(100),
+	     static_cast<base_quality_t>(100));
   checkMin("-AS:rbl",mp_assembly_params.as_numrmbbreakloops,
 	   static_cast<uint32>(1),
-	   static_cast<uint32>(1), verbose);
-
-  checkMin("-CL:peckms",mp_assembly_params.as_clip_pec_basesperhash,
+	   static_cast<uint32>(1));
+  
+  checkMin("-CL:pecbph",mp_assembly_params.as_clip_pec_basesperhash,
 	   static_cast<uint32>(10),
-	   static_cast<uint32>(10), verbose);
+	   static_cast<uint32>(10));
 
-  checkMax("-SK:kms",mp_skim_params.sk_basesperhash,
-	   static_cast<uint32>(256),
-	   static_cast<uint32>(256), verbose);
+  if(sizeof(uint64) == 4) {
+    checkMax("-SB:bph",mp_skim_params.sk_basesperhash,
+	     static_cast<uint32>(16),
+	     static_cast<uint32>(16));
+  }
+  if(sizeof(uint64) == 8) {
+    checkMax("-SK:bph",mp_skim_params.sk_basesperhash,
+	     static_cast<uint32>(32),
+	     static_cast<uint32>(32));
+  }
 //  if(sizeof(unsigned long) == 4) {
 //    if(mp_skim_params.sk_basesperhash>=16) {
 //      cout << "We're on a 32 bit machine, must adapt -SK:bph.\n";
 //    }
 //    checkMax("-SK:bph",mp_skim_params.sk_basesperhash,
 //	     static_cast<uint32>(15),
-//	     static_cast<uint32>(15), verbose);
+//	     static_cast<uint32>(15));
 //  }
   checkMax("-SB:sbuip",mp_assembly_params.as_startbackboneusage_inpass,
 	   static_cast<int32>(mp_assembly_params.as_numpasses),
-	   static_cast<int32>(mp_assembly_params.as_numpasses), verbose);
+	   static_cast<int32>(mp_assembly_params.as_numpasses));
 
   // TODO: more consistency checks down the parameter list
 
-  checkMin("-OUT:tcpl",mp_contig_params.con_output_text_cpl,10,60, verbose);
-  checkMin("-OUT:hcpl",mp_contig_params.con_output_html_cpl,10,60, verbose);
+  checkMin("-OUT:tcpl",mp_contig_params.con_output_text_cpl,10,60);
+  checkMin("-OUT:hcpl",mp_contig_params.con_output_html_cpl,10,60);
 }
 
-void MIRAParameters::generateProjectNames(vector<MIRAParameters> & Pv, string name)
-{
+void MIRAParameters::generateProjectNames(vector<MIRAParameters> & Pv, string name) {
   generateProjectInNames(Pv, name);
   generateProjectOutNames(Pv, name);
 
   return;
 }
 
-// TODO: to be retired as soon as ssaha2 / smalt is integrated into manifest loading system
 void MIRAParameters::generateProjectInNames(vector<MIRAParameters> & Pv, string name) {
   if(name.empty()) name=Pv[0].mp_assembly_params.as_projectname_in;
-
-  Pv[0].mp_assembly_params.as_projectname_in=name;
+  Pv[0].mp_assembly_params.as_infile_backbone_MAF=name+"_backbone_in.maf";
+  Pv[0].mp_assembly_params.as_infile_backbone_CAF=name+"_backbone_in.caf";
+  Pv[0].mp_assembly_params.as_infile_backbone_GBF=name+"_backbone_in.gbf";
+  Pv[0].mp_assembly_params.as_infile_backbone_GFF3=name+"_backbone_in.gff3";
+  Pv[0].mp_assembly_params.as_infile_backbone_FASTA=name+"_backbone_in.fasta";
+  Pv[0].mp_assembly_params.as_infile_backbone_FASTAQUAL=name+"_backbone_in.fasta.qual";
+  Pv[0].mp_assembly_params.as_infile_FOFNPHD=name+"_in.fofnphd";
+  Pv[0].mp_assembly_params.as_infile_PHD=name+"_in.phd.1";
+  Pv[0].mp_assembly_params.as_infile_straindata=name+"_straindata_in.txt";
+  Pv[0].mp_assembly_params.as_infile_ssahavectorscreen=name+"_ssaha2vectorscreen_in.txt";
+  Pv[0].mp_assembly_params.as_infile_smaltvectorscreen=name+"_smaltvectorscreen_in.txt";
+
+  Pv[0].mp_assembly_params.as_infile_chkptMAF="readpool.maf";
+
+  for(uint32 i=0; i<Read::SEQTYPE_END; i++){
+    string sname=Read::getNameOfSequencingType(i);
+    boost::to_lower(sname);
+    Pv[i].mp_assembly_params.as_infile_xmltraceinfo=name+"_traceinfo_in."+sname+".xml";
+    Pv[i].mp_assembly_params.as_infile_FASTQ=name+"_in."+sname+".fastq";
+    Pv[i].mp_assembly_params.as_infile_FASTA=name+"_in."+sname+".fasta";
+    Pv[i].mp_assembly_params.as_infile_FASTAQUAL=name+"_in."+sname+".fasta.qual";
+    Pv[i].mp_assembly_params.as_infile_CAF=name+"_in."+sname+".caf";
+    Pv[i].mp_assembly_params.as_infile_MAF=name+"_in."+sname+".maf";
+    Pv[i].mp_assembly_params.as_infile_FOFNEXP=name+"_in."+sname+".fofn";
+  }
 
   return;
 }
 
 void MIRAParameters::generateProjectOutNames(vector<MIRAParameters> & Pv, string name) {
   if(name.empty()) name=Pv[0].mp_assembly_params.as_projectname_out;
-  Pv[0].mp_assembly_params.as_projectname_out=name;
-  Pv[0].mp_assembly_params.as_outfile_FASTAUNPADDED=name+"_out.unpadded";
-  Pv[0].mp_assembly_params.as_outfile_FASTAUNPADDEDQUAL=name+"_out.unpadded";
+  Pv[0].mp_assembly_params.as_outfile_FASTA=name+"_out.unpadded";
+  Pv[0].mp_assembly_params.as_outfile_FASTAQUAL=name+"_out.unpadded";
   Pv[0].mp_assembly_params.as_outfile_FASTAPADDED=name+"_out.padded";
   Pv[0].mp_assembly_params.as_outfile_FASTAPADDEDQUAL=name+"_out.padded";
-  Pv[0].mp_assembly_params.as_outfile_FASTA=name+"_out";
   Pv[0].mp_assembly_params.as_outfile_CAF=name+"_out";
   Pv[0].mp_assembly_params.as_outfile_MAF=name+"_out";
   Pv[0].mp_assembly_params.as_outfile_HTML=name+"_out";
@@ -2100,17 +2077,12 @@ void MIRAParameters::generateProjectOutNames(vector<MIRAParameters> & Pv, string
   Pv[0].mp_assembly_params.as_outfile_TCS=name+"_out";
   Pv[0].mp_assembly_params.as_outdir_GAP4DA=name+"_out";
 
-  Pv[0].mp_file_params.chkpt_persistentoverlaps="povl.txt";
-  Pv[0].mp_file_params.chkpt_bannedoverlaps="bannedOverlaps.txt";
-  Pv[0].mp_file_params.chkpt_maxcovreached="maxCovReached.txt";
-  Pv[0].mp_file_params.chkpt_passinfo="passInfo.txt";
-  Pv[0].mp_file_params.chkpt_readpool="readpool.maf";
+  Pv[0].mp_assembly_params.as_outfile_callparams=name+"_info_callparameters.txt";
 
   Pv[0].mp_assembly_params.as_outfile_stats_reads_invalid=name+"_info_reads_invalid";
   Pv[0].mp_assembly_params.as_outfile_stats_reads_tooshort=name+"_info_reads_tooshort";
   Pv[0].mp_assembly_params.as_outfile_stats_contigstats=name+"_info_contigstats";
   Pv[0].mp_assembly_params.as_outfile_stats_info=name+"_info_assembly";
-  Pv[0].mp_assembly_params.as_outfile_stats_warnings=name+"_info_WARNINGS";
   Pv[0].mp_assembly_params.as_outfile_stats_debrislist=name+"_info_debrislist";
   Pv[0].mp_assembly_params.as_outfile_stats_crlist=name+"_info_contigreadlist";
   Pv[0].mp_assembly_params.as_outfile_stats_readtags=name+"_info_readtaglist";
@@ -2120,10 +2092,7 @@ void MIRAParameters::generateProjectOutNames(vector<MIRAParameters> & Pv, string
   Pv[0].mp_assembly_params.as_outfile_stats_featureanalysis=name+"_info_featureanalysis";
   Pv[0].mp_assembly_params.as_outfile_stats_featuresummary=name+"_info_featuresummary";
   Pv[0].mp_assembly_params.as_outfile_stats_featuresequences=name+"_info_featuresequences";
-  Pv[0].mp_assembly_params.as_outfile_stats_featurecoverage=name+"_info_featurecoverage";
   Pv[0].mp_assembly_params.as_outfile_stats_readrepeats=name+"_info_readrepeats";
-  Pv[0].mp_assembly_params.as_outfile_stats_largecontigs=name+"_info_largecontigs";
-  Pv[0].mp_assembly_params.as_outfile_stats_rgstinfo=name+"_info_readgroups";
 
   Pv[0].mp_assembly_params.as_tmpf_spoiler=name+"_int_contigjoinspoiler";
   Pv[0].mp_assembly_params.as_tmpf_adsextend=name+"_int_alignextends";
@@ -2134,20 +2103,6 @@ void MIRAParameters::generateProjectOutNames(vector<MIRAParameters> & Pv, string
   Pv[0].mp_assembly_params.as_tmpf_clippings=name+"_int_clippings";
   Pv[0].mp_assembly_params.as_tmpf_ads=name+"_int_ads";
   Pv[0].mp_assembly_params.as_tmpf_poolinfo=name+"_log_readpoolinfo";
-  Pv[0].mp_assembly_params.as_tmpf_kmerstatistics=name+"_int_kmerstats";
-
-  Pv[0].mp_assembly_params.as_tmpf_signal_findpossibleoverlaps=name+"_signal_findpossibleoverlaps";
-  Pv[0].mp_assembly_params.as_tmpf_signal_mainalignments=name+"_signal_mainalignments";
-  Pv[0].mp_assembly_params.as_tmpf_signal_kmerstats=name+"_signal_kmerstats";
-
-  Pv[0].mp_assembly_params.as_tmpf_wellconnected=name+"_int_wellconnected";
-  Pv[0].mp_assembly_params.as_tmpf_banned_overlaps=name+"_int_banned_overlaps";
-  Pv[0].mp_assembly_params.as_tmpf_istroublemaker=name+"_int_istroublemaker";
-  Pv[0].mp_assembly_params.as_tmpf_needalloverlaps=name+"_int_needalloverlaps";
-  Pv[0].mp_assembly_params.as_tmpf_multicopies=name+"_int_multicopies";
-  Pv[0].mp_assembly_params.as_tmpf_hasmcoverlap=name+"_int_hasmcoverlap";
-  Pv[0].mp_assembly_params.as_tmpf_debrisreason=name+"_int_debrisreason";
-  Pv[0].mp_assembly_params.as_tmpf_skimmegahubs=name+"_int_skimmegahubs";
 
   string topdir=name+"_assembly";
   Pv[0].mp_directory_params.dir_top=topdir;
@@ -2156,7 +2111,6 @@ void MIRAParameters::generateProjectOutNames(vector<MIRAParameters> & Pv, string
   Pv[0].mp_directory_params.dir_results=topdir+"/"+name+"_d_results";
   Pv[0].mp_directory_params.dir_info=topdir+"/"+name+"_d_info";
   Pv[0].mp_directory_params.dir_checkpoint=topdir+"/"+name+"_d_chkpt";
-  Pv[0].mp_directory_params.dir_checkpoint_tmp=topdir+"/"+name+"_d_chkpt_tmp";
 
   //Pv[0].mp_assembly_params.as_tmpf_unused_ids="miratmp.unused_ids";
   Pv[0].mp_assembly_params.as_tmpf_unused_ids="";
@@ -2169,7 +2123,7 @@ void MIRAParameters::generateProjectOutNames(vector<MIRAParameters> & Pv, string
   return;
 }
 
-void MIRAParameters::correctTmpDirectory(vector<MIRAParameters> & Pv)
+void MIRAParameters::correctTmpDirectory(vector<MIRAParameters> & Pv) 
 {
   if(Pv[0].mp_directory_params.dir_tmp_redirectedto.size()){
     Pv[0].mp_directory_params.dir_tmp_symlink=Pv[0].mp_directory_params.dir_tmp;
@@ -2192,7 +2146,7 @@ ostream & operator<<(ostream &ostr, MIRAParameters const  &mp)
   Pv.push_back(mp);
   vector<int> bla;
   bla.push_back(0);
-
+  
   MIRAParameters::dumpAllParams(
     Pv,
     bla,
@@ -2202,6 +2156,133 @@ ostream & operator<<(ostream &ostr, MIRAParameters const  &mp)
 }
 
 
+//void MIRAParameters::setBorgMode(vector<MIRAParameters> & Pv,bool verbose)
+//{
+//  cout << "\nWe are MIRA of borg. You will be assembled. Resistance is futile.\n\n";
+//
+//  // TODO: check the following
+//  Pv[0].mp_align_params.al_max_cutoff=1;
+//  Pv[0].mp_edit_params.ed_automatic_contic_editing=true;
+//
+//  const char modestring[] = " -GE:eq=scf:eqo=no:uti=yes"
+//    " -ED:ace=yes -AS:mrl=32:nop=4:rbl=3:sd=yes:sdlpo=no:sep=yes"
+//    " -DP:ure=yes:rewl=30:rewme=4:feip=0:leip=2"
+//    " -AL:ms=15:mrs=55:mo=15:bmin=25:bmax=150:bip=20:egp=no:egpl=low"
+//    " -CO:rodirs=30:analysis=signal:dmer=10:mr=yes";
+//
+//  if(verbose){
+//    parseQuickmode(modestring, "-borg", Pv);
+//  }else{
+//    parseQuickmode(modestring, "", Pv);
+//  }
+//}
+//
+//void MIRAParameters::setQuickmodeGenomeDraft(vector<MIRAParameters> & Pv,bool verbose)
+//{
+//  const char modestring[] =	"\n\t-GE:uti=yes"
+//    "\n\t-AS:mrl=40:nop=2:sep=no:rbl=2:sd=no:ugpf=yes"
+//    "\n\t-DP:ure=no:tpae=no"
+//    "\n\t-CL:pvlc=no:qc=no:mbc=no:emlc=yes:mlcr=25:smlc=30"
+//    "\n\t-SK:bph=16:hss=8:pr=60:mhpr=100"
+//    "\n\t-AL:bip=15:bmin=25:bmax=70:mo=15:ms=30:mrs=65:egp=yes:egpl=low"
+//    "\n\t-CO:rodirs=15:mr=yes:asir=no:mrpg=2:emea=25"
+//    "\n\t    amgb=yes:amgbemc=yes:amgbnbs=yes"
+//    "\n\t-ED:ace=no";
+//  
+//  if(verbose){
+//    parseQuickmode(modestring, "-genomedraft", Pv);
+//  }else{
+//    parseQuickmode(modestring, "", Pv);
+//  }
+//}
+//
+//void MIRAParameters::setQuickmodeGenomeNormal(vector<MIRAParameters> & Pv,bool verbose)
+//{
+//  const char modestring[] =	"\n\t-GE:uti=yes"
+//    "\n\t-AS:mrl=40:nop=3:sep=no:rbl=3:sd=yes:sdlpo=yes:ugpf=yes"
+//    "\n\t-DP:ure=yes:rewl=30:rewme=2:feip=0;leip=0:tpae=no"
+//    "\n\t-CL:pvlc=yes:pvcmla=18:qc=no:mbc=no:emlc=yes:mlcr=25:smlc=30"
+//    "\n\t-SK:bph=16:hss=4:pr=50:mhpr=200"
+//    "\n\t-AL:bip=15:bmin=25:bmax=100:mo=15:ms=30:mrs=65:egp=yes:egpl=low"
+//    "\n\t-CO:rodirs=20:mr=yes:asir=no:mrpg=2:emea=25"
+//    "\n\t    amgb=yes:amgbemc=yes:amgbnbs=yes"
+//    "\n\t-ED:ace=no";
+//  
+//  if(verbose){
+//    parseQuickmode(modestring, "-genomenormal", Pv);
+//  }else{
+//    parseQuickmode(modestring, "", Pv);
+//  }
+//}
+//void MIRAParameters::setQuickmodeGenomeAccurate(vector<MIRAParameters> & Pv,bool verbose)
+//{
+//  const char modestring[] =	"\n\t-GE:uti=yes"
+//    "\n\t-AS:mrl=40:nop=4:sep=yes:rbl=4:sd=yes:sdlpo=yes:ugpf=yes"
+//    "\n\t-DP:ure=yes:rewl=30:rewme=2:feip=0;leip=0:tpae=no"
+//    "\n\t-CL:pvlc=yes:pvcmla=18:qc=no:mbc=no:emlc=yes:mlcr=25:smlc=30"
+//    "\n\t-SK:bph=16:hss=4:pr=45:mhpr=200"
+//    "\n\t-AL:bip=20:bmin=25:bmax=130:mo=15:ms=30:mrs=65:egp=yes:egpl=low"
+//    "\n\t-CO:rodirs=25:mr=yes:asir=no:mrpg=2:emea=25"
+//    "\n\t    amgb=yes:amgbemc=yes:amgbnbs=yes"
+//    "\n\t-ED:ace=no";
+//  
+//  if(verbose){
+//    parseQuickmode(modestring, "-genomeaccurate", Pv);
+//  }else{
+//    parseQuickmode(modestring, "", Pv);
+//  }
+//}
+
+
+
+// return 0 if ok
+int32 MIRAParameters::setSkimParams(skim_parameters & sp)
+{
+  mp_skim_params=sp;
+  return 0;
+}
+
+int32 MIRAParameters::setAlignParams(align_parameters & ap)
+{
+  mp_align_params=ap;
+  return 0;
+}
+
+int32 MIRAParameters::setDynamicParams(dynamic_parameters & dp)
+{
+  mp_dynamic_params=dp;
+  return 0;
+}
+int32 MIRAParameters::setAssemblyParams(assembly_parameters & ap)
+{
+  mp_assembly_params=ap;
+  return 0;
+}
+int32 MIRAParameters::setPathfinderParams(pathfinder_parameters & pp)
+{
+  mp_pathfinder_params=pp;
+  return 0;
+}
+int32 MIRAParameters::setContigParams(contig_parameters & cp)
+{
+  mp_contig_params=cp;
+  return 0;
+}
+int32 MIRAParameters::setDirectoryParams(directory_parameters & cp)
+{
+  mp_directory_params=cp;
+  return 0;
+}
+int32 MIRAParameters::setEditParams(edit_parameters & cp)
+{
+  mp_edit_params=cp;
+  return 0;
+}
+
+void MIRAParameters::setPathfinderuseGenomicAlgorithms(bool b)
+{
+  mp_pathfinder_params.paf_use_genomic_algorithms=b;
+}
 
 void MIRAParameters::setPathfinderMaxContigTime(uint32 t)
 {
@@ -2213,49 +2294,88 @@ void MIRAParameters::setPathfinderNextReadMaxTimeToESS(uint32 t)
   mp_pathfinder_params.paf_nextread_maxcttoess=t*sysconf(_SC_CLK_TCK);
 }
 
-void MIRAParameters::setContigForceNonIUPAC(bool perseq, bool amongseq)
+void MIRAParameters::setContigRODIRS(uint32 r)
 {
-  mp_contig_params.con_force_nonIUPACconsensus_perseqtype=perseq;
-  mp_contig_params.con_force_nonIUPACconsensus=amongseq;
+  mp_contig_params.con_reject_on_drop_in_relscore=r;
 }
 
-//void MIRAParameters::setAlignGapPenaltyLevel(uint32 level)
-bool MIRAParameters::setAlignGapPenaltyLevel(const string & gplevels, std::stringstream * errstreamptr)
+void MIRAParameters::setContigMinReadsPerGroup(uint32 r)
 {
-  FUNCSTART("bool MIRAParameters::setAlignGapPenaltyLevel(const string & gplevels, std::stringstream * errstream)");
+  mp_contig_params.con_minreadspergroup=r;
+}
 
-  static boost::char_separator<char> separator(",");
+void MIRAParameters::setContigEndReadMarkExclusionArea(uint32 r)
+{
+  mp_contig_params.con_endreadmarkexclusionarea=r;
+}
 
-  bool retval_error=false;
+void MIRAParameters::setContigAssumeSNPInsteadofRepeats(bool b)
+{
+  mp_contig_params.con_assume_snp_insteadof_rmb=b;
+}
 
-  mp_align_params.ads_gp_functionstring=gplevels;
-  mp_align_params.ads_gp_function.clear();
-  // 0 stars: no additional penalty
-  mp_align_params.ads_gp_function.push_back(0);
+void MIRAParameters::setContigDisregardSpuriousRMBMismatches(bool b)
+{
+  mp_contig_params.con_disregard_spurious_rmb_mismatches=b;
+}
 
-  boost::tokenizer<boost::char_separator<char> > tok(gplevels,separator);
-  for(auto & te : tok){
-    string tmps(te);
-    boost::trim(tmps);
-    auto tmp=atoi(tmps.c_str());
-    if(tmp<0 || tmp>100){
-      std::stringstream msg;
-      msg << "ERROR -AS:kmerseries: "
-	  << gplevels << "\n" << tmps << " is <= 0. kmer values must be >0\n";
-      if(errstreamptr!=nullptr) {
-	*errstreamptr << msg.str();
-	retval_error=true;
-      }else{
-	MIRANOTIFY(Notify::FATAL,msg.str());
-      }
-    }
-    mp_align_params.ads_gp_function.push_back(tmp);
-  }
 
-  return retval_error;
+
+void MIRAParameters::setContigMinNeighbourQuality(base_quality_t q)
+{
+  mp_contig_params.con_minrmbneighbourqual=q;
 }
 
-/*
+void MIRAParameters::setContigMinGroupQuality(base_quality_t q)
+{
+  mp_contig_params.con_mingroupqualforrmbtagging=q;;
+}
+
+void MIRAParameters::setContigMarkGapBases(bool b)
+{
+  mp_contig_params.con_also_mark_gap_bases=b;
+}
+
+void MIRAParameters::setContigMarkMulticolumnGapBases(bool b)
+{
+  mp_contig_params.con_also_mark_gap_bases_evenmc=b;
+}
+
+
+
+void MIRAParameters::setContigAlignmentOutputTextLineLen(int32 l)
+{
+  mp_contig_params.con_output_text_cpl=l;
+}
+
+void MIRAParameters::setContigAlignmentOutputHTMLLineLen(int32 l)
+{
+  mp_contig_params.con_output_html_cpl=l;
+}
+
+void MIRAParameters::setContigAlignmentOutputTextGapPad(char c)
+{
+  mp_contig_params.con_output_text_gapfill=c;
+}
+
+void MIRAParameters::setContigAlignmentOutputHTMLGapPad(char c)
+{
+  mp_contig_params.con_output_html_gapfill=c;
+}
+
+void MIRAParameters::setContigForceNonIUPAC(bool perseq, bool amongseq)
+{
+  mp_contig_params.con_force_nonIUPACconsensus_perseqtype=false;
+  mp_contig_params.con_force_nonIUPACconsensus_amongseqtypes=false;
+}
+
+void MIRAParameters::setAlignGapPenaltyLevel(uint32 level)
+{
+  mp_align_params.ads_gp_level=level;
+  mp_align_params.ads_gp_function.clear();
+  // 0 stars: no additional penalty
+  mp_align_params.ads_gp_function.push_back(0);
+  
   switch(level){
   case 0:{
     mp_align_params.ads_gp_function.push_back(0);     // 1 gap
@@ -2297,7 +2417,188 @@ bool MIRAParameters::setAlignGapPenaltyLevel(const string & gplevels, std::strin
   }
   }
 }
-*/
+
+void MIRAParameters::setAlignMaxCutoff(uint32 mco)
+{
+  mp_align_params.al_max_cutoff=mco;
+}
+void MIRAParameters::setAlignMinScore(uint32 ms)
+{
+  mp_align_params.al_min_score=ms;
+}
+void MIRAParameters::setAlignMinRelScore(uint32 mrs)
+{
+  mp_align_params.al_min_relscore=mrs;
+}
+void MIRAParameters::setAlignMinOverlap(uint32 mo)
+{
+  mp_align_params.al_min_overlap=mo;
+}
+void MIRAParameters::setAlignBandwidthInPercent(uint32 bip)
+{
+  mp_align_params.al_kpercent=bip;
+}
+void MIRAParameters::setAlignBandwidthMin(uint32 bm)
+{
+  mp_align_params.al_kmin=bm;
+}
+void MIRAParameters::setAlignBandwidthMax(uint32 bm)
+{
+  mp_align_params.al_kmax=bm;
+}
+
+
+//void MIRAParameters::setAssemblyPatternLength(uint32 pl)
+//{
+//  mp_assembly_params.as_pattern_length=pl;
+//}
+//
+//void MIRAParameters::setAssemblyNumEndErrors(uint32 nee)
+//{
+//  mp_assembly_params.as_num_end_errors=nee;
+//}
+//
+//void MIRAParameters::setAssemblyNumMiddleErrors(uint32 nme)
+//{
+//  mp_assembly_params.as_num_middle_errors=nme;
+//}
+//
+//void MIRAParameters::setAssemblyNumMiddleRuns(uint32 nmr)
+//{
+//  mp_assembly_params.as_num_middle_runs=nmr;
+//}
+
+
+void MIRAParameters::setAssemblyUseTemplateInformation(bool b)
+{
+  mp_pathfinder_params.paf_use_template_information=b;
+  mp_contig_params.con_use_template_information=b;
+}
+
+void MIRAParameters::setEditAutomaticContigEditing(bool b)
+{
+  mp_edit_params.ed_automatic_contic_editing=b;
+}
+
+void MIRAParameters::setEditStrictEditingMode(bool b)
+{
+  mp_edit_params.ed_strict_editing_mode=b;
+}
+
+void MIRAParameters::setEditConfirmationThreshold(uint32 r)
+{
+  mp_edit_params.ed_confirmation_threshold=r;
+}
+
+void MIRAParameters::setAssemblyPutAssembledWithMIRATags(bool b)
+{
+  mp_assembly_params.as_put_asswithmira_tags=b;
+}
+
+void MIRAParameters::setAssemblyReadExtension(bool b)
+{
+  mp_assembly_params.as_use_read_extension=b;
+}
+
+void MIRAParameters::setAssemblyClipPossibleVectors(bool b)
+{
+  mp_assembly_params.as_clip_possible_vectors=b;
+}
+
+void MIRAParameters::setAssemblyLoadStrainData(bool b)
+{
+  mp_assembly_params.as_loadstraindata=b;
+}
+
+void MIRAParameters::setAssemblyNumRMBBreakLoops(int32 i)
+{
+  mp_assembly_params.as_numrmbbreakloops=i;
+}
+
+void MIRAParameters::setAssemblyStartBackboneUsageInPass(int32 i)
+{
+  mp_assembly_params.as_startbackboneusage_inpass=i;
+}
+
+void MIRAParameters::setAssemblyLoadBackbone(bool b)
+{
+  mp_assembly_params.as_loadbackbone=b;
+}
+
+void MIRAParameters::setAssemblyNumPasses(int32 i)
+{
+  mp_assembly_params.as_numpasses=i;
+}
+
+void MIRAParameters::setAssemblyMarkRepeats(bool b)
+{
+  mp_assembly_params.as_mark_repeats=b;
+}
+
+void MIRAParameters::setAssemblyMinLength(uint32 r)
+{
+  mp_assembly_params.as_minimum_readlength=r;
+}
+
+void MIRAParameters::setAssemblyInfileWhich(string & iw)
+{
+  mp_assembly_params.as_infile_which=iw;
+}
+
+void MIRAParameters::setAssemblyLogUnusedIDs( const string & s)
+{
+  mp_assembly_params.as_tmpf_unused_ids=s;
+}
+
+void MIRAParameters::setAssemblyLogADS( const string & s)
+{
+  mp_assembly_params.as_tmpf_ads=s;
+}
+
+//void MIRAParameters::setAssemblyProjectName( const string & s)
+//{
+//  mp_assembly_params.as_projectname=s;
+//  generateProjectNames();
+//}
+
+void MIRAParameters::setAssemblyInfileFOFNEXP( const string & s)
+{
+  mp_assembly_params.as_infile_FOFNEXP=s;
+}
+
+void MIRAParameters::setAssemblyInfileFASTA( const string & s)
+{
+  mp_assembly_params.as_infile_FASTA=s;
+}
+void MIRAParameters::setAssemblyInfileFASTAQUAL( const string & s)
+{
+  mp_assembly_params.as_infile_FASTAQUAL=s;
+}
+
+void MIRAParameters::setAssemblyInfileCAF( const string & s)
+{
+  mp_assembly_params.as_infile_CAF=s;
+}
+
+void MIRAParameters::setAssemblyInfileStrainData( const string & s)
+{
+  mp_assembly_params.as_infile_straindata=s;
+}
+void MIRAParameters::setAssemblyOutfileCAF( const string & s)
+{
+  mp_assembly_params.as_outfile_CAF=s;
+}
+void MIRAParameters::setAssemblyOutdirGAP4DA( const string & s)
+{
+  mp_assembly_params.as_outdir_GAP4DA=s;
+}
+void MIRAParameters::setAssemblyFASTQQualOffset(base_quality_t b)
+{
+  mp_assembly_params.as_fastq_qualoffset=b;
+}
+
+
+
 
 
 void MIRAParameters::loadParams(const string & pfile, vector<MIRAParameters> & Pv)
@@ -2324,20 +2625,20 @@ void MIRAParameters::loadParams(const string & pfile, vector<MIRAParameters> & P
   if(!fin){
     MIRANOTIFY(Notify::FATAL, "File not found: " << pfile);
   }
-
-  parse(fin, Pv, false);
+  
+  parse(fin, Pv, NULL);
 
   fin.close();
 
   MP_loadfilename.pop_back();
 
-  Pv[0].consistencyCheck(true);
+  Pv[0].consistencyCheck();
 
   FUNCEND();
   return;
 }
 
-void MIRAParameters::parse(int argc, char **argv, vector<MIRAParameters> & Pv, bool verbose)
+void MIRAParameters::parse(int argc, char **argv, vector<MIRAParameters> & Pv)
 {
   stringstream tss;
 
@@ -2349,22 +2650,22 @@ void MIRAParameters::parse(int argc, char **argv, vector<MIRAParameters> & Pv, b
   }
   cout << "\n\n";
 
-  parse(tss, Pv, verbose);
+  parse(tss, Pv, NULL);
 }
 
-void MIRAParameters::parse(const char * params, vector<MIRAParameters> & Pv, bool verbose)
+void MIRAParameters::parse(const char * params, vector<MIRAParameters> & Pv)
 {
   stringstream tss;
   tss << params;
-  parse(tss, Pv, verbose);
+  parse(tss, Pv, NULL);
 }
 
-void MIRAParameters::parseQuickmode(const char * params, const char * qm, vector<MIRAParameters> & Pv, bool verbose)
+void MIRAParameters::parseQuickmode(const char * params, const char * qm, vector<MIRAParameters> & Pv, bool verbose,MIRAParameters * mp)
 {
   stringstream tss;
 
   //verbose=true;
-
+  
   if(verbose){
     if(strlen(qm)>0) {
       cout << "Using quickmode switch " << qm << " : ";
@@ -2372,15 +2673,15 @@ void MIRAParameters::parseQuickmode(const char * params, const char * qm, vector
     cout << params << endl;
   }
   tss << params;
-  parse(tss, Pv, verbose);
+  parse(tss, Pv, mp);
 }
 
-void MIRAParameters::parseQuickmodeNoTechSettingsChange(const char * params, const char * qm, vector<MIRAParameters> & Pv, bool verbose)
+void MIRAParameters::parseQuickmodeNoTechSettingsChange(const char * params, const char * qm, vector<MIRAParameters> & Pv, bool verbose,MIRAParameters * mp)
 {
   vector<bool> save;
-  saveParsedSettingsValues(Pv, save);
-  parseQuickmode(params, qm, Pv, verbose);
-  restoreParsedSettingsValues(Pv, save);
+  saveParsedSettingsValues(Pv, mp, save);
+  parseQuickmode(params, qm, Pv, verbose, mp);
+  restoreParsedSettingsValues(Pv, mp, save);
 }
 
 int32 MIRAParameters::gimmeAnInt(FlexLexer * lexer, stringstream & errstream)
@@ -2412,10 +2713,10 @@ int32 MIRAParameters::getFixedStringMode(FlexLexer * lexer, stringstream & errst
   string currenttoken=lexer->YYText();
   int32 tmp=lexer->yylex();
   if(tmp==MP_UNRECOGNISED_STRING){
-    errstream << "* Parameter section: '" << MP_currentparametersection << "'\t\tToken '" << currenttoken << "'\n*\tNon recognised string '" << lexer->YYText() << "', probably expected something\n*\tlike yes|no|on|off|true|false|y|n|t|f or other fixed strings.\n\n";
+    errstream << "* Parameter section: '" << MP_currentparametersection << "'\t\tToken '" << currenttoken << "'\n*\tNon recognised string '" << lexer->YYText() << "', probably expected something\n*\tlike yes|no|on|off|1|0 or other fixed strings.\n\n";
     MP_errorinparams=true;
   }
-  CEBUG("\t\tFixed string: " << lexer->YYText() << " -> " << tmp << endl);
+  CEBUG("\t\tFixed string: " << lexer->YYText() << endl);
   return tmp;
 }
 
@@ -2451,38 +2752,45 @@ void MIRAParameters::checkNONCOMMON(const string & currentst, FlexLexer * lexer,
 }
 
 
-static const string noclipping_string = "-CL:pvlc=no:qc=no:bsqc=no:mbc=no:lccf=no:lccb=no:emlc=no:emrc=no:c3pp=no:cpat=no:mqtfer=0:ckar=no:rkm=no:cbse=no";
-static const string noquality_string = "-LR:wqf=no -AS:epoq=no -CL:qc=no:bsqc=no";
+static const string noclipping_string = "-CL:msvs=no:pvlc=no:qc=no:bsqc=no:mbc=no:lcc=no:emlc=no:emrc=no:c3pp=no:cpat=no:mqtfer=0:ckar=no";
+static const string noquality_string = "-LR:wqf=no -AS:bdq=20:epoq=no -CL:qc=no:bsqc=no";
 
 
 // parses either into MIRAParameters Pv vector
-//  or into single MIRAParameters object
-void MIRAParameters::parse(istream & is, vector<MIRAParameters> & Pv, bool verbose)
+//  or into single MIRAParameters object 
+void MIRAParameters::parse(istream & is, vector<MIRAParameters> & Pv, MIRAParameters * singlemp)
 {
-  FUNCSTART("void MIRAParameters::parse(istream & is, vector<MIRAParameters> & Pv)");
+  FUNCSTART("void MIRAParameters::parse(istream & is, vector<MIRAParameters> & Pv, MIRAParameters * singlemp)");
 
   stringstream errstream;
+
   FlexLexer* lexer = new MPFlexLexer(&is);
 
+  MP_errorinparams=false;
+
   string currentseqtypesettings="COMMON_SETTINGS";
 
-  MP_errorinparams=false;
   MP_currentparametersection="(none)";
 
   MIRAParameters * actpar;
+
   if(!Pv.empty()){
-    actpar=&Pv[ReadGroupLib::SEQTYPE_SANGER];
+    actpar=&Pv[Read::SEQTYPE_SANGER];
+  }else if(singlemp != NULL){
+    actpar=singlemp;
   }else{
     MIRANOTIFY(Notify::INTERNAL, "No parameter object to parse into? Not good.");
   }
 
+  actpar->MP_parsedsomesettings=true;
+
   // vector to hold quickswitch --job definitions
   vector<vector<uint32> > jobdefs(4);
 
   int yyretcode=-1;
   while(yyretcode!=0){
     yyretcode=lexer->yylex();
-    CEBUG("******: " << currentseqtypesettings << " " << yyretcode << "\t" << lexer->YYText() << endl);
+    CEBUG("******: " << yyretcode << "\t" << lexer->YYText() << endl);
     switch(yyretcode){
     case 0: {break;}                              // do nothing, eof
     case MP_PARSING_SECTIONCHANGE: {
@@ -2493,54 +2801,69 @@ void MIRAParameters::parse(istream & is, vector<MIRAParameters> & Pv, bool verbo
       MP_currentparametersection="(none)";
       break;
     }
-    case MP_as_numthreads:{
+    case MP_as_projectname: {
       checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_assembly_params.as_numthreads=gimmeAnInt(lexer,errstream);
-      if(actpar->mp_assembly_params.as_numthreads==0){
-	actpar->mp_assembly_params.as_numthreads=MachineInfo::getCoresTotal();
-	if(actpar->mp_assembly_params.as_numthreads==0) actpar->mp_assembly_params.as_numthreads=2;
+      if(lexer->YYText()==NULL){
+	errstream << "ERROR Projectname: projectname not found?\n";
+	MP_errorinparams=true;
+	break;
       }
-      actpar->mp_skim_params.sk_numthreads=actpar->mp_assembly_params.as_numthreads;
+      Pv[0].mp_assembly_params.as_projectname_in=lexer->YYText();
+      Pv[0].mp_assembly_params.as_projectname_out=lexer->YYText();
+      generateProjectNames(Pv);
       break;
     }
-    case MP_as_automemmanagement:{
+    case MP_as_projectname_in: {
       checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_assembly_params.as_automemmanagement=getFixedStringMode(lexer,errstream);
+      if(lexer->YYText()==NULL){
+	errstream << "ERROR Projectname in: projectname not found?\n";
+	MP_errorinparams=true;
+	break;
+      }
+      Pv[0].mp_assembly_params.as_projectname_in=lexer->YYText();
+      generateProjectInNames(Pv);
       break;
     }
-    case MP_as_amm_keeppercentfree:{
+    case MP_as_projectname_out: {
       checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_assembly_params.as_amm_keeppercentfree=gimmeAnInt(lexer,errstream);
+      if(lexer->YYText()==NULL){
+	errstream << "ERROR Projectname out: projectname not found?\n";
+	MP_errorinparams=true;
+	break;
+      }
+      Pv[0].mp_assembly_params.as_projectname_out=lexer->YYText();
+      generateProjectOutNames(Pv);
       break;
     }
-    case MP_as_amm_maxprocesssize:{
+    case MP_as_numthreads:{
       checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_assembly_params.as_amm_maxprocesssize=gimmeAnInt(lexer,errstream);
+      actpar->mp_assembly_params.as_numthreads=gimmeAnInt(lexer,errstream);
+      actpar->mp_skim_params.sk_numthreads=actpar->mp_assembly_params.as_numthreads;
       break;
     }
-    case MP_ed_sdbg_readedit:{
+    case MP_as_automemmanagement:{
       checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_edit_params.ed_sdbg_readedit=getFixedStringMode(lexer,errstream);
+      actpar->mp_assembly_params.as_automemmanagement=getFixedStringMode(lexer,errstream);
       break;
     }
-    case MP_ed_mira_automatic_contig_editing:{
+    case MP_as_amm_keeppercentfree:{
       checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_edit_params.ed_mira_automatic_contic_editing=getFixedStringMode(lexer,errstream);
+      actpar->mp_assembly_params.as_amm_keeppercentfree=gimmeAnInt(lexer,errstream);
       break;
     }
-    case MP_ed_kmer_singlets:{
+    case MP_as_amm_maxprocesssize:{
       checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_edit_params.ed_kmer_singlets=getFixedStringMode(lexer,errstream);
+      actpar->mp_assembly_params.as_amm_maxprocesssize=gimmeAnInt(lexer,errstream);
       break;
     }
-    case MP_ed_homopolymer_overcalls:{
+    case MP_ed_automatic_contig_editing:{
       checkNONCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_edit_params.ed_homopolymer_overcalls=getFixedStringMode(lexer,errstream);
+      actpar->mp_edit_params.ed_automatic_contic_editing=getFixedStringMode(lexer,errstream);
       break;
     }
     case MP_ed_strict:{
       checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_edit_params.ed_strict_editing_mode=getFixedStringMode(lexer,errstream);
+      actpar->mp_edit_params.ed_strict_editing_mode=getFixedStringMode(lexer,errstream);;
       break;
     }
     case MP_ed_confirmation_threshold:{
@@ -2553,124 +2876,83 @@ void MIRAParameters::parse(istream & is, vector<MIRAParameters> & Pv, bool verbo
       actpar->mp_special_params.sp_est_startstep=gimmeAnInt(lexer,errstream);
       break;
     }
-    case MP_nw_check_nfs:{
+    case MP_mi_stoponnfs:{
       checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_nagandwarn_params.nw_check_nfs=getFixedStringMode(lexer,errstream);
+      actpar->mp_special_params.mi_stop_on_nfs=getFixedStringMode(lexer,errstream);
       break;
     }
-    case MP_nw_check_multipassmapping:{
+    case MP_mi_extendedlog:{
       checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_nagandwarn_params.nw_check_multipassmapping=getFixedStringMode(lexer,errstream);
+      actpar->mp_special_params.mi_extended_log=getFixedStringMode(lexer,errstream);
       break;
     }
-    case MP_nw_check_templateproblems:{
+    case MP_mi_stop_maxreadnamelength:{
       checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_nagandwarn_params.nw_check_templateproblems=getFixedStringMode(lexer,errstream);
+      actpar->mp_special_params.mi_stop_readnamelength=gimmeAnInt(lexer,errstream);
       break;
     }
-    case MP_nw_check_duplicatereadnames:{
+    case MP_mi_as_largecontigsize:{
       checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_nagandwarn_params.nw_check_duplicatereadnames=getFixedStringMode(lexer,errstream);
+      actpar->mp_special_params.mi_as_largecontigsize=gimmeAnInt(lexer,errstream);
       break;
     }
-    case MP_nw_check_readnamesra:{
+    case MP_mi_as_largecontigsize4stats:{
       checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_nagandwarn_params.nw_check_readnamesra=getFixedStringMode(lexer,errstream);
+      actpar->mp_special_params.mi_as_largecontigsize4stats=gimmeAnInt(lexer,errstream);
       break;
     }
-    case MP_nw_check_maxreadnamelength:{
-      checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_nagandwarn_params.nw_check_maxreadnamelength=getFixedStringMode(lexer,errstream);
+    case MP_as_load_sequencedata:{
+      checkNONCOMMON(currentseqtypesettings, lexer, errstream);
+      actpar->mp_assembly_params.as_load_sequencedata=getFixedStringMode(lexer,errstream);
       break;
     }
-    case MP_nw_check_mrnlvalue:{
-      checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_nagandwarn_params.nw_check_mrnlvalue=gimmeAnInt(lexer,errstream);
+    case MP_as_infile_loadjob:{
+      checkNONCOMMON(currentseqtypesettings, lexer, errstream);
+      if(lexer->YYText()==NULL){
+	errstream << "ERROR file type not found?\n";
+	MP_errorinparams=true;
+	break;
+      }
+      actpar->mp_assembly_params.as_infile_which=lexer->YYText();
+      std::transform(actpar->mp_assembly_params.as_infile_which.begin(),
+		     actpar->mp_assembly_params.as_infile_which.end(),
+		     actpar->mp_assembly_params.as_infile_which.begin(), 
+		     (int(*)(int))std::tolower); // ugly
       break;
     }
-    case MP_nw_check_coverage:{
-      checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_nagandwarn_params.nw_check_coverage=getFixedStringMode(lexer,errstream);
+    case MP_as_readnaming_scheme:{
+      checkNONCOMMON(currentseqtypesettings, lexer, errstream);
+      actpar->mp_assembly_params.as_readnaming_scheme=getFixedStringMode(lexer,errstream);
       break;
     }
-    case MP_nw_check_covvalue:{
+    case MP_as_external_quality:{
       checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_nagandwarn_params.nw_check_covvalue=gimmeAnInt(lexer,errstream);
+      actpar->mp_assembly_params.as_external_qual=getFixedStringMode(lexer,errstream);
       break;
     }
-    case MP_mi_extendedlog:{
-      checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_special_params.mi_extended_log=getFixedStringMode(lexer,errstream);
+    case MP_as_extend_reads:{
+      checkNONCOMMON(currentseqtypesettings, lexer, errstream);
+      actpar->mp_assembly_params.as_use_read_extension=getFixedStringMode(lexer,errstream);
       break;
     }
-    case MP_mi_iknowwhatido:{
+    case MP_as_external_quality_override:{
       checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_special_params.mi_iknowwhatido=getFixedStringMode(lexer,errstream);
+      actpar->mp_assembly_params.as_external_qual_override=getFixedStringMode(lexer,errstream);
       break;
     }
-    case MP_mi_as_largecontigsize:{
+    case MP_as_discard_read_on_eq_error:{
       checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_special_params.mi_as_largecontigsize=gimmeAnInt(lexer,errstream);
+      actpar->mp_assembly_params.as_discard_read_on_eq_error=getFixedStringMode(lexer,errstream);
       break;
     }
-    case MP_mi_as_largecontigsize4stats:{
+    case MP_as_cleanup_tmp_files:{
       checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_special_params.mi_as_largecontigsize4stats=gimmeAnInt(lexer,errstream);
+      actpar->mp_assembly_params.as_cleanup_tmpfiles=getFixedStringMode(lexer,errstream);
       break;
     }
-    case MP_mi_extra_flag1:{
-      checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_special_params.mi_extra_flag1=getFixedStringMode(lexer,errstream);
-      break;
-    }
-    case MP_mi_extra_flag2:{
-      checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_special_params.mi_extra_flag2=getFixedStringMode(lexer,errstream);
-      break;
-    }
-    case MP_mi_extra_flag3:{
-      checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_special_params.mi_extra_flag3=getFixedStringMode(lexer,errstream);
-      break;
-    }
-    case MP_as_kmerseries:{
-      checkCOMMON(currentseqtypesettings, lexer, errstream);
-      int32 tmp=lexer->yylex();
-      if(lexer->YYText()==nullptr){
-	errstream << "ERROR -AS:kmerseries: ahum?\n";
-	MP_errorinparams=true;
-	break;
-      }
-      actpar->mp_assembly_params.as_user_kmerseries=lexer->YYText();
-      actpar->mp_assembly_params.as_bphseries.clear();
-
-      boost::char_separator<char> separator(",");
-      boost::tokenizer<boost::char_separator<char> > tok(actpar->mp_assembly_params.as_user_kmerseries,separator);
-      for(auto & te : tok){
-	string tmps(te);
-	boost::trim(tmps);
-	int64 tmp=atoi(tmps.c_str());
-	if(tmp<=0){
-	  errstream << "ERROR -AS:kmerseries: " << actpar->mp_assembly_params.as_user_kmerseries << "\n" << tmps << " is <= 0. kmer values must be >0\n";
-	  MP_errorinparams=true;
-	  break;
-	}
-	actpar->mp_assembly_params.as_bphseries.push_back(static_cast<uint32>(tmp));
-      }
-      if(!actpar->mp_assembly_params.as_bphseries.empty()){
-	actpar->mp_assembly_params.as_numpasses=0;
-      }
-
-      break;
-    }
-    case MP_as_extend_reads:{
-      checkNONCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_assembly_params.as_use_read_extension=getFixedStringMode(lexer,errstream);
-      break;
-    }
-    case MP_as_cleanup_tmp_files:{
-      checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_assembly_params.as_cleanup_tmpfiles=getFixedStringMode(lexer,errstream);
+    case MP_as_clip_mergessahavectorscreen:{
+      checkNONCOMMON(currentseqtypesettings, lexer, errstream);
+      actpar->mp_assembly_params.as_clip_mergessahavectorscreen=getFixedStringMode(lexer,errstream);
       break;
     }
     case MP_as_clip_ssahamerge_gapsize:{
@@ -2798,29 +3080,9 @@ void MIRAParameters::parse(istream & is, vector<MIRAParameters> & Pv, bool verbo
       actpar->mp_assembly_params.as_clip_maskedbase_maxendgap=gimmeAnInt(lexer,errstream);
       break;
     }
-    case MP_as_clip_lowercase_front: {
-      checkNONCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_assembly_params.as_clip_lowercase_front=getFixedStringMode(lexer,errstream);
-      break;
-    }
-    case MP_as_clip_lowercase_back: {
+    case MP_as_clip_lowercase: {
       checkNONCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_assembly_params.as_clip_lowercase_back=getFixedStringMode(lexer,errstream);
-      break;
-    }
-    case MP_as_clip_sdbg_chimeradetection: {
-      checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_assembly_params.as_clip_sdbg_chimeradetection=getFixedStringMode(lexer,errstream);
-      break;
-    }
-    case MP_as_clip_kmer_junkdetection: {
-      checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_assembly_params.as_clip_kmer_junkdetection=getFixedStringMode(lexer,errstream);
-      break;
-    }
-    case MP_as_clip_kmer_junkkill: {
-      checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_assembly_params.as_clip_kmer_junkkill=getFixedStringMode(lexer,errstream);
+      actpar->mp_assembly_params.as_clip_lowercase=getFixedStringMode(lexer,errstream);
       break;
     }
     case MP_as_clip_skimchimeradetection: {
@@ -2834,7 +3096,7 @@ void MIRAParameters::parse(istream & is, vector<MIRAParameters> & Pv, bool verbo
       break;
     }
     case MP_as_clip_proposeendclips: {
-      checkNONCOMMON(currentseqtypesettings, lexer, errstream);
+      checkCOMMON(currentseqtypesettings, lexer, errstream);
       actpar->mp_assembly_params.as_clip_proposeendclips=getFixedStringMode(lexer,errstream);
       break;
     }
@@ -2848,81 +3110,24 @@ void MIRAParameters::parse(istream & is, vector<MIRAParameters> & Pv, bool verbo
       actpar->mp_assembly_params.as_clip_pec_basesperhash=gimmeAnInt(lexer,errstream);
       break;
     }
-
-    case MP_as_clip_pec_ffreq:{
-      checkNONCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_assembly_params.as_clip_pec_ffreq=gimmeAnInt(lexer,errstream);
-      break;
-    }
-    case MP_as_clip_pec_bfreq:{
-      checkNONCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_assembly_params.as_clip_pec_bfreq=gimmeAnInt(lexer,errstream);
-      break;
-    }
-    case MP_as_clip_pec_mkfr: {
-      checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_assembly_params.as_clip_pec_mkfr=gimmeAnInt(lexer,errstream);
-      break;
-    }
-    case MP_as_clip_pec_mtk: {
-      checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_assembly_params.as_clip_pec_mtk=gimmeAnInt(lexer,errstream);
-      break;
-    }
-    case MP_as_clip_pec_ffr: {
-      checkNONCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_assembly_params.as_clip_pec_ffr=getFixedStringMode(lexer,errstream);
-      break;
-    }
-    case MP_as_clip_pec_bfr: {
-      checkNONCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_assembly_params.as_clip_pec_bfr=getFixedStringMode(lexer,errstream);
-      break;
-    }
-    case MP_as_clip_pec_fcmst: {
-      checkNONCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_assembly_params.as_clip_pec_fcmst=getFixedStringMode(lexer,errstream);
-      break;
-    }
-    case MP_as_clip_pec_bcmst: {
-      checkNONCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_assembly_params.as_clip_pec_bcmst=getFixedStringMode(lexer,errstream);
-      break;
-    }
-    case MP_as_clip_pec_fsalp: {
-      checkNONCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_assembly_params.as_clip_pec_fsalp=getFixedStringMode(lexer,errstream);
-      break;
-    }
-    case MP_as_clip_pec_bsalp: {
-      checkNONCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_assembly_params.as_clip_pec_bsalp=getFixedStringMode(lexer,errstream);
-      break;
-    }
-
     case MP_as_clip_badsolexaends: {
-      checkNONCOMMON(currentseqtypesettings, lexer, errstream);
+      checkCOMMON(currentseqtypesettings, lexer, errstream);
       actpar->mp_assembly_params.as_clip_badsolexaends=getFixedStringMode(lexer,errstream);
       break;
     }
-    case MP_as_search_phix174: {
-      checkNONCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_assembly_params.as_search_phix174=getFixedStringMode(lexer,errstream);
-      break;
-    }
-    case MP_as_filter_phix174: {
+    case MP_as_clip_knownadaptorsright: {
       checkNONCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_assembly_params.as_filter_phix174=getFixedStringMode(lexer,errstream);
+      actpar->mp_assembly_params.as_clip_knownadaptorsright=getFixedStringMode(lexer,errstream);
       break;
     }
-    case MP_as_clip_knownadaptorsright: {
+    case MP_as_basedefaultqual:{
       checkNONCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_assembly_params.as_clip_knownadaptorsright=getFixedStringMode(lexer,errstream);
+      actpar->mp_assembly_params.as_basedefaultqual=gimmeAnInt(lexer,errstream);
       break;
     }
     case MP_con_name_prefix: {
       checkCOMMON(currentseqtypesettings, lexer, errstream);
-      if(lexer->YYText()==nullptr){
+      if(lexer->YYText()==NULL){
 	errstream << "ERROR -CO:name_prefix: string not found?\n";
 	MP_errorinparams=true;
 	break;
@@ -2970,11 +3175,6 @@ void MIRAParameters::parse(istream & is, vector<MIRAParameters> & Pv, bool verbo
       actpar->mp_assembly_params.as_urd_cutoffmultiplier=gimmeADouble(lexer,errstream);
       break;
     }
-    case MP_as_rle_reads:{
-      checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_assembly_params.as_rle_reads=getFixedStringMode(lexer,errstream);
-      break;
-    }
     case MP_as_automatic_repeat_detection:{
       checkCOMMON(currentseqtypesettings, lexer, errstream);
       actpar->mp_assembly_params.as_automatic_repeat_detection=getFixedStringMode(lexer,errstream);
@@ -2995,14 +3195,19 @@ void MIRAParameters::parse(istream & is, vector<MIRAParameters> & Pv, bool verbo
       actpar->mp_assembly_params.as_ard_multicopygrace=gimmeAnInt(lexer,errstream);
       break;
     }
+    case MP_as_keep_long_repeats_separated:{
+      checkCOMMON(currentseqtypesettings, lexer, errstream);
+      actpar->mp_assembly_params.as_keep_long_repeats_separated=getFixedStringMode(lexer,errstream);
+      break;
+    }
     case MP_as_clip_polyat:{
       checkNONCOMMON(currentseqtypesettings, lexer, errstream);
       actpar->mp_assembly_params.as_clip_polyat=getFixedStringMode(lexer,errstream);
       break;
     }
-    case MP_as_clip_polyat_keeppolystretch:{
+    case MP_as_clip_polyat_keeppolysignal:{
       checkNONCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_assembly_params.as_clip_polyat_keeppolystretch=getFixedStringMode(lexer,errstream);
+      actpar->mp_assembly_params.as_clip_polyat_keeppolysignal=getFixedStringMode(lexer,errstream);
       break;
     }
     case MP_as_clip_polyat_len:{
@@ -3041,11 +3246,6 @@ void MIRAParameters::parse(istream & is, vector<MIRAParameters> & Pv, bool verbo
       actpar->mp_assembly_params.as_clip_3ppolybase_maxgap=gimmeAnInt(lexer,errstream);
       break;
     }
-    case MP_as_clipmask_rarekmers:{
-      checkNONCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_assembly_params.as_clipmask_rarekmers=getFixedStringMode(lexer,errstream);
-      break;
-    }
 
     case MP_as_readextension_window_len:{
       checkNONCOMMON(currentseqtypesettings, lexer, errstream);
@@ -3072,22 +3272,62 @@ void MIRAParameters::parse(istream & is, vector<MIRAParameters> & Pv, bool verbo
       actpar->mp_assembly_params.as_filecheck_only=getFixedStringMode(lexer,errstream);
       break;
     }
-    case MP_as_backbone_trimoverhangingreads:{
+    case MP_as_loadstraindata:{
       checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_assembly_params.as_backbone_trimoverhangingreads=getFixedStringMode(lexer,errstream);
+      actpar->mp_assembly_params.as_loadstraindata=getFixedStringMode(lexer,errstream);
+      break;
+    }
+    case MP_as_assign_defaultstrain:{
+      checkNONCOMMON(currentseqtypesettings, lexer, errstream);
+      actpar->mp_assembly_params.as_assigndefaultstrain=getFixedStringMode(lexer,errstream);
       break;
     }
-    case MP_as_backbone_bootstrapnewbackbone:{
+    case MP_as_default_strainname:{
       checkNONCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_assembly_params.as_backbone_bootstrapnewbackbone=getFixedStringMode(lexer,errstream);
+      if(lexer->YYText()==NULL){
+	errstream << "ERROR default strainname: name not found?\n";
+	MP_errorinparams=true;
+	break;
+      }
+      actpar->mp_assembly_params.as_default_strainname=lexer->YYText();
+      break;
+    }
+    case MP_as_loadbackbone:{
+      checkCOMMON(currentseqtypesettings, lexer, errstream);
+      actpar->mp_assembly_params.as_loadbackbone=getFixedStringMode(lexer,errstream);
       break;
     }
     case MP_as_backbone_alsobuildnewcontigs:{
       checkCOMMON(currentseqtypesettings, lexer, errstream);
       actpar->mp_assembly_params.as_backbone_alsobuildnewcontigs=getFixedStringMode(lexer,errstream);
-      if(actpar->mp_assembly_params.as_backbone_alsobuildnewcontigs){
-	errstream << "* Oooooops, sorry, -SB:abnc=on is currently not supported as parameter!\n";
+      break;
+    }
+    //case MP_as_backbone_loadjob:{
+    //  actpar->mp_assembly_params.as_infile_backbone_which=getFixedStringMode(lexer,errstream);
+    //  break;
+    //}
+    case MP_as_backbone_loadjob:{
+      checkCOMMON(currentseqtypesettings, lexer, errstream);
+      if(lexer->YYText()==NULL){
+	errstream << "ERROR backbone file type not found?\n";
+	MP_errorinparams=true;
+	break;
+      }
+      actpar->mp_assembly_params.as_infile_backbone_which=lexer->YYText();
+      std::transform(actpar->mp_assembly_params.as_infile_backbone_which.begin(),
+		     actpar->mp_assembly_params.as_infile_backbone_which.end(),
+		     actpar->mp_assembly_params.as_infile_backbone_which.begin(), 
+		     (int(*)(int))std::tolower); // ugly
+      break;
+    }
+    case MP_as_backbone_strainname: {
+      checkCOMMON(currentseqtypesettings, lexer, errstream);
+      if(lexer->YYText()==NULL){
+	errstream << "ERROR backbone strainname: name not found?\n";
+	MP_errorinparams=true;
+	break;
       }
+      actpar->mp_assembly_params.as_backbone_strainname=lexer->YYText();
       break;
     }
     case MP_as_backbone_strainname_forceforall: {
@@ -3097,7 +3337,7 @@ void MIRAParameters::parse(istream & is, vector<MIRAParameters> & Pv, bool verbo
     }
     case MP_as_backbone_rail_fromstrain: {
       checkCOMMON(currentseqtypesettings, lexer, errstream);
-      if(lexer->YYText()==nullptr){
+      if(lexer->YYText()==NULL){
 	errstream << "ERROR backbone rail from strain: name not found?\n";
 	MP_errorinparams=true;
 	break;
@@ -3125,14 +3365,23 @@ void MIRAParameters::parse(istream & is, vector<MIRAParameters> & Pv, bool verbo
       actpar->mp_assembly_params.as_backbone_outlen=gimmeAnInt(lexer,errstream);
       break;
     }
-    case MP_as_buntify_reads:{
+    case MP_as_backbone_basequals:{
       checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_assembly_params.as_buntify_reads=getFixedStringMode(lexer,errstream);
+      actpar->mp_assembly_params.as_backbone_basequals=gimmeAnInt(lexer,errstream);
+      break;
+    }
+    case MP_as_merge_xmltraceinfo:{
+      actpar->mp_assembly_params.as_mergexmltraceinfo=getFixedStringMode(lexer,errstream);
+      break;
+    }
+    case MP_as_keepcontigsinmem:{
+      checkCOMMON(currentseqtypesettings, lexer, errstream);
+      actpar->mp_assembly_params.as_keepcontigsinmem=getFixedStringMode(lexer,errstream);
       break;
     }
-    case MP_as_preprocess_only:{
+    case MP_as_buntify_reads:{
       checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_assembly_params.as_assemblyjob_preprocessonly=getFixedStringMode(lexer,errstream);
+      actpar->mp_assembly_params.as_buntify_reads=getFixedStringMode(lexer,errstream);
       break;
     }
     case MP_as_savesimplesingletsinproject:{
@@ -3145,6 +3394,16 @@ void MIRAParameters::parse(istream & is, vector<MIRAParameters> & Pv, bool verbo
       actpar->mp_assembly_params.as_savetaggedsingletsinproject=getFixedStringMode(lexer,errstream);
       break;
     }
+    case MP_as_loadSOLEXA_solexa_scores_in_qual_files:{
+      checkCOMMON(currentseqtypesettings, lexer, errstream);
+      actpar->mp_assembly_params.as_loadSOLEXA_solexa_scores_in_qual_files=getFixedStringMode(lexer,errstream);
+      break;
+    }
+    case MP_as_fastq_qualoffset:{
+      checkNONCOMMON(currentseqtypesettings, lexer, errstream);
+      actpar->mp_assembly_params.as_fastq_qualoffset=gimmeAnInt(lexer,errstream);
+      break;
+    }
     case MP_as_enforce_qualsinreads:{
       checkNONCOMMON(currentseqtypesettings, lexer, errstream);
       actpar->mp_assembly_params.as_enforce_qualsinreads=getFixedStringMode(lexer,errstream);
@@ -3167,7 +3426,7 @@ void MIRAParameters::parse(istream & is, vector<MIRAParameters> & Pv, bool verbo
     }
     case MP_con_output_html_gapfill: {
       checkCOMMON(currentseqtypesettings, lexer, errstream);
-      if(lexer->YYText()==nullptr){
+      if(lexer->YYText()==NULL){
 	errstream << "-OUT:hegfc: character not found?\n";
 	MP_errorinparams=true;
 	break;
@@ -3179,7 +3438,7 @@ void MIRAParameters::parse(istream & is, vector<MIRAParameters> & Pv, bool verbo
     }
     case MP_con_output_text_gapfill: {
       checkCOMMON(currentseqtypesettings, lexer, errstream);
-      if(lexer->YYText()==nullptr){
+      if(lexer->YYText()==NULL){
 	errstream << "-OUT:tegfc: character not found?\n";
 	MP_errorinparams=true;
 	break;
@@ -3326,11 +3585,11 @@ void MIRAParameters::parse(istream & is, vector<MIRAParameters> & Pv, bool verbo
       actpar->mp_assembly_params.as_numpasses=gimmeAnInt(lexer,errstream);
       break;
     }
-//    case MP_as_skimeachpass:{
-//      checkCOMMON(currentseqtypesettings, lexer, errstream);
-//      actpar->mp_assembly_params.as_skimeachpass=getFixedStringMode(lexer,errstream);
-//      break;
-//    }
+    case MP_as_skimeachpass:{
+      checkCOMMON(currentseqtypesettings, lexer, errstream);
+      actpar->mp_assembly_params.as_skimeachpass=getFixedStringMode(lexer,errstream);
+      break;
+    }
     case MP_as_numrmbbreakloops:{
       checkCOMMON(currentseqtypesettings, lexer, errstream);
       actpar->mp_assembly_params.as_numrmbbreakloops=gimmeAnInt(lexer,errstream);
@@ -3356,7 +3615,7 @@ void MIRAParameters::parse(istream & is, vector<MIRAParameters> & Pv, bool verbo
 //      if(tmp==MP_UNRECOGNISED_STRING){
 //	errstream << "-AL:emp" << endl;
 //	break;
-//      }
+//      } 
 //      actpar->mp_align_params.ads_extra_mismatch_penalty=(tmp>0);
 //      break;
 //    }
@@ -3368,49 +3627,24 @@ void MIRAParameters::parse(istream & is, vector<MIRAParameters> & Pv, bool verbo
 //      actpar->mp_align_params.ads_emp_maxmismatches=gimmeAnInt(lexer,errstream);
 //      break;
 //    }
-    case MP_ads_enforce_clean_ends:{
-      checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_align_params.ads_enforce_clean_ends=(getFixedStringMode(lexer,errstream)>0);
-      break;
-    }
-    case MP_ads_clean_end_distance:{
-      checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_align_params.ads_clean_end_distance=gimmeAnInt(lexer,errstream);
-      break;
-    }
-    case MP_ads_clean_end_mismatchallowed:{
-      checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_align_params.ads_clean_end_mismatchallowed=gimmeAnInt(lexer,errstream);
-      break;
-    }
     case MP_ads_extra_gap_penalty:{
-      checkCOMMON(currentseqtypesettings, lexer, errstream);
+      checkNONCOMMON(currentseqtypesettings, lexer, errstream);
       actpar->mp_align_params.ads_extra_gap_penalty=(getFixedStringMode(lexer,errstream)>0);
       break;
     }
     case MP_ads_max_gppercent:{
-      checkCOMMON(currentseqtypesettings, lexer, errstream);
+      checkNONCOMMON(currentseqtypesettings, lexer, errstream);
       actpar->mp_align_params.ads_max_gppercent=gimmeAnInt(lexer,errstream);
       break;
     }
-    case MP_ads_gp_functionstring:{
-      checkCOMMON(currentseqtypesettings, lexer, errstream);
-      int32 tmp=lexer->yylex();
-      if(lexer->YYText()==nullptr){
-	errstream << "ERROR -AL:egpl: ahum?\n";
-	MP_errorinparams=true;
-	break;
-      }
-      MP_errorinparams|=actpar->setAlignGapPenaltyLevel(lexer->YYText(),&errstream);
+    case MP_ads_gp_level:{
+      checkNONCOMMON(currentseqtypesettings, lexer, errstream);
+      actpar->setAlignGapPenaltyLevel(getFixedStringMode(lexer,errstream));
       break;
     }
     case MP_sk_numthreads:{
       checkCOMMON(currentseqtypesettings, lexer, errstream);
       actpar->mp_skim_params.sk_numthreads=gimmeAnInt(lexer,errstream);
-      if(actpar->mp_skim_params.sk_numthreads==0){
-	actpar->mp_skim_params.sk_numthreads=MachineInfo::getCoresTotal();
-	if(actpar->mp_skim_params.sk_numthreads==0) actpar->mp_skim_params.sk_numthreads=2;
-      }
       break;
     }
     case MP_sk_alsoskimrevcomp:{
@@ -3428,16 +3662,6 @@ void MIRAParameters::parse(istream & is, vector<MIRAParameters> & Pv, bool verbo
       actpar->mp_skim_params.sk_basesperhash=gimmeAnInt(lexer,errstream);
       break;
     }
-    case MP_sk_bph_increasestep:{
-      checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_skim_params.sk_bph_increasestep=gimmeAnInt(lexer,errstream);
-      break;
-    }
-    case MP_sk_bph_max:{
-      checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_skim_params.sk_bph_max=gimmeAnInt(lexer,errstream);
-      break;
-    }
     case MP_sk_hashsavestepping:{
       checkCOMMON(currentseqtypesettings, lexer, errstream);
       actpar->mp_skim_params.sk_hashsavestepping=gimmeAnInt(lexer,errstream);
@@ -3462,84 +3686,49 @@ void MIRAParameters::parse(istream & is, vector<MIRAParameters> & Pv, bool verbo
       actpar->mp_skim_params.sk_memcaphitreduction=gimmeAnInt(lexer,errstream);
       break;
     }
-    case MP_sk_filtermegahubs:{
-      checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_skim_params.sk_filtermegahubs=getFixedStringMode(lexer,errstream);
-      break;
-    }
-    case MP_sk_megahubcap:{
-      checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_skim_params.sk_maxmegahubratio=gimmeAnInt(lexer,errstream);
-      break;
-    }
-    case MP_sk_maxmegahubratio:{
-      checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_skim_params.sk_maxmegahubratio=gimmeAnInt(lexer,errstream);
-      break;
-    }
-    case MP_hs_masknastyrepeats:{
-      checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_hashstatistics_params.hs_masknastyrepeats=getFixedStringMode(lexer,errstream);
-      break;
-    }
-    case MP_hs_nastyrepeatratio:{
-      checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_hashstatistics_params.hs_nastyrepeatratio=gimmeAnInt(lexer,errstream);
-      break;
-    }
-    case MP_hs_nastyrepeatcoverage:{
-      checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_hashstatistics_params.hs_nastyrepeatcoverage=gimmeAnInt(lexer,errstream);
-      break;
-    }
-    case MP_hs_repeatlevel_in_infofile:{
-      checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_hashstatistics_params.hs_repeatlevel_in_infofile=gimmeAnInt(lexer,errstream);
-      break;
-    }
-    case MP_hs_freq_covestmin:{
+    case MP_sk_masknastyrepeats:{
       checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_hashstatistics_params.hs_freq_covestmin=gimmeAnInt(lexer,errstream);
+      actpar->mp_skim_params.sk_masknastyrepeats=getFixedStringMode(lexer,errstream);
       break;
     }
-    case MP_hs_freqest_minnormal:{
+    case MP_sk_nastyrepeatratio:{
       checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_hashstatistics_params.hs_freqest_minnormal=gimmeADouble(lexer,errstream);
+      actpar->mp_skim_params.sk_nastyrepeatratio=gimmeAnInt(lexer,errstream);
       break;
     }
-    case MP_hs_freqest_maxnormal:{
+    case MP_sk_repeatlevel_in_infofile:{
       checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_hashstatistics_params.hs_freqest_maxnormal=gimmeADouble(lexer,errstream);
+      actpar->mp_skim_params.sk_repeatlevel_in_infofile=gimmeAnInt(lexer,errstream);
       break;
     }
-    case MP_hs_freqest_repeat:{
+    case MP_sk_freqest_minnormal:{
       checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_hashstatistics_params.hs_freqest_repeat=gimmeADouble(lexer,errstream);
+      actpar->mp_skim_params.sk_freqest_minnormal=gimmeADouble(lexer,errstream);
       break;
     }
-    case MP_hs_freqest_heavyrepeat:{
+    case MP_sk_freqest_maxnormal:{
       checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_hashstatistics_params.hs_freqest_heavyrepeat=gimmeADouble(lexer,errstream);
+      actpar->mp_skim_params.sk_freqest_maxnormal=gimmeADouble(lexer,errstream);
       break;
     }
-    case MP_hs_freqest_crazyrepeat:{
+    case MP_sk_freqest_repeat:{
       checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_hashstatistics_params.hs_freqest_crazyrepeat=gimmeADouble(lexer,errstream);
+      actpar->mp_skim_params.sk_freqest_repeat=gimmeADouble(lexer,errstream);
       break;
     }
-    case MP_hs_applydigitalnormalisation:{
+    case MP_sk_freqest_heavyrepeat:{
       checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_hashstatistics_params.hs_apply_digitalnormalisation=getFixedStringMode(lexer,errstream);
+      actpar->mp_skim_params.sk_freqest_heavyrepeat=gimmeADouble(lexer,errstream);
       break;
     }
-    case MP_hs_million_hashes_per_buffer:{
+    case MP_sk_freqest_crazyrepeat:{
       checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_hashstatistics_params.hs_million_hashes_per_buffer=gimmeAnInt(lexer,errstream);
+      actpar->mp_skim_params.sk_freqest_crazyrepeat=gimmeADouble(lexer,errstream);
       break;
     }
-    case MP_hs_rare_kmer_final_kill:{
+    case MP_sk_maxmegahubratio:{
       checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_hashstatistics_params.hs_rare_kmer_final_kill=gimmeAnInt(lexer,errstream);
+      actpar->mp_skim_params.sk_maxmegahubratio=gimmeAnInt(lexer,errstream);
       break;
     }
     case MP_al_bip:{
@@ -3580,6 +3769,11 @@ void MIRAParameters::parse(istream & is, vector<MIRAParameters> & Pv, bool verbo
       }
       break;
     }
+    case MP_as_use_template_information:{
+      checkNONCOMMON(currentseqtypesettings, lexer, errstream);
+      actpar->setAssemblyUseTemplateInformation(getFixedStringMode(lexer,errstream));
+      break;
+    }
     case MP_con_analyse_mode:{
       checkCOMMON(currentseqtypesettings, lexer, errstream);
       actpar->mp_contig_params.con_danger_analyse_mode=getFixedStringMode(lexer,errstream);
@@ -3590,11 +3784,6 @@ void MIRAParameters::parse(istream & is, vector<MIRAParameters> & Pv, bool verbo
       actpar->mp_contig_params.con_reject_on_drop_in_relscore=gimmeAnInt(lexer,errstream);
       break;
     }
-    case MP_con_min_relscore:{
-      checkNONCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_contig_params.con_min_relscore=gimmeAnInt(lexer,errstream);
-      break;
-    }
     case MP_con_also_mark_gap_bases:{
       checkNONCOMMON(currentseqtypesettings, lexer, errstream);
       actpar->mp_contig_params.con_also_mark_gap_bases=getFixedStringMode(lexer,errstream);
@@ -3653,19 +3842,34 @@ void MIRAParameters::parse(istream & is, vector<MIRAParameters> & Pv, bool verbo
       actpar->mp_contig_params.con_danger_max_error_rate=gimmeAnInt(lexer,errstream);
       break;
     }
-    case MP_con_force_nonIUPACconsensus:{
-      checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_contig_params.con_force_nonIUPACconsensus=getFixedStringMode(lexer,errstream);
+    case MP_con_insertsize_minimum:{
+      checkNONCOMMON(currentseqtypesettings, lexer, errstream);
+      actpar->mp_contig_params.con_insertsize_minimum=gimmeAnInt(lexer,errstream);
       break;
     }
-    case MP_con_mergeshortreads:{
+    case MP_con_insertsize_maximum:{
       checkNONCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_contig_params.con_mergeshortreads=getFixedStringMode(lexer,errstream);
+      actpar->mp_contig_params.con_insertsize_maximum=gimmeAnInt(lexer,errstream);
       break;
     }
-    case MP_con_msr_maxerrors:{
+    case MP_con_template_build_direction:{
       checkNONCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_contig_params.con_msr_maxerrors=gimmeAnInt(lexer,errstream);
+      actpar->mp_contig_params.con_template_build_direction=gimmeAnInt(lexer,errstream);
+      break;
+    }
+    case MP_con_force_nonIUPACconsensus_perseqtype:{
+      checkNONCOMMON(currentseqtypesettings, lexer, errstream);
+      actpar->mp_contig_params.con_force_nonIUPACconsensus_perseqtype=getFixedStringMode(lexer,errstream);
+      break;
+    }
+    case MP_con_force_nonIUPACconsensus_amongseqtypes:{
+      checkCOMMON(currentseqtypesettings, lexer, errstream);
+      actpar->mp_contig_params.con_force_nonIUPACconsensus_amongseqtypes=getFixedStringMode(lexer,errstream);
+      break;
+    }
+    case MP_con_mergeshortreads:{
+      checkNONCOMMON(currentseqtypesettings, lexer, errstream);
+      actpar->mp_contig_params.con_mergeshortreads=getFixedStringMode(lexer,errstream);
       break;
     }
     case MP_con_msr_keependsunmapped:{
@@ -3676,7 +3880,7 @@ void MIRAParameters::parse(istream & is, vector<MIRAParameters> & Pv, bool verbo
 
     case MP_paf_use_genomic_pathfinder :{
       checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_pathfinder_params.paf_use_genomic_algorithms=getFixedStringMode(lexer,errstream);
+      actpar->setPathfinderuseGenomicAlgorithms(getFixedStringMode(lexer,errstream));
       break;
     }
     case MP_paf_use_emergency_blacklist :{
@@ -3702,7 +3906,7 @@ void MIRAParameters::parse(istream & is, vector<MIRAParameters> & Pv, bool verbo
     case MP_paf_buildtime_inseconds :{
       checkCOMMON(currentseqtypesettings, lexer, errstream);
       actpar->mp_pathfinder_params.paf_max_contig_buildtime=gimmeAnInt(lexer,errstream);
-      actpar->setPathfinderMaxContigTime(actpar->mp_pathfinder_params.paf_max_contig_buildtime);
+      actpar->setPathfinderMaxContigTime(actpar->mp_pathfinder_params.paf_max_contig_buildtime); 
       break;
     }
     case MP_paf_max_startcache_filltime :{
@@ -3745,189 +3949,540 @@ void MIRAParameters::parse(istream & is, vector<MIRAParameters> & Pv, bool verbo
       actpar->mp_pathfinder_params.paf_bbquickoverlap_minlen=gimmeAnInt(lexer,errstream);
       break;
     }
-    case MP_fn_cafout: {
-      if(lexer->YYText()==nullptr){
-	errstream << "ERROR Filename cafout: filename not found?\n";
+
+    case MP_fn_straindatain: {
+      if(lexer->YYText()==NULL){
+	errstream << "ERROR Filename straindatain: filename not found?\n";
 	MP_errorinparams=true;
 	break;
       }
       checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_assembly_params.as_outfile_CAF=lexer->YYText();
+      actpar->mp_assembly_params.as_infile_straindata=lexer->YYText();
       break;
     }
-    case MP_dir_tmp: {
-      if(lexer->YYText()==nullptr){
-	errstream << "ERROR Directory name tmp: name not found?\n";
+    case MP_fn_xmltraceinfoin: {
+      checkNONCOMMON(currentseqtypesettings, lexer, errstream);
+      if(lexer->YYText()==NULL){
+	errstream << "ERROR Filename xmltraceinfoin: filename not found?\n";
 	MP_errorinparams=true;
 	break;
       }
-      checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_directory_params.dir_tmp=lexer->YYText();
+      actpar->mp_assembly_params.as_infile_xmltraceinfo=lexer->YYText();
       break;
     }
-    case MP_dir_tmp_redirectedto: {
-      if(lexer->YYText()==nullptr){
-	errstream << "ERROR Directory name tmp_redirected_to: name not found?\n";
+    case MP_fn_ssahavectorscreenin: {
+      if(lexer->YYText()==NULL){
+	errstream << "ERROR Filename SSAHA2 vectorscreenin: filename not found?\n";
 	MP_errorinparams=true;
 	break;
       }
       checkCOMMON(currentseqtypesettings, lexer, errstream);
-      actpar->mp_directory_params.dir_tmp_redirectedto=lexer->YYText();
+      actpar->mp_assembly_params.as_infile_ssahavectorscreen=lexer->YYText();
       break;
     }
-    case MP_quickmode_loadparam: {
-      if(lexer->YYText()==nullptr){
-	errstream << "ERROR --params=: filename not found?\n";
+    case MP_fn_smaltvectorscreenin: {
+      if(lexer->YYText()==NULL){
+	errstream << "ERROR Filename SMALT vectorscreenin: filename not found?\n";
 	MP_errorinparams=true;
 	break;
       }
-      loadParams(lexer->YYText(), Pv);
+      checkCOMMON(currentseqtypesettings, lexer, errstream);
+      actpar->mp_assembly_params.as_infile_smaltvectorscreen=lexer->YYText();
       break;
     }
-#if CPP_READ_SEQTYPE_END != 8
-#error "This code is made for 8 sequencing types, adapt!"
-#endif
-    case MP_quickmode_noquality_all: {
-      string modestring =
-	"\n_SANGER_SETTINGS\n\t    " + noquality_string
-	+ "\n_454_SETTINGS\n\t    " + noquality_string
-	+ "\n_IONTOR_SETTINGS\n\t    " + noquality_string
-	+ "\n_PCBIOHQ_SETTINGS\n\t    " + noquality_string
-	+ "\n_PCBIOLQ_SETTINGS\n\t    " + noquality_string
-	+ "\n_TEXT_SETTINGS\n\t    " + noquality_string
-	+ "\n_SOLEXA_SETTINGS\n\t    " + noquality_string
-	+ "\n_SOLID_SETTINGS\n\t    " + noquality_string;
-
-      parseQuickmodeNoTechSettingsChange(modestring.c_str(), "-noquality", Pv, verbose);
-      if(verbose) cout << "Adjusting -CO:mrpg to a minimum of 3\n";
-      if(!Pv.empty()) {
-	for(uint32 i=0; i<Pv.size(); i++){
-	  if(Pv[i].mp_contig_params.con_minreadspergroup<3) {
-	    Pv[i].mp_contig_params.con_minreadspergroup=3;
-	  }
-	}
-      }else{
-	if(actpar->mp_contig_params.con_minreadspergroup<3) actpar->mp_contig_params.con_minreadspergroup=3;
+    case MP_fn_fastaqualin: {
+      checkNONCOMMON(currentseqtypesettings, lexer, errstream);
+      if(lexer->YYText()==NULL){
+	errstream << "ERROR Filename fastaqualin: filename not found?\n";
+	MP_errorinparams=true;
+	break;
       }
+      actpar->mp_assembly_params.as_infile_FASTAQUAL=lexer->YYText();
       break;
-
-
+    }
+    case MP_fn_fastain: {
+      checkNONCOMMON(currentseqtypesettings, lexer, errstream);
+      if(lexer->YYText()==NULL){
+	errstream << "ERROR Filename fastain: filename not found?\n";
+	MP_errorinparams=true;
+	break;
+      }
+      actpar->mp_assembly_params.as_infile_FASTA=lexer->YYText();
       break;
     }
-#if CPP_READ_SEQTYPE_END != 8
-#error "This code is made for 8 sequencing types, adapt!"
-#endif
-    case MP_quickmode_noclipping_all: {
-      string modestring =
-	"\n_SANGER_SETTINGS\n\t    " + noclipping_string
-	+ "\n_454_SETTINGS\n\t    " + noclipping_string
-	+ "\n_IONTOR_SETTINGS\n\t    " + noclipping_string
-	+ "\n_PCBIOHQ_SETTINGS\n\t    " + noclipping_string
-	+ "\n_PCBIOLQ_SETTINGS\n\t    " + noclipping_string
-	+ "\n_TEXT_SETTINGS\n\t    " + noclipping_string
-	+ "\n_SOLEXA_SETTINGS\n\t    " + noclipping_string
-	+ "\n_SOLID_SETTINGS\n\t    " + noclipping_string
-	+ "\nCOMMON_SETTINGS -CL:ascdc=no:asjdc=no:gbcdc=yes:kjd=yes:kjck=no ";
-
-      parseQuickmodeNoTechSettingsChange(modestring.c_str(), "-noclipping", Pv, verbose);
+    case MP_fn_fastqin: {
+      checkNONCOMMON(currentseqtypesettings, lexer, errstream);
+      if(lexer->YYText()==NULL){
+	errstream << "ERROR Filename fastqin: filename not found?\n";
+	MP_errorinparams=true;
+	break;
+      }
+      actpar->mp_assembly_params.as_infile_FASTQ=lexer->YYText();
       break;
     }
-#if CPP_READ_SEQTYPE_END != 8
-#error "This code is made for 8 sequencing types, adapt!"
-#endif
-    case MP_quickmode_noclipping_sanger: {
-      string modestring =
-	"\n_SANGER_SETTINGS\n\t    " + noclipping_string
-	+ "\nCOMMON_SETTINGS -CL:ascdc=no:asjdc=no:gbcdc=yes:kjd=yes:kjck=no ";
-
-      parseQuickmodeNoTechSettingsChange(modestring.c_str(), "-noclipping", Pv, verbose);
+    case MP_fn_phdin: {
+      if(lexer->YYText()==NULL){
+	errstream << "ERROR Filename phdin: filename not found?\n";
+	MP_errorinparams=true;
+	break;
+      }
+      checkCOMMON(currentseqtypesettings, lexer, errstream);
+      actpar->mp_assembly_params.as_infile_PHD=lexer->YYText();
       break;
     }
-    case MP_quickmode_noclipping_454: {
+    case MP_fn_backbonein: {
+      if(lexer->YYText()==NULL){
+	errstream << "ERROR Filename cafin: filename not found?\n";
+	MP_errorinparams=true;
+	break;
+      }
+      checkCOMMON(currentseqtypesettings, lexer, errstream);
+      actpar->mp_assembly_params.as_infile_backbone_MAF=lexer->YYText();
+      actpar->mp_assembly_params.as_infile_backbone_CAF=lexer->YYText();
+      actpar->mp_assembly_params.as_infile_backbone_GBF=lexer->YYText();
+      actpar->mp_assembly_params.as_infile_backbone_GFF3=lexer->YYText();
+      actpar->mp_assembly_params.as_infile_backbone_FASTA=lexer->YYText();
+      actpar->mp_assembly_params.as_infile_backbone_FASTAQUAL=actpar->mp_assembly_params.as_infile_backbone_FASTA+".qual";
+      break;
+    }
+    case MP_fn_cafin: {
+      if(lexer->YYText()==NULL){
+	errstream << "ERROR Filename cafin: filename not found?\n";
+	MP_errorinparams=true;
+	break;
+      }
+      size_t slen=strlen(lexer->YYText());
+      if(slen<=4
+	 || lexer->YYText()[slen-4]!='.'
+	 || lexer->YYText()[slen-3]!='c'
+	 || lexer->YYText()[slen-2]!='a'
+	 || lexer->YYText()[slen-1]!='f'
+	 ){
+	errstream << "ERROR: Filename cafout: filename does not end in '.caf'\n";
+	MP_errorinparams=true;
+	break;
+      }
+      checkCOMMON(currentseqtypesettings, lexer, errstream);
+      actpar->mp_assembly_params.as_infile_CAF=lexer->YYText();
+      break;
+    }
+    case MP_fn_cafout: {
+      if(lexer->YYText()==NULL){
+	errstream << "ERROR Filename cafout: filename not found?\n";
+	MP_errorinparams=true;
+	break;
+      }
+      checkCOMMON(currentseqtypesettings, lexer, errstream);
+      actpar->mp_assembly_params.as_outfile_CAF=lexer->YYText();
+      break;
+    }
+    case MP_fn_fofnexpin: {
+      if(lexer->YYText()==NULL){
+	errstream << "ERROR Filename fofnin: filename not found?\n";
+	MP_errorinparams=true;
+	break;
+      }
+      checkCOMMON(currentseqtypesettings, lexer, errstream);
+      actpar->mp_assembly_params.as_infile_FOFNEXP=lexer->YYText();
+      break;
+    }
+    case MP_fn_fofnphdin: {
+      if(lexer->YYText()==NULL){
+	errstream << "ERROR Filename phdin: filename not found?\n";
+	MP_errorinparams=true;
+	break;
+      }
+      checkCOMMON(currentseqtypesettings, lexer, errstream);
+      actpar->mp_assembly_params.as_infile_FOFNPHD=lexer->YYText();
+      break;
+    }
+    case MP_dir_cwd: {
+      if(lexer->YYText()==NULL){
+	errstream << "ERROR Directory name cwd: name not found?\n";
+	MP_errorinparams=true;
+	break;
+      }
+      checkCOMMON(currentseqtypesettings, lexer, errstream);
+      actpar->mp_directory_params.dir_cwd=lexer->YYText();
+      if(!actpar->mp_directory_params.dir_cwd.empty()){
+	int ret=chdir(actpar->mp_directory_params.dir_cwd.c_str());
+	if(ret){
+	  MIRANOTIFY(Notify::FATAL,"Changing working directory to '" << actpar->mp_directory_params.dir_cwd << "' failed, system message is: " << strerror(errno) << endl);
+	}
+      }
+      break;
+    }
+    case MP_dir_tmp: {
+      if(lexer->YYText()==NULL){
+	errstream << "ERROR Directory name tmp: name not found?\n";
+	MP_errorinparams=true;
+	break;
+      }
+      checkCOMMON(currentseqtypesettings, lexer, errstream);
+      actpar->mp_directory_params.dir_tmp=lexer->YYText();
+      break;
+    }
+    case MP_dir_tmp_redirectedto: {
+      if(lexer->YYText()==NULL){
+	errstream << "ERROR Directory name tmp_redirected_to: name not found?\n";
+	MP_errorinparams=true;
+	break;
+      }
+      checkCOMMON(currentseqtypesettings, lexer, errstream);
+      actpar->mp_directory_params.dir_tmp_redirectedto=lexer->YYText();
+      break;
+    }
+    case MP_dir_gap4da: {
+      if(lexer->YYText()==NULL){
+	errstream << "ERROR Directory name tmp: name not found?\n";
+	MP_errorinparams=true;
+	break;
+      }
+      checkCOMMON(currentseqtypesettings, lexer, errstream);
+      actpar->mp_assembly_params.as_outdir_GAP4DA=lexer->YYText();
+      break;
+    }
+    case MP_dir_exp: {
+      if(lexer->YYText()==NULL){
+	errstream << "ERROR Directory name exp: name not found?\n";
+	MP_errorinparams=true;
+	break;
+      }
+      checkCOMMON(currentseqtypesettings, lexer, errstream);
+      actpar->mp_directory_params.dir_exp=lexer->YYText();
+      break;
+    }
+    case MP_dir_scf: {
+      if(lexer->YYText()==NULL){
+	errstream << "ERROR Directory name scf: name not found?\n";
+	MP_errorinparams=true;
+	break;
+      }
+      checkCOMMON(currentseqtypesettings, lexer, errstream);
+      actpar->mp_directory_params.dir_scf=lexer->YYText();
+      break;
+    }
+    case MP_dir_fasta: {
+      if(lexer->YYText()==NULL){
+	errstream << "ERROR Directory name tmp: name not found?\n";
+	MP_errorinparams=true;
+	break;
+      }
+      checkCOMMON(currentseqtypesettings, lexer, errstream);
+      actpar->mp_directory_params.dir_fasta=lexer->YYText();
+      break;
+    }
+    case MP_quickmode_fastaname: {
+      if(lexer->YYText()==NULL){
+	errstream << "ERROR --fasta=: filename not found?\n";
+	MP_errorinparams=true;
+	break;
+      }
+      actpar->mp_assembly_params.as_infile_FASTA=lexer->YYText();
+      actpar->mp_assembly_params.as_infile_FASTAQUAL=actpar->mp_assembly_params.as_infile_FASTA+".qual";
+      if(!Pv.empty()){
+	for(uint32 i=0; i<Pv.size(); i++){
+	  Pv[i].mp_assembly_params.as_infile_FASTA=lexer->YYText();
+	  Pv[i].mp_assembly_params.as_infile_FASTAQUAL=actpar->mp_assembly_params.as_infile_FASTA+".qual";
+	}
+      }
+      // FALL THROUGH!
+    }
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
+#endif
+    case MP_quickmode_fasta: {
+      static const char modestring[] = 
+	"SANGER_SETTINGS -LR:ft=fasta"
+	"\n454_SETTINGS -LR:ft=fasta"
+	"\nIONTOR_SETTINGS -LR:ft=fasta"
+	"\nPACBIO_SETTINGS -LR:ft=fasta"
+	"\nSOLEXA_SETTINGS -LR:ft=fasta"
+	"\nSOLID_SETTINGS -LR:ft=fasta";
+      parseQuickmodeNoTechSettingsChange(modestring, "fasta", Pv,false);
+      break;
+    }
+    case MP_quickmode_fastqname: {
+      if(lexer->YYText()==NULL){
+	errstream << "ERROR --fastq=: filename not found?\n";
+	MP_errorinparams=true;
+	break;
+      }
+      actpar->mp_assembly_params.as_infile_FASTQ=lexer->YYText();
+      if(!Pv.empty()){
+	for(uint32 i=0; i<Pv.size(); i++){
+	  Pv[i].mp_assembly_params.as_infile_FASTQ=lexer->YYText();
+	}
+      }
+      // FALL THROUGH!
+    }
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
+#endif
+    case MP_quickmode_fastq: {
+      static const char modestring[] = 
+	"SANGER_SETTINGS -LR:ft=fastq"
+	"\n454_SETTINGS -LR:ft=fastq"
+	"\nIONTOR_SETTINGS -LR:ft=fastq"
+	"\nPACBIO_SETTINGS -LR:ft=fastq"
+	"\nSOLEXA_SETTINGS -LR:ft=fastq"
+	"\nSOLID_SETTINGS -LR:ft=fastq";
+      parseQuickmodeNoTechSettingsChange(modestring, "fastq", Pv,false);
+      break;
+    }
+    case MP_quickmode_phdname: {
+      if(lexer->YYText()==NULL){
+	errstream << "ERROR --phd=: filename not found?\n";
+	MP_errorinparams=true;
+	break;
+      }
+      checkCOMMON(currentseqtypesettings, lexer, errstream);
+      actpar->mp_assembly_params.as_infile_PHD=lexer->YYText();
+      // FALL THROUGH!
+    }
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
+#endif
+    case MP_quickmode_phd: {
+      static const char modestring[] = 
+	"SANGER_SETTINGS -LR:ft=phd"
+	"\n454_SETTINGS -LR:ft=phd"
+	"\nIONTOR_SETTINGS -LR:ft=phd"
+	"\nPACBIO_SETTINGS -LR:ft=phd"
+	"\nSOLEXA_SETTINGS -LR:ft=phd"
+	"\nSOLID_SETTINGS -LR:ft=phd";
+      parseQuickmodeNoTechSettingsChange(modestring, "phd", Pv);
+      break;
+    }
+    case MP_quickmode_cafname: {
+      if(lexer->YYText()==NULL){
+	errstream << "ERROR --caf=: filename not found?\n";
+	MP_errorinparams=true;
+	break;
+      }
+      actpar->mp_assembly_params.as_infile_CAF=lexer->YYText();
+      // FALL THROUGH!
+    }
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
+#endif
+    case MP_quickmode_caf: {
+      static const char modestring[] = 
+	"SANGER_SETTINGS -LR:ft=caf"
+	"\n454_SETTINGS -LR:ft=caf"
+	"\nIONTOR_SETTINGS -LR:ft=caf"
+	"\nPACBIO_SETTINGS -LR:ft=caf"
+	"\nSOLEXA_SETTINGS -LR:ft=caf"
+	"\nSOLID_SETTINGS -LR:ft=caf";
+      parseQuickmodeNoTechSettingsChange(modestring, "caf", Pv);
+      break;
+    }
+    case MP_quickmode_loadparam: {
+      if(lexer->YYText()==NULL){
+	errstream << "ERROR --params=: filename not found?\n";
+	MP_errorinparams=true;
+	break;
+      }
+      loadParams(lexer->YYText(), Pv);
+      break;
+    }
+    case MP_quickmode_clippinglight: {
+      static const char modestring[] =	
+	"\nSANGER_SETTINGS"
+	"\n\t-CL:pvlc=yes:pvcmla=18:qc=yes:qcmq=20:qcwl=25"
+	"\n\t    mbc=yes:mbcgs=20:mbcmfg=40:mbcmeg=60"
+	"\n\t    emlc=yes:mlcr=15:smlc=20";
+
+      parseQuickmode(modestring, "-clippinglight", Pv);
+      break;
+    }
+    case MP_quickmode_clippingmedium: {
+      static const char modestring[] =	
+	"\nSANGER_SETTINGS"
+	"\n\t-CL:pvlc=yes:pvcmla=18:qc=yes:qcmq=20:qcwl=30"
+	"\n\t    mbc=yes:mbcgs=20:mbcmfg=40:mbcmeg=60"
+	"\n\t    emlc=yes:mlcr=25:smlc=30";
+
+      parseQuickmode(modestring, "-clippingmedium", Pv);
+      break;
+    }
+    case MP_quickmode_clippingheavy: {
+      static const char modestring[] =	
+	"\nSANGER_SETTINGS"
+	"\n\t-CL:pvlc=yes:pvcmla=25:qc=yes:qcmq=25:qcwl=30"
+	"\n\t    mbc=yes:mbcgs=30:mbcmfg=50:mbcmeg=80"
+	"\n\t    emlc=yes:mlcr=35:smlc=40";
+
+      parseQuickmodeNoTechSettingsChange(modestring, "-clippingheavy", Pv);
+      break;
+    }
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
+#endif
+    case MP_quickmode_noquality_all: {
+      string modestring =
+	"\nSANGER_SETTINGS\n\t    " + noquality_string
+	+ "\n454_SETTINGS\n\t    " + noquality_string
+	+ "\nIONTOR_SETTINGS\n\t    " + noquality_string
+	+ "\nPACBIO_SETTINGS\n\t    " + noquality_string
+	+ "\nSOLEXA_SETTINGS\n\t    " + noquality_string
+	+ "\nSOLID_SETTINGS\n\t    " + noquality_string;
+
+      parseQuickmodeNoTechSettingsChange(modestring.c_str(), "-noquality", Pv);
+      cout << "Adjusting -CO:mrpg to a minimum of 3\n";
+      if(!Pv.empty()) {
+	for(uint32 i=0; i<Pv.size(); i++){
+	  if(Pv[i].mp_contig_params.con_minreadspergroup<3) {
+	    Pv[i].mp_contig_params.con_minreadspergroup=3;
+	  }
+	}
+      }else{
+	if(actpar->mp_contig_params.con_minreadspergroup<3) actpar->mp_contig_params.con_minreadspergroup=3;
+      }
+      break;
+
+
+      break;
+    }
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
+#endif
+    case MP_quickmode_noclipping_all: {
       string modestring =
-	"\n_454_SETTINGS\n\t    " + noclipping_string
-	+ "\nCOMMON_SETTINGS -CL:ascdc=no:asjdc=no:gbcdc=yes:kjd=yes:kjck=no ";
+	"\nSANGER_SETTINGS\n\t    " + noclipping_string
+	+ "\n454_SETTINGS\n\t    " + noclipping_string
+	+ "\nIONTOR_SETTINGS\n\t    " + noclipping_string
+	+ "\nPACBIO_SETTINGS\n\t    " + noclipping_string
+	+ "\nSOLEXA_SETTINGS\n\t    " + noclipping_string
+	+ "\nSOLID_SETTINGS\n\t    " + noclipping_string
+	+ "\nCOMMON_SETTINGS -CL:ascdc=no:asjdc=no:cbse=no ";
 
-      parseQuickmodeNoTechSettingsChange(modestring.c_str(), "-noclipping", Pv, verbose);
+      parseQuickmodeNoTechSettingsChange(modestring.c_str(), "-noclipping", Pv);
       break;
     }
-    case MP_quickmode_noclipping_iontor: {
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
+#endif
+    case MP_quickmode_noclipping_sanger: {
       string modestring =
-	"\n_IONTOR_SETTINGS\n\t    " + noclipping_string
-	+ "\nCOMMON_SETTINGS -CL:ascdc=no:asjdc=no:gbcdc=yes:kjd=yes:kjck=no ";
+	"\nSANGER_SETTINGS\n\t    " + noclipping_string
+	+ "\nCOMMON_SETTINGS -CL:ascdc=no:asjdc=no ";
 
-      parseQuickmodeNoTechSettingsChange(modestring.c_str(), "-noclipping", Pv, verbose);
+      parseQuickmodeNoTechSettingsChange(modestring.c_str(), "-noclipping", Pv);
       break;
     }
-    case MP_quickmode_noclipping_pacbiohq: {
+    case MP_quickmode_noclipping_454: {
       string modestring =
-	"\n_PCBIOHQ_SETTINGS\n\t    " + noclipping_string
-	+ "\nCOMMON_SETTINGS -CL:ascdc=no:asjdc=no:gbcdc=yes:kjd=yes:kjck=no ";
+	"\n454_SETTINGS\n\t    " + noclipping_string
+	+ "\nCOMMON_SETTINGS -CL:ascdc=no:asjdc=no ";
 
-      parseQuickmodeNoTechSettingsChange(modestring.c_str(), "-noclipping", Pv, verbose);
+      parseQuickmodeNoTechSettingsChange(modestring.c_str(), "-noclipping", Pv);
       break;
     }
-    case MP_quickmode_noclipping_pacbiolq: {
+    case MP_quickmode_noclipping_iontor: {
       string modestring =
-	"\n_PCBIOLQ_SETTINGS\n\t    " + noclipping_string
-	+ "\nCOMMON_SETTINGS -CL:ascdc=no:asjdc=no:gbcdc=yes:kjd=yes:kjck=no ";
+	"\nIONTOR_SETTINGS\n\t    " + noclipping_string
+	+ "\nCOMMON_SETTINGS -CL:ascdc=no:asjdc=no ";
 
-      parseQuickmodeNoTechSettingsChange(modestring.c_str(), "-noclipping", Pv, verbose);
+      parseQuickmodeNoTechSettingsChange(modestring.c_str(), "-noclipping", Pv);
       break;
     }
-    case MP_quickmode_noclipping_text: {
+    case MP_quickmode_noclipping_pacbio: {
       string modestring =
-	"\n_TEXT_SETTINGS\n\t    " + noclipping_string
-	+ "\nCOMMON_SETTINGS -CL:ascdc=no:asjdc=no:gbcdc=yes:kjd=yes:kjck=no ";
+	"\nPACBIO_SETTINGS\n\t    " + noclipping_string
+	+ "\nCOMMON_SETTINGS -CL:ascdc=no:asjdc=no ";
 
-      parseQuickmodeNoTechSettingsChange(modestring.c_str(), "-noclipping", Pv, verbose);
+      parseQuickmodeNoTechSettingsChange(modestring.c_str(), "-noclipping", Pv);
       break;
     }
     case MP_quickmode_noclipping_solexa: {
       string modestring =
-	"\n_SOLEXA_SETTINGS\n\t    " + noclipping_string
-	+ "\nCOMMON_SETTINGS -CL:ascdc=no:asjdc=no:gbcdc=yes:kjd=yes:kjck=no ";
+	"\nSOLEXA_SETTINGS\n\t    " + noclipping_string
+	+ "\nCOMMON_SETTINGS -CL:ascdc=no:asjdc=no ";
 
-      parseQuickmodeNoTechSettingsChange(modestring.c_str(), "-noclipping", Pv, verbose);
+      parseQuickmodeNoTechSettingsChange(modestring.c_str(), "-noclipping", Pv);
       break;
     }
     case MP_quickmode_noclipping_solid: {
       string modestring =
-	"\n_SOLID_SETTINGS\n\t    " + noclipping_string
-	+ "\nCOMMON_SETTINGS -CL:ascdc=no:asjdc=no:gbcdc=yes:kjd=yes:kjck=no ";
+	"\nSOLID_SETTINGS\n\t    " + noclipping_string
+	+ "\nCOMMON_SETTINGS -CL:ascdc=no:asjdc=no ";
 
-      parseQuickmodeNoTechSettingsChange(modestring.c_str(), "-noclipping", Pv, verbose);
+      parseQuickmodeNoTechSettingsChange(modestring.c_str(), "-noclipping", Pv);
       break;
     }
-#if CPP_READ_SEQTYPE_END != 8
-#error "This code is made for 8 sequencing types, adapt!"
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
 #endif
-    case MP_quickmode_hirep_something:
-    case MP_quickmode_hirep_good:
-    case MP_quickmode_hirep_best: {
-      if(verbose) cout << "Changing some parameters for highly repetitive data, mode ";
-      string modestring("\n_COMMON_SETTINGS"
-			"\n\t-CO:mr=yes:mroir=false");
-      if(yyretcode==MP_quickmode_hirep_something){
-	if(verbose) cout << "'something'";
-	modestring+=
-	  "\n\t-KS:mnr=yes:nrr=10:nrc=0"
-	  "\n";
-      }else if(yyretcode==MP_quickmode_hirep_good){
-	if(verbose) cout << "'good'";
-	modestring+=
-	  "\n\t-KS:mnr=yes:nrr=200:nrc=0"
-	  "\n";
-      }else if(yyretcode==MP_quickmode_hirep_best){
-	if(verbose) cout << "'best'";
-	modestring+=
-	  "\n\t-KS:mnr=no"
-	  "\n";
-      }else{
-	MIRANOTIFY(Notify::INTERNAL,"Huh? Unknown highly repetitive flag?");
-      }
-      parseQuickmode(modestring.c_str(), "", Pv, verbose);
-      if(verbose) cout << "  - fixed settings\n";
+    case MP_quickmode_notraceinfo: {
+      static const char modestring[] =
+	"\nSANGER_SETTINGS"
+	"\n\t    -LR:mxti=no"
+	"\n454_SETTINGS"
+	"\n\t    -LR:mxti=no"
+	"\nIONTOR_SETTINGS"
+	"\n\t    -LR:mxti=no"
+	"\nPACBIO_SETTINGS"
+	"\n\t    -LR:mxti=no"
+	"\nSOLEXA_SETTINGS"
+	"\n\t    -LR:mxti=no"
+	"\nSOLID_SETTINGS"
+	"\n\t    -LR:mxti=no";
+
+      parseQuickmodeNoTechSettingsChange(modestring, "-notraceinfo", Pv);
+      break;
+    }
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
+#endif
+    case MP_quickmode_highlyrepetitive: {
+      cout << "Changing some parameters for highly repetitive data ...";
+      static const char modestring[] =	
+	"\n_COMMON_SETTINGS"
+	"\n\t-AS:sep=yes"
+	"\n\t-CO:mr=yes:mroir=false"
+	"\n\t-SK:mnr=yes:nrr=10"
+	"\n"
+	"\n_SANGER_SETTINGS"
+	"\n\t-GE:uti=yes"
+	"\n\t-AS:urdcm=1.2"
+	"\n\t-CL:pvlc=yes:pvcmla=10"
+	"\n\t-DP:ure=yes:feip=0:leip=0"
+	"\n\t-CO:emea=15:amgb=yes:amgbemc=yes:amgbnbs=yes"
+	"\n"
+	"\n_454_SETTINGS"
+	"\n\t-DP:ure=no"
+	"\n\t-AS:urdcm=1.4"
+	"\n\t-CL:pvlc=yes:pvcmla=10"
+	"\n\t-CO:emea=5:amgb=no"
+	"\n"
+	// TODO: what for IonTorrent? atm like 454
+	"\n_IONTOR_SETTINGS"
+	"\n\t-DP:ure=no"
+	"\n\t-AS:urdcm=1.4"
+	"\n\t-CL:pvlc=yes:pvcmla=10"
+	"\n\t-CO:emea=5:amgb=no"
+	"\n"
+	// TODO: what for PacBio? atm as 454
+	// new: switch off -AL:egp (for short strobing)
+	//        better would be to change egp that it strikes only between two bases, 
+	//        not when neighbouring N
+	//        won't help:  ....atcaaatgtt***************t--------------....
+	"\n_PACBIO_SETTINGS"
+	"\n\t-DP:ure=no"
+	"\n\t-AS:urdcm=1.4"
+	"\n\t-CL:pvlc=yes:pvcmla=10"
+	"\n\t-AL:egp=no"
+	"\n\t-CO:emea=5:amgb=no"
+	"\n"
+	"\n_SOLEXA_SETTINGS"
+	"\n\t-DP:ure=no"
+	"\n\t-AS:urdcm=1.9"
+	"\n\t-CL:pvlc=no"
+	"\n\t-CO:emea=5:amgb=yes:amgbemc=yes:amgbnbs=yes"
+	;
+      parseQuickmode(modestring, "", Pv,false);
+      cout << "  - fixed settings\n";
 
       MIRAParameters * tmpactpar;
       if(!Pv.empty()) {
@@ -3935,73 +4490,63 @@ void MIRAParameters::parse(istream & is, vector<MIRAParameters> & Pv, bool verbo
       }else{
 	tmpactpar=actpar;
       }
+
       if(tmpactpar->mp_assembly_params.as_numpasses<6){
-	if(verbose) cout << "  - increassing number of passes (-AS:nop) ";
+	cout << "  - increassing number of passes (-AS:nop) ";
 	tmpactpar->mp_assembly_params.as_numpasses++;
 	if(tmpactpar->mp_assembly_params.as_numpasses<=5){
 	  tmpactpar->mp_assembly_params.as_numpasses++;
-	  if(verbose) cout << "by two.\n";
+	  cout << "by two.\n";
 	}else{
-	  if(verbose) cout << "by one.\n";
+	  cout << "by one.\n";
 	}
       }
       if(tmpactpar->mp_assembly_params.as_numrmbbreakloops<3){
-	if(verbose) cout << "  - increasing maximum of RMB break loop (-AS:rbl).\n";
+	cout << "  - increasing maximum of RMB break loop (-AS:rbl).\n";
 	tmpactpar->mp_assembly_params.as_numrmbbreakloops++;
       }
-      if(verbose) cout << "Done\n";
-
-      break;
-    }
-    case MP_quickmode_highlyrepetitive: {
-      errstream << "I'm sorry, '--highlyrepetitive' has been replaced by either"
-	"\n  1) '--hirep_something' for \"give me something\" (fast)"
-	"\n  2) '--hirep_good' for \"give me good resolve\" (slow)"
-	"\n  3) '--hirep_best' for \"give me best resolve\" (very slow)"
-	"\n";
+      cout << "Done\n";
       break;
     }
     case MP_quickmode_lowqualitydata: {
-      if(verbose) cout << "Adjusting parameters for low quality data (-lowqualitydata):\n"
-		    "  Increassing (-CO:mrpg) by 1.\n"
-		    "  Switching on -CO:amgbnbs=yes\n";
+      cout << "Adjusting parameters for low quality data (-lowqualitydata):\n"
+	"  Increassing (-CO:mrpg) by 1.\n"
+	"  Switching on -CO:amgbnbs=yes\n";
       //"  Switching on read extension (-DP:ure=yes)"
 
       if(!Pv.empty()) {
 	for(uint32 i=0; i<Pv.size(); i++){
 	  Pv[i].mp_contig_params.con_minreadspergroup+=1;
 	  Pv[i].mp_contig_params.con_also_mark_gap_bases_needbothstrands=true;
-	  if(Pv[i].mp_contig_params.con_reject_on_drop_in_relscore>20){
-	    Pv[i].mp_contig_params.con_reject_on_drop_in_relscore-=10;
-	  }
-	  if(Pv[i].mp_contig_params.con_min_relscore>20){
-	    Pv[i].mp_contig_params.con_reject_on_drop_in_relscore-=10;
+	  Pv[i].mp_contig_params.con_reject_on_drop_in_relscore-=10;
+	  if(Pv[i].mp_contig_params.con_reject_on_drop_in_relscore<10){
+	    Pv[i].mp_contig_params.con_reject_on_drop_in_relscore=10;
 	  }
 	  Pv[i].mp_contig_params.con_mingroupqualforrmbtagging-=5;
 
 	  Pv[i].mp_align_params.ads_extra_gap_penalty=true;
-	  //Pv[i].setAlignGapPenaltyLevel(0);
+	  Pv[i].setAlignGapPenaltyLevel(0);
 	  Pv[i].mp_align_params.ads_max_gppercent=100;
 	}
       }else{
 	actpar->mp_contig_params.con_minreadspergroup+=1;
 	actpar->mp_contig_params.con_also_mark_gap_bases_needbothstrands=true;
-	if(actpar->mp_contig_params.con_reject_on_drop_in_relscore>20){
-	  actpar->mp_contig_params.con_reject_on_drop_in_relscore-=10;
+	if(actpar->mp_contig_params.con_reject_on_drop_in_relscore<10){
+	  actpar->mp_contig_params.con_reject_on_drop_in_relscore=10;
 	}
 	actpar->mp_contig_params.con_mingroupqualforrmbtagging-=5;
 
 	actpar->mp_align_params.ads_extra_gap_penalty=true;
-	//actpar->setAlignGapPenaltyLevel(0);
+	actpar->setAlignGapPenaltyLevel(0);
 	actpar->mp_align_params.ads_max_gppercent=100;
       }
       break;
     }
     case MP_quickmode_highqualitydata: {
-      if(verbose) cout << "Adjusting parameters for high quality data (-highqualitydata):\n"
-		    "  Increassing (-CL:qcmq) by 4.\n"
-		    "  Increassing (-CO:mnq) by 4.\n"
-		    "  Increassing (-CO:mgqrt) by 2.\n";
+      cout << "Adjusting parameters for high quality data (-highqualitydata):\n"
+	"  Increassing (-CL:qcmq) by 4.\n"
+	"  Increassing (-CO:mnq) by 4.\n"
+	"  Increassing (-CO:mgqrt) by 2.\n";
       // why does gcc 4.3.2 warn
       //  warning: conversion to ‘base_quality_t’ from ‘int’ may alter its value [-Wconversion]
       // in the next 6 lines with += ???
@@ -4023,110 +4568,78 @@ void MIRAParameters::parse(istream & is, vector<MIRAParameters> & Pv, bool verbo
       actpar->mp_assembly_params.as_dateoutput=getFixedStringMode(lexer,errstream);
       break;
     }
-    case MP_as_bangonthrow : {
-      getFixedStringMode(lexer,errstream);
-      Notify::setBangOnThrow(true);
-      cout << "\n############# Bang on throw: MIRA will raise a SigTrap when encountering INTERNAL or FATAL errors.\n\n";
-      break;
-    }
 
-#if CPP_READ_SEQTYPE_END != 8
-#error "This code is made for 8 sequencing types, adapt!"
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
 #endif
     case MP_silentparams_for_common :
     case MP_silentparams_for_sanger :
-    case MP_silentparams_for_454 :
-    case MP_silentparams_for_iontor :
-    case MP_silentparams_for_pacbiohq :
-    case MP_silentparams_for_pacbiolq :
-    case MP_silentparams_for_text :
-    case MP_silentparams_for_solexa :
-    case MP_silentparams_for_solid :
+    case MP_silentparams_for_454 : 
+    case MP_silentparams_for_iontor : 
+    case MP_silentparams_for_pacbio : 
+    case MP_silentparams_for_solexa : 
+    case MP_silentparams_for_solid : 
     case MP_params_for_common :
     case MP_params_for_sanger :
-    case MP_params_for_454 :
-    case MP_params_for_iontor :
-    case MP_params_for_pacbiohq :
-    case MP_params_for_pacbiolq :
-    case MP_params_for_text :
-    case MP_params_for_solexa :
+    case MP_params_for_454 : 
+    case MP_params_for_iontor : 
+    case MP_params_for_pacbio : 
+    case MP_params_for_solexa : 
     case MP_params_for_solid : {
       BUGIFTHROW(Pv.empty(),"Current parsing mode does not allow for changing the sequencing type.\n");
       currentseqtypesettings=lexer->YYText();
-
-      uint32 newst=SEQTYPE_END;
-      bool realst=true;
       switch(yyretcode){
       case MP_silentparams_for_common :
-      case MP_params_for_common :{
-	newst=SEQTYPE_SANGER;
-	realst=false;
-	break;
-      }
-#if CPP_READ_SEQTYPE_END != 8
-#error "This code is made for 8 sequencing types, adapt!"
-#endif
+      case MP_params_for_common :
       case MP_silentparams_for_sanger :
       case MP_params_for_sanger : {
-      	newst=SEQTYPE_SANGER;
+      	actpar=&Pv[Read::SEQTYPE_SANGER];
       	break;
       }
-      case MP_silentparams_for_454 :
+      case MP_silentparams_for_454 : 
       case MP_params_for_454 : {
-      	newst=SEQTYPE_454GS20;
+      	BUGIFTHROW(Pv.size() < 1+Read::SEQTYPE_454GS20,"Trying to switch to 454 settings, but not enough parameter objects exist?");
+      	actpar=&Pv[Read::SEQTYPE_454GS20];
       	break;
       }
-      case MP_silentparams_for_iontor :
+      case MP_silentparams_for_iontor : 
       case MP_params_for_iontor : {
-      	newst=SEQTYPE_IONTORRENT;
-      	break;
-      }
-      case MP_silentparams_for_pacbiolq :
-      case MP_params_for_pacbiolq : {
-      	newst=SEQTYPE_PACBIOLQ;
+      	BUGIFTHROW(Pv.size() < 1+Read::SEQTYPE_IONTORRENT,"Trying to switch to IonTorrent settings, but not enough parameter objects exist?");
+      	actpar=&Pv[Read::SEQTYPE_IONTORRENT];
       	break;
       }
-      case MP_silentparams_for_pacbiohq :
-      case MP_params_for_pacbiohq : {
-      	newst=SEQTYPE_PACBIOHQ;
+      case MP_silentparams_for_pacbio : 
+      case MP_params_for_pacbio : {
+      	BUGIFTHROW(Pv.size() < 1+Read::SEQTYPE_PACBIO,"Trying to switch to PacBio settings, but not enough parameter objects exist?");
+      	actpar=&Pv[Read::SEQTYPE_PACBIO];
       	break;
       }
       case MP_silentparams_for_solexa :
       case MP_params_for_solexa : {
-      	newst=SEQTYPE_SOLEXA;
-      	break;
-      }
-      case MP_silentparams_for_text :
-      case MP_params_for_text : {
-      	newst=SEQTYPE_TEXT;
+      	BUGIFTHROW(Pv.size() < 1+Read::SEQTYPE_SOLEXA,"Trying to switch to SOLEXA settings, but not enough parameter objects exist?");
+      	actpar=&Pv[Read::SEQTYPE_SOLEXA];
       	break;
       }
       case MP_silentparams_for_solid :
       case MP_params_for_solid : {
-      	newst=SEQTYPE_ABISOLID;
+      	BUGIFTHROW(Pv.size() < 1+Read::SEQTYPE_ABISOLID,"Trying to switch to SOLiD settings, but not enough parameter objects exist?");
+      	actpar=&Pv[Read::SEQTYPE_ABISOLID];
       	break;
       }
       default: {
 	// do nothing
       }
       }
-      BUGIFTHROW(newst>=Pv.size(),"Trying to switch to " << ReadGroupLib::getNameOfSequencingType(newst) << " settings, but not enough parameter objects exist?");
-
-      actpar=&Pv[newst];
-
-#if CPP_READ_SEQTYPE_END != 8
-#error "This code is made for 8 sequencing types, adapt!"
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
 #endif
       switch(yyretcode){
       case MP_params_for_sanger :
       case MP_params_for_454 :
       case MP_params_for_iontor :
-      case MP_params_for_pacbiohq :
-      case MP_params_for_pacbiolq :
-      case MP_params_for_text :
+      case MP_params_for_pacbio :
       case MP_params_for_solexa :
       case MP_params_for_solid : {
-	CEBUG("\nParsed some settings!\n");
 	actpar->MP_parsedsomesettings=true;
 	break;
       }
@@ -4146,16 +4659,15 @@ void MIRAParameters::parse(istream & is, vector<MIRAParameters> & Pv, bool verbo
     case MP_jobdef_accurate: {
       jobdefs[JA_QUALITY].push_back(yyretcode);
       if(yyretcode==MP_jobdef_normal){
-	if(verbose) cout << "--job=normal is deprecated and will be removed in later versions of MIRA"
-		      "\nPlease use only 'draft' or 'accurate'\n";
+	cout << "--job=normal is deprecated and will be removed in later versions of MIRA"
+	  "\nPlease use only 'draft' or 'accurate'\n";
       }
       break;
     }
     case MP_jobdef_genome:
-    case MP_jobdef_est:
-    case MP_jobdef_fragments:
-    case MP_jobdef_estsnppipeline1:
-    case MP_jobdef_estsnppipeline2:
+    case MP_jobdef_est: 
+    case MP_jobdef_estsnppipeline1: 
+    case MP_jobdef_estsnppipeline2: 
     case MP_jobdef_estsnppipeline3: {
       jobdefs[JA_TYPE].push_back(yyretcode);
       break;
@@ -4165,15 +4677,13 @@ void MIRAParameters::parse(istream & is, vector<MIRAParameters> & Pv, bool verbo
       jobdefs[JA_METHOD].push_back(yyretcode);
       break;
     }
-#if CPP_READ_SEQTYPE_END != 8
-#error "This code is made for 8 sequencing types, adapt!"
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
 #endif
     case MP_jobdef_sanger:
     case MP_jobdef_454:
     case MP_jobdef_iontor:
-    case MP_jobdef_pacbiolq:
-    case MP_jobdef_pacbiohq:
-    case MP_jobdef_text:
+    case MP_jobdef_pacbio:
     case MP_jobdef_solexa:
     case MP_jobdef_solid: {
       jobdefs[JA_TECH].push_back(yyretcode);
@@ -4192,7 +4702,7 @@ void MIRAParameters::parse(istream & is, vector<MIRAParameters> & Pv, bool verbo
       break;
     }
     case MP_ERROR : {
-      errstream << "* Parameter section: '" << MP_currentparametersection
+      errstream << "* Parameter section: '" << MP_currentparametersection 
 		<< "'\n*\tunrecognised string or unexpected character: " << lexer->YYText();
       if(MP_errorinparams){
 	errstream << "\n*\t(may be due to previous errors)";
@@ -4201,57 +4711,13 @@ void MIRAParameters::parse(istream & is, vector<MIRAParameters> & Pv, bool verbo
       MP_errorinparams=true;
       break;
     }
-    case MP_ERROR_RENAMED_BPH_KMER : {
-      errstream << "* Parameter section: '" << MP_currentparametersection
-		<< "'\n*\tParameter: " << lexer->YYText()
-		<< "\n*\tParameters with a name 'bph' (bases_per_hash) in MIRA 4.0.x and before were renamed to use 'kms' (kmer_size) as this term is what the world now uses. Sorry about that.";
-      if(MP_errorinparams){
-	errstream << "\n*\t(may be due to previous errors)";
-      }
-      errstream <<"\n\n";
-      MP_errorinparams=true;
-      break;
-    }
-    case MP_ERROR_REMOVED : {
-      errstream << "* Parameter section: '" << MP_currentparametersection
-		<< "'\n*\tParameter: " << lexer->YYText()
-		<< "\n*\tThis parameter was removed completely, sorry about that.";
-      if(MP_errorinparams){
-	errstream << "\n*\t(may be due to previous errors)";
-      }
-      errstream <<"\n\n";
-      MP_errorinparams=true;
-      break;
-    }
-    case MP_ERROR_MOVED_SECTION_NW : {
-      errstream << "* Parameter section: '" << MP_currentparametersection
-		<< "'\n*\tParameter: " << lexer->YYText()
-		<< "\n*\tThis was moved to section '-NW' (eventually also renamed), sorry about that.";
-      if(MP_errorinparams){
-	errstream << "\n*\t(may be due to previous errors)";
-      }
-      errstream <<"\n\n";
-      MP_errorinparams=true;
-      break;
-    }
-    case MP_ERROR_MOVED_SECTION_KS : {
-      errstream << "* Parameter section: '" << MP_currentparametersection
-		<< "'\n*\tParameter: " << lexer->YYText()
-		<< "\n*\tSection -HASHSTATISTICS was renamed to section '-KMERSTATISTICS'. Furthermore, parameters with the term 'hash' were renamed with the term 'kmer'. Please look up the new name in the documentation, sorry about that.";
-      if(MP_errorinparams){
-	errstream << "\n*\t(may be due to previous errors)";
-      }
-      errstream <<"\n\n";
-      MP_errorinparams=true;
-      break;
-    }
     case MP_ERROR_DASHES : {
       errstream << "* Parameter section: '" << MP_currentparametersection << "'\n";
       errstream <<  "*\tone or several dashes with a blank too much behind them: " << lexer->YYText();
       if(MP_errorinparams){
 	errstream << "\n*\t(may be due to previous errors)";
       }
-      errstream <<"\n\n";
+      errstream <<"\n\n";;
       MP_errorinparams=true;
       break;
     }
@@ -4261,19 +4727,19 @@ void MIRAParameters::parse(istream & is, vector<MIRAParameters> & Pv, bool verbo
       if(MP_errorinparams){
 	errstream << "\n*\t(may be due to previous errors)";
       }
-      errstream <<"\n\n";
+      errstream <<"\n\n";;
       MP_errorinparams=true;
       break;
     }
-    case MP_FLOAT :
-    case MP_INT :
+    case MP_FLOAT : 
+    case MP_INT : 
     case MP_ANID : {
       errstream << "* Parameter section: '" << MP_currentparametersection << "'\n";
       errstream << "*\tunrecognised string or unexpected character: " << lexer->YYText();
       if(MP_errorinparams){
 	errstream << "\n*\t(may be due to previous errors)";
       }
-      errstream <<"\n\n";
+      errstream <<"\n\n";;
       MP_errorinparams=true;
       break;
     }
@@ -4289,18 +4755,10 @@ void MIRAParameters::parse(istream & is, vector<MIRAParameters> & Pv, bool verbo
 
   delete lexer;
 
-  if(Pv[0].mp_special_params.sp_parse_checktechnologypresence){
-    for(uint32 st=0; st<Pv.size(); ++st){
-      if(Pv[st].MP_parsedsomesettings && !Pv[st].MP_jobtechsettings){
-	errstream << "* Seen parameters for " << ReadGroupLib::getNameOfSequencingType(st) << ", but no readgroup has that sequencing technology?\n\n";
-      }
-    }
-  }
-
   if(errstream.str().size()){
     vector<int> bla;
     for(uint32 i=0; i<Pv.size(); i++) bla.push_back(i);
-
+    
     cout << "\n\n";
 
     //MIRAParameters::dumpAllParams(
@@ -4314,53 +4772,29 @@ void MIRAParameters::parse(istream & is, vector<MIRAParameters> & Pv, bool verbo
     MIRANOTIFY(Notify::FATAL, "Error while parsing parameters, sorry.");
   }
 
-  //cout << endl;
-  Pv[0].consistencyCheck(verbose);
+  cout << endl;
+  Pv[0].consistencyCheck();
 
   for(uint32 st=1; st<Pv.size(); ++st){
     if(Pv[st].MP_parsedsomesettings
-       && Pv[0].mp_skim_params.sk_basesperhash>Pv[st].mp_align_params.al_min_overlap){
-      if(verbose) cout << "WARNING: -SK:kms=" << Pv[0].mp_skim_params.sk_basesperhash
-		       << " is larger than -AL:mo=" << Pv[st].mp_align_params.al_min_overlap
-		       << " for " << ReadGroupLib::getShortNameOfSequencingType(st) << ". Some potential overlaps will not be found.\n";
+       && Pv[st].mp_skim_params.sk_basesperhash>Pv[st].mp_align_params.al_min_overlap){
+      cout << "WARNING: -SK:bph=" << Pv[st].mp_skim_params.sk_basesperhash 
+	   << " is larger than -AL:mo=" << Pv[st].mp_align_params.al_min_overlap
+	   << " for " << Read::getShortNameOfSequencingType(st) << ". Some overlaps will not be found.\n";
     }
   }
 
-  // hack to get
-  //   -AL:egp:egpl:megpp:ece:ced:cema
-  //  copied to every seqtype from the common settings as assembly_swalign.C and contig.C
-  //  use seqtype dependent params for -AL:bip:bmax:bmin:ms:mo:mrs)
-  //
-  // Above can make sense for read/read SW calc, but would break down in hybrid de-novo
-  //  assemblies during contig build phase.
-  // E.g.: 454 & Solexa. Long 454 with homopolymers error gets added (lenient on extra gaps),
-  //  but that would stop Solexas being added (if strict on extra gaps).
-  for(uint32 st=1; st<Pv.size(); ++st){
-    Pv[st].mp_align_params.ads_extra_gap_penalty=Pv[0].mp_align_params.ads_extra_gap_penalty;
-    Pv[st].mp_align_params.ads_gp_function=Pv[0].mp_align_params.ads_gp_function;
-    Pv[st].mp_align_params.ads_max_gppercent=Pv[0].mp_align_params.ads_max_gppercent;
-    Pv[st].mp_align_params.ads_enforce_clean_ends=Pv[0].mp_align_params.ads_enforce_clean_ends;
-    Pv[st].mp_align_params.ads_clean_end_distance=Pv[0].mp_align_params.ads_clean_end_distance;
-    Pv[st].mp_align_params.ads_clean_end_mismatchallowed=Pv[0].mp_align_params.ads_clean_end_mismatchallowed;
-  }
-
   FUNCEND();
 }
 
 
 
 
-
+ 
 void MIRAParameters::interpretJobDefs(vector<MIRAParameters> & Pv, vector<vector<uint32> > & jobdefs, stringstream & errstream)
 {
   FUNCSTART("void MIRAParameters::interpretJobDefs(vector<vector<uint16> > & jobdefs, stringstream & errstream)");
 
-  BUGIFTHROW(Pv.size()!=SEQTYPE_END,"Pv.size()!=SEQTYPE_END ???");
-
-  for(auto pvi=0; pvi<Pv.size(); ++pvi){
-    Pv[pvi].MP_jobtechsettings=false;
-  }
-
   if(jobdefs[JA_QUALITY].size()==0){
     cout << "Seen no assembly quality in job definition, assuming 'accurate'.\n";
     jobdefs[JA_QUALITY].push_back(MP_jobdef_accurate);
@@ -4385,88 +4819,88 @@ void MIRAParameters::interpretJobDefs(vector<MIRAParameters> & Pv, vector<vector
     errstream <<  "*\tSeen multiple assembly methods in job definition, pick only one\n";
     MP_errorinparams=true;
   }
-
-  Pv[0].getNonConstAssemblyParams().as_assemblyjob_accurate=(jobdefs[JA_QUALITY].front() == MP_jobdef_accurate);
-  if(jobdefs[JA_METHOD].front()==MP_jobdef_mapping){
-    Pv[0].getNonConstAssemblyParams().as_assemblyjob_mapping=true;
-  }
-
-  bool isfragments=false;
-  if(jobdefs[JA_TYPE].back()==MP_jobdef_fragments){
-    // fragments is a specialised mode of EST
-    // i.e., has all data reduction security features (diginorm etc.) etc. switched off.
-    isfragments=true;
-    jobdefs[JA_TYPE].back()=MP_jobdef_est;
-  }
-
-#if CPP_READ_SEQTYPE_END != 8
-#error "This code is made for 8 sequencing types, adapt!"
+  
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
 #endif
+  bool hasSANGER=false;
+  bool has454=false;
+  bool hasIONTOR=false;
+  bool hasPACBIO=false;
+  bool hasSOLEXA=false;
+  bool hasSOLID=false;
 
   {
+    string multiple;
     for(uint32 i=0; i<jobdefs[JA_TECH].size(); i++){
-      uint32 actst=SEQTYPE_END;
+      multiple.clear();
       switch(jobdefs[JA_TECH][i]){
       case MP_jobdef_sanger : {
-	actst=SEQTYPE_SANGER;
+	if(hasSANGER) {
+	  multiple=Read::getNameOfSequencingType(Read::SEQTYPE_SANGER);
+	}
+	hasSANGER=true;
 	break;
       }
       case MP_jobdef_454 : {
-	actst=SEQTYPE_454GS20;
+	if(has454) {
+	  multiple=Read::getNameOfSequencingType(Read::SEQTYPE_454GS20);
+	}
+	has454=true;
 	break;
       }
       case MP_jobdef_iontor : {
-	actst=SEQTYPE_IONTORRENT;
-	break;
-      }
-      case MP_jobdef_pacbiolq : {
-	actst=SEQTYPE_PACBIOLQ;
-	break;
-      }
-      case MP_jobdef_pacbiohq : {
-	actst=SEQTYPE_PACBIOHQ;
+	if(hasIONTOR) {
+	  multiple=Read::getNameOfSequencingType(Read::SEQTYPE_IONTORRENT);
+	}
+	hasIONTOR=true;
 	break;
       }
-      case MP_jobdef_text : {
-	actst=SEQTYPE_TEXT;
+      case MP_jobdef_pacbio : {
+	if(hasPACBIO) {
+	  multiple=Read::getNameOfSequencingType(Read::SEQTYPE_PACBIO);
+	}
+	hasPACBIO=true;
 	break;
       }
       case MP_jobdef_solexa : {
-	actst=SEQTYPE_SOLEXA;
+	if(hasSOLEXA) {
+	  multiple=Read::getNameOfSequencingType(Read::SEQTYPE_SOLEXA);
+	}
+	hasSOLEXA=true;
 	break;
       }
       case MP_jobdef_solid : {
-	actst=SEQTYPE_ABISOLID;
+	if(hasSOLID) {
+	  multiple=Read::getNameOfSequencingType(Read::SEQTYPE_ABISOLID);
+	}
+	hasSOLID=true;
 	break;
       }
       default: {
 	// do nothing
       }
       }
-
-      if(Pv[actst].MP_jobtechsettings){
+      if(!multiple.empty()){
 	errstream << "* Parameter section: '" << MP_currentparametersection << "'\n";
-	errstream << "*\tSeen '" << ReadGroupLib::getNameOfSequencingType(actst) << "' more than once, did you mean a different sequencing\n\ttechnology?\n";
+	errstream <<  "*\tSeen '" << multiple << "' more than once, did you mean a different sequencing\n\ttechnology?\n";
 	MP_errorinparams=true;
       }
-      Pv[actst].MP_jobtechsettings=true;
     }
   }
 
-  bool hasSHORTREADS=Pv[SEQTYPE_SOLEXA].MP_jobtechsettings | Pv[SEQTYPE_ABISOLID].MP_jobtechsettings;
+  bool hasSHORTREADS=hasSOLEXA | hasSOLID;
 
-#if CPP_READ_SEQTYPE_END != 8
-#error "This code is made for 8 sequencing types, adapt!"
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
 #endif
 
-  CEBUG("Pv[SEQTYPE_SANGER].MP_jobtechsettings: " << Pv[SEQTYPE_SANGER].MP_jobtechsettings << endl);
-  CEBUG("Pv[SEQTYPE_454GS20].MP_jobtechsettings: " << Pv[SEQTYPE_454GS20].MP_jobtechsettings << endl);
-  CEBUG("Pv[SEQTYPE_IONTORRENT].MP_jobtechsettings: " << Pv[SEQTYPE_IONTORRENT].MP_jobtechsettings << endl);
-  CEBUG("Pv[SEQTYPE_PACBIOHQ].MP_jobtechsettings: " << Pv[SEQTYPE_PACBIOHQ].MP_jobtechsettings << endl);
-  CEBUG("Pv[SEQTYPE_PACBIOLQ].MP_jobtechsettings: " << Pv[SEQTYPE_PACBIOLQ].MP_jobtechsettings << endl);
-  CEBUG("Pv[SEQTYPE_SOLEXA].MP_jobtechsettings: " << Pv[SEQTYPE_TEXT].MP_jobtechsettings << endl);
-  CEBUG("Pv[SEQTYPE_SOLEXA].MP_jobtechsettings: " << Pv[SEQTYPE_SOLEXA].MP_jobtechsettings << endl);
-  CEBUG("Pv[SEQTYPE_ABISOLID].MP_jobtechsettings: " << Pv[SEQTYPE_ABISOLID].MP_jobtechsettings << endl);
+  CEBUG("hasSANGER: " << hasSANGER << endl);
+  CEBUG("has454: " << has454 << endl);
+  CEBUG("hasIONTOR: " << hasIONTOR << endl);
+  CEBUG("hasPACBIO: " << hasPACBIO << endl);
+  CEBUG("hasSOLEXA: " << hasSOLEXA << endl);
+  CEBUG("hasSOLID: " << hasSOLID << endl);
   CEBUG("hasSHORTREADS: " << hasSHORTREADS << endl);
 
   // complete: 1.6 2.1
@@ -4476,119 +4910,94 @@ void MIRAParameters::interpretJobDefs(vector<MIRAParameters> & Pv, vector<vector
 
   string modestring=
     "\nCOMMON_SETTINGS"
-    "\n\t-GE:not=0:crkf=yes:amm=yes:kpmf=15:mps=0:ppo=no"
-    "\n\t-MI:ikwid=no:el=false:lcs=500:lcs4s=5000"
-    "\n\t-NW:cnfs=stop:ctp=stop:cdrn=stop:csrn=stop:cmrnl=stop:mrnl=40:cac=stop:acv=80"
+    "\n\t-GE:not=2:crhf=yes:amm=yes:kpmf=15:mps=0"
+    "\n\t-MI:sonfs=yes:el=false:lcs=500:lcs4s=5000:somrnl=40"
     "\n\t-LR:fo=no"
-    "\n\t-AS:nop=0;urle=no:ugpf=yes:urd=no:urdsip=3:mcpp=0"
-    "\n\t-SB:bsnffa=no"
-    "\n\t-CL:peckms=17:pechsgp=yes:ascdc=yes:asjdc=no:gbcdc=yes:kjd=yes:kjck=no"
+    "\n\t-AS:ugpf=yes:urd=no:urdsip=3:klrs=no:mcpp=0"
+    "\n\t-SB:bsnffa=no:bbq=30:bsn=ReferenceStrain"
+    "\n\t-CL:pec=yes:pecbph=17:pechsgp=yes:ascdc=yes:asjdc=no:cbse=yes"
     "\n\t-CO:mr=yes:mroir=false:asir=no"
-    "\n\t    emeas1clpec=yes:fnic=no"
-    "\n\t-SK:kmsaipp=0:acrc=yes:pr=80:swcob=no:fmh=yes:mhc=150000:mmhr=0:mchr=2048"
-    "\n\t-KS:ldn=no:mnr=yes:nrr=100:nrc=0:fenn=0.4:fexn=1.6:fer=1.9:fehr=8:fecr=20:fcem=0"
-    "\n\t-KS:mkpb=4:rkfk=1"
+    "\n\t    emeas1clpec=yes:fnicast=no"
+    "\n\t-SK:acrc=yes:bph=17:pr=80:swcob=no:mnr=yes:nrr=100:mmhr=0:mchr=2048"
+    "\n\t    fenn=0.4:fexn=1.6:fer=1.9:fehr=8:fecr=20"
     "\n\t-PF:mscft=5"
-    "\n\t-ED:mace=yes:eks=yes"
-    "\n\t-AL:egp=yes:egpl=0,5,10,20,40,80,100"  // "1,2,4,8,16,32,64,100"
     "\n\t"
-    "\n\t-OUT:ors=yes:otc=yes:orm=yes:otm=no:ora=no:rrot=yes:rtd=no"
+    "\n\t-OUT:ors=yes:otc=yes:orm=yes:otm=no:rrot=yes:rtd=no"
+    "\n\t"
+    "\nSANGER_SETTINGS"
+    "\n\t-GE:uti=yes"
+    "\n\t-LR:lsd=no"
+    "\n\t-AS:mrl=80:mrpc=2"
+    "\n\t    urdcm=1.5:ardct=2.0:ardml=400:ardgl=40"
+    "\n\t-SB:ads=no:dsn=StrainX"
+    "\n\t-DP:ure=yes:rewl=30:rewme=2:feip=0;leip=0"
+    "\n\t-CL:bsqc=yes:bsqcmq=20:bsqcwl=30:mbc=yes:mbcgs=20:mbcmfg=40:mbcmeg=60:mqtfer=0:mqtfernob=0"
+    "\n\t    emlc=yes:mlcr=25:smlc=30:qc=no:cpat=no:c3pp=no:lcc=no:ckar=no"
+    "\n\t-CO:mrpg=2:emea=25"
+    "\n\t    amgb=yes:amgbemc=yes:amgbnbs=yes"
+    "\n\t    fnicpst=no"
+    "\n\t-ED:ace=no"
+    "\n\t-AL:bip=15:bmin=25:bmax=70:mo=17:ms=30:mrs=65:egp=no"
+    "\n\t-PF:uqr=yes:qrml1=200:qrms1=90:qrml2:100:qrms2=95:bqoml=150"
     ;
 
-  if(Pv[SEQTYPE_SANGER].MP_jobtechsettings){
-    // nothing atm
+  if(hasSANGER){
     modestring+=
-      "\nCOMMON_SETTINGS"
-      "\n\t-CL:pmkfr=1"
-      "\n\t-OUT:org=no"
+      "\n\t"
       "\nSANGER_SETTINGS"
-      "\n\t-AS:mrl=80:mrpc=2"
-      "\n\t    urdcm=1.5:ardct=2.0:ardml=400:ardgl=40"
-      "\n\t-DP:ure=yes:rewl=30:rewme=2:feip=0;leip=0"
-      "\n\t-CL:bsqc=yes:bsqcmq=20:bsqcwl=30:mbc=yes:mbcgs=20:mbcmfg=40:mbcmeg=60:mqtfer=0:mqtfernob=0"
-      "\n\t    emlc=yes:mlcr=25:smlc=30:qc=no:cpat=no:c3pp=no:lccf=no:lccb=no:ckar=no"
-      "\n\t    pec=yes:pffreq=1:pbfreq=1:pffore=false:pbfore=false:pfcmst=false:pbcmst=false:pfsalp=false:pbsalp=false"
-      "\n\t-CO:mrpg=2:emea=25"
-      "\n\t    amgb=yes:amgbemc=yes:amgbnbs=yes"
-      "\n\t-ED:ehpo=yes"
-      "\n\t-AL:bip=15:bmin=25:bmax=70:mo=17:ms=30:mrs=65"
-      "\n\t-PF:uqr=yes:qrml1=200:qrms1=90:qrml2:100:qrms2=95:bqoml=150"
-      "\n"
+      "\n\t-LR:lsd=yes"
       ;
   }
 
-  if(Pv[SEQTYPE_TEXT].MP_jobtechsettings){
-    modestring+=
-      "\nCOMMON_SETTINGS"
-      "\n\t-CL:pmkfr=1"
-      "\nTEXT_SETTINGS"
-      "\n\t-AS:mrl=80:mrpc=2"
-      "\n\t    urdcm=1.5:ardct=2.0:ardml=400:ardgl=40"
-      "\n\t-DP:ure=no"
-      "\n\t-CO:mrpg=2:emea=1"
-      "\n\t    amgb=yes:amgbemc=yes:amgbnbs=yes"
-      "\n\t-CL:pec=no:pffreq=0:pbfreq=0:pffore=false:pbfore=false:pfcmst=false:pbcmst=false:pfsalp=false:pbsalp=false"
-      "\n\t-ED:ehpo=yes"
-      "\n\t-AL:bip=15:bmin=25:bmax=70:mo=17:ms=30:mrs=65"
-      "\n\t-PF:uqr=yes:qrml1=200:qrms1=90:qrml2:100:qrms2=95:bqoml=150"
-      "\nTEXT_SETTINGS\n\t"
-      +
-      noclipping_string
-      +
-      "\n"
-      ;
-  }
-
-  if(Pv[SEQTYPE_454GS20].MP_jobtechsettings){
+  if(has454){
     modestring+=
       "\n\t"
       "\nCOMMON_SETTINGS"
-      "\n\t-CL:pmkfr=1:peckms=27"
+      "\n\t-CL:pec=yes:pecbph=27"
       "\n\t-OUT:org=no"
-      "\n\t-KS:fenn=0.4:fexn=1.6:fer=1.9:fehr=8:fecr=20"
-      "\n\t-KS:rkfk=0"
-      "\n\t-AL:egp=yes:egpl=0,0,100"
+      "\n\t-SK:fenn=0.4:fexn=1.6:fer=1.9:fehr=8:fecr=20"
       "\n\t"
       "\n454_SETTINGS"
+      "\n\t-AL:egp=yes:egpl=reject_codongaps"
+      "\n\t-LR:lsd=yes:rns=fr:mxti=yes:ft=fastq"
+      "\n\t-GE:uti=yes"
       "\n\t-AS:mrl=40:mrpc=5"
       "\n\t    urdcm=1.5:ardct=2.0:ardml=200:ardgl=20"
+      "\n\t-SB:ads=no:dsn=StrainX"
       "\n\t-DP:ure=no:rewl=15:rewme=2:feip=0;leip=0"
       "\n\t-CL:pvlc=no:qc=no:bsqc=no:emlc=no:mlcr=4:smlc=4:emrc=no:mrcr=10:smrc=15:mbc=yes:mbcgs=5:mbcmfg=12:mbcmeg=12:mqtfer=0:mqtfernob=0"
-      "\n\t    msvsgs=8:msvsmfg=8:msvsmeg=12:msvssfc=0:msvssec=0:c3pp=no:cpat=no:lccf=yes:lccb=yes:ckar=yes"
-      // TODO: pbsalp=true is not good for Solexa due to GGCxG errors also very early in some reads
-      //       therefore transplanted this to 454, but would need some checks.
-      "\n\t    pec=yes:pffreq=1:pbfreq=1:pffore=false:pbfore=yes:pfcmst=false:pbcmst=yes:pfsalp=false:pbsalp=false"
-      "\n\t-AL:ms=15:mo=17:mrs=70:bip=20:bmin=20:bmax=80"
+      "\n\t    msvs=no:msvsgs=8:msvsmfg=8:msvsmeg=12:msvssfc=0:msvssec=0:c3pp=no:cpat=no:lcc=yes:ckar=yes"
+      "\n\t-AL:ms=15:mo=20:mrs=70:bip=20:bmin=20:bmax=80:egp=yes:egpl=reject_codongaps"
       "\n\t-CO:rodirs=30:mrpg=4:mnq=20:mgqrt=25:emea=10:amgb=no"
-      "\n\t    gor=66"
-      "\n\t-ED:ehpo=yes"
+      "\n\t    fnicpst=no:gor=66"
+      "\n\t-ED:ace=yes"
       "\n\t-PF:uqr=yes:qrml1=80:qrms1=90:qrml2=60:qrms2=95:bqoml=80"
       "\n\t-SK:pr=80"
       ;
   }
 
-  if(Pv[SEQTYPE_IONTORRENT].MP_jobtechsettings){
+  if(hasIONTOR){
     modestring+=
       "\n\t"
       "\nCOMMON_SETTINGS"
-      "\n\t-CL:peckms=27:pmkfr=1"
+      "\n\t-CL:pec=yes:pecbph=27"
       "\n\t-OUT:org=no"
-      "\n\t-KS:fenn=0.4:fexn=1.6:fer=1.9:fehr=8:fecr=20"
-      "\n\t-KS:rkfk=0"
-      "\n\t-AL:egp=yes:egpl=0,0,100"
+      "\n\t-SK:fenn=0.4:fexn=1.6:fer=1.9:fehr=8:fecr=20"
       "\n\t"
       "\nIONTOR_SETTINGS"
+      "\n\t-AL:egp=yes:egpl=reject_codongaps"
+      "\n\t-LR:lsd=yes:ft=fastq:rns=fr:mxti=yes"
+      "\n\t-GE:uti=yes"
       "\n\t-AS:mrl=40:mrpc=5"
       "\n\t    urdcm=1.5:ardct=2.0:ardml=200:ardgl=20"
+      "\n\t-SB:ads=no:dsn=StrainX"
       "\n\t-DP:ure=no:rewl=15:rewme=2:feip=0;leip=0"
       "\n\t-CL:pvlc=no:qc=no:bsqc=no:emlc=no:mlcr=4:smlc=4:emrc=no:mrcr=10:smrc=15:mbc=yes:mbcgs=5:mbcmfg=12:mbcmeg=12:mqtfer=0:mqtfernob=0"
-      "\n\t    msvsgs=8:msvsmfg=8:msvsmeg=12:msvssfc=0:msvssec=0:c3pp=no:cpat=no:lccf=yes:lccb=yes:ckar=yes"
-      //TODO: check whether like Sanger (now) or like 454 would be better
-      "\n\t    pec=yes:pffreq=1:pbfreq=1:pffore=false:pbfore=false:pfcmst=false:pbcmst=false:pfsalp=false:pbsalp=false"
-      "\n\t-AL:ms=15:mo=17:mrs=70:bip=20:bmin=20:bmax=80"
+      "\n\t    msvs=no:msvsgs=8:msvsmfg=8:msvsmeg=12:msvssfc=0:msvssec=0:c3pp=no:cpat=no:lcc=yes:ckar=yes"
+      "\n\t-AL:ms=15:mo=20:mrs=70:bip=20:bmin=20:bmax=80:egp=yes:egpl=reject_codongaps"
       "\n\t-CO:rodirs=25:mrpg=4:mnq=20:mgqrt=25:emea=10:amgb=no"
-      "\n\t    gor=66"
-      "\n\t-ED:ehpo=yes"
+      "\n\t    fnicpst=no:gor=66"
+      "\n\t-ED:ace=yes"
       "\n\t-PF:uqr=yes:qrml1=80:qrms1=90:qrml2=60:qrms2=95:bqoml=80"
       "\n\t-SK:pr=80"
       ;
@@ -4597,130 +5006,94 @@ void MIRAParameters::interpretJobDefs(vector<MIRAParameters> & Pv, vector<vector
   // TODO: adapt once PacBio data analysed
   // template from 454
   // mrpg=3 for less coverage expected.
-  if(Pv[SEQTYPE_PACBIOHQ].MP_jobtechsettings){
-    // TODO: PacBioLQ and combo
-    // This is for HQ only
+  if(hasPACBIO){
     modestring+=
       "\n\t"
       "\nCOMMON_SETTINGS"
-      "\n\t-CL:peckms=27:pmkfr=1"
+      "\n\t-CL:pec=yes:pecbph=27"
       "\n\t-OUT:org=no"
-      "\n\t-KS:fenn=0.4:fexn=1.6:fer=1.9:fehr=8:fecr=20"
-      "\n\t-AL:egp=yes:egpl=0,0,100"
+      "\n\t-SK:fenn=0.4:fexn=1.6:fer=1.9:fehr=8:fecr=20"
       "\n\t"
-      "\nPCBIOHQ_SETTINGS"
+      "\nPACBIO_SETTINGS"
+      "\n\t-AL:egp=yes:egpl=reject_codongaps"
+      "\n\t-LR:lsd=yes:rns=fr:mxti=no:ft=fastq"
+      "\n\t-GE:uti=yes"
       "\n\t-AS:mrl=40:mrpc=5"
       "\n\t    urdcm=1.5:ardct=2.0:ardml=200:ardgl=20"
+      "\n\t-SB:ads=no:dsn=StrainX"
       "\n\t-DP:ure=no:rewl=15:rewme=2:feip=0;leip=0"
       "\n\t-CL:pvlc=no:qc=no:bsqc=no:emlc=no:mlcr=4:smlc=4:emrc=no:mrcr=10:smrc=15:mbc=yes:mbcgs=5:mbcmfg=12:mbcmeg=12"
-      "\n\t    msvsgs=8:msvsmfg=8:msvsmeg=12:msvssfc=0:msvssec=0:c3pp=no:cpat=no:lccf=yes:lccb=yes:ckar=no"
-      "\n\t    pec=no:pffreq=1:pbfreq=1:pffore=false:pbfore=false:pfcmst=false:pbcmst=false:pfsalp=false:pbsalp=false"
-      "\n\t-AL:ms=15:mo=17:mrs=70:bip=20:bmin=20:bmax=200"
+      "\n\t    msvs=no:msvsgs=8:msvsmfg=8:msvsmeg=12:msvssfc=0:msvssec=0:c3pp=no:cpat=no:lcc=yes:ckar=no"
+      "\n\t-AL:ms=15:mo=20:mrs=70:bip=20:bmin=20:bmax=200:egp=yes:egpl=reject_codongaps"
       "\n\t-CO:rodirs=30:mrpg=3:mnq=20:mgqrt=25:emea=10:amgb=no"
-      "\n\t    gor=66"
-      "\n\t-ED:ehpo=yes"
-      "\n\t-PF:uqr=yes:qrml1=80:qrms1=90:qrml2=60:qrms2=95:bqoml=80"
-      "\n\t-SK:pr=80"
-      ;
-  }
-
-  if(Pv[SEQTYPE_PACBIOLQ].MP_jobtechsettings){
-    // note: -CL:pec and -SK:kms set at end again to override all for PacBio LQ data
-    modestring+=
-      "\n\t"
-      "\nCOMMON_SETTINGS"
-      "\n\t-CL:pmkfr=1"
-      "\n\t-OUT:org=no"
-      "\n\t-SK:kms=6:mmhr=90"
-      "\n\t-KS:fenn=0.4:fexn=1.6:fer=1.9:fehr=8:fecr=20"
-      "\n\t-ED:mace=no"
-      "\n\t-AL:egp=no"
-      "\n\t"
-      "\nPCBIOLQ_SETTINGS"
-      "\n\t-AL:bip=50:bmax=1000:mrs=10"
-      "\n\t-AS:mrl=100:mrpc=2"
-      "\n\t    urdcm=1.5:ardct=2.0:ardml=200:ardgl=20"
-      "\n\t-DP:ure=no:rewl=15:rewme=2:feip=0;leip=0"
-      "\n\t-CO:rodirs=30:mrpg=6:mnq=20:mgqrt=25:emea=10:amgb=no"
-      "\n\t    gor=66"
-      "\n\t-CL"
-      "\n\t    pec=no:pffreq=1:pbfreq=1:pffore=false:pbfore=false:pfcmst=false:pbcmst=false:pfsalp=false:pbsalp=false"
-      "\n\t-ED:ehpo=no"
+      "\n\t    fnicpst=no:gor=66"
+      "\n\t-ED:ace=yes"
       "\n\t-PF:uqr=yes:qrml1=80:qrms1=90:qrml2=60:qrms2=95:bqoml=80"
       "\n\t-SK:pr=80"
-      "\n\t"
-      +noclipping_string;
       ;
   }
 
-
-  if(Pv[SEQTYPE_SOLEXA].MP_jobtechsettings){
+  if(hasSOLEXA){
     modestring+=
       "\n\t"
       "\nCOMMON_SETTINGS"
-      "\n\t-AS:sd=no:rbl=2:urd=no:ard=yes"
+      "\n\t-AS:nop=1:sd=no:rbl=1:urd=no:ard=yes"
       "\n\t-OUT:otc=yes:ort=no:org=no"
-      "\n\t-SK:kss=1:mchr=4096"
+      "\n\t-SK:bph=16:hss=1:mchr=4096"
       "\n\t-CO:mr=yes"
       "\n\t-PF:swcs=12"
-      "\n\t-CL:peckms=31:pmkfr=1"
-      "\n\t-KS:fenn=0.4:fexn=1.6:fer=1.9:fehr=8:fecr=20"
-      "\n\t-KS:rkfk=0"
-      "\n\t-AL:egp=yes:egpl=0,0,100"
+      "\n\t-CL:pecbph=31"
+      "\n\t-SK:fenn=0.4:fexn=1.6:fer=1.9:fehr=8:fecr=20"
       "\n\t"
       "\nSOLEXA_SETTINGS"
       "\n\t-OUT:sssip=no:stsip=no"
+      "\n\t-LR:lsd=yes:rns=solexa:ft=fastq"
       "\n\t-AS:mrl=20:mrpc=10"
       "\n\t    urdcm=1.5:ardct=2.5:ardml=300:ardgl=20"
+      "\n\t-SB:ads=no:dsn=StrainX"
+      "\n\t-GE:uti=yes"
       "\n\t-DP:ure=no"
       "\n\t-CL:pvlc=no:qc=no:bsqc=no:emlc=no:mlcr=0:smlc=0:mbc=no:mbcgs=5:mbcmfg=12:mbcmeg=12:mqtfer=5:mqtfernob=15"
-      "\n\t    spx174=true"
-      "\n\t    fpx174=no"
-      "\n\t    msvsgs=1:msvsmfg=2:msvsmeg=2:msvssfc=0:msvssec=0:cpat=no:lccf=no:lccb=no:ckar=yes"
-      "\n\t    c3pp=yes:c3ppmsl=15:c3ppmea=3:c3ppmgfe=9:cbse=yes"
-      // 27.04.2012 pbsalp=true is not good for Solexa due to GGCxG errors also very early in some reads
-      // 27.04.2012 pbfreq=1 is not good for Solexa due to identical GGCxG error patterns in multiple reads
-      //  i.e., for front and back clipping, only forward/reverse is good
-      //  (maybe pbfreq=1 for low coverage data?)
-      "\n\t    pec=yes:rkm=no:pffreq=0:pbfreq=0:pffore=yes:pbfore=yes:pfcmst=yes:pbcmst=yes:pfsalp=false:pbsalp=false"
-      // 29.08.2014: why do I have mo=25 here? I might want mo=17 ???
-      "\n\t-AL:ms=15:mo=17:mrs=90:bip=20:bmin=20:bmax=80"
+      "\n\t    msvsgs=1:msvsmfg=2:msvsmeg=2:msvssfc=0:msvssec=0:cpat=no:lcc=no:ckar=yes"
+      "\n\t    c3pp=yes:c3ppmsl=12:c3ppmea=2:c3ppmgfe=9"
+      "\n\t-AL:ms=15:mo=25:mrs=90:bip=20:bmin=20:bmax=80:egp=no"
       "\n\t-CO:rodirs=30:mrpg=4:mnq=20:mgqrt=30:emea=4:amgb=yes"
-      "\n\t    msr=yes:msrme=0:msrkceu=-1"
-      "\n\t-ED:ehpo=no"
+      "\n\t    fnicpst=no"
+      "\n\t    msr=yes:msrkceu=-1"
+      "\n\t-ED:ace=no"
       "\n\t-PF:uqr=yes:qrml1=-95:qrms1=100:qrml2=-85:qrms2=100:bqoml=20"
       "\n\t-SK:pr=90"
       ;
-    if(Pv[SEQTYPE_454GS20].MP_jobtechsettings){
+    if(has454){
       modestring+=
 	"\n\t"
 	"\nCOMMON_SETTINGS"
-	"\n\t-CL:peckms=27"
+	"\n\t-CL:pec=yes:pecbph=27"
 	;
     }
-    if(Pv[SEQTYPE_IONTORRENT].MP_jobtechsettings){
+    if(hasIONTOR){
       modestring+=
 	"\n\t"
 	"\nCOMMON_SETTINGS"
-	"\n\t-CL:peckms=27"
+	"\n\t-CL:pec=yes:pecbph=27"
 	;
     }
-    // TODO: PacBio LQ ?
-    if(Pv[SEQTYPE_PACBIOHQ].MP_jobtechsettings){
+    if(hasPACBIO){
       modestring+=
 	"\n\t"
 	"\nCOMMON_SETTINGS"
-	"\n\t-CL:peckms=27"
+	"\n\t-CL:pec=yes:pecbph=27"
 	;
     }
   }
 
-  if(Pv[SEQTYPE_ABISOLID].MP_jobtechsettings){
+  if(hasSOLID){
     modestring+=
       "\n\t"
       "\nCOMMON_SETTINGS"
       "\n\t"
       "\nSOLID_SETTINGS"
+      "\n\t-LR:lsd=yes:rns=fr"
       "\n\t-DP:ure=no"
       "\n\t-AS:mrl=30"
       "\n\t    urdcm=1.5:ardct=2.0:ardml=200:ardgl=20"
@@ -4730,10 +5103,10 @@ void MIRAParameters::interpretJobDefs(vector<MIRAParameters> & Pv, vector<vector
 
   if(jobdefs[JA_QUALITY].front()==MP_jobdef_draft){
     CEBUG("MP_jobdef_draft\n");
-    static const char g_draftonly[] =
+    static const char g_draftonly[] =	
       "\nCOMMON_SETTINGS"
-      "\n\t-AS:rbl=1:sd=no:ard=yes:urd=no"
-      "\n\t-SK:kss=8:pr=70:mhpr=200"
+      "\n\t-AS:nop=2:sep=no:rbl=1:sd=no:ard=yes:urd=no"
+      "\n\t-SK:bph=17:hss=8:pr=70:mhpr=200"
       "\n\t"
       "\n_SANGER_SETTINGS"
       "\n\t-DP:ure=no"
@@ -4743,12 +5116,13 @@ void MIRAParameters::interpretJobDefs(vector<MIRAParameters> & Pv, vector<vector
       ;
     modestring+=g_draftonly;
 
-    if(Pv[SEQTYPE_454GS20].MP_jobtechsettings) {
+    if(has454) {
       modestring+=
 	"\nCOMMON_SETTINGS"
-	"\n\t-AS:rbl=2"
+	"\n\t-AS:nop=3:rbl=2:sep=yes"
 	"\n"
 	"\n_454_SETTINGS"
+	"\n\t-ED:ace=yes"
 	"\n\t-AL:mrs=70"
 	"\n\t-DP:ure=no"
 	"\n\t-CL:emrc=no"
@@ -4756,12 +5130,14 @@ void MIRAParameters::interpretJobDefs(vector<MIRAParameters> & Pv, vector<vector
 	;
     }
 
-    if(Pv[SEQTYPE_IONTORRENT].MP_jobtechsettings) {
+    if(hasIONTOR) {
       modestring+=
 	"\nCOMMON_SETTINGS"
-	"\n\t-AS:rbl=2"
+	"\n\t-AS:nop=3:rbl=2:sep=yes"
+	"\n\t-SK:bph=21"
 	"\n"
 	"\n_IONTOR_SETTINGS"
+	"\n\t-ED:ace=yes"
 	"\n\t-AL:mrs=70:mo=21"
 	"\n\t-DP:ure=no"
 	"\n\t-CL:emrc=no"
@@ -4771,33 +5147,37 @@ void MIRAParameters::interpretJobDefs(vector<MIRAParameters> & Pv, vector<vector
 
   // TODO: adapt once PacBio data analysed
   // template from 454
-    if(Pv[SEQTYPE_PACBIOHQ].MP_jobtechsettings || Pv[SEQTYPE_PACBIOLQ].MP_jobtechsettings) {
-      // TODO: PacBio HQ only atm
+    if(hasPACBIO) {
       modestring+=
 	"\nCOMMON_SETTINGS"
-	"\n\t-AS:rbl=2"
+	"\n\t-AS:nop=3:rbl=2:sep=yes"
 	"\n"
+	"\n_PACBIO_SETTINGS"
+	"\n\t-ED:ace=yes"
+	"\n\t-AL:mrs=70"
+	"\n\t-DP:ure=no"
+	"\n\t-CL:emrc=no"
+	"\n\t-SK:pr=90"
 	;
     }
 
-    if(Pv[SEQTYPE_SOLEXA].MP_jobtechsettings) {
-      // TODO: PacBio ??? LQ?
-      if(Pv[SEQTYPE_SANGER].MP_jobtechsettings || Pv[SEQTYPE_454GS20].MP_jobtechsettings || Pv[SEQTYPE_PACBIOHQ].MP_jobtechsettings || Pv[SEQTYPE_IONTORRENT].MP_jobtechsettings) {
+    if(hasSOLEXA) {
+      if(hasSANGER || has454 || hasPACBIO || hasIONTOR) {
 	modestring+=
 	  "\nCOMMON_SETTINGS"
-	  "\n\t-SK:pr=85:kss=4"
+	  "\n\t-SK:pr=85:hss=4"
 	  "\n_454_SETTINGS"
 	  "\n\t-SK:pr=85"
 	  "\n_IONTOR_SETTINGS"
 	  "\n\t-SK:pr=85"
-	  "\n_PCBIOHQ_SETTINGS"
+	  "\n_PACBIO_SETTINGS"
 	  "\n\t-SK:pr=85"
 	  ;
       }else{
 	modestring+=
 	  "\nCOMMON_SETTINGS"
-	  "\n\t-AS:rbl=2"
-	  "\n\t-SK:kss=4"
+	  "\n\t-AS:nop=1:rbl=1:sep=yes"
+	  "\n\t-SK:hss=4"
 	  "\n_SOLEXA_SETTINGS"
 	  "\n\t-SK:pr=90"
 	  ;
@@ -4808,20 +5188,20 @@ void MIRAParameters::interpretJobDefs(vector<MIRAParameters> & Pv, vector<vector
     CEBUG("not MP_jobdef_draft\n");
     static const char g_level23[]=
       "\nCOMMON_SETTINGS"
-      "\n\t-AS:sd=yes:sdlpo=yes"
+      "\n\t-AS:sep=yes:sd=yes:sdlpo=yes"
       "\n\t"
       "\n_SANGER_SETTINGS"
       "\n\t-DP:ure=yes:feip=0;leip=0"
       "\n\t-CL:pvlc=yes:pvcmla=18"
-      ;
+      ;    
     modestring+=g_level23;
 
     if(jobdefs[JA_QUALITY].front()==MP_jobdef_normal){
       CEBUG("MP_jobdef_normal\n");
-      static const char g_normalonly[] =
+      static const char g_normalonly[] =	
 	"\nCOMMON_SETTINGS"
-	"\n\t-AS:rbl=2:urdsip=3"
-	"\n\t-SK:kss=4:pr=70:mhpr=2000"
+	"\n\t-AS:nop=3:rbl=2:urdsip=3"
+	"\n\t-SK:bph=17:hss=4:pr=70:mhpr=2000"
 	"\n\t"
 	"\n_SANGER_SETTINGS"
 	"\n\t-AL:bip=15:bmin=25:bmax=100"
@@ -4829,29 +5209,32 @@ void MIRAParameters::interpretJobDefs(vector<MIRAParameters> & Pv, vector<vector
 	;
       modestring+=g_normalonly;
 
-      if(Pv[SEQTYPE_454GS20].MP_jobtechsettings) {
+      if(has454) {
 	modestring+=
 	  "\nCOMMON_SETTINGS"
-	  "\n\t-AS:rbl=2:urdsip=3"
+	  "\n\t-AS:nop=4:rbl=2:sep=yes:urdsip=3"
 	  "\n"
 	  "\n_SANGER_SETTINGS"
 	  "\n\t-AL:mrs=70"
 	  "\n"
 	  "\n_454_SETTINGS"
+	  "\n\t-ED:ace=yes"
 	  "\n\t-AL:mrs=70"
 	  "\n\t-SK:pr=80"
 	  ;
       }
 
-      if(Pv[SEQTYPE_IONTORRENT].MP_jobtechsettings) {
+      if(hasIONTOR) {
 	modestring+=
 	  "\nCOMMON_SETTINGS"
-	  "\n\t-AS:rbl=2:urdsip=3"
+	  "\n\t-AS:nop=4:rbl=2:sep=yes:urdsip=3"
+	  "\n\t-SK:bph=19"
 	  "\n"
 	  "\n_SANGER_SETTINGS"
 	  "\n\t-AL:mrs=70"
 	  "\n"
 	  "\n_IONTOR_SETTINGS"
+	  "\n\t-ED:ace=yes"
 	  "\n\t-AL:mrs=70:mo=19"
 	  "\n\t-SK:pr=50"
 	  ;
@@ -4860,37 +5243,36 @@ void MIRAParameters::interpretJobDefs(vector<MIRAParameters> & Pv, vector<vector
 
       // TODO: adapt once PacBio data analysed
       // template from 454
-      if(Pv[SEQTYPE_PACBIOHQ].MP_jobtechsettings) {
-	// TODO: PacBio HQ atm
+      if(hasPACBIO) {
 	modestring+=
 	  "\nCOMMON_SETTINGS"
-	  "\n\t-AS:rbl=2:urdsip=3"
+	  "\n\t-AS:nop=4:rbl=2:sep=yes:urdsip=3"
 	  "\n"
 	  "\n_SANGER_SETTINGS"
 	  "\n\t-AL:mrs=70"
 	  "\n"
-	  "\n_PCBIOHQ_SETTINGS"
+	  "\n_PACBIO_SETTINGS"
+	  "\n\t-ED:ace=yes"
 	  "\n\t-AL:mrs=70"
 	  "\n\t-SK:pr=80"
 	  ;
       }
 
-      if(Pv[SEQTYPE_SOLEXA].MP_jobtechsettings) {
-	if(Pv[SEQTYPE_SANGER].MP_jobtechsettings || Pv[SEQTYPE_454GS20].MP_jobtechsettings || Pv[SEQTYPE_PACBIOHQ].MP_jobtechsettings) {
-	// TODO: PacBio HQ atm
+      if(hasSOLEXA) {
+	if(hasSANGER || has454 || hasPACBIO) {
 	  modestring+=
 	    "\nCOMMON_SETTINGS"
-	    "\n\t-SK:pr=85:kss=1"
+	    "\n\t-SK:pr=85:hss=1"
 	    "\n_454_SETTINGS"
 	    "\n\t-SK:pr=85"
-	    "\n_PCBIOHQ_SETTINGS"
+	    "\n_PACBIO_SETTINGS"
 	    "\n\t-SK:pr=85"
 	    ;
 	}else{
 	  modestring+=
 	    "\nCOMMON_SETTINGS"
-	    "\n\t-AS:rbl=2"
-	    "\n\t-SK:kss=1:mhpr=100"
+	    "\n\t-AS:nop=2:rbl=1:sep=yes"
+	    "\n\t-SK:bph=17:hss=1:mhpr=100"
 	    "\n"
 	    "\n_SOLEXA_SETTINGS"
 	    "\n\t-SK:pr=90"
@@ -4902,41 +5284,44 @@ void MIRAParameters::interpretJobDefs(vector<MIRAParameters> & Pv, vector<vector
       CEBUG("not MP_jobdef_draft ie MP_jobdef_accurate\n");
       static const char g_accurateonly[] =
 	"\nCOMMON_SETTINGS"
-	"\n\t-AS:rbl=2:urdsip=3"
-	"\n\t-SK:kss=1:pr=65:mhpr=2000"
+	"\n\t-AS:nop=4:rbl=2:urdsip=3"
+	"\n\t-SK:bph=21:hss=1:pr=65:mhpr=2000"
 	"\n_SANGER_SETTINGS"
 	"\n\t-AL:bip=20:bmin=25:bmax=130"
 	"\n\t-CO:rodirs=25"
 	;
-
+      
       modestring+=g_accurateonly;
 
-      if(Pv[SEQTYPE_454GS20].MP_jobtechsettings) {
+      if(has454) {
 	modestring+=
 	  "\nCOMMON_SETTINGS"
-	  "\n\t-AS:rbl=3:urdsip=4"
+	  "\n\t-AS:nop=5:rbl=3:sep=yes:urdsip=4"
 	  "\n"
 	  "\n_SANGER_SETTINGS"
 	  "\n\t-AL:mrs=70"
 	  "\n\t-SK:pr=70"
 	  "\n"
 	  "\n_454_SETTINGS"
+	  "\n\t-ED:ace=yes"
 	  "\n\t-AL:mrs=70"
 	  "\n\t-SK:pr=80"
 	  ;
       }
 
 
-      if(Pv[SEQTYPE_IONTORRENT].MP_jobtechsettings) {
+      if(hasIONTOR) {
 	modestring+=
 	  "\nCOMMON_SETTINGS"
-	  "\n\t-AS:rbl=3:urdsip=4"
+	  "\n\t-AS:nop=5:rbl=3:sep=yes:urdsip=4"
+	  "\n\t-SK:bph=19"
 	  "\n"
 	  "\n_SANGER_SETTINGS"
 	  "\n\t-AL:mrs=70"
 	  "\n\t-SK:pr=70"
 	  "\n"
 	  "\n_IONTOR_SETTINGS"
+	  "\n\t-ED:ace=yes"
 	  "\n\t-AL:mrs=70:mo=19"
 	  "\n\t-SK:pr=50"
 	  ;
@@ -4944,40 +5329,39 @@ void MIRAParameters::interpretJobDefs(vector<MIRAParameters> & Pv, vector<vector
 
       // TODO: adapt once PacBio data analysed
       // template from 454
-      if(Pv[SEQTYPE_PACBIOHQ].MP_jobtechsettings) {
-	// TODO: PacBio HQ atm
+      if(hasPACBIO) {
 	modestring+=
 	  "\nCOMMON_SETTINGS"
-	  "\n\t-AS:rbl=3:urdsip=4"
+	  "\n\t-AS:nop=5:rbl=3:sep=yes:urdsip=4"
 	  "\n"
 	  "\n_SANGER_SETTINGS"
 	  "\n\t-AL:mrs=70"
 	  "\n\t-SK:pr=70"
 	  "\n"
-	  "\n_PCBIOHQ_SETTINGS"
+	  "\n_PACBIO_SETTINGS"
+	  "\n\t-ED:ace=yes"
 	  "\n\t-AL:mrs=70"
 	  "\n\t-SK:pr=80"
 	  ;
       }
 
-      if(Pv[SEQTYPE_SOLEXA].MP_jobtechsettings) {
-	if(Pv[SEQTYPE_SANGER].MP_jobtechsettings || Pv[SEQTYPE_454GS20].MP_jobtechsettings || Pv[SEQTYPE_PACBIOHQ].MP_jobtechsettings || Pv[SEQTYPE_IONTORRENT].MP_jobtechsettings) {
-	  // TODO: PacBio HQ atm
+      if(hasSOLEXA) {
+	if(hasSANGER || has454 || hasPACBIO || hasIONTOR) {
 	  modestring+=
 	    "\nCOMMON_SETTINGS"
-	    "\n\t-SK:pr=85:kss=1"
+	    "\n\t-SK:pr=85:bph=19:hss=1"
 	    "\n_454_SETTINGS"
 	    "\n\t-SK:pr=85"
 	    "\n_IONTOR_SETTINGS"
 	    "\n\t-SK:pr=85"
-	    "\n_PCBIOHQ_SETTINGS"
+	    "\n_PACBIO_SETTINGS"
 	    "\n\t-SK:pr=85"
 	    ;
 	}else{
 	  modestring+=
 	    "\nCOMMON_SETTINGS"
-	    "\n\t-AS:rbl=2"
-	    "\n\t-SK:kss=1:mhpr=2000"
+	    "\n\t-AS:nop=3:rbl=1:sep=yes"
+	    "\n\t-SK:bph=17:hss=1:mhpr=2000"
 	    "\n_SOLEXA_SETTINGS"
 	    "\n\t-SK:pr=95"
 	    ;
@@ -4991,96 +5375,243 @@ void MIRAParameters::interpretJobDefs(vector<MIRAParameters> & Pv, vector<vector
 
     CEBUG("MP_jobdef_mapping\n");
 
-    addModifiersForMapping(modestring, jobdefs, Pv, hasSHORTREADS);
-  }
+    modestring+=
+      "\n\t"
+      "\nCOMMON_SETTINGS"
+      "\n\t-OUT:otc=yes:ort=no"
+      "\n\t-AS:ard=yes:urd=no:nop=1:rbl=1"
+      "\n\t-CL:ascdc=no"
+      "\n\t-SB:lb=yes:bft=fasta:sbuip=1:brl=0:bro=0:abnc=no"
+      "\n\t-SK:bph=16:hss=4:pr=60:mnr=no:mhpr=1000"
+      "\n\t-CO:mr=yes"
+      "\n\t-PF:swcs=12"
+      ;
 
-  //
-  // settings for EST / RNASeq
-  //
+    if(jobdefs[JA_QUALITY].front()==MP_jobdef_accurate){
+      modestring+=
+	"\n\t"
+	"\nCOMMON_SETTINGS"
+	"\n\t-SK:swcob=yes";
+    }
+
+    if(hasSANGER){
+      modestring+=
+	"\nSANGER_SETTINGS"
+	"\n\t-SB:ads=yes";
+    }
+    if(has454){
+      modestring+=
+	"\n454_SETTINGS"
+	"\n\t-SB:ads=yes";
+    }
+    if(hasIONTOR){
+      modestring+=
+	"\nIONTOR_SETTINGS"
+	"\n\t-SB:ads=yes";
+    }
+    if(hasSOLEXA){
+      modestring+=
+	"\n\t"
+	"\nCOMMON_SETTINGS"
+	"\n\t-SK:bph=17:hss=1:pr=60"
+	"\n\t-CO:mr=yes"
+	"\n\t-PF:swcs=12"
+	"\n\t"
+	"\nSOLEXA_SETTINGS"
+	"\n\t-LR:rns=solexa"
+	"\n\t-AS:mrl=20"
+	"\n\t    urdcm=1.5:ardct=2.0:ardml=200:ardgl=20"
+	"\n\t-GE:uti=no"
+	"\n\t-DP:ure=no"
+	"\n\t-SB:ads=yes"
+	"\n\t-CL:pvlc=no:qc=no:bsqc=no:emlc=no:mlcr=0:smlc=0:mbc=no:mbcgs=5:mbcmfg=12:mbcmeg=12"
+	"\n\t    msvsgs=1:msvsmfg=2:msvsmeg=2:msvssfc=0:msvssec=0:cpat=no:mqtfer=0"
+	"\n\t-AL:ms=15:mo=20:mrs=80:bip=20:bmin=20:bmax=80:egp=no"
+	"\n\t-CO:rodirs=30:mrpg=3:mnq=20:mgqrt=30:emea=4:amgb=yes"
+	"\n\t    fnicpst=no"
+	"\n\t-ED:ace=no"
+	"\n\t-PF:uqr=yes:qrml1=-90:qrms1=100:qrml2=-80:qrms2=100:bqoml=20"
+	"\n\t-SK:pr=60"
+	;
+      // moved to general mapping above.
+      //if(!hasSANGER && !has454 && !hasPACBIO){
+      //	modestring+=
+      //	  "\nCOMMON_SETTINGS"
+      //	  "\n\t-AS:nop=1"
+      //	  ;
+      //}
+      if(hasPACBIO){
+	modestring+=
+	  "\nPACBIO_SETTINGS"
+	  "\n\t-SB:ads=yes";
+      }
+    }
+
+    modestring+=
+      "\nCOMMON_SETTINGS";
+
+    // also take care of brl by checking which sequencing types are used
+    if(hasSHORTREADS){
+      // TODO: check good brl length
+      modestring+=
+	"\nCOMMON_SETTINGS"
+	"\n\t-SB:sbuip=0:brl=0:abnc=no"
+	"\n\t-CO:mroir=yes";
+      if(hasSOLEXA){
+	if(jobdefs[JA_QUALITY].front()==MP_jobdef_draft){
+	  modestring+=
+	    "\nCOMMON_SETTINGS"
+	    "\n\t-SB:bro=0"
+	    "\n\t-SK:mhpr=1000"
+	    "\n_SANGER_SETTINGS"
+	    "\n\t-SK:pr=70"
+	    "\n_454_SETTINGS"
+	    "\n\t-SK:pr=70"
+	    "\n_IONTOR_SETTINGS"
+	    "\n\t-SK:pr=70"
+	    "\n_PACBIO_SETTINGS"
+	    "\n\t-SK:pr=70"
+	    "\n_SOLEXA_SETTINGS"
+	    "\n\t-AL:mrs=70"
+	    "\n\t-CO:msr=yes"
+	    "\n\t-SK:pr=90"
+	    ;
+	}else if(jobdefs[JA_QUALITY].front()==MP_jobdef_normal){
+	  if(!hasSANGER && !has454 && !hasIONTOR) modestring+="\nCOMMON_SETTINGS\n-SK:bph=12:hss=1:mhpr=1500";
+	  modestring+=
+	    "\nCOMMON_SETTINGS"
+	    "\n\t-SB:brl=0:bro=0"
+	    "\n_SANGER_SETTINGS"
+	    "\n\t-SK:pr=60"
+	    "\n_454_SETTINGS"
+	    "\n\t-SK:pr=60"
+	    "\n_IONTOR_SETTINGS"
+	    "\n\t-SK:pr=60"
+	    "\n_PACBIO_SETTINGS"
+	    "\n\t-SK:pr=60"
+	    "\n_SOLEXA_SETTINGS"
+	    "\n\t-AL:mrs=75"
+	    "\n\t-CO:msr=yes"
+	    "\n\t-SK:pr=75"
+	    ;
+	}else{
+	  if(!hasSANGER && !has454 && !hasPACBIO) modestring+="\nCOMMON_SETTINGS\n-SK:bph=10:hss=1:mhpr=2000";
+	  modestring+=
+	    "\nCOMMON_SETTINGS"
+	    "\n\t-SB:brl=0:bro=0"
+	    "\n_SANGER_SETTINGS"
+	    "\n\t-SK:pr=60"
+	    "\n_454_SETTINGS"
+	    "\n\t-SK:pr=60"
+	    "\n_IONTOR_SETTINGS"
+	    "\n\t-SK:pr=60"
+	    "\n_PACBIO_SETTINGS"
+	    "\n\t-SK:pr=60"
+	    "\n_SOLEXA_SETTINGS"
+	    "\n\t-AL:mrs=60"
+	    "\n\t-CO:msr=yes"
+	    "\n\t-SK:pr=60"
+	    ;
+	}
+      }else{
+	if(jobdefs[JA_QUALITY].front()==MP_jobdef_draft){
+	  modestring+="\n\t-SB:bro=20";
+	}else if(jobdefs[JA_QUALITY].front()==MP_jobdef_normal){
+	  modestring+="\n\t-SB:bro=35";
+	  if(!hasSANGER && !has454 && !hasPACBIO && !hasIONTOR) modestring+="\n\n-SK:bph=12";
+	}else{
+	  modestring+="\n\t-SB:bro=40";
+	  if(!hasSANGER && !has454 && !hasPACBIO && !hasIONTOR) modestring+="\n\n-SK:bph=10";
+	}
+      }
+    }else if(has454 || hasPACBIO){
+      // dumb idea to set abnc=yes automatically ... users don't expect that
+      //if(jobdefs[JA_QUALITY].front()==MP_jobdef_draft){
+      //	modestring+="\n\t-SB:sbuip=0:abnc=no";
+      //}else if(jobdefs[JA_QUALITY].front()==MP_jobdef_normal){
+      //	modestring+="\n\t-SB:sbuip=0:abnc=no";
+      //}else{
+      //	modestring+="\n\t-SB:sbuip=1:abnc=yes";
+      //}
+      modestring+="\n\t-SB:brl=0:bro=0"
+	"\n\t-SB:sbuip=0;abnc=no";
+    }else{
+      modestring+="\n\t-SB:brl=0:bro=0"
+	"\n\t-SB:sbuip=0;abnc=no";
+      //if(jobdefs[JA_QUALITY].front()==MP_jobdef_draft){
+      //	modestring+="\n\t-SB:sbuip=0;abnc=no";
+      //}else if(jobdefs[JA_QUALITY].front()==MP_jobdef_normal){
+      //	modestring+="\n\t-SB:sbuip=0;abnc=no";
+      //}else{
+      //	modestring+="\n\t-SB:sbuip=0;abnc=no";
+      //}
+    }
+  }
 
   string estbasesettings=
     "\nCOMMON_SETTINGS"
-    "\n\t-GE:crkf=no"
+    "\n\t-GE:crhf=no"
     "\n\t-MI:lcs=500:lcs4s=1000"
-    "\n\t-AS:sd=no:ard=no:urd=no:ugpf=no:uess=yes:esspd=500:umcbt=yes:bts=360"
-    "\n\t-CL:peckms=25:ascdc=no:asjdc=no:gbcdc=yes:kjd=yes:kjck=yes"
-    "\n\t-SK:mhpr=30:mhc=250000"
-    "\n\t-KS:ldn=yes:mnr=yes:fcem=30:nrc=200"
+    "\n\t-AS:sd=no:ard=no:urd=no:klrs=no:ugpf=no:uess=yes:esspd=500:umcbt=yes:bts=3600"
+    "\n\t-CL:pec=no:pecbph=17:ascdc=no:asjdc=no"
+    "\n\t-SK:mhpr=30:mnr=yes"
     "\n\t-OUT:orw=no"
-    "\n\t-AL:egp=yes"
     ;
-  if(Pv[SEQTYPE_SANGER].MP_jobtechsettings){
+  if(hasSANGER){
     estbasesettings+=
       "\nSANGER_SETTINGS"
       "\n\t-AS:mrpc=2"
-      "\n\t-AL:mrs=85"
+      "\n\t-AL:mrs=85:egp=yes:egpl=reject_codongaps"
       "\n\t-DP:ure=no"
-      "\n\t-CL:pvlc=no:qc=yes:bsqc=no:mbc=yes:c3pp=no:emlc=no:emrc=no:mqtfer=0:mqtfernob=0"
-      "\n\t    cpat=yes:cpkps=yes:cpmsl=12:cpmea=1:cpmgfe=20000"
-      "\n\t    pec=no"
+      "\n\t-CL:msvs=no:pvlc=no:qc=yes:bsqc=no:mbc=yes:c3pp=no:emlc=no:emrc=no:mqtfer=0:mqtfernob=0"
+      "\n\t    cpat=yes:cpkps=no:cpmsl=12:cpmea=1:cpmgfe=20000"
       "\n\t-CO:rodirs=10"
       ;
   }
-  if(Pv[SEQTYPE_454GS20].MP_jobtechsettings) {
+  if(has454) {
     estbasesettings+=
       "\n454_SETTINGS"
       "\n\t-AS:mrpc=2"
-      "\n\t-AL:mrs=80"
-      "\n\t-CL:pvlc=no:qc=no:bsqc=no:mbc=yes:c3pp=no:emlc=no:emrc=no:mqtfer=0:mqtfernob=0"
-      "\n\t    cpat=yes:cpkps=yes:cpmsl=12:cpmea=1:cpmgfe=20000"
-      "\n\t    pec=no"
+      "\n\t-AL:mrs=80:egp=yes:egpl=reject_codongaps"
+      "\n\t-CL:msvs=no:pvlc=no:qc=no:bsqc=no:mbc=yes:c3pp=no:emlc=no:emrc=no:mqtfer=0:mqtfernob=0"
+      "\n\t    cpat=yes:cpkps=no:cpmsl=12:cpmea=1:cpmgfe=20000"
       "\n\t-CO:rodirs=15"
       ;
   }
-  if(Pv[SEQTYPE_IONTORRENT].MP_jobtechsettings) {
+  if(hasIONTOR) {
     estbasesettings+=
       "\nIONTOR_SETTINGS"
       "\n\t-AS:mrpc=2"
-      "\n\t-AL:mrs=80"
-      "\n\t-CL:pvlc=no:qc=no:bsqc=no:mbc=yes:c3pp=no:emlc=no:emrc=no:mqtfer=0:mqtfernob=0"
-      "\n\t    cpat=yes:cpkps=yes:cpmsl=12:cpmea=1:cpmgfe=20000"
-      "\n\t    pec=no"
+      "\n\t-AL:mrs=80:egp=yes:egpl=reject_codongaps"
+      "\n\t-CL:msvs=no:pvlc=no:qc=no:bsqc=no:mbc=yes:c3pp=no:emlc=no:emrc=no:mqtfer=0:mqtfernob=0"
+      "\n\t    cpat=yes:cpkps=no:cpmsl=12:cpmea=1:cpmgfe=20000"
       "\n\t-CO:rodirs=15"
       ;
   }
-  if(Pv[SEQTYPE_SOLEXA].MP_jobtechsettings) {
+  if(hasSOLEXA) {
     estbasesettings+=
       "\nCOMMON_SETTINGS"
-      "\n\t-CL:peckms=31:pmkfr=1:pmtk=3:ascdc=yes"
+      "\n\t-AS:nop=3:rbl=1"
+      "\n\t-CL:pec=yes:pecbph=31:ascdc=yes"
       "\nSOLEXA_SETTINGS"
       "\n\t-AS:mrpc=4"
-      "\n\t-AL:mrs=90"
-      "\n\t-CL:pvlc=no:qc=no:bsqc=no:mbc=yes:emlc=no:emrc=no:mqtfer=5:mqtfernob=15"
-      "\n\t    spx174=yes:fpx174=yes"
-      "\n\t    cpat=yes:cpkps=yes:cpmsl=15:cpmea=1:cpmgfe=20000"
-      "\n\t    c3pp=yes:c3ppmsl=15:c3ppmea=3:c3ppmgfe=9"
-      "\n\t    pec=yes:rkm=no"
+      "\n\t-AL:mrs=90:egp=yes:egpl=reject_codongaps"
+      "\n\t-CL:msvs=no:pvlc=no:qc=no:bsqc=no:mbc=yes:emlc=no:emrc=no:mqtfer=5:mqtfernob=15"
+      "\n\t    cpat=yes:cpkps=no:cpmsl=15:cpmea=1:cpmgfe=20000"
+      "\n\t    c3pp=yes:c3ppmsl=12:c3ppmea=2:c3ppmgfe=9"
       "\n\t-CO:rodirs=15"
       ;
   }
-  if(Pv[SEQTYPE_PACBIOHQ].MP_jobtechsettings) {
+  if(hasPACBIO) {
     estbasesettings+=
-      "\nPCBIOHQ_SETTINGS"
+      "\nPACBIO_SETTINGS"
       "\n\t-AS:mrpc=2"
-      "\n\t-AL:mrs=85"
+      "\n\t-AL:mrs=85:egp=yes:egpl=reject_codongaps"
       "\n\t-DP:ure=no"
-      "\n\t-CL:pvlc=no:qc=yes:bsqc=no:mbc=yes:c3pp=no:cpat=yes:cpkps=yes:cpmsl=12:cpmea=1:cpmgfe=20000:emlc=no:emrc=no:mqtfer=0:mqtfernob=0"
+      "\n\t-CL:msvs=no:pvlc=no:qc=yes:bsqc=no:mbc=yes:c3pp=no:cpat=yes:cpkps=no:cpmsl=12:cpmea=1:cpmgfe=20000:emlc=no:emrc=no:mqtfer=0:mqtfernob=0"
       "\n\t-CO:rodirs=10"
       ;
   }
-  // TODO: PacBio LQ?
-  if(Pv[SEQTYPE_PACBIOLQ].MP_jobtechsettings) {
-    estbasesettings+=
-      "\nPCBIOLQ_SETTINGS"
-      "\n\t-AS:mrpc=2"
-      "\n\t-DP:ure=no"
-      "\n\t-CL:pvlc=no:qc=yes:bsqc=no:mbc=yes:c3pp=no:cpat=yes:cpkps=yes:cpmsl=12:cpmea=1:cpmgfe=20000:emlc=no:emrc=no:mqtfer=0:mqtfernob=0"
-      "\n\t-CO:rodirs=30"
-      ;
-  }
-  if(!jobdefs[JA_METHOD].empty() && jobdefs[JA_METHOD].front()==MP_jobdef_mapping){
-    addModifiersForMapping(estbasesettings, jobdefs, Pv, hasSHORTREADS);
-  }
 
   switch(jobdefs[JA_TYPE].front()){
     case MP_jobdef_genome : {
@@ -5091,13 +5622,6 @@ void MIRAParameters::interpretJobDefs(vector<MIRAParameters> & Pv, vector<vector
     case MP_jobdef_est : {
       CEBUG("MP_jobdef_est\n");
       modestring+=estbasesettings;
-      // give Sanger and 454 Sequences a bit more maximum time (longer sequences)
-      if(Pv[SEQTYPE_SANGER].MP_jobtechsettings || Pv[SEQTYPE_454GS20].MP_jobtechsettings){
-	modestring+=
-	  "\nCOMMON_SETTINGS"
-	  "\n\t-AS:bts=720"
-	  ;
-      }
       break;
     }
     case MP_jobdef_estsnppipeline1 : {
@@ -5106,46 +5630,42 @@ void MIRAParameters::interpretJobDefs(vector<MIRAParameters> & Pv, vector<vector
       modestring+=
 	"\nCOMMON_SETTINGS"
 	"\n\t-GE:proout=step1:esps=1"
-	"\n\t-AS:rbl=4"
+	"\n\t-SB:lsd=yes:lb=no"
+	"\n\t-AS:nop=2:rbl=4"
 	"\n\t-CO:mr=yes:mroir=no:asir=no"
 	"\n\t-OUT:orc=yes:orf=yes:org=no:ora=no:ort=no:orh=no"
-	"\n\t-ED:mace=no"
 	;
 
-      if(Pv[SEQTYPE_SANGER].MP_jobtechsettings){
+      if(hasSANGER){
 	modestring+=
 	  "\nSANGER_SETTINGS"
-	  "\n\t-AL:ms=15:mo=17:mrs=65"
-	  "\n\t-CO:emea=15:rodirs=20:amgb=yes:amgbemc=yes:amgbnbs=yes"
-	  ;
-      }
-      // TODO: PacBio LQ?
-      if(Pv[SEQTYPE_PACBIOLQ].MP_jobtechsettings) {
-	modestring+=
-	  "\nPCBIOLQ_SETTINGS"
-	  "\n\t-AL:ms=15:mo=17:mrs=10"
+	  "\n\t-AL:ms=15:mo=17:mrs=65:egpl=low"
 	  "\n\t-CO:emea=15:rodirs=20:amgb=yes:amgbemc=yes:amgbnbs=yes"
+	  "\n\t-ED:ace=no"
 	  ;
       }
-      if(Pv[SEQTYPE_PACBIOHQ].MP_jobtechsettings) {
+      if(hasPACBIO) {
 	modestring+=
-	  "\nPCBIOHQ_SETTINGS"
-	  "\n\t-AL:ms=15:mo=17:mrs=65"
+	  "\nPACBIO_SETTINGS"
+	  "\n\t-AL:ms=15:mo=17:mrs=65:egpl=low"
 	  "\n\t-CO:emea=15:rodirs=20:amgb=yes:amgbemc=yes:amgbnbs=yes"
+	  "\n\t-ED:ace=no"
 	  ;
       }
-      if(Pv[SEQTYPE_454GS20].MP_jobtechsettings) {
+      if(has454) {
 	modestring+=
 	  "\n454_SETTINGS"
-	  "\n\t-AL:ms=15:mo=17:mrs=65"
+	  "\n\t-AL:ms=15:mo=17:mrs=65:egpl=low"
 	  "\n\t-CO:emea=5:rodirs=25:amgb=no"
+	  "\n\t-ED:ace=no"
 	  ;
       }
-      if(Pv[SEQTYPE_IONTORRENT].MP_jobtechsettings) {
+      if(hasIONTOR) {
 	modestring+=
 	  "\nIONTOR_SETTINGS"
-	  "\n\t-AL:ms=15:mo=17:mrs=65"
+	  "\n\t-AL:ms=15:mo=17:mrs=65:egpl=low"
 	  "\n\t-CO:emea=5:rodirs=25:amgb=no"
+	  "\n\t-ED:ace=no"
 	  ;
       }
       break;
@@ -5156,51 +5676,50 @@ void MIRAParameters::interpretJobDefs(vector<MIRAParameters> & Pv, vector<vector
       modestring+=
 	"\nCOMMON_SETTINGS"
 	"\n\t-GE:proout=step2:esps=2"
-	"\n\t-AS:rbl=7"
-	"\n\t-CO:mr=yes:mroir=no:asir=no:fnic=yes"
+	"\n\t-SB:lsd=yes:lb=no"
+	"\n\t-AS:nop=3:rbl=7"
+	"\n\t-CO:mr=yes:mroir=no:asir=no"
 	"\n\t-OUT:orc=yes:orf=yes:org=no:ora=no:ort=no:orh=no"
-	"\n\t-ED:mace=no"
-	"\n\t-AL:egp=yes:egpl=0,0,100"
+	"\nSANGER_SETTINGS"
+	"\n\t-LR:lsd=yes:ft=caf" 
 	;
-      if(Pv[SEQTYPE_SANGER].MP_jobtechsettings){
+      if(hasSANGER){
 	modestring+=
 	  "\nSANGER_SETTINGS"
 	  "\n\t" + noclipping_string +
-	  "\n\t-AL:ms=30:mo=30:mrs=75"
-	  "\n\t-CO:emea=15:rodirs=10:amgb=yes:amgbemc=yes:amgbnbs=yes"
+	  "\n\t-AL:ms=30:mo=30:mrs=75:egpl=reject_codongaps"
+	  "\n\t-CO:emea=15:rodirs=10:amgb=yes:amgbemc=yes:amgbnbs=yes:fnicpst=yes"
+	  "\n\t-ED:ace=yes"
 	  ;
       }
-      if(Pv[SEQTYPE_PACBIOHQ].MP_jobtechsettings){
+      if(hasPACBIO){
 	modestring+=
-	  "\nPCBIOHQ_SETTINGS"
+	  "\nPACBIO_SETTINGS"
+	  "\n\t-LR:lsd=no" 
 	  "\n\t" + noclipping_string +
-	  "\n\t-AL:ms=30:mo=30:mrs=75"
-	  "\n\t-CO:emea=15:rodirs=10:amgb=yes:amgbemc=yes:amgbnbs=yes"
+	  "\n\t-AL:ms=30:mo=30:mrs=75:egpl=reject_codongaps"
+	  "\n\t-CO:emea=15:rodirs=10:amgb=yes:amgbemc=yes:amgbnbs=yes:fnicpst=yes"
+	  "\n\t-ED:ace=yes"
 	  ;
       }
-      // TODO: PacBio LQ ?
-      if(Pv[SEQTYPE_PACBIOLQ].MP_jobtechsettings){
-	modestring+=
-	  "\nPCBIOLQ_SETTINGS"
-	  "\n\t" + noclipping_string +
-	  "\n\t-AL:ms=30:mo=30:mrs=10"
-	  "\n\t-CO:emea=15:rodirs=10:amgb=yes:amgbemc=yes:amgbnbs=yes"
-	  ;
-      }
-      if(Pv[SEQTYPE_454GS20].MP_jobtechsettings){
+      if(has454){
 	modestring+=
 	  "\n454_SETTINGS"
+	  "\n\t-LR:lsd=no"
 	  "\n\t" + noclipping_string +
-	  "\n\t-AL:ms=30:mo=30:mrs=75"
-	  "\n\t-CO:emea=5:rodirs=15:amgb=no"
+	  "\n\t-AL:ms=30:mo=30:mrs=75:egpl=reject_codongaps"
+	  "\n\t-CO:emea=5:rodirs=15:amgb=no:fnicpst=yes"
+	  "\n\t-ED:ace=yes"
 	  ;
       }
-      if(Pv[SEQTYPE_IONTORRENT].MP_jobtechsettings){
+      if(hasIONTOR){
 	modestring+=
 	  "\nIONTOR_SETTINGS"
+	  "\n\t-LR:lsd=no"
 	  "\n\t" + noclipping_string +
-	  "\n\t-AL:ms=30:mo=30:mrs=75"
-	  "\n\t-CO:emea=5:rodirs=15:amgb=no"
+	  "\n\t-AL:ms=30:mo=30:mrs=75:egpl=reject_codongaps"
+	  "\n\t-CO:emea=5:rodirs=15:amgb=no:fnicpst=yes"
+	  "\n\t-ED:ace=yes"
 	  ;
       }
       break;
@@ -5212,51 +5731,50 @@ void MIRAParameters::interpretJobDefs(vector<MIRAParameters> & Pv, vector<vector
 	"\nCOMMON_SETTINGS"
 	"\n\t-GE:proout=step3:esps=3"
 	"\n\t-FN:cafin=step2_reads.caf:straindatain=step2_straindata_in.txt"
-	"\n\t-AS:rbl=1"
+	"\n\t-SB:lsd=yes:lb=no"
+	"\n\t-AS:nop=1:rbl=1"
 	"\n\t-CO:mr=yes:mroir=no:asir=yes"
 	"\n\t-OUT:orc=yes:orf=yes:org=no:ora=no:ort=no:orh=no"
-	"\n\t-ED:mace=no"
-	"\n\t-AL:egp=yes:egpl=0,0,0,0,0,0,0,0,0,0,0,0,0,0,100"  // 15 gaps, reject if 5 codons or more as gap
+	"\nSANGER_SETTINGS"
+	"\n\t-LR:lsd=yes:ft=caf"
 	;
-	if(Pv[SEQTYPE_SANGER].MP_jobtechsettings){
+	if(hasSANGER){
 	  modestring+=
 	    "\nSANGER_SETTINGS"
 	    "\n\t" + noclipping_string +
-	    "\n\t-AL:ms=30:mo=30:mrs=70"
+	    "\n\t-AL:ms=30:mo=30:mrs=70:egpl=low"
 	    "\n\t-CO:rodirs=12:mrpg=1:emea=3:amgb=yes:amgbemc=yes:amgbnbs=yes"
+	    "\n\t-ED:ace=no"
 	    ;
 	}
-	// TODO: PacBio LQ ?
-	if(Pv[SEQTYPE_PACBIOLQ].MP_jobtechsettings){
+	if(hasPACBIO){
 	  modestring+=
-	    "\nPCBIOLQ_SETTINGS"
+	    "\nPACBIO_SETTINGS"
 	    "\n\t" + noclipping_string +
-	    "\n\t-AL:ms=30:mo=30:mrs=70"
+	    "\n\t-AL:ms=30:mo=30:mrs=70:egpl=low"
 	    "\n\t-CO:rodirs=12:mrpg=1:emea=3:amgb=yes:amgbemc=yes:amgbnbs=yes"
+	    "\n\t-LR:lsd=no"
+	    "\n\t-ED:ace=no"
 	    ;
 	}
-	if(Pv[SEQTYPE_PACBIOHQ].MP_jobtechsettings){
-	  modestring+=
-	    "\nPCBIOHQ_SETTINGS"
-	    "\n\t" + noclipping_string +
-	    "\n\t-AL:ms=30:mo=30:mrs=70"
-	    "\n\t-CO:rodirs=12:mrpg=1:emea=3:amgb=yes:amgbemc=yes:amgbnbs=yes"
-	    ;
-	}
-	if(Pv[SEQTYPE_454GS20].MP_jobtechsettings){
+	if(has454){
 	  modestring+=
 	    "\n454_SETTINGS"
 	    "\n\t" + noclipping_string +
-	    "\n\t-AL:ms=30:mo=30:mrs=70"
+	    "\n\t-AL:ms=30:mo=30:mrs=70:egpl=low"
 	    "\n\t-CO:rodirs=12:mrpg=1:emea=3:amgb=yes:amgbemc=yes:amgbnbs=yes"
+	    "\n\t-LR:lsd=no"
+	    "\n\t-ED:ace=no"
 	    ;
 	}
-	if(Pv[SEQTYPE_IONTORRENT].MP_jobtechsettings){
+	if(hasIONTOR){
 	  modestring+=
 	    "\nIONTOR_SETTINGS"
 	    "\n\t" + noclipping_string +
-	    "\n\t-AL:ms=30:mo=30:mrs=70"
+	    "\n\t-AL:ms=30:mo=30:mrs=70:egpl=low"
 	    "\n\t-CO:rodirs=12:mrpg=1:emea=3:amgb=yes:amgbemc=yes:amgbnbs=yes"
+	    "\n\t-LR:lsd=no"
+	    "\n\t-ED:ace=no"
 	    ;
 	}
       break;
@@ -5264,27 +5782,7 @@ void MIRAParameters::interpretJobDefs(vector<MIRAParameters> & Pv, vector<vector
   default : {
   }
   }
-
-  // fragments at end for override of diginorm etc.
-  if(isfragments){
-    modestring+=
-      "\n\t"
-      "\nCOMMON_SETTINGS"
-      "\n\t-KS:mnr=no:ldn=no"
-      "\n\t-SK:mhpr=20000:fmh=no"
-      "\n\t";
-  }
-
-  if(Pv[SEQTYPE_PACBIOLQ].MP_jobtechsettings){
-    // note: -CL:pec and -SK:kms set at end again to override all for PacBio LQ data
-    modestring+=
-      "\n\t"
-      "\nCOMMON_SETTINGS"
-      "\n\t-SK:kms=6:mmhr=90"
-      "\n\t";
-  }
-
-
+  
   CEBUG("Standard settings after quality, method and type lookup:" << modestring << endl);
 
   parseQuickmode(modestring.c_str(), "JobDefs", Pv, false);
@@ -5293,199 +5791,8 @@ void MIRAParameters::interpretJobDefs(vector<MIRAParameters> & Pv, vector<vector
 }
 
 
-void MIRAParameters::addModifiersForMapping(string & modestring, vector<vector<uint32> > & jobdefs, std::vector<MIRAParameters> & Pv, bool hasSHORTREADS)
-{
-    modestring+=
-      "\n\t"
-      "\nCOMMON_SETTINGS"
-      "\n\t-OUT:otc=yes:ort=no"
-      "\n\t-AS:ard=yes:urd=no:nop=1:rbl=1"
-      "\n\t-CL:ascdc=no"
-      "\n\t-SB:sbuip=1:brl=0:bro=0:abnc=no:tor=yes"
-      "\n\t-SK:kms=16:kss=4:pr=60:mhpr=1000"
-      "\n\t-KS:ldn=no:mnr=no"
-      "\n\t-CO:mr=yes"
-      "\n\t-PF:swcs=12"
-      "\n\t-AL:egp=no"
-      ;
-
-    if(jobdefs[JA_QUALITY].front()==MP_jobdef_accurate){
-      modestring+=
-	"\n\t"
-	"\nCOMMON_SETTINGS"
-	"\n\t-SK:swcob=yes";
-    }
-
-    if(Pv[SEQTYPE_SANGER].MP_jobtechsettings){
-      // empty atm
-      modestring+=
-	"\nSANGER_SETTINGS"
-	"\n\t-AS:mrl=20"
-	"\n\t-SB:bnb=no"
-	;
-    }
-    if(Pv[SEQTYPE_454GS20].MP_jobtechsettings){
-      // empty atm
-      modestring+=
-	"\n454_SETTINGS"
-	"\n\t-AS:mrl=20"
-	"\n\t-SB:bnb=no"
-	;
-    }
-    if(Pv[SEQTYPE_IONTORRENT].MP_jobtechsettings){
-      modestring+=
-	"\n\t"
-	"\nCOMMON_SETTINGS"
-	"\n\t-NW:acv=120"
-	"\nIONTOR_SETTINGS"
-	"\n\t-AS:mrl=20"
-	"\n\t-SB:bnb=no"
-	;
-    }
-    if(Pv[SEQTYPE_TEXT].MP_jobtechsettings){
-      modestring+=
-	"\nTEXT_SETTINGS"
-	"\n\t-AS:mrl=20"
-	;
-    }
-    if(Pv[SEQTYPE_SOLEXA].MP_jobtechsettings){
-      modestring+=
-	"\n\t"
-	"\nCOMMON_SETTINGS"
-	"\n\t-SK:kms=17:kss=1:pr=60"
-	"\n\t-CO:mr=yes"
-	"\n\t-PF:swcs=12"
-	"\n\t-NW:acv=160"
-	"\n\t"
-	"\nSOLEXA_SETTINGS"
-	"\n\t-AS:mrl=20"
-	"\n\t    urdcm=1.5:ardct=2.0:ardml=200:ardgl=20"
-	"\n\t-DP:ure=no"
-	"\n\t-CL:pvlc=no:qc=no:bsqc=no:emlc=no:mlcr=0:smlc=0:mbc=no:mbcgs=5:mbcmfg=12:mbcmeg=12"
-	"\n\t    msvsgs=1:msvsmfg=2:msvsmeg=2:msvssfc=0:msvssec=0:cpat=no:mqtfer=0"
-	"\n\t-AL:ms=15:mo=17:mrs=80:bip=20:bmin=20:bmax=80"
-	"\n\t-CO:rodirs=30:cmrs=-1:mrpg=3:mnq=20:mgqrt=30:emea=4:amgb=yes"
-	"\n\t-PF:uqr=yes:qrml1=-90:qrms1=100:qrml2=-80:qrms2=100:bqoml=20"
-	"\n\t-SK:pr=60"
-	"\n\t-SB:bnb=yes"
-	;
-      if(Pv[SEQTYPE_PACBIOHQ].MP_jobtechsettings){
-	// empty atm
-      }
-    }
-
-    modestring+=
-      "\nCOMMON_SETTINGS";
-
-    // also take care of brl by checking which sequencing types are used
-    if(hasSHORTREADS){
-      // TODO: check good brl length
-      modestring+=
-	"\nCOMMON_SETTINGS"
-	"\n\t-SB:sbuip=0:brl=0:abnc=no";
-      // BaCh: 27.04.2013
-      // mroir=yes heavily interferes with decision making on whether
-      //  overcalls may be edited or not (assembly.C), as this is decided
-      //  upon existence of SRM tags. And these do not get set if
-      //  mroir is true, which then sometimes leads to wrong overcall editing
-      //"\n\t-CO:mroir=yes";
-      if(Pv[SEQTYPE_SOLEXA].MP_jobtechsettings){
-	if(jobdefs[JA_QUALITY].front()==MP_jobdef_draft){
-	  modestring+=
-	    "\nCOMMON_SETTINGS"
-	    "\n\t-SB:bro=0"
-	    "\n\t-SK:mhpr=1000"
-	    "\n_SANGER_SETTINGS"
-	    "\n\t-SK:pr=70"
-	    "\n_454_SETTINGS"
-	    "\n\t-SK:pr=70"
-	    "\n_IONTOR_SETTINGS"
-	    "\n\t-SK:pr=70"
-	    "\n_PCBIOHQ_SETTINGS"
-	    "\n\t-SK:pr=70"
-	    // TODO:PacBio LQ ?
-	    "\n_SOLEXA_SETTINGS"
-	    "\n\t-AL:mrs=70"
-	    "\n\t-CO:msr=yes"
-	    "\n\t-SK:pr=90"
-	    ;
-	}else if(jobdefs[JA_QUALITY].front()==MP_jobdef_normal){
-	  if(!Pv[SEQTYPE_SANGER].MP_jobtechsettings && !Pv[SEQTYPE_454GS20].MP_jobtechsettings && !Pv[SEQTYPE_IONTORRENT].MP_jobtechsettings) modestring+="\nCOMMON_SETTINGS\n-SK:kms=12:kss=1:mhpr=1500";
-	  modestring+=
-	    "\nCOMMON_SETTINGS"
-	    "\n\t-SB:brl=0:bro=0"
-	    "\n_SANGER_SETTINGS"
-	    "\n\t-SK:pr=60"
-	    "\n_454_SETTINGS"
-	    "\n\t-SK:pr=60"
-	    "\n_IONTOR_SETTINGS"
-	    "\n\t-SK:pr=60"
-	    // TODO:PacBio LQ ?
-	    "\n_PCBIOHQ_SETTINGS"
-	    "\n\t-SK:pr=60"
-	    "\n_SOLEXA_SETTINGS"
-	    "\n\t-AL:mrs=75"
-	    "\n\t-CO:msr=yes"
-	    "\n\t-SK:pr=75"
-	    ;
-	}else{
-	  if(!Pv[SEQTYPE_SANGER].MP_jobtechsettings && !Pv[SEQTYPE_454GS20].MP_jobtechsettings && !Pv[SEQTYPE_PACBIOHQ].MP_jobtechsettings && !Pv[SEQTYPE_PACBIOLQ].MP_jobtechsettings) modestring+="\nCOMMON_SETTINGS\n-SK:kms=10:kss=1:mhpr=2000";
-	  modestring+=
-	    "\nCOMMON_SETTINGS"
-	    "\n\t-SB:brl=0:bro=0"
-	    "\n_SANGER_SETTINGS"
-	    "\n\t-SK:pr=60"
-	    "\n_454_SETTINGS"
-	    "\n\t-SK:pr=60"
-	    "\n_IONTOR_SETTINGS"
-	    "\n\t-SK:pr=60"
-	    "\n_PCBIOHQ_SETTINGS"
-	    "\n\t-SK:pr=60"
-	    "\n_SOLEXA_SETTINGS"
-	    "\n\t-AL:mrs=60"
-	    "\n\t-CO:msr=yes"
-	    "\n\t-SK:pr=60"
-	    ;
-	}
-      }else{
-	if(jobdefs[JA_QUALITY].front()==MP_jobdef_draft){
-	  modestring+="\n\t-SB:bro=20";
-	}else if(jobdefs[JA_QUALITY].front()==MP_jobdef_normal){
-	  modestring+="\n\t-SB:bro=35";
-	  if(!Pv[SEQTYPE_SANGER].MP_jobtechsettings && !Pv[SEQTYPE_454GS20].MP_jobtechsettings && !Pv[SEQTYPE_PACBIOHQ].MP_jobtechsettings && !Pv[SEQTYPE_PACBIOLQ].MP_jobtechsettings && !Pv[SEQTYPE_IONTORRENT].MP_jobtechsettings) modestring+="\n\n-SK:kms=12";
-	}else{
-	  modestring+="\n\t-SB:bro=40";
-	  if(!Pv[SEQTYPE_SANGER].MP_jobtechsettings && !Pv[SEQTYPE_454GS20].MP_jobtechsettings && !Pv[SEQTYPE_PACBIOHQ].MP_jobtechsettings && !Pv[SEQTYPE_PACBIOLQ].MP_jobtechsettings && !Pv[SEQTYPE_IONTORRENT].MP_jobtechsettings) modestring+="\n\n-SK:kms=10";
-	}
-      }
-    }else if(Pv[SEQTYPE_454GS20].MP_jobtechsettings || Pv[SEQTYPE_PACBIOHQ].MP_jobtechsettings){
-      // TODO: PacBio LQ?
-
-      // dumb idea to set abnc=yes automatically ... users don't expect that
-      //if(jobdefs[JA_QUALITY].front()==MP_jobdef_draft){
-      //	modestring+="\n\t-SB:sbuip=0:abnc=no";
-      //}else if(jobdefs[JA_QUALITY].front()==MP_jobdef_normal){
-      //	modestring+="\n\t-SB:sbuip=0:abnc=no";
-      //}else{
-      //	modestring+="\n\t-SB:sbuip=1:abnc=yes";
-      //}
-      modestring+="\n\t-SB:brl=0:bro=0"
-	"\n\t-SB:sbuip=0;abnc=no";
-    }else{
-      modestring+="\n\t-SB:brl=0:bro=0"
-	"\n\t-SB:sbuip=0;abnc=no";
-      //if(jobdefs[JA_QUALITY].front()==MP_jobdef_draft){
-      //	modestring+="\n\t-SB:sbuip=0;abnc=no";
-      //}else if(jobdefs[JA_QUALITY].front()==MP_jobdef_normal){
-      //	modestring+="\n\t-SB:sbuip=0;abnc=no";
-      //}else{
-      //	modestring+="\n\t-SB:sbuip=0;abnc=no";
-      //}
-    }
-}
-
 
-void MIRAParameters::saveParsedSettingsValues(vector<MIRAParameters> & Pv, vector<bool> & saved)
+void MIRAParameters::saveParsedSettingsValues(vector<MIRAParameters> & Pv, MIRAParameters * actpar, vector<bool> & saved)
 {
   saved.clear();
   if(!Pv.empty()) {
@@ -5493,14 +5800,18 @@ void MIRAParameters::saveParsedSettingsValues(vector<MIRAParameters> & Pv, vecto
     for(uint32 i=0; i<Pv.size(); i++){
       saved[i]=Pv[i].MP_parsedsomesettings;
     }
+  }else if(actpar!= NULL){
+    saved.resize(1, actpar->MP_parsedsomesettings);
   }
 }
 
-void MIRAParameters::restoreParsedSettingsValues(vector<MIRAParameters> & Pv, vector<bool> & saved)
+void MIRAParameters::restoreParsedSettingsValues(vector<MIRAParameters> & Pv, MIRAParameters * actpar, vector<bool> & saved)
 {
   if(saved.size()==Pv.size()) {
     for(uint32 i=0; i<saved.size(); i++){
       Pv[i].MP_parsedsomesettings=saved[i];
     }
+  }else if(actpar!= NULL && !saved.empty()){
+    actpar->MP_parsedsomesettings=saved[0];
   }
 }
diff --git a/src/mira/parameters.H b/src/mira/parameters.H
index 5f462aa..f582a7d 100644
--- a/src/mira/parameters.H
+++ b/src/mira/parameters.H
@@ -11,19 +11,21 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
+// 	$Id$	
+
 #ifndef _mira_parameters_H
 #define _mira_parameters_H
 
@@ -35,10 +37,8 @@
 #include <sstream>
 #include <algorithm>                     // STL min max template
 
-// for strlen()
-#include <cstring>
-
-
+// BOOST string functions
+#include <boost/algorithm/string.hpp> 
 
 #include "errorhandling/errorhandling.H"
 
@@ -54,78 +54,69 @@ private:
 
   enum qsj_jobareas_t {JA_QUALITY, JA_TYPE, JA_METHOD, JA_TECH};
 
-  static std::string MP_currentparametersection;
+  static string MP_currentparametersection;
   static bool MP_errorinparams;
-  static std::vector<std::string>        MP_loadfilename;
+  static vector<string>        MP_loadfilename;
 
 
   special_parameters    mp_special_params;
-  nagandwarn_parameters mp_nagandwarn_params;
   skim_parameters       mp_skim_params;
-  hashstatistics_parameters  mp_hashstatistics_params;
   align_parameters      mp_align_params;
   dynamic_parameters    mp_dynamic_params;
   assembly_parameters   mp_assembly_params;
   pathfinder_parameters mp_pathfinder_params;
   contig_parameters     mp_contig_params;
   directory_parameters  mp_directory_params;
-  file_parameters       mp_file_params;
   edit_parameters       mp_edit_params;
 
   bool MP_parsedsomesettings;
-  bool MP_jobtechsettings;
 
   //Functions
 private:
   void foolCompiler();
 
   template <class T>
-  void checkMin(const char * parameter, T & var, const T & minval, const T & defaultval, bool verbose)
+  void checkMin(const char * parameter, T & var, const T & minval, const T & defaultval)
     {
       if(var < minval){
-	if(verbose) std::cout << parameter << " is " << var << ", but must be at least " << minval << ". Setting to " << defaultval << std::endl;
+	cout << parameter << " is " << var << ", but must be at least " << minval << ". Setting to " << defaultval << endl; 
 	var=defaultval;
       }
     }
   template <class T>
-  void checkMax(const char * parameter, T & var, const T & maxval, const T & defaultval, bool verbose)
+  void checkMax(const char * parameter, T & var, const T & maxval, const T & defaultval)
     {
       if(var > maxval){
-	if(verbose) std::cout << parameter << " is " << var << ", but must be no more than " << maxval << ". Setting to " << defaultval << std::endl;
+	cout << parameter << " is " << var << ", but must be no more than " << maxval << ". Setting to " << defaultval << endl; 
 	var=defaultval;
       }
     }
 
-#include "mira/readseqtypes.H"
-
-  template <class T>
-  static void multiParamPrint(std::vector<MIRAParameters> & Pv, const std::vector<int> & indexesInPv, std::ostream & ostr, T & varInPv0, const char * indent, const char * desc, int32 fieldlength){
-    multiParamPrint_(Pv, indexesInPv, ostr, varInPv0,
-		     indent, desc, fieldlength,
-		     0);
-  }
+  // doubled from Read class ... to circumvent include of read.H in this header file
+  // is there a better way?
+  enum read_sequencing_type {SEQTYPE_SANGER=0, SEQTYPE_454GS20, SEQTYPE_IONTORRENT, SEQTYPE_PACBIO, SEQTYPE_SOLEXA, SEQTYPE_ABISOLID, SEQTYPE_END};
+  
   template <class T>
-  static void multiParamPrintNumericChar(std::vector<MIRAParameters> & Pv, const std::vector<int> & indexesInPv, std::ostream & ostr, T & varInPv0, const char * indent, const char * desc, int32 fieldlength){
-    multiParamPrint_(Pv, indexesInPv, ostr, varInPv0,
+  static void multiParamPrint(vector<MIRAParameters> & Pv, const vector<int> & indexesInPv, ostream & ostr, T & varInPv0, const char * indent, const char * desc, int32 fieldlength){
+    multiParamPrint_(Pv, indexesInPv, ostr, varInPv0, 
 		     indent, desc, fieldlength,
-		     1);
+		     false, false);
   }
   template <class T>
-  static void multiParamPrintBool(std::vector<MIRAParameters> & Pv, const std::vector<int> & indexesInPv, std::ostream & ostr, T & varInPv0, const char * indent, const char * desc, int32 fieldlength){
-    multiParamPrint_(Pv, indexesInPv, ostr, varInPv0,
+  static void multiParamPrintNumericChar(vector<MIRAParameters> & Pv, const vector<int> & indexesInPv, ostream & ostr, T & varInPv0, const char * indent, const char * desc, int32 fieldlength){
+    multiParamPrint_(Pv, indexesInPv, ostr, varInPv0, 
 		     indent, desc, fieldlength,
-		     2);
+		     false, true);
   }
   template <class T>
-  static void multiParamPrintNagWarn(std::vector<MIRAParameters> & Pv, const std::vector<int> & indexesInPv, std::ostream & ostr, T & varInPv0, const char * indent, const char * desc, int32 fieldlength){
-    multiParamPrint_(Pv, indexesInPv, ostr, varInPv0,
+  static void multiParamPrintBool(vector<MIRAParameters> & Pv, const vector<int> & indexesInPv, ostream & ostr, T & varInPv0, const char * indent, const char * desc, int32 fieldlength){
+    multiParamPrint_(Pv, indexesInPv, ostr, varInPv0, 
 		     indent, desc, fieldlength,
-		     3);
+		     true, false);
   }
 
   template <class T>
-  static void multiParamPrint_(std::vector<MIRAParameters> & Pv, const std::vector<int> & indexesInPv, std::ostream & ostr, T & varInPv0, const char * indent, const char * desc, int32 fieldlength, uint8 printhow){
-//bool asboolean, bool numericcast){
+  static void multiParamPrint_(vector<MIRAParameters> & Pv, const vector<int> & indexesInPv, ostream & ostr, T & varInPv0, const char * indent, const char * desc, int32 fieldlength, bool asboolean, bool numericcast){
 
     int32 offsetOfVarInPv0=static_cast<int32>(reinterpret_cast<char *>(&varInPv0) - reinterpret_cast<char *>(&(Pv[0])));
 
@@ -136,22 +127,14 @@ private:
     ostr << ':';
     if(indexesInPv.size()==1){
       char * addrPv0= reinterpret_cast<char *>(&Pv[indexesInPv[0]]);
-      char * valInPv0= reinterpret_cast<char *>(&(addrPv0[offsetOfVarInPv0]));
-      if(printhow==3) {
-	if(*valInPv0==0){
-	  ostr << " no\n";
-	}else if(*valInPv0==1){
-	  ostr << " stop\n";
-	}else{
-	  ostr << " warn\n";
-	}
-      }else if(printhow==2) {
+      char * valInPv0= reinterpret_cast<char *>(&(addrPv0[offsetOfVarInPv0])); 
+      if(asboolean) {
 	if(*(reinterpret_cast<bool *>(valInPv0))) {
 	  ostr << " yes\n";
 	}else{
 	  ostr << " no\n";
 	}
-      }else if(printhow==1) {
+      }else if(numericcast) {
 	ostr << ' ';
 	charAsNum(ostr, valInPv0);
 	ostr << '\n';
@@ -162,18 +145,14 @@ private:
     }else{
       //ostr << '\n';
       for(uint32 ipvindex=0; ipvindex<indexesInPv.size(); ipvindex++){
-	if(indexesInPv[ipvindex] == SEQTYPE_END) continue;
 	if(ipvindex>0) {
 	  ostr << indent;
 	  for(int32 pad=fieldlength;pad>0;pad--) ostr << ' ';
 	}
 	if(indexesInPv[ipvindex] >= static_cast<int>(Pv.size())) {
-	  std::cerr << "BARF! .H MIRAParameters broken, wanted to read elem " << indexesInPv[ipvindex] << " for vector of size " << Pv.size() << " STE: " << SEQTYPE_END << "\n";
+	  cerr << "BARF! MIRAParameters broken, wanted to read elem " << indexesInPv[ipvindex] << " for vector of size " << Pv.size() << "\n";
 	  abort();
 	}
-#if CPP_READ_SEQTYPE_END != 8
-#error "This code is made for 8 sequencing types, adapt!"
-#endif
 	switch(indexesInPv[ipvindex]){
 	case SEQTYPE_SANGER:{
 	  ostr << "  [san] ";
@@ -187,16 +166,8 @@ private:
 	  ostr << "  [ion] ";
 	  break;
 	}
-	case SEQTYPE_PACBIOHQ:{
-	  ostr << "  [pbh] ";
-	  break;
-	}
-	case SEQTYPE_PACBIOLQ:{
-	  ostr << "  [pbl] ";
-	  break;
-	}
-	case SEQTYPE_TEXT:{
-	  ostr << "  [txt] ";
+	case SEQTYPE_PACBIO:{
+	  ostr << "  [pbs] ";
 	  break;
 	}
 	case SEQTYPE_SOLEXA:{
@@ -208,7 +179,7 @@ private:
 	  break;
 	}
 	default : {
-	  std::cerr << "BARF! MIRAParameters broken, wanted readtype " << indexesInPv[ipvindex] << "\n";
+	  cerr << "BARF! MIRAParameters broken, wanted readtype " << indexesInPv[ipvindex] << "\n";
 	  abort();
 	}
 	}
@@ -220,21 +191,13 @@ private:
 	}
 
 	ostr << ' ';
-	if(printhow==3) {
-	  if(*valInPvX==0){
-	    ostr << "no\n";
-	  }else if(*valInPvX==1){
-	    ostr << "stop\n";
-	  }else{
-	    ostr << "warn\n";
-	  }
-	}else if(printhow==2) {
+	if(asboolean) {
 	  if(*(reinterpret_cast<bool*>(valInPvX))==true) {
 	    ostr << "yes\n";
 	  }else{
 	    ostr << "no\n";
 	  }
-	}else if(printhow==1) {
+	}else if(numericcast) {
 	  charAsNum(ostr, valInPvX);
 	  ostr << '\n';
 	}else{
@@ -244,149 +207,136 @@ private:
     }
   }
 
-  static void charAsNum(std::ostream & ostr, char * c){
+  static void charAsNum(ostream & ostr, char * c){
     char x=*c;
     ostr << static_cast<int>(x);
   }
 
-  static int32 gimmeAnInt(FlexLexer * lexer, std::stringstream & errstream);
-  static double gimmeADouble(FlexLexer * lexer, std::stringstream & errstream);
-  static int32 getFixedStringMode(FlexLexer * lexer, std::stringstream & errstream);
-  static void checkCOMMON(const std::string & currentst,
-			  FlexLexer * lexer,
-			  std::stringstream & errstream);
-  static void checkNONCOMMON(const std::string & currentst,
-			     FlexLexer * lexer,
-			     std::stringstream & errstream);
-
-
-  static void interpretJobDefs(std::vector<MIRAParameters> & Pv,
-			       std::vector<std::vector<uint32> > & jobdefs,
-			       std::stringstream & errstream);
-
-  static void addModifiersForMapping(std::string & modestring,
-				     std::vector<std::vector<uint32> > & jobdefs,
-				     std::vector<MIRAParameters> & Pv,
-				     bool hasSHORTREADS);
-
-  static void saveParsedSettingsValues(std::vector<MIRAParameters> & Pv,
-				       std::vector<bool> & saved);
-  static void restoreParsedSettingsValues(std::vector<MIRAParameters> & Pv,
-					  std::vector<bool> & saved);
+  static int32 gimmeAnInt(FlexLexer * lexer, stringstream & errstream);
+  static double gimmeADouble(FlexLexer * lexer, stringstream & errstream);
+  static int32 getFixedStringMode(FlexLexer * lexer, stringstream & errstream);
+  static void checkCOMMON(const string & currentst,
+			  FlexLexer * lexer, 
+			  stringstream & errstream);
+  static void checkNONCOMMON(const string & currentst,
+			     FlexLexer * lexer, 
+			     stringstream & errstream);
+			  
+
+  static void interpretJobDefs(vector<MIRAParameters> & Pv, 
+			       vector<vector<uint32> > & jobdefs, 
+			       stringstream & errstream);
+
+  static void saveParsedSettingsValues(vector<MIRAParameters> & Pv,
+				       MIRAParameters * actpar, 
+				       vector<bool> & saved);
+  static void restoreParsedSettingsValues(vector<MIRAParameters> & Pv,
+					  MIRAParameters * actpar, 
+					  vector<bool> & saved);
 
 public:
   MIRAParameters();
   ~MIRAParameters();
-  friend std::ostream & operator<<(std::ostream &ostr, MIRAParameters const &mp);
+  friend ostream & operator<<(ostream &ostr, MIRAParameters const &mp);
 
-  static void setupStdMIRAParameters(std::vector<MIRAParameters> & Pv,
+  static void setupStdMIRAParameters(vector<MIRAParameters> & Pv, 
 				     bool verbose=false);
-  static void postParsingChanges(std::vector<MIRAParameters> & Pv);
-
-  static void dumpAllParams(std::vector<MIRAParameters> & Pv,
-			    std::ostream & ostr);
-  static void dumpAllParams(std::vector<MIRAParameters> & Pv,
-			    const std::vector<int> & indexesInPvm,
-			    std::ostream & ostr);
-  static void dumpAlignParams(std::vector<MIRAParameters> & Pv,
-			      const std::vector<int> & indexesInPvm,
-			      std::ostream & ostr);
-
-  static void dumpGeneralParams(std::vector<MIRAParameters> & Pv,
-				const std::vector<int> & indexesInPvm,
-				std::ostream & ostr);
-  static void dumpMiscParams(std::vector<MIRAParameters> & Pv,
-			     const std::vector<int> & indexesInPvm,
-			     std::ostream & ostr);
-  static void dumpNagAndWarnParams(std::vector<MIRAParameters> & Pv,
-			     const std::vector<int> & indexesInPvm,
-			     std::ostream & ostr);
-  static void dumpLoadParams(std::vector<MIRAParameters> & Pv,
-			     const std::vector<int> & indexesInPvm,
-			     std::ostream & ostr);
-  //static void dumpShortReadParams(std::vector<MIRAParameters> & Pv,
-  //			   const std::vector<int> & indexesInPvm,
-  //			   std::ostream & ostr);
-  static void dumpAssemblyParams(std::vector<MIRAParameters> & Pv,
-				 const std::vector<int> & indexesInPvm,
-				 std::ostream & ostr);
-  static void dumpStrainBackboneParams(std::vector<MIRAParameters> & Pv,
-				       const std::vector<int> & indexesInPvm,
-				       std::ostream & ostr);
-  static void dumpDataProcessingParams(std::vector<MIRAParameters> & Pv,
-				       const std::vector<int> & indexesInPvm,
-				       std::ostream & ostr);
-  static void dumpClippingParams(std::vector<MIRAParameters> & Pv,
-				 const std::vector<int> & indexesInPvm,
-				 std::ostream & ostr);
-  static void dumpSkimParams(std::vector<MIRAParameters> & Pv,
-			     const std::vector<int> & indexesInPvm,
-			     std::ostream & ostr);
-  static void dumpHashStatisticsParams(std::vector<MIRAParameters> & Pv,
-				       const std::vector<int> & indexesInPvm,
-				       std::ostream & ostr);
-  static void dumpPathfinderParams(std::vector<MIRAParameters> & Pv,
-				   const std::vector<int> & indexesInPvm,
-				   std::ostream & ostr);
-
-  static void dumpContigParams(std::vector<MIRAParameters> & Pv,
-			       const std::vector<int> & indexesInPvm,
-			       std::ostream & ostr);
-  static void dumpEditParams(std::vector<MIRAParameters> & Pv,
-			     const std::vector<int> & indexesInPvm,
-			     std::ostream & ostr);
-  static void dumpDirectoryParams(std::vector<MIRAParameters> & Pv,
-				  const std::vector<int> & indexesInPvm,
-				  std::ostream & ostr);
-  static void dumpFileInParams(std::vector<MIRAParameters> & Pv,
-			       const std::vector<int> & indexesInPvm,
-			       std::ostream & ostr);
-  static void dumpFileOutParams(std::vector<MIRAParameters> & Pv,
-				const std::vector<int> & indexesInPvm,
-				std::ostream & ostr);
-  static void dumpFileTempParams(std::vector<MIRAParameters> & Pv,
-				 const std::vector<int> & indexesInPvm,
-				 std::ostream & ostr);
-  static void dumpOutputCustomisationParams(std::vector<MIRAParameters> & Pv,
-					    const std::vector<int> & indexesInPvm,
-					    std::ostream & ostr);
-  static void dumpFileDirectoryOutNamesParams(std::vector<MIRAParameters> & Pv,
-					      const std::vector<int> & indexesInPvm,
-					      std::ostream & ostr);
-
-
-  void dumpGeneralParams(std::ostream &ostr) const;
-  void dump454Params(std::ostream &ostr) const;
-  void dumpShortReadParams(std::ostream &ostr) const;
-  void dumpAssemblyParams(std::ostream &ostr) const;
-  void dumpStrainBackboneParams(std::ostream &ostr) const;
-  void dumpDataProcessingParams(std::ostream &ostr) const;
-  void dumpClippingParams(std::ostream &ostr) const;
-  void dumpSkimParams(std::ostream &ostr) const;
-  void dumpPathfinderParams(std::ostream &ostr) const;
-  void dumpAlignParams(std::ostream &ostr) const;
-  void dumpContigParams(std::ostream &ostr) const;
-  void dumpEditParams(std::ostream &ostr) const;
-  void dumpDirectoryParams(std::ostream &ostr) const;
-  void dumpFileInParams(std::ostream &ostr) const;
-  void dumpFileOutParams(std::ostream &ostr) const;
-  void dumpFileTempParams(std::ostream &ostr) const;
-  void dumpOutputCustomisationParams(std::ostream &ostr) const;
-  void dumpFileDirectoryOutNamesParams(std::ostream &ostr) const;
+  static void postParsingChanges(vector<MIRAParameters> & Pv);
+
+  static void dumpAllParams(vector<MIRAParameters> & Pv, 
+			    ostream & ostr);
+  static void dumpAllParams(vector<MIRAParameters> & Pv, 
+			    const vector<int> & indexesInPvm,
+			    ostream & ostr);
+  static void dumpAlignParams(vector<MIRAParameters> & Pv, 
+			      const vector<int> & indexesInPvm,
+			      ostream & ostr);
+
+  static void dumpGeneralParams(vector<MIRAParameters> & Pv, 
+				const vector<int> & indexesInPvm,
+				ostream & ostr);
+  static void dumpMiscParams(vector<MIRAParameters> & Pv, 
+			     const vector<int> & indexesInPvm,
+			     ostream & ostr);
+  static void dumpLoadParams(vector<MIRAParameters> & Pv, 
+			     const vector<int> & indexesInPvm,
+			     ostream & ostr);
+  //static void dumpShortReadParams(vector<MIRAParameters> & Pv, 
+  //			   const vector<int> & indexesInPvm,
+  //			   ostream & ostr);
+  static void dumpAssemblyParams(vector<MIRAParameters> & Pv, 
+				 const vector<int> & indexesInPvm,
+				 ostream & ostr);
+  static void dumpStrainBackboneParams(vector<MIRAParameters> & Pv, 
+				       const vector<int> & indexesInPvm,
+				       ostream & ostr);
+  static void dumpDataProcessingParams(vector<MIRAParameters> & Pv, 
+				       const vector<int> & indexesInPvm,
+				       ostream & ostr);
+  static void dumpClippingParams(vector<MIRAParameters> & Pv, 
+				 const vector<int> & indexesInPvm,
+				 ostream & ostr);
+  static void dumpSkimParams(vector<MIRAParameters> & Pv, 
+			     const vector<int> & indexesInPvm,
+			     ostream & ostr);
+  static void dumpPathfinderParams(vector<MIRAParameters> & Pv, 
+				   const vector<int> & indexesInPvm,
+				   ostream & ostr);
+  
+  static void dumpContigParams(vector<MIRAParameters> & Pv, 
+			       const vector<int> & indexesInPvm,
+			       ostream & ostr);
+  static void dumpEditParams(vector<MIRAParameters> & Pv, 
+			     const vector<int> & indexesInPvm,
+			     ostream & ostr);
+  static void dumpDirectoryParams(vector<MIRAParameters> & Pv, 
+				  const vector<int> & indexesInPvm,
+				  ostream & ostr);
+  static void dumpFileInParams(vector<MIRAParameters> & Pv, 
+			       const vector<int> & indexesInPvm,
+			       ostream & ostr);
+  static void dumpFileOutParams(vector<MIRAParameters> & Pv, 
+				const vector<int> & indexesInPvm,
+				ostream & ostr);
+  static void dumpFileTempParams(vector<MIRAParameters> & Pv, 
+				 const vector<int> & indexesInPvm,
+				 ostream & ostr);
+  static void dumpOutputCustomisationParams(vector<MIRAParameters> & Pv, 
+					    const vector<int> & indexesInPvm,
+					    ostream & ostr);
+  static void dumpFileDirectoryOutNamesParams(vector<MIRAParameters> & Pv, 
+					      const vector<int> & indexesInPvm,
+					      ostream & ostr);
+
+  
+  void dumpGeneralParams(ostream &ostr) const;
+  void dump454Params(ostream &ostr) const;
+  void dumpShortReadParams(ostream &ostr) const;
+  void dumpAssemblyParams(ostream &ostr) const;
+  void dumpStrainBackboneParams(ostream &ostr) const;
+  void dumpDataProcessingParams(ostream &ostr) const;
+  void dumpClippingParams(ostream &ostr) const;
+  void dumpSkimParams(ostream &ostr) const;
+  void dumpPathfinderParams(ostream &ostr) const;
+  void dumpAlignParams(ostream &ostr) const;
+  void dumpContigParams(ostream &ostr) const;
+  void dumpEditParams(ostream &ostr) const;
+  void dumpDirectoryParams(ostream &ostr) const;
+  void dumpFileInParams(ostream &ostr) const;
+  void dumpFileOutParams(ostream &ostr) const;
+  void dumpFileTempParams(ostream &ostr) const;
+  void dumpOutputCustomisationParams(ostream &ostr) const;
+  void dumpFileDirectoryOutNamesParams(ostream &ostr) const;
 
   template <class T>
-  static void multiParamPrint(std::vector<MIRAParameters> & Pv, const T & var, const std::string & desc);
+  static void multiParamPrint(vector<MIRAParameters> & Pv, const T & var, const string & desc);
 
-  void consistencyCheck(bool verbose);
+  void consistencyCheck();
 
-  inline special_parameters const & getSpecialParams() const
+  inline special_parameters const & getSpecialParams() const 
     { return mp_special_params; }
-  inline nagandwarn_parameters const & getNagAndWarnParams() const
-    { return mp_nagandwarn_params; }
   inline skim_parameters const & getSkimParams() const
     { return mp_skim_params; }
-  inline hashstatistics_parameters const & getHashStatisticsParams() const
-    { return mp_hashstatistics_params; }
   inline align_parameters const & getAlignParams() const
     { return mp_align_params; }
   inline dynamic_parameters const & getDynamicParams() const
@@ -399,19 +349,13 @@ public:
     { return mp_contig_params; }
   inline directory_parameters const & getDirectoryParams() const
     { return mp_directory_params; }
-  inline file_parameters const & getFileParams() const
-    { return mp_file_params; }
   inline edit_parameters const & getEditParams() const
     { return mp_edit_params; }
 
-  inline special_parameters & getNonConstSpecialParams()
+  inline special_parameters & getNonConstSpecialParams() 
     { return mp_special_params; }
-  inline nagandwarn_parameters & getNonConstNagAndWarnParams()
-    { return mp_nagandwarn_params;}
   inline skim_parameters & getNonConstSkimParams()
     { return mp_skim_params; }
-  inline hashstatistics_parameters & getNonConstHashStatisticsParams()
-    { return mp_hashstatistics_params; }
   inline align_parameters & getNonConstAlignParams()
     { return mp_align_params; }
   inline dynamic_parameters & getNonConstDynamicParams()
@@ -427,33 +371,115 @@ public:
   inline edit_parameters & getNonConstEditParams()
     { return mp_edit_params; }
 
-  static void loadParams(const std::string & pfile, std::vector<MIRAParameters> & Pv);
-  static void parse(int argc, char **argv, std::vector<MIRAParameters> & Pv, bool verbose=true);
-  static void parse(const char * params, std::vector<MIRAParameters> & Pv, bool verbose=true);
-  static void parse(const std::string & params, std::vector<MIRAParameters> & Pv, bool verbose=true) {parse(params.c_str(),Pv,verbose);};
-  static void parse(std::istream & is,
-		    std::vector<MIRAParameters> & Pv,
-		    bool verbose=true);
-  static void parseQuickmode(const char * params,
+  static void loadParams(const string & pfile, vector<MIRAParameters> & Pv);
+  static void parse(int argc, char **argv, vector<MIRAParameters> & Pv);
+  static void parse(const char * params, vector<MIRAParameters> & Pv);
+  static void parse(const string & params, vector<MIRAParameters> & Pv) {parse(params.c_str(),Pv);};
+  static void parse(istream & is, 
+		    vector<MIRAParameters> & Pv,
+		    MIRAParameters * mp);
+  static void parseQuickmode(const char * params, 
 			     const char * qm,
-			     std::vector<MIRAParameters> & Pv,
-			     bool verbose=true);
+			     vector<MIRAParameters> & Pv,
+			     bool verbose=true,
+			     MIRAParameters * mp=NULL);
   static void parseQuickmodeNoTechSettingsChange(
-    const char * params,
+    const char * params, 
     const char * qm,
-    std::vector<MIRAParameters> & Pv,
-    bool verbose=true);
-
-  static void generateProjectNames(std::vector<MIRAParameters> & Pv, std::string name="");
-  static void generateProjectInNames(std::vector<MIRAParameters> & Pv, std::string name="");
-  static void generateProjectOutNames(std::vector<MIRAParameters> & Pv, std::string name="");
-  static void correctTmpDirectory(std::vector<MIRAParameters> & Pv);
-
-  void setPathfinderMaxContigTime(uint32 t);
-  void setPathfinderNextReadMaxTimeToESS(uint32 t);
-  bool setAlignGapPenaltyLevel(const std::string & gplevels, std::stringstream * errstream=nullptr);
+    vector<MIRAParameters> & Pv,
+    bool verbose=true,
+    MIRAParameters * mp=NULL);
+
+  static void generateProjectNames(vector<MIRAParameters> & Pv, string name="");
+  static void generateProjectInNames(vector<MIRAParameters> & Pv, string name="");
+  static void generateProjectOutNames(vector<MIRAParameters> & Pv, string name="");
+  static void correctTmpDirectory(vector<MIRAParameters> & Pv);
+
+  static void setBorgMode(vector<MIRAParameters> & Pv, 
+			  bool verbose);
+  static void setQuickmodeGenomeDraft(vector<MIRAParameters> & Pv,
+				      bool verbose);
+  static void setQuickmodeGenomeNormal(vector<MIRAParameters> & Pv, 
+				       bool verbose);
+  static void setQuickmodeGenomeAccurate(vector<MIRAParameters> & Pv,
+					 bool verbose);
+
+  int32 setSpecialParams(special_parameters & sp);
+  int32 setSkimParams(skim_parameters & sk);
+  int32 setAlignParams(align_parameters & ap);
+  int32 setDynamicParams(dynamic_parameters & dp);
+  int32 setAssemblyParams(assembly_parameters & ap);
+  int32 setPathfinderParams(pathfinder_parameters & pp);
+  int32 setContigParams(contig_parameters & cp);
+  int32 setDirectoryParams(directory_parameters & cp);
+  int32 setEditParams(edit_parameters & cp);
+
+  void setPathfinderuseGenomicAlgorithms(bool b);
+  void setPathfinderMaxContigTime(uint32 t); 
+  void setPathfinderNextReadMaxTimeToESS(uint32 t); 
+
+  void setContigRODIRS(uint32 r);
+  void setContigAssumeSNPInsteadofRepeats(bool b);
+  void setContigDisregardSpuriousRMBMismatches(bool b);
+  void setContigMinReadsPerGroup(uint32 i);
+  void setContigEndReadMarkExclusionArea(uint32 r);
+  void setContigMinNeighbourQuality(base_quality_t q);
+  void setContigMinGroupQuality(base_quality_t q);
+  void setContigMarkGapBases(bool b);
+  void setContigMarkMulticolumnGapBases(bool b);
+
+  void setContigAlignmentOutputTextLineLen(int32 l);
+  void setContigAlignmentOutputHTMLLineLen(int32 l);
+  void setContigAlignmentOutputTextGapPad(char c);
+  void setContigAlignmentOutputHTMLGapPad(char c);
   void setContigForceNonIUPAC(bool perseq, bool amongseq);
 
+  void setAlignMaxCutoff(uint32 mco);
+  void setAlignMinScore(uint32 ms);
+  void setAlignMinRelScore(uint32 mrs);
+  void setAlignMinOverlap(uint32 mo);
+  void setAlignBandwidthMin(uint32 bm);
+  void setAlignBandwidthMax(uint32 bm);
+  void setAlignBandwidthInPercent(uint32 bip);
+  void setAlignGapPenaltyLevel(uint32 level);
+
+  void setEditAutomaticContigEditing(bool b);
+  void setEditStrictEditingMode(bool b);
+  void setEditConfirmationThreshold(uint32 r);
+
+  void setAssemblyProjectName(const string & s);
+  void setAssemblyInfileFOFNEXP( const string & s);
+  void setAssemblyInfileFASTA( const string & s);
+  void setAssemblyInfileFASTAQUAL( const string & s);
+  void setAssemblyInfileCAF( const string & s);
+  void setAssemblyInfileStrainData( const string & s);
+  void setAssemblyOutfileCAF( const string & s);
+  void setAssemblyOutdirGAP4DA( const string & s);
+
+  void setAssemblyUseTemplateInformation(bool u);
+  void setAssemblyPatternLength(uint32 pl);
+  void setAssemblyNumEndErrors(uint32 nee);
+  void setAssemblyNumMiddleErrors(uint32 nme);
+  void setAssemblyNumMiddleRuns(uint32 nmr);
+  void setAssemblyNumRMBBreakLoops(int32 i);
+  void setAssemblyLoadBackbone(bool b);
+  void setAssemblyStartBackboneUsageInPass(int32 i);
+  void setAssemblyNumPasses(int32 i);
+  void setAssemblyInfileWhich(string & iw);
+  void setAssemblyLogUnusedIDs(const string & s);
+  void setAssemblyLogADS( const string & s);
+  void setAssemblyReadExtension(bool b);
+  void setAssemblyMarkRepeats(bool b);
+  void setAssemblyMinLength(uint32 r);
+  void setAssemblyLoadStrainData(bool b);
+  void setAssemblyClipPossibleVectors(bool b);
+  void setAssemblyPutAssembledWithMIRATags(bool b);
+  void setAssemblyFASTQQualOffset(base_quality_t b);
+
 };
 
 #endif
+
+
+
+
diff --git a/src/mira/parameters_flexer.cc b/src/mira/parameters_flexer.cc
index 4fdbdb2..a878ab1 100644
--- a/src/mira/parameters_flexer.cc
+++ b/src/mira/parameters_flexer.cc
@@ -334,8 +334,8 @@ int yyFlexLexer::yywrap() { return 1; }
 	*yy_cp = '\0'; \
 	(yy_c_buf_p) = yy_cp;
 
-#define YY_NUM_RULES 655
-#define YY_END_OF_BUFFER 656
+#define YY_NUM_RULES 628
+#define YY_END_OF_BUFFER 629
 /* This struct is not used in this scanner,
    but its presence is necessary. */
 struct yy_trans_info
@@ -343,726 +343,679 @@ struct yy_trans_info
 	flex_int32_t yy_verify;
 	flex_int32_t yy_nxt;
 	};
-static yyconst flex_int16_t yy_accept[6522] =
+static yyconst flex_int16_t yy_accept[6095] =
     {   0,
         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,  629,  628,  625,  623,
+      628,  627,  627,  619,  619,  620,  622,  621,  617,  617,
+      617,  617,  617,  628,  528,  527,  527,  528,  528,  528,
+      525,  528,  528,  528,  528,  525,  528,  528,  528,  528,
+      528,  528,  528,  528,  528,  528,  528,  528,  528,  528,
+
+      528,  528,  528,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,   53,  627,  627,   52,   52,
+       50,   50,   50,   50,   50,   50,   50,   71,  627,  627,
+       70,   70,   68,   68,   68,   68,   68,   68,   68,   68,
+       68,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  623,  628,  619,  619,  617,  617,  617,  617,
+      617,  628,  263,  627,  627,  259,  258,  262,  262,  260,
+      260,  260,  260,  260,  260,  260,  260,  260,  260,  251,
+
+      250,  251,  251,  251,  251,  251,  251,  251,  251,  247,
+      251,  247,  251,  251,  251,  251,  251,  251,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  430,
+      627,  627,  421,  423,  425,  429,  429,  427,  427,  427,
+      427,  427,  427,  427,  427,  427,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      441,  627,  627,  440,  440,  438,  438,  438,  438,  438,
+
+      438,  438,  438,  628,  625,  624,  623,  628,  627,  627,
+      619,  619,  620,  622,  621,  617,  617,  617,  617,  617,
+      628,  537,  619,  617,  617,  617,  617,    0,  619,  626,
         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,  656,  655,  652,  650,  655,  654,  654,  646,
-      646,  647,  649,  648,  644,  644,  644,  644,  644,  644,
-      655,  557,  556,  556,  557,  557,  557,  554,  557,  557,
-      557,  557,  554,  557,  557,  557,  557,  557,  557,  557,
-
-      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
-      557,  557,  557,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,   28,  654,  654,
-       27,   27,   25,   25,   25,   25,   25,   25,   25,   25,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  650,
-      655,  646,  646,  644,  644,  644,  644,  644,  644,  655,
-      238,  237,  238,  238,  238,  238,  238,  238,  238,  238,
-      237,  238,  238,  236,  238,  236,  238,  238,  238,  235,
-      235,  238,  235,  228,  227,  228,  228,  228,  228,  228,
-
-      228,  228,  228,  224,  228,  224,  228,  228,  228,  228,
-      228,  228,  228,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  508,  654,  654,  511,
-      511,  508,  509,  509,  509,  509,  509,  509,  509,  509,
-      509,  430,  654,  654,  429,  429,  427,  427,  427,  427,
-
-      427,  427,  427,  427,  427,  291,  291,  291,  291,  655,
-      652,  651,  650,  655,  654,  654,  646,  646,  647,  649,
-      648,  644,  644,  644,  644,  644,  644,  655,  568,  646,
-      644,  644,  644,  644,  644,    0,  646,  653,    0,    0,
         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,  619,  619,  617,  617,  617,  617,  617,  617,    0,
+        0,    0,    0,    0,  526,  526,  526,  526,  526,  526,
+      526,  526,  526,  526,  526,  526,  526,  526,  526,  526,
+      526,  526,  526,  526,  526,  526,  526,  526,  526,  526,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+
+      617,  617,  617,   21,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,   79,  617,  617,  617,  617,  617,  617,   45,  617,
+      617,  617,   57,  617,   37,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,   52,    0,   52,   52,   50,
+       50,   50,   50,   50,   50,   50,   50,   70,    0,   70,
+       70,   68,   68,   64,   68,   68,   68,   68,   68,   68,
+       68,   68,   68,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  125,
+
+      617,  617,  617,  617,  617,  617,  273,  275,  617,  617,
+      617,  617,  617,  617,  281,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  298,  298,  298,  298,
+      298,  298,  298,  298,  298,  298,  298,  298,  298,  298,
+      298,  262,    0,  262,  262,  260,  260,  260,  260,  257,
+      260,  252,  260,  260,  260,  260,  260,    0,  247,    0,
+        0,  247,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  362,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+
+      617,  617,  617,  617,  617,  617,  617,  370,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  408,
+      617,  406,  617,  617,  429,    0,  429,  419,  429,  427,
+      427,  427,  427,  427,  427,  427,  427,  427,  427,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  312,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  434,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  447,  617,  617,  472,
+
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  486,  617,  617,  617,  617,  617,  440,
+        0,  440,  440,  438,  438,  438,  438,  438,  438,  438,
+      438,  438,    0,  624,    0,  619,  626,  624,    0,    0,
         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-      646,  646,  644,  644,  644,  644,  644,  644,  644,    0,
-        0,    0,    0,    0,    0,  555,  555,  555,  555,  555,
-      555,  555,  555,  555,  555,  555,  555,  555,  555,  555,
-      555,  555,  555,  555,  555,  555,  555,  555,  555,  555,
-
-      555,  555,  555,  555,  555,  555,  555,  555,  555,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,   12,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-       30,  644,  644,   27,    0,   27,   27,   25,   25,   25,
-       25,   25,   25,   25,   25,   25,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,   74,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  242,  242,  242,  242,  242,  242,  242,  242,  242,
-      242,  242,  242,  242,  242,  242,  242,  242,  644,  234,
-      644,  229,  644,  644,    0,  224,    0,    0,  224,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      315,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  329,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  405,  644,  403,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  258,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  423,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  438,  644,  644,
-      463,  644,  644,  644,  644,  644,  644,  644,  475,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-
-      644,  644,  644,  644,  644,  511,    0,  511,  511,  509,
-      509,  509,  509,  509,  509,  509,  505,  509,  509,  429,
-        0,  429,  429,  427,  427,  427,  427,  427,  427,  427,
-      427,  427,  427,  291,  291,  291,    0,  651,    0,  646,
-      653,  651,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,  646,  646,  644,  644,  644,  644,
-      644,  644,  644,    0,    0,    0,    0,    0,    0,  646,
-      644,  644,  644,  644,  644,  644,    0,    0,  597,  583,
-      576,  599,    0,  602,  585,  587,    0,  581,  570,    0,
-
-      592,    0,  595,    0,  572,  604,    0,  608,  579,    0,
-      610,  574,  589,    0,    0,    0,    0,    0,    0,    0,
-      645,  646,  644,  644,  644,  644,  644,  644,    0,    0,
-        0,    0,    0,    0,    0,  555,  540,  555,  555,  555,
-      555,  555,  555,  555,  555,  555,  555,  555,  555,  555,
-      555,  555,  555,  555,  555,  555,  555,  555,  555,  555,
-      532,  555,  555,  555,  555,  555,  555,  555,    8,  644,
-      644,   20,  644,  644,  644,   10,  644,  644,  644,  644,
-      644,    6,    2,  644,   18,  644,  644,  644,  644,  644,
-       40,   48,  644,  644,   32,   34,  644,  644,  644,   46,
-
-      644,  644,  644,   22,   26,   27,   25,   25,   25,   25,
-       25,   24,   25,   25,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  143,  644,  644,  644,
-      644,   82,  644,  644,  644,  644,  644,  644,  644,  644,
-      125,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  159,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  205,  197,  215,  213,  201,
-      199,  209,  203,  207,  179,  175,  183,  181,  169,  177,
-      173,  171,  644,  644,  644,  167,  644,  644,  644,  644,
-
-      644,  644,  242,  242,  242,  242,  242,  242,  242,  242,
-      242,  242,  242,  242,  242,  242,  242,  644,  230,  644,
-      233,  226,  225,  644,  644,  644,  644,  644,  644,  644,
-      644,  515,  644,  644,  644,  644,  644,  307,  644,  644,
-      644,  644,  313,  644,  644,  644,  644,  321,  644,  644,
-      644,  644,  363,  644,  644,  343,  644,  644,  323,  644,
-      325,  327,  644,  644,  644,  644,  644,  347,  644,  644,
-      644,  644,  355,  644,  317,  351,  349,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  383,  644,  644,
-      389,  644,  644,  644,  644,  644,  375,  644,  371,  369,
-
-      644,  644,  644,  644,  644,  397,  644,  644,  417,  644,
-      644,  415,  411,  644,  644,  644,  644,  644,  407,  644,
-      644,  264,  644,  288,  644,  644,  644,  644,  644,  644,
-      644,  644,  249,  644,  644,  644,  244,  644,  248,  644,
-      254,  644,  644,  644,  252,  644,  644,  644,  644,  644,
-      644,  644,  644,  276,  644,  644,  644,  644,  644,  644,
-      644,  644,  293,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  473,  644,
-      644,  644,  644,  446,  644,  644,  471,  644,  440,  644,
-      644,  644,  241,  240,  482,  483,  484,  644,  644,  644,
-
-      644,  481,  644,  644,  504,  644,  502,  644,  644,  644,
-      644,  644,  644,  490,  644,  644,  510,  511,  509,  509,
-      509,  509,  509,  509,  509,  509,  428,  429,  427,  427,
-      427,  427,  427,  427,  427,  427,  427,  291,    0,    0,
-      597,  583,  576,  599,    0,  602,  585,  587,    0,  581,
-      570,    0,  592,    0,  595,    0,  572,  604,    0,  608,
-      579,    0,  610,  574,  589,    0,    0,    0,    0,    0,
-        0,    0,  645,  646,  644,  644,  644,  644,  644,  644,
-        0,    0,    0,    0,    0,    0,    0,  561,  559,  644,
-      644,  644,  644,  644,    0,    0,    0,    0,    0,    0,
-
-      601,    0,    0,    0,    0,    0,    0,    0,    0,  607,
-      578,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,  644,  644,  644,  644,  644,  644,  644,
-        0,    0,    0,    0,    0,    0,    0,  555,  555,  555,
-      555,  555,  555,  555,  555,  555,  555,  555,  555,  555,
-      555,  551,  555,  555,  555,  555,  555,  555,  555,  555,
-      555,  555,  555,  555,  555,  555,  555,  555,  555,  555,
-      644,  644,  644,  644,   16,   14,  644,  644,    4,  644,
-      644,  644,  644,   44,  644,  644,  644,   36,  644,  644,
-      644,  644,  644,  644,   25,   25,   23,   23,   25,   25,
-
-       25,   25,   25,  644,  644,  644,  644,   68,  103,  151,
-      157,  644,  644,  644,  111,  644,  644,  644,  644,   88,
-       93,  644,  644,  644,  644,  644,  644,  145,  644,   86,
-       84,  644,  644,  644,  644,  644,  644,  644,   90,  644,
-       95,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  132,  644,  644,  644,  644,
-       60,  644,  644,   70,   72,  644,  644,  644,  644,   92,
-       97,  644,  216,  644,  644,  191,  189,  195,  193,  187,
-      211,  644,  644,  165,  644,  644,  644,  218,  644,  644,
-      242,  242,  242,  242,  242,  242,  242,  242,  242,  242,
-
-      242,  242,  242,  242,  242,  644,  231,  644,  644,  644,
-      644,  644,  644,  644,  644,  513,  644,  644,  311,  644,
-      309,  644,  303,  305,  644,  644,  339,  644,  644,  357,
-      367,  365,  359,  361,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  337,  644,  644,  333,  331,  335,
-      345,  644,  644,  644,  644,  644,  644,  644,  377,  387,
-      385,  379,  381,  644,  644,  644,  393,  644,  395,  644,
-      644,  644,  391,  644,  644,  399,  401,  419,  644,  644,
-      409,  644,  644,  644,  644,  644,  421,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  290,  644,  644,  644,
-
-      644,  644,  256,  644,  644,  246,  644,  644,  644,  644,
-      644,  644,  644,  282,  280,  278,  644,  644,  644,  644,
-      262,  644,  299,  644,  644,  301,  644,  295,  644,  644,
-      644,  460,  644,  443,  644,  644,  434,  644,  436,  454,
-      644,  465,  644,  644,  644,  644,  644,  644,  644,  448,
-      644,  644,  644,  462,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  492,  644,  500,  644,
-      488,  494,  644,  498,  509,  509,  509,  509,  509,  509,
-      509,  506,  507,  427,  427,  427,  427,  427,  427,  427,
-      424,  427,  425,    0,    0,    0,    0,    0,    0,  601,
-
-        0,    0,    0,    0,    0,    0,    0,    0,  607,  578,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,  644,  644,  644,  644,  644,  644,  644,    0,
-        0,    0,    0,    0,    0,    0,  644,  644,  644,  644,
-      644,  565,    0,    0,    0,    0,    0,    0,    0,  586,
-        0,    0,    0,    0,    0,  603,    0,    0,    0,    0,
-      588,    0,  629,    0,    0,    0,  558,    0,    0,    0,
-        0,    0,  644,  644,  644,  644,  644,  644,  644,    0,
-        0,    0,    0,    0,    0,    0,    0,  555,  555,  555,
-      555,  555,  555,  555,  555,  555,  555,  555,  555,  553,
-
-      555,  555,  555,  555,  555,  555,  555,  555,  555,  555,
-      555,  528,  534,  535,  536,  555,  555,  555,  555,  555,
-      555,  555,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,   42,  644,  644,  644,
-      644,   25,   25,   25,   25,   25,   25,   25,  644,  147,
-      149,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  113,  117,  644,  115,  644,  644,  644,  644,  141,
-      644,  644,  644,  644,  644,  644,   76,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-
-      130,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  220,  644,  185,  644,  644,  644,  644,  161,
-      163,  222,  644,  242,  242,  242,  242,  242,  242,  242,
-      242,  242,  242,  242,  242,  242,  242,  242,  242,  232,
-      644,  525,  644,  527,  517,  521,  519,  523,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  353,  644,  341,  644,  644,
-      644,  644,  644,  644,  644,  373,  644,  644,  644,  644,
-      644,  644,  413,  644,  644,  644,  644,  266,  270,  268,
-
-      644,  644,  644,  644,  644,  644,  284,  644,  644,  644,
-      644,  644,  644,  644,  644,  260,  644,  644,  644,  286,
-      644,  272,  644,  644,  644,  644,  644,  644,  644,  644,
-      297,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  450,  644,  644,  441,
-      644,  644,  644,  467,  644,  644,  644,  644,  644,  644,
-      644,  477,  644,  479,  644,  485,  644,  644,  496,  644,
-      509,  509,  509,  509,  509,  509,  509,  427,  427,  427,
-      427,  427,  427,  427,  427,    0,    0,    0,    0,    0,
-        0,    0,  586,    0,    0,    0,    0,    0,  603,    0,
-
-        0,    0,    0,  588,    0,  629,    0,    0,    0,  558,
-        0,    0,    0,    0,    0,  644,  644,  644,  644,  644,
-      644,  644,    0,    0,    0,    0,    0,    0,    0,    0,
-      644,  644,  644,  644,  567,    0,  596,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,  619,
+      619,  617,  617,  617,  617,  617,  617,    0,    0,    0,
+        0,    0,  619,  617,  617,  617,  617,  617,    0,    0,
+      560,  552,  545,  562,    0,  565,  554,  556,    0,  550,
+      539,    0,  541,  567,  548,    0,  569,  543,  558,    0,
+
         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,  618,  619,  617,  617,  617,  617,  617,    0,
+        0,    0,    0,    0,    0,  526,  520,  526,  526,  526,
+      526,  526,  526,  526,  526,  526,  526,  526,  526,  526,
+      526,  526,  513,  526,  526,  526,  526,  526,  526,  526,
+       17,  617,  617,  617,  617,   19,  617,  617,  617,  617,
+      617,   15,   11,  617,  617,    9,  617,  617,  617,  617,
+       25,  617,   75,  617,  617,  617,   93,   81,  617,   83,
+       85,   90,  617,   76,  617,   73,  617,  617,  617,  617,
+       43,  617,  617,  617,  617,  617,   35,  617,  617,  617,
+
+       61,  617,  617,  617,   47,   51,   52,   50,   50,   50,
+       50,   50,   49,   50,   69,   70,   68,   68,   68,   68,
+       68,   68,   68,   68,   68,   68,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  135,  617,  617,  133,  617,  617,  617,
+      617,  617,  617,  172,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  285,  617,
+      277,  617,  279,  283,  617,  617,  289,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  228,  220,
+      238,  236,  224,  222,  232,  226,  230,  202,  198,  206,
+
+      204,  192,  200,  196,  194,  617,  617,  617,  190,  617,
+      617,  617,  617,  617,  617,  298,  298,  298,  298,  298,
+      298,  298,  298,  298,  298,  298,  298,  298,  261,  262,
+      260,  260,  260,  253,  260,  260,  260,  260,  256,  249,
+      248,  617,  617,  617,  617,  617,  617,  617,  617,  496,
+      617,  358,  617,  617,  360,  617,  617,  617,  617,  366,
+      617,  617,  617,  394,  617,  617,  617,  368,  617,  617,
+      617,  617,  617,  617,  617,  378,  617,  364,  384,  617,
+      617,  617,  617,  617,  617,  617,  400,  617,  617,  414,
+      617,  617,  617,  617,  410,  617,  617,  428,  429,  427,
+
+      427,  427,  427,  427,  427,  422,  427,  427,  316,  617,
+      617,  344,  342,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  300,  617,  304,  617,  308,
+      617,  617,  617,  306,  617,  617,  617,  617,  617,  617,
+      617,  617,  328,  617,  617,  617,  617,  617,  617,  617,
+      348,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  482,  617,  617,  617,  617,  455,
+      617,  617,  480,  617,  449,  617,  617,  617,  617,  432,
+      267,  269,  617,  617,  270,  268,  266,  617,  617,  490,
+      617,  617,  617,  439,  440,  438,  438,  438,  438,  438,
+
+      438,  438,  438,    0,    0,  560,  552,  545,  562,    0,
+      565,  554,  556,    0,  550,  539,    0,  541,  567,  548,
+        0,  569,  543,  558,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,  618,  619,  617,
+      617,  617,  617,  617,    0,    0,    0,    0,    0,    0,
+      532,  530,  617,  617,  617,  617,    0,    0,    0,    0,
+        0,    0,  564,    0,    0,    0,    0,    0,  547,    0,
+        0,    0,    0,  592,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,  590,    0,    0,  617,  617,  617,
+      617,  617,  617,    0,    0,    0,    0,    0,    0,  526,
+
+      526,  526,  526,  526,  526,  526,  526,  526,  526,  526,
+      526,  526,  526,  526,  526,  526,  526,  526,  526,  526,
+      526,  526,  526,  526,  617,  617,  617,   33,   23,  617,
+      617,   13,  617,  617,  617,  617,  617,  617,  617,  617,
+       31,  617,   97,  617,  617,  617,   87,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,   41,  617,  617,
+       59,  617,  617,  617,  617,   50,   50,   48,   48,   50,
+       50,   50,   50,   68,   68,   68,   68,   68,   68,   68,
+       68,   68,   63,   68,  617,  617,  617,  617,  119,  152,
+      180,  182,  617,  617,  617,  160,  617,  617,  617,  617,
+
+      137,  142,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  139,  617,  144,  109,  617,  617,  617,  617,
+      617,  617,  617,  111,  617,  617,  121,  123,  617,  617,
+      141,  146,  617,  297,  617,  617,  617,  617,  287,  617,
+      617,  617,  617,  617,  617,  617,  291,  239,  617,  617,
+      214,  212,  218,  216,  210,  234,  617,  617,  188,  617,
+      617,  617,  241,  617,  617,  298,  298,  298,  298,  298,
+      298,  298,  298,  298,  298,  298,  298,  298,  260,  260,
+      260,  260,  260,  260,  260,  254,  617,  617,  617,  617,
+      617,  617,  617,  617,  494,  617,  617,  617,  617,  380,
+
+      617,  617,  398,  396,  390,  392,  617,  617,  617,  617,
+      617,  376,  617,  374,  372,  388,  617,  617,  617,  617,
+      617,  617,  617,  617,  402,  404,  617,  412,  617,  617,
+      617,  617,  418,  617,  427,  427,  427,  427,  427,  427,
+      426,  427,  427,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  346,  617,  617,  617,  617,  330,  617,  310,
+      617,  617,  302,  617,  617,  617,  617,  617,  617,  617,
+      336,  334,  332,  617,  617,  617,  617,  617,  354,  617,
+      617,  356,  617,  350,  617,  617,  617,  469,  617,  452,
+      617,  617,  445,  463,  617,  617,  617,  617,  617,  617,
+
+      617,  617,  617,  457,  617,  617,  471,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      438,  438,  438,  438,  438,  438,  435,  438,  436,    0,
+        0,    0,    0,    0,    0,  564,    0,    0,    0,    0,
+        0,  547,    0,    0,    0,    0,  592,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,  590,    0,    0,
+      617,  617,  617,  617,  617,  617,    0,    0,    0,    0,
+        0,    0,  617,  617,  617,  617,  617,    0,    0,    0,
+        0,    0,    0,    0,  555,    0,    0,    0,  566,    0,
+        0,  557,    0,  584,    0,  591,    0,    0,  593,    0,
+
+        0,    0,  529,    0,    0,    0,    0,    0,    0,  589,
+        0,    0,    0,    0,  617,  617,  617,  617,  617,  617,
+        0,    0,    0,    0,    0,    0,    0,  526,  526,  526,
+      526,  526,  526,  526,  526,  526,  526,  526,  526,  526,
+      526,  526,  526,  509,  514,  515,  516,  526,  526,  526,
+      526,  526,  526,  526,  524,  617,  617,  617,  617,  617,
+      617,  617,  617,    3,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,   95,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,   39,  617,
+       50,   50,   50,   50,   50,   50,   68,   68,   68,   68,
+
+       68,   68,   68,   68,   68,   68,  617,  176,  178,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  162,
+      166,  617,  164,  617,  617,  617,  617,  617,  617,  127,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  272,  617,  617,  617,  617,  617,  280,  617,
+      617,  293,  617,  295,  617,  243,  617,  208,  617,  617,
+      617,  617,  184,  186,  245,  617,  298,  298,  298,  298,
+      298,  298,  298,  298,  298,  298,  298,  298,  298,  298,
+      260,  255,  260,  260,  260,  260,  260,  617,  506,  617,
+
+      508,  498,  502,  500,  504,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  386,  617,  382,  617,  617,  617,
+      617,  416,  617,  617,  617,  617,  427,  427,  427,  427,
+      427,  427,  427,  427,  318,  322,  320,  617,  617,  617,
+      617,  617,  617,  617,  338,  617,  617,  617,  617,  617,
+      617,  617,  617,  314,  617,  617,  617,  340,  617,  324,
+      617,  617,  617,  617,  617,  617,  617,  352,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  459,  617,  617,  450,  617,  617,
+
+      617,  617,  617,  617,  617,  271,  617,  617,  617,  617,
+      488,  617,  484,  617,  438,  438,  438,  438,  438,  438,
+      438,    0,    0,    0,    0,    0,    0,    0,  555,    0,
+        0,    0,  566,    0,    0,  557,    0,  584,    0,  591,
+        0,    0,  593,    0,    0,    0,  529,    0,    0,    0,
+        0,    0,    0,  589,    0,    0,    0,    0,  617,  617,
+      617,  617,  617,  617,    0,    0,    0,    0,    0,    0,
+        0,  617,  617,  617,  617,  536,    0,  559,    0,    0,
         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-      644,  644,  644,  644,  644,  644,  644,  644,    0,    0,
-        0,    0,    0,    0,    0,    0,  555,  555,  555,  542,
-      555,  555,  555,  555,  555,  555,  555,  555,  539,  552,
-      555,  555,  555,  555,  555,  555,  555,  555,  555,  555,
-
-      537,  555,  531,  541,  555,  529,  555,  555,  555,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,   37,  644,  644,  644,  644,   25,   25,   25,
-       25,   25,   25,   25,   25,  644,  644,  644,  644,   64,
-       66,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  119,  644,  644,  155,  644,  644,  644,  644,
-      644,  644,  644,   80,   78,  644,  644,  101,  644,  644,
-      644,   54,  644,  644,  644,  644,  137,  135,  129,  139,
-      644,  644,  644,  123,  644,  121,  136,  134,  128,  138,
-      644,  644,  644,   62,  644,  644,  644,  644,  644,  644,
-
-      153,  644,  644,  644,  644,  644,  644,  644,  644,  242,
-      242,  242,  242,  242,  242,  242,  242,  242,  242,  242,
-      242,  242,  242,  242,  242,  242,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  318,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  274,  644,  644,  644,  644,
-
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  432,  644,  644,
-      644,  644,  486,  644,  644,  644,  509,  509,  509,  509,
-      509,  509,  509,  509,  427,  427,  427,  427,  427,  427,
-      427,  427,  426,    0,  596,    0,    0,    0,    0,    0,
+      587,  588,    0,    0,    0,    0,    0,    0,    0,    0,
+
+        0,    0,    0,  617,  617,  617,  617,  617,  617,    0,
+        0,    0,    0,    0,    0,    0,  526,  526,  526,  526,
+      526,  526,  526,  526,  526,  526,  526,  526,  526,  526,
+      526,  517,  512,  521,  526,  510,  522,  519,  523,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,    6,  617,
+       29,   27,  617,  617,  617,  617,   88,  617,  617,  617,
+      617,  617,   55,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,   50,   50,   50,   50,   50,   50,   68,   68,
+       68,   62,   62,   67,   67,   68,   68,   68,  617,  617,
+      617,  617,  115,  117,  617,  617,  617,  617,  617,  617,
+
+      617,  617,  617,  617,  617,  168,  617,  617,  617,  617,
+      617,  617,  131,  129,  617,  617,  617,  150,  617,  617,
+      617,  103,  617,  617,  617,  617,  617,  170,  617,  617,
+      617,  617,  113,  617,  617,  617,  617,  617,  274,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  298,  298,  298,  298,
+      298,  298,  298,  298,  298,  298,  298,  298,  298,  298,
+      260,  260,  260,  260,  260,  260,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+
+      617,  617,  617,  617,  617,  617,  427,  427,  427,  427,
+      427,  427,  424,  427,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  326,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  443,  617,  264,  617,  617,  617,
+      492,  617,  438,  438,  438,  438,  438,  438,  437,    0,
+      559,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,  587,  588,    0,    0,    0,    0,    0,
+
+        0,    0,    0,    0,    0,    0,  617,  617,  617,  617,
+      617,  617,    0,    0,    0,    0,    0,    0,    0,  533,
+      534,  531,  535,    0,    0,    0,  561,    0,    0,    0,
+        0,    0,  546,    0,    0,    0,    0,  585,    0,  586,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,  594,
+        0,    0,    0,  617,  617,  617,  617,  617,  617,    0,
+        0,    0,    0,    0,    0,    0,  526,  526,  526,  526,
+      526,  526,  526,  526,  526,  526,  526,  526,  526,  526,
+      526,  518,  617,  617,  617,  617,  617,  617,  617,  617,
+        8,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+       50,   50,   50,   50,   50,   50,   68,   68,   68,   68,
+       68,   68,   66,   68,  617,  617,  617,  617,  617,  617,
+      156,  617,  154,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  107,  105,  101,   99,  617,  174,  617,
+      617,  617,  617,  617,  617,  617,  617,  284,  617,  282,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  298,  298,  298,  298,  298,  298,
+      298,  298,  298,  298,  298,  298,  298,  298,  260,  260,
+
+      260,  260,  260,  260,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  427,  427,  427,  427,  427,  427,
+      427,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  465,  467,
+      617,  617,  617,  617,  617,  617,  476,  474,  617,  617,
+      617,  617,  617,  617,  617,  617,  478,  617,  617,  617,
+      617,  617,  617,  617,  617,  438,  438,  438,  438,  438,
+
+      438,    0,    0,    0,  561,    0,    0,    0,    0,    0,
+      546,    0,    0,    0,    0,  585,    0,  586,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,  594,    0,    0,
+        0,  617,  617,  617,  617,  617,  617,    0,    0,    0,
         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,  644,  644,
-      644,  644,  644,  644,  644,  644,    0,    0,    0,    0,
-        0,    0,    0,    0,  562,  644,  644,  560,  566,    0,
-
-        0,    0,  598,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,  577,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,  644,  644,  644,  644,  644,  644,
-      644,  644,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,  555,  555,  555,  555,  555,  555,  555,  549,  545,
-      555,  555,  555,  555,  555,  555,  555,  555,  555,  555,
-      555,  555,  555,  555,  555,  538,  555,  555,  550,  546,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,   25,   25,   25,
-       25,   25,   25,   25,   25,  644,  644,  644,  644,  644,
-
-      644,  107,  644,  105,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,   58,   56,   52,   50,
-      644,  644,  644,  127,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  242,  242,  242,  242,  242,  242,  242,  242,  242,
-      242,  242,  242,  242,  242,  242,  242,  242,  242,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  319,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  456,  458,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  469,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  509,  509,  509,  509,  509,  509,  509,  509,  427,
-      427,  427,  427,  427,  427,  427,  427,    0,    0,    0,
-
-      598,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-      577,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,  644,  644,  644,  644,  644,  644,  644,  644,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,  563,
-      564,    0,    0,    0,    0,    0,    0,  569,    0,    0,
+      538,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,  603,    0,    0,  597,    0,  617,  617,
+      617,  617,  617,  617,    0,    0,    0,    0,    0,    0,
+        0,  526,  526,  526,  526,  526,  526,  526,  526,  526,
+      526,  526,  526,  526,  526,  511,  617,  617,  617,  617,
+
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,   50,   50,   50,   50,
+       50,   50,   68,   68,   68,   68,   68,   68,    0,  617,
+      617,  617,  617,  617,  617,  158,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  298,  298,  298,  298,  298,  298,
+
+      298,  298,  298,  298,  298,  298,  298,  298,  260,  260,
+      260,  260,  260,  260,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  427,  427,  427,  427,  427,  427,
+      427,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  433,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+
+      438,  438,  438,  438,  438,  438,    0,    0,    0,    0,
+        0,    0,  538,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,  603,    0,    0,  597,    0,
+      617,  617,  617,  617,  617,  617,    0,    0,    0,    0,
+        0,    0,    0,    0,  551,  544,    0,    0,  549,    0,
         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,  631,    0,  644,  644,  644,
-      644,  644,  644,  644,  644,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,  555,  555,  555,  555,  555,  547,
-      543,  555,  555,  555,  555,  555,  555,  555,  555,  555,
-
-      555,  555,  555,  555,  530,  555,  548,  544,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,   25,   25,   25,   25,   25,
-       25,   25,   25,  644,  644,  644,  644,  644,  644,  109,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  242,  242,  242,  242,
-      242,  242,  242,  242,  242,  242,  242,  242,  242,  242,
-
-      242,  242,  242,  242,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  422,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  509,  509,  509,  509,  509,  509,  509,
-      509,  427,  427,  427,  427,  427,  427,  427,  427,    0,
-        0,    0,    0,    0,    0,  569,    0,    0,    0,    0,
+        0,  600,    0,    0,    0,    0,  617,  617,  617,  617,
+      617,  617,    0,    0,    0,    0,    0,    0,    0,  526,
+      526,  526,  526,  526,  526,  526,  526,  526,  526,  526,
+      526,  526,  526,  617,  617,  617,  617,  617,  617,  617,
+
+      617,    2,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,   36,  617,  617,
+      617,  617,  617,  617,   50,   50,   50,   50,   50,   50,
+       68,   68,   68,   68,   68,   68,    0,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  148,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  276,  278,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  298,  298,  298,  298,  298,  298,  298,
+
+      298,  298,  298,  298,  298,  298,  298,  260,  260,  260,
+      260,  260,  260,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  411,  617,  617,  617,
+      617,  405,  617,  427,  427,  427,  427,  427,  427,  427,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  438,
+
+      438,  438,  438,  438,  438,    0,  551,  544,    0,    0,
+      549,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,  600,    0,    0,    0,    0,  617,  617,
+      617,  617,  617,  617,    0,    0,    0,    0,    0,    0,
+        0,  616,    0,  563,  540,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,  614,    0,    0,    0,    0,
+        0,    0,  617,  617,  617,  617,  617,  617,    0,    0,
+        0,    0,    0,    0,    0,  526,  526,  526,  526,  526,
+      526,  526,  526,  526,  526,  526,  526,  526,  526,  617,
+      617,  617,  617,  617,  617,  617,   20,  617,  617,    5,
+
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,   50,   50,   50,   50,   50,   50,   68,   68,
+       68,   68,   68,   68,    0,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  296,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      298,  298,  298,  298,  298,  298,  298,  298,  298,  298,
+
+      298,  298,  298,  298,  260,  260,  260,  260,  260,  260,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  427,  427,  427,  427,  427,  427,  427,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  319,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  438,  438,  438,
+
+      438,  438,  438,  616,    0,  563,  540,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,  614,    0,    0,
+        0,    0,    0,    0,  617,  617,  617,  617,  617,  617,
+        0,    0,    0,    0,    0,    0,    0,    0,  568,    0,
+        0,    0,    0,    0,    0,    0,  613,    0,    0,    0,
+        0,    0,  595,    0,    0,    0,    0,  617,  617,  617,
+      617,  617,  617,    0,    0,    0,    0,    0,    0,    0,
+      526,  526,  526,  526,  526,  526,  526,  526,  526,  526,
+      526,  526,  526,  526,  617,  617,  617,  617,  617,  617,
+      617,  617,    7,  617,  617,  617,  617,  617,  617,  617,
+
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,   50,   50,   50,   50,
+       50,   50,   68,   68,   68,   68,   68,   68,    0,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  159,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  286,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  298,  298,  298,  298,  298,  298,  298,
+      298,  298,  298,  298,  298,  298,  298,  260,  260,  260,
+
+      260,  260,  260,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  407,  617,  617,  427,  427,  427,  427,
+      427,  427,  427,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  325,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  461,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  470,  617,  617,  617,  617,  617,  617,  617,
+      483,  438,  438,  438,  438,  438,  438,    0,  568,    0,
+
+        0,    0,    0,    0,    0,    0,  613,    0,    0,    0,
+        0,    0,  595,    0,    0,    0,    0,  617,  617,  617,
+      617,  617,  617,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,  612,  613,
+      615,  605,    0,    0,  604,    0,    0,    0,  598,    0,
+      572,  617,  617,  617,  617,  617,  617,    0,    0,    0,
+        0,    0,    0,    0,  526,  526,  526,  526,  526,  526,
+      526,  526,  526,  526,  526,  526,  526,  526,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+
+      617,  617,  617,  617,  617,  617,  617,  617,  617,   50,
+       50,   50,   50,   50,   50,   68,   68,   68,   68,   68,
+       68,    0,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  126,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  124,  617,
+      617,  617,  288,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  298,  298,  298,  298,  298,
+      298,  298,  298,  298,  298,  298,  298,  298,  298,  260,
+      260,  260,  260,  260,  260,  617,  617,  617,  617,  617,
+
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  427,  427,
+      427,  427,  427,  427,  427,  617,  617,  617,  617,  617,
+      617,  617,  321,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  446,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  485,  617,  617,  438,
+      438,  438,  438,  438,  438,    0,    0,    0,    0,    0,
+        0,    0,    0,  612,  613,  615,  605,    0,    0,  604,
+
+        0,    0,    0,  598,    0,  572,  617,  617,  617,  617,
+      617,  617,    0,    0,    0,    0,    0,    0,    0,    0,
         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,  631,    0,  644,  644,  644,  644,  644,
-      644,  644,  644,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,  582,  575,    0,    0,  580,  591,  594,
+      601,    0,  617,  617,  617,  617,  617,  617,  579,    0,
+        0,    0,    0,    0,    0,  526,  526,  526,  526,  526,
+      526,  526,  526,  526,  526,  526,  526,  526,  617,  617,
+      617,  617,  617,  617,  617,    1,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,   78,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,   50,
+       50,   50,   50,   50,   50,   68,   68,   68,   68,   68,
+
+       68,    0,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  102,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  298,  298,  298,  298,  298,  298,
+      298,  298,  298,  298,  298,  298,  298,  260,  260,  260,
+      260,  260,  260,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+
+      401,  403,  617,  617,  617,  617,  427,  427,  427,  427,
+      427,  427,  427,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  303,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  438,  438,  438,  438,  438,  438,
         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,  644,  644,  644,  644,  644,
-
-      644,  644,  644,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,  555,  555,  555,  555,  555,  555,  555,  555,
-      555,  555,  555,  555,  555,  555,  555,  555,  555,  555,
-      533,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,   25,   25,
-       25,   25,   25,   25,   25,   25,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,   99,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      242,  242,  242,  242,  242,  242,  242,  242,  242,  242,
-      242,  242,  242,  242,  242,  242,  242,  242,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  324,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  408,  644,  644,  644,  644,  644,  402,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  487,  644,  644,  644,  509,  509,  509,
-      509,  509,  509,  509,  509,  427,  427,  427,  427,  427,
-      427,  427,  427,    0,  582,  575,    0,    0,  580,  591,
-      594,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,  644,  644,  644,  644,
-      644,  644,  644,  644,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,  643,    0,  600,    0,    0,  571,    0,
+        0,  601,    0,  617,  617,  617,  617,  617,  617,  579,
+        0,    0,    0,    0,    0,    0,    0,    0,  608,  606,
+        0,    0,    0,    0,    0,    0,    0,  617,  617,  617,
+
+      617,  617,  576,    0,    0,    0,    0,    0,    0,  526,
+      526,  526,  526,  526,  526,  526,  526,  526,  526,  526,
+      526,  617,  617,  617,  617,  617,  617,  617,    4,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,   56,  617,  617,  617,
+      617,  617,   50,   50,   50,   50,   50,   50,   68,   68,
+       68,   68,   68,   68,    0,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  134,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+
+      617,  617,  617,  617,  290,  617,  617,  617,  617,  617,
+      617,  189,  617,  617,  617,  617,  298,  298,  298,  298,
+      298,  298,  298,  298,  298,  298,  298,  298,  260,  260,
+      260,  260,  260,  260,  617,  617,  617,  617,  617,  495,
+      617,  617,  617,  617,  365,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  427,  427,  427,  427,
+      427,  427,  427,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  305,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+
+      617,  617,  617,  617,  617,  617,  617,  617,  448,  617,
+      617,  617,  617,  617,  438,  438,  438,  438,  438,  438,
+        0,    0,  608,  606,    0,    0,    0,    0,    0,    0,
+        0,  617,  617,  617,  617,  617,  576,    0,    0,    0,
+        0,    0,    0,  553,    0,  607,    0,    0,  611,    0,
+      602,    0,  596,    0,  570,  573,  574,  571,  575,    0,
+        0,    0,    0,    0,  583,  526,  526,  526,  526,  526,
+      526,  526,  526,  526,  526,  526,  617,   18,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,   72,  617,  617,  617,  617,
+
+      617,  617,  617,  617,  617,   50,   50,   50,   50,   50,
+       68,   68,   68,   68,   68,   65,  617,  617,  617,  617,
+      617,  617,  617,  617,  151,  617,  617,  617,  617,  617,
+      617,  617,  617,  132,  130,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  298,  298,  298,  298,  298,  298,  298,  298,  298,
+      298,  298,  260,  260,  260,  260,  260,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+
+      393,  617,  617,  617,  617,  371,  617,  617,  617,  617,
+      617,  617,  617,  617,  415,  617,  617,  427,  427,  427,
+      427,  427,  427,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  307,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  438,  438,  438,  438,  438,  553,    0,
+      607,    0,    0,  611,    0,  602,    0,  596,    0,  570,
+      573,  574,  571,  575,    0,    0,    0,    0,    0,  583,
+      542,    0,  610,    0,  599,  577,  580,  581,  578,  582,
+
+      526,  526,  526,  526,  526,  617,  617,  617,  617,   14,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,   44,   40,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  106,  617,  617,  617,  617,  617,  171,
+      617,  617,  122,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  298,  298,  298,  298,
+      298,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  369,  617,  617,  617,  617,  617,  617,  420,  617,
+      617,  617,  617,  617,  617,  337,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  542,
+        0,  610,    0,  599,  577,  580,  581,  578,  582,  609,
+      617,  617,  617,  617,   10,  617,  617,  617,  617,  617,
+      617,   80,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,   60,  617,  617,  617,  617,  617,  617,  617,
+
+      617,  617,  617,  617,  617,  617,  617,  617,  163,  617,
+      617,  128,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  112,  617,  617,  617,  617,  617,  617,  617,  617,
+      227,  219,  617,  617,  617,  617,  221,  231,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  497,  501,
+      499,  503,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  387,  373,  617,  617,  363,  617,  617,
+      617,  413,  617,  617,  617,  617,  617,  617,  323,  617,
+      617,  617,  617,  617,  313,  311,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+
+      617,  617,  479,  617,  617,  617,  617,  617,  617,  617,
+      265,  489,  617,  609,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,   92,  617,  617,  617,  617,   77,  617,
+      617,  617,   34,   58,  617,   46,  617,  617,  617,  617,
+      116,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  104,  617,  617,  169,  617,
+      120,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      233,  223,  225,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  391,  389,  367,  377,  617,
+
+      383,  617,  617,  617,  409,  617,  617,  617,  617,  317,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  347,  617,  617,  617,  617,  617,  617,
+      481,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,   96,  617,  617,
+       82,  617,   91,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  153,  179,  617,  161,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      294,  292,  240,  617,  617,  237,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  242,
+
+      617,  617,  617,  617,  617,  617,  359,  617,  617,  617,
+      375,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  299,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  468,  617,  617,  617,  617,  617,  617,  456,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,   74,  617,   84,  617,  617,  617,
+      617,  617,  617,  617,  617,  114,  617,  617,  617,  617,
+      167,  617,  617,  617,  617,  617,  617,  100,  617,  617,
+      617,  617,  244,  617,  235,  229,  201,  197,  617,  617,
+      617,  199,  195,  617,  187,  617,  617,  246,  617,  617,
+
+      617,  617,  617,  617,  397,  395,  617,  617,  399,  417,
+      617,  343,  341,  617,  617,  309,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,   22,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  165,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  191,  193,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  381,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+
+      617,  617,  617,  617,  444,  617,  617,  617,  617,  454,
+      617,  617,  442,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  157,  617,  617,  617,  617,  617,  617,
+      617,   98,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  205,  617,  617,  617,  617,  617,  493,  617,  361,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  331,
+      617,  617,  355,  617,  617,  617,  617,  617,  617,  617,
+      617,  453,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+
+      617,  617,  155,  617,  617,  617,  108,  617,  617,  617,
+      617,  617,  617,  213,  617,  211,  617,  617,  617,  203,
+      617,  617,  617,  507,  617,  617,  385,  617,  617,  617,
+      301,  617,  335,  617,  617,  353,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,   12,  617,  617,  617,   24,   86,  617,  617,   54,
+      617,  617,  617,  617,  118,  181,  136,  617,  617,  617,
+      617,  617,  140,  617,  617,  617,  617,  209,  617,  617,
+      617,  357,  617,  617,  617,  617,  617,  617,  339,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  431,
+
+      617,  617,  617,  617,   28,   26,  617,  617,   94,   42,
+      617,  617,  617,  617,  617,  617,  617,  617,  145,  617,
+      217,  617,  617,  617,  617,  617,  617,  617,  617,  327,
+      333,  349,  617,  617,  617,  451,  460,  617,  617,  617,
+      617,  617,  617,  491,  617,  617,  617,  617,   38,  617,
+      617,  617,  617,  138,  617,  617,  617,  215,  617,  617,
+      617,  617,  315,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  477,  617,   16,  617,  617,  617,  617,  617,
+      173,  617,  143,  617,  617,  183,  185,  505,  617,  617,
+      329,  617,  617,  617,  462,  617,  617,  617,  487,  617,
+
+      617,  617,  617,  177,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,   30,  617,  617,  617,
+      110,  617,  617,  345,  617,  617,  617,  617,  617,  458,
+       32,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,   89,  175,  617,  617,  617,  351,  617,  617,  617,
+      617,  617,  207,  379,  617,  617,  617,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  473,  617,  617,
+      466,  617,  617,  464,  617,  149,  475,  617,  617,  617,
+      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
+      617,  617,  147,    0
 
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,  641,    0,    0,  644,  644,  644,  644,  644,  644,
-      644,  644,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,  555,  555,  555,  555,  555,  555,  555,  555,  555,
-      555,  555,  555,  555,  555,  555,  555,  555,  555,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,   11,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,   25,   25,
-       25,   25,   25,   25,   25,   25,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  242,  242,  242,  242,  242,  242,  242,  242,
-      242,  242,  242,  242,  242,  242,  242,  242,  242,  242,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  267,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  509,  509,  509,  509,  509,  509,  509,  509,  427,
-      427,  427,  427,  427,  427,  427,  427,  643,    0,  600,
-        0,    0,  571,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,  641,    0,    0,  644,  644,
-
-      644,  644,  644,  644,  644,  644,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,  605,    0,
-      609,    0,    0,    0,  635,  634,    0,    0,  640,    0,
-        0,    0,    0,  644,  644,  644,  644,  644,  644,  644,
-      644,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-      555,  555,  555,  555,  555,  555,  555,  555,  555,  555,
-      555,  555,  555,  555,  555,  555,  555,  555,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,   25,   25,   25,   25,
-       25,   25,   25,   25,  644,  644,  644,  644,  644,  644,
-
-      644,  644,  644,  644,  110,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      242,  242,  242,  242,  242,  242,  242,  242,  242,  242,
-      242,  242,  242,  242,  242,  242,  242,  242,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  346,  644,  644,  644,
-
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  404,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  250,  644,  644,  644,  644,  644,  644,
-      644,  273,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  452,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  461,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  509,  509,  509,  509,  509,  509,  509,  509,
-      427,  427,  427,  427,  427,  427,  427,  427,    0,    0,
-
-        0,  605,    0,  609,    0,    0,    0,  635,  634,    0,
-        0,  640,    0,    0,    0,    0,  644,  644,  644,  644,
-      644,  644,  644,  644,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,  639,  640,  642,    0,    0,  632,  613,  644,
-      644,  644,  644,  644,  644,  644,  644,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,  555,  555,  555,  555,
-      555,  555,  555,  555,  555,  555,  555,  555,  555,  555,
-      555,  555,  555,  555,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-
-      644,  644,   25,   25,   25,   25,   25,   25,   25,   25,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,   75,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,   73,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  242,  242,  242,  242,
-      242,  242,  242,  242,  242,  242,  242,  242,  242,  242,
-      242,  242,  242,  242,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  269,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  437,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  474,  476,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  509,  509,  509,  509,  509,  509,  509,
-
-      509,  427,  427,  427,  427,  427,  427,  427,  427,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,  639,  640,
-      642,    0,    0,  632,  613,  644,  644,  644,  644,  644,
-      644,  644,  644,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,  606,    0,    0,    0,    0,
-        0,    0,  644,  644,  644,  644,  644,  644,  644,  617,
-      622,    0,    0,    0,    0,    0,    0,    0,    0,  555,
-      555,  555,  555,  555,  555,  555,  555,  555,  555,  555,
-      555,  555,  555,  555,  555,  555,  644,   19,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-
-      644,  644,  644,  644,   25,   25,   25,   25,   25,   25,
-       25,   25,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-       53,  644,  644,  644,  644,  644,  120,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  242,
-      242,  242,  242,  242,  242,  242,  242,  242,  242,  242,
-      242,  242,  242,  242,  242,  242,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  398,  400,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  247,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  466,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  509,  509,  509,  509,  509,  509,  509,  509,
-
-      427,  427,  427,  427,  427,  427,  427,  427,    0,    0,
-        0,  606,    0,    0,    0,    0,    0,    0,  644,  644,
-      644,  644,  644,  644,  644,  617,  622,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,  644,  644,  644,  644,  644,  644,
-      619,    0,    0,    0,    0,    0,    0,    0,  626,  555,
-      555,  555,  555,  555,  555,  555,  555,  555,  555,  555,
-      555,  555,  555,  555,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,   29,  644,   25,   25,   25,   25,   25,   25,   25,
-
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  154,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      158,  152,  644,  644,  644,  644,  644,  644,  644,  644,
-      166,  644,  644,  644,  644,  242,  242,  242,  242,  242,
-      242,  242,  242,  242,  242,  242,  242,  242,  242,  242,
-      644,  644,  644,  644,  644,  514,  644,  644,  644,  644,
-      644,  644,  644,  644,  320,  644,  356,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-
-      644,  644,  644,  644,  644,  644,  376,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  251,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  439,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  509,  509,  509,  509,  509,
-      509,  509,  427,  427,  427,  427,  427,  427,  427,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,  644,  644,
-
-      644,  644,  644,  644,  619,    0,    0,    0,    0,    0,
-        0,    0,  626,  584,  590,  593,    0,    0,    0,    0,
-      638,    0,  630,  611,  614,  644,  644,  612,  618,    0,
-        0,    0,    0,    0,    0,  628,  555,  555,  555,  555,
-      555,  555,  555,  555,  555,  555,  555,  555,  555,  644,
-        9,  644,  644,  644,  644,  644,   17,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,   25,   25,   25,
-       25,   25,   25,  644,  644,  644,  644,  644,  644,  644,
-      644,  102,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,   81,   79,  644,  644,  644,  644,
-
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  242,  242,  242,  242,  242,  242,  242,  242,  242,
-      242,  242,  242,  242,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  302,  644,  644,  644,  342,  644,  644,
-      644,  644,  362,  644,  644,  644,  644,  644,  330,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  382,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  412,  644,  644,  644,  644,
-
-      644,  644,  644,  644,  644,  644,  644,  253,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  509,  509,  509,  509,  509,  509,
-      427,  427,  427,  427,  427,  427,  584,  590,  593,    0,
-        0,    0,    0,  638,    0,  630,  611,  614,  644,  644,
-      612,  618,    0,    0,    0,    0,    0,    0,  628,  573,
-        0,  637,  633,  616,  615,  620,  623,    0,    0,  621,
-      627,  555,  555,  555,  555,  555,  555,  555,  555,  644,
-
-      644,  644,  644,    5,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,   25,   25,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,   57,  644,  644,  644,  644,  644,  644,  644,
-      124,  644,  644,   71,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  242,  242,  242,  242,  242,
-      242,  242,  242,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-
-      644,  644,  644,  644,  334,  644,  644,  644,  644,  328,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  283,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  509,  509,  427,
-      427,  573,    0,  637,  633,  616,  615,  620,  623,    0,
-        0,  621,  627,  636,  625,  624,  555,  555,  644,  644,
-
-      644,  644,    1,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,   77,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,   61,  644,  644,  644,  644,
-      644,  644,  204,  196,  644,  644,  644,  644,  198,  208,
-      644,  644,  644,  644,  644,  644,  644,  644,  242,  242,
-      644,  644,  516,  520,  518,  522,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  344,  332,  644,  644,  644,  316,  644,  644,  644,
-
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  410,  644,  644,  644,  644,
-      644,  271,  644,  644,  644,  644,  259,  257,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  470,  644,  644,  644,
-      644,  644,  644,  239,  480,  644,  644,  644,  644,  644,
-      644,  644,  497,  636,  625,  624,  644,  644,  644,  644,
-      644,   39,  644,  644,  644,  644,  644,  644,  644,   21,
-      644,  644,  644,  644,   65,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  142,  644,
-
-      644,  644,  644,  644,   55,  644,  644,  122,  644,  644,
-      644,   69,  644,  644,  644,  644,  644,  644,  644,  210,
-      200,  202,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  306,  644,  644,  644,  644,  644,  360,  358,  322,
-      326,  354,  644,  644,  348,  644,  644,  644,  644,  380,
-      378,  644,  374,  644,  644,  644,  368,  644,  644,  644,
-      416,  644,  414,  406,  644,  644,  644,  265,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  292,  644,  644,  644,  644,  644,  644,  644,  472,
-
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,   43,  644,
-       31,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  104,  150,  644,  644,  644,  644,  114,  644,
-      644,  644,  644,   85,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  217,  644,  644,  214,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  219,  644,  644,  644,  644,  644,  644,  644,
-      644,  312,  644,  644,  644,  336,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-
-      644,  644,  644,  644,  243,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  459,  644,  433,  644,  644,
-      644,  644,  644,  447,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  493,  644,  644,  644,  644,  644,
-      644,   33,  644,  644,  644,  644,  644,  644,  644,   63,
-      644,  644,  644,  112,  644,  118,  644,  644,  644,  644,
-       83,  644,  644,  644,   51,  644,  644,  644,  644,  644,
-      644,  221,  644,  212,  206,  178,  174,  644,  644,  644,
-      176,  172,  644,  164,  644,  644,  223,  644,  644,  644,
-      644,  644,  644,  644,  644,  366,  364,  644,  644,  644,
-
-      386,  384,  644,  644,  644,  644,  390,  644,  396,  644,
-      420,  644,  287,  644,  255,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,   13,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  116,  644,
-      644,  644,  144,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  168,
-      170,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  350,  644,  340,  644,  644,  644,  370,  644,  644,
-
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  435,  644,  644,  644,  644,
-      445,  644,  644,  431,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,   47,  644,   45,  644,
-      644,  644,  644,  108,  644,  644,  644,  644,  644,  644,
-      644,   49,  644,  133,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  182,  644,  644,  644,  644,  644,  512,
-      314,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  277,  644,  644,
-      644,  300,  644,  644,  644,  644,  644,  644,  644,  644,
-
-      444,  644,  644,  503,  501,  644,  644,  499,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  106,  644,
-      644,  140,  644,  644,  644,  644,  644,  644,  644,  644,
-      190,  644,  188,  644,  644,  644,  180,  644,  644,  644,
-      526,  644,  644,  644,  644,  352,  644,  644,  644,  372,
-      644,  644,  644,  644,  644,  281,  644,  644,  261,  298,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  495,  489,  644,  644,    3,   35,  644,  644,
-      644,  644,   67,  156,   87,  644,  644,  644,  644,  644,
-      644,   91,  644,  644,  644,  644,  186,  644,  644,  644,
-
-      644,  644,  644,  644,  644,  644,  394,  644,  644,  644,
-      245,  644,  644,  285,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,   41,
-      644,  644,  644,  644,  644,  644,  644,  644,   96,  644,
-      194,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      392,  644,  644,  644,  275,  279,  294,  644,  644,  644,
-      442,  451,  644,  644,  644,  644,  644,  491,  644,  644,
-      644,  644,  644,  644,  644,   89,  644,  644,  644,  644,
-      192,  644,  644,  644,  644,  308,  644,  644,  644,  418,
-      263,  644,  644,  644,  644,  644,  644,  644,  468,  644,
-
-        7,  644,  644,  644,  644,  126,  644,   94,  644,  644,
-      644,  160,  162,  524,  644,  644,  644,  644,  644,  644,
-      644,  644,  453,  644,  644,  478,  644,  644,  644,  148,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,   59,
-      644,  310,  304,  644,  644,  289,  644,  644,  644,  644,
-      449,   15,  644,  644,  644,  644,  644,  644,  388,  644,
-      644,  644,  644,   38,  146,  644,  644,  644,  644,  296,
-      644,  644,  644,  644,  131,  184,  338,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  464,  644,  644,
-
-      457,  644,  455,  100,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,   98,
-        0
     } ;
 
 static yyconst flex_int32_t yy_ec[256] =
@@ -1072,18 +1025,18 @@ static yyconst flex_int32_t yy_ec[256] =
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    2,    1,    4,    5,    1,    1,    1,    6,    1,
         1,    7,    8,    9,   10,   11,   12,   13,   14,   15,
-       16,   17,   18,   19,   20,   19,   19,   21,   22,    1,
-       23,    1,    1,    1,   24,   25,   26,   27,   28,   29,
-       30,   31,   32,   33,   34,   35,   36,   37,   38,   39,
-       40,   41,   42,   43,   44,   33,   45,   46,   47,   33,
-        1,    1,    1,    1,   48,    1,   49,   50,   51,   52,
-
-       53,   54,   55,   56,   57,   58,   59,   60,   61,   62,
-       63,   64,   65,   66,   67,   68,   69,   70,   71,   72,
-       73,   74,    1,    1,    1,    1,    1,    1,    1,    1,
+       16,   17,   18,   19,   19,   19,   19,   20,   21,    1,
+       22,    1,    1,    1,   23,   24,   25,   26,   27,   28,
+       29,   30,   31,   32,   33,   34,   35,   36,   37,   38,
+       32,   39,   40,   41,   42,   32,   32,   43,   44,   32,
+        1,    1,    1,    1,   45,    1,   46,   47,   48,   49,
+
+       50,   51,   52,   53,   54,   55,   56,   57,   58,   59,
+       60,   61,   62,   63,   64,   65,   66,   67,   68,   69,
+       70,   71,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,   75,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,   72,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
@@ -1097,2573 +1050,2398 @@ static yyconst flex_int32_t yy_ec[256] =
         1,    1,    1,    1,    1
     } ;
 
-static yyconst flex_int32_t yy_meta[76] =
+static yyconst flex_int32_t yy_meta[73] =
     {   0,
-        1,    2,    3,    1,    4,    1,    1,    1,    2,    4,
-        5,    4,    6,    6,    6,    6,    6,    6,    6,    6,
-        1,    1,    1,    7,    7,    7,    7,    7,    7,    7,
-        7,    7,    7,    7,    7,    7,    7,    7,    7,    7,
-        7,    7,    7,    7,    7,    7,    7,    6,    7,    7,
-        7,    7,    7,    7,    7,    7,    7,    7,    7,    7,
-        7,    7,    7,    7,    7,    7,    7,    7,    7,    7,
-        7,    7,    7,    7,    1
+        1,    1,    2,    1,    3,    1,    1,    1,    1,    3,
+        3,    3,    4,    4,    4,    4,    4,    4,    4,    1,
+        1,    1,    4,    4,    4,    4,    4,    4,    4,    4,
+        4,    4,    4,    4,    4,    4,    4,    4,    4,    4,
+        4,    4,    4,    4,    4,    4,    4,    4,    4,    4,
+        4,    4,    4,    4,    4,    4,    4,    4,    4,    4,
+        4,    4,    4,    4,    4,    4,    4,    4,    4,    4,
+        4,    1
     } ;
 
-static yyconst flex_int16_t yy_base[6539] =
+static yyconst flex_int16_t yy_base[6113] =
     {   0,
-        0,   75,  150,    0,    0,    0,    0,    7,    5,   53,
-       45,   51,  225,    0,    0,    0,  252,  271,    0,    0,
-        0,    0,   63,   69,  338,  413,  488,    0,  563,  638,
-       77,   78,  312,  321,  335,  404,  344,  413,  342,  390,
-      548,  623,   46,  418,  567,  642, 9742, 9741,  649,  654,
-      317,  398,  721,    0,  796,    0,  870,  889,  909,  984,
-     1007, 1012, 9808, 9811, 9811, 9811, 9784,  945, 1079,  955,
-     1020, 9811, 9811, 9811,    0, 9768, 9767, 9778,    0, 9775,
-     1106, 9811, 9811, 9811,    0, 9779,  963, 9811,    0,    0,
-     1030, 1139, 9811, 9811, 9811,   23, 1073, 1155, 1158, 1166,
-
-     1169, 1156,  889, 1007,  870, 1191,  582,  657,   99, 1200,
-     1209, 1220, 1010,   72,  260,  417, 9734,   10,    3,   71,
-      398,  254, 1174,  260,  324,  312,   59, 9811, 1229, 1257,
-     1271, 1281,    0, 9762, 9761,    2, 9772, 1004, 9769,   19,
-      344,  266, 1243,  376,  343, 9746, 9746,  530,  320,  889,
-     1255,  539,  427,  570,  647,  999,  559,  650,  391,    0,
-        0, 1313, 1323, 1114, 1223, 1339, 1342, 1350, 1353, 1174,
-     9811, 9811, 9811, 9771, 1376,    0, 1386, 1396, 9811, 9811,
-     9811,    0, 9755,  639, 9754,  649, 1388, 9765,    3, 1025,
-      914, 1340, 1021, 9811,   23,    0, 9811,    0, 9767, 1413,
-
-        0, 1438, 1448, 9787, 9811, 9786,    0, 9749, 9748, 9759,
-      641, 9756, 1443,  827,  634,  808,  410,  381,  266, 1261,
-     9733,  547,  825,  615, 1008, 1423, 1021,  565, 1385,  884,
-      547,  883, 9711, 1080,  882, 1434,  959, 1327, 1073,  998,
-     1089, 1445, 1064, 1035,  568, 1073, 1125, 9715, 9719, 1318,
-     1187, 1114, 1451, 1461, 1033, 1202, 9726,  829, 1410, 9717,
-     1051, 1124, 1164, 1145, 1476, 1098, 1205, 1201, 1245, 1427,
-     9718,  962, 9713, 1253, 1483, 1307, 9811, 1539, 1547, 1557,
-     1567, 9811,    0, 9737, 9736, 9747, 1214, 9744, 9708, 9702,
-     9720, 9811, 1575, 1583, 1593, 1603,    0, 9730, 9729, 9740,
-
-     1215, 9737, 9701, 9706, 9709, 1622, 1641, 1660, 1679, 9758,
-     9757, 9811, 9756, 1312, 1688, 1707, 1759, 1777, 9755, 9754,
-     9753, 1797, 1872, 9717, 1240, 1241,    9, 1807, 9811, 1812,
-     9694, 9690, 9701, 1296, 9698, 9725, 1838, 9811, 1857, 1277,
-     1383, 1346, 9722, 1387, 9720, 1398, 1401, 1382, 9715, 1455,
-     9702,    7, 1463, 9682, 9687, 9680, 9679, 9678, 9691, 1872,
-     1885, 1909,    0, 9703, 9701, 9712, 9699, 9700, 9688, 9715,
-     9694, 9693, 9704, 1454, 9701,    0, 1917, 1935, 1945, 1536,
-     1748, 1831, 1622, 1641, 1933, 1961, 1964, 1977, 1980, 1988,
-     1992, 2003, 9710, 9689, 9688, 9699, 1471, 9696, 2006, 2014,
-
-     1859, 2017, 2025, 2029, 2039, 2042, 2050, 2053, 2061, 9662,
-     9654, 9659, 9652, 9666, 9658, 9658, 9662, 1371, 9662, 9653,
-     9641, 9645, 9643, 9649,    0, 9646, 1448, 9646, 9640, 9655,
-     9640, 9654, 9640, 1701, 9640, 9632, 9651, 9633, 9641, 9637,
-        0, 9634, 9641, 2079, 2104, 2114, 2124,    0, 9658, 9656,
-     1040, 9667, 9654, 1317, 9655, 9643, 9624, 1462, 9635, 9621,
-     9621, 9617, 9634, 9625, 1691, 1458, 9614, 9620, 9607, 1397,
-     9616, 1229, 9624, 9625, 9604, 9607, 9622, 9610, 9620, 9602,
-     9618, 9598, 1616, 9616, 1661,  651, 9599, 9602, 1466, 1773,
-     9615, 9597, 9601, 1472, 1470, 9589, 9596, 9604, 9597, 9589,
-
-     2096, 2104, 9588, 9594, 9591, 9601, 9582, 9584, 9583, 9585,
-     1573,    0, 2160, 2170, 2180, 2072, 2196, 2199, 2208, 2211,
-     2219, 2102, 9630, 9609, 9608, 9619, 1591, 9616, 1570,    0,
-     1618,    0, 1620, 1644, 1642, 9641, 9638, 9635, 9638, 9588,
-     9575, 9565, 9585, 9574, 9577, 9576, 9581, 9565, 9577, 9567,
-        0, 9577, 9570, 9562, 9558, 1634, 9573, 9557, 9561, 9555,
-     9554, 9552, 9551, 9561, 9563, 2183, 9555, 9558, 9560, 9545,
-     9544, 1663, 9543, 1646, 9553, 1693, 2051, 9551, 9551, 9540,
-     9538, 9536, 1483, 9542, 9536,    0, 9537, 9543, 1681, 9546,
-     2184, 9545, 9535, 9529, 9528, 9530, 9533, 9528, 9525, 9523,
-
-     1700, 9523, 9524, 9533, 9529, 9523, 9520, 1265, 1695, 9530,
-     9529, 9517, 9526, 9511, 9506, 9522, 9514,    0, 9508,    0,
-     9513, 9513, 9520, 9503, 9503, 9512, 9498, 9499, 9512, 9502,
-     9497, 9514, 1715, 9490, 9497, 9498, 1721, 9495, 9497, 9497,
-     9506, 1787, 9491, 9497, 9490, 9503, 1618, 9487, 9499, 9492,
-     1762, 9495, 9490, 9480, 9478, 9487, 1577, 9490, 9489, 9474,
-     9485, 9490, 1341, 1840, 9476, 9484, 9483, 9483, 9477, 9467,
-     9468, 9465, 9464, 9463, 9463, 9465, 9461, 1723, 9459, 9463,
-        0, 9457, 9462, 9463, 9468, 9455, 9450, 1797,    0, 9449,
-     1847, 9450, 9448, 1754, 9444, 9460, 9461, 9445, 9457, 1774,
-
-     9455, 9442, 9443, 9434, 9443, 2244, 2252, 2262, 2272,    0,
-     9468, 9466, 9477, 9464, 9465, 9453,    0, 9435, 9431, 2280,
-     2288, 2298, 2308,    0, 9460, 9458, 9469, 9456, 9457, 9445,
-     9428, 9434, 9416, 2327, 2346, 2365, 9484, 9811, 1954, 2374,
-     9483, 9811, 2348, 2202, 2065, 2383,  870, 2317, 1834, 2328,
-     2211, 1939, 1908, 2043, 1965, 2214, 2392, 1980, 1913, 1993,
-     2007, 2017, 1576, 2424, 2442, 2460, 9447, 1825, 1828, 1956,
-     1968, 1810, 1985, 2087, 2123, 2165, 2083, 2394, 1911, 2470,
-     9424, 9421, 9432, 9419, 9420, 9407, 9450, 2399, 9445, 9434,
-     9443, 9437, 9430, 9431, 9811, 9439, 9435, 9811, 9432, 9426,
-
-     9811, 9439, 9811, 9442, 9811, 9423, 2124, 9811, 9421, 9420,
-     9811, 9811, 9430, 9420, 9394, 1117, 9409, 9387, 1956, 9391,
-     2478, 2488, 9420, 9412, 9422, 9423, 2134, 9409, 9434, 9414,
-     9412, 9423, 9410, 9411, 9399, 2496, 2506, 2418, 2409, 2522,
-     2530, 2533, 2541, 2545, 2556, 2559, 2567, 2575, 2571, 9427,
-     9407, 9405, 9416, 9403, 9404, 9392, 2327, 2584, 2592, 2595,
-     2605, 2616, 2620, 2624, 2632, 2640, 2643, 2653,    0, 9374,
-     9381,    0, 9386, 9371, 9379,    0, 9365, 9383, 9366, 9375,
-     9380,    0,    0, 9377,    0, 9362, 9363, 9373, 9360, 9363,
-        0,    0, 9353, 9353,    0,    0, 9365, 9361, 9351,    0,
-
-     9355, 9362, 9346,    0, 2659, 2671, 9377, 9369, 2199, 9379,
-     9380,    0, 2302, 9366, 9348, 9355, 9354, 9357, 9353, 9339,
-     9349, 9335, 9336, 2028, 9331, 9334, 2358, 9346, 9345, 9326,
-     9326, 9379, 9341, 9339, 9338, 9330,    0, 9322, 2318, 9334,
-     9327, 2647, 2021, 9319, 9330, 9317, 9315, 9320, 2083, 9331,
-     2563, 9318, 2149, 9329, 9323, 9317, 9308, 9310, 1984, 9322,
-     2121, 9307, 9311, 9310, 9316,    0, 9302, 9319, 9315, 9314,
-     9350, 9303, 9308, 9301, 2649,    0,    0,    0, 9344,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0, 9295, 9295, 9289,    0, 9303, 9298, 9297, 9293,
-
-     9298, 9283, 2698, 2709, 2725, 2656, 2728, 2736, 2739, 2753,
-     9333, 9313, 9311, 9322, 9309, 9310, 9298, 2184,    0, 2282,
-        0, 9811, 9811, 9284, 9281, 9293, 9286, 2364, 9288, 9274,
-     9270,    0, 9288, 9281, 9281, 9265, 9269,    0, 9265, 9277,
-     9276, 9279,    0, 9270, 9275, 9262, 9271,    0, 9262, 9256,
-     9255, 9258,    0, 9257, 9250,    0, 9252, 9260,    0, 9247,
-     2385,    0, 9253, 2553, 9222, 9232,   62,    0,   88,  296,
-      351,  416,    0,  556,    0,    0,    0,  621,  893, 1001,
-     1071, 1217, 1285, 1412, 1441, 1471, 1507,    0, 1587, 1622,
-        0, 1647, 1660, 1733, 1729, 1767,    0, 1844,    0,    0,
-
-     1888, 1914, 1919, 1938, 1981,    0, 1987, 2017,    0, 2061,
-     2087,    0, 2388, 2093, 2104, 2154, 2161, 2180,    0, 2188,
-     2189, 2701, 2221,    0, 2273, 2300, 2293, 2306, 2306, 2352,
-     2322, 2309,    0, 2351, 2339, 2480,    0, 2354,    0, 2385,
-        0, 2399, 2389, 2386,    0, 2390, 2407, 2399, 2406, 2400,
-     2414, 2419, 2416, 2480, 2419, 2434, 2436, 2451, 2461, 2466,
-     2487, 2488,    0, 2511, 2497, 2513, 2513, 2508, 2521, 2529,
-     2525, 2538, 2533, 2559, 2557, 2582, 2587, 2592,    0, 2582,
-     2594, 2590, 2609,    0, 2602, 2605, 2673, 2616,    0, 2597,
-     2632, 2624, 2646,    0,    0,    0,    0, 2644, 2643, 2650,
-
-     2654, 2714, 2676, 2689,    0, 2679,    0, 2691, 2703, 2694,
-     2697, 2701, 2707,    0, 2704, 2712, 2760, 2770, 2746, 2748,
-     2760, 2763, 2766, 2752, 2733, 2737, 2787, 2797, 2773, 2776,
-     2788, 2791, 2794, 2780, 2771, 2763, 2759, 2826, 2826, 2828,
-     2829, 2830, 2831, 2833, 2836, 2837, 2838, 2839, 2840, 2841,
-     2843, 2844, 2845, 2848, 2846, 2849, 2847, 2850, 2852, 2853,
-     2855, 2856, 2854, 2857, 2859, 2861, 2862, 2863, 2864, 2865,
-     2866, 2874, 2890, 2930, 2845, 2846, 2856, 2857, 2883, 2847,
-     2909, 2898, 2893, 2897, 2916, 2917, 2910, 2944,    0, 2848,
-     2866, 2869, 2882, 2857, 2897, 2902, 2909, 2899, 2899, 2927,
-
-     2926, 2922, 2938, 2939, 2937, 2928, 2943, 2945, 2948, 9811,
-     2934, 2943, 2939, 2952, 2922, 2923, 2927, 2979, 2917, 2923,
-     2915, 2936, 2944, 2949, 2950, 2951, 2962, 2945, 2966, 2946,
-     2947, 2961, 2955, 2967, 2970, 2973, 2960, 2962, 3001, 3004,
-     3012, 3015, 3023, 3026, 3035, 3038, 3046, 3049, 3057, 3060,
-     3071, 3080, 2959, 2972, 2967, 2986, 2989, 3046, 2978, 3083,
-     3093, 3096, 3106, 3120, 3123, 3131, 3134, 3143, 3146, 3155,
-     2968, 2982, 2970, 2972,    0,    0, 2977, 3004,    0, 2991,
-     3011, 3000, 3009,    0, 3029, 3036, 3020,    0, 3042, 3033,
-     3031, 3052, 3058, 3043, 3075, 3076,    0, 9811, 3077, 3095,
-
-     3078, 3099, 3079, 3064, 3087, 3089, 3080, 3111, 3113,    0,
-        0, 3102, 3099, 3113,    0, 3101, 3120, 3117, 3113,    0,
-        0, 3109, 3123, 3157, 3122, 3128, 3120,    0, 3125,    0,
-        0, 3119, 3133, 3132, 3121, 3136, 3130, 3135,    0, 3144,
-        0, 3150, 3132, 3134, 3148, 3142, 3154, 3142, 3140, 3147,
-     3142, 3144, 3159, 3154, 3150,    0, 3162, 3157, 3160, 3162,
-        0, 3166, 3167,    0,    0, 3168, 3178, 3176, 3167,    0,
-        0, 3209,    0, 3179, 3183, 3165,    0,    0,    0,    0,
-        0, 3164, 3164,    0, 3168, 3173, 3174,    0, 3188, 3192,
-     3199, 3237, 3240, 3248, 3251, 3259, 3262, 3271, 3195, 3208,
-
-     3203, 3222, 3225, 3252, 3214, 3237,    0, 3216, 3208, 3210,
-     3217, 3273, 3277, 3234, 3246,    0, 3230, 3239,    0, 3249,
-        0, 3245,    0,    0, 3251, 3249,    0, 3253, 3235,    0,
-        0,    0,    0,    0, 3250, 3256, 3258, 3259, 3251, 3260,
-     3262, 3250, 3263, 3252,    0, 3258, 3266,    0,    0,    0,
-        0, 3243, 3264, 3265, 3272, 3268, 3267, 3274,    0,    0,
-        0,    0,    0, 3277, 3266, 3279,    0, 3271,    0, 3256,
-     3282, 3282,    0, 3278, 3262,    0,    0,    0, 3272, 3275,
-        0, 3270, 3288, 3285, 3275, 3277,    0, 3269, 3274, 3285,
-     3286, 3286, 3296, 3283, 3296, 3285,    0, 3288, 3301, 3301,
-
-     3307, 3305,    0, 3297, 3297,    0, 3296, 3310, 3312, 3299,
-     3315, 3304, 3297,    0,    0,    0, 3298, 3304, 3307, 3312,
-        0, 3317,    0, 3303, 3325,    0, 3326,    0, 3322, 3310,
-     3329, 3326, 3307,    0, 3320, 3334,    0, 3331,    0, 3337,
-     3333,    0, 3334, 3326, 3342, 3338, 3324, 3339, 3327,    0,
-     3336, 3345, 3345, 3351, 3352, 3338, 3336, 3337, 3344, 3336,
-     3356, 3356, 3343, 3349, 3345, 3364,    0, 3355,    0, 3355,
-        0,    0, 3363,    0, 3379, 3380, 3381, 3392, 3375, 3395,
-     3375,    0,    0, 3386, 3387, 3388, 3399, 3382, 3402, 3382,
-        0, 3382,    0, 3429, 3430, 3433, 3431, 3432, 3434, 3435,
-
-     3436, 3437, 3438, 3440, 3439, 3441, 3443, 3448, 3442, 3444,
-     3445, 3446, 3449, 3447, 3450, 3451, 3454, 3452, 3459, 3461,
-     3464, 3478, 3436, 3440, 3446, 3457, 3448, 3460, 3451, 3485,
-     3487, 3488, 3489, 3494, 3490, 3497, 3438, 3440, 3452, 3435,
-     3456,    0, 3477, 3473, 3475, 3473, 3482, 3476, 3490, 9811,
-     3488, 3485, 3485, 3486, 3488, 9811, 3495, 3510, 3491, 3507,
-     9811, 3505, 9811, 3478, 3475, 3539, 9811, 3473, 3487, 3496,
-     3485, 3519, 3511, 3508, 3519, 3510, 3528, 3505, 3513, 3514,
-     3519, 3520, 3521, 3532, 3515, 3536, 3516, 3537, 3561, 3564,
-     3572, 3575, 3583, 3591, 3602, 3606, 3622, 3630, 3639, 3642,
-
-     3650, 3525, 3530, 3532, 3540, 3551, 3535, 3562, 3542, 3653,
-     3661, 3664, 3672, 3675, 3688, 3696, 3699, 3707, 3710, 3718,
-     3721, 3729, 3542, 3529, 3549, 3533, 3538, 3540, 3542, 3543,
-     3552, 3571, 3551, 3558, 3555, 3575,    0, 3575, 3565, 3573,
-     3583, 3599, 3596, 3659, 3598, 3621, 3600, 3614, 3609,    0,
-        0, 3591, 3607, 3602, 3619, 3620, 3636, 3697, 3642, 3625,
-     3643,    0,    0, 3661,    0, 3663, 3659, 3710, 3678,    0,
-     3683, 3668, 3687, 3690, 3694, 3695,    0, 3690, 3691, 3679,
-     3681, 3685, 3698, 3687, 3704, 3709, 3687, 3707, 3699, 3702,
-     3718, 3707, 3712, 3714, 3716, 3707, 3707, 3723, 3712, 3715,
-
-        0, 3730, 3714, 3733, 3734, 3724, 3725, 3720, 3731, 3735,
-     3735, 3776,    0, 3743,    0, 3727, 3744, 3741, 3750,    0,
-        0,    0, 3749, 3773, 3798, 3801, 3809, 3812, 3821, 3836,
-     3844, 3762, 3767, 3769, 3777, 3788, 3772, 3798, 3779,    0,
-     3765,    0, 3761,    0,    0,    0,    0,    0, 3764, 3763,
-     3767, 3771, 3801, 3789, 3790, 3775, 3800, 3804, 3792, 3808,
-     3795, 3796, 3800, 3793, 3804, 3814, 3801, 3801, 3817, 3802,
-     3808, 3825, 3808, 3813, 3808,    0, 3824,    0, 3827, 3826,
-     3819, 3819, 3835, 3826, 3819,    0, 3831, 3841, 3837, 3840,
-     3844, 3838,    0, 3824, 3842, 3845, 3848,    0,    0,    0,
-
-     3849, 3831, 3851, 3847, 3851, 3854,    0, 3856, 3838, 3843,
-     3854, 3839, 3855, 3844, 3844,    0, 3859, 3860, 3857,    0,
-     3849,    0, 3852, 3856, 3865, 3870, 3851, 3873, 3869, 3870,
-        0, 3871, 3864, 3865, 3877, 3861, 3876, 3864, 3865, 3865,
-     3919, 3885, 3887, 3866, 3871, 3890,    0, 3873, 3887,    0,
-     3888, 3893, 3890,    0, 3880, 3888, 3884, 3880, 3896, 3898,
-     3880,    0, 3904,    0, 3893,    0, 3899, 3907,    0, 3907,
-     3920, 3917, 3928, 3919, 3937, 3914, 3922, 3928, 3925, 3936,
-     3927, 3945, 3922, 3930, 3913, 3971, 3972, 3974, 3973, 3975,
-     3976, 3978, 3977, 3979, 3980, 3981, 3982, 3984, 3983, 3985,
-
-     3987, 3986, 3988, 3989, 3994, 3990, 3991, 3993, 3996, 3992,
-     3997, 3998, 3999, 4002, 4003, 3976, 3991, 4002, 3997, 3996,
-     3970, 4001, 4025, 4024, 4033, 4038, 4041, 4039, 4043, 4042,
-     3981, 3993, 3984, 4003,    0, 4017, 9811, 4033, 4027, 4030,
-     4020, 4021, 4041, 4044, 4029, 4030, 4046, 4048, 4040, 4035,
-     4047, 4043, 4008, 4013, 4035, 4035, 4022, 4027, 4035, 4046,
-     4043, 4044, 4053, 4054, 4047, 4048, 4055, 4070, 4071, 4063,
-     4060, 4072, 4063, 4081, 4058, 4066, 4066, 4105, 4108, 4116,
-     4119, 4127, 4130, 4138, 4152, 4161, 4164, 4172, 4175, 4183,
-     4191, 4083, 4075, 4073, 4116, 4081, 4099, 4077, 4091, 4194,
-
-     4205, 4213, 4216, 4224, 4227, 4235, 4238, 4246, 4249, 4066,
-     4074, 4076, 4097, 4082, 4099, 4091, 4107, 4107, 4108, 4111,
-     4108, 4113,    0, 4132, 4119, 4137, 4126, 4149, 4150, 4160,
-     4167, 4160, 4163, 4171, 4192, 4155, 4164, 4174, 4176,    0,
-        0, 4195, 4192, 4188, 4193, 4191, 4214, 4202, 4202, 4202,
-     4219, 4220,    0, 4221, 4222,    0, 4210, 4224, 4211, 4225,
-     4226, 4213, 4206,    0,    0, 4230, 4219, 4219, 4234, 4235,
-     4217,    0, 4231, 4232, 4237, 4238,    0,    0,    0,    0,
-     4223, 4238, 4230,    0, 4229,    0,    0,    0,    0,    0,
-     4235, 4243, 4225,    0, 4242, 4248, 4228, 4241, 4255, 4242,
-
-        0, 4249, 4244, 4259, 4260, 4248, 4255, 4256, 4251, 4272,
-     4311, 4314, 4323, 4326, 4334, 4337, 4345, 4360, 4289, 4281,
-     4279, 4323, 4286, 4305, 4282, 4290, 4278, 4292, 4274, 4295,
-     4295, 4292, 4291, 4298, 4303, 4315, 4299, 4321, 4310, 4310,
-     4327, 4313, 4310, 4329, 4332, 4315,    0, 4331, 4328, 4328,
-     4319, 4324, 4341, 4344, 4327, 4346, 4327, 4336, 4346, 4335,
-     4332, 4333, 4352, 4340, 4337, 4343, 4345, 4354, 4354, 4338,
-     4356, 4355, 4347, 4359, 4353, 4351, 4359, 4348, 4360, 4363,
-     4371, 4367, 4355, 4362, 4370, 4362, 4363, 4365, 4379, 4375,
-     4361, 4381, 4365, 4370, 4372,    0, 4381, 4373, 4364, 4375,
-
-     4385, 4367, 4368, 4392, 4393, 4392, 4377, 4388, 4398, 4394,
-     4400, 4396, 4399, 4399, 4390, 4400, 4401, 4388, 4393, 4408,
-     4408, 4406, 4388, 4392, 4396, 4401, 4416,    0, 4413, 4413,
-     4411, 4417,    0, 4416, 4421, 4419, 4424, 4426, 4435, 4436,
-     4429, 4430, 4437, 4452, 4433, 4436, 4445, 4446, 4439, 4442,
-     4449, 4464,    0, 4490, 4491, 4492, 4493, 4494, 4495, 4496,
-     4497, 4498, 4499, 4500, 4501, 4503, 4504, 4502, 4505, 4507,
-     4506, 4508, 4509, 4510, 4511, 4512, 4513, 4515, 4485, 4490,
-     4494, 4508, 4502, 4513, 4493, 4524, 4546, 4516, 4523, 4551,
-     4544, 4552, 4517, 4553,    0, 4495, 4498,    0,    0, 4554,
-
-     4533, 4532, 9811, 4532, 4533, 4537, 4543, 4557, 4559, 4560,
-     4542, 4561, 9811, 4552, 4578, 4525, 4543, 4543, 4534, 4532,
-     4540, 4531, 4598, 4558, 4560, 4561, 4556, 4557, 4564, 4565,
-     4580, 4566, 4568, 4564, 4565, 4574, 4575, 4568, 4569, 4576,
-     4591, 4577, 4617, 4620, 4628, 4631, 4640, 4643, 4653, 4656,
-     4676, 4679, 4687, 4690, 4580, 4576, 4578, 4594, 4595, 4589,
-     4596, 4604, 4619, 4698, 4701, 4712, 4715, 4724, 4727, 4735,
-     4592, 4608, 4596, 4594, 4621, 4604, 4620, 4609, 4620, 4625,
-     4615, 4624, 4629, 4631, 4632, 4642, 4625, 4654, 4662, 4657,
-     4659, 4672, 4674, 4691, 4685, 4671, 4678, 4679, 4680, 4671,
-
-     4682,    0, 4695,    0, 4685, 4698, 4689, 4693, 4706, 4702,
-     4689, 4697, 4695, 4707, 4694, 4703, 4696, 4715, 4717, 4718,
-     4707, 4720, 4707, 4707, 4700, 4707,    0,    0,    0,    0,
-     4721, 4709, 4719,    0, 4724, 4730, 4719, 4720, 4719, 4735,
-     4731, 4721, 4729, 4738, 4736, 4737, 4725, 4728, 4739, 4746,
-     4744, 4754, 4796, 4799, 4807, 4810, 4818, 4821, 4834, 4837,
-     4755, 4751, 4752, 4762, 4773, 4766, 4768, 4782, 4797, 4774,
-     4768, 4775, 4773, 4786, 4791, 4775, 4789, 4798, 4804, 4785,
-     4801, 4795, 4804, 4798, 4791, 4796, 4795, 4796, 4793,    0,
-     4801, 4820, 4817, 4823, 4805, 4825, 4818, 4822, 4813, 4829,
-
-     4825, 4820, 4811, 4814, 4816, 4817, 4837, 4833, 4834, 4835,
-     4821, 4828, 4838, 4844, 4844, 4846, 4829, 4847, 4831, 4849,
-     4842, 4839, 4848, 4841, 4855, 4836, 4852, 4840, 4839, 4853,
-     4861, 4846, 4862, 4864, 4862, 4866, 4851, 4868, 4851, 4855,
-     4871, 4872, 4849, 4854, 4855, 4872, 4859,    0,    0, 4859,
-     4860, 4868, 4868, 4862, 4871, 4884, 4870, 4868, 4871, 4880,
-     4868, 4886, 4891, 4876, 4888,    0, 4889, 4895, 4892, 4888,
-     4894, 4898, 4885, 4901, 4880, 4882, 4903, 4899, 4888, 4902,
-     4894, 4915, 4916, 4911, 4912, 4919, 4920, 4935, 4921, 4923,
-     4924, 4919, 4920, 4927, 4928, 4943, 4930, 4971, 4972, 4973,
-
-     4974, 4975, 4976, 4979, 4977, 4978, 4980, 4982, 4983, 4984,
-     4985, 4986, 4987, 4988, 4989, 4990, 4991, 4992, 4993, 4994,
-     4998, 5000, 4967, 4978, 4960, 4979, 4980, 4987, 4996, 4988,
-     5016, 5027, 5029, 5030, 5032, 5033, 5034, 5036, 5038,    0,
-        0, 5019, 4997, 5016, 5021, 5007, 5021, 9811, 5009, 5010,
-     5028, 5034, 5012, 5034, 5038, 5011, 5005, 5014, 5005, 5006,
-     5014, 5016, 5006, 5023, 5077, 9811, 5048, 5055, 5056, 5043,
-     5044, 5059, 5060, 5046, 5047, 5048, 5050, 5051, 5046, 5047,
-     5054, 5055, 5070, 5056, 5069, 5097, 5100, 5108, 5111, 5119,
-     5122, 5130, 5133, 5144, 5152, 5060, 5062, 5064, 5066, 5067,
-
-     5075, 5084, 5108, 5094, 5155, 5163, 5166, 5174, 5088, 5078,
-     5083, 5095, 5087, 5101, 5106, 5115, 5103, 5104, 5128, 5133,
-     5118, 5124, 5122, 5130, 5141, 5163, 5164, 5151, 5152, 5168,
-     5169, 5155, 5156, 5143, 5133, 5145, 5151, 5156, 5157,    0,
-     5143, 5159, 5137, 5136, 5146, 5145, 5163, 5160, 5157, 5159,
-     5150, 5154, 5170, 5166, 5153, 5154, 5169, 5167, 5165, 5176,
-     5179, 5180, 5172, 5165, 5185, 5173, 5187, 5183, 5184, 5169,
-     5168, 5189, 5175, 5186, 5182, 5178, 5190, 5174, 5194, 5187,
-     5186, 5189, 5191, 5199, 5187, 5199, 5223, 5251, 5254, 5262,
-     5265, 5273, 5281, 5284, 5300, 5214, 5216, 5218, 5220, 5221,
-
-     5229, 5238, 5253, 5244, 5223, 5222, 5244, 5238, 5240, 5232,
-     5239, 5240, 5240, 5255, 5250, 5262, 5251, 5250, 5264, 5265,
-     5271, 5267, 5268, 5269, 5255, 5268, 5258, 5262, 5271, 5278,
-     5273, 5267, 5278, 5267, 5264, 5287, 5283, 5289, 5290, 5271,
-     5285, 5276, 5276, 5275, 5290, 5295, 5288, 5298, 5286, 5287,
-     5292, 5285, 5301, 5304, 5305, 5304, 5310, 5290, 5296, 5299,
-     5300, 5306, 5307, 5297, 5300, 5318, 5309, 5305, 5314, 5319,
-     5323, 5307, 5319, 5314, 5325, 5317, 5310, 5326, 5327, 5333,
-     5323,    0, 5321, 5335, 5336, 5372, 5323, 5327, 5327, 5324,
-     5338, 5329, 5329, 5327, 5333, 5345, 5331, 5344, 5333, 5334,
-
-     5335, 5354, 5335, 5342, 5354, 5353, 5343, 5336, 5349, 5343,
-     5362, 5351, 5364, 5386, 5387, 5374, 5375, 5390, 5391, 5377,
-     5378, 5394, 5395, 5382, 5383, 5398, 5399, 5385, 5386, 5427,
-     5428, 5429, 5430, 5431, 5432, 5433, 5434, 5435, 5436, 5437,
-     5438, 5439, 5440, 5441, 5442, 5443, 5444, 5445, 5446, 5448,
-     5449, 5451, 5465, 5450, 5452, 5436, 5441, 5420, 5438, 5443,
-     5445, 5444, 5447, 5454, 5467, 5486, 5488, 5489, 5490, 5492,
-     5495, 5496, 5493, 9811, 9811, 5473, 5459, 9811, 5478, 5479,
-     5470, 5472, 5469, 5487, 5492, 5454, 5462, 5453, 5458, 5461,
-     5456, 5463, 5469, 5461, 5492, 5487, 5488, 5505, 5507, 5495,
-
-     5497, 5498, 5511, 5512, 5517, 5518, 5505, 5506, 5521, 5522,
-     5508, 5509, 5516, 5549, 5552, 5560, 5563, 5571, 5574, 5588,
-     5591, 5523, 5528, 5530, 5524, 5525, 5541, 5549, 5535, 5537,
-     5599, 5539, 5533, 5542, 5545, 5540, 5552, 5539, 5559, 5541,
-     5559, 5551, 5566, 5567, 5568, 5563, 5572, 5561, 5579, 5581,
-     5597, 5598, 5584, 5585, 5586, 5598, 5573, 5584, 5575, 5574,
-     5585, 5572, 5581, 5575, 5581, 5595, 5582, 5580, 5583, 5583,
-     5587, 5593, 5602, 5592, 5602, 5607, 5603, 5600, 5596, 5593,
-     5592, 5608, 5605,    0, 5596, 5611, 5615, 5619, 5601, 5600,
-     5600, 5609, 5610, 5612, 5626, 5615, 5628, 5620, 5609, 5612,
-
-     5631, 5613, 5615, 5619, 5624, 5621, 5633, 5635, 5621, 5640,
-     5653, 5686, 5689, 5697, 5700, 5708, 5711, 5725, 5728, 5660,
-     5665, 5667, 5661, 5662, 5678, 5686, 5672, 5674, 5655, 5675,
-     5679, 5678, 5686, 5684, 5681, 5679, 5696, 5693, 5685, 5690,
-     5679, 5701, 5695, 5685, 5705, 5705, 5707,    0, 5684, 5689,
-     5702, 5709, 5701, 5715, 5697, 5714, 5721, 5717, 5719, 5710,
-     5707, 5724, 5724, 5704, 5729, 5718, 5728, 5734, 5730, 5736,
-     5738,    0, 5727, 5740, 5736, 5742, 5735,    0, 5734, 5746,
-     5747, 5728, 5737, 5732, 5746, 5745, 5748, 5747, 5747, 5751,
-     5738, 5758, 5758, 5760, 5756, 5743, 5758, 5759, 5756, 5751,
-
-     5762, 5763, 5755, 5756, 5766, 5772, 5757, 5754, 5751, 5776,
-     5772, 5777, 5795, 5771, 5780, 5764, 5766, 5784, 5780, 5771,
-     5769, 5779, 5784, 5775, 5786, 5780, 5784, 5774, 5780, 5778,
-     5785, 5780, 5779,    0, 5800, 5785, 5789, 5808, 5809, 5825,
-     5826, 5812, 5813, 5814, 5826, 5816, 5817, 5833, 5834, 5820,
-     5821, 5822, 5834, 5864, 5865, 5866, 5867, 5869, 5870, 5871,
-     5872, 5873, 5876, 5874, 5877, 5875, 5878, 5879, 5880, 5881,
-     5882, 5883, 5884, 5888, 5886, 5885, 5854, 5855, 5862, 5868,
-     5864, 5870, 5871, 5880, 5891, 5898, 5907, 5908, 5917, 5921,
-     5925, 5922, 5924, 9811, 5879, 9811, 5887, 5888, 9811, 5894,
-
-     5908, 5892, 5908, 5884, 5870, 5871, 5888, 5888, 5875, 5899,
-     5902, 9811, 5902, 5927, 5915, 5917, 5919, 5920, 5921, 5923,
-     5936, 5933, 5934, 5929, 5930, 5946, 5947, 5933, 5934, 5935,
-     5947, 5950, 5976, 5979, 5987, 5990, 5998, 6001, 6013, 6016,
-     5945, 5940, 5942, 5965, 5966, 5953, 5961, 5962, 5975, 5953,
-     5949, 5962, 5965, 5956, 5967, 5964, 5964, 5986,    0, 5982,
-     5987, 5988, 5970, 5977, 5977, 5993, 5980, 5989, 6004, 6005,
-     6006, 6007, 6008, 6009, 6022, 6018, 6008, 6001, 5989, 5988,
-     5994, 6012, 6005, 5990, 6001, 6017, 5998, 6007, 6005, 6021,
-     6001, 6014, 6000, 6021, 6021, 6012, 6023, 6026, 6030, 6005,
-
-     6028, 6018, 6009, 6029, 6029, 6028, 6024, 6021, 6020, 6025,
-     6033, 6030, 6039, 6041, 6045, 6047, 6036, 6040, 6037, 6027,
-     6039, 6053, 6038, 6035, 6035, 6039, 6046, 6059, 6041, 6042,
-     6062, 6047, 6082, 6108, 6111, 6119, 6122, 6130, 6133, 6145,
-     6148, 6077, 6072, 6074, 6097, 6098, 6085, 6093, 6094, 6107,
-     6089, 6098, 6087, 6101, 6086, 6098, 6114, 6101, 6099, 6110,
-     6119, 6101, 6102, 6115, 6123, 6106, 6109, 6125, 6130, 6127,
-     6114, 6115, 6135, 6134, 6124, 6122, 6128, 6126, 6125, 6143,
-     6125, 6129, 6135, 6134, 6129, 6132, 6146, 6151, 6148, 6145,
-     6155, 6137, 6152, 6157, 6153, 6149, 6153, 6159, 6159, 6149,
-
-     6149, 6152, 6147, 6170, 6153, 6164, 6166, 6155, 6171, 6159,
-     6158, 6160, 6161,    0, 6180, 6163, 6171, 6165, 6169, 6166,
-     6168, 6187, 6175, 6187, 6177, 6178, 6179, 6175, 6176, 6172,
-     6190, 6198, 6190, 6200, 6186, 6199, 6185, 6208, 6201, 6186,
-     6187, 6187, 6193, 6201, 6197, 6197, 6189, 6195, 6199, 6213,
-     6202, 6214, 6210, 6198, 6220, 6213, 6218, 6215, 6207, 6214,
-     6222, 6233, 6234, 6235, 6236, 6237, 6238, 6250, 6246, 6241,
-     6242, 6243, 6244, 6245, 6246, 6258, 6254, 6289, 6290, 6291,
-     6292, 6293, 6294, 6296, 6295, 6297, 6298, 6299, 6300, 6301,
-     6302, 6303, 6304, 6305, 6306, 6307, 6308, 6309, 6275, 6277,
-
-     6278, 6279, 6285, 6287, 6299, 6289, 6311, 6333, 6337, 6338,
-     6339, 6340, 6341, 6342, 6326, 6304, 6304, 6306, 9811, 6309,
-     9811, 6317, 6285, 6282, 9811, 9811, 6289, 6309, 6340, 6297,
-     6308, 6368, 6329, 6340, 6341, 6331, 6335, 6347, 6349, 6345,
-     6356, 6357, 6345, 6346, 6347, 6349, 6350, 6351, 6363, 6359,
-     6355, 6393, 6401, 6404, 6412, 6416, 6424, 6427, 6439, 6369,
-     6357, 6358, 6359, 6365, 6367, 6375, 6387, 6383, 6377, 6368,
-     6383, 6374, 6389, 6375, 6397, 6390, 6389, 6382, 6387, 6400,
-     6392, 6406, 6398, 6399, 6400, 6395, 6433, 6434, 6424, 6425,
-     6438, 6439, 6435, 6443, 6423, 6427, 6415, 6429, 6412, 6415,
-
-     6425, 6432, 6423, 6435,    0, 6412, 6420, 6433, 6435, 6428,
-     6476, 6438, 6420, 6432, 6426, 6435, 6445, 6444, 6450, 6437,
-     6452, 6433, 6446, 6429, 6452, 6442, 6458, 6454, 6434, 6461,
-     6459, 6463, 6452, 6448, 6461, 6451, 6467, 6503, 6470, 6455,
-     6472, 6460, 6462, 6470, 6461, 6473, 6469, 6470, 6464, 6481,
-     6488, 6526, 6529, 6537, 6540, 6552, 6555, 6563, 6566, 6502,
-     6490, 6492, 6500, 6501, 6503, 6510, 6522, 6518, 6505, 6508,
-     6512, 6519, 6503, 6517, 6513, 6522, 6528, 6518, 6520, 6532,
-     6537, 6542, 6536, 6532, 6545, 6546, 6525, 6536, 6535, 6533,
-     6534, 6537, 6556, 6544, 6540, 6554,    0, 6555, 6541, 6554,
-
-     6542, 6564, 6565, 6553, 6566, 6567, 6545, 6556, 6555, 6565,
-     6555, 6566, 6557, 6556, 6568, 6578, 6565, 6579, 6572, 6573,
-     6582, 6579, 6582,    0, 6581, 6574, 6584, 6576, 6573, 6583,
-     6574, 6590, 6587,    0, 6596, 6593, 6593, 6584, 6581, 6600,
-     6597,    0, 6599, 6601, 6605, 6586, 6600, 6589, 6600, 6601,
-     6591, 6611, 6604, 6592, 6610, 6602,    0, 6606, 6627, 6614,
-     6601, 6621, 6621, 6618, 6617, 6605, 6608,    0, 6606, 6619,
-     6609, 6623, 6616, 6625, 6628, 6627, 6632, 6635, 6621, 6633,
-     6638, 6628, 6657, 6658, 6648, 6649, 6661, 6662, 6658, 6666,
-     6665, 6666, 6656, 6657, 6669, 6670, 6666, 6674, 6702, 6703,
-
-     6704, 6705, 6707, 6706, 6708, 6709, 6710, 6711, 6712, 6713,
-     6714, 6715, 6717, 6716, 6720, 6718, 6692, 6693, 6689, 6690,
-     6697, 6702, 6699, 6711, 6723, 6736, 6742, 6747, 6748, 6749,
-     6751, 6754, 6752, 6724, 6726, 6727, 6724, 6737, 6706, 6712,
-     6709, 6718, 9811, 6745, 9811, 6709, 6770, 9811, 9811, 6733,
-     6734, 6742, 6743, 6739, 6741, 6750, 6745, 6746, 6763, 6764,
-     6754, 6755, 6767, 6768, 6764, 6772,    0, 6798, 6801, 6809,
-     6812, 6820, 6835, 6838, 6848, 6762, 6773, 6775, 6772, 6773,
-     6786, 6794, 6790, 6798, 6768, 6762, 6774, 6788, 6777, 6791,
-     6775, 6785, 6790, 6803, 6802, 6796, 6812, 6791, 6810, 6809,
-
-     6805, 6793, 6830, 6832, 6838, 6839, 6836, 6837, 6845, 6834,
-     6821, 6809, 6814, 6832, 6821, 6819, 6835, 6822, 6836, 6833,
-     6835, 6840, 6822, 6825, 6830, 6824, 6874, 6827, 6847, 6833,
-     6845, 6842, 6840,    0, 6846, 6834, 6835, 6856, 6837, 6853,
-     6859, 6846, 6856, 6845, 6859, 6854, 6846, 6864, 6856, 6848,
-     6856,    0, 6852, 6900, 6861, 6870, 6870, 6861, 6858, 6861,
-     6859, 6873, 6869, 6870, 6880, 6880,    0, 6930, 6933, 6941,
-     6944, 6952, 6967, 6970, 6980, 6894, 6905, 6907, 6904, 6905,
-     6918, 6926, 6922, 6930, 6902, 6909, 6904, 6905, 6909, 6923,
-     6917, 6910, 6922, 6929, 6930, 6926, 6945, 6927, 6926, 6939,
-
-     6923, 6928, 6937, 6939, 6949, 6950, 6952, 6953, 6941, 6955,
-     6956, 6949, 6959, 6964, 6947, 6957, 6958, 6966, 6960, 6944,
-     6949, 6958, 6959, 6970, 6967, 6972, 6973, 6960, 6980, 6967,
-     6973, 6983, 6960, 6971, 6967, 6968, 6974, 6975, 6985, 6991,
-     6991, 6977, 6994, 6990, 6980, 6992, 6993,    0, 6983, 7000,
-     6982, 6987, 7003, 6985, 7002, 7006, 6982, 6992, 7000, 6990,
-     7002, 6997, 6998, 7009, 6999, 7002, 7012, 7000, 7020, 7021,
-     7046, 7023,    0, 7006, 7013, 7008, 7019, 7019, 7010, 7018,
-     7017, 7027,    0,    0, 7033, 7016, 7030, 7035, 7033, 7037,
-     7038, 7020, 7036, 7053, 7054, 7060, 7061, 7057, 7058, 7066,
-
-     7055, 7061, 7062, 7068, 7069, 7065, 7066, 7074, 7063, 7103,
-     7104, 7105, 7106, 7107, 7108, 7109, 7110, 7111, 7112, 7115,
-     7113, 7114, 7117, 7118, 7119, 7086, 7088, 7095, 7096, 7092,
-     7104, 7101, 7106, 7142, 7143, 7144, 7146, 7147, 7148, 7149,
-     7150, 7152, 7117, 7130, 7131, 9811, 7120, 7091, 7113, 7106,
-     7096, 7114, 7138, 7139, 7133, 7134, 7142, 7143, 7135,    0,
-     9811, 7141, 7142, 7151, 7153, 7149, 7151, 7161, 7150, 7188,
-     7191, 7199, 7202, 7212, 7215, 7223, 7236,    0, 7157, 7158,
-     7165, 7173, 7169, 7171, 7185, 7174, 7156,    0, 7176, 7180,
-     7174, 7171, 7180, 7185, 7180, 7180, 7179, 7201, 7193, 7203,
-
-     7183, 7196, 7181, 7207, 7226, 7227, 7221, 7222, 7230, 7232,
-     7221,    0, 7209, 7205, 7199, 7204, 7217, 7205, 7218, 7224,
-     7207, 7203, 7227, 7210, 7230, 7216, 7229, 7220, 7265, 7230,
-     7236, 7225, 7235, 7223, 7231, 7240, 7242, 7235, 7241, 7245,
-        0, 7239, 7227, 7234, 7231, 7250,    0, 7238, 7237, 7238,
-     7242, 7240, 7255, 7250, 7247, 7290, 7255, 7252, 7244, 7254,
-     7246, 7265, 7245, 7262, 7250, 7262, 7263, 7253, 7263, 7316,
-     7319, 7327, 7330, 7340, 7343, 7351, 7364,    0, 7285, 7286,
-     7293, 7301, 7297, 7299, 7313, 7302, 7284, 7304, 7298, 7297,
-     7307, 7298, 7317, 7310, 7317, 7315, 7327, 7324, 7314, 7325,
-
-     7332, 7321, 7311, 7312, 7323, 7324, 7339, 7325, 7326, 7327,
-     7343, 7333, 7346, 7333, 7328, 7347, 7346, 7334, 7339, 7353,
-     7341, 7331, 7332, 7343, 7344, 7359, 7341, 7346, 7344, 7364,
-     7363, 7366, 7354, 7353,    0,    0, 7350, 7358, 7372, 7372,
-     7360, 7356, 7352, 7372, 7359, 7360, 7368, 7368, 7367, 7379,
-     7373, 7386,    0, 7371, 7373, 7370, 7370, 7387, 7392, 7392,
-     7387, 7387, 7381, 7383, 7384, 7385, 7400, 7382, 7402, 7385,
-     7401, 7400, 7428, 7389, 7403, 7409, 7410, 7409, 7405,    0,
-     7393, 7396, 7411, 7397, 7416, 7418, 7399, 7406, 7402, 7418,
-     7418, 7410, 7443, 7444, 7438, 7439, 7447, 7448, 7437,    0,
-
-     7450, 7451, 7445, 7446, 7454, 7455, 7444,    0, 7484, 7485,
-     7486, 7487, 7488, 7489, 7490, 7491, 7492, 7493, 7467, 7468,
-     7462, 7464, 7477, 7478, 7471, 7465, 7501, 7507, 7514, 7511,
-     7515, 7516, 7517, 7519, 7520, 7494, 7483, 7485, 7491, 7472,
-     7462, 7469, 7483, 7532, 7491, 7493, 7506, 7507, 7496, 7498,
-        0, 7511, 7512, 7508, 7513, 7522, 7526, 7516, 9811, 7554,
-     7558, 7562, 7571, 7574, 7583, 7592, 7531, 7541, 7538, 7540,
-     7548, 7550, 7545,    0, 7523, 7523, 7518, 7536, 7546, 7531,
-     7557, 7534, 7546, 7540, 7556, 7558, 7542, 7551, 7564, 7548,
-     7555,    0, 7564, 7577, 7578, 7591, 7592, 7581, 7582,    0,
-
-     7565, 7568, 7579, 7560, 7568, 7564, 7566, 7573, 7581, 7586,
-     7572, 7569, 7589, 7578, 7587, 7593,    0, 7591, 7588, 7591,
-     7577, 7598, 7583, 7584, 7594, 7584, 7591, 7601, 7604, 7606,
-     7603, 7593, 7601, 7605, 7591, 7594, 7604, 7591, 7603, 7596,
-        0,    0, 7611, 7611, 7619, 7608, 7616, 7621, 7611, 7607,
-        0, 7614, 7618, 7631, 7620, 7676, 7685, 7689, 7693, 7697,
-     7701, 7705, 7653, 7654, 7648, 7654, 7663, 7684, 7678,    0,
-     7651, 7674, 7671, 7668, 7658,    0, 7672, 7681, 7677, 7671,
-     7677, 7685, 7686, 7682,    0, 7669,    0, 7671, 7672, 7674,
-     7675, 7674, 7680, 7681, 7693, 7679, 7685, 7697, 7684, 7700,
-
-     7689, 7704, 7705, 7702, 7708, 7706,    0, 7692, 7693, 7694,
-     7695, 7694, 7714, 7711, 7717, 7702, 7704, 7719, 7709, 7722,
-     7718, 7723, 7724, 7721, 7715, 7708, 7726, 7725, 7730, 7727,
-     7725, 7725, 7732, 7716, 7719, 7733, 7723, 7721, 7727,    0,
-     7733, 7734, 7742, 7725, 7746, 7747, 7734, 7749, 7750, 7732,
-     7750, 7733, 7735, 7740, 7744, 7733, 7755, 7758, 7759, 7756,
-     7756, 7749, 7760,    0, 7761, 7767, 7759, 7762, 7767, 7766,
-     7771, 7754, 7760, 7775, 7769, 7783, 7784, 7797, 7798, 7787,
-     7788,    0, 7789, 7790, 7803, 7804, 7793, 7794,    0, 7834,
-     7835, 7836, 7837, 7838, 7839, 7840, 7841, 7843, 7809, 7810,
-
-     7819, 7820, 7817, 7818, 7815, 7851, 7858, 7859, 7860, 7862,
-     7864, 7866, 7865, 9811, 9811, 9811, 7842, 7801, 7823, 7818,
-     9811, 7877, 9811,    0,    0, 7833, 7834,    0,    0, 7838,
-     7840, 7853, 7854, 7843, 7844, 9811, 7893, 7901, 7904, 7912,
-     7915, 7923, 7845, 7847, 7861, 7863, 7857, 7859,    0, 7837,
-        0, 7870, 7866, 7860, 7876, 7878,    0, 7863, 7883, 7870,
-     7875, 7885, 7877, 7891, 7892, 7887, 7886,    0,    0, 7902,
-     7903,    0,    0, 7894, 7896, 7889, 7901, 7896, 7904, 7890,
-     7907,    0, 7903, 7889, 7892, 7899, 7912, 7913, 7902, 7895,
-     7909, 7897, 7909, 7917,    0,    0, 7919, 7916, 7913, 7912,
-
-     7909, 7919, 7927, 7914, 7928, 7912, 7930, 7932, 7917, 7929,
-     7926, 7928, 7917, 7930, 7927, 7928, 7922, 7939, 7942, 7943,
-     7944, 7926, 7946, 7946, 7939, 7932, 7953, 7949, 7950, 7944,
-     7945, 8001, 8004, 8012, 8015, 8023, 8026, 7965, 7966, 7980,
-     7988, 7977, 7979,    0, 7976, 7976, 7970, 7978, 7983, 7975,
-     7991, 7977, 7991,    0, 7994, 7985, 7977,    0, 7995, 7996,
-     7989, 7990,    0, 7995, 7996, 8006, 7999, 7992,    0, 7986,
-     7992, 7991, 7994, 8011, 8012, 8008, 8007, 8014, 8015, 8008,
-     8009,    0, 8011, 8023, 8009, 8021, 8005, 8008, 8029, 8021,
-     8013, 8018, 8013, 8020, 8015,    0, 8021, 8019, 8018, 8036,
-
-     8025, 8036, 8037, 8035, 8044, 8031, 8041,    0, 8035, 8033,
-     8030, 8038, 8046, 8044, 8051, 8049, 8055, 8047, 8034, 8049,
-     8058, 8055, 8058, 8044, 8054, 8061, 8050, 8046, 8063, 8053,
-     8051, 8052, 8057, 8060, 8054, 8049, 8071, 8062, 8078, 8066,
-     8067, 8080, 8066, 8063,    0,    0, 8090, 8091,    0,    0,
-        0,    0, 8092, 8093,    0,    0, 8133, 8134, 8135, 8136,
-     8137, 8138, 8139, 8140, 8142, 8143, 8109, 8110, 8111, 8112,
-     8113, 8114, 8153, 8154, 8152, 8155, 8156, 8157, 8158, 9811,
-     8109, 9811, 9811,    0,    0, 9811, 9811, 8121, 8124, 9811,
-     9811, 8162, 8165,    0,    0, 8126, 8127,    0,    0, 8123,
-
-     8119, 8131, 8117,    0, 8114, 8126, 8124, 8123, 8133, 8123,
-     8141, 8140, 8137, 8145, 8137,    0,    0, 8134, 8148, 8145,
-     8143, 8136, 8156, 8145, 8148, 8147, 8147, 8158, 8152, 8160,
-     8154, 8162, 8159, 8166, 8165, 8156, 8171, 8155, 8158, 8156,
-     8160, 8168,    0, 8177, 8176, 8160, 8162, 8182, 8171, 8172,
-        0, 8181, 8166,    0, 8187, 8168, 8180, 8187, 8170, 8187,
-     8187, 8175, 8179, 8190, 8184, 8192, 8180, 8176, 8194, 8202,
-     8183, 8184, 8185, 8197, 8204, 8251, 8254,    0,    0, 8215,
-     8216,    0,    0, 8194, 8210, 8254, 8256, 8217, 8220, 8211,
-     8227, 8208, 8214, 8215, 8226, 8216, 8217, 8233, 8234, 8222,
-
-     8223, 8218, 8224, 8215,    0, 8232, 8237, 8234, 8225,    0,
-     8231, 8244, 8231, 8232, 8248, 8249, 8251, 8232, 8248, 8236,
-     8250, 8247, 8246, 8244, 8256, 8257, 8258, 8258, 8238, 8246,
-     8247, 8266, 8252, 8256, 8251, 8270,    0, 8255, 8265, 8255,
-     8249, 8261, 8256, 8276, 8277, 8273, 8259, 8267, 8273, 8269,
-     8275, 8270, 8267, 8286, 8273, 8289, 8274, 8279, 8278, 8284,
-     8275, 8277, 8281, 8297, 8280, 8295, 8281, 8286, 8297, 8303,
-     8282, 8287, 8301, 8306, 8295, 8291, 8302,    0,    0,    0,
-        0, 8356, 8357, 8358, 8359, 8325, 8326, 8362, 8363, 8364,
-     8365, 8366, 8367, 9811, 9811, 9811,    0,    0, 8310, 8311,
-
-     8306, 8308,    0, 8320, 8309, 8316, 8310, 8319, 8319, 8322,
-     8329, 8317, 8331, 8336, 8318, 8319, 8331, 8333, 8330, 8343,
-     8339, 8341, 8328, 8327, 8333, 8335, 8345, 8345, 8337, 8329,
-     8343, 8341, 8353, 8342,    0, 8352, 8361, 8347, 8348, 8353,
-     8366, 8359, 8362, 8369, 8365,    0, 8346, 8369, 8373, 8360,
-     8367, 8364,    0,    0, 8357, 8409, 8411, 8368,    0,    0,
-     8361, 8375, 8382, 8371, 8367, 8368, 8377, 8384,    0,    0,
-     8381, 8382,    0,    0,    0,    0, 8396, 8378, 8384, 8384,
-     8381, 8387, 8399, 8386, 8400, 8401, 8395, 8396, 8402, 8403,
-     8392,    0,    0, 8397, 8395, 8399,    0, 8409, 8401, 8412,
-
-     8413, 8407, 8408, 8407, 8403, 8405, 8424, 8407, 8411, 8418,
-     8422, 8424, 8425, 8423, 8413,    0, 8428, 8419, 8431, 8422,
-     8433,    0, 8423, 8438, 8420, 8441,    0,    0, 8424, 8440,
-     8426, 8436, 8437, 8444, 8434, 8449, 8436, 8437, 8447, 8449,
-     8436, 8437, 8440, 8436, 8439, 8444,    0, 8460, 8440, 8445,
-     8463, 8445, 8462,    0, 8466, 8445, 8463, 8464, 8458, 8455,
-     8467, 8458,    0, 8519, 8520, 8521, 8476, 8473, 8459, 8455,
-     8462,    0, 8463, 8475, 8483, 8480, 8484, 8487, 8483,    0,
-     8485, 8485, 8466, 8472,    0, 8481, 8489, 8481, 8477, 8478,
-     8495, 8476, 8496, 8487, 8482, 8489, 8497, 8496,    0, 8495,
-
-     8493, 8493, 8491, 8510,    0, 8502, 8509,    0, 8498, 8503,
-     8509,    0, 8504, 8514, 8513, 8518, 8500, 8520, 8518,    0,
-        0,    0, 8511, 8521, 8524, 8525, 8526, 8508, 8528, 8527,
-     8515, 8524, 8525, 8530, 8535, 8536, 8526, 8520, 8532, 8521,
-     8520,    0, 8523, 8539, 8526, 8545, 8546,    0,    0,    0,
-        0,    0, 8534, 8548,    0, 8535, 8537, 8551, 8552,    0,
-        0, 8539,    0, 8555, 8554, 8556,    0, 8546, 8544, 8546,
-        0, 8561,    0,    0, 8544, 8558, 8560,    0, 8559, 8547,
-     8559, 8565, 8560, 8559, 8568, 8558, 8561, 8559, 8575, 8560,
-     8573,    0, 8559, 8579, 8575, 8580, 8573, 8564, 8579,    0,
-
-     8567, 8570, 8566, 8571, 8568, 8575, 8585, 8591, 8575, 8593,
-     8590, 8580, 8578, 8596, 8585, 8582, 8596, 8602,    0, 8583,
-        0, 8588, 8605, 8591, 8598, 8607, 8604, 8607, 8611, 8587,
-     8598, 8600,    0,    0, 8597, 8608, 8612, 8599,    0, 8619,
-     8617, 8621, 8610,    0, 8603, 8612, 8620, 8608, 8611, 8616,
-     8611, 8617, 8611, 8623, 8621,    0, 8616, 8635,    0, 8635,
-     8632, 8633, 8633, 8621, 8625, 8629, 8637, 8625, 8621, 8627,
-     8633, 8634,    0, 8631, 8634, 8631, 8649, 8638, 8645, 8650,
-     8647,    0, 8652, 8638, 8639,    0, 8653, 8655, 8657, 8643,
-     8644, 8647, 8664, 8646, 8661, 8657, 8664, 8651, 8671, 8654,
-
-     8654, 8656, 8676, 8658,    0, 8663, 8677, 8668, 8673, 8678,
-     8679, 8680, 8669, 8685, 8672, 8688, 8671,    0, 8670, 8677,
-     8683, 8679, 8681,    0, 8694, 8675, 8683, 8680, 8684, 8688,
-     8700, 8698, 8689, 8695,    0, 8693, 8705, 8707, 8692, 8703,
-     8692,    0, 8705, 8698, 8699, 8710, 8695, 8696, 8714,    0,
-     8695, 8715, 8711,    0, 8717,    0, 8719, 8711, 8708, 8713,
-        0, 8722, 8710, 8723,    0, 8720, 8707, 8726, 8717, 8717,
-     8725,    0, 8734,    0,    0,    0,    0, 8716, 8769, 8727,
-        0,    0, 8723,    0, 8728, 8729,    0, 8746, 8738, 8747,
-     8737, 8743, 8733, 8745, 8753,    0,    0, 8749, 8746, 8737,
-
-        0,    0, 8744, 8737, 8753, 8755,    0, 8752,    0, 8750,
-        0, 8758,    0, 8747,    0, 8751, 8745, 8758, 8768, 8764,
-     8750, 8762, 8771, 8754, 8751, 8770, 8771, 8772, 8771, 8764,
-     8761, 8779, 8770, 8782, 8772, 8781, 8769, 8767, 8782, 8776,
-     8784, 8778, 8788, 8787, 8789,    0, 8778, 8796, 8783, 8794,
-     8784, 8782, 8797, 8794, 8792, 8800, 8787, 8800,    0, 8796,
-     8800, 8792,    0, 8811, 8791, 8796, 8798, 8814, 8798, 8795,
-     8818, 8803, 8817, 8820, 8821, 8822, 8804, 8824, 8822,    0,
-        0, 8809, 8810, 8817, 8818, 8818, 8829, 8834, 8832, 8836,
-     8834,    0, 8826,    0, 8838, 8834, 8835,    0, 8830, 8831,
-
-     8841, 8824, 8826, 8827, 8829, 8830, 8832, 8842, 8838, 8834,
-     8835, 8855, 8834, 8852, 8842,    0, 8859, 8846, 8840, 8862,
-        0, 8851, 8859,    0, 8865, 8861, 8862, 8867, 8849, 8863,
-     8858, 8867, 8855, 8869, 8866, 8858,    0, 8876,    0, 8875,
-     8864, 8871, 8877,    0, 8874, 8874, 8868, 8870, 8880, 8878,
-     8867,    0, 8871,    0, 8885, 8871, 8892, 8888, 8875, 8889,
-     8877, 8881, 8885,    0, 8898, 8885, 8886, 8893, 8898,    0,
-        0, 8899, 8904, 8901, 8892, 8903, 8897, 8904, 8906, 8907,
-     8898, 8894, 8914, 8907, 8908, 8898, 8899,    0, 8907, 8914,
-     8903,    0, 8911, 8920, 8921, 8922, 8912, 8929, 8911, 8911,
-
-        0, 8914, 8914,    0,    0, 8921, 8927,    0, 8917, 8924,
-     8933, 8934, 8926, 8938, 8923, 8923, 8930, 8929,    0, 8926,
-     8931,    0, 8946, 8934, 8932, 8942, 8948, 8935, 8939, 8935,
-        0, 8941,    0, 8937, 8989, 8947,    0, 8950, 8951, 8948,
-        0, 8959, 8952, 8961, 8953,    0, 8958, 8963, 8951,    0,
-     8947, 8962, 8960, 8966, 8959,    0, 8960, 8971,    0,    0,
-     8972, 8977, 8965, 8976, 8980, 8977, 8982, 8984, 8984, 8979,
-     8967, 8983,    0,    0, 8984, 8973,    0,    0, 8986, 8973,
-     8984, 8991,    0,    0,    0, 8983, 8978, 8992, 8980, 8999,
-     9000,    0, 8986, 8983, 9002, 9000,    0, 9000, 9001, 8995,
-
-     8999, 8997, 9001, 8995, 8993, 8995,    0, 9009, 9000, 9007,
-        0, 9003, 9002,    0, 9005, 8996, 9021, 9020, 9003, 9021,
-     9007, 9010, 9020, 9023, 9028, 9011, 9017, 9011, 9027,    0,
-     9019, 9023, 9031, 9037, 9034, 9034, 9022, 9038,    0, 9033,
-        0, 9042, 9041, 9042, 9041, 9027, 9029, 9029, 9038, 9050,
-        0, 9048, 9039, 9034,    0,    0,    0, 9050, 9043, 9042,
-        0,    0, 9053, 9054, 9053, 9057, 9042,    0, 9043, 9059,
-     9050, 9052, 9058, 9055, 9064,    0, 9066, 9066, 9060, 9059,
-        0, 9054, 9055, 9062, 9068,    0, 9069, 9074, 9060,    0,
-        0, 9072, 9064, 9062, 9064, 9084, 9068, 9078,    0, 9069,
-
-        0, 9075, 9072, 9088, 9076,    0, 9079,    0, 9072, 9086,
-     9089,    0,    0,    0, 9083, 9084, 9086, 9091, 9096, 9084,
-     9091, 9096,    0, 9086, 9092,    0, 9104, 9107, 9097,    0,
-     9090, 9106, 9096, 9101, 9107, 9108, 9111, 9102, 9099, 9104,
-     9100, 9102, 9117, 9116, 9099, 9113, 9117, 9118, 9110,    0,
-     9124,    0,    0, 9116, 9117,    0, 9114, 9124, 9114, 9118,
-        0,    0, 9124, 9121, 9120, 9120, 9120, 9121,    0, 9123,
-     9140, 9126, 9125,    0,    0, 9141, 9142, 9129, 9130,    0,
-     9135, 9150, 9127, 9153,    0,    0,    0, 9142, 9141, 9140,
-     9139, 9137, 9155, 9155, 9156, 9149, 9144,    0, 9163, 9151,
-
-        0, 9162,    0, 9167, 9154, 9148, 9157, 9169, 9167, 9155,
-     9174, 9160, 9170, 9177, 9176, 9178, 9161, 9176, 9163,    0,
-     9811, 9230, 9237, 9244, 9251, 9253, 9257, 9261, 9263, 9267,
-     9271, 9278, 9285, 9287, 9289, 9296, 9303, 9309
+        0,   72,  144,    0,    0,    0,    0,   50,    5,   72,
+       74,  168,  236,    0,  308,    0,  335,  354,    0,    0,
+      358,  373,  170,  375,  442,  514,  586,    0,  658,  730,
+      367,  419,    7,   56,  442,  497,  428,  444,  802,    0,
+      829,  850,   77,  433,  516,  641,  658,  663,  334,  353,
+      916,    0,  988, 1060, 1038, 1040, 9052, 9053, 9053, 9053,
+     9029,  763, 1131,  772,  781, 9053, 9053, 9053,    0, 9013,
+     9012, 9025,    0,  532, 9053, 9053, 9053,    0, 9025, 1030,
+     9053,    0,    0, 1095, 1104, 9053, 9053, 9053,   22,   31,
+      460,  748, 1013, 1099,  499, 1162, 1078,  707, 1027, 1010,
+
+     1184, 1165, 1188,   41,   70, 8982,  380,    3,   35,  345,
+      492,   49,  837, 1089,  448,  517,  348,  166,    1,  845,
+       62,  636,  373,  164,  523, 9053, 1188, 1200, 1213, 1222,
+        0, 9008, 9007,    7, 9020, 1004,  672, 9053, 1236, 1243,
+     1252, 1261,    0, 9005,  474, 9004, 9017, 1250,  671,  991,
+     1258,  325,  708, 1269,  163, 8993,  523, 1243,  706,  968,
+      418,  494, 1137, 1252,  628, 1270,  515, 1078, 1274, 1158,
+     1116,   91,    0,    0, 1330, 1339, 1354, 1357, 1365, 1368,
+     1376, 1365, 9053, 1393, 1401, 1410, 1419, 1428, 1437,    0,
+     9001,    1, 9000,  843, 1258, 9013,  867,  972,  862, 9053,
+
+     1105,    0, 9053,    0, 9013, 1444,    0, 1453, 1462, 9032,
+     9053, 9031,    0, 8995, 8994, 9007,  994, 1457, 1246, 1200,
+      324,  706,  662, 1235,  409, 1238,  637, 1275,  488, 1265,
+     1441, 1338,  666,  638, 8961, 1339,  715, 1452, 1043, 9053,
+     1504, 1511, 1520, 1529, 1538, 1547, 1556,    0, 8991, 8990,
+     9003, 1337, 8971, 8964, 8973, 8972, 1098, 1444,  518, 1444,
+     8958, 1081, 1438,  993, 1162, 1527, 1532,  828,  865, 8970,
+      700, 1274, 1105, 1184, 1312, 1533, 1535, 1281, 1341,  376,
+     1449, 8951, 8949, 8971, 8970, 8967, 1539, 1153,  966, 1540,
+     9053, 1593, 1600, 1609, 1618,    0, 8977, 8976, 8989, 1607,
+
+     8951, 8956, 8959, 9005, 9004, 9053, 9003, 1482, 1635, 1653,
+     1702, 1719, 9002, 9001, 9000, 1738, 1810, 8965, 1620, 1622,
+     1658, 9053, 1750, 8944, 8940, 8953, 1600, 8974, 1710, 9053,
+     1881, 1349,   23, 1654, 8971, 1611, 8969, 1056, 8964, 8952,
+        7, 1662, 8933, 1616, 8946, 8937, 8930, 8929, 8928, 1709,
+     1760, 1769, 1778,    0, 8952, 8950, 8960, 8948, 8949, 8964,
+     8944, 8943, 8956, 1674,    0, 1785, 1822, 1835, 1850, 1853,
+     1861, 1864, 1875, 1888, 8960, 8940, 8939, 8952, 1733, 1891,
+     1902, 1905, 1913, 1936, 1944, 1947, 1955, 1958, 1970, 1974,
+     8916, 8908, 8922, 8914, 8917, 8918, 1446, 8918, 8909, 8897,
+
+     8901, 8899, 8905,    0, 1526, 8904, 8897, 8913, 8909, 8904,
+     8898, 8892, 8891, 8890, 8905, 8890, 8886, 1870, 8891, 8898,
+     8889,    0, 8901, 8897, 8879, 8898, 8879, 8882, 8881, 8875,
+     8875, 8881,    0, 8875,    0, 8890, 8886, 8871, 8868, 8886,
+     8867, 8873, 8875, 8869, 8876, 1810, 1974, 1983, 1996,    0,
+     8891, 8889, 1542, 8899, 8887, 1613, 8888, 2006, 2019, 2028,
+     2037,    0, 8886,    0, 8884, 8894, 1695, 1800, 1810, 1809,
+     1822, 1852, 8855, 8856, 1610, 8867, 8853, 8853, 8849, 8866,
+     8857, 2012, 1694, 8846, 8850, 8860, 8839, 8842, 8857, 8841,
+     8844, 8854, 8836, 8852, 8832, 8850, 8833, 8836, 1374, 1875,
+
+     8849, 8829, 1874, 8845, 8838, 8840,    0,    0, 1297, 8836,
+     8838, 8834, 1824, 8838,    0, 8832, 8839, 1859, 1742, 8827,
+     8829, 8821, 8829, 8822, 8814, 2013, 2021, 8813, 8819, 8816,
+     8826, 8807, 8809, 8808, 8810, 1552,    0, 2074, 2083, 2092,
+     2107, 2110, 2118, 2121, 2129, 2132, 8852, 8832, 8831, 8844,
+     1869, 2134, 2142, 2156, 2165,    0, 8831, 1916, 8829,    0,
+     1925,    0, 8839, 8827, 8828, 1828, 1855, 1942, 8859, 8856,
+     8853, 8856, 8809, 8796, 8786, 8806, 8795, 8798, 8797, 8802,
+     8786, 8798, 8797, 8781, 8786,    0, 8786, 8780, 8779, 8777,
+     8776, 8786, 2137, 8788, 8773, 8772, 1630, 8782, 8776, 1648,
+
+     8780, 8769, 8767, 8765, 8766, 8770, 8764,    0, 8765, 8771,
+     1982, 8765, 8762,  747, 8761, 8756, 8751, 8767, 8759,    0,
+     8753,    0, 8758, 8758, 2194, 2201, 2210, 2219, 2228,    0,
+     8779, 8777, 8787, 8775, 8776, 8757, 8740, 8758, 8751, 8756,
+     8739, 8739, 8740, 8737, 8746, 8732, 8733, 8746, 8736, 8731,
+     8748, 8743, 8729, 8722, 8729, 8730, 2019, 8727, 8729, 8729,
+     8738, 1926, 8723, 8729, 8722, 8735, 1743, 8719, 8731, 8724,
+     8728, 8726, 8721, 8711, 8709, 8718, 1958, 8721, 8720, 8705,
+     8716, 8721, 1717, 8707, 8715, 8714, 8714, 8708, 8698, 8699,
+     8696, 8695, 8694, 8694, 8696, 8692, 1579, 8690, 8694,    0,
+
+     8688, 8693, 8694, 8699, 8697, 8692, 8696, 8683, 8679, 8681,
+     8690, 8679, 8674,    0, 8673, 8674, 8672, 1694, 8675, 2235,
+     2242, 2251, 2260,    0, 8699, 8697, 8707, 8695, 8696, 8670,
+     8676, 8658, 8723, 9053, 2025, 2269, 8722, 9053, 2287, 2159,
+     2079, 2277, 2014, 2132, 2057, 2288,  476, 1055, 2174, 2278,
+     1389, 2260, 1317, 1805, 2002, 2135, 2289, 2290, 2342, 2351,
+     2360, 8687, 1150, 1806, 2038, 1872, 2090, 2183, 2161, 2185,
+     2291, 2293, 2369, 8666, 8663, 8673, 8661, 8662, 8691, 2302,
+     8686, 8676, 8684, 8678, 8672, 8673, 9053, 8680, 8676, 9053,
+     8673, 8685, 9053, 8667, 8665, 8664, 9053, 9053, 8673, 8664,
+
+     8639, 8650, 8646, 8650, 8634, 8645, 8649, 8627, 2259, 8631,
+     8644, 8632, 2376, 2385, 8656, 8649, 8665, 8659, 2160, 8670,
+     8651, 8649, 8659, 8647, 8648, 2392, 2401, 2416, 2424, 2428,
+     2321, 2432, 8664, 8645, 8643, 8653, 8641, 8642, 2443, 2456,
+     2459, 2467, 2470, 2478, 2481, 2489, 2493, 2501, 2509, 2512,
+        0, 8615, 8628, 8613, 8621,    0, 8607, 8625, 8608, 8617,
+     8622,    0,    0, 8619, 8606, 2402, 8603, 8605, 8613, 8616,
+        0, 8612,    0, 8599, 8604, 8601,    0,    0, 8592,    0,
+        0, 8604, 8608,    0, 8604,    0, 8598, 8588, 8602, 8599,
+        0, 8598, 8582, 8596, 8585, 8595,    0, 8591, 8588, 8592,
+
+        0, 8590, 8577, 8573,    0, 2526, 2541, 8602, 8595, 2423,
+     8611, 8605,    0, 2268, 2554, 2563, 8598, 8591, 8607, 2289,
+     2300, 2499, 2395, 2387, 2259, 8562, 8572, 8579, 8578, 8581,
+     8577, 8563, 8573, 8559, 8560, 1189, 8555, 8558, 2287, 8570,
+     8569, 8550, 8566,    0, 8564, 8557, 2538, 8560, 1487, 8548,
+     8559, 8546, 8544, 2256, 8543, 8545, 1438, 8557, 1877, 8542,
+     8546, 8545, 8556, 8552, 8551, 8542, 8538, 2371,    0, 8531,
+        0, 8536,    0,    0, 8540, 8539,    0, 8535, 8538, 8526,
+     8543, 8524, 8522, 8532, 8528, 8533, 8526, 2481,    0,    0,
+        0, 8566,    0,    0,    0,    0,    0,    0,    0,    0,
+
+        0,    0,    0,    0,    0, 8520, 8520, 8514,    0, 8528,
+     8523, 8522, 8518, 8523, 8508, 2584, 2596, 2582, 2611, 2614,
+     2622, 2632, 8555, 8536, 8534, 8544, 8532, 8533, 2651, 2660,
+     8531, 2283, 8524,    0, 8540, 8534, 2557, 2447,    0, 9053,
+     9053, 8506, 8503, 8515, 8508, 2256, 8510, 8496, 8492,    0,
+     8510,    0, 8494,   54,    0,  173,  636,  661,  715,    0,
+      820, 1066, 1096,    0, 1223, 1222, 1269,    0, 1384, 2396,
+     1402, 1502, 1501, 1505, 1540,    0, 1609,    0,    0, 1660,
+     1758, 1827, 1918, 1929, 1956, 2034,    0, 2026, 2045, 2147,
+     2051, 2080, 2075, 2144,    0, 2144, 2153, 2667, 2676, 2170,
+
+     2190, 2216, 2281, 2558, 2319,    0, 2327, 2347, 2587, 2353,
+     2373,    0,    0, 2375, 2408, 2400, 2416, 2422, 2457, 2437,
+     2426, 2432, 2462, 2447, 2483,    0, 2467,    0, 2480,    0,
+     2490, 2479, 2486,    0, 2495, 2509, 2501, 2508, 2511, 2540,
+     2548, 2553, 2572, 2560, 2545, 2554, 2563, 2568, 2581, 2589,
+        0, 2586, 2580, 2601, 2592, 2587, 2587, 2602, 2592, 2610,
+     2594, 2610, 2612, 2616,    0, 2606, 2620, 2625, 2651,    0,
+     2643, 2646, 2654, 2650,    0, 2631, 2657, 2649, 2659,    0,
+        0,    0, 2641, 2690,    0, 2663,    0, 2659, 2659, 2695,
+     2650, 2663, 2654, 2709, 2718, 2681, 2676, 2694, 2690, 2711,
+
+     2670, 2671, 2674, 2737, 2741, 2738, 2742, 2743, 2744, 2745,
+     2746, 2747, 2750, 2749, 2751, 2752, 2753, 2754, 2755, 2756,
+     2757, 2758, 2759, 2762, 2763, 2764, 2765, 2767, 2768, 2769,
+     2770, 2772, 2774, 2775, 2776, 2781, 2784, 2791, 2832, 2754,
+     2755, 2766, 2783, 2787, 2796, 2797, 2798, 2828, 2822, 2823,
+     2848,    0, 2746, 2768, 2776, 2802, 2800, 2807, 2811, 2803,
+     2813, 2832, 2833, 2827, 2842, 2843, 2845, 2847, 2835, 2844,
+     2840, 2853, 2826, 2877, 2819, 2879, 2817, 2830, 2882, 2823,
+     2829, 2821, 2825, 2843, 2888, 2837, 2854, 2858, 2859, 2867,
+     2873, 2859, 2877, 2860, 2871, 2866, 2884, 2880, 2884, 2872,
+
+     2908, 2911, 2919, 2922, 2930, 2941, 2869, 2882, 2884, 2902,
+     2899, 2912, 2949, 2952, 2960, 2964, 2972, 2976, 2980, 2989,
+     2992, 3003, 3006, 3016, 2878, 2878, 2872,    0,    0, 2880,
+     2902,    0, 2894, 2906, 2893, 2907, 2918, 2923, 2936, 2952,
+        0, 2930,    0, 2949, 2953, 2960,    0, 2958, 2944, 2975,
+     2961, 2958, 2978, 2967, 2968, 2970, 2992,    0, 2988, 2988,
+        0, 2980, 2972, 2991, 2979, 3007, 3008,    0, 9053, 3016,
+     3021, 3006, 3024, 3014, 3015, 3023, 3028, 3029, 3014, 3032,
+     3016, 3018,    0, 3015, 2992, 3015, 3016, 3002, 3022, 3023,
+        0,    0, 3024, 3020, 3028,    0, 3007, 3026, 3022, 3019,
+
+        0,    0, 3014, 3029, 3024, 3038, 3037, 3027, 3042, 3044,
+     3034, 3039,    0, 3048,    0, 3054, 3053, 3040, 3038, 3049,
+     3044, 3047, 3050,    0, 3054, 3055,    0,    0, 3056, 3053,
+        0,    0, 3066,    0, 3055, 3049, 3070, 3067,    0, 3060,
+     3055, 3075, 3068, 3069, 3070, 3062,    0,    0, 3078, 3082,
+     3065,    0,    0,    0,    0,    0, 3064, 3064,    0, 3069,
+     3074, 3075,    0, 3089, 3093, 3099, 3135, 3138, 3146, 3149,
+     3157, 3168, 3096, 3107, 3103, 3128, 3124, 3139, 3118, 3136,
+     3127, 3134, 3144, 3131, 3155,    0, 3135, 3126, 3120, 3120,
+     3173, 3175, 3135, 3147,    0, 3131, 3137, 3142, 3149,    0,
+
+     3153, 3135,    0,    0,    0,    0, 3156, 3157, 3158, 3146,
+     3159,    0, 3160,    0,    0,    0, 3137, 3158, 3159, 3164,
+     3160, 3159, 3167, 3147,    0,    0, 3159,    0, 3171, 3168,
+     3158, 3160,    0, 3152, 3185, 3188, 3195, 3200, 3185, 3203,
+        0, 3164, 3183, 3167, 3176, 3177, 3177, 3191, 3188, 3175,
+     3188, 3177,    0, 3180, 3193, 3193, 3199,    0, 3197,    0,
+     3189, 3189,    0, 3188, 3202, 3204, 3191, 3207, 3196, 3189,
+        0,    0,    0, 3190, 3196, 3199, 3204, 3209,    0, 3195,
+     3217,    0, 3218,    0, 3214, 3202, 3221, 3218, 3199,    0,
+     3212, 3221,    0, 3227, 3223, 3228, 3225, 3216, 3233, 3229,
+
+     3215, 3229, 3219,    0, 3227, 3236, 3240, 3241, 3227, 3225,
+     3225, 3247, 3245, 3232, 3237, 3247, 3234, 3240, 3236, 3256,
+     3265, 3266, 3273, 3278, 3263, 3281,    0, 3262,    0, 3306,
+     3307, 3310, 3308, 3309, 3311, 3312, 3313, 3314, 3315, 3317,
+     3319, 3318, 3321, 3320, 3322, 3316, 3325, 3323, 3327, 3328,
+     3329, 3350, 3330, 3337, 3335, 3345, 3354, 3356, 3357, 3358,
+     3325, 3326, 3333, 3338, 3330, 3340, 3368, 3371, 3366, 3373,
+     3376, 3383, 3320, 3327, 3333, 3316, 3338, 3357, 3353, 3355,
+     3353, 3364, 3358, 3374, 9053, 3366, 3364, 3365, 9053, 3367,
+     3387, 9053, 3385, 9053, 3416, 9053, 3358, 3418, 9053, 3375,
+
+     3365, 3421, 9053, 3358, 3371, 3380, 3382, 3371, 3428, 9053,
+     3372, 3382, 3367, 3407, 3399, 3397, 3402, 3402, 3419, 3399,
+     3405, 3409, 3410, 3417, 3422, 3408, 3426, 3426, 3449, 3452,
+     3460, 3463, 3471, 3488, 3415, 3419, 3421, 3435, 3440, 3426,
+     3451, 3496, 3499, 3507, 3510, 3518, 3526, 3529, 3538, 3541,
+     3550, 3553, 3561, 3564, 3572, 3432, 3434, 3417, 3425, 3425,
+     3424, 3425, 3444,    0, 3442, 3427, 3449, 3427, 3444, 3455,
+     3447, 3455, 3456, 3478, 3468, 3480,    0, 3479, 3469, 3485,
+     3486, 3502, 3489, 3503, 3493, 3522, 3522, 3524,    0, 3533,
+     3544, 3542, 3548, 3547, 3564, 3543, 3553, 3551, 3554, 3553,
+
+     3554, 3572, 3573, 3549, 3566, 3535, 3554,    0,    0, 3537,
+     3546, 3541, 3548, 3548, 3559, 3592, 3562, 3546, 3562,    0,
+        0, 3572,    0, 3575, 3576, 3579, 3579, 3583, 3584,    0,
+     3579, 3580, 3588, 3568, 3569, 3573, 3585, 3574, 3590, 3594,
+     3596, 3593, 3595, 3603, 3587, 3606, 3608, 3596, 3597, 3592,
+     3604, 3599,    0, 3595, 3607, 3608, 3594, 3611,    0, 3598,
+     3599,    0, 3608,    0, 3622,    0, 3622,    0, 3606, 3623,
+     3620, 3629,    0,    0,    0, 3628, 3650, 3674, 3677, 3685,
+     3688, 3696, 3713, 3640, 3644, 3646, 3660, 3665, 3651, 3676,
+     3667,    0, 3665, 3668, 3670, 3688, 3667, 3653,    0, 3649,
+
+        0,    0,    0,    0,    0, 3652, 3649, 3654, 3675, 3663,
+     3663, 3681, 3685, 3681, 3668, 3674, 3684, 3671, 3671, 3676,
+     3693, 3676, 3681, 3676,    0, 3692,    0, 3689, 3694, 3700,
+     3694,    0, 3680, 3698, 3701, 3704, 3715, 3713, 3716, 3715,
+     3732, 3711, 3699, 3694,    0,    0,    0, 3714, 3712, 3697,
+     3717, 3713, 3717, 3720,    0, 3722, 3711, 3709, 3720, 3705,
+     3721, 3710, 3710,    0, 3725, 3726, 3723,    0, 3715,    0,
+     3718, 3722, 3731, 3736, 3738, 3734, 3735,    0, 3736, 3729,
+     3730, 3742, 3726, 3741, 3729, 3729, 3780, 3749, 3732, 3733,
+     3753, 3732, 3737, 3756,    0, 3739, 3753,    0, 3754, 3755,
+
+     3745, 3753, 3749, 3745, 3760,    0, 3766, 3763, 3765, 3770,
+        0, 3759,    0, 3757, 3782, 3780, 3783, 3782, 3799, 3778,
+     3767, 3822, 3823, 3825, 3824, 3826, 3827, 3829, 3828, 3830,
+     3831, 3832, 3833, 3834, 3835, 3836, 3837, 3838, 3842, 3839,
+     3840, 3845, 3843, 3846, 3847, 3853, 3848, 3849, 3858, 3870,
+     3871, 3855, 3875, 3866, 3869, 3876, 3877, 3878, 3846, 3847,
+     3848, 3850, 3865, 3853, 3890, 3888, 3892, 3891, 3893, 3896,
+     3897, 3840, 3846, 3844, 3864,    0, 3875, 9053, 3890, 3887,
+     3890, 3882, 3883, 3904, 3908, 3905, 3892, 3903, 3899, 3882,
+     3935, 3936, 3870, 3875, 3896, 3883, 3888, 3898, 3897, 3946,
+
+     3901, 3885, 3910, 3907, 3908, 3909, 3910, 3911, 3919, 3933,
+     3926, 3924, 3927, 3926, 3943, 3922, 3928, 3965, 3968, 3976,
+     3979, 3987, 3990, 3944, 3936, 3935, 3945, 3944, 3962, 3948,
+     4004, 4007, 4015, 4023, 4026, 4034, 4037, 4045, 4048, 3929,
+     3931, 3958, 3943, 3955, 3946, 3962, 3959, 3946,    0, 3957,
+        0,    0, 3965, 3975, 3995, 3982,    0, 3978, 4005, 3987,
+     4008, 4012,    0, 4016, 4001, 3994, 4015, 4016, 3998, 4010,
+     4025, 4009, 4027, 4028, 4029, 4030, 4031, 4037, 4034, 4035,
+     4036, 4037,    0, 4038,    0, 4044, 4054, 4037, 4023, 4025,
+     4035, 4036,    0,    0, 4045, 4046, 4042, 4037, 4034, 4050,
+
+     4038, 4038, 4039, 4056, 4057,    0, 4058, 4059, 4059, 4059,
+     4046, 4039,    0,    0, 4045, 4064, 4053, 4053, 4067, 4068,
+     4050,    0, 4064, 4065, 4071, 4072, 4057,    0, 4061, 4066,
+     4074, 4056,    0, 4072, 4078, 4058, 4070, 4071,    0, 4072,
+     4066, 4074, 4073, 4086, 4086, 4087, 4089, 4091, 4087, 4082,
+     4097, 4098, 4086, 4093, 4093, 4088, 4107, 4144, 4147, 4155,
+     4158, 4166, 4169, 4123, 4115, 4114, 4124, 4123, 4141, 4127,
+     4128, 4130, 4137, 4138, 4139, 4145, 4127, 4141, 4122, 4137,
+     4137, 4128, 4136, 4150, 4136, 4136, 4134, 4153, 4155, 4150,
+     4151, 4141, 4161, 4144, 4163, 4145, 4155, 4165, 4165, 4148,
+
+     4164, 4156, 4168, 4162, 4160, 4168, 4177, 4178, 4179, 4180,
+     4181, 4187,    0, 4183, 4164, 4180, 4177, 4180, 4188, 4184,
+     4172, 4179, 4177, 4179, 4180, 4182, 4196, 4192, 4178, 4198,
+     4182, 4187, 4189,    0, 4198, 4190, 4181, 4201, 4183, 4184,
+     4208, 4209, 4208, 4193, 4204, 4214, 4215, 4211, 4214, 4214,
+     4199, 4200, 4207, 4217, 4218, 4205, 4210, 4225, 4225, 4223,
+     4208, 4212, 4217, 4232,    0, 4220,    0, 4230, 4230, 4233,
+        0, 4223, 4238, 4239, 4240, 4241, 4242, 4248,    0, 4286,
+     4287, 4288, 4289, 4290, 4291, 4292, 4293, 4294, 4296, 4295,
+     4297, 4298, 4299, 4302, 4304, 4300, 4305, 4306, 4307, 4308,
+
+     4310, 4311, 4329, 4312, 4315, 4318, 4290, 4292, 4301, 4302,
+     4303, 4304, 4322, 4340, 4339, 4342, 4347, 4351, 4352,    0,
+        0,    0,    0, 4343, 4323, 4326, 9053, 4326, 4327, 4331,
+     4333, 4346, 9053, 4336, 4361, 4318, 4379, 9053, 4380, 9053,
+     4320, 4338, 4328, 4326, 4334, 4339, 4325, 4389, 4390, 9053,
+     4328, 4392, 4354, 4356, 4358, 4359, 4360, 4363, 4377, 4364,
+     4361, 4362, 4363, 4364, 4365, 4373, 4374, 4411, 4414, 4422,
+     4425, 4433, 4436, 4376, 4373, 4375, 4383, 4384, 4386, 4399,
+     4445, 4448, 4386, 4384, 4386, 4407, 4398, 4416, 4406, 4421,
+     4415, 4418, 4409, 4414, 4423, 4426, 4432, 4430, 4416, 4432,
+
+     4436, 4425, 4417, 4423, 4437, 4424, 4429, 4434, 4425, 4424,
+     4451, 4452, 4453, 4454, 4456, 4470, 4458, 4459, 4460, 4461,
+     4462, 4476,    0, 4492, 4449, 4456, 4448, 4449, 4440, 4451,
+        0, 4461,    0, 4451, 4464, 4454, 4458, 4471, 4467, 4454,
+     4462, 4457, 4458, 4477, 4479, 4480, 4462, 4470, 4483, 4469,
+     4469, 4462, 4469,    0,    0,    0,    0, 4483,    0, 4484,
+     4490, 4479, 4479, 4478, 4494, 4486, 4491,    0, 4496,    0,
+     4489, 4490, 4497, 4498, 4501, 4498, 4503, 4501, 4501, 4489,
+     4492, 4503, 4510, 4508, 4517, 4557, 4560, 4568, 4571, 4579,
+     4582, 4518, 4515, 4516, 4518, 4529, 4530, 4537, 4545, 4546,
+
+     4548, 4555, 4556, 4571, 4549, 4538, 4545, 4543, 4556, 4551,
+     4560, 4557, 4552, 4562, 4548, 4547, 4551, 4570, 4567, 4573,
+     4567, 4571, 4562, 4578, 4574, 4569, 4561, 4577, 4582, 4584,
+     4567, 4585, 4569, 4587, 4594, 4595, 4596, 4597, 4598, 4612,
+     4592, 4587, 4591, 4585, 4594, 4587, 4601, 4582, 4598, 4590,
+     4585, 4599, 4607, 4592, 4608, 4610, 4608, 4612, 4597, 4614,
+     4597, 4601, 4617, 4594, 4599, 4600, 4617, 4604,    0,    0,
+     4604, 4605, 4612, 4606, 4615, 4628,    0,    0, 4614, 4612,
+     4615, 4624, 4612, 4630, 4635, 4620,    0, 4632, 4638, 4635,
+     4624, 4632, 4638, 4628, 4644, 4650, 4651, 4652, 4653, 4654,
+
+     4668, 4693, 4694, 4695, 4696, 4697, 4698, 4701, 4699, 4700,
+     4702, 4704, 4705, 4706, 4708, 4709, 4716, 4710, 4711, 4712,
+     4713, 4717, 4718, 4719, 4721, 4723, 4739, 4724, 4726, 4741,
+     4734, 4709, 4710, 4711, 4715, 4716, 4727, 4736, 4754, 4756,
+     4757, 4759, 4763, 4765, 4710, 4723, 4742, 4748, 4737, 4752,
+     9053, 4754, 4755, 4758, 4731, 4734, 4728, 4733, 4734, 4724,
+     4736, 4742, 4791, 9053, 4792, 4793, 9053, 4765, 4770, 4771,
+     4773, 4776, 4779, 4766, 4768, 4770, 4771, 4772, 4776, 4777,
+     4791, 4788, 4815, 4818, 4826, 4829, 4838, 4849, 4780, 4782,
+     4784, 4792, 4793, 4795, 4817, 4852, 4799, 4794, 4808, 4805,
+
+     4819, 4818, 4818, 4805, 4812, 4826, 4807, 4820, 4818, 4827,
+     4827, 4833, 4815, 4824, 4836, 4827, 4821, 4840, 4840, 4837,
+     4832, 4823, 4834, 4833, 4845, 4848, 4868, 4869, 4870, 4871,
+     4872, 4859, 4874, 4875, 4876, 4877, 4878, 4865, 4844, 4854,
+     4844, 4856, 4862, 4867, 4868,    0, 4854, 4870, 4848, 4847,
+     4857, 4856, 4874, 4867, 4868, 4863, 4874, 4861, 4862, 4877,
+     4883, 4876, 4874, 4885, 4888, 4889, 4881, 4872, 4893, 4889,
+     4890, 4875, 4874, 4895, 4886, 4891, 4889, 4888, 4889, 4884,
+     4885, 4886, 4898, 4890, 4902, 4886, 4906, 4899, 4898, 4901,
+     4903, 4911, 4899, 4911, 4933, 4960, 4963, 4971, 4974, 4983,
+
+     4992, 4925, 4927, 4929, 4937, 4938, 4940, 4962, 4964, 4965,
+     4969, 4972, 4973, 4964, 4944, 4942, 4958, 4952, 4955, 4964,
+     4948, 4965, 4954, 4953, 4972, 4968, 4954, 4967, 4957, 4961,
+     4969, 4963, 4974, 4963, 4960, 4983, 4976, 4973, 4970, 4971,
+     4977, 4970, 4986, 4989, 5011, 5012, 5013, 5014, 5015, 5002,
+     4984, 4997, 5000, 4997, 5003, 4983, 4989, 4992, 4993, 5001,
+     5000, 4990, 4993, 5011, 5002, 4998, 5007, 5012, 5016, 5000,
+     5012, 5007, 5018, 5002, 5018, 5019, 5025, 5015,    0, 5013,
+     5027, 5060, 5014, 5018, 5018, 5015, 5029, 5020, 5020, 5018,
+     5024, 5036, 5034, 5023, 5024, 5031, 5026, 5045, 5032, 5034,
+
+     5067, 5068, 5069, 5070, 5071, 5058, 5097, 5098, 5099, 5100,
+     5101, 5102, 5103, 5104, 5105, 5108, 5106, 5107, 5109, 5110,
+     5111, 5112, 5113, 5118, 5115, 5117, 5121, 5124, 5119, 5130,
+     5107, 5108, 5111, 5112, 5114, 5113, 5133, 5144, 5149, 5150,
+     5152, 5153, 5156, 5153, 9053, 9053, 5135, 5119, 9053, 5129,
+     5143, 5148, 5129, 5111, 5119, 5111, 5119, 5125, 5126, 5125,
+     5189, 9053, 5135, 5150, 5131, 5162, 5158, 5159, 5160, 5161,
+     5162, 5163, 5174, 5179, 5180, 5181, 5182, 5183, 5171, 5177,
+     5209, 5212, 5220, 5223, 5231, 5234, 5184, 5189, 5191, 5199,
+     5200, 5202, 5196, 5193, 5195, 5201, 5194, 5199, 5187, 5207,
+
+     5204, 5196, 5198, 5192, 5199, 5213, 5214, 5203, 5212, 5218,
+     5201, 5220, 5214, 5223, 5221, 5211, 5217,    0, 5231, 5227,
+     5213, 5227, 5220, 5226, 5243, 5244, 5245, 5246, 5247, 5248,
+     5249, 5250, 5251, 5252, 5253, 5254, 5246, 5239, 5250, 5241,
+     5240, 5251, 5238, 5247, 5241, 5247, 5261, 5248, 5246, 5249,
+     5259, 5253, 5256, 5269, 5265, 5262, 5258, 5255, 5266, 5255,
+     5271, 5268,    0, 5259, 5274, 5278, 5282, 5261, 5270, 5271,
+     5273, 5287, 5276, 5268, 5276, 5282,    0,    0, 5277, 5278,
+     5293, 5281, 5277, 5296, 5278, 5280, 5284, 5289, 5286, 5298,
+     5300, 5286, 5305, 5316, 5348, 5351, 5359, 5362, 5370, 5373,
+
+     5323, 5328, 5330, 5338, 5339, 5341, 5335, 5336, 5338, 5345,
+     5346, 5347, 5349, 5325, 5345, 5349, 5345, 5351, 5352, 5344,
+     5345, 5335, 5357, 5357, 5359, 5336, 5341, 5354, 5359, 5347,
+     5363, 5371, 5367, 5368, 5359, 5376,    0, 5377, 5373, 5378,
+     5371,    0, 5370, 5386, 5387, 5388, 5389, 5390, 5391, 5384,
+     5389, 5369, 5391, 5372, 5381, 5376, 5390, 5389, 5397, 5391,
+     5391, 5395, 5382, 5402, 5402, 5404, 5400, 5387, 5402, 5403,
+     5400, 5395, 5406, 5398, 5399, 5409, 5415, 5400, 5393, 5418,
+     5414, 5419, 5435, 5413, 5422, 5406, 5408, 5426, 5422, 5413,
+     5420, 5425, 5416, 5431, 5428, 5422, 5415, 5435, 5431, 5442,
+
+     5443, 5444, 5445, 5446, 5447, 5486, 5487, 5488, 5489, 5491,
+     5492, 5493, 5494, 5495, 5496, 5497, 5498, 5499, 5500, 5501,
+     5502, 5503, 5505, 5506, 5508, 5510, 5507, 5509, 5478, 5483,
+     5485, 5488, 5491, 5493, 5511, 5514, 5520, 5533, 5535, 5536,
+     5528, 9053, 5497, 9053, 9053, 5501, 5518, 5494, 5492, 5498,
+     5500, 5486, 5487, 5513, 5518, 9053, 5519, 5521, 5572, 5517,
+     5511, 5548, 5537, 5538, 5539, 5540, 5541, 5552, 5548, 5545,
+     5546, 5547, 5548, 5549, 5550, 5563, 5588, 5591, 5599, 5602,
+     5610, 5613, 5559, 5556, 5564, 5565, 5567, 5575, 5576, 5561,
+     5575, 5578, 5567, 5571, 5569, 5569,    0, 5589, 5586, 5578,
+
+     5574, 5576, 5576, 5592, 5599, 5600, 5593, 5602, 5584, 5587,
+     5592, 5594, 5594, 5609, 5590, 5597, 5598, 5600, 5597, 5616,
+     5599, 5609, 5623, 5624, 5625, 5626, 5627, 5638, 5629, 5630,
+     5631, 5632, 5633, 5644, 5609, 5632, 5625, 5613, 5612, 5618,
+     5636, 5629, 5614, 5625, 5641, 5622, 5631, 5629, 5645, 5632,
+     5638, 5643, 5646, 5650, 5625, 5648, 5638, 5653, 5630, 5650,
+     5650, 5649, 5645, 5642, 5641, 5646, 5658, 5660, 5664, 5666,
+     5655, 5659, 5656,    0, 5656, 5653, 5654, 5664, 5668, 5675,
+     5660, 5657, 5657, 5661, 5668, 5681, 5663, 5664, 5684, 5669,
+     5702, 5727, 5730, 5738, 5741, 5749, 5752, 5697, 5693, 5695,
+
+     5703, 5704, 5706, 5714, 5715, 5717, 5724, 5725, 5726, 5738,
+     5716, 5726, 5715, 5729, 5712, 5728, 5717, 5713, 5715, 5728,
+     5721, 5735, 5740, 5737, 5724, 5744, 5744, 5733, 5730, 5732,
+     5750, 5732, 5736, 5742, 5741, 5747, 5741, 5740, 5743, 5739,
+     5762, 5767, 5768, 5769, 5770, 5771, 5782, 5754, 5752, 5759,
+     5763, 5765, 5754, 5770, 5758, 5757, 5760, 5760,    0, 5779,
+     5762, 5770, 5764, 5768, 5765, 5767, 5786, 5774, 5786, 5776,
+     5777, 5773, 5774, 5770, 5788, 5796, 5797, 5783, 5796, 5782,
+     5804, 5798, 5783, 5784, 5784, 5790, 5798, 5794, 5785, 5791,
+     5795, 5792, 5810, 5799, 5806, 5792, 5798, 5822, 5823, 5824,
+
+     5825, 5826, 5837, 5866, 5867, 5868, 5869, 5870, 5871, 5872,
+     5873, 5874, 5875, 5876, 5877, 5878, 5879, 5880, 5881, 5882,
+     5884, 5886, 5885, 5887, 5854, 5856, 5857, 5862, 5863, 5871,
+     5898, 5907, 5908, 5910, 5911, 5912, 5914, 5852, 9053, 5872,
+     5866, 5866, 5870, 5855, 5851, 5874, 5904, 5864, 5871, 5881,
+     5934, 5935, 9053, 5892, 5889, 5938, 5902, 5914, 5923, 5927,
+     5928, 5930, 5926, 5934, 5923, 5924, 5925, 5926, 5928, 5939,
+     5931, 5967, 5970, 5978, 5981, 5994, 6003, 5944, 5933, 5935,
+     5943, 5944, 5946, 5963, 5945, 5942, 5936, 5952, 5938, 5962,
+     5957, 5953,    0, 5970, 5967, 5953, 5969, 5952, 5955, 5958,
+
+     5966, 5970, 5963, 5981, 5969, 5980, 5971, 5982, 5986, 5982,
+     5975, 5987, 5990, 5973, 5988, 5975, 6010, 6011, 6012, 6013,
+     6014, 6010, 6016, 6017, 6018, 6019, 6020, 6016, 6003, 6006,
+     6010, 5998, 6012, 5995, 5998, 6008, 6015, 6006, 6018,    0,
+     5995, 6003, 6016, 6022, 6011, 6001, 6014, 6024, 6023, 6029,
+     6016, 6009, 6032, 6013, 6026, 6009, 6032, 6022, 6038, 6034,
+     6037, 6041, 6030, 6026, 6039, 6029, 6046,    0, 6028, 6029,
+     6035, 6035, 6035, 6052, 6040, 6042, 6050, 6041, 6053, 6049,
+     6050, 6044, 6061, 6067, 6103, 6106, 6114, 6117, 6128, 6131,
+     6080, 6069, 6071, 6079, 6080, 6082, 6099, 6100, 6101, 6104,
+
+     6113, 6115, 6111, 6101, 6102, 6097, 6104, 6087, 6094, 6096,
+     6102, 6107, 6112, 6114, 6115, 6093, 6104, 6103, 6100, 6103,
+     6123, 6111, 6107, 6121, 6107, 6120, 6108, 6130, 6131, 6118,
+     6132, 6129, 6132,    0, 6131, 6124, 6152, 6153, 6154, 6156,
+     6157, 6153, 6131, 6141, 6127, 6134, 6131, 6141, 6132, 6148,
+     6145, 6149, 6155, 6152, 6152, 6143, 6140, 6159, 6156,    0,
+     6158, 6160, 6164, 6145, 6147, 6158, 6159, 6149, 6169, 6162,
+     6167, 6159,    0, 6163, 6182, 6171, 6158, 6178, 6178, 6175,
+     6174, 6162,    0, 6162, 6175, 6180, 6166, 6180, 6181, 6171,
+        0, 6204, 6205, 6206, 6207, 6208, 6204, 6238, 6239, 6240,
+
+     6241, 6242, 6243, 6244, 6245, 6246, 6247, 6248, 6250, 6249,
+     6252, 6254, 6255, 6256, 6257, 6259, 6260, 6233, 6234, 6235,
+     6246, 6248, 6231, 6272, 6279, 6281, 6283, 6285, 6286, 6277,
+     6259, 6267, 6226, 6243, 6243, 6244, 6250, 6258, 9053, 6283,
+     9053, 9053, 6249, 6311, 9053, 6256, 6314, 6315, 9053, 6273,
+     9053, 6285, 6287, 6289, 6292, 6293, 6301, 6291, 6301, 6303,
+     6304, 6307, 6308, 6304,    0, 6336, 6339, 6347, 6350, 6358,
+     6366, 6302, 6312, 6314, 6322, 6323, 6325, 6328, 6307, 6309,
+     6322, 6316, 6329, 6315, 6317, 6331, 6324, 6321, 6326, 6342,
+     6340, 6332, 6340, 6341, 6335, 6347, 6342, 6347, 6352, 6349,
+
+     6355, 6344, 6351, 6346, 6354, 6357, 6358, 6343, 6338, 6373,
+     6374, 6375, 6376, 6377, 6385, 6379, 6380, 6381, 6382, 6383,
+     6391, 6358, 6369, 6357, 6362, 6380, 6369, 6367, 6383, 6370,
+     6384, 6381, 6383, 6388, 6370, 6372, 6379, 6371, 6392, 6385,
+     6383,    0, 6389, 6377, 6393, 6379, 6400, 6381, 6397, 6403,
+     6390, 6400, 6389, 6388, 6406, 6398, 6390, 6398,    0, 6401,
+     6411, 6412,    0, 6407, 6412, 6412, 6404, 6401, 6403, 6401,
+     6415, 6411, 6412, 6422, 6422,    0, 6469, 6472, 6480, 6483,
+     6491, 6499, 6435, 6445, 6447, 6455, 6456, 6458, 6461, 6462,
+     6463, 6464, 6470, 6471, 6483, 6457, 6461, 6456, 6457, 6461,
+
+     6461, 6476, 6463, 6478, 6460, 6454, 6459, 6470, 6471, 6481,
+     6482, 6483, 6471, 6485, 6486, 6488, 6493, 6476, 6486, 6487,
+     6495, 6498, 6475, 6486, 6487, 6497, 6503, 6503, 6514, 6515,
+     6516, 6517, 6518, 6526, 6504, 6496, 6513, 6514, 6510, 6500,
+     6512, 6513,    0, 6503, 6504, 6521, 6503, 6508, 6524, 6506,
+     6523, 6527, 6503, 6513, 6521, 6522, 6517, 6518, 6529, 6519,
+     6522, 6519, 6538, 6539, 6562, 6541,    0, 6524, 6531, 6526,
+     6537, 6537, 6535, 6534, 6549, 6545,    0, 6551, 6547, 6562,
+     6563, 6564, 6565, 6566, 6574, 6601, 6602, 6603, 6604, 6605,
+     6606, 6607, 6608, 6609, 6611, 6610, 6612, 6614, 6616, 6613,
+
+     6617, 6619, 6621, 6622, 6626, 6624, 6594, 6598, 6600, 6603,
+     6608, 6613, 6625, 6643, 6645, 6646, 6648, 6649, 6650, 6611,
+     6618, 6588, 6596, 6596, 6598, 6618, 6601, 6617, 6618, 6667,
+     9053, 6615, 6649, 6652, 6653, 6654, 6655, 6645, 9053, 6651,
+     6652, 6654, 6655, 6656, 6664, 6689, 6692, 6700, 6703, 6712,
+     6715,    0, 6659, 6660, 6662, 6670, 6671, 6680, 6656, 6669,
+     6681, 6676, 6673, 6679, 6684,    0, 6685, 6671, 6687, 6684,
+     6679, 6675, 6680, 6678, 6699, 6691, 6687,    0, 6682, 6682,
+     6689, 6696, 6687, 6682, 6708, 6704, 6704, 6713, 6715, 6732,
+     6733, 6734, 6735, 6736, 6726, 6738, 6739, 6740, 6741, 6742,
+
+     6732, 6709, 6720, 6716, 6710, 6715, 6728, 6716, 6729, 6735,
+     6718, 6714, 6738, 6721, 6741, 6727, 6743, 6731, 6745, 6730,
+     6738, 6747, 6749, 6747, 6743, 6749, 6753,    0, 6747, 6735,
+     6742, 6739, 6758, 6744, 6748, 6746, 6761, 6756, 6759, 6756,
+     6748, 6749, 6754, 6751, 6761, 6753, 6772, 6752, 6769, 6757,
+     6769, 6770, 6760, 6770, 6820, 6823, 6831, 6834, 6843, 6846,
+        0, 6790, 6791, 6793, 6801, 6802, 6811, 6818, 6821, 6830,
+     6832, 6833, 6824, 6805, 6816, 6810, 6809, 6819, 6805, 6806,
+     6821, 6812, 6823, 6807, 6808, 6819, 6820, 6835, 6821, 6822,
+     6838, 6827, 6841, 6822, 6826, 6840, 6828, 6833, 6847, 6833,
+
+        0,    0, 6849, 6837, 6833, 6829, 6870, 6871, 6872, 6873,
+     6874, 6864, 6859, 6856, 6845, 6844, 6845, 6853, 6852, 6851,
+     6863, 6864, 6858,    0, 6855, 6857, 6854, 6855, 6872, 6877,
+     6877, 6872, 6865, 6867, 6868, 6869, 6884, 6866, 6868, 6884,
+     6883, 6909, 6872, 6886, 6892, 6893, 6892, 6888, 6876, 6879,
+     6889, 6895, 6881, 6900, 6918, 6919, 6920, 6921, 6922, 6912,
+     6950, 6951, 6952, 6953, 6954, 6956, 6955, 6958, 6957, 6959,
+     6961, 6962, 6966, 6937, 6938, 6939, 6941, 6942, 6940, 6969,
+     6970, 6978, 6979, 6981, 6989, 6982, 6958, 6953, 9053, 9053,
+     6932, 6937, 6928, 6948, 6994, 6997, 6945, 6957, 6958, 6960,
+
+     6962, 6963,    0, 6975, 6976, 6979, 6981, 6983, 6973, 7021,
+     7024, 7032, 7035, 7043, 7046, 6998, 6999, 7001, 7009, 7010,
+     7001, 6986, 6986, 6982, 7000, 7010, 6991, 7017,    0, 7001,
+     7003, 7008, 7009, 7005, 7004, 7001, 7022, 7024, 7009, 7018,
+     7019, 7033, 7016, 7022, 7017, 7034,    0, 7036, 7032, 7037,
+     7034, 7038, 7050, 7051, 7052, 7053, 7054,    0, 7055, 7056,
+     7057, 7058, 7059,    0, 7050, 7043, 7046, 7057, 7038, 7046,
+     7042, 7044, 7051, 7059, 7064, 7050, 7058, 7067, 7056, 7058,
+     7071, 7065,    0, 7057, 7058, 7068, 7056, 7059, 7066, 7076,
+     7079, 7081, 7078, 7068, 7076, 7067, 7077, 7064, 7076, 7069,
+
+     7084, 7084, 7087, 7088,    0, 7094, 7083, 7091, 7096, 7086,
+     7082,    0, 7089, 7093, 7106, 7095, 7148, 7157, 7160, 7168,
+     7171, 7179, 7126, 7127, 7128, 7134, 7137, 7134, 7135, 7137,
+     7145, 7146, 7147,    0, 7125, 7148, 7144, 7141, 7131,    0,
+     7144, 7146, 7156, 7152,    0, 7140, 7141, 7142, 7143, 7142,
+     7148, 7160, 7147, 7153, 7165, 7167, 7170, 7171, 7168, 7174,
+     7172, 7171, 7165, 7158, 7176, 7175, 7186, 7187, 7188, 7189,
+     7190,    0, 7170, 7186, 7167, 7184, 7182, 7182, 7189, 7173,
+     7193, 7177, 7191, 7192, 7179, 7185,    0, 7191, 7192, 7200,
+     7183, 7204, 7191, 7206, 7207, 7189, 7207, 7190, 7196, 7200,
+
+     7189, 7211, 7214, 7215, 7211, 7211, 7205, 7216,    0, 7217,
+     7209, 7224, 7216, 7222, 7232, 7233, 7234, 7235, 7236,    0,
+     7274, 7275, 7276, 7277, 7278, 7279, 7280, 7281, 7283, 7285,
+     7287, 7252, 7254, 7256, 7258, 7260, 7262, 7299, 7301, 7303,
+     7305, 7306, 7298, 9053, 7283, 9053, 7245, 7267, 9053, 7317,
+     9053, 7318, 9053, 7319,    0,    0,    0,    0,    0, 7274,
+     7275, 7276, 7277, 7278, 9053, 7337, 7341, 7345, 7349, 7353,
+     7282, 7283, 7284, 7285, 7286,    0, 7259,    0, 7286, 7293,
+     7286, 7312, 7317, 7313, 7321, 7318, 7305, 7306, 7326, 7312,
+     7311, 7316, 7326, 7318, 7332,    0, 7333, 7335, 7311, 7317,
+
+     7337, 7325, 7327, 7327, 7333,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0, 9053, 7338, 7340, 7333, 7345,
+     7340, 7348, 7334, 7350,    0, 7346, 7332, 7346, 7342, 7355,
+     7351, 7345, 7351,    0,    0, 7358, 7345, 7356, 7353, 7351,
+     7348, 7358, 7366, 7353, 7367, 7369, 7354, 7366, 7363, 7365,
+     7354, 7367, 7371, 7372, 7366, 7367, 7361, 7378, 7381, 7382,
+     7383, 7365, 7385, 7385, 7378, 7371, 7392, 7388, 7389, 7383,
+     7384, 7437, 7440, 7448, 7451, 7459, 7403, 7404, 7406, 7414,
+     7415,    0,    0,    0,    0,    0,    0, 7407, 7414, 7407,
+     7409, 7414, 7420, 7410, 7416, 7408, 7426, 7427, 7420, 7421,
+
+        0, 7426, 7435, 7428, 7420,    0, 7419, 7420, 7437, 7438,
+     7434, 7433, 7427, 7426,    0, 7432, 7430,    0,    0,    0,
+        0,    0, 7430, 7430, 7450, 7449, 7438, 7449, 7450, 7448,
+     7437, 7458, 7445, 7442,    0, 7449, 7447, 7444, 7452, 7460,
+     7458, 7465, 7468, 7460, 7447, 7462, 7471, 7468, 7456, 7466,
+     7473, 7462, 7458, 7475, 7465, 7463, 7464, 7469, 7472, 7480,
+     7467, 7462, 7475,    0,    0,    0,    0,    0, 7532, 7533,
+     7534, 7535, 7536, 7537, 7539, 7540, 7542, 7543, 7545, 7512,
+     7513, 7514, 7515, 7516, 7551, 7552, 7553, 7554, 7555, 7556,
+     9053, 7512, 9053, 7561, 9053, 9053, 9053, 9053, 9053, 9053,
+
+        0,    0,    0,    0,    0, 7520, 7513, 7523, 7509,    0,
+     7506, 7500, 7506, 7513, 7520, 7512, 7519, 7527, 7518, 7527,
+     7517, 7535, 7526, 7533, 7536, 7542,    0, 7523, 7538, 7540,
+     7551, 7540, 7535, 7549, 7546, 7544, 7538, 7558, 7547, 7549,
+     7548, 7548, 7550, 7553, 7561, 7553, 7563, 7566, 7554, 7553,
+     7553, 7557, 7565,    0, 7574, 7573, 7557, 7559, 7567,    0,
+     7576, 7561,    0, 7582, 7563, 7570, 7571, 7577, 7584, 7567,
+     7584, 7584, 7572, 7576, 7587, 7581, 7589, 7577, 7573, 7591,
+     7599, 7580, 7581, 7582, 7594, 7601,    0,    0,    0,    0,
+        0, 7587, 7597, 7638, 7640, 7604, 7612, 7608, 7599, 7610,
+
+     7600, 7601, 7617, 7618, 7606, 7601, 7607, 7598, 7615, 7616,
+     7607,    0, 7613, 7626, 7626, 7605, 7613, 7614,    0, 7633,
+     7622, 7620, 7624, 7619, 7638,    0, 7620, 7624, 7634, 7642,
+     7618, 7630, 7625, 7645, 7646, 7642, 7628, 7641, 7637, 7643,
+     7638, 7635, 7654, 7656, 7641, 7646, 7645, 7651, 7642, 7644,
+     7648, 7664, 7647, 7662, 7648, 7653, 7654, 7665, 7670, 7714,
+     7715, 7716, 7718, 7719, 7720, 7721, 7722, 7723, 7724, 9053,
+     7670, 7683, 7666, 7668,    0, 7682, 7679, 7671, 7683, 7690,
+     7673,    0, 7680, 7674, 7684, 7684, 7693, 7694, 7683, 7686,
+     7701, 7688,    0, 7687, 7700, 7705, 7687, 7688, 7700, 7702,
+
+     7699, 7712, 7708, 7710, 7697, 7715, 7702, 7704,    0, 7713,
+     7697,    0, 7703, 7715, 7724, 7709, 7710, 7715, 7728, 7721,
+     7725,    0, 7706, 7729, 7733, 7725, 7726, 7722, 7729, 7726,
+        0,    0, 7719, 7768, 7770, 7730,    0,    0, 7723, 7737,
+     7744, 7733, 7729, 7730, 7739, 7746, 7743, 7744,    0,    0,
+        0,    0, 7758, 7754, 7741, 7757, 7744, 7758, 7760, 7754,
+     7755, 7761, 7750,    0,    0, 7755, 7756,    0, 7766, 7758,
+     7769,    0, 7770, 7761, 7773, 7769, 7765, 7776,    0, 7766,
+     7782, 7782, 7764, 7782,    0,    0, 7768, 7784, 7770, 7780,
+     7781, 7777, 7792, 7779, 7780, 7790, 7792, 7779, 7782, 7778,
+
+     7781, 7786,    0, 7802, 7782, 7787, 7805, 7787, 7804, 7790,
+        0, 7809, 7797, 7853, 7811, 7794, 7794, 7790, 7803, 7805,
+     7805, 7800, 7811,    0, 7802, 7814, 7822, 7819,    0, 7825,
+     7826, 7805,    0,    0, 7807,    0, 7825, 7825, 7806, 7812,
+        0, 7821, 7829, 7821, 7817, 7818, 7826, 7816, 7836, 7821,
+     7835, 7840, 7829, 7827, 7846,    0, 7838, 7845,    0, 7843,
+        0, 7838, 7848, 7838, 7839, 7849, 7854, 7836, 7856, 7854,
+        0,    0,    0, 7847, 7857, 7860, 7861, 7862, 7844, 7864,
+     7863, 7851, 7860, 7861, 7866, 7871, 7872, 7862, 7856, 7872,
+     7869, 7873, 7860, 7879, 7880,    0,    0,    0,    0, 7868,
+
+        0, 7868, 7870, 7871,    0, 7868, 7882, 7868, 7885,    0,
+     7884, 7872, 7873, 7885, 7879, 7886, 7885, 7894, 7884, 7887,
+     7900, 7885, 7898,    0, 7884, 7904, 7904, 7897, 7888, 7903,
+        0, 7891, 7894, 7890, 7895, 7892, 7899, 7902, 7910, 7912,
+     7904, 7911, 7915, 7921, 7921, 7919, 7923,    0, 7911, 7906,
+        0, 7911, 7928, 7920, 7926, 7927, 7932, 7929, 7932, 7936,
+     7912, 7923, 7925,    0,    0, 7922,    0, 7936, 7923, 7943,
+     7944, 7927, 7934, 7942, 7930, 7933, 7938, 7931, 7943, 7941,
+        0,    0,    0, 7936, 7955,    0, 7955, 7952, 7953, 7953,
+     7941, 7945, 7949, 7957, 7945, 7941, 7947, 7953, 7954,    0,
+
+     7951, 7954, 7951, 7969, 7964, 7959,    0, 7970, 7956, 7957,
+        0, 7972, 7974, 7960, 7962, 7962, 7958, 7965, 7985, 7981,
+     7968,    0, 7974, 7987, 7978, 7983, 7988, 7989, 7978, 7994,
+     7981, 7997, 7980, 7979, 7986, 7992, 7988, 7990,    0, 8003,
+     7984, 7992, 7989, 8007, 7994, 7998, 8010, 8012, 7997, 8008,
+     7991, 8002, 8013, 7998,    0, 8001,    0, 8014, 8007, 8004,
+     8005, 8012, 8005, 8006, 8024,    0, 8005, 8025, 8021, 8027,
+        0, 8029, 8017, 8029, 8031, 8019, 8032,    0, 8029, 8024,
+     8024, 8032,    0, 8041,    0,    0,    0,    0, 8023, 8073,
+     8034,    0,    0, 8030,    0, 8035, 8036,    0, 8053, 8045,
+
+     8054, 8036, 8045, 8058,    0,    0, 8050, 8041,    0,    0,
+     8056,    0,    0, 8045, 8047,    0, 8044, 8044, 8057, 8067,
+     8063, 8049, 8069, 8052, 8049, 8068, 8069, 8070, 8069, 8062,
+     8059, 8077, 8068, 8080, 8070, 8079, 8065, 8068, 8082, 8081,
+     8083,    0, 8072, 8082, 8083, 8084, 8085, 8094, 8081, 8081,
+     8080, 8081, 8100, 8096, 8093, 8091, 8099, 8086, 8099,    0,
+     8095, 8090, 8104, 8110, 8090, 8095, 8097, 8092, 8115, 8100,
+     8114, 8117, 8118, 8119, 8101, 8121, 8119,    0,    0, 8106,
+     8107, 8114, 8115, 8115, 8121, 8127, 8129, 8121,    0, 8131,
+     8114, 8135, 8128, 8118, 8120, 8121, 8123, 8133, 8124, 8125,
+
+     8145, 8124, 8142, 8132,    0, 8149, 8136, 8130, 8152,    0,
+     8141, 8149,    0, 8146, 8156, 8143, 8153, 8141, 8155, 8148,
+     8149, 8145, 8149, 8156, 8148, 8166, 8153, 8160, 8164, 8168,
+     8157, 8164, 8170,    0, 8167, 8167, 8162, 8164, 8173, 8171,
+     8160,    0, 8177, 8163, 8184, 8180, 8167, 8181, 8169, 8173,
+     8177,    0, 8190, 8177, 8178, 8185, 8190,    0, 8182,    0,
+     8182, 8193, 8179, 8199, 8183, 8195, 8194, 8184, 8185,    0,
+     8193, 8188,    0, 8196, 8205, 8206, 8207, 8197, 8214, 8196,
+     8196,    0, 8199, 8203, 8200, 8213, 8208, 8217, 8218, 8203,
+     8204, 8221, 8213, 8214, 8226, 8211, 8213, 8228, 8224, 8214,
+
+     8221, 8220,    0, 8217, 8222, 8237,    0, 8225, 8223, 8233,
+     8225, 8229, 8225,    0, 8231,    0, 8227, 8276, 8237,    0,
+     8240, 8241, 8238,    0, 8246, 8241,    0, 8246, 8244, 8256,
+        0, 8243,    0, 8244, 8255,    0, 8256, 8261, 8249, 8260,
+     8264, 8261, 8266, 8268, 8268, 8263, 8257, 8252, 8253, 8269,
+     8258,    0, 8263, 8264, 8275,    0,    0, 8274, 8261,    0,
+     8276, 8270, 8274, 8281,    0,    0,    0, 8273, 8268, 8282,
+     8270, 8289,    0, 8275, 8272, 8291, 8289,    0, 8289, 8290,
+     8284,    0, 8281, 8283, 8290, 8280, 8287, 8286,    0, 8289,
+     8280, 8305, 8304, 8287, 8305, 8291, 8309, 8304, 8307,    0,
+
+     8312, 8306, 8301, 8295,    0,    0, 8297, 8312,    0,    0,
+     8314, 8305, 8309, 8317, 8323, 8320, 8321, 8324,    0, 8319,
+        0, 8328, 8327, 8328, 8327, 8321, 8320, 8315, 8331,    0,
+        0,    0, 8332, 8325, 8324,    0,    0, 8335, 8328, 8337,
+     8336, 8340, 8325,    0, 8326, 8342, 8339, 8334,    0, 8336,
+     8342, 8339, 8348,    0, 8350, 8343, 8342,    0, 8337, 8338,
+     8345, 8355,    0, 8352, 8358, 8345, 8343, 8345, 8365, 8352,
+     8350, 8360,    0, 8351,    0, 8357, 8357, 8355, 8371, 8359,
+        0, 8362,    0, 8368, 8371,    0,    0,    0, 8366, 8375,
+        0, 8363, 8370, 8375,    0, 8370, 8366, 8372,    0, 8384,
+
+     8374, 8388, 8378,    0, 8371, 8376, 8381, 8389, 8376, 8381,
+     8377, 8379, 8392, 8395, 8394, 8377,    0, 8391, 8395, 8396,
+        0, 8401, 8393,    0, 8390, 8400, 8390, 8392, 8395,    0,
+        0, 8401, 8398, 8397, 8396, 8397, 8399, 8416, 8402, 8416,
+     8402,    0,    0, 8418, 8405, 8406,    0, 8411, 8426, 8411,
+     8404, 8430,    0,    0, 8419, 8418, 8413, 8418, 8417, 8415,
+     8433, 8413, 8434, 8435, 8428, 8423, 8427,    0, 8443, 8431,
+        0, 8441, 8443,    0, 8429, 8449,    0, 8436, 8430, 8439,
+     8451, 8449, 8437, 8456, 8442, 8452, 8459, 8458, 8460, 8443,
+     8458, 8445,    0, 9053, 8509, 8513, 8517, 8521, 8522, 8524,
+
+     8526, 8527, 8528, 8530, 8532, 8533, 8537, 8541, 8535, 8539,
+     8545, 8549
     } ;
 
-static yyconst flex_int16_t yy_def[6539] =
+static yyconst flex_int16_t yy_def[6113] =
     {   0,
-     6522, 6522, 6521,    3,    2,    2,    2,    2,    2,    2,
-        2,    2, 6521,   13,    2,    2,    2,    2,    2,    2,
-        2,    2,    2,    2, 6523, 6523, 6521,   27, 6524, 6524,
-        2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
+     6095, 6095, 6094,    3,    2,    2,    2,    2,    2,    2,
+        2,    2, 6094,   13, 6094,   15,    2,    2,    2,    2,
+        2,    2,    2,    2, 6096, 6096, 6094,   27, 6097, 6097,
+        2,    2,    2,    2,    2,    2,    2,    2, 6094,   39,
         2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
-        2,    2, 6521,   53, 6521,   55,    2,    2, 6525, 6525,
-        2,    2, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521,
-     6521, 6521, 6521, 6521, 6526, 6526, 6526, 6526, 6526, 6526,
-     6521, 6521, 6521, 6521, 6527, 6521, 6521, 6521,   69, 6527,
-     6527, 6527, 6521, 6521, 6521, 6528, 6528, 6528, 6528, 6528,
-
-     6528, 6527, 6528, 6528, 6528, 6528, 6528, 6528, 6528, 6528,
-     6528, 6528, 6528, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6521, 6521,   69,
-     6521, 6521, 6529, 6529, 6529, 6529, 6529, 6529, 6529, 6529,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6530,
-     6530, 6530, 6530, 6531, 6531, 6531, 6531, 6531, 6531, 6530,
-     6521, 6521, 6521, 6521, 6521,   69, 6521, 6521, 6521, 6521,
-     6521, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6521, 6526, 6521, 6521, 6532, 6521, 6533, 6521, 6521,
-
-       69, 6521, 6521, 6521, 6521, 6521, 6526, 6526, 6526, 6526,
-     6526, 6526, 6521, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6521, 6521,   69, 6521,
-     6521, 6521, 6534, 6534, 6534, 6534, 6534, 6534, 6534, 6534,
-     6534, 6521, 6521,   69, 6521, 6521, 6535, 6535, 6535, 6535,
-
-     6535, 6535, 6535, 6535, 6535, 6521, 6521, 6521, 6521, 6536,
-     6536, 6521, 6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536,
-     6536, 6537, 6537,  323,  323,  323,  323, 6536, 6521, 6521,
-     6526, 6526, 6526, 6526, 6526, 6521, 6521, 6521, 6521, 6521,
-     6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521,
-     6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521,
-     6521, 6521, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6521,
-     6521, 6521, 6521, 6521, 6521, 6527, 6527, 6527, 6527, 6528,
-     6528, 6528, 6528, 6528, 6528, 6528, 6528, 6528, 6528, 6528,
-     6528, 6528, 6527, 6527, 6527, 6527, 6527, 6527, 6528, 6528,
-
-     6528, 6528, 6528, 6528, 6528, 6528, 6528, 6528, 6528, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6521, 6521, 6521, 6521, 6529, 6529, 6529,
-     6529, 6529, 6529, 6529, 6529, 6529, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6530, 6530, 6530, 6530, 6531, 6531, 6531, 6531, 6531,
-     6531, 6531, 6530, 6530, 6530, 6530, 6530, 6530, 6526, 6526,
-     6526, 6526, 6526, 6526, 6521, 6521, 6521, 6521, 6521, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-
-     6526, 6526, 6526, 6526, 6526, 6521, 6521, 6521, 6521, 6534,
-     6534, 6534, 6534, 6534, 6534, 6534, 6534, 6534, 6534, 6521,
-     6521, 6521, 6521, 6535, 6535, 6535, 6535, 6535, 6535, 6535,
-     6535, 6535, 6535, 6521, 6521, 6521, 6536, 6521, 6536, 6536,
-     6536, 6521, 6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536,
-     6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536,
-     6536, 6536, 6536, 6536, 6536, 6536,  323,  323,  323,  323,
-      323,  323,  323, 6536, 6536, 6536, 6536, 6536, 6536, 6521,
-     6526, 6526, 6526, 6526, 6526, 6526, 6521, 6521, 6521, 6521,
-     6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521,
-
-     6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521,
-     6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521,
-     6521, 6521, 6526, 6526, 6526, 6526, 6526, 6526, 6521, 6521,
-     6521, 6521, 6521, 6521, 6521, 6527, 6527, 6528, 6528, 6528,
-     6528, 6528, 6528, 6528, 6528, 6528, 6528, 6528, 6528, 6527,
-     6527, 6527, 6527, 6527, 6527, 6527, 6528, 6528, 6528, 6528,
-     6528, 6528, 6528, 6528, 6528, 6528, 6528, 6528, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-
-     6526, 6526, 6526, 6526, 6521, 6521, 6529, 6529, 6529, 6529,
-     6529, 6529, 6529, 6529, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-
-     6526, 6526, 6530, 6530, 6531, 6531, 6531, 6531, 6531, 6531,
-     6530, 6530, 6530, 6530, 6530, 6530, 6530, 6526, 6526, 6526,
-     6526, 6521, 6521, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6521, 6521, 6534, 6534,
-     6534, 6534, 6534, 6534, 6534, 6534, 6521, 6521, 6535, 6535,
-     6535, 6535, 6535, 6535, 6535, 6535, 6535, 6538, 6536, 6536,
-     6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536,
-     6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536,
-     6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536,
-     6536, 6536, 6536, 6536,  323,  323,  323,  323,  323,  323,
-     6536, 6536, 6536, 6536, 6536, 6536, 6536, 6521, 6526, 6526,
-     6526, 6526, 6526, 6526, 6521, 6521, 6521, 6521, 6521, 6521,
-
-     6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521,
-     6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521,
-     6521, 6521, 6521, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6521, 6521, 6521, 6521, 6521, 6521, 6521, 6527, 6528, 6528,
-     6528, 6528, 6528, 6528, 6528, 6528, 6528, 6528, 6528, 6528,
-     6528, 6528, 6527, 6527, 6527, 6527, 6527, 6527, 6527, 6528,
-     6528, 6528, 6528, 6528, 6528, 6528, 6528, 6528, 6528, 6528,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6529, 6529, 6529, 6521, 6529, 6529,
-
-     6529, 6529, 6529, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6530, 6531, 6531, 6531, 6531, 6531, 6531, 6531, 6530, 6530,
-
-     6530, 6530, 6530, 6530, 6530, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6534, 6534, 6534, 6534, 6534, 6534,
-     6534, 6534, 6534, 6535, 6535, 6535, 6535, 6535, 6535, 6535,
-     6535, 6535, 6535, 6536, 6536, 6536, 6536, 6536, 6536, 6536,
-
-     6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536,
-     6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536,
-     6536, 6536,  323,  323,  323,  323,  323,  323,  323, 6536,
-     6536, 6536, 6536, 6536, 6536, 6536, 6526, 6526, 6526, 6526,
-     6526, 6526, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521,
-     6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521,
-     6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521,
-     6521, 6521, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6521,
-     6521, 6521, 6521, 6521, 6521, 6521, 6521, 6527, 6528, 6528,
-     6528, 6528, 6528, 6528, 6528, 6528, 6528, 6528, 6528, 6528,
-
-     6528, 6527, 6527, 6527, 6527, 6527, 6527, 6527, 6527, 6528,
-     6528, 6528, 6528, 6528, 6528, 6528, 6528, 6528, 6528, 6528,
-     6528, 6528, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6529, 6529, 6529, 6529, 6529, 6529, 6529, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6530, 6531, 6531, 6531, 6531, 6531, 6531,
-     6531, 6530, 6530, 6530, 6530, 6530, 6530, 6530, 6530, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6534, 6534, 6534, 6534, 6534, 6534, 6534, 6535, 6535, 6535,
-     6535, 6535, 6535, 6535, 6535, 6536, 6536, 6536, 6536, 6536,
-     6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536,
-
-     6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536,
-     6536, 6536, 6536, 6536, 6536,  323,  323,  323,  323,  323,
-      323,  323, 6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536,
-     6526, 6526, 6526, 6526, 6526, 6521, 6521, 6521, 6521, 6521,
-     6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521,
-     6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6521, 6521,
-     6521, 6521, 6521, 6521, 6521, 6521, 6527, 6528, 6528, 6528,
-     6528, 6528, 6528, 6528, 6528, 6528, 6528, 6528, 6528, 6528,
-     6528, 6527, 6527, 6527, 6527, 6527, 6527, 6527, 6527, 6528,
-
-     6528, 6528, 6528, 6528, 6528, 6528, 6528, 6528, 6528, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6529, 6529, 6529,
-     6529, 6529, 6529, 6529, 6529, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6530,
-     6531, 6531, 6531, 6531, 6531, 6531, 6531, 6531, 6530, 6530,
-     6530, 6530, 6530, 6530, 6530, 6530, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6534, 6534, 6534, 6534,
-     6534, 6534, 6534, 6534, 6535, 6535, 6535, 6535, 6535, 6535,
-     6535, 6535, 6535, 6536, 6536, 6536, 6536, 6536, 6536, 6536,
-     6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536,
-     6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536,  323,  323,
-      323,  323,  323,  323,  323,  323, 6536, 6536, 6536, 6536,
-     6536, 6536, 6536, 6536, 6526, 6526, 6526, 6526, 6526, 6521,
-
-     6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521,
-     6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521,
-     6521, 6521, 6521, 6521, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521,
-     6521, 6527, 6528, 6528, 6528, 6528, 6528, 6528, 6528, 6528,
-     6528, 6528, 6528, 6528, 6527, 6527, 6527, 6527, 6527, 6527,
-     6527, 6527, 6527, 6528, 6528, 6528, 6528, 6528, 6528, 6528,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6529, 6529, 6529,
-     6529, 6529, 6529, 6529, 6529, 6526, 6526, 6526, 6526, 6526,
-
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6530, 6531, 6531, 6531, 6531, 6531, 6531, 6531, 6531,
-     6530, 6530, 6530, 6530, 6530, 6530, 6530, 6530, 6530, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6534, 6534, 6534, 6534, 6534, 6534, 6534, 6534, 6535,
-     6535, 6535, 6535, 6535, 6535, 6535, 6535, 6536, 6536, 6536,
-
-     6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536,
-     6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536,
-     6536, 6536,  323,  323,  323,  323,  323,  323,  323,  323,
-     6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536, 6526,
-     6526, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521,
-     6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521,
-     6521, 6521, 6521, 6521, 6521, 6521, 6521, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6521, 6521, 6521, 6521, 6521,
-     6521, 6521, 6521, 6521, 6527, 6528, 6528, 6528, 6528, 6528,
-     6528, 6528, 6528, 6528, 6528, 6527, 6527, 6527, 6527, 6527,
-
-     6527, 6527, 6527, 6527, 6528, 6528, 6528, 6528, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6529, 6529, 6529, 6529, 6529,
-     6529, 6529, 6529, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6530, 6531, 6531, 6531,
-     6531, 6531, 6531, 6531, 6531, 6530, 6530, 6530, 6530, 6530,
-
-     6530, 6530, 6530, 6530, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6534, 6534, 6534, 6534, 6534, 6534, 6534,
-     6534, 6535, 6535, 6535, 6535, 6535, 6535, 6535, 6535, 6536,
-     6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536,
-     6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536,
-     6536, 6536, 6536, 6536, 6536,  323,  323,  323,  323,  323,
-      323,  323,  323, 6536, 6536, 6536, 6536, 6536, 6536, 6536,
-     6536, 6536, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521,
-     6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521,
-     6521, 6521, 6521, 6521, 6521, 6526, 6526, 6526, 6526, 6526,
-
-     6526, 6526, 6526, 6521, 6521, 6521, 6521, 6521, 6521, 6521,
-     6521, 6521, 6527, 6528, 6528, 6528, 6528, 6528, 6528, 6528,
-     6528, 6527, 6527, 6527, 6527, 6527, 6527, 6527, 6527, 6527,
-     6528, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6529, 6529,
-     6529, 6529, 6529, 6529, 6529, 6529, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6530, 6531, 6531, 6531, 6531, 6531, 6531, 6531, 6531, 6530,
-     6530, 6530, 6530, 6530, 6530, 6530, 6530, 6530, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6534, 6534, 6534,
-     6534, 6534, 6534, 6534, 6534, 6535, 6535, 6535, 6535, 6535,
-     6535, 6535, 6535, 6536, 6536, 6536, 6536, 6536, 6536, 6536,
-     6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536,
-     6536, 6536, 6536, 6536, 6536, 6536,  323,  323,  323,  323,
-      323,  323,  323,  323, 6536, 6536, 6536, 6536, 6536, 6536,
-     6536, 6536, 6536, 6521, 6521, 6521, 6521, 6521, 6521, 6521,
-
-     6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521,
-     6521, 6521, 6521, 6521, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521,
-     6521, 6527, 6528, 6528, 6528, 6528, 6528, 6528, 6528, 6528,
-     6527, 6527, 6527, 6527, 6527, 6527, 6527, 6527, 6527, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6529, 6529,
-     6529, 6529, 6529, 6529, 6529, 6529, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6530, 6531, 6531, 6531, 6531, 6531, 6531, 6531,
-     6531, 6530, 6530, 6530, 6530, 6530, 6530, 6530, 6530, 6530,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6534, 6534, 6534, 6534, 6534, 6534, 6534, 6534, 6535,
-     6535, 6535, 6535, 6535, 6535, 6535, 6535, 6536, 6536, 6536,
-     6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536,
-     6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536,  323,  323,
-
-      323,  323,  323,  323,  323,  323, 6536, 6536, 6536, 6536,
-     6536, 6536, 6536, 6536, 6536, 6521, 6521, 6521, 6521, 6521,
-     6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521,
-     6521, 6521, 6521, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521,
-     6527, 6528, 6528, 6528, 6528, 6528, 6528, 6528, 6528, 6527,
-     6527, 6527, 6527, 6527, 6527, 6527, 6527, 6527, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6529, 6529, 6529, 6529,
-     6529, 6529, 6529, 6529, 6526, 6526, 6526, 6526, 6526, 6526,
-
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6530, 6531, 6531, 6531, 6531, 6531, 6531, 6531, 6531, 6530,
-     6530, 6530, 6530, 6530, 6530, 6530, 6530, 6530, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6534, 6534, 6534, 6534, 6534, 6534, 6534, 6534,
-     6535, 6535, 6535, 6535, 6535, 6535, 6535, 6535, 6536, 6536,
-
-     6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536,
-     6536, 6536, 6536, 6536, 6536, 6536,  323,  323,  323,  323,
-      323,  323,  323,  323, 6536, 6536, 6536, 6536, 6536, 6536,
-     6536, 6536, 6536, 6521, 6521, 6521, 6521, 6521, 6521, 6521,
-     6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6521, 6521, 6521,
-     6521, 6521, 6521, 6521, 6521, 6521, 6527, 6528, 6528, 6528,
-     6528, 6528, 6528, 6528, 6528, 6527, 6527, 6527, 6527, 6527,
-     6527, 6527, 6527, 6527, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-
-     6526, 6526, 6529, 6529, 6529, 6529, 6529, 6529, 6529, 6529,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6530, 6531, 6531, 6531,
-     6531, 6531, 6531, 6531, 6531, 6530, 6530, 6530, 6530, 6530,
-     6530, 6530, 6530, 6530, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6534, 6534, 6534, 6534, 6534, 6534, 6534,
-
-     6534, 6535, 6535, 6535, 6535, 6535, 6535, 6535, 6535, 6536,
-     6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536,
-     6536, 6536, 6536, 6536, 6536,  323,  323,  323,  323,  323,
-      323,  323,  323, 6536, 6536, 6536, 6536, 6536, 6536, 6536,
-     6536, 6536, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521,
-     6521, 6521, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6528,
-     6528, 6528, 6528, 6528, 6528, 6528, 6528, 6527, 6527, 6527,
-     6527, 6527, 6527, 6527, 6527, 6527, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-
-     6526, 6526, 6526, 6526, 6529, 6529, 6529, 6529, 6529, 6529,
-     6529, 6529, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6531,
-     6531, 6531, 6531, 6531, 6531, 6531, 6531, 6530, 6530, 6530,
-     6530, 6530, 6530, 6530, 6530, 6530, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6534, 6534, 6534, 6534, 6534, 6534, 6534, 6534,
-
-     6535, 6535, 6535, 6535, 6535, 6535, 6535, 6535, 6536, 6536,
-     6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536,  323,  323,
-      323,  323,  323,  323,  323,  323, 6536, 6536, 6536, 6536,
-     6536, 6536, 6536, 6536, 6536, 6521, 6521, 6521, 6521, 6521,
-     6521, 6521, 6521, 6521, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6528,
-     6528, 6528, 6528, 6528, 6528, 6528, 6527, 6527, 6527, 6527,
-     6527, 6527, 6527, 6527, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6529, 6529, 6529, 6529, 6529, 6529, 6529,
-
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6531, 6531, 6531, 6531, 6531,
-     6531, 6531, 6530, 6530, 6530, 6530, 6530, 6530, 6530, 6530,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6534, 6534, 6534, 6534, 6534,
-     6534, 6534, 6535, 6535, 6535, 6535, 6535, 6535, 6535, 6536,
-     6536, 6536, 6536, 6536, 6536, 6536, 6536, 6536,  323,  323,
-
-      323,  323,  323,  323,  323, 6536, 6536, 6536, 6536, 6536,
-     6536, 6536, 6536, 6521, 6521, 6521, 6521, 6521, 6521, 6521,
-     6521, 6521, 6521, 6526, 6526, 6526, 6526, 6526, 6526, 6521,
-     6521, 6521, 6521, 6521, 6521, 6521, 6528, 6528, 6528, 6528,
-     6528, 6528, 6527, 6527, 6527, 6527, 6527, 6527, 6527, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6529, 6529, 6529,
-     6529, 6529, 6529, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6531, 6531, 6531, 6531, 6531, 6531, 6530, 6530, 6530,
-     6530, 6530, 6530, 6530, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6534, 6534, 6534, 6534, 6534, 6534,
-     6535, 6535, 6535, 6535, 6535, 6535, 6536, 6536, 6536, 6536,
-     6536, 6536, 6536, 6536, 6536, 6536,  323,  323,  323,  323,
-      323,  323, 6536, 6536, 6536, 6536, 6536, 6536, 6536, 6521,
-     6521, 6521, 6521, 6526, 6526, 6521, 6521, 6521, 6521, 6521,
-     6521, 6528, 6528, 6527, 6527, 6527, 6527, 6527, 6527, 6526,
-
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6529, 6529, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6531, 6531, 6530, 6530, 6530,
-     6530, 6530, 6530, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6534, 6534, 6535,
-     6535, 6536, 6536, 6536, 6536,  323,  323, 6536, 6536, 6536,
-     6536, 6536, 6536, 6521, 6521, 6521, 6527, 6527, 6526, 6526,
-
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6530, 6530,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6536, 6536, 6536, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-     6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526, 6526,
-        0, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521,
-     6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521
+     6094,   51, 6098, 6098,    2,    2, 6094, 6094, 6094, 6094,
+     6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6099, 6099,
+     6099, 6099, 6099, 6094, 6094, 6094, 6094, 6100, 6094, 6094,
+     6094,   63, 6100, 6100, 6100, 6094, 6094, 6094, 6101, 6101,
+     6101, 6101, 6101, 6100, 6101, 6101, 6101, 6101, 6101, 6101,
+
+     6101, 6101, 6101, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6094, 6094,   63, 6094, 6094,
+     6102, 6102, 6102, 6102, 6102, 6102, 6102, 6094, 6094,   63,
+     6094, 6094, 6103, 6103, 6103, 6103, 6103, 6103, 6103, 6103,
+     6103, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6104, 6104, 6104, 6104, 6105, 6105, 6105, 6105,
+     6105, 6104, 6094, 6094,   63, 6094, 6094, 6094, 6094, 6106,
+     6106, 6106, 6106, 6106, 6106, 6106, 6106, 6106, 6106, 6094,
+
+     6094, 6107, 6094, 6108, 6094, 6094,   63, 6094, 6094, 6094,
+     6094, 6094, 6099, 6099, 6099, 6099, 6099, 6094, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6094,
+     6094,   63, 6094, 6094, 6094, 6094, 6094, 6109, 6109, 6109,
+     6109, 6109, 6109, 6109, 6109, 6109, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6094, 6094,   63, 6094, 6094, 6110, 6110, 6110, 6110, 6110,
+
+     6110, 6110, 6110, 6111, 6111, 6094, 6111, 6111, 6111, 6111,
+     6111, 6111, 6111, 6111, 6111, 6112, 6112,  317,  317,  317,
+     6111, 6094, 6094, 6099, 6099, 6099, 6099, 6094, 6094, 6094,
+     6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094,
+     6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094,
+     6094, 6094, 6094, 6099, 6099, 6099, 6099, 6099, 6099, 6094,
+     6094, 6094, 6094, 6094, 6100, 6100, 6100, 6100, 6101, 6101,
+     6101, 6101, 6101, 6101, 6100, 6100, 6100, 6100, 6100, 6101,
+     6101, 6101, 6101, 6101, 6101, 6101, 6101, 6101, 6101, 6101,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6094, 6094, 6094, 6094, 6102,
+     6102, 6102, 6102, 6102, 6102, 6102, 6102, 6094, 6094, 6094,
+     6094, 6103, 6103, 6103, 6103, 6103, 6103, 6103, 6103, 6103,
+     6103, 6103, 6103, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6104, 6104, 6104, 6104,
+     6105, 6105, 6105, 6105, 6105, 6105, 6104, 6104, 6104, 6104,
+     6104, 6094, 6094, 6094, 6094, 6106, 6106, 6106, 6106, 6106,
+     6106, 6106, 6106, 6106, 6106, 6106, 6106, 6094, 6094, 6094,
+     6094, 6094, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6094, 6094, 6094, 6094, 6094, 6109,
+     6109, 6109, 6109, 6109, 6109, 6109, 6109, 6109, 6109, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6094,
+     6094, 6094, 6094, 6110, 6110, 6110, 6110, 6110, 6110, 6110,
+     6110, 6110, 6111, 6094, 6111, 6111, 6111, 6094, 6111, 6111,
+     6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111,
+     6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111,
+     6111,  317,  317,  317,  317,  317,  317, 6111, 6111, 6111,
+     6111, 6111, 6094, 6099, 6099, 6099, 6099, 6099, 6094, 6094,
+     6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094,
+     6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094,
+
+     6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094,
+     6094, 6094, 6094, 6094, 6099, 6099, 6099, 6099, 6099, 6094,
+     6094, 6094, 6094, 6094, 6094, 6100, 6100, 6101, 6101, 6101,
+     6101, 6101, 6100, 6100, 6100, 6100, 6100, 6100, 6101, 6101,
+     6101, 6101, 6101, 6101, 6101, 6101, 6101, 6101, 6101, 6101,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+
+     6099, 6099, 6099, 6099, 6099, 6094, 6094, 6102, 6102, 6102,
+     6102, 6102, 6102, 6102, 6094, 6094, 6103, 6103, 6103, 6103,
+     6103, 6103, 6103, 6103, 6103, 6103, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6104, 6104, 6105, 6105, 6105,
+     6105, 6105, 6104, 6104, 6104, 6104, 6104, 6104, 6094, 6094,
+     6106, 6106, 6106, 6106, 6106, 6106, 6106, 6106, 6106, 6094,
+     6094, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6094, 6094, 6109,
+
+     6109, 6109, 6109, 6109, 6109, 6109, 6109, 6109, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6094, 6094, 6110, 6110, 6110, 6110, 6110,
+
+     6110, 6110, 6110, 6111, 6111, 6111, 6111, 6111, 6111, 6111,
+     6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111,
+     6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111,
+     6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111,  317,
+      317,  317,  317,  317, 6111, 6111, 6111, 6111, 6111, 6111,
+     6094, 6099, 6099, 6099, 6099, 6099, 6094, 6094, 6094, 6094,
+     6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094,
+     6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094,
+     6094, 6094, 6094, 6094, 6094, 6094, 6094, 6099, 6099, 6099,
+     6099, 6099, 6099, 6094, 6094, 6094, 6094, 6094, 6094, 6100,
+
+     6101, 6101, 6101, 6101, 6101, 6101, 6100, 6100, 6100, 6100,
+     6100, 6100, 6101, 6101, 6101, 6101, 6101, 6101, 6101, 6101,
+     6101, 6101, 6101, 6101, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6102, 6102, 6102, 6094, 6102,
+     6102, 6102, 6102, 6103, 6103, 6103, 6103, 6103, 6103, 6103,
+     6103, 6103, 6103, 6103, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6104, 6105, 6105, 6105, 6105,
+     6105, 6105, 6104, 6104, 6104, 6104, 6104, 6104, 6106, 6106,
+     6106, 6106, 6106, 6106, 6106, 6106, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6109, 6109, 6109, 6109, 6109, 6109,
+     6109, 6109, 6109, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6110, 6110, 6110, 6110, 6110, 6110, 6110, 6110, 6110, 6111,
+     6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111,
+     6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111,
+     6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111,
+      317,  317,  317,  317,  317,  317, 6111, 6111, 6111, 6111,
+     6111, 6111, 6099, 6099, 6099, 6099, 6099, 6094, 6094, 6094,
+     6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094,
+     6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094,
+
+     6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094,
+     6094, 6094, 6094, 6094, 6099, 6099, 6099, 6099, 6099, 6099,
+     6094, 6094, 6094, 6094, 6094, 6094, 6094, 6100, 6101, 6101,
+     6101, 6101, 6101, 6101, 6100, 6100, 6100, 6100, 6100, 6100,
+     6100, 6101, 6101, 6101, 6101, 6101, 6101, 6101, 6101, 6101,
+     6101, 6101, 6101, 6101, 6101, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6102, 6102, 6102, 6102, 6102, 6102, 6103, 6103, 6103, 6103,
+
+     6103, 6103, 6103, 6103, 6103, 6103, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6104, 6105, 6105, 6105,
+     6105, 6105, 6105, 6104, 6104, 6104, 6104, 6104, 6104, 6104,
+     6106, 6106, 6106, 6106, 6106, 6106, 6106, 6099, 6099, 6099,
+
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6109, 6109, 6109, 6109,
+     6109, 6109, 6109, 6109, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6110, 6110, 6110, 6110, 6110, 6110,
+     6110, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111,
+     6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111,
+     6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111,
+     6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111,  317,  317,
+      317,  317,  317,  317, 6111, 6111, 6111, 6111, 6111, 6111,
+     6111, 6099, 6099, 6099, 6099, 6099, 6094, 6094, 6094, 6094,
+     6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094,
+     6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094,
+
+     6094, 6094, 6094, 6099, 6099, 6099, 6099, 6099, 6099, 6094,
+     6094, 6094, 6094, 6094, 6094, 6094, 6100, 6101, 6101, 6101,
+     6101, 6101, 6101, 6100, 6100, 6100, 6100, 6100, 6100, 6100,
+     6101, 6101, 6101, 6101, 6101, 6101, 6101, 6101, 6101, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6102, 6102, 6102, 6102, 6102, 6102, 6103, 6103,
+     6103, 6103, 6103, 6103, 6103, 6103, 6103, 6103, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6104, 6105, 6105, 6105,
+     6105, 6105, 6105, 6104, 6104, 6104, 6104, 6104, 6104, 6104,
+     6106, 6106, 6106, 6106, 6106, 6106, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+
+     6099, 6099, 6099, 6099, 6099, 6099, 6109, 6109, 6109, 6109,
+     6109, 6109, 6109, 6109, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6110, 6110, 6110, 6110, 6110, 6110, 6110, 6111,
+     6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111,
+     6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111,
+
+     6111, 6111, 6111, 6111, 6111, 6111,  317,  317,  317,  317,
+      317,  317, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6099,
+     6099, 6099, 6099, 6094, 6094, 6094, 6094, 6094, 6094, 6094,
+     6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094,
+     6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094,
+     6094, 6094, 6094, 6099, 6099, 6099, 6099, 6099, 6099, 6094,
+     6094, 6094, 6094, 6094, 6094, 6094, 6100, 6101, 6101, 6101,
+     6101, 6101, 6101, 6100, 6100, 6100, 6100, 6100, 6100, 6100,
+     6101, 6101, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6102, 6102, 6102, 6102, 6102, 6102, 6103, 6103, 6103, 6103,
+     6103, 6103, 6103, 6103, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6104, 6105, 6105, 6105, 6105, 6105,
+     6105, 6104, 6104, 6104, 6104, 6104, 6104, 6104, 6106, 6106,
+
+     6106, 6106, 6106, 6106, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6109, 6109, 6109, 6109, 6109, 6109,
+     6109, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6110, 6110, 6110, 6110, 6110,
+
+     6110, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111,
+     6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111,
+     6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111,
+     6111,  317,  317,  317,  317,  317,  317, 6111, 6111, 6111,
+     6111, 6111, 6111, 6111, 6094, 6094, 6094, 6094, 6094, 6094,
+     6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094,
+     6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6099, 6099,
+     6099, 6099, 6099, 6099, 6094, 6094, 6094, 6094, 6094, 6094,
+     6094, 6100, 6101, 6101, 6101, 6101, 6101, 6101, 6100, 6100,
+     6100, 6100, 6100, 6100, 6100, 6101, 6099, 6099, 6099, 6099,
+
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6102, 6102, 6102, 6102,
+     6102, 6102, 6103, 6103, 6103, 6103, 6103, 6103, 6094, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6104, 6105, 6105, 6105, 6105, 6105,
+
+     6105, 6104, 6104, 6104, 6104, 6104, 6104, 6104, 6106, 6106,
+     6106, 6106, 6106, 6106, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6109, 6109, 6109, 6109, 6109, 6109,
+     6109, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+
+     6110, 6110, 6110, 6110, 6110, 6110, 6111, 6111, 6111, 6111,
+     6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111,
+     6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111,
+      317,  317,  317,  317,  317,  317, 6111, 6111, 6111, 6111,
+     6111, 6111, 6111, 6094, 6094, 6094, 6094, 6094, 6094, 6094,
+     6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094,
+     6094, 6094, 6094, 6094, 6094, 6094, 6099, 6099, 6099, 6099,
+     6099, 6099, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6100,
+     6101, 6101, 6101, 6101, 6101, 6101, 6100, 6100, 6100, 6100,
+     6100, 6100, 6100, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6102, 6102, 6102, 6102, 6102, 6102,
+     6103, 6103, 6103, 6103, 6103, 6103, 6094, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6104, 6105, 6105, 6105, 6105, 6105, 6105,
+
+     6104, 6104, 6104, 6104, 6104, 6104, 6104, 6106, 6106, 6106,
+     6106, 6106, 6106, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6109, 6109, 6109, 6109, 6109, 6109, 6109,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6110,
+
+     6110, 6110, 6110, 6110, 6110, 6111, 6111, 6111, 6111, 6111,
+     6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111,
+     6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111,  317,  317,
+      317,  317,  317,  317, 6111, 6111, 6111, 6111, 6111, 6111,
+     6111, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094,
+     6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094,
+     6094, 6094, 6099, 6099, 6099, 6099, 6099, 6099, 6094, 6094,
+     6094, 6094, 6094, 6094, 6094, 6100, 6101, 6101, 6101, 6101,
+     6101, 6101, 6100, 6100, 6100, 6100, 6100, 6100, 6100, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6102, 6102, 6102, 6102, 6102, 6102, 6103, 6103,
+     6103, 6103, 6103, 6103, 6094, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6104, 6105, 6105, 6105, 6105, 6105, 6105, 6104, 6104, 6104,
+
+     6104, 6104, 6104, 6104, 6106, 6106, 6106, 6106, 6106, 6106,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6109, 6109, 6109, 6109, 6109, 6109, 6109, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6110, 6110, 6110,
+
+     6110, 6110, 6110, 6111, 6111, 6111, 6111, 6111, 6111, 6111,
+     6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111,
+     6111, 6111, 6111, 6111,  317,  317,  317,  317,  317,  317,
+     6111, 6111, 6111, 6111, 6111, 6111, 6111, 6094, 6094, 6094,
+     6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094,
+     6094, 6094, 6094, 6094, 6094, 6094, 6094, 6099, 6099, 6099,
+     6099, 6099, 6099, 6094, 6094, 6094, 6094, 6094, 6094, 6094,
+     6100, 6101, 6101, 6101, 6101, 6101, 6101, 6100, 6100, 6100,
+     6100, 6100, 6100, 6100, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6102, 6102, 6102, 6102,
+     6102, 6102, 6103, 6103, 6103, 6103, 6103, 6103, 6094, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6104, 6105, 6105, 6105, 6105, 6105, 6105,
+     6104, 6104, 6104, 6104, 6104, 6104, 6104, 6106, 6106, 6106,
+
+     6106, 6106, 6106, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6109, 6109, 6109, 6109,
+     6109, 6109, 6109, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6110, 6110, 6110, 6110, 6110, 6110, 6111, 6111, 6111,
+
+     6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111,
+     6111, 6111, 6111, 6111, 6111, 6111, 6111,  317,  317,  317,
+      317,  317,  317, 6111, 6111, 6111, 6111, 6111, 6111, 6111,
+     6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094,
+     6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094,
+     6094, 6099, 6099, 6099, 6099, 6099, 6099, 6094, 6094, 6094,
+     6094, 6094, 6094, 6094, 6100, 6101, 6101, 6101, 6101, 6101,
+     6101, 6100, 6100, 6100, 6100, 6100, 6100, 6100, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6102,
+     6102, 6102, 6102, 6102, 6102, 6103, 6103, 6103, 6103, 6103,
+     6103, 6094, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6104, 6105, 6105, 6105, 6105,
+     6105, 6105, 6104, 6104, 6104, 6104, 6104, 6104, 6104, 6106,
+     6106, 6106, 6106, 6106, 6106, 6099, 6099, 6099, 6099, 6099,
+
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6109, 6109,
+     6109, 6109, 6109, 6109, 6109, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6110,
+     6110, 6110, 6110, 6110, 6110, 6111, 6111, 6111, 6111, 6111,
+     6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111,
+
+     6111, 6111, 6111, 6111, 6111, 6111,  317,  317,  317,  317,
+      317,  317, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6094,
+     6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094,
+     6094, 6094, 6099, 6099, 6099, 6099, 6099, 6099, 6094, 6094,
+     6094, 6094, 6094, 6094, 6094, 6101, 6101, 6101, 6101, 6101,
+     6101, 6100, 6100, 6100, 6100, 6100, 6100, 6100, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6102,
+     6102, 6102, 6102, 6102, 6102, 6103, 6103, 6103, 6103, 6103,
+
+     6103, 6094, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6105, 6105, 6105, 6105, 6105, 6105,
+     6104, 6104, 6104, 6104, 6104, 6104, 6104, 6106, 6106, 6106,
+     6106, 6106, 6106, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+
+     6099, 6099, 6099, 6099, 6099, 6099, 6109, 6109, 6109, 6109,
+     6109, 6109, 6109, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6110, 6110, 6110, 6110, 6110, 6110,
+     6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111,
+     6111, 6111, 6111,  317,  317,  317,  317,  317,  317, 6111,
+     6111, 6111, 6111, 6111, 6111, 6111, 6094, 6094, 6094, 6094,
+     6094, 6094, 6094, 6094, 6094, 6094, 6094, 6099, 6099, 6099,
+
+     6099, 6099, 6099, 6094, 6094, 6094, 6094, 6094, 6094, 6101,
+     6101, 6101, 6101, 6101, 6101, 6100, 6100, 6100, 6100, 6100,
+     6100, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6102, 6102, 6102, 6102, 6102, 6102, 6103, 6103,
+     6103, 6103, 6103, 6103, 6094, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6105, 6105, 6105, 6105,
+     6105, 6105, 6104, 6104, 6104, 6104, 6104, 6104, 6106, 6106,
+     6106, 6106, 6106, 6106, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6109, 6109, 6109, 6109,
+     6109, 6109, 6109, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6110, 6110, 6110, 6110, 6110, 6110,
+     6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111,
+     6111,  317,  317,  317,  317,  317,  317, 6111, 6111, 6111,
+     6111, 6111, 6111, 6094, 6094, 6094, 6094, 6094, 6094, 6094,
+     6094, 6094, 6094, 6094, 6099, 6099, 6099, 6099, 6099, 6094,
+     6094, 6094, 6094, 6094, 6094, 6101, 6101, 6101, 6101, 6101,
+     6100, 6100, 6100, 6100, 6100, 6100, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+
+     6099, 6099, 6099, 6099, 6099, 6102, 6102, 6102, 6102, 6102,
+     6103, 6103, 6103, 6103, 6103, 6094, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6105, 6105, 6105, 6105, 6105, 6104, 6104, 6104, 6104,
+     6104, 6104, 6106, 6106, 6106, 6106, 6106, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6109, 6109, 6109,
+     6109, 6109, 6109, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6110, 6110, 6110, 6110, 6110, 6111, 6111,
+     6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111,  317,
+      317,  317,  317,  317, 6111, 6111, 6111, 6111, 6111, 6111,
+     6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094,
+
+     6100, 6100, 6100, 6100, 6100, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6104, 6104, 6104, 6104,
+     6104, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6109, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6111,
+     6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6111, 6094,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6111, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099, 6099,
+     6099, 6099, 6099,    0, 6094, 6094, 6094, 6094, 6094, 6094,
+
+     6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094,
+     6094, 6094
     } ;
 
-static yyconst flex_int16_t yy_nxt[9887] =
+static yyconst flex_int16_t yy_nxt[9126] =
     {   0,
-       64,   65,   65,   64,   66,   64,   67,   68,   64,   69,
-       64,   64,   70,   70,   70,   70,   71,   70,   70,   70,
-       72,   73,   74,  367,  535,   76,  367,  376, 6521, 6521,
-      810,   77,  376,  376,  376,  811,  773,  368,   78,  451,
-      368,   79,   80,  536,  454,  536,  767,   81,  114,  115,
-      116,  421,  117,  122,  123,  114,  115,  116,  118,  117,
-      119,  120,  419,  121,  451,  118,  422,  119,  120,  454,
-      121,  124,  125,  420,   64,   64,   65,   65,   64,   66,
-       64,   67,   68,   64,   69,   64,   64,   70,   70,   70,
-       70,   71,   70,   70,   70,   72,   73,   74,  126,  255,
-
-       76,  122,  123,  376,  126,  256,   77,  442,  376,  376,
-      376,  257, 1547,   78,  258,  127,   79,   80,  155,  124,
-      125,  127,   81,  443,  155,  156,  214,  214,  157,  158,
-      159,  156,  410,  423,  157,  158,  159,  215,  215,  424,
-      411,  216,  216,  217,  217,  218,  218,  406, 1548,   64,
-       82,   83,   84,   82,   85,   82,   86,   87,   88,   89,
-       90,   90,   91,   91,   91,   91,   92,   91,   91,   91,
-       93,   94,   95,   96,   96,   97,   96,   96,   96,   96,
-       96,   98,   96,   96,   96,   96,   96,   96,   99,   96,
-       96,  100,  101,   96,   96,   96,   96,  102,  103,   96,
-
-       96,  104,  105,  106,  107,   96,  108,   96,   96,   96,
-      109,  110,   96,  111,   96,   96,  112,  113,   96,   96,
-       96,   96,   96,   96,   82,   64,   65,  128,   64,   66,
-       64,   67,  129,   64,  130,   64,   64,  131,  131,  131,
-      131,  132,  131,  131,  131,   72,   73,   74,  133,  133,
-      134,  133,  133,  133,  133,  133,  135,  133,  133,  133,
-      133,  136,  133,  137,  133,  133,  138,  139,  133,  133,
-      133,  133,   81,  133,  133,  133,  133,  133,  133,  133,
-      133,  133,  133,  133,  133,  133,  136,  133,  133,  133,
-      133,  140,  133,  133,  133,  133,  133,  133,  133,   64,
-
-      141,  142,  143,  428,  144,  145,  146,  147,  412,  436,
-      148,  149,  150,  429,  459,  151,  152,  153,  154,  141,
-      142,  143,  413,  144,  145,  146,  147,  437,  550,  148,
-      149,  150,  460,  551,  151,  152,  153,  154,   64,   65,
-       65,   64,  160,   64,   67,   68,   64,   69,  161,  161,
-      162,  162,  162,  162,  163,  162,  162,  162,   72,   73,
-       74, 1549,  219,  165,  220,  274,  221,  275,  440,  166,
-      474,  219,  222,  220,  441,  221,  167,  276,  223,  168,
-      169,  222,  475,  224,  225,  170,  438,  223,  226,  439,
-      227,  239,  240,  228,  241,  229,  230,  234,  231,  468,
-
-      232,  233,  242,  235,  236,  237,  469,  457,  243,  238,
-      458, 1550,   64,   64,   65,   65,   64,  160,   64,   67,
-       68,   64,   69,  161,  161,  162,  162,  162,  162,  163,
-      162,  162,  162,   72,   73,   74,  466,  467,  165,  239,
-      240,  510,  241,  511,  166,  548,  274,  549,  275,  425,
-      242,  167,  224,  225,  168,  169,  243,  226,  276,  227,
-      170,  426,  228,  427,  229,  230,  234,  231,  546,  232,
-      233,  255,  235,  236,  237,  492,  414,  256,  238,  415,
-      547, 1551,  416,  257,  417,  493,  258,   64,  171,  172,
-       65,  171,  173,  171,  174,  175,  171,  176,  171,  171,
-
-      177,  177,  177,  177,  178,  177,  177,  177,  179,  180,
-      181,  182,  182,  183,  182,  182,  184,  182,  182,  185,
-      182,  182,  182,  182,  186,  187,  188,  182,  182,  189,
-      190,  182,  182,  182,  191,  192,  182,  182,  182,  182,
-      182,  184,  182,  182,  182,  182,  182,  182,  182,  186,
-      187,  182,  182,  182,  182,  193,  182,  182,  182,  182,
-      191,  182,  171,  194,  195,   65,  196,  197,  198,  199,
-      200,  194,  201,  194,  194,  202,  202,  202,  202,  203,
-      202,  202,  202,  204,  205,  206,  376,  472,  208,  490,
-      473,  376,  376,  376,  209,  557,  244,  245,  246,  585,
-
-      247,  210,  248,  558,  211,  212,  249,  491,  250,  251,
-      213,  504,  586,  252,  253,  259,  254,  260,  261,  262,
-      263,  264,  494, 1552,  505,  572,  506,  265,  266,  267,
-      495,  573,  268,  496,  404,  625,  626,  194,  194,  195,
-       65,  196,  197,  198,  199,  200,  194,  201,  194,  194,
-      202,  202,  202,  202,  203,  202,  202,  202,  204,  205,
-      206,  376,  529,  208,  367,  561,  376,  376,  376,  209,
-     1553,  244,  245,  246,  562,  247,  210,  248,  368,  211,
-      212,  249,  542,  250,  251,  213,  530,  529,  252,  253,
-      259,  254,  260,  261,  262,  263,  264,  497,  507,  498,
-
-      543,  270,  265,  266,  267,  271,  270,  268,  272,  955,
-      271,  530,  194,  272,  499,  273,  508,  509,  956,  405,
-      273,   64,  277,   65,   64,   66,   64,   67,  278,   64,
-      279,   64,   64,  280,  280,  280,  280,  281,  280,  280,
-      280,   72,   73,  282,  283,  283,  284,  283,  283,  283,
-      283,  283,  285,  283,  283,  283,  283,  283,  283,  286,
-      283,  283,  287,  288,  283,  283,  283,  283,   81,  283,
-      283,  283,  283,  283,  283,  283,  283,  283,  283,  283,
-      283,  283,  289,  283,  283,  283,  283,  290,  283,  283,
-      283,  291,  283,  283,  283,   64,   64,   65,  292,   64,
-
-       66,   64,   67,  293,   64,  294,   64,   64,  295,  295,
-      295,  295,  296,  295,  295,  295,   72,   73,   74,  297,
-      297,  298,  297,  297,  297,  297,  297,  299,  297,  297,
-      297,  297,  297,  297,  300,  297,  297,  301,  302,  297,
-      297,  297,  297,   81,  297,  297,  297,  297,  297,  297,
-      297,  297,  297,  297,  297,  297,  297,  303,  297,  297,
-      297,  297,  304,  305,  297,  297,  297,  297,  297,  297,
-       64,  306,  738,  544,  376,  540,  545,  559,  307,  376,
-      376,  376,  308,  308,  308,  308,  309,  308,  308,  308,
-      306,  541,  560,  376,  658,  659, 1248,  307,  376,  376,
-
-      376,  308,  308,  308,  308,  309,  308,  308,  308,  310,
-      311,  312,  310,  313,  310,  314,  315,  310,  316,  310,
-      310,  317,  317,  317,  317,  318,  317,  317,  317,  319,
-      320,  321,  581,  593,  323,  587,  402,  476,  477,  399,
-      324,  534,  588, 1554,  594,  478,  582,  325,  479,  583,
-      326,  327,  584,  480,  481,  482,  328,  337,  337,  337,
-      337,  337,  337,  337,  337,  360,  534,  361,  361,  361,
-      361,  361,  361,  361,  361,  337,  337,  337,  337,  337,
-      337,  337,  337,  310,  310,  311,  312,  310,  313,  310,
-      314,  315,  310,  316,  310,  310,  317,  317,  317,  317,
-
-      318,  317,  317,  317,  319,  320,  321,  600,  329,  323,
-      692,  376,  693,  329,  376,  324,  376,  376,  376,  376,
-      376,  376,  325,  330,  601,  326,  327,  453,  330,  454,
-      360,  328,  361,  361,  361,  361,  361,  362,  361,  361,
-      377,  455,  378,  378,  378,  378,  378,  378,  378,  378,
-      609,  500,  369, 1555,  454,  331,  563,  610,  310,  400,
-      331,  533,  392,  332,  501,  533,  502,  503,  332,  570,
-      333,  564,  401,  334,  335,  333,  909,  376,  334,  335,
-      338,  338,  376,  376,  376,  653,  533,  571,  339,  654,
-      533,  337,  337,  337,  337,  337,  337,  337,  337,  665,
-
-      623,  909,  340,  624,  341,  342,  343,  344,  345,  346,
-      381,  666,  347,  348,  349,  350,  351,  352,  512,  621,
-      353,  606,  370,  512,  512,  512,  622, 1556,  354,  607,
-      590,  371,  591,  608,  355,  627,  356,  372,  357,  611,
-      358,  628,  359,  612,  373,  592,  680,  374,  375,  377,
-      613,  378,  378,  378,  378,  378,  379,  378,  378,  376,
-      614,  681,  376,  640,  376,  376,  376,  376,  376,  376,
-      376, 1316,  393,  376,  641,  376,  376,  376,  376,  376,
-      376,  394, 1317,  384,  667,  668,  629,  395,  630,  387,
-      523,  631,  382,  671,  396,  376,  391,  397,  398,  524,
-
-      376,  376,  376,  388,  376,  525,  385,  672,  386,  376,
-      376,  376,  526,  376,  389,  527,  528,  383,  376,  376,
-      376,  392,  430,  431,  376,  669,  670,  512,  390,  376,
-      376,  376,  512,  512,  512,  432,  433,  714,  728,  434,
-      435,  444,  444,  444,  444,  444,  444,  444,  444,  638,
-      655,  715,  729,  684,  656,  639,  403,  408,  461,  409,
-      517,  682,  407,  685,  771,  770,  683, 1557,  389,  444,
-      444,  444,  444,  444,  444,  444,  444,  767,  772,  936,
-      937,  445,  390,  446,  446,  446,  446,  446,  446,  446,
-      446,  445,  462,  446,  446,  446,  446,  446,  447,  446,
-
-      446,  463,  464,  695,  483,  686,  465,  484,  485,  552,
-      687,  789,  553, 1107,  738,  486,  554,  487,  790,  555,
-      488, 1108,  696,  513,  489,  514,  514,  514,  514,  514,
-      514,  514,  514,  513,  739,  514,  514,  514,  514,  514,
-      515,  514,  514,  512,  784,  912,  512, 1558,  512,  512,
-      512,  512,  512,  512,  512,  704,  370,  512,  785,  512,
-      512,  512,  512,  512,  512,  371,  634,  519,  635,  793,
-      912,  372,  705,  520,  636,  602,  518,  794,  373,  603,
-      522,  374,  375,  637,  795,  604,  605,  521,  337,  337,
-      337,  337,  337,  337,  337,  337,  360, 1168,  361,  361,
-
-      361,  361,  361,  361,  361,  361,  360, 1169,  361,  361,
-      361,  361,  361,  362,  361,  361,  531,  791,  797,  804,
-      792,  800,  805,  798,  532,  337,  337,  337,  337,  337,
-      337,  337,  337,  574,  877,  575,  802,  576,  878,  801,
-      577,  531,  803,  578,  933,  579,  580,  934,  360,  532,
-      361,  361,  361,  361,  361,  361,  361,  361,  360,  370,
-      361,  361,  361,  361,  361,  362,  361,  361,  371,  660,
-      661,  662, 1559,  565,  372,  566,  663,  833,  807,  567,
-      688,  373,  595,  568,  374,  375,  689,  812,  569,  596,
-      597,  834,  598,  615,  854,  599,  813,  616,  690,  808,
-
-      886,  617,  642,  643,  887,  814, 1560,  618,  855,  644,
-      619,  620,  916,  647,  645,  648,  959,  928,  646,  917,
-      967,  649,  650,  929,  673,  960,  651,  652,  674,  969,
-      675,  697,  676, 1076,  698,  970, 1561,  677,  699,  968,
-      376,  678,  679,  700,  701,  376,  376,  376, 1077,  702,
-      703,  706,  706,  706,  706,  706,  706,  706,  706,  706,
-      706,  706,  706,  706,  706,  706,  706,  707, 1562,  708,
-      708,  708,  708,  708,  708,  708,  708,  707,  738,  708,
-      708,  708,  708,  708,  709,  708,  708,  720,  720,  720,
-      720,  720,  720,  720,  720,  720,  720,  720,  720,  720,
-
-      720,  720,  720,  721, 1018,  722,  722,  722,  722,  722,
-      722,  722,  722,  721, 1015,  722,  722,  722,  722,  722,
-      723,  722,  722,  734, 1272, 1161,  376, 1001, 1016, 1018,
-      734,  376,  376,  376,  734,  734,  734,  734,  734,  734,
-      734,  734,  734,  535, 1002,  376, 1019, 1162, 1563,  734,
-      376,  376,  376,  734,  734,  734,  734,  734,  734,  734,
-      734,  734,  536, 1020,  536,  841,  948, 1149,  734,  949,
-      360, 1019,  735,  735,  735,  735,  735,  735,  735,  735,
-      734, 1039,  950,  840, 1150, 1021, 1564,  734, 1020,  360,
-      738,  735,  735,  735,  735,  735,  736,  735,  735, 1040,
-
-      740,  740,  740,  740,  740,  740,  740,  740,  741,  742,
-     1021,  952, 1063, 1565,  953, 1060,  743, 1064, 1566,  740,
-      740,  740,  740,  740,  740,  740,  740,  954, 1082, 1061,
-      744, 1083,  745,  746,  747,  748,  749,  750,  924,  925,
-      751,  752,  753,  754,  755,  756, 1109, 1066,  757,  926,
-     1099,  927,  376, 1067,  894, 1110,  758,  376,  376,  376,
-      895,  738,  759,  896,  760, 1100,  761, 1132,  762,  764,
-      763,  765,  765,  765,  765,  765,  765,  765,  765,  738,
-     1137, 1133, 1567,  838, 1138, 1185, 1186,  764, 1568,  765,
-      765,  765,  765,  765,  766,  765,  765,  737,  737,  738,
-
-      737,  737,  737,  737,  737,  737,  737,  737,  737,  738,
-     1195, 1196, 1197, 1154, 1203, 1204, 1569,  737,  737,  737,
-      961, 1155,  360,  774,  361,  361,  361,  361,  361,  780,
-      361,  361,  775,  962, 1143,  376,  738, 1210,  776, 1211,
-      376,  376,  376,  963, 1279,  777, 1144,  767,  778,  779,
-      337,  337,  337,  337,  337,  337,  337,  337,  338,  338,
-     1275, 1251,  767,  376, 1276,  767,  788,  839,  376,  376,
-      376,  737,  737,  737,  738,  737,  737,  737,  737,  737,
-      737,  737,  737,  737,  821,  821,  821,  821,  821,  821,
-      821,  821,  737,  737,  737,  360, 1170,  361,  361,  361,
-
-      361,  361,  361,  361,  361, 1171,  354,  859, 1199,  768,
-      738, 1570,  355,  738,  356,  738,  357, 1200,  358,  360,
-      359,  361,  361,  361,  361,  822,  361,  361,  361,  836,
-      836,  836,  836,  836,  836,  836,  836,  376, 1287, 1258,
-     1571,  738,  376,  376,  376,  377,  737,  378,  378,  378,
-      378,  378,  378,  378,  378,  377,  738,  378,  378,  378,
-      378,  837,  378,  378,  378,  376, 1572,  738,  376, 1268,
-      376,  376,  376,  376,  376,  376, 1256, 1573, 1239, 1257,
-     1277,  376,  738,  842,  376,  843,  376,  376,  376,  376,
-      376,  376,  376,  767, 1574,  738,  376,  376,  376,  376,
-
-      844,  376,  376,  376, 1278,  767, 1320,  376, 1261,  738,
-      376,  845,  376,  376,  376,  376,  376,  376,  376,  738,
-     1321,  376,  767,  376,  376,  376,  376,  376,  376,  376,
-     1280, 1459, 1575,  376,  376,  376,  376,  848,  376,  376,
-      376,  846, 1267,  376, 1460,  738,  376,  847,  376,  376,
-      376,  376,  376,  376,  376, 1269,  857,  376, 1576,  376,
-      376,  376,  376,  376,  376,  376, 1259,  738, 1437, 1270,
-      376,  376,  376,  862,  849,  858,  512, 1438, 1577, 1271,
-      860,  512,  512,  512,  861,  738, 1413, 1260, 1414,  738,
-      863,  444,  444,  444,  444,  444,  444,  444,  444, 1243,
-
-      864, 1068, 1244,  867, 1281,  865,  512, 1069, 1284, 1578,
-      868,  512,  512,  512, 1070,  866,  905,  905,  905,  905,
-      905,  905,  905,  905,  445,  738,  446,  446,  446,  446,
-      446,  446,  446,  446,  445, 1579,  446,  446,  446,  446,
-      906,  446,  446,  446,  976, 1444,  977, 1010, 1445,  978,
-      979,  980,  985, 1309,  986, 1582,  981,  987,  988,  989,
-     1282, 1328,  982,  983,  990, 1329,  984,  738, 1310, 1583,
-      991,  992, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003,
-      513, 1462,  514,  514,  514,  514,  514,  514,  514,  514,
-      513, 1463,  514,  514,  514,  514, 1004,  514,  514,  514,
-
-      512, 1584, 1283,  512,  738,  512,  512,  512,  512,  512,
-      512, 1452,  512,  738, 1453,  512,  738,  512,  512,  512,
-      512,  512,  512,  512, 1585, 1506, 1397, 1586,  512,  512,
-      512, 1005, 1007, 1050, 1085, 1006, 1241, 1262, 1051, 1086,
-     1587, 1588, 1263, 1242, 1052, 1087, 1254, 1008, 1053, 1088,
-     1506, 1397, 1255, 1009, 1054, 1089,  706,  706,  706,  706,
-      706,  706,  706,  706, 1217, 1217, 1217, 1217, 1217, 1217,
-     1217, 1217,  707, 1398,  708,  708,  708,  708,  708,  708,
-      708,  708,  707, 1592,  708,  708,  708,  708, 1218,  708,
-      708,  708,  720,  720,  720,  720,  720,  720,  720,  720,
-
-     1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227,  721, 1507,
-      722,  722,  722,  722,  722,  722,  722,  722,  721,  738,
-      722,  722,  722,  722, 1228,  722,  722,  722,  734, 1401,
-      738,  376, 1593, 1402, 1507,  734,  376,  376,  376,  734,
-      734,  734,  734,  734,  734,  734,  734,  734, 1249,  741,
-      742, 1252, 1594, 1250,  734, 1595,  360, 1240,  735,  735,
-      735,  735,  735,  735,  735,  735,  734, 1430, 1596, 1253,
-     1597, 1431, 1600,  734, 1601,  360,  738,  735,  735,  735,
-      735, 1238,  735,  735,  735,  738,  740,  740,  740,  740,
-      740,  740,  740,  740,  738, 1360,  738,  758, 1602, 1598,
-
-      338,  338, 1603,  759, 1606,  760, 1245,  761,  788,  762,
-     1417,  763, 1418,  376, 1246, 1599, 1264, 1285,  376,  376,
-      376, 1247,  376, 1512, 1419, 1265,  738,  376,  376,  376,
-     1513, 1286, 1607, 1539, 1266, 1580, 1273, 1273, 1273, 1273,
-     1273, 1273, 1273, 1273,  738, 1540, 1608, 1581, 1609, 1610,
-     1611, 1340,  764, 1339,  765,  765,  765,  765,  765,  765,
-      765,  765,  738, 1612, 1613, 1614, 1615, 1616, 1617, 1618,
-      764, 1621,  765,  765,  765,  765, 1274,  765,  765,  765,
-      360, 1622,  361,  361,  361,  361, 1288,  361,  361,  361,
-      821,  821,  821,  821,  821,  821,  821,  821,  360, 1623,
-
-      361,  361,  361,  361,  361,  361,  361,  361,  836,  836,
-      836,  836,  836,  836,  836,  836,  377, 1624,  378,  378,
-      378,  378,  378,  378,  378,  378,  376, 1604, 1625, 1626,
-     1619,  376,  376,  376,  376, 1323, 1605,  376, 1627,  376,
-      376,  376,  376,  376,  376,  376, 1620, 1628, 1629,  376,
-      376,  376,  376, 1338,  376,  376,  376, 1343, 1630, 1631,
-      376, 1342, 1632,  376, 1341,  376,  376,  376,  376,  376,
-      376,  376, 1633, 1634, 1345,  376,  376,  376,  376,  376,
-      376,  376,  376, 1346,  376,  376,  376, 1347,  376, 1635,
-     1636, 1637, 1638,  376,  376,  376,  376, 1344, 1639,  376,
-
-     1542,  376,  376,  376,  376,  376,  376, 1640, 1543,  376,
-     1447, 1544, 1448, 1348,  376,  376,  376, 1351, 1449, 1349,
-      376, 1450, 1641, 1350,  376,  376,  376,  376,  376,  376,
-      376,  376, 1642,  376,  376,  376,  376, 1643, 1352, 1644,
-     1645,  376,  376,  376,  376, 1362, 1361,  376, 1646,  376,
-      376,  376,  376,  376,  376, 1647, 1648,  376, 1649, 1650,
-      512, 1363,  376,  376,  376,  512,  512,  512, 1654, 1655,
-     1364,  905,  905,  905,  905,  905,  905,  905,  905, 1656,
-     1657,  445, 1365,  446,  446,  446,  446,  446,  446,  446,
-      446, 1366, 1369, 1658, 1434, 1367, 1659, 1476, 1493, 1477,
-
-     1368, 1435, 1478, 1479, 1480, 1660, 1661, 1436, 1662, 1370,
-     1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1323,  513,
-     1651,  514,  514,  514,  514,  514,  514,  514,  514,  512,
-     1663, 1652,  512, 1653,  512,  512,  512,  512,  512,  512,
-      512, 1664, 1665,  512, 1666,  512,  512,  512,  512,  512,
-      512, 1589, 1667, 1668, 1669, 1590, 1491,  512, 1670, 1494,
-     1492, 1591,  512,  512,  512, 1495, 1496, 1671, 1672, 1673,
-     1497, 1674, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217,
-      707, 1675,  708,  708,  708,  708,  708,  708,  708,  708,
-     1676, 1677, 1678, 1679, 1681, 1498, 1682, 1680, 1683, 1227,
-
-     1227, 1227, 1227, 1227, 1227, 1227, 1227,  721, 1684,  722,
-      722,  722,  722,  722,  722,  722,  722, 1323, 1685, 1686,
-     1687, 1688, 1690, 1691, 1692, 1689, 1693,  734,  738,  741,
-      742,  738,  738,  738,  734,  738,  360, 1240,  738,  738,
-      738,  738,  738,  738, 1323,  738,  738,  738,  738,  738,
-      738,  738,  738, 1694,  738,  738,  738,  738,  738,  738,
-     1695,  738, 1697,  738,  738,  738,  738,  738,  738, 1698,
-     1701, 1696, 1706, 1323, 1702, 1705,  738, 1700, 1699, 1703,
-     1723, 1708,  767,  767,  767, 1704, 1726, 1725, 1724, 1729,
-     1712, 1707,  738,  767,  767,  738, 1709, 1710, 1711,  738,
-
-      738, 1713, 1273, 1273, 1273, 1273, 1273, 1273, 1273, 1273,
-     1727,  738,  738, 1717, 1728, 1737, 1719, 1715,  738,  738,
-      767, 1733, 1738, 1739, 1742, 1730, 1743, 1714, 1716, 1732,
-     1720, 1744,  738, 1731, 1740, 1718, 1745, 1746, 1741, 1721,
-      764, 1747,  765,  765,  765,  765,  765,  765,  765,  765,
-     1748, 1735, 1734, 1749,  360, 1736,  361,  361,  361,  361,
-      361,  361,  361,  361, 1750, 1751, 1752, 1753, 1754, 1755,
-     1756, 1757, 1759, 1760, 1761, 1762, 1763, 1722, 1764, 1765,
-     1766, 1768, 1769, 1770, 1771, 1772, 1773, 1774, 1775, 1776,
-     1777, 1323, 1778, 1779, 1780, 1758, 1781, 1782, 1783, 1784,
-
-     1785, 1767, 1787, 1788, 1786,  376, 1802, 1803,  376, 1804,
-      376,  376,  376,  376,  376,  376,  376, 1805, 1806,  376,
-     1809,  376,  376,  376,  376,  376,  376,  376, 1823, 1824,
-      376, 1825,  376,  376,  376,  376,  376,  376, 1789,  376,
-     1826, 1790,  376, 1827,  376,  376,  376,  376,  376,  376,
-      376, 1828, 1792,  376, 1829,  376,  376,  376,  376,  376,
-      376,  376, 1795, 1830,  376, 1831,  376,  376,  376,  376,
-      376,  376, 1797, 1807, 1791,  376, 1832, 1808, 1833, 1793,
-      376,  376,  376, 1796,  376, 1834, 1835,  376, 1794,  376,
-      376,  376,  376,  376,  376, 1836, 1837,  376, 1838, 1839,
-
-      376, 1798,  376,  376,  376,  376,  376,  376, 1840, 1841,
-      376, 1800, 1842, 1843, 1844,  376,  376,  376, 1801, 1813,
-     1814, 1815, 1845, 1846,  376, 1847, 1848,  376, 1799,  376,
-      376,  376,  376,  376,  376,  376, 1849, 1850,  376, 1851,
-      376,  376,  376,  376,  376,  376, 1852,  376, 1810, 1858,
-      376, 1859,  376,  376,  376,  376,  376,  376, 1853,  376,
-     1856, 1860, 1811, 1812,  376,  376,  376, 1862, 1863, 1861,
-     1864, 1854, 1865, 1857, 1866, 1867, 1868, 1869, 1870, 1871,
-     1816, 1855, 1872, 1817, 1873, 1874, 1875, 1877, 1878, 1879,
-     1819, 1820, 1876, 1818, 1880, 1881, 1882, 1883, 1887, 1888,
-
-     1889, 1890, 1821, 1891, 1884, 1894, 1895, 1896, 1897, 1898,
-     1885, 1899, 1892, 1900, 1893, 1901, 1886, 1822, 1902, 1903,
-     1904, 1905, 1906, 1907, 1908, 1909, 1910, 1911, 1912, 1913,
-     1914, 1915, 1916, 1917, 1918, 1919, 1920, 1921, 1922, 1923,
-     1924,  512, 1932, 1933,  512, 1934,  512,  512,  512,  512,
-      512,  512,  512, 1935, 1936,  512, 1939,  512,  512,  512,
-      512,  512,  512,  512, 1940, 1941,  512, 1942,  512,  512,
-      512,  512,  512,  512, 1925,  512, 1943, 1926, 1928, 1937,
-      512,  512,  512, 1938, 1944, 1927, 1945, 1946, 1930, 1940,
-     1947, 1948, 1949, 1950, 1951, 1952, 1953, 1954, 1955, 1956,
-
-     1957, 1958, 1959, 1960, 1929, 1961, 1962, 1963, 1964, 1965,
-     1966, 1967, 1969, 1970, 1971, 1972, 1973, 1974, 1931, 1968,
-     1975, 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984,
-     1985, 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
-     1997, 1998, 1995, 1996, 1999, 2000, 2001, 2002, 2003, 2004,
-     2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
-     2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024,
-     2028, 2025, 2029, 2030, 2031, 2032, 2033, 2026, 2034, 2036,
-     2037, 2038, 2027, 2039, 2040, 2042, 2043, 2035, 2044, 2045,
-     2046, 2047, 2050, 2048, 2051, 2053, 2052, 2054, 2055, 2056,
-
-     2057, 2058, 2059, 2041, 2049, 2060, 2061, 2062, 2063, 2064,
-     2065, 2066, 2067, 2068, 2069, 2070, 2071, 2072, 2073, 2074,
-     2075, 2076, 2077, 2078, 2079, 2080, 2081, 2082, 2083, 2084,
-     2085,  738,  738,  738,  738,  738,  738,  738,  738,  738,
-      738,  738,  738,  738,  738,  738,  738,  738,  738,  738,
-      738,  738,  738,  738,  738, 2109,  738, 2091, 2086, 2087,
-     2088,  738, 2092,  738, 2094, 2095,  738, 2098, 2099, 2089,
-     2096, 2100, 2105, 2116, 2090, 2103, 2110, 2117, 2093, 2097,
-      738, 2104, 2102, 2118, 2119,  767, 2121,  738,  767,  738,
-      738,  738,  738, 2120,  767, 2101,  738,  767, 2122,  738,
-
-     2131, 2106, 2132, 2108, 2133, 2107, 2134, 2135, 2136, 2137,
-     2138, 2139, 2114, 2140, 2141, 2142, 2111, 2128, 2112, 2115,
-     2126, 2129, 2124, 2127, 2143, 2144, 2145, 2146, 2147, 2113,
-     2125, 2148, 2123, 2149, 2150, 2151, 2152, 2153, 2155, 2130,
-     1766, 2156, 2154, 2157, 2158, 2159, 2160, 2161, 2162, 2163,
-     2165, 2166, 2167, 2164, 2168, 2169, 2170, 2171, 2172, 2173,
-     2174, 1767, 2175, 2176, 2177,  376, 2192, 2193,  376, 2194,
-      376,  376,  376,  376,  376,  376,  376, 2195, 2196,  376,
-     2197,  376,  376,  376,  376,  376,  376,  376, 2198, 2199,
-     2210, 2211,  376,  376,  376,  376, 2212, 2178, 2213, 2214,
-
-      376,  376,  376, 2215, 2179, 2181,  376, 2216, 2217, 2182,
-      376,  376,  376,  376, 2218,  376,  376,  376, 2219, 2220,
-     2221, 2184, 2222, 2223, 2224, 2185,  376, 2225, 2226, 2187,
-     2227,  376,  376,  376,  376, 2228, 2229, 2180, 2232,  376,
-      376,  376, 2186,  376, 2233, 2183,  376, 2234,  376,  376,
-      376,  376,  376,  376,  376, 2235, 2236,  376, 2237,  376,
-      376,  376,  376,  376,  376,  376, 2240, 2238,  376, 2188,
-      376,  376,  376,  376,  376,  376,  376, 2239, 2241,  376,
-     2242,  376,  376,  376,  376,  376,  376, 2190, 2243, 2230,
-     2244, 2191,  376, 2231, 2250, 2189, 2251,  376,  376,  376,
-
-      376, 2200, 2245,  376, 2252,  376,  376,  376,  376,  376,
-      376,  376, 2246, 2253,  376, 2254,  376,  376,  376,  376,
-      376,  376,  376, 2201, 2255,  376, 2256,  376,  376,  376,
-      376,  376,  376,  376, 2257, 2258, 2259, 2260,  376,  376,
-      376, 2261, 2262, 2263, 2264, 2265, 2247, 2266, 2202, 2267,
-     2268, 2203, 2269, 2272, 2277, 2248, 2273, 2274, 2270, 2278,
-     2249, 2275, 2276, 2279, 2271, 2280, 2281, 2282, 2283, 2284,
-     2285, 2205, 2204, 2286, 2287, 2288, 2289, 2206, 2290, 2291,
-     2292, 2293, 2294, 2207, 2208, 2295, 2296, 2297, 2209, 2298,
-     2299, 2300, 2301, 2302, 2304, 2303, 2305, 2306, 2307, 2308,
-
-     2310, 2309,  512, 2319, 2320,  512, 2321,  512,  512,  512,
-      512,  512,  512,  512, 2322, 2323,  512, 2324,  512,  512,
-      512,  512,  512,  512, 2325,  512, 2326, 2327, 2328, 2329,
-      512,  512,  512, 2330, 2311, 2331, 2332, 2336, 2337, 2313,
-      512, 2312, 2338, 2314, 2316,  512,  512,  512,  512, 2333,
-     2339, 2340, 2315,  512,  512,  512, 2334, 2341, 2342, 2335,
-     2343, 2344, 2345, 2346, 2347, 2348, 2349, 2350, 2351, 2352,
-     2353, 2354, 2355, 2356, 2357, 2358, 2359, 2360, 2362, 2361,
-     2363, 2364, 2365, 2317, 2366, 2318, 2367, 2368, 2369, 2370,
-     2371, 2372, 2373, 2374, 2375, 2376, 2377, 2378, 2379, 2380,
-
-     2381, 2382, 2383, 2384, 2385, 2386, 2387, 2388, 2389, 2390,
-     2391, 2392, 2393, 2394, 2395, 2396, 2397, 2398, 2399, 2400,
-     2401, 2402, 2403, 2404, 2405, 2406, 2407, 2408, 2409, 2410,
-     2411, 2412, 2413, 2414, 2415, 2416, 2417, 2418, 2419, 2420,
-     2422, 2423, 2424, 2425, 2426, 2427, 2428, 2421, 2429, 2430,
-     2431, 2432, 2433, 2434, 2435, 2436, 2437, 2438, 2439, 2441,
-     2442, 2443, 2440, 2444, 2445, 2446, 2447, 2449, 2450, 2451,
-     2448, 2452, 2453,  738,  738,  738,  738,  738,  738,  738,
-      738,  738,  738,  738,  738,  738,  738,  738,  738,  738,
-      738,  738,  738,  738,  738,  738,  738, 2109,  738,  738,
-
-      738,  738, 2454, 2460,  738,  738, 2458,  767, 2455, 2456,
-     2467, 2457, 2479,  767, 2459, 2461, 2469, 2485, 2110, 2484,
-     2462, 2466, 2463, 2464, 2465, 2470,  738,  738,  767, 2468,
-     2478, 2480, 2481,  767,  767,  738, 2482, 2483,  767,  767,
-      738,  738, 2486,  738,  738,  738, 2495, 2476, 2496, 2498,
-     2471, 2499, 2497, 2500, 2475, 2472, 2473, 2501, 2502, 2503,
-     2504, 2488, 2477, 2505, 2506, 2474, 2487, 2507, 2491, 2493,
-     2489, 2508, 2509, 2510, 2511, 2490, 2512, 2513, 2514, 2515,
-     2516, 2517, 2518, 2519, 2492, 2520, 2521, 2522, 2524, 2494,
-     2525, 2526, 2527, 2528, 2529, 2530, 2531, 2532, 2533, 2534,
-
-     2535, 2523, 2536, 2538, 2539, 2540, 2537, 2541, 2542,  376,
-     2555, 2556,  376, 2557,  376,  376,  376,  376,  376,  376,
-      376, 2560, 2561,  376, 2562,  376,  376,  376,  376,  376,
-      376,  376, 2563, 2571,  376, 2572,  376,  376,  376,  376,
-      376,  376,  376, 2573, 2574, 2575, 2558,  376,  376,  376,
-     2559, 2576, 2543, 2577, 2578, 2544,  376, 2579, 2545, 2580,
-     2547,  376,  376,  376, 2548,  376, 2546, 2581,  376, 2582,
-      376,  376,  376,  376,  376,  376,  376, 2549, 2583,  376,
-     2584,  376,  376,  376,  376,  376,  376,  376, 2585, 2586,
-     2587, 2550,  376,  376,  376,  376, 2588, 2589,  376, 2590,
-
-      376,  376,  376,  376,  376,  376, 2591, 2592, 2551,  376,
-     2593, 2552, 2594, 2553,  376,  376,  376,  376, 2554, 2595,
-      376, 2596,  376,  376,  376,  376,  376,  376,  376, 2597,
-     2598,  376, 2599,  376,  376,  376,  376,  376,  376,  376,
-     2602, 2603,  376, 2600,  376,  376,  376,  376,  376,  376,
-      376, 2601, 2604,  376, 2605,  376,  376,  376,  376,  376,
-      376, 2564, 2606, 2607, 2608, 2609, 2610, 2611, 2612, 2613,
-     2614, 2615, 2616, 2617, 2565, 2618, 2619, 2620, 2621, 2622,
-     2623, 2566, 2624, 2625, 2626, 2627, 2628, 2629, 2630, 2631,
-     2632, 2633, 2634, 2567, 2635, 2636, 2637, 2568, 2638, 2639,
-
-     2640, 2641, 2642, 2643, 2644, 2645, 2646, 2647, 2648, 2649,
-     2569, 2650, 2651, 2570, 2652,  512, 2661, 2662,  512, 2663,
-      512,  512,  512,  512,  512,  512, 2666,  512, 2667, 2668,
-      512, 2669,  512,  512,  512,  512,  512,  512,  512, 2670,
-     2671,  512, 2672,  512,  512,  512,  512,  512,  512,  512,
-     2673, 2674, 2675, 2664,  512,  512,  512, 2665, 2653, 2676,
-     2677, 2654, 2655, 2678,  512, 2656, 2679, 2680, 2681,  512,
-      512,  512, 2682, 2683, 2684, 2685, 2686, 2687, 2690, 2691,
-     2688, 2657, 2692, 2693, 2658, 2694, 2659, 2660, 2689, 2695,
-     2696, 2697, 2698, 2699, 2700, 2701, 2702, 2703, 2704, 2705,
-
-     2706, 2707, 2708, 2709, 2710, 2711, 2712, 2713, 2714, 2715,
-     2716, 2717, 2718, 2719, 2720, 2721, 2722, 2723, 2724, 2725,
-     2726, 2727, 2728, 2729, 2730, 2731, 2732, 2733, 2734, 2735,
-     2736, 2737, 2738, 2739, 2740, 2741, 2742, 2743, 2744, 2745,
-     2746, 2747, 2748, 2749, 2750, 2751, 2752, 2753, 2754, 2755,
-     2756, 2757, 2758, 2759, 2760, 2761, 2762, 2763, 2764, 2765,
-     2766, 2767, 2768, 2769, 2770, 2771, 2772, 2773, 2774, 2775,
-     2781, 2782, 2776, 2783, 2784, 2785, 2786, 2787, 2788, 2789,
-     2790, 2777, 2778, 2791, 2792, 2793, 2794, 2779, 2780, 2795,
-     2796, 2797,  738,  738,  738,  738,  738,  738,  738,  738,
-
-      738,  738,  738,  738,  738,  738,  738,  738,  738,  738,
-      738,  738,  738,  738,  738,  738, 2799,  738,  738,  738,
-     2804, 2805,  767, 2801, 2800,  738, 2798,  767, 2808, 2809,
-      767,  767, 2823, 2825, 2829, 2802, 2812, 2824, 2803,  767,
-     2810, 2806, 2807, 2813, 2811,  767,  738, 2826,  738, 2827,
-      767, 2830, 2832,  738,  738,  738, 2816, 2822, 2817, 2840,
-     2828,  767, 2841, 2833, 2838, 2820, 2842, 2843, 2844, 2845,
-     2846, 2819, 2847, 2831, 2818, 2837, 2815, 2848, 2814, 2821,
-     2849, 2834, 2850, 2851, 2836, 2835, 2852, 2853, 2854, 2855,
-     2856, 2857, 2858, 2861, 2839, 2862, 2863, 2859, 2864, 2865,
-
-     2867, 2868, 2869, 2870, 2871, 2872, 2873, 2874, 2875, 2860,
+       58,   59,   59,   58,   60,   58,   61,   62,   58,   63,
+       58,   58,   64,   64,   64,   64,   65,   64,   64,   66,
+       67,   68,  358,  558,   70, 6094,  365, 6094, 6094,  796,
+       71,  365,  365,  365,  797,  365,  359,   72, 6094,   73,
+      365,  365,  365,  453,   74,  104,  558,  105,  400,  106,
+      113,  114,  224,  115,  225,  107,  783,  108,  109,  784,
+      110,  116,  429,  401,  111,  112,  453,  370,  117,  430,
+      226,   58,   58,   59,   59,   58,   60,   58,   61,   62,
+       58,   63,   58,   58,   64,   64,   64,   64,   65,   64,
+       64,   66,   67,   68,  402,  104,   70,  105,  391,  106,
+
+      403,  224,   71,  225, 1498,  107,  392,  108,  109,   72,
+      110,   73,  409,  410,  111,  112,   74,  113,  114,  226,
+      115,  436,  118,  119,  120,  437,  393,  268,  116,  394,
+      121,  122,  395,  269,  396,  117,  123,  124,  535,  270,
+      536,  125,  271,   58,   75,   76,   77,   75,   78,   75,
+       79,   80,   81,   82,   83,   83,   84,   84,   84,   84,
+       85,   84,   84,   86,   87,   88,   89,   89,   90,   89,
+       89,   89,   89,   89,   91,   89,   89,   89,   89,   89,
+       89,   92,   89,   93,   89,   89,   89,   89,   94,   95,
+       89,   89,   96,   97,   89,   98,   89,   99,   89,   89,
+
+       89,  100,  101,   89,  102,   89,   89,  103,   89,   89,
+       89,   89,   89,   89,   89,   75,  118,  119,  120,  427,
+      483,  484,  168,  442,  121,  122, 1499,  443,  428,  169,
+      123,  124,  170,  171,  172,  125,   58,   59,  126,   58,
+       60,   58,   61,  127,   58,  128,   58,   58,  129,  129,
+      129,  129,  130,  129,  129,   66,   67,   68,  131,  131,
+      132,  131,  131,  131,  131,  131,  133,  131,  131,  131,
+      131,  134,  131,  135,  131,  136,  131,  131,  131,  131,
+       74,  131,  131,  131,  131,  131,  131,  131,  131,  131,
+      131,  131,  131,  131,  134,  131,  131,  131,  131,  137,
+
+      131,  131,  131,  131,  131,  131,  131,   58,   58,   59,
+      138,   58,   60,   58,   61,  139,   58,  140,   58,   58,
+      141,  141,  141,  141,  142,  141,  141,   66,   67,   68,
+      143,  143,  144,  143,  143,  145,  143,  143,  146,  143,
+      143,  143,  143,  143,  143,  147,  143,  148,  149,  143,
+      143,  143,   74,  143,  143,  143,  143,  143,  150,  143,
+      143,  143,  143,  143,  143,  143,  143,  143,  143,  143,
+      143,  151,  149,  143,  143,  143,  143,  143,  143,   58,
+      152,  153,  154,  288,  155,  474,  577,  156,  475,  578,
+      289,  157,  158,  404,  425,  159,  160,  290,  161,  152,
+
+      153,  154,  288,  155,  162,  163,  156,  405,  164,  289,
+      157,  158,  426,  219,  159,  160,  290,  161,  165,  162,
+      163,  166,  440,  164,  220,  703,  167,  168,  221,  398,
+      222,  441,  223,  165,  169,  704,  166,  170,  171,  172,
+      399,  167,   58,   59,   59,   58,  173,   58,   61,   62,
+       58,   63,  174,  174,  175,  175,  175,  175,  176,  175,
+      175,   66,   67,   68,  365,  219,  178,  502,  585,  365,
+      365,  365,  179,  586,  236,  503,  220,  237,  734,  180,
+      221,  181,  222,  268,  223,  238,  182,  227,  228,  269,
+      236,  239,  229,  237,  230,  270,  371,  420,  271,  231,
+
+      232,  238,  233,  365,  234,  235, 1219,  239,  365,  365,
+      365,  421,  464,   58,   58,   59,   59,   58,  173,   58,
+       61,   62,   58,   63,  174,  174,  175,  175,  175,  175,
+      176,  175,  175,   66,   67,   68,  464,  593,  178,  504,
+      505,  406,  227,  228,  179,  407,  380,  229,  360,  230,
+      594,  180,  408,  181,  231,  232,  361,  233,  182,  234,
+      235,  272,  362,  422,  273,  274,  275,  276,  444,  363,
+      486,  364,  520,  277,  278,  279,  423,  646,  280,  521,
+      424,  281,  487,  647,  445,   58,   58,   59,  183,   58,
+       60,   58,   61,  184,   58,  185,   58,   58,  186,  187,
+
+      188,  188,  189,  188,  188,   66,   67,   68,  190,  190,
+      191,  190,  190,  192,  190,  190,  193,  190,  190,  190,
+      190,  194,  195,  196,  190,  197,  198,  190,  190,  199,
+       74,  190,  190,  190,  190,  190,  192,  190,  190,  190,
+      190,  190,  190,  190,  194,  195,  190,  190,  190,  190,
+      198,  190,  190,  190,  190,  199,  190,   58,  200,  201,
+       59,  202,  203,  204,  205,  206,  200,  207,  200,  200,
+      208,  208,  208,  208,  209,  208,  208,  210,  211,  212,
+      514,  515,  214, 1500,  589,  438,  272,  609,  215,  273,
+      274,  275,  276,  590,  610,  216,  456,  217,  277,  278,
+
+      279,  472,  218,  280,  439,  282,  281,  283,  284,  285,
+      282,  365,  283,  284,  285,  607,  365,  365,  365,  456,
+     1501,  286,  287,  581,  472,  582,  286,  287,  608,  200,
+      200,  201,   59,  202,  203,  204,  205,  206,  200,  207,
+      200,  200,  208,  208,  208,  208,  209,  208,  208,  210,
+      211,  212,  365,  476,  214,  496,  384,  365,  365,  365,
+      215,  579,  678,  679, 1502,  497,  615,  216,  498,  217,
+      372,  477,  499,  580,  218,  329,  329,  329,  329,  329,
+      329,  329,  351,  616,  352,  352,  352,  352,  352,  352,
+      352,  351, 1088,  352,  352,  352,  352,  352,  353,  352,
+
+     1089,  200,   58,   59,  240,   58,   60,   58,   61,  241,
+       58,  242,   58,   58,  243,  244,  245,  246,  247,  246,
+      246,   66,   67,   68,  248,  248,  249,  248,  248,  248,
+      248,  248,  250,  248,  248,  248,  248,  248,  248,  251,
+      248,  252,  248,  248,  248,  248,   74,  248,  248,  248,
+      248,  248,  248,  248,  253,  248,  248,  248,  254,  255,
+      248,  248,  248,  248,  256,  248,  248,  248,  248,  248,
+      248,  248,  248,   58,  257,  258,  259,  673,  260,  560,
+      261,  674, 1503,  411,  262,  412,  263,  264,  567,  564,
+      431,  265,  266,  413,  267,  257,  258,  259,  432,  260,
+
+      414,  261,  560,  565,  433,  262,  434,  263,  264,  435,
+      675,  567,  265,  266,  676,  267,   58,   59,  291,   58,
+       60,   58,   61,  292,   58,  293,   58,   58,  294,  294,
+      294,  294,  295,  294,  294,   66,   67,   68,  296,  296,
+      297,  296,  296,  296,  296,  296,  298,  296,  296,  296,
+      296,  296,  296,  299,  296,  300,  296,  296,  296,  296,
+       74,  296,  296,  296,  296,  296,  296,  296,  296,  296,
+      296,  296,  296,  296,  301,  296,  296,  296,  296,  302,
+      303,  296,  296,  296,  296,  296,  296,   58,  304,  305,
+      306,  304,  307,  304,  308,  309,  304,  310,  304,  304,
+
+      311,  311,  311,  311,  312,  311,  311,  313,  314,  315,
+      566,  716,  317,  717,  365,  500,  358,  365,  318,  365,
+      365,  365,  365,  365,  365,  319,  455,  320,  456,  464,
+      359,  365,  321,  501,  566,  373,  365,  365,  365,  322,
+      457,  322,  329,  329,  329,  329,  329,  329,  329,  374,
+      473,  456,  658,  464,  323,  386,  323,  734,  659,  304,
+      304,  305,  306,  304,  307,  304,  308,  309,  304,  310,
+      304,  304,  311,  311,  311,  311,  312,  311,  311,  313,
+      314,  315,  365,  324,  317,  324,  385,  365,  365,  365,
+      318,  325,  792,  325,  793,  623, 1220,  319,  326,  320,
+
+      326,  327,  624,  327,  321,  366,  568,  367,  367,  367,
+      367,  367,  367,  367,  366,  375,  367,  367,  367,  367,
+      367,  368,  367,  376,  569,  522,  569,  523, 1504,  377,
+      652,  304,  330,  330,  415,  416,  378,  653,  379,  417,
+      331,  383,  524,  329,  329,  329,  329,  329,  329,  329,
+      684,  418,  419,  332, 1505,  333,  334,  335,  336,  337,
+      640,  532,  685,  641,  338,  339,  365,  340,  341,  365,
+      342,  365,  365,  365,  365,  365,  365,  343,  344,  533,
+      534,  345,  506,  346, 1240,  347,  762,  348,  365,  349,
+      507,  350,  365,  365,  365,  365,  508,  365,  365,  365,
+
+      446,  446,  446,  446,  446,  446,  446,  529,  660,  714,
+      388,  381,  446,  446,  446,  446,  446,  446,  446,  661,
+      530,  715,  531,  447,  382,  448,  448,  448,  448,  448,
+      448,  448,  447,  389,  448,  448,  448,  448,  448,  449,
+      448,  686,  687,  387, 1394,  575, 1395,  390,  458,  458,
+      458,  458,  458,  458,  458,  458,  458,  458,  458,  458,
+      458,  458,  459,  576,  460,  460,  460,  460,  460,  460,
+      460,  459,  467,  460,  460,  460,  460,  460,  461,  460,
+      470, 1506,  583, 1507,  478,  561,  468,  587,  488,  489,
+      469,  573,  490,  562,  471,  470,  491,  509,  469,  492,
+
+      584,  510,  588,  470,  493,  494,  495,  574,  561,  471,
+      595,  511,  512,  513,  469,  479,  562,  471,  516,  734,
+      591, 1508,  469,  525,  480,  481,  699,  517,  596,  482,
+      680,  681,  682,  518,  519,  592,  526,  683,  527,  528,
+      538,  700,  539,  539,  539,  539,  539,  539,  539,  538,
+      969,  539,  539,  539,  539,  539,  540,  539,  537,  634,
+      970,  537, 1230,  537,  537,  537,  537,  537,  537,  537,
+      688,  689,  537,  635,  537,  537,  537,  537,  537,  537,
+      537,  547,  781,  603,  612,  537,  537,  537,  782,  548,
+      544,  734,  613,  542,  701,  549,  614,  604,  545,  702,
+
+      605,  543,  550,  606,  551,  552,  552,  552,  552,  552,
+      552,  552,  546,  552,  552,  552,  552,  552,  552,  552,
+      553,  957,  554,  554,  554,  554,  554,  554,  554,  553,
+      958,  554,  554,  554,  554,  554,  554,  554,  553, 1509,
+      554,  554,  554,  554,  554,  554,  554,  553, 1226,  554,
+      554,  554,  554,  554,  555,  554,  329,  329,  329,  329,
+      329,  329,  329,  351, 1512,  352,  352,  352,  352,  352,
+      352,  352,  351,  360,  352,  352,  352,  352,  352,  353,
+      352,  361, 1422,  654,  734,  655,  597,  362,  598,  642,
+      599,  656,  643,  600,  363, 1423,  364,  617,  601,  602,
+
+      657,  618,  648,  735,  649,  619,  857,  650,  644,  645,
+      858,  620,  705,  706,  621,  622,  625,  625,  625,  625,
+      625,  625,  625,  625,  625,  625,  625,  625,  625,  625,
+      626, 1411,  627,  627,  627,  627,  627,  627,  627,  626,
+     1412,  628,  627,  627,  627,  627,  627,  627,  626, 1513,
+      627,  627,  627,  627,  627,  627,  627,  626, 1514,  627,
+      627,  627,  627,  627,  627,  627,  626, 1515,  627,  627,
+      627,  627,  627,  629,  627,  662,  663,  910,  690,  865,
+      692,  667,  664,  668,  693,  866,  694,  665,  695,  669,
+      670,  666,  691,  696,  671,  672,  712,  697,  698,  718,
+
+      910,  713, 1516, 1014,  719,  720,  720,  720,  720,  720,
+      720,  720,  720,  720,  720,  720,  720,  720,  720,  721,
+     1015,  722,  722,  722,  722,  722,  722,  722,  721,  728,
+      722,  722,  722,  722,  722,  723,  722,  734, 1171, 1172,
+      913,  789,  765,  729,  766,  777,  790,  736,  736,  736,
+      736,  736,  736,  736,  737,  738,  762,  928,  767,  778,
+      734,  802,  739,  913,  929,  736,  736,  736,  736,  736,
+      736,  736,  803, 1517,  768,  740,  785,  741,  742,  743,
+      744,  745,  769,  804,  786,  798,  746,  747,  770,  748,
+      749,  787,  750, 1069,  799,  771,  824,  772, 1070,  751,
+
+      752, 1073,  800,  753,  734,  754, 1518,  755, 1074,  756,
+      825,  757,  759,  758,  760,  760,  760,  760,  760,  760,
+      760,  734,  329,  329,  329,  329,  329,  329,  329,  759,
+      920,  760,  760,  760,  760,  760,  761,  760,  733,  733,
+      734,  733,  733,  733,  733,  733,  733,  733,  733,  733,
+      940, 1191, 1192,  921,  810,  837,  941,  733,  733,  733,
+      351,  811,  352,  352,  352,  352,  352,  773,  352,  838,
+     1156,  812,  813,  813,  813,  813,  813,  813,  813,  351,
+     1157,  352,  352,  352,  352,  352,  352,  352,  351, 1138,
+      352,  352,  352,  352,  814,  352,  352,  826,  826,  826,
+
+      826,  826,  826,  826,  981, 1519, 1139,  734,  982,  733,
+      733,  733,  734,  733,  733,  733,  733,  733,  733,  733,
+      733,  733,  446,  446,  446,  446,  446,  446,  446,  733,
+      733,  733,  366,  922,  367,  367,  367,  367,  367,  367,
+      367, 1241,  762,  924,  921,  366,  763,  367,  367,  367,
+      367,  827,  367,  367,  365,  923,  923,  365, 1231,  365,
+      365,  365,  365,  365,  365,  365,  924,  921,  365, 1038,
+      365,  365,  365,  365,  365,  365, 1520,  974,  923,  365,
+      925,  733,  330,  330,  365,  365,  365,  828,  830,  975,
+      780, 1027,  365, 1038, 1039,  365,  829,  365,  365,  365,
+
+      365,  365,  365,  925,  979, 1028,  365, 1243,  762,  365,
+      831,  365,  365,  365,  365,  365,  365,  365, 1039,  959,
+      879,  832,  365,  365,  365,  980,  880,  343,  344,  881,
+      964,  345,  960,  346, 1425,  347,  965,  348,  839,  349,
+      365,  350,  961,  568, 1426,  365,  365,  365,  365, 1032,
+      841,  365, 1034,  365,  365,  365,  365,  365,  365,  365,
+      840,  569,  365,  569,  365,  365,  365,  365,  365,  365,
+     1132, 1521, 1032,  842,  365, 1034, 1522,  843,  365,  365,
+      365,  365, 1133,  365,  365,  365,  906,  906,  906,  906,
+      906,  906,  906,  447,  844,  448,  448,  448,  448,  448,
+
+      448,  448,  845, 1149,  734,  848,  447,  846,  448,  448,
+      448,  448,  907,  448,  448, 1523,  734,  847,  458,  458,
+      458,  458,  458,  458,  458, 1150, 1084,  734,  849, 1085,
+      850,  915,  915,  915,  915,  915,  915,  915,  459, 1213,
+      460,  460,  460,  460,  460,  460,  460,  459, 1204,  460,
+      460,  460,  460,  916,  460,  460,  936,  937,  989,  734,
+      990, 1232, 1242,  991,  992,  993,  998,  938,  999,  939,
+      994, 1000, 1001, 1002,  762, 1126,  995,  996, 1003, 1127,
+      997,  734, 1524, 1216, 1004, 1005, 1016, 1016, 1016, 1016,
+     1016, 1016, 1016,  538, 1525,  539,  539,  539,  539,  539,
+
+      539,  539,  538, 1526,  539,  539,  539,  539, 1017,  539,
+      539,  537, 1208, 1529,  537, 1209,  537,  537,  537,  537,
+      537,  537,  537, 1244, 1530,  537,  762,  537,  537,  537,
+      537,  537,  537,  537,  734, 1531,  537,  734,  537,  537,
+      537,  537,  537,  537, 1018, 1020,  552,  552,  552,  552,
+      552,  552,  552, 1019, 1029, 1029, 1029, 1029, 1029, 1029,
+     1029,  734, 1214,  734, 1021, 1022,  553, 1215,  554,  554,
+      554,  554,  554,  554,  554,  553,  734,  554,  554,  554,
+      554, 1030,  554,  554, 1061,  734, 1292,  734, 1532, 1062,
+     1293, 1527, 1206, 1533, 1233, 1063, 1221, 1246, 1207, 1064,
+
+     1245, 1222, 1534, 1528, 1535, 1065,  625,  625,  625,  625,
+      625,  625,  625, 1098, 1098, 1098, 1098, 1098, 1098, 1098,
+      626, 1247,  627,  627,  627,  627,  627,  627,  627,  626,
+     1536,  627,  627,  627,  627,  627,  627,  627,  626, 1537,
+      627,  627,  627,  627, 1099,  627,  627,  720,  720,  720,
+      720,  720,  720,  720, 1194, 1194, 1194, 1194, 1194, 1194,
+     1194,  721,  734,  722,  722,  722,  722,  722,  722,  722,
+      721,  734,  722,  722,  722,  722, 1195,  722,  722,  734,
+      734,  736,  736,  736,  736,  736,  736,  736,  737,  738,
+      734,  734,  734,  734, 1372,  734, 1205, 1383, 1373, 1210,
+
+     1417, 1223, 1418,  330,  330, 1227, 1281, 1211, 1419, 1538,
+     1224,  780, 1491, 1248, 1212, 1249, 1228, 1377, 1225, 1492,
+     1282, 1383, 1480, 1283, 1217,  365, 1218, 1229, 1378, 1250,
+      365,  365,  365,  751,  752, 1235, 1398,  753, 1399,  754,
+     1378,  755, 1236,  756,  734,  757, 1480,  758, 1234, 1304,
+     1400, 1378, 1237,  734, 1238, 1238, 1238, 1238, 1238, 1238,
+     1238,  759,  734,  760,  760,  760,  760,  760,  760,  760,
+      759, 1541,  760,  760,  760,  760, 1239,  760,  760,  351,
+     1542,  352,  352,  352,  352, 1251,  352,  352,  813,  813,
+      813,  813,  813,  813,  813,  351, 1543,  352,  352,  352,
+
+      352,  352,  352,  352,  826,  826,  826,  826,  826,  826,
+      826,  366, 1547,  367,  367,  367,  367,  367,  367,  367,
+      365, 1381, 1548, 1382, 1435,  365,  365,  365,  365, 1287,
+     1436, 1549,  365,  365,  365,  365,  365,  365,  365,  365,
+     1510,  365,  365,  365, 1381, 1300, 1382,  365, 1511, 1368,
+     1301, 1303,  365,  365,  365, 1336, 1337, 1550, 1305, 1551,
+      365, 1338, 1306,  365, 1302,  365,  365,  365,  365,  365,
+      365,  365, 1368, 1486,  365, 1552,  365,  365,  365,  365,
+      365,  365,  365, 1553, 1556,  365, 1557,  365,  365,  365,
+      365,  365,  365,  365, 1369, 1558, 1486,  365,  365,  365,
+
+      365, 1554,  365,  365,  365,  365, 1559, 1560, 1313, 1315,
+      365,  365,  365,  365, 1563, 1314,  365, 1555,  365,  365,
+      365,  365,  365,  365, 1564, 1379, 1451, 1561, 1452, 1380,
+     1316, 1453, 1454, 1455, 1565, 1566, 1562, 1317,  906,  906,
+      906,  906,  906,  906,  906, 1318, 1567, 1321, 1381, 1319,
+     1320,  447, 1568,  448,  448,  448,  448,  448,  448,  448,
+     1322, 1323, 1569, 1570, 1571, 1324,  915,  915,  915,  915,
+      915,  915,  915,  459, 1572,  460,  460,  460,  460,  460,
+      460,  460, 1407, 1484, 1539, 1287,  537, 1485, 1540, 1408,
+     1573,  537,  537,  537, 1574, 1409, 1016, 1016, 1016, 1016,
+
+     1016, 1016, 1016, 1575, 1578, 1579,  538, 1287,  539,  539,
+      539,  539,  539,  539,  539,  537, 1467, 1580,  537, 1576,
+      537,  537,  537,  537,  537,  537,  537, 1581, 1582, 1583,
+     1586,  537,  537,  537, 1544, 1577,  537, 1469, 1545, 1587,
+     1466,  537,  537,  537, 1546, 1584, 1585, 1588, 1589, 1590,
+     1470, 1468, 1591, 1592, 1593, 1594, 1595, 1596, 1471, 1597,
+     1598, 1599, 1472, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
+      553, 1600,  554,  554,  554,  554,  554,  554,  554, 1098,
+     1098, 1098, 1098, 1098, 1098, 1098,  626, 1601,  627,  627,
+      627,  627,  627,  627,  627, 1602, 1603, 1604, 1605, 1607,
+
+     1608, 1609, 1610, 1611, 1287, 1612, 1613, 1614, 1615, 1606,
+     1616, 1617, 1618, 1619, 1620, 1621, 1622, 1623, 1624, 1627,
+     1287, 1194, 1194, 1194, 1194, 1194, 1194, 1194,  721, 1628,
+      722,  722,  722,  722,  722,  722,  722, 1625, 1629,  734,
+      734, 1626,  737,  738,  734,  734,  734,  734,  734,  734,
+     1205,  734,  734,  734,  734,  734,  734,  734,  734,  734,
+      734,  734, 1287, 1630,  734,  734,  734,  734, 1631,  734,
+      734,  734,  734, 1633,  734, 1640,  734,  734,  734, 1634,
+     1637, 1632, 1638,  734, 1636, 1635,  734, 1639, 1661, 1663,
+      762,  762, 1644,  734, 1641, 1662, 1642, 1643,  734,  734,
+
+      734, 1645,  762, 1238, 1238, 1238, 1238, 1238, 1238, 1238,
+     1673, 1664, 1667, 1665, 1674, 1647, 1649, 1666, 1652,  762,
+     1648, 1651, 1654,  762,  734,  734, 1646, 1675, 1678, 1658,
+      734, 1668, 1650, 1669,  734, 1679, 1655, 1680, 1657, 1656,
+     1681, 1653,  759, 1659,  760,  760,  760,  760,  760,  760,
+      760, 1676, 1670, 1682, 1683, 1677, 1672, 1671,  351, 1684,
+      352,  352,  352,  352,  352,  352,  352, 1685, 1686, 1687,
+     1688, 1689, 1690, 1691, 1692, 1693, 1660, 1694, 1695, 1697,
+     1698, 1700, 1701, 1702, 1704, 1705, 1706, 1707, 1708, 1709,
+     1711, 1712, 1287, 1714, 1715, 1716, 1713, 1717, 1696, 1718,
+
+     1699, 1719, 1720, 1703, 1721, 1722, 1723, 1724, 1725, 1710,
+     1726, 1728,  365, 1735, 1727,  365, 1736,  365,  365,  365,
+      365,  365,  365,  365, 1737, 1738,  365, 1739,  365,  365,
+      365,  365,  365,  365,  365, 1756, 1757, 1758, 1740,  365,
+      365,  365, 1741, 1759, 1729,  365, 1760, 1730, 1732, 1731,
+      365,  365,  365,  365, 1761, 1762,  365, 1763,  365,  365,
+      365,  365,  365,  365,  365, 1764, 1734, 1765,  365,  365,
+      365,  365, 1733,  365,  365,  365,  365, 1745, 1746, 1747,
+      365,  365,  365,  365,  365,  365,  365,  365, 1766,  365,
+      365,  365, 1767,  365, 1770, 1771,  365, 1768,  365,  365,
+
+      365,  365,  365,  365, 1772, 1769, 1773,  365, 1774, 1775,
+      365, 1742,  365,  365,  365,  365,  365,  365, 1743, 1776,
+      365, 1777, 1778, 1779, 1744,  365,  365,  365, 1780, 1748,
+     1781, 1782, 1785, 1750, 1751, 1749, 1783, 1786, 1787, 1784,
+     1788, 1789, 1790, 1791, 1792, 1752, 1793, 1794, 1795, 1796,
+     1797, 1798, 1753, 1799, 1800, 1801, 1802, 1804, 1803, 1805,
+     1806, 1807, 1808, 1809, 1755, 1810, 1811, 1814, 1816, 1817,
+     1820, 1821, 1822, 1818, 1754, 1823, 1824, 1801, 1801, 1812,
+     1815, 1819, 1803, 1805, 1803, 1825, 1826, 1827, 1828, 1813,
+     1830, 1831, 1832, 1833, 1829, 1834, 1835, 1836, 1837, 1841,
+
+     1842, 1843, 1844, 1845, 1846, 1838, 1847, 1848, 1849, 1850,
+     1851, 1839, 1852, 1853, 1854, 1855, 1857, 1840, 1859, 1860,
+     1861, 1862, 1863, 1864, 1865, 1866, 1867, 1858, 1868, 1869,
+     1870, 1856, 1871, 1872, 1873, 1874, 1875, 1876, 1877,  537,
+     1884, 1885,  537, 1886,  537,  537,  537,  537,  537,  537,
+      537, 1887, 1888,  537, 1891,  537,  537,  537,  537,  537,
+      537,  537, 1892, 1893, 1894, 1889,  537,  537,  537, 1890,
+     1895, 1878,  537, 1896, 1879, 1881, 1880,  537,  537,  537,
+     1897, 1898, 1899, 1900, 1901, 1892, 1902, 1903, 1904, 1905,
+     1906, 1907, 1908, 1883, 1909, 1910, 1911, 1912, 1913, 1882,
+
+     1914, 1915, 1916, 1917, 1918, 1920, 1921, 1922, 1923, 1924,
+     1925, 1926, 1919, 1927, 1928, 1929, 1930, 1931, 1932, 1933,
+     1936, 1937, 1934, 1935, 1938, 1939, 1940, 1941, 1942, 1943,
+     1944, 1945, 1946, 1947, 1948, 1949, 1950, 1951, 1952, 1953,
+     1954, 1955, 1956, 1957, 1958, 1959, 1960, 1961, 1962, 1963,
+     1964, 1965, 1966, 1967, 1968, 1969, 1970, 1971, 1972, 1975,
+     1973, 1976, 1977, 1978, 1979, 1980, 1974, 1981, 1983, 1984,
+     1985, 1986, 1988, 1989, 1991, 1992, 1982, 1993, 1994, 1995,
+     1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 1990, 2005,
+     1987, 1997, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013,
+
+     2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021,  734,  734,
+      734,  734,  734,  734,  734,  734,  734,  734,  734,  734,
+      734,  734,  734,  734,  734,  734, 2039,  734, 2042,  734,
+      734,  734,  734, 2027, 2022, 2023, 2024,  734, 2028,  734,
+     2030, 2031, 2032, 2033, 2037, 2025, 2040,  734, 2043, 2026,
+     2035, 2046,  734, 2029, 2036, 2034,  734, 2053,  734,  734,
+      734, 2059, 2060, 2061, 2062, 2064,  762, 2038,  734,  762,
+      734, 2047, 2063,  734,  762,  734,  762, 2054,  734, 2072,
+     2073, 2045, 2074, 2041, 2075,  734, 2076, 2077, 2078, 2079,
+     2080, 2048, 2044, 2049, 2081, 2082, 2068, 2058, 2083, 2052,
+
+     2050, 2084, 2085, 2086, 2069, 2066, 2067, 2051, 2087, 2070,
+     2055, 2056, 2065, 2071, 2088, 2089, 2057, 1695, 2090, 1698,
+     2091, 2093, 1702, 2095, 2096, 2097, 2094, 2098, 2099, 1709,
+     2100, 2101, 2102, 2103, 2104, 2105, 2092, 1696, 2106, 1699,
+     2107, 2108, 1703, 2109, 2110, 2111, 2112, 2113, 2114, 1710,
+     2115, 2116, 2117,  365, 2124, 2125,  365, 2126,  365,  365,
+      365,  365,  365,  365,  365, 2127, 2128,  365, 2129,  365,
+      365,  365,  365,  365,  365,  365, 2130, 2140, 2141, 2142,
+      365,  365,  365, 2143, 2118, 2144, 2145, 2146, 2147, 2148,
+     2119, 2149,  365, 2122, 2150, 2151, 2120,  365,  365,  365,
+
+      365, 2121, 2152,  365, 2153,  365,  365,  365,  365,  365,
+      365,  365, 2154, 2155,  365, 2156,  365,  365,  365,  365,
+      365,  365,  365, 2157, 2158, 2161, 2159,  365,  365,  365,
+      365, 2162, 2123,  365, 2163,  365,  365,  365,  365,  365,
+      365, 2131,  365, 2160, 2164,  365, 2165,  365,  365,  365,
+      365,  365,  365, 2166,  365, 2167, 2168,  365, 2132,  365,
+      365,  365,  365,  365,  365,  365, 2169, 2170,  365, 2171,
+      365,  365,  365,  365,  365,  365,  365, 2172, 2133, 2173,
+     2174,  365,  365,  365, 2175, 2176, 2177, 2178, 2179, 2180,
+     2181, 2182, 2183, 2186, 2184, 2185, 2187, 2188, 2189, 2135,
+
+     2134, 2190, 2193, 2191, 2194, 2195, 2136, 2199, 2196, 2139,
+     2197, 2203, 2137, 2192, 2204, 2183, 2183, 2185, 2185, 2187,
+     2205, 2206, 2198, 2138, 2207, 2208, 2209, 2210, 2211, 2212,
+     2213, 2214, 2215, 2216, 2217, 2218, 2219, 2222, 2200, 2223,
+     2224, 2227, 2220, 2225, 2226, 2228, 2229, 2201, 2221, 2230,
+     2231, 2232, 2202, 2233, 2234, 2235, 2236, 2237, 2238, 2239,
+     2240, 2242, 2243, 2244, 2245, 2246, 2247, 2248, 2241, 2249,
+     2251, 2250, 2252, 2253, 2254, 2255, 2257, 2256,  537, 2264,
+     2265,  537, 2266,  537,  537,  537,  537,  537,  537,  537,
+     2267, 2268,  537, 2269,  537,  537,  537,  537,  537,  537,
+
+      537, 2270, 2271, 2272, 2273,  537,  537,  537, 2274, 2258,
+     2275, 2276, 2277, 2278, 2279, 2259, 2280,  537, 2262, 2281,
+     2282, 2260,  537,  537,  537, 2283, 2261, 2284, 2285, 2286,
+     2287, 2288, 2289, 2290, 2291, 2292, 2293, 2294, 2295, 2296,
+     2297, 2298, 2299, 2300, 2301, 2302, 2303, 2304, 2305, 2306,
+     2307, 2308, 2309, 2310, 2311, 2312, 2313, 2263, 2314, 2315,
+     2316, 2317, 2318, 2319, 2320, 2321, 2322, 2323, 2324, 2325,
+     2326, 2327, 2328, 2329, 2330, 2331, 2332, 2333, 2334, 2335,
+     2336, 2337, 2338, 2339, 2340, 2341, 2342, 2343, 2344, 2345,
+     2346, 2347, 2348, 2349, 2350, 2351, 2352, 2353, 2354, 2355,
+
+     2356, 2357, 2358, 2360, 2361, 2362, 2363, 2364, 2365, 2366,
+     2359, 2367, 2368, 2369, 2370, 2371, 2372, 2373, 2374, 2375,
+     2376, 2377, 2378, 2379,  734,  734,  734,  734,  734,  734,
+      734,  734,  734,  734,  734,  734,  734,  734,  734,  734,
+      734,  734,  734, 2039,  734,  734, 2042,  734,  734,  734,
+      734,  734, 2380, 2386, 2046,  734, 2384,  734, 2381, 2382,
+      734, 2383, 2391, 2040, 2385, 2387, 2043, 2392,  734, 2388,
+     2389,  734,  734,  734, 2047, 2390, 2053,  734,  734,  734,
+      734, 2407,  762,  762, 2409, 2408,  762, 2411, 2410,  762,
+      734, 2394,  734,  734,  734,  734, 2054, 2412,  734,  734,
+
+     2393,  762, 2420, 2396, 2406, 2421, 2422, 2395, 2397, 2423,
+     2424, 2399, 2402, 2425, 2398, 2400, 2401, 2426, 2427, 2417,
+     2428, 2416, 2419, 2429, 2414, 2404, 2430, 2403, 2415, 2413,
+     2431, 2432, 2433, 2434, 2435, 2436, 2437, 2439, 2418, 2441,
+     2442, 2443, 2405, 2444, 2445, 2446, 2447, 2449, 2451, 2452,
+     2453, 2454, 2455, 2456, 2457, 2458, 2438, 2440, 2459, 2460,
+     2448, 2461, 2462, 2463, 2464, 2465, 2466, 2450, 2467,  365,
+     2474, 2475,  365, 2476,  365,  365,  365,  365,  365,  365,
+      365, 2477, 2478,  365, 2479,  365,  365,  365,  365,  365,
+      365,  365, 2480, 2483,  365, 2484,  365,  365,  365,  365,
+
+      365,  365, 2485, 2486, 2487, 2488, 2489, 2490,  365, 2468,
+     2491,  365, 2469,  365,  365,  365,  365,  365,  365,  365,
+     2470, 2492, 2493, 2471,  365,  365,  365,  365, 2494, 2473,
+      365, 2472,  365,  365,  365,  365,  365,  365,  365, 2495,
+     2496,  365, 2497,  365,  365,  365,  365,  365,  365,  365,
+     2498, 2499,  365, 2500,  365,  365,  365,  365,  365,  365,
+     2501, 2502, 2503, 2504, 2505, 2506, 2507, 2508, 2481, 2509,
+     2510, 2511, 2512, 2513, 2514, 2515, 2516, 2482, 2517, 2518,
+     2519, 2520, 2521, 2522, 2523, 2524, 2525, 2526, 2527, 2528,
+     2529, 2531, 2532, 2533, 2534, 2535, 2536, 2537, 2530, 2538,
+
+     2539, 2540, 2541, 2542, 2543, 2544, 2545, 2546, 2547, 2548,
+     2549, 2550, 2551, 2552, 2553, 2554, 2555, 2523, 2556, 2557,
+     2558, 2559, 2560, 2561, 2562, 2563, 2564, 2565, 2566, 2567,
+     2568, 2569, 2570, 2571, 2572, 2573, 2574, 2575, 2576, 2577,
+     2578, 2579, 2580, 2581, 2582, 2583, 2584, 2585,  537, 2592,
+     2593,  537, 2594,  537,  537,  537,  537,  537,  537,  537,
+     2595, 2596,  537, 2597,  537,  537,  537,  537,  537,  537,
+      537, 2598, 2599,  537, 2600,  537,  537,  537,  537,  537,
+      537, 2601, 2602, 2603, 2604, 2605, 2606, 2607, 2586, 2608,
+     2609, 2587, 2610, 2611, 2612, 2613, 2614, 2615, 2616, 2588,
+
+     2617, 2618, 2589, 2619, 2620, 2621, 2622, 2623, 2591, 2624,
+     2590, 2625, 2626, 2627, 2628, 2629, 2630, 2631, 2632, 2633,
+     2634, 2635, 2636, 2637, 2638, 2639, 2640, 2641, 2642, 2643,
+     2644, 2645, 2646, 2647, 2648, 2649, 2650, 2651, 2652, 2653,
+     2654, 2655, 2656, 2657, 2658, 2659, 2660, 2661, 2662, 2663,
+     2664, 2665, 2666, 2667, 2668, 2669, 2670, 2671, 2672, 2673,
+     2674, 2675, 2676, 2677, 2678, 2679, 2680, 2681, 2682, 2683,
+     2684, 2685, 2686, 2687, 2688, 2689, 2690, 2691, 2692, 2693,
+     2694, 2695, 2696, 2697, 2698, 2699, 2700, 2701,  734,  734,
+      734,  734,  734,  734,  734,  734,  734,  734,  734,  734,
+
+      734,  734,  734, 2715,  734, 2717,  734,  734,  734,  734,
+      734, 2703,  734,  734,  734, 2708, 2709,  734, 2705, 2704,
+      734, 2702, 2710, 2716,  734, 2718,  762, 2712,  762, 2706,
+     2727,  734, 2707, 2713, 2732, 2711, 2733,  762,  762,  762,
+      762,  734,  734, 2737,  734, 2734, 2735, 2736, 2738,  734,
+     2728, 2721, 2714,  734,  734, 2745, 2746, 2724, 2731, 2729,
+     2725, 2747, 2748, 2749, 2723, 2750, 2751, 2722, 2752, 2719,
+     2720, 2753, 2754, 2743, 2726, 2739, 2755, 2740, 2741, 2730,
+     2437, 2439, 2756, 2757, 2758, 2742, 2759, 2760, 2761, 2762,
+     2763, 2449, 2765, 2766, 2768, 2769, 2744, 2770, 2771, 2772,
+
+     2438, 2440, 2773, 2774, 2775, 2776, 2777, 2778, 2779, 2780,
+     2764, 2450, 2781, 2767, 2782,  365, 2789, 2790,  365, 2791,
+      365,  365,  365,  365,  365,  365,  365, 2792, 2793,  365,
+     2794,  365,  365,  365,  365,  365,  365,  365, 2795, 2797,
+      365, 2798,  365,  365,  365,  365,  365,  365, 2799,  365,
+     2783, 2800,  365, 2784,  365,  365,  365,  365,  365,  365,
+     2801, 2785, 2788, 2802, 2786, 2803, 2804, 2808, 2805, 2809,
+     2810, 2811, 2787, 2806, 2807, 2812, 2813, 2814, 2815, 2816,
+     2817, 2818, 2819, 2820, 2821, 2822, 2823, 2824, 2825, 2826,
+     2827, 2828, 2829, 2830, 2796, 2831, 2832, 2833, 2834, 2835,
+
+     2836, 2837, 2838, 2839, 2840, 2841, 2842, 2843, 2844, 2845,
+     2846, 2847, 2848, 2849, 2850, 2851, 2852, 2854, 2853, 2855,
+     2856, 2857, 2858, 2859, 2860, 2861, 2862, 2863, 2864, 2865,
+     2866, 2867, 2868, 2869, 2870, 2871, 2872, 2873, 2874, 2875,
      2876, 2877, 2878, 2879, 2880, 2881, 2882, 2883, 2884, 2885,
-     2866,  376, 2896, 2897,  376, 2898,  376,  376,  376,  376,
-      376,  376,  376, 2899, 2900,  376, 2901,  376,  376,  376,
-      376,  376,  376, 2902,  376, 2903, 2904,  376, 2909,  376,
-      376,  376,  376,  376,  376, 2910, 2911,  376, 2886, 2912,
-      376, 2887,  376,  376,  376,  376,  376,  376, 2913, 2914,
-     2915, 2916, 2917, 2918, 2919, 2888, 2920, 2921, 2889, 2890,
-      376, 2922, 2891,  376, 2923,  376,  376,  376,  376,  376,
-      376,  376, 2924, 2925,  376, 2926,  376,  376,  376,  376,
-
-      376,  376,  376, 2927, 2928,  376, 2929,  376,  376,  376,
-      376,  376,  376, 2930, 2894, 2931,  376, 2892, 2932,  376,
-     2893,  376,  376,  376,  376,  376,  376, 2933,  376, 2934,
-     2935,  376, 2895,  376,  376,  376,  376,  376,  376,  376,
-     2936, 2937, 2938, 2939,  376,  376,  376, 2940, 2941, 2942,
-     2905, 2943, 2944, 2945, 2946, 2948, 2947, 2949, 2950, 2951,
-     2952, 2953, 2954, 2955, 2956, 2957, 2958, 2959, 2906, 2960,
-     2961, 2962, 2963, 2964, 2965, 2966, 2967, 2968, 2969, 2907,
-     2970, 2971, 2972, 2973, 2974, 2975, 2976, 2977, 2908, 2978,
-     2981, 2983, 2982, 2984, 2985, 2986, 2987, 2996, 2997, 2998,
-
-      512, 2999, 2979,  512, 2980,  512,  512,  512,  512,  512,
-      512,  512, 3000, 3001,  512, 3002,  512,  512,  512,  512,
-      512,  512,  512, 3003, 3004,  512, 3005,  512,  512,  512,
-      512,  512,  512, 3006, 3007, 3008, 3009, 2988,  512, 3010,
-     2989,  512, 3011,  512,  512,  512,  512,  512,  512, 3012,
-     3013, 3014, 3015, 3016, 2990, 3017, 3018, 2991, 3019, 2992,
-     3020, 2994, 2993, 3021, 3022, 3023, 3024, 3025, 3026, 3027,
-     3028, 3029, 3030, 3031, 3032, 3033, 3034, 3035, 3036, 2995,
-     3037, 3038, 3039, 3040, 3041, 3042, 3043, 3044, 3045, 3046,
-     3047, 3048, 3049, 3050, 3051, 3052, 3053, 3054, 3055, 3056,
-
-     3057, 3058, 3059, 3060, 3061, 3062, 3063, 3064, 3065, 3066,
-     3067, 3068, 3069, 3070, 3071, 3072, 3073, 3074, 3075, 3076,
-     3077, 3078, 3079, 3080, 3081, 3082, 3083, 3084, 3085, 3086,
-     3087, 3088, 3089, 3090, 3091, 3092, 3093, 3094, 3095, 3096,
-     3097, 3098, 3099, 3100, 3101, 3102, 3103, 3104, 3105, 3106,
-     3107, 3108, 3110, 3111, 3112, 3113, 3114, 3115, 3116, 3117,
-     3118, 3119, 3120, 3121, 3122, 3123, 3124, 3125, 3126, 3127,
-     3128, 3109, 3129,  738,  738,  738,  738,  738,  738,  738,
-      738,  738,  738, 3130,  738,  738,  738,  738,  738,  738,
-      738,  738,  738,  738,  738,  738,  738,  767, 3143, 3153,
-
-      738, 3137,  738, 3138,  767, 3139, 3131, 3158, 3156, 3132,
-     3141, 3136, 3133, 3134, 3135,  767,  767,  767,  738, 3157,
-     3154, 3160, 3142, 3162,  767,  767, 3159, 3140, 3161,  738,
-     3163,  738,  738,  767,  738,  738,  738, 3145,  738, 3146,
-      738, 3173, 3155, 3174, 3147, 3175, 3176, 3177, 3178, 3151,
-     3149, 3179, 3180, 3144, 3181, 3150, 3148, 3182, 3164, 3183,
-     3184, 3152, 3185, 3186, 3187, 3172, 3188, 3189, 3190, 3167,
-     3191, 3168, 3192, 3193, 3165, 3194, 3166, 3171, 2865, 3195,
-     3169, 3170, 3196, 3197, 3198, 3199, 3200, 3201, 3202, 3203,
-     3204, 3205, 3206, 3207, 3208, 3209, 3210, 3211, 3212, 2866,
-
-     3213,  376, 3222, 3223,  376, 3224,  376,  376,  376,  376,
-      376,  376,  376, 3225, 3226,  376, 3227,  376,  376,  376,
-      376,  376,  376,  376, 3214, 3228,  376, 3215,  376,  376,
-      376,  376,  376,  376,  376, 3229, 3230,  376, 3232,  376,
-      376,  376,  376,  376,  376, 3233, 3234, 3235,  376, 3216,
-     3236, 3237, 3217,  376,  376,  376,  376, 3218, 3238,  376,
-     3219,  376,  376,  376,  376,  376,  376,  376, 3239, 3240,
-      376, 3241,  376,  376,  376,  376,  376,  376,  376, 3242,
-     3243, 3244, 3245,  376,  376,  376, 3220, 3246, 3247, 3248,
-     3249, 3250, 3251, 3252, 3221, 3253, 3254, 3255, 3256, 3257,
-
-     3258, 3259, 3260, 3261, 3262, 3263, 3264, 3265, 3266, 3267,
-     3268, 3269, 3270, 3271, 3272, 3273, 3274, 3275, 3276, 3277,
-     3278, 3279, 3280, 3281, 3282, 3284, 3285, 3286, 3287, 3231,
-     3283, 3288, 3289, 3290, 3291, 3292, 3293, 3294, 3295, 3296,
-     3297, 3298, 3299, 3300, 3301, 3302, 3303, 3304, 3305, 3306,
-     3307, 3308, 3309, 3310, 3311,  512, 3320, 3321,  512, 3322,
-      512,  512,  512,  512,  512,  512,  512, 3323, 3324,  512,
-     3325,  512,  512,  512,  512,  512,  512,  512, 3312, 3326,
-     3327, 3313,  512,  512,  512,  512, 3328, 3329,  512, 3330,
-      512,  512,  512,  512,  512,  512, 3331, 3332, 3333, 3334,
-
-     3316, 3335, 3336, 3314,  512, 3337, 3315, 3338, 3317,  512,
-      512,  512, 3339, 3340, 3341, 3342, 3343, 3344, 3345, 3346,
-     3347, 3348, 3349, 3350, 3351, 3352, 3318, 3353, 3354, 3355,
-     3356, 3357, 3358, 3359, 3360, 3361, 3362, 3363, 3364, 3367,
-     3365, 3368, 3319, 3366, 3369, 3370, 3371, 3372, 3373, 3374,
-     3375, 3376, 3377, 3378, 3379, 3380, 3381, 3382, 3383, 3384,
-     3385, 3386, 3387, 3388, 3389, 3390, 3391, 3392, 3393, 3394,
-     3395, 3396, 3397, 3398, 3399, 3400, 3401, 3402, 3403, 3404,
-     3405, 3406, 3407, 3408, 3409, 3410, 3411, 3412, 3413, 3414,
-     3415, 3416, 3417, 3418, 3419, 3420, 3421, 3422, 3423, 3424,
-
-     3425, 3426, 3427, 3428, 3429, 3430, 3431, 3432, 3433, 3434,
-     3435, 3436, 3437, 3438, 3439, 3440, 3441, 3442, 3443, 3444,
-     3445, 3446, 3447, 3448, 3449, 3450, 3451, 3452, 3453,  738,
-      738,  738,  738,  738,  738,  738,  738,  738,  738,  738,
-      738,  738,  738,  738,  738,  738,  738,  738,  738, 3454,
-      738,  738,  738,  738,  738, 3457,  738,  767, 3456, 3459,
-     3463, 3479, 3462, 3477, 3466, 3465, 3153,  738, 3478,  738,
-     3481, 3458, 3482,  767, 3455,  767, 3460, 3461,  767, 3480,
-      767,  767,  767, 3476,  767, 3464, 3483, 3154,  738, 3484,
-      738,  738,  738, 3467,  738, 3469, 3485,  738,  738, 3494,
-
-     3495, 3468, 3472, 3475, 3473, 3496, 3470, 3471, 3486, 3497,
-     3498, 3499, 3500, 3501, 3502, 3503, 3474, 3504, 3505, 3506,
-     3507, 3508, 3492, 3509, 3510, 3511, 3513, 3487, 3514, 3515,
-     3516, 3490, 3517, 3491, 3518, 3488, 3489, 3519, 3493, 3520,
-     3521, 3512, 3522, 3523, 3524, 3525, 3526, 3527, 3528, 3529,
-     3530, 3531, 3532,  376, 3541, 3542,  376, 3543,  376,  376,
-      376,  376,  376,  376,  376, 3544, 3545,  376, 3546,  376,
-      376,  376,  376,  376,  376,  376, 3547, 3548,  376, 3549,
-      376,  376,  376,  376,  376,  376, 3550, 3535, 3551, 3552,
-     3536, 3533,  376, 3553, 3534,  376, 3554,  376,  376,  376,
-
-      376,  376,  376,  376, 3555, 3556, 3557, 3558,  376,  376,
-      376, 3559, 3560, 3537, 3564, 3561, 3538, 3565, 3566, 3567,
-     3568, 3569, 3540, 3570, 3571, 3572, 3573, 3574, 3575, 3576,
-     3539, 3562, 3563, 3577, 3578, 3579, 3580, 3581, 3583, 3582,
-     3584, 3585, 3586, 3587, 3588, 3589, 3590, 3591, 3592, 3593,
-     3594, 3595, 3596, 3597, 3598, 3599, 3600, 3601, 3602, 3603,
-     3604, 3605, 3606, 3607, 3608, 3609, 3610, 3611, 3612, 3613,
-     3614, 3615, 3616, 3617, 3618, 3619, 3620, 3621, 3622, 3623,
-     3624, 3625, 3626, 3627, 3628, 3629, 3630, 3631, 3632, 3633,
-      512, 3642, 3643,  512, 3644,  512,  512,  512,  512,  512,
-
-      512,  512, 3645, 3646,  512, 3647,  512,  512,  512,  512,
-      512,  512,  512, 3648, 3649,  512, 3650,  512,  512,  512,
-      512,  512,  512, 3651, 3636, 3652, 3653, 3637, 3634,  512,
-     3654, 3635,  512, 3655,  512,  512,  512,  512,  512,  512,
-     3656, 3657, 3658, 3659, 3660, 3661, 3662, 3663, 3664, 3665,
-     3638, 3666, 3671, 3639, 3672, 3667, 3673, 3674, 3675, 3641,
-     3668, 3676, 3677, 3678, 3679, 3669, 3680, 3640, 3681, 3682,
-     3670, 3683, 3684, 3685, 3686, 3690, 3691, 3692, 3693, 3687,
-     3694, 3695, 3696, 3697, 3688, 3698, 3699, 3700, 3701, 3689,
-     3702, 3703, 3704, 3705, 3706, 3707, 3708, 3709, 3710, 3711,
-
-     3712, 3713, 3714, 3715, 3716, 3717, 3718, 3719, 3720, 3721,
-     3722, 3723, 3724, 3725, 3726, 3727, 3728, 3729, 3730, 3731,
-     3732, 3733, 3734, 3735, 3736, 3737, 3738, 3739, 3740, 3741,
-     3742, 3743, 3744, 3745, 3746, 3747, 3748, 3749, 3750, 3751,
-     3752, 3753, 3754, 3755, 3756, 3757, 3758, 3759, 3760, 3761,
-     3762, 3763, 3764, 3765, 3766, 3767, 3768, 3769, 3770, 3771,
-     3772, 3773, 3774, 3775, 3776, 3777,  738,  738,  738,  738,
-     3778,  738,  738,  738,  738,  738,  738,  738,  738,  738,
-      738,  738,  738,  738,  738,  738,  738,  738,  738, 3801,
-      738,  767,  767,  738, 3779, 3802, 3799, 3800, 3787,  767,
-
-      738,  767, 3781, 3782, 3786,  767, 3803,  767,  767,  738,
-      738, 3806, 3804, 3805, 3783, 3780, 3784,  767, 3785,  738,
-     3816, 3798, 3807,  738,  738, 3808,  738,  738, 3817, 3818,
-     3819, 3820, 3821, 3822, 3809, 3789, 3823, 3824, 3825, 3826,
-     3827, 3788, 3792, 3791, 3795, 3794, 3790, 3828, 3812, 3810,
-     3793, 3797, 3813, 3829, 3830, 3831, 3833, 3834, 3811, 3835,
-     3796, 3836, 3837, 3838, 3814, 3839, 3815, 3840, 3832, 3841,
-     3842, 3843, 3844, 3845, 3846, 3847, 3848, 3849, 3850, 3851,
-      376, 3860, 3861,  376, 3862,  376,  376,  376,  376,  376,
-      376,  376, 3863, 3864,  376, 3865,  376,  376,  376,  376,
-
-      376,  376,  376, 3866, 3867,  376, 3868,  376,  376,  376,
-      376,  376,  376, 3869, 3870, 3871, 3872,  376, 3852, 3873,
-      376, 3853,  376,  376,  376,  376,  376,  376, 3874, 3854,
-     3875, 3876, 3855, 3877, 3878, 3879, 3880, 3881, 3882, 3883,
-     3856, 3884, 3885, 3857, 3858, 3886, 3887, 3888, 3889, 3890,
-     3891, 3892, 3859, 3893, 3894, 3895, 3896, 3897, 3898, 3899,
-     3900, 3901, 3902, 3903, 3904, 3905, 3906, 3907, 3908, 3909,
-     3910, 3911, 3912, 3913, 3914, 3915, 3916, 3917, 3918, 3919,
-     3920, 3921, 3922, 3923, 3924, 3925, 3926, 3927, 3928, 3929,
-     3930, 3931, 3932, 3933, 3934, 3935, 3936, 3937, 3938, 3939,
-
-     3940, 3941, 3942, 3943, 3944, 3945, 3946, 3947, 3948, 3949,
-     3950, 3951,  512, 3960, 3961,  512, 3962,  512,  512,  512,
-      512,  512,  512,  512, 3963, 3964,  512, 3965,  512,  512,
-      512,  512,  512,  512,  512, 3966, 3967,  512, 3968,  512,
-      512,  512,  512,  512,  512, 3969, 3970, 3971, 3972,  512,
-     3952, 3973,  512, 3953,  512,  512,  512,  512,  512,  512,
-     3974, 3954, 3975, 3976, 3955, 3977, 3978, 3979, 3980, 3981,
-     3982, 3983, 3956, 3984, 3985, 3957, 3958, 3986, 3987, 3989,
-     3990, 3991, 3992, 3993, 3959, 3994, 3988, 3995, 3996, 3997,
-     3998, 3999, 4000, 4001, 4002, 4003, 4004, 4005, 4006, 4007,
-
-     4009, 4010, 4011, 4012, 4013, 4014, 4015, 4008, 4016, 4017,
-     4019, 4021, 4022, 4018, 4023, 4024, 4025, 4026, 4027, 4020,
-     4028, 4029, 4030, 4031, 4032, 4033, 4034, 4035, 4036, 4037,
-     4038, 4039, 4040, 4041, 4042, 4043, 4044, 4045, 4046, 4047,
-     4048, 4049, 4050, 4051, 4052, 4053, 4054, 4055, 4056, 4057,
-     4058, 4059, 4060, 4061, 4062, 4063, 4064, 4065, 4066, 4067,
-     4068, 4069, 4070, 4071, 4072, 4073, 4074, 4075, 4076, 4077,
-     4078, 4079, 4080, 4081, 4082, 4083, 4084, 4085, 4086, 4087,
-     4088, 4089, 4090, 4091, 4092, 4093, 4094, 4095, 4096, 4097,
-     4098,  738,  738,  738,  738,  738,  738,  738,  738,  738,
-
-      738,  738,  738,  738,  738,  738,  738,  738,  738,  738,
-      738,  738,  767,  738,  767,  767,  767, 4117, 4103, 4118,
-     4119, 4120,  767, 4105,  767, 4124,  767, 4121,  738, 4122,
-     4123, 4099, 4102, 4100, 4101,  738,  767, 4104, 4116,  738,
-      738,  738,  738,  738,  738, 4134, 4135, 4125, 4136, 4137,
-     4138, 4106, 4139, 4109, 4140, 4110, 4141, 4133, 4113, 4112,
-     4142, 4114, 4143, 4145, 4146, 4128, 4129, 4107, 4108, 4147,
-     4149, 4150, 4151, 4152, 4115, 4126, 4111, 4153, 4154, 4127,
-     4155, 4156, 4130, 4131, 4132, 4157, 4158, 4159, 4160, 4161,
-     4148, 4162, 4163, 4164, 4165, 4166, 4167,  376, 4176, 4177,
-
-     4178, 4179,  376,  376,  376,  376, 4144, 4180,  376, 4181,
-      376,  376,  376,  376,  376,  376,  376, 4182, 4183, 4184,
-      376,  376,  376,  376, 4168,  376,  376,  376,  376, 4185,
-     4186,  376, 4169,  376,  376,  376,  376,  376,  376, 4187,
-     4188, 4189, 4190,  376, 4191, 4192, 4170, 4172,  376,  376,
-      376, 4193, 4194, 4195, 4171, 4173, 4196, 4197, 4198, 4199,
-     4200, 4201, 4202, 4174, 4203, 4204, 4205, 4206, 4175, 4207,
-     4208, 4209, 4210, 4211, 4213, 4214, 4215, 4216, 4217, 4218,
-     4212, 4219, 4220, 4221, 4222, 4223, 4224, 4225, 4226, 4227,
-     4228, 4229, 4230, 4231, 4232, 4233, 4234, 4235, 4236, 4237,
-
-     4238, 4239, 4240, 4241, 4242, 4243, 4244, 4245, 4246, 4247,
-     4248, 4249, 4250, 4251, 4252, 4253, 4254, 4255, 4256, 4257,
-     4258, 4259, 4260, 4261, 4262, 4263, 4264, 4265, 4266, 4267,
-      512, 4276, 4277,  512, 4278,  512,  512,  512,  512,  512,
-      512,  512, 4279, 4280,  512, 4281,  512,  512,  512,  512,
-      512,  512, 4282, 4283, 4284, 4285,  512, 4268, 4286,  512,
-     4269,  512,  512,  512,  512,  512,  512,  512, 4287, 4288,
-      512, 4289,  512,  512,  512,  512,  512,  512, 4290, 4270,
-     4291, 4292, 4271, 4272, 4293, 4294, 4273, 4295, 4296, 4297,
-     4298, 4299, 4300, 4301, 4302, 4275, 4303, 4304, 4305, 4274,
-
-     4306, 4307, 4308, 4309, 4310, 4311, 4312, 4313, 4314, 4315,
-     4316, 4317, 4318, 4319, 4320, 4321, 4322, 4323, 4324, 4325,
-     4326, 4327, 4328, 4329, 4330, 4331, 4332, 4333, 4335, 4336,
-     4337, 4338, 4339, 4340, 4341, 4334, 4342, 4343, 4344, 4345,
-     4346, 4347, 4348, 4349, 4350, 4351, 4352, 4353, 4354, 4355,
-     4356, 4357, 4358, 4359, 4360, 4361, 4362, 4363, 4364, 4365,
-     4366, 4367, 4368, 4369, 4370, 4371, 4372, 4373, 4374, 4375,
-     4376, 4377, 4378, 4379, 4380, 4381, 4382, 4383, 4384, 4385,
-     4386, 4387, 4388, 4389, 4390, 4391, 4392, 4393, 4394, 4395,
-     4396, 4397, 4398, 4399, 4400, 4401, 4402, 4403, 4404, 4405,
-
-     4406, 4407, 4408, 4409,  738,  738,  738,  738,  738,  738,
-      738,  738,  738,  738,  738,  738,  738,  738,  738,  738,
-      738, 4423,  738, 4426, 4427,  738,  767,  767, 4430,  767,
-      767, 4428, 4429, 4431,  767, 4432,  767, 4419,  738,  767,
-     4433, 4414, 4424, 4410,  738, 4411, 4412, 4413,  767,  738,
-      738,  738, 4434,  738,  738, 4443,  738, 4444, 4445, 4425,
-     4446, 4447, 4448, 4449, 4450, 4418, 4451, 4143, 4452, 4453,
-     4454, 4147, 4422, 4455, 4456, 4457, 4415, 4458, 4435, 4459,
-     4417, 4420, 4416, 4421, 4436, 4441, 4460, 4461, 4442, 4437,
-     4438, 4439, 4148, 4440, 4462, 4463, 4464, 4465, 4466, 4467,
-
-     4468, 4469,  376, 4478, 4479,  376, 4480,  376,  376,  376,
-      376,  376,  376,  376, 4481, 4482,  376, 4483,  376,  376,
-      376,  376,  376,  376,  376, 4484, 4485, 4486, 4487,  376,
-      376,  376, 4488, 4489, 4470, 4490, 4491, 4471, 4492,  376,
-     4472, 4493,  376, 4473,  376,  376,  376,  376,  376,  376,
-     4494, 4495,  376, 4496, 4497, 4498, 4474,  376,  376,  376,
-     4499, 4500, 4501, 4502, 4503, 4504, 4505, 4476, 4506, 4507,
-     4508, 4475, 4509, 4510, 4511, 4512, 4513, 4514, 4515, 4516,
-     4517, 4518, 4519, 4520, 4521, 4522, 4523, 4524, 4525, 4477,
-     4526, 4527, 4528, 4529, 4530, 4531, 4532, 4533, 4534, 4535,
-
-     4536, 4537, 4538, 4539, 4540, 4541, 4542, 4543, 4544, 4545,
-     4546, 4547, 4548, 4550, 4551, 4552, 4553, 4554, 4555, 4556,
-     4557, 4549, 4559, 4560, 4561, 4562, 4558, 4563, 4564, 4565,
-     4566, 4567, 4568, 4569,  512, 4578, 4579,  512, 4580,  512,
-      512,  512,  512,  512,  512,  512, 4581, 4582,  512, 4583,
-      512,  512,  512,  512,  512,  512,  512, 4584, 4585, 4586,
-     4587,  512,  512,  512, 4588, 4589, 4570, 4590, 4591, 4571,
-     4592,  512, 4572, 4593,  512, 4573,  512,  512,  512,  512,
-      512,  512, 4594, 4595,  512, 4596, 4597, 4598, 4574,  512,
-      512,  512, 4599, 4600, 4601, 4602, 4603, 4604, 4605, 4576,
-
-     4606, 4607, 4608, 4575, 4609, 4610, 4611, 4612, 4613, 4614,
-     4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624,
-     4625, 4577, 4626, 4627, 4628, 4629, 4630, 4631, 4632, 4633,
-     4634, 4635, 4636, 4637, 4638, 4639, 4640, 4641, 4642, 4643,
-     4644, 4645, 4646, 4647, 4648, 4649, 4650, 4651, 4653, 4654,
-     4655, 4656, 4657, 4658, 4659, 4660, 4661, 4662, 4663, 4664,
-     4665, 4666, 4667, 4668, 4669, 4670, 4652, 4671, 4672, 4673,
-     4674, 4675, 4676, 4677, 4678, 4679, 4680, 4681, 4682, 4683,
-     4684, 4685, 4686, 4687, 4688, 4689, 4690, 4691, 4692, 4693,
-     4694, 4695, 4696, 4697, 4698, 4699, 4700, 4701, 4702, 4703,
+     2886, 2889, 2891, 2890, 2892, 2893, 2894, 2895, 2902, 2903,
+     2904,  537, 2905, 2887,  537, 2888,  537,  537,  537,  537,
+      537,  537,  537, 2906, 2907,  537, 2908,  537,  537,  537,
+      537,  537,  537,  537, 2909, 2910,  537, 2911,  537,  537,
+      537,  537,  537,  537, 2912, 2913, 2896, 2914, 2915, 2897,
+
+     2916, 2917, 2918, 2919, 2920, 2921, 2922, 2898, 2901, 2923,
+     2899, 2924, 2925, 2926, 2927, 2928, 2929, 2930, 2900, 2931,
+     2932, 2933, 2934, 2935, 2936, 2937, 2938, 2939, 2940, 2941,
+     2942, 2943, 2944, 2945, 2946, 2947, 2948, 2949, 2950, 2951,
+     2952, 2953, 2954, 2955, 2956, 2957, 2958, 2959, 2960, 2961,
+     2962, 2963, 2964, 2965, 2966, 2967, 2968, 2969, 2970, 2971,
+     2972, 2973, 2974, 2975, 2976, 2977, 2978, 2979, 2980, 2981,
+     2982, 2983, 2984, 2985, 2986, 2987, 2988, 2989, 2990, 2991,
+     2992, 2993, 2994, 2995, 2996, 2997, 2998, 2999, 3000, 3001,
+     3002, 3003, 3004, 3005, 3006,  734,  734,  734,  734,  734,
+
+      734,  734,  734,  734,  734, 3007,  734,  734,  734, 2715,
+      734,  734,  734,  734,  734,  734, 3016, 2717,  734,  734,
+      734,  734, 3014,  734, 3025,  734,  734, 3008,  734, 2716,
+     3009, 3044, 3013, 3010, 3011, 3012,  734, 2718,  734, 3015,
+     2727,  734, 3028,  734, 3026,  762,  762,  762, 3031, 3032,
+     3033,  762,  762, 3036, 3034, 3035,  734, 3019,  734,  734,
+     2728,  734, 3029,  762, 3017,  734, 3045,  734, 3023, 3020,
+     3046, 3022, 3047, 3018, 3030, 3048, 3037, 3021, 3049, 3050,
+     3051, 3052, 3053, 3054, 3055, 3024, 3056, 3057, 3058, 3059,
+     3027, 3060, 2763, 3061, 2766, 3066, 3067, 3068, 3038, 3069,
+
+     3039, 3040, 3070, 3041, 3043, 3071, 3072, 3042, 3073, 3074,
+     3075, 3076, 2764, 3062, 2767, 3077, 3078, 3079, 3080,  365,
+     3087, 3088,  365, 3089,  365,  365,  365,  365,  365,  365,
+      365, 3090, 3091,  365, 3092,  365,  365,  365,  365,  365,
+      365, 3081,  365, 3093, 3082, 3063, 3094,  365,  365,  365,
+     3064, 3065, 3083,  365, 3095, 3084,  365, 3096,  365,  365,
+      365,  365,  365,  365, 3085, 3097, 3098, 3099, 3100, 3101,
+     3102, 3103, 3104, 3105, 3107, 3108, 3109, 3110, 3111, 3112,
+     3106, 3113, 3114, 3115, 3116, 3117, 3118, 3119, 3120, 3086,
+     3121, 3122, 3123, 3124, 3125, 3126, 3127, 3128, 3129, 3130,
 
-     4704, 4705, 4706, 4707, 4708,  738,  738,  738,  738,  738,
-      738,  738,  738,  738,  738,  738,  738,  738, 4423,  738,
-      738,  738, 4719,  767, 4720,  767, 4721, 4722, 4723,  767,
-     4725, 4713,  767,  767, 4709, 4710, 4711, 4419,  767, 4424,
-     4724,  767, 4712,  767,  738,  738,  738, 4726,  738,  738,
-      738,  738,  738, 4736,  738, 4737, 4738, 4739, 4740, 4717,
-     4715, 4741, 4742, 4743, 4714, 4716, 4744, 4745, 4746, 4747,
-     4748, 4749, 4750, 4718, 4728, 4729, 4751, 4752, 4753, 4732,
-     4733, 4735, 4754, 4727, 4755, 4756, 4734, 4757, 4730, 4731,
-     4758, 4759,  376, 4767, 4768,  376, 4769,  376,  376,  376,
-
-      376,  376,  376,  376, 4770, 4771,  376, 4772,  376,  376,
-      376,  376,  376,  376, 4773, 4774,  376, 4760, 4775,  376,
-     4761,  376,  376,  376,  376,  376,  376,  376, 4776, 4777,
-     4778, 4779,  376,  376,  376, 4762, 4780, 4781, 4763, 4782,
-      376, 4764, 4783, 4784, 4765,  376,  376,  376, 4785, 4788,
-     4789, 4790, 4791, 4792, 4793, 4794, 4795, 4796, 4797, 4798,
-     4786, 4799, 4800, 4787, 4766, 4801, 4802, 4803, 4804, 4805,
-     4806, 4807, 4808, 4809, 4810, 4811, 4812, 4813, 4814, 4815,
-     4816, 4817, 4818, 4819, 4820, 4821, 4822, 4823, 4824, 4825,
-     4826, 4827, 4828, 4829, 4830, 4831, 4832, 4833, 4834, 4835,
-
-     4836, 4837, 4838, 4839, 4840, 4841, 4842, 4843, 4844, 4845,
-     4846, 4847, 4848, 4849, 4850, 4851, 4852, 4853, 4854, 4855,
-      512, 4863, 4864,  512, 4865,  512,  512,  512,  512,  512,
-      512,  512, 4866, 4867,  512, 4868,  512,  512,  512,  512,
-      512,  512, 4869, 4870,  512, 4856, 4871,  512, 4857,  512,
-      512,  512,  512,  512,  512,  512, 4872, 4873, 4875, 4876,
-      512,  512,  512, 4858, 4874, 4877, 4859, 4878,  512, 4860,
-     4879, 4880, 4861,  512,  512,  512, 4881, 4882, 4883, 4884,
-     4885, 4886, 4887, 4888, 4889, 4890, 4891, 4892, 4893, 4894,
-     4895, 4896, 4862, 4897, 4898, 4899, 4900, 4901, 4903, 4904,
-
-     4905, 4906, 4907, 4908, 4909, 4910, 4911, 4912, 4913, 4914,
-     4915, 4916, 4902, 4917, 4919, 4920, 4921, 4922, 4923, 4924,
-     4925, 4926, 4927, 4928, 4929, 4930, 4931, 4932, 4918, 4933,
-     4934, 4935, 4936, 4937, 4938, 4939, 4940, 4941, 4942, 4943,
+     3131, 3132, 3133, 3134, 3135, 3136, 3137, 3138, 3139, 3140,
+     3141, 3142, 3143, 3144, 3145, 3146, 3147, 3148, 3149, 3150,
+     3151, 3152, 3153, 3154, 3155, 3156, 3157, 3158, 3159, 3160,
+     3161, 3163, 3164, 3165, 3166, 3167, 3162, 3168, 3169, 3170,
+     3171, 3172, 3173, 3174, 3175, 3176, 3177, 3178, 3179, 3180,
+     3181, 3182, 3183, 3184, 3185, 3186, 3187, 3188, 3189, 3190,
+     3191, 3192, 3193, 3194,  537, 3201, 3202,  537, 3203,  537,
+      537,  537,  537,  537,  537,  537, 3204, 3205,  537, 3206,
+      537,  537,  537,  537,  537,  537, 3195,  537, 3207, 3196,
+     3208, 3209,  537,  537,  537, 3210,  537, 3197, 3211, 3212,
+
+     3198,  537,  537,  537, 3213, 3214, 3215, 3216, 3217, 3199,
+     3218, 3219, 3220, 3221, 3222, 3223, 3224, 3225, 3226, 3227,
+     3228, 3229, 3230, 3231, 3232, 3233, 3234, 3235, 3236, 3237,
+     3238, 3239, 3200, 3240, 3241, 3242, 3243, 3244, 3245, 3246,
+     3247, 3248, 3249, 3250, 3251, 3252, 3253, 3254, 3255, 3256,
+     3257, 3258, 3259, 3260, 3261, 3262, 3263, 3264, 3265, 3266,
+     3267, 3268, 3269, 3270, 3271, 3272, 3273, 3274, 3275, 3276,
+     3277, 3278, 3279, 3280, 3281, 3282, 3283, 3284, 3285, 3286,
+     3287, 3288, 3289, 3290, 3291, 3292, 3293, 3294, 3295, 3296,
+     3297, 3298, 3299, 3300, 3301, 3302, 3303, 3304, 3305,  734,
+
+      734,  734,  734,  734,  734,  734,  734,  734,  734,  734,
+      734,  734,  734,  734,  734,  734, 3025,  734, 3306,  734,
+      734,  734, 3323,  734, 3309, 3028,  734, 3308, 3311, 3312,
+     3313, 3314,  734, 3329, 3330,  734, 3026, 3331, 3332, 3310,
+     3333, 3307, 3324,  762,  762, 3029,  734,  762,  762,  762,
+      762,  734,  734, 3334,  734,  734, 3316, 3315,  734, 3342,
+     3328, 3343, 3344, 3318, 3319, 3317, 3321, 3322, 3345, 3346,
+     3347, 3351, 3352, 3335, 3325, 3353, 3320, 3354, 3355, 3326,
+     3327, 3348, 3341, 3336, 3357, 3349, 3350, 3358, 3337, 3338,
+     3061, 3339, 3340, 3359, 3356, 3360, 3361, 3362, 3363, 3364,
+
+     3365, 3366, 3367, 3368, 3369, 3370, 3371, 3372, 3373, 3374,
+     3062, 3375, 3376,  365, 3383, 3384,  365, 3385,  365,  365,
+      365,  365,  365,  365,  365, 3386, 3387,  365, 3388,  365,
+      365,  365,  365,  365,  365,  365, 3389, 3390,  365, 3391,
+      365,  365,  365,  365,  365,  365, 3392, 3393, 3394, 3377,
+     3395, 3396, 3378, 3397, 3398, 3399, 3400, 3401, 3402, 3403,
+     3379, 3404, 3405, 3380, 3406, 3410, 3411, 3412, 3407, 3413,
+     3414, 3381, 3415, 3416, 3382, 3417, 3418, 3419, 3420, 3421,
+     3408, 3409, 3422, 3423, 3424, 3425, 3426, 3427, 3428, 3429,
+     3430, 3431, 3432, 3433, 3434, 3435, 3436, 3437, 3438, 3439,
+
+     3440, 3442, 3441, 3443, 3444, 3445, 3446, 3447, 3448, 3449,
+     3450, 3451, 3452, 3453, 3454, 3455, 3456, 3457, 3458, 3459,
+     3460, 3461, 3462, 3463, 3464, 3465, 3466, 3467, 3468, 3469,
+     3470, 3471, 3472, 3473, 3474, 3475, 3476, 3477, 3478, 3479,
+     3480, 3481, 3482, 3483, 3484, 3485, 3486, 3487, 3488, 3489,
+     3490, 3491,  537, 3498, 3499,  537, 3500,  537,  537,  537,
+      537,  537,  537,  537, 3501, 3502,  537, 3503,  537,  537,
+      537,  537,  537,  537,  537, 3504, 3505,  537, 3506,  537,
+      537,  537,  537,  537,  537, 3507, 3508, 3509, 3492, 3510,
+     3511, 3493, 3512, 3513, 3514, 3515, 3516, 3517, 3518, 3494,
+
+     3519, 3520, 3495, 3525, 3521, 3526, 3527, 3528, 3529, 3522,
+     3496, 3530, 3531, 3497, 3523, 3532, 3533, 3534, 3535, 3524,
+     3536, 3537, 3538, 3539, 3540, 3541, 3542, 3543, 3544, 3545,
+     3546, 3547, 3548, 3549, 3550, 3551, 3552, 3553, 3554, 3555,
+     3556, 3557, 3558, 3559, 3560, 3561, 3562, 3563, 3564, 3565,
+     3566, 3567, 3568, 3569, 3570, 3571, 3572, 3573, 3574, 3575,
+     3576, 3577, 3578, 3579, 3580, 3581, 3582, 3583, 3584, 3585,
+     3586, 3587, 3588, 3589, 3590, 3591, 3592, 3593, 3594, 3595,
+     3596, 3597, 3598, 3599, 3600, 3601, 3602, 3603,  734,  734,
+      734,  734, 3604,  734,  734,  734,  734,  734,  734,  734,
+
+      734,  734,  734,  734,  734,  734, 3323,  734,  734,  734,
+      734,  734,  734,  734,  762, 3605,  734, 3609, 3625,  762,
+     3608,  762,  734, 3626,  762, 3627, 3324,  762, 3628,  762,
+      734, 3629, 3607, 3630, 3606,  734, 3638,  734,  734, 3639,
+     3632, 3631, 3640, 3641, 3624, 3642, 3633, 3643, 3610, 3644,
+     3645, 3614, 3611, 3612, 3617, 3622, 3646, 3613, 3616, 3634,
+     3619, 3635, 3636, 3615, 3647, 3620, 3621, 3648, 3637, 3649,
+     3618, 3650, 3623, 3652, 3655, 3656, 3657, 3658, 3659, 3660,
+     3661, 3662, 3663, 3664, 3651, 3665, 3666, 3667, 3668, 3669,
+     3670, 3671,  365, 3653, 3678,  365, 3679,  365,  365,  365,
+
+      365,  365,  365,  365, 3680, 3681,  365, 3682,  365,  365,
+      365,  365,  365,  365,  365, 3683, 3684,  365, 3685,  365,
+      365,  365,  365,  365,  365, 3686, 3687, 3688, 3672, 3689,
+     3654, 3673, 3690, 3691, 3692, 3693, 3694, 3695, 3696, 3674,
+     3697, 3698, 3675, 3677, 3699, 3700, 3701, 3702, 3703, 3704,
+     3676, 3705, 3706, 3707, 3708, 3709, 3710, 3711, 3712, 3713,
+     3714, 3715, 3716, 3717, 3718, 3719, 3720, 3721, 3722, 3723,
+     3724, 3725, 3726, 3727, 3728, 3729, 3730, 3731, 3732, 3733,
+     3734, 3735, 3736, 3737, 3738, 3739, 3740, 3741, 3742, 3743,
+     3744, 3745, 3746, 3747, 3748, 3749, 3750, 3751, 3752, 3753,
+
+     3754, 3755, 3756, 3757, 3758, 3759, 3760, 3761, 3762, 3763,
+     3764, 3765, 3766, 3767, 3768, 3769, 3770, 3771, 3772, 3773,
+     3774, 3775, 3776, 3777, 3778, 3779, 3780, 3781, 3782, 3783,
+     3784,  537, 3791, 3792,  537, 3793,  537,  537,  537,  537,
+      537,  537,  537, 3794, 3795,  537, 3796,  537,  537,  537,
+      537,  537,  537,  537, 3797, 3798,  537, 3799,  537,  537,
+      537,  537,  537,  537, 3800, 3801, 3802, 3785, 3803, 3804,
+     3786, 3805, 3806, 3807, 3808, 3809, 3810, 3811, 3787, 3812,
+     3813, 3788, 3790, 3814, 3815, 3816, 3818, 3819, 3820, 3789,
+     3821, 3822, 3823, 3817, 3824, 3825, 3826, 3827, 3828, 3829,
+
+     3830, 3832, 3833, 3834, 3831, 3835, 3836, 3837, 3838, 3839,
+     3840, 3841, 3842, 3843, 3844, 3845, 3846, 3847, 3848, 3849,
+     3850, 3851, 3852, 3853, 3854, 3855, 3856, 3857, 3858, 3859,
+     3860, 3861, 3862, 3863, 3864, 3865, 3866, 3867, 3868, 3869,
+     3870, 3871, 3872, 3873, 3874, 3875, 3876, 3877, 3878, 3879,
+     3880, 3881, 3882, 3883, 3884, 3885, 3886, 3887, 3888, 3889,
+     3890, 3891, 3892, 3893, 3894, 3895, 3896, 3897,  734,  734,
+      734,  734,  734,  734,  734,  734,  734,  734,  734,  734,
+      734,  734,  734,  734,  734, 3912,  734,  734,  734,  734,
+      762, 3931,  762,  762, 3918, 3900, 3919, 3920,  762,  762,
+
+      734, 3923, 3921, 3922, 3932, 3913, 3898,  762, 3899,  734,
+      734, 3933,  734,  734,  734, 3917,  734, 3934, 3935, 3936,
+     3937, 3901, 3938, 3903, 3904, 3939, 3902, 3941, 3908, 3907,
+     3942, 3909, 3910, 3924, 3943, 3944, 3652, 3946, 3947, 3948,
+     3905, 3951, 3914, 3915, 3952, 3911, 3906, 3925, 3926, 3916,
+     3927, 3928, 3929, 3953, 3930, 3945, 3653, 3954, 3955, 3949,
+     3956, 3957, 3958, 3959, 3960, 3961, 3962, 3940, 3963, 3964,
+     3965,  365, 3972, 3973,  365, 3974,  365,  365,  365,  365,
+      365,  365,  365, 3975, 3976,  365, 3977,  365,  365,  365,
+      365,  365,  365, 3978, 3979, 3980, 3950, 3966,  365, 3981,
+
+     3967, 3982, 3983,  365,  365,  365, 3984,  365, 3968, 3985,
+     3986, 3969,  365,  365,  365, 3987, 3988, 3989, 3990, 3991,
+     3992, 3993, 3994, 3995, 3970, 3996, 3997, 3998, 3999, 4000,
+     4001, 4002, 4003, 4004, 4005, 4006, 4007, 4008, 3971, 4009,
+     4010, 4011, 4012, 4013, 4014, 4015, 4016, 4017, 4018, 4019,
+     4020, 4021, 4022, 4023, 4025, 4026, 4027, 4028, 4029, 4030,
+     4024, 4031, 4032, 4033, 4034, 4035, 4036, 4037, 4038, 4039,
+     4040, 4041, 4042, 4043, 4044, 4045, 4046, 4047, 4048, 4049,
+     4050, 4051, 4052, 4053, 4054, 4055, 4056, 4057, 4058, 4059,
+     4060, 4061, 4062, 4063, 4064, 4065, 4066, 4067, 4068, 4069,
+
+     4070, 4071, 4072, 4073, 4074, 4075, 4076,  537, 4083, 4084,
+      537, 4085,  537,  537,  537,  537,  537,  537,  537, 4086,
+     4087,  537, 4088,  537,  537,  537,  537,  537,  537, 4089,
+     4090, 4091,  537, 4077, 4092,  537, 4078,  537,  537,  537,
+      537,  537,  537, 4093, 4079, 4094, 4095, 4080, 4096, 4097,
+     4098, 4099, 4100, 4101, 4102, 4103, 4104, 4105, 4081, 4106,
+     4107, 4108, 4109, 4110, 4111, 4112, 4082, 4113, 4114, 4115,
+     4116, 4117, 4118, 4119, 4120, 4121, 4122, 4123, 4125, 4126,
+     4127, 4128, 4129, 4130, 4131, 4124, 4132, 4133, 4134, 4135,
+     4136, 4137, 4138, 4139, 4140, 4141, 4142, 4143, 4144, 4145,
+
+     4146, 4147, 4148, 4149, 4150, 4151, 4152, 4153, 4154, 4155,
+     4156, 4157, 4158, 4159, 4160, 4161, 4162, 4163, 4164, 4165,
+     4166, 4167, 4168, 4169, 4170, 4171, 4172, 4173, 4174, 4175,
+     4176, 4177, 4178, 4179, 4180, 4181, 4182, 4183, 4184, 4185,
+      734,  734,  734,  734,  734,  734,  734,  734,  734,  734,
+      734,  734,  734, 4199,  734, 3912,  734,  734,  734,  734,
+     4203,  734,  734, 4207, 4208, 4209, 4212,  762, 4194,  762,
+      762,  762, 4187, 4200,  734, 3913, 4210, 4186, 4211,  734,
+     4204,  734,  762,  734,  762,  734, 4188,  734,  734, 4220,
+     4221, 4190, 4222, 4189, 4193, 4223, 4224, 4225, 4226, 4206,
+
+     4213, 4201, 4198, 4227, 3939, 4228, 4202, 4219, 4191, 4197,
+     4195, 4196, 3944, 4229, 4192, 4230, 3948, 4205, 4232, 4214,
+     4233, 4215, 4234, 4216, 4235, 4217, 4218, 4236, 4237, 4238,
+     4239, 4240, 3945, 4241, 4242, 4231, 3949, 4243, 4244, 4245,
+      365, 4252, 4253,  365, 4254,  365,  365,  365,  365,  365,
+      365,  365, 4255, 4256,  365, 4257,  365,  365,  365,  365,
+      365,  365,  365, 4258, 4259, 4260, 4261,  365,  365,  365,
+      365, 4246, 4262, 4263, 4247,  365,  365,  365, 4264, 4265,
+     4266, 4267, 4248, 4268, 4269, 4249, 4270, 4271, 4272, 4273,
+     4274, 4275, 4276, 4250, 4251, 4277, 4278, 4279, 4280, 4281,
+
+     4282, 4283, 4284, 4285, 4286, 4287, 4288, 4289, 4290, 4291,
+     4292, 4293, 4294, 4295, 4296, 4297, 4298, 4299, 4300, 4301,
+     4302, 4303, 4304, 4305, 4306, 4307, 4308, 4309, 4310, 4311,
+     4312, 4313, 4314, 4315, 4316, 4317, 4318, 4319, 4320, 4321,
+     4322, 4323, 4324, 4325, 4326, 4327, 4328, 4329, 4330, 4331,
+     4332, 4333, 4334, 4335, 4336, 4337, 4338, 4339, 4341, 4342,
+     4343, 4344, 4345, 4340, 4346, 4347, 4348, 4349, 4350, 4351,
+     4352, 4353, 4354,  537, 4361, 4362,  537, 4363,  537,  537,
+      537,  537,  537,  537,  537, 4364, 4365,  537, 4366,  537,
+      537,  537,  537,  537,  537,  537, 4367, 4368, 4369, 4370,
+
+      537,  537,  537,  537, 4355, 4371, 4372, 4356,  537,  537,
+      537, 4373, 4374, 4375, 4376, 4357, 4377, 4378, 4358, 4379,
+     4380, 4381, 4382, 4383, 4384, 4385, 4359, 4360, 4386, 4387,
+     4388, 4389, 4390, 4391, 4392, 4393, 4394, 4395, 4396, 4397,
+     4398, 4399, 4400, 4401, 4402, 4403, 4404, 4405, 4406, 4407,
+     4408, 4409, 4410, 4411, 4412, 4413, 4414, 4415, 4416, 4417,
+     4418, 4419, 4420, 4421, 4422, 4423, 4424, 4425, 4426, 4427,
+     4428, 4429, 4430, 4431, 4432, 4433, 4434, 4435, 4436, 4437,
+     4438, 4439, 4440, 4441, 4442, 4443, 4444, 4445, 4446, 4447,
+     4448, 4449, 4450, 4451, 4452, 4453, 4454, 4455, 4456, 4457,
+
+     4458, 4459, 4460,  734,  734,  734,  734,  734,  734,  734,
+      734,  734,  734,  734,  734,  734,  734, 4199,  734,  734,
+     4471,  734, 4203,  734,  734, 4462,  734,  734,  734, 4474,
+      762, 4461, 4194, 4475,  762, 4476,  762, 4200, 4477,  762,
+     4472, 4479, 4204, 4478,  762,  734, 4487,  734,  734,  762,
+      734,  734,  734, 4468, 4488, 4467, 4464, 4489, 4465, 4466,
+     4490, 4491, 4492, 4493, 4480, 4494, 4495, 4496, 4230, 4463,
+     4469, 4473, 4497, 4481, 4470, 4482, 4483, 4498, 4484, 4485,
+     4499, 4500, 4501, 4502, 4503, 4486, 4504, 4505, 4231, 4506,
+     4507, 4508, 4509,  365, 4516, 4517,  365, 4518,  365,  365,
+
+      365,  365,  365,  365,  365, 4519, 4520,  365, 4521,  365,
+      365,  365,  365,  365,  365, 4522,  365, 4510, 4523,  365,
+     4511,  365,  365,  365,  365,  365,  365, 4524, 4512, 4525,
+     4526, 4513, 4527, 4528, 4529, 4530, 4531, 4532, 4533, 4534,
+     4514, 4535, 4536, 4537, 4540, 4541, 4542, 4543, 4544, 4545,
+     4546, 4547, 4548, 4549, 4515, 4538, 4550, 4551, 4539, 4552,
+     4553, 4554, 4555, 4556, 4557, 4558, 4559, 4560, 4561, 4562,
+     4563, 4564, 4565, 4566, 4567, 4568, 4569, 4570, 4571, 4572,
+     4573, 4574, 4575, 4576, 4577, 4578, 4579, 4580, 4581, 4582,
+     4583, 4584, 4585, 4586, 4587, 4588, 4589, 4590, 4591, 4592,
+
+     4593, 4594, 4595, 4596, 4597, 4598, 4599, 4600, 4601, 4602,
+     4603, 4604, 4605, 4606, 4607, 4608, 4609, 4610, 4611, 4612,
+     4613, 4614, 4615, 4616,  537, 4623, 4624,  537, 4625,  537,
+      537,  537,  537,  537,  537,  537, 4626, 4627,  537, 4628,
+      537,  537,  537,  537,  537,  537, 4629,  537, 4617, 4630,
+      537, 4618,  537,  537,  537,  537,  537,  537, 4631, 4619,
+     4632, 4633, 4620, 4634, 4635, 4636, 4637, 4639, 4640, 4641,
+     4642, 4621, 4643, 4638, 4644, 4645, 4646, 4647, 4648, 4649,
+     4650, 4651, 4652, 4653, 4654, 4622, 4655, 4656, 4657, 4658,
+     4659, 4660, 4661, 4662, 4663, 4664, 4665, 4666, 4667, 4668,
+
+     4669, 4670, 4671, 4672, 4673, 4674, 4675, 4676, 4677, 4678,
+     4679, 4680, 4681, 4682, 4683, 4685, 4686, 4687, 4684, 4688,
+     4689, 4690, 4691, 4692, 4693, 4694, 4695, 4696, 4697, 4698,
+     4699, 4700, 4701, 4702, 4703, 4704, 4705, 4706, 4707, 4708,
+     4709, 4710, 4711, 4712, 4713, 4714, 4715, 4716, 4717, 4718,
+     4719, 4720,  734,  734,  734,  734,  734,  734,  734,  734,
+      734,  734, 4471,  734,  734, 4732, 4733, 4734,  734, 4735,
+     4736,  734,  734,  762,  762,  762,  762,  762,  762, 4737,
+      734,  734, 4472,  734,  734, 4721, 4744, 4722, 4745, 4746,
+     4747,  734, 4748, 4749, 4754, 4750, 4755, 4756, 4752, 4757,
+
+     4727, 4758, 4759, 4760, 4761, 4738, 4729, 4762, 4730, 4763,
+     4743, 4764, 4765, 4739, 4740, 4751, 4741, 4724, 4753, 4725,
+     4726, 4723, 4728, 4731, 4742,  365, 4771, 4772,  365, 4773,
+      365,  365,  365,  365,  365,  365,  365, 4774, 4775,  365,
+     4776,  365,  365,  365,  365,  365,  365,  365, 4777, 4778,
+      365, 4779,  365,  365,  365,  365,  365,  365, 4780, 4781,
+     4766, 4782, 4783, 4767, 4784, 4785, 4786, 4787, 4788, 4789,
+     4790, 4768, 4791, 4792, 4769, 4793, 4794, 4795, 4796, 4797,
+     4798, 4799, 4770, 4800, 4801, 4802, 4803, 4804, 4805, 4806,
+     4807, 4808, 4809, 4810, 4811, 4812, 4813, 4814, 4815, 4816,
+
+     4817, 4818, 4819, 4820, 4821, 4822, 4823, 4824, 4825, 4826,
+     4827, 4828, 4829, 4830, 4831, 4832, 4833, 4834, 4835, 4836,
+     4837, 4838, 4839, 4840, 4841, 4842, 4843, 4844, 4845, 4846,
+     4847, 4848, 4849, 4850, 4851, 4852, 4853, 4854, 4855, 4856,
+     4857, 4858, 4866, 4859, 4867, 4868, 4860, 4861, 4862, 4869,
+     4870, 4871,  537, 4863, 4877, 4878, 4879,  537,  537,  537,
+     4864,  537, 4880, 4865,  537, 4881,  537,  537,  537,  537,
+      537,  537,  537, 4882, 4883,  537, 4884,  537,  537,  537,
+      537,  537,  537,  537, 4885, 4886, 4887, 4872,  537,  537,
+      537, 4888, 4889, 4890, 4891, 4892, 4873, 4893, 4894, 4874,
+
+     4895, 4896, 4897, 4898, 4899, 4900, 4901, 4875, 4902, 4903,
+     4876, 4904, 4905, 4906, 4907, 4908, 4909, 4910, 4911, 4912,
+     4913, 4914, 4915, 4916, 4917, 4918, 4919, 4920, 4921, 4922,
+     4923, 4924, 4925, 4926, 4927, 4928, 4929, 4930, 4931, 4932,
+     4933, 4934, 4935, 4936, 4937, 4938, 4939, 4941, 4942, 4943,
      4944, 4945, 4946, 4947, 4948, 4949, 4950, 4951, 4952, 4953,
-     4954, 4955, 4956, 4957, 4958, 4959, 4960, 4961, 4962, 4963,
-     4964, 4965, 4966, 4967, 4968, 4969, 4970, 4971, 4972, 4973,
-     4974, 4975, 4976, 4977, 4978, 4979, 4980, 4981, 4982, 4983,
-     4984, 4985, 4986, 4987, 4988, 4989,  738,  738,  738,  738,
-      738,  738,  738,  738,  738,  738, 4999, 5000, 5001,  767,
-
-     5002,  767,  767,  738,  767,  767, 5003, 5004,  767,  738,
-     4991, 4992, 5005,  738,  767,  767,  738,  738,  738,  738,
-     4990,  738,  738, 5014, 5015, 4993, 5016, 5017, 5018, 5019,
-     5020, 5021, 5024, 5022, 5025, 5026, 5027, 5028, 4995, 5029,
-     5030, 5031, 5008, 5006, 5032, 4998, 5009, 4996, 5012, 5033,
-     5007, 5034, 5010, 5011, 5023, 5035, 4994, 5036,  376, 4997,
-     5043, 5013,  376,  376,  376,  376,  376,  376,  376,  376,
-     5044,  376,  376,  376, 5045,  376, 5046, 5047,  376, 5048,
-      376,  376,  376,  376,  376,  376, 5049,  376, 5050, 5051,
-     5052, 5039,  376,  376,  376, 5037,  376, 5053, 5054, 5038,
-
-     5040,  376,  376,  376, 5055, 5056, 5057, 5058, 5059, 5060,
-     5061, 5062, 5063, 5064, 5065, 5041, 5066, 5067, 5068, 5069,
-     5070, 5071, 5072, 5073, 5042, 5074, 5075, 5076, 5077, 5078,
-     5079, 5080, 5081, 5082, 5083, 5084, 5085, 5086, 5087, 5088,
-     5089, 5090, 5091, 5092, 5093, 5094, 5095, 5096, 5097, 5098,
-     5099, 5100, 5101, 5102, 5103, 5104, 5105, 5106, 5107, 5108,
-     5109, 5110, 5111, 5112, 5113, 5114, 5115, 5116, 5117, 5118,
-     5126, 5119, 5127, 5128, 5120, 5121, 5122, 5129, 5130, 5131,
-      512, 5123, 5138, 5139, 5140,  512,  512,  512, 5124,  512,
-     5141, 5125, 5142,  512,  512,  512,  512,  512,  512,  512,
-
-      512,  512,  512,  512,  512,  512,  512,  512,  512,  512,
-      512,  512,  512, 5143,  512,  512,  512, 5132, 5134, 5144,
-     5145, 5146, 5135, 5147, 5148, 5149, 5133, 5150, 5151, 5152,
-     5153, 5154, 5155, 5156, 5157, 5158, 5159, 5160, 5136, 5161,
-     5162, 5163, 5137, 5164, 5165, 5166, 5167, 5168, 5169, 5170,
-     5171, 5172, 5173, 5174, 5175, 5176, 5177, 5178, 5179, 5180,
-     5181, 5182, 5183, 5184, 5185, 5186, 5187, 5188, 5189, 5190,
-     5191, 5192, 5193, 5194, 5195, 5196, 5197, 5198, 5199, 5200,
-     5201, 5202, 5203, 5204, 5205, 5206, 5207, 5208, 5209, 5210,
-     5211, 5212, 5214, 5215, 5216, 5217, 5218, 5219, 5220, 5221,
-
-     5222, 5223, 5224, 5225, 5226, 5227, 5228, 5229, 5213, 5230,
-     5231, 5232, 5233, 5234, 5235, 5236, 5237, 5238, 5239, 5240,
-     5241, 5242, 5243, 5244, 5245, 5246, 5247, 5248, 5249, 5250,
-     5251, 5252, 5253, 5254, 5255, 5256,  738,  738,  738,  738,
-      738,  738,  738,  738, 5265,  738,  767,  767, 5269, 5270,
-     5267, 5268,  767,  738,  767,  767,  767,  767, 5271, 5272,
-      738,  738,  738, 5257,  738, 5266,  738,  738,  738, 5280,
-     5281, 5282, 5283, 5260, 5284, 5285, 5258, 5259, 5022, 5286,
-     5273, 5287, 5288, 5289, 5290, 5291, 5294, 5274, 5295, 5264,
-     5296, 5277, 5297, 5278, 5261, 5275, 5276,  376, 5298, 5023,
-
-     5299, 5263,  376,  376,  376,  376, 5262, 5279,  376, 5300,
-      376,  376,  376,  376,  376,  376,  376, 5301, 5302,  376,
-     5303,  376,  376,  376,  376,  376,  376,  376, 5304, 5305,
-     5306, 5307,  376,  376,  376, 5308, 5309, 5310, 5311, 5312,
-     5313, 5314, 5315, 5316, 5317, 5292, 5318, 5319, 5320, 5321,
-     5322, 5323, 5324, 5293, 5325, 5326, 5327, 5328, 5329, 5330,
-     5331, 5332, 5333, 5334, 5335, 5336, 5337, 5339, 5340, 5341,
-     5338, 5342, 5343, 5344, 5345, 5346, 5347, 5348, 5349, 5350,
-     5351, 5352, 5353, 5354, 5355, 5356, 5357, 5358, 5359, 5360,
-     5361, 5362, 5363, 5365, 5366, 5369, 5367, 5364, 5368, 5370,
-
-     5371, 5372, 5373, 5374, 5375,  512, 5378, 5379,  512, 5380,
-      512,  512,  512,  512,  512,  512,  512, 5381, 5382,  512,
-     5383,  512,  512,  512,  512,  512,  512,  512, 5384, 5385,
-      512, 5386,  512,  512,  512,  512,  512,  512, 5387, 5388,
-     5389, 5390, 5391, 5392, 5393, 5394, 5395, 5396, 5397, 5398,
-     5399, 5400, 5401, 5376, 5402, 5403, 5377, 5404, 5405, 5406,
-     5407, 5408, 5409, 5410, 5411, 5412, 5413, 5414, 5415, 5416,
-     5417, 5418, 5419, 5420, 5421, 5422, 5423, 5424, 5425, 5426,
-     5427, 5428, 5429, 5430, 5431, 5432, 5433, 5434, 5435, 5436,
-     5437, 5438, 5439, 5440, 5441, 5442, 5443, 5444, 5445, 5446,
-
-     5447, 5448, 5449, 5450, 5451, 5452, 5453, 5454, 5455, 5456,
-     5457, 5458, 5459, 5460, 5461, 5462, 5463, 5464, 5466, 5467,
-     5465, 5468, 5469, 5470, 5471, 5472, 5473, 5474, 5475, 5476,
-     5477, 5478, 5479, 5480, 5481,  738,  738,  738,  738,  738,
-      738,  738,  738, 5265,  738,  738,  767,  767,  767,  767,
-      767,  767, 5486, 5487,  738,  738,  738,  738,  738,  738,
-      738, 5494, 5495, 5482, 5266, 5496,  376, 5497, 5498,  376,
-     5499,  376,  376,  376,  376,  376,  376, 5500, 5501, 5502,
-     5503, 5490, 5504, 5505, 5491, 5506, 5484, 5507, 5508, 5509,
-     5510, 5511, 5512, 5485, 5488, 5489, 5513, 5492, 5493, 5514,
-
-     5515, 5516, 5517, 5518, 5519, 5520, 5483, 5521, 5522, 5523,
-     5524, 5525, 5526, 5527, 5528, 5529, 5530, 5531, 5532, 5533,
-     5534, 5535, 5536, 5537, 5538, 5539, 5540, 5541, 5542, 5543,
-     5544, 5545, 5546, 5547, 5548, 5549, 5550, 5551, 5552, 5553,
-     5554, 5555, 5556, 5557, 5558, 5559, 5560, 5561, 5562, 5563,
-     5564, 5565, 5566, 5567, 5568,  512, 5569, 5570,  512, 5571,
-      512,  512,  512,  512,  512,  512, 5572, 5573, 5574, 5575,
-     5576, 5577, 5578, 5579, 5580, 5581, 5582, 5583, 5584, 5585,
-     5586, 5587, 5588, 5589, 5590, 5591, 5592, 5593, 5594, 5595,
-     5596, 5597, 5598, 5599, 5600, 5601, 5602, 5603, 5604, 5605,
-
-     5606, 5607, 5608, 5609, 5610, 5611, 5612, 5613, 5614, 5615,
-     5616, 5617, 5618, 5619, 5620, 5621, 5622, 5623, 5624, 5625,
-     5626, 5627, 5628, 5629, 5630, 5631, 5632, 5633, 5634, 5635,
-     5636, 5637, 5638, 5639, 5640, 5641, 5642, 5643, 5644, 5645,
-     5646, 5647, 5648, 5649, 5650, 5651, 5652, 5653, 5654, 5655,
-     5656, 5657, 5658, 5659, 5660, 5661, 5662, 5663,  738,  738,
-      738,  738,  767,  767,  738,  738,  738,  738,  738,  738,
-     5667, 5668, 5669, 5670, 5671, 5672, 5673, 5674, 5675, 5676,
-     5677, 5678, 5679, 5680, 5681, 5682, 5683, 5684, 5685, 5686,
-     5687, 5688, 5689, 5690, 5691, 5692, 5693, 5694, 5695, 5696,
-
-     5697, 5698, 5699, 5700, 5701, 5665, 5666, 5702, 5703, 5664,
-     5704, 5705, 5706, 5707, 5708, 5709, 5710, 5711, 5712, 5713,
-     5714, 5715, 5716, 5717, 5718, 5719, 5720, 5721, 5722, 5723,
-     5724, 5731, 5725, 5732, 5733, 5726, 5727, 5728, 5734, 5735,
-     5736, 5737, 5729, 5738, 5739, 5740, 5741, 5742, 5743, 5730,
-     5744, 5745, 5746, 5747, 5748, 5749, 5750, 5751, 5752, 5753,
-     5754, 5755, 5756, 5757, 5758, 5759, 5760, 5761, 5762, 5763,
-     5764, 5765, 5766, 5767, 5768, 5769, 5770, 5771, 5772, 5773,
-     5774, 5775, 5776, 5777, 5778, 5779, 5780, 5781, 5782, 5783,
-     5784, 5785, 5786, 5787, 5788, 5789, 5790, 5791, 5792, 5793,
-
-     5794, 5795, 5796, 5797, 5798, 5799, 5800, 5801, 5802, 5803,
-     5804, 5805, 5806, 5807, 5808, 5809, 5810, 5811, 5812, 5813,
-     5814,  738,  738,  738, 5815, 5816, 5817, 5818, 5819, 5820,
-     5821, 5822, 5823, 5824, 5825, 5826, 5827, 5828, 5829, 5830,
-     5831, 5832, 5833, 5834, 5835, 5836, 5837, 5838, 5839, 5840,
-     5841, 5842, 5843, 5844, 5845, 5846, 5847, 5848, 5849, 5850,
-     5851, 5852, 5853, 5854, 5855, 5856, 5857, 5858, 5859, 5860,
-     5861, 5862, 5863, 5864, 5865, 5866, 5867, 5868, 5870, 5869,
-     5871, 5872, 5873, 5874, 5875, 5876, 5877, 5878, 5879, 5880,
-     5881, 5882, 5883, 5884, 5885, 5886, 5887, 5888, 5889, 5890,
-
-     5891, 5892, 5893, 5894, 5895, 5896, 5897, 5898, 5899, 5900,
-     5901, 5902, 5903, 5904, 5905, 5906, 5907, 5908, 5909, 5910,
-     5911, 5912, 5913, 5914, 5915, 5916, 5917, 5918, 5919, 5920,
-     5921, 5922, 5923, 5924, 5925, 5926, 5927, 5928, 5929, 5930,
-     5931, 5932, 5933, 5934, 5935, 5936, 5937, 5938, 5939, 5940,
-     5941, 5942, 5943, 5944, 5945, 5946, 5947, 5948, 5949, 5950,
-     5951, 5952, 5953, 5954, 5955, 5956, 5957, 5958, 5959, 5960,
-     5961, 5962, 5963, 5964, 5965, 5966, 5967, 5968, 5969, 5970,
-     5971, 5972, 5973, 5974, 5975, 5976, 5977, 5978, 5979, 5980,
-     5981, 5982, 5983, 5984, 5985, 5986, 5987, 5988, 5989, 5990,
-
-     5991, 5992, 5993, 5994, 5995, 5996, 5997, 5998, 5999, 6000,
-     6001, 6002, 6003, 6004, 6005, 6006, 6007, 6008, 6009, 6010,
-     6011, 6012, 6013, 6014, 6015, 6016, 6017, 6018, 6019, 6020,
-     6021, 6022, 6023, 6024, 6025, 6026, 6027, 6028, 6029, 6030,
-     6031, 6032, 6033, 6034, 6035, 6036, 6037, 6038, 6039, 6040,
-     6041, 6042, 6043, 6044, 6045, 6046, 6047, 6048, 6049, 6050,
-     6051, 6052, 6053, 6054, 6055, 6056, 6057, 6058, 6059, 6060,
-     6061, 6062, 6063, 6064, 6065, 6066, 6067, 6068, 6069, 6070,
-     6071, 6072, 6073, 6078, 6074, 6079, 6080, 6075, 6076, 6077,
-     6081, 6082, 6083, 6084, 6085, 6086, 6087, 6088, 6089, 6090,
-
-     6091, 6092, 6093, 6094, 6095, 6096, 6097, 6098, 6099, 6100,
-     6101, 6102, 6103, 6104, 6105, 6106, 6107, 6108, 6109, 6110,
-     6111, 6112, 6113, 6115, 6116, 6117, 6118, 6119, 6120, 6121,
-     6122, 6114, 6123, 6124, 6125, 6126, 6127, 6128, 6129, 6130,
-     6131, 6132, 6133, 6134, 6135, 6136, 6137, 6138, 6139, 6140,
-     6141, 6142, 6143, 6144, 6145, 6146, 6147, 6148, 6149, 6150,
-     6151, 6152, 6153, 6154, 6155, 6156, 6157, 6158, 6160, 6161,
-     6162, 6163, 6164, 6165, 6166, 6167, 6159, 6168, 6169, 6170,
-     6171, 6172, 6173, 6174, 6175, 6176, 6177, 6178, 6179, 6180,
-     6181, 6182, 6183, 6184, 6185, 6186, 6187, 6188, 6189, 6190,
-
-     6191, 6192, 6193, 6194, 6195, 6196, 6197, 6198, 6199, 6200,
-     6201, 6202, 6203, 6204, 6205, 6206, 6207, 6208, 6209, 6210,
-     6211, 6212, 6213, 6214, 6215, 6216, 6217, 6218, 6219, 6220,
-     6221, 6222, 6223, 6224, 6225, 6226, 6227, 6228, 6229, 6230,
-     6231, 6232, 6233, 6234, 6235, 6236, 6237, 6238, 6239, 6240,
-     6241, 6242, 6243, 6244, 6245, 6246, 6247, 6248, 6249, 6250,
-     6251, 6252, 6253, 6254, 6255, 6256, 6257, 6258, 6259, 6260,
-     6261, 6262, 6263, 6264, 6265, 6266, 6267, 6268, 6269, 6270,
-     6271, 6272, 6273, 6274, 6275, 6276, 6277, 6278, 6279, 6280,
-     6281, 6282, 6283, 6284, 6285, 6286, 6287, 6288, 6289, 6290,
-
-     6291, 6292, 6293, 6294, 6295, 6296, 6297, 6298, 6299, 6300,
-     6301, 6302, 6303, 6304, 6305, 6306, 6307, 6308, 6309, 6310,
-     6311, 6312, 6313, 6314, 6315, 6316, 6317, 6318, 6319, 6320,
-     6321, 6322, 6323, 6324, 6325, 6326, 6327, 6328, 6329, 6330,
-     6331, 6332, 6333, 6334, 6335, 6336, 6337, 6338, 6339, 6340,
-     6341, 6342, 6343, 6344, 6345, 6346, 6347, 6348, 6349, 6350,
-     6351, 6352, 6353, 6354, 6355, 6356, 6357, 6358, 6359, 6360,
-     6361, 6362, 6363, 6364, 6365, 6366, 6367, 6368, 6369, 6370,
-     6371, 6372, 6373, 6374, 6375, 6376, 6377, 6378, 6379, 6380,
-     6381, 6382, 6383, 6384, 6385, 6386, 6387, 6388, 6389, 6390,
-
-     6391, 6392, 6393, 6394, 6395, 6396, 6397, 6398, 6399, 6400,
-     6401, 6402, 6403, 6404, 6405, 6406, 6407, 6408, 6409, 6410,
-     6411, 6412, 6413, 6414, 6415, 6416, 6417, 6418, 6419, 6420,
-     6421, 6422, 6423, 6424, 6425, 6426, 6427, 6428, 6429, 6430,
-     6431, 6432, 6433, 6434, 6435, 6436, 6437, 6438, 6439, 6440,
-     6441, 6442, 6443, 6444, 6445, 6446, 6447, 6448, 6449, 6450,
-     6451, 6452, 6453, 6454, 6455, 6456, 6457, 6458, 6459, 6460,
-     6461, 6462, 6463, 6464, 6465, 6466, 6467, 6468, 6469, 6470,
-     6471, 6472, 6473, 6474, 6475, 6476, 6477, 6478, 6479, 6480,
-     6481, 6482, 6483, 6484, 6485, 6486, 6487, 6488, 6489, 6490,
-
-     6491, 6492, 6493, 6494, 6495, 6496, 6497, 6498, 6499, 6500,
-     6501, 6502, 6503, 6504, 6505, 6506, 6507, 6508, 6509, 6510,
-     6511, 6512, 6513, 6514, 6515, 6516, 6517, 6518, 6519, 6520,
-       75,   75,   75,   75,   75,   75,   75,  164,  164,  164,
-      164,  164,  164,  164,  207,  207,  207,  207,  207,  207,
-      207,  322,  322,  322,  322,  322,  322,  322,  363,  363,
-      376,  376,  376,  376,  380,  380,  380,  380,  448,  448,
-      512,  512,  512,  512,  516,  516,  516,  516,  537,  537,
-     1546,  537,  537,  537,  537,  538,  538, 1545,  538,  538,
-      538,  538,  710,  710,  724,  724,  737,  737,  737,  737,
-
-      737,  737,  737,  767,  767,  767,  767,  767,  767,  767,
-      735, 1541, 1538,  735,  735, 1537, 1536, 1535, 1534, 1533,
-     1532, 1531, 1530, 1529, 1528, 1527, 1526, 1525, 1524, 1523,
-     1522, 1521, 1520, 1519, 1518, 1517, 1516, 1515, 1514, 1511,
-     1510, 1509, 1508, 1505, 1504, 1503, 1502, 1501, 1500, 1499,
-     1490, 1489, 1488, 1487, 1486, 1485, 1484, 1483, 1482, 1481,
-     1475, 1474, 1473, 1472, 1471, 1470, 1469, 1468, 1467, 1466,
-     1465, 1464, 1461, 1458, 1457, 1456, 1455, 1454, 1451, 1446,
-     1443, 1442, 1441, 1440, 1439, 1433, 1432, 1429, 1428, 1427,
-     1426, 1425, 1424, 1423, 1422, 1421, 1420, 1416, 1415, 1412,
-
-     1411, 1410, 1409, 1408, 1407, 1406, 1405, 1404, 1403, 1400,
-     1399, 1396, 1395, 1394, 1393, 1392, 1391, 1390, 1389, 1388,
-     1387, 1386, 1385, 1384, 1383, 1382, 1381, 1380, 1379, 1378,
-     1377, 1376, 1375, 1374, 1373, 1372, 1371, 1359, 1358, 1357,
-     1356, 1355, 1354, 1353, 1337, 1336, 1335, 1334, 1333, 1332,
-     1331, 1330, 1327, 1326, 1325, 1324, 1322, 1319, 1318, 1315,
-     1314, 1313, 1312, 1311, 1308, 1307, 1306, 1305, 1304, 1303,
-     1302, 1301, 1300, 1299, 1298, 1297, 1296, 1295, 1294, 1293,
-     1292, 1291, 1290, 1289,  767,  738,  738, 1237, 1236, 1235,
-     1234, 1233, 1232, 1231, 1230, 1229, 1226, 1225, 1224, 1223,
-
-     1222, 1221, 1220, 1219, 1216, 1215, 1214, 1213, 1212, 1209,
-     1208, 1207, 1206, 1205, 1202, 1201, 1198, 1194, 1193, 1192,
-     1191, 1190, 1189, 1188, 1187, 1184, 1183, 1182, 1181, 1180,
-     1179, 1178, 1177, 1176, 1175, 1174, 1173, 1172, 1167, 1166,
-     1165, 1164, 1163, 1160, 1159, 1158, 1157, 1156, 1153, 1152,
-     1151, 1148, 1147, 1146, 1145, 1142, 1141, 1140, 1139, 1136,
-     1135, 1134, 1131, 1130, 1129, 1128, 1127, 1126, 1125, 1124,
+     4954, 4955, 4956, 4940, 4957, 4958, 4959, 4960, 4961, 4962,
+     4963, 4964, 4965, 4966, 4967, 4968,  734,  734,  734,  734,
+      734,  734,  734,  734, 4975,  734, 4977,  734,  762,  734,
+      762, 4980,  762, 4981,  762, 4982,  762, 4983,  762, 4984,
+
+      734,  734, 4969,  734, 4976,  734, 4978,  734,  734, 4991,
+     4970, 4992, 4993, 4996, 4997, 4998, 4999, 5000, 4750, 4752,
+     4994, 5001, 5002, 5003, 5004, 5005, 4974, 4985, 5006, 4986,
+     5007, 4987, 4972, 4988, 4989, 4971, 4979, 4990, 4751, 4753,
+     4995,  365, 5008, 5009, 4973,  365,  365,  365,  365,  365,
+      365,  365,  365,  365,  365,  365,  365,  365,  365,  365,
+      365, 5010,  365,  365,  365, 5011, 5012, 5013, 5014, 5015,
+     5016, 5017, 5018, 5019, 5020, 5021, 5022, 5023, 5024, 5025,
+     5026, 5027, 5028, 5029, 5030, 5031, 5032, 5033, 5034, 5035,
+     5036, 5037, 5038, 5039, 5040, 5041, 5042, 5043, 5044, 5045,
+
+     5046, 5047, 5048, 5049, 5050, 5051, 5052, 5053, 5054, 5055,
+     5056, 5057, 5058, 5059, 5060, 5061, 5062, 5063, 5064, 5065,
+     5066, 5067, 5068, 5069, 5070, 5071, 5072, 5073, 5074, 5076,
+     5077, 5080, 5078, 5075, 5079, 5081, 5082, 5083, 5084, 5085,
+     5086,  537, 5087, 5088,  537, 5089,  537,  537,  537,  537,
+      537,  537,  537, 5090, 5091,  537, 5092,  537,  537,  537,
+      537,  537,  537,  537, 5093, 5094, 5095, 5096,  537,  537,
+      537, 5097, 5098, 5099, 5100, 5101, 5102, 5103, 5104, 5105,
+     5106, 5107, 5108, 5109, 5110, 5111, 5112, 5113, 5114, 5115,
+     5116, 5117, 5118, 5119, 5120, 5121, 5122, 5123, 5124, 5125,
+
+     5126, 5127, 5128, 5129, 5130, 5131, 5132, 5133, 5134, 5135,
+     5136, 5137, 5138, 5139, 5140, 5141, 5142, 5143, 5144, 5145,
+     5146, 5147, 5148, 5149, 5150, 5151, 5152, 5154, 5155, 5153,
+     5156, 5157, 5158, 5159,  734,  734,  734,  734,  734,  734,
+     4975,  734,  734, 4977,  734,  734, 5163,  734,  762,  762,
+      762,  762,  762,  734,  734,  734,  734,  734,  734, 5160,
+     4976, 5170, 4994, 4978, 5171, 5172, 5164, 5173, 5174, 5175,
+     5176, 5177, 5178, 5179, 5180, 5181, 5182, 5183, 5184, 5185,
+     5186, 5162, 4995, 5187, 5188, 5189, 5190, 5191, 5192, 5193,
+     5165, 5166, 5167, 5168, 5169, 5194, 5195, 5196, 5197, 5198,
+
+     5199, 5161, 5200, 5201, 5202, 5203, 5204, 5205, 5206, 5207,
+     5208, 5209, 5210, 5211, 5212, 5213, 5214, 5215, 5216, 5217,
+     5218, 5219, 5220, 5221, 5222, 5223, 5224, 5225, 5226, 5227,
+     5228, 5229, 5230, 5231, 5232, 5233, 5234, 5235, 5236, 5237,
+     5238, 5239, 5240, 5241, 5242, 5243, 5244, 5245, 5246, 5247,
+     5248, 5249, 5250, 5251, 5252, 5253, 5254, 5255, 5256, 5257,
+     5258, 5259, 5260, 5261, 5262, 5263, 5264, 5265, 5266, 5267,
+     5268, 5269, 5270, 5271, 5272, 5273, 5274, 5275, 5276, 5277,
+     5278, 5279, 5280, 5281, 5282, 5283, 5284, 5285, 5286, 5287,
+     5288, 5289, 5290, 5291, 5292, 5293, 5294, 5295, 5296, 5297,
+
+     5298, 5299, 5300, 5301, 5302, 5303, 5304, 5305, 5306, 5307,
+     5308, 5309, 5310, 5311, 5312, 5313,  734,  734,  734, 5163,
+      734,  734,  734,  734,  734,  734,  734, 5315, 5316, 5317,
+     5318, 5319, 5320, 5321, 5322, 5323, 5324, 5325, 5326, 5164,
+     5327, 5328, 5329, 5330, 5331, 5332, 5333, 5334, 5335, 5336,
+     5337, 5338, 5339, 5340, 5341, 5342, 5343, 5344, 5345, 5346,
+     5347, 5348, 5349, 5350, 5314, 5351, 5352, 5353, 5354, 5355,
+     5356, 5357, 5358, 5359, 5360, 5361, 5362, 5363, 5364, 5365,
+     5366, 5367, 5368, 5369, 5370, 5371, 5372, 5373, 5374, 5375,
+     5382, 5376, 5383, 5384, 5377, 5378, 5379, 5385, 5386, 5387,
+
+     5388, 5380, 5389, 5390, 5391, 5392, 5393, 5394, 5381, 5395,
+     5396, 5397, 5398, 5399, 5400, 5401, 5402, 5403, 5404, 5405,
+     5406, 5407, 5408, 5409, 5410, 5411, 5412, 5413, 5414, 5415,
+     5416, 5417, 5418, 5419, 5420, 5421, 5422, 5423, 5424, 5425,
+     5426, 5427, 5428, 5429, 5430, 5431, 5432, 5433, 5434, 5435,
+     5436, 5437, 5438, 5439, 5440,  734, 5441, 5442, 5443, 5444,
+     5445, 5446, 5447, 5448, 5449, 5450, 5451, 5452, 5453, 5454,
+     5455, 5456, 5457, 5458, 5459, 5460, 5461, 5462, 5463, 5464,
+     5465, 5466, 5467, 5468, 5469, 5470, 5471, 5472, 5473, 5474,
+     5475, 5476, 5477, 5478, 5479, 5480, 5481, 5482, 5483, 5484,
+
+     5485, 5486, 5487, 5488, 5489, 5490, 5491, 5492, 5493, 5494,
+     5495, 5497, 5496, 5498, 5499, 5500, 5501, 5502, 5503, 5504,
+     5505, 5506, 5507, 5508, 5509, 5510, 5511, 5512, 5513, 5514,
+     5515, 5516, 5517, 5518, 5519, 5520, 5521, 5522, 5523, 5524,
+     5525, 5526, 5527, 5528, 5529, 5530, 5531, 5532, 5533, 5534,
+     5535, 5536, 5537, 5538, 5539, 5540, 5541, 5542, 5543, 5544,
+     5545, 5546, 5547, 5548, 5549, 5550, 5551, 5553, 5554, 5555,
+     5556, 5557, 5558, 5559, 5552, 5560, 5561, 5562, 5563, 5564,
+     5565, 5566, 5567, 5568, 5569, 5570, 5571, 5572, 5573, 5574,
+     5575, 5576, 5577, 5578, 5579, 5580, 5581, 5582, 5583, 5584,
+
+     5585, 5586, 5587, 5588, 5589, 5590, 5591, 5592, 5593, 5594,
+     5595, 5596, 5597, 5598, 5599, 5600, 5601, 5602, 5603, 5604,
+     5605, 5606, 5607, 5608, 5609, 5610, 5611, 5612, 5613, 5614,
+     5615, 5616, 5617, 5618, 5619, 5620, 5621, 5622, 5623, 5624,
+     5625, 5626, 5627, 5628, 5629, 5630, 5631, 5632, 5633, 5634,
+     5635, 5636, 5637, 5638, 5639, 5640, 5641, 5642, 5643, 5644,
+     5645, 5646, 5647, 5648, 5649, 5650, 5651, 5652, 5653, 5654,
+     5655, 5656, 5657, 5658, 5659, 5660, 5661, 5662, 5663, 5664,
+     5665, 5666, 5667, 5668, 5669, 5670, 5671, 5676, 5672, 5677,
+     5678, 5673, 5674, 5675, 5679, 5680, 5681, 5682, 5683, 5684,
+
+     5685, 5686, 5687, 5688, 5689, 5690, 5691, 5692, 5693, 5694,
+     5695, 5696, 5697, 5698, 5699, 5700, 5701, 5702, 5704, 5705,
+     5706, 5707, 5708, 5709, 5710, 5711, 5703, 5712, 5713, 5714,
+     5715, 5716, 5717, 5718, 5719, 5720, 5721, 5722, 5723, 5724,
+     5725, 5726, 5727, 5728, 5729, 5730, 5731, 5732, 5733, 5734,
+     5735, 5736, 5737, 5738, 5739, 5740, 5741, 5742, 5743, 5744,
+     5745, 5746, 5748, 5749, 5750, 5751, 5752, 5753, 5754, 5755,
+     5747, 5756, 5757, 5758, 5759, 5760, 5761, 5762, 5763, 5764,
+     5765, 5766, 5767, 5768, 5769, 5770, 5771, 5772, 5773, 5774,
+     5775, 5776, 5777, 5778, 5779, 5780, 5781, 5782, 5783, 5784,
+
+     5785, 5786, 5787, 5788, 5789, 5790, 5791, 5792, 5793, 5794,
+     5795, 5796, 5797, 5798, 5799, 5800, 5801, 5802, 5803, 5804,
+     5805, 5806, 5807, 5808, 5809, 5810, 5811, 5812, 5813, 5814,
+     5815, 5816, 5817, 5818, 5819, 5820, 5821, 5822, 5823, 5824,
+     5825, 5826, 5827, 5828, 5829, 5830, 5831, 5832, 5833, 5834,
+     5835, 5836, 5837, 5838, 5839, 5840, 5841, 5842, 5843, 5844,
+     5845, 5846, 5847, 5848, 5849, 5850, 5851, 5852, 5853, 5854,
+     5855, 5856, 5857, 5858, 5859, 5860, 5861, 5862, 5863, 5864,
+     5865, 5866, 5867, 5868, 5869, 5870, 5871, 5872, 5873, 5874,
+     5875, 5876, 5877, 5878, 5879, 5880, 5881, 5882, 5883, 5884,
+
+     5885, 5886, 5887, 5888, 5889, 5890, 5891, 5892, 5893, 5894,
+     5895, 5896, 5897, 5898, 5899, 5900, 5901, 5902, 5903, 5904,
+     5905, 5906, 5907, 5908, 5909, 5910, 5911, 5912, 5913, 5914,
+     5915, 5916, 5917, 5918, 5919, 5920, 5921, 5922, 5923, 5924,
+     5925, 5926, 5927, 5928, 5929, 5930, 5931, 5932, 5933, 5934,
+     5935, 5936, 5937, 5938, 5939, 5941, 5942, 5943, 5944, 5945,
+     5946, 5947, 5948, 5949, 5950, 5951, 5952, 5953, 5954, 5940,
+     5955, 5956, 5957, 5958, 5959, 5960, 5961, 5962, 5963, 5964,
+     5965, 5966, 5967, 5968, 5969, 5970, 5971, 5972, 5973, 5974,
+     5975, 5976, 5977, 5978, 5979, 5980, 5981, 5982, 5983, 5984,
+
+     5985, 5986, 5987, 5988, 5989, 5990, 5991, 5992, 5993, 5994,
+     5995, 5996, 5997, 5998, 5999, 6000, 6001, 6002, 6003, 6004,
+     6005, 6006, 6007, 6008, 6009, 6010, 6011, 6012, 6013, 6014,
+     6015, 6016, 6017, 6018, 6019, 6020, 6021, 6022, 6023, 6024,
+     6025, 6026, 6027, 6028, 6029, 6030, 6031, 6032, 6033, 6034,
+     6035, 6036, 6037, 6038, 6039, 6040, 6041, 6042, 6043, 6044,
+     6045, 6046, 6047, 6048, 6049, 6050, 6051, 6052, 6053, 6054,
+     6055, 6056, 6057, 6058, 6059, 6060, 6061, 6062, 6063, 6064,
+     6065, 6066, 6067, 6068, 6069, 6070, 6071, 6072, 6073, 6074,
+     6075, 6076, 6077, 6078, 6079, 6080, 6081, 6082, 6083, 6084,
+
+     6085, 6086, 6087, 6088, 6089, 6090, 6091, 6092, 6093,   69,
+       69,   69,   69,  177,  177,  177,  177,  213,  213,  213,
+      213,  316,  316,  316,  316,  354,  365,  365,  369,  369,
+      450,  462,  537,  537,  541,  541,  556,  570,  630,  570,
+      570,  571,  724,  571,  571,  733,  733,  733,  733,  762,
+      762,  762,  762, 1497, 1496, 1495, 1494, 1493, 1490, 1489,
+     1488, 1487, 1483, 1482, 1481, 1479, 1478, 1477, 1476, 1475,
+     1474, 1473, 1465, 1464, 1463, 1462, 1461, 1460, 1459, 1458,
+     1457, 1456, 1450, 1449, 1448, 1447, 1446, 1445, 1444, 1443,
+     1442, 1441, 1440, 1439, 1438, 1437, 1434, 1433, 1432, 1431,
+
+     1430, 1429, 1428, 1427, 1424, 1421, 1420, 1416, 1415, 1414,
+     1413, 1410, 1406, 1405, 1404, 1403, 1402, 1401, 1397, 1396,
+     1393, 1392, 1391, 1390, 1389, 1388, 1387, 1386, 1385, 1384,
+     1376, 1375, 1374, 1371, 1370, 1367, 1366, 1365, 1364, 1363,
+     1362, 1361, 1360, 1359, 1358, 1357, 1356, 1355, 1354, 1353,
+     1352, 1351, 1350, 1349, 1348, 1347, 1346, 1345, 1344, 1343,
+     1342, 1341, 1340, 1339, 1335, 1334, 1333, 1332, 1331, 1330,
+     1329, 1328, 1327, 1326, 1325, 1312, 1311, 1310, 1309, 1308,
+     1307, 1299, 1298, 1297, 1296, 1295, 1294, 1291, 1290, 1289,
+     1288, 1286, 1285, 1284, 1280, 1279, 1278, 1277, 1276, 1275,
+
+     1274, 1273, 1272, 1271, 1270, 1269, 1268, 1267, 1266, 1265,
+     1264, 1263, 1262, 1261, 1260, 1259, 1258, 1257, 1256, 1255,
+     1254, 1253, 1252,  762,  734,  734, 1203, 1202, 1201, 1200,
+     1199, 1198, 1197, 1196, 1193, 1190, 1189, 1188, 1187, 1186,
+     1185, 1184, 1183, 1182, 1181, 1180, 1179, 1178, 1177, 1176,
+     1175, 1174, 1173, 1170, 1169, 1168, 1167, 1166, 1165, 1164,
+     1163, 1162, 1161, 1160, 1159, 1158, 1155, 1154, 1153, 1152,
+     1151, 1148, 1147, 1146, 1145, 1144, 1143, 1142, 1141, 1140,
+     1137, 1136, 1135, 1134, 1131, 1130, 1129, 1128, 1125, 1124,
      1123, 1122, 1121, 1120, 1119, 1118, 1117, 1116, 1115, 1114,
-     1113, 1112, 1111, 1106, 1105, 1104, 1103, 1102, 1101, 1098,
-     1097, 1096, 1095, 1094, 1093, 1092, 1091, 1090, 1084, 1081,
-
-     1080, 1079, 1078, 1075, 1074, 1073, 1072, 1071, 1065, 1062,
-     1059, 1058, 1057, 1056, 1055, 1049, 1048, 1047, 1046, 1045,
-     1044, 1043, 1042, 1041, 1038, 1037, 1036, 1035, 1034, 1033,
-     1032, 1031, 1030, 1029, 1028, 1027, 1026, 1025, 1024,  539,
-     1023, 1022,  539, 1017, 1014, 1013, 1012, 1011, 1000,  999,
-      998,  997,  996,  995,  994,  993,  975,  974,  973,  972,
-      971,  966,  965,  964,  958,  957,  951,  947,  946,  945,
-      944,  943,  942,  941,  940,  939,  938,  935,  932,  931,
-      930,  923,  922,  921,  920,  919,  918,  915,  914,  913,
-      911,  910,  908,  907,  904,  903,  902,  901,  900,  899,
-
-      898,  897,  893,  892,  891,  890,  889,  888,  885,  884,
-      883,  882,  881,  880,  879,  876,  875,  874,  873,  872,
-      871,  870,  869,  856,  853,  852,  851,  850,  835,  832,
-      831,  830,  829,  828,  827,  826,  825,  824,  823,  820,
-      819,  818,  817,  816,  815,  809,  806,  799,  796,  787,
-      786,  783,  782,  781,  769,  738,  738,  738,  738,  738,
-      738,  733,  732,  731,  730,  727,  726,  725,  719,  718,
-      717,  716,  713,  712,  711,  694,  691,  664,  657,  633,
-      632,  589,  556,  369,  366,  365,  364,  539,  539,  336,
-      366,  365,  364,  336,  471,  470,  456,  452,  450,  449,
-
-      418,  336,  369,  366,  365,  364,  336, 6521,  269,  269,
-       63, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521,
-     6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521,
-     6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521,
-     6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521,
-     6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521,
-     6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521,
-     6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521,
-     6521, 6521, 6521, 6521, 6521, 6521
+
+     1113, 1112, 1111, 1110, 1109, 1108, 1107, 1106, 1105, 1104,
+     1103, 1102, 1101, 1100, 1097, 1096, 1095, 1094, 1093, 1092,
+     1091, 1090, 1087, 1086, 1083, 1082, 1081, 1080, 1079, 1078,
+     1077, 1076, 1075, 1072, 1071, 1068, 1067, 1066, 1060, 1059,
+     1058, 1057, 1056, 1055, 1054, 1053, 1052, 1051, 1050, 1049,
+     1048, 1047, 1046, 1045, 1044, 1043, 1042,  572, 1041, 1040,
+      572, 1037, 1036, 1035, 1033, 1031, 1026, 1025, 1024, 1023,
+     1013, 1012, 1011, 1010, 1009, 1008, 1007, 1006,  988,  987,
+      986,  985,  984,  983,  978,  977,  976,  973,  972,  971,
+      968,  967,  966,  963,  962,  956,  955,  954,  953,  952,
+
+      951,  950,  949,  948,  947,  946,  945,  944,  943,  942,
+      935,  934,  933,  932,  931,  930,  927,  926,  919,  918,
+      917,  914,  912,  911,  909,  908,  905,  904,  903,  902,
+      901,  900,  899,  898,  897,  896,  895,  894,  893,  892,
+      891,  890,  889,  888,  887,  886,  885,  884,  883,  882,
+      878,  877,  876,  875,  874,  873,  872,  871,  870,  869,
+      868,  867,  864,  863,  862,  861,  860,  859,  856,  855,
+      854,  853,  852,  851,  836,  835,  834,  833,  823,  822,
+      821,  820,  819,  818,  817,  816,  815,  809,  808,  807,
+      806,  805,  801,  795,  794,  791,  788,  779,  776,  775,
+
+      774,  764,  734,  734,  734,  734,  734,  734,  732,  731,
+      730,  727,  726,  725,  711,  710,  709,  708,  707,  677,
+      651,  639,  638,  637,  636,  633,  632,  631,  611,  357,
+      356,  355,  572,  572,  328,  563,  559,  557,  485,  466,
+      465,  463,  454,  452,  451,  397,  328,  357,  356,  355,
+      328, 6094,   57, 6094, 6094, 6094, 6094, 6094, 6094, 6094,
+     6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094,
+     6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094,
+     6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094,
+     6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094,
+
+     6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094,
+     6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094,
+     6094, 6094, 6094, 6094, 6094
     } ;
 
-static yyconst flex_int16_t yy_chk[9887] =
+static yyconst flex_int16_t yy_chk[9126] =
     {   0,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,   79,  195,    1,  189,   96,    0,    0,
-      352,    1,   96,   96,   96,  352,  327,   79,    1,  136,
-      189,    1,    1,  195,  140,  195,  327,    1,    7,    7,
-        7,  119,    7,    9,    9,    8,    8,    8,    7,    8,
-        7,    7,  118,    7,  136,    8,  119,    8,    8,  140,
-        8,    9,    9,  118,    1,    2,    2,    2,    2,    2,
+        1,    1,   73,  192,    1,    0,   89,    0,    0,  341,
+        1,   89,   89,   89,  341,   90,   73,    1,    0,    1,
+       90,   90,   90,  134,    1,    7,  192,    7,  108,    7,
+        9,    9,   33,    9,   33,    7,  333,    7,    7,  333,
+        7,    9,  119,  108,    7,    7,  134,   90,    9,  119,
+       33,    1,    2,    2,    2,    2,    2,    2,    2,    2,
         2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
-        2,    2,    2,    2,    2,    2,    2,    2,   11,   43,
+        2,    2,    2,    2,  109,    8,    2,    8,  104,    8,
 
-        2,   10,   10,  109,   12,   43,    2,  127,  109,  109,
-      109,   43, 1067,    2,   43,   11,    2,    2,   23,   10,
-       10,   12,    2,  127,   24,   23,   31,   32,   23,   23,
-       23,   24,  114,  120,   24,   24,   24,   31,   32,  120,
-      114,   31,   32,   31,   32,   31,   32,  109, 1069,    2,
+      109,   34,    2,   34, 1054,    8,  104,    8,    8,    2,
+        8,    2,  112,  112,    8,    8,    2,   10,   10,   34,
+       10,  121,   11,   11,   11,  121,  105,   43,   10,  105,
+       11,   11,  105,   43,  105,   10,   11,   11,  172,   43,
+      172,   11,   43,    2,    3,    3,    3,    3,    3,    3,
         3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
         3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
         3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
@@ -3671,9 +3449,9 @@ static yyconst flex_int16_t yy_chk[9887] =
         3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
 
         3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
-        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
-        3,    3,    3,    3,    3,   13,   13,   13,   13,   13,
-       13,   13,   13,   13,   13,   13,   13,   13,   13,   13,
+        3,    3,    3,    3,    3,    3,   12,   12,   12,  118,
+      155,  155,   23,  124,   12,   12, 1056,  124,  118,   23,
+       12,   12,   23,   23,   23,   12,   13,   13,   13,   13,
        13,   13,   13,   13,   13,   13,   13,   13,   13,   13,
        13,   13,   13,   13,   13,   13,   13,   13,   13,   13,
        13,   13,   13,   13,   13,   13,   13,   13,   13,   13,
@@ -3681,26 +3459,37 @@ static yyconst flex_int16_t yy_chk[9887] =
        13,   13,   13,   13,   13,   13,   13,   13,   13,   13,
        13,   13,   13,   13,   13,   13,   13,   13,   13,   13,
 
-       17,   17,   17,  122,   17,   17,   17,   17,  115,  124,
-       17,   17,   17,  122,  142,   17,   17,   17,   17,   18,
-       18,   18,  115,   18,   18,   18,   18,  124,  219,   18,
-       18,   18,  142,  219,   18,   18,   18,   18,   25,   25,
+       13,   13,   13,   13,   13,   13,   13,   13,   15,   15,
+       15,   15,   15,   15,   15,   15,   15,   15,   15,   15,
+       15,   15,   15,   15,   15,   15,   15,   15,   15,   15,
+       15,   15,   15,   15,   15,   15,   15,   15,   15,   15,
+       15,   15,   15,   15,   15,   15,   15,   15,   15,   15,
+       15,   15,   15,   15,   15,   15,   15,   15,   15,   15,
+       15,   15,   15,   15,   15,   15,   15,   15,   15,   15,
+       15,   15,   15,   15,   15,   15,   15,   15,   15,   15,
+       17,   17,   17,   49,   17,  152,  221,   17,  152,  221,
+       49,   17,   17,  110,  117,   17,   17,   49,   17,   18,
+
+       18,   18,   50,   18,   21,   21,   18,  110,   21,   50,
+       18,   18,  117,   31,   18,   18,   50,   18,   21,   22,
+       22,   21,  123,   22,   31,  280,   21,   24,   31,  107,
+       31,  123,   31,   22,   24,  280,   22,   24,   24,   24,
+      107,   22,   25,   25,   25,   25,   25,   25,   25,   25,
        25,   25,   25,   25,   25,   25,   25,   25,   25,   25,
-       25,   25,   25,   25,   25,   25,   25,   25,   25,   25,
-       25, 1070,   33,   25,   33,   51,   33,   51,  126,   25,
-      149,   34,   33,   34,  126,   34,   25,   51,   33,   25,
-       25,   34,  149,   35,   35,   25,  125,   34,   35,  125,
-       35,   39,   39,   35,   39,   35,   35,   37,   35,  145,
+       25,   25,   25,   25,   91,   32,   25,  161,  225,   91,
+       91,   91,   25,  225,   37,  161,   32,   37,  747,   25,
+       32,   25,   32,   44,   32,   37,   25,   35,   35,   44,
+       38,   37,   35,   38,   35,   44,   91,  115,   44,   35,
 
-       35,   35,   39,   37,   37,   37,  145,  141,   39,   37,
-      141, 1071,   25,   26,   26,   26,   26,   26,   26,   26,
+       35,   38,   35,   95,   35,   35,  747,   38,   95,   95,
+       95,  115,  145,   25,   26,   26,   26,   26,   26,   26,
        26,   26,   26,   26,   26,   26,   26,   26,   26,   26,
-       26,   26,   26,   26,   26,   26,  144,  144,   26,   40,
-       40,  159,   40,  159,   26,  218,   52,  218,   52,  121,
-       40,   26,   36,   36,   26,   26,   40,   36,   52,   36,
-       26,  121,   36,  121,   36,   36,   38,   36,  217,   36,
-       36,   44,   38,   38,   38,  153,  116,   44,   38,  116,
-      217, 1072,  116,   44,  116,  153,   44,   26,   27,   27,
+       26,   26,   26,   26,   26,   26,  145,  229,   26,  162,
+      162,  111,   36,   36,   26,  111,   95,   36,   74,   36,
+      229,   26,  111,   26,   36,   36,   74,   36,   26,   36,
+       36,   45,   74,  116,   45,   45,   45,   45,  125,   74,
+      157,   74,  167,   45,   45,   45,  116,  259,   45,  167,
+      116,   45,  157,  259,  125,   26,   27,   27,   27,   27,
        27,   27,   27,   27,   27,   27,   27,   27,   27,   27,
 
        27,   27,   27,   27,   27,   27,   27,   27,   27,   27,
@@ -3708,1033 +3497,939 @@ static yyconst flex_int16_t yy_chk[9887] =
        27,   27,   27,   27,   27,   27,   27,   27,   27,   27,
        27,   27,   27,   27,   27,   27,   27,   27,   27,   27,
        27,   27,   27,   27,   27,   27,   27,   27,   27,   27,
-       27,   27,   27,   27,   27,   27,   27,   27,   27,   27,
-       27,   27,   27,   29,   29,   29,   29,   29,   29,   29,
+       27,   27,   27,   27,   27,   27,   27,   27,   29,   29,
        29,   29,   29,   29,   29,   29,   29,   29,   29,   29,
-       29,   29,   29,   29,   29,   29,  107,  148,   29,  152,
-      148,  107,  107,  107,   29,  222,   41,   41,   41,  231,
+       29,   29,   29,   29,   29,   29,   29,   29,   29,   29,
+      165,  165,   29, 1057,  227,  122,   46,  234,   29,   46,
+       46,   46,   46,  227,  234,   29,  137,   29,   46,   46,
 
-       41,   29,   41,  222,   29,   29,   41,  152,   41,   41,
-       29,  157,  231,   41,   41,   45,   41,   45,   45,   45,
-       45,   45,  154, 1074,  157,  228,  157,   45,   45,   45,
-      154,  228,   45,  154,  107,  245,  245,   29,   30,   30,
+       46,  149,   29,   46,  122,   47,   46,   47,   47,   47,
+       48,   98,   48,   48,   48,  233,   98,   98,   98,  137,
+     1058,   47,   47,  223,  149,  223,   48,   48,  233,   29,
        30,   30,   30,   30,   30,   30,   30,   30,   30,   30,
        30,   30,   30,   30,   30,   30,   30,   30,   30,   30,
-       30,  108,  184,   30,  211,  224,  108,  108,  108,   30,
-     1078,   42,   42,   42,  224,   42,   30,   42,  211,   30,
-       30,   42,  215,   42,   42,   30,  186,  184,   42,   42,
-       46,   42,   46,   46,   46,   46,   46,  155,  158,  155,
-
-      215,   49,   46,   46,   46,   49,   50,   46,   49,  486,
-       50,  186,   30,   50,  155,   49,  158,  158,  486,  108,
-       50,   53,   53,   53,   53,   53,   53,   53,   53,   53,
-       53,   53,   53,   53,   53,   53,   53,   53,   53,   53,
-       53,   53,   53,   53,   53,   53,   53,   53,   53,   53,
-       53,   53,   53,   53,   53,   53,   53,   53,   53,   53,
-       53,   53,   53,   53,   53,   53,   53,   53,   53,   53,
+       30,   30,   92,  153,   30,  159,   98,   92,   92,   92,
+       30,  222,  271,  271, 1059,  159,  237,   30,  159,   30,
+       92,  153,  159,  222,   30,   62,   62,   62,   62,   62,
+       62,   62,   64,  237,   64,   64,   64,   64,   64,   64,
+       64,   65,  614,   65,   65,   65,   65,   65,   65,   65,
+
+      614,   30,   39,   39,   39,   39,   39,   39,   39,   39,
+       39,   39,   39,   39,   39,   39,   39,   39,   39,   39,
+       39,   39,   39,   39,   39,   39,   39,   39,   39,   39,
+       39,   39,   39,   39,   39,   39,   39,   39,   39,   39,
+       39,   39,   39,   39,   39,   39,   39,   39,   39,   39,
+       39,   39,   39,   39,   39,   39,   39,   39,   39,   39,
+       39,   39,   39,   39,   39,   39,   39,   39,   39,   39,
+       39,   39,   39,   39,   41,   41,   41,  268,   41,  194,
+       41,  268, 1061,  113,   41,  113,   41,   41,  199,  197,
+      120,   41,   41,  113,   41,   42,   42,   42,  120,   42,
+
+      113,   42,  194,  197,  120,   42,  120,   42,   42,  120,
+      269,  199,   42,   42,  269,   42,   51,   51,   51,   51,
+       51,   51,   51,   51,   51,   51,   51,   51,   51,   51,
+       51,   51,   51,   51,   51,   51,   51,   51,   51,   51,
+       51,   51,   51,   51,   51,   51,   51,   51,   51,   51,
+       51,   51,   51,   51,   51,   51,   51,   51,   51,   51,
+       51,   51,   51,   51,   51,   51,   51,   51,   51,   51,
+       51,   51,   51,   51,   51,   51,   51,   51,   51,   51,
+       51,   51,   51,   51,   51,   51,   51,   51,   53,   53,
        53,   53,   53,   53,   53,   53,   53,   53,   53,   53,
+
        53,   53,   53,   53,   53,   53,   53,   53,   53,   53,
-       53,   53,   53,   53,   53,   53,   55,   55,   55,   55,
-
-       55,   55,   55,   55,   55,   55,   55,   55,   55,   55,
-       55,   55,   55,   55,   55,   55,   55,   55,   55,   55,
-       55,   55,   55,   55,   55,   55,   55,   55,   55,   55,
-       55,   55,   55,   55,   55,   55,   55,   55,   55,   55,
-       55,   55,   55,   55,   55,   55,   55,   55,   55,   55,
-       55,   55,   55,   55,   55,   55,   55,   55,   55,   55,
-       55,   55,   55,   55,   55,   55,   55,   55,   55,   55,
-       55,   57,  747,  216,  105,  214,  216,  223,   57,  105,
-      105,  105,   57,   57,   57,   57,   57,   57,   57,   57,
-       58,  214,  223,  103,  258,  258,  747,   58,  103,  103,
-
-      103,   58,   58,   58,   58,   58,   58,   58,   58,   59,
-       59,   59,   59,   59,   59,   59,   59,   59,   59,   59,
-       59,   59,   59,   59,   59,   59,   59,   59,   59,   59,
-       59,   59,  230,  235,   59,  232,  105,  150,  150,  103,
-       59,  191,  232, 1079,  235,  150,  230,   59,  150,  230,
-       59,   59,  230,  150,  150,  150,   59,   68,   68,   68,
-       68,   68,   68,   68,   68,   70,  191,   70,   70,   70,
-       70,   70,   70,   70,   70,   87,   87,   87,   87,   87,
-       87,   87,   87,   59,   60,   60,   60,   60,   60,   60,
-       60,   60,   60,   60,   60,   60,   60,   60,   60,   60,
-
-       60,   60,   60,   60,   60,   60,   60,  237,   61,   60,
-      272,  104,  272,   62,  113,   60,  104,  104,  104,  113,
-      113,  113,   60,   61,  237,   60,   60,  138,   62,  138,
-       71,   60,   71,   71,   71,   71,   71,   71,   71,   71,
-       91,  138,   91,   91,   91,   91,   91,   91,   91,   91,
-      240,  156,  190, 1080,  138,   61,  225,  240,   60,  104,
-       62,  193,  113,   61,  156,  190,  156,  156,   62,  227,
-       61,  225,  104,   61,   61,   62,  451,   97,   62,   62,
-       69,   69,   97,   97,   97,  255,  193,  227,   69,  255,
-      190,   69,   69,   69,   69,   69,   69,   69,   69,  261,
-
-      244,  451,   69,  244,   69,   69,   69,   69,   69,   69,
-       97,  261,   69,   69,   69,   69,   69,   69,  164,  243,
-       69,  239,   81,  164,  164,  164,  243, 1081,   69,  239,
-      234,   81,  234,  239,   69,  246,   69,   81,   69,  241,
-       69,  246,   69,  241,   81,  234,  266,   81,   81,   92,
-      241,   92,   92,   92,   92,   92,   92,   92,   92,   98,
-      241,  266,   99,  252,   98,   98,   98,   99,   99,   99,
-      100,  816,  102,  101,  252,  100,  100,  100,  101,  101,
-      101,  102,  816,   99,  262,  262,  247,  102,  247,  100,
-      170,  247,   98,  264,  102,  106,  101,  102,  102,  170,
-
-      106,  106,  106,  100,  110,  170,   99,  264,   99,  110,
-      110,  110,  170,  111,  100,  170,  170,   98,  111,  111,
-      111,  101,  123,  123,  112,  263,  263,  165,  100,  112,
-      112,  112,  165,  165,  165,  123,  123,  287,  301,  123,
-      123,  129,  129,  129,  129,  129,  129,  129,  129,  251,
-      256,  287,  301,  268,  256,  251,  106,  111,  143,  111,
-      165,  267,  110,  268,  326,  325,  267, 1082,  112,  130,
-      130,  130,  130,  130,  130,  130,  130,  325,  326,  472,
-      472,  131,  112,  131,  131,  131,  131,  131,  131,  131,
-      131,  132,  143,  132,  132,  132,  132,  132,  132,  132,
-
-      132,  143,  143,  274,  151,  269,  143,  151,  151,  220,
-      269,  340,  220,  608,  314,  151,  220,  151,  340,  220,
-      151,  608,  274,  162,  151,  162,  162,  162,  162,  162,
-      162,  162,  162,  163,  314,  163,  163,  163,  163,  163,
-      163,  163,  163,  166,  334,  454,  167, 1083,  166,  166,
-      166,  167,  167,  167,  168,  276,  192,  169,  334,  168,
-      168,  168,  169,  169,  169,  192,  250,  167,  250,  342,
-      454,  192,  276,  168,  250,  238,  166,  342,  192,  238,
-      169,  192,  192,  250,  342,  238,  238,  168,  175,  175,
-      175,  175,  175,  175,  175,  175,  177,  663,  177,  177,
-
-      177,  177,  177,  177,  177,  177,  178,  663,  178,  178,
-      178,  178,  178,  178,  178,  178,  187,  341,  344,  348,
-      341,  346,  348,  344,  187,  200,  200,  200,  200,  200,
-      200,  200,  200,  229,  418,  229,  347,  229,  418,  346,
-      229,  187,  347,  229,  470,  229,  229,  470,  202,  187,
-      202,  202,  202,  202,  202,  202,  202,  202,  203,  213,
-      203,  203,  203,  203,  203,  203,  203,  203,  213,  259,
-      259,  259, 1084,  226,  213,  226,  259,  374,  350,  226,
-      270,  213,  236,  226,  213,  213,  270,  353,  226,  236,
-      236,  374,  236,  242,  397,  236,  353,  242,  270,  350,
-
-      427,  242,  253,  253,  427,  353, 1085,  242,  397,  253,
-      242,  242,  458,  254,  253,  254,  489,  466,  253,  458,
-      494,  254,  254,  466,  265,  489,  254,  254,  265,  495,
-      265,  275,  265,  583,  275,  495, 1086,  265,  275,  494,
-      380,  265,  265,  275,  275,  380,  380,  380,  583,  275,
-      275,  278,  278,  278,  278,  278,  278,  278,  278,  279,
-      279,  279,  279,  279,  279,  279,  279,  280, 1087,  280,
-      280,  280,  280,  280,  280,  280,  280,  281,  763,  281,
-      281,  281,  281,  281,  281,  281,  281,  293,  293,  293,
-      293,  293,  293,  293,  293,  294,  294,  294,  294,  294,
-
-      294,  294,  294,  295,  529,  295,  295,  295,  295,  295,
-      295,  295,  295,  296,  527,  296,  296,  296,  296,  296,
-      296,  296,  296,  306,  763,  657,  383,  511,  527,  529,
-      306,  383,  383,  383,  306,  306,  306,  306,  306,  306,
-      306,  306,  307,  535,  511,  384,  531,  657, 1089,  307,
-      384,  384,  384,  307,  307,  307,  307,  307,  307,  307,
-      307,  308,  535,  533,  535,  384,  483,  647,  308,  483,
-      308,  531,  308,  308,  308,  308,  308,  308,  308,  308,
-      309,  556,  483,  383,  647,  534, 1090,  309,  533,  309,
-      315,  309,  309,  309,  309,  309,  309,  309,  309,  556,
-
-      315,  315,  315,  315,  315,  315,  315,  315,  316,  316,
-      534,  485,  574, 1092,  485,  572,  316,  574, 1093,  316,
-      316,  316,  316,  316,  316,  316,  316,  485,  589,  572,
-      316,  589,  316,  316,  316,  316,  316,  316,  465,  465,
-      316,  316,  316,  316,  316,  316,  609,  576,  316,  465,
-      601,  465,  381,  576,  434,  609,  316,  381,  381,  381,
-      434,  317,  316,  434,  316,  601,  316,  633,  316,  317,
-      316,  317,  317,  317,  317,  317,  317,  317,  317,  318,
-      637,  633, 1094,  381,  637,  678,  678,  318, 1095,  318,
-      318,  318,  318,  318,  318,  318,  318,  322,  322,  322,
-
-      322,  322,  322,  322,  322,  322,  322,  322,  322,  328,
-      688,  688,  688,  651,  694,  694, 1096,  322,  322,  322,
-      490,  651,  330,  328,  330,  330,  330,  330,  330,  330,
-      330,  330,  328,  490,  642,  382,  749,  700,  328,  700,
-      382,  382,  382,  490,  772,  328,  642,  772,  328,  328,
-      337,  337,  337,  337,  337,  337,  337,  337,  339,  339,
-      768,  749,  768,  401,  769,  769,  339,  382,  401,  401,
-      401,  322,  323,  323,  323,  323,  323,  323,  323,  323,
-      323,  323,  323,  323,  360,  360,  360,  360,  360,  360,
-      360,  360,  323,  323,  323,  361,  664,  361,  361,  361,
-
-      361,  361,  361,  361,  361,  664,  339,  401,  691,  323,
-      753, 1098,  339,  779,  339,  759,  339,  691,  339,  362,
-      339,  362,  362,  362,  362,  362,  362,  362,  362,  377,
-      377,  377,  377,  377,  377,  377,  377,  385,  779,  753,
-     1101,  752,  385,  385,  385,  378,  323,  378,  378,  378,
-      378,  378,  378,  378,  378,  379,  739,  379,  379,  379,
-      379,  379,  379,  379,  379,  386, 1102,  755,  387,  759,
-      386,  386,  386,  387,  387,  387,  752, 1103,  739,  752,
-      770,  388,  758,  385,  389,  386,  388,  388,  388,  389,
-      389,  389,  390,  770, 1104,  760,  391,  390,  390,  390,
-
-      387,  391,  391,  391,  771,  771,  819,  392,  755,  761,
-      399,  388,  392,  392,  392,  399,  399,  399,  400,  762,
-      819,  402,  773,  400,  400,  400,  402,  402,  402,  403,
-      773,  959, 1105,  404,  403,  403,  403,  391,  404,  404,
-      404,  389,  758,  405,  959,  754,  406,  390,  405,  405,
-      405,  406,  406,  406,  407,  760,  399,  408, 1107,  407,
-      407,  407,  408,  408,  408,  409,  754,  745,  943,  761,
-      409,  409,  409,  403,  392,  400,  516,  943, 1108,  762,
-      402,  516,  516,  516,  402,  777,  924,  754,  924,  774,
-      404,  444,  444,  444,  444,  444,  444,  444,  444,  745,
-
-      405,  577,  745,  408,  774,  406,  522,  577,  777, 1110,
-      409,  522,  522,  522,  577,  407,  445,  445,  445,  445,
-      445,  445,  445,  445,  446,  775,  446,  446,  446,  446,
-      446,  446,  446,  446,  447, 1111,  447,  447,  447,  447,
-      447,  447,  447,  447,  501,  949,  501,  522,  949,  501,
-      501,  501,  502,  807,  502, 1114,  501,  502,  502,  502,
-      775,  827,  501,  501,  502,  827,  501,  776,  807, 1115,
-      502,  502,  513,  513,  513,  513,  513,  513,  513,  513,
-      514,  961,  514,  514,  514,  514,  514,  514,  514,  514,
-      515,  961,  515,  515,  515,  515,  515,  515,  515,  515,
-
-      517, 1116,  776,  518,  744,  517,  517,  517,  518,  518,
-      518,  953,  519,  751,  953,  520,  756,  519,  519,  519,
-      520,  520,  520,  521, 1117, 1018,  909, 1118,  521,  521,
-      521,  517,  519,  566,  591,  518,  744,  756,  566,  591,
-     1120, 1121,  756,  744,  566,  591,  751,  520,  566,  591,
-     1018,  909,  751,  521,  566,  591,  706,  706,  706,  706,
-      706,  706,  706,  706,  707,  707,  707,  707,  707,  707,
-      707,  707,  708,  909,  708,  708,  708,  708,  708,  708,
-      708,  708,  709, 1123,  709,  709,  709,  709,  709,  709,
-      709,  709,  720,  720,  720,  720,  720,  720,  720,  720,
-
-      721,  721,  721,  721,  721,  721,  721,  721,  722, 1020,
-      722,  722,  722,  722,  722,  722,  722,  722,  723,  748,
-      723,  723,  723,  723,  723,  723,  723,  723,  734,  913,
-      750,  857, 1125,  913, 1020,  734,  857,  857,  857,  734,
-      734,  734,  734,  734,  734,  734,  734,  735,  748,  743,
-      743,  750, 1126,  748,  735, 1127,  735,  743,  735,  735,
-      735,  735,  735,  735,  735,  735,  736,  939, 1128,  750,
-     1129,  939, 1131,  736, 1132,  736,  740,  736,  736,  736,
-      736,  736,  736,  736,  736,  746,  740,  740,  740,  740,
-      740,  740,  740,  740,  757,  857,  778,  743, 1134, 1130,
-
-      788,  788, 1135,  743, 1138,  743,  746,  743,  788,  743,
-      927,  743,  927,  839,  746, 1130,  757,  778,  839,  839,
-      839,  746,  838, 1028,  927,  757,  764,  838,  838,  838,
-     1028,  778, 1140, 1061,  757, 1113,  764,  764,  764,  764,
-      764,  764,  764,  764,  765, 1061, 1142, 1113, 1143, 1144,
-     1146,  839,  765,  838,  765,  765,  765,  765,  765,  765,
-      765,  765,  766, 1147, 1148, 1149, 1150, 1151, 1152, 1153,
-      766, 1155,  766,  766,  766,  766,  766,  766,  766,  766,
-      780, 1156,  780,  780,  780,  780,  780,  780,  780,  780,
-      821,  821,  821,  821,  821,  821,  821,  821,  822, 1157,
-
-      822,  822,  822,  822,  822,  822,  822,  822,  836,  836,
-      836,  836,  836,  836,  836,  836,  837, 1158,  837,  837,
-      837,  837,  837,  837,  837,  837,  840, 1136, 1159, 1160,
-     1154,  840,  840,  840,  841,  822, 1136,  842, 1161,  841,
-      841,  841,  842,  842,  842,  843, 1154, 1162, 1162,  844,
-      843,  843,  843,  837,  844,  844,  844,  842, 1164, 1165,
-      845,  841, 1166,  846,  840,  845,  845,  845,  846,  846,
-      846,  847, 1167, 1168,  844,  849,  847,  847,  847,  848,
-      849,  849,  849,  845,  848,  848,  848,  845,  858, 1169,
-     1170, 1171, 1172,  858,  858,  858,  859,  843, 1173,  860,
-
-     1064,  859,  859,  859,  860,  860,  860, 1174, 1064,  861,
-      951, 1064,  951,  846,  861,  861,  861,  848,  951,  847,
-      862,  951, 1175,  847,  863,  862,  862,  862,  864,  863,
-      863,  863, 1176,  864,  864,  864,  865, 1177,  849, 1178,
-     1180,  865,  865,  865,  866,  859,  858,  867, 1181,  866,
-      866,  866,  867,  867,  867, 1182, 1183,  868, 1185, 1186,
-     1006,  860,  868,  868,  868, 1006, 1006, 1006, 1188, 1190,
-      862,  905,  905,  905,  905,  905,  905,  905,  905, 1191,
-     1192,  906,  863,  906,  906,  906,  906,  906,  906,  906,
-      906,  864,  867, 1193,  942,  865, 1198,  975, 1006,  975,
-
-      866,  942,  975,  975,  975, 1199, 1200,  942, 1201,  868,
-     1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003,  906, 1004,
-     1187, 1004, 1004, 1004, 1004, 1004, 1004, 1004, 1004, 1005,
-     1202, 1187, 1007, 1187, 1005, 1005, 1005, 1007, 1007, 1007,
-     1008, 1203, 1204, 1009, 1206, 1008, 1008, 1008, 1009, 1009,
-     1009, 1122, 1208, 1209, 1210, 1122, 1004, 1010, 1211, 1007,
-     1005, 1122, 1010, 1010, 1010, 1008, 1009, 1212, 1213, 1215,
-     1009, 1216, 1217, 1217, 1217, 1217, 1217, 1217, 1217, 1217,
-     1218, 1219, 1218, 1218, 1218, 1218, 1218, 1218, 1218, 1218,
-     1220, 1221, 1222, 1223, 1224, 1010, 1225, 1223, 1226, 1227,
-
-     1227, 1227, 1227, 1227, 1227, 1227, 1227, 1228, 1229, 1228,
-     1228, 1228, 1228, 1228, 1228, 1228, 1228, 1218, 1230, 1231,
-     1232, 1233, 1234, 1235, 1236, 1233, 1237, 1238, 1239, 1240,
-     1240, 1241, 1242, 1243, 1238, 1244, 1238, 1240, 1245, 1246,
-     1247, 1248, 1249, 1250, 1228, 1251, 1252, 1253, 1255, 1257,
-     1254, 1256, 1258, 1239, 1259, 1260, 1263, 1261, 1262, 1264,
-     1241, 1265, 1243, 1266, 1267, 1268, 1269, 1270, 1271, 1244,
-     1248, 1242, 1256, 1238, 1249, 1254, 1272, 1246, 1245, 1251,
-     1275, 1259, 1275, 1276, 1280, 1252, 1278, 1277, 1276, 1280,
-     1265, 1258, 1273, 1277, 1278, 1283, 1259, 1261, 1262, 1284,
-
-     1282, 1266, 1273, 1273, 1273, 1273, 1273, 1273, 1273, 1273,
-     1279, 1281, 1287, 1269, 1279, 1290, 1271, 1268, 1285, 1286,
-     1279, 1284, 1291, 1292, 1294, 1281, 1295, 1267, 1268, 1283,
-     1271, 1296, 1274, 1282, 1293, 1270, 1297, 1298, 1293, 1272,
-     1274, 1299, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274,
-     1300, 1286, 1285, 1301, 1288, 1287, 1288, 1288, 1288, 1288,
-     1288, 1288, 1288, 1288, 1302, 1303, 1304, 1305, 1306, 1307,
-     1308, 1309, 1311, 1312, 1313, 1314, 1315, 1274, 1316, 1317,
-     1318, 1319, 1320, 1321, 1322, 1323, 1324, 1325, 1326, 1327,
-     1328, 1288, 1329, 1330, 1331, 1309, 1332, 1333, 1334, 1335,
-
-     1336, 1318, 1337, 1338, 1336, 1339, 1353, 1354, 1340, 1355,
-     1339, 1339, 1339, 1340, 1340, 1340, 1341, 1356, 1357, 1342,
-     1359, 1341, 1341, 1341, 1342, 1342, 1342, 1343, 1371, 1372,
-     1344, 1373, 1343, 1343, 1343, 1344, 1344, 1344, 1339, 1345,
-     1374, 1340, 1346, 1377, 1345, 1345, 1345, 1346, 1346, 1346,
-     1347, 1378, 1342, 1348, 1380, 1347, 1347, 1347, 1348, 1348,
-     1348, 1349, 1345, 1381, 1350, 1382, 1349, 1349, 1349, 1350,
-     1350, 1350, 1347, 1358, 1341, 1351, 1383, 1358, 1385, 1343,
-     1351, 1351, 1351, 1346, 1352, 1386, 1387, 1360, 1344, 1352,
-     1352, 1352, 1360, 1360, 1360, 1389, 1390, 1361, 1391, 1392,
-
-     1362, 1348, 1361, 1361, 1361, 1362, 1362, 1362, 1393, 1394,
-     1363, 1350, 1395, 1396, 1399, 1363, 1363, 1363, 1351, 1363,
-     1363, 1363, 1400, 1401, 1364, 1402, 1403, 1365, 1349, 1364,
-     1364, 1364, 1365, 1365, 1365, 1366, 1404, 1405, 1367, 1406,
-     1366, 1366, 1366, 1367, 1367, 1367, 1407, 1368, 1360, 1412,
-     1369, 1413, 1368, 1368, 1368, 1369, 1369, 1369, 1408, 1370,
-     1409, 1414, 1361, 1362, 1370, 1370, 1370, 1416, 1417, 1414,
-     1418, 1408, 1419, 1409, 1422, 1423, 1424, 1425, 1426, 1427,
-     1364, 1408, 1429, 1365, 1432, 1433, 1434, 1435, 1436, 1436,
-     1367, 1368, 1434, 1366, 1437, 1438, 1440, 1442, 1443, 1444,
-
-     1445, 1446, 1369, 1447, 1442, 1448, 1449, 1450, 1451, 1452,
-     1442, 1453, 1447, 1454, 1447, 1455, 1442, 1370, 1457, 1458,
-     1459, 1460, 1462, 1463, 1466, 1467, 1468, 1469, 1472, 1474,
-     1475, 1476, 1482, 1483, 1485, 1485, 1486, 1487, 1489, 1490,
-     1491, 1492, 1499, 1500, 1493, 1501, 1492, 1492, 1492, 1493,
-     1493, 1493, 1494, 1502, 1503, 1495, 1505, 1494, 1494, 1494,
-     1495, 1495, 1495, 1496, 1506, 1508, 1497, 1509, 1496, 1496,
-     1496, 1497, 1497, 1497, 1492, 1498, 1510, 1493, 1495, 1504,
-     1498, 1498, 1498, 1504, 1511, 1494, 1512, 1512, 1497, 1506,
-     1513, 1513, 1514, 1515, 1517, 1518, 1520, 1522, 1525, 1526,
-
-     1528, 1529, 1535, 1536, 1496, 1537, 1538, 1539, 1540, 1541,
-     1542, 1543, 1544, 1546, 1547, 1552, 1553, 1554, 1498, 1543,
-     1555, 1556, 1557, 1558, 1564, 1565, 1566, 1568, 1570, 1571,
-     1572, 1574, 1575, 1579, 1580, 1582, 1583, 1584, 1585, 1586,
-     1588, 1589, 1586, 1586, 1590, 1591, 1592, 1593, 1594, 1595,
-     1596, 1598, 1599, 1600, 1601, 1602, 1604, 1605, 1607, 1608,
-     1609, 1610, 1611, 1612, 1613, 1617, 1618, 1619, 1620, 1622,
-     1624, 1622, 1625, 1627, 1629, 1630, 1631, 1622, 1632, 1633,
-     1635, 1636, 1622, 1638, 1640, 1641, 1643, 1632, 1644, 1645,
-     1646, 1647, 1649, 1648, 1651, 1652, 1651, 1653, 1654, 1655,
-
-     1656, 1657, 1658, 1640, 1648, 1659, 1660, 1661, 1662, 1663,
-     1664, 1665, 1666, 1668, 1670, 1673, 1675, 1676, 1677, 1678,
-     1679, 1680, 1681, 1684, 1685, 1686, 1687, 1688, 1689, 1690,
-     1692, 1694, 1695, 1697, 1698, 1696, 1699, 1700, 1701, 1702,
-     1703, 1705, 1704, 1706, 1709, 1707, 1710, 1711, 1712, 1714,
-     1708, 1713, 1715, 1716, 1718, 1717, 1717, 1699, 1694, 1695,
-     1696, 1719, 1700, 1720, 1702, 1703, 1721, 1706, 1707, 1697,
-     1704, 1708, 1713, 1723, 1698, 1711, 1717, 1724, 1701, 1705,
-     1722, 1712, 1710, 1725, 1726, 1727, 1728, 1730, 1729, 1731,
-     1732, 1733, 1735, 1727, 1726, 1708, 1734, 1728, 1729, 1736,
-
-     1737, 1714, 1738, 1716, 1739, 1715, 1740, 1741, 1743, 1744,
-     1745, 1746, 1721, 1747, 1748, 1749, 1718, 1735, 1719, 1722,
-     1733, 1735, 1731, 1734, 1751, 1752, 1753, 1754, 1755, 1720,
-     1732, 1757, 1730, 1758, 1759, 1760, 1762, 1764, 1765, 1736,
-     1766, 1768, 1764, 1769, 1770, 1771, 1772, 1773, 1774, 1775,
-     1776, 1777, 1778, 1775, 1779, 1780, 1781, 1782, 1783, 1784,
-     1785, 1766, 1786, 1787, 1788, 1789, 1802, 1803, 1790, 1804,
-     1789, 1789, 1789, 1790, 1790, 1790, 1791, 1805, 1806, 1792,
-     1807, 1791, 1791, 1791, 1792, 1792, 1792, 1793, 1808, 1809,
-     1823, 1824, 1793, 1793, 1793, 1794, 1825, 1789, 1826, 1827,
-
-     1794, 1794, 1794, 1828, 1790, 1792, 1795, 1829, 1830, 1792,
-     1796, 1795, 1795, 1795, 1831, 1796, 1796, 1796, 1832, 1833,
-     1834, 1794, 1835, 1836, 1838, 1794, 1797, 1839, 1840, 1796,
-     1841, 1797, 1797, 1797, 1798, 1842, 1843, 1791, 1845, 1798,
-     1798, 1798, 1795, 1799, 1846, 1793, 1800, 1847, 1799, 1799,
-     1799, 1800, 1800, 1800, 1801, 1848, 1849, 1810, 1852, 1801,
-     1801, 1801, 1810, 1810, 1810, 1811, 1854, 1853, 1812, 1797,
-     1811, 1811, 1811, 1812, 1812, 1812, 1813, 1853, 1855, 1814,
-     1856, 1813, 1813, 1813, 1814, 1814, 1814, 1799, 1857, 1844,
-     1857, 1801, 1815, 1844, 1859, 1798, 1860, 1815, 1815, 1815,
-
-     1816, 1810, 1857, 1817, 1861, 1816, 1816, 1816, 1817, 1817,
-     1817, 1818, 1858, 1864, 1819, 1866, 1818, 1818, 1818, 1819,
-     1819, 1819, 1820, 1811, 1867, 1821, 1868, 1820, 1820, 1820,
-     1821, 1821, 1821, 1822, 1869, 1871, 1872, 1873, 1822, 1822,
-     1822, 1874, 1875, 1876, 1878, 1879, 1858, 1880, 1816, 1881,
-     1882, 1817, 1883, 1884, 1887, 1858, 1885, 1885, 1883, 1888,
-     1858, 1886, 1886, 1889, 1883, 1890, 1891, 1892, 1893, 1894,
-     1895, 1819, 1818, 1896, 1897, 1898, 1899, 1820, 1900, 1902,
-     1903, 1904, 1905, 1821, 1822, 1906, 1907, 1908, 1822, 1909,
-     1910, 1911, 1912, 1914, 1916, 1914, 1917, 1918, 1919, 1923,
-
-     1924, 1923, 1925, 1932, 1933, 1926, 1934, 1925, 1925, 1925,
-     1926, 1926, 1926, 1927, 1935, 1936, 1928, 1937, 1927, 1927,
-     1927, 1928, 1928, 1928, 1938, 1929, 1939, 1941, 1943, 1949,
-     1929, 1929, 1929, 1950, 1925, 1951, 1952, 1954, 1955, 1927,
-     1930, 1926, 1956, 1927, 1929, 1930, 1930, 1930, 1931, 1953,
-     1957, 1958, 1928, 1931, 1931, 1931, 1953, 1959, 1960, 1953,
-     1960, 1961, 1962, 1963, 1964, 1965, 1966, 1967, 1968, 1969,
-     1970, 1971, 1972, 1973, 1974, 1975, 1977, 1979, 1980, 1979,
-     1981, 1982, 1983, 1930, 1984, 1931, 1985, 1987, 1988, 1989,
-     1990, 1991, 1992, 1994, 1995, 1996, 1997, 2001, 2002, 2003,
-
-     2004, 2005, 2006, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
-     2015, 2017, 2018, 2019, 2021, 2023, 2024, 2025, 2026, 2027,
-     2028, 2029, 2030, 2032, 2033, 2034, 2035, 2036, 2037, 2038,
-     2039, 2040, 2041, 2042, 2043, 2044, 2045, 2046, 2048, 2049,
-     2051, 2052, 2053, 2055, 2056, 2057, 2058, 2049, 2059, 2060,
-     2061, 2063, 2065, 2067, 2068, 2070, 2071, 2072, 2073, 2074,
-     2075, 2076, 2073, 2077, 2078, 2079, 2080, 2081, 2082, 2083,
-     2080, 2084, 2085, 2086, 2087, 2089, 2088, 2090, 2091, 2093,
-     2092, 2094, 2095, 2096, 2097, 2099, 2098, 2100, 2102, 2101,
-     2103, 2104, 2106, 2107, 2110, 2108, 2105, 2109, 2109, 2111,
-
-     2112, 2113, 2086, 2092, 2114, 2115, 2090, 2121, 2087, 2088,
-     2101, 2089, 2116, 2116, 2091, 2094, 2103, 2121, 2109, 2120,
-     2095, 2100, 2096, 2097, 2098, 2105, 2124, 2123, 2117, 2102,
-     2115, 2117, 2118, 2120, 2119, 2125, 2118, 2119, 2122, 2118,
-     2126, 2128, 2122, 2127, 2130, 2129, 2131, 2113, 2132, 2133,
-     2107, 2134, 2132, 2136, 2112, 2107, 2108, 2138, 2139, 2140,
-     2141, 2124, 2114, 2142, 2143, 2111, 2123, 2144, 2127, 2129,
-     2125, 2145, 2146, 2147, 2148, 2126, 2149, 2150, 2151, 2152,
-     2153, 2154, 2155, 2156, 2128, 2157, 2158, 2159, 2160, 2130,
-     2161, 2162, 2163, 2164, 2165, 2166, 2167, 2168, 2169, 2170,
-
-     2171, 2159, 2172, 2173, 2174, 2175, 2172, 2176, 2177, 2178,
-     2192, 2193, 2179, 2194, 2178, 2178, 2178, 2179, 2179, 2179,
-     2180, 2196, 2197, 2181, 2198, 2180, 2180, 2180, 2181, 2181,
-     2181, 2182, 2199, 2210, 2183, 2211, 2182, 2182, 2182, 2183,
-     2183, 2183, 2184, 2212, 2213, 2214, 2195, 2184, 2184, 2184,
-     2195, 2215, 2178, 2216, 2217, 2179, 2185, 2218, 2181, 2219,
-     2183, 2185, 2185, 2185, 2183, 2186, 2182, 2220, 2187, 2221,
-     2186, 2186, 2186, 2187, 2187, 2187, 2188, 2184, 2222, 2189,
-     2224, 2188, 2188, 2188, 2189, 2189, 2189, 2190, 2225, 2226,
-     2227, 2185, 2190, 2190, 2190, 2191, 2228, 2229, 2200, 2230,
-
-     2191, 2191, 2191, 2200, 2200, 2200, 2231, 2232, 2186, 2201,
-     2233, 2187, 2234, 2188, 2201, 2201, 2201, 2202, 2191, 2235,
-     2203, 2236, 2202, 2202, 2202, 2203, 2203, 2203, 2204, 2237,
-     2238, 2205, 2239, 2204, 2204, 2204, 2205, 2205, 2205, 2206,
-     2243, 2244, 2207, 2242, 2206, 2206, 2206, 2207, 2207, 2207,
-     2208, 2242, 2245, 2209, 2246, 2208, 2208, 2208, 2209, 2209,
-     2209, 2200, 2247, 2248, 2249, 2250, 2251, 2252, 2254, 2255,
-     2257, 2258, 2259, 2260, 2202, 2261, 2262, 2263, 2266, 2267,
-     2268, 2205, 2269, 2270, 2271, 2273, 2274, 2275, 2276, 2281,
-     2282, 2283, 2285, 2207, 2291, 2292, 2293, 2207, 2295, 2296,
-
-     2297, 2298, 2299, 2300, 2302, 2303, 2304, 2305, 2306, 2307,
-     2208, 2308, 2309, 2209, 2310, 2311, 2319, 2320, 2312, 2321,
-     2311, 2311, 2311, 2312, 2312, 2312, 2323, 2313, 2324, 2325,
-     2314, 2326, 2313, 2313, 2313, 2314, 2314, 2314, 2315, 2327,
-     2328, 2316, 2329, 2315, 2315, 2315, 2316, 2316, 2316, 2317,
-     2330, 2331, 2332, 2322, 2317, 2317, 2317, 2322, 2311, 2333,
-     2334, 2312, 2313, 2335, 2318, 2314, 2336, 2337, 2338, 2318,
-     2318, 2318, 2339, 2340, 2341, 2342, 2343, 2344, 2346, 2348,
-     2345, 2315, 2349, 2350, 2316, 2351, 2317, 2318, 2345, 2352,
-     2353, 2354, 2355, 2356, 2357, 2358, 2359, 2360, 2361, 2362,
-
-     2363, 2364, 2365, 2366, 2367, 2368, 2369, 2370, 2371, 2372,
-     2373, 2374, 2375, 2376, 2377, 2378, 2379, 2380, 2381, 2382,
-     2383, 2384, 2385, 2386, 2387, 2388, 2389, 2390, 2391, 2392,
-     2393, 2394, 2395, 2397, 2398, 2399, 2400, 2401, 2402, 2403,
-     2404, 2405, 2406, 2407, 2408, 2409, 2410, 2411, 2412, 2413,
-     2414, 2415, 2416, 2417, 2418, 2419, 2420, 2421, 2422, 2423,
-     2424, 2425, 2426, 2427, 2429, 2430, 2431, 2432, 2434, 2435,
-     2436, 2437, 2435, 2438, 2439, 2440, 2441, 2442, 2443, 2444,
-     2445, 2435, 2435, 2446, 2447, 2448, 2449, 2435, 2435, 2450,
-     2451, 2452, 2454, 2455, 2456, 2457, 2458, 2459, 2460, 2461,
-
-     2462, 2463, 2464, 2465, 2468, 2466, 2467, 2469, 2471, 2470,
-     2472, 2473, 2474, 2475, 2476, 2477, 2456, 2478, 2488, 2493,
-     2461, 2462, 2479, 2458, 2457, 2489, 2454, 2480, 2465, 2466,
-     2485, 2481, 2479, 2481, 2485, 2459, 2469, 2480, 2460, 2483,
-     2467, 2463, 2464, 2470, 2468, 2482, 2491, 2482, 2487, 2483,
-     2484, 2486, 2488, 2490, 2492, 2494, 2473, 2478, 2474, 2496,
-     2484, 2486, 2497, 2489, 2493, 2477, 2500, 2501, 2502, 2504,
-     2505, 2476, 2506, 2487, 2475, 2492, 2472, 2507, 2471, 2477,
-     2508, 2490, 2509, 2510, 2491, 2490, 2511, 2512, 2514, 2515,
-     2516, 2517, 2518, 2519, 2494, 2520, 2521, 2518, 2522, 2523,
-
-     2524, 2525, 2526, 2527, 2528, 2529, 2530, 2531, 2532, 2518,
-     2533, 2534, 2535, 2536, 2537, 2538, 2539, 2540, 2541, 2542,
-     2523, 2543, 2555, 2556, 2544, 2557, 2543, 2543, 2543, 2544,
-     2544, 2544, 2545, 2558, 2559, 2546, 2560, 2545, 2545, 2545,
-     2546, 2546, 2546, 2561, 2547, 2562, 2563, 2548, 2571, 2547,
-     2547, 2547, 2548, 2548, 2548, 2572, 2573, 2549, 2543, 2574,
-     2550, 2544, 2549, 2549, 2549, 2550, 2550, 2550, 2575, 2576,
-     2577, 2578, 2579, 2580, 2581, 2545, 2582, 2583, 2546, 2547,
-     2551, 2584, 2548, 2552, 2585, 2551, 2551, 2551, 2552, 2552,
-     2552, 2553, 2586, 2587, 2554, 2588, 2553, 2553, 2553, 2554,
-
-     2554, 2554, 2564, 2589, 2590, 2565, 2591, 2564, 2564, 2564,
-     2565, 2565, 2565, 2592, 2553, 2593, 2566, 2551, 2594, 2567,
-     2552, 2566, 2566, 2566, 2567, 2567, 2567, 2595, 2568, 2596,
-     2597, 2569, 2554, 2568, 2568, 2568, 2569, 2569, 2569, 2570,
-     2598, 2599, 2600, 2601, 2570, 2570, 2570, 2603, 2605, 2606,
-     2564, 2607, 2608, 2609, 2610, 2611, 2610, 2612, 2613, 2614,
-     2615, 2616, 2617, 2618, 2619, 2620, 2621, 2622, 2565, 2623,
-     2624, 2625, 2626, 2631, 2632, 2633, 2635, 2636, 2637, 2567,
-     2638, 2639, 2640, 2641, 2642, 2643, 2644, 2645, 2568, 2646,
-     2647, 2648, 2647, 2649, 2650, 2651, 2652, 2661, 2662, 2663,
-
-     2653, 2664, 2646, 2654, 2646, 2653, 2653, 2653, 2654, 2654,
-     2654, 2655, 2665, 2666, 2656, 2667, 2655, 2655, 2655, 2656,
-     2656, 2656, 2657, 2668, 2669, 2658, 2670, 2657, 2657, 2657,
-     2658, 2658, 2658, 2671, 2672, 2673, 2674, 2653, 2659, 2675,
-     2654, 2660, 2676, 2659, 2659, 2659, 2660, 2660, 2660, 2677,
-     2678, 2679, 2680, 2681, 2655, 2682, 2683, 2656, 2684, 2657,
-     2685, 2659, 2658, 2686, 2687, 2688, 2689, 2691, 2692, 2693,
-     2694, 2695, 2696, 2697, 2698, 2699, 2700, 2701, 2702, 2660,
-     2703, 2704, 2705, 2706, 2707, 2708, 2709, 2710, 2711, 2712,
-     2713, 2714, 2715, 2716, 2717, 2718, 2719, 2720, 2721, 2722,
-
-     2723, 2724, 2725, 2726, 2727, 2728, 2729, 2730, 2731, 2732,
-     2733, 2734, 2735, 2736, 2737, 2738, 2739, 2740, 2741, 2742,
-     2743, 2744, 2745, 2746, 2747, 2750, 2751, 2752, 2753, 2754,
-     2755, 2756, 2757, 2758, 2759, 2760, 2761, 2762, 2763, 2764,
-     2765, 2767, 2768, 2769, 2770, 2771, 2772, 2773, 2774, 2775,
-     2776, 2777, 2778, 2779, 2780, 2781, 2782, 2783, 2784, 2785,
-     2786, 2787, 2788, 2789, 2790, 2791, 2792, 2793, 2794, 2795,
-     2796, 2777, 2797, 2798, 2799, 2800, 2801, 2802, 2803, 2805,
-     2806, 2804, 2807, 2798, 2808, 2809, 2810, 2811, 2812, 2813,
-     2814, 2815, 2816, 2817, 2818, 2819, 2820, 2825, 2813, 2821,
-
-     2821, 2806, 2822, 2807, 2823, 2808, 2799, 2825, 2823, 2800,
-     2810, 2805, 2802, 2803, 2804, 2824, 2826, 2827, 2831, 2824,
-     2821, 2827, 2812, 2829, 2828, 2830, 2826, 2809, 2828, 2832,
-     2830, 2833, 2834, 2829, 2835, 2836, 2837, 2815, 2838, 2816,
-     2839, 2842, 2822, 2843, 2816, 2844, 2845, 2846, 2847, 2819,
-     2817, 2849, 2850, 2814, 2851, 2818, 2816, 2852, 2831, 2853,
-     2854, 2820, 2855, 2856, 2857, 2839, 2858, 2859, 2860, 2834,
-     2861, 2835, 2862, 2863, 2832, 2864, 2833, 2838, 2865, 2867,
-     2836, 2837, 2868, 2869, 2870, 2871, 2872, 2873, 2874, 2875,
-     2876, 2877, 2878, 2879, 2880, 2881, 2882, 2883, 2884, 2865,
-
-     2885, 2886, 2896, 2897, 2887, 2898, 2886, 2886, 2886, 2887,
-     2887, 2887, 2888, 2899, 2900, 2889, 2901, 2888, 2888, 2888,
-     2889, 2889, 2889, 2890, 2886, 2902, 2891, 2887, 2890, 2890,
-     2890, 2891, 2891, 2891, 2892, 2903, 2904, 2893, 2909, 2892,
-     2892, 2892, 2893, 2893, 2893, 2910, 2911, 2912, 2894, 2888,
-     2913, 2914, 2889, 2894, 2894, 2894, 2895, 2892, 2915, 2905,
-     2893, 2895, 2895, 2895, 2905, 2905, 2905, 2906, 2916, 2917,
-     2907, 2918, 2906, 2906, 2906, 2907, 2907, 2907, 2908, 2919,
-     2920, 2921, 2922, 2908, 2908, 2908, 2894, 2923, 2924, 2925,
-     2926, 2927, 2928, 2929, 2895, 2930, 2931, 2932, 2933, 2934,
-
-     2935, 2936, 2937, 2938, 2939, 2941, 2942, 2943, 2944, 2945,
-     2946, 2947, 2948, 2949, 2950, 2951, 2952, 2953, 2954, 2955,
-     2956, 2957, 2957, 2958, 2959, 2960, 2961, 2962, 2963, 2906,
-     2959, 2964, 2965, 2966, 2967, 2968, 2969, 2970, 2971, 2972,
-     2973, 2974, 2975, 2976, 2977, 2978, 2979, 2980, 2981, 2982,
-     2983, 2984, 2985, 2986, 2987, 2988, 2996, 2997, 2989, 2998,
-     2988, 2988, 2988, 2989, 2989, 2989, 2990, 2999, 3000, 2991,
-     3001, 2990, 2990, 2990, 2991, 2991, 2991, 2992, 2988, 3002,
-     3003, 2989, 2992, 2992, 2992, 2993, 3004, 3005, 2994, 3006,
-     2993, 2993, 2993, 2994, 2994, 2994, 3007, 3008, 3009, 3010,
-
-     2992, 3011, 3012, 2990, 2995, 3013, 2991, 3014, 2993, 2995,
-     2995, 2995, 3015, 3016, 3017, 3018, 3019, 3020, 3021, 3022,
-     3023, 3024, 3025, 3026, 3027, 3028, 2994, 3029, 3030, 3031,
-     3032, 3033, 3034, 3035, 3036, 3037, 3038, 3039, 3040, 3042,
-     3041, 3043, 2995, 3041, 3044, 3045, 3046, 3047, 3048, 3049,
-     3050, 3051, 3052, 3053, 3054, 3055, 3056, 3057, 3058, 3059,
-     3060, 3061, 3062, 3063, 3064, 3065, 3066, 3067, 3068, 3069,
-     3070, 3071, 3072, 3073, 3074, 3075, 3076, 3077, 3078, 3079,
-     3080, 3081, 3083, 3084, 3085, 3086, 3087, 3088, 3089, 3090,
-     3091, 3092, 3093, 3094, 3095, 3096, 3097, 3098, 3099, 3100,
-
-     3101, 3102, 3103, 3104, 3105, 3106, 3107, 3108, 3109, 3110,
-     3111, 3112, 3113, 3114, 3115, 3116, 3117, 3118, 3119, 3120,
-     3121, 3122, 3123, 3124, 3125, 3126, 3127, 3128, 3129, 3130,
-     3131, 3132, 3133, 3134, 3135, 3136, 3137, 3138, 3139, 3140,
-     3141, 3142, 3143, 3144, 3145, 3146, 3147, 3148, 3149, 3130,
-     3150, 3151, 3154, 3152, 3155, 3133, 3164, 3158, 3132, 3135,
-     3140, 3158, 3139, 3156, 3143, 3142, 3153, 3153, 3157, 3165,
-     3160, 3134, 3161, 3156, 3131, 3159, 3137, 3138, 3157, 3159,
-     3160, 3162, 3161, 3155, 3163, 3141, 3162, 3153, 3166, 3163,
-     3167, 3168, 3169, 3144, 3170, 3146, 3164, 3171, 3172, 3173,
-
-     3176, 3145, 3149, 3152, 3150, 3177, 3147, 3148, 3165, 3179,
-     3180, 3181, 3182, 3183, 3184, 3185, 3151, 3186, 3187, 3188,
-     3189, 3190, 3171, 3191, 3192, 3193, 3194, 3166, 3195, 3196,
-     3197, 3169, 3198, 3170, 3199, 3167, 3168, 3200, 3172, 3201,
-     3202, 3193, 3203, 3204, 3205, 3206, 3207, 3208, 3209, 3210,
-     3211, 3212, 3213, 3214, 3222, 3223, 3215, 3224, 3214, 3214,
-     3214, 3215, 3215, 3215, 3216, 3225, 3226, 3217, 3227, 3216,
-     3216, 3216, 3217, 3217, 3217, 3218, 3228, 3229, 3219, 3230,
-     3218, 3218, 3218, 3219, 3219, 3219, 3232, 3216, 3233, 3234,
-     3217, 3214, 3220, 3235, 3215, 3221, 3236, 3220, 3220, 3220,
-
-     3221, 3221, 3221, 3231, 3237, 3238, 3239, 3240, 3231, 3231,
-     3231, 3241, 3242, 3218, 3244, 3243, 3219, 3245, 3246, 3247,
-     3248, 3249, 3221, 3250, 3251, 3252, 3253, 3254, 3255, 3256,
-     3220, 3243, 3243, 3257, 3258, 3259, 3260, 3261, 3262, 3261,
-     3263, 3264, 3265, 3266, 3267, 3268, 3269, 3270, 3271, 3272,
-     3273, 3274, 3275, 3275, 3276, 3277, 3278, 3279, 3280, 3281,
-     3282, 3283, 3285, 3286, 3286, 3287, 3288, 3289, 3290, 3291,
-     3292, 3293, 3294, 3295, 3296, 3297, 3298, 3299, 3300, 3301,
-     3302, 3303, 3304, 3305, 3306, 3307, 3308, 3309, 3310, 3311,
-     3312, 3320, 3321, 3313, 3322, 3312, 3312, 3312, 3313, 3313,
-
-     3313, 3314, 3323, 3324, 3315, 3325, 3314, 3314, 3314, 3315,
-     3315, 3315, 3316, 3326, 3327, 3317, 3328, 3316, 3316, 3316,
-     3317, 3317, 3317, 3329, 3314, 3330, 3331, 3315, 3312, 3318,
-     3332, 3313, 3319, 3333, 3318, 3318, 3318, 3319, 3319, 3319,
-     3334, 3335, 3336, 3337, 3338, 3339, 3340, 3341, 3342, 3343,
-     3316, 3344, 3346, 3317, 3347, 3345, 3349, 3350, 3351, 3319,
-     3345, 3352, 3353, 3354, 3355, 3345, 3356, 3318, 3357, 3358,
-     3345, 3359, 3360, 3361, 3362, 3363, 3364, 3365, 3366, 3362,
-     3367, 3368, 3369, 3370, 3362, 3371, 3373, 3374, 3375, 3362,
-     3376, 3377, 3379, 3380, 3381, 3382, 3383, 3384, 3385, 3386,
-
-     3387, 3388, 3389, 3390, 3391, 3392, 3393, 3394, 3395, 3396,
-     3397, 3398, 3399, 3400, 3401, 3402, 3403, 3404, 3405, 3406,
-     3407, 3408, 3409, 3410, 3411, 3412, 3413, 3414, 3415, 3416,
-     3417, 3418, 3419, 3420, 3421, 3422, 3423, 3424, 3425, 3426,
-     3427, 3428, 3429, 3430, 3431, 3432, 3433, 3435, 3436, 3437,
-     3438, 3439, 3440, 3441, 3442, 3443, 3444, 3445, 3446, 3447,
-     3448, 3449, 3450, 3451, 3452, 3453, 3454, 3455, 3456, 3457,
-     3454, 3458, 3459, 3460, 3461, 3462, 3464, 3466, 3463, 3465,
-     3467, 3468, 3469, 3470, 3471, 3472, 3473, 3476, 3475, 3479,
-     3474, 3477, 3478, 3485, 3457, 3480, 3477, 3478, 3466, 3479,
-
-     3486, 3481, 3460, 3461, 3465, 3480, 3481, 3482, 3483, 3487,
-     3488, 3484, 3482, 3483, 3462, 3458, 3463, 3484, 3464, 3489,
-     3495, 3476, 3485, 3490, 3492, 3486, 3493, 3491, 3497, 3498,
-     3500, 3501, 3502, 3503, 3487, 3468, 3504, 3505, 3506, 3507,
-     3508, 3467, 3471, 3470, 3474, 3473, 3469, 3509, 3490, 3488,
-     3472, 3475, 3491, 3510, 3511, 3513, 3514, 3515, 3489, 3516,
-     3474, 3517, 3518, 3519, 3492, 3520, 3493, 3521, 3513, 3522,
-     3523, 3524, 3525, 3526, 3527, 3528, 3529, 3530, 3531, 3532,
-     3533, 3541, 3542, 3534, 3543, 3533, 3533, 3533, 3534, 3534,
-     3534, 3535, 3544, 3545, 3536, 3546, 3535, 3535, 3535, 3536,
-
-     3536, 3536, 3537, 3547, 3548, 3538, 3549, 3537, 3537, 3537,
-     3538, 3538, 3538, 3550, 3551, 3552, 3553, 3539, 3533, 3554,
-     3540, 3534, 3539, 3539, 3539, 3540, 3540, 3540, 3555, 3535,
-     3556, 3557, 3536, 3558, 3560, 3561, 3562, 3563, 3564, 3565,
-     3537, 3566, 3567, 3538, 3539, 3568, 3569, 3570, 3571, 3572,
-     3573, 3574, 3540, 3575, 3576, 3577, 3578, 3579, 3580, 3581,
-     3582, 3583, 3584, 3585, 3586, 3587, 3588, 3589, 3590, 3591,
-     3592, 3593, 3594, 3595, 3596, 3597, 3598, 3599, 3600, 3601,
-     3602, 3603, 3604, 3605, 3606, 3607, 3608, 3609, 3610, 3611,
-     3612, 3613, 3614, 3615, 3616, 3617, 3618, 3619, 3620, 3621,
-
-     3622, 3623, 3624, 3625, 3626, 3627, 3628, 3629, 3630, 3631,
-     3632, 3633, 3634, 3642, 3643, 3635, 3644, 3634, 3634, 3634,
-     3635, 3635, 3635, 3636, 3645, 3646, 3637, 3647, 3636, 3636,
-     3636, 3637, 3637, 3637, 3638, 3648, 3649, 3639, 3650, 3638,
-     3638, 3638, 3639, 3639, 3639, 3651, 3652, 3653, 3654, 3640,
-     3634, 3655, 3641, 3635, 3640, 3640, 3640, 3641, 3641, 3641,
-     3656, 3636, 3657, 3658, 3637, 3659, 3660, 3661, 3662, 3663,
-     3664, 3665, 3638, 3666, 3667, 3639, 3640, 3668, 3669, 3670,
-     3671, 3672, 3673, 3674, 3641, 3675, 3669, 3676, 3677, 3678,
-     3679, 3680, 3681, 3682, 3683, 3684, 3685, 3686, 3687, 3688,
-
-     3689, 3690, 3691, 3692, 3693, 3694, 3695, 3688, 3696, 3697,
-     3698, 3699, 3700, 3697, 3701, 3702, 3703, 3704, 3705, 3698,
-     3706, 3707, 3708, 3709, 3710, 3711, 3712, 3713, 3715, 3716,
+      198,  289,   53,  289,  100,  160,  217,   93,   53,  100,
+      100,  100,   93,   93,   93,   53,  136,   53,  136,  150,
+      217,   99,   53,  160,  198,   93,   99,   99,   99,   55,
+      136,   56,   80,   80,   80,   80,   80,   80,   80,   93,
+      150,  136,  264,  150,   55,  100,   56,  748,  264,   53,
+       54,   54,   54,   54,   54,   54,   54,   54,   54,   54,
+       54,   54,   54,   54,   54,   54,   54,   54,   54,   54,
+       54,   54,   97,   55,   54,   56,   99,   97,   97,   97,
+       54,   55,  338,   56,  338,  239,  748,   54,   55,   54,
+
+       56,   55,  239,   56,   54,   84,  201,   84,   84,   84,
+       84,   84,   84,   84,   85,   94,   85,   85,   85,   85,
+       85,   85,   85,   94,  201,  168,  201,  168, 1062,   94,
+      262,   54,   63,   63,  114,  114,   94,  262,   94,  114,
+       63,   97,  168,   63,   63,   63,   63,   63,   63,   63,
+      273,  114,  114,   63, 1063,   63,   63,   63,   63,   63,
+      257,  171,  273,  257,   63,   63,   96,   63,   63,  102,
+       63,   96,   96,   96,  102,  102,  102,   63,   63,  171,
+      171,   63,  163,   63,  763,   63,  763,   63,  101,   63,
+      163,   63,  103,  101,  101,  101,  163,  103,  103,  103,
+
+      127,  127,  127,  127,  127,  127,  127,  170,  265,  288,
+      102,   96,  128,  128,  128,  128,  128,  128,  128,  265,
+      170,  288,  170,  129,   96,  129,  129,  129,  129,  129,
+      129,  129,  130,  103,  130,  130,  130,  130,  130,  130,
+      130,  274,  274,  101,  936,  220,  936,  103,  139,  139,
+      139,  139,  139,  139,  139,  140,  140,  140,  140,  140,
+      140,  140,  141,  220,  141,  141,  141,  141,  141,  141,
+      141,  142,  148,  142,  142,  142,  142,  142,  142,  142,
+      151, 1065,  224, 1066,  154,  195,  148,  226,  158,  158,
+      148,  219,  158,  195,  151,  148,  158,  164,  151,  158,
+
+      224,  164,  226,  151,  158,  158,  158,  219,  195,  148,
+      230,  164,  164,  164,  148,  154,  195,  151,  166,  753,
+      228, 1067,  151,  169,  154,  154,  278,  166,  230,  154,
+      272,  272,  272,  166,  166,  228,  169,  272,  169,  169,
+      175,  278,  175,  175,  175,  175,  175,  175,  175,  176,
+      509,  176,  176,  176,  176,  176,  176,  176,  177,  252,
+      509,  178,  753,  177,  177,  177,  178,  178,  178,  179,
+      275,  275,  180,  252,  179,  179,  179,  180,  180,  180,
+      181,  182,  332,  232,  236,  181,  181,  181,  332,  182,
+      180,  751,  236,  178,  279,  182,  236,  232,  181,  279,
+
+      232,  179,  182,  232,  182,  184,  184,  184,  184,  184,
+      184,  184,  181,  185,  185,  185,  185,  185,  185,  185,
+      186,  499,  186,  186,  186,  186,  186,  186,  186,  187,
+      499,  187,  187,  187,  187,  187,  187,  187,  188, 1069,
+      188,  188,  188,  188,  188,  188,  188,  189,  751,  189,
+      189,  189,  189,  189,  189,  189,  206,  206,  206,  206,
+      206,  206,  206,  208, 1071,  208,  208,  208,  208,  208,
+      208,  208,  209,  218,  209,  209,  209,  209,  209,  209,
+      209,  218,  957,  263,  308,  263,  231,  218,  231,  258,
+      231,  263,  258,  231,  218,  957,  218,  238,  231,  231,
+
+      263,  238,  260,  308,  260,  238,  397,  260,  258,  258,
+      397,  238,  281,  281,  238,  238,  241,  241,  241,  241,
+      241,  241,  241,  242,  242,  242,  242,  242,  242,  242,
+      243,  949,  243,  243,  243,  243,  243,  243,  243,  244,
+      949,  244,  244,  244,  244,  244,  244,  244,  245, 1072,
+      245,  245,  245,  245,  245,  245,  245,  246, 1073,  246,
+      246,  246,  246,  246,  246,  246,  247, 1074,  247,  247,
+      247,  247,  247,  247,  247,  266,  266,  453,  276,  405,
+      277,  267,  266,  267,  277,  405,  277,  266,  277,  267,
+      267,  266,  276,  277,  267,  267,  287,  277,  277,  290,
+
+      453,  287, 1075,  536,  290,  292,  292,  292,  292,  292,
+      292,  292,  293,  293,  293,  293,  293,  293,  293,  294,
+      536,  294,  294,  294,  294,  294,  294,  294,  295,  300,
+      295,  295,  295,  295,  295,  295,  295,  309,  697,  697,
+      456,  336,  319,  300,  320,  327,  336,  309,  309,  309,
+      309,  309,  309,  309,  310,  310,  319,  475,  320,  327,
+      321,  344,  310,  456,  475,  310,  310,  310,  310,  310,
+      310,  310,  344, 1077,  321,  310,  334,  310,  310,  310,
+      310,  310,  321,  344,  334,  342,  310,  310,  321,  310,
+      310,  334,  310,  597,  342,  321,  364,  321,  597,  310,
+
+      310,  600,  342,  310,  311,  310, 1080,  310,  600,  310,
+      364,  310,  311,  310,  311,  311,  311,  311,  311,  311,
+      311,  312,  329,  329,  329,  329,  329,  329,  329,  312,
+      467,  312,  312,  312,  312,  312,  312,  312,  316,  316,
+      316,  316,  316,  316,  316,  316,  316,  316,  316,  316,
+      483,  718,  718,  467,  350,  379,  483,  316,  316,  316,
+      323,  350,  323,  323,  323,  323,  323,  323,  323,  379,
+      683,  350,  351,  351,  351,  351,  351,  351,  351,  352,
+      683,  352,  352,  352,  352,  352,  352,  352,  353,  667,
+      353,  353,  353,  353,  353,  353,  353,  366,  366,  366,
+
+      366,  366,  366,  366,  519, 1081,  667,  754,  519,  316,
+      317,  317,  317,  317,  317,  317,  317,  317,  317,  317,
+      317,  317,  446,  446,  446,  446,  446,  446,  446,  317,
+      317,  317,  367,  468,  367,  367,  367,  367,  367,  367,
+      367,  764,  764,  469,  470,  368,  317,  368,  368,  368,
+      368,  368,  368,  368,  369,  471,  468,  370,  754,  369,
+      369,  369,  370,  370,  370,  371,  469,  470,  372,  566,
+      371,  371,  371,  372,  372,  372, 1082,  513,  471,  373,
+      472,  317,  331,  331,  373,  373,  373,  370,  372,  513,
+      331,  551,  374,  566,  567,  380,  371,  374,  374,  374,
+
+      380,  380,  380,  472,  518,  551,  381,  766,  766,  382,
+      373,  381,  381,  381,  382,  382,  382,  383,  567,  500,
+      418,  374,  383,  383,  383,  518,  418,  331,  331,  418,
+      503,  331,  500,  331,  959,  331,  503,  331,  380,  331,
+      384,  331,  500,  568,  959,  384,  384,  384,  385,  558,
+      382,  386,  561,  385,  385,  385,  386,  386,  386,  387,
+      381,  568,  388,  568,  387,  387,  387,  388,  388,  388,
+      662, 1083,  558,  383,  389,  561, 1084,  383,  390,  389,
+      389,  389,  662,  390,  390,  390,  447,  447,  447,  447,
+      447,  447,  447,  448,  384,  448,  448,  448,  448,  448,
+
+      448,  448,  385,  677,  755,  388,  449,  386,  449,  449,
+      449,  449,  449,  449,  449, 1085,  743,  387,  458,  458,
+      458,  458,  458,  458,  458,  677,  611,  735,  389,  611,
+      390,  459,  459,  459,  459,  459,  459,  459,  460,  743,
+      460,  460,  460,  460,  460,  460,  460,  461,  735,  461,
+      461,  461,  461,  461,  461,  461,  482,  482,  526,  745,
+      526,  755,  765,  526,  526,  526,  527,  482,  527,  482,
+      526,  527,  527,  527,  765,  657,  526,  526,  527,  657,
+      526,  741, 1086,  745,  527,  527,  538,  538,  538,  538,
+      538,  538,  538,  539, 1088,  539,  539,  539,  539,  539,
+
+      539,  539,  540, 1089,  540,  540,  540,  540,  540,  540,
+      540,  541,  741, 1091,  542,  741,  541,  541,  541,  542,
+      542,  542,  543,  767, 1092,  544,  767,  543,  543,  543,
+      544,  544,  544,  545,  744, 1093,  546,  756,  545,  545,
+      545,  546,  546,  546,  542,  544,  552,  552,  552,  552,
+      552,  552,  552,  543,  553,  553,  553,  553,  553,  553,
+      553,  740,  744,  769,  545,  546,  554,  744,  554,  554,
+      554,  554,  554,  554,  554,  555,  749,  555,  555,  555,
+      555,  555,  555,  555,  593,  768,  819,  770, 1094,  593,
+      819, 1090,  740, 1096,  756,  593,  749,  769,  740,  593,
+
+      768,  749, 1097, 1090, 1100,  593,  625,  625,  625,  625,
+      625,  625,  625,  626,  626,  626,  626,  626,  626,  626,
+      627,  770,  627,  627,  627,  627,  627,  627,  627,  628,
+     1101,  628,  628,  628,  628,  628,  628,  628,  629, 1102,
+      629,  629,  629,  629,  629,  629,  629,  720,  720,  720,
+      720,  720,  720,  720,  721,  721,  721,  721,  721,  721,
+      721,  722,  752,  722,  722,  722,  722,  722,  722,  722,
+      723,  736,  723,  723,  723,  723,  723,  723,  723,  742,
+      750,  736,  736,  736,  736,  736,  736,  736,  739,  739,
+      746,  757,  758,  771,  914,  772,  739,  925,  914,  742,
+
+      954,  750,  954,  780,  780,  752,  809,  742,  954, 1103,
+      750,  780, 1046,  771,  742,  772,  752,  920,  750, 1046,
+      809,  925, 1032,  809,  746,  831,  746,  752,  921,  772,
+      831,  831,  831,  739,  739,  758,  939,  739,  939,  739,
+      920,  739,  758,  739,  759,  739, 1032,  739,  757,  831,
+      939,  921,  758,  760,  759,  759,  759,  759,  759,  759,
+      759,  760,  761,  760,  760,  760,  760,  760,  760,  760,
+      761, 1105,  761,  761,  761,  761,  761,  761,  761,  773,
+     1107,  773,  773,  773,  773,  773,  773,  773,  813,  813,
+      813,  813,  813,  813,  813,  814, 1108,  814,  814,  814,
+
+      814,  814,  814,  814,  826,  826,  826,  826,  826,  826,
+      826,  827, 1110,  827,  827,  827,  827,  827,  827,  827,
+      828,  923, 1111,  924,  968,  828,  828,  828,  829,  814,
+      968, 1114,  830,  829,  829,  829,  832,  830,  830,  830,
+     1070,  832,  832,  832,  923,  827,  924,  839, 1070,  910,
+      828,  830,  839,  839,  839,  866,  866, 1115,  832, 1116,
+      840,  866,  832,  841,  829,  840,  840,  840,  841,  841,
+      841,  842,  910, 1038,  843, 1117,  842,  842,  842,  843,
+      843,  843,  844, 1118, 1120,  845, 1121,  844,  844,  844,
+      845,  845,  845,  846,  910, 1122, 1038,  847,  846,  846,
+
+      846, 1119,  847,  847,  847,  848, 1123, 1124,  839,  841,
+      848,  848,  848,  849, 1127,  840,  850, 1119,  849,  849,
+      849,  850,  850,  850, 1129,  922,  988, 1125,  988,  922,
+      842,  988,  988,  988, 1131, 1132, 1125,  844,  906,  906,
+      906,  906,  906,  906,  906,  845, 1133,  848,  922,  846,
+      847,  907, 1135,  907,  907,  907,  907,  907,  907,  907,
+      849,  850, 1136, 1137, 1138,  850,  915,  915,  915,  915,
+      915,  915,  915,  916, 1139,  916,  916,  916,  916,  916,
+      916,  916,  947, 1037, 1104,  907, 1018, 1037, 1104,  947,
+     1140, 1018, 1018, 1018, 1141,  947, 1016, 1016, 1016, 1016,
+
+     1016, 1016, 1016, 1142, 1144, 1145, 1017,  916, 1017, 1017,
+     1017, 1017, 1017, 1017, 1017, 1019, 1018, 1146, 1020, 1143,
+     1019, 1019, 1019, 1020, 1020, 1020, 1021, 1147, 1148, 1149,
+     1152, 1021, 1021, 1021, 1109, 1143, 1022, 1020, 1109, 1153,
+     1017, 1022, 1022, 1022, 1109, 1150, 1150, 1154, 1155, 1156,
+     1021, 1019, 1157, 1158, 1159, 1160, 1161, 1162, 1022, 1163,
+     1164, 1166, 1022, 1029, 1029, 1029, 1029, 1029, 1029, 1029,
+     1030, 1167, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1098,
+     1098, 1098, 1098, 1098, 1098, 1098, 1099, 1168, 1099, 1099,
+     1099, 1099, 1099, 1099, 1099, 1169, 1171, 1172, 1173, 1174,
+
+     1176, 1177, 1178, 1179, 1030, 1183, 1184, 1186, 1188, 1173,
+     1189, 1190, 1191, 1192, 1193, 1196, 1197, 1198, 1199, 1201,
+     1099, 1194, 1194, 1194, 1194, 1194, 1194, 1194, 1195, 1202,
+     1195, 1195, 1195, 1195, 1195, 1195, 1195, 1200, 1203, 1204,
+     1206, 1200, 1205, 1205, 1207, 1208, 1209, 1210, 1211, 1212,
+     1205, 1214, 1213, 1215, 1216, 1217, 1218, 1219, 1220, 1221,
+     1222, 1223, 1195, 1204, 1224, 1225, 1226, 1227, 1206, 1228,
+     1229, 1230, 1231, 1208, 1232, 1217, 1233, 1234, 1235, 1209,
+     1213, 1207, 1214, 1236, 1211, 1210, 1237, 1216, 1240, 1242,
+     1240, 1241, 1224, 1238, 1219, 1241, 1220, 1221, 1245, 1246,
+
+     1247, 1225, 1242, 1238, 1238, 1238, 1238, 1238, 1238, 1238,
+     1253, 1243, 1245, 1244, 1254, 1227, 1229, 1244, 1232, 1243,
+     1228, 1231, 1234, 1244, 1249, 1250, 1226, 1255, 1257, 1236,
+     1248, 1246, 1230, 1247, 1239, 1258, 1234, 1259, 1235, 1234,
+     1260, 1233, 1239, 1237, 1239, 1239, 1239, 1239, 1239, 1239,
+     1239, 1256, 1248, 1261, 1262, 1256, 1250, 1249, 1251, 1263,
+     1251, 1251, 1251, 1251, 1251, 1251, 1251, 1264, 1265, 1266,
+     1267, 1268, 1269, 1270, 1271, 1272, 1239, 1273, 1274, 1275,
+     1276, 1277, 1278, 1279, 1280, 1281, 1282, 1283, 1284, 1285,
+     1286, 1286, 1251, 1287, 1288, 1289, 1286, 1290, 1274, 1291,
+
+     1276, 1292, 1293, 1279, 1294, 1295, 1296, 1297, 1298, 1285,
+     1299, 1300, 1301, 1307, 1299, 1302, 1308, 1301, 1301, 1301,
+     1302, 1302, 1302, 1303, 1309, 1310, 1304, 1311, 1303, 1303,
+     1303, 1304, 1304, 1304, 1305, 1325, 1326, 1327, 1312, 1305,
+     1305, 1305, 1312, 1330, 1301, 1306, 1331, 1302, 1304, 1303,
+     1306, 1306, 1306, 1313, 1333, 1334, 1314, 1335, 1313, 1313,
+     1313, 1314, 1314, 1314, 1315, 1336, 1306, 1337, 1316, 1315,
+     1315, 1315, 1305, 1316, 1316, 1316, 1317, 1316, 1316, 1316,
+     1318, 1317, 1317, 1317, 1319, 1318, 1318, 1318, 1338, 1319,
+     1319, 1319, 1339, 1320, 1342, 1344, 1321, 1340, 1320, 1320,
+
+     1320, 1321, 1321, 1321, 1345, 1340, 1346, 1322, 1348, 1349,
+     1323, 1313, 1322, 1322, 1322, 1323, 1323, 1323, 1314, 1350,
+     1324, 1351, 1352, 1353, 1315, 1324, 1324, 1324, 1354, 1317,
+     1355, 1356, 1359, 1319, 1320, 1318, 1357, 1360, 1362, 1357,
+     1363, 1364, 1365, 1366, 1367, 1321, 1370, 1371, 1372, 1373,
+     1374, 1375, 1322, 1376, 1377, 1378, 1379, 1380, 1381, 1382,
+     1384, 1385, 1386, 1387, 1324, 1388, 1389, 1390, 1393, 1394,
+     1397, 1398, 1399, 1395, 1323, 1400, 1403, 1377, 1378, 1389,
+     1390, 1395, 1379, 1382, 1381, 1404, 1405, 1406, 1407, 1389,
+     1408, 1409, 1409, 1410, 1407, 1411, 1412, 1414, 1416, 1417,
+
+     1418, 1419, 1420, 1421, 1422, 1416, 1423, 1425, 1426, 1429,
+     1430, 1416, 1433, 1435, 1436, 1437, 1438, 1416, 1440, 1441,
+     1442, 1443, 1444, 1445, 1446, 1449, 1450, 1438, 1451, 1457,
+     1458, 1437, 1460, 1460, 1461, 1462, 1464, 1465, 1466, 1467,
+     1473, 1474, 1468, 1475, 1467, 1467, 1467, 1468, 1468, 1468,
+     1469, 1476, 1477, 1470, 1479, 1469, 1469, 1469, 1470, 1470,
+     1470, 1471, 1480, 1481, 1482, 1478, 1471, 1471, 1471, 1478,
+     1483, 1467, 1472, 1484, 1468, 1470, 1469, 1472, 1472, 1472,
+     1485, 1487, 1488, 1489, 1490, 1480, 1491, 1491, 1492, 1492,
+     1493, 1494, 1496, 1472, 1497, 1498, 1499, 1501, 1502, 1471,
+
+     1507, 1508, 1509, 1510, 1511, 1513, 1517, 1518, 1519, 1520,
+     1521, 1522, 1511, 1523, 1524, 1527, 1529, 1530, 1531, 1532,
+     1534, 1535, 1532, 1532, 1536, 1537, 1538, 1539, 1540, 1542,
+     1543, 1544, 1545, 1546, 1547, 1548, 1549, 1550, 1551, 1552,
+     1554, 1555, 1556, 1557, 1559, 1561, 1562, 1564, 1565, 1566,
+     1567, 1568, 1569, 1570, 1574, 1575, 1576, 1577, 1578, 1580,
+     1578, 1581, 1583, 1585, 1586, 1587, 1578, 1588, 1589, 1591,
+     1592, 1594, 1595, 1596, 1597, 1598, 1588, 1599, 1600, 1601,
+     1602, 1603, 1605, 1606, 1607, 1608, 1609, 1610, 1596, 1611,
+     1594, 1602, 1612, 1613, 1614, 1615, 1616, 1617, 1618, 1619,
+
+     1620, 1621, 1622, 1623, 1624, 1625, 1626, 1628, 1630, 1631,
+     1633, 1634, 1632, 1635, 1636, 1637, 1638, 1639, 1646, 1640,
+     1642, 1641, 1644, 1643, 1645, 1648, 1647, 1647, 1649, 1649,
+     1650, 1651, 1653, 1635, 1630, 1631, 1632, 1655, 1636, 1654,
+     1638, 1639, 1640, 1641, 1645, 1633, 1647, 1656, 1649, 1634,
+     1643, 1652, 1652, 1637, 1644, 1642, 1657, 1658, 1658, 1659,
+     1660, 1661, 1662, 1663, 1664, 1666, 1665, 1646, 1669, 1663,
+     1667, 1652, 1665, 1668, 1664, 1670, 1666, 1658, 1671, 1673,
+     1674, 1651, 1675, 1648, 1676, 1672, 1677, 1678, 1679, 1680,
+     1681, 1653, 1650, 1654, 1682, 1683, 1670, 1660, 1684, 1657,
+
+     1655, 1686, 1687, 1688, 1671, 1668, 1669, 1656, 1690, 1672,
+     1659, 1659, 1667, 1672, 1691, 1693, 1659, 1695, 1697, 1698,
+     1700, 1701, 1702, 1704, 1705, 1706, 1701, 1707, 1708, 1709,
+     1711, 1712, 1713, 1714, 1715, 1716, 1700, 1695, 1717, 1698,
+     1718, 1719, 1702, 1720, 1721, 1722, 1723, 1724, 1725, 1709,
+     1726, 1727, 1728, 1729, 1735, 1736, 1730, 1737, 1729, 1729,
+     1729, 1730, 1730, 1730, 1731, 1738, 1739, 1732, 1740, 1731,
+     1731, 1731, 1732, 1732, 1732, 1733, 1741, 1756, 1757, 1758,
+     1733, 1733, 1733, 1759, 1729, 1760, 1761, 1762, 1763, 1765,
+     1730, 1766, 1734, 1733, 1767, 1768, 1731, 1734, 1734, 1734,
+
+     1742, 1732, 1769, 1743, 1770, 1742, 1742, 1742, 1743, 1743,
+     1743, 1744, 1771, 1772, 1745, 1773, 1744, 1744, 1744, 1745,
+     1745, 1745, 1746, 1774, 1775, 1778, 1776, 1746, 1746, 1746,
+     1747, 1779, 1734, 1748, 1780, 1747, 1747, 1747, 1748, 1748,
+     1748, 1742, 1749, 1776, 1781, 1750, 1782, 1749, 1749, 1749,
+     1750, 1750, 1750, 1783, 1751, 1784, 1785, 1752, 1743, 1751,
+     1751, 1751, 1752, 1752, 1752, 1753, 1786, 1787, 1754, 1788,
+     1753, 1753, 1753, 1754, 1754, 1754, 1755, 1790, 1748, 1791,
+     1792, 1755, 1755, 1755, 1793, 1794, 1795, 1796, 1797, 1798,
+     1799, 1800, 1801, 1804, 1802, 1803, 1805, 1806, 1807, 1750,
+
+     1749, 1810, 1812, 1811, 1813, 1814, 1751, 1816, 1815, 1754,
+     1815, 1817, 1752, 1811, 1818, 1800, 1801, 1802, 1803, 1805,
+     1819, 1822, 1815, 1753, 1824, 1825, 1826, 1827, 1828, 1829,
+     1831, 1832, 1833, 1834, 1835, 1836, 1837, 1838, 1816, 1839,
+     1839, 1841, 1837, 1840, 1840, 1842, 1843, 1816, 1837, 1844,
+     1845, 1846, 1816, 1847, 1848, 1849, 1850, 1851, 1852, 1854,
+     1855, 1856, 1857, 1858, 1860, 1861, 1863, 1865, 1855, 1867,
+     1869, 1867, 1870, 1871, 1872, 1876, 1877, 1876, 1878, 1884,
+     1885, 1879, 1886, 1878, 1878, 1878, 1879, 1879, 1879, 1880,
+     1887, 1888, 1881, 1889, 1880, 1880, 1880, 1881, 1881, 1881,
+
+     1882, 1890, 1891, 1893, 1894, 1882, 1882, 1882, 1895, 1878,
+     1896, 1897, 1898, 1900, 1906, 1879, 1907, 1883, 1882, 1908,
+     1909, 1880, 1883, 1883, 1883, 1910, 1881, 1911, 1912, 1913,
+     1914, 1915, 1916, 1917, 1918, 1919, 1920, 1921, 1922, 1923,
+     1924, 1926, 1928, 1929, 1930, 1931, 1933, 1934, 1935, 1936,
+     1937, 1938, 1939, 1940, 1941, 1942, 1943, 1883, 1944, 1948,
+     1949, 1950, 1951, 1952, 1953, 1954, 1956, 1957, 1958, 1959,
+     1960, 1961, 1962, 1963, 1965, 1966, 1967, 1969, 1971, 1972,
+     1973, 1974, 1975, 1976, 1977, 1979, 1980, 1981, 1982, 1983,
+     1984, 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993,
+
+     1994, 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+     1997, 2007, 2008, 2009, 2010, 2012, 2014, 2015, 2016, 2017,
+     2018, 2019, 2020, 2021, 2022, 2023, 2025, 2024, 2026, 2027,
+     2029, 2028, 2030, 2031, 2032, 2033, 2034, 2035, 2036, 2037,
+     2038, 2040, 2041, 2039, 2039, 2043, 2042, 2042, 2044, 2045,
+     2047, 2048, 2022, 2028, 2046, 2046, 2026, 2052, 2023, 2024,
+     2049, 2025, 2035, 2039, 2027, 2030, 2042, 2037, 2054, 2031,
+     2032, 2055, 2050, 2051, 2046, 2034, 2053, 2053, 2056, 2057,
+     2058, 2059, 2059, 2060, 2061, 2060, 2062, 2063, 2062, 2064,
+     2066, 2044, 2065, 2068, 2067, 2069, 2053, 2064, 2070, 2071,
+
+     2041, 2063, 2072, 2045, 2058, 2073, 2074, 2044, 2045, 2075,
+     2077, 2049, 2052, 2079, 2048, 2050, 2051, 2080, 2081, 2069,
+     2082, 2068, 2071, 2083, 2066, 2056, 2084, 2055, 2067, 2065,
+     2085, 2086, 2087, 2088, 2089, 2090, 2091, 2092, 2070, 2093,
+     2094, 2095, 2057, 2096, 2097, 2098, 2099, 2100, 2101, 2102,
+     2103, 2104, 2105, 2106, 2107, 2108, 2091, 2092, 2109, 2110,
+     2099, 2111, 2112, 2113, 2114, 2115, 2116, 2100, 2117, 2118,
+     2124, 2125, 2119, 2126, 2118, 2118, 2118, 2119, 2119, 2119,
+     2120, 2127, 2128, 2121, 2129, 2120, 2120, 2120, 2121, 2121,
+     2121, 2122, 2130, 2140, 2123, 2141, 2122, 2122, 2122, 2123,
+
+     2123, 2123, 2142, 2143, 2144, 2145, 2146, 2147, 2131, 2118,
+     2148, 2132, 2119, 2131, 2131, 2131, 2132, 2132, 2132, 2133,
+     2120, 2150, 2153, 2121, 2133, 2133, 2133, 2134, 2154, 2123,
+     2135, 2122, 2134, 2134, 2134, 2135, 2135, 2135, 2136, 2155,
+     2156, 2137, 2158, 2136, 2136, 2136, 2137, 2137, 2137, 2138,
+     2159, 2160, 2139, 2161, 2138, 2138, 2138, 2139, 2139, 2139,
+     2162, 2164, 2165, 2166, 2167, 2168, 2169, 2170, 2131, 2171,
+     2172, 2173, 2174, 2175, 2176, 2177, 2178, 2135, 2179, 2180,
+     2181, 2182, 2184, 2186, 2187, 2188, 2189, 2190, 2191, 2192,
+     2195, 2196, 2197, 2198, 2199, 2200, 2201, 2202, 2195, 2203,
+
+     2204, 2205, 2207, 2208, 2209, 2210, 2211, 2212, 2215, 2216,
+     2217, 2218, 2219, 2220, 2221, 2223, 2224, 2187, 2225, 2226,
+     2227, 2229, 2230, 2231, 2232, 2234, 2235, 2236, 2237, 2238,
+     2240, 2241, 2242, 2243, 2244, 2245, 2246, 2247, 2248, 2249,
+     2250, 2251, 2252, 2253, 2254, 2255, 2256, 2257, 2258, 2264,
+     2265, 2259, 2266, 2258, 2258, 2258, 2259, 2259, 2259, 2260,
+     2267, 2268, 2261, 2269, 2260, 2260, 2260, 2261, 2261, 2261,
+     2262, 2270, 2271, 2263, 2272, 2262, 2262, 2262, 2263, 2263,
+     2263, 2273, 2274, 2275, 2276, 2277, 2278, 2279, 2258, 2280,
+     2281, 2259, 2282, 2283, 2284, 2285, 2286, 2287, 2288, 2260,
+
+     2289, 2290, 2261, 2291, 2292, 2293, 2294, 2295, 2263, 2296,
+     2262, 2297, 2298, 2299, 2300, 2301, 2302, 2303, 2304, 2305,
+     2306, 2307, 2308, 2309, 2310, 2311, 2312, 2314, 2315, 2316,
+     2317, 2318, 2319, 2320, 2321, 2322, 2323, 2324, 2325, 2326,
+     2327, 2328, 2329, 2330, 2331, 2332, 2333, 2335, 2336, 2337,
+     2338, 2339, 2340, 2341, 2342, 2343, 2344, 2345, 2346, 2347,
+     2348, 2349, 2350, 2351, 2352, 2353, 2354, 2355, 2356, 2357,
+     2358, 2359, 2360, 2361, 2362, 2363, 2364, 2366, 2368, 2369,
+     2370, 2372, 2373, 2374, 2375, 2376, 2377, 2378, 2380, 2381,
+     2382, 2383, 2384, 2385, 2386, 2387, 2388, 2390, 2389, 2391,
+
+     2392, 2393, 2396, 2394, 2394, 2395, 2395, 2397, 2398, 2399,
+     2400, 2382, 2401, 2402, 2404, 2387, 2388, 2405, 2384, 2383,
+     2406, 2380, 2389, 2394, 2413, 2395, 2407, 2391, 2408, 2385,
+     2403, 2403, 2386, 2392, 2407, 2390, 2408, 2409, 2410, 2411,
+     2412, 2415, 2414, 2412, 2416, 2409, 2410, 2411, 2413, 2417,
+     2403, 2398, 2393, 2418, 2419, 2424, 2425, 2401, 2406, 2404,
+     2402, 2426, 2428, 2429, 2400, 2430, 2431, 2399, 2432, 2396,
+     2397, 2434, 2435, 2418, 2402, 2414, 2436, 2415, 2416, 2405,
+     2437, 2439, 2441, 2442, 2443, 2417, 2444, 2445, 2446, 2447,
+     2448, 2449, 2451, 2452, 2453, 2454, 2419, 2455, 2456, 2457,
+
+     2437, 2439, 2458, 2459, 2460, 2461, 2462, 2463, 2464, 2465,
+     2448, 2449, 2466, 2452, 2467, 2468, 2474, 2475, 2469, 2476,
+     2468, 2468, 2468, 2469, 2469, 2469, 2470, 2477, 2478, 2471,
+     2479, 2470, 2470, 2470, 2471, 2471, 2471, 2472, 2480, 2483,
+     2473, 2484, 2472, 2472, 2472, 2473, 2473, 2473, 2485, 2481,
+     2468, 2486, 2482, 2469, 2481, 2481, 2481, 2482, 2482, 2482,
+     2487, 2470, 2473, 2488, 2471, 2489, 2490, 2492, 2491, 2493,
+     2494, 2495, 2472, 2491, 2491, 2496, 2497, 2498, 2499, 2500,
+     2501, 2502, 2503, 2504, 2505, 2506, 2507, 2508, 2509, 2510,
+     2511, 2512, 2513, 2514, 2481, 2515, 2516, 2517, 2518, 2519,
+
+     2520, 2521, 2522, 2524, 2525, 2526, 2527, 2528, 2529, 2530,
+     2532, 2534, 2535, 2536, 2537, 2538, 2539, 2540, 2539, 2541,
+     2542, 2543, 2544, 2545, 2546, 2547, 2548, 2549, 2550, 2551,
+     2552, 2553, 2558, 2560, 2561, 2562, 2563, 2564, 2565, 2566,
+     2567, 2569, 2571, 2572, 2573, 2574, 2575, 2576, 2577, 2578,
+     2579, 2580, 2581, 2580, 2582, 2583, 2584, 2585, 2592, 2593,
+     2594, 2586, 2595, 2579, 2587, 2579, 2586, 2586, 2586, 2587,
+     2587, 2587, 2588, 2596, 2597, 2589, 2598, 2588, 2588, 2588,
+     2589, 2589, 2589, 2590, 2599, 2600, 2591, 2601, 2590, 2590,
+     2590, 2591, 2591, 2591, 2602, 2603, 2586, 2604, 2605, 2587,
+
+     2606, 2607, 2608, 2609, 2610, 2611, 2612, 2588, 2591, 2613,
+     2589, 2614, 2615, 2616, 2617, 2618, 2619, 2620, 2590, 2621,
+     2622, 2623, 2624, 2625, 2626, 2627, 2628, 2629, 2630, 2631,
+     2632, 2633, 2634, 2635, 2636, 2637, 2638, 2639, 2640, 2641,
+     2642, 2643, 2644, 2645, 2646, 2647, 2648, 2649, 2650, 2651,
+     2652, 2653, 2654, 2655, 2656, 2657, 2658, 2659, 2660, 2661,
+     2662, 2663, 2664, 2665, 2666, 2667, 2668, 2671, 2672, 2673,
+     2674, 2675, 2676, 2679, 2680, 2681, 2682, 2683, 2684, 2685,
+     2686, 2688, 2689, 2690, 2691, 2692, 2693, 2694, 2695, 2696,
+     2697, 2698, 2699, 2700, 2701, 2702, 2703, 2704, 2705, 2706,
+
+     2707, 2709, 2710, 2708, 2711, 2702, 2712, 2713, 2714, 2715,
+     2715, 2716, 2718, 2719, 2720, 2721, 2713, 2717, 2717, 2722,
+     2723, 2724, 2710, 2725, 2726, 2726, 2728, 2703, 2729, 2715,
+     2704, 2745, 2709, 2706, 2707, 2708, 2731, 2717, 2738, 2712,
+     2727, 2727, 2730, 2730, 2726, 2732, 2733, 2734, 2732, 2733,
+     2734, 2735, 2736, 2737, 2735, 2736, 2739, 2720, 2740, 2741,
+     2727, 2742, 2730, 2737, 2714, 2743, 2746, 2744, 2724, 2721,
+     2747, 2723, 2748, 2719, 2731, 2749, 2738, 2722, 2750, 2752,
+     2753, 2754, 2755, 2756, 2757, 2725, 2758, 2759, 2760, 2761,
+     2729, 2762, 2763, 2765, 2766, 2768, 2769, 2770, 2739, 2771,
+
+     2740, 2741, 2772, 2742, 2744, 2773, 2774, 2743, 2775, 2776,
+     2777, 2778, 2763, 2765, 2766, 2779, 2780, 2781, 2782, 2783,
+     2789, 2790, 2784, 2791, 2783, 2783, 2783, 2784, 2784, 2784,
+     2785, 2792, 2793, 2786, 2794, 2785, 2785, 2785, 2786, 2786,
+     2786, 2783, 2787, 2795, 2784, 2765, 2797, 2787, 2787, 2787,
+     2765, 2765, 2785, 2788, 2798, 2786, 2796, 2799, 2788, 2788,
+     2788, 2796, 2796, 2796, 2787, 2800, 2801, 2802, 2803, 2804,
+     2805, 2806, 2807, 2808, 2809, 2810, 2811, 2812, 2813, 2814,
+     2808, 2815, 2816, 2817, 2818, 2819, 2820, 2821, 2822, 2788,
+     2823, 2824, 2825, 2826, 2827, 2828, 2829, 2830, 2831, 2832,
+
+     2833, 2834, 2835, 2836, 2837, 2838, 2839, 2840, 2841, 2842,
+     2843, 2844, 2845, 2847, 2848, 2849, 2850, 2851, 2852, 2853,
+     2854, 2855, 2856, 2857, 2858, 2859, 2860, 2860, 2861, 2862,
+     2863, 2864, 2865, 2866, 2867, 2868, 2863, 2869, 2870, 2871,
+     2872, 2873, 2874, 2875, 2876, 2877, 2878, 2879, 2880, 2881,
+     2882, 2883, 2884, 2885, 2886, 2887, 2888, 2889, 2890, 2891,
+     2892, 2893, 2894, 2895, 2896, 2902, 2903, 2897, 2904, 2896,
+     2896, 2896, 2897, 2897, 2897, 2898, 2905, 2906, 2899, 2907,
+     2898, 2898, 2898, 2899, 2899, 2899, 2896, 2900, 2908, 2897,
+     2909, 2910, 2900, 2900, 2900, 2911, 2901, 2898, 2912, 2913,
+
+     2899, 2901, 2901, 2901, 2914, 2915, 2916, 2917, 2918, 2900,
+     2919, 2920, 2921, 2922, 2923, 2924, 2925, 2926, 2927, 2928,
+     2929, 2930, 2931, 2932, 2933, 2934, 2935, 2936, 2937, 2938,
+     2939, 2940, 2901, 2941, 2942, 2943, 2944, 2945, 2946, 2947,
+     2948, 2949, 2950, 2951, 2952, 2953, 2954, 2955, 2956, 2957,
+     2958, 2959, 2960, 2961, 2962, 2963, 2964, 2965, 2966, 2967,
+     2968, 2969, 2970, 2971, 2972, 2973, 2974, 2975, 2976, 2977,
+     2978, 2980, 2981, 2982, 2983, 2984, 2985, 2986, 2987, 2988,
+     2989, 2990, 2991, 2992, 2993, 2994, 2995, 2996, 2997, 2998,
+     2999, 3000, 3000, 3001, 3002, 3003, 3004, 3005, 3006, 3007,
+
+     3008, 3009, 3010, 3011, 3012, 3013, 3014, 3015, 3017, 3018,
+     3016, 3019, 3020, 3021, 3022, 3023, 3025, 3025, 3007, 3026,
+     3024, 3029, 3027, 3027, 3010, 3028, 3028, 3009, 3012, 3014,
+     3015, 3016, 3030, 3031, 3032, 3037, 3025, 3033, 3034, 3011,
+     3035, 3008, 3027, 3031, 3032, 3028, 3038, 3033, 3034, 3036,
+     3035, 3039, 3040, 3036, 3041, 3042, 3018, 3017, 3043, 3044,
+     3030, 3047, 3048, 3020, 3021, 3019, 3023, 3024, 3050, 3051,
+     3052, 3054, 3055, 3037, 3027, 3056, 3022, 3057, 3058, 3027,
+     3027, 3053, 3043, 3038, 3059, 3053, 3053, 3060, 3039, 3040,
+     3061, 3041, 3042, 3063, 3058, 3064, 3065, 3066, 3067, 3068,
+
+     3069, 3070, 3071, 3072, 3073, 3074, 3075, 3076, 3077, 3078,
+     3061, 3079, 3080, 3081, 3087, 3088, 3082, 3089, 3081, 3081,
+     3081, 3082, 3082, 3082, 3083, 3090, 3091, 3084, 3092, 3083,
+     3083, 3083, 3084, 3084, 3084, 3085, 3093, 3094, 3086, 3095,
+     3085, 3085, 3085, 3086, 3086, 3086, 3096, 3097, 3098, 3081,
+     3099, 3100, 3082, 3101, 3102, 3103, 3104, 3105, 3106, 3107,
+     3083, 3108, 3109, 3084, 3110, 3111, 3112, 3113, 3110, 3114,
+     3115, 3085, 3116, 3117, 3086, 3119, 3120, 3121, 3122, 3123,
+     3110, 3110, 3124, 3125, 3126, 3127, 3128, 3129, 3130, 3131,
+     3132, 3133, 3134, 3135, 3136, 3137, 3138, 3139, 3140, 3141,
+
+     3142, 3143, 3142, 3144, 3145, 3146, 3147, 3148, 3149, 3150,
+     3151, 3152, 3153, 3154, 3155, 3156, 3157, 3158, 3159, 3160,
+     3161, 3162, 3164, 3165, 3165, 3166, 3167, 3168, 3169, 3170,
+     3171, 3172, 3173, 3174, 3175, 3176, 3179, 3180, 3181, 3182,
+     3183, 3184, 3185, 3186, 3187, 3188, 3189, 3190, 3191, 3192,
+     3193, 3194, 3195, 3201, 3202, 3196, 3203, 3195, 3195, 3195,
+     3196, 3196, 3196, 3197, 3204, 3205, 3198, 3206, 3197, 3197,
+     3197, 3198, 3198, 3198, 3199, 3207, 3208, 3200, 3209, 3199,
+     3199, 3199, 3200, 3200, 3200, 3210, 3211, 3212, 3195, 3213,
+     3214, 3196, 3215, 3216, 3217, 3218, 3219, 3220, 3221, 3197,
+
+     3222, 3223, 3198, 3225, 3224, 3226, 3227, 3228, 3229, 3224,
+     3199, 3230, 3231, 3200, 3224, 3232, 3233, 3234, 3235, 3224,
+     3236, 3238, 3239, 3240, 3241, 3243, 3244, 3245, 3246, 3247,
+     3248, 3249, 3250, 3251, 3252, 3253, 3254, 3255, 3256, 3257,
+     3258, 3259, 3260, 3261, 3262, 3263, 3264, 3265, 3266, 3267,
+     3268, 3269, 3270, 3271, 3272, 3273, 3274, 3275, 3276, 3277,
+     3278, 3279, 3280, 3281, 3282, 3283, 3284, 3285, 3286, 3287,
+     3288, 3289, 3290, 3291, 3292, 3293, 3294, 3295, 3296, 3297,
+     3298, 3299, 3300, 3301, 3302, 3303, 3304, 3305, 3306, 3307,
+     3308, 3309, 3306, 3310, 3311, 3312, 3313, 3314, 3315, 3316,
+
+     3317, 3318, 3319, 3320, 3321, 3322, 3323, 3323, 3324, 3327,
+     3325, 3328, 3326, 3335, 3329, 3309, 3336, 3314, 3329, 3330,
+     3313, 3331, 3337, 3330, 3332, 3331, 3323, 3333, 3332, 3334,
+     3341, 3333, 3312, 3334, 3310, 3338, 3343, 3339, 3340, 3346,
+     3336, 3335, 3347, 3348, 3328, 3349, 3337, 3350, 3315, 3351,
+     3352, 3317, 3315, 3315, 3320, 3326, 3353, 3316, 3319, 3338,
+     3321, 3339, 3340, 3318, 3354, 3322, 3325, 3355, 3341, 3357,
+     3320, 3358, 3327, 3359, 3360, 3361, 3362, 3363, 3364, 3365,
+     3366, 3367, 3368, 3369, 3358, 3370, 3371, 3372, 3373, 3374,
+     3375, 3376, 3377, 3359, 3383, 3378, 3384, 3377, 3377, 3377,
+
+     3378, 3378, 3378, 3379, 3385, 3386, 3380, 3387, 3379, 3379,
+     3379, 3380, 3380, 3380, 3381, 3388, 3389, 3382, 3390, 3381,
+     3381, 3381, 3382, 3382, 3382, 3391, 3392, 3393, 3377, 3394,
+     3359, 3378, 3395, 3396, 3398, 3399, 3400, 3401, 3402, 3379,
+     3403, 3404, 3380, 3382, 3405, 3406, 3407, 3408, 3409, 3410,
+     3381, 3411, 3412, 3413, 3414, 3415, 3416, 3417, 3418, 3419,
+     3420, 3421, 3422, 3423, 3424, 3425, 3426, 3427, 3428, 3429,
+     3430, 3431, 3432, 3433, 3434, 3435, 3436, 3437, 3438, 3439,
+     3440, 3441, 3442, 3443, 3444, 3445, 3446, 3447, 3448, 3449,
+     3450, 3451, 3452, 3453, 3454, 3455, 3456, 3457, 3458, 3459,
+
+     3460, 3461, 3462, 3463, 3464, 3465, 3466, 3467, 3468, 3469,
+     3470, 3471, 3472, 3473, 3475, 3476, 3477, 3478, 3479, 3480,
+     3481, 3482, 3483, 3484, 3485, 3486, 3487, 3488, 3489, 3490,
+     3491, 3492, 3498, 3499, 3493, 3500, 3492, 3492, 3492, 3493,
+     3493, 3493, 3494, 3501, 3502, 3495, 3503, 3494, 3494, 3494,
+     3495, 3495, 3495, 3496, 3504, 3505, 3497, 3506, 3496, 3496,
+     3496, 3497, 3497, 3497, 3507, 3508, 3509, 3492, 3510, 3511,
+     3493, 3512, 3513, 3514, 3515, 3516, 3517, 3518, 3494, 3519,
+     3520, 3495, 3497, 3521, 3522, 3523, 3524, 3525, 3526, 3496,
+     3527, 3528, 3529, 3523, 3530, 3531, 3532, 3533, 3534, 3535,
+
+     3536, 3537, 3538, 3539, 3536, 3540, 3541, 3542, 3543, 3544,
+     3545, 3546, 3547, 3548, 3549, 3550, 3551, 3552, 3553, 3554,
+     3555, 3556, 3557, 3558, 3560, 3561, 3562, 3563, 3564, 3565,
+     3566, 3567, 3568, 3569, 3570, 3571, 3572, 3573, 3574, 3575,
+     3576, 3577, 3578, 3579, 3580, 3581, 3582, 3583, 3584, 3585,
+     3586, 3587, 3588, 3589, 3590, 3591, 3592, 3593, 3594, 3595,
+     3596, 3597, 3598, 3599, 3600, 3601, 3602, 3603, 3604, 3605,
+     3606, 3607, 3608, 3609, 3610, 3611, 3612, 3613, 3614, 3615,
+     3616, 3617, 3618, 3619, 3620, 3621, 3621, 3623, 3622, 3624,
+     3625, 3638, 3626, 3627, 3625, 3609, 3626, 3627, 3628, 3629,
+
+     3631, 3630, 3628, 3629, 3640, 3621, 3605, 3630, 3608, 3632,
+     3633, 3641, 3634, 3635, 3636, 3624, 3637, 3642, 3643, 3644,
+     3645, 3610, 3646, 3612, 3613, 3647, 3611, 3648, 3617, 3616,
+     3649, 3619, 3620, 3631, 3650, 3651, 3652, 3654, 3655, 3656,
+     3614, 3657, 3621, 3622, 3658, 3620, 3615, 3632, 3633, 3623,
+     3634, 3635, 3636, 3659, 3637, 3651, 3652, 3660, 3661, 3656,
+     3662, 3663, 3664, 3665, 3666, 3667, 3668, 3647, 3669, 3670,
+     3671, 3672, 3678, 3679, 3673, 3680, 3672, 3672, 3672, 3673,
+     3673, 3673, 3674, 3681, 3682, 3675, 3683, 3674, 3674, 3674,
+     3675, 3675, 3675, 3684, 3685, 3686, 3656, 3672, 3676, 3687,
+
+     3673, 3688, 3689, 3676, 3676, 3676, 3690, 3677, 3674, 3691,
+     3692, 3675, 3677, 3677, 3677, 3694, 3695, 3696, 3697, 3698,
+     3699, 3700, 3701, 3702, 3676, 3703, 3704, 3705, 3706, 3707,
+     3708, 3709, 3710, 3711, 3712, 3713, 3714, 3715, 3677, 3716,
      3717, 3718, 3719, 3720, 3721, 3722, 3723, 3724, 3725, 3726,
      3727, 3728, 3729, 3730, 3731, 3732, 3733, 3734, 3735, 3736,
-     3737, 3738, 3739, 3740, 3741, 3742, 3743, 3744, 3745, 3746,
+     3730, 3737, 3738, 3739, 3741, 3742, 3743, 3744, 3745, 3746,
      3747, 3748, 3749, 3750, 3751, 3752, 3753, 3754, 3755, 3756,
      3757, 3758, 3759, 3760, 3761, 3762, 3763, 3764, 3765, 3766,
-     3767, 3768, 3769, 3770, 3771, 3772, 3773, 3774, 3775, 3776,
-     3777, 3778, 3779, 3780, 3781, 3782, 3783, 3785, 3784, 3786,
-
-     3787, 3788, 3789, 3790, 3791, 3792, 3793, 3794, 3795, 3796,
-     3797, 3798, 3799, 3807, 3800, 3801, 3802, 3799, 3785, 3800,
-     3801, 3802, 3803, 3787, 3804, 3806, 3806, 3803, 3815, 3804,
-     3805, 3779, 3784, 3781, 3782, 3808, 3805, 3786, 3798, 3809,
-     3810, 3811, 3812, 3813, 3814, 3816, 3817, 3807, 3818, 3820,
-     3822, 3788, 3823, 3791, 3824, 3792, 3827, 3815, 3795, 3794,
-     3828, 3797, 3829, 3830, 3831, 3810, 3811, 3789, 3790, 3832,
-     3833, 3834, 3835, 3836, 3797, 3808, 3793, 3837, 3838, 3809,
-     3839, 3840, 3812, 3813, 3814, 3841, 3842, 3843, 3844, 3845,
-     3832, 3846, 3847, 3848, 3849, 3850, 3851, 3852, 3860, 3861,
-
-     3862, 3863, 3852, 3852, 3852, 3853, 3829, 3864, 3854, 3865,
-     3853, 3853, 3853, 3854, 3854, 3854, 3855, 3866, 3867, 3868,
-     3856, 3855, 3855, 3855, 3852, 3856, 3856, 3856, 3857, 3869,
-     3870, 3858, 3853, 3857, 3857, 3857, 3858, 3858, 3858, 3871,
-     3872, 3873, 3874, 3859, 3875, 3876, 3854, 3856, 3859, 3859,
-     3859, 3877, 3878, 3879, 3855, 3857, 3880, 3881, 3882, 3883,
-     3884, 3885, 3886, 3858, 3887, 3888, 3889, 3890, 3859, 3891,
-     3892, 3893, 3894, 3895, 3896, 3897, 3898, 3899, 3900, 3901,
-     3895, 3902, 3903, 3904, 3906, 3907, 3908, 3909, 3910, 3911,
-     3912, 3913, 3914, 3915, 3916, 3917, 3918, 3919, 3920, 3921,
-
-     3922, 3923, 3924, 3925, 3926, 3927, 3928, 3929, 3930, 3931,
-     3932, 3933, 3934, 3935, 3936, 3937, 3938, 3939, 3940, 3941,
-     3942, 3943, 3944, 3945, 3946, 3947, 3948, 3949, 3950, 3951,
-     3952, 3960, 3961, 3953, 3962, 3952, 3952, 3952, 3953, 3953,
-     3953, 3954, 3963, 3964, 3955, 3965, 3954, 3954, 3954, 3955,
-     3955, 3955, 3966, 3967, 3968, 3969, 3956, 3952, 3970, 3957,
-     3953, 3956, 3956, 3956, 3957, 3957, 3957, 3958, 3971, 3972,
-     3959, 3973, 3958, 3958, 3958, 3959, 3959, 3959, 3974, 3954,
-     3975, 3976, 3955, 3956, 3977, 3978, 3957, 3979, 3980, 3981,
-     3982, 3983, 3984, 3985, 3986, 3959, 3987, 3988, 3989, 3958,
-
-     3990, 3991, 3992, 3993, 3994, 3995, 3996, 3998, 3999, 4000,
-     4001, 4002, 4003, 4004, 4005, 4006, 4007, 4008, 4009, 4010,
-     4011, 4012, 4013, 4014, 4015, 4016, 4017, 4018, 4019, 4020,
-     4021, 4022, 4023, 4025, 4026, 4018, 4027, 4028, 4029, 4030,
-     4031, 4032, 4033, 4035, 4036, 4037, 4038, 4039, 4040, 4041,
+     3767, 3769, 3770, 3771, 3772, 3773, 3774, 3775, 3776, 3777,
+
+     3778, 3779, 3780, 3781, 3782, 3783, 3784, 3785, 3791, 3792,
+     3786, 3793, 3785, 3785, 3785, 3786, 3786, 3786, 3787, 3794,
+     3795, 3788, 3796, 3787, 3787, 3787, 3788, 3788, 3788, 3797,
+     3798, 3799, 3789, 3785, 3800, 3790, 3786, 3789, 3789, 3789,
+     3790, 3790, 3790, 3801, 3787, 3802, 3803, 3788, 3804, 3805,
+     3806, 3807, 3808, 3809, 3810, 3811, 3812, 3813, 3789, 3814,
+     3815, 3816, 3817, 3818, 3819, 3820, 3790, 3821, 3822, 3823,
+     3824, 3825, 3826, 3827, 3828, 3829, 3830, 3831, 3832, 3833,
+     3835, 3836, 3837, 3838, 3839, 3831, 3840, 3841, 3842, 3843,
+     3844, 3845, 3846, 3847, 3848, 3849, 3850, 3851, 3852, 3853,
+
+     3854, 3855, 3856, 3857, 3858, 3859, 3861, 3862, 3863, 3864,
+     3865, 3866, 3867, 3868, 3869, 3870, 3871, 3872, 3874, 3875,
+     3876, 3877, 3878, 3879, 3880, 3881, 3882, 3884, 3885, 3886,
+     3887, 3888, 3889, 3890, 3892, 3893, 3894, 3895, 3896, 3897,
+     3898, 3899, 3900, 3901, 3902, 3903, 3904, 3905, 3906, 3907,
+     3908, 3910, 3909, 3911, 3911, 3912, 3912, 3913, 3914, 3915,
+     3916, 3916, 3917, 3918, 3919, 3920, 3923, 3923, 3907, 3918,
+     3919, 3920, 3900, 3911, 3924, 3912, 3921, 3898, 3922, 3930,
+     3916, 3925, 3921, 3926, 3922, 3927, 3901, 3928, 3929, 3931,
+     3932, 3903, 3933, 3902, 3906, 3934, 3935, 3936, 3937, 3917,
+
+     3924, 3914, 3910, 3938, 3940, 3943, 3915, 3930, 3904, 3909,
+     3907, 3908, 3944, 3946, 3905, 3947, 3948, 3916, 3950, 3925,
+     3952, 3926, 3953, 3927, 3954, 3928, 3929, 3955, 3956, 3957,
+     3958, 3959, 3944, 3960, 3961, 3947, 3948, 3962, 3963, 3964,
+     3966, 3972, 3973, 3967, 3974, 3966, 3966, 3966, 3967, 3967,
+     3967, 3968, 3975, 3976, 3969, 3977, 3968, 3968, 3968, 3969,
+     3969, 3969, 3970, 3978, 3979, 3980, 3981, 3970, 3970, 3970,
+     3971, 3966, 3982, 3983, 3967, 3971, 3971, 3971, 3984, 3985,
+     3986, 3987, 3968, 3988, 3989, 3969, 3990, 3991, 3992, 3993,
+     3994, 3995, 3996, 3970, 3971, 3997, 3998, 3999, 4000, 4001,
+
+     4002, 4003, 4004, 4005, 4006, 4007, 4008, 4009, 4010, 4011,
+     4012, 4013, 4014, 4015, 4016, 4017, 4018, 4019, 4020, 4021,
+     4022, 4023, 4024, 4025, 4026, 4027, 4028, 4029, 4030, 4031,
+     4032, 4033, 4034, 4035, 4036, 4037, 4038, 4039, 4040, 4041,
      4043, 4044, 4045, 4046, 4047, 4048, 4049, 4050, 4051, 4052,
-     4053, 4054, 4055, 4056, 4058, 4059, 4060, 4061, 4062, 4063,
-     4064, 4065, 4066, 4067, 4069, 4070, 4071, 4072, 4073, 4074,
-     4075, 4076, 4077, 4078, 4079, 4080, 4081, 4082, 4083, 4084,
-     4085, 4086, 4087, 4088, 4089, 4090, 4091, 4092, 4093, 4094,
-
-     4095, 4096, 4097, 4098, 4099, 4100, 4101, 4102, 4104, 4103,
-     4105, 4106, 4107, 4108, 4109, 4110, 4111, 4112, 4114, 4113,
-     4116, 4115, 4115, 4117, 4118, 4125, 4119, 4120, 4121, 4117,
-     4118, 4119, 4120, 4122, 4121, 4123, 4123, 4112, 4126, 4122,
-     4124, 4105, 4115, 4099, 4127, 4100, 4101, 4103, 4124, 4128,
-     4129, 4130, 4125, 4131, 4133, 4134, 4132, 4135, 4136, 4116,
-     4137, 4138, 4139, 4140, 4141, 4111, 4142, 4144, 4146, 4150,
-     4151, 4147, 4114, 4152, 4153, 4154, 4106, 4155, 4126, 4156,
-     4110, 4112, 4107, 4113, 4127, 4132, 4157, 4158, 4133, 4128,
-     4129, 4130, 4147, 4131, 4159, 4160, 4161, 4162, 4163, 4164,
-
-     4165, 4166, 4168, 4176, 4177, 4169, 4178, 4168, 4168, 4168,
-     4169, 4169, 4169, 4170, 4179, 4180, 4171, 4181, 4170, 4170,
-     4170, 4171, 4171, 4171, 4172, 4182, 4183, 4184, 4185, 4172,
-     4172, 4172, 4186, 4187, 4168, 4188, 4189, 4169, 4190, 4173,
-     4170, 4191, 4174, 4171, 4173, 4173, 4173, 4174, 4174, 4174,
-     4192, 4193, 4175, 4194, 4195, 4196, 4172, 4175, 4175, 4175,
-     4197, 4198, 4199, 4200, 4201, 4202, 4203, 4174, 4204, 4205,
-     4206, 4173, 4207, 4208, 4209, 4210, 4211, 4212, 4213, 4214,
-     4215, 4216, 4217, 4218, 4219, 4220, 4221, 4222, 4223, 4175,
-     4224, 4225, 4226, 4227, 4228, 4229, 4230, 4231, 4232, 4233,
-
-     4235, 4236, 4237, 4238, 4239, 4240, 4241, 4242, 4243, 4243,
-     4244, 4245, 4246, 4247, 4248, 4249, 4250, 4251, 4253, 4254,
-     4255, 4246, 4256, 4257, 4258, 4259, 4255, 4260, 4261, 4262,
-     4263, 4264, 4265, 4266, 4268, 4276, 4277, 4269, 4278, 4268,
-     4268, 4268, 4269, 4269, 4269, 4270, 4279, 4280, 4271, 4281,
-     4270, 4270, 4270, 4271, 4271, 4271, 4272, 4282, 4283, 4284,
-     4285, 4272, 4272, 4272, 4286, 4287, 4268, 4288, 4289, 4269,
-     4290, 4273, 4270, 4291, 4274, 4271, 4273, 4273, 4273, 4274,
-     4274, 4274, 4292, 4293, 4275, 4294, 4295, 4296, 4272, 4275,
-     4275, 4275, 4297, 4298, 4299, 4300, 4301, 4302, 4303, 4274,
-
-     4304, 4305, 4306, 4273, 4307, 4308, 4309, 4310, 4311, 4312,
-     4313, 4314, 4315, 4316, 4317, 4318, 4319, 4320, 4321, 4322,
-     4323, 4275, 4324, 4325, 4326, 4327, 4328, 4329, 4330, 4331,
-     4332, 4333, 4334, 4335, 4336, 4337, 4338, 4339, 4340, 4341,
-     4342, 4343, 4344, 4345, 4346, 4347, 4349, 4350, 4351, 4352,
-     4353, 4354, 4355, 4356, 4357, 4358, 4359, 4360, 4361, 4362,
-     4363, 4364, 4365, 4366, 4367, 4368, 4350, 4369, 4370, 4371,
-     4372, 4374, 4375, 4376, 4377, 4378, 4379, 4380, 4381, 4382,
-     4385, 4386, 4387, 4388, 4389, 4390, 4391, 4392, 4393, 4394,
-     4395, 4396, 4397, 4398, 4399, 4400, 4401, 4402, 4403, 4404,
-
-     4405, 4406, 4407, 4408, 4409, 4410, 4411, 4412, 4413, 4414,
-     4415, 4416, 4417, 4418, 4419, 4421, 4422, 4420, 4423, 4423,
-     4424, 4425, 4426, 4426, 4427, 4427, 4428, 4429, 4430, 4430,
-     4432, 4414, 4428, 4429, 4410, 4411, 4412, 4420, 4432, 4423,
-     4431, 4431, 4413, 4433, 4434, 4435, 4436, 4433, 4437, 4438,
-     4439, 4440, 4441, 4443, 4442, 4444, 4445, 4447, 4448, 4418,
-     4416, 4449, 4450, 4451, 4415, 4417, 4452, 4453, 4454, 4455,
-     4456, 4457, 4458, 4422, 4435, 4436, 4459, 4462, 4463, 4439,
-     4440, 4442, 4464, 4434, 4465, 4466, 4441, 4467, 4437, 4438,
-     4468, 4469, 4470, 4479, 4480, 4471, 4481, 4470, 4470, 4470,
-
-     4471, 4471, 4471, 4472, 4482, 4483, 4473, 4484, 4472, 4472,
-     4472, 4473, 4473, 4473, 4485, 4486, 4474, 4470, 4487, 4475,
-     4471, 4474, 4474, 4474, 4475, 4475, 4475, 4476, 4489, 4490,
-     4491, 4492, 4476, 4476, 4476, 4472, 4493, 4494, 4473, 4495,
-     4477, 4474, 4496, 4497, 4475, 4477, 4477, 4477, 4498, 4499,
-     4500, 4501, 4502, 4503, 4504, 4505, 4506, 4507, 4508, 4509,
-     4498, 4510, 4511, 4498, 4476, 4513, 4514, 4515, 4516, 4517,
-     4518, 4519, 4520, 4521, 4522, 4523, 4524, 4525, 4526, 4527,
-     4528, 4529, 4530, 4531, 4532, 4533, 4534, 4535, 4536, 4537,
-     4538, 4539, 4540, 4542, 4543, 4544, 4545, 4546, 4548, 4549,
-
-     4550, 4551, 4552, 4553, 4554, 4555, 4556, 4557, 4558, 4559,
-     4560, 4561, 4562, 4563, 4564, 4565, 4566, 4567, 4568, 4569,
-     4570, 4579, 4580, 4571, 4581, 4570, 4570, 4570, 4571, 4571,
-     4571, 4572, 4582, 4583, 4573, 4584, 4572, 4572, 4572, 4573,
-     4573, 4573, 4585, 4586, 4574, 4570, 4587, 4575, 4571, 4574,
-     4574, 4574, 4575, 4575, 4575, 4576, 4588, 4589, 4590, 4591,
-     4576, 4576, 4576, 4572, 4589, 4592, 4573, 4593, 4577, 4574,
-     4594, 4595, 4575, 4577, 4577, 4577, 4596, 4597, 4598, 4599,
-     4600, 4601, 4602, 4603, 4604, 4605, 4606, 4607, 4608, 4609,
-     4610, 4611, 4576, 4612, 4613, 4614, 4615, 4616, 4617, 4618,
-
-     4619, 4620, 4621, 4622, 4623, 4624, 4625, 4626, 4627, 4628,
-     4629, 4630, 4616, 4631, 4632, 4633, 4634, 4637, 4638, 4639,
-     4640, 4641, 4642, 4643, 4644, 4645, 4646, 4647, 4631, 4648,
-     4649, 4650, 4651, 4652, 4654, 4655, 4656, 4657, 4658, 4659,
-     4660, 4661, 4662, 4663, 4664, 4665, 4666, 4667, 4668, 4669,
-     4670, 4671, 4672, 4673, 4674, 4675, 4676, 4677, 4678, 4679,
-     4681, 4682, 4683, 4684, 4685, 4686, 4687, 4688, 4689, 4690,
-     4691, 4692, 4693, 4694, 4695, 4696, 4697, 4698, 4699, 4701,
-     4702, 4703, 4704, 4705, 4706, 4707, 4709, 4710, 4711, 4712,
-     4713, 4714, 4715, 4716, 4717, 4718, 4719, 4720, 4721, 4721,
-
-     4722, 4722, 4726, 4727, 4719, 4720, 4723, 4724, 4725, 4728,
-     4710, 4711, 4725, 4730, 4723, 4724, 4729, 4731, 4732, 4733,
-     4709, 4734, 4735, 4736, 4737, 4713, 4738, 4739, 4740, 4741,
-     4742, 4743, 4745, 4744, 4746, 4747, 4748, 4749, 4715, 4750,
-     4752, 4753, 4730, 4728, 4754, 4718, 4731, 4716, 4734, 4755,
-     4729, 4756, 4732, 4733, 4744, 4757, 4714, 4758, 4760, 4717,
-     4767, 4735, 4761, 4760, 4760, 4760, 4762, 4761, 4761, 4761,
-     4768, 4762, 4762, 4762, 4769, 4763, 4770, 4771, 4764, 4772,
-     4763, 4763, 4763, 4764, 4764, 4764, 4773, 4765, 4775, 4776,
-     4777, 4762, 4765, 4765, 4765, 4760, 4766, 4778, 4779, 4761,
-
-     4763, 4766, 4766, 4766, 4780, 4781, 4782, 4783, 4784, 4785,
-     4786, 4787, 4788, 4789, 4790, 4764, 4791, 4793, 4794, 4795,
-     4796, 4797, 4798, 4799, 4765, 4801, 4802, 4803, 4804, 4805,
-     4806, 4807, 4808, 4809, 4810, 4811, 4812, 4813, 4814, 4815,
-     4816, 4818, 4819, 4820, 4821, 4822, 4823, 4824, 4825, 4826,
-     4827, 4828, 4829, 4830, 4831, 4832, 4833, 4834, 4835, 4836,
-     4837, 4838, 4839, 4840, 4843, 4844, 4845, 4846, 4847, 4848,
-     4849, 4848, 4850, 4852, 4848, 4848, 4848, 4853, 4854, 4855,
-     4856, 4848, 4863, 4864, 4865, 4856, 4856, 4856, 4848, 4857,
-     4866, 4848, 4867, 4858, 4857, 4857, 4857, 4859, 4858, 4858,
-
-     4858, 4860, 4859, 4859, 4859, 4861, 4860, 4860, 4860, 4862,
-     4861, 4861, 4861, 4868, 4862, 4862, 4862, 4856, 4858, 4869,
-     4871, 4872, 4859, 4873, 4874, 4875, 4857, 4877, 4878, 4879,
-     4880, 4881, 4882, 4883, 4884, 4886, 4888, 4889, 4860, 4890,
-     4891, 4892, 4861, 4893, 4894, 4895, 4896, 4897, 4898, 4899,
-     4900, 4901, 4902, 4903, 4904, 4905, 4906, 4908, 4909, 4910,
-     4911, 4912, 4913, 4914, 4915, 4916, 4917, 4918, 4919, 4920,
-     4921, 4922, 4923, 4924, 4925, 4926, 4927, 4928, 4929, 4930,
-     4931, 4932, 4933, 4934, 4935, 4936, 4937, 4938, 4939, 4941,
-     4942, 4943, 4944, 4945, 4946, 4947, 4948, 4949, 4950, 4951,
-
-     4952, 4953, 4954, 4955, 4956, 4957, 4958, 4959, 4943, 4960,
-     4961, 4962, 4963, 4965, 4966, 4967, 4968, 4969, 4970, 4971,
-     4972, 4973, 4974, 4975, 4976, 4977, 4978, 4979, 4980, 4981,
-     4983, 4984, 4985, 4986, 4987, 4988, 4990, 4991, 4992, 4993,
-     4994, 4995, 4996, 4997, 4998, 4998, 4999, 5000, 5001, 5002,
-     4999, 5000, 5005, 5006, 5003, 5004, 5001, 5002, 5003, 5004,
-     5007, 5008, 5009, 4990, 5010, 4998, 5011, 5013, 5012, 5017,
-     5018, 5019, 5020, 4993, 5026, 5027, 4991, 4992, 5022, 5030,
-     5006, 5031, 5032, 5033, 5034, 5035, 5043, 5007, 5044, 4997,
-     5045, 5010, 5046, 5011, 4994, 5008, 5009, 5037, 5047, 5022,
-
-     5048, 4996, 5037, 5037, 5037, 5038, 4995, 5012, 5039, 5050,
-     5038, 5038, 5038, 5039, 5039, 5039, 5040, 5052, 5053, 5041,
-     5054, 5040, 5040, 5040, 5041, 5041, 5041, 5042, 5055, 5056,
-     5058, 5059, 5042, 5042, 5042, 5060, 5061, 5062, 5063, 5064,
-     5065, 5066, 5067, 5070, 5071, 5039, 5074, 5075, 5076, 5077,
-     5078, 5079, 5080, 5040, 5081, 5083, 5084, 5085, 5086, 5087,
-     5088, 5089, 5090, 5091, 5092, 5093, 5094, 5097, 5098, 5099,
-     5094, 5100, 5101, 5102, 5103, 5104, 5105, 5106, 5107, 5108,
-     5109, 5110, 5111, 5112, 5113, 5114, 5115, 5116, 5117, 5118,
-     5119, 5120, 5121, 5122, 5123, 5125, 5124, 5121, 5124, 5126,
-
-     5127, 5128, 5129, 5130, 5131, 5132, 5138, 5139, 5133, 5140,
-     5132, 5132, 5132, 5133, 5133, 5133, 5134, 5141, 5142, 5135,
-     5143, 5134, 5134, 5134, 5135, 5135, 5135, 5136, 5145, 5146,
-     5137, 5147, 5136, 5136, 5136, 5137, 5137, 5137, 5148, 5149,
-     5150, 5151, 5152, 5153, 5155, 5156, 5157, 5159, 5160, 5161,
-     5162, 5164, 5165, 5134, 5166, 5167, 5135, 5168, 5170, 5171,
-     5172, 5173, 5174, 5175, 5176, 5177, 5178, 5179, 5180, 5181,
-     5183, 5184, 5185, 5186, 5187, 5188, 5189, 5190, 5191, 5192,
-     5193, 5194, 5195, 5197, 5198, 5199, 5200, 5201, 5202, 5203,
-     5204, 5205, 5206, 5207, 5209, 5210, 5211, 5212, 5213, 5214,
-
-     5215, 5216, 5217, 5218, 5219, 5220, 5221, 5222, 5223, 5224,
-     5225, 5226, 5227, 5228, 5229, 5230, 5231, 5232, 5233, 5234,
-     5232, 5235, 5236, 5237, 5238, 5239, 5240, 5241, 5242, 5243,
-     5244, 5247, 5248, 5253, 5254, 5257, 5258, 5259, 5260, 5261,
-     5262, 5263, 5264, 5265, 5265, 5266, 5267, 5268, 5269, 5270,
-     5271, 5272, 5269, 5270, 5275, 5273, 5274, 5276, 5277, 5278,
-     5279, 5281, 5288, 5260, 5265, 5289, 5292, 5296, 5297, 5293,
-     5300, 5292, 5292, 5292, 5293, 5293, 5293, 5301, 5302, 5303,
-     5305, 5275, 5306, 5307, 5276, 5308, 5262, 5309, 5310, 5311,
-     5312, 5313, 5314, 5263, 5273, 5274, 5315, 5277, 5278, 5318,
-
-     5319, 5320, 5321, 5322, 5323, 5324, 5261, 5325, 5326, 5327,
-     5328, 5329, 5330, 5331, 5332, 5333, 5334, 5335, 5336, 5337,
-     5338, 5339, 5340, 5341, 5342, 5344, 5345, 5346, 5347, 5348,
-     5349, 5350, 5352, 5353, 5355, 5356, 5357, 5358, 5359, 5360,
-     5361, 5362, 5363, 5364, 5365, 5366, 5367, 5368, 5369, 5370,
-     5371, 5372, 5373, 5374, 5375, 5376, 5380, 5381, 5377, 5384,
-     5376, 5376, 5376, 5377, 5377, 5377, 5385, 5386, 5386, 5387,
-     5387, 5388, 5389, 5390, 5391, 5392, 5393, 5394, 5395, 5396,
-     5397, 5398, 5399, 5400, 5401, 5402, 5403, 5404, 5406, 5407,
-     5408, 5409, 5411, 5412, 5413, 5414, 5415, 5416, 5417, 5418,
-
-     5419, 5420, 5421, 5422, 5423, 5424, 5425, 5426, 5427, 5428,
-     5429, 5430, 5431, 5432, 5433, 5434, 5435, 5436, 5438, 5439,
-     5440, 5441, 5442, 5443, 5444, 5445, 5446, 5447, 5448, 5449,
-     5450, 5451, 5452, 5453, 5454, 5455, 5456, 5457, 5458, 5459,
-     5460, 5461, 5462, 5463, 5464, 5465, 5466, 5467, 5468, 5469,
-     5470, 5471, 5472, 5473, 5474, 5475, 5476, 5477, 5482, 5483,
-     5484, 5485, 5486, 5487, 5488, 5489, 5490, 5491, 5492, 5493,
-     5499, 5500, 5501, 5502, 5504, 5505, 5506, 5507, 5508, 5509,
-     5510, 5511, 5512, 5513, 5514, 5515, 5516, 5517, 5518, 5519,
-     5520, 5521, 5522, 5523, 5524, 5525, 5526, 5527, 5528, 5529,
-
-     5530, 5531, 5532, 5533, 5534, 5490, 5491, 5536, 5537, 5483,
-     5538, 5539, 5540, 5541, 5542, 5543, 5544, 5545, 5547, 5548,
-     5549, 5550, 5551, 5552, 5555, 5556, 5557, 5558, 5561, 5562,
-     5563, 5564, 5563, 5565, 5566, 5563, 5563, 5563, 5567, 5568,
-     5571, 5572, 5563, 5577, 5578, 5579, 5580, 5581, 5582, 5563,
-     5583, 5584, 5585, 5586, 5587, 5588, 5589, 5590, 5591, 5594,
-     5595, 5596, 5598, 5599, 5600, 5601, 5602, 5603, 5604, 5605,
-     5606, 5607, 5608, 5609, 5610, 5611, 5612, 5613, 5614, 5615,
-     5617, 5618, 5619, 5620, 5621, 5623, 5624, 5625, 5626, 5629,
-     5630, 5631, 5632, 5633, 5634, 5635, 5636, 5637, 5638, 5639,
-
-     5640, 5641, 5642, 5643, 5644, 5645, 5646, 5648, 5649, 5650,
-     5651, 5652, 5653, 5655, 5656, 5657, 5658, 5659, 5660, 5661,
-     5662, 5664, 5665, 5666, 5667, 5668, 5669, 5670, 5671, 5673,
-     5674, 5675, 5676, 5677, 5678, 5679, 5681, 5682, 5683, 5684,
-     5686, 5687, 5688, 5689, 5690, 5691, 5692, 5693, 5694, 5695,
-     5696, 5697, 5698, 5700, 5701, 5702, 5703, 5704, 5706, 5707,
-     5709, 5710, 5711, 5713, 5714, 5715, 5716, 5717, 5718, 5719,
-     5723, 5724, 5725, 5726, 5727, 5728, 5729, 5730, 5731, 5730,
-     5732, 5733, 5734, 5735, 5736, 5737, 5738, 5739, 5740, 5741,
-     5743, 5744, 5745, 5746, 5747, 5753, 5754, 5756, 5757, 5758,
-
-     5759, 5762, 5764, 5765, 5766, 5768, 5769, 5770, 5772, 5775,
-     5776, 5777, 5779, 5780, 5781, 5782, 5783, 5784, 5785, 5786,
-     5787, 5788, 5789, 5790, 5791, 5793, 5794, 5795, 5796, 5797,
-     5798, 5799, 5801, 5802, 5803, 5804, 5805, 5806, 5807, 5808,
-     5809, 5810, 5811, 5812, 5813, 5814, 5815, 5816, 5817, 5818,
-     5820, 5822, 5823, 5824, 5825, 5826, 5827, 5828, 5829, 5830,
-     5831, 5832, 5835, 5836, 5837, 5838, 5840, 5841, 5842, 5843,
-     5845, 5846, 5847, 5848, 5849, 5850, 5851, 5852, 5853, 5854,
-     5855, 5857, 5858, 5860, 5861, 5862, 5863, 5864, 5865, 5866,
-     5867, 5868, 5869, 5870, 5871, 5872, 5874, 5875, 5876, 5877,
-
-     5878, 5879, 5880, 5881, 5883, 5884, 5885, 5887, 5888, 5889,
-     5890, 5891, 5892, 5893, 5894, 5895, 5896, 5897, 5898, 5899,
-     5900, 5901, 5902, 5903, 5904, 5906, 5907, 5908, 5909, 5910,
-     5911, 5912, 5913, 5914, 5915, 5916, 5917, 5919, 5920, 5921,
-     5922, 5923, 5925, 5926, 5927, 5928, 5929, 5930, 5931, 5932,
-     5933, 5934, 5936, 5937, 5938, 5939, 5940, 5941, 5943, 5944,
-     5945, 5946, 5947, 5948, 5949, 5951, 5952, 5953, 5955, 5957,
-     5958, 5959, 5960, 5962, 5963, 5964, 5966, 5967, 5968, 5969,
-     5970, 5971, 5973, 5978, 5973, 5979, 5980, 5973, 5973, 5973,
-     5983, 5985, 5986, 5988, 5989, 5990, 5991, 5992, 5993, 5994,
-
-     5995, 5998, 5999, 6000, 6003, 6004, 6005, 6006, 6008, 6010,
-     6012, 6014, 6016, 6017, 6018, 6019, 6020, 6021, 6022, 6023,
-     6024, 6025, 6026, 6027, 6028, 6029, 6030, 6031, 6032, 6033,
-     6034, 6026, 6035, 6036, 6037, 6038, 6039, 6040, 6041, 6042,
-     6043, 6044, 6045, 6047, 6048, 6049, 6050, 6051, 6052, 6053,
-     6054, 6055, 6056, 6057, 6058, 6060, 6061, 6062, 6064, 6065,
-     6066, 6067, 6068, 6069, 6070, 6071, 6072, 6073, 6074, 6075,
-     6076, 6077, 6078, 6079, 6082, 6083, 6073, 6084, 6085, 6086,
-     6087, 6088, 6089, 6090, 6091, 6093, 6095, 6096, 6097, 6099,
-     6100, 6101, 6102, 6103, 6104, 6105, 6106, 6107, 6108, 6109,
-
-     6110, 6111, 6112, 6113, 6114, 6115, 6117, 6118, 6119, 6120,
-     6122, 6123, 6125, 6126, 6127, 6128, 6129, 6130, 6131, 6132,
-     6133, 6134, 6135, 6136, 6138, 6140, 6141, 6142, 6143, 6145,
-     6146, 6147, 6148, 6149, 6150, 6151, 6153, 6155, 6156, 6157,
-     6158, 6159, 6160, 6161, 6162, 6163, 6165, 6166, 6167, 6168,
-     6169, 6172, 6173, 6174, 6175, 6176, 6177, 6178, 6179, 6180,
-     6181, 6182, 6183, 6184, 6185, 6186, 6187, 6189, 6190, 6191,
-     6193, 6193, 6194, 6195, 6196, 6197, 6198, 6199, 6200, 6202,
-     6203, 6206, 6207, 6209, 6210, 6211, 6212, 6213, 6214, 6215,
-     6216, 6217, 6218, 6220, 6221, 6223, 6224, 6225, 6226, 6227,
-
-     6228, 6229, 6230, 6232, 6234, 6235, 6236, 6238, 6239, 6240,
-     6242, 6243, 6244, 6245, 6247, 6248, 6249, 6251, 6252, 6253,
-     6254, 6255, 6257, 6258, 6261, 6262, 6263, 6264, 6265, 6266,
-     6267, 6268, 6269, 6270, 6271, 6272, 6275, 6276, 6279, 6280,
-     6281, 6282, 6286, 6287, 6288, 6289, 6290, 6291, 6293, 6294,
-     6295, 6296, 6298, 6299, 6300, 6301, 6302, 6303, 6304, 6305,
-     6306, 6308, 6309, 6310, 6312, 6313, 6315, 6316, 6317, 6318,
-     6319, 6320, 6321, 6322, 6323, 6324, 6325, 6326, 6327, 6328,
-     6329, 6331, 6332, 6333, 6334, 6335, 6336, 6337, 6338, 6340,
-     6342, 6343, 6344, 6345, 6346, 6347, 6348, 6349, 6350, 6352,
-
-     6353, 6354, 6358, 6359, 6360, 6363, 6364, 6365, 6366, 6367,
-     6369, 6370, 6371, 6372, 6373, 6374, 6375, 6377, 6378, 6379,
-     6380, 6382, 6383, 6384, 6385, 6387, 6388, 6389, 6392, 6393,
-     6394, 6395, 6396, 6397, 6398, 6400, 6402, 6403, 6404, 6405,
-     6407, 6409, 6410, 6411, 6415, 6416, 6417, 6418, 6419, 6420,
-     6421, 6422, 6424, 6425, 6427, 6428, 6429, 6431, 6432, 6433,
-     6434, 6435, 6436, 6437, 6438, 6439, 6440, 6441, 6442, 6443,
-     6444, 6445, 6446, 6447, 6448, 6449, 6451, 6454, 6455, 6457,
-     6458, 6459, 6460, 6463, 6464, 6465, 6466, 6467, 6468, 6470,
-     6471, 6472, 6473, 6476, 6477, 6478, 6479, 6481, 6482, 6483,
-
-     6484, 6488, 6489, 6490, 6491, 6492, 6493, 6494, 6495, 6496,
-     6497, 6499, 6500, 6502, 6504, 6505, 6506, 6507, 6508, 6509,
-     6510, 6511, 6512, 6513, 6514, 6515, 6516, 6517, 6518, 6519,
-     6522, 6522, 6522, 6522, 6522, 6522, 6522, 6523, 6523, 6523,
-     6523, 6523, 6523, 6523, 6524, 6524, 6524, 6524, 6524, 6524,
-     6524, 6525, 6525, 6525, 6525, 6525, 6525, 6525, 6526, 6526,
-     6527, 6527, 6527, 6527, 6528, 6528, 6528, 6528, 6529, 6529,
-     6530, 6530, 6530, 6530, 6531, 6531, 6531, 6531, 6532, 6532,
-     1066, 6532, 6532, 6532, 6532, 6533, 6533, 1065, 6533, 6533,
-     6533, 6533, 6534, 6534, 6535, 6535, 6536, 6536, 6536, 6536,
-
-     6536, 6536, 6536, 6537, 6537, 6537, 6537, 6537, 6537, 6537,
-     6538, 1063, 1060, 6538, 6538, 1058, 1057, 1055, 1054, 1052,
-     1051, 1050, 1049, 1047, 1046, 1045, 1044, 1042, 1041, 1040,
-     1039, 1037, 1036, 1035, 1034, 1033, 1031, 1030, 1029, 1027,
-     1026, 1025, 1024, 1017, 1016, 1015, 1014, 1013, 1012, 1011,
-     1002, 1001, 1000,  999,  998,  997,  995,  994,  993,  979,
-      974,  973,  972,  971,  970,  969,  968,  967,  965,  964,
-      963,  962,  960,  958,  957,  956,  955,  954,  952,  950,
-      948,  947,  946,  945,  944,  941,  940,  938,  936,  935,
-      934,  933,  932,  931,  930,  929,  928,  926,  925,  923,
-
-      922,  921,  920,  919,  918,  917,  916,  915,  914,  911,
-      910,  908,  907,  903,  902,  901,  899,  898,  897,  894,
-      893,  890,  889,  888,  887,  886,  884,  881,  880,  879,
-      878,  877,  875,  874,  873,  871,  870,  856,  855,  854,
-      853,  852,  851,  850,  835,  834,  833,  832,  831,  830,
-      829,  828,  826,  825,  824,  823,  820,  818,  817,  815,
-      814,  813,  810,  809,  806,  804,  802,  800,  799,  797,
-      796,  794,  793,  792,  791,  790,  789,  787,  786,  785,
-      784,  783,  782,  781,  767,  741,  737,  733,  732,  731,
-      730,  729,  728,  727,  726,  725,  719,  718,  716,  715,
-
-      714,  713,  712,  711,  705,  704,  703,  702,  701,  699,
-      698,  697,  696,  695,  693,  692,  690,  687,  686,  685,
-      684,  683,  682,  680,  679,  677,  676,  675,  674,  673,
-      672,  671,  670,  669,  668,  667,  666,  665,  662,  661,
-      660,  659,  658,  656,  655,  654,  653,  652,  650,  649,
-      648,  646,  645,  644,  643,  641,  640,  639,  638,  636,
-      635,  634,  632,  631,  630,  629,  628,  627,  626,  625,
-      624,  623,  622,  621,  619,  617,  616,  615,  614,  613,
-      612,  611,  610,  607,  606,  605,  604,  603,  602,  600,
-      599,  598,  597,  596,  595,  594,  593,  592,  590,  588,
-
-      587,  585,  584,  582,  581,  580,  579,  578,  575,  573,
-      571,  570,  569,  568,  567,  565,  564,  563,  562,  561,
-      560,  559,  558,  557,  555,  554,  553,  552,  550,  549,
-      548,  547,  546,  545,  544,  543,  542,  541,  540,  539,
-      538,  537,  536,  528,  526,  525,  524,  523,  510,  509,
-      508,  507,  506,  505,  504,  503,  500,  499,  498,  497,
-      496,  493,  492,  491,  488,  487,  484,  482,  481,  480,
-      479,  478,  477,  476,  475,  474,  473,  471,  469,  468,
-      467,  464,  463,  462,  461,  460,  459,  457,  456,  455,
-      453,  452,  450,  449,  443,  442,  440,  439,  438,  437,
-
-      436,  435,  433,  432,  431,  430,  429,  428,  426,  424,
-      423,  422,  421,  420,  419,  417,  416,  415,  414,  413,
-      412,  411,  410,  398,  396,  395,  394,  393,  375,  373,
-      372,  371,  370,  369,  368,  367,  366,  365,  364,  359,
-      358,  357,  356,  355,  354,  351,  349,  345,  343,  336,
-      335,  333,  332,  331,  324,  321,  320,  319,  313,  311,
-      310,  305,  304,  303,  302,  300,  299,  298,  291,  290,
-      289,  288,  286,  285,  284,  273,  271,  260,  257,  249,
-      248,  233,  221,  212,  210,  209,  208,  206,  204,  199,
-      188,  185,  183,  174,  147,  146,  139,  137,  135,  134,
-
-      117,   86,   80,   78,   77,   76,   67,   63,   48,   47,
-     6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521,
-     6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521,
-     6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521,
-     6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521,
-     6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521,
-     6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521,
-     6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521, 6521,
-     6521, 6521, 6521, 6521, 6521, 6521
+     4052, 4053, 4054, 4055, 4056, 4057, 4058, 4060, 4061, 4062,
+     4064, 4065, 4066, 4060, 4067, 4068, 4069, 4070, 4071, 4072,
+     4073, 4074, 4075, 4077, 4083, 4084, 4078, 4085, 4077, 4077,
+     4077, 4078, 4078, 4078, 4079, 4086, 4087, 4080, 4088, 4079,
+     4079, 4079, 4080, 4080, 4080, 4081, 4089, 4090, 4091, 4092,
+
+     4081, 4081, 4081, 4082, 4077, 4093, 4094, 4078, 4082, 4082,
+     4082, 4095, 4096, 4097, 4098, 4079, 4099, 4100, 4080, 4101,
+     4102, 4103, 4104, 4105, 4106, 4107, 4081, 4082, 4108, 4109,
+     4110, 4111, 4112, 4113, 4114, 4115, 4116, 4117, 4118, 4119,
+     4120, 4121, 4122, 4123, 4124, 4125, 4126, 4127, 4128, 4129,
+     4130, 4131, 4132, 4133, 4134, 4135, 4136, 4137, 4138, 4139,
+     4140, 4141, 4142, 4144, 4145, 4146, 4147, 4148, 4149, 4150,
+     4151, 4152, 4153, 4154, 4155, 4156, 4157, 4158, 4159, 4160,
+     4161, 4162, 4163, 4164, 4165, 4166, 4168, 4169, 4170, 4171,
+     4172, 4173, 4174, 4175, 4176, 4178, 4179, 4180, 4181, 4182,
+
+     4183, 4184, 4185, 4186, 4187, 4188, 4189, 4190, 4191, 4192,
+     4193, 4194, 4196, 4195, 4197, 4200, 4198, 4199, 4199, 4201,
+     4202, 4202, 4203, 4203, 4204, 4187, 4206, 4213, 4205, 4207,
+     4207, 4186, 4195, 4208, 4208, 4209, 4209, 4199, 4210, 4210,
+     4202, 4212, 4203, 4211, 4211, 4214, 4220, 4215, 4216, 4212,
+     4217, 4218, 4219, 4193, 4221, 4192, 4189, 4222, 4190, 4191,
+     4223, 4224, 4225, 4226, 4213, 4227, 4228, 4229, 4230, 4188,
+     4198, 4205, 4232, 4214, 4201, 4215, 4216, 4233, 4217, 4218,
+     4234, 4235, 4236, 4237, 4238, 4219, 4240, 4241, 4230, 4242,
+     4243, 4244, 4245, 4246, 4253, 4254, 4247, 4255, 4246, 4246,
+
+     4246, 4247, 4247, 4247, 4248, 4256, 4257, 4249, 4258, 4248,
+     4248, 4248, 4249, 4249, 4249, 4259, 4250, 4246, 4260, 4251,
+     4247, 4250, 4250, 4250, 4251, 4251, 4251, 4261, 4248, 4262,
+     4263, 4249, 4264, 4265, 4267, 4268, 4269, 4270, 4271, 4272,
+     4250, 4273, 4274, 4275, 4276, 4277, 4279, 4280, 4281, 4282,
+     4283, 4284, 4285, 4286, 4251, 4275, 4287, 4288, 4275, 4289,
+     4290, 4291, 4292, 4293, 4294, 4295, 4296, 4297, 4298, 4299,
+     4300, 4301, 4302, 4303, 4304, 4305, 4306, 4307, 4308, 4309,
+     4310, 4311, 4312, 4313, 4314, 4315, 4316, 4317, 4318, 4319,
+     4320, 4321, 4322, 4323, 4324, 4325, 4326, 4327, 4329, 4330,
+
+     4331, 4332, 4333, 4334, 4335, 4336, 4337, 4338, 4339, 4340,
+     4341, 4342, 4343, 4344, 4345, 4346, 4347, 4348, 4349, 4350,
+     4351, 4352, 4353, 4354, 4355, 4362, 4363, 4356, 4364, 4355,
+     4355, 4355, 4356, 4356, 4356, 4357, 4365, 4366, 4358, 4367,
+     4357, 4357, 4357, 4358, 4358, 4358, 4368, 4359, 4355, 4369,
+     4360, 4356, 4359, 4359, 4359, 4360, 4360, 4360, 4370, 4357,
+     4371, 4372, 4358, 4373, 4374, 4375, 4376, 4377, 4378, 4379,
+     4380, 4359, 4381, 4376, 4382, 4383, 4384, 4385, 4386, 4387,
+     4388, 4389, 4390, 4391, 4392, 4360, 4393, 4394, 4395, 4396,
+     4397, 4398, 4399, 4400, 4403, 4404, 4405, 4406, 4407, 4408,
+
+     4409, 4410, 4411, 4412, 4413, 4414, 4415, 4416, 4417, 4418,
+     4419, 4420, 4421, 4422, 4423, 4425, 4426, 4427, 4423, 4428,
+     4429, 4430, 4431, 4432, 4433, 4434, 4435, 4436, 4437, 4438,
+     4439, 4440, 4441, 4442, 4443, 4444, 4445, 4446, 4447, 4448,
+     4449, 4450, 4451, 4452, 4453, 4454, 4455, 4456, 4457, 4458,
+     4459, 4460, 4461, 4462, 4463, 4464, 4465, 4467, 4466, 4469,
+     4468, 4470, 4471, 4471, 4472, 4474, 4475, 4476, 4473, 4477,
+     4478, 4480, 4481, 4474, 4475, 4476, 4479, 4477, 4478, 4479,
+     4482, 4483, 4471, 4484, 4486, 4461, 4487, 4462, 4488, 4491,
+     4492, 4485, 4493, 4494, 4497, 4495, 4498, 4499, 4496, 4500,
+
+     4467, 4501, 4502, 4504, 4505, 4481, 4469, 4506, 4470, 4507,
+     4486, 4508, 4509, 4482, 4483, 4495, 4484, 4464, 4496, 4465,
+     4466, 4463, 4468, 4473, 4485, 4510, 4516, 4517, 4511, 4518,
+     4510, 4510, 4510, 4511, 4511, 4511, 4512, 4519, 4520, 4513,
+     4521, 4512, 4512, 4512, 4513, 4513, 4513, 4514, 4522, 4523,
+     4515, 4524, 4514, 4514, 4514, 4515, 4515, 4515, 4525, 4526,
+     4510, 4527, 4528, 4511, 4530, 4531, 4532, 4533, 4534, 4535,
+     4536, 4512, 4537, 4538, 4513, 4539, 4540, 4541, 4542, 4543,
+     4544, 4545, 4514, 4546, 4548, 4549, 4550, 4551, 4552, 4553,
+     4554, 4555, 4556, 4557, 4559, 4560, 4561, 4562, 4563, 4565,
+
+     4566, 4567, 4568, 4569, 4570, 4571, 4572, 4573, 4574, 4575,
+     4576, 4577, 4578, 4579, 4580, 4581, 4582, 4584, 4585, 4586,
+     4587, 4588, 4589, 4590, 4591, 4592, 4593, 4594, 4595, 4596,
+     4597, 4598, 4599, 4600, 4601, 4602, 4603, 4604, 4606, 4607,
+     4608, 4609, 4610, 4609, 4611, 4613, 4609, 4609, 4609, 4614,
+     4615, 4616, 4617, 4609, 4623, 4624, 4625, 4617, 4617, 4617,
+     4609, 4618, 4626, 4609, 4619, 4627, 4618, 4618, 4618, 4619,
+     4619, 4619, 4620, 4628, 4629, 4621, 4630, 4620, 4620, 4620,
+     4621, 4621, 4621, 4622, 4631, 4632, 4633, 4617, 4622, 4622,
+     4622, 4635, 4636, 4637, 4638, 4639, 4618, 4641, 4642, 4619,
+
+     4643, 4644, 4646, 4647, 4648, 4649, 4650, 4620, 4651, 4652,
+     4621, 4653, 4654, 4655, 4656, 4657, 4658, 4659, 4660, 4661,
+     4662, 4663, 4664, 4665, 4666, 4667, 4668, 4669, 4670, 4671,
+     4673, 4674, 4675, 4676, 4677, 4678, 4679, 4680, 4681, 4682,
+     4683, 4684, 4685, 4686, 4688, 4689, 4690, 4691, 4692, 4693,
+     4694, 4695, 4696, 4697, 4698, 4699, 4700, 4701, 4702, 4703,
+     4704, 4705, 4706, 4690, 4707, 4708, 4710, 4711, 4712, 4713,
+     4714, 4715, 4716, 4717, 4718, 4719, 4721, 4722, 4723, 4724,
+     4725, 4726, 4727, 4728, 4729, 4729, 4730, 4730, 4732, 4731,
+     4733, 4732, 4734, 4733, 4735, 4734, 4736, 4735, 4737, 4736,
+
+     4743, 4738, 4721, 4739, 4729, 4740, 4730, 4741, 4742, 4745,
+     4722, 4747, 4748, 4760, 4761, 4762, 4763, 4764, 4750, 4752,
+     4754, 4771, 4772, 4773, 4774, 4775, 4728, 4738, 4777, 4739,
+     4779, 4740, 4726, 4741, 4742, 4725, 4731, 4743, 4750, 4752,
+     4754, 4766, 4780, 4781, 4727, 4767, 4766, 4766, 4766, 4768,
+     4767, 4767, 4767, 4769, 4768, 4768, 4768, 4770, 4769, 4769,
+     4769, 4782, 4770, 4770, 4770, 4783, 4784, 4785, 4786, 4787,
+     4788, 4789, 4790, 4791, 4792, 4793, 4794, 4795, 4797, 4798,
+     4799, 4800, 4801, 4802, 4803, 4804, 4805, 4817, 4818, 4819,
+     4820, 4821, 4822, 4823, 4824, 4826, 4827, 4828, 4829, 4830,
+
+     4831, 4832, 4833, 4836, 4837, 4838, 4839, 4840, 4841, 4842,
+     4843, 4844, 4845, 4846, 4847, 4848, 4849, 4850, 4851, 4852,
+     4853, 4854, 4855, 4856, 4857, 4858, 4859, 4860, 4861, 4862,
+     4863, 4865, 4864, 4861, 4864, 4866, 4867, 4868, 4869, 4870,
+     4871, 4872, 4877, 4878, 4873, 4879, 4872, 4872, 4872, 4873,
+     4873, 4873, 4874, 4880, 4881, 4875, 4888, 4874, 4874, 4874,
+     4875, 4875, 4875, 4876, 4889, 4890, 4891, 4892, 4876, 4876,
+     4876, 4893, 4894, 4895, 4896, 4897, 4898, 4899, 4900, 4902,
+     4903, 4904, 4905, 4907, 4908, 4909, 4910, 4911, 4912, 4913,
+     4914, 4916, 4917, 4923, 4924, 4925, 4926, 4927, 4928, 4929,
+
+     4930, 4931, 4932, 4933, 4934, 4936, 4937, 4938, 4939, 4940,
+     4941, 4942, 4943, 4944, 4945, 4946, 4947, 4948, 4949, 4950,
+     4951, 4952, 4953, 4954, 4955, 4956, 4957, 4958, 4959, 4957,
+     4960, 4961, 4962, 4963, 4969, 4970, 4971, 4972, 4973, 4974,
+     4975, 4975, 4976, 4977, 4977, 4978, 4979, 4979, 4980, 4981,
+     4982, 4983, 4984, 4985, 4986, 4987, 4988, 4989, 4990, 4970,
+     4975, 4992, 4994, 4977, 5006, 5007, 4979, 5008, 5009, 5011,
+     5012, 5013, 5014, 5015, 5016, 5017, 5018, 5019, 5020, 5021,
+     5022, 4973, 4994, 5023, 5024, 5025, 5026, 5028, 5029, 5030,
+     4985, 4986, 4987, 4988, 4989, 5031, 5032, 5033, 5034, 5035,
+
+     5036, 4972, 5037, 5038, 5039, 5040, 5041, 5042, 5043, 5044,
+     5045, 5046, 5047, 5048, 5049, 5050, 5051, 5052, 5053, 5055,
+     5056, 5057, 5058, 5059, 5061, 5062, 5064, 5065, 5066, 5067,
+     5068, 5069, 5070, 5071, 5072, 5073, 5074, 5075, 5076, 5077,
+     5078, 5079, 5080, 5081, 5082, 5083, 5084, 5085, 5086, 5092,
+     5093, 5094, 5094, 5095, 5095, 5096, 5097, 5098, 5099, 5100,
+     5101, 5102, 5103, 5104, 5105, 5106, 5107, 5108, 5109, 5110,
+     5111, 5113, 5114, 5115, 5116, 5117, 5118, 5120, 5121, 5122,
+     5123, 5124, 5125, 5127, 5128, 5129, 5130, 5131, 5132, 5133,
+     5134, 5135, 5136, 5137, 5138, 5139, 5140, 5141, 5142, 5143,
+
+     5144, 5145, 5146, 5147, 5148, 5149, 5150, 5151, 5152, 5153,
+     5154, 5155, 5156, 5157, 5158, 5159, 5160, 5161, 5162, 5163,
+     5163, 5164, 5165, 5166, 5167, 5168, 5169, 5171, 5172, 5173,
+     5174, 5176, 5177, 5178, 5179, 5180, 5181, 5183, 5184, 5163,
+     5185, 5186, 5187, 5188, 5189, 5190, 5191, 5192, 5194, 5195,
+     5196, 5197, 5198, 5199, 5200, 5201, 5202, 5203, 5204, 5205,
+     5206, 5207, 5208, 5210, 5161, 5211, 5213, 5214, 5215, 5216,
+     5217, 5218, 5219, 5220, 5221, 5223, 5224, 5225, 5226, 5227,
+     5228, 5229, 5230, 5233, 5234, 5235, 5236, 5239, 5240, 5241,
+     5242, 5241, 5243, 5244, 5241, 5241, 5241, 5245, 5246, 5247,
+
+     5248, 5241, 5253, 5254, 5255, 5256, 5257, 5258, 5241, 5259,
+     5260, 5261, 5262, 5263, 5266, 5267, 5269, 5270, 5271, 5273,
+     5274, 5275, 5276, 5277, 5278, 5280, 5281, 5282, 5283, 5284,
+     5287, 5288, 5289, 5290, 5291, 5292, 5293, 5294, 5295, 5296,
+     5297, 5298, 5299, 5300, 5301, 5302, 5304, 5305, 5306, 5307,
+     5308, 5309, 5310, 5312, 5313, 5314, 5315, 5316, 5317, 5318,
+     5319, 5320, 5321, 5322, 5323, 5325, 5326, 5327, 5328, 5330,
+     5331, 5332, 5335, 5337, 5338, 5339, 5340, 5342, 5343, 5344,
+     5345, 5346, 5347, 5348, 5349, 5350, 5351, 5352, 5353, 5354,
+     5355, 5357, 5358, 5360, 5362, 5363, 5364, 5365, 5366, 5367,
+
+     5368, 5369, 5370, 5374, 5375, 5376, 5377, 5378, 5379, 5380,
+     5381, 5382, 5381, 5383, 5384, 5385, 5386, 5387, 5388, 5389,
+     5390, 5391, 5392, 5393, 5394, 5395, 5400, 5402, 5403, 5404,
+     5406, 5407, 5408, 5409, 5411, 5412, 5413, 5414, 5415, 5416,
+     5417, 5418, 5419, 5420, 5421, 5422, 5423, 5425, 5426, 5427,
+     5428, 5429, 5430, 5432, 5433, 5434, 5435, 5436, 5437, 5438,
+     5439, 5440, 5441, 5442, 5443, 5444, 5445, 5446, 5447, 5449,
+     5450, 5452, 5453, 5454, 5445, 5455, 5456, 5457, 5458, 5459,
+     5460, 5461, 5462, 5463, 5466, 5468, 5469, 5470, 5471, 5472,
+     5473, 5474, 5475, 5476, 5477, 5478, 5479, 5480, 5484, 5485,
+
+     5487, 5488, 5489, 5490, 5491, 5492, 5493, 5494, 5495, 5496,
+     5497, 5498, 5499, 5501, 5502, 5503, 5504, 5505, 5506, 5508,
+     5509, 5510, 5512, 5513, 5514, 5515, 5516, 5517, 5518, 5519,
+     5520, 5521, 5523, 5524, 5525, 5526, 5527, 5528, 5529, 5530,
+     5531, 5532, 5533, 5534, 5535, 5536, 5537, 5538, 5540, 5541,
+     5542, 5543, 5544, 5545, 5546, 5547, 5548, 5549, 5550, 5551,
+     5552, 5553, 5554, 5556, 5558, 5559, 5560, 5561, 5562, 5563,
+     5564, 5565, 5567, 5568, 5569, 5570, 5572, 5573, 5574, 5575,
+     5576, 5577, 5579, 5580, 5581, 5582, 5584, 5589, 5584, 5590,
+     5591, 5584, 5584, 5584, 5594, 5596, 5597, 5599, 5600, 5601,
+
+     5602, 5603, 5604, 5607, 5608, 5611, 5614, 5615, 5617, 5618,
+     5619, 5620, 5621, 5622, 5623, 5624, 5625, 5626, 5627, 5628,
+     5629, 5630, 5631, 5632, 5633, 5634, 5626, 5635, 5636, 5637,
+     5638, 5639, 5640, 5641, 5643, 5644, 5645, 5646, 5647, 5648,
+     5649, 5650, 5651, 5652, 5653, 5654, 5655, 5656, 5657, 5658,
+     5659, 5661, 5662, 5663, 5664, 5665, 5666, 5667, 5668, 5669,
+     5670, 5671, 5672, 5673, 5674, 5675, 5676, 5677, 5680, 5681,
+     5671, 5682, 5683, 5684, 5685, 5686, 5687, 5688, 5690, 5691,
+     5692, 5693, 5694, 5695, 5696, 5697, 5698, 5699, 5700, 5701,
+     5702, 5703, 5704, 5706, 5707, 5708, 5709, 5711, 5712, 5714,
+
+     5715, 5716, 5717, 5718, 5719, 5720, 5721, 5722, 5723, 5724,
+     5725, 5726, 5727, 5728, 5729, 5730, 5731, 5732, 5733, 5735,
+     5736, 5737, 5738, 5739, 5740, 5741, 5743, 5744, 5745, 5746,
+     5747, 5748, 5749, 5750, 5751, 5753, 5754, 5755, 5756, 5757,
+     5759, 5761, 5762, 5763, 5764, 5765, 5766, 5767, 5768, 5769,
+     5771, 5772, 5774, 5774, 5775, 5776, 5777, 5778, 5779, 5780,
+     5781, 5783, 5784, 5785, 5786, 5787, 5788, 5789, 5790, 5791,
+     5792, 5793, 5794, 5795, 5796, 5797, 5798, 5799, 5800, 5801,
+     5802, 5804, 5805, 5806, 5808, 5809, 5810, 5811, 5812, 5813,
+     5815, 5817, 5818, 5819, 5821, 5822, 5823, 5825, 5826, 5828,
+
+     5829, 5830, 5832, 5834, 5835, 5837, 5838, 5839, 5840, 5841,
+     5842, 5843, 5844, 5845, 5846, 5847, 5848, 5849, 5850, 5851,
+     5853, 5854, 5855, 5858, 5859, 5861, 5862, 5863, 5864, 5868,
+     5869, 5870, 5871, 5872, 5874, 5875, 5876, 5877, 5879, 5880,
+     5881, 5883, 5884, 5885, 5886, 5887, 5888, 5890, 5891, 5892,
+     5893, 5894, 5895, 5896, 5897, 5898, 5899, 5901, 5902, 5903,
+     5904, 5907, 5908, 5911, 5912, 5913, 5914, 5915, 5916, 5897,
+     5917, 5918, 5920, 5922, 5923, 5924, 5925, 5926, 5927, 5928,
+     5929, 5933, 5934, 5935, 5938, 5939, 5940, 5941, 5942, 5943,
+     5945, 5946, 5947, 5948, 5950, 5951, 5952, 5953, 5955, 5956,
+
+     5957, 5959, 5960, 5961, 5962, 5964, 5965, 5966, 5967, 5968,
+     5969, 5970, 5971, 5972, 5974, 5976, 5977, 5978, 5979, 5980,
+     5982, 5984, 5985, 5989, 5990, 5992, 5993, 5994, 5996, 5997,
+     5998, 6000, 6001, 6002, 6003, 6005, 6006, 6007, 6008, 6009,
+     6010, 6011, 6012, 6013, 6014, 6015, 6016, 6018, 6019, 6020,
+     6022, 6023, 6025, 6026, 6027, 6028, 6029, 6032, 6033, 6034,
+     6035, 6036, 6037, 6038, 6039, 6040, 6041, 6044, 6045, 6046,
+     6048, 6049, 6050, 6051, 6052, 6055, 6056, 6057, 6058, 6059,
+     6060, 6061, 6062, 6063, 6064, 6065, 6066, 6067, 6069, 6070,
+     6072, 6073, 6075, 6076, 6078, 6079, 6080, 6081, 6082, 6083,
+
+     6084, 6085, 6086, 6087, 6088, 6089, 6090, 6091, 6092, 6095,
+     6095, 6095, 6095, 6096, 6096, 6096, 6096, 6097, 6097, 6097,
+     6097, 6098, 6098, 6098, 6098, 6099, 6100, 6100, 6101, 6101,
+     6102, 6103, 6104, 6104, 6105, 6105, 6106, 6107, 6109, 6107,
+     6107, 6108, 6110, 6108, 6108, 6111, 6111, 6111, 6111, 6112,
+     6112, 6112, 6112, 1053, 1051, 1049, 1048, 1047, 1045, 1044,
+     1043, 1042, 1036, 1035, 1033, 1031, 1028, 1027, 1026, 1025,
+     1024, 1023, 1015, 1014, 1013, 1012, 1011, 1010, 1008, 1007,
+     1006,  992,  987,  986,  985,  984,  983,  982,  981,  980,
+      979,  978,  976,  975,  972,  970,  967,  966,  965,  964,
+
+      963,  962,  961,  960,  958,  956,  955,  953,  952,  951,
+      950,  948,  946,  945,  943,  942,  941,  940,  938,  937,
+      935,  934,  933,  932,  931,  930,  929,  928,  927,  926,
+      919,  918,  917,  912,  911,  909,  908,  904,  903,  902,
+      900,  899,  898,  896,  895,  894,  893,  892,  890,  889,
+      888,  887,  885,  883,  882,  879,  876,  875,  874,  872,
+      870,  869,  868,  867,  865,  864,  861,  860,  859,  858,
+      857,  855,  854,  853,  852,  838,  837,  836,  835,  834,
+      833,  825,  824,  823,  822,  821,  820,  818,  817,  816,
+      815,  812,  811,  810,  808,  807,  806,  805,  804,  803,
+
+      802,  801,  800,  799,  796,  795,  794,  792,  791,  789,
+      788,  786,  785,  784,  783,  782,  781,  779,  778,  777,
+      776,  775,  774,  762,  737,  733,  732,  731,  730,  729,
+      728,  727,  726,  725,  719,  717,  716,  715,  713,  712,
+      711,  710,  709,  708,  707,  706,  705,  704,  703,  702,
+      701,  699,  698,  696,  695,  694,  693,  692,  691,  690,
+      689,  688,  687,  686,  685,  684,  682,  681,  680,  679,
+      678,  676,  675,  674,  673,  672,  671,  670,  669,  668,
+      666,  665,  664,  663,  661,  660,  659,  658,  656,  655,
+      654,  653,  652,  651,  650,  649,  648,  647,  646,  645,
+
+      644,  643,  642,  641,  640,  639,  638,  637,  636,  635,
+      634,  633,  632,  631,  624,  623,  621,  619,  618,  617,
+      616,  615,  613,  612,  610,  609,  607,  606,  605,  604,
+      603,  602,  601,  599,  598,  596,  595,  594,  592,  591,
+      590,  589,  588,  587,  585,  584,  583,  582,  581,  580,
+      579,  578,  577,  576,  575,  574,  573,  572,  571,  570,
+      569,  565,  564,  563,  559,  557,  550,  549,  548,  547,
+      535,  534,  533,  532,  531,  530,  529,  528,  525,  524,
+      523,  522,  521,  520,  517,  516,  514,  512,  511,  510,
+      506,  505,  504,  502,  501,  498,  497,  496,  495,  494,
+
+      493,  492,  491,  490,  489,  488,  487,  486,  485,  484,
+      481,  480,  479,  478,  477,  476,  474,  473,  466,  465,
+      463,  457,  455,  454,  452,  451,  445,  444,  443,  442,
+      441,  440,  439,  438,  437,  436,  434,  432,  431,  430,
+      429,  428,  427,  426,  425,  424,  423,  421,  420,  419,
+      417,  416,  415,  414,  413,  412,  411,  410,  409,  408,
+      407,  406,  403,  402,  401,  400,  399,  398,  396,  395,
+      394,  393,  392,  391,  378,  377,  376,  375,  363,  362,
+      361,  360,  359,  358,  357,  356,  355,  349,  348,  347,
+      346,  345,  343,  340,  339,  337,  335,  328,  326,  325,
+
+      324,  318,  315,  314,  313,  307,  305,  304,  303,  302,
+      301,  299,  298,  297,  286,  285,  284,  283,  282,  270,
+      261,  256,  255,  254,  253,  251,  250,  249,  235,  216,
+      215,  214,  212,  210,  205,  196,  193,  191,  156,  147,
+      146,  144,  135,  133,  132,  106,   79,   72,   71,   70,
+       61,   57, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094,
+     6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094,
+     6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094,
+     6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094,
+     6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094,
+
+     6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094,
+     6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094, 6094,
+     6094, 6094, 6094, 6094, 6094
     } ;
 
 /* The intent behind this definition is that it'll catch
@@ -4759,17 +4454,17 @@ static yyconst flex_int16_t yy_chk[9887] =
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
 #include <fstream>
@@ -4813,10 +4508,7 @@ using namespace std;
 
 
 
-
-
-
-#line 4820 "parameters_flexer.cc"
+#line 4512 "parameters_flexer.cc"
 
 #define INITIAL 0
 #define JOB_MODE 1
@@ -4836,19 +4528,16 @@ using namespace std;
 #define PAF_MODE 15
 #define EDIT_MODE 16
 #define SKIM_MODE 17
-#define KMERSTAT_MODE 18
-#define ALIGN_MODE 19
+#define ALIGN_MODE 18
+#define AL_GPLMODE 19
 #define AS_MODE 20
 #define DP_MODE 21
 #define CO_MODE 22
 #define DIR_MODE 23
 #define MI_MODE 24
-#define NW_MODE 25
-#define NW_CHOICEMODE 26
-#define CO_VALMODE 27
-#define CSV_NUMBERS_MODE 28
-#define COMMENT_MODE 29
-#define ASKFORTECH_NOCLIPPING 30
+#define CO_VALMODE 25
+#define COMMENT_MODE 26
+#define ASKFORTECH_NOCLIPPING 27
 
 #ifndef YY_NO_UNISTD_H
 /* Special case for "unistd.h", since it is non-ANSI. We include it way
@@ -4951,10 +4640,10 @@ YY_DECL
 	register char *yy_cp, *yy_bp;
 	register int yy_act;
     
-#line 85 "parameters_flexer.ll"
+#line 82 "parameters_flexer.ll"
 
 
-#line 4958 "parameters_flexer.cc"
+#line 4647 "parameters_flexer.cc"
 
 	if ( !(yy_init) )
 		{
@@ -5007,13 +4696,13 @@ yy_match:
 			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 				{
 				yy_current_state = (int) yy_def[yy_current_state];
-				if ( yy_current_state >= 6522 )
+				if ( yy_current_state >= 6095 )
 					yy_c = yy_meta[(unsigned int) yy_c];
 				}
 			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
 			++yy_cp;
 			}
-		while ( yy_base[yy_current_state] != 9811 );
+		while ( yy_base[yy_current_state] != 9053 );
 
 yy_find_action:
 		yy_act = yy_accept[yy_current_state];
@@ -5038,2481 +4727,2391 @@ do_action:	/* This label is used only to access EOF actions. */
 			goto yy_find_action;
 
 case 1:
-#line 88 "parameters_flexer.ll"
+#line 85 "parameters_flexer.ll"
 case 2:
-YY_RULE_SETUP
-#line 88 "parameters_flexer.ll"
-{return MP_as_numthreads;}
-	YY_BREAK
+#line 86 "parameters_flexer.ll"
 case 3:
-#line 90 "parameters_flexer.ll"
-case 4:
 YY_RULE_SETUP
-#line 90 "parameters_flexer.ll"
-{return MP_as_amm_keeppercentfree;}
+#line 86 "parameters_flexer.ll"
+{ filenameid=MP_as_projectname_in; yy_push_state(FN_MODE);}
 	YY_BREAK
+case 4:
+#line 88 "parameters_flexer.ll"
 case 5:
-#line 92 "parameters_flexer.ll"
+#line 89 "parameters_flexer.ll"
 case 6:
 YY_RULE_SETUP
-#line 92 "parameters_flexer.ll"
-{return MP_as_amm_maxprocesssize;}
+#line 89 "parameters_flexer.ll"
+{ filenameid=MP_as_projectname_out; yy_push_state(FN_MODE);}
 	YY_BREAK
 case 7:
-#line 94 "parameters_flexer.ll"
+#line 91 "parameters_flexer.ll"
 case 8:
-YY_RULE_SETUP
-#line 94 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_automemmanagement;}
-	YY_BREAK
+#line 92 "parameters_flexer.ll"
 case 9:
-#line 97 "parameters_flexer.ll"
-case 10:
 YY_RULE_SETUP
-#line 97 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_cleanup_tmp_files;}
+#line 92 "parameters_flexer.ll"
+{ filenameid=MP_as_projectname; yy_push_state(FN_MODE);}
 	YY_BREAK
+case 10:
+#line 94 "parameters_flexer.ll"
 case 11:
-#line 100 "parameters_flexer.ll"
-case 12:
 YY_RULE_SETUP
-#line 100 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_nodateoutput;}
+#line 94 "parameters_flexer.ll"
+{return MP_as_numthreads;}
 	YY_BREAK
+case 12:
+#line 96 "parameters_flexer.ll"
 case 13:
-#line 102 "parameters_flexer.ll"
-case 14:
 YY_RULE_SETUP
-#line 102 "parameters_flexer.ll"
-{ return MP_sp_est_startstep;}
+#line 96 "parameters_flexer.ll"
+{return MP_as_amm_keeppercentfree;}
 	YY_BREAK
+case 14:
+#line 98 "parameters_flexer.ll"
 case 15:
-#line 104 "parameters_flexer.ll"
-case 16:
 YY_RULE_SETUP
-#line 104 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_buntify_reads;}
+#line 98 "parameters_flexer.ll"
+{return MP_as_amm_maxprocesssize;}
 	YY_BREAK
+case 16:
+#line 100 "parameters_flexer.ll"
 case 17:
-#line 106 "parameters_flexer.ll"
-case 18:
 YY_RULE_SETUP
-#line 106 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_preprocess_only;}
+#line 100 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_automemmanagement;}
 	YY_BREAK
+case 18:
+#line 103 "parameters_flexer.ll"
 case 19:
-#line 108 "parameters_flexer.ll"
-case 20:
 YY_RULE_SETUP
-#line 108 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_bangonthrow;}
+#line 103 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_cleanup_tmp_files;}
 	YY_BREAK
+case 20:
+#line 106 "parameters_flexer.ll"
 case 21:
-#line 112 "parameters_flexer.ll"
-case 22:
 YY_RULE_SETUP
-#line 112 "parameters_flexer.ll"
-{yy_push_state(ASK_YN_MODE); return MP_as_wants_qualityfile;}
+#line 106 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_nodateoutput;}
 	YY_BREAK
+case 22:
+#line 108 "parameters_flexer.ll"
 case 23:
 YY_RULE_SETUP
-#line 114 "parameters_flexer.ll"
-{ BEGIN(LR_MODE); return E_QUAL_NONE;}
+#line 108 "parameters_flexer.ll"
+{ return MP_sp_est_startstep;}
 	YY_BREAK
 case 24:
-YY_RULE_SETUP
-#line 115 "parameters_flexer.ll"
-{ BEGIN(LR_MODE); return E_QUAL_SCF;}
-	YY_BREAK
+#line 110 "parameters_flexer.ll"
 case 25:
 YY_RULE_SETUP
-#line 116 "parameters_flexer.ll"
-{ BEGIN(0); return MP_UNRECOGNISED_STRING;}
+#line 110 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_use_template_information;}
 	YY_BREAK
 case 26:
-YY_RULE_SETUP
-#line 117 "parameters_flexer.ll"
-{ BEGIN(0); return MP_UNRECOGNISED_STRING;}
-	YY_BREAK
+#line 112 "parameters_flexer.ll"
 case 27:
 YY_RULE_SETUP
-#line 118 "parameters_flexer.ll"
-{ BEGIN(0); return MP_UNRECOGNISED_STRING;}
+#line 112 "parameters_flexer.ll"
+{return MP_con_insertsize_minimum;}
 	YY_BREAK
 case 28:
-/* rule 28 can match eol */
+#line 114 "parameters_flexer.ll"
+case 29:
 YY_RULE_SETUP
-#line 119 "parameters_flexer.ll"
-{ BEGIN(0); return MP_UNRECOGNISED_STRING;}
+#line 114 "parameters_flexer.ll"
+{return MP_con_insertsize_maximum;}
 	YY_BREAK
-case 29:
-#line 121 "parameters_flexer.ll"
 case 30:
+#line 116 "parameters_flexer.ll"
+case 31:
 YY_RULE_SETUP
-#line 121 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_filecheck_only;}
+#line 116 "parameters_flexer.ll"
+{return MP_con_template_build_direction;}
 	YY_BREAK
-case 31:
-#line 125 "parameters_flexer.ll"
 case 32:
+#line 118 "parameters_flexer.ll"
+case 33:
 YY_RULE_SETUP
-#line 125 "parameters_flexer.ll"
-{ return MP_as_backbone_raillength;}
+#line 118 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_buntify_reads;}
 	YY_BREAK
-case 33:
-#line 127 "parameters_flexer.ll"
 case 34:
+#line 123 "parameters_flexer.ll"
+case 35:
 YY_RULE_SETUP
-#line 127 "parameters_flexer.ll"
-{ return MP_as_backbone_railoverlap;}
+#line 123 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_load_sequencedata;}
 	YY_BREAK
-case 35:
-#line 129 "parameters_flexer.ll"
 case 36:
+#line 125 "parameters_flexer.ll"
+case 37:
 YY_RULE_SETUP
-#line 129 "parameters_flexer.ll"
-{ filenameid=MP_as_backbone_rail_fromstrain; yy_push_state(FN_MODE);}
+#line 125 "parameters_flexer.ll"
+{ filenameid=MP_as_infile_loadjob; yy_push_state(FN_MODE);}
 	YY_BREAK
-case 37:
-#line 131 "parameters_flexer.ll"
 case 38:
+#line 128 "parameters_flexer.ll"
+case 39:
 YY_RULE_SETUP
-#line 131 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_backbone_strainname_forceforall;}
+#line 128 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_loadSOLEXA_solexa_scores_in_qual_files;}
 	YY_BREAK
-case 39:
-#line 133 "parameters_flexer.ll"
 case 40:
+#line 130 "parameters_flexer.ll"
+case 41:
 YY_RULE_SETUP
-#line 133 "parameters_flexer.ll"
-{ return MP_as_backbone_basequals;}
+#line 130 "parameters_flexer.ll"
+{return MP_as_fastq_qualoffset;}
 	YY_BREAK
-case 41:
-#line 135 "parameters_flexer.ll"
 case 42:
+#line 132 "parameters_flexer.ll"
+case 43:
 YY_RULE_SETUP
-#line 135 "parameters_flexer.ll"
-{ return MP_as_startbackboneusage_inpass;}
+#line 132 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_external_quality_override;}
 	YY_BREAK
-case 43:
-#line 137 "parameters_flexer.ll"
 case 44:
+#line 134 "parameters_flexer.ll"
+case 45:
 YY_RULE_SETUP
-#line 137 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_backbone_alsobuildnewcontigs;}
+#line 134 "parameters_flexer.ll"
+{ BEGIN(LR_EQMODE); return MP_as_external_quality;}
 	YY_BREAK
-case 45:
-#line 139 "parameters_flexer.ll"
 case 46:
+#line 136 "parameters_flexer.ll"
+case 47:
 YY_RULE_SETUP
-#line 139 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_backbone_trimoverhangingreads;}
+#line 136 "parameters_flexer.ll"
+{yy_push_state(ASK_YN_MODE); return MP_as_wants_qualityfile;}
 	YY_BREAK
-case 47:
-#line 141 "parameters_flexer.ll"
 case 48:
 YY_RULE_SETUP
-#line 141 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_backbone_bootstrapnewbackbone;}
+#line 138 "parameters_flexer.ll"
+{ BEGIN(LR_MODE); return E_QUAL_NONE;}
 	YY_BREAK
 case 49:
-#line 145 "parameters_flexer.ll"
+YY_RULE_SETUP
+#line 139 "parameters_flexer.ll"
+{ BEGIN(LR_MODE); return E_QUAL_SCF;}
+	YY_BREAK
 case 50:
 YY_RULE_SETUP
-#line 145 "parameters_flexer.ll"
-{ return MP_as_clip_ssahamerge_strictfrontclip;}
+#line 140 "parameters_flexer.ll"
+{ BEGIN(0); return MP_UNRECOGNISED_STRING;}
 	YY_BREAK
 case 51:
-#line 147 "parameters_flexer.ll"
+YY_RULE_SETUP
+#line 141 "parameters_flexer.ll"
+{ BEGIN(0); return MP_UNRECOGNISED_STRING;}
+	YY_BREAK
 case 52:
 YY_RULE_SETUP
-#line 147 "parameters_flexer.ll"
-{ return MP_as_clip_ssahamerge_strictendclip;}
+#line 142 "parameters_flexer.ll"
+{ BEGIN(0); return MP_UNRECOGNISED_STRING;}
 	YY_BREAK
 case 53:
-#line 149 "parameters_flexer.ll"
-case 54:
+/* rule 53 can match eol */
 YY_RULE_SETUP
-#line 149 "parameters_flexer.ll"
-{ return MP_as_clip_ssahamerge_gapsize;}
+#line 143 "parameters_flexer.ll"
+{ BEGIN(0); return MP_UNRECOGNISED_STRING;}
 	YY_BREAK
+case 54:
+#line 145 "parameters_flexer.ll"
 case 55:
-#line 151 "parameters_flexer.ll"
-case 56:
 YY_RULE_SETUP
-#line 151 "parameters_flexer.ll"
-{ return MP_as_clip_ssahamerge_maxfrontgap;}
+#line 145 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_discard_read_on_eq_error;}
 	YY_BREAK
+case 56:
+#line 147 "parameters_flexer.ll"
 case 57:
-#line 153 "parameters_flexer.ll"
-case 58:
 YY_RULE_SETUP
-#line 153 "parameters_flexer.ll"
-{ return MP_as_clip_ssahamerge_maxendgap;}
+#line 147 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_filecheck_only;}
 	YY_BREAK
+case 58:
+#line 149 "parameters_flexer.ll"
 case 59:
-#line 155 "parameters_flexer.ll"
-case 60:
 YY_RULE_SETUP
-#line 155 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_clip_possible_vectors;}
+#line 149 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_merge_xmltraceinfo;}
 	YY_BREAK
+case 60:
+#line 151 "parameters_flexer.ll"
 case 61:
-#line 157 "parameters_flexer.ll"
+YY_RULE_SETUP
+#line 151 "parameters_flexer.ll"
+{ BEGIN(LR_RNSMODE); return MP_as_readnaming_scheme;}
+	YY_BREAK
 case 62:
 YY_RULE_SETUP
-#line 157 "parameters_flexer.ll"
-{ return MP_as_clip_vector_maxlenallowed;}
+#line 152 "parameters_flexer.ll"
+{ BEGIN(LR_MODE); return SCHEME_SANGER;}
 	YY_BREAK
 case 63:
-#line 159 "parameters_flexer.ll"
+YY_RULE_SETUP
+#line 153 "parameters_flexer.ll"
+{ BEGIN(LR_MODE); return SCHEME_TIGR;}
+	YY_BREAK
 case 64:
 YY_RULE_SETUP
-#line 159 "parameters_flexer.ll"
-{ return MP_as_clip_badstretchquality_minqual;}
+#line 154 "parameters_flexer.ll"
+{ BEGIN(LR_MODE); return SCHEME_FR;}
 	YY_BREAK
 case 65:
-#line 161 "parameters_flexer.ll"
+YY_RULE_SETUP
+#line 155 "parameters_flexer.ll"
+{ BEGIN(LR_MODE); return SCHEME_FR;}
+	YY_BREAK
 case 66:
 YY_RULE_SETUP
-#line 161 "parameters_flexer.ll"
-{ return MP_as_clip_badstretchquality_winlen;}
+#line 156 "parameters_flexer.ll"
+{ BEGIN(LR_MODE); return SCHEME_STLOUIS;}
 	YY_BREAK
 case 67:
-#line 163 "parameters_flexer.ll"
+YY_RULE_SETUP
+#line 157 "parameters_flexer.ll"
+{ BEGIN(LR_MODE); return SCHEME_SOLEXA;}
+	YY_BREAK
 case 68:
 YY_RULE_SETUP
-#line 163 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_clip_badstretchquality;}
+#line 158 "parameters_flexer.ll"
+{ BEGIN(0); return MP_UNRECOGNISED_STRING;}
 	YY_BREAK
 case 69:
-#line 165 "parameters_flexer.ll"
+YY_RULE_SETUP
+#line 159 "parameters_flexer.ll"
+{ BEGIN(0); return MP_UNRECOGNISED_STRING;}
+	YY_BREAK
 case 70:
 YY_RULE_SETUP
-#line 165 "parameters_flexer.ll"
-{ return MP_as_clip_quality_minqual;}
+#line 160 "parameters_flexer.ll"
+{ BEGIN(0); return MP_UNRECOGNISED_STRING;}
 	YY_BREAK
 case 71:
-#line 167 "parameters_flexer.ll"
-case 72:
+/* rule 71 can match eol */
 YY_RULE_SETUP
-#line 167 "parameters_flexer.ll"
-{ return MP_as_clip_quality_winlen;}
+#line 161 "parameters_flexer.ll"
+{ BEGIN(0); return MP_UNRECOGNISED_STRING;}
 	YY_BREAK
+case 72:
+#line 165 "parameters_flexer.ll"
 case 73:
-#line 169 "parameters_flexer.ll"
-case 74:
 YY_RULE_SETUP
-#line 169 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_clip_quality;}
+#line 165 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_loadstraindata;}
 	YY_BREAK
+case 74:
+#line 167 "parameters_flexer.ll"
 case 75:
-#line 171 "parameters_flexer.ll"
+YY_RULE_SETUP
+#line 167 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_assign_defaultstrain;}
+	YY_BREAK
 case 76:
+#line 169 "parameters_flexer.ll"
+case 77:
+YY_RULE_SETUP
+#line 169 "parameters_flexer.ll"
+{ filenameid=MP_as_default_strainname; yy_push_state(FN_MODE);}
+	YY_BREAK
+case 78:
+#line 171 "parameters_flexer.ll"
+case 79:
 YY_RULE_SETUP
 #line 171 "parameters_flexer.ll"
-{ return MP_as_clip_maskedbases_gapsize;}
+{ yy_push_state(ASK_YN_MODE); return MP_as_loadbackbone;}
 	YY_BREAK
-case 77:
+case 80:
 #line 173 "parameters_flexer.ll"
-case 78:
+case 81:
 YY_RULE_SETUP
 #line 173 "parameters_flexer.ll"
-{ return MP_as_clip_maskedbases_maxfrontgap;}
+{ filenameid=MP_as_backbone_loadjob; yy_push_state(FN_MODE);}
 	YY_BREAK
-case 79:
+case 82:
 #line 175 "parameters_flexer.ll"
-case 80:
+case 83:
 YY_RULE_SETUP
 #line 175 "parameters_flexer.ll"
-{ return MP_as_clip_maskedbases_maxendgap;}
+{ return MP_as_backbone_raillength;}
 	YY_BREAK
-case 81:
+case 84:
 #line 177 "parameters_flexer.ll"
-case 82:
+case 85:
 YY_RULE_SETUP
 #line 177 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_clip_maskedbases;}
+{ return MP_as_backbone_railoverlap;}
 	YY_BREAK
-case 83:
+case 86:
 #line 179 "parameters_flexer.ll"
-case 84:
+case 87:
 YY_RULE_SETUP
 #line 179 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_clip_lowercase_front;}
+{ filenameid=MP_as_backbone_rail_fromstrain; yy_push_state(FN_MODE);}
 	YY_BREAK
-case 85:
+case 88:
 #line 181 "parameters_flexer.ll"
-case 86:
+case 89:
 YY_RULE_SETUP
 #line 181 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_clip_lowercase_back;}
+{ yy_push_state(ASK_YN_MODE); return MP_as_backbone_strainname_forceforall;}
 	YY_BREAK
-case 87:
+case 90:
 #line 183 "parameters_flexer.ll"
-case 88:
+case 91:
 YY_RULE_SETUP
 #line 183 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_clip_ensureminimumleftclip;}
+{ filenameid=MP_as_backbone_strainname; yy_push_state(FN_MODE);}
 	YY_BREAK
-case 89:
-#line 185 "parameters_flexer.ll"
-case 90:
-YY_RULE_SETUP
-#line 185 "parameters_flexer.ll"
-{ return MP_as_clip_minimumleftcliprequired;}
-	YY_BREAK
-case 91:
-#line 187 "parameters_flexer.ll"
 case 92:
-YY_RULE_SETUP
-#line 187 "parameters_flexer.ll"
-{ return MP_as_clip_setminimumleftclip;}
-	YY_BREAK
+#line 185 "parameters_flexer.ll"
 case 93:
 YY_RULE_SETUP
-#line 188 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_clip_ensureminimumrightclip;}
+#line 185 "parameters_flexer.ll"
+{ return MP_as_backbone_basequals;}
 	YY_BREAK
 case 94:
-#line 190 "parameters_flexer.ll"
+#line 187 "parameters_flexer.ll"
 case 95:
 YY_RULE_SETUP
-#line 190 "parameters_flexer.ll"
-{ return MP_as_clip_minimumrightcliprequired;}
+#line 187 "parameters_flexer.ll"
+{ return MP_as_startbackboneusage_inpass;}
 	YY_BREAK
 case 96:
-#line 192 "parameters_flexer.ll"
+#line 189 "parameters_flexer.ll"
 case 97:
 YY_RULE_SETUP
-#line 192 "parameters_flexer.ll"
-{ return MP_as_clip_setminimumrightclip;}
+#line 189 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_backbone_alsobuildnewcontigs;}
 	YY_BREAK
 case 98:
-#line 194 "parameters_flexer.ll"
+#line 193 "parameters_flexer.ll"
 case 99:
 YY_RULE_SETUP
-#line 194 "parameters_flexer.ll"
-{ return MP_as_clip_quality_numminthreshold;}
+#line 193 "parameters_flexer.ll"
+{ return MP_as_clip_ssahamerge_strictfrontclip;}
 	YY_BREAK
 case 100:
-#line 196 "parameters_flexer.ll"
+#line 195 "parameters_flexer.ll"
 case 101:
 YY_RULE_SETUP
-#line 196 "parameters_flexer.ll"
-{ return MP_as_clip_quality_minthreshold;}
+#line 195 "parameters_flexer.ll"
+{ return MP_as_clip_ssahamerge_strictendclip;}
 	YY_BREAK
 case 102:
-#line 199 "parameters_flexer.ll"
+#line 197 "parameters_flexer.ll"
 case 103:
 YY_RULE_SETUP
-#line 199 "parameters_flexer.ll"
-{yy_push_state(ASK_YN_MODE); return MP_as_clip_3ppolybase;}
+#line 197 "parameters_flexer.ll"
+{ return MP_as_clip_ssahamerge_gapsize;}
 	YY_BREAK
 case 104:
-#line 201 "parameters_flexer.ll"
+#line 199 "parameters_flexer.ll"
 case 105:
 YY_RULE_SETUP
-#line 201 "parameters_flexer.ll"
-{return MP_as_clip_3ppolybase_len;}
+#line 199 "parameters_flexer.ll"
+{ return MP_as_clip_ssahamerge_maxfrontgap;}
 	YY_BREAK
 case 106:
-#line 203 "parameters_flexer.ll"
+#line 201 "parameters_flexer.ll"
 case 107:
 YY_RULE_SETUP
-#line 203 "parameters_flexer.ll"
-{return MP_as_clip_3ppolybase_maxerrors;}
+#line 201 "parameters_flexer.ll"
+{ return MP_as_clip_ssahamerge_maxendgap;}
 	YY_BREAK
 case 108:
-#line 205 "parameters_flexer.ll"
+#line 203 "parameters_flexer.ll"
 case 109:
 YY_RULE_SETUP
-#line 205 "parameters_flexer.ll"
-{return MP_as_clip_3ppolybase_maxgap;}
+#line 203 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_clip_mergessahavectorscreen;}
 	YY_BREAK
 case 110:
-#line 208 "parameters_flexer.ll"
+#line 205 "parameters_flexer.ll"
 case 111:
 YY_RULE_SETUP
-#line 208 "parameters_flexer.ll"
-{yy_push_state(ASK_YN_MODE); return MP_as_clip_polyat;}
+#line 205 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_clip_possible_vectors;}
 	YY_BREAK
 case 112:
-#line 210 "parameters_flexer.ll"
+#line 207 "parameters_flexer.ll"
 case 113:
 YY_RULE_SETUP
-#line 210 "parameters_flexer.ll"
-{yy_push_state(ASK_YN_MODE); return MP_as_clip_polyat_keeppolystretch;}
+#line 207 "parameters_flexer.ll"
+{ return MP_as_clip_vector_maxlenallowed;}
 	YY_BREAK
 case 114:
-#line 212 "parameters_flexer.ll"
+#line 209 "parameters_flexer.ll"
 case 115:
 YY_RULE_SETUP
-#line 212 "parameters_flexer.ll"
-{return MP_as_clip_polyat_len;}
+#line 209 "parameters_flexer.ll"
+{ return MP_as_clip_badstretchquality_minqual;}
 	YY_BREAK
 case 116:
-#line 214 "parameters_flexer.ll"
+#line 211 "parameters_flexer.ll"
 case 117:
 YY_RULE_SETUP
-#line 214 "parameters_flexer.ll"
-{return MP_as_clip_polyat_maxerrors;}
+#line 211 "parameters_flexer.ll"
+{ return MP_as_clip_badstretchquality_winlen;}
 	YY_BREAK
 case 118:
-#line 216 "parameters_flexer.ll"
+#line 213 "parameters_flexer.ll"
 case 119:
 YY_RULE_SETUP
-#line 216 "parameters_flexer.ll"
-{return MP_as_clip_polyat_maxgap;}
+#line 213 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_clip_badstretchquality;}
 	YY_BREAK
 case 120:
-#line 219 "parameters_flexer.ll"
+#line 215 "parameters_flexer.ll"
 case 121:
 YY_RULE_SETUP
-#line 219 "parameters_flexer.ll"
-{ return MP_as_clip_pec_basesperhash;}
+#line 215 "parameters_flexer.ll"
+{ return MP_as_clip_quality_minqual;}
 	YY_BREAK
 case 122:
-#line 221 "parameters_flexer.ll"
+#line 217 "parameters_flexer.ll"
 case 123:
 YY_RULE_SETUP
-#line 221 "parameters_flexer.ll"
-{ return MP_ERROR_RENAMED_BPH_KMER;}
+#line 217 "parameters_flexer.ll"
+{ return MP_as_clip_quality_winlen;}
 	YY_BREAK
 case 124:
-#line 223 "parameters_flexer.ll"
+#line 219 "parameters_flexer.ll"
 case 125:
 YY_RULE_SETUP
-#line 223 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_clip_proposeendclips;}
+#line 219 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_clip_quality;}
 	YY_BREAK
 case 126:
-#line 225 "parameters_flexer.ll"
+#line 221 "parameters_flexer.ll"
 case 127:
 YY_RULE_SETUP
-#line 225 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_clip_pec_sxaggcxg;}
+#line 221 "parameters_flexer.ll"
+{ return MP_as_clip_maskedbases_gapsize;}
 	YY_BREAK
 case 128:
-YY_RULE_SETUP
-#line 226 "parameters_flexer.ll"
-{ return MP_as_clip_pec_ffreq;}
-	YY_BREAK
+#line 223 "parameters_flexer.ll"
 case 129:
 YY_RULE_SETUP
-#line 227 "parameters_flexer.ll"
-{ return MP_as_clip_pec_bfreq;}
+#line 223 "parameters_flexer.ll"
+{ return MP_as_clip_maskedbases_maxfrontgap;}
 	YY_BREAK
 case 130:
-#line 229 "parameters_flexer.ll"
+#line 225 "parameters_flexer.ll"
 case 131:
 YY_RULE_SETUP
-#line 229 "parameters_flexer.ll"
-{ return MP_as_clip_pec_mkfr;}
+#line 225 "parameters_flexer.ll"
+{ return MP_as_clip_maskedbases_maxendgap;}
 	YY_BREAK
 case 132:
-#line 231 "parameters_flexer.ll"
+#line 227 "parameters_flexer.ll"
 case 133:
 YY_RULE_SETUP
-#line 231 "parameters_flexer.ll"
-{ return MP_as_clip_pec_mtk;}
+#line 227 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_clip_maskedbases;}
 	YY_BREAK
 case 134:
-YY_RULE_SETUP
-#line 232 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_clip_pec_ffr;}
-	YY_BREAK
+#line 229 "parameters_flexer.ll"
 case 135:
 YY_RULE_SETUP
-#line 233 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_clip_pec_bfr;}
+#line 229 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_clip_lowercase;}
 	YY_BREAK
 case 136:
-YY_RULE_SETUP
-#line 234 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_clip_pec_fcmst;}
-	YY_BREAK
+#line 231 "parameters_flexer.ll"
 case 137:
 YY_RULE_SETUP
-#line 235 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_clip_pec_bcmst;}
+#line 231 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_clip_ensureminimumleftclip;}
 	YY_BREAK
 case 138:
-YY_RULE_SETUP
-#line 236 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_clip_pec_fsalp;}
-	YY_BREAK
+#line 233 "parameters_flexer.ll"
 case 139:
 YY_RULE_SETUP
-#line 237 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_clip_pec_bsalp;}
+#line 233 "parameters_flexer.ll"
+{ return MP_as_clip_minimumleftcliprequired;}
 	YY_BREAK
 case 140:
-#line 239 "parameters_flexer.ll"
+#line 235 "parameters_flexer.ll"
 case 141:
 YY_RULE_SETUP
-#line 239 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_clip_sdbg_chimeradetection;}
+#line 235 "parameters_flexer.ll"
+{ return MP_as_clip_setminimumleftclip;}
 	YY_BREAK
 case 142:
-#line 241 "parameters_flexer.ll"
-case 143:
 YY_RULE_SETUP
-#line 241 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_clip_kmer_junkdetection;}
+#line 236 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_clip_ensureminimumrightclip;}
 	YY_BREAK
+case 143:
+#line 238 "parameters_flexer.ll"
 case 144:
-#line 243 "parameters_flexer.ll"
-case 145:
 YY_RULE_SETUP
-#line 243 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_clip_kmer_junkkill;}
+#line 238 "parameters_flexer.ll"
+{ return MP_as_clip_minimumrightcliprequired;}
 	YY_BREAK
+case 145:
+#line 240 "parameters_flexer.ll"
 case 146:
-#line 245 "parameters_flexer.ll"
-case 147:
 YY_RULE_SETUP
-#line 245 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_clip_skimchimeradetection;}
+#line 240 "parameters_flexer.ll"
+{ return MP_as_clip_setminimumrightclip;}
 	YY_BREAK
+case 147:
+#line 242 "parameters_flexer.ll"
 case 148:
-#line 247 "parameters_flexer.ll"
+YY_RULE_SETUP
+#line 242 "parameters_flexer.ll"
+{ return MP_as_clip_quality_numminthreshold;}
+	YY_BREAK
 case 149:
+#line 244 "parameters_flexer.ll"
+case 150:
 YY_RULE_SETUP
+#line 244 "parameters_flexer.ll"
+{ return MP_as_clip_quality_minthreshold;}
+	YY_BREAK
+case 151:
 #line 247 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_clip_skimjunkdetection;}
+case 152:
+YY_RULE_SETUP
+#line 247 "parameters_flexer.ll"
+{yy_push_state(ASK_YN_MODE); return MP_as_clip_3ppolybase;}
 	YY_BREAK
-case 150:
+case 153:
 #line 249 "parameters_flexer.ll"
-case 151:
+case 154:
 YY_RULE_SETUP
 #line 249 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_clip_badsolexaends;}
+{return MP_as_clip_3ppolybase_len;}
 	YY_BREAK
-case 152:
+case 155:
 #line 251 "parameters_flexer.ll"
-case 153:
+case 156:
 YY_RULE_SETUP
 #line 251 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_search_phix174;}
+{return MP_as_clip_3ppolybase_maxerrors;}
 	YY_BREAK
-case 154:
+case 157:
 #line 253 "parameters_flexer.ll"
-case 155:
+case 158:
 YY_RULE_SETUP
 #line 253 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_filter_phix174;}
-	YY_BREAK
-case 156:
-#line 255 "parameters_flexer.ll"
-case 157:
-YY_RULE_SETUP
-#line 255 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_clip_knownadaptorsright;}
+{return MP_as_clip_3ppolybase_maxgap;}
 	YY_BREAK
-case 158:
-#line 257 "parameters_flexer.ll"
 case 159:
+#line 256 "parameters_flexer.ll"
+case 160:
 YY_RULE_SETUP
-#line 257 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_clipmask_rarekmers;}
+#line 256 "parameters_flexer.ll"
+{yy_push_state(ASK_YN_MODE); return MP_as_clip_polyat;}
 	YY_BREAK
-case 160:
-#line 263 "parameters_flexer.ll"
 case 161:
+#line 258 "parameters_flexer.ll"
+case 162:
 YY_RULE_SETUP
-#line 263 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_savesimplesingletsinproject;}
+#line 258 "parameters_flexer.ll"
+{yy_push_state(ASK_YN_MODE); return MP_as_clip_polyat_keeppolysignal;}
 	YY_BREAK
-case 162:
-#line 265 "parameters_flexer.ll"
 case 163:
+#line 260 "parameters_flexer.ll"
+case 164:
 YY_RULE_SETUP
-#line 265 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_savesimplesingletsinproject;}
+#line 260 "parameters_flexer.ll"
+{return MP_as_clip_polyat_len;}
 	YY_BREAK
-case 164:
-#line 267 "parameters_flexer.ll"
 case 165:
+#line 262 "parameters_flexer.ll"
+case 166:
 YY_RULE_SETUP
-#line 267 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_output_removerollovertmps;}
+#line 262 "parameters_flexer.ll"
+{return MP_as_clip_polyat_maxerrors;}
 	YY_BREAK
-case 166:
-#line 269 "parameters_flexer.ll"
 case 167:
+#line 264 "parameters_flexer.ll"
+case 168:
 YY_RULE_SETUP
-#line 269 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_output_removetmpdir;}
+#line 264 "parameters_flexer.ll"
+{return MP_as_clip_polyat_maxgap;}
 	YY_BREAK
-case 168:
-#line 272 "parameters_flexer.ll"
 case 169:
+#line 267 "parameters_flexer.ll"
+case 170:
 YY_RULE_SETUP
-#line 272 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_output_tmp_html;}
+#line 267 "parameters_flexer.ll"
+{ return MP_as_clip_pec_basesperhash;}
 	YY_BREAK
-case 170:
-#line 274 "parameters_flexer.ll"
 case 171:
+#line 269 "parameters_flexer.ll"
+case 172:
 YY_RULE_SETUP
-#line 274 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_output_tmp_text;}
+#line 269 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_clip_proposeendclips;}
 	YY_BREAK
-case 172:
-#line 276 "parameters_flexer.ll"
 case 173:
+#line 271 "parameters_flexer.ll"
+case 174:
 YY_RULE_SETUP
-#line 276 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_output_tmp_tcs;}
+#line 271 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_clip_pec_sxaggcxg;}
 	YY_BREAK
-case 174:
-#line 278 "parameters_flexer.ll"
 case 175:
+#line 273 "parameters_flexer.ll"
+case 176:
 YY_RULE_SETUP
-#line 278 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_output_tmp_caf;}
+#line 273 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_clip_skimchimeradetection;}
 	YY_BREAK
-case 176:
-#line 280 "parameters_flexer.ll"
 case 177:
+#line 275 "parameters_flexer.ll"
+case 178:
 YY_RULE_SETUP
-#line 280 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_output_tmp_maf;}
+#line 275 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_clip_skimjunkdetection;}
 	YY_BREAK
-case 178:
-#line 282 "parameters_flexer.ll"
 case 179:
+#line 277 "parameters_flexer.ll"
+case 180:
 YY_RULE_SETUP
-#line 282 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_output_tmp_ace;}
+#line 277 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_clip_badsolexaends;}
 	YY_BREAK
-case 180:
-#line 284 "parameters_flexer.ll"
 case 181:
+#line 279 "parameters_flexer.ll"
+case 182:
 YY_RULE_SETUP
-#line 284 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_output_tmp_gap4da;}
+#line 279 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_clip_knownadaptorsright;}
 	YY_BREAK
-case 182:
-#line 286 "parameters_flexer.ll"
 case 183:
+#line 285 "parameters_flexer.ll"
+case 184:
 YY_RULE_SETUP
-#line 286 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_output_tmp_fasta;}
+#line 285 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_savesimplesingletsinproject;}
 	YY_BREAK
-case 184:
-#line 289 "parameters_flexer.ll"
 case 185:
+#line 287 "parameters_flexer.ll"
+case 186:
 YY_RULE_SETUP
-#line 289 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_output_exttmp_alsosinglets;}
+#line 287 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_savesimplesingletsinproject;}
 	YY_BREAK
-case 186:
-#line 291 "parameters_flexer.ll"
 case 187:
+#line 289 "parameters_flexer.ll"
+case 188:
 YY_RULE_SETUP
-#line 291 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_output_exttmp_html;}
+#line 289 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_output_removerollovertmps;}
 	YY_BREAK
-case 188:
-#line 293 "parameters_flexer.ll"
 case 189:
+#line 291 "parameters_flexer.ll"
+case 190:
 YY_RULE_SETUP
-#line 293 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_output_exttmp_caf;}
+#line 291 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_output_removetmpdir;}
 	YY_BREAK
-case 190:
-#line 295 "parameters_flexer.ll"
 case 191:
+#line 294 "parameters_flexer.ll"
+case 192:
 YY_RULE_SETUP
-#line 295 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_output_exttmp_ace;}
+#line 294 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_output_tmp_html;}
 	YY_BREAK
-case 192:
-#line 297 "parameters_flexer.ll"
 case 193:
+#line 296 "parameters_flexer.ll"
+case 194:
 YY_RULE_SETUP
-#line 297 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_output_exttmp_gap4da;}
+#line 296 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_output_tmp_text;}
 	YY_BREAK
-case 194:
-#line 299 "parameters_flexer.ll"
 case 195:
+#line 298 "parameters_flexer.ll"
+case 196:
 YY_RULE_SETUP
-#line 299 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_output_exttmp_fasta;}
+#line 298 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_output_tmp_tcs;}
 	YY_BREAK
-case 196:
-#line 302 "parameters_flexer.ll"
 case 197:
+#line 300 "parameters_flexer.ll"
+case 198:
+YY_RULE_SETUP
+#line 300 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_output_tmp_caf;}
+	YY_BREAK
+case 199:
+#line 302 "parameters_flexer.ll"
+case 200:
 YY_RULE_SETUP
 #line 302 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_output_caf;}
+{ yy_push_state(ASK_YN_MODE); return MP_as_output_tmp_maf;}
 	YY_BREAK
-case 198:
+case 201:
 #line 304 "parameters_flexer.ll"
-case 199:
+case 202:
 YY_RULE_SETUP
 #line 304 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_output_maf;}
+{ yy_push_state(ASK_YN_MODE); return MP_as_output_tmp_ace;}
 	YY_BREAK
-case 200:
+case 203:
 #line 306 "parameters_flexer.ll"
-case 201:
+case 204:
 YY_RULE_SETUP
 #line 306 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_output_html;}
+{ yy_push_state(ASK_YN_MODE); return MP_as_output_tmp_gap4da;}
 	YY_BREAK
-case 202:
+case 205:
 #line 308 "parameters_flexer.ll"
-case 203:
+case 206:
 YY_RULE_SETUP
 #line 308 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_output_text;}
-	YY_BREAK
-case 204:
-#line 310 "parameters_flexer.ll"
-case 205:
-YY_RULE_SETUP
-#line 310 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_output_ace;}
+{ yy_push_state(ASK_YN_MODE); return MP_as_output_tmp_fasta;}
 	YY_BREAK
-case 206:
-#line 312 "parameters_flexer.ll"
 case 207:
-YY_RULE_SETUP
-#line 312 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_output_wiggle;}
-	YY_BREAK
+#line 311 "parameters_flexer.ll"
 case 208:
-#line 314 "parameters_flexer.ll"
-case 209:
 YY_RULE_SETUP
-#line 314 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_output_tcs;}
+#line 311 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_output_exttmp_alsosinglets;}
 	YY_BREAK
+case 209:
+#line 313 "parameters_flexer.ll"
 case 210:
-#line 316 "parameters_flexer.ll"
-case 211:
 YY_RULE_SETUP
-#line 316 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_output_gff3;}
+#line 313 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_output_exttmp_html;}
 	YY_BREAK
+case 211:
+#line 315 "parameters_flexer.ll"
 case 212:
-#line 318 "parameters_flexer.ll"
-case 213:
 YY_RULE_SETUP
-#line 318 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_output_gap4da;}
+#line 315 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_output_exttmp_caf;}
 	YY_BREAK
+case 213:
+#line 317 "parameters_flexer.ll"
 case 214:
-#line 320 "parameters_flexer.ll"
-case 215:
 YY_RULE_SETUP
-#line 320 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_output_fasta;}
+#line 317 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_output_exttmp_ace;}
 	YY_BREAK
+case 215:
+#line 319 "parameters_flexer.ll"
 case 216:
-#line 323 "parameters_flexer.ll"
-case 217:
 YY_RULE_SETUP
-#line 323 "parameters_flexer.ll"
-{ return MP_con_output_html_cpl;}
+#line 319 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_output_exttmp_gap4da;}
 	YY_BREAK
+case 217:
+#line 321 "parameters_flexer.ll"
 case 218:
-#line 325 "parameters_flexer.ll"
-case 219:
 YY_RULE_SETUP
-#line 325 "parameters_flexer.ll"
-{ return MP_con_output_text_cpl;}
+#line 321 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_output_exttmp_fasta;}
 	YY_BREAK
+case 219:
+#line 324 "parameters_flexer.ll"
 case 220:
-#line 327 "parameters_flexer.ll"
-case 221:
 YY_RULE_SETUP
-#line 327 "parameters_flexer.ll"
-{ singlechar_id=MP_con_output_html_gapfill; yy_push_state(GET_SINGLECHAR_STRING_MODE);}
+#line 324 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_output_caf;}
 	YY_BREAK
+case 221:
+#line 326 "parameters_flexer.ll"
 case 222:
-#line 329 "parameters_flexer.ll"
-case 223:
 YY_RULE_SETUP
-#line 329 "parameters_flexer.ll"
-{ singlechar_id=MP_con_output_text_gapfill;yy_push_state(GET_SINGLECHAR_STRING_MODE);}
+#line 326 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_output_maf;}
 	YY_BREAK
+case 223:
+#line 328 "parameters_flexer.ll"
 case 224:
 YY_RULE_SETUP
-#line 331 "parameters_flexer.ll"
-
+#line 328 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_output_html;}
 	YY_BREAK
 case 225:
-YY_RULE_SETUP
-#line 332 "parameters_flexer.ll"
-{yy_pop_state(); return singlechar_id;}
-	YY_BREAK
+#line 330 "parameters_flexer.ll"
 case 226:
 YY_RULE_SETUP
-#line 333 "parameters_flexer.ll"
-{yy_pop_state(); return singlechar_id;}
+#line 330 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_output_text;}
 	YY_BREAK
 case 227:
-YY_RULE_SETUP
-#line 334 "parameters_flexer.ll"
-
-	YY_BREAK
+#line 332 "parameters_flexer.ll"
 case 228:
 YY_RULE_SETUP
-#line 335 "parameters_flexer.ll"
-{yy_pop_state(); return singlechar_id;}
+#line 332 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_output_ace;}
 	YY_BREAK
 case 229:
-YY_RULE_SETUP
-#line 338 "parameters_flexer.ll"
-{yy_pop_state(); return 1;}
-	YY_BREAK
+#line 334 "parameters_flexer.ll"
 case 230:
 YY_RULE_SETUP
-#line 339 "parameters_flexer.ll"
-{yy_pop_state(); return 0;}
+#line 334 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_output_wiggle;}
 	YY_BREAK
 case 231:
-YY_RULE_SETUP
-#line 340 "parameters_flexer.ll"
-{yy_pop_state(); return 1;}
-	YY_BREAK
+#line 336 "parameters_flexer.ll"
 case 232:
 YY_RULE_SETUP
-#line 341 "parameters_flexer.ll"
-{yy_pop_state(); return 0;}
+#line 336 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_output_tcs;}
 	YY_BREAK
 case 233:
-YY_RULE_SETUP
-#line 342 "parameters_flexer.ll"
-{yy_pop_state(); return 1;}
-	YY_BREAK
+#line 338 "parameters_flexer.ll"
 case 234:
 YY_RULE_SETUP
-#line 343 "parameters_flexer.ll"
-{yy_pop_state(); return 0;}
+#line 338 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_output_gff3;}
 	YY_BREAK
 case 235:
-YY_RULE_SETUP
-#line 344 "parameters_flexer.ll"
-{yy_pop_state(); return 1;}
-	YY_BREAK
+#line 340 "parameters_flexer.ll"
 case 236:
 YY_RULE_SETUP
-#line 345 "parameters_flexer.ll"
-{yy_pop_state(); return 0;}
+#line 340 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_output_gap4da;}
 	YY_BREAK
 case 237:
-YY_RULE_SETUP
-#line 346 "parameters_flexer.ll"
-{}
-	YY_BREAK
+#line 342 "parameters_flexer.ll"
 case 238:
 YY_RULE_SETUP
-#line 347 "parameters_flexer.ll"
-{yy_pop_state(); return MP_UNRECOGNISED_STRING;}
+#line 342 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_output_fasta;}
 	YY_BREAK
 case 239:
-#line 350 "parameters_flexer.ll"
+#line 345 "parameters_flexer.ll"
 case 240:
 YY_RULE_SETUP
-#line 350 "parameters_flexer.ll"
-{filenameid=MP_dir_tmp_redirectedto; yy_push_state(FN_MODE); }
+#line 345 "parameters_flexer.ll"
+{ return MP_con_output_html_cpl;}
 	YY_BREAK
 case 241:
-YY_RULE_SETUP
-#line 351 "parameters_flexer.ll"
-{filenameid=MP_dir_tmp; yy_push_state(FN_MODE); }
-	YY_BREAK
+#line 347 "parameters_flexer.ll"
 case 242:
 YY_RULE_SETUP
-#line 353 "parameters_flexer.ll"
-{ yy_pop_state(); return filenameid;}
+#line 347 "parameters_flexer.ll"
+{ return MP_con_output_text_cpl;}
 	YY_BREAK
 case 243:
-#line 357 "parameters_flexer.ll"
+#line 349 "parameters_flexer.ll"
 case 244:
 YY_RULE_SETUP
-#line 357 "parameters_flexer.ll"
-{ return MP_as_minimum_readlength;}
+#line 349 "parameters_flexer.ll"
+{ singlechar_id=MP_con_output_html_gapfill; yy_push_state(GET_SINGLECHAR_STRING_MODE);}
 	YY_BREAK
 case 245:
-#line 359 "parameters_flexer.ll"
+#line 351 "parameters_flexer.ll"
 case 246:
 YY_RULE_SETUP
-#line 359 "parameters_flexer.ll"
-{ return MP_as_minimum_readspercontig;}
+#line 351 "parameters_flexer.ll"
+{ singlechar_id=MP_con_output_text_gapfill;yy_push_state(GET_SINGLECHAR_STRING_MODE);}
 	YY_BREAK
 case 247:
-#line 361 "parameters_flexer.ll"
+YY_RULE_SETUP
+#line 353 "parameters_flexer.ll"
+
+	YY_BREAK
 case 248:
 YY_RULE_SETUP
-#line 361 "parameters_flexer.ll"
-{ return(MP_as_numpasses);}
+#line 354 "parameters_flexer.ll"
+{yy_pop_state(); return singlechar_id;}
 	YY_BREAK
 case 249:
-#line 363 "parameters_flexer.ll"
+YY_RULE_SETUP
+#line 355 "parameters_flexer.ll"
+{yy_pop_state(); return singlechar_id;}
+	YY_BREAK
 case 250:
 YY_RULE_SETUP
-#line 363 "parameters_flexer.ll"
-{ yy_push_state(CSV_NUMBERS_MODE); return MP_as_kmerseries;}
+#line 356 "parameters_flexer.ll"
+
 	YY_BREAK
 case 251:
-#line 365 "parameters_flexer.ll"
+YY_RULE_SETUP
+#line 357 "parameters_flexer.ll"
+{yy_pop_state(); return singlechar_id;}
+	YY_BREAK
 case 252:
 YY_RULE_SETUP
-#line 365 "parameters_flexer.ll"
-{ return MP_ERROR_REMOVED;}
+#line 360 "parameters_flexer.ll"
+{yy_pop_state(); return 1;}
 	YY_BREAK
 case 253:
-#line 367 "parameters_flexer.ll"
+YY_RULE_SETUP
+#line 361 "parameters_flexer.ll"
+{yy_pop_state(); return 0;}
+	YY_BREAK
 case 254:
 YY_RULE_SETUP
-#line 367 "parameters_flexer.ll"
-{ return MP_as_numrmbbreakloops;}
+#line 362 "parameters_flexer.ll"
+{yy_pop_state(); return 1;}
 	YY_BREAK
 case 255:
-#line 369 "parameters_flexer.ll"
+YY_RULE_SETUP
+#line 363 "parameters_flexer.ll"
+{yy_pop_state(); return 0;}
+	YY_BREAK
 case 256:
 YY_RULE_SETUP
-#line 369 "parameters_flexer.ll"
-{ return MP_as_maxcontigsperpass;}
+#line 364 "parameters_flexer.ll"
+{yy_pop_state(); return 1;}
 	YY_BREAK
 case 257:
-#line 371 "parameters_flexer.ll"
+YY_RULE_SETUP
+#line 365 "parameters_flexer.ll"
+{yy_pop_state(); return 0;}
+	YY_BREAK
 case 258:
 YY_RULE_SETUP
-#line 371 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_spoiler_detection;}
+#line 366 "parameters_flexer.ll"
+{yy_pop_state(); return 1;}
 	YY_BREAK
 case 259:
-#line 373 "parameters_flexer.ll"
+YY_RULE_SETUP
+#line 367 "parameters_flexer.ll"
+{yy_pop_state(); return 0;}
+	YY_BREAK
 case 260:
 YY_RULE_SETUP
-#line 373 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_sd_lastpassonly;}
+#line 368 "parameters_flexer.ll"
+{yy_pop_state(); return MP_UNRECOGNISED_STRING;}
 	YY_BREAK
 case 261:
-#line 375 "parameters_flexer.ll"
+YY_RULE_SETUP
+#line 369 "parameters_flexer.ll"
+{yy_pop_state(); return MP_UNRECOGNISED_STRING;}
+	YY_BREAK
 case 262:
 YY_RULE_SETUP
-#line 375 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return(MP_as_rle_reads);}
+#line 370 "parameters_flexer.ll"
+{yy_pop_state(); return MP_UNRECOGNISED_STRING;}
 	YY_BREAK
 case 263:
-#line 377 "parameters_flexer.ll"
+/* rule 263 can match eol */
+YY_RULE_SETUP
+#line 371 "parameters_flexer.ll"
+{yy_pop_state(); return MP_UNRECOGNISED_STRING;}
+	YY_BREAK
 case 264:
 YY_RULE_SETUP
-#line 377 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_automatic_repeat_detection;}
+#line 373 "parameters_flexer.ll"
+{filenameid=MP_dir_gap4da; yy_push_state(FN_MODE); }
 	YY_BREAK
 case 265:
-#line 379 "parameters_flexer.ll"
+#line 375 "parameters_flexer.ll"
 case 266:
 YY_RULE_SETUP
-#line 379 "parameters_flexer.ll"
-{ return MP_as_ard_multicopythreshold;}
+#line 375 "parameters_flexer.ll"
+{filenameid=MP_dir_tmp_redirectedto; yy_push_state(FN_MODE); }
 	YY_BREAK
 case 267:
-#line 381 "parameters_flexer.ll"
+YY_RULE_SETUP
+#line 376 "parameters_flexer.ll"
+{filenameid=MP_dir_cwd; yy_push_state(FN_MODE); }
+	YY_BREAK
 case 268:
 YY_RULE_SETUP
-#line 381 "parameters_flexer.ll"
-{ return MP_as_ard_multicopyminlen;}
+#line 377 "parameters_flexer.ll"
+{filenameid=MP_dir_tmp; yy_push_state(FN_MODE); }
 	YY_BREAK
 case 269:
-#line 383 "parameters_flexer.ll"
+YY_RULE_SETUP
+#line 378 "parameters_flexer.ll"
+{filenameid=MP_dir_exp; yy_push_state(FN_MODE); }
+	YY_BREAK
 case 270:
 YY_RULE_SETUP
-#line 383 "parameters_flexer.ll"
-{ return MP_as_ard_multicopygrace;}
+#line 379 "parameters_flexer.ll"
+{filenameid=MP_dir_scf; yy_push_state(FN_MODE); }
 	YY_BREAK
 case 271:
-#line 385 "parameters_flexer.ll"
+YY_RULE_SETUP
+#line 380 "parameters_flexer.ll"
+{filenameid=MP_dir_fasta; yy_push_state(FN_MODE); }
+	YY_BREAK
 case 272:
+#line 383 "parameters_flexer.ll"
+case 273:
 YY_RULE_SETUP
+#line 383 "parameters_flexer.ll"
+{ filenameid=MP_fn_cafin; yy_push_state(FN_MODE); }
+	YY_BREAK
+case 274:
 #line 385 "parameters_flexer.ll"
-{ return MP_as_urd_cutoffmultiplier;}
+case 275:
+YY_RULE_SETUP
+#line 385 "parameters_flexer.ll"
+{ filenameid=MP_fn_cafout; yy_push_state(FN_MODE); }
 	YY_BREAK
-case 273:
+case 276:
 #line 387 "parameters_flexer.ll"
-case 274:
+case 277:
 YY_RULE_SETUP
 #line 387 "parameters_flexer.ll"
-{ return MP_as_urd_startinpass;}
+{ filenameid=MP_fn_fofnexpin; yy_push_state(FN_MODE); }
 	YY_BREAK
-case 275:
+case 278:
 #line 389 "parameters_flexer.ll"
-case 276:
+case 279:
 YY_RULE_SETUP
 #line 389 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_uniform_read_distribution;}
+{ filenameid=MP_fn_fofnphdin; yy_push_state(FN_MODE); }
 	YY_BREAK
-case 277:
+case 280:
 #line 391 "parameters_flexer.ll"
-case 278:
+case 281:
 YY_RULE_SETUP
 #line 391 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_paf_use_genomic_pathfinder;}
+{ filenameid=MP_fn_phdin; yy_push_state(FN_MODE); }
 	YY_BREAK
-case 279:
+case 282:
 #line 393 "parameters_flexer.ll"
-case 280:
+case 283:
 YY_RULE_SETUP
 #line 393 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_paf_use_emergency_search_stop;}
+{ filenameid=MP_fn_fastqin; yy_push_state(FN_MODE); }
 	YY_BREAK
-case 281:
+case 284:
 #line 395 "parameters_flexer.ll"
-case 282:
+case 285:
 YY_RULE_SETUP
 #line 395 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_paf_use_emergency_blacklist;}
+{ filenameid=MP_fn_fastain; yy_push_state(FN_MODE); }
 	YY_BREAK
-case 283:
+case 286:
 #line 397 "parameters_flexer.ll"
-case 284:
+case 287:
 YY_RULE_SETUP
 #line 397 "parameters_flexer.ll"
-{return MP_paf_ess_partnerdepth;}
+{ filenameid=MP_fn_fastaqualin; yy_push_state(FN_MODE); }
 	YY_BREAK
-case 285:
+case 288:
 #line 399 "parameters_flexer.ll"
-case 286:
+case 289:
 YY_RULE_SETUP
 #line 399 "parameters_flexer.ll"
-{yy_push_state(ASK_YN_MODE); return MP_paf_use_max_contig_buildtime;}
+{ filenameid=MP_fn_straindatain; yy_push_state(FN_MODE); }
 	YY_BREAK
-case 287:
-#line 401 "parameters_flexer.ll"
-case 288:
-YY_RULE_SETUP
-#line 401 "parameters_flexer.ll"
-{return MP_paf_buildtime_inseconds;}
-	YY_BREAK
-case 289:
-#line 403 "parameters_flexer.ll"
 case 290:
-YY_RULE_SETUP
-#line 403 "parameters_flexer.ll"
-{yy_push_state(ASK_YN_MODE); return MP_as_enforce_qualsinreads;}
-	YY_BREAK
+#line 401 "parameters_flexer.ll"
 case 291:
 YY_RULE_SETUP
-#line 405 "parameters_flexer.ll"
-{ yy_pop_state(); return filenameid;}
+#line 401 "parameters_flexer.ll"
+{ filenameid=MP_fn_xmltraceinfoin; yy_push_state(FN_MODE); }
 	YY_BREAK
 case 292:
-#line 408 "parameters_flexer.ll"
+#line 403 "parameters_flexer.ll"
 case 293:
 YY_RULE_SETUP
-#line 408 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_extend_reads;}
+#line 403 "parameters_flexer.ll"
+{ filenameid=MP_fn_ssahavectorscreenin; yy_push_state(FN_MODE); }
 	YY_BREAK
 case 294:
-#line 410 "parameters_flexer.ll"
+#line 405 "parameters_flexer.ll"
 case 295:
 YY_RULE_SETUP
-#line 410 "parameters_flexer.ll"
-{return MP_as_readextension_window_len;}
+#line 405 "parameters_flexer.ll"
+{ filenameid=MP_fn_smaltvectorscreenin; yy_push_state(FN_MODE); }
 	YY_BREAK
 case 296:
-#line 412 "parameters_flexer.ll"
+#line 407 "parameters_flexer.ll"
 case 297:
 YY_RULE_SETUP
-#line 412 "parameters_flexer.ll"
-{return MP_as_readextension_window_maxerrors;}
+#line 407 "parameters_flexer.ll"
+{ filenameid=MP_fn_backbonein; yy_push_state(FN_MODE); }
 	YY_BREAK
 case 298:
-#line 414 "parameters_flexer.ll"
-case 299:
 YY_RULE_SETUP
-#line 414 "parameters_flexer.ll"
-{return MP_as_readextension_firstpassnum;}
+#line 409 "parameters_flexer.ll"
+{ yy_pop_state(); return filenameid;}
 	YY_BREAK
+case 299:
+#line 413 "parameters_flexer.ll"
 case 300:
-#line 416 "parameters_flexer.ll"
-case 301:
 YY_RULE_SETUP
-#line 416 "parameters_flexer.ll"
-{return MP_as_readextension_lastpassnum;}
+#line 413 "parameters_flexer.ll"
+{ return MP_as_minimum_readlength;}
 	YY_BREAK
+case 301:
+#line 415 "parameters_flexer.ll"
 case 302:
-#line 420 "parameters_flexer.ll"
-case 303:
 YY_RULE_SETUP
-#line 420 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_ed_sdbg_readedit;}
+#line 415 "parameters_flexer.ll"
+{ return MP_as_minimum_readspercontig;}
 	YY_BREAK
+case 303:
+#line 417 "parameters_flexer.ll"
 case 304:
-#line 422 "parameters_flexer.ll"
-case 305:
 YY_RULE_SETUP
-#line 422 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_ed_mira_automatic_contig_editing;}
+#line 417 "parameters_flexer.ll"
+{ return(MP_as_numpasses);}
 	YY_BREAK
+case 305:
+#line 419 "parameters_flexer.ll"
 case 306:
 YY_RULE_SETUP
-#line 423 "parameters_flexer.ll"
-
+#line 419 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return(MP_as_skimeachpass);}
 	YY_BREAK
 case 307:
-YY_RULE_SETUP
-#line 424 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_ed_kmer_singlets;}
-	YY_BREAK
+#line 421 "parameters_flexer.ll"
 case 308:
 YY_RULE_SETUP
-#line 425 "parameters_flexer.ll"
-
+#line 421 "parameters_flexer.ll"
+{ return MP_as_numrmbbreakloops;}
 	YY_BREAK
 case 309:
-YY_RULE_SETUP
-#line 426 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_ed_homopolymer_overcalls;}
-	YY_BREAK
+#line 423 "parameters_flexer.ll"
 case 310:
-#line 429 "parameters_flexer.ll"
-case 311:
 YY_RULE_SETUP
-#line 429 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_ed_edit_automatic_contig_editing;}
+#line 423 "parameters_flexer.ll"
+{ return MP_as_maxcontigsperpass;}
 	YY_BREAK
+case 311:
+#line 425 "parameters_flexer.ll"
 case 312:
-#line 431 "parameters_flexer.ll"
-case 313:
 YY_RULE_SETUP
-#line 431 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_ed_strict;}
+#line 425 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_spoiler_detection;}
 	YY_BREAK
+case 313:
+#line 427 "parameters_flexer.ll"
 case 314:
-#line 433 "parameters_flexer.ll"
-case 315:
 YY_RULE_SETUP
-#line 433 "parameters_flexer.ll"
-{ return MP_ed_confirmation_threshold;}
+#line 427 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_sd_lastpassonly;}
 	YY_BREAK
+case 315:
+#line 429 "parameters_flexer.ll"
 case 316:
-#line 436 "parameters_flexer.ll"
-case 317:
 YY_RULE_SETUP
-#line 436 "parameters_flexer.ll"
-{return MP_sk_numthreads;}
+#line 429 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_automatic_repeat_detection;}
 	YY_BREAK
+case 317:
+#line 431 "parameters_flexer.ll"
 case 318:
 YY_RULE_SETUP
-#line 437 "parameters_flexer.ll"
-{return MP_sk_bph_max;}
+#line 431 "parameters_flexer.ll"
+{ return MP_as_ard_multicopythreshold;}
 	YY_BREAK
 case 319:
+#line 433 "parameters_flexer.ll"
+case 320:
 YY_RULE_SETUP
-#line 438 "parameters_flexer.ll"
-{return MP_sk_bph_increasestep;}
+#line 433 "parameters_flexer.ll"
+{ return MP_as_ard_multicopyminlen;}
 	YY_BREAK
-case 320:
-#line 440 "parameters_flexer.ll"
 case 321:
+#line 435 "parameters_flexer.ll"
+case 322:
 YY_RULE_SETUP
-#line 440 "parameters_flexer.ll"
-{ return MP_ERROR_RENAMED_BPH_KMER;}
+#line 435 "parameters_flexer.ll"
+{ return MP_as_ard_multicopygrace;}
 	YY_BREAK
-case 322:
-#line 442 "parameters_flexer.ll"
 case 323:
+#line 437 "parameters_flexer.ll"
+case 324:
 YY_RULE_SETUP
-#line 442 "parameters_flexer.ll"
-{return MP_ERROR_RENAMED_BPH_KMER;}
+#line 437 "parameters_flexer.ll"
+{ return MP_as_urd_cutoffmultiplier;}
 	YY_BREAK
-case 324:
-#line 444 "parameters_flexer.ll"
 case 325:
+#line 439 "parameters_flexer.ll"
+case 326:
 YY_RULE_SETUP
-#line 444 "parameters_flexer.ll"
-{return MP_sk_basesperhash;}
+#line 439 "parameters_flexer.ll"
+{ return MP_as_urd_startinpass;}
 	YY_BREAK
-case 326:
-#line 446 "parameters_flexer.ll"
 case 327:
+#line 441 "parameters_flexer.ll"
+case 328:
 YY_RULE_SETUP
-#line 446 "parameters_flexer.ll"
-{return MP_sk_hashsavestepping;}
+#line 441 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_uniform_read_distribution;}
 	YY_BREAK
-case 328:
-#line 448 "parameters_flexer.ll"
 case 329:
+#line 443 "parameters_flexer.ll"
+case 330:
 YY_RULE_SETUP
-#line 448 "parameters_flexer.ll"
-{return MP_sk_percentrequired;}
+#line 443 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_keep_long_repeats_separated;}
 	YY_BREAK
-case 330:
-#line 450 "parameters_flexer.ll"
 case 331:
+#line 445 "parameters_flexer.ll"
+case 332:
 YY_RULE_SETUP
-#line 450 "parameters_flexer.ll"
-{return MP_sk_maxhitsperread;}
+#line 445 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_paf_use_genomic_pathfinder;}
 	YY_BREAK
-case 332:
-#line 452 "parameters_flexer.ll"
 case 333:
+#line 447 "parameters_flexer.ll"
+case 334:
 YY_RULE_SETUP
-#line 452 "parameters_flexer.ll"
-{return MP_ERROR_RENAMED_BPH_KMER;}
+#line 447 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_paf_use_emergency_search_stop;}
 	YY_BREAK
-case 334:
-#line 454 "parameters_flexer.ll"
 case 335:
+#line 449 "parameters_flexer.ll"
+case 336:
 YY_RULE_SETUP
-#line 454 "parameters_flexer.ll"
-{return MP_sk_maxhashesinmemory;}
+#line 449 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_paf_use_emergency_blacklist;}
 	YY_BREAK
-case 336:
-#line 456 "parameters_flexer.ll"
 case 337:
+#line 451 "parameters_flexer.ll"
+case 338:
 YY_RULE_SETUP
-#line 456 "parameters_flexer.ll"
-{return MP_sk_memcaphitreduction;}
+#line 451 "parameters_flexer.ll"
+{return MP_paf_ess_partnerdepth;}
 	YY_BREAK
-case 338:
-#line 458 "parameters_flexer.ll"
 case 339:
+#line 453 "parameters_flexer.ll"
+case 340:
 YY_RULE_SETUP
-#line 458 "parameters_flexer.ll"
-{yy_push_state(ASK_YN_MODE); return MP_sk_alsoskimrevcomp;}
+#line 453 "parameters_flexer.ll"
+{yy_push_state(ASK_YN_MODE); return MP_paf_use_max_contig_buildtime;}
 	YY_BREAK
-case 340:
-#line 460 "parameters_flexer.ll"
 case 341:
+#line 455 "parameters_flexer.ll"
+case 342:
 YY_RULE_SETUP
-#line 460 "parameters_flexer.ll"
-{yy_push_state(ASK_YN_MODE); return MP_sk_swcheckonbackbones;}
+#line 455 "parameters_flexer.ll"
+{return MP_paf_buildtime_inseconds;}
 	YY_BREAK
-case 342:
-#line 462 "parameters_flexer.ll"
 case 343:
+#line 457 "parameters_flexer.ll"
+case 344:
 YY_RULE_SETUP
-#line 462 "parameters_flexer.ll"
-{yy_push_state(ASK_YN_MODE); return MP_sk_filtermegahubs;}
+#line 457 "parameters_flexer.ll"
+{return MP_as_basedefaultqual;}
 	YY_BREAK
-case 344:
-#line 464 "parameters_flexer.ll"
 case 345:
+#line 459 "parameters_flexer.ll"
+case 346:
 YY_RULE_SETUP
-#line 464 "parameters_flexer.ll"
-{return MP_sk_maxmegahubratio;}
+#line 459 "parameters_flexer.ll"
+{yy_push_state(ASK_YN_MODE); return MP_as_enforce_qualsinreads;}
 	YY_BREAK
-case 346:
-#line 466 "parameters_flexer.ll"
 case 347:
+#line 463 "parameters_flexer.ll"
+case 348:
 YY_RULE_SETUP
-#line 466 "parameters_flexer.ll"
-{return MP_sk_megahubcap;}
+#line 463 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_extend_reads;}
 	YY_BREAK
-case 348:
-#line 469 "parameters_flexer.ll"
 case 349:
+#line 465 "parameters_flexer.ll"
+case 350:
 YY_RULE_SETUP
-#line 469 "parameters_flexer.ll"
-{return MP_ERROR_MOVED_SECTION_KS;}
+#line 465 "parameters_flexer.ll"
+{return MP_as_readextension_window_len;}
 	YY_BREAK
-case 350:
-#line 471 "parameters_flexer.ll"
 case 351:
+#line 467 "parameters_flexer.ll"
+case 352:
 YY_RULE_SETUP
-#line 471 "parameters_flexer.ll"
-{return MP_ERROR_MOVED_SECTION_KS;}
+#line 467 "parameters_flexer.ll"
+{return MP_as_readextension_window_maxerrors;}
 	YY_BREAK
-case 352:
-#line 473 "parameters_flexer.ll"
 case 353:
+#line 469 "parameters_flexer.ll"
+case 354:
 YY_RULE_SETUP
-#line 473 "parameters_flexer.ll"
-{return MP_ERROR_MOVED_SECTION_KS;}
+#line 469 "parameters_flexer.ll"
+{return MP_as_readextension_firstpassnum;}
 	YY_BREAK
-case 354:
-#line 475 "parameters_flexer.ll"
 case 355:
+#line 471 "parameters_flexer.ll"
+case 356:
 YY_RULE_SETUP
-#line 475 "parameters_flexer.ll"
-{ return MP_ERROR_MOVED_SECTION_KS;}
+#line 471 "parameters_flexer.ll"
+{return MP_as_readextension_lastpassnum;}
 	YY_BREAK
-case 356:
-#line 477 "parameters_flexer.ll"
 case 357:
+#line 475 "parameters_flexer.ll"
+case 358:
 YY_RULE_SETUP
-#line 477 "parameters_flexer.ll"
-{return MP_ERROR_MOVED_SECTION_KS;}
+#line 475 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_ed_automatic_contig_editing;}
 	YY_BREAK
-case 358:
-#line 479 "parameters_flexer.ll"
 case 359:
+#line 477 "parameters_flexer.ll"
+case 360:
 YY_RULE_SETUP
-#line 479 "parameters_flexer.ll"
-{return MP_ERROR_MOVED_SECTION_KS;}
+#line 477 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_ed_strict;}
 	YY_BREAK
-case 360:
-#line 481 "parameters_flexer.ll"
 case 361:
+#line 479 "parameters_flexer.ll"
+case 362:
 YY_RULE_SETUP
-#line 481 "parameters_flexer.ll"
-{return MP_ERROR_MOVED_SECTION_KS;}
+#line 479 "parameters_flexer.ll"
+{ return MP_ed_confirmation_threshold;}
 	YY_BREAK
-case 362:
-#line 483 "parameters_flexer.ll"
 case 363:
+#line 482 "parameters_flexer.ll"
+case 364:
 YY_RULE_SETUP
-#line 483 "parameters_flexer.ll"
-{return MP_ERROR_MOVED_SECTION_KS;}
+#line 482 "parameters_flexer.ll"
+{return MP_sk_numthreads;}
 	YY_BREAK
-case 364:
-#line 485 "parameters_flexer.ll"
 case 365:
+#line 484 "parameters_flexer.ll"
+case 366:
 YY_RULE_SETUP
-#line 485 "parameters_flexer.ll"
-{return MP_ERROR_MOVED_SECTION_KS;}
+#line 484 "parameters_flexer.ll"
+{return MP_sk_basesperhash;}
 	YY_BREAK
-case 366:
-#line 487 "parameters_flexer.ll"
 case 367:
+#line 486 "parameters_flexer.ll"
+case 368:
 YY_RULE_SETUP
-#line 487 "parameters_flexer.ll"
-{return MP_ERROR_MOVED_SECTION_KS;}
+#line 486 "parameters_flexer.ll"
+{return MP_sk_hashsavestepping;}
 	YY_BREAK
-case 368:
-#line 491 "parameters_flexer.ll"
 case 369:
+#line 488 "parameters_flexer.ll"
+case 370:
 YY_RULE_SETUP
-#line 491 "parameters_flexer.ll"
-{return MP_hs_nastyrepeatratio;}
+#line 488 "parameters_flexer.ll"
+{return MP_sk_percentrequired;}
 	YY_BREAK
-case 370:
-#line 493 "parameters_flexer.ll"
 case 371:
+#line 490 "parameters_flexer.ll"
+case 372:
 YY_RULE_SETUP
-#line 493 "parameters_flexer.ll"
-{return MP_hs_nastyrepeatcoverage;}
+#line 490 "parameters_flexer.ll"
+{return MP_sk_maxhitsperread;}
 	YY_BREAK
-case 372:
-#line 495 "parameters_flexer.ll"
 case 373:
+#line 492 "parameters_flexer.ll"
+case 374:
 YY_RULE_SETUP
-#line 495 "parameters_flexer.ll"
-{return MP_hs_repeatlevel_in_infofile;}
+#line 492 "parameters_flexer.ll"
+{return MP_sk_maxhashesinmemory;}
 	YY_BREAK
-case 374:
-#line 497 "parameters_flexer.ll"
 case 375:
+#line 494 "parameters_flexer.ll"
+case 376:
 YY_RULE_SETUP
-#line 497 "parameters_flexer.ll"
-{yy_push_state(ASK_YN_MODE); return MP_hs_masknastyrepeats;}
+#line 494 "parameters_flexer.ll"
+{return MP_sk_memcaphitreduction;}
 	YY_BREAK
-case 376:
-#line 499 "parameters_flexer.ll"
 case 377:
+#line 496 "parameters_flexer.ll"
+case 378:
 YY_RULE_SETUP
-#line 499 "parameters_flexer.ll"
-{return MP_hs_freq_covestmin;}
+#line 496 "parameters_flexer.ll"
+{yy_push_state(ASK_YN_MODE); return MP_sk_masknastyrepeats;}
 	YY_BREAK
-case 378:
-#line 501 "parameters_flexer.ll"
 case 379:
+#line 498 "parameters_flexer.ll"
+case 380:
 YY_RULE_SETUP
-#line 501 "parameters_flexer.ll"
-{return MP_hs_freqest_minnormal;}
+#line 498 "parameters_flexer.ll"
+{yy_push_state(ASK_YN_MODE); return MP_sk_alsoskimrevcomp;}
 	YY_BREAK
-case 380:
-#line 503 "parameters_flexer.ll"
 case 381:
+#line 500 "parameters_flexer.ll"
+case 382:
 YY_RULE_SETUP
-#line 503 "parameters_flexer.ll"
-{return MP_hs_freqest_maxnormal;}
+#line 500 "parameters_flexer.ll"
+{yy_push_state(ASK_YN_MODE); return MP_sk_swcheckonbackbones;}
 	YY_BREAK
-case 382:
-#line 505 "parameters_flexer.ll"
 case 383:
+#line 502 "parameters_flexer.ll"
+case 384:
 YY_RULE_SETUP
-#line 505 "parameters_flexer.ll"
-{return MP_hs_freqest_repeat;}
+#line 502 "parameters_flexer.ll"
+{return MP_sk_nastyrepeatratio;}
 	YY_BREAK
-case 384:
-#line 507 "parameters_flexer.ll"
 case 385:
+#line 504 "parameters_flexer.ll"
+case 386:
 YY_RULE_SETUP
-#line 507 "parameters_flexer.ll"
-{return MP_hs_freqest_heavyrepeat;}
+#line 504 "parameters_flexer.ll"
+{return MP_sk_repeatlevel_in_infofile;}
 	YY_BREAK
-case 386:
-#line 509 "parameters_flexer.ll"
 case 387:
+#line 506 "parameters_flexer.ll"
+case 388:
+YY_RULE_SETUP
+#line 506 "parameters_flexer.ll"
+{return MP_sk_maxmegahubratio;}
+	YY_BREAK
+case 389:
+#line 509 "parameters_flexer.ll"
+case 390:
 YY_RULE_SETUP
 #line 509 "parameters_flexer.ll"
-{return MP_hs_freqest_crazyrepeat;}
+{return MP_sk_freqest_minnormal;}
 	YY_BREAK
-case 388:
+case 391:
 #line 511 "parameters_flexer.ll"
-case 389:
+case 392:
 YY_RULE_SETUP
 #line 511 "parameters_flexer.ll"
-{yy_push_state(ASK_YN_MODE); return MP_hs_applydigitalnormalisation;}
+{return MP_sk_freqest_maxnormal;}
 	YY_BREAK
-case 390:
+case 393:
 #line 513 "parameters_flexer.ll"
-case 391:
+case 394:
 YY_RULE_SETUP
 #line 513 "parameters_flexer.ll"
-{return MP_hs_rare_kmer_final_kill;}
+{return MP_sk_freqest_repeat;}
 	YY_BREAK
-case 392:
+case 395:
 #line 515 "parameters_flexer.ll"
-case 393:
+case 396:
 YY_RULE_SETUP
 #line 515 "parameters_flexer.ll"
-{return MP_ERROR_MOVED_SECTION_KS;}
+{return MP_sk_freqest_heavyrepeat;}
 	YY_BREAK
-case 394:
+case 397:
 #line 517 "parameters_flexer.ll"
-case 395:
+case 398:
 YY_RULE_SETUP
 #line 517 "parameters_flexer.ll"
-{return MP_hs_million_hashes_per_buffer;}
+{return MP_sk_freqest_crazyrepeat;}
 	YY_BREAK
-case 396:
+case 399:
 #line 522 "parameters_flexer.ll"
-case 397:
+case 400:
 YY_RULE_SETUP
 #line 522 "parameters_flexer.ll"
 {return MP_al_bip;}
 	YY_BREAK
-case 398:
+case 401:
 #line 524 "parameters_flexer.ll"
-case 399:
+case 402:
 YY_RULE_SETUP
 #line 524 "parameters_flexer.ll"
 {return MP_al_bmax;}
 	YY_BREAK
-case 400:
+case 403:
 #line 526 "parameters_flexer.ll"
-case 401:
+case 404:
 YY_RULE_SETUP
 #line 526 "parameters_flexer.ll"
 {return MP_al_bmin;}
 	YY_BREAK
-case 402:
+case 405:
 #line 528 "parameters_flexer.ll"
-case 403:
+case 406:
 YY_RULE_SETUP
 #line 528 "parameters_flexer.ll"
 {return MP_al_min_score;}
 	YY_BREAK
-case 404:
+case 407:
 #line 530 "parameters_flexer.ll"
-case 405:
+case 408:
 YY_RULE_SETUP
 #line 530 "parameters_flexer.ll"
 {return MP_al_min_overlap;}
 	YY_BREAK
-case 406:
+case 409:
 #line 532 "parameters_flexer.ll"
-case 407:
+case 410:
 YY_RULE_SETUP
 #line 532 "parameters_flexer.ll"
 {return MP_al_min_relscore;}
 	YY_BREAK
-case 408:
+case 411:
 #line 534 "parameters_flexer.ll"
-case 409:
+case 412:
 YY_RULE_SETUP
 #line 534 "parameters_flexer.ll"
-{ yy_push_state(CSV_NUMBERS_MODE); return MP_ads_gp_functionstring;}
+{BEGIN(AL_GPLMODE); return MP_ads_gp_level;}
 	YY_BREAK
-case 410:
+case 413:
 #line 536 "parameters_flexer.ll"
-case 411:
+case 414:
 YY_RULE_SETUP
 #line 536 "parameters_flexer.ll"
 { yy_push_state(ASK_YN_MODE); return MP_ads_extra_gap_penalty;}
 	YY_BREAK
-case 412:
+case 415:
 #line 538 "parameters_flexer.ll"
-case 413:
+case 416:
 YY_RULE_SETUP
 #line 538 "parameters_flexer.ll"
 {return MP_ads_max_gppercent;}
 	YY_BREAK
-case 414:
+case 417:
 #line 540 "parameters_flexer.ll"
-case 415:
+case 418:
 YY_RULE_SETUP
 #line 540 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_ads_enforce_clean_ends;}
+{return MP_al_solexahack_maxerrors;}
 	YY_BREAK
-case 416:
+case 419:
 #line 542 "parameters_flexer.ll"
-case 417:
+case 420:
 YY_RULE_SETUP
 #line 542 "parameters_flexer.ll"
-{return MP_ads_clean_end_distance;}
+{BEGIN(ALIGN_MODE); return 10;}
 	YY_BREAK
-case 418:
+case 421:
 #line 544 "parameters_flexer.ll"
-case 419:
+case 422:
 YY_RULE_SETUP
 #line 544 "parameters_flexer.ll"
-{return MP_ads_clean_end_mismatchallowed;}
-	YY_BREAK
-case 420:
-#line 546 "parameters_flexer.ll"
-case 421:
-YY_RULE_SETUP
-#line 546 "parameters_flexer.ll"
-{return MP_al_solexahack_maxerrors;}
+{BEGIN(ALIGN_MODE); return 0;}
 	YY_BREAK
-case 422:
-#line 549 "parameters_flexer.ll"
 case 423:
-YY_RULE_SETUP
-#line 549 "parameters_flexer.ll"
-{BEGIN(CO_VALMODE); return MP_con_analyse_mode;}
-	YY_BREAK
+#line 546 "parameters_flexer.ll"
 case 424:
 YY_RULE_SETUP
-#line 550 "parameters_flexer.ll"
-{BEGIN(CO_MODE); return 0;}
+#line 546 "parameters_flexer.ll"
+{BEGIN(ALIGN_MODE); return 1;}
 	YY_BREAK
 case 425:
-YY_RULE_SETUP
-#line 551 "parameters_flexer.ll"
-{BEGIN(CO_MODE); return 1;}
-	YY_BREAK
+#line 548 "parameters_flexer.ll"
 case 426:
 YY_RULE_SETUP
-#line 552 "parameters_flexer.ll"
-{BEGIN(CO_MODE); return 2;}
+#line 548 "parameters_flexer.ll"
+{BEGIN(ALIGN_MODE); return 2;}
 	YY_BREAK
 case 427:
 YY_RULE_SETUP
-#line 553 "parameters_flexer.ll"
-{BEGIN(CO_MODE); return MP_UNRECOGNISED_STRING;}
+#line 549 "parameters_flexer.ll"
+{BEGIN(ALIGN_MODE); return MP_UNRECOGNISED_STRING;}
 	YY_BREAK
 case 428:
 YY_RULE_SETUP
-#line 554 "parameters_flexer.ll"
-{BEGIN(CO_MODE); return MP_UNRECOGNISED_STRING;}
+#line 550 "parameters_flexer.ll"
+{BEGIN(ALIGN_MODE); return MP_UNRECOGNISED_STRING;}
 	YY_BREAK
 case 429:
 YY_RULE_SETUP
-#line 555 "parameters_flexer.ll"
-{BEGIN(CO_MODE); return MP_UNRECOGNISED_STRING;}
+#line 551 "parameters_flexer.ll"
+{BEGIN(ALIGN_MODE); return MP_UNRECOGNISED_STRING;}
 	YY_BREAK
 case 430:
 /* rule 430 can match eol */
 YY_RULE_SETUP
-#line 556 "parameters_flexer.ll"
-{BEGIN(CO_MODE); return MP_UNRECOGNISED_STRING;}
+#line 552 "parameters_flexer.ll"
+{BEGIN(ALIGN_MODE); return MP_UNRECOGNISED_STRING;}
 	YY_BREAK
 case 431:
-#line 558 "parameters_flexer.ll"
+#line 555 "parameters_flexer.ll"
 case 432:
 YY_RULE_SETUP
-#line 558 "parameters_flexer.ll"
-{return MP_con_rodirs;}
+#line 555 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_use_template_information;}
 	YY_BREAK
 case 433:
-#line 560 "parameters_flexer.ll"
+#line 557 "parameters_flexer.ll"
 case 434:
 YY_RULE_SETUP
-#line 560 "parameters_flexer.ll"
-{return MP_con_min_relscore;}
+#line 557 "parameters_flexer.ll"
+{BEGIN(CO_VALMODE); return MP_con_analyse_mode;}
 	YY_BREAK
 case 435:
-#line 562 "parameters_flexer.ll"
+YY_RULE_SETUP
+#line 558 "parameters_flexer.ll"
+{BEGIN(CO_MODE); return 0;}
+	YY_BREAK
 case 436:
 YY_RULE_SETUP
-#line 562 "parameters_flexer.ll"
-{return MP_con_danger_max_error_rate;}
+#line 559 "parameters_flexer.ll"
+{BEGIN(CO_MODE); return 1;}
 	YY_BREAK
 case 437:
-#line 564 "parameters_flexer.ll"
+YY_RULE_SETUP
+#line 560 "parameters_flexer.ll"
+{BEGIN(CO_MODE); return 2;}
+	YY_BREAK
 case 438:
 YY_RULE_SETUP
-#line 564 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_mark_repeats;}
+#line 561 "parameters_flexer.ll"
+{BEGIN(CO_MODE); return MP_UNRECOGNISED_STRING;}
 	YY_BREAK
 case 439:
-#line 566 "parameters_flexer.ll"
+YY_RULE_SETUP
+#line 562 "parameters_flexer.ll"
+{BEGIN(CO_MODE); return MP_UNRECOGNISED_STRING;}
+	YY_BREAK
 case 440:
-#line 567 "parameters_flexer.ll"
+YY_RULE_SETUP
+#line 563 "parameters_flexer.ll"
+{BEGIN(CO_MODE); return MP_UNRECOGNISED_STRING;}
+	YY_BREAK
 case 441:
+/* rule 441 can match eol */
 YY_RULE_SETUP
-#line 567 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_as_mark_repeats_only_in_result;}
+#line 564 "parameters_flexer.ll"
+{BEGIN(CO_MODE); return MP_UNRECOGNISED_STRING;}
 	YY_BREAK
 case 442:
-#line 569 "parameters_flexer.ll"
+#line 566 "parameters_flexer.ll"
 case 443:
 YY_RULE_SETUP
-#line 569 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_con_assume_snp_insteadof_rmb;}
+#line 566 "parameters_flexer.ll"
+{return MP_con_rodirs;}
 	YY_BREAK
 case 444:
-#line 571 "parameters_flexer.ll"
+#line 568 "parameters_flexer.ll"
 case 445:
-#line 572 "parameters_flexer.ll"
-case 446:
 YY_RULE_SETUP
-#line 572 "parameters_flexer.ll"
-{return MP_con_min_rmb_neighbourqual;}
+#line 568 "parameters_flexer.ll"
+{return MP_con_danger_max_error_rate;}
 	YY_BREAK
+case 446:
+#line 570 "parameters_flexer.ll"
 case 447:
-#line 574 "parameters_flexer.ll"
-case 448:
 YY_RULE_SETUP
-#line 574 "parameters_flexer.ll"
-{return MP_con_min_readspergroup;}
+#line 570 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_mark_repeats;}
 	YY_BREAK
+case 448:
+#line 572 "parameters_flexer.ll"
 case 449:
-#line 576 "parameters_flexer.ll"
+#line 573 "parameters_flexer.ll"
 case 450:
 YY_RULE_SETUP
-#line 576 "parameters_flexer.ll"
-{return MP_con_min_groupqual_for_rmb_tagging;}
+#line 573 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_as_mark_repeats_only_in_result;}
 	YY_BREAK
 case 451:
-#line 578 "parameters_flexer.ll"
+#line 575 "parameters_flexer.ll"
 case 452:
 YY_RULE_SETUP
-#line 578 "parameters_flexer.ll"
-{return MP_con_emea_setzero_on_clipping_pec;}
+#line 575 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_con_assume_snp_insteadof_rmb;}
 	YY_BREAK
 case 453:
-#line 580 "parameters_flexer.ll"
+#line 577 "parameters_flexer.ll"
 case 454:
+#line 578 "parameters_flexer.ll"
+case 455:
 YY_RULE_SETUP
-#line 580 "parameters_flexer.ll"
-{return MP_con_endread_mark_exclusion_area;}
+#line 578 "parameters_flexer.ll"
+{return MP_con_min_rmb_neighbourqual;}
 	YY_BREAK
-case 455:
-#line 582 "parameters_flexer.ll"
 case 456:
+#line 580 "parameters_flexer.ll"
+case 457:
 YY_RULE_SETUP
-#line 582 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_con_also_mark_gap_bases_evenmc;}
+#line 580 "parameters_flexer.ll"
+{return MP_con_min_readspergroup;}
 	YY_BREAK
-case 457:
-#line 584 "parameters_flexer.ll"
 case 458:
+#line 582 "parameters_flexer.ll"
+case 459:
 YY_RULE_SETUP
-#line 584 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_con_also_mark_gap_bases_needbothstrands;}
+#line 582 "parameters_flexer.ll"
+{return MP_con_min_groupqual_for_rmb_tagging;}
 	YY_BREAK
-case 459:
-#line 586 "parameters_flexer.ll"
 case 460:
+#line 584 "parameters_flexer.ll"
+case 461:
 YY_RULE_SETUP
-#line 586 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_con_also_mark_gap_bases;}
+#line 584 "parameters_flexer.ll"
+{return MP_con_emea_setzero_on_clipping_pec;}
 	YY_BREAK
-case 461:
-#line 588 "parameters_flexer.ll"
 case 462:
-#line 589 "parameters_flexer.ll"
+#line 586 "parameters_flexer.ll"
 case 463:
 YY_RULE_SETUP
-#line 589 "parameters_flexer.ll"
-{filenameid=MP_con_name_prefix; yy_push_state(FN_MODE);}
+#line 586 "parameters_flexer.ll"
+{return MP_con_endread_mark_exclusion_area;}
 	YY_BREAK
 case 464:
-#line 591 "parameters_flexer.ll"
+#line 588 "parameters_flexer.ll"
 case 465:
 YY_RULE_SETUP
-#line 591 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_con_force_nonIUPACconsensus;}
+#line 588 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_con_also_mark_gap_bases_evenmc;}
 	YY_BREAK
 case 466:
-#line 593 "parameters_flexer.ll"
+#line 590 "parameters_flexer.ll"
 case 467:
 YY_RULE_SETUP
-#line 593 "parameters_flexer.ll"
-{ return MP_con_msr_maxerrors;}
+#line 590 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_con_also_mark_gap_bases_needbothstrands;}
 	YY_BREAK
 case 468:
-#line 595 "parameters_flexer.ll"
+#line 592 "parameters_flexer.ll"
 case 469:
 YY_RULE_SETUP
-#line 595 "parameters_flexer.ll"
-{ return MP_con_msr_keependsunmapped;}
+#line 592 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_con_also_mark_gap_bases;}
 	YY_BREAK
 case 470:
-#line 597 "parameters_flexer.ll"
+#line 594 "parameters_flexer.ll"
 case 471:
-YY_RULE_SETUP
-#line 597 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_con_mergeshortreads;}
-	YY_BREAK
+#line 595 "parameters_flexer.ll"
 case 472:
-#line 599 "parameters_flexer.ll"
-case 473:
 YY_RULE_SETUP
-#line 599 "parameters_flexer.ll"
-{return MP_con_gap_override_ratio;}
+#line 595 "parameters_flexer.ll"
+{filenameid=MP_con_name_prefix; yy_push_state(FN_MODE);}
 	YY_BREAK
+case 473:
+#line 597 "parameters_flexer.ll"
 case 474:
-#line 602 "parameters_flexer.ll"
-case 475:
 YY_RULE_SETUP
-#line 602 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_mi_extendedlog;}
+#line 597 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_con_force_nonIUPACconsensus_perseqtype;}
 	YY_BREAK
+case 475:
+#line 599 "parameters_flexer.ll"
 case 476:
-#line 604 "parameters_flexer.ll"
-case 477:
 YY_RULE_SETUP
-#line 604 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_mi_iknowwhatido;}
+#line 599 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_con_force_nonIUPACconsensus_amongseqtypes;}
 	YY_BREAK
+case 477:
+#line 601 "parameters_flexer.ll"
 case 478:
-#line 606 "parameters_flexer.ll"
-case 479:
 YY_RULE_SETUP
-#line 606 "parameters_flexer.ll"
-{ return MP_mi_as_largecontigsize4stats;}
+#line 601 "parameters_flexer.ll"
+{ return MP_con_msr_keependsunmapped;}
 	YY_BREAK
+case 479:
+#line 603 "parameters_flexer.ll"
 case 480:
-#line 608 "parameters_flexer.ll"
-case 481:
 YY_RULE_SETUP
-#line 608 "parameters_flexer.ll"
-{ return MP_mi_as_largecontigsize;}
+#line 603 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_con_mergeshortreads;}
 	YY_BREAK
+case 481:
+#line 605 "parameters_flexer.ll"
 case 482:
 YY_RULE_SETUP
-#line 609 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_mi_extra_flag1;}
+#line 605 "parameters_flexer.ll"
+{return MP_con_gap_override_ratio;}
 	YY_BREAK
 case 483:
-YY_RULE_SETUP
-#line 610 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_mi_extra_flag2;}
-	YY_BREAK
+#line 608 "parameters_flexer.ll"
 case 484:
 YY_RULE_SETUP
-#line 611 "parameters_flexer.ll"
-{ yy_push_state(ASK_YN_MODE); return MP_mi_extra_flag3;}
+#line 608 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_mi_stoponnfs;}
 	YY_BREAK
 case 485:
-YY_RULE_SETUP
-#line 612 "parameters_flexer.ll"
-{ return MP_ERROR_MOVED_SECTION_NW;}
-	YY_BREAK
+#line 610 "parameters_flexer.ll"
 case 486:
 YY_RULE_SETUP
-#line 613 "parameters_flexer.ll"
-{ return MP_ERROR_MOVED_SECTION_NW;}
+#line 610 "parameters_flexer.ll"
+{ yy_push_state(ASK_YN_MODE); return MP_mi_extendedlog;}
 	YY_BREAK
 case 487:
-#line 616 "parameters_flexer.ll"
+#line 612 "parameters_flexer.ll"
 case 488:
 YY_RULE_SETUP
-#line 616 "parameters_flexer.ll"
-{ yy_push_state(NW_CHOICEMODE); return MP_nw_check_nfs;}
+#line 612 "parameters_flexer.ll"
+{ return MP_mi_as_largecontigsize4stats;}
 	YY_BREAK
 case 489:
-#line 618 "parameters_flexer.ll"
+#line 614 "parameters_flexer.ll"
 case 490:
 YY_RULE_SETUP
-#line 618 "parameters_flexer.ll"
-{ yy_push_state(NW_CHOICEMODE); return MP_nw_check_templateproblems;}
+#line 614 "parameters_flexer.ll"
+{ return MP_mi_as_largecontigsize;}
 	YY_BREAK
 case 491:
-#line 620 "parameters_flexer.ll"
+#line 616 "parameters_flexer.ll"
 case 492:
 YY_RULE_SETUP
-#line 620 "parameters_flexer.ll"
-{ yy_push_state(NW_CHOICEMODE); return MP_nw_check_duplicatereadnames;}
+#line 616 "parameters_flexer.ll"
+{ return MP_mi_stop_maxreadnamelength;}
 	YY_BREAK
 case 493:
-#line 622 "parameters_flexer.ll"
+#line 620 "parameters_flexer.ll"
 case 494:
 YY_RULE_SETUP
-#line 622 "parameters_flexer.ll"
-{ yy_push_state(NW_CHOICEMODE); return MP_nw_check_readnamesra;}
+#line 620 "parameters_flexer.ll"
+{ return MP_paf_skip_whole_contig_scan;}
 	YY_BREAK
 case 495:
-#line 624 "parameters_flexer.ll"
+#line 622 "parameters_flexer.ll"
 case 496:
 YY_RULE_SETUP
-#line 624 "parameters_flexer.ll"
-{ yy_push_state(NW_CHOICEMODE); return MP_nw_check_maxreadnamelength;}
+#line 622 "parameters_flexer.ll"
+{ return MP_paf_use_quick_rule;}
 	YY_BREAK
 case 497:
-#line 626 "parameters_flexer.ll"
+#line 624 "parameters_flexer.ll"
 case 498:
 YY_RULE_SETUP
-#line 626 "parameters_flexer.ll"
-{ return MP_nw_check_mrnlvalue;}
+#line 624 "parameters_flexer.ll"
+{ return MP_paf_quickrule_minlen1;}
 	YY_BREAK
 case 499:
-#line 628 "parameters_flexer.ll"
+#line 626 "parameters_flexer.ll"
 case 500:
 YY_RULE_SETUP
-#line 628 "parameters_flexer.ll"
-{ yy_push_state(NW_CHOICEMODE); return MP_nw_check_multipassmapping;}
+#line 626 "parameters_flexer.ll"
+{ return MP_paf_quickrule_minsim1;}
 	YY_BREAK
 case 501:
-#line 630 "parameters_flexer.ll"
+#line 628 "parameters_flexer.ll"
 case 502:
 YY_RULE_SETUP
-#line 630 "parameters_flexer.ll"
-{ yy_push_state(NW_CHOICEMODE); return MP_nw_check_coverage;}
+#line 628 "parameters_flexer.ll"
+{ return MP_paf_quickrule_minlen2;}
 	YY_BREAK
 case 503:
-#line 632 "parameters_flexer.ll"
+#line 630 "parameters_flexer.ll"
 case 504:
 YY_RULE_SETUP
-#line 632 "parameters_flexer.ll"
-{ return MP_nw_check_covvalue;}
+#line 630 "parameters_flexer.ll"
+{ return MP_paf_quickrule_minsim2;}
 	YY_BREAK
 case 505:
-YY_RULE_SETUP
-#line 634 "parameters_flexer.ll"
-{yy_pop_state(); return 0;}
-	YY_BREAK
+#line 632 "parameters_flexer.ll"
 case 506:
 YY_RULE_SETUP
-#line 635 "parameters_flexer.ll"
-{yy_pop_state(); return 1;}
+#line 632 "parameters_flexer.ll"
+{ return MP_paf_bbquickoverlap_minlen;}
 	YY_BREAK
 case 507:
+#line 634 "parameters_flexer.ll"
+case 508:
 YY_RULE_SETUP
-#line 636 "parameters_flexer.ll"
-{yy_pop_state(); return 2;}
+#line 634 "parameters_flexer.ll"
+{return MP_paf_max_startcache_filltime;}
 	YY_BREAK
-case 508:
+case 509:
 YY_RULE_SETUP
 #line 637 "parameters_flexer.ll"
-{}
+{ return MP_jobdef_draft;}
 	YY_BREAK
-case 509:
+case 510:
 YY_RULE_SETUP
 #line 638 "parameters_flexer.ll"
-{ BEGIN(0); return MP_UNRECOGNISED_STRING;}
+{ return MP_jobdef_normal   ;}
 	YY_BREAK
-case 510:
+case 511:
 YY_RULE_SETUP
 #line 639 "parameters_flexer.ll"
-{ BEGIN(0); return MP_UNRECOGNISED_STRING;}
+{ return MP_jobdef_accurate ;}
 	YY_BREAK
-case 511:
+case 512:
 YY_RULE_SETUP
 #line 640 "parameters_flexer.ll"
-{ BEGIN(0); return MP_UNRECOGNISED_STRING;}
+{ return MP_jobdef_genome   ;}
 	YY_BREAK
-case 512:
-#line 644 "parameters_flexer.ll"
 case 513:
 YY_RULE_SETUP
-#line 644 "parameters_flexer.ll"
-{ return MP_paf_skip_whole_contig_scan;}
+#line 641 "parameters_flexer.ll"
+{ return MP_jobdef_est      ;}
 	YY_BREAK
 case 514:
-#line 646 "parameters_flexer.ll"
+YY_RULE_SETUP
+#line 642 "parameters_flexer.ll"
+{ return MP_jobdef_estsnppipeline1 ;}
+	YY_BREAK
 case 515:
 YY_RULE_SETUP
-#line 646 "parameters_flexer.ll"
-{ return MP_paf_use_quick_rule;}
+#line 643 "parameters_flexer.ll"
+{ return MP_jobdef_estsnppipeline2 ;}
 	YY_BREAK
 case 516:
-#line 648 "parameters_flexer.ll"
+YY_RULE_SETUP
+#line 644 "parameters_flexer.ll"
+{ return MP_jobdef_estsnppipeline3 ;}
+	YY_BREAK
 case 517:
 YY_RULE_SETUP
-#line 648 "parameters_flexer.ll"
-{ return MP_paf_quickrule_minlen1;}
+#line 645 "parameters_flexer.ll"
+{ return MP_jobdef_denovo   ;}
 	YY_BREAK
 case 518:
-#line 650 "parameters_flexer.ll"
+YY_RULE_SETUP
+#line 646 "parameters_flexer.ll"
+{ return MP_jobdef_mapping  ;}
+	YY_BREAK
 case 519:
 YY_RULE_SETUP
-#line 650 "parameters_flexer.ll"
-{ return MP_paf_quickrule_minsim1;}
+#line 647 "parameters_flexer.ll"
+{ return MP_jobdef_sanger   ;}
 	YY_BREAK
 case 520:
-#line 652 "parameters_flexer.ll"
+YY_RULE_SETUP
+#line 648 "parameters_flexer.ll"
+{ return MP_jobdef_454	;}
+	YY_BREAK
 case 521:
 YY_RULE_SETUP
-#line 652 "parameters_flexer.ll"
-{ return MP_paf_quickrule_minlen2;}
+#line 649 "parameters_flexer.ll"
+{ return MP_jobdef_iontor	;}
 	YY_BREAK
 case 522:
-#line 654 "parameters_flexer.ll"
+YY_RULE_SETUP
+#line 650 "parameters_flexer.ll"
+{ return MP_jobdef_pacbio	;}
+	YY_BREAK
 case 523:
 YY_RULE_SETUP
-#line 654 "parameters_flexer.ll"
-{ return MP_paf_quickrule_minsim2;}
+#line 651 "parameters_flexer.ll"
+{ return MP_jobdef_solexa   ;}
 	YY_BREAK
 case 524:
-#line 656 "parameters_flexer.ll"
+YY_RULE_SETUP
+#line 652 "parameters_flexer.ll"
+{ return MP_jobdef_solid	;}
+	YY_BREAK
 case 525:
 YY_RULE_SETUP
-#line 656 "parameters_flexer.ll"
-{ return MP_paf_bbquickoverlap_minlen;}
+#line 653 "parameters_flexer.ll"
+
 	YY_BREAK
 case 526:
-#line 658 "parameters_flexer.ll"
+YY_RULE_SETUP
+#line 654 "parameters_flexer.ll"
+{ return MP_UNRECOGNISED_STRING;}
+	YY_BREAK
 case 527:
+/* rule 527 can match eol */
 YY_RULE_SETUP
-#line 658 "parameters_flexer.ll"
-{return MP_paf_max_startcache_filltime;}
+#line 655 "parameters_flexer.ll"
+{ BEGIN(0); return MP_jobdefend;}                
 	YY_BREAK
 case 528:
-YY_RULE_SETUP
-#line 661 "parameters_flexer.ll"
-{ return MP_jobdef_draft;}
+#line 657 "parameters_flexer.ll"
+case YY_STATE_EOF(JOB_MODE):
+#line 657 "parameters_flexer.ll"
+{ BEGIN(0); return MP_jobdefend;}                
 	YY_BREAK
 case 529:
 YY_RULE_SETUP
-#line 662 "parameters_flexer.ll"
-{ return MP_jobdef_normal   ;}
+#line 658 "parameters_flexer.ll"
+{ BEGIN(JOB_MODE); return MP_jobdefstart;}
 	YY_BREAK
 case 530:
 YY_RULE_SETUP
-#line 663 "parameters_flexer.ll"
-{ return MP_jobdef_accurate ;}
+#line 661 "parameters_flexer.ll"
+{ return MP_quickmode_noclipping_all;}
 	YY_BREAK
 case 531:
 YY_RULE_SETUP
-#line 664 "parameters_flexer.ll"
-{ return MP_jobdef_genome   ;}
+#line 662 "parameters_flexer.ll"
+{ return MP_quickmode_noclipping_sanger;}
 	YY_BREAK
 case 532:
 YY_RULE_SETUP
-#line 665 "parameters_flexer.ll"
-{ return MP_jobdef_est      ;}
+#line 663 "parameters_flexer.ll"
+{ return MP_quickmode_noclipping_454;}
 	YY_BREAK
 case 533:
 YY_RULE_SETUP
-#line 666 "parameters_flexer.ll"
-{ return MP_jobdef_fragments    ;}
+#line 664 "parameters_flexer.ll"
+{ return MP_quickmode_noclipping_iontor;}
 	YY_BREAK
 case 534:
 YY_RULE_SETUP
-#line 667 "parameters_flexer.ll"
-{ return MP_jobdef_estsnppipeline1 ;}
+#line 665 "parameters_flexer.ll"
+{ return MP_quickmode_noclipping_pacbio;}
 	YY_BREAK
 case 535:
 YY_RULE_SETUP
-#line 668 "parameters_flexer.ll"
-{ return MP_jobdef_estsnppipeline2 ;}
+#line 666 "parameters_flexer.ll"
+{ return MP_quickmode_noclipping_solexa;}
 	YY_BREAK
 case 536:
 YY_RULE_SETUP
-#line 669 "parameters_flexer.ll"
-{ return MP_jobdef_estsnppipeline3 ;}
+#line 667 "parameters_flexer.ll"
+{ return MP_quickmode_noclipping_solid;}
 	YY_BREAK
 case 537:
 YY_RULE_SETUP
-#line 670 "parameters_flexer.ll"
-{ return MP_jobdef_denovo   ;}
+#line 668 "parameters_flexer.ll"
+{ BEGIN(0); }
 	YY_BREAK
 case 538:
-YY_RULE_SETUP
-#line 671 "parameters_flexer.ll"
-{ return MP_jobdef_mapping  ;}
-	YY_BREAK
+#line 672 "parameters_flexer.ll"
 case 539:
 YY_RULE_SETUP
 #line 672 "parameters_flexer.ll"
-{ return MP_jobdef_sanger   ;}
+{BEGIN(GE_MODE); return MP_PARSING_SECTIONCHANGE;}
 	YY_BREAK
 case 540:
+#line 674 "parameters_flexer.ll"
+case 541:
 YY_RULE_SETUP
-#line 673 "parameters_flexer.ll"
-{ return MP_jobdef_454	;}
+#line 674 "parameters_flexer.ll"
+{BEGIN(LR_MODE); return MP_PARSING_SECTIONCHANGE;}
 	YY_BREAK
-case 541:
-#line 675 "parameters_flexer.ll"
 case 542:
+#line 676 "parameters_flexer.ll"
+case 543:
 YY_RULE_SETUP
-#line 675 "parameters_flexer.ll"
-{ return MP_jobdef_iontor	;}
+#line 676 "parameters_flexer.ll"
+{BEGIN(SB_MODE); return MP_PARSING_SECTIONCHANGE;}
 	YY_BREAK
-case 543:
-#line 677 "parameters_flexer.ll"
 case 544:
 #line 678 "parameters_flexer.ll"
 case 545:
-#line 679 "parameters_flexer.ll"
-case 546:
 YY_RULE_SETUP
-#line 679 "parameters_flexer.ll"
-{ return MP_jobdef_pacbiolq	;}
+#line 678 "parameters_flexer.ll"
+{BEGIN(CL_MODE); return MP_PARSING_SECTIONCHANGE;}
 	YY_BREAK
+case 546:
+#line 680 "parameters_flexer.ll"
 case 547:
 #line 681 "parameters_flexer.ll"
 case 548:
-#line 682 "parameters_flexer.ll"
+YY_RULE_SETUP
+#line 681 "parameters_flexer.ll"
+{BEGIN(OUTPUT_MODE); return MP_PARSING_SECTIONCHANGE;}
+	YY_BREAK
 case 549:
 #line 683 "parameters_flexer.ll"
 case 550:
 YY_RULE_SETUP
 #line 683 "parameters_flexer.ll"
-{ return MP_jobdef_pacbiohq	;}
+{ BEGIN(FILE_MODE); return MP_PARSING_SECTIONCHANGE;} 
 	YY_BREAK
 case 551:
-YY_RULE_SETUP
-#line 684 "parameters_flexer.ll"
-{ return MP_jobdef_text   ;}
-	YY_BREAK
+#line 685 "parameters_flexer.ll"
 case 552:
 YY_RULE_SETUP
 #line 685 "parameters_flexer.ll"
-{ return MP_jobdef_solexa   ;}
+{BEGIN(AS_MODE); return MP_PARSING_SECTIONCHANGE;}
 	YY_BREAK
 case 553:
-YY_RULE_SETUP
-#line 686 "parameters_flexer.ll"
-{ return MP_jobdef_solid	;}
-	YY_BREAK
+#line 687 "parameters_flexer.ll"
 case 554:
 YY_RULE_SETUP
 #line 687 "parameters_flexer.ll"
-
+{BEGIN(DP_MODE); return MP_PARSING_SECTIONCHANGE;}
 	YY_BREAK
 case 555:
-YY_RULE_SETUP
-#line 688 "parameters_flexer.ll"
-{ return MP_UNRECOGNISED_STRING;}
-	YY_BREAK
+#line 689 "parameters_flexer.ll"
 case 556:
-/* rule 556 can match eol */
 YY_RULE_SETUP
 #line 689 "parameters_flexer.ll"
-{ BEGIN(0); return MP_jobdefend;}
+{BEGIN(EDIT_MODE); return MP_PARSING_SECTIONCHANGE;}
 	YY_BREAK
 case 557:
 #line 691 "parameters_flexer.ll"
-case YY_STATE_EOF(JOB_MODE):
-#line 691 "parameters_flexer.ll"
-{ BEGIN(0); return MP_jobdefend;}
-	YY_BREAK
 case 558:
 YY_RULE_SETUP
-#line 692 "parameters_flexer.ll"
-{ BEGIN(JOB_MODE); return MP_jobdefstart;}
+#line 691 "parameters_flexer.ll"
+{BEGIN(SKIM_MODE); return MP_PARSING_SECTIONCHANGE;}
 	YY_BREAK
 case 559:
-YY_RULE_SETUP
-#line 695 "parameters_flexer.ll"
-{ return MP_quickmode_noclipping_all;}
-	YY_BREAK
+#line 693 "parameters_flexer.ll"
 case 560:
 YY_RULE_SETUP
-#line 696 "parameters_flexer.ll"
-{ return MP_quickmode_noclipping_sanger;}
+#line 693 "parameters_flexer.ll"
+{BEGIN(ALIGN_MODE); return MP_PARSING_SECTIONCHANGE;}
 	YY_BREAK
 case 561:
-YY_RULE_SETUP
-#line 697 "parameters_flexer.ll"
-{ return MP_quickmode_noclipping_454;}
-	YY_BREAK
+#line 695 "parameters_flexer.ll"
 case 562:
 YY_RULE_SETUP
-#line 698 "parameters_flexer.ll"
-{ return MP_quickmode_noclipping_iontor;}
-	YY_BREAK
-case 563:
-YY_RULE_SETUP
-#line 699 "parameters_flexer.ll"
-{ return MP_quickmode_noclipping_pacbiohq;}
-	YY_BREAK
-case 564:
-YY_RULE_SETUP
-#line 700 "parameters_flexer.ll"
-{ return MP_quickmode_noclipping_pacbiolq;}
+#line 695 "parameters_flexer.ll"
+{BEGIN(CO_MODE); return MP_PARSING_SECTIONCHANGE;}
 	YY_BREAK
+case 563:
+#line 697 "parameters_flexer.ll"
+case 564:
+#line 698 "parameters_flexer.ll"
 case 565:
 YY_RULE_SETUP
-#line 701 "parameters_flexer.ll"
-{ return MP_quickmode_noclipping_text;}
+#line 698 "parameters_flexer.ll"
+{BEGIN(DIR_MODE); return MP_PARSING_SECTIONCHANGE;}
 	YY_BREAK
 case 566:
-YY_RULE_SETUP
-#line 702 "parameters_flexer.ll"
-{ return MP_quickmode_noclipping_solexa;}
-	YY_BREAK
+#line 700 "parameters_flexer.ll"
 case 567:
 YY_RULE_SETUP
-#line 703 "parameters_flexer.ll"
-{ return MP_quickmode_noclipping_solid;}
+#line 700 "parameters_flexer.ll"
+{BEGIN(MI_MODE); return MP_PARSING_SECTIONCHANGE;}
 	YY_BREAK
 case 568:
+#line 702 "parameters_flexer.ll"
+case 569:
 YY_RULE_SETUP
-#line 704 "parameters_flexer.ll"
-{ BEGIN(0); }
+#line 702 "parameters_flexer.ll"
+{ BEGIN(PAF_MODE); return MP_PARSING_SECTIONCHANGE;}
 	YY_BREAK
-case 569:
-#line 708 "parameters_flexer.ll"
 case 570:
 YY_RULE_SETUP
-#line 708 "parameters_flexer.ll"
-{BEGIN(GE_MODE); return MP_PARSING_SECTIONCHANGE;}
+#line 704 "parameters_flexer.ll"
+{ return MP_params_for_common;}
 	YY_BREAK
 case 571:
-#line 710 "parameters_flexer.ll"
+YY_RULE_SETUP
+#line 705 "parameters_flexer.ll"
+{ return MP_params_for_sanger;}
+	YY_BREAK
 case 572:
 YY_RULE_SETUP
-#line 710 "parameters_flexer.ll"
-{BEGIN(LR_MODE); return MP_PARSING_SECTIONCHANGE;}
+#line 706 "parameters_flexer.ll"
+{ return MP_params_for_454;}
 	YY_BREAK
 case 573:
-#line 712 "parameters_flexer.ll"
+YY_RULE_SETUP
+#line 707 "parameters_flexer.ll"
+{ return MP_params_for_iontor;}
+	YY_BREAK
 case 574:
 YY_RULE_SETUP
-#line 712 "parameters_flexer.ll"
-{BEGIN(SB_MODE); return MP_PARSING_SECTIONCHANGE;}
+#line 708 "parameters_flexer.ll"
+{ return MP_params_for_pacbio;}
 	YY_BREAK
 case 575:
-#line 714 "parameters_flexer.ll"
+YY_RULE_SETUP
+#line 709 "parameters_flexer.ll"
+{ return MP_params_for_solexa;}
+	YY_BREAK
 case 576:
 YY_RULE_SETUP
-#line 714 "parameters_flexer.ll"
-{BEGIN(CL_MODE); return MP_PARSING_SECTIONCHANGE;}
+#line 710 "parameters_flexer.ll"
+{ return MP_params_for_solid;}
 	YY_BREAK
 case 577:
-#line 716 "parameters_flexer.ll"
+YY_RULE_SETUP
+#line 712 "parameters_flexer.ll"
+{ return MP_silentparams_for_common;}
+	YY_BREAK
 case 578:
-#line 717 "parameters_flexer.ll"
+YY_RULE_SETUP
+#line 713 "parameters_flexer.ll"
+{ return MP_silentparams_for_sanger;}
+	YY_BREAK
 case 579:
 YY_RULE_SETUP
-#line 717 "parameters_flexer.ll"
-{BEGIN(OUTPUT_MODE); return MP_PARSING_SECTIONCHANGE;}
+#line 714 "parameters_flexer.ll"
+{ return MP_silentparams_for_454;}
 	YY_BREAK
 case 580:
-#line 719 "parameters_flexer.ll"
+YY_RULE_SETUP
+#line 715 "parameters_flexer.ll"
+{ return MP_silentparams_for_iontor;}
+	YY_BREAK
 case 581:
 YY_RULE_SETUP
-#line 719 "parameters_flexer.ll"
-{ BEGIN(FILE_MODE); return MP_PARSING_SECTIONCHANGE;}
+#line 716 "parameters_flexer.ll"
+{ return MP_silentparams_for_pacbio;}
 	YY_BREAK
 case 582:
-#line 721 "parameters_flexer.ll"
+YY_RULE_SETUP
+#line 717 "parameters_flexer.ll"
+{ return MP_silentparams_for_solexa;}
+	YY_BREAK
 case 583:
 YY_RULE_SETUP
-#line 721 "parameters_flexer.ll"
-{BEGIN(AS_MODE); return MP_PARSING_SECTIONCHANGE;}
+#line 718 "parameters_flexer.ll"
+{ return MP_silentparams_for_solid;}
 	YY_BREAK
 case 584:
-#line 723 "parameters_flexer.ll"
+YY_RULE_SETUP
+#line 721 "parameters_flexer.ll"
+{ return MP_quickmode_borg;}
+	YY_BREAK
 case 585:
 YY_RULE_SETUP
 #line 723 "parameters_flexer.ll"
-{BEGIN(DP_MODE); return MP_PARSING_SECTIONCHANGE;}
+{ filenameid=MP_quickmode_fastaname; yy_push_state(FN_MODE);}
 	YY_BREAK
 case 586:
-#line 725 "parameters_flexer.ll"
+YY_RULE_SETUP
+#line 724 "parameters_flexer.ll"
+{ filenameid=MP_quickmode_fastqname; yy_push_state(FN_MODE);}
+	YY_BREAK
 case 587:
 YY_RULE_SETUP
 #line 725 "parameters_flexer.ll"
-{BEGIN(EDIT_MODE); return MP_PARSING_SECTIONCHANGE;}
+{ return MP_quickmode_fasta;}
 	YY_BREAK
 case 588:
-#line 727 "parameters_flexer.ll"
+YY_RULE_SETUP
+#line 726 "parameters_flexer.ll"
+{ return MP_quickmode_fastq;}
+	YY_BREAK
 case 589:
 YY_RULE_SETUP
 #line 727 "parameters_flexer.ll"
-{BEGIN(SKIM_MODE); return MP_PARSING_SECTIONCHANGE;}
+{ filenameid=MP_quickmode_phdname; yy_push_state(FN_MODE);}
 	YY_BREAK
 case 590:
-#line 729 "parameters_flexer.ll"
+YY_RULE_SETUP
+#line 728 "parameters_flexer.ll"
+{ return MP_quickmode_phd;}
+	YY_BREAK
 case 591:
+YY_RULE_SETUP
 #line 730 "parameters_flexer.ll"
+{ filenameid=MP_quickmode_cafname; yy_push_state(FN_MODE);}
+	YY_BREAK
 case 592:
 YY_RULE_SETUP
-#line 730 "parameters_flexer.ll"
-{return MP_ERROR_MOVED_SECTION_KS;}
+#line 731 "parameters_flexer.ll"
+{ return MP_quickmode_caf;}
 	YY_BREAK
 case 593:
-#line 732 "parameters_flexer.ll"
-case 594:
-#line 733 "parameters_flexer.ll"
-case 595:
 YY_RULE_SETUP
 #line 733 "parameters_flexer.ll"
-{BEGIN(KMERSTAT_MODE); return MP_PARSING_SECTIONCHANGE;}
-	YY_BREAK
-case 596:
-#line 735 "parameters_flexer.ll"
-case 597:
-YY_RULE_SETUP
-#line 735 "parameters_flexer.ll"
-{BEGIN(ALIGN_MODE); return MP_PARSING_SECTIONCHANGE;}
+{ filenameid=MP_dir_cwd; yy_push_state(FN_MODE);}
 	YY_BREAK
-case 598:
+case 594:
+#line 736 "parameters_flexer.ll"
+case 595:
 #line 737 "parameters_flexer.ll"
-case 599:
+case 596:
 YY_RULE_SETUP
 #line 737 "parameters_flexer.ll"
-{BEGIN(CO_MODE); return MP_PARSING_SECTIONCHANGE;}
+{ filenameid=MP_as_projectname_in; yy_push_state(FN_MODE);}
 	YY_BREAK
-case 600:
+case 597:
 #line 739 "parameters_flexer.ll"
-case 601:
+case 598:
 #line 740 "parameters_flexer.ll"
-case 602:
+case 599:
 YY_RULE_SETUP
 #line 740 "parameters_flexer.ll"
-{BEGIN(DIR_MODE); return MP_PARSING_SECTIONCHANGE;}
+{ filenameid=MP_as_projectname_out; yy_push_state(FN_MODE);}
 	YY_BREAK
-case 603:
+case 600:
 #line 742 "parameters_flexer.ll"
-case 604:
+case 601:
 YY_RULE_SETUP
 #line 742 "parameters_flexer.ll"
-{BEGIN(MI_MODE); return MP_PARSING_SECTIONCHANGE;}
+{ filenameid=MP_as_projectname; yy_push_state(FN_MODE);}
 	YY_BREAK
-case 605:
-#line 744 "parameters_flexer.ll"
-case 606:
+case 602:
 #line 745 "parameters_flexer.ll"
-case 607:
+case 603:
 #line 746 "parameters_flexer.ll"
-case 608:
+case 604:
 YY_RULE_SETUP
 #line 746 "parameters_flexer.ll"
-{BEGIN(NW_MODE); return MP_PARSING_SECTIONCHANGE;}
+{ filenameid=MP_quickmode_loadparam; yy_push_state(FN_MODE);}
 	YY_BREAK
-case 609:
-#line 748 "parameters_flexer.ll"
-case 610:
+case 605:
 YY_RULE_SETUP
 #line 748 "parameters_flexer.ll"
-{ BEGIN(PAF_MODE); return MP_PARSING_SECTIONCHANGE;}
+{ return MP_quickmode_notraceinfo;}
 	YY_BREAK
-case 611:
+case 606:
 YY_RULE_SETUP
 #line 750 "parameters_flexer.ll"
-{ return MP_params_for_common;}
+{ return MP_quickmode_clippinglight;}
 	YY_BREAK
-case 612:
+case 607:
 YY_RULE_SETUP
 #line 751 "parameters_flexer.ll"
-{ return MP_params_for_sanger;}
+{ return MP_quickmode_clippingmedium;}
 	YY_BREAK
-case 613:
+case 608:
 YY_RULE_SETUP
 #line 752 "parameters_flexer.ll"
-{ return MP_params_for_454;}
-	YY_BREAK
-case 614:
-YY_RULE_SETUP
-#line 753 "parameters_flexer.ll"
-{ return MP_params_for_iontor;}
+{ return MP_quickmode_clippingheavy;}
 	YY_BREAK
-case 615:
+case 609:
 YY_RULE_SETUP
 #line 754 "parameters_flexer.ll"
-{ return MP_params_for_pacbiolq;}
-	YY_BREAK
-case 616:
-YY_RULE_SETUP
-#line 755 "parameters_flexer.ll"
-{ return MP_params_for_pacbiohq;}
-	YY_BREAK
-case 617:
-YY_RULE_SETUP
-#line 756 "parameters_flexer.ll"
-{ return MP_params_for_text;}
-	YY_BREAK
-case 618:
-YY_RULE_SETUP
-#line 757 "parameters_flexer.ll"
-{ return MP_params_for_solexa;}
-	YY_BREAK
-case 619:
-YY_RULE_SETUP
-#line 758 "parameters_flexer.ll"
-{ return MP_params_for_solid;}
-	YY_BREAK
-case 620:
-YY_RULE_SETUP
-#line 760 "parameters_flexer.ll"
-{ return MP_silentparams_for_common;}
-	YY_BREAK
-case 621:
-YY_RULE_SETUP
-#line 761 "parameters_flexer.ll"
-{ return MP_silentparams_for_sanger;}
-	YY_BREAK
-case 622:
-YY_RULE_SETUP
-#line 762 "parameters_flexer.ll"
-{ return MP_silentparams_for_454;}
-	YY_BREAK
-case 623:
-YY_RULE_SETUP
-#line 763 "parameters_flexer.ll"
-{ return MP_silentparams_for_iontor;}
-	YY_BREAK
-case 624:
-YY_RULE_SETUP
-#line 764 "parameters_flexer.ll"
-{ return MP_silentparams_for_pacbiolq;}
-	YY_BREAK
-case 625:
-YY_RULE_SETUP
-#line 765 "parameters_flexer.ll"
-{ return MP_silentparams_for_pacbiohq;}
-	YY_BREAK
-case 626:
-YY_RULE_SETUP
-#line 766 "parameters_flexer.ll"
-{ return MP_silentparams_for_text;}
-	YY_BREAK
-case 627:
-YY_RULE_SETUP
-#line 767 "parameters_flexer.ll"
-{ return MP_silentparams_for_solexa;}
-	YY_BREAK
-case 628:
-YY_RULE_SETUP
-#line 768 "parameters_flexer.ll"
-{ return MP_silentparams_for_solid;}
-	YY_BREAK
-case 629:
-YY_RULE_SETUP
-#line 771 "parameters_flexer.ll"
-{ return MP_quickmode_borg;}
-	YY_BREAK
-case 630:
-#line 774 "parameters_flexer.ll"
-case 631:
-#line 775 "parameters_flexer.ll"
-case 632:
-YY_RULE_SETUP
-#line 775 "parameters_flexer.ll"
-{ filenameid=MP_quickmode_loadparam; yy_push_state(FN_MODE);}
-	YY_BREAK
-case 633:
-YY_RULE_SETUP
-#line 777 "parameters_flexer.ll"
-{ return MP_quickmode_hirep_something;}
-	YY_BREAK
-case 634:
-YY_RULE_SETUP
-#line 778 "parameters_flexer.ll"
-{ return MP_quickmode_hirep_good;}
-	YY_BREAK
-case 635:
-YY_RULE_SETUP
-#line 779 "parameters_flexer.ll"
-{ return MP_quickmode_hirep_best;}
-	YY_BREAK
-case 636:
-YY_RULE_SETUP
-#line 780 "parameters_flexer.ll"
 { return MP_quickmode_highlyrepetitive;}
 	YY_BREAK
-case 637:
+case 610:
 YY_RULE_SETUP
-#line 781 "parameters_flexer.ll"
+#line 755 "parameters_flexer.ll"
 { return MP_quickmode_highqualitydata;}
 	YY_BREAK
-case 638:
+case 611:
 YY_RULE_SETUP
-#line 782 "parameters_flexer.ll"
+#line 756 "parameters_flexer.ll"
 { return MP_quickmode_lowqualitydata;}
 	YY_BREAK
-case 639:
+case 612:
 YY_RULE_SETUP
-#line 785 "parameters_flexer.ll"
+#line 759 "parameters_flexer.ll"
 { BEGIN(ASKFORTECH_NOCLIPPING);}
 	YY_BREAK
-case 640:
+case 613:
 YY_RULE_SETUP
-#line 787 "parameters_flexer.ll"
+#line 761 "parameters_flexer.ll"
 { return MP_quickmode_noclipping_all;}
 	YY_BREAK
-case 641:
-#line 790 "parameters_flexer.ll"
-case 642:
+case 614:
+#line 764 "parameters_flexer.ll"
+case 615:
 YY_RULE_SETUP
-#line 790 "parameters_flexer.ll"
+#line 764 "parameters_flexer.ll"
 { return MP_quickmode_noquality_all;}
 	YY_BREAK
-case 643:
+case 616:
 YY_RULE_SETUP
-#line 792 "parameters_flexer.ll"
+#line 767 "parameters_flexer.ll"
 {BEGIN(0); return MP_PARSING_SECTIONRESET;} /*Hack for
 							     parsing command
 							     lines
                                    where each blank resets the state */
 	YY_BREAK
-case 644:
+case 617:
 YY_RULE_SETUP
-#line 796 "parameters_flexer.ll"
+#line 771 "parameters_flexer.ll"
 {return MP_ANID;}
 	YY_BREAK
-case 645:
+case 618:
 YY_RULE_SETUP
-#line 797 "parameters_flexer.ll"
+#line 772 "parameters_flexer.ll"
 {return MP_FLOAT;}
 	YY_BREAK
-case 646:
+case 619:
 YY_RULE_SETUP
-#line 798 "parameters_flexer.ll"
+#line 773 "parameters_flexer.ll"
 {return MP_INT;}
 	YY_BREAK
-case 647:
+case 620:
 YY_RULE_SETUP
-#line 800 "parameters_flexer.ll"
+#line 775 "parameters_flexer.ll"
 
 	YY_BREAK
-case 648:
+case 621:
 YY_RULE_SETUP
-#line 801 "parameters_flexer.ll"
+#line 776 "parameters_flexer.ll"
 
 	YY_BREAK
-case 649:
+case 622:
 YY_RULE_SETUP
-#line 802 "parameters_flexer.ll"
+#line 777 "parameters_flexer.ll"
 
 	YY_BREAK
-case 650:
+case 623:
 YY_RULE_SETUP
-#line 804 "parameters_flexer.ll"
+#line 779 "parameters_flexer.ll"
 {yy_push_state(COMMENT_MODE);} /* munch commentline, # is start of comment */
 	YY_BREAK
-case 651:
-/* rule 651 can match eol */
+case 624:
+/* rule 624 can match eol */
 YY_RULE_SETUP
-#line 805 "parameters_flexer.ll"
+#line 780 "parameters_flexer.ll"
 { yy_pop_state();}
 	YY_BREAK
-case 652:
-/* rule 652 can match eol */
+case 625:
+/* rule 625 can match eol */
 YY_RULE_SETUP
-#line 807 "parameters_flexer.ll"
+#line 782 "parameters_flexer.ll"
 {/* munch these, if not recognised earlier */ }
 	YY_BREAK
-case 653:
-/* rule 653 can match eol */
+case 626:
+/* rule 626 can match eol */
 YY_RULE_SETUP
-#line 809 "parameters_flexer.ll"
+#line 784 "parameters_flexer.ll"
 {return MP_ERROR_DASHES;}
 	YY_BREAK
-case 654:
+case 627:
 YY_RULE_SETUP
-#line 810 "parameters_flexer.ll"
+#line 785 "parameters_flexer.ll"
 {return MP_ERROR;}
 	YY_BREAK
-case 655:
+case 628:
 YY_RULE_SETUP
-#line 812 "parameters_flexer.ll"
+#line 787 "parameters_flexer.ll"
 ECHO;
 	YY_BREAK
-#line 7516 "parameters_flexer.cc"
+#line 7115 "parameters_flexer.cc"
 case YY_STATE_EOF(INITIAL):
 case YY_STATE_EOF(GET_UNTIL_NEWLINE):
 case YY_STATE_EOF(GE_MODE):
@@ -7530,17 +7129,14 @@ case YY_STATE_EOF(GET_SINGLECHAR_STRING_MODE):
 case YY_STATE_EOF(PAF_MODE):
 case YY_STATE_EOF(EDIT_MODE):
 case YY_STATE_EOF(SKIM_MODE):
-case YY_STATE_EOF(KMERSTAT_MODE):
 case YY_STATE_EOF(ALIGN_MODE):
+case YY_STATE_EOF(AL_GPLMODE):
 case YY_STATE_EOF(AS_MODE):
 case YY_STATE_EOF(DP_MODE):
 case YY_STATE_EOF(CO_MODE):
 case YY_STATE_EOF(DIR_MODE):
 case YY_STATE_EOF(MI_MODE):
-case YY_STATE_EOF(NW_MODE):
-case YY_STATE_EOF(NW_CHOICEMODE):
 case YY_STATE_EOF(CO_VALMODE):
-case YY_STATE_EOF(CSV_NUMBERS_MODE):
 case YY_STATE_EOF(COMMENT_MODE):
 case YY_STATE_EOF(ASKFORTECH_NOCLIPPING):
 	yyterminate();
@@ -7922,7 +7518,7 @@ int yyFlexLexer::yy_get_next_buffer()
 		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 			{
 			yy_current_state = (int) yy_def[yy_current_state];
-			if ( yy_current_state >= 6522 )
+			if ( yy_current_state >= 6095 )
 				yy_c = yy_meta[(unsigned int) yy_c];
 			}
 		yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -7950,11 +7546,11 @@ int yyFlexLexer::yy_get_next_buffer()
 	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 		{
 		yy_current_state = (int) yy_def[yy_current_state];
-		if ( yy_current_state >= 6522 )
+		if ( yy_current_state >= 6095 )
 			yy_c = yy_meta[(unsigned int) yy_c];
 		}
 	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
-	yy_is_jam = (yy_current_state == 6521);
+	yy_is_jam = (yy_current_state == 6094);
 
 	return yy_is_jam ? 0 : yy_current_state;
 }
@@ -8441,7 +8037,7 @@ void MPfree (void * ptr )
 
 #define YYTABLES_NAME "yytables"
 
-#line 812 "parameters_flexer.ll"
+#line 787 "parameters_flexer.ll"
 
 
 
@@ -8460,23 +8056,8 @@ void MPfree (void * ptr )
 <*>-{1,2}mappingnormal  { return MP_quickmode_mappingnormal;}
 <*>-{1,2}mappingaccurate { return MP_quickmode_mappingaccurate;}
 
-<GE_MODE>"projectinname" |
-<GE_MODE>"projectin" |
-<GE_MODE>"proin"                 { filenameid=MP_as_projectname_in; yy_push_state(FN_MODE);}
-<GE_MODE>"projectoutname" |
-<GE_MODE>"projectout" |
-<GE_MODE>"proout"                 { filenameid=MP_as_projectname_out; yy_push_state(FN_MODE);}
-<GE_MODE>"projectname" |
-<GE_MODE>"project" |
-<GE_MODE>"pro"                 { filenameid=MP_as_projectname; yy_push_state(FN_MODE);}
-
-<*>-{1,2}proin[\t ]*= |
-<*>-{1,2}projectin[\t ]*= |
-<*>-{1,2}projectinname[\t ]*=  { filenameid=MP_as_projectname_in; yy_push_state(FN_MODE);}
-<*>-{1,2}proout[\t ]*= |
-<*>-{1,2}projectout[\t ]*= |
-<*>-{1,2}projectoutname[\t ]*=  { filenameid=MP_as_projectname_out; yy_push_state(FN_MODE);}
-<*>-{1,2}project[\t ]*= |
-<*>-{1,2}projectname[\t ]*=  { filenameid=MP_as_projectname; yy_push_state(FN_MODE);}
+<GE_MODE>"keep_contigs_in_memory" |
+<GE_MODE>"kcim"                 { yy_push_state(ASK_YN_MODE); return MP_as_keepcontigsinmem;}
+
  */
 
diff --git a/src/mira/parameters_flexer.ll b/src/mira/parameters_flexer.ll
index 8b1b7cd..8e5c4ed 100644
--- a/src/mira/parameters_flexer.ll
+++ b/src/mira/parameters_flexer.ll
@@ -1,4 +1,4 @@
-option stack
+%option stack
 %option noyywrap
 %option c++
 %option outfile="lex.yy.c"
@@ -18,17 +18,17 @@ option stack
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
 #include <fstream>
@@ -69,21 +69,27 @@ FILENAME [/A-Za-z0-9_#.][\-/A-Za-z0-9_#.]+
 %x PAF_MODE
 %x EDIT_MODE
 %x SKIM_MODE
-%x KMERSTAT_MODE
 %x ALIGN_MODE
+%x AL_GPLMODE
 %x AS_MODE
 %x DP_MODE
 %x CO_MODE
 %x DIR_MODE
 %x MI_MODE
-%x NW_MODE
-%x NW_CHOICEMODE
 %x CO_VALMODE
-%x CSV_NUMBERS_MODE
 %x COMMENT_MODE
 %x ASKFORTECH_NOCLIPPING
 %%
 
+<GE_MODE>"projectinname" |
+<GE_MODE>"projectin" |
+<GE_MODE>"proin"                 { filenameid=MP_as_projectname_in; yy_push_state(FN_MODE);}
+<GE_MODE>"projectoutname" |
+<GE_MODE>"projectout" |
+<GE_MODE>"proout"                 { filenameid=MP_as_projectname_out; yy_push_state(FN_MODE);}
+<GE_MODE>"projectname" |
+<GE_MODE>"project" |
+<GE_MODE>"pro"                 { filenameid=MP_as_projectname; yy_push_state(FN_MODE);}
 <GE_MODE>"number_of_threads" |
 <GE_MODE>"not"                   {return MP_as_numthreads;}
 <GE_MODE>"keep_percent_memory_free" |
@@ -100,14 +106,32 @@ FILENAME [/A-Za-z0-9_#.][\-/A-Za-z0-9_#.]+
 <GE_MODE>"pd"              { yy_push_state(ASK_YN_MODE); return MP_as_nodateoutput;}
 <GE_MODE>"est_snp_pipeline_step" |
 <GE_MODE>"esps"               { return MP_sp_est_startstep;}
-<GE_MODE>"colour_reads_by_kmer_frequency" |
-<GE_MODE>"crkf"                 { yy_push_state(ASK_YN_MODE); return MP_as_buntify_reads;}
-<GE_MODE>"preprocess_only" |
-<GE_MODE>"ppo"                 { yy_push_state(ASK_YN_MODE); return MP_as_preprocess_only;}
-<GE_MODE>"bang_on_throw" |
-<GE_MODE>"bot"              { yy_push_state(ASK_YN_MODE); return MP_as_bangonthrow;}
-
-
+<GE_MODE>"use_template_information" |
+<GE_MODE>"uti"                     { yy_push_state(ASK_YN_MODE); return MP_as_use_template_information;}
+<GE_MODE>"templateinsertsizeminimum" | 
+<GE_MODE>"tismin"                    {return MP_con_insertsize_minimum;}
+<GE_MODE>"templateinsertsizemaximum" | 
+<GE_MODE>"tismax"                    {return MP_con_insertsize_maximum;}
+<GE_MODE>"templatepartnerbuilddirection" | 
+<GE_MODE>"tpbd"                      {return MP_con_template_build_direction;}
+<GE_MODE>"colour_reads_by_hash_frequency" |
+<GE_MODE>"crhf"                 { yy_push_state(ASK_YN_MODE); return MP_as_buntify_reads;}
+
+
+
+<LR_MODE>"load_sequence_data" |
+<LR_MODE>"lsd"               { yy_push_state(ASK_YN_MODE); return MP_as_load_sequencedata;}
+<LR_MODE>"file_type" |
+<LR_MODE>"ft"                 { filenameid=MP_as_infile_loadjob; yy_push_state(FN_MODE);}
+
+<LR_MODE>"solexa_scores_in_qual_file" |
+<LR_MODE>"ssiqf"               { yy_push_state(ASK_YN_MODE); return MP_as_loadSOLEXA_solexa_scores_in_qual_files;}
+<LR_MODE>"fastq_qualoffset" |
+<LR_MODE>"fqqo"              {return MP_as_fastq_qualoffset;}
+<LR_MODE>"external_quality_override" |
+<LR_MODE>"eqo"                 { yy_push_state(ASK_YN_MODE); return MP_as_external_quality_override;}
+<LR_MODE>"external_quality" |
+<LR_MODE>"eq"                  { BEGIN(LR_EQMODE); return MP_as_external_quality;}
 <LR_MODE>"wants_quality_file" |
 <LR_MODE>"wqf"              {yy_push_state(ASK_YN_MODE); return MP_as_wants_qualityfile;}
 
@@ -117,10 +141,36 @@ FILENAME [/A-Za-z0-9_#.][\-/A-Za-z0-9_#.]+
 <LR_EQMODE>{FLOAT}             { BEGIN(0); return MP_UNRECOGNISED_STRING;}
 <LR_EQMODE>{INT}               { BEGIN(0); return MP_UNRECOGNISED_STRING;}
 <LR_EQMODE>\n                  { BEGIN(0); return MP_UNRECOGNISED_STRING;}
+<LR_MODE>"discard_read_on_eq_error" |
+<LR_MODE>"droeqe"              { yy_push_state(ASK_YN_MODE); return MP_as_discard_read_on_eq_error;}
 <LR_MODE>"filecheck_only" |
 <LR_MODE>"fo"                 { yy_push_state(ASK_YN_MODE); return MP_as_filecheck_only;}
-
-
+<LR_MODE>"merge_xmltraceinfo" |
+<LR_MODE>"mxti"                 { yy_push_state(ASK_YN_MODE); return MP_as_merge_xmltraceinfo;}
+<LR_MODE>"readnaming_scheme" |
+<LR_MODE>"rns"                 { BEGIN(LR_RNSMODE); return MP_as_readnaming_scheme;}
+<LR_RNSMODE>[sS][aA][nN][gG][eE][rR] { BEGIN(LR_MODE); return SCHEME_SANGER;}
+<LR_RNSMODE>[tT][iI][gG][rR]    { BEGIN(LR_MODE); return SCHEME_TIGR;}
+<LR_RNSMODE>[fF][rR]            { BEGIN(LR_MODE); return SCHEME_FR;}
+<LR_RNSMODE>"forward/reverse"   { BEGIN(LR_MODE); return SCHEME_FR;}
+<LR_RNSMODE>[sS][tT][lL][oO][uU][iI][sI] { BEGIN(LR_MODE); return SCHEME_STLOUIS;}
+<LR_RNSMODE>[sS][oO][lL][eE][xX][aA] { BEGIN(LR_MODE); return SCHEME_SOLEXA;}
+<LR_RNSMODE>{ANID}              { BEGIN(0); return MP_UNRECOGNISED_STRING;}
+<LR_RNSMODE>{FLOAT}             { BEGIN(0); return MP_UNRECOGNISED_STRING;}
+<LR_RNSMODE>{INT}               { BEGIN(0); return MP_UNRECOGNISED_STRING;}
+<LR_RNSMODE>\n                  { BEGIN(0); return MP_UNRECOGNISED_STRING;}
+
+
+<SB_MODE>"load_straindata" |
+<SB_MODE>"lsd"                 { yy_push_state(ASK_YN_MODE); return MP_as_loadstraindata;}
+<SB_MODE>"assign_defaultstrain" |
+<SB_MODE>"ads"                 { yy_push_state(ASK_YN_MODE); return MP_as_assign_defaultstrain;}
+<SB_MODE>"dsn" |
+<SB_MODE>"default_strainname"  { filenameid=MP_as_default_strainname; yy_push_state(FN_MODE);}
+<SB_MODE>"load_backbone" |
+<SB_MODE>"lb"                 { yy_push_state(ASK_YN_MODE); return MP_as_loadbackbone;}
+<SB_MODE>"backbone_filetype" |
+<SB_MODE>"bft"                  { filenameid=MP_as_backbone_loadjob; yy_push_state(FN_MODE);}
 <SB_MODE>"backbone_raillength" |
 <SB_MODE>"brl"               { return MP_as_backbone_raillength;}
 <SB_MODE>"backbone_railoverlap" |
@@ -129,16 +179,14 @@ FILENAME [/A-Za-z0-9_#.][\-/A-Za-z0-9_#.]+
 <SB_MODE>"brfs"               { filenameid=MP_as_backbone_rail_fromstrain; yy_push_state(FN_MODE);}
 <SB_MODE>"bsnffa" |
 <SB_MODE>"backbone_strainname_forceforall"  { yy_push_state(ASK_YN_MODE); return MP_as_backbone_strainname_forceforall;}
+<SB_MODE>"bsn" |
+<SB_MODE>"backbone_strainname"  { filenameid=MP_as_backbone_strainname; yy_push_state(FN_MODE);}
 <SB_MODE>"backbone_basequals" |
 <SB_MODE>"bbq"               { return MP_as_backbone_basequals;}
 <SB_MODE>"startbackboneusage_inpass" |
 <SB_MODE>"sbuip"               { return MP_as_startbackboneusage_inpass;}
 <SB_MODE>"alsobuildnewcontigs" |
 <SB_MODE>"abnc"                 { yy_push_state(ASK_YN_MODE); return MP_as_backbone_alsobuildnewcontigs;}
-<SB_MODE>"trim_overhanging_reads" |
-<SB_MODE>"tor"                 { yy_push_state(ASK_YN_MODE); return MP_as_backbone_trimoverhangingreads;}
-<SB_MODE>"bootstrap_new_backbone" |
-<SB_MODE>"bnb"                 { yy_push_state(ASK_YN_MODE); return MP_as_backbone_bootstrapnewbackbone;}
 
 
 <CL_MODE>"msvs_strict_front_clip" |
@@ -151,6 +199,8 @@ FILENAME [/A-Za-z0-9_#.][\-/A-Za-z0-9_#.]+
 <CL_MODE>"msvsmfg"             { return MP_as_clip_ssahamerge_maxfrontgap;}
 <CL_MODE>"msvs_max_end_gap" |
 <CL_MODE>"msvsmeg"             { return MP_as_clip_ssahamerge_maxendgap;}
+<CL_MODE>"merge_ssahavectorscreen" |
+<CL_MODE>"msvs"                 { yy_push_state(ASK_YN_MODE); return MP_as_clip_mergessahavectorscreen;}
 <CL_MODE>"possible_vector_leftover_clip" |
 <CL_MODE>"pvlc"                { yy_push_state(ASK_YN_MODE); return MP_as_clip_possible_vectors;}
 <CL_MODE>"pvc_maxlenallowed" |
@@ -175,10 +225,8 @@ FILENAME [/A-Za-z0-9_#.][\-/A-Za-z0-9_#.]+
 <CL_MODE>"mbcmeg"             { return MP_as_clip_maskedbases_maxendgap;}
 <CL_MODE>"maskedbase_clip" |
 <CL_MODE>"mbc"                { yy_push_state(ASK_YN_MODE); return MP_as_clip_maskedbases;}
-<CL_MODE>"lowercase_clip_front" |
-<CL_MODE>"lccf"                { yy_push_state(ASK_YN_MODE); return MP_as_clip_lowercase_front;}
-<CL_MODE>"lowercase_clip_back" |
-<CL_MODE>"lccb"                { yy_push_state(ASK_YN_MODE); return MP_as_clip_lowercase_back;}
+<CL_MODE>"lowercase_clip" |
+<CL_MODE>"lcc"                { yy_push_state(ASK_YN_MODE); return MP_as_clip_lowercase;}
 <CL_MODE>"ensure_minimum_left_clip" |
 <CL_MODE>"emlc"               { yy_push_state(ASK_YN_MODE); return MP_as_clip_ensureminimumleftclip;}
 <CL_MODE>"minimum_left_clip_required" |
@@ -206,55 +254,29 @@ FILENAME [/A-Za-z0-9_#.][\-/A-Za-z0-9_#.]+
 
 <CL_MODE>"clip_polyat" |
 <CL_MODE>"cpat"              {yy_push_state(ASK_YN_MODE); return MP_as_clip_polyat;}
-<CL_MODE>"cp_keep_poly_stretch" |
-<CL_MODE>"cpkps"              {yy_push_state(ASK_YN_MODE); return MP_as_clip_polyat_keeppolystretch;}
-<CL_MODE>"cp_min_sequence_len" |
+<CL_MODE>"cp_keep_poly_signal" |
+<CL_MODE>"cpkps"              {yy_push_state(ASK_YN_MODE); return MP_as_clip_polyat_keeppolysignal;}
+<CL_MODE>"cp_min_signal_len" |
 <CL_MODE>"cpmsl"              {return MP_as_clip_polyat_len;}
 <CL_MODE>"cp_max_errors_allowed" |
 <CL_MODE>"cpmea"              {return MP_as_clip_polyat_maxerrors;}
 <CL_MODE>"cp_max_gap_from_ends" |
 <CL_MODE>"cpmgfe"              {return MP_as_clip_polyat_maxgap;}
 
-<CL_MODE>"pec_kmer_size" |
-<CL_MODE>"peckms"             { return MP_as_clip_pec_basesperhash;}
 <CL_MODE>"pec_bases_per_hash" |
-<CL_MODE>"pecbph"                { return MP_ERROR_RENAMED_BPH_KMER;}
+<CL_MODE>"pecbph"                { return MP_as_clip_pec_basesperhash;}
 <CL_MODE>"propose_end_clip" |
 <CL_MODE>"pec"                { yy_push_state(ASK_YN_MODE); return MP_as_clip_proposeendclips;}
 <CL_MODE>"handle_solexa_ggcxg_problem" |
 <CL_MODE>"pechsgp"            { yy_push_state(ASK_YN_MODE); return MP_as_clip_pec_sxaggcxg;}
-<CL_MODE>"pffreq"            { return MP_as_clip_pec_ffreq;}
-<CL_MODE>"pbfreq"            { return MP_as_clip_pec_bfreq;}
-<CL_MODE>"pmkfr" |
-<CL_MODE>"pec_minimum_kmer_forward_reverse"     { return MP_as_clip_pec_mkfr;}
-<CL_MODE>"pmtk" |
-<CL_MODE>"pec_minimum_total_kmer"     { return MP_as_clip_pec_mtk;}
-<CL_MODE>"pffore"              { yy_push_state(ASK_YN_MODE); return MP_as_clip_pec_ffr;}
-<CL_MODE>"pbfore"              { yy_push_state(ASK_YN_MODE); return MP_as_clip_pec_bfr;}
-<CL_MODE>"pfcmst"            { yy_push_state(ASK_YN_MODE); return MP_as_clip_pec_fcmst;}
-<CL_MODE>"pbcmst"            { yy_push_state(ASK_YN_MODE); return MP_as_clip_pec_bcmst;}
-<CL_MODE>"pfsalp"            { yy_push_state(ASK_YN_MODE); return MP_as_clip_pec_fsalp;}
-<CL_MODE>"pbsalp"            { yy_push_state(ASK_YN_MODE); return MP_as_clip_pec_bsalp;}
-<CL_MODE>"gb_chimeradetectionclip" |
-<CL_MODE>"gbcdc"              { yy_push_state(ASK_YN_MODE); return MP_as_clip_sdbg_chimeradetection;}
-<CL_MODE>"kmerjunk_detection" |
-<CL_MODE>"kjd"              { yy_push_state(ASK_YN_MODE); return MP_as_clip_kmer_junkdetection;}
-<CL_MODE>"kmerjunk_completekill" |
-<CL_MODE>"kjck"              { yy_push_state(ASK_YN_MODE); return MP_as_clip_kmer_junkkill;}
 <CL_MODE>"apply_skim_chimeradetectionclip" |
 <CL_MODE>"ascdc"              { yy_push_state(ASK_YN_MODE); return MP_as_clip_skimchimeradetection;}
 <CL_MODE>"apply_skim_junkdetectionclip" |
 <CL_MODE>"asjdc"              { yy_push_state(ASK_YN_MODE); return MP_as_clip_skimjunkdetection;}
 <CL_MODE>"clip_bad_solexaends" |
 <CL_MODE>"cbse"                { yy_push_state(ASK_YN_MODE); return MP_as_clip_badsolexaends;}
-<CL_MODE>"search_phix174" |
-<CL_MODE>"spx174"                { yy_push_state(ASK_YN_MODE); return MP_as_search_phix174;}
-<CL_MODE>"filter_phix174" |
-<CL_MODE>"fpx174"                { yy_push_state(ASK_YN_MODE); return MP_as_filter_phix174;}
 <CL_MODE>"clip_known_adaptorsright" |
 <CL_MODE>"ckar"                { yy_push_state(ASK_YN_MODE); return MP_as_clip_knownadaptorsright;}
-<CL_MODE>"rare_kmer_mask" |
-<CL_MODE>"rkm"                { yy_push_state(ASK_YN_MODE); return MP_as_clipmask_rarekmers;}
 
 
 
@@ -341,28 +363,60 @@ FILENAME [/A-Za-z0-9_#.][\-/A-Za-z0-9_#.]+
 <ASK_YN_MODE>[fF][aA][lL][sS][eE] {yy_pop_state(); return 0;}
 <ASK_YN_MODE>[yY][eE][sS]      {yy_pop_state(); return 1;}
 <ASK_YN_MODE>[nN][oO]          {yy_pop_state(); return 0;}
-<ASK_YN_MODE>[yYtT]      {yy_pop_state(); return 1;}
-<ASK_YN_MODE>[nNfF]      {yy_pop_state(); return 0;}
-<ASK_YN_MODE>[= \t]               {}
-<ASK_YN_MODE>.               {yy_pop_state(); return MP_UNRECOGNISED_STRING;}
-
+<ASK_YN_MODE>"1"               {yy_pop_state(); return 1;}
+<ASK_YN_MODE>"0"               {yy_pop_state(); return 0;}
+<ASK_YN_MODE>{ANID}               {yy_pop_state(); return MP_UNRECOGNISED_STRING;}
+<ASK_YN_MODE>{FLOAT}               {yy_pop_state(); return MP_UNRECOGNISED_STRING;}
+<ASK_YN_MODE>{INT}               {yy_pop_state(); return MP_UNRECOGNISED_STRING;}
+<ASK_YN_MODE>\n               {yy_pop_state(); return MP_UNRECOGNISED_STRING;}
+
+<DIR_MODE>"gap4da"            {filenameid=MP_dir_gap4da; yy_push_state(FN_MODE); }
 <DIR_MODE>"tmp_redirected_to" |
 <DIR_MODE>"trt"               {filenameid=MP_dir_tmp_redirectedto; yy_push_state(FN_MODE); }
+<DIR_MODE>"cwd"               {filenameid=MP_dir_cwd; yy_push_state(FN_MODE); }
 <DIR_MODE>"tmp"               {filenameid=MP_dir_tmp; yy_push_state(FN_MODE); }
+<DIR_MODE>"exp"               {filenameid=MP_dir_exp; yy_push_state(FN_MODE); }
+<DIR_MODE>"scf"               {filenameid=MP_dir_scf; yy_push_state(FN_MODE); }
+<DIR_MODE>"fasta"             {filenameid=MP_dir_fasta; yy_push_state(FN_MODE); }
+
+<FILE_MODE>"cafin" | 
+<FILE_MODE>"ci"                    { filenameid=MP_fn_cafin; yy_push_state(FN_MODE); }
+<FILE_MODE>"cafout" |
+<FILE_MODE>"co"                    { filenameid=MP_fn_cafout; yy_push_state(FN_MODE); }
+<FILE_MODE>"fofnexpin" |
+<FILE_MODE>"fei"                    { filenameid=MP_fn_fofnexpin; yy_push_state(FN_MODE); }
+<FILE_MODE>"fofnphdin" |
+<FILE_MODE>"fpi"                    { filenameid=MP_fn_fofnphdin; yy_push_state(FN_MODE); }
+<FILE_MODE>"phdin" |
+<FILE_MODE>"pi"                    { filenameid=MP_fn_phdin; yy_push_state(FN_MODE); }
+<FILE_MODE>"fastqin" |
+<FILE_MODE>"fqi"                    { filenameid=MP_fn_fastqin; yy_push_state(FN_MODE); }
+<FILE_MODE>"fastain" |
+<FILE_MODE>"fai"                    { filenameid=MP_fn_fastain; yy_push_state(FN_MODE); }
+<FILE_MODE>"fastaqualin" |
+<FILE_MODE>"fqui"                   { filenameid=MP_fn_fastaqualin; yy_push_state(FN_MODE); }
+<FILE_MODE>"straindatain" |
+<FILE_MODE>"sdi"                    { filenameid=MP_fn_straindatain; yy_push_state(FN_MODE); }
+<FILE_MODE>"xmltraceinfoin" |
+<FILE_MODE>"xtii"                    { filenameid=MP_fn_xmltraceinfoin; yy_push_state(FN_MODE); }
+<FILE_MODE>"ssahavectorscreenin" |
+<FILE_MODE>"ssvsi"                    { filenameid=MP_fn_ssahavectorscreenin; yy_push_state(FN_MODE); }
+<FILE_MODE>"smaltvectorscreenin" |
+<FILE_MODE>"stvsi"                    { filenameid=MP_fn_smaltvectorscreenin; yy_push_state(FN_MODE); }
+<FILE_MODE>"backbonein" | 
+<FILE_MODE>"bbin"                    { filenameid=MP_fn_backbonein; yy_push_state(FN_MODE); }
 
 <FN_MODE>{FILENAME}          { yy_pop_state(); return filenameid;}
 
 
 <AS_MODE>"minimum_read_length" |
 <AS_MODE>"mrl"                   { return MP_as_minimum_readlength;}
-<AS_MODE>"minimum_reads_per_contig" |
+<AS_MODE>"minimum_read_per_contig" |
 <AS_MODE>"mrpc"                   { return MP_as_minimum_readspercontig;}
 <AS_MODE>"num_of_passes" |
-<AS_MODE>"nop"               { return(MP_as_numpasses);}
-<AS_MODE>"kms" |
-<AS_MODE>"kmer_series"       { yy_push_state(CSV_NUMBERS_MODE); return MP_as_kmerseries;}
+<AS_MODE>"nop"                 { return(MP_as_numpasses);}
 <AS_MODE>"skim_each_pass" |
-<AS_MODE>"sep"                 { return MP_ERROR_REMOVED;}
+<AS_MODE>"sep"                 { yy_push_state(ASK_YN_MODE); return(MP_as_skimeachpass);}
 <AS_MODE>"rmb_break_loops" |
 <AS_MODE>"rbl"                   { return MP_as_numrmbbreakloops;}
 <AS_MODE>"max_contigs_per_pass" |
@@ -371,8 +425,6 @@ FILENAME [/A-Za-z0-9_#.][\-/A-Za-z0-9_#.]+
 <AS_MODE>"sd"               { yy_push_state(ASK_YN_MODE); return MP_as_spoiler_detection;}
 <AS_MODE>"sd_last_pass_only" |
 <AS_MODE>"sdlpo"               { yy_push_state(ASK_YN_MODE); return MP_as_sd_lastpassonly;}
-<AS_MODE>"use_run_length_encoding" |
-<AS_MODE>"urle"                { yy_push_state(ASK_YN_MODE); return(MP_as_rle_reads);}
 <AS_MODE>"automatic_repeat_detection" |
 <AS_MODE>"ard"             { yy_push_state(ASK_YN_MODE); return MP_as_automatic_repeat_detection;}
 <AS_MODE>"coverage_threshold" |
@@ -387,6 +439,8 @@ FILENAME [/A-Za-z0-9_#.][\-/A-Za-z0-9_#.]+
 <AS_MODE>"urdsip"             { return MP_as_urd_startinpass;}
 <AS_MODE>"uniform_read_distribution" |
 <AS_MODE>"urd"               { yy_push_state(ASK_YN_MODE); return MP_as_uniform_read_distribution;}
+<AS_MODE>"keep_long_repeats_separated" |
+<AS_MODE>"klrs"             { yy_push_state(ASK_YN_MODE); return MP_as_keep_long_repeats_separated;}
 <AS_MODE>"use_genomic_pathfinder" |
 <AS_MODE>"ugpf"               { yy_push_state(ASK_YN_MODE); return MP_paf_use_genomic_pathfinder;}
 <AS_MODE>"use_emergency_search_stop" |
@@ -399,10 +453,11 @@ FILENAME [/A-Za-z0-9_#.][\-/A-Za-z0-9_#.]+
 <AS_MODE>"umcbt"              {yy_push_state(ASK_YN_MODE); return MP_paf_use_max_contig_buildtime;}
 <AS_MODE>"buildtime_in_seconds" |
 <AS_MODE>"bts"              {return MP_paf_buildtime_inseconds;}
+<AS_MODE>"base_default_quality" |
+<AS_MODE>"bdq"              {return MP_as_basedefaultqual;}
 <AS_MODE>"enforce_presence_of_qualities" |
 <AS_MODE>"epoq"              {yy_push_state(ASK_YN_MODE); return MP_as_enforce_qualsinreads;}
 
-<CSV_NUMBERS_MODE>[0-9, \t]+       { yy_pop_state(); return filenameid;}
 
 <DP_MODE>"use_read_extension" |
 <DP_MODE>"ure"                 { yy_push_state(ASK_YN_MODE); return MP_as_extend_reads;}
@@ -416,17 +471,8 @@ FILENAME [/A-Za-z0-9_#.][\-/A-Za-z0-9_#.]+
 <DP_MODE>"leip"              {return MP_as_readextension_lastpassnum;}
 
 
-<EDIT_MODE>"gb_read_editing" |
-<EDIT_MODE>"gbre"                 { yy_push_state(ASK_YN_MODE); return MP_ed_sdbg_readedit;}
-<EDIT_MODE>"mira_automatic_contig_editing" |
-<EDIT_MODE>"mace"                 { yy_push_state(ASK_YN_MODE); return MP_ed_mira_automatic_contig_editing;}
-<EDIT_MODE>"edit_kmer_singlets"
-<EDIT_MODE>"eks"                 { yy_push_state(ASK_YN_MODE); return MP_ed_kmer_singlets;}
-<EDIT_MODE>"edit_homopolymer_overcalls"
-<EDIT_MODE>"ehpo"                 { yy_push_state(ASK_YN_MODE); return MP_ed_homopolymer_overcalls;}
-
-<EDIT_MODE>"edit_automatic_contig_editing" |
-<EDIT_MODE>"eace"                 { yy_push_state(ASK_YN_MODE); return MP_ed_edit_automatic_contig_editing;}
+<EDIT_MODE>"automatic_contig_editing" |
+<EDIT_MODE>"ace"                 { yy_push_state(ASK_YN_MODE); return MP_ed_automatic_contig_editing;}
 <EDIT_MODE>"strict_editing_mode" |
 <EDIT_MODE>"sem"                 { yy_push_state(ASK_YN_MODE); return MP_ed_strict;}
 <EDIT_MODE>"confirmation_threshold" |
@@ -434,87 +480,41 @@ FILENAME [/A-Za-z0-9_#.][\-/A-Za-z0-9_#.]+
 
 <SKIM_MODE>"number_of_threads" |
 <SKIM_MODE>"not"                   {return MP_sk_numthreads;}
-<SKIM_MODE>"kmsmax"                   {return MP_sk_bph_max;}
-<SKIM_MODE>"kmsaipp"                   {return MP_sk_bph_increasestep;}
 <SKIM_MODE>"bases_per_hash" |
-<SKIM_MODE>"bph"                    { return MP_ERROR_RENAMED_BPH_KMER;}
+<SKIM_MODE>"bph"                   {return MP_sk_basesperhash;}
 <SKIM_MODE>"hash_save_stepping" |
-<SKIM_MODE>"hss"                   {return MP_ERROR_RENAMED_BPH_KMER;}
-<SKIM_MODE>"kmer_size" |
-<SKIM_MODE>"kms"                   {return MP_sk_basesperhash;}
-<SKIM_MODE>"kmer_save_stepping" |
-<SKIM_MODE>"kss"                   {return MP_sk_hashsavestepping;}
+<SKIM_MODE>"hss"                   {return MP_sk_hashsavestepping;}
 <SKIM_MODE>"percent_required" |
 <SKIM_MODE>"pr"                   {return MP_sk_percentrequired;}
 <SKIM_MODE>"maxhits_perread" |
 <SKIM_MODE>"mhpr"                 {return MP_sk_maxhitsperread;}
 <SKIM_MODE>"maxhashesinmemory" |
-<SKIM_MODE>"mhim"                 {return MP_ERROR_RENAMED_BPH_KMER;}
-<SKIM_MODE>"maxkmersinmemory" |
-<SKIM_MODE>"mkim"                 {return MP_sk_maxhashesinmemory;}
+<SKIM_MODE>"mhim"                 {return MP_sk_maxhashesinmemory;}
 <SKIM_MODE>"memcap_hitreduction" |
 <SKIM_MODE>"mchr"                 {return MP_sk_memcaphitreduction;}
+<SKIM_MODE>"mask_nasty_repeats" |
+<SKIM_MODE>"mnr"                 {yy_push_state(ASK_YN_MODE); return MP_sk_masknastyrepeats;}
 <SKIM_MODE>"also_compute_reverse_complements" |
 <SKIM_MODE>"acrc"                {yy_push_state(ASK_YN_MODE); return MP_sk_alsoskimrevcomp;}
 <SKIM_MODE>"sw_check_on_backbones" |
 <SKIM_MODE>"swcob"                {yy_push_state(ASK_YN_MODE); return MP_sk_swcheckonbackbones;}
-<SKIM_MODE>"filter_megahubs" |
-<SKIM_MODE>"fmh"                {yy_push_state(ASK_YN_MODE); return MP_sk_filtermegahubs;}
+<SKIM_MODE>"nasty_repeat_ratio" |
+<SKIM_MODE>"nrr"                 {return MP_sk_nastyrepeatratio;}
+<SKIM_MODE>"repeatlevel_in_infofile" |
+<SKIM_MODE>"rliif"                 {return MP_sk_repeatlevel_in_infofile;}
 <SKIM_MODE>"max_megahub_ratio" |
 <SKIM_MODE>"mmhr"                 {return MP_sk_maxmegahubratio;}
-<SKIM_MODE>"megahub_cap" |
-<SKIM_MODE>"mhc"                 {return MP_sk_megahubcap;}
 
-<SKIM_MODE>"nasty_repeat_ratio" |
-<SKIM_MODE>"nrr"                 {return MP_ERROR_MOVED_SECTION_KS;}
-<SKIM_MODE>"nasty_repeat_coverage" |
-<SKIM_MODE>"nrc"                 {return MP_ERROR_MOVED_SECTION_KS;}
-<SKIM_MODE>"repeatlevel_in_infofile" |
-<SKIM_MODE>"rliif"                 {return MP_ERROR_MOVED_SECTION_KS;}
-<SKIM_MODE>"mask_nasty_repeats" |
-<SKIM_MODE>"mnr"                 { return MP_ERROR_MOVED_SECTION_KS;}
-<SKIM_MODE>"freq_covestmin" |
-<SKIM_MODE>"fcem"                 {return MP_ERROR_MOVED_SECTION_KS;}
 <SKIM_MODE>"freq_est_minnormal" |
-<SKIM_MODE>"fenn"                 {return MP_ERROR_MOVED_SECTION_KS;}
+<SKIM_MODE>"fenn"                 {return MP_sk_freqest_minnormal;}
 <SKIM_MODE>"freq_est_maxnormal" |
-<SKIM_MODE>"fexn"                 {return MP_ERROR_MOVED_SECTION_KS;}
+<SKIM_MODE>"fexn"                 {return MP_sk_freqest_maxnormal;}
 <SKIM_MODE>"freq_est_repeat" |
-<SKIM_MODE>"fer"                 {return MP_ERROR_MOVED_SECTION_KS;}
+<SKIM_MODE>"fer"                 {return MP_sk_freqest_repeat;}
 <SKIM_MODE>"freq_est_heavyrepeat" |
-<SKIM_MODE>"fehr"                 {return MP_ERROR_MOVED_SECTION_KS;}
+<SKIM_MODE>"fehr"                 {return MP_sk_freqest_heavyrepeat;}
 <SKIM_MODE>"freq_est_crazyrepeat" |
-<SKIM_MODE>"fecr"                 {return MP_ERROR_MOVED_SECTION_KS;}
-
-
-<KMERSTAT_MODE>"nasty_repeat_ratio" |
-<KMERSTAT_MODE>"nrr"                 {return MP_hs_nastyrepeatratio;}
-<KMERSTAT_MODE>"nasty_repeat_coverage" |
-<KMERSTAT_MODE>"nrc"                 {return MP_hs_nastyrepeatcoverage;}
-<KMERSTAT_MODE>"repeatlevel_in_infofile" |
-<KMERSTAT_MODE>"rliif"                 {return MP_hs_repeatlevel_in_infofile;}
-<KMERSTAT_MODE>"mask_nasty_repeats" |
-<KMERSTAT_MODE>"mnr"                 {yy_push_state(ASK_YN_MODE); return MP_hs_masknastyrepeats;}
-<KMERSTAT_MODE>"freq_covestmin" |
-<KMERSTAT_MODE>"fcem"                 {return MP_hs_freq_covestmin;}
-<KMERSTAT_MODE>"freq_est_minnormal" |
-<KMERSTAT_MODE>"fenn"                 {return MP_hs_freqest_minnormal;}
-<KMERSTAT_MODE>"freq_est_maxnormal" |
-<KMERSTAT_MODE>"fexn"                 {return MP_hs_freqest_maxnormal;}
-<KMERSTAT_MODE>"freq_est_repeat" |
-<KMERSTAT_MODE>"fer"                 {return MP_hs_freqest_repeat;}
-<KMERSTAT_MODE>"freq_est_heavyrepeat" |
-<KMERSTAT_MODE>"fehr"                 {return MP_hs_freqest_heavyrepeat;}
-<KMERSTAT_MODE>"freq_est_crazyrepeat" |
-<KMERSTAT_MODE>"fecr"                 {return MP_hs_freqest_crazyrepeat;}
-<KMERSTAT_MODE>"lossless_digital_normalisation" |
-<KMERSTAT_MODE>"ldn"                 {yy_push_state(ASK_YN_MODE); return MP_hs_applydigitalnormalisation;}
-<KMERSTAT_MODE>"rare_kmer_final_kill" |
-<KMERSTAT_MODE>"rkfk"                 {return MP_hs_rare_kmer_final_kill;}
-<KMERSTAT_MODE>"million_hashes_per_buffer" |
-<KMERSTAT_MODE>"mhpb"                 {return MP_ERROR_MOVED_SECTION_KS;}
-<KMERSTAT_MODE>"million_kmers_per_buffer" |
-<KMERSTAT_MODE>"mkpb"                 {return MP_hs_million_hashes_per_buffer;}
+<SKIM_MODE>"fecr"                 {return MP_sk_freqest_crazyrepeat;}
 
 
 
@@ -531,20 +531,28 @@ FILENAME [/A-Za-z0-9_#.][\-/A-Za-z0-9_#.]+
 <ALIGN_MODE>"min_relative_score" |
 <ALIGN_MODE>"mrs"                  {return MP_al_min_relscore;}
 <ALIGN_MODE>"egp_level" |
-<ALIGN_MODE>"egpl"                 { yy_push_state(CSV_NUMBERS_MODE); return MP_ads_gp_functionstring;}
+<ALIGN_MODE>"egpl"                 {BEGIN(AL_GPLMODE); return MP_ads_gp_level;}
 <ALIGN_MODE>"extra_gap_penalty" |
 <ALIGN_MODE>"egp"                  { yy_push_state(ASK_YN_MODE); return MP_ads_extra_gap_penalty;}
 <ALIGN_MODE>"max_egp_percent" |
 <ALIGN_MODE>"megpp"                  {return MP_ads_max_gppercent;}
-<ALIGN_MODE>"enforce_clean_ends" |
-<ALIGN_MODE>"ece"                  { yy_push_state(ASK_YN_MODE); return MP_ads_enforce_clean_ends;}
-<ALIGN_MODE>"clean_end_distance" |
-<ALIGN_MODE>"ced"                  {return MP_ads_clean_end_distance;}
-<ALIGN_MODE>"clean_end_mismatch_allowed" |
-<ALIGN_MODE>"cema"                  {return MP_ads_clean_end_mismatchallowed;}
 <ALIGN_MODE>"solexahack_maxerrors" |
 <ALIGN_MODE>"shme"                   {return MP_al_solexahack_maxerrors;}
-
+<AL_GPLMODE>"10" |
+<AL_GPLMODE>"reject_codongaps"   {BEGIN(ALIGN_MODE); return 10;}
+<AL_GPLMODE>"0" |
+<AL_GPLMODE>"low"                  {BEGIN(ALIGN_MODE); return 0;}
+<AL_GPLMODE>"1" |
+<AL_GPLMODE>"medium"               {BEGIN(ALIGN_MODE); return 1;}
+<AL_GPLMODE>"2" |
+<AL_GPLMODE>"high"                 {BEGIN(ALIGN_MODE); return 2;}
+<AL_GPLMODE>{ANID}              {BEGIN(ALIGN_MODE); return MP_UNRECOGNISED_STRING;}
+<AL_GPLMODE>{FLOAT}             {BEGIN(ALIGN_MODE); return MP_UNRECOGNISED_STRING;}
+<AL_GPLMODE>{INT}               {BEGIN(ALIGN_MODE); return MP_UNRECOGNISED_STRING;}
+<AL_GPLMODE>\n                  {BEGIN(ALIGN_MODE); return MP_UNRECOGNISED_STRING;}
+
+<CO_MODE>"use_template_information" |
+<CO_MODE>"uti"                     { yy_push_state(ASK_YN_MODE); return MP_as_use_template_information;}
 <CO_MODE>"analysis" |
 <CO_MODE>"an"                      {BEGIN(CO_VALMODE); return MP_con_analyse_mode;}
 <CO_VALMODE>"none"                 {BEGIN(CO_MODE); return 0;}
@@ -554,11 +562,9 @@ FILENAME [/A-Za-z0-9_#.][\-/A-Za-z0-9_#.]+
 <CO_VALMODE>{FLOAT}             {BEGIN(CO_MODE); return MP_UNRECOGNISED_STRING;}
 <CO_VALMODE>{INT}               {BEGIN(CO_MODE); return MP_UNRECOGNISED_STRING;}
 <CO_VALMODE>\n               {BEGIN(CO_MODE); return MP_UNRECOGNISED_STRING;}
-<CO_MODE>"rej_on_dropinrelscore" |
+<CO_MODE>"rej_on_dropinrelscore" | 
 <CO_MODE>"rodirs"                  {return MP_con_rodirs;}
-<CO_MODE>"cmin_relative_score" |
-<CO_MODE>"cmrs"                  {return MP_con_min_relscore;}
-<CO_MODE>"danger_max_error_rate" |
+<CO_MODE>"danger_max_error_rate" | 
 <CO_MODE>"dmer"                    {return MP_con_danger_max_error_rate;}
 <CO_MODE>"mark_repeats" |
 <CO_MODE>"mr"                 { yy_push_state(ASK_YN_MODE); return MP_as_mark_repeats;}
@@ -567,16 +573,16 @@ FILENAME [/A-Za-z0-9_#.][\-/A-Za-z0-9_#.]+
 <CO_MODE>"mroir"                 { yy_push_state(ASK_YN_MODE); return MP_as_mark_repeats_only_in_result;}
 <CO_MODE>"assume_snp_instead_repeat" |
 <CO_MODE>"asir"                 { yy_push_state(ASK_YN_MODE); return MP_con_assume_snp_insteadof_rmb;}
-<CO_MODE>"min_rmb_neighbour_qual" |
-<CO_MODE>"min_rmb_neighbor_qual" |
+<CO_MODE>"min_rmb_neighbour_qual" | 
+<CO_MODE>"min_rmb_neighbor_qual" | 
 <CO_MODE>"mnq"                    {return MP_con_min_rmb_neighbourqual;}
-<CO_MODE>"min_reads_per_group" |
+<CO_MODE>"min_reads_per_group" | 
 <CO_MODE>"mrpg"                    {return MP_con_min_readspergroup;}
-<CO_MODE>"min_groupqual_for_rmb_tagging" |
+<CO_MODE>"min_groupqual_for_rmb_tagging" | 
 <CO_MODE>"mgqrt"                    {return MP_con_min_groupqual_for_rmb_tagging;}
-<CO_MODE>"emea_set1_on_clipping_pec" |
+<CO_MODE>"emea_set1_on_clipping_pec" | 
 <CO_MODE>"emeas1clpec"              {return MP_con_emea_setzero_on_clipping_pec;}
-<CO_MODE>"endread_mark_exclusion_area" |
+<CO_MODE>"endread_mark_exclusion_area" | 
 <CO_MODE>"emea"                    {return MP_con_endread_mark_exclusion_area;}
 <CO_MODE>"also_mark_gap_bases_even_multicolumn" |
 <CO_MODE>"amgbemc"                 { yy_push_state(ASK_YN_MODE); return MP_con_also_mark_gap_bases_evenmc;}
@@ -584,60 +590,30 @@ FILENAME [/A-Za-z0-9_#.][\-/A-Za-z0-9_#.]+
 <CO_MODE>"amgbnbs"                 { yy_push_state(ASK_YN_MODE); return MP_con_also_mark_gap_bases_needbothstrands;}
 <CO_MODE>"also_mark_gap_bases" |
 <CO_MODE>"amgb"                 { yy_push_state(ASK_YN_MODE); return MP_con_also_mark_gap_bases;}
-<CO_MODE>"name_prefix" |
-<CO_MODE>"name" |
+<CO_MODE>"name_prefix" | 
+<CO_MODE>"name" | 
 <CO_MODE>"np"                    {filenameid=MP_con_name_prefix; yy_push_state(FN_MODE);}
 <CO_MODE>"force_nonIUPACconsensus_perseqtype" |
-<CO_MODE>"fnic"               { yy_push_state(ASK_YN_MODE); return MP_con_force_nonIUPACconsensus;}
-<CO_MODE>"msr_maxerrors" |
-<CO_MODE>"msrme"               { return MP_con_msr_maxerrors;}
+<CO_MODE>"fnicpst"               { yy_push_state(ASK_YN_MODE); return MP_con_force_nonIUPACconsensus_perseqtype;}
+<CO_MODE>"force_nonIUPACconsensus_amongseqtypes" |
+<CO_MODE>"fnicast"               { yy_push_state(ASK_YN_MODE); return MP_con_force_nonIUPACconsensus_amongseqtypes;}
 <CO_MODE>"msr_keepcontigendsunmerged" |
 <CO_MODE>"msrkceu"               { return MP_con_msr_keependsunmapped;}
 <CO_MODE>"merge_short_reads" |
 <CO_MODE>"msr"               { yy_push_state(ASK_YN_MODE); return MP_con_mergeshortreads;}
-<CO_MODE>"gap_override_ratio" |
+<CO_MODE>"gap_override_ratio" | 
 <CO_MODE>"gor"                    {return MP_con_gap_override_ratio;}
 
+<MI_MODE>"stop_on_nfs" |
+<MI_MODE>"sonfs"                  { yy_push_state(ASK_YN_MODE); return MP_mi_stoponnfs;}
 <MI_MODE>"extended_log" |
 <MI_MODE>"el"                  { yy_push_state(ASK_YN_MODE); return MP_mi_extendedlog;}
-<MI_MODE>"iknowwhatido" |
-<MI_MODE>"ikwid"                  { yy_push_state(ASK_YN_MODE); return MP_mi_iknowwhatido;}
 <MI_MODE>"large_contig_size_for_stats" |
 <MI_MODE>"lcs4s"                  { return MP_mi_as_largecontigsize4stats;}
 <MI_MODE>"large_contig_size" |
 <MI_MODE>"lcs"                  { return MP_mi_as_largecontigsize;}
-<MI_MODE>"ef1"                  { yy_push_state(ASK_YN_MODE); return MP_mi_extra_flag1;}
-<MI_MODE>"ef2"                  { yy_push_state(ASK_YN_MODE); return MP_mi_extra_flag2;}
-<MI_MODE>"ef3"                  { yy_push_state(ASK_YN_MODE); return MP_mi_extra_flag3;}
-<MI_MODE>"sonfs"                { return MP_ERROR_MOVED_SECTION_NW;}
-<MI_MODE>"somrnl"               { return MP_ERROR_MOVED_SECTION_NW;}
-
-<NW_MODE>"check_nfs" |
-<NW_MODE>"cnfs"                  { yy_push_state(NW_CHOICEMODE); return MP_nw_check_nfs;}
-<NW_MODE>"check_template_problems" |
-<NW_MODE>"ctp"                  { yy_push_state(NW_CHOICEMODE); return MP_nw_check_templateproblems;}
-<NW_MODE>"check_duplicate_readnames" |
-<NW_MODE>"cdrn"                  { yy_push_state(NW_CHOICEMODE); return MP_nw_check_duplicatereadnames;}
-<NW_MODE>"check_sra_readnames" |
-<NW_MODE>"csrn"                  { yy_push_state(NW_CHOICEMODE); return MP_nw_check_readnamesra;}
-<NW_MODE>"check_maxreadnamelength" |
-<NW_MODE>"cmrnl"                  { yy_push_state(NW_CHOICEMODE); return MP_nw_check_maxreadnamelength;}
-<NW_MODE>"maxreadnamelength" |
-<NW_MODE>"mrnl"                  { return MP_nw_check_mrnlvalue;}
-<NW_MODE>"check_multipassmapping" |
-<NW_MODE>"cmpm"                  { yy_push_state(NW_CHOICEMODE); return MP_nw_check_multipassmapping;}
-<NW_MODE>"check_average_coverage" |
-<NW_MODE>"cac"                  { yy_push_state(NW_CHOICEMODE); return MP_nw_check_coverage;}
-<NW_MODE>"average_coverage_value" |
-<NW_MODE>"acv"                  { return MP_nw_check_covvalue;}
-
-<NW_CHOICEMODE>"no"          {yy_pop_state(); return 0;}
-<NW_CHOICEMODE>"stop"          {yy_pop_state(); return 1;}
-<NW_CHOICEMODE>"warn"          {yy_pop_state(); return 2;}
-<NW_CHOICEMODE>[= \t]        {}
-<NW_CHOICEMODE>{ANID}              { BEGIN(0); return MP_UNRECOGNISED_STRING;}
-<NW_CHOICEMODE>{FLOAT}             { BEGIN(0); return MP_UNRECOGNISED_STRING;}
-<NW_CHOICEMODE>{INT}               { BEGIN(0); return MP_UNRECOGNISED_STRING;}
+<MI_MODE>"stop_on_maxreadnamelength" |
+<MI_MODE>"somrnl"                  { return MP_mi_stop_maxreadnamelength;}
 
 
 <PAF_MODE>"skip_whole_contig_scan" |
@@ -663,32 +639,22 @@ FILENAME [/A-Za-z0-9_#.][\-/A-Za-z0-9_#.]+
 <JOB_MODE>accurate   { return MP_jobdef_accurate ;}
 <JOB_MODE>genome     { return MP_jobdef_genome   ;}
 <JOB_MODE>est        { return MP_jobdef_est      ;}
-<JOB_MODE>fragments  { return MP_jobdef_fragments    ;}
 <JOB_MODE>esps1      { return MP_jobdef_estsnppipeline1 ;}
 <JOB_MODE>esps2      { return MP_jobdef_estsnppipeline2 ;}
 <JOB_MODE>esps3      { return MP_jobdef_estsnppipeline3 ;}
 <JOB_MODE>denovo     { return MP_jobdef_denovo   ;}
 <JOB_MODE>mapping    { return MP_jobdef_mapping  ;}
-<JOB_MODE>[Ss]anger     { return MP_jobdef_sanger   ;}
+<JOB_MODE>sanger     { return MP_jobdef_sanger   ;}
 <JOB_MODE>454	     { return MP_jobdef_454	;}
-<JOB_MODE>iontor |
-<JOB_MODE>IonTor	     { return MP_jobdef_iontor	;}
-<JOB_MODE>PacBioLQ |
-<JOB_MODE>pacbiolq |
-<JOB_MODE>PcBioLQ |
-<JOB_MODE>pcbiolq     { return MP_jobdef_pacbiolq	;}
-<JOB_MODE>PacBioHQ |
-<JOB_MODE>pacbiohq |
-<JOB_MODE>PcBioHQ |
-<JOB_MODE>pcbiohq     { return MP_jobdef_pacbiohq	;}
-<JOB_MODE>[Tt]ext     { return MP_jobdef_text   ;}
-<JOB_MODE>[Ss]olexa     { return MP_jobdef_solexa   ;}
-<JOB_MODE>[Ss]olid	     { return MP_jobdef_solid	;}
+<JOB_MODE>iontor	     { return MP_jobdef_iontor	;}
+<JOB_MODE>pacbio     { return MP_jobdef_pacbio	;}
+<JOB_MODE>solexa     { return MP_jobdef_solexa   ;}
+<JOB_MODE>solid	     { return MP_jobdef_solid	;}
 <JOB_MODE>[,:]
 <JOB_MODE>{FILENAME} { return MP_UNRECOGNISED_STRING;}
-<JOB_MODE>[\n\t ]    { BEGIN(0); return MP_jobdefend;}
+<JOB_MODE>[\n\t ]    { BEGIN(0); return MP_jobdefend;}                
 <JOB_MODE>.  |
-<JOB_MODE><<EOF>>    { BEGIN(0); return MP_jobdefend;}
+<JOB_MODE><<EOF>>    { BEGIN(0); return MP_jobdefend;}                
 <*>-{1,2}job[\t ]*=  { BEGIN(JOB_MODE); return MP_jobdefstart;}
 
 
@@ -696,9 +662,7 @@ FILENAME [/A-Za-z0-9_#.][\-/A-Za-z0-9_#.]+
 <ASKFORTECH_NOCLIPPING>sanger   { return MP_quickmode_noclipping_sanger;}
 <ASKFORTECH_NOCLIPPING>454      { return MP_quickmode_noclipping_454;}
 <ASKFORTECH_NOCLIPPING>iontor   { return MP_quickmode_noclipping_iontor;}
-<ASKFORTECH_NOCLIPPING>pcbiohq   { return MP_quickmode_noclipping_pacbiohq;}
-<ASKFORTECH_NOCLIPPING>pcbiolq   { return MP_quickmode_noclipping_pacbiolq;}
-<ASKFORTECH_NOCLIPPING>text     { return MP_quickmode_noclipping_text;}
+<ASKFORTECH_NOCLIPPING>pacbio   { return MP_quickmode_noclipping_pacbio;}
 <ASKFORTECH_NOCLIPPING>solexa   { return MP_quickmode_noclipping_solexa;}
 <ASKFORTECH_NOCLIPPING>solid    { return MP_quickmode_noclipping_solid;}
 <ASKFORTECH_NOCLIPPING>[ \t]    { BEGIN(0); }
@@ -716,7 +680,7 @@ FILENAME [/A-Za-z0-9_#.][\-/A-Za-z0-9_#.]+
 <*>"-OUT"    |
 <*>"-OU"                       {BEGIN(OUTPUT_MODE); return MP_PARSING_SECTIONCHANGE;}
 <*>"-FILENAME" |
-<*>"-FN"                          { BEGIN(FILE_MODE); return MP_PARSING_SECTIONCHANGE;}
+<*>"-FN"                          { BEGIN(FILE_MODE); return MP_PARSING_SECTIONCHANGE;} 
 <*>"-ASSEMBLY" |
 <*>"-AS"                           {BEGIN(AS_MODE); return MP_PARSING_SECTIONCHANGE;}
 <*>"-DATAPROCESSING" |
@@ -725,12 +689,6 @@ FILENAME [/A-Za-z0-9_#.][\-/A-Za-z0-9_#.]+
 <*>"-ED"                           {BEGIN(EDIT_MODE); return MP_PARSING_SECTIONCHANGE;}
 <*>"-SKIM" |
 <*>"-SK"                           {BEGIN(SKIM_MODE); return MP_PARSING_SECTIONCHANGE;}
-<*>"-HASHSTATISTICS" |
-<*>"-HASHSTAT" |
-<*>"-HS"                           {return MP_ERROR_MOVED_SECTION_KS;}
-<*>"-KMERSTATISTICS" |
-<*>"-KMERSTAT" |
-<*>"-KS"                           {BEGIN(KMERSTAT_MODE); return MP_PARSING_SECTIONCHANGE;}
 <*>"-ALIGN" |
 <*>"-AL"                           {BEGIN(ALIGN_MODE); return MP_PARSING_SECTIONCHANGE;}
 <*>"-CONTIG" |
@@ -740,10 +698,6 @@ FILENAME [/A-Za-z0-9_#.][\-/A-Za-z0-9_#.]+
 <*>"-DI"                           {BEGIN(DIR_MODE); return MP_PARSING_SECTIONCHANGE;}
 <*>"-MISC" |
 <*>"-MI"                           {BEGIN(MI_MODE); return MP_PARSING_SECTIONCHANGE;}
-<*>"-NAGANDWARN" |
-<*>"-NAG_AND_WARN" |
-<*>"-NAW" |
-<*>"-NW"                           {BEGIN(NW_MODE); return MP_PARSING_SECTIONCHANGE;}
 <*>"-PATHFINDER" |
 <*>"-PF"                         { BEGIN(PAF_MODE); return MP_PARSING_SECTIONCHANGE;}
 
@@ -751,9 +705,7 @@ FILENAME [/A-Za-z0-9_#.][\-/A-Za-z0-9_#.]+
 <*>SANGER_SETTINGS    { return MP_params_for_sanger;}
 <*>454_SETTINGS       { return MP_params_for_454;}
 <*>IONTOR_SETTINGS    { return MP_params_for_iontor;}
-<*>PCBIOLQ_SETTINGS    { return MP_params_for_pacbiolq;}
-<*>PCBIOHQ_SETTINGS    { return MP_params_for_pacbiohq;}
-<*>TEXT_SETTINGS    { return MP_params_for_text;}
+<*>PACBIO_SETTINGS    { return MP_params_for_pacbio;}
 <*>SOLEXA_SETTINGS    { return MP_params_for_solexa;}
 <*>SOLID_SETTINGS     { return MP_params_for_solid;}
 
@@ -761,22 +713,44 @@ FILENAME [/A-Za-z0-9_#.][\-/A-Za-z0-9_#.]+
 <*>_SANGER_SETTINGS    { return MP_silentparams_for_sanger;}
 <*>_454_SETTINGS       { return MP_silentparams_for_454;}
 <*>_IONTOR_SETTINGS    { return MP_silentparams_for_iontor;}
-<*>_PCBIOLQ_SETTINGS    { return MP_silentparams_for_pacbiolq;}
-<*>_PCBIOHQ_SETTINGS    { return MP_silentparams_for_pacbiohq;}
-<*>_TEXT_SETTINGS    { return MP_silentparams_for_text;}
+<*>_PACBIO_SETTINGS    { return MP_silentparams_for_pacbio;}
 <*>_SOLEXA_SETTINGS    { return MP_silentparams_for_solexa;}
 <*>_SOLID_SETTINGS     { return MP_silentparams_for_solid;}
 
 
 <*>-{1,2}borg   { return MP_quickmode_borg;}
 
+<*>-{1,2}fasta[\t ]*=  { filenameid=MP_quickmode_fastaname; yy_push_state(FN_MODE);}
+<*>-{1,2}fastq[\t ]*=  { filenameid=MP_quickmode_fastqname; yy_push_state(FN_MODE);}
+<*>-{1,2}fasta             { return MP_quickmode_fasta;}
+<*>-{1,2}fastq             { return MP_quickmode_fastq;}
+<*>-{1,2}phd[\t ]*=        { filenameid=MP_quickmode_phdname; yy_push_state(FN_MODE);}
+<*>-{1,2}phd               { return MP_quickmode_phd;}
+
+<*>-{1,2}caf[\t ]*=        { filenameid=MP_quickmode_cafname; yy_push_state(FN_MODE);}
+<*>-{1,2}caf               { return MP_quickmode_caf;}
+
+<*>-{1,2}cwd[\t ]*=  { filenameid=MP_dir_cwd; yy_push_state(FN_MODE);}
+
+<*>-{1,2}proin[\t ]*= |
+<*>-{1,2}projectin[\t ]*= |
+<*>-{1,2}projectinname[\t ]*=  { filenameid=MP_as_projectname_in; yy_push_state(FN_MODE);}
+<*>-{1,2}proout[\t ]*= |
+<*>-{1,2}projectout[\t ]*= |
+<*>-{1,2}projectoutname[\t ]*=  { filenameid=MP_as_projectname_out; yy_push_state(FN_MODE);}
+<*>-{1,2}project[\t ]*= |
+<*>-{1,2}projectname[\t ]*=  { filenameid=MP_as_projectname; yy_push_state(FN_MODE);}
+
 <*>-{1,2}parameterfile[\t ]*= |
 <*>-{1,2}params[\t ]*= |
 <*>-{1,2}parameters[\t ]*=   { filenameid=MP_quickmode_loadparam; yy_push_state(FN_MODE);}
 
-<*>-{1,2}hirep_something  { return MP_quickmode_hirep_something;}
-<*>-{1,2}hirep_good  { return MP_quickmode_hirep_good;}
-<*>-{1,2}hirep_best  { return MP_quickmode_hirep_best;}
+<*>-{1,2}notraceinfo     { return MP_quickmode_notraceinfo;}
+
+<*>-{1,2}clippinglight  { return MP_quickmode_clippinglight;}
+<*>-{1,2}clippingmedium { return MP_quickmode_clippingmedium;}
+<*>-{1,2}clippingheavy  { return MP_quickmode_clippingheavy;}
+
 <*>-{1,2}highlyrepetitive  { return MP_quickmode_highlyrepetitive;}
 <*>-{1,2}highqualitydata  { return MP_quickmode_highqualitydata;}
 <*>-{1,2}lowqualitydata  { return MP_quickmode_lowqualitydata;}
@@ -789,6 +763,7 @@ FILENAME [/A-Za-z0-9_#.][\-/A-Za-z0-9_#.]+
 <*>-{1,2}noquality |
 <*>-{1,2}noqualities    { return MP_quickmode_noquality_all;}
 
+
 <*>"*=BEGIN0=*" {BEGIN(0); return MP_PARSING_SECTIONRESET;} /*Hack for
 							     parsing command
 							     lines
@@ -826,22 +801,7 @@ FILENAME [/A-Za-z0-9_#.][\-/A-Za-z0-9_#.]+
 <*>-{1,2}mappingnormal  { return MP_quickmode_mappingnormal;}
 <*>-{1,2}mappingaccurate { return MP_quickmode_mappingaccurate;}
 
-<GE_MODE>"projectinname" |
-<GE_MODE>"projectin" |
-<GE_MODE>"proin"                 { filenameid=MP_as_projectname_in; yy_push_state(FN_MODE);}
-<GE_MODE>"projectoutname" |
-<GE_MODE>"projectout" |
-<GE_MODE>"proout"                 { filenameid=MP_as_projectname_out; yy_push_state(FN_MODE);}
-<GE_MODE>"projectname" |
-<GE_MODE>"project" |
-<GE_MODE>"pro"                 { filenameid=MP_as_projectname; yy_push_state(FN_MODE);}
+<GE_MODE>"keep_contigs_in_memory" |
+<GE_MODE>"kcim"                 { yy_push_state(ASK_YN_MODE); return MP_as_keepcontigsinmem;}
 
-<*>-{1,2}proin[\t ]*= |
-<*>-{1,2}projectin[\t ]*= |
-<*>-{1,2}projectinname[\t ]*=  { filenameid=MP_as_projectname_in; yy_push_state(FN_MODE);}
-<*>-{1,2}proout[\t ]*= |
-<*>-{1,2}projectout[\t ]*= |
-<*>-{1,2}projectoutname[\t ]*=  { filenameid=MP_as_projectname_out; yy_push_state(FN_MODE);}
-<*>-{1,2}project[\t ]*= |
-<*>-{1,2}projectname[\t ]*=  { filenameid=MP_as_projectname; yy_push_state(FN_MODE);}
  */
diff --git a/src/mira/parameters_tokens.h b/src/mira/parameters_tokens.h
index f7cb18e..c24e117 100644
--- a/src/mira/parameters_tokens.h
+++ b/src/mira/parameters_tokens.h
@@ -11,44 +11,48 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
-enum { MP_ed_mira_automatic_contig_editing=1000,
-       MP_ed_sdbg_readedit,
-       MP_ed_kmer_singlets,
-       MP_ed_homopolymer_overcalls,
-       MP_ed_edit_automatic_contig_editing,
+enum { MP_bla=1000,
+       MP_ed_automatic_contig_editing,
        MP_ed_strict,
        MP_ed_confirmation_threshold,
 
        MP_sp_est_startstep=1100,
 
-       MP_as_numthreads=1200,
+       MP_as_projectname=1200,
+       MP_as_projectname_in,
+       MP_as_projectname_out,
+       MP_as_numthreads,
        MP_as_automemmanagement,
        MP_as_amm_keeppercentfree,
        MP_as_amm_maxprocesssize,
        MP_as_nodateoutput,
-       MP_as_bangonthrow,
+       MP_as_readnaming_scheme,
        MP_as_plen,
        MP_as_perrors,
        MP_as_minimum_readlength,
        MP_as_minimum_readspercontig,
+       MP_as_infile_loadjob,
+       MP_as_merge_xmltraceinfo,
+       MP_as_load_sequencedata,
+       MP_as_loadSOLEXA_solexa_scores_in_qual_files,
+       MP_as_fastq_qualoffset,
        MP_as_enforce_qualsinreads,
        MP_as_wants_qualityfile,
-       MP_as_rle_reads,
        MP_as_numpasses,
-       MP_as_kmerseries,
+       MP_as_skimeachpass,
        MP_as_numrmbbreakloops,
        MP_as_maxcontigsperpass,
        MP_as_mark_repeats,
@@ -62,11 +66,17 @@ enum { MP_ed_mira_automatic_contig_editing=1000,
        MP_as_uniform_read_distribution,
        MP_as_urd_startinpass,
        MP_as_urd_cutoffmultiplier,
+       MP_as_keep_long_repeats_separated,
        MP_as_cleanup_tmp_files,
+       MP_as_external_quality,
+       MP_as_external_quality_override,
+       MP_as_discard_read_on_eq_error,
+       MP_as_assignreaddefaultqual,
+       MP_as_basedefaultqual,
+       MP_as_keepcontigsinmem,
        MP_as_savesimplesingletsinproject,
        MP_as_savetaggedsingletsinproject,
        MP_as_buntify_reads,
-       MP_as_preprocess_only,
 
        MP_as_output_tmp_html,
        MP_as_output_tmp_text,
@@ -96,27 +106,16 @@ enum { MP_ed_mira_automatic_contig_editing=1000,
        MP_as_output_removetmpdir,
 
        MP_as_filecheck_only,
-       MP_as_clip_sdbg_chimeradetection,
-       MP_as_clip_kmer_junkdetection,
-       MP_as_clip_kmer_junkkill,
+       MP_as_loadstraindata,
+       MP_as_assign_defaultstrain,
+       MP_as_default_strainname,
+       MP_as_use_template_information,
        MP_as_clip_skimchimeradetection,
        MP_as_clip_skimjunkdetection,
        MP_as_clip_proposeendclips,
        MP_as_clip_pec_basesperhash,
        MP_as_clip_pec_sxaggcxg,
-       MP_as_clip_pec_ffreq,
-       MP_as_clip_pec_bfreq,
-       MP_as_clip_pec_mkfr,
-       MP_as_clip_pec_mtk,
-       MP_as_clip_pec_ffr,
-       MP_as_clip_pec_bfr,
-       MP_as_clip_pec_fcmst,
-       MP_as_clip_pec_bcmst,
-       MP_as_clip_pec_fsalp,
-       MP_as_clip_pec_bsalp,
        MP_as_clip_badsolexaends,
-       MP_as_search_phix174,
-       MP_as_filter_phix174,
        MP_as_clip_knownadaptorsright,
        MP_as_clip_possible_vectors,
        MP_as_clip_vector_maxlenallowed,
@@ -132,21 +131,21 @@ enum { MP_ed_mira_automatic_contig_editing=1000,
        MP_as_clip_maskedbases_gapsize,
        MP_as_clip_maskedbases_maxfrontgap,
        MP_as_clip_maskedbases_maxendgap,
-       MP_as_clip_lowercase_front,
-       MP_as_clip_lowercase_back,
+       MP_as_clip_lowercase,
        MP_as_clip_ensureminimumleftclip,
        MP_as_clip_minimumleftcliprequired,
        MP_as_clip_setminimumleftclip,
        MP_as_clip_ensureminimumrightclip,
        MP_as_clip_minimumrightcliprequired,
        MP_as_clip_setminimumrightclip,
+       MP_as_clip_mergessahavectorscreen,
        MP_as_clip_ssahamerge_gapsize,
        MP_as_clip_ssahamerge_maxfrontgap,
        MP_as_clip_ssahamerge_maxendgap,
        MP_as_clip_ssahamerge_strictfrontclip,
        MP_as_clip_ssahamerge_strictendclip,
        MP_as_clip_polyat,
-       MP_as_clip_polyat_keeppolystretch,
+       MP_as_clip_polyat_keeppolysignal,
        MP_as_clip_polyat_len,
        MP_as_clip_polyat_maxerrors,
        MP_as_clip_polyat_maxgap,
@@ -155,13 +154,14 @@ enum { MP_ed_mira_automatic_contig_editing=1000,
        MP_as_clip_3ppolybase_len,
        MP_as_clip_3ppolybase_maxerrors,
        MP_as_clip_3ppolybase_maxgap,
-       MP_as_clipmask_rarekmers,
 
        MP_as_extend_reads,
        MP_as_readextension_window_len,
        MP_as_readextension_window_maxerrors,
        MP_as_readextension_firstpassnum,
        MP_as_readextension_lastpassnum,
+       MP_as_loadbackbone,
+       MP_as_backbone_loadjob,
        MP_as_backbone_raillength,
        MP_as_backbone_railoverlap,
        MP_as_backbone_basequals,
@@ -171,37 +171,26 @@ enum { MP_ed_mira_automatic_contig_editing=1000,
        MP_as_backbone_rail_fromstrain,
        MP_as_startbackboneusage_inpass,
        MP_as_backbone_alsobuildnewcontigs,
-       MP_as_backbone_trimoverhangingreads,
-       MP_as_backbone_bootstrapnewbackbone,
 
        MP_sk_numthreads=5000,
        MP_sk_basesperhash,
-       MP_sk_bph_increasestep,
-       MP_sk_bph_max,
        MP_sk_hashsavestepping,
        MP_sk_percentrequired,
        MP_sk_maxhitsperread,
        MP_sk_maxhashesinmemory,
        MP_sk_memcaphitreduction,
+       MP_sk_maxmegahubratio,
+       MP_sk_masknastyrepeats,
        MP_sk_alsoskimrevcomp,
        MP_sk_swcheckonbackbones,
-       MP_sk_filtermegahubs,
-       MP_sk_megahubcap,
-       MP_sk_maxmegahubratio,
 
-       MP_hs_freq_covestmin,
-       MP_hs_freqest_minnormal,
-       MP_hs_freqest_maxnormal,
-       MP_hs_freqest_repeat,
-       MP_hs_freqest_heavyrepeat,
-       MP_hs_freqest_crazyrepeat,
-       MP_hs_masknastyrepeats,
-       MP_hs_nastyrepeatratio,
-       MP_hs_nastyrepeatcoverage,
-       MP_hs_repeatlevel_in_infofile,
-       MP_hs_applydigitalnormalisation,
-       MP_hs_million_hashes_per_buffer,
-       MP_hs_rare_kmer_final_kill,
+       MP_sk_freqest_minnormal,
+       MP_sk_freqest_maxnormal,
+       MP_sk_freqest_repeat,
+       MP_sk_freqest_heavyrepeat,
+       MP_sk_freqest_crazyrepeat,
+       MP_sk_nastyrepeatratio,
+       MP_sk_repeatlevel_in_infofile,
 
        MP_al_bip=5500,
        MP_al_bmax,
@@ -212,11 +201,8 @@ enum { MP_ed_mira_automatic_contig_editing=1000,
        MP_al_solexahack_maxerrors,
 
        MP_ads_extra_gap_penalty=5700,
-       MP_ads_gp_functionstring,
+       MP_ads_gp_level,
        MP_ads_max_gppercent,
-       MP_ads_enforce_clean_ends,
-       MP_ads_clean_end_distance,
-       MP_ads_clean_end_mismatchallowed,
 //       MP_ads_extra_mismatch_penalty,
 //       MP_ads_emp_windowlen,
 //       MP_ads_emp_maxmismatches,
@@ -242,7 +228,6 @@ enum { MP_ed_mira_automatic_contig_editing=1000,
        MP_con_val_am_text,
        MP_con_val_am_string,
        MP_con_rodirs,
-       MP_con_min_relscore,
        MP_con_danger_max_error_rate,
        MP_con_assume_snp_insteadof_rmb,
 //       MP_con_num_rmb_zone_trigger,
@@ -255,59 +240,73 @@ enum { MP_ed_mira_automatic_contig_editing=1000,
        MP_con_also_mark_gap_bases,
        MP_con_also_mark_gap_bases_evenmc,
        MP_con_also_mark_gap_bases_needbothstrands,
+       MP_con_insertsize_minimum,
+       MP_con_insertsize_maximum,
+       MP_con_template_build_direction,
        MP_con_output_fasta_cpl,
        MP_con_output_html_cpl,
        MP_con_output_text_cpl,
        MP_con_output_html_gapfill,
        MP_con_output_text_gapfill,
-       MP_con_force_nonIUPACconsensus,
+       MP_con_force_nonIUPACconsensus_perseqtype,
+       MP_con_force_nonIUPACconsensus_amongseqtypes,
        MP_con_mergeshortreads,
        MP_con_msr_keependsunmapped,
-       MP_con_msr_maxerrors,
        MP_con_gap_override_ratio,
 
-       MP_mi_extendedlog=7700,
-       MP_mi_iknowwhatido,
+       MP_mi_stoponnfs=7700,
+       MP_mi_extendedlog,
        MP_mi_as_largecontigsize,
        MP_mi_as_largecontigsize4stats,
-       MP_mi_extra_flag1,
-       MP_mi_extra_flag2,
-       MP_mi_extra_flag3,
-
-       MP_nw_check_nfs=7800,
-       MP_nw_check_templateproblems,
-       MP_nw_check_duplicatereadnames,
-       MP_nw_check_readnamesra,
-       MP_nw_check_maxreadnamelength,
-       MP_nw_check_multipassmapping,
-       MP_nw_check_mrnlvalue,
-       MP_nw_check_coverage,
-       MP_nw_check_covvalue,
+       MP_mi_stop_maxreadnamelength,
 
-       MP_fn_cafin=7900,
+       MP_fn_cafin=7800,
        MP_fn_cafout,
+       MP_fn_fofnexpin,
+       MP_fn_fofnphdin,
+       MP_fn_fastqin,
+       MP_fn_fastain,
+       MP_fn_fastaqualin,
+       MP_fn_phdin,
+       MP_fn_straindatain,
+       MP_fn_xmltraceinfoin,
+       MP_fn_ssahavectorscreenin,
+       MP_fn_smaltvectorscreenin,
+       MP_fn_backbonein,
 
-       MP_dir_tmp=8000,
+       MP_dir_cwd=8000,
+       MP_dir_tmp,
        MP_dir_tmp_redirectedto,
+       MP_dir_exp,
+       MP_dir_scf,
+       MP_dir_fasta,
+       MP_dir_gap4da,
 
        MP_quickmode_borg=8200,
+       MP_quickmode_fastq,
+       MP_quickmode_fastqname,
+       MP_quickmode_fasta,
+       MP_quickmode_fastaname,
+       MP_quickmode_phd,
+       MP_quickmode_phdname,
+       MP_quickmode_caf,
+       MP_quickmode_cafname,
        MP_quickmode_loadparam,
+       MP_quickmode_clippinglight,
+       MP_quickmode_clippingmedium,
+       MP_quickmode_clippingheavy,
        MP_quickmode_noquality_all,
        MP_quickmode_noclipping_all,
        MP_quickmode_noclipping_sanger,
        MP_quickmode_noclipping_454,
        MP_quickmode_noclipping_iontor,
-       MP_quickmode_noclipping_pacbiolq,
-       MP_quickmode_noclipping_pacbiohq,
-       MP_quickmode_noclipping_text,
+       MP_quickmode_noclipping_pacbio,
        MP_quickmode_noclipping_solexa,
        MP_quickmode_noclipping_solid,
-       MP_quickmode_hirep_something,
-       MP_quickmode_hirep_good,
-       MP_quickmode_hirep_best,
+       MP_quickmode_highlyrepetitive,
        MP_quickmode_highqualitydata,
        MP_quickmode_lowqualitydata,
-       MP_quickmode_highlyrepetitive,
+       MP_quickmode_notraceinfo,
 
        MP_jobdefstart=8300,
        MP_jobdef_draft,
@@ -315,7 +314,6 @@ enum { MP_ed_mira_automatic_contig_editing=1000,
        MP_jobdef_accurate,
        MP_jobdef_genome,
        MP_jobdef_est,
-       MP_jobdef_fragments,
        MP_jobdef_estsnppipeline1,
        MP_jobdef_estsnppipeline2,
        MP_jobdef_estsnppipeline3,
@@ -324,29 +322,23 @@ enum { MP_ed_mira_automatic_contig_editing=1000,
        MP_jobdef_sanger,
        MP_jobdef_454,
        MP_jobdef_iontor,
-       MP_jobdef_pacbiolq,
-       MP_jobdef_pacbiohq,
-       MP_jobdef_text,
+       MP_jobdef_pacbio,
        MP_jobdef_solexa,
-       MP_jobdef_solid,
+       MP_jobdef_solid,   
        MP_jobdefend,
 
        MP_params_for_common=8400,
        MP_params_for_sanger,
        MP_params_for_454,
        MP_params_for_iontor,
-       MP_params_for_pacbiolq,
-       MP_params_for_pacbiohq,
-       MP_params_for_text,
+       MP_params_for_pacbio,
        MP_params_for_solexa,
        MP_params_for_solid,
        MP_silentparams_for_common,
        MP_silentparams_for_sanger,
        MP_silentparams_for_454,
        MP_silentparams_for_iontor,
-       MP_silentparams_for_pacbiolq,
-       MP_silentparams_for_pacbiohq,
-       MP_silentparams_for_text,
+       MP_silentparams_for_pacbio,
        MP_silentparams_for_solexa,
        MP_silentparams_for_solid,
 
@@ -357,14 +349,10 @@ enum { MP_ed_mira_automatic_contig_editing=1000,
        MP_PARSING_SECTIONRESET,
 
        MP_ERROR=10000,
-       MP_ERROR_MOVED_SECTION_NW,
-       MP_ERROR_MOVED_SECTION_KS,
-       MP_ERROR_RENAMED_BPH_KMER,
-       MP_ERROR_REMOVED,
        MP_ERROR_DASHES,
        MP_UNRECOGNISED_STRING
 };
 
-// Local Variables:
+// Local Variables: 
 // mode: C++
-// End:
+// End: 
diff --git a/src/mira/pcrcontainer.C b/src/mira/pcrcontainer.C
deleted file mode 100644
index 7c1025c..0000000
--- a/src/mira/pcrcontainer.C
+++ /dev/null
@@ -1,890 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 2012 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-
-
-#include "mira/pcrcontainer.H"
-
-using namespace std;
-
-
-#define CEBUG(bla)
-
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-PlacedContigReads::~PlacedContigReads()
-{
-//    cout << "~PlacedContigReads()"
-//	 << "\nPCR_readdump: " << PCR_readdump.size()
-//	 << "\nPCR_offsetmap: " << PCR_offsetmap.size()
-//	 << "\nPCR_readposbins: " << PCR_readposbins.size()
-//	 << "\nPCR_ancillaryinfo: " << PCR_ancillaryinfo.size()
-//	 << "\nsr_lb1: " << PCR_time_sr_lb1
-//	 << "\nsr_lb2: " << PCR_time_sr_lb2
-//	 << "\nsr_aoadj: " << PCR_time_sr_aoadj
-//	 << "\nsr_omadj: " << PCR_time_sr_omadj
-//	 << "\nsb_c2h: " << PCR_time_sb_c2h
-//	 << "\nsb_total: " << PCR_time_sb_total
-//	 << "\nprh_pf: " << PCR_time_prh_pf
-//	 << "\nprh_a2b1: " << PCR_time_prh_a2b1
-//	 << "\nprh_a2b2: " << PCR_time_prh_a2b2
-//	 << "\nprh_a2b3: " << PCR_time_prh_a2b3
-//	 << "\nprh_a2b: " << PCR_time_prh_a2b
-//	 << endl;
-};
-
-
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-PlacedContigReads const & PlacedContigReads::operator=(PlacedContigReads const & other)
-{
-  if(this != &other){
-    PlacedContigReads(*(other.PCR_originalrp)); // sets readpool, zeroes all timing counters
-    PCR_readdump.clear();
-    PCR_ancillaryinfo.clear();
-    PCR_readposbins.clear();
-    PCR_offsetmap.clear();
-    PCR_bo_binsize=other.PCR_bo_binsize;
-    for(auto opcrI=other.begin(); opcrI != other.end(); ++opcrI){
-      placeRead(*opcrI,opcrI.getORPID(),opcrI.getReadStartOffset(),opcrI.getReadDirection());
-    }
-  }
-
-  return *this;
-}
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-void PlacedContigReads::debugDump(bool shortdbg)
-{
-  FUNCSTART("void PlacedContigReads::debugDump(bool shortdbg)");
-  cout << "debugDump PlacedContigReads\nbinsize: " << PCR_bo_binsize << endl;
-  cout << "rd size: " << PCR_readdump.size() << endl;
-  cout << "rd active: " << PCR_readdump.getNumActiveReads() << endl;
-  cout << "anc size: " << PCR_ancillaryinfo.size() << endl;
-  cout << "size(): " << size() << endl;
-  cout << "readposbins size: " << PCR_readposbins.size() << endl;
-  if(shortdbg) return;
-  for(uint32 i=0; i<PCR_offsetmap.size(); ++i){
-    cout << "om " << i
-	 << "\tf: " << PCR_offsetmap[i].from
-	 << "\tnum: " << PCR_offsetmap[i].rpbI->readao.size()
-	 << "\trpbI: " << &(*(PCR_offsetmap[i].rpbI))
-	 << endl;
-  }
-  cout << endl;
-
-  uint32 elemnum=0;
-  for(auto & rpbe : PCR_readposbins){
-    cout << "rpbe " << elemnum << "\tomi: " << rpbe.offsetmapindex << " (from: " << PCR_offsetmap[rpbe.offsetmapindex].from << ")" << endl;
-    for(uint32 i=0; i<rpbe.readao.size(); ++i){
-      cout << "aoi " << i << "\tao: " << rpbe.readao[i].addoffset
-	   << "\turdid: " << rpbe.readao[i].urdid << endl;
-    }
-    ++elemnum;
-  }
-
-  for(uint32 i=0; i<PCR_readdump.size(); ++i){
-    cout << "rd rn " << i << "\tname: ";
-    //cout.flush();
-    cout << PCR_readdump[i].getName();
-    //cout.flush();
-    BUGIFTHROW(i>PCR_ancillaryinfo.size(),"i>PCR_ancillaryinfo.size() ???");
-    if(i==PCR_ancillaryinfo.size()){
-      cout << "ancillary info not available yet (OK while debugging PCR, not OK else!";
-    }else{
-      cout << "\torpid: " << PCR_ancillaryinfo[i].orpid << "\tdir: " << static_cast<int16>(PCR_ancillaryinfo[i].direction);
-      if(PCR_ancillaryinfo[i].rpbI == PCR_readposbins.end()){
-	cout << "\trpbI.end()";
-      }else{
-	cout << "\trpbI->omi: " <<PCR_ancillaryinfo[i].rpbI->offsetmapindex
-	     << " (from: " << PCR_offsetmap[PCR_ancillaryinfo[i].rpbI->offsetmapindex].from << ")";
-      }
-    }
-    cout << endl;
-  }
-  FUNCEND();
-}
-
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-void PlacedContigReads::addORPID2Map(int32 rpid, list<rposbin_t>::iterator rpbI)
-{
-  if(rpid>=0){
-    if(!PCR_maprpids_to_rpb_v.empty()){
-      if(rpid>=static_cast<int32>(PCR_maprpids_to_rpb_v.size())){
-	PCR_maprpids_to_rpb_v.resize(static_cast<uint64>(rpid)*2,PCR_readposbins.end());
-      }
-      PCR_maprpids_to_rpb_v[rpid]=rpbI;
-    }else{
-      if(PCR_maprpids_to_rpb_m.size()<8192){
-	PCR_maprpids_to_rpb_m.insert(pair<int32,list<rposbin_t>::iterator>(rpid,rpbI));
-      }else{
-	// switch from map to vector
-	PCR_maprpids_to_rpb_v.resize(PCR_originalrp->size(),PCR_readposbins.end());
-	for(auto & m : PCR_maprpids_to_rpb_m){
-	  PCR_maprpids_to_rpb_v[m.first]=m.second;
-	}
-	PCR_maprpids_to_rpb_m.clear();
-	PCR_maprpids_to_rpb_v[rpid]=rpbI;
-      }
-    }
-  }
-}
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-void PlacedContigReads::delORPIDFromMap(int32 rpid)
-{
-  FUNCSTART("void PlacedContigReads::delRPIDFromMap(int32 rpid)");
-  if(!PCR_maprpids_to_rpb_v.empty()){
-    PCR_maprpids_to_rpb_v[rpid]=PCR_readposbins.end();
-  }else{
-    auto tmp=PCR_maprpids_to_rpb_m.erase(rpid);
-    BUGIFTHROW(tmp!=1,"Erased " << tmp << " instances of rpid " << rpid << " from map???");
-  }
-  FUNCEND();
-}
-
-
-/*************************************************************************
- *
- * Returns end() if rpid not present
- *
- *
- *************************************************************************/
-
-PlacedContigReads::const_iterator PlacedContigReads::getIteratorOfReadpoolID(int32 rpid)
-{
-  FUNCSTART("PlacedContigReads::iterator PlacedContigReads::getIteratorOfReadpoolID(int32 rpid)");
-
-  const_iterator retI(end());
-
-  if(rpid>=0){
-    list<rposbin_t>::iterator rpbI(PCR_readposbins.end());
-    if(!PCR_maprpids_to_rpb_v.empty()){
-      if(static_cast<size_t>(rpid)<PCR_maprpids_to_rpb_v.size()) rpbI=PCR_maprpids_to_rpb_v[rpid];
-    }else{
-      auto mI=PCR_maprpids_to_rpb_m.find(rpid);
-      if(mI!=PCR_maprpids_to_rpb_m.end()) rpbI=mI->second;
-    }
-
-    if(rpbI!=PCR_readposbins.end()){
-      auto raoI=rpbI->readao.begin();
-      for(; raoI!=rpbI->readao.end(); ++raoI){
-	if(PCR_ancillaryinfo[raoI->urdid].orpid==rpid) break;
-      }
-      BUGIFTHROW(raoI==rpbI->readao.end(), "Should never happen, did not find rpid " << rpid);
-      retI=const_iterator(this,rpbI,
-			  static_cast<const_iterator::raoindex_t>(raoI-rpbI->readao.begin()));
-    }
-  }
-
-  FUNCEND();
-  return retI;
-}
-
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-//#define CEBUG(bla) {cout << bla; cout.flush();}
-#ifdef CEBUG
-#define GIMMECEBUGBACK
-#undef CEBUG
-#endif
-vector<PlacedContigReads::offsettile_t>::iterator PlacedContigReads::searchOffsetTileForPlacement(int32 position)
-{
-  auto fI=upper_bound(PCR_offsetmap.begin(), PCR_offsetmap.end(),
-		      offsettile_t(position,PCR_readposbins.end()),       // comparator object, only position matters
-		      offsettile_t::lt_offsetfrom);
-
-#ifndef CEBUG
-  while(fI!=PCR_offsetmap.begin() && (fI-1)->from + (fI-1)->rpbI->readao.back().addoffset >= position) --fI;
-#else
-  while(fI!=PCR_offsetmap.begin()){
-    CEBUG("PCR sotfp w1 ls " << fI-PCR_offsetmap.begin() << " s " << PCR_offsetmap.size() << endl);
-    CEBUG("PCR sotfp w1 -1 from " << (fI-1)->from << endl);
-    CEBUG("PCR sotfp w1 -1 omi " << (fI-1)->rpbI->offsetmapindex << endl);
-    CEBUG("PCR sotfp w1 -1 aos " << (fI-1)->rpbI->readao.size() << endl);
-    CEBUG("rpbI: " << &(*((fI-1)->rpbI)) << endl);
-
-    if(!((fI-1)->from + (fI-1)->rpbI->readao.back().addoffset >= position)) break;
-    --fI;
-  }
-  CEBUG("PCR sotfp 3" << endl);
-#endif
-  while(fI!=PCR_offsetmap.end() && fI->from + fI->rpbI->readao.back().addoffset < position) ++fI;
-  if(fI == PCR_offsetmap.end()
-    && fI!=PCR_offsetmap.begin()){
-    --fI;
-    if(fI->rpbI->readao.size() == fI->rpbI->readao.capacity()) ++fI;
-  }
-  return fI;
-};
-#ifdef GIMMECEBUGBACK
-#undef GIMMECEBUGBACK
-#define CEBUG(bla)
-#endif
-
-
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-//#define CEBUG(bla) {cout << bla; cout.flush();}
-void PlacedContigReads::splitBin(uint32 binindex)
-{
-  FUNCSTART("void PlacedContigReads::splitBin(uint32 binindex)");
-
-  timeval tvp;
-  timeval tvt;
-
-  gettimeofday(&tvt,nullptr);
-
-  CEBUG("want to split offsetbin " << binindex << endl);
-  BUGIFTHROW(binindex>=PCR_offsetmap.size(), "binindex>=PCR_offsetmap.size() ???");
-
-  // num elements of first partial bin after split
-  auto numfirst=PCR_offsetmap[binindex].rpbI->readao.size()/2;
-
-  // make a duplication of the offsettile
-  {
-    auto boiI=PCR_offsetmap.begin();
-    advance(boiI,binindex);
-    auto tmp=PCR_offsetmap[binindex];
-    PCR_offsetmap.insert(boiI,tmp);
-
-    // set "from" in offsetmap to correct values
-    PCR_offsetmap[binindex+1].from=PCR_offsetmap[binindex].from+PCR_offsetmap[binindex].rpbI->readao[numfirst].addoffset;
-
-  }
-
-  CEBUG("after DUP \n"; debugDump());
-
-  // insert new rposbin_t after current one
-  auto rpbI=PCR_offsetmap[binindex].rpbI;
-  {
-    ++rpbI;
-    rpbI=PCR_readposbins.insert(rpbI,rposbin_t(binindex+1,PCR_bo_binsize));
-    PCR_offsetmap[binindex+1].rpbI=rpbI;
-
-    // and copy 2nd half of readao of first to second readao
-    //  already adjusting the additional offsets
-    //  & rpbI of ancillaryinfo_t
-    //  & the rpid2rpbI map
-    int32 offsetdiff=PCR_offsetmap[binindex+1].from-PCR_offsetmap[binindex].from;
-    auto raoI=PCR_offsetmap[binindex].rpbI->readao.begin();
-    advance(raoI,numfirst);
-    gettimeofday(&tvp,nullptr);
-    // a simple unrolling of this is pointless
-    // furthermore, total runtime for splitBin on 10m inserts is 0.25s
-    // keep as is
-    for(; raoI != PCR_offsetmap[binindex].rpbI->readao.end(); ++raoI){
-      rpbI->readao.push_back(addoff_t(raoI->addoffset-offsetdiff,raoI->urdid));
-      PCR_ancillaryinfo[raoI->urdid].rpbI=rpbI;
-      updateMapBinOfORPID(PCR_ancillaryinfo[raoI->urdid].orpid,rpbI);
-    }
-    PCR_time_sb_c2h+=diffsuseconds(tvp);
-
-    // adjust size of first readao (it's an adjustment down, but need to pass default object anyway
-    PCR_offsetmap[binindex].rpbI->readao.resize(numfirst,addoff_t(0,0));
-  }
-
-  // adjust offsetmap indexes
-  rpbI=PCR_offsetmap[binindex+1].rpbI;
-  ++rpbI;
-  for(; rpbI!=PCR_readposbins.end(); ++rpbI){
-    rpbI->offsetmapindex+=1;
-  }
-
-  PCR_time_sb_total+=diffsuseconds(tvt);
-
-  CEBUG("after split\n"; debugDump());
-
-  FUNCEND();
-
-  return;
-}
-
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-//#define CEBUG(bla) {cout << bla; cout.flush();}
-PlacedContigReads::const_iterator PlacedContigReads::placeRead(const Read & theread, int32 rpid, int32 position, int8 dir)
-{
-  FUNCSTART("void PlacedContigReads::insertRead(Read theread, int32 rpid, int32 position, int8 dir)");
-
-//#ifdef PARANOIABUGTRACKFLAG
-// really just for paranoia?
-//  BUGIFTHROW(getURDIDOfReadpoolID(rpid)>=0,"rpid " << rpid << " already present ???");
-//#endif
-
-  BUGIFTHROW(dir!=-1 && dir!=1,"dir == " << static_cast<int16>(dir) << " ???");
-  BUGIFTHROW(position<0,"position " << position << " < 0 ???");
-
-  //CEBUG("PCR PR BEFORE\n"; debugDump());
-  //if(PCR_readdump.size() > 8200) {
-  //  cout << "pcr before" << endl;
-  //  debugDump(false);
-  //}
-  int32 urdid=static_cast<int32>(PCR_readdump.provideEmptyRead());
-  CEBUG("got urdid " << urdid << endl);
-  //if(urdid==8216) debugDump(false);
-  //cout << "dbg end" << endl;
-  PCR_readdump[urdid]=theread;
-  //CEBUG("read assigned" << endl);
-  //if(urdid==8216) debugDump(false);
-
-  // PCR_readposbins.end() below is a placeholder, is overwritten a couple of lines later
-  //  but splitBin() in placeRead_helper()
-  //  expects readdump and ancillaryinfo to exist and be consistent
-  if(urdid>=static_cast<int32>(PCR_ancillaryinfo.size())){
-    PCR_ancillaryinfo.push_back(ancillaryinfo_t(rpid,dir,PCR_readposbins.end()));
-  }else{
-    PCR_ancillaryinfo[urdid]=ancillaryinfo_t(rpid,dir,PCR_readposbins.end());
-  }
-  CEBUG("ancillary created" << endl);
-  //if(urdid==8216) debugDump(false);
-
-  const_iterator::raoindex_t araoindex;
-  auto rpbI=placeRead_helper(rpid,position,dir,urdid,araoindex);
-  CEBUG("helper done" << endl);
-
-  PCR_ancillaryinfo[urdid].rpbI=rpbI;
-
-  CEBUG("ancillary finished\n");
-
-  addORPID2Map(rpid,rpbI);
-
-  CEBUG("ORPID added 2 map\n");
-
-  ++PCR_numreads;
-
-  //CEBUG("PCR PR INSERTED\n"; debugDump(););
-
-  CEBUG("PCR PR end" << endl);
-
-  FUNCEND();
-  return const_iterator(this,rpbI,araoindex);
-}
-//#define CEBUG(bla)
-
-/*************************************************************************
- *
- * Note:
- *  Using the "const_iterator::raoindex_t & araoindex" to give back
- *   the raoindex of the newly placed read is a bit of a hack
- *  Normally I'd let _helper return a fully valid const_iterator,
- *   but the caller needs a non-const list<PlacedContigReads::rposbin_t>::iterator
- *   and there is absolutely no way to cast a list<>::const_iterator (which
- *   is stored in the PlacedContigReads::const_iterator) into a
- *   list<>::iterator. Hence this hack.
- *
- *************************************************************************/
-
-//#define CEBUG(bla) {cout << bla; cout.flush();}
-list<PlacedContigReads::rposbin_t>::iterator PlacedContigReads::placeRead_helper(int32 rpid, int32 position, int8 dir, int32 urdid, const_iterator::raoindex_t & araoindex)
-{
-  FUNCSTART("void PlacedContigReads::insertRead(Read r, int32 rpid, int32 position, int8 dir, int32 urdid)");
-
-  list<PlacedContigReads::rposbin_t>::iterator rpbI;
-  araoindex=0;
-
-  auto otI=searchOffsetTileForPlacement(position);
-  CEBUG("got otI " << otI-PCR_offsetmap.begin() << " (size " << PCR_offsetmap.size() << ") " << endl);
-
-  if(otI == PCR_offsetmap.end()){
-    CEBUG("push back");
-    // easy case: this just needs a new bin
-
-    // the following line is a push_back, but it does not take more time and we get back the iterator
-    //  to the last element gratis
-
-    rpbI= PCR_readposbins.insert(PCR_readposbins.end(),rposbin_t(PCR_offsetmap.size(),PCR_bo_binsize));
-    PCR_offsetmap.push_back(offsettile_t(position,rpbI));
-
-    rpbI->readao.push_back(addoff_t(0,urdid));
-
-    CEBUG("new rp bin\n");
-  }else if((otI==PCR_offsetmap.begin() && position <= otI->from) && otI->rpbI->readao.size() == PCR_bo_binsize){
-    CEBUG("push front");
-    // easy case: this just needs a new bin
-
-    timeval tvp;
-    gettimeofday(&tvp,nullptr);
-
-    // the following line is a push_front
-    rpbI= PCR_readposbins.insert(PCR_readposbins.begin(),rposbin_t(0,PCR_bo_binsize));
-    rpbI->readao.push_back(addoff_t(0,urdid));
-    PCR_offsetmap.insert(PCR_offsetmap.begin(),offsettile_t(position,rpbI));
-    ++rpbI;
-    for(; rpbI!=PCR_readposbins.end(); ++rpbI) rpbI->offsetmapindex+=1;
-    rpbI=PCR_readposbins.begin();
-    PCR_time_prh_pf+=diffsuseconds(tvp);
-
-    CEBUG("new rp bin\n");
-  }else{
-    CEBUG("must add to bin\n");
-
-    CEBUG("have otI " << otI-PCR_offsetmap.begin() << endl);
-
-    if(otI->rpbI->readao.size() < otI->rpbI->readao.capacity()){
-      timeval tvt;
-      gettimeofday(&tvt,nullptr);
-
-      timeval tvp;
-      gettimeofday(&tvp,nullptr);
-
-      int32 positionadditionaloffset=position-(otI->from);
-
-      rpbI=otI->rpbI;
-      auto raoI=lower_bound(rpbI->readao.begin(),rpbI->readao.end(),
-			    addoff_t(positionadditionaloffset,0),
-			    addoff_t::lt);
-
-      araoindex=static_cast<const_iterator::raoindex_t>(raoI-rpbI->readao.begin());
-
-      PCR_time_prh_a2b1+=diffsuseconds(tvp);
-      gettimeofday(&tvp,nullptr);
-
-      // if we're adding to the end of the container, things are fast and easy ...
-      if(raoI==rpbI->readao.end()){
-	rpbI->readao.push_back(addoff_t(positionadditionaloffset,urdid));
-      }else{
-	// ... else we need to copy a bit around
-
-	// The push_back/memmove is a 33% faster replacement for
-	//    raoI=rpbI->readao.insert(raoI,addoff_t(positionadditionaloffset,urdid));
-
-	rpbI->readao.push_back(addoff_t(0,0)); // just dummy, will be overwritten either by memmove or afterwards
-
-	// we should recalc raoI. Even if not really needed in this case
-	//  ... but it's fast enough to not be of any concern.
-	raoI=rpbI->readao.begin();
-	advance(raoI,araoindex);
-
-	CEBUG("Before memmove. Have araoindex " << araoindex << " and raoI at " << raoI-rpbI->readao.begin() << " with readao size " << rpbI->readao.size() << "\n");
-	CEBUG("memadr  : " << &(*(raoI)) << endl);
-	CEBUG("memadr+1: " << &(*(raoI+1)) << endl);
-	memmove(&(*(raoI+1)),
-		&(*raoI),
-		sizeof(addoff_t)*(rpbI->readao.end()-raoI-1));
-	CEBUG("After memmove\n");
-	raoI->addoffset=positionadditionaloffset;
-	raoI->urdid=urdid;
-	CEBUG("After assign\n");
-      }
-
-      PCR_time_prh_a2b2+=diffsuseconds(tvp);
-      gettimeofday(&tvp,nullptr);
-
-      // have we been inserted at the very front of the bin, with an offset lower than the previous one?
-      if(positionadditionaloffset<0){
-	CEBUG("ADJUST B1" << endl);// debugDump(false));
-	// if yes: adjust additional offset of reads for this bin
-
-	// unroll: 2x faster
-	//__builtin_prefetch(&(*(omI+32)), 1, 3);
-	for(uint32 count=static_cast<uint32>((rpbI->readao.end()-raoI)/4); count; --count){
-	  raoI->addoffset-=positionadditionaloffset;
-	  ++raoI;
-	  raoI->addoffset-=positionadditionaloffset;
-	  ++raoI;
-	  raoI->addoffset-=positionadditionaloffset;
-	  ++raoI;
-	  raoI->addoffset-=positionadditionaloffset;
-	  ++raoI;
-	}
-	CEBUG("ADJUST B2" << endl);// debugDump(false));
-	for(;raoI!=rpbI->readao.end(); ++raoI) {
-	  raoI->addoffset-=positionadditionaloffset;
-	}
-	CEBUG("ADJUST B3" << endl);// debugDump(false));
-	otI->from+=positionadditionaloffset;
-	PCR_time_prh_a2b3+=diffsuseconds(tvp);
-      }
-      PCR_time_prh_a2b+=diffsuseconds(tvt);
-
-    }else{
-      CEBUG("Must split");
-      splitBin(otI-PCR_offsetmap.begin());
-      // recursion: simplest way to rerun placeRead_helper() from start,
-      //  will recurse only once anyway
-      rpbI=placeRead_helper(rpid,position,dir,urdid,araoindex);
-    }
-  }
-  CEBUG("returning" << endl);
-  return rpbI;
-}
-//#define CEBUG(bla)
-
-
-
-/*************************************************************************
- *
- * shift all reads at "position" or higher by the given offset
- *
- * This does *NOT* sort the container anew if some reads are suddenly
- *  wrongly placed. E.g., shift(5,-2) on
- *   1,2,3,4,5,6,7,8,9
- *  gives
- *   1,2,3,4,3,4,5,6,7
- * It's up to the caller to make sure the logic is OK.
- *
- * Having negative positions after the shift is possible. E.g.: shift(0,5) on
- *   0,1,2,3,4,5,6,7,8
- *  gives
- *   -5,-4,-3,-2,-1,0,1,2,3
- *
- *************************************************************************/
-
-void PlacedContigReads::shiftReads(int32 position, int32 offsetdiff)
-{
-  FUNCSTART("void PlacedContigReads::shiftReads(int32 position, int32 offsetdiff)");
-
-  if(offsetdiff==0) return;
-
-  timeval tvp;
-  gettimeofday(&tvp,nullptr);
-
-
-  auto omI=lower_bound(PCR_offsetmap.begin(),PCR_offsetmap.end(),
-		       offsettile_t(position,PCR_readposbins.end()),
-		       offsettile_t::lt_offsetfrom);
-  for(;omI!=PCR_offsetmap.begin(); --omI){
-    if((omI-1)->from + (omI-1)->rpbI->readao.back().addoffset < position) break;
-  }
-
-  PCR_time_sr_lb1+=diffsuseconds(tvp);
-
-  //if(omI == PCR_offsetmap.end()){
-  //  cout << "I'm at PCR_offsetmap.end()\n";
-  //}
-  if(omI != PCR_offsetmap.end()){
-    int targetao=position-omI->from;
-    //cout << "My from is " << omI->from << " and targetao is " << targetao << endl;
-    auto rpbI=omI->rpbI;
-
-    // Time of this simple loop is the same as for lower_bound(),
-    //  but lower_bound should be more cache friendly.
-    //auto raoI=rpbI->readao.begin();
-    //while(raoI!=rpbI->readao.end() && raoI->addoffset < targetao) ++raoI;
-
-    gettimeofday(&tvp,nullptr);
-    auto raoI=lower_bound(rpbI->readao.begin(),rpbI->readao.end(),
-			  addoff_t(targetao,0),
-			  addoff_t::lt);
-
-    PCR_time_sr_lb2+=diffsuseconds(tvp);
-
-    // even on large containers (>1m reads), this loop takes almost no time
-    //  ...
-    if(raoI!=rpbI->readao.begin()){
-      gettimeofday(&tvp,nullptr);
-      for(; raoI!=rpbI->readao.end(); ++raoI){
-	raoI->addoffset+=offsetdiff;
-      }
-      PCR_time_sr_aoadj+=diffsuseconds(tvp);
-      ++omI;
-    }
-    PCR_time_sr_aoadj+=diffsuseconds(tvp);
-
-    // ... when compared to this loop
-    //
-    // unrolling saves ~5% (from & to, from only 2.5%)
-    // unrolling with prefetch saves ~19% (from & to, from only 17 %)
-    gettimeofday(&tvp,nullptr);
-    for(uint32 count=(PCR_offsetmap.end()-omI)/4; count; --count){
-      __builtin_prefetch(&(*(omI+32)), 1, 3);
-      omI->from+=offsetdiff;
-      ++omI;
-      omI->from+=offsetdiff;
-      ++omI;
-      omI->from+=offsetdiff;
-      ++omI;
-      omI->from+=offsetdiff;
-      ++omI;
-    }
-    for(; omI!=PCR_offsetmap.end(); ++omI){
-      omI->from+=offsetdiff;
-    }
-    PCR_time_sr_omadj+=diffsuseconds(tvp);
-
-  }
-
-  FUNCEND();
-}
-
-
-
-/*************************************************************************
- *
- * shift all reads at "position" or higher by the given offset, but bounce
- *  negative offsets back to 0
- *
- * E.g.: shiftReadsBounceZero(0,5) on
- *   0,1,2,3,4,5,6,7,8
- * becomes an intermediate (from shiftReads(0,-5))
- *   -5,-4,-3,-2,-1,0,1,2,3
- * and finally a
- *   0,0,0,0,0,0,1,2,3
- *
- * This is a hacky thing helping to implement cutting back overhanging
- *  front reads in mapping assemblies (Contig::trimMapOverhang())
- *
- * Like for shiftReads(), there is no reordering of the container, so doing
- *  a shiftReadsBounceZero(2,-5) will wreak havoc on
- *   0,1,2,3,4,5,6,7,8
- * producing
- *   0,1,-3,-2,-1,0,1,2,3
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-void PlacedContigReads::shiftReadsBounceZero(int32 position, int32 offsetdiff)
-{
-  FUNCSTART("void PlacedContigReads::shiftReads(int32 position, int32 offsetdiff)");
-
-  //CEBUG("BEFORE1\n");
-  //debugDump(false);
-
-  shiftReads(position,offsetdiff);
-
-  //CEBUG("BEFORE2\n");
-  //debugDump(false);
-
-  // need to bounce?
-  if(PCR_offsetmap.front().from<=0){
-    // yes
-    CEBUG("BOUNCE!\n");
-    auto omI=PCR_offsetmap.begin();
-    for(; omI!=PCR_offsetmap.end(); ++omI){     // TODO: eventually more intelligent, earlier stop, but don't care ATM
-      for(auto & raoe : omI->rpbI->readao){
-	CEBUG("test bounce " << PCR_readdump[raoe.urdid].getName());
-	CEBUG("\tof: " << omI->from);
-	CEBUG("\tao: " << raoe.addoffset);
-	CEBUG(endl);
-	if(omI->from+raoe.addoffset < 0){
-	  CEBUG("bounceit!\n");
-	  raoe.addoffset=-omI->from;
-	}
-      }
-    }
-  }
-
-  //CEBUG("AFTER\n");
-  //debugDump(false);
-
-  FUNCEND();
-}
-//#define CEBUG(bla)
-
-/*************************************************************************
- *
- * remove a placed read, return iterator to element after
- *
- *************************************************************************/
-
-PlacedContigReads::const_iterator PlacedContigReads::removeRead(PlacedContigReads::const_iterator pcrI)
-{
-  FUNCSTART("void removeRead(const_iterator pcrI)");
-
-  BUGIFTHROW(pcrI==end(),"pcrI=end() ??");
-
-  auto retrpbI=pcrI.rpbI;
-  auto retaoi=pcrI.raoindex;
-
-  auto urdid=pcrI.rpbI->readao[pcrI.raoindex].urdid;
-
-  // delete orpid from PCR_map*
-  delORPIDFromMap(PCR_ancillaryinfo[urdid].orpid);
-
-  // invalidate ancillary info
-  PCR_ancillaryinfo[urdid]=ancillaryinfo_t(-1,0,PCR_readposbins.end());
-
-  if(pcrI.rpbI->readao.size()==1){
-    auto omI=PCR_offsetmap.begin();
-    advance(omI,pcrI.rpbI->offsetmapindex);
-    PCR_offsetmap.erase(omI);
-
-    // terrible hack: cannot assign a list<>::const_iterator to a list<>::iterator
-    //  though we need that for erase()
-    // I don't want to change PlacedContigReads::const_iterator.rpbI to a list<>::iterator
-    // Therefore:
-    // recreate artificially a list<>::iterator by doing a list traversal *sigh*
-    //  this is so sick ... !
-    list<rposbin_t>::iterator rpbI=PCR_readposbins.begin();
-    for(; rpbI!=pcrI.rpbI; ++rpbI) {};
-
-    rpbI=PCR_readposbins.erase(rpbI);
-    retrpbI=rpbI;
-    retaoi=0;
-    for(; rpbI!=PCR_readposbins.end(); ++rpbI){
-      rpbI->offsetmapindex-=1;
-    }
-  }else{
-    // more sickness:
-    // pcrI.rpbI->readao is constified, this is the easiest way I found to cast the const away
-    //  as const_cast<vector<addoff_t>>(pcrI.rpbI->readao) does not work
-    vector<addoff_t> * raovptr=const_cast<vector<addoff_t> *>(&pcrI.rpbI->readao);
-
-    if(pcrI.raoindex == 0){
-      auto offsetdiff=pcrI.rpbI->readao[1].addoffset;
-      PCR_offsetmap[pcrI.rpbI->offsetmapindex].from+=offsetdiff;
-      for(auto tmpI=raovptr->begin(); tmpI!=raovptr->end(); ++tmpI){
-	tmpI->addoffset-=offsetdiff;
-      }
-    }
-
-    auto eI=raovptr->begin();
-    advance(eI,pcrI.raoindex);
-    raovptr->erase(eI);
-
-    if(retaoi>=raovptr->size()){
-      ++retrpbI;
-      retaoi=0;
-    }
-  }
-
-  // release read in read dump
-  PCR_readdump.releaseRead(urdid);
-
-  // if the whole thing gets empty, clear() the PCR to get things clean
-  //  (e.g. the ReadContainer PCR_readdump gets faster when re-filled)
-  if(--PCR_numreads==0){
-    clear();
-  }
-
-  FUNCEND();
-
-  return const_iterator(pcrI.pcr,retrpbI,retaoi);
-}
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-PlacedContigReads::const_iterator PlacedContigReads::getPCRIForReadsStartingAtPos(int32 position) const
-{
-  FUNCSTART("PlacedContigReads::const_iterator PlacedContigReads::getPCRIForReadsStartingAtPos(int32 position) const");
-
-  // TODO: this is very much like the beginning of shiftRead()
-  // consolidate?
-
-
-  // const gymnastics to get this function to compile as "const"
-  auto ncthis=const_cast<PlacedContigReads *>(this);
-
-  list<PlacedContigReads::rposbin_t>::iterator rpbI=ncthis->PCR_readposbins.end();
-  const_iterator::raoindex_t araoindex=0;
-
-  auto otI=lower_bound(ncthis->PCR_offsetmap.begin(), ncthis->PCR_offsetmap.end(),
-		       offsettile_t(position,ncthis->PCR_readposbins.end()),       // comparator object, only position matters
-		       offsettile_t::lt_offsetfrom);
-  for(;otI!=PCR_offsetmap.begin(); --otI){
-    if((otI-1)->from + (otI-1)->rpbI->readao.back().addoffset < position) break;
-  }
-
-  if(otI != PCR_offsetmap.end()){
-    int targetao=position-otI->from;
-    rpbI=otI->rpbI;
-    auto raoI=lower_bound(rpbI->readao.begin(),
-			  rpbI->readao.end(),
-			  addoff_t(targetao,0),           // comparator object, only position matters
-			  addoff_t::lt);
-    araoindex=static_cast<const_iterator::raoindex_t>(raoI - rpbI->readao.begin());
-  }
-
-  return const_iterator(this,rpbI,araoindex);
-
-  FUNCEND();
-}
-
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-ostream & PlacedContigReads::dumpPCRIElement(ostream &ostr, const const_iterator & pcrI) const
-{
-  ostr << pcrI->getLenClippedSeq() << " "
-       << pcrI.getReadStartOffset()
-       << "-" << pcrI.getReadStartOffset() + pcrI->getLenClippedSeq()-1;
-  if(pcrI.getReadDirection() < 0){
-    ostr << "\t-";
-  }else{
-    ostr << "\t+";
-  }
-  ostr << pcrI->getName();
-  ostr << '\t' << pcrI.getORPID();
-
-  return ostr;
-}
diff --git a/src/mira/pcrcontainer.H b/src/mira/pcrcontainer.H
deleted file mode 100644
index 8127bd0..0000000
--- a/src/mira/pcrcontainer.H
+++ /dev/null
@@ -1,435 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 2012 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-
-#ifndef _mira_pcrcont_h_
-#define _mira_pcrcont_h_
-
-#include "stdinc/types.H"
-#include "mira/readpool.H"
-
-
-class PlacedContigReads
-{
-private:
-  ReadPool * PCR_originalrp;  // original readpool
-
-  // additional offset per read
-  struct addoff_t {
-    int32  addoffset;        // additional offset
-    int32  urdid;            // read id in the unsorted readdump, >=0 OK, <0 should never happen
-
-    inline addoff_t(int32 ao, int32 uid) : addoffset(ao),urdid(uid) {};
-    static inline bool lt(const addoff_t & a, const addoff_t & b) { return a.addoffset<b.addoffset;}
-  };
-
-  // for list, sorted by position
-  struct rposbin_t {
-    uint32           offsetmapindex;   // index to offsetbin
-    std::vector<addoff_t> readao;
-
-    inline rposbin_t(uint32 omi, size_t reservesize) : offsetmapindex(omi) {readao.reserve(reservesize);};
-  };
-
-
-  // unsorted vector, linked to ReadPool::ReadContainer (same index)
-  struct ancillaryinfo_t {
-    int32 orpid;              // read id in the original readpool
-    int8  direction;
-
-    std::list<rposbin_t>::iterator rpbI;
-
-    inline ancillaryinfo_t(int32 rpid, int8 dir, std::list<rposbin_t>::iterator I): orpid(rpid),direction(dir),rpbI(I) {};
-  };
-
-  // sorted by baseoffset (vector)
-  struct offsettile_t{
-    int32  from;
-    std::list<rposbin_t>::iterator rpbI;       // iterator back to rposbin_t in list
-
-    inline offsettile_t(int32 bofr, std::list<rposbin_t>::iterator I) : from(bofr),rpbI(I) {};
-    static inline bool lt_offsetfrom(const offsettile_t & a, const offsettile_t & b) { return a.from<b.from;}
-  };
-
-/*************************************************************************
- *
- * Main logic for the containers and placement
- *
- *  - readdump & ancillaryinfo are linked: always the same size (except
- *    for a short time in placeRead() and placeRead_helper())
- *  - readdump and baseoffset link back via iterators to readpositioning
- *  - readpositioning links back via readao.urdid (index) to readdump/ancillaryinfo
- *                    links back via offsetmapindex to baseoffset
- *  - after having removed a read, ancillary info may contain entries paired
- *    to empty / invalid reads.
- *
- * readpositioning: the first element of each new bin has *always* an
- *  addoffset==0!
- *
- *************************************************************************/
-  ReadPool::ReadContainer   PCR_readdump;
-  std::vector<ancillaryinfo_t>   PCR_ancillaryinfo;
-
-  std::list<rposbin_t>           PCR_readposbins;
-  std::vector<offsettile_t>      PCR_offsetmap;
-
-  uint32                    PCR_bo_binsize;
-
-/*************************************************************************
- *
- * Main logic for the containers and placement
- *
- *************************************************************************/
-  std::vector<std::list<rposbin_t>::iterator>    PCR_maprpids_to_rpb_v;      // map RP id to readposbin_t
-  /* same as above, but with a map behaviour: for less than (8k?)  reads, use
-     map, else will switch on the fly to the vector. Rationale: a vector is bad
-     for projects with millions of reads contigs with low number of reads,
-     a map is bad for large contigs with many reads */
-  std::map<int32,std::list<rposbin_t>::iterator> PCR_maprpids_to_rpb_m;
-
-  size_t PCR_numreads; /* number of placed reads. Cannot use PCR_ancillaryinfo because
-			  removeRead() and the ReadContainer PCR_readdump will
-			  not physically remove, but rather flag for re-use */
-
-  suseconds_t PCR_time_sr_lb1;
-  suseconds_t PCR_time_sr_lb2;
-  suseconds_t PCR_time_sr_aoadj;
-  suseconds_t PCR_time_sr_omadj;
-
-  suseconds_t PCR_time_sb_total;
-  suseconds_t PCR_time_sb_c2h;
-
-  suseconds_t PCR_time_prh_pf;
-  suseconds_t PCR_time_prh_a2b1;
-  suseconds_t PCR_time_prh_a2b2;
-  suseconds_t PCR_time_prh_a2b3;
-  suseconds_t PCR_time_prh_a2b;
-
-
-  /*************************************************************************************
-   *
-   *
-   *  Iterators
-   *
-   *
-   *************************************************************************************/
-public:
-  class const_iterator
-    : public boost::iterator_facade<
-    const_iterator                          // Derived
-    , Read const             // Value
-    , std::bidirectional_iterator_tag   //random_access_iterator_tag  //boost::forward_traversal_tag    // CategoryOrTraversal
-    > {
-
-  friend class PlacedContigReads;
-
-  public:
-    typedef uint32 raoindex_t;
-
-  private:
-    PlacedContigReads const * pcr;
-    std::list<rposbin_t>::const_iterator rpbI;
-    raoindex_t raoindex;
-
-  public:
-    inline const_iterator(const PlacedContigReads * apcr, std::list<rposbin_t>::const_iterator arpbI, uint32 araoindex) : pcr(apcr),rpbI(arpbI),raoindex(araoindex) { };
-
-    inline uint32 getReadStartOffset() const {
-      return pcr->PCR_offsetmap[rpbI->offsetmapindex].from + rpbI->readao[raoindex].addoffset;
-    }
-    inline int32 getOriginalReadPoolID() const {
-      return pcr->PCR_ancillaryinfo[rpbI->readao[raoindex].urdid].orpid;
-    }
-    inline int32 getORPID() const {
-      return getOriginalReadPoolID();
-    }
-    inline void setORPID(int32 neworpid) {
-      // some const gymnastics to be able to assign the value in an otherwise const object
-      *(const_cast<int32 *>(&(pcr->PCR_ancillaryinfo[rpbI->readao[raoindex].urdid].orpid)))=neworpid;
-    }
-    inline int8 getReadDirection() const {
-      return pcr->PCR_ancillaryinfo[rpbI->readao[raoindex].urdid].direction;
-    }
-    inline int32 getURDID() const {
-      return rpbI->readao[raoindex].urdid;
-    }
-
-    friend std::ostream & operator<<(std::ostream &ostr, const const_iterator & ci) {
-      ostr << "pcr: " << ci.pcr << "\trpbI: " << &(*(ci.rpbI)) << "\traoi " << ci.raoindex << "\t";
-      if(ci==ci.pcr->end()){
-	ostr << "This is end()" << std::endl;
-      }else{
-	ci.pcr->dumpPCRIElement(ostr,ci);
-      }
-      return ostr;
-    }
-
-
-   /*******************************************************************
-    *
-    *  unclippedReadPosToContigPos
-    *  We have a position in an UNCLIPPED read and we want to know the corresponding
-    *  position in the contig
-    *
-    ******************************************************************/
-    inline int32 unclippedReadPos2ContigPos(const int32 readpos) const
-      {
-	if (getReadDirection() > 0) {
-	  return readpos - (*this)->getLeftClipoff() + getReadStartOffset() ;
-	} else {
-	  return (*this)->getRightClipoff()- readpos + getReadStartOffset() -1 ;
-	}
-      }
-
-    /******************************************************************
-     *
-     * contigPosToUnclippedReadPos
-     * We have a contig position and we want to know which position in the
-     * UNCLIPPED FORWARD read corresponds to the contig position
-     *
-     ******************************************************************/
-
-    inline int32 contigPos2UnclippedReadPos(const int32 contigpos) const
-      {
-	if (getReadDirection() > 0) {
-	  return contigpos - getReadStartOffset() + (*this)->getLeftClipoff();
-	} else {
-	  // FALSCH return ric.offset + ric.read.getRightClipoff() -1 - contigpos;
-	  return (*this)->getLenSeq() - (*this)->getRightClipoff() + contigpos - getReadStartOffset();
-	}
-      };
-    inline int32 contigPos2RawReadPos(const int32 contigpos) const
-      {
-	if (getReadDirection() > 0) {
-	  return contigPos2UnclippedReadPos(contigpos);
-	} else {
-	  return (*this)->calcComplPos(contigPos2UnclippedReadPos(contigpos));
-	}
-      };
-
-
-    /******************************************************************
-     *
-     *
-     *
-     ******************************************************************/
-    inline char getBase(const int32 contigpos) const
-      {
-	if(getReadDirection()>0){
-	  return (*this)->getBaseInSequence(contigPos2UnclippedReadPos(contigpos));
-	}else{
-	  return (*this)->getBaseInComplementSequence(contigPos2UnclippedReadPos(contigpos));
-	}
-      }
-    inline base_quality_t getQuality(const int32 contigpos) const
-      {
-	if(getReadDirection()>0){
-	  return (*this)->getQualityInSequence(contigPos2UnclippedReadPos(contigpos));
-	}else{
-	  return (*this)->getQualityInComplementSequence(contigPos2UnclippedReadPos(contigpos));
-	}
-      }
-
-    // this is a bad idea ... incredibly slow compared to currently used methods outside pcrI
-    //   (calc read pos, then access base and qual directly on read)
-    //
-    //inline void getBaseAndQuality(const int32 contigpos, char & base, base_quality_t & qual) const
-    //  {
-    //	auto urp=contigPos2UnclippedReadPos(contigpos);
-    //	if(getReadDirection()>0){
-    //	  base=(*this)->getBaseInSequence(urp);
-    //	  qual=(*this)->getQualityInSequence(urp);
-    //	}else{
-    //	  base=(*this)->getBaseInComplementSequence(urp);
-    //	  qual=(*this)->getQualityInComplementSequence(urp);
-    //
-    //  }
-
-
-  private:
-    // Everything Boost's iterator facade needs
-    friend class boost::iterator_core_access;
-
-    // behaviour of dereference might seem a bit strange: it returns const Read &
-    // i.e., when dereferenced one cannot access position or read direction of read
-    //
-    // Reason: the PlacedContigReads::const_iterator is behaving a bit like a SQL VIEW,
-    //  i.e., it aggregates information which is not present together as "struct"
-    //  I could copy all these things into a temporary structure, but why should this be
-    //  done? For many use cases (iterating through a contig etc.) this would just waste
-    //  time
-    //
-    // In the end this means: if one wants to get info on the placement, use the iterator
-    //  functions above (getReadPosition(), getReadDirection(), getOriginalReadPoolID() etc.pp)
-    // Also the other functions allowing to translate contig positions to read positions,
-    //  get a base of a read in a contig etc., use the iterator functions.
-    inline Read const & dereference() const
-    {
-      // TODO: eventually remove the BUGIFTHROW if prooves to be to slow (check that
-      //  on projects)
-      FUNCSTART("inline Read const & PlacedContigReads::const_iterator::dereference() const");
-      BUGIFTHROW(*this==pcr->end(),"Trying to dereference an iterator pointing to end()???");
-      return pcr->PCR_readdump[rpbI->readao[raoindex].urdid];
-    }
-
-    inline bool equal(const_iterator const & other) const
-    {
-      return rpbI == other.rpbI && raoindex == other.raoindex;
-    }
-
-    inline void increment()
-    {
-      ++raoindex;
-      if(raoindex==rpbI->readao.size()){
-	++rpbI;
-	raoindex=0;
-      }
-    }
-
-    inline void decrement()
-    {
-      if(raoindex>0){
-	--raoindex;
-      }else{
-	--rpbI;
-	raoindex=static_cast<raoindex_t>(rpbI->readao.size()-1);
-      }
-    }
-  };
-
-
-private:
-  void addORPID2Map(int32 rpid, std::list<rposbin_t>::iterator rpbI);
-  void delORPIDFromMap(int32 rpid);
-  inline void updateMapBinOfORPID(int32 rpid, std::list<rposbin_t>::iterator rpbI){
-    // careful with rpid: may be -1 for CER reads
-    if(rpid>=0){
-      if(!PCR_maprpids_to_rpb_v.empty()){
-	if(rpid>=PCR_maprpids_to_rpb_v.size()){
-	  std::cout << "updateMapBinOfORPID(): should never arrive here. rpid " << rpid << " >= PCR_maprpids_to_rpb_v.size() " << PCR_maprpids_to_rpb_v.size() << std::endl;
-	  exit(1000);
-	}
-	PCR_maprpids_to_rpb_v[rpid]=rpbI;
-      }else{
-	auto mI=PCR_maprpids_to_rpb_m.find(rpid);
-	if(mI==PCR_maprpids_to_rpb_m.end()){
-	  std::cout << "updateMapBinOfRPID(): should never arrive here, did not find rpid " << rpid << std::endl;
-	  exit(1000);
-	}
-	mI->second=rpbI;
-      }
-    }
-  };
-
-
-  std::vector<offsettile_t>::iterator searchOffsetTileForPlacement(int32 position);
-  //std::list<PlacedContigReads::rposbin_t>::iterator findReadpositionIterator(int32 position);
-
-  void splitBin(uint32 binindex);
-  std::list<rposbin_t>::iterator placeRead_helper(int32 rpid,
-						  int32 position,
-						  int8 direction,
-						  int32 urdid,
-						  const_iterator::raoindex_t & araoindex);
-
-public:
-  PlacedContigReads(ReadPool & rp) : PCR_originalrp(&rp), PCR_bo_binsize(2048), PCR_numreads(0),
-				     PCR_time_sr_lb1(0),
-				     PCR_time_sr_lb2(0),
-				     PCR_time_sr_aoadj(0),
-				     PCR_time_sr_omadj(0),
-				     PCR_time_sb_c2h(0),
-				     PCR_time_sb_total(0),
-				     PCR_time_prh_pf(0),
-				     PCR_time_prh_a2b1(0),
-				     PCR_time_prh_a2b2(0),
-				     PCR_time_prh_a2b3(0),
-				     PCR_time_prh_a2b(0)
-    {};
-  ~PlacedContigReads();
-
-  // Copy constructor & copy operator
-  PlacedContigReads(const PlacedContigReads&) = delete;
-  PlacedContigReads const & operator=(PlacedContigReads const & other);
-
-
-  inline const_iterator begin() const {
-    return const_iterator(this,PCR_readposbins.begin(),0);
-  }
-  inline const_iterator end() const {
-    return const_iterator(this,PCR_readposbins.end(),0);
-  }
-//  inline reverse_iterator rbegin() {
-//    return reverse_iterator(this,PCR_readposbins.rbegin(),PCR_readposbins.rbegin()->readao.size()-1);
-//  }
-//  inline reverse_iterator rend() {
-//    return reverse_iterator(this,PCR_readposbins.rend(),0);
-//  }
-
-  inline size_t size() const {return PCR_numreads;};
-  inline bool empty() const {return PCR_numreads==0;};
-
-  std::ostream & dumpPCRIElement(std::ostream &ostr, const const_iterator & ci) const;
-
-  const_iterator getIteratorOfReadpoolID(int32 rpid);
-  inline const Read & getReadAtURDID(int32 urdid) const {
-    return PCR_readdump[urdid];
-  }
-  inline int8 getReadDirectionAtURDID(int32 urdid) const {
-    FUNCSTART("inline int8 getReadDirectionAtURDID(int32 urdid) const");
-    BUGIFTHROW(urdid >= static_cast<int32>(PCR_ancillaryinfo.size()),"urdid >= PCR_ancillaryinfo.size() ???");
-    return PCR_ancillaryinfo[urdid].direction;
-  }
-  inline int32 getReadORPIDAtURDID(int32 urdid) const {
-    FUNCSTART("inline int8 getReadORPIDAtURDID(int32 urdid) const");
-    BUGIFTHROW(urdid >= static_cast<int32>(PCR_ancillaryinfo.size()),"urdid >= PCR_ancillaryinfo.size() ???");
-    return PCR_ancillaryinfo[urdid].orpid;
-  }
-
-  void clear() {
-    PCR_readdump.clear();
-    PCR_ancillaryinfo.clear();
-    PCR_readposbins.clear();
-    PCR_offsetmap.clear();
-    PCR_maprpids_to_rpb_v.clear();
-    PCR_maprpids_to_rpb_m.clear();
-    PCR_numreads=0;
-  }
-
-  void setBinSize(uint32 bs) {PCR_bo_binsize=bs;};
-  const_iterator placeRead(const Read & theread, int32 rpid, int32 position, int8 direction);
-  const_iterator removeRead(const_iterator pcrI);
-
-  void shiftReads(int32 position, int32 offsetdiff);
-  void shiftReadsBounceZero(int32 position, int32 offsetdiff);
-
-  const_iterator getPCRIForReadsStartingAtPos(int32 position) const;
-
-
-  void debugDump(bool shortdbg);
-
-};
-
-
-#endif
diff --git a/src/mira/ppathfinder.C b/src/mira/ppathfinder.C
deleted file mode 100644
index f646fb2..0000000
--- a/src/mira/ppathfinder.C
+++ /dev/null
@@ -1,2492 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 2003 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-#include "ppathfinder.H"
-#include "errorhandling/errorhandling.H"
-
-// for time measurements
-#include <sys/times.h>
-
-using namespace std;
-
-#define CEBUG(bla)
-
-// cs1 for normal clocking ('user compatible' as is does not disturb user)
-// cs2 is for extensive clocking output, more for analysis of MIRA behaviour
-//  during development
-
-#define CLOCK_STEPS1
-#ifndef PUBLICQUIET
-#define CLOCK_STEPS2
-#endif
-
-#define CLOCK_STEPS2
-
-
-/*************************************************************************
- *
- * This should be a compile time check, but don't know how!
- *
- *************************************************************************/
-
-bool PPathfinder::PPF_staticinit=PPathfinder::staticInit();
-bool PPathfinder::staticInit()
-{
-  //cout << "QTG_END " << QTG_END << " QTE_END " << QTE_END << endl;
-  if(QTG_END<QTE_END){
-    cout << "PPathfinder problem: QTG_END " << QTG_END << " is < QTE_END " << QTE_END
-	 << "\nThis is a problem which can only be fixed by changing the source code! " << endl;
-    exit(1000);
-  }
-  return true;
-}
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-// Plain vanilla constructor
-PPathfinder::PPathfinder(vector<MIRAParameters> * params, ReadPool * readpool, necontainer_t * overlap_edges, adsfcontainer_t * adsfacts, vector<Align> * aligncache, vector<int8> * used_ids, vector<uint8> * multicopies, vector<uint8> * hasmcoverlaps, vector<uint8> * hasreptoverlaps, vector<uint8> * hasnoreptoverlaps, vector<uint8> * istroublemaker, vector<uint8> * incorrectibleorchimera, vector<uint8> * maybespoilsport, vector<uint8> * wellconnected,vector<necontainer_t::iterator > * low [...]
-{
-  FUNCSTART("PPathfinder::PPathfinder()");
-
-  PPF_actcontig_ptr=nullptr;
-
-  PPF_miraparams_ptr=params;
-  PPF_readpool_ptr=readpool;
-  PPF_overlap_edges_ptr=overlap_edges;
-  PPF_adsfacts_ptr=adsfacts;
-  PPF_aligncache_ptr=aligncache;
-  PPF_used_ids_ptr=used_ids;
-  PPF_multicopies_ptr=multicopies;
-  PPF_hasmcoverlap_ptr=hasmcoverlaps;
-  PPF_hasreptoverlap_ptr=hasreptoverlaps;
-  PPF_hasnoreptoverlap_ptr=hasnoreptoverlaps;
-  PPF_istroublemaker_ptr=istroublemaker;
-  PPF_incorrectibleorchimera_ptr=incorrectibleorchimera;
-  PPF_maybespoilsport_ptr=maybespoilsport;
-  PPF_wellconnected_ptr=wellconnected;
-  PPF_lowerbound_oedges_ptr=lowerbound_oedges_ptr;
-  PPF_astemplateguesses_ptr=astemplateguesses;
-
-  //////
-  if(PPF_hasnoreptoverlap_ptr->empty()){
-    priv_ppFillNoRept();
-  }
-  if(PPF_hasreptoverlap_ptr->empty()){
-    priv_ppFillRept();
-  }
-  if(PPF_maybespoilsport_ptr->empty()){
-    priv_ppFillSpoilSport();
-  }
-  //////
-
-  PPF_pafparams_ptr=&((*PPF_miraparams_ptr)[0].getPathfinderParams());
-
-  PPF_ids_in_contig_list.reserve(readpool->size());
-  PPF_ids_added_oltype.resize(readpool->size(),0);
-  PPF_blacklisted_ids.resize(readpool->size(),0);
-  PPF_tmparray.resize(readpool->size(),0);
-
-  // give the small store iterators to banned overlaps a capacity of
-  //  500k entries.
-  // should be enough even for extremely deep RNASeq data
-  PPF_overlapsbanned_smallstore.reserve(500000);
-
-  PPF_wantscleanoverlapends=0;
-  PPF_mintotalnonmatches=0;
-  PPF_allowedseqtype=ReadGroupLib::SEQTYPE_END;
-
-  FUNCEND();
-}
-
-
-PPathfinder::~PPathfinder()
-{
-  FUNCSTART("PPathfinder::~PPathfinder()");
-
-  // do nothing???
-
-  FUNCEND();
-}
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-void PPathfinder::priv_ppFillNoRept()
-{
-  PPF_hasnoreptoverlap_ptr->clear();
-  PPF_hasnoreptoverlap_ptr->resize(PPF_readpool_ptr->size(),false);
-  for(auto & oee : *PPF_overlap_edges_ptr){
-    if(oee.ol_norept){
-      (*PPF_hasnoreptoverlap_ptr)[oee.rid1]=true;
-      (*PPF_hasnoreptoverlap_ptr)[oee.linked_with]=true;
-    }
-  }
-}
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-void PPathfinder::priv_ppFillRept()
-{
-  PPF_hasreptoverlap_ptr->clear();
-  PPF_hasreptoverlap_ptr->resize(PPF_readpool_ptr->size(),false);
-  for(auto & oee : *PPF_overlap_edges_ptr){
-    if(oee.ol_rept){
-      (*PPF_hasreptoverlap_ptr)[oee.rid1]=true;
-      (*PPF_hasreptoverlap_ptr)[oee.linked_with]=true;
-    }
-  }
-}
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-void PPathfinder::priv_ppFillSpoilSport()
-{
-  auto & rp=*PPF_readpool_ptr;
-  auto & wc=*PPF_wellconnected_ptr;
-  auto & mss=*PPF_maybespoilsport_ptr;
-
-  mss.clear();
-  mss.resize(rp.size(),false);
-
-  for(size_t rpi=0; rpi<rp.size(); ++rpi){
-    if(!wc[rpi]){
-      auto & actread=rp[rpi];
-      auto bhsI=actread.getBPosHashStats().cbegin();
-      int32 xpos=actread.getLeftClipoff();
-      if(xpos>=0){
-	advance(bhsI,xpos);
-	if(!bhsI->fwd.isValid()){
-	  mss[rpi]=true;
-	}
-      }
-      xpos=actread.getRightClipoff();
-      if(xpos>0){
-	bhsI=actread.getBPosHashStats().begin();
-	advance(bhsI,xpos-1);
-	if(!bhsI->rev.isValid()){
-	  mss[rpi]=true;
-	}
-      }
-    }
-  }
-}
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush(); }
-void PPathfinder::prepareForNewContig(Contig & con)
-{
-  FUNCSTART("void PPathfinder::prepareForNewContig(Contig & con)");
-
-  PPF_actcontig_ptr=&con;
-
-  for(auto & qu : PPF_queues){
-    BUGIFTHROW(!qu.empty(),"Queue not empty?");
-  }
-
-  for(auto rid : PPF_ids_in_contig_list){
-    PPF_ids_added_oltype[rid]=ADDED_NOTADDED;
-  }
-  PPF_ids_in_contig_list.clear();
-  PPF_rails_in_contig_list.clear();
-
-  vector<int8> & lr_used_ids = *PPF_used_ids_ptr;
-  auto & cr=PPF_actcontig_ptr->getContigReads();
-  for(auto pcrI=cr.begin(); pcrI!=cr.end(); ++pcrI){
-    if(pcrI.getORPID()>=0){
-      PPF_ids_in_contig_list.push_back(pcrI.getORPID());
-      lr_used_ids[pcrI.getORPID()]=1;
-      if(pcrI->isRail() || pcrI->isBackbone()){
-	PPF_ids_added_oltype[pcrI.getORPID()]=ADDED_BY_BACKBONE;
-	if(pcrI->isRail()) PPF_rails_in_contig_list.push_back(pcrI.getORPID());
-      }else{
-	priv_insertRIDIntoDenovoQueues(pcrI.getORPID());
-      }
-    }
-  }
-
-  FUNCEND();
-}
-//#define CEBUG(bla)
-
-
-/*************************************************************************
- *
- * almost like prepareForNewContig(), but here we trust the external
- *  used_ids and synch the contig according to it.
- * also, entries in PPF_ids_added_oltype do not get all cleared, just the ones
- *  of reads which "disappeared" between the time the pathfinder last saw
- *  the contig and now (due to cutdown by assembly etc.)
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush(); }
-void PPathfinder::resyncContig()
-{
-  FUNCSTART("void PPathfinder::resyncContig()");
-
-  BUGIFTHROW(PPF_actcontig_ptr==nullptr,"PPF_actcontig_ptr==nullptr ???");
-
-  for(auto & qu : PPF_queues){
-    BUGIFTHROW(!qu.empty(),"Queue not empty?");
-  }
-
-  vector<int8> & lr_used_ids = *PPF_used_ids_ptr;
-  for(auto rid : PPF_ids_in_contig_list){
-    if(!lr_used_ids[rid]){
-      PPF_ids_added_oltype[rid]=0;
-    }
-  }
-  PPF_ids_in_contig_list.clear();
-  PPF_rails_in_contig_list.clear();
-
-  auto & cr=PPF_actcontig_ptr->getContigReads();
-  for(auto pcrI=cr.begin(); pcrI!=cr.end(); ++pcrI){
-    if(pcrI.getORPID()>=0){
-      if(lr_used_ids[pcrI.getORPID()]){
-	PPF_ids_in_contig_list.push_back(pcrI.getORPID());
-	if(pcrI->isRail() || pcrI->isBackbone()){
-	  if(pcrI->isRail()) PPF_rails_in_contig_list.push_back(pcrI.getORPID());
-	}
-	// nope ... both map() and denovo() should take care of that
-	// priv_insertRIDIntoDenovoQueues(pcrI.getORPID());
-      }else{
-      }
-    }
-  }
-
-  FUNCEND();
-}
-//#define CEBUG(bla)
-
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush(); }
-void PPathfinder::denovo()
-{
-  FUNCSTART("void PPathfinder::denovo()");
-
-  Contig::templateguessinfo_t tguess;
-
-  if(PPF_ids_in_contig_list.size()
-     &&(PPF_actcontig_ptr->getContigReads().size()==0
-	|| PPF_actcontig_ptr->getContigLength()==0)){
-    MIRANOTIFY(Notify::FATAL,"Ummm, forgot to call prepareForNewContig? " << PPF_ids_in_contig_list.size() << " " << PPF_actcontig_ptr->getContigReads().size() << " " << PPF_actcontig_ptr->getContigLength());
-  }
-
-  priv_basicSetup();
-
-  readid_t startid=-1;
-  bool alreadydone=false;
-  size_t fdnmaxdist=0; // fillDenovoQueue maxdist
-  if(PPF_actcontig_ptr->getContigLength()==0){
-    startid=priv_getNextStartID();
-    CEBUG("startid: " << startid << endl);
-    if(startid<0) return;
-    BUGIFTHROW(startid >= static_cast<readid_t>(PPF_used_ids_ptr->size()), "Starting with read id " << startid << " which is >= number of reads " << PPF_used_ids_ptr->size() << " ?");
-    BUGIFTHROW((*PPF_used_ids_ptr)[startid], "Startid " << startid << " already used ???");
-    CEBUG("Read: " << PPF_readpool_ptr->getRead(startid).getName() << endl);
-    BUGIFTHROW(PPF_readpool_ptr->getRead(startid).getLenClippedSeq()==0,"PPF_readpool_ptr->getRead(" << startid << ").getLenClippedSeq()==0???\n" << PPF_readpool_ptr->getRead(startid).getName());
-
-    // if we keep long repeats separated:
-    //   if we start with a non-multicopy read, forbid
-    //    multicopy/multicopy overlaps
-    if((*PPF_multicopies_ptr)[startid]>0) {
-#ifndef PUBLICQUIET
-      cout << "\nStarted with multicopy.\n";
-#endif
-      if(PPF_pafparams_ptr->paf_use_genomic_algorithms) PPF_actcontig_ptr->setLongRepeatStatus(true);
-    }
-
-    ++PPF_readaddattempts;
-    PPF_actcontig_ptr->addRead(*PPF_aligncache_ptr,
-			       nullptr, startid, startid, 1,
-			       (*PPF_multicopies_ptr)[startid],
-			       0,
-			       tguess,
-			       PPF_contigerrstat);
-    (*PPF_used_ids_ptr)[startid]=1;
-    PPF_ids_in_contig_list.push_back(startid);
-    PPF_ids_added_oltype[startid]=1;
-    priv_showProgress();
-
-    if(PPF_bsccontent==BSCC_SINGLETS){
-      // singlets
-      alreadydone=true;
-      CEBUG("That's a singlet, PPF_bsccontent is " << static_cast<uint16>(PPF_bsccontent) << "\n");
-    }
-  }else{
-    // we seem to continue construction of a contig ... prepare for that
-
-    // first: contig may have lost reads, account for that and update some internal arrays
-    // use PPF_tmparray as temporary for info "which reads are in the contig"
-    for(auto index : PPF_tmparray_idxused) PPF_tmparray[index]=0;
-    auto & cr=PPF_actcontig_ptr->getContigReads();
-    for(auto pcrI=cr.begin(); pcrI!=cr.end(); ++pcrI){
-      if(pcrI.getORPID()>=0){
-	PPF_tmparray[pcrI.getORPID()]=1;
-	PPF_tmparray_idxused.push_back(pcrI.getORPID());
-      }
-    }
-    // now adjust PPF_ids_added_oltype && PPF_ids_in_contig_list
-    //  the blacklist was already taken care of by basicSetup
-    // rewrite PPF_ids_in_contig_list in place, swapping unused ids to the end
-    //  and then resizing the array afterwards
-    BUGIFTHROW(PPF_ids_in_contig_list.empty(),"PPF_ids_in_contig_list.empty() ???");
-    auto iicI=PPF_ids_in_contig_list.begin();
-    auto lastusedI=PPF_ids_in_contig_list.end();
-    while(iicI!=lastusedI){
-      if(PPF_tmparray[*iicI]){
-	++iicI;
-      }else{
-	BUGIFTHROW((*PPF_used_ids_ptr)[*iicI],"hmmmm, AS_used not reflecting reality? status for " << *iicI << " not 0!");
-	PPF_ids_added_oltype[*iicI]=0;
-	--lastusedI;
-	if(iicI!=lastusedI) swap(*iicI,*lastusedI);
-      }
-    }
-    PPF_ids_in_contig_list.resize(lastusedI-PPF_ids_in_contig_list.begin());
-    // cleanup tmparray
-    for(auto index : PPF_tmparray_idxused) PPF_tmparray[index]=0;
-    PPF_tmparray_idxused.clear();
-
-    // TODO:
-    //  set this to llength of longest read or so?
-    //  or else 1000
-    fdnmaxdist=1000;
-
-    BUGIFTHROW(PPF_ids_in_contig_list.size()!=PPF_actcontig_ptr->getContigReads().size(),"PPF_ids_in_contig_list.size() " << PPF_ids_in_contig_list.size() << " != PPF_actcontig_ptr->getContigReads().size()" << PPF_actcontig_ptr->getContigReads().size());
-  }
-
-  if(!alreadydone){
-    priv_fillDenovoQueues(fdnmaxdist);
-    priv_loopDenovo();
-  }
-
-  FUNCEND();
-  return;
-};
-//#define CEBUG(bla)
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-void PPathfinder::priv_showProgress()
-{
-  const uint32 cpl=60;
-  if(PPF_buildcontig_newlinecounter==0){
-    cout << '[' << PPF_ids_in_contig_list.size() << "]\t";
-    PPF_buildcontig_newlinecounter=cpl;
-    PPF_timing_pathsearch=0;
-    PPF_timing_connadd=0;
-  }
-#ifdef PUBLICQUIET
-  PPF_contigerrstat.dumpStatus();
-#else
-  PPF_contigerrstat.dumpStatus(true);
-#endif
-  --PPF_buildcontig_newlinecounter;
-  if(PPF_buildcontig_newlinecounter==0){
-    cout << "   " << PPF_actcontig_ptr->getContigLength();
-#ifdef CLOCK_STEPS1
-    cout << "\tpft\t" << PPF_timing_pathsearch/cpl;
-    cout << " / " << PPF_timing_connadd/cpl;
-#endif
-    cout << endl;
-  }
-}
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-void PPathfinder::priv_initialiseLowerBoundOEdges()
-{
-  // initialise the quick lowerbound_oedges lookup vector if not already done
-  if(PPF_lowerbound_oedges_ptr->empty()){
-#ifdef CLOCK_STEPS2
-    timeval tv;
-    gettimeofday(&tv,nullptr);
-#endif
-    //vector<necontainer_t::iterator> & lowerbound_oedges=*PPF_lowerbound_oedges_ptr;
-    vector<necontainer_t::iterator> & lowerbound_oedges=*PPF_lowerbound_oedges_ptr;
-    lowerbound_oedges.resize(PPF_readpool_ptr->size(),PPF_overlap_edges_ptr->end());
-    newedges_t tmp;
-    for(uint32 li=0; li<lowerbound_oedges.size(); ++li) {
-      tmp.rid1=li;
-      lowerbound_oedges[li]=lower_bound(PPF_overlap_edges_ptr->begin(),
-					PPF_overlap_edges_ptr->end(),
-					tmp,
-					newedges_t::sortComparatorByRIDUp);
-    }
-#ifdef CLOCK_STEPS2
-    cout << "Timing priv_initialiseLowerBoundOEdges: " << diffsuseconds(tv) << endl;
-#endif
-  }
-  return;
-}
-
-
-/*************************************************************************
- *
- * called as basic init routine by denovo() or map()
- * take care not to overwrite/destroy structures/values which might be
- *  needed by iterative calls of assembly to map() or denovo()
- *  Those would rather be made by prepareForNewContig()
- *
- *************************************************************************/
-
-void PPathfinder::priv_basicSetup()
-{
-  PPF_buildcontig_newlinecounter=0;
-  PPF_timing_pathsearch=0;
-  PPF_timing_connadd=0;
-  PPF_readaddattempts=0;
-
-  priv_initialiseLowerBoundOEdges();
-
-  if(!PPF_overlapsbanned_smallstore.empty()){
-    if(PPF_overlapsbanned_smallstore.size() < PPF_overlapsbanned_smallstore.capacity()){
-#ifndef PUBLICQUIET
-      cout << "Clear pf_banned quick: " << PPF_overlapsbanned_smallstore.size() << '\n';
-#endif
-      for(auto obI : PPF_overlapsbanned_smallstore){
-	obI->pf_banned=false;
-      }
-    }else{
-#ifndef PUBLICQUIET
-      cout << "Clear pf_banned full\n";
-#endif
-      for(auto & ne : *PPF_overlap_edges_ptr){
-	ne.pf_banned=false;
-      }
-    }
-    PPF_overlapsbanned_smallstore.clear();
-  }
-
-  while(!PPF_blacklist_queues.empty()){
-    for(auto rid : PPF_blacklist_queues.front()){
-      PPF_blacklisted_ids[rid]=0;
-    }
-    PPF_blacklist_queues.pop();
-  }
-
-  return;
-}
-
-
-/*************************************************************************
- *
- * pilfered from Pathfinder::n4_searchBestStrongGoodStartEnvironment_sub
- *
- *************************************************************************/
-
-void PPathfinder::priv_fdns_genome()
-{
-  FUNCSTART("void PPathfinder::priv_fdns_genome()");
-
-#ifdef CLOCK_STEPS2
-  timeval tv;
-  gettimeofday(&tv,nullptr);
-#endif
-
-  PPF_bsccontent=BSCC_GENOME_BESTQUAL;
-  priv_fdns_g_subFillCache(true,true,true,true,true);
-
-  if(PPF_beststartcache.empty()){
-    PPF_bsccontent=BSCC_GENOME_MEDQUAL_TROUBLEMAKER_NOTSTRONG_NOTMULTICOPY_WELLCONNECTED_NOKMERFORK;
-    priv_fdns_g_subFillCache(false,false,true,true,true);
-    if(PPF_beststartcache.empty()){
-      PPF_bsccontent=BSCC_GENOME_MEDQUAL_TROUBLEMAKER_NOTSTRONG_NOTMULTICOPY_WELLCONNECTED_NOKMERFORK;
-      priv_fdns_g_subFillCache(false,false,true,true,true);
-      if(PPF_beststartcache.empty()){
-	PPF_bsccontent=BSCC_GENOME_MEDQUAL_TROUBLEMAKER_NOTSTRONG_MULTICOPY_WELLCONNECTED_NOKMERFORK;
-	priv_fdns_g_subFillCache(false,false,false,true,true);
-	if(PPF_beststartcache.empty()){
-	  PPF_bsccontent=BSCC_GENOME_BADQUAL_NOTWELLCONNECTED;
-	  priv_fdns_g_subFillCache(false,false,false,false,false);
-	}
-      }
-    }
-  }
-
-  if(!PPF_beststartcache.empty()){
-    sort(PPF_beststartcache.begin(),
-	 PPF_beststartcache.end(),
-	 PPathfinder::beststartinfo_t::ltclustersize
-      );
-  }else{
-    // found nothing ... now put singlets into list
-    priv_fdns_fillSinglets();
-  }
-
-  if(!PPF_beststartcache.empty()){
-    CEBUG("Startcache take " << PPF_beststartcache.back());
-  }
-
-#ifdef CLOCK_STEPS2
-  cout << "Timing priv_fdns_genome total: " << diffsuseconds(tv)
-       << "\n";
-#endif
-
-
-  FUNCEND();
-
-  return;
-
-  //  return 0;
-}
-//#define CEBUG(bla)
-
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-void PPathfinder::priv_fdns_fillSinglets()
-{
-  FUNCSTART("void PPathfinder::priv_fdns_fillSinglets()");
-
-#ifdef CLOCK_STEPS2
-  timeval tvtmp;
-  gettimeofday(&tvtmp,nullptr);
-#endif
-  PPF_bsccontent=BSCC_SINGLETS;
-  {
-    beststartinfo_t tmp;
-    tmp.bsi_clustersize=0;
-    tmp.bsi_numconnects=0;
-
-    readid_t uid=0;
-    for(auto tmpused : *PPF_used_ids_ptr){
-      if(!tmpused){
-	if(PPF_readpool_ptr->getRead(uid).isUsedInAssembly()
-	   && PPF_readpool_ptr->getRead(uid).getLenClippedSeq() > 0) {
-	  tmp.bsi_rid=uid;
-	  PPF_beststartcache.push_back(tmp);
-	}
-      }
-      ++uid;
-    }
-  }
-  CEBUG("Startcache filled with singlets: " << PPF_beststartcache.size() << '\n');
-#ifdef CLOCK_STEPS2
-  cout << "Timing priv_fdns_fillSinglets: " << diffsuseconds(tvtmp) << endl;
-#endif
-}
-
-/*************************************************************************
- *
- *  fills the cache for the best start sites
- *
- *************************************************************************/
-
-
-//#define CEBUG(bla)   {cout << bla; cout.flush(); }
-void PPathfinder::priv_fdns_g_subFillCache(bool wanttroublemakercheck, bool wantstronggoodcheck, bool wantmulticopycheck, bool wantwellconnectedcheck, bool wantnokmerfork)
-{
-  FUNCSTART("void PPathfinder::priv_fdns_g_subFillCache(bool wanttroublemakercheck, bool wantstronggoodcheck, bool wantmulticopycheck, bool wantwellconnectedcheck, bool wantnokmerfork)");
-
-#ifdef CLOCK_STEPS2
-  timeval tv;
-  timeval tvtotal;
-  gettimeofday(&tv,nullptr);
-  tvtotal=tv;
-#endif
-
-  const auto & PPF_used_ids = *PPF_used_ids_ptr;
-  const auto & PPF_istroublemaker = *PPF_istroublemaker_ptr;
-  const auto & PPF_multicopies = *PPF_multicopies_ptr;
-  const auto & PPF_wellconnected = *PPF_wellconnected_ptr;
-
-  vector<bool> uid_in_cluster(PPF_used_ids.size(),false);
-
-  // in EST / RNASeq projects, things can get *very* ugly ... clusters of
-  //  several million reads (rRNA etc). This takes ages, even on fast processors
-  //  (E.g., 18 minutes for 10m 100bp where 40 to 50% may be rRNA).
-  // Solution: restrict growth of the unlooked vector to (currently) 8000
-  //  elements
-  // Effect: in genome assemblies, may lead to several start sites per
-  //  area. In EST / RNASeq assemblies, leads to several start sites per
-  //  heavy multicopy area.
-  //  Oh, and reduces time *a lot*, especially in conjunction with -PF:mscft
-  //  (see end of function)
-
-  vector<readid_t> unlooked;
-  unlooked.reserve(8000);
-  bool unlookedaccepts=true;
-  bool unlookthreshreached=false;
-
-  PPF_beststartcache.reserve(10000);
-
-  long int maxmusec=PPF_pafparams_ptr->paf_max_startcache_filltime*1000000;
-  timeval starttv;
-  timeval curtv;
-  gettimeofday(&starttv,nullptr);
-
-  for(readid_t actid=0; actid < static_cast<readid_t>(PPF_used_ids.size()); ++actid) {
-    if(!PPF_readpool_ptr->getRead(actid).isUsedInAssembly()
-       || PPF_readpool_ptr->getRead(actid).getLenClippedSeq() == 0) continue;
-
-    CEBUG("aid: " << actid);
-    CEBUG("\tused " << (int16) PPF_used_ids[actid]);
-    CEBUG("\ttm " <<(uint16) PPF_istroublemaker[actid]);
-    CEBUG("\n");
-    if(PPF_used_ids[actid]!=0
-       || (wanttroublemakercheck && PPF_istroublemaker[actid]!=0)
-       || (wantmulticopycheck && PPF_multicopies[actid]!=0)
-       || (wantwellconnectedcheck && !PPF_wellconnected[actid])
-       || (wantnokmerfork && PPF_readpool_ptr->getRead(actid).hasKMerFork())
-       || uid_in_cluster[actid]) continue;
-
-    uint32 goodclustersize=0;
-    uint32 goodclusterbestid=0;
-    uint32 maxconnects=0;
-    unlooked.clear();
-    unlooked.push_back(actid);
-
-    unlookedaccepts=true;
-
-    readid_t lookid;
-    while(!unlooked.empty()){
-      CEBUG("unlooked.size(): " << unlooked.size() << endl);
-      lookid=unlooked.back();
-      unlooked.pop_back();
-
-      uid_in_cluster[lookid]=true;
-
-      necontainer_t::const_iterator oeI=(*PPF_lowerbound_oedges_ptr)[lookid];
-
-      uint32 numconnects=0;
-      for(;oeI!=PPF_overlap_edges_ptr->end() && lookid==oeI->rid1;++oeI){
-	CEBUG("  lid: " << oeI->linked_with);
-	CEBUG("\tused " << (int16) PPF_used_ids[oeI->linked_with]);
-	CEBUG("\ttm " <<(uint16) PPF_istroublemaker[oeI->linked_with]);
-	CEBUG("\n");
-	CEBUG("  " << *oeI);
-
-	if((wantstronggoodcheck && !oeI->ol_stronggood)
-	   || PPF_used_ids[oeI->linked_with]!=0
-	   || (wanttroublemakercheck && PPF_istroublemaker[oeI->linked_with]!=0)
-	   || (wantmulticopycheck && PPF_multicopies[oeI->linked_with]!=0)
-	   || (wantwellconnectedcheck && !PPF_wellconnected[oeI->linked_with])
-	   || uid_in_cluster[oeI->linked_with]) continue;
-	++numconnects;
-
-	if(unlookedaccepts) {
-	  unlooked.push_back(oeI->linked_with);
-	  // Check whether to stop looking for more
-	  // Do not do that only when multicopies are also allowed as it may be that
-	  //  people give projects *just* with heavy multicopy clusters and then
-	  //  it would not work (as only a minority may then be multicopy with
-	  //  regard to the already high copy number)
-	  if(unlooked.size()==unlooked.capacity()){
-	    unlookedaccepts=false;
-	    unlookthreshreached=true;
-	  }
-	}
-      }
-      if(numconnects) ++goodclustersize;
-      if(numconnects>maxconnects){
-	goodclusterbestid=lookid;
-	maxconnects=numconnects;
-	CEBUG("goodclusterbestid: " << goodclusterbestid << endl);
-	CEBUG("maxconnects: " << numconnects << endl);
-      }
-    }
-
-    if(maxconnects){
-      beststartinfo_t tmp;
-      tmp.bsi_rid=goodclusterbestid;
-      tmp.bsi_clustersize=goodclustersize;
-      tmp.bsi_numconnects=maxconnects;
-      PPF_beststartcache.push_back(tmp);
-    }
-
-    // see whether we need to care about time (-PF:mscft)
-    if(maxmusec>=0 && actid%64==0 && !PPF_beststartcache.empty()) {
-      if(diffsuseconds(starttv) >= maxmusec) {
-	cout << "Non-deterministic behaviour of assembly likely: " << diffsuseconds(starttv) << " -PF:mscft threshold hit " << maxmusec << ".\n";
-	break;
-      }
-    }
-  }
-
-#ifdef CLOCK_STEPS2
-  cout << "Timing priv_fdns_subFillCache " << wanttroublemakercheck << " " << wantstronggoodcheck << " " << wantmulticopycheck << " " << wantwellconnectedcheck << " : " << diffsuseconds(tvtotal)
-       << "\nStartcache size: " << PPF_beststartcache.size() << endl;
-#endif
-
-  if(unlookthreshreached){
-    cout << "hit unlooked threshold\n";
-  }
-
-  FUNCEND();
-}
-//#define CEBUG(bla)
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-void PPathfinder::priv_fdns_est()
-{
-  FUNCSTART("void PPathfinder::priv_fdns_est()");
-
-  if(PPF_haflevel_max.empty()) priv_fillHAFLevelInfo();
-
-#ifdef CLOCK_STEPS2
-  timeval tv;
-  gettimeofday(&tv,nullptr);
-#endif
-
-  PPF_bsccontent=BSCC_EST_WELLCONNECTED_REPT6P;
-  priv_fdns_e_subFillCache(true,6);
-  if(PPF_beststartcache.empty()){
-    PPF_bsccontent=BSCC_EST_WELLCONNECTED_REPT;
-    priv_fdns_e_subFillCache(true,5);
-    if(PPF_beststartcache.empty()){
-      PPF_bsccontent=BSCC_EST_WELLCONNECTED_H4;
-      priv_fdns_e_subFillCache(true,4);
-      if(PPF_beststartcache.empty()){
-	PPF_bsccontent=BSCC_EST_WELLCONNECTED_H3;
-	priv_fdns_e_subFillCache(true,3);
-	if(PPF_beststartcache.empty()){
-	  PPF_bsccontent=BSCC_EST_WELLCONNECTED_H2;
-	  priv_fdns_e_subFillCache(true,2);
-	  if(PPF_beststartcache.empty()){
-	    PPF_bsccontent=BSCC_EST_NOTWELLCONNECTED;
-	    priv_fdns_e_subFillCache(false,0);
-	  }
-	}
-      }
-    }
-  }
-
-  if(!PPF_beststartcache.empty()){
-    sort(PPF_beststartcache.begin(),
-	 PPF_beststartcache.end(),
-	 PPathfinder::beststartinfo_t::ltclustersize
-      );
-  }else{
-    // found nothing ... now put singlets into list
-    priv_fdns_fillSinglets();
-  }
-
-  if(!PPF_beststartcache.empty()){
-    CEBUG("Startcache take " << PPF_beststartcache.back());
-  }
-
-#ifdef CLOCK_STEPS2
-  cout << "Timing priv_fdns_est total: " << diffsuseconds(tv)
-       << "\n";
-#endif
-}
-
-//#define CEBUG(bla)   {cout << bla; cout.flush(); }
-void PPathfinder::priv_fdns_e_subFillCache(bool wantwellconnectedcheck, uint8 minallowedfreq)
-{
-  FUNCSTART("void PPathfinder::priv_fdns_e_subFillCache(bool wantwellconnectedcheck, uint8 minallowedfreq)");
-
-#ifdef CLOCK_STEPS2
-  timeval tv;
-  timeval tvtotal;
-  gettimeofday(&tv,nullptr);
-  tvtotal=tv;
-#endif
-
-  const auto & PPF_used_ids = *PPF_used_ids_ptr;
-  const auto & PPF_wellconnected = *PPF_wellconnected_ptr;
-
-  vector<bool> uid_in_cluster(PPF_used_ids.size(),false);
-
-  // in EST / RNASeq projects, things can get *very* ugly ... clusters of
-  //  several million reads (rRNA etc). This takes ages, even on fast processors
-  //  (E.g., 18 minutes for 10m 100bp where 40 to 50% may be rRNA).
-  // Solution: restrict growth of the unlooked vector to (currently) 8000
-  //  elements
-  // Effect: in genome assemblies, may lead to several start sites per
-  //  area. In EST / RNASeq assemblies, leads to several start sites per
-  //  heavy multicopy area.
-  //  Oh, and reduces time *a lot*, especially in conjunction with -PF:mscft
-  //  (see end of function)
-
-  vector<readid_t> unlooked;
-  unlooked.reserve(8000);
-  bool unlookedaccepts=true;
-  bool unlookthreshreached=false;
-
-  PPF_beststartcache.reserve(10000);
-
-  long int maxmusec=PPF_pafparams_ptr->paf_max_startcache_filltime*1000000;
-  timeval starttv;
-  timeval curtv;
-  gettimeofday(&starttv,nullptr);
-
-  for(readid_t actid=0; actid < static_cast<readid_t>(PPF_used_ids.size()); ++actid) {
-    CEBUG("aid: " << actid);
-    CEBUG("\tused " << (int16) PPF_used_ids[actid]);
-    CEBUG("\ttm " <<(uint16) (*PPF_istroublemaker_ptr)[actid]);
-    CEBUG("\n");
-    if(PPF_used_ids[actid]!=0
-       || (PPF_haflevel_min[actid] < minallowedfreq)
-       || (wantwellconnectedcheck && !PPF_wellconnected[actid])
-       || uid_in_cluster[actid]) continue;
-
-    uint32 goodclustersize=0;
-    uint32 goodclusterbestid=0;
-    uint32 maxconnects=0;
-    unlooked.clear();
-    unlooked.push_back(actid);
-
-    unlookedaccepts=true;
-
-    readid_t lookid;
-    while(!unlooked.empty()){
-      CEBUG("unlooked.size(): " << unlooked.size() << endl);
-      lookid=unlooked.back();
-      unlooked.pop_back();
-
-      uid_in_cluster[lookid]=true;
-
-      necontainer_t::const_iterator oeI=(*PPF_lowerbound_oedges_ptr)[lookid];
-
-      uint32 numconnects=0;
-      for(;oeI!=PPF_overlap_edges_ptr->end() && lookid==oeI->rid1;++oeI){
-	CEBUG("  lid: " << oeI->linked_with);
-	CEBUG("\tused " << (int16) PPF_used_ids[oeI->linked_with]);
-	CEBUG("\ttm " <<(uint16) (*PPF_istroublemaker_ptr)[oeI->linked_with]);
-	CEBUG("\n");
-	CEBUG("  " << *oeI);
-
-	if(PPF_used_ids[oeI->linked_with]!=0
-	   || (PPF_haflevel_min[oeI->linked_with] < minallowedfreq)
-	   || (wantwellconnectedcheck && !PPF_wellconnected[oeI->linked_with])
-	   || uid_in_cluster[oeI->linked_with]) continue;
-	++numconnects;
-
-	if(unlookedaccepts) {
-	  unlooked.push_back(oeI->linked_with);
-	  // Check whether to stop looking for more
-	  // Do not do that only when multicopies are also allowed as it may be that
-	  //  people give projects *just* with heavy multicopy clusters and then
-	  //  it would not work (as only a minority may then be multicopy with
-	  //  regard to the already high copy number)
-	  if(unlooked.size()==unlooked.capacity()){
-	    unlookedaccepts=false;
-	    unlookthreshreached=true;
-	  }
-	}
-      }
-      if(numconnects) ++goodclustersize;
-      if(numconnects>maxconnects){
-	goodclusterbestid=lookid;
-	maxconnects=numconnects;
-	CEBUG("goodclusterbestid: " << goodclusterbestid << endl);
-	CEBUG("maxconnects: " << numconnects << endl);
-      }
-    }
-
-    if(maxconnects){
-      beststartinfo_t tmp;
-      tmp.bsi_rid=goodclusterbestid;
-      tmp.bsi_clustersize=goodclustersize;
-      tmp.bsi_numconnects=maxconnects;
-      PPF_beststartcache.push_back(tmp);
-    }
-
-    // see whether we need to care about time (-PF:mscft)
-    if(maxmusec>=0 && actid%64==0 && !PPF_beststartcache.empty()) {
-      if(diffsuseconds(starttv) >= maxmusec) {
-	cout << "Non-deterministic behaviour of assembly likely: -PF:mscft threshold hit.\n";
-	break;
-      }
-    }
-  }
-
-#ifdef CLOCK_STEPS2
-  cout << "Timing priv_fdns_e_subFillCache " << wantwellconnectedcheck << " " << static_cast<uint16>(minallowedfreq) << ": " << diffsuseconds(tvtotal)
-       << "\nStartcache size: " << PPF_beststartcache.size() << endl;
-#endif
-
-  if(unlookthreshreached){
-    cout << "hit unlooked threshold\n";
-  }
-
-  FUNCEND();
-}
-//#define CEBUG(bla)
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-void PPathfinder::priv_fillHAFLevelInfo()
-{
-  FUNCSTART("void PPathfinder::priv_fillHAFLevelInfo()");
-
-  PPF_haflevel_max.clear();
-  PPF_haflevel_max.resize(PPF_readpool_ptr->size(),0);
-  PPF_haflevel_maxseen=0;
-  PPF_haflevel_min.clear();
-  PPF_haflevel_min.resize(PPF_readpool_ptr->size(),255);
-  PPF_haflevel_minseen=255;
-  for(readid_t ri=0; ri<PPF_readpool_ptr->size(); ++ri){
-    for(auto & bphs : PPF_readpool_ptr->getRead(ri).getBPosHashStats()){
-      if(bphs.fwd.isValid()){
-	if(bphs.fwd.getFrequency() > PPF_haflevel_max[ri]) PPF_haflevel_max[ri]=bphs.fwd.getFrequency();
-	if(bphs.fwd.getFrequency() > PPF_haflevel_maxseen) PPF_haflevel_maxseen=bphs.fwd.getFrequency();
-	if(bphs.fwd.getFrequency() < PPF_haflevel_min[ri]) PPF_haflevel_min[ri]=bphs.fwd.getFrequency();
-	if(bphs.fwd.getFrequency() < PPF_haflevel_minseen) PPF_haflevel_minseen=bphs.fwd.getFrequency();
-      }
-    }
-  }
-}
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-readid_t PPathfinder::priv_getNextStartID()
-{
-#ifdef CLOCK_STEPS1
-  timeval tv;
-  gettimeofday(&tv,nullptr);
-#endif
-
-  readid_t bestid=-1;
-  PPF_bsrandry=false;
-  if(!PPF_beststartcache.empty()){
-    bestid=priv_gnsi_helper();
-  }
-  if(bestid<0 && PPF_beststartcache.empty()){
-    priv_fillDenovoStartCache();
-    bestid=priv_gnsi_helper();
-  }
-#ifdef CLOCK_STEPS2
-  PPF_timing_pathsearch+=diffsuseconds(tv);
-#endif
-  return bestid;
-}
-
-readid_t PPathfinder::priv_gnsi_helper()
-{
-  const vector<int8> & lr_used_ids = *PPF_used_ids_ptr;
-
-  // if there's something in the cache and
-  //  the read it points to hasn't been included via other means
-  //  (like jumping over a small repeat), return that cached entry
-  while(!PPF_beststartcache.empty()){
-    CEBUG("Startcache look " << PPF_beststartcache.back());
-    auto bestid=PPF_beststartcache.back().bsi_rid;
-    if(!lr_used_ids[bestid]){
-      CEBUG("Startcache taken\n");
-      return bestid;
-    }
-    PPF_beststartcache.pop_back();
-  }
-
-  return -1;
-}
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-void PPathfinder::priv_fillDenovoQueues(size_t maxdist)
-{
-  auto & cr=PPF_actcontig_ptr->getContigReads();
-  for(auto pcrI=cr.begin(); pcrI!=cr.end(); ++pcrI){
-    if(pcrI.getORPID()>=0){
-      if(maxdist == 0
-	 || PPF_actcontig_ptr->getContigLength() < maxdist
-	 || pcrI.getReadStartOffset() <= maxdist
-	 || pcrI.getReadStartOffset()+pcrI->getLenClippedSeq() >= PPF_actcontig_ptr->getContigLength()-maxdist){
-	priv_insertRIDIntoDenovoQueues(pcrI.getORPID());
-      }
-    }
-  }
-
-  //cout << "DN Queues\n";
-  //for(uint32 dqi=0; dqi<PPF_queues.size(); ++dqi){
-  //  cout << dqi << "\t" << PPF_queues[dqi].size() << endl;
-  //}
-}
-
-
-/*************************************************************************
- *
- * returns queue number where read was inserted (or QTG_END if not)
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush(); }
-uint32 PPathfinder::priv_iridnq_genome(readid_t insertrid)
-{
-  FUNCSTART("void PPathfinder::priv_iridnq_genome(readid_t insertrid)");
-
-#ifdef CLOCK_STEPS1
-  timeval tv;
-  gettimeofday(&tv,nullptr);
-#endif
-
-  BUGIFTHROW(insertrid<0, "insertrid " << insertrid << " < 0 ???");
-  BUGIFTHROW(insertrid>=static_cast<readid_t>(PPF_readpool_ptr->size()), "insertrid " << insertrid << " >= rp size() " << PPF_readpool_ptr->size() << " ???");
-  BUGIFTHROW(!PPF_ids_added_oltype[insertrid], "insertrid " << insertrid << " (" << PPF_readpool_ptr->getRead(insertrid).getName() << ") not in contig ???");
-
-  CEBUG("Trying to insert " << PPF_readpool_ptr->getRead(insertrid).getName() << " (" << insertrid << ")...");
-
-  // lr_ == local reference
-  const vector<int8> &  lr_used_ids = *PPF_used_ids_ptr;
-  const vector<uint8> &  lr_wellconnected = *PPF_wellconnected_ptr;
-  //const vector<uint8> & lr_istroublemaker = *PPF_istroublemaker_ptr;
-
-  necontainer_t::iterator oeI=(*PPF_lowerbound_oedges_ptr)[insertrid];
-  auto bestoeI=oeI;
-  uint32 bestoelevel=QTG_END;
-
-  for(;oeI!=PPF_overlap_edges_ptr->end() && insertrid==oeI->rid1;++oeI){
-    CEBUG("\nbest oe level " << bestoelevel);
-
-    // don't bother looking at if overlap is banned
-    CEBUG("\ncheck " << PPF_readpool_ptr->getRead(oeI->linked_with).getName() << " chkban...");
-    if(oeI->pf_banned) continue;
-
-    // don't bother looking at if read linked to is already used or temporarily blacklisted
-    CEBUG(" chkuse of " << PPF_readpool_ptr->getRead(oeI->linked_with).getName() << " (" << oeI->linked_with << ")...");
-    if(lr_used_ids[oeI->linked_with]) continue;
-
-    // don't bother looking at if read linked to is temporarily blacklisted
-    CEBUG(" chkblcklst ...");
-    if(PPF_blacklisted_ids[oeI->linked_with]) continue;
-
-    // of course, rails and backbones are not suited as new reads
-    CEBUG(" chkrailbb ...");
-    if(PPF_readpool_ptr->getRead(oeI->linked_with).isRail()
-       || PPF_readpool_ptr->getRead(oeI->linked_with).isBackbone()) continue;
-
-    CEBUG(" may take");
-
-    readid_t linkedwithid=oeI->linked_with;
-    readid_t linkedwith_partnerid=PPF_readpool_ptr->getRead(linkedwithid).getTemplatePartnerID();
-
-    bool swb=oeI->ol_stronggood | oeI->ol_weakgood | oeI->ol_belowavgfreq;  // swb: overlap is Strong / Weak / Belowavg
-
-    bool havedecision=false;
-
-    if((*PPF_incorrectibleorchimera_ptr)[linkedwithid]){
-      if(bestoelevel>QTG_INCORRECTIBLEORCHIMERA){
-	bestoelevel=QTG_INCORRECTIBLEORCHIMERA;
-	bestoeI=oeI;
-      }
-      havedecision=true;
-    }else if((*PPF_maybespoilsport_ptr)[linkedwithid]){
-      if(bestoelevel>QTG_MAYBESPOILSPORT){
-	bestoelevel=QTG_MAYBESPOILSPORT;
-	bestoeI=oeI;
-      }
-      havedecision=true;
-    }
-
-    if(!havedecision && swb && oeI->ol_norept){
-      // 0-14
-      if(linkedwith_partnerid>=0 && PPF_ids_added_oltype[linkedwith_partnerid]==ADDED_BY_NOREPT && lr_wellconnected[linkedwithid]){
-	// 0-2
-	havedecision=true;
-	if(oeI->ol_stronggood){
-	  if(bestoelevel>QTG_TPARTNERNOREPT_OLNOREPTSTRONG_WELLCONNECTED){
-	    bestoelevel=QTG_TPARTNERNOREPT_OLNOREPTSTRONG_WELLCONNECTED;
-	    bestoeI=oeI;
-	    break; // early termination of for loop, we won't find something better.
-	  }
-	}else if(oeI->ol_weakgood){
-	  if(bestoelevel>QTG_TPARTNERNOREPT_OLNOREPTWEAK_WELLCONNECTED){
-	    bestoelevel=QTG_TPARTNERNOREPT_OLNOREPTWEAK_WELLCONNECTED;
-	    bestoeI=oeI;
-	  }
-	}else{
-	  if(bestoelevel>QTG_TPARTNERNOREPT_OLNOREPTBELOWAVG_WELLCONNECTED){
-	    bestoelevel=QTG_TPARTNERNOREPT_OLNOREPTBELOWAVG_WELLCONNECTED;
-	    bestoeI=oeI;
-	  }
-	}
-      }else if(linkedwith_partnerid>=0 && PPF_ids_added_oltype[linkedwith_partnerid]==ADDED_BY_NOREPT){
-	// 3-5
-	havedecision=true;
-	if(oeI->ol_stronggood){
-	  if(bestoelevel>QTG_TPARTNERNOREPT_OLNOREPTSTRONG){
-	    bestoelevel=QTG_TPARTNERNOREPT_OLNOREPTSTRONG;
-	    bestoeI=oeI;
-	  }
-	}else if(oeI->ol_weakgood){
-	  if(bestoelevel>QTG_TPARTNERNOREPT_OLNOREPTWEAK){
-	    bestoelevel=QTG_TPARTNERNOREPT_OLNOREPTWEAK;
-	    bestoeI=oeI;
-	  }
-	}else{
-	  if(bestoelevel>QTG_TPARTNERNOREPT_OLNOREPTBELOWAVG){
-	    bestoelevel=QTG_TPARTNERNOREPT_OLNOREPTBELOWAVG;
-	    bestoeI=oeI;
-	  }
-	}
-      }else if(linkedwith_partnerid>=0 && PPF_ids_added_oltype[linkedwith_partnerid]==ADDED_BY_NOTREPT && lr_wellconnected[linkedwithid]){
-	// 6-8
-	havedecision=true;
-	if(oeI->ol_stronggood){
-	  if(bestoelevel>QTG_TPARTNERNOTREPT_OLNOREPTSTRONG_WELLCONNECTED){
-	    bestoelevel=QTG_TPARTNERNOTREPT_OLNOREPTSTRONG_WELLCONNECTED;
-	    bestoeI=oeI;
-	  }
-	}else if(oeI->ol_weakgood){
-	  if(bestoelevel>QTG_TPARTNERNOTREPT_OLNOREPTWEAK_WELLCONNECTED){
-	    bestoelevel=QTG_TPARTNERNOTREPT_OLNOREPTWEAK_WELLCONNECTED;
-	    bestoeI=oeI;
-	  }
-	}else{
-	  if(bestoelevel>QTG_TPARTNERNOTREPT_OLNOREPTBELOWAVG_WELLCONNECTED){
-	    bestoelevel=QTG_TPARTNERNOTREPT_OLNOREPTBELOWAVG_WELLCONNECTED;
-	    bestoeI=oeI;
-	  }
-	}
-      }else if(linkedwith_partnerid>=0 && PPF_ids_added_oltype[linkedwith_partnerid]==ADDED_BY_NOTREPT){
-	// 9-11
-	havedecision=true;
-	if(oeI->ol_stronggood){
-	  if(bestoelevel>QTG_TPARTNERNOTREPT_OLNOREPTSTRONG){
-	    bestoelevel=QTG_TPARTNERNOTREPT_OLNOREPTSTRONG;
-	    bestoeI=oeI;
-	  }
-	}else if(oeI->ol_weakgood){
-	  if(bestoelevel>QTG_TPARTNERNOTREPT_OLNOREPTWEAK){
-	    bestoelevel=QTG_TPARTNERNOTREPT_OLNOREPTWEAK;
-	    bestoeI=oeI;
-	  }
-	}else{
-	  if(bestoelevel>QTG_TPARTNERNOTREPT_OLNOREPTBELOWAVG){
-	    bestoelevel=QTG_TPARTNERNOTREPT_OLNOREPTBELOWAVG;
-	    bestoeI=oeI;
-	  }
-	}
-      }else if(swb && lr_wellconnected[linkedwithid]){
-	// 12-14
-	havedecision=true;
-	if(oeI->ol_stronggood){
-	  if(bestoelevel>QTG_OLNOREPTSTRONG_WELLCONNECTED){
-	    bestoelevel=QTG_OLNOREPTSTRONG_WELLCONNECTED;
-	    bestoeI=oeI;
-	  }
-	}else if(oeI->ol_weakgood){
-	  if(bestoelevel>QTG_OLNOREPTWEAK_WELLCONNECTED){
-	    bestoelevel=QTG_OLNOREPTWEAK_WELLCONNECTED;
-	    bestoeI=oeI;
-	  }
-	}else{
-	  if(bestoelevel>QTG_OLNOREPTBELOWAVG_WELLCONNECTED){
-	    bestoelevel=QTG_OLNOREPTBELOWAVG_WELLCONNECTED;
-	    bestoeI=oeI;
-	  }
-	}
-      }
-    }
-
-    if(!havedecision
-       && oeI->ol_stronggood
-       && linkedwith_partnerid>=0 && PPF_ids_added_oltype[linkedwith_partnerid]==ADDED_BY_NOREPT && lr_wellconnected[linkedwithid]){
-      // 14a
-      havedecision=true;
-      if(bestoelevel>QTG_TPARTNERNOREPT_STRONG_WELLCONNECTED){
-	bestoelevel=QTG_TPARTNERNOREPT_STRONG_WELLCONNECTED;
-	bestoeI=oeI;
-      }
-    }
-
-    if(!havedecision
-       && swb && oeI->ol_norept){
-      // 15-17
-      havedecision=true;
-      if(oeI->ol_stronggood){
-	if(bestoelevel>QTG_OLNOREPTSTRONG){
-	  bestoelevel=QTG_OLNOREPTSTRONG;
-	  bestoeI=oeI;
-	}
-      }else if(oeI->ol_weakgood){
-	if(bestoelevel>QTG_OLNOREPTWEAK){
-	  bestoelevel=QTG_OLNOREPTWEAK;
-	  bestoeI=oeI;
-	}
-      }else{
-	if(bestoelevel>QTG_OLNOREPTBELOWAVG){
-	  bestoelevel=QTG_OLNOREPTBELOWAVG;
-	  bestoeI=oeI;
-	}
-      }
-    }
-
-    if(!havedecision){
-      // rest, 18-27
-
-      if(linkedwith_partnerid>=0 && PPF_ids_added_oltype[linkedwith_partnerid]==ADDED_BY_NOREPT && oeI->ol_norept){
-	if(bestoelevel>QTG_TPARTNERNOREPT_OLNOREPTOTHER){
-	  bestoelevel=QTG_TPARTNERNOREPT_OLNOREPTOTHER;
-	  bestoeI=oeI;
-	}
-      }else if(linkedwith_partnerid>=0 && PPF_ids_added_oltype[linkedwith_partnerid]==ADDED_BY_NOREPT && !oeI->ol_norept && !oeI->ol_rept){
-	if(bestoelevel>QTG_TPARTNERNOREPT_OLNOTREPTOTHER){
-	  bestoelevel=QTG_TPARTNERNOREPT_OLNOTREPTOTHER;
-	  bestoeI=oeI;
-	}
-      }else if(linkedwith_partnerid>=0 && PPF_ids_added_oltype[linkedwith_partnerid]==ADDED_BY_NOTREPT && oeI->ol_norept){
-	if(bestoelevel>QTG_TPARTNERNOTREPT_OLNOREPTOTHER){
-	  bestoelevel=QTG_TPARTNERNOTREPT_OLNOREPTOTHER;
-	  bestoeI=oeI;
-	}
-      }else if(linkedwith_partnerid>=0 && PPF_ids_added_oltype[linkedwith_partnerid]==ADDED_BY_NOTREPT && !oeI->ol_norept && !oeI->ol_norept && !oeI->ol_rept){
-	if(bestoelevel>QTG_TPARTNERNOTREPT_OLNOTREPTOTHER){
-	  bestoelevel=QTG_TPARTNERNOTREPT_OLNOTREPTOTHER;
-	  bestoeI=oeI;
-	}
-      }else if(oeI->ol_norept){
-	// 22
-	if(bestoelevel>QTG_OLNOREPTOTHER){
-	  bestoelevel=QTG_OLNOREPTOTHER;
-	  bestoeI=oeI;
-	}
-      }else if(linkedwith_partnerid>=0 && PPF_ids_added_oltype[linkedwith_partnerid]==ADDED_BY_NOREPT && oeI->ol_rept){
-	if(bestoelevel>QTG_TPARTNERNOREPT_OLREPT){
-	  bestoelevel=QTG_TPARTNERNOREPT_OLREPT;
-	  bestoeI=oeI;
-	}
-      }else if(linkedwith_partnerid>=0 && PPF_ids_added_oltype[linkedwith_partnerid]==ADDED_BY_NOTREPT && oeI->ol_rept){
-	if(bestoelevel>QTG_TPARTNERNOTREPT_OLREPT){
-	  bestoelevel=QTG_TPARTNERNOTREPT_OLREPT;
-	  bestoeI=oeI;
-	}
-      }else if(!oeI->ol_norept & !oeI->ol_rept){
-	if(bestoelevel>QTG_OLNOTREPT){
-	  bestoelevel=QTG_OLNOTREPT;
-	  bestoeI=oeI;
-	}
-      }else if(oeI->ol_rept){
-	if(bestoelevel>QTG_OLREPTSTRONG_WELLCONNECTED && lr_wellconnected[linkedwithid] && oeI->ol_stronggood){
-	  bestoelevel=QTG_OLREPTSTRONG_WELLCONNECTED;
-	  bestoeI=oeI;
-	}else if(bestoelevel>QTG_OLREPTWEAK_WELLCONNECTED && lr_wellconnected[linkedwithid] && oeI->ol_weakgood){
-	  bestoelevel=QTG_OLREPTWEAK_WELLCONNECTED;
-	  bestoeI=oeI;
-	}else if(bestoelevel>QTG_OLREPTSTRONG && oeI->ol_stronggood){
-	  bestoelevel=QTG_OLREPTSTRONG;
-	  bestoeI=oeI;
-	}else if(bestoelevel>QTG_OLREPTWEAK && oeI->ol_weakgood){
-	  bestoelevel=QTG_OLREPTWEAK;
-	  bestoeI=oeI;
-	}else if(bestoelevel>QTG_OLREPT){
-	  bestoelevel=QTG_OLREPT;
-	  bestoeI=oeI;
-	}
-      }else{
-	if(bestoelevel>QTG_OLOTHER){
-	  bestoelevel=QTG_OLOTHER;
-	  bestoeI=oeI;
-	}
-      }
-    }
-  }
-
-
-  if(bestoelevel!=QTG_END){
-    PPF_queues[bestoelevel].push(ppfweightelem_t(bestoeI->best_weight,bestoeI));
-    CEBUG("\nInserted " << PPF_readpool_ptr->getRead(bestoeI->rid1).getName() << " in queue " << bestoelevel << " with oe " << *bestoeI << endl);
-  }else{
-    CEBUG("\nNo insertion\n");
-  }
-
-#ifdef CLOCK_STEPS1
-  PPF_timing_pathsearch+=diffsuseconds(tv);
-#endif
-
-  FUNCEND();
-  return bestoelevel;
-}
-//#define CEBUG(bla)
-
-
-/*************************************************************************
- *
- * returns queue number where read was inserted (or QTG_END if not)
- *  (really, qt_G_ and not qt_E_ !)
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush(); }
-//#define CEBUG(bla)   {if(insertrid==10002) {cout << bla; cout.flush();} }
-uint32 PPathfinder::priv_iridnq_est(readid_t insertrid)
-{
-  FUNCSTART("uint32 PPathfinder::priv_iridnq_est(readid_t insertrid)");
-
-  CEBUG("priv_iridnq_est" << endl);
-
-#ifdef CLOCK_STEPS1
-  timeval tv;
-  gettimeofday(&tv,nullptr);
-#endif
-
-  // TODO: for de-novo, this gets called anyway earlier
-  //  but mapping not. See whether to put somewhere else
-  //  for mapping
-  if(PPF_haflevel_max.empty()) priv_fillHAFLevelInfo();
-
-  BUGIFTHROW(insertrid<0, "insertrid " << insertrid << " < 0 ???");
-  BUGIFTHROW(insertrid>=static_cast<readid_t>(PPF_readpool_ptr->size()), "insertrid " << insertrid << " >= rp size() " << PPF_readpool_ptr->size() << " ???");
-  BUGIFTHROW(!PPF_ids_added_oltype[insertrid], "insertrid " << insertrid << " (" << PPF_readpool_ptr->getRead(insertrid).getName() << ") not in contig ???");
-
-  CEBUG("Trying to insert " << PPF_readpool_ptr->getRead(insertrid).getName() << " (" << insertrid << ")...");
-
-  // lr_ == local reference
-  const vector<int8> &  lr_used_ids = *PPF_used_ids_ptr;
-  const vector<uint8> &  lr_wellconnected = *PPF_wellconnected_ptr;
-  //const vector<uint8> & lr_istroublemaker = *PPF_istroublemaker_ptr;
-
-  bool has_tpartner;
-  bool has_tpartnerwc;
-  bool has_refwc;
-  bool has_newwc;
-
-  necontainer_t::iterator oeI=(*PPF_lowerbound_oedges_ptr)[insertrid];
-  auto bestoeI=oeI;
-  uint32 bestoelevel=QTG_END;
-  for(;oeI!=PPF_overlap_edges_ptr->end() && insertrid==oeI->rid1;++oeI){
-    // don't bother looking at if overlap is banned
-    CEBUG("\ncheck " << PPF_readpool_ptr->getRead(oeI->linked_with).getName() << " chkban...");
-    if(oeI->pf_banned) continue;
-
-    // don't bother looking at if read linked to is already used or temporarily blacklisted
-    CEBUG(" chkuse of " << PPF_readpool_ptr->getRead(oeI->linked_with).getName() << " (" << oeI->linked_with << ")...");
-    if(lr_used_ids[oeI->linked_with]) continue;
-
-    // don't bother looking at if read linked to is temporarily blacklisted
-    CEBUG(" chkblcklst ...");
-    if(PPF_blacklisted_ids[oeI->linked_with]) continue;
-
-    // of course, rails and backbones are not suited as new reads
-    CEBUG(" chkrailbb ...");
-    if(PPF_readpool_ptr->getRead(oeI->linked_with).isRail()
-       || PPF_readpool_ptr->getRead(oeI->linked_with).isBackbone()) continue;
-
-    CEBUG(" may take");
-
-    bool havedecision=false;
-    readid_t linkedwithid=oeI->linked_with;
-
-    if((*PPF_incorrectibleorchimera_ptr)[linkedwithid]){
-      havedecision=true;
-      if(bestoelevel>QTE_INCORRECTIBLEORCHIMERA){
-	bestoelevel=QTE_INCORRECTIBLEORCHIMERA;
-	bestoeI=oeI;
-      }
-    }
-
-    if(!havedecision){
-      readid_t linkedwith_partnerid=PPF_readpool_ptr->getRead(linkedwithid).getTemplatePartnerID();
-
-      has_tpartner=linkedwith_partnerid>=0 && PPF_ids_added_oltype[linkedwith_partnerid];
-      has_tpartnerwc=has_tpartner && lr_wellconnected[linkedwith_partnerid];
-      has_refwc=lr_wellconnected[insertrid];
-      has_newwc=lr_wellconnected[linkedwithid];
-
-      if(oeI->ol_rept && has_tpartnerwc && has_refwc && has_newwc
-	 && PPF_haflevel_min[linkedwith_partnerid]>=6
-	 && PPF_haflevel_min[insertrid]>=6
-	 && PPF_haflevel_min[linkedwithid]>=6
-	){
-	if(bestoelevel>QTE_TPARTNERWCREPT6P_WCREPT6P_OLREPT_REPT6PWC){
-	  bestoelevel=QTE_TPARTNERWCREPT6P_WCREPT6P_OLREPT_REPT6PWC;
-	  bestoeI=oeI;
-	  break; // early termination of for loop, we won't find something better.
-	}
-      }else if(oeI->ol_rept && has_tpartnerwc && has_refwc && has_newwc
-	       && PPF_haflevel_min[linkedwith_partnerid]>=5
-	       && PPF_haflevel_min[insertrid]>=5
-	       && PPF_haflevel_min[linkedwithid]>=6
-	){
-	if(bestoelevel>QTE_TPARTNERWCREPT5_WCREPT5_OLREPT_REPT6PWC){
-	  bestoelevel=QTE_TPARTNERWCREPT5_WCREPT5_OLREPT_REPT6PWC;
-	  bestoeI=oeI;
-	}
-      }else if(oeI->ol_rept && has_tpartnerwc && has_refwc && has_newwc
-	       && PPF_haflevel_min[linkedwith_partnerid]>=5
-	       && PPF_haflevel_min[insertrid]>=5
-	       && PPF_haflevel_min[linkedwithid]>=5
-	){
-	if(bestoelevel>QTE_TPARTNERWCREPT5_WCREPT5_OLREPT_REPT5WC){
-	  bestoelevel=QTE_TPARTNERWCREPT5_WCREPT5_OLREPT_REPT5WC;
-	  bestoeI=oeI;
-	}
-      }else if(oeI->ol_rept && has_tpartnerwc && has_refwc && has_newwc
-	       && PPF_haflevel_min[insertrid]>=6
-	       && PPF_haflevel_min[linkedwithid]>=6
-	){
-	if(bestoelevel>QTE_TPARTNERWC_WCREPT6P_OLREPT_REPT6PWC){
-	  bestoelevel=QTE_TPARTNERWC_WCREPT6P_OLREPT_REPT6PWC;
-	  bestoeI=oeI;
-	}
-      }else if(oeI->ol_rept && has_tpartnerwc && has_refwc && has_newwc
-	       && PPF_haflevel_min[insertrid]>=5
-	       && PPF_haflevel_min[linkedwithid]>=6
-	){
-	if(bestoelevel>QTE_TPARTNERWC_WCREPT5_OLREPT_REPT6PWC){
-	  bestoelevel=QTE_TPARTNERWC_WCREPT5_OLREPT_REPT6PWC;
-	  bestoeI=oeI;
-	}
-      }else if(oeI->ol_rept && has_tpartnerwc && has_refwc && has_newwc
-	       && PPF_haflevel_min[insertrid]>=5
-	       && PPF_haflevel_min[linkedwithid]>=5
-	){
-	if(bestoelevel>QTE_TPARTNERWC_WCREPT5_OLREPT_REPT5WC){
-	  bestoelevel=QTE_TPARTNERWC_WCREPT5_OLREPT_REPT5WC;
-	  bestoeI=oeI;
-	}
-      }else if(oeI->ol_rept && has_tpartnerwc && has_refwc && has_newwc
-	       && PPF_haflevel_min[linkedwithid]>=6
-	){
-	if(bestoelevel>QTE_TPARTNERWC_WC_OLREPT_REPT6PWC){
-	  bestoelevel=QTE_TPARTNERWC_WC_OLREPT_REPT6PWC;
-	  bestoeI=oeI;
-	}
-      }else if(oeI->ol_rept && has_tpartnerwc && has_refwc && has_newwc
-	       && PPF_haflevel_min[linkedwithid]>=5
-	){
-	if(bestoelevel>QTE_TPARTNERWC_WC_OLREPT_REPT5WC){
-	  bestoelevel=QTE_TPARTNERWC_WC_OLREPT_REPT5WC;
-	  bestoeI=oeI;
-	}
-      }else if(oeI->ol_rept && has_tpartnerwc && has_refwc && has_newwc){
-	if(bestoelevel>QTE_TPARTNERWC_WC_OLREPT_WC){
-	  bestoelevel=QTE_TPARTNERWC_WC_OLREPT_WC;
-	  bestoeI=oeI;
-	}
-      }else if(oeI->ol_rept && has_refwc && has_newwc
-	       && PPF_haflevel_min[insertrid]>=6
-	       && PPF_haflevel_min[linkedwithid]>=6
-	){
-	if(bestoelevel>QTE_WCREPT6P_OLREPT_REPT6PWC){
-	  bestoelevel=QTE_WCREPT6P_OLREPT_REPT6PWC;
-	  bestoeI=oeI;
-	}
-      }else if(oeI->ol_rept && has_refwc && has_newwc
-	       && PPF_haflevel_min[insertrid]>=5
-	       && PPF_haflevel_min[linkedwithid]>=6
-	){
-	if(bestoelevel>QTE_WCREPT5_OLREPT_REPT6PWC){
-	  bestoelevel=QTE_WCREPT5_OLREPT_REPT6PWC;
-	  bestoeI=oeI;
-	}
-      }else if(oeI->ol_rept && has_refwc && has_newwc
-	       && PPF_haflevel_min[insertrid]>=5
-	       && PPF_haflevel_min[linkedwithid]>=5
-	){
-	if(bestoelevel>QTE_WCREPT5_OLREPT_REPT5WC){
-	  bestoelevel=QTE_WCREPT5_OLREPT_REPT5WC;
-	  bestoeI=oeI;
-	}
-      }else if(oeI->ol_rept && has_newwc
-	       && PPF_haflevel_min[insertrid]>=6
-	       && PPF_haflevel_min[linkedwithid]>=6
-	){
-	if(bestoelevel>QTE_REPT6P_OLREPT_REPT6PWC){
-	  bestoelevel=QTE_REPT6P_OLREPT_REPT6PWC;
-	  bestoeI=oeI;
-	}
-      }else if(oeI->ol_rept && has_newwc
-	       && PPF_haflevel_min[insertrid]>=5
-	       && PPF_haflevel_min[linkedwithid]>=6
-	){
-	if(bestoelevel>QTE_REPT5_OLREPT_REPT6PWC){
-	  bestoelevel=QTE_REPT5_OLREPT_REPT6PWC;
-	  bestoeI=oeI;
-	}
-      }else if(oeI->ol_rept && has_newwc
-	       && PPF_haflevel_min[insertrid]>=5
-	       && PPF_haflevel_min[linkedwithid]>=5
-	){
-	if(bestoelevel>QTE_REPT5_OLREPT_REPT5WC){
-	  bestoelevel=QTE_REPT5_OLREPT_REPT5WC;
-	  bestoeI=oeI;
-	}
-      }else if(oeI->ol_rept && has_tpartner && has_refwc && has_newwc){
-	if(bestoelevel>QTE_TPARTNER_WC_OLREPT_WC){
-	  bestoelevel=QTE_TPARTNER_WC_OLREPT_WC;
-	  bestoeI=oeI;
-	}
-      }else if(oeI->ol_rept && has_tpartner && has_newwc){
-	if(bestoelevel>QTE_TPARTNER_OLREPT_WC){
-	  bestoelevel=QTE_TPARTNER_OLREPT_WC;
-	  bestoeI=oeI;
-	}
-      }else if(oeI->ol_rept && has_refwc && has_newwc){
-	if(bestoelevel>QTE_WC_OLREPT_WC){
-	  bestoelevel=QTE_WC_OLREPT_WC;
-	  bestoeI=oeI;
-	}
-      }else if(oeI->ol_rept && has_newwc){
-	if(bestoelevel>QTE_OLREPT_WC){
-	  bestoelevel=QTE_OLREPT_WC;
-	  bestoeI=oeI;
-	}
-      }else if(has_tpartnerwc && has_refwc && has_newwc){
-	if(bestoelevel>QTE_TPARTNERWC_WC_OL_WC){
-	  bestoelevel=QTE_TPARTNERWC_WC_OL_WC;
-	  bestoeI=oeI;
-	}
-      }else if(has_tpartner && has_refwc && has_newwc){
-	if(bestoelevel>QTE_TPARTNER_WC_OL_WC){
-	  bestoelevel=QTE_TPARTNER_WC_OL_WC;
-	  bestoeI=oeI;
-	}
-      }else if(has_tpartner && has_newwc){
-	if(bestoelevel>QTE_TPARTNER_OL_WC){
-	  bestoelevel=QTE_TPARTNER_OL_WC;
-	  bestoeI=oeI;
-	}
-//    }else if(has_tpartner){
-//      if(bestoelevel>QTE_TPARTNER){
-//	bestoelevel=QTE_TPARTNER;
-//	bestoeI=oeI;
-//      }
-      }else if(has_refwc && has_newwc){
-	if(bestoelevel>QTE_WC_OL_WC){
-	  bestoelevel=QTE_WC_OL_WC;
-	  bestoeI=oeI;
-	}
-      }else if(has_newwc){
-	if(bestoelevel>QTE_OL_WC){
-	  bestoelevel=QTE_OL_WC;
-	  bestoeI=oeI;
-	}
-      }else if(PPF_haflevel_min[linkedwithid]>=6){
-	if(bestoelevel>QTE_REPT6P){
-	  bestoelevel=QTE_REPT6P;
-	  bestoeI=oeI;
-	}
-      }else if(PPF_haflevel_min[linkedwithid]>=5){
-	if(bestoelevel>QTE_REPT5){
-	  bestoelevel=QTE_REPT5;
-	  bestoeI=oeI;
-	}
-      }else if(PPF_haflevel_min[linkedwithid]>=4){
-	if(bestoelevel>QTE_H4){
-	  bestoelevel=QTE_H4;
-	  bestoeI=oeI;
-	}
-      }else if(PPF_haflevel_min[linkedwithid]>=3){
-	if(bestoelevel>QTE_H3){
-	  bestoelevel=QTE_H3;
-	  bestoeI=oeI;
-	}
-      }else{
-	if(bestoelevel>QTE_OTHER){
-	  bestoelevel=QTE_OTHER;
-	  bestoeI=oeI;
-	}
-      }
-    }
-  }
-
-
-  if(bestoelevel!=QTG_END){
-    PPF_queues[bestoelevel].push(ppfweightelem_t(bestoeI->best_weight,bestoeI));
-    CEBUG("\nInserted " << PPF_readpool_ptr->getRead(bestoeI->rid1).getName() << " in queue " << bestoelevel << endl);
-  }else{
-    CEBUG("\nNo insertion\n");
-  }
-
-#ifdef CLOCK_STEPS1
-  PPF_timing_pathsearch+=diffsuseconds(tv);
-#endif
-
-  FUNCEND();
-  return bestoelevel;
-}
-//#define CEBUG(bla)
-
-
-/*************************************************************************
- *
- * return
- *   as value: in which queue it found something
- *   by caller: iterator, == PPF_overlap_edges_ptr->end() if not found
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush(); }
-uint32 PPathfinder::priv_getNextOverlapFromDenovoQueue(necontainer_t::iterator & oeI)
-{
-  FUNCSTART("void PPathfinder::priv_getNextOverlapFromDenovoQueue()");
-
-  CEBUG("priv_getNextOverlapFromDenovoQueue\n");
-
-  oeI=PPF_overlap_edges_ptr->end();
-
-  size_t qnum;
-
-  // outer while to handle blacklisting
-  while(true){
-    for(qnum=0; qnum < PPF_queues.size() && oeI==PPF_overlap_edges_ptr->end(); ++qnum){
-      CEBUG("Queue " << qnum << "\t" << PPF_queues[qnum].size() << endl);
-      while(!PPF_queues[qnum].empty()){
-	auto qe = PPF_queues[qnum].top();
-	PPF_queues[qnum].pop();
-	CEBUG("new qsize: " << PPF_queues[qnum].size() << endl);
-	CEBUG("qe check " << PPF_readpool_ptr->getRead(qe.second->rid1).getName() << " "  << PPF_readpool_ptr->getRead(qe.second->linked_with).getName() << endl);
-
-/*
-  BaCh: 18.10.2014
-  OK ... what on earth was I thinking???
-  If a read was already added, we do not need to place the overlap edge into *any* queue
-  BaCh: 26.11.2014
-  Gaaaaahhhhhh ... so what was I thinking on 14.10. when I uncommented that block???
-  Of course we need to reinsert rid1 into the denovo-queue if the current linked_with was
-  already taken: there could still be *OTHER* reads. *bigsigh*
-  If not, then low covered areas may have a premature stop lurking, even with 100% overlaps.
-*/
-	if(PPF_ids_added_oltype[qe.second->linked_with]){
-	  CEBUG("going to insert " << qe.second->linked_with << "\t" << static_cast<uint16>(PPF_ids_added_oltype[qe.second->linked_with]) << " " << static_cast<uint16>((*PPF_used_ids_ptr)[qe.second->linked_with]) << endl);
-	  BUGIFTHROW(((PPF_ids_added_oltype[qe.second->linked_with]>0)+(*PPF_used_ids_ptr)[qe.second->linked_with])==1,"Oooops, added by oltype and used ids do not agree? " << static_cast<uint16>(PPF_ids_added_oltype[qe.second->linked_with]) << " " << static_cast<uint16>((*PPF_used_ids_ptr)[qe.second->linked_with]) << endl);
-
-	  // BaCh 04.03.2013
-	  // what was I thinking when I had this?
-	  //  || PPF_blacklisted_ids[qe.second->linked_with]){
-	  // really a bad move as that may add blacklisted ids which are not in the contig!
-	  size_t newqnum=priv_insertRIDIntoDenovoQueues(qe.second->rid1);
-	  CEBUG("new qnum: " << qnum << " --> " << newqnum << endl);
-	  if(newqnum<qnum) {
-	    // if re-inserted in a higher-prio queue (i.e. due to a template partner having
-	    //  been added to contig in the mean time), break handling of this queue
-	    //  and have the outer for-loop restart at the higher-prio queue
-	    qnum=newqnum-1; // -1 because of ++qnum in for-loop
-	    break; // inner while
-	  }
-	}else if(!PPF_blacklisted_ids[qe.second->linked_with]){
-	  oeI=qe.second; // this will stop the inner while
-	  --qnum; // corrector: the for loop will increase qnum ("wrongly"), so correct for that
-	  break;
-	}
-
-	if(!PPF_ids_added_oltype[qe.second->linked_with]
-	   && !PPF_blacklisted_ids[qe.second->linked_with]){
-	  oeI=qe.second; // this will stop the inner while
-	  --qnum; // corrector: the for loop will increase qnum ("wrongly"), so correct for that
-	  break;
-	}
-
-      }
-    }
-    if(oeI!=PPF_overlap_edges_ptr->end()) break;
-    if(PPF_blacklist_queues.empty()) break;
-    priv_munchBlacklist(true);
-  }
-
-  CEBUG("Returning from qnum " << qnum << ": " << *oeI << endl);
-  FUNCEND();
-
-  return static_cast<uint32>(qnum);
-}
-//#define CEBUG(bla)
-
-
-/*************************************************************************
- *
- * loop denovo
- *
- * Currently, this seems to handle genome and EST quite well
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush(); }
-void PPathfinder::priv_ld_genome_and_est()
-{
-  FUNCSTART("void PPathfinder::priv_ld_genome()");
-
-  Contig::templateguessinfo_t tguess;
-
-#ifdef CLOCK_STEPS1
-  timeval tv;
-
-  timeval tvtotal;
-  gettimeofday(&tvtotal,nullptr);
-  suseconds_t ldtimear=0;
-#endif
-
-  struct tms mytms;
-  times(&mytms);
-  clock_t actclocks=mytms.tms_utime+mytms.tms_stime;
-  clock_t maxallowedclocks=actclocks+PPF_pafparams_ptr->paf_maxcontigclockticks;
-
-
-  vector<int8> &  lr_used_ids = *PPF_used_ids_ptr;
-
-  nextreadtoadd_t nrta;
-  necontainer_t::iterator oeI;
-
-  // the forcegrow for addRead()
-  //  0:  growth allowed
-  //  >0: need to grow at least n bases (not used in newpathfinder)
-  //  -1: no growth allowed (not used atm?)
-
-  int32 forcegrow=0;
-
-  bool buildprematurestop=false;
-
-  // noaligncounter counts how many times the pathfinder itself skipped over calling Contig::addRead()
-  //  when it saw it made no sense. Though every time a read is added to the contig, the counter is
-  //  reset to 0
-  // if noaligncounter reaches a threshold (2400 atm), we'll stop contig building
-  //
-  // This speeds up abortion a contig build process in hopeless situations,
-  //  i.e., when both ends of a contig end in repeats which very probably
-  //  cannot be crossed.
-
-  uint32 noaligncounter=0;
-  while(true){
-#ifdef CLOCK_STEPS1
-    gettimeofday(&tv,nullptr);
-#endif
-    nrta.foundqueuenum=priv_getNextOverlapFromDenovoQueue(oeI);
-#ifdef CLOCK_STEPS1
-    PPF_timing_pathsearch+=diffsuseconds(tv);
-#endif
-    CEBUG("nrta.foundqueuenum: " << static_cast<uint16>(nrta.foundqueuenum) << endl);
-#ifndef PUBLICQUIET
-    cout << "nrta.foundqueuenum: " << static_cast<uint16>(nrta.foundqueuenum) << endl;
-#endif
-    if(oeI==PPF_overlap_edges_ptr->end()) {
-      CEBUG("breaking out\n");
-      // queues are empty, this is a totally normal stopping of the build
-      break;
-    }
-    nrta.refid=oeI->rid1;
-    nrta.newid=oeI->linked_with;
-    nrta.direction_newid=oeI->direction;
-    nrta.ads_node=&(*PPF_adsfacts_ptr)[oeI->adsfindex];
-    nrta.weight=oeI->best_weight;
-    PPF_contigerrstat.reset();
-    PPF_contigerrstat.code=Contig::ENOTCALLED;
-    forcegrow=0;
-
-#ifndef PUBLICQUIET
-    //cout << "ADS Node: " << *(nrta.ads_node) << "\n";
-#endif
-
-    // for genomes, disallow growth of contig if ...
-    bool doalign=true;
-    if(PPF_pafparams_ptr->paf_use_genomic_algorithms && !PPF_actcontig_ptr->getLongRepeatStatus()){
-      // this gets too dangerous, i.e., the overlap is repetitive and no
-      //  paired-end in sight. BUT: only if this is a "regular" contig that
-      //  was started from a non-multicopy read
-
-      auto & newread = PPF_readpool_ptr->getRead(nrta.newid);
-      auto tpid=newread.getTemplatePartnerID();
-      if(newread.getSequencingType()==ReadGroupLib::SEQTYPE_SOLEXA){
-	if(!(oeI->ol_stronggood || oeI->ol_weakgood)){
-	  if(tpid>=0){
-	    auto & tpread=PPF_readpool_ptr->getRead(tpid);
-	    if(!PPF_ids_added_oltype[tpid]
-	       && (tpread.hasFreqAvg() || !tpread.hasFreqRept())){
-	      // so ... this Solexa overlap is not strong- or weakgood
-	      //  and its template-partner has average frequency (or not
-	      //  rept freq), but is not in the contig yet
-	      // we could say "wait for a later timepoint to include this,
-	      //  this may be safer" by simply doing
-	      //    doalign=false;
-	      //  but this can stop the building of a contig at places where,
-	      //  for some reason or another, we have a "longer stretch with
-	      //  less coverage than average. Longer means: > ~2x avg
-	      //  read length.
-	      //
-	      // For this reason, we will take a detour:
-	      // if overlap ratio=100 and overlap length>=35 and new read has no rept,
-	      //  kmer we will still allow incorporation of read
-	      // 35 maybe too small? On the other hand: we're already pretty low in the queues
-	      //
-	      // On the other hand, 35 may also be too large in projects with very
-	      //  uneven coverage.
-	      // Therefore, improved strategy:
-	      //  - if tparther is already in contig: >=17bp, 100%
-	      //  - if tparther not in contig
-	      //     - overlap >= 35bp, accept
-	      //     - if overlap <35bp and "normal" queues, relegate read (i.e.: pathfinder will try everything else before touching it again)
-	      //     - if overlap <35bp and "relegated" queue, give it a try
-	      if(!PPF_readpool_ptr->getRead(nrta.newid).hasFreqRept()       // maybe also check freq of ref?
-		 && nrta.ads_node->getOverlapLen()>=17
-		 && nrta.ads_node->getScoreRatio()==100){
-		// this accepts all length>=17 where template partner is in contig
-		// if not in contig, overlap must be >= 35
-		if(PPF_ids_added_oltype[tpid] == 0
-		   && nrta.ads_node->getOverlapLen()<35
-		   && nrta.foundqueuenum<QTG_RELEGATEDBYPP){
-		  doalign=false;
-#ifndef PUBLICQUIET
-		  cout << "FALSE1\n";
-#endif
-		}
-	      }else{
-		doalign=false;
-#ifndef PUBLICQUIET
-		cout << "FALSE2\n";
-#endif
-	      }
-	    }else if(PPF_ids_added_oltype[tpid] != ADDED_BY_NOREPT){
-	      forcegrow=-1;
-	    }
-	  }else{
-	    if((!oeI->ol_norept || oeI->ol_rept)
-	       && newread.hasKMerFork()){
-	      forcegrow=-1;
-	    }
-	  }
-	}
-      }else if(nrta.foundqueuenum>=QTG_TPARTNERNOTREPT_OLREPT){
-	if(!(oeI->ol_stronggood || oeI->ol_weakgood)){      // 05.11.2013: let's test that
-	  forcegrow=-1;
-	}else if(!oeI->ol_stronggood
-		 && oeI->ol_weakgood
-		 && newread.hasKMerFork()){
-	  forcegrow=-1;
-	}
-      }
-
-      // rule for rept(!) overlap with non-overlapping template partners
-      // On 14.10.14, Added ol_stronggood to allow walking into rept area
-      //  a bit more (for scaffolding). Hope this doesn't backfire.
-      if(!oeI->ol_stronggood   // Added 14.10.14
-	 && oeI->ol_rept
-	 && tpid>=0
-	 && tpid != nrta.refid){  // this is the non-pair overlap clause
-
-	// if template partner not in contig (or added otherwise than by norept),
-	// do not add
-	if(PPF_ids_added_oltype[tpid]!=ADDED_BY_NOREPT){
-	  doalign=false;
-#ifndef PUBLICQUIET
-	  cout << "FALSE3\n";
-#endif
-	}
-
-/*
-	// if template partner with a non-rept overlap exists
-	//  but is not used yet, do not align!
-	if((*PPF_hasnoreptoverlap_ptr)[tpid]
-	   && !(*PPF_used_ids_ptr)[tpid]){
-	  doalign=false;
-	}else if((*PPF_hasnoreptoverlap_ptr)[tpid]
-		 && (*PPF_used_ids_ptr)[tpid]
-		 && PPF_ids_added_oltype[tpid]==ADDED_NOTADDED){
-	  // if template partner with a non-rept overlap exists
-	  //  but is not in this contig, do not align!
-	  doalign=false;
-	}else if(!(*PPF_hasnoreptoverlap_ptr)[tpid]
-		 && !(*PPF_hasnoreptoverlap_ptr)[nrta.newid]){
-	  // if both partner have no no-rept overlap (i.e., are completely
-	  //  in a repeat), do not align
-	  // TODO: 1. this of course leads to problems with PCR duplicates *sigh*
-	  // TODO: 2. maybe better to blacklist that via ol_ flag?
-	  doalign=false;
-	}
-//*/
-
-      }
-    }
-
-#ifndef PUBLICQUIET
-    cout << "doalign\t" << doalign << "\t" << PPF_readpool_ptr->getRead(nrta.newid).getName() << "\toechosen\tsg: " << oeI->ol_stronggood << " wg: " << oeI->ol_weakgood << " baf: " << oeI->ol_belowavgfreq << " nrp: " << oeI->ol_norept << " rep: " << oeI->ol_rept << endl;
-#endif
-
-    if(doalign){
-#ifdef CLOCK_STEPS1
-      gettimeofday(&tv,nullptr);
-#endif
-      ++PPF_readaddattempts;
-      BUGIFTHROW(static_cast<uint16>(lr_used_ids[nrta.newid]),"PFcheck: newid already used??? " << nrta.newid << " " << static_cast<uint16>(lr_used_ids[nrta.newid]) << '\n');
-      PPF_actcontig_ptr->addRead(*PPF_aligncache_ptr,
-				 nrta.ads_node, nrta.refid, nrta.newid, nrta.direction_newid,
-				 (*PPF_multicopies_ptr)[nrta.newid],
-				 forcegrow,
-				 tguess,
-				 PPF_contigerrstat);
-#ifdef CLOCK_STEPS1
-      {
-	auto tmpx=diffsuseconds(tv);
-	PPF_timing_connadd+=tmpx;
-	ldtimear+=tmpx;
-      }
-#endif
-    }
-
-    // in genome assemblies, some overlaps get one last chance
-    if(!doalign
-       && nrta.foundqueuenum<QTG_RELEGATEDBYPP
-       && PPF_pafparams_ptr->paf_use_genomic_algorithms){
-      PPF_queues[QTG_RELEGATEDBYPP].push(ppfweightelem_t(oeI->best_weight,oeI));
-      doalign=true;
-      PPF_contigerrstat.code=Contig::ERELEGATEDBYPP;
-#ifndef PUBLICQUIET
-      cout << "RELEGATED\n";
-#endif
-    }else{
-      if(doalign && PPF_contigerrstat.code == Contig::ENOERROR){
-	CEBUG("\nok, added" << endl);
-	noaligncounter=0;
-	PPF_ids_in_contig_list.push_back(nrta.newid);
-	lr_used_ids[nrta.newid]=1;
-	if(oeI->ol_norept){
-	  PPF_ids_added_oltype[nrta.newid]=ADDED_BY_NOREPT;
-	}else if(!oeI->ol_rept){
-	  PPF_ids_added_oltype[nrta.newid]=ADDED_BY_NOTREPT;
-	}else{
-	  PPF_ids_added_oltype[nrta.newid]=ADDED_BY_OTHER;
-	}
-#ifdef CLOCK_STEPS1
-	gettimeofday(&tv,nullptr);
-#endif
-	priv_insertRIDIntoDenovoQueues(oeI->linked_with);
-#ifdef CLOCK_STEPS1
-	PPF_timing_pathsearch+=diffsuseconds(tv);
-#endif
-	priv_munchBlacklist(false);
-	//cout << "\nTGUESS " << tguess << endl;
-	priv_storeTemplateGuess(nrta.newid,tguess);
-      }else{
-	CEBUG("\nnot added" << endl);
-	priv_handleReadNotAligned(oeI,nrta);
-	if(!doalign) ++noaligncounter;
-      }
-      CEBUG("\npost ar" << endl);
-      // keep this here so that a possible ban above is taken into account
-#ifdef CLOCK_STEPS1
-      gettimeofday(&tv,nullptr);
-#endif
-      priv_insertRIDIntoDenovoQueues(oeI->rid1);
-#ifdef CLOCK_STEPS1
-      PPF_timing_pathsearch+=diffsuseconds(tv);
-#endif
-    }
-
-    priv_showProgress();
-
-    if(PPF_pafparams_ptr->paf_use_max_contig_buildtime && PPF_buildcontig_newlinecounter==0){
-      times(&mytms);
-      actclocks=mytms.tms_utime+mytms.tms_stime;
-      if(actclocks>maxallowedclocks){
-	cout << "\nMaximum build time for this contig reached, aborting build.\n";
-	buildprematurestop=true;
-	break;
-      }
-    }
-    if(noaligncounter>=4800){
-      cout << "\nProbable dead end, aborting build.\n";
-      buildprematurestop=true;
-      break;
-    }
-  }
-
-  // in case we stopped the build prematurely
-  // cleanup the priority queues ... we need to be tidy
-  if(buildprematurestop){
-    for(auto & pq : PPF_queues){
-      while(!pq.empty()) pq.pop();
-    }
-  }
-
-
-#ifdef CLOCK_STEPS1
-  cout << "priv_ld addRead: " << ldtimear << endl;
-  cout << "priv_ld total: " << diffsuseconds(tvtotal) << endl;
-#endif
-
-  FUNCEND();
-}
-//#define CEBUG(bla)
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush(); }
-void PPathfinder::priv_handleReadNotAligned(necontainer_t::iterator oeI, nextreadtoadd_t const &nrta)
-{
-  FUNCSTART("void Pathfinder::priv_handleReadNotAligned(nextreadtoadd_t const &nrta)");
-
-//  CEBUG("Banning " << oeI->rid1 << " (" << PPF_readpool_ptr->getRead(oeI->rid1).getName() << ")\t" << oeI->linked_with << " (" << PPF_readpool_ptr->getRead(oeI->linked_with).getName() << ")" << endl);
-
-  // always, always ban the overlap which was not aligned
-  // (or else endless loop possible in mapping)
-  oeI->pf_banned=true;
-  if(PPF_overlapsbanned_smallstore.size()<PPF_overlapsbanned_smallstore.capacity()){
-    PPF_overlapsbanned_smallstore.push_back(oeI);
-  }
-
-  // Now look at the blocks of newedges_t whose reads are given
-  //  by the vector and who overlap with nrta.newid
-  auto raI=PPF_contigerrstat.reads_affected.begin();
-  for(; raI != PPF_contigerrstat.reads_affected.end(); ++raI){
-    //cout << "cesra: " << *raI << "\t" << PPF_readpool_ptr->getRead(*raI).getName() << endl;
-    auto neI = (*PPF_lowerbound_oedges_ptr)[*raI];
-    for(; neI != PPF_overlap_edges_ptr->end() && neI->rid1 == *raI; ++neI){
-      if(!neI->pf_banned){
-	if(neI->linked_with == nrta.newid){
-	  //cout << "Banning2: " << neI->rid1 << '\t' << neI->linked_with << '\n';
-	  neI->pf_banned=true;
-	  if(PPF_overlapsbanned_smallstore.size()<PPF_overlapsbanned_smallstore.capacity()){
-	    PPF_overlapsbanned_smallstore.push_back(neI);
-	  }
-	  //break;
-	  // NOTE: should MIRA ever get multiple overlaps between
-	  //  two reads, then the "break;" above must be removed
-	  //  should be safe for now.
-	  // BaCh 18.10.2014: this is now the case with overlap storage for small kmers
-	}
-      }
-    }
-  }
-
-  if(PPF_blacklist_queues.empty()) PPF_blacklist_queues.push(vector<readid_t>());
-  PPF_blacklist_queues.back().push_back(nrta.newid);
-  PPF_blacklisted_ids[nrta.newid]=1;
-
-  FUNCEND();
-  return;
-}
-//#define CEBUG(bla)
-
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush(); }
-void PPathfinder::priv_munchBlacklist(bool force)
-{
-  if((force && !PPF_blacklisted_ids.empty())
-     || (PPF_ids_in_contig_list.size()%8 == 0
-	 && PPF_blacklist_queues.size()>=10)){
-    CEBUG("Munching start force("<<force<<") blacklist front with " << PPF_blacklist_queues.front().size() << " elements\n");
-    for(auto rid : PPF_blacklist_queues.front()){
-      PPF_blacklisted_ids[rid]=0;
-    }
-    uint64 dmok=0;
-    uint64 dmnok=0;
-    for(auto rid : PPF_blacklist_queues.front()){
-      necontainer_t::iterator oeI=(*PPF_lowerbound_oedges_ptr)[rid];
-      for(;oeI!=PPF_overlap_edges_ptr->end() && rid==oeI->rid1;++oeI){
-	if(!oeI->pf_banned && PPF_ids_added_oltype[oeI->linked_with]){
-	  auto rv=priv_insertRIDIntoDenovoQueues(oeI->linked_with);
-	  if(rv!=QTG_END) {
-	    CEBUG("demunch success " << *oeI << endl; ++dmok);
-	  }else{
-	    CEBUG("demunch fail " << *oeI << endl; ++dmnok);
-	  }
-	}
-      }
-    }
-    PPF_blacklist_queues.pop();
-    CEBUG("Munching end. ok: " << dmok << " nok: " << dmnok << endl);
-  }
-}
-//#define CEBUG(bla)
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-//#define CEBUG(bla)   {cout << bla; cout.flush(); }
-void PPathfinder::map()
-{
-  FUNCSTART("void PPathfinder::map()");
-
-#ifdef CLOCK_STEPS1
-  timeval tv;
-#endif
-
-  Contig::templateguessinfo_t tguess;
-
-  cout << "Backbone assembly to " << PPF_actcontig_ptr->getContigName() << endl;
-  for(auto qi=0; qi<PPF_queues.size(); ++qi){
-    BUGIFTHROW(!PPF_queues[qi].empty(),"Queue chk 1 " << qi << " not empty?");
-  }
-
-  BUGIFTHROW(PPF_actcontig_ptr->getNumReadsInContig()==0,"No reads in contig " << PPF_actcontig_ptr->getContigName() << " ??? How should I map something to nothing?");
-
-  priv_basicSetup();
-  priv_prepareRailOverlapCache();
-
-  nextreadtoadd_t nrta;
-  nrta.newid=0;
-
-  bool allowbbqmulticopies=false;
-  bool allowbbqtroublemakers=false;
-  bool allowbbqsmallhits=false;
-
-  while(nrta.newid >= 0) {
-    nrta.refid=-1;
-    nrta.newid=-1;
-    nrta.weight=0;
-    nrta.direction_newid=0;
-    nrta.ads_node=nullptr;
-
-#ifdef CLOCK_STEPS1
-    gettimeofday(&tv,nullptr);
-#endif
-    auto oeI=priv_findNextBackboneOverlapQuick(nrta,
-					       allowbbqmulticopies,
-					       allowbbqtroublemakers,
-					       allowbbqsmallhits);
-
-    if(nrta.newid < 0) {
-      priv_prepareRailOverlapCache();
-      oeI=priv_findNextBackboneOverlapQuick(nrta,
-					    allowbbqmulticopies,
-					    allowbbqtroublemakers,
-					    allowbbqsmallhits);
-
-
-      if(nrta.newid < 0) {
-	CEBUG("allow everything\n");
-	priv_prepareRailOverlapCache();
-	allowbbqmulticopies=true;
-	allowbbqtroublemakers=true;
-	allowbbqsmallhits=true;
-	oeI=priv_findNextBackboneOverlapQuick(nrta,
-					      allowbbqmulticopies,
-					      allowbbqtroublemakers,
-					      allowbbqsmallhits);
-      }
-    }
-#ifdef CLOCK_STEPS1
-    PPF_timing_pathsearch+=diffsuseconds(tv);
-    gettimeofday(&tv,nullptr);
-#endif
-
-    if(nrta.newid >= 0) {
-      ++PPF_readaddattempts;
-      PPF_actcontig_ptr->addRead(*PPF_aligncache_ptr,
-				 nrta.ads_node, nrta.refid, nrta.newid, nrta.direction_newid,
-				 (*PPF_multicopies_ptr)[nrta.newid],
-				 0,
-				 tguess,
-				 PPF_contigerrstat);
-      if(PPF_contigerrstat.code == Contig::ENOERROR) {
-	CEBUG("\nok, added" << endl);
-	//Contig::setCoutType(Contig::AS_TEXT);
-	//cout << "nrnrnrnrnrnr\n" << *PPF_actcontig_ptr << endl;
-	PPF_ids_in_contig_list.push_back(nrta.newid);
-	(*PPF_used_ids_ptr)[nrta.newid]=1;
-	PPF_ids_added_oltype[nrta.newid]=ADDED_BY_BACKBONE;
-	priv_storeTemplateGuess(nrta.newid,tguess);
-      }else{
-	priv_handleReadNotAligned(oeI,nrta);
-      }
-#ifdef CLOCK_STEPS1
-      PPF_timing_connadd+=diffsuseconds(tv);
-#endif
-      priv_showProgress();
-    }
-  }
-
-  for(auto qi=0; qi<PPF_queues.size(); ++qi){
-    BUGIFTHROW(!PPF_queues[qi].empty(),"Queue chk 2 " << qi << " not empty?");
-  }
-
-}
-//#define CEBUG(bla)
-
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-void PPathfinder::priv_prepareRailOverlapCache()
-{
-#ifdef CLOCK_STEPS2
-  timeval tv;
-  timeval tvtotal;
-  gettimeofday(&tv,nullptr);
-  tvtotal=tv;
-#endif
-
-  // initialise PPF_railoverlapcache
-  // each read that has an overlap with a rail is put into the
-  //  vector once;
-  PPF_railoverlapcache.clear();
-
-  if(PPF_tmpproc_readalreadyrailed.empty()){
-    PPF_tmpproc_readalreadyrailed.resize(PPF_used_ids_ptr->size(),0);
-  }
-
-  priv_prochelper1(ReadGroupLib::SEQTYPE_PACBIOHQ);
-  priv_prochelper1(ReadGroupLib::SEQTYPE_SANGER);
-  priv_prochelper1(ReadGroupLib::SEQTYPE_454GS20);
-  priv_prochelper1(ReadGroupLib::SEQTYPE_SOLEXA);
-  priv_prochelper1(ReadGroupLib::SEQTYPE_IONTORRENT);
-  priv_prochelper1(ReadGroupLib::SEQTYPE_TEXT);
-  // take the rest in case there should be some
-  priv_prochelper1(ReadGroupLib::SEQTYPE_END);
-
-  // done here, need to clean up our tmp data so that the next
-  //  call finds it clean
-  for(auto rid : PPF_railoverlapcache) PPF_tmpproc_readalreadyrailed[rid]=0;
-
-#ifndef PUBLICQUIET
-  cout << "Backbone overlap cache: " << PPF_railoverlapcache.size() << endl;
-#endif
-}
-
-void PPathfinder::priv_prochelper1(uint8 seqtype)
-{
-  if(seqtype != ReadGroupLib::SEQTYPE_END
-     && !ReadGroupLib::hasLibWithSeqType(seqtype)) return;
-
-  for(auto rid : PPF_rails_in_contig_list){
-    auto rcI=(*PPF_lowerbound_oedges_ptr)[rid];
-    //if(!allowedrefids.empty() && !allowedrefids[rid]) continue;
-    for(; rcI != PPF_overlap_edges_ptr->end() && rcI->rid1==rid; ++rcI){
-      if(rcI->pf_banned) continue;
-      if(seqtype != ReadGroupLib::SEQTYPE_END
-	 && PPF_readpool_ptr->getRead(rcI->linked_with).getSequencingType()!=seqtype) continue;
-      if((*PPF_used_ids_ptr)[rcI->linked_with]) continue;
-      if(PPF_tmpproc_readalreadyrailed[rcI->linked_with]) continue;
-      if(PPF_readpool_ptr->getRead(rcI->linked_with).isRail()) continue;
-
-      // evil little rule for clean overlap ends ...
-      if(PPF_wantscleanoverlapends > 0){
-	if((*PPF_adsfacts_ptr)[rcI->adsfindex].get5pLenContiguousMatch(rcI->linked_with) <= PPF_wantscleanoverlapends
-	   || (*PPF_adsfacts_ptr)[rcI->adsfindex].get3pLenContiguousMatch(rcI->linked_with) <= PPF_wantscleanoverlapends)
-	  continue;
-      }
-      // ... and for minimum total non-matches
-      if(PPF_mintotalnonmatches > 0
-	 && (*PPF_adsfacts_ptr)[rcI->adsfindex].getTotalNonMatches() <= PPF_mintotalnonmatches){
-	continue;
-      }
-      // ... and for allowed seqtype
-      if(PPF_allowedseqtype!=ReadGroupLib::SEQTYPE_END
-	 && PPF_readpool_ptr->getRead(rcI->linked_with).getSequencingType() != PPF_allowedseqtype) continue;
-
-      PPF_tmpproc_readalreadyrailed[rcI->linked_with]=1;
-      PPF_railoverlapcache.push_back(rcI->linked_with);
-    }
-  }
-}
-
-//#define CEBUG(bla)
-
-
-
-/*************************************************************************
- *
- * Take one non-rail, find best place for a it in existing contig
- *
- *************************************************************************/
-
-
-//#define CEBUG(bla)   {cout << bla; cout.flush(); }
-necontainer_t::iterator PPathfinder::priv_findNextBackboneOverlapQuick(nextreadtoadd_t & resultread, bool allowmulticopies, bool allowtroublemakers, bool allowsmallhits)
-{
-  FUNCSTART("necontainer_t::iterator PPathfinder::priv_findNextBackboneOverlapQuick(nextreadtoadd_t & resultread, bool allowmulticopies, bool allowtroublemakers, bool allowsmallhits)");
-
-  CEBUG("aaa: " << allowmulticopies << allowtroublemakers << allowsmallhits << endl);
-
-  necontainer_t::iterator retoeI=PPF_overlap_edges_ptr->end();
-  if(PPF_railoverlapcache.empty()){
-    CEBUG("\troc empty\n");
-    // found nothing in previous loop, exit
-    return retoeI;
-  }
-
-  const vector<int8> & lr_used_ids = *PPF_used_ids_ptr;
-  const vector<uint8> & lr_multicopies = *PPF_multicopies_ptr;
-  const vector<uint8> & lr_istroublemaker = *PPF_istroublemaker_ptr;
-
-  resultread.newid=-1;
-  while(resultread.newid<0){
-    bool continuesearch=true;
-    int32 readid=-1;
-    while(continuesearch && !PPF_railoverlapcache.empty()){
-      readid=PPF_railoverlapcache.front();
-
-      CEBUG("\nfnboq:\n");
-      CEBUG("l: " << PPF_readpool_ptr->getRead(readid).getName());
-      CEBUG("\tused: " << (int16) lr_used_ids[readid]);
-      CEBUG("\tmc: " << (int16) lr_multicopies[readid]);
-      CEBUG("\ttm: " << (int16) lr_istroublemaker[readid]);
-      //if(!allowedrefids.empty()){
-      //	CEBUG("\tar: " << (int16) allowedrefids[readid]);
-      //}
-
-      PPF_railoverlapcache.pop_front();
-
-      if(lr_used_ids[readid]==0
-	 && (allowmulticopies || lr_multicopies[readid]==0)
-	 && (allowtroublemakers || lr_istroublemaker[readid]==0)){
-	continuesearch=false;
-      }
-    }
-
-
-    if(continuesearch){
-      CEBUG("\tnot taken/found\n");
-      // found nothing in previous loop, exit
-      return retoeI;
-    }
-    BUGIFTHROW(readid<0,"readid " << readid << " < 0, shouldn't be here");
-
-    CEBUG("\ttaken/found");
-
-    // ok, found one. Now search the rail it fits best to *in this contig*
-    necontainer_t::iterator oeI=(*PPF_lowerbound_oedges_ptr)[readid];
-
-    for(;oeI!=PPF_overlap_edges_ptr->end() && oeI->rid1 == readid; ++oeI){
-      // don't bother looking at if overlap is banned
-      if(oeI->pf_banned) {CEBUG("\tbanned"); continue;}
-      // must link to rail
-      if(!PPF_readpool_ptr->getRead(oeI->linked_with).isRail()) {CEBUG("\tbanned"); continue;}
-      // rail must be in this contig!
-      if(!PPF_ids_added_oltype[oeI->linked_with]) {CEBUG("\tbanned"); continue;}
-      //// rail must be allowed as refid
-      //if((!allowedrefids.empty() && !allowedrefids[oeI->linked_with])) continue;
-
-      // if necessary, take into account only rails that are
-      //  - non-multicopies
-      //  - non-troublemakers
-      CEBUG("\tbasicok");
-      if((allowmulticopies || lr_multicopies[oeI->linked_with]==0)
-	 && (allowtroublemakers || lr_istroublemaker[oeI->linked_with] == 0)){
-	CEBUG("\tmc&tm ok");
-	//  - that have overlap length >= minim length (just to have
-	//    good matches first)
-	if(oeI->best_weight > resultread.weight){
-	  CEBUG("\tbw ok");
-	  if(allowsmallhits
-	     || (*PPF_adsfacts_ptr)[oeI->adsfindex].getOverlapLen() >=
-	     (*PPF_miraparams_ptr)[PPF_readpool_ptr->getRead(readid).getSequencingType()].getPathfinderParams().paf_bbquickoverlap_minlen) {
-	    resultread.refid=oeI->linked_with;
-	    resultread.newid=readid;
-	    resultread.weight=oeI->best_weight;
-	    resultread.direction_newid=oeI->direction;
-	    resultread.ads_node=&(*PPF_adsfacts_ptr)[oeI->adsfindex];
-
-	    // the edges are sorted by rid1, then by "bestweight: high to low"
-	    // therefore, if we wound something, we do not need to check further
-	    // edges of this read ... all remaining edges have lower or equal
-	    // quality anyway. Therefore, break out of loop here
-	    retoeI=oeI;
-	    CEBUG("\treturned\n");
-	    break;
-	  }
-	}
-      }
-    }
-  }
-  return retoeI;
-}
-
-//#define CEBUG(bla)
-
-void PPathfinder::priv_storeTemplateGuess(readid_t newid, Contig::templateguessinfo_t & tguess)
-{
-  FUNCSTART("void PPathfinder::priv_storeTemplateGuess(readid_t refid, readid_t newid, Contig::templateguessinfo_t & tguess)");
-
-  //cout << "STORE STORE STORE " << tguess << endl;
-
-  if(PPF_astemplateguesses_ptr->empty()
-     || tguess.rgid.isDefaultNonValidReadGroupID()) return;
-
-  auto tpid=PPF_readpool_ptr->getRead(newid).getTemplatePartnerID();
-  BUGIFTHROW(tpid == -1, "tpid == -1?");
-  if( PPF_pafparams_ptr->paf_use_genomic_algorithms       // thorough check on repeats only for genome, not possible for EST
-      && PPF_ids_added_oltype[newid]!=ADDED_BY_BACKBONE
-      && (PPF_ids_added_oltype[tpid]!=ADDED_BY_NOREPT
-	  || PPF_ids_added_oltype[newid]!=ADDED_BY_NOREPT)){
-    return;
-  }
-
-  //cout << "REALLYSTORE\n";
-
-  BUGIFTHROW(PPF_readpool_ptr->getRead(tpid).getTemplateID() != PPF_readpool_ptr->getRead(newid).getTemplateID(), "PPF_readpool_ptr->getRead(tpid).getTemplateID() " << PPF_readpool_ptr->getRead(tpid).getTemplateID() << " != " << PPF_readpool_ptr->getRead(newid).getTemplateID() << " PPF_readpool_ptr->getRead(newid).getTemplateID() ???");
-  (*PPF_astemplateguesses_ptr)[PPF_readpool_ptr->getRead(newid).getTemplateID()]=tguess;
-}
diff --git a/src/mira/ppathfinder.H b/src/mira/ppathfinder.H
deleted file mode 100644
index dd2fc2b..0000000
--- a/src/mira/ppathfinder.H
+++ /dev/null
@@ -1,472 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 2003 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-#ifndef _mira_ppathfinder_h_
-#define _mira_ppathfinder_h_
-
-#include <array>
-#include <queue>
-#include <utility>
-
-#include "stdinc/defines.H"
-
-#include "mira/overlapedges.H"
-#include "mira/contig.H"
-
-
-class PPathfinder
-{
-  // Types
-private:
-  struct beststartinfo_t {
-    uint32 bsi_clustersize;
-    readid_t bsi_rid;
-    // don't need to add that one, just for debugging
-    uint32 bsi_numconnects;
-
-    friend std::ostream & operator<<(std::ostream &ostr, beststartinfo_t const &bsi){
-      ostr << "BSI: rid " << bsi.bsi_rid
-	   << "\tcs:" << bsi.bsi_clustersize
-	   << "\tnc: " << bsi.bsi_numconnects << std::endl;
-      return ostr;
-    }
-
-    inline static bool ltclustersize(const beststartinfo_t & a, const beststartinfo_t & b){
-      return a.bsi_clustersize < b.bsi_clustersize;
-    }
-
-  };
-
-
-  struct nextreadtoadd_t{
-    readid_t refid;
-    readid_t newid;                   // number of read in seqpool
-    uint32 weight;
-    int16  direction_newid;
-    const AlignedDualSeqFacts * ads_node;
-
-    uint8 foundqueuenum;
-    friend std::ostream & operator<<(std::ostream &ostr, nextreadtoadd_t const &nrta);
-  };
-
-
-  typedef std::pair<uint32,necontainer_t::iterator> ppfweightelem_t;
-  typedef std::priority_queue<ppfweightelem_t> ppfweightqueue_t;
-
-  //Variables
-private:
-  enum queue_types {
-    QTG_TPARTNERNOREPT_OLNOREPTSTRONG_WELLCONNECTED=0,     // 0    // TPARTNER: no rept; THIS OVERLAP: norept; NEW READ: well connected
-    QTG_TPARTNERNOREPT_OLNOREPTWEAK_WELLCONNECTED,	    // 1
-    QTG_TPARTNERNOREPT_OLNOREPTBELOWAVG_WELLCONNECTED,	    // 2
-
-    QTG_TPARTNERNOREPT_OLNOREPTSTRONG,      // 3    // TPARTNER: no rept; THIS OVERLAP: norept
-    QTG_TPARTNERNOREPT_OLNOREPTWEAK,	    // 4
-    QTG_TPARTNERNOREPT_OLNOREPTBELOWAVG,    // 5
-
-    QTG_TPARTNERNOTREPT_OLNOREPTSTRONG_WELLCONNECTED,      // 6    // TPARTNER: HAF4; THIS OVERLAP: norept; NEW READ: well connected
-    QTG_TPARTNERNOTREPT_OLNOREPTWEAK_WELLCONNECTED,	    // 7
-    QTG_TPARTNERNOTREPT_OLNOREPTBELOWAVG_WELLCONNECTED,    // 8
-
-    QTG_TPARTNERNOTREPT_OLNOREPTSTRONG,      // 9    // TPARTNER: HAF4; THIS OVERLAP: norept
-    QTG_TPARTNERNOTREPT_OLNOREPTWEAK,	    // 10
-    QTG_TPARTNERNOTREPT_OLNOREPTBELOWAVG,    // 11
-
-    QTG_OLNOREPTSTRONG_WELLCONNECTED,			    // 12
-    QTG_OLNOREPTWEAK_WELLCONNECTED,			    // 13
-    QTG_OLNOREPTBELOWAVG_WELLCONNECTED,		    // 14
-
-    QTG_TPARTNERNOREPT_STRONG_WELLCONNECTED,		    // 14a, maybe also a 14b and c (weak/belowavg)?
-
-    QTG_OLNOREPTSTRONG,			    // 15
-    QTG_OLNOREPTWEAK,			    // 16
-    QTG_OLNOREPTBELOWAVG,		    // 17
-
-    QTG_TPARTNERNOREPT_OLNOREPTOTHER,	    // 18
-    QTG_TPARTNERNOREPT_OLNOTREPTOTHER,	    // 19
-    QTG_TPARTNERNOTREPT_OLNOREPTOTHER,	    // 20
-    QTG_TPARTNERNOTREPT_OLNOTREPTOTHER,	    // 21
-    QTG_OLNOREPTOTHER,			    // 22
-
-    QTG_TPARTNERNOREPT_OLREPT,		    // 23
-    QTG_TPARTNERNOTREPT_OLREPT,		    // 24
-
-    QTG_OLNOTREPT,                           // 25   // norept==false, but also rept==false (HAF4)
-
-    QTG_OLREPTSTRONG_WELLCONNECTED,	    // 26
-    QTG_OLREPTWEAK_WELLCONNECTED,	    // 27
-    QTG_OLREPTSTRONG,			    // 28
-    QTG_OLREPTWEAK,			    // 29
-    QTG_OLREPT,				    // 30
-
-    QTG_MAYBESPOILSPORT,                    // 31
-
-    QTG_INCORRECTIBLEORCHIMERA,             // 32 keep this as very, very last resort option
-
-    QTG_OLOTHER,                             // 33   should stay empty??
-
-    QTG_RELEGATEDBYPP,                      // 34
-
-    QTG_END = 36,
-
-
-    QTE_TPARTNERWCREPT6P_WCREPT6P_OLREPT_REPT6PWC=0,  //  0
-    QTE_TPARTNERWCREPT5_WCREPT5_OLREPT_REPT6PWC,      //  1
-    QTE_TPARTNERWCREPT5_WCREPT5_OLREPT_REPT5WC,	      //  2
-
-    QTE_TPARTNERWC_WCREPT6P_OLREPT_REPT6PWC,	      //  3
-    QTE_TPARTNERWC_WCREPT5_OLREPT_REPT6PWC,	      //  4
-    QTE_TPARTNERWC_WCREPT5_OLREPT_REPT5WC,	      //  5
-
-    QTE_TPARTNERWC_WC_OLREPT_REPT6PWC,		      //  6
-    QTE_TPARTNERWC_WC_OLREPT_REPT5WC,		      //  7
-
-    QTE_TPARTNERWC_WC_OLREPT_WC,		      //  8
- ///--- OL_REPT && TPARTNERWC ^^^
-    QTE_WCREPT6P_OLREPT_REPT6PWC,		      //  9
-    QTE_WCREPT5_OLREPT_REPT6PWC,		      // 10
-    QTE_WCREPT5_OLREPT_REPT5WC,			      // 11
-
-    QTE_REPT6P_OLREPT_REPT6PWC,			      // 12
-    QTE_REPT5_OLREPT_REPT6PWC,			      // 13
-    QTE_REPT5_OLREPT_REPT5WC,			      // 14
-
-    QTE_TPARTNER_WC_OLREPT_WC,			      // 15
-    QTE_TPARTNER_OLREPT_WC,			      // 16
-
-    QTE_WC_OLREPT_WC,				      // 17
-    QTE_OLREPT_WC,				      // 18
-///--- OLREPT ^^^
-    QTE_TPARTNERWC_WC_OL_WC,			      // 19
-    QTE_TPARTNER_WC_OL_WC,			      // 20
-    QTE_TPARTNER_OL_WC,				      // 21
-    QTE_TPARTNER,				      // 22  // nope for EST ... intron still may spoil
-
-    QTE_WC_OL_WC,				      // 23
-    QTE_OL_WC,					      // 24
-
-    QTE_REPT6P,					      // 25
-    QTE_REPT5,					      // 26
-    QTE_H4,					      // 27
-    QTE_H3,					      // 28
-
-    QTE_INCORRECTIBLEORCHIMERA,                       // 29 keep this as very, very last resort option
-
-    QTE_OTHER,                                        // 30    should stay empty??
-
-    QTE_RELEGATEDBYPP,                                // 31
-
-    QTE_END
-  };
-
-  std::array<ppfweightqueue_t,QTG_END> PPF_queues; // careful in case QTE_END is bigger!
-
-  std::vector<MIRAParameters> * PPF_miraparams_ptr;
-  ReadPool * PPF_readpool_ptr;
-  necontainer_t  * PPF_overlap_edges_ptr;
-  adsfcontainer_t * PPF_adsfacts_ptr;
-  std::vector<Align> * PPF_aligncache_ptr;
-
-  std::vector<int8>  * PPF_used_ids_ptr;
-  std::vector<uint8> * PPF_multicopies_ptr; /* reads with more overlaps than
-					  expected on average have 1
-					  provided by assembly class
-					  pathfinder will start building
-					  elsewhere, and include those
-					  last
-				       */
-  std::vector<uint8> * PPF_hasmcoverlap_ptr; /* reads that overlap with a read
-					   that is categorised as multi-
-					   copy get 1 here
-					   initialised by pathfinder if
-					   vector is empty (==once
-					   every pass of MIRA)
-					   // TODO: unused now???
-					*/
-  std::vector<uint8> * PPF_hasreptoverlap_ptr; /* reads that have ol_rept overlaps
-						  init by pathfinder if empty (once every pass)
-						  maybe unused atm
-					      */
-  std::vector<uint8> * PPF_hasnoreptoverlap_ptr; /* reads that have ol_norept overlaps
-						    init by pathfinder if empty (once every pass)
-						 */
-  std::vector<uint8> * PPF_istroublemaker_ptr;
-  std::vector<uint8> * PPF_incorrectibleorchimera_ptr;
-  std::vector<uint8> * PPF_maybespoilsport_ptr;
-  std::vector<uint8> * PPF_wellconnected_ptr; /* vector of bool values
-					    reads having a level 0 overlap
-					    criterion with left extend and
-					    level 0 for right extend are
-					    well connected
-					    (see skim and assembly for level
-					    settings)
-					 */
-
-  /* lower_bound() is called very often, so caching/precomputing all
-     possible results (= number of reads in readpool)
-     speeds the things up
-  */
-  std::vector<necontainer_t::iterator> * PPF_lowerbound_oedges_ptr;
-  std::vector<Contig::templateguessinfo_t> * PPF_astemplateguesses_ptr; // beware, may be rightfully empty
-
-
-  // atm only for mapping
-  uint32 PPF_wantscleanoverlapends;   // but this one could also be used for de-novo I think
-  // special for mapping
-  uint32 PPF_mintotalnonmatches;
-  // special for mapping
-  uint8 PPF_allowedseqtype;
-
-  /*********************************************************************************
-   *********************************************************************************/
-
-  Contig * PPF_actcontig_ptr;
-
-  /*********************************************************************************
-   *********************************************************************************/
-
-  const pathfinder_parameters * PPF_pafparams_ptr;
-  std::vector<beststartinfo_t> PPF_beststartcache;;
-
-  // size of number of reads in assembly
-  // tells what overlap type led to a read being added to a contig
-  // double function: lookup for which read is in contig
-  // 4: added via ol_norept
-  // 3: added via ol_norept==false && ol_rept==false
-  // 2: added via other
-  // 1: added by backbone
-  // 0: not added
-  enum {
-    ADDED_NOTADDED=0,
-    ADDED_BY_BACKBONE,
-    ADDED_BY_OTHER,
-    ADDED_BY_NOTREPT,
-    ADDED_BY_NOREPT
-  };
-  std::vector<int8>    PPF_ids_added_oltype;
-
-  // simple list of ids that were added to a contig, in the order of addition
-  //  used as a quick lookup for cleanup routines which need to restore
-  //  pristine, all-zero PPF_ids_added_oltype, PPF_blacklisted_ids etc vectors.
-  std::vector<readid_t>    PPF_ids_in_contig_list;
-
-  // simple list of rail reads in a contig when mapping
-  std::vector<readid_t>    PPF_rails_in_contig_list;
-
-  // A simple queue for rail overlaps, using deque as STL queue has no clear() :-(
-  //  IDs contained here are from non-rails, but have an overlap to a rail
-  std::deque<readid_t>     PPF_railoverlapcache;
-  // bool yes/no whether a rail already used
-  std::vector<uint8>       PPF_tmpproc_readalreadyrailed;
-
-  Contig::errorstatus_t PPF_contigerrstat;
-
-  /* set by n4_searchBestStrongGoodStartEnvironment_sub()
-     says what the startcache contains
-     0 == best quality, strong good overlaps found, well connected reads
-     1 == medium quality, overlaps but not strong good, not multicopy, well connected reads
-     2 == medium quality, overlaps but not strong good. multicopy, well connected reads
-     3 == not well connected
-     4 == singlets
-  */
-  enum {
-    BSCC_GENOME_BESTQUAL=0,
-    BSCC_GENOME_MEDQUAL_TROUBLEMAKER_NOTSTRONG_NOTMULTICOPY_WELLCONNECTED_NOKMERFORK,
-    BSCC_GENOME_MEDQUAL_TROUBLEMAKER_NOTSTRONG_MULTICOPY_WELLCONNECTED_NOKMERFORK,
-    BSCC_GENOME_BADQUAL_NOTWELLCONNECTED,
-    BSCC_EST_WELLCONNECTED_REPT6P,
-    BSCC_EST_WELLCONNECTED_REPT,
-    BSCC_EST_WELLCONNECTED_H4,
-    BSCC_EST_WELLCONNECTED_H3,
-    BSCC_EST_WELLCONNECTED_H2,
-    BSCC_EST_NOTWELLCONNECTED,
-    BSCC_SINGLETS,
-  };
-  uint8 PPF_bsccontent;
-  bool  PPF_bsrandry;    // whether startcache had to be refilled in last call to Pathfinder
-
-  // small store is a store with a certain capacity (100k?) that takes
-  //  up iterators to all banned overlaps until full.
-  // So when it comes to reset pf_banned flag, if store is not full only
-  //  the overlap edges whose iterators are in this store have to be cleared
-  //  instead of iterating through the complete overlap edges. The latter
-  //  is needed if store is full.
-  // on de-novo 6m Solexa paired-end 36mers, this reduces another
-  //  15% in the contig building phase (38 minutes to 33 minutes)
-  // tradeoff of 5 minutes for 800k RAM is pretty good (160k RAM would
-  //  suffice in that example, but let's plan for a bit more)
-  // influence of mechanism grows with number of overlaps, so
-  //  assemblies with more reads will profit exponentially
-  std::vector<necontainer_t::iterator> PPF_overlapsbanned_smallstore;
-
-  // blacklisting: queue to handle blacklist decay ...
-  std::queue<std::vector<readid_t>> PPF_blacklist_queues;
-  // ... and bool vector (size of readpool) for quick access
-  // 0: normal; 1: blacklisted
-  std::vector<int8> PPF_blacklisted_ids;
-
-  // temporary vector to be used by routines which need an array of size of readpool
-  // initiliased to all 0 by ppathfinder, but routines must take care themselves
-  //  to clean up after they used it!
-  std::vector<uint8> PPF_tmparray;
-  std::vector<uint32> PPF_tmparray_idxused;
-
-  // currently for EST data
-  // max and min HAF level in reads
-  std::vector<uint8> PPF_haflevel_max;
-  std::vector<uint8> PPF_haflevel_min;
-  uint8 PPF_haflevel_maxseen;
-  uint8 PPF_haflevel_minseen;
-
-  // counts how many read add attempts there were to the contig (contig.addRead())
-  //  in the last call to map() or denovo() (needed for Solexa mapping assembly,
-  //  where loops can stop if no more adding attempt exists)
-  uint32 PPF_readaddattempts;
-
-  /*********************************************************************************
-   *********************************************************************************/
-
-  uint32 PPF_buildcontig_newlinecounter;
-  suseconds_t PPF_timing_pathsearch;
-  suseconds_t PPF_timing_connadd;
-
-  static bool PPF_staticinit;
-
-public:
-
-
-  //Functions
-private:
-  static bool staticInit();
-
-  void priv_ppFillNoRept();
-  void priv_ppFillRept();
-  void priv_ppFillSpoilSport();
-
-  void priv_initialiseLowerBoundOEdges();
-  void priv_showProgress();
-  void priv_basicSetup();
-
-  void priv_fillDenovoStartCache() {
-    if(PPF_beststartcache.empty()){
-      PPF_bsrandry=true;
-      if(PPF_pafparams_ptr->paf_use_genomic_algorithms) {
-	priv_fdns_genome();
-      }else{
-	priv_fdns_est();
-      }
-    }
-  }
-  void priv_fdns_genome();
-  void priv_fdns_g_subFillCache(bool wanttroublemakercheck,
-				bool wantstronggoodcheck,
-				bool wantmulticopycheck,
-				bool wantwellconnectedcheck,
-				bool wantnokmerfork);
-  void priv_fdns_est();
-  void priv_fdns_e_subFillCache(bool wantwellconnectedcheck,
-				uint8 minallowedfreq);
-  void priv_fdns_fillSinglets();
-
-  readid_t priv_getNextStartID();
-  readid_t priv_gnsi_helper();
-  void priv_fillDenovoQueues(size_t maxdist);
-  inline uint32 priv_insertRIDIntoDenovoQueues(readid_t rid){
-    if(PPF_pafparams_ptr->paf_use_genomic_algorithms) {
-      return priv_iridnq_genome(rid);
-    }
-    return priv_iridnq_est(rid);
-  }
-  uint32 priv_iridnq_genome(readid_t rid);
-  uint32 priv_iridnq_est(readid_t rid);
-
-  uint32 priv_getNextOverlapFromDenovoQueue(necontainer_t::iterator & oeI);
-
-  void priv_loopDenovo(){
-    priv_ld_genome_and_est();
-  }
-  void priv_ld_genome_and_est();
-
-  void priv_handleReadNotAligned(necontainer_t::iterator oeI, nextreadtoadd_t const &nrta);
-  void priv_munchBlacklist(bool force);
-
-  void priv_fillHAFLevelInfo();
-
-  void priv_prepareRailOverlapCache();
-  void priv_prochelper1(uint8 seqtype);
-
-  necontainer_t::iterator priv_findNextBackboneOverlapQuick(nextreadtoadd_t & resultread,
-								      bool allowmulticopies,
-								      bool allowtroublemakers,
-								      bool allowsmallhits);
-
-  void priv_storeTemplateGuess(readid_t newid, Contig::templateguessinfo_t & tguess);
-
-public:
-  PPathfinder(std::vector<MIRAParameters> * params,
-	      ReadPool * readpool,
-	      necontainer_t * overlap_edges,
-	      adsfcontainer_t * adsfacts,
-	      std::vector<Align> * aligncache,
-	      std::vector<int8> * used_ids,
-	      std::vector<uint8> * multicopies,
-	      std::vector<uint8> * hasmcoverlaps,
-	      std::vector<uint8> * hasreptoverlaps,
-	      std::vector<uint8> * hasnoreptoverlaps,
-	      std::vector<uint8> * istroublemaker,
-	      std::vector<uint8> * incorrectibleorchimera,
-	      std::vector<uint8> * maybespoilsport,
-	      std::vector<uint8> * wellconnected,
-	      std::vector<necontainer_t::iterator > * lowerbound_oedges_ptr,
-	      std::vector<Contig::templateguessinfo_t> * astemplateguess
-    );
-
-  ~PPathfinder();
-
-  PPathfinder(PPathfinder const &other) = delete;
-  PPathfinder const & operator=(PPathfinder const & other) = delete;
-
-  //friend std::ostream & operator<<(std::ostream &ostr, PPathfinder const &ppf);
-
-  void discard();
-
-  void prepareForNewContig(Contig & con);
-  void resyncContig();
-
-  void denovo();
-  void map();
-  void mapAndDenovo();
-
-  const std::vector<readid_t> & getRIDsKnownInContig() const { return PPF_ids_in_contig_list;}
-  bool startCacheRanDry() const { return PPF_bsrandry;}
-  bool startCacheHasSinglets() const { return PPF_bsccontent==BSCC_SINGLETS;}
-  uint32 getReadAddAttempts() const {return PPF_readaddattempts;}
-
-  void setWantsCleanOverlapEnds(uint32 len) {PPF_wantscleanoverlapends=len;}
-  void setMinTotalNonMatches(uint32 n) {PPF_mintotalnonmatches=n;}
-  void setAllowedSeqTypeForMapping(uint8 st) {PPF_allowedseqtype=st;}
-};
-
-
-#endif
diff --git a/src/mira/preventinitfiasco.C b/src/mira/preventinitfiasco.C
deleted file mode 100644
index b45301e..0000000
--- a/src/mira/preventinitfiasco.C
+++ /dev/null
@@ -1,372 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
- *   Krebsforschungszentrum, DKFZ Heidelberg) and Bastien Chevreux
- * Copyright (C) 2000 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-
-#include <memorc/memorc.H>
-
-#include <io/annotationmappings.H>
-#include <mira/readgrouplib.H>
-#include <mira/multitag.H>
-#include <mira/read.H>
-#include <mira/contig.H>
-#include <mira/gff_parse.H>
-#include <util/misc.H>
-
-
-using namespace std;
-
-
-// simplest way to avoid the static initialisation fiasco:
-//  define static class variables for libraries here
-
-/*************************************************************************
- *
- * MemORC
- *
- *************************************************************************/
-#ifdef MIRAMEMORC
-MemORC::mbmap_t MemORC::MOC_memblocks;
-MemORC::mbmap_t MemORC::MOC_hotblocks;
-vector<uint64> MemORC::MOC_hotaidsrequested;
-
-MemORC MemORC::MOC_semaphore; // keep last for memorc: when instantiated, sets readytouse
-                   //  when destructed, clears readytouse
-#endif
-
-/*************************************************************************
- *
- * multitag_t
- *
- *************************************************************************/
-
-const vector<uint32> multitag_t::MT_zerosizeuint32v;
-
-StringContainer<uint8> multitag_t::MT_sc_mttagsource("multitags tagsource");
-StringContainer<uint16> multitag_t::MT_sc_mtidentifier("multitags identifier");
-StringContainer<uint32> multitag_t::MT_sc_mtcomment("multitags comment");
-
-
-vector<int8> multitag_t::MT_cache_identifier_isgff3so_entry;
-
-
-#ifdef MIRA_HAS_EDIT
-#include <EdIt/hypothesen.H>
-multitag_t fault_region::fr_tagED_C(Read::REA_defaulttag_ED_C);
-multitag_t fault_region::fr_tagED_D(Read::REA_defaulttag_ED_D);
-multitag_t fault_region::fr_tagED_I(Read::REA_defaulttag_ED_I);
-#endif
-
-
-
-// multitag_t::newIdentifier() and newComment() below will need initialised
-//  static entries in the multitag class. Therefore, make sure we initialised
-//   that before using newIdentifier() or newComment()
-
-const multitag_t::mte_src_t multitag_t::MT_tagsrcentry_idEmpty=multitag_t::newSource("");
-const multitag_t::mte_src_t multitag_t::MT_tagsrcentry_idMIRA=multitag_t::newSource("MIRA");
-const multitag_t::mte_src_t multitag_t::MT_tagsrcentry_idGenBank=multitag_t::newSource("GenBank");
-const multitag_t::mte_src_t multitag_t::MT_tagsrcentry_idGFF3=multitag_t::newSource("GFF3");
-
-
-/*************************************************************************
- *
- * Contig
- *
- *************************************************************************/
-
-std::unordered_set<std::string> Contig::CON_cebugnames;
-vector<multitag_t::mte_id_t> Contig::CON_danger_zones_ids;
-vector<multitag_t::mte_id_t> Contig::CON_baselock_ids;
-vector<multitag_t::mte_id_t> Contig::CON_snplock_ids;
-
-const multitag_t::mte_id_t Contig::CON_tagentry_idEmpty=multitag_t::newIdentifier("");
-const multitag_t::mte_id_t Contig::CON_tagentry_idALUS=multitag_t::newIdentifier("ALUS");
-const multitag_t::mte_id_t Contig::CON_tagentry_idREPT=multitag_t::newIdentifier("REPT");
-const multitag_t::mte_id_t Contig::CON_tagentry_idSRMc=multitag_t::newIdentifier("SRMc");
-const multitag_t::mte_id_t Contig::CON_tagentry_idWRMc=multitag_t::newIdentifier("WRMc");
-const multitag_t::mte_id_t Contig::CON_tagentry_idSAOc=multitag_t::newIdentifier("SAOc");
-const multitag_t::mte_id_t Contig::CON_tagentry_idSROc=multitag_t::newIdentifier("SROc");
-const multitag_t::mte_id_t Contig::CON_tagentry_idSIOc=multitag_t::newIdentifier("SIOc");
-const multitag_t::mte_id_t Contig::CON_tagentry_idPSHP=multitag_t::newIdentifier("PSHP");
-const multitag_t::mte_id_t Contig::CON_tagentry_idED_D=multitag_t::newIdentifier("ED_D");
-const multitag_t::mte_id_t Contig::CON_tagentry_idED_C=multitag_t::newIdentifier("ED_C");
-const multitag_t::mte_id_t Contig::CON_tagentry_idED_I=multitag_t::newIdentifier("ED_I");
-
-const multitag_t::mte_id_t Contig::CON_tagentry_idESDN=multitag_t::newIdentifier("ESDN");
-
-const multitag_t::mte_id_t Contig::CON_tagentry_idSTMS=multitag_t::newIdentifier("STMS");
-const multitag_t::mte_id_t Contig::CON_tagentry_idSTMU=multitag_t::newIdentifier("STMU");
-const multitag_t::mte_id_t Contig::CON_tagentry_idUNSc=multitag_t::newIdentifier("UNSc");   // UNSure, contig
-
-const multitag_t::mte_id_t Contig::CON_tagentry_idIUPc=multitag_t::newIdentifier("IUPc");   // IUPAC in consensus
-
-const multitag_t::mte_id_t Contig::CON_tagentry_idMCVc=multitag_t::newIdentifier("MCVc");   // missing coverage in consensus
-const multitag_t::mte_id_t Contig::CON_tagentry_idDGPc=multitag_t::newIdentifier("DGPc");   // Dubious Gap Position
-
-const multitag_t::mte_id_t Contig::CON_tagentry_idSOFApolyA_signal_sequence=multitag_t::newIdentifier("polyA_signal_sequence");
-
-const multitag_t::mte_co_t Contig::CON_tagentry_coEmpty=multitag_t::newComment("");
-
-
-/*************************************************************************
- *
- * Read
- *
- *************************************************************************/
-
-StringContainer<uint32> Read::REA_sc_readname("Read:: read name");
-StringContainer<uint8> Read::REA_sc_processstatus("Read:: process status");
-StringContainer<uint32> Read::REA_sc_asped("asped");
-
-const multitag_t::mte_id_t Read::REA_tagentry_idEmpty=multitag_t::newIdentifier("");
-
-const multitag_t::mte_id_t Read::REA_tagentry_idMINF=multitag_t::newIdentifier("MINF");
-const multitag_t::mte_id_t Read::REA_tagentry_idMIT2=multitag_t::newIdentifier("MIT2");
-const multitag_t::mte_id_t Read::REA_tagentry_idCOMM=multitag_t::newIdentifier("COMM");
-
-const multitag_t::mte_id_t Read::REA_tagentry_idSRMr=multitag_t::newIdentifier("SRMr");
-const multitag_t::mte_id_t Read::REA_tagentry_idCRMr=multitag_t::newIdentifier("CRMr");
-const multitag_t::mte_id_t Read::REA_tagentry_idWRMr=multitag_t::newIdentifier("WRMr");
-const multitag_t::mte_id_t Read::REA_tagentry_idSAOr=multitag_t::newIdentifier("SAOr"); //  SNP intrA Organism in Read
-const multitag_t::mte_id_t Read::REA_tagentry_idSROr=multitag_t::newIdentifier("SROr"); //  SNP inteR Organism in Read
-const multitag_t::mte_id_t Read::REA_tagentry_idSIOr=multitag_t::newIdentifier("SIOr"); //  SNP Intra- and inter Organism in Read
-const multitag_t::mte_id_t Read::REA_tagentry_idSAOm=multitag_t::newIdentifier("SAOm"); // 'm': Marker versions for GFF3
-const multitag_t::mte_id_t Read::REA_tagentry_idSROm=multitag_t::newIdentifier("SROm");
-const multitag_t::mte_id_t Read::REA_tagentry_idSIOm=multitag_t::newIdentifier("SIOm");
-const multitag_t::mte_id_t Read::REA_tagentry_idMCVm=multitag_t::newIdentifier("MCVm");
-const multitag_t::mte_id_t Read::REA_tagentry_idSRMm=multitag_t::newIdentifier("SRMm");
-const multitag_t::mte_id_t Read::REA_tagentry_idWRMm=multitag_t::newIdentifier("WRMm");
-
-const multitag_t::mte_id_t Read::REA_tagentry_idESDN=multitag_t::newIdentifier("ESDN");
-
-const multitag_t::mte_id_t Read::REA_tagentry_idUNSr=multitag_t::newIdentifier("UNSr");
-const multitag_t::mte_id_t Read::REA_tagentry_idMNRr=multitag_t::newIdentifier("MNRr");      // Masked Nasty Repeat
-
-const multitag_t::mte_id_t Read::REA_tagentry_idHAF0=multitag_t::newIdentifier("HAF0");
-const multitag_t::mte_id_t Read::REA_tagentry_idHAF1=multitag_t::newIdentifier("HAF1");
-const multitag_t::mte_id_t Read::REA_tagentry_idHAF2=multitag_t::newIdentifier("HAF2");
-const multitag_t::mte_id_t Read::REA_tagentry_idHAF3=multitag_t::newIdentifier("HAF3");
-const multitag_t::mte_id_t Read::REA_tagentry_idHAF4=multitag_t::newIdentifier("HAF4");
-const multitag_t::mte_id_t Read::REA_tagentry_idHAF5=multitag_t::newIdentifier("HAF5");
-const multitag_t::mte_id_t Read::REA_tagentry_idHAF6=multitag_t::newIdentifier("HAF6");
-const multitag_t::mte_id_t Read::REA_tagentry_idHAF7=multitag_t::newIdentifier("HAF7");
-
-const multitag_t::mte_id_t Read::REA_tagentry_idRLE1=multitag_t::newIdentifier("RLE1");
-const multitag_t::mte_id_t Read::REA_tagentry_idRLE2=multitag_t::newIdentifier("RLE2");
-const multitag_t::mte_id_t Read::REA_tagentry_idRLE3=multitag_t::newIdentifier("RLE3");
-const multitag_t::mte_id_t Read::REA_tagentry_idRLE4=multitag_t::newIdentifier("RLE4");
-const multitag_t::mte_id_t Read::REA_tagentry_idRLE5=multitag_t::newIdentifier("RLE5");
-const multitag_t::mte_id_t Read::REA_tagentry_idRLE6=multitag_t::newIdentifier("RLE6");
-const multitag_t::mte_id_t Read::REA_tagentry_idRLE7=multitag_t::newIdentifier("RLE7");
-const multitag_t::mte_id_t Read::REA_tagentry_idRLE8=multitag_t::newIdentifier("RLE8");
-
-const multitag_t::mte_id_t Read::REA_tagentry_idKMRF=multitag_t::newIdentifier("KMRF");
-
-
-const multitag_t::mte_id_t Read::REA_tagentry_idDGNr=multitag_t::newIdentifier("DGNr");
-
-const multitag_t::mte_id_t Read::REA_tagentry_idMFSM=multitag_t::newIdentifier("MFSM");  // MIRA Force Short-Read Merge
-
-
-const multitag_t::mte_id_t Read::REA_tagentry_idALUS=multitag_t::newIdentifier("ALUS");
-const multitag_t::mte_id_t Read::REA_tagentry_idREPT=multitag_t::newIdentifier("REPT");
-const multitag_t::mte_id_t Read::REA_tagentry_idSVEC=multitag_t::newIdentifier("SVEC");
-
-const multitag_t::mte_id_t Read::REA_tagentry_idSOFAdatabank_entry	      =multitag_t::newIdentifier("databank_entry");
-const multitag_t::mte_id_t Read::REA_tagentry_idSOFAcontig		      =multitag_t::newIdentifier("contig");
-const multitag_t::mte_id_t Read::REA_tagentry_idSOFAgene		      =multitag_t::newIdentifier("gene");
-const multitag_t::mte_id_t Read::REA_tagentry_idSOFACDS		              =multitag_t::newIdentifier("CDS");
-const multitag_t::mte_id_t Read::REA_tagentry_idSOFAexon		      =multitag_t::newIdentifier("exon");
-const multitag_t::mte_id_t Read::REA_tagentry_idSOFAintron		      =multitag_t::newIdentifier("intron");
-const multitag_t::mte_id_t Read::REA_tagentry_idSOFApolyA_sequence            =multitag_t::newIdentifier("polyA_sequence");
-
-const multitag_t::mte_id_t Read::REA_tagentry_idSOFAmRNA		      =multitag_t::newIdentifier("mRNA");
-const multitag_t::mte_id_t Read::REA_tagentry_idSOFAtranscript	              =multitag_t::newIdentifier("transcript");
-const multitag_t::mte_id_t Read::REA_tagentry_idSOFAprimary_transcript        =multitag_t::newIdentifier("primary_transcript");
-const multitag_t::mte_id_t Read::REA_tagentry_idSOFArRNA		      =multitag_t::newIdentifier("rRNA");
-const multitag_t::mte_id_t Read::REA_tagentry_idSOFAscRNA		      =multitag_t::newIdentifier("scRNA");
-const multitag_t::mte_id_t Read::REA_tagentry_idSOFAsnRNA		      =multitag_t::newIdentifier("snRNA");
-const multitag_t::mte_id_t Read::REA_tagentry_idSOFAtRNA                      =multitag_t::newIdentifier("tRNA");
-
-const multitag_t::mte_id_t Read::REA_tagentry_idSOFAmiraitagstore=multitag_t::newIdentifier("experimental_feature");
-
-const multitag_t Read::REA_defaulttag_SRMr("SRMr","","MIRA");
-const multitag_t Read::REA_defaulttag_CRMr("CRMr","","MIRA");
-const multitag_t Read::REA_defaulttag_WRMr("WRMr","","MIRA");
-const multitag_t Read::REA_defaulttag_SAOr("SAOr","","MIRA");
-const multitag_t Read::REA_defaulttag_SROr("SROr","","MIRA");
-const multitag_t Read::REA_defaulttag_SIOr("SIOr","","MIRA");
-
-const multitag_t Read::REA_defaulttag_ED_C("ED_C","","EdIt");
-const multitag_t Read::REA_defaulttag_ED_D("ED_D","","EdIt");
-const multitag_t Read::REA_defaulttag_ED_I("ED_I","","EdIt");
-
-const multitag_t Read::REA_defaulttag_UNSr("UNSr","","MIRA");
-const multitag_t Read::REA_defaulttag_MNRr("MNRr","","MIRA");
-
-const multitag_t Read::REA_defaulttag_PSHP("PSHP","","MIRA");
-const multitag_t Read::REA_defaulttag_CJSP("CJSP","","MIRA");
-
-const multitag_t Read::REA_defaulttag_SOFApolyA_sequence("polyA_sequence","","MIRA");
-
-
-const multitag_t::mte_co_t Read::REA_tagentry_coEmpty=multitag_t::newComment("");
-const multitag_t::mte_co_t Read::REA_tagentry_coUnknown=multitag_t::newComment("UNKNOWN??? Please contact author.");
-const multitag_t::mte_co_t Read::REA_tagentry_coSRMr=multitag_t::newComment("Strong Repeat Marker base");
-const multitag_t::mte_co_t Read::REA_tagentry_coCRMr=multitag_t::newComment("Carbon-copy Repeat Marker base");
-const multitag_t::mte_co_t Read::REA_tagentry_coWRMr=multitag_t::newComment("Weak Repeat Marker base");
-const multitag_t::mte_co_t Read::REA_tagentry_coSAOr=multitag_t::newComment("SNP intrA Organism");
-const multitag_t::mte_co_t Read::REA_tagentry_coSROr=multitag_t::newComment("SNP inteR Organism");
-const multitag_t::mte_co_t Read::REA_tagentry_coSIOr=multitag_t::newComment("SNP Intra- and inter Organism");
-const multitag_t::mte_co_t Read::REA_tagentry_coPSHP=multitag_t::newComment("Pyrosequencing Suspicious HomoPolymer");
-const multitag_t::mte_co_t Read::REA_tagentry_coUNSr=multitag_t::newComment("Unsure, read");
-
-const std::vector<multitag_t::mte_id_t> Read::REA_allhaftags={Read::REA_tagentry_idHAF0,
-							      Read::REA_tagentry_idHAF1,
-							      Read::REA_tagentry_idHAF2,
-							      Read::REA_tagentry_idHAF3,
-							      Read::REA_tagentry_idHAF4,
-							      Read::REA_tagentry_idHAF5,
-							      Read::REA_tagentry_idHAF6,
-							      Read::REA_tagentry_idHAF7};
-
-/*************************************************************************
- *
- * ReadGroupLib
- *
- *************************************************************************/
-
-vector<ReadGroupLib::rginfo_t> ReadGroupLib::RG_static_infolib;
-
-bool ReadGroupLib::RG_strainids_clean;
-int8 ReadGroupLib::RG_numstrains;
-
-#if CPP_READ_SEQTYPE_END != 8
-#error "This code is made for 8 sequencing types, adapt!"
-#endif
-
-const vector<string> ReadGroupLib::RG_namesofseqtypes = {
-  "Sanger",
-  "454",
-  "IonTor",
-  "PcBioHQ",
-  "PcBioLQ",
-  "Text",
-  "Solexa",
-  "Solid",
-  "UNDEFINED!!! SHOULD NEVER BE SEEN"
-};
-const vector<string> ReadGroupLib::RG_lcnamesofseqtypes;
-const vector<string> ReadGroupLib::RG_shortnamesofseqtypes = {
-  "san",
-  "454",
-  "ion",
-  "pbh",
-  "pbl",
-  "txt",
-  "sxa",
-  "sid",
-  "NDF!!! SHOULD NEVER BE SEEN!!!"
-};
-const vector<string> ReadGroupLib::RG_samnamesofseqtypes = {
-  "CAPILLARY",
-  "LS454",
-  "IONTORRENT",
-  "PACBIO",
-  "PACBIO",
-  "TEXT",
-  "ILLUMINA",
-  "SOLID",
-  "UNDEFINED!!! SHOULD NEVER BE SEEN"
-};
-
-const vector<string> ReadGroupLib::RG_namesofnamingschemes = {
-  "unknown",
-  "Sanger",
-  "TIGR",
-  "fr",
-  "Solexa",
-  "StLouis",
-  "SRA",
-  "none",
-  "UNDEFINED!!! SHOULD NEVER BE SEEN"
-};
-
-const vector<string> ReadGroupLib::RG_namesofsegmentplacements = {
-  "outies",
-  "innies",
-  "unknown",
-  "lefties",
-  "righties",
-  "samedir",
-  "UNDEFINED!!! SHOULD NEVER BE SEEN"
-};
-
-
-const string RG_emptystring;
-
-// keep this last!
-const bool ReadGroupLib::RG_initialisedstatics=ReadGroupLib::staticInitialiser();
-
-
-/*************************************************************************
- *
- * Parameters
- *
- *************************************************************************/
-
-string MIRAParameters::MP_currentparametersection;
-vector<string> MIRAParameters::MP_loadfilename;
-
-
-
-/*************************************************************************
- *
- * gff_parse
- *
- *************************************************************************/
-
-const string GFFParse::GFFP_emptystring;
-
-const vector<string> GFFParse::GFFP_gff3scankeys= {
-  "ID=",       // having this first second speeds up for standard GFF3 tags
-  "gff3str=",  // and this second speeds up scanning for MIRA tags (MAF V1 files)
-  "Name=",
-  "Alias=",
-  "Parent=",
-  "Note=",
-  "Target=",
-  "Dbxref=",
-  "miragff3=",
-  "miraitag=",
-  "gff3sco=",
-  "gff3pha=",
-  "gff3src="
-};
-
-std::unordered_map<std::string,boost::regex> GFFParse::GFFP_regex_extractkeys;
-
-
diff --git a/src/mira/read.C b/src/mira/read.C
index 9773d1e..25101f4 100644
--- a/src/mira/read.C
+++ b/src/mira/read.C
@@ -11,39 +11,28 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
 
-#include "mira/read.H"
-
-// for boost::trim, split
-#include <boost/algorithm/string.hpp>
+// TODO: mutable?
 
-#include "util/misc.H"
-#include "util/dptools.H"
+#ifndef lint
+static char vcid[] = "$Id$";
+#endif /* lint */
 
-#include "io/exp.H"
-#include "io/scf.H"
+#include <mira/read.H>
 
-#include "mira/readgrouplib.H"
-#include "mira/gff_parse.H"
-#include "mira/gbf_parse.H"
-
-
-using namespace std;
-
-#define CEBUG(bla)
 
 //#define PARANOIABUGTRACKFLAG
 #ifdef PARANOIABUGTRACKFLAG
@@ -55,12 +44,42 @@ using namespace std;
 
 const Read::bposhashstat_t Read::REA_bposhashstat_default;
 
+StringContainer<uint32> Read::REA_sc_readname("Read:: read name");
+
+StringContainer<uint8> Read::REA_sc_scf_pathname("Read:: scf path name");
+StringContainer<uint8> Read::REA_sc_exp_pathname("Read:: exp path name");
+
+StringContainer<uint8> Read::REA_sc_machine_type("Read:: machine type");
+StringContainer<uint8> Read::REA_sc_primer("Read:: primer");
+StringContainer<uint8> Read::REA_sc_strain("Read:: strain");
+StringContainer<uint8> Read::REA_sc_basecaller("Read:: base caller");
+StringContainer<uint8> Read::REA_sc_dye("Read:: dye");
+StringContainer<uint8> Read::REA_sc_processstatus("Read:: process status");
+
+StringContainer<uint16> Read::REA_sc_clonevec_name("Read:: clone vector name");
+StringContainer<uint16> Read::REA_sc_seqvec_name("Read:: sequencing vector name");
+
+StringContainer<uint32> Read::REA_sc_asped("asped");
+
+vector<Read::insizelib_t> Read::REA_insize_staticlib;
+
+
+
+
+
+const vector<string> Read::REA_namesofseqtypes;
+const vector<string> Read::REA_shortnamesofseqtypes;
+
 
 // initialise the filename logic
-// the read expects the name of the EXP file from which it gets
+// the read expects the name of the EXP file from which it gets 
 //  the SCF and CAF names
 
 const char Read::REA_zerostring=0;
+uint8      Read::REA_cut_givenname=0;
+string Read::REA_add_4expfn=".exp";
+string Read::REA_add_4caffn=".caf";
+string Read::REA_add_4scffn=".scf";
 
 uint8 Read::REA_outtype=AS_TEXT;
 
@@ -69,7 +88,7 @@ uint8 Read::REA_outtype=AS_TEXT;
 /*************************************************************************
  *
  * a static class variables initialised by static class initialiser
- *
+ * 
  *
  *************************************************************************/
 
@@ -78,137 +97,13 @@ vector<double> Read::REA_bqual2errorrate;
 const bool Read::REA_initialisedstatics=Read::staticInitialiser();
 
 
-/*************************************************************************
- *
- *  Given a position, a length and a replacement sequence,
- *   replaces the sequence in the read defined by pos and pos+len
- *   by the replacement sequence.
- *  Read length can change.
- *  Replaced sequence gets lowercase and quality values set to zero
- *   except the stretches and ends which match the replaced sequence.
- *
- * E.g.:    aaaaaaaatttatcgatgcaaaaaaa
- *          qqqqqqqqqqqqqqqqqqqqqqqqqq
- * Replace "atgcatgc" with "atgcttatgc" yields
- *          aaaaaaaatttatcgttatgcaaaaaaa
- *          qqqqqqqqqqqqqqq00qqqqqqqqqqq
- *
- * Bugs: simplistic uppercasing / quality replacement can lead to
- *       wrongl assigned qualities
- * E.g.:    aaaaaaaattaaaaaaa
- *          qqqqqqqqqqqqqqqqq
- * Replace "tt" with "tttt" yields
- * E.g.:    aaaaaaaattttaaaaaaa
- *          qqqqqqqqqqqqqqqqqqq
- * where the qualities of the new Ts are copied from existing Ts
- * Same for microrepeats (E.g.: "acgacg" with "acgacgacg")
- * ATM not really a big problem though.
- *
- * Has lots of side effects atm
- * - no 'complement' or 'clipped' version
- * - does not work on rle sequences
- * - all tags deleted
- * - base hashstats deleted
- *
- *************************************************************************/
-
-void Read::smoothSequenceReplace(uint32 position, uint32 len, string & replacement)
+void Read::foolCompiler()
 {
-  FUNCSTART("void Read::smoothSequenceReplace(uint32 position, uint32 len, std::string & replacement)");
-
-  BUGIFTHROW(checkRead()!=nullptr, checkRead());
-  BUGIFTHROW(REA_rlevptr!=nullptr,"Currently doesn't work on RLE");
-  BUGIFTHROW(!REA_tags.empty(),"Tags not empty, not implemented atm");
-
-  refreshPaddedSequence();
-
-  BUGIFTHROW(position>=REA_padded_sequence.size(), getName() << ": position (" << position << ") >= size of read (" << REA_padded_sequence.size() << ")?");
-
-  REA_pcs_dirty=true;
-
-  int32 lendiff=static_cast<int32>(replacement.size())-static_cast<int32>(len);
-  int32 newlen=static_cast<int32>(REA_padded_sequence.size())+lendiff;
-  vector<char> newseq;
-  vector<base_quality_t> newqual;
-  vector<int32> newadjustments;
-  newseq.reserve(newlen);
-  newqual.reserve(newlen);
-  if(!REA_adjustments.empty()) newadjustments.reserve(newlen);
-
-  // create unchanged head
-  uint32 pi=0;
-  for(; pi<position; ++pi){
-    newseq.push_back(REA_padded_sequence[pi]);
-    newqual.push_back(REA_qualities[pi]);
-    if(!REA_adjustments.empty()) newadjustments.push_back(REA_adjustments[pi]);
-  }
-
-  // append replaced mid section
-  bool copyqualsfwd=true;
-  for(char c : replacement){
-    char upc=toupper(c);
-    char upps=toupper(REA_padded_sequence[pi]);
-    if(REA_padded_sequence[pi]==upps){
-      c=upc;
-    }else{
-      c=tolower(c);
-    }
-    if(pi<REA_padded_sequence.size() && upc != upps) {
-      copyqualsfwd=false;
-    }
-    newseq.push_back(c);
-    if(copyqualsfwd){
-      newqual.push_back(REA_qualities[pi]);
-    }else{
-      newqual.push_back(0);
-    }
-    if(!REA_adjustments.empty()) newadjustments.push_back(-1);
-    ++pi;
-  }
-
-  // ok, transfer the quality values and sequence case at the back of replaced area
-  {
-    pi=position+len-1;
-    auto srI=newseq.rbegin();
-    auto qrI=newqual.rbegin();
-    for(uint32 ti=0; ti<len; ++ti, --pi, ++srI, ++qrI){
-      if(toupper(REA_padded_sequence[pi]) == toupper(*srI)){
-	*qrI=REA_qualities[pi];
-	//*srI=toupper(*srI);
-      }else{
-	break;
-      }
-    }
-  }
-
-  // append tail
-  for(pi=position+len; pi<REA_padded_sequence.size(); ++pi){
-    newseq.push_back(REA_padded_sequence[pi]);
-    newqual.push_back(REA_qualities[pi]);
-    if(!REA_adjustments.empty()) newadjustments.push_back(REA_adjustments[pi]);
-  }
-
-  REA_padded_sequence.swap(newseq);
-  REA_qualities.swap(newqual);
-  if(!newadjustments.empty()) REA_adjustments.swap(newadjustments);
-
-  if(lendiff){
-    uint32 threshold=position+len;
-    if(REA_ql>=threshold) REA_ql+=lendiff;
-    if(REA_sl>=threshold) REA_sl+=lendiff;
-    if(REA_cl>=threshold) REA_cl+=lendiff;
-    if(REA_ml>=threshold) REA_ml+=lendiff;
-    if(REA_qr>=threshold) REA_qr+=lendiff;
-    if(REA_sr>=threshold) REA_sr+=lendiff;
-    if(REA_cr>=threshold) REA_cr+=lendiff;
-    if(REA_mr>=threshold) REA_mr+=lendiff;
-  }
-
-  REA_tags.clear();
-  clearAllBPosHashStats();
+#include "stdinc/foolcompiler.C"
 }
 
 
+
 /*************************************************************************
  *
  * a static class initialiser
@@ -220,6 +115,11 @@ void Read::smoothSequenceReplace(uint32 position, uint32 len, string & replaceme
 
 bool Read::staticInitialiser()
 {
+  if(getNumSequencingTypes()>6) {
+    cerr << "Internal error: more than 6 readtypes defined in class Read!\nNeed to rework Contig::makeIntelligentConsensus()\n";
+    abort();
+  }
+
   REA_bqual2errorrate.clear();
   REA_bqual2errorrate.reserve(101);
   REA_bqual2errorrate.push_back(1);
@@ -227,10 +127,35 @@ bool Read::staticInitialiser()
     REA_bqual2errorrate.push_back(qualityToErrorRate_compute(i));
   }
 
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
+#endif
+
+  // ugly ugly ugly
+  const_cast<vector<string> *>(&REA_namesofseqtypes)->push_back("Sanger");
+  const_cast<vector<string> *>(&REA_namesofseqtypes)->push_back("454");
+  const_cast<vector<string> *>(&REA_namesofseqtypes)->push_back("IonTor");
+  const_cast<vector<string> *>(&REA_namesofseqtypes)->push_back("PacBio");
+  const_cast<vector<string> *>(&REA_namesofseqtypes)->push_back("Solexa");
+  const_cast<vector<string> *>(&REA_namesofseqtypes)->push_back("Solid");
+
+  const_cast<vector<string> *>(&REA_shortnamesofseqtypes)->push_back("san");
+  const_cast<vector<string> *>(&REA_shortnamesofseqtypes)->push_back("454");
+  const_cast<vector<string> *>(&REA_shortnamesofseqtypes)->push_back("ion");
+  const_cast<vector<string> *>(&REA_shortnamesofseqtypes)->push_back("pbs");
+  const_cast<vector<string> *>(&REA_shortnamesofseqtypes)->push_back("sxa");
+  const_cast<vector<string> *>(&REA_shortnamesofseqtypes)->push_back("sid");
+
+
+  // initialise library with insert sizes
+  REA_insize_staticlib.reserve(255);
+  REA_insize_staticlib.resize(1);
+  REA_insize_staticlib.back().insize_from=-1;
+  REA_insize_staticlib.back().insize_to=-1;
+
   return true;
 }
 
-
 /*************************************************************************
  *
  *
@@ -242,17 +167,13 @@ Read::Read()
 {
   FUNCSTART("Read::Read()");
 
-  init();
   // Hmmm, do what?
   zeroVars();
 
   FUNCEND();
 }
 
-void Read::init()
-{
-  REA_rlevptr=nullptr;
-}
+
 
 /*************************************************************************
  *
@@ -263,8 +184,11 @@ void Read::init()
 
 void Read::zeroVars()
 {
-  REA_rgid.resetLibId();
-
+  //nukeSTLContainer(REA_name);
+  nukeSTLContainer(REA_scf_filename);
+  //nukeSTLContainer(REA_exp_filename);
+  //nukeSTLContainer(REA_caf_filename);
+  
   nukeSTLContainer(REA_padded_sequence);
   nukeSTLContainer(REA_padded_complementsequence);
 
@@ -276,28 +200,29 @@ void Read::zeroVars()
   REA_has_freqavg=false;
   REA_has_freqrept=false;
 
-  REA_has_kmerfork=false;
-
   REA_scf_available=false;
   REA_scf_loadattempted=false;
 
+  REA_name_scheme_valid=false;
+
   REA_has_valid_data=false;
 
   REA_used_in_assembly=false;
+  REA_isbackbone=false;
+  REA_israil=false;
+  REA_iscoverageequivalentread=false;
 
   REA_uses_adjustments=true;
   //REA_uses_adjustments=false;
 
-  REA_template_segment=0;
+  REA_seqtype=SEQTYPE_SANGER;
+  REA_readnaming_scheme=SCHEME_SANGER;
+  REA_template_end='N';
 
   nukeSTLContainer(REA_qualities);
   nukeSTLContainer(REA_adjustments);
   nukeSTLContainer(REA_bposhashstats);
   nukeSTLContainer(REA_tags);
-  if(REA_rlevptr!=nullptr){
-    delete REA_rlevptr;
-    REA_rlevptr=nullptr;
-  }
 
   REA_ql=0;
   REA_sl=0;
@@ -313,16 +238,44 @@ void Read::zeroVars()
   //REA_rightclip=0;
   //REA_len_clipped=0;
 
+  REA_insize_libid=0;
   //REA_stadenid=-1;
   REA_templateid=-1;
   REA_templatepartnerid=-1;
+  REA_templatebuilddirection=false;
+  REA_strainid=0;
 
   nukeSTLContainer(REA_template);
+  //nukeSTLContainer(REA_clonevec_name);
+  //nukeSTLContainer(REA_seqvec_name);
+  //nukeSTLContainer(REA_strain);
+  //nukeSTLContainer(REA_basecaller);
+  //nukeSTLContainer(REA_stolen);
+  //nukeSTLContainer(REA_asped);
+  //nukeSTLContainer(REA_dye);
+  //nukeSTLContainer(REA_processstatus);
+  //nukeSTLContainer(REA_primer);
+  //nukeSTLContainer(REA_machine_type);
+  //nukeSTLContainer(REA_scf_pathname);
+  //nukeSTLContainer(REA_exp_pathname);
+  //nukeSTLContainer(REA_scf_fullpathname);
+  //nukeSTLContainer(REA_exp_fullpathname);
 
   REA_nameentry=REA_sc_readname.emptyEntry();
   REA_asped=REA_sc_asped.emptyEntry();
-
-  REA_processstatus=REA_sc_processstatus.emptyEntry();
+  REA_clonevec_name=REA_sc_clonevec_name.emptyEntry(); 
+  REA_seqvec_name=REA_sc_seqvec_name.emptyEntry();   
+		                        
+  REA_machine_type=REA_sc_machine_type.emptyEntry();  
+  REA_primer=REA_sc_primer.emptyEntry();	     
+  REA_strain=REA_sc_strain.emptyEntry();	     
+  REA_basecaller=REA_sc_basecaller.emptyEntry();    
+  REA_dye=REA_sc_dye.emptyEntry();	     
+  REA_processstatus=REA_sc_processstatus.emptyEntry(); 
+		                        
+  REA_scf_pathname=REA_sc_scf_pathname.emptyEntry();  
+  REA_exp_pathname=REA_sc_exp_pathname.emptyEntry();  
+  
 
   //REA_template_seqtry=" ";
 }
@@ -358,8 +311,7 @@ Read::~Read()
 Read::Read(Read const &other)
 {
   FUNCSTART("Read::Read(Read const &other)");
-
-  init();
+  
   zeroVars();
   *this=other;                               // call the copy operator
 
@@ -378,7 +330,16 @@ Read::Read(Read const &other)
 void Read::dumpStringContainerStats(ostream & ostr)
 {
   REA_sc_readname.status(ostr);
+  REA_sc_scf_pathname.status(ostr);
+  REA_sc_exp_pathname.status(ostr);
+  REA_sc_machine_type.status(ostr);
+  REA_sc_primer.status(ostr);
+  REA_sc_strain.status(ostr);
+  REA_sc_basecaller.status(ostr);
+  REA_sc_dye.status(ostr);
   REA_sc_processstatus.status(ostr);
+  REA_sc_clonevec_name.status(ostr);
+  REA_sc_seqvec_name.status(ostr);
   REA_sc_asped.status(ostr);
   return;
 }
@@ -393,29 +354,32 @@ void Read::dumpStringContainerStats(ostream & ostr)
  *************************************************************************/
 const char * Read::sanityCheck() const
 {
-  FUNCSTART("const char * Read::sanityCheck() const");
+  if(getName().empty()) return NULL;
 
-  // no name? no sanity check
-  if(getName().empty()) return nullptr;
+  if(REA_seqtype >= getNumSequencingTypes()) return "Undefined read type.";
 
-  BUGIFTHROW(!REA_rgid.isDefaultNonValidReadGroupID() && REA_rgid.getSequencingType() >= ReadGroupLib::getNumSequencingTypes(), getName() << ": undefined technology " << static_cast<uint16>(REA_rgid.getSequencingType()));
+  if(REA_has_valid_data==false) return "Read has no valid data?";
 
-  BUGIFTHROW(REA_has_valid_data==false, getName() << ": read has no valid data?");
-
-  BUGIFTHROW(REA_ps_dirty==true && REA_pcs_dirty==true, getName() << "REA_ps_dirty and REA_pcs_dirty both true?");
+  if(REA_ps_dirty==true && REA_pcs_dirty==true) return "REA_ps_dirty and REA_pcs_dirty both true?";
   if(REA_ps_dirty==false && REA_pcs_dirty==false){
-    BUGIFTHROW(REA_padded_sequence.size()!=REA_padded_complementsequence.size(), getName() << "Sizes of forward " << REA_padded_sequence.size() << " and complement padded " << REA_padded_complementsequence.size() << " differ.");
+    if(REA_padded_sequence.size()!=REA_padded_complementsequence.size())
+      return "Sizes of forward and complement padded differ.";
+  }
+  if(REA_ql<0) return "REA_ql<0 ?";
+  if(REA_cl<0) return "REA_cl<0 ?";
+  if(REA_sl<0) return "REA_sl<0 ?";
+  if(REA_ml<0) return "REA_ml<0 ?";
+  // do not call getLenSeq() ... recursion!
+  int32 actlen;
+  if(REA_ps_dirty==false){
+    actlen=static_cast<int32>(REA_padded_sequence.size());
+  }else{
+    actlen=static_cast<int32>(REA_padded_complementsequence.size());
   }
-  BUGIFTHROW(REA_ql<0, getName() << ": REA_ql " << REA_ql << " <0 ?");
-  BUGIFTHROW(REA_cl<0, getName() << ": REA_cl " << REA_cl << " <0 ?");
-  BUGIFTHROW(REA_sl<0, getName() << ": REA_sl " << REA_sl << " <0 ?");
-  BUGIFTHROW(REA_ml<0, getName() << ": REA_ml " << REA_ml << " <0 ?");
-
-  int32 actlen=static_cast<int32>(getLenSeq());
-  BUGIFTHROW(REA_cr>actlen+1,getName() << ": REA_cr " << REA_cr << " > actlen+1 " << actlen+1 << " ?");
-  BUGIFTHROW(REA_qr>actlen+1,getName() << ": REA_qr " << REA_qr << " > actlen+1 " << actlen+1 << " ?");
-  BUGIFTHROW(REA_sr>actlen+1,getName() << ": REA_sr " << REA_sr << " > actlen+1 " << actlen+1 << " ?");
-  BUGIFTHROW(REA_mr>actlen+1,getName() << ": REA_mr " << REA_mr << " > actlen+1 " << actlen+1 << " ?");
+  if(REA_cr>actlen+1) return "REA_cr > size() ?";
+  if(REA_qr>actlen+1) return "REA_qr > size() ?";
+  if(REA_sr>actlen+1) return "REA_sr > size() ?";
+  if(REA_mr>actlen+1) return "REA_mr > size() ?";
 
   //if(REA_leftclip != max(REA_ql, REA_sl)) return "REA_leftclip!=max(REA_ql, REA_sl) ?";
   //if(REA_rightclip != min(REA_qr, REA_sr)) return "REA_rightclip!=min(REA_qr, REA_sr) ?";
@@ -423,11 +387,25 @@ const char * Read::sanityCheck() const
   //  if(REA_rightclip-REA_leftclip>0) return "REA_len_clipped != REA_rightclip-REA_leftclip ?";
   //}
 
-  BUGIFTHROW(REA_uses_adjustments && static_cast<int32>(REA_adjustments.size()) != actlen, getName() << ": REA_adjustments " << REA_adjustments.size() << " != expected size " << actlen << " ?");
-  BUGIFTHROW(static_cast<int32>(REA_qualities.size()) != actlen, getName() << ": REA_qualities " << REA_qualities.size() << " != expected size " << actlen << " ?");
-  BUGIFTHROW(static_cast<int32>(REA_bposhashstats.size()) != actlen, getName() << ": REA_bposhashstats " << REA_bposhashstats.size() << " != " << " expected size " << actlen << " ?");
-  BUGIFTHROW(REA_rlevptr!=nullptr && static_cast<int32>(REA_rlevptr->size()) != actlen, getName() << ": REA_rlevptr->size() " << REA_rlevptr->size() << " != actlen " << actlen << " ? ");
+  if(REA_uses_adjustments
+     && static_cast<int32>(REA_adjustments.size()) != actlen) return "REA_adjustments != expected size?";
+  if(static_cast<int32>(REA_qualities.size()) != actlen) return "REA_qualities != expected size?";
+  if(static_cast<int32>(REA_bposhashstats.size()) != actlen) return "REA_bposhashstats != expected size?";
+
+  switch(REA_template_end) {
+  case 'F':
+  case 'R':
+  case 'N':{
+    break;
+  }
+  default : {
+    return "REA_template_end is not F/R/N ?";
+  }
+  }
 
+  if(REA_seqtype>=getNumSequencingTypes()){
+    return "Illegal sequencing type?";
+  }
   // TODO: configure this only when bughunting
 #if 0
   {
@@ -445,7 +423,7 @@ const char * Read::sanityCheck() const
   }
 #endif
 
-  return nullptr;
+  return NULL;
 }
 
 
@@ -459,13 +437,11 @@ const char * Read::sanityCheck() const
  *************************************************************************/
 const char * Read::checkRead() const
 {
-  //  return nullptr;
+  //  return NULL;
 
 
   if(sanityCheck()) {
     cout << "Sanity check of read '" << getName() << "' failed" << endl;
-    setCoutType(AS_TEXT);
-    cout << *this;
     return sanityCheck();
   }
 
@@ -513,11 +489,11 @@ const char * Read::checkRead() const
   }
 #endif
 
-  return nullptr;
+  return NULL;
 }
 
 
-void Read::integrityCheck() const
+void Read::integrityCheck() const 
 {
   FUNCSTART("void Read::integrityCheck() const ");
 
@@ -525,8 +501,9 @@ void Read::integrityCheck() const
     MIRANOTIFY(Notify::INTERNAL, "Read " << getName() << " has no valid data?");
   }
 
-  BUGIFTHROW(checkRead()!=nullptr, checkRead());
-
+  if(checkRead()){
+    throw Notify(Notify::INTERNAL, THISFUNC, checkRead());
+  }
   FUNCEND();
 }
 
@@ -537,7 +514,7 @@ void Read::integrityCheck() const
  *
  *
  *************************************************************************/
-void Read::reserve(uint32 lentoreserve)
+void Read::reserve(uint32 lentoreserve) 
 {
   REA_padded_sequence.reserve(lentoreserve);
   REA_padded_complementsequence.reserve(lentoreserve);
@@ -562,9 +539,6 @@ size_t Read::getWastage() const
   if(REA_adjustments.capacity()) {
     w+=4*(REA_adjustments.capacity()-REA_adjustments.size());
   }
-  if(REA_rlevptr!=nullptr){
-    w+=4*(REA_rlevptr->capacity()-REA_rlevptr->size());
-  }
   return w;
 }
 
@@ -586,10 +560,10 @@ size_t Read::capacity() const
  *
  *
  *************************************************************************/
-void Read::moderateContainerGrowth()
+void Read::moderateContainerGrowth() 
 {
-  static const size_t divval=10; // == 10%
-  static const size_t minim=5;
+  size_t divval=10; // == 10%
+  size_t minim=5;
 
   if(REA_padded_sequence.capacity()==REA_padded_sequence.size()){
     REA_padded_sequence.reserve(
@@ -625,14 +599,6 @@ void Read::moderateContainerGrowth()
       );
   }
 
-  if(REA_rlevptr!=nullptr
-     && REA_rlevptr->capacity()==REA_rlevptr->size()){
-    REA_rlevptr->reserve(
-      max(minim,
-	  REA_rlevptr->size()+REA_rlevptr->size()/divval)
-      );
-  }
-
   return;
 }
 
@@ -649,8 +615,9 @@ Read const & Read::operator=(Read const & other)
   FUNCSTART("Read const & Read::operator=(Read const & other)");
 
   if(this != &other){
+    TRACE("copying\n");
     discard();
-
+    
     REA_uses_adjustments=other.REA_uses_adjustments;
 
     //uint32 lentoreserve=0;
@@ -664,12 +631,14 @@ Read const & Read::operator=(Read const & other)
     //REA_name=        other.REA_name;
     REA_nameentry=        other.REA_nameentry;
 
+    REA_scf_filename=other.REA_scf_filename;
+
     //REA_exp_filename=other.REA_exp_filename;
     //REA_caf_filename=other.REA_caf_filename;
-
-    REA_scf_pathname=    other.REA_scf_pathname;
-    REA_exp_pathname=	   other.REA_exp_pathname;
-
+    
+    REA_scf_pathname=    other.REA_scf_pathname;	   
+    REA_exp_pathname=	   other.REA_exp_pathname;	   
+    
     REA_ps_dirty=other.REA_ps_dirty;
     if(REA_ps_dirty==false){
       REA_padded_sequence=other.REA_padded_sequence;
@@ -678,17 +647,12 @@ Read const & Read::operator=(Read const & other)
     if(REA_pcs_dirty==false){
       REA_padded_complementsequence=other.REA_padded_complementsequence;
     }
-
+      
     REA_qualities=other.REA_qualities;
 
     REA_adjustments=other.REA_adjustments;
     REA_bposhashstats=other.REA_bposhashstats;
-
-    if(other.REA_rlevptr!=nullptr){
-      REA_rlevptr= new vector<uint8>;
-      *REA_rlevptr= *(other.REA_rlevptr);
-    }
-
+      
     REA_ql=other.REA_ql;
     REA_qr=other.REA_qr;
     REA_sl=other.REA_sl;
@@ -701,31 +665,45 @@ Read const & Read::operator=(Read const & other)
     //REA_leftclip=other.REA_leftclip;
     //REA_rightclip=other.REA_rightclip;
     //REA_len_clipped=other.REA_len_clipped;
-
+      
     REA_tags=other.REA_tags;
-
+      
     REA_has_quality=other.REA_has_quality;
     REA_has_basehashstats=other.REA_has_basehashstats;
     REA_has_freqavg=other.REA_has_freqavg;
-    REA_has_freqrept=other.REA_has_freqrept;
-
-    REA_has_kmerfork=other.REA_has_kmerfork;
-
+    REA_has_freqrept=other.REA_has_freqrept
+;
     REA_scf_available=other.REA_scf_available;
     REA_scf_loadattempted=other.REA_scf_loadattempted;
-
+    REA_name_scheme_valid=other.REA_name_scheme_valid;
     REA_has_valid_data=other.REA_has_valid_data;
     REA_used_in_assembly=other.REA_used_in_assembly;
+    REA_isbackbone=other.REA_isbackbone;
+    REA_israil=other.REA_israil;
+    REA_iscoverageequivalentread=other.REA_iscoverageequivalentread;
+    REA_seqtype=other.REA_seqtype;
 
-    REA_rgid=other.REA_rgid;
+    REA_readnaming_scheme=other.REA_readnaming_scheme;
+
+    REA_insize_libid=other.REA_insize_libid;
     //REA_stadenid=other.REA_stadenid;
     REA_templateid=other.REA_templateid;
     REA_templatepartnerid=other.REA_templatepartnerid;
-    REA_template_segment=other.REA_template_segment;
+    REA_template_end=other.REA_template_end;
+    REA_templatebuilddirection=other.REA_templatebuilddirection;
+    REA_strainid=other.REA_strainid;
 
+    REA_seqvec_name=other.REA_seqvec_name;
+    REA_clonevec_name=other.REA_clonevec_name;
     REA_template=other.REA_template;
+    REA_strain=other.REA_strain;
+    REA_basecaller=other.REA_basecaller;
+    //REA_stolen=other.REA_stolen;
     REA_asped=other.REA_asped;
+    REA_dye=other.REA_dye;
     REA_processstatus=other.REA_processstatus;
+    REA_primer=other.REA_primer;
+    REA_machine_type=other.REA_machine_type;
   }
 
   FUNCEND();
@@ -748,7 +726,12 @@ size_t Read::estimateMemoryUsage() const
   size_t components=0;
 
   size_t cnum,cbytes,freecap,clba;
-
+  
+  //components+=estimateMemoryUsageOfContainer(REA_name	  ,false,cnum,cbytes,freecap,clba);
+  components+=estimateMemoryUsageOfContainer(REA_scf_filename,false,cnum,cbytes,freecap,clba);
+  //components+=estimateMemoryUsageOfContainer(REA_exp_filename,false,cnum,cbytes,freecap,clba);
+  //components+=estimateMemoryUsageOfContainer(REA_caf_filename,false,cnum,cbytes,freecap,clba);
+  
   components+=estimateMemoryUsageOfContainer(REA_padded_sequence,false,cnum,cbytes,freecap,clba);
   components+=estimateMemoryUsageOfContainer(REA_padded_complementsequence,false,cnum,cbytes,freecap,clba);
   components+=estimateMemoryUsageOfContainer(REA_qualities,false,cnum,cbytes,freecap,clba);
@@ -756,229 +739,41 @@ size_t Read::estimateMemoryUsage() const
   components+=estimateMemoryUsageOfContainer(REA_bposhashstats,false,cnum,cbytes,freecap,clba);
   components+=estimateMemoryUsageOfContainer(REA_tags,false,cnum,cbytes,freecap,clba);
 
-  if(REA_rlevptr!=nullptr){
-    components+=estimateMemoryUsageOfContainer(*REA_rlevptr,false,cnum,cbytes,freecap,clba);
-  }
-
   FUNCEND();
   return components;
 }
 
 
 
-/*************************************************************************
- *
- * only ACGT are RLEd, IUPACs and Ns are left untouched
- *
- * Big problem: the adjustment vector
- * Initial version tried to preserve the adjustments of the original reads,
- *  but the PacBio corrector routines depend on continuous adjustment values
- *  (0,1,2,3,...) to find out where during correction insertions or deletions
- *  occured.
- * As I am not sure what the original adjustments could be used for and
- *  I do not want to keep two vectors, I'm switching to continuous for
- *  the moment.
- * In case "near original" would be needed in future, would need to find
- *  other solution
- *
- *************************************************************************/
-
-void Read::rleRead()
-{
-  FUNCSTART("void Read::rleRead()");
-
-  BUGIFTHROW(REA_rlevptr!=nullptr,"Read " << getName() << " already RLEd?");
-
-  REA_rlevptr=new vector<uint8>;
-  REA_rlevptr->resize(getLenSeq());
-
-  refreshPaddedSequence();
-  REA_padded_complementsequence.clear();
-  REA_pcs_dirty=true;
-
-  uint32 rlectr=0;
-  uint32 run=0;
-  auto aI=REA_adjustments.cbegin();
-  auto qI=REA_qualities.cbegin();
-  auto sI=REA_padded_sequence.cbegin();
-  char runchar=*sI;
-  uint32 sumqual=0;
-  int32 startadj=*aI;
-  for(uint32 ri=0; ri<REA_padded_sequence.size(); ++sI, ++qI, ++aI, ++ri){
-    if(unlikely(ri==0) || (*sI==runchar && dptools::isValidACGTBase(*sI))){
-      ++run;
-      sumqual+=*qI;
-    }else{
-      REA_padded_sequence[rlectr]=runchar;
-      runchar=*sI;
-      REA_qualities[rlectr]=sumqual/run;
-      sumqual=*qI;
-      (*REA_rlevptr)[rlectr]=run;
-      run=1;
-      // REA_adjustments[rlectr]=startadj;   // "near original adjustments"
-      REA_adjustments[rlectr]=rlectr;       // continuous RLE adjustments
-      startadj=*aI;
-
-      ++rlectr;
-    }
-    if(REA_ql==ri) REA_ql=rlectr;
-    if(REA_sl==ri) REA_sl=rlectr;
-    if(REA_cl==ri) REA_cl=rlectr;
-    if(REA_ml==ri) REA_ml=rlectr;
-    if(REA_qr==ri) REA_qr=rlectr;
-    if(REA_sr==ri) REA_sr=rlectr;
-    if(REA_cr==ri) REA_cr=rlectr;
-    if(REA_mr==ri) REA_mr=rlectr;
-
-    for(auto & te : REA_tags){
-      if(te.from==ri) te.from=rlectr;
-      if(te.to==ri) te.to=rlectr;
-    }
-  }
-  REA_padded_sequence[rlectr]=runchar;
-  (*REA_rlevptr)[rlectr]=run;
-  REA_qualities[rlectr]=sumqual/run;
-  //REA_adjustments[rlectr]=startadj;
-  REA_adjustments[rlectr]=rlectr;
-
-  ++rlectr;
-  REA_padded_sequence.resize(rlectr);
-  REA_rlevptr->resize(rlectr);
-  REA_qualities.resize(rlectr);
-  REA_adjustments.resize(rlectr);
-  REA_bposhashstats.clear();
-  REA_bposhashstats.resize(rlectr);
-
-  if(REA_ql>=rlectr) REA_ql=rlectr;
-  if(REA_sl>=rlectr) REA_sl=rlectr;
-  if(REA_cl>=rlectr) REA_cl=rlectr;
-  if(REA_ml>=rlectr) REA_ml=rlectr;
-  if(REA_qr>=rlectr) REA_qr=rlectr;
-  if(REA_sr>=rlectr) REA_sr=rlectr;
-  if(REA_cr>=rlectr) REA_cr=rlectr;
-  if(REA_mr>=rlectr) REA_mr=rlectr;
-}
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-int32 drr_helper(vector<int32> & v, int32 p)
-{
-  if(v.empty() || p<0) return -1;
-  if(p>=v.size()) return v.back();
-  return v[p];
-}
-
-void Read::deRLERead()
-{
-  FUNCSTART("void Read::deRLERead()");
-
-//  if(REA_rlevptr==nullptr){
-//    setCoutType(AS_TEXT);
-//    cout << "Read " << getName() << " not RLEd?\n" << *this;
-//  }
-  BUGIFTHROW(REA_rlevptr==nullptr,"Read " << getName() << " not RLEd?");
-
-  uint32 totalbases=0;
-  for(auto rvI=REA_rlevptr->begin(); rvI!=REA_rlevptr->end(); ++rvI){
-    BUGIFTHROW(*rvI==0,"0 RLE value at pos " << rvI-REA_rlevptr->begin() << " in " << getName());
-    totalbases+=*rvI;
-  }
-
-  vector<char> newseq;
-  newseq.reserve(totalbases);
-  vector<base_quality_t> newqual;
-  newqual.reserve(totalbases);
-  vector<int32> posmap;
-  posmap.reserve(totalbases);
-
-  refreshPaddedSequence();
-  REA_pcs_dirty=true;
-  {
-    auto sI=REA_padded_sequence.begin();
-    auto qI=REA_qualities.begin();
-    for(auto rvI=REA_rlevptr->begin(); rvI!=REA_rlevptr->end(); ++rvI, ++sI, ++qI){
-      posmap.push_back(newseq.size());
-      for(uint8 rlei=0; rlei<*rvI; ++rlei){
-	newseq.push_back(*sI);
-	newqual.push_back(*qI);
-      }
-    }
-    posmap.push_back(newseq.size());
-  }
-
-  REA_bposhashstats.clear();
-  REA_bposhashstats.resize(newseq.size());
-
-  REA_ql=drr_helper(posmap,REA_ql);
-  REA_sl=drr_helper(posmap,REA_sl);
-  REA_cl=drr_helper(posmap,REA_cl);
-  REA_ml=drr_helper(posmap,REA_ml);
-  REA_qr=drr_helper(posmap,REA_qr);
-  REA_sr=drr_helper(posmap,REA_sr);
-  REA_cr=drr_helper(posmap,REA_cr);
-  REA_mr=drr_helper(posmap,REA_mr);
-
-  for(auto & te : REA_tags){
-    te.from=drr_helper(posmap,te.from);
-    te.to=drr_helper(posmap,te.to);
-  }
-
-  REA_padded_sequence.swap(newseq);
-  REA_qualities.swap(newqual);
-  REA_adjustments.clear();
-  REA_adjustments.resize(REA_padded_sequence.size());
-  for(int32 i=0; i< REA_adjustments.size(); ++i){
-    REA_adjustments[i]=i;
-  }
-
-  delete REA_rlevptr;
-  REA_rlevptr=nullptr;
-}
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
 
 void Read::setCoutType(uint8 type)
 {
-  FUNCSTART("void Read::setCoutType(uint8 type)");
   switch(type){
-  case AS_TEXT:
-  case AS_TEXTSHORT:
-  case AS_TEXTCLIPS:
-  case AS_CAF:
-  case AS_MAF:
-  case AS_ACE:
-  case AS_ACE_COMPLEMENT:
-  case AS_FASTA:
-  case AS_FASTQ:
-  case AS_GAP4DA:
-  case AS_CLIPPEDFASTA:
-  case AS_SEQVECMASKEDFASTA:
+  case AS_TEXT: 
+  case AS_TEXTSHORT: 
+  case AS_TEXTCLIPS: 
+  case AS_CAF: 
+  case AS_MAF: 
+  case AS_ACE: 
+  case AS_ACE_COMPLEMENT: 
+  case AS_FASTA: 
+  case AS_FASTQ: 
+  case AS_GAP4DA: 
+  case AS_CLIPPEDFASTA: 
+  case AS_SEQVECMASKEDFASTA: 
   case AS_MASKEDMASKFASTA:
-  case AS_FASTAQUAL:
-  case AS_CLIPPEDFASTAQUAL:
+  case AS_FASTAQUAL: 
+  case AS_CLIPPEDFASTAQUAL: 
   case AS_SEQVECMASKEDFASTAQUAL:
-  case AS_MASKEDMASKFASTAQUAL:
-  case AS_READNAME: {
+  case AS_MASKEDMASKFASTAQUAL: {
     REA_outtype=type;
     break;
   }
-  case AS_ILLEGAL:
   default:{
-    MIRANOTIFY(Notify::INTERNAL, "Wrong type " << static_cast<uint16>(type) << " is not known.");
+    throw Notify(Notify::INTERNAL, "void Read::setCoutType(uint8 type)", "Wrong type is not one of TEXT or CAF.");
   }
   }
 
-  FUNCEND();
   return;
 }
 
@@ -993,7 +788,7 @@ ostream & operator<<(ostream &ostr, Read const &read)
 {
   FUNCSTART("friend ostream & Read::operator<<(ostream &ostr, const  &read)");
 
-//  BUGSTAT(read.checkRead());
+  BUGSTAT(read.checkRead());
 
 //  if(read.REA_outtype==Read::AS_CAF){
 //    Read & nonconstread = const_cast<Read &>(read);
@@ -1105,11 +900,6 @@ ostream & operator<<(ostream &ostr, Read const &read)
     nonconstread.dumpAsACE(ostr, -1);
     break;
   }
-  case Read::AS_READNAME : {
-    Read & nonconstread = const_cast<Read &>(read);
-    nonconstread.dumpAsReadname(ostr);
-    break;
-  }
   default: {
     stopit=false;
   }
@@ -1133,23 +923,21 @@ ostream & operator<<(ostream &ostr, Read const &read)
   ostr << "\nLeftclip: " << read.getLeftClipoff() << "\tRightclip: " << read.getRightClipoff();
   ostr << "\tLen: " << read.getLenClippedSeq() << " (" << (read.getRightClipoff()-read.getLeftClipoff()) << ")\tLenSeq: " << read.getLenSeq() << '\n';
   ostr << "\nLeftextend: " << read.getLeftExtend() << "\tRightextend: " << read.getRightExtend();
-  ostr << "\nTemplate: ";
+  ostr << "\nTemplate end: " << read.REA_template_end;
+  ostr << "\tTemplate: ";
   if(!read.REA_template.empty()){
     ostr << read.REA_template;
   }
-  ostr << "\tTemplate segment: " << static_cast<uint32>(read.REA_template_segment);
-  //ostr << "\tInt. Tname: " << const_cast<Read &>(read).getInternalTemplateName();
+  ostr << "\tInt. Tname: " << const_cast<Read &>(read).getInternalTemplateName();
   ostr << "\nT-ID: " << read.REA_templateid;
   ostr << "\tTPartner-ID: " << read.REA_templatepartnerid << endl;
+  ostr << "\nStrain: " << read.REA_sc_strain.getEntry(read.REA_strain);
 
-//  ostr << "\nStrain: " << read.getStrainName();
-//  ostr << "\tS-ID: " << static_cast<int32>(read.getStrainID()) << endl;
-//  ostr << "Seqtype: " << ReadGroupLib::getShortNameOfSequencingType(read.getSequencingType()) << endl;
-//  ostr << "IsBB: " << read.isBackbone()
-//       << "\tIsRail: " << read.isRail()
-//       << "\tIsCER: " << read.isCoverageEquivalentRead() << endl;
-  ostr << "RG-Info\n" << read.REA_rgid << endl;
-  ostr << "RLE: " << (read.REA_rlevptr!=nullptr) << endl;
+  ostr << "\tS-ID: " << static_cast<int32>(read.REA_strainid) << endl;
+  ostr << "Seqtype: " << read.getShortNameOfSequencingType(read.REA_seqtype) << endl;
+  ostr << "IsBB: " << read.isBackbone()
+       << "\tIsRail: " << read.isRail()
+       << "\tIsCER: " << read.isCoverageEquivalentRead() << endl;
 
   ostr << "\nTags:\n";
   {
@@ -1159,7 +947,7 @@ ostream & operator<<(ostream &ostr, Read const &read)
   for(uint32 i=0; i < read.getNumOfTags(); i++) {
     const multitag_t & acttag=read.getTag(i);
     ostr << "Tag " << i << ":\t" << acttag.getIdentifierStr() << ' ' << acttag.from << ' ' << acttag.to;
-    ostr << " \"" << acttag.getCommentStr() << "\"\n";
+    ostr << " \"" << acttag.getCommentStr() << "\"\n";	
   }
 
   if(read.REA_outtype!=Read::AS_TEXTCLIPS
@@ -1178,8 +966,8 @@ ostream & operator<<(ostream &ostr, Read const &read)
     }else{
       ostr << "Forward padded dirty.\n";
     }
-
-
+    
+    
     if(read.REA_pcs_dirty==false){
       ostr << "\n\nRead complement size padded: " << read.REA_padded_complementsequence.size();
       ostr << "\nRead padded complement sequence:\n";
@@ -1193,7 +981,7 @@ ostream & operator<<(ostream &ostr, Read const &read)
     }else{
       ostr << "Complement padded dirty.\n";
     }
-
+    
     if(read.REA_outtype==Read::AS_TEXT) {
       ostr << "\nRead padded sequence, adjustment, quality, baseflags:\n";
       {
@@ -1202,32 +990,21 @@ ostream & operator<<(ostream &ostr, Read const &read)
 	const vector<int32> & adj=read.getAdjustments();
 	const vector<base_quality_t> & qual=read.getQualities();
 	const vector<Read::bposhashstat_t> & bhstat=read.getBPosHashStats();
-
+	
 	vector<char>::const_iterator sI=seq.begin();
 	vector<int32>::const_iterator aI=adj.begin();
 	vector<base_quality_t>::const_iterator qI=qual.begin();
 	vector<Read::bposhashstat_t>::const_iterator fI=bhstat.begin();
-
-	uint8 * rleptr=nullptr;
-	if(read.REA_rlevptr!=nullptr){
-	  rleptr=&(read.REA_rlevptr->front());
-	}
-
+	
 	uint32 actpos=0;
-	for(;sI!=read.REA_padded_sequence.end(); ++sI,++qI,++fI,++actpos,++rleptr){
+	for(;sI!=read.REA_padded_sequence.end(); sI++,qI++,fI++,actpos++){
 	  ostr << actpos << ":\t" << *sI;
-	  // RLE?
-	  if(read.REA_rlevptr!=nullptr){
-	    ostr << "(" << static_cast<uint16>(*rleptr) << ')';
-	  }
-
 	  if(!dptools::isValidStarBase(*sI)) ostr << " inv!";
-
 	  if(read.REA_uses_adjustments) {
 	    ostr << '\t' << *aI;
-	    // manually counting up aI. Not in for loop as adjustments
+	    // manually counting up aI. Not in for loop as adjustments 
 	    //  may be empty
-	    ++aI;
+	    aI++;
 	  }else{
 	    ostr << "\tNoAdj";
 	  }
@@ -1250,42 +1027,11 @@ ostream & operator<<(ostream &ostr, Read const &read)
  *
  *************************************************************************/
 
-void Read::dumpAsReadname(ostream & ostr)
-{
-  FUNCSTART("void Read::dumpAsReadname(ostream & ostr)");
-
-  if(checkRead()!=nullptr || getName().empty()){
-    // This is some kind of invalid read ... try to save something minimal
-
-    if(getName().empty()){
-      char buffer[24] ;
-      sprintf(buffer, "%x", this) ;
-
-      ostr << "readwithoutname_" << buffer << '\n';
-    }else{
-      ostr << getName() << '\n';
-    }
-
-  }else{
-    ostr << getName() << '\n';
-  }
-
-  FUNCEND();
-  return;
-}
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
 void Read::dumpAsFASTA(ostream & ostr, bool clippedonly, bool maskedseqvec, bool maskedmask)
 {
   FUNCSTART("void Read::dumpAsFASTA(ostream & ostr, bool clippedonly, bool maskedseqvec)");
 
-  if(checkRead()!=nullptr || getName().empty()){
+  if(checkRead()!=NULL || getName().empty()){
     // This is some kind of invalid read ... try to save something minimal
 
     if(getName().empty()){
@@ -1309,16 +1055,14 @@ void Read::dumpAsFASTA(ostream & ostr, bool clippedonly, bool maskedseqvec, bool
       // TODO: u.U. die ComplSeq nutzen
       refreshPaddedSequence();
       {
-	ostr << ">" << getName();
-	for(auto & ce : REA_tags){
-	  if(ce.identifier == REA_tagentry_idCOMM) {
-	    ostr << " " << ce.getCommentStr();
-	  }
-	}
-	ostr << endl;
-
-	auto I=REA_padded_sequence.cbegin();
-	auto J=REA_padded_sequence.cend();
+	ostr << ">" << getName() << endl;
+	vector<char>::const_iterator I=REA_padded_sequence.begin();
+	vector<char>::const_iterator J=REA_padded_sequence.end();
+	//if(clippedonly) {
+	//  J=I;
+	//  advance(J,getRightClipoff());
+	//  advance(I,getLeftClipoff());
+	//}
 	int32 seqcharcount=0;
 	uint32 cpl=0;
 	bool dooutput;
@@ -1344,8 +1088,8 @@ void Read::dumpAsFASTA(ostream & ostr, bool clippedonly, bool maskedseqvec, bool
 	      ostr << '\n';
 	    }
 	  }
-	  ++I;
-	  ++seqcharcount;
+	  I++;
+	  seqcharcount++;
 	}
 	if(cpl!=0) ostr << '\n';
       }
@@ -1369,7 +1113,7 @@ void Read::dumpAsFASTQ(ostream & ostr, bool clippedonly, bool maskedseqvec, bool
 {
   FUNCSTART("void Read::dumpAsFASTQ(ostream & ostr, bool clippedonly, bool maskedseqvec)");
 
-  if(checkRead()!=nullptr || getName().empty()){
+  if(checkRead()!=NULL || getName().empty()){
     // This is some kind of invalid read ... try to save something minimal
 
     if(getName().empty()){
@@ -1393,16 +1137,9 @@ void Read::dumpAsFASTQ(ostream & ostr, bool clippedonly, bool maskedseqvec, bool
       // TODO: u.U. die ComplSeq nutzen
       refreshPaddedSequence();
       {
-	ostr << "@" << getName();
-	for(auto & ce : REA_tags){
-	  if(ce.identifier == REA_tagentry_idCOMM) {
-	    ostr << " " << ce.getCommentStr();
-	  }
-	}
-	ostr << '\n';
-
-	auto I=REA_padded_sequence.cbegin();
-	auto J=REA_padded_sequence.cend();
+	ostr << "@" << getName() << '\n';
+	vector<char>::const_iterator I=REA_padded_sequence.begin();
+	vector<char>::const_iterator J=REA_padded_sequence.end();
 
 	int32 seqcharcount=0;
 	bool dooutput;
@@ -1424,14 +1161,14 @@ void Read::dumpAsFASTQ(ostream & ostr, bool clippedonly, bool maskedseqvec, bool
 	      ostr << *I;
 	    }
 	  }
-	  ++I;
-	  ++seqcharcount;
+	  I++;
+	  seqcharcount++;
 	}
       }
       {
 	ostr << "\n+\n";
-	auto I=REA_qualities.cbegin();
-	auto J=REA_qualities.cend();
+	vector<base_quality_t>::const_iterator I=REA_qualities.begin();
+	vector<base_quality_t>::const_iterator J=REA_qualities.end();
 
 	int32 seqcharcount=0;
 	bool dooutput;
@@ -1443,8 +1180,8 @@ void Read::dumpAsFASTQ(ostream & ostr, bool clippedonly, bool maskedseqvec, bool
 	  if(dooutput){
 	    ostr << static_cast<char>((*I)+33);
 	  }
-	  ++I;
-	  ++seqcharcount;
+	  I++;
+	  seqcharcount++;
 	}
       }
       ostr << '\n';
@@ -1470,7 +1207,7 @@ void Read::dumpAsFASTAQual(ostream & ostr, bool clippedonly, bool maskedseqvec,
 
   ostr << dec;
 
-  if(checkRead()!=nullptr || getName().empty()){
+  if(checkRead()!=NULL || getName().empty()){
     // This is some kind of invalid read ... try to save something minimal
 
     if(getName().empty()){
@@ -1493,8 +1230,8 @@ void Read::dumpAsFASTAQual(ostream & ostr, bool clippedonly, bool maskedseqvec,
 
       {
 	ostr << ">" << getName() << endl;
-	auto I=REA_qualities.cbegin();
-	auto J=REA_qualities.cend();
+	vector<base_quality_t>::const_iterator I=REA_qualities.begin();
+	vector<base_quality_t>::const_iterator J=REA_qualities.end();
 
 	int32 seqcharcount=0;
 	uint32 cpl=0;
@@ -1521,7 +1258,7 @@ void Read::dumpAsFASTAQual(ostream & ostr, bool clippedonly, bool maskedseqvec,
 	  seqcharcount++;
 	}
 	if(cpl!=0) ostr << '\n';
-      }
+      }      
     }
   }
 
@@ -1542,9 +1279,9 @@ void Read::dumpAsCAF(ostream & ostr)
 {
   FUNCSTART("void Read::dumpAsCAF(ostream & ostr)");
 
-  BUGIFTHROW(checkRead()!=nullptr, checkRead());
+  BUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
 
-  if(checkRead()!=nullptr || getName().empty()){
+  if(checkRead()!=NULL || getName().empty()){
     if(getName().empty()){
       char buffer[24] ;
       sprintf(buffer, "%x", this) ;
@@ -1561,9 +1298,9 @@ void Read::dumpAsCAF(ostream & ostr)
   refreshPaddedSequence();
   {
     ostr << "\nDNA : " << getName() << '\n';
-    auto I=REA_padded_sequence.cbegin();
+    vector<char>::const_iterator I=REA_padded_sequence.begin();
     uint32 cpl=0;
-    while(I!=REA_padded_sequence.cend()){
+    while(I!=REA_padded_sequence.end()){
       if(*I=='*'){
 	ostr << '-';
       }else{
@@ -1573,34 +1310,34 @@ void Read::dumpAsCAF(ostream & ostr)
 	cpl=0;
 	ostr << '\n';
       }
-      ++I;
+      I++;
     }
     ostr << '\n';
   }
 
 #ifdef PARANOIABUGTRACKFLAG
-  if(checkRead()!=nullptr){
+  if(checkRead()!=NULL){
     cout << "Ouch, failed second check." << endl;
     setCoutType(AS_TEXT);
     cout << *this;
-    MIRANOTIFY(Notify::FATAL, checkRead());
+    throw Notify(Notify::FATAL, THISFUNC, checkRead());
   }
 #endif
 
   {
     ostr << "\nBaseQuality : " << getName() << '\n';
 
-    auto I=REA_qualities.cbegin();
+    vector<base_quality_t>::const_iterator I=REA_qualities.begin();
     uint32 cpl=0;
-    while(I!=REA_qualities.cend()){
+    while(I!=REA_qualities.end()){
       ostr << static_cast<uint16>(*I);
-      if(cpl++==30){
-	ostr << '\n';
-	cpl=0;
-      }else{
-	ostr << ' ';
-      }
-      ++I;
+	if(cpl++==30){
+	  ostr << '\n';
+	  cpl=0;
+	}else{
+	  ostr << ' ';
+	}
+      I++;
     }
     ostr << "\n\n";
   }
@@ -1609,74 +1346,85 @@ void Read::dumpAsCAF(ostream & ostr)
   ostr << "Sequence : " << getName() << '\n';
   ostr << "Is_read\nPadded\n";
 
-  if(!REA_rgid.getSeqVecName().empty()){
-    ostr << "Sequencing_vector \"" << REA_rgid.getSeqVecName() << "\"" << '\n';
+  if(!REA_sc_seqvec_name.getEntry(REA_seqvec_name).empty()){
+    ostr << "Sequencing_vector \"" << REA_sc_seqvec_name.getEntry(REA_seqvec_name) << "\"" << '\n';
   }
   if(!REA_template.empty()){
     ostr << "Template \"" << REA_template <<  "\"" << '\n';
   }
-  if(REA_template_segment != 0){
-    if(REA_rgid.getSequencingType() != ReadGroupLib::SEQTYPE_SOLEXA
-       || REA_templatepartnerid!=-1){
-      if(REA_template_segment == 1) {
-	ostr << "Strand Forward\n";
-      }else if(REA_template_segment == 255) {
-	ostr << "Strand Reverse\n";
-      }
-    }
+  switch(REA_template_end){
+  case 'F' : {
+    ostr << "Strand Forward\n";
+    break;
   }
-
-  if(REA_rgid.getInsizeFrom() != -1
-     && REA_rgid.getInsizeTo() != -1){
-    ostr << "Insert_size " << REA_rgid.getInsizeFrom()
-	 << ' ' << REA_rgid.getInsizeTo() << '\n';
+  case 'R' : {
+    ostr << "Strand Reverse\n";
+    break;
   }
-  // TODO: readgroups. SCF filename?
-  //if(!REA_scf_filename.empty()){
-  //  ostr << "SCF_File \"" << REA_scf_filename <<  "\"" << '\n';
-  //}else if(getSequencingType()==ReadGroupLib::SEQTYPE_454GS20){
-  //  ostr << "SCF_File \"" << getName() <<  "\"" << '\n';
-  //}
-
-  if(!REA_rgid.getBaseCaller().empty()){
-    ostr << "Base_caller \"" << REA_rgid.getBaseCaller() <<  "\"" << '\n';
+  case 'N' : {
+    //ostr << "//template end == 'N'\n";
+    // do nothing
+    break;
+  }
+  default : {
+    throw Notify(Notify::FATAL, THISFUNC, "Illegal template end?");
+  }
+  }
+  if(REA_insize_staticlib[REA_insize_libid].insize_to!=-1 
+     && REA_insize_staticlib[REA_insize_libid].insize_from!=-1){
+    ostr << "Insert_size " << REA_insize_staticlib[REA_insize_libid].insize_from 
+	 << ' ' << REA_insize_staticlib[REA_insize_libid].insize_to << '\n';
+  }
+  if(!REA_scf_filename.empty()){
+    ostr << "SCF_File \"" << REA_scf_filename <<  "\"" << '\n';
+  }else if(REA_seqtype==SEQTYPE_454GS20){
+    ostr << "SCF_File \"" << getName() <<  "\"" << '\n';
   }
 
+  if(!REA_sc_basecaller.getEntry(REA_basecaller).empty()){
+    ostr << "Base_caller \"" << REA_sc_basecaller.getEntry(REA_basecaller) <<  "\"" << '\n';
+  }
+  //if(!REA_stolen.empty()){
+  //  ostr << "Stolen \"" << REA_stolen <<  "\"" << '\n';
+  //}
+  //if(REA_stadenid!=-1){
+  //  ostr << "Staden_id " << REA_stadenid <<  '\n';
+  //}
   if(!REA_sc_asped.getEntry(REA_asped).empty()){
     ostr << "Asped \"" << REA_sc_asped.getEntry(REA_asped) <<  "\"" << '\n';
   }
   if(!REA_sc_processstatus.getEntry(REA_processstatus).empty()){
     ostr << "ProcessStatus \"" << REA_sc_processstatus.getEntry(REA_processstatus) <<  "\"" << '\n';
   }
-  if(!REA_rgid.getDye().empty()){
-    ostr << "Dye \"" << REA_rgid.getDye() <<  "\"" << '\n';
+  if(!REA_sc_dye.getEntry(REA_dye).empty()){
+    ostr << "Dye \"" << REA_sc_dye.getEntry(REA_dye) <<  "\"" << '\n';
   }
-  if(!REA_rgid.getPrimer().empty()){
-    ostr << "Primer " << REA_rgid.getPrimer() << '\n';
+  if(!REA_sc_primer.getEntry(REA_primer).empty()){
+    ostr << "Primer " << REA_sc_primer.getEntry(REA_primer) << '\n';
   }
 
-
+  
   if(REA_sl>0){
     ostr << "Seq_vec SVEC 1 " << REA_sl;
-    if(!REA_rgid.getSeqVecName().empty()) ostr << " \"" << REA_rgid.getSeqVecName() << "\"";
+    if(!REA_sc_seqvec_name.getEntry(REA_seqvec_name).empty()) ostr << " \"" << REA_sc_seqvec_name.getEntry(REA_seqvec_name) << "\"";
     ostr << '\n';;
   }
   if(REA_sr < static_cast<int32>(getLenSeq())){
     ostr << "Seq_vec SVEC "<< REA_sr+1 <<' ' << getLenSeq();
-    if(!REA_rgid.getSeqVecName().empty()) ostr << " \"" << REA_rgid.getSeqVecName() << "\"";
+    if(!REA_sc_seqvec_name.getEntry(REA_seqvec_name).empty()) ostr << " \"" << REA_sc_seqvec_name.getEntry(REA_seqvec_name) << "\"";
     ostr << '\n';
   }
-
+  
   ostr << "Clipping QUAL " << REA_ql+1 << ' ' << REA_qr << '\n'; //<<"NameOfSeq\n";
-
+  
   if(REA_cl>0){
     ostr << "Clone_vec CVEC 1 " << REA_cl;
-    if(!REA_rgid.getCloneVecName().empty()) ostr << " \"" << REA_rgid.getCloneVecName() <<  "\"";
+    if(!REA_sc_clonevec_name.getEntry(REA_clonevec_name).empty()) ostr << " \"" << REA_sc_clonevec_name.getEntry(REA_clonevec_name) <<  "\"";
     ostr << '\n';
   }
   if(REA_cr < static_cast<int32>(getLenSeq())){
     ostr << "Clone_vec CVEC "<< REA_cr+1 <<' ' << getLenSeq();
-    if(!REA_rgid.getCloneVecName().empty()) ostr << " \"" << REA_rgid.getCloneVecName() <<  "\"";
+    if(!REA_sc_clonevec_name.getEntry(REA_clonevec_name).empty()) ostr << " \"" << REA_sc_clonevec_name.getEntry(REA_clonevec_name) <<  "\"";
     ostr << '\n';
   }
 
@@ -1706,66 +1454,68 @@ void Read::dumpAsCAF(ostream & ostr)
     ostr << "Align_to_SCF " << 1 << ' ' << getLenSeq() << ' ' << 1 << ' ' << getLenSeq() << '\n';
   }
 
-  // Tags
-  for(auto & rte : REA_tags) rte.dumpAsCAF(ostr);
 
-#if CPP_READ_SEQTYPE_END != 8
-#error "This code is made for 8 sequencing types, adapt!"
-#endif
-  // Store read type and strain name in a special tag
-  {
-    ostr << "Tag MIT2 1 1 \"st=";
-    switch(getSequencingType()) {
-    case ReadGroupLib::SEQTYPE_SANGER :
-    case ReadGroupLib::SEQTYPE_454GS20 :
-    case ReadGroupLib::SEQTYPE_IONTORRENT :
-    case ReadGroupLib::SEQTYPE_PACBIOLQ :
-    case ReadGroupLib::SEQTYPE_PACBIOHQ :
-    case ReadGroupLib::SEQTYPE_TEXT :
-    case ReadGroupLib::SEQTYPE_SOLEXA : {
-      ostr << REA_rgid.getNameOfSequencingType();
-      break;
-    }
-    case ReadGroupLib::SEQTYPE_ABISOLID : {
-      MIRANOTIFY(Notify::INTERNAL, "Type ABI SOLiD needs more support 7.");
-      break;
+  if(!REA_tags.empty()){
+    vector<multitag_t>::const_iterator I=REA_tags.begin();
+    while(I!=REA_tags.end()){
+      if(I->strand=='-') {
+	ostr << "Tag " << I->getIdentifierStr() << ' ' << (I->to)+1 << ' ' << (I->from)+1 << " \"" ;
+      }else{
+	ostr << "Tag " << I->getIdentifierStr() << ' ' << (I->from)+1 << ' ' << (I->to)+1 << " \"" ;
+      }
+      
+      // cannot use serialiseComment() here because Quotes are bad
+      // in CAFs
+      const string & tmpcs=I->getCommentStr();
+      for(uint32 i=0; i< tmpcs.size(); i++){
+	if(tmpcs[i]!='\n'){
+	  if(tmpcs[i]!='\"') ostr << tmpcs[i];
+	}else{
+	  ostr << " :: ";
+	}
+      }
+      ostr << "\"\n";
+      I++;
+    }
+  }
+  
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
+#endif
+  // Store read type and strain name in a special tag
+  {
+    ostr << "Tag MINF 1 1 \"ST=";
+    switch(REA_seqtype) {
+    case SEQTYPE_SANGER : 
+    case SEQTYPE_454GS20 : 
+    case SEQTYPE_IONTORRENT : 
+    case SEQTYPE_PACBIO : 
+    case SEQTYPE_SOLEXA : {
+      ostr << getNameOfSequencingType(REA_seqtype);
+      break;
+    }
+    case SEQTYPE_ABISOLID : {
+      throw Notify(Notify::INTERNAL, THISFUNC, "Type ABI SOLiD needs more support 7.");
+      break;
     }
     default : {
-      cerr << "For read " << getName() << ": unknown seqtype code " << static_cast<uint16>(getSequencingType()) << " ?\n";
-      cerr << "Allowed are: Sanger, 454, IonTor, PacBioLQ, PacBioHQ, Text, Solexa, SOLiD.\n";
-      MIRANOTIFY(Notify::FATAL, "Illegal readtype?");
+      cerr << "For read " << getName() << ": unknown seqtype code " << static_cast<uint16>(REA_seqtype) << " ?\n";
+      cerr << "Allowed are: Sanger, 454, IonTor, PacBio, Solexa, SOLiD.\n";
+      throw Notify(Notify::FATAL, THISFUNC, "Illegal readtype?");
     }
     }
     //if(REA_strainid > 0){
-    if(!REA_rgid.getStrainName().empty()){
-      ostr << ";sn=" << REA_rgid.getStrainName();
+    if(!REA_sc_strain.getEntry(REA_strain).empty()){
+      ostr << " :: SN=" << REA_sc_strain.getEntry(REA_strain);
     }
-    if(!REA_rgid.getMachineType().empty()){
-      ostr << ";mt=" << REA_rgid.getMachineType();
+    if(!REA_sc_machine_type.getEntry(REA_machine_type).empty()){
+      ostr << " :: MT=" << REA_sc_machine_type.getEntry(REA_machine_type);
     }
     if(isBackbone()){
-      ostr << ";bb=1";
-    }
-    if(isRail()){
-      ostr << ";rr=1";
+      ostr << " :: BB=1";
     }
     if(isCoverageEquivalentRead()){
-      ostr << ";cer=1";
-    }
-    if(REA_rgid.getSegmentPlacementCode()!=ReadGroupLib::SPLACE_UNKNOWN){
-      if(REA_rgid.getSegmentPlacementCode()==ReadGroupLib::SPLACE_SF){
-	ostr << ";pc=sf";
-      }else if(REA_rgid.getSegmentPlacementCode()==ReadGroupLib::SPLACE_SB){
-	ostr << ";pc=sb";
-      }else if(REA_rgid.getSegmentPlacementCode()==ReadGroupLib::SPLACE_SU){
-	ostr << ";pc=su";
-      }else if(REA_rgid.getSegmentPlacementCode()==ReadGroupLib::SPLACE_FR){
-	ostr << ";pc=fr";
-      }else if(REA_rgid.getSegmentPlacementCode()==ReadGroupLib::SPLACE_RF){
-	ostr << ";pc=rf";
-      }else{
-	BUGIFTHROW(true,"Oooops? Illegal teplate placement code " << static_cast<int32>(REA_rgid.getSegmentPlacementCode()) << " in read " << getName());
-      }
+      ostr << " :: CER=1";
     }
     ostr << "\"\n";
   }
@@ -1788,13 +1538,13 @@ void Read::dumpAsBAF(ostream & ostr)
 {
   FUNCSTART("void Read::dumpAsBAF(ostream & ostr)");
 
-  BUGIFTHROW(checkRead()!=nullptr, checkRead());
+  BUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
 
-  if(checkRead()!=nullptr){
+  if(checkRead()!=NULL){
     cout << "Ouch, failed first check." << endl;
     setCoutType(AS_TEXT);
     cout << *this;
-    MIRANOTIFY(Notify::FATAL, checkRead());
+    throw Notify(Notify::FATAL, THISFUNC, checkRead());
   }
 
   /*
@@ -1815,7 +1565,7 @@ void Read::dumpAsBAF(ostream & ostr)
     - RD/CO in annotations: bad, consensus annotations? AT= (attach to)
     - direction of annotation
     - multiline annotations in TX?
-
+    
     Perhaps include???
     optional: LN= (for preassigned sizes)
 
@@ -1837,11 +1587,11 @@ void Read::dumpAsBAF(ostream & ostr)
   }
 
 #ifdef PARANOIABUGTRACKFLAG
-  if(checkRead()!=nullptr){
+  if(checkRead()!=NULL){
     cout << "Ouch, failed second check." << endl;
     setCoutType(AS_TEXT);
     cout << *this;
-    MIRANOTIFY(Notify::FATAL, checkRead());
+    throw Notify(Notify::FATAL, THISFUNC, checkRead());
   }
 #endif
 
@@ -1852,12 +1602,11 @@ void Read::dumpAsBAF(ostream & ostr)
   }
   ostr << '\n';
 
-  // TODO: readgroups. SCF filename?
-  //if(!REA_scf_filename.empty()){
-  //  ostr << "TR=" << REA_scf_filename << '\n';
-  //}else if(getSequencingType()==ReadGroupLib::SEQTYPE_454GS20){
-  //  ostr << "TR=" << getName() << '\n';
-  //}
+  if(!REA_scf_filename.empty()){
+    ostr << "TR=" << REA_scf_filename << '\n';
+  }else if(REA_seqtype==SEQTYPE_454GS20){
+    ostr << "TR=" << getName() << '\n';
+  }
 
   // for the time being, we can't use REA_ql an qr as MIRA
   //  has other clips that may meddle
@@ -1875,7 +1624,7 @@ void Read::dumpAsBAF(ostream & ostr)
       ostr << "AN=" << I->getIdentifierStr()
 	   << "\nLO=" << (I->from)+1;
       if((I->to)-(I->from) > 0) ostr << "\nLL=" << (I->to)-(I->from)+1 << "\n" ;
-      if(I->getStrandDirection()==-1) {
+      if(I->strand=='-') {
 	ostr << "DR=-1\n";
       }
 
@@ -1894,49 +1643,44 @@ void Read::dumpAsBAF(ostream & ostr)
       }
     }
   }
-
-#if CPP_READ_SEQTYPE_END != 8
-#error "This code is made for 8 sequencing types, adapt!"
+  
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
 #endif
   // Store read type and strain name in a special tag
   {
-    ostr << "AN=MIT2\nTX=st=";
-    switch(getSequencingType()) {
-    case ReadGroupLib::SEQTYPE_SANGER :
-    case ReadGroupLib::SEQTYPE_454GS20 :
-    case ReadGroupLib::SEQTYPE_IONTORRENT :
-    case ReadGroupLib::SEQTYPE_PACBIOHQ :
-    case ReadGroupLib::SEQTYPE_PACBIOLQ :
-    case ReadGroupLib::SEQTYPE_TEXT :
-    case ReadGroupLib::SEQTYPE_SOLEXA : {
-      ostr << REA_rgid.getNameOfSequencingType() << '\n';
+    ostr << "AN=MINF\nTX=ST=";
+    switch(REA_seqtype) {
+    case SEQTYPE_SANGER :
+    case SEQTYPE_454GS20 :
+    case SEQTYPE_IONTORRENT :
+    case SEQTYPE_PACBIO :
+    case SEQTYPE_SOLEXA : {
+      ostr << getNameOfSequencingType(REA_seqtype) << '\n';
       break;
     }
-    case ReadGroupLib::SEQTYPE_ABISOLID : {
-      MIRANOTIFY(Notify::INTERNAL, "Type ABI SOLiD needs more support 7.");
+    case SEQTYPE_ABISOLID : {
+      throw Notify(Notify::INTERNAL, THISFUNC, "Type ABI SOLiD needs more support 7.");
       break;
     }
     default : {
-      cerr << "For read " << getName() << ": unknown readtype code " << static_cast<uint16>(getSequencingType()) << " ?\n";
-      cerr << "Allowed are: Sanger, 454, IonTor, Solexa, PacBioLQ, PacBioHQ, Text, SOLiD.\n";
-      MIRANOTIFY(Notify::FATAL, "Illegal readtype?");
+      cerr << "For read " << getName() << ": unknown readtype code " << static_cast<uint16>(REA_seqtype) << " ?\n";
+      cerr << "Allowed are: Sanger, 454, IonTor, Solexa, PacBio, SOLiD.\n";
+      throw Notify(Notify::FATAL, THISFUNC, "Illegal readtype?");
     }
     }
     //if(REA_strainid > 0){
-    if(!REA_rgid.getStrainName().empty()){
-      ostr << ";sn=" << REA_rgid.getStrainName();
+    if(!REA_sc_strain.getEntry(REA_strain).empty()){
+      ostr << " :: SN=" << REA_sc_strain.getEntry(REA_strain);
     }
-    if(!REA_rgid.getMachineType().empty()){
-      ostr << ";mt=" << REA_rgid.getMachineType();
+    if(!REA_sc_machine_type.getEntry(REA_machine_type).empty()){
+      ostr << " :: MT=" << REA_sc_machine_type.getEntry(REA_machine_type);
     }
     if(isBackbone()){
-      ostr << ";bb=1";
-    }
-    if(isRail()){
-      ostr << ";rr=1";
+      ostr << " :: BB=1";
     }
     if(isCoverageEquivalentRead()){
-      ostr << ";cer=1";
+      ostr << " :: CER=1";
     }
     ostr << "\n";
   }
@@ -1960,7 +1704,9 @@ void Read::dumpAsMAF(ostream & ostr)
 {
   FUNCSTART("void Read::dumpAsMAF(ostream & ostr)");
 
-  if(checkRead()!=nullptr || getName().empty()){
+  //BUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
+
+  if(checkRead()!=NULL || getName().empty()){
     // This is some kind of invalid read ... try to save something minimal
 
     if(getName().empty()){
@@ -1980,15 +1726,18 @@ void Read::dumpAsMAF(ostream & ostr)
   refreshPaddedSequence();
 
   // RD = Read name
-  // RG = Read Group ID
   // LR = Read length (length of unclipped sequence) (optional, only written on len >=2000)
   // RS = sequence (in one line, gaps as '*')
   // RQ = base quality (in one line, FASTQ-33 format)
   // SV = sequencing vector (name)
   // TN = template (name)
-  // TS = template segment
+  // DI = direction (strand; 'F' or 'R' for forward/reverse)
+
+  // TF = template size from (integer>=0 or -1 for "don't care")
+  // TT = template size to (integer>=0 or -1 for "don't care")
 
   // SF = Sequencing File (file name with raw data like SCF file etc.pp)
+  // BC = basecaller (name)
 
   // SL, SR = sequencing vector left / right cutoffs
   // QL, QR = quality left / right cutoffs
@@ -1998,40 +1747,75 @@ void Read::dumpAsMAF(ostream & ostr)
 
   // RT = Read Tag (identifier from to comment).
 
+  // ST = sequencing type (Sanger, 454, PacBio, Solexa, SOLiD)
+  // SN = strain name
+  // MT = machine name
+
+  // IB = is backbone (0 or 1)
+  // IR = is rail (0 or 1)
+  // IC = is Coverage Equivalent Read (0 or 1)
+
   // ER = End Read (marker for MAF parsing, mandatory)
   {
     ostr << "RD\t" << getName() << '\n';
-    ostr << "RG\t" << getReadGroupID().getLibId() << '\n';
-
     if(getLenSeq()>=2000) ostr << "LR\t" << getLenSeq() << '\n';
     ostr << "RS\t";
-    for(auto & cv : REA_padded_sequence) ostr << cv;
+    vector<char>::const_iterator I=REA_padded_sequence.begin();
+    for(;I!=REA_padded_sequence.end(); I++) ostr << *I;
     ostr << '\n';
   }
 
 #ifdef PARANOIABUGTRACKFLAG
-  if(checkRead()!=nullptr){
+  if(checkRead()!=NULL){
     cout << "Ouch, failed second check." << endl;
     setCoutType(AS_TEXT);
     cout << *this;
-    MIRANOTIFY(Notify::FATAL, checkRead());
+    throw Notify(Notify::FATAL, THISFUNC, checkRead());
   }
 #endif
 
   {
     ostr << "RQ\t";
-    for(auto & qv: REA_qualities) ostr << static_cast<char>(qv+33);
+    vector<base_quality_t>::const_iterator I=REA_qualities.begin();
+    for(;I!=REA_qualities.end();++I) ostr << static_cast<char>((*I)+33);
     ostr << '\n';
   }
 
-  if(!REA_rgid.getSeqVecName().empty()){
-    ostr << "SV\t" << REA_rgid.getSeqVecName() << '\n';
+  if(!REA_sc_seqvec_name.getEntry(REA_seqvec_name).empty()){
+    ostr << "SV\t" << REA_sc_seqvec_name.getEntry(REA_seqvec_name) << '\n';
   }
   if(!REA_template.empty()){
     ostr << "TN\t" << REA_template << '\n';
   }
-  if(REA_template_segment != 0){
-    ostr << "TS\t" << static_cast<uint32>(REA_template_segment) << '\n';
+  switch(REA_template_end){
+  case 'F' : {
+    ostr << "DI\tF\n";
+    break;
+  }
+  case 'R' : {
+    ostr << "DI\tR\n";
+    break;
+  }
+  case 'N' : {
+    //ostr << "//template end == 'N'\n";
+    // do nothing
+    break;
+  }
+  default : {
+    throw Notify(Notify::FATAL, THISFUNC, "Illegal template end?");
+  }
+  }
+  if(REA_insize_staticlib[REA_insize_libid].insize_to!=-1 
+     && REA_insize_staticlib[REA_insize_libid].insize_from!=-1){
+    ostr << "TF\t" << REA_insize_staticlib[REA_insize_libid].insize_from 
+	 << "\nTT\t" << REA_insize_staticlib[REA_insize_libid].insize_to << '\n';
+  }
+  if(!REA_scf_filename.empty()){
+    ostr << "SF\t" << REA_scf_filename << '\n';
+  }
+
+  if(!REA_sc_basecaller.getEntry(REA_basecaller).empty()){
+    ostr << "BC\t" << REA_sc_basecaller.getEntry(REA_basecaller) << '\n';
   }
 
   if(REA_sl>0){
@@ -2040,7 +1824,7 @@ void Read::dumpAsMAF(ostream & ostr)
   if(REA_sr < static_cast<int32>(getLenSeq())){
     ostr << "SR\t"<< REA_sr  << '\n';
   }
-
+  
   if(REA_ql>0){
     ostr << "QL\t" << REA_ql+1 << '\n';
   }
@@ -2054,33 +1838,94 @@ void Read::dumpAsMAF(ostream & ostr)
   if(REA_cr < static_cast<int32>(getLenSeq())){
     ostr << "CR\t"<< REA_cr  << '\n';
   }
-
+  
   if(REA_uses_adjustments){
     uint32 i;
     uint32 imin=0;
-    bool wroteAO=false;
     for(i=1; i< getLenSeq(); i++){
       if(REA_adjustments[i-1]!=-1){
 	if(REA_adjustments[i]!=REA_adjustments[i-1]+1){
-	  ostr << "AO\t" << imin+1 << '\t' << i << '\t' << REA_adjustments[imin]+1 << '\t' << REA_adjustments[i-1]+1 << '\n';
-	  wroteAO=true;
+	  ostr << "AO\t" << imin+1 << ' ' << i << ' ' << REA_adjustments[imin]+1 << ' ' << REA_adjustments[i-1]+1 << '\n';
 	  imin=i;
 	}
       }else{
 	imin=i;
       }
     }
-    // we're at the end of the sequence
-    // if we previously wrote an AO line, there were edits and we need to write the last
-    //  AO range too
-    // but if AO was not written until now, do not write any
-    if(REA_adjustments[i-1]!=-1
-       && wroteAO){
-      ostr << "AO\t" << imin+1 << '\t' << i << '\t' << REA_adjustments[imin]+1 << '\t' << REA_adjustments[i-1]+1 << '\n';
+    if(REA_adjustments[i-1]!=-1){
+      ostr << "AO\t" << imin+1 << ' ' << i << ' ' << REA_adjustments[imin]+1 << ' ' << REA_adjustments[i-1]+1 << '\n';
     }
+  }else{
+    ostr << "AO\t" << 1 << ' ' << getLenSeq() << ' ' << 1 << ' ' << getLenSeq() << '\n';
   }
 
-  for(auto & rt : REA_tags) rt.dumpAsMAF(ostr,"RT");
+
+  if(!REA_tags.empty()){
+    vector<multitag_t>::const_iterator I=REA_tags.begin();
+    while(I!=REA_tags.end()){
+      if(I->strand=='-') {
+	ostr << "RT\t" << I->getIdentifierStr() << ' ' << (I->to)+1 << ' ' << (I->from)+1 << " " ;
+      }else{
+	ostr << "RT\t" << I->getIdentifierStr() << ' ' << (I->from)+1 << ' ' << (I->to)+1 << " " ;
+      }
+
+      const string & tmpcs=I->getCommentStr();
+      for(uint32 i=0; i< tmpcs.size(); i++){
+	if(tmpcs[i]=='\n'){
+	  ostr << "\\n";
+	}else if(tmpcs[i]=='\\'){
+	  ostr << "\\\\";
+	}else{
+	  ostr << tmpcs[i];
+	}
+      }
+      ostr << '\n';
+      I++;
+    }
+  }
+  
+  // Store read type and strain name in a special tag
+  {
+    ostr << "ST\t";
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
+#endif
+    switch(REA_seqtype) {
+    case SEQTYPE_SANGER :
+    case SEQTYPE_454GS20 : 
+    case SEQTYPE_IONTORRENT : 
+    case SEQTYPE_PACBIO :
+    case SEQTYPE_SOLEXA : {
+      ostr << getNameOfSequencingType(REA_seqtype) << '\n';
+      break;
+    }
+    case SEQTYPE_ABISOLID : {
+      throw Notify(Notify::INTERNAL, THISFUNC, "Type ABI SOLiD needs more support 7.");
+      break;
+    }
+    default : {
+      cerr << "For read " << getName() << ": unknown readtype code " << static_cast<uint16>(REA_seqtype) << " ?\n";
+      cerr << "Allowed are: Sanger, 454, IonTor, Solexa, PacBio, SOLiD.\n";
+      throw Notify(Notify::FATAL, THISFUNC, "Illegal readtype?");
+    }
+    }
+    //if(REA_strainid > 0){
+    if(!REA_sc_strain.getEntry(REA_strain).empty()){
+      ostr << "SN\t" << REA_sc_strain.getEntry(REA_strain) << '\n';
+    }
+    if(!REA_sc_machine_type.getEntry(REA_machine_type).empty()){
+      ostr << "MT\t" << REA_sc_machine_type.getEntry(REA_machine_type) << '\n';
+    }
+    if(isBackbone()){
+      ostr << "IB\t1\n";
+    }
+    if(isRail()){
+      ostr << "IR\t1\n";
+    }
+    if(isCoverageEquivalentRead()){
+      ostr << "IC\t1\n";
+    }
+  }
 
   ostr << "ER\n";
 
@@ -2099,11 +1944,13 @@ void Read::dumpAsACE(ostream & ostr, int32 direction)
 {
   FUNCSTART("void Read::dumpAsACE(ostream & ostr, int32 direction)");
 
-  if(checkRead()!=nullptr){
+  BUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
+
+  if(checkRead()!=NULL){
     cout << "Ouch, failed first check." << endl;
     setCoutType(AS_TEXT);
     cout << *this;
-    MIRANOTIFY(Notify::FATAL, checkRead());
+    throw Notify(Notify::FATAL, THISFUNC, checkRead());
   }
 
   {
@@ -2133,11 +1980,11 @@ void Read::dumpAsACE(ostream & ostr, int32 direction)
     ostr << '\n';
   }
 
-  if(checkRead()!=nullptr){
+  if(checkRead()!=NULL){
     cout << "Ouch, failed second check." << endl;
     setCoutType(AS_TEXT);
     cout << *this;
-    MIRANOTIFY(Notify::FATAL, checkRead());
+    throw Notify(Notify::FATAL, THISFUNC, checkRead());
   }
 
   // ACE has no base qualities *sigh*
@@ -2154,10 +2001,9 @@ void Read::dumpAsACE(ostream & ostr, int32 direction)
   if(!REA_template.empty()){
     ostr << "TEMPLATE: " << REA_template << ' ';
   }
-  // TODO: readgroups. SCF filename?
-  //if(!REA_scf_filename.empty()){
-  //  ostr << "SCF_FILE: " << REA_scf_filename <<  ' ' ;
-  //}
+  if(!REA_scf_filename.empty()){
+    ostr << "SCF_FILE: " << REA_scf_filename <<  ' ' ;
+  }
   ostr << "CHROMAT_FILE: " << getName() << ' ';
   ostr << "PHD_FILE: " << getName() << ".phd.1 ";
   ostr << "TIME: Sat Jan  1 11:11:11 MEST 2000";
@@ -2174,14 +2020,14 @@ void Read::dumpAsACE(ostream & ostr, int32 direction)
     string serialc;
     while(I!=REA_tags.end()){
       ostr << "RT{\n" << getName() << ' ' << I->getIdentifierStr();
-      if(I->getStrandDirection()==-1){
+      if(I->strand=='-'){
 	ostr << " MIRA " << (I->to)+1 << ' ' << (I->from)+1;
       } else{
 	ostr << " MIRA " << (I->from)+1 << ' ' << (I->to)+1;
       }
       // TODO: make it a real date
       ostr << " 020202:121212\n";
-
+      
       const string & tmpcs=I->getCommentStr();
       if(!tmpcs.empty()){
 	I->serialiseComment(serialc);
@@ -2210,11 +2056,13 @@ void Read::dumpAsGAP4DA(ostream & ostr, string & APline, bool outputTags)
 {
   FUNCSTART("void Read::dumpAsGAP4DA(ostream & ostr, string & APline, bool outputTags)");
 
-  if(checkRead()!=nullptr){
+  BUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
+
+  if(checkRead()!=NULL){
     cout << "Ouch, failed first check." << endl;
     setCoutType(AS_TEXT);
     cout << *this;
-    MIRANOTIFY(Notify::FATAL, checkRead());
+    throw Notify(Notify::FATAL, THISFUNC, checkRead());
   }
 
   ostr << "ID   " << getName() << endl;
@@ -2232,34 +2080,33 @@ void Read::dumpAsGAP4DA(ostream & ostr, string & APline, bool outputTags)
   if(REA_sr<static_cast<int32>(REA_qualities.size())) {
     ostr << "SR   " << REA_sr+1 << endl;
   }
-  if(!REA_rgid.getSeqVecName().empty()){
-    ostr << "SV   " << REA_rgid.getSeqVecName() << endl;
+  if(!REA_sc_seqvec_name.getEntry(REA_seqvec_name).empty()){
+    ostr << "SV   " << REA_sc_seqvec_name.getEntry(REA_seqvec_name) << endl;
   }
-  if(!REA_rgid.getCloneVecName().empty()){
-    ostr << "CV   " << REA_rgid.getCloneVecName() << endl;
+  if(!REA_sc_clonevec_name.getEntry(REA_clonevec_name).empty()){
+    ostr << "CV   " << REA_sc_clonevec_name.getEntry(REA_clonevec_name) << endl;
   }
 
   if(!REA_template.empty()){
     ostr << "TN   " << REA_template << endl;
   }
-  if(REA_rgid.getInsizeFrom() != -1
-     && REA_rgid.getInsizeTo() != -1){
-    ostr << "SI   " << REA_rgid.getInsizeFrom()
-	 << ".." << REA_rgid.getInsizeTo() << endl;
+  if(REA_insize_staticlib[REA_insize_libid].insize_to!=-1 
+     && REA_insize_staticlib[REA_insize_libid].insize_from!=-1){
+    ostr << "SI   " << REA_insize_staticlib[REA_insize_libid].insize_from 
+	 << ".." << REA_insize_staticlib[REA_insize_libid].insize_to << endl;
   }
-  // TODO: readgroups. SCF filename?
-  //if(!REA_scf_filename.empty()){
-  //  ostr << "LN   " << REA_scf_filename;
-  //  ostr << "\nLT   SCF" << endl;
-  //}
-  if(!REA_rgid.getBaseCaller().empty()){
-    ostr << "BC   " << REA_rgid.getBaseCaller() << endl;
+  if(!REA_scf_filename.empty()){
+    ostr << "LN   " << REA_scf_filename;
+    ostr << "\nLT   SCF" << endl;
+  }
+  if(!REA_sc_basecaller.getEntry(REA_basecaller).empty()){
+    ostr << "BC   " << REA_sc_basecaller.getEntry(REA_basecaller) << endl;
   }
   if(!REA_sc_processstatus.getEntry(REA_processstatus).empty()){
     ostr << "PS   " << REA_sc_processstatus.getEntry(REA_processstatus) << endl;
   }
-  if(!REA_rgid.getPrimer().empty()){
-    ostr << "PN   " << REA_rgid.getPrimer() << endl;
+  if(!REA_sc_primer.getEntry(REA_primer).empty()){
+    ostr << "PN   " << REA_sc_primer.getEntry(REA_primer) << endl;
   }
 
   // ON
@@ -2272,8 +2119,8 @@ void Read::dumpAsGAP4DA(ostream & ostr, string & APline, bool outputTags)
     int32 rmin=-1;
 
     // James said there is a line limit for EXP
-    //  so I need this to make an output of at most
-    //  "8" (may be a few more) values per line
+    //  so I need this to make an output of at most 
+    //  "8" (may be a few more) values per line 
     bool mustwriteON=false;
     uint32 valuesinline=0;
     uint32 maxvaluesinline=8;
@@ -2370,7 +2217,7 @@ void Read::dumpAsGAP4DA(ostream & ostr, string & APline, bool outputTags)
     vector<multitag_t>::const_iterator I=REA_tags.begin();
     while(I!=REA_tags.end()){
       ostr << "TG   " << I->getIdentifierStr();
-      ostr << ' ' << I->getStrand() << ' ' << (I->from)+1 << ".." << (I->to)+1;
+      ostr << ' ' << I->strand << ' ' << (I->from)+1 << ".." << (I->to)+1;
       const char * cs=I->getCommentStr().c_str();
       if (*cs!=0) ostr << "\nTG        ";
       while(*cs) {
@@ -2387,45 +2234,6 @@ void Read::dumpAsGAP4DA(ostream & ostr, string & APline, bool outputTags)
   return;
 }
 
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-void Read::dumpTagsAsGFF3(ostream & ostr)
-{
-  FUNCSTART("void Read::dumpTagsAsGFF3(ostream & ostr)");
-
-  BUGIFTHROW(checkRead()!=nullptr, checkRead());
-
-  vector<multitag_t>::const_iterator tI=REA_tags.begin();
-  for(; tI< REA_tags.end(); ++tI){
-    tI->dumpAsGFF3(ostr,getName());
-  }
-
-  // create MIT2 info for that sequence
-  ostr << getName() << "\tMIRA\texperimental_feature\t1\t1\t.\t.\t.\tst=" << REA_rgid.getNameOfSequencingType();
-  if(!REA_rgid.getStrainName().empty()){
-    ostr << ";sn=" << REA_rgid.getStrainName();
-  }
-  if(!REA_rgid.getMachineType().empty()){
-    ostr << ";mt=" << REA_rgid.getMachineType();
-  }
-  if(isBackbone()){
-    ostr << ";bb=1";
-  }
-  if(isRail()){
-    ostr << ";rr=1";
-  }
-  if(isCoverageEquivalentRead()){
-    ostr << ";cer=1";
-  }
-  ostr << ";miraitag=MIT2\n";
-
-  return;
-}
-
 
 /*************************************************************************
  *
@@ -2438,8 +2246,13 @@ void Read::discard()
 {
   FUNCSTART("Read::discard()");
 
-  nukeSTLContainer(REA_template);
+  //nukeSTLContainer(REA_name);         
+  nukeSTLContainer(REA_scf_filename); 
+  //nukeSTLContainer(REA_exp_filename); 
+  //nukeSTLContainer(REA_caf_filename); 
+  nukeSTLContainer(REA_template);  
 
+  
   nukeSTLContainer(REA_padded_sequence);
   nukeSTLContainer(REA_padded_complementsequence);
   nukeSTLContainer(REA_qualities);
@@ -2447,11 +2260,6 @@ void Read::discard()
   nukeSTLContainer(REA_bposhashstats);
   nukeSTLContainer(REA_tags);
 
-  if(REA_rlevptr!=nullptr){
-    delete REA_rlevptr;
-    REA_rlevptr=nullptr;
-  }
-
   zeroVars();
 
   FUNCEND();
@@ -2486,10 +2294,10 @@ void Read::discard()
 /*************************************************************************
  *
  * starting from the actual quality clips, clip more from the ends while
- *  the characters occuring are X, N, *. That is, results will differ
+ *  the characters occuring are X, N, *. That is, results will differ 
  *  whether or not a previous quality clipping might have happened or not
  *
- * stretches with other bases will be merged while being <= 'gapsize',
+ * stretches with other bases will be merged while being <= 'gapsize', 
  *  the very first stretch may be 'frontgs' away and the last
  *  'endgs' away from the ends
  *
@@ -2512,11 +2320,11 @@ void Read::setClipoffsToMaskedChars(int32 gapsize, int32 frontgs, int32 endgs, b
   int32 ql;
 
   // 1st loop: calc from ends of read
-  // 2nd loop: calc from current left clipoff
+  // 2nd loop: calc from quality clips
   for(uint32 loop=0; loop<2; loop++){
     grace=frontgs+1;
     if(loop) {
-      ql=getLeftClipoff();
+      ql=REA_ql;
     } else {
       ql=0;
     }
@@ -2565,11 +2373,11 @@ void Read::setClipoffsToMaskedChars(int32 gapsize, int32 frontgs, int32 endgs, b
 
   int32 qr;
   // 1st loop: calc from ends of read
-  // 2nd loop: calc from current right clipoff
+  // 2nd loop: calc from quality clips
   for(uint32 loop=0; loop<2; loop++){
     grace=endgs+1;
     if(loop) {
-      qr=getRightClipoff();
+      qr=REA_qr;
     } else {
       qr=getLenSeq();
     }
@@ -2583,7 +2391,7 @@ void Read::setClipoffsToMaskedChars(int32 gapsize, int32 frontgs, int32 endgs, b
       actbase=toupper(*I);
       if(allowN && actbase=='N') actbase='X';
       switch(actbase) {
-      case 'N' :
+      case 'N' : 
       case '*' : {
 	if(inXrun) {
 	  qr=icount;
@@ -2636,7 +2444,7 @@ void Read::setSequenceFromString(const char * sequence)
 
   REA_padded_sequence.clear();
   REA_padded_sequence.reserve(strlen(sequence)+3);
-
+  
   // initialise the sequence vector
   {
     const char * fasta_sequence=sequence;
@@ -2647,12 +2455,11 @@ void Read::setSequenceFromString(const char * sequence)
       }else{
 	switch(toupper(tmpc)){
 	case 'N':
-	case 'X':{
+	case 'X':{ 
 	  REA_padded_sequence.push_back(tmpc);
 	  break;
 	}
-	  //case '*':
-	case '@':                                     // currently used by MIRA for "no coverage"
+	  //case '*': 
 	case '-': {
 	  REA_padded_sequence.push_back('N');
 	  break;
@@ -2664,34 +2471,30 @@ void Read::setSequenceFromString(const char * sequence)
 	case '\r' :{
 	  break;
 	}
-	case 0 : {
-	  fasta_sequence=nullptr;
-	  break;
-	}
 	default: {
-	  MIRANOTIFY(Notify::FATAL,"tried to set a base '" << tmpc << "' (ASCII: " << static_cast<uint16>(tmpc) << "), which is not a valid IUPAC base nor N, X, - or @.");
+	  fasta_sequence=NULL;
 	}
 	}
       }
-    }while(fasta_sequence!=nullptr);
+    }while(fasta_sequence!=NULL);
   }
-
-  REA_ql=0;
+  
+  REA_ql=0;                           
   REA_qr=static_cast<int32>(REA_padded_sequence.size());
-  REA_sl=0;
+  REA_sl=0;                           
   REA_sr=static_cast<int32>(REA_padded_sequence.size());
-  REA_cl=0;
+  REA_cl=0;                           
   REA_cr=static_cast<int32>(REA_padded_sequence.size());
-  REA_ml=0;
+  REA_ml=0;                           
   REA_mr=static_cast<int32>(REA_padded_sequence.size());
-
+  
   updateClipoffs();
-
+  
   postLoadEXPFASTA();
-
+    
   REA_has_valid_data=true;
 
-  BUGIFTHROW(checkRead()!=nullptr, checkRead());
+  BUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
 
   FUNCEND();
 }
@@ -2709,9 +2512,12 @@ void Read::checkQualities()
 {
   FUNCSTART("void Read::checkQualities()");
 
-  for(auto & qv : REA_qualities){
-    if(qv>100){
-      MIRANOTIFY(Notify::FATAL,"Read " << getName() << ": have quality <0 or > 100???\n");
+  vector<base_quality_t>::const_iterator I=REA_qualities.begin();
+  vector<base_quality_t>::const_iterator E=REA_qualities.end();
+
+  for(;I!=E; I++){
+    if(*I>100){
+      MIRANOTIFY(Notify::FATAL,"Read " << getName() << ": tried to set quality <0 or > 100???\n");
     }
   }
 
@@ -2728,10 +2534,12 @@ void Read::setQualities(const vector<base_quality_t> & quals)
 {
   FUNCSTART("void Read::setQuality(vector<base_quality_t> & quals)");
 
+  // TODO: check, if that is ok!
   if(quals.size() != REA_qualities.size()) {
     MIRANOTIFY(Notify::FATAL,"Read " << getName() << ": tried to set " << quals.size() << " qualities although the read has " << REA_qualities.size() << " bases.\n");
   }
 
+
   REA_qualities=quals;
 
   setQualityFlag(true);
@@ -2775,20 +2583,14 @@ void Read::loadDataFromSCF(const string & scfname)
   discard();
 
   if(scfname.empty()) {
-    MIRANOTIFY(Notify::FATAL, "No scfname given?");
-  }
-  if(!hasSCFData()){
-    MIRANOTIFY(Notify::FATAL, "No scf data available for " << scfname);
+    throw Notify(Notify::FATAL, THISFUNC, "No scfname given?");
   }
 
-  //REA_scf_filename=scfname;
+  REA_scf_filename=scfname;
   //setFileNamesFromSCFFileName(scfname);
 
   SCF scf;
-  string emsg;
-  if(scf.load(scfname.c_str(),emsg)>0){
-    MIRANOTIFY(Notify::FATAL,"Unexpected error where it should not happen: " << emsg);
-  }
+  scf.load(REA_scf_filename.c_str());
 
   // initialise the sequence vector
   {
@@ -2802,11 +2604,11 @@ void Read::loadDataFromSCF(const string & scfname)
       }else{
 	switch(toupper(tmpc)){
 	case 'N':
-	case 'X':{
+	case 'X':{ 
 	  REA_padded_sequence.push_back(tmpc);
 	  break;
 	}
-	case '*':
+	case '*': 
 	case '-': {
 	  REA_padded_sequence.push_back('N');
 	  break;
@@ -2820,124 +2622,350 @@ void Read::loadDataFromSCF(const string & scfname)
     }
   }
 
-  REA_ql=0;
+  REA_ql=0;                           
   REA_qr=static_cast<int32>(REA_padded_sequence.size());
-  REA_sl=0;
+  REA_sl=0;                           
   REA_sr=static_cast<int32>(REA_padded_sequence.size());
-  REA_cl=0;
+  REA_cl=0;                           
   REA_cr=static_cast<int32>(REA_padded_sequence.size());
-  REA_ml=0;
+  REA_ml=0;                           
   REA_mr=static_cast<int32>(REA_padded_sequence.size());
-
+  
   updateClipoffs();
 
   postLoadEXPFASTA();
-
+    
   for(uint32 i=0; i<scf.getNumBases(); i++) {
     REA_qualities[i]=scf.getCalledBaseProb(i);
   }
 
   REA_has_valid_data=true;
 
-  BUGIFTHROW(checkRead()!=nullptr, checkRead());
+  BUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
 
   FUNCEND();
   return;
 
 }
 
-
-
 /*************************************************************************
  *
- * void postLoadEXPFASTA()
- * build complements, build padded vectors, set qualities to defaults
- *  set adjustments to defaults, set bposhashstats to default
- *  set template if necessary and possible
+ *
+ *
  *
  *************************************************************************/
-void Read::postLoadEXPFASTA()
+void Read::loadDataFromEXP(const string & filename)
 {
-  FUNCSTART("void postLoadEXPFASTA();");
-
-  // build the complement padded sequence
-  makeComplement(REA_padded_sequence, REA_padded_complementsequence);
+  FUNCSTART("void Read::loadDataFromEXP()");
 
-  REA_ps_dirty=false;
-  REA_pcs_dirty=false;
+  REA_has_valid_data=false;
 
+  EXP tmpexp;
 
-  // When loading from an EXP-file, there might be no qualities given
-  // So, fill the quality-vector with 0, which will be overwritten if
-  //  quals are available
-  REA_qualities.clear();
-  REA_qualities.reserve(REA_padded_sequence.capacity());
-  REA_qualities.resize(REA_padded_sequence.size(),0);
+  string dummy;
+  if(!REA_sc_exp_pathname.getEntry(REA_exp_pathname).empty()) {
+    dummy=REA_sc_exp_pathname.getEntry(REA_exp_pathname)+"/"+filename;
+  }else{
+    dummy=filename;
+  }
 
-  // base flags
-  REA_bposhashstats.clear();
-  REA_bposhashstats.reserve(REA_padded_sequence.capacity());
-  clearAllBPosHashStats();
+  tmpexp.load(dummy.c_str());
 
-  // When loading an EXP-file, the bases correspond to the bases in the
-  //  SCF file.
-  if(REA_uses_adjustments){
-    REA_adjustments.reserve(REA_padded_sequence.capacity());
-    REA_adjustments.resize(REA_padded_sequence.size());
-    vector<int32>::iterator aI=REA_adjustments.begin();
-    vector<char>::const_iterator sI=REA_padded_sequence.begin();
-    int32 actadjust=0;
-    for(; aI<REA_adjustments.end(); aI++, sI++){
-      if(*sI!='*') {
-	*aI=actadjust;
-	actadjust++;
-      }else{
-	*aI=-1;
-      }
+  // ok, get the name and SCFname from the exp file
+  {
+    // First, the name of the experiment
+    //REA_name.clear();
+    //REA_name=tmpexp.getID();
+    setName(tmpexp.getID());
+    if(getName().empty()){
+      MIRANOTIFY(Notify::FATAL, "The experiment has no name (no ID field found): " << filename);
     }
-  }
 
-  // and don't forget that this read was possibly used before and had RLE ...
-  if(REA_rlevptr!=nullptr){
-    delete REA_rlevptr;
-    REA_rlevptr=nullptr;
+    // Now the SCF filename of the experiment
+    REA_scf_filename.clear();
+    REA_scf_filename=tmpexp.getLN();
+    //if(REA_scf_filename.empty()){
+    //  // FIXME: how to treat exp files without SCF data?
+    //  //throw Notify(Notify::FATAL, THISFUNC, REA_exp_filename, ": The experiment has no SCF file (no LN field found)");
+    //}
   }
 
-  FUNCEND();
-}
 
+  REA_ql=tmpexp.getQL();
+  REA_qr=tmpexp.getQR();
+  REA_sl=tmpexp.getSL();
+  REA_sr=tmpexp.getSR();
+  REA_cl=tmpexp.getCL();
+  REA_cr=tmpexp.getCR();
 
-/*************************************************************************
- *
- * TODO; check 'frommaskedchar'
- *
- *
- *************************************************************************/
+  REA_machine_type=REA_sc_machine_type.addEntry(tmpexp.getMA());
 
-void Read::setMinimumLeftClipoff(int32 minreq, int32 setto, bool fromseqvec, bool frommaskedchar)
-{
-  FUNCSTART("void Read::setMinimumLeftClipoff(int32 minreq, int32 setto, bool fromseqvec, bool frommaskedchar)");
+  setInsize(tmpexp.getSIfrom(),tmpexp.getSIto());
 
-  paranoiaBUGIF(checkRead()!=nullptr, MIRANOTIFY(Notify::FATAL, checkRead()));
+  // TODO: reactivate/emulate
+  //tmpexp.swapTags(REA_tags);      // the EXP will be destructed, so save time
 
-  if( REA_ql < setto ) {
-    if(REA_ql < minreq) {
-      REA_ql=setto;
-    }
-    if(fromseqvec && REA_sl < minreq) {
-      REA_ql=setto;
-    }
-    if(REA_ml>0 && REA_ml < minreq) {
-      REA_ql=setto;
-    }
-    if(REA_ql>=static_cast<int32>(REA_qualities.size())) REA_ql=static_cast<int32>(REA_qualities.size())-1;
-    if(REA_ql<0) REA_ql=0;
-    if(REA_qr<REA_ql) REA_qr=REA_ql;
-    updateClipoffs();
+  // subtract 1 from the positions read in exp file (which are basis 1)
+  for(uint32 i=0; i<REA_tags.size(); i++ ){
+    REA_tags[i].from--;
+    REA_tags[i].to--;
+  }
+  
+  if(REA_ql>REA_qr){
+#ifndef PUBLICQUIET
+    WARNING("WARNING: " << getName() << "   left quality clip > right quality clip (QL > QR), adjusted.");
+#endif
+    REA_qr=REA_ql;
+  }
+  if(REA_sl>REA_sr){
+#ifndef PUBLICQUIET
+    WARNING("WARNING: " << getName() << "   sequence vector left clip > sequence vector right clip (SL > SR), adjusted.");
+#endif
+    REA_sr=REA_sl;
   }
 
-  FUNCEND();
-}
+  updateClipoffs();
+
+  if(getRightClipoff()-getLeftClipoff()<0){
+#ifndef PUBLICQUIET
+    WARNING("WARNING: " << getName() << "   quality and sequence vector clippings form a negative length (clip right - clip left <0), adjusted");
+#endif
+    REA_qr=REA_sl;
+    updateClipoffs();
+  }
+
+  // initialise the sequence vector
+  {
+    const char * exp_sequence=tmpexp.getSequence().c_str();
+    if(exp_sequence==NULL){
+      MIRANOTIFY(Notify::WARNING, "No bases were found: " << getName());
+    }
+
+    REA_padded_sequence.clear();
+    REA_padded_sequence.reserve(strlen(exp_sequence)+3);
+    do{
+      char tmpc=*exp_sequence++;
+      if(dptools::isValidIUPACBase(tmpc)){
+	REA_padded_sequence.push_back(tmpc);
+      }else{
+	switch(toupper(tmpc)){
+	case 'N':
+	case 'X':
+	case '*':{
+	  REA_padded_sequence.push_back(tmpc);
+	  break;
+	}
+	case '-': {
+	  REA_padded_sequence.push_back('N');
+	  break;
+	}
+	case 0 : {
+	  // FIXME: how to treat emtpy reads????
+	  //throw Notify(Notify::WARNING, THISFUNC, REA_exp_filename, ": No bases were found?");
+	  // cannot throw, isn't gentle enough for big projects :(
+	  WARNING("WARNING: " << tmpexp.getID() << "   has no bases in the experiment file?");
+	  // FIXME: pfusch!
+	  REA_padded_sequence.push_back('N');
+	  REA_ql=0;
+	  REA_qr=1;
+	  REA_sl=0;
+	  REA_sr=1;
+	  updateClipoffs();
+	  exp_sequence--;
+	  break;
+	}
+	default: {
+	  cout << "Illegal base: " << tmpc << "(" << hex << static_cast<uint16>(tmpc) << dec << ")" << endl;
+	  MIRANOTIFY(Notify::FATAL, "Illegal base found: " << tmpexp.getID());
+	}
+	}
+      }
+      
+    }while(*exp_sequence!=0);
+  }
+
+  postLoadEXPFASTA();
+
+
+  if(tmpexp.getSV().empty()){
+    REA_seqvec_name=REA_sc_seqvec_name.addEntry(tmpexp.getSF());
+  }else{
+    REA_seqvec_name=REA_sc_seqvec_name.addEntry(tmpexp.getSV());
+  }
+  REA_template=tmpexp.getTN();
+  REA_basecaller=REA_sc_basecaller.addEntry(tmpexp.getBC());
+  REA_asped=REA_sc_asped.addEntry(tmpexp.getDT());
+  //  REA_dye;
+  REA_processstatus=REA_sc_processstatus.addEntry(tmpexp.getPS());
+  REA_primer=REA_sc_primer.addEntry(tmpexp.getPN());
+
+  //  read AV qualities if any
+  {
+    const vector<base_quality_t> & equal=tmpexp.getAV();
+    uint32 expavsize=static_cast<uint32>(equal.size());
+    if(expavsize>0 && expavsize!=REA_padded_sequence.size()){
+      cout << "Sequence length: " << REA_padded_sequence.size() << endl;
+      cout << "Number of quality values: " << expavsize << endl;
+      MIRANOTIFY(Notify::FATAL, "The experiment has an unequal number of bases and quality values (SQ vs AV fields): " << filename);
+    }
+    if(expavsize>0){
+      REA_has_quality=true;
+      for(uint32 i=0; i<REA_qualities.size(); i++){
+	REA_qualities[i]=equal[i];
+      }
+    }
+  }
+
+  //  read ON adjustments
+  if(REA_uses_adjustments){
+    const vector<int32> onvals= tmpexp.getON();
+    if(onvals.size()){
+      if(onvals.size()%2) {
+	MIRANOTIFY(Notify::INTERNAL, "there should be a even number of ON adjustments: " << filename);
+      }
+      //vector<int32> newadjustments[REA_adjustments.size()];
+      vector<int32> newadjustments;
+      newadjustments.resize(REA_adjustments.size());
+      uint32 nai=0;
+      uint32 ovi=0;
+      while(ovi<onvals.size()){
+	//cout << onvals[ovi] << "  " << onvals[ovi+1] << endl;
+	if(onvals[ovi]==0){
+	  newadjustments[nai]=-1;
+	  nai++;
+	} else {
+	  uint32 onlow=onvals[ovi];
+	  uint32 onhigh=onvals[ovi+1];
+	  for(uint32 i=onlow; i<=onhigh; i++, nai++){
+	    if(nai>=newadjustments.size()) {
+	      MIRANOTIFY(Notify::FATAL, "the adjustments given in the ON tag exceed the size of the sequence: " << filename);
+	    }
+	    newadjustments[nai]=i-1;
+	  }
+	}
+	ovi+=2;
+      }
+      if(nai!=newadjustments.size()){
+	cout << "nai: " << nai << "  newadjustments.size(): " << newadjustments.size() << endl;
+	MIRANOTIFY(Notify::FATAL, "the adjustments given in the ON tag do not cover the whole range of sequence: " << filename);
+      }
+      REA_adjustments.swap(newadjustments);
+    }
+  }
+
+  // transfer Mira INFormation in MINF tags to read variables
+  transferMINFTagsToReadInfo();
+
+  REA_has_valid_data=true;
+
+  REA_ml=0;                           
+  REA_mr=getLenSeq();
+
+  if(REA_qr<static_cast<int32>(REA_qualities.size())) REA_qr--;
+  if(REA_sr<static_cast<int32>(REA_qualities.size())) REA_sr--;
+  if(REA_cr<static_cast<int32>(REA_qualities.size())) REA_cr--;
+  updateClipoffs();
+
+  //  CEBUG(*this);
+  BUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
+
+  //tmpexp.dump();
+  //cout << *this;
+
+  FUNCEND();
+}
+
+
+
+/*************************************************************************
+ *
+ * void postLoadEXPFASTA()
+ * build complements, build padded vectors, set qualities to defaults
+ *  set adjustments to defaults, set bposhashstats to default
+ *  set template if necessary and possible
+ *
+ *************************************************************************/
+void Read::postLoadEXPFASTA()
+{
+  FUNCSTART("void postLoadEXPFASTA();");
+
+  // build the complement padded sequence
+  makeComplement(REA_padded_sequence, REA_padded_complementsequence);
+
+  REA_ps_dirty=false;
+  REA_pcs_dirty=false;
+
+
+  // When loading from an EXP-file, there might be no qualities given
+  // So, fill the quality-vector with 0, which will be overwritten if 
+  //  quals are available
+  REA_qualities.clear();
+  REA_qualities.reserve(REA_padded_sequence.capacity());
+  REA_qualities.resize(REA_padded_sequence.size(),0);
+
+  // base flags
+  REA_bposhashstats.clear(); 
+  REA_bposhashstats.reserve(REA_padded_sequence.capacity());
+  clearAllBPosHashStats();
+
+  // When loading an EXP-file, the bases correspond to the bases in the
+  //  SCF file.
+  if(REA_uses_adjustments){
+    REA_adjustments.reserve(REA_padded_sequence.capacity());
+    REA_adjustments.resize(REA_padded_sequence.size());
+    vector<int32>::iterator aI=REA_adjustments.begin();
+    vector<char>::const_iterator sI=REA_padded_sequence.begin();
+    int32 actadjust=0;
+    for(; aI<REA_adjustments.end(); aI++, sI++){
+      if(*sI!='*') {
+	*aI=actadjust;
+	actadjust++;
+      }else{
+	*aI=-1;
+      }
+    }
+  }
+
+  if(REA_template.empty()){
+    string tmp=getInternalTemplateName();
+    if(REA_template_end!='N') REA_template=tmp;
+  }
+
+  FUNCEND();
+}
+
+
+/*************************************************************************
+ *
+ * TODO; check 'frommaskedchar'
+ *
+ *
+ *************************************************************************/
+
+void Read::setMinimumLeftClipoff(int32 minreq, int32 setto, bool fromseqvec, bool frommaskedchar)
+{
+  FUNCSTART("void Read::setMinimumLeftClipoff(int32 minreq, int32 setto, bool fromseqvec, bool frommaskedchar)");
+
+  paranoiaBUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
+
+  if( REA_ql < setto ) {
+    if(REA_ql < minreq) {
+      REA_ql=setto;
+    }
+    if(fromseqvec && REA_sl < minreq) {
+      REA_ql=setto;
+    }
+    if(REA_ml>0 && REA_ml < minreq) {
+      REA_ql=setto;
+    }
+    if(REA_ql>=static_cast<int32>(REA_qualities.size())) REA_ql=static_cast<int32>(REA_qualities.size())-1;
+    if(REA_ql<0) REA_ql=0;
+    if(REA_qr<REA_ql) REA_qr=REA_ql;
+    updateClipoffs();
+  }
+
+  FUNCEND();
+}
 
 
 /*************************************************************************
@@ -2951,7 +2979,7 @@ void Read::setMinimumRightClipoff(int32 minreq, int32 setto)
 {
   FUNCSTART("void Read::setMinimumRightClipoff(int32 minreq, int32 setto)");
 
-  paranoiaBUGIF(checkRead()!=nullptr, MIRANOTIFY(Notify::FATAL, checkRead()));
+  paranoiaBUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
 
   if( REA_qr > static_cast<int32>(REA_qualities.size())-minreq ) {
     REA_qr=static_cast<int32>(REA_qualities.size())-setto;
@@ -2976,14 +3004,14 @@ bool Read::hasSCFData(bool loadfailnoerror)
   FUNCSTART("bool Read::hasSCFData(bool loadfailnoerror=false)");
 
   if(!REA_has_valid_data
-     || getSequencingType() != ReadGroupLib::SEQTYPE_SANGER) {
+     || REA_seqtype != SEQTYPE_SANGER) {
     FUNCEND();
     return false;
   }
 
-  paranoiaBUGIF(checkRead()!=nullptr, MIRANOTIFY(Notify::FATAL, checkRead()));
+  paranoiaBUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
 
-  checkSCFAndLoadQual(hasQuality(),loadfailnoerror);
+  checkSCFAndLoadQual(true,loadfailnoerror);
 
   FUNCEND();
   return REA_scf_available;
@@ -3002,12 +3030,14 @@ void Read::checkSCFAndLoadQual(bool justcheck, bool loadfailnoerror)
   FUNCSTART("void Read::checkSCFAndLoadQual(bool justcheck)");
 
   if(hasValidData()==false){
-    MIRANOTIFY(Notify::INTERNAL, "Trying to load SCF from unitialised Read.");
+    throw Notify(Notify::INTERNAL, THISFUNC, "Trying to load SCF from unitialised Read.");          
   }
+
   if(REA_scf_loadattempted
-     || isRail()
-     || isCoverageEquivalentRead()
-     || getSequencingType()!=ReadGroupLib::SEQTYPE_SANGER){
+     || REA_scf_filename.empty()
+     || REA_israil
+     || REA_iscoverageequivalentread
+     || REA_seqtype!=SEQTYPE_SANGER){
     FUNCEND();
     return;
   }
@@ -3016,31 +3046,30 @@ void Read::checkSCFAndLoadQual(bool justcheck, bool loadfailnoerror)
 
   SCF scf;
 
-  string dummy;
-  getSCFFullPathName(dummy);
-  if(dummy.empty()) return;
-
-  string emsg;
-  auto loadres=scf.load(dummy.c_str(),emsg);
-  if(loadres>0){
-    if(!loadfailnoerror){
-      cout << "Warning: " << emsg << endl;
+  try{
+    string dummy;
+    getSCFFullPathName(dummy);
+    scf.load(dummy.c_str());
+    scf.transposeAmbiguityCodes();
+    //    scf.recalcProbs();
+  }
+  catch(Notify n){
+    if(!loadfailnoerror) {
+      n.setGravity(Notify::WARNING);
+      n.handleError(THISFUNC);
     }
+    FUNCEND();
     return;
   }
 
-  scf.transposeAmbiguityCodes();
-
   if(justcheck==false){
     if(scf.getNumBases()!=getLenSeq()){
-      cout << "Warning: Number of bases in SCF file (" << dummy << ") does not correspond to the number of bases expected in the read (read from fasta, exp, phd or caf file).\nRead will _not_ be used in assembly!" << endl;
-      return;
+      MIRANOTIFY(Notify::WARNING,"Number of bases in SCF file (" << REA_scf_filename << ") does not correspond to the number of bases expected in the read (read from fasta, exp, phd or caf file).\nRead will _not_ be used in assembly!");
     }
     for(uint32 i=0; i<REA_padded_sequence.size(); i++){
       if(toupper(scf.getBase(i))!=toupper(REA_padded_sequence[i])){
 	if(!(scf.getBase(i)=='-' || toupper(REA_padded_sequence[i])=='N' || toupper(REA_padded_sequence[i])=='X')){
-	  cout << "Warning: A base (" << scf.getBase(i) << ") in the SCF (" << dummy << ") does not correspond to the the one (" << REA_padded_sequence[i] << ") in the read read from fasta, exp, phd or caf (position: " << i << ").\nRead will _not_ be used in assembly!" << endl;
-	  return;
+	  MIRANOTIFY(Notify::WARNING,"A base (" << scf.getBase(i) << ") in the SCF (" << REA_scf_filename << ") does not correspond to the the one (" << REA_padded_sequence[i] << ") in the read read from fasta, exp, phd or caf (position: " << i << ").\nRead will _not_ be used in assembly!");
 	}
       }
       if(justcheck==false){
@@ -3057,12 +3086,11 @@ void Read::checkSCFAndLoadQual(bool justcheck, bool loadfailnoerror)
 
 /*************************************************************************
  *
- * The "const"-ness of this function is a lie
- * Destination is usually a member variable, which, however, is mutable :-)
- *  (for non-mutable variables the compiler rightly complains)
+ *
+ *
  *
  *************************************************************************/
-void Read::makeComplement(const vector<char> & source, vector<char> & destination) const
+void Read::makeComplement(const vector<char> & source, vector<char> & destination)
 {
   FUNCSTART("void Read::makeComplement(vector<char> & source, vector<char> & destination);");
 
@@ -3072,15 +3100,15 @@ void Read::makeComplement(const vector<char> & source, vector<char> & destinatio
   while(I!=source.rend()){
     char base=*I++;
     char cbase=dptools::getComplementIUPACBase(base);
-    if(likely(cbase!=0)){
+    if(cbase!=0){
       destination.push_back(cbase);
     }else{
       cout << "Argh! Found illegal base " << base << " and there's no complement for it!\n";
-      MIRANOTIFY(Notify::INTERNAL, "Illegal base in a phase where there should be none.");
+      throw Notify(Notify::INTERNAL, THISFUNC, "Illegal base in a phase where there should be none.");
     }
   }
   if(destination.size()!=source.size()){
-    MIRANOTIFY(Notify::INTERNAL, "While making complement sequence: source and destination have different sizes afterwards?");
+    throw Notify(Notify::INTERNAL, THISFUNC, "While making complement sequence: source and destination have different sizes afterwards?");
   }
 
   FUNCEND();
@@ -3098,9 +3126,9 @@ void Read::makeComplement(const vector<char> & source, vector<char> & destinatio
 int32 Read::calcComplPos(int32 pos) const
 {
   FUNCSTART("int32 Read::calcComplPos(int32 pos) const");
-  paranoiaBUGIF(checkRead()!=nullptr, MIRANOTIFY(Notify::FATAL, checkRead()));
+  paranoiaBUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
   FUNCEND();
-  return static_cast<int32>(getLenSeq())-1-pos;
+  return static_cast<int32>(REA_qualities.size())-1-pos;
 }
 
 
@@ -3116,7 +3144,7 @@ int32 Read::calcComplPos(int32 pos) const
 int32 Read::calcClippedPos2RawPos(int32 pos) const
 {
   FUNCSTART("int32 Read::calcComplPos2RawPos(int32 pos) const");
-  paranoiaBUGIF(checkRead()!=nullptr, MIRANOTIFY(Notify::FATAL, checkRead()));
+  paranoiaBUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
   FUNCEND();
   return (pos+getLeftClipoff());
 }
@@ -3132,7 +3160,7 @@ int32 Read::calcClippedPos2RawPos(int32 pos) const
 int32 Read::calcRawPos2ClippedPos(int32 pos) const
 {
   FUNCSTART("int32 Read::calcComplPos2RawPos(int32 pos) const");
-  paranoiaBUGIF(checkRead()!=nullptr, MIRANOTIFY(Notify::FATAL, checkRead()));
+  paranoiaBUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
   FUNCEND();
   return (pos-getLeftClipoff());
 }
@@ -3148,7 +3176,7 @@ int32 Read::calcRawPos2ClippedPos(int32 pos) const
 int32 Read::calcClippedComplPos2RawPos(int32 pos) const
 {
   FUNCSTART("int32 Read::calcClippedComplPos2RawPos(int32 pos) const");
-  paranoiaBUGIF(checkRead()!=nullptr, MIRANOTIFY(Notify::FATAL, checkRead()));
+  paranoiaBUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
   FUNCEND();
   return (getRightClipoff()-1-pos);
 }
@@ -3166,8 +3194,8 @@ void Read::setName(const string & name)
   FUNCSTART("void Read::setName(const string & name)");
 
   const char * c=name.c_str();
-  const char * emsg=nullptr;
-  const char * wmsg=nullptr;
+  const char * emsg=NULL;
+  const char * wmsg=NULL;
   char wchar=' ';
   for(; *c !=0; ++c){
     if(*c <32 || *c==127){
@@ -3192,102 +3220,181 @@ void Read::setName(const string & name)
     default : {
     }
     }
-    if(emsg != nullptr) break;
+    if(emsg != NULL) break;
   }
 
-  if(emsg!=nullptr){
+  if(emsg!=NULL){
     MIRANOTIFY(Notify::INTERNAL,"While trying to set the name of read \n" << name << "\nEncountered character with ASCII code " << static_cast<uint16>(*c) << ". " << *emsg << "\nIt is probably due to your input data, but normally, MIRA should have caught that earlier!");
   }
-  if(wmsg!=nullptr){
-    cout << "Warning while setting the name of read '"
-	 << name
-	 << "':\nEncountered character with ASCII code "
-	 << static_cast<uint16>(wchar) << " (" << wchar << ").\n"
+  if(wmsg!=NULL){
+    cout << "Warning while setting the name of read '" 
+	 << name 
+	 << "':\nEncountered character with ASCII code " 
+	 << static_cast<uint16>(wchar) << " (" << wchar << ").\n" 
 	 << *wmsg << "\n";
   }
 
-  string finalname(renameReadPrefix(name));
-  REA_nameentry=REA_sc_readname.addEntryNoDoubleCheck(finalname);
-
-  if(!REA_rgid.isDefaultNonValidReadGroupID()) calcTemplateInfo();
+  REA_nameentry=REA_sc_readname.addEntryNoDoubleCheck(name);
 
   FUNCEND();
 }
 
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
 
-bool Read::checkStringForSRANamingScheme(const string & rname)
+void Read::setDirectories(const string & exp, const string & scf)
 {
-  if(rname.size()>10
-     && rname[0] >= 'A' && rname[0] <= 'Z'
-     && rname[1] >= 'A' && rname[1] <= 'Z'
-     && rname[2] >= 'A' && rname[2] <= 'Z'
-     && isdigit(rname[3])
-     && isdigit(rname[4])
-     && isdigit(rname[5])
-     && isdigit(rname[6])
-     && isdigit(rname[7])
-     && isdigit(rname[8])
-     && rname[9] == '.'
-    ){
-    return true;
-  }
-  return false;
-}
+  REA_exp_pathname=REA_sc_exp_pathname.addEntry(exp);
+  REA_scf_pathname=REA_sc_scf_pathname.addEntry(scf);
 
+  REA_scf_loadattempted=false;
+  REA_scf_available=false;
+}
 
-/*************************************************************************
- *
- * renamelist: (prefix2search replacewith) (... ...)
- *
- *
- *************************************************************************/
-
-string Read::renameReadPrefix(const string & actname)
+void Read::setSCFDirectory(const string & scf)
 {
-  FUNCSTART("bool Read::renameReadPrefix(string & actname)");
-
-  auto & renamelist=REA_rgid.getReadRenamePrefixList();
-  if(renamelist.empty()) return actname;
-  BUGIFTHROW(renamelist.size()%2,"renamelist % 2 != 0???");
+  REA_scf_pathname=REA_sc_scf_pathname.addEntry(scf);
 
-  for(auto rlI=renamelist.begin(); rlI!=renamelist.end(); ++rlI){
-    auto rmI = std::mismatch(rlI->begin(), rlI->end(), actname.begin());
-    if(rmI.first == rlI->end()){
-      // found a prefix, now rename read;
-      string newname=*(++rlI);  // new prefix
-      newname+=actname.substr((--rlI)->size(),string::npos); // old postfix
-      return newname;
-    }
-    ++rlI;
-  }
-
-  return actname;
+  REA_scf_loadattempted=false;
+  REA_scf_available=false;
 }
 
+void Read::setSCFFileName(const string & scf)
+{
+  REA_scf_filename=scf;
 
+  REA_scf_loadattempted=false;
+  REA_scf_available=false;
+}
 
 void Read::getSCFFullPathName(string & path) const
 {
   path.clear();
-
-  if(!REA_rgid.getDataDir().empty()){
-    path+=REA_rgid.getDataDir();
-    if(path.back()!='/') path+='/';
-  }
-  if(!REA_rgid.getDataFile().empty()){
-    path+=REA_rgid.getDataFile();
+  if(!REA_sc_scf_pathname.getEntry(REA_scf_pathname).empty()) {
+    path=REA_sc_scf_pathname.getEntry(REA_scf_pathname)+"/"+REA_scf_filename;
   }else{
-    path+=getName()+".scf";
+    path=REA_scf_filename;
   }
   return;
 }
 
-
+//void Read::getEXPFullPathName(string & path) const
+//{
+//  path.clear();
+//  string expfn;
+//  getEXPName(expfn);
+//  if(!REA_sc_exp_pathname.getEntry(REA_exp_pathname).empty()) {
+//    path=REA_sc_exp_pathname.getEntry(REA_exp_pathname)+"/"+expfn;
+//  }else{
+//    path=expfn;
+//  }
+//  return;
+//}
+
+
+
+///*************************************************************************
+// *
+// * Constructs the EXP and CAF filenames for the read, taking the reads
+// *  given name as source.
+// * Evtl. construct an SCF name.
+// *
+// *************************************************************************/
+//
+//void Read::setFileNamesFromEXPFileName(const string & filename)
+//{
+//  FUNCSTART("void Read::setFileNamesFromEXPFileName(const string & filename)");
+//
+//  REA_name=filename;
+//
+//  string::size_type bpos = filename.rfind(".");
+//
+//  if (bpos != string::npos) {
+//    REA_name=filename.substr(0,bpos);
+//  }
+//
+//  //REA_exp_filename=filename;
+//  //REA_caf_filename=REA_name+REA_add_4caffn;
+//  if (REA_scf_filename.empty()) {
+//    REA_scf_filename=REA_name+REA_add_4scffn;
+//  }
+//
+//  REA_scf_loadattempted=false;
+//  REA_scf_available=false;
+//
+//  FUNCEND();
+//  return;
+//}
+
+
+///*************************************************************************
+// *
+// * Constructs the EXP and CAF filenames for the read, taking the reads
+// *  given name as source.
+// *
+// *************************************************************************/
+//
+//void Read::setFileNamesFromSCFFileName(const string & filename)
+//{
+//  FUNCSTART("void Read::setFileNamesFromSCFFileName(const string & filename)");
+//
+//  REA_scf_filename=filename;
+//
+//  string tmpname=filename;
+//  for(uint32 i=0; i<tmpname.size(); i++){
+//    tmpname[i]=static_cast<char>(tolower(tmpname[i]));
+//  }
+//
+//  string::size_type bpos = tmpname.rfind(".scf");
+//
+//  if (bpos != string::npos) {
+//    REA_name=filename.substr(0,bpos);
+//  } else {
+//    REA_name=filename;
+//  }
+//
+//  REA_exp_filename=REA_name+REA_add_4expfn;
+//  //REA_caf_filename=REA_name+REA_add_4caffn;
+//
+//  FUNCEND();
+//  return;
+//}
+
+
+//string str16 = "abcdefghi";
+//string str17 = "def";
+//string::size_type pos = str16.find (str17,0);
+//cout << pos << endl; // 3
+//pos = str16.find ("AB",0);
+//if (pos == string::npos) cout << "Not found" << endl;
+
+
+
+
+void Read::setFileNamesFromFASTAName(const string & givenname)
+{
+  FUNCSTART("void Read::setFileNamesFromFASTAName(const string & givenname)");
+
+  //REA_name=givenname;
+  //REA_exp_filename=givenname+REA_add_4expfn;
+  //REA_caf_filename=givenname+REA_add_4caffn;
+
+  setName(givenname);
+  if (REA_scf_filename.empty()) {
+    REA_scf_filename=givenname+REA_add_4scffn;
+    REA_scf_loadattempted=false;
+    REA_scf_available=false;
+  }
+
+  //cout << REA_name << endl;
+  //cout << REA_exp_filename << endl;
+  //cout << REA_scf_filename << endl;
+  //cout << REA_caf_filename << endl;
+
+  FUNCEND();
+  return;
+}
+
+
+
 /*************************************************************************
  *
  *
@@ -3298,11 +3405,10 @@ void Read::getSCFFullPathName(string & path) const
 void Read::initialiseRead(bool preserve_originals,
 			  bool iscomplement,
 			  bool ispadded,
-			  ReadGroupLib::ReadGroupID rgid,
 			  vector<char>           & sequence,
 			  vector<base_quality_t> & qualities,
 			  vector<int32>          & adjustments,
-			  vector<multitag_t>     & tags,
+			  vector<tag_t>          & tags,
 			  const string & name,
 			  const string & SCFname,
 			  int32 ql, int32 qr,    // quality clipping left/right
@@ -3314,19 +3420,33 @@ void Read::initialiseRead(bool preserve_originals,
 
   discard();
 
-  // handle the names
-  BUGIFTHROW(name.empty(), "no name given");
+//  cout << "got ql: " << ql << endl;
+//  cout << "got qr: " << qr << endl;
+//  cout << "got sl: " << sl << endl;
+//  cout << "got sr: " << sr << endl;
+//  cout << "got cl: " << cl << endl;
+//  cout << "got cr: " << cr << endl;
 
-  REA_rgid=rgid;  // do this before calling setName()!
-  setName(name);
 
-  BUGIFTHROW(qualities.size() != sequence.size(),"qualities.size() " << qualities.size() << " != sequence.size() " << sequence.size() << " for: " << name);
-  BUGIFTHROW(!adjustments.empty() && adjustments.size() != sequence.size(),"adjustments.size() " << adjustments.size() << " != sequence.size() " << sequence.size() << " for: " << name);
+  //cout << name << "\t" << sequence.size() << "\t" << qualities.size() << endl;
+
+  uint32 size=static_cast<uint32>(sequence.size());
+  if(qualities.size() != size){
+    cerr << "Sequence size: " << size << "\tQualities size: " << qualities.size() << endl;
+    MIRANOTIFY(Notify::INTERNAL, "qualities.size() != sequence.size() : " << name);
+  }
+  if(adjustments.size() != size){
+    cerr << "Sequence size: " << size << "\tAdjustments size: " << qualities.size() << endl;
+    MIRANOTIFY(Notify::INTERNAL, "adjustments.size() != sequence.size() ?:" << name);
+  }
 
-  // force not using adjustements if those are empty
-  if(!sequence.empty() && adjustments.empty()){
-    disallowAdjustments();
+  if(name.empty()){
+    throw Notify(Notify::INTERNAL, THISFUNC," no name given");
   }
+  //if(SCFname==NULL){
+  //  //throw Notify(Notify::INTERNAL, THISFUNC," no SCFname given");
+  //  SCFname=' ';
+  //}
 
   // handle the sequence
   if(iscomplement==true){
@@ -3344,6 +3464,7 @@ void Read::initialiseRead(bool preserve_originals,
 	REA_padded_complementsequence.swap(sequence);
       }
       makeComplement(REA_padded_complementsequence, REA_padded_sequence);
+
     }
   }else{
     if(ispadded==true){
@@ -3360,6 +3481,7 @@ void Read::initialiseRead(bool preserve_originals,
 	REA_padded_sequence.swap(sequence);
       }
       makeComplement(REA_padded_sequence, REA_padded_complementsequence);
+
     }
   }
 
@@ -3397,14 +3519,26 @@ void Read::initialiseRead(bool preserve_originals,
   }
 
   // handle the tags
-  setTags(tags);
+
+  {
+    REA_tags.resize(tags.size());
+    vector<tag_t>::const_iterator fI=tags.begin();
+    vector<multitag_t>::iterator tI=REA_tags.begin();
+    for(; fI != tags.end(); ++tI, ++fI){
+      *tI=*fI;
+    }
+  }
 
   // handle the baseflags (not given, so set everything to default)
   clearAllBPosHashStats();
 
+  // handle the names
+  setName(name);
+  REA_scf_filename=SCFname;
+
 
   // handle the normal clippings
-
+  
   REA_qr=qr;
   REA_ql=ql;
   REA_sr=sr;
@@ -3413,12 +3547,15 @@ void Read::initialiseRead(bool preserve_originals,
   REA_cl=cl;
   updateClipoffs();
 
+  // transfer Mira INFormation in MINF tags to read variables
+  transferMINFTagsToReadInfo();
+
   // getLenSeq needs a valid read!
   REA_has_valid_data=true;
-  REA_ml=0;
+  REA_ml=0;                           
   REA_mr=getLenSeq();
-
-  BUGIFTHROW(checkRead()!=nullptr, checkRead());
+  
+  BUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
 
   FUNCEND();
 }
@@ -3436,7 +3573,7 @@ void Read::removeGapsFromRead()
 {
   FUNCSTART("void Read::removeGapsFromRead()");
 
-  BUGIFTHROW(checkRead()!=nullptr, checkRead());
+  BUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
 
   refreshPaddedSequence();
 
@@ -3470,7 +3607,7 @@ void Read::fixZeroGapQuals()
   // cannot do anything in these cases
   if(REA_qualities.empty() || getLenSeq()<2) return;
 
-  BUGIFTHROW(checkRead()!=nullptr, checkRead());
+  BUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
 
   refreshPaddedSequence();
 
@@ -3507,17 +3644,17 @@ void Read::correctNStretch(int32 from, int32 to, int32 changeestim)
 {
   FUNCSTART("void Read::correctNStretch(const int32 from, const int32 to, int32 changeestim)");
 
-  BUGIFTHROW(checkRead()!=nullptr, checkRead());
-
+  BUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
+  
   if(from>to) swap(from,to);
 
   refreshPaddedSequence();
-
+	     
   BUGIFTHROW(from<0,getName() << ": from (" << from << ") <0 ?");
   BUGIFTHROW(from>=REA_padded_sequence.size(),getName() << ": from (" << from << ") >= REA_padded_sequence.size (" << REA_padded_sequence.size() << ") ?");
   BUGIFTHROW(to<0,getName() << ": to (" << to << ") <0 ?");
   BUGIFTHROW(to>=REA_padded_sequence.size(),getName() << ": to (" << to << ") >= REA_padded_sequence.size (" << REA_padded_sequence.size() << ") ?");
-
+			
   if(changeestim==0) return;
 
   bool ok=true;
@@ -3579,7 +3716,7 @@ void Read::transformGapsToNs()
 {
   FUNCSTART("void Read::transformGapsToNs()");
 
-  BUGIFTHROW(checkRead()!=nullptr, checkRead());
+  BUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
 
   refreshPaddedSequence();
 
@@ -3637,12 +3774,12 @@ int32 Read::getAdjustmentPosOfReadPos(const uint32 position) const
 
   if(REA_uses_adjustments){
     BUGIFTHROW(position>=REA_adjustments.size(), getName() << ": readpos (" << position << ") >= size of read (" << REA_adjustments.size() << ")?");
-
+    
     FUNCEND();
     return REA_adjustments[position];
   }
 
-  refreshPaddedSequence();
+  const_cast<Read *>(this)->refreshPaddedSequence();
 
   if(REA_padded_sequence[position]=='*') return -1;
   return position;
@@ -3664,12 +3801,12 @@ int32 Read::getLowerNonGapAdjustmentPosOfReadPos(uint32 position) const
     BUGIFTHROW(position>=REA_adjustments.size(), getName() << ": readpos (" << position << ") >= size of read (" << REA_adjustments.size() << ")?");
 
     while(position>0 && REA_adjustments[position] == -1) position--;
-
+    
     FUNCEND();
     return REA_adjustments[position];
   }
 
-  refreshPaddedSequence();
+  const_cast<Read *>(this)->refreshPaddedSequence();
   while(position>0 && REA_padded_sequence[position] == '*') position--;
 
   int32 adjpos=0;
@@ -3696,14 +3833,14 @@ int32 Read::getUpperNonGapAdjustmentPosOfReadPos(uint32 position) const
 
   if(REA_uses_adjustments){
     BUGIFTHROW(position>=REA_adjustments.size(), getName() << ": readpos (" << position << ") >= size of read (" << REA_adjustments.size() << ")?");
-
+    
     while(position<REA_adjustments.size()-1 && REA_adjustments[position] == -1) position++;
-
+    
     FUNCEND();
     return REA_adjustments[position];
   }
 
-  refreshPaddedSequence();
+  const_cast<Read *>(this)->refreshPaddedSequence();
   while(position<REA_padded_sequence.size()-1 && REA_padded_sequence[position] == '*') position++;
 
   int32 adjpos=0;
@@ -3729,7 +3866,7 @@ int32 Read::getLowerNonGapPosOfReadPos(uint32 position) const
 {
   FUNCSTART("int32 Read::getLowerNonGapPosOfReadPos(const uint32 position) const");
 
-  refreshPaddedSequence();
+  const_cast<Read *>(this)->refreshPaddedSequence();
 
   BUGIFTHROW(position>=REA_padded_sequence.size(),getName() << ": position (" << position << ") >= REA_padded_sequence.size (" << REA_padded_sequence.size() << ") ?");
 
@@ -3751,7 +3888,7 @@ int32 Read::getUpperNonGapPosOfReadPos(uint32 position) const
 {
   FUNCSTART("int32 Read::getUpperNonGapPosOfReadPos(const uint32 position) const");
 
-  refreshPaddedSequence();
+  const_cast<Read *>(this)->refreshPaddedSequence();
   BUGIFTHROW(position>=REA_padded_sequence.size(),getName() << ": position (" << position << ") >= REA_padded_sequence.size (" << REA_padded_sequence.size() << ") ?");
 
   while(position<REA_padded_sequence.size()-1 && REA_padded_sequence[position] == '*') ++position;
@@ -3793,135 +3930,29 @@ int32 Read::getReadPosOfAdjustmentPos(const int32 position) const
 }
 
 
-///*************************************************************************
-// *
-// *
-// *
-// *
-// *************************************************************************/
-//
-//void Read::setTags(const vector<tag_t> & oldtags)
-//{
-//  FUNCSTART("void setTags(const vector<tag_t> & oldtags)");
-//
-//  REA_tags.clear();
-//  REA_tags.resize(oldtags.size());
-//  vector<tag_t>::const_iterator tI=oldtags.begin();
-//  vector<multitag_t>::iterator mI=REA_tags.begin();
-//
-//  for(; tI != oldtags.end(); ++tI, ++mI){
-//    if(tI->identifier=="MIT2"
-//       || tI->identifier=="MINF"){
-//      BUGIFTHROW(true,"Read " << getName() << ": found MINF / MIT2 tag while setting tags. With read groups, should not be anymore, must be parsed out before.");
-//    }
-//    upgradeOldTagToMultitagWithGFF3(*tI,*mI);
-//  }
-//
-//  FUNCEND();
-//}
-
 /*************************************************************************
  *
- * Not multithread capable because of the static variables,
- *  but multithread really not needed here and that's faster
  *
- * If need to be, remove "static"
+ *
  *
  *************************************************************************/
 
-//#define CEBUG(bla) {cout << bla;}
-void Read::upgradeOldTagToMultitagWithGFF3(const multitag_t & oldtag, multitag_t & mt)
+void Read::setTags(const vector<tag_t> & tags)
 {
-  string emptystr;
-  string dummystr;
-
-  string setcomment;
-  string setidentifier;
-
-  string miraitag;
-  string g3source;
-  char   g3strand;
-  uint8  g3phase;
-
-  bool isgff3=GFFParse::checkCommentForGFF3(oldtag.getCommentStr());
-
-  //cout << "###Checked oldmiragbf: " << oldmiraGBFstyle << "\tisgff3: " << isgff3 << "\n" << oldtag;
-
-  if(!isgff3 && oldtag.identifier!=REA_tagentry_idMIT2){
-    CEBUG("non-gff3" << endl);
+  FUNCSTART("void setTags(const vector<tag_t> & tags)");
 
-    setidentifier=oldtag.getIdentifierStr();
-
-    bool oldmiraGBFstyle=GBF::checkIfCommentInOldMIRAGBFstyle(oldtag.getCommentStr());
-
-    // retain compatibility to old MINF tags by doing nothing with the comment itself
-    //  and allow read finction transferMINFTagsToReadInfo() to get what it wants
-    if(oldmiraGBFstyle){
-      GBF::liftOldMIRAGBFCommentToGFF3(oldtag.getCommentStr(),setcomment);
-    }else if(!oldtag.getCommentStr().empty()){
-      setcomment="Note="+oldtag.getCommentStr();
+  vector<tag_t>::const_iterator I=tags.begin();
+  for(;I!=tags.end();I++){
+    try{
+      addTag(*I,false);
     }
-
-    // there will be no GFF3 fields in those ... just called with empty string
-    //  to make sure the g3* variables get default values
-    GFFParse::extractMIRAGFF3InfoFromGFF3Attributes(emptystr,
-						    dummystr,
-						    g3source,
-						    g3strand,
-						    g3phase,
-						    miraitag);
-    g3strand=oldtag.getStrand();
-    if(oldtag.from==oldtag.to) g3strand='.';
-    g3source="MIRA";
-  }else if(oldtag.getCommentStr().empty()){
-    //cout << "isempty\n";
-    // there will be no GFF3 fields in those ... just called with empty string
-    //  to make sure the g3* variables get default values
-    GFFParse::extractMIRAGFF3InfoFromGFF3Attributes(emptystr,
-						    dummystr,
-						    g3source,
-						    g3strand,
-						    g3phase,
-						    miraitag);
-    g3source="MIRA";
-  }else{
-    CEBUG("is-gff3" << endl);
-    GFFParse::extractMIRAGFF3InfoFromGFF3Attributes(oldtag.getCommentStr(),
-						    setcomment,
-						    g3source,
-						    g3strand,
-						    g3phase,
-						    miraitag);
-    if(g3strand=='*'){
-      g3strand=oldtag.getStrand();
-      if(oldtag.from==oldtag.to) g3strand='.';
-    }
-    if(!miraitag.empty()) {
-      //cout << "seen itag\n";
-      setidentifier=miraitag;
-    }else{
-      //cout << "no itag\n";
-      setidentifier=oldtag.getIdentifierStr();
+    catch (Notify n){
+      cout << *I;
+      n.handleError(THISFUNC);
     }
   }
-  mt.from=oldtag.from;
-  mt.to=oldtag.to;
-  mt.comment=multitag_t::newComment(setcomment);
-  mt.identifier=multitag_t::newIdentifier(setidentifier);
-  mt.source=multitag_t::newSource(g3source);
-  mt.setStrand(g3strand);
-  mt.phase=g3phase;
-  mt.commentisgff3=true;
-
-//  cout << "gnagnagna old2\n";
-//  oldtag.dumpDebug(cout);
-//  cout << "gnagnagna new\n";
-//  mt.dumpDebug(cout);
-
-  return;
+  FUNCEND();
 }
-//#define CEBUG(bla)
-
 
 /*************************************************************************
  *
@@ -3930,22 +3961,17 @@ void Read::upgradeOldTagToMultitagWithGFF3(const multitag_t & oldtag, multitag_t
  *
  *************************************************************************/
 
-
 void Read::setTags(const vector<multitag_t> & tags)
 {
-  FUNCSTART("void Read::setTags(const vector<multitag_t> & tags)");
+  FUNCSTART("void setTags(const vector<multitag_t> & tags)");
 
-  vector<multitag_t>::const_iterator tI=tags.begin();
-  for(;tI!=tags.end();tI++){
-    if(tI->identifier==REA_tagentry_idMINF
-       || tI->identifier==REA_tagentry_idMIT2){
-      BUGIFTHROW(true,"Read " << getName() << ": found MINF / MIT2 tag while setting tags. With read groups, should not be anymore, must be parsed out before.");
-    }
+  vector<multitag_t>::const_iterator I=tags.begin();
+  for(;I!=tags.end();I++){
     try{
-      addTagO(*tI);
+      addTag(*I,false);
     }
     catch (Notify n){
-      cout << *tI;
+      cout << *I;
       n.handleError(THISFUNC);
     }
   }
@@ -3960,23 +3986,22 @@ void Read::setTags(const vector<multitag_t> & tags)
  *
  *************************************************************************/
 
-void Read::addTagO(const multitag_t & tag)
+void Read::addTag(const tag_t & tag, bool onlygoodqual)
 {
-  FUNCSTART("void Read::addTag(multitag_t & tag)");
+  FUNCSTART("void Read::addTag(tag_t & tag)");
 
-  paranoiaBUGIF(checkRead()!=nullptr, MIRANOTIFY(Notify::FATAL, checkRead()));
+  paranoiaBUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
+  BUGIFTHROW(tag.to>=getLenSeq(), getName() << ": tag to (" << tag.to << ") >= len of sequence (" << getLenSeq() << ")?");
+  BUGIFTHROW(tag.from>tag.to, getName() << ": tag from (" << tag.from << ") > tag.to (" << tag.to << ")?");
 
-//  //REMOVEME: ?? at the moment, i decided to go for optional parameter
-//  if(onlygoodqual) {
-//    BUGIFTHROW(static_cast<int32>(tag.from)<getLeftClipoff(), getName() << ": from (" << tag.from << ") < getLeftClipoff() (" << getLeftClipoff() << ")?");
-//    BUGIFTHROW(static_cast<int32>(tag.to)>=getRightClipoff(), getName() << ": to (" << tag.to << " >= getRightClipoff() (" << getRightClipoff() << ")?");
-//  }
-
-  BUGIFTHROW(tag.from>=getLenSeq(),"read " << getName() << " : tag.from " << tag.from << " >= getLenSeq() " << getLenSeq() <<" ???");
-  BUGIFTHROW(tag.to>=getLenSeq(),"read " << getName() << " : tag.to " << tag.to << " >= getLenSeq() " << getLenSeq() << " ???");
+  //REMOVEME: ?? at the moment, i decided to go for optional parameter
+  if(onlygoodqual) {
+    BUGIFTHROW(static_cast<int32>(tag.from)<getLeftClipoff(), getName() << ": from (" << tag.from << ") < getLeftClipoff() (" << getLeftClipoff() << ")?");
+    BUGIFTHROW(static_cast<int32>(tag.to)>=getRightClipoff(), getName() << ": to (" << tag.to << " >= getRightClipoff() (" << getRightClipoff() << ")?");
+  }
 
-  // simple check for tag duplicates
-  // TODO: MIRA started to use multiple base tags at this time,
+  // simple check for tag duplicates 
+  // TODO: MIRA started to use multiple base tags at this time, 
   //  so this should be perhaps reworked.
   // New: if tag is already there, then backpack information (comment
   //  at the time) is copied into the location.
@@ -3988,152 +4013,24 @@ void Read::addTagO(const multitag_t & tag)
   for(;I!=REA_tags.end();I++) {
     if(I->from == tag.from
        && I->to == tag.to
-       && I->identifier == tag.identifier
-       && I->getStrand() == tag.getStrand()){
+       && I->strand == tag.strand
+       && I->getIdentifierStr() == tag.identifier) {
       mustaddtag=false;
-      I->comment=tag.comment;
+      I->comment=multitag_t::newComment(tag.comment.c_str());
     }
   }
 
   if(mustaddtag) {
-    REA_tags.push_back(tag);
-    if(tag.to<tag.from) swap(REA_tags.back().to,REA_tags.back().from);
+    REA_tags.resize(REA_tags.size()+1);
+    REA_tags.back()=tag;
   }
 
-  BUGIFTHROW(tag.to>=getLenSeq(), "Read " << getName() << " for tag: " << tag << "\nto (" << tag.to << ") >= len of sequence (" << getLenSeq() << ")?");
-
   FUNCEND();
   return;
 }
 
 
 
-
-///*************************************************************************
-// *
-// *
-// *
-// *
-// *************************************************************************/
-//
-//void Read::addTag(uint32 from, uint32 to,
-//		  const multitag_t::mte_id_t identifier,
-//		  const multitag_t::mte_co_t comment)
-//{
-//  FUNCSTART("void Read::addTag(...)");
-//
-//  paranoiaBUGIF(checkRead()!=nullptr, MIRANOTIFY(Notify::FATAL, checkRead()));
-//  BUGIFTHROW(to>=getLenSeq(), getName() << ": to (" << to << ") >= len of sequence (" << getLenSeq() << ") ?");
-//  BUGIFTHROW(from>to, getName() << ": from (" << from << ") > to (" << to << ") ?");
-//
-//  ////REMOVEME: ?? at the moment, i decided to go for optional parameter
-//  //if(onlygoodqual) {
-//  //  BUGIFTHROW(static_cast<int32>(from)<getLeftClipoff(), "from < getLeftClipoff()?");
-//  //  BUGIFTHROW(static_cast<int32>(to)>=getRightClipoff(), "to >= getRightClipoff()?");
-//  //}
-//
-//  bool mustaddtag=true;
-//  vector<multitag_t>::iterator I=REA_tags.begin();
-//  for(;I!=REA_tags.end();I++) {
-//    if(I->from == from
-//       && I->to == to
-//       && I->identifier == identifier) {
-//      mustaddtag=false;
-//      if(I->comment!=comment){
-//	I->comment=comment;
-//      }
-//    }
-//  }
-//
-//  if(mustaddtag){
-//    REA_tags.resize(REA_tags.size()+1);
-//    REA_tags.back().from=from;
-//    REA_tags.back().to=to;
-//    REA_tags.back().identifier=identifier;
-//    REA_tags.back().setStrand('=');
-//    REA_tags.back().comment=comment;
-//  }
-//
-//  FUNCEND();
-//}
-//
-//
-//
-//
-//
-///*************************************************************************
-// *
-// *
-// *
-// *
-// *************************************************************************/
-//
-//void Read::addTag(uint32 from, uint32 to,
-//		  const multitag_t::mte_id_t identifier,
-//		  const string & comment)
-//{
-//  FUNCSTART("void Read::addTag(...)");
-//
-//  addTag(from,to,
-//	 identifier,
-//	 multitag_t::newComment(comment));
-//
-//  FUNCEND();
-//}
-
-
-
-
-
-///*************************************************************************
-// *
-// *
-// *
-// *
-// *************************************************************************/
-//
-//bool Read::hasTag(const string & identifier, int32 pos) const
-//{
-//  FUNCSTART("bool Read::hasTag(const string & identifier, uint32 pos)");
-//
-//  paranoiaBUGIF(checkRead()!=nullptr, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
-//
-//  BUGIFTHROW(pos>=0 && pos>=static_cast<int32>(REA_qualities.size()),
-//	     getName() << ": pos(" << pos << ") > read size " << REA_qualities.size() << ")?");
-//
-//  // handle case where we don't care about tag position
-//  if(pos<0) {
-//    vector<multitag_t>::const_iterator I=REA_tags.begin();
-//    for(;I!=REA_tags.end();I++) {
-//      if(I->getIdentifierStr()==identifier){
-//	// we found this id in the read, we don't need to examine further
-//	FUNCEND();
-//	return true;
-//      }
-//    }
-//    FUNCEND();
-//    return false;
-//  }
-//
-//  // here we need to care about tag position
-//  vector<multitag_t>::const_iterator I=REA_tags.begin();
-//  for(;I!=REA_tags.end();I++) {
-//    if(static_cast<int32>(I->to) < pos
-//       || static_cast<int32>(I->from) > pos) continue;
-//    // tag at  specified position, check identifier
-//    if(I->getIdentifierStr()==identifier){
-//      // we found this id in the read at that pos,
-//      //  we don't need to examine further
-//      FUNCEND();
-//      return true;
-//    }
-//  }
-//
-//  FUNCEND();
-//  return false;
-//}
-
-
 /*************************************************************************
  *
  *
@@ -4141,11 +4038,48 @@ void Read::addTagO(const multitag_t & tag)
  *
  *************************************************************************/
 
-multitag_t::mte_id_t Read::getTagID(const string & identifier)
+void Read::addTag(const multitag_t & tag, bool onlygoodqual)
 {
-  return multitag_t::hasIdentifier(identifier);
-}
+  FUNCSTART("void Read::addTag(multitag_t & tag)");
+
+  paranoiaBUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
+  BUGIFTHROW(tag.to>=getLenSeq(), getName() << ": tag to (" << tag.to << ") >= len of sequence (" << getLenSeq() << ")?");
+  BUGIFTHROW(tag.from>tag.to, getName() << ": tag from (" << tag.from << ") > tag.to (" << tag.to << ")?");
+
+  //REMOVEME: ?? at the moment, i decided to go for optional parameter
+  if(onlygoodqual) {
+    BUGIFTHROW(static_cast<int32>(tag.from)<getLeftClipoff(), getName() << ": from (" << tag.from << ") < getLeftClipoff() (" << getLeftClipoff() << ")?");
+    BUGIFTHROW(static_cast<int32>(tag.to)>=getRightClipoff(), getName() << ": to (" << tag.to << " >= getRightClipoff() (" << getRightClipoff() << ")?");
+  }
+
+  // simple check for tag duplicates 
+  // TODO: MIRA started to use multiple base tags at this time, 
+  //  so this should be perhaps reworked.
+  // New: if tag is already there, then backpack information (comment
+  //  at the time) is copied into the location.
+  //  Cannot use string.swap() as tag might be present multiple times
+  //   (should not happen, but might be due to loading non-MIRA tags)
+
+  bool mustaddtag=true;
+  vector<multitag_t>::iterator I=REA_tags.begin();
+  for(;I!=REA_tags.end();I++) {
+    if(I->from == tag.from
+       && I->to == tag.to
+       && I->strand == tag.strand
+       && I->identifier == tag.identifier) {
+      mustaddtag=false;
+      I->comment=tag.comment;
+    }
+  }
+
+  if(mustaddtag) {
+    REA_tags.resize(REA_tags.size()+1);
+    REA_tags.back()=tag;
+  }
 
+  FUNCEND();
+  return;
+}
 
 
 /*************************************************************************
@@ -4155,11 +4089,204 @@ multitag_t::mte_id_t Read::getTagID(const string & identifier)
  *
  *************************************************************************/
 
-bool Read::hasTag(const string & identifier, int32 pos) const
+void Read::addTag(uint32 from, uint32 to,
+		  const string & identifier,
+		  const string & comment)
 {
-  multitag_t::mte_id_t id=multitag_t::hasIdentifier(identifier);
-  if(!multitag_t::getIdentifierStr(id).empty()){
-    return hasTag(id,pos);
+  FUNCSTART("void Read::addTag(uint32 from, uint32 to, const string & identifier, const string & comment)");
+
+  paranoiaBUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
+  BUGIFTHROW(to>=getLenSeq(), getName() << ": to (" << to << ") >= len of sequence (" << getLenSeq() << ") ?");
+  BUGIFTHROW(from>to, getName() << ": from (" << from << ") > to (" << to << ") ?");
+
+  ////REMOVEME: ?? at the moment, i decided to go for optional parameter
+  //if(onlygoodqual) {
+  //  BUGIFTHROW(static_cast<int32>(from)<getLeftClipoff(), "from < getLeftClipoff()?");
+  //  BUGIFTHROW(static_cast<int32>(to)>=getRightClipoff(), "to >= getRightClipoff()?");
+  //}
+
+  bool mustaddtag=true;
+  vector<multitag_t>::iterator I=REA_tags.begin();
+  for(;I!=REA_tags.end();I++) {
+    if(I->from == from
+       && I->to == to
+       && I->getIdentifierStr() == identifier) {
+      mustaddtag=false;
+      if(!I->getCommentStr().empty()
+	 || !comment.empty()){
+	I->comment=multitag_t::newComment(comment);
+      }
+    }
+  }
+
+  if(mustaddtag){
+    REA_tags.resize(REA_tags.size()+1);
+    REA_tags.back().from=from;
+    REA_tags.back().to=to;
+    REA_tags.back().identifier=multitag_t::newIdentifier(identifier);
+    REA_tags.back().strand='=';
+    if(!comment.empty()){
+      REA_tags.back().comment=multitag_t::newComment(comment);
+    }
+  }
+
+  FUNCEND();
+}
+
+
+
+
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+
+void Read::addTag(uint32 from, uint32 to,
+		  const multitag_t::mte_id_t identifier,
+		  const multitag_t::mte_co_t comment)
+{
+  FUNCSTART("void Read::addTag(...)");
+
+  paranoiaBUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
+  BUGIFTHROW(to>=getLenSeq(), getName() << ": to (" << to << ") >= len of sequence (" << getLenSeq() << ") ?");
+  BUGIFTHROW(from>to, getName() << ": from (" << from << ") > to (" << to << ") ?");
+
+  ////REMOVEME: ?? at the moment, i decided to go for optional parameter
+  //if(onlygoodqual) {
+  //  BUGIFTHROW(static_cast<int32>(from)<getLeftClipoff(), "from < getLeftClipoff()?");
+  //  BUGIFTHROW(static_cast<int32>(to)>=getRightClipoff(), "to >= getRightClipoff()?");
+  //}
+
+  bool mustaddtag=true;
+  vector<multitag_t>::iterator I=REA_tags.begin();
+  for(;I!=REA_tags.end();I++) {
+    if(I->from == from
+       && I->to == to
+       && I->identifier == identifier) {
+      mustaddtag=false;
+      if(I->comment!=comment){
+	I->comment=comment;
+      }
+    }
+  }
+
+  if(mustaddtag){
+    REA_tags.resize(REA_tags.size()+1);
+    REA_tags.back().from=from;
+    REA_tags.back().to=to;
+    REA_tags.back().identifier=identifier;
+    REA_tags.back().strand='=';
+    REA_tags.back().comment=comment;
+  }
+
+  FUNCEND();
+}
+
+
+
+
+
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+
+void Read::addTag(uint32 from, uint32 to,
+		  const multitag_t::mte_id_t identifier,
+		  const string & comment)
+{
+  FUNCSTART("void Read::addTag(...)");
+
+  addTag(from,to,
+	 identifier,
+	 multitag_t::newComment(comment));
+
+  FUNCEND();
+}
+
+
+
+
+
+///*************************************************************************
+// *
+// *
+// *
+// *
+// *************************************************************************/
+//
+//bool Read::hasTag(const string & identifier, int32 pos) const
+//{
+//  FUNCSTART("bool Read::hasTag(const string & identifier, uint32 pos)");
+//
+//  paranoiaBUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
+//  
+//  BUGIFTHROW(pos>=0 && pos>=static_cast<int32>(REA_qualities.size()),
+//	     getName() << ": pos(" << pos << ") > read size " << REA_qualities.size() << ")?");
+//
+//  // handle case where we don't care about tag position
+//  if(pos<0) {
+//    vector<multitag_t>::const_iterator I=REA_tags.begin();
+//    for(;I!=REA_tags.end();I++) {
+//      if(I->getIdentifierStr()==identifier){
+//	// we found this id in the read, we don't need to examine further
+//	FUNCEND();
+//	return true;
+//      }
+//    }
+//    FUNCEND();
+//    return false;
+//  }
+//
+//  // here we need to care about tag position
+//  vector<multitag_t>::const_iterator I=REA_tags.begin();
+//  for(;I!=REA_tags.end();I++) {
+//    if(static_cast<int32>(I->to) < pos
+//       || static_cast<int32>(I->from) > pos) continue;
+//    // tag at  specified position, check identifier
+//    if(I->getIdentifierStr()==identifier){
+//      // we found this id in the read at that pos, 
+//      //  we don't need to examine further
+//      FUNCEND();
+//      return true;
+//    }
+//  }
+//
+//  FUNCEND();
+//  return false;
+//}
+
+
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+
+multitag_t::mte_id_t Read::getTagID(const string & identifier)
+{
+  return multitag_t::hasIdentifier(identifier);
+}
+
+
+
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+
+bool Read::hasTag(const string & identifier, int32 pos) const
+{
+  multitag_t::mte_id_t id=multitag_t::hasIdentifier(identifier);
+  if(!multitag_t::getIdentifierStr(id).empty()){
+    return hasTag(id,pos);
   }
   return false;
 }
@@ -4176,8 +4303,8 @@ bool Read::hasTag(const multitag_t::mte_id_t identifier, int32 pos) const
 {
   FUNCSTART("Read::hasTag(const multitag_t::mte_id_t identifier, int32 pos) const");
 
-  paranoiaBUGIF(checkRead()!=nullptr, MIRANOTIFY(Notify::FATAL, checkRead()));
-
+  paranoiaBUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
+  
   BUGIFTHROW(pos>=0 && pos>=static_cast<int32>(REA_qualities.size()),
 	     getName() << ": pos(" << pos << ") > read size " << REA_qualities.size() << ")?");
 
@@ -4202,7 +4329,7 @@ bool Read::hasTag(const multitag_t::mte_id_t identifier, int32 pos) const
        || static_cast<int32>(I->from) > pos) continue;
     // tag at  specified position, check identifier
     if(I->identifier==identifier){
-      // we found this id in the read at that pos,
+      // we found this id in the read at that pos, 
       //  we don't need to examine further
       FUNCEND();
       return true;
@@ -4224,8 +4351,8 @@ bool Read::hasTag(const multitag_t::mte_id_t identifier, int32 pos) const
 //{
 //  FUNCSTART("bool Read::countTags(const string & identifier, uint32 pos)");
 //
-//  paranoiaBUGIF(checkRead()!=nullptr, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
-//
+//  paranoiaBUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
+//  
 //  BUGIFTHROW(pos>=0 && pos>=static_cast<int32>(REA_qualities.size()),
 //	     getName() << ": pos(" << pos << ") > read size " << REA_qualities.size() << ")?");
 //
@@ -4268,8 +4395,8 @@ uint32 Read::countTags(const multitag_t::mte_id_t identifier, int32 pos) const
 {
   FUNCSTART("uint32 Read::countTags(const multitag_t::mte_id_t identifier, int32 pos) const");
 
-  paranoiaBUGIF(checkRead()!=nullptr, MIRANOTIFY(Notify::FATAL, checkRead()));
-
+  paranoiaBUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
+  
   BUGIFTHROW(pos>=0 && pos>=static_cast<int32>(REA_qualities.size()),
 	     getName() << ": pos(" << pos << ") > read size " << REA_qualities.size() << ")?");
 
@@ -4309,11 +4436,11 @@ uint32 Read::countTags(const multitag_t::mte_id_t identifier, int32 pos) const
  *
  *************************************************************************/
 
-const multitag_t & Read::getTag(uint32 tagnumber) const
+const multitag_t & Read::getTag(uint32 tagnumber) const 
 {
   FUNCSTART("const multitag_t & Read::getTag(uint32 tagnumber) const");
 
-  paranoiaBUGIF(checkRead()!=nullptr, MIRANOTIFY(Notify::FATAL, checkRead()));
+  paranoiaBUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
   BUGIFTHROW(tagnumber >= REA_tags.size(),
 	     getName() << ": tagnumber (" << tagnumber << ") >= REA_tags.size (" << REA_tags.size() << ") ?");
 
@@ -4332,23 +4459,23 @@ const multitag_t & Read::getTag(uint32 tagnumber) const
  *
  *
  *************************************************************************/
-void Read::helper_refreshPaddedSequence() const
+void Read::refreshPaddedSequence()
 {
-  FUNCSTART("void Read::helper_refreshPaddedSequence()");
-
+  FUNCSTART("void Read::refreshPaddedSequence()");
+  
   if(REA_ps_dirty==true){
-    BUGIFTHROW(REA_pcs_dirty==true, "Both seq and compl.seq. are tagged dirty.");
-    BUGIFTHROW(checkRead()!=nullptr, checkRead());
+    if(REA_pcs_dirty==true){
+      throw Notify(Notify::FATAL, THISFUNC, "Both seq and compl.seq. are tagged dirty.");
+    }
+    BUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
 
     makeComplement(REA_padded_complementsequence, REA_padded_sequence);
     CEBUG("Refreshed.\n");
     REA_ps_dirty=false;
 
-    if(sanityCheck()!=nullptr){
-      setCoutType(AS_TEXT);
-      cout << *this;
-      MIRANOTIFY(Notify::FATAL, sanityCheck());
-    }
+    BUGIF(sanityCheck()!=NULL, cout << *this);
+    BUGIF(sanityCheck()!=NULL, throw Notify(Notify::FATAL, THISFUNC, sanityCheck()));
+
   }
 
   FUNCEND();
@@ -4364,22 +4491,22 @@ void Read::helper_refreshPaddedSequence() const
  *
  *************************************************************************/
 
-void Read::helper_refreshPaddedComplementSequence() const
+void Read::refreshPaddedComplementSequence()
 {
-  FUNCSTART("void Read::helper_refreshPaddedComplementSequence()");
-
-  if(REA_pcs_dirty){
-    BUGIFTHROW(REA_ps_dirty, "Both seq and compl.seq. are tagged dirty.");
-    BUGIFTHROW(checkRead()!=nullptr, checkRead());
+  FUNCSTART("void Read::refreshPaddedComplementSequence()");
+  
+  if(REA_pcs_dirty==true){
+    if(REA_ps_dirty==true){
+      throw Notify(Notify::FATAL, THISFUNC, "Both seq and compl.seq. are tagged dirty.");
+    }
+    BUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
 
     CEBUG("Refreshed.\n");
     makeComplement(REA_padded_sequence, REA_padded_complementsequence);
     REA_pcs_dirty=false;
-    if(sanityCheck()!=nullptr){
-      setCoutType(AS_TEXT);
-      cout << *this;
-      MIRANOTIFY(Notify::FATAL, sanityCheck());
-    }
+    BUGIF(sanityCheck()!=NULL, cout << *this);
+    BUGIF(sanityCheck()!=NULL, throw Notify(Notify::FATAL, THISFUNC, sanityCheck()));
+
   }
 
   FUNCEND();
@@ -4416,7 +4543,7 @@ void Read::insertBaseInSequence(char base, base_quality_t quality, uint32 positi
 {
   FUNCSTART("void Read::insertBaseInSequence(char base, base_quality_t quality, int32 position, bool extends_clipped_area)");
 
-  BUGIFTHROW(checkRead()!=nullptr, checkRead());
+  BUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
 
   CEBUG("Position: " << position << endl);
 
@@ -4426,13 +4553,17 @@ void Read::insertBaseInSequence(char base, base_quality_t quality, uint32 positi
 				   static_cast<uint32>(REA_padded_complementsequence.size())-position,
 				   extends_clipped_area);
   }else{
+    if(position>REA_padded_sequence.size()){
+      throw Notify(Notify::FATAL, THISFUNC, "Position > size of read?");
+    }
+
     refreshPaddedSequence();
-    BUGIFTHROW(position>REA_padded_sequence.size(),getName() << ": position (" << position << ") > REA_padded_sequence.size (" << REA_padded_sequence.size() << ") ?");
 
     moderateContainerGrowth();
 
     {
       vector<char>::iterator I=REA_padded_sequence.begin();
+      BUGIFTHROW(position>REA_padded_sequence.size(),getName() << ": position (" << position << ") > REA_padded_sequence.size (" << REA_padded_sequence.size() << ") ?");
       advance(I, position);
       REA_padded_sequence.insert(I, base);
     }
@@ -4453,16 +4584,6 @@ void Read::insertBaseInSequence(char base, base_quality_t quality, uint32 positi
       REA_adjustments.insert(K, -1);
     }
 
-    // insert 1 into RLE value vector, as this base is not in the
-    //  original sequence
-    // strictly speaking, this may now not be an RLE vector now ... but it's how MIRA needs it
-    if(REA_rlevptr!=nullptr){
-      auto K=REA_rlevptr->begin();
-      BUGIFTHROW(position > REA_rlevptr->size(),getName() << ": position (" << position << " > REA_rlevptr->size (" << REA_rlevptr->size() << ") ?");
-      advance(K, position);
-      REA_rlevptr->insert(K, 1);
-    }
-
     // insert baseflags into baseflags_t vector (with defaults)
     {
       vector<bposhashstat_t>::iterator B=REA_bposhashstats.begin();
@@ -4506,7 +4627,7 @@ void Read::insertBaseInSequence(char base, base_quality_t quality, uint32 positi
 //  REA_char_seq_dirty=true;
 //  REA_char_cseq_dirty=true;
 
-  BUGIFTHROW(sanityCheck()!=nullptr, sanityCheck());
+  BUGIF(sanityCheck()!=NULL, throw Notify(Notify::FATAL, THISFUNC, sanityCheck()));
 
   FUNCEND();
 }
@@ -4523,7 +4644,7 @@ void Read::updateTagBaseInserted(uint32 position)
 {
   FUNCSTART("void Read::updateTagInsert(uint32 position)");
 
-  paranoiaBUGIF(checkRead()!=nullptr, MIRANOTIFY(Notify::FATAL, checkRead()));
+  paranoiaBUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
 
   vector<multitag_t>::iterator tI=REA_tags.begin();
   for(;tI!=REA_tags.end();tI++){
@@ -4544,7 +4665,7 @@ void Read::updateTagBaseDeleted(uint32 position)
 {
   FUNCSTART("void Read::updateTagBaseDeleted(int32 position)");
 
-  paranoiaBUGIF(checkRead()!=nullptr, MIRANOTIFY(Notify::FATAL, checkRead()));
+  paranoiaBUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
 
   vector<multitag_t>::iterator tI=REA_tags.begin();
   while(tI!=REA_tags.end()){
@@ -4573,19 +4694,23 @@ void Read::deleteBaseFromSequence(uint32 position)
 {
   FUNCSTART("void Read::deleteBaseFromSequence(int32 position)");
 
-  BUGIFTHROW(checkRead()!=nullptr, checkRead());
+  BUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
 
   CEBUG("Position: " << position << endl);
 
   if(REA_ps_dirty==true && REA_pcs_dirty==false){
     deleteBaseFromComplementSequence(static_cast<uint32>(REA_padded_complementsequence.size())-position-1);
   }else{
+    if(position>=REA_padded_sequence.size()){
+      throw Notify(Notify::FATAL, THISFUNC, "Position >= size of read?");
+    }
+
     refreshPaddedSequence();
-    BUGIFTHROW(position>=REA_padded_sequence.size(),getName() << ": position (" << position << ") >= REA_padded_sequence.size (" << REA_padded_sequence.size() << ") ?");
 
     {
       vector<char>::iterator I=REA_padded_sequence.begin();
       //BOUNDCHECK(position, 0, REA_padded_sequence.size());
+      BUGIFTHROW(position>=REA_padded_sequence.size(),getName() << ": position (" << position << ") >= REA_padded_sequence.size (" << REA_padded_sequence.size() << ") ?");
       advance(I, position);
       REA_padded_sequence.erase(I);
     }
@@ -4606,16 +4731,6 @@ void Read::deleteBaseFromSequence(uint32 position)
       REA_adjustments.erase(K);
     }
 
-    // for RLE reads, this does not only delete a base, but eventually a whole
-    //  stretch
-    // That's OK for now, MIRA needs it that way.
-    if(REA_rlevptr!=nullptr){
-      auto K=REA_rlevptr->begin();
-      BUGIFTHROW(position >= REA_rlevptr->size(),getName() << ": position (" << position << " >= REA_rlevptr->size (" << REA_rlevptr->size() << ") ?");
-      advance(K, position);
-      REA_rlevptr->erase(K);
-    }
-
     {
       vector<bposhashstat_t>::iterator B=REA_bposhashstats.begin();
       //BOUNDCHECK(position, 0, REA_bposhashstats.size());
@@ -4626,8 +4741,8 @@ void Read::deleteBaseFromSequence(uint32 position)
 
     REA_pcs_dirty=true;
 
-    // FALSCH! was <, but I think that was wrong. <= should be right
-    // TODO: was <, but I think that was wrong. <= should be right
+    // FALSCH! was <, but I think that was wrong. <= should be right 
+    // TODO: was <, but I think that was wrong. <= should be right 
     if(static_cast<int32>(position)<REA_ql && REA_ql > 0) REA_ql--;
     if(static_cast<int32>(position)<REA_qr && REA_qr > 0) REA_qr--;
     if(static_cast<int32>(position)<REA_ml && REA_ml > 0) REA_ml--;
@@ -4647,7 +4762,7 @@ void Read::deleteBaseFromSequence(uint32 position)
 //  REA_char_seq_dirty=true;
 //  REA_char_cseq_dirty=true;
 
-  BUGIFTHROW(checkRead()!=nullptr, checkRead());
+  BUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
 
   FUNCEND();
 }
@@ -4666,7 +4781,7 @@ void Read::insertBaseInComplementSequence(char base, base_quality_t quality, uin
 {
   FUNCSTART("void Read::insertBaseInComplementSequence(char base, base_quality_t quality, int32 position, bool extends_clipped_area)");
 
-  BUGIFTHROW(checkRead()!=nullptr, checkRead());
+  BUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
 
   CEBUG("Position: " << position << endl);
 
@@ -4676,9 +4791,12 @@ void Read::insertBaseInComplementSequence(char base, base_quality_t quality, uin
 			 static_cast<uint32>(REA_padded_sequence.size())-position,
 			 extends_clipped_area);
   }else{
-    refreshPaddedComplementSequence();
+    if(position>REA_padded_complementsequence.size()){
+      cout << *this;
+      throw Notify(Notify::FATAL, THISFUNC, "Position > size of read?");
+    }
 
-    BUGIFTHROW(position>=REA_padded_complementsequence.size(),getName() << ": position (" << position << ") >= REA_padded_complementsequence.size (" << REA_padded_sequence.size() << ") ?");
+    refreshPaddedComplementSequence();
 
     moderateContainerGrowth();
 
@@ -4710,16 +4828,6 @@ void Read::insertBaseInComplementSequence(char base, base_quality_t quality, uin
       REA_adjustments.insert(K, -1);
     }
 
-    // insert 1 into RLE value vector, as this base is not in the
-    //  original sequence
-    // strictly speaking, this may now not be an RLE vector now ... but it's how MIRA needs it
-    if(REA_rlevptr!=nullptr){
-      auto K=REA_rlevptr->begin();
-      BUGIFTHROW(complement_position > REA_rlevptr->size(),getName() << ": complement_position (" << complement_position << " > REA_rlevptr->size (" << REA_rlevptr->size() << ") ?");
-      advance(K, complement_position);
-      REA_rlevptr->insert(K, 1);
-    }
-
     // insert baseflags into baseflags_t vector (with defaults)
     {
       vector<bposhashstat_t>::iterator B=REA_bposhashstats.begin();
@@ -4762,7 +4870,7 @@ void Read::insertBaseInComplementSequence(char base, base_quality_t quality, uin
 //  REA_char_seq_dirty=true;
 //  REA_char_cseq_dirty=true;
 
-  BUGIFTHROW(checkRead()!=nullptr, checkRead());
+  BUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
 
   FUNCEND();
 }
@@ -4782,15 +4890,17 @@ void Read::deleteBaseFromComplementSequence(uint32 position)
 {
   FUNCSTART("void Read::deleteBaseFromComplementSequence(int32 uposition)");
 
-  BUGIFTHROW(checkRead()!=nullptr, checkRead());
+  BUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
   CEBUG("Position: " << position << endl);
 
   if(REA_pcs_dirty==true && REA_ps_dirty==false){
     deleteBaseFromSequence(static_cast<uint32>(REA_padded_sequence.size())-position-1);
   }else{
-    refreshPaddedComplementSequence();
+    if(position > REA_padded_complementsequence.size()){
+      throw Notify(Notify::FATAL, THISFUNC, "Position >= size of read?");
+    }
 
-    BUGIFTHROW(position>=REA_padded_complementsequence.size(),getName() << ": position (" << position << ") >= REA_padded_complementsequence.size (" << REA_padded_sequence.size() << ") ?");
+    refreshPaddedComplementSequence();
 
     uint32 complement_position=static_cast<uint32>(REA_padded_complementsequence.size())-position-1;
 
@@ -4818,16 +4928,6 @@ void Read::deleteBaseFromComplementSequence(uint32 position)
       REA_adjustments.erase(K);
     }
 
-    // for RLE reads, this does not only delete a base, but eventually a whole
-    //  stretch
-    // That's OK for now, MIRA needs it that way.
-    if(REA_rlevptr!=nullptr){
-      auto K=REA_rlevptr->begin();
-      BUGIFTHROW(complement_position >= REA_rlevptr->size(),getName() << ": position (" << complement_position << " >= REA_rlevptr->size (" << REA_rlevptr->size() << ") ?");
-      advance(K, complement_position);
-      REA_rlevptr->erase(K);
-    }
-
     {
       vector<bposhashstat_t>::iterator B=REA_bposhashstats.begin();
       //BOUNDCHECK(complement_position, 0, REA_bposhashstats.size());
@@ -4838,8 +4938,8 @@ void Read::deleteBaseFromComplementSequence(uint32 position)
 
     REA_ps_dirty=true;
 
-    // TODO: was <, but I think that was wrong. <= should be right
-    // update: <= is wrong, due to new complpos calc, < should be right
+    // TODO: was <, but I think that was wrong. <= should be right 
+    // update: <= is wrong, due to new complpos calc, < should be right 
     if(static_cast<int32>(complement_position)<REA_ql && REA_ql > 0) REA_ql--;
     if(static_cast<int32>(complement_position)<REA_sl && REA_sl > 0) REA_sl--;
     if(static_cast<int32>(complement_position)<REA_ml && REA_ml > 0) REA_ml--;
@@ -4856,7 +4956,7 @@ void Read::deleteBaseFromComplementSequence(uint32 position)
 
   }
 
-  BUGIFTHROW(checkRead()!=nullptr, checkRead());
+  BUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
 
 //  REA_char_seq_dirty=true;
 //  REA_char_cseq_dirty=true;
@@ -4871,7 +4971,7 @@ void Read::deleteBaseFromComplementSequence(uint32 position)
 
 /*************************************************************************
  *
- * qual==255 -> no qual change
+ *
  *
  *
  *tested
@@ -4881,26 +4981,25 @@ void Read::changeBaseInSequence(char base, base_quality_t quality, uint32 positi
 {
   FUNCSTART("void changeBaseInSequence(char base, base_quality_t quality, int32 position)");
 
-  BUGIFTHROW(checkRead()!=nullptr, checkRead());
+  BUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
 
   CEBUG("Position: " << position << endl);
 
   if(REA_ps_dirty==false){
     CEBUG("ps clean\n");
-    BUGIFTHROW(position>=REA_padded_sequence.size(), getName() << ": position (" << position << ") >= size of read (" << REA_padded_sequence.size() << ")?");
-
+    if(position>=REA_padded_sequence.size()){
+      throw Notify(Notify::FATAL, THISFUNC, "Position >= size of read?");
+    }
     vector<char>::iterator I=REA_padded_sequence.begin();
     //BOUNDCHECK(position, 0, REA_padded_sequence.size());
     advance(I, position);
     *I=base;
 
-    if(quality!=255){
-      vector<base_quality_t>::iterator J=REA_qualities.begin();
-      //BOUNDCHECK(position, 0, REA_qualities.size());
-      BUGIFTHROW(position>=REA_qualities.size(),getName() << ": position (" << position << ") >= REA_qualities.size (" << REA_qualities.size() << ") ?");
-      advance(J,position);
-      *J=quality;
-    }
+    vector<base_quality_t>::iterator J=REA_qualities.begin();
+    //BOUNDCHECK(position, 0, REA_qualities.size());
+    BUGIFTHROW(position>=REA_qualities.size(),getName() << ": position (" << position << ") >= REA_qualities.size (" << REA_qualities.size() << ") ?");
+    advance(J,position);
+    *J=quality;
   }
 
   if(REA_pcs_dirty==false){
@@ -4916,13 +5015,11 @@ void Read::changeBaseInSequence(char base, base_quality_t quality, uint32 positi
     advance(I, cposition);
     *I=dptools::getComplementIUPACBase(base);
 
-    if(quality!=255){
-      vector<base_quality_t>::iterator J=REA_qualities.begin();
-      //BOUNDCHECK(position, 0, REA_qualities.size());
-      BUGIFTHROW(position>=REA_qualities.size(),getName() << ": position (" << position << ") >= REA_qualities.size (" << REA_qualities.size() << ") ?");
-      advance(J, position);
-      *J=quality;
-    }
+    vector<base_quality_t>::iterator J=REA_qualities.begin();
+    //BOUNDCHECK(position, 0, REA_qualities.size());
+    BUGIFTHROW(position>=REA_qualities.size(),getName() << ": position (" << position << ") >= REA_qualities.size (" << REA_qualities.size() << ") ?");
+    advance(J, position);
+    *J=quality;
   }
 
 
@@ -4932,7 +5029,7 @@ void Read::changeBaseInSequence(char base, base_quality_t quality, uint32 positi
     *B=REA_bposhashstat_default;
   }
 
-  BUGIFTHROW(checkRead()!=nullptr, checkRead());
+  BUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
 
   FUNCEND();
 }
@@ -4975,7 +5072,7 @@ void Read::changeAdjustment(uint32 position, int32 newadjustment)
 {
   FUNCSTART("void Read::changeAdjustment(uint32 position, int32 newadjustment)");
 
-  BUGIFTHROW(checkRead()!=nullptr, checkRead());
+  BUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
 
   BUGIFTHROW(REA_adjustments.empty(), getName() << ": trying to change adjustment in read which does not have any?");
   BUGIFTHROW(position>=REA_adjustments.size(), getName() << ": trying to change adjustment at position " << position << " but size of adjustment is only " << REA_adjustments.size());
@@ -4996,10 +5093,12 @@ void Read::changeAdjustment(uint32 position, int32 newadjustment)
 void Read::insertBaseInClippedSequence(char base, base_quality_t quality, uint32 position, bool extends_clipped_area)
 {
   FUNCSTART("void Read::insertBaseInClippedSequence(char base, base_quality_t quality, uint32 position, bool extends_clipped_area)");
-
+  
   CEBUG("Position: " << position << endl);
 
-  BUGIFTHROW(static_cast<int32>(position)>getLenClippedSeq(), "Position > len of clipped read ?");
+  if(static_cast<int32>(position)>getLenClippedSeq()){
+    throw Notify(Notify::FATAL, THISFUNC, "Position > len of clipped read ?");
+  }
 
   insertBaseInSequence(base, quality, position+getLeftClipoff(),
 		       extends_clipped_area);
@@ -5023,7 +5122,9 @@ void Read::deleteBaseFromClippedSequence(uint32 position)
 
   CEBUG("Position: " << position << endl);
 
-  BUGIFTHROW(static_cast<int32>(position)>=getLenClippedSeq(), "Position >= len of clipped read ?");
+  if(static_cast<int32>(position)>=getLenClippedSeq()){
+    throw Notify(Notify::FATAL, THISFUNC, "Position >= len of clipped read ?");
+  }
 
   deleteBaseFromSequence(position+getLeftClipoff());
 
@@ -5042,10 +5143,12 @@ void Read::deleteBaseFromClippedSequence(uint32 position)
 void Read::insertBaseInClippedComplementSequence(char base, base_quality_t quality, uint32 position, bool extends_clipped_area)
 {
   FUNCSTART("void Read::insertBaseInClippedComplementSequence(char base, base_quality_t quality, int32 position, bool extends_clipped_area)");
-
+  
   CEBUG("Position: " << position << endl);
 
-  BUGIFTHROW(static_cast<int32>(position)>getLenClippedSeq(), "Position > len of clipped read ?");
+  if(static_cast<int32>(position)>getLenClippedSeq()){
+    throw Notify(Notify::FATAL, THISFUNC, "Position > len of clipped read ?");
+  }
 
   insertBaseInComplementSequence(base, quality,
 				 getLenSeq()-getRightClipoff()+position,
@@ -5070,7 +5173,9 @@ void Read::deleteBaseFromClippedComplementSequence(uint32 position)
 
   CEBUG("Position: " << position << endl);
 
-  BUGIFTHROW(static_cast<int32>(position)>=getLenClippedSeq(), "Position >= len of clipped read ?");
+  if(static_cast<int32>(position)>=getLenClippedSeq()){
+    throw Notify(Notify::FATAL, THISFUNC, "Position >= len of clipped read ?");
+  }
 
   deleteBaseFromComplementSequence(getLenSeq()-getRightClipoff()+position);
 
@@ -5093,10 +5198,12 @@ void Read::changeBaseInClippedSequence(char base, base_quality_t quality, uint32
 
   CEBUG("Position: " << position << endl);
 
-  BUGIFTHROW(static_cast<int32>(position)>=getLenClippedSeq(), "Position >= len of clipped read ?");
+  if(static_cast<int32>(position)>=getLenClippedSeq()){
+    throw Notify(Notify::FATAL, THISFUNC, "Position >= len of clipped read ?");
+  }
 
   changeBaseInSequence(base, quality, getLeftClipoff()+position);
-
+  
   FUNCEND();
 }
 
@@ -5115,10 +5222,12 @@ void Read::changeBaseInClippedComplementSequence(char base, base_quality_t quali
 
   CEBUG("Position: " << position << endl);
 
-  BUGIFTHROW(static_cast<int32>(position)>=getLenClippedSeq(), "Position >= len of clipped read ?");
+  if(static_cast<int32>(position)>=getLenClippedSeq()){
+    throw Notify(Notify::FATAL, THISFUNC, "Position >= len of clipped read ?");
+  }
 
   changeBaseInComplementSequence(base, quality, getLenSeq()-getRightClipoff()+position);
-
+  
   FUNCEND();
 }
 
@@ -5127,25 +5236,25 @@ void Read::changeBaseInClippedComplementSequence(char base, base_quality_t quali
 
 
 
-///*************************************************************************
-// *
-// *
-// *
-// *tested
-// *************************************************************************/
-//uint32 Read::getLenSeq() const
-//{
-//  FUNCSTART("uint32 Read::getLenSeq() const");
-//
-//  paranoiaBUGIF(checkRead()!=nullptr, MIRANOTIFY(Notify::FATAL, checkRead()));
-//
-//  FUNCEND();
-//  if(REA_ps_dirty==false){
-//    return static_cast<uint32>(REA_padded_sequence.size());
-//  }else{
-//    return static_cast<uint32>(REA_padded_complementsequence.size());
-//  }
-//}
+/*************************************************************************
+ *
+ *
+ *
+ *tested
+ *************************************************************************/
+uint32 Read::getLenSeq() const
+{
+  FUNCSTART("uint32 Read::getLenSeq() const");
+  
+  paranoiaBUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
+
+  FUNCEND();
+  if(REA_ps_dirty==false){
+    return static_cast<uint32>(REA_padded_sequence.size());
+  }else{
+    return static_cast<uint32>(REA_padded_complementsequence.size());
+  }
+}
 
 /*************************************************************************
  *
@@ -5161,8 +5270,8 @@ const vector<char> & Read::getActualSequence() const
 {
   FUNCSTART("const vector<char> & Read::getActualSequence() const");
 
-  paranoiaBUGIF(checkRead()!=nullptr, MIRANOTIFY(Notify::FATAL, checkRead()));
-  refreshPaddedSequence();
+  paranoiaBUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
+  const_cast<Read *>(this)->refreshPaddedSequence();
 
   FUNCEND();
   return REA_padded_sequence;
@@ -5176,8 +5285,8 @@ const vector<char> & Read::getActualComplementSequence() const
 {
   FUNCSTART("const vector<char> & Read::getActualComplementSequence() const");
 
-  paranoiaBUGIF(checkRead()!=nullptr, MIRANOTIFY(Notify::FATAL, checkRead()));
-  refreshPaddedComplementSequence();
+  paranoiaBUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
+  const_cast<Read *>(this)->refreshPaddedComplementSequence();
 
   FUNCEND();
   return REA_padded_complementsequence;
@@ -5197,11 +5306,11 @@ const char * Read::getClippedSeqAsChar() const
 {
   FUNCSTART("const char * Read::getClippedSeqAsChar()");
 
-  paranoiaBUGIF(checkRead()!=nullptr, MIRANOTIFY(Notify::FATAL, checkRead()));
+  paranoiaBUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
 
-  refreshPaddedSequence();
+  const_cast<Read *>(this)->refreshPaddedSequence();
 
-  if(REA_padded_sequence.empty()||getLeftClipoff()==REA_padded_sequence.size()) return &REA_zerostring;
+  if(REA_padded_sequence.empty()) return &REA_zerostring;
 
   vector<char>::const_iterator cI=REA_padded_sequence.begin();
   BOUNDCHECK(getLeftClipoff(), 0, static_cast<int32>(REA_padded_sequence.size()));
@@ -5217,13 +5326,15 @@ const char * Read::getClippedSeqAsChar() const
  *
  *tested
  *************************************************************************/
+// This should be const
+// too, but SGI CC 7.1 doesn't know the keyword mutable
 const char * Read::getSeqAsChar() const
 {
   FUNCSTART("const char * Read::getSeqAsChar()");
 
-  paranoiaBUGIF(checkRead()!=nullptr, MIRANOTIFY(Notify::FATAL, checkRead()));
+  paranoiaBUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
 
-  refreshPaddedSequence();
+  const_cast<Read *>(this)->refreshPaddedSequence();
 
   if(REA_padded_sequence.empty()) return &REA_zerostring;
 
@@ -5232,84 +5343,41 @@ const char * Read::getSeqAsChar() const
 }
 
 
+
+
 /*************************************************************************
  *
  *
  *
  *tested
  *************************************************************************/
-const char * Read::getComplementSeqAsChar() const
+
+// This should be const
+// too, but SGI CC 7.1 doesn't know the keyword mutable
+const char * Read::getClippedComplementSeqAsChar() const
 {
-  FUNCSTART("const char * Read::getComplementSeqAsChar()");
+  FUNCSTART("const char * Read::getClippedComplementSeqAsChar()");
 
-  paranoiaBUGIF(checkRead()!=nullptr, MIRANOTIFY(Notify::FATAL, checkRead()));
+  paranoiaBUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
 
-  refreshPaddedComplementSequence();
+  const_cast<Read *>(this)->refreshPaddedComplementSequence();
 
   if(REA_padded_complementsequence.empty()) return &REA_zerostring;
 
   vector<char>::const_iterator cI=REA_padded_complementsequence.begin();
+  BOUNDCHECK(static_cast<int32>(REA_padded_complementsequence.size())-getRightClipoff(), 0, static_cast<int32>(REA_padded_complementsequence.size()));
+  advance(cI, REA_padded_complementsequence.size()-getRightClipoff());
+  
   return &(*cI);
 }
 
 
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-void Read::getSeqAsString(string & result)
-{
-  paranoiaBUGIF(checkRead()!=nullptr, MIRANOTIFY(Notify::FATAL, checkRead()));
-
-  refreshPaddedSequence();
-
-  vector<char>::const_iterator cI=REA_padded_sequence.begin();
-  result.resize(getLenSeq());
-  string::iterator sI=result.begin();
-  for(; cI != REA_padded_sequence.end(); ++cI, ++sI){
-    *sI=*cI;
-  }
-  return;
-}
-
 
 
 
 /*************************************************************************
  *
- *
- *
- *tested
- *************************************************************************/
-
-// This should be const
-// too, but SGI CC 7.1 doesn't know the keyword mutable
-const char * Read::getClippedComplementSeqAsChar() const
-{
-  FUNCSTART("const char * Read::getClippedComplementSeqAsChar()");
-
-  paranoiaBUGIF(checkRead()!=nullptr, MIRANOTIFY(Notify::FATAL, checkRead()));
-
-  refreshPaddedComplementSequence();
-
-  if(REA_padded_complementsequence.empty()) return &REA_zerostring;
-
-  vector<char>::const_iterator cI=REA_padded_complementsequence.begin();
-  BOUNDCHECK(static_cast<int32>(REA_padded_complementsequence.size())-getRightClipoff(), 0, static_cast<int32>(REA_padded_complementsequence.size())+1);
-  advance(cI, REA_padded_complementsequence.size()-getRightClipoff());
-
-  return &(*cI);
-}
-
-
-
-
-
-/*************************************************************************
- *
- * Returns an iterator to the sequencing vector and quality clipped read
+ * Returns an iterator to the sequencing vector and quality clipped read
  *
  *tested
  *************************************************************************/
@@ -5318,10 +5386,11 @@ vector<char>::const_iterator Read::getClippedSeqIterator() const
 {
   FUNCSTART("const vector<char>::iterator Read::getClippedSeqIterator()");
 
-  paranoiaBUGIF(checkRead()!=nullptr, MIRANOTIFY(Notify::FATAL, checkRead()));
-
-  refreshPaddedSequence();
+  paranoiaBUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
 
+  //  const_cast<Read *>(this)->refreshPaddedSequence();
+  const_cast<Read *>(this)->refreshPaddedSequence();
+  
   vector<char>::const_iterator I=REA_padded_sequence.begin();
 
   if(getLeftClipoff() < 0 ||
@@ -5352,10 +5421,11 @@ vector<char>::const_iterator Read::getSeqIteratorBegin() const
 {
   FUNCSTART("const vector<char>::iterator Read::getSeqIteratorBegin()");
 
-  paranoiaBUGIF(checkRead()!=nullptr, MIRANOTIFY(Notify::FATAL, checkRead()));
-
-  refreshPaddedSequence();
+  paranoiaBUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
 
+  //  const_cast<Read *>(this)->refreshPaddedSequence();
+  const_cast<Read *>(this)->refreshPaddedSequence();
+  
   FUNCEND();
 
   return REA_padded_sequence.begin();
@@ -5365,10 +5435,11 @@ vector<char>::const_iterator Read::getSeqIteratorEnd() const
 {
   FUNCSTART("const vector<char>::iterator Read::getSeqIteratorEnd()");
 
-  paranoiaBUGIF(checkRead()!=nullptr, MIRANOTIFY(Notify::FATAL, checkRead()));
-
-  refreshPaddedSequence();
+  paranoiaBUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
 
+  //  const_cast<Read *>(this)->refreshPaddedSequence();
+  const_cast<Read *>(this)->refreshPaddedSequence();
+  
   FUNCEND();
 
   return REA_padded_sequence.end();
@@ -5378,7 +5449,7 @@ vector<char>::const_iterator Read::getSeqIteratorEnd() const
 
 /*************************************************************************
  *
- * Returns an iterator to the
+ * Returns an iterator to the 
  *  complement read
  *
  *tested
@@ -5388,10 +5459,11 @@ vector<char>::const_iterator Read::getComplementSeqIteratorBegin() const
 {
   FUNCSTART("const vector<char>::iterator Read::getComplementSeqIteratorBegin()");
 
-  paranoiaBUGIF(checkRead()!=nullptr, MIRANOTIFY(Notify::FATAL, checkRead()));
-
-  refreshPaddedComplementSequence();
+  paranoiaBUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
 
+  //const_cast<Read *>(this)->refreshPaddedComplementSequence();
+  const_cast<Read *>(this)->refreshPaddedComplementSequence();
+  
   FUNCEND();
 
   return REA_padded_complementsequence.begin();
@@ -5401,10 +5473,11 @@ vector<char>::const_iterator Read::getComplementSeqIteratorEnd() const
 {
   FUNCSTART("const vector<char>::iterator Read::getComplementSeqIteratorEnd()");
 
-  paranoiaBUGIF(checkRead()!=nullptr, MIRANOTIFY(Notify::FATAL, checkRead()));
-
-  refreshPaddedComplementSequence();
+  paranoiaBUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
 
+  //const_cast<Read *>(this)->refreshPaddedComplementSequence();
+  const_cast<Read *>(this)->refreshPaddedComplementSequence();
+  
   FUNCEND();
 
   return REA_padded_complementsequence.end();
@@ -5414,7 +5487,7 @@ vector<char>::const_iterator Read::getComplementSeqIteratorEnd() const
 
 /*************************************************************************
  *
- * Returns an iterator to the sequencing vector and quality clipped
+ * Returns an iterator to the sequencing vector and quality clipped 
  *  complement read
  *
  *tested
@@ -5424,12 +5497,13 @@ vector<char>::const_iterator Read::getClippedComplementSeqIterator() const
 {
   FUNCSTART("const vector<char>::iterator Read::getClippedComplementSeqIterator()");
 
-  paranoiaBUGIF(checkRead()!=nullptr, MIRANOTIFY(Notify::FATAL, checkRead()));
-
-  refreshPaddedComplementSequence();
+  paranoiaBUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
 
+  //const_cast<Read *>(this)->refreshPaddedComplementSequence();
+  const_cast<Read *>(this)->refreshPaddedComplementSequence();
+  
   vector<char>::const_iterator I=REA_padded_complementsequence.begin();
-
+  
   BOUNDCHECK(static_cast<int32>(REA_padded_complementsequence.size())-getRightClipoff(), 0, static_cast<int32>(REA_padded_complementsequence.size()+1));
   advance(I, REA_padded_complementsequence.size()-getRightClipoff());
 
@@ -5451,7 +5525,7 @@ char Read::getBaseInSequence(uint32 pos) const
 {
   FUNCSTART("char Read::getBaseInSequence(uint32 pos)");
 
-  refreshPaddedSequence();
+  const_cast<Read *>(this)->refreshPaddedSequence();
 
   BUGIFTHROW(pos >= REA_padded_sequence.size(), getName() << ": pos (" << pos << ") >= REA_padded_sequence.size (" << REA_padded_sequence.size() << ") ?");
 
@@ -5464,7 +5538,7 @@ char Read::getBaseInClippedSequence(uint32 pos) const
 {
   FUNCSTART("char Read::getBaseInClippedSequence(uint32 pos)");
 
-  refreshPaddedSequence();
+  const_cast<Read *>(this)->refreshPaddedSequence();
 
   BUGIFTHROW(pos >= REA_padded_sequence.size(), getName() << ": pos (" << pos << ") >= REA_padded_sequence.size (" << REA_padded_sequence.size() << ") ?");
 
@@ -5477,7 +5551,7 @@ char Read::getBaseInComplementSequence(uint32 pos) const
 {
   FUNCSTART("char Read::getBaseInComplementSequence(int32 pos)");
 
-  refreshPaddedComplementSequence();
+  const_cast<Read *>(this)->refreshPaddedComplementSequence();
 
   FUNCEND();
 
@@ -5488,7 +5562,7 @@ base_quality_t Read::getQualityInSequence(uint32 pos) const
 {
   FUNCSTART("char Read::getQualityInSequence(int32 pos)");
 
-  //refreshPaddedSequence();
+  const_cast<Read *>(this)->refreshPaddedSequence();
 
   BUGIFTHROW(pos >= REA_qualities.size(), getName() << ": pos (" << pos << ") >= REA_qualities.size (" << REA_qualities.size()  << ") ?");
 
@@ -5499,9 +5573,9 @@ base_quality_t Read::getQualityInSequence(uint32 pos) const
 
 base_quality_t Read::getQualityInComplementSequence(uint32 pos) const
 {
-  FUNCSTART("char Read::getQualityInComplementSequence(int32 pos)");
+  FUNCSTART("char Read::getQualityInSequence(int32 pos)");
 
-  //refreshPaddedComplementSequence();
+  const_cast<Read *>(this)->refreshPaddedComplementSequence();
 
   BUGIFTHROW(pos >= static_cast<uint32>(REA_qualities.size()), getName() << ": pos (" << pos << ") >= REA_qualities.size (" << REA_qualities.size()  << ") ?");
 
@@ -5532,7 +5606,7 @@ Read::bposhashstat_t Read::getBPosHashStats(uint32 pos) const
 
 /*************************************************************************
  *
- * returns the position in unclipped sequence of first base of a
+ * returns the position in unclipped sequence of first base of a 
  *  consecutive run of bases (including)
  *
  *
@@ -5543,7 +5617,7 @@ uint32 Read::getLowerBoundPosOfBaseRun(uint32 pos, char base, const bool alsotak
 {
   FUNCSTART("uint32 Read::getLowerBoundPosOfBaseRun(uint32 pos, char base, const bool alsotakegap) const");
 
-  refreshPaddedSequence();
+  const_cast<Read *>(this)->refreshPaddedSequence();
 
   BUGIFTHROW(pos >= REA_padded_sequence.size(), getName() << ": pos (" << pos << ") >= REA_padded_sequence.size (" << REA_padded_sequence.size() << ") ?");
 
@@ -5563,7 +5637,7 @@ uint32 Read::getLowerBoundPosOfBaseRun(uint32 pos, char base, const bool alsotak
 
 /*************************************************************************
  *
- * returns the position in unclipped sequence of last base of a
+ * returns the position in unclipped sequence of last base of a 
  *  consecutive run of bases (including)
  *
  *
@@ -5573,7 +5647,7 @@ uint32 Read::getUpperBoundPosOfBaseRun(uint32 pos, char base, const bool alsotak
 {
   FUNCSTART("uint32 Read::getUpperBoundPosOfBaseRun(uint32 pos, char base, const bool alsotakegap) const");
 
-  refreshPaddedSequence();
+  const_cast<Read *>(this)->refreshPaddedSequence();
 
   BUGIFTHROW(pos >= REA_padded_sequence.size(), getName() << ": pos (" << pos << ") >= REA_padded_sequence.size (" << REA_padded_sequence.size() << ") ?");
 
@@ -5603,10 +5677,10 @@ uint32 Read::getLenOfGapRun(uint32 pos) const
 {
   FUNCSTART("uint32 Read::getLenOfGapRun(uint32 pos) const");
 
-  refreshPaddedSequence();
+  const_cast<Read *>(this)->refreshPaddedSequence();
 
   BUGIFTHROW(pos >= REA_padded_sequence.size(), getName() << ": pos (" << pos << ") >= REA_padded_sequence.size (" << REA_padded_sequence.size() << ") ?");
-
+  
   if(REA_padded_sequence[pos]!='*') {
     FUNCEND();
     return 0;
@@ -5620,348 +5694,406 @@ uint32 Read::getLenOfGapRun(uint32 pos) const
   return pos-spos+1;
 }
 
-
-
 /*************************************************************************
  *
+ * set insize (mate pair size) for this read via static insize lib
+ * 
+ * looks through existing lib whether already present
+ *  if not, adds this size to lib
  *
  *
  *************************************************************************/
 
-void Read::calcTemplateInfo()
+void Read::setInsize(int32 from, int32 to)
 {
-  FUNCSTART("string Read::calcTemplateInfo()");
-
-  BUGIFTHROW(!REA_template.empty(),getName() << ": template already set to " << REA_template << " ?");
-  BUGIFTHROW(REA_template_segment!=0,getName() << ": template segment already set to " << static_cast<uint32>(REA_template_segment) << " ?");
-  BUGIFTHROW(REA_rgid.getSequencingType()==ReadGroupLib::SEQTYPE_SOLEXA && REA_rgid.getReadNamingScheme() == ReadGroupLib::SCHEME_NONE,"Oooops, Solexa type but no naming scheme?");
+  FUNCSTART("void Read::setInsize(int32 from, int32 to)");
+  BUGIFTHROW(from<-1 || to < -1, getName() << ": negative values < -1? " << from << ' ' << to << '?');
+  BUGIFTHROW(to<from, getName() << ": to<from? Tried to set insert sizes where the minimum library size (" << from << ") is larger than the maximum library size (" << to << ')');
 
-  switch(REA_rgid.getReadNamingScheme()) {
-  case ReadGroupLib::SCHEME_SANGER: {
-    getInternalTemplateName_Sanger(REA_template,REA_template_segment);
-    break;
-  }
-  case ReadGroupLib::SCHEME_TIGR: {
-    getInternalTemplateName_TIGR(REA_template,REA_template_segment);
-    break;
-  }
-  case ReadGroupLib::SCHEME_SOLEXA: {
-    getInternalTemplateName_Solexa(REA_template,REA_template_segment);
-    break;
-  }
-  case ReadGroupLib::SCHEME_FR: {
-    getInternalTemplateName_FR(REA_template,REA_template_segment);
-    break;
-  }
-  case ReadGroupLib::SCHEME_STLOUIS: {
-    getInternalTemplateName_StLouis(REA_template,REA_template_segment);
-    break;
-  }
-  case ReadGroupLib::SCHEME_SRARAW: {
-    getInternalTemplateName_SRARaw(REA_template,REA_template_segment);
-    break;
-  }
-  case ReadGroupLib::SCHEME_NONE: {
-    REA_template=getName();
-    break;
-  }
-  default: {
-    MIRANOTIFY(Notify::INTERNAL, getName() << ": unknown read naming scheme " << static_cast<uint32>(REA_rgid.getReadNamingScheme()) << " set??? ReadGroupLib::SCHEME_NONE " << ReadGroupLib::SCHEME_NONE);
-  }
+  for(uint32 libid=0; libid<REA_insize_staticlib.size(); libid++){
+    if(REA_insize_staticlib[libid].insize_from == from
+       && REA_insize_staticlib[libid].insize_to == to){
+      REA_insize_libid=libid;
+      FUNCEND();
+      return;
+    }
   }
 
-  //cout << "### " << getName() << "\t" << REA_template << "\t" << static_cast<uint32>(REA_template_segment) << endl;
-  //cout << *this;
+  BUGIFTHROW(REA_insize_staticlib.size()>=255, getName() << ": Uh ... more than 255 libraries with different mate pair sizes? Very unusual, contact author!");
+
+  REA_insize_libid=REA_insize_staticlib.size();
+  REA_insize_staticlib.resize(REA_insize_staticlib.size()+1);
+  REA_insize_staticlib.back().insize_from=from;
+  REA_insize_staticlib.back().insize_to=to;
 
   FUNCEND();
   return;
 }
 
 
-
 /*************************************************************************
  *
- * Deduce template name from sanger centre naming scheme
- *  also set template_segment
+ * Set the read naming scheme 
+ * for the time being uses in getInternalTemplateName
  *
  *************************************************************************/
 
-void Read::getInternalTemplateName_Sanger(string & tname, uint8 & segment)
+void Read::setReadNamingScheme(uint8 scheme)
 {
-  string templbase;
-  string sangerext;
+  FUNCSTART("void Read::setReadNamingScheme(uint8 scheme)");
+  BUGIFTHROW(scheme >= SCHEME_UNKNOWN, getName() << ": Tried to set unknown read naming scheme (" << static_cast<uint16>(scheme) << ") ?");
+  REA_readnaming_scheme=scheme;
+  FUNCEND();
+  return;
+}
 
-  segment=0;
-  tname.clear();
 
-  auto bpos = getName().rfind(".");
+/*************************************************************************
+ *
+ * Set the template end
+ *
+ *************************************************************************/
 
-  if (bpos != string::npos) {
-    templbase=getName().substr(0,bpos);
-    sangerext=getName().substr(bpos,getName().size());
-    if(!sangerext.empty()){
-      if(toupper(sangerext[1])=='P'
-	 || toupper(sangerext[1])=='F'){
-	segment=1;
-      }else if(toupper(sangerext[1])=='Q'
-	       || toupper(sangerext[1])=='R'){
-	segment=255;
-      }
-    }
-    tname=templbase;
-    if(sangerext.size()>2) tname+='_'+sangerext.substr(2,sangerext.size());
+void Read::setTemplateEnd(char e)
+{
+  FUNCSTART("void Read::setTemplateEnd(char e)");
+  switch(e) {
+  case 'F':
+  case 'R':
+  case 'N':{
+    break;
+  }
+  default : {
+    MIRANOTIFY(Notify::INTERNAL, getName() << ": template end/strand is not F/R/N ?");
   }
-
-  if(tname.empty()) {
-    tname=getName();
   }
 
-  //cout << "getName(): " << getName()<< endl;
-  //cout << "templbase: " << templbase << endl;
-  //cout << "sangerext: " << sangerext << endl;
-  //cout << "sangerext.substr(2,sangerext.size()): " << sangerext.substr(2,sangerext.size()) << endl;
-  //cout << "return; " << (templbase+sangerext.substr(2,sangerext.size())) << endl;
+  REA_template_end=e;
 
+  FUNCEND();
   return;
 }
 
 
 
+
 /*************************************************************************
  *
- *  Deduce from TIGR centre naming scheme
- *  also set template_segment
+ * get template name either from internal template name (if present)
+ *  or deduce from centre naming scheme
  *
  *************************************************************************/
 
-void Read::getInternalTemplateName_TIGR(string & tname, uint8 & segment)
+string Read::getInternalTemplateName()
 {
-  string templbase;
-  string otherext;
+  FUNCSTART("string Read::getInternalTemplateName() const");
+  switch(REA_readnaming_scheme) {
+  case SCHEME_SANGER: {
+    return getInternalTemplateName_Sanger();
+  }
+  case SCHEME_TIGR: {
+    return getInternalTemplateName_TIGR();
+  }
+  case SCHEME_SOLEXA: {
+    return getInternalTemplateName_Solexa();
+  }
+  case SCHEME_FR: {
+    return getInternalTemplateName_FR();
+  }
+  case SCHEME_STLOUIS: {
+    return getInternalTemplateName_StLouis();
+  }
+  case SCHEME_NONE: {
+    return getName();
+  }
+  default: {
+    throw Notify(Notify::INTERNAL, THISFUNC, "Unknown read naming scheme set???");
+  }
+  }
+
+  FUNCEND();
+  return "";
+}
+
+/*************************************************************************
+ *
+ * get template name either from internal template name (if present)
+ *  or deduce from sanger centre naming scheme
+ *
+ *************************************************************************/
 
-  //cout << "Scheme TIGR";
+string Read::getInternalTemplateName_Sanger()
+{
+    string templbase;
+    string sangerext;
 
-  segment=0;
-  tname.clear();
+    REA_name_scheme_valid=false;
 
-  auto bpos = getName().find("TF");
+    string::size_type bpos = getName().rfind(".");
 
-  if (bpos != string::npos) {
-    templbase=getName().substr(0,bpos);
-    segment=1;
-  } else {
-    bpos = getName().find("TR");
     if (bpos != string::npos) {
       templbase=getName().substr(0,bpos);
-      segment=255;
+      sangerext=getName().substr(bpos,getName().size());
+      if(!sangerext.empty()){
+	if(toupper(sangerext[1])=='P'
+	   || toupper(sangerext[1])=='F'){
+	  REA_name_scheme_valid=true;
+	  if(REA_template_end == 'N') REA_template_end='F';
+	}else if(toupper(sangerext[1])=='Q'
+		 || toupper(sangerext[1])=='R'){
+	  REA_name_scheme_valid=true;
+	  if(REA_template_end == 'N') REA_template_end='R';
+	}
+      }
+    } else {
+      if(!REA_template.empty()) return REA_template;
+      return getName();
     }
-  }
-  if(bpos!=string::npos){
-    otherext=getName().substr(bpos,getName().size());
-    tname=templbase;
-    if(otherext.size()>2) tname+='_'+otherext.substr(2,otherext.size());
-  }
-  if(tname.empty()){
-    tname=getName();
-  }
+    
+    if(!REA_template.empty()) {
+      templbase=REA_template;
+    }
+    
+    if(sangerext.size()<2) {
+      return (templbase+' ');
+    }
+    
+    // test: if not sanger centre naming scheme, it's read name
+    //  or template base if it exists
+    if(sangerext.size()<3) {
+      if(!REA_template.empty()) return REA_template;
+      return getName();
+    } 
+    //return (templbase+sangerext[sangerext.size()-1]);
 
-  //cout << "otherext.substr(2,otherext.size()): " << otherext.substr(2,otherext.size()) << endl;
-  //cout << "return; " << (templbase+otherext.substr(2,otherext.size())) << endl;
+    //cout << "getName(): " << getName()<< endl;
+    //cout << "templbase: " << templbase << endl;
+    //cout << "sangerext: " << sangerext << endl;
+    //cout << "sangerext.substr(2,sangerext.size()): " << sangerext.substr(2,sangerext.size()) << endl;
+    //cout << "return; " << (templbase+sangerext.substr(2,sangerext.size())) << endl;
 
-  return;
+    return (templbase+'_'+sangerext.substr(2,sangerext.size()));
 }
 
 
 
 /*************************************************************************
  *
- *  Deduce from FR naming scheme (.f* / .r*)
- *  also set template_segment
+ * get template name either from internal template name (if present)
+ *  or deduce from TIGR centre naming scheme
  *
  *************************************************************************/
 
-void Read::getInternalTemplateName_FR(string & tname, uint8 & segment)
+string Read::getInternalTemplateName_TIGR()
 {
-  string templbase;
-  string otherext;
+    string templbase;
+    string tigrext;
 
-  segment=0;
-  tname.clear();
+    //cout << "Scheme TIGR";
 
-  auto bpos = getName().rfind(".");
+    REA_name_scheme_valid=false;
 
-  if (bpos != string::npos) {
-    templbase=getName().substr(0,bpos);
-    otherext=getName().substr(bpos,getName().size());
+    string::size_type bpos = getName().find("TF");
 
-    if(otherext.size()>=2){
-      if(toupper(otherext[1])=='F'){
-	segment=1;
-      }else if(toupper(otherext[1])=='R'){
-	segment=255;
+    if (bpos != string::npos) {
+      templbase=getName().substr(0,bpos);
+      REA_name_scheme_valid=true;
+      if(REA_template_end == 'N') REA_template_end='F';
+    } else {
+      bpos = getName().find("TR");
+      if (bpos != string::npos) {
+	templbase=getName().substr(0,bpos);
+	REA_name_scheme_valid=true;
+	if(REA_template_end == 'N') REA_template_end='R';
+      } else {
+	if(!REA_template.empty()) return REA_template;
+	return getName();
       }
-      tname=templbase;
-      if(otherext.size()>2) tname+='_'+otherext.substr(2,otherext.size());
     }
-  }
-  if(tname.empty()){
-    tname=getName();
-  }
+    tigrext=getName().substr(bpos,getName().size());
+    
+    if(!REA_template.empty()) {
+      templbase=REA_template;
+    }
 
-  return;
+    //cout << "REA_name: " << getName()<< endl;
+    //cout << "templbase: " << templbase << endl;
+    //cout << "tigrext: " << tigrext << endl;
+
+    if(tigrext.size()<=2) {
+      return (templbase+' ');
+    }
+
+    //cout << "tigrext.substr(2,tigrext.size()): " << tigrext.substr(2,tigrext.size()) << endl;
+    //cout << "return; " << (templbase+tigrext.substr(2,tigrext.size())) << endl;
+
+    return (templbase+'_'+tigrext.substr(2,tigrext.size()));
 }
 
 
+
 /*************************************************************************
  *
- *  Deduce from .1/.2 naming scheme (.1* / .2*)
- *  also set template_segment
+ * get template name either from internal template name (if present)
+ *  or deduce from FR naming scheme (.f* / .r*)
  *
  *************************************************************************/
 
-void Read::getInternalTemplateName_SRARaw(string & tname, uint8 & segment)
+string Read::getInternalTemplateName_FR()
 {
-  string templbase;
-  string otherext;
+    string templbase;
+    string otherext;
 
-  segment=0;
-  tname.clear();
+    REA_name_scheme_valid=false;
 
-  auto bpos = getName().rfind(".");
+    string::size_type bpos = getName().rfind(".");
 
-  if (bpos != string::npos) {
-    templbase=getName().substr(0,bpos);
-    otherext=getName().substr(bpos,getName().size());
+    if (bpos != string::npos) {
+      templbase=getName().substr(0,bpos);
+      otherext=getName().substr(bpos,getName().size());
 
-    if(otherext.size()>=2){
-      if(otherext[1]=='1'){
-	segment=1;
-      }else if(otherext[1]=='2'){
-	segment=255;
+      if(REA_template_end == 'N' && !otherext.empty()){
+	if(toupper(otherext[1])=='F'){
+	  REA_template_end='F';
+	}else if(toupper(otherext[1])=='R'){
+	  REA_template_end='R';
+	}else{
+	  return getName();
+	}
       }
-      tname=templbase;
-      if(otherext.size()>2) tname+='_'+otherext.substr(2,otherext.size());
+    } else {
+      REA_template_end='F';
+      if(!REA_template.empty()) return REA_template;
+      return getName();
     }
-  }
-  if(tname.empty()){
-    tname=getName();
-  }
-
-  return;
+    
+    if(!REA_template.empty()) {
+      templbase=REA_template;
+    }
+    
+    // if it was .f or .r  (well, .? to be precise)
+    if(otherext.size()<3) {
+      return templbase;
+    }
+    
+    // else it was .f* .r*
+    return (templbase+'_'+otherext.substr(2,otherext.size()));
 }
 
 
+
 /*************************************************************************
  *
- *  Deduce from Solexa naming scheme ( /1 or /2)
- *  If unsuccessful, try FR scheme from 454 and Ion reads
- *  also set template_segment
+ * get template name either from internal template name (if present)
+ *  or deduce from Solexa naming scheme ( /1 or /2)
  *
  *************************************************************************/
 
-void Read::getInternalTemplateName_Solexa(string & tname, uint8 & segment)
+string Read::getInternalTemplateName_Solexa()
 {
-  string templbase;
-  string otherext;
+    string templbase;
+    string otherext;
 
-  segment=0;
-  tname.clear();
+    REA_name_scheme_valid=false;
 
-  auto bpos = getName().rfind("/");
+    string::size_type bpos = getName().rfind("/");
 
-  if (bpos != string::npos) {
-    templbase=getName().substr(0,bpos);
-    otherext=getName().substr(bpos,getName().size());
+    if (bpos != string::npos) {
+      templbase=getName().substr(0,bpos);
+      otherext=getName().substr(bpos,getName().size());
 
-    if(otherext.size()>=2){
-      if(toupper(otherext[1])=='1'){
-	segment=1;
-      }else if(toupper(otherext[1])=='2'){
-	segment=255;
+      if(REA_template_end == 'N' && !otherext.empty()){
+	if(toupper(otherext[1])=='1'){
+	  REA_template_end='F';
+	}else if(toupper(otherext[1])=='2'){
+	  REA_template_end='R';
+	}
       }
-      tname=templbase;
-      if(otherext.size()>2) tname+='_'+otherext.substr(2,otherext.size());
+    } else {
+      REA_template_end='F';
+      if(!REA_template.empty()) return REA_template;
+      return getName();
     }
-  }else{
-    // Hmmm ... no "/" found in the read name.
-    // To retain compatibility to earlier MIRA versions and other programs:
-    //  if sequencing tech is 454 or Ion, try the FR scheme
-    if(REA_rgid.getSequencingType() == ReadGroupLib::SEQTYPE_454GS20
-       || REA_rgid.getSequencingType() == ReadGroupLib::SEQTYPE_IONTORRENT){
-      getInternalTemplateName_FR(tname,segment);
+    
+    if(!REA_template.empty()) {
+      templbase=REA_template;
     }
-  }
-
-  if(tname.empty()){
-    tname=getName();
-  }
-
-  //cout << "getName(): " << getName()<< endl;
-  //cout << "templbase: " << templbase << endl;
-  //cout << "otherext: " << otherext << endl;
-  //cout << "segment: " << static_cast<uint32>(segment) << endl;
-  //cout << "tname: " << tname << endl;
-
-  return;
+    
+    // if it was /1 or /2  (well, .? to be precise)
+    if(otherext.size()<3) {
+      return templbase;
+    }
+    
+    // else it was /1* /2*
+    return (templbase+'_'+otherext.substr(2,otherext.size()));
 }
 
 
 
 /*************************************************************************
  *
- *  Deduce from stlouis naming scheme
- *  also set template_segment
+ * get template name either from internal template name (if present)
+ *  or deduce from stlouis naming scheme
  *
  *************************************************************************/
 
-void Read::getInternalTemplateName_StLouis(string & tname, uint8 & segment)
+string Read::getInternalTemplateName_StLouis()
 {
-  string templbase;
-  string otherext;
+    string templbase;
+    string stlext;
 
-  segment=0;
-  tname.clear();
+    REA_name_scheme_valid=false;
 
-  auto bpos = getName().rfind(".");
+    string::size_type bpos = getName().rfind(".");
 
-  if (bpos != string::npos) {
-    templbase=getName().substr(0,bpos);
-    otherext=getName().substr(bpos,getName().size());
-    if(!otherext.empty()){
-      switch(tolower(otherext[1])){
-      case 'r' :
-      case 'y' :
-      case 'g' : {
-	segment=255;
-	break;
-      }
-      case 's' :
-      case 'f' :
-      case 'x' :
-      case 'z' :
-      case 'i' :
-      case 'b' : {
-	segment=1;
-      }
-      default: {
-	// everything else treat as unknown
-      }
+    if (bpos != string::npos) {
+      templbase=getName().substr(0,bpos);
+      stlext=getName().substr(bpos,getName().size());
+      if(!stlext.empty()){
+	switch(tolower(stlext[1])){
+	case 'r' :
+	case 'y' :
+	case 'g' : {
+	  if(REA_template_end == 'N') REA_template_end='R';
+	  REA_name_scheme_valid=true;
+	  break;
+	}
+	case 's' :
+	case 'f' :
+	case 'x' :
+	case 'z' :
+	case 'i' :
+	case 'b' : {
+	  if(REA_template_end == 'N') REA_template_end='F';
+	  REA_name_scheme_valid=true;
+	}
+	default: {
+	  // everything else treat as unknown
+	  REA_template_end='N';
+	  REA_name_scheme_valid=false;
+	}
+	}
       }
+    } else {
+      if(!REA_template.empty()) return REA_template;
+      return getName();
     }
-    tname=templbase;
-    if(otherext.size()>2) tname+='_'+otherext.substr(2,otherext.size());
-  }
-  if(tname.empty()){
-    tname=getName();
-  }
-
-  //cout << "getName(): " << getName()<< endl;
-  //cout << "templbase: " << templbase << endl;
-  //cout << "otherext: " << otherext << endl;
-  //cout << "otherext.substr(2,otherext.size()): " << otherext.substr(2,otherext.size()) << endl;
-  //cout << "return; " << (templbase+otherext.substr(2,otherext.size())) << endl;
+    
+    if(!REA_template.empty()) {
+      templbase=REA_template;
+    }
+    
+    if(stlext.size()<2) {
+      return (templbase+' ');
+    }
+    
+    //cout << "getName(): " << getName()<< endl;
+    //cout << "templbase: " << templbase << endl;
+    //cout << "stlext: " << stlext << endl;
+    //cout << "stlext.substr(2,stlext.size()): " << stlext.substr(2,stlext.size()) << endl;
+    //cout << "return; " << (templbase+stlext.substr(2,stlext.size())) << endl;
 
-  return;
+    return (templbase+'_'+stlext.substr(2,stlext.size()));
 }
 
 
@@ -5981,11 +6113,15 @@ void Read::getInternalTemplateName_StLouis(string & tname, uint8 & segment)
 void Read::transferSVTagsToClip(int32 tolerancelen, int32 clipsearchlen) {
   FUNCSTART("void Read::transferSVTagsToClip(int32 tolerancelen)");
 
-  BUGIFTHROW(tolerancelen<0, "tolerancelen <0");
-  BUGIFTHROW(clipsearchlen<0, "clipsearchlen <0");
-
+  if(tolerancelen<0){
+    throw Notify(Notify::FATAL, THISFUNC, "tolerancelen <0");
+  }
+  if(clipsearchlen<0){
+    throw Notify(Notify::FATAL, THISFUNC, "clipsearchlen <0");
+  }
   if(REA_has_valid_data==false) return;
 
+
   refreshPaddedSequence();
 
   if(REA_tags.empty()) {
@@ -5993,7 +6129,7 @@ void Read::transferSVTagsToClip(int32 tolerancelen, int32 clipsearchlen) {
     return;
   }
 
-  //string tagSVEC="SVEC";
+  //string tagSVEC="SVEC";  
 
   bool found=false;
   for(uint32 i=0; i<REA_tags.size(); i++){
@@ -6012,7 +6148,7 @@ void Read::transferSVTagsToClip(int32 tolerancelen, int32 clipsearchlen) {
 	for(uint32 index=from; index<to; index++) {
 	  tagfield[index]=1;
 	}
-
+	
 	if(getLeftClipoff()<static_cast<int32>(REA_padded_sequence.size())){
 	  // first, search within left clip + tolerance
 	  vector<char>::const_iterator I=tagfield.begin();
@@ -6087,7 +6223,7 @@ void Read::transferSVTagsToClip(int32 tolerancelen, int32 clipsearchlen) {
     }
   }
 
-
+  
 
   FUNCEND();
 }
@@ -6106,13 +6242,18 @@ void Read::setClipoffs(int32 lclip, int32 rclip, bool force)
 {
   FUNCSTART("void Read::setClipoffs(uint32 lclip, uint32 rclip, bool force)");
 
-  BUGIFTHROW(checkRead()!=nullptr, checkRead());
-  BUGIFTHROW(lclip<0, "lclip < 0?");
-  BUGIFTHROW(rclip<0, "rclip < 0?");
+  BUGIF(checkRead()!=NULL, throw Notify(Notify::INTERNAL, THISFUNC, checkRead()));
+  BUGIF(lclip<0, throw Notify(Notify::INTERNAL, THISFUNC, "lclip < 0?"));
+  BUGIF(rclip<0, throw Notify(Notify::INTERNAL, THISFUNC, "rclip < 0?"));
+
+  if(rclip>static_cast<int32>(REA_padded_sequence.size())){
+    rclip=static_cast<int32>(REA_padded_sequence.size());
+    //throw Notify(Notify::INTERNAL, THISFUNC, "rclip > REA_padded_sequence.size().");
+  }
 
-  auto lenseq=static_cast<int32>(getLenSeq());
-  if(rclip>lenseq) rclip=lenseq;
-  if(lclip>lenseq) lclip=lenseq;
+  if(lclip>static_cast<int32>(REA_padded_sequence.size())){
+    lclip=static_cast<int32>(REA_padded_sequence.size());
+  }
 
   REA_ql=lclip;
   REA_qr=rclip;
@@ -6120,6 +6261,8 @@ void Read::setClipoffs(int32 lclip, int32 rclip, bool force)
     if(REA_sl>lclip) REA_sl=lclip;
     if(REA_sr<rclip) REA_sr=rclip;
   }
+//  REA_char_seq_dirty=true;
+//  REA_char_cseq_dirty=true;
 
   updateClipoffs();
 
@@ -6138,11 +6281,12 @@ void Read::setLQClipoff(int32 lclip)
 {
   FUNCSTART("void Read::setLQClipoffs(int32 lclip)");
 
-  BUGIFTHROW(checkRead()!=nullptr, checkRead());
-  BUGIFTHROW(lclip<0, "lclip < 0?");
+  BUGIF(checkRead()!=NULL, throw Notify(Notify::INTERNAL, THISFUNC, checkRead()));
+  BUGIF(lclip<0, throw Notify(Notify::INTERNAL, THISFUNC, "lclip < 0?"));
 
-  auto lenseq=static_cast<int32>(getLenSeq());
-  if(lclip>lenseq) lclip=lenseq;
+  if(lclip>static_cast<int32>(REA_padded_sequence.size())){
+    lclip=static_cast<int32>(REA_padded_sequence.size());
+  }
 
   REA_ql=lclip;
   updateClipoffs();
@@ -6160,11 +6304,12 @@ void Read::setRQClipoff(int32 rclip)
 {
   FUNCSTART("void Read::setRQClipoffs(int32 rclip)");
 
-  BUGIFTHROW(checkRead()!=nullptr, checkRead());
-  BUGIFTHROW(rclip<0, "rclip < 0?");
+  BUGIF(checkRead()!=NULL, throw Notify(Notify::INTERNAL, THISFUNC, checkRead()));
+  BUGIF(rclip<0, throw Notify(Notify::INTERNAL, THISFUNC, "rclip < 0?"));
 
-  auto lenseq=static_cast<int32>(getLenSeq());
-  if(rclip>lenseq) rclip=lenseq;
+  if(rclip>static_cast<int32>(REA_padded_sequence.size())){
+    rclip=static_cast<int32>(REA_padded_sequence.size());
+  }
 
   REA_qr=rclip;
   updateClipoffs();
@@ -6183,11 +6328,12 @@ void Read::setLSClipoff(int32 lclip)
 {
   FUNCSTART("void Read::setLSClipoffs(int32 lclip)");
 
-  BUGIFTHROW(checkRead()!=nullptr, checkRead());
-  BUGIFTHROW(lclip<0, "lclip < 0?");
+  BUGIF(checkRead()!=NULL, throw Notify(Notify::INTERNAL, THISFUNC, checkRead()));
+  BUGIF(lclip<0, throw Notify(Notify::INTERNAL, THISFUNC, "lclip < 0?"));
 
-  auto lenseq=static_cast<int32>(getLenSeq());
-  if(lclip>lenseq) lclip=lenseq;
+  if(lclip>static_cast<int32>(REA_padded_sequence.size())){
+    lclip=static_cast<int32>(REA_padded_sequence.size());
+  }
 
   REA_sl=lclip;
   updateClipoffs();
@@ -6205,11 +6351,12 @@ void Read::setRSClipoff(int32 rclip)
 {
   FUNCSTART("void Read::setRSClipoffs(int32 rclip)");
 
-  BUGIFTHROW(checkRead()!=nullptr, checkRead());
-  BUGIFTHROW(rclip<0, "rclip < 0?");
+  BUGIF(checkRead()!=NULL, throw Notify(Notify::INTERNAL, THISFUNC, checkRead()));
+  BUGIF(rclip<0, throw Notify(Notify::INTERNAL, THISFUNC, "rclip < 0?"));
 
-  auto lenseq=static_cast<int32>(getLenSeq());
-  if(rclip>lenseq) rclip=lenseq;
+  if(rclip>static_cast<int32>(REA_padded_sequence.size())){
+    rclip=static_cast<int32>(REA_padded_sequence.size());
+  }
 
   REA_sr=rclip;
   updateClipoffs();
@@ -6221,35 +6368,37 @@ void Read::setRSClipoff(int32 rclip)
 
 /*************************************************************************
  *
- * Sets the masked (and quality) clipoffs to the given values.
+ * Sets the masked (and quality) clipoffs to the given values. 
  *
  *************************************************************************/
 
-void Read::setLMClipoff(int32 lclip)
+void Read::setLMClipoff(int32 lclip) 
 {
   FUNCSTART("int32 Read::setLMClipoff(int32 lclip)");
 
-  BUGIFTHROW(checkRead()!=nullptr, checkRead());
-  BUGIFTHROW(lclip<0, "lclip < 0?");
-
-  auto lenseq=static_cast<int32>(getLenSeq());
-  if(lclip>lenseq) lclip=lenseq;
+  BUGIF(checkRead()!=NULL, throw Notify(Notify::INTERNAL, THISFUNC, checkRead()));
+  BUGIF(lclip<0, throw Notify(Notify::INTERNAL, THISFUNC, "lclip < 0?"));
 
+  if(lclip>static_cast<int32>(REA_padded_sequence.size())){
+    lclip=static_cast<int32>(REA_padded_sequence.size());
+    //throw Notify(Notify::INTERNAL, THISFUNC, "rclip > REA_padded_sequence.size().");
+  }
   REA_ml=lclip;
   REA_ql=lclip;
   updateClipoffs();
 }
 
-void Read::setRMClipoff(int32 rclip)
+void Read::setRMClipoff(int32 rclip) 
 {
   FUNCSTART("int32 Read::setRMClipoff(int32 rclip)");
 
-  BUGIFTHROW(checkRead()!=nullptr, checkRead());
-  BUGIFTHROW(rclip<0, "rclip < 0?");
-
-  auto lenseq=static_cast<int32>(getLenSeq());
-  if(rclip>lenseq) rclip=lenseq;
+  BUGIF(checkRead()!=NULL, throw Notify(Notify::INTERNAL, THISFUNC, checkRead()));
+  BUGIF(rclip<0, throw Notify(Notify::INTERNAL, THISFUNC, "rclip < 0?"));
 
+  if(rclip>static_cast<int32>(REA_padded_sequence.size())){
+    rclip=static_cast<int32>(REA_padded_sequence.size());
+    //throw Notify(Notify::INTERNAL, THISFUNC, "rclip > REA_padded_sequence.size().");
+  }
   REA_mr=rclip;
   REA_qr=rclip;
   updateClipoffs();
@@ -6267,7 +6416,7 @@ int32 Read::getLeftExtend() const
 {
   FUNCSTART("int32 Read::getLeftExtend() const");
 
-  paranoiaBUGIF(checkRead()!=nullptr, MIRANOTIFY(Notify::FATAL, checkRead()));
+  paranoiaBUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
 
   FUNCEND();
 
@@ -6286,7 +6435,7 @@ int32 Read::getLeftExtend() const
 int32 Read::getRightExtend() const
 {
   FUNCSTART("int32 Read::getRightExtend() const");
-  paranoiaBUGIF(checkRead()!=nullptr, MIRANOTIFY(Notify::FATAL, checkRead()));
+  paranoiaBUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
 
   FUNCEND();
 
@@ -6305,14 +6454,14 @@ int32 Read::getRightExtend() const
  *
  *************************************************************************/
 
-double Read::qualityToErrorRate_compute(base_quality_t qual)
+double Read::qualityToErrorRate_compute(base_quality_t qual) 
 {
   return pow(10.0,static_cast<double>(qual)/10.0);
 }
 
 
 // Qual is caped at 100
-base_quality_t Read::errorRateToQuality(double errProb)
+base_quality_t Read::errorRateToQuality(double errProb) 
 {
   //FUNCSTART("static const double Read::qualityToErrorProb(base_quality_t qual)");
   if(errProb>1000000000.0) errProb=1000000000.0;
@@ -6332,7 +6481,7 @@ base_quality_t Read::errorRateToQuality(double errProb)
  *
  *************************************************************************/
 
-base_quality_t Read::queryAverageQualInSequence(int32 posl, int32 posr, bool skipNs, bool skipStars) const
+base_quality_t Read::queryAverageQualInSequence(int32 posl, int32 posr, bool skipNs, bool skipStars)
 {
   FUNCSTART("base_quality_t Read::queryAverageQualInSequence(int32 posl, int32 posr, bool skipNs, bool skipStars)");
 
@@ -6359,14 +6508,14 @@ base_quality_t Read::queryAverageQualInSequence(int32 posl, int32 posr, bool ski
 
     vector<base_quality_t>::const_iterator qI;
     vector<char>::const_iterator sI;
-
+    
     qI=REA_qualities.begin();
     BOUNDCHECK(posl, 0, static_cast<int32>(REA_qualities.size()));
     advance(qI, posl);
     sI=REA_padded_sequence.begin();
     BOUNDCHECK(posl, 0, static_cast<int32>(REA_padded_sequence.size()));
     advance(sI, posl);
-
+    
     while((((*sI=='N'
 	       || *sI=='n'
 	       || *sI=='X'
@@ -6376,12 +6525,12 @@ base_quality_t Read::queryAverageQualInSequence(int32 posl, int32 posr, bool ski
 	    && sI!=REA_padded_sequence.begin()){
 	sI--; qI--;
     }
-
+    
     vector<char>::const_iterator tsI;
     tsI=REA_padded_sequence.begin();
     BOUNDCHECK(posr, 0, static_cast<int32>(REA_padded_sequence.size()));
     advance(tsI, posr);
-
+    
     while((((*tsI=='N'
 	       || *tsI=='n'
 	       || *tsI=='X'
@@ -6391,7 +6540,7 @@ base_quality_t Read::queryAverageQualInSequence(int32 posl, int32 posr, bool ski
 	    && (tsI+1)!=REA_padded_sequence.end()){
 	tsI++;
     }
-
+    
     for(;sI<=tsI; sI++, qI++){
       CEBUG("char: " << *sI<< endl);
       if(dptools::isValidIUPACBase(*sI)){
@@ -6444,7 +6593,7 @@ base_quality_t Read::queryAverageQualInSequence(int32 posl, int32 posr, bool ski
  *
  *************************************************************************/
 
-base_quality_t Read::queryAverageQualInClippedSequence(int32 posl, int32 posr, bool skipNs, bool skipStars) const
+base_quality_t Read::queryAverageQualInClippedSequence(int32 posl, int32 posr, bool skipNs, bool skipStars)
 {
   FUNCSTART("base_quality_t Read::queryAverageQualInClippedSequence(int32 posl, int32 posr, bool skipNs, bool skipStars)");
 
@@ -6472,7 +6621,7 @@ base_quality_t Read::queryAverageQualInClippedSequence(int32 posl, int32 posr, b
  *
  *************************************************************************/
 
-base_quality_t Read::queryAverageQualInComplementSequence(int32 posl, int32 posr, bool skipNs, bool skipStars) const
+base_quality_t Read::queryAverageQualInComplementSequence(int32 posl, int32 posr, bool skipNs, bool skipStars)
 {
   FUNCSTART("base_quality_t Read::queryAverageQualInComplementSequence(int32 posl, int32 posr, bool skipNs, bool skipStars)");
 
@@ -6496,14 +6645,14 @@ base_quality_t Read::queryAverageQualInComplementSequence(int32 posl, int32 posr
 
     if(posl<0) posl=0;
     if(posr >= static_cast<int32>(REA_padded_complementsequence.size())) posr=static_cast<int32>(REA_padded_complementsequence.size())-1;
-
+    
     uint32 complement_posl=static_cast<uint32>(REA_padded_complementsequence.size())-posl-1;
 
     CEBUG("complement_posl: " << complement_posl << endl);
 
     vector<base_quality_t>::const_iterator qI;
     vector<char>::const_iterator sI;
-
+    
     qI=REA_qualities.begin();
     //BOUNDCHECK(complement_posl, 0, REA_qualities.size());
     BUGIFTHROW(complement_posl>=REA_qualities.size(),getName() << ": complement_posl (" << complement_posl << ") >= REA_qualities.size(" << REA_qualities.size() << ") ?");
@@ -6511,7 +6660,7 @@ base_quality_t Read::queryAverageQualInComplementSequence(int32 posl, int32 posr
     sI=REA_padded_complementsequence.begin();
     BOUNDCHECK(posl, 0, static_cast<int32>(REA_padded_complementsequence.size()));
     advance(sI, posl);
-
+    
     while((((*sI=='N'
 	       || *sI=='n'
 	       || *sI=='X'
@@ -6521,12 +6670,12 @@ base_quality_t Read::queryAverageQualInComplementSequence(int32 posl, int32 posr
 	    && sI!=REA_padded_complementsequence.begin()){
 	sI--; qI++;
     }
-
+    
     vector<char>::const_iterator tsI;
     tsI=REA_padded_complementsequence.begin();
     BOUNDCHECK(posr, 0, static_cast<int32>(REA_padded_complementsequence.size()));
     advance(tsI, posr);
-
+    
     while((((*tsI=='N'
 	       || *tsI=='n'
 	       || *tsI=='X'
@@ -6536,7 +6685,7 @@ base_quality_t Read::queryAverageQualInComplementSequence(int32 posl, int32 posr
 	    && (tsI+1)!=REA_padded_complementsequence.end()){
 	tsI++;
     }
-
+    
     for(;sI<=tsI; sI++, qI--){
       CEBUG("char: " << *sI<< endl);
       if(dptools::isValidIUPACBase(*sI)){
@@ -6588,7 +6737,7 @@ base_quality_t Read::queryAverageQualInComplementSequence(int32 posl, int32 posr
  *
  *************************************************************************/
 
-base_quality_t Read::queryAverageQualInClippedComplementSequence(int32 posl, int32 posr, bool skipNs, bool skipStars) const
+base_quality_t Read::queryAverageQualInClippedComplementSequence(int32 posl, int32 posr, bool skipNs, bool skipStars)
 {
   FUNCSTART("base_quality_t Read::queryAverageQualInClippedComplementSequence(int32 posl, int32 posr, bool skipNs, bool skipStars)");
 
@@ -6599,7 +6748,7 @@ base_quality_t Read::queryAverageQualInClippedComplementSequence(int32 posl, int
 
   FUNCEND();
 
-  return queryAverageQualInComplementSequence(getLenSeq()-getRightClipoff()+posl,
+  return queryAverageQualInComplementSequence(getLenSeq()-getRightClipoff()+posl, 
 						getLenSeq()-getRightClipoff()+posr,
 						skipNs,
 						skipStars);
@@ -6622,7 +6771,7 @@ base_quality_t Read::queryAverageQualInClippedComplementSequence(int32 posl, int
  *                <<<     <<<
  *  then
  *  -------F2-----RF1-X---RF2-------F1-----------
- *                >>>
+ *                >>>     
  *
  * backward:
  *  -------F1-----------------------F2-----------
@@ -6651,7 +6800,7 @@ void Read::performQualityClip(uint32 minqual, uint32 winlen)
     FUNCEND();
     return;
   }
-
+  
   if(minqual<5) minqual=5;
   if(winlen<10) winlen=10;
 
@@ -6681,8 +6830,8 @@ void Read::performQualityClip(uint32 minqual, uint32 winlen)
       F2++;
     }
     if(avgquald < minquald) {
-      // Sheesh, we went through that Read without finding good quality,
-      //  set the REA_ql and REA_qr accordingly
+      // Sheesh, we went through that Read without finding good quality, 
+      //  set the REA_ql and REA_qr accordingly 
       REA_ql=static_cast<int32>(REA_qualities.size());
       REA_qr=0;
       exitprematurely=true;
@@ -6698,7 +6847,7 @@ void Read::performQualityClip(uint32 minqual, uint32 winlen)
       }
       vector<base_quality_t>::const_iterator RF2=F1;
       avgquald=static_cast<double>(qualtotal)/winlen_2d;
-      while(RF1!=REA_qualities.begin() && RF1 >= F2 && avgquald < minqualm5d){
+      while(RF1 >= F2 && avgquald < minqualm5d){
 	qualtotal+=*RF1;
 	qualtotal-=*RF2;
 	avgquald=static_cast<double>(qualtotal)/winlend;
@@ -6730,12 +6879,12 @@ void Read::performQualityClip(uint32 minqual, uint32 winlen)
 	F2--;
       }
       if(avgquald < minquald) {
-	// Sheesh, we went through that Read without finding good quality,
+	// Sheesh, we went through that Read without finding good quality, 
 	//  this ... eh ... cannot be! (remember, we found forward!)
 	updateClipoffs();
 	refreshPaddedSequence();
 	cout << *this;
-	MIRANOTIFY(Notify::INTERNAL, "Quality clipping error: no backward cutoff, but forward found?");
+	throw Notify(Notify::INTERNAL, THISFUNC, "Quality clipping error: no backward cutoff, but forward found?");
       } else {
 	if(F1<REA_qualities.begin()) F1=REA_qualities.begin();
 	vector<base_quality_t>::const_iterator RF1=F1;
@@ -6782,8 +6931,6 @@ void Read::performQualityClip(uint32 minqual, uint32 winlen)
  * physically trims the read to the left and right clips
  * tags completely outside new bounds are erased, others get positions adjusted
  *
- * reads of length 0 get to read of length 1, containing only 1 "N"
- *
  *************************************************************************/
 
 void Read::performHardTrim()
@@ -6797,10 +6944,7 @@ void Read::performHardTrim()
 
   // see whether to completely delete
   if(getLenClippedSeq()==0){
-    static const char * nseq = "N";
-
-    REA_tags.clear();
-    setSequenceFromString(nseq);
+    discard();
   }else{
     // see whether to trim on right
     if(static_cast<int32>(getLenSeq()) - getRightClipoff() >0){
@@ -6810,27 +6954,22 @@ void Read::performHardTrim()
       REA_pcs_dirty=true;
       if(!REA_qualities.empty()){
 	BUGIFTHROW(REA_qualities.size()<getRightClipoff()-1,"REA_qualities.size()<getRightClipoff()-1 ?");
-	REA_qualities.resize(getRightClipoff()-1);
+	REA_qualities.resize(getRightClipoff()-1);      
       }
       if(!REA_adjustments.empty()){
 	BUGIFTHROW(REA_adjustments.size()<getRightClipoff()-1,"REA_adjustments.size()<getRightClipoff()-1 ?");
-	REA_adjustments.resize(getRightClipoff()-1);
+	REA_adjustments.resize(getRightClipoff()-1);      
       }
-      if(REA_rlevptr!=nullptr){
-	BUGIFTHROW(REA_rlevptr->size()<getRightClipoff()-1,"REA_rlevptr->size()<getRightClipoff()-1 ?");
-	REA_rlevptr->resize(getRightClipoff()-1);
-      }
-
       if(!REA_bposhashstats.empty()){
 	BUGIFTHROW(REA_bposhashstats.size()<getRightClipoff()-1,"REA_bposhashstats.size()<getRightClipoff()-1 ?");
-	REA_bposhashstats.resize(getRightClipoff()-1);
+	REA_bposhashstats.resize(getRightClipoff()-1);      
       }
-
+      
       REA_qr=REA_padded_sequence.size();
-      REA_sr=REA_padded_sequence.size();
+      REA_sr=REA_padded_sequence.size(); 
       REA_cr=REA_padded_sequence.size();
       REA_mr=REA_padded_sequence.size();
-
+      
       vector<multitag_t>::iterator tI=REA_tags.begin();
       for(uint32 tagpos=0; tI != REA_tags.end(); ++tagpos){
 	if(tI->from >= REA_padded_sequence.size()) {
@@ -6844,8 +6983,8 @@ void Read::performHardTrim()
 	}
       }
     }
-
-
+    
+    
     // see whether to trim on left
     if(getLeftClipoff()>0){
       BUGIFTHROW(REA_padded_sequence.size()<getRightClipoff()-1,"2 REA_padded_sequence.size()<getRightClipoff()-1 ?");
@@ -6870,19 +7009,12 @@ void Read::performHardTrim()
 	vector<int32>::iterator eI=bI;
 	advance(eI,getLeftClipoff());
 	REA_adjustments.erase(bI,eI);
-
+	
 	vector<int32>::iterator aI=REA_adjustments.begin();
 	for(; aI != REA_adjustments.end(); ++aI){
 	  if(*aI >=0 ) (*aI)-=getLeftClipoff();
 	}
       }
-      if(REA_rlevptr!=nullptr){
-	BUGIFTHROW(REA_rlevptr->size()<getRightClipoff()-1,"REA_rlevptr->size()<getRightClipoff()-1 ?");
-	auto bI=REA_rlevptr->begin();
-	auto eI=bI;
-	advance(eI,getLeftClipoff());
-	REA_rlevptr->erase(bI,eI);
-      }
       if(!REA_bposhashstats.empty()){
 	BUGIFTHROW(REA_bposhashstats.size()<getRightClipoff()-1,"REA_bposhashstats.size()<getRightClipoff()-1 ?");
 	vector<bposhashstat_t>::iterator bI=REA_bposhashstats.begin();
@@ -6890,7 +7022,7 @@ void Read::performHardTrim()
 	advance(eI,getLeftClipoff());
 	REA_bposhashstats.erase(bI,eI);
       }
-
+      
       vector<multitag_t>::iterator tI=REA_tags.begin();
       for(uint32 tagpos=0; tI != REA_tags.end(); ++tagpos){
 	if(tI->to < getLeftClipoff()) {
@@ -6904,14 +7036,14 @@ void Read::performHardTrim()
 	  ++tI;
 	}
       }
-
-      REA_qr-=getLeftClipoff();
-      REA_sr-=getLeftClipoff();
+      
+      REA_qr-=getLeftClipoff(); 
+      REA_sr-=getLeftClipoff(); 
       REA_cr-=getLeftClipoff();
       REA_mr-=getLeftClipoff();
-
-      REA_ql=0;
-      REA_sl=0;
+      
+      REA_ql=0; 
+      REA_sl=0; 
       REA_cl=0;
       REA_ml=0;
     }
@@ -6925,7 +7057,7 @@ void Read::performHardTrim()
 
 /*************************************************************************
  *
- * deletes the weakest base of a base run
+ * deletes the weakest base of a base run 
  * can also insert a gap with quality 0 at the *original* position
  *  given in the run (helps to delete a weak base also in aligned reads
  *  without breaking the alignment)
@@ -6982,11 +7114,11 @@ bool Read::getPosOfWeakestBaseInRun(char base, uint32 & position)
   uint32 minqualpos=position;
   bool foundmin=false;
 
-  // check stretch of char base to left
+  // check stretch of char base to left 
   // if several bases have the same loq qual, takes farthest right
   {
     int32 rrpi=position-1;
-
+    
     for(; rrpi>=0; rrpi--){
       if(REA_padded_sequence[rrpi] != '*') {
 	if(toupper(REA_padded_sequence[rrpi]) == base) {
@@ -7001,12 +7133,12 @@ bool Read::getPosOfWeakestBaseInRun(char base, uint32 & position)
       }
     }
   }
-
+  
   // check stretch of char base to right
   // if several bases have the same loq qual, takes farthest right
   {
     int32 rrpi=position;
-
+    
     for(; rrpi < static_cast<int32>(REA_padded_sequence.size()); rrpi++){
       if(REA_padded_sequence[rrpi] != '*'){
 	if(toupper(REA_padded_sequence[rrpi]) == base) {
@@ -7035,177 +7167,143 @@ bool Read::getPosOfWeakestBaseInRun(char base, uint32 & position)
 
 
 
-///*************************************************************************
-// *
-// * transfers read type and strain names from MINF or MIT2 tags
-// *  into REA_... variables
-// * uses extractMINFTagInfo which deletes the tags after processing
-// *
-// *************************************************************************/
-//
-//void Read::transferMINFTagsToReadInfo()
-//{
-//  FUNCSTART("void Read::transferMINFTagsToReadInfo()");
-//
-//  string dummy_strainname;
-//  string dummy_seqtypename;
-//  string dummy_machinetype;
-//  bool dummy_isbb;
-//  bool dummy_isCER;
-//
-//  extractMINFTagInfo(dummy_strainname,
-//		     dummy_seqtypename,
-//		     dummy_machinetype,
-//		     dummy_isbb,
-//		     dummy_isCER);
-//
-//  FUNCEND();
-//}
-
 /*************************************************************************
  *
- * extract read type and strain names from MINF or MIT2 tags
- *
+ * transfers read type and strain names from MINF tags into REA_... variables
  * deletes the tags after processing
  *
- * currently, israil is always false (as not written to CAF anyway)
- *
- * returns false if no MINF/MIT2 tags were encountered; else true
- *
  *************************************************************************/
 
-bool Read::extractMINFTagInfo(vector<multitag_t> & tags, const string & readname, string & dummy_strainname, string & dummy_seqtypename, string & dummy_machinetype, int8 & dummy_tplacementcode, bool & dummy_isbb, bool & dummy_israil, bool & dummy_isCER)
+void Read::transferMINFTagsToReadInfo()
 {
-  FUNCSTART("void Read::extractMINFTagInfo(vector<multitag_t> & tags, const string & readname, string & dummy_strainname, string & dummy_seqtypename, string & dummy_machinetype, int8 & dummy_tplacementcode, bool & dummy_isbb, bool & dummy_isCER)");
+  FUNCSTART("void Read::transferMINFTagsToReadInfo()");
 
-  bool retval=false;
-  dummy_strainname.clear();
-  dummy_seqtypename.clear();
-  dummy_machinetype.clear();
-  dummy_tplacementcode=ReadGroupLib::SPLACE_UNKNOWN;
-  dummy_isbb=false;
-  dummy_israil=false;
-  dummy_isCER=false;
-
-  vector<multitag_t>::iterator tI=tags.begin();
-  while(tI!=tags.end()){
+  vector<multitag_t>::iterator tI=REA_tags.begin();
+  while(tI!=REA_tags.end()){
     if(tI->identifier==REA_tagentry_idMINF){
-      retval=true;
-      dummy_strainname.clear();
-      dummy_seqtypename.clear();
-      dummy_machinetype.clear();
-      dummy_isbb=false;
-      dummy_israil=false;
-      dummy_isCER=false;
-
       // extract values from tag comment
       // they're not GenBank comments, but stored the same way
       //  let's misuse the function then :-)
       string value;
-      tI->extractGenBankKeyValueFromComment("ST",dummy_seqtypename);
+      tI->extractGenBankKeyValueFromComment("ST",value);
+      if(!value.empty()){
+	REA_seqtype=stringToSeqType(value);
+	if(REA_seqtype==getNumSequencingTypes()){
+	  MIRANOTIFY(Notify::FATAL, "Error in " << getName() << " with unknown sequencing type " << value << " in ST part of MINF tag.\n");
+	}
+      }else{
+	//REMOVEME: in version 3
+	// keep compatibility to MIRA versions that used RT=...
+	tI->extractGenBankKeyValueFromComment("RT",value);
+	if(!value.empty()){
+	  cerr << "Warning in " << getName() << ": using 'RT=' in MINF tag is deprecated, use 'ST='\n";
+	  cout << "Warning in " << getName() << ": using 'RT=' in MINF tag is deprecated, use 'ST='\n";
+	  REA_seqtype=stringToSeqType(value);
+	  if(REA_seqtype==getNumSequencingTypes()){
+	    if(value=="454GS20"){
+	      REA_seqtype=SEQTYPE_454GS20;
+	    }else{
+	      MIRANOTIFY(Notify::FATAL, "Error in " << getName() << " with unknown sequencing type " << value << " in deprecated RT part of MINF tag.\n");
+	    }
+	  }
+	}
+      }
 
-      tI->extractGenBankKeyValueFromComment("SN",dummy_strainname);
+      tI->extractGenBankKeyValueFromComment("SN",value);
+      REA_strain=REA_sc_strain.addEntry(value);
+      //cout << "tI: Read " << getName() << "\tSN: " << REA_strain << '\n';
 
-      tI->extractGenBankKeyValueFromComment("MT",dummy_machinetype);
+      tI->extractGenBankKeyValueFromComment("MT",value);
+      REA_machine_type=REA_sc_machine_type.addEntry(value);
 
       tI->extractGenBankKeyValueFromComment("BB",value);
       if(!value.empty() && value!="0"){
-	dummy_isbb=true;
-      }
-      tI->extractGenBankKeyValueFromComment("RR",value);
-      if(!value.empty() && value!="0"){
-	dummy_israil=true;
+	setBackbone(true);
       }
 
       tI->extractGenBankKeyValueFromComment("CER",value);
       //cout << tI-> comment << "\nmsrextract: " << value << endl;
       if(!value.empty() && value!="0"){
-	dummy_isCER=true;
-      }
-
-      // Ok, extracted everything. delete this tag
-      tI=tags.erase(tI);
-    }else if(tI->identifier==REA_tagentry_idMIT2){
-      retval=true;
-      dummy_strainname.clear();
-      dummy_seqtypename.clear();
-      dummy_machinetype.clear();
-      dummy_isbb=false;
-      dummy_israil=false;
-      dummy_isCER=false;
-
-      string tmpdecode;
-      vector<string> attributes;
-
-      // TODO: adapt to readgroups
-
-      attributes.reserve(6);
-      boost::split(attributes, tI->getCommentStr(), boost::is_any_of(";"),boost::token_compress_on);
-      vector<string> keyvalue;
-      keyvalue.reserve(2);
-      vector<string>::const_iterator aI=attributes.begin();
-      for(; aI != attributes.end(); ++aI){
-	keyvalue.clear();
-	boost::split(keyvalue, *aI, boost::is_any_of("="));
-	if(keyvalue.size()==2){
-	  if(keyvalue[0] == "st"){
-	    dummy_seqtypename=keyvalue[1];
-	  }else if(keyvalue[0] == "sn"){
-	    gff3Decode(keyvalue[1],tmpdecode);
-	    dummy_strainname=tmpdecode;
-	  }else if(keyvalue[0] == "mt"){
-	    gff3Decode(keyvalue[1],tmpdecode);
-	    dummy_machinetype=tmpdecode;
-	  }else if(keyvalue[0] == "bb"){
-	    if(!keyvalue[1].empty() && keyvalue[1]!="0"){
-	      dummy_isbb=true;
-	    }
-	  }else if(keyvalue[0] == "rr"){
-	    if(!keyvalue[1].empty() && keyvalue[1]!="0"){
-	      dummy_israil=true;
-	    }
-	  }else if(keyvalue[0] == "pc"){
-	    if(!ReadGroupLib::parseSegmentPlacement(keyvalue[1],dummy_tplacementcode)){
-	      MIRANOTIFY(Notify::FATAL, "Error in " << readname << ": key type 'pc' has unknown value in MIT2 tag: " << tI->getCommentStr() << "\n");
-	    }
-	  }else if(keyvalue[0] == "cer"){
-	    if(!keyvalue[1].empty() && keyvalue[1]!="0"){
-	      dummy_isCER=true;
-	    }
-	  }else{
-	    MIRANOTIFY(Notify::FATAL, "Error in " << readname << " with unknown key type '" << keyvalue[0] << "' in MIT2 tag: " << tI->getCommentStr() << "\n");
-	  }
-	}
+	setCoverageEquivalentRead(true);
       }
 
       // Ok, extracted everything. delete this tag
-      tI=tags.erase(tI);
+      tI=REA_tags.erase(tI);
     }else{
       tI++;
     }
   }
 
   FUNCEND();
-  return retval;
+  return;
 }
 
 
+/*************************************************************************
+ *
+ * Returns code for sequencing type given in value string
+ * or SEQTYPE_END if string was not recognised
+ *
+ *************************************************************************/
+
+uint8 Read::stringToSeqType(const string & value)
+{
+  if(!value.empty()){
+    for(uint8 i=0; i<REA_namesofseqtypes.size(); i++){
+      if(value==REA_namesofseqtypes[i]) return i;
+    }
+
+    // *sigh* retain compatibility with mira < 3rc3
+    if(value=="454GS") return SEQTYPE_454GS20;
+  }
+
+  return getNumSequencingTypes();
+}
+
+
+/*************************************************************************
+ *
+ *
+ *************************************************************************/
+
+void Read::setSequencingType(uint8 st)
+{
+  FUNCSTART("void Read::setSequencingType(uint8 st)");
+  BUGIFTHROW(st>=getNumSequencingTypes(),"Trying to set illegal sequencing type " << st << " ?");
+  REA_seqtype=st;
+  FUNCEND();
+}
+
 
 ///*************************************************************************
 // *
 // *
+// *
+// *
 // *************************************************************************/
 //
-//void Read::setSequencingType(uint8 st)
+//uint32 Read::deleteTag(const string & identifier)
 //{
-//  FUNCSTART("void Read::setSequencingType(uint8 st)");
-//  BUGIFTHROW(st>=ReadGroupLib::getNumSequencingTypes(),"Trying to set illegal sequencing type " << st << " ?");
-//  getSequencingType()=st;
+//  FUNCSTART("void Read::deleteTag(const string & identifier)");
+//
+//  paranoiaBUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
+//
+//  uint32 deleted=0;
+//  vector<multitag_t>::iterator tI=REA_tags.begin();
+//  while(tI!=REA_tags.end()){
+//    if(identifier==tI->getIdentifierStr()){
+//      tI=REA_tags.erase(tI);
+//      deleted++;
+//    }else{
+//      tI++;
+//    }
+//  }
+//
 //  FUNCEND();
+//  return deleted;
 //}
 
 
-
 /*************************************************************************
  *
  *
@@ -7217,7 +7315,7 @@ uint32 Read::deleteTag(const multitag_t::mte_id_t identifier)
 {
   FUNCSTART("uint32 Read::deleteTag(const multitag_t::mte_id_t identifier)");
 
-  paranoiaBUGIF(checkRead()!=nullptr, MIRANOTIFY(Notify::FATAL, checkRead()));
+  paranoiaBUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
 
   uint32 deleted=0;
   vector<multitag_t>::iterator tI=REA_tags.begin();
@@ -7248,14 +7346,14 @@ uint32 Read::deleteTag(const uint32 from, const uint32 to, const string & identi
 {
   FUNCSTART("void Read::deleteTag(uint32 from, uint32 to, const string & identifier)");
 
-  paranoiaBUGIF(checkRead()!=nullptr, MIRANOTIFY(Notify::FATAL, checkRead()));
+  paranoiaBUGIF(checkRead()!=NULL, throw Notify(Notify::FATAL, THISFUNC, checkRead()));
 
   uint32 deleted=0;
   vector<multitag_t>::iterator tI=REA_tags.begin();
   while(tI!=REA_tags.end()){
-    if(tI->from == from
+    if(tI->from == from 
        && tI->to != to
-       && (identifier.empty() == false
+       && (identifier.empty() == false 
 	   || identifier==tI->getIdentifierStr())){
       tI=REA_tags.erase(tI);
       deleted++;
@@ -7298,10 +7396,10 @@ void Read::exchangeNsWithGaps()
       REA_pcs_dirty=true;
       *cI='*';
       if(REA_uses_adjustments) *aI=-1;
-      switch(getSequencingType()){
-      case ReadGroupLib::SEQTYPE_SANGER :
-      case ReadGroupLib::SEQTYPE_SOLEXA :
-      case ReadGroupLib::SEQTYPE_ABISOLID : {
+      switch(REA_seqtype){
+      case SEQTYPE_SANGER :
+      case SEQTYPE_SOLEXA :
+      case SEQTYPE_ABISOLID : {
 	base_quality_t newqual=0;
 	base_quality_t poslooked=0;
 	if(cI!=REA_padded_sequence.begin()){
@@ -7325,7 +7423,7 @@ void Read::exchangeNsWithGaps()
 	}
 	break;
       }
-      case ReadGroupLib::SEQTYPE_454GS20 : {
+      case SEQTYPE_454GS20 : {
 	*qI=1;
       }
       default: {
@@ -7343,387 +7441,63 @@ void Read::exchangeNsWithGaps()
 
 
 
-
-
-
 /*************************************************************************
  *
  *
  *
+ *
+ *
  *************************************************************************/
 
-void Read::blindSeqData(char base)
+const string & Read::getNameOfSequencingType(uint32 st)
 {
-  FUNCSTART("void Read::blindSeqData(char base)")
-  if(!REA_has_valid_data) {
-    FUNCEND();
-    return;
-  }
-
-  // TODO: perhaps also work with reverse? but not needed now
-
-  if(!REA_ps_dirty){
-    vector<char>::iterator cI=REA_padded_sequence.begin();
-    for(; cI!=REA_padded_sequence.end(); cI++){
-      if(*cI != '*' && *cI != 'n' && *cI != 'N') *cI=base;
-    }
-  }
-
-  if(!REA_pcs_dirty){
-    base=dptools::getComplementIUPACBase(base);
-    vector<char>::iterator cI=REA_padded_complementsequence.begin();
-    for(; cI!=REA_padded_complementsequence.end(); cI++){
-      if(*cI != '*' && *cI != 'n' && *cI != 'N') *cI=base;
-    }
-  }
-
+  FUNCSTART("const string & Read::getNameOfSequencingType(uint32 st)");
+  BUGIFTHROW(st>=REA_namesofseqtypes.size(),"Asking for name of unknown sequencing type " << st << " ?");
   FUNCEND();
+  return REA_namesofseqtypes[st];
 }
 
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-void Read::upDownCase(base_quality_t threshold)
+const string & Read::getShortNameOfSequencingType(uint32 st)
 {
-  FUNCSTART("void Read::upDownCase(base_quality_t threshold)");
-  if(!REA_has_valid_data) {
-    FUNCEND();
-    return;
-  }
-
-  // TODO: perhaps also work with reverse? but not needed now
-  refreshPaddedSequence();
-
-  vector<char>::iterator cI=REA_padded_sequence.begin();
-  vector<base_quality_t>::iterator qI=REA_qualities.begin();
-  for(; cI!=REA_padded_sequence.end(); cI++, ++qI){
-    *cI=static_cast<char>(toupper(*cI));
-    if(*qI<threshold) *cI=static_cast<char>(tolower(*cI));
-  }
-
-  REA_pcs_dirty=true;
-
+  FUNCSTART("const string & Read::getShortNameOfSequencingType(uint32 st)");
+  BUGIFTHROW(st>=REA_namesofseqtypes.size(),"Asking for name of unknown sequencing type " << st << " ?");
   FUNCEND();
+  return REA_shortnamesofseqtypes[st];
 }
 
 
 
+
 /*************************************************************************
  *
  *
  *
  *************************************************************************/
 
-void Read::upDownCaseClips()
+void Read::blindSeqData(char base)
 {
-  FUNCSTART("void Read::upDownCaseClips()");
+  FUNCSTART("void Read::blindSeqData(char base)")
   if(!REA_has_valid_data) {
     FUNCEND();
     return;
   }
 
   // TODO: perhaps also work with reverse? but not needed now
-  refreshPaddedSequence();
-
-  vector<char>::iterator cI=REA_padded_sequence.begin();
-  auto lc=getLeftClipoff();
-  auto rc=getRightClipoff();
-  for(int32 si=0; cI!=REA_padded_sequence.end(); ++cI, ++si){
-    if(si>=lc && si<rc){
-      *cI=static_cast<char>(toupper(*cI));
-    }else{
-      *cI=static_cast<char>(tolower(*cI));
-    }
-  }
-
-  REA_pcs_dirty=true;
-
-  FUNCEND();
-}
-
-
-
-
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-void Read::loadDataFromEXP(string filename, string path)
-{
-  FUNCSTART("void Read::loadDataFromEXP()");
-
-  REA_has_valid_data=false;
-
-  EXP tmpexp;
-
-  boost::trim(path);
-  boost::trim(filename);
-  string fullpath(path);
-  if(!fullpath.empty()){
-    fullpath+="/";
-  }
-  fullpath+=filename;
-
-  tmpexp.load(fullpath.c_str());
-
-  // ok, get the name and SCFname from the exp file
-  {
-    // First, the name of the experiment
-    //REA_name.clear();
-    //REA_name=tmpexp.getID();
-    setName(tmpexp.getID());
-    if(getName().empty()){
-      MIRANOTIFY(Notify::FATAL, "The experiment has no name (no ID field found): " << filename);
-    }
-
-    // Now the SCF filename of the experiment
-    // TODO: readgroups. SCF filename
-    //REA_scf_filename.clear();
-    //REA_scf_filename=tmpexp.getLN();
-
-    //if(REA_scf_filename.empty()){
-    //  // FIXME: how to treat exp files without SCF data?
-    //  //throw Notify(Notify::FATAL, THISFUNC, REA_exp_filename, ": The experiment has no SCF file (no LN field found)");
-    //}
-  }
-
-
-  REA_ql=tmpexp.getQL();
-  REA_qr=tmpexp.getQR();
-  REA_sl=tmpexp.getSL();
-  REA_sr=tmpexp.getSR();
-  REA_cl=tmpexp.getCL();
-  REA_cr=tmpexp.getCR();
-
-  // TODO: adapt to readgroups
-  //REA_machine_type=REA_sc_machine_type.addEntry(tmpexp.getMA());
-  //setInsize(tmpexp.getSIfrom(),tmpexp.getSIto());
-
-  // TODO: reactivate/emulate
-  //tmpexp.swapTags(REA_tags);      // the EXP will be destructed, so save time
-
-  // subtract 1 from the positions read in exp file (which are basis 1)
-  for(uint32 i=0; i<REA_tags.size(); i++ ){
-    REA_tags[i].from--;
-    REA_tags[i].to--;
-  }
-
-  if(REA_ql>REA_qr){
-#ifndef PUBLICQUIET
-    WARNING("WARNING: " << getName() << "   left quality clip > right quality clip (QL > QR), adjusted.");
-#endif
-    REA_qr=REA_ql;
-  }
-  if(REA_sl>REA_sr){
-#ifndef PUBLICQUIET
-    WARNING("WARNING: " << getName() << "   sequence vector left clip > sequence vector right clip (SL > SR), adjusted.");
-#endif
-    REA_sr=REA_sl;
-  }
 
-  updateClipoffs();
-
-  if(getRightClipoff()-getLeftClipoff()<0){
-#ifndef PUBLICQUIET
-    WARNING("WARNING: " << getName() << "   quality and sequence vector clippings form a negative length (clip right - clip left <0), adjusted");
-#endif
-    REA_qr=REA_sl;
-    updateClipoffs();
-  }
-
-  // initialise the sequence vector
-  {
-    const char * exp_sequence=tmpexp.getSequence().c_str();
-    if(exp_sequence==nullptr){
-      MIRANOTIFY(Notify::WARNING, "No bases were found: " << getName());
-    }
-
-    REA_padded_sequence.clear();
-    REA_padded_sequence.reserve(strlen(exp_sequence)+3);
-    do{
-      char tmpc=*exp_sequence++;
-      if(dptools::isValidIUPACBase(tmpc)){
-	REA_padded_sequence.push_back(tmpc);
-      }else{
-	switch(toupper(tmpc)){
-	case 'N':
-	case 'X':
-	case '*':{
-	  REA_padded_sequence.push_back(tmpc);
-	  break;
-	}
-	case '-': {
-	  REA_padded_sequence.push_back('N');
-	  break;
-	}
-	case 0 : {
-	  // FIXME: how to treat emtpy reads????
-	  //throw Notify(Notify::WARNING, THISFUNC, REA_exp_filename, ": No bases were found?");
-	  // cannot throw, isn't gentle enough for big projects :(
-	  WARNING("WARNING: " << tmpexp.getID() << "   has no bases in the experiment file?");
-	  // FIXME: pfusch!
-	  REA_padded_sequence.push_back('N');
-	  REA_ql=0;
-	  REA_qr=1;
-	  REA_sl=0;
-	  REA_sr=1;
-	  updateClipoffs();
-	  exp_sequence--;
-	  break;
-	}
-	default: {
-	  cout << "Illegal base: " << tmpc << "(" << hex << static_cast<uint16>(tmpc) << dec << ")" << endl;
-	  MIRANOTIFY(Notify::FATAL, "Illegal base found: " << tmpexp.getID());
-	}
-	}
-      }
-
-    }while(*exp_sequence!=0);
-  }
-
-  postLoadEXPFASTA();
-
-
-  REA_template=tmpexp.getTN();
-
-  // TODO: adapt to readgroups
-//  if(tmpexp.getSV().empty()){
-//    REA_seqvec_name=REA_sc_seqvec_name.addEntry(tmpexp.getSF());
-//  }else{
-//    REA_seqvec_name=REA_sc_seqvec_name.addEntry(tmpexp.getSV());
-//  }
-//  REA_basecaller=REA_sc_basecaller.addEntry(tmpexp.getBC());
-//  REA_asped=REA_sc_asped.addEntry(tmpexp.getDT());
-//  //  REA_dye;
-//  REA_processstatus=REA_sc_processstatus.addEntry(tmpexp.getPS());
-//  REA_primer=REA_sc_primer.addEntry(tmpexp.getPN());
-
-  //  read AV qualities if any
-  {
-    const vector<base_quality_t> & equal=tmpexp.getAV();
-    uint32 expavsize=static_cast<uint32>(equal.size());
-    if(expavsize>0 && expavsize!=REA_padded_sequence.size()){
-      cout << "Sequence length: " << REA_padded_sequence.size() << endl;
-      cout << "Number of quality values: " << expavsize << endl;
-      MIRANOTIFY(Notify::FATAL, "The experiment has an unequal number of bases and quality values (SQ vs AV fields): " << filename);
-    }
-    if(expavsize>0){
-      REA_has_quality=true;
-      for(uint32 i=0; i<REA_qualities.size(); i++){
-	REA_qualities[i]=equal[i];
-      }
+  if(!REA_ps_dirty){
+    vector<char>::iterator cI=REA_padded_sequence.begin();
+    for(; cI!=REA_padded_sequence.end(); cI++){
+      if(*cI != '*' && *cI != 'n' && *cI != 'N') *cI=base;
     }
   }
 
-  //  read ON adjustments
-  if(REA_uses_adjustments){
-    const vector<int32> onvals= tmpexp.getON();
-    if(onvals.size()){
-      if(onvals.size()%2) {
-	MIRANOTIFY(Notify::INTERNAL, "there should be a even number of ON adjustments: " << filename);
-      }
-      //vector<int32> newadjustments[REA_adjustments.size()];
-      vector<int32> newadjustments;
-      newadjustments.resize(REA_adjustments.size());
-      uint32 nai=0;
-      uint32 ovi=0;
-      while(ovi<onvals.size()){
-	//cout << onvals[ovi] << "  " << onvals[ovi+1] << endl;
-	if(onvals[ovi]==0){
-	  newadjustments[nai]=-1;
-	  nai++;
-	} else {
-	  uint32 onlow=onvals[ovi];
-	  uint32 onhigh=onvals[ovi+1];
-	  for(uint32 i=onlow; i<=onhigh; i++, nai++){
-	    if(nai>=newadjustments.size()) {
-	      MIRANOTIFY(Notify::FATAL, "the adjustments given in the ON tag exceed the size of the sequence: " << filename);
-	    }
-	    newadjustments[nai]=i-1;
-	  }
-	}
-	ovi+=2;
-      }
-      if(nai!=newadjustments.size()){
-	cout << "nai: " << nai << "  newadjustments.size(): " << newadjustments.size() << endl;
-	MIRANOTIFY(Notify::FATAL, "the adjustments given in the ON tag do not cover the whole range of sequence: " << filename);
-      }
-      REA_adjustments.swap(newadjustments);
+  if(!REA_pcs_dirty){
+    base=dptools::getComplementIUPACBase(base);
+    vector<char>::iterator cI=REA_padded_complementsequence.begin();
+    for(; cI!=REA_padded_complementsequence.end(); cI++){
+      if(*cI != '*' && *cI != 'n' && *cI != 'N') *cI=base;
     }
   }
 
-  //// transfer Mira INFormation in MINF tags to read variables
-  //transferMINFTagsToReadInfo();
-  {
-    string dummy_strainname,dummy_seqtype,dummy_machinetype;
-    int8 dummy_tplacementcode;
-    bool dummy_issbb, dummy_israil, dummy_isCER;
-    extractMINFTagInfo(REA_tags,getName(),
-		       dummy_strainname,dummy_seqtype,dummy_machinetype,
-		       dummy_tplacementcode,
-		       dummy_issbb, dummy_israil, dummy_isCER);
-  }
-
-  REA_has_valid_data=true;
-
-  REA_ml=0;
-  REA_mr=getLenSeq();
-
-  if(REA_qr<static_cast<int32>(REA_qualities.size())) REA_qr--;
-  if(REA_sr<static_cast<int32>(REA_qualities.size())) REA_sr--;
-  if(REA_cr<static_cast<int32>(REA_qualities.size())) REA_cr--;
-  updateClipoffs();
-
-  //  CEBUG(*this);
-  BUGIFTHROW(checkRead()!=nullptr, checkRead());
-
-  //tmpexp.dump();
-  //cout << *this;
-
   FUNCEND();
 }
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-int32 Read::getDigiNormMultiplier() const
-{
-  FUNCSTART("int32 Read::getDigiNormMultiplier() const");
-
-  static string notestr("Note");
-
-  int32 retvalue=1;
-
-  string dnrstr;
-  for(auto & te : REA_tags){
-    // Note: must also check whether DGNr tag covers the complete current sequence
-    // because sometimes reads get cut back in parts (e.g. those covered by DGNr)
-    //  and this then gives a completely wrong impression.
-    if(te.identifier==REA_tagentry_idDGNr
-       && !te.getCommentStr().empty()
-       && getLeftClipoff() >= te.from
-       && getRightClipoff()-1 <= te.to){
-      if(te.commentisgff3){
-	retvalue=atoi(GFFParse::extractKeytag(notestr,te.getCommentStr()).c_str());
-      }else{
-	retvalue=atoi(te.getCommentStr().c_str());
-      }
-      break;
-    }
-  }
-
-  BUGIFTHROW(retvalue==0,getName() << ": Found diginorm multiplier of 0?");
-
-  return retvalue;
-}
diff --git a/src/mira/read.H b/src/mira/read.H
index f222d1a..2f0ca6f 100644
--- a/src/mira/read.H
+++ b/src/mira/read.H
@@ -11,36 +11,47 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
+// 	$Id$	
+
 #ifndef _mira_read_h_
 #define _mira_read_h_
 
 
+#include <assert.h>
+
+#include <ctype.h>
+#include <math.h>
+
 #include <string>
 
+#include "stdinc/stlincludes.H"
+
 #include "stdinc/defines.H"
 #include "errorhandling/errorhandling.H"
 
+#include "io/exp.H"
+#include "io/scf.H"
+#include "util/memusage.H"
+#include "util/misc.H"
+#include "util/dptools.H"
 #include "mira/enums.H"
-#include "mira/readgrouplib.H"
+#include "mira/stringcontainer.H"
 #include "mira/multitag.H"
 
-#include "util/memusage.H"
 
-template <class T> class StringContainer;
-class multitag_t;
 
 #define BQ_UNDEFINED 255
 
@@ -48,21 +59,27 @@ class Read
 {
 
 public:
-  enum read_output_type {AS_ILLEGAL=0, AS_TEXT, AS_TEXTSHORT, AS_TEXTCLIPS, AS_CAF, AS_BAF, AS_MAF, AS_FASTA, AS_FASTQ, AS_CLIPPEDFASTA, AS_MASKEDMASKFASTA, AS_SEQVECMASKEDFASTA, AS_FASTAQUAL, AS_CLIPPEDFASTAQUAL, AS_MASKEDMASKFASTAQUAL, AS_SEQVECMASKEDFASTAQUAL, AS_ACE, AS_ACE_COMPLEMENT, AS_GAP4DA, AS_READNAME, AS_GBF, AS_PHD};
+  enum read_output_type {AS_TEXT=0, AS_TEXTSHORT, AS_TEXTCLIPS, AS_CAF, AS_BAF, AS_MAF, AS_FASTA, AS_FASTQ, AS_CLIPPEDFASTA, AS_MASKEDMASKFASTA, AS_SEQVECMASKEDFASTA, AS_FASTAQUAL, AS_CLIPPEDFASTAQUAL, AS_MASKEDMASKFASTAQUAL, AS_SEQVECMASKEDFASTAQUAL, AS_ACE, AS_ACE_COMPLEMENT, AS_GAP4DA};
+
+  // Don't forget to also change the same definition in parameters.H!!!
+  enum read_sequencing_type {SEQTYPE_SANGER=0, SEQTYPE_454GS20, SEQTYPE_IONTORRENT, SEQTYPE_PACBIO, SEQTYPE_SOLEXA, SEQTYPE_ABISOLID, SEQTYPE_END};
+
+// cludge to get the C(++) preprocessor know the number of sequencing types, adapt
+//  according to the enum array above
+#define CPP_READ_SEQTYPE_END 6
 
   enum bhashstat_bits {BHSBITS_NONE=0,
 		       BHSBITS_DEFAULT=0,
 		       BHSBITS_FREQUENCY=7,
 		       BHSBITS_SEENATLOWPOS=8,
-		       BHSBITS_CONFIRMED_FWDREV=0x10,
+		       BHSBITS_CONFIRMED_FWDREV=0x10, 
 		       BHSBITS_CONFIRMED_MULTIPLESEQTYPE=0x20,
-		       BHSBITS_KMERFORK=0x40,
-		       BHSBITS_BITSAREVALID=0x80,
-		       BHSBITS_ALL=0xff};
+		       BHSBITS_BITSAREVALID=0x40,
+		       BHSBITS_ALL=0x7f};
 
   /* the three bits for frequency above are used like this:
      0 no info
-     1 single hash or actively masked out k-mer
+     1 single hash
      2 below nmc
      3 non-mc
      4 above nmc
@@ -70,7 +87,7 @@ public:
      6 crazy
 
 
-     the routines below rely on bit numbering 76543210
+     the routines below rely on bit numbering 76543210 
   */
 
   /*
@@ -82,7 +99,7 @@ public:
     The fwd holds status of hash for seqence from 20-29
     The rev holds status of hash for rev compl. seq from 20 to 11
   */
-
+    
   struct bhashstat_t {
     uint8 flags;
 
@@ -121,14 +138,8 @@ public:
     inline bool hasConfirmedMultipleSeqType() const {
       return flags&Read::BHSBITS_CONFIRMED_MULTIPLESEQTYPE;
     }
-    inline void setKMerFork() {
-      flags=flags|Read::BHSBITS_KMERFORK;
-    }
-    inline bool isKMerFork() const {
-      return flags&Read::BHSBITS_KMERFORK;
-    }
 
-    friend std::ostream & operator<<(std::ostream &ostr, const bhashstat_t & bhs){
+    friend ostream & operator<<(ostream &ostr, const bhashstat_t & bhs){
       //ostr << hex << static_cast<uint16>(bhs.flags) << dec << ' ';
       if(bhs.isValid()){
 	ostr << "valid ";
@@ -138,7 +149,6 @@ public:
       if(bhs.hasSeenAtLowPos()) ostr << "slp ";
       if(bhs.hasConfirmedFwdRev()) ostr << "fr ";
       if(bhs.hasConfirmedMultipleSeqType()) ostr << "mst ";
-      if(bhs.isKMerFork()) ostr << "kmrf ";
       ostr << '#' << static_cast<uint16>(bhs.getFrequency()) << ' ';
 
       return ostr;
@@ -197,59 +207,43 @@ public:
       if(direction>0) return fwd.hasConfirmedMultipleSeqType();
       return rev.hasConfirmedMultipleSeqType();
     }
-    inline void setKMerFork(int8 direction) {
-      if(direction>0) fwd.setKMerFork();
-      rev.setKMerFork();
-    }
-    inline bool isKMerFork(int8 direction) const {
-      if(direction>0) return fwd.isKMerFork();
-      return rev.isKMerFork();
-    }
 
-    friend std::ostream & operator<<(std::ostream &ostr, const bposhashstat_t & bhs){
+    friend ostream & operator<<(ostream &ostr, const bposhashstat_t & bhs){
       ostr << "f: " << bhs.fwd << ' ';
       ostr << "r; " << bhs.rev << ' ';
       return ostr;
     }
-
-    bposhashstat_t() {};
   };
-
-
+  
+  
   // Static variables
 public:
   static const bposhashstat_t REA_bposhashstat_default;
 
+  static const vector<string> REA_namesofseqtypes;
+  static const vector<string> REA_shortnamesofseqtypes;
+
   // Note: due to possible static initialization fiasco,
   //       the REA_tagentry_* variables are defined/initialised
-  //       in "mira/preventinitfiasco.C" and not in "mira/read.C"
+  //       in "mira/multitag.C" and not in "mira/read.C"
   static const multitag_t::mte_id_t REA_tagentry_idEmpty;
 
   static const multitag_t::mte_id_t REA_tagentry_idMINF;
-  static const multitag_t::mte_id_t REA_tagentry_idMIT2;
-
-  static const multitag_t::mte_id_t REA_tagentry_idCOMM;
+  
+  static const multitag_t::mte_id_t REA_tagentry_idED_D;
+  static const multitag_t::mte_id_t REA_tagentry_idED_C;
+  static const multitag_t::mte_id_t REA_tagentry_idED_I;
 
   static const multitag_t::mte_id_t REA_tagentry_idESDN;
-
+  
   static const multitag_t::mte_id_t REA_tagentry_idSRMr;
   static const multitag_t::mte_id_t REA_tagentry_idCRMr;
   static const multitag_t::mte_id_t REA_tagentry_idWRMr;
   static const multitag_t::mte_id_t REA_tagentry_idSAOr;
   static const multitag_t::mte_id_t REA_tagentry_idSROr;
   static const multitag_t::mte_id_t REA_tagentry_idSIOr;
-  /* m version: "Marker"
-    these get written to GFF3 to indicate the position of 'c' version in the consensus tags so
-    that resulting GFF files can be used directly for subsequent mapping assemblies
-    without having the 'c' version in the then new backbone
-  */
-  static const multitag_t::mte_id_t REA_tagentry_idSAOm;
-  static const multitag_t::mte_id_t REA_tagentry_idSROm;
-  static const multitag_t::mte_id_t REA_tagentry_idSIOm;
-  static const multitag_t::mte_id_t REA_tagentry_idMCVm;
-  static const multitag_t::mte_id_t REA_tagentry_idSRMm;
-  static const multitag_t::mte_id_t REA_tagentry_idWRMm;
-
+  static const multitag_t::mte_id_t REA_tagentry_idPSHP;
+  static const multitag_t::mte_id_t REA_tagentry_idCJSP;
   static const multitag_t::mte_id_t REA_tagentry_idUNSr;
   static const multitag_t::mte_id_t REA_tagentry_idMNRr;
 
@@ -262,20 +256,6 @@ public:
   static const multitag_t::mte_id_t REA_tagentry_idHAF6;
   static const multitag_t::mte_id_t REA_tagentry_idHAF7;
 
-
-  static const multitag_t::mte_id_t REA_tagentry_idRLE1;
-  static const multitag_t::mte_id_t REA_tagentry_idRLE2;
-  static const multitag_t::mte_id_t REA_tagentry_idRLE3;
-  static const multitag_t::mte_id_t REA_tagentry_idRLE4;
-  static const multitag_t::mte_id_t REA_tagentry_idRLE5;
-  static const multitag_t::mte_id_t REA_tagentry_idRLE6;
-  static const multitag_t::mte_id_t REA_tagentry_idRLE7;
-  static const multitag_t::mte_id_t REA_tagentry_idRLE8;
-
-  static const multitag_t::mte_id_t REA_tagentry_idKMRF;
-
-  static const multitag_t::mte_id_t REA_tagentry_idDGNr;
-
   static const multitag_t::mte_id_t REA_tagentry_idMFSM;
 
 
@@ -284,23 +264,21 @@ public:
 
   static const multitag_t::mte_id_t REA_tagentry_idSVEC;
 
-  static const multitag_t::mte_id_t REA_tagentry_idSOFAdatabank_entry;
-  static const multitag_t::mte_id_t REA_tagentry_idSOFAcontig;
-  static const multitag_t::mte_id_t REA_tagentry_idSOFAgene;
-  static const multitag_t::mte_id_t REA_tagentry_idSOFACDS;
-  static const multitag_t::mte_id_t REA_tagentry_idSOFAexon;
-  static const multitag_t::mte_id_t REA_tagentry_idSOFAintron;
-  static const multitag_t::mte_id_t REA_tagentry_idSOFApolyA_sequence;
+  static const multitag_t::mte_id_t REA_tagentry_idFsrc;
+  static const multitag_t::mte_id_t REA_tagentry_idFgen;
+  static const multitag_t::mte_id_t REA_tagentry_idFCDS;
+  static const multitag_t::mte_id_t REA_tagentry_idFexn;
+  static const multitag_t::mte_id_t REA_tagentry_idFint;
+  static const multitag_t::mte_id_t REA_tagentry_idFpAS;
+ 
+  static const multitag_t::mte_id_t REA_tagentry_idFmRN;
+  static const multitag_t::mte_id_t REA_tagentry_idFm_R;
+  static const multitag_t::mte_id_t REA_tagentry_idFpRN;
+  static const multitag_t::mte_id_t REA_tagentry_idFrRN;
+  static const multitag_t::mte_id_t REA_tagentry_idFscR;
+  static const multitag_t::mte_id_t REA_tagentry_idFsnR;
+  static const multitag_t::mte_id_t REA_tagentry_idFtRN;
 
-  static const multitag_t::mte_id_t REA_tagentry_idSOFAmRNA;
-  static const multitag_t::mte_id_t REA_tagentry_idSOFAtranscript;
-  static const multitag_t::mte_id_t REA_tagentry_idSOFAprimary_transcript;
-  static const multitag_t::mte_id_t REA_tagentry_idSOFArRNA;
-  static const multitag_t::mte_id_t REA_tagentry_idSOFAscRNA;
-  static const multitag_t::mte_id_t REA_tagentry_idSOFAsnRNA;
-  static const multitag_t::mte_id_t REA_tagentry_idSOFAtRNA;
-
-  static const multitag_t::mte_id_t REA_tagentry_idSOFAmiraitagstore;
 
   static const multitag_t::mte_co_t REA_tagentry_coEmpty;
   static const multitag_t::mte_co_t REA_tagentry_coUnknown;
@@ -310,51 +288,84 @@ public:
   static const multitag_t::mte_co_t REA_tagentry_coSAOr;
   static const multitag_t::mte_co_t REA_tagentry_coSROr;
   static const multitag_t::mte_co_t REA_tagentry_coSIOr;
+  static const multitag_t::mte_co_t REA_tagentry_coFpAS;
   static const multitag_t::mte_co_t REA_tagentry_coPSHP;
   static const multitag_t::mte_co_t REA_tagentry_coUNSr;
 
-  static const multitag_t REA_defaulttag_SRMr;
-  static const multitag_t REA_defaulttag_CRMr;
-  static const multitag_t REA_defaulttag_WRMr;
-  static const multitag_t REA_defaulttag_SAOr;
-  static const multitag_t REA_defaulttag_SROr;
-  static const multitag_t REA_defaulttag_SIOr;
-  static const multitag_t REA_defaulttag_PSHP;
-  static const multitag_t REA_defaulttag_CJSP;
-
-  static const multitag_t REA_defaulttag_UNSr;
-  static const multitag_t REA_defaulttag_MNRr;
-
-  static const multitag_t REA_defaulttag_ED_C;
-  static const multitag_t REA_defaulttag_ED_D;
-  static const multitag_t REA_defaulttag_ED_I;
 
-  static const multitag_t REA_defaulttag_SOFApolyA_sequence;
-
-  static const std::vector<multitag_t::mte_id_t> REA_allhaftags;
 
 private:
 
   // a dummy variable, used in read.C to call the static initialiser
   // before entering main;
   static const bool REA_initialisedstatics;
-  static std::vector<double> REA_bqual2errorrate;
+  static vector<double> REA_bqual2errorrate;
 
 
   static StringContainer<uint32> REA_sc_readname;
 
   // StringContainer for additional info
+  static StringContainer<uint8> REA_sc_machine_type;
+  static StringContainer<uint8> REA_sc_primer;
+  static StringContainer<uint8> REA_sc_strain;
+  static StringContainer<uint8> REA_sc_basecaller;
+  static StringContainer<uint8> REA_sc_dye;
   static StringContainer<uint8> REA_sc_processstatus;
+
+  static StringContainer<uint16> REA_sc_clonevec_name;
+  static StringContainer<uint16> REA_sc_seqvec_name;
+
   static StringContainer<uint32> REA_sc_asped;
 
-  // controls the behaviour of std::cout << Read
+  // string container for pathanmes
+  static StringContainer<uint8> REA_sc_scf_pathname;
+  static StringContainer<uint8> REA_sc_exp_pathname;
+
+  // library with insert sizes
+  // (save memory using an uint8 libid in Read which points
+  //  to corresponding entry of this vector
+  // downside: only 255 different combinations of mate pairs
+  //  possible ... but which assembly project uses even 100???
+  struct insizelib_t {
+    int32 insize_from;
+    int32 insize_to;
+  };
+  static vector<insizelib_t> REA_insize_staticlib;
+
+  // controls the behaviour of cout << Read
   // this is not thread safe! calling functions must use mutexes
   static uint8 REA_outtype;
 
+  // A static array for fast complement conversion 
+  // has been moved to a util/misc.C function
+  //static char  REA_complement_base[256];
+
   static const char  REA_zerostring;
 
+  // Here's the logic to get the name of the read and the filenames
+  //  out of the given init-name:
+
+  //  char * REA_givenname;      // 0 terminated
+
+  static uint8  REA_cut_givenname;  /* cut n chars from name to get
+					a base name
+				     */ 
+  static string REA_add_4expfn;  /* add this to the basename to
+					  get the real exp filename 
+				       */
+  static string REA_add_4caffn;  /* add this to the basename to
+					  get the real caf filename 
+				       */
+  static string REA_add_4scffn;  /* add this to the basename to
+					  get the real scf filename 
+				       */
+
 private:
-  std::string REA_template;
+  string REA_template;
+
+  string REA_scf_filename;   // got from exp or caf file; evtl. constructed from fasta
+  //string REA_exp_filename;      // the constructed exp name; 
+  //string REA_caf_filename;      // the constructed caf name; 
 
   // The padded sequences
   //  changes allowed afterwards
@@ -362,102 +373,114 @@ private:
   //  insertions/deletions made to one sequence are not made directly in
   //   the other. Instead, the dirty flag of the other will be set and the
   //   other sequence will be recomputed when needed.
-  mutable std::vector<char> REA_padded_sequence;
-  mutable std::vector<char> REA_padded_complementsequence;
+  vector<char>           REA_padded_sequence;
+  vector<char>           REA_padded_complementsequence; 
 
 
   // The qualities of the bases called, for each trace one byte
   //  (as suggested for the staden package)
   // This vector is always padded
-  std::vector<base_quality_t> REA_qualities;
-
+  vector<base_quality_t> REA_qualities;
+  
   // The adjustment vector contains the relations between the bases
   //  in this class and the ones in the SCF file
   // Inserted bases have -1 as relation.
-  std::vector<int32>          REA_adjustments;
-
-  // NULL if unused
-  std::vector<uint8> * REA_rlevptr;
+  vector<int32>          REA_adjustments;
 
   // new in 2.9.41x4
   // each base can have flags set to it, at the moment 8 suffice
-  std::vector<bposhashstat_t>    REA_bposhashstats;
+  vector<bposhashstat_t>    REA_bposhashstats;
 
   // the tags set to the sequence
-  std::vector<multitag_t> REA_tags;
+  vector<multitag_t> REA_tags;
 
 
   // left cutoffs: 10 meaning bases[0..9] cut , take [10..]
 
-  int32 REA_ql;   // REA_qual_left_clipoff;
-  int32 REA_sl;	  // REA_svec_left_clipoff;
-  int32 REA_cl;	  // REA_clon_left_clipoff;
-  int32 REA_ml;	  // REA_maskbase_left_clipoff;
+  int32 REA_ql;   // REA_qual_left_clipoff;  
+  int32 REA_sl;	  // REA_svec_left_clipoff;  
+  int32 REA_cl;	  // REA_clon_left_clipoff;  
+  int32 REA_ml;	  // REA_maskbase_left_clipoff;  
 
   // right cutoffs: 100 meaning take bases [..99], cut [100..]
-  int32 REA_qr;	  // REA_qual_right_clipoff;
-  int32 REA_sr;	  // REA_svec_right_clipoff;
-  int32 REA_cr;   // REA_clon_right_clipoff;
-  int32 REA_mr;   // REA_maskbase_right_clipoff;
+  int32 REA_qr;	  // REA_qual_right_clipoff; 
+  int32 REA_sr;	  // REA_svec_right_clipoff; 
+  int32 REA_cr;   // REA_clon_right_clipoff; 
+  int32 REA_mr;   // REA_maskbase_right_clipoff; 
 
   /* ergo: xL and xR make normal c delimiters like in
      for(int i=xL, i<xR, i++) ... */
 
 
+  //int32 REA_leftclip;      // rightmost leftclip, clone and mask clip NOT! cared of
+  //int32 REA_rightclip;     // leftmost rightclip, clone and mask clip NOT! cared of
+  //int32 REA_len_clipped;   // rightclip - leftclip (0 if lower than 0)
+
+  //int32  REA_insize_from;
+  //int32  REA_insize_to;
+
+  //int32  REA_stadenid;
+
   int32  REA_templateid;               // ID of template
   int32  REA_templatepartnerid;        // ID of read in same template
 
 
+  //string REA_stolen;
+
+  //string REA_name;           // got from exp, caf or fasta file, 
   StringContainer<uint32>::Entry REA_nameentry;
   StringContainer<uint32>::Entry REA_asped;
-//  StringContainer<uint16>::Entry REA_clonevec_name;
-//  StringContainer<uint16>::Entry REA_seqvec_name;
-
-//  StringContainer<uint8>::Entry REA_machine_type;
-//  StringContainer<uint8>::Entry REA_primer;
-//  StringContainer<uint8>::Entry REA_strain;
-//  StringContainer<uint8>::Entry REA_basecaller;
-//  StringContainer<uint8>::Entry REA_dye;
+  StringContainer<uint16>::Entry REA_clonevec_name;
+  StringContainer<uint16>::Entry REA_seqvec_name;
+
+  StringContainer<uint8>::Entry REA_machine_type;
+  StringContainer<uint8>::Entry REA_primer;
+  StringContainer<uint8>::Entry REA_strain;
+  StringContainer<uint8>::Entry REA_basecaller;
+  StringContainer<uint8>::Entry REA_dye;
   StringContainer<uint8>::Entry REA_processstatus;
 
   StringContainer<uint8>::Entry REA_scf_pathname;
   StringContainer<uint8>::Entry REA_exp_pathname;
 
-  ReadGroupLib::ReadGroupID REA_rgid;
 
-//  char REA_template_end;    /* equivalent TRACE_END from TRACEINFO file
-//			       or to the ...F or ...R from TIGR naming scheme
-//			       or to p1cx and q1cx from Sanger scheme
-//
-//			       stores whether the read is from Forward,
-//			       or Reverse end of template
-//			       or unknowN
-//			       'F', 'R', 'N' (N is default) */
+  int8  REA_strainid;
+
+  uint8 REA_insize_libid;
+
+  uint8 REA_seqtype;         // what kind of data generated that read?
 
-  /* like old REA_template_end, but more versatile
-     0 : unknown / undefined (REA_template_end = 'N')
-     1 : 1st segment  (REA_template_end = 'F')
-     2..254: nth segment
-     255: last segment (REA_template_end = 'R') */
-  uint8 REA_template_segment;
+  uint8 REA_readnaming_scheme;    // how was the read named by which center?
+
+  char REA_template_end;    /* equivalent TRACE_END from TRACEINFO file
+			       or to the ...F or ...R from TIGR naming scheme
+			       or to p1cx and q1cx from Sanger scheme
+
+			       stores whether the read is from Forward,
+			       or Reverse end of template
+			       or unknowN
+			       'F', 'R', 'N' (N is default) */
+
+  // true: templates must be in same direction in contig
+  // false: one of the reads must be reverse
+  // (on >2 reads per template: no meaning atm)
+  bool REA_templatebuilddirection;
 
   // the dirty flags for the padded and padded complement sequence
-  mutable bool REA_ps_dirty:1;
-  mutable bool REA_pcs_dirty:1;
+  bool REA_ps_dirty:1;
+  bool REA_pcs_dirty:1;
 
   bool REA_has_quality:1;
   bool REA_has_basehashstats:1;
   bool REA_has_freqavg:1;
   bool REA_has_freqrept:1;
 
-  bool REA_has_kmerfork:1;
-
   // has the SCF been found and do the data seem valid?
   bool REA_scf_available:1;
   bool REA_scf_loadattempted:1;
 
-//  bool REA_name_scheme_valid:1;       /* was the name scheme valid, i.e.,
-//				       is it paired-end? */
+  bool REA_name_scheme_valid:1;       /* was the name scheme valid, i.e.,
+				       is it paired-end? */
 
   // Last not least, has this read valid data?
   bool REA_has_valid_data:1;
@@ -465,9 +488,9 @@ private:
   // is it used?
   bool REA_used_in_assembly:1;
 
-//  bool REA_isbackbone:1;
-//  bool REA_israil:1;
-//  bool REA_iscoverageequivalentread:1;
+  bool REA_isbackbone:1;
+  bool REA_israil:1;
+  bool REA_iscoverageequivalentread:1;
 
   // space saving
   //
@@ -485,17 +508,15 @@ private:
   static bool staticInitialiser();
 
   void foolCompiler();
-  void init();
   void zeroVars();
 
-  void dumpAsReadname(std::ostream & ostr);
-  void dumpAsBAF(std::ostream & ostr);
-  void dumpAsCAF(std::ostream & ostr);
-  void dumpAsMAF(std::ostream & ostr);
-  void dumpAsFASTQ(std::ostream & ostr, bool clippedonly, bool maskedseqvec, bool maskedmask);
-  void dumpAsFASTA(std::ostream & ostr, bool clippedonly, bool maskedseqvec, bool maskedmask);
-  void dumpAsFASTAQual(std::ostream & ostr, bool clippedonly, bool maskedseqvec, bool maskedmask);
-  void dumpAsACE(std::ostream & ostr, int32 direction);
+  void dumpAsBAF(ostream & ostr);
+  void dumpAsCAF(ostream & ostr);
+  void dumpAsMAF(ostream & ostr);
+  void dumpAsFASTQ(ostream & ostr, bool clippedonly, bool maskedseqvec, bool maskedmask);
+  void dumpAsFASTA(ostream & ostr, bool clippedonly, bool maskedseqvec, bool maskedmask);
+  void dumpAsFASTAQual(ostream & ostr, bool clippedonly, bool maskedseqvec, bool maskedmask);
+  void dumpAsACE(ostream & ostr, int32 direction);
 
   const char * sanityCheck() const;
 
@@ -504,25 +525,20 @@ private:
   void postLoadEXPFASTA();
 
   //void construct_names(const char * givenname);
-  void makeComplement(const std::vector<char> & source, std::vector<char> & destination) const;
+  void makeComplement(const vector<char> & source, vector<char> & destination);
   inline void updateClipoffs() const {};
   void updateTagBaseInserted(uint32 position);
   void updateTagBaseDeleted(uint32 position);
-  inline void refreshPaddedSequence() const {if(REA_ps_dirty) helper_refreshPaddedSequence();}
-  inline void refreshPaddedComplementSequence() const {if(REA_pcs_dirty) helper_refreshPaddedComplementSequence();}
-  void helper_refreshPaddedSequence() const;
-  void helper_refreshPaddedComplementSequence() const;
+  void refreshPaddedSequence();
+  void refreshPaddedComplementSequence();
   const char * processEXPTag(const char * ptr);
 
-  void  getInternalTemplateName_Sanger(std::string & tname, uint8 & segment);
-  void  getInternalTemplateName_TIGR(std::string & tname, uint8 & segment);
-  void  getInternalTemplateName_FR(std::string & tname, uint8 & segment);
-  void  getInternalTemplateName_Solexa(std::string & tname, uint8 & segment);
-  void  getInternalTemplateName_StLouis(std::string & tname, uint8 & segment);
-  void  getInternalTemplateName_SRARaw(std::string & tname, uint8 & segment);
+  string getInternalTemplateName_Sanger();
+  string getInternalTemplateName_TIGR();
+  string getInternalTemplateName_FR();
+  string getInternalTemplateName_Solexa();
+  string getInternalTemplateName_StLouis();
 
-  // sort on "from" ASCENDING and on "to" DESCENDING and on "identifier" ASCENDING
-  //
   static bool tag_t_comparator(const multitag_t & t1, const multitag_t & t2)
   {
     if(t1.from < t2.from) return true;
@@ -531,35 +547,10 @@ private:
     if(t1.to > t2.to) return false;
     return (t1.getIdentifierStr() < t2.getIdentifierStr());
   };
-
-  // sort on "from" ASCENDING and on "some special entries" FIXED ORDER and on "to" DESCENDING and on "identifier" ASCENDING
-  //
-  static bool tag_t_comparatorGFF3(const multitag_t & t1, const multitag_t & t2)
-  {
-    if(t1.from < t2.from) return true;
-    if(t1.from > t2.from) return false;
-    if(t1.identifier!=t2.identifier){
-      if(t1.identifier==Read::REA_tagentry_idSOFAdatabank_entry
-	 || t2.identifier==Read::REA_tagentry_idSOFAdatabank_entry) return t1.identifier==Read::REA_tagentry_idSOFAdatabank_entry;
-      if(t1.identifier==Read::REA_tagentry_idSOFAcontig
-	 || t2.identifier==Read::REA_tagentry_idSOFAcontig) return t1.identifier==Read::REA_tagentry_idSOFAcontig;
-      if(t1.identifier==Read::REA_tagentry_idSOFAgene
-	 || t2.identifier==Read::REA_tagentry_idSOFAgene) return t1.identifier==Read::REA_tagentry_idSOFAgene;
-      if(t1.identifier==Read::REA_tagentry_idSOFAmRNA
-	 || t2.identifier==Read::REA_tagentry_idSOFAmRNA) return t1.identifier==Read::REA_tagentry_idSOFAmRNA;
-      if(t1.identifier==Read::REA_tagentry_idSOFAexon
-	 || t2.identifier==Read::REA_tagentry_idSOFAexon) return t1.identifier==Read::REA_tagentry_idSOFAexon;
-      if(t1.identifier==Read::REA_tagentry_idSOFACDS
-	 || t2.identifier==Read::REA_tagentry_idSOFACDS) return t1.identifier==Read::REA_tagentry_idSOFACDS;
-    }
-    if(t1.to < t2.to) return true;
-    if(t1.to > t2.to) return false;
-    return (t1.getIdentifierStr() < t2.getIdentifierStr());
-  };
-
+  
   static double qualityToErrorRate_compute(base_quality_t qual);
 
-  //void transferMINFTagsToReadInfo();
+  void transferMINFTagsToReadInfo();
 
   void moderateContainerGrowth();
 
@@ -569,7 +560,7 @@ public:
   ~Read();
 
   Read const & operator=(Read const & other);
-  friend std::ostream & operator<<(std::ostream &ostr, Read const &read);
+  friend ostream & operator<<(ostream &ostr, Read const &read);
 
   size_t estimateMemoryUsage() const;
 
@@ -582,22 +573,31 @@ public:
 
   void integrityCheck() const;
 
-  static void dumpStringContainerStats(std::ostream & ostr);
+  static void dumpStringContainerStats(ostream & ostr);
   static void setCoutType(uint8 type);
-  void dumpAsGAP4DA(std::ostream & ostr, std::string & APline, bool outputTags=true);
-  void dumpTagsAsGFF3(std::ostream & ostr);
-  void getCIGARString(std::string & s) {s.clear();};
+  void dumpAsGAP4DA(ostream & ostr, string & APline, bool outputTags=true);
+  void getCIGARString(string & s) {s.clear();};
 
   void discard();
   const char * checkRead() const;
 
+  void setFileNamesFromEXPFileName(const string & filename);
+  void setFileNamesFromFASTAName(const string & fastaname);
+  void setFileNamesFromSCFFileName(const string & filename);
+  void setSCFFileName(const string & filename);
+
+  void setDirectories(const string & exp, 
+		      const string & scf
+		      );
+  void setSCFDirectory(const string & scf);
+
   void setSequenceFromString(const char * sequence);
-  inline void setSequenceFromString(const std::string & sequence) {
+  inline void setSequenceFromString(const string & sequence) {
     setSequenceFromString(sequence.c_str());
   };
 
-  const std::vector<char> & getActualSequence() const;
-  const std::vector<char> & getActualComplementSequence() const;
+  const vector<char> & getActualSequence() const;
+  const vector<char> & getActualComplementSequence() const;
 
   inline void disallowAdjustments(){
     REA_uses_adjustments=false;
@@ -606,27 +606,21 @@ public:
     }
   }
   inline bool usesAdjustments() const {return REA_uses_adjustments;};
-  inline const std::vector<int32> & getAdjustments() const
+  inline const vector<int32> & getAdjustments() const
     {return REA_adjustments;}
 
-  inline const std::vector<uint8> * getRLEValues() const
-    {return REA_rlevptr;}
-
   // NOT! 0 terminated. getLenClippedSeq() to get its length;
   const char * getClippedSeqAsChar() const;
   const char * getClippedComplementSeqAsChar() const;
   const char * getSeqAsChar() const;
-  const char * getComplementSeqAsChar() const;
-
-  void getSeqAsString(std::string & result);
 
-  std::vector<char>::const_iterator getSeqIteratorBegin() const;
-  std::vector<char>::const_iterator getSeqIteratorEnd() const;
-  std::vector<char>::const_iterator getComplementSeqIteratorBegin() const;
-  std::vector<char>::const_iterator getComplementSeqIteratorEnd() const;
+  vector<char>::const_iterator getSeqIteratorBegin() const;
+  vector<char>::const_iterator getSeqIteratorEnd() const;
+  vector<char>::const_iterator getComplementSeqIteratorBegin() const;
+  vector<char>::const_iterator getComplementSeqIteratorEnd() const;
 
-  std::vector<char>::const_iterator getClippedSeqIterator() const;
-  std::vector<char>::const_iterator getClippedComplementSeqIterator() const;
+  vector<char>::const_iterator getClippedSeqIterator() const;
+  vector<char>::const_iterator getClippedComplementSeqIterator() const;
 
   char getBaseInSequence(uint32 pos) const ;
   char getBaseInComplementSequence(uint32 pos) const ;
@@ -635,20 +629,8 @@ public:
   char getBaseInClippedSequence(uint32 pos) const;
   char getBaseInClippedComplementSequence(uint32 pos);
 
-  inline char nocheckGetBaseInSequence(uint32 pos) const {
-    refreshPaddedSequence();
-    return REA_padded_sequence[pos];
-  }
-  inline char nocheckGetBaseInComplementSequence(uint32 pos) const {
-    refreshPaddedComplementSequence();
-    return REA_padded_complementsequence[pos];
-  }
-  inline base_quality_t nocheckGetQualityInSequence(uint32 pos) const {return REA_qualities[pos];}
-  inline base_quality_t nocheckGetQualityInComplementSequence(uint32 pos) const {return REA_qualities[REA_qualities.size()-1-pos];}
-
-
   // Every change in the sequence also changes the complement (and
-  //  vice versa), but the changes are not made immediately
+  //  vice versa), but the changes are not made immediately 
   //  (caching mechanism in effect), only when needed.
   // inserts a base in front of the given position
   // deletes a base at the given position
@@ -664,9 +646,9 @@ public:
   void deleteBaseFromComplementSequence(uint32 uposition);
 
   // Every change here is made directly in both vectors (costs almost
-  //  no time), _IF_ they're valid.
+  //  no time), _IF_ they're valid. 
   // changes a base at the given position
-  void changeBaseInSequence(char base,
+  void changeBaseInSequence(char base, 
 			    base_quality_t quality,
 			    uint32 position);
   void changeBaseInComplementSequence(char base,
@@ -690,24 +672,22 @@ public:
   void deleteBaseFromClippedComplementSequence(uint32 position);
 
   // Every change here is made directly in both vectors (costs almost
-  //  no time), _IF_ they're valid.
+  //  no time), _IF_ they're valid. 
   // changes a base at the given position
-  void changeBaseInClippedSequence(char base,
+  void changeBaseInClippedSequence(char base, 
 				   base_quality_t quality,
 				   uint32 position);
   void changeBaseInClippedComplementSequence(char base,
 					     base_quality_t quality,
 					     uint32 position);
 
-  // This one is new, needed by disjoint de-Bruijn-Graph corrector
-  void smoothSequenceReplace(uint32 position, uint32 len, std::string & replacement);
 
-  inline const std::vector<base_quality_t> & getQualities() const
+  inline const vector<base_quality_t> & getQualities() const
     {return REA_qualities;}
-  void setQualities(const std::vector<base_quality_t> & quals);
+  void setQualities(const vector<base_quality_t> & quals);
   void setQualities(base_quality_t qual);
 
-  inline const std::vector<bposhashstat_t> & getBPosHashStats() const
+  inline const vector<bposhashstat_t> & getBPosHashStats() const
     {return REA_bposhashstats;}
   bposhashstat_t getBPosHashStats(uint32 pos) const;
   inline bposhashstat_t getBPosHashStatsInClippedSequence(uint32 pos) const {
@@ -719,9 +699,9 @@ public:
   }
 
   bool hasTheseBaseHashStatsSet(bposhashstat_t bf, uint32 pos) const;
-  inline void clearAllBPosHashStats() {
-    REA_bposhashstats.clear();
-    REA_bposhashstats.resize(getLenSeq(),REA_bposhashstat_default);
+  inline void clearAllBPosHashStats() { 
+    REA_bposhashstats.clear(); 
+    REA_bposhashstats.resize(REA_qualities.size(),REA_bposhashstat_default);
     REA_has_basehashstats=false;
   }
   inline void setHasBaseHashStats(bool b) { REA_has_basehashstats=b;}
@@ -732,56 +712,65 @@ public:
   inline void setHasFreqRept(bool b) { REA_has_freqrept=b;}
   inline bool hasFreqRept() const {return REA_has_freqrept;}
 
-  inline void setHasKMerFork(bool b) { REA_has_kmerfork=b;}
-  inline bool hasKMerFork() const {return REA_has_kmerfork;}
+  void setTags(const vector<tag_t> & tags);
+  void setTags(const vector<multitag_t> & tags);
 
-  void setTags(const std::vector<multitag_t> & tags);
-  void addTagO(const multitag_t & tag);          // TODO: rename back to addTag()
-  const multitag_t & getTag(uint32 tagnumber) const;
-  inline const std::vector<multitag_t> & getTags() const {return REA_tags;}
-  inline uint32 getNumOfTags() const { return static_cast<uint32>(REA_tags.size());}; // TODO: rename
+  // TODO:: phase out!!!!
+  void addTag(const tag_t & tag, bool onlygoodqual=true);
+  void addTag(uint32 from, uint32 to,
+	      const string & identifier, 
+	      const string & comment);
+	      //bool onlygoodqual=true);
+
+  // TODO:: multitag_t
+  void addTag(const multitag_t & tag, bool onlygoodqual=true);
+  void addTag(uint32 from, uint32 to,
+	      const multitag_t::mte_id_t identifier, 
+	      const multitag_t::mte_co_t comment);
+
+  void addTag(uint32 from, uint32 to,
+	      const multitag_t::mte_id_t identifier, 
+	      const string & comment);
 
 
   //bool hasTag(const string & identifier, int32 pos=-1) const;
   bool hasTag(const multitag_t::mte_id_t identifier, int32 pos=-1) const;
-  bool hasTag(const std::string & identifier, int32 pos) const;
-  static multitag_t::mte_id_t getTagID(const std::string & identifier);
+  bool hasTag(const string & identifier, int32 pos) const;
+  static multitag_t::mte_id_t getTagID(const string & identifier);
 
 
-  //uint32 countTags(const std::string & identifier, int32 pos=-1) const;
+  //uint32 countTags(const string & identifier, int32 pos=-1) const;
   uint32 countTags(const multitag_t::mte_id_t identifier, int32 pos=-1) const;
+  const multitag_t & getTag(uint32 tagnumber) const;
   void sortTags() {sort(REA_tags.begin(),REA_tags.end(),tag_t_comparator);};
-  void sortTagsForGFF3() {sort(REA_tags.begin(),REA_tags.end(),tag_t_comparatorGFF3);};
-
-  static bool extractMINFTagInfo(std::vector<multitag_t> & tags,
-				 const std::string & readname,
-				 std::string & strainname,
-				 std::string & seqtypename,
-				 std::string & machinetype,
-				 int8 & tplacementcode,
-				 bool & isbb,
-				 bool & israil,
-				 bool & isCER);
+  inline uint32 getNumOfTags() const { return static_cast<uint32>(REA_tags.size());};
 
   // TODO: multitag
-  //uint32 deleteTag(const std::string & identifier);
+  //uint32 deleteTag(const string & identifier);
   uint32 deleteTag(const multitag_t::mte_id_t identifier);
-  uint32 deleteTag(const uint32 from,
+  uint32 deleteTag(const uint32 from, 
 		   const uint32 to,
-		   const std::string & identifier);
+		   const string & identifier);
+
+
+  //inline void setName(const string & name) {
+  //  REA_nameentry=REA_sc_readname.addEntryNoDoubleCheck(name);
+  //};
+  void setName(const string & name);
+  inline const string & getName() const { return REA_sc_readname.getEntry(REA_nameentry);};
 
-  void clearTags() { REA_tags.clear(); };
+  inline const string & getSCFName() const { return REA_scf_filename;};
+  //inline const string & getEXPName() const { return REA_exp_filename;};
+  //inline const string & getCAFName() const { return REA_caf_filename;};
 
-  void setName(const std::string & name);
-  inline const std::string & getName() const { return REA_sc_readname.getEntry(REA_nameentry);};
+  //void getEXPName(string & fn) const { fn="";return;};
 
-  inline const std::string & getSCFName() const { std::cout << "Read::getSCFName() killed\n"; exit(0);};
 
-  void getSCFFullPathName(std::string & path) const;
-  void getEXPFullPathName(std::string & path) const;
+  void getSCFFullPathName(string & path) const;
+  void getEXPFullPathName(string & path) const;
 
-  void loadDataFromEXP(std::string filename, std::string path);
-  void loadDataFromSCF(const std::string & scfname);
+  void loadDataFromEXP(const string & filename);
+  void loadDataFromSCF(const string & scfname);
   void checkSCFAndLoadQual(bool justcheck, bool loadfailnoerror=false);
 
   // "sequence" has to be in fasta format (valid IUPAC codes,* is gap)
@@ -790,13 +779,12 @@ public:
 		                                // copied, else swaped (destr.)
 		      bool iscomplement,  // true, iv seq, qual, adj are compl.
 		      bool ispadded,
-		      ReadGroupLib::ReadGroupID rgid,
-		      std::vector<char>           & sequence,
-		      std::vector<base_quality_t> & qualities,
-		      std::vector<int32>          & adjustments,
-		      std::vector<multitag_t>     & tags,
-		      const std::string & name,
-		      const std::string & SCFname,
+		      vector<char>           & sequence,
+		      vector<base_quality_t> & qualities,
+		      vector<int32>          & adjustments,
+		      vector<tag_t>          & tags,
+		      const string & name,
+		      const string & SCFname,
 		      int32 ql, int32 qr,        // quality clipping left/right
 		      int32 sl, int32 sr,        // sequence vector clipping
 		      int32 cl, int32 cr         // clone vector clipping
@@ -807,48 +795,51 @@ public:
   void transformGapsToNs();
   void correctNStretch(const int32 from, const int32 to, int32 changeestim);
 
-  inline void setTemplate(const std::string & s) {REA_template=s;};
+  void setInsize(int32 from, int32 to);
+  //inline void setStadenID(int32 id) {REA_stadenid=id;};
+  inline void setTemplate(const string & s) {REA_template=s;};
   inline void setTemplatePartnerID(int32 id) {REA_templatepartnerid=id;}
   inline void setTemplateID(int32 id) {REA_templateid=id;};
-
-  inline void setAsped(const std::string & s) {REA_asped=REA_sc_asped.addEntry(s);};
-  inline void setProcessStatus(const std::string & s) {REA_processstatus=REA_sc_processstatus.addEntry(s);};
-
-  inline int32 getInsizeFrom() const {return REA_rgid.getInsizeFrom();};
-  inline int32 getInsizeTo() const {return REA_rgid.getInsizeTo();};
-
-  inline bool hasTemplateInfo() const {return REA_rgid.hasTemplateInfo();};
-  inline bool wantTemplateInfoEstimate() const {return REA_rgid.wantTemplateInfoEstimate();};
-  inline bool hasUserDefaultQuality() const {return REA_rgid.hasUserDefaultQual();};
-
+  inline void setStrainID(int8 id) {REA_strainid=id;};
+
+  inline void setClonevecName(const string & s) {REA_clonevec_name=REA_sc_clonevec_name.addEntry(s);};
+  inline void setSeqvecName(const string & s) {REA_seqvec_name=REA_sc_seqvec_name.addEntry(s);};
+  inline void setStrain(const string & s) {REA_strain=REA_sc_strain.addEntry(s);};
+  inline void setBasecaller(const string & s) {REA_basecaller=REA_sc_basecaller.addEntry(s);};
+  inline void setAsped(const string & s) {REA_asped=REA_sc_asped.addEntry(s);};
+  inline void setDye(const string & s) {REA_dye=REA_sc_dye.addEntry(s);};
+  inline void setProcessStatus(const string & s) {REA_processstatus=REA_sc_processstatus.addEntry(s);};
+  inline void setMachineType(const string & s) {REA_machine_type=REA_sc_machine_type.addEntry(s);};
+  inline void setPrimer(const string & s) {REA_primer=REA_sc_primer.addEntry(s);};
+
+  inline int32 getInsizeFrom() const {return REA_insize_staticlib[REA_insize_libid].insize_from;};
+  inline int32 getInsizeTo() const {return REA_insize_staticlib[REA_insize_libid].insize_to;};
+
+  //inline int32 getStadenID() const {return REA_stadenid;};
   inline int32 getTemplatePartnerID() const {return REA_templatepartnerid;};
-  inline const std::string & getTemplate() const { return REA_template;};
-  inline const std::string & getClonevecName() const { return REA_rgid.getCloneVecName();};
-  inline const std::string & getSeqvecName() const { return REA_rgid.getSeqVecName();};
-  inline const std::string & getStrainName() const { return REA_rgid.getStrainName();};
-  inline const std::string & getBaseCaller() const { return REA_rgid.getBaseCaller();};
-  inline const std::string & getAsped() const { return REA_sc_asped.getEntry(REA_asped);};
-  inline const std::string & getDye() const { return REA_rgid.getDye();};
-  inline const std::string & getProcessStatus() const { return REA_sc_processstatus.getEntry(REA_processstatus);};
-  inline const std::string & getMachineType() const { return REA_rgid.getMachineType();};
-  inline const std::string & getPrimer() const { return REA_rgid.getPrimer();};
-  inline int8 getStrainID() const {return REA_rgid.getStrainID();};
-
-  inline void setReadGroupID(ReadGroupLib::ReadGroupID rgid) {REA_rgid=rgid;}
-  inline ReadGroupLib::ReadGroupID getReadGroupID() const {return REA_rgid;}
-
-  inline uint8 getReadNamingScheme() const {return REA_rgid.getReadNamingScheme();};
-  //std::string getInternalTemplateName();
-  void calcTemplateInfo();
+  inline const string & getTemplate() const { return REA_template;};
+  inline const string & getClonevecName() const { return REA_sc_clonevec_name.getEntry(REA_clonevec_name);};
+  inline const string & getSeqvecName() const { return REA_sc_seqvec_name.getEntry(REA_seqvec_name);};
+  inline const string & getStrain() const { return REA_sc_strain.getEntry(REA_strain);};
+  inline const string & getBasecaller() const { return REA_sc_basecaller.getEntry(REA_basecaller);};
+  inline const string & getAsped() const { return REA_sc_asped.getEntry(REA_asped);};
+  inline const string & getDye() const { return REA_sc_dye.getEntry(REA_dye);};
+  inline const string & getProcessStatus() const { return REA_sc_processstatus.getEntry(REA_processstatus);};
+  inline const string & getMachineType() const { return REA_sc_machine_type.getEntry(REA_machine_type);};
+  inline const string & getPrimer() const { return REA_sc_primer.getEntry(REA_primer);};
+
+  void  setReadNamingScheme(uint8 scheme);
+  inline uint8 getReadNamingScheme() const {return REA_readnaming_scheme;};
+  string getInternalTemplateName();
   inline int32 getTemplateID() const {return REA_templateid;};
-
-  //inline char getTemplateEnd() const {return REA_template_end;}
-  //void setTemplateEnd(char e);
-
-  inline uint8 getTemplateSegment() const {return REA_template_segment;}
-  inline void setTemplateSegment(uint8 s) {REA_template_segment=s;}
-
-  inline int8 getTemplateBuildDirection() const {return REA_rgid.getBuildDirection();}
+  inline int8 getStrainID() const {return REA_strainid;};
+  inline char getTemplateEnd() const {return REA_template_end;}
+  void setTemplateEnd(char e);
+  inline int8 getTemplateBuildDirection() const {if(REA_templatebuilddirection) return 1; return -1;}
+  inline void setTemplateBuildDirection(int8 dir) {
+    REA_templatebuilddirection=false;
+    if(dir>0) REA_templatebuilddirection=true;
+  }
 
   inline int32 getLQClipoff() const { return REA_ql;}
   inline int32 getRQClipoff() const { return REA_qr;}
@@ -857,20 +848,18 @@ public:
   inline int32 getLMClipoff() const { return REA_ml;}
   inline int32 getRMClipoff() const { return REA_mr;}
 
-  inline int32 getLeftClipoff()  const { return std::max(REA_ql, REA_sl);}
-  inline int32 getRightClipoff() const { return std::min(REA_qr, REA_sr);}
+  //inline int32 getLeftClipoff()  const { return REA_leftclip;}
+  //inline int32 getRightClipoff() const { return REA_rightclip;}
+  //inline uint32 getLenClippedSeq() const {return REA_len_clipped;};
+
+  inline int32 getLeftClipoff()  const { return max(REA_ql, REA_sl);}
+  inline int32 getRightClipoff() const { return min(REA_qr, REA_sr);}
   inline uint32 getLenClippedSeq() const {
-    if(unlikely(getLeftClipoff()>getRightClipoff())) return 0;
+    if(getLeftClipoff()>getRightClipoff()) return 0;
     return getRightClipoff()-getLeftClipoff();
   };
 
-  inline uint32 getLenSeq() const {
-    if(REA_ps_dirty){
-      return static_cast<uint32>(REA_padded_complementsequence.size());
-    }else{
-      return static_cast<uint32>(REA_padded_sequence.size());
-    }
-  }
+  uint32 getLenSeq() const;
 
 
   int32 getLeftExtend() const;
@@ -894,43 +883,51 @@ public:
   int32 getLowerNonGapPosOfReadPos(uint32 position) const;
   int32 getUpperNonGapPosOfReadPos(uint32 position) const;
 
-  uint32 getLowerBoundPosOfBaseRun(uint32 pos,
-				   char base,
+  uint32 getLowerBoundPosOfBaseRun(uint32 pos, 
+				   char base, 
 				   const bool alsotakegap) const;
-  uint32 getUpperBoundPosOfBaseRun(uint32 pos,
-				   char base,
+  uint32 getUpperBoundPosOfBaseRun(uint32 pos, 
+				   char base, 
 				   const bool alsotakegap) const;
   uint32 getLenOfGapRun(uint32 pos) const;
 
   bool hasSCFData(bool loadfailnoerror=false);
-  //inline bool hasValidNameScheme() const {return REA_name_scheme_valid;}
+  inline bool hasValidNameScheme() const {return REA_name_scheme_valid;}
   inline bool hasQuality() const {return REA_has_quality;}
   inline void setQualityFlag(bool v) {REA_has_quality=v;};
   inline void setValidData(bool v) {REA_has_valid_data=v;}
   inline bool hasValidData() const {return REA_has_valid_data;}
   inline bool isUsedInAssembly() const {return REA_used_in_assembly;}
   inline void setUsedInAssembly(bool used) {REA_used_in_assembly=used;}
-  inline bool isBackbone() const {return REA_rgid.isBackbone();}
-  inline bool isRail() const {return REA_rgid.isRail();}
-  inline bool isCoverageEquivalentRead() const {return REA_rgid.isCoverageEquivalentRead();}
+  inline bool isBackbone() const {return REA_isbackbone;}
+  inline void setBackbone(bool bb) {REA_isbackbone=bb;}
+  inline bool isRail() const {return REA_israil;}
+  inline void setRail(bool rail) {REA_israil=rail;}
+  inline bool isCoverageEquivalentRead() const {return REA_iscoverageequivalentread;}
+  inline void setCoverageEquivalentRead(bool v) {REA_iscoverageequivalentread=v;}
 
   static void trashReadNameContainer() {REA_sc_readname.trash();}
-
-  inline uint8 getSequencingType() const {return REA_rgid.getSequencingType();}
-  inline bool isSequencingType(uint8 t) const {return REA_rgid.getSequencingType()==t;}
+  static inline uint8 getNumSequencingTypes() {return SEQTYPE_END;}
+  static const string & getNameOfSequencingType(uint32 st);
+  static const string & getShortNameOfSequencingType(uint32 st);
+  static uint8 stringToSeqType(const string & value);
+  void setSequencingType(uint8 t);
+  inline void setSequencingType(const string & t) {setSequencingType(stringToSeqType(t));};
+  inline uint8 getSequencingType() const {return REA_seqtype;}
+  inline bool isSequencingType(uint8 t) const {return REA_seqtype==t;}
 
 
-  base_quality_t queryAverageQualInSequence(int32 posl, int32 posr, bool skipNs, bool skipStars) const;
-  base_quality_t queryAverageQualInComplementSequence(int32 posl, int32 posr, bool skipNs, bool skipStars) const;
-  base_quality_t queryAverageQualInClippedSequence(int32 posl, int32 posr, bool skipNs, bool skipStars) const;
-  base_quality_t queryAverageQualInClippedComplementSequence(int32 posl, int32 posr, bool skipNs, bool skipStars) const;
+  base_quality_t queryAverageQualInSequence(int32 posl, int32 posr, bool skipNs, bool skipStars);
+  base_quality_t queryAverageQualInComplementSequence(int32 posl, int32 posr, bool skipNs, bool skipStars);
+  base_quality_t queryAverageQualInClippedSequence(int32 posl, int32 posr, bool skipNs, bool skipStars);
+  base_quality_t queryAverageQualInClippedComplementSequence(int32 posl, int32 posr, bool skipNs, bool skipStars);
 
-  // inlining these makes things slower
   int32 calcComplPos(int32 pos) const;
   int32 calcClippedPos2RawPos(int32 pos) const;
+
   int32 calcRawPos2ClippedPos(int32 pos) const;
+
   int32 calcClippedComplPos2RawPos(int32 pos) const;
-  //
 
   inline static double qualityToErrorRate(base_quality_t qual) {
     if(qual>100) qual=100;
@@ -949,24 +946,13 @@ public:
 
   void exchangeNsWithGaps();
   void blindSeqData(char newbase);
-  void upDownCase(base_quality_t threshold);
-  void upDownCaseClips();
-
-  int32 getDigiNormMultiplier() const;
-
-  static void upgradeOldTagToMultitagWithGFF3(const multitag_t & oldtag, multitag_t & mt);
-  void rleRead();
-  void deRLERead();
-
-  std::string renameReadPrefix(const std::string & actname);
-  static bool checkStringForSRANamingScheme(const std::string & rname);
 };
 
 
 // for Read
 inline void emuoc_statsOnType(const Read & c, size_t & total_size, size_t & total_freecap, size_t & total_lostba, size_t & num_size, size_t & bytes_size, size_t & overhead, size_t & lostbyalign, bool & iscontainer)
 {
-  MMEBUG("emuoc_statsOnType(Read): " << typeid(c).name() << std::endl);
+  CEBUG("emuoc_statsOnType(Read): " << typeid(c).name() << endl);
 
   (void) c;
   (void) total_freecap;
@@ -984,7 +970,7 @@ inline void emuoc_statsOnType(const Read & c, size_t & total_size, size_t & tota
   if(bytes_size%sizeof(void *)){
     lostbyalign=sizeof(void *)-bytes_size%sizeof(void *);
   }
-  MMEBUG("Lost by align: " <<lostbyalign << std::endl);
+  CEBUG("Lost by align: " <<lostbyalign << endl);
 
   return;
 }
diff --git a/src/mira/readgrouplib.C b/src/mira/readgrouplib.C
deleted file mode 100644
index d40bd1f..0000000
--- a/src/mira/readgrouplib.C
+++ /dev/null
@@ -1,824 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 2003 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-
-#include "readgrouplib.H"
-
-#include <unordered_map>
-
-#include <boost/algorithm/string.hpp>
-
-
-
-using namespace std;
-
-#define CEBUG(bla)
-
-bool ReadGroupLib::staticInitialiser()
-{
-  // not really nice to do the following, but what the heck
-  // --
-  vector<string> & lcnames=const_cast<vector<string>&>(RG_lcnamesofseqtypes);
-  lcnames=RG_namesofseqtypes;
-  for(size_t i=0; i<lcnames.size(); ++i){
-    boost::to_lower(lcnames[i]);
-  }
-  //--
-
-  RG_static_infolib.reserve(255);
-
-  zeroVars();
-
-  return true;
-}
-
-
-
-// Plain vanilla constructor
-ReadGroupLib::ReadGroupLib()
-{
-  FUNCSTART("ReadGroupLib::ReadGroupLib()");
-
-  zeroVars();
-
-  FUNCEND();
-}
-
-void ReadGroupLib::zeroVars()
-{
-  FUNCSTART("void ReadGroupLib::zeroVars()");
-
-  RG_strainids_clean=false;
-  RG_numstrains=-1;
-
-  RG_static_infolib.clear();
-  newReadGroup();
-  completeDefaultsForReadGroups();
-
-  FUNCEND();
-}
-
-void ReadGroupLib::init()
-{
-  FUNCSTART("void ReadGroupLib::init()");
-
-  FUNCEND();
-}
-
-
-
-ReadGroupLib::~ReadGroupLib()
-{
-  FUNCSTART("ReadGroupLib::~ReadGroupLib()");
-
-  discard();
-
-  FUNCEND();
-}
-
-
-void ReadGroupLib::discard()
-{
-  FUNCSTART("ReadGroupLib::discard()");
-
-  zeroVars();
-
-  FUNCEND();
-}
-
-
-//// Copy constructor
-////  no discard needed as this object will be freshly created when
-////  called through this constructor
-//ReadGroupLib::ReadGroupLib(ReadGroupLib const &other)
-//{
-//  FUNCSTART("ReadGroupLib::ReadGroupLib(ReadGroupLib const &other)");
-//
-//  ??_valid=0;
-//
-//  *this=other;                               // call the copy operator
-//
-//  FUNCEND();
-//}
-//
-//// Copy operator, needed by copy-constructor
-//ReadGroupLib const & ReadGroupLib::operator=(ReadGroupLib const & other)
-//{
-//  FUNCSTART("ReadGroupLib const & ReadGroupLib::operator=(ReadGroupLib const & other)");
-//  ERROR("Not implemented yet.");
-//  FUNCEND();
-//  return *this;
-//}
-
-//ostream & operator<<(ostream &ostr, ReadGroupLib const &???)
-//{
-//  FUNCSTART("friend ostream & ReadGroupLib::operator<<(ostream &ostr, const  &???)");
-//  ERROR("Not implemented yet.");
-//
-//  FUNCEND();
-//  return ostr;
-//}
-
-
-
-ReadGroupLib::ReadGroupID ReadGroupLib::newReadGroup()
-{
-  FUNCSTART("ReadGroupLib::ReadGroupID ReadGroupLib::newReadGroup()");
-  BUGIFTHROW(RG_static_infolib.size()==255,"Maximum number of readgroups reached? What kind of data do you have there?!");
-  RG_static_infolib.resize(RG_static_infolib.size()+1);
-  RG_strainids_clean=false;
-  return ReadGroupID(RG_static_infolib.size()-1);
-}
-
-
-
-void ReadGroupLib::checkLibValidity(rgid_t libid)
-{
-  FUNCSTART("static void checkLibValidity(rgid_t libid)");
-  if(libid==0) abort();
-  BUGIFTHROW(RG_static_infolib[libid].seqtype>=SEQTYPE_END, "Readgroup " << static_cast<uint16>(libid) << " (named: '" << RG_static_infolib[libid].groupname << "') has no valid sequencing technology set.");
-
-  BUGIFTHROW(RG_static_infolib[libid].defaultqual>=100, "Readgroup " << static_cast<uint16>(libid) << " (named: '" << RG_static_infolib[libid].groupname << "') has a default quality of " << static_cast<uint16>(RG_static_infolib[libid].defaultqual) << " which is >= 100 ... invalid.");
-}
-
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-void ReadGroupLib::fillInSensibleDefaults(rgid_t libid)
-{
-  FUNCSTART("void ReadGroupLib::fillInSensibleDefaults(rgid_t libid)");
-
-  if(libid==0) {
-    // no "sensible" defaults for libid 0, try to set values which will let MIRA puke
-    RG_static_infolib[0].seqtype=SEQTYPE_END;
-    RG_static_infolib[0].namingscheme=SCHEME_UNKNOWN;
-    RG_static_infolib[0].defaultqual=212;
-    RG_static_infolib[0].groupname="UnassigneReads";
-    RG_static_infolib[0].machine_type="ShouldNeverBeSeen";
-    return;
-  }
-
-  // check for sequencing type
-  if(RG_static_infolib[libid].seqtype==SEQTYPE_END){
-    if(RG_static_infolib[libid].is_backbone) {
-      // backbones do not need technolgies (but user can choose so)
-      // by default, they're TEXT
-      RG_static_infolib[libid].seqtype=SEQTYPE_TEXT;
-    }else{
-      MIRANOTIFY(Notify::FATAL,"Oooops, the readgroup '" << RG_static_infolib[libid].groupname << "' has no sequencing technology defined, nor is it defined as reference (which would excuse the missing technology definition).");
-    }
-  }
-  // check for strain name
-  if(RG_static_infolib[libid].strainname.empty()){
-    if(RG_static_infolib[libid].is_backbone) {
-      RG_static_infolib[libid].strainname="ReferenceStrain";
-      if(RG_static_infolib[libid].defaultqual>100) RG_static_infolib[libid].defaultqual=30;
-    }else{
-      RG_static_infolib[libid].strainname="StrainX";
-    }
-  }
-  // check for default qual
-  RG_static_infolib[libid].has_userdefaultqual=true;
-  if(RG_static_infolib[libid].defaultqual>=100){
-    RG_static_infolib[libid].has_userdefaultqual=false;
-    base_quality_t def=0;
-    if(RG_static_infolib[libid].is_backbone) {
-      def=30;
-    }else{
-#if CPP_READ_SEQTYPE_END != 8
-#error "This code is made for 8 sequencing types, adapt!"
-#endif
-      switch(RG_static_infolib[libid].seqtype){
-      case ReadGroupLib::SEQTYPE_TEXT : {
-	def=10;
-	break;
-      }
-      case ReadGroupLib::SEQTYPE_SANGER :
-      case ReadGroupLib::SEQTYPE_454GS20 :
-      case ReadGroupLib::SEQTYPE_IONTORRENT :
-      case ReadGroupLib::SEQTYPE_PACBIOHQ : {
-	def=20;
-	break;
-      }
-      case ReadGroupLib::SEQTYPE_SOLEXA : {
-	def=30;
-	break;
-      }
-      default : {
-	def=5;
-      }
-      }
-    }
-    RG_static_infolib[libid].defaultqual=def;
-  }
-
-#if CPP_READ_SEQTYPE_END != 8
-#error "This code is made for 8 sequencing types, adapt!"
-#endif
-  // read naming scheme
-  if(RG_static_infolib[libid].namingscheme==SCHEME_UNKNOWN){
-    if(RG_static_infolib[libid].is_backbone) {
-      RG_static_infolib[libid].namingscheme=SCHEME_NONE;
-    }else{
-      switch(RG_static_infolib[libid].seqtype){
-      case ReadGroupLib::SEQTYPE_TEXT : {
-	RG_static_infolib[libid].namingscheme=SCHEME_NONE;
-	break;
-      }
-      case ReadGroupLib::SEQTYPE_SANGER : {
-	RG_static_infolib[libid].namingscheme=SCHEME_SANGER;
-	break;
-      }
-      case ReadGroupLib::SEQTYPE_454GS20 : {
-	RG_static_infolib[libid].namingscheme=SCHEME_SOLEXA;
-	break;
-      }
-      case ReadGroupLib::SEQTYPE_IONTORRENT : {
-	RG_static_infolib[libid].namingscheme=SCHEME_SOLEXA;
-	break;
-      }
-      case ReadGroupLib::SEQTYPE_PACBIOHQ :  {
-	RG_static_infolib[libid].namingscheme=SCHEME_SOLEXA;
-	break;
-      }
-      case ReadGroupLib::SEQTYPE_SOLEXA : {
-	RG_static_infolib[libid].namingscheme=SCHEME_SOLEXA;
-	break;
-      }
-      default : {
-	MIRANOTIFY(Notify::FATAL,"Unknown seqtype " << static_cast<uint32>(RG_static_infolib[libid].seqtype));
-      }
-      }
-    }
-  }
-
-  // templateinfo
-  if(RG_static_infolib[libid].insize_from>=0
-     || RG_static_infolib[libid].insize_to>=0
-     || RG_static_infolib[libid].segmentplacementcode!=SPLACE_UNKNOWN){
-    RG_static_infolib[libid].has_templateinfo=true;
-  }
-
-  FUNCEND();
-}
-
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-void ReadGroupLib::completeDefaultsForReadGroups()
-{
-  FUNCSTART("void ReadGroupLib::fillInDefaultParams()");
-  for(size_t rglibid=0; rglibid<RG_static_infolib.size(); ++rglibid){
-    fillInSensibleDefaults(rglibid);
-  }
-}
-
-
-
-
-ReadGroupLib::rgid_t ReadGroupLib::searchExactRGMatch(string & rgname, uint8 seqtype, int32 isfrom, int32 isto, int8 tpcode, string & strainname, bool isbb, bool israil, bool iscer, string & seqvecname, string & machine_type, string & basecaller)
-//ReadGroupLib::rgid_t ReadGroupLib::searchExactRGMatch(string & rgname, uint8 seqtype, int32 isfrom, int32 isto, string tpcode, string & strainname, bool isbb, bool israil, bool iscer, string & seqvecname, string & machine_type, string & basecaller)
-{
-  for(rgid_t libid=1; libid < RG_static_infolib.size(); ++libid){
-    /*
-    cout << RG_static_infolib.size() << '\t' << static_cast<int64>(libid) << endl;
-    cout << "RG_static_infolib[libid].seqtype                 " << (RG_static_infolib[libid].seqtype == seqtype);
-    cout << "\nRG_static_infolib[libid].groupname	      " << (RG_static_infolib[libid].groupname == rgname);
-    cout << "\nRG_static_infolib[libid].strainname	      " << (RG_static_infolib[libid].strainname == strainname);
-    cout << "\nRG_static_infolib[libid].insize_from	      " << (RG_static_infolib[libid].insize_from == isfrom);
-    cout << "\nRG_static_infolib[libid].insize_to	      " << (RG_static_infolib[libid].insize_to == isto);
-    cout << "\nRG_static_infolib[libid].segmentplacementcode  " << (RG_static_infolib[libid].segmentplacementcode == tpcode);
-    cout << "\nRG_static_infolib[libid].is_backbone	      " << (RG_static_infolib[libid].is_backbone == isbb);
-    cout << "\nRG_static_infolib[libid].is_rail		      " << (RG_static_infolib[libid].is_rail == israil);
-    cout << "\nRG_static_infolib[libid].is_coverageequivalent " << (RG_static_infolib[libid].is_coverageequivalent == iscer);
-    cout << "\nRG_static_infolib[libid].seqvecname	      " << (RG_static_infolib[libid].seqvecname == seqvecname);
-    cout << "\nRG_static_infolib[libid].machine_type	      " << (RG_static_infolib[libid].machine_type == machine_type);
-    cout << "\nRG_static_infolib[libid].basecaller            " << (RG_static_infolib[libid].basecaller == basecaller);
-    cout << '\n';
-    */
-
-    if(RG_static_infolib[libid].seqtype == seqtype
-       && RG_static_infolib[libid].groupname == rgname
-       && RG_static_infolib[libid].strainname == strainname
-       && RG_static_infolib[libid].insize_from == isfrom
-       && RG_static_infolib[libid].insize_to == isto
-       && RG_static_infolib[libid].segmentplacementcode == tpcode
-       && RG_static_infolib[libid].is_backbone == isbb
-       && RG_static_infolib[libid].is_rail == israil
-       && RG_static_infolib[libid].is_coverageequivalent == iscer
-       && RG_static_infolib[libid].seqvecname == seqvecname
-       && RG_static_infolib[libid].machine_type == machine_type
-       && RG_static_infolib[libid].basecaller == basecaller
-      ){
-      return libid;
-    }
-  }
-  return 0;
-}
-
-
-
-/*************************************************************************
- *
- *
- *
- *
- *
- *************************************************************************/
-
-const string & ReadGroupLib::getNameOfSequencingType(uint32 st)
-{
-  FUNCSTART("const string & ReadGroupLib::getNameOfSequencingType(uint32 st)");
-  BUGIFTHROW(st>=RG_namesofseqtypes.size(),"Asking for name of unknown sequencing type " << st << " ?");
-  FUNCEND();
-  return RG_namesofseqtypes[st];
-}
-
-const string & ReadGroupLib::getShortNameOfSequencingType(uint32 st)
-{
-  FUNCSTART("const string & ReadGroupLib::getShortNameOfSequencingType(uint32 st)");
-  BUGIFTHROW(st>=RG_namesofseqtypes.size(),"Asking for name of unknown sequencing type " << st << " ?");
-  FUNCEND();
-  return RG_shortnamesofseqtypes[st];
-}
-
-const string & ReadGroupLib::getSAMNameOfSequencingType(uint32 st)
-{
-  FUNCSTART("const string & ReadGroupLib::getSAMNameOfSequencingType(uint32 st)");
-  BUGIFTHROW(st>=RG_namesofseqtypes.size(),"Asking for name of unknown sequencing type " << st << " ?");
-  FUNCEND();
-  return RG_samnamesofseqtypes[st];
-}
-
-
-/*************************************************************************
- *
- * Returns code for sequencing type given in value string
- * or ReadGroupLib::SEQTYPE_END if string was not recognised
- *
- *************************************************************************/
-
-uint8 ReadGroupLib::stringToSeqType(const string & value)
-{
-  if(!value.empty()){
-    for(uint8 i=0; i<RG_namesofseqtypes.size(); i++){
-      if(value==RG_namesofseqtypes[i]) return i;
-    }
-
-    // *sigh* retain compatibility with mira < 3rc3
-    if(value=="454GS") return SEQTYPE_454GS20;
-    if(value=="454gs") return SEQTYPE_454GS20;
-
-    string lcv(value);
-    boost::to_lower(lcv);
-    for(uint8 i=0; i<RG_lcnamesofseqtypes.size(); i++){
-      if(value==RG_lcnamesofseqtypes[i]) return i;
-    }
-  }
-
-  return getNumSequencingTypes();
-}
-
-
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-
-//#define CEBUG(bla)   {cout << bla; cout.flush(); }
-void ReadGroupLib::makeStrainIDs()
-{
-  FUNCSTART("void ReadGroupLib::makeStrainIDs()");
-
-  //vector<int32> tidcounter;
-  //tidcounter.resize(size(), 0);
-
-  CEBUG("ReadGroupLib::makeStrainIDs dd\n"; debugDumpReadGroupInfo(cout));
-
-  typedef unordered_map<std::string, int8> strintmap;
-  strintmap sidmap;
-  strintmap::iterator sidI;
-
-  // go through readpool in two rounds, first just looking at Solexa reads,
-  //  then at all remaining reads
-  // reason: let Solexa have the low strain IDs 0-7, so that they can
-  //  be mapped with merge option in the contig
-
-  RG_numstrains=0;
-  for(uint32 round=0; round < 2;++round){
-    for(uint32 rgid=1; rgid<RG_static_infolib.size();++rgid){
-      if(round==0 && RG_static_infolib[rgid].seqtype!=ReadGroupLib::SEQTYPE_SOLEXA) continue;
-      if(round>0 && RG_static_infolib[rgid].seqtype==ReadGroupLib::SEQTYPE_SOLEXA) continue;
-      sidI=sidmap.find(RG_static_infolib[rgid].strainname);
-      if(sidI!=sidmap.end()){
-	RG_static_infolib[rgid].strainid=sidI->second;
-      }else{
-	if(RG_numstrains==127){
-	  MIRANOTIFY(Notify::FATAL, "More than 127 strains encountered? Sorry, not possible. Strain " << RG_static_infolib[rgid].strainname << " in readgroup " << RG_static_infolib[rgid].groupname << "\n");
-	}
-	RG_static_infolib[rgid].strainid=RG_numstrains;
-	sidmap[RG_static_infolib[rgid].strainname]=RG_numstrains;
-	++RG_numstrains;
-      }
-    }
-  }
-
-  RG_strainids_clean=true;
-
-  CEBUG("Recalc of strain ids yielded " << static_cast<size_t>(RG_numstrains) << " strains." << endl);
-
-  return;
-}
-//#define CEBUG(bla)
-
-
-bool ReadGroupLib::getStrainIDOfStrain(const string & strainname, int32 & sid)
-{
-  for(sid=1; sid<static_cast<int32>(RG_static_infolib.size()); ++sid){
-    if(RG_static_infolib[sid].strainname==strainname) return true;
-  }
-  sid=-1;
-  return false;
-}
-
-const string & ReadGroupLib::getStrainOfStrainID(int32 sid)
-{
-  FUNCSTART("const string & ReadGroupLib::getStrainOfStrainID(int32 & sid)");
-  for(size_t rgid=1; rgid<RG_static_infolib.size(); ++rgid){
-    if(RG_static_infolib[rgid].strainid==sid) return RG_static_infolib[rgid].strainname;
-  }
-
-  MIRANOTIFY(Notify::INTERNAL, "Did not find strain id " << sid);
-  FUNCEND();
-  return RG_emptystring;
-}
-
-
-
-
-
-void ReadGroupLib::setSequencingType(rgid_t libid, uint8 st)
-{
-  FUNCSTART("void ReadGroupLib::setSequencingType(rgid_t libid, uint8 st)");
-  checkLibExistence(libid);
-  RG_static_infolib[libid].seqtype=st;
-
-  if(RG_static_infolib[libid].namingscheme==SCHEME_UNKNOWN){
-    if(st == ReadGroupLib::SEQTYPE_SANGER){
-      setReadNamingScheme(libid,SCHEME_SANGER);
-    }else if( st == ReadGroupLib::SEQTYPE_IONTORRENT
-	      || st == ReadGroupLib::SEQTYPE_454GS20){
-      setReadNamingScheme(libid,SCHEME_SOLEXA);
-    }else if(st == ReadGroupLib::SEQTYPE_PACBIOHQ
-	     || st == ReadGroupLib::SEQTYPE_PACBIOLQ) {
-      setReadNamingScheme(libid,SCHEME_NONE);
-    }else if (st==ReadGroupLib::SEQTYPE_SOLEXA){
-      setReadNamingScheme(libid,SCHEME_SOLEXA);
-    }else if (st==ReadGroupLib::SEQTYPE_TEXT){
-      setReadNamingScheme(libid,SCHEME_NONE);
-    }else if(st>= ReadGroupLib::SEQTYPE_END)
-      MIRANOTIFY(Notify::INTERNAL, "Sequencing technology " << static_cast<int16>(st) << " is unknown to MIRA");
-  }else{
-    // Scheme already known ... nothing to do?
-  }
-}
-
-
-
-void ReadGroupLib::saveAllReadGroupsAsMAF(ostream & ostr)
-{
-  for(uint32 rgi=1; rgi<RG_static_infolib.size(); ++rgi){
-    saveReadGroupAsMAF(rgi,ostr);
-  }
-}
-
-
-void ReadGroupLib::saveReadGroupAsMAF(uint32 rgi, ostream & ostr)
-{
-  FUNCSTART("void ReadGroupLib::saveReadGroupAsMAF(uint32 rgi, ostream & ostr)");
-  BUGIFTHROW(rgi>=RG_static_infolib.size(),"rgi (" << rgi << ") >= RG_static_infolib.size() " << RG_static_infolib.size() << ") ???");
-  if(!RG_static_infolib[rgi].wassaved){
-    RG_static_infolib[rgi].wassaved=true;
-    dumpReadGroupAsMAF(rgi,ostr);
-  }
-
-}
-
-
-void ReadGroupLib::dumpAllReadGroupsAsMAF(ostream & ostr)
-{
-  for(uint32 rgi=1; rgi<RG_static_infolib.size(); ++rgi){
-    dumpReadGroupAsMAF(rgi,ostr);
-  }
-}
-
-
-
-void ReadGroupLib::dumpReadGroupAsMAF(uint32 rgi, ostream & ostr)
-{
-  FUNCSTART("void ReadGroupLib::dumpReadGroupAsMAF(uint32 rgi, ostream & ostr)");
-  BUGIFTHROW(rgi>=RG_static_infolib.size(),"rgi (" << rgi << ") >= RG_static_infolib.size() " << RG_static_infolib.size() << ") ???");
-
-  ostr << "@ReadGroup\n";
-  if(RG_static_infolib[rgi].groupname.size()){
-    ostr << "@RG\tname\t" << RG_static_infolib[rgi].groupname << '\n';
-  }
-  ostr << "@RG\tID\t" << rgi << '\n';
-  ostr << "@RG\ttechnology\t" << getNameOfSequencingType(RG_static_infolib[rgi].seqtype) << '\n';
-  if(RG_static_infolib[rgi].strainname.size()){
-    ostr << "@RG\tstrainname\t" << RG_static_infolib[rgi].strainname << '\n';
-  }
-  if(RG_static_infolib[rgi].insize_from>=0 || RG_static_infolib[rgi].insize_to>=0 ){
-    ostr << "@RG\ttemplatesize\t" << RG_static_infolib[rgi].insize_from
-	 << '\t' << RG_static_infolib[rgi].insize_to << '\n';
-  }
-  if(RG_static_infolib[rgi].segmentplacementcode != SPLACE_UNKNOWN){
-    ostr << "@RG\tsegmentplacement\t" << getNameOfSegmentplacement(RG_static_infolib[rgi].segmentplacementcode) << '\n';
-  }
-  ostr << "@RG\tsegmentnaming\t" << getNameOfNamingScheme(RG_static_infolib[rgi].namingscheme) << '\n';
-
-  if(!RG_static_infolib[rgi].machine_type.empty()){
-    ostr << "@RG\tmachinetype\t" << RG_static_infolib[rgi].machine_type << '\n';
-  }
-  if(!RG_static_infolib[rgi].basecaller.empty()){
-    ostr << "@RG\tbasecaller\t" << RG_static_infolib[rgi].basecaller << '\n';
-  }
-  if(!RG_static_infolib[rgi].dye.empty()){
-    ostr << "@RG\tdye\t" << RG_static_infolib[rgi].dye << '\n';
-  }
-  if(!RG_static_infolib[rgi].primer.empty()){
-    ostr << "@RG\tprimer\t" << RG_static_infolib[rgi].primer << '\n';
-  }
-  if(!RG_static_infolib[rgi].clonevecname.empty()){
-    ostr << "@RG\tclonevecname\t" << RG_static_infolib[rgi].clonevecname << '\n';
-  }
-  if(!RG_static_infolib[rgi].seqvecname.empty()){
-    ostr << "@RG\tseqvecname\t" << RG_static_infolib[rgi].seqvecname << '\n';
-  }
-  if(!RG_static_infolib[rgi].adaptorleft.empty()){
-    ostr << "@RG\tadaptorleft\t" << RG_static_infolib[rgi].adaptorleft << '\n';
-  }
-  if(!RG_static_infolib[rgi].adaptorright.empty()){
-    ostr << "@RG\tadaptorright\t" << RG_static_infolib[rgi].adaptorright << '\n';
-  }
-  if(!RG_static_infolib[rgi].adaptorsplit.empty()){
-    ostr << "@RG\tadaptorsplit\t" << RG_static_infolib[rgi].adaptorsplit << '\n';
-  }
-  if(!RG_static_infolib[rgi].datadir.empty()){
-    ostr << "@RG\tdatadir\t" << RG_static_infolib[rgi].datadir << '\n';
-  }
-  if(!RG_static_infolib[rgi].datafile.empty()){
-    ostr << "@RG\tdatafile\t" << RG_static_infolib[rgi].datafile << '\n';
-  }
-
-  if(RG_static_infolib[rgi].is_backbone){
-    ostr << "@RG\tisbackbone\n";
-  }
-  if(RG_static_infolib[rgi].is_rail){
-    ostr << "@RG\tisrail\n";
-  }
-  if(RG_static_infolib[rgi].is_coverageequivalent){
-    ostr << "@RG\tiscoverageequivalent\n";
-  }
-  ostr << "@EndReadGroup\n";
-}
-
-void ReadGroupLib::dumpReadGroupAsSAM(uint32 rgi, ostream & ostr)
-{
-  FUNCSTART("void ReadGroupLib::dumpReadGroupAsSAM(uint32 rgi, ostream & ostr)");
-  BUGIFTHROW(rgi>=RG_static_infolib.size(),"rgi (" << rgi << ") >= RG_static_infolib.size() " << RG_static_infolib.size() << ") ???");
-
-  ostr << "@RG\tID:" << rgi
-       << "\tPL:" << getSAMNameOfSequencingType(RG_static_infolib[rgi].seqtype);
-  if(RG_static_infolib[rgi].groupname.size()){
-    ostr << "\tLB:" << RG_static_infolib[rgi].groupname;
-  }
-  if(RG_static_infolib[rgi].strainname.size()){
-    ostr << "\tSM:" << RG_static_infolib[rgi].strainname;
-  }
-  if(RG_static_infolib[rgi].insize_from>=0 || RG_static_infolib[rgi].insize_to>=0 ){
-    ostr << "\tPI:" << RG_static_infolib[rgi].insize_to-RG_static_infolib[rgi].insize_from;
-  }
-  ostr << endl;
-}
-
-
-void ReadGroupLib::ReadGroupID::setSequencingType(string t)
-{
-  boost::to_lower(t);
-  ReadGroupLib::setSequencingType(rgid_id,ReadGroupLib::stringToSeqType(t));
-}
-
-void ReadGroupLib::debugDumpReadGroupInfo(ostream & ostr)
-{
-  for(uint32 rgi=0; rgi<RG_static_infolib.size(); ++rgi){
-    ostr << "\n\nRGI: " << rgi << "\t" << ReadGroupLib::getReadGroupID(rgi) << endl;
-  }
-}
-
-
-/*************************************************************************
- *
- *  Accepts: FR / RF / ...
- *   or graphical representation like:
- *          ---------> <----------
- *          ---------> ---------->
- *          1---------> 2---------->
- *          2---------> 1---------->
- *  returns:
- *    true / false to signal whether code recognise (empty string is also OK)
- *    placementcode
- *
- *************************************************************************/
-
-
-bool ReadGroupLib::parseSegmentPlacement(const string & sps, int8 & placementcode)
-{
-  FUNCSTART("bool ReadGroupLib::parseSegmentPlacement(const string & sps, int8 & placementcode)");
-
-  placementcode=SPLACE_UNKNOWN;
-
-  if(!sps.empty()){
-    string shortsps;
-    for(auto cs : sps){
-      if(!isspace(cs)){
-	if(cs=='>'){
-	  shortsps+="FORWARD";
-	}else if(cs=='<'){
-	  shortsps+="REVERSE";
-	}else if(cs=='='){
-	  shortsps+="SAMEDIR";
-	}else if(cs=='?'){
-	  shortsps+="UNKNOWN";
-	}else if(cs=='-'){
-	  // do nothing, munch the character to allow for "--->" etc.
-	}else{
-	  shortsps+=toupper(cs);
-	}
-      }
-    }
-    if(shortsps=="SF"
-       || shortsps=="SAMEDIRFORWARD"
-       || shortsps=="FORWARDFORWARD"
-       || shortsps=="1FORWARD2FORWARD"
-       || shortsps=="SAMEDIRECTIONFORWARD"
-       || shortsps=="LEFTIES"
-       || shortsps=="LEFTIE"
-       || shortsps=="LEFTY") {
-      placementcode=SPLACE_SF;
-    }else if(shortsps=="SB"
-	     || shortsps=="2FORWARD1FORWARD"
-	     || shortsps=="SAMEDIRREVERSE"
-	     || shortsps=="SAMEDIRECTIONREVERSE"
-	     || shortsps=="SAMEDIRBACKWARD"
-	     || shortsps=="SAMEDIRECTIONBACKWARD"
-	     || shortsps=="RIGHTIES"
-	     || shortsps=="RIGHTIE"
-	     || shortsps=="RIGHTY") {
-      placementcode=SPLACE_SB;
-    }else if(shortsps=="SAMEDIR"
-	     || shortsps=="SU"
-	     || shortsps=="SAMEDIRECTION"
-	     || shortsps=="SAMEDIRUNKNOWN"
-	     || shortsps=="SAMEDIRECTIONUNKNOWN") {
-      placementcode=SPLACE_SU;
-    }else if(shortsps=="FORWARDREVERSE"
-	     || shortsps=="FR"
-	     || shortsps=="INNIES"
-	     || shortsps=="INNIE"
-	     || shortsps=="INNY") {
-      placementcode=SPLACE_FR;
-    }else if(shortsps=="REVERSEFORWARD"
-	     || shortsps=="RF"
-	     || shortsps=="OUTIES"
-	     || shortsps=="OUTIE"
-	     || shortsps=="OUTY") {
-      placementcode=SPLACE_RF;
-    }else if(shortsps=="UNKNOWN"){
-      // intentionally do nothing, SPLACE_UNKNOWN is default anyway
-    }else{
-      return false;
-    }
-  }
-  return true;
-}
-
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-bool ReadGroupLib::parseSegmentNaming(const string & sns, uint8 & namingscheme)
-{
-  FUNCSTART("bool ReadGroupLib::parseSegmentNaming(const string & sns, uint8 & namingscheme)");
-
-  namingscheme=SCHEME_UNKNOWN;
-
-  string tmpsns(sns);
-  boost::to_lower(tmpsns);
-
-  if(tmpsns=="solexa"){
-    namingscheme=SCHEME_SOLEXA;
-  }else if(tmpsns=="sanger"){
-    namingscheme=SCHEME_SANGER;
-  }else if(tmpsns=="stlouis"){
-    namingscheme=SCHEME_STLOUIS;
-  }else if(tmpsns=="tigr"){
-    namingscheme=SCHEME_TIGR;
-  }else if(tmpsns=="fr"){
-    namingscheme=SCHEME_FR;
-  }else if(tmpsns=="sra"){
-    namingscheme=SCHEME_SRARAW;
-  }else if(tmpsns=="unknown"){
-    namingscheme=SCHEME_UNKNOWN;
-  }else if(tmpsns=="none"){
-    namingscheme=SCHEME_NONE;
-  }else{
-    return false;
-  }
-
-  FUNCEND();
-  return true;
-}
-
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-bool ReadGroupLib::hasLibWithSeqType(uint8 seqtype)
-{
-  for(uint32 rgi=1; rgi<RG_static_infolib.size(); ++rgi){
-    if(RG_static_infolib[rgi].seqtype==seqtype) return true;
-  }
-  return false;
-}
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-const string & ReadGroupLib::getNameOfNamingScheme(uint8 nscode)
-{
-  FUNCSTART("const string & ReadGroupLib::getNameOfNamingScheme(uint8 nscode)");
-  BUGIFTHROW(nscode >= RG_namesofnamingschemes.size(),"illegal nscode " << static_cast<uint16>(nscode));
-  return RG_namesofnamingschemes[nscode];
-}
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-const string & ReadGroupLib::getNameOfSegmentplacement(int8 spcode)
-{
-  FUNCSTART("const string & ReadGroupLib::getNameOfSequencingType(int8 spcode)");
-  auto idx=static_cast<size_t>(spcode-1-SPLACE_UNUSED_LOW);
-  BUGIFTHROW(idx >= RG_namesofsegmentplacements.size(),"illegal spcode " << static_cast<int16>(spcode) << " " << idx);
-  return RG_namesofsegmentplacements[idx];
-}
diff --git a/src/mira/readgrouplib.H b/src/mira/readgrouplib.H
deleted file mode 100644
index 29894bf..0000000
--- a/src/mira/readgrouplib.H
+++ /dev/null
@@ -1,475 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 2003 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-#ifndef _bas_readgrouplib_h_
-#define _bas_readgrouplib_h_
-
-#include <iostream>
-
-#include "stdinc/defines.H"
-#include "errorhandling/errorhandling.H"
-
-class ReadGroupLib
-{
-public:
-#include "mira/readseqtypes.H"
-
-  typedef uint8 rgid_t;
-
-  static const std::vector<std::string> RG_namesofnamingschemes;
-  static const std::vector<std::string> RG_namesofsegmentplacements;
-  static const std::vector<std::string> RG_namesofseqtypes;
-  static const std::vector<std::string> RG_lcnamesofseqtypes;
-  static const std::vector<std::string> RG_shortnamesofseqtypes;
-  static const std::vector<std::string> RG_samnamesofseqtypes;
-
-  static const std::string RG_emptystring;
-
-  class ReadGroupID
-  {
-  private:
-    rgid_t rgid_id;
-
-  public:
-    ReadGroupID() : rgid_id(0) {};
-    ReadGroupID(size_t rgid) : rgid_id(static_cast<rgid_t>(rgid)) {};
-
-    friend std::ostream & operator<<(std::ostream &ostr, const ReadGroupID & r){
-      ostr << "RGID: " << static_cast<uint16>(r.rgid_id) << "\n";
-      r.dumpDebug(ostr);
-      ostr << std::endl;
-      return ostr;
-    }
-
-    inline bool operator==(const ReadGroupID & other) const {return rgid_id==other.rgid_id;}
-    inline bool operator!=(const ReadGroupID & other) const {return rgid_id!=other.rgid_id;}
-    inline bool operator<(const ReadGroupID & other) const {return rgid_id<other.rgid_id;}
-
-    inline bool isDefaultNonValidReadGroupID() const {return rgid_id==0;}
-    inline void resetLibId() {rgid_id=0;};
-    inline uint32 getLibId() const {return rgid_id;};
-    void checkValidity() {ReadGroupLib::checkLibValidity(rgid_id);}
-    void fillInSensibleDefaults() {ReadGroupLib::fillInSensibleDefaults(rgid_id);}
-
-    inline const std::string & getBaseCaller() const  {return ReadGroupLib::getBaseCaller(rgid_id);}
-    inline int8  getBuildDirection() const {return ReadGroupLib::getBuildDirection(rgid_id);}
-    inline const std::string & getCloneVecName() const  {return ReadGroupLib::getCloneVecName(rgid_id);}
-    inline uint8 getDefaultQual() const {return ReadGroupLib::getDefaultQual(rgid_id);}
-    inline bool hasUserDefaultQual() const {return ReadGroupLib::hasUserDefaultQual(rgid_id);}
-    inline const std::string & getDataDir() const  {return ReadGroupLib::getDataDir(rgid_id);}
-    inline const std::string & getDataFile() const  {return ReadGroupLib::getDataFile(rgid_id);}
-    inline const std::string & getDye() const  {return ReadGroupLib::getDye(rgid_id);}
-    inline const std::string & getGroupName() const  {return ReadGroupLib::getGroupName(rgid_id);}
-    inline int32 getInsizeFrom() const { return ReadGroupLib::getInsizeFrom(rgid_id);}
-    inline int32 getInsizeTo() const { return ReadGroupLib::getInsizeTo(rgid_id);}
-    inline const std::string & getMachineType() const  {return ReadGroupLib::getMachineType(rgid_id);}
-    inline const std::string & getPrimer() const  {return ReadGroupLib::getPrimer(rgid_id);}
-    inline uint8 getReadNamingScheme() const {return ReadGroupLib::getReadNamingScheme(rgid_id);}
-    inline uint8 getSequencingType() const {return ReadGroupLib::getSequencingType(rgid_id);}
-    inline const std::string & getSeqVecName() const  {return ReadGroupLib::getSeqVecName(rgid_id);}
-    inline int8  getStrainID() const {return ReadGroupLib::getStrainID(rgid_id);}
-    inline const std::string & getStrainName() const  {return ReadGroupLib::getStrainName(rgid_id);}
-    inline const std::string & getSegmentPlacement() const  {return ReadGroupLib::getSegmentPlacement(rgid_id);}
-    inline int8 getSegmentPlacementCode() const  {return ReadGroupLib::getSegmentPlacementCode(rgid_id);}
-
-    inline bool  hasTemplateInfo() const {return ReadGroupLib::hasTemplateInfo(rgid_id);}
-    inline bool  wantTemplateInfoEstimate() const {return ReadGroupLib::wantTemplateInfoEstimate(rgid_id);}
-    inline bool  wantSegmentPlacementEstimate() const {return ReadGroupLib::wantSegmentPlacementEstimate(rgid_id);}
-    inline bool  wantTemplateSizeEstimate() const {return ReadGroupLib::wantTemplateSizeEstimate(rgid_id);}
-    inline bool  expectsReadPairs() const {return ReadGroupLib::expectsReadPairs(rgid_id);}
-    inline bool  getSPInfoOnly() const {return ReadGroupLib::getSPInfoOnly(rgid_id);}
-    inline bool  getTSInfoOnly() const {return ReadGroupLib::getTSInfoOnly(rgid_id);}
-
-    inline bool  wantStatisticsCalc() const {return ReadGroupLib::wantStatisticsCalc(rgid_id);}
-    inline void  setStatisticsCalc(bool b) {ReadGroupLib::setStatisticsCalc(rgid_id,b);}
-
-    inline bool  wantUseReadNameFromComment() const {return ReadGroupLib::wantUseReadNameFromComment(rgid_id);}
-    inline void  setUseReadNameFromComment(bool b) {ReadGroupLib::setUseReadNameFromComment(rgid_id,b);}
-
-    inline bool  isBackbone() const {return ReadGroupLib::isBackbone(rgid_id);}
-    inline bool  isRail() const {return ReadGroupLib::isRail(rgid_id);}
-    inline bool  isCoverageEquivalentRead() const {return ReadGroupLib::isCoverageEquivalentRead(rgid_id);}
-
-    inline void setWantSegmentPlacementEstimate(bool b) {ReadGroupLib::setWantSegmentPlacementEstimate(rgid_id,b);}
-    inline void setWantTemplateSizeEstimate(bool b) {ReadGroupLib::setWantTemplateSizeEstimate(rgid_id,b);}
-    inline void setExpectsReadPairs(bool b) {ReadGroupLib::setExpectsReadPairs(rgid_id,b);}
-
-    inline void setBackbone(bool b) {ReadGroupLib::setBackbone(rgid_id,b);}
-    inline void setBaseCaller(const std::string & s) {ReadGroupLib::setBaseCaller(rgid_id,s);}
-    inline void setCoverageEquivalentRead(bool b) {ReadGroupLib::setCoverageEquivalentRead(rgid_id,b);}
-    inline void setCloneVecName(const std::string & s) {ReadGroupLib::setCloneVecName(rgid_id,s);}
-    inline void setDataDir(const std::string & s) {ReadGroupLib::setDataDir(rgid_id,s);}
-    inline void setDataFile(const std::string & s) {ReadGroupLib::setDataFile(rgid_id,s);}
-    inline void setDefaultQual(base_quality_t i) {ReadGroupLib::setDefaultQual(rgid_id,i);}
-    inline void setDye(const std::string & s) {ReadGroupLib::setDye(rgid_id,s);}
-    inline void setGroupName(const std::string & s){ReadGroupLib::setGroupName(rgid_id,s);}
-    inline void setInsizeFrom(int32 i) {ReadGroupLib::setInsizeFrom(rgid_id,i);}
-    inline void setInsizeTo(int32 i) {ReadGroupLib::setInsizeTo(rgid_id,i);}
-    inline void setMachineType(const std::string & s) {ReadGroupLib::setMachineType(rgid_id,s);}
-    inline void setPrimer(const std::string & s) {ReadGroupLib::setPrimer(rgid_id,s);}
-    inline void setRail(bool b) {ReadGroupLib::setRail(rgid_id,b);}
-    inline void setReadNamingScheme(uint8 t) {ReadGroupLib::setReadNamingScheme(rgid_id,t);}
-    inline void setSequencingType(uint8 t) {ReadGroupLib::setSequencingType(rgid_id,t);}
-    void setSequencingType(std::string t);
-    inline void setSeqVecName(const std::string & s) {ReadGroupLib::setSeqVecName(rgid_id,s);}
-    inline void setStrainID(int8 i) {ReadGroupLib::setStrainID(rgid_id,i);}
-    inline void setStrainName(const std::string & s) {ReadGroupLib::setStrainName(rgid_id,s);}
-    inline bool setSegmentPlacement(const std::string & s) {return ReadGroupLib::setSegmentPlacement(rgid_id,s);}
-    inline void setSegmentPlacementCode(const int8 code) {ReadGroupLib::setSegmentPlacementCode(rgid_id,code);}
-    inline bool setSegmentNaming(const std::string & s) {return ReadGroupLib::setSegmentNaming(rgid_id,s);}
-    inline void setSPInfoOnly(bool b) {ReadGroupLib::setSPInfoOnly(rgid_id,b);}
-    inline void setTSInfoOnly(bool b) {ReadGroupLib::setTSInfoOnly(rgid_id,b);}
-
-    inline const std::string & getNameOfSequencingType() const {return ReadGroupLib::getNameOfSequencingType(RG_static_infolib[rgid_id].seqtype);};
-    inline const std::string & getShortNameOfSequencingType() const {return ReadGroupLib::getShortNameOfSequencingType(RG_static_infolib[rgid_id].seqtype);};
-
-    inline const std::vector<std::string> & getReadRenamePrefixList() const {return ReadGroupLib::getReadRenamePrefixList(rgid_id);};
-    inline const void addReadRenamePrefix(const std::string & pre, const std::string & ren) {ReadGroupLib::addReadRenamePrefix(rgid_id,pre,ren);};
-
-    std::ostream & dumpDebug(std::ostream & ostr) const {return ostr << ReadGroupLib::RG_static_infolib[rgid_id];}
-
-  };
-
-
-  //Variables
-private:
-  static const bool RG_initialisedstatics;
-
-  struct rginfo_t {
-    std::string groupname;
-    std::string strainname;
-    std::string segmentplacement;
-    int32 insize_from;
-    int32 insize_to;
-    uint8 seqtype;
-    uint8 namingscheme;
-
-    base_quality_t defaultqual;
-
-    std::string machine_type;
-    std::string basecaller;
-    std::string dye;
-    std::string primer;
-    std::string clonevecname;
-    std::string seqvecname;
-
-    std::string adaptorleft;
-    std::string adaptorright;
-    std::string adaptorsplit;
-
-    std::string datadir;
-    std::string datafile;
-
-    std::vector<std::string> readrenameprefixlist;
-
-    bool is_backbone;
-    bool is_rail;
-    bool is_coverageequivalent;
-
-    //*****************************************************************
-    // Maybe create new class "rgparams" which would also hold
-    //  all clipping etc. parameters which are specific to readgroups?
-    // This is again a long term TODO though
-    bool expectsreadpairs;
-    bool sp_wantestimate;  // segment placement: wants MIRA to estimate value
-    bool ts_wantestimate;  // template size: wants MIRA to estimate value
-    bool sp_infoonly;  // segment placement: info only, do not use in assembly
-    bool ts_infoonly;  // template size: info only, do not use in assembly
-
-    bool hack_calcstats;  // MIRA can use Rg to calc statistics
-    //*****************************************************************
-
-    bool sn_rollcommenttoname;  // roll first comment word to be name of the read
-
-    // computed, then query by outside
-    bool has_templateinfo;
-    bool has_userdefaultqual;
-    int8 segmentplacementcode;
-
-    int8  strainid;
-
-    bool wassaved;   // used by readgrouplib to show which Rg was already saved
-
-  public:
-    inline rginfo_t() : insize_from(-1),
-			insize_to(-1),
-			seqtype(SEQTYPE_END),
-			namingscheme(SCHEME_UNKNOWN),
-			defaultqual(101),
-			strainid(0),
-			wassaved(false),
-			is_backbone(false),
-			is_rail(false),
-			is_coverageequivalent(false),
-			has_templateinfo(false),
-			has_userdefaultqual(false),
-			expectsreadpairs(false),
-			sp_wantestimate(true),
-			ts_wantestimate(true),
-			sp_infoonly(false),
-			ts_infoonly(false),
-			hack_calcstats(true),
-			sn_rollcommenttoname(false),
-			segmentplacementcode(SPLACE_UNKNOWN) {};
-
-    friend std::ostream & operator<<(std::ostream &ostr, const rginfo_t & rgi){
-      ostr << "RGN: " << rgi.groupname << "\tSN: " << rgi.strainname
-	   << "\nSP: " << rgi.segmentplacement << "\tSPio: " << rgi.sp_infoonly
-	   << "\tSPC: " << static_cast<int32>(rgi.segmentplacementcode)
-	   << "\tIF: " << rgi.insize_from << "\tIT: " << rgi.insize_to << "\tTSio: " << rgi.ts_infoonly
-	   << "\nST: " << static_cast<uint16>(rgi.seqtype);
-      ostr.flush();
-      ostr << " (" << getNameOfSequencingType(rgi.seqtype)
-	   << ")\tnamschem: " << static_cast<uint16>(rgi.namingscheme) << "\tSID: " << static_cast<uint16>(rgi.strainid)
-	   << "\nDQ: " << static_cast<uint16>(rgi.defaultqual)
-	   << "\nBB: " << rgi.is_backbone << "\tRail: " << rgi.is_rail << "\tCER: " << rgi.is_coverageequivalent
-	   << std::endl;
-      return ostr;
-    }
-  };
-  // sooner or later, clipping options should move here
-
-  static std::vector<rginfo_t> RG_static_infolib;
-
-  static bool RG_strainids_clean;
-  static int8 RG_numstrains;
-
-  //Functions
-private:
-  void foolCompiler();
-  static bool staticInitialiser();
-  void init();
-  static void zeroVars();
-
-  static void checkLibValidity(rgid_t libid);
-  static void fillInSensibleDefaults(rgid_t libid);
-
-  inline static void checkLibExistence(rgid_t libid) {
-    FUNCSTART("void checkLibExistence(gid_t libid)");
-    BUGIFTHROW(libid > RG_static_infolib.size(), "libid " << static_cast<uint32>(libid) << " > RG_static_infolib.size() " << RG_static_infolib.size() << " ???");
-    FUNCEND();
-  }
-
-  inline static const std::string & getBaseCaller(rgid_t libid){checkLibExistence(libid); return RG_static_infolib[libid].basecaller;}
-  inline static int8 getBuildDirection(rgid_t libid){
-    checkLibExistence(libid);
-    if(RG_static_infolib[libid].segmentplacementcode>=0) return 1;
-    return -1;
-  }
-  inline static const std::string & getCloneVecName(rgid_t libid){checkLibExistence(libid); return RG_static_infolib[libid].clonevecname;}
-  inline static const std::string & getDataDir(rgid_t libid){checkLibExistence(libid); return RG_static_infolib[libid].datadir;}
-  inline static const std::string & getDataFile(rgid_t libid){checkLibExistence(libid); return RG_static_infolib[libid].datafile;}
-  inline static base_quality_t getDefaultQual(rgid_t libid) {checkLibExistence(libid); return RG_static_infolib[libid].defaultqual;}
-  inline static bool hasUserDefaultQual(rgid_t libid) {checkLibExistence(libid); return RG_static_infolib[libid].has_userdefaultqual;}
-  inline static const std::string & getDye(rgid_t libid){checkLibExistence(libid); return RG_static_infolib[libid].dye;}
-  inline static const std::string & getGroupName(rgid_t libid){checkLibExistence(libid); return RG_static_infolib[libid].groupname;}
-  inline static int32 getInsizeFrom(rgid_t libid){checkLibExistence(libid); return RG_static_infolib[libid].insize_from;}
-  inline static int32 getInsizeTo(rgid_t libid) {checkLibExistence(libid); return RG_static_infolib[libid].insize_to;}
-  inline static const std::string & getMachineType(rgid_t libid){checkLibExistence(libid); return RG_static_infolib[libid].machine_type;}
-  inline static const std::string & getPrimer(rgid_t libid){checkLibExistence(libid); return RG_static_infolib[libid].primer;}
-  inline static uint8 getReadNamingScheme(rgid_t libid) {checkLibExistence(libid); return RG_static_infolib[libid].namingscheme;}
-  inline static std::vector<std::string> & getReadRenamePrefixList(rgid_t libid) {checkLibExistence(libid); return RG_static_infolib[libid].readrenameprefixlist;}
-  inline static const std::string & getStrainName(rgid_t libid){checkLibExistence(libid); return RG_static_infolib[libid].strainname;}
-  inline static uint8 getSequencingType(rgid_t libid) {checkLibExistence(libid); return RG_static_infolib[libid].seqtype;}
-  inline static const std::string & getSeqVecName(rgid_t libid){checkLibExistence(libid); return RG_static_infolib[libid].seqvecname;}
-  inline static int8 getStrainID(rgid_t libid){
-    checkLibExistence(libid);
-    //std::cout << "RG_strainids_clean: " << RG_strainids_clean << endl;
-    if(!RG_strainids_clean) makeStrainIDs();
-    //std::cout << "RG_static_infolib[" << static_cast<int32>(libid) << "] = " << static_cast<int32>(RG_static_infolib[libid].strainid) << endl;
-    return RG_static_infolib[libid].strainid;
-  }
-  inline static const std::string & getSegmentPlacement(rgid_t libid){checkLibExistence(libid); return RG_static_infolib[libid].segmentplacement;}
-  inline static int8 getSegmentPlacementCode(rgid_t libid){checkLibExistence(libid); return RG_static_infolib[libid].segmentplacementcode;}
-
-  inline static bool hasTemplateInfo(rgid_t libid){checkLibExistence(libid); return RG_static_infolib[libid].has_templateinfo;}
-  inline static bool wantTemplateInfoEstimate(rgid_t libid){checkLibExistence(libid); return RG_static_infolib[libid].sp_wantestimate | RG_static_infolib[libid].ts_wantestimate;}
-  inline static bool wantSegmentPlacementEstimate(rgid_t libid){checkLibExistence(libid); return RG_static_infolib[libid].sp_wantestimate;}
-  inline static bool wantTemplateSizeEstimate(rgid_t libid){checkLibExistence(libid); return RG_static_infolib[libid].ts_wantestimate;}
-  inline static bool expectsReadPairs(rgid_t libid){checkLibExistence(libid); return RG_static_infolib[libid].expectsreadpairs;}
-  inline static bool getSPInfoOnly(rgid_t libid){checkLibExistence(libid); return RG_static_infolib[libid].sp_infoonly;}
-  inline static bool getTSInfoOnly(rgid_t libid){checkLibExistence(libid); return RG_static_infolib[libid].ts_infoonly;}
-
-  inline static bool isBackbone(rgid_t libid){checkLibExistence(libid); return RG_static_infolib[libid].is_backbone;}
-  inline static bool isRail(rgid_t libid){checkLibExistence(libid); return RG_static_infolib[libid].is_rail;}
-  inline static bool isCoverageEquivalentRead(rgid_t libid){checkLibExistence(libid); return RG_static_infolib[libid].is_coverageequivalent;}
-
-  inline static bool  wantUseReadNameFromComment(rgid_t libid){checkLibExistence(libid); return RG_static_infolib[libid].sn_rollcommenttoname;}
-  inline static void  setUseReadNameFromComment(rgid_t libid, bool v) {checkLibExistence(libid); RG_static_infolib[libid].sn_rollcommenttoname=v;}
-
-  inline static bool  wantStatisticsCalc(rgid_t libid){checkLibExistence(libid); return RG_static_infolib[libid].hack_calcstats;}
-  inline static void  setStatisticsCalc(rgid_t libid, bool v) {checkLibExistence(libid); RG_static_infolib[libid].hack_calcstats=v;}
-
-  inline static void setWantSegmentPlacementEstimate(rgid_t libid, bool v) {checkLibExistence(libid); RG_static_infolib[libid].sp_wantestimate=v;}
-  inline static void setWantTemplateSizeEstimate(rgid_t libid, bool v) {checkLibExistence(libid); RG_static_infolib[libid].ts_wantestimate=v;}
-  inline static void setExpectsReadPairs(rgid_t libid, bool v) {checkLibExistence(libid); RG_static_infolib[libid].expectsreadpairs=v;}
-  inline static void addReadRenamePrefix(rgid_t libid, const std::string & pre, const std::string & ren) {
-    checkLibExistence(libid);
-    RG_static_infolib[libid].readrenameprefixlist.push_back(pre);
-    RG_static_infolib[libid].readrenameprefixlist.push_back(ren);
-  }
-  inline static void setBackbone(rgid_t libid, bool v) {checkLibExistence(libid); RG_static_infolib[libid].is_backbone=v;}
-  inline static void setBaseCaller(rgid_t libid, const std::string & s) {checkLibExistence(libid); RG_static_infolib[libid].basecaller=s;}
-  inline static void setCloneVecName(rgid_t libid, const std::string & s) {checkLibExistence(libid); RG_static_infolib[libid].clonevecname=s;}
-  inline static void setCoverageEquivalentRead(rgid_t libid, bool v) {checkLibExistence(libid); RG_static_infolib[libid].is_coverageequivalent=v;}
-  inline static void setDataDir(rgid_t libid, const std::string & s) {checkLibExistence(libid); RG_static_infolib[libid].datadir=s;}
-  inline static void setDataFile(rgid_t libid, const std::string & s) {checkLibExistence(libid); RG_static_infolib[libid].datafile=s;}
-  inline static void setDefaultQual(rgid_t libid, int8 i) {checkLibExistence(libid); RG_static_infolib[libid].defaultqual=i;}
-  inline static void setDye(rgid_t libid, const std::string & s) {checkLibExistence(libid); RG_static_infolib[libid].dye=s;}
-  inline static void setGroupName(rgid_t libid, const std::string & s){checkLibExistence(libid); RG_static_infolib[libid].groupname=s;}
-  inline static void setInsizeFrom(rgid_t libid, int32 i) {
-    checkLibExistence(libid); RG_static_infolib[libid].insize_from=i;
-    if(i>=0){
-      RG_static_infolib[libid].has_templateinfo=true;
-    }else if(RG_static_infolib[libid].insize_to<0
-	     && RG_static_infolib[libid].segmentplacementcode==SPLACE_UNKNOWN){
-      RG_static_infolib[libid].has_templateinfo=false;
-    }
-  }
-  inline static void setInsizeTo(rgid_t libid, int32 i) {
-    checkLibExistence(libid); RG_static_infolib[libid].insize_to=i;
-    if(i>=0){
-      RG_static_infolib[libid].has_templateinfo=true;
-    }else if(RG_static_infolib[libid].insize_from<0
-	     && RG_static_infolib[libid].segmentplacementcode==SPLACE_UNKNOWN){
-      RG_static_infolib[libid].has_templateinfo=false;
-    }
-  }
-  inline static void setMachineType(rgid_t libid, const std::string & s) {checkLibExistence(libid); RG_static_infolib[libid].machine_type=s;}
-  inline static void setPrimer(rgid_t libid, const std::string & s) {checkLibExistence(libid); RG_static_infolib[libid].primer=s;}
-  inline static void setRail(rgid_t libid, bool v) {checkLibExistence(libid); RG_static_infolib[libid].is_rail=v;}
-  inline static void setReadNamingScheme(rgid_t libid, uint8 t) {checkLibExistence(libid); RG_static_infolib[libid].namingscheme=t;}
-  static void setSequencingType(rgid_t libid, uint8 st);
-  inline static void setSeqVecName(rgid_t libid, const std::string & s) {checkLibExistence(libid); RG_static_infolib[libid].seqvecname=s;}
-  inline static void setStrainID(rgid_t libid, int8 i) {checkLibExistence(libid); RG_static_infolib[libid].strainid=i;}
-  inline static void setStrainName(rgid_t libid, const std::string & s) {checkLibExistence(libid); RG_static_infolib[libid].strainname=s; RG_strainids_clean=false;}
-
-  static void setSegmentPlacementCode(rgid_t libid, const int8 code){
-    FUNCSTART("static bool ReadGroupLib::setSegmentPlacement(rgid_t libid, const int8 code)");
-    BUGIFTHROW(code<=SPLACE_UNUSED_LOW || code>=SPLACE_UNUSED_HIGH,"code " << static_cast<int16>(code) << " is invalid.");
-    RG_static_infolib[libid].segmentplacementcode=code;
-    if(RG_static_infolib[libid].segmentplacementcode!=SPLACE_UNKNOWN){
-      RG_static_infolib[libid].has_templateinfo=true;
-    }else if(RG_static_infolib[libid].insize_from<0
-	     && RG_static_infolib[libid].insize_to<0){
-      RG_static_infolib[libid].has_templateinfo=false;
-    }
-  }
-  static bool setSegmentPlacement(rgid_t libid, const std::string & sps){
-    RG_static_infolib[libid].segmentplacement=sps;
-    auto x=parseSegmentPlacement(sps,RG_static_infolib[libid].segmentplacementcode);
-    if(RG_static_infolib[libid].segmentplacementcode!=SPLACE_UNKNOWN){
-      RG_static_infolib[libid].has_templateinfo=true;
-    }else if(RG_static_infolib[libid].insize_from<0
-	     && RG_static_infolib[libid].insize_to<0){
-      RG_static_infolib[libid].has_templateinfo=false;
-    }
-    return x;
-  }
-
-  static bool setSegmentNaming(rgid_t libid, const std::string & sns){
-    return parseSegmentNaming(sns,RG_static_infolib[libid].namingscheme);
-  }
-
-  inline static void setSPInfoOnly(rgid_t libid, bool b) {checkLibExistence(libid); RG_static_infolib[libid].sp_infoonly=b;}
-  inline static void setTSInfoOnly(rgid_t libid, bool b) {checkLibExistence(libid); RG_static_infolib[libid].ts_infoonly=b;}
-
-
-  static void makeStrainIDs();
-
-public:
-  ReadGroupLib();
-  ReadGroupLib(ReadGroupLib const &other);
-  ~ReadGroupLib();
-
-  ReadGroupLib const & operator=(ReadGroupLib const & other);
-  friend std::ostream & operator<<(std::ostream &ostr, ReadGroupLib const &rgl);
-
-  static void discard();
-
-  static rgid_t setReadGroupInfo2(rgid_t libid,
-				  std::string & rgname,
-				  uint8 seqtype,
-				  int32 isfrom,
-				  int32 isto,
-				  int8  dir);
-
-  static ReadGroupID newReadGroup();
-  static inline size_t getNumReadGroups() { return RG_static_infolib.size();}
-  static inline ReadGroupID getReadGroupID(rgid_t libid) {
-    checkLibExistence(libid);
-    return ReadGroupID(libid);
-  }
-
-  static inline uint8 getNumSequencingTypes() {return SEQTYPE_END;}
-  static const std::string & getNameOfSequencingType(uint32 st);
-  static const std::string & getShortNameOfSequencingType(uint32 st);
-  static const std::string & getSAMNameOfSequencingType(uint32 st);
-  static uint8 stringToSeqType(const std::string & value);
-
-  static bool parseSegmentPlacement(const std::string & sps, int8 & tpcode);
-  static bool parseSegmentNaming(const std::string & sns, uint8 & schemecode);
-
-  static const std::string & getNameOfNamingScheme(uint8 ns);
-  static const std::string & getNameOfSegmentplacement(int8 sp);
-
-  static inline int8 getNumOfStrains() {
-    if(!RG_strainids_clean) makeStrainIDs();
-    return RG_numstrains;
-  }
-  static const std::string & getStrainOfStrainID(int32 sid);
-  static bool getStrainIDOfStrain(const std::string & strainname, int32 & sid);
-
-  static void dumpStrainIDSummary() {std::cout << "TODO: Like Readpool: strain x has y reads\n";}
-
-  static bool hasLibWithSeqType(uint8 seqtype);
-
-  static rgid_t searchExactRGMatch(
-    std::string & rgname,
-    uint8 seqtype,
-    int32 isfrom,
-    int32 isto,
-    int8 segmentplacementcode,
-    std::string & strainname,
-    bool isbb,
-    bool israil,
-    bool iscer,
-    std::string & seqvecname,
-    std::string & machine_type,
-    std::string & basecaller);
-
-  static void completeDefaultsForReadGroups();
-
-  static void dumpAllReadGroupsAsMAF(std::ostream & ostr);
-  static void dumpReadGroupAsMAF(uint32 rgi, std::ostream & ostr);
-  static void saveAllReadGroupsAsMAF(std::ostream & ostr);
-  static void saveReadGroupAsMAF(uint32 rgi, std::ostream & ostr);
-
-  static void dumpReadGroupAsSAM(uint32 rgi, std::ostream & ostr);
-
-  static void debugDumpReadGroupInfo(std::ostream & ostr);
-};
-
-
-#endif
diff --git a/src/mira/readlotstat.C b/src/mira/readlotstat.C
deleted file mode 100644
index 16b9563..0000000
--- a/src/mira/readlotstat.C
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 2003 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-#include "readlotstat.H"
-
-//// Plain vanilla constructor
-//ReadLotStat::ReadLotStat()
-//{
-//  FUNCSTART("ReadLotStat::ReadLotStat()");
-//
-//  FUNCEND();
-//}
-//
-//ReadLotStat::~ReadLotStat()
-//{
-//  FUNCSTART("ReadLotStat::~ReadLotStat()");
-//
-//  FUNCEND();
-//}
-
-
-
-//ostream & operator<<(ostream &ostr, ReadLotStat const &???)
-//{
-//  FUNCSTART("friend ostream & ReadLotStat::operator<<(ostream &ostr, const  &???)");
-//  ERROR("Not implemented yet.");
-//
-//  FUNCEND();
-//  return ostr;
-//}
diff --git a/src/mira/readlotstat.H b/src/mira/readlotstat.H
deleted file mode 100644
index 8159d0f..0000000
--- a/src/mira/readlotstat.H
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 2003 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-#ifndef _bas_readlotstat_h_
-#define _bas_readlotstat_h_
-
-#include <iostream>
-#include <string>
-
-#include "stdinc/defines.H"
-
-
-class ReadLotStat
-{
-  //Variables
-private:
-
-public:
-  uint64 RLS_count_all=0;
-  uint64 RLS_count_withoutclips=0;
-  uint64 RLS_count_used=0;
-  uint64 RLS_count_noqual=0;
-  uint64 RLS_count_clipleft=0;
-  uint64 RLS_count_clipright=0;
-  uint64 RLS_count_chimera=0;
-
-  uint64 RLS_len_all=0;
-  uint64 RLS_len_used=0;
-
-  uint64 getAvgLenAll() const { return RLS_count_all==0 ? 0 : RLS_len_all/RLS_count_all; }
-  uint64 getAvgLenUsed() const { return RLS_count_used==0 ? 0 : RLS_len_used/RLS_count_used; }
-
-  std::string RLS_verdict_chimera;
-
-  //ReadLotStat();
-  //ReadLotStat(ReadLotStat const &other);
-  //~ReadLotStat();
-
-  friend std::ostream & operator<<(std::ostream &ostr, ReadLotStat const &daq);
-};
-
-
-#endif
diff --git a/src/mira/readpool.C b/src/mira/readpool.C
index 746feea..af3efa9 100644
--- a/src/mira/readpool.C
+++ b/src/mira/readpool.C
@@ -2,7 +2,7 @@
  * Written by Bastien Chevreux (BaCh)
  *
  * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
- *   Krebsforschungszentrum, DKFZ Heidelberg) and Bastien Chevreux
+ *   Krebsforschungszentrum, DKFZ Heidelberg) and Bastien Chevreux 
  *   and Thomas Pfisterer
  * Copyright (C) 2000 and later by Bastien Chevreux
  *
@@ -12,85 +12,46 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
+#ifndef lint
+static char vcid[] = "$Id$";
+#endif /* lint */
+
 
-#include "mira/readpool.H"
+#include "readpool.H"
+
+#include <iostream>
+#include <fstream>
+#include <ctype.h>
 
 #include "errorhandling/errorhandling.H"
+#include "util/progressindic.H"
 
 #include "io/generalio.H"
 #include "io/fasta.H"
 #include "io/fastq-lh.H"
+#include "io/gbf.H"
 #include "io/phd.H"
 #include "io/ncbiinfoxml.H"
 
-#include "util/fileanddisk.H"
-#include "util/progressindic.H"
+#include "gff_parse.H"
+
+#include "boost/unordered_map.hpp" 
 
-#include "caf/caf.H"
-
-#include "mira/gbf_parse.H"
-#include "mira/gff_parse.H"
-#include "mira/maf_parse.H"
-
-#include <unordered_map>
-#include <unordered_set>
-
-KSEQ_INIT(gzFile, myGZRead)
-
-using namespace std;
-
-#define CEBUG(bla)
-
-string ReadPool::RP_missingfastaqual_resolvemsg("name your files with a .fna postfix");
-
-const base_quality_t ReadPool::RP_sxa2phredmap[256]= {
-  0, 0, 0, 0, 0, 0, 0, 0,
-  0, 0, 0, 0, 0, 0, 0, 0,
-  0, 0, 0, 0, 0, 0, 0, 0,
-  0, 0, 0, 0, 0, 0, 0, 0,
-  0, 0, 0, 0, 0, 0, 0, 0,
-  0, 0, 0, 0, 0, 0, 0, 0,
-  0, 0, 0, 0, 0, 0, 0, 0,
-  0, 0, 0, 1, 1, 2, 2, 3,
-  3, 4, 4, 5, 5, 6, 7, 8,
-  9, 10, 10, 11, 12, 13, 14, 15,
-  16, 17, 18, 19, 20, 21, 22, 23,
-  24, 25, 26, 27, 28, 29, 30, 31,
-  32, 33, 34, 35, 36, 37, 38, 39,
-  40, 41, 42, 43, 44, 45, 46, 47,
-  48, 49, 50, 51, 52, 53, 54, 55,
-  56, 57, 58, 59, 60, 61, 62, 63,
-  64, 65, 66, 67, 68, 69, 70, 71,
-  72, 73, 74, 75, 76, 77, 78, 79,
-  80, 81, 82, 83, 84, 85, 86, 87,
-  88, 89, 90, 91, 92, 93, 94, 95,
-  96, 97, 98, 99, 100, 101, 102, 103,
-  104, 105, 106, 107, 108, 109, 110, 111,
-  112, 113, 114, 115, 116, 117, 118, 119,
-  120, 121, 122, 123, 124, 125, 126, 127,
-  128, 129, 130, 131, 132, 133, 134, 135,
-  136, 137, 138, 139, 140, 141, 142, 143,
-  144, 145, 146, 147, 148, 149, 150, 151,
-  152, 153, 154, 155, 156, 157, 158, 159,
-  160, 161, 162, 163, 164, 165, 166, 167,
-  168, 169, 170, 171, 172, 173, 174, 175,
-  176, 177, 178, 179, 180, 181, 182, 183,
-  184, 185, 186, 187, 188, 189, 190, 191
-};
 
+KSEQ_INIT(gzFile, gzread)
 
 
 /*************************************************************************
@@ -99,36 +60,32 @@ const base_quality_t ReadPool::RP_sxa2phredmap[256]= {
  *
  *
  *************************************************************************/
-ReadPool::ReadContainer const & ReadPool::ReadContainer::operator=(ReadPool::ReadContainer const & other)
+void ReadPool::foolCompiler()
 {
-  // 1 to 1 copy, including eventually free elements so that
-  // operator[] has the same result on source and copy object
-  if(this != &other){
-    RC_thepool.clear();
-    for(auto rptr : other.RC_poolrptr){
-      RC_thepool.push_back(*rptr);
-      RC_poolrptr.push_back(&(RC_thepool.back()));
-    }
-    RC_releasedidx=other.RC_releasedidx;
-  }
-  //cout << "Copied ReadContainer size " << size() << " and with " << getNumActiveReads() << " active reads\n";
-  return *this;
+#include "stdinc/foolcompiler.C"
 }
 
+
+
+
 /*************************************************************************
  *
  *
  *
  *
  *************************************************************************/
-ReadPool::ReadPool()
+ReadPool::ReadPool(vector<MIRAParameters> * params)
 {
   FUNCSTART("ReadPool::ReadPool()");
 
-  REP_thepool3.clear();
+  REP_thepool.clear();
+  //REP_filenames=NULL;
+  REP_miraparams=params;
+
+  // fill in the default strain (Id=0)
+  REP_strainnames.push_back("default");
 
-  REP_allownameindex=false;
-  REP_nameindex.clear();
+  REP_valid=REP_VALID;
 
   FUNCEND();
 }
@@ -146,8 +103,9 @@ void ReadPool::discard()
 {
   FUNCSTART("ReadPool::discard()");
 
-  REP_thepool3.clear();
-  REP_nameindex.clear();
+  //REP_miraparams=NULL;
+  nukeSTLContainer(REP_thepool);
+  nukeSTLContainer(REP_strainnames);
 
   //delete [] REP_filenames;
 
@@ -167,11 +125,21 @@ ReadPool::~ReadPool()
   FUNCSTART("ReadPool::~ReadPool()");
 
   discard();
-
+  
   FUNCEND();
 }
 
 
+//void ReadPool::setMIRAParameters(MIRAParameters * params)
+//{
+//  FUNCSTART("void ReadPool::setMIRAParameters(MIRAParameters * params);");
+//
+//  REP_miraparams=params;
+//
+//  FUNCEND();
+//}
+
+
 
 /*************************************************************************
  *
@@ -184,8 +152,8 @@ size_t ReadPool::estimateMemoryUsage() const
   FUNCSTART("size_t ReadPool::estimateMemoryUsage()");
 
   size_t ret=sizeof(ReadPool);
-  // TODO: estimateMemoryUsage for deque
-  //ret+=estimateMemoryUsageOfContainer(REP_thepool2,false);
+  ret+=estimateMemoryUsageOfContainer(REP_thepool,false);
+  ret+=estimateMemoryUsageOfContainer(REP_strainnames,false);
 
   FUNCEND();
   return ret;
@@ -196,13 +164,24 @@ size_t ReadPool::estimateMemoryUsage() const
  *
  * makes template IDs for the reads in the pool
  *
- * returns
+ * returns 
  *  true if there are usable templates (less templates than valid reads)
  *  false otherwise
  *
  *************************************************************************/
 
-bool ReadPool::makeTemplateIDs(uint8 nagwarn_templateproblems, bool verbose)
+//struct eqstr
+//{
+//  bool operator()(const char* s1, const char* s2) const
+//  {
+//    return strcmp(s1, s2) == 0;
+//  }
+//}; 
+//
+//typedef hash_multimap<const char*, int, hash<const char *>, eqstr> stringhash_t; 
+//typedef stringhash_t::value_type stringhash_entry_t;
+
+bool ReadPool::makeTemplateIDs(bool verbose)
 {
   FUNCSTART("void ReadPool::makeTemplateIDs()");
 
@@ -223,283 +202,1506 @@ bool ReadPool::makeTemplateIDs(uint8 nagwarn_templateproblems, bool verbose)
   //  ancillary data, the no_te_check will ensure that we'll then still use
   //  the template information
   bool notecheck=true;
-  for(size_t i=0; i<REP_thepool3.size(); ++i){
-    if(getRead(i).getTemplateSegment()!=0) {
+  for(uint32 i=0; i<size();i++){
+    if(REP_thepool[i].getTemplateEnd()!='N') {
       notecheck=false;
     }
   }
 
 
-  typedef unordered_map<std::string, int32> strintmap;
+  typedef boost::unordered_map<std::string, int32> strintmap;
   strintmap tnmap;
   strintmap::iterator tnI;
 
   int32 acttid=0;
   int32 validreads=0;
 
-  uint32 outlines_fatal=0;
-  uint32 outlines_warn=0;
-  uint32 ol_emptytn=0;
-  uint32 ol_gt2reads=0;
-  uint32 ol_unknownsegment=0;
-  uint32 ol_unknownsegmentfixed=0;
-  uint32 ol_samesegment=0;
-  for(uint32 rid=0; rid<size();++rid){
+  for(uint32 i=0; i<size();i++){
       //cout << "acttid: " << acttid << "\t";
-    if(getRead(rid).hasValidData()==false) continue;
-    ++validreads;
-    if(getRead(rid).getTemplate().empty()) {
-      getRead(rid).setTemplateID(acttid);
+    if(REP_thepool[i].hasValidData()==false) continue;
+    validreads++;
+
+    tnI=tnmap.find(REP_thepool[i].getInternalTemplateName());
+    if(tnI!=tnmap.end()){
+      REP_thepool[i].setTemplateID(tnI->second);
+      tidcounter[tnI->second]++;
+        
+      int32 firstpartner=tid_firstpartner[tnI->second];
+      REP_thepool[i].setTemplatePartnerID(firstpartner);
+      REP_thepool[firstpartner].setTemplatePartnerID(i);
+    }else{
+      REP_thepool[i].setTemplateID(acttid);
+
+      tid_firstpartner[acttid]=i;
+
       tidcounter[acttid]++;
-      ++acttid;
-      if(getRead(rid).getReadGroupID().hasTemplateInfo()){
-	// Ooooops ... empty template but readgroupinfo?
-	if(ol_emptytn<200){
-	  ++outlines_fatal;
-	  cout << "Read " << getRead(rid).getName() << " has template info given, but the internal template name is empty? This is fishy!" << endl;
-	  if(++ol_emptytn==200){
-	    cout << "More than 200 cases like the above, will not report more.\n";
+      tnmap[REP_thepool[i].getInternalTemplateName()]=acttid;
+      acttid++;
+    }
+  }
+
+
+  bool faultfound=false;
+  for(uint32 i=0; i<size(); i++){
+    CEBUG("Checking template " << i << "\t" << tidcounter[i] << endl);
+    if(tidcounter[i]>2){
+      acttid--;
+      faultfound=true;
+      cerr << "The reads ";
+      for(uint32 j=0; j<size(); j++){
+	if(REP_thepool[j].getTemplateID()==static_cast<int32>(i)){
+	  // TODO: make configurable
+	  cerr << REP_thepool[j].getName() << " ";
+	  REP_thepool[j].setTemplateID(-1);
+	  REP_thepool[j].setTemplatePartnerID(-1);
+	}
+      }
+      cerr << "have the same template and MIRA was unable to differentiate between different trials. Template information not used there.\n";
+    } else {
+      //Read::setCoutType(Read::AS_TEXT);
+      //cout << REP_thepool[i];
+    }
+  }
+
+  if(verbose){
+    cout << "Generated " << acttid << " unique template ids for " << validreads << " valid reads.\n";
+  }
+
+  if(acttid==validreads){
+    FUNCEND();
+    return false;
+  }
+
+  FUNCEND();
+  return true;
+}
+
+
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+
+
+void ReadPool::makeStrainIDs(bool verbose)
+{
+  FUNCSTART("void ReadPool::makeStrainIDs()");
+
+  if(verbose){
+    rpDateStamp();
+    cout << endl;
+  }
+
+  //vector<int32> tidcounter;
+  //tidcounter.resize(size(), 0);
+
+  typedef boost::unordered_map<std::string, int8> strintmap;
+  strintmap sidmap;
+  strintmap::iterator sidI;
+
+  // fill in the default strain (Id=0)
+  REP_strainnames.clear();
+  sidmap["default"]=REP_strainnames.size();
+  REP_strainnames.push_back("default");
+
+  
+  // go through readpool in two rounds, first just looking at Solexa reads,
+  //  then at all remaining reads
+  // reason: let Solexa have the low strain IDs 0-7, so that they can
+  //  be mapped with merge option in the contig
+
+  for(uint32 round=0; round < 2;++round){
+    for(uint32 rid=0; rid<size();++rid){
+      if(REP_thepool[rid].hasValidData()==false) continue;
+      if(REP_thepool[rid].isRail()) continue;
+      if(REP_thepool[rid].getStrain().size()==0) continue;
+      if(round==0 && REP_thepool[rid].getSequencingType()!=Read::SEQTYPE_SOLEXA) continue;
+      if(round>0 && REP_thepool[rid].getSequencingType()==Read::SEQTYPE_SOLEXA) continue;
+      sidI=sidmap.find(REP_thepool[rid].getStrain());
+      if(sidI!=sidmap.end()){
+	REP_thepool[rid].setStrainID(sidI->second);
+      }else{
+	if(REP_strainnames.size()==127){
+	  MIRANOTIFY(Notify::FATAL, "More than 127 strains encountered? Sorry, not possible. Strain " << REP_thepool[rid].getStrain() << " in read " << REP_thepool[rid].getName() << "\n");
+	}
+	REP_thepool[rid].setStrainID(REP_strainnames.size());
+	if(verbose){
+	  cout << "Seeing strain " << REP_strainnames.size() << ": \"" << REP_thepool[rid].getStrain() << "\"" << endl;
+	}
+	sidmap[REP_thepool[rid].getStrain()]=REP_strainnames.size();
+	REP_strainnames.push_back(REP_thepool[rid].getStrain());
+      }
+      //cout << "Read " <<REP_thepool[i].getName() << " has strain " << REP_thepool[i].getStrain() << endl;
+    }
+  }
+
+  if(verbose){
+    cout << "Generated " << REP_strainnames.size()-1 << " unique strain ids for " << size() << " reads.\n";
+  }
+  return;
+}
+
+
+
+
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+
+void ReadPool::dumpStrainIDSummary()
+{
+  FUNCSTART("void ReadPool::dumpStrainIDSummary()");
+  vector<int32> tidcounter;
+  tidcounter.resize(REP_strainnames.size(), 0);
+  for(uint32 i=0; i<size();i++){
+    if(REP_thepool[i].isRail()) continue;
+    tidcounter[REP_thepool[i].getStrainID()]++;
+  }
+
+  for(uint32 sid=0; sid<REP_strainnames.size();sid++){
+    cout << "Strain \"" << REP_strainnames[sid] << "\" has " << tidcounter[sid] << " reads.\n";
+  }
+
+  FUNCEND();
+}
+
+
+
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+
+bool ReadPool::getStrainIDOfStrain(const string & strainname, int32 & sid) const
+{
+  for(sid=0; sid<REP_strainnames.size(); sid++){
+    if(REP_strainnames[sid]==strainname) return true;
+  }
+  sid=-1;
+  return false;
+}
+
+
+
+
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+const string & ReadPool::getStrainOfStrainID(uint32 sid) const
+{
+  FUNCSTART("const string & ReadPool::getStrainOfStrainID(uint32 sid)");
+
+  BUGIFTHROW(sid >= REP_strainnames.size(),"sid >= REP_strainnames.size()");
+
+  FUNCEND();
+
+  return REP_strainnames[sid];
+}
+
+
+
+
+/*************************************************************************
+ *
+ *
+ * loadaction:
+ *   //  0 = count only
+ *   //  1 = count, adjust readpool capacity and load
+ *   //  2 = load only
+ *
+ *
+ *************************************************************************/
+
+size_t ReadPool::loadEXPs(const string & fofn, const uint8 loadaction, uint32 & longestread, const uint8 readtype, void (*callback)(ReadPool &))
+{
+  FUNCSTART("size_t ReadPool::loadEXPs(const string & fofn, const uint8 loadaction, uint32 & longestread, const uint8 readtype)");
+
+  cout << "Loading file of filenames: " << fofn << endl;
+
+  // Load the file of filenames 
+  ifstream fin;
+  fin.open(fofn.c_str(), ios::in|ios::ate);
+  if(!fin){
+    MIRANOTIFY(Notify::FATAL, "File not found: " << fofn);
+  }
+
+  uint32 len_fofn=fin.tellg();
+  if(len_fofn==1){
+    MIRANOTIFY(Notify::FATAL, "Zero length file: " << fofn);
+  }
+  fin.seekg(0, ios::beg);
+
+  vector<string> names;
+  {
+    string filename, dummy;
+    while(GeneralIO::readKeyValue(fin, filename, dummy)){
+      names.push_back(filename);
+    }
+  }
+  fin.close();
+
+  bool stopprocessing=false;
+  {
+    //stringhash_t M;
+    //pair<stringhash_t::const_iterator, stringhash_t::const_iterator> p;
+
+    typedef boost::unordered_map<std::string, uint32> strintmap;
+    strintmap namemap;
+    strintmap::iterator nI;
+
+    for(uint32 i=0; i< names.size(); i++){
+      nI=namemap.find(names[i]);
+      if(nI!=namemap.end()){
+	cout << "WARNING: file " << names[i] << " is present more than once in your file of filenames." << endl;
+	names[i].clear();
+	stopprocessing=true;
+      }else{
+	namemap[names[i]]=i;
+      }
+    }
+  }
+  cout << "done." << endl;
+
+  if(stopprocessing){
+    MIRANOTIFY(Notify::FATAL, "Some reads lead to unrecoverable error: duplicate names. Aborting, see log above for further information.");
+  }
+
+  rpDateStamp();
+  if(loadaction==0){
+    if(longestread==0) return names.size();
+
+    // if loadaction == 0 and longestread >0 : must load reads but not 
+    //  store, only give back length of longest read
+    
+    cout << "Must analyse reads to find out about longest read length:\n";
+    ProgressIndicator<int32> P(0, names.size()-1);
+
+    longestread=0;
+    Read dummy;
+    for(uint32 i=0; i<names.size(); i++){
+      P.progress(i);
+      if(names[i].empty()) continue;
+      try{
+	if(REP_miraparams!=NULL) {
+	  if((*REP_miraparams)[0].getDirectoryParams().dir_exp.size()!=0 ||
+	     (*REP_miraparams)[0].getDirectoryParams().dir_scf.size()!=0 ) {
+	    dummy.setDirectories((*REP_miraparams)[0].getDirectoryParams().dir_exp,
+				 (*REP_miraparams)[0].getDirectoryParams().dir_scf
+	      );
 	  }
 	}
+	dummy.loadDataFromEXP(names[i]);
+	longestread=max(longestread,dummy.getLenClippedSeq());
+      }
+      catch(Flow){
+      }
+      catch(Notify n){
+	stopprocessing=true;
+	n.handleError(THISFUNC);
+      }
+    }
+    rpDateStamp();
+    return names.size();
+  }
+
+  // Now load all these files.
+  size_t no_files_ok=0;
+  longestread=0;
+  {
+    uint32 pooli=REP_thepool.size();
+    if(loadaction==1) REP_thepool.reserve(REP_thepool.size()+names.size()+10);
+    REP_thepool.resize(REP_thepool.size()+names.size());
+    
+    ProgressIndicator<int32> P(0, names.size()-1);
+    
+    cout << "Loading EXP files: " << endl;
+    
+    //string completename;
+    for(uint32 i=0; i<names.size(); i++, pooli++){
+      P.progress(i);
+      if(names[i].empty()) continue;
+      try{
+	if(REP_miraparams!=NULL) {
+	  if((*REP_miraparams)[0].getDirectoryParams().dir_exp.size()!=0 ||
+	     (*REP_miraparams)[0].getDirectoryParams().dir_scf.size()!=0 ) {
+	    REP_thepool[pooli].setDirectories((*REP_miraparams)[0].getDirectoryParams().dir_exp,
+					      (*REP_miraparams)[0].getDirectoryParams().dir_scf
+					  );
+	  }
+	}
+	REP_thepool[pooli].setSequencingType(readtype);
+	REP_thepool[pooli].loadDataFromEXP(names[i]);
+	no_files_ok++;
+	longestread=max(longestread, REP_thepool[pooli].getLenClippedSeq());
+
+	if(REP_miraparams!=NULL) {
+	  // Set standard insert size if not given in EXP
+	  // TODO: adapt to different read types
+	  if(REP_thepool[pooli].getInsizeFrom() == -1
+	     && REP_thepool[pooli].getInsizeTo() == -1){
+	    REP_thepool[pooli].setInsize(
+	      (*REP_miraparams)[0].getContigParams().con_insertsize_minimum,
+	      (*REP_miraparams)[0].getContigParams().con_insertsize_maximum);
+	  }
+	}
+      }
+      catch(Flow){
+      }
+      catch(Notify n){
+	stopprocessing=true;
+	n.handleError(THISFUNC);
+      }
+      if(callback!=NULL) {
+	(*callback)(*this);
       }
+    }
+    P.finishAtOnce();
+    
+    cout << "\nDone.\n";
+    
+    cout << "There haven been " << names.size() << " files given, " ;
+    cout << no_files_ok << " of which have loaded ok.\n";
+  }
+
+  rpDateStamp();
+  cout << "Adjusting sequencing vector clips from tags:\n";
+  ProgressIndicator<int32> P(0, REP_thepool.size());
+    
+  for(uint32 i=0; i<REP_thepool.size(); i++){
+    P.progress(i);
+    REP_thepool[i].transferSVTagsToClip(20,60);
+  }
+  P.finishAtOnce();
+
+  cout << endl;
+
+  FUNCEND();
+
+  return no_files_ok;
+}
+
+
+
+/*************************************************************************
+ *
+ * if force == true, then load always the qualities from the SCF
+ * if force == false, just load qualities from SCF if no other has already been loaded
+ *
+ * loadfailnoerror = true means that simple load errors (not found etc) do not
+ *                    produce an error on stderr
+ *                   hard errors (mismatch fasta <-> scf) still do!
+ *
+ *************************************************************************/
+void ReadPool::loadQualitiesFromSCF(uint32 force, bool loadfailnoerror, const string & f1name, const string & f2name)
+{
+  FUNCSTART("void ReadPool::loadQualitiesFromSCF()");
+
+  //cout << "### " << f1name << endl;
+  //cout << "### " << f2name << endl;
+
+  assembly_parameters const & as_params= (*REP_miraparams)[0].getAssemblyParams();
+
+  ofstream f1out;
+  f1out.open(f1name.c_str(), ios::out|ios::trunc);
+  ofstream f2out;
+  f2out.open(f2name.c_str(), ios::out|ios::trunc);
+
+  ProgressIndicator<int32> P(0, REP_thepool.size()-1);
+
+  if(force!=0){
+    cout << "Checking SCF files and loading qualities:\n";
+  }else{
+    cout << "Checking SCF files (loading qualities only if needed):\n";
+  }
+  
+  uint32 filesok=0;
+  uint32 filesnotfound=0;
+  uint32 filesbad=0;
+
+  for(uint32 i=0; i<REP_thepool.size(); i++){
+    P.progress(i);
+    if(REP_thepool[i].hasValidData()==true){
+      try{
+	if(force!=0 || REP_thepool[i].hasQuality()==false){
+	  REP_thepool[i].checkSCFAndLoadQual(false, loadfailnoerror);
+	}else{
+	  // just check if SCF file is there and can correctly be loaded
+	  REP_thepool[i].checkSCFAndLoadQual(true, loadfailnoerror);
+	}
+	if(REP_thepool[i].hasSCFData()==false) {
+	  if(!(REP_thepool[i].isBackbone() || REP_thepool[i].isRail())) {
+	    f1out << REP_thepool[i].getSCFName() << endl;
+	    filesnotfound++;
+	  }
+	} else {
+	  filesok++;
+	}
+      }
+      catch(Notify n){
+	cerr << "Ouch, read " << REP_thepool[i].getName() << " produced this error:\n";
+	n.handleError(THISFUNC);
+	f2out << REP_thepool[i].getSCFName() << endl;
+	filesbad++;
+	if(as_params.as_discard_read_on_eq_error) {
+	  REP_thepool[i].discard();
+	}
+      }
+    }
+  }
+  P.finishAtOnce();
+  
+  f2out.close();
+  f1out.close();
+
+  cout << "\nDone." << endl;
+  cout << filesok << " SCF files loaded ok.\n";
+  if (filesnotfound) {
+    cout << filesnotfound << " SCF files were not found (see '" << f1name << "' for a list of names).\n";
+  }
+  if (filesbad) {
+    cout << filesbad << " SCF files do not match the data in the experiment file counterpart!!!\nYou really DO want to check back why (see logfile '" << f2name << "'\nfor a list of names and the stderr on why the load failed).\n";
+    if(as_params.as_discard_read_on_eq_error) {
+      cout << "Those reads were discarded from assembly.\n";
     }else{
-      tnI=tnmap.find(getRead(rid).getTemplate());
-      if(tnI!=tnmap.end()){
-	getRead(rid).setTemplateID(tnI->second);
-	int32 firstpartner=tid_firstpartner[tnI->second];
-	if(++tidcounter[tnI->second]==2){
-	  getRead(rid).setTemplatePartnerID(firstpartner);
-	  getRead(firstpartner).setTemplatePartnerID(rid);
-
-	  // look out for unknown segments ("0"), try to fix if possible, else dump error message
-	  uint8 numunknownseg=(getRead(rid).getTemplateSegment()==0)+(getRead(firstpartner).getTemplateSegment()==0);
-	  if(numunknownseg){
-	    bool couldfix=false;
-	    if(numunknownseg==1){
-	      Read * tofix=&getRead(rid);
-	      Read * other=&getRead(firstpartner);
-	      uint8 segmenttoset=0;
-	      if(tofix->getTemplateSegment()>0) swap(tofix,other);
-	      if(other->getTemplateSegment()==1){
-		segmenttoset=255;
-	      }else if(other->getTemplateSegment()==255){
-		segmenttoset=1;
-	      }
-	      if(segmenttoset){
-		couldfix=true;
-		tofix->setTemplateSegment(segmenttoset);
-		ol_unknownsegmentfixed++;
-		if(ol_unknownsegmentfixed<200){
-		  cout << "Read " << tofix->getName() << ": fixed unrecognised template segment.\n";
-		}
-		if(++ol_unknownsegmentfixed==200){
-		  cout << "More than 200 cases like the above, will not report more.\n";
+      cout << "Reads kept in assembly, but only with default quality!\n";
+    }
+  }
+  cout << "\n\n";
+
+  FUNCEND();
+}
+
+
+
+
+/*************************************************************************
+ *
+ * if generatefilenames == true (default) tells the read object to generate
+ *  filenames according to convention. Else does not (and saves memory)
+ *  
+ * Sets for each read its type
+ *
+ * only if SequencingType=Sanger 
+ *  set filenames (regardless of generatefilenames). 
+ * Saves ~ 235M in 454 project with ~1 mio reads (= ~17% of initial memory
+ *  consumption)
+ *
+ * loadaction:
+ *   //  0 = count only
+ *   //  1 = count, adjust readpool capacity and load
+ *   //  2 = load only
+ *
+ *************************************************************************/
+size_t ReadPool::loadDataFromFASTQ(const string & filename, const uint8 loadaction, uint32 & longestread, const bool generatefilenames, const uint8 seqtype, const bool sxa_mustconvert, void (*callback)(ReadPool &))
+{
+  FUNCSTART("void ReadPool::loadDataFromFASTQ(const string & filename, const string & qualfilename, const bool generatefilenames, const uint8 seqtype, const uint8 loadaction)");
+
+  bool fatalloaderror=false;
+
+  gzFile fp;
+  kseq_t *seq;
+
+  rpDateStamp();
+
+  size_t numseqsloaded=0;
+  base_quality_t minqualseen=255;
+  {
+    fp = gzopen(filename.c_str(), "r");
+    if(fp==Z_NULL) {
+      MIRANOTIFY(Notify::FATAL,"Could not open FASTQ file '" << filename << "'. Is it present? Is it readable? Did you want to load your data in another format?");
+    }    
+    seq = kseq_init(fp);
+    
+    int l;
+    cout << "Counting sequences in FASTQ file: "; cout.flush();
+    
+    // well, count sequences and also try guessing the FASTQ quality offset
+    while ((l = kseq_read(seq)) >= 0) {
+      numseqsloaded++;
+      
+      if(seq->qual.l && minqualseen>33){
+	const char * qi = seq->qual.s;
+	for(;*qi; qi++) if(*qi<minqualseen) minqualseen=*qi;
+      }
+      longestread=max(longestread,static_cast<uint32>(seq->qual.l));
+    }
+    
+    cout << "found " << numseqsloaded << " sequences." << endl;
+
+    kseq_destroy(seq);
+    gzclose(fp);
+  }
+
+  rpDateStamp();
+
+  if(loadaction==0) return numseqsloaded;
+
+  if(loadaction==1){
+    // safety margin
+    REP_thepool.reserve(REP_thepool.size()+numseqsloaded+20);
+  }
+
+  {
+    fp = gzopen(filename.c_str(), "r");
+    seq = kseq_init(fp);
+
+    bool qualerror=false;
+    base_quality_t fqqualoffset;
+    if((*REP_miraparams)[seqtype].getAssemblyParams().as_fastq_qualoffset ==0){
+      fqqualoffset=minqualseen;
+      if(fqqualoffset != 33 && fqqualoffset<50) {
+	cout << "Unusual offset of " << static_cast<uint16>(fqqualoffset) << ", guessing this file to be a Sanger-type FASTQ format.\n";
+	fqqualoffset=33;
+      }
+      cout << "Using calculated FASTQ quality offset: " << static_cast<int16>(fqqualoffset) << '\n';
+    }else{
+      fqqualoffset=(*REP_miraparams)[seqtype].getAssemblyParams().as_fastq_qualoffset;
+      cout << "Using given FASTQ quality offset: " << static_cast<int16>(fqqualoffset) << '\n';
+    }
+    bool fqqualoffseterror=false;
+
+    // solexa 1.0 format must be converted specially, later formats not anymore
+    bool issolexa10format=false;
+    if(seqtype==Read::SEQTYPE_SOLEXA){
+      if(fqqualoffset>50 && fqqualoffset < 63) {
+	issolexa10format=true;
+	cout << "Guessing FASTQ quality values to be in Illumina/Solexa 1.0 format.\n";
+      }
+    }
+
+    vector<base_quality_t> bq;
+    bq.reserve(1000);
+    vector<int32> bq10sxaformat;
+    bq10sxaformat.reserve(1000);
+    
+    rpDateStamp();
+
+    cout << "Loading data from FASTQ file:" << endl;
+    ProgressIndicator<int32> P(0, numseqsloaded);
+
+    int l;
+    while ((l = kseq_read(seq)) >= 0) {
+      P.increaseprogress();
+      addNewEmptyRead();
+      //cout << "Name: " << (char*) name.begin() << endl;
+      
+      if(seqtype == Read::SEQTYPE_SOLEXA){
+	REP_thepool.back().disallowAdjustments();
+      }
+
+      // set read naming scheme according to default
+      if(REP_miraparams!=NULL) {
+	REP_thepool.back().setReadNamingScheme((*REP_miraparams)[seqtype].getAssemblyParams().as_readnaming_scheme);
+      }
+
+      if(generatefilenames && seqtype==Read::SEQTYPE_SANGER) {
+	REP_thepool.back().setFileNamesFromFASTAName(seq->name.s);
+      }else{
+	REP_thepool.back().setName(seq->name.s);
+      }
+
+      if(REP_thepool.back().getName().empty()){
+	cout << "Ouch, there's a read without a name? This is illegal. The sequence\n  " 
+	     << seq->seq.s 
+	     << "\nmust have a name!\n";
+	fatalloaderror=true;
+      }
+
+      if(seq->seq.l==0){
+	REP_thepool.back().setValidData(false);
+      }else{
+	REP_thepool.back().setSequenceFromString(seq->seq.s);
+	if(seq->qual.l){
+	  if(seq->qual.l == seq->seq.l){
+	    bq.clear();
+	    const char * qi = seq->qual.s;
+	    bool noerrormsgprinted=true;
+	    for(;*qi; qi++) {
+	      if(*qi<fqqualoffset) {
+		fqqualoffseterror=true;
+		if(noerrormsgprinted){
+		  cout << REP_thepool.back().getName() 
+		       << ": some quality values in FASTQ are below the chosen FASTQ offset of "
+		       << static_cast<uint16>(fqqualoffset) << '\n';
+		  noerrormsgprinted=false;
 		}
+		bq.push_back(0);
+	      }else{
+		bq.push_back(*qi - fqqualoffset);
 	      }
 	    }
-	    if(!couldfix){
-	      if(ol_unknownsegment<200){
-		++outlines_fatal;
-		if(getRead(rid).getTemplateSegment()==0){
-		  cout << "DNA template " << tnI->first << ", read " << getRead(rid).getName() << ": template segment not recognised.\n";
-		}
-		if(getRead(firstpartner).getTemplateSegment()==0){
-		  cout << "DNA template " << tnI->first << ", read " << getRead(firstpartner).getName() << ": template segment not recognised.\n";
-		}
-		if(++ol_unknownsegment==200){
-		  cout << "More than 200 cases like the above, will not report more.\n";
-		}
+	    if(issolexa10format){
+	      bq10sxaformat.clear();
+	      for(uint32 i=0;i<bq.size();i++){
+		bq10sxaformat.push_back(static_cast<int32>(bq[i]));
+		solexaScoreToQual(bq10sxaformat,bq);
 	      }
 	    }
+	    REP_thepool.back().setQualities(bq);
+	  }else{
+	    cout << REP_thepool.back().getName() 
+		 << ": different number of quality values than bases?\n";
+	    qualerror=true;
+	  }
+	}
+	if(generatefilenames 
+	   && seqtype==Read::SEQTYPE_SANGER 
+	   && REP_miraparams!=NULL) {
+	  if((*REP_miraparams)[0].getDirectoryParams().dir_exp.size()!=0 ||
+	     (*REP_miraparams)[0].getDirectoryParams().dir_scf.size()!=0 ) {
+	    REP_thepool.back().setDirectories((*REP_miraparams)[0].getDirectoryParams().dir_exp,
+					      (*REP_miraparams)[0].getDirectoryParams().dir_scf
+	      );
 	  }
+	}
+      }
 
-	  // the folowing is almost impossible when reading FASTA/FASTQ and other simple files,
-	  //  but it may happen in CAF/MAF (and maybe SAM?)
-	  if(getRead(rid).getTemplateSegment()==getRead(firstpartner).getTemplateSegment()){
-	    if(ol_samesegment<200){
-	      ++outlines_fatal;
-	      cout << "Reads " << getRead(rid).getName() << " and " << getRead(firstpartner).getName() << " have the same template segments.\n";
-	      if(++ol_samesegment==200){
-		cout << "More than 200 cases like the above, will not report more.\n";
-	      }
-	    }
+      REP_thepool.back().setSequencingType(seqtype);
+
+      if(REP_miraparams!=NULL) {
+	// Set standard insert size if not given otherwise
+	// TODO: adapt to different read types
+	if(REP_thepool.back().getInsizeFrom() == -1
+	   && REP_thepool.back().getInsizeTo() == -1){
+	  REP_thepool.back().setInsize(
+	    (*REP_miraparams)[seqtype].getContigParams().con_insertsize_minimum,
+	    (*REP_miraparams)[seqtype].getContigParams().con_insertsize_maximum);
+	}
+
+	REP_thepool.back().setTemplateBuildDirection(
+	  (*REP_miraparams)[seqtype].getContigParams().con_template_build_direction);
+      }
+
+      if(callback!=NULL) {
+	(*callback)(*this);
+      }
+    }
+    P.finishAtOnce();
+    cout << "\n";
+
+    kseq_destroy(seq);
+    gzclose(fp);
+
+    if(qualerror){
+      MIRANOTIFY(Notify::FATAL,"Unrecoverable error while loading data from FASTQ. Fix your input please.");
+    }
+    if(fqqualoffseterror){
+      MIRANOTIFY(Notify::FATAL,"You might want to set the FASTQ offset for this technology to a lower value (-LR:fqqo=...).");
+    }
+  }
+
+  cout << "\nDone.\n";
+  
+  cout << "Loaded " << numseqsloaded << " reads, " ;
+  //cout << num_reads_qual_ok << " of which have quality accounted for.\n";
+
+  rpDateStamp();
+
+  if(fatalloaderror) {
+    MIRANOTIFY(Notify::FATAL, "Fatal error encountered during load of data (see log), aborting.\n") ;
+  }
+
+  FUNCEND();
+
+  return numseqsloaded;
+}
+
+
+/*************************************************************************
+ *
+ * if generatefilenames == true (default) tells the read object to generate
+ *  filenames according to convention. Else does not (and saves memory)
+ *  
+ * Sets for each read its type
+ *
+ * only if SequencingType=Sanger 
+ *  set filenames (regardless of generatefilenames). 
+ * Saves ~ 235M in 454 project with ~1 mio reads (= ~17% of initial memory
+ *  consumption)
+ *
+ * loadaction:
+ *   //  0 = count only
+ *   //  1 = count, adjust readpool capacity and load
+ *   //  2 = load only
+ *
+ *************************************************************************/
+size_t ReadPool::loadDataFromFASTA(const string & filename, const uint8 loadaction, uint32 & longestread, const bool wantsqualfiletoexist, const string & qualfilename, const bool generatefilenames, const uint8 seqtype, const bool sxa_mustconvert, void (*callback)(ReadPool &))
+{
+  FUNCSTART("size_t ReadPool::loadDataFromFASTA(const string & filename, const uint8 loadaction, uint32 & longestread, const bool wantsqualfiletoexist, const string & qualfilename, const bool generatefilenames, const uint8 seqtype, const bool sxa_mustconvert)");
+
+  ifstream fin;
+
+  bool callcallbackforeachread=true;
+  bool hasqualfile=false;
+  if(qualfilename.size()!=0){
+    fin.open(qualfilename.c_str(), ios::in|ios::ate);
+    if(!fin){
+      cout << "Could not find FASTA quality file " << qualfilename.c_str();
+      if(wantsqualfiletoexist){
+	cout << ", aborting. If you want to work without qualities, use -LR:wqf=no\n";
+	MIRANOTIFY(Notify::FATAL, "File not found: " << qualfilename);
+      }else{
+	cout << ", using default values for these reads.\n";
+      }
+    }else{
+      hasqualfile=true;
+      callcallbackforeachread=false;
+    }
+    if(!fin.tellg() && wantsqualfiletoexist){
+      MIRANOTIFY(Notify::FATAL, "FASTA quality file " << qualfilename << " has zero length? Seems fishy.");
+    }
+    fin.close();
+    fin.clear();
+  }else{
+    if(wantsqualfiletoexist){
+      MIRANOTIFY(Notify::FATAL, "FASTA quality file expected to exist, but no quality filename given???");
+    }
+  }
+
+  fin.open(filename.c_str(), ios::in|ios::ate);
+  if(!fin){
+    MIRANOTIFY(Notify::FATAL, "File not found: " << filename);
+  }
+  if(!fin.tellg()){
+    MIRANOTIFY(Notify::FATAL, "Zero length file: "  << filename);
+  }
+
+  bool fatalloaderror=false;
+
+  // these two are for the automatic conversion of Solexa base scores
+  //  to quality values
+  bool sxa_foundnegativevalue=false;
+
+  streamsize fsize=fin.tellg();
+
+  uint32 formerpoolsize=REP_thepool.size();
+
+  // qualset looks whether the loaded fastas had quality values
+  vector<bool> qualset;    
+  if(!REP_thepool.empty()) qualset.resize(REP_thepool.size(),true);
+
+  rpDateStamp();
+
+  size_t numseqsloaded=0;
+  size_t numbasesloaded=0;
+  if(loadaction<2){
+    cout << "Counting sequences in FASTA file:\n";
+
+    bool noerrormsgprinted=true;
+
+    fin.seekg(0, ios::beg);
+    ProgressIndicator<streamsize> P(0, fsize,1000);
+    FASTA thefasta;
+    while(1){
+      thefasta.loadNextSeq(fin);
+      if(P.delaytrigger()) P.progress(fin.tellg());
+      if(thefasta.testIfEmpty()) {
+	break;
+      }
+      longestread=max(longestread,static_cast<uint32>(thefasta.getSequence().size()));
+      if(thefasta.getSeqName().empty()){
+	cout << "Ouch, there's a read without a name? This is illegal. The sequence\n  " 
+	     << thefasta.getSequence()
+	     << "\nmust have a name! It's read number " << numseqsloaded+1 << endl;
+	noerrormsgprinted=false;
+      }
+
+      numseqsloaded++;
+    }
+    P.finishAtOnce();
+    cout << "\nFound " << numseqsloaded << " sequences." << endl;
+
+    if(!noerrormsgprinted){
+      MIRANOTIFY(Notify::FATAL, "Fatal error encountered during load of data (see log), aborting.\n") ;
+    }
+  }
+
+  rpDateStamp();
+  if(loadaction==0) return numseqsloaded;
+
+  if(loadaction==1){
+    // safety margin
+    REP_thepool.reserve(REP_thepool.size()+numseqsloaded+20);
+  }
+
+  numseqsloaded=0;
+  {
+    cout << "Loading data from FASTA file:\n";
+    fin.clear();
+    fin.seekg(0, ios::beg);
+    ProgressIndicator<streamsize> P(0, fsize-1,1000);
+    FASTA thefasta;
+    while(1){
+      thefasta.loadNextSeq(fin);
+      if(P.delaytrigger()) P.progress(fin.tellg());
+      if(thefasta.testIfEmpty()) {
+	// no more sequences.
+	break;
+      }
+      ++numseqsloaded;
+      addNewEmptyRead();
+      //cout << "Name: " << (char*) name.begin() << endl;
+      
+      if(seqtype == Read::SEQTYPE_SOLEXA){
+	REP_thepool.back().disallowAdjustments();
+      }
+
+      // set read naming scheme according to default
+      if(REP_miraparams!=NULL) {
+	REP_thepool.back().setReadNamingScheme((*REP_miraparams)[seqtype].getAssemblyParams().as_readnaming_scheme);
+      }
+
+      if(generatefilenames && seqtype==Read::SEQTYPE_SANGER) {
+	REP_thepool.back().setFileNamesFromFASTAName(thefasta.getSeqName());
+      }else{
+	REP_thepool.back().setName(thefasta.getSeqName());
+      }
+
+      if(thefasta.getSequence().empty()){
+	REP_thepool.back().setValidData(false);
+	cout << "\nWarning: " << thefasta.getSeqName() << " has no bases?! This usually points at some error in the processing of data before it arrives to MIRA.\n";
+      }else{
+	REP_thepool.back().setSequenceFromString(thefasta.getSequence());
+	numbasesloaded+=thefasta.getSequence().size();
+	if(generatefilenames 
+	   && seqtype==Read::SEQTYPE_SANGER 
+	   && REP_miraparams!=NULL) {
+	  if((*REP_miraparams)[0].getDirectoryParams().dir_exp.size()!=0 ||
+	     (*REP_miraparams)[0].getDirectoryParams().dir_scf.size()!=0 ) {
+	    REP_thepool.back().setDirectories((*REP_miraparams)[0].getDirectoryParams().dir_exp,
+					      (*REP_miraparams)[0].getDirectoryParams().dir_scf
+	      );
 	  }
+	}
+      }
 
-	}else{
-	  // Ooooops ... not good: more than two reads for this template
-	  getRead(rid).setTemplatePartnerID(-1);
-	  getRead(firstpartner).setTemplatePartnerID(-1);
-	  if(ol_gt2reads<200){
-	    ++outlines_fatal;
-	    cout << tidcounter[tnI->second] << " ";
-	    cout << "DNA template " << tnI->first << " has more than two reads, template info not used. Read at fault: " << getRead(rid).getName() << endl;
-	    if(++ol_gt2reads==200){
-	      cout << "More than 200 cases like the above, will not report more.\n";
+      REP_thepool.back().setSequencingType(seqtype);
+
+      if(REP_miraparams!=NULL) {
+	// standard quality at first, may be overwritten later in load stage
+	base_quality_t bdq=(*REP_miraparams)[seqtype].getAssemblyParams().as_basedefaultqual;
+
+	if(REP_thepool.back().hasValidData()
+	 && !(REP_thepool.back().isBackbone() || REP_thepool.back().isRail())) {
+	  REP_thepool.back().setQualities(bdq);
+	  REP_thepool.back().setQualityFlag(false);
+	}
+
+	// Set standard insert size if not given
+	if(REP_thepool.back().getInsizeFrom() == -1
+	   && REP_thepool.back().getInsizeTo() == -1){
+	  REP_thepool.back().setInsize(
+	    (*REP_miraparams)[seqtype].getContigParams().con_insertsize_minimum,
+	    (*REP_miraparams)[seqtype].getContigParams().con_insertsize_maximum);
+	}
+
+	REP_thepool.back().setTemplateBuildDirection(
+	  (*REP_miraparams)[seqtype].getContigParams().con_template_build_direction);
+      }
+
+      if(callcallbackforeachread && callback!=NULL) {
+	(*callback)(*this);
+      }
+    }
+    P.finishAtOnce();
+    cout << "\n";
+  }
+
+  fin.close();
+
+  rpDateStamp();
+
+
+  //stringhash_t M;
+  //pair<stringhash_t::const_iterator, stringhash_t::const_iterator> p;
+
+  typedef boost::unordered_map<std::string, int32> strintmap;
+  strintmap rnmap;
+  strintmap::iterator rnI;
+
+  // make a quick hash lookup of read names
+  {
+    bool haserror=false;
+    for(uint32 i=0; i<size();i++){
+      if(REP_thepool[i].hasValidData()==false) continue;
+      if(REP_thepool[i].getName().size()==0) continue;
+      rnI=rnmap.find(REP_thepool[i].getName());
+      if(rnI!=rnmap.end()){
+	//cout << "uh oh ... double?";
+	haserror=true;
+	rnI->second+=1;
+      }else{
+	rnmap[REP_thepool[i].getName()]=1;;
+      }
+    }
+
+    if(haserror){
+      for(rnI=rnmap.begin(); rnI!=rnmap.end(); ++rnI){
+	if(rnI->second > 1){
+	  cout << "Error: read name " << rnI->first << " present " << rnI->second << " times in readpool!\n";
+	}
+      }
+      MIRANOTIFY(Notify::FATAL, "Read names not unique (either in this file or together with files loaded earlier): " << filename);
+      
+    }
+
+    // now re-fill the rnmap with the read-ids
+    rnmap.clear();
+    cout << "rnm size: " << rnmap.size() << endl;
+    for(uint32 i=0; i<size();i++){
+      if(REP_thepool[i].hasValidData()==false) continue;
+      if(REP_thepool[i].getName().size()==0) continue;
+      rnmap[REP_thepool[i].getName()]=i;
+    }
+
+    //cout << "\n---\n";
+    //rnI=rnmap.begin();
+    //for(; rnI != rnmap.end(); ++rnI){
+    //  cout << "rnif" << rnI->first << "\trnis: " << rnI->second << endl;
+    //}
+    //cout << "---\n";
+  }
+
+  //dumpAsMAF(cout);
+
+  qualset.resize(REP_thepool.size(),false);
+  int32 num_reads_qual_ok=0;
+  if(hasqualfile && REP_thepool.size()) {
+    FASTA thefasta;
+
+    fin.clear();
+    fin.open(qualfilename.c_str(), ios::in|ios::ate);
+
+    if(!fin){
+      cout << "Could not find FASTA quality file " << qualfilename.c_str();
+      if(wantsqualfiletoexist){
+	cout << ", aborting. If you want to work without qualities, use -LR:wqf=no\n";
+	fatalloaderror=true;
+      }else{
+	cout << ", using default values for these reads.\n";
+      }
+    }
+    if(!fin){
+      cout << "Could not find FASTA quality file " << qualfilename.c_str() << " although I found it before loading the FASTA data???\nStrange ... please check what could have happened.\n";
+      fatalloaderror=true;
+    } else {
+      cout << "Loading quality data from FASTA quality file " << qualfilename << ":\n";
+
+      fsize=fin.tellg();
+      if(fsize==0) fsize=1;
+      fin.seekg(0, ios::beg);
+
+      ProgressIndicator<streamsize> P(0, fsize-1,1000);
+
+      while(1){
+	thefasta.loadNextINTSeq(fin,255);
+	if(P.delaytrigger()) P.progress(fin.tellg());
+	if(thefasta.testIfEmpty()) break;
+	try{
+	  rnI=rnmap.find(thefasta.getQualName());
+	  if(rnI!=rnmap.end()){
+	    //cout << "Wanna set rnif" << rnI->first << "\trnis: " << rnI->second << endl;
+	    if(seqtype==Read::SEQTYPE_SOLEXA){
+	      const vector<int32> & svalues=thefasta.getINTValues();
+	      vector<int32>::const_iterator sI=svalues.begin();
+	      bool foundnegative=false;
+	      if(!sxa_foundnegativevalue){
+		for(;sI!=svalues.end(); sI++){
+		  if(*sI<0) {
+		    foundnegative=true;
+		    sxa_foundnegativevalue=true;
+		  }
+		}
+	      }
+	      if(sxa_mustconvert){
+		vector<base_quality_t> q;
+		solexaScoreToQual(svalues,q);
+		REP_thepool[rnI->second].setQualities(q);
+	      }else{
+		if(foundnegative){
+		  cerr << "\n----------------------------\n";
+		  cerr << thefasta.getQualName() << " has negative quality values although we are supposed to load new Solexa scores (phred, >=0). Could these be old Solexa scores instead?\n";
+		  cerr << "\n----------------------------\n";
+		  MIRANOTIFY(Notify::FATAL, "Found negative values in file where only values >= 0 were expected.\n") ;
+		}
+		REP_thepool[rnI->second].setQualities(thefasta.getQualities());
+	      }
+	    }else{
+	      REP_thepool[rnI->second].setQualities(thefasta.getQualities());
 	    }
+	    qualset[rnI->second]=true;
+	    num_reads_qual_ok++;
+	  }else{
+	    // TODO: make a WARNINGS file
+	    cout << "Warning: " << thefasta.getQualName() << " has quality values, but was not present in sequence file?!\n";
 	  }
 	}
-      }else{
-	getRead(rid).setTemplateID(acttid);
+	catch(Notify n){
+	  if(n.gravity==Notify::FATAL) fatalloaderror=true;
+	  n.setGravity(Notify::WARNING);
+	  n.handleError(THISFUNC);
+	}
+      }
+      P.finishAtOnce();
+
+      cout << "\n";
+
+      //if(seqtype==Read::SEQTYPE_SOLEXA && !sxa_foundnegativevalue){
+      //	cerr << "No negative values found in FASTA quality file of Solexa data??\n";
+      //}
+    }
+  }else{
+    cout << "No FASTA quality file given, using default qualities for all reads just loaded." << endl;
+  }
 
-	tid_firstpartner[acttid]=rid;
+  rpDateStamp();
 
-	tidcounter[acttid]++;
-	tnmap[getRead(rid).getTemplate()]=acttid;
-	++acttid;
+//  if(REP_miraparams!=NULL) {
+//    base_quality_t bdq=(*REP_miraparams)[seqtype].getAssemblyParams().as_basedefaultqual;
+//    for(uint32 i=formerpoolsize; i<qualset.size(); i++){
+//      if(qualset[i]==false
+//	 && REP_thepool[i].hasValidData()
+//	 && !(REP_thepool[i].isBackbone() || REP_thepool[i].isRail())) {
+//	if(hasqualfile) cout << REP_thepool[i].getName() << " has no valid qualities, using default.\n";
+//	REP_thepool[i].setQualities(bdq);
+//	REP_thepool[i].setQualityFlag(false);
+//      }
+//    }
+//  }
+
+  if(REP_miraparams!=NULL) {
+    for(uint32 i=formerpoolsize; i<qualset.size(); i++){
+      if(qualset[i]==false
+	 && REP_thepool[i].hasValidData()
+	 && !(REP_thepool[i].isBackbone() || REP_thepool[i].isRail())) {
+	if(hasqualfile) cout << REP_thepool[i].getName() << " has no valid qualities, using default.\n";
       }
     }
   }
 
-  if(outlines_fatal>0 && nagwarn_templateproblems){
-    static string emsg="Problems found with the template data, see output log for more info. This points some serious problem either with read naming (like unrecognised read naming scheme) or broken template information, please fix your input files!\nOr switch off this warning with -NW:ctp=no (but you'll do this at own risk!)";
-    if(nagwarn_templateproblems==NWSTOP) {
-      MIRANOTIFY(Notify::FATAL,emsg);
+
+  cout << "\nDone.\n";
+  
+  cout << "Loaded " << numseqsloaded << " reads with " 
+       << numbasesloaded << " raw bases.\n"
+       << num_reads_qual_ok << " reads have quality accounted for.\n";
+
+  if(fatalloaderror) {
+    MIRANOTIFY(Notify::FATAL, "Fatal error encountered during load of data (see log), aborting.\n") ;
+  }
+
+  if(!callcallbackforeachread && callback!=NULL) {
+    (*callback)(*this);
+  }
+
+  FUNCEND();
+  return numseqsloaded;
+}
+
+
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+// TODO:
+// ugly, slow, replace with lookup table
+void ReadPool::solexaScoreToQual(const vector<int32> & s, vector<base_quality_t> & q)
+{
+  FUNCSTART("void ReadPool::solexaScoreToQual(const vector<int32> & s, vector<base_quality_t> & q)");
+
+  vector<int32>::const_iterator sI=s.begin();
+  q.clear();
+  q.reserve(s.size());
+  for(;sI!=s.end(); sI++){
+    if(*sI<-9){
+      q.push_back(0);
+    }else if(*sI<-3){
+      q.push_back(1);
+    }else if(*sI>=10){
+      q.push_back(*sI);
+    }else if(*sI>=4){
+      q.push_back(*sI+1);
     }else{
-      cout << "WARNING!\n" << emsg << endl;
+      switch(*sI){
+      case -3 : 
+      case -2 : {
+	q.push_back(2);
+	break;
+      }
+      case -1 : 
+      case 0 :  {
+	q.push_back(3);
+	break;
+      }
+      case 1 : 
+      case 2 :  {
+	q.push_back(4);
+	break;
+      }
+      case 3 :  {
+	q.push_back(5);
+	break;
+      }
+      default: {
+	MIRANOTIFY(Notify::INTERNAL, "Oooops, this branch should never be run?!");
+      }
+      }
     }
+    //cout << *sI << " == " << static_cast<uint16>(q.back()) << endl;
   }
+  FUNCEND();
+}
 
-  if(verbose){
-    cout << "Generated " << acttid << " unique DNA template ids for " << validreads << " valid reads.\n";
+
+/*************************************************************************
+ *
+ *
+ * loadaction:
+ *   //  0 = count only
+ *   //  1 = count, adjust readpool capacity and load
+ *   //  2 = load only
+ *
+ *
+ *************************************************************************/
+size_t ReadPool::loadPHD(const string & filename, const uint8 loadaction, uint32 & longestread, void (*callback)(ReadPool &))
+{
+  FUNCSTART("void ReadPool::loadDataFromPHD(const string & filename, const uint8 loadaction)");
+
+  ifstream fin;
+  fin.open(filename.c_str(), ios::in|ios::ate);
+  if(!fin){
+    MIRANOTIFY(Notify::FATAL, "File not found: " << filename);
+  }
+
+  if(!fin.tellg()){
+    MIRANOTIFY(Notify::FATAL, "Zero length file: " << filename);
+  }
+
+  std::streamoff fsize=fin.tellg();
+
+  ProgressIndicator<std::streamoff> P(0, fsize-1,100);
+  PHD thephd;
+
+
+
+  // step 1= counting
+  // 0=loading
+  // -1 away
+  size_t numseqsloaded=0;
+
+  if(loadaction==0){
+    cout << "Counting sequence data from PHD file:\n";
+    fin.seekg(0, ios::beg);
+    P.reset(0,fsize-1);
+    
+    while(1){
+      try {
+	thephd.loadNextSeq(fin);
+      }
+      catch (Notify n) {
+	if(numseqsloaded==0) {
+	  n.handleError(THISFUNC);
+	}
+      }
+      // FIXME: check: reading tellg() seems to reset the read pointer on my home system
+      if(P.delaytrigger()) P.progress(fin.tellg());
+      if(thephd.testIfEmpty()) {
+	// no more sequences.
+	break;
+      }
+      longestread=max(longestread, static_cast<uint32>(thephd.getSequence().size()));
+      numseqsloaded++;
+    }
   }
 
-  FUNCEND();
-  return acttid!=validreads;
-}
+  P.finishAtOnce();
+  cout << endl;
+
+  // ok, if we just counted, go away
+  if(loadaction==0) return numseqsloaded;
+
+  // if wanted, reserve enough space in the readpool
+  if(loadaction==1){
+    REP_thepool.reserve(REP_thepool.size()+numseqsloaded+10);
+  }
+    
+
+  // need clear() to recover from EOF in first pass
+  fin.clear();
+  fin.seekg(0, ios::beg);
+  P.reset(0,fsize-1);
+  
+  numseqsloaded=0;
+  cout << "Loading sequence data from PHD file:\n";
+  while(1){
+    try {
+      thephd.loadNextSeq(fin);
+    }
+    catch (Notify n) {
+      if(numseqsloaded==0) {
+	n.handleError(THISFUNC);
+      }
+    }
+    // FIXME: check: reading tellg() seems to reset the read pointer on my home system
+    if(P.delaytrigger()) P.progress(fin.tellg());
+    if(thephd.testIfEmpty()) {
+      // no more sequences.
+      break;
+    }
+    numseqsloaded++;
+
+    // okay, add a new read as we're in loading step
+    addNewEmptyRead();
+    //cout << "Name: " << thephd.getName() << endl;
+    REP_thepool.back().setFileNamesFromFASTAName(thephd.getName());
+    REP_thepool.back().setSequenceFromString(thephd.getSequence());
+    REP_thepool.back().setQualities(thephd.getQualities());
+    if(REP_miraparams!=NULL) {
+      if((*REP_miraparams)[0].getDirectoryParams().dir_exp.size()!=0 ||
+	 (*REP_miraparams)[0].getDirectoryParams().dir_scf.size()!=0 ) {
+	REP_thepool.back().setDirectories((*REP_miraparams)[0].getDirectoryParams().dir_exp,
+					  (*REP_miraparams)[0].getDirectoryParams().dir_scf
+	  );
+      }
+      
+      // Set standard insert size if not given
+      // TODO: adapt to different read types
+      if(REP_thepool.back().getInsizeFrom() == -1
+	 && REP_thepool.back().getInsizeTo() == -1){
+	REP_thepool.back().setInsize(
+	  (*REP_miraparams)[0].getContigParams().con_insertsize_minimum,
+	  (*REP_miraparams)[0].getContigParams().con_insertsize_maximum);
+      }
+
+    }
+    //cout << REP_thepool.back();
+
+    if(callback!=NULL) {
+      (*callback)(*this);
+    }
+  }
+
+  P.finishAtOnce();
+  cout << endl;
+  
+  fin.close();
+  
+  cout << "\nDone.\n";
+  
+  cout << "There haven been " << numseqsloaded << " reads loaded from " << filename << endl;
+  
+  FUNCEND();
+  return numseqsloaded;
+}
+
+
+
 
 
 /*************************************************************************
  *
- *
+ * GBF is one of the formats which may contain several sequences
+ *  the object already loads them completely into memory
  *
  *************************************************************************/
 
-void ReadPool::checkTemplateIDs(const string & errmsg)
+void ReadPool::loadDataFromGBF(const string & filename)
 {
-  FUNCSTART("void ReadPool::checkTemplateIDs(string & errmsg)");
-  for(uint32 ri=0;ri< REP_thepool3.size(); ++ri){
-    if(REP_thepool3.getRead(ri).getTemplatePartnerID()>=0
-       && REP_thepool3.getRead(ri).getTemplateID() != REP_thepool3.getRead(REP_thepool3.getRead(ri).getTemplatePartnerID()).getTemplateID()){
-      cout << "Ouch, template problem for read " << ri << " " << REP_thepool3.getRead(ri).getName() << ", dumping readpool for debug\n";
-      dumpAs(cout,Read::AS_TEXT,true);
-      BUGIFTHROW(true, errmsg);
+  FUNCSTART("void ReadPool::loadDataFromGBF(const string & filename)");
+
+  GBF thegbf;
+  thegbf.load(filename);
+  thegbf.transferGeneInfoToCDSInfo();
+
+  REP_thepool.reserve(REP_thepool.size()+thegbf.getNumSequences()+10);
+  for(uint32 i=0; i<thegbf.getNumSequences(); i++){
+    addNewEmptyRead();
+
+    //cout << "Read GBF " << i << endl;
+    //cout << "\tName   : " << thegbf.getSequenceName(i) << endl;
+    //cout << "\tLenseq : " << thegbf.getSequence(i).size() << endl;
+    //cout << "\tNumtags: " << thegbf.getTags(i).size() << endl;
+
+    REP_thepool.back().setFileNamesFromFASTAName(thegbf.getSequenceName(i));
+    REP_thepool.back().setSequenceFromString(thegbf.getSequence(i));
+    REP_thepool.back().setTags(thegbf.getTags(i));
+
+    if(REP_miraparams!=NULL) {
+      if((*REP_miraparams)[0].getDirectoryParams().dir_exp.size()!=0 ||
+	 (*REP_miraparams)[0].getDirectoryParams().dir_scf.size()!=0 ) {
+	REP_thepool.back().setDirectories((*REP_miraparams)[0].getDirectoryParams().dir_exp,
+					  (*REP_miraparams)[0].getDirectoryParams().dir_scf
+	  );
+      }
+
+      // Set standard insert size if not given
+      // TODO: adapt to different read types
+      if(REP_thepool.back().getInsizeFrom() == -1
+	 && REP_thepool.back().getInsizeTo() == -1){
+	REP_thepool.back().setInsize(
+	  (*REP_miraparams)[0].getContigParams().con_insertsize_minimum,
+	  (*REP_miraparams)[0].getContigParams().con_insertsize_maximum);
+      }
+
+      REP_thepool.back().setTemplateBuildDirection(
+	(*REP_miraparams)[0].getContigParams().con_template_build_direction);
     }
   }
+
+  FUNCEND();
 }
 
 /*************************************************************************
  *
- * return true if no duplicate was found
+ * GFF3 is one of the formats which may contain several sequences
+ *  the object already loads them completely into memory
  *
  *************************************************************************/
 
-bool ReadPool::checkForDuplicateReadNames(uint8 nagwarn_duplicatenames)
+void ReadPool::loadDataFromGFF3(const string & filename)
 {
-  FUNCSTART("bool ReadPool::checkForDuplicateReadNames(bool verbose)");
-
-  typedef unordered_set<std::string> strset;
-  strset rnset;
-  strset::iterator rnI;
+  FUNCSTART("void ReadPool::loadDataFromGBF(const string & filename)");
+
+  GFFParse thegff;
+  thegff.loadFile(filename);
+
+  REP_thepool.reserve(REP_thepool.size()+thegff.getNumSequences()+10);
+  for(uint32 i=0; i<thegff.getNumSequences(); i++){
+    addNewEmptyRead();
+
+    //cout << "Read GBF " << i << endl;
+    //cout << "\tName   : " << thegff.getSequenceName(i) << endl;
+    //cout << "\tLenseq : " << thegff.getSequence(i).size() << endl;
+    //cout << "\tNumtags: " << thegff.getTags(i).size() << endl;
+
+    REP_thepool.back().setFileNamesFromFASTAName(thegff.getSequenceName(i));
+    REP_thepool.back().setSequenceFromString(thegff.getSequence(i));
+    REP_thepool.back().setTags(thegff.getTags(i));
+
+    if(REP_miraparams!=NULL) {
+      if((*REP_miraparams)[0].getDirectoryParams().dir_exp.size()!=0 ||
+	 (*REP_miraparams)[0].getDirectoryParams().dir_scf.size()!=0 ) {
+	REP_thepool.back().setDirectories((*REP_miraparams)[0].getDirectoryParams().dir_exp,
+					  (*REP_miraparams)[0].getDirectoryParams().dir_scf
+	  );
+      }
 
-  bool allok=true;
-  uint32 outlines=0;
-  for(uint32 i=0; i<size();i++){
-    if(getRead(i).hasValidData()==false) continue;
-
-    rnI=rnset.find(getRead(i).getName());
-    if(rnI!=rnset.end()){
-      allok=false;
-      if(outlines<2000){
-	cout << "Read " << *rnI << " is present more than once in the data set. Did you load a file twice in the manifest? Is a read present more than once in your file(s)?\n";
-	if(++outlines==2000){
-	  cout << "More than 2000 cases like the above, will not report more. Fix your input!\n";
-	}
+      // Set standard insert size if not given
+      // TODO: adapt to different read types
+      if(REP_thepool.back().getInsizeFrom() == -1
+	 && REP_thepool.back().getInsizeTo() == -1){
+	REP_thepool.back().setInsize(
+	  (*REP_miraparams)[0].getContigParams().con_insertsize_minimum,
+	  (*REP_miraparams)[0].getContigParams().con_insertsize_maximum);
       }
-    }else{
-      rnset.insert(getRead(i).getName());
-    }
-  }
 
-  if(outlines>0 && nagwarn_duplicatenames){
-    static string emsg="Some read names were found more than once (see log above). This usually hints to a serious problem with your input and should really, really be fixed. You can choose to ignore this error with '-NW:cdrn=no', but this will almost certainly lead to problems with result files (ACE and CAF for sure, maybe also SAM) and probably to other unexpected effects.";
-    if(nagwarn_duplicatenames==NWSTOP){
-      MIRANOTIFY(Notify::FATAL,emsg);
-    }else{
-      cout << "WARNING!\n" << emsg << endl;
+      REP_thepool.back().setTemplateBuildDirection(
+	(*REP_miraparams)[0].getContigParams().con_template_build_direction);
     }
   }
 
   FUNCEND();
-  return allok;
 }
 
-
 /*************************************************************************
  *
+ * loads external strain data (should these not be provided by the EXPs)
  *
+ * the data must be in a key-value file
+ * key can be: read name, or filename of exp read or file name of caf read
+ *   (may not contain spaces, sorry)
+ * value is: s string describing the strain name (may contain spaces)
+ * line with # as first nonwhitespace character are comments and read over
  *
  *************************************************************************/
 
-void ReadPool::adaptFASTQQualValues(uint32 rpstart, uint32 rpend, base_quality_t fastqoffset, bool verbose, uint32 longestread, base_quality_t seenminqual, base_quality_t seenmaxqual)
+void ReadPool::loadStrainData(const string & sdfile)
 {
-  if(verbose) cout << "Looking at FASTQ type ... ";cout.flush();
+  FUNCSTART("void ReadPool::loadStrainData(const string & sdfile)");
 
-  base_quality_t qualcorrector=0;
-  bool needoldsxamapping=false;
+  //stringhash_t M;
 
-  bool checkqual=false;
-  if(seenminqual==255 && seenmaxqual==0) checkqual=true;
+  typedef boost::unordered_map<std::string, uint32> strintmap;
+  strintmap rnmap;
+  strintmap::iterator rnI;
+  
+  cout << "Building hash table ... "; cout.flush();
+  for(uint32 i=0; i<size();i++){
+    if(!REP_thepool[i].getName().empty()) {
+      rnmap[REP_thepool[i].getName()]=i;
+      //cout << "Inserted1: " << REP_thepool[i].getName() << endl;
+    }
+  }
+  cout << "done. Assigning strains to reads:\n";
 
-  if(checkqual || longestread==0){
-    for(size_t rpi=rpstart; rpi<rpend; ++rpi){
-      longestread=max(longestread,getRead(rpi).getLenSeq());
-      if(checkqual){
-	for(auto & qv : const_cast<vector<base_quality_t> &>(getRead(rpi).getQualities())){
-	  seenminqual=min(seenminqual,qv);
-	  seenmaxqual=max(seenmaxqual,qv);
-	}
+  ifstream fin;
+  fin.open(sdfile.c_str(), ios::in|ios::ate);
+  if(!fin){
+    MIRANOTIFY(Notify::FATAL, "File not found: " << sdfile);
+  }
+  ProgressIndicator<streamsize> P(0, fin.tellg(),5000);
+  fin.seekg(0, ios::beg);
+
+  string readname, strain;
+  uint32 numvals=0;
+  while(GeneralIO::readKeyValue(fin, readname, strain)){
+    if(P.delaytrigger()) P.progress(fin.tellg());
+    if(!strain.empty()){
+      rnI=rnmap.find(readname);
+      if(rnI!=rnmap.end()){
+	REP_thepool[rnI->second].setStrain(strain.c_str());
+	// TODO: move this output to a log file
+	//cout << readname << " has id " << rnI->second << " in readpool, setting strain to " << strain << endl;
+      }else{
+	//cout << readname << " from straindata not found in readpool.\n";
       }
     }
+    numvals++;
   }
+  fin.close();
+  P.finishAtOnce();
 
-  if(fastqoffset<33){
-    // longestread criterion catches everything non-Solexa (including 454, or contigs) as Illumina
-    //  switched to Sanger style before attaining 200bp
-    if(seenminqual<59 || seenmaxqual <= 73 || seenminqual==seenmaxqual || longestread>=200){
-      if(verbose) cout << "guessing FASTQ-33 (Sanger)\n";
-      qualcorrector=33;
-    }else if(seenminqual>=59 && seenminqual<64){
-      if(verbose) cout << "guessing FASTQ-59 (old Solexa)\n";
-      needoldsxamapping=false;
-    }else{
-      if(verbose) cout << "guessing FASTQ-64 (Illumina)\n";
-      qualcorrector=64;
+  cout << "\nRead " << numvals << " straindata lines." << endl;
+
+  uint nostrain=0;
+  for(uint32 i=0; i<size();i++){
+    if(REP_thepool[i].hasValidData()==true 
+       && REP_thepool[i].getStrain().size()==0
+       && !REP_thepool[i].isRail()
+       && !REP_thepool[i].isBackbone()){
+      ++nostrain;
     }
-  }else{
-    if(verbose) cout << "told it to be FASTQ-" << static_cast<uint16>(fastqoffset) << '\n';
-    qualcorrector=fastqoffset;
   }
 
-  if(verbose) cout << "Running quality values adaptation ... "; cout.flush();
-  if(needoldsxamapping){
-    for(size_t rpi=rpstart; rpi<rpend; ++rpi){
-      for(auto & qv : const_cast<vector<base_quality_t> &>(getRead(rpi).getQualities())){
-	qv=RP_sxa2phredmap[qv];
-      }
-    }
-  }else{
-    for(size_t rpi=rpstart; rpi<rpend; ++rpi){
-      for(auto & qv : const_cast<vector<base_quality_t> &>(getRead(rpi).getQualities())){
-	qv-=qualcorrector;
-      }
-    }
+  if(nostrain){
+    cout << "Warning: after loading data from strain data file \"" << sdfile << "\",\n"
+	 << nostrain << " reads have still no strain. Using empty strain there.\n";
+    cout << "A list of reads without strain data can be made by analysing the"
+      "\ncheckpoint file of MIRA in MAF format.\n";
   }
-  if(verbose) cout << "done." << endl;
+
+//#endif
+
+  FUNCEND();
 }
 
 
 
 
+
+
 /*************************************************************************
  *
  * loads names of reads from external file and deletes them from pool
@@ -519,54 +1721,53 @@ void ReadPool::deleteReadsByName(const string & nfile, bool invertselection)
 {
   FUNCSTART("void ReadPool::InvalidateReadsByName(const string & nfile)");
 
-  BUGIFTHROW(true,"this needs to be adapted to indirection");
+  //stringhash_t M;
+  typedef boost::unordered_map<std::string, uint32> strintmap;
+  strintmap rnmap;
+  strintmap::iterator rnI;
 
-//  //stringhash_t M;
-//  typedef unordered_map<std::string, uint32> strintmap;
-//  strintmap rnmap;
-//  strintmap::iterator rnI;
-//
-//  for(uint32 i=0; i<size();i++){
-//    if(!REP_thepool[i].getName().empty()) {
-//      rnmap[REP_thepool[i].getName()]=i;
-//    }
-//  }
-//
-//  ifstream fin;
-//  fin.open(nfile.c_str(), ios::in|ios::ate);
-//  if(!fin){
-//    MIRANOTIFY(Notify::FATAL, "File not found: " << nfile);
-//  }
-//  fin.seekg(0, ios::beg);
-//
-//  if(invertselection){
-//    for(uint32 i=0; i<size();i++){
-//      REP_thepool[i].setValidData(false);
-//    }
-//  }
-//
-//  string readname, dummy;
-//  while(GeneralIO::readKeyValue(fin, readname,dummy)){
-//    rnI=rnmap.find(readname);
-//    if(rnI!=rnmap.end()) {
-//      if(invertselection){
-//	REP_thepool[rnI->second].setValidData(true);
-//      }else{
-//	REP_thepool[rnI->second].setValidData(false);
-//      }
-//    }
-//  }
-//  fin.close();
-//
-//  if(size()){
-//    for(int32 i=size()-1; i >= 0; i--){
-//      if(!REP_thepool[i].hasValidData()){
-//	vector<Read>::iterator I=REP_thepool.begin();
-//	advance(I,i);
-//	REP_thepool.erase(I);
-//      }
-//    }
-//  }
+  for(uint32 i=0; i<size();i++){
+    if(!REP_thepool[i].getName().empty()) {
+      rnmap[REP_thepool[i].getName()]=i;
+    }
+  }
+
+  ifstream fin;
+  fin.open(nfile.c_str(), ios::in|ios::ate);
+  if(!fin){
+    MIRANOTIFY(Notify::FATAL, "File not found: " << nfile);
+  }
+  fin.seekg(0, ios::beg);
+
+  if(invertselection){
+    for(uint32 i=0; i<size();i++){
+      REP_thepool[i].setValidData(false);
+    }
+  }
+
+  string readname, dummy;
+  uint32 numvals=0;
+  while(GeneralIO::readKeyValue(fin, readname,dummy)){
+    rnI=rnmap.find(readname);
+    if(rnI!=rnmap.end()) {
+      if(invertselection){
+	REP_thepool[rnI->second].setValidData(true);
+      }else{
+	REP_thepool[rnI->second].setValidData(false);
+      }
+    }
+  }
+  fin.close();
+
+  if(size()){
+    for(int32 i=size()-1; i >= 0; i--){
+      if(!REP_thepool[i].hasValidData()){
+	vector<Read>::iterator I=REP_thepool.begin();
+	advance(I,i);
+	REP_thepool.erase(I);
+      }
+    }
+  }
 
   FUNCEND();
 }
@@ -580,7 +1781,7 @@ void ReadPool::deleteReadsByName(const string & nfile, bool invertselection)
  *
  *
  *************************************************************************/
-void ReadPool::mergeXMLTraceInfo(const string & xmlfile, uint8 nagwarn_templateproblems)
+void ReadPool::mergeXMLTraceInfo(const string & xmlfile)
 {
   FUNCSTART("void ReadPool::mergeXMLTraceInfo(const string & filename)");
 
@@ -618,15 +1819,15 @@ void ReadPool::mergeXMLTraceInfo(const string & xmlfile, uint8 nagwarn_templatep
 
   cout << "Num reads: " << traces.size() << endl;
 
-  typedef unordered_map<std::string, int32> strintmap;
+  typedef boost::unordered_map<std::string, int32> strintmap;
   strintmap rnmap;
   strintmap::iterator rnI;
 
   cout << "Building hash table ... "; cout.flush();
 
   for(uint32 i=0; i<size();i++){
-    if(!getRead(i).getName().empty()) {
-      rnmap[getRead(i).getName()]=i;
+    if(!REP_thepool[i].getName().empty()) {
+      rnmap[REP_thepool[i].getName()]=i;
     }
   }
   cout << "done." << endl;
@@ -660,20 +1861,20 @@ void ReadPool::mergeXMLTraceInfo(const string & xmlfile, uint8 nagwarn_templatep
 	}
       }
     }
-
+    
     if(found){
       int32 idoffound=rnI->second;
-      // cout << "Found " << REP_thepool[idoffound].getName() << endl;
+      // cout << "Found " << REP_thepool[idoffound].getName() << endl; 
       // Read::setCoutType(Read::AS_TEXTCLIPS);
       // cout << REP_thepool[idoffound];
-
+      
       int32 insertsize=-1;
       int32 insertstdev=-1;
       //int32 inssizemin=-1;
       //int32 inssizemax=-1;
-
-      uint8 seqtype=ReadGroupLib::SEQTYPE_SANGER;
-
+      
+      uint8 seqtype=Read::SEQTYPE_SANGER;
+      
       E=T->elements.begin();
       ECD=T->elements_cdata.begin();
       for(;E!=T->elements.end(); E++, ECD++) {
@@ -681,41 +1882,73 @@ void ReadPool::mergeXMLTraceInfo(const string & xmlfile, uint8 nagwarn_templatep
 	case NCBIInfoXML::NCBIXML_TRACE_NAME : {
 	  break;
 	}
+	case NCBIInfoXML::NCBIXML_TRACE_FILE : {
+	  //if(!REP_thepool[idoffound].hasSCFData()) {
+	  //set only when first load attempt failed?
+	  
+	  string path, filename;
+	  splitFullPathAndFileName(*ECD, path, filename);
+	  REP_thepool[idoffound].setSCFFileName(filename);
+	  //REP_thepool[idoffound].setSCFDirectory(path);
+	  //}
+	  break;
+	}
+	case NCBIInfoXML::NCBIXML_TRACE_TYPE_CODE : {
+	  if(*ECD == id454){
+	    seqtype=Read::SEQTYPE_454GS20;
+	  }
+	  break;
+	}
 	case NCBIInfoXML::NCBIXML_CLIP_QUALITY_LEFT  : {
-	  getRead(idoffound).setLQClipoff(atoi(ECD->c_str()));
+	  REP_thepool[idoffound].setLQClipoff(atoi(ECD->c_str()));
 	  break;
 	}
 	case NCBIInfoXML::NCBIXML_CLIP_QUALITY_RIGHT  : {
-	  getRead(idoffound).setRQClipoff(atoi(ECD->c_str()));
+	  REP_thepool[idoffound].setRQClipoff(atoi(ECD->c_str()));
 	  break;
 	}
 	case NCBIInfoXML::NCBIXML_CLIP_VECTOR_LEFT  : {
-	  getRead(idoffound).setLSClipoff(atoi(ECD->c_str()));
+	  REP_thepool[idoffound].setLSClipoff(atoi(ECD->c_str()));
 	  break;
 	}
 	case NCBIInfoXML::NCBIXML_CLIP_VECTOR_RIGHT  : {
-	  getRead(idoffound).setRSClipoff(atoi(ECD->c_str()));
+	  REP_thepool[idoffound].setRSClipoff(atoi(ECD->c_str()));
 	  break;
 	}
+	case NCBIInfoXML::NCBIXML_INSERT_SIZE  : {
+	  insertsize=atoi(ECD->c_str());
+	  break;
+	}
+	case NCBIInfoXML::NCBIXML_INSERT_STDEV  : {
+	  insertstdev=atoi(ECD->c_str());
+	  break;
+	}
+//	case NCBIInfoXML::NCBIXML_INSERT_SIZE_MIN  : {
+//	  inssizemin=atoi(ECD->c_str());
+//	  if(inssizemax<0) inssizemax=inssizemin;
+//	  break;
+//	}
+//	case NCBIInfoXML::NCBIXML_INSERT_SIZE_MAX  : {
+//	  inssizemax=atoi(ECD->c_str());
+//	  if(inssizemin<0) inssizemin=inssizemax;
+//	  break;
+//	}
 	case NCBIInfoXML::NCBIXML_TEMPLATE_ID  : {
-	  getRead(idoffound).setTemplate(ECD->c_str());
+	  REP_thepool[idoffound].setTemplate(ECD->c_str());
 	  //cout<< *ECD << endl;
 	  break;
 	}
 	case NCBIInfoXML::NCBIXML_TRACE_END  : {
 	  if(strlen(ECD->c_str())>0){
 	    switch(toupper(ECD->c_str()[0])){
-	    case 'F': {
-	      getRead(idoffound).setTemplateSegment(1);
-	      break;
-	    }
+	    case 'F': // fall through
 	    case 'R': {
-	      getRead(idoffound).setTemplateSegment(255);
+	      REP_thepool[idoffound].setTemplateEnd(toupper(ECD->c_str()[0]));
 	      break;
 	    }
 	    case 'U' : // fall through
 	    case 'N' : {
-	      getRead(idoffound).setTemplateSegment(0);
+	      REP_thepool[idoffound].setTemplateEnd('N');
 	      break;
 	    }
 	    default : {
@@ -725,18 +1958,65 @@ void ReadPool::mergeXMLTraceInfo(const string & xmlfile, uint8 nagwarn_templatep
 	  }
 	  break;
 	}
+	case NCBIInfoXML::NCBIXML_MACHINE_TYPE  : {
+	  REP_thepool[idoffound].setMachineType(ECD->c_str());
+	  //cout<< *ECD << endl;
+	  //cout << REP_thepool[idoffound];
+	  //abort();
+	  break;
+	}
+	case NCBIInfoXML::NCBIXML_PROGRAM_ID  : {
+	  REP_thepool[idoffound].setBasecaller(ECD->c_str());
+	  //cout<< *ECD << endl;
+	  break;
+	}
+	case NCBIInfoXML::NCBIXML_STRAIN  : {
+	  REP_thepool[idoffound].setStrain(ECD->c_str());
+	  //cout<< *ECD << endl;
+	  break;
+	}
+	case NCBIInfoXML::NCBIXML_BASE_FILE  :
+	case NCBIInfoXML::NCBIXML_QUAL_FILE  : {
+	  break;
+	}
 	default : {
 	  // Ooooops?
 	}
 	}
       }
       // cout << "After:\n";
-      // cout << getRead(idoffound);
-
+      // cout << REP_thepool[idoffound];
+      
+      if(insertsize>0 || insertstdev>0) {
+	if(insertsize<0) {
+	  cout << "Read " << REP_thepool[idoffound].getName() << ": there is 'INSERT_STDEV' but no 'INSERT_SIZE' in the XML? This is suspicious ...\n";
+	  insertsize=0;
+	}
+	if(insertstdev<0) {
+	  cout << "Read " << REP_thepool[idoffound].getName() << ": there is 'INSERT_SIZE' but no 'INSERT_STDEV' in the XML? This is suspicious ...\n";
+	  insertstdev=0;
+	}
+	int32 diff=insertstdev*3;  // "standard" used by most people
+	int32 min=insertsize-diff;
+	if(min<0)min=0;
+	REP_thepool[idoffound].setInsize(min,
+					 insertsize+diff);
+	//cout << REP_thepool[idoffound].getName() << ": " << min << "\t" << insertsize+diff << endl;
+      }
+      if(seqtype==Read::SEQTYPE_454GS20){
+	REP_thepool[idoffound].setSequencingType(seqtype);
+      }
+      
+      if(seqtype == Read::SEQTYPE_SOLEXA){
+	MIRANOTIFY(Notify::INTERNAL, "Type Solexa needs more support 6.");
+      }
+      if(seqtype == Read::SEQTYPE_ABISOLID){
+	MIRANOTIFY(Notify::INTERNAL, "Type ABI SOLiD needs more support 6.");
+      }
     }
   }
 
-  makeTemplateIDs(nagwarn_templateproblems);
+  makeTemplateIDs();
 
   cout << "Done merging XML data, matched " << numfound << " reads." << endl;
 
@@ -747,263 +2027,55 @@ void ReadPool::mergeXMLTraceInfo(const string & xmlfile, uint8 nagwarn_templatep
 }
 
 
+
+
+
 /*************************************************************************
  *
- * ugly and slow, but works and is fast enough
+ *
  *
  *
  *************************************************************************/
-//#define CEBUG(bla)   {cout << bla; cout.flush(); }
-void ReadPool::mergeSSAHA2SMALTVecScreenData(const string & ssahafile, bool issmalt, vector<MIRAParameters> & miraparams, const string & logname, const string & logprefix)
+Read & ReadPool::addNewEmptyRead()
 {
-  FUNCSTART("void ReadPool::mergeSSAHA2VecScreenData(const string & ssahafile, bool issmalt, vector<MIRAParameters> & miraparams, const string & logname, const string & logprefix)");
-
-  cout << "Merging vector screen data from ";
-  if(issmalt){
-    cout << "SMALT";
-  }else{
-    cout << "SSAHA2";
-  }
-  cout << " results file " << ssahafile << ":\n";
-
-  CEBUG("Building hash table ... "); cout.flush();
-
-  typedef unordered_map<std::string, int32> strmap;
-  strmap rnmap;
-  strmap::iterator rnI;
-
-  for(uint32 rpi=0; rpi<size();++rpi){
-    if(!getRead(rpi).getName().empty()) {
-      rnmap[getRead(rpi).getName()]=rpi;
-    }
-  }
-  CEBUG("done." << endl);
-
-  ofstream logfout;
-  if(!logname.empty()){
-    logfout.open(logname.c_str(), ios::out|ios::app);
-    if(!logfout){
-      MIRANOTIFY(Notify::FATAL, "Could not open log for appending: " << logname << "\nPossible causes: Disk full? Changed permissions? Directory deleted?");
-    }
-  }
+  FUNCSTART("Read & ReadPool::addNewEmptyRead()");
 
-  ifstream ssahafin;
-  ssahafin.open(ssahafile.c_str(), ios::in|ios::ate);
-  if(!ssahafin){
-    MIRANOTIFY(Notify::FATAL, "File not found: " << ssahafile);
-  }
-  streampos sfinsize=ssahafin.tellg();
-  ssahafin.seekg(0, ios::beg);
-
-  ProgressIndicator<streamsize> P (0, sfinsize,1000);
-
-  uint32 sd_score;
-  string sd_readname;
-  string sd_vecname;
-  uint32 sd_rfrom;
-  uint32 sd_rto;
-  uint32 sd_vfrom;
-  uint32 sd_vto;
-  string sd_dir;
-  uint32 sd_totalmatchsize;
-  float  sd_percentmatch;
-  uint32 sd_rlen;
-
-  string token;
-  string alstring;
-  if(issmalt){
-    alstring="alignment:";
-  }else{
-    alstring="ALIGNMENT:";
-  }
-
-  bool haserrors=false;
-
-  while(!ssahafin.eof()){
-    ssahafin >> token;
-    if(ssahafin.eof()) break;
-    if(P.delaytrigger()) P.progress(ssahafin.tellg());
-    if(token.compare(0,alstring.size(),alstring) != 0) {
-      getline(ssahafin,token);
-      continue;
-    }
-    ssahafin >> sd_score >> sd_readname;
-
-    if(ssahafin.eof()) break;
-
-    // *sigh* allow for empty names
-    sd_vecname.clear();
-    {
-      bool loopit=true;
-      char tmp;
-
-      ssahafin.get(tmp);
-      loopit=true;
-      do{
-	ssahafin.get(tmp);
-	if(ssahafin.eof()) break;
-	if(tmp==' ' || tmp=='\t'){
-	  loopit=false;
-	}else{
-	  sd_vecname.push_back(tmp);
-	}
-      }while(loopit);
-    }
+  REP_thepool.resize(REP_thepool.size()+1);
+//  REP_thepool.back().setInsize(
+//    (*REP_miraparams)[0].getContigParams().con_insertsize_minimum,
+//    (*REP_miraparams)[0].getContigParams().con_insertsize_maximum);
+//  REP_thepool.back().setReadNamingScheme(
+//    (*REP_miraparams)[0].getAssemblyParams().as_readnaming_scheme);
+//  REP_thepool.back().setQualities(
+//    (*REP_miraparams)[0].getAssemblyParams().as_basedefaultqual);
 
-    if(ssahafin.eof()) break;
-
-    ssahafin >> sd_rfrom
-	     >> sd_rto
-	     >> sd_vfrom
-	     >> sd_vto
-	     >> sd_dir
-	     >> sd_totalmatchsize
-	     >> sd_percentmatch
-	     >> sd_rlen;
-
-    if(ssahafin.eof()) break;
-
-    CEBUG(sd_readname << '\t' << sd_rfrom << '\t' << sd_rto << '\n');
+  FUNCEND();
+  return REP_thepool.back();
 
-    bool foundname=false;
-    rnI=rnmap.find(sd_readname);
-    if(rnI==rnmap.end()) {
-      CEBUG("Not found: " << sd_readname << endl);
-      continue;
-    }
-    uint32 foundreadid=rnI->second;
-    if(!getRead(foundreadid).hasValidData()) continue;
-
-    Read actread(getRead(foundreadid));
-    assembly_parameters const & as_params= miraparams[actread.getSequencingType()].getAssemblyParams();
-
-    if(actread.getLenSeq() != sd_rlen){
-      if(actread.isSequencingType(ReadGroupLib::SEQTYPE_SOLEXA) && actread.getLenSeq() != sd_rlen+1) {
-	cout << "\nError! The length of read " << actread.getName()
-	     << " (" << actread.getLenSeq()
-	     << ") does not match the length given in the SSAHA2/SMALT file ("
-	     << sd_rlen << ")\nSSAHA2 line:"
-	     << ' ' << token
-	     << ' ' << sd_score
-	     << ' ' << sd_readname
-	     << ' ' << sd_vecname
-	     << ' ' << sd_rfrom
-	     << ' ' << sd_rto
-	     << ' ' << sd_vfrom
-	     << ' ' << sd_vto
-	     << ' ' << sd_dir
-	     << ' ' << sd_totalmatchsize
-	     << ' ' << sd_percentmatch
-	     << ' ' << sd_rlen << endl;
-	haserrors=true;
-      }
-    }
+}
 
-    CEBUG("SSAHA2/SMALT line:"
-	  << ' ' << token
-	  << ' ' << sd_score
-	  << " r: " << sd_readname
-	  << " v: " << sd_vecname
-	  << " # " << sd_rfrom
-	  << ' ' << sd_rto
-	  << ' ' << sd_vfrom
-	  << ' ' << sd_vto
-	  << ' ' << sd_dir
-	  << ' ' << sd_totalmatchsize
-	  << ' ' << sd_percentmatch
-	  << ' ' << sd_rlen << endl);
-
-    //Read::setCoutType(Read::AS_FASTA);
-    //CEBUG(actread);
-    //Read::setCoutType(Read::AS_CLIPPEDFASTA);
-    //CEBUG(actread);
-
-    // in SSAHA2 output, from rfrom may be > rto for reverse matches
-    // swap in these cases
-    if(sd_rfrom > sd_rto) swap(sd_rfrom,sd_rto);
-
-    for(uint32 i=sd_rfrom-1; i<sd_rto; i++){
-      bool domask=false;
-      if(as_params.as_clip_ssahamerge_strictfrontclip >0
-	 || as_params.as_clip_ssahamerge_strictendclip >0){
-	if(as_params.as_clip_ssahamerge_strictfrontclip >0
-	   && static_cast<int32>(i)<as_params.as_clip_ssahamerge_strictfrontclip) domask=true;
-	if(as_params.as_clip_ssahamerge_strictendclip>0
-	   && i>=actread.getLenSeq()-as_params.as_clip_ssahamerge_strictendclip) domask=true;
-      }else{
-	domask=true;
-      }
-      if(domask) actread.changeBaseInSequence('X',0,i);
-    }
-    //Read::setCoutType(Read::AS_FASTA);
-    //CEBUG(actread);
-    //Read::setCoutType(Read::AS_CLIPPEDFASTA);
-    //CEBUG(actread);
-
-    actread.setClipoffsToMaskedChars(as_params.as_clip_ssahamerge_gapsize,
-				     as_params.as_clip_ssahamerge_maxfrontgap,
-				     as_params.as_clip_ssahamerge_maxendgap,
-				     false);
-    //Read::setCoutType(Read::AS_CLIPPEDFASTA);
-    //CEBUG(actread);
-
-    if(actread.getLMClipoff() > getRead(foundreadid).getLSClipoff()){
-      getRead(foundreadid).setLSClipoff(actread.getLMClipoff());
-      CEBUG("clippyl\n");
-      if(!logname.empty()){
-	logfout << logprefix << " SSAHA2/SMALT clip left "
-		<< actread.getName()
-		<< " to: "
-		<< getRead(foundreadid).getLSClipoff() << '\n';
-      }
-    }else{
-      if(!logname.empty()){
-	logfout << logprefix << "unchanged SSAHA2/SMALT clip left "
-		<< actread.getName()
-		<< " stays: "
-		<< getRead(foundreadid).getLSClipoff() << '\n';
-      }
-    }
-    if(actread.getRMClipoff() < getRead(foundreadid).getRSClipoff()){
-      getRead(foundreadid).setRSClipoff(actread.getRMClipoff());
-      CEBUG("clippyr\n");
-      if(!logname.empty()){
-	logfout << logprefix << " SSAHA2/SMALT clip right "
-		<< actread.getName()
-		<< " to: "
-		<< getRead(foundreadid).getRSClipoff() << '\n';
-      }
-    }else{
-      if(!logname.empty()){
-	logfout << logprefix << "unchanged SSAHA2/SMALT clip right "
-		<< actread.getName()
-		<< " stays: "
-		<< getRead(foundreadid).getRSClipoff() << '\n';
-      }
-    }
 
-    //Read::setCoutType(Read::AS_TEXTSHORT);
-    //CEBUG(getRead(foundreadid));
-  }
-  P.finishAtOnce();
 
-  ssahafin.close();
 
-  if(!logname.empty()){
-    logfout.close();
-  }
 
-  cout << "\nDone merging SSAHA2 vector screen data." << endl;
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+Read & ReadPool::getRead(uint32 index)
+{
+  FUNCSTART("Read & ReadPool::getRead(uint32 index)");
 
-  if(haserrors){
-    MIRANOTIFY(Notify::FATAL,"There were errors in the SSAHA2 data, most probably the sequences used to screen are different from\nthe ones loaded now (see log above). Sorry, MIRA has to abort, please check your data.");
+  if(index >= REP_thepool.size()){
+    MIRANOTIFY(Notify::INTERNAL, "error: index (" << index << ") >= REP_thepool.size() (" << REP_thepool.size() << ") ?");
   }
 
   FUNCEND();
-  return;
-}
-//#define CEBUG(bla)
 
+  return REP_thepool[index];
+}
 
 
 
@@ -1016,92 +2088,91 @@ void ReadPool::mergeSSAHA2SMALTVecScreenData(const string & ssahafile, bool issm
  *************************************************************************/
 Read & ReadPool::getRead(const string & name)
 {
-  return getRead(getReadIndex(name));
+  return REP_thepool[getReadIndex(name)];
 }
 
 
 
-
-
 /*************************************************************************
  *
  *
  *
  *
  *************************************************************************/
-void ReadPool::dumpAs(ostream & ostr, uint8 astype, bool alsoinvalids) const
+int32 ReadPool::getReadIndex(const string & name) const
 {
-  FUNCSTART("void ReadPool::dumpAs(ostream & ostr, uint8 astype, bool alsoinvalids) const)");
+  FUNCSTART("Read & ReadPool::getRead(const string & name)");
 
-  if(astype==Read::AS_MAF){
-    for(uint32 rgi=1; rgi<ReadGroupLib::getNumReadGroups(); ++rgi){
-      // use dumpReadGroupAsMAF() instead saveReadGroupAsMAF!
-      ReadGroupLib::dumpReadGroupAsMAF(rgi,ostr);
-    }
+  if(name.empty()){
+    MIRANOTIFY(Notify::INTERNAL, "tried to search empty name") ;
   }
-  Read::setCoutType(astype);
 
-  for(uint32 i=0; i<REP_thepool3.size(); ++i){
-    try{
-      if(getRead(i).hasValidData() || alsoinvalids) ostr << getRead(i);
-    }
-    catch(Notify n){
-      cout << "Ouch, ouch, ouch, ouch ... ouch. Error while output of read " << i << ", " << getRead(i).getName() << endl;
-      n.handleError(THISFUNC);
-    }
+  vector<Read>::const_iterator I=REP_thepool.begin();
+
+  int32 i=0;
+  while(I!=REP_thepool.end()){
+    if(name==I->getName()) break;
+    I++; i++;
+  }
+
+  if(I==REP_thepool.end()){
+    MIRANOTIFY(Notify::WARNING,"Could not find read " << name << " in readpool.");
   }
 
   FUNCEND();
-}
 
+  return i;
+}
 
 /*************************************************************************
  *
- * like above, but using save()
- * This is for miraconvert
+ *
+ *
  *
  *************************************************************************/
-void ReadPool::saveAsMAF(ostream & ostr, bool alsoinvalids) const
+int32 ReadPool::getReadIndex(const char * name) const
 {
-  FUNCSTART("void ReadPool::dumpAs(ostream & ostr, uint8 astype, bool alsoinvalids) const)");
+  FUNCSTART("Read & ReadPool::getRead(const char * name)");
 
-  for(uint32 rgi=1; rgi<ReadGroupLib::getNumReadGroups(); ++rgi){
-    ReadGroupLib::saveReadGroupAsMAF(rgi,ostr);
+  if(name==NULL && *name==0) {
+    MIRANOTIFY(Notify::INTERNAL, "tried to search empty name") ;
   }
 
-  Read::setCoutType(Read::AS_MAF);
-  for(uint32 i=0; i<REP_thepool3.size(); ++i){
-    try{
-      if(getRead(i).hasValidData() || alsoinvalids) ostr << getRead(i);
-    }
-    catch(Notify n){
-      cout << "Ouch, ouch, ouch, ouch ... ouch. Error while output of read " << i << ", " << getRead(i).getName() << endl;
-      n.handleError(THISFUNC);
-    }
+  vector<Read>::const_iterator I=REP_thepool.begin();
+
+  int32 i=0;
+  while(I!=REP_thepool.end()){
+    if(strcmp(name,I->getName().c_str()) == 0) break;
+    I++; i++;
+  }
+
+  if(I==REP_thepool.end()){
+    MIRANOTIFY(Notify::WARNING,"Could not find read " << name << " in readpool.");
   }
 
   FUNCEND();
+
+  return i;
 }
 
 
+
 /*************************************************************************
  *
  *
  *
  *
  *************************************************************************/
-void ReadPool::dumpPoolInfo(ostream & ostr) const
-{
-  FUNCSTART("void ReadPool::dumpPoolInfo(ostream & ostr)");
 
-  for(uint32 i=0; i<REP_thepool3.size(); ++i){
-    if(getRead(i).hasValidData()) {
-      ostr << i << '\t' << getRead(i).getName() << '\n';
-    }else{
-      ostr << i << "\tinvalid\n";
-    }
+bool ReadPool::isInPool(const string & name) const
+{
+  try{
+    getReadIndex(name);
+    return true;
+  }
+  catch (...){
+    return false;
   }
-  FUNCEND();
 }
 
 
@@ -1112,106 +2183,72 @@ void ReadPool::dumpPoolInfo(ostream & ostr) const
  *
  *
  *************************************************************************/
-void ReadPool::dumpAsEXPs(string & dirname) const
+void ReadPool::dumpAs(ostream & ostr, uint8 astype, bool alsoinvalids) const
 {
-  FUNCSTART("void ReadPool::dumpAsEXPs(string & dirname) const");
-
-  if(ensureDirectory(dirname,true)){
-    MIRANOTIFY(Notify::FATAL, "Could not make sure that directory '" << dirname << "' exists, aborting MIRA.");
-  }
-
-  ofstream fofnout((dirname+"/fofn").c_str(), ios::out | ios::trunc);
-
-  string dummyAP="";
-  for(uint32 i=0; i<REP_thepool3.size(); ++i){
-    if(getRead(i).hasValidData()) {
-      ofstream expout((dirname+"/"+getRead(i).getName()+".exp").c_str(), ios::out | ios::trunc);
-      (const_cast<Read &>(getRead(i))).dumpAsGAP4DA(expout, dummyAP);
-
-      expout.close();
+  FUNCSTART("void ReadPool::dumpAs(ostream & ostr, uint8 astype, bool alsoinvalids) const)");
 
-      fofnout << getRead(i).getName() << ".exp" << endl;
-    }
+  Read::setCoutType(astype);
+  for(uint32 i=0; i<REP_thepool.size(); i++){
+    if(REP_thepool[i].hasValidData() || alsoinvalids) ostr << REP_thepool[i];
   }
 
-  fofnout.close();
-
   FUNCEND();
 }
 
 
-
 /*************************************************************************
  *
  *
  *
  *
  *************************************************************************/
-
-void ReadPool::refreshNameIndex()
+void ReadPool::dumpPoolInfo(ostream & ostr) const
 {
-  FUNCSTART("void ReadPool::refreshNameIndex()");
-  BUGIFTHROW(!REP_allownameindex,"Pool not allowed to make a name index?");
-
-  REP_nameindex.clear();
-
-  for(uint32 ri=0; ri<size(); ++ri){
-    unordered_map<string, uint32>::iterator mI=REP_nameindex.find(getRead(ri).getName());
-    if(mI!=REP_nameindex.end()){
-      MIRANOTIFY(Notify::FATAL,"Read '" << mI->first << "' present at least twice in read pool? Not good, you may not have more than one read with the same name.");
+  FUNCSTART("void ReadPool::dumpPoolInfo(ostream & ostr)");
+  
+  for(uint32 i=0; i<REP_thepool.size(); i++){
+    if(REP_thepool[i].hasValidData()) {
+      ostr << i << '\t' << REP_thepool[i].getName() << '\n';
+    }else{
+      ostr << i << "\tinvalid\n";
     }
-    REP_nameindex[getRead(ri).getName()]=ri;
-  }
-
+  } 
   FUNCEND();
 }
 
-//  // returns (first) read with name i.p.
-//  Read & getRead(const string & name);
-//
+
 
 /*************************************************************************
  *
- * returns id of (first) read with name or -1
+ *
  *
  *
  *************************************************************************/
-
-int32 ReadPool::getReadIndex(const string & name)
+void ReadPool::dumpAsEXPs(string & dirname) const
 {
-  if(REP_nameindex.empty()) refreshNameIndex();
+  FUNCSTART("void ReadPool::dumpAsEXPs(string & dirname) const");
 
-  unordered_map<string, uint32>::iterator mI=REP_nameindex.find(name);
-  if(mI!=REP_nameindex.end()){
-    return mI->second;
+  if(ensureDirectory(dirname,true)){
+    MIRANOTIFY(Notify::FATAL, "Could not make sure that directory '" << dirname << "' exists, aborting MIRA.");
   }
-  return -1;
-}
-
 
+  ofstream fofnout((dirname+"/fofn").c_str(), ios::out | ios::trunc);
 
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
+  string dummyAP="";
+  for(uint32 i=0; i<REP_thepool.size(); i++){
+    if(REP_thepool[i].hasValidData()) {
+      ofstream expout((dirname+"/"+REP_thepool[i].getName()+".exp").c_str(), ios::out | ios::trunc);
+      (const_cast<Read &>(REP_thepool[i])).dumpAsGAP4DA(expout, dummyAP);
+      
+      expout.close();
 
-void ReadPool::adjustIllegalQualities(base_quality_t bq)
-{
-  for(size_t i=0; i<REP_thepool3.size(); ++i){
-    vector<base_quality_t> & bqv =const_cast<vector<base_quality_t>&>(getRead(i).getQualities());
-    bool mustadjust=true;
-    for(auto tbq: bqv){
-      if(tbq<=100) {
-	mustadjust=false;
-	break;
-      }
-    }
-    if(mustadjust){
-      auto s=bqv.size();
-      bqv.clear();
-      bqv.resize(s,bq);
+      fofnout << REP_thepool[i].getName() << ".exp" << endl;
     }
   }
 
+  fofnout.close();
+
+  FUNCEND();
 }
+
+
diff --git a/src/mira/readpool.H b/src/mira/readpool.H
index b1aab73..5feaac6 100644
--- a/src/mira/readpool.H
+++ b/src/mira/readpool.H
@@ -2,7 +2,7 @@
  * Written by Bastien Chevreux (BaCh)
  *
  * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
- *   Krebsforschungszentrum, DKFZ Heidelberg) and Bastien Chevreux
+ *   Krebsforschungszentrum, DKFZ Heidelberg) and Bastien Chevreux 
  *   and Thomas Pfisterer
  * Copyright (C) 2000 and later by Bastien Chevreux
  *
@@ -12,261 +12,175 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
+// 	$Id$	
+
 
+ 
 #ifndef _readpool_h_
 #define _readpool_h_
 
-#include <string>
 
-#include <unordered_map>
+#include "stdinc/defines.H"
+#include "stdinc/stlincludes.H"
 
-#include <boost/lambda/bind.hpp>
 
-#include "stdinc/defines.H"
+#include <string>
 
 #include "mira/parameters.H"
 #include "mira/read.H"
 
-
 #undef yyFlexLexer
 #define yyFlexLexer FAFlexLexer
 #include <FlexLexer.h>
 
 
+using namespace std;
+
 class ReadPool
 {
-public:
-  class ReadContainer {
-  private:
-    std::deque<Read> RC_thepool;
-    std::vector<Read *> RC_poolrptr;
-    std::vector<uint32> RC_releasedidx; // index of free elements in the std::deque
-  private:
-    // sort criterion for standard MIRA readpool order
-    // rails first (need that for skim!)
-    // then reads with template partners by template id (sorted by segment number)
-    // then rest
-    inline bool sortcompMIRAstd(const uint32 i1, const uint32 i2){
-      //std::cout << "scm " << i1 << ' ' << i2 << std::endl;
-      if(RC_poolrptr[i1]->isRail()){
-	if(RC_poolrptr[i2]->isRail()) return i1<i2;
-	return true;
-      }else if(RC_poolrptr[i2]->isRail()){
-	return false;
-      }
-      if(RC_poolrptr[i1]->getTemplatePartnerID() >= 0
-	 || RC_poolrptr[i2]->getTemplatePartnerID() >=0){
-	if(RC_poolrptr[i1]->getTemplatePartnerID() >= 0
-	   && RC_poolrptr[i2]->getTemplatePartnerID() >=0){
-	  if(RC_poolrptr[i1]->getTemplateID() == RC_poolrptr[i2]->getTemplateID()){
-	    return RC_poolrptr[i1]->getTemplateSegment() < RC_poolrptr[i2]->getTemplateSegment();
-	  }else{
-	    return RC_poolrptr[i1]->getTemplateID() < RC_poolrptr[i2]->getTemplateID();
-	  }
-	}else if(RC_poolrptr[i1]->getTemplatePartnerID() >=0) {
-	  return true;
-	}
-      }
-      return false;
-    }
-  public:
-    ReadContainer() = default;
-    // Copy operator
-    ReadContainer(const ReadContainer&) = delete;
-    ReadContainer const & operator=(ReadContainer const & other);
-
-    inline size_t size() const { return RC_poolrptr.size();}
-    inline size_t getNumActiveReads() const { return RC_poolrptr.size() - RC_releasedidx.size();}
-    inline void clear() { RC_thepool.clear(); RC_poolrptr.clear(); RC_releasedidx.clear();}
-    inline size_t provideEmptyRead() {
-      size_t readidx=-1;
-      if(RC_releasedidx.size()){
-	// let's try without
-	// RC_freerptr.back()->~Read();            // destructor, followed by ...
-	// retread=new(RC_freerptr.back()) Read(); // ... a "placement new"
-	readidx=RC_releasedidx.back();
-
-	RC_releasedidx.pop_back();
-      }else{
-	readidx=size();
-	RC_thepool.resize(RC_thepool.size()+1);
-	RC_poolrptr.push_back(&(RC_thepool[readidx]));
-      }
-      return readidx;
-    }
+  // Variables
+private:
+  //for debuging and sanity checks
+#define REP_VALID ((((static_cast<uint32>('R')<<8)+static_cast<uint32>('E')<<8)\
+                     +static_cast<uint32>('P')<<8)+static_cast<uint32>('V'))
+  uint32 REP_valid;
 
-    // Read not physically deleted (also no destructor called),
-    //  an empty, invalid read then exists at this index which will be re-used
-    //  as soon as possible
-    void releaseRead(size_t index) {
-      FUNCSTART("Read & ReadContainer::realeaseRead(size_t index)");
-      BUGIFTHROW(index >= RC_poolrptr.size(),"index (" << index << ") >= RC_poolrptr.size() (" << RC_poolrptr.size() << ") ?");
-      RC_poolrptr[index]->discard();
-      RC_releasedidx.push_back(static_cast<uint32>(index));
-    }
-    // returns read at the index in pool
-    inline Read & getRead(size_t index) const {
-      FUNCSTART("Read & ReadContainer::getRead(uint32 index)");
-      BUGIFTHROW(index >= RC_poolrptr.size(),"error: index (" << index << ") >= RC_poolrptr.size() (" << RC_poolrptr.size() << ") ?");
-      return *(RC_poolrptr[index]);
-    }
-    inline Read & operator [] (size_t index) const {return getRead(index);};
-    inline Read & back() const {return *(RC_poolrptr.back());};
-
-    void sortContainerToMIRAStandard(std::vector<uint32> & sortorder) {
-      //std::cout << "sTTMS 1 " << RC_poolrptr.size() << std::endl;
-      sortorder.resize(RC_poolrptr.size());
-      //std::cout << "sTTMS 2" << std::endl;
-      for(uint32 i=0; i<sortorder.size(); ++i) sortorder[i]=i;
-      //std::cout << "sTTMS 3" << std::endl;
-      sort(sortorder.begin(), sortorder.end(), boost::lambda::bind(&ReadContainer::sortcompMIRAstd, this, boost::lambda::_1, boost::lambda::_2));
-      //std::cout << "sTTMS 4" << std::endl;
-      std::vector<Read *> newrcpoolptr;
-      newrcpoolptr.reserve(RC_poolrptr.size());
-      //std::cout << "sTTMS 5" << std::endl;
-      for(uint32 i=0; i<sortorder.size(); ++i) newrcpoolptr.push_back(RC_poolrptr[sortorder[i]]);
-      //std::cout << "sTTMS 6" << std::endl;
-      RC_poolrptr.swap(newrcpoolptr);
-      //std::cout << "sTTMS 7" << std::endl;
-    }
+  vector<MIRAParameters> * REP_miraparams;
 
-    void sortContainerToGivenOrder(const std::vector<uint32> & sortorder) {
-      FUNCSTART("void ReadContainer::sortContainerToMIRAStandard(const std::vector<uint32> & sortorder)");
-      BUGIFTHROW(4294967295 == size(), "uh oh ... 4294967295 != size()");
-
-      std::vector<Read *> tmp;
-      tmp.reserve(RC_poolrptr.size());
-      for(uint32 i=0; i<sortorder.size(); ++i) {
-	if(sortorder[i]<size()){
-	  if(RC_poolrptr[sortorder[i]]==nullptr){
-	    MIRANOTIFY(Notify::FATAL,"RC_poolrptr[sortorder[i]]==nullptr ??? Did you specify a read twice in your input for sorting?");
-	  }
-	  tmp.push_back(RC_poolrptr[sortorder[i]]);
-	  RC_poolrptr[sortorder[i]]=nullptr;
-	}
-      }
-      for(uint32 i=0; i<RC_poolrptr.size(); ++i) {
-	if(RC_poolrptr[i]!=nullptr) tmp.push_back(RC_poolrptr[i]);
-      }
-      RC_poolrptr.swap(tmp);
-
-      FUNCEND();
-    }
-    void dumpDebug(){
-      std::cout << "RC_thepool: " << RC_thepool.size() << std::endl;
-      std::cout << "RC_poolrptr: " << RC_poolrptr.size() << std::endl;
-      std::cout << "RC_releasedidx: " << RC_releasedidx.size() << std::endl;
-    }
-  };
+  //char * REP_filenames;          // temporary buffer for the loaded fofn.
 
-  // Variables
-private:
-  static std::string RP_missingfastaqual_resolvemsg;
-  const static base_quality_t RP_sxa2phredmap[256];
+  vector<Read> REP_thepool;
 
-  ReadContainer REP_thepool3;
+  vector<string> REP_strainnames;
 
-  bool REP_allownameindex;
-  std::unordered_map<std::string, uint32> REP_nameindex;
 
   // Functions
 private:
   void foolCompiler();
 
-  static void mergeXMLTraceInfo_callback(void * callerobjptr, std::list<std::string> & elements, std::list<std::string> & elements_cdata);
+  static void mergeXMLTraceInfo_callback(void * callerobjptr, list<string> & elements, list<string> & elements_cdata);
+  
+  void solexaScoreToQual(const vector<int32> & s, 
+			 vector<base_quality_t> & q);
 
   inline void rpDateStamp() {
-    dateStamp(std::cout);
+    if(REP_miraparams!=NULL) {
+      if((*REP_miraparams)[0].getAssemblyParams().as_dateoutput) dateStamp(cout);
+    }else{
+      dateStamp(cout);
+    };
   }
 
-
 public:
-  //ReadPool(std::vector<MIRAParameters> * params);
-  ReadPool();
+  ReadPool(vector<MIRAParameters> * params);
   ~ReadPool();
 
-  // currently do not allow copying of readpool
-  ReadPool & operator=(const ReadPool&) = delete;
-
   void discard();
   size_t estimateMemoryUsage() const;
 
-  inline size_t provideEmptyRead() { REP_nameindex.clear(); return REP_thepool3.provideEmptyRead();}
-  inline void releaseRead(size_t index) {REP_thepool3.releaseRead(index);}
-  inline void dumpRCDebug() {REP_thepool3.dumpDebug(); }
+  Read & addNewEmptyRead();            // adds an empty read to the pool
 
-  inline size_t size() const {return REP_thepool3.size();};
-  inline size_t getNumActiveReads() const {return REP_thepool3.getNumActiveReads();};
+  inline uint32 size() const     // returns number of reads in pool
+    {return static_cast<uint32>(REP_thepool.size());};
+  inline uint32 capacity() const     // returns number of reads in pool
+    {return static_cast<uint32>(REP_thepool.capacity());};
+  inline void reserve(uint32 rsize) {REP_thepool.reserve(rsize);};
+  inline Read & back()           // returns reference to last read in pool
+    {return REP_thepool.back();};
 
   // returns read at the index in pool
-  inline Read & getRead(uint32 index) const {
-    return REP_thepool3.getRead(index);
-  }
-  inline Read & operator [] (uint32 index) const {return REP_thepool3.getRead(index);};
-
-  void allowNameIndex(bool b) {REP_allownameindex=b; if(!b) REP_nameindex.clear();}
-  void refreshNameIndex();
+  Read & getRead(uint32 index);
+  inline Read & operator [] (uint32 index) {return getRead(index);};
 
   // returns (first) read with name i.p.
-  Read & getRead(const std::string & name);
+  Read & getRead(const string & name);
 
   // returns id of (first) read with name
-  int32  getReadIndex(const std::string & name);
+  int32  getReadIndex(const string & name) const;
 
-  void adaptFASTQQualValues(uint32 rpstart,
-			    uint32 rpend,
-			    base_quality_t fastqoffset,
-			    bool verbose,
-			    uint32 longestread=0,
-			    base_quality_t seenminqual=255,
-			    base_quality_t seenmaxqual=0);
+  // to save some old functions the time to convert to a string obj
+  int32  getReadIndex(const char * name) const;
 
-  void setMissingFASTAQualFileResolveMsg(std::string s) {RP_missingfastaqual_resolvemsg=s;}
+  // true if name is already in pool, else false
+  bool isInPool(const string & name) const;
 
-  void deleteReadsByName(const std::string & nfile,
+  const string & getStrainOfStrainID(uint32 sid) const;
+  inline uint32 getNumOfStrainInReadpool() const {
+    if(REP_strainnames.empty()){
+      ReadPool & nrp=const_cast<ReadPool &>(*this);
+      nrp.makeTemplateIDs(false);
+      nrp.makeStrainIDs(false);
+    }
+    return static_cast<uint32>(REP_strainnames.size());
+  };
+  bool getStrainIDOfStrain(const string & strainname, int32 & sid) const;
+
+
+  size_t loadEXPs(const string & fofn, 
+		  const uint8 loadaction, 
+		  uint32 & longestread,
+		  const uint8 readtype=Read::SEQTYPE_SANGER,
+		  void (*callback)(ReadPool &)=NULL);
+  size_t loadPHD(const string & filename, 
+		 const uint8 loadaction,
+		 uint32 & longestread,
+		 void (*callback)(ReadPool &)=NULL);
+
+  size_t loadDataFromFASTA(const string & filename, 
+			   const uint8 loadaction,
+			   uint32 & longestread,
+			   bool  wantsqualfiletoexist,
+			   const string & qualfilename="",
+			   const bool generatefilenames=true,   
+			   const uint8 readtype=Read::SEQTYPE_SANGER,
+			   const bool sxa_mustconvert=true,
+			   void (*callback)(ReadPool &)=NULL);
+  size_t loadDataFromFASTQ(const string & filename, 
+			   const uint8 loadaction,
+			   uint32 & longestread,
+			   const bool generatefilenames=true,   
+			   const uint8 readtype=Read::SEQTYPE_SANGER,
+			   const bool sxa_mustconvert=true,
+			   void (*callback)(ReadPool &)=NULL);
+
+
+  void loadDataFromGBF(const string & filename);
+  void loadDataFromGFF3(const string & filename);
+  void loadStrainData(const string & sdfile);    // name for the key value file;
+  void deleteReadsByName(const string & nfile, 
 			 bool invertselection);
 
-  void loadQualitiesFromSCF(uint32 force,
-			    bool loadfailnoerror,
-			    const std::string & log1name,
-			    const std::string & log2name);
+  void loadQualitiesFromSCF(uint32 force, 
+			    bool loadfailnoerror, 
+			    const string & log1name, 
+			    const string & log2name);
   void loadQualitiesFromSCF(uint32 force, bool loadfailnoerror);
 
-  void mergeXMLTraceInfo(const std::string & xmlfile, uint8 nagwarn_templateproblems);
-  void mergeSSAHA2SMALTVecScreenData(const std::string & ssahafile,
-				     bool issmalt,
-				     std::vector<MIRAParameters> & miraparams,
-				     const std::string & logname,
-				     const std::string & logprefix);
-
-  void dumpAs(std::ostream & ostr, uint8 astype, bool alsoinvalids) const;
-  void saveAsMAF(std::ostream & ostr, bool alsoinvalids) const;
-  void dumpAsEXPs(std::string & dirname) const;
-  void dumpPoolInfo(std::ostream & ostr) const;
+  void mergeXMLTraceInfo(const string & xmlfile);
 
+  void dumpAs(ostream & ostr, uint8 astype, bool alsoinvalids) const;
+  void dumpAsEXPs(string & dirname) const;
+  void dumpPoolInfo(ostream & ostr) const;
 
-  bool makeTemplateIDs(uint8 nagwarn_templateproblems, bool verbose=true);
-  void checkTemplateIDs(const std::string & errmsg);
 
-  void sortPoolToMIRAStandard(std::vector<uint32> & sortorder) {REP_thepool3.sortContainerToMIRAStandard(sortorder);}
-  void sortPoolToGivenOrder(const std::vector<uint32> & sortorder) {REP_thepool3.sortContainerToGivenOrder(sortorder);}
 
-  bool checkForDuplicateReadNames(uint8 nagwarn_templateproblems);
+  bool makeTemplateIDs(bool verbose=true);
+  void makeStrainIDs(bool verbose=true);
+  void dumpStrainIDSummary();
 
-  void adjustIllegalQualities(base_quality_t bq);
 };
 
 #endif
diff --git a/src/mira/readpool_io.C b/src/mira/readpool_io.C
deleted file mode 100644
index e816cca..0000000
--- a/src/mira/readpool_io.C
+++ /dev/null
@@ -1,1005 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 2003 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-#include <boost/algorithm/string.hpp>
-
-#include "mira/readpool_io.H"
-
-#include "util/fileanddisk.H"
-#include "caf/caf.H"
-#include "mira/maf_parse.H"
-
-using namespace std;
-
-
-// Plain vanilla constructor
-ReadPoolIO::ReadPoolIO(ReadPool & rp)
-{
-  FUNCSTART("ReadPoolIO::ReadPoolIO(ReadPool & rp)");
-
-  priv_zeroVars();
-  priv_init();
-
-  RPIO_rpptr=&rp;
-  RPIO_clistptr=nullptr;
-  RPIO_mpptr=nullptr;
-  RPIO_loadstatus=LS_UNDEFINED;
-  RPIO_loadtype=LT_UNDEFINED;
-
-  RPIO_maf_parse=nullptr;
-  RPIO_caf_parse=nullptr;
-
-  RPIO_fasta_preservecomments=false;
-
-  RPIO_progressindic=nullptr;
-
-  FUNCEND();
-}
-
-void ReadPoolIO::priv_zeroVars()
-{
-  FUNCSTART("void ReadPoolIO::zeroVars()");
-  FUNCEND();
-}
-
-void ReadPoolIO::priv_init()
-{
-  FUNCSTART("void ReadPoolIO::init()");
-  FUNCEND();
-}
-
-
-
-ReadPoolIO::~ReadPoolIO()
-{
-  FUNCSTART("ReadPoolIO::~ReadPoolIO()");
-
-  discard();
-
-  FUNCEND();
-}
-
-
-void ReadPoolIO::discard()
-{
-  FUNCSTART("ReadPoolIO::discard()");
-
-  priv_zeroVars();
-
-  priv_closeFiles();
-
-  FUNCEND();
-}
-
-
-void ReadPoolIO::registerFile(const string & filename1, const string & optfilename2, const ReadGroupLib::ReadGroupID rgid, bool countonly)
-{
-  uint8 ziptype=0;
-  string filetype;
-  string dummytostem;
-  string dummypathto;
-  string fn2(optfilename2);
-
-  guessFileAndZipType(filename1,dummypathto,dummytostem,filetype,ziptype);
-  boost::to_lower(filetype);
-
-  if(fn2.empty() && filetype=="fasta"){
-    fn2=filename1+".qual";
-  }
-  registerFile(filetype,filename1, fn2, rgid, countonly);
-}
-
-void ReadPoolIO::registerFile(const string & filetype, const string & filename1, const string & optfilename2, const ReadGroupLib::ReadGroupID rgid, bool countonly)
-{
-  FUNCSTART("void ReadPoolIO::registerFile(const string & filetype, const string & filename1, const string & optfilename2, const ReadGroupLib::ReadGroupID rgid, bool countonly)");
-
-  if(RPIO_loadstatus==LS_OPEN) {
-    priv_closeFiles();
-  }
-  RPIO_loadstatus=LS_NOTOPEN;
-  RPIO_filetype=filetype;
-  RPIO_filename1=filename1;
-  RPIO_optfilename2=optfilename2;
-  RPIO_rgid=rgid;
-  RPIO_countonly=countonly;
-
-  if(!fileExists(RPIO_filename1)){
-    MIRANOTIFY(Notify::FATAL,"Could not open " << RPIO_filetype << " file '" << RPIO_filename1 << "'. Is it present? Is it readable?");
-  }
-  if(getFileSize(RPIO_filename1)==0){
-    MIRANOTIFY(Notify::FATAL,"Zero length  " << RPIO_filetype << " file '" << RPIO_filename1 << "'. This is fishy.");
-  }
-
-  priv_openFiles();
-}
-
-
-void ReadPoolIO::setAttributesForContigs(std::list<Contig>  * clist, std::vector<MIRAParameters> * mp)
-{
-  RPIO_clistptr=clist;
-  RPIO_mpptr=mp;
-  if(RPIO_maf_parse!=nullptr) RPIO_maf_parse->setNewContainers(RPIO_rpptr,RPIO_clistptr,RPIO_mpptr);
-  if(RPIO_caf_parse!=nullptr) RPIO_caf_parse->setNewContainers(RPIO_rpptr,RPIO_clistptr,RPIO_mpptr);
-}
-
-void ReadPoolIO::priv_openFiles()
-{
-  FUNCSTART("void ReadPoolIO::priv_openFiles()");
-  if(RPIO_loadstatus!=LS_NOTOPEN) return;
-
-  if(RPIO_filetype=="fastq"
-     || RPIO_filetype=="fq"){
-    priv_openFiles_fastq();
-    RPIO_loadtype=LT_FASTQ;
-  }else if(RPIO_filetype=="fasta"
-	   || RPIO_filetype=="fna"
-	   || RPIO_filetype=="fastanoqual"
-	   || RPIO_filetype=="fa"){
-    priv_openFiles_fasta();
-    RPIO_loadtype=LT_FASTA;
-  }else if(RPIO_filetype=="maf"){
-    priv_openFiles_maf();
-    RPIO_loadtype=LT_MAF;
-  }else if(RPIO_filetype=="caf"){
-    priv_openFiles_caf();
-    RPIO_loadtype=LT_CAF;
-  }else if(RPIO_filetype=="gbf"
-	   || RPIO_filetype=="gbk"
-	   || RPIO_filetype=="gb"
-	   || RPIO_filetype=="gbff"
-    ){
-    priv_openFiles_gbf();
-    RPIO_loadtype=LT_GBF;
-  }else if(RPIO_filetype=="gff3"){
-    priv_openFiles_gff3();
-    RPIO_loadtype=LT_GFF3;
-  }else if(RPIO_filetype=="fofnexp"){
-    priv_openFiles_fofnexp();
-    RPIO_loadtype=LT_FOFNEXP;
-  }else if(RPIO_filetype=="exp"){
-    priv_openFiles_exp();
-    RPIO_loadtype=LT_EXP;
-  }else{
-    MIRANOTIFY(Notify::FATAL, "Unknown file type '" << RPIO_filetype << "'");
-  }
-
-  RPIO_totalreadsloaded=0;
-  RPIO_loadstatus=LS_OPEN;
-  RPIO_fsize=getFileSize(RPIO_filename1);
-}
-
-void ReadPoolIO::priv_closeFiles()
-{
-  FUNCSTART("void ReadPoolIO::priv_closeFiles()");
-  if(RPIO_loadstatus!=LS_OPEN) return;
-
-  if(RPIO_progressindic!=nullptr) RPIO_progressindic->finishAtOnce();
-
-  switch(RPIO_loadtype){
-  case LT_FASTQ : {
-    kseq_destroy(RPIO_fastq_seq);
-    gzclose(RPIO_fastq_fp);
-    break;
-  }
-  case LT_FASTA : {
-    RPIO_fasta_fin.close();
-    if(RPIO_fasta_hasqualfile){
-      RPIO_fasta_qin.close();
-    }
-    break;
-  }
-  case LT_GBF : {
-    RPIO_gbf_ioobj.discard();
-    break;
-  }
-  case LT_GFF3 : {
-    RPIO_gff_ioobj.discard();
-    break;
-  }
-  case LT_EXP : {
-    // really nothing to do
-    break;
-  }
-  case LT_FOFNEXP : {
-    RPIO_fofnexp_names.clear();
-    break;
-  }
-  case LT_MAF : {
-    if(RPIO_maf_parse!=nullptr) delete RPIO_maf_parse;
-    break;
-  }
-  case LT_CAF : {
-    if(RPIO_caf_parse!=nullptr) delete RPIO_caf_parse;
-    break;
-  }
-  default:{
-    BUGIFTHROW(true,"close not implemented for " << RPIO_filetype);
-  }
-  }
-  RPIO_loadstatus=LS_CLOSED;
-}
-
-void ReadPoolIO::priv_openFiles_fastq()
-{
-  FUNCSTART("void ReadPoolIO::priv_openFiles_fastq()");
-  if(!RPIO_optfilename2.empty()){
-    MIRANOTIFY(Notify::INTERNAL,"quality in filename2 not supported anymore");
-    RPIO_fastq_qualoffset=static_cast<base_quality_t>(atoi(RPIO_optfilename2.c_str()));
-  }
-
-  streamsize fsize=getFileSize(RPIO_filename1);
-
-  RPIO_fastq_fp = gzopen(RPIO_filename1.c_str(), "r");
-  if(RPIO_fastq_fp==Z_NULL) {
-    MIRANOTIFY(Notify::FATAL,"Could not open FASTQ file '" << RPIO_filename1 << "' though it was possible just moments ago? Was it deleted?");
-  }
-
-  RPIO_fastq_seq = kseq_init(RPIO_fastq_fp);
-}
-
-
-void ReadPoolIO::priv_openFiles_fasta()
-{
-  FUNCSTART("void ReadPoolIO::priv_openFiles_fasta()");
-
-  RPIO_fasta_fin.open(RPIO_filename1, ios::in);
-  if(!RPIO_fasta_fin){
-    MIRANOTIFY(Notify::FATAL, "Could not open: " << RPIO_filename1);
-  }
-
-  RPIO_fasta_hasqualfile=false;
-  if(!RPIO_optfilename2.empty()){
-    if(!fileExists(RPIO_optfilename2)){
-      //MIRANOTIFY(Notify::FATAL,"Could not open " << RPIO_filetype << " quality file '" << RPIO_optfilename2 << "'. Is it present? Is it readable?");
-      cout << "Could not find FASTA quality file " << RPIO_optfilename2;
-      if(RPIO_fasta_wantsqualfiletoexist){
-	cout << ", aborting. If you want to work without qualities, " << RPIO_missingfastaqual_resolvemsg;
-	MIRANOTIFY(Notify::FATAL, "File not found: " << RPIO_optfilename2);
-      }else{
-	cout << ", using default values for these reads.\n";
-      }
-    }else{
-      RPIO_fasta_hasqualfile=true;
-      if(RPIO_fasta_wantsqualfiletoexist && getFileSize(RPIO_optfilename2)==0){
-	MIRANOTIFY(Notify::FATAL, "FASTA quality file " << RPIO_optfilename2 << " has zero length? Seems fishy.");
-      }
-      RPIO_fasta_qin.open(RPIO_optfilename2, ios::in);
-    }
-  }else{
-    if(RPIO_fasta_wantsqualfiletoexist){
-      MIRANOTIFY(Notify::FATAL, "FASTA quality file expected to exist, but no quality filename given??? Refer to\nhttp://mira-assembler.sourceforge.net/docs/DefinitiveGuideToMIRA.html#sect_ref_manifest_readgroups\non how to load FASTA data without corresponding quality files.");
-    }
-  }
-}
-
-void ReadPoolIO::priv_openFiles_maf()
-{
-  FUNCSTART("void ReadPoolIO::priv_openFiles_maf()");
-
-  if(RPIO_maf_parse!=nullptr) delete RPIO_maf_parse;
-  RPIO_maf_parse=new MAFParse(RPIO_rpptr,RPIO_clistptr,RPIO_mpptr);
-  RPIO_maf_parse->registerFile(RPIO_filename1);
-  if(RPIO_progressindic!=nullptr) setAttributeProgressIndicator(true);
-}
-
-void ReadPoolIO::priv_openFiles_caf()
-{
-  FUNCSTART("void ReadPoolIO::priv_openFiles_caf()");
-  if(RPIO_caf_parse!=nullptr) delete RPIO_caf_parse;
-  RPIO_caf_parse=new CAF(RPIO_rpptr,RPIO_clistptr,RPIO_mpptr);
-  RPIO_caf_parse->registerFile(RPIO_filename1);
-  if(RPIO_progressindic!=nullptr) setAttributeProgressIndicator(true);
-}
-
-void ReadPoolIO::priv_openFiles_gbf()
-{
-  FUNCSTART("void ReadPoolIO::priv_openFiles_gbf()");
-
-  RPIO_gbf_gbfloaded=false;
-  RPIO_gbf_numtransferred=0;
-}
-
-void ReadPoolIO::priv_openFiles_gff3()
-{
-  FUNCSTART("void ReadPoolIO::priv_openFiles_gff3()");
-
-  RPIO_gff_gffloaded=false;
-  RPIO_gff_numtransferred=0;
-}
-
-void ReadPoolIO::priv_openFiles_fofnexp()
-{
-  FUNCSTART("void ReadPoolIO::priv_openFiles_fofnexp()");
-
-  string justfilenamedummy;
-  splitFullPathAndFileName(RPIO_filename1,RPIO_fofnexp_justpath,justfilenamedummy);
-
-   // Load the file of filenames
-  {
-    ifstream fin;
-    fin.open(RPIO_filename1, ios::in|ios::ate);
-    if(!fin){
-      MIRANOTIFY(Notify::FATAL, "File not found: " << RPIO_filename1);
-    }
-    if(fin.rdstate()){
-      MIRANOTIFY(Notify::FATAL, "Failed to open file: " << RPIO_filename1);
-    }
-    if(fin.tellg()==0){
-      MIRANOTIFY(Notify::FATAL, "Zero length file: " << RPIO_filename1);
-    }
-    fin.seekg(0, ios::beg);
-
-    RPIO_fofnexp_names.clear();
-    string filename, dummy;
-    while(GeneralIO::readKeyValue(fin, filename, dummy)){
-      RPIO_fofnexp_names.push_back(filename);
-    }
-  }
-
-  bool stopprocessing=false;
-  {
-    typedef unordered_set<std::string> strset;
-    strset namemap;
-    strset::iterator nI;
-
-    for(uint32 i=0; i< RPIO_fofnexp_names.size(); i++){
-      nI=namemap.find(RPIO_fofnexp_names[i]);
-      if(nI!=namemap.end()){
-	cout << "WARNING: file " << RPIO_fofnexp_names[i] << " is present more than once in your file of filenames." << endl;
-	stopprocessing=true;
-      }else{
-	namemap.insert(RPIO_fofnexp_names[i]);
-      }
-    }
-  }
-
-  if(stopprocessing){
-    MIRANOTIFY(Notify::FATAL, "Some entries in your file of filenames lead to unrecoverable error: duplicate names. Aborting, see log above for further information.");
-  }
-
-  RPIO_fofnexp_nameiloaded=0;
-}
-
-void ReadPoolIO::priv_openFiles_exp()
-{
-  FUNCSTART("void ReadPoolIO::priv_openFiles_exp()");
-  // really nothing to do?
-}
-
-uint64 ReadPoolIO::loadNextSeqs(uint64 numseqs, uint64 numcons)
-{
-  FUNCSTART("uint64 ReadPoolIO::loadNextSeqs(uint64 numseqs, uint64 numcons)");
-
-  uint64 retvalue=0;
-  if(RPIO_loadstatus==LS_NOTOPEN){
-    priv_openFiles();
-  }
-  if(RPIO_loadstatus==LS_OPEN){
-    // load things
-    if(RPIO_loadtype==LT_FASTQ){
-      auto oldrpsize=RPIO_rpptr->size();
-      retvalue=priv_loadNextSeqs_fastq(numseqs);
-      if(RPIO_fastq_qualoffset) RPIO_rpptr->adaptFASTQQualValues(oldrpsize,RPIO_rpptr->size(),RPIO_fastq_qualoffset,false);
-    }else if(RPIO_loadtype==LT_FASTA){
-      retvalue=priv_loadNextSeqs_fasta(numseqs);
-    }else if(RPIO_loadtype==LT_MAF){
-      retvalue=priv_loadNextSeqs_maf(numseqs,numcons);
-    }else if(RPIO_loadtype==LT_CAF){
-      retvalue=priv_loadNextSeqs_caf(numseqs,numcons);
-    }else if(RPIO_loadtype==LT_GBF){
-      retvalue=priv_loadNextSeqs_gbf(numseqs);
-    }else if(RPIO_loadtype==LT_GFF3){
-      retvalue=priv_loadNextSeqs_gff3(numseqs);
-    }else if(RPIO_loadtype==LT_FOFNEXP){
-      retvalue=priv_loadNextSeqs_fofnexp(numseqs);
-    }else if(RPIO_loadtype==LT_EXP){
-      retvalue=priv_loadNextSeqs_exp();
-    }else{
-      BUGIFTHROW(true,"not implemented for " << RPIO_filetype);
-    }
-  }
-  return retvalue;
-}
-
-
-void ReadPoolIO::setAttributeProgressIndicator(bool b)
-{
-  FUNCSTART("void ReadPoolIO::setAttributeProgressIndicator(bool b)");
-
-  if(b && RPIO_progressindic==nullptr){
-    RPIO_progressindic= new ProgressIndicator<int64>(0, 1,10000);
-    if(RPIO_maf_parse!=nullptr) RPIO_maf_parse->setProgressIndicator(true);
-    if(RPIO_caf_parse!=nullptr) RPIO_caf_parse->setProgressIndicator(true);
-  }else if(!b && RPIO_progressindic!=nullptr){
-    delete RPIO_progressindic;
-    RPIO_progressindic=nullptr;
-    if(RPIO_maf_parse!=nullptr) RPIO_maf_parse->setProgressIndicator(false);
-    if(RPIO_caf_parse!=nullptr) RPIO_caf_parse->setProgressIndicator(false);
-  }
-  return;
-}
-
-
-uint64 ReadPoolIO::priv_loadNextSeqs_fastq(uint64 numseqstoload)
-{
-  FUNCSTART("uint64 ReadPoolIO::priv_loadNextSeqs_fastq(uint64 numseqstoload)");
-
-  bool fatalloaderror=false;
-  bool qualerror=false;
-  uint64 numseqsloaded=0;
-  int kseqretvalue=-1;
-
-  vector<base_quality_t> fastq_bq;
-  fastq_bq.reserve(1000);
-
-  string fastq_tmpname;
-  fastq_tmpname.reserve(100);
-  string fastq_tmpcomment;
-  fastq_tmpcomment.reserve(100);
-
-  if(RPIO_totalreadsloaded==0 && RPIO_progressindic!=nullptr) RPIO_progressindic->reset(0,RPIO_fsize-1);
-
-  while (numseqsloaded<numseqstoload && (kseqretvalue = kseq_read(RPIO_fastq_seq)) >= 0) {
-#ifdef HAVE_GZOFFSET
-    if(RPIO_progressindic!=nullptr && RPIO_progressindic->delaytrigger()) RPIO_progressindic->progress(gzoffset(RPIO_fastq_fp));
-#endif
-    ++numseqsloaded;
-    ++RPIO_totalreadsloaded;
-    if(RPIO_countonly) continue;
-
-    Read & actread = RPIO_rpptr->getRead(RPIO_rpptr->provideEmptyRead());
-    actread.setReadGroupID(RPIO_rgid);
-
-    fastq_tmpcomment.clear();
-    fastq_tmpname.clear();
-    if(RPIO_fastq_seq->name.s!=nullptr) fastq_tmpname=RPIO_fastq_seq->name.s;
-    if(RPIO_fastq_seq->comment.s!=nullptr) fastq_tmpcomment=RPIO_fastq_seq->comment.s;
-
-    if(RPIO_rgid.wantUseReadNameFromComment()
-       && !fastq_tmpcomment.empty()){
-      auto bpos = fastq_tmpcomment.find_first_of(" \t");
-      fastq_tmpname=fastq_tmpcomment.substr(0,bpos);
-      if (bpos != string::npos) {
-	fastq_tmpcomment=fastq_tmpcomment.substr(bpos+1,string::npos);
-	boost::trim(fastq_tmpcomment);
-      }
-    }
-
-    bool maybesolexa=(RPIO_rgid.getSequencingType() == ReadGroupLib::SEQTYPE_SOLEXA);
-
-    if(RPIO_rgid.getSequencingType() == ReadGroupLib::SEQTYPE_TEXT
-       && RPIO_fastq_seq->comment.l>0){
-      uint32 numcolons=0;
-      char * sptr=RPIO_fastq_seq->comment.s;
-      for(; *sptr; ++sptr){
-	if(*sptr==':') ++numcolons;
-      }
-      if(numcolons==3){
-	sptr=RPIO_fastq_seq->comment.s;
-	if(sptr[1]==':'
-	   && (sptr[2]=='Y' || sptr[2]=='N')
-	   && sptr[3]==':') {
-	  maybesolexa=true;
-	}
-      }
-    }
-
-    if(maybesolexa){
-      actread.disallowAdjustments();
-    }
-
-    if(maybesolexa){
-      string::size_type bpos = fastq_tmpname.rfind("/");
-      //cout << "tmpname: " << fastq_tmpname << endl;
-      if (bpos == string::npos && RPIO_fastq_seq->comment.l>0) {
-	//cout << "No / for " << fastq_tmpname << " ... need to make one:" << RPIO_fastq_seq->comment.s << endl;
-	char * colonptr=RPIO_fastq_seq->comment.s;
-	for(; *colonptr!=0; ++colonptr){
-	  if(*colonptr==':') break;
-	}
-	if(*colonptr){
-	  fastq_tmpname+='/';
-	  colonptr=RPIO_fastq_seq->comment.s;
-	  while(*colonptr!=':') {
-	    fastq_tmpname+=*colonptr;
-	    ++colonptr;
-	  }
-	}
-      }
-    }
-
-    actread.setName(fastq_tmpname);
-
-    if(actread.getName().empty()){
-      cout << "Ouch, there's a read without a name? This is illegal. The sequence\n  "
-	   << RPIO_fastq_seq->seq.s
-	   << "\nmust have a name!\n";
-      fatalloaderror=true;
-    }
-
-    if(RPIO_fastq_seq->seq.l==0){
-      actread.setValidData(false);
-    }else{
-      actread.setSequenceFromString(RPIO_fastq_seq->seq.s);
-      fastq_bq.clear();
-      if(RPIO_fastq_seq->qual.l){
-	if(RPIO_fastq_seq->qual.l != RPIO_fastq_seq->seq.l){
-	  cout << actread.getName()
-	       << ": different number of quality values than bases?\n";
-	  qualerror=true;
-	}else{
-	  const uint8 * qi = reinterpret_cast<const uint8 *>(RPIO_fastq_seq->qual.s);
-	  bool qualok=true;
-	  for(;*qi; qi++) {
-	    if(*qi<33 || *qi>164){
-	      cout << "Read " << actread.getName() << ": invalid quality " << static_cast<uint16>(*qi) << '\n';
-	      qualok=false;
-	    }
-	    fastq_bq.push_back(*qi);
-	  }
-	  if(qualok) {
-	    actread.setQualities(fastq_bq);
-	  }else{
-	    qualerror=true;
-	  }
-	}
-      }else{
-	if(RPIO_fastq_qualoffset<33){
-	  // ooops, trying to guess automatically ... not good if there's no sequence
-	  // most probable nowadays: Sanger style FASTQ
-	  fastq_bq.resize(RPIO_fastq_seq->seq.l,RPIO_rgid.getDefaultQual()+33);
-	}else{
-	  fastq_bq.resize(RPIO_fastq_seq->seq.l,RPIO_rgid.getDefaultQual()+RPIO_fastq_qualoffset);
-	}
-	actread.setQualities(fastq_bq);
-	actread.setQualityFlag(RPIO_rgid.getDefaultQual()>0);
-      }
-    }
-  }
-
-  if(kseqretvalue<-1){
-    cout << "Whoooops, something seems fishy with the last sequence loaded, the FASTQ parser returned " << kseqretvalue << " instead of the expected >= -1.\n";
-    cout << "\nThis could be read: " << RPIO_fastq_seq->name.s << endl;
-    cout << "Sequence string length: " << RPIO_fastq_seq->seq.l << endl;
-    cout << "Quality string length: " << RPIO_fastq_seq->qual.l << endl;
-    if(numseqsloaded>0 && !RPIO_countonly && RPIO_rpptr->size()>0){
-      cout << "\nLast read which seemed OK: " << RPIO_rpptr->getRead(RPIO_rpptr->size()-1).getName() << endl;
-    }
-    if(RPIO_fastq_seq->seq.l != RPIO_fastq_seq->qual.l){
-      MIRANOTIFY(Notify::FATAL,"FASTQ seems broken, there are reads where length of sequence does not match length of quality string. See log above.\n");
-    }
-    MIRANOTIFY(Notify::FATAL,"FASTQ seems broken, see log above.\n");
-  }
-
-  if(numseqstoload!=numseqsloaded){
-    priv_closeFiles();
-  }
-
-  if(qualerror){
-    MIRANOTIFY(Notify::FATAL,"Unrecoverable error while loading data from FASTQ (see output above) Fix your input please.");
-  }
-
-  if(fatalloaderror) {
-    MIRANOTIFY(Notify::FATAL, "Fatal error encountered during load of data (see log), aborting.\n") ;
-  }
-
-  return numseqsloaded;
-}
-
-uint64 ReadPoolIO::priv_loadNextSeqs_fasta(uint64 numseqstoload)
-{
-  FUNCSTART("uint64 ReadPoolIO::priv_loadNextSeqs_fasta(uint64 numseqstoload)");
-
-  static multitag_t tmpcomm("COMM","","");
-  tmpcomm.from=0;
-  tmpcomm.to=0;
-
-  uint64 numseqsloaded=0;
-
-  if(RPIO_totalreadsloaded==0 && RPIO_progressindic!=nullptr) RPIO_progressindic->reset(0,RPIO_fsize-1);
-
-  auto formerpoolsize=RPIO_rpptr->size();
-
-  while(numseqsloaded<numseqstoload && !RPIO_fasta_fin.eof()) {
-    RPIO_fasta_ioobj.loadNextSeq(RPIO_fasta_fin);
-    if(RPIO_progressindic!=nullptr && RPIO_progressindic->delaytrigger()) RPIO_progressindic->progress(RPIO_fasta_fin.tellg());
-    ++numseqsloaded;
-    ++RPIO_totalreadsloaded;
-    if(RPIO_countonly) continue;
-    Read & actread = RPIO_rpptr->getRead(RPIO_rpptr->provideEmptyRead());
-    actread.setReadGroupID(RPIO_rgid);
-    actread.setName(RPIO_fasta_ioobj.getSeqName());
-
-    if(RPIO_rgid.getSequencingType() == ReadGroupLib::SEQTYPE_SOLEXA){
-      actread.disallowAdjustments();
-    }
-
-    if(RPIO_fasta_ioobj.getSequence().empty()){
-      actread.setValidData(false);
-      cout << "\nWarning: read '" << actread.getName() << "' has no bases?! This usually points at some error in the processing of data before it arrives to MIRA.\n";
-    }else{
-      actread.setSequenceFromString(RPIO_fasta_ioobj.getSequence());
-    }
-    if(RPIO_fasta_preservecomments && !RPIO_fasta_ioobj.getComment().empty()){
-      tmpcomm.setCommentStr(RPIO_fasta_ioobj.getComment());
-      actread.addTagO(tmpcomm);
-    }
-
-    if(actread.hasValidData()){
-      actread.setQualities(RPIO_rgid.getDefaultQual());
-      actread.setQualityFlag(false);
-    }
-  }
-
-  bool endoffile=RPIO_fasta_ioobj.testIfEmpty();
-
-  if(RPIO_fasta_hasqualfile && !RPIO_countonly){
-    for(auto rpi=formerpoolsize; rpi<RPIO_rpptr->size(); ++rpi){
-      RPIO_fasta_ioobj.loadNextINTSeq(RPIO_fasta_qin,255);
-      //if(P.delaytrigger()) P.progress(fin.tellg());
-      Read & actread=RPIO_rpptr->getRead(rpi);
-      if(RPIO_fasta_ioobj.testIfEmpty()) {
-	MIRANOTIFY(Notify::FATAL,"Premature end of FASTA quality file: did not find qualities for " << actread.getName());
-      }
-      if(actread.getName()!=RPIO_fasta_ioobj.getQualName()){
-	MIRANOTIFY(Notify::FATAL,"FASTA quality file '" << RPIO_optfilename2 << "' is not in the same order as the FASTA file '" << RPIO_filename1 << "' itself: expected qualities for read '" << actread.getName() << "' but found qualities for '" << RPIO_fasta_ioobj.getQualName() << "'.\nPlease fix your input files.");
-      }
-      for(auto & iv : RPIO_fasta_ioobj.getINTValues()){
-	if(iv<0) {
-	  MIRANOTIFY(Notify::FATAL,"Whooops ... FASTA quality values <0? That's the very old Solexa scoring scheme and not supported anymore, sorry.\n");
-	}
-      }
-      actread.setQualities(RPIO_fasta_ioobj.getQualities());
-    }
-  }
-
-  if(endoffile){
-    priv_closeFiles();
-  }
-
-  return numseqsloaded;
-}
-
-
-/*************************************************************************
- *
- * MAF is one of the formats which may contain contigs and/or reads
- * When loaded via the readpool io, all reads are loaded, but no contigs
- *  created.
- * E.g.: fle contains 1 contig (2 reads) and one 1 read without contig
- *  -> 3 reads are added to readpool
- *
- *************************************************************************/
-
-uint64 ReadPoolIO::priv_loadNextSeqs_maf(uint64 numseqstoload, uint64 numconstoload)
-{
-  FUNCSTART("uint64 ReadPoolIO::priv_loadNextSeqs_maf(uint64 numseqstoload)");
-
-  auto retvalue=RPIO_maf_parse->loadNextSeqs(numseqstoload,numconstoload);
-  if(RPIO_maf_parse->checkIfEOF()){
-    priv_closeFiles();
-  }
-
-  return retvalue;
-}
-
-
-/*************************************************************************
- *
- * CAF is one of the formats which may contain contigs and/or reads
- * When loaded via the readpool io, all reads are loaded, but no contigs
- *  created.
- * E.g.: fle contains 1 contig (2 reads) and one 1 read without contig
- *  -> 3 reads are added to readpool
- *
- *************************************************************************/
-
-uint64 ReadPoolIO::priv_loadNextSeqs_caf(uint64 numseqstoload, uint64 numconstoload)
-{
-  FUNCSTART("uint64 ReadPoolIO::priv_loadNextSeqs_caf(uint64 numseqstoload, uint64 numconstoload)");
-  auto retvalue=RPIO_caf_parse->loadNextSeqs(numseqstoload,numconstoload);
-  if(RPIO_caf_parse->checkIfEOF()){
-    priv_closeFiles();
-  }
-  return retvalue;
-}
-
-
-/*************************************************************************
- *
- * At the moment GBF does not provide a mechanism for loading sequences
- *  one by one. So the ReadPoolIO will have a GBF which contains a fully
- *  loaded object and release it as desired to the ReadPool.
- *
- * Probably less important as GBFs will not be huge files.
- *
- *************************************************************************/
-
-uint64 ReadPoolIO::priv_loadNextSeqs_gbf(uint64 numseqstoload)
-{
-  FUNCSTART("uint64 ReadPoolIO::priv_loadNextSeqs_gbf(uint64 numseqstoload)");
-
-  if(!RPIO_gbf_gbfloaded){
-    RPIO_gbf_ioobj.load(RPIO_filename1);
-    RPIO_gbf_ioobj.transferGeneInfoToCDSInfo();
-    RPIO_gbf_gbfloaded=true;
-  }
-
-  uint64 numseqsloaded=0;
-  for(; RPIO_gbf_numtransferred<RPIO_gbf_ioobj.getNumSequences() && numseqsloaded<numseqstoload; ++numseqsloaded,++RPIO_gbf_numtransferred){
-    Read & actread=RPIO_rpptr->getRead(RPIO_rpptr->provideEmptyRead());
-    actread.setReadGroupID(RPIO_rgid);
-
-    //cout << "Read GBF " << i << endl;
-    //cout << "\tName   : " << RPIO_gbf_ioobj.getSequenceName(i) << endl;
-    //cout << "\tLenseq : " << RPIO_gbf_ioobj.getSequence(i).size() << endl;
-    //cout << "\tNumtags: " << RPIO_gbf_ioobj.getTags(i).size() << endl;
-
-    actread.setName(RPIO_gbf_ioobj.getSequenceName(RPIO_gbf_numtransferred));
-    actread.setSequenceFromString(RPIO_gbf_ioobj.getSequence(RPIO_gbf_numtransferred));
-    actread.setTags(RPIO_gbf_ioobj.getTags(RPIO_gbf_numtransferred));
-    actread.setQualities(RPIO_rgid.getDefaultQual());
-  }
-
-  if(RPIO_gbf_numtransferred==RPIO_gbf_ioobj.getNumSequences()){
-    priv_closeFiles();
-  }
-
-  return numseqsloaded;
-}
-
-
-/*************************************************************************
- *
- * Like GBF, GFF3 does not provide a mechanism for loading sequences
- *  one by one. So the ReadPoolIO will have a GFF which contains a fully
- *  loaded object and release it as desired to the ReadPool.
- *
- * Probably less important as GBFs will not be huge files.
- *
- *************************************************************************/
-uint64 ReadPoolIO::priv_loadNextSeqs_gff3(uint64 numseqstoload)
-{
-  FUNCSTART("uint64 ReadPoolIO::priv_loadNextSeqs_gff3(uint64 numseqstoload)");
-
-  //GFFParse thegff(this);
-  //thegff.loadFile(filename);
-
-  if(!RPIO_gff_gffloaded){
-    RPIO_gff_ioobj.loadFile(RPIO_filename1);
-    RPIO_gff_gffloaded=true;
-  }
-
-
-  uint64 numseqsloaded=0;
-  for(; RPIO_gff_numtransferred<RPIO_gff_ioobj.getNumSequences() && numseqsloaded<numseqstoload; ++numseqsloaded,++RPIO_gff_numtransferred){
-    if(RPIO_gff_ioobj.getSequence(RPIO_gff_numtransferred).size()==0 && !RPIO_gff_ioobj.getTags(RPIO_gff_numtransferred).empty()){
-      // special case: empty sequence but tags means: the GFF had descriptions
-      //  but no sequence for it. One of the already loaded reads however has a name
-      //  matching, so simply add the tags to that read
-      auto rid=RPIO_rpptr->getReadIndex(RPIO_gff_ioobj.getSequenceName(RPIO_gff_numtransferred));
-      BUGIFTHROW(rid<0,"rid<0 ? should not happen here");
-      Read & actread=RPIO_rpptr->getRead(rid);
-      for(auto & ttag : RPIO_gff_ioobj.getTags(RPIO_gff_numtransferred)){
-	actread.addTagO(ttag);
-      }
-    }else{
-      Read & actread=RPIO_rpptr->getRead(RPIO_rpptr->provideEmptyRead());
-      actread.setReadGroupID(RPIO_rgid);
-
-      string minft_strainname;
-      string minft_seqtypename;
-      string minft_machinetype;
-      int8 minft_tplacementcode;
-      bool minft_isbb;
-      bool minft_israil;
-      bool minft_isCER;
-
-      // ugly, but we know what we do and do not want to copy around the tags
-      // unnecessarily
-      vector<multitag_t> & gff3tags=const_cast<vector<multitag_t> & >(RPIO_gff_ioobj.getTags(RPIO_gff_numtransferred));
-
-      if(Read::extractMINFTagInfo(gff3tags,
-				  RPIO_gff_ioobj.getSequenceName(RPIO_gff_numtransferred),
-				  minft_strainname,
-				  minft_seqtypename,
-				  minft_machinetype,
-				  minft_tplacementcode,
-				  minft_isbb,
-				  minft_israil,
-				  minft_isCER)){
-
-	string dummy_empty;
-
-	uint8 st=ReadGroupLib::stringToSeqType(minft_seqtypename);
-	if(st==ReadGroupLib::SEQTYPE_END && !minft_seqtypename.empty()){
-	  MIRANOTIFY(Notify::FATAL,"File " << RPIO_filename1 << " has invalid sequencing type '" << minft_seqtypename << "' in MIRA MIT2 tag.\n");
-	}
-
-	ReadGroupLib::ReadGroupID rgidt=ReadGroupLib::searchExactRGMatch(
-	  dummy_empty,
-	  st,
-	  -1,
-	  -1,
-	  minft_tplacementcode,
-	  minft_strainname,
-	  minft_isbb,
-	  minft_israil,
-	  minft_isCER,
-	  dummy_empty,
-	  dummy_empty,
-	  dummy_empty);
-
-	if(rgidt.isDefaultNonValidReadGroupID()){
-	  rgidt=ReadGroupLib::newReadGroup();
-	  rgidt.setGroupName(dummy_empty);
-	  rgidt.setSequencingType(st);
-	  rgidt.setStrainName(minft_strainname);
-	  rgidt.setBackbone(minft_isbb);
-	  rgidt.setRail(minft_israil);
-	  rgidt.setCoverageEquivalentRead(minft_isCER);
-	  rgidt.setMachineType(minft_machinetype);
-	}
-      }
-
-      actread.setName(RPIO_gff_ioobj.getSequenceName(RPIO_gff_numtransferred));
-      actread.setSequenceFromString(RPIO_gff_ioobj.getSequence(RPIO_gff_numtransferred));
-      actread.setTags(RPIO_gff_ioobj.getTags(RPIO_gff_numtransferred));
-      actread.setQualities(RPIO_rgid.getDefaultQual());
-    }
-  }
-
-  RPIO_rpptr->allowNameIndex(false);
-
-  FUNCEND();
-  return numseqsloaded;
-}
-
-
-/*************************************************************************
- *
- * In theory, EXP *could* contain multiple reads, but never encountered
- * in the wild and it's not the time to start that.
- *
- *************************************************************************/
-
-uint64 ReadPoolIO::priv_loadNextSeqs_fofnexp(uint64 numseqstoload)
-{
-  FUNCSTART("uint64 ReadPoolIO::priv_loadNextSeqs_fofnexp(uint64 numseqstoload)");
-
-  uint64 numseqsloaded=0;
-
-  for(;RPIO_fofnexp_nameiloaded<RPIO_fofnexp_names.size() && numseqsloaded<numseqstoload; ++RPIO_fofnexp_nameiloaded){
-    //P.progress(RPIO_fofnexp_nameiloaded);
-    if(RPIO_fofnexp_names[RPIO_fofnexp_nameiloaded].empty()) continue;
-    try{
-      Read & actread = RPIO_rpptr->getRead(RPIO_rpptr->provideEmptyRead());
-      actread.setReadGroupID(RPIO_rgid);
-
-      actread.loadDataFromEXP(RPIO_fofnexp_names[RPIO_fofnexp_nameiloaded],RPIO_fofnexp_justpath);
-      actread.transferSVTagsToClip(20,60);
-
-      ++numseqsloaded;
-    }
-    catch(Flow){
-    }
-    catch(Notify n){
-      n.handleError(THISFUNC);
-    }
-  }
-
-  if(RPIO_fofnexp_nameiloaded>=RPIO_fofnexp_names.size()){
-    //P.finishAtOnce();
-    priv_closeFiles();
-  }
-
-  return numseqsloaded;
-}
-
-
-/*************************************************************************
- *
- * In theory, EXP *could* contain multiple reads, but never encountered
- * in the wild and it's not the time to start that.
- *
- *************************************************************************/
-uint64 ReadPoolIO::priv_loadNextSeqs_exp()
-{
-  FUNCSTART("uint64 ReadPoolIO::priv_loadNextSeqs_exp()");
-
-  uint64 retvalue=0;
-  try{
-    Read & actread = RPIO_rpptr->getRead(RPIO_rpptr->provideEmptyRead());
-    actread.setReadGroupID(RPIO_rgid);
-
-    actread.loadDataFromEXP(RPIO_filename1,"");
-    actread.transferSVTagsToClip(20,60);
-
-    retvalue=1;
-  }
-  catch(Flow){
-  }
-  catch(Notify n){
-    n.handleError(THISFUNC);
-  }
-  return retvalue;
-}
-
-
-/*
-    loadDataFromGFF3_rgid(filename1, rgid, countonly, callback);
-  }else if(filetype=="fofnexp"){
-    loadDataFromFOFNEXP_rgid(filename1, rgid, countonly, callback);
-  }else if(filetype=="exp"){
-    loadDataFromEXP_rgid(filename1, rgid, countonly, callback);
-  }else if(filetype=="scf"){
-    // scf is actually just a data directory
-    cout << "Setting to " << filename1 << endl;
-    const_cast<ReadGroupLib::ReadGroupID &>(rgid).setDataDir(filename1);
-  }else if(filetype.empty()){
-    MIRANOTIFY(Notify::FATAL,"While trying to load data for readgroup, an empty string was given as file type (should have been fasta, fastq, etc.pp).\nReadgroup:" << rgid << endl);
-  }else{
-    MIRANOTIFY(Notify::FATAL,"While trying to load data for readgroup, type " << filetype << " not known.");
-  }
-
-  FUNCEND();
-
-  //TODO: should we return the number of leaded reads?
-  return 0;
-}
-*/
-
-
-
-//// Copy constructor
-////  no discard needed as this object will be freshly created when
-////  called through this constructor
-//ReadPoolIO::ReadPoolIO(ReadPoolIO const &other)
-//{
-//  FUNCSTART("ReadPoolIO::ReadPoolIO(ReadPoolIO const &other)");
-//
-//  ??_valid=0;
-//
-//  *this=other;                               // call the copy operator
-//
-//  FUNCEND();
-//}
-//
-//// Copy operator, needed by copy-constructor
-//ReadPoolIO const & ReadPoolIO::operator=(ReadPoolIO const & other)
-//{
-//  FUNCSTART("ReadPoolIO const & ReadPoolIO::operator=(ReadPoolIO const & other)");
-//  ERROR("Not implemented yet.");
-//  FUNCEND();
-//  return *this;
-//}
-
-//ostream & operator<<(ostream &ostr, ReadPoolIO const &???)
-//{
-//  FUNCSTART("friend ostream & ReadPoolIO::operator<<(ostream &ostr, const  &???)");
-//  ERROR("Not implemented yet.");
-//
-//  FUNCEND();
-//  return ostr;
-//}
diff --git a/src/mira/readpool_io.H b/src/mira/readpool_io.H
deleted file mode 100644
index 4669aca..0000000
--- a/src/mira/readpool_io.H
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 2003 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-#ifndef _bas_readpoolio_h_
-#define _bas_readpoolio_h_
-
-#include <iostream>
-
-#include "stdinc/defines.H"
-#include "errorhandling/errorhandling.H"
-
-#include "io/generalio.H"
-#include "io/fasta.H"
-#include "io/fastq-lh.H"
-#include "mira/gbf_parse.H"
-#include "mira/gff_parse.H"
-
-class MAFParse;
-class CAF;
-
-#include "util/progressindic.H"
-
-
-#include "mira/readpool.H"
-#include "mira/contig.H"
-
-
-
-class ReadPoolIO
-{
-private:
-  KSEQ_INIT(gzFile, gzread);
-
-
-  //Variables
-private:
-  ReadPool * RPIO_rpptr;
-  std::list<Contig> * RPIO_clistptr;
-  std::vector<MIRAParameters> * RPIO_mpptr;   // parameters for the contigs
-
-   // 0: undefined; 1: not open; 2: open (loading); 3: closed (no more sequences)
-  enum loadstatus {LS_UNDEFINED=0,LS_NOTOPEN,LS_OPEN,LS_CLOSED};
-  uint32 RPIO_loadstatus;
-  std::string RPIO_filetype;
-  std::string RPIO_filename1;
-  std::string RPIO_optfilename2;
-  ReadGroupLib::ReadGroupID RPIO_rgid;
-  bool RPIO_countonly;
-
-  enum loadtype {LT_UNDEFINED=0,LT_FASTQ,LT_FASTA,LT_MAF,LT_CAF,LT_GBF,LT_GFF3,LT_FOFNEXP,LT_EXP};
-  uint32 RPIO_loadtype;
-
-  ProgressIndicator<int64> * RPIO_progressindic;
-  uint64 RPIO_totalreadsloaded;
-  std::streamsize RPIO_fsize;
-
-  base_quality_t RPIO_fastq_qualoffset;  // 0 = external correction, q-values not corrected after loading!
-  gzFile   RPIO_fastq_fp;
-  kseq_t * RPIO_fastq_seq;
-
-  std::ifstream RPIO_fasta_fin;
-  std::ifstream RPIO_fasta_qin;
-  std::streamsize RPIO_fasta_fsize;
-  std::string RPIO_missingfastaqual_resolvemsg;
-  bool RPIO_fasta_wantsqualfiletoexist;
-  bool RPIO_fasta_hasqualfile;
-  bool RPIO_fasta_preservecomments;
-  FASTA RPIO_fasta_ioobj;
-
-  GBF RPIO_gbf_ioobj;
-  bool RPIO_gbf_gbfloaded;
-  uint32 RPIO_gbf_numtransferred;
-
-  GFFParse RPIO_gff_ioobj;
-  bool RPIO_gff_gffloaded;
-  uint32 RPIO_gff_numtransferred;
-
-  std::string RPIO_fofnexp_justpath;
-  std::vector<std::string> RPIO_fofnexp_names;
-  uint32 RPIO_fofnexp_nameiloaded;
-
-  MAFParse * RPIO_maf_parse;
-
-  CAF * RPIO_caf_parse;
-
-
-
-public:
-
-
-  //Functions
-private:
-  void priv_init();
-  void priv_zeroVars();
-
-  void priv_closeFiles();
-  void priv_openFiles();
-  void priv_openFiles_fastq();
-  void priv_openFiles_fasta();
-  void priv_openFiles_maf();
-  void priv_openFiles_caf();
-  void priv_openFiles_gbf();
-  void priv_openFiles_gff3();
-  void priv_openFiles_fofnexp();
-  void priv_openFiles_exp();
-
-  uint64 priv_loadNextSeqs_fastq(uint64 numseqstoload);
-  uint64 priv_loadNextSeqs_fasta(uint64 numseqstoload);
-  uint64 priv_loadNextSeqs_maf(uint64 numseqstoload, uint64 numconstoload);
-  uint64 priv_loadNextSeqs_caf(uint64 numseqstoload, uint64 numconstoload);
-  uint64 priv_loadNextSeqs_gbf(uint64 numseqstoload);
-  uint64 priv_loadNextSeqs_gff3(uint64 numseqstoload);
-  uint64 priv_loadNextSeqs_fofnexp(uint64 numseqstoload);
-  uint64 priv_loadNextSeqs_exp();
-
-public:
-  ReadPoolIO(ReadPool & rp);
-  ~ReadPoolIO();
-
-  ReadPoolIO(ReadPoolIO const &other)=delete;
-  ReadPoolIO const & operator=(ReadPoolIO const & other) = delete;
-
-  friend std::ostream & operator<<(std::ostream &ostr, ReadPoolIO const &rpio);
-
-  void discard();
-
-  void registerFile(const std::string & filetype,
-		    const std::string & filename1,
-		    const std::string & optfilename2,
-		    const ReadGroupLib::ReadGroupID rgid,
-		    bool countonly);
-  void registerFile(const std::string & filename1,
-		    const std::string & optfilename2,
-		    const ReadGroupLib::ReadGroupID rgid,
-		    bool countonly);
-  uint64 loadNextSeqs(uint64 numseqstoload, uint64 numconstoload=0);
-
-  void setAttributesForContigs(std::list<Contig>  * clist, std::vector<MIRAParameters> * mp);
-  void setAttributeReadPool(ReadPool & rp) {RPIO_rpptr=&rp;}
-  void setAttributeContigList(std::list<Contig> * clist) {RPIO_clistptr=clist;}
-  void setAttributeProgressIndicator(bool b);
-
-  void setAttributeFASTAQualFileWanted(bool b) {RPIO_fasta_wantsqualfiletoexist=b;}
-  void setAttributeFASTAMissingQualFileResolveMsg(const std::string & s) {RPIO_missingfastaqual_resolvemsg=s;}
-  void setAttributeFASTAPreserveComment(bool b) {RPIO_fasta_preservecomments=b;}
-
-  void setAttributeFASTQQualOffset(base_quality_t q) {RPIO_fastq_qualoffset=q;}
-};
-
-
-#endif
diff --git a/src/mira/readseqtypes.H b/src/mira/readseqtypes.H
deleted file mode 100644
index 37134b1..0000000
--- a/src/mira/readseqtypes.H
+++ /dev/null
@@ -1,47 +0,0 @@
-
-// These enums live in ReadGroupLib
-// should be included ONLY from ReadGroupLib.H
-
-enum read_sequencing_type : unsigned int {
-  SEQTYPE_SANGER=0,
-    SEQTYPE_454GS20,
-    SEQTYPE_IONTORRENT,
-    SEQTYPE_PACBIOHQ,
-    SEQTYPE_PACBIOLQ,
-    SEQTYPE_TEXT,
-    SEQTYPE_SOLEXA,
-    SEQTYPE_ABISOLID,
-    SEQTYPE_END
-};
-
-// cludge to get the C(++) preprocessor know the number of sequencing types, adapt
-//  according to the enum array above
-
-#ifndef CPP_READ_SEQTYPE_END
-#define CPP_READ_SEQTYPE_END 8
-#endif
-
-
-enum read_naming_scheme : unsigned int {
-  SCHEME_UNKNOWN=0,
-    SCHEME_SANGER,
-    SCHEME_TIGR,
-    SCHEME_FR,          // .f, .r
-    SCHEME_SOLEXA,      // /1, /2
-    SCHEME_STLOUIS,
-    SCHEME_SRARAW,
-    SCHEME_NONE
-};
-
-
-// have unknown = 0, FF > 0 and FR/RF <0
-enum splace_code {
-  SPLACE_UNUSED_LOW=-3,
-  SPLACE_RF,
-  SPLACE_FR,
-  SPLACE_UNKNOWN,
-  SPLACE_SF,
-  SPLACE_SB,
-  SPLACE_SU,
-  SPLACE_UNUSED_HIGH
-};
diff --git a/src/mira/sam_collect.C b/src/mira/sam_collect.C
deleted file mode 100644
index 624fb57..0000000
--- a/src/mira/sam_collect.C
+++ /dev/null
@@ -1,542 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 2012 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- *
- */
-
-
-#include <iostream>
-#include <sstream>
-
-#include "mira/sam_collect.H"
-#include "mira/maf_parse.H"
-
-#include "errorhandling/errorhandling.H"
-#include "util/progressindic.H"
-
-// boost::split
-#include <boost/algorithm/string.hpp>
-
-#define CEBUG(bla)
-
-using namespace std;
-
-
-//#define CEBUG(bla)   {cout << bla; cout.flush(); }
-void SAMCollect::processMAF(const string & mafname)
-{
-  FUNCSTART("void SAMCollect::processMAF(const string & mafname)");
-
-  collectInfoFromMAF(mafname);
-  processSAMRIs();
-
-  FUNCEND();
-}
-
-
-void SAMCollect::processSAMRIs()
-{
-  FUNCSTART("void SAMCollect::processSAMRIs(const string & mafname)");
-
-  cout << "Sorting read info ... "; cout.flush();
-  sort(SAMC_samris.begin(),SAMC_samris.end(),SAMCollect::samrinfo_t::lt_templateid);
-  cout << "done" << endl;
-
-  // this has changed the ordering in SAMC_samris, therefore the samri_ids in
-  //  SAMC_rname2samriid are not valid anymore. Generate the new ones and
-  //  put them into SAMC_rname2samriid
-  {
-    vector<pair<size_t,size_t>> neworder(SAMC_samris.size());
-    auto noI=neworder.begin();
-    size_t counter=0;
-    for(auto sI=SAMC_samris.begin(); sI!=SAMC_samris.end(); ++sI, ++noI, ++counter){
-      *noI=pair<size_t,size_t>(sI->initial_samri_id,counter);
-    }
-    sort(neworder.begin(),neworder.end());
-    for(auto & rnme : SAMC_rname2samriid){
-      rnme.second=neworder[rnme.second].second;
-    }
-  }
-
-  // now go through the SAMC_samris template by template to set flags
-  auto sI=SAMC_samris.begin();
-  auto sE=sI;
-  for(; sI!=SAMC_samris.end(); sI=sE){
-    BUGIFTHROW(sI->rgid.isDefaultNonValidReadGroupID(),"Template " << SAMC_templatenames[sI->templateid] << " has no readgroup set? Should not be.");
-    for(; sE!=SAMC_samris.end() && sE->templateid==sI->templateid; ++sE) {};
-
-    CEBUG("LAT: " << SAMC_templatenames[sI->templateid] << endl);
-    CEBUG(sI->rgid << endl);
-    if(sE-sI > 1){
-      uint32 samflags=1;
-      bool samecontig=true;
-      uint32 numnonzerosegments=0;
-      uint32 numzerosegments=0;
-      int32 tlen=0;
-      int32 seg1left=true;
-      bool eachsegmentproperlyaligned=true;
-      bool seenfirstsegment=false;
-      bool seenlastsegment=false;
-      for(auto iI=sI; iI!=sE; ++iI) {
-	if(iI->contigid!=sI->contigid){
-	  samecontig=false;
-	}
-	if(iI->template_segment){
-	  ++numnonzerosegments;
-	  if(iI->template_segment==1){
-	    seenfirstsegment=true;
-	  }else if(iI->template_segment==255){
-	    seenlastsegment=true;
-	  }
-	}else{
-	  ++numzerosegments;
-	}
-      };
-      if(numzerosegments && numnonzerosegments){
-	if(sI->templateid>0) {
-	  cout << "WARNING: template " << SAMC_templatenames[sI->templateid] << " (" << sI->templateid << ") has " << sE-sI << " segments, but some of them have no segment order???\n";
-	  eachsegmentproperlyaligned=false;
-	}
-      }else if(!samecontig || numzerosegments || !seenfirstsegment || !seenlastsegment){
-	eachsegmentproperlyaligned=false;
-	CEBUG("BAH 1" << "\tsc " << samecontig << "\tzs " << numzerosegments << "\tfs " << seenfirstsegment << "\tls " << seenlastsegment << "\tpc " << static_cast<int16>(sI->rgid.getSegmentPlacementCode()) << "\n");
-      }
-
-      tlen=0;
-      if(eachsegmentproperlyaligned){
-	BUGIFTHROW(sI->template_segment==0,"sI->template_segment==0 ???");
-	switch(sI->rgid.getSegmentPlacementCode()){
-	case ReadGroupLib::SPLACE_UNKNOWN : {
-	  // intentionally do nothing
-	  // we don't know the placement code, so assembled reads from a
-	  //  template should be seen as correct
-	  break;
-	}
-	case ReadGroupLib::SPLACE_SF : {
-	  auto initialstartpos=sI->clippedstartpos;
-	  auto dirtaken=sI->dir;
-	  for(auto iI=sI; iI!=sE; ++iI){
-	    if(iI->dir != dirtaken
-	       || (dirtaken>0 && iI->clippedstartpos < initialstartpos)
-	       || (dirtaken<0 && iI->clippedstartpos > initialstartpos)){
-	      eachsegmentproperlyaligned=false;
-	      CEBUG("BAH 2sf\n");
-	      break;
-	    }
-	  }
-	  break;
-	}
-	case ReadGroupLib::SPLACE_SB : {
-	  auto initialstartpos=sI->clippedstartpos;
-	  auto dirtaken=sI->dir;
-	  for(auto iI=sI; iI!=sE; ++iI){
-	    if(iI->dir != dirtaken
-	       || (dirtaken>0 && iI->clippedstartpos > initialstartpos)
-	       || (dirtaken<0 && iI->clippedstartpos < initialstartpos)){
-	      eachsegmentproperlyaligned=false;
-	      CEBUG("BAH 2sb\n");
-	      break;
-	    }
-	  }
-	  break;
-	}
-	case ReadGroupLib::SPLACE_SU : {
-	  auto initialstartpos=sI->clippedstartpos;
-	  auto dirtaken=sI->dir;
-	  for(auto iI=sI; iI!=sE; ++iI){
-	    if(iI->dir != dirtaken){
-	      eachsegmentproperlyaligned=false;
-	      CEBUG("BAH 2su\n");
-	      break;
-	    }
-	  }
-	  break;
-	}
-	case ReadGroupLib::SPLACE_RF :
-	case ReadGroupLib::SPLACE_FR : {
-	  if(sE-sI>2){
-	    eachsegmentproperlyaligned=false;
-	    cout << "WARNING: template " << SAMC_templatenames[sI->templateid] << " has " << sE-sI << " segments, but should have only 2???\n";
-	  }else{
-	    // for overlapping reads, it makes not much sense to check RF/FR orientation
-	    bool isoverlapping=true;
-	    if(sI->clippedstartpos+sI->clippedlen < (sI+1)->clippedstartpos
-	       || (sI+1)->clippedstartpos+(sI+1)->clippedlen < sI->clippedstartpos){
-	      isoverlapping=false;
-	    }
-	    if(!isoverlapping){
-	      // check orientation
-	      bool isok=true;
-	      if(sI->dir>0 && sI->clippedstartpos > (sI+1)->clippedstartpos) isok=false;
-	      if(sI->dir<0 && sI->clippedstartpos < (sI+1)->clippedstartpos) isok=false;
-	      if(sI->rgid.getSegmentPlacementCode()==ReadGroupLib::SPLACE_RF) isok=!isok;
-	      eachsegmentproperlyaligned=isok;
-	      if(!eachsegmentproperlyaligned) {CEBUG("BAH 3\n");}
-	    }
-	  }
-	  break;
-	}
-	default : {
-	  MIRANOTIFY(Notify::FATAL,"Placement code " << static_cast<int16>(sI->rgid.getSegmentPlacementCode()) << " is unknown???");
-	}
-	}
-
-	if(eachsegmentproperlyaligned){
-	  // check distance
-	  int32 mins=min(sI->clippedstartpos,(sE-1)->clippedstartpos);
-	  int32 maxs=max(sI->clippedstartpos+sI->clippedlen,(sE-1)->clippedstartpos+(sE-1)->clippedlen);
-	  tlen=maxs-mins;
-	  if((sE-1)->clippedstartpos < sI->clippedstartpos) seg1left=false;
-	  int32 grace=(sI->rgid.getInsizeTo()-sI->rgid.getInsizeFrom())/20; // 5% grace (for gap columns etc.)
-	  if((sI->rgid.getInsizeFrom() >= 0 && tlen<sI->rgid.getInsizeFrom()-grace)
-	     || (sI->rgid.getInsizeTo() >=0 && tlen>sI->rgid.getInsizeTo()+grace)){
-	    eachsegmentproperlyaligned=false;
-	    CEBUG("BAH 4\n");
-	  }
-	}
-
-      }
-
-      auto inextI=sI;
-      ++inextI;
-      for(auto iactI=sI; true; ++iactI, ++inextI){
-	bool nextsegmentmapped=false;
-	if(inextI!=sE && iactI->template_segment!=0){
-	  if(iactI->template_segment >0
-	     && (inextI->template_segment == 255
-		 || (inextI->template_segment == iactI->template_segment+1))){
-	    nextsegmentmapped=true;
-	  }
-	}
-	auto actsamflags=samflags;
-	if(eachsegmentproperlyaligned) actsamflags|=0x2;
-	if(inextI->dir<0) actsamflags|=0x20;
-	if(iactI->dir<0) actsamflags|=0x10;
-	if(iactI->template_segment==1) actsamflags|=0x40;  // first segment in template
-	if(iactI->template_segment==255) actsamflags|=0x80;  // last segment in template
-	if(iactI->template_segment>1 && iactI->template_segment<255) actsamflags|=0x40 | 0x80;  // part of linear segment, set 0x40 & 0x80
-	if(!nextsegmentmapped && iactI->template_segment!=255) actsamflags|=0x8;
-	iactI->samflags=actsamflags;
-
-	// rnext, pnext
-	if(nextsegmentmapped){
-	  iactI->rnext_conid=inextI->contigid;
-	  iactI->pnext=inextI->clippedstartpos;
-	}else if(iactI->template_segment==255 && sI->template_segment==1){
-	  iactI->rnext_conid=sI->contigid;
-	  iactI->pnext=sI->clippedstartpos;
-	}
-
-	// tlen
-	if(eachsegmentproperlyaligned){
-	  if(iactI->template_segment==1){
-	    if(seg1left){
-	      iactI->tlen=tlen;
-	    }else{
-	      iactI->tlen=-tlen;
-	    }
-	  }else if(iactI->template_segment==255){
-	    if(seg1left){
-	      iactI->tlen=-tlen;
-	    }else{
-	      iactI->tlen=tlen;
-	    }
-	  }
-	}
-
-	if(inextI==sE) break;
-      }
-    }
-
-/*
-    cout << sE-sI << " reads for " << SAMC_templatenames[sI->templateid] << endl;
-    for(auto xI=sI; xI!=sE; ++xI) {
-      cout << "sI tid: " << xI->templateid << "\tsegid: " << static_cast<uint32>(xI->template_segment)
-	   << "\tpos: " << xI->clippedstartpos
-	   << "\tdir: " << static_cast<int16>(xI->dir)
-	   << "\tflag: " << hex << xI->samflags << dec
-	   << endl;
-    };
-*/
-
-  }
-
-  FUNCEND();
-}
-#define CEBUG(bla)
-
-
-// having define instead of inline function makes BOOST header disappear from .H
-#define SPLITMAFLINE(numexpected) {boost::split(mafsplit, mafline, boost::is_any_of("\t")); if(mafsplit.size()!=numexpected){cout << "Oooops, expected " << numexpected << " elements but found " << mafsplit.size() << "???\n";errorMsgMAFFormat(mafname,linenumber,mafline,"wrong number of elements in line");}};
-
-void SAMCollect::collectInfoFromMAF(const string & mafname)
-{
-  FUNCSTART("void SAMCollect::collectInfoFromMAF(const string & mafname)");
-
-  static const string cpsHReadGroupShort("@R");
-  static const string cpsHReadGroup("@ReadGroup");
-
-  static const string cpsCO("CO");
-  static const string cpsCS("CS");
-  static const string cpsEC("EC");
-
-  static const string cpsRD("RD");
-  static const string cpsRG("RG");
-  static const string cpsTN("TN");
-  static const string cpsTS("TS");
-  static const string cpsER("ER");
-  static const string cpsAT("AT");
-
-  ifstream mafin;
-
-  mafin.open(mafname.c_str(), ios::in|ios::ate);
-  if(!mafin) {
-    MIRANOTIFY(Notify::FATAL, "MAF file " << mafname << " not found for loading.");
-  }
-  if(!mafin.tellg() ) {
-    MIRANOTIFY(Notify::FATAL, "MAF file " << mafname << " is empty.");
-  }
-  mafin.seekg(0, ios::beg);
-
-  // template id 0 for no template
-  if(SAMC_templatenames.empty()) SAMC_templatenames.push_back("");
-  if(SAMC_tname2tid.empty()) SAMC_tname2tid.insert(pair<string,size_t>("",0));
-
-  bool sawreadrg=false;
-  size_t actcontigid=0;
-  size_t acttemplateid=0;
-  int32  acttemplatesegment=-1;
-  string actcontigname;
-  string actreadname;
-  ReadGroupLib::ReadGroupID actrgid;
-
-  string mafline;
-  string maftoken;
-  vector<string> mafsplit;
-  uint64 linenumber=0;
-
-  pair<unordered_map<string, size_t>::iterator,bool> lastsamri;
-  lastsamri.second=false;
-
-  while(true){
-    ++linenumber;
-    getline(mafin,mafline);
-    if(mafin.eof()) break;
-
-    CEBUG("l: " << linenumber << "\tt: ###" << mafline << "###" << endl);
-
-    if(mafline.size()<2) continue;
-    maftoken=mafline.substr(0,2);
-    if(maftoken==cpsRD){
-      if(actreadname.size()>0){
-	errorMsgMAFFormat(mafname,linenumber,mafline,"found RD token while already in read, did not close previous read?");
-      }
-      SPLITMAFLINE(2);
-      actreadname=std::move(mafsplit[1]);
-      if(actreadname.empty()){
-	errorMsgMAFFormat(mafname,linenumber,mafline,"found RD token without a read name?");
-      }
-    }else if(maftoken==cpsER){
-      if(actreadname.empty()){
-	errorMsgMAFFormat(mafname,linenumber,mafline,"found ER token while not in read (missing RD token?)");
-      }
-      if(actrgid.isDefaultNonValidReadGroupID()){
-	errorMsgMAFFormat(mafname,linenumber,mafline,"read has no read group (missing RG token?)");
-      }
-      if(acttemplatesegment==-1){
-	acttemplatesegment=0;
-      }
-      BUGIFTHROW(actcontigid==0,"ER token, actcontigid==0 ??");
-      SAMC_samris.push_back(samrinfo_t(SAMC_samris.size(),actcontigid-1,acttemplateid,acttemplatesegment,actrgid,-1,-1,0,0));
-      lastsamri=SAMC_rname2samriid.insert(pair<string,size_t>(actreadname,SAMC_samris.size()-1));
-      BUGIFTHROW(!lastsamri.second,"!lastsamri.second ???")
-      actreadname.clear();
-      acttemplateid=0;
-      acttemplatesegment=-1;
-      actrgid.resetLibId();
-    }else if(maftoken==cpsRG){
-      sawreadrg=true;
-      if(actreadname.empty()){
-	errorMsgMAFFormat(mafname,linenumber,mafline,"found RG token while not in read (missing RD token?)");
-      }
-      if(!actrgid.isDefaultNonValidReadGroupID()){
-	errorMsgMAFFormat(mafname,linenumber,mafline,"read already in read group (double RG token?)");
-      }
-      SPLITMAFLINE(2);
-      // convoluted way to assign readgroupid, but hey
-      actrgid=ReadGroupLib::ReadGroupID(atoi(mafsplit[1].c_str()));
-    }else if(maftoken==cpsTN){
-      SPLITMAFLINE(2);
-      auto tnI=SAMC_tname2tid.find(mafsplit[1]);
-      if(tnI==SAMC_tname2tid.end()){
-	acttemplateid=SAMC_templatenames.size();
-	SAMC_templatenames.push_back(mafsplit[1]);
-	SAMC_tname2tid.insert(pair<string,size_t>(mafsplit[1],acttemplateid));
-      }else{
-	acttemplateid=tnI->second;
-      }
-    }else if(maftoken==cpsTS){
-      if(acttemplatesegment!=-1){
-	errorMsgMAFFormat(mafname,linenumber,mafline,"TS already set for this read?");
-      }
-      SPLITMAFLINE(2);
-      acttemplatesegment=atoi(mafsplit[1].c_str());
-    }else if(maftoken==cpsAT){
-      if(!actreadname.empty()){
-	errorMsgMAFFormat(mafname,linenumber,mafline,"found AT token while in read (missing ER token?)");
-      }
-      BUGIFTHROW(actcontigid==0,"ER token, actcontigid==0 ??");
-      if(SAMC_samris.empty()){
-	errorMsgMAFFormat(mafname,linenumber,mafline,"found AT token without previous read ?)");
-      }
-      if(SAMC_samris.back().clippedstartpos>=0){
-	errorMsgMAFFormat(mafname,linenumber,mafline,"last read seems already to have positions set ... double AT line ?)");
-      }
-      SPLITMAFLINE(5);
-      int32 first=atoi(mafsplit[1].c_str());
-      int32 second=atoi(mafsplit[2].c_str());
-      SAMC_samris.back().clippedstartpos=min(first,second);
-      SAMC_samris.back().dir=1;
-      if(first>second) SAMC_samris.back().dir=-1;
-      first=atoi(mafsplit[3].c_str());
-      second=atoi(mafsplit[4].c_str());
-      SAMC_samris.back().clippedlen=second-first;
-    }else if(maftoken==cpsCO){
-      if(actcontigid!=0){
-	errorMsgMAFFormat(mafname,linenumber,mafline,"found CO token while already in contig? Missed an EC token.");
-      }
-      SPLITMAFLINE(2);
-      actcontigname=std::move(mafsplit[1]);
-      auto oldsize=SAMC_namecheck_contig.size();
-      SAMC_namecheck_contig.insert(actcontigname);
-      if(SAMC_namecheck_contig.size() == oldsize){
-	cout << "Duplicate: " << actcontigname << endl;
-	errorMsgMAFFormat(mafname,linenumber,mafline,"duplicate contig name?");
-      }
-      SAMC_contignames.push_back(actcontigname);
-      actcontigid=SAMC_contignames.size();
-    }else if(maftoken==cpsCS){
-      if(actcontigid==0){
-	errorMsgMAFFormat(mafname,linenumber,mafline,"found CS token while not in contig?");
-      }
-      // I'm lazy
-      mafline[0]=' ';
-      mafline[1]=' ';
-      boost::trim(mafline);
-      SAMC_contiglengths.push_back(mafline.size());
-    }else if(maftoken==cpsEC){
-      if(actcontigid==0){
-	errorMsgMAFFormat(mafname,linenumber,mafline,"found EC token without preceding CO token?");
-      }
-      actcontigid=0;
-    }else if(maftoken==cpsHReadGroupShort
-	     && mafline.size()>=10
-	     && mafline.substr(0,10)==cpsHReadGroup
-      ){
-      if(sawreadrg){
-	errorMsgMAFFormat(mafname,linenumber,mafline,"found @Readgroup in MAF while other reads have already been defined. Cannot do that yet.\n\nUse 'grep ^@ old.maf >new.maf; grep -v ^@ old.maf >>new.maf; ' to create a MAF which can be converted to SAM.");
-      }
-      vector<ReadGroupLib::ReadGroupID> dummy_externalidmapper;
-      auto dummy_rgid=ReadGroupLib::newReadGroup();
-      MAFParse::parseReadGroup(mafin, dummy_rgid, dummy_externalidmapper, linenumber);
-    }
-  }
-
-  if(SAMC_contiglengths.size() != SAMC_contignames.size()){
-    MIRANOTIFY(Notify::FATAL,"different number of contigs and contig lengths? were there contigs without sequences?");
-  }
-
-  FUNCEND();
-}
-
-
-void SAMCollect::errorMsgMAFFormat(const string & filename, size_t linenumber, const string & line, const char * msg)
-{
-  cout << "MAF file " << filename << " at line " << linenumber << ":\n" << line << "\n\n" << msg << endl;
-  cout << "Error in MAF format, aborting." << endl;
-  exit(100);
-}
-
-
-void SAMCollect::createSAMHeader()
-{
-  std::stringstream ostr;
-  // readgroup 0 should never be present anyway
-  for(uint32 rgi=1; rgi<ReadGroupLib::getNumReadGroups(); ++rgi){
-    ReadGroupLib::dumpReadGroupAsSAM(rgi,ostr);
-  }
-
-  for(size_t ci=0; ci<SAMC_contignames.size(); ++ci){
-    ostr << "@SQ\tSN:" << SAMC_contignames[ci]
-	 << "\tLN:" << SAMC_contiglengths[ci]
-	 << '\n';
-  }
-  SAMC_headerstring=ostr.str();
-}
-
-
-/*************************************************************************
- *
- * returns false if not found
- * true if found and the samrinfo_t structure in samri
- *
- *************************************************************************/
-
-bool SAMCollect::getSAMRInfo(const string & readname, samrinfo_t & samri) const
-{
-  auto srI=SAMC_rname2samriid.find(readname);
-  if(srI==SAMC_rname2samriid.end()) return false;
-  samri=SAMC_samris[srI->second];
-  return true;
-}
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-const string & SAMCollect::getContigName(samrinfo_t & samri) const
-{
-  FUNCSTART("const string & SAMCollect::getContigName(samrinfo_t & samri) const");
-  BUGIFTHROW(samri.contigid >= SAMC_contignames.size(),"samri.contigid >= SAMC_contignames.size() ???");
-  return SAMC_contignames[samri.contigid];
-}
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-const string & SAMCollect::getRNextEntry(samrinfo_t & samri) const
-{
-  static const string sstar("*");
-  static const string sequal("=");
-  if(samri.rnext_conid>=0) {
-    if(samri.contigid==samri.rnext_conid) return sequal;
-    return SAMC_contignames[samri.rnext_conid];
-  }
-  return sstar;
-}
diff --git a/src/mira/sam_collect.H b/src/mira/sam_collect.H
deleted file mode 100644
index a2d2f82..0000000
--- a/src/mira/sam_collect.H
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 2012 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- *
- */
-
-
-#ifndef _samcollect_h
-#define _samcollect_h
-
-
-#include <string>
-#include <vector>
-
-#include <unordered_map>
-#include <unordered_set>
-
-#include "stdinc/types.H"
-#include "stdinc/stlincludes.H"
-
-#include "mira/readgrouplib.H"
-
-
-class SAMCollect
-{
-public:
-  struct samrinfo_t {
-    size_t initial_samri_id;     // 0.. size of SAMC_samris -1
-    size_t contigid;     // in which contig is the read
-    size_t templateid;   // part of which template
-
-    int32 clippedstartpos;
-    int32 clippedlen;
-    int8  dir;
-    uint8  template_segment;
-    ReadGroupLib::ReadGroupID rgid;
-
-    uint32 samflags;
-
-    int32 rnext_conid;
-    int32 pnext;
-    int32 tlen;
-
-    samrinfo_t(bool dummy) {(void) dummy;};  // lazy initialiser, we know what we do
-    samrinfo_t(size_t sid, size_t cid, size_t tid, uint8 ts, ReadGroupLib::ReadGroupID rg, int32 csp, int32 cl, int8 di, uint32 sf) :
-      initial_samri_id(sid),
-      contigid(cid), templateid(tid),
-      clippedstartpos(csp), clippedlen(cl),
-      dir(di),
-      template_segment(ts),
-      rgid(rg),
-      samflags(sf),
-      rnext_conid(-1),
-      pnext(0),
-      tlen(0)
-      {};
-    // sort ascending by template, then by template-segment
-    static inline bool lt_templateid(const samrinfo_t & a, const samrinfo_t & b) {
-      if(a.templateid == b.templateid){
-	return a.template_segment < b.template_segment;
-      }
-      return a.templateid < b.templateid;};
-
-    friend std::ostream & operator<<(std::ostream &ostr, const samrinfo_t & si){
-      ostr << "SI: "
-	   << "isid: " << si.initial_samri_id
-	   << "\tcid: " << si.contigid
-	   << "\ttid: " << si.templateid
-	   << "\tcsp: " << si.clippedstartpos
-	   << "\tcln: " << si.clippedlen
-	   << "\tdir: " << static_cast<int16>(si.dir)
-	   << "\tts: " << static_cast<uint16>(si.template_segment)
-	   << "\trgid: " << si.rgid.getLibId()
-	   << "\tsfl: " << si.samflags
-	   << "\trnxt_id: " << si.rnext_conid
-	   << "\tpnxt: " << si.pnext
-	   << "\ttlen: " << si.tlen
-	   << "\n";
-      return ostr;
-    }
-  };
-
-  std::vector<samrinfo_t> SAMC_samris;
-
-  std::unordered_set<std::string> SAMC_namecheck_contig;
-
-  std::vector<std::string> SAMC_contignames;
-  std::vector<size_t> SAMC_contiglengths;
-  std::vector<std::string> SAMC_templatenames;
-  std::unordered_map<std::string, size_t> SAMC_tname2tid;
-  std::unordered_map<std::string, size_t> SAMC_rname2samriid;
-
-  std::string SAMC_headerstring;
-
-private:
-  void errorMsgMAFFormat(const std::string & filename,
-			 size_t linenumber,
-			 const std::string & line,
-			 const char * msg);
-
-  void collectInfoFromMAF(const std::string & mafname);
-  void processSAMRIs();
-
-public:
-  void processMAF(const std::string & mafname);
-  void createSAMHeader();
-
-  bool getSAMRInfo(const std::string & readname, samrinfo_t & samri) const;
-  const std::string & getContigName(samrinfo_t & samri) const;
-  const std::string & getRNextEntry(samrinfo_t & samri) const;
-};
-
-
-
-
-
-#endif
diff --git a/src/mira/scaffolder.C b/src/mira/scaffolder.C
index e40303b..c255780 100644
--- a/src/mira/scaffolder.C
+++ b/src/mira/scaffolder.C
@@ -9,27 +9,32 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
+// 	$Id$	
 
-#include "mira/scaffolder.H"
-
-#include "mira/contig.H"
+#ifndef lint
+static char vcid[] = "$Id$";
+#endif /* lint */
 
+#include "mira/scaffolder.H"
 
-using namespace std;
 
+void Scaffolder::foolCompiler()
+{
+#include "stdinc/foolcompiler.C"
+}
 
 // Plain vanilla constructor
 Scaffolder::Scaffolder()
@@ -39,6 +44,7 @@ Scaffolder::Scaffolder()
   zeroVars();
   init();
 
+  ERROR("Not implemented yet.");
   FUNCEND();
 }
 
@@ -51,9 +57,6 @@ void Scaffolder::zeroVars()
 void Scaffolder::init()
 {
   FUNCSTART("void Scaffolder::init()");
-
-  SCA_tname2tid.insert(pair<string,uint32>("",0));
-
   FUNCEND();
 }
 
@@ -65,6 +68,7 @@ Scaffolder::~Scaffolder()
 
   discard();
 
+  ERROR("Not implemented yet.");
   FUNCEND();
 }
 
@@ -79,131 +83,50 @@ void Scaffolder::discard()
 }
 
 
-#define CEBUG(bla)   {cout << bla; cout.flush(); }
+//// Copy constructor
+////  no discard needed as this object will be freshly created when
+////  called through this constructor
+//Scaffolder::Scaffolder(Scaffolder const &other)
+//{
+//  FUNCSTART("Scaffolder::Scaffolder(Scaffolder const &other)");
+//
+//  ??_valid=0;
+//
+//  *this=other;                               // call the copy operator
+//
+//  FUNCEND();
+//}
+//
+//// Copy operator, needed by copy-constructor
+//Scaffolder const & Scaffolder::operator=(Scaffolder const & other)
+//{
+//  FUNCSTART("Scaffolder const & Scaffolder::operator=(Scaffolder const & other)");
+//  ERROR("Not implemented yet.");
+//  FUNCEND();
+//  return *this;
+//}
+
+//ostream & operator<<(ostream &ostr, Scaffolder const &???)
+//{
+//  FUNCSTART("friend ostream & Scaffolder::operator<<(ostream &ostr, const  &???)");
+//  ERROR("Not implemented yet.");
+//
+//  FUNCEND();
+//  return ostr;
+//}
+
+
 void Scaffolder::storeInfoFreshContig(Contig & con)
 {
   FUNCSTART("void Scaffolder::storeInfoFreshContig(contig & con)");
 
-  readlinkinfo_t tmplink;
-  tmplink.contigid=SCA_contiginfo.size();
-
-  SCA_contiginfo.resize(SCA_contiginfo.size()+1);
-  auto & actcinfo=SCA_contiginfo.back();
-  actcinfo.name=con.getContigName();
-
-  auto & creads=con.getContigReads();
   {
-    auto crE=creads.end();
-    for(auto crI=creads.begin(); crI!=crE; ++crI){
-      auto & actread=*crI;
-      int64 startpos=crI.getReadStartOffset();
-      int64 endpos=startpos+actread.getLenClippedSeq();
-      auto rgid=actread.getReadGroupID();
-      auto wanteddist=max(rgid.getInsizeTo(),rgid.getInsizeFrom()); // if wanteddist <= 0: just go by directions
-      CEBUG("Wanted: " << wanteddist << endl);
-      if(actread.getTemplateSegment() != 0         // do we have a valid template segment?
-	 && rgid.getSegmentPlacementCode() != ReadGroupLib::SPLACE_UNKNOWN
-	 && (wanteddist <= 0
-	     || startpos <= wanteddist
-	     || endpos >= static_cast<int64>(con.getContigLength())-wanteddist)){
-	// OK ... we are at the right distance from one of the contig ends
-	// find out which is the correct one:
-	//  from the direction of the read in the contig its segment placement scheme
-	tmplink.wantdir=0;
-	bool wantleft=false;    // partner read should be on left
-	bool wantright=false;   // partner read should be on right
-	auto rdir=crI.getReadDirection();
-	// this is the logic for rdir > 0
-	switch(rgid.getSegmentPlacementCode()){
-	case ReadGroupLib::SPLACE_RF : {
-	  tmplink.wantdir=-1;
-	  wantleft=true;
-	  break;
-	}
-	case ReadGroupLib::SPLACE_FR : {
-	  tmplink.wantdir=-1;
-	  wantright=true;
-	  break;
-	}
-	case ReadGroupLib::SPLACE_SF : {
-	  tmplink.wantdir=1;
-	  if(actread.getTemplateSegment()==1){
-	    wantright=true;
-	  }else if(actread.getTemplateSegment()==255){
-	    wantleft=true;
-	  }
-	  break;
-	}
-	case ReadGroupLib::SPLACE_SB : {
-	  tmplink.wantdir=1;
-	  if(actread.getTemplateSegment()==1){
-	    wantleft=true;
-	  }else if(actread.getTemplateSegment()==255){
-	    wantright=true;
-	  }
-	  break;
-	}
-	case ReadGroupLib::SPLACE_SU : {
-	  tmplink.wantdir=1;
-	  wantleft=true;
-	  wantright=true;
-	  break;
-	}
-	default : {
-	  BUGIFTHROW(true,"rgid.getSegmentPlacement() " << static_cast<int16>(rgid.getSegmentPlacementCode()) << " (" << rgid.getSegmentPlacement() << ") is unexpected here.");
-	}
-	}
-	// this is the logic for rdir < 0
-	if(rdir<0){
-	  tmplink.wantdir=-tmplink.wantdir;
-	  if(rgid.getSegmentPlacementCode() != ReadGroupLib::SPLACE_SU){
-	    wantleft=!wantleft;
-	    wantright=!wantright;
-	  }
-	}
-
-	// Good, we know where we want the partner to be, let's see whether we are at the correct distances
-	// If not, forget again about what we want
-	if(wanteddist>0){
-	  if(wantleft && endpos > wanteddist) wantleft=false;
-	  if(wantright && startpos < static_cast<int64>(con.getContigLength())-wanteddist) wantright=false;
-	}
-
-	// Yay, now store what we want ... and we may want both
-	tmplink.dir=rdir;
-	// tmplink.templateid=...
-	{
-	  auto tnI=SCA_tname2tid.find(actread.getTemplate());
-	  if(tnI==SCA_tname2tid.end()){
-	    tmplink.templateid=SCA_tname2tid.size();
-	    SCA_tname2tid.insert(pair<string,uint32>(actread.getTemplate(),tmplink.templateid));
-	  }else{
-	    tmplink.templateid=tnI->second;
-	  }
-	}
-
-	if(wantleft){
-	  tmplink.distance=startpos+endpos;
-	  SCA_readlinks.push_back(tmplink);
-	  CEBUG("Storing " << con.getContigName() << " left " << actread.getName() << " " << tmplink << endl);
-	}
-	if(wantright){
-	  tmplink.distance=con.getContigLength()-startpos;
-	  SCA_readlinks.push_back(tmplink);
-	  CEBUG("Storing " << con.getContigName() << " right " << actread.getName() << " " << tmplink << endl);
-	}
-      }
-    }
+    scaffinfo_t si;
+    SCA_scaffinfolist.push_back(si);
   }
+  scaffinfo_t & si=SCA_scaffinfolist.back();
+  si.contigname=con.getContigName();
 
   FUNCEND();
 }
-#define CEBUG(bla)
 
-
-void Scaffolder::dumpDebug()
-{
-  for(const auto & rlie : SCA_readlinks){
-    cout << rlie << endl;
-  }
-}
diff --git a/src/mira/scaffolder.H b/src/mira/scaffolder.H
index ca11478..d85aeaa 100644
--- a/src/mira/scaffolder.H
+++ b/src/mira/scaffolder.H
@@ -9,17 +9,17 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
 #ifndef _scaffolder_h_
@@ -30,54 +30,44 @@
 #include "stdinc/defines.H"
 #include "errorhandling/errorhandling.H"
 
-#include <unordered_map>
+#include "mira/contig.H"
+
 
-// fwd declaration of Contig so that contig.H does not need to be included
-//  by this .H
-class Contig;
 
 class Scaffolder
 {
   //struct
 private:
-  struct contiginfo_t {
-    std::string name;    // contigname;
-  };
+  struct linkinfo_t {
+    int32 readid;       // read id in readpool
+    int32 distance;     // distance from border of contig
 
-  struct placedcontig_t {
-    size_t contigid=0;
-    int8 dir=0;
-    int32 disttonextcontig=0;
-  };
-
-  struct scaffold_t {
-    std::vector<placedcontig_t> placedcontigs;
+    linkinfo_t() {
+      readid=-1;
+      distance=0;
+    }
   };
 
-  struct readlinkinfo_t {
-    size_t contigid=0;
-    size_t templateid=0;       // template id as created via MAF/CAF reading function
-    int32  distance=0;     // distance from border of contig
-    int8   dir=0;
-    int8   wantdir=0;
-
-    friend std::ostream & operator<<(std::ostream &ostr, readlinkinfo_t const &rli){
-      ostr << "cid: " << rli.contigid << "\ttid: " << rli.templateid
-	   << "\td: " << rli.distance
-	   << "\tdr: " << static_cast<int16>(rli.dir)
-	   << "\twdr: " << static_cast<int16>(rli.wantdir)
-	;
-      return ostr;
+  struct scaffinfo_t {
+    string contigname;
+    vector<linkinfo_t> linksleft;
+    vector<linkinfo_t> linksright;
+    bool leftwelllinked;
+    bool rightwelllinked;
+    bool leftlinktononrep;
+    bool rightlinktononrep;
+
+    scaffinfo_t(){
+      leftwelllinked=false;
+      rightwelllinked=false;
+      leftlinktononrep=false;
+      rightlinktononrep=false;
     }
   };
 
   //Variables
 private:
-  std::vector<contiginfo_t> SCA_contiginfo;     // index == contigid
-  std::vector<scaffold_t>   SCA_scaffolds;      // index == scaffoldid;
-  std::vector<readlinkinfo_t> SCA_readlinks;
-
-  std::unordered_map<std::string, uint32> SCA_tname2tid;
+  list<scaffinfo_t> SCA_scaffinfolist;
 
 public:
 
@@ -90,18 +80,15 @@ private:
 
 public:
   Scaffolder();
+  Scaffolder(Scaffolder const &other);
   ~Scaffolder();
 
-  Scaffolder(Scaffolder const &other) = delete;
-  Scaffolder const & operator=(Scaffolder const & other) = delete;
-
-  friend std::ostream & operator<<(std::ostream &ostr, Scaffolder const &sca);
+  Scaffolder const & operator=(Scaffolder const & other);
+  friend ostream & operator<<(ostream &ostr, Scaffolder const &sca);
 
   void discard();
 
   void storeInfoFreshContig(Contig & con);
-
-  void dumpDebug();
 };
 
 
diff --git a/src/mira/seqforfilter_phix174.solexa.xxd b/src/mira/seqforfilter_phix174.solexa.xxd
deleted file mode 100644
index e0a3096..0000000
--- a/src/mira/seqforfilter_phix174.solexa.xxd
+++ /dev/null
@@ -1,2 +0,0 @@
->phi-X174
-gagttttatcgcttccatgacgcagaagttaacactttcggatatttctgatgagtcgaaaaattatcttgataaagcaggaattactactgcttgtttacgaattaaatcgaagtggactgctggcggaaaatgagaaaattcgacctatccttgcgcagctcgagaagctcttactttgcgacctttcgccatcaactaacgattctgtcaaaaactgacgcgttggatgaggagaagtggcttaatatgcttggcacgttcgtcaaggactggtttagatatgagtcacattttgttcatggtagagattctcttgttgacattttaaaagagcgtggattactatctgagtccgatgctgttcaaccactaataggtaagaaatcatgagtcaagttactgaacaatccgtacgtttccagaccgctttggcctctattaagctcattcaggcttctgccgttttggatttaaccgaagatgatttcg [...]
diff --git a/src/mira/seqtohash.C b/src/mira/seqtohash.C
deleted file mode 100644
index 783ca90..0000000
--- a/src/mira/seqtohash.C
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 2005 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-
-#include "mira/seqtohash.H"
-
-const uint8 seqtohash::hashaddmatrix[256]=
-{
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-  0, 1, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0,  // 0x41 = A
-  0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-  0, 1, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0,   // 0x61 = a
-  0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-};
diff --git a/src/mira/seqtohash.H b/src/mira/seqtohash.H
deleted file mode 100644
index c560a43..0000000
--- a/src/mira/seqtohash.H
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 2005 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-#ifndef _seqtohash_h
-#define _seqtohash_h
-
-
-#include "stdinc/defines.H"
-
-class seqtohash
-{
-public:
-  static const uint8 hashaddmatrix[256];
-};
-
-
-/*************************************************************************
- *
- * To use these two macros, one needs to define
- *
- * const uint8 * seq
- * uint64        slen
- * const uint32  basesperhash
- * const char *  namestr
- *
- * In the loop, two variables may be of interest:
- *   VHASHT acthash   contains the sequence hash
- *   uint64 seqi      position of this hash + basesperhash
- *
- *************************************************************************/
-
-
-#define SEQTOHASH_LOOPSTART(VHASHT) \
-  BUGIFTHROW(basesperhash>sizeof(VHASHT)*4,"SEQTOHASH_LOOPSTART basesperhash " << static_cast<uint16>(basesperhash) << " > allowed size for VHASHT ?"); \
-{						\
-  VHASHT acthash(0);							\
-  VHASHT hashmask(1);							\
-  /* *grml* undefined behaviour of left shift for 64 shifts in a 64 bit type makes this cludge necessary */ \
-  /* the same for 32 shift in 32 bit types etc.pp */			\
-  if(basesperhash==sizeof(VHASHT)*4){					\
-    hashmask=0;								\
-  }else{								\
-    hashmask<<=(basesperhash*2);					\
-  }									\
-  --hashmask;								\
-									\
-  uint32  baseok=0;							\
-									\
-  for(uint64 seqi=0; likely(seqi<slen); ++seqi, ++seq){			\
-    acthash<<=2;							\
-    acthash&=hashmask;							\
-    ++baseok;								\
-									\
-    if(likely(::seqtohash::hashaddmatrix[*seq])){			\
-      acthash|=::seqtohash::hashaddmatrix[*seq]-1;			\
-    }else{								\
-      if(likely(dptools::isValidIUPACStarBase(*seq))) {			\
-        /* the IUPAC bases are treated like N and X */			\
-	/* break hash making (which is actually better than behaving */	\
-	/*  like another character in case of multiple bases with */	\
-	/*  IUPAC or '*') */						\
-	acthash=0;							\
-	baseok=0;							\
-      } else {								\
-	cout << "Illegal base '" << *seq << "' (ASCII " << static_cast<uint16>(*seq) << ") at position " << seqi << " in sequence "; \
-	if(namestr!=nullptr) {						\
-	  cout << namestr << endl;					\
-	}else{								\
-	  cout << "(no name given)" << endl;				\
-	}								\
-	exit(100);							\
-      }									\
-    }									\
-									\
-    if(likely(baseok >= basesperhash)) {
-
-
-#define SEQTOHASH_LOOPEND }}}
-
-
-#endif
diff --git a/src/mira/simple_2Dsignalprocessing.H b/src/mira/simple_2Dsignalprocessing.H
deleted file mode 100644
index d4349f4..0000000
--- a/src/mira/simple_2Dsignalprocessing.H
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 2013 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-
-#ifndef _mira_simplesignalproc_h_
-#define _mira_simplesignalproc_h_
-
-
-template <class PI>
-void erode(PI begin, PI end, uint32 thickness)
-{
-  auto counter=thickness;
-  for(; begin!=end; ++begin){
-    if(*begin){
-      if(counter){
-	*begin=0;
-	--counter;
-      }
-    }else{
-      counter=thickness;
-    }
-  }
-}
-
-template <class PI>
-void dilate(PI begin, PI end, uint32 thickness)
-{
-  uint32 counter=0;
-  for(; begin!=end; ++begin){
-    if(*begin){
-      counter=thickness;
-    }else{
-      if(counter){
-	*begin=1;
-	--counter;
-      }
-    }
-  }
-}
-
-
-template <class PI>
-void removeSmallPeaks(PI & peakindicator, uint32 minlen)
-{
-  auto start = peakindicator.begin();
-  while(start != peakindicator.end()){
-    if(*start){
-      auto end=start;
-      while(end != peakindicator.end() && *end) ++end;
-      //cout << "peak is " << end-start << endl;
-      if(end-start < minlen){
-	//cout << "delete\n";
-	for(; start != end; ++start){
-	  *start=0;
-	}
-      }
-      start=end;
-    }else{
-      ++start;
-    }
-  }
-}
-
-
-template <class PI>
-int64 distToFirstThreshold(PI begin, PI end, uint64 threshold)
-{
-  auto counter=0;
-  for(; begin!=end; ++begin, ++counter){
-    if(*begin>=threshold) return counter;
-  }
-  return -1;
-}
-
-#endif
diff --git a/src/mira/simplebloomfilter.C b/src/mira/simplebloomfilter.C
deleted file mode 100644
index 7697aad..0000000
--- a/src/mira/simplebloomfilter.C
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 2003 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-#include "simplebloomfilter.H"
-#include "util/dptools.H"
-
-using namespace std;
-
-
-// Plain vanilla constructor
-template<class TVHASH_T>
-SimpleBloomFilter<TVHASH_T>::SimpleBloomFilter(const uint8 bits, const uint32 numkeys)
-{
-  FUNCSTART("SimpleBloomFilter<TVHASH_T>::SimpleBloomFilter()");
-
-  cout << "initialising Simple Bloom Filter with " << static_cast<uint16>(bits) << " bits (" << (0x1ull<<bits) << " elements), " << (0x1ull<<bits)/8 << " bytes\n";
-
-  BUGIFTHROW(bits>64,"bits >64 ?");
-  BUGIFTHROW(numkeys==0||numkeys>20,"numkeys == " << numkeys << " ???");
-  BF_numkeys=numkeys;
-  BF_bfaddressmask=(0x1uLL<<bits)-1;
-  BF_bloomfield.resize((0x1ull<<bits)/8);
-  reset();
-
-  FUNCEND();
-}
-
-
-template<class TVHASH_T>
-SimpleBloomFilter<TVHASH_T>::~SimpleBloomFilter()
-{
-  FUNCSTART("SimpleBloomFilter<TVHASH_T>::~SimpleBloomFilter()");
-
-  discard();
-
-  FUNCEND();
-}
-
-
-template<class TVHASH_T>
-void SimpleBloomFilter<TVHASH_T>::discard()
-{
-  FUNCSTART("SimpleBloomFilter<TVHASH_T>::discard()");
-
-  BF_bloomfield.clear();
-  BF_level1count=0;
-  BF_numuniqkmers=0;
-  BF_numkmerseenge2=0;
-
-  FUNCEND();
-}
-
-template<class TVHASH_T>
-void SimpleBloomFilter<TVHASH_T>::reset()
-{
-  discard();
-  BF_bloomfield.resize(BF_bloomfield.capacity(),0);
-}
-
-
-
-
-// explicit template instantiations needed for the linker to create these for library files
-template class SimpleBloomFilter<vhash64_t>;
diff --git a/src/mira/simplebloomfilter.H b/src/mira/simplebloomfilter.H
deleted file mode 100644
index 075d9d2..0000000
--- a/src/mira/simplebloomfilter.H
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 2003 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-#ifndef _bas_simplebloomfilter_h_
-#define _bas_simplebloomfilter_h_
-
-#include <iostream>
-
-#include "stdinc/defines.H"
-#include "mira/vhash.H"
-#include "errorhandling/errorhandling.H"
-
-#if defined(_MSC_VER)
-#define FORCE_INLINE    __forceinline
-#else
-#define FORCE_INLINE __attribute__((always_inline))
-#endif
-
-
-template<class TVHASH_T>
-class SimpleBloomFilter
-{
-  //Variables
-private:
-  //static const bool BF_staticinitialiser;
-
-  std::vector<uint8> BF_bloomfield;
-  uint64        BF_bfaddressmask;
-
-  uint64        BF_level1count;
-
-  uint64        BF_numuniqkmers;  // probable num unique kmers
-  uint64        BF_numkmerseenge2;  // probable num kmers seen two or more times
-
-  uint32        BF_numkeys;
-
-public:
-
-
-  //Functions
-private:
-  void init();
-
-/*************************************************************************
- *
- * MurmurHash3_x64 variant:
- *  - 8 byte (64 bit) input (instead variable length)
- *  - seed is 64 bits (instead 32)
- *  - returning only 64 bits (instead 128)
- *
- * Code shamelessly copied and adapted from the copyright free code
- *  for Murmurhash3 by ... at http://code.google.com/p/smhasher/
- *
- *
- *************************************************************************/
-  inline uint64_t rotl64(uint64_t x, int8_t r) { return (x << r) | (x >> (64 - r)); }
-
-  FORCE_INLINE uint64 mmh3_64_8 ( const void * key, const uint64 seed ) {
-    uint64_t h1 = seed;
-    uint64_t h2 = seed;
-
-    const uint8_t * tail = static_cast<const uint8_t*>(key);
-
-    uint64_t k1 = uint64_t(tail[ 7]) << 56;
-    k1 ^= uint64_t(tail[ 6]) << 48;
-    k1 ^= uint64_t(tail[ 5]) << 40;
-    k1 ^= uint64_t(tail[ 4]) << 32;
-    k1 ^= uint64_t(tail[ 3]) << 24;
-    k1 ^= uint64_t(tail[ 2]) << 16;
-    k1 ^= uint64_t(tail[ 1]) << 8;
-    k1 ^= uint64_t(tail[ 0]) << 0;
-
-    k1 *= 0x87c37b91114253d5LLU;
-    k1  = rotl64(k1,31);
-    k1 *= 0x4cf5ad432745937fLLU;
-    h1 ^= k1;
-
-    h1 += h2;
-    h2 += h1;
-
-    h1 ^= h1 >> 33;
-    h1 *= 0xff51afd7ed558ccdLLU;
-    h1 ^= h1 >> 33;
-    h1 *= 0xc4ceb9fe1a85ec53LLU;
-    h1 ^= h1 >> 33;
-
-    h2 ^= h2 >> 33;
-    h2 *= 0xff51afd7ed558ccdLLU;
-    h2 ^= h2 >> 33;
-    h2 *= 0xc4ceb9fe1a85ec53LLU;
-    h2 ^= h2 >> 33;
-
-    h1 += h2;
-
-    return h1;
-  }
-
-public:
-  SimpleBloomFilter(const uint8 bits, const uint32 numhashes);
-  SimpleBloomFilter(SimpleBloomFilter const &other);
-  ~SimpleBloomFilter();
-
-  SimpleBloomFilter const & operator=(SimpleBloomFilter const & other);
-  friend std::ostream & operator<<(std::ostream &ostr, SimpleBloomFilter<TVHASH_T> const &bf) {
-    ostr << "SimpleBloomFilter:"
-	 << "\nmemory: " << bf.BF_bloomfield.size()
-	 << "\nkeys per kmer: " << bf.BF_numkeys
-	 << "\nl1 occupancy: " << bf.BF_level1count
-	 << "\nprobable num kmers    : " << bf.BF_numuniqkmers
-	 << "\n thereof num kmers>=2 : " << bf.BF_numkmerseenge2
-	 << std::endl;
-    return ostr;
-  }
-
-  void reset();
-  void discard();
-
-  uint64 getNumKMersSeenGE2() const { return BF_numkmerseenge2;}
-
-#define prefetchrl(p)     __builtin_prefetch((p), 0, 3)
-
-  FORCE_INLINE void prefetchVHash(TVHASH_T dnahash){
-    uint64 mmh3hash1=mmh3_64_8(&dnahash,0);
-    uint64 mmh3hash2=mmh3_64_8(&mmh3hash1,mmh3hash1);
-
-    uint64 mmh3ihash;
-    uint64 indexinbf;
-
-    for(uint16 numkeys=1; numkeys<=BF_numkeys; ++numkeys){
-      mmh3ihash=(mmh3hash1+numkeys*mmh3hash2)&BF_bfaddressmask;
-      indexinbf=mmh3ihash/8;
-      prefetchrl(&(BF_bloomfield[indexinbf]));
-    }
-  }
-
-/*************************************************************************
- *
- * retvalue=0 -> VHash was certainly not in filter before
- *         =1 -> VHash was perhaps at most once in filter
- *
- *************************************************************************/
-
-  FORCE_INLINE int addVHash(TVHASH_T dnahash){
-    int retvalue=0;
-    uint64 mmh3hash1=mmh3_64_8(&dnahash,0);
-    uint64 mmh3hash2=mmh3_64_8(&mmh3hash1,mmh3hash1);
-
-    uint16 setcounter=0;
-    uint64 mmh3ihash;
-    uint64 indexinbf;
-    uint32 bitinbf;
-
-    for(uint16 numkeys=1; numkeys<=BF_numkeys; ++numkeys){
-      mmh3ihash=(mmh3hash1+numkeys*mmh3hash2)&BF_bfaddressmask;
-      indexinbf=mmh3ihash/8;
-      bitinbf=static_cast<uint32>(mmh3ihash%8);
-      if(unlikely(BITTEST(bitinbf,BF_bloomfield[indexinbf]))) {
-	++setcounter;
-      }
-      BITSET(bitinbf,BF_bloomfield[indexinbf]);
-    }
-    BF_level1count+=BF_numkeys-setcounter;
-    //std::cout << std::hex << dnahash << std::dec << "\tBF_level1count " << BF_level1count << "\tsetc: " << setcounter << std::endl;
-    retvalue+=static_cast<int>(setcounter==BF_numkeys);
-    if(retvalue) {
-      ++BF_numkmerseenge2;
-    }else{
-      ++BF_numuniqkmers;
-    }
-    return retvalue;
-  }
-
-  FORCE_INLINE bool isPresentVHash(TVHASH_T dnahash){
-    bool retvalue=true;
-    uint64 mmh3hash1=mmh3_64_8(&dnahash,0);
-    uint64 mmh3hash2=mmh3_64_8(&mmh3hash1,mmh3hash1);
-
-    uint16 setcounter=0;
-    uint64 mmh3ihash;
-    uint64 indexinbf;
-    uint32 bitinbf;
-
-    for(uint16 numkeys=1; numkeys<=BF_numkeys; ++numkeys){
-      mmh3ihash=(mmh3hash1+numkeys*mmh3hash2)&BF_bfaddressmask;
-      indexinbf=mmh3ihash/8;
-      bitinbf=static_cast<uint32>(mmh3ihash%8);
-      if(!BITTEST(bitinbf,BF_bloomfield[indexinbf])) {
-	retvalue=true;
-	break;
-      }
-    }
-    return retvalue;
-  }
-
-
-
-};
-
-
-#endif
diff --git a/src/mira/skim.C b/src/mira/skim.C
old mode 100644
new mode 100755
index 4cb89e5..4b188fd
--- a/src/mira/skim.C
+++ b/src/mira/skim.C
@@ -7,36 +7,38 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- *
+ * 
+ * 
  */
 
+// 	$Id$	
 
-#include "mira/skim.H"
+#ifndef lint
+static char vcid[] = "$Id$";
+#endif /* lint */
 
 #include <boost/thread/thread.hpp>
 #include <boost/bind.hpp>
 
+#include <iostream>
+#include <math.h>
+
+
+#include "skim.H"
+
 #include "errorhandling/errorhandling.H"
 
-#include "util/fileanddisk.H"
-#include "util/dptools.H"
-#include "util/progressindic.H"
 
-#include "mira/ads.H"
-#include "mira/readpool.H"
-#include "mira/vhash.H"
 
-using namespace std;
 
 
 //#define CEBUGFLAG
@@ -53,28 +55,30 @@ using namespace std;
 //#define CEBUG(bla)   {cout << bla; cout.flush();}
 
 
-template<typename TVHASH_T>
-const TVHASH_T Skim<TVHASH_T>::SKIM3_MAXVHASHMASK(0xffffffUL);
+#define MAXVHASHMASK 0xFFFFFFLL
+
 
+#define MAXREADSIZEALLOWED 29900
+
+// 10G
+#define SKIMMATCHFIRSTCHECK 10737418240LL
+#define SKIMMATCHCHECKINCR 10737418240LL
+
+//#define SKIMMATCHFIRSTCHECK 200000
+//#define SKIMMATCHCHECKINCR 100000
+
+
+
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
 
-// sort id1 low to high,
-//  on same id1 by skimweight high to low,
-//  on same numhashes by id2 low to high
-//  on same id2 by eoffset low to high
-bool skimhitforsave_t::stdSortCmp(const skimhitforsave_t & a, const skimhitforsave_t & b)
+void Skim::foolCompiler()
 {
-  if(a.rid1 == b.rid1){
-    if(a.numhashes == b.numhashes){
-      if(a.rid2 == b.rid2){
-	return a.eoffset < b.eoffset;
-      }else{
-	return a.rid2 < b.rid2;
-      }
-    }else{
-      return a.numhashes > b.numhashes;
-    }
-  }
-  return a.rid1 < b.rid1;
+#include "stdinc/foolcompiler.C"
 }
 
 
@@ -86,10 +90,9 @@ bool skimhitforsave_t::stdSortCmp(const skimhitforsave_t & a, const skimhitforsa
  *************************************************************************/
 
 // Plain vanilla constructor
-template<typename TVHASH_T>
-Skim<TVHASH_T>::Skim()
+Skim::Skim()
 {
-  FUNCSTART("Skim<TVHASH_T>::Skim(ReadPool & rp)");
+  FUNCSTART("Skim::Skim(ReadPool & rp)");
 
   SKIM3_logflag_purgeunnecessaryhits=false;
   init();
@@ -98,23 +101,31 @@ Skim<TVHASH_T>::Skim()
 }
 
 
-template<typename TVHASH_T>
-void Skim<TVHASH_T>::init()
+void Skim::init()
 {
-  FUNCSTART("Skim<TVHASH_T>::init()");
+  FUNCSTART("Skim::init()");
+
+  SKIM3_possiblehits=0;
+  SKIM3_acceptedhits=0;
 
 
   SKIM3_numthreads=2;
   SKIM3_basesperhash=16;
   SKIM3_hashsavestepping=4;
+  //SKIM3_percentrequired=50;
   SKIM3_overlaplenrequired.clear();
-  for(uint32 i=0;i<ReadGroupLib::getNumSequencingTypes(); i++){
+  for(uint32 i=0;i<Read::getNumSequencingTypes(); i++){
     SKIM3_overlaplenrequired.push_back(20);
     SKIM3_percentrequired.push_back(50);
   }
 
+  SKIM3_totalpermbans=0;
   SKIM3_totalhitschosen=0;
 
+  //SKIM3_whpid_counter=0;
+
+  setHashFrequencyRatios(.4,1.6,2.0,8.0,20.0,static_cast<uint32>(100));
+
   FUNCEND()
 }
 
@@ -125,16 +136,58 @@ void Skim<TVHASH_T>::init()
  *
  *************************************************************************/
 
-template<typename TVHASH_T>
-Skim<TVHASH_T>::~Skim()
+Skim::~Skim()
 {
-  FUNCSTART("Skim<TVHASH_T>::~Skim()");
+  FUNCSTART("Skim::~Skim()");
   //  ERROR("Not implemented yet.");
 
   FUNCEND();
 }
 
 
+//// Copy constructor
+////  no discard needed as this object will be freshly created when
+////  called through this constructor
+//Skim::Skim(Skim const &other)
+//{
+//  FUNCSTART("Skim::Skim(Skim const &other)");
+//
+//  SKIM_valid=0;
+//
+//  *this=other;                               // call the copy operator
+//
+//  FUNCEND();
+//}
+//
+//
+//// Copy operator, needed by copy-constructor
+//Skim const & Skim::operator=(Skim const & other)
+//{
+//  FUNCSTART("Skim const & Skim::operator=(Skim const & other)");
+//  ERROR("Not implemented yet.");
+//  FUNCEND();
+//  return *this;
+//}
+
+
+
+
+///*************************************************************************
+// *
+// *
+// *
+// *
+// *************************************************************************/
+//
+//ostream & operator<<(ostream &ostr, Skim const &theskim)
+//{
+//  FUNCSTART("friend ostream & Skim::operator<<(ostream &ostr, const  &theskim)");
+//  //  ERROR("Not implemented yet.");
+//
+//  FUNCEND();
+//  return ostr;
+//}
+
 
 /*************************************************************************
  *
@@ -143,10 +196,9 @@ Skim<TVHASH_T>::~Skim()
  *
  *************************************************************************/
 
-template<typename TVHASH_T>
-void Skim<TVHASH_T>::discard()
+void Skim::discard()
 {
-  FUNCSTART("Skim<TVHASH_T>::discard()");
+  FUNCSTART("Skim::discard()");
 
   FUNCEND();
 }
@@ -155,6 +207,29 @@ void Skim<TVHASH_T>::discard()
 
 /*************************************************************************
  *
+ *
+ *
+ *
+ *************************************************************************/
+
+void Skim::setHashFrequencyRatios(double freqest_minnormal,
+			    double freqest_maxnormal,
+			    double freqest_repeat,
+			    double freqest_heavyrepeat,
+			    double freqest_crazyrepeat,
+			    uint32 nastyrepeatratio)
+{
+  SKIM3_freqest_minnormal=freqest_minnormal;
+  SKIM3_freqest_maxnormal=freqest_maxnormal;	
+  SKIM3_freqest_repeat=freqest_repeat;	
+  SKIM3_freqest_heavyrepeat=freqest_heavyrepeat;
+  SKIM3_freqest_crazyrepeat=freqest_crazyrepeat;
+  SKIM3_nastyrepeatratio=nastyrepeatratio;
+}
+
+
+/*************************************************************************
+ *
  * returns number of megahubs
  *
  *
@@ -162,34 +237,30 @@ void Skim<TVHASH_T>::discard()
 
 //#define CEBUG(bla)   {cout << bla; cout.flush();}
 
-template<typename TVHASH_T>
-uint32 Skim<TVHASH_T>::skimGo(ReadPool & rp,
+uint32 Skim::skimGo(ReadPool & rp, 
 		    string               & posfmatchname,
 		    string               & poscmatchname,
+		    string               & megahublogname,
 		    bannedoverlappairs_t & bannedoverlaps,
 		    vector<uint32>       & overlapcounter,
 		    vector<uint32>       & writtenhitsperid,
+//		    vector<uint32>       & rawhashhitcounter,
 		    vector<int32>        & chuntleftcut,
 		    vector<int32>        & chuntrightcut,
-		    vector<vector<uint8>>        & overlapcritlevell,
-		    vector<vector<uint8>>        & overlapcritlevelr,
-		    vector<uint8>        * meghubsptr,
+		    vector<uint8>        & overlapcritlevell,
+		    vector<uint8>        & overlapcritlevelr,
 		    uint32 numthreads,
 		    uint32 maxmemusage,
 		    bool onlyagainstrails,
 		    bool alsocheckreverse,
-		    uint32 basesperhash,
+		    uint8  bph,
 		    uint8  hss,
+		    //int32  percentrequired,
 		    const vector<int32> & percentrequired,
 		    const vector<int32> & overlaplenrequired,
-		    uint32 maxhitsperread,
-		    uint32 megahubcap,
-		    bool forcetakestronggood)
+		    uint32 maxhitsperread)
 {
-  FUNCSTART("uint32 Skim<TVHASH_T>::skimGo( ... )");
-
-  BUGIFTHROW(posfmatchname.empty(),"posfmatchname.empty() ???");
-  BUGIFTHROW(poscmatchname.empty(),"poscmatchname.empty() ???");
+  FUNCSTART("uint32 Skim::skimGo( ... )");
 
   dateStamp(cout);
   Read::setCoutType(Read::AS_CLIPPEDFASTA);
@@ -202,44 +273,35 @@ uint32 Skim<TVHASH_T>::skimGo(ReadPool & rp,
   if(SKIM3_numthreads<1) SKIM3_numthreads=1;
   if(SKIM3_numthreads>256) SKIM3_numthreads=256;
 
-  if(megahubcap<150000) megahubcap=150000;
-  SKIM3_megahubcap=megahubcap;
-
   // if extalso is true, the take not only the clipped sequence, but
   //  also the extends to it
 
   SKIM3_onlyagainstrails=onlyagainstrails;
 
-  if(basesperhash > sizeof(TVHASH_T)*4){
-    basesperhash= sizeof(TVHASH_T)*4;
+  if(sizeof(vhash_t)==4){
+    if(bph>16) bph=16;
   }
-  SKIM3_basesperhash=basesperhash;
+  if(sizeof(vhash_t)==8){
+    if(bph>32) bph=32;
+  }
+  SKIM3_basesperhash=bph;
   SKIM3_hashsavestepping=hss;
   SKIM3_percentrequired=percentrequired;
   SKIM3_overlaplenrequired=overlaplenrequired;
   SKIM3_maxhitsperread=maxhitsperread;
-  SKIM3_forcetakestronggood=forcetakestronggood;
-
-  SKIM3_overlapcritlevelvl=&overlapcritlevell;
-  SKIM3_overlapcritlevelvr=&overlapcritlevelr;
 
-  SKIM3_megahubsptr=meghubsptr;
+  SKIM3_overlapcritlevell=&overlapcritlevell;
+  SKIM3_overlapcritlevelr=&overlapcritlevelr;
 
   // TODO: check whether these can be re-used between assembly passes
   //  would reduce skim files even a bit further in later passes
   //  Question: can an overlap criterion level become worse through editing???
-  SKIM3_overlapcritlevelvl->clear();
-  SKIM3_overlapcritlevelvl->resize(2);
-  (*SKIM3_overlapcritlevelvl)[0].resize(SKIM3_readpool->size(),255);
-  (*SKIM3_overlapcritlevelvl)[1].resize(SKIM3_readpool->size(),255);
-  SKIM3_overlapcritlevelvr->clear();
-  SKIM3_overlapcritlevelvr->resize(2);
-  (*SKIM3_overlapcritlevelvr)[0].resize(SKIM3_readpool->size(),255);
-  (*SKIM3_overlapcritlevelvr)[1].resize(SKIM3_readpool->size(),255);
+  SKIM3_overlapcritlevell->clear();
+  SKIM3_overlapcritlevell->resize(SKIM3_readpool->size(),255);
+  SKIM3_overlapcritlevelr->clear();
+  SKIM3_overlapcritlevelr->resize(SKIM3_readpool->size(),255);
   SKIM3_largestencasementscoretodate.clear();
   SKIM3_largestencasementscoretodate.resize(SKIM3_readpool->size(),0);
-  SKIM3_nomorehitseie.clear();
-  SKIM3_nomorehitseie.resize(SKIM3_readpool->size(),0);
 
   SKIM3_overlapcounter=&overlapcounter;
   SKIM3_overlapcounter->clear();
@@ -248,7 +310,7 @@ uint32 Skim<TVHASH_T>::skimGo(ReadPool & rp,
   SKIM3_writtenhitsperid=&writtenhitsperid;
   SKIM3_writtenhitsperid->clear();
 
-  SKIM3_posfmatchnextchecksize=SKIM3_SKIMMATCHFIRSTCHECK;
+  SKIM3_posfmatchnextchecksize=SKIMMATCHFIRSTCHECK;
   SKIM3_poscmatchnextchecksize=SKIM3_posfmatchnextchecksize;
 
   SKIM3_bannedoverlaps=&bannedoverlaps;
@@ -278,8 +340,8 @@ uint32 Skim<TVHASH_T>::skimGo(ReadPool & rp,
   SKIM3_poscmatchfname=poscmatchname;
   SKIM3_poscmatchfout.open(poscmatchname.c_str(), ios::out| ios::trunc | ios::binary);
 
-  //ofstream mout;
-  //mout.open(megahublogname.c_str(), ios::out| ios::trunc);
+  ofstream mout;
+  mout.open(megahublogname.c_str(), ios::out| ios::trunc);    
 
   uint32 numpartitions=computePartition(maxmemusage*SKIM3_hashsavestepping,true);
 
@@ -289,111 +351,86 @@ uint32 Skim<TVHASH_T>::skimGo(ReadPool & rp,
 
   CEBUG("Progressend: " << SKIM_progressend << endl);
 
-  if(SKIM3_megahubsptr!=nullptr){
-    SKIM3_megahubsptr->clear();
-    SKIM3_megahubsptr->resize(SKIM3_readpool->size(),0);
-  }
+  SKIM3_megahubs.resize(SKIM3_readpool->size(),0);
   SKIM3_fullencasedcounter.resize(SKIM3_readpool->size(),0);
 
   fillTagStatusInfoOfReads();
 
-  if(0){
-  }else{
-    cout << "Now running threaded and partitioned skimmer-" << SKIM3_basesperhash << " with " << numpartitions << " partitions in " << SKIM3_numthreads << " threads:" << endl;
-
-    SKIM_progressindicator= new ProgressIndicator<int64>(0,SKIM_progressend);
-
-    SKIM3_vhraparray.clear();
-    for(uint32 actpartition=1; actpartition<=numpartitions; actpartition++){
-      CEBUG("\nWorking on partition " << actpartition << "/" << numpartitions << endl);
-
-      computePartition(maxmemusage*SKIM3_hashsavestepping,false);
-
-      CEBUG("Will contain read IDs " << SKIM_partfirstreadid << " to " << SKIM_partlastreadid-1 << endl);
-
-      prepareSkim(SKIM_partfirstreadid, SKIM_partlastreadid, SKIM3_vhraparray,true);
-      if(!SKIM3_vhraparray.empty()){
-	CEBUG("Checking forward hashes" << endl);
-	startMultiThreading(1,
+  cout << "Now running threaded and partitioned skimmer with " << numpartitions << " partitions in " << SKIM3_numthreads << " threads:" << endl;
+
+  SKIM_progressindicator= new ProgressIndicator<int64>(0,SKIM_progressend);
+
+  SKIM3_vhraparray.clear();
+  for(uint32 actpartition=1; actpartition<=numpartitions; actpartition++){
+    CEBUG("\nWorking on partition " << actpartition << "/" << numpartitions << endl);
+
+    computePartition(maxmemusage*SKIM3_hashsavestepping,false);
+    
+    CEBUG("Will contain read IDs " << SKIM_partfirstreadid << " to " << SKIM_partlastreadid-1 << endl);
+
+    prepareSkim(SKIM_partfirstreadid, SKIM_partlastreadid, SKIM3_vhraparray,true);
+    if(!SKIM3_vhraparray.empty()){
+      CEBUG("Checking forward hashes" << endl);
+      startMultiThreading(1,
+			  SKIM3_numthreads,
+			  5000,
+			  SKIM_partfirstreadid,
+			  SKIM3_readpool->size(),
+			  boost::bind( &Skim::cfhThreadsDataInit, this, _1 ),
+			  boost::bind( &Skim::cfhThreadLoop, this, _1 ));
+      purgeMatchFileIfNeeded(1);
+      if(alsocheckreverse){
+	CEBUG("Checking reverse hashes" << endl);
+	startMultiThreading(-1,
 			    SKIM3_numthreads,
 			    5000,
 			    SKIM_partfirstreadid,
 			    SKIM3_readpool->size(),
-			    boost::bind( &Skim<TVHASH_T>::cfhThreadsDataInit, this, _1 ),
-			    boost::bind( &Skim<TVHASH_T>::cfhThreadLoop, this, _1 ));
-	purgeMatchFileIfNeeded(1);
-	if(alsocheckreverse){
-	  CEBUG("Checking reverse hashes" << endl);
-	  startMultiThreading(-1,
-			      SKIM3_numthreads,
-			      5000,
-			      SKIM_partfirstreadid,
-			      SKIM3_readpool->size(),
-			      boost::bind( &Skim<TVHASH_T>::cfhThreadsDataInit, this, _1 ),
-			      boost::bind( &Skim<TVHASH_T>::cfhThreadLoop, this, _1 ));
-	  purgeMatchFileIfNeeded(-1);
-	}
-	CEBUG("Done." << endl);
+			    boost::bind( &Skim::cfhThreadsDataInit, this, _1 ),
+			    boost::bind( &Skim::cfhThreadLoop, this, _1 ));
+	purgeMatchFileIfNeeded(-1);
       }
-
-      SKIM_partfirstreadid=SKIM_partlastreadid;
+      CEBUG("Done." << endl);
     }
 
-    SKIM_progressindicator->finishAtOnce();
-    delete SKIM_progressindicator;
-    cout << " done.\n";
+    SKIM_partfirstreadid=SKIM_partlastreadid;
   }
 
+  SKIM_progressindicator->finishAtOnce();
+
+  cout << " done.\n";
+
   SKIM3_posfmatchfout.close();
   SKIM3_poscmatchfout.close();
 
   SKIM3_writtenhitsperid->resize(SKIM3_readpool->size(),0);
-
-  {
-    vector<uint8> perfectrailmatches;
-    bool hasrails=false;
-    for(uint32 ri=0; ri<SKIM3_readpool->size(); ++ri){
-      if(SKIM3_readpool->getRead(ri).isRail()){
-	hasrails=true;
-	break;
-      }
-    }
-    if(hasrails){
-      perfectrailmatches.resize(SKIM3_readpool->size(),0);
-      findPerfectRailMatchesInSkimFile(SKIM3_posfmatchfname,1,perfectrailmatches);
-      findPerfectRailMatchesInSkimFile(SKIM3_poscmatchfname,-1,perfectrailmatches);
-    }
-    purgeUnnecessaryHitsFromSkimFile(SKIM3_posfmatchfname,1,perfectrailmatches);
-    purgeUnnecessaryHitsFromSkimFile(SKIM3_poscmatchfname,-1,perfectrailmatches);
-  }
-
-  for(uint32 i=0; i<SKIM3_writtenhitsperid->size(); ++i){
-    SKIM3_totalhitschosen+=(*SKIM3_writtenhitsperid)[i];
-  }
+  purgeUnnecessaryHitsFromSkimFile(SKIM3_posfmatchfname,1);
+  purgeUnnecessaryHitsFromSkimFile(SKIM3_poscmatchfname,-1);
 
   uint32 megahubs=0;
 
-  if(SKIM3_megahubsptr!=nullptr){
-    for(uint32 mhi=0; mhi<SKIM3_megahubsptr->size(); mhi++){
-      if((*SKIM3_megahubsptr)[mhi]>0) {
-	megahubs++;
-      }
+  for(uint32 i=0; i<SKIM3_megahubs.size(); i++){
+    if(SKIM3_megahubs[i]>0) {
+      megahubs++;
+      mout << SKIM3_readpool->getRead(i).getName() << '\n';
     }
   }
-  //cout << "\nSkim summary:\n\taccepted: " << SKIM3_acceptedhits << "\n\tpossible: " << SKIM3_possiblehits  << "\n\tpermbans: " << SKIM3_totalpermbans;
+  cout << "\nSkim summary:\n\taccepted: " << SKIM3_acceptedhits << "\n\tpossible: " << SKIM3_possiblehits  << "\n\tpermbans: " << SKIM3_totalpermbans;
   cout << "\n\nHits chosen: " << SKIM3_totalhitschosen << "\n\n";
 
-//  mout.close();
+  mout.close();
   dateStamp(cout);
 
   cout << endl;
 
+  delete SKIM_progressindicator;
+
   if(SKIM3_chimerahunt.size()){
     chimeraHuntLocateChimeras();
   }
 
 
-
+  
   FUNCEND();
   return megahubs;
 }
@@ -410,28 +447,27 @@ uint32 Skim<TVHASH_T>::skimGo(ReadPool & rp,
  *
  *************************************************************************/
 
-template<typename TVHASH_T>
-void Skim<TVHASH_T>::fillTagStatusInfoOfReads()
+void Skim::fillTagStatusInfoOfReads()
 {
   SKIM3_hasMNRr.clear();
   SKIM3_hasSRMr.clear();
-  SKIM3_hasFpas.clear();
+  SKIM3_hasFpAS.clear();
   SKIM3_hasMNRr.resize(SKIM3_readpool->size(),0);
   SKIM3_hasSRMr.resize(SKIM3_readpool->size(),0);
-  SKIM3_hasFpas.resize(SKIM3_readpool->size(),0);
+  SKIM3_hasFpAS.resize(SKIM3_readpool->size(),0);
 
   for(uint32 actreadid=0; actreadid<SKIM3_readpool->size(); actreadid++){
     for(uint32 tn=0; tn<SKIM3_readpool->getRead(actreadid).getNumOfTags(); tn++){
       if(SKIM3_readpool->getRead(actreadid).getTag(tn).identifier==Read::REA_tagentry_idMNRr) SKIM3_hasMNRr[actreadid]=1;
       if(SKIM3_readpool->getRead(actreadid).getTag(tn).identifier==Read::REA_tagentry_idSRMr) SKIM3_hasSRMr[actreadid]=1;
-      if(SKIM3_readpool->getRead(actreadid).getTag(tn).identifier==Read::REA_tagentry_idSOFApolyA_sequence) SKIM3_hasFpas[actreadid]=1;
+      if(SKIM3_readpool->getRead(actreadid).getTag(tn).identifier==Read::REA_tagentry_idFpAS) SKIM3_hasFpAS[actreadid]=1;
     }
   }
 }
 
 /*************************************************************************
  *
- * computes either
+ * computes either 
  *  - starting from the first read id, the last read id to use for the
  *    next partition (SKIM_partfirstreadid and SKIM_partlastreadid)
  * or
@@ -447,10 +483,9 @@ void Skim<TVHASH_T>::fillTagStatusInfoOfReads()
 //#define CEBUG(bla)   {cout << bla; cout.flush();}
 //#define CEBUGF(bla)  {cout << bla; cout.flush();}
 
-template<typename TVHASH_T>
-uint32 Skim<TVHASH_T>::computePartition(uint32 maxmemusage, bool computenumpartitions)
+uint32 Skim::computePartition(uint32 maxmemusage, bool computenumpartitions)
 {
-  FUNCSTART("uint32 Skim<TVHASH_T>::computePartition(uint32 maxmemusage, bool computenumpartitions)");
+  FUNCSTART("uint32 Skim::computePartition(uint32 maxmemusage, bool computenumpartitions)");
 
   uint32 numpartitions=0;
   uint32 totalseqlen=0;
@@ -461,13 +496,13 @@ uint32 Skim<TVHASH_T>::computePartition(uint32 maxmemusage, bool computenumparti
   if(computenumpartitions) {
     SKIM_progressend=SKIM3_readpool->size()-SKIM_partlastreadid;
   }
-
+  
   for(; SKIM_partlastreadid<SKIM3_readpool->size(); SKIM_partlastreadid++) {
     if(!SKIM3_readpool->getRead(SKIM_partlastreadid).hasValidData()
-       || !SKIM3_readpool->getRead(SKIM_partlastreadid).isUsedInAssembly()) continue;
+       || !SKIM3_readpool->getRead(SKIM_partlastreadid).isUsedInAssembly()) continue; 
 
-    if(SKIM3_readpool->getRead(SKIM_partlastreadid).getLenClippedSeq() > SKIM3_MAXREADSIZEALLOWED) {
-      MIRANOTIFY(Notify::FATAL,"Read " << SKIM3_readpool->getRead(SKIM_partlastreadid).getName() << " is longer than SKIM3_MAXREADSIZEALLOWED (" << SKIM3_MAXREADSIZEALLOWED << ") bases. SKIM cannot handle this, aborting.\n");
+    if(SKIM3_readpool->getRead(SKIM_partlastreadid).getLenClippedSeq() > MAXREADSIZEALLOWED) {
+      MIRANOTIFY(Notify::FATAL,"Read " << SKIM3_readpool->getRead(SKIM_partlastreadid).getName() << " is longer than MAXREADSIZEALLOWED (" << MAXREADSIZEALLOWED << ") bases. SKIM cannot handle this, aborting.\n");
     }
 
     maxseqlen=max(maxseqlen,SKIM3_readpool->getRead(SKIM_partlastreadid).getLenClippedSeq());
@@ -476,14 +511,14 @@ uint32 Skim<TVHASH_T>::computePartition(uint32 maxmemusage, bool computenumparti
     //if(SKIM_takeextalso){
     //  totalseqlen+=SKIM3_readpool->getRead(SKIM_partlastreadid).getRightExtend();
     //}
-
+    
     if(totalseqlen>maxmemusage) {
       if(computenumpartitions){
 	totalseqlen=0;
 	numpartitions++;
-
+	
 	SKIM_progressend+=SKIM3_readpool->size()-SKIM_partlastreadid;
-
+	
       }else{
 	SKIM_partlastreadid++;
 	break;
@@ -498,10 +533,10 @@ uint32 Skim<TVHASH_T>::computePartition(uint32 maxmemusage, bool computenumparti
     }
     SKIM_progressend*=2;
   }
-
+  
   //// Compute SKIM_maxoffsets
   //if(maxseqlen>0){
-  //  // this beauty is slow, but a cute hack to find out the number of
+  //  // this beauty is slow, but a cute hack to find out the number of 
   //  //  the highest bit which power of two fits the given value
   //  // e.g. 1024 -> 10 -> 2^10 = 1024 fits 1024
   //  //      1025 -> 11 -> 2^11 = 2048 fits 1025
@@ -520,6 +555,32 @@ uint32 Skim<TVHASH_T>::computePartition(uint32 maxmemusage, bool computenumparti
   return numpartitions;
 }
 
+		       
+
+
+
+/*************************************************************************
+ *
+ * sorter to sort from low to high, but lower 24bit grouped
+ *
+ *
+ *************************************************************************/
+
+inline bool Skim__sortVHRAPArray_(const vhrap_t & a, 
+			    const vhrap_t & b);
+inline bool Skim__sortVHRAPArray_(const vhrap_t & a, const vhrap_t & b)
+{
+  ////if(a.vhash == b.vhash) {
+  ////  return a.readid < b.readid;
+  ////}
+  //return a.vhash < b.vhash;
+  
+  if((a.vhash & MAXVHASHMASK) != (b.vhash & MAXVHASHMASK)) {
+    return (a.vhash & MAXVHASHMASK) < (b.vhash & MAXVHASHMASK);
+  }
+  return a.vhash < b.vhash;
+}
+
 
 
 
@@ -533,10 +594,9 @@ uint32 Skim<TVHASH_T>::computePartition(uint32 maxmemusage, bool computenumparti
 
 //#define CEBUG(bla)   {cout << bla; cout.flush();}
 
-template<typename TVHASH_T>
-void Skim<TVHASH_T>::prepareSkim(uint32 fromid, uint32 toid, vector<typename HashStatistics<TVHASH_T>::vhrap_t> & vhraparray, bool assemblychecks)
+void Skim::prepareSkim(uint32 fromid, uint32 toid, vector<vhrap_t> & vhraparray, bool assemblychecks)
 {
-  FUNCSTART("void Skim<TVHASH_T>::prepareSkim(bool alsocheckreverse)");
+  FUNCSTART("void Skim::prepareSkim(bool alsocheckreverse)");
 
   vhraparray.clear();
 
@@ -547,19 +607,19 @@ void Skim<TVHASH_T>::prepareSkim(uint32 fromid, uint32 toid, vector<typename Has
     if(!SKIM3_readpool->getRead(seqnr).hasValidData()) continue;
     if(assemblychecks
        && (!SKIM3_readpool->getRead(seqnr).isUsedInAssembly()
-	   || (SKIM3_onlyagainstrails && !SKIM3_readpool->getRead(seqnr).isRail()))) continue;
+	   || (SKIM3_onlyagainstrails && !SKIM3_readpool->getRead(seqnr).isRail()))) continue; 
     totalseqlen+=SKIM3_readpool->getRead(seqnr).getLenClippedSeq();
     totalseqs++;
     //if(SKIM_takeextalso) totalseqlen+=SKIM3_readpool->getRead(i).getRightExtend();
   }
-
+  
   //dateStamp(cout);
   CEBUG("\nPreparing skim data: "  << fromid << " to " << toid << endl);
   CEBUG(totalseqs << " sequences to skim, totalling " << totalseqlen << " bases." << endl);
 
 
   // next loop:
-  //  transform each read into a series of forward
+  //  transform each read into a series of forward 
   //   hashes, store them into the array along with info whether
   //   each hash position is valid or not,
   //  also store the info how many hashes each sequence produced
@@ -569,9 +629,9 @@ void Skim<TVHASH_T>::prepareSkim(uint32 fromid, uint32 toid, vector<typename Has
   if(totalseqlen>0){
 
     vhraparray.resize(totalseqlen/SKIM3_hashsavestepping);
-    auto vhraparrayI=vhraparray.begin();
+    vector<vhrap_t>::iterator vhraparrayI=vhraparray.begin();
     vector<uint8> tagmaskvector;
-
+    
     //ProgressIndicator P(partfirstreadid, partlastreadid);
     for(uint32 seqnr=fromid; seqnr < toid; seqnr++){
       //P.progress(seqnr);
@@ -579,15 +639,15 @@ void Skim<TVHASH_T>::prepareSkim(uint32 fromid, uint32 toid, vector<typename Has
       if(!actread.hasValidData()) continue;
       if(assemblychecks
 	 && (!SKIM3_readpool->getRead(seqnr).isUsedInAssembly()
-	     || (SKIM3_onlyagainstrails && !SKIM3_readpool->getRead(seqnr).isRail()))) continue;
-
+	     || (SKIM3_onlyagainstrails && !SKIM3_readpool->getRead(seqnr).isRail()))) continue; 
+      
       uint32 slen=actread.getLenClippedSeq();
       //if(SKIM_takeextalso) slen+=actread.getRightExtend();
-
+      
       const vector<Read::bposhashstat_t> & bposhashstats=actread.getBPosHashStats();
       int32 bfpos=actread.calcClippedPos2RawPos(0);
       int32 bfposinc=1;
-
+      
       if(slen>=8) {
 	fillTagMaskVector(seqnr, tagmaskvector);
 	uint32 hashesmade= transformSeqToVariableHash(
@@ -604,41 +664,41 @@ void Skim<TVHASH_T>::prepareSkim(uint32 fromid, uint32 toid, vector<typename Has
 	  bfpos,
 	  bfposinc
 	  );
-
+	
 	//CEBUG(seqnr << "\t" << totalhashes << "\t" << slen << endl);
 	totalhashes+=hashesmade;
       }
     }
-
+    
     //P.progress(partlastreadid);
     CEBUG("Totalseqlen " << totalseqlen << endl);
     CEBUG("Computed " << totalhashes << " linkpoints." << endl);
-
+    
     if(totalhashes>0){
       CEBUG("Resizing array" << endl);
       vhraparray.resize(totalhashes);
-
+      
       if(0){
 	CEBUG("Partition unsorted:\n");
-	auto vaI=vhraparray.cbegin();
+	vector<vhrap_t>::const_iterator vaI=vhraparray.begin();
 	for(; vaI!=vhraparray.end(); vaI++){
 	  cout << *vaI << '\n';
 	}
 	cout << "###########################" << endl;
       }
-
+      
       CEBUG("Sorting array" << endl);
-      sort(vhraparray.begin(), vhraparray.end(), Skim<TVHASH_T>::sortVHRAPArrayElem_);
-
+      sort(vhraparray.begin(), vhraparray.end(), Skim__sortVHRAPArray_);
+      
       if(0){
 	CEBUG("Partition sorted:\n");
-	auto vaI=vhraparray.begin();
+	vector<vhrap_t>::const_iterator vaI=vhraparray.begin();
 	for(; vaI!=vhraparray.end(); vaI++){
 	  cout << *vaI << '\n';
 	}
 	cout << "###########################" << endl;
       }
-
+      
     }
   }
 
@@ -658,14 +718,13 @@ void Skim<TVHASH_T>::prepareSkim(uint32 fromid, uint32 toid, vector<typename Has
  *
  *************************************************************************/
 
-template<typename TVHASH_T>
-void Skim<TVHASH_T>::purgeMatchFileIfNeeded(int8 direction)
+void Skim::purgeMatchFileIfNeeded(int8 direction)
 {
-  FUNCSTART("void Skim<TVHASH_T>::purgeMatchFileIfNeeded(int8 direction)");
+  FUNCSTART("void Skim::purgeMatchFileIfNeeded(int8 direction)");
 
-  ofstream * posmatchfout=nullptr;
-  string * fname=nullptr;
-  uint64 * nextchecksize=nullptr;
+  ofstream * posmatchfout=NULL;
+  string * fname=NULL;
+  uint64 * nextchecksize=NULL;
   if(direction>0){
     posmatchfout=&SKIM3_posfmatchfout;
     fname=&SKIM3_posfmatchfname;
@@ -676,21 +735,18 @@ void Skim<TVHASH_T>::purgeMatchFileIfNeeded(int8 direction)
     nextchecksize=&SKIM3_poscmatchnextchecksize;
   }
 
-  BUGIFTHROW(fname->empty(),"fname->empty() ???");
-
   if(posmatchfout->tellp() >= *nextchecksize){
-    (*nextchecksize)+=SKIM3_SKIMMATCHCHECKINCR;
+    (*nextchecksize)+=SKIMMATCHCHECKINCR;
 
     posmatchfout->close();
-    vector<uint8> dummy;
-    purgeUnnecessaryHitsFromSkimFile(*fname,direction,dummy);
-
+    purgeUnnecessaryHitsFromSkimFile(*fname,direction);
+    
     posmatchfout->open(fname->c_str(), ios::out|ios::app);
     if(!posmatchfout){
       MIRANOTIFY(Notify::FATAL, "Could not reopen SKIM match file " << *fname);
     }
     if(posmatchfout->tellp() >= *nextchecksize){
-      (*nextchecksize)=SKIM3_SKIMMATCHCHECKINCR+posmatchfout->tellp();
+      (*nextchecksize)=SKIMMATCHCHECKINCR+posmatchfout->tellp();
     }
   }
 
@@ -700,89 +756,6 @@ void Skim<TVHASH_T>::purgeMatchFileIfNeeded(int8 direction)
 
 /*************************************************************************
  *
- * Go through written skim hits on disk.
- *
- *************************************************************************/
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-template<typename TVHASH_T>
-void Skim<TVHASH_T>::findPerfectRailMatchesInSkimFile(string & filename, const int8 rid2dir, vector<uint8> & prmatches)
-{
-  FUNCSTART("void Skim<TVHASH_T>::findPerfectRailMatchesInSkimFile(string & filename, const int8 rid2dir, vector<uint8> & prmatches)");
-
-  // temporary skim container
-  vector<skimhitforsave_t> tsc;
-
-  FILE * finfout;
-  finfout = fopen(filename.c_str(),"r+");
-  if(finfout == nullptr) {
-    MIRANOTIFY(Notify::FATAL, "File not found: " << filename);
-  }
-
-  //// which reads have a perfect rail match?
-  //vector<uint8> prmatches;
-  //prmatches.resize(SKIM3_readpool->size(),0);
-
-  myFSeek(finfout, 0, SEEK_END);
-  streamsize finsize=myFTell(finfout);
-  rewind(finfout);
-
-  uint64 lineno=0;
-
-  ADSEstimator adse;
-
-  long freadpos=0;
-  long fwritepos=0;
-
-  while(!feof(finfout)){
-    tsc.resize(500000);
-    myFSeek(finfout, freadpos, SEEK_SET);
-
-    auto numread=myFRead(&tsc[0],sizeof(skimhitforsave_t),tsc.capacity(),finfout);
-
-    if(numread==0) break;
-    CEBUG("rsh4_pUHFNSF: read " << numread << endl;)
-    lineno+=numread;
-
-    freadpos=myFTell(finfout);
-    CEBUG("new freadpos: " << freadpos << endl);
-
-    if(numread<tsc.capacity()) tsc.resize(numread);
-
-    vector<skimhitforsave_t>::const_iterator readI=tsc.begin();
-
-    for(; readI != tsc.end(); ++readI){
-      // one of both must be rail
-      if((*SKIM3_readpool)[readI->rid1].isRail()
-	 ||(*SKIM3_readpool)[readI->rid2].isRail()){
-	// but not both
-	if(!((*SKIM3_readpool)[readI->rid1].isRail() && (*SKIM3_readpool)[readI->rid2].isRail())){
-	    // we want a perfect match, i.e. 100%
-	  if(readI->percent_in_overlap == 100){
-	    adse.calcNewEstimateFromSkim(
-	      readI->eoffset,
-	      (*SKIM3_readpool)[readI->rid1].getLenClippedSeq(),
-	      (*SKIM3_readpool)[readI->rid2].getLenClippedSeq(),
-	      readI->rid1,
-	      readI->rid2,
-	      1,
-	      rid2dir);
-	    if(adse.getContainmentLevel()!=0){
-	      uint32 railid=readI->rid1;
-	      uint32 nreadid=readI->rid2;
-	      if((*SKIM3_readpool)[readI->rid2].isRail()){
-		swap(railid,nreadid);
-	      }
-	      prmatches[nreadid]=1;
-	    }
-	  }
-	}
-      }
-    }
-  }
-}
-
-/*************************************************************************
- *
  * Go through written skim hits on disk. Compare saved hits to best level found
  * If both reads agree they have better partners at hand, throw out skim hit.
  * Do this only if both reads are not rails, else it might be that good, fully
@@ -793,24 +766,18 @@ void Skim<TVHASH_T>::findPerfectRailMatchesInSkimFile(string & filename, const i
  * Careful: this rewrites and truncates the original file.
  * Length will awlays be <= initial length
  *
- * Careful: side effect SKIM3_writtenhitsperid gets filled with
- *  values ... this MUST happen!
- *
  *************************************************************************/
 //#define CEBUG(bla)   {cout << bla; cout.flush();}
-template<typename TVHASH_T>
-void Skim<TVHASH_T>::purgeUnnecessaryHitsFromSkimFile(string & filename, const int8 rid2dir, vector<uint8> & prmatches)
+void Skim::purgeUnnecessaryHitsFromSkimFile(string & filename, const int8 rid2dir)
 {
-  FUNCSTART("void Skim<TVHASH_T>::purgeUnnecessaryHitsFromSkimFile(string & filename, const int8 rid2dir, vector<uint8> & prmatches)");
-
-  BUGIFTHROW(filename.empty(),"filename.empty() ???");
+  FUNCSTART("void Skim::purgeUnnecessaryHitsFromSkimFile(string & filename, const int8 rid2dir)");
 
   // temporary skim container
   vector<skimhitforsave_t> tsc;
 
   FILE * finfout;
   finfout = fopen(filename.c_str(),"r+");
-  if(finfout == nullptr) {
+  if(finfout == NULL) {
     MIRANOTIFY(Notify::FATAL, "File not found: " << filename);
   }
 
@@ -819,28 +786,21 @@ void Skim<TVHASH_T>::purgeUnnecessaryHitsFromSkimFile(string & filename, const i
     string path,justfilename;
     splitFullPathAndFileName(filename,path,justfilename);
     string logfilename=path+"/elog.skim.puh."+justfilename;
-    cout << "\nSkim: elog " << logfilename << endl;
+    cout << "\nSkim: elog " << logfilename << '\n';
     logfout.open(logfilename.c_str(), ios::out|ios::trunc);
   }
 
-  // some statistics: how many hits does each read have?
-  vector<uint32> hitstats;
-  hitstats.resize(SKIM3_readpool->size(),0);
-  ofstream logcount;
-  if(SKIM3_logflag_purgeunnecessaryhits){
-    string path,justfilename;
-    splitFullPathAndFileName(filename,path,justfilename);
-    string logfilename=path+"/elog.skim.puh.count."+justfilename;
-    cout << "\nSkim: elog count " << logfilename << endl;
-    logcount.open(logfilename.c_str(), ios::out|ios::trunc);
-  }
+//  string system_lsdir = static_cast<string>("ls -l ")+AS_miraparams[0].getDirectoryParams().dir_log;
+//  {
+//    int tmp=system(system_lsdir.c_str()); 
+//    // don't complain about unused variable
+//    (void) tmp;
+//  }
 
-  myFSeek(finfout, 0, SEEK_END);
-  streamsize finsize=myFTell(finfout);
+  fseek(finfout, 0, SEEK_END);
+  streamsize finsize=ftell(finfout);
   rewind(finfout);
 
-  cout << "\ntruncating " << filename << endl;
-
   uint64 lineno=0;
   uint32 bannedoverlapsfound=0;
   size_t totalhits=0;
@@ -852,15 +812,15 @@ void Skim<TVHASH_T>::purgeUnnecessaryHitsFromSkimFile(string & filename, const i
 
   while(!feof(finfout)){
     tsc.resize(500000);
-    myFSeek(finfout, freadpos, SEEK_SET);
-
-    auto numread=myFRead(&tsc[0],sizeof(skimhitforsave_t),tsc.capacity(),finfout);
+    fseek(finfout, freadpos, SEEK_SET);
+    
+    size_t numread=fread(&tsc[0],sizeof(skimhitforsave_t),tsc.capacity(),finfout);
 
     if(numread==0) break;
     CEBUG("rsh4_pUHFNSF: read " << numread << endl;)
     lineno+=numread;
 
-    freadpos=myFTell(finfout);
+    freadpos=ftell(finfout);
     CEBUG("new freadpos: " << freadpos << endl);
 
     if(numread<tsc.capacity()) tsc.resize(numread);
@@ -870,13 +830,11 @@ void Skim<TVHASH_T>::purgeUnnecessaryHitsFromSkimFile(string & filename, const i
 
     uint8 ocll=255;
     uint8 oclr=255;
-
+    
     for(; readI != tsc.end(); ++readI){
       bool del1=false;
       bool del2=false;
       bool del3=false;
-      bool del4=false;
-      bool del5=false;
       if(!(*SKIM3_readpool)[readI->rid1].isRail()
 	 && !(*SKIM3_readpool)[readI->rid2].isRail()){
 	adse.calcNewEstimateFromSkim(
@@ -887,49 +845,43 @@ void Skim<TVHASH_T>::purgeUnnecessaryHitsFromSkimFile(string & filename, const i
 	  readI->rid2,
 	  1,
 	  rid2dir);
-
-	Skim<TVHASH_T>::getOverlapCriterionLevel(readI->rid1,
+	
+	Skim::getOverlapCriterionLevel(readI->rid1,
 				       (*SKIM3_readpool)[readI->rid1].getSequencingType(),
 				       adse,readI->percent_in_overlap,
 				     ocll,oclr);
-	uint32 ocvi=0;  // overlap criterion vector index 0 is for norept overlaps
-	if(!readI->ol_norept) ocvi=1;  // index 1 is for all other rept overlaps (among them the rept)
-
-	auto & oclvl = (*SKIM3_overlapcritlevelvl)[ocvi];
-	auto & oclvr = (*SKIM3_overlapcritlevelvr)[ocvi];
-
 	CEBUG("OCL: " << readI->rid1 << " " << static_cast<uint16>(ocll) << " " << static_cast<uint16>(oclr) << endl);
-
+	
 	// if it's a rail, then the read has no saying in the decision whether this skim should be deleted
 	// if not, look at overlap criterion level left and right
 	if((*SKIM3_readpool)[readI->rid1].isRail()
-	   || (ocll>oclvl[readI->rid1]
-	       && oclr>oclvr[readI->rid1])){
+	   || (ocll>(*SKIM3_overlapcritlevell)[readI->rid1]
+	       && oclr>(*SKIM3_overlapcritlevelr)[readI->rid1])){
 	  del1=true;
 	}
 	// if it's a Solexa and the best overlapcritlevel is not 0, we are probably in a under-coverage
 	//  situation ... try to account for that by being less harsh
-	// Values: in getOverlapCriterionLevel(), current overlapcritlevel for Solexa goes from
+	// Values: in getOverlapCriterionLevel(), current overlapcritlevel for Solexa goes from 
 	//  0-29 for 100% matches
-	//  30-59 for 99%
+	//  30-59 for 99% 
 	//  ... etc up to 95% (including, == 149 max)
 	// Therefore, if best overlapcritlevel != 0 && <= 29, then the best overlap is 100% albeit
 	//  not as long as it could be when in high coverage situations
 	// Therefore: low coverage
 	// Therefore: we'll take all 100% matches for that read
-	if(del1 && SKIM3_readpool->getRead(readI->rid1).isSequencingType(ReadGroupLib::SEQTYPE_SOLEXA)){
+	if(del1 && SKIM3_readpool->getRead(readI->rid1).isSequencingType(Read::SEQTYPE_SOLEXA)){
 	  if(ocll <= 29
-	     && oclvl[readI->rid1]!= 0
-	     && oclvl[readI->rid1] <= 29){
+	     && (*SKIM3_overlapcritlevell)[readI->rid1]!= 0
+	     && (*SKIM3_overlapcritlevell)[readI->rid1] <= 29){
 	    del1=false;
 	  }else if(oclr <= 29
-		   && oclvr[readI->rid1]!= 0
-		   && oclvr[readI->rid1] <= 29){
+		   && (*SKIM3_overlapcritlevelr)[readI->rid1]!= 0 
+		   && (*SKIM3_overlapcritlevelr)[readI->rid1] <= 29){
 	    del1=false;
 	  }
 	}
 
-	Skim<TVHASH_T>::getOverlapCriterionLevel(readI->rid2,
+	Skim::getOverlapCriterionLevel(readI->rid2,
 				       (*SKIM3_readpool)[readI->rid2].getSequencingType(),
 				       adse,readI->percent_in_overlap,
 				       ocll,oclr);
@@ -937,103 +889,44 @@ void Skim<TVHASH_T>::purgeUnnecessaryHitsFromSkimFile(string & filename, const i
 	// if it's a rail, then the read has no saying in the decision whether this skim should be deleted
 	// if not, look at overlap criterion level left and right
 	if((*SKIM3_readpool)[readI->rid2].isRail()
-	   || (ocll>oclvl[readI->rid2]
-	       && oclr>oclvr[readI->rid2])){
+	   || (ocll>(*SKIM3_overlapcritlevell)[readI->rid2]
+	       && oclr>(*SKIM3_overlapcritlevelr)[readI->rid2])){
 	  del2=true;
 	}
 
 	// if it's a Solexa and the best overlapcritlevel is not 0, we are probably in a under-coverage
 	//  situation ... try to account for that by being less harsh
-	if(del2 && SKIM3_readpool->getRead(readI->rid2).isSequencingType(ReadGroupLib::SEQTYPE_SOLEXA)){
+	if(del2 && SKIM3_readpool->getRead(readI->rid2).isSequencingType(Read::SEQTYPE_SOLEXA)){
 	  if(ocll <= 29
-	     && oclvl[readI->rid2]!= 0
-	     && oclvl[readI->rid2] <= 29){
+	     && (*SKIM3_overlapcritlevell)[readI->rid2]!= 0 
+	     && (*SKIM3_overlapcritlevell)[readI->rid2] <= 29){
 	    del2=false;
 	  }else if(oclr <= 29
-		   && oclvr[readI->rid2]!= 0
-		   && oclvr[readI->rid2] <= 29){
+		   && (*SKIM3_overlapcritlevelr)[readI->rid2]!= 0 
+		   && (*SKIM3_overlapcritlevelr)[readI->rid2] <= 29){
 	    del2=false;
 	  }
 	}
 
-	// Special Solexa tests
-	if(SKIM3_readpool->getRead(readI->rid1).isSequencingType(ReadGroupLib::SEQTYPE_SOLEXA)
-	   && SKIM3_readpool->getRead(readI->rid2).isSequencingType(ReadGroupLib::SEQTYPE_SOLEXA)){
-
-	  // Solexa elitist tests
-	  // Solexa elitists (<=5 left/right) do not want to play with pariahs (both >+5 levels left/right)
-	  if(oclvl[readI->rid1] <= 5
-	     && oclvr[readI->rid1] <= 5){
-
-	    if(oclvl[readI->rid2] > oclvl[readI->rid1]+5
-	       && oclvr[readI->rid2] > oclvr[readI->rid1]+5){
+	// test
+	// but Solexa elitists (<=5 left/right) do not want to play with pariahs (both >+5 levels left/right)
+	if(SKIM3_readpool->getRead(readI->rid1).isSequencingType(Read::SEQTYPE_SOLEXA)
+	   && SKIM3_readpool->getRead(readI->rid2).isSequencingType(Read::SEQTYPE_SOLEXA)){
+	  if((*SKIM3_overlapcritlevell)[readI->rid1] <= 5
+	     && (*SKIM3_overlapcritlevelr)[readI->rid1] <= 5){
+	    
+	    if((*SKIM3_overlapcritlevell)[readI->rid2] > (*SKIM3_overlapcritlevell)[readI->rid1]+5
+	       && (*SKIM3_overlapcritlevelr)[readI->rid2] > (*SKIM3_overlapcritlevelr)[readI->rid1]+5){
 	      del3=true;
 	    }
-	  }else if(oclvl[readI->rid2] <= 5
-		   && oclvr[readI->rid2] <= 5){
-
-	    if(oclvl[readI->rid1] > oclvl[readI->rid2]+5
-	       && oclvr[readI->rid1] > oclvr[readI->rid2]+5){
+	  }else if((*SKIM3_overlapcritlevell)[readI->rid2] <= 5
+		   && (*SKIM3_overlapcritlevelr)[readI->rid2] <= 5){
+	    
+	    if((*SKIM3_overlapcritlevell)[readI->rid1] > (*SKIM3_overlapcritlevell)[readI->rid2]+5
+	       && (*SKIM3_overlapcritlevelr)[readI->rid1] > (*SKIM3_overlapcritlevelr)[readI->rid2]+5){
 	      del3=true;
 	    }
 	  }
-
-	  // Solexa enough is enough tests
-	  // but only if there is no strong good overlap
-
-	  //bang here: take presence of HAF5-7 / MNRr into account. How?
-
-	  if(readI->ol_stronggood && SKIM3_forcetakestronggood){
-	    // forced take of strong good overlaps regardless of enough-is-enough
-	    //  to ensure sg hits in highly repetitive reads get taken (should be on for de-novo genome only)
-	    // TODO: do we need to do something or is this branch really empty? Think about it.
-	  }else{
-	    bool sdel1=false;
-	    bool sdel2=false;
-	    const uint8 ocritthresh=3;
-	    if(hitstats[readI->rid1] >= 350){
-	      SKIM3_nomorehitseie[readI->rid1]=1;
-	      sdel1=true;
-	    }else if(hitstats[readI->rid1] >= 50
-		     && oclvl[readI->rid1]<=ocritthresh
-		     && oclvr[readI->rid1]<=ocritthresh
-	      ){
-	      SKIM3_nomorehitseie[readI->rid1]=1;
-	      sdel1=true;
-	    }else if(hitstats[readI->rid1] >= 100
-		     && (oclvl[readI->rid1]<=ocritthresh
-			 || oclvr[readI->rid1]<=ocritthresh)){
-	      SKIM3_nomorehitseie[readI->rid1]=1;
-	      sdel1=true;
-	    }
-
-	    if(hitstats[readI->rid2] >= 350){
-	      SKIM3_nomorehitseie[readI->rid2]=1;
-	      sdel2=true;
-	    }else if(hitstats[readI->rid2] >= 50
-		     && oclvl[readI->rid2]<=ocritthresh
-		     && oclvr[readI->rid2]<=ocritthresh
-	      ){
-	      SKIM3_nomorehitseie[readI->rid2]=1;
-	      sdel2=true;
-	    } else if(hitstats[readI->rid2] >= 100
-		      && (oclvl[readI->rid2]<=ocritthresh
-			  || oclvr[readI->rid2]<=ocritthresh)){
-	      SKIM3_nomorehitseie[readI->rid2]=1;
-	      sdel2=true;
-	    }
-
-	    if(sdel1&&sdel2) del4=true;
-	  }
-	}
-      }
-
-      if(readI->percent_in_overlap!=100
-	 && !prmatches.empty()){
-	if((*SKIM3_readpool)[readI->rid1].isRail() && prmatches[readI->rid2]){
-	  del5=true;
-	}else if((*SKIM3_readpool)[readI->rid2].isRail() && prmatches[readI->rid1]){
-	  del5=true;
 	}
       }
 
@@ -1043,131 +936,92 @@ void Skim<TVHASH_T>::purgeUnnecessaryHitsFromSkimFile(string & filename, const i
 	del1=false;
 	del2=false;
 	del3=false;
-	del4=false;
-	del5=false;
-      }
-
-      // both reads PacBioLQ? currently don't purge
-      if(SKIM3_readpool->getRead(readI->rid1).isSequencingType(ReadGroupLib::SEQTYPE_PACBIOLQ)
-	 && SKIM3_readpool->getRead(readI->rid2).isSequencingType(ReadGroupLib::SEQTYPE_PACBIOLQ)){
-	del1=false;
-	del2=false;
-	del3=false;
-	del4=false;
-	del5=false;
-      }
-
-      // strong good and rept? we're at a border, don't purge
-      if(readI->ol_stronggood && readI->ol_rept){
-	del1=false;
-	del2=false;
-	del3=false;
-	del4=false;
-	del5=false;
       }
 
-//	del1=false;
-//	del2=false;
-//	del3=false;
-//	del4=false;
-//	del5=false;
-
       if(readI != writeI){
 	*writeI=*readI;
       }
       ++writeI;
-      CEBUG("DEL: " << del1 << " " << del2 << " " << del3 << " " << del4 << " " << del5 << endl);
-      //CEBUG(readI->rid1 << ": " << static_cast<uint16>(oclvl[readI->rid1]) << " " << static_cast<uint16>(oclvr[readI->rid1])
-      //	    << "\t\t" << readI->rid2 << ": " << static_cast<uint16>(oclvl[readI->rid2]) << " " << static_cast<uint16>(oclvr[readI->rid2]) << endl);
+      CEBUG("DEL: " << del1 << " " << del2 << " " << del3 << endl);
+      CEBUG(readI->rid1 << ": " << static_cast<uint16>((*SKIM3_overlapcritlevell)[readI->rid1]) << " " << static_cast<uint16>((*SKIM3_overlapcritlevelr)[readI->rid1])
+	    << "\t\t" << readI->rid2 << ": " << static_cast<uint16>((*SKIM3_overlapcritlevell)[readI->rid2]) << " " << static_cast<uint16>((*SKIM3_overlapcritlevelr)[readI->rid2]) << endl);
 
-      if((del1 && del2) || del3 || del4 || del5){
+      if((del1 && del2) || del3){
 	//if(0){
 	--writeI;
 	CEBUG("Purged: " << *readI);
 	if(SKIM3_logflag_purgeunnecessaryhits){
 	  logfout << "Purged:\t" << SKIM3_readpool->getRead(readI->rid1).getName()
-		  << " (" << static_cast<uint16>((*SKIM3_overlapcritlevelvl)[0][readI->rid1])
-		  << "," << static_cast<uint16>((*SKIM3_overlapcritlevelvr)[0][readI->rid1]) << ")"
-		  << " (" << static_cast<uint16>((*SKIM3_overlapcritlevelvl)[1][readI->rid1])
-		  << "," << static_cast<uint16>((*SKIM3_overlapcritlevelvr)[1][readI->rid1]) << ")"
+		  << " (" << static_cast<uint16>((*SKIM3_overlapcritlevell)[readI->rid1]) 
+		  << "," << static_cast<uint16>((*SKIM3_overlapcritlevelr)[readI->rid1]) << ")"
 		  << '\t' << SKIM3_readpool->getRead(readI->rid2).getName()
-		  << " (" << static_cast<uint16>((*SKIM3_overlapcritlevelvl)[0][readI->rid2])
-		  << "," << static_cast<uint16>((*SKIM3_overlapcritlevelvr)[0][readI->rid2]) << ")"
-		  << " (" << static_cast<uint16>((*SKIM3_overlapcritlevelvl)[1][readI->rid2])
-		  << "," << static_cast<uint16>((*SKIM3_overlapcritlevelvr)[1][readI->rid2]) << ")"
-		  << "\t(" << static_cast<uint16>(ocll)
+		  << " (" << static_cast<uint16>((*SKIM3_overlapcritlevell)[readI->rid2]) 
+		  << "," << static_cast<uint16>((*SKIM3_overlapcritlevelr)[readI->rid2]) << ")"
+		  << "\t(" << static_cast<uint16>(ocll) 
 		  << "," << static_cast<uint16>(oclr) << ")"
 		  << '\t' << *readI;
 	}
       }else{
-	if(min(readI->rid1,readI->rid2) == 0) {CEBUG("DINGO! ")};
+	if(min(readI->rid1,readI->rid2) == 0) CEBUG("DINGO! ");
 	CEBUG("Kept: " << *readI);
 	if(SKIM3_logflag_purgeunnecessaryhits){
 	  logfout << "Kept:\t" << SKIM3_readpool->getRead(readI->rid1).getName()
-		  << " (" << static_cast<uint16>((*SKIM3_overlapcritlevelvl)[0][readI->rid1])
-		  << "," << static_cast<uint16>((*SKIM3_overlapcritlevelvr)[0][readI->rid1]) << ")"
-		  << " (" << static_cast<uint16>((*SKIM3_overlapcritlevelvl)[1][readI->rid1])
-		  << "," << static_cast<uint16>((*SKIM3_overlapcritlevelvr)[1][readI->rid1]) << ")"
+		  << " (" << static_cast<uint16>((*SKIM3_overlapcritlevell)[readI->rid1]) 
+		  << "," << static_cast<uint16>((*SKIM3_overlapcritlevelr)[readI->rid1]) << ")"
 		  << '\t' << SKIM3_readpool->getRead(readI->rid2).getName()
-		  << " (" << static_cast<uint16>((*SKIM3_overlapcritlevelvl)[0][readI->rid2])
-		  << "," << static_cast<uint16>((*SKIM3_overlapcritlevelvr)[0][readI->rid2]) << ")"
-		  << " (" << static_cast<uint16>((*SKIM3_overlapcritlevelvl)[1][readI->rid2])
-		  << "," << static_cast<uint16>((*SKIM3_overlapcritlevelvr)[1][readI->rid2]) << ")"
-		  << "\t(" << static_cast<uint16>(ocll)
+		  << " (" << static_cast<uint16>((*SKIM3_overlapcritlevell)[readI->rid2]) 
+		  << "," << static_cast<uint16>((*SKIM3_overlapcritlevelr)[readI->rid2]) << ")"
+		  << "\t(" << static_cast<uint16>(ocll) 
 		  << "," << static_cast<uint16>(oclr) << ")"
 		  << '\t' << *readI;
 	}
 	if(!SKIM3_writtenhitsperid->empty()){
-	  (*SKIM3_writtenhitsperid)[readI->rid1]+=1;
-	  (*SKIM3_writtenhitsperid)[readI->rid2]+=1;
+	  (*SKIM3_writtenhitsperid)[min(readI->rid1,readI->rid2)]+=2;
 	}
-
-	++hitstats[readI->rid1];
-	++hitstats[readI->rid2];
       }
     }
 
-    // the resize thing is really not optimal ... one could write to file only a
+    // the resize thing is really not optimal ... one could write to file only a 
     //  subset. However, at the moment just keep it for 100% safety
     CEBUG("Purge skim data. Old size: " << tsc.size() << endl);
     tsc.resize(tsc.size()-(readI-writeI));
     CEBUG("New size: " << tsc.size() << endl);
 
     if(!tsc.empty()){
-      myFSeek(finfout, fwritepos, SEEK_SET);
-      if(myFWrite(&tsc[0],
-		  sizeof(skimhitforsave_t),
-		  tsc.size(),
-		  finfout) != tsc.size()){
+      fseek(finfout, fwritepos, SEEK_SET);
+      if(fwrite(&tsc[0],
+		sizeof(skimhitforsave_t),
+		tsc.size(),
+		finfout) != tsc.size()){
 	MIRANOTIFY(Notify::FATAL, "Could not write anymore to normalised skim file. Disk full? Changed permissions?");
       }
-      fwritepos=myFTell(finfout);
+      fwritepos=ftell(finfout);
       CEBUG("new fwritepos: " << fwritepos << endl);
     }
   }
 
   fclose(finfout);
 
-  cout << "truncated " << filename << " from " << finsize << " to " << fwritepos << endl;
+//  {
+//    int tmp=system(system_lsdir.c_str()); 
+//    // don't complain about unused variable
+//    (void) tmp;
+//  }
+
+  cout << "truncating " << filename << " from " << finsize << " to " << fwritepos << endl;
   if(truncate(filename.c_str(),fwritepos)){
     MIRANOTIFY(Notify::FATAL, "Could not truncate normalised skim file? Strange ...");
   }
 
-  for(uint32 ri=0; ri<hitstats.size(); ++ri){
-    logcount << SKIM3_readpool->getRead(ri).getName() << "\t" << hitstats[ri] << "\t"
-	     << static_cast<uint32>((*SKIM3_overlapcritlevelvl)[0][ri]) << "\t"
-	     << static_cast<uint32>((*SKIM3_overlapcritlevelvr)[0][ri]) << "\t"
-	     << static_cast<uint32>((*SKIM3_overlapcritlevelvl)[1][ri]) << "\t"
-	     << static_cast<uint32>((*SKIM3_overlapcritlevelvr)[1][ri]) << "\t";
-
-    if(SKIM3_nomorehitseie[ri]) logcount << "enough";
-    logcount << '\n';
-  }
-  logcount.close();
-
+//  {
+//    int tmp=system(system_lsdir.c_str()); 
+//    // don't complain about unused variable
+//    (void) tmp;
+//  }
+//
 //  tsc.resize(500000);
 //  finfout = fopen(filename.c_str(),"r+");
-//  size_t numread=myFRead(&tsc[0],sizeof(skimhitforsave_t),500000,finfout);
+//  size_t numread=fread(&tsc[0],sizeof(skimhitforsave_t),500000,finfout);
 //  CEBUG("Read anew: " << numread << endl);
 //  tsc.resize(numread);
 //  for(uint32 i=0;i < numread; i++){
@@ -1194,39 +1048,37 @@ void Skim<TVHASH_T>::purgeUnnecessaryHitsFromSkimFile(string & filename, const i
 //#define CEBUG(bla)   {cout << bla; cout.flush();}
 //#define CEBUGF(bla)  {cout << bla; cout.flush();}
 
-template<typename TVHASH_T>
-void Skim<TVHASH_T>::makeVHRAPArrayShortcuts(vector<typename HashStatistics<TVHASH_T>::vhrap_t> & vhraparray, const uint32 basesperhash)
+void Skim::makeVHRAPArrayShortcuts(vector<vhrap_t> & vhraparray, const uint8 basesperhash)
 {
   //cout << "Making VHRAPArrayShortcuts" << endl;
 
   SKIM3_vashortcuts_begin.clear();
   SKIM3_vashortcuts_end.clear();
   SKIM3_completevhraparray_end=vhraparray.end();
-  auto vaI=vhraparray.cbegin();
+  vector<vhrap_t>::const_iterator vaI=vhraparray.begin();
   if(vaI==vhraparray.end()) return;
 
   SKIM3_vashortcuts_begin.resize(
-    1<<(min(static_cast<uint32>(12),basesperhash)*2),
-//    static_cast<vector<vhrap_t>::iterator>(nullptr)
+    1<<(min(static_cast<uint8>(12),basesperhash)*2),
+//    static_cast<vector<vhrap_t>::iterator>(NULL)
 //    SKIM3_empty_vector_vhrap_t.end()
     vhraparray.end()
     );
 
   SKIM3_vashortcuts_end.resize(
-    1<<(min(static_cast<uint32>(12),basesperhash)*2),
-//    static_cast<vector<vhrap_t>::iterator>(nullptr)
+    1<<(min(static_cast<uint8>(12),basesperhash)*2),
+//    static_cast<vector<vhrap_t>::iterator>(NULL)
 //    SKIM3_empty_vector_vhrap_t.end()
     vhraparray.end()
     );
 
-  TVHASH_T acthash= (vaI->vhash & SKIM3_MAXVHASHMASK);
+  vhash_t acthash= (vaI->vhash & MAXVHASHMASK);
   while(vaI != vhraparray.end()){
-    auto vasi=static_cast<uint64>(acthash);
-    SKIM3_vashortcuts_begin[vasi]=vaI;
-    for(;vaI != vhraparray.end() && (vaI->vhash & SKIM3_MAXVHASHMASK) == acthash; vaI++) ;
-    SKIM3_vashortcuts_end[vasi]=vaI;
+    SKIM3_vashortcuts_begin[acthash]=vaI;
+    for(;vaI != vhraparray.end() && (vaI->vhash & MAXVHASHMASK) == acthash; vaI++) ;
+    SKIM3_vashortcuts_end[acthash]=vaI;
     //cout << "vhash: " << hex << acthash << "\t" << dec << SKIM3_vashortcuts_end[acthash]-SKIM3_vashortcuts_begin[acthash] << '\n';
-    if(vaI != vhraparray.end()) acthash= vaI->vhash & SKIM3_MAXVHASHMASK;
+    if(vaI != vhraparray.end()) acthash= vaI->vhash & MAXVHASHMASK;
   }
 }
 
@@ -1246,19 +1098,14 @@ void Skim<TVHASH_T>::makeVHRAPArrayShortcuts(vector<typename HashStatistics<TVHA
 //#define CEBUG(bla)   {cout << bla; cout.flush();}
 //#define CEBUGF(bla)  {cout << bla; cout.flush();}
 
-template<typename TVHASH_T>
-uint32 Skim<TVHASH_T>::transformSeqToVariableHash (const uint32 readid, const Read & actread, const char * seq, uint32 slen, const uint32 basesperhash, typename vector<typename HashStatistics<TVHASH_T>::vhrap_t>::iterator & vhraparrayI, const bool countonly, const uint8 hashsavestepping, vector<uint8> & tagmaskvector, const vector<Read::bposhashstat_t> & bposhashstats, int32 bfpos, const int32 bfposinc)
+uint32 Skim::transformSeqToVariableHash (const uint32 readid, const Read & actread, const char * seq, uint32 slen, const uint8 basesperhash, vector<vhrap_t>::iterator & vhraparrayI, const bool countonly, const uint8 hashsavestepping, vector<uint8> & tagmaskvector, const vector<Read::bposhashstat_t> & bposhashstats, int32 bfpos, const int32 bfposinc)
 {
-  FUNCSTART("void Skim<TVHASH_T>::transformSeqToVariableHash (...)");
+  FUNCSTART("void Skim::transformSeqToVariableHash (...)");
 
-  //BUGIFTHROW(basesperhash>32, "basesperhash > 32 ?");
+  BUGIFTHROW(basesperhash>32, "basesperhash > 32 ?");
   BUGIFTHROW(hashsavestepping<1, "hashsavestepping < 1 ?");
-  if(slen>SKIM3_MAXREADSIZEALLOWED){
-    MIRANOTIFY(Notify::FATAL,"Read " << actread.getName() << " is " << slen << " bp long and thus longer than SKIM3_MAXREADSIZEALLOWED (" << SKIM3_MAXREADSIZEALLOWED << ") bases. Skim cannot handle that, sorry.");
-  }
-
-  if(!tagmaskvector.empty()){
-    BUGIFTHROW(tagmaskvector.size()!=slen,"tagmaskvector.size() " << tagmaskvector.size() << " != slen " << slen);
+  if(slen>MAXREADSIZEALLOWED){
+    MIRANOTIFY(Notify::FATAL,"Read " << actread.getName() << " is " << slen << " bp long and thus longer than MAXREADSIZEALLOWED (" << MAXREADSIZEALLOWED << ") bases. Skim cannot handle than, sorry.");
   }
 
 //  Read::setCoutType(Read::AS_TEXT);
@@ -1273,33 +1120,28 @@ uint32 Skim<TVHASH_T>::transformSeqToVariableHash (const uint32 readid, const Re
   vector<Read::bposhashstat_t>::const_iterator bhsI=bposhashstats.begin();
   advance(bhsI,bfpos);
 
-  TVHASH_T lasthash(0);
-  TVHASH_T acthash(0);
-  TVHASH_T hashmask(1);
+  vhash_t lasthash=0;
+  vhash_t acthash=0;
+  vhash_t hashmask=1;
   // *grml* undefined behaviour of left shift for 64 shifts in a 64 bit type makes this cludge necessary
-  // VLuint would handle it by itself, but not a normal uint64
-  if(basesperhash>=sizeof(TVHASH_T)*4){
+  if(basesperhash==32){
     hashmask=0;
   }else{
     hashmask<<=(basesperhash*2);
   }
   --hashmask;
 
-  // strictly speaking, the following two are no kmer hashes (TVHASH_T)
-  // BUT: they need to be able to have one bit per baseperhash to follow the masking
-  // making them of the same type as TVHASH_T helps to simplify coding
-  TVHASH_T nonmaskedposbitvector(0);
-  TVHASH_T nmpmask(1);
-  // *grml* undefined behaviour of left shift for n shifts in a n-bit type makes this cludge necessary
-  // VLuint would handle it by itself, but not a normal uint32/uint64
-  if(basesperhash>=sizeof(TVHASH_T)*8){
+  uint32 nonmaskedposbitvector=0;
+  uint32 nmpmask=1;
+  // *grml* undefined behaviour of left shift for 32 shifts in a 32 bit type makes this cludge necessary
+  if(basesperhash==32){
     nmpmask=0;
   }else{
-    nmpmask<<=basesperhash;
+    nmpmask<<=(basesperhash);
   }
   --nmpmask;
 
-  CEBUG("sizeof TVHASH_T: " << sizeof(TVHASH_T) << '\n');
+  CEBUG("sizeof vhash_t: " << sizeof(vhash_t) << '\n');
   CEBUG("bases per hash: " << static_cast<uint16>(basesperhash) << '\n');
   CEBUG("hashsavestepping: " << static_cast<uint16>(hashsavestepping) << '\n');
   CEBUG("hash mask: " << hex << hashmask << dec << '\n');
@@ -1311,7 +1153,7 @@ uint32 Skim<TVHASH_T>::transformSeqToVariableHash (const uint32 readid, const Re
   uint32 goods=0;
   uint32 bads=0;
   uint32  baseok=0;
-  auto initial_vaI=vhraparrayI;
+  vector<vhrap_t>::iterator initial_vaI=vhraparrayI;
   vector<uint8>::const_iterator tmvI=tagmaskvector.begin();
 
   CEBUG("Hashing " << actread.getName() << '\t' << slen << '\t' << strlen(seq) << '\t' << actread.getLenClippedSeq() << "\n");
@@ -1322,9 +1164,7 @@ uint32 Skim<TVHASH_T>::transformSeqToVariableHash (const uint32 readid, const Re
   uint16 lastposhashsaved=0;
 
   bool notright=false;
-  for(uint32 seqi=0; seqi<slen; ++seqi, ++seq){
-    // careful here: no continue statement until tmvI has been increased!!!
-    // not doing this in loop increment as HashStatistics::checkBaitHit() calls us with empty vector
+  for(uint16 seqi=0; seqi<slen; seqi++, seq++, tmvI++){
     lasthash=acthash;
     acthash<<=2;
     acthash&=hashmask;
@@ -1333,19 +1173,19 @@ uint32 Skim<TVHASH_T>::transformSeqToVariableHash (const uint32 readid, const Re
     actbase=static_cast<char>(toupper(*seq));
 
     CEBUG(seqi << '\t' << actbase << endl);
-
+    
     switch (actbase) {
     case 'A' : break;
     case 'C' : {
-      acthash|=1;
+      acthash+=1;
       break;
     }
     case 'G' : {
-      acthash|=2;
+      acthash+=2;
       break;
     }
     case 'T' : {
-      acthash|=3;
+      acthash+=3;
       break;
     }
     default : {
@@ -1354,8 +1194,8 @@ uint32 Skim<TVHASH_T>::transformSeqToVariableHash (const uint32 readid, const Re
 
 	mustsavelasthash=true;
 
-	// break hash making (which is actually better than behaving
-	//  like another character in case of multiple bases with
+	// break hash making (which is actually better than behaving 
+	//  like another character in case of multiple bases with 
 	//  IUPAC or '*')
 	acthash=0;
 	baseok=0;
@@ -1365,33 +1205,25 @@ uint32 Skim<TVHASH_T>::transformSeqToVariableHash (const uint32 readid, const Re
       }
     }
     }
-
+    
     // handling of masked positions
     bool lastposhadunmasked=false;
-    if(static_cast<bool>(nonmaskedposbitvector)) lastposhadunmasked=true;
+    if(nonmaskedposbitvector) lastposhadunmasked=true;
     nonmaskedposbitvector<<=1;
     nonmaskedposbitvector&=nmpmask;
-
-    if(tagmaskvector.empty()){
+    if(*tmvI==0){
       nonmaskedposbitvector|=1;
-    }else{
-      if(*tmvI==0){
-	nonmaskedposbitvector|=1;
-      }
-      ++tmvI;
     }
 
-    // using "continue" is now allowed (if needed)
-
-    if(lastposhadunmasked && static_cast<bool>(nonmaskedposbitvector)==false
+    if(lastposhadunmasked && nonmaskedposbitvector==0 
        && lastposhashsaved != seqi-1) {
       mustsavelasthash=true;
     }
 
-    CEBUG(seqi << ' ' << *seq << ' ' << hex << nonmaskedposbitvector << dec << ' ' << mustsavelasthash << ' ');
+    CEBUG(seqi << ' ' << *seq << ' ' << static_cast<uint16>(*tmvI) << ' ' << hex << nonmaskedposbitvector << dec << ' ' << mustsavelasthash << ' ');
     if(baseok >= basesperhash) {
       goods++;
-      if(!countonly && static_cast<bool>(nonmaskedposbitvector)) {
+      if(!countonly && nonmaskedposbitvector) {
 	if(mustsavelasthash){
 	  vhraparrayI->vhash=lasthash;
 	  vhraparrayI->readid=readid;
@@ -1399,7 +1231,7 @@ uint32 Skim<TVHASH_T>::transformSeqToVariableHash (const uint32 readid, const Re
 	  vhraparrayI->bhashstats=(bhsI-bfposinc)->getBHashStat(-bfposinc);
 	  // getBHashStat(-bfposinc) because while we're running "forward", we save
 	  //  hashes only with a delay of 'basesperhash' and need to know the status
-	  //  of the "past" bases ... and this info is readily available in
+	  //  of the "past" bases ... and this info is readily available in 
 	  //  the BHashStat of the other strand
 
 	  CEBUG("saved LG hash: " << *vhraparrayI << '\n');
@@ -1417,7 +1249,7 @@ uint32 Skim<TVHASH_T>::transformSeqToVariableHash (const uint32 readid, const Re
 	  vhraparrayI->bhashstats=bhsI->getBHashStat(-bfposinc);
 	  // getBHashStat(-bfposinc) because while we're running "forward", we save
 	  //  hashes only with a delay of 'basesperhash' and need to know the status
-	  //  of the "past" bases ... and this info is readily available in
+	  //  of the "past" bases ... and this info is readily available in 
 	  //  the BHashStat of the other strand
 
 	  CEBUG("saved hash: " << *vhraparrayI << '\n');
@@ -1439,7 +1271,7 @@ uint32 Skim<TVHASH_T>::transformSeqToVariableHash (const uint32 readid, const Re
 
     // this is a hack to make this routine work in -D_GLIBCXX_DEBUG mode
     // normally, this iterator should be handled by the for() statement,
-    //  but in reverese cases where the read has no left clip, after the
+    //  but in reverese cases where the read has no left clip, after the 
     //  last loop the iterator would advance to the "-1" position where the
     //  STL debug containers are not happy with, even though the iterator
     //  wouldn't be used as the for() loops would stop right there
@@ -1458,7 +1290,7 @@ uint32 Skim<TVHASH_T>::transformSeqToVariableHash (const uint32 readid, const Re
       bhsI+=bfposinc;
     }
   }
-
+  
   //for(uint32 i=0; i<basesperhash; i++, hashp++, hashokp++) {
   //  *hashp=0;
   //  *hashokp=0;
@@ -1479,20 +1311,81 @@ uint32 Skim<TVHASH_T>::transformSeqToVariableHash (const uint32 readid, const Re
 
 
 
+
+/*************************************************************************
+ *
+ * sorter to sort from low to high
+ *
+ *
+ *************************************************************************/
+
+inline bool Skim__compareVHRAPArrayElem_(const vhrap_t & one, const vhrap_t & other) 
+{
+  return one.vhash < other.vhash;
+};
+
+
+bool Skim__sortreadhashmatch_t_(const readhashmatch_t & a, 
+			    const readhashmatch_t & b);
+bool Skim__sortreadhashmatch_t_(const readhashmatch_t & a, const readhashmatch_t & b)
+{
+  if(a.rid2 == b.rid2){
+    if(a.eoffset == b.eoffset) return a.hashpos1 < b.hashpos1;
+    return a.eoffset < b.eoffset;
+  }
+  return a.rid2 < b.rid2;
+}
+
+/*************************************************************************
+ *
+ * sorter to sort from high to low
+ *
+ *
+ *************************************************************************/
+
+bool Skim__sortMWByPercent_(const matchwithsorter_t & a, 
+			    const matchwithsorter_t & b);
+bool Skim__sortMWByPercent_(const matchwithsorter_t & a, const matchwithsorter_t & b)
+{
+  if(a.percent_in_overlap == b.percent_in_overlap) {
+    return a.numhashes > b.numhashes;
+  }
+  return a.percent_in_overlap > b.percent_in_overlap;
+}
+
+bool Skim__sortMWByEstimScore_(const matchwithsorter_t & a, 
+			    const matchwithsorter_t & b);
+bool Skim__sortMWByEstimScore_(const matchwithsorter_t & a, const matchwithsorter_t & b)
+{
+  if(a.estimscore == b.estimscore) {
+    return a.percent_in_overlap > b.percent_in_overlap;
+  }
+  return a.estimscore > b.estimscore;
+}
+
+bool Skim__sortMWByNumHashes_(const matchwithsorter_t & a, 
+			    const matchwithsorter_t & b);
+bool Skim__sortMWByNumHashes_(const matchwithsorter_t & a, const matchwithsorter_t & b)
+{
+  if(a.numhashes == b.numhashes){
+     return a.percent_in_overlap > b.percent_in_overlap;
+  }
+  return a.numhashes > b.numhashes;
+}
+
 //#define CEBUG(bla)   {cout << bla; cout.flush();}
 
 
 //#define CEBUG(bla)   {boost::mutex::scoped_lock lock(SKIM3_coutmutex); cout << bla; cout.flush();}
 
 // TODO: bad: direction should not be in this call, more of the called function
-template<typename TVHASH_T>
-void Skim<TVHASH_T>::startMultiThreading(const int8 direction, const uint32 numthreads, const uint32 readsperthread, const uint32 firstid, const uint32 lastid, boost::function<void(uint32_t)> initfunc, boost::function<void(uint32_t)> callfunc)
+void Skim::startMultiThreading(const int8 direction, const uint32 numthreads, const uint32 readsperthread, const uint32 firstid, const uint32 lastid, boost::function<void(uint32_t)> initfunc, boost::function<void(uint32_t)> callfunc)
 {
   // initialise task specific data by task specific init routine
   initfunc(numthreads);
 
   // initialise the data structure with which the master
-  //  process (well, this process) will communicate with the
+  //  process (well, this process) will communicate with the 
   //  worker threads
   // do this *before* creating the threads :-)
   {
@@ -1502,7 +1395,7 @@ void Skim<TVHASH_T>::startMultiThreading(const int8 direction, const uint32 numt
     twc.direction=direction;
     twc.flag_datavalid=false;
     twc.flag_endthread=false;
-
+    
     SKIM3_threadcontrol.clear();
     SKIM3_threadcontrol.resize(numthreads,twc);
   }
@@ -1514,7 +1407,7 @@ void Skim<TVHASH_T>::startMultiThreading(const int8 direction, const uint32 numt
   }
 
   // main work distribution loop
-  // gives each thread a part of the search space. If no
+  // gives each thread a part of the search space. If no 
   //  thread is free, waits for a slave2master signal
   //  (which currently can only mean a thread has finished
   //  going through it's search space)
@@ -1535,12 +1428,12 @@ void Skim<TVHASH_T>::startMultiThreading(const int8 direction, const uint32 numt
     }else{
       uint32 endid=startid+readsperthread;
       if(endid>lastid) endid=lastid;
-
+      
       CEBUG("Giving " << startid << " to " << endid << " to thread " << tnr << "\n");
       SKIM3_threadcontrol[tnr].from=startid;
       SKIM3_threadcontrol[tnr].to=endid;
       SKIM3_threadcontrol[tnr].flag_datavalid=true;
-
+      
       SKIM3_master2slavesignal.notify_all();
 
       startid=endid;
@@ -1565,12 +1458,10 @@ void Skim<TVHASH_T>::startMultiThreading(const int8 direction, const uint32 numt
   workerthreads.join_all();
 
 }
-//#define CEBUG(bla)
 
-template<typename TVHASH_T>
-void Skim<TVHASH_T>::cfhThreadsDataInit(const uint32 numthreads)
+void Skim::cfhThreadsDataInit(const uint32 numthreads)
 {
-  FUNCSTART("void Skim<TVHASH_T>::cfhThreadsDataInit(const uint32 numthreads)");
+  FUNCSTART("void Skim::cfhThreadsDataInit(const uint32 numthreads)");
 
   SKIM3_cfhd_vector.resize(numthreads);
   for(uint32 ti=0; ti<numthreads;++ti){
@@ -1578,8 +1469,8 @@ void Skim<TVHASH_T>::cfhThreadsDataInit(const uint32 numthreads)
     SKIM3_cfhd_vector[ti].readhashmatches.reserve(500000);
     SKIM3_cfhd_vector[ti].smallhist4repeats.clear();
     SKIM3_cfhd_vector[ti].smallhist4repeats.reserve(100);
-    SKIM3_cfhd_vector[ti].singlereadvhraparray.clear();
-    SKIM3_cfhd_vector[ti].singlereadvhraparray.reserve(5000);
+    SKIM3_cfhd_vector[ti].singlereadvhraparray.clear(); 
+    SKIM3_cfhd_vector[ti].singlereadvhraparray.reserve(5000); 
     SKIM3_cfhd_vector[ti].tmpmatchwith.clear();
     SKIM3_cfhd_vector[ti].tmpmatchwith.reserve(2000);
     SKIM3_cfhd_vector[ti].tagmaskvector.clear();
@@ -1588,29 +1479,21 @@ void Skim<TVHASH_T>::cfhThreadsDataInit(const uint32 numthreads)
     SKIM3_cfhd_vector[ti].shfsv.reserve(100000);
     SKIM3_cfhd_vector[ti].ridswithmatches.clear();
     SKIM3_cfhd_vector[ti].ridswithmatches.reserve(10000);
-
-    SKIM3_cfhd_vector[ti].uidswithnewcritlevelvl.clear();
-    SKIM3_cfhd_vector[ti].uidswithnewcritlevelvl.resize(2);
-    SKIM3_cfhd_vector[ti].uidswithnewcritlevelvr.clear();
-    SKIM3_cfhd_vector[ti].uidswithnewcritlevelvr.resize(2);
-    SKIM3_cfhd_vector[ti].critlevellofnewuidsv.clear();
-    SKIM3_cfhd_vector[ti].critlevellofnewuidsv.resize(2);
-    SKIM3_cfhd_vector[ti].critlevelrofnewuidsv.clear();
-    SKIM3_cfhd_vector[ti].critlevelrofnewuidsv.resize(2);
-    for(uint32 ocvi=0; ocvi<2; ++ocvi){
-      SKIM3_cfhd_vector[ti].uidswithnewcritlevelvl[ocvi].reserve(10000);
-      SKIM3_cfhd_vector[ti].uidswithnewcritlevelvr[ocvi].reserve(10000);
-      SKIM3_cfhd_vector[ti].critlevellofnewuidsv[ocvi].reserve(10000);
-      SKIM3_cfhd_vector[ti].critlevelrofnewuidsv[ocvi].reserve(10000);
-    }
+    SKIM3_cfhd_vector[ti].uidswithnewcritlevell.clear();
+    SKIM3_cfhd_vector[ti].uidswithnewcritlevell.reserve(10000);
+    SKIM3_cfhd_vector[ti].uidswithnewcritlevelr.clear();
+    SKIM3_cfhd_vector[ti].uidswithnewcritlevelr.reserve(10000);
+    SKIM3_cfhd_vector[ti].critlevellofnewuids.clear();
+    SKIM3_cfhd_vector[ti].critlevellofnewuids.reserve(10000);
+    SKIM3_cfhd_vector[ti].critlevelrofnewuids.clear();
+    SKIM3_cfhd_vector[ti].critlevelrofnewuids.reserve(10000);
   }
   FUNCEND();
 }
 
-template<typename TVHASH_T>
-void Skim<TVHASH_T>::cfhThreadLoop(const uint32 threadnr)
+void Skim::cfhThreadLoop(const uint32 threadnr)
 {
-  FUNCSTART("void Skim<TVHASH_T>::threadloop(const uint32 threadnr)");
+  FUNCSTART("void Skim::threadloop(const uint32 threadnr)");
 
   // threads need their own try() catch() block
 
@@ -1622,11 +1505,11 @@ void Skim<TVHASH_T>::cfhThreadLoop(const uint32 threadnr)
     //cfh_threaddata_t cfhd;
 
 //    cfhd.readhashmatches.reserve(500000);
-//    cfhd.singlereadvhraparray.reserve(5000);
+//    cfhd.singlereadvhraparray.reserve(5000); 
 //    cfhd.tmpmatchwith.reserve(2000);
 //    cfhd.tagmaskvector.reserve(2000);
 //    cfhd.shfsv.reserve(100000);
-//
+//    
 //    cfhd.posmatchfout=&SKIM3_posfmatchfout;
 //
 //    cfhd.ridswithmatches.reserve(10000);
@@ -1640,7 +1523,7 @@ void Skim<TVHASH_T>::cfhThreadLoop(const uint32 threadnr)
 
     // we'll jump out with a break;
     while(true){
-      {
+      { 
 	boost::mutex::scoped_lock mylock(SKIM3_mutex);
 	CEBUG("Thread " << threadnr << " waiting ...\n");
 	while(!SKIM3_threadcontrol[threadnr].flag_datavalid
@@ -1650,17 +1533,17 @@ void Skim<TVHASH_T>::cfhThreadLoop(const uint32 threadnr)
       }
       if(SKIM3_threadcontrol[threadnr].flag_datavalid){
 	CEBUG("Thread " << threadnr << " working on " << SKIM3_threadcontrol[threadnr].from << " to " << SKIM3_threadcontrol[threadnr].to << "\n");
-
+	
 	cfhd.posmatchfout=&SKIM3_posfmatchfout;
 	if(SKIM3_threadcontrol[threadnr].direction<0) cfhd.posmatchfout=&SKIM3_poscmatchfout;
 	checkForHashes_fromto(SKIM3_threadcontrol[threadnr].direction,
 			      SKIM3_threadcontrol[threadnr].from,
 			      SKIM3_threadcontrol[threadnr].to,
 			      cfhd);
-
+	
 	boost::mutex::scoped_lock mylock(SKIM3_mutex);
 	SKIM3_threadcontrol[threadnr].flag_datavalid=false;
-
+	
 	SKIM3_slave2mastersignal.notify_one();
       }else if(SKIM3_threadcontrol[threadnr].flag_endthread){
 	CEBUG("Thread " << threadnr << "  exiting.\n");
@@ -1700,10 +1583,9 @@ void Skim<TVHASH_T>::cfhThreadLoop(const uint32 threadnr)
 
 //#define CEBUG(bla)   {cout << bla; cout.flush();}
 
-template<typename TVHASH_T>
-void Skim<TVHASH_T>::checkForHashes_fromto(const int8 direction, const uint32 fromid, const uint32 toid, cfh_threaddata_t & cfhd)
+void Skim::checkForHashes_fromto(const int8 direction, const uint32 fromid, const uint32 toid, cfh_threaddata_t & cfhd)
 {
-  FUNCSTART("void Skim<TVHASH_T>::checkForHashes_fromto(const int8 direction, const uint32 fromid, const uint32 toid, cfh_threaddata_t & cfhd)");
+  FUNCSTART("void Skim::checkForHashes_fromto(const int8 direction, const uint32 fromid, const uint32 toid, cfh_threaddata_t & cfhd)");
 
   // really?
   //BUGIFTHROW(Read::getNumSequencingTypes() >4, "Must be reworked for new sequencing types! (encasement shortcuts & others?");
@@ -1716,18 +1598,17 @@ void Skim<TVHASH_T>::checkForHashes_fromto(const int8 direction, const uint32 fr
   cfhd.tagmaskvector.clear();;
   // do NOT clear vector<skimhitforsave_t> shfsv !!!
   cfhd.ridswithmatches.clear();
-  for(uint32 ocvi=0; ocvi<2; ++ocvi){
-    cfhd.uidswithnewcritlevelvl[ocvi].clear();
-    cfhd.uidswithnewcritlevelvr[ocvi].clear();
-    cfhd.critlevellofnewuidsv[ocvi].clear();
-    cfhd.critlevelrofnewuidsv[ocvi].clear();
-  }
+  cfhd.uidswithnewcritlevell.clear();
+  cfhd.uidswithnewcritlevelr.clear();
+  cfhd.critlevellofnewuids.clear();
+  cfhd.critlevelrofnewuids.clear();
+
 
   for(uint32 actreadid=fromid; actreadid<toid; actreadid++){
     //if(actreadid>100) return;
 
     // don't need to go through identified megahubs again
-    if(SKIM3_megahubsptr!=nullptr && (*SKIM3_megahubsptr)[actreadid]>0) continue;
+    if(SKIM3_megahubs[actreadid]>0) continue;
 
     // if this read has been fully encased by other reads, then also
     //  skip it
@@ -1735,7 +1616,7 @@ void Skim<TVHASH_T>::checkForHashes_fromto(const int8 direction, const uint32 fr
 
     Read & actread= SKIM3_readpool->getRead(actreadid);
     if(!actread.hasValidData()
-      || !actread.isUsedInAssembly()) continue;
+      || !actread.isUsedInAssembly()) continue; 
 
     uint32 slen=actread.getLenClippedSeq();
 
@@ -1743,7 +1624,7 @@ void Skim<TVHASH_T>::checkForHashes_fromto(const int8 direction, const uint32 fr
 
     cfhd.singlereadvhraparray.resize(slen);
 
-    auto srvaI=cfhd.singlereadvhraparray.begin();
+    vector<vhrap_t>::iterator srvaI=cfhd.singlereadvhraparray.begin();
     const vector<Read::bposhashstat_t> & bposhashstats=actread.getBPosHashStats();
 
     uint32 hashesmade;
@@ -1790,20 +1671,23 @@ void Skim<TVHASH_T>::checkForHashes_fromto(const int8 direction, const uint32 fr
     cfhd.singlereadvhraparray.resize(hashesmade);
 
     srvaI=cfhd.singlereadvhraparray.begin();
+    vector<vhrap_t>::const_iterator lowerbound;
+    vector<vhrap_t>::const_iterator upperbound;
     uint32 truetestsm2hits=0;
     for(; srvaI != cfhd.singlereadvhraparray.end(); srvaI++){
-      auto lowerbound=SKIM3_vashortcuts_begin[static_cast<uint64>(srvaI->vhash & SKIM3_MAXVHASHMASK)];
-      auto upperbound=SKIM3_vashortcuts_end[static_cast<uint64>(srvaI->vhash & SKIM3_MAXVHASHMASK)];
+      lowerbound=SKIM3_vashortcuts_begin[srvaI->vhash & MAXVHASHMASK];
+      upperbound=SKIM3_vashortcuts_end[srvaI->vhash & MAXVHASHMASK];
 
-      // "SKIM3_empty_vector_vhrap_t.end()" is the "nullptr" replacement
+      // "SKIM3_empty_vector_vhrap_t.end()" is the "NULL" replacement
       if(SKIM3_completevhraparray_end != lowerbound){
 	if(SKIM3_basesperhash>12){
 	  // with more than 12 bases in a hash, the vhrap array is
-	  //  subdivided
-	  auto p=equal_range(lowerbound,
-			     upperbound,
-			     *srvaI,
-			     compareVHRAPArrayElem_);
+	  //  subdivided 
+	  pair<vector<vhrap_t>::const_iterator, vector<vhrap_t>::const_iterator>
+	    p=equal_range(lowerbound,
+			  upperbound,
+			  *srvaI,
+			  Skim__compareVHRAPArrayElem_);
 	  lowerbound=p.first;
 	  upperbound=p.second;
 	}
@@ -1814,16 +1698,12 @@ void Skim<TVHASH_T>::checkForHashes_fromto(const int8 direction, const uint32 fr
 	  CEBUG("/// " << actreadid << '\t' << lowerbound->readid << '\n');
 
 	  // hmmmm .....
-	  // original: if(actreadid > lowerbound->readid){
+	  // original: if(actreadid > lowerbound->readid){ 
 	  // this fails spectacularly for mapping now that rails shifted to end of pool
-	  // correct resolution would be adding
-	  //
+	  // correct resolution would be adding 
+	  //        
 	  // but this might slow down the search quite a bit
 	  if(actreadid > lowerbound->readid){
-	    // NO! do not check this here ... terrible time penalty
-	    // do that in checkForPotentialHits() !
-	      //&& SKIM3_nomorehitseie[actreadid] == 0
-	      //&& SKIM3_nomorehitseie[lowerbound->readid] == 0){
 	    CEBUG("/// take!\n");
 	    cfhd.readhashmatches.resize(cfhd.readhashmatches.size()+1);
 	    cfhd.readhashmatches.back().rid2=lowerbound->readid;
@@ -1837,7 +1717,7 @@ void Skim<TVHASH_T>::checkForHashes_fromto(const int8 direction, const uint32 fr
     }
 
     if(actreadid % 1 == 0) {
-      CEBUG("actreadid: " << actreadid << "\treadhashmatches.size(): " << cfhd.readhashmatches.size() << "\ttruetestsm2hits: " << truetestsm2hits << endl);
+      CEBUG("actreadid: " << actreadid << "\treadhashmatches.size(): " << readhashmatches.size() << "\ttruetestsm2hits: " << truetestsm2hits << endl);
     }
 
     // Hmmm ... this does not represent the full truth, but without "if" there
@@ -1847,38 +1727,35 @@ void Skim<TVHASH_T>::checkForHashes_fromto(const int8 direction, const uint32 fr
     //if(SKIM_partfirstreadid==0)(*SKIM3_rawhashitcounter)[actreadid]+=truetestsm2hits;
 
     if(cfhd.readhashmatches.size()>0){
-      bool ismegahub=false;
-      if(SKIM3_megahubsptr!=nullptr && truetestsm2hits>SKIM3_megahubcap) {
-	CEBUG("Potential megahub: " << actreadid << "\treadhashmatches.size(): " << cfhd.readhashmatches.size() << endl);
-
-	// ok, potential megahub. To save the situation, iteratively throw out
-	//  all hashes with a frequency > nlevel
-	// Throws out first frequency 7, then 6, then 5 as last resort.
-	// If the size of readhashmatches gets below the cap,
-	//  then it's not treated as megahub
+      if(truetestsm2hits>150000) {
+	CEBUG("Potential megahub: " << actreadid << "\treadhashmatches.size(): " << readhashmatches.size() << endl);
 
-	for(uint32 nlevel=6; nlevel>=4 && cfhd.readhashmatches.size()>SKIM3_megahubcap; --nlevel){
-	  vector<readhashmatch_t>::iterator dstI=cfhd.readhashmatches.begin();
+	// ok, potential megahub. To save the situation, throw out
+	//  all hashes with a frequency > 4
+	// if the size of readhashmatches can be reduced by at least 50%,
+	//  then it's not treated as megahub
 
-	  for(auto srcI=dstI; srcI != cfhd.readhashmatches.end(); ++srcI){
+	size_t oldsize=cfhd.readhashmatches.size();
+	vector<readhashmatch_t>::iterator dstI=cfhd.readhashmatches.begin();
+	vector<readhashmatch_t>::iterator srcI=dstI;
+	
+	for(; srcI != cfhd.readhashmatches.end(); srcI++){
+	  if(srcI->bhashstats.getFrequency()<=4){
 	    *dstI=*srcI;
-	    if(srcI->bhashstats.getFrequency()<=nlevel){
-	      ++dstI;
-	    }
+	    dstI++;
 	  }
-	  cfhd.readhashmatches.resize(dstI-cfhd.readhashmatches.begin());
 	}
+	cfhd.readhashmatches.resize(dstI-cfhd.readhashmatches.begin());
 
-	if(cfhd.readhashmatches.size() > SKIM3_megahubcap) {
+	if(cfhd.readhashmatches.size() > oldsize/2) {
 	  CEBUG("Megahub confirmed: " << actreadid << "\treadhashmatches.size(): " << cfhd.readhashmatches.size() << endl);
-	  (*SKIM3_megahubsptr)[actreadid]=1;
-	  ismegahub=true;
+	  SKIM3_megahubs[actreadid]=1;
 	}
       }
-      if(!ismegahub) {
+      if(!SKIM3_megahubs[actreadid]) {
 	checkForPotentialHits(direction, actreadid, cfhd.tmpmatchwith, cfhd.readhashmatches, cfhd.smallhist4repeats);
 
-	selectPotentialHitsForSave2(direction, actreadid,
+	selectPotentialHitsForSave2(direction, actreadid, 
 				    cfhd);
 
       }
@@ -1893,7 +1770,7 @@ void Skim<TVHASH_T>::checkForHashes_fromto(const int8 direction, const uint32 fr
 
 }
 
-//#define CEBUG(bla)
+//#define CEBUG(bla) 
 
 
 
@@ -1902,15 +1779,17 @@ void Skim<TVHASH_T>::checkForHashes_fromto(const int8 direction, const uint32 fr
 /*************************************************************************
  *
  *
- *
+ * 
  *************************************************************************/
 
+#define CEBUG2(bla)
+
 //#define CEBUG(bla)   {cout << bla; cout.flush();}
+//#define CEBUG2(bla)   {cout << bla; cout.flush();}
 
-template<typename TVHASH_T>
-void Skim<TVHASH_T>::selectPotentialHitsForSave2(const int8 direction, const uint32 actreadid, cfh_threaddata_t & cfhd)
+void Skim::selectPotentialHitsForSave2(const int8 direction, const uint32 actreadid, cfh_threaddata_t & cfhd)
 {
-  FUNCSTART("void Skim<TVHASH_T>::selectPotentialHitsForSave2(const int8 direction, const uint32 actreadid, cfh_threaddata_t & cfhd)");
+  FUNCSTART("void Skim::selectPotentialHitsForSave2(const int8 direction, const uint32 actreadid, cfh_threaddata_t & cfhd)");
 
   cfhd.ridswithmatches.clear();
   if(cfhd.tmpmatchwith.empty()) return;
@@ -1919,7 +1798,7 @@ void Skim<TVHASH_T>::selectPotentialHitsForSave2(const int8 direction, const uin
   updateCriterionLevels(direction,actreadid,
 			cfhd);
 
-  sort(cfhd.tmpmatchwith.begin(), cfhd.tmpmatchwith.end(), sortMWByEstimScore_);
+  sort(cfhd.tmpmatchwith.begin(), cfhd.tmpmatchwith.end(), Skim__sortMWByEstimScore_);
 
   ADSEstimator adse;
 
@@ -1930,13 +1809,13 @@ void Skim<TVHASH_T>::selectPotentialHitsForSave2(const int8 direction, const uin
 
   bool takenrailfulllength=false;
 
+  CEBUG("actreadid critlevel: " << static_cast<uint16>((*SKIM3_overlapcritlevell)[actreadid]) << " " << static_cast<uint16>((*SKIM3_overlapcritlevelr)[actreadid]) << '\n');
 
   // take all which have the same or lower level (if it is not 255)
 
   vector<matchwithsorter_t>::iterator tmwI=cfhd.tmpmatchwith.begin();
   for(;tmwI!=cfhd.tmpmatchwith.end(); ++tmwI) {
-    CEBUG("### " << tmwI-cfhd.tmpmatchwith.begin() << " " << (*SKIM3_readpool)[actreadid].getName() << " " << (*SKIM3_readpool)[tmwI->otherid].getName());
-    CEBUG("\ntmwI: " << *tmwI << endl);
+    CEBUG("### " << tmwI-cfhd.tmpmatchwith.begin() << "\ntmwI: " << *tmwI << endl);
 
     adse.calcNewEstimateFromSkim(
       tmwI->eoffset,
@@ -1954,38 +1833,30 @@ void Skim<TVHASH_T>::selectPotentialHitsForSave2(const int8 direction, const uin
 			     static_cast<uint8>(tmwI->percent_in_overlap),
 			     ocll,
 			     oclr);
-
-    uint32 ocvi=0;  // overlap criterion vector index 0 is for norept overlaps
-    if(!tmwI->ol_norept) ocvi=1;  // index 1 is for all other rept overlaps (among them the rept)
-
-    auto & oclvl = (*SKIM3_overlapcritlevelvl)[ocvi];
-    auto & oclvr = (*SKIM3_overlapcritlevelvr)[ocvi];
-
-    CEBUG("actreadid critlevel: " << static_cast<uint16>(oclvl[actreadid]) << " " << static_cast<uint16>(oclvr[actreadid]) << '\n');
     CEBUG("ocll: " << static_cast<uint16>(ocll) << " " << static_cast<uint16>(oclr) << '\n');
 
     bool regulartake=false;
 
-    if((ocll!=255 && ocll<=oclvl[actreadid])
-       || (oclr!=255 && oclr<=oclvr[actreadid])){
+    if((ocll!=255 && ocll<=(*SKIM3_overlapcritlevell)[actreadid])
+       || (oclr!=255 && oclr<=(*SKIM3_overlapcritlevelr)[actreadid])){
       regulartake=true;
-    }else if(SKIM3_readpool->getRead(actreadid).isSequencingType(ReadGroupLib::SEQTYPE_SOLEXA)){
+    }else if(SKIM3_readpool->getRead(actreadid).isSequencingType(Read::SEQTYPE_SOLEXA)){
       // if it's a Solexa and the best overlapcritlevel is not 0, we are probably in a under-coverage
       //  situation ... try to account for that by being less harsh
       // see purgeUnnecessaryHitsFromSkimFile() for the value "29"
       if(ocll <= 29
-	 && oclvl[actreadid]!= 0
-	 && oclvl[actreadid] <= 29){
+	 && (*SKIM3_overlapcritlevell)[actreadid]!= 0 
+	 && (*SKIM3_overlapcritlevell)[actreadid] <= 29){
 	regulartake=true;
       }else if(oclr <= 29
-	       && oclvr[actreadid]!= 0
-	       && oclvr[actreadid] <= 29){
+	       && (*SKIM3_overlapcritlevelr)[actreadid]!= 0 
+	       && (*SKIM3_overlapcritlevelr)[actreadid] <= 29){
 	regulartake=true;
       }
     }
 
     if(regulartake){
-      CEBUG("actreadid critlevel: " << static_cast<uint16>(oclvl[actreadid]) << " " << static_cast<uint16>(oclvr[actreadid]) << '\n');
+      CEBUG("actreadid critlevel: " << static_cast<uint16>((*SKIM3_overlapcritlevell)[actreadid]) << " " << static_cast<uint16>((*SKIM3_overlapcritlevelr)[actreadid]) << '\n');
       tmwI->taken=true;
       if(numleftext>0 && adse.getEstimatedLeftExpand(actreadid)>0) --numleftext;
       if(numrightext>0 && adse.getEstimatedRightExpand(actreadid)>0) --numrightext;
@@ -1995,7 +1866,7 @@ void Skim<TVHASH_T>::selectPotentialHitsForSave2(const int8 direction, const uin
 	// if one of the reads is a rail and there is a full-length overlap, we have to
 	//  take that hit no matter what.
 	// Reason: either it's a 100% hit, then it's obvious, or its a <100% hit and then
-	//  the Smith-Waterman *needs* to have a look at that bugger to get the very best
+	//  the Smith-Waterman *needs* to have a look at that bugger to get the very best 
 	//  placement
 	tmwI->taken=true;
 	takenrailfulllength=true;
@@ -2091,7 +1962,7 @@ void Skim<TVHASH_T>::selectPotentialHitsForSave2(const int8 direction, const uin
       shfs.ol_norept      =tmwI->ol_norept;
       shfs.ol_rept        =tmwI->ol_rept;
 
-      CEBUG("save2: " << actreadid << "\n" << *tmwI);
+      CEBUG2("save2: " << actreadid << "\n" << *tmwI);
 
       cfhd.ridswithmatches.push_back(min(tmwI->otherid,actreadid));
     }else{
@@ -2103,22 +1974,22 @@ void Skim<TVHASH_T>::selectPotentialHitsForSave2(const int8 direction, const uin
     }
   }
 
-//  CEBUG("Savestat " << actreadid << ": " << cfhd.ridswithmatches.size() << endl);
-//  if(!cfhd.ridswithmatches.empty()){
-//    vector<uint32>::const_iterator rwmI=cfhd.ridswithmatches.begin();
-//    {
-//      // TODO: should get rid of that counter ... meaningless now
-//      boost::mutex::scoped_lock lock(SKIM3_whpid_mutex);
-//      SKIM3_totalhitschosen+=cfhd.ridswithmatches.size();
-//    }
-//  }
-
+  CEBUG2("Savestat " << actreadid << ": " << cfhd.ridswithmatches.size() << endl);
+  if(!cfhd.ridswithmatches.empty()){
+    vector<uint32>::const_iterator rwmI=cfhd.ridswithmatches.begin();
+    {
+      // TODO: should get rid of that counter ... meaningless now
+      boost::mutex::scoped_lock lock(SKIM3_whpid_mutex);
+      SKIM3_totalhitschosen+=cfhd.ridswithmatches.size();
+    }
+  }
   cfhd.ridswithmatches.clear();
 
   CEBUG("end selectPotentialHitsForSave2()\n");
 
   FUNCEND();
 }
+//#define CEBUG2(bla)
 //#define CEBUG(bla)
 
 
@@ -2131,31 +2002,28 @@ void Skim<TVHASH_T>::selectPotentialHitsForSave2(const int8 direction, const uin
  *  to get down the number of calls to ADSEstimator calculations)
  *
  *  - stores the estimated score in estimscore
- *  - calculates ol_fulllength and ol_fullencased
+ *  - calculates ol_fulllength and ol_fullencased 
  *
  *************************************************************************/
 
 //#define CEBUG(bla)   {cout << bla; cout.flush();}
-template<typename TVHASH_T>
-void Skim<TVHASH_T>::updateCriterionLevels(const int8 direction, const uint32 actreadid, cfh_threaddata_t & cfhd)
+void Skim::updateCriterionLevels(const int8 direction, const uint32 actreadid, cfh_threaddata_t & cfhd)
 {
-  FUNCSTART("void Skim<TVHASH_T>::updateCriterionLevels(const int8 direction, const uint32 actreadid, vector<matchwithsorter_t> & tmpmatchwith)");
+  FUNCSTART("void Skim::updateCriterionLevels(const int8 direction, const uint32 actreadid, vector<matchwithsorter_t> & tmpmatchwith)");
 
   CEBUG("start updateCriterionLevels() " << actreadid << '\n');
 
   ADSEstimator adse;
 
-  for(uint32 ocvi=0; ocvi<2; ++ocvi){
-    cfhd.uidswithnewcritlevelvl[ocvi].clear();
-    cfhd.uidswithnewcritlevelvr[ocvi].clear();
-    cfhd.critlevellofnewuidsv[ocvi].clear();
-    cfhd.critlevelrofnewuidsv[ocvi].clear();
-  }
+  cfhd.uidswithnewcritlevell.clear();
+  cfhd.uidswithnewcritlevelr.clear();
+  cfhd.critlevellofnewuids.clear();
+  cfhd.critlevelrofnewuids.clear();
 
-  uint8 actreadcritlevell[2]={255,255};
-  uint8 actreadcritlevelr[2]={255,255};
-  uint8 tmpnewcll=255;
-  uint8 tmpnewclr=255;
+  uint8 actreadcritlevell=255;
+  uint8 actreadcritlevelr=255;
+  uint8 newcll=255;
+  uint8 newclr=255;
 
   vector<matchwithsorter_t>::iterator tmwI=cfhd.tmpmatchwith.begin();
   for(;tmwI!=cfhd.tmpmatchwith.end(); tmwI++) {
@@ -2185,73 +2053,66 @@ void Skim<TVHASH_T>::updateCriterionLevels(const int8 direction, const uint32 ac
 
     CEBUG("tmwI after: " << *tmwI << endl);
 
-    uint32 ocvi=0;  // overlap criterion vector index 0 is for norept overlaps
-    if(!tmwI->ol_norept) ocvi=1;  // index 1 is for all other rept overlaps (among them the rept)
-
-    if(actreadcritlevell[ocvi]>0 || actreadcritlevelr[ocvi]>0){
-      CEBUG("old: " << static_cast<uint16>(actreadcritlevell[ocvi]) << " " << static_cast<uint16>(actreadcritlevelr[ocvi]) << '\n');
+    if(actreadcritlevell>0 || actreadcritlevelr>0){
+      CEBUG("old: " << static_cast<uint16>(actreadcritlevell) << " " << static_cast<uint16>(actreadcritlevelr) << '\n');
       getOverlapCriterionLevel(actreadid,
 			       SKIM3_readpool->getRead(actreadid).getSequencingType(),
 			       adse,
 			       static_cast<uint8>(tmwI->percent_in_overlap),
-			       tmpnewcll,tmpnewclr);
-      if(tmpnewcll<actreadcritlevell[ocvi]) actreadcritlevell[ocvi]=tmpnewcll;
-      if(tmpnewclr<actreadcritlevelr[ocvi]) actreadcritlevelr[ocvi]=tmpnewclr;
-      CEBUG("new: " << static_cast<uint16>(actreadcritlevell[ocvi]) << " " << static_cast<uint16>(actreadcritlevelr[ocvi]) << '\n');
+			       newcll,newclr);
+      if(newcll<actreadcritlevell) actreadcritlevell=newcll;
+      if(newclr<actreadcritlevelr) actreadcritlevelr=newclr;
+      CEBUG("new: " << static_cast<uint16>(actreadcritlevell) << " " << static_cast<uint16>(actreadcritlevelr) << '\n');
     }
 
     // then for other id
     getOverlapCriterionLevel(tmwI->otherid,SKIM3_readpool->getRead(tmwI->otherid).getSequencingType(),
 			     adse,
 			     static_cast<uint8>(tmwI->percent_in_overlap),
-			     tmpnewcll,tmpnewclr);
-    if(tmpnewcll<(*SKIM3_overlapcritlevelvl)[ocvi][tmwI->otherid]){
-      cfhd.uidswithnewcritlevelvl[ocvi].push_back(tmwI->otherid);
-      cfhd.critlevellofnewuidsv[ocvi].push_back(tmpnewcll);
-      CEBUG("tmpnewcll: pushback " << cfhd.uidswithnewcritlevelvl[ocvi].back() << "\t" << static_cast<uint16>(cfhd.critlevellofnewuidsv[ocvi].back()) << '\n');
+			     newcll,newclr);
+    if(newcll<(*SKIM3_overlapcritlevell)[tmwI->otherid]){
+      cfhd.uidswithnewcritlevell.push_back(tmwI->otherid);
+      cfhd.critlevellofnewuids.push_back(newcll);
+      CEBUG("newcll: pushback " << cfhd.uidswithnewcritlevell.back() << "\t" << static_cast<uint16>(cfhd.critlevellofnewuids.back()) << '\n');
     }
-    if(tmpnewclr<(*SKIM3_overlapcritlevelvr)[ocvi][tmwI->otherid]){
-      cfhd.uidswithnewcritlevelvr[ocvi].push_back(tmwI->otherid);
-      cfhd.critlevelrofnewuidsv[ocvi].push_back(tmpnewclr);
-      CEBUG("tmpnewclr: pushback " << cfhd.uidswithnewcritlevelvr[ocvi].back() << "\t" << static_cast<uint16>(cfhd.critlevelrofnewuidsv[ocvi].back()) << '\n');
+    if(newclr<(*SKIM3_overlapcritlevelr)[tmwI->otherid]){
+      cfhd.uidswithnewcritlevelr.push_back(tmwI->otherid);
+      cfhd.critlevelrofnewuids.push_back(newclr);
+      CEBUG("newclr: pushback " << cfhd.uidswithnewcritlevelr.back() << "\t" << static_cast<uint16>(cfhd.critlevelrofnewuids.back()) << '\n');
     }
   }
 
   {
     boost::mutex::scoped_lock lock(SKIM3_critlevelwrite_mutex);
-    for(uint32 ocvi=0; ocvi<2; ++ocvi){
-      if(actreadcritlevell[ocvi]<(*SKIM3_overlapcritlevelvl)[ocvi][actreadid]){
-	CEBUG("ari: update critlevell " << actreadid << " " << static_cast<uint16>((*SKIM3_overlapcritlevelvl)[ocvi][actreadid]));
-	(*SKIM3_overlapcritlevelvl)[ocvi][actreadid]=actreadcritlevell[ocvi];
-	CEBUG(" to " << static_cast<uint16>((*SKIM3_overlapcritlevelvl)[ocvi][actreadid]) << '\n');
-      }
-      if(actreadcritlevelr[ocvi]<(*SKIM3_overlapcritlevelvr)[ocvi][actreadid]){
-	CEBUG("ari: update critlevelr " << actreadid << " " << static_cast<uint16>((*SKIM3_overlapcritlevelvr)[ocvi][actreadid]));
-	(*SKIM3_overlapcritlevelvr)[ocvi][actreadid]=actreadcritlevelr[ocvi];
-	CEBUG(" to " << static_cast<uint16>((*SKIM3_overlapcritlevelvr)[ocvi][actreadid]) << '\n');
-      }
-    }
-
-    for(uint32 ocvi=0; ocvi<2; ++ocvi){
-      vector<uint32>::const_iterator nI=cfhd.uidswithnewcritlevelvl[ocvi].begin();
-      vector<uint8>::const_iterator cI=cfhd.critlevellofnewuidsv[ocvi].begin();
-      for(; nI != cfhd.uidswithnewcritlevelvl[ocvi].end(); ++nI, ++cI){
-	// still check ... might have changed in the mean time by another thread
-	if(*cI < (*SKIM3_overlapcritlevelvl)[ocvi][*nI]){
-	  CEBUG("ori: update critlevell " << *nI <<  " " << static_cast<uint16>((*SKIM3_overlapcritlevelvl)[ocvi][*nI]));
-	  (*SKIM3_overlapcritlevelvl)[ocvi][*nI]=*cI;
-	  CEBUG(" to " << static_cast<uint16>((*SKIM3_overlapcritlevelvl)[ocvi][*nI]) << '\n');
-	}
+    if(actreadcritlevell<(*SKIM3_overlapcritlevell)[actreadid]){
+      CEBUG("ari: update critlevell " << actreadid << " " << static_cast<uint16>((*SKIM3_overlapcritlevell)[actreadid]));
+      (*SKIM3_overlapcritlevell)[actreadid]=actreadcritlevell;
+      CEBUG(" to " << static_cast<uint16>((*SKIM3_overlapcritlevell)[actreadid]) << '\n');
+    }
+    if(actreadcritlevelr<(*SKIM3_overlapcritlevelr)[actreadid]){
+      CEBUG("ari: update critlevelr " << actreadid << " " << static_cast<uint16>((*SKIM3_overlapcritlevelr)[actreadid]));
+      (*SKIM3_overlapcritlevelr)[actreadid]=actreadcritlevelr;
+      CEBUG(" to " << static_cast<uint16>((*SKIM3_overlapcritlevelr)[actreadid]) << '\n');
+    }
+
+    vector<uint32>::const_iterator nI=cfhd.uidswithnewcritlevell.begin();
+    vector<uint8>::const_iterator cI=cfhd.critlevellofnewuids.begin();
+    for(; nI != cfhd.uidswithnewcritlevell.end(); ++nI, ++cI){
+      // still check ... might have changed in the mean time by another thread
+      if(*cI < (*SKIM3_overlapcritlevell)[*nI]){
+	CEBUG("ori: update critlevell " << *nI <<  " " << static_cast<uint16>((*SKIM3_overlapcritlevell)[*nI]));
+	(*SKIM3_overlapcritlevell)[*nI]=*cI;
+	CEBUG(" to " << static_cast<uint16>((*SKIM3_overlapcritlevell)[*nI]) << '\n');
       }
-      nI=cfhd.uidswithnewcritlevelvr[ocvi].begin();
-      cI=cfhd.critlevelrofnewuidsv[ocvi].begin();
-      for(; nI != cfhd.uidswithnewcritlevelvr[ocvi].end(); ++nI, ++cI){
-	// still check ... might have changed in the mean time by another thread
-	if(*cI < (*SKIM3_overlapcritlevelvr)[ocvi][*nI]){
-	  CEBUG("ori: update critlevelr " << *nI <<  " " << static_cast<uint16>((*SKIM3_overlapcritlevelvr)[ocvi][*nI]));
-	  (*SKIM3_overlapcritlevelvr)[ocvi][*nI]=*cI;
-	  CEBUG(" to " << static_cast<uint16>((*SKIM3_overlapcritlevelvr)[ocvi][*nI]) << '\n');
-	}
+    }
+    nI=cfhd.uidswithnewcritlevelr.begin();
+    cI=cfhd.critlevelrofnewuids.begin();
+    for(; nI != cfhd.uidswithnewcritlevelr.end(); ++nI, ++cI){
+      // still check ... might have changed in the mean time by another thread
+      if(*cI < (*SKIM3_overlapcritlevelr)[*nI]){
+	CEBUG("ori: update critlevelr " << *nI <<  " " << static_cast<uint16>((*SKIM3_overlapcritlevelr)[*nI]));
+	(*SKIM3_overlapcritlevelr)[*nI]=*cI;
+	CEBUG(" to " << static_cast<uint16>((*SKIM3_overlapcritlevelr)[*nI]) << '\n');
       }
     }
 
@@ -2270,13 +2131,22 @@ void Skim<TVHASH_T>::updateCriterionLevels(const int8 direction, const uint32 ac
  * Returns criterium levels for overlaps extending left and right
  *
  *
- *   Sanger, 454, Ion, Text, PacBio
- *     crit0: 80% overlap
- *     crit1: 70% overlap
+ *   Sanger:
+ *     crit1: 80% overlap
+ *     crit2: 60% overlap
+ *   454:
+ *     crit1: 80% overlap
  *     crit2: 60% overlap
- *     crit3: 50% overlap
+ *   IonTorrent:
+ *     crit1: 90% overlap
+ *     crit2: 80% overlap
+ *     crit3: 70% overlap
+ *     crit4: 60% overlap
  *   Solexa:
  *     crit-level from 0 to 59, see code
+ *   PacBio:
+ *     crit1: 80% overlap
+ *     crit2: 60% overlap
  *
  * Special: if none of above, level = 240 if fully encased
  *          made for hits against rails, so that partial matches
@@ -2288,14 +2158,13 @@ void Skim<TVHASH_T>::updateCriterionLevels(const int8 direction, const uint32 ac
 //#define CEBUG(bla)   {cout << bla; cout.flush();}
 //#define CEBUG(bla)   {if(adse.getID1()==2 && adse.getID2()==140820) {cout << bla; cout.flush();}}
 
-#if CPP_READ_SEQTYPE_END != 8
-#error "This code is made for 8 sequencing types, adapt!"
+#if CPP_READ_SEQTYPE_END != 6
+#error "This code is made for 6 sequencing types, adapt!"
 #endif
-
-template<typename TVHASH_T>
-void Skim<TVHASH_T>::getOverlapCriterionLevel(const uint32 actreadid, const uint8 seqtype, const ADSEstimator & adse, const uint8 relscore, uint8 & levell, uint8 & levelr)
+  
+void Skim::getOverlapCriterionLevel(const uint32 actreadid, const uint8 seqtype, const ADSEstimator & adse, const uint8 relscore, uint8 & levell, uint8 & levelr)
 {
-  FUNCSTART("void Skim<TVHASH_T>::getOverlapCriterionLevel(const uint32 actreadid, const uint8 seqtype, const ADSEstimator & adse, const uint8 relscore, uint8 & levell, uint8 & levelr)");
+  FUNCSTART("void Skim::getOverlapCriterionLevel(const uint32 actreadid, const uint8 seqtype, const ADSEstimator & adse, const uint8 relscore, uint8 & levell, uint8 & levelr)");
 
   uint32 overlapratiopc=100*adse.getEstimatedOverlap()/adse.getLen(actreadid);
 
@@ -2305,16 +2174,12 @@ void Skim<TVHASH_T>::getOverlapCriterionLevel(const uint32 actreadid, const uint
   levell=255;
   levelr=255;
   switch(seqtype){
-  case ReadGroupLib::SEQTYPE_SOLEXA : {
+  case Read::SEQTYPE_SOLEXA : {
     if(relscore>=95){
       // level from 0 to 179
       uint8 startlevel=(100-relscore)*30;;
       startlevel+=29-(adse.getEstimatedOverlap()*29/adse.getLen(actreadid));
       BUGIFTHROW(startlevel>=200,"Startlevel>=200? " << static_cast<uint16>(startlevel) << "\tid1: " << adse.getID1() << " id2: " << adse.getID2() << "\n" << adse);
-
-      // this is for reads longer than 100bp (MiSeq), because this is really "good enough"
-      if(adse.getEstimatedOverlap()>=100 && relscore==100) startlevel=0;
-
       if(adse.getEstimatedLeftExpand(actreadid)>0){
 	levell=startlevel;
       }
@@ -2324,12 +2189,9 @@ void Skim<TVHASH_T>::getOverlapCriterionLevel(const uint32 actreadid, const uint
     }
     break;
   }
-  case ReadGroupLib::SEQTYPE_SANGER :
-  case ReadGroupLib::SEQTYPE_454GS20 :
-  case ReadGroupLib::SEQTYPE_IONTORRENT :
-  case ReadGroupLib::SEQTYPE_PACBIOHQ :
-  case ReadGroupLib::SEQTYPE_PACBIOLQ :
-  case ReadGroupLib::SEQTYPE_TEXT :{
+  case Read::SEQTYPE_SANGER :
+  case Read::SEQTYPE_454GS20 :
+  case Read::SEQTYPE_PACBIO :{
     if(overlapratiopc>=80){
       if(adse.getEstimatedLeftExpand(actreadid)>0){
 	levell=0;
@@ -2337,26 +2199,62 @@ void Skim<TVHASH_T>::getOverlapCriterionLevel(const uint32 actreadid, const uint
       if(adse.getEstimatedRightExpand(actreadid)>0){
 	levelr=0;
       }
-    }else if(overlapratiopc>=70){
+    }else if(overlapratiopc>=60){
       if(adse.getEstimatedLeftExpand(actreadid)>0){
 	levell=1;
       }
       if(adse.getEstimatedRightExpand(actreadid)>0){
 	levelr=1;
       }
-    }else if(overlapratiopc>=60){
-      if(adse.getEstimatedLeftExpand(actreadid)>0){
-	levell=2;
-      }
-      if(adse.getEstimatedRightExpand(actreadid)>0){
-	levelr=2;
-      }
-    }else if(overlapratiopc>=50){
-      if(adse.getEstimatedLeftExpand(actreadid)>0){
-	levell=3;
+    }
+    break;
+  }
+  case Read::SEQTYPE_IONTORRENT :{
+    if(adse.getLen(actreadid)>120){
+      if(overlapratiopc>=80){
+	if(adse.getEstimatedLeftExpand(actreadid)>0){
+	  levell=0;
+	}
+	if(adse.getEstimatedRightExpand(actreadid)>0){
+	  levelr=0;
+	}
+      }else if(overlapratiopc>=60){
+	if(adse.getEstimatedLeftExpand(actreadid)>0){
+	  levell=1;
+	}
+	if(adse.getEstimatedRightExpand(actreadid)>0){
+	  levelr=1;
+	}
       }
-      if(adse.getEstimatedRightExpand(actreadid)>0){
-	levelr=3;
+    }else{
+      if(overlapratiopc>=90){
+	if(adse.getEstimatedLeftExpand(actreadid)>0){
+	  levell=0;
+	}
+	if(adse.getEstimatedRightExpand(actreadid)>0){
+	  levelr=0;
+	}
+      }else if(overlapratiopc>=80){
+	if(adse.getEstimatedLeftExpand(actreadid)>0){
+	  levell=1;
+	}
+	if(adse.getEstimatedRightExpand(actreadid)>0){
+	  levelr=1;
+	}
+      }else if(overlapratiopc>=70){
+	if(adse.getEstimatedLeftExpand(actreadid)>0){
+	  levell=2;
+	}
+	if(adse.getEstimatedRightExpand(actreadid)>0){
+	  levelr=2;
+	}
+      }else if(overlapratiopc>=60){
+	if(adse.getEstimatedLeftExpand(actreadid)>0){
+	  levell=3;
+	}
+	if(adse.getEstimatedRightExpand(actreadid)>0){
+	  levelr=3;
+	}
       }
     }
     break;
@@ -2406,8 +2304,7 @@ void Skim<TVHASH_T>::getOverlapCriterionLevel(const uint32 actreadid, const uint
 //#define CEBUG(bla)   {cout << bla; cout.flush();}
 //#define CEBUG_extra_cFPH
 
-template<typename TVHASH_T>
-void Skim<TVHASH_T>::checkForPotentialHits(const int8 direction, const uint32 actreadid, vector<matchwithsorter_t> & tmpmatchwith, vector<readhashmatch_t> & readhashmatches, vector<uint32> & smallhist4repeats)
+void Skim::checkForPotentialHits(const int8 direction, const uint32 actreadid, vector<matchwithsorter_t> & tmpmatchwith, vector<readhashmatch_t> & readhashmatches, vector<uint32> & smallhist4repeats)
 {
   //bool dodebug=false;
 
@@ -2420,10 +2317,9 @@ void Skim<TVHASH_T>::checkForPotentialHits(const int8 direction, const uint32 ac
   // so, if it is empty, return immediately
   if(readhashmatches.empty()) return;
 
-  sort(readhashmatches.begin(), readhashmatches.end(), sortreadhashmatch_t_);
-
+  sort(readhashmatches.begin(), readhashmatches.end(), Skim__sortreadhashmatch_t_);
+  
   bool actreadisrail=SKIM3_readpool->getRead(actreadid).isRail();
-  bool actreadhasenough=SKIM3_nomorehitseie[actreadid]>0;
 
   vector<readhashmatch_t>::const_iterator sI=readhashmatches.begin();
   uint32 possiblehits=0;
@@ -2447,17 +2343,14 @@ void Skim<TVHASH_T>::checkForPotentialHits(const int8 direction, const uint32 ac
       if(sI!=readhashmatches.end()) countid=sI->rid2;
       continue;
     }
-    // 3) both reads have the "enough-is-enough" status
-    // nope, don't do that here! Do it when we know whether a strong match exists
-
-    //  4) this read pair has been banned previously
+    //  3) this read pair has been banned previously
     if((*SKIM3_bannedoverlaps).checkIfBanned(actreadid,rid2)){
       for(;sI!=readhashmatches.end() && sI->rid2==rid2; ++sI);
       if(sI!=readhashmatches.end()) countid=sI->rid2;
-//      {
-//	boost::mutex::scoped_lock lock(SKIM3_globalclassdatamutex);
-//	SKIM3_totalpermbans++;
-//      }
+      {
+	boost::mutex::scoped_lock lock(SKIM3_globalclassdatamutex);
+	SKIM3_totalpermbans++;
+      }
       continue;
     }
 
@@ -2498,11 +2391,7 @@ void Skim<TVHASH_T>::checkForPotentialHits(const int8 direction, const uint32 ac
 
 //    if(actreadid==0 || rid2==0) dodebug=true;
 //#define CEBUG(bla)   {if(dodebug) cout << bla; cout.flush();}
-
-
-    if(sI != readhashmatches.end()){
-      CEBUG("hhh " << SKIM3_readpool->getRead(actreadid).getName() << " " << SKIM3_readpool->getRead(sI->rid2).getName() << endl);
-    }
+    
 
     vector<readhashmatch_t>::const_iterator sIS=sI;
     for(;sI != readhashmatches.end() && sI->rid2 == countid; sI++){
@@ -2512,14 +2401,11 @@ void Skim<TVHASH_T>::checkForPotentialHits(const int8 direction, const uint32 ac
       //  entries may not differ by too much (10 bases here)
       // IF they do, then this is treated like a different hit
       //  by breaking the loop
-
-      // TODO: 100 only as tes tfor PacBio CLR
-      if(abs(sI->eoffset - oldeoffset) > 100){
+      if(abs(sI->eoffset - oldeoffset) > 10){
 	CEBUG("BREAKER!\n");
 	break;
       }
-      ++numhashes;
-      CEBUG("numhashes: " << numhashes << '\n');
+      numhashes++;
 
       if(oldhashpos + SKIM3_hashsavestepping != sI->hashpos1){
 	CEBUG("NOT CONTIGUOUS!\n");
@@ -2589,6 +2475,28 @@ void Skim<TVHASH_T>::checkForPotentialHits(const int8 direction, const uint32 ac
       oldhashpos=sI->hashpos1;
     }
 
+    // disregard this potential match if
+    //  1) both reads are rails
+    if((actreadisrail && SKIM3_readpool->getRead(rid2).isRail())){
+      if(sI!=readhashmatches.end()) countid=sI->rid2;
+      continue;
+    }
+    //  2) we scan only against rails and both reads are non-rails
+    if((SKIM3_onlyagainstrails
+	&& (!actreadisrail && !SKIM3_readpool->getRead(rid2).isRail()))){
+      if(sI!=readhashmatches.end()) countid=sI->rid2;
+      continue;
+    }
+    //  3) this read pair has been banned previously
+    if((*SKIM3_bannedoverlaps).checkIfBanned(actreadid,rid2)){
+      if(sI!=readhashmatches.end()) countid=sI->rid2;
+      {
+	boost::mutex::scoped_lock lock(SKIM3_globalclassdatamutex);
+	SKIM3_totalpermbans++;
+      }
+      continue;
+    }
+
     int32 maxoverlap;
 
     // adjust min positions for the hash length
@@ -2596,7 +2504,7 @@ void Skim<TVHASH_T>::checkForPotentialHits(const int8 direction, const uint32 ac
     hp2min-=(SKIM3_basesperhash-1);
 
     int32 eoffsetmean=eoffsetmin+(eoffsetmax-eoffsetmin)/2;
-
+    
     // calc max overlap
     // currently only for one offset
     if(eoffsetmean<0){
@@ -2627,116 +2535,97 @@ void Skim<TVHASH_T>::checkForPotentialHits(const int8 direction, const uint32 ac
     bool majorrecalc=false;
 
     if(maxnumhashes>0){
-
-      if(SKIM3_readpool->getRead(actreadid).isSequencingType(ReadGroupLib::SEQTYPE_PACBIOLQ)
-	 || SKIM3_readpool->getRead(rid2).isSequencingType(ReadGroupLib::SEQTYPE_PACBIOLQ)){
-	majorrecalc=true;
-	// TODO: PacBio perhaps in recalc below, take also left & right of max
-	//  (or monotonic down?) as numhashes
-	// via flag?
-      }else if(perc>=minpercentrequired
+      if(perc>=minpercentrequired
 	 && numhashes>1){
 	if((perc == 100 && maxeoffsetjump>=3)
 	   || numhashes>maxnumhashes
 	   // NO!!! this would be bad for microrepeats || weighteoffsetjumps>=3
 	  ) {
+	  CEBUG("part1\n");
 	  majorrecalc=true;
-	}
-      }
-      if(majorrecalc){
-	CEBUG("part1\n");
-	// find eoffset with most hashes (this is our new eoffset mean)
-	//  and numhashes will now only concern that offset (disregarding frameshifts,
-	//  but that cannot be helped)
-	smallhist4repeats.clear();
-	smallhist4repeats.resize(eoffsetmax-eoffsetmin+1,0);
-	vector<readhashmatch_t>::const_iterator rI=sIS;
-	numhashes=0;
-	for(;rI != sI; ++rI){
-	  //cout << *rI;
-	  //if(abs(rI->eoffset-eoffsetmin)>=smallhist4repeats.size()){
-	  //  cout << "Eh, what?\n";
-	  //  exit(0);
-	  //}
-	  ++smallhist4repeats[rI->eoffset-eoffsetmin];
-	  if(smallhist4repeats[rI->eoffset-eoffsetmin] > numhashes){
-	    numhashes=smallhist4repeats[rI->eoffset-eoffsetmin];
+	  // find eoffset with most hashes (this is our new eoffset mean)
+	  //  and numhashes will now only concern that offset (disregarding frameshifts,
+	  //  but that cannot be helped)
+	  smallhist4repeats.clear();
+	  smallhist4repeats.resize(eoffsetmax-eoffsetmin+1,0);
+	  vector<readhashmatch_t>::const_iterator rI=sIS;
+	  numhashes=0;
+	  for(;rI != sI; ++rI){
+	    //cout << *rI;
+	    //if(abs(rI->eoffset-eoffsetmin)>=smallhist4repeats.size()){
+	    //  cout << "Eh, what?\n";
+	    //  exit(0);
+	    //}
+	    ++smallhist4repeats[rI->eoffset-eoffsetmin];
+	    if(smallhist4repeats[rI->eoffset-eoffsetmin] > numhashes){
+	      numhashes=smallhist4repeats[rI->eoffset-eoffsetmin];
+	    }
 	  }
-	}
 
 //	cout << "hist\n";
 //	for(uint32 ii=0; ii<smallhist4repeats.size(); ++ii){
 //	  cout << ii << "\t" << smallhist4repeats[ii] << endl;
 //	}
-
-	int32 newmini=0;
-	for(; newmini<smallhist4repeats.size(); ++newmini){
-	  if(smallhist4repeats[newmini] == numhashes){
-	    break;
+	
+	  int32 newmini=0;
+	  for(; newmini<smallhist4repeats.size(); ++newmini){
+	    if(smallhist4repeats[newmini] == numhashes){
+	      break;
+	    }
 	  }
-	}
-	int32 newmaxi=newmini;
-	for(; newmaxi<smallhist4repeats.size(); ++newmaxi){
-	  if(smallhist4repeats[newmaxi] != numhashes){
-	    break;
+	  int32 newmaxi=newmini;
+	  for(; newmaxi<smallhist4repeats.size(); ++newmaxi){
+	    if(smallhist4repeats[newmaxi] != numhashes){
+	      break;
+	    }
 	  }
-	}
-	--newmaxi;
-	//cout << "mini: " << newmini << "\tmaxi: " << newmaxi << endl;
-	newmini+=eoffsetmin;
-	newmaxi+=eoffsetmin;
-	//cout << "mini: " << newmini << "\tmaxi: " << newmaxi << endl;
-	eoffsetmean=(newmaxi+newmini)/2;
-
-	// recalc hp1min/max
-	hp1min=0xffff;
-	hp1max=0;
-
-	for(rI=sIS;rI != sI; ++rI){
-	  if(rI->eoffset == eoffsetmean){
-	    hp1min=min(hp1min,rI->hashpos1);
-	    hp1max=max(hp1max,rI->hashpos1);
+	  --newmaxi;
+	  //cout << "mini: " << newmini << "\tmaxi: " << newmaxi << endl;
+	  newmini+=eoffsetmin;
+	  newmaxi+=eoffsetmin;
+	  //cout << "mini: " << newmini << "\tmaxi: " << newmaxi << endl;
+	  eoffsetmean=(newmaxi+newmini)/2;
+	  
+	  // recalc hp1min/max
+	  hp1min=0xffff;
+	  hp1max=0;
+	  
+	  for(rI=sIS;rI != sI; ++rI){
+	    if(rI->eoffset == eoffsetmean){
+	      hp1min=min(hp1min,rI->hashpos1);
+	      hp1max=max(hp1max,rI->hashpos1);
+	    }
+	  }
+	  // adjust min positions for the hash length
+	  hp1min-=(SKIM3_basesperhash-1);
+	  
+	  hashesoverlap=hp1max-hp1min+1;
+	  perc=100*hashesoverlap/maxoverlap;
+	  
+	  if(perc==100){
+	    eoffsetmin=eoffsetmean;
+	    eoffsetmax=eoffsetmean;
 	  }
-	}
-	// adjust min positions for the hash length
-	hp1min-=(SKIM3_basesperhash-1);
-
-	hashesoverlap=hp1max-hp1min+1;
-	perc=100*hashesoverlap/maxoverlap;
-
-	if(perc==100){
-	  eoffsetmin=eoffsetmean;
-	  eoffsetmax=eoffsetmean;
-	}
-
-	//cout << static_cast<int16>(direction) << "\tari: " << actreadid << "\trid2: " << rid2 << "\tnumh: " << numhashes << "\teom: " << eoffsetmean
-	//     << "\tho: " << hashesoverlap << "\tper: " << perc
-	//     << endl;
-
-	// saver:
-	// we might have been too harsh, very probably so in mapping asemblies for the following case:
-	//
-	//  C     ..............................
-	//  R          ........*.....
-	//
-	// where only ~half of the hashes in R are counted. In that case, set percent to the
-	//  minimum needed to not be thrown out.
-	if(perc<minpercentrequired){
-	  disregardperc=true;
-	}
 
-	CEBUG("recalc\n" << static_cast<int16>(direction) << "\tperc: " << perc << "\tari: " << actreadid << "\trid2: " << rid2 << "\tnumh: " << numhashes << "\tmnh: " << maxnumhashes << "\teom: " << eoffsetmean << "\teomin: " << eoffsetmin << "\teomax: " << eoffsetmax << endl);
-      }
+	  //cout << static_cast<int16>(direction) << "\tari: " << actreadid << "\trid2: " << rid2 << "\tnumh: " << numhashes << "\teom: " << eoffsetmean 
+	  //     << "\tho: " << hashesoverlap << "\tper: " << perc
+	  //     << endl;
+	  
+	  // saver:
+	  // we might have been too harsh, very probably so in mapping asemblies for the following case:
+	  //
+	  //  C     ..............................
+	  //  R          ........*.....
+	  //
+	  // where only ~half of the hashes in R are counted. In that case, set percent to the
+	  //  minimum needed to not be thrown out.
+	  if(perc<minpercentrequired){
+	    disregardperc=true;
+	  }
 
-      if(SKIM3_readpool->getRead(actreadid).isSequencingType(ReadGroupLib::SEQTYPE_PACBIOLQ)
-	 && SKIM3_readpool->getRead(rid2).isSequencingType(ReadGroupLib::SEQTYPE_PACBIOLQ)){
-	// TODO: PacBio make 20 configurable
-	// PB / PB hits need at least 20 hashes
-	if(numhashes<20){
-	  numhashes=0;
-	  maxnumhashes=0;
-	  perc=0;
-	  disregardperc=false;
+	  CEBUG("recalc\n" << static_cast<int16>(direction) << "\tperc: " << perc << "\tari: " << actreadid << "\trid2: " << rid2 << "\tnumh: " << numhashes << "\tmnh: " << maxnumhashes << "\teom: " << eoffsetmean << "\teomin: " << eoffsetmin << "\teomax: " << eoffsetmax << endl);
+	  
+	  
 	}
       }
 
@@ -2806,7 +2695,7 @@ void Skim<TVHASH_T>::checkForPotentialHits(const int8 direction, const uint32 ac
 #ifdef CEBUG_extra_cFPH
       {
 	boost::mutex::scoped_lock lock(SKIM3_coutmutex);
-	CEBUG("eomin: " << eoffsetmin << "\teomax: " << eoffsetmax
+	CEBUG("eomin: " << eoffsetmin << "\teomax: " << eoffsetmax 
 	      << "\tmor: " << minoverlaprequired
 	      << "\tho: " << hashesoverlap
 	      << "\t%: " << perc
@@ -2814,23 +2703,12 @@ void Skim<TVHASH_T>::checkForPotentialHits(const int8 direction, const uint32 ac
       }
 #endif
 
-      CEBUG("disr%: "  << disregardperc << '\n');
-      CEBUG("ho: " << hashesoverlap << "\tmo required: " << minoverlaprequired << endl);
-
-      if(perc>100) perc=100;
-
       // we take the hit if the overlap percentage is above threshold
       // NEW: or if both reads have MNRr tags
-      // NEW: or we have a perfect overlap >= 17
-      //   || (perc==100 && hashesoverlap>=17))
-      // BaCh: 06.02.2015; nope, not "or >= 17" as this does not reflect the wish of the user!
-      //       and it needlessly inflates the skim table for highly repetitive data sets
       if(hashesoverlap >= minoverlaprequired
 	 && (perc>=minpercentrequired
 	     || disregardperc
 	     || (SKIM3_hasMNRr[actreadid] && SKIM3_hasMNRr[rid2]))) {
-
-	CEBUG("accepted\n");
 	acceptedhits++;
 
 	// increase overlapcounter only for "real" reads,
@@ -2847,7 +2725,8 @@ void Skim<TVHASH_T>::checkForPotentialHits(const int8 direction, const uint32 ac
 	matchwithsorter_t tmp;
 	tmp.otherid=rid2;
 	tmp.eoffset=eoffsetmean;
-
+      
+	if(perc>100) perc=100;
 	tmp.percent_in_overlap=perc;
 	tmp.numhashes=numhashes;
 	tmp.estimscore=0;
@@ -2863,25 +2742,13 @@ void Skim<TVHASH_T>::checkForPotentialHits(const int8 direction, const uint32 ac
 	if(maxcontiguousfreq32counter){
 	  tmp.ol_belowavgfreq=(SKIM3_basesperhash+(maxcontiguousfreq32counter-1)*SKIM3_hashsavestepping) >= 26;
 	}
+	tmp.ol_weakgood=false;
 	if(maxcontiguousfreq3counter){
 	  tmp.ol_weakgood=(SKIM3_basesperhash+(maxcontiguousfreq3counter-1)*SKIM3_hashsavestepping) >= 20;
-	  tmp.ol_stronggood=(SKIM3_basesperhash+(maxcontiguousfreq3counter-1)*SKIM3_hashsavestepping) >= SKIM3_basesperhash*2-1;
-	}else{
-	  tmp.ol_weakgood=false;
-	  tmp.ol_stronggood=false;
-	}
-
-	// small hack for "very good reads" (atm Illumina / Moleculo or other "corrected" reads)
-	if(perc==100 && SKIM3_basesperhash>60 && flag_norept){
-	  if(SKIM3_basesperhash>90){
-	    tmp.ol_stronggood=true;
-	  }else{
-	    tmp.ol_weakgood=true;
-	  }
 	}
 
 
-	//tmp.ol_stronggood=tmp.ol_weakgood & (maxcontiguousfreq3counter-1 >= SKIM3_basesperhash*2/SKIM3_hashsavestepping);
+	tmp.ol_stronggood=tmp.ol_weakgood & (totalfreq3counter > (SKIM3_basesperhash*2/SKIM3_hashsavestepping-1));
 
 	/* still too harsh sometimes
 
@@ -2890,10 +2757,10 @@ void Skim<TVHASH_T>::checkForPotentialHits(const int8 direction, const uint32 ac
 	//  overlaps of >= 30
 	if(!tmp.ol_stronggood){
 	  bool acceptshort=false;
-	  if(SKIM3_readpool->getRead(actreadid).getSequencingType() == ReadGroupLib::SEQTYPE_SOLEXA
+	  if(SKIM3_readpool->getRead(actreadid).getSequencingType() == Read::SEQTYPE_SOLEXA
 	     && SKIM3_readpool->getRead(actreadid).getLenClippedSeq() < 64) {
 	    acceptshort=true;
-	  }else if(SKIM3_readpool->getRead(rid2).getSequencingType() == ReadGroupLib::SEQTYPE_SOLEXA
+	  }else if(SKIM3_readpool->getRead(rid2).getSequencingType() == Read::SEQTYPE_SOLEXA
 		   && SKIM3_readpool->getRead(rid2).getLenClippedSeq() < 64) {
 	    acceptshort=true;
 	  }
@@ -2904,51 +2771,62 @@ void Skim<TVHASH_T>::checkForPotentialHits(const int8 direction, const uint32 ac
 	}
 	*/
 
-	/* Nope, too lenient
 	// all contiguous HAF33 overlaps >= 30 are stronggood
 	if(!tmp.ol_stronggood){
 	  tmp.ol_stronggood=(SKIM3_basesperhash+(maxcontiguousfreq3counter-1)*SKIM3_hashsavestepping) >= 30;
 	}
-	*/
 
-	// 3) save only if there's a strong overlap or if both reads are not enough-is-enough together
-	if(tmp.ol_stronggood || !(actreadhasenough && SKIM3_nomorehitseie[rid2]!=0)){
-
-	  tmp.ol_norept=flag_norept;
-	  tmp.ol_rept=(totalfreq5counter > 0);
-
-	  // calc of these two would not be 100% accurate here, moved to updateCriterionLevels()
-	  tmp.ol_fulllength=false;
-	  tmp.ol_fullencased=false;
-
-	  tmpmatchwith.push_back(tmp);
-
-	  if(tmp.ol_rept) {CEBUG("\nREPT!!!\n")};
-	  CEBUG("Pushing possible hit with offset: " << tmp.eoffset << endl
-		<< rid2
-		<< "\t" << actreadid
-		<< "\t" << SKIM3_readpool->getRead(rid2).getLenClippedSeq()
-		<< "\t" << hp1min
-		<< "\t" << hp1max
-		<< "\t" << eoffsetmin
-		<< "\t" << eoffsetmax
-		<< "\t" << maxoverlap
-		<< "\t" << hashesoverlap
-		<< "\t" << numhashes
-		<< "\t" << minoverlaprequired
-		<< "\t" << perc << '%'
-		<< "\t" << maxcontiguousfreq3counter
-		<< "\t" << maxcontiguousfreq32counter
-		<< "\t" << totalfreq3counter
-		<< "\t" << totalfreq5counter
-		<< "\n" << tmp.ol_stronggood << ' ' << tmp.ol_weakgood << ' ' << tmp.ol_belowavgfreq << ' ' << tmp.ol_norept << ' ' << tmp.ol_rept
-		<< '\n');
+
+
+	tmp.ol_norept=flag_norept;
+	tmp.ol_rept=(totalfreq5counter > 0);
+
+	tmp.ol_fulllength=false;
+	tmp.ol_fullencased=false;
+
+	// not 100% accurate, moved to updateCriterionLevels()
+	//
+	//if(hashesoverlap>=SKIM3_readpool->getRead(actreadid).getLenClippedSeq()-SKIM3_hashsavestepping
+	//	 || hashesoverlap>=SKIM3_readpool->getRead(rid2).getLenClippedSeq()-SKIM3_hashsavestepping){
+	//	tmp.ol_fulllength=true;
+	//
+	//	if(perc == 100 
+	//	   && tmp.ol_norept){
+	//	  int32 lendiff=abs(static_cast<int32>(SKIM3_readpool->getRead(actreadid).getLenClippedSeq())
+	//			    -static_cast<int32>(SKIM3_readpool->getRead(tmp.otherid).getLenClippedSeq()));
+	//	  if(lendiff>=8){
+	//	    tmp.ol_fullencased=true;
+	//	  }
+	//	}
+	//}
+
+	tmpmatchwith.push_back(tmp);
+
+	if(tmp.ol_rept) {CEBUG("\nREPT!!!\n")};
+	CEBUG("Pushing possible hit with offset: " << tmp.eoffset << endl
+	      << rid2
+	      << "\t" << actreadid
+	      << "\t" << SKIM3_readpool->getRead(rid2).getLenClippedSeq()
+	      << "\t" << hp1min
+	      << "\t" << hp1max
+	      << "\t" << eoffsetmin
+	      << "\t" << eoffsetmax
+	      << "\t" << maxoverlap
+	      << "\t" << hashesoverlap
+	      << "\t" << numhashes
+	      << "\t" << minoverlaprequired
+	      << "\t" << perc << '%'
+	      << "\t" << maxcontiguousfreq3counter
+	      << "\t" << maxcontiguousfreq32counter
+	      << "\t" << totalfreq3counter
+	      << "\t" << totalfreq5counter
+	      << "\n" << tmp.ol_stronggood << ' ' << tmp.ol_weakgood << ' ' << tmp.ol_belowavgfreq << ' ' << tmp.ol_norept << ' ' << tmp.ol_rept
+	      << '\n');
 //#define CEBUG(bla)
 
-	  if(SKIM3_chimerahunt.size()){
-	    chimeraHuntStoreOverlapCoverage(direction, actreadid, rid2,
-					    hp1min,hp1max,hp2min,hp2max);
-	  }
+	if(SKIM3_chimerahunt.size()){
+	  chimeraHuntStoreOverlapCoverage(direction, actreadid, rid2,
+					  hp1min,hp1max,hp2min,hp2max);
 	}
       }
     }
@@ -2960,12 +2838,12 @@ void Skim<TVHASH_T>::checkForPotentialHits(const int8 direction, const uint32 ac
     CEBUG("Numhits " << actreadid << "\t" << possiblehits << "\t" << acceptedhits << "\n\n");
   }
 
-//  boost::mutex::scoped_lock lock(SKIM3_globalclassdatamutex);
-//  SKIM3_possiblehits+=possiblehits;
-//  SKIM3_acceptedhits+=acceptedhits;
+  boost::mutex::scoped_lock lock(SKIM3_globalclassdatamutex);
+  SKIM3_possiblehits+=possiblehits;
+  SKIM3_acceptedhits+=acceptedhits;
 }
-//#define CEBUG(bla)
-//#undef CEBUG_extra_cFPH
+#define CEBUG(bla)
+#undef CEBUG_extra_cFPH
 
 
 /*************************************************************************
@@ -2977,8 +2855,7 @@ void Skim<TVHASH_T>::checkForPotentialHits(const int8 direction, const uint32 ac
 
 //#define CEBUG(bla)   {cout << bla; cout.flush();}
 
-template<typename TVHASH_T>
-void Skim<TVHASH_T>::chimeraHuntStoreOverlapCoverage(const int8 direction, const uint32 actreadid, const uint32 rid2, uint16 hp1min, uint16 hp1max, uint16 hp2min, uint16 hp2max)
+void Skim::chimeraHuntStoreOverlapCoverage(const int8 direction, const uint32 actreadid, const uint32 rid2, uint16 hp1min, uint16 hp1max, uint16 hp2min, uint16 hp2max)
 {
   bool cebug=false;
   //if(actreadid==0 || rid2==0) cebug=true;
@@ -2986,7 +2863,7 @@ void Skim<TVHASH_T>::chimeraHuntStoreOverlapCoverage(const int8 direction, const
 //#define CEBUG(bla)   {if(cebug) cout << bla; cout.flush();}
 
   CEBUG("checkForChimeras: " << SKIM3_readpool->getRead(actreadid).getName()
-	<< " (" << actreadid << ':' << static_cast<int16>(direction) << ") / "
+	<< " (" << actreadid << ':' << static_cast<int16>(direction) << ") / " 
 	<< SKIM3_readpool->getRead(rid2).getName()
 	<< " (" << rid2 << ":1)\n");
   CEBUG("hp1min: " << hp1min << '\n');
@@ -3092,8 +2969,7 @@ void Skim<TVHASH_T>::chimeraHuntStoreOverlapCoverage(const int8 direction, const
 
 //#define CEBUG(bla)   {if(actreadid==0) cout << bla; cout.flush();}
 
-template<typename TVHASH_T>
-void Skim<TVHASH_T>::chimeraHuntLocateChimeras()
+void Skim::chimeraHuntLocateChimeras()
 {
   for(uint32 actreadid=0; actreadid<SKIM3_chimerahunt.size(); actreadid++){
     vector<uint8> & hunt = SKIM3_chimerahunt[actreadid];
@@ -3114,7 +2990,7 @@ void Skim<TVHASH_T>::chimeraHuntLocateChimeras()
     // now, to make thing easier in search, fill up leading
     // and traing 0s with 1
     // actually, if no fill up were used, this could also be used as
-    //  automatic clipping ... but the analyseHashStats() in
+    //  automatic clipping ... but the analyseHashStats() in 
     //  conjunction with the dataprocessing.C routine does it already
     //  quite well.
     //
@@ -3134,12 +3010,7 @@ void Skim<TVHASH_T>::chimeraHuntLocateChimeras()
       proposedright--;
     };
 
-    // not only look at holes in the alignments, but also make sure they correlate to
-    //  rare or unique kmers by looking at the hash statistics
-    auto & bposhashstats=SKIM3_readpool->getRead(actreadid).getBPosHashStats();
-    uint32 bphsi=SKIM3_readpool->getRead(actreadid).getLeftClipoff();
-
-    // search for holes with 0s >= 2*basesperhash-2
+    // search for holes with 0s >= 2*SKIM3_hashsavestepping
     int32 consecutivezeroes=0;
     int32 leftcut=0;
     int32 longestleftcut=0;
@@ -3147,14 +3018,14 @@ void Skim<TVHASH_T>::chimeraHuntLocateChimeras()
 
     int32 acti=0;
     bool foundcuts=false;
-    for(; acti<hunt.size(); ++acti, ++bphsi){
+    for(; acti<hunt.size(); acti++){
       if(consecutivezeroes){
-	if(hunt[acti]==0 && bposhashstats[bphsi].fwd.getFrequency()<2){
+	if(hunt[acti]==0){
 	  consecutivezeroes++;
 	}else{
-	  if(consecutivezeroes>=2*SKIM3_basesperhash-2){
+	  if(consecutivezeroes>=2*SKIM3_hashsavestepping){
 	    foundcuts=true;
-	    CEBUG("Chimera candidate "
+	    CEBUG("Chimera candidate " 
 		  << SKIM3_readpool->getRead(actreadid).getName()
 		  << '\n');
 	    CEBUG("consecutivezeroes: " << consecutivezeroes << '\n');
@@ -3167,7 +3038,7 @@ void Skim<TVHASH_T>::chimeraHuntLocateChimeras()
 	  }
 	}
       }else{
-	if(hunt[acti]==0 && bposhashstats[bphsi].fwd.getFrequency()<2){
+	if(hunt[acti]==0){
 	  consecutivezeroes++;
 	}else{
 	  if(acti-leftcut>longestrightcut-longestleftcut){
@@ -3200,44 +3071,43 @@ void Skim<TVHASH_T>::chimeraHuntLocateChimeras()
 
 //#define CEBUG(bla)   {cout << bla; cout.flush();}
 
-template<typename TVHASH_T>
-void Skim<TVHASH_T>::fillTagMaskVector(const uint32 readid, vector<uint8> & tagmaskvector)
+void Skim::fillTagMaskVector(const uint32 readid, vector<uint8> & tagmaskvector)
 {
   tagmaskvector.clear();
   tagmaskvector.resize(SKIM3_readpool->getRead(readid).getLenClippedSeq(),0);
 
 
   if(SKIM3_hasMNRr[readid]
-     || SKIM3_hasFpas[readid]){
+     || SKIM3_hasFpAS[readid]){
 
     for(uint32 tn=0; tn<SKIM3_readpool->getRead(readid).getNumOfTags(); tn++){
       if(SKIM3_readpool->getRead(readid).getTag(tn).identifier==Read::REA_tagentry_idMNRr
-	 || SKIM3_readpool->getRead(readid).getTag(tn).identifier==Read::REA_tagentry_idSOFApolyA_sequence){
+	 || SKIM3_readpool->getRead(readid).getTag(tn).identifier==Read::REA_tagentry_idFpAS){
 	CEBUG("MAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASK!\n");
-
+	
 	int32 from=SKIM3_readpool->getRead(readid).getTag(tn).from;
 	from-=SKIM3_readpool->getRead(readid).getLeftClipoff();
 	int32 to=SKIM3_readpool->getRead(readid).getTag(tn).to;
 	to-=SKIM3_readpool->getRead(readid).getLeftClipoff();
-
+	
 	/* the masking routines will mask only if *ALL* positions
 	   in a hash are masked. This allows for cases like this
 	   (shown here: dot == masked)
-
+	   
 	   ............A...............
-
+	   
 	   to still make hashes that have the "A" in them
-
-	   But for Fpas (poly A), we want stop dead at the beginning
+	   
+	   But for FpAS (poly A), we want stop dead at the beginning
 	   of the poly A. Therefore, we need to expand the masked
 	   area by (number of bases in a hash)-1
 	*/
-	if(SKIM3_readpool->getRead(readid).getTag(tn).identifier==Read::REA_tagentry_idSOFApolyA_sequence){
+	if(SKIM3_readpool->getRead(readid).getTag(tn).identifier==Read::REA_tagentry_idFpAS){
 	  from-=(SKIM3_basesperhash-1);
 	  to+=(SKIM3_basesperhash-1);
 	}
-
-
+	
+	
 	CEBUG("ftmv: " << from << " " << to << '\n');
 	for(int32 i=from; i<=to; i++){
 	  if(i>=0 && i<static_cast<int32>(tagmaskvector.size())) {
@@ -3256,8 +3126,7 @@ void Skim<TVHASH_T>::fillTagMaskVector(const uint32 readid, vector<uint8> & tagm
 }
 
 
-template<typename TVHASH_T>
-void Skim<TVHASH_T>::reverseTagMaskVector(vector<uint8> & tagmaskvector)
+void Skim::reverseTagMaskVector(vector<uint8> & tagmaskvector)
 {
   if(tagmaskvector.size()){
     vector<uint8>::iterator f=tagmaskvector.begin();
@@ -3280,149 +3149,1433 @@ void Skim<TVHASH_T>::reverseTagMaskVector(vector<uint8> & tagmaskvector)
 
 
 
+
+#include "boost/format.hpp"
+using boost::format;
+
+
 /*************************************************************************
  *
- * Around each RMB base, set the base statitsics to "repeat"
- * More a test.
+ *
  *
  *
  *************************************************************************/
 
 //#define CEBUG(bla)   {cout << bla; cout.flush();}
-
-template<typename TVHASH_T>
-void Skim<TVHASH_T>::correctReadBaseStatisticsByRMB(ReadPool & rp, const uint32 basesperhash)
+void Skim::provideHashStatistics(const string & directory, ReadPool & rp, bool checkusedinassembly, bool onlyagainstrails, bool alsosavesinglehashes, bool fwdandrev, uint32 fwdrevmin,uint8  basesperhash, uint8  hashsavestepping)
 {
-  ProgressIndicator<int32> P(0, rp.size());
-
-  for(uint32 actreadid=0; actreadid<rp.size(); actreadid++){
-    P.progress(actreadid);
+  string hashstatfilename;
+
+  SKIM3_hs_basesperhash=basesperhash;
+  size_t avghashcov=prepareHashStatistics(directory, rp, checkusedinassembly, onlyagainstrails, alsosavesinglehashes,
+					  fwdandrev, fwdrevmin, basesperhash, hashsavestepping, 
+					  hashstatfilename,
+					  SKIM3_hs_hashstats,
+					  SKIM3_hs_hsshortcuts_begin,
+					  SKIM3_hs_hsshortcuts_end);
+}
 
-    Read & actread= rp.getRead(actreadid);
-    if(!actread.hasValidData()
-       || !actread.isUsedInAssembly()
-       || !actread.hasBaseHashStats()) continue;
 
-    if(actread.hasTag(Read::REA_tagentry_idSRMr)
-       || actread.hasTag(Read::REA_tagentry_idCRMr)){
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
 
-      CEBUG("Read " << actread.getName() << endl);
-      for(uint32 tagnr=0; tagnr<actread.getNumOfTags(); tagnr++){
-	const multitag_t & acttag=actread.getTag(tagnr);
-	if(acttag.identifier==Read::REA_tagentry_idSRMr
-	   || acttag.identifier==Read::REA_tagentry_idCRMr){
+void Skim::analyseHashes(const string & directory, ReadPool & rp, bool checkusedinassembly, bool onlyagainstrails, bool alsosavesinglehashes, bool fwdandrev, uint32 fwdrevmin, uint8  basesperhash, uint8  hashsavestepping, bool masknastyrepeats)
+{
+  string hashstatfilename;
+  vector<hashstat_t> hashstats;
+  vector<vector<hashstat_t>::const_iterator > hsshortcuts_begin;
+  vector<vector<hashstat_t>::const_iterator > hsshortcuts_end;
 
-	  CEBUG("Tag " << acttag << endl);
-	  vector<Read::bposhashstat_t> & bposhashstats=const_cast<vector<Read::bposhashstat_t> &>(actread.getBPosHashStats());
-	  if(!bposhashstats.empty()){
-	    Read::setCoutType(Read::AS_TEXT);
-	    CEBUG("Before\n" << actread);
+  size_t avghashcov=prepareHashStatistics(directory, rp, checkusedinassembly, onlyagainstrails, alsosavesinglehashes,
+					  fwdandrev, fwdrevmin, basesperhash, hashsavestepping,
+					  hashstatfilename,
+					  hashstats,
+					  hsshortcuts_begin,
+					  hsshortcuts_end);
 
-	    uint32 bposfrom=acttag.from;
-	    uint32 bposto=acttag.to;
-	    if(bposto<bposfrom) swap(bposfrom,bposto);
-	    if(bposfrom>=basesperhash-1){
-	      bposfrom-=basesperhash-1;
-	    }else{
-	      bposfrom=0;
-	    }
+  CEBUG("Avg. " << avghashcov << endl);
 
-	    CEBUG("bposfrom: " << bposfrom << "\tbposto: " << bposto << endl);
-	    for(; bposfrom<=bposto; bposfrom++){
-	      if(bposhashstats[bposfrom].fwd.isValid()
-		 && bposhashstats[bposfrom].fwd.getFrequency()<5){
-		bposhashstats[bposfrom].fwd.setFrequency(5);
-	      }
-	      if(bposhashstats[bposfrom].rev.isValid()
-		 && bposhashstats[bposfrom].rev.getFrequency()<5){
-		bposhashstats[bposfrom].rev.setFrequency(5);
-	      }
-	    }
+  dumpHashStatisticsInfo(avghashcov, hashstats);
 
-	    bposfrom=acttag.from;
-	    bposto=acttag.to;
-	    if(bposto<bposfrom) swap(bposfrom,bposto);
-	    bposto+=basesperhash-1;
-	    if(bposto>=bposhashstats.size()) bposto=bposhashstats.size()-1;
+  cout << "Assigning statistics values:\n";
+  dateStamp(cout);
 
-	    CEBUG("bposfrom: " << bposfrom << "\tbposto: " << bposto << endl);
-	    for(; bposfrom<=bposto; bposfrom++){
-	      if(bposhashstats[bposfrom].rev.isValid()
-		 && bposhashstats[bposfrom].rev.getFrequency()<5){
-		bposhashstats[bposfrom].rev.setFrequency(5);
-	      }
-	    }
+  assignReadBaseStatistics(rp,
+			   avghashcov,
+  			   hashstats, 
+  			   basesperhash,
+  			   hsshortcuts_begin,
+  			   hsshortcuts_end,
+			   masknastyrepeats);
 
-	    CEBUG("After\n" << actread);
+  //cout << "Correcting by RMB:\n";
+  //correctReadBaseStatisticsByRMB(rp,basesperhash);
 
-	  }
-	}
-      }
-    }
+  dateStamp(cout);
 
-  }
-  P.finishAtOnce();
-  cout << '\n';
+  return;
 }
 //#define CEBUG(bla)
 
 
 
-
-
-
 /*************************************************************************
  *
+ * all steps until a usable hash statistics file is in memory
+ * Note: does not delete the hash statistics file on disk (only the
+ *  temporary files)
  *
+ * Returns explicitly:
+ *   average hash coverage
+ *
+ * Returns implicitly:
+ *   hashstatfilename
+ *   hashstats
+ *   hsshortcuts_begin & hsshortcuts_end
  *
  *************************************************************************/
 
 //#define CEBUG(bla)   {cout << bla; cout.flush();}
-
-template<typename TVHASH_T>
-void Skim<TVHASH_T>::skimStreamPrepare(ReadPool & rp, uint32 basesperhash, uint8 hss, const char * additionalregexp)
+size_t Skim::prepareHashStatistics(const string & directory, ReadPool & rp, bool checkusedinassembly, bool onlyagainstrails, bool alsosavesinglehashes, bool fwdandrev, uint32 fwdrevmin, uint8  basesperhash, uint8  hashsavestepping, string & hashstatfilename, vector<hashstat_t> & hashstats,  vector<vector<hashstat_t>::const_iterator> & hsshortcuts_begin,  vector<vector<hashstat_t>::const_iterator> & hsshortcuts_end)
 {
-  FUNCSTART("void Skim<TVHASH_T>::skimStreamPrepare(ReadPool & rp, uint32 basesperhash, uint8 hss, const char * additionalregexp)");
+  SKIM3_readpool=&rp;
 
-  init();
+  vector<string> hashfilenames;
+  vector<size_t> elementsperfile;
 
-  SKIM3_readpool=&rp;
+  hashstats.clear();
+  hsshortcuts_begin.clear();
+  hsshortcuts_end.clear();
 
-  if(basesperhash>sizeof(TVHASH_T)*4){
-    basesperhash=sizeof(TVHASH_T)*4;
-  }
-  SKIM3_basesperhash=basesperhash;
-  SKIM3_hashsavestepping=hss;
 
-  fillTagStatusInfoOfReads();
+  dateStamp(cout);
 
-  prepareSkim(0, rp.size(), SKIM3_vhraparray,false);
+  cout << "Writing temporary hstat files:\n";
+  hashes2disk(hashfilenames,elementsperfile,
+	      rp,checkusedinassembly,onlyagainstrails,fwdandrev,
+	      basesperhash,hashsavestepping,directory);
 
-  FUNCEND();
-  return;
-}
-//#define CEBUG(bla)
+  dateStamp(cout);
+
+  cout << "\nAnalysing hstat files:\n";
+  size_t numhashstats=
+    createHashStatisticsFile(hashstatfilename,
+			     hashfilenames,
+			     elementsperfile,
+			     basesperhash,
+			     fwdrevmin,
+			     rp,
+			     onlyagainstrails,
+			     alsosavesinglehashes,
+			     directory);
+
+  cout << "\n";
+
+  dateStamp(cout);
+
+  cout << "clean up temporary stat files..."; cout.flush();
+  // clean up temporary stat files
+  for(uint32 hfni=0; hfni<hashfilenames.size();hfni++){
+    string system_rmdir = static_cast<string>("rm -rf ")+hashfilenames[hfni];
+    // tmp ... dear compiler: don't complain about unused variable
+    int tmp=system(system_rmdir.c_str()); 
+    (void) tmp;    
+  }
+
+  dateStamp(cout); cout.flush();
 
+  hashstats.resize(numhashstats);
+  size_t avghashcov=loadHashStatisticsFile(hashstatfilename,
+					   hashstats);
 
+  makeHashStatArrayShortcuts(hashstats,basesperhash, 
+			     hsshortcuts_begin, hsshortcuts_end);
 
+  dateStamp(cout);
+
+  return avghashcov;
+}
+//#define CEBUG(bla)
 
 
 
 /*************************************************************************
  *
- * seqtype -1 == all sequencing types, else only the given
+ *
+ *
  *
  *************************************************************************/
 
-//#define CEBUG(bla)   {cout << bla; cout.flush();}
-
-template<typename TVHASH_T>
-void Skim<TVHASH_T>::findAdaptorRightClip(ReadPool & searchpool, vector<int32> & results, int8 seqtype, uint32 minhashes, uint32 numthreads)
+void Skim::showHashStatisticsInfo(string & hashstatfilename)
 {
-  FUNCSTART("void Skim<TVHASH_T>::checkForAdaptor(Read & actread, cfh_threaddata_t & cfhd)");
+  FUNCSTART("void Skim::showHashStatisticsInfo(string & hashstatfilename)");
 
-  results.clear();
-  results.resize(searchpool.size(),-1);
+  ifstream finfin;
+  finfin.open(hashstatfilename.c_str(), ios::in|ios::ate);
+  if(!finfin){
+    MIRANOTIFY(Notify::FATAL, "File not found: " << hashstatfilename);
+  }
+  size_t finfinsize=finfin.tellg();
+  finfin.close();
+
+  if(finfinsize%sizeof(hashstat_t)){
+    MIRANOTIFY(Notify::FATAL, "File probably not a hash stat: " << hashstatfilename);
+  }
+
+  size_t numhashstats=finfinsize/sizeof(hashstat_t);
+  
+
+  vector<hashstat_t> hashstats(numhashstats);
+  size_t avghashcov=loadHashStatisticsFile(hashstatfilename,
+					   hashstats);
+
+  CEBUG("Avg. " << avghashcov << endl);
+
+  dumpHashStatisticsInfo(avghashcov, hashstats);
+
+  FUNCEND();
+}
+
+
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+
+//#define CEBUG(bla)   {cout << bla; cout.flush();}
+
+void Skim::hashes2disk(vector<string> & hashfilenames, vector<size_t> & elementsperfile, ReadPool & rp, bool checkusedinassembly, bool onlyagainstrails, bool fwdandrev, uint8  basesperhash, uint8  hashsavestepping, const string & directory)
+{
+  FUNCSTART("void Skim::hashes2disk(uint32 basesperhash)");
+
+  const size_t upperbases=2;
+
+  hashfilenames.clear();
+
+  BUGIFTHROW(basesperhash==0,"basesperhash == 0 ???");
+  BUGIFTHROW(upperbases>=basesperhash,"upperbases (" << upperbases << ") >=basesperhash " << static_cast<uint16>(basesperhash) << ") ???");
+
+  size_t numfiles=1<<(upperbases*2);
+  size_t rightshift=(basesperhash-upperbases)*2;
+
+  CEBUG("bph: " << static_cast<uint16>(basesperhash) << ".\n");
+  CEBUG("Must create " << numfiles << " files.\n");
+  CEBUG("Rightshift:" << rightshift << '\n');
+  CEBUG("sizeof(vhash_t): " << sizeof(vhash_t) << '\n');
+
+  vector<FILE *> hashfiles(numfiles);
+  vector<vector<diskhash_t> > hashfilebuffer(numfiles);
+  for(size_t i=0; i<numfiles; i++){
+    string fname=directory+"/stattmp"+str(format("%x") % i )+".bin";
+    hashfilenames.push_back(fname);
+    hashfiles[i]=fopen(fname.c_str(), "w");
+    hashfilebuffer[i].reserve(131072);
+  }
+
+  elementsperfile.clear();
+  elementsperfile.resize(numfiles,0);
+
+  vector<vhrap_t> singlereadvhraparray;
+  singlereadvhraparray.reserve(10000);
+
+  // we will not use a mask, but
+  //  we need to supply an empty one anyway
+  vector<uint8> tagmaskvector;
+
+  diskhash_t tmpdh;
+
+  ProgressIndicator<int32> P(0, rp.size());
+
+  for(uint32 actreadid=0; actreadid<rp.size(); actreadid++){
+    P.progress(actreadid);
+
+    //if(actreadid>100) return;
+
+    Read & actread= rp.getRead(actreadid);
+
+    // Has been taken out as hash statistics now also used for mirabait
+    // TODO: check whether this has big influence on "normal" assembly jobs
+    //  !!! it has ... for mapping assemblies !!! 
+
+    if(!actread.hasValidData()
+       || (checkusedinassembly && !actread.isUsedInAssembly())) continue; 
+
+    uint32 slen=actread.getLenClippedSeq();
+
+    if(slen<basesperhash) continue;
+
+    singlereadvhraparray.resize(slen);
+    tagmaskvector.resize(slen,0);
+
+    vector<vhrap_t>::iterator srvaI=singlereadvhraparray.begin();
+
+    uint32 hashesmade;
+
+    const vector<Read::bposhashstat_t> & bposhashstats=actread.getBPosHashStats();
+    int32 bfpos=actread.calcClippedPos2RawPos(0);
+    int32 bfposinc=0;
+
+    hashesmade=transformSeqToVariableHash(
+      actreadid,
+      actread,
+      actread.getClippedSeqAsChar(),
+      slen,
+      basesperhash,
+      srvaI,
+      false,
+      1,
+      tagmaskvector,
+      bposhashstats,
+      bfpos,
+      bfposinc
+      );
+    singlereadvhraparray.resize(hashesmade);
+
+    tmpdh.seqtype=actread.getSequencingType();
+
+    tmpdh.dir=1;
+
+    size_t hashfilesindex;
+    srvaI=singlereadvhraparray.begin();
+    for(uint32 i=0;i<hashesmade; i++, srvaI++){
+      tmpdh.hashpos=srvaI->hashpos-(basesperhash-1);
+      tmpdh.vhash=srvaI->vhash;
+      hashfilesindex=tmpdh.vhash>>rightshift;
+      CEBUG("Want to write fwd: " << tmpdh << " to " << hashfilesindex << endl);
+      BUGIFTHROW(hashfilesindex>=hashfiles.size(),"hashfilesindex>=hashfiles.size() ???");
+
+      if(hashfilebuffer[hashfilesindex].size()==hashfilebuffer[hashfilesindex].capacity()){
+	if(fwrite(&hashfilebuffer[hashfilesindex][0],sizeof(tmpdh),hashfilebuffer[hashfilesindex].size(),hashfiles[hashfilesindex]) != hashfilebuffer[hashfilesindex].size()){
+	  MIRANOTIFY(Notify::FATAL, "1 Could not write anymore to hash file. Disk full? Changed permissions?");
+	}
+	hashfilebuffer[hashfilesindex].clear();
+      }
+      hashfilebuffer[hashfilesindex].push_back(tmpdh);
+
+      elementsperfile[hashfilesindex]++;
+    }
+    //abort();
+
+    if(fwdandrev){
+      srvaI=singlereadvhraparray.begin();
+      hashesmade=transformSeqToVariableHash(
+	actreadid,
+	actread,
+	actread.getClippedComplementSeqAsChar(),
+	slen,
+	basesperhash,
+	srvaI,
+	false,
+	1,
+	tagmaskvector,
+	bposhashstats,
+	bfpos,
+	bfposinc
+	);
+      singlereadvhraparray.resize(hashesmade);
+      
+      tmpdh.dir=-1;
+      srvaI=singlereadvhraparray.begin();
+      for(uint32 i=0;i<hashesmade; i++, srvaI++){
+	tmpdh.hashpos=srvaI->hashpos-(basesperhash-1);
+	tmpdh.vhash=srvaI->vhash;
+	hashfilesindex=tmpdh.vhash>>rightshift;
+	CEBUG("Want to write rev: " << tmpdh << " to " << hashfilesindex << endl);
+	BUGIFTHROW(hashfilesindex>=hashfiles.size(),"hashfilesindex>=hashfiles.size() ???");
+
+	if(hashfilebuffer[hashfilesindex].size()==hashfilebuffer[hashfilesindex].capacity()){
+	  if(fwrite(&hashfilebuffer[hashfilesindex][0],sizeof(tmpdh),hashfilebuffer[hashfilesindex].size(),hashfiles[hashfilesindex]) != hashfilebuffer[hashfilesindex].size()){
+	    MIRANOTIFY(Notify::FATAL, "2 Could not write anymore to hash file. Disk full? Changed permissions?");
+	  }
+	  hashfilebuffer[hashfilesindex].clear();
+	}
+	hashfilebuffer[hashfilesindex].push_back(tmpdh);
+
+	elementsperfile[hashfilesindex]++;
+      }
+    }
+  }
+
+  for(size_t i=0; i<numfiles; i++){
+    if(!hashfilebuffer[i].empty()){
+      if(fwrite(&(hashfilebuffer[i][0]),sizeof(tmpdh),hashfilebuffer[i].size(),hashfiles[i]) != hashfilebuffer[i].size()){
+	MIRANOTIFY(Notify::FATAL, "3 Could not write anymore to hash file. Disk full? Changed permissions?");
+      }
+    }
+  }
+
+  P.finishAtOnce();
+  cout << "done\n";
+
+  for(size_t i=0; i<numfiles; i++){
+    fclose(hashfiles[i]);
+  }
+
+  FUNCEND();
+}
+#define CEBUG(bla) 
+
+
+/*************************************************************************
+ *
+ * sorter to sort from low to high in vhash (first) and direction
+ *
+ *************************************************************************/
+
+inline bool Skim__sortDiskHashComparator_(const diskhash_t & a, 
+					  const diskhash_t & b);
+inline bool Skim__sortDiskHashComparator_(const diskhash_t & a, 
+					  const diskhash_t & b)
+{
+  if(a.vhash==b.vhash){
+    return a.dir<b.dir;
+  }
+  return a.vhash < b.vhash;
+}
+
+/*************************************************************************
+ *
+ * sorter to sort from low to high in count
+ *
+ *************************************************************************/
+
+inline bool Skim__sortHashStatComparatorByCount_(const hashstat_t & a, 
+						 const hashstat_t & b);
+inline bool Skim__sortHashStatComparatorByCount_(const hashstat_t & a, 
+						 const hashstat_t & b)
+{
+  return a.count < b.count;
+}
+
+
+/*************************************************************************
+ *
+ * sorts every hashfile and writes a hash statistics file
+ *
+ * TODO: delete single hash files and clear vectors of filenames and sizes
+ * 
+ * returns:
+ *  - by value: elements in hash statistics file
+ *  - name of file in the call by reference variable
+ *
+ *************************************************************************/
+
+//#define CEBUG(bla)   {cout << bla; cout.flush();}
+
+size_t Skim::createHashStatisticsFile(string & hashstatfilename, vector<string> & hashfilenames, vector<size_t> & elementsperfile, uint8 basesperhash, uint32 fwdrevmin, ReadPool & rp, bool onlyagainstrails, bool alsosavesinglehashes, const string & directory)
+{
+  FUNCSTART("size_t Skim::createHashStatisticsFile(string & hashstatfilename, vector<string> & hashfilenames, vector<size_t> & elementsperfile, ReadPool & rp, bool onlyagainstrails, const string & directory)");
+
+  FILE * fout;
+  hashstatfilename=directory+"/hashstat.bin";
+  fout=fopen(hashstatfilename.c_str(), "w");
+
+  size_t maxelementsperfile=0;
+
+  for(size_t fi=0; fi< elementsperfile.size(); fi++){
+    maxelementsperfile=max(maxelementsperfile,elementsperfile[fi]);
+  }
+
+  CEBUG("Max elements per file: " << maxelementsperfile << '\n');
+
+  vector<diskhash_t> hashpool;
+  hashpool.reserve(maxelementsperfile+10);
+
+  size_t numhashstats=0;
+
+  ProgressIndicator<int32> P(0, static_cast<int32>(elementsperfile.size()));
+
+  for(size_t fi=0; fi< elementsperfile.size(); fi++){
+    P.increaseprogress();
+
+    CEBUG("Loading " << hashfilenames[fi] << endl);
+    CEBUG("elements in file: " << elementsperfile[fi] << endl);
+
+    if(elementsperfile[fi]==0) continue;
+    hashpool.clear();
+    hashpool.resize(elementsperfile[fi]);
+    
+    FILE * fin;
+    fin=fopen(hashfilenames[fi].c_str(), "r");
+    if(fread(&hashpool[0],sizeof(diskhash_t),elementsperfile[fi],fin) != elementsperfile[fi]) {
+      MIRANOTIFY(Notify::FATAL, "Expected to read " << elementsperfile[fi] << " elements in file " << hashfilenames[fi] << " but read less. Was the file deleted? Disk full?");
+    }
+    fclose(fin);
+
+    //for(size_t i=0; i<hashpool.size(); i++){
+    //  CEBUG(hashpool[i] << '\n');
+    //}
+
+    CEBUG("Sorting ... "); cout.flush();
+    sort(hashpool.begin(), hashpool.end(), Skim__sortDiskHashComparator_);
+    CEBUG("done.\n");
+
+    for(size_t i=0; i<hashpool.size(); i++){
+      CEBUG(hashpool[i] << '\n');
+    }
+
+    vector<diskhash_t>::const_iterator dhI=hashpool.begin();
+    uint32 hasforward=0;
+    uint32 hasreverse=0;
+    bool hasmultipleseqtype=false;
+    uint8 thisseqtype=0;
+    uint32 thishashcounter=0;
+    uint16 thislowpos=0;
+    hashstat_t tmphs;
+    // setting this leads the very first iteration of the main loop 
+    //  to set correct values
+    vhash_t thishash=(dhI->vhash)-1;
+    for(; dhI!=hashpool.end(); dhI++){
+      if(dhI->vhash != thishash){
+	// save only hashes that appeared more than once
+	bool writeit=false;
+	if(thishashcounter>1){
+	  writeit=true;
+	  tmphs.vhash=thishash;
+	  tmphs.count=thishashcounter;
+	  tmphs.lowpos=thislowpos;
+	  tmphs.hasfwdrev=(hasforward>=fwdrevmin) & (hasreverse>=fwdrevmin);
+	  tmphs.hasmultipleseqtype=hasmultipleseqtype;	  
+	  CEBUG("Write multiple: " << tmphs << '\n');
+	}else if(thishashcounter==1 && alsosavesinglehashes){
+	  writeit=true;
+	  tmphs.vhash=thishash;
+	  tmphs.count=1;
+	  tmphs.lowpos=thislowpos;
+	  tmphs.hasfwdrev=false;
+	  tmphs.hasmultipleseqtype=false;
+	  CEBUG("Write single: " << tmphs << '\n');
+	}
+	if(writeit){
+	  if(fwrite(&tmphs,sizeof(hashstat_t),1,fout) != 1){
+	    MIRANOTIFY(Notify::FATAL, "Expected to write 1 element in file " << hashstatfilename << " but could not. Was the file deleted? Disk full?");
+	  }
+	  numhashstats++;
+	}
+	hasforward=0;
+	hasreverse=0;
+	hasmultipleseqtype=false;
+	thishash=dhI->vhash;
+	thislowpos=dhI->hashpos;
+	thishashcounter=0;
+	thisseqtype=dhI->seqtype;
+      }
+      thishashcounter++;
+      if(dhI->dir>0) {
+	++hasforward;
+      }else{
+	++hasreverse;
+      }
+      if(dhI->hashpos < thislowpos) thislowpos=dhI->hashpos;
+      if(dhI->seqtype != thisseqtype) hasmultipleseqtype=true;
+    }
+
+    // were out of the loop, write last elements if there were any
+    bool writeit=false;
+    if(thishashcounter>1){
+      writeit=true;
+      tmphs.vhash=thishash;
+      tmphs.count=thishashcounter;
+      tmphs.lowpos=thislowpos;
+      tmphs.hasfwdrev=(hasforward>=fwdrevmin) & (hasreverse>=fwdrevmin);
+      tmphs.hasmultipleseqtype=hasmultipleseqtype;	  
+      if(fwrite(&tmphs,sizeof(hashstat_t),1,fout) != 1){
+	MIRANOTIFY(Notify::FATAL, "Expected to write 1 element in file " << hashstatfilename << " but could not. Was the file deleted? Disk full?");
+      }
+      CEBUG("Written multiple: " << tmphs << '\n');
+    }else if(thishashcounter==1 && alsosavesinglehashes){
+      writeit=true;
+      tmphs.vhash=thishash;
+      tmphs.count=1;
+      tmphs.lowpos=thislowpos;
+      tmphs.hasfwdrev=false;
+      tmphs.hasmultipleseqtype=false;
+      CEBUG("Write single: " << tmphs << '\n');
+    }
+    if(writeit){
+      if(fwrite(&tmphs,sizeof(hashstat_t),1,fout) != 1){
+	MIRANOTIFY(Notify::FATAL, "Expected to write 1 element in file " << hashstatfilename << " but could not. Was the file deleted? Disk full?");
+      }
+      numhashstats++;
+    }
+  }
+  
+  fclose(fout);
+
+  P.finishAtOnce();
+
+  FUNCEND();
+  return numhashstats;
+}
+//#define CEBUG(bla)
+
+
+/*************************************************************************
+ *
+ * Needs: Name of the hashstat filename and
+ *  vector<hashstat_t at the correct size to load all elements of the file
+ * returns:
+ *  - average hash statistics
+ *  - the hash statistics vector (sorted by count)
+ *
+ *************************************************************************/
+
+//#define CEBUG(bla)   {cout << bla; cout.flush();}
+size_t Skim::loadHashStatisticsFile(string & hashstatfilename, vector<hashstat_t> & hashstats)
+{
+  FUNCSTART("size_t Skim::loadHashStatisticsFile(string & hashstatfilename, vector<hashstat_t> & hashstats)");
+
+  CEBUG("Loading hash stats: " << hashstats.size() << endl);
+
+  FILE * fin;
+  fin=fopen(hashstatfilename.c_str(), "r");
+  size_t numread=fread(&hashstats[0],sizeof(hashstat_t),hashstats.size(),fin);
+  if(numread != hashstats.size()){
+    MIRANOTIFY(Notify::FATAL, "Expected to read " << hashstats.size() << " elements in hashfile " << hashstatfilename << " but read less (" << numread << "). Was the file deleted? Disk full?");
+  }
+  fclose(fin);
+
+  if(hashstats.begin() == hashstats.end()) return 0;
+
+  sort(hashstats.begin(),hashstats.end(),Skim__sortHashStatComparatorByCount_);
+
+  size_t mhi=calcMidHashStatIndex(hashstats,0);
+  // if mh index is in last 10 % of the hashstats, we have a pretty skewed
+  //  distribution. In that case, recalc without last 10%
+  // TODO: check whether 40 or 50% wouldn't be better.
+  if(mhi >= (hashstats.size()-hashstats.size()/10)){
+    mhi=calcMidHashStatIndex(hashstats,10);
+  }
+
+  FUNCEND();
+  return hashstats[mhi].count;
+}
+//#define CEBUG(bla)
+
+
+
+/*************************************************************************
+ *
+ * 
+ *
+ *************************************************************************/
+
+
+//#define CEBUG(bla)   {cout << bla; cout.flush();}
+size_t Skim::calcMidHashStatIndex(const vector<hashstat_t> & hashstats, size_t dontcarepercent)
+{
+  FUNCSTART("size_t Skim::calcMidHashStatIndex(const vector<hashstat_t> & hashstats, size_t dontcarepercent)");
+
+  if(hashstats.empty()) return 0;
+
+  size_t firsti=0;
+  size_t lasti=hashstats.size();
+  if(dontcarepercent){
+    firsti=hashstats.size()*dontcarepercent/100;
+    lasti-=hashstats.size()*dontcarepercent/100;
+  }else{
+    // 5% default
+    firsti=hashstats.size()/20;
+    lasti-=hashstats.size()/20;
+  }
+
+  size_t sumhashcounts=0;
+  uint32 oldhashcount=hashstats[0].count-1;
+  size_t oldsumhashcounts=0;
+  for(size_t i=firsti; i<lasti; i++){
+    if(hashstats[i].count != oldhashcount){
+      oldhashcount=hashstats[i].count;
+      CEBUG("count: " << oldhashcount << "\tsumhash: " << sumhashcounts << "\tdiff: " << sumhashcounts-oldsumhashcounts << endl);      
+      oldsumhashcounts=sumhashcounts;
+    }
+    if(hashstats[i].hasfwdrev) sumhashcounts+=hashstats[i].count;
+  }
+  CEBUG("count: " << oldhashcount << "\tsumhash: " << sumhashcounts << endl);
+
+  // Hmmm, pathological case. Maybe all reads were in the same direction.
+  //  simply recalc without the "has fwd/rev" clause
+  bool dontusefwdrev=false;
+  if(sumhashcounts==0){
+    dontusefwdrev=true;
+    for(size_t i=firsti; i<lasti; i++){
+      sumhashcounts+=hashstats[i].count;
+    }
+    CEBUG("recalc sumhash: " << sumhashcounts << endl);
+  }
+
+  size_t midhashstats=sumhashcounts/2;
+
+  CEBUG("midhashstats: " << midhashstats << endl);
+
+  sumhashcounts=0;
+  for(size_t i=firsti; i<lasti; i++){
+    if(dontusefwdrev || hashstats[i].hasfwdrev) sumhashcounts+=hashstats[i].count;
+    if(sumhashcounts>midhashstats) {
+      return i;
+    }
+  }
+
+  FUNCEND();
+
+  return 0;
+}
+//#define CEBUG(bla)
+
+
+
+
+
+/*************************************************************************
+ *
+ * Needs: 
+ *  - the hash statistics vector (sorted by count)
+ *
+ *************************************************************************/
+
+void Skim::dumpHashStatisticsInfo(size_t avgcov, vector<hashstat_t> & hashstats)
+{
+  FUNCSTART("void Skim::dumpHashStatisticsInfo(size_t avgcov, vector<hashstat_t> & hashstats)");
+
+  cout << "Hash statistics:\n"
+       << "=========================================================\n"
+       << "Measured avg. frequency coverage: " << avgcov << endl
+
+       << "\nDeduced thresholds:\n"
+       << "-------------------"
+       << "\nMin normal cov: " << SKIM3_freqest_minnormal*avgcov
+       << "\nMax normal cov: " << SKIM3_freqest_maxnormal*avgcov
+       << "\nRepeat cov: " << SKIM3_freqest_repeat*avgcov
+       << "\nHeavy cov: " << SKIM3_freqest_heavyrepeat*avgcov
+       << "\nCrazy cov: " << SKIM3_freqest_crazyrepeat*avgcov
+       << "\nMask cov: " << SKIM3_nastyrepeatratio*avgcov
+       << "\n\nRepeat ratio histogram:\n"
+       << "-----------------------"
+       << endl;
+
+  vector<size_t> ratiocounts(1,0);
+  for(size_t i=0; i<hashstats.size(); i++){
+    uint32 rci=static_cast<uint32>((static_cast<double>(hashstats[i].count) / avgcov) + 0.5);
+    if(rci>=ratiocounts.size()){
+      ratiocounts.resize(rci+1,0);
+    }
+    ratiocounts[rci]++;
+  }
+
+  for(size_t i=0; i<ratiocounts.size(); i++){
+    if(ratiocounts[i]) cout << i << '\t' << ratiocounts[i] << endl;
+  }
+
+  cout << "=========================================================\n\n";
+  
+  FUNCEND();
+
+  return;
+}
+
+
+
+/*************************************************************************
+ *
+ * sorter to sort from low to high, but lower 24bit grouped
+ *
+ *
+ *************************************************************************/
+
+inline bool Skim__sortHashStatComparatorByLow24bit_(const hashstat_t & a, 
+						    const hashstat_t & b);
+inline bool Skim__sortHashStatComparatorByLow24bit_(const hashstat_t & a, 
+						    const hashstat_t & b)
+{
+  if((a.vhash & MAXVHASHMASK) != (b.vhash & MAXVHASHMASK)) {
+    return (a.vhash & MAXVHASHMASK) < (b.vhash & MAXVHASHMASK);
+  }
+  return a.vhash < b.vhash;
+}
+
+
+/*************************************************************************
+ *
+ * needs: 
+ *  - hashstats filled with entries (can be unsorted, will be re-sorted
+ *    anyway)
+ *
+ * returns:
+ *  - hashstats array sorted by low 24 bit (low to high), then by vhash
+ *  - hsshortcuts_begin and ..._end pointing to start and end of each
+ *    low 24 bit group of same value
+ *
+ *************************************************************************/
+
+//#define CEBUG(bla)   {cout << bla; cout.flush();}
+
+void Skim::makeHashStatArrayShortcuts(vector<hashstat_t> & hashstats, const uint8 basesperhash, vector<vector<hashstat_t>::const_iterator > & hsshortcuts_begin, vector<vector<hashstat_t>::const_iterator > & hsshortcuts_end)
+{
+  FUNCSTART("void Skim::makeHashStatArrayShortcuts(vector<hashstat_t> & hashstats, const uint8 basesperhash, vector<vector<hashstat_t>::const_iterator > & hsshortcuts_begin, vector<vector<hashstat_t>::const_iterator > & hsshortcuts_end)");
+
+  CEBUG("makeHashStatArrayShortcuts: basesperhash: " << static_cast<uint16>(basesperhash) << "\n");
+
+  BUGIFTHROW(basesperhash==0, "basesperhash == 0 ???");
+
+  for(size_t i=0; i<hashstats.size(); i++){
+    CEBUG(hashstats[i] << '\n');
+  }
+
+  sort(hashstats.begin(), hashstats.end(), Skim__sortHashStatComparatorByLow24bit_);
+
+  hsshortcuts_begin.clear();
+  hsshortcuts_end.clear();
+  vector<hashstat_t>::const_iterator hsI=hashstats.begin();
+
+  hsshortcuts_begin.resize(
+    1<<(min(static_cast<uint8>(12),basesperhash)*2),
+//    static_cast<vector<hashstat_t>::iterator>(NULL)
+//    SKIM3_empty_vector_hashstat_t.end()
+    hashstats.end()
+   );
+
+  hsshortcuts_end.resize(
+    1<<(min(static_cast<uint8>(12),basesperhash)*2),
+//    static_cast<vector<hashstat_t>::iterator>(NULL)
+//    SKIM3_empty_vector_hashstat_t.end()
+    hashstats.end()
+    );
+
+  if(hsI==hashstats.end()) return;
+
+  CEBUG("hsshortcuts_begin.size(): " << hsshortcuts_begin.size() << endl);
+  CEBUG("hsshortcuts_end.size(): " << hsshortcuts_end.size() << endl);
+
+  vhash_t acthash= (hsI->vhash & MAXVHASHMASK);
+  while(hsI != hashstats.end()){
+    CEBUG("begin " << hex << acthash << dec << " is: " << *hsI << endl);
+    hsshortcuts_begin[acthash]=hsI;
+    for(;(hsI != hashstats.end()) && ((hsI->vhash & MAXVHASHMASK) == acthash); hsI++) {
+      CEBUG("INC\n")
+    }
+    CEBUG("end " << hex << acthash << dec << " is: " << *hsI << endl);
+    hsshortcuts_end[acthash]=hsI;
+    //cout << "vhash: " << hex << acthash << "\t" << dec << hsshortcuts_end[acthash]-hsshortcuts_begin[acthash] << '\n';
+    if(hsI != hashstats.end()) acthash= hsI->vhash & MAXVHASHMASK;
+  }
+
+  FUNCEND();
+}
+//#define CEBUG(bla)
+
+
+/*************************************************************************
+ *
+ * comparator for lower_bound below
+ *
+ *************************************************************************/
+
+inline bool Skim__compareHashStatHashElem_(const hashstat_t & a, 
+					   const hashstat_t & b);
+inline bool Skim__compareHashStatHashElem_(const hashstat_t & a, 
+					   const hashstat_t & b)
+{
+  return a.vhash < b.vhash;
+}
+
+//#define CEBUG(bla)   {cout << bla; cout.flush();}
+
+void Skim::assignReadBaseStatistics(ReadPool & rp, size_t avghashcov, vector<hashstat_t> & hashstats, const uint8 basesperhash, vector<vector<hashstat_t>::const_iterator > & hsshortcuts_begin, vector<vector<hashstat_t>::const_iterator > & hsshortcuts_end, bool masknastyrepeats)
+{
+  FUNCSTART("void Skim::assignReadBaseStatistics(ReadPool & rp, size_t avghashcov, vector<hashstat_t> & hashstats, const uint8 basesperhash, vector<vector<hashstat_t>::const_iterator > & hsshortcuts_begin, vector<vector<hashstat_t>::const_iterator > & hsshortcuts_end)");
+
+  uint32 minnormalhashcov=static_cast<uint32>(static_cast<double>(avghashcov)*SKIM3_freqest_minnormal); 
+  uint32 maxnormalhashcov=static_cast<uint32>(static_cast<double>(avghashcov)*SKIM3_freqest_maxnormal); 
+  uint32 repeathashcov=static_cast<uint32>(static_cast<double>(avghashcov)*SKIM3_freqest_repeat);
+  uint32 heavyrepthashcov=static_cast<uint32>(static_cast<double>(avghashcov)*SKIM3_freqest_heavyrepeat);
+  uint32 crazyrepthashcov=static_cast<uint32>(static_cast<double>(avghashcov)*SKIM3_freqest_crazyrepeat);
+  uint32 maskhashcov=static_cast<uint32>(static_cast<double>(avghashcov)*SKIM3_nastyrepeatratio); 
+
+  CEBUG("minnormalhashcov: " << minnormalhashcov << endl);
+  CEBUG("maxnormalhashcov: " << maxnormalhashcov << endl);
+  CEBUG("repeathashcov: " << repeathashcov << endl);
+
+  vector<vhrap_t> singlereadvhraparray;
+  singlereadvhraparray.reserve(10000);
+
+  // we will not use a mask, but
+  //  we need to supply an empty one anyway
+  vector<uint8> tagmaskvector;
+
+  // stores in each read whether the given hash frequency was seen
+  vector<uint8> hasfrequency(8);
+
+  vector<uint8> mcmask;
+  mcmask.reserve(10000);
+
+  ProgressIndicator<int32> P(0, rp.size());
+
+  for(uint32 actreadid=0; actreadid<rp.size(); actreadid++){
+    P.progress(actreadid);
+
+    //if(actreadid>100) return;
+
+    Read & actread= rp.getRead(actreadid);
+    if(!actread.hasValidData()
+      || !actread.isUsedInAssembly()) continue; 
+
+    // get rid of old values
+    actread.clearAllBPosHashStats();
+
+//#define CEBUG(bla)   {if(cebugok) cout << bla; cout.flush();}
+//    bool cebugok=false;
+//    if(actread.getName()=="E0K6C4E01CTNQI") cebugok=true;
+
+    uint32 slen=actread.getLenClippedSeq();
+
+    if(slen<basesperhash) continue;
+
+    mcmask.clear();
+    mcmask.resize(actread.getLenSeq(),0);
+
+    hasfrequency.clear();
+    hasfrequency.resize(8,0);
+
+    CEBUG("name: " << actread.getName() << '\n');
+
+    //cout << "Before ...\n";
+    //Read::setCoutType(Read::AS_TEXT);
+    //cout << actread;
+
+    singlereadvhraparray.resize(slen);
+    tagmaskvector.resize(slen,0);
+
+    vector<vhrap_t>::iterator srvaI=singlereadvhraparray.begin();
+
+    vector<Read::bposhashstat_t> & bposhashstats=const_cast<vector<Read::bposhashstat_t> &>(actread.getBPosHashStats());
+    uint32 hashesmade;
+
+    {
+      int32 bfpos=actread.calcClippedPos2RawPos(0);
+      int32 bfposinc=1;
+
+      hashesmade=transformSeqToVariableHash(
+	actreadid,
+	actread,
+	actread.getClippedSeqAsChar(),
+	slen,
+	basesperhash,
+	srvaI,
+	false,
+	1,
+	tagmaskvector,
+	bposhashstats,
+	bfpos,
+	bfposinc
+	);
+    }
+    singlereadvhraparray.resize(hashesmade);
+
+    CEBUG("hashesmade: " << hashesmade << endl);
+
+    vector<hashstat_t>::const_iterator lowerbound;
+    vector<hashstat_t>::const_iterator upperbound;
+
+    vector<hashstat_t>::const_iterator hssearchI;
+    srvaI=singlereadvhraparray.begin();
+
+    int32 bfpos1,bfpos2;
+    hashstat_t hstmp;
+    bool foundit;
+    for(; srvaI != singlereadvhraparray.end(); srvaI++){
+      CEBUG(*srvaI << '\n');
+
+      foundit=false;
+      lowerbound=hsshortcuts_begin[srvaI->vhash & MAXVHASHMASK];
+      upperbound=hsshortcuts_end[srvaI->vhash & MAXVHASHMASK];
+	
+      // "SKIM3_empty_vector_hashstat_t.end()" is the "NULL" replacement
+      if(hashstats.end() != lowerbound){
+	if(basesperhash>12){
+	  // with more than 12 bases in a hash, the array is subdivided 
+	  hstmp.vhash=srvaI->vhash;
+	  hssearchI=lower_bound(lowerbound,
+				upperbound,
+				hstmp,
+				Skim__compareHashStatHashElem_);
+	  if(hssearchI != hashstats.end()
+	     && hssearchI->vhash == srvaI->vhash) foundit=true;
+	}else{
+	  hssearchI=lowerbound;
+	  foundit=true;
+	}
+      }else{
+	CEBUG("---------- NO LB HIT??? -------\n");
+      }
+
+      if(foundit) {
+	CEBUG("VHRAP: " << *srvaI << '\n');
+	CEBUG("HashStat: " << *hssearchI << '\n');
+	CEBUG("srvaI->hashpos: " << srvaI->hashpos << '\n');
+
+	bfpos1=actread.calcClippedPos2RawPos(srvaI->hashpos-(basesperhash-1));
+	bfpos2=bfpos1+basesperhash-1;
+
+	CEBUG("b bfpos1: " << bfpos1 << '\t' << bposhashstats[bfpos1] << endl);
+	CEBUG("b bfpos2: " << bfpos2 << '\t' << bposhashstats[bfpos2] << endl);
+
+	bposhashstats[bfpos1].fwd.setValid();
+	bposhashstats[bfpos2].rev.setValid();
+
+	if(hssearchI->hasfwdrev) {
+	  //bhs|=Read::BFLAGS_CONFIRMED_FWDREV;
+	  CEBUG("Set ConfFWDREV\n");
+	  bposhashstats[bfpos1].fwd.setConfirmedFwdRev();
+	  bposhashstats[bfpos2].rev.setConfirmedFwdRev();
+	}
+	if(hssearchI->lowpos<=4){
+	  //bhs|=Read::BFLAGS_SEENATLOWPOS;
+	  CEBUG("Set SeenAtLowPos\n");
+	  bposhashstats[bfpos1].fwd.setSeenAtLowPos();
+	  bposhashstats[bfpos2].rev.setSeenAtLowPos();
+	}
+	if(hssearchI->hasmultipleseqtype){
+	  //bhs|=Read::BFLAGS_CONFIRMED_MULTIPLESEQTYPE;
+	  CEBUG("Set ConfMultSeqType\n");
+	  bposhashstats[bfpos1].fwd.setConfirmedMultipleSeqType();
+	  bposhashstats[bfpos2].rev.setConfirmedMultipleSeqType();
+	}
+	uint8 frequency=2;
+	if(hssearchI->count == 1){
+	  frequency=1;
+	}else if(hssearchI->count<minnormalhashcov) {
+	  frequency=2;
+	}else if(hssearchI->count>=minnormalhashcov
+	   && hssearchI->count<=maxnormalhashcov) {
+	  frequency=3;
+	  //}else if(hssearchI->count > minnormalhashcov*20){
+	}else if(hssearchI->count > crazyrepthashcov){
+	  frequency=7;
+	}else if(hssearchI->count > heavyrepthashcov){
+	  frequency=6;
+	}else if(hssearchI->count>=repeathashcov){
+	  frequency=5;
+	}else{
+	  frequency=4;
+	}
+	CEBUG("Set frequency: " << static_cast<uint16>(frequency) << endl);
+
+	if(maskhashcov>0 && hssearchI->count>=maskhashcov){
+	  for(uint32 j=0; j<basesperhash; j++){
+	    mcmask[bfpos1+j]=1;
+	  }
+	}
+
+	CEBUG("a1 bfpos1: " << bfpos1 << '\t' << bposhashstats[bfpos1] << endl);
+	CEBUG("a1 bfpos2: " << bfpos2 << '\t' << bposhashstats[bfpos2] << endl);
+
+	bposhashstats[bfpos1].fwd.setFrequency(frequency);
+	bposhashstats[bfpos2].rev.setFrequency(frequency);
+
+	CEBUG("a2 bfpos1: " << bfpos1 << '\t' << bposhashstats[bfpos1] << endl);
+	CEBUG("a2 bfpos2: " << bfpos2 << '\t' << bposhashstats[bfpos2] << endl);
+
+	hasfrequency[frequency]=1;
+	
+	//cout.flush();
+	//actread.setBaseFlagsInClippedSequence(bhs,
+	//				      srvaI->hashpos-(basesperhash-1),
+	//				      basesperhash);
+	//actread.setHasBaseFlags(true);
+      }
+    }
+
+    actread.setHasFreqAvg(false);
+    actread.setHasFreqRept(false);
+
+    if(hasfrequency[3]){
+      actread.setHasFreqAvg(true);
+    }
+    if(hasfrequency[5] || hasfrequency[6] || hasfrequency[7]){
+      actread.setHasFreqRept(true);
+    }
+
+    actread.setHasBaseHashStats(true);
+
+    //cout << "After ...\n";
+    //Read::setCoutType(Read::AS_TEXT);
+    //cout << actread;
+
+
+    // BaCh 07.04.2009 Bad Idea!!!
+    // BaCh 12.07.2009 Why? Forgot ... :-(
+    ///* the fwd/rev of a read now looks like this (e.g.)
+    //   (for better viewing dot == 0)
+    //
+    //   f   ..........2222222233333....355555....................
+    //   r   ................2222222....33333355555...............
+    //
+    //   in dubio pro reo and to allow for potential matches,
+    //   do this:
+    //
+    //   f   ..........2222222233333....355555->..................
+    //   r   ..............<-2222222....33333355555...............
+    //
+    //   so that this 
+    //
+    //   f   ..........2222222233333....35555555555...............
+    //   r   ..........2222222222222....33333355555...............
+    //
+    //   is generated
+    //
+    //*/
+    //
+    //{
+    //  uint32 bfposi=0;
+    //  for(; bfposi<bposhashstats.size() && bposhashstats[bfposi].fwd.getFrequency()==0; bfposi++) {};
+    //  uint32 bfpose=bfposi;
+    //  for(; bfpose<bposhashstats.size() && bposhashstats[bfpose].rev.getFrequency()==0; bfpose++) {};
+    //  if(bfposi<bposhashstats.size() && bfpose<bposhashstats.size()){
+    //	for(uint32 i=bfposi; i<bfpose; i++){
+    //	  bposhashstats[i].fwd=bposhashstats[bfpose].rev;
+    //	}
+    //  }
+    //
+    //  bfposi=bposhashstats.size()-1;
+    //  for(; bfposi>0 && bposhashstats[bfposi].rev.getFrequency()==0; bfposi--) {};
+    //  bfpose=bfposi;
+    //  for(; bfpose>0 && bposhashstats[bfpose].fwd.getFrequency()==0; bfpose--) {};
+    //  if(bfposi>0){
+    //	for(uint32 i=bfposi; i>bfpose; i--){
+    //	  bposhashstats[i].fwd=bposhashstats[bfpose].rev;
+    //	}
+    //  }
+    //}
+
+
+    // go through multicopy array and set MNRr tags for
+    //  consecutive positions in read tagged as multicopy
+    if(masknastyrepeats){
+      bool inrun=false;
+      uint32 runstart=0;
+      uint32 pos=0;
+      for(; pos<mcmask.size(); pos++){
+	CEBUG("pos: " << pos << '\t' << static_cast<uint16>(mcmask[pos]) << '\t' << inrun << '\n');
+	if(mcmask[pos]){
+	  if(!inrun){
+	    runstart=pos;
+	    inrun=true;
+	  }
+	}else{
+	  if(inrun){
+	    CEBUG("reprun " << actread.getName() << '\t' << runstart << '\t' << pos-1 << endl);
+	    actread.addTag(runstart, pos-1, Read::REA_tagentry_idMNRr, Read::REA_tagentry_coEmpty);
+	    inrun=false;
+	  }
+	}
+      }
+      if(inrun){
+	CEBUG("reprun " << actread.getName() << '\t' << runstart << '\t' << pos-1 << endl);
+	actread.addTag(runstart, pos-1, Read::REA_tagentry_idMNRr, Read::REA_tagentry_coEmpty);
+	inrun=false;
+      }
+    }
+
+
+
+  }
+
+  P.finishAtOnce();
+  cout << '\n';
+
+  //cout << "\nskim Needs redo!\n";
+  //exit(0);
+
+  FUNCEND();
+}
+
+
+
+
+
+
+/*************************************************************************
+ *
+ *
+ *
+ *************************************************************************/
+
+
+uint32 Skim::checkBaitHit(Read & actread)
+{
+  //, const uint8 basesperhash, vector<hashstat_t> & hashstats, vector<vector<hashstat_t>::const_iterator > & hsshortcuts_begin, vector<vector<hashstat_t>::const_iterator > & hsshortcuts_end)
+  FUNCSTART("checkBaitHit()");
+
+  if(!actread.hasValidData()) return 0;
+  uint32 slen=actread.getLenClippedSeq();
+  if(slen<SKIM3_hs_basesperhash) return 0;
+
+  // don't really need to clear out these re-used vectors
+  //   - tagmask just needs to contain "0" at every elemnt
+  //   - singlereadvhraparray needs to be big enough to be
+  //     written into by transformSeqToVariableHash()
+  if(SKIM3_baiting_tagmaskvector.size() < slen){
+    SKIM3_baiting_tagmaskvector.resize(slen,0);
+  }
+  if(SKIM3_baiting_singlereadvhraparray.size() < slen){
+    SKIM3_baiting_singlereadvhraparray.resize(slen);
+  }
+
+  vector<vhrap_t>::iterator srvaI=SKIM3_baiting_singlereadvhraparray.begin();
+
+  vector<Read::bposhashstat_t> & bposhashstats=const_cast<vector<Read::bposhashstat_t> &>(actread.getBPosHashStats());
+  uint32 hashesmade;
+
+  {
+    int32 bfpos=0;
+    int32 bfposinc=1;
+    
+    uint32 actreadid=0;
+    
+    hashesmade=transformSeqToVariableHash(
+      actreadid,
+      actread,
+      actread.getClippedSeqAsChar(),
+      slen,
+      SKIM3_hs_basesperhash,
+      srvaI,
+      false,
+      1,
+      SKIM3_baiting_tagmaskvector,
+      bposhashstats,
+      bfpos,
+      bfposinc
+      );
+  }
+  SKIM3_baiting_singlereadvhraparray.resize(hashesmade);
+  
+  CEBUG("hashesmade: " << hashesmade << endl);
+  
+  vector<hashstat_t>::const_iterator lowerbound;
+  vector<hashstat_t>::const_iterator upperbound;
+  
+  vector<hashstat_t>::const_iterator hssearchI;
+  srvaI=SKIM3_baiting_singlereadvhraparray.begin();
+
+  hashstat_t hstmp;
+  bool foundit;
+  uint32 numhits=0;
+  for(; srvaI != SKIM3_baiting_singlereadvhraparray.end(); srvaI++){
+    CEBUG(*srvaI << '\n');
+    
+    foundit=false;
+    lowerbound=SKIM3_hs_hsshortcuts_begin[srvaI->vhash & MAXVHASHMASK];
+    upperbound=SKIM3_hs_hsshortcuts_end[srvaI->vhash & MAXVHASHMASK];
+    
+    // "SKIM3_empty_vector_hashstat_t.end()" is the "NULL" replacement
+    if(SKIM3_hs_hashstats.end() != lowerbound){
+      if(SKIM3_hs_basesperhash>12){
+	// with more than 12 bases in a hash, the array is subdivided 
+	hstmp.vhash=srvaI->vhash;
+	hssearchI=lower_bound(lowerbound,
+			      upperbound,
+			      hstmp,
+			      Skim__compareHashStatHashElem_);
+	if(hssearchI != SKIM3_hs_hashstats.end()
+	   && hssearchI->vhash == srvaI->vhash) foundit=true;
+      }else{
+	hssearchI=lowerbound;
+	foundit=true;
+      }
+    }else{
+      CEBUG("---------- NO LB HIT??? -------\n");
+    }
+    
+    if(foundit) {
+      ++numhits;
+    }
+  }
+
+  //cout << "\nskim Needs redo!\n";
+  //exit(0);
+
+  FUNCEND();
+  return numhits;
+}
+
+
+
+
+/*************************************************************************
+ *
+ * Around each RMB base, set the base statitsics to "repeat"
+ * More a test.
+ *
+ *
+ *************************************************************************/
+
+//#define CEBUG(bla)   {cout << bla; cout.flush();}
+
+void Skim::correctReadBaseStatisticsByRMB(ReadPool & rp, const uint8 basesperhash)
+{
+  ProgressIndicator<int32> P(0, rp.size());
+
+  for(uint32 actreadid=0; actreadid<rp.size(); actreadid++){
+    P.progress(actreadid);
+
+    Read & actread= rp.getRead(actreadid);
+    if(!actread.hasValidData()
+       || !actread.isUsedInAssembly()
+       || !actread.hasBaseHashStats()) continue; 
+
+    if(actread.hasTag(Read::REA_tagentry_idSRMr)
+       || actread.hasTag(Read::REA_tagentry_idCRMr)){
+
+      CEBUG("Read " << actread.getName() << endl);
+      for(uint32 tagnr=0; tagnr<actread.getNumOfTags(); tagnr++){
+	const multitag_t & acttag=actread.getTag(tagnr);
+	if(acttag.identifier==Read::REA_tagentry_idSRMr
+	   || acttag.identifier==Read::REA_tagentry_idCRMr){
+	  
+	  CEBUG("Tag " << acttag << endl);
+	  vector<Read::bposhashstat_t> & bposhashstats=const_cast<vector<Read::bposhashstat_t> &>(actread.getBPosHashStats());
+	  if(!bposhashstats.empty()){
+	    Read::setCoutType(Read::AS_TEXT);
+	    CEBUG("Before\n" << actread);
+
+	    uint32 bposfrom=acttag.from;
+	    uint32 bposto=acttag.to;
+	    if(bposto<bposfrom) swap(bposfrom,bposto);
+	    if(bposfrom>=basesperhash-1){
+	      bposfrom-=basesperhash-1;
+	    }else{
+	      bposfrom=0;
+	    }
+
+	    CEBUG("bposfrom: " << bposfrom << "\tbposto: " << bposto << endl);
+	    for(; bposfrom<=bposto; bposfrom++){
+	      if(bposhashstats[bposfrom].fwd.isValid()
+		 && bposhashstats[bposfrom].fwd.getFrequency()<5){
+		bposhashstats[bposfrom].fwd.setFrequency(5);
+	      }
+	      if(bposhashstats[bposfrom].rev.isValid()
+		 && bposhashstats[bposfrom].rev.getFrequency()<5){
+		bposhashstats[bposfrom].rev.setFrequency(5);
+	      }
+	    }
+
+	    bposfrom=acttag.from;
+	    bposto=acttag.to;
+	    if(bposto<bposfrom) swap(bposfrom,bposto);
+	    bposto+=basesperhash-1;
+	    if(bposto>=bposhashstats.size()) bposto=bposhashstats.size()-1;
+
+	    CEBUG("bposfrom: " << bposfrom << "\tbposto: " << bposto << endl);
+	    for(; bposfrom<=bposto; bposfrom++){
+	      if(bposhashstats[bposfrom].rev.isValid()
+		 && bposhashstats[bposfrom].rev.getFrequency()<5){
+		bposhashstats[bposfrom].rev.setFrequency(5);
+	      }
+	    }
+
+	    CEBUG("After\n" << actread);
+
+	  }
+	}
+      }
+    }
+
+  }
+  P.finishAtOnce();
+  cout << '\n';
+}
+//#define CEBUG(bla)
+
+
+
+
+
+
+
+
+/*************************************************************************
+ *
+ *
+ *
+ *************************************************************************/
+
+//#define CEBUG(bla)   {cout << bla; cout.flush();}
+
+void Skim::skimStreamPrepare(ReadPool & rp, 
+			     uint8  bph,
+			     uint8  hss,
+			     const char * additionalregexp)
+{
+  FUNCSTART("uint32 Skim::skimGo( ... )");
+
+  dateStamp(cout);
+  Read::setCoutType(Read::AS_CLIPPEDFASTA);
+
+  init();
+
+  SKIM3_readpool=&rp;
+
+  if(sizeof(vhash_t)==4){
+    if(bph>14) bph=14;
+  }
+  if(sizeof(vhash_t)==8){
+    if(bph>30) bph=30;
+  }
+  SKIM3_basesperhash=bph;
+  SKIM3_hashsavestepping=hss;
+
+  fillTagStatusInfoOfReads();
+
+  prepareSkim(0, rp.size(), SKIM3_vhraparray,false);
+
+  SKIM3_farc_addregexes_file.clear();
+
+  //// prepare regular expressions
+  if(additionalregexp!=NULL){
+    SKIM3_farc_addregexes_file=additionalregexp;
+  }
+  //if(additionalregexp!=NULL){
+  //  istringstream tmpis(additionalregexp);
+  //  string line;
+  //  while(true){
+  //    getline(tmpis,line);
+  //    if(tmpis.eof()) break;
+  //    boost::to_upper(line);
+  //    SKIM3_farc_addregexes_templates.push_back(boost::regex(line));
+  //  }
+  //}
+
+
+ 
+  FUNCEND();
+  return;
+}
+//#define CEBUG(bla)
+
+
+
+
+
+
+/*************************************************************************
+ *
+ * seqtype -1 == all sequencing types, else only the given
+ *
+ *************************************************************************/
+
+//#define CEBUG(bla)   {cout << bla; cout.flush();}
+
+void Skim::findAdaptorRightClip(ReadPool & searchpool, vector<int32> & results, int8 seqtype, uint32 minhashes, uint32 numthreads)
+{
+  FUNCSTART("void Skim::checkForAdaptor(Read & actread, cfh_threaddata_t & cfhd)");
+
+  results.clear();
+  results.resize(searchpool.size(),-1);
 
   SKIM3_farc_searchpool=&searchpool;
   SKIM3_farc_results=&results;
@@ -3430,35 +4583,29 @@ void Skim<TVHASH_T>::findAdaptorRightClip(ReadPool & searchpool, vector<int32> &
   SKIM3_farc_seqtype=seqtype;
 
   startMultiThreading(1,numthreads,10000,0,searchpool.size(),
-		      boost::bind( &Skim<TVHASH_T>::farcThreadsDataInit, this, _1 ),
-		      boost::bind( &Skim<TVHASH_T>::farcThreadLoop, this, _1 ));
+		      boost::bind( &Skim::farcThreadsDataInit, this, _1 ),
+		      boost::bind( &Skim::farcThreadLoop, this, _1 ));
 
   FUNCEND();
 }
 
-template<typename TVHASH_T>
-int32 Skim<TVHASH_T>::findAdaptorRightClip(Read & actread, uint32 minhashes, readid_t & ridofadapfound, int32 threadid)
+int32 Skim::findAdaptorRightClip(Read & actread, uint32 minhashes)
 {
-  FUNCSTART("int32 Skim<TVHASH_T>::findAdaptorRightClip(Read & actread, uint32 minhashes. int32 threadid)");
+  FUNCSTART("void Skim::checkForAdaptor(Read & actread, cfh_threaddata_t & cfhd)");
 
-  int32 ret=0;
-  if(threadid<0){
-    ret=findAdaptorRightClip_internal(actread,minhashes,ridofadapfound,SKIM3_farcdata_fornonmultithread);
-  }else{
-    BUGIFTHROW(threadid>=SKIM3_farcd_vector.size(),"Oooooops, trying to use thread id " << threadid << ", but prepared only for " << SKIM3_farcd_vector.size() << " threads???");
-    ret=findAdaptorRightClip_internal(actread,minhashes, ridofadapfound, SKIM3_farcd_vector[threadid]);
-  }
-  return ret;
+  return findAdaptorRightClip_internal(actread,minhashes,SKIM3_farcdata_fornonmultithread);
+
+  FUNCEND();
 }
 
+
+
 #define CEBUG2(bla)
-//#define CEBUG2(bla)   {cout << bla; cout.flush();}
 //#define CEBUG(bla)   {cout << bla; cout.flush();}
 
-template<typename TVHASH_T>
-int32 Skim<TVHASH_T>::findAdaptorRightClip_internal(Read & actread, uint32 minhashes, readid_t & ridofadapfound, farc_threaddata_t & farcd)
+int32 Skim::findAdaptorRightClip_internal(Read & actread, uint32 minhashes, farc_threaddata_t & farcd)
 {
-  FUNCSTART("void Skim<TVHASH_T>::checkForAdaptor(Read & actread, cfh_threaddata_t & cfhd)");
+  FUNCSTART("void Skim::checkForAdaptor(Read & actread, cfh_threaddata_t & cfhd)");
 
   CEBUG("farc_i: " << actread.getName() << endl);
 
@@ -3467,16 +4614,20 @@ int32 Skim<TVHASH_T>::findAdaptorRightClip_internal(Read & actread, uint32 minha
   uint32 slen=actread.getLenClippedSeq();
   if(slen<SKIM3_basesperhash) return -1;
 
-  // don't really need to clear out this re-used vector
+  // don't really need to clear out these re-used vectors
+  //   - tagmask just needs to contain "0" at every elemnt
   //   - singlereadvhraparray needs to be big enough to be
   //     written into by transformSeqToVariableHash()
+  if(farcd.tagmaskvector.size() < slen){
+    farcd.tagmaskvector.resize(slen,0);
+  }
   if(farcd.singlereadvhraparray.size() < slen){
     farcd.singlereadvhraparray.resize(slen);
   }
 
   farcd.readhashmatches.clear();
 
-  auto srvaI=farcd.singlereadvhraparray.begin();
+  vector<vhrap_t>::iterator srvaI=farcd.singlereadvhraparray.begin();
 
   vector<Read::bposhashstat_t> & bposhashstats=const_cast<vector<Read::bposhashstat_t> &>(actread.getBPosHashStats());
   uint32 hashesmade;
@@ -3486,7 +4637,7 @@ int32 Skim<TVHASH_T>::findAdaptorRightClip_internal(Read & actread, uint32 minha
   {
     int32 bfpos=0;
     int32 bfposinc=1;
-
+    
     hashesmade=transformSeqToVariableHash(
       actreadid,
       actread,
@@ -3496,38 +4647,39 @@ int32 Skim<TVHASH_T>::findAdaptorRightClip_internal(Read & actread, uint32 minha
       srvaI,
       false,
       1,
-      farcd.unused_tagmaskvector,
+      farcd.tagmaskvector,
       bposhashstats,
       bfpos,
       bfposinc
       );
   }
   farcd.singlereadvhraparray.resize(hashesmade);
-
+  
   CEBUG("hashesmade: " << hashesmade << endl);
-
+  
 
   srvaI=farcd.singlereadvhraparray.begin();
 
-  typename vector<typename HashStatistics<TVHASH_T>::vhrap_t>::const_iterator lowerbound;
-  typename vector<typename HashStatistics<TVHASH_T>::vhrap_t>::const_iterator upperbound;
+  vector<vhrap_t>::const_iterator lowerbound;
+  vector<vhrap_t>::const_iterator upperbound;
   for(; srvaI != farcd.singlereadvhraparray.end(); srvaI++){
-    lowerbound=SKIM3_vashortcuts_begin[static_cast<uint64>(srvaI->vhash & SKIM3_MAXVHASHMASK)];
-    upperbound=SKIM3_vashortcuts_end[static_cast<uint64>(srvaI->vhash & SKIM3_MAXVHASHMASK)];
-
-    // "SKIM3_empty_vector_vhrap_t.end()" is the "nullptr" replacement
+    lowerbound=SKIM3_vashortcuts_begin[srvaI->vhash & MAXVHASHMASK];
+    upperbound=SKIM3_vashortcuts_end[srvaI->vhash & MAXVHASHMASK];
+    
+    // "SKIM3_empty_vector_vhrap_t.end()" is the "NULL" replacement
     if(SKIM3_completevhraparray_end != lowerbound){
       if(SKIM3_basesperhash>12){
 	// with more than 12 bases in a hash, the vhrap array is
-	//  subdivided
-	auto p=equal_range(lowerbound,
-			   upperbound,
-			   *srvaI,
-			   compareVHRAPArrayElem_);
+	//  subdivided 
+	pair<vector<vhrap_t>::const_iterator, vector<vhrap_t>::const_iterator>
+	  p=equal_range(lowerbound,
+			upperbound,
+			*srvaI,
+			Skim__compareVHRAPArrayElem_);
 	lowerbound=p.first;
 	upperbound=p.second;
       }
-
+      
       for(;lowerbound!=upperbound; lowerbound++){
 	//CEBUG("/// " << actreadid << '\t' << lowerbound->readid << '\n');
 	//CEBUG("/// take!\n");
@@ -3557,47 +4709,65 @@ int32 Skim<TVHASH_T>::findAdaptorRightClip_internal(Read & actread, uint32 minha
       uint32 largesthash=0;
       for(; ssmwsI != farcd.tmpmatchwith.end(); ++ssmwsI){
 	CEBUG2(actread.getName() << " to " << SKIM3_readpool->getRead(ssmwsI->otherid).getName() << " : " << *ssmwsI);
-	// have at least an estimated 50% identity, false positive adaptor identifications normally have well below 50%
-	if(ssmwsI->numhashes>=minhashes && ssmwsI->percent_in_overlap>=50){
+	if(ssmwsI->numhashes>=minhashes){
 	  int32 numhashes=ssmwsI->numhashes;
 	  if(ssmwsI->eoffset < 0) numhashes+=ssmwsI->eoffset;
 	  if(numhashes>=minhashes){
 	    if(ssmwsI->eoffset < leftmostpos){
-	      CEBUG2("newleft!!!!!!\n");
 	      leftmostpos=ssmwsI->eoffset;
 	      leftmostokI=ssmwsI;
 	    }
 	    if(numhashes>largesthash){
-	      CEBUG2("newlarge!!!!!!\n");
 	      largesthash=numhashes;
 	      largestokI=ssmwsI;
 	    }
 	  }
 	}
       }
-//      if(leftmostokI!=farcd.tmpmatchwith.end()){
-//	//cout << "Chosen " << SKIM3_readpool->getRead(leftmostokI->otherid).getName() << ": " << *leftmostokI;
-//	ridofadapfound=leftmostokI->otherid;
-//	retvalue=leftmostokI->eoffset;
-      if(largestokI!=farcd.tmpmatchwith.end()){
-	//cout << "Chosen " << SKIM3_readpool->getRead(largestokI->otherid).getName() << ": " << *largestokI;
-	ridofadapfound=largestokI->otherid;
-	retvalue=largestokI->eoffset;
+      if(leftmostokI!=farcd.tmpmatchwith.end()){
+	//cout << "Chosen " << SKIM3_readpool->getRead(leftmostokI->otherid).getName() << ": " << *leftmostokI;
+	retvalue=leftmostokI->eoffset;
 	if(retvalue<0) retvalue=0;
 	if(leftmostokI!=largestokI){
-	  //cout << "Leftmost != Biggest " << SKIM3_readpool->getRead(largestokI->otherid).getName() << ": " << *largestokI;
+	  //cout << "Chosen != Biggest " << SKIM3_readpool->getRead(largestokI->otherid).getName() << ": " << *largestokI;
 	}
       }
     }
-    //selectPotentialHitsForSave2(direction, actreadid,
+    //selectPotentialHitsForSave2(direction, actreadid, 
     //				cfhd);
+    
+  }
 
+  // not hit via SKIM? use plain old regex
+  if(0){
+  //if(retvalue<0){
+    CEBUG("No hit, trying harder: " << actread.getName() << endl);
+
+    string seq(actread.getSeqAsChar());
+    boost::to_upper(seq);
+
+    list<boost::regex>::const_iterator areI=farcd.addregexes.begin();
+    boost::match_flag_type flags = boost::match_default; 
+    std::string::const_iterator start, end; 
+    for(; areI != farcd.addregexes.end(); ++areI){
+      start = seq.begin(); 
+      end = seq.end(); 
+      if(regex_search(start, end, farcd.rematches, *areI, flags)) { 
+//	++numclipped;
+//	actread.setRSClipoff(what.position());
+//	logfout << logprefix << " Solexa partial end adaptor: " << actread.getName()
+//		<< " changed right clip to " << farcd.rematches.position() << "\n";
+	retvalue=farcd.rematches.position();
+	CEBUG("Regex hit: " << retvalue << endl);
+	break;
+      }
+    }
   }
 
   return retvalue;
 }
 
-//#define CEBUG(bla)
+#define CEBUG(bla) 
 
 
 
@@ -3614,8 +4784,7 @@ int32 Skim<TVHASH_T>::findAdaptorRightClip_internal(Read & actread, uint32 minha
 //#define CEBUG(bla)   {cout << bla; cout.flush();}
 //#define CEBUG_extra_cFPH
 
-template<typename TVHASH_T>
-void Skim<TVHASH_T>::checkForPotentialAdaptorHits(const int8 direction, const uint32 actreadid, Read & actread, vector<matchwithsorter_t> & tmpmatchwith, vector<readhashmatch_t> & readhashmatches)
+void Skim::checkForPotentialAdaptorHits(const int8 direction, const uint32 actreadid, Read & actread, vector<matchwithsorter_t> & tmpmatchwith, vector<readhashmatch_t> & readhashmatches)
 {
   //bool dodebug=false;
 
@@ -3632,13 +4801,13 @@ void Skim<TVHASH_T>::checkForPotentialAdaptorHits(const int8 direction, const ui
   // so, if it is empty, return immediately
   if(readhashmatches.empty()) return;
 
-  sort(readhashmatches.begin(), readhashmatches.end(), sortreadhashmatch_t_);
-
+  sort(readhashmatches.begin(), readhashmatches.end(), Skim__sortreadhashmatch_t_);
+  
   vector<readhashmatch_t>::const_iterator sI=readhashmatches.begin();
 
   uint32 countid=sI->rid2;
   while(sI != readhashmatches.end()){
-
+    
     uint32 rid2=sI->rid2;
     uint16 oldhashpos=sI->hashpos1;
     uint16 hp1min=0xffff;
@@ -3699,7 +4868,7 @@ void Skim<TVHASH_T>::checkForPotentialAdaptorHits(const int8 direction, const ui
     hp2min-=(SKIM3_basesperhash-1);
 
     int32 eoffsetmean=eoffsetmin+(eoffsetmax-eoffsetmin)/2;
-
+    
     // calc max overlap
     // currently only for one offset
     if(eoffsetmean<0){
@@ -3747,15 +4916,12 @@ void Skim<TVHASH_T>::checkForPotentialAdaptorHits(const int8 direction, const ui
       }
     }
 
-    // 13 was a bit too small, still produces rare false positives even if percent_in_overlap >= 60
-    // only workable countermeasure: 16 (and that is also more in-line with minimm overlaps one
-    //  should use)
-    int32 minoverlaprequired=16;
+    int32 minoverlaprequired=13;
 
 #ifdef CEBUG_extra_cFPH
     {
       boost::mutex::scoped_lock lock(SKIM3_coutmutex);
-      CEBUG("eomin: " << eoffsetmin << "\teomax: " << eoffsetmax
+      CEBUG("eomin: " << eoffsetmin << "\teomax: " << eoffsetmax 
 	    << "\tmor: " << minoverlaprequired
 	    << "\tho: " << hashesoverlap
 	    << "\t%: " << perc
@@ -3772,7 +4938,7 @@ void Skim<TVHASH_T>::checkForPotentialAdaptorHits(const int8 direction, const ui
       matchwithsorter_t tmp;
       tmp.otherid=rid2;
       tmp.eoffset=eoffsetmean;
-
+      
       if(perc>100) perc=100;
       tmp.percent_in_overlap=perc;
       tmp.numhashes=numhashes;
@@ -3806,59 +4972,76 @@ void Skim<TVHASH_T>::checkForPotentialAdaptorHits(const int8 direction, const ui
 
 
 
-template<typename TVHASH_T>
-void Skim<TVHASH_T>::prepareForMultithreadFarc(uint32 numthreads)
-{
-  FUNCSTART("void Skim<TVHASH_T>::prepareForMultithreadFarc()");
-
-  SKIM3_numthreads=numthreads;
-  farcThreadsDataInit(SKIM3_numthreads);
-}
-
-template<typename TVHASH_T>
-void Skim<TVHASH_T>::farcThreadsDataInit(const uint32 numthreads)
+void Skim::farcThreadsDataInit(const uint32 numthreads)
 {
-  FUNCSTART("void Skim<TVHASH_T>::cfhThreadsDataInit(const uint32 numthreads)");
+  FUNCSTART("void Skim::cfhThreadsDataInit(const uint32 numthreads)");
 
   SKIM3_farcd_vector.resize(numthreads);
   for(uint32 ti=0; ti<numthreads;++ti){
-
+    
     SKIM3_farcd_vector[ti].readhashmatches.clear();
     SKIM3_farcd_vector[ti].readhashmatches.reserve(2000);
     SKIM3_farcd_vector[ti].singlereadvhraparray.clear();
     SKIM3_farcd_vector[ti].singlereadvhraparray.reserve(2000);
-    SKIM3_farcd_vector[ti].unused_tagmaskvector.clear();
-    //SKIM3_farcd_vector[ti].unused_tagmaskvector.reserve(2000);
+    SKIM3_farcd_vector[ti].tagmaskvector.clear();
+    SKIM3_farcd_vector[ti].tagmaskvector.reserve(2000);
     SKIM3_farcd_vector[ti].tmpmatchwith.clear();
     SKIM3_farcd_vector[ti].tmpmatchwith.reserve(2000);
 
+    if(!SKIM3_farc_addregexes_file.empty()){
+      istringstream tmpis(SKIM3_farc_addregexes_file);
+      string line;
+      while(true){
+        getline(tmpis,line);
+        if(tmpis.eof()) break;
+        boost::to_upper(line);
+        SKIM3_farcd_vector[ti].addregexes.push_back(boost::regex(line));
+      }
+    }
   }
   FUNCEND();
 }
 
-template<typename TVHASH_T>
-void Skim<TVHASH_T>::farcThreadLoop(const uint32 threadnr)
+void Skim::farcThreadLoop(const uint32 threadnr)
 {
-  FUNCSTART("void Skim<TVHASH_T>::threadloop(const uint32 threadnr)");
+  FUNCSTART("void Skim::threadloop(const uint32 threadnr)");
 
   // threads need their own try() catch() block
 
   try {
     CEBUG("Thread: " << threadnr << " starting.\n");
 
+//    farc_threaddata_t farcd;
+//    farcd.readhashmatches.reserve(2000);
+//    farcd.singlereadvhraparray.reserve(2000);
+//    farcd.tagmaskvector.reserve(2000);
+//    farcd.tmpmatchwith.reserve(2000);
+//
+//    if(!SKIM3_farc_addregexes_file.empty()){
+//      istringstream tmpis(SKIM3_farc_addregexes_file);
+//      string line;
+//      while(true){
+//        getline(tmpis,line);
+//        if(tmpis.eof()) break;
+//        boost::to_upper(line);
+//        farcd.addregexes.push_back(boost::regex(line));
+//      }
+//    }
+//    //farcd.addregexes=SKIM3_farc_addregexes_templates;
+
+
     BUGIFTHROW(threadnr>=SKIM3_farcd_vector.size(),"threadnr>=SKIM3_farcd_vector.size()???");
     farc_threaddata_t & farcd=SKIM3_farcd_vector[threadnr];
 
     farcd.readhashmatches.clear();
     farcd.singlereadvhraparray.clear();
-    farcd.unused_tagmaskvector.clear();
+    farcd.tagmaskvector.clear();
     farcd.tmpmatchwith.clear();
 
-    readid_t dummy=0; // in this version, we do not give back the read id of the adaptor found, but need a variable to call the internal routine
 
     // we'll jump out with a break;
     while(true){
-      {
+      { 
 	boost::mutex::scoped_lock mylock(SKIM3_mutex);
 	CEBUG("Thread " << threadnr << " waiting ...\n");
 	while(!SKIM3_threadcontrol[threadnr].flag_datavalid
@@ -3868,21 +5051,21 @@ void Skim<TVHASH_T>::farcThreadLoop(const uint32 threadnr)
       }
       if(SKIM3_threadcontrol[threadnr].flag_datavalid){
 	CEBUG("Thread " << threadnr << " working on " << SKIM3_threadcontrol[threadnr].from << " to " << SKIM3_threadcontrol[threadnr].to << "\n");
-
+	
 	for(uint32 readi=SKIM3_threadcontrol[threadnr].from; readi<SKIM3_threadcontrol[threadnr].to; ++readi){
-	  if(SKIM3_farc_seqtype < 0
+	  if(SKIM3_farc_seqtype < 0 
 	     || SKIM3_farc_searchpool->getRead(readi).getSequencingType() == SKIM3_farc_seqtype){
-	    int32 clip=findAdaptorRightClip_internal(SKIM3_farc_searchpool->getRead(readi),SKIM3_farc_minhashes,dummy, farcd);
+	    int32 clip=findAdaptorRightClip_internal(SKIM3_farc_searchpool->getRead(readi),SKIM3_farc_minhashes,farcd);
 	    if(clip>=0){
 	      boost::mutex::scoped_lock lock(SKIM3_resultfileoutmutex);
 	      (*SKIM3_farc_results)[readi]=clip;
 	    }
 	  }
 	}
-
+	
 	boost::mutex::scoped_lock mylock(SKIM3_mutex);
 	SKIM3_threadcontrol[threadnr].flag_datavalid=false;
-
+	
 	SKIM3_slave2mastersignal.notify_one();
       }else if(SKIM3_threadcontrol[threadnr].flag_endthread){
 	CEBUG("Thread " << threadnr << "  exiting.\n");
@@ -3898,12 +5081,5 @@ void Skim<TVHASH_T>::farcThreadLoop(const uint32 threadnr)
   FUNCEND();
 }
 
+//#define CEBUG(bla)
 
-
-// explicit template instantiations needed for the linker to create these for library files
-template class Skim<vhash64_t>;
-#ifndef KMER_INTERNALTYPE
-template class Skim<vhash128_t>;
-template class Skim<vhash256_t>;
-template class Skim<vhash512_t>;
-#endif
diff --git a/src/mira/skim.H b/src/mira/skim.H
index 7af71a3..56435aa 100644
--- a/src/mira/skim.H
+++ b/src/mira/skim.H
@@ -7,12 +7,12 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
@@ -22,33 +22,98 @@
 #ifndef _bas_skim_h_
 #define _bas_skim_h_
 
-#include <boost/function.hpp>
 #include <boost/thread/mutex.hpp>
 #include <boost/thread/condition.hpp>
+#include <boost/regex.hpp> 
 
 #include "stdinc/defines.H"
+#include "stdinc/stlincludes.H"
 
-#include "mira/types_basic.H"
-#include "mira/hashstats.H"
+#include "util/progressindic.H"
+#include "mira/readpool.H"
+#include "ads.H"
 
-class ADSEstimator;
-class ReadPool;
-template <class T> class ProgressIndicator;
 
+//typedef unsigned long vhash_t;
+typedef uint64 vhash_t;
 
-//#define SKIM3_MAXVHASHMASK 0xFFFFFFLL
+struct vhrap_t {
+  vhash_t vhash;       // vhash,
+  uint32 readid;       // readid
+  uint16 hashpos;      // (hash)position  (lowest pos: basesperhash-1)
 
+  Read::bhashstat_t bhashstats; // baseflags for this hash
 
-#define SKIM3_MAXREADSIZEALLOWED 29900
+  //bool operator<(const vhrap_t & other) const {return vhash < other.vhash;};
+  friend ostream & operator<<(ostream &ostr, const vhrap_t & v){
+    ostr << "hash: " << hex << v.vhash
+	 << "\trid: " << dec << v.readid
+	 << "\thpos: " << v.hashpos
+	 << "\tbhs: " << v.bhashstats;
+    return ostr;
+  }
+};
 
-// 10G
-#define SKIM3_SKIMMATCHFIRSTCHECK 10737418240LL
-#define SKIM3_SKIMMATCHCHECKINCR 10737418240LL
 
+struct diskhash_t {
+  vhash_t vhash;       // vhash,
+  uint16  hashpos;     // hash position (lowest pos: 0)
+  int8    dir;         // direction
+  uint8   seqtype;     // sequencing type
 
+  //bool operator<(const vhrap_t & other) const {return vhash < other.vhash;};
+  friend ostream & operator<<(ostream &ostr, const diskhash_t & v){
+    ostr << "hash: " << hex << v.vhash
+	 << "\thpos: " << v.hashpos
+	 << "\tdir: " << dec << static_cast<int16>(v.dir)
+	 << "\tseqtype: " << static_cast<uint16>(v.seqtype);
+    return ostr;
+  }
+};
 
-typedef uint32 shash_t;
 
+// now almost same as hashstat? takes up 16 bytes anyway (like diskhash)
+struct newdiskhash_t {
+  vhash_t vhash;       // vhash,
+  uint32  count;       // how often this hash appeared
+  uint16  lowpos;      // lowest hash position (lowest pos: 0)
+  uint8   seqtype;     // sequencing type
+
+  bool    hasfwd:1;
+  bool    hasrev:1;
+  bool    hasmultipleseqtype:1;
+
+  //bool operator<(const vhrap_t & other) const {return vhash < other.vhash;};
+  friend ostream & operator<<(ostream &ostr, const newdiskhash_t & v){
+    ostr << "hash: " << hex << v.vhash
+	 << "\tcount: " << v.count
+	 << "\tlpos: " << v.lowpos
+	 << "\tseqtype: " << static_cast<uint16>(v.seqtype)
+	 << "\tfwd: " << v.hasfwd
+	 << "\trev: " << v.hasrev
+	 << "\tmseq: " << v.hasmultipleseqtype;
+    return ostr;
+  }
+};
+
+
+
+struct hashstat_t {
+  vhash_t vhash;       // vhash,
+  uint32  count;       // how often this hash appeared
+  uint16  lowpos;      // lowest hash position seen (lowest pos: 0)
+  bool    hasfwdrev:1;            // whether it's there in forward and reverse
+  bool    hasmultipleseqtype:1;   // found in multiple sequencing types?
+
+  friend ostream & operator<<(ostream &ostr, const hashstat_t & v){
+    ostr << "hash: " << hex << v.vhash
+	 << "\tcount: " << dec << v.count
+	 << "\tlowpos: " << v.lowpos
+	 << "\tfwdrev: " << v.hasfwdrev
+	 << "\tmseqtype: " << v.hasmultipleseqtype;
+    return ostr;
+  }
+};
 
 struct matchwithsorter_t{
   uint32 otherid;
@@ -59,7 +124,7 @@ struct matchwithsorter_t{
   uint32 estimscore;
 
   bool   taken;
-
+  
   bool ol_stronggood:1;  // frequency: 2*bph-1 pos at 3, thereof bph-1 contiguous
   bool ol_weakgood:1;   // frequency: bph-1 positions contiguous at 3
   bool ol_belowavgfreq:1;   // frequency: bph-1 positions contiguous at <=3
@@ -72,7 +137,7 @@ struct matchwithsorter_t{
 			     100% match, no rept, len difference >=8
 			  */
 
-  friend std::ostream & operator<<(std::ostream &ostr, const matchwithsorter_t & m){
+  friend ostream & operator<<(ostream &ostr, const matchwithsorter_t & m){
     ostr << "MWS:\t" << m.otherid
 	 << '\t' << m.eoffset
 	 << '\t' << m.percent_in_overlap
@@ -99,45 +164,28 @@ struct skimhitforsave_t{
   int32  eoffset;
   int32  percent_in_overlap;
   uint32 numhashes;
-
+  
   bool ol_stronggood:1;  // frequency: 2*bph-1 pos at 3, thereof bph-1 contiguous
   bool ol_weakgood:1;   // frequency: bph-1 positions contiguous at 3
   bool ol_belowavgfreq:1;   // frequency: bph-1 positions contiguous at <=3
   bool ol_norept:1;      // nothing >3 (but can contain 1 (single hashes == errors)
   bool ol_rept:1;      // bph-1 positions >=5 frequency
 
-  // the following is used only by PacBio correction atm, should expand this
-private:
-  bool rid1dir:1;
-  bool rid2dir:1;
-
-public:
-  inline int8 getRID1Dir() const { return (rid1dir ? 1 : -1);}
-  inline int8 getRID2Dir() const { return (rid2dir ? 1 : -1);}
-  inline void setRID1Dir(int8 d) { rid1dir=d>0;}
-  inline void setRID2Dir(int8 d) { rid2dir=d>0;}
-
-  friend std::ostream & operator<<(std::ostream &ostr, const skimhitforsave_t & e){
+  friend ostream & operator<<(ostream &ostr, const skimhitforsave_t & e){
     ostr << "SHFS:\t" << e.rid1
 	 << '\t' << e.rid2
-	 << '\t' << e.rid1dir
-	 << '\t' << e.rid2dir
-	 << "\teo " << e.eoffset
-	 << "\t% " << e.percent_in_overlap
-	 << "\tnh " << e.numhashes
+	 << '\t' << e.eoffset
+	 << '\t' << e.percent_in_overlap
+	 << '\t' << e.numhashes
 	 << "\tsg " << e.ol_stronggood
 	 << "\twg " << e.ol_weakgood
 	 << "\tbaf " << e.ol_belowavgfreq
-	 << "\tnrp " << e.ol_norept
-	 << "\trp " << e.ol_rept
-	 << "\tr1d " << static_cast<int16>(e.getRID1Dir())
-	 << "\tr2d " << static_cast<int16>(e.getRID2Dir())
+	 << "\trp" << e.ol_norept
+	 << "\tnrp" << e.ol_rept
 	 << '\n';
     return ostr;
   }
 
-
-  static bool stdSortCmp(const skimhitforsave_t & a, const skimhitforsave_t & b);
 };
 
 
@@ -155,7 +203,7 @@ struct readhashmatch_t{
   uint16 hashpos2;
   Read::bhashstat_t bhashstats; // baseflags for this hash
 
-  friend std::ostream & operator<<(std::ostream &ostr, const readhashmatch_t & rhm){
+  friend ostream & operator<<(ostream &ostr, const readhashmatch_t & rhm){
     ostr << "rid2: " << rhm.rid2
 	 << "\teoffset: " << rhm.eoffset
 	 << "\thp1: " << rhm.hashpos1
@@ -167,30 +215,28 @@ struct readhashmatch_t{
 
 };
 
-typedef std::multimap< int32, matchwith_t> possible_overlaps_t;
+typedef multimap< int32, matchwith_t> possible_overlaps_t;
 typedef possible_overlaps_t::value_type posoverlap_pair_t;
 
 
 // bop_t is organised as follows:
 //  each ban of a pair of reads is stored in the vector of the read with the lower ID
-// bop_t was initially std::vector<set<uint32> >, but these beasts are extremely expensive,
+// bop_t was initially vector<set<uint32> >, but these beasts are extremely expensive,
 //  both in time and in memory (48 per set + 48 per element in set!)
 // using a vector is way quicker (around 3 times), uses way less memory (24 + 4 per element)
 //  and the growth strategy ensures that not too much memory is wasted (has a small hit on
 //  run-time efficiency though as we might need to copy quite a couple of times)
 
 struct bannedoverlappairs_t {
-  typedef std::vector<std::vector<uint32> > bop_t;
+  typedef vector<vector<uint32> > bop_t;
   bop_t          bop;
 
   inline void nuke() {nukeSTLContainer(bop);};
   inline size_t size() {return bop.size();};
   inline void resize(size_t sz) {bop.resize(sz);};
-  void insertBan(uint32 id1, uint32 id2) {
-    FUNCSTART("void insertBan(uint32 id1, uint32 id2)");
-    if(id1>id2) std::swap(id1,id2);
-    BUGIFTHROW(id1>=bop.size(),"id1 " << id1 << " >= bop.size() " << bop.size())
-    std::vector<uint32>::iterator iI=upper_bound(bop[id1].begin(),bop[id1].end(),id2);
+  inline void insertBan(uint32 id1, uint32 id2) {
+    if(id1>id2) swap(id1,id2);
+    vector<uint32>::iterator iI=upper_bound(bop[id1].begin(),bop[id1].end(),id2);
     if(iI==bop[id1].end() || iI==bop[id1].begin() || (iI != bop[id1].begin() && (*(iI-1) != id2))){
       // must insert
       // moderate growth strategy if needed ... most reads will not have thousands of bans
@@ -208,9 +254,7 @@ struct bannedoverlappairs_t {
     }
   }
   inline bool checkIfBanned(uint32 id1, uint32 id2) {
-    FUNCSTART("inline bool checkIfBanned(uint32 id1, uint32 id2)");
-    if(id1>id2) std::swap(id1,id2);
-    BUGIFTHROW(id1>=bop.size(),"id1 " << id1 << " >= bop.size() " << bop.size())
+    if(id1>id2) swap(id1,id2);
     return binary_search(bop[id1].begin(),bop[id1].end(),id2);
   }
   void getNumBans(size_t & banned, size_t & numsets) {
@@ -225,199 +269,59 @@ struct bannedoverlappairs_t {
   }
 };
 
-typedef std::map< uint32, uint32> simplematches_t;
+typedef map< uint32, uint32> simplematches_t;
 typedef simplematches_t::value_type simplematch_pair_t;
 
-template<typename TVHASH_T>
 class Skim
 {
-  static const TVHASH_T SKIM3_MAXVHASHMASK;
-
-  /****************************************************************************
-   *
-   * FARC
-   *
-   ****************************************************************************/
-private:
-  // each findAdaptorRightClip thread needs a couple of data structures ...
-  struct farc_threaddata_t {
-    std::vector<readhashmatch_t> readhashmatches;
-    std::vector<typename HashStatistics<TVHASH_T>::vhrap_t> singlereadvhraparray;
-    std::vector<uint8> unused_tagmaskvector;
-    std::vector<matchwithsorter_t> tmpmatchwith;
-  };
-
-  farc_threaddata_t  SKIM3_farcdata_fornonmultithread;
-  ReadPool         * SKIM3_farc_searchpool;
-  std::vector<int32>    * SKIM3_farc_results;
-  uint32             SKIM3_farc_minhashes;
-  uint8              SKIM3_farc_seqtype;
-  std::vector<farc_threaddata_t> SKIM3_farcd_vector;
-
-  // functions
-  void farcThreadsDataInit(const uint32 threadnr);
-  void farcThreadLoop(const uint32 threadnr);
-  void checkForPotentialAdaptorHits(const int8 direction,
-				    const uint32 actreadid,
-				    Read & actread,
-				    std::vector<matchwithsorter_t> & tmpmatchwith,
-				    std::vector<readhashmatch_t> & readhashmatches);
-
-  int32 findAdaptorRightClip_internal(Read & actread, uint32 minhashes, readid_t & ridofadapfound, farc_threaddata_t & farcd);
-
-public:
-  // These two calls need no preparation by the caller
-  //int32 findAdaptorRightClip(Read & actread, uint32 minhashes);    // call for simple, non-multithreaded check of single read
-  void findAdaptorRightClip(ReadPool & searchpool,
-			    std::vector<int32> & results,
-			    int8 seqtype,
-			    uint32 minhashes,
-			    uint32 numthreads); // call for multithreaded check of whole read pool
-
-  // These calls for non-multithreaded and multi-threaded usage, caller decides everything
-  void  prepareForMultithreadFarc(uint32 numthreads);
-  int32 findAdaptorRightClip(Read & actread,
-			     uint32 minhashes,
-			     readid_t & ridofadapfound,
-			     int32 threadid);  // call for multithreaded check of single read, caller decides in which thread structure ID it runs
-                                               // threadid==-1 means: non-multithreaded version (same as above), needs no prepareForMultithreadFarc
-
-
-
-
-  /****************************************************************************
-   *
-   * low BPH skim
-   *
-   ****************************************************************************/
-private:
-
-  struct srhashhits_t {
-    uint32 numhashes;
-    uint32 rid;
-
-    // yeah, well, I know: this is ... errmmm ... well
-    // but that function is really only needed for a high/low sort
-    inline bool operator<(const srhashhits_t & other) const {
-      return numhashes>other.numhashes;
-    }
-  };
-
-  struct shashpos_t {
-    shash_t shash;
-    int32   hashpos;
-  };
-
-  struct lbphs_threaddata_t {
-    std::vector<shash_t>  hashvec;
-    std::vector<uint32>   hashhitperread;
-
-    std::vector<srhashhits_t> hashhitsofoneread;
-
-    std::vector<std::vector<int32> > r1posperhash;
-    std::vector<shash_t>        r1pphlist;
-    std::vector<shashpos_t> r2shashpos;
-
-    std::vector<uint32>  r1r2poshistogram;
-    std::vector<uint32>  r1r2phused;
-    std::vector<uint32>  r1r2idstaken;
-
-    std::vector<skimhitforsave_t> shfsvf;
-    std::vector<skimhitforsave_t> shfsvr;
-  };
-
-  std::vector<lbphs_threaddata_t> SKIM3_lbphsd_vector;
-
-  // 2ndtry
-  std::vector<std::vector<uint32> >  SKIM3_lbphs_idsperhash;
-  std::vector<uint32>           SKIM3_lbphs_numoverlapsperid;
-  std::vector<uint32>           SKIM3_lbphs_maxoverlaphashesperid;
-
-  uint64 totalphits;
-
-  static shash_t SKIM3_lbphs_hashadd[128];
-
-
-  // functions
-  void lowBPHSkim();
-  void lbphsThreadsDataInit(const uint32 numthreads);
-  void lbphsThreadLoop(const uint32 threadnr);
-  void lbphsLookAtRead(const uint32 actreadi, const uint32 threadnr, const int8 direction);
-
-  void lbphsPrepareHashOverviewTable(uint32 & readi);
-  bool lbphsPrepareOneSeqForHOT(const uint32 readi);
-  void lbphsGetHashesOfOneSeq(const uint32 readi,
-			      std::vector<shash_t> & hashvec,
-			      const uint32 basesperhash,
-			      const char * seq,
-			      const uint32 slen
-    );
-
-  void lbphsSecondLineCheck(const uint32 actreadid, lbphs_threaddata_t & lbphsd, int8 direction);
-  void lbphsSeqToPosOverviewTable(std::vector<std::vector<int32> > & posperhash,
-				  std::vector<shash_t> & r1pphlist,
-				  const uint32 basesperhash,
-				  const char * seq,
-				  const uint32 slen);
-  void lbphsGetHashPosOfOneSeq(const uint32 readi,
-			       std::vector<shashpos_t> & hashposvec,
-			       const uint32 basesperhash,
-			       const char * seq,
-			       const uint32 slen);
-
-
-
-  /****************************************************************************
-   *
-   * Core Skim
-   *
-   ****************************************************************************/
 private:
   bool SKIM3_logflag_purgeunnecessaryhits;
   bool SKIM3_logflag_save2;
 
   ReadPool * SKIM3_readpool;
 
-  typename std::vector<typename HashStatistics<TVHASH_T>::vhrap_t> SKIM3_vhraparray;
-  typename std::vector<typename std::vector<typename HashStatistics<TVHASH_T>::vhrap_t>::const_iterator > SKIM3_vashortcuts_begin;
-  typename std::vector<typename std::vector<typename HashStatistics<TVHASH_T>::vhrap_t>::const_iterator > SKIM3_vashortcuts_end;
+  vector<vhrap_t> SKIM3_vhraparray;
+  vector<vector<vhrap_t>::const_iterator > SKIM3_vashortcuts_begin;
+  vector<vector<vhrap_t>::const_iterator > SKIM3_vashortcuts_end;
+
+  // the "NULL" replacement for the shortcut arrays above
+  vector<vhrap_t>::const_iterator SKIM3_completevhraparray_end;
 
-  // the "nullptr" replacement for the shortcut arrays above
-  typename std::vector<typename HashStatistics<TVHASH_T>::vhrap_t>::const_iterator SKIM3_completevhraparray_end;
+  vector<uint8> SKIM3_megahubs;
 
-  // TODO: eventuall compress this into uint8 having 8 boolean
-  std::vector<uint8> SKIM3_hasMNRr;
-  std::vector<uint8> SKIM3_hasSRMr;
-  std::vector<uint8> SKIM3_hasFpas;
+  // TODO: eventuall compress this with megahubs into uint8 having 8 boolean 
+  vector<uint8> SKIM3_hasMNRr;
+  vector<uint8> SKIM3_hasSRMr;
+  vector<uint8> SKIM3_hasFpAS;
 
   // counts how many times a read has excellent hits with other reads
-  std::vector<uint32> * SKIM3_overlapcounter;
+  vector<uint32> * SKIM3_overlapcounter;
 
   // count how many times a read was saved as fully encased
-  std::vector<uint8> SKIM3_fullencasedcounter;
+  vector<uint8> SKIM3_fullencasedcounter;
 
-  std::vector<uint32> * SKIM3_writtenhitsperid;
-  std::vector<uint8> * SKIM3_megahubsptr;
+  vector<uint32> * SKIM3_writtenhitsperid;
 
   bannedoverlappairs_t * SKIM3_bannedoverlaps;
-
-  std::ofstream SKIM3_posfmatchfout;
-  std::ofstream SKIM3_poscmatchfout;
-  std::string SKIM3_posfmatchfname;
-  std::string SKIM3_poscmatchfname;
+  
+  ofstream SKIM3_posfmatchfout;
+  ofstream SKIM3_poscmatchfout;
+  string SKIM3_posfmatchfname;
+  string SKIM3_poscmatchfname;
   uint64 SKIM3_posfmatchnextchecksize;
   uint64 SKIM3_poscmatchnextchecksize;
 
-  uint32 SKIM3_megahubcap;
+  uint32 SKIM3_possiblehits;
+  uint32 SKIM3_acceptedhits;
 
   uint32 SKIM3_numthreads;
-  uint32 SKIM3_basesperhash;
+  uint8  SKIM3_basesperhash;
   uint8  SKIM3_hashsavestepping;
 
   //int32  SKIM3_percentrequired;
 
-  std::vector<int32>  SKIM3_percentrequired;
-  std::vector<int32>  SKIM3_overlaplenrequired; // min len per sequencing type
+  vector<int32>  SKIM3_percentrequired;
+  vector<int32>  SKIM3_overlaplenrequired; // min len per sequencing type
 
   // if vector.size() != 0
   // skimGo() also hunts chimeras
@@ -425,29 +329,23 @@ private:
   // inner vectors size of length of clipped sequences
   //  0 initially, set to 1 for consecutive hash matches
   //  chimeras show up as a 0 stretch within the 1s
-  std::vector<std::vector<uint8> > SKIM3_chimerahunt;
-  std::vector<int32> * SKIM3_chuntleftcut;
-  std::vector<int32> * SKIM3_chuntrightcut;
+  vector<vector<uint8> > SKIM3_chimerahunt;
+  vector<int32> * SKIM3_chuntleftcut;
+  vector<int32> * SKIM3_chuntrightcut;
 
   // overlap criterion levels for left and right extend
   // used to take overlaps only if they reach a given level
-  // [0] is for norept overlaps, [1] for rept
-  std::vector<std::vector<uint8>> * SKIM3_overlapcritlevelvl;
-  std::vector<std::vector<uint8>> * SKIM3_overlapcritlevelvr;
+  vector<uint8> * SKIM3_overlapcritlevell;
+  vector<uint8> * SKIM3_overlapcritlevelr;
 
-  std::vector<uint32> SKIM3_largestencasementscoretodate;
+  vector<uint32> SKIM3_largestencasementscoretodate;
 
-  // for ultra-deeply connected reads: enough is enough
-  // set to 1 for a read which whould not be looked at anymore
-  //  by skim because it already has too many hits with
-  //  overlap criterion 0 left/righ on disk
-  // (currently only set for Solexa reads)
-  std::vector<uint8>  SKIM3_nomorehitseie;
 
   uint32 SKIM3_maxhitsperread;
-  bool SKIM3_forcetakestronggood;
+
 
   uint64 SKIM3_totalhitschosen;
+  uint64 SKIM3_totalpermbans;
 
 
   uint32 SKIM_partfirstreadid;
@@ -456,27 +354,68 @@ private:
   ProgressIndicator<int64> * SKIM_progressindicator;
   int64 SKIM_progressend;
 
+
   bool SKIM3_onlyagainstrails;
 
+  double SKIM3_freqest_minnormal;
+  double SKIM3_freqest_maxnormal;
+  double SKIM3_freqest_repeat;
+  double SKIM3_freqest_heavyrepeat;
+  double SKIM3_freqest_crazyrepeat;
+  uint32 SKIM3_nastyrepeatratio;
+
+
+  // for provideHashStatistics()
+  vector<hashstat_t> SKIM3_hs_hashstats;
+  vector<vector<hashstat_t>::const_iterator > SKIM3_hs_hsshortcuts_begin;
+  vector<vector<hashstat_t>::const_iterator > SKIM3_hs_hsshortcuts_end;
+  uint8 SKIM3_hs_basesperhash;
+
+  vector<vhrap_t> SKIM3_baiting_singlereadvhraparray;
+  vector<uint8>   SKIM3_baiting_tagmaskvector;
+
+  // each findAdaptorRightClip thread needs a couple of data structures ...
+  struct farc_threaddata_t {
+    vector<readhashmatch_t> readhashmatches;
+    vector<vhrap_t> singlereadvhraparray;
+    vector<uint8> tagmaskvector;
+    vector<matchwithsorter_t> tmpmatchwith;
+    list<boost::regex> addregexes;
+    boost::match_results<std::string::const_iterator> rematches;
+  };
+
+  farc_threaddata_t  SKIM3_farcdata_fornonmultithread;
+  ReadPool         * SKIM3_farc_searchpool;
+  vector<int32>    * SKIM3_farc_results;
+  uint32             SKIM3_farc_minhashes;
+  uint8              SKIM3_farc_seqtype;
+//  list<boost::regex> SKIM3_farc_addregexes_templates;
+  string             SKIM3_farc_addregexes_file;
+
+  vector<farc_threaddata_t> SKIM3_farcd_vector;
+
+//  vector<readhashmatch_t> SKIM3_streamskim_readhashmatches;
+//  vector<matchwithsorter_t> SKIM3_streamskim_tmpmatchwith;
+
   // each checkForHashes thread needs a couple of data structures ...
   struct cfh_threaddata_t {
-    std::vector<readhashmatch_t> readhashmatches;
-    std::vector<uint32> smallhist4repeats;
-    std::vector<typename HashStatistics<TVHASH_T>::vhrap_t> singlereadvhraparray;
-    std::vector<matchwithsorter_t> tmpmatchwith;
-    std::vector<uint8> tagmaskvector;
-    std::vector<skimhitforsave_t> shfsv;
-    std::ofstream * posmatchfout;
+    vector<readhashmatch_t> readhashmatches;
+    vector<uint32> smallhist4repeats;
+    vector<vhrap_t> singlereadvhraparray;
+    vector<matchwithsorter_t> tmpmatchwith;
+    vector<uint8> tagmaskvector;
+    vector<skimhitforsave_t> shfsv;
+    ofstream * posmatchfout;
     // this vector is used to collect read ids which have a match
     //  and then quickly update SKIM3_writtenhitsperid inside a mutex
-    std::vector<uint32> ridswithmatches;
-    std::vector<std::vector<uint32>> uidswithnewcritlevelvl;  // 0 for norept, 1 for rept overlaps
-    std::vector<std::vector<uint32>> uidswithnewcritlevelvr;
-    std::vector<std::vector<uint8>> critlevellofnewuidsv;
-    std::vector<std::vector<uint8>> critlevelrofnewuidsv;
+    vector<uint32> ridswithmatches;
+    vector<uint32> uidswithnewcritlevell;
+    vector<uint32> uidswithnewcritlevelr;
+    vector<uint8> critlevellofnewuids;
+    vector<uint8> critlevelrofnewuids;
   };
 
-  std::vector<cfh_threaddata_t> SKIM3_cfhd_vector;
+  vector<cfh_threaddata_t> SKIM3_cfhd_vector;
 
 
   struct threadworkercontrol_t {
@@ -487,15 +426,18 @@ private:
     bool   flag_endthread;
   };
 
-  std::vector<threadworkercontrol_t> SKIM3_threadcontrol;
+  vector<threadworkercontrol_t> SKIM3_threadcontrol;
 
   boost::mutex SKIM3_coutmutex;
   boost::mutex SKIM3_resultfileoutmutex;
   boost::mutex SKIM3_globalclassdatamutex;
-  //boost::mutex SKIM3_whpid_mutex;
+  boost::mutex SKIM3_whpid_mutex;
 
   boost::mutex SKIM3_critlevelwrite_mutex;
 
+
+  //uint32 SKIM3_whpid_counter;
+
   boost::mutex SKIM3_mutex;
   boost::condition SKIM3_master2slavesignal;
   boost::condition SKIM3_slave2mastersignal;
@@ -508,20 +450,34 @@ private:
   void foolCompiler();
 
 //  void prepareSkim(bool alsocheckreverse);
-  void prepareSkim(uint32 fromid, uint32 toid, std::vector<typename HashStatistics<TVHASH_T>::vhrap_t> & vhraparray, bool assemblychecks);
+  void prepareSkim(uint32 fromid, uint32 toid, vector<vhrap_t> & vhraparray, bool assemblychecks);
   void purgeMatchFileIfNeeded(int8 direction);
-  void findPerfectRailMatchesInSkimFile(std::string & filename, const int8 rid2dir, std::vector<uint8> & prmatches);
-  void purgeUnnecessaryHitsFromSkimFile(std::string & filename, const int8 rid2dir, std::vector<uint8> & prmatches);
+  void purgeUnnecessaryHitsFromSkimFile(string & filename, const int8 rid2dir);
 
-  void fillTagMaskVector(const uint32 readid, std::vector<uint8> & tagmaskvector);
+  uint32 transformSeqToVariableHash(
+    const uint32 readid, 
+    const Read & actread,
+    const char * seq, 
+    uint32 slen,
+    const uint8 basesperhash,
+    vector<vhrap_t>::iterator & vhraparrayI,
+    const bool countonly,
+    const uint8 hashsavestepping,
+    vector<uint8> & maskvector,
+    const vector<Read::bposhashstat_t> & bposhashstats, 
+    int32 bfpos, 
+    const int32 bfposinc
+    );
+  
+  void fillTagMaskVector(const uint32 readid, vector<uint8> & tagmaskvector);
   void fillTagStatusInfoOfReads();
 
-  void reverseTagMaskVector(std::vector<uint8> & tagmaskvector);
+  void reverseTagMaskVector(vector<uint8> & tagmaskvector);
 
 
-  void startMultiThreading(const int8 direction,
-			   const uint32 numthreads,
-			   const uint32 readsperthread,
+  void startMultiThreading(const int8 direction, 
+			   const uint32 numthreads, 
+			   const uint32 readsperthread, 
 			   const uint32 firstid,
 			   const uint32 lastid,
 			   boost::function<void(uint32_t)> initfunc,
@@ -533,11 +489,19 @@ private:
 			     const uint32 toid,
 			     cfh_threaddata_t & cfhd);
   void checkForPotentialHits(const int8 direction,
-			     const uint32 actreadid,
-			     std::vector<matchwithsorter_t> & tmpmatchwith,
-			     std::vector<readhashmatch_t> & readhashmatches,
-			     std::vector<uint32> & smallhist4repeats);
+			     const uint32 actreadid, 
+			     vector<matchwithsorter_t> & tmpmatchwith,
+			     vector<readhashmatch_t> & readhashmatches,
+			     vector<uint32> & smallhist4repeats);
 
+  void farcThreadsDataInit(const uint32 threadnr);
+  void farcThreadLoop(const uint32 threadnr);
+  void checkForPotentialAdaptorHits(const int8 direction,
+				    const uint32 actreadid,
+				    Read & actread,
+				    vector<matchwithsorter_t> & tmpmatchwith,
+				    vector<readhashmatch_t> & readhashmatches);
+  
   void selectPotentialHitsForSave2(const int8 direction,
 				   const uint32 actreadid,
 				   cfh_threaddata_t & cfhd);
@@ -546,146 +510,163 @@ private:
 			     cfh_threaddata_t & cfhd);
 
   void chimeraHuntStoreOverlapCoverage(
-    const int8 direction,
-    const uint32 actreadid,
-    const uint32 rid2,
+    const int8 direction, 
+    const uint32 actreadid, 
+    const uint32 rid2, 
     uint16 hp1min,
     uint16 hp1max,
     uint16 hp2min,
     uint16 hp2max);
   void chimeraHuntLocateChimeras();
 
-  void makeVHRAPArrayShortcuts(std::vector<typename HashStatistics<TVHASH_T>::vhrap_t> & vhraparray,
-			       const uint32 basesperhash);
-
-
-/*************************************************************************
- *
- * sorters VHRAPArray
- *
- *************************************************************************/
-
-  // standard sort: from low to high, but lower 24bit grouped
-  inline static bool sortVHRAPArrayElem_(const typename HashStatistics<TVHASH_T>::vhrap_t & a, const typename HashStatistics<TVHASH_T>::vhrap_t & b) {
-    if((a.vhash & SKIM3_MAXVHASHMASK) != (b.vhash & SKIM3_MAXVHASHMASK)) {
-      return (a.vhash & SKIM3_MAXVHASHMASK) < (b.vhash & SKIM3_MAXVHASHMASK);
-    }
-    return a.vhash < b.vhash;
-  }
-
-  // sorter to sort from low to high
-
-  inline static bool compareVHRAPArrayElem_(const typename HashStatistics<TVHASH_T>::vhrap_t & one, const typename HashStatistics<TVHASH_T>::vhrap_t & other)
-    {
-      return one.vhash < other.vhash;
-    };
-
-
-/*************************************************************************
- *
- * sorters readhashmatches_t
- *
- *************************************************************************/
-
-  // low to high
-  inline static bool sortreadhashmatch_t_(const readhashmatch_t & a, const readhashmatch_t & b)
-    {
-      if(a.rid2 == b.rid2){
-	if(a.eoffset == b.eoffset) return a.hashpos1 < b.hashpos1;
-	return a.eoffset < b.eoffset;
-      }
-      return a.rid2 < b.rid2;
-    }
-
-/*************************************************************************
- *
- * sorters matchwithsorter_t
- *
- *************************************************************************/
-
-  // high to low
-  inline static bool sortMWByPercent_(const matchwithsorter_t & a, const matchwithsorter_t & b)
-    {
-      if(a.percent_in_overlap == b.percent_in_overlap) {
-	return a.numhashes > b.numhashes;
-      }
-      return a.percent_in_overlap > b.percent_in_overlap;
-    }
-
-  // high to low
-  inline static bool sortMWByEstimScore_(const matchwithsorter_t & a, const matchwithsorter_t & b)
-    {
-      if(a.estimscore == b.estimscore) {
-	return a.percent_in_overlap > b.percent_in_overlap;
-      }
-      return a.estimscore > b.estimscore;
-    }
-
-  // high to low
-  bool sortMWByNumHashes_(const matchwithsorter_t & a, const matchwithsorter_t & b)
-    {
-      if(a.numhashes == b.numhashes){
-	return a.percent_in_overlap > b.percent_in_overlap;
-      }
-      return a.numhashes > b.numhashes;
-    }
-
-
-
+  void makeVHRAPArrayShortcuts(vector<vhrap_t> & vhraparray,
+			       const uint8 basesperhash);
 
 //////////////////////////////////
 
   void init();
-
-  uint32 computePartition(uint32 maxmemusage,
+  
+  uint32 computePartition(uint32 maxmemusage, 
 			  bool computenumpartitions);
 
-  void sFR_makeHashCounts(std::vector<uint32> & hashcounter, uint32 basesperhash);
+  void sFR_makeHashCounts(vector<uint32> & hashcounter, uint32 basesperhash);
 
 ////////////////////////////////////////
 
+  void hashes2disk(vector<string> & hashfilenames,
+		   vector<size_t> & elementsperfile,
+		   ReadPool & rp, 
+		   bool checkusedinassembly,
+		   bool onlyagainstrails,
+		   bool fwdandrev,
+		   uint8  basesperhash,
+		   uint8  hashsavestepping,
+		   const string & directory);
+  size_t createHashStatisticsFile(string & hashstatfilename, 
+				  vector<string> & hashfilenames, 
+				  vector<size_t> & elementsperfile, 
+				  uint8 basesperhash,
+				  uint32 fwdrevmin,
+				  ReadPool & rp, 
+				  bool onlyagainstrails, 
+				  bool alsosavesinglehashes, 
+				  const string & directory);
+  size_t loadHashStatisticsFile(string & hashstatfilename, 
+				vector<hashstat_t> & hashstats);
+
+  size_t prepareHashStatistics(const string & directory, 
+			       ReadPool & rp, bool checkusedinassembly, bool onlyagainstrails, bool alsosavesinglehashes,
+			       bool fwdandrev,
+			       uint32 fwdrevmin,
+			       uint8  basesperhash,
+			       uint8  hashsavestepping,
+			       string & hashstatfilename,
+			       vector<hashstat_t> & hashstats,
+			       vector<vector<hashstat_t>::const_iterator> & hsshortcuts_begin,
+			       vector<vector<hashstat_t>::const_iterator> & hsshortcuts_end);
+
+  size_t calcMidHashStatIndex(const vector<hashstat_t> & hashstats,
+			      size_t dontcarepercent);
+
+  void dumpHashStatisticsInfo(size_t avgcov,
+			      vector<hashstat_t> & hashstats);
+
+  void makeHashStatArrayShortcuts(
+    vector<hashstat_t> & hashstats,
+    const uint8 basesperhash, 
+    vector<vector<hashstat_t>::const_iterator > & hsshortcuts_begin,
+    vector<vector<hashstat_t>::const_iterator > & hsshortcuts_end);
+  
+  void assignReadBaseStatistics(
+    ReadPool & rp, 
+    size_t avgcov,
+    vector<hashstat_t> & hashstats, 
+    const uint8 basesperhash, 
+    vector<vector<hashstat_t>::const_iterator > & hsshortcuts_begin,
+    vector<vector<hashstat_t>::const_iterator > & hsshortcuts_end,
+    bool masknastyrepeats);
+
   void correctReadBaseStatisticsByRMB(ReadPool & rp,
-				      const uint32 basesperhash);
+				      const uint8 basesperhash);
+
+  int32 findAdaptorRightClip_internal(Read & actread, uint32 minhashes, farc_threaddata_t & farcd);
 
 
 public:
   Skim();
+  Skim(Skim const &other);
   ~Skim();
 
-  Skim(Skim const &other) = delete;
-  Skim const & operator=(Skim const & other) = delete;
+  Skim const & operator=(Skim const & other);
+  friend ostream & operator<<(ostream &ostr, Skim const &theskim);
 
   void discard();
 
 
-  uint32 skimGo (ReadPool & rp,
-		 std::string               & posfmatchname,
-		 std::string               & poscmatchname,
-		 bannedoverlappairs_t & bannedoverlaps,
-		 std::vector<uint32>       & overlapcounter,
-		 std::vector<uint32>       & writtenhitsperid,
-		 std::vector<int32>        & chuntleftcut,
-		 std::vector<int32>        & chuntrightcut,
-		 std::vector<std::vector<uint8>>        & overlapcritlevell,
-		 std::vector<std::vector<uint8>>        & overlapcritlevelr,
-		 std::vector<uint8>        * meghubs,
+  void setHashFrequencyRatios(double freqest_minnormal,
+			      double freqest_maxnormal,
+			      double freqest_repeat,
+			      double freqest_heavyrepeat,
+			      double freqest_crazyrepeat,
+			      uint32 nastyrepeatratio);
 
+  uint32 skimGo (ReadPool & rp, 
+		 string               & posfmatchname,
+		 string               & poscmatchname,
+		 string               & megahublogname,
+		 bannedoverlappairs_t & bannedoverlaps,
+		 vector<uint32>       & overlapcounter,
+		 vector<uint32>       & writtenhitsperid,
+		 vector<int32>        & chuntleftcut,
+		 vector<int32>        & chuntrightcut,
+		 vector<uint8>        & overlapcritlevell,
+		 vector<uint8>        & overlapcritlevelr,
+		 
 		 uint32 numthreads,           //2
 		 uint32 maxmemusage,          //  = 15000000
-
+		 
 		 bool onlyagainstrails,       // =false
 		 bool alsocheckreverse,       // =true
-
-		 uint32 basesperhash,         // = 16
+		 
+		 uint8  basesperhash,         // = 16
 		 uint8  hashsavestepping,     // = 4
-		 const std::vector<int32> & percentrequired,   // = 30 for each st
-		 const std::vector<int32> & overlaplenrequired,   // = 30 for each st
-		 uint32 maxhitsperread,
-		 uint32 megahubcap,
-		 bool forcetakestronggood);      // = 200
-
-  void skimStreamPrepare(ReadPool & rp, uint32 basesperhash, uint8  hss, const char * additionalregexp=nullptr);
-
+		 //int32  percentrequired,      // = 50
+		 const vector<int32> & percentrequired,   // = 30 for each st
+		 const vector<int32> & overlaplenrequired,   // = 30 for each st
+		 uint32 maxhitsperread);      // = 200
+
+  void skimStreamPrepare(ReadPool & rp, uint8  bph, uint8  hss, const char * additionalregexp=NULL);
+  int32 findAdaptorRightClip(Read & actread, uint32 minhashes);
+  void findAdaptorRightClip(ReadPool & searchpool, vector<int32> & results, int8 seqtype, uint32 minhashes, uint32 numthreads);
+
+
+  uint32 maskNastyRepeats(ReadPool & rp, 
+			  uint32 repeatthreshold,
+			  ostream * logostr = NULL);
+
+  void analyseHashes(const string & directory,
+		     ReadPool & rp, 
+		     bool checkusedinassembly,
+		     bool onlyagainstrails,
+		     bool alsosavesinglehashes,
+		     bool fwdandrev,
+		     uint32 fwdrevmin,
+		     uint8  basesperhash,
+		     uint8  hashsavestepping,
+		     bool masknastyrepeats);
+
+  void provideHashStatistics(const string & directory,
+			     ReadPool & rp, 
+			     bool checkusedinassembly,
+			     bool onlyagainstrails,
+			     bool alsosavesinglehashes,
+			     bool fwdandrev,
+			     uint32 fwdrevmin,
+			     uint8  basesperhash,
+			     uint8  hashsavestepping);
+  void showHashStatisticsInfo(string & filename);
+
+  uint32 checkBaitHit(Read & actread);
 
   static void getOverlapCriterionLevel(const uint32 actreadid,
 				       const uint8 seqtype,
@@ -694,21 +675,6 @@ public:
 				       uint8 & levell,
 				       uint8 & levelr);
 
-  static uint32 transformSeqToVariableHash(
-    const uint32 readid,
-    const Read & actread,
-    const char * seq,
-    uint32 slen,
-    const uint32 basesperhash,
-    typename std::vector<typename HashStatistics<TVHASH_T>::vhrap_t>::iterator & vhraparrayI,
-    const bool countonly,
-    const uint8 hashsavestepping,
-    std::vector<uint8> & maskvector,
-    const std::vector<Read::bposhashstat_t> & bposhashstats,
-    int32 bfpos,
-    const int32 bfposinc
-    );
-
   void setExtendedLog(bool f) {
     SKIM3_logflag_purgeunnecessaryhits=f;
     SKIM3_logflag_save2=f;
@@ -718,3 +684,4 @@ public:
 
 
 #endif
+
diff --git a/src/mira/skim_lowbph.C b/src/mira/skim_lowbph.C
deleted file mode 100644
index 5006e56..0000000
--- a/src/mira/skim_lowbph.C
+++ /dev/null
@@ -1,621 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- * Copyright (C) 2011 and later by Bastien Chevreux
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- *
- */
-
-#include "skim.H"
-
-#include <boost/thread/thread.hpp>
-#include <boost/bind.hpp>
-
-#include "errorhandling/errorhandling.H"
-
-#include "util/dptools.H"
-
-
-using namespace std;
-
-
-//#define CEBUGFLAG
-
-#ifdef CEBUGFLAG
-#define CEBUG(bla)   {cout << bla; cout.flush();}
-#define CEBUGF(bla)  {cout << bla; cout.flush();}
-#else
-#define CEBUG(bla)
-#define CEBUGF(bla)
-#endif
-
-
-// TODO get 2nd line checks done and saved
-
-
-template<class TVHASH_T>
-shash_t Skim<TVHASH_T>::SKIM3_lbphs_hashadd[128];
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-template<class TVHASH_T>
-void Skim<TVHASH_T>::lowBPHSkim()
-{
-  FUNCSTART("void Skim<TVHASH_T>::lowBPHSkim()");
-
-//  SKIM_progressindicator= new ProgressIndicator<int64>(0,SKIM3_readpool->size());
-//
-//  for(uint32 i=0; i<SKIM3_readpool->size();++i){
-//    for(uint32 j=i+1; j<SKIM3_readpool->size();++j){
-//      SKIM_progressindicator->progress(i);
-//    }
-//  }
-//
-//  delete SKIM_progressindicator;
-
-  for(uint32 i=0;i < 128; ++i){
-    SKIM3_lbphs_hashadd[i]=0xffff;
-  }
-  SKIM3_lbphs_hashadd['a']=0;
-  SKIM3_lbphs_hashadd['A']=0;
-  SKIM3_lbphs_hashadd['c']=1;
-  SKIM3_lbphs_hashadd['C']=1;
-  SKIM3_lbphs_hashadd['g']=2;
-  SKIM3_lbphs_hashadd['G']=2;
-  SKIM3_lbphs_hashadd['t']=3;
-  SKIM3_lbphs_hashadd['T']=3;
-
-  SKIM3_lbphs_idsperhash.clear();
-  SKIM3_lbphs_idsperhash.resize(1<<(SKIM3_basesperhash*2));
-  totalphits=0;
-
-  SKIM3_lbphs_numoverlapsperid.clear();
-  SKIM3_lbphs_numoverlapsperid.resize(SKIM3_readpool->size(),0);
-  SKIM3_lbphs_maxoverlaphashesperid.clear();
-  SKIM3_lbphs_maxoverlaphashesperid.resize(SKIM3_readpool->size(),0);
-
-  cout << "Starting lbph skim" << endl;
-
-  BUGIFTHROW(SKIM3_basesperhash>14,"bph is " << SKIM3_basesperhash << ". Using a bph >12 is a pretty bad idea memory wise.");
-
-  for(uint32 readpart=0; readpart < SKIM3_readpool->size();){
-    SKIM_partfirstreadid=readpart;
-    lbphsPrepareHashOverviewTable(readpart);
-    SKIM_partlastreadid=readpart;
-    cout << "Prepared " << SKIM_partfirstreadid << " to " << SKIM_partlastreadid << endl;
-    startMultiThreading(1,SKIM3_numthreads,1000,SKIM_partfirstreadid,SKIM3_readpool->size(),
-    			boost::bind( &Skim<TVHASH_T>::lbphsThreadsDataInit, this, _1 ),
-    			boost::bind( &Skim<TVHASH_T>::lbphsThreadLoop, this, _1 ));
-  }
-
-  cout << "Kill me now " << totalphits << endl;
-  exit(0);
-
-  FUNCEND();
-}
-
-
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-template<class TVHASH_T>
-void Skim<TVHASH_T>::lbphsPrepareHashOverviewTable(uint32 & readi)
-{
-  {
-    vector<vector<uint32> >::iterator iphI=SKIM3_lbphs_idsperhash.begin();
-    for(; iphI != SKIM3_lbphs_idsperhash.end(); ++ iphI){
-      iphI->clear();
-    }
-  }
-
-  bool loopok=true;
-  for(;readi<SKIM3_readpool->size() && loopok; ++readi){
-    loopok=lbphsPrepareOneSeqForHOT(readi);
-  }
-
-//  {
-//    vector<vector<uint32> >::iterator iphI=SKIM3_lbphs_idsperhash.begin();
-//    for(; iphI != SKIM3_lbphs_idsperhash.end(); ++ iphI){
-//      cout << "bhs" << readi << "\t" << iphI-SKIM3_lbphs_idsperhash.begin() << "\t" << iphI->size() << endl;
-//    }
-//  }
-
-  // normalise overview table
-  {
-    vector<vector<uint32> >::iterator iphI=SKIM3_lbphs_idsperhash.begin();
-    for(; iphI != SKIM3_lbphs_idsperhash.end(); ++ iphI){
-      if(!iphI->empty()){
-	sort(iphI->begin(), iphI->end());
-	iphI->resize(unique(iphI->begin(), iphI->end())-iphI->begin());
-      }
-    }
-  }
-
-//  {
-//    vector<vector<uint32> >::iterator iphI=SKIM3_lbphs_idsperhash.begin();
-//    for(; iphI != SKIM3_lbphs_idsperhash.end(); ++ iphI){
-//      cout << "ahs" << readi << "\t" << iphI-SKIM3_lbphs_idsperhash.begin() << "\t" << iphI->size() << endl;
-//    }
-//  }
-
-
-}
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-template<class TVHASH_T>
-bool Skim<TVHASH_T>::lbphsPrepareOneSeqForHOT(const uint32 readi)
-{
-  const char * seq=SKIM3_readpool->getRead(readi).getSeqAsChar();
-  const uint32 slen=SKIM3_readpool->getRead(readi).getLenClippedSeq();
-  const uint32 basesperhash=SKIM3_basesperhash;
-
-  bool retvalue=true;
-
-  shash_t acthash=0;
-  shash_t hashmask=1;
-  // note: bph kann never be >12 in these routines, hence no special handling of bph==16
-  //  where the shift would be undefined
-  hashmask<<=(basesperhash*2);
-  --hashmask;
-
-  uint32  baseok=0;
-
-  for(int32 seqi=0; seqi<static_cast<int32>(slen); ++seqi, ++seq){
-    ++baseok;
-
-    acthash<<=2;
-    acthash&=hashmask;
-    acthash+=SKIM3_lbphs_hashadd[*seq];
-
-    if(SKIM3_lbphs_hashadd[*seq]==0xffff){
-      if(dptools::isValidIUPACStarBase(*seq)) {
-	// the IUPAC bases are treated like N and X
-
-	// break hash making (which is actually better than behaving
-	//  like another character in case of multiple bases with
-	//  IUPAC or '*')
-	acthash=0;
-	baseok=0;
-      } else {
-	cout << "Unknown base '" << *seq << "' (ASCII " << static_cast<uint16>(*seq) << ") at position " << seqi << " in _CLIPPED_ sequence " << readi << endl; // << actread.getName() << endl;
-	exit(100);
-      }
-    }else if(baseok >= basesperhash){
-      SKIM3_lbphs_idsperhash[acthash].push_back(readi);
-      if(SKIM3_lbphs_idsperhash[acthash].size()>=512000) retvalue=false;
-    }
-  }
-
-  if(readi>0 && readi%12000==0) retvalue=false;
-
-  return retvalue;
-}
-
-
-
-template<class TVHASH_T>
-void Skim<TVHASH_T>::lbphsThreadsDataInit(const uint32 numthreads)
-{
-  FUNCSTART("void Skim<TVHASH_T>::lbphsThreadsDataInit(const uint32 numthreads)");
-
-  SKIM3_lbphsd_vector.resize(numthreads);
-  for(uint32 ti=0; ti<numthreads;++ti){
-    SKIM3_lbphsd_vector[ti].hashhitperread.clear();
-    SKIM3_lbphsd_vector[ti].hashhitperread.resize(SKIM3_readpool->size(),0);
-
-    SKIM3_lbphsd_vector[ti].r1posperhash.clear();
-    SKIM3_lbphsd_vector[ti].r1posperhash.resize(1<<(SKIM3_basesperhash*2));
-
-    SKIM3_lbphsd_vector[ti].r1r2poshistogram.clear();
-    SKIM3_lbphsd_vector[ti].r1r2poshistogram.resize(100000,0);    // FIXME
-
-    SKIM3_lbphsd_vector[ti].r1r2phused.reserve(100000);
-  }
-
-  FUNCEND();
-}
-
-template<class TVHASH_T>
-void Skim<TVHASH_T>::lbphsThreadLoop(const uint32 threadnr)
-{
-  FUNCSTART("void Skim<TVHASH_T>::lbphsThreadloop(const uint32 threadnr)");
-
-  // threads need their own try() catch() block
-
-  try {
-    CEBUG("Thread: " << threadnr << " starting.\n");
-
-    BUGIFTHROW(threadnr>=SKIM3_lbphsd_vector.size(),"threadnr>=SKIM3_lbphsd_vector.size()???");
-
-    // we'll jump out with a break;
-    while(true){
-      {
-	boost::mutex::scoped_lock mylock(SKIM3_mutex);
-	CEBUG("Thread " << threadnr << " waiting ...\n");
-	while(!SKIM3_threadcontrol[threadnr].flag_datavalid
-	      && ! SKIM3_threadcontrol[threadnr].flag_endthread){
-	  SKIM3_master2slavesignal.wait(mylock);
-	}
-      }
-      if(SKIM3_threadcontrol[threadnr].flag_datavalid){
-	CEBUG("Thread " << threadnr << " working on " << SKIM3_threadcontrol[threadnr].from << " to " << SKIM3_threadcontrol[threadnr].to << "\n");
-
-	for(uint32 readi=SKIM3_threadcontrol[threadnr].from; readi<SKIM3_threadcontrol[threadnr].to; ++readi){
-	  lbphsLookAtRead(readi,threadnr,1);
-	  lbphsLookAtRead(readi,threadnr,-1);
-	  if(readi%1000==0) cout << "Doing " << readi << "\t" << totalphits << endl;
-	  //if(actreadi==5000) exit(0);
-	}
-
-	boost::mutex::scoped_lock mylock(SKIM3_mutex);
-	SKIM3_threadcontrol[threadnr].flag_datavalid=false;
-
-	SKIM3_slave2mastersignal.notify_one();
-      }else if(SKIM3_threadcontrol[threadnr].flag_endthread){
-	CEBUG("Thread " << threadnr << "  exiting.\n");
-	break;
-      }
-    }
-
-  }
-  catch(Notify n){
-    n.handleError(THISFUNC);
-  }
-
-  FUNCEND();
-}
-
-
-template<class TVHASH_T>
-void Skim<TVHASH_T>::lbphsLookAtRead(const uint32 actreadi, const uint32 threadnr, const int8 direction)
-{
-  FUNCSTART("void Skim<TVHASH_T>::lbphsLookAtRead(const uint32 readnr, const uint32 threadnr)");
-
-  lbphs_threaddata_t & lbphsd=SKIM3_lbphsd_vector[threadnr];
-
-  if(direction>0){
-    lbphsGetHashesOfOneSeq(actreadi,
-			   lbphsd.hashvec,
-			   SKIM3_basesperhash,
-			   SKIM3_readpool->getRead(actreadi).getClippedSeqAsChar(),
-			   SKIM3_readpool->getRead(actreadi).getLenClippedSeq());
-  }else{
-    lbphsGetHashesOfOneSeq(actreadi,
-			   lbphsd.hashvec,
-			   SKIM3_basesperhash,
-			   SKIM3_readpool->getRead(actreadi).getClippedComplementSeqAsChar(),
-			   SKIM3_readpool->getRead(actreadi).getLenClippedSeq());
-  }
-  sort(lbphsd.hashvec.begin(),lbphsd.hashvec.end());
-  lbphsd.hashvec.resize(unique(lbphsd.hashvec.begin(),lbphsd.hashvec.end())-lbphsd.hashvec.begin());
-
-  vector<uint32>::const_iterator hvI=lbphsd.hashvec.begin();
-  for(; hvI!=lbphsd.hashvec.end(); ++hvI){
-    vector<uint32>::const_iterator iphI=SKIM3_lbphs_idsperhash[*hvI].begin();
-//    for(; iphI != SKIM3_lbphs_idsperhash[*hvI].end(); ++iphI){
-//      lbphsd.hashhitperread[*iphI]+=1;
-//    }
-    uint32 loopcount=SKIM3_lbphs_idsperhash[*hvI].size();
-    for(; loopcount!=0; --loopcount, ++iphI){
-      lbphsd.hashhitperread[*iphI]+=1;
-
-      //lbphsd.hashhitperread[*iphI]+=*iphI>actreadi;
-      //if(*iphI>actreadi) lbphsd.hashhitperread[*iphI]+=1;
-
-    }
-  }
-
-  // search for cutoff
-  uint32 numhitschosen=0;
-  uint32 threshold=0;
-  if(1){
-    uint32 maxhits=0;
-    for(uint32 ri=SKIM_partfirstreadid; ri < SKIM_partlastreadid; ++ri){
-      if(lbphsd.hashhitperread[ri]>maxhits) maxhits=lbphsd.hashhitperread[ri];
-    }
-    threshold=(maxhits*5)/10;
-    uint32 diffstep=(maxhits-threshold)/2;
-    uint32 numhits=0;
-    for(; diffstep>0; diffstep/=2){
-      numhits=0;
-      for(uint32 ri=SKIM_partfirstreadid; ri < SKIM_partlastreadid; ++ri){
-	if(lbphsd.hashhitperread[ri]>threshold) ++numhits;
-      }
-      if(numhits>25){
-	threshold+=diffstep;
-      }else if(numhits<10){
-	threshold-=diffstep;
-      }else{
-	diffstep=0;
-      }
-    }
-    numhitschosen=numhits;
-  }
-
-
-  lbphsd.hashhitsofoneread.clear();
-  for(uint32 ri=SKIM_partfirstreadid; ri < SKIM_partlastreadid; ++ri){
-    if(lbphsd.hashhitperread[ri]>threshold) {
-      lbphsd.hashhitsofoneread.resize(lbphsd.hashhitsofoneread.size()+1);
-      lbphsd.hashhitsofoneread.back().numhashes=lbphsd.hashhitperread[ri];
-      lbphsd.hashhitsofoneread.back().rid=ri;
-    }
-  }
-
-  sort(lbphsd.hashhitsofoneread.begin(), lbphsd.hashhitsofoneread.end());
-  lbphsSecondLineCheck(actreadi, lbphsd, direction);
-
-
-  numhitschosen=lbphsd.r1r2idstaken.size();
-//    cout << "1: " << lbphsd.hashhitsofoneread[0].numhashes
-//	 << "\n2: " << lbphsd.hashhitsofoneread[1].numhashes << endl;
-
-  for(uint32 ri=SKIM_partfirstreadid; ri < SKIM_partlastreadid; ++ri){
-    //cout << "makesure: " << actreadi << "\t" << ri << "\t# " << lbphsd.hashhitperread[ri] << endl;
-    lbphsd.hashhitperread[ri]=0;
-  }
-
-  {
-    boost::mutex::scoped_lock lock(SKIM3_coutmutex);
-    //cout << "nhc\t" << lbphsd.r1r2idstaken.size() << "\n";
-    totalphits+=numhitschosen;
-  }
-
-  FUNCEND();
-}
-
-
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-template<class TVHASH_T>
-void Skim<TVHASH_T>::lbphsGetHashesOfOneSeq(const uint32 readi, vector<shash_t> & hashvec, const uint32 basesperhash, const char * seq, const uint32 slen)
-{
-  //const char * seq=SKIM3_readpool->getRead(readi).getSeqAsChar();
-  //const uint32 slen=SKIM3_readpool->getRead(readi).getLenClippedSeq();
-  //const uint32 basesperhash=SKIM3_basesperhash;
-
-  hashvec.clear();
-
-  shash_t acthash=0;
-  shash_t hashmask=1;
-  // note: bph kann never be >12 in these routines, hence no special handling of bph==16
-  //  where the shift would be undefined
-  hashmask<<=(basesperhash*2);
-  --hashmask;
-
-  uint32  baseok=0;
-
-  for(int32 seqi=0; seqi<static_cast<int32>(slen); ++seqi, ++seq){
-    ++baseok;
-
-    acthash<<=2;
-    acthash&=hashmask;
-    acthash+=SKIM3_lbphs_hashadd[*seq];
-
-    if(SKIM3_lbphs_hashadd[*seq]==0xffff){
-      acthash=0;
-      baseok=0;
-    }else if(baseok >= basesperhash){
-      hashvec.push_back(acthash);
-    }
-  }
-
-  return;
-}
-
-
-
-
-template<class TVHASH_T>
-void Skim<TVHASH_T>::lbphsSecondLineCheck(const uint32 actreadid, lbphs_threaddata_t & lbphsd, int8 direction)
-{
-//  //vector<vector<int32> > r1posperhash;
-
-  lbphsd.r1r2poshistogram.clear();
-  lbphsd.r1r2poshistogram.resize(100000,0);
-
-  lbphsd.r1pphlist.clear();
-  lbphsd.r2shashpos.clear();
-  lbphsd.r1r2phused.clear();
-  lbphsd.r1r2idstaken.clear();
-
-
-  vector<shashpos_t> & r2shashpos=lbphsd.r2shashpos;
-
-  if(direction>0){
-    lbphsSeqToPosOverviewTable(lbphsd.r1posperhash,
-			       lbphsd.r1pphlist,
-			       SKIM3_basesperhash,
-			       SKIM3_readpool->getRead(actreadid).getClippedSeqAsChar(),
-			       SKIM3_readpool->getRead(actreadid).getLenClippedSeq());
-  }else{
-    lbphsSeqToPosOverviewTable(lbphsd.r1posperhash,
-			       lbphsd.r1pphlist,
-			       SKIM3_basesperhash,
-			       SKIM3_readpool->getRead(actreadid).getClippedComplementSeqAsChar(),
-			       SKIM3_readpool->getRead(actreadid).getLenClippedSeq());
-  }
-
-  uint32 dummy=0;
-
-  auto srhhI=lbphsd.hashhitsofoneread.cbegin();
-  for(; srhhI!= lbphsd.hashhitsofoneread.end(); ++srhhI){
-    lbphsGetHashPosOfOneSeq(srhhI->rid, r2shashpos, SKIM3_basesperhash,
-			    SKIM3_readpool->getRead(actreadid).getClippedSeqAsChar(),
-			    SKIM3_readpool->getRead(actreadid).getLenClippedSeq());
-
-    lbphsd.r1r2phused.clear();
-    auto r2shpI=r2shashpos.cbegin();
-    for(; r2shpI!=r2shashpos.end(); ++r2shpI){
-      if(lbphsd.r1posperhash[r2shpI->shash].size()){
-	vector<int32>::const_iterator r1pphI=lbphsd.r1posperhash[r2shpI->shash].begin();
-	for(; r1pphI!=lbphsd.r1posperhash[r2shpI->shash].end(); ++r1pphI){
-	  int32 posdiff=*r1pphI-r2shpI->hashpos+50000;
-	  if(lbphsd.r1r2poshistogram[posdiff]++==0) lbphsd.r1r2phused.push_back(posdiff);
-	}
-      }
-    }
-
-    uint32 maxseen=0;
-    int32 indexmax=-1;
-    {
-      vector<uint32>::iterator uI=lbphsd.r1r2phused.begin();
-      for(; uI!=lbphsd.r1r2phused.end(); ++uI){
-	if(lbphsd.r1r2poshistogram[*uI]>maxseen){
-	  maxseen=lbphsd.r1r2poshistogram[*uI];
-	  indexmax=*uI;
-	}
-      }
-    }
-
-    if(indexmax>=0){
-      if(indexmax>0) maxseen+=lbphsd.r1r2poshistogram[indexmax-1];
-      if(indexmax<lbphsd.r1r2poshistogram.size()-2) maxseen+=lbphsd.r1r2poshistogram[indexmax+1];
-    }
-
-    //if(maxseen>0){
-    //  boost::mutex::scoped_lock lock(SKIM3_coutmutex);
-    //  cout << "ms\t" << maxseen << "\n";
-    //}
-    if(maxseen>=100) {
-      ++dummy;
-      //lbphsd.r1r2idstaken.push_back(srhhI->rid);
-      vector<skimhitforsave_t> * actshfsv;
-      if(direction>0){
-	actshfsv=&lbphsd.shfsvf;
-      }else{
-	actshfsv=&lbphsd.shfsvr;
-      }
-      actshfsv->resize(actshfsv->size()+1);
-      skimhitforsave_t & shfs=actshfsv->back();
-      shfs.rid1=srhhI->rid;
-      shfs.rid2=actreadid;
-      shfs.eoffset=-(indexmax);
-      shfs.percent_in_overlap=50;
-      shfs.numhashes=maxseen;
-      shfs.ol_stronggood  =false;
-      shfs.ol_weakgood    =false;
-      shfs.ol_belowavgfreq=false;
-      shfs.ol_norept      =false;
-      shfs.ol_rept        =false;
-    }
-
-    {
-      vector<uint32>::iterator uI=lbphsd.r1r2phused.begin();
-      for(; uI!=lbphsd.r1r2phused.end(); ++uI){
-	lbphsd.r1r2poshistogram[*uI]=0;
-      }
-    }
-
-    if(dummy==10) break;
-  }
-
-  vector<shash_t>::const_iterator r1pphI=lbphsd.r1pphlist.begin();
-  for(; r1pphI!=lbphsd.r1pphlist.end(); ++r1pphI){
-    lbphsd.r1posperhash[*r1pphI].clear();
-  }
-}
-
-
-template<class TVHASH_T>
-void Skim<TVHASH_T>::lbphsGetHashPosOfOneSeq(const uint32 readi, vector<shashpos_t> & hashposvec, const uint32 basesperhash, const char * seq, const uint32 slen)
-{
-  hashposvec.clear();
-
-  shash_t acthash=0;
-  shash_t hashmask=1;
-  // note: bph kann never be >12 in these routines, hence no special handling of bph==16
-  //  where the shift would be undefined
-  hashmask<<=(basesperhash*2);
-  --hashmask;
-
-  uint32  baseok=0;
-
-  for(int32 seqi=0; seqi<static_cast<int32>(slen); ++seqi, ++seq){
-    ++baseok;
-
-    acthash<<=2;
-    acthash&=hashmask;
-    acthash+=SKIM3_lbphs_hashadd[*seq];
-
-    if(SKIM3_lbphs_hashadd[*seq]==0xffff){
-      acthash=0;
-      baseok=0;
-    }else if(baseok >= basesperhash){
-      hashposvec.resize(hashposvec.size()+1);
-      hashposvec.back().shash=acthash;
-      hashposvec.back().hashpos=seqi;
-    }
-  }
-
-  return;
-}
-
-
-template<class TVHASH_T>
-void Skim<TVHASH_T>::lbphsSeqToPosOverviewTable(vector<vector<int32> > & posperhash, vector<shash_t> & r1pphlist, const uint32 basesperhash, const char * seq, const uint32 slen)
-{
-  r1pphlist.clear();
-
-  shash_t acthash=0;
-  shash_t hashmask=1;
-  // note: bph kann never be >12 in these routines, hence no special handling of bph==16
-  //  where the shift would be undefined
-  hashmask<<=(basesperhash*2);
-  --hashmask;
-
-  uint32  baseok=0;
-
-  for(int32 seqi=0; seqi<static_cast<int32>(slen); ++seqi, ++seq){
-    ++baseok;
-
-    acthash<<=2;
-    acthash&=hashmask;
-    acthash+=SKIM3_lbphs_hashadd[*seq];
-
-    if(SKIM3_lbphs_hashadd[*seq]==0xffff){
-      acthash=0;
-      baseok=0;
-    }else if(baseok >= basesperhash){
-      posperhash[acthash].push_back(seqi);
-      if(posperhash[acthash].size()==1) r1pphlist.push_back(acthash);
-    }
-  }
-
-  return;
-}
diff --git a/src/mira/stringcontainer.H b/src/mira/stringcontainer.H
index d630517..1e881a5 100644
--- a/src/mira/stringcontainer.H
+++ b/src/mira/stringcontainer.H
@@ -11,17 +11,17 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
 
@@ -37,9 +37,6 @@
 
 #include <boost/bind.hpp>
 
-//#define SCCEBUG(bla) {std::cout << bla; std::cout.flush();}
-#define SCCEBUG(bla)
-
 template <class T>
 class StringContainer
 {
@@ -58,10 +55,10 @@ public:
   };
 
 private:
-  std::string SC_name;                /* name of the container, used for
+  string SC_name;                /* name of the container, used for
 				    error messages and debugging */
-  std::vector<std::string> SC_thestrings;  // all the strings of that container
-  std::vector<T> SC_stringsorder;     // order of lexically sorted strings in "thestrings"
+  vector<string> SC_thestrings;  // all the strings of that container
+  vector<T> SC_stringsorder;     // order of lexically sorted strings in "thestrings"
   T SC_maxnumentries;            /* max num of entries this container can have
 				    (governed by size of template type T) */
 
@@ -70,13 +67,13 @@ private:
 // functions
 
 public:
-  void dump(std::ostream & ostr);
-  void status(std::ostream & ostr);
+  void dump(ostream & ostr);
+  void status(ostream & ostr);
 
 private:
   void init(const char * name);
 
-  typename std::vector<T>::iterator searchInsertIndex(const std::string & s);
+  typename vector<T>::iterator searchInsertIndex(const string & s);
 
   inline bool sortcontainer_funccmp(const T & i, const T & j) const {
     return SC_thestrings[i]<SC_thestrings[j];
@@ -87,17 +84,17 @@ private:
       FUNCEND();
       return;
     }
-    SCCEBUG("Must sort\n");
+    FUNCTRACE("Must sort\n");
 
     if(SC_thestrings.size()==0){
-      std::cout << "Oooooops? SC_thestrings.size()==0 and still want to sort???" << std::endl;
+      cout << "Oooooops? SC_thestrings.size()==0 and still want to sort???" << endl;
     }
 
-    //dump(std::cout);
+    //dump(cout);
     sort(SC_stringsorder.begin(),SC_stringsorder.end(),
 	 bind(&StringContainer<T>::sortcontainer_funccmp, this, _1, _2));
     SC_issorted=true;
-    //dump(std::cout);
+    //dump(cout);
 
     FUNCEND();
   }
@@ -107,19 +104,19 @@ private:
 
 public:
   StringContainer(const char * name)  {init(name);}
-  StringContainer(const std::string & name) {init(name.c_str());}
+  StringContainer(const string & name) {init(name.c_str());}
 
   inline size_t size() const {return SC_thestrings.size();};
   inline void reserve(size_t s) {SC_thestrings.reserve(s);SC_stringsorder.reserve(s); return;};
   inline void trash() {SC_thestrings.clear();SC_stringsorder.clear(); init(SC_name.c_str());return;};
 
-  Entry addEntry(const std::string & s);
-  Entry addEntryNoDoubleCheck(const std::string & s);
-  Entry hasEntry(const std::string & s);
+  Entry addEntry(const string & s);
+  Entry addEntryNoDoubleCheck(const string & s);
+  Entry hasEntry(const string & s);
 
-  inline const std::string & getEntry(Entry e) const {
-    FUNCSTART("const std::string & StringContainer::getEntry(Entry e)");
-    BUGIFTHROW(e.getSCID() >= SC_thestrings.size(), "StringContainer: " << SC_name << "\nTried to get non-existent entry: " << static_cast<uint64>(e.getSCID()) << std::endl);
+  inline const string & getEntry(Entry e) const {
+    FUNCSTART("const string & StringContainer::getEntry(Entry e)");
+    BUGIFTHROW(e.getSCID() >= SC_thestrings.size(), "StringContainer: " << SC_name << "\nTried to get non-existent entry: " << static_cast<uint64>(e.getSCID()) << endl);
     FUNCEND();
     return SC_thestrings[e.getSCID()];
   }
@@ -132,13 +129,15 @@ public:
 
 };
 
+//#define SCCEBUG(bla) {std::cout << bla; cout.flush();}
+#define SCCEBUG(bla)
 
 template <class T>
 void StringContainer<T>::init(const char * name)
 {
   FUNCSTART("template <class T> void StringContainer<T>::init(const char * name)");
 
-  SCCEBUG("SC init: " << name << std::endl);
+  SCCEBUG("SC init: " << name << endl);
   SC_name=name;
   SC_thestrings.resize(1);
   SC_stringsorder.push_back(0);
@@ -147,19 +146,19 @@ void StringContainer<T>::init(const char * name)
   SC_issorted=true;
 
   //status(std::cout);
-  SCCEBUG("SC end init: " << name << std::endl);
+  SCCEBUG("SC end init: " << name << endl);
 
   FUNCEND();
 }
 
 template <class T>
-typename std::vector<T>::iterator StringContainer<T>::searchInsertIndex(const std::string & s)
+typename vector<T>::iterator StringContainer<T>::searchInsertIndex(const string & s)
 {
-  FUNCSTART("template <class T> typename std::vector<T>::iterator StringContainer<T>::searchInsertIndex(const string & s)");
+  FUNCSTART("template <class T> typename vector<T>::iterator StringContainer<T>::searchInsertIndex(const string & s)");
 
   if(!SC_issorted) sortContainer();
 
-  typename std::vector<T>::iterator first, last, it;
+  typename vector<T>::iterator first, last, it;
 
   first=SC_stringsorder.begin();
   last=SC_stringsorder.end();
@@ -168,7 +167,7 @@ typename std::vector<T>::iterator StringContainer<T>::searchInsertIndex(const st
   count = distance(first,last);
   while (count>0){
     it = first; step=count/2; advance (it,step);
-    if (SC_thestrings[*it]<s) {
+    if (SC_thestrings[*it]<s) { 
       first=++it; count-=step+1;
     }else{
       count=step;
@@ -180,7 +179,7 @@ typename std::vector<T>::iterator StringContainer<T>::searchInsertIndex(const st
 }
 
 template <class T>
-typename StringContainer<T>::Entry StringContainer<T>::hasEntry(const std::string & s)
+typename StringContainer<T>::Entry StringContainer<T>::hasEntry(const string & s)
 {
   FUNCSTART("template <class T> StringContainer<T>::Entry<T> StringContainer<T>::hasEntry(const string & s)");
 
@@ -192,7 +191,7 @@ typename StringContainer<T>::Entry StringContainer<T>::hasEntry(const std::strin
 
   Entry e;
 
-  typename std::vector<T>::iterator inserti=searchInsertIndex(s);
+  typename vector<T>::iterator inserti=searchInsertIndex(s);
   if(inserti!=SC_stringsorder.end()
      && SC_thestrings[*inserti]==s) {
     e.setSCID(*inserti);
@@ -205,9 +204,9 @@ typename StringContainer<T>::Entry StringContainer<T>::hasEntry(const std::strin
 }
 
 template <class T>
-typename StringContainer<T>::Entry StringContainer<T>::addEntry(const std::string & s)
+typename StringContainer<T>::Entry StringContainer<T>::addEntry(const string & s)
 {
-  FUNCSTART("template <class T> StringContainer<T>::Entry<T> StringContainer<T>::addEntry(const std::string & s)");
+  FUNCSTART("template <class T> StringContainer<T>::Entry<T> StringContainer<T>::addEntry(const string & s)");
 
   // empty entries get quick treatment
   if(s.empty()){
@@ -215,17 +214,17 @@ typename StringContainer<T>::Entry StringContainer<T>::addEntry(const std::strin
     return emptyEntry();
   }
 
-  SCCEBUG("SC " << SC_name << ": adding non-empty entry '" << s << "'" << std::endl);
+  SCCEBUG("SC " << SC_name << ": adding non-empty entry '" << s << "'" << endl);
 
   if(SC_thestrings.size()==SC_maxnumentries){
-    std::cout << "Oooops? Going to throw in addEntry because of this: " << SC_thestrings.size() << " " << SC_maxnumentries << " for " << s << std::endl;
+    std::cout << "Oooops? Going to throw in addEntry because of this: " << SC_thestrings.size() << " " << SC_maxnumentries << endl;
     dump(std::cout);
     MIRANOTIFY(Notify::INTERNAL, "Tried to add '" << s << "', but max number of entries (" << SC_thestrings.size() << ") reached.\n");
   }
 
   Entry e;
 
-  typename std::vector<T>::iterator inserti=searchInsertIndex(s);
+  typename vector<T>::iterator inserti=searchInsertIndex(s);
   if(inserti!=SC_stringsorder.end()
      && SC_thestrings[*inserti]==s) {
     e.setSCID(*inserti);
@@ -234,9 +233,9 @@ typename StringContainer<T>::Entry StringContainer<T>::addEntry(const std::strin
   }
 
   //if(inserti==SC_stringsorder.end()){
-  //  std::cout << "insert at end\n";
+  //  cout << "insert at end\n";
   //}else{
-  //  std::cout << "insert at pos" << inserti-SC_stringsorder.begin() << std::endl;;
+  //  cout << "insert at pos" << inserti-SC_stringsorder.begin() << endl;;
   //}
 
 
@@ -251,9 +250,9 @@ typename StringContainer<T>::Entry StringContainer<T>::addEntry(const std::strin
 
 
 template <class T>
-typename StringContainer<T>::Entry StringContainer<T>::addEntryNoDoubleCheck(const std::string & s)
+typename StringContainer<T>::Entry StringContainer<T>::addEntryNoDoubleCheck(const string & s)
 {
-  FUNCSTART("template <class T> StringContainer<T>::Entry<T> StringContainer<T>::addEntryNoDoubleCheck(const std::string & s)");
+  FUNCSTART("template <class T> StringContainer<T>::Entry<T> StringContainer<T>::addEntryNoDoubleCheck(const string & s)");
 
   // empty entries get quick treatment
   if(s.empty()){
@@ -261,7 +260,7 @@ typename StringContainer<T>::Entry StringContainer<T>::addEntryNoDoubleCheck(con
     return emptyEntry();
   }
 
-  SCCEBUG("SC " << SC_name << ": adding non-empty entry '" << s << "'" << std::endl);
+  SCCEBUG("SC " << SC_name << ": adding non-empty entry '" << s << "'" << endl);
 
   if(SC_thestrings.size()==SC_maxnumentries){
     std::cout << "Oooops? Going to throw in addEntryNoDoubleCheck because of this:\n";
@@ -282,28 +281,28 @@ typename StringContainer<T>::Entry StringContainer<T>::addEntryNoDoubleCheck(con
 
 
 template <class T>
-void StringContainer<T>::status(std::ostream & ostr)
+void StringContainer<T>::status(ostream & ostr)
 {
-  FUNCSTART("template <class T> void StringContainer<T>::status(std::ostream & ostr)");
+  FUNCSTART("template <class T> void StringContainer<T>::status(ostream & ostr)");
 
-  ostr << "SC " << SC_name
-       << " issorted (" << SC_issorted << ") capacity "
+  ostr << "SC " << SC_name 
+       << " issorted (" << SC_issorted << ") capacity " 
        << static_cast<uint64>(SC_maxnumentries) << "(" << sizeof(SC_maxnumentries) << ") size "
-       << SC_thestrings.size() << std::endl;
+       << SC_thestrings.size() << endl;
 
   FUNCEND();
 }
 
 template <class T>
-void StringContainer<T>::dump(std::ostream & ostr)
+void StringContainer<T>::dump(ostream & ostr)
 {
-  FUNCSTART("template <class T> void StringContainer<T>::dump(std::ostream & ostr)");
+  FUNCSTART("template <class T> void StringContainer<T>::dump(ostream & ostr)");
 
   status(ostr);
   for(size_t i=0; i<SC_thestrings.size(); i++){
-    ostr << i << "\traw:" << SC_thestrings[i]
-	 << "\to:" << static_cast<size_t>(SC_stringsorder[i])
-	 << "\tsrt:" << SC_thestrings[SC_stringsorder[i]]
+    ostr << i << "\traw:" << SC_thestrings[i] 
+	 << "\to:" << static_cast<size_t>(SC_stringsorder[i]) 
+	 << "\tsrt:" << SC_thestrings[SC_stringsorder[i]] 
 	 << '\n';
   }
   ostr.flush();
@@ -313,3 +312,4 @@ void StringContainer<T>::dump(std::ostream & ostr)
 
 
 #endif
+
diff --git a/src/mira/structs.H b/src/mira/structs.H
index 036c832..f68e71d 100644
--- a/src/mira/structs.H
+++ b/src/mira/structs.H
@@ -9,33 +9,34 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
 
-// 	$Id$
+// 	$Id$	
 
 
 #ifndef _mira_structs_h_
 #define _mira_structs_h_
 
 #include <string>
-#include <vector>
 
 //#include "stdinc/stlincludes.H"
 #include "stdinc/types.H"
 #include "enums.H"
 
+using namespace std;
+
 
 // ----------------- For parametrisation
 
@@ -43,34 +44,13 @@ struct special_parameters
 {
   uint32 sp_est_startstep;
 
-  bool mi_iknowwhatido;
-
+  bool mi_stop_on_nfs;
   bool mi_extended_log;
-  bool mi_extra_flag1;
-  bool mi_extra_flag2;
-  bool mi_extra_flag3;
 
   uint32 mi_as_largecontigsize;
   uint32 mi_as_largecontigsize4stats;
 
-  bool sp_parse_checktechnologypresence;
-};
-
-
-enum { NWNONE=0, NWSTOP, NWWARN };
-struct nagandwarn_parameters
-{
-  uint8  nw_check_nfs;
-  uint8  nw_check_templateproblems;
-  uint8  nw_check_multipassmapping;
-
-  uint8  nw_check_maxreadnamelength;
-  uint32 nw_check_mrnlvalue;
-  uint8  nw_check_readnamesra;
-  uint8  nw_check_duplicatereadnames;
-
-  uint8  nw_check_coverage;
-  uint32 nw_check_covvalue;
+  uint32 mi_stop_readnamelength;
 };
 
 struct assembly_parameters
@@ -90,29 +70,34 @@ struct assembly_parameters
   uint32 as_minimum_readlength;      // min. length of reads to be used in assembly
   uint32 as_minimum_readspercontig;      // min. reads per contig
 
+  //uint32 as_infile_which;          // loadjob
+  //uint32 as_infile_backbone_which; // loadjob for backbone
+  string as_infile_which;          // SANGER file type
+  string as_infile_backbone_which; // backbone file type
+
+
   uint32 as_backbone_raillength;   // raillength for backbone
   uint32 as_backbone_railoverlap;   // railoverlap for backbone
   uint32 as_backbone_outlen;       // "rail"length for backbone in output
   int32 as_startbackboneusage_inpass; // in which pass to use backbones first
+  base_quality_t  as_backbone_basequals;     // quality for backbone
 
-  bool   as_backbone_bootstrapnewbackbone;
-  bool   as_backbone_trimoverhangingreads;
   bool   as_automemmanagement;
 
-  bool   as_assemblyjob_accurate;
-  bool   as_assemblyjob_mapping;
-  bool   as_assemblyjob_preprocessonly;
+  bool   as_loadbackbone;
   bool   as_backbone_alsobuildnewcontigs;
-  uint32  as_numpasses;
-  uint32  as_maxcontigsperpass;
-  uint32  as_numrmbbreakloops;
-  bool   as_filecheck_only;
 
-  std::vector<uint32> as_bphseries;
 
+  bool   as_load_sequencedata;
+  bool   as_filecheck_only;
   bool   as_enforce_qualsinreads;
   bool   as_wants_qualityfile;
+  bool   as_loadSOLEXA_solexa_scores_in_qual_files;
+  bool   as_loadstraindata;
+  bool   as_assigndefaultstrain;
+  bool   as_mergexmltraceinfo;
 
+  bool   as_keepcontigsinmem;
   bool   as_savesimplesingletsinproject;
   bool   as_savetaggedsingletsinproject;
 
@@ -140,37 +125,20 @@ struct assembly_parameters
   bool   as_output_exttmp_ace;
   bool   as_output_exttmp_fasta;
   bool   as_output_exttmp_gap4da;
-
+  
   bool   as_output_removerollovertmps;
   bool   as_output_removetmpdir;
 
-  bool   as_clip_lowercase_front;
-  bool   as_clip_lowercase_back;
-
-  bool   as_clip_sdbg_chimeradetection;
-  bool   as_clip_kmer_junkdetection;
-  bool   as_clip_kmer_junkkill;
+  bool   as_clip_lowercase;
 
   bool   as_clip_skimchimeradetection;
   bool   as_clip_skimjunkdetection;
 
   bool   as_clip_knownadaptorsright;
-  bool   as_search_phix174;
-  bool   as_filter_phix174;
 
   bool   as_clip_proposeendclips;
   bool   as_clip_pec_sxaggcxg;
   uint32 as_clip_pec_basesperhash;
-  uint16 as_clip_pec_ffreq;     // front freq
-  uint16 as_clip_pec_bfreq;     // back  freq
-  uint32 as_clip_pec_mkfr;  // min kmer for forward-rev criterion
-  uint32 as_clip_pec_mtk;  // min total kmer (both directions)
-  bool   as_clip_pec_ffr; // front forward-rev
-  bool   as_clip_pec_bfr; // back  forward-rev
-  bool   as_clip_pec_fcmst; // front confirmed multiple seq-types
-  bool   as_clip_pec_bcmst; // back  confirmed multiple seq-types
-  bool   as_clip_pec_fsalp; // front seen at low pos, 27.04.2012 not a good criterion, should not be used
-  bool   as_clip_pec_bsalp; // back  seen at low pos, 27.04.2012 not a good criterion, should not be used
 
   bool   as_clip_badsolexaends;
 
@@ -178,11 +146,14 @@ struct assembly_parameters
   bool   as_clip_quality;
   bool   as_clip_badstretchquality;
   bool   as_clip_maskedbases;
+  bool   as_clip_mergessahavectorscreen;
 
   bool   as_put_asswithmira_tags;
 
+  base_quality_t as_basedefaultqual;
   base_quality_t as_clip_quality_minqual;
   base_quality_t as_clip_badstretchquality_minqual;
+  base_quality_t as_fastq_qualoffset;
 
   base_quality_t as_clip_quality_minthreshold;
   uint32         as_clip_quality_numminthreshold;
@@ -207,7 +178,7 @@ struct assembly_parameters
   bool   as_clip_ensureminimumrightclipoff;
 
   bool    as_clip_polyat;
-  bool    as_clip_polyat_keeppolystretch;
+  bool    as_clip_polyat_keeppolysignal;
   uint32  as_clip_polyat_len;
   uint32  as_clip_polyat_maxerrors;
   uint32  as_clip_polyat_maxgap;
@@ -217,8 +188,15 @@ struct assembly_parameters
   uint32  as_clip_3ppolybase_maxerrors;
   uint32  as_clip_3ppolybase_maxgap;
 
-  //uint32  as_clipmask_rarekmers;
-  bool    as_clipmask_rarekmers;
+
+
+  uint32 as_external_qual;
+  uint32 as_external_qual_override;
+  bool   as_discard_read_on_eq_error;
+
+  uint32  as_numpasses;
+  uint32  as_maxcontigsperpass;
+  uint32  as_numrmbbreakloops;
 
   bool    as_use_read_extension;
   uint32  as_readextension_window_len;
@@ -228,11 +206,12 @@ struct assembly_parameters
 
   bool   as_mark_repeats;
   bool   as_mark_repeats_onlyinresult;
-//  bool   as_skimeachpass;
+  bool   as_skimeachpass;
 
   bool   as_spoilerdetection;
   int32  as_spdetect_lastpassonly;
 
+  bool   as_keep_long_repeats_separated;
   bool   as_automatic_repeat_detection;
   double as_ard_multicopythreshold;
   int32  as_ard_multicopyminlen;
@@ -241,120 +220,130 @@ struct assembly_parameters
   int32  as_urd_startinpass;
   double as_urd_cutoffmultiplier;
 
+  char   as_readnaming_scheme;
+
   bool   as_dateoutput;
 
   bool as_backbone_strainname_forceforall;
 
   bool as_buntify_reads;
-  bool as_rle_reads;
-
-  std::string as_user_kmerseries;
-
-  std::string as_projectname_in;
-  std::string as_projectname_out;
-  std::string as_tmpf_unused_ids;
-  std::string as_tmpf_ads;
-  std::string as_tmpf_adsextend;
-  std::string as_tmpf_scfreadfail;
-  std::string as_tmpf_scfreadfatallywrong;
-  std::string as_tmpf_vectorclip;
-  std::string as_tmpf_spoiler;
-  std::string as_tmpf_posmatch;
-  std::string as_tmpf_poolinfo;
-  std::string as_tmpf_normalisedskim;
-  std::string as_tmpf_clippings;
-  std::string as_tmpf_kmerstatistics;
-
-  ////////// needed for extended resuming
-  std::string as_tmpf_signal_kmerstats;
-  std::string as_tmpf_signal_findpossibleoverlaps;
-  std::string as_tmpf_signal_mainalignments;
-
-  std::string as_tmpf_wellconnected;
-  std::string as_tmpf_banned_overlaps;
-  std::string as_tmpf_istroublemaker;
-  std::string as_tmpf_needalloverlaps;
-  std::string as_tmpf_multicopies;
-  std::string as_tmpf_hasmcoverlap;
-  std::string as_tmpf_debrisreason;
-  std::string as_tmpf_skimmegahubs;
-
-  //////////
-
-  std::string as_backbone_rail_fromstrain;
-
-  std::string as_outfile_FASTA;
-  std::string as_outfile_FASTAUNPADDED;
-  std::string as_outfile_FASTAUNPADDEDQUAL;
-  std::string as_outfile_FASTAPADDED;
-  std::string as_outfile_FASTAPADDEDQUAL;
-  std::string as_outfile_CAF;
-  std::string as_outfile_MAF;
-  std::string as_outfile_TCS;
-  std::string as_outfile_ACE;
-  std::string as_outfile_WIGGLE;
-  std::string as_outfile_HTML;
-  std::string as_outfile_TXT;
-  std::string as_outdir_GAP4DA;
-
-  std::string as_outfile_stats_contigstats;
-  std::string as_outfile_stats_contigtags;
-  std::string as_outfile_stats_crlist;
-  std::string as_outfile_stats_debrislist;
-  std::string as_outfile_stats_featureanalysis;
-  std::string as_outfile_stats_featuresummary;
-  std::string as_outfile_stats_featuresequences;
-  std::string as_outfile_stats_featurecoverage;
-  std::string as_outfile_stats_info;
-  std::string as_outfile_stats_warnings;
-  std::string as_outfile_stats_largecontigs;
-  std::string as_outfile_stats_snpanalysis;
-  std::string as_outfile_stats_snpenvironment;
-  std::string as_outfile_stats_reads_invalid;
-  std::string as_outfile_stats_reads_tooshort;
-  std::string as_outfile_stats_readrepeats;
-  std::string as_outfile_stats_readtags;
-  std::string as_outfile_stats_rgstinfo;
-};
 
-struct directory_parameters
-{
-  std::string dir_top;
-  std::string dir_tmp;
-  std::string dir_tmp_redirectedto;
-  std::string dir_results;
-  std::string dir_info;
-  std::string dir_checkpoint;
-  std::string dir_checkpoint_tmp;
-
-  std::string dir_tmp_symlink;
+  string as_projectname_in;
+  string as_projectname_out;
+  string as_tmpf_unused_ids;
+  string as_tmpf_ads;
+  string as_tmpf_adsextend;
+  string as_tmpf_scfreadfail;
+  string as_tmpf_scfreadfatallywrong;
+  string as_tmpf_vectorclip;
+  string as_tmpf_spoiler;
+  string as_tmpf_posmatch;
+  string as_tmpf_poolinfo;
+  string as_tmpf_normalisedskim;
+  string as_tmpf_clippings;
+
+  string as_backbone_strainname;
+  string as_default_strainname;
+  string as_backbone_rail_fromstrain;
+
+  string as_infile_backbone_MAF;
+  string as_infile_backbone_CAF;
+  string as_infile_backbone_GBF;
+  string as_infile_backbone_GFF3;
+  string as_infile_backbone_FASTA;
+  string as_infile_backbone_FASTAQUAL;
+
+  string as_infile_FOFNEXP;
+  string as_infile_FASTA;
+  string as_infile_FASTAQUAL;
+  string as_infile_FASTQ;
+  string as_infile_CAF;
+  string as_infile_MAF;
+  string as_infile_FOFNPHD;
+  string as_infile_PHD;
+
+  string as_infile_chkptMAF;
+
+//  string as_infile_454GS20FASTA;
+//  string as_infile_454GS20FASTAQUAL;
+//  string as_infile_454GS20CONSSHREDFASTA;
+//  string as_infile_454GS20CONSSHREDFASTAQUAL;
+//  string as_infile_454GS20CONSFASTA;
+//  string as_infile_454GS20CONSFASTAQUAL;
+//  string as_infile_SOLEXAFASTA;
+//  string as_infile_SOLEXAFASTAQUAL;
+//  string as_infile_SOLIDFASTA;
+//  string as_infile_SOLIDFASTAQUAL;
+  string as_infile_straindata;
+  string as_infile_xmltraceinfo;
+  string as_infile_ssahavectorscreen;
+  string as_infile_smaltvectorscreen;
+
+  string as_outfile_FASTA;
+  string as_outfile_FASTAQUAL;
+  string as_outfile_FASTAPADDED;
+  string as_outfile_FASTAPADDEDQUAL;
+  string as_outfile_CAF;
+  string as_outfile_MAF;
+  string as_outfile_TCS;
+  string as_outfile_ACE;
+  string as_outfile_WIGGLE;
+  string as_outfile_HTML;
+  string as_outfile_TXT;
+  string as_outdir_GAP4DA;
+  string as_outfile_callparams;
+
+  string as_outfile_stats_reads_invalid;
+  string as_outfile_stats_reads_tooshort;
+  string as_outfile_stats_contigstats;
+  string as_outfile_stats_info;
+  string as_outfile_stats_debrislist;
+  string as_outfile_stats_crlist;
+  string as_outfile_stats_readtags;
+  string as_outfile_stats_contigtags;
+  string as_outfile_stats_snpanalysis;
+  string as_outfile_stats_snpenvironment;
+  string as_outfile_stats_featureanalysis;
+  string as_outfile_stats_featuresummary;
+  string as_outfile_stats_featuresequences;
+  //string as_tmp_skimmarknastyrepeats;
+  string as_outfile_stats_readrepeats;
 };
 
-
-struct file_parameters
+struct directory_parameters
 {
-  std::string chkpt_persistentoverlaps;
-  std::string chkpt_bannedoverlaps;
-  std::string chkpt_maxcovreached;
-  std::string chkpt_passinfo;
-  std::string chkpt_readpool;
+  string dir_exp;
+  string dir_scf;
+  string dir_fasta;
+
+  string dir_cwd;
+  string dir_top;
+  string dir_tmp;
+  string dir_tmp_redirectedto;
+  string dir_results;
+  string dir_info;
+  string dir_checkpoint;
+
+  string dir_tmp_symlink;
 };
 
-
 struct skim_parameters
 {
   uint32 sk_numthreads;
   uint32 sk_basesperhash;
-  uint32 sk_bph_max;
-  uint32 sk_bph_increasestep;
   uint32 sk_hashsavestepping;
   int32  sk_percentrequired;
   uint32 sk_maxhitsperread;
-
-  bool   sk_filtermegahubs;
   double sk_maxmegahubratio;
-  uint32 sk_megahubcap;
 
+  double sk_freqest_minnormal;
+  double sk_freqest_maxnormal;
+  double sk_freqest_repeat;
+  double sk_freqest_heavyrepeat;
+  double sk_freqest_crazyrepeat;
+  uint32 sk_nastyrepeatratio;
+  uint32 sk_repeatlevel_in_infofile;
+  bool   sk_masknastyrepeats;
   bool   sk_alsoskimrevcomp;
 
   bool   sk_swcheckonbackbones;
@@ -365,35 +354,12 @@ struct skim_parameters
 };
 
 
-struct hashstatistics_parameters
-{
-  double hs_freqest_minnormal;
-  double hs_freqest_maxnormal;
-  double hs_freqest_repeat;
-  double hs_freqest_heavyrepeat;
-  double hs_freqest_crazyrepeat;
-  uint32 hs_freq_covestmin;
-
-  bool   hs_masknastyrepeats;
-  uint32 hs_nastyrepeatratio;
-  uint32 hs_nastyrepeatcoverage;
-
-  uint32 hs_repeatlevel_in_infofile;
-
-  bool   hs_apply_digitalnormalisation;
-
-  uint32 hs_million_hashes_per_buffer;
-  uint32 hs_rare_kmer_final_kill;
-};
-
-
-
 struct align_parameters
 {
   uint32 al_max_cutoff;	        /* failsafe. if too many solutions exist,
 				   stop calculations here */
 
-  // The following values will all need to be reached if a solution
+  // The following values will all need to be reached if a solution 
   //  has to be regarded as valid.
   int32 al_min_score;	        /* Minimum score for two aligned sequences
 				   to be accepted as valid solution */
@@ -407,24 +373,21 @@ struct align_parameters
   int32  al_kpercent;       /* k errors deduced by the length of expected overlap in %
 			       10% and 150 ovelap -> k= 15 */
 
-
+  
   bool   ads_enforce_clean_ends; /* when true, ads will tolerate no ACGT/ACGT
 				    mismatch within distance of ends of
 				    overlap */
   int32  ads_clean_end_distance; // distance for above
-  int32  ads_clean_end_mismatchallowed; // how many mismatches/gaps are allowed in ends
 
 
-  bool   ads_extra_gap_penalty;   // in ADS, use extra penalty function for long gaps?
-  std::string ads_gp_functionstring; // the below as given by user
-  std::vector<uint32> ads_gp_function;  // gap penalty level;
+  bool   ads_extra_gap_penalty;   // in ADS, use extra penalty function for long gaps? 
+  uint32 ads_gp_level;  // gap penalty level;
   uint32 ads_max_gppercent;  // Max. gap penalty in percent
+  vector<uint32> ads_gp_function;  // gap penalty level;
 
-  int32 al_solexahack_maxerrors; /* hack (not used at the moment by align object
-				    but by assembly: maximum errors an alignment
-				    of Solexa sequences may have
-				    -AL:shme is < 0, automatically determining optimal value.
-				  */
+  uint32 al_solexahack_maxerrors; /* hack (not used at the moment by align object
+				     but by assembly: maximum errors an alignment
+				     of Solexa sequences may have */
 
 //  bool   ads_extra_mismatch_penalty;
 //  uint32 ads_emp_windowlen;
@@ -433,9 +396,9 @@ struct align_parameters
 
 struct dynamic_parameters
 {
-  int32 dyn_score_multiplier;   /* by which factor the score differs from a normal
+  int32 dyn_score_multiplier;   /* by which factor the score differs from a normal 
 				   +1/-1/-2 matrix */
-
+				   
 
   int32 dyn_score_match;		// Scores for a match
   int32 dyn_score_mismatch;      //   "  a mismatch
@@ -456,6 +419,7 @@ struct pathfinder_parameters
 {
   bool paf_use_genomic_algorithms;
 
+  bool paf_use_template_information;
   bool paf_use_emergency_blacklist;
   bool paf_use_emergency_search_stop;
   bool paf_use_max_contig_buildtime;
@@ -476,18 +440,15 @@ struct pathfinder_parameters
   long int paf_max_startcache_filltime;
 
   int16 paf_skipwholecontigscan;
-
+  
   clock_t paf_maxcontigclockticks;
   clock_t paf_nextread_maxcttoess;
 };
 
 struct contig_parameters
 {
-  std::string con_nameprefix;
+  string con_nameprefix;
   int32 con_reject_on_drop_in_relscore;
-  int32 con_min_relscore;	/* Percentage minimum of the score of two
-				   alignments to have to be recognised as
-				   valid solution */
   int32 con_danger_analyse_mode;        // analysejob
   int32 con_danger_max_error_rate;      /* reject when more than x% bases
 					   from danger zones in read to add
@@ -500,8 +461,12 @@ struct contig_parameters
   base_quality_t con_minrmbneighbourqual;
   base_quality_t con_mingroupqualforrmbtagging;
   int32 con_minreadspergroup;
+  int32 con_use_template_information;
   int32 con_endreadmarkexclusionarea;
   bool  con_emea_setzero_on_clipping_pec;
+  int32 con_insertsize_minimum;
+  int32 con_insertsize_maximum;
+  int32 con_template_build_direction;
 
   int32 con_output_html_cpl;            // characters per line for HTML
   int32 con_output_text_cpl;            // characters per line for TEXT
@@ -517,26 +482,23 @@ struct contig_parameters
   bool  con_also_mark_gap_bases_evenmc;   // even multicolumn
   bool  con_shorttagcomments;
 
-  bool  con_force_nonIUPACconsensus; // for all seqtypes
-  bool  con_force_nonIUPACconsensus_perseqtype;  // to be retired
+  bool  con_force_nonIUPACconsensus_perseqtype;
+  bool  con_force_nonIUPACconsensus_amongseqtypes;
 
   bool  con_mergeshortreads;
   int32 con_msr_keependsunmapped;
-  int32 con_msr_maxerrors;
 };
 
 struct edit_parameters
 {
-  bool ed_mira_automatic_contic_editing;
-  bool ed_homopolymer_overcalls;
-  bool ed_kmer_singlets;
-
-  bool ed_sdbg_readedit;
-
-  bool ed_edit_automatic_contic_editing;
+  bool ed_automatic_contic_editing;
   bool ed_strict_editing_mode;
+
   uint32 ed_confirmation_threshold;
 };
 
 
 #endif
+
+
+
diff --git a/src/mira/timerestrict.H b/src/mira/timerestrict.H
index a1d88ef..963c68b 100644
--- a/src/mira/timerestrict.H
+++ b/src/mira/timerestrict.H
@@ -9,17 +9,17 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
 #ifndef _timerestrict_h_
diff --git a/src/mira/types_basic.H b/src/mira/types_basic.H
deleted file mode 100644
index fdb6815..0000000
--- a/src/mira/types_basic.H
+++ /dev/null
@@ -1,10 +0,0 @@
-
-#ifndef mira_typesbasic
-#define mira_typesbasic
-
-
-//typedef uint64_t vhash_t;
-
-
-
-#endif
diff --git a/src/mira/vhash.H b/src/mira/vhash.H
deleted file mode 100644
index f71a7d6..0000000
--- a/src/mira/vhash.H
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 2003 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-#ifndef _bas_vhash_h_
-#define _bas_vhash_h_
-
-#include "mira/vluint.H"
-
-
-// TODO
-// the typedef should somehow move to a vhash class which
-// also implements reverseComplement
-// the current code is really badly designed as VLuint should
-// not have this kludge function gnagna__this_is_so_badly_designed__kmerReverseComplement()
-
-
-#if 0
-#define KMER_INTERNALTYPE
-  typedef VLuint<64> vhash64_t;
-  typedef VLuint<64> vhash128_t;
-  typedef VLuint<64> vhash256_t;
-  typedef VLuint<64> vhash512_t;
-
-namespace std {
-  template <> struct hash<VLuint<64> >
-  {
-    size_t operator()(const VLuint<64> & x) const
-    {
-      return x.hash();
-    }
-  };
-};
-
-#else
-
-typedef uint64_t vhash64_t;        // faster
-//  typedef VLuint<64> vhash64_t;
-  typedef VLuint<128> vhash128_t;
-  typedef VLuint<256> vhash256_t;
-  typedef VLuint<512> vhash512_t;
-
-// Specialisation of namespace std so that VLuint knows how to compute hashes of itself
-// Needed for e.g., unordered_set or *_map
-// See http://stackoverflow.com/questions/8157937/how-to-specialize-stdhashkeyoperator-for-user-defined-type-in-unordered?rq=1
-
-// how to make this happen automatically for any instantiated VLuint size???
-
-namespace std {
-  template <> struct hash<VLuint<64> >
-  {
-    size_t operator()(const VLuint<64> & x) const
-    {
-      return x.hash();
-    }
-  };
-};
-namespace std {
-  template <> struct hash<VLuint<128> >
-  {
-    size_t operator()(const VLuint<128> & x) const
-    {
-      return x.hash();
-    }
-  };
-};
-namespace std {
-  template <> struct hash<VLuint<256> >
-  {
-    size_t operator()(const VLuint<256> & x) const
-    {
-      return x.hash();
-    }
-  };
-};
-namespace std {
-  template <> struct hash<VLuint<512> >
-  {
-    size_t operator()(const VLuint<512> & x) const
-    {
-      return x.hash();
-    }
-  };
-};
-#endif
-
-// just contains reverseComplement() atm ... should be somehow a derived class
-//  of VLuint<> for every vhash<>_t
-namespace nsvhash {
-  // specialisation of reverseComplement() for uint64_t
-  inline uint64 reverseComplement(uint64 vh, uint32 basesperhash) {
-    auto oldpl=vh;
-    uint64_t ret=
-	(static_cast<uint64>(nsVLuint::kractable[oldpl&0xFF])<<56)
-	| (static_cast<uint64>(nsVLuint::kractable[(oldpl >>  8) &0xFF])<<48)
-	| (static_cast<uint64>(nsVLuint::kractable[(oldpl >> 16) &0xFF])<<40)
-	| (static_cast<uint64>(nsVLuint::kractable[(oldpl >> 24) &0xFF])<<32)
-	| (static_cast<uint64>(nsVLuint::kractable[(oldpl >> 32) &0xFF])<<24)
-	| (static_cast<uint64>(nsVLuint::kractable[(oldpl >> 40) &0xFF])<<16)
-	| (static_cast<uint64>(nsVLuint::kractable[(oldpl >> 48) &0xFF])<<8)
-	| (static_cast<uint64>(nsVLuint::kractable[(oldpl >> 56) &0xFF]))
-	;
-    ret>>=(sizeof(uint64)*8-basesperhash*2);
-    return ret;
-  }
-  // and template version for the rest
-  template<class T>
-  T reverseComplement(T & vh, uint32 basesperhash){
-    return vh.gnagna__this_is_so_badly_designed__kmerReverseComplement()>>(sizeof(T)*8-basesperhash*2);
-  }
-}
-
-#endif
diff --git a/src/mira/vluint.H b/src/mira/vluint.H
deleted file mode 100644
index 0851772..0000000
--- a/src/mira/vluint.H
+++ /dev/null
@@ -1,388 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 2003 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-
-#ifndef _bas_vluint_h_
-#define _bas_vluint_h_
-
-
-/*
-  This is a no-frills class for "large" integers as needed by MIRA, i.e., only
-  a tiny subset of functions has been implemented.
-
-  I had looked at
-  1. https://github.com/calccrypto/uint256_t
-  2. https://github.com/mjtryhorn/Boost.LargeInt
-  3. http://src.chromium.org/svn/trunk/src/net/base/int128.h
-  4. http://www.codef00.com/coding/uint128.h
-  5. https://github.com/bitcoin/bitcoin/blob/master/src/uint256.cpp and *.h
-  6. http://www.boost.org/doc/libs/1_55_0/libs/multiprecision/doc/html/index.html
-  and the discussion at
-    https://groups.google.com/forum/#!topic/boost-devel-archive/Maax-DSiE1M
-
-  Mode of action:
-  (1) uses a recursive mode (2*64 bit to define a 128, 2*128 to define a 256)
-  (2) is a generalisation of (1), probably to "infinity"
-  (3) & (4) use 2*64 bits
-  (5) Uses an array of 8*32 bits
-  (6) Arbitrary precision
-
-  Drawbacks:
-  (1) can do only up to 256 bits (and is "slow"); (2) is "slow"; (3) only 128 bits;
-  (4) only 128 bits; (5) only 256 bits (and "slow" as based on 32 bits)
-  (6) uses additional pointers (needs more memory)
-
-  I decided for an own class which can do abitrary sizes without additional
-  memory needed and relying on 64 bit operations. (5) was used as general
-  storage setup, combined with 64 bit storage and use of standard C++ library
-  calls for memory fills and comparisons where possible (they can be highly
-  optimised and better than hand-rolled functions).
-
-  TODO: I'm not sure the memory layout is the best possible. (5) uses a
-  low-to-high scheme, i.e., the uint64 with the lowest bits is in payload[0]
-  and the highest bits are in payload[n]. This is bad for comparison operators
-  which need to go backwards through the array, leading to memory faults at
-  every step! Doing it the other way round could be faster due to automatic
-  cache prefetching.
-
-  It would make sense for adding and subtracting (which are generally used
-  more often than shifting), but as MIRA does not use these (and they're not
-  implemented), turning the memory organisation around could make sense. TBD /
-  tested when I have time.
-
-  REMARKS:
-
-  1) I am in awe. Somehow, a comparator involving operator&(uint64 &) is >50%
-  slower than a comparator using operator&(Self &) when used in a std::sort()
-  (e.g. mirabait -b bs168data ...) jumping from 15s to 22s runtime. I suspect
-  the optimiser is able to change that into using the operator&= which does
-  not involve creating a temporary copy. But still ...
-
-  2) I am depressed. Using VLuint<64> instead of uint64_t leads to mirabait
-  doubling in runtime. This does not feel right.
-
-  3) I am scared because of the inexplicable segfault, see priv_compareLess()
-  below.
- */
-
-
-//#include <iostream>
-
-#include "stdinc/defines.H"
-
-// TODO: having extra namespace??? can we put that to VLuint without
-//  using the same space every time???
-namespace nsVLuint {
-  // bit reverse table
-  static const uint8 brtable[] =
-  {
-    0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
-    0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
-    0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
-    0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
-    0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
-    0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
-    0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
-    0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
-    0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
-    0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
-    0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
-    0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
-    0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
-    0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
-    0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
-    0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff
-  };
-
-  // kmer reverse and complement table
-  static const uint8 kractable[] =
-  {
-    0xff, 0xbf, 0x7f, 0x3f, 0xef, 0xaf, 0x6f, 0x2f, 0xdf, 0x9f, 0x5f, 0x1f, 0xcf, 0x8f, 0x4f, 0xf,
-    0xfb, 0xbb, 0x7b, 0x3b, 0xeb, 0xab, 0x6b, 0x2b, 0xdb, 0x9b, 0x5b, 0x1b, 0xcb, 0x8b, 0x4b, 0xb,
-    0xf7, 0xb7, 0x77, 0x37, 0xe7, 0xa7, 0x67, 0x27, 0xd7, 0x97, 0x57, 0x17, 0xc7, 0x87, 0x47, 0x7,
-    0xf3, 0xb3, 0x73, 0x33, 0xe3, 0xa3, 0x63, 0x23, 0xd3, 0x93, 0x53, 0x13, 0xc3, 0x83, 0x43, 0x3,
-    0xfe, 0xbe, 0x7e, 0x3e, 0xee, 0xae, 0x6e, 0x2e, 0xde, 0x9e, 0x5e, 0x1e, 0xce, 0x8e, 0x4e, 0xe,
-    0xfa, 0xba, 0x7a, 0x3a, 0xea, 0xaa, 0x6a, 0x2a, 0xda, 0x9a, 0x5a, 0x1a, 0xca, 0x8a, 0x4a, 0xa,
-    0xf6, 0xb6, 0x76, 0x36, 0xe6, 0xa6, 0x66, 0x26, 0xd6, 0x96, 0x56, 0x16, 0xc6, 0x86, 0x46, 0x6,
-    0xf2, 0xb2, 0x72, 0x32, 0xe2, 0xa2, 0x62, 0x22, 0xd2, 0x92, 0x52, 0x12, 0xc2, 0x82, 0x42, 0x2,
-    0xfd, 0xbd, 0x7d, 0x3d, 0xed, 0xad, 0x6d, 0x2d, 0xdd, 0x9d, 0x5d, 0x1d, 0xcd, 0x8d, 0x4d, 0xd,
-    0xf9, 0xb9, 0x79, 0x39, 0xe9, 0xa9, 0x69, 0x29, 0xd9, 0x99, 0x59, 0x19, 0xc9, 0x89, 0x49, 0x9,
-    0xf5, 0xb5, 0x75, 0x35, 0xe5, 0xa5, 0x65, 0x25, 0xd5, 0x95, 0x55, 0x15, 0xc5, 0x85, 0x45, 0x5,
-    0xf1, 0xb1, 0x71, 0x31, 0xe1, 0xa1, 0x61, 0x21, 0xd1, 0x91, 0x51, 0x11, 0xc1, 0x81, 0x41, 0x1,
-    0xfc, 0xbc, 0x7c, 0x3c, 0xec, 0xac, 0x6c, 0x2c, 0xdc, 0x9c, 0x5c, 0x1c, 0xcc, 0x8c, 0x4c, 0xc,
-    0xf8, 0xb8, 0x78, 0x38, 0xe8, 0xa8, 0x68, 0x28, 0xd8, 0x98, 0x58, 0x18, 0xc8, 0x88, 0x48, 0x8,
-    0xf4, 0xb4, 0x74, 0x34, 0xe4, 0xa4, 0x64, 0x24, 0xd4, 0x94, 0x54, 0x14, 0xc4, 0x84, 0x44, 0x4,
-    0xf0, 0xb0, 0x70, 0x30, 0xe0, 0xa0, 0x60, 0x20, 0xd0, 0x90, 0x50, 0x10, 0xc0, 0x80, 0x40, 0x0
-  };
-}
-
-template<unsigned int VLBITS>
-class VLuint
-{
-protected:
-  typedef uint64 base_type;
-
-  static_assert(std::is_pod<base_type>::value,"base_type must be a POD type in template class VLUint<>");
-  static_assert(sizeof(base_type) >= 4, "base_type must be at least 32 bit wide in template class VLUint<>");
-  static_assert(sizeof(base_type) == 8, "base_type must be 64 bit wide in template class VLUint<> for function reverseComplement(). If not, need to rewrite that function!");
-
-  enum { WIDTH=VLBITS/(8*sizeof(base_type)) };
-  base_type payload[WIDTH];
-
-  typedef VLuint<VLBITS> Self;
-
-  //Functions
-private:
-  // general comparison function
-  // to use like in operator<()
-  inline int priv_compareTo(const Self & other) const {
-    for(int i = WIDTH-1; i >= 0; --i) {
-      if(payload[i] < other.payload[i]) return -1;
-      if(payload[i] > other.payload[i]) return 1;
-    }
-    return 0;
-  }
-
-  // so, here's one hell of a problem: the code below segfaults quickly in
-  // mirabait (compiled with a VLuint<512>) on large k (e.g. -k 255)!
-  //
-  // This is *totally* the same code as the general priv_compareTo() function
-  // above, except one if-line has been taken out. And it segfaults??? I have not
-  // the slightest idea why ... I'm scared.
-  //
-  // seen 16.08.2014 on OSX, gcc 4.8.2, no optimisation or full -O3 + others
-  //
-  // inline int priv_compareLess(const Self & other) const {
-  //   for(int i = WIDTH-1; i >= 0; --i) {
-  //     if(payload[i] < other.payload[i]) return -1;
-  //     // if(payload[i] > other.payload[i]) return 1;
-  //   }
-  //   return 0;
-  // }
-
-public:
-  // STD. CONSTRUCTOR
-  //
-  // Note that no memory is cleared here, i.e., can contain random values upon
-  // instantiation
-  VLuint() {};
-
-  // ASSIGNMENT CONSTRUCTOR
-  //
-  // I have them explicit to find/prevent unexpected conversions
-  explicit VLuint(base_type x) {
-    //cout << "ctor= int " << this << " ";
-    payload[0]=x;
-    std::fill(&payload[1], &payload[WIDTH], 0);
-  };
-
-  // Std. output operator (which is more for debugging than anything really useful)
-  friend std::ostream & operator<<(std::ostream &ostr, Self const &vl) {
-    //ostr << "W " << WIDTH << " ";
-    for(uint32 i=WIDTH; i>0; ){
-      ostr << std::hex << vl.payload[--i] << " ";
-    }
-    return ostr;
-  }
-
-  // ASSIGNMENT
-  Self & operator=(const Self &other) {
-    if(&other != this) {
-      std::copy(&other.payload[0], &other.payload[WIDTH], &payload[0]);
-    }
-    return *this;
-  }
-
-  Self & operator=(const base_type x) {
-    //cout << "opor= int " << this << " ";
-    payload[0]=x;
-    std::fill(&payload[1], &payload[WIDTH], 0);
-    return *this;
-  }
-
-  // COMPARATORS
-  inline bool operator==(const Self & other) const {
-    return std::equal(&other.payload[0], &other.payload[WIDTH], &payload[0]);
-  }
-  inline bool operator!=(const Self & other) const {
-    return !(*this==other);
-  }
-
-  inline bool operator<(const Self & other) const {
-    return (priv_compareTo(other) < 0);
-  }
-
-  // Segfaults, see comments for priv_compareLess() above
-  //inline bool operator<(const Self & other) const {
-  //  return (priv_compareLess(other) < 0);
-  //}
-
-
-  // OPERATORS
-  inline Self & operator--() {
-    for(int i = 0; payload[i++]--==0 && i < WIDTH; ) {};
-    return *this;
-  }
-  inline Self & operator++() {
-    for(int i = 0; ++payload[i++]==0 && i < WIDTH; ) {};
-    return *this;
-  }
-
-  inline Self operator&=(const Self & other) {
-    for(int i = 0; i < WIDTH; ++i) {payload[i]&=other.payload[i];}
-    return *this;
-  }
-
-  inline Self operator~() const {
-    Self ret;
-    for(int i = 0; i < WIDTH; ++i) {ret.payload[i]=~payload[i];}
-    return ret;
-  }
-
-  inline Self operator&(const Self & other) const {
-    Self ret;
-    for(int i = 0; i < WIDTH; ++i) {ret.payload[i]=payload[i] & other.payload[i];}
-    return ret;
-  }
-
-// disabled, 50% slower in sort() than operator&(Self &) above
-//  inline Self operator&(const base_type & other) const {
-//    Self ret;
-//    ret.payload[0]=payload[0] & other;
-//    std::fill(&ret.payload[1], &ret.payload[WIDTH], 0);
-//    return ret;
-//  }
-
-  inline Self operator|=(const base_type & other) {
-    payload[0]|=other;
-    return *this;
-  }
-
-  inline Self & operator>>=(base_type shift) {
-    Self tmp(*this);
-    std::fill(&payload[0], &payload[WIDTH], 0);
-    int k = shift / (sizeof(base_type)*8);
-    shift = shift % (sizeof(base_type)*8);
-    for (int i = 0; i < WIDTH; ++i) {
-      if (i-k-1 >= 0 && shift != 0) payload[i-k-1] |= (tmp.payload[i] << ((sizeof(base_type)*8)-shift));
-      if (i-k >= 0) payload[i-k] |= (tmp.payload[i] >> shift);
-    }
-    return *this;
-  }
-  inline Self operator>>(base_type shift) const {
-    return Self(*this) >>= shift;
-  }
-
-  inline Self & operator<<=(base_type shift) {
-    Self tmp(*this);
-    std::fill(&payload[0], &payload[WIDTH], 0);
-    int k = shift / (sizeof(base_type)*8);
-    shift = shift % (sizeof(base_type)*8);
-    for (int i = 0; i < WIDTH; ++i) {
-      if (i+k+1 < WIDTH && shift != 0) payload[i+k+1] |= (tmp.payload[i] >> ((sizeof(base_type)*8)-shift));
-      if (i+k < WIDTH) payload[i+k] |= (tmp.payload[i] << shift);
-    }
-    return *this;
-  }
-
-  // CONVERTORS
-  //
-  // I have them explicit to find/prevent unexpected conversions
-  // BaCh: 06.02.2015
-  // Do not use size_t as cast target: on OSX, uint64 and size_t
-  //  are NOT the same types! And I cannot make two conversion
-  //  functions as under Linux (and others?), they are the same
-  //  and the compiler complains about ambiguous conversions.
-  // The base type of vluint has been defined as uint64 anyway.
-  inline explicit operator uint64() {
-    return payload[0];
-  }
-  inline explicit operator bool() {
-    bool ret=false;
-    for(int i = 0; i < WIDTH; ++i) {
-      ret|=payload[i];
-    };
-    return ret;
-  }
-
-  // HASH FUNCTION
-  //
-  // to facilitate simple hashing where needed in C++ containers like
-  // unordered_set/*_map. See vhash.H on how to do this.
-  inline size_t hash() const {
-    size_t ret=0;
-    for (int hi = 0; hi < WIDTH; ++hi) {
-      //boost::hash_combine(ret, payload[hi]);
-      // To not to have to include boost here, do as BOOST does in hash_combine()
-      ret ^= std::hash<base_type>()(payload[hi]) + 0x9e3779b9 + (ret << 6) + (ret >> 2);
-    }
-    // this was for testing, does not seem good
-    //    ret ^= (ret>>32) | (ret<<32);
-    return ret;
-  }
-
-  // Other
-  // this function + the table it uses should somehow move to a vhash class!
-  inline Self gnagna__this_is_so_badly_designed__kmerReverseComplement() const {
-    Self ret;
-    for(int pi = 0; pi < WIDTH; ++pi) {
-      base_type oldpl=payload[pi];
-      ret.payload[WIDTH-1-pi]=
-	(static_cast<base_type>(nsVLuint::kractable[oldpl&0xFF])<<56)
-	| (static_cast<base_type>(nsVLuint::kractable[(oldpl >>  8) &0xFF])<<48)
-	| (static_cast<base_type>(nsVLuint::kractable[(oldpl >> 16) &0xFF])<<40)
-	| (static_cast<base_type>(nsVLuint::kractable[(oldpl >> 24) &0xFF])<<32)
-	| (static_cast<base_type>(nsVLuint::kractable[(oldpl >> 32) &0xFF])<<24)
-	| (static_cast<base_type>(nsVLuint::kractable[(oldpl >> 40) &0xFF])<<16)
-	| (static_cast<base_type>(nsVLuint::kractable[(oldpl >> 48) &0xFF])<<8)
-	| (static_cast<base_type>(nsVLuint::kractable[(oldpl >> 56) &0xFF]))
-	;
-    }
-    return ret;
-  }
-
-/*
-  // Not sure if needed
-  inline void reverseComplement() {
-    Self tmp(*this);
-    for(int pi = 0; pi < WIDTH; ++pi) {
-      base_type oldpl=tmp.payload[pi];
-      payload[WIDTH-1-pi]=
-	(static_cast<base_type>(nsVLuint::bractable[oldpl&0xFF])<<56)
-	| (static_cast<base_type>(nsVLuint::bractable[(oldpl >>  8) &0xFF])<<48)
-	| (static_cast<base_type>(nsVLuint::bractable[(oldpl >> 16) &0xFF])<<40)
-	| (static_cast<base_type>(nsVLuint::bractable[(oldpl >> 24) &0xFF])<<32)
-	| (static_cast<base_type>(nsVLuint::bractable[(oldpl >> 32) &0xFF])<<24)
-	| (static_cast<base_type>(nsVLuint::bractable[(oldpl >> 40) &0xFF])<<16)
-	| (static_cast<base_type>(nsVLuint::bractable[(oldpl >> 48) &0xFF])<<8)
-	| (static_cast<base_type>(nsVLuint::bractable[(oldpl >> 56) &0xFF]))
-	;
-    }
-  }
-*/
-
-};
-
-
-#endif
diff --git a/src/mira/warnings.C b/src/mira/warnings.C
deleted file mode 100644
index e774c6c..0000000
--- a/src/mira/warnings.C
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 2003 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-#include "mira/warnings.H"
-
-#include "errorhandling/errorhandling.H"
-#include "util/fmttext.H"
-
-using namespace std;
-
-// Plain vanilla constructor
-Warnings::Warnings()
-{
-  FUNCSTART("Warnings::Warnings()");
-
-  zeroVars();
-  init();
-
-  FUNCEND();
-}
-
-void Warnings::zeroVars()
-{
-  FUNCSTART("void Warnings::zeroVars()");
-  FUNCEND();
-}
-
-void Warnings::init()
-{
-  FUNCSTART("void Warnings::init()");
-  FUNCEND();
-}
-
-
-
-Warnings::~Warnings()
-{
-  FUNCSTART("Warnings::~Warnings()");
-
-  discard();
-
-  FUNCEND();
-}
-
-
-void Warnings::discard()
-{
-  FUNCSTART("Warnings::discard()");
-
-  zeroVars();
-
-  FUNCEND();
-}
-
-void Warnings::priv_setWarning(std::string & shortcode,uint32 level,std::string & title,std::string & message,bool donotdump,bool add)
-{
-  FUNCSTART("void Warnings::priv_setWarning(std::string & shortcode,uint32 level,std::string & title,std::string & message,bool add)");
-
-  BUGIFTHROW(level>2,"level>2 ???");
-  if(add){
-    auto mI=WA_messages.find(shortcode);
-    if(mI==WA_messages.end()){
-      WA_messages[shortcode]=warnmsg_t(title,message,level);
-    }else{
-      mI->second.warnlevel=level;
-      mI->second.title=title;
-      mI->second.message+=message;
-    }
-  }else{
-    WA_messages[shortcode]=warnmsg_t(title,message,level);
-  }
-  priv_dumpSingleWarning(*(WA_messages.find(shortcode)),true,cout);
-}
-
-ostream & operator<<(ostream &ostr, Warnings const &war)
-{
-  FUNCSTART("friend ostream & Warnings::operator<<(ostream &ostr, const  &war)");
-
-  for(uint32 wl=0; wl<3; ++wl){
-    for(auto & wme : war.WA_messages){
-      if(wme.second.warnlevel==wl){
-	war.priv_dumpSingleWarning(wme,true,ostr);
-      }
-    }
-  }
-
-  FUNCEND();
-  return ostr;
-}
-
-void Warnings::priv_dumpSingleWarning(const std::pair<const std::string, warnmsg_t> & wm, bool withheader, ostream & ostr) const
-{
-  if(withheader){
-    ostr << "-------- ";
-    if(wm.second.warnlevel==0){
-      ostr << "CRITICAL";
-    }else if(wm.second.warnlevel==1){
-      ostr << "MEDIUM";
-    }else if(wm.second.warnlevel==2){
-      ostr << "MINOR";
-    }
-    ostr << " warning --------\n\n";
-  }
-  ostr << "MIRA warncode: " << wm.first << "\nTitle: " << wm.second.title << "\n\n";
-  ostr << FmtText::wordWrap(wm.second.message,80) << '\n';
-}
-
-
-void Warnings::dumpWarnings() const
-{
-  FUNCSTART("void Warnings::dumpWarnings() const");
-
-  if(WA_filebasename.empty()){
-    cout << *this;
-  }else{
-    for(uint32 wl=0; wl<3; ++wl){
-      string fname(WA_filebasename);
-      if(wl==0){
-	fname+="_critical";
-      }else if(wl==1){
-	fname+="_medium";
-      }else if(wl==2){
-	fname+="_minor";
-      }
-      fname+=".txt";
-      ofstream fout(fname, ios::out | ios::trunc);
-      bool hadoutput=false;
-      for(auto & wme : WA_messages){
-	if(wme.second.warnlevel==wl){
-	  if(hadoutput) fout << "\n";
-	  hadoutput=true;
-	  priv_dumpSingleWarning(wme,false,fout);
-	  fout << "\n--------------------------------------------------------------------------------\n";
-	}
-      }
-      fout.close();
-      if(fout.fail()){
-	MIRANOTIFY(Notify::FATAL,"Could not write to " << fname << " ?");
-      }
-    }
-  }
-}
-
-void Warnings::dumpWarning(std::string & shortcode, ostream & ostr) const
-{
-  auto mI=WA_messages.find(shortcode);
-  if(mI!=WA_messages.end()){
-    priv_dumpSingleWarning(*mI,true,ostr);
-  }
-}
diff --git a/src/mira/warnings.H b/src/mira/warnings.H
deleted file mode 100644
index a981d7e..0000000
--- a/src/mira/warnings.H
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 2013 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-#ifndef _mira_warnings_h_
-#define _mira_warnings_h_
-
-#include <ostream>
-
-#include "stdinc/defines.H"
-
-#include <unordered_map>
-
-
-class Warnings
-{
-  //Variables
-private:
-
-  struct warnmsg_t {
-    std::string title;
-    std::string message;
-    uint32 warnlevel;
-
-    warnmsg_t(std::string & t,std::string & m,uint32 wl) : title(t), message(m), warnlevel(wl) {};
-    warnmsg_t() {}; // need this for emplace, should however never be used "normally"
-  };
-
-  std::unordered_map<std::string,warnmsg_t> WA_messages;
-
-  std::string WA_filebasename;
-
-public:
-
-
-  //Functions
-private:
-  void init();
-  void zeroVars();
-
-  void priv_setWarning(std::string & shortcode,
-		       uint32 level,
-		       std::string & title,
-		       std::string & message,
-		       bool donotdump,
-		       bool add);
-
-  void priv_dumpSingleWarning(const std::pair<const std::string, warnmsg_t> & wm,
-			      bool withheader, std::ostream & ostr) const;
-
-public:
-  Warnings();
-  Warnings(Warnings const &other);
-  ~Warnings();
-
-  Warnings const & operator=(Warnings const & other);
-  friend std::ostream & operator<<(std::ostream &ostr, Warnings const &war);
-
-  void discard();
-
-  inline void setWarning(std::string & shortcode,
-			 uint32 level,
-			 std::string & title,
-			 std::string & message) {priv_setWarning(shortcode,level,title,message,false,false);}
-  inline void setWarning(const char * shortcode,
-			 uint32 level,
-			 const char * title,
-			 std::string & message) {
-    std::string sc(shortcode);
-    std::string ti(title);
-    priv_setWarning(sc,level,ti,message,false,false);
-  }
-  inline void setWarning(const char * shortcode,
-			 uint32 level,
-			 const char * title,
-			 const char * message) {
-    std::string sc(shortcode);
-    std::string ti(title);
-    std::string mg(message);
-    priv_setWarning(sc,level,ti,mg,false,false);
-  }
-  inline void addToWarning(std::string & shortcode,
-			   uint32 level,
-			   std::string & title,
-			   std::string & message) {priv_setWarning(shortcode,level,title,message,false,true);}
-
-  void dumpWarnings() const;
-  void dumpWarning(std::string & shortcode, std::ostream & ostr) const;
-  void dumpWarning(const char * shortcode, std::ostream & ostr) const {
-    std::string sc(shortcode); dumpWarning(sc,ostr);
-  }
-  void setOutputPath(const std::string & p) {WA_filebasename=p;}
-  void setOutputPath(const char * p) {WA_filebasename=p;}
-};
-
-
-#endif
diff --git a/src/modules/Makefile.am b/src/modules/Makefile.am
deleted file mode 100644
index 10a2a0a..0000000
--- a/src/modules/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-AM_CPPFLAGS = -I$(top_srcdir)/src $(all_includes)
-
-noinst_LIBRARIES = libmiramodules.a
-libmiramodules_a_SOURCES= mod_sigconex.C mod_scaffold.C mod_bait.C mod_dbgreplay.C mod_diff.C mod_mer.C mod_mira.C mod_convert.C mod_memestim.C mod_tagsnp.C misc.C
-noinst_HEADERS= mod_sigconex.H mod_scaffold.H mod_bait.H mod_diff.H mod_mer.H mod_mira.H mod_convert.H mod_memestim.H mod_tagsnp.H misc.H
diff --git a/src/modules/misc.C b/src/modules/misc.C
deleted file mode 100644
index 0fda7e1..0000000
--- a/src/modules/misc.C
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
- *   Krebsforschungszentrum, DKFZ Heidelberg) and Bastien Chevreux
- * Copyright (C) 2000 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-#include "modules/misc.H"
-
-#include "stdinc/defines.H"
-#include "stdinc/types.H"
-#include "io/generalio.H"
-#include "errorhandling/errorhandling.H"
-
-#include <iostream>
-#include <fstream>
-
-#include <cstdlib>      // exit() on Cygwin
-
-
-using namespace std;
-
-
-extern const char compileinfo[];
-
-
-void dumpStdMsg()
-{
-  cout <<
-    "To (un-)subscribe the MIRA mailing lists, see:\n"
-    "\thttp://www.chevreux.org/mira_mailinglists.html\n\n"
-    "After subscribing, mail general questions to the MIRA talk mailing list:\n"
-    "\tmira_talk at freelists.org\n\n"
-    "\nTo report bugs or ask for features, please use the SourceForge ticketing\nsystem at:\n"
-    "\thttp://sourceforge.net/p/mira-assembler/tickets/\n"
-    "This ensures that requests do not get lost.\n\n\n";
-
-  bool addnl=false;
-
-  cout << compileinfo;
-#ifdef CEBUGFLAG
-  cout << "Compiled in debug output mode.\n";
-  addnl=true;
-#endif
-#ifdef TRACEFLAG
-  cout << "Compiled with trace mode.\n";
-  addnl=true;
-#endif
-#ifdef BOUNDTRACKFLAG
-  cout << "Compiled in boundtracking mode.\n";
-  addnl=true;
-#endif
-#ifdef BUGTRACKFLAG
-  cout << "Compiled in bugtracking mode.\n";
-  addnl=true;
-#endif
-#ifdef PARANOIABUGTRACKFLAG
-  cout << "Compiled in paranoia bugtracking mode.\n";
-  addnl=true;
-#endif
-#ifdef ENABLE64
-  cout << "Compiled with ENABLE64 activated.\n";
-  addnl=true;
-#else
-  cout << "Compiled with ENABLE64 de-activated.\n";
-  addnl=true;
-#endif
-#ifdef MIRAMEMORC
-  cout << "Compiled with memory overrun checks, MIRA *will* be slower.\n";
-  addnl=true;
-#endif
-
-  cout << "Runtime settings (sorry, for debug):"
-       << "\n\tSize of size_t  : " << sizeof(size_t)
-       << "\n\tSize of uint32  : " << sizeof(uint32)
-       << "\n\tSize of uint32_t: " << sizeof(uint32_t)
-       << "\n\tSize of uint64  : " << sizeof(uint64)
-       << "\n\tSize of uint64_t: " << sizeof(uint64_t)
-       << "\nCurrent system: ";
-  {
-    cout.flush();
-    int tmp=system("uname -a");
-    // don't complain about unused variable
-    (void) tmp;
-  }
-
-  if(addnl) cout << endl;
-}
-
-
-General::strintmap General::GE_nameselectionmap;
-bool General::GE_namesread=false;
-
-void General::makeSelectionStringSet(string & filename)
-{
-  FUNCSTART("void makeSelectionStringSet(string & filename)");
-
-  ifstream fin;
-  fin.open(filename.c_str(), ios::in);
-  if(!fin){
-    MIRANOTIFY(Notify::FATAL, "File not found: " << filename);
-  }
-  fin.seekg(0, ios::beg);
-
-  string elemname, dummy;
-  strintmap::iterator nI;
-  uint32 numread=0;
-  while(GeneralIO::readKeyValue(fin, elemname,dummy)){
-    nI=GE_nameselectionmap.find(elemname);
-    if(nI==GE_nameselectionmap.end()) {
-      GE_nameselectionmap[elemname]=numread;
-      numread++;
-    }
-  }
-  fin.close();
-  GE_namesread=true;
-
-  if(numread>0 && GE_nameselectionmap.empty()) {
-    cerr << "ehhh?";
-    exit(10);
-  }
-
-  FUNCEND();
-}
-
-
-
-bool General::checkNamePresence(string & name)
-{
-  if(!GE_namesread) return true;
-  return (GE_nameselectionmap.find(name) != GE_nameselectionmap.end());
-}
-
-bool General::hasNames()
-{
-  return GE_namesread;
-}
-
-size_t General::getNameOrder(const string & name)
-{
-  if(GE_nameselectionmap.empty()) return (0-1);
-  strintmap::iterator nI=GE_nameselectionmap.find(name);
-  if (nI == GE_nameselectionmap.end()) return (0-1);
-  return nI->second;
-}
-
diff --git a/src/modules/misc.H b/src/modules/misc.H
deleted file mode 100644
index 3faefbf..0000000
--- a/src/modules/misc.H
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
- *   Krebsforschungszentrum, DKFZ Heidelberg) and Bastien Chevreux
- * Copyright (C) 2000 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-#ifndef _modmira_h_
-#define _modmira_h_
-
-#include <string>
-
-#include <unordered_map>
-
-#include "stdinc/types.H"
-
-
-void dumpStdMsg();
-
-class General {
-  typedef std::unordered_map<std::string, size_t> strintmap;
-  static strintmap GE_nameselectionmap;
-  static bool GE_namesread;
-
-public:
-  static void makeSelectionStringSet(std::string & filename);
-  static bool checkNamePresence(std::string & name);
-  static bool hasNames();
-  static size_t getNameOrder(const std::string & name);
-};
-
-
-#endif
diff --git a/src/modules/mod_bait.C b/src/modules/mod_bait.C
deleted file mode 100644
index 5c79ae3..0000000
--- a/src/modules/mod_bait.C
+++ /dev/null
@@ -1,868 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
- *   Krebsforschungszentrum, DKFZ Heidelberg) and Bastien Chevreux
- * Copyright (C) 2000 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-#include <getopt.h>
-
-#include <boost/algorithm/string.hpp>
-#include <boost/filesystem.hpp>
-
-#include "modules/mod_bait.H"
-#include "util/fmttext.H"
-
-#include "version.H"
-
-
-using namespace std;
-
-
-vector<MIRAParameters> MiraBait::MB_Pv;
-
-string MiraBait::MB_fromtype;
-string MiraBait::MB_totype;
-string MiraBait::MB_baitfromtype;
-
-uint8 MiraBait::MB_tortype;
-
-list<string> MiraBait::MB_infiles;
-list<string> MiraBait::MB_baitfiles;
-string MiraBait::MB_hitpath;
-string MiraBait::MB_misspath;
-string MiraBait::MB_nameprefix;
-
-string MiraBait::MB_hashstatfname;
-
-bool   MiraBait::MB_deletestaronlycolumns=false;
-bool   MiraBait::MB_mustdeletetargetfiles=true;
-bool   MiraBait::MB_wantbaithits=true;
-bool   MiraBait::MB_wantbaitmiss=false;
-bool   MiraBait::MB_fwdandrev=true;
-bool   MiraBait::MB_changeseqcase=true;
-bool   MiraBait::MB_mergeoutput=false;
-int32  MiraBait::MB_numbaithits=1;
-
-list<char> MiraBait::MB_filepairinfo;    // p = 2 files, P = 1 file interleave
-uint32 MiraBait::MB_basesperhash=0;
-uint64 MiraBait::MB_baitpoolsize=0;
-uint64 MiraBait::MB_numreadsread=0;
-uint64 MiraBait::MB_numpairsbaited=0;
-uint64 MiraBait::MB_numpairsmissed=0;
-uint64 MiraBait::MB_numunpairedbaited=0;
-uint64 MiraBait::MB_numunpairedmissed=0;
-
-uint64 MiraBait::MB_numclippedreadsinload; // number of reads which have clips already when loaded (CAF/MAF)
-
-list<MiraBait::wqueueunit_t> MiraBait::MB_workqueue;
-MiraBait::files_t MiraBait::MB_files;
-
-unordered_map<string,uint8> MiraBait::MB_fromtypemap = {
-  {"fastq",Read::AS_FASTQ},
-  {"fasta",Read::AS_FASTA},
-  {"gb",Read::AS_GBF},
-  {"gbf",Read::AS_GBF},
-  {"gbk",Read::AS_GBF},
-  {"gbff",Read::AS_GBF},
-  {"caf",Read::AS_CAF},
-  {"maf",Read::AS_MAF},
-  {"exp",Read::AS_GAP4DA},
-  {"phd",Read::AS_PHD},
-};
-
-unordered_map<string,uint8> MiraBait::MB_totypemap = {
-  {"fastq",Read::AS_FASTQ},
-  {"fasta",Read::AS_FASTA},
-  {"caf",Read::AS_CAF},
-  {"scaf",Read::AS_CAF},
-  {"maf",Read::AS_MAF},
-  {"txt",Read::AS_READNAME},
-};
-
-
-MiraBait::~MiraBait()
-{
-}
-
-void MiraBait::usage()
-{
-//hdiIpPrvb:f:t:o:a:k:L:n:
-  cout << "mirabait\t(MIRALIB version " << MIRALIBVERSION << ")\n";
-  cout << "Author: Bastien Chevreux\t(bach at chevreux.org)\n\n";
-
-  cout << FmtText::wordWrap("mirabait selects reads from a read collection which are partly similar or equal to sequences defined as target baits. Similarity is defined by finding a user-adjustable number of common k-mers (sequences of k consecutive bases) which are the same in the bait sequences and the screened sequences to be selected, either in forward or forward/reverse complement direction.\nWhen used on paired files, selects sequences where at least one mate matches.\n");
-  cout << "\nUsage:\n";
-  cout << "mirabait [options]"
-    "\n\t\t{-b baitfile [-b ...] | -L file}"
-    "\n\t\t{-p file_1 file_2 | -P file3}* [file4 ...]\n\n";
-  cout << "Main options:\n";
-  cout << "\t-b file\t\tLoad bait sequences from file\n"
-    "\t\t\t (multiple -b allowed)\n"
-    "\t-p file1 file2\tLoad paired sequences to search from file1 and file2\n"
-    "\t\t\t Files must contain same number of sequences, sequence \n"
-    "\t\t\t names must be in same order.\n"
-    "\t\t\t Multiple -p allowed, but must come before non-paired\n"
-    "\t\t\t files.\n"
-    "\t-P file\t\tLoad paired sequences from file\n"
-    "\t\t\t File must be interleaved: pairs must follow each other,\n"
-    "\t\t\t non-pairs are not allowed.\n"
-    "\t\t\t Multiple -p allowed, but must come before non-paired\n"
-    "\t\t\t files.\n";
-
-  cout << "\n"
-    "\t-L file\t\tDo not compute hash statistics, load from file\n"
-    "\t\t\t (which the must be a mirabait hash statistics file).\n";
-
-  cout << "\n"
-    "\t-k\t\tk-mer, length of bait in bases (<=256, default=31)\n"
-    "\t-n\t\tIf >0: minimum number of k-mer baits needed (default=1)\n"
-    "\t\t\tIf <=0: allowed number of missed kmers over sequence\n"
-    "\t\t\t        length\n"
-    "\t-i\t\tSelects sequences that do not hit bait\n"
-    "\t-I\t\tSelects sequences that hit and do not hit bait (to\n"
-    "\t\t\t different files)\n"
-    "\t-r\t\tNo checking of reverse complement direction\n"
-    "\t-c\t\tNo case change of sequence to denote bait hits\n";
-
-  cout << "\nOptions for defining files types to load and save:\n";
-  cout << FmtText::wordWrap("Normally, mirabait recognises the file types according to the file extension. In cases you need to force a certain file type because the file extension is non-standard, use the following options:\n");
-  cout << "\t-f <fromtype>\tload sequences from this type of files, where type is:\n"
-    "\t   caf\t\t sequences from CAF\n"
-    "\t   fasta\t sequences from a FASTA\n"
-    "\t   fastq\t sequences from a FASTQ\n"
-    "\t   gb[f|k|ff]\t sequences from GenBank\n"
-    "\t   maf\t\t sequences from MAF\n"
-    "\t   phd\t\t sequences from a PHD\n"
-    ;
-  cout << "\t-F <fromtype>\tload bait sequences from this type of file\n"
-    "\t\t\t For supported file types, see -f\n";
-  cout << "\t-t <totype>\twrite the sequences to this type;\n"
-    "\t   caf\t\t sequences to CAF\n"
-    "\t   fasta\t sequences to FASTA (saved wo quality values)\n"
-    "\t   fastq\t sequences to FASTQ\n"
-    "\t   maf\t\t sequences to MAF\n"
-    "\t   txt\t\t sequence names to text file\n";
-
-  cout << "\nOptions for output definition:\n";
-  cout << FmtText::wordWrap("Normally, mirabait writes separate result files (named 'bait_match_*' and 'bait_miss_*') for each input to the current directory. For changing this behaviour, use these options:\n");
-  cout << "\t-N name\t\tChange the prefix 'bait' to <name>\n"
-    "\t\t\t Has no effect if -o/-O is used and targets are not\n"
-    "\t\t\t directories\n";
-  cout << "\t-o <path>\tSave sequences matching bait to path\n"
-    "\t\t\t If path is a directory, write separate files into this\n"
-    "\t\t\t directory. If not, combine all matching sequences from\n"
-    "\t\t\t the input file(s) into a single file specified by the\n"
-    "\t\t\t path.\n";
-  cout << "\t-O <path>\tLike -o, but for sequences not matching\n";
-
-//  cout << "\n"
-//    "\t-o\t\tfastq quality Offset (only for -f = 'fastq')\n"
-//    "\t\t\t Offset of quality values in FASTQ file. Default: 33\n"
-//    "\t\t\t A value of 0 tries to automatically recognise.\n";
-
-
-
-//  cout << "\t-a <string>\tString with MIRA parameters to be parsed\n"
-//    "\t\t\t Useful when setting parameters affecting consensus\n"
-//    "\t\t\t calling like -CO:mrpg etc.\n"
-//    "\t\t\t E.g.: -a \"454_SETTINGS -CO:mrpg=3\"\n";
-
-  cout << "\nExamples:\n"
-    "  mirabait -b b.fasta file.fastq"
-    "\n  mirabait -b b1.fasta -b b2.gbk file.fastq"
-    "\n  mirabait -b b.fasta -p file_1.fastq file_2.fastq"
-    "\n  mirabait -b b.fasta -p file_1.fastq file_2.fastq -P file3.fasta file4.caf"
-    "\n  mirabait -I -b b.fasta -p file_1.fastq file_2.fastq -P file3.fasta file4.caf"
-    "\n  mirabait -k 27 -n 10 -b b.fasta file.fastq"
-    "\n  mirabait -F fasta -f fastq -b b.dat file.dat"
-    "\n  mirabait -o /dev/shm/ -b b.fasta -p file_1.fastq file_2.fastq"
-    "\n  mirabait -o /dev/shm/match -b b.fasta -p file_1.fastq file_2.fastq"
-    "\n";
-}
-
-
-uint8 MiraBait::checkFromType(string & fromtype)
-{
-  auto mI=MB_fromtypemap.find(fromtype);
-  if(mI!=MB_fromtypemap.end()) return mI->second;
-  return Read::AS_ILLEGAL;
-}
-
-uint8 MiraBait::checkToType(string & totype)
-{
-  auto mI=MB_totypemap.find(totype);
-  if(mI!=MB_totypemap.end()) return mI->second;
-  return Read::AS_ILLEGAL;
-}
-
-
-
-uint8 MiraBait::setupRPIO(const string & filename, ReadGroupLib::ReadGroupID rgid, ReadPoolIO & rpio, uint8 & ziptype)
-{
-  ziptype=0;
-  string filetype;
-  string dummytostem;
-  string dummypathto;
-  if(MB_fromtype.empty()){
-    guessFileAndZipType(filename,dummypathto,dummytostem,filetype,ziptype);
-  }else{
-    filetype=MB_fromtype;
-  }
-
-  boost::to_lower(filetype);
-  uint8 rtype=checkFromType(filetype);
-
-  cout << "Loading data from " << filename << " (" << filetype << ")";
-
-  string fn2;
-  if(filetype=="fasta"){
-    fn2=filename+".qual";
-  }
-
-  string loadtype(filetype);
-  if(loadtype=="fasta"){
-    loadtype="fastanoqual";
-  }
-
-  rpio.registerFile(loadtype, filename, fn2, rgid, false);
-  return rtype;
-}
-
-void MiraBait::setupOutfiles(const string & fname, uint8 rtype, uint8 ziptype, ofstream & hitfout, ofstream & missfout)
-{
-  if(hitfout.is_open()) hitfout.close();
-  if(missfout.is_open()) missfout.close();
-
-  string pname(MB_nameprefix);
-  if(pname.empty()) pname="bait";
-  string matchpre(pname+"_match_");
-  string misspre(pname+"_miss_");
-
-  boost::filesystem::path fp(fname);
-  // if we work on zipped files, the ouput must get away the zip extension
-  if(ziptype){
-    fp=fp.parent_path() / fp.stem();  // boost::filesystem append operation
-  }
-
-  string hitname;
-  if(MB_mergeoutput && !MB_hitpath.empty()){
-    hitname=MB_hitpath;
-  }else{
-    hitname=MB_hitpath;
-    if(!hitname.empty()) hitname+='/';
-    hitname+=matchpre+fp.filename().string();
-  }
-  string missname;
-  if(MB_mergeoutput && !MB_misspath.empty()){
-    missname=MB_misspath;
-  }else{
-    missname=MB_misspath;
-    if(!missname.empty()) missname+='/';
-    missname+=misspre+fp.filename().string();
-  }
-
-  auto omode=ios::out;
-  if(MB_mergeoutput) omode|=ios::app;
-  if(MB_wantbaithits){
-    hitfout.open(hitname,omode);
-    if(!hitfout.is_open()){
-      cout.flush();
-      cerr << "\n\nCould not open " << hitname << ".\nDoes the path exist, is it writable? Is the disk full?";
-      exit(10);
-    }
-  }
-  if(MB_wantbaitmiss){
-    missfout.open(missname,omode);
-    if(!missfout.is_open()){
-      cout.flush();
-      cerr << "\n\nCould not open " << missname << ".\nDoes the path exist, is it writable? Is the disk full?";
-      exit(10);
-    }
-  }
-
-  if(MB_wantbaithits && MB_wantbaitmiss){
-    cout << ", sorting" << endl;
-  }else{
-    cout << ", filtering" << endl;
-  }
-  if(MB_wantbaithits){
-    cout << "+++ matches to " << hitname << endl;
-  }
-  if(MB_wantbaitmiss){
-    cout << "--- non-matches to " << missname << endl;
-  }
-}
-
-
-template<typename TVHASH_T>
-void MiraBait::baitReads(HashStatistics<TVHASH_T> & hs, const ReadPool & rp, vector<uint8> & take)
-{
-  take.clear();
-  take.resize(rp.size(),0);
-  for(uint32 rpi=0; rpi<take.size(); ++rpi){
-    if(rp[rpi].getLenClippedSeq() != rp[rpi].getLenSeq()){
-      ++MB_numclippedreadsinload;
-    }
-    uint32 neededhashes=static_cast<uint32>(MB_numbaithits);
-    if(MB_numbaithits<=0){
-      auto tmpnh=
-	static_cast<int32>(rp[rpi].getLenClippedSeq())-static_cast<int32>(MB_basesperhash-1)+MB_numbaithits;
-      if(tmpnh<0) tmpnh=0;
-      neededhashes=static_cast<uint32>(tmpnh);
-    }
-    if(hs.checkBaitHit(rp[rpi],MB_changeseqcase) >= neededhashes){
-      take[rpi]=1;
-    }
-  }
-}
-
-void MiraBait::saveWQueueElement(wqueueunit_t & wqu)
-{
-  FUNCSTART("void MiraBait::saveWQueueElement(wqueueunit_t & wqu)");
-
-  Read::setCoutType(MB_files.writetype);
-
-  uint64 numbaited=0;
-  uint64 numnonbaited=0;
-
-  auto t1I=wqu.take1.begin();
-  for(uint32 rpi=0; rpi<wqu.rp1.size(); ++rpi, ++t1I){
-    if(*t1I && MB_wantbaithits) {
-      MB_files.hitfout1 << wqu.rp1[rpi];
-      ++numbaited;
-    }else if(!*t1I && MB_wantbaitmiss){
-      MB_files.missfout1 << wqu.rp1[rpi];
-      ++numnonbaited;
-    }
-    if(wqu.pairstatus==PS_2FILES){
-      if(*t1I && MB_wantbaithits) {
-	if(MB_mergeoutput){
-	  MB_files.hitfout1 << wqu.rp2[rpi];
-	}else{
-	  MB_files.hitfout2 << wqu.rp2[rpi];
-	}
-      }else if(!*t1I && MB_wantbaitmiss){
-	if(MB_mergeoutput){
-	  MB_files.missfout1 << wqu.rp2[rpi];
-	}else{
-	  MB_files.missfout2 << wqu.rp2[rpi];
-	}
-      }
-    }
-  }
-
-  MB_numreadsread+=wqu.rp1.size()+wqu.rp2.size();
-
-  if(wqu.pairstatus==PS_NOPAIR){
-    MB_numunpairedbaited+=numbaited;
-    MB_numunpairedmissed+=numnonbaited;
-  }else if(wqu.pairstatus==PS_INTERLEAVE){
-    MB_numpairsbaited+=numbaited/2;
-    MB_numpairsmissed+=numnonbaited/2;
-  }else if(wqu.pairstatus==PS_2FILES){
-    MB_numpairsbaited+=numbaited;
-    MB_numpairsmissed+=numnonbaited;
-  }else{
-    MIRANOTIFY(Notify::INTERNAL,"Ummm ... unknown pairstatus " << static_cast<uint16>(wqu.pairstatus));
-  }
-
-//  MB_numreadsread+=rp.size();
-//  MB_numreadswritten+=rp.size();
-}
-
-
-template<typename TVHASH_T>
-void MiraBait::doBaitWithHS(HashStatistics<TVHASH_T> & mbhs)
-{
-  FUNCSTART("void MiraBait::doBaitWithHS(HashStatistics<TVHASH_T> & mbhs)");
-  {
-    if(!MB_hashstatfname.empty()){
-      cout << "Loading from existing hashstat file ... "; cout.flush();
-      mbhs.loadHashStatistics(MB_hashstatfname);
-      cout << "done.\n";
-      if(MB_basesperhash!=0){
-	if(mbhs.getBasesPerHash()!=MB_basesperhash){
-	  cout << "Error: kmer size set for mirabait (" << MB_basesperhash
-	       << ") is not equal to the kmer size loaded from file ("
-	       << mbhs.getBasesPerHash() << ")!\nDid you know you can leave away -k when using -L?\nAborting!\n";
-	  exit(10);
-	}
-      }else{
-	cout << "No -k given, using k from the loaded file: "
-	     << mbhs.getBasesPerHash() << endl;
-	MB_basesperhash=mbhs.getBasesPerHash();
-      }
-    }else{
-      ReadGroupLib::ReadGroupID rgid=ReadGroupLib::newReadGroup();
-      rgid.setSequencingType(ReadGroupLib::SEQTYPE_TEXT);
-
-      cout << "Loading baits ...";
-      ReadPool baitrp;
-      ReadPoolIO rpio(baitrp);
-      rpio.setAttributeFASTAQualFileWanted(false); // in case we load FASTAs
-      for(auto & bfn : MB_baitfiles){
-	uint8 ziptype=0;
-	string ft;
-	string dummyfromstem;
-	string dummypathto;
-	guessFileAndZipType(bfn,dummypathto,dummyfromstem,ft,ziptype);
-	if(checkFromType(ft)==0){
-	  if(MB_baitfromtype.empty()){
-	    ft="fasta";
-	  }else{
-	    ft=MB_baitfromtype;
-	  }
-	}
-
-	rpio.registerFile(ft,bfn,"",rgid,false);
-	rpio.loadNextSeqs(-1,-1);
-      }
-
-      cout << "baitrp.size(): " << baitrp.size() << endl;
-
-      string resultfn("hashstat.mhs.gz");
-      mbhs.prepareHashStatistics(baitrp,false,false,MB_fwdandrev,1,0,MB_basesperhash,
-				 MB_Pv[0].getHashStatisticsParams().hs_million_hashes_per_buffer,
-				 resultfn,".");
-      MB_baitpoolsize=baitrp.size();
-      if(mbhs.getNumHashEntries()==0){
-	cout << FmtText::makeTextSign("WARNING: not a single kmer bait could be generated. This is due to the sequences you are using to bait are all either too short or contain too many closely located IUPAC codes.\nThis may be right, but most probably is not. If not: either check your bait sequences in the input files or choose a lower kmer size.") << endl;
-      }
-    }
-  }
-
-  mbhs.showHashStatisticsInfo();
-
-  MB_workqueue.resize(1);
-  auto qI=MB_workqueue.begin(); // fixed atm
-
-  ReadPoolIO rpio1(qI->rp1);
-  ReadPoolIO rpio2(qI->rp2);
-  rpio1.setAttributeFASTAQualFileWanted(false); // in case we load FASTAs
-  rpio2.setAttributeFASTAQualFileWanted(false); // in case we load FASTAs
-  rpio1.setAttributeFASTQQualOffset(33); // in case we load FASTQs
-  rpio2.setAttributeFASTQQualOffset(33); // in case we load FASTQs
-  ReadGroupLib::ReadGroupID rgid=ReadGroupLib::newReadGroup();
-  rgid.setSequencingType(ReadGroupLib::SEQTYPE_SOLEXA);
-
-  auto ifI=MB_infiles.begin();
-  while(ifI!=MB_infiles.end()){
-    uint8 ziptype=0;
-    rpio1.setAttributeProgressIndicator(true);
-    MB_files.infilename1.clear();
-    MB_files.infilename2.clear();
-
-    MB_files.intype1=setupRPIO(*ifI,rgid,rpio1,ziptype);
-    MB_files.writetype=MB_files.intype1;
-    if(MB_mergeoutput){
-      if(ifI==MB_infiles.begin() && MB_tortype==Read::AS_ILLEGAL){
-	MB_tortype=MB_files.intype1;
-      }
-    }
-    if(MB_tortype!=Read::AS_ILLEGAL){
-      MB_files.writetype=MB_tortype;
-    }
-    setupOutfiles(*ifI,MB_files.intype1,ziptype,MB_files.hitfout1,MB_files.missfout1);
-    MB_files.infilename1=*ifI;
-
-    qI->pairstatus=PS_NOPAIR;
-    if(!MB_filepairinfo.empty()){
-      if(MB_filepairinfo.front()=='P'){
-	qI->pairstatus=PS_INTERLEAVE;
-      }else if(MB_filepairinfo.front()=='p'){
-	++ifI;
-	if(ifI==MB_infiles.end()){
-	  MIRANOTIFY(Notify::FATAL,"Something's wrong here: -p says to expect one further file, but " << *(--ifI) << " is the last file seen on the command line?");
-	}
-	rpio1.setAttributeProgressIndicator(false);
-	rpio2.setAttributeProgressIndicator(true);
-	MB_files.intype2=setupRPIO(*ifI,rgid,rpio2,ziptype);
-	setupOutfiles(*ifI,MB_files.intype2,ziptype,MB_files.hitfout2,MB_files.missfout2);
-	MB_files.infilename2=*ifI;
-	qI->pairstatus=PS_2FILES;
-      }
-      MB_filepairinfo.pop_front();
-    }
-
-    ++ifI;
-
-    while(rpio1.loadNextSeqs(500)){
-      if(qI->pairstatus==PS_2FILES){
-	rpio2.loadNextSeqs(500);
-	if(qI->rp1.size() != qI->rp2.size()){
-	  MIRANOTIFY(Notify::FATAL,"Something's wrong here: -p says you have two files with reads paired across both files. But file " << MB_files.infilename1 << " does not have the same number of reads as file " << MB_files.infilename2 << " ???");
-	}
-      }
-
-      // name or template checks
-      {
-	if(qI->pairstatus==PS_2FILES){
-	  for(uint32 rpi=0; rpi<qI->rp1.size(); ++rpi){
-	    if(qI->rp1[rpi].getName()!=qI->rp2[rpi].getName()
-	       && qI->rp1[rpi].getTemplate()!=qI->rp2[rpi].getTemplate()){
-	      MIRANOTIFY(Notify::FATAL,"Paired end files not synchronised: read name " << qI->rp1[rpi].getName() << " not equal to " << qI->rp2[rpi].getName() << " and templates also do not match: " << qI->rp1[rpi].getTemplate() << " vs " << qI->rp2[rpi].getTemplate());
-	    }
-	  }
-	}else if(qI->pairstatus==PS_INTERLEAVE){
-	  for(uint32 rpi=0; rpi<qI->rp1.size(); rpi+=2){
-	    if(qI->rp1[rpi].getTemplate()!=qI->rp1[rpi+1].getTemplate()){
-	      MIRANOTIFY(Notify::FATAL,"Interleaved paired end file apparently not cleanly interleaved: read template " << qI->rp1[rpi].getTemplate() << " not equal to " << qI->rp1[rpi+1].getTemplate());
-	    }
-	  }
-	}
-      }
-
-      baitReads(mbhs,qI->rp1,qI->take1);
-      if(qI->pairstatus==PS_2FILES){
-	baitReads(mbhs,qI->rp2,qI->take2);
-
-	// take both reads in dual load
-	auto t1I=qI->take1.begin();
-	auto t2I=qI->take2.begin();
-	for(; t1I != qI->take1.end(); ++t1I, ++t2I){
-	  if(*t2I) *t1I=1;
-	  if(*t1I) *t2I=1;
-	}
-      }
-
-      if(qI->pairstatus==PS_INTERLEAVE){
-	// take both reads in interleaved
-	auto sI=qI->take1.begin();
-	auto eI=sI+1;
-	for(; sI!=qI->take1.end(); sI+=2, eI+=2){
-	  if(*sI | *eI){
-	    *sI=1;
-	    *eI=1;
-	  }
-	}
-      }
-
-      saveWQueueElement(*qI);
-
-      Read::trashReadNameContainer();
-      qI->rp1.discard();
-      qI->rp2.discard();
-    }
-    if(qI->pairstatus==PS_2FILES){
-      rpio2.loadNextSeqs(1);
-      if(qI->rp2.size()){
-	MIRANOTIFY(Notify::FATAL,"File (bla2) more reads than file (bla)???");
-      }
-    }
-  }
-
-  cout << endl;
-}
-
-
-int MiraBait::mainMiraBait(int argc, char ** argv)
-{
-  //CALLGRIND_STOP_INSTRUMENTATION;
-
-  FUNCSTART("int mainMiraBait(int argc, char ** argv)");
-
-  int c;
-  extern char *optarg;
-  extern int optind;
-
-
-  string path;
-  string convertprog;
-  splitFullPathAndFileName(argv[0],path,convertprog);
-
-  string miraparams;
-
-  MB_basesperhash=0;
-  MB_baitpoolsize=0;
-
-  MB_filepairinfo.clear();    // p = 2 files, P = 1 file interleave
-
-  while (true){
-    static struct option long_options[] =
-      {
-	{"help",  no_argument,           0, 'h'},
-	{"version", no_argument,         0, 'v'},
-	{"loadhsf", no_argument,    0, 'L'},
-	{0, 0, 0, 0}
-      };
-    /* getopt_long stores the option index here. */
-    int option_index = 0;
-
-    int c = getopt_long (argc, argv, "hcdiIpPrva:b:f:F:k:L:n:N:o:O:t:",
-			 long_options, &option_index);
-    if(c == -1) break;
-
-    switch (c) {
-    case 'a': {
-      miraparams=optarg;
-      break;
-    }
-    case 'b': {
-      MB_baitfiles.push_back(optarg);
-      break;
-    }
-    case 'c': {
-      MB_changeseqcase=false;
-      break;
-    }
-    case 'd': {
-      MB_deletestaronlycolumns=true;
-      break;
-    }
-    case 'f': {
-      MB_fromtype=optarg;
-      break;
-    }
-    case 'F': {
-      MB_baitfromtype=optarg;
-      break;
-    }
-    case 'i': {
-      MB_wantbaithits=false;
-      MB_wantbaitmiss=true;
-      break;
-    }
-    case 'I': {
-      MB_wantbaithits=true;
-      MB_wantbaitmiss=true;
-      break;
-    }
-    case 'k': {
-      uint32 bla=atoi(optarg);
-      MB_basesperhash=bla;
-      break;
-    }
-    case 'L': {
-      MB_hashstatfname=optarg;
-      break;
-    }
-    case 'n': {
-      MB_numbaithits=atoi(optarg);
-      break;
-    }
-    case 'N': {
-      MB_nameprefix=optarg;
-      break;
-    }
-    case 'o': {
-      MB_wantbaithits=true;
-      MB_hitpath=optarg;
-      break;
-    }
-    case 'O': {
-      MB_wantbaitmiss=true;
-      MB_misspath=optarg;
-      break;
-    }
-    case 'p' :
-    case 'P' : {
-      MB_filepairinfo.push_back(c);
-      break;
-    }
-    case 'r': {
-      MB_fwdandrev=false;
-      break;
-    }
-    case 't': {
-      MB_totype=optarg;
-      break;
-    }
-    case 'h':
-    case '?': {
-      usage();
-      exit(0);
-    }
-    case 'v':
-      cout << MIRAVERSION << endl;
-      exit(0);
-    default : {}
-    }
-  }
-
-  if(MB_baitfiles.empty() && MB_hashstatfname.empty()){
-    usage();
-    cout << endl;
-    cerr << argv[0] << ": " << "No bait files defined via -b and no -L given!\nDid you use the command line for the old mirabait (<= 4.0.2)?\n";
-    exit(1);
-  }
-
-  if(argc-optind < 1) {
-    usage();
-    cout << endl;
-    cerr << argv[0] << ": " << "Missing files to work on!\n";
-    exit(1);
-  }
-
-  for(;optind<argc;++optind){
-    MB_infiles.push_back(argv[optind]);
-  }
-
-  if(!MB_fromtype.empty() && !checkFromType(MB_fromtype)){
-    usage();
-    cout << endl;
-    cerr << "Unknown or illegal file type '" << MB_fromtype << "' defined as <fromtype>\n";
-    exit(1);
-  }
-  string foundfromtype(MB_fromtype);
-  if(MB_fromtype.empty()){
-    for(auto & fname : MB_infiles){
-      uint8 ziptype=0;
-      string ft;
-      string dummyfromstem;
-      string dummypathto;
-      guessFileAndZipType(fname,dummypathto,dummyfromstem,ft,ziptype);
-      if(!ft.empty()) {
-	if(checkFromType(ft)==0){
-	  usage();
-	  cout << endl;
-	  cerr << "Unknown or illegal file extension '" << ft << "' in file name " << fname << "\n";
-	  exit(1);
-	}
-	if(foundfromtype.empty()) foundfromtype=ft;
-      }
-    }
-  }
-
-  MB_tortype=Read::AS_ILLEGAL;
-  if(!MB_totype.empty()){
-    MB_tortype=checkToType(MB_totype);
-    if(MB_tortype==Read::AS_ILLEGAL){
-      cerr << "Unknown or illegal format '" << MB_totype << "' defined as to-type\n";
-      exit(1);
-    }
-  }
-
-  if(!MB_hitpath.empty()){
-    boost::filesystem::path finaldest(walkSymLinks(MB_hitpath));
-    bool setmerge=true;
-    if(boost::filesystem::exists(finaldest)){
-      if(boost::filesystem::is_directory(finaldest)) {
-	setmerge=false;
-	if(MB_hitpath.back()!='/') MB_hitpath+='/';
-      }
-    }
-    MB_mergeoutput=setmerge;
-    if(setmerge) fileRemove(finaldest.string(),false);
-    if(boost::filesystem::exists(finaldest)){
-      cout.flush();
-      cerr << "\n\nCould not remove file " << finaldest << "\nIs it writable?";
-      exit(10);
-     }
-  }
-  if(!MB_misspath.empty()){
-    boost::filesystem::path finaldest(walkSymLinks(MB_misspath));
-    bool setmerge=true;
-    if(boost::filesystem::exists(finaldest)){
-      if(boost::filesystem::is_directory(finaldest)) {
-	setmerge=false;
-	if(MB_misspath.back()!='/') MB_misspath+='/';
-      }
-    }
-    MB_mergeoutput=setmerge;
-    if(setmerge) fileRemove(finaldest.string(),false);
-    if(boost::filesystem::exists(finaldest)){
-      cout.flush();
-      cerr << "\n\nCould not remove file " << finaldest << "\nIs it writable?";
-      exit(10);
-     }
-  }
-
-  MIRAParameters::setupStdMIRAParameters(MB_Pv);
-  if(!miraparams.empty()){
-    cout << "Parsing special MIRA parameters: " << miraparams << endl;
-    MIRAParameters::parse(miraparams,MB_Pv,false);
-    cout << "Ok.\n";
-  }
-
-  if(MB_numbaithits>0){
-    cout << "Baiting sequences with at least " << MB_numbaithits << " exact kmer matches.\n";
-  }else{
-    cout << "Baiting sequences allowing for " << -MB_numbaithits << " missed kmer matches over the sequence length.\n";
-  }
-
-  try{
-    // find out which size of hash we are going to work with
-    uint32 sizeofhash=0;
-    if(MB_hashstatfname.empty()){
-      if(MB_basesperhash==0) MB_basesperhash=31;
-      sizeofhash=HashStatistics<vhash64_t>::byteSizeOfHash(MB_basesperhash);
-    }else{
-      auto mhs=HashStatistics<vhash64_t>::loadHashStatisticsFileHeader(MB_hashstatfname);
-      sizeofhash=mhs.sizeofhash;
-      if(MB_basesperhash>0 && MB_basesperhash != mhs.basesperhash){
-	MIRANOTIFY(Notify::FATAL,"-k specified on the command line (" << MB_basesperhash << ") is different than the kmer size saved (" << mhs.basesperhash << ") in the hash statistics file. This is treated as error, bailing out.");
-      }
-      MB_basesperhash=mhs.basesperhash;
-      cout << "Size of kmers in file " << MB_hashstatfname << ": " << MB_basesperhash << endl;
-    }
-
-    if(MB_basesperhash>256){
-      cout << "Sorry, the max. kmer size supported atm is 256.\n";
-      exit(10);
-    }
-
-    if(sizeofhash==8){
-      HashStatistics<vhash64_t> hs;
-      doBaitWithHS(hs);
-    }else if(sizeofhash==16){
-      HashStatistics<vhash128_t> hs;
-      doBaitWithHS(hs);
-    }else if(sizeofhash==32){
-      HashStatistics<vhash256_t> hs;
-      doBaitWithHS(hs);
-    }else if(sizeofhash==64){
-      HashStatistics<vhash512_t> hs;
-      doBaitWithHS(hs);
-    }else{
-      BUGIFTHROW(true,"sizeofhash == " << sizeofhash << " is rather unexpected.");
-    }
-
-  }
-  catch(Notify n){
-    n.handleError("main");
-  }
-  catch(Flow f){
-    cerr << "Unexpected exception: Flow()\n";
-  }
-  catch(...){
-    cerr << "Unknown exception caught, aborting the process.\n\nPlease contact: bach at chevreux.org\n\n";
-    abort();
-  }
-
-  if(MB_numclippedreadsinload){
-    cout << FmtText::wordWrap("\nNOTICE! You baited sequences which had clipping information (CAF or MAF). Mirabait will have baited *only* in the unclipped parts of the sequences (which are thought to represent 'good, viable' sequence).\n");
-  }
-
-  cout << "\nBaiting process finished.\n\n";
-  if(MB_baitpoolsize>0){
-    cout << "Number of bait sequences:   " << MB_baitpoolsize << endl;
-  }
-  cout << "Total number of sequences read: " << MB_numreadsread << endl;
-  cout << "Pairs baited: " << MB_numpairsbaited << " (" << fixed << setprecision(2) << 100.0f/MB_numreadsread*MB_numpairsbaited*2 << "%)\n";
-  cout << "Pairs missed: " << MB_numpairsmissed << " (" << fixed << setprecision(2) << 100.0f/MB_numreadsread*MB_numpairsmissed*2 << "%)\n";
-  cout << "Unpaired baited: " << MB_numunpairedbaited << " (" << fixed << setprecision(2) << 100.0f/MB_numreadsread*MB_numunpairedbaited << "%)\n";
-  cout << "Unpaired missed: " << MB_numunpairedmissed << " (" << fixed << setprecision(2) << 100.0f/MB_numreadsread*MB_numunpairedmissed << "%)\n";
-
-  FUNCEND();
-  return 0;
-}
diff --git a/src/modules/mod_bait.H b/src/modules/mod_bait.H
deleted file mode 100644
index 0ff80ab..0000000
--- a/src/modules/mod_bait.H
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
- *   Krebsforschungszentrum, DKFZ Heidelberg) and Bastien Chevreux
- * Copyright (C) 2000 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-
-#include <fstream>
-
-#include <string>
-#include <vector>
-#include <list>
-
-#include "util/fileanddisk.H"
-
-#include "mira/parameters.H"
-#include "mira/readpool_io.H"
-#include "mira/hashstats.H"
-#include "mira/vhash.H"
-
-
-class MiraBait
-{
-private:
-
-  enum { PS_NOPAIR=0, PS_INTERLEAVE, PS_2FILES};
-  struct wqueueunit_t {
-    uint8 wqu_status; // loading, baiting, saving etc.
-
-    uint8 pairstatus; // 0==no pair; 1==interleave; 2==paired2files
-
-    ReadPool rp1;
-    ReadPool rp2;
-    std::vector<uint8> take1;
-    std::vector<uint8> take2;
-  };
-
-  struct files_t {
-    std::string infilename1;
-    std::string infilename2;
-
-    uint8 intype1; // Read::AS_FASTQ etc.
-    uint8 intype2; // Read::AS_FASTQ etc.
-    uint8 writetype; // Read::AS_FASTQ etc.
-
-    std::ofstream hitfout1;
-    std::ofstream missfout1;
-    std::ofstream hitfout2;
-    std::ofstream missfout2;
-  };
-
-  // TODO: get the statics out into class variables
-
-  static std::unordered_map<std::string,uint8> MB_fromtypemap;
-  static std::unordered_map<std::string,uint8> MB_totypemap;
-
-  static std::list<wqueueunit_t> MB_workqueue;
-  static files_t MB_files;
-
-  static std::vector<MIRAParameters> MB_Pv;
-
-  static std::string MB_fromtype;
-  static std::string MB_totype;
-  static std::string MB_baitfromtype;
-
-  static uint8 MB_tortype;
-
-  static std::list<std::string> MB_baitfiles;
-  static std::list<std::string> MB_infiles;
-
-  static std::string MB_hashstatfname;
-
-  static bool MB_deletestaronlycolumns;
-  static bool MB_wantbaithits;
-  static bool MB_wantbaitmiss;
-  static bool MB_fwdandrev;
-  static bool MB_changeseqcase;
-
-  static bool MB_mergeoutput;
-  static std::string MB_hitpath;
-  static std::string MB_misspath;
-  static std::string MB_nameprefix;
-
-  static int32 MB_numbaithits;
-
-  static bool MB_mustdeletetargetfiles;
-
-  static HashStatistics<vhash512_t> MB_hashstatistics;
-
-  static std::list<char> MB_filepairinfo;    // p = 2 files, P = 1 file interleave
-
-  static uint32 MB_basesperhash;
-  static uint64 MB_baitpoolsize;
-  static uint64 MB_numreadsread;
-  static uint64 MB_numpairsbaited;
-  static uint64 MB_numpairsmissed;
-  static uint64 MB_numunpairedbaited;
-  static uint64 MB_numunpairedmissed;
-
-  static uint64 MB_numclippedreadsinload; // number of reads which have clips already when loaded (CAF/MAF)
-
-private:
-  static void usage();
-  static uint8 checkFromType(std::string & fromtype);
-  static uint8 checkToType(std::string & totype);
-
-  static void saveReadPool(ReadPool & rp);
-
-  static uint8 setupRPIO(const std::string & filename, ReadGroupLib::ReadGroupID rgid, ReadPoolIO & rpio, uint8 & ziptype);
-
-  template<typename TVHASH_T>
-  static void baitReads(HashStatistics<TVHASH_T> & hs, const ReadPool & rp, std::vector<uint8> & take);
-  template<typename TVHASH_T>
-  static void doBaitWithHS(HashStatistics<TVHASH_T> & hs);
-
-  static void saveWQueueElement(wqueueunit_t & wqu);
-
-  static void setupOutfiles(const std::string & fname, uint8 rtype, uint8 ziptype, std::ofstream & hitfout, std::ofstream & missfout);
-
-public:
-  ~MiraBait();
-
-  int mainMiraBait(int argc, char ** argv);
-
-};
diff --git a/src/modules/mod_convert.C b/src/modules/mod_convert.C
deleted file mode 100644
index 5e394dd..0000000
--- a/src/modules/mod_convert.C
+++ /dev/null
@@ -1,2130 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
- *   Krebsforschungszentrum, DKFZ Heidelberg) and Bastien Chevreux
- * Copyright (C) 2000 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-
-
-#include "modules/mod_convert.H"
-
-#include <boost/lexical_cast.hpp>
-
-#include "io/generalio.H"
-#include "util/fmttext.H"
-
-#include "caf/caf.H"
-
-#include "mira/maf_parse.H"
-#include "mira/readpool_io.H"
-
-#include "modules/misc.H"
-#include "version.H"
-
-
-
-using namespace std;
-
-
-vector<MIRAParameters> ConvPro::CP_Pv;
-
-string ConvPro::CP_fromtype;
-list<string> ConvPro::CP_totype;
-list<ofstream *> ConvPro::CP_ofs;
-
-string ConvPro::CP_infile;
-
-string ConvPro::CP_inbasename;
-string ConvPro::CP_outbasename;
-
-string ConvPro::CP_renamesequences;
-string ConvPro::CP_renamenamescheme;
-
-bool ConvPro::CP_splitcontigs2singlefiles=false;
-bool ConvPro::CP_deletestaronlycolumns=false;
-bool ConvPro::CP_blinddata=false;
-bool ConvPro::CP_fillholesinstraingenomes=false;
-bool ConvPro::CP_makecontigs=false;
-bool ConvPro::CP_extractreadsinsteadcontigs=false;
-bool ConvPro::CP_hardtrim=false;
-bool ConvPro::CP_trimnx=false;
-
-string ConvPro::CP_namefile;
-bool ConvPro::CP_sortbyname=false;
-bool ConvPro::CP_keepnamesfromfile=true;
-
-bool ConvPro::CP_mustdeletetargetfiles=true;
-
-bool ConvPro::CP_specialtestcode=false;
-bool ConvPro::CP_filter2readgroup=false;
-bool ConvPro::CP_filter2readgroup_split=false;
-
-base_quality_t ConvPro::CP_minqual=0;
-bool ConvPro::CP_needsquality=true;
-base_quality_t ConvPro::CP_defaultqual=30;
-
-char ConvPro::CP_recalcconopt=' ';
-char ConvPro::CP_recalcfeatureopt=' ';
-
-uint32 ConvPro::CP_minbasecoverage=0;
-
-uint32 ConvPro::CP_mincontiglength=0;
-bool ConvPro::CP_minlengthisclipped=false;
-uint32 ConvPro::CP_mincontigcoverage=1;
-uint32 ConvPro::CP_minnumreads=0;
-
-list<Contig> ConvPro::CP_clist;   // needed for CAF conversion (and GBF)
-AssemblyInfo ConvPro::CP_assemblyinfo;
-
-
-uint64 ConvPro::CP_readrenamecounter=1;
-uint64 ConvPro::CP_numclippedreadsinload=0;
-bool ConvPro::CP_ulcaseclips=true;
-bool ConvPro::CP_mustcaseclips=false;
-
-uint64 ConvPro::CP_yieldmax=0;
-uint64 ConvPro::CP_yieldwritten=0;
-
-GFFSave ConvPro::CP_gffsave;
-SAMCollect ConvPro::CP_samcollect;
-
-
-ConvPro::~ConvPro()
-{
-  closeOpenStreams(CP_ofs);
-}
-
-void ConvPro::usage()
-{
-  cout << "miraconvert\t(MIRALIB version " << MIRAVERSION << ")\n"
-    "Author:  Bastien Chevreux\t(bach at chevreux.org)\n"
-    "Purpose: convert assembly and sequencing file types.\n\n";
-  cout << "Usage:\n"
-    "miraconvert [-f <fromtype>] [-t <totype> [-t <totype> ...]]\n"
-    "\t[-aAChimMsuZ]\n"
-    "\t[-cflnNoPqrtvxXyYz {...}]\n"
-    "\t{infile} {outfile} [<totype> <totype> ...]\n\n";
-  cout << "Options:\n";
-  cout <<
-    "\t-f <fromtype>\tload this type of project files, where fromtype is:\n"
-    "\t   caf\t\t a complete assembly or single sequences from CAF\n"
-    "\t   maf\t\t a complete assembly or single sequences from CAF\n"
-    "\t   fasta\t sequences from a FASTA file\n"
-    "\t   fastq\t sequences from a FASTQ file\n"
-    "\t   gb[f|k|ff]\t sequences from a GenBank file\n"
-    "\t   phd\t\t sequences from a PHD file\n"
-    "\t   fofnexp\t sequences in EXP files from file of filenames\n";
-  cout << "\t-t <totype>\twrite the sequences/assembly to this type (multiple\n"
-    "\t\t\tmentions of -t are allowed):\n"
-    "\t   ace\t\t sequences or complete assembly to ACE\n"
-    "\t   caf\t\t sequences or complete assembly to CAF\n"
-    "\t   maf\t\t sequences or complete assembly to MAF\n"
-    "\t   sam\t\t complete assembly to SAM\n"
-    "\t   samnbb\t like above, but leaving out reference (backbones) in\n"
-    "\t\t\t  mapping assemblies\n"
-    "\t   gb[f|k|ff]\t sequences or consensus to GenBank\n"
-    "\t   gff3\t\t consensus to GFF3\n"
-    "\t   wig\t\t assembly coverage info to wiggle file\n"
-    "\t   gcwig\t assembly gc content info to wiggle file\n"
-    "\t   fasta\t sequences or consensus to FASTA file (qualities to\n"
-    "\t\t\t  .qual)\n"
-    "\t   fastq\t sequences or consensus to FASTQ file\n"
-    "\t   exp\t\t sequences or complete assembly to EXP files in\n"
-    "\t\t\t  directories. Complete assemblies are suited for gap4\n"
-    "\t\t\t  import as directed assembly.\n"
-    "\t\t\t  Note: using caf2gap to import into gap4 is recommended\n"
-    "\t\t\t  though\n"
-    "\t   text\t\t complete assembly to text alignment (only when -f is\n"
-    "\t\t\t  caf, maf or gbf)\n"
-    "\t   html\t\t complete assembly to HTML (only when -f is caf, maf or\n"
-    "\t\t\t  gbf)\n"
-    "\t   tcs\t\t complete assembly to tcs\n"
-    "\t   hsnp\t\t surrounding of SNP tags (SROc, SAOc, SIOc) to HTML\n"
-    "\t\t\t (only when -f is caf, maf or gbf)\n"
-    "\t   asnp\t\t analysis of SNP tags\n"
-    "\t\t\t (only when -f is caf, maf or gbf)\n"
-    "\t   cstats\t contig statistics file like from MIRA\n"
-    "\t\t\t (only when source contains contigs)\n"
-    "\t   crlist\t contig read list file like from MIRA\n"
-    "\t\t\t (only when source contains contigs)\n"
-    "\t   maskedfasta\t reads where sequencing vector is masked out\n"
-    "\t\t\t (with X) to FASTA file (qualities to .qual)\n"
-    "\t   scaf\t\t sequences or complete assembly to single sequences CAF\n";
-
-  cout << "\t-a\t\tAppend to target files instead of rewriting\n";
-
-//\t\t\t-----------------------------------------------------------------
-  cout << "\t-A\t\tDo not Adjust sequence case\n"
-    "\t\t\t When reading formats which define clipping points,\n"
-    "\t\t\t  and saving to formats which do not have clipping\n"
-    "\t\t\t  information, miraconvert normally adjusts the case of\n"
-    "\t\t\t  read sequences: lower case for clipped parts, upper\n"
-    "\t\t\t  case for unclipped parts of reads.\n"
-    "\t\t\t  Use -A if you do not want this. See also -C.\n"
-    "\t\t\t Applies only to files/formats which do not contain\n"
-    "\t\t\t  contigs.\n";
-
-  cout <<
-    "\t-b\t\tBlind data\n"
-    "\t\t\t Replaces all bases in reads/contigs with a 'c'\n";
-
-  cout << "\t-C\t\tPerform hard clip to reads\n"
-    "\t\t\t When reading formats which define clipping points, will\n"
-    "\t\t\t  save only the unclipped part into the result file.\n"
-    "\t\t\t Applies only to files/formats which do not contain\n"
-    "\t\t\t  contigs.\n";
-
-  cout <<
-    "\t-d\t\tDelete gap only columns\n"
-    "\t\t\t When output is contigs: delete columns that are\n"
-    "\t\t\t  entirely gaps (like after having deleted reads during\n"
-    "\t\t\t  editing in gap4 or similar)\n"
-    "\t\t\t When output is reads: delete gaps in reads\n";
-
-  cout <<
-    "\t-F\t\tFilter read groups to different files\n"
-    "\t\t\t Works only for input files with readgroups (CAF/MAF)\n"
-    "\t\t\t 3 (or 4) files generated: one or two for paired, one\n"
-    "\t\t\t  for unpaired and one for debris reads.\n"
-    "\t\t\t Reads in paired file are interlaced by default, use -F\n"
-    "\t\t\t  twice to create separate files.\n";
-
-  cout <<
-    "\t-m\t\tMake contigs (only for -t = caf or maf)\n"
-    "\t\t\t Encase single reads as contig singlets into the CAF/MAF\n"
-    "\t\t\t file.\n";
-  cout <<
-    "\t-n <filename>\twhen given, selects only reads or contigs given by\n"
-    "\t\t\t name in that file.\n";
-  cout <<
-    "\t-N <filename>\tlike -n, but sorts output according to order given\n"
-    "\t\t\t in file.\n";
-  cout <<
-    "\t-i\t\twhen -n is used, inverts the selection\n";
-  cout <<
-    "\t-o <quality>t\tFASTQ quality Offset (only for -f = 'fastq')\n"
-    "\t\t\t Offset of quality values in FASTQ file. Default of 33\n"
-    "\t\t\t loads Sanger/Phred style files, using 0 tries to\n"
-    "\t\t\t automatically recognise.\n";
-
-  cout <<
-    "\t-P <string>\tString with MIRA parameters to be parsed\n"
-    "\t\t\t Useful when setting parameters affecting consensus\n"
-    "\t\t\t calling like -CO:mrpg etc.\n"
-    "\t\t\t E.g.: -P \"454_SETTINGS -CO:mrpg=3\"\n";
-
-  cout <<
-    "\t-q <quality>\tSet default quality for bases in file types without\n"
-    "\t\t\t quality values. Furthermore, do not stop if expected\n"
-    "\t\t\t quality files are missing (e.g. '.fasta')\n";
-
-  cout <<
-    "\t-R <name>\tRename contigs/singlets/reads with given name string\n"
-    "\t\t\t to which a counter is appended.\n"
-    "\t\t\t Known bug: will create duplicate names if input\n"
-    "\t\t\t  contains contigs/singlets as well as free reads, i.e.\n"
-    "\t\t\t  reads not in contigs nor singlets.\n";
-
-  cout <<
-    "\t-S <name>\t(name)Scheme for renaming reads, important for\n"
-    "\t\t\t  paired-ends. Only 'solexa' is currently supported.\n";
-
-  cout <<
-    "\t-T\t\tWhen converting single reads, trim/clip away stretches\n"
-    "\t\t\t of N and X and ends of reads. Note: remember to use -C to\n"
-    "\t\t\t also perform a hard clip (e.g. with FASTA as output).\n"
-    ;
-
-  cout <<
-    "\t-v\t\tPrint version number and exit\n";
-
-  cout <<
-    "\t-Y <integer>\tYield. Max (clipped/padded) bases to convert.\n"
-    "\t\t\t When used on reads: output will contain first reads of\n"
-    "\t\t\t  file where length of clipped bases totals at least -Y.\n"
-    "\t\t\t When used on contigs: output will contain first contigs\n"
-    "\t\t\t  of file where length of padded contigs totals at least\n"
-    "\t\t\t  -Y.\n";
-
-
-
-  cout <<
-    "\n\t--------------------------------------------------------\n"
-    "\tThe following switches work only when input (CAF or MAF)\n"
-    "\tcontains contigs. Beware: CAF and MAf can also contain\n"
-    "\tjust reads.\n"
-    "\t--------------------------------------------------------\n\n";
-
-  // TODO: check if ok for >2.9.8
-  cout <<
-    "\t-M\t\tDo not extract contigs (or their consensus), but the\n"
-    "\t\t\t  sequence of the reads they are composed of.\n";
-  cout <<
-    "\t-r [cCqf]\tRecalculate consensus and / or consensus quality values\n"
-    "\t\t\t and / or SNP feature tags.\n"
-    "\t\t\t 'c' recalc cons & cons qualities (with IUPAC)\n"
-    "\t\t\t 'C' recalc cons & cons qualities (forcing non-IUPAC)\n"
-    "\t\t\t 'q' recalc consensus qualities only\n"
-    "\t\t\t 'f' recalc SNP features\n"
-    "\t\t\t Note: only the last of cCq is relevant, f works as a\n"
-    "\t\t\t  switch and can be combined with cQq (e.g. \"-r C -r f\")\n"
-    "\t\t\t Note: if the CAF/MAF contains multiple strains,\n"
-    "\t\t\t recalculation of cons & cons qualities is forced, you\n"
-    "\t\t\t  can just influence whether IUPACs are used or not.\n";
-  cout <<
-    "\t-s\t\tsplit output into multiple files instead of creating a\n"
-    "\t\t\t single file\n";
-  cout <<
-    "\t-u\t\t'fillUp strain genomes'\n"
-    "\t\t\t Fill holes in the genome of one strain (N or @)\n"
-    "\t\t\t with sequence from a consensus of other strains\n"
-    "\t\t\t Takes effect only with -r and -t gbf or fasta/q\n"
-    "\t\t\t in FASTA/Q: bases filled up are in lower case\n"
-    "\t\t\t in GBF: bases filled up are in upper case\n";
-
-  cout <<
-    "\t-Q <integer>\tDefines minimum quality a consensus base of a strain\n"
-    "\t\t\t must have, consensus bases below this will be 'N'\n"
-    "\t\t\t Default: 0\n"
-    "\t\t\t Only used with -r, and -f is caf/maf and -t is (fasta\n"
-    "\t\t\t  or gbf)\n";
-  cout <<
-    "\t-V <integer>\tDefines minimum coverage a consensus base of a strain\n"
-    "\t\t\t must have, bases with coverage below this will be 'N'\n"
-    "\t\t\t Default: 0\n"
-    "\t\t\t Only used with -r, and -t is (fasta\n"
-    "\t\t\t  or gbf)\n";
-
-  cout <<
-    "\t-x <integer>\tMinimum contig or unclipped read length\n"
-    "\t\t\t When loading, discard all contigs / reads with a\n"
-    "\t\t\t length less than this value. Default: 0 (=switched off)\n"
-    "\t\t\t Note: not applied to reads in contigs!\n";
-  cout <<
-    "\t-X <integer>\tSimilar to -x but applies only to reads and\n"
-    "\t\t\t then to the clipped length.\n";
-
-  cout <<
-    "\t-y <integer>\tMinimum average contig coverage\n"
-    "\t\t\t When loading, discard all contigs with an\n"
-    "\t\t\t average coverage less than this value.\n"
-    "\t\t\t Default: 1\n";
-
-  cout <<
-    "\t-z <integer>\tMinimum number of reads in contig\n"
-    "\t\t\t When loading, discard all contigs with a\n"
-    "\t\t\t number of reads less than this value.\n"
-    "\t\t\t Default: 0 (=switched off)\n";
-
-
-  cout <<
-    "\t-l <integer>\twhen output as text or HTML: number of bases shown in\n"
-    "\t\t\t one alignment line. Default: 60.\n"
-    "\t-c <character>\twhen output as text or HTML: character used to pad\n"
-    "\t\t\t endgaps. Default: ' ' (blank)\n";
-
-  cout << "\nExamples:\n"
-    "\tmiraconvert source.maf dest.sam\n"
-    "\tmiraconvert source.caf dest.fasta wig ace\n"
-    "\tmiraconvert -x 2000 -y 10 source.caf dest.caf\n"
-    "\tmiraconvert -x 40 -C -F -F source.maf .fastq\n";
-}
-
-
-bool ConvPro::checkForFromType(const string & ftype)
-{
-  static set<string> ftypes={
-    "caf",
-    "maf",
-    "phd",
-    "gbf",
-    "gbff",
-    "gbk",
-    "gb",
-    "gff3",
-    "fasta",
-    "fna",
-    "fa",
-    "fastq",
-    "fq",
-    "fofnexp"
-  };
-  return ftypes.find(ftype)!=ftypes.end();
-}
-
-bool ConvPro::checkForToType(const string & ttype)
-{
-  static set<string> ttypes={
-    "fasta",
-    "fna",
-    "fa",
-    "fastq",
-    "fq",
-    "maskedfasta",
-    "caf",
-    "maf",
-    "sam",
-    "samnbb",
-    "ace",
-    "scaf",
-    "exp",
-    "gbf",
-    "gbff",
-    "gbk",
-    "gb",
-    "gff3",
-    "tcs",
-    "text",
-    "txt",
-    "html",
-    "wiggle",
-    "wig",
-    "gcwiggle",
-    "gcwig",
-    "asnp",
-    "fcov",
-    "hsnp",
-    "cstats",
-    "crlist",
-    "null"
-  };
-  return ttypes.find(ttype)!=ttypes.end();
-}
-
-void ConvPro::checkTypes(const string & fromtype,list<string> & totype)
-{
-  if(!checkForFromType(fromtype)){
-    usage();
-    cout << endl;
-    cerr << "Unknown or illegal file type '" << fromtype << "' defined as <fromtype>\n";
-    exit(1);
-  }
-  if(CP_totype.empty()){
-    CP_totype.push_back(fromtype);
-  }
-  for(list<string>::iterator ttI= CP_totype.begin(); ttI!=CP_totype.end(); ++ttI){
-    if(!checkForToType(*ttI)){
-      usage();
-      cout << endl;
-      cerr << "ConvPro::checkTypes: Unknown or illegal file type '" << *ttI << "' defined as <totype>\n";
-      exit(1);
-    }
-  }
-}
-
-// comfort function: parse fromtype and totype from name of infile, outfile
-void ConvPro::guessFromAndToType(const string & fnamefrom, string & fromtype, string * fromstem, const string & fnameto, list<string> & totypes, string * tostem)
-{
-  uint8 ziptype=0;
-  string ft;
-  string dummyfromstem;
-  string dummypathto;
-  guessFileAndZipType(fnamefrom,dummypathto,dummyfromstem,ft,ziptype);
-  if(fromtype.empty()){
-    fromtype.swap(ft);
-  }
-  if(fromstem != nullptr) {
-    fromstem->swap(dummypathto);
-    if(!dummypathto.empty() && dummypathto!="/"){
-      *fromstem+='/';
-    }
-    *fromstem+=dummyfromstem;
-  }
-
-  string dummytostem;
-  ft.clear();
-  guessFileAndZipType(fnameto,dummypathto,dummytostem,ft,ziptype);
-  if(!ft.empty() && checkForToType(ft)){
-    totypes.push_back(ft);
-    if(dummytostem.empty()) dummytostem=dummyfromstem;
-    if(tostem != nullptr) {
-      *tostem=dummypathto;
-      if(!dummypathto.empty() && dummypathto!="/"){
-	*tostem+='/';
-      }
-      *tostem+=dummytostem;
-    }
-  }
-  //cout << "dfs: " << dummyfromstem << " dpt: " << dummypathto << " dts: " << dummytostem << endl;
-}
-
-
-void ConvPro::filterToReadGroup(ReadPool & rp)
-{
-  FUNCSTART("void ConvPro::filterToReadGroup(ReadPool & rp)");
-
-  vector<ofstream> ofspaired(ReadGroupLib::getNumReadGroups());
-  vector<ofstream> ofspaired_1(ReadGroupLib::getNumReadGroups());
-  vector<ofstream> ofspaired_2(ReadGroupLib::getNumReadGroups());
-  vector<ofstream> ofsunpaired(ReadGroupLib::getNumReadGroups());
-  vector<ofstream> ofsdebris(ReadGroupLib::getNumReadGroups());
-
-  deque<string> seenrgnames;
-  for(uint32 rglid=1; rglid<ReadGroupLib::getNumReadGroups(); ++rglid){
-    auto rgid=ReadGroupLib::getReadGroupID(rglid);
-    string rgname(rgid.getGroupName());
-    if(rgname.empty()){
-      rgname=string("readgroup")+boost::lexical_cast<string>(rglid);
-    }
-    for(auto & sn : seenrgnames){
-      if(sn==rgname){
-	cout << "\nReadgroup '"<<sn<<"' seen more than once in MAF file, this is illegal.\n";
-	exit(0);
-      }
-    }
-    seenrgnames.push_back(rgname);
-    string basename;
-    if(CP_outbasename!=CP_inbasename){
-      basename=CP_outbasename+"_"+rgname;
-    }else{
-      basename=rgname;
-    }
-    string pname;
-    if(CP_filter2readgroup_split){
-      pname=basename+"_paired_1.fastq";
-      openOFStream(ofspaired_1[rglid],pname,ios::out);
-      pname=basename+"_paired_2.fastq";
-      openOFStream(ofspaired_2[rglid],pname,ios::out);
-    }else{
-      pname=basename+"_paired.fastq";
-      openOFStream(ofspaired[rglid],pname,ios::out);
-    }
-    pname=basename+"_unpaired.fastq";
-    openOFStream(ofsunpaired[rglid],pname,ios::out);
-    pname=basename+"_debris.fastq";
-    openOFStream(ofsdebris[rglid],pname,ios::out);
-  }
-
-  Read::setCoutType(Read::AS_FASTQ);
-
-  rp.makeTemplateIDs(true);
-  {
-    vector<uint32> sortdummy;
-    rp.sortPoolToMIRAStandard(sortdummy);
-  }
-  vector<bool> hasmultisegmentemplates(ReadGroupLib::getNumReadGroups(),false);
-  for(uint32 rpi=0; rpi< rp.size(); ++rpi){
-    if(rp[rpi].getTemplatePartnerID()!=-1){
-      hasmultisegmentemplates[rp[rpi].getReadGroupID().getLibId()]=true;
-    }
-  }
-  hasmultisegmentemplates[0]=false;
-
-  for(uint32 rpi=0; rpi< rp.size(); ){
-    bool allok=true;
-    auto lasti=rpi;
-    for(; lasti<rp.size() && rp[rpi].getTemplateID()==rp[lasti].getTemplateID(); ++lasti){
-      if(CP_mincontiglength>0) {
-	if(CP_minlengthisclipped){
-	  if(rp[lasti].getLenSeq()<CP_mincontiglength) allok=false;
-	}else{
-	  if(rp[lasti].getLenClippedSeq()<CP_mincontiglength) allok=false;
-	}
-      }
-    }
-    auto numseq=lasti-rpi;
-    if(hasmultisegmentemplates[rp[rpi].getReadGroupID().getLibId()] && numseq<2) allok=false;
-    for(;rpi<lasti; ++rpi){
-      if(allok){
-	if(CP_filter2readgroup_split){
-	  if(rp[rpi].getTemplateSegment()==1){
-	    ofspaired_1[rp[rpi].getReadGroupID().getLibId()] << rp[rpi];
-	  }else{
-	    ofspaired_2[rp[rpi].getReadGroupID().getLibId()] << rp[rpi];
-	  }
-	}else{
-	  ofspaired[rp[rpi].getReadGroupID().getLibId()] << rp[rpi];
-	}
-      }else if(numseq==1){
-	ofsdebris[rp[rpi].getReadGroupID().getLibId()] << rp[rpi];
-      }else{
-	if(CP_mincontiglength>0 && rp[rpi].getLenSeq()>=CP_mincontiglength){
-	  ofsunpaired[rp[rpi].getReadGroupID().getLibId()] << rp[rpi];
-	}else{
-	  ofsdebris[rp[rpi].getReadGroupID().getLibId()] << rp[rpi];
-	}
-      }
-    }
-  }
-
-}
-
-
-#define CEBUG(bla)   //{cout << bla; cout.flush();}
-void ConvPro::specialTestCode(list<Contig> & clist, ReadPool & rp)
-{
-  FUNCSTART("void ConvPro::specialTestCode(list<Contig> & clist, ReadPool & rp)");
-  try {
-    for(auto cI=clist.begin(); cI!=clist.end(); ++cI){
-      cI->findBestNonMisassembledRange();
-      cout << "CHecking: " << cI->getContigName() << endl;
-      if(cI->getContigLength()>=1000){
-	auto p=cI->findBestPairConsistencyRange();
-	if(p.first>=0) cout << "Found best range: " << cI->getContigName() << "\t" << p.first << "\t" << p.second << "\t" << p.second-p.first << endl;
-      }
-
-
-      if(1){
-	auto range=cI->findBestNonMisassembledRange();
-	if(range.first>=0){
-	  cout<<"Found misassembly by repeat marker. Best range: " << range.first << ".." << range.second << '\t' << range.second-range.first << endl;
-	  cI->trimContigToRange(range.first,range.second);
-
-	}
-      }
-
-      if(1){
-      	coverageinfo_t cinfo;
-      	vector<uint64> covvals;
-      	cI->collectCoverage(covvals);
-      	cI->calcStatsOnContainer(cinfo,covvals);
-      	cout << "1st covnum: " << cinfo << endl;
-
-      	// TODO: perhaps make this dependend of ratio mean vs stddev ?
-      	cI->calcSecondOrderStatsOnContainer(cinfo,covvals);
-      	cout << "2nd covnum: " << cinfo << endl;
-
-      	vector<uint8> peakindicator;
-      	cI->findPeaks(cinfo.median,peakindicator);
-      	unordered_set<readid_t> readsremoved;
-      	cI->reduceReadsAtCoveragePeaks(cinfo.median,peakindicator,readsremoved);
-      	cout << "Removed " << readsremoved.size() << endl;
-      }
-
-
-//      vector<bool> readsmarkedsrm;
-//      if(1){
-//	cout << "\nMarking tricky 454 / Solexa overcalls in temporary contig.\n";
-//	cout << "Marked " << I->editTrickyOvercalls(true,false,readsmarkedsrm) << " reads.\n";
-//	bool newreptmarked=Assembly::markRepeats(*I, readsmarkedsrm);
-//	cout << "Edited " << I->editTrickyOvercalls(false,false,readsmarkedsrm) << " reads.\n";
-//	I->deleteStarOnlyColumns(0, I->getContigLength()-1);
-//	I->deleteTagsInReads(Read::REA_defaulttag_PSHP.identifier);
-//      }
-//      I->markFeaturesByConsensus(true,true,true);
-//      I->editSingleDiscrepancyNoHAFTag(readsmarkedsrm);
-//      assout::saveReadTagList(*I,
-//			      "blabla",
-//			      true);
-
-
-//      uint32 numcoledits=0;
-//      uint32 numreadedits=0;
-//      for(uint32 i=0; i<5; ++i){
-//	I->editPBSledgeHammer(readsmarkedsrm,numcoledits,numreadedits);
-//	cout <<"### i " << i << " " << numcoledits << " " << numreadedits << endl;
-//	I->deleteStarOnlyColumns(0,I->getContigLength());
-//	//I->upDownCase(5);
-//      }
-
-    }
-  }
-//  try{
-//    for(auto & cle : clist){
-//      auto & cr=cle.getContigReads();
-//      for(auto & cre : cr){
-//	Read & r=const_cast<Read &>(cre);
-//	if(r.isBackbone()){
-//	  cout << "Sorting " << r.getName() << endl;
-//	  r.sortTagsForGFF3();
-//	}
-//      }
-//    }
-//  }
-  catch(Notify n){
-    n.handleError(THISFUNC);
-  }
-  FUNCEND();
-}
-#undef CEBUG
-
-
-
-void ConvPro::putReadsInContigsAndSave(vector<MIRAParameters> & Pv, ReadPool & rp)
-{
-  for(uint32 i=0; i<rp.size(); i++) {
-    if(!rp[i].hasQuality()){
-      base_quality_t bq=30;
-      if(rp[i].getReadGroupID().getDefaultQual()<=100) bq=rp[i].getReadGroupID().getDefaultQual();
-      rp[i].setQualities(bq);
-    }
-
-    Contig con(&Pv, rp);
-    CP_clist.push_back(con);
-    CP_clist.back().addFirstRead(i,1);
-    CP_clist.back().setContigName(rp[i].getName()+"_contig");
-    saveContigList_helper(CP_clist, rp);
-    CP_clist.clear();
-  }
-}
-
-void ConvPro::discardShortReads(vector<MIRAParameters> & Pv, ReadPool & rp, uint32 minlength, bool fromclipped)
-{
-  for(uint32 i=0; i<rp.size(); i++) {
-    uint32 len;
-    if(fromclipped){
-      len=rp[i].getLenClippedSeq();
-    }else{
-      len=rp[i].getLenSeq();
-    }
-    if(len<minlength) rp[i].discard();
-  }
-}
-
-
-
-//string ConvPro::createFileNameFromBasePostfixContigAndRead(const string & basename, string & postfix, Contig * actcon, Read * actread)
-string ConvPro::createFileNameFromBasePostfixContigAndRead(const string & basename, const char * postfix, Contig * actcon, Read * actread)
-{
-  string filename=basename;
-  if(actcon != nullptr){
-    if(!filename.empty()) filename+='_';
-    filename+=actcon->getContigName();
-  }else if(actread != nullptr){
-    if(!filename.empty()) filename+='_';
-    filename+=actread->getName();
-  }
-  filename+=postfix;
-  return filename;
-}
-
-
-bool ConvPro::contig__nameordercomp(const Contig & a, const Contig & b)
-{
-  return General::getNameOrder(a.getContigName()) < General::getNameOrder(b.getContigName());
-}
-
-
-void ConvPro::sortContigsByName(list<Contig> & clist)
-{
-  clist.sort(contig__nameordercomp);
-}
-
-
-void ConvPro::sortPoolByName(ReadPool & rp, string & filename)
-{
-  FUNCSTART("void ConvPro::sortPoolByName(ReadPool & rp, string & filename)");
-
-  cout << "Sorting pool ..."; cout.flush();
-
-  rp.allowNameIndex(true);
-
-  ifstream fin;
-  openIFStream(fin,filename, ios::in);
-
-  vector<uint32> newsortorder;
-
-  string elemname, dummy;
-  uint32 numread=0;
-  while(GeneralIO::readKeyValue(fin, elemname,dummy)){
-    int32 newpos=rp.getReadIndex(elemname);
-    if(newpos>=0) newsortorder.push_back(static_cast<uint32>(newpos));
-  }
-  fin.close();
-
-  rp.sortPoolToGivenOrder(newsortorder);
-
-  rp.allowNameIndex(false);
-
-  cout << "done.\n";
-
-  FUNCEND();
-}
-
-void ConvPro::saveContigList_helper(list<Contig> & clist, ReadPool & rp)
-{
-  FUNCSTART("void ConvPro::saveContigList_helper(list<Contig> & clist, ReadPool & rp)");
-
-  if(CP_specialtestcode) specialTestCode(clist,rp);
-
-  //{
-  //  cout << "CLISTSIZE: " << clist.size() << endl;
-  //  list<Contig>::iterator cI=clist.begin();
-  //  for(; cI != clist.end(); cI++){
-  //    cout << "cname: " << cI->getContigName() << endl;
-  //  }
-  //}
-
-  if(CP_yieldmax>0){
-    for(auto & cle : clist){
-      if(CP_yieldwritten<CP_yieldmax){
-	CP_yieldwritten+=cle.getContigLength();
-      }else{
-	cle.discard();
-      }
-    }
-  }else{
-    for(auto & cle : clist){
-      CP_yieldwritten+=cle.getContigLength();
-    }
-  }
-
-  BUGIFTHROW(!CP_ofs.empty() && CP_ofs.size() != CP_totype.size(), "Ooops? !CP_ofs.empty() && CP_ofs.size() != CP_totype.size() ???");
-
-  list<ofstream *>::iterator ofsI= CP_ofs.begin();
-  list<string>::iterator ttI= CP_totype.begin();
-  for(; ttI!=CP_totype.end(); ++ttI, ++ofsI){
-    if(*ttI=="null"){
-      // do nothing
-    }else if(*ttI=="scaf"){
-      //clear_conandrp=false;
-    }else if(*ttI=="hsnp"){
-      MIRAParameters::generateProjectOutNames(CP_Pv,CP_outbasename);
-      string fn;
-      if(CP_splitcontigs2singlefiles){
-	fn=createFileNameFromBasePostfixContigAndRead(
-	  CP_Pv[0].getAssemblyParams().as_outfile_stats_snpenvironment,
-	  ".html",
-	  &clist.front());
-      }else{
-	fn=createFileNameFromBasePostfixContigAndRead(
-	  CP_Pv[0].getAssemblyParams().as_outfile_stats_snpenvironment,
-	  ".html");
-      }
-      assout::saveSNPSurroundingAsHTML(clist,fn,CP_mustdeletetargetfiles);
-    }else if(*ttI=="cstats"){
-      MIRAParameters::generateProjectOutNames(CP_Pv,CP_outbasename);
-      string fn;
-      if(CP_splitcontigs2singlefiles){
-	fn=createFileNameFromBasePostfixContigAndRead(
-	  CP_Pv[0].getAssemblyParams().as_outfile_stats_contigstats,
-	  ".txt",
-	  &clist.front());
-      }else{
-	fn=createFileNameFromBasePostfixContigAndRead(
-	  CP_Pv[0].getAssemblyParams().as_outfile_stats_contigstats,
-	  ".txt");
-      }
-      assout::saveStatistics(clist,fn,CP_mustdeletetargetfiles);
-      if(CP_splitcontigs2singlefiles){
-	fn=createFileNameFromBasePostfixContigAndRead(
-	  CP_Pv[0].getAssemblyParams().as_outfile_stats_contigtags,
-	  ".txt",
-	  &clist.front());
-      }else{
-	fn=createFileNameFromBasePostfixContigAndRead(
-	  CP_Pv[0].getAssemblyParams().as_outfile_stats_contigtags,
-	  ".txt");
-      }
-      assout::saveConsensusTagList(clist,fn,CP_mustdeletetargetfiles);
-    }else if(*ttI=="crlist"){
-      MIRAParameters::generateProjectOutNames(CP_Pv,CP_outbasename);
-      string fn;
-      if(CP_splitcontigs2singlefiles){
-	fn=createFileNameFromBasePostfixContigAndRead(
-	  CP_Pv[0].getAssemblyParams().as_outfile_stats_crlist,
-	  ".txt",
-	  &clist.front());
-      }else{
-	fn=createFileNameFromBasePostfixContigAndRead(
-	  CP_Pv[0].getAssemblyParams().as_outfile_stats_crlist,
-	  ".txt");
-      }
-      assout::saveContigReadList(clist,fn,CP_mustdeletetargetfiles);
-    }else if(*ttI=="asnp"){
-      MIRAParameters::generateProjectOutNames(CP_Pv,CP_outbasename);
-      string fn,fa,fs,fc;
-
-      if(CP_splitcontigs2singlefiles){
-	fn=createFileNameFromBasePostfixContigAndRead(
-	  CP_Pv[0].getAssemblyParams().as_outfile_stats_snpanalysis,
-	  ".txt",
-	  &clist.front());
-	fa=createFileNameFromBasePostfixContigAndRead(
-	  CP_Pv[0].getAssemblyParams().as_outfile_stats_featureanalysis,
-	  ".txt",
-	  &clist.front());
-	fs=createFileNameFromBasePostfixContigAndRead(
-	  CP_Pv[0].getAssemblyParams().as_outfile_stats_featuresummary,
-	  ".txt",
-	  &clist.front());
-	fc=createFileNameFromBasePostfixContigAndRead(
-	  CP_Pv[0].getAssemblyParams().as_outfile_stats_featuresequences,
-	  ".txt",
-	  &clist.front());
-      }else{
-	fn=createFileNameFromBasePostfixContigAndRead(
-	  CP_Pv[0].getAssemblyParams().as_outfile_stats_snpanalysis,
-	  ".txt");
-	fa=createFileNameFromBasePostfixContigAndRead(
-	  CP_Pv[0].getAssemblyParams().as_outfile_stats_featureanalysis,
-	  ".txt");
-	fs=createFileNameFromBasePostfixContigAndRead(
-	  CP_Pv[0].getAssemblyParams().as_outfile_stats_featuresummary,
-	  ".txt");
-	fc=createFileNameFromBasePostfixContigAndRead(
-	  CP_Pv[0].getAssemblyParams().as_outfile_stats_featuresequences,
-	  ".txt");
-      }
-
-      assout::saveFeatureAnalysis(clist,rp,
-				  fa,fs,fc,
-				  CP_mustdeletetargetfiles);
-      // do this after saveFeatureAnalysis() which takes care of recomputing features if needed
-      assout::saveSNPList(clist,fn,CP_mustdeletetargetfiles);
-
-    }else if(*ttI=="fcov"){
-      MIRAParameters::generateProjectOutNames(CP_Pv,CP_outbasename);
-      string fn,fa,fs,fc;
-
-      if(CP_splitcontigs2singlefiles){
-	fn=createFileNameFromBasePostfixContigAndRead(
-	  CP_Pv[0].getAssemblyParams().as_outfile_stats_featurecoverage,
-//	  "coveragei",
-	  ".txt",
-	  &clist.front());
-      }else{
-	fn=createFileNameFromBasePostfixContigAndRead(
-	  CP_Pv[0].getAssemblyParams().as_outfile_stats_featurecoverage,
-//	  "coveragei",
-	  ".txt");
-      }
-
-      assout::saveCoverageInfo(clist,fn,CP_mustdeletetargetfiles);
-    }else if(*ttI=="fasta"){
-      //CALLGRIND_START_INSTRUMENTATION;
-      string bn;
-      if(CP_splitcontigs2singlefiles){
-	bn=createFileNameFromBasePostfixContigAndRead(
-	  CP_outbasename,
-	  "",
-	  &clist.front());
-      }else{
-	bn=createFileNameFromBasePostfixContigAndRead(
-	  CP_outbasename,
-	  "");
-      }
-      assout::saveStrainsAsFASTAQ(clist,
-				  rp,
-				  bn,
-				  false,
-				  CP_minbasecoverage,
-				  CP_minqual,
-				  CP_mustdeletetargetfiles,
-				  CP_fillholesinstraingenomes);
-    }else if(*ttI=="fastaqual"){
-      // fastaqual is "do-nothing" as "fasta" also write fastaqual here!
-    }else if(*ttI=="fastq"){
-      //CALLGRIND_START_INSTRUMENTATION;
-      string bn;
-      if(CP_splitcontigs2singlefiles){
-	bn=createFileNameFromBasePostfixContigAndRead(
-	  CP_outbasename,
-	  "",
-	  &clist.front());
-      }else{
-	bn=createFileNameFromBasePostfixContigAndRead(
-	  CP_outbasename,
-	  "");
-      }
-      assout::saveStrainsAsFASTAQ(clist,
-				  rp,
-				  bn,
-				  true,
-				  CP_minbasecoverage,
-				  CP_minqual,
-				  CP_mustdeletetargetfiles,
-				  CP_fillholesinstraingenomes);
-    } else if(*ttI=="caf"){
-      Contig::setCoutType(Contig::AS_CAF);
-      list<Contig>::iterator I=clist.begin();
-      for(;I!=clist.end(); I++){
-	if(CP_recalcfeatureopt=='f') I->markFeaturesByConsensus(true,true,true);
-	if(CP_recalcfeatureopt=='r') {
-	  vector<bool> dummy;
-	  Contig::repeatmarker_stats_t contigrepstats;
-	  Assembly::markRepeats(*I,dummy,contigrepstats);
-	}
-	bool mustclose=false;
-	if(!(*ofsI)->is_open()){
-	  string bn;
-	  if(CP_splitcontigs2singlefiles){
-	    bn=createFileNameFromBasePostfixContigAndRead(
-	      CP_outbasename,
-	      ".caf",
-	      &clist.front());
-	  }else{
-	    bn=createFileNameFromBasePostfixContigAndRead(
-	      CP_outbasename,
-	      ".caf",
-	      nullptr);
-	  }
-	  openOFStream(*(*ofsI),bn,ios::out);
-	  mustclose=true;
-	}
-	*(*ofsI) << *I;
-	if(mustclose){
-	  (*ofsI)->close();
-	}
-      }
-    } else if(*ttI=="sam"){
-      BUGIFTHROW(!(*ofsI)->is_open(),"Ooops, SAM stream not open?");
-      for(auto & cle : clist){
-	cle.dumpAsSAM(*(*ofsI),CP_samcollect,true);
-      }
-    } else if(*ttI=="samnbb"){
-      BUGIFTHROW(!(*ofsI)->is_open(),"Ooops, SAM stream not open?");
-      for(auto & cle : clist){
-	cle.dumpAsSAM(*(*ofsI),CP_samcollect,false);
-      }
-    } else if(*ttI=="maf"){
-      Contig::setCoutType(Contig::AS_MAF);
-      list<Contig>::iterator I=clist.begin();
-      for(;I!=clist.end(); I++){
-	if(CP_recalcfeatureopt=='f') I->markFeaturesByConsensus(true,true,true);
-	if(CP_recalcfeatureopt=='r') {
-	  vector<bool> dummy;
-	  Contig::repeatmarker_stats_t contigrepstats;
-	  Assembly::markRepeats(*I,dummy,contigrepstats);
-	}
-	if(!(*ofsI)->is_open()){
-	  string bn;
-	  if(CP_splitcontigs2singlefiles){
-	    bn=createFileNameFromBasePostfixContigAndRead(
-	      CP_outbasename,
-	      ".maf",
-	      &clist.front());
-	  }else{
-	    bn=createFileNameFromBasePostfixContigAndRead(
-	      CP_outbasename,
-	      ".maf",
-	      nullptr);
-	  }
-	  openOFStream(*(*ofsI),bn,ios::out);
-	  Contig::dumpMAF_Head(*(*ofsI));
-	}
-	*(*ofsI) << *I;
-	if(CP_splitcontigs2singlefiles){
-	  (*ofsI)->close();
-	}
-      }
-    } else if(*ttI=="html"){
-      //cerr << "HTML output currently deactivated in development version!\n";
-      //exit(1);
-      string bn;
-      if(CP_splitcontigs2singlefiles){
-	bn=createFileNameFromBasePostfixContigAndRead(
-	  CP_outbasename,
-	  ".html",
-	  &clist.front());
-      }else{
-	bn=createFileNameFromBasePostfixContigAndRead(
-	  CP_outbasename,
-	  ".html");
-      }
-      assout::dumpContigListAsHTML(clist, bn, CP_mustdeletetargetfiles, CP_outbasename);
-    } else if(*ttI=="text"
-	      || *ttI=="txt"){
-      string bn;
-      if(CP_splitcontigs2singlefiles){
-	bn=createFileNameFromBasePostfixContigAndRead(
-	  CP_outbasename,
-	  ".txt",
-	  &clist.front());
-      }else{
-	bn=createFileNameFromBasePostfixContigAndRead(
-	  CP_outbasename,
-	  ".txt");
-      }
-      assout::saveAsTXT(clist, bn, CP_mustdeletetargetfiles);
-    } else if(*ttI=="exp"){
-      // outbasename is in this case a directory name
-      string bn;
-      if(CP_splitcontigs2singlefiles){
-	bn=createFileNameFromBasePostfixContigAndRead(
-	  CP_outbasename,
-	  "",
-	  &clist.front());
-      }else{
-	bn=createFileNameFromBasePostfixContigAndRead(
-	  CP_outbasename,
-	  "");
-      }
-      assout::saveAsGAP4DA(clist,bn,CP_mustdeletetargetfiles);
-    } else if(*ttI=="gbf"){
-      if(CP_recalcfeatureopt=='f') {
-	for(auto & ce : clist){
-	  ce.markFeaturesByConsensus(true,true,true);
-	}
-      }
-      // outbasename is in this case the basename name
-      string bn;
-      if(CP_splitcontigs2singlefiles){
-	bn=createFileNameFromBasePostfixContigAndRead(
-	  CP_outbasename,
-	  "",
-	  &clist.front());
-      }else{
-	bn=createFileNameFromBasePostfixContigAndRead(
-	  CP_outbasename,
-	  "");
-      }
-      assout::saveStrainsAsGBF(clist,
-			       rp,
-			       bn,
-			       CP_minqual,
-			       CP_fillholesinstraingenomes,
-			       CP_mustdeletetargetfiles);
-    } else if(*ttI=="gff3"){
-      // outbasename is in this case the basename name
-      list<Contig>::iterator cI=clist.begin();
-      for(; cI != clist.end(); ++cI){
-	string bn;
-	if(CP_splitcontigs2singlefiles){
-	  bn=createFileNameFromBasePostfixContigAndRead(
-	    CP_outbasename,
-	    "",
-	    &clist.front());
-	  if(CP_gffsave.is_open()){
-	    CP_gffsave.close();
-	  }
-	  CP_gffsave.open(bn);
-	}else{
-	  bn=createFileNameFromBasePostfixContigAndRead(
-	    CP_outbasename,
-	    "");
-	  if(!CP_gffsave.is_open()){
-	    CP_gffsave.open(bn);
-	  }
-	}
-	CP_gffsave.acquireContig(*cI,rp);
-      }
-    } else if(*ttI=="ace"){
-      // outbasename is in this case the basename name
-      string bn;
-      if(CP_splitcontigs2singlefiles){
-	bn=createFileNameFromBasePostfixContigAndRead(
-	  CP_outbasename,
-	  ".ace",
-	  &clist.front());
-      }else{
-	bn=createFileNameFromBasePostfixContigAndRead(
-	  CP_outbasename,
-	  ".ace");
-      }
-      assout::saveAsACE(clist,bn,CP_mustdeletetargetfiles);
-    } else if(*ttI=="tcs"){
-      // outbasename is in this case the basename name
-      string bn;
-      if(CP_splitcontigs2singlefiles){
-	bn=createFileNameFromBasePostfixContigAndRead(
-	  CP_outbasename,
-	  ".tcs",
-	  &clist.front());
-      }else{
-	bn=createFileNameFromBasePostfixContigAndRead(
-	  CP_outbasename,
-	  ".tcs");
-      }
-      assout::saveAsTCS(clist,bn,CP_mustdeletetargetfiles);
-    } else if(*ttI=="wiggle" || *ttI=="wig"){
-      // outbasename is in this case the basename name
-      string bn;
-      if(CP_splitcontigs2singlefiles){
-	bn=createFileNameFromBasePostfixContigAndRead(
-	  CP_outbasename,
-	  ".wig",
-	  &clist.front());
-      }else{
-	bn=createFileNameFromBasePostfixContigAndRead(
-	  CP_outbasename,
-	  ".wig");
-      }
-      assout::saveAsWiggle(clist,bn,CP_mustdeletetargetfiles,false);
-    } else if(*ttI=="gcwiggle" || *ttI=="gcwig"){
-      // outbasename is in this case the basename name
-      string bn;
-      if(CP_splitcontigs2singlefiles){
-	bn=createFileNameFromBasePostfixContigAndRead(
-	  CP_outbasename,
-	  "_gccontent.wig",
-	  &clist.front());
-      }else{
-	bn=createFileNameFromBasePostfixContigAndRead(
-	  CP_outbasename,
-	  "_gccontent.wig");
-      }
-      assout::saveAsWiggle(clist,bn,CP_mustdeletetargetfiles,true);
-    } else {
-      cerr << "\n\n-t " << *ttI << " is not a valid 'to' type when converting contigs (sorry). But maybe something went wrong, please contact the author.\n";
-      exit(1);
-    }
-  }
-
-  if(!CP_splitcontigs2singlefiles){
-    CP_mustdeletetargetfiles=false;
-  }
-
-  FUNCEND();
-}
-
-void ConvPro::saveContigList(list<Contig> & clist, ReadPool & rp)
-{
-  FUNCSTART("void ConvPro::saveContigList(list<Contig> & clist, ReadPool & rp)");
-  bool dosomeoutput=false;
-
-  list<Contig>::iterator cI=clist.begin();
-  for(; cI != clist.end(); cI++){
-    bool conout=true;
-
-    if(CP_mincontiglength>0
-       && cI->getContigLength() < CP_mincontiglength){
-      conout=false;
-    } else {
-      Contig::constats_t constats(cI->getStats());
-
-      //cI->stats(cout);
-
-      if(CP_mincontigcoverage>0
-	 && constats.avg_coverage < CP_mincontigcoverage){
-	conout=false;
-      } else if(CP_minnumreads>0
-		&& constats.total_reads < CP_minnumreads){
-	conout=false;
-      }
-    }
-
-    if(conout){
-      if(General::hasNames()){
-	string cname(cI->getContigName());
-	if(!General::checkNamePresence(cname)){
-	  conout=false;
-	}
-	if(!CP_keepnamesfromfile) conout=!conout;
-      }
-    }
-
-    // delete contigs which should not be output
-    // TODO:
-    //  would generally be better to have that in some loading callback (and
-    //  would work for contigs well enough), but readpool mechanisms would
-    //  not at the moment, too primitive
-    if(!conout){
-      cI=clist.erase(cI);
-      if(cI != clist.begin()) --cI;
-    }
-
-    dosomeoutput|=conout;
-  }
-
-  if(dosomeoutput){
-    for(cI=clist.begin(); cI != clist.end(); cI++){
-      if(CP_deletestaronlycolumns) {
-	cI->deleteStarOnlyColumns(0,cI->getContigLength());
-      }
-      if(CP_blinddata){
-	cI->blindContig();
-      }
-    }
-
-    Assembly::refreshContigAndReadpoolValuesAfterLoading(rp,clist,NWNONE);
-
-    string dummyempty;
-    // TODO: ! make autoconfigure: on several strains, this is needed!
-    //  else, let user define via switch
-    for(cI=clist.begin(); cI != clist.end(); cI++){
-      if(CP_recalcconopt=='c'
-	 || CP_recalcconopt=='C'){
-	cI->trashConsensusCache(false);
-      }
-      if(CP_recalcconopt=='q'){
-	cI->trashConsensusCache(true);
-      }
-
-      CP_assemblyinfo.storeContigStats(cI->getStats(), dummyempty);
-    }
-
-    try{
-      saveContigList_helper(CP_clist, rp);
-    }
-    catch(Notify n){
-      n.handleError(THISFUNC);
-    }
-  }
-}
-
-void ConvPro::saveReadPool(ReadPool & rp, list<ofstream *> & ofs)
-{
-  FUNCSTART("void ConvPro::saveReadPool(ReadPool & rp, list<ofstream *> & ofs)");
-
-  rp.adjustIllegalQualities(30);
-
-  if(CP_deletestaronlycolumns) {
-    for(uint32 i=0; i<rp.size(); i++) {
-      rp.getRead(i).removeGapsFromRead();
-    }
-  }
-  if(CP_blinddata) {
-    for(uint32 i=0; i<rp.size(); i++) {
-      rp.getRead(i).blindSeqData('c');
-    }
-  }
-  if(General::hasNames()){
-    for(uint32 i=0; i<rp.size(); i++) {
-      string rname(rp[i].getName());
-      if((!General::checkNamePresence(rname) && CP_keepnamesfromfile)
-	 || (General::checkNamePresence(rname) && !CP_keepnamesfromfile)){
-	rp[i].discard();
-      }
-    }
-  }
-
-  for(uint32 i=0; i<rp.size(); ++i) {
-    if(rp[i].getLenSeq() != rp[i].getLenClippedSeq()){
-      ++CP_numclippedreadsinload;
-    }
-  }
-  if(CP_trimnx){
-    for(uint32 i=0; i<rp.size(); ++i) {
-      rp[i].setClipoffsToMaskedChars(0,0,0,true);
-    }
-  }
-  if(CP_hardtrim){
-    for(uint32 i=0; i<rp.size(); ++i) {
-      rp[i].performHardTrim();
-    }
-  }
-  if(CP_mustcaseclips && CP_ulcaseclips){
-    for(uint32 i=0; i<rp.size(); ++i) {
-      rp[i].upDownCaseClips();
-    }
-  }
-
-  if(CP_mincontiglength>0 && !CP_filter2readgroup){
-    discardShortReads(CP_Pv,rp,CP_mincontiglength,CP_minlengthisclipped);
-  }
-
-  if(!CP_renamesequences.empty()){
-    if(!CP_renamenamescheme.empty()){
-      for(size_t i=1; i<ReadGroupLib::getNumReadGroups(); ++i){
-	auto rgid=ReadGroupLib::getReadGroupID(i);
-	if(!rgid.setSegmentNaming(CP_renamenamescheme)){
-	  BUGIFTHROW(true,"Naming scheme '" << CP_renamenamescheme << "' is unknown.");
-	}
-      }
-      for(uint32 i=0; i<rp.size(); ++i){
-	rp[i].setTemplate("");
-	rp[i].setTemplateSegment(0);
-	rp[i].calcTemplateInfo();
-      }
-      rp.makeTemplateIDs(NWWARN);
-    }
-
-    vector<uint8> readrenamed(rp.size(),0);
-    string tmpname;
-    for(uint32 rpi=0; rpi<rp.size(); ++rpi){
-      if(rp[rpi].getTemplatePartnerID()>=0 && readrenamed[rp[rpi].getTemplatePartnerID()]){
-	tmpname=rp[rp[rpi].getTemplatePartnerID()].getTemplate();
-      }else{
-	tmpname=CP_renamesequences+"_"+boost::lexical_cast<std::string>(CP_readrenamecounter++);
-      }
-      auto segment=rp[rpi].getTemplateSegment();
-      if(rp[rpi].getReadNamingScheme()==ReadGroupLib::SCHEME_SOLEXA){
-	if(rp[rpi].getTemplateSegment()==1){
-	  tmpname+="/1";
-	}else if(rp[rpi].getTemplateSegment()==255){
-	  tmpname+="/2";
-	}else if(rp[rpi].getTemplateSegment()!=0){
-	  BUGIFTHROW(true,"Read " << rp[rpi].getName() << " has illegal segment " << static_cast<uint16>(rp[rpi].getTemplateSegment()) << " ???");
-	}
-      }
-      rp[rpi].setTemplate("");
-      rp[rpi].setTemplateSegment(0);
-      rp[rpi].setName(tmpname);
-      readrenamed[rpi]=1;
-    }
-  }
-
-  if(CP_yieldmax>0) {
-    for(uint32 rpi=0; rpi<rp.size(); ++rpi){
-      if(CP_yieldwritten<CP_yieldmax){
-	CP_yieldwritten+=rp[rpi].getLenClippedSeq();
-      }else{
-	rp[rpi].discard();
-      }
-    }
-  }else{
-    for(uint32 rpi=0; rpi<rp.size(); ++rpi){
-      CP_yieldwritten+=rp[rpi].getLenClippedSeq();
-    }
-  }
-
-  if(CP_makecontigs) {
-    putReadsInContigsAndSave(CP_Pv, rp);
-  }else if(CP_filter2readgroup){
-    filterToReadGroup(rp);
-  }else{
-    list<string>::iterator ttI= CP_totype.begin();
-    list<ofstream *>::iterator ofsI= ofs.begin();
-    for(; ttI!=CP_totype.end(); ++ttI, ++ofsI){
-      bool needofsIclose=false;
-      // BaCh 16.01.2012: changed != below to == ... was probably a simple programming error (I hope)
-      if(*ttI=="gff3"){
-	if(!CP_splitcontigs2singlefiles){
-	  BUGIFTHROW(!(*(*ofsI)).is_open(), *ttI << " file stream not open???");
-	}
-	openOFStream((*(*ofsI)),rp[0].getName()+'.'+*ttI,ios::out);
-	needofsIclose=true;
-      }
-      if(*ttI=="fasta"){
-	// double indirection because iterator needs one and it is a list of ofstream pointers ...
-	rp.dumpAs(*(*ofsI),Read::AS_FASTA,false);
-      } else if(*ttI=="fastaqual"){
-	rp.dumpAs(*(*ofsI),Read::AS_FASTAQUAL,false);
-      } else if(*ttI=="maskedfasta"){
-	rp.dumpAs(*(*ofsI),Read::AS_MASKEDMASKFASTA,false);
-      } else if(*ttI=="maskedfastaqual"){
-	rp.dumpAs(*(*ofsI),Read::AS_MASKEDMASKFASTAQUAL,false);
-      } else if(*ttI=="fastq"){
-	rp.dumpAs(*(*ofsI),Read::AS_FASTQ,false);
-      } else if(*ttI=="caf" || *ttI=="scaf" ){
-	rp.dumpAs(*(*ofsI),Read::AS_CAF,false);
-      } else if(*ttI=="maf"){
-	//rp.dumpAs(*(*ofsI),Read::AS_MAF,false);
-	rp.saveAsMAF(*(*ofsI),false);
-      } else if(*ttI=="gff3"){
-	for(uint32 rpi=0; rpi<rp.size(); ++rpi){
-	  bool mustclose=false;
-	  if(!CP_gffsave.is_open()){
-	    mustclose=true;
-	    CP_gffsave.open(rp[rpi].getName());
-	  }
-	  CP_gffsave.acquireRead(rp[rpi]);
-	  if(mustclose) CP_gffsave.close();
-	}
-      } else {
-	cout.flush();
-	cerr << "\n\n-t " << *ttI << " is not a valid type for saving a readpool (internal)!\n";
-	//usage();
-	exit(1);
-      }
-      if(needofsIclose){
-	(*(*ofsI)).close();
-      }
-    }
-  }
-
-  FUNCEND();
-}
-
-uint32 ConvPro::openOFSlist(Contig * optcontig, list<ofstream *> & ofs)
-{
-  FUNCSTART("uint32 ConvPro::openOFSlist(Contig * optcontig, list<ofstream *> & ofs)");
-  BUGIFTHROW(CP_totype.empty(), " CP_totype.empty() ???");
-
-  uint32 mustclose=0;
-  ofstream * ofstmp;
-
-  for(list<string>::iterator ttI= CP_totype.begin(); ttI!=CP_totype.end(); ++ttI){
-
-    cout << "opening " << *ttI << endl;
-
-    ofstmp=new ofstream;
-    ofs.push_back(ofstmp);
-    if(*ttI=="fasta"){
-      openOFStream(*ofs.back(),createFileNameFromBasePostfixContigAndRead(CP_outbasename,".fasta",optcontig),ios::out);
-      ++mustclose;
-    } else if(*ttI=="fastaqual"){
-      openOFStream(*ofs.back(),createFileNameFromBasePostfixContigAndRead(CP_outbasename,".fasta.qual",optcontig),ios::out);
-      ++mustclose;
-    } else if(*ttI=="maskedfasta"){
-      openOFStream(*ofs.back(),createFileNameFromBasePostfixContigAndRead(CP_outbasename,".fasta",optcontig),ios::out);
-      ++mustclose;
-    } else if(*ttI=="maskedfastaqual"){
-      openOFStream(*ofs.back(),createFileNameFromBasePostfixContigAndRead(CP_outbasename,".fasta.qual",optcontig),ios::out);
-      ++mustclose;
-    } else if(*ttI=="fastq"){
-      openOFStream(*ofs.back(),createFileNameFromBasePostfixContigAndRead(CP_outbasename,".fastq",optcontig),ios::out);
-      ++mustclose;
-    } else if(*ttI=="caf" || *ttI=="scaf" ){
-      openOFStream(*ofs.back(),createFileNameFromBasePostfixContigAndRead(CP_outbasename,".caf",optcontig),ios::out);
-      ++mustclose;
-    } else if(*ttI=="maf"){
-      openOFStream(*ofs.back(),createFileNameFromBasePostfixContigAndRead(CP_outbasename,".maf",optcontig),ios::out);
-      Contig::dumpMAF_Head(*(ofs.back()));
-      ++mustclose;
-    } else if(*ttI=="sam" || *ttI=="samnbb"){
-      openOFStream(*ofs.back(),createFileNameFromBasePostfixContigAndRead(CP_outbasename,".sam",optcontig),ios::out);
-      ++mustclose;
-    } else if(*ttI=="gff3"){
-      if(CP_gffsave.is_open()) CP_gffsave.close();
-      CP_gffsave.open(createFileNameFromBasePostfixContigAndRead(CP_outbasename,".gff3",optcontig));
-    }
-  }
-  return mustclose;
-}
-
-void ConvPro::closeOFSList(uint32 howmany, list<ofstream *> & ofs)
-{
-  FUNCSTART("uint32 ConvPro::closeOFSList(uint32 howmany)");
-  BUGIFTHROW(howmany>ofs.size(),"howmany>ofs.size() ???");
-  for(uint32 i=0; i<howmany; ++i){
-    delete ofs.back();
-    ofs.pop_back();
-  }
-  FUNCEND();
-}
-
-
-void ConvPro::cafmafload_callback(list<Contig> & clist, ReadPool & rp)
-{
-  FUNCSTART("void ConvPro::cafmafload_callback(list<Contig> & clist, ReadPool & rp)");
-  BUGIFTHROW(clist.empty() && rp.size()==0,"clist.empty() && rp.size()==0");
-  {
-    list<Contig>::iterator cI=clist.begin();
-    for(; cI != clist.end(); ++cI){
-      if(!CP_renamesequences.empty()){
-	cI->setContigName("");
-	cI->setContigNamePrefix(CP_renamesequences);
-      }
-    }
-  }
-  if(!clist.empty() && !CP_extractreadsinsteadcontigs){
-    saveContigList(clist,rp);
-  }else{
-    list<ofstream *> ofs;
-    uint32 mustclose=0;
-    if(CP_splitcontigs2singlefiles && !clist.empty()){
-      mustclose=openOFSlist(&clist.front(),ofs);
-      saveReadPool(rp,ofs);
-    }else{
-      saveReadPool(rp,CP_ofs);
-    }
-    closeOFSList(mustclose,ofs);
-  }
-
-  Read::trashReadNameContainer();
-  clist.clear();
-  rp.discard();
-}
-
-void ConvPro::readpoolload_callback(ReadPool & rp)
-{
-  saveReadPool(rp,CP_ofs);
-
-  Read::trashReadNameContainer();
-  rp.discard();
-}
-
-
-void ConvPro::closeOpenStreams(list<ofstream *> & ofsl)
-{
-  list<ofstream *>::iterator ofsI= ofsl.begin();
-  for(; ofsI!=ofsl.end(); ++ofsI){
-    delete *ofsI;
-  }
-}
-
-void ConvPro::openOFStream(std::ofstream & ofs, std::string fname, std::ios_base::openmode mode)
-{
-  FUNCSTART("void ConvPro::openOFStream(std::ofstream & ofs, std::string fname, std::ios_base::openmode mode)");
-  ofs.open(fname,mode);
-  if(ofs.fail()){
-    MIRANOTIFY(Notify::FATAL,"File " << fname << " could not be opened for writing. Possible causes: non-existing or write protected directory; disk quota exceeded; others.");
-  }
-}
-
-void ConvPro::openIFStream(std::ifstream & ifs, std::string fname, std::ios_base::openmode mode)
-{
-  FUNCSTART("void ConvPro::openOFStream(std::ofstream & ofs, std::string fname, std::ios_base::openmode mode)");
-  ifs.open(fname,mode);
-  if(ifs.fail()){
-    MIRANOTIFY(Notify::FATAL,"File " << fname << " could not be opened for reading. Possible causes: non-existing directory; not allowed to read directory or file; others.");
-  }
-}
-
-
-int ConvPro::mainConvPro(int argc, char ** argv)
-{
-  //CALLGRIND_STOP_INSTRUMENTATION;
-
-  FUNCSTART("int mainConvPro(int argc, char ** argv)");
-
-  Notify::setBangOnThrow(true);
-
-  int c;
-  extern char *optarg;
-  extern int optind;
-
-  base_quality_t fqqualoffset=33;
-
-  string strainfile="";
-
-  int32 linelen=60;
-  char  endgap_fillchar=' ';
-
-  string miraparams;
-
-  //"CZihumMsl:r:c:f:t:s:q:n:N:v:x:X:y:z:o:a:"
-  const char pstring[]=
-    "aAbCdFhimMsTuvZ"
-    "c:f:l:n:N:o:P:q:Q:r:R:S:t:V:x:X:y:Y:z:";
-
-  while (1){
-    c = getopt(argc, argv, pstring);
-    if(c == -1) break;
-
-    switch (c) {
-    case 'v': {
-      cout << MIRAVERSION << endl;
-      exit(0);
-    }
-    case '?': {
-      cerr << "Use '-h' to get a short online help." << endl;
-      exit(100);
-    }
-    case 'h': {
-      usage();
-      exit(0);
-    }
-
-    case 'a': {
-      CP_mustdeletetargetfiles=false;
-      break;
-    }
-    case 'A': {
-      CP_ulcaseclips=false;
-      break;
-    }
-    case 'b': {
-      CP_blinddata=true;
-      break;
-    }
-    case 'c': {
-      string egfc=optarg;
-      if(egfc.size()!=1){
-	usage();
-	cout << endl;
-	cerr << "ERROR: -c must be a single character\n";
-	exit(1);
-      }
-      endgap_fillchar=egfc[0];
-      break;
-    }
-    case 'C': {
-      CP_hardtrim=true;
-      break;
-    }
-    case 'd': {
-      CP_deletestaronlycolumns=true;
-      break;
-    }
-    case 'f': {
-      CP_fromtype=optarg;
-      break;
-    }
-    case 'F': {
-      if(CP_filter2readgroup){
-	CP_filter2readgroup_split=true;
-      }
-      CP_filter2readgroup=true;
-      break;
-    }
-    case 'i': {
-      CP_keepnamesfromfile=false;
-      break;
-    }
-    case 'l': {
-      linelen=atoi(optarg);
-      if(linelen <= 0) {
-	usage();
-	cout << endl;
-	cerr << "ERROR: -l must be >=0\n";
-	exit(1);
-      }
-      break;
-    }
-    case 'm': {
-      CP_makecontigs=true;
-      CP_extractreadsinsteadcontigs=false;
-      break;
-    }
-    case 'M': {
-      CP_extractreadsinsteadcontigs=true;
-      CP_makecontigs=false;
-      break;
-    }
-    case 'n': {
-      CP_namefile=optarg;
-      break;
-    }
-    case 'N': {
-      CP_namefile=optarg;
-      CP_sortbyname=true;
-      break;
-    }
-    case 'o': {
-      auto tmpv=atoi(optarg);
-      if(tmpv<0 || tmpv > 100) {
-	usage();
-	cout << endl;
-	cerr << "ERROR: -o must be  0 <= value <= 100\n";
-	exit(1);
-      }
-      fqqualoffset=static_cast<base_quality_t>(tmpv);
-      break;
-    }
-    case 'P': {
-      miraparams=optarg;
-      break;
-    }
-    case 'Q': {
-      CP_minqual=atoi(optarg);
-      if(CP_minqual >100) {
-	usage();
-	cout << endl;
-	cerr << "ERROR: -Q must be <= 100\n";
-	exit(1);
-      }
-      break;
-    }
-    case 'q': {
-      auto tmpv=atoi(optarg);
-      if(tmpv<0 || tmpv > 100) {
-	usage();
-	cout << endl;
-	cerr << "ERROR: -q must be  0 <= value <= 100\n";
-	exit(1);
-      }
-      CP_defaultqual=tmpv;
-      CP_needsquality=false;
-      break;
-    }
-    case 'r': {
-      string rrr=optarg;
-      for(size_t si=0; si<rrr.size(); si++){
-	switch(rrr[si]){
-	case 'c' :
-	case 'C' :
-	case 'q' : {
-	  CP_recalcconopt=rrr[si];
-	  break;
-	}
-	case 'f' :
-	case 'r' : {
-	  CP_recalcfeatureopt=rrr[si];
-	  break;
-	}
-	default : {
-	  cerr << "ERROR: -r must be one of c, C, q, f, r\n";
-	  usage();
-	  exit(1);
-	}
-	}
-      }
-      break;
-    }
-    case 'R': {
-      CP_renamesequences=optarg;
-      break;
-    }
-    case 's': {
-      CP_splitcontigs2singlefiles=true;
-      break;
-    }
-    case 'S': {
-      CP_renamenamescheme=optarg;
-      break;
-    }
-    case 'T': {
-      CP_trimnx=true;
-      break;
-    }
-    case 't': {
-      CP_totype.push_back(optarg);
-      break;
-    }
-    case 'u': {
-      CP_fillholesinstraingenomes=true;
-      break;
-    }
-    case 'V': {
-      CP_minbasecoverage=atoi(optarg);
-      break;
-    }
-    case 'x': {
-      CP_mincontiglength=atoi(optarg);
-      break;
-    }
-    case 'X': {
-      CP_mincontiglength=atoi(optarg);
-      CP_minlengthisclipped=true;
-      break;
-    }
-    case 'y': {
-      CP_mincontigcoverage=atoi(optarg);
-      break;
-    }
-    case 'Y': {
-      CP_yieldmax=atoi(optarg);
-      break;
-    }
-    case 'z': {
-      CP_minnumreads=atoi(optarg);
-      break;
-    }
-    case 'Z': {
-      CP_specialtestcode=true;
-      break;
-    }
-    default : {
-      cout << "Oooops? Known but unhandled option " << c << " ?\n";
-      exit(100);
-    }
-    }
-  }
-
-  if(argc-optind < 1) {
-    usage();
-    cout << endl;
-    cerr << argv[0] << ": " << "Missing infile and out-basename as arguments!\n";
-    exit(1);
-  }
-
-  if(argc-optind < 2) {
-    usage();
-    cout << endl;
-    cerr << argv[0] << ": " << "Missing either infile or out-basename as arguments!\n";
-    exit(1);
-  }
-
-  CP_infile=argv[optind++];
-  CP_outbasename=argv[optind++];
-
-  if(CP_infile=="--help"){
-    usage();
-    exit(0);
-  }
-
-  guessFromAndToType(CP_infile, CP_fromtype, &CP_inbasename,
-		     CP_outbasename, CP_totype, &CP_outbasename);
-
-  // anything additional on the command line is treated as an additional totype
-  for(; optind < argc; ++optind){
-    CP_totype.push_back(argv[optind]);
-  }
-
-  if(CP_fromtype=="gb" || CP_fromtype=="gbk" || CP_fromtype=="gbff"){
-    CP_fromtype="gbf";
-  }
-
-  // sanitise totypes:
-  //  gbf ...
-  for(list<string>::iterator ttI= CP_totype.begin(); ttI!=CP_totype.end(); ++ttI){
-    if(*ttI=="gb" || *ttI=="gbk" || *ttI=="gbff"){
-      *ttI="gbf";
-    }else if(*ttI=="fq"){
-      *ttI="fastq";
-    }else if(*ttI=="fa"
-	     || *ttI=="fna"){
-      *ttI="fasta";
-    }
-  }
-
-  // sanitise totypes:
-  // uniquify totypes
-  CP_totype.sort();
-  CP_totype.erase(unique(CP_totype.begin(),CP_totype.end()),CP_totype.end());
-
-  // sanitise totypes:
-  // remove all "sam" if "samnbb" is present
-  if(find(CP_totype.begin(),CP_totype.end(),"samnbb")!=CP_totype.end()){
-    auto eI = std::remove(CP_totype.begin(),CP_totype.end(),"sam");
-    CP_totype.erase(eI,CP_totype.end());
-  }
-
-
-  checkTypes(CP_fromtype,CP_totype);
-
-  MIRAParameters::setupStdMIRAParameters(CP_Pv);
-  if(!miraparams.empty()){
-    cout << "Parsing special MIRA parameters: " << miraparams << endl;
-    // switch off the checking of technology presence in the MIRAParameters object,
-    //  this makes almost no sense. See bug report for -A "SOLEXA_SETTINGS -CO:fnicpst=yes"
-    CP_Pv[0].getNonConstSpecialParams().sp_parse_checktechnologypresence=false;
-    MIRAParameters::parse(miraparams.c_str(),CP_Pv,false);
-    cout << "Ok.\n";
-  }
-
-  CP_Pv[0].getNonConstContigParams().con_output_text_cpl=linelen;
-  CP_Pv[0].getNonConstContigParams().con_output_html_cpl=linelen;
-  CP_Pv[0].getNonConstContigParams().con_output_text_gapfill=endgap_fillchar;
-  CP_Pv[0].getNonConstContigParams().con_output_html_gapfill=endgap_fillchar;
-  CP_Pv[0].getNonConstNagAndWarnParams().nw_check_templateproblems=NWNONE;
-
-  ReadPool thepool;
-  thepool.setMissingFASTAQualFileResolveMsg("use -Q");
-
-  CP_assemblyinfo.setLargeContigSize(CP_mincontiglength);
-  CP_assemblyinfo.setLargeTotalCov(CP_mincontigcoverage);
-
-  if(CP_recalcconopt=='C'){
-    for(uint32 i=0; i< CP_Pv.size(); i++){
-      CP_Pv[i].setContigForceNonIUPAC(true,true);
-    }
-  }
-
-  if(!CP_namefile.empty()){
-    General::makeSelectionStringSet(CP_namefile);
-  }
-
-  // check that output does not overwrite input
-  if(CP_inbasename==CP_outbasename){
-    for(auto & tt : CP_totype){
-      if(tt == CP_fromtype){
-	cerr << "Output file " << CP_outbasename << '.' << tt
-	     << " would overwrite input file " << CP_infile
-	     << ", aborting.\n";
-	exit(10);
-      }
-    }
-  }
-
-  cout << "Loading from " << CP_fromtype << ", saving to:";
-  ofstream * ofstmp;
-  for(list<string>::iterator ttI= CP_totype.begin(); ttI!=CP_totype.end(); ++ttI){
-    ofstmp=new ofstream;
-    CP_ofs.push_back(ofstmp);
-    cout << ' ' << *ttI;
-    if(*ttI=="fasta"){
-      if(!CP_splitcontigs2singlefiles){
-	openOFStream(*CP_ofs.back(),createFileNameFromBasePostfixContigAndRead(CP_outbasename,".fasta"),ios::out);
-      }
-      CP_totype.push_back("fastaqual");
-    } else if(*ttI=="fastaqual"){
-      if(!CP_splitcontigs2singlefiles){
-	openOFStream(*CP_ofs.back(),createFileNameFromBasePostfixContigAndRead(CP_outbasename,".fasta.qual"),ios::out);
-      }
-    } else if(*ttI=="maskedfasta"){
-      if(!CP_splitcontigs2singlefiles){
-	openOFStream(*CP_ofs.back(),createFileNameFromBasePostfixContigAndRead(CP_outbasename,".fasta"),ios::out);
-      }
-      CP_totype.push_back("maskedfastaqual");
-    } else if(*ttI=="maskedfastaqual"){
-      if(!CP_splitcontigs2singlefiles){
-	openOFStream(*CP_ofs.back(),createFileNameFromBasePostfixContigAndRead(CP_outbasename,".fasta.qual"),ios::out);
-      }
-    } else if(*ttI=="fastq"){
-      if(!CP_splitcontigs2singlefiles){
-	openOFStream(*CP_ofs.back(),createFileNameFromBasePostfixContigAndRead(CP_outbasename,".fastq"),ios::out);
-      }
-    } else if(*ttI=="caf" || *ttI=="scaf" ){
-      if(!CP_splitcontigs2singlefiles){
-	openOFStream(*CP_ofs.back(),createFileNameFromBasePostfixContigAndRead(CP_outbasename,".caf"),ios::out);
-      }
-    } else if(*ttI=="maf"){
-      if(!CP_splitcontigs2singlefiles){
-	openOFStream(*CP_ofs.back(),createFileNameFromBasePostfixContigAndRead(CP_outbasename,".maf"),ios::out);
-	Contig::dumpMAF_Head(*(CP_ofs.back()));
-      }
-    } else if(*ttI=="sam" || *ttI=="samnbb"){
-      if(!CP_splitcontigs2singlefiles){
-	openOFStream(*CP_ofs.back(),createFileNameFromBasePostfixContigAndRead(CP_outbasename,".sam"),ios::out);
-      }
-    } else if(*ttI=="gff3"){
-      if(!CP_splitcontigs2singlefiles){
-	CP_gffsave.open(createFileNameFromBasePostfixContigAndRead(CP_outbasename,"").c_str());
-      }
-    } else if(*ttI=="hsnp"){
-    } else if(*ttI=="asnp"){
-    } else if(*ttI=="fcov"){
-    } else if(*ttI=="cstats"){
-    } else if(*ttI=="crlist"){
-    } else if(*ttI=="html"){
-    } else if(*ttI=="text"){
-    } else if(*ttI=="txt"){
-    } else if(*ttI=="exp"){
-    } else if(*ttI=="gbf"){
-    } else if(*ttI=="gff3"){
-    } else if(*ttI=="ace"){
-    } else if(*ttI=="tcs"){
-    } else if(*ttI=="wiggle" || *ttI=="wig"){
-    } else if(*ttI=="gcwiggle" || *ttI=="gcwig"){
-    } else if(*ttI=="null"){
-    } else {
-      BUGIFTHROW(true,"should never arrive here!");
-    }
-  }
-  cout << '\n';
-
-  auto cpofsI=CP_ofs.begin();
-  for(list<string>::iterator ttI= CP_totype.begin(); ttI!=CP_totype.end(); ++ttI, ++cpofsI){
-    if(*ttI=="sam" || *ttI=="samnbb"){
-      if(CP_fromtype=="maf"){
-	cout << "Collecting basic SAM info from MAF file" << endl;
-	CP_samcollect.processMAF(CP_infile);
-	CP_samcollect.createSAMHeader();
-	*(*cpofsI) << CP_samcollect.SAMC_headerstring;
-	ReadGroupLib::discard();
-      }else{
-	cout.flush();
-	cerr << "\n\ncan only convert MAF to SAM for the time being, sorry\n";
-	exit(1);
-      }
-    }
-  }
-
-  CP_mustcaseclips=false;
-  if(CP_fromtype=="caf" || CP_fromtype=="maf") {
-    for(auto & tte : CP_totype){
-      if(!(tte == "caf"
-	   || tte == "scaf"
-	   || tte == "maf"
-	   || tte == "sam"
-	   || tte == "samnbb"
-	   || tte == "exp")){
-	//cout << "huh? " << tte << endl;
-	CP_mustcaseclips=true;
-	break;
-      }
-    }
-  }
-
-  try{
-    ReadPoolIO rpio(thepool);
-    rpio.setAttributeProgressIndicator(true);
-    rpio.setAttributeFASTQQualOffset(33); // in case we load FASTQs
-    rpio.setAttributeFASTAPreserveComment(true);
-
-    if(CP_fromtype=="caf" || CP_fromtype=="maf") {
-      void (*usecrcallback)(list<Contig> &, ReadPool &) = cafmafload_callback;
-      void (*usercallback)(ReadPool &) = readpoolload_callback;
-      if(CP_sortbyname){
-	usecrcallback=nullptr;
-	usercallback=nullptr;
-      }
-
-      // TODO: switch to ReadPoolIO
-      if(CP_fromtype=="caf") {
-	CAF tcaf(&thepool, &CP_clist, &CP_Pv);
-	tcaf.setProgressIndicator(true);
-	if(CP_filter2readgroup) {
-	  usecrcallback=nullptr;
-	  usercallback=nullptr;
-	}
-	vector<uint32> dummy;
-	tcaf.load(CP_infile.c_str(),
-		  ReadGroupLib::SEQTYPE_SANGER,
-		  1,
-		  dummy,
-		  false,
-		  usecrcallback
-	  );
-      }else if(CP_fromtype=="maf") {
-	MAFParse mafp(&thepool, &CP_clist, &CP_Pv);
-	mafp.setProgressIndicator(true);
-	if(CP_filter2readgroup) {
-	  usecrcallback=nullptr;
-	  usercallback=nullptr;
-	}
-	vector<uint32> dummy;
-	mafp.load(CP_infile.c_str(),
-		  ReadGroupLib::SEQTYPE_SANGER,
-		  1,
-		  dummy,
-		  false,
-		  usecrcallback,
-		  usercallback
-	  );
-      }
-      if(!CP_clist.empty() && usecrcallback==nullptr){
-	sortContigsByName(CP_clist);
-	cafmafload_callback(CP_clist,thepool);
-      }else if(thepool.size()!=0){
-	if(CP_sortbyname) sortPoolByName(thepool,CP_namefile);
-	cafmafload_callback(CP_clist,thepool);
-      }
-    }else{
-      cout << "Loading data from " << CP_fromtype << " ...";
-
-      ReadGroupLib::ReadGroupID rgid=ReadGroupLib::newReadGroup();
-      rgid.setSequencingType(ReadGroupLib::SEQTYPE_TEXT);
-      rgid.setDefaultQual(CP_defaultqual);
-
-      string fn2;
-      if(CP_fromtype=="fasta"){
-	fn2=CP_infile+".qual";
-      }
-
-      string loadtype(CP_fromtype);
-      if(loadtype=="fasta" && !CP_needsquality){
-	loadtype="fastanoqual";
-      }
-
-      uint64 numseqstoload=500;
-      base_quality_t fastqbq=255;
-      if(CP_sortbyname){
-	cout << "For sorting the reads by name, more RAM will be used as the full file needs to load into memory.\n";
-	numseqstoload=-1;
-      }else if(CP_fromtype=="fastq" && fqqualoffset==0){
-	cout << "For guessing the FASTQ offset, more RAM will be used as the full file needs to load into memory.\n";
-	numseqstoload=-1;
-      }
-
-      rpio.registerFile(loadtype, CP_infile, fn2, rgid, false);
-      while(rpio.loadNextSeqs(numseqstoload)){
-	if(fqqualoffset==0){
-	  thepool.adaptFASTQQualValues(0,thepool.size(),0,true);
-	}
-	if(CP_sortbyname){
-	  sortPoolByName(thepool,CP_namefile);
-	}
-	readpoolload_callback(thepool);
-	if(CP_yieldmax>0 && CP_yieldwritten>CP_yieldmax) break;
-      }
-    }
-  }
-  catch(Notify n){
-    // Need to close by hand as handleError() will perform a hard exit
-    closeOpenStreams(CP_ofs);
-    n.handleError(THISFUNC);
-  }
-  catch(Flow f){
-    cerr << "Unexpected exception: Flow()\n";
-  }
-  catch(...){
-    cout.flush();
-    cerr.flush();
-    cerr << "Unknown exception caught, aborting the process.\n\nPlease contact: bach at chevreux.org\n\n";
-    abort();
-  }
-
-  cout << " done.\n";
-
-  if(CP_yieldmax) {
-    cout << "Written " << CP_yieldwritten << " bases.";
-  }
-
-  cout << "\nData conversion process finished, no obvious errors encountered.\n";
-
-  if(CP_numclippedreadsinload && !CP_hardtrim){
-    if(CP_mustcaseclips && CP_ulcaseclips){
-      cout << FmtText::wordWrap("\nNOTICE! You converted data which has clipping information (CAF or MAF) into a format which does not contain clipping information. As you did not use the '-C' option (perform hard clip), your result files do contain the complete sequences including clipped parts. The clipped parts of reads have been set to lower case, the unclipped parts have upper case.\nIf you do not want to have the sequence case changed, use '-A'. If you want the sequence trimmed ins [...]
-    }else if(CP_mustcaseclips){
-      cout << FmtText::wordWrap("\nWARNING! You converted data which has clipping information (CAF or MAF) into a format which does not contain clipping information. As you did not use the '-C' option (perform hard clip), your result files do contain the complete sequences including clipped parts. Furthermore, you used '-A' to switch off adapting case for denoting clipped parts in sequences. If you do not want this, use '-C'. Or do not use '-A'.\n");
-    }
-  }
-
-  FUNCEND();
-  return 0;
-}
diff --git a/src/modules/mod_convert.H b/src/modules/mod_convert.H
deleted file mode 100644
index e0d2d28..0000000
--- a/src/modules/mod_convert.H
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
- *   Krebsforschungszentrum, DKFZ Heidelberg) and Bastien Chevreux
- * Copyright (C) 2000 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-#include <fstream>
-
-#include <string>
-#include <vector>
-#include <list>
-
-#include "mira/parameters.H"
-#include "mira/readpool.H"
-#include "mira/contig.H"
-#include "mira/assembly.H"
-#include "mira/sam_collect.H"
-#include "mira/gff_save.H"
-
-class ConvPro
-{
-private:
-  static std::vector<MIRAParameters> CP_Pv;
-
-  static std::string CP_fromtype;
-  static std::list<std::string> CP_totype;
-
-  static std::list<std::ofstream *> CP_ofs;
-
-
-  static std::string CP_infile;
-
-  static std::string CP_inbasename;
-  static std::string CP_outbasename;
-
-  static std::string CP_renamesequences;
-  static std::string CP_renamenamescheme;
-
-  static bool CP_splitcontigs2singlefiles;
-
-  static bool CP_deletestaronlycolumns;
-  static bool CP_blinddata;
-  static bool CP_fillholesinstraingenomes;
-  static bool CP_makecontigs;
-  static bool CP_extractreadsinsteadcontigs;
-  static bool CP_hardtrim;
-  static bool CP_trimnx;
-
-  static std::string CP_namefile;
-  static bool CP_keepnamesfromfile;
-  static bool CP_sortbyname;
-
-  static bool CP_mustdeletetargetfiles;
-
-  static bool CP_specialtestcode;
-
-  static bool CP_filter2readgroup;
-  static bool CP_filter2readgroup_split;
-
-  static base_quality_t CP_minqual;
-  static bool CP_needsquality;
-  static base_quality_t CP_defaultqual;
-
-  static char CP_recalcconopt;
-  static char CP_recalcfeatureopt;
-
-  static uint32 CP_minbasecoverage;
-
-  static uint32 CP_mincontiglength;
-  static bool   CP_minlengthisclipped;
-
-  static uint32 CP_mincontigcoverage;
-  static uint32 CP_minnumreads;
-
-  static std::list<Contig> CP_clist;   // needed for CAF & MAF conversion (and GBF)
-  static AssemblyInfo CP_assemblyinfo;
-
-  static uint64 CP_readrenamecounter;
-  static GFFSave CP_gffsave;
-  static SAMCollect CP_samcollect;
-
-  static uint64 CP_numclippedreadsinload; // number of reads which have clips already when loaded (CAF/MAF)
-  static bool CP_ulcaseclips; // user wants change case of sequence according to left / right clips?
-  static bool CP_mustcaseclips; // mirabait must change case clips for reads not in contigs
-
-  static uint64 CP_yieldmax; // max bases to be written out
-  static uint64 CP_yieldwritten; // currently written
-
-private:
-  static void usage();
-  static void checkTypes(const std::string & fromtype,std::list<std::string> & totype);
-  static void putReadsInContigsAndSave(std::vector<MIRAParameters> & Pv, ReadPool & rp);
-  static void discardShortReads(std::vector<MIRAParameters> & Pv, ReadPool & rp, uint32 minlength, bool fromclipped);
-  static void specialTestCode(std::list<Contig> & clist, ReadPool & rp);
-
-  static void filterToReadGroup(ReadPool & rp);
-
-  static bool contig__nameordercomp(const Contig & a, const Contig & b);
-  static void sortContigsByName(std::list<Contig> & clist);
-  static void sortPoolByName(ReadPool & rp, std::string & filename);
-
-  static void saveContigList(std::list<Contig> & clist, ReadPool & rp);
-  static void saveContigList_helper(std::list<Contig> & clist, ReadPool & rp);
-
-  static void saveReadPool(ReadPool & rp, std::list<std::ofstream *> & ofs);
-  static void cafmafload_callback(std::list<Contig> & clist, ReadPool & rp);
-  static void readpoolload_callback(ReadPool & rp);
-  static std::string createFileNameFromBasePostfixContigAndRead(const std::string & basename,
-							   const char * postfix,
-							   Contig * actcon = nullptr,
-							   Read * actread = nullptr);
-  static uint32 openOFSlist(Contig * optcontig, std::list<std::ofstream *> & ofs);
-  static void closeOFSList(uint32 howmany, std::list<std::ofstream *> & ofs);
-
-  static void openIFStream(std::ifstream & ifs, std::string fname, std::ios_base::openmode mode);
-  static void openOFStream(std::ofstream & ofs, std::string fname, std::ios_base::openmode mode);
-
-public:
-  ~ConvPro();
-
-  int mainConvPro(int argc, char ** argv);
-
-  static void closeOpenStreams(std::list<std::ofstream *> & ofsl);
-
-  static bool checkForFromType(const std::string & ftype);
-  static bool checkForToType(const std::string & ttype);
-  static void guessFromAndToType(const std::string & fnamefrom,
-				 std::string & fromtype,
-				 std::string * fromstem,
-				 const std::string & fnameto,
-				 std::list<std::string> & totypes,
-				 std::string * tostem);
-};
-
diff --git a/src/modules/mod_dbgreplay.C b/src/modules/mod_dbgreplay.C
deleted file mode 100644
index 09e7fc3..0000000
--- a/src/modules/mod_dbgreplay.C
+++ /dev/null
@@ -1,90 +0,0 @@
-#include <iostream>
-#include <string>
-
-#include "mira/assembly.H"
-#include "mira/align.H"
-#include "mira/parameters.H"
-#include "mira/maf_parse.H"
-
-
-
-using namespace std;
-
-
-int dbgReplayMain(int argc, char ** argv)
-{
-  FUNCSTART("dbgReplayMain");
-
-  string datafile="e.maf";
-  string refrname="HUZ85:2416:1763";
-  string newrname="HUZ85:1578:1024";
-  string paramstring="--job=denovo,genome,accurate,iontor";
-
-  vector<MIRAParameters> MPv;
-  MIRAParameters::setupStdMIRAParameters(MPv);
-
-  if(!paramstring.empty()){
-    MIRAParameters::parse(paramstring.c_str(),MPv);
-  }
-
-  ReadPool       greadpool;
-  list<Contig>   gcontigs;
-
-  // not used, but needed for linking *sigh*
-  Manifest manifest;
-  Assembly as(manifest,MPv,false);
-
-  MAFParse tmaf(&greadpool, &gcontigs, &MPv);
-  vector<uint32> dummy;
-  tmaf.load(datafile, ReadGroupLib::SEQTYPE_SANGER, 1, dummy, false);
-  greadpool.makeTemplateIDs(NWWARN);
-
-  greadpool.allowNameIndex(true);
-  int32 refid=greadpool.getReadIndex(refrname);
-  BUGIFTHROW(refid<0,"Ref " << refrname << " not in readpool?");
-  int32 newid=greadpool.getReadIndex(newrname);
-  BUGIFTHROW(newid<0,"New " << newrname << " not in readpool?");
-
-  AlignedDualSeqFacts adsf;
-  // refid, newid,
-  //   delta,id1_rightdelta, id2_rightdelta, totallen, id1_direction, id2_direction, score_ratio
-  //adsf.publicinit(refid,newid,2,0,9,91,1,1,100);
-  int8 dirnewid=-1;
-  bool newid_ismulticopy=true;
-  adsf.publicinit(newid,refid,14,41,0,242,1,1,94,4,0,0,28,0);
-
-  cout << adsf << endl;
-
-  Contig::errorstatus_t errstat;
-  vector<Align> aligncache;
-  for(uint32 i=0; i<ReadGroupLib::SEQTYPE_END; i++) {
-    Align a(&MPv[i]);
-    aligncache.push_back(a);
-  }
-
-  cout << "before\n";
-  Contig::setCoutType(Contig::AS_TEXT);
-  cout << gcontigs.back();
-  Contig::templateguessinfo_t tguess;
-  gcontigs.back().addRead(aligncache,
-			  &adsf,
-			  refid,newid,
-			  dirnewid,
-			  newid_ismulticopy,
-			  0,
-			  tguess,
-			  errstat);
-
-  if(errstat.code == Contig::ENOERROR) {
-    cout << "read added\n\n";
-    Contig::setCoutType(Contig::AS_TEXT);
-    cout << gcontigs.back();
-  }else{
-    cout << "read not added\n\n";
-    Contig::setCoutType(Contig::AS_TEXT);
-    cout << gcontigs.back();
-  }
-
-
-  return 0;
-}
diff --git a/src/modules/mod_diff.C b/src/modules/mod_diff.C
deleted file mode 100644
index b79d3de..0000000
--- a/src/modules/mod_diff.C
+++ /dev/null
@@ -1,305 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
- *   Krebsforschungszentrum, DKFZ Heidelberg) and Bastien Chevreux
- * Copyright (C) 2000 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-#include <getopt.h>
-
-#include "modules/mod_diff.H"
-
-#include <boost/algorithm/string.hpp>
-#include <boost/lexical_cast.hpp>
-
-#include "util/fmttext.H"
-#include "mira/readpool_io.H"
-
-#include "version.H"
-
-
-using namespace std;
-
-
-
-
-MiraDiff::MiraDiff()
-{
-}
-
-void MiraDiff::usage()
-{
-//hdiIpPrvb:f:t:o:a:k:L:n:
-  cout << "miramer\t(MIRALIB version " << MIRALIBVERSION << ")\n";
-  cout << "Author: Bastien Chevreux\t(bach at chevreux.org)\n\n";
-  cout << "...\n";
-}
-
-
-void MiraDiff::priv_clipsAfterLoad(ReadPool & myrp)
-{
-  MIRAParameters::setupStdMIRAParameters(MD_miraparams);
-  MIRAParameters::parse("--job=genome,denovo,accurate,solexa",MD_miraparams,false);
-  MD_miraparams[0].getNonConstDirectoryParams().dir_tmp=".";  // for DataProcessing
-  //MIRAParameters::dumpAllParams(MD_miraparams,cout);
-  //cout.flush();
-
-  //auto numthreads=MD_miraparams[0].getAssemblyParams().as_numthreads;
-  auto numthreads=4;
-
-  vector<uint8> debrisreason;
-  debrisreason.clear();
-  debrisreason.resize(myrp.size(),Assembly::DEBRIS_NOTDEBRIS);
-
-  vector<unique_ptr<DataProcessing>> dpv(numthreads);
-  DataProcessing dpcollector(&MD_miraparams);
-
-  for(uint32 ti=0; ti<dpv.size(); ++ti){
-    dpv[ti]=unique_ptr<DataProcessing>(new DataProcessing(&MD_miraparams));
-    string logname("mdclip_t" + boost::lexical_cast<string>(ti) + ".txt");
-    cout << logname << endl;
-    dpv[ti]->startLogging(logname,false);
-  }
-
-  string logprefix("loadclip: ");
-  cout << "Post-load clips:\n";
-
-  DataProcessing::stdTreatmentPool_MultiThread(MD_miraparams,dpcollector,dpv,myrp,&debrisreason,logprefix,true);
-
-  cout << endl;
-  if(dpcollector.DP_stats.cphix174){
-    cout << "SEARCH MSG: PhiX 174 found: " << dpcollector.DP_stats.cphix174 << endl;
-  }
-  if(dpcollector.DP_stats.cadapright){
-    cout << "CLIP MSG: Adaptor right found: " << dpcollector.DP_stats.cadapright << endl;
-  }
-  if(dpcollector.DP_stats.cadaprightpartial){
-    cout << "CLIP MSG: Partial adaptor right found: " << dpcollector.DP_stats.cadaprightpartial << endl;
-  }
-}
-
-
-void MiraDiff::priv_simpleDiff(int argc, char ** argv)
-{
-  list<string> loadfs1;
-
-  uint32 numfiles=1;
-  uint8 basesperhash=31;
-
-  int32 trimfr=4;
-  int32 trimtot=20;
-
-  string nameseta("A");
-  string namesetb("B");
-
-  for(auto fc=0;optind<argc && fc<numfiles;++optind,++fc){
-    loadfs1.push_back(argv[optind]);
-  }
-
-  list<string> loadfs2;
-  for(auto fc=0;optind<argc && fc<numfiles;++optind,++fc){
-    loadfs2.push_back(argv[optind]);
-  }
-
-  auto rgid=ReadGroupLib::newReadGroup();
-  rgid.setSequencingType(ReadGroupLib::SEQTYPE_SOLEXA);
-
-  cout << "Loading data set " << nameseta << " into memory:\n";
-  ReadPool myrp;
-  ReadPoolIO rpio(myrp);
-  rpio.setAttributeFASTAQualFileWanted(false); // in case we load FASTAs
-  rpio.setAttributeFASTQQualOffset(33); // in case we load FASTQs
-
-  for(auto & dfn : loadfs1){
-    cout << dfn << endl;
-    uint8 ziptype=0;
-    string ft;
-    string dummyfromstem;
-    string dummypathto;
-    guessFileAndZipType(dfn,dummypathto,dummyfromstem,ft,ziptype);
-
-    rpio.registerFile(ft,dfn,"",rgid,false);
-    rpio.loadNextSeqs(-1,-1);
-  }
-  cout << "\nDone\n";
-  cout << "Clipping pool " << nameseta << ":\n";
-  priv_clipsAfterLoad(myrp);
-  cout << "\nDone\n";
-  cout << "Calculating hash statistics for pool " << nameseta << " :\n";
-
-  string dummyfn;
-  bool MB_fwdandrev=true;
-  HashStatistics<vhash64_t> hs1;
-  hs1.prepareHashStatistics(myrp,false,false,MB_fwdandrev,1,0,basesperhash,
-			    MD_miraparams[0].getHashStatisticsParams().hs_million_hashes_per_buffer,
-			    dummyfn,".");
-  cout << "\nDone\nSaving ...";cout.flush();
-  hs1.saveHashStatistics(nameseta+".mhs.gz");
-  cout << "done." << endl;
-
-  hs1.trimHashStatsByFrequencyANDOR(trimfr,trimfr,trimtot);
-
-  cout << "hash distrib " << nameseta << " :\n";
-  //hs1.dumpHashDistrib(cout);
-  hs1.sortByCountDown();
-  //hs1.dump(cout);
-
-//  hs1.sortLexicographically();
-//  cout << "########## HS1\n";
-//  hs1.dump(cout);
-
-
-  cout << "Loading data set " << namesetb << " into memory:\n";
-
-  myrp.discard();
-  for(auto & dfn : loadfs2){
-    cout << dfn << endl;
-    uint8 ziptype=0;
-    string ft;
-    string dummyfromstem;
-    string dummypathto;
-    guessFileAndZipType(dfn,dummypathto,dummyfromstem,ft,ziptype);
-
-    rpio.registerFile(ft,dfn,"",rgid,false);
-    rpio.loadNextSeqs(-1,-1);
-  }
-  cout << "\nDone\n";
-  cout << "Clipping pool " << namesetb << " :\n";
-  priv_clipsAfterLoad(myrp);
-  cout << "\nDone\n";
-
-  cout << "Calculating hash statistics for pool " << namesetb << " :\n";
-  HashStatistics<vhash64_t> hs2;
-  hs2.prepareHashStatistics(myrp,false,false,MB_fwdandrev,1,0,basesperhash,
-			    MD_miraparams[0].getHashStatisticsParams().hs_million_hashes_per_buffer,
-			    dummyfn,".");
-  cout << "\nDone\nSaving ...";cout.flush();
-  hs2.saveHashStatistics(namesetb+".mhs.gz");
-  cout << "done." << endl;
-
-  myrp.discard();
-
-  hs2.trimHashStatsByFrequencyANDOR(trimfr,trimfr,trimtot);
-  cout << "hash distrib " << namesetb << " :\n";
-
-//  cout << "########## HS2\n";
-  hs2.sortByCountDown();
-//  hs2.dump(cout);
-
-//  hs2.sortLexicographically();
-//  cout << "########## HS2\n";
-//  hs2.dump(cout);
-
-  cout << "creating subhs" << endl;
-  HashStatistics<vhash64_t> in_a_not_b;
-  in_a_not_b.inANotB(hs1,hs2);
-  in_a_not_b.sortByCountDown();
-  cout << "\n######## " << nameseta << " not " << namesetb << "\n";
-  in_a_not_b.dump(cout);
-
-  HashStatistics<vhash64_t> in_b_not_a;
-  in_b_not_a.inANotB(hs2,hs1);
-  in_b_not_a.sortByCountDown();
-  cout << "\n######## " << namesetb << " not " << nameseta << "\n";
-  in_b_not_a.dump(cout);
-
-//  HashStatistics<vhash64_t> in_a_and_b;
-//  in_a_and_b.inAAndB(hs1,hs2);
-//  in_a_and_b.sortByCountDown();
-//  cout << "\n######## A and B\n";
-//  in_a_and_b.dump(cout);
-
-  cout << "\nDone\n";
-
-}
-
-int MiraDiff::mainMiraDiff(int argc, char ** argv)
-{
-  // that loop is straight from the GNU getopt_long example
-  // http://www.gnu.org/s/hello/manual/libc/Getopt-Long-Option-Example.html
-  while (1){
-    static struct option mlong_options[] =
-      {
-	{"help",  no_argument,           0, 'h'},
-	{"job", required_argument,         0, 'j'},
-	{"kmersize", required_argument,         0, 'k'},
-	{"version", no_argument,         0, 'v'},
-	{0, 0, 0, 0}
-      };
-    /* getopt_long stores the option index here. */
-    int option_index = 0;
-
-    int c = getopt_long (argc, argv, "hj:k:v",
-		     mlong_options, &option_index);
-
-    if (c == -1) break;
-
-    switch (c) {
-    case 'h':
-      cout << "mira\t\tMIRALIB version " << MIRAVERSION << "\n"
-	"Author:\t\tBastien Chevreux (bach at chevreux.org)\n"
-	"Purpose:\thandle k-mer statistics of a data set\n\n";
-
-      cout << "Usage:\n"
-	"miradiff ...\n";
-      cout << "\nOptions:\n";
-      cout <<
-	"  -h / --help\t\t\t\tPrint short help and exit\n"
-	"  -v / --version\t\t\tPrint version and exit\n"
-	;
-      exit(0);
-    case 'j': {
-      //MER_job=optarg;
-      //boost::to_lower(MER_job);
-      break;
-    }
-    case 'k': {
-      uint64 bla=atoi(optarg);
-      if(bla>32) bla=32;
-      //MER_basesperhash=bla;
-      break;
-    }
-    case 'v':
-      cout << MIRAVERSION << endl;
-      exit(0);
-    default:
-      abort();
-    }
-  }
-
-  try {
-    priv_simpleDiff(argc,argv);
-  }
-  catch(Notify n){
-    n.handleError("main");
-  }
-  catch(Flow f){
-    cerr << "Unexpected exception: Flow()\n";
-  }
-  catch(...){
-    cerr << "Unknown exception caught, aborting the process.\n\nPlease contact: bach at chevreux.org\n\n";
-    abort();
-  }
-
-  FUNCEND();
-  return 0;
-}
diff --git a/src/modules/mod_diff.H b/src/modules/mod_diff.H
deleted file mode 100644
index 481cc60..0000000
--- a/src/modules/mod_diff.H
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
- *   Krebsforschungszentrum, DKFZ Heidelberg) and Bastien Chevreux
- * Copyright (C) 2000 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-
-#include <fstream>
-
-#include <string>
-#include <vector>
-#include <list>
-
-#include "mira/assembly.H"
-//#include "mira/readpool_io.H"
-//#include "mira/dataprocessing.H"
-//#include "mira/hashstats.H"
-
-
-class MiraDiff
-{
-private:
-  std::vector<MIRAParameters> MD_miraparams;
-
-private:
-  void usage();
-
-  void priv_clipsAfterLoad(ReadPool & rp);
-
-  void priv_simpleDiff(int argc, char ** argv);
-public:
-  MiraDiff();
-
-  int mainMiraDiff(int argc, char ** argv);
-};
diff --git a/src/modules/mod_memestim.C b/src/modules/mod_memestim.C
deleted file mode 100644
index 292b44b..0000000
--- a/src/modules/mod_memestim.C
+++ /dev/null
@@ -1,438 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
- *   Krebsforschungszentrum, DKFZ Heidelberg) and Bastien Chevreux
- * Copyright (C) 2000 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-#include <iostream>
-#include <iterator>
-#include <string>
-
-
-#include "modules/mod_memestim.H"
-#include "modules/misc.H"
-
-
-#include "mira/assembly.H"
-#include "version.H"
-
-
-using namespace std;
-
-
-void mme_askChar(const string & question, const string & possibilities, char & answer, const char defchar)
-{
-  bool doloop=true;
-  while(doloop){
-    cout << question << ' ';
-    if(!possibilities.empty()){
-      cout <<"(";
-      std::copy(possibilities.begin(),
-		possibilities.end(),
-		ostream_iterator<char> (cout, "/"));
-      cout << ") ";
-    }
-    if(defchar!=0){
-      cout << "[" << defchar << "] ";
-    }
-    string input;
-    getline(cin,input);
-
-    // empty input, try to get defchar from possibilities if it exists
-    if(input.empty() && defchar!=0) input=defchar;
-    input.resize(1);
-    for(uint32 i=0; i<possibilities.size(); i++){
-      if(input[0] == possibilities[i]) {
-	doloop=false;
-	answer=input[0];
-	break;
-      }
-    }
-  }
-  cout << answer << endl;
-}
-
-void mme_askDoubleNP(const string & question, double & answer, const string & defd)
-{
-  bool doloop=true;
-  while(doloop){
-    cout << question << ' ';
-    if(!defd.empty()){
-      cout << "[" << defd << "] ";
-    }
-    string input;
-    getline(cin,input);
-
-    // empty input, try to get def from possibilities if it exists
-    if(input.empty() && !defd.empty()) {
-      input=defd;
-    }
-    char * pend;
-    answer=strtod(input.c_str(),&pend);
-    doloop=false;
-
-    // try to parse kilo, mega, giga
-    while(*pend != 0 && isspace(*pend)) pend++;
-    switch(toupper(*pend)){
-    case 0 : break;
-    case 'K' :{
-      answer*=1000;
-      break;
-    }
-    case 'M' :{
-      answer*=1000000;
-      break;
-    }
-    case 'G' :{
-      answer*=1000000000;
-      break;
-    }
-    default : {
-      cout << "Please only use k, m, g as modifiers.\n";
-      doloop=true;
-    }
-    }
-  }
-}
-
-void mme_askDouble(const string & question, double & answer, const string & defd)
-{
-  mme_askDoubleNP(question, answer, defd);
-  cout << answer << endl;
-}
-
-void mme_askInt(const string & question, int64 & answer, const string & defint)
-{
-  double tmp;
-  mme_askDoubleNP(question, tmp, defint);
-  answer=static_cast<int64>(tmp);
-  cout << answer << endl;
-}
-
-
-void miraMemEstimate(int argc, char ** argv)
-{
-  int c;
-  extern char *optarg;
-  extern int optind;
-
-  while (1){
-    c = getopt(argc, argv, "v");
-    if(c == -1) break;
-
-    switch (c) {
-    case 'v':
-      cout << MIRAVERSION << endl;
-      exit(0);
-    default : {}
-    }
-  }
-
-
-  cout << "This is MIRA " MIRAVERSION ".\n\n";
-
-  cout << "Please cite: Chevreux, B., Wetter, T. and Suhai, S. (1999), Genome Sequence\nAssembly Using Trace Signals and Additional Sequence Information.\nComputer Science and Biology: Proceedings of the German Conference on\nBioinformatics (GCB) 99, pp. 45-56.\n\n";
-  dumpStdMsg();
-
-  cout << "\n\nmiraMEM helps you to estimate the memory needed to assemble a project.\n"
-    "Please answer the questions below.\n\n"
-    "Defaults are give in square brackets and chosen if you just press return.\n"
-    "Hint: you can add k/m/g modifiers to your numbers to say kilo, mega or giga.\n\n";
-
-  char yesno;
-  char ptype=' ';
-  char denovomapping;
-  int64 seqsize=0;
-
-  int64 numsanreads=0;
-  int64 num454gs20reads=0;
-  int64 num454flxreads=0;
-  int64 num454titaniumreads=0;
-  int64 numsxareads=0;
-  int64 avgsxalen=0;
-  int64 numpbsreads=0;
-  int64 avgpbslen=0;
-  int64 largestcontigexpected=0;
-
-  // computed
-  int64 totalexpectedbases=0;
-  int64 totalreads=0;
-  int64 readsinlargestcontig=0;
-  int64 readbasesinlargestcontig=0;
-
-  mme_askChar("Is it a genome or transcript (EST/tag/etc.) project?",
-	      "ge",
-	      ptype,
-	      'g');
-  if(ptype=='g'){
-    mme_askInt("Size of genome?",
-	       seqsize,
-	       "4.5m");
-    if(seqsize<100) {
-      cout << "A sequence size of less than 100 bases is pretty improbable.\n"
-	   << "Did you forget a modifier (k, m or g) to the number you gave?\n";
-      exit(10);
-    }
-    largestcontigexpected=seqsize;
-    if(largestcontigexpected>30*1000*1000){
-      cout << "Looks like a larger eukaryote, guessing largest chromosome size: 30m\nChange if needed!\n";
-      largestcontigexpected=30*1000*1000;
-    }
-
-    {
-      string tmplc;
-      ostringstream ostr;
-      ostr << largestcontigexpected;
-      tmplc=ostr.str();
-      mme_askInt("Size of largest chromosome?",
-		 largestcontigexpected,
-		 tmplc);
-    }
-
-    mme_askChar("Is it a denovo or mapping assembly?",
-		"dm",
-		denovomapping,
-		'd');
-  }
-
-
-  mme_askInt("Number of Sanger reads?",
-	     numsanreads,
-	     "0");
-  mme_askChar("Are there 454 reads?",
-	      "yn",
-	      yesno,
-	      'n');
-  if(yesno=='y'){
-    mme_askInt("Number of 454 GS20 reads?",
-	       num454gs20reads,
-	       "0");
-    mme_askInt("Number of 454 FLX reads?",
-	       num454flxreads,
-	       "0");
-    mme_askInt("Number of 454 Titanium reads?",
-	       num454titaniumreads,
-	       "0");
-  }
-  mme_askChar("Are there PacBio reads?",
-	      "yn",
-	      yesno,
-	      'n');
-  if(yesno=='y'){
-    mme_askInt("Number of PacBio reads?",
-	       numpbsreads,
-	       "0");
-    mme_askInt("Average PacBio length?",
-	       avgpbslen,
-	       "1100");
-  }
-  mme_askChar("Are there Solexa reads?",
-	      "yn",
-	      yesno,
-	      'n');
-  if(yesno=='y'){
-    mme_askInt("Number of Solexa reads?",
-	       numsxareads,
-	       "0");
-    mme_askInt("Average Solexe length?",
-	       avgsxalen,
-	       "75");
-  }
-
-  totalexpectedbases=numsanreads*1000;
-  totalexpectedbases+=num454gs20reads*120;
-  totalexpectedbases+=num454flxreads*260;
-  totalexpectedbases+=num454titaniumreads*460;
-  totalexpectedbases+=numsxareads*avgsxalen;
-  totalexpectedbases+=numpbsreads*avgpbslen;
-
-  totalreads=numsanreads;
-  totalreads+=num454gs20reads;
-  totalreads+=num454flxreads;
-  totalreads+=num454titaniumreads;
-  totalreads+=numsxareads;
-  totalreads+=numpbsreads;
-
-  if(ptype=='g'){
-    if(denovomapping=='d'){
-      readsinlargestcontig=totalreads/2;
-      readbasesinlargestcontig=totalexpectedbases/2;
-    }else{
-      largestcontigexpected=seqsize;
-      readsinlargestcontig=totalreads;
-      readbasesinlargestcontig=totalexpectedbases;
-
-      // if solexa is mapped, there are less reads due to
-      //  coverage equivalent mapping and virtual long reads
-      // be conservative, reduce only by 50%
-      if(numsxareads>0){
-	readsinlargestcontig-=numsxareads/2;
-      }
-    }
-  }else{
-    seqsize=50000;
-    largestcontigexpected=seqsize;
-    readsinlargestcontig=50000;
-    readbasesinlargestcontig=readsinlargestcontig*1000; //10k reads times sanger length
-  }
-
-  // account for gaps with 454 reads
-  if(num454flxreads>0 || num454gs20reads>0){
-    largestcontigexpected+=largestcontigexpected/10;
-    readbasesinlargestcontig+=readbasesinlargestcontig/10;
-  }
-
-  //cout << "totalreads: " << totalreads
-  //     << "\nreadsinlargestcontig: " << readsinlargestcontig
-  //     << "\ntotalexpectedbases: " << totalexpectedbases
-  //     << "\nreadbasesinlargestcontig: " << readbasesinlargestcontig
-  //     << endl;
-
-  int64 livereads=totalreads+readsinlargestcontig;
-  int64 livebases=totalexpectedbases+readbasesinlargestcontig;
-
-  //cout << "livereads: " << livereads
-  //     << "\nlivebases: " << livebases << endl;
-
-  double avgcov=static_cast<double>(totalexpectedbases/seqsize);
-  avgcov-=avgcov/8; // in general we have 12% loss of usable data
-
-  int64 numskimhits=static_cast<int64>(avgcov*850000);  // estimate skim hits, very rough
-
-  int64 memneeded=0;
-
-  // what do the reads need?
-  memneeded=
-    livereads*sizeof(Read)       // class size
-    +livereads*200               // additional strings etc.
-    +livereads*4*sizeof(tag_t)   // on average 4 tags per read
-    +livebases*8;                // sequences, qualities, adjustments, base flags
-
-  // new: solexa reads don't have adjustments
-  // yeah, but estimate is already small enough, keep it
-  //memneeded-=(numsxareads*avgsxalen) * 2;
-
-
-  // what does a contig need?
-  //  (note: the needs for the reads themselves are already
-  //   accounted for in the section above)
-  memneeded+=
-    //readsinlargestcontig*sizeof(Contig::contigread_t)
-    //+readsinlargestcontig*sizeof(Contig::out_order_t)
-
-    readsinlargestcontig*40       // 40 == rough guesstimate for PlacedContigReads
-    +totalreads*9                              /* templates, mapping
-						 allowedrefids */
-    +largestcontigexpected*sizeof(Contig::consensus_counts_t)
-    +largestcontigexpected*10;              // adjustments and some reserve
-
-  int64 memforlargetables=0;
-  // some more overhead by the assembly class
-  memforlargetables+= totalreads*20;
-
-  // get the skim edges accounted
-  int64 skimhitsmem=numskimhits*2*sizeof(skimedges_t);
-  // since 2.9.40 there's the possibility to cap that memory
-  // use default value
-  if(skimhitsmem>1024L*1024*1024){
-    skimhitsmem=2LL*1024*1024*1024;
-    if(numsxareads>0) skimhitsmem*=2;
-  }
-
-  // mem needed for temporary skim need
-  int64 tmpskim=500*1000*1000;
-
-  memforlargetables+=max(skimhitsmem,tmpskim);
-
-  // possible vector leftover clip
-  int64 memforpvlc=0;
-  {
-    // AS_readhitmiss & AS_readhmcovered
-    memforpvlc=totalexpectedbases*8;
-    // overhead of the structures above
-    memforpvlc+=sizeof(vector<uint32>)*totalreads*2;
-
-    // AS_count_rhm
-    memforpvlc+=totalreads*4;
-  }
-
-  // ok, 1MB of additional small things
-  int64 memneededfordata=memneeded+(1024*1024);
-
-  // experience shows that not all has been accounted for
-  //  and internal mem caching of memory allocators add another
-  //  layer of RAM needs
-  //
-  // add 40% to estimates
-  //  but not if whe have mapping with Solexas
-  if(denovomapping!='m' && numsxareads==0){
-    memneededfordata+=memneededfordata/100*40;
-    memforlargetables+=memforlargetables/100*40;
-  }
-
-  cout.setf(ios::fixed, ios::floatfield);
-  //cout.setf(ios::showpoint);
-  cout.precision(1);
-
-  cout << "\n\n************************* Estimates *************************\n\n";
-  // last, if it's an EST assembly, there is no seqsize
-
-  if(ptype=='e'){
-    cout << "EST assembly, cannot give coverage estimate. Also, estimates"
-      "\nmay be way off for pathological cases.\n";
-
-  }else{
-    cout << "The contigs will have an average coverage of ~ " << avgcov
-	 << " (+/- 10%)"
-      "\nEstimates may be way off for pathological cases.\n";
-  }
-
-  cout << "\nRAM estimates:"
-    "\n" << setw(40) << "reads+contigs (unavoidable): ";
-  byteToHumanReadableSize(memneededfordata,cout);
-  cout << "\n" << setw(40) << "large tables (tunable): ";
-  byteToHumanReadableSize(memforlargetables,cout);
-  cout << "\n" << setw(40) << "" << "---------"
-    "\n" << setw(40) << "total (peak): ";
-  byteToHumanReadableSize(memforlargetables+memneededfordata,
-			  cout);
-  cout << "\n\n" << setw(40) << "add if using -CL:pvlc=yes : ";
-  byteToHumanReadableSize(memforpvlc,cout);
-  if(denovomapping=='m' && numsxareads>0){
-    int64 notusingmerge=memneededfordata/100*40;
-    cout << "\n" << setw(40) << "add if setting -CO:msr=no : ";
-    byteToHumanReadableSize(notusingmerge,cout);
-  }
-  cout << "\n\n"
-    "Note that some algorithms might try to grab more memory if"
-    "\nthe need arises and the system has enough RAM. The options"
-    "\nfor automatic memory management control this:"
-    "\n  -AS:amm, -AS:kpmf, -AS:mps"
-    "\nFurther switches that might reduce RAM (at cost of run time"
-    "\nor accuracy):"
-    "\n  -SK:mhim, -SK:mchr (both runtime); -SK:mhpr (accuracy)\n"
-    "*************************************************************\n";
-
-}
-
-
diff --git a/src/modules/mod_memestim.H b/src/modules/mod_memestim.H
deleted file mode 100644
index 8c9ea04..0000000
--- a/src/modules/mod_memestim.H
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
- *   Krebsforschungszentrum, DKFZ Heidelberg) and Bastien Chevreux
- * Copyright (C) 2000 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-void miraMemEstimate(int argc, char ** argv);
diff --git a/src/modules/mod_mer.C b/src/modules/mod_mer.C
deleted file mode 100644
index e7513bf..0000000
--- a/src/modules/mod_mer.C
+++ /dev/null
@@ -1,524 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
- *   Krebsforschungszentrum, DKFZ Heidelberg) and Bastien Chevreux
- * Copyright (C) 2000 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-#include "modules/mod_mer.H"
-#include "util/fmttext.H"
-#include "util/fileanddisk.H"
-
-#include <getopt.h>
-#include <boost/algorithm/string.hpp>
-#include <boost/filesystem.hpp>
-
-#include "version.H"
-
-
-using namespace std;
-
-
-
-
-void MiraMer::usage()
-{
-//hdiIpPrvb:f:t:o:a:k:L:n:
-  cout << "miramer\t(MIRALIB version " << MIRALIBVERSION << ")\n";
-  cout << "Author: Bastien Chevreux\t(bach at chevreux.org)\n\n";
-  cout << "...\n";
-}
-
-
-/*
-void MiraMer::merCreateHashStats(int argc, char ** argv)
-{
-  if(argc-optind < 1) {
-    cerr << argv[0] << ": " << "Missing name of input.\n";
-    exit(1);
-  }
-
-  string loadfn(argv[optind++]);
-
-  vector<MIRAParameters> Pv;
-  MIRAParameters::setupStdMIRAParameters(Pv);
-
-  auto rgid = ReadGroupLib::getReadGroupID(0);
-
-  NHashStatistics nhs;
-  nhs.setupNewAnalysis(32,4,MER_basesperhash,MER_numlearnsteps);
-  {
-    uint8 ziptype=0;
-    string ft,pathto,stem;
-    guessFileAndZipType(loadfn,pathto,stem,ft,ziptype);
-
-    ReadPool rp1;
-    {
-      ReadPoolIO rpio(rp1);
-      rpio.registerFile(
-	"fastq",
-	loadfn,
-	"",
-	rgid,
-	false);
-      rpio.loadNextSeqs(-1);
-    }
-
-    nhs.analyseReadPool(rp1);
-    nhs.dumpHealth(cout);
-    nhs.deleteBloomFilter();
-    nhs.saveHashStatistics(stem+".mhs",true);
-  }
-
-}
-*/
-
-void MiraMer::merCreateHashStats(int argc, char ** argv)
-{
-  FUNCSTART("void MiraMer::merCreateHashStats(int argc, char ** argv)");
-
-  if(argc-optind < 1) {
-    cerr << argv[0] << ": " << "Missing name of input.\n";
-    exit(1);
-  }
-
-  list<string> loadfn;
-  for(;optind<argc;++optind){
-    loadfn.push_back(argv[optind]);
-  }
-
-  vector<MIRAParameters> Pv;
-  MIRAParameters::setupStdMIRAParameters(Pv);
-
-  auto rgid=ReadGroupLib::newReadGroup();
-  rgid.setSequencingType(ReadGroupLib::SEQTYPE_TEXT);
-
-  cout << "Loading data into memory ...";
-  ReadPool loadrp;
-  ReadPoolIO rpio(loadrp);
-  rpio.setAttributeFASTAQualFileWanted(false); // in case we load FASTAs
-
-  for(auto & dfn : loadfn){
-    uint8 ziptype=0;
-    string ft;
-    string dummyfromstem;
-    string dummypathto;
-    guessFileAndZipType(dfn,dummypathto,dummyfromstem,ft,ziptype);
-
-    rpio.registerFile(ft,dfn,"",rgid,false);
-    rpio.loadNextSeqs(-1,-1);
-  }
-
-  string resultfn("miramer.mhs.gz");
-  bool fwdandrev=true;
-  cout << "MER_basesperhash " << MER_basesperhash << endl;
-  auto bytes=HashStatistics<vhash64_t>::byteSizeOfHash(MER_basesperhash);
-  if(bytes==8){
-    HashStatistics<vhash64_t> hs;
-    hs.prepareHashStatistics(loadrp,false,false,fwdandrev,1,MER_rarekmerearlykill,MER_basesperhash,
-			     Pv[0].getHashStatisticsParams().hs_million_hashes_per_buffer,
-			     resultfn,".");
-  }else if(bytes==16){
-    HashStatistics<vhash128_t> hs;
-    hs.prepareHashStatistics(loadrp,false,false,fwdandrev,1,MER_rarekmerearlykill,MER_basesperhash,
-			     Pv[0].getHashStatisticsParams().hs_million_hashes_per_buffer,
-			     resultfn,".");
-  }else if(bytes==32){
-    HashStatistics<vhash256_t> hs;
-    hs.prepareHashStatistics(loadrp,false,false,fwdandrev,1,MER_rarekmerearlykill,MER_basesperhash,
-			     Pv[0].getHashStatisticsParams().hs_million_hashes_per_buffer,
-			     resultfn,".");
-  }else if(bytes==64){
-    HashStatistics<vhash512_t> hs;
-    hs.prepareHashStatistics(loadrp,false,false,fwdandrev,1,MER_rarekmerearlykill,MER_basesperhash,
-			     Pv[0].getHashStatisticsParams().hs_million_hashes_per_buffer,
-			     resultfn,".");
-  }else{
-    MIRANOTIFY(true,"Kmer size " << MER_basesperhash << " with " << bytes << " bytes are not expected here.\n");
-  }
-}
-
-
-void MiraMer::merInfoHashStats(int argc, char ** argv)
-{
-  FUNCSTART("void MiraMer::merInfoHashStats(int argc, char ** argv)");
-
-
-  if(argc-optind < 1) {
-    cerr << argv[0] << ": " << "Missing name of input.\n";
-    exit(1);
-  }
-
-  list<string> loadfn;
-  for(;optind<argc;++optind){
-    loadfn.push_back(argv[optind]);
-
-    string hfn(argv[optind]);
-    cout << "File " << hfn << ":";
-    try {
-      auto mhs=HashStatistics<vhash64_t>::loadHashStatisticsFileHeader(hfn);
-      cout << "\n  File format version:\t" << static_cast<uint16>(mhs.version)
-	   << "\n  Kmer length:\t" << mhs.basesperhash
-	   << "\n  Kmer bytes:\t" << mhs.sizeofhash
-	   << "\n  Num. kmers:\t" << mhs.numelem
-	   << "\n  Sort status:\t" << static_cast<uint16>(mhs.sortstatus)
-	   << endl;
-    }
-    catch(Notify n){
-      cout << " not readable or not a mhs file.\n";
-    }
-  }
-
-}
-
-
-
-
-void MiraMer::merSortHashStats(int argc, char ** argv)
-{
-  if(argc-optind < 2) {
-    cerr << argv[0] << ": " << "Missing name of at least one file.\n";
-    exit(1);
-  }
-
-//  string loadfn(argv[optind]);
-//  NHashStatistics nhs;
-//  nhs.loadHashStatistics(loadfn);
-//  nhs.sortLow24Bit();
-//  nhs.saveHashStatistics(loadfn+".sorted",true);
-}
-
-void MiraMer::merDiffHashStats(int argc, char ** argv)
-{
-  if(argc-optind < 2) {
-    cerr << argv[0] << ": " << "Missing name of at least one file.\n";
-    exit(1);
-  }
-
-  string fn1(argv[optind++]);
-  string fn2(argv[optind++]);
-
-  boost::filesystem::path fp(fn1);
-  string nameseta(fp.stem().string());
-  fp=fn2;
-  string namesetb(fp.stem().string());
-
-  cout << nameseta << " " << namesetb << endl;
-
-  int32 trimfr=4;
-  int32 trimtot=10;
-
-  HashStatistics<vhash512_t> hs1;
-  cout << "load " << fn1 << endl;
-  dateStamp(cout);
-  hs1.loadHashStatistics(fn1);
-  dateStamp(cout);
-  cout << "trim " << nameseta << endl;
-  hs1.trimHashStatsByFrequencyANDOR(trimfr,trimfr,trimtot);
-
-  HashStatistics<vhash512_t> hs2;
-  cout << "load " << fn2 << endl;
-  dateStamp(cout);
-  hs2.loadHashStatistics(fn2);
-  dateStamp(cout);
-  cout << "trim " << namesetb << endl;
-  hs2.trimHashStatsByFrequencyANDOR(trimfr,trimfr,trimtot);
-  dateStamp(cout);
-
-  cout << "creating subhs" << endl;
-  HashStatistics<vhash512_t> in_a_not_b;
-  in_a_not_b.inANotB(hs1,hs2);
-  in_a_not_b.sortByCountDown();
-  dateStamp(cout);
-  {
-    string outname("in_"+nameseta+"_notin_"+namesetb+".fasta");
-    cout << "Saving hashes to FASTA file " << outname << endl;
-    ofstream fout(outname);
-    in_a_not_b.dumpAsFASTA(fout);
-  }
-  {
-    string outname("in_"+nameseta+"_notin_"+namesetb+".txt");
-    cout << "Saving hashes to text file " << outname << endl;
-    ofstream fout(outname);
-    in_a_not_b.dump(fout);
-  }
-  dateStamp(cout);
-
-  HashStatistics<vhash512_t> in_b_not_a;
-  in_b_not_a.inANotB(hs2,hs1);
-  in_b_not_a.sortByCountDown();
-  {
-    string outname("in_"+namesetb+"_notin_"+nameseta+".fasta");
-    cout << "Saving hashes to FASTA file " << outname << endl;
-    ofstream fout(outname);
-    in_b_not_a.dumpAsFASTA(fout);
-  }
-  {
-    string outname("in_"+namesetb+"_notin_"+nameseta+".txt");
-    cout << "Saving hashes to text file " << outname << endl;
-    ofstream fout(outname);
-    in_b_not_a.dump(fout);
-  }
-  dateStamp(cout);
-
-}
-
-void MiraMer::merDumpHashStats(int argc, char ** argv)
-{
-  FUNCSTART("void MiraMer::merDumpHashStats(int argc, char ** argv)");
-
-  if(argc-optind < 1) {
-    cerr << argv[0] << ": " << "Missing name of input.\n";
-    exit(1);
-  }
-
-  string loadfn(argv[optind]);
-  auto bytes=HashStatistics<vhash64_t>::loadHashStatisticsFileHeader(loadfn).sizeofhash;
-  if(bytes==8){
-    HashStatistics<vhash64_t> hs;
-    hs.loadHashStatistics(loadfn);
-    hs.dump(cout);
-  }else if(bytes==16){
-    HashStatistics<vhash128_t> hs;
-    hs.loadHashStatistics(loadfn);
-    hs.dump(cout);
-  }else if(bytes==32){
-    HashStatistics<vhash256_t> hs;
-    hs.loadHashStatistics(loadfn);
-    hs.dump(cout);
-  }else if(bytes==64){
-    HashStatistics<vhash512_t> hs;
-    hs.loadHashStatistics(loadfn);
-    hs.dump(cout);
-  }else{
-    MIRANOTIFY(true,"Kmer size " << MER_basesperhash << " with " << bytes << " bytes are not expected here.\n");
-  }
-}
-
-void MiraMer::merDumpDebug(int argc, char ** argv)
-{
-  FUNCSTART("void MiraMer::merDumpDebug(int argc, char ** argv)");
-
-  if(argc-optind < 1) {
-    cerr << argv[0] << ": " << "Missing name of input.\n";
-    exit(1);
-  }
-
-  string loadfn(argv[optind]);
-  auto bytes=HashStatistics<vhash64_t>::loadHashStatisticsFileHeader(loadfn).sizeofhash;
-  if(bytes==8){
-    HashStatistics<vhash64_t> hs;
-    hs.loadHashStatistics(loadfn);
-    hs.dumpHSDebug(cout);
-  }else if(bytes==16){
-    HashStatistics<vhash128_t> hs;
-    hs.loadHashStatistics(loadfn);
-    hs.dumpHSDebug(cout);
-  }else if(bytes==32){
-    HashStatistics<vhash256_t> hs;
-    hs.loadHashStatistics(loadfn);
-    hs.dumpHSDebug(cout);
-  }else if(bytes==64){
-    HashStatistics<vhash512_t> hs;
-    hs.loadHashStatistics(loadfn);
-    hs.dumpHSDebug(cout);
-  }else{
-    MIRANOTIFY(true,"Kmer size " << MER_basesperhash << " with " << bytes << " bytes are not expected here.\n");
-  }
-}
-
-void MiraMer::merDumpHashDistrib(int argc, char ** argv)
-{
-  FUNCSTART("void MiraMer::merDumpHashDistrib(int argc, char ** argv)");
-  if(argc-optind < 1) {
-    cerr << argv[0] << ": " << "Missing name of input.\n";
-    exit(1);
-  }
-
-  string loadfn(argv[optind]);
-  auto bytes=HashStatistics<vhash64_t>::loadHashStatisticsFileHeader(loadfn).sizeofhash;
-  if(bytes==8){
-    HashStatistics<vhash64_t> hs;
-    hs.loadHashStatistics(loadfn);
-    hs.showHashStatisticsInfo();
-  }else if(bytes==16){
-    HashStatistics<vhash128_t> hs;
-    hs.loadHashStatistics(loadfn);
-    hs.showHashStatisticsInfo();
-  }else if(bytes==32){
-    HashStatistics<vhash256_t> hs;
-    hs.loadHashStatistics(loadfn);
-    hs.showHashStatisticsInfo();
-  }else if(bytes==64){
-    HashStatistics<vhash512_t> hs;
-    hs.loadHashStatistics(loadfn);
-    hs.showHashStatisticsInfo();
-  }else{
-    MIRANOTIFY(true,"Kmer size " << MER_basesperhash << " with " << bytes << " bytes are not expected here.\n");
-  }
-}
-
-void MiraMer::merDeltaTest(int argc, char ** argv)
-{
-  if(argc-optind < 1) {
-    cerr << argv[0] << ": " << "Missing name of input.\n";
-    exit(1);
-  }
-
-  cerr << argv[0] << ": " << "merDeltaTest() Currently de-activated.\n";
-  exit(1);
-/*
-  TODO
-  De-activated until KMer gets a - operator
-
-  string loadfn(argv[optind]);
-  HashStatistics<vhash512_t> hs;
-  hs.loadHashStatistics(loadfn);
-  hs.sortLexicographically();
-  auto & hsd=hs.getHashStats();
-  if(!hsd.empty()){
-    uint64 oldvh=0;
-    for(auto & hsde : hsd){
-      //cout << oldvh << " " << hsde.vhash << "\t->\t";
-      uint64 newvh=hsde.vhash-oldvh;
-      oldvh=hsde.vhash;
-      hsde.vhash=newvh;
-      //cout << oldvh << " " << newvh << endl;
-    }
-    hs.sortLexicographically();
-    hs.saveHashStatistics(loadfn+".delta.sorted",true);
-  }
-*/
-}
-
-
-int MiraMer::mainMiraMer(int argc, char ** argv)
-{
-  // that loop is straight from the GNU getopt_long example
-  // http://www.gnu.org/s/hello/manual/libc/Getopt-Long-Option-Example.html
-  while (1){
-    static struct option mlong_options[] =
-      {
-	{"help",  no_argument,           0, 'h'},
-	{"job", required_argument,         0, 'j'},
-	{"kmersize", required_argument,         0, 'k'},
-	{"version", no_argument,         0, 'v'},
-	{0, 0, 0, 0}
-      };
-    /* getopt_long stores the option index here. */
-    int option_index = 0;
-
-    int c = getopt_long (argc, argv, "hc:j:k:v",
-		     mlong_options, &option_index);
-
-    if (c == -1) break;
-
-    switch (c) {
-    case 'h':
-      cout << "mira\t\tMIRALIB version " << MIRAVERSION << "\n"
-	"Author:\t\tBastien Chevreux (bach at chevreux.org)\n"
-	"Purpose:\thandle k-mer statistics of a data set\n\n";
-
-      cout << "Usage:\n"
-	"miramer ...\n";
-      cout << "\nOptions:\n";
-      cout <<
-	"  -j / --job\t\t\t\tJob type. Currently:\n"
-	"            \t\t\t\tcreate (default)\n"
-	"            \t\t\t\tinfo\n"
-	"            \t\t\t\tsort\n"
-	"            \t\t\t\tdiff\n"
-	"            \t\t\t\tdumpcounts\n"
-	"            \t\t\t\tdebug\n"
-	"            \t\t\t\tdtest\n"
-	"            \t\t\t\tdumpdistrib\n"
-	"  -h / --help\t\t\t\tPrint short help and exit\n"
-	"  -v / --version\t\t\tPrint version and exit\n"
-	;
-      exit(0);
-    case 'j': {
-      MER_job=optarg;
-      boost::to_lower(MER_job);
-      break;
-    }
-    case 'k': {
-      uint64 bla=atoi(optarg);
-      //if(bla>32) bla=32;
-      MER_basesperhash=bla;
-      break;
-    }
-    case 'c': {
-      uint64 bla=atoi(optarg);
-      //if(bla>32) bla=32;
-      MER_rarekmerearlykill=bla;
-      break;
-    }
-    case 'v':
-      cout << MIRAVERSION << endl;
-      exit(0);
-    default:
-      abort();
-    }
-  }
-
-  if(MER_basesperhash==0) MER_basesperhash=32;
-  if(MER_basesperhash>256){
-    cout << "Sorry, -k for kmer size must be <= 256 for the time being.\n";
-    exit(100);
-  }
-
-  try {
-    if(MER_job=="create"){
-      merCreateHashStats(argc,argv);
-    }else if(MER_job=="info"){
-      merInfoHashStats(argc,argv);
-    }else if(MER_job=="sort"){
-      merSortHashStats(argc,argv);
-    }else if(MER_job=="diff"){
-      merDiffHashStats(argc,argv);
-    }else if(MER_job=="dumpcounts"){
-      merDumpHashStats(argc,argv);
-    }else if(MER_job=="debug"){
-      merDumpDebug(argc,argv);
-    }else if(MER_job=="dtest"){
-      merDeltaTest(argc,argv);
-    }else if(MER_job=="dumpdistrib"){
-      merDumpHashDistrib(argc,argv);
-    }else{
-      cout << argv[0] << ": unknown job '" << MER_job << "'???" << endl;
-      exit(1);
-    }
-  }
-  catch(Notify n){
-    n.handleError("main");
-  }
-  catch(Flow f){
-    cerr << "Unexpected exception: Flow()\n";
-  }
-  catch(...){
-    cerr << "Unknown exception caught, aborting the process.\n\nPlease contact: bach at chevreux.org\n\n";
-    abort();
-  }
-
-  FUNCEND();
-  return 0;
-}
diff --git a/src/modules/mod_mer.H b/src/modules/mod_mer.H
deleted file mode 100644
index e503167..0000000
--- a/src/modules/mod_mer.H
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
- *   Krebsforschungszentrum, DKFZ Heidelberg) and Bastien Chevreux
- * Copyright (C) 2000 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-
-#include <fstream>
-
-#include <string>
-#include <vector>
-#include <list>
-
-#include "mira/parameters.H"
-#include "mira/readpool_io.H"
-#include "mira/hashstats.H"
-#include "mira/vhash.H"
-
-
-class MiraMer
-{
-private:
-  std::string MER_job;
-
-  uint32 MER_basesperhash=31;
-  uint32 MER_rarekmerearlykill=0;
-
-  HashStatistics<vhash64_t> MER_hashstatistics;
-
-private:
-  void usage();
-
-  void merCreateHashStats(int argc, char ** argv);
-  void merInfoHashStats(int argc, char ** argv);
-  void merSortHashStats(int argc, char ** argv);
-  void merDumpHashStats(int argc, char ** argv);
-  void merDumpDebug(int argc, char ** argv);
-  void merDumpHashDistrib(int argc, char ** argv);
-  void merDiffHashStats(int argc, char ** argv);
-
-  void merDeltaTest(int argc, char ** argv);
-
-public:
-  MiraMer() : MER_job("create") {};
-
-  int mainMiraMer(int argc, char ** argv);
-};
diff --git a/src/modules/mod_mira.C b/src/modules/mod_mira.C
deleted file mode 100644
index 970122d..0000000
--- a/src/modules/mod_mira.C
+++ /dev/null
@@ -1,480 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
- *   Krebsforschungszentrum, DKFZ Heidelberg) and Bastien Chevreux
- * Copyright (C) 2000 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-
-#include <getopt.h>
-
-#include <iostream>
-#include <string>
-
-#include "boost/filesystem/operations.hpp"
-#include "boost/filesystem/path.hpp"
-
-#include "util/fileanddisk.H"
-#include "mira/assembly.H"
-#include "mira/parameters.H"
-#include "mira/manifest.H"
-
-#include "modules/misc.H"
-
-
-#include "version.H"
-
-using namespace std;
-
-
-
-
-bool   opt_mira_wrapped=false;          // 'secret' option
-bool   opt_mira_resumeassembly=false;
-string opt_mira_cwd;
-
-
-bool   opt_ispbcorrect=false;
-
-uint32 opt_mira_numthreads=0;
-bool   opt_mira_checkmanifestonly=false;
-bool   opt_mira_checkmanifestandfilesonly=false;
-
-
-void miraParseCmdLine(int argc, char ** argv)
-{
-  // that loop is straight from the GNU getopt_long example
-  // http://www.gnu.org/s/hello/manual/libc/Getopt-Long-Option-Example.html
-  while (1){
-    static struct option long_options[] =
-      {
-	{"help",  no_argument,           0, 'h'},
-	{"resume", no_argument,          0, 'r'},
-	{"version", no_argument,         0, 'v'},
-	{"mcheck", no_argument,          0, 'm'},
-	{"mdcheck", no_argument,         0, 'M'},
-	{"cwd", required_argument,       0, 'c'},
-	{"threads", required_argument,       0, 't'},
-
-	{"nowrap", no_argument,       0, 'W'},
-	{"job", optional_argument,       0, ' '},        // catch old command line
-	{"project", optional_argument,   0, ' '},        // catch old command line
-	{0, 0, 0, 0}
-      };
-    /* getopt_long stores the option index here. */
-    int option_index = 0;
-
-    int c = getopt_long (argc, argv, "WhmMrvc:t: ",
-		     long_options, &option_index);
-
-    if (c == -1) break;
-
-    switch (c) {
-    case 'W': {
-      opt_mira_wrapped=true;
-      break;
-    }
-    case 'M':
-      opt_mira_checkmanifestandfilesonly=true;
-      // fall through
-    case 'm':
-      opt_mira_wrapped=true;            // we need this: checks of manifest should not be run wrapped
-      opt_mira_checkmanifestonly=true;
-      break;
-    case 'c':
-      if(optarg){
-	opt_mira_cwd=optarg;
-      }else{
-	cout << "Missing directory name for option -c / --cwd=" << endl;
-	exit(100);
-      }
-      break;
-    case 'h':
-      if(opt_ispbcorrect){
-	cout << "mirapbcorrect\t";
-      }else{
-	cout << "mira\t\t";
-      }
-      cout << "MIRALIB version " << MIRAVERSION << "\n"
-	"Author:\t\tBastien Chevreux (bach at chevreux.org)\n";
-      if(opt_ispbcorrect){
-	cout << "Purpose:\tcorrect low quality PacBio sequencing data.\n\n";
-      }else{
-	cout << "Purpose:\tassemble sequencing data.\n\n";
-      }
-
-      dumpStdMsg();
-      cout << "Usage:\n" << argv[0] <<
-	" [options] manifest_file [manifest_file ...]\n";
-      cout << "\nOptions:\n";
-      cout <<
-	"  -c / --cwd=\t\tdirectory\tChange working directory\n";
-      if(!opt_ispbcorrect){
-	cout << "  -m / --mcheck\t\t\t\tOnly check the manifest file, then exit.\n"
-	  "  -M / --mdcheck\t\t\tLike -m, but also check existence of\n"
-	  "\t\t\t\t\t data files.\n"
-	  "  -r / --resume\t\t\t\tResume an interrupted assembly\n";
-      }
-      cout <<
-	"  -h / --help\t\t\t\tPrint short help and exit\n"
-	"  -m / --mcheck\t\t\t\tOnly check the manifest file, then exit.\n"
-	"  -M / --mdcheck\t\t\tLike -m, but also check existence of\n"
-	"\t\t\t\t\t data files.\n"
-	"  -r / --resume\t\t\t\tResume/restart an interrupted assembly\n"
-	"  -t / --threads=\tinteger\t\tForce number of threads (overrides\n"
-	"\t\t\t\t\t equivalent -GE:not manifest entry)\n"
-	"  -v / --version\t\t\tPrint version and exit\n"
-	;
-      exit(0);
-    case 'r':
-      opt_mira_resumeassembly=true;
-      break;
-    case 't':
-      opt_mira_numthreads=atoi(optarg);
-      break;
-    case 'v':
-      cout << MIRAVERSION << endl;
-      exit(0);
-    case ' ':
-      cout << "It looks like you are using the old command line format of MIRA 3.4.x and earlier."
-	"\nPlease look up in the manual on how to use manifest files for MIRA 3.9.x and later.\n";
-      exit(0);
-    default:
-      abort ();
-    }
-  }
-
-  if (optind == argc) {
-    cout << "You did not specify a manifest file to load?\n";
-    exit(100);
-  }
-}
-
-void miraMain_wrapped(int argc, char ** argv)
-{
-  FUNCSTART("void mira(int argc, char ** argv)");
-
-  cout << "This is MIRA " MIRAVERSION ".\n\n";
-
-  cout << "Please cite: Chevreux, B., Wetter, T. and Suhai, S. (1999), Genome Sequence\nAssembly Using Trace Signals and Additional Sequence Information.\nComputer Science and Biology: Proceedings of the German Conference on\nBioinformatics (GCB) 99, pp. 45-56.\n\n";
-
-  if(!opt_mira_cwd.empty() && chdir(opt_mira_cwd.c_str())){
-    cout << "Changing working directory to '" << opt_mira_cwd << "' failed, system message is: " << strerror(errno) << endl;
-    exit(100);
-  }
-
-  dumpStdMsg();
-
-  Manifest manifest;
-  {
-    bool tmprflag=opt_mira_resumeassembly;
-    if(opt_mira_checkmanifestonly) tmprflag|=!opt_mira_checkmanifestandfilesonly;
-    for(; optind < argc; ++optind) {
-      manifest.loadManifestFile(argv[optind],tmprflag);
-    }
-  }
-
-  // if we are just to check the manifest (and maybe data) and we came this far: exit
-  if(opt_mira_checkmanifestonly) {
-    cout << "\nManifest looks OK";
-    if(opt_mira_checkmanifestandfilesonly){
-      cout << " and the data files referenced within were found";
-    }
-    cout << ".\n";
-    exit(0);
-  }
-
-  cout << manifest;
-
-  vector<MIRAParameters> Pv;
-  MIRAParameters::setupStdMIRAParameters(Pv);
-
-  MIRAParameters::generateProjectNames(Pv,manifest.getProjectName());
-
-  string mparams(manifest.getFullMIRAParameterString());
-  //cout << "Seen parameters in manifest: " << mparams << endl;
-  MIRAParameters::parse(mparams, Pv);
-
-  // some users make the error to use "mira" instead of miraSearchESTSNPs
-  // this code takes care of it:
-  // if start_step >0, then the miraSearchESTSNPs pipeline is used,
-  //  else the normal mira
-  if(Pv[0].getSpecialParams().sp_est_startstep){
-    MIRANOTIFY(Notify::FATAL,"Oooooops? You called the 'mira' executable but have parameters set for the"
-	       "EST-SNP-Search pipeline set. For this, you have to use the 'miraSearchESTSNPs'"
-	       "executable (sorry).");
-  }
-
-  cout << "\nParameters parsed without error, perfect.\n";
-
-  if(opt_mira_numthreads>0){
-    cout << "Overriding number of threads via '-t' with " << opt_mira_numthreads << endl;
-    Pv[0].getNonConstAssemblyParams().as_numthreads=opt_mira_numthreads;
-    Pv[0].getNonConstSkimParams().sk_numthreads=opt_mira_numthreads;
-  }
-
-  cout << '\n';
-
-  MIRAParameters::postParsingChanges(Pv);
-  MIRAParameters::dumpAllParams(Pv, cout);
-
-
-
-  //exit(0);
-
-  {
-    Assembly as(manifest, Pv, opt_mira_resumeassembly);
-
-    as.loadSequenceData();
-
-    //doAbort();
-
-    if(Pv[0].getAssemblyParams().as_filecheck_only==false){
-      try {
-	if(opt_ispbcorrect){
-	  as.correctPBMain();
-	}else{
-	  as.assemble();
-	}
-	cout << "\n\n";
-	as.setEverythingWentFine(true);
-      }
-      catch(const std::bad_alloc & e){
-	cout << "Ouch, out of memory detected.\n";
-	as.dumpMemInfo();
-	throw;
-      }
-      catch(...){
-	throw;
-      }
-    }
-  }
-  //Read::dumpStringContainerStats(cout);
-
-  cout << "\n\nEnd of assembly process, thank you for using MIRA." << endl;
-
-  return;
-}
-
-void miraMain_launchWrapped(int argc, char ** argv)
-{
-  // find out where the called binary is installed, then recreate a full command line
-  string calledbin;
-  findLocationOfSelfBinary(calledbin);
-
-  // protect the path with quotes so that spaces in path are seen as part of the path to binary
-  //  when the system() call is performed
-  string newcmdline('"'+calledbin+'"');
-
-  newcmdline+=" -W";
-  for(int32 i=1; i<argc; i++){
-    newcmdline+=' ';
-    newcmdline+=argv[i];
-  }
-  //cout << "Launching: " << newcmdline << endl;
-
-  int ret=0;
-  ret=system(newcmdline.c_str());
-  if(ret<0){
-    cout << "Ooooops? Somehow failed to launch: " << newcmdline << endl;
-    cout << "Using rescue assembly mode, but extraction of large contigs will not be done automatically.\n" << endl;
-    miraMain_wrapped(argc,argv);
-  }else if(ret>0){
-    // do nothing, just exit as the wrapped call already printed out all there is to say in case of an error
-    cout << "Failure, wrapped MIRA process aborted.\n";
-    exit(100);
-  }else{
-    bool couldextractlargecontigs=false;
-
-    Manifest manifest;
-
-    for(; optind < argc; ++optind) {
-      manifest.loadManifestFile(argv[optind],opt_mira_resumeassembly);
-    }
-    vector<MIRAParameters> Pv;
-    MIRAParameters::setupStdMIRAParameters(Pv);
-    MIRAParameters::generateProjectNames(Pv,manifest.getProjectName());
-
-    MIRAParameters::parse(manifest.getFullMIRAParameterString(), Pv, false);
-
-    auto & as_fixparams=Pv[0].getAssemblyParams();
-    auto & di_fixparams=Pv[0].getDirectoryParams();
-
-    string mcprog(boost::filesystem::path(calledbin).parent_path().string()+"/miraconvert");
-    if(system((mcprog+" -v >/dev/null 2>&1").c_str())){
-      // try the 'd' version (just my personal setup on some machines)
-      mcprog+='d';
-      if(system((mcprog+" -v >/dev/null 2>&1").c_str())){
-	mcprog="miraconvert";
-	if(system((mcprog+" -v >/dev/null 2>&1").c_str())){
-	  mcprog.clear();
-	}
-      }
-    }
-
-    string lcfile(di_fixparams.dir_info+"/"+as_fixparams.as_outfile_stats_largecontigs+".txt");
-    if(fileExists(lcfile)){
-      //cout << "found large contigs file " << lcfile << ", extracting now ..." << endl;
-      string convertstr;
-      if(as_fixparams.as_output_html) convertstr+=" -t html";
-      if(as_fixparams.as_output_txt) convertstr+=" -t txt";
-      if(as_fixparams.as_output_caf) convertstr+=" -t caf";
-      if(as_fixparams.as_output_maf) convertstr+=" -t maf";
-      if(as_fixparams.as_output_tcs) convertstr+=" -t tcs";
-      if(as_fixparams.as_output_ace) convertstr+=" -t ace";
-      if(as_fixparams.as_output_gff3) convertstr+=" -t gff3";
-      if(as_fixparams.as_output_wiggle) convertstr+=" -t wig";
-      if(as_fixparams.as_output_fasta) convertstr+=" -t fasta";
-      if(as_fixparams.as_output_gap4da) convertstr+=" -t exp";
-
-      string relativelcfile("../"+manifest.getProjectName()+"_d_info/"+as_fixparams.as_outfile_stats_largecontigs+".txt");
-      convertstr+=" -n "+relativelcfile;
-
-      convertstr+=" -P \"--job="+manifest.getJob()+","+manifest.getTechnologies()+" ";
-      // just to be really sure ...
-      for(auto pc : manifest.getParameters()){
-	if(pc=='"'){
-	  convertstr+="\\\"";
-	}else if(pc<32 || pc==0x7f){
-	  // do nothing
-	}else{
-	  convertstr+=pc;
-	}
-      }
-      convertstr+="\" ";
-
-      convertstr+=as_fixparams.as_outfile_MAF+".maf";
-      convertstr+=" "+manifest.getProjectName()+"_LargeContigs_out";
-
-      {
-	string elcshname=di_fixparams.dir_results+"/extractLargeContigs.sh";
-	ofstream fout(elcshname);
-	fout << "#!/bin/sh"
-	  "\n"
-	  "\necho"
-	  "\necho This is how MIRA extracted 'large contigs' from the total assembly for you:"
-	  "\necho  it made a list of contigs \\(see info file " << relativelcfile << "\\)"
-	  "\necho  which reached a certain length \\(usually 500, see -MI:lcs=...\\) and had at least 1/3 of"
-	  "\necho  the average coverage \\(per sequencing technology\\)."
-	  "\necho"
-	  "\necho Note that you can redefine what large contigs are for you by simply using any"
-	  "\necho combination of -n, -x, -y and -z parameters of 'miraconvert' instead of only the"
-	  "\necho '-n' parameter as used in this example."
-	  "\necho"
-	  "\necho You can follow the progress of the conversion in the file \"ec.log\""
-	  "\necho"
-	  "\n\nmiraconvert " << convertstr << " >ec.log 2>&1"
-	  "\n"
-	  "\nif [ $? -eq 0 ];then"
-	  "\n   rm ec.log"
-	  "\n   echo Finished, all done."
-	  "\nelse"
-	  "\n   tail -50 ec.log"
-	  "\n   echo"
-	  "\n   echo Ooops, something went wrong. Please consult the file 'ec-log' in this directory."
-	  "\nfi"
-	  ;
-	chmod(elcshname.c_str(),S_IRWXU|S_IRGRP|S_IROTH);
-      }
-
-      if(mcprog.empty()){
-	cout << "Could not find executable 'miraconvert' for extracting large contigs?\n";
-      }else{
-	if(chdir(di_fixparams.dir_results.c_str())){
-	  cout << "Changing working directory to '" << di_fixparams.dir_results << "' failed, system message is: " << strerror(errno) << endl;
-	}else{
-	  cout << "Starting extraction of large contigs now (this may take a while, please be patient)." << endl;
-	  if(system((mcprog+" "+convertstr+" >ec.log 2>&1").c_str())){
-	    cout << "\nExtraction failed, please consult " << di_fixparams.dir_results << "/ec.log"
-	      "\nfor more information on why.\n";
-	  }else{
-	    cout << "\nDone.\n";
-	    couldextractlargecontigs=true;
-	    fileRemove("ec.log",false);
-	  }
-	}
-      }
-      if(!couldextractlargecontigs){
-	cout << "Large contigs could not be extracted, sorry.\n"
-	  "\nDON'T PANIC! In the directory\n    '" << di_fixparams.dir_results << "'"
-	  "\nyou will find a script called"
-	  "   'extractLargeContigs.sh'\n"
-	  "which shows you how to extract large contigs from your assembly. Either"
-	  "read it to understand how it's done or ... just run it :-)\n";
-      }
-      chdir("../..");
-    }
-
-    string rcfile(di_fixparams.dir_results+"/_tmprecreate");
-    if(fileExists(rcfile)){
-      string convertstr;
-      convertstr+=as_fixparams.as_outfile_MAF+".maf";
-      convertstr+=" "+as_fixparams.as_outfile_CAF+".caf";
-      if(mcprog.empty()){
-	cout << "Could not find executable 'miraconvert' for re-creating CAF results file?\n";
-      }else{
-	if(chdir(di_fixparams.dir_results.c_str())){
-	  cout << "Changing working directory to '" << di_fixparams.dir_results << "' failed, system message is: " << strerror(errno) << endl;
-	}else{
-	  cout << "Starting recreating CAF results file (please be patient)." << endl;
-	  if(system((mcprog+" "+convertstr+" >rc.log 2>&1").c_str())){
-	    cout << "\nOooops, that failed, please consult " << di_fixparams.dir_results << "/rc.log"
-	      "\nfor more information on why.\n";
-	  }else{
-	    cout << "\nDone.\n";
-	    fileRemove("rc.log",false);
-	    fileRemove(rcfile,false);
-	  }
-	}
-      }
-      chdir("../..");
-    }
-
-    cout << "\n\nWe're done here, thank you for using MIRA." << endl;
-  }
-}
-
-int miraMain(int argc, char ** argv)
-{
-  FUNCSTART("void miraMain(int argc, char ** argv)");
-
-  miraParseCmdLine(argc,argv);
-  if(opt_mira_wrapped){
-    miraMain_wrapped(argc,argv);
-  }else{
-    miraMain_launchWrapped(argc,argv);
-  }
-
-  return 0;
-}
-
-
-int mainPBCorrect(int argc, char ** argv)
-{
-  FUNCSTART("int mainPBCorrect(int argc, char ** argv)");
-
-  opt_ispbcorrect=true;
-  miraParseCmdLine(argc,argv);
-  miraMain_wrapped(argc,argv);
-
-  return 0;
-}
diff --git a/src/modules/mod_mira.H b/src/modules/mod_mira.H
deleted file mode 100644
index ff6c950..0000000
--- a/src/modules/mod_mira.H
+++ /dev/null
@@ -1,10 +0,0 @@
-
-#ifndef _modmira_h_
-#define _modmira_h_
-
-int miraMain(int argc, char ** argv);
-int dbgReplayMain(int argc, char ** argv);
-
-int mainPBCorrect(int argc, char ** argv);
-
-#endif
diff --git a/src/modules/mod_scaffold.C b/src/modules/mod_scaffold.C
deleted file mode 100644
index 6a6d3ba..0000000
--- a/src/modules/mod_scaffold.C
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
- *   Krebsforschungszentrum, DKFZ Heidelberg) and Bastien Chevreux
- * Copyright (C) 2000 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-
-
-#include "modules/mod_scaffold.H"
-
-#include "mira/parameters.H"
-#include "mira/contig.H"
-#include "mira/readpool_io.H"
-#include "mira/maf_parse.H"
-
-#include "version.H"
-
-
-Scaffolder MiraScaffold::MS_scaffolder;
-
-using namespace std;
-
-
-vector<MIRAParameters> MS_Pv;
-
-
-void MiraScaffold::cafmafload_callback(list<Contig> & clist, ReadPool & rp)
-{
-  for(auto & con : clist){
-    MS_scaffolder.storeInfoFreshContig(con);
-  }
-  clist.clear();
-}
-
-int MiraScaffold::mainMiraScaffold(int argc, char ** argv)
-{
-  //CALLGRIND_STOP_INSTRUMENTATION;
-
-  FUNCSTART("int MiraScaffold::mainMiraScaffold(int argc, char ** argv)");
-
-  string filename("bla.maf");
-
-  try{
-    void (*usecrcallback)(list<Contig> &, ReadPool &) = cafmafload_callback;
-
-    ReadPool rpool;
-    list<Contig> clist;
-    {
-      MAFParse mafp(&rpool, &clist, &MS_Pv);
-      mafp.setProgressIndicator(true);
-      {
-	vector<uint32> dummy;
-	mafp.load(filename,
-		  ReadGroupLib::SEQTYPE_SANGER,
-		  1,
-		  dummy,
-		  false,
-		  usecrcallback,
-		  nullptr
-	  );
-      }
-    }
-    MS_scaffolder.dumpDebug();
-  }
-  catch(Notify n){
-    // Need to close by hand as handleError() will perform a hard exit
-    n.handleError(THISFUNC);
-  }
-  catch(Flow f){
-    cerr << "Unexpected exception: Flow()\n";
-  }
-  catch(...){
-    cout.flush();
-    cerr.flush();
-    cerr << "Unknown exception caught, aborting the process.\n\nPlease contact: bach at chevreux.org\n\n";
-    abort();
-  }
-
-  FUNCEND();
-  return 0;
-}
diff --git a/src/modules/mod_scaffold.H b/src/modules/mod_scaffold.H
deleted file mode 100644
index 9317fe9..0000000
--- a/src/modules/mod_scaffold.H
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
- *   Krebsforschungszentrum, DKFZ Heidelberg) and Bastien Chevreux
- * Copyright (C) 2000 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-
-#include <fstream>
-
-#include <string>
-#include <vector>
-#include <list>
-
-#include "mira/scaffolder.H"
-
-class Contig;
-class ReadPool;
-
-class MiraScaffold
-{
-private:
-  static Scaffolder MS_scaffolder;
-
-private:
-  static void cafmafload_callback(std::list<Contig> & clist, ReadPool & rp);
-
-public:
-  int mainMiraScaffold(int argc, char ** argv);
-
-};
diff --git a/src/modules/mod_sigconex.C b/src/modules/mod_sigconex.C
deleted file mode 100644
index a83e787..0000000
--- a/src/modules/mod_sigconex.C
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
- *   Krebsforschungszentrum, DKFZ Heidelberg) and Bastien Chevreux
- * Copyright (C) 2000 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-#include "modules/mod_sigconex.H"
-#include "util/fmttext.H"
-#include "util/fileanddisk.H"
-
-#include <getopt.h>
-#include <boost/algorithm/string.hpp>
-#include <boost/filesystem.hpp>
-
-#include <regex>
-
-#include "version.H"
-
-
-using namespace std;
-
-
-
-
-void MiraSCE::usage()
-{
-//hdiIpPrvb:f:t:o:a:k:L:n:
-  cout << "miramer\t(MIRALIB version " << MIRALIBVERSION << ")\n";
-  cout << "Author: Bastien Chevreux\t(bach at chevreux.org)\n\n";
-  cout << "...\n";
-}
-
-
-struct scinfo_t {
-  uint32 rid=0;
-  uint32 len=0;
-  double cov=0.0;
-  bool learned=false;
-
-  inline static bool sortComparatorByLen(const scinfo_t & a, const scinfo_t & b){
-    if(a.len==b.len){
-      return a.cov<b.cov;
-    }
-    return a.len<b.len;
-  }
-};
-
-void MiraSCE::excon(int argc, char ** argv)
-{
-  FUNCSTART("void MiraSCE::excon(int argc, char ** argv)");
-
-  if(argc-optind < 1) {
-    cerr << argv[0] << ": " << "Missing name of input.\n";
-    exit(1);
-  }
-
-  list<string> loadfn;
-  for(;optind<argc;++optind){
-    loadfn.push_back(argv[optind]);
-  }
-
-  vector<MIRAParameters> Pv;
-  MIRAParameters::setupStdMIRAParameters(Pv);
-
-  auto rgid=ReadGroupLib::newReadGroup();
-  rgid.setSequencingType(ReadGroupLib::SEQTYPE_TEXT);
-
-  cout << "Loading data into memory ...";
-  ReadPool loadrp;
-  ReadPoolIO rpio(loadrp);
-  rpio.setAttributeFASTAQualFileWanted(false); // in case we load FASTAs
-  rpio.setAttributeFASTAPreserveComment(true); // want to store comments in COMM read tags
-
-  for(auto & dfn : loadfn){
-    uint8 ziptype=0;
-    string ft;
-    string dummyfromstem;
-    string dummypathto;
-    guessFileAndZipType(dfn,dummypathto,dummyfromstem,ft,ziptype);
-
-    rpio.registerFile(ft,dfn,"",rgid,false);
-    rpio.loadNextSeqs(-1,-1);
-  }
-
-  bool allcovfound=true;
-  std::regex rgx("cov=([\\d\\.]+)");
-  std::smatch match;
-  vector<scinfo_t> scinfo(loadrp.size());
-  for(uint32 rpi=0; rpi<loadrp.size(); ++rpi){
-    Read & actread=loadrp[rpi];
-    scinfo[rpi].rid=rpi;
-    scinfo[rpi].len=actread.getLenSeq();
-    string rcomm;
-    for(auto & rt : actread.getTags()){
-      if(rt.identifier==Read::REA_tagentry_idCOMM){
-	rcomm=rt.getCommentStr();
-	break;
-      }
-    }
-    if(!rcomm.empty()){
-      if (std::regex_search(rcomm, match, rgx)) {
-	scinfo[rpi].cov=std::stod(match[1]);
-      }else{
-	cout << actread.getName() << " is missing a coverage number in the form of 'cov=xx.xxx' in its comments.\n";
-	allcovfound=false;
-      }
-    }
-  }
-
-  if(!allcovfound){
-    cout << "Sorry, fix that.\n";
-    exit(100);
-  }
-
-  double mincov=34.00;
-  for(auto & sce : scinfo){
-    if(sce.cov>=mincov){
-      // learn seq
-      sce.learned=true;
-    }
-  }
-
-  sort(scinfo.begin(),scinfo.end(),scinfo_t::sortComparatorByLen);
-
-  for(uint32 downlen=32; downlen>=8; downlen/=2){
-    for(uint32 downcov=32; downcov>=8; downcov/=2){
-      auto actmincov=static_cast<double>(downcov);
-      for(auto & sce : scinfo){
-	if(!sce.learned && sce.cov>=actmincov && sce.len>=downlen){
-	  // learn seq
-	  sce.learned=true;
-	}
-      }
-    }
-  }
-
-  for(uint32 downlen=6; downlen>=2; downlen-=2){
-    for(uint32 downcov=32; downcov>=8; downcov/=2){
-      auto actmincov=static_cast<double>(downcov);
-      for(auto & sce : scinfo){
-	if(!sce.learned && sce.cov>=actmincov && sce.len>=downlen){
-	  // learn seq
-	  sce.learned=true;
-	}
-      }
-    }
-  }
-
-  // check & select remaining seqs
-
-}
-
-
-
-
-int MiraSCE::mainSignificantContigExtraction(int argc, char ** argv)
-{
-  FUNCSTART("int MiraSCE::mainSignificantContigExtraction(int argc, char ** argv)");
-
-  // that loop is straight from the GNU getopt_long example
-  // http://www.gnu.org/s/hello/manual/libc/Getopt-Long-Option-Example.html
-  while (1){
-    static struct option mlong_options[] =
-      {
-	{"help",  no_argument,           0, 'h'},
-	{"kmersize", required_argument,         0, 'k'},
-	{"version", no_argument,         0, 'v'},
-	{0, 0, 0, 0}
-      };
-    /* getopt_long stores the option index here. */
-    int option_index = 0;
-
-    int c = getopt_long (argc, argv, "hc:j:k:v",
-		     mlong_options, &option_index);
-
-    if (c == -1) break;
-
-    switch (c) {
-    case 'h':
-      cout << "mira\t\tMIRALIB version " << MIRAVERSION << "\n"
-	"Author:\t\tBastien Chevreux (bach at chevreux.org)\n"
-	"Purpose:\t...\n\n";
-
-      cout << "Usage:\n"
-	",,,, ...\n";
-      cout << "\nOptions:\n";
-      cout <<
-	"  -h / --help\t\t\t\tThis help text\n"
-	"  -v / --version\t\t\tPrint version and exit\n"
-	;
-      exit(0);
-//    case 'j': {
-//      SCE_job=optarg;
-//      boost::to_lower(SCE_job);
-//      break;
-//    }
-    case 'k': {
-      uint64 bla=atoi(optarg);
-      //if(bla>32) bla=32;
-      SCE_basesperhash=bla;
-      break;
-    }
-    case 'v':
-      cout << MIRAVERSION << endl;
-      exit(0);
-    default:
-      abort();
-    }
-  }
-
-  if(SCE_basesperhash==0) SCE_basesperhash=32;
-  if(SCE_basesperhash>32){
-    cout << "Sorry, -k for kmer size must be <= 32 for the time being.\n";
-    exit(100);
-  }
-
-  try {
-    excon(argc,argv);
-  }
-  catch(Notify n){
-    n.handleError(THISFUNC);
-  }
-  catch(Flow f){
-    cerr << "Unexpected exception: Flow()\n";
-  }
-  catch(...){
-    cerr << "Unknown exception caught, aborting the process.\n\nPlease contact: bach at chevreux.org\n\n";
-    abort();
-  }
-
-  FUNCEND();
-  return 0;
-}
diff --git a/src/modules/mod_sigconex.H b/src/modules/mod_sigconex.H
deleted file mode 100644
index 7a00a04..0000000
--- a/src/modules/mod_sigconex.H
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
- *   Krebsforschungszentrum, DKFZ Heidelberg) and Bastien Chevreux
- * Copyright (C) 2000 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-
-#include <fstream>
-
-#include <string>
-#include <vector>
-#include <list>
-
-#include "mira/parameters.H"
-#include "mira/readpool_io.H"
-#include "mira/vhash.H"
-
-
-class MiraSCE
-{
-private:
-  uint32 SCE_basesperhash=31;
-
-private:
-  void usage();
-
-  void excon(int argc, char ** argv);
-
-public:
-  int mainSignificantContigExtraction(int argc, char ** argv);
-};
diff --git a/src/modules/mod_tagsnp.C b/src/modules/mod_tagsnp.C
deleted file mode 100644
index f8bff8b..0000000
--- a/src/modules/mod_tagsnp.C
+++ /dev/null
@@ -1,254 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
- *   Krebsforschungszentrum, DKFZ Heidelberg) and Bastien Chevreux
- * Copyright (C) 2000 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-#include <iostream>
-
-#include "caf/caf.H"
-#include "mira/assembly.H"
-
-#include "modules/misc.H"
-#include "modules/mod_tagsnp.H"
-
-#include "version.H"
-
-
-using namespace std;
-
-
-
-list<Contig> tagsnp::TS_clist;
-ofstream tagsnp::TS_fout;
-
-void tagsnp::usage()
-{
-  cerr << "tagsnp\t(MIRALIB version " << MIRALIBVERSION << ")\n\n";
-  cerr << "Usage:\n";
-  cerr << "  tagsnp [-xxx] cafin cafout [optional MIRA settings]\n\n";
-  cerr << "Options:\n";
-  cerr << "\t-n\t\tnuke all existing SNP and RMB tags in file\n";
-//  cerr << "\t-s <filename>\tload strain data from file\n";
-//  cerr << "\t-a\t\tassume SNPs instead of repeats\n";
-//  cerr << "\t-r <int>\tminimum reads per group (default: 1)\n";
-//  cerr << "\t-q <int>\tminimum qual for tagging (default: 30)\n";
-//  cerr << "\t-n <int>\tminimum neighbour qual for tagging (default: 20)\n";
-//  cerr << "\t-e <int>\tend read exclusion area (default: 25)\n";
-//  cerr << "\t-g\t\talso mark gap bases\n";
-//  cerr << "\t-m\t\talso mark multicolumn gap bases\n";
-
-}
-
-
-//void tagsnp::save(string & cafout)
-//{
-//
-//  if(!cafout.empty()){
-//    assout::saveAsCAF(contigs,cafout);
-//  } else {
-//    assout::dumpAsCAF(contigs,cout);
-//  }
-//
-//  //
-//  //filename="out.tcs";
-//  //assout::saveAsTCS(contigs,filename);
-//
-//  //filename="tagsnp_out.gap4da";
-//  //assout::saveAsGAP4DA(contigs,filename);
-//
-//  //filename="featureanalysis.txt";
-//  //assout::saveFeatureAnalysis(400,100,contigs,readpool,
-//  //				filename,
-//  //				"featuresummary.txt",
-//  //				"featureprot.txt");
-//
-//  //{
-//  //  string filename="out.html";
-//  //  cout << "Saving contigs to htmlfile: " << filename << endl;
-//  //  ofstream out(filename.c_str(), ios::out | ios::trunc);
-//  //  assout::dumpContigListAsHTML(contigs, "Super project", out);
-//  //  out.close();
-//  //}
-//}
-
-//void tagsnp::load (MIRAParameters * mp, string & cafin, string & strainin)
-//{
-//  cerr << "Loading project from CAF file: " << cafin << endl;
-//
-//  CAF tcaf(readpool, contigs, mp);
-//  tcaf.load(cafin);
-//
-//  if(!strainin.empty()){
-//    cerr << "Loading strain data";
-//    readpool.loadStrainData(strainin);
-//  }
-//
-//  Assembly::refreshContigAndReadpoolValuesAfterLoading(readpool,contigs);
-//}
-
-//void tagsnp::doit(list<Contig> & contigs)
-//{
-//  cout << "Tagging reads ..." << endl;
-//  list<Contig>::iterator I=contigs.begin();
-//  for(;I!=contigs.end(); I++){
-//    //I->setParams(&P);
-//    //
-//    //uint32 numSRMB=0;
-//    //uint32 numWRMB=0;
-//    //uint32 numSNP=0;
-//    //I->transposeReadSRMTagsToContig();
-//    ////I->markPossibleRepeats(numSRMB, numWRMB, numSNP);
-//    //vector<bool> readsmarkedsrm;
-//    //I->newMarkPossibleRepeats(numSRMB,readsmarkedsrm);
-//  }
-//}
-
-
-void tagsnp::saveCList(list<Contig> & clist, ReadPool & rp)
-{
-  Contig::setCoutType(Contig::AS_CAF);
-  list<Contig>::iterator I=clist.begin();
-  for(;I!=clist.end(); I++){
-    TS_fout << *I;
-  }
-}
-
-void tagsnp::cafload_callback(list<Contig> & clist, ReadPool & rp)
-{
-  bool dooutput=true;
-
-  Assembly::refreshContigAndReadpoolValuesAfterLoading(rp,clist,NWWARN);
-  clist.back().trashConsensusCache(false);
-
-  doit2(clist);
-  saveCList(clist, rp);
-
-  clist.clear();
-  rp.discard();
-}
-
-void tagsnp::doit2(list<Contig> & contigs)
-{
-  cout << "Tagging reads ..." << endl;
-  list<Contig>::iterator I=contigs.begin();
-  for(;I!=contigs.end(); I++){
-    I->trashConsensusCache(false);
-
-    Contig::repeatmarker_stats_t repstats;
-    vector<bool> readsmarkedsrm;
-    I->newMarkPossibleRepeats(repstats, readsmarkedsrm);
-
-    I->markFeaturesByConsensus(true,true,true);
-  }
-}
-
-
-
-int tagsnp::mainTagSNP(int argc, char ** argv)
-{
-  FUNCSTART("int mainTagSNP(int argc, char ** argv)");
-
-  vector<MIRAParameters> Pv;
-  MIRAParameters::setupStdMIRAParameters(Pv);
-
-  const_cast<contig_parameters &>(Pv[0].getContigParams()).con_disregard_spurious_rmb_mismatches=false;
-
-  ReadPool thepool;
-
-  int c;
-  extern char *optarg;
-  extern int optind;
-
-
-  string cafin="";
-  string strainin="";
-
-  while (1){
-    c = getopt(argc, argv, "+h");
-    if(c == -1) break;
-
-    switch (c) {
-    case 'h':
-    case '?': {
-      usage();
-      exit(0);
-    }
-    default : {}
-    }
-  }
-
-  if(argc-optind < 2) {
-    cerr << argv[0] << ": " << "Missing at least infile or outfile as argument!\n";
-    usage();
-    exit(1);
-  }
-
-  string infile=argv[optind++];
-  string outfile=argv[optind++];
-
-  if(argc-optind > 0) {
-    stringstream tss;
-    for(int32 i=optind; i<argc; i++) tss << argv[i] << "  *=BEGIN0=*";
-    MIRAParameters::parse(tss,Pv,false);
-  }
-
-  MIRAParameters::dumpAllParams(Pv, cout);
-
-  TS_fout.open(outfile.c_str(), ios::out);
-  if(!TS_fout){
-    MIRANOTIFY(Notify::FATAL, "Could not open file for saving: " << outfile);
-  }
-
-  try{
-    vector<uint32> dummy;
-    CAF tcaf(&thepool, &TS_clist, &Pv);
-    tcaf.load(infile,
-	      ReadGroupLib::SEQTYPE_SANGER,
-	      1,
-	      dummy,
-	      false,
-	      cafload_callback
-      );
-
-    //load(&P, infile, strainin);
-    //
-    //doit();
-    //save(outfile);
-
-  }
-  catch(Notify n){
-    n.handleError("main");
-  }
-  catch(Flow f){
-    cerr << "Unexpected exception: Flow()\n";
-  }
-
-  TS_fout.close();
-
-  FUNCEND();
-  return 0;
-}
-
-
-
diff --git a/src/modules/mod_tagsnp.H b/src/modules/mod_tagsnp.H
deleted file mode 100644
index 2b7f0c0..0000000
--- a/src/modules/mod_tagsnp.H
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
- *   Krebsforschungszentrum, DKFZ Heidelberg) and Bastien Chevreux
- * Copyright (C) 2000 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-#include <iostream>
-#include <fstream>
-
-#include <list>
-
-#include "mira/readpool.H"
-#include "mira/contig.H"
-
-
-class tagsnp
-{
-private:
-  static std::ofstream TS_fout;
-
-  static std::list<Contig> TS_clist;   // needed for CAF conversion (and GBF)
-
-private:
-  void usage();
-
-
-  static void doit2(std::list<Contig> & contigs);
-  static void saveCList(std::list<Contig> & clist, ReadPool & rp);
-  static void cafload_callback(std::list<Contig> & clist, ReadPool & rp);
-
-public:
-  int mainTagSNP(int argc, char ** argv);
-};
-
diff --git a/src/progs/Makefile.am b/src/progs/Makefile.am
index 2ad1958..5512368 100644
--- a/src/progs/Makefile.am
+++ b/src/progs/Makefile.am
@@ -1,74 +1,59 @@
-AM_CPPFLAGS = -I$(top_srcdir)/src $(all_includes)
+INCLUDES = -I$(top_srcdir)/src $(all_includes)
 
 AM_CXXFLAGS = $(BOOST_CPPFLAGS)
 
-#LINKEDITLIB= -lmiraEdIt -lmiraExamine -lmiraKNN_abi373
-#LINKEDITDIR= -L../examine -L../EdIt -L../knn_abi373 -L../knn_alf
+SUFFIXES= .par .itxt
 
-LINKEDITLIB=
-LINKEDITDIR=
-
-
-SUFFIXES= .itxt
+%.par.H: %.par
+	@echo "Making .H out of .par" $@
+	@$(SHELL) -ec 'grep -v "^#" $< >$<.tmp; cat $<.tmp | perl $(top_srcdir)/src/progs/par2c.pl >$<.H; rm $<.tmp'
 
 ciclean:
 	- at rm -f compileinfo.itxt
 
 compileinfo.itxt:
-	@/bin/echo -n "Compiled by: " >compileinfo.itxt.xxd
-	@whoami >>compileinfo.itxt.xxd
-	@date >>compileinfo.itxt.xxd
-	@/bin/echo -n "On: " >>compileinfo.itxt.xxd
-	@uname -a >>compileinfo.itxt.xxd
-	@echo "Making .H out of .xxd" $@
-	@$(SHELL) -ec 'grep -v "^#" compileinfo.itxt.xxd | xxd -i >compileinfo.itxt.xxd.H'
-	@rm compileinfo.itxt.xxd
+	@/bin/echo -n "Compiled by: " >compileinfo.itxt
+	@whoami >>compileinfo.itxt
+	@date >>compileinfo.itxt
+	@/bin/echo -n "On: " >>compileinfo.itxt
+	@uname -a >>compileinfo.itxt
 
+%.itxt.H: %.itxt
+	@echo "Making .H out of .itxt" $@
+	@$(SHELL) -ec 'grep -v "^#" $< >$<.tmp; cat $<.tmp | perl $(top_srcdir)/src/progs/par2c.pl >$<.H; rm $<.tmp'
 
+noinst_HEADERS= version.H
+EXTRA_DIST = me_step1.par me_step2.par me_step3.par par2c.pl
 
+#bin_PROGRAMS= mira fastatool scftool uncover_at convert_project tagsnp
+bin_PROGRAMS= mira fastatool scftool convert_project 
 
-bin_PROGRAMS= mira
-noinst_PROGRAMS= miratest
+# tagsnp ace2caf
+noinst_PROGRAMS= sw miratest dbgreplay
 
-noinst_HEADERS= quirks.H
+#noinst_PROGRAMS+= mirazip
+# EdIt_abi373 EdIt_alf skimmer
 
 if BUILDMIRASTATIC
-AM_LDFLAGS=  $(BLOODYDARWINSTATLIBDIRHACK) -L../modules -L../debuggersupport -L../memorc -L../io/ -L../util/ -L../errorhandling/ -L../mira -L../caf $(LINKEDITDIR) $(BOOST_LDFLAGS) -all-static
+AM_LDFLAGS=  $(BLOODYDARWINSTATLIBDIRHACK) -L../io/ -L../util/ -L../errorhandling/ -L../mira -L../examine/ -L../EdIt/ -L../caf/ -L../knn_abi373 -L../knn_alf $(BOOST_LDFLAGS) -all-static
 else
-AM_LDFLAGS=  -L../modules -L../debuggersupport -L../memorc -L../io/ -L../util/ -L../errorhandling/ -L../mira -L../caf $(LINKEDITDIR) $(BOOST_LDFLAGS)
+AM_LDFLAGS=  -L../io/ -L../util/ -L../errorhandling/ -L../mira -L../examine/ -L../EdIt/ -L../caf/ -L../knn_abi373 -L../knn_alf $(BOOST_LDFLAGS)
+#AM_LDFLAGS=  -L../io/ -L../util/ -L../errorhandling/ -L../mira -L../caf/ $(BOOST_LDFLAGS)
 endif
 
-if BUILDMIRAMEMORC
-MEMORC= -lmemorc
-endif
-
-MIRALIBS= -lmiramodules -lmiradebuggersupport $(MEMORC) -lmira -lmiraestass -lmiracaf -lmirautil -lmiradptools -lmirafio -lmiraerrorhandling -lmiradebuggersupport -lmirafmttext $(LINKEDITLIB)
-
 install-exec-hook:
 	cd $(DESTDIR)$(bindir) && \
+	rm -f miraSearchESTSNPs$(EXEEXT) && \
+	rm -f miraclip$(EXEEXT) && \
 	rm -f miramem$(EXEEXT) && \
 	$(LN_S) mira$(EXEEXT) miramem$(EXEEXT) && \
-	rm -f mirabait$(EXEEXT) && \
-	$(LN_S) mira$(EXEEXT) mirabait$(EXEEXT) &&\
-	rm -f miraconvert$(EXEEXT) && \
-	$(LN_S) mira$(EXEEXT) miraconvert$(EXEEXT) \
-	rm -f miramer$(EXEEXT) && \
-	$(LN_S) mira$(EXEEXT) miramer$(EXEEXT)
-
-#	$(LN_S) miramer$(EXEEXT) miradiff$(EXEEXT) && \
-#	$(LN_S) mira$(EXEEXT) miraSearchESTSNPs$(EXEEXT) && \
-#	$(LN_S) mira$(EXEEXT) miraclip$(EXEEXT) && \
-#	rm -f miraSearchESTSNPs$(EXEEXT) && \
-#	rm -f miraclip$(EXEEXT) && \
-#	rm -f miradiff$(EXEEXT) && \
-#
+	$(LN_S) mira$(EXEEXT) miraSearchESTSNPs$(EXEEXT) && \
+	$(LN_S) mira$(EXEEXT) miraclip$(EXEEXT)
 
 uninstall-hook:
 	cd $(DESTDIR)$(bindir) && \
 	rm -f miraSearchESTSNPs$(EXEEXT) && \
-	rm -f mirabait$(EXEEXT) && \
 	rm -f miramem$(EXEEXT) && \
-	rm -f miradiff$(EXEEXT) && \
 	rm -f miraclip$(EXEEXT)
 
 
@@ -84,11 +69,43 @@ binclean:
 	rm -rf $(bin_PROGRAMS)
 
 
-mira.C: ciclean compileinfo.itxt
-mira_SOURCES= mira.C quirks.C
-mira_LDADD= $(MIRALIBS)
+sw.C:  version.H
+sw_SOURCES= sw.C
+sw_LDADD= -lmirasupport -lmirautil -lmiradptools -lmirafio -lmiracaf -lmiraEdIt -lmiraExamine -lmiraKNN_abi373 -lmiraerrorhandling -lz -lexpat
+
+mira.C: me_step1.par.H me_step2.par.H me_step3.par.H version.H ciclean compileinfo.itxt.H
+mira_SOURCES= mira.C
+mira_LDADD=  -lmira -lmiraEdIt -lmiraExamine -lmiraestass -lmiracaf -lmirasupport -lmirautil -lmiradptools -lmirafio -lmiraKNN_abi373 -lmiraerrorhandling -lm -lz -lexpat $(BOOST_THREAD_LIB) $(BOOST_REGEX_LIB) 
+
+mirazip.C: version.H ciclean compileinfo.itxt.H
+nodist_mirazip_SOURCES= mirazip.C
+mirazip_LDADD=  -lmira -lmiraEdIt -lmiraExamine -lmiracaf -lmirasupport -lmirautil -lmiradptools -lmirafio -lmiraKNN_abi373 -lmiraerrorhandling -lm -lz -lexpat $(BOOST_THREAD_LIB) $(BOOST_REGEX_LIB) 
+
+dbgreplay_SOURCES= dbgreplay.C
+dbgreplay_LDADD=  -lmira -lmiraEdIt -lmiraExamine -lmiraestass -lmiracaf -lmirasupport -lmirautil -lmiradptools -lmirafio -lmiraKNN_abi373 -lmiraerrorhandling -lm -lz -lexpat $(BOOST_THREAD_LIB) $(BOOST_REGEX_LIB) 
+
+#mira_LDADD=  -lmira -lmiraestass -lmiracaf -lmirasupport -lmirautil -lmiradptools -lmirafio -lmiraerrorhandling -lm -lz -lexpat $(BOOST_THREAD_LIB)
+
+uncover_at_SOURCES= uncover_at.C
+uncover_at_LDADD= -lmiraExamine -lmiraKNN_abi373 -lmirasupport -lmiraerrorhandling  -lmirautil -lmiradptools -lmirafio -lmiracaf -lmiraEdIt -lz -lexpat $(BOOST_THREAD_LIB) $(BOOST_REGEX_LIB)
 
-miratest.C:
 miratest_SOURCES= miratest.C
-miratest_LDADD= $(MIRALIBS)
+miratest_LDADD=  -lmira -lmirasupport -lmiraestass -lmiraerrorhandling  -lmirautil -lmiradptools -lz -lmirafio -lmiracaf -lmiraEdIt -lmiraExamine -lmiraKNN_abi373 -lm -lz -lexpat $(BOOST_THREAD_LIB) $(BOOST_REGEX_LIB)
+
+
+fastatool_SOURCES= fastatool.C
+fastatool_LDADD= -lmiraerrorhandling  -lmirautil -lmirafio -lexpat
+
+scftool_SOURCES= scftool.C
+scftool_LDADD= -lmirasupport -lmiraerrorhandling  -lmirautil -lmiradptools -lmirafio -lz -lexpat
+
+ace2caf_SOURCES= ace2caf.C
+ace2caf_LDADD= -lmiraerrorhandling  -lmirautil -lmiradptools -lmirafio -lexpat
+
+tagsnp_SOURCES= tagsnp.C
+tagsnp_LDADD= -lmira -lmiraEdIt -lmiraExamine -lmirasupport -lmiraerrorhandling  -lmirautil -lmiradptools -lmirafio -lmiracaf  -lmiraKNN_abi373 -lz -lexpat $(BOOST_THREAD_LIB) $(BOOST_REGEX_LIB)
+
+convert_project_SOURCES= convert_project.C
+convert_project_LDADD= -lmira -lmirasupport -lmiraerrorhandling  -lmirautil -lmiradptools -lmirafio -lmiracaf -lmiraEdIt -lmiraExamine -lmiraKNN_abi373 -lz -lexpat $(BOOST_THREAD_LIB) $(BOOST_REGEX_LIB)
+
 
diff --git a/src/progs/Makefile.in b/src/progs/Makefile.in
index 7339bd5..0209f93 100644
--- a/src/progs/Makefile.in
+++ b/src/progs/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -35,20 +35,29 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
-bin_PROGRAMS = mira$(EXEEXT)
-noinst_PROGRAMS = miratest$(EXEEXT)
+bin_PROGRAMS = mira$(EXEEXT) fastatool$(EXEEXT) scftool$(EXEEXT) \
+	convert_project$(EXEEXT)
+noinst_PROGRAMS = sw$(EXEEXT) miratest$(EXEEXT) dbgreplay$(EXEEXT)
 subdir = src/progs
 DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/ax_boost_base.m4 \
-	$(top_srcdir)/m4/ax_boost_filesystem.m4 \
-	$(top_srcdir)/m4/ax_boost_iostreams.m4 \
-	$(top_srcdir)/m4/ax_boost_regex.m4 \
-	$(top_srcdir)/m4/ax_boost_system.m4 \
-	$(top_srcdir)/m4/ax_boost_thread.m4 \
-	$(top_srcdir)/m4/ax_check_zlib.m4 \
-	$(top_srcdir)/m4/ax_lib_expat.m4 $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/config/m4/ax_boost_base.m4 \
+	$(top_srcdir)/config/m4/ax_boost_regex.m4 \
+	$(top_srcdir)/config/m4/ax_boost_thread.m4 \
+	$(top_srcdir)/config/m4/ax_check_zlib.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_std.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_stl.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_namespaces.m4 \
+	$(top_srcdir)/config/m4/ax_lib_expat.m4 \
+	$(top_srcdir)/config/m4/ax_with_perl.m4 \
+	$(top_srcdir)/config/m4/ax_with_prog.m4 \
+	$(top_srcdir)/config/m4/libtool.m4 \
+	$(top_srcdir)/config/m4/ltoptions.m4 \
+	$(top_srcdir)/config/m4/ltsugar.m4 \
+	$(top_srcdir)/config/m4/ltversion.m4 \
+	$(top_srcdir)/config/m4/lt~obsolete.m4 \
+	$(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -56,14 +65,29 @@ CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
 am__installdirs = "$(DESTDIR)$(bindir)"
 PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
-am_mira_OBJECTS = mira.$(OBJEXT) quirks.$(OBJEXT)
-mira_OBJECTS = $(am_mira_OBJECTS)
+am_convert_project_OBJECTS = convert_project.$(OBJEXT)
+convert_project_OBJECTS = $(am_convert_project_OBJECTS)
 am__DEPENDENCIES_1 =
-am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
-mira_DEPENDENCIES = $(am__DEPENDENCIES_2)
+convert_project_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1)
+am_dbgreplay_OBJECTS = dbgreplay.$(OBJEXT)
+dbgreplay_OBJECTS = $(am_dbgreplay_OBJECTS)
+dbgreplay_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+am_fastatool_OBJECTS = fastatool.$(OBJEXT)
+fastatool_OBJECTS = $(am_fastatool_OBJECTS)
+fastatool_DEPENDENCIES =
+am_mira_OBJECTS = mira.$(OBJEXT)
+mira_OBJECTS = $(am_mira_OBJECTS)
+mira_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 am_miratest_OBJECTS = miratest.$(OBJEXT)
 miratest_OBJECTS = $(am_miratest_OBJECTS)
-miratest_DEPENDENCIES = $(am__DEPENDENCIES_2)
+miratest_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+am_scftool_OBJECTS = scftool.$(OBJEXT)
+scftool_OBJECTS = $(am_scftool_OBJECTS)
+scftool_DEPENDENCIES =
+am_sw_OBJECTS = sw.$(OBJEXT)
+sw_OBJECTS = $(am_sw_OBJECTS)
+sw_DEPENDENCIES =
 DEFAULT_INCLUDES = -I. at am__isrc@
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
@@ -77,8 +101,12 @@ CXXLD = $(CXX)
 CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	--mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
 	$(LDFLAGS) -o $@
-SOURCES = $(mira_SOURCES) $(miratest_SOURCES)
-DIST_SOURCES = $(mira_SOURCES) $(miratest_SOURCES)
+SOURCES = $(convert_project_SOURCES) $(dbgreplay_SOURCES) \
+	$(fastatool_SOURCES) $(mira_SOURCES) $(miratest_SOURCES) \
+	$(scftool_SOURCES) $(sw_SOURCES)
+DIST_SOURCES = $(convert_project_SOURCES) $(dbgreplay_SOURCES) \
+	$(fastatool_SOURCES) $(mira_SOURCES) $(miratest_SOURCES) \
+	$(scftool_SOURCES) $(sw_SOURCES)
 HEADERS = $(noinst_HEADERS)
 ETAGS = etags
 CTAGS = ctags
@@ -93,13 +121,9 @@ AWK = @AWK@
 BITPACKAGE = @BITPACKAGE@
 BLOODYDARWINSTATLIBDIRHACK = @BLOODYDARWINSTATLIBDIRHACK@
 BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
-BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@
-BOOST_IOSTREAMS_LIB = @BOOST_IOSTREAMS_LIB@
 BOOST_LDFLAGS = @BOOST_LDFLAGS@
 BOOST_REGEX_LIB = @BOOST_REGEX_LIB@
-BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@
 BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
-BUNDLETARGET = @BUNDLETARGET@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
@@ -112,7 +136,6 @@ CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -122,13 +145,11 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LDFLAGS = @EXPAT_LDFLAGS@
-EXPAT_LIBS = @EXPAT_LIBS@
 EXPAT_VERSION = @EXPAT_VERSION@
 FGREP = @FGREP@
 FLEX = @FLEX@
 FLEXPP = @FLEXPP@
 GREP = @GREP@
-HAVE_XXD = @HAVE_XXD@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -146,7 +167,6 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
 MIRASTATIC = @MIRASTATIC@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
@@ -163,17 +183,18 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
+SHORTMIRAAUDIENCE = @SHORTMIRAAUDIENCE@
 STRIP = @STRIP@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -207,6 +228,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -222,27 +244,44 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-AM_CPPFLAGS = -I$(top_srcdir)/src $(all_includes)
+INCLUDES = -I$(top_srcdir)/src $(all_includes)
 AM_CXXFLAGS = $(BOOST_CPPFLAGS)
-
-#LINKEDITLIB= -lmiraEdIt -lmiraExamine -lmiraKNN_abi373
-#LINKEDITDIR= -L../examine -L../EdIt -L../knn_abi373 -L../knn_alf
-LINKEDITLIB = 
-LINKEDITDIR = 
-SUFFIXES = .itxt
-noinst_HEADERS = quirks.H
- at BUILDMIRASTATIC_FALSE@AM_LDFLAGS = -L../modules -L../debuggersupport -L../memorc -L../io/ -L../util/ -L../errorhandling/ -L../mira -L../caf $(LINKEDITDIR) $(BOOST_LDFLAGS)
- at BUILDMIRASTATIC_TRUE@AM_LDFLAGS = $(BLOODYDARWINSTATLIBDIRHACK) -L../modules -L../debuggersupport -L../memorc -L../io/ -L../util/ -L../errorhandling/ -L../mira -L../caf $(LINKEDITDIR) $(BOOST_LDFLAGS) -all-static
- at BUILDMIRAMEMORC_TRUE@MEMORC = -lmemorc
-MIRALIBS = -lmiramodules -lmiradebuggersupport $(MEMORC) -lmira -lmiraestass -lmiracaf -lmirautil -lmiradptools -lmirafio -lmiraerrorhandling -lmiradebuggersupport -lmirafmttext $(LINKEDITLIB)
-mira_SOURCES = mira.C quirks.C
-mira_LDADD = $(MIRALIBS)
+SUFFIXES = .par .itxt
+noinst_HEADERS = version.H
+EXTRA_DIST = me_step1.par me_step2.par me_step3.par par2c.pl
+ at BUILDMIRASTATIC_FALSE@AM_LDFLAGS = -L../io/ -L../util/ -L../errorhandling/ -L../mira -L../examine/ -L../EdIt/ -L../caf/ -L../knn_abi373 -L../knn_alf $(BOOST_LDFLAGS)
+
+#noinst_PROGRAMS+= mirazip
+# EdIt_abi373 EdIt_alf skimmer
+ at BUILDMIRASTATIC_TRUE@AM_LDFLAGS = $(BLOODYDARWINSTATLIBDIRHACK) -L../io/ -L../util/ -L../errorhandling/ -L../mira -L../examine/ -L../EdIt/ -L../caf/ -L../knn_abi373 -L../knn_alf $(BOOST_LDFLAGS) -all-static
+sw_SOURCES = sw.C
+sw_LDADD = -lmirasupport -lmirautil -lmiradptools -lmirafio -lmiracaf -lmiraEdIt -lmiraExamine -lmiraKNN_abi373 -lmiraerrorhandling -lz -lexpat
+mira_SOURCES = mira.C
+mira_LDADD = -lmira -lmiraEdIt -lmiraExamine -lmiraestass -lmiracaf -lmirasupport -lmirautil -lmiradptools -lmirafio -lmiraKNN_abi373 -lmiraerrorhandling -lm -lz -lexpat $(BOOST_THREAD_LIB) $(BOOST_REGEX_LIB) 
+nodist_mirazip_SOURCES = mirazip.C
+mirazip_LDADD = -lmira -lmiraEdIt -lmiraExamine -lmiracaf -lmirasupport -lmirautil -lmiradptools -lmirafio -lmiraKNN_abi373 -lmiraerrorhandling -lm -lz -lexpat $(BOOST_THREAD_LIB) $(BOOST_REGEX_LIB) 
+dbgreplay_SOURCES = dbgreplay.C
+dbgreplay_LDADD = -lmira -lmiraEdIt -lmiraExamine -lmiraestass -lmiracaf -lmirasupport -lmirautil -lmiradptools -lmirafio -lmiraKNN_abi373 -lmiraerrorhandling -lm -lz -lexpat $(BOOST_THREAD_LIB) $(BOOST_REGEX_LIB) 
+
+#mira_LDADD=  -lmira -lmiraestass -lmiracaf -lmirasupport -lmirautil -lmiradptools -lmirafio -lmiraerrorhandling -lm -lz -lexpat $(BOOST_THREAD_LIB)
+uncover_at_SOURCES = uncover_at.C
+uncover_at_LDADD = -lmiraExamine -lmiraKNN_abi373 -lmirasupport -lmiraerrorhandling  -lmirautil -lmiradptools -lmirafio -lmiracaf -lmiraEdIt -lz -lexpat $(BOOST_THREAD_LIB) $(BOOST_REGEX_LIB)
 miratest_SOURCES = miratest.C
-miratest_LDADD = $(MIRALIBS)
+miratest_LDADD = -lmira -lmirasupport -lmiraestass -lmiraerrorhandling  -lmirautil -lmiradptools -lz -lmirafio -lmiracaf -lmiraEdIt -lmiraExamine -lmiraKNN_abi373 -lm -lz -lexpat $(BOOST_THREAD_LIB) $(BOOST_REGEX_LIB)
+fastatool_SOURCES = fastatool.C
+fastatool_LDADD = -lmiraerrorhandling  -lmirautil -lmirafio -lexpat
+scftool_SOURCES = scftool.C
+scftool_LDADD = -lmirasupport -lmiraerrorhandling  -lmirautil -lmiradptools -lmirafio -lz -lexpat
+ace2caf_SOURCES = ace2caf.C
+ace2caf_LDADD = -lmiraerrorhandling  -lmirautil -lmiradptools -lmirafio -lexpat
+tagsnp_SOURCES = tagsnp.C
+tagsnp_LDADD = -lmira -lmiraEdIt -lmiraExamine -lmirasupport -lmiraerrorhandling  -lmirautil -lmiradptools -lmirafio -lmiracaf  -lmiraKNN_abi373 -lz -lexpat $(BOOST_THREAD_LIB) $(BOOST_REGEX_LIB)
+convert_project_SOURCES = convert_project.C
+convert_project_LDADD = -lmira -lmirasupport -lmiraerrorhandling  -lmirautil -lmiradptools -lmirafio -lmiracaf -lmiraEdIt -lmiraExamine -lmiraKNN_abi373 -lz -lexpat $(BOOST_THREAD_LIB) $(BOOST_REGEX_LIB)
 all: all-am
 
 .SUFFIXES:
-.SUFFIXES: .itxt .C .lo .o .obj
+.SUFFIXES: .par .itxt .C .lo .o .obj
 $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
@@ -325,12 +364,27 @@ clean-noinstPROGRAMS:
 	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
 	echo " rm -f" $$list; \
 	rm -f $$list
-mira$(EXEEXT): $(mira_OBJECTS) $(mira_DEPENDENCIES) $(EXTRA_mira_DEPENDENCIES) 
+convert_project$(EXEEXT): $(convert_project_OBJECTS) $(convert_project_DEPENDENCIES) 
+	@rm -f convert_project$(EXEEXT)
+	$(CXXLINK) $(convert_project_OBJECTS) $(convert_project_LDADD) $(LIBS)
+dbgreplay$(EXEEXT): $(dbgreplay_OBJECTS) $(dbgreplay_DEPENDENCIES) 
+	@rm -f dbgreplay$(EXEEXT)
+	$(CXXLINK) $(dbgreplay_OBJECTS) $(dbgreplay_LDADD) $(LIBS)
+fastatool$(EXEEXT): $(fastatool_OBJECTS) $(fastatool_DEPENDENCIES) 
+	@rm -f fastatool$(EXEEXT)
+	$(CXXLINK) $(fastatool_OBJECTS) $(fastatool_LDADD) $(LIBS)
+mira$(EXEEXT): $(mira_OBJECTS) $(mira_DEPENDENCIES) 
 	@rm -f mira$(EXEEXT)
 	$(CXXLINK) $(mira_OBJECTS) $(mira_LDADD) $(LIBS)
-miratest$(EXEEXT): $(miratest_OBJECTS) $(miratest_DEPENDENCIES) $(EXTRA_miratest_DEPENDENCIES) 
+miratest$(EXEEXT): $(miratest_OBJECTS) $(miratest_DEPENDENCIES) 
 	@rm -f miratest$(EXEEXT)
 	$(CXXLINK) $(miratest_OBJECTS) $(miratest_LDADD) $(LIBS)
+scftool$(EXEEXT): $(scftool_OBJECTS) $(scftool_DEPENDENCIES) 
+	@rm -f scftool$(EXEEXT)
+	$(CXXLINK) $(scftool_OBJECTS) $(scftool_LDADD) $(LIBS)
+sw$(EXEEXT): $(sw_OBJECTS) $(sw_DEPENDENCIES) 
+	@rm -f sw$(EXEEXT)
+	$(CXXLINK) $(sw_OBJECTS) $(sw_LDADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -338,9 +392,13 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/convert_project.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dbgreplay.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fastatool.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mira.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/miratest.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/quirks.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/scftool.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/sw.Po at am__quote@
 
 .C.o:
 @am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@@ -468,15 +526,10 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	if test -z '$(STRIP)'; then \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	      install; \
-	else \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-	fi
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
 mostlyclean-generic:
 
 clean-generic:
@@ -579,44 +632,38 @@ uninstall-am: uninstall-binPROGRAMS
 	uninstall-binPROGRAMS uninstall-hook
 
 
+%.par.H: %.par
+	@echo "Making .H out of .par" $@
+	@$(SHELL) -ec 'grep -v "^#" $< >$<.tmp; cat $<.tmp | perl $(top_srcdir)/src/progs/par2c.pl >$<.H; rm $<.tmp'
+
 ciclean:
 	- at rm -f compileinfo.itxt
 
 compileinfo.itxt:
-	@/bin/echo -n "Compiled by: " >compileinfo.itxt.xxd
-	@whoami >>compileinfo.itxt.xxd
-	@date >>compileinfo.itxt.xxd
-	@/bin/echo -n "On: " >>compileinfo.itxt.xxd
-	@uname -a >>compileinfo.itxt.xxd
-	@echo "Making .H out of .xxd" $@
-	@$(SHELL) -ec 'grep -v "^#" compileinfo.itxt.xxd | xxd -i >compileinfo.itxt.xxd.H'
-	@rm compileinfo.itxt.xxd
+	@/bin/echo -n "Compiled by: " >compileinfo.itxt
+	@whoami >>compileinfo.itxt
+	@date >>compileinfo.itxt
+	@/bin/echo -n "On: " >>compileinfo.itxt
+	@uname -a >>compileinfo.itxt
+
+%.itxt.H: %.itxt
+	@echo "Making .H out of .itxt" $@
+	@$(SHELL) -ec 'grep -v "^#" $< >$<.tmp; cat $<.tmp | perl $(top_srcdir)/src/progs/par2c.pl >$<.H; rm $<.tmp'
+#AM_LDFLAGS=  -L../io/ -L../util/ -L../errorhandling/ -L../mira -L../caf/ $(BOOST_LDFLAGS)
 
 install-exec-hook:
 	cd $(DESTDIR)$(bindir) && \
+	rm -f miraSearchESTSNPs$(EXEEXT) && \
+	rm -f miraclip$(EXEEXT) && \
 	rm -f miramem$(EXEEXT) && \
 	$(LN_S) mira$(EXEEXT) miramem$(EXEEXT) && \
-	rm -f mirabait$(EXEEXT) && \
-	$(LN_S) mira$(EXEEXT) mirabait$(EXEEXT) &&\
-	rm -f miraconvert$(EXEEXT) && \
-	$(LN_S) mira$(EXEEXT) miraconvert$(EXEEXT) \
-	rm -f miramer$(EXEEXT) && \
-	$(LN_S) mira$(EXEEXT) miramer$(EXEEXT)
-
-#	$(LN_S) miramer$(EXEEXT) miradiff$(EXEEXT) && \
-#	$(LN_S) mira$(EXEEXT) miraSearchESTSNPs$(EXEEXT) && \
-#	$(LN_S) mira$(EXEEXT) miraclip$(EXEEXT) && \
-#	rm -f miraSearchESTSNPs$(EXEEXT) && \
-#	rm -f miraclip$(EXEEXT) && \
-#	rm -f miradiff$(EXEEXT) && \
-#
+	$(LN_S) mira$(EXEEXT) miraSearchESTSNPs$(EXEEXT) && \
+	$(LN_S) mira$(EXEEXT) miraclip$(EXEEXT)
 
 uninstall-hook:
 	cd $(DESTDIR)$(bindir) && \
 	rm -f miraSearchESTSNPs$(EXEEXT) && \
-	rm -f mirabait$(EXEEXT) && \
 	rm -f miramem$(EXEEXT) && \
-	rm -f miradiff$(EXEEXT) && \
 	rm -f miraclip$(EXEEXT)
 
 strip:
@@ -630,9 +677,11 @@ privinst:
 binclean:
 	rm -rf $(bin_PROGRAMS)
 
-mira.C: ciclean compileinfo.itxt
+sw.C:  version.H
+
+mira.C: me_step1.par.H me_step2.par.H me_step3.par.H version.H ciclean compileinfo.itxt.H
 
-miratest.C:
+mirazip.C: version.H ciclean compileinfo.itxt.H
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/src/progs/convert_project.C b/src/progs/convert_project.C
new file mode 100755
index 0000000..70d49b1
--- /dev/null
+++ b/src/progs/convert_project.C
@@ -0,0 +1,2518 @@
+/*
+ * Written by Bastien Chevreux (BaCh)
+ *
+ * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
+ *   Krebsforschungszentrum, DKFZ Heidelberg) and Bastien Chevreux
+ * Copyright (C) 2000 and later by Bastien Chevreux
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ * 
+ */
+
+#include <iostream>
+
+#include <boost/unordered_set.hpp> 
+#include <boost/lexical_cast.hpp>
+
+//#include <valgrind/callgrind.h>
+
+//#include "readpool.H"
+#include "io/generalio.H"
+#include "mira/parameters.H"
+#include "mira/assembly.H"
+#include "mira/assembly_output.H"
+#include "mira/maf_parse.H"
+#include "caf/caf.H"
+
+#include "version.H"
+
+
+#ifndef lint
+static char vcid[] = "$Id$";
+#endif /* lint */
+
+
+// 	$Id$	
+
+
+
+
+
+class General {
+  typedef boost::unordered_map<std::string, size_t> strintmap;
+  static strintmap GE_nameselectionmap;
+
+public:
+  static void makeSelectionStringSet(string & filename);
+  static bool checkNamePresence(string & name);
+  static bool hasNames();
+  static size_t getNameOrder(const string & name);
+};
+
+General::strintmap General::GE_nameselectionmap;
+
+
+void General::makeSelectionStringSet(string & filename)
+{
+  FUNCSTART("void makeSelectionStringSet(string & filename)");
+
+  ifstream fin;
+  fin.open(filename.c_str(), ios::in);
+  if(!fin){
+    MIRANOTIFY(Notify::FATAL, "File not found: " << filename);
+  }
+  fin.seekg(0, ios::beg);
+
+  string elemname, dummy;
+  strintmap::iterator nI;
+  uint32 numread=0;
+  while(GeneralIO::readKeyValue(fin, elemname,dummy)){
+    nI=GE_nameselectionmap.find(elemname);
+    if(nI==GE_nameselectionmap.end()) {
+      GE_nameselectionmap[elemname]=numread;
+      numread++;
+    }
+  }
+  fin.close();
+
+  if(GE_nameselectionmap.empty()) {
+    cerr << "ehhh?";
+    exit(10);
+  }
+
+  FUNCEND();
+}
+
+
+
+bool General::checkNamePresence(string & name)
+{
+  if(GE_nameselectionmap.empty()) return true;
+  return (GE_nameselectionmap.find(name) != GE_nameselectionmap.end());
+}
+
+bool General::hasNames()
+{
+  return !GE_nameselectionmap.empty();
+}
+
+size_t General::getNameOrder(const string & name)
+{
+  if(GE_nameselectionmap.empty()) return (0-1);
+  strintmap::iterator nI=GE_nameselectionmap.find(name);
+  if (nI == GE_nameselectionmap.end()) return (0-1);
+  return nI->second;
+}
+
+
+
+
+class mirafa
+{
+private:
+  static ofstream MFA_fout;
+
+  static list<Contig> MFA_clist;   // needed for CAF conversion (and GBF)
+
+private:
+  void usage();
+
+
+  static void doit2(list<Contig> & contigs, ReadPool & rp);
+  static void saveCList(list<Contig> & clist, ReadPool & rp);
+  static void cafload_callback(list<Contig> & clist, ReadPool & rp);
+
+public:
+  int main(int argc, char ** argv);
+};
+
+
+list<Contig> mirafa::MFA_clist;
+ofstream mirafa::MFA_fout;
+
+void mirafa::usage()
+{
+  cerr << "mirafa\t(MIRALIB version " << MIRALIBVERSION << ")\n\n";
+  cerr << "Usage:\n";
+  cerr << "  mirafa [-xxx] cafin cafout [optional MIRA settings]\n\n";
+  cerr << "Options:\n";
+  cerr << "\t-n\t\tnuke all existing SNP and RMB tags in file\n";
+}
+
+
+void mirafa::saveCList(list<Contig> & clist, ReadPool & rp)
+{
+  Contig::setCoutType(Contig::AS_CAF);
+  list<Contig>::iterator I=clist.begin();
+  for(;I!=clist.end(); I++){
+    MFA_fout << *I;
+  }
+}
+
+void mirafa::cafload_callback(list<Contig> & clist, ReadPool & rp)
+{
+  bool dooutput=true;
+
+  Assembly::refreshContigAndReadpoolValuesAfterLoading(rp,clist);
+  clist.back().trashConsensusCache(false);
+
+  cout << clist.back().getContigLength() << '\n';
+
+  doit2(clist,rp);
+
+  cout << clist.back().getContigLength() << '\n';
+
+  saveCList(clist, rp);
+
+  clist.clear();
+  rp.discard();
+}
+
+void mirafa::doit2(list<Contig> & contigs, ReadPool & rp)
+{
+  FUNCSTART("void mirafa::doit2(list<Contig> & contigs, ReadPool & rp)");
+  cout << "Buntifying reads ..." << endl;
+  list<Contig>::iterator I=contigs.begin();
+
+  string dir_tmp="./tmp";
+  uint8 basesperhash=17;
+
+  for(;I!=contigs.end(); I++){
+    I->trashConsensusCache(false);
+    I->addRails(10000,0,"",false,"",false);
+
+    for(uint32 rpi=0; rpi<rp.size(); rpi++){
+      if(rp[rpi].isRail()){
+	rp[rpi].setUsedInAssembly(true);
+	rp[rpi].setValidData(true);
+      }
+    }
+
+    if(ensureDirectory(dir_tmp,true)) {
+      MIRANOTIFY(Notify::FATAL, "Could not make sure that directory '" << dir_tmp << "' exists, aborting.");
+    }
+
+    {
+      Skim s3;
+      
+      s3.analyseHashes(dir_tmp,
+		       rp,
+		       false,
+		       false,
+		       false,
+		       true,
+		       basesperhash,
+		       1,
+		       1,
+		       true);
+      
+      Assembly::buntifyReadsByHashFreq(basesperhash, rp);
+    }
+  }
+
+  FUNCEND();
+}
+
+
+
+int mirafa::main(int argc, char ** argv)
+{
+  FUNCSTART("int main(int argc, char ** argv)");
+
+  vector<MIRAParameters> Pv;
+  MIRAParameters::setupStdMIRAParameters(Pv);
+
+  Pv[0].setContigDisregardSpuriousRMBMismatches(false);
+
+  ReadPool thepool(&Pv);
+
+  int c;
+  extern char *optarg;
+  extern int optind;
+
+
+  string cafin="";
+  string strainin="";
+
+  while (1){
+    c = getopt(argc, argv, "+h");
+    if(c == -1) break;
+
+    switch (c) {
+    case 'h': 
+    case '?': {
+      usage();
+      exit(0);
+    }
+    default : {}
+    }
+  }
+
+  if(argc-optind < 2) {
+    cerr << argv[0] << ": " << "Missing at least infile or outfile as argument!\n";
+    usage();
+    exit(1);
+  }
+
+  string infile=argv[optind++];
+  string outfile=argv[optind++];
+
+  if(argc-optind > 0) {
+    stringstream tss;
+    for(int32 i=optind; i<argc; i++) tss << argv[i] << "  *=BEGIN0=*";
+    MIRAParameters::parse(tss,Pv,NULL);
+  }
+
+  MIRAParameters::dumpAllParams(Pv, cout);
+
+  MFA_fout.open(outfile.c_str(), ios::out);
+  if(!MFA_fout){
+    MIRANOTIFY(Notify::FATAL, "Could not open file for saving: " << outfile);
+  }
+
+  try{
+    CAF tcaf(thepool, MFA_clist, &Pv);
+    vector<uint32> dummy;
+    tcaf.load(infile,
+	      Read::SEQTYPE_SANGER,
+	      1,
+	      dummy,
+	      false, 
+	      mirafa::cafload_callback
+      );
+
+    //load(&P, infile, strainin);
+    //
+    //doit();
+    //save(outfile);
+
+  }
+  catch(Notify n){
+    n.handleError("main");
+  }
+  catch(Flow f){
+    cerr << "Unexpected exception: Flow()\n";
+  }
+
+  MFA_fout.close();
+
+  FUNCEND();
+  return 0;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+class tagsnp
+{
+private:
+  static ofstream TS_fout;
+
+  static list<Contig> TS_clist;   // needed for CAF conversion (and GBF)
+
+private:
+  void usage();
+
+
+  static void doit2(list<Contig> & contigs);
+  static void saveCList(list<Contig> & clist, ReadPool & rp);
+  static void cafload_callback(list<Contig> & clist, ReadPool & rp);
+
+public:
+  int main(int argc, char ** argv);
+};
+
+
+list<Contig> tagsnp::TS_clist;
+ofstream tagsnp::TS_fout;
+
+void tagsnp::usage()
+{
+  cerr << "tagsnp\t(MIRALIB version " << MIRALIBVERSION << ")\n\n";
+  cerr << "Usage:\n";
+  cerr << "  tagsnp [-xxx] cafin cafout [optional MIRA settings]\n\n";
+  cerr << "Options:\n";
+  cerr << "\t-n\t\tnuke all existing SNP and RMB tags in file\n";
+//  cerr << "\t-s <filename>\tload strain data from file\n";
+//  cerr << "\t-a\t\tassume SNPs instead of repeats\n";
+//  cerr << "\t-r <int>\tminimum reads per group (default: 1)\n";
+//  cerr << "\t-q <int>\tminimum qual for tagging (default: 30)\n";
+//  cerr << "\t-n <int>\tminimum neighbour qual for tagging (default: 20)\n";
+//  cerr << "\t-e <int>\tend read exclusion area (default: 25)\n";
+//  cerr << "\t-g\t\talso mark gap bases\n";
+//  cerr << "\t-m\t\talso mark multicolumn gap bases\n";
+  
+}
+
+
+//void tagsnp::save(string & cafout)
+//{
+//   
+//  if(!cafout.empty()){
+//    assout::saveAsCAF(contigs,cafout);
+//  } else {
+//    assout::dumpAsCAF(contigs,cout);
+//  }
+//
+//  //
+//  //filename="out.tcs";
+//  //assout::saveAsTCS(contigs,filename);
+//  
+//  //filename="tagsnp_out.gap4da";
+//  //assout::saveAsGAP4DA(contigs,filename);
+//  
+//  //filename="featureanalysis.txt";
+//  //assout::saveFeatureAnalysis(400,100,contigs,readpool,
+//  //				filename,
+//  //				"featuresummary.txt",
+//  //				"featureprot.txt");
+//
+//  //{
+//  //  string filename="out.html";
+//  //  cout << "Saving contigs to htmlfile: " << filename << endl;
+//  //  ofstream out(filename.c_str(), ios::out | ios::trunc);
+//  //  assout::dumpContigListAsHTML(contigs, "Super project", out);
+//  //  out.close();
+//  //}
+//}
+
+//void tagsnp::load (MIRAParameters * mp, string & cafin, string & strainin)
+//{
+//  cerr << "Loading project from CAF file: " << cafin << endl;
+//
+//  CAF tcaf(readpool, contigs, mp);
+//  tcaf.load(cafin);
+//
+//  if(!strainin.empty()){
+//    cerr << "Loading strain data";
+//    readpool.loadStrainData(strainin);
+//  }
+//
+//  Assembly::refreshContigAndReadpoolValuesAfterLoading(readpool,contigs);
+//}
+
+//void tagsnp::doit(list<Contig> & contigs)
+//{
+//  cout << "Tagging reads ..." << endl;
+//  list<Contig>::iterator I=contigs.begin();
+//  for(;I!=contigs.end(); I++){
+//    //I->setParams(&P);
+//    //
+//    //uint32 numSRMB=0;
+//    //uint32 numWRMB=0;
+//    //uint32 numSNP=0;
+//    //I->transposeReadSRMTagsToContig();
+//    ////I->markPossibleRepeats(numSRMB, numWRMB, numSNP);
+//    //vector<bool> readsmarkedsrm;
+//    //I->newMarkPossibleRepeats(numSRMB,readsmarkedsrm);
+//  }
+//}
+
+
+void tagsnp::saveCList(list<Contig> & clist, ReadPool & rp)
+{
+  Contig::setCoutType(Contig::AS_CAF);
+  list<Contig>::iterator I=clist.begin();
+  for(;I!=clist.end(); I++){
+    TS_fout << *I;
+  }
+}
+
+void tagsnp::cafload_callback(list<Contig> & clist, ReadPool & rp)
+{
+  bool dooutput=true;
+
+  Assembly::refreshContigAndReadpoolValuesAfterLoading(rp,clist);
+  clist.back().trashConsensusCache(false);
+
+  doit2(clist);
+  saveCList(clist, rp);
+
+  clist.clear();
+  rp.discard();
+}
+
+void tagsnp::doit2(list<Contig> & contigs)
+{
+  cout << "Tagging reads ..." << endl;
+  list<Contig>::iterator I=contigs.begin();
+  for(;I!=contigs.end(); I++){
+    I->trashConsensusCache(false);
+
+    Contig::repeatmarker_stats_t repstats;
+    vector<bool> readsmarkedsrm;
+    I->newMarkPossibleRepeats(repstats, readsmarkedsrm);
+
+    I->markFeaturesByConsensus(true,true,true);
+  }
+}
+
+
+
+int tagsnp::main(int argc, char ** argv)
+{
+  FUNCSTART("int main(int argc, char ** argv)");
+
+  vector<MIRAParameters> Pv;
+  MIRAParameters::setupStdMIRAParameters(Pv);
+
+  Pv[0].setContigDisregardSpuriousRMBMismatches(false);
+
+  ReadPool thepool(&Pv);
+
+  int c;
+  extern char *optarg;
+  extern int optind;
+
+
+  string cafin="";
+  string strainin="";
+
+  while (1){
+    c = getopt(argc, argv, "+h");
+    if(c == -1) break;
+
+    switch (c) {
+    case 'h': 
+    case '?': {
+      usage();
+      exit(0);
+    }
+    default : {}
+    }
+  }
+
+  if(argc-optind < 2) {
+    cerr << argv[0] << ": " << "Missing at least infile or outfile as argument!\n";
+    usage();
+    exit(1);
+  }
+
+  string infile=argv[optind++];
+  string outfile=argv[optind++];
+
+  if(argc-optind > 0) {
+    stringstream tss;
+    for(int32 i=optind; i<argc; i++) tss << argv[i] << "  *=BEGIN0=*";
+    MIRAParameters::parse(tss,Pv,NULL);
+  }
+
+  MIRAParameters::dumpAllParams(Pv, cout);
+
+  TS_fout.open(outfile.c_str(), ios::out);
+  if(!TS_fout){
+    MIRANOTIFY(Notify::FATAL, "Could not open file for saving: " << outfile);
+  }
+
+  try{
+    vector<uint32> dummy;
+    CAF tcaf(thepool, TS_clist, &Pv);
+    tcaf.load(infile,
+	      Read::SEQTYPE_SANGER,
+	      1,
+	      dummy,
+	      false, 
+	      cafload_callback
+      );
+
+    //load(&P, infile, strainin);
+    //
+    //doit();
+    //save(outfile);
+
+  }
+  catch(Notify n){
+    n.handleError("main");
+  }
+  catch(Flow f){
+    cerr << "Unexpected exception: Flow()\n";
+  }
+
+  TS_fout.close();
+
+  FUNCEND();
+  return 0;
+}
+
+
+
+
+
+
+
+
+class ConvPro 
+{
+private:
+  static vector<MIRAParameters> CP_Pv;
+
+  static string CP_fromtype;
+  static list<string> CP_totype;
+
+  static list<ofstream *> CP_ofs;
+
+
+  static string CP_infile;
+  static string CP_outbasename;
+
+  static string CP_renamesequences;
+
+  static bool CP_splitcontigs2singlefiles;
+
+  static bool CP_deletestaronlycolumns;
+  static bool CP_blinddata;
+  static bool CP_fillholesinstraingenomes;
+  static bool CP_makecontigs;
+  static bool CP_extractreadsinsteadcontigs;
+  static bool CP_hardtrim;
+
+  static bool CP_sortbyname;
+
+  static bool CP_mustdeletetargetfiles;
+
+  static bool CP_specialtestcode;
+
+  static base_quality_t CP_minqual;
+  static char CP_recalcconopt;
+  static char CP_recalcfeatureopt;
+
+  static uint32 CP_minbasecoverage;
+
+  static uint32 CP_mincontiglength;
+  static bool   CP_minlengthisclipped;
+
+  static uint32 CP_mincontigcoverage;
+  static uint32 CP_minnumreads;
+  
+  static list<Contig> CP_clist;   // needed for CAF & MAF conversion (and GBF)
+  static AssemblyInfo CP_assemblyinfo;
+
+  static uint64 CP_readrenamecounter;
+
+private:
+  static void usage();
+  static void checkTypes(const string & fromtype,list<string> & totype);
+  static void putReadsInContigsAndSave(vector<MIRAParameters> & Pv, ReadPool & rp);
+  static void discardShortReads(vector<MIRAParameters> & Pv, ReadPool & rp, uint32 minlength, bool fromclipped);
+  static void specialTestCode(list<Contig> & clist, ReadPool & rp);
+
+  static bool contig__nameordercomp(const Contig & a, const Contig & b);
+  static void sortContigsByName(list<Contig> & clist);
+
+  static void saveContigList(list<Contig> & clist, ReadPool & rp);
+  static void saveContigList_helper(list<Contig> & clist, ReadPool & rp);
+
+  static void saveReadPool(ReadPool & rp, list<ofstream *> & ofs);
+  static void cafmafload_callback(list<Contig> & clist, ReadPool & rp);
+  static void readpoolload_callback(ReadPool & rp);
+  static string createFileNameFromBasePostfixContigAndRead(const string & basename, 
+							   char * postfix, 
+							   Contig * actcon = NULL, 
+							   Read * actread = NULL);
+  static uint32 openOFSlist(Contig * optcontig, list<ofstream *> & ofs);
+  static void closeOFSList(uint32 howmany, list<ofstream *> & ofs);
+
+public:
+  ~ConvPro();
+
+  int main2(int argc, char ** argv);
+
+  static void closeOpenStreams(list<ofstream *> & ofsl);
+};
+
+vector<MIRAParameters> ConvPro::CP_Pv;
+
+string ConvPro::CP_fromtype="caf";
+list<string> ConvPro::CP_totype;
+list<ofstream *> ConvPro::CP_ofs;
+
+string ConvPro::CP_infile;
+string ConvPro::CP_outbasename;
+
+string ConvPro::CP_renamesequences;
+
+bool ConvPro::CP_splitcontigs2singlefiles=false;
+bool ConvPro::CP_deletestaronlycolumns=false;
+bool ConvPro::CP_blinddata=false;
+bool ConvPro::CP_fillholesinstraingenomes=false;
+bool ConvPro::CP_makecontigs=false;
+bool ConvPro::CP_extractreadsinsteadcontigs=false;
+bool ConvPro::CP_hardtrim=false;
+bool ConvPro::CP_sortbyname=false;
+
+bool ConvPro::CP_mustdeletetargetfiles=true;
+
+bool ConvPro::CP_specialtestcode=false;
+
+base_quality_t ConvPro::CP_minqual=0;
+char ConvPro::CP_recalcconopt=' ';
+char ConvPro::CP_recalcfeatureopt=' ';
+
+uint32 ConvPro::CP_minbasecoverage=0;
+
+uint32 ConvPro::CP_mincontiglength=0;
+bool ConvPro::CP_minlengthisclipped=false;
+uint32 ConvPro::CP_mincontigcoverage=1;
+uint32 ConvPro::CP_minnumreads=0;
+
+list<Contig> ConvPro::CP_clist;   // needed for CAF conversion (and GBF)
+AssemblyInfo ConvPro::CP_assemblyinfo;
+
+uint64 ConvPro::CP_readrenamecounter=1;
+
+
+ConvPro::~ConvPro()
+{
+  closeOpenStreams(CP_ofs);
+}
+
+void ConvPro::usage()
+{
+  cout << "convert_project\t(MIRALIB version " << MIRALIBVERSION << ")\n"
+    "Author:  Bastien Chevreux\t(bach at chevreux.org)\n"
+    "Purpose: convert assembly and sequencing file types.\n\n";
+  cout << "Usage:\n"
+    "convert_project [-f <fromtype>] [-t <totype> [-t <totype> ...]]\n"
+    "\t[-aChimMsuZ]\n"
+    "\t[-AcflnNoqrtvxXyz {...}]\n"
+    "\t{infile} {basename_for_outfile(s)}\n\n";
+  cout << "Options:\n";
+  cout << 
+    "\t-f <fromtype>\tload this type of project files, where fromtype is:\n"
+    "\t   caf\t\t a complete assembly or single sequences from CAF\n"
+    "\t   maf\t\t a complete assembly or single sequences from CAF\n"
+    "\t   fasta\t sequences from a FASTA file\n"
+    "\t   fastq\t sequences from a FASTQ file\n"
+    "\t   gbf\t\t sequences from a GBF file\n"
+    "\t   phd\t\t sequences from a PHD file\n"
+    "\t   fofnexp\t sequences in EXP files from file of filenames\n";
+  cout << "\t-t <totype>\twrite the sequences/assembly to this type (multiple\n"
+    "\t\t\tmentions of -t are allowed):\n"
+    "\t   ace\t\t sequences or complete assembly to ACE\n"
+    "\t   caf\t\t sequences or complete assembly to CAF\n"
+    "\t   maf\t\t sequences or complete assembly to MAF\n"
+    "\t   exp\t\t sequences or complete assembly to EXP files in\n"
+    "\t\t\t  directories. Complete assemblies are suited for gap4\n"
+    "\t\t\t  import as directed assembly.\n"
+    "\t   text\t\t complete assembly to text alignment (only when -f is\n"
+    "\t\t\t  caf, maf or gbf)\n"
+    "\t   html\t\t complete assembly to HTML (only when -f is caf, maf or\n"
+    "\t\t\t  gbf)\n"
+    "\t   fasta\t sequences or consensus to FASTA file (qualities to\n"
+    "\t\t\t  .qual)\n"
+    "\t   fastq\t sequences or consensus to FASTQ file\n"
+    "\t   gbf\t\t sequences or consensus to GBF\n"
+    "\t   tcs\t\t complete assembly to tcs\n"
+    "\t   wig\t\t assembly coverage info to wiggle file\n"
+    "\t   hsnp\t\t surrounding of SNP tags (SROc, SAOc, SIOc) to HTML\n"
+    "\t\t\t (only when -f is caf, maf or gbf)\n"
+    "\t   asnp\t\t analysis of SNP tags\n"
+    "\t\t\t (only when -f is caf, maf or gbf)\n"
+    "\t   cstats\t contig statistics file like from MIRA\n"
+    "\t\t\t (only when source contains contigs)\n"
+    "\t   crlist\t contig read list file like from MIRA\n"
+    "\t\t\t (only when source contains contigs)\n"
+    "\t   clippedfasta\t reads clipped to quality and sequencing vector to\n"
+    "\t\t\t FASTA file (qualities to .qual)\n"
+    "\t   maskedfasta\t reads where sequencing vector is masked out\n"
+    "\t\t\t (with X) to FASTA file (qualities to .qual)\n"
+    "\t   scaf\t\t sequences or complete assembly to single sequences CAF\n";
+  
+  cout << "\t-a\t\tAppend to target files instead of rewriting\n";
+
+  cout <<
+    "\t-A <string>\tString with MIRA parameters to be parsed\n"
+    "\t\t\t Useful when setting parameters affecting consensus\n"
+    "\t\t\t calling like -CO:mrpg etc.\n"
+    "\t\t\t E.g.: -a \"454_SETTINGS -CO:mrpg=3\"\n";
+
+  cout << 
+    "\t-b\t\tBlind data\n"
+    "\t\t\t Replaces all bases in reads/contigs with a 'c'\n";
+
+  cout << "\t-C\t\tPerform hard clip to reads\n"
+    "\t\t\t When reading formats which define clipping points, will\n"
+    "\t\t\t  save only the unclipped part into the result file.\n"
+    "\t\t\t Applies only to files/formats which do not contain\n"
+    "\t\t\t  contigs.\n";
+
+  cout << 
+    "\t-d\t\t'Delete gap only columns'\n"
+    "\t\t\t When output is contigs: delete columns that are\n"
+    "\t\t\t  entirely gaps (like after having delete reads during\n"
+    "\t\t\t  editing in gap4 or similar)\n"
+    "\t\t\t When output is reads: delete gaps in reads\n";
+
+  cout << 
+    "\t-m\t\tMake contigs (only for -t = caf or maf)\n"
+    "\t\t\t Encase single reads as contig singlets into the CAF/MAF\n"
+    "\t\t\t file.\n";
+  cout << 
+    "\t-n <filename>\twhen given, selects only reads or contigs given by\n"
+    "\t\t\t name in that file.\n";
+//  cout << "\t-i\t\twhen -n is used, inverts the selection\n";
+  cout << 
+    "\t-o\t\tfastq quality Offset (only for -f = 'fastq')\n"
+    "\t\t\t Offset of quality values in FASTQ file. Default of 0\n"
+    "\t\t\t tries to automatically recognise.\n";
+
+  cout << 
+    "\t-R <name>\tRename contigs/singlets/reads with given name string\n"
+    "\t\t\t to which a counter is appended.\n"
+    "\t\t\t Known bug: will create duplicate names if input\n"
+    "\t\t\t  contains contigs/singlets as well as free reads, i.e.\n"
+    "\t\t\t  reads not in contigs nor singlets.\n";
+
+  // TODO: re-adapt these switches to >2.9.8
+//  cout << "\t-s <filename>\twhen loading assemblies from files that do not contain\n";
+//  cout << "\t\t\t strain information (e.g. CAF), load the strain\n";
+//  cout << "\t\t\t information from this file. (2 columns, tab delimited:\n";
+//  cout << "\t\t\t readname left, strain name right)\n";
+//
+
+//
+
+  cout << 
+    "\n\t--------------------------------------------------------\n"
+    "\tThe following switches work only when input (CAF or MAF)\n"
+    "\tcontains contigs. Beware: CAF and MAf can also contain\n"
+    "\tjust reads.\n"
+    "\t--------------------------------------------------------\n\n";
+
+  // TODO: check if ok for >2.9.8
+  cout << 
+    "\t-M\t\tDo not extract contigs (or their consensus), but the\n"
+    "\t\t\t  sequence of the reads they are composed of.\n";
+  cout << 
+    "\t-N <filename>\tlike -n, but sorts output according to order given\n"
+    "\t\t\t in file. (works currently only for contigs)\n";
+  cout << 
+    "\t-r [cCqf]\tRecalculate consensus and / or consensus quality values\n"
+    "\t\t\t and / or SNP feature tags.\n"
+    "\t\t\t 'c' recalc cons & cons qualities (with IUPAC)\n"
+    "\t\t\t 'C' recalc cons & cons qualities (forcing non-IUPAC)\n"
+    "\t\t\t 'q' recalc consensus qualities only\n"
+    "\t\t\t 'f' recalc SNP features\n"
+    "\t\t\t Note: only the last of cCq is relevant, f works as a\n"
+    "\t\t\t  switch and can be combined with cQq (e.g. \"-r C -r f\")\n"
+    "\t\t\t Note: if the CAF/MAF contains multiple strains,\n"
+    "\t\t\t recalculation of cons & cons qualities is forced, you\n"
+    "\t\t\t  can just influence whether IUPACs are used or not.\n";
+  cout << 
+    "\t-s\t\tsplit output into multiple files instead of creating a\n"
+    "\t\t\t single file\n";
+  cout << 
+    "\t-u\t\t'fillUp strain genomes'\n"
+    "\t\t\t Fill holes in the genome of one strain (N or @)\n"
+    "\t\t\t with sequence from a consensus of other strains\n"
+    "\t\t\t Takes effect only with -r and -t gbf or fasta/q\n"
+    "\t\t\t in FASTA/Q: bases filled up are in lower case\n"
+    "\t\t\t in GBF: bases filled up are in upper case\n";
+
+  cout << 
+    "\t-q <integer>\tDefines minimum quality a consensus base of a strain\n"
+    "\t\t\t must have, consensus bases below this will be 'N'\n"
+    "\t\t\t Default: 0\n"
+    "\t\t\t Only used with -r, and -f is caf/maf and -t is (fasta\n"
+    "\t\t\t  or gbf)\n";
+  cout << 
+    "\t-v <integer>\tDefines minimum coverage a consensus base of a strain\n"
+    "\t\t\t must have, bases with coverage below this will be 'N'\n"
+    "\t\t\t Default: 0\n"
+    "\t\t\t Only used with -r, and -t is (fasta\n"
+    "\t\t\t  or gbf)\n";
+
+  cout << 
+    "\t-x <integer>\tMinimum contig or read length\n"
+    "\t\t\t When loading, discard all contigs / reads with a\n"
+    "\t\t\t length less than this value. Default: 0 (=switched off)\n"
+    "\t\t\t Note: not applied to reads in contigs!\n";
+  cout << 
+    "\t-X <integer>\tSimilar to -x but applies only to reads and\n"
+    "\t\t\t then to the clipped length.\n";
+
+  cout << 
+    "\t-y <integer>\tMinimum average contig coverage\n"
+    "\t\t\t When loading, discard all contigs with an\n"
+    "\t\t\t average coverage less than this value.\n"
+    "\t\t\t Default: 1\n";
+
+  cout << 
+    "\t-z <integer>\tMinimum number of reads in contig\n"
+    "\t\t\t When loading, discard all contigs with a\n"
+    "\t\t\t number of reads less than this value.\n"
+    "\t\t\t Default: 0 (=switched off)\n";
+
+
+  cout << 
+    "\t-l <integer>\twhen output as text or HTML: number of bases shown in\n"
+    "\t\t\t one alignment line. Default: 60.\n"
+    "\t-c <character>\twhen output as text or HTML: character used to pad\n"
+    "\t\t\t endgaps. Default: ' ' (blank)\n";
+
+  cout << "\nAliases:\n"
+    "caf2html, exp2fasta, ... etc. Any combination of \"<validfromtype>2<validtotype>\"\ncan be used as program name (also using links) so as that convert_project\nautomatically sets -f and -t accordingly.\n";
+
+  cout << "\nExamples:\n"
+    "\tconvert_project -f caf -t fasta -t wig -t ace source.caf dest\n"
+    "\tconvert_project -f caf -t caf -x 2000 -y 10 source.caf dest\n"
+    "\tcaf2html -l 100 -c . source.caf dest\n";
+}
+
+
+void ConvPro::checkTypes(const string & fromtype,list<string> & totype)
+{
+  if(!(fromtype=="caf"
+       || fromtype=="maf"
+       || fromtype=="phd"
+       || fromtype=="gbf"
+       || fromtype=="fasta"
+       || fromtype=="fastq"
+       || fromtype=="fofnexp"
+       )){
+    usage();
+    cout << endl;
+    cerr << "Unknown or illegal file type '" << fromtype << "' defined as <fromtype>\n";
+    exit(1);
+  }
+  if(CP_totype.empty()){
+    CP_totype.push_back(fromtype);
+  }
+  for(list<string>::iterator ttI= CP_totype.begin(); ttI!=CP_totype.end(); ++ttI){
+    if(!(*ttI=="fasta"
+	 || *ttI=="fastq"
+	 || *ttI=="clippedfasta"
+	 || *ttI=="maskedfasta"
+	 || *ttI=="caf"
+	 || *ttI=="maf"
+	 || *ttI=="ace"
+	 || *ttI=="scaf"
+	 || *ttI=="exp"
+	 || *ttI=="gbf"
+	 || *ttI=="tcs"
+	 || *ttI=="text"
+	 || *ttI=="txt"
+	 || *ttI=="html"
+	 || *ttI=="wiggle"
+	 || *ttI=="wig"
+	 || *ttI=="asnp"
+	 || *ttI=="hsnp"
+	 || *ttI=="cstats"
+	 || *ttI=="crlist"
+	 )){
+      usage();
+      cout << endl;
+      cerr << "Unknown or illegal file type '" << *ttI << "' defined as <totype>\n";
+      exit(1);
+    }
+    //if(*ttI=="html"){
+    //  cerr << "SORRY: HTML output is currently de-activated\n";
+    //  exit(1);
+    //}
+  }
+
+}
+
+
+
+
+void ConvPro::specialTestCode(list<Contig> & clist, ReadPool & rp)
+{
+  list<Contig>::iterator I=clist.begin();
+  for(;I!=clist.end(); I++){
+
+    vector<bool> readsmarkedsrm;
+    if(1){
+      cout << "\nMarking tricky 454 / Solexa overcalls in temporary contig.\n";
+      cout << "Marked " << I->editTrickyOvercalls(true,false,readsmarkedsrm) << " reads.\n";
+      bool newreptmarked=Assembly::markRepeats(*I, readsmarkedsrm);
+    }
+    I->markFeaturesByConsensus(true,true,true);
+    I->editSingleDiscrepancyNoHAFTag(readsmarkedsrm);
+
+  }
+}
+
+
+
+void ConvPro::putReadsInContigsAndSave(vector<MIRAParameters> & Pv, ReadPool & rp)
+{
+  for(uint32 i=0; i<rp.size(); i++) {
+    if(!rp[i].hasQuality()
+       && Pv[0].getAssemblyParams().as_backbone_basequals>0) {
+      rp[i].setQualities(Pv[0].getAssemblyParams().as_backbone_basequals);
+    }
+    
+    Contig con(&Pv, rp);
+    CP_clist.push_back(con);
+    CP_clist.back().addFirstRead(i,1);    
+    saveContigList_helper(CP_clist, rp);
+    CP_clist.clear();
+  }
+}
+
+void ConvPro::discardShortReads(vector<MIRAParameters> & Pv, ReadPool & rp, uint32 minlength, bool fromclipped)
+{
+  for(uint32 i=0; i<rp.size(); i++) {
+    uint32 len;
+    if(fromclipped){
+      len=rp[i].getLenClippedSeq();
+    }else{
+      len=rp[i].getLenSeq();
+    }
+    if(len<minlength) rp[i].discard();
+  }
+}
+
+
+
+//string ConvPro::createFileNameFromBasePostfixContigAndRead(const string & basename, string & postfix, Contig * actcon, Read * actread)
+string ConvPro::createFileNameFromBasePostfixContigAndRead(const string & basename, char * postfix, Contig * actcon, Read * actread)
+{
+  string filename=basename;
+  if(actcon != NULL){
+    if(!filename.empty()) filename+='_';
+    filename+=actcon->getContigName();
+  }else if(actread != NULL){
+    if(!filename.empty()) filename+='_';
+    filename+=actread->getName();
+  }
+  filename+=postfix;
+  return filename;
+}
+
+
+bool ConvPro::contig__nameordercomp(const Contig & a, const Contig & b)
+{
+  return General::getNameOrder(a.getContigName()) < General::getNameOrder(b.getContigName());
+}
+
+
+void ConvPro::sortContigsByName(list<Contig> & clist)
+{
+  clist.sort(contig__nameordercomp);
+}
+
+
+void ConvPro::saveContigList_helper(list<Contig> & clist, ReadPool & rp)
+{
+  FUNCSTART("void ConvPro::saveContigList_helper(list<Contig> & clist, ReadPool & rp)");
+
+  if(CP_specialtestcode) specialTestCode(clist,rp);
+
+  //{
+  //  cout << "CLISTSIZE: " << clist.size() << endl;
+  //  list<Contig>::iterator cI=clist.begin();
+  //  for(; cI != clist.end(); cI++){
+  //    cout << "cname: " << cI->getContigName() << endl;
+  //  }
+  //}
+
+  BUGIFTHROW(!CP_ofs.empty() && CP_ofs.size() != CP_totype.size(), "Ooops? !CP_ofs.empty() && CP_ofs.size() != CP_totype.size() ???");
+
+  list<ofstream *>::iterator ofsI= CP_ofs.begin();
+  list<string>::iterator ttI= CP_totype.begin();
+  for(; ttI!=CP_totype.end(); ++ttI, ++ofsI){
+    if(*ttI=="scaf"){
+      //clear_conandrp=false;
+    }else if(*ttI=="hsnp"){
+      MIRAParameters::generateProjectOutNames(CP_Pv,CP_outbasename);
+      string fn;
+      if(CP_splitcontigs2singlefiles){
+	fn=createFileNameFromBasePostfixContigAndRead(
+	  CP_Pv[0].getAssemblyParams().as_outfile_stats_snpenvironment,
+	  ".html",
+	  &clist.front());
+      }else{
+	fn=createFileNameFromBasePostfixContigAndRead(
+	  CP_Pv[0].getAssemblyParams().as_outfile_stats_snpenvironment,
+	  ".html");
+      }
+      assout::saveSNPSurroundingAsHTML(clist,fn,CP_mustdeletetargetfiles);
+    }else if(*ttI=="cstats"){
+      MIRAParameters::generateProjectOutNames(CP_Pv,CP_outbasename);
+      string fn;
+      if(CP_splitcontigs2singlefiles){
+	fn=createFileNameFromBasePostfixContigAndRead(
+	  CP_Pv[0].getAssemblyParams().as_outfile_stats_contigstats,
+	  ".txt",
+	  &clist.front());
+      }else{
+	fn=createFileNameFromBasePostfixContigAndRead(
+	  CP_Pv[0].getAssemblyParams().as_outfile_stats_contigstats,
+	  ".txt");
+      }
+      assout::saveStatistics(clist,fn,CP_mustdeletetargetfiles);
+    }else if(*ttI=="crlist"){
+      MIRAParameters::generateProjectOutNames(CP_Pv,CP_outbasename);
+      string fn;
+      if(CP_splitcontigs2singlefiles){
+	fn=createFileNameFromBasePostfixContigAndRead(
+	  CP_Pv[0].getAssemblyParams().as_outfile_stats_crlist,
+	  ".txt",
+	  &clist.front());
+      }else{
+	fn=createFileNameFromBasePostfixContigAndRead(
+	  CP_Pv[0].getAssemblyParams().as_outfile_stats_crlist,
+	  ".txt");
+      }
+      assout::saveContigReadList(clist,fn,CP_mustdeletetargetfiles);
+    }else if(*ttI=="asnp"){
+      MIRAParameters::generateProjectOutNames(CP_Pv,CP_outbasename);
+      string fn,fa,fs,fc;
+
+      if(CP_splitcontigs2singlefiles){
+	fn=createFileNameFromBasePostfixContigAndRead(
+	  CP_Pv[0].getAssemblyParams().as_outfile_stats_snpanalysis,
+	  ".txt",
+	  &clist.front());
+	fa=createFileNameFromBasePostfixContigAndRead(
+	  CP_Pv[0].getAssemblyParams().as_outfile_stats_featureanalysis,
+	  ".txt",
+	  &clist.front());
+	fs=createFileNameFromBasePostfixContigAndRead(
+	  CP_Pv[0].getAssemblyParams().as_outfile_stats_featuresummary,
+	  ".txt",
+	  &clist.front());
+	fc=createFileNameFromBasePostfixContigAndRead(
+	  CP_Pv[0].getAssemblyParams().as_outfile_stats_featuresequences,
+	  ".txt",
+	  &clist.front());
+      }else{
+	fn=createFileNameFromBasePostfixContigAndRead(
+	  CP_Pv[0].getAssemblyParams().as_outfile_stats_snpanalysis,
+	  ".txt");
+	fa=createFileNameFromBasePostfixContigAndRead(
+	  CP_Pv[0].getAssemblyParams().as_outfile_stats_featureanalysis,
+	  ".txt");
+	fs=createFileNameFromBasePostfixContigAndRead(
+	  CP_Pv[0].getAssemblyParams().as_outfile_stats_featuresummary,
+	  ".txt");
+	fc=createFileNameFromBasePostfixContigAndRead(
+	  CP_Pv[0].getAssemblyParams().as_outfile_stats_featuresequences,
+	  ".txt");
+      }
+
+      assout::saveSNPList(clist,fn,CP_mustdeletetargetfiles);
+      assout::saveFeatureAnalysis(clist,rp,
+				  fa,fs,fc,
+				  CP_mustdeletetargetfiles);
+
+    }else if(*ttI=="fasta"){
+      //CALLGRIND_START_INSTRUMENTATION;
+      string bn;
+      if(CP_splitcontigs2singlefiles){
+	bn=createFileNameFromBasePostfixContigAndRead(
+	  CP_outbasename,
+	  "",
+	  &clist.front());
+      }else{
+	bn=createFileNameFromBasePostfixContigAndRead(
+	  CP_outbasename,
+	  "");
+      }
+      assout::saveStrainsAsFASTAQ(clist, 
+				  rp,
+				  bn,
+				  false,
+				  CP_minbasecoverage,
+				  CP_minqual,
+				  CP_mustdeletetargetfiles,
+				  CP_fillholesinstraingenomes);
+    }else if(*ttI=="fastaqual"){
+      // fastaqual is "do-nothing" as "fasta" also write fastaqual here! 
+    }else if(*ttI=="fastq"){
+      //CALLGRIND_START_INSTRUMENTATION;
+      string bn;
+      if(CP_splitcontigs2singlefiles){
+	bn=createFileNameFromBasePostfixContigAndRead(
+	  CP_outbasename,
+	  "",
+	  &clist.front());
+      }else{
+	bn=createFileNameFromBasePostfixContigAndRead(
+	  CP_outbasename,
+	  "");
+      }
+      assout::saveStrainsAsFASTAQ(clist, 
+				  rp, 
+				  bn,
+				  true,
+				  CP_minbasecoverage,
+				  CP_minqual,
+				  CP_mustdeletetargetfiles,
+				  CP_fillholesinstraingenomes);
+    } else if(*ttI=="caf"){
+      Contig::setCoutType(Contig::AS_CAF);
+      list<Contig>::iterator I=clist.begin();
+      for(;I!=clist.end(); I++){
+	if(CP_recalcfeatureopt=='f') I->markFeaturesByConsensus(true,true,true);
+	if(CP_recalcfeatureopt=='r') {
+	  vector<bool> dummy;
+	  Assembly::markRepeats(*I,dummy);
+	}
+	bool mustclose=false;
+	if(!(*ofsI)->is_open()){
+	  string bn;
+	  if(CP_splitcontigs2singlefiles){
+	    bn=createFileNameFromBasePostfixContigAndRead(
+	      CP_outbasename,
+	      ".caf",
+	      &clist.front());
+	  }else{
+	    bn=createFileNameFromBasePostfixContigAndRead(
+	      CP_outbasename,
+	      ".caf",
+	      NULL);
+	  }
+	  (*ofsI)->open(bn.c_str(), ios::out);
+	  mustclose=true;
+	}
+	*(*ofsI) << *I;
+	if(mustclose){
+	  (*ofsI)->close();
+	}
+      }
+    } else if(*ttI=="maf"){
+      Contig::setCoutType(Contig::AS_MAF);
+      list<Contig>::iterator I=clist.begin();
+      for(;I!=clist.end(); I++){
+	if(CP_recalcfeatureopt=='f') I->markFeaturesByConsensus(true,true,true);
+	if(CP_recalcfeatureopt=='r') {
+	  vector<bool> dummy;
+	  Assembly::markRepeats(*I,dummy);
+	}
+	if(!(*ofsI)->is_open()){
+	  string bn;
+	  if(CP_splitcontigs2singlefiles){
+	    bn=createFileNameFromBasePostfixContigAndRead(
+	      CP_outbasename,
+	      ".maf",
+	      &clist.front());
+	  }else{
+	    bn=createFileNameFromBasePostfixContigAndRead(
+	      CP_outbasename,
+	      ".maf",
+	      NULL);
+	  }
+	  (*ofsI)->open(bn.c_str(), ios::out);
+	}
+	*(*ofsI) << *I;
+	if(CP_splitcontigs2singlefiles){
+	  (*ofsI)->close();
+	}
+      }
+    } else if(*ttI=="html"){
+      //cerr << "HTML output currently deactivated in development version!\n";
+      //exit(1);
+      string bn;
+      if(CP_splitcontigs2singlefiles){
+	bn=createFileNameFromBasePostfixContigAndRead(
+	  CP_outbasename,
+	  ".html",
+	  &clist.front());
+      }else{
+	bn=createFileNameFromBasePostfixContigAndRead(
+	  CP_outbasename,
+	  ".html");
+      }
+      assout::dumpContigListAsHTML(clist, bn, CP_mustdeletetargetfiles, CP_outbasename);
+    } else if(*ttI=="text"
+	      || *ttI=="txt"){
+      string bn;
+      if(CP_splitcontigs2singlefiles){
+	bn=createFileNameFromBasePostfixContigAndRead(
+	  CP_outbasename,
+	  ".txt",
+	  &clist.front());
+      }else{
+	bn=createFileNameFromBasePostfixContigAndRead(
+	  CP_outbasename,
+	  ".txt");
+      }
+      assout::saveAsTXT(clist, bn, CP_mustdeletetargetfiles);
+    } else if(*ttI=="exp"){
+      // outbasename is in this case a directory name
+      string bn;
+      if(CP_splitcontigs2singlefiles){
+	bn=createFileNameFromBasePostfixContigAndRead(
+	  CP_outbasename,
+	  "",
+	  &clist.front());
+      }else{
+	bn=createFileNameFromBasePostfixContigAndRead(
+	  CP_outbasename,
+	  "");
+      }
+      assout::saveAsGAP4DA(clist,bn,CP_mustdeletetargetfiles);
+    } else if(*ttI=="gbf"){
+      // outbasename is in this case the basename name
+      string bn;
+      if(CP_splitcontigs2singlefiles){
+	bn=createFileNameFromBasePostfixContigAndRead(
+	  CP_outbasename,
+	  "",
+	  &clist.front());
+      }else{
+	bn=createFileNameFromBasePostfixContigAndRead(
+	  CP_outbasename,
+	  "");
+      }
+      assout::saveStrainsAsGBF(clist,
+			       rp,
+			       bn,
+			       CP_minqual,
+			       CP_fillholesinstraingenomes,
+			       CP_mustdeletetargetfiles);
+    } else if(*ttI=="ace"){
+      // outbasename is in this case the basename name
+      string bn;
+      if(CP_splitcontigs2singlefiles){
+	bn=createFileNameFromBasePostfixContigAndRead(
+	  CP_outbasename,
+	  ".ace",
+	  &clist.front());
+      }else{
+	bn=createFileNameFromBasePostfixContigAndRead(
+	  CP_outbasename,
+	  ".ace");
+      }
+      assout::saveAsACE(clist,bn,CP_mustdeletetargetfiles);
+    } else if(*ttI=="tcs"){
+      // outbasename is in this case the basename name
+      string bn;
+      if(CP_splitcontigs2singlefiles){
+	bn=createFileNameFromBasePostfixContigAndRead(
+	  CP_outbasename,
+	  ".tcs",
+	  &clist.front());
+      }else{
+	bn=createFileNameFromBasePostfixContigAndRead(
+	  CP_outbasename,
+	  ".tcs");
+      }
+      assout::saveAsTCS(clist,bn,CP_mustdeletetargetfiles);
+    } else if(*ttI=="wiggle" || *ttI=="wig"){
+      // outbasename is in this case the basename name
+      string bn;
+      if(CP_splitcontigs2singlefiles){
+	bn=createFileNameFromBasePostfixContigAndRead(
+	  CP_outbasename,
+	  ".wig",
+	  &clist.front());
+      }else{
+	bn=createFileNameFromBasePostfixContigAndRead(
+	  CP_outbasename,
+	  ".wig");
+      }
+      assout::saveAsWiggle(clist,bn,CP_mustdeletetargetfiles);
+    } else {
+      cerr << "\n\n-t " << *ttI << " is not a valid 'to' type when converting contigs (sorry). But maybe something went wrong, please contact the author.\n";
+      exit(1);
+    }
+  }
+
+  if(!CP_splitcontigs2singlefiles){
+    CP_mustdeletetargetfiles=false;
+  }
+
+  FUNCEND();
+}
+
+void ConvPro::saveContigList(list<Contig> & clist, ReadPool & rp)
+{
+  bool dosomeoutput=false;
+
+  list<Contig>::iterator cI=clist.begin();
+  for(; cI != clist.end(); cI++){
+    bool conout=true;
+    
+    if(CP_mincontiglength>0
+       && cI->getContigLength() < CP_mincontiglength){
+      conout=false;
+    } else {
+      Contig::constats_t constats(cI->getStats());
+      
+      //cI->stats(cout);
+      
+      if(CP_mincontigcoverage>0
+	 && constats.avg_coverage < CP_mincontigcoverage){
+	conout=false;
+      } else if(CP_minnumreads>0
+		&& constats.total_reads < CP_minnumreads){
+	conout=false;
+      } 
+    }
+
+    if(conout){
+      string cname(cI->getContigName());
+      if(!General::checkNamePresence(cname)){
+	conout=false;
+      }
+    }
+
+    // delete contigs which should not be output
+    // TODO:
+    //  would generally be better to have that in some loading callback (and
+    //  would work for contigs well enough), but readpool mechanisms would
+    //  not at the moment, too primitive
+    if(!conout){
+      cI=clist.erase(cI);
+      if(cI != clist.begin()) --cI;
+    }
+
+    dosomeoutput|=conout;
+  }
+
+  if(dosomeoutput){
+    for(cI=clist.begin(); cI != clist.end(); cI++){
+      if(CP_deletestaronlycolumns) {
+	cI->deleteStarOnlyColumns(0,cI->getContigLength());
+      }
+      if(CP_blinddata){
+	cI->blindContig();
+      }
+    }
+
+    Assembly::refreshContigAndReadpoolValuesAfterLoading(rp,clist);
+    
+    // TODO: ! make autoconfigure: on several strains, this is needed!
+    //  else, let user define via switch
+    for(cI=clist.begin(); cI != clist.end(); cI++){
+      if(CP_recalcconopt=='c'
+	 || CP_recalcconopt=='C'){
+	cI->trashConsensusCache(false);
+      }
+      if(CP_recalcconopt=='q'){
+	cI->trashConsensusCache(true);
+      }
+      
+      CP_assemblyinfo.storeContigStats(cI->getStats());
+    }
+
+    saveContigList_helper(CP_clist, rp);
+  }
+
+}
+
+void ConvPro::saveReadPool(ReadPool & rp, list<ofstream *> & ofs)
+{
+  FUNCSTART("void ConvPro::saveReadPool(ReadPool & rp, list<ofstream *> & ofs)");
+
+  if(CP_deletestaronlycolumns) {
+    for(uint32 i=0; i<rp.size(); i++) {
+      rp.getRead(i).removeGapsFromRead();
+    }
+  }
+  if(CP_blinddata) {
+    for(uint32 i=0; i<rp.size(); i++) {
+      rp.getRead(i).blindSeqData('c');
+    }
+  }
+  if(General::hasNames()){
+    for(uint32 i=0; i<rp.size(); i++) {
+      string rname(rp[i].getName());
+      if(!General::checkNamePresence(rname)){
+	rp[i].discard();
+      }
+    }	
+  }
+  if(CP_hardtrim){
+    for(uint32 i=0; i<rp.size(); ++i) {
+      rp[i].performHardTrim();
+    }
+  }
+  if(CP_mincontiglength>0){
+    discardShortReads(CP_Pv,rp,CP_mincontiglength,CP_minlengthisclipped);
+  }
+
+  if(!CP_renamesequences.empty()){
+    string tmpname;
+    for(uint32 i=0; i<rp.size(); ++i){
+      tmpname=CP_renamesequences+"_"+boost::lexical_cast<std::string>(CP_readrenamecounter++);
+      rp[i].setName(tmpname);
+    }
+  }
+
+  if(CP_makecontigs) {
+    putReadsInContigsAndSave(CP_Pv, rp);
+  }else{
+    list<string>::iterator ttI= CP_totype.begin();
+    list<ofstream *>::iterator ofsI= ofs.begin();
+    for(; ttI!=CP_totype.end(); ++ttI, ++ofsI){
+      BUGIFTHROW(!(*(*ofsI)).is_open(), *ttI << " file stream not open???");
+      if(*ttI=="fasta"){
+	// double indirection because iterator needs one and it is a list of ofstream pointers ...
+	rp.dumpAs(*(*ofsI),Read::AS_FASTA,false);
+      } else if(*ttI=="fastaqual"){
+	rp.dumpAs(*(*ofsI),Read::AS_FASTAQUAL,false);
+      } else if(*ttI=="maskedfasta"){
+	rp.dumpAs(*(*ofsI),Read::AS_MASKEDMASKFASTA,false);
+      } else if(*ttI=="maskedfastaqual"){
+	rp.dumpAs(*(*ofsI),Read::AS_MASKEDMASKFASTAQUAL,false);
+      } else if(*ttI=="fastq"){
+	rp.dumpAs(*(*ofsI),Read::AS_FASTQ,false);
+      } else if(*ttI=="caf" || *ttI=="scaf" ){
+	rp.dumpAs(*(*ofsI),Read::AS_CAF,false);
+      } else if(*ttI=="maf"){
+	rp.dumpAs(*(*ofsI),Read::AS_MAF,false);
+      } else {
+	cout.flush();
+	cerr << "\n\n-t " << *ttI << " is not a valid type for saving a readpool (internal)!\n";
+	//usage();
+	exit(1);
+      }
+    }
+  }
+
+  FUNCEND();
+}
+
+uint32 ConvPro::openOFSlist(Contig * optcontig, list<ofstream *> & ofs)
+{
+  FUNCSTART("uint32 ConvPro::openOFSlist(Contig * optcontig, list<ofstream *> & ofs)");
+  BUGIFTHROW(CP_totype.empty(), " CP_totype.empty() ???");
+
+  uint32 mustclose=0;
+  ofstream * ofstmp;
+
+  for(list<string>::iterator ttI= CP_totype.begin(); ttI!=CP_totype.end(); ++ttI){
+    ofstmp=new ofstream;
+    ofs.push_back(ofstmp);
+    if(*ttI=="fasta"){
+      ofs.back()->open(createFileNameFromBasePostfixContigAndRead(CP_outbasename,".fasta",optcontig).c_str(), ios::out);
+      ++mustclose;
+    } else if(*ttI=="fastaqual"){
+      ofs.back()->open(createFileNameFromBasePostfixContigAndRead(CP_outbasename,".fasta.qual",optcontig).c_str(), ios::out);
+      ++mustclose;
+    } else if(*ttI=="maskedfasta"){
+      ofs.back()->open(createFileNameFromBasePostfixContigAndRead(CP_outbasename,".fasta",optcontig).c_str(), ios::out);
+      ++mustclose;
+    } else if(*ttI=="maskedfastaqual"){
+      ofs.back()->open(createFileNameFromBasePostfixContigAndRead(CP_outbasename,".fasta.qual",optcontig).c_str(), ios::out);
+      ++mustclose;
+    } else if(*ttI=="fastq"){
+      ofs.back()->open(createFileNameFromBasePostfixContigAndRead(CP_outbasename,".fastq",optcontig).c_str(), ios::out);
+      ++mustclose;
+	} else if(*ttI=="caf" || *ttI=="scaf" ){
+      ofs.back()->open(createFileNameFromBasePostfixContigAndRead(CP_outbasename,".caf",optcontig).c_str(), ios::out);
+      ++mustclose;
+    } else if(*ttI=="maf"){
+      ofs.back()->open(createFileNameFromBasePostfixContigAndRead(CP_outbasename,".maf",optcontig).c_str(), ios::out);
+      ++mustclose;
+    }
+  }
+  return mustclose;
+}
+
+void ConvPro::closeOFSList(uint32 howmany, list<ofstream *> & ofs)
+{
+  FUNCSTART("uint32 ConvPro::closeOFSList(uint32 howmany)");
+  BUGIFTHROW(howmany>ofs.size(),"howmany>ofs.size() ???");
+  for(uint32 i=0; i<howmany; ++i){
+    delete ofs.back();
+    ofs.pop_back();
+  }
+  FUNCEND();
+}
+
+
+void ConvPro::cafmafload_callback(list<Contig> & clist, ReadPool & rp)
+{
+  {
+    list<Contig>::iterator cI=clist.begin();
+    for(; cI != clist.end(); ++cI){
+      if(!CP_renamesequences.empty()){
+	cI->setContigName("");
+	cI->setContigNamePrefix(CP_renamesequences);
+      }
+    }
+  }
+  if(!clist.empty() && !CP_extractreadsinsteadcontigs){
+    saveContigList(clist,rp);
+  }else{
+    list<ofstream *> ofs;
+    uint32 mustclose=0;
+    if(CP_splitcontigs2singlefiles && !clist.empty()){
+      mustclose=openOFSlist(&clist.front(),ofs);
+      saveReadPool(rp,ofs);
+    }else{
+      saveReadPool(rp,CP_ofs);
+    }
+    closeOFSList(mustclose,ofs);
+  }
+
+  Read::trashReadNameContainer();
+  clist.clear();
+  rp.discard();
+}
+
+void ConvPro::readpoolload_callback(ReadPool & rp)
+{
+  // TODO: check if needed (slows loading by ~30 to 50%
+//  rp.makeTemplateIDs(false);
+//  rp.makeStrainIDs(false);
+
+  saveReadPool(rp,CP_ofs);
+
+  Read::trashReadNameContainer();
+  rp.discard();
+}
+
+
+void ConvPro::closeOpenStreams(list<ofstream *> & ofsl)
+{
+  list<ofstream *>::iterator ofsI= ofsl.begin();
+  for(; ofsI!=ofsl.end(); ++ofsI){
+    delete *ofsI;
+  }
+}
+
+int ConvPro::main2(int argc, char ** argv)
+{
+  //CALLGRIND_STOP_INSTRUMENTATION;
+
+  FUNCSTART("int main2(int argc, char ** argv)");
+
+  int c;
+  extern char *optarg;
+  extern int optind;
+
+  base_quality_t fqqualoffset=0;
+
+  string strainfile="";
+
+  int32 linelen=60;
+  char  endgap_fillchar=' ';
+
+  string namefile="";
+  bool keepnamesfromfile=true;
+
+  string path;
+  string convertprog;
+  splitFullPathAndFileName(argv[0],path,convertprog);
+
+  {
+    std::transform(convertprog.begin(),
+		   convertprog.end(),
+		   convertprog.begin(), 
+		   (int(*)(int))std::tolower); // now, that's what I call ugly
+    string sep="2";
+    string::size_type seppos=string::npos;
+    seppos=convertprog.find_first_of(sep,0);
+    if(seppos!=string::npos){
+      CP_fromtype=convertprog.substr(0, seppos);
+      CP_totype.push_back(convertprog.substr(seppos+1,100));
+    }
+  }
+
+  string miraparams;
+
+  //"CZihumMsl:r:c:f:t:s:q:n:N:v:x:X:y:z:o:a:"
+  const char pstring[]=
+    "abCdhimMsuZ"
+    "A:c:f:l:n:N:o:q:r:R:t:v:x:X:y:z:";
+
+  while (1){
+    c = getopt(argc, argv, pstring);
+    if(c == -1) break;
+
+    switch (c) {
+    case 'a': {
+      CP_mustdeletetargetfiles=false;
+      break;
+    }
+    case 'A': {
+      miraparams=optarg;
+      break;
+    }
+    case 'C': {
+      CP_hardtrim=true;
+      break;
+    }
+    case 'f': {
+      CP_fromtype=optarg;
+      break;
+    }
+    case 't': {
+      CP_totype.push_back(optarg);
+      break;
+    }
+    case 's': {
+      CP_splitcontigs2singlefiles=true;
+      break;
+    }
+    case 'r': {
+      string rrr=optarg;
+      for(size_t si=0; si<rrr.size(); si++){
+	switch(rrr[si]){
+	case 'c' :
+	case 'C' :
+	case 'q' : {
+	  CP_recalcconopt=rrr[si];
+	  break;
+	}
+	case 'f' : 
+	case 'r' : {
+	  CP_recalcfeatureopt=rrr[si];
+	  break;
+	}
+	default : {
+	  cerr << "ERROR: -r must be one of c, C, q, f, r\n";
+	  usage();	
+	  exit(1);	
+	}
+	}
+      }
+      break;
+    }
+    case 'R': {
+      CP_renamesequences=optarg;
+      break;
+    }
+    case 'c': {
+      string egfc=optarg;
+      if(egfc.size()!=1){
+	usage();
+	cout << endl;
+	cerr << "ERROR: -c must be a single character\n";
+	exit(1);	
+      }
+      endgap_fillchar=egfc[0];
+      break;
+    }
+    case 'q': {
+      CP_minqual=atoi(optarg);
+      if(CP_minqual >100) {
+	usage();
+	cout << endl;
+	cerr << "ERROR: -q must be <= 100\n";
+	exit(1);
+      }
+      break;
+    }
+    case 'v': {
+      CP_minbasecoverage=atoi(optarg);
+      break;
+    }
+    case 'x': {
+      CP_mincontiglength=atoi(optarg);
+      break;
+    }
+    case 'X': {
+      CP_mincontiglength=atoi(optarg);
+      CP_minlengthisclipped=true;
+      break;
+    }
+    case 'y': {
+      CP_mincontigcoverage=atoi(optarg);
+      break;
+    }
+    case 'z': {
+      CP_minnumreads=atoi(optarg);
+      break;
+    }
+    case 'o': {
+      fqqualoffset=atoi(optarg);
+      break;
+    }
+    case 'l': {
+      linelen=atoi(optarg);
+      if(linelen <= 0) {
+	usage();
+	cout << endl;
+	cerr << "ERROR: -l must be >=0\n";
+	exit(1);
+      }
+      break;
+    }
+    case 'u': {
+      CP_fillholesinstraingenomes=true;
+      break;
+    }
+    case 'm': {
+      CP_makecontigs=true;
+      CP_extractreadsinsteadcontigs=false;
+      break;
+    }
+    case 'M': {
+      CP_extractreadsinsteadcontigs=true;
+      CP_makecontigs=false;
+      break;
+    }
+    case 'd': {
+      CP_deletestaronlycolumns=true;
+      break;
+    }
+    case 'b': {
+      CP_blinddata=true;
+      break;
+    }
+    case 'n': {
+      namefile=optarg;
+      break;
+    }
+    case 'N': {
+      namefile=optarg;
+      CP_sortbyname=true;
+      break;
+    }
+    case 'i': {
+      cerr << "SORRY: -" << static_cast<char>(c) << " is currently de-activated\n";
+      exit(1);
+      keepnamesfromfile=false;
+      break;
+    }
+    case 'Z': {
+      CP_specialtestcode=true;
+      break;
+    }
+    case 'h': 
+    case '?': {
+      usage();
+      exit(0);
+    }
+    default : {}
+    }
+  }
+
+  if(argc-optind < 1) {
+    usage();
+    cout << endl;
+    cerr << argv[0] << ": " << "Missing infile and out-basename as arguments!\n";
+    exit(1);
+  }
+
+  if(argc-optind < 2) {
+    usage();
+    cout << endl;
+    cerr << argv[0] << ": " << "Missing either infile or out-basename as arguments!\n";
+    exit(1);
+  }
+
+  if(argc-optind > 2) {
+    usage();
+    cout << endl;
+    cerr << argv[0] << ": " << "Whoops, found more than infile and out-basename as arguments left on the command line!\n";
+    cerr << "Unparsed command line: ";
+    for(;optind<argc;optind++) cerr <<argv[optind] << " ";  
+    cerr << endl;
+    exit(1);
+  }
+
+  CP_infile=argv[optind++];
+  CP_outbasename=argv[optind];
+
+  if(CP_infile=="--help"){
+    usage();
+    exit(0);
+  }
+
+  checkTypes(CP_fromtype,CP_totype);
+
+  MIRAParameters::setupStdMIRAParameters(CP_Pv);
+  if(!miraparams.empty()){
+    cout << "Parsing special MIRA parameters: " << miraparams << endl;
+    MIRAParameters::parse(miraparams.c_str(),CP_Pv);
+    cout << "Ok.\n";
+  }
+
+  CP_Pv[0].setContigAlignmentOutputTextLineLen(linelen);
+  CP_Pv[0].setContigAlignmentOutputHTMLLineLen(linelen);
+  CP_Pv[0].setContigAlignmentOutputTextGapPad(endgap_fillchar);
+  CP_Pv[0].setContigAlignmentOutputHTMLGapPad(endgap_fillchar);
+
+  for(uint32 i=0; i< CP_Pv.size(); i++){
+    CP_Pv[i].setAssemblyFASTQQualOffset(fqqualoffset);
+  }
+
+  ReadPool thepool(&CP_Pv);
+
+  CP_assemblyinfo.setLargeContigSize(CP_mincontiglength);
+  CP_assemblyinfo.setLargeTotalCov(CP_mincontigcoverage);
+
+  if(CP_recalcconopt=='C'){
+    for(uint32 i=0; i< CP_Pv.size(); i++){
+      CP_Pv[i].setContigForceNonIUPAC(true,true);
+    }
+  }
+
+  if(!namefile.empty()){
+    General::makeSelectionStringSet(namefile);
+  }
+
+  cout << "Loading from " << CP_fromtype << ", saving to:";
+  ofstream * ofstmp;
+  for(list<string>::iterator ttI= CP_totype.begin(); ttI!=CP_totype.end(); ++ttI){
+    ofstmp=new ofstream;
+    CP_ofs.push_back(ofstmp);
+    cout << ' ' << *ttI;
+    if(*ttI=="fasta"){
+      if(!CP_splitcontigs2singlefiles){
+	CP_ofs.back()->open(createFileNameFromBasePostfixContigAndRead(CP_outbasename,".fasta").c_str(), ios::out);
+      }
+      CP_totype.push_back("fastaqual");
+    } else if(*ttI=="fastaqual"){
+      if(!CP_splitcontigs2singlefiles){
+	CP_ofs.back()->open(createFileNameFromBasePostfixContigAndRead(CP_outbasename,".fasta.qual").c_str(), ios::out);
+      }
+    } else if(*ttI=="maskedfasta"){
+      if(!CP_splitcontigs2singlefiles){
+	CP_ofs.back()->open(createFileNameFromBasePostfixContigAndRead(CP_outbasename,".fasta").c_str(), ios::out);
+      }
+      CP_totype.push_back("maskedfastaqual");
+    } else if(*ttI=="maskedfastaqual"){
+      if(!CP_splitcontigs2singlefiles){
+	CP_ofs.back()->open(createFileNameFromBasePostfixContigAndRead(CP_outbasename,".fasta.qual").c_str(), ios::out);
+      }
+    } else if(*ttI=="fastq"){
+      if(!CP_splitcontigs2singlefiles){
+	CP_ofs.back()->open(createFileNameFromBasePostfixContigAndRead(CP_outbasename,".fastq").c_str(), ios::out);
+      }
+    } else if(*ttI=="caf" || *ttI=="scaf" ){
+      if(!CP_splitcontigs2singlefiles){
+	CP_ofs.back()->open(createFileNameFromBasePostfixContigAndRead(CP_outbasename,".caf").c_str(), ios::out);
+      }
+    } else if(*ttI=="maf"){
+      if(!CP_splitcontigs2singlefiles){
+	CP_ofs.back()->open(createFileNameFromBasePostfixContigAndRead(CP_outbasename,".maf").c_str(), ios::out);
+      }
+    } else if(*ttI=="hsnp"){
+    } else if(*ttI=="asnp"){
+    } else if(*ttI=="cstats"){
+    } else if(*ttI=="crlist"){
+    } else if(*ttI=="html"){
+    } else if(*ttI=="text"){
+    } else if(*ttI=="txt"){
+    } else if(*ttI=="exp"){
+    } else if(*ttI=="gbf"){
+    } else if(*ttI=="ace"){
+    } else if(*ttI=="tcs"){
+    } else if(*ttI=="wiggle" || *ttI=="wig"){
+    } else {
+      cout.flush();
+      cerr << "\n\n-t " << *ttI << " is not a handled 'to' type\n";
+      //usage();
+      exit(1);
+    }
+  }
+  cout << '\n';
+
+  try{
+    if(CP_fromtype=="caf" || CP_fromtype=="maf") {
+      void (*usecallback)(list<Contig> &, ReadPool &) = cafmafload_callback;
+      if(CP_sortbyname){
+	usecallback=NULL;
+      }
+
+      if(CP_fromtype=="caf") {
+	CAF tcaf(thepool, CP_clist, &CP_Pv);
+	vector<uint32> dummy;
+	tcaf.load(CP_infile.c_str(), 
+		  Read::SEQTYPE_SANGER,
+		  1,
+		  dummy,
+		  false, 
+		  usecallback
+	  );
+      }else if(CP_fromtype=="maf") {
+	MAFParse mafp(thepool, CP_clist, &CP_Pv);
+	vector<uint32> dummy;
+	mafp.load(CP_infile.c_str(), 
+		  Read::SEQTYPE_SANGER,
+		  1,
+		  dummy,
+		  false, 
+		  usecallback
+	  );
+      }
+      if(usecallback==NULL){
+	sortContigsByName(CP_clist);
+	cafmafload_callback(CP_clist,thepool);
+      }
+    }else{
+      uint32 dummy=0;
+      if(CP_fromtype=="fasta"){
+	cout << "Loading data from FASTA ...";
+	thepool.loadDataFromFASTA(CP_infile,2, dummy, false, CP_infile+".qual",false,Read::SEQTYPE_SANGER,false,readpoolload_callback);
+      } else if(CP_fromtype=="fastq"){
+	cout << "Loading data from FASTQ ...";
+	thepool.loadDataFromFASTQ(CP_infile,2, dummy,false,Read::SEQTYPE_SANGER,false,readpoolload_callback);
+      } else if(CP_fromtype=="gbf") {
+	cout << "Loading data from GBF ...";
+	thepool.loadDataFromGBF(CP_infile);
+	saveReadPool(thepool,CP_ofs);
+      } else if(CP_fromtype=="fofnexp"){
+	cout << "Loading data from EXP in file of filenames ...";
+	thepool.loadEXPs(CP_infile,1, dummy);
+	thepool.loadQualitiesFromSCF(false, false,"/dev/null","/dev/null");
+	saveReadPool(thepool,CP_ofs);
+      } else {
+	cerr << "\n\n-f " << CP_fromtype << " is not a valid from type! (simple pool)\n";
+	//usage();
+	exit(1);
+      }
+      cout << " done.\n"; 
+    }
+  }
+  catch(Notify n){
+    // Need to close by hand as handleError() will perform a hard exit
+    closeOpenStreams(CP_ofs);
+    n.handleError("main");
+  }
+  catch(Flow f){
+    cerr << "Unexpected exception: Flow()\n";
+  }
+  catch(...){
+    cout.flush();
+    cerr.flush();
+    cerr << "Unknown exception caught, aborting the process.\n\nPlease contact: bach at chevreux.org\n\n";
+    abort();
+  }
+
+  cout << "\nData conversion process finished, no obvious errors encountered.\n";
+
+  FUNCEND();
+  return 0;
+}
+
+
+
+
+class MiraBait 
+{
+private:
+
+
+  static vector<MIRAParameters> MB_Pv;
+
+  static string MB_fromtype;
+  static list<string> MB_totype;
+
+  static list<ofstream *> MB_ofs;
+
+
+  static string MB_baitfile;
+  static string MB_infile;
+  static string MB_outbasename;
+
+  static bool MB_deletestaronlycolumns;
+  static bool MB_inversehit;
+  static bool MB_fwdandrev;
+  static uint32 MB_numbaithits;
+
+  static bool MB_mustdeletetargetfiles;
+
+  static list<Contig> MB_clist;   // needed for CAF conversion (and GBF)
+
+  static Skim MB_skim;
+
+private:
+  static void usage();
+  static void checkTypes(string & fromtype,list<string> & totype);
+  static void putReadsInContigsAndSave(vector<MIRAParameters> & Pv, ReadPool & rp);
+  static void specialTestCode(list<Contig> & clist, ReadPool & rp);
+
+  static void saveReadPool(ReadPool & rp);
+  static void cafmafload_callback(list<Contig> & clist, ReadPool & rp);
+  static void readpoolload_callback(ReadPool & rp);
+
+public:
+  ~MiraBait();
+
+  int main(int argc, char ** argv);
+
+};
+
+vector<MIRAParameters> MiraBait::MB_Pv;
+
+string MiraBait::MB_fromtype="fastq";
+list<string> MiraBait::MB_totype;
+list<ofstream *> MiraBait::MB_ofs;
+
+string MiraBait::MB_infile;
+string MiraBait::MB_baitfile;
+string MiraBait::MB_outbasename;
+
+bool   MiraBait::MB_deletestaronlycolumns=false;
+bool   MiraBait::MB_mustdeletetargetfiles=true;
+bool   MiraBait::MB_inversehit=false;
+bool   MiraBait::MB_fwdandrev=true;
+uint32 MiraBait::MB_numbaithits=1;
+
+list<Contig> MiraBait::MB_clist;   // needed for CAF conversion (and GBF)
+
+Skim MiraBait::MB_skim;;
+
+
+MiraBait::~MiraBait()
+{
+  ConvPro::closeOpenStreams(MB_ofs);
+}
+
+void MiraBait::usage()
+{
+  cout << "mirabait\t(MIRALIB version " << MIRALIBVERSION << ")\n";
+  cout << "Author: Bastien Chevreux\t(bach at chevreux.org)\n\n";
+
+  cout << "... baiting ...\n";
+  cout << "Usage:\n";
+  //cout << "\tconvert_project [-f <fromtype>] [-t <totype>] [-s strainfile] [-q] infile outfile\n\n";
+  cout << "mirabait [-f <fromtype>] [-t <totype> [-t <totype> ...]] [-iklor] baitfile infile <basename_for_outfile(s)>\n\n";
+  cout << "Options:\n";
+  cout << "\t-f <fromtype>\tload this type of project files, where fromtype is:\n"
+    "\t   caf\t\t sequences from CAF\n"
+    "\t   maf\t\t sequences from MAF\n"
+    "\t   phd\t\t sequences from a PHD file\n"
+    "\t   gbf\t\t sequences from a GBF file\n"
+    "\t   fasta\t sequences from a FASTA file\n"
+    "\t   fastq\t sequences from a FASTQ file\n";
+  cout << "\t-t <totype>\twrite the sequences to this type (multiple mentions\n"
+    "\t\t\tof -t are allowed):\n"
+    "\t   fasta\t sequences to FASTA file\n"
+    "\t   fastq\t sequences to FASTQ file\n"
+    "\t   caf\t\t sequences to CAF\n"
+    "\t   maf\t\t sequences to MAF\n";
+
+  cout << "\n"
+    "\t-k\t\tk-mer, length of bait in bases (<32, default=31)\n"
+    "\t-n\t\tMin. number of k-mer baits needed (default=1)\n"
+    "\t-i\t\tInverse hit: writes only sequences that do not hit bait\n"
+    "\t-r\t\tNo checking of reverse complement direction\n";
+
+  cout << "\n"
+    "\t-o\t\tfastq quality Offset (only for -f = 'fastq')\n"
+    "\t\t\t Offset of quality values in FASTQ file. Default: 33\n"
+    "\t\t\t A value of 0 tries to automatically recognise.\n";
+
+
+
+//  cout << "\t-a <string>\tString with MIRA parameters to be parsed\n"
+//    "\t\t\t Useful when setting parameters affecting consensus\n"
+//    "\t\t\t calling like -CO:mrpg etc.\n"
+//    "\t\t\t E.g.: -a \"454_SETTINGS -CO:mrpg=3\"\n";
+
+  cout << "\nExamples:\n"
+    "\t...\n"
+    "\t...\n";
+}
+
+
+void MiraBait::checkTypes(string & fromtype,list<string> & totype)
+{
+  if(fromtype.empty()){
+    fromtype="fastq";
+  }
+  if(!(fromtype=="caf"
+       || fromtype=="maf"
+       || fromtype=="phd"
+       || fromtype=="gbf"
+       || fromtype=="exp"
+       || fromtype=="fasta"
+       || fromtype=="fastq"
+       )){
+    usage();
+    cout << endl;
+    cerr << "Unknown or illegal file type '" << fromtype << "' defined as <fromtype>\n";
+    exit(1);
+  }
+  if(MB_totype.empty()){
+    if(fromtype=="caf"
+       || fromtype=="maf"
+       || fromtype=="fasta"
+       || fromtype=="fastq"
+      ){
+      MB_totype.push_back(fromtype);
+    }else{
+      MB_totype.push_back("fastq");
+    }
+  }
+  for(list<string>::iterator ttI= MB_totype.begin(); ttI!=MB_totype.end(); ++ttI){
+    if(*ttI=="scaf") *ttI="caf";
+    if(!(*ttI=="fasta"
+	 || *ttI=="fastq"
+	 || *ttI=="caf"
+	 || *ttI=="maf"
+	 )){
+      usage();
+      cout << endl;
+      cerr << "Unknown or illegal file type '" << *ttI << "' defined as <totype>\n";
+      exit(1);
+    }
+  }
+}
+
+// Note: clears the readpool after saving!
+void MiraBait::saveReadPool(ReadPool & rp)
+{
+  // first, bait all reads. Those who bite, discard.
+  for(uint32 i=0; i<rp.size(); ++i){
+    if((MB_skim.checkBaitHit(rp[i]) >= MB_numbaithits) ^ !MB_inversehit){
+      rp[i].discard();
+    }
+  }
+
+  // then save the read pool
+  list<string>::iterator ttI= MB_totype.begin();
+  list<ofstream *>::iterator ofsI= MB_ofs.begin();
+  for(; ttI!=MB_totype.end(); ++ttI, ++ofsI){
+    if(*ttI=="fasta"){
+      // double indirection because iterator needs one and it is a list of ofstream pointers ...
+      rp.dumpAs(*(*ofsI),Read::AS_FASTA,false);
+    } else if(*ttI=="fastaqual"){
+      rp.dumpAs(*(*ofsI),Read::AS_FASTAQUAL,false);
+    } else if(*ttI=="fastq"){
+      rp.dumpAs(*(*ofsI),Read::AS_FASTQ,false);
+    } else if(*ttI=="caf" || *ttI=="scaf" ){
+      rp.dumpAs(*(*ofsI),Read::AS_CAF,false);
+    } else if(*ttI=="maf"){
+      rp.dumpAs(*(*ofsI),Read::AS_MAF,false);
+    } else {
+      cout.flush();
+      cerr << "\n\n-t " << *ttI << " is not a valid type when the source file does not contain a full assembly!\n";
+      //usage();
+      exit(1);
+    }
+  }
+}
+
+
+void MiraBait::cafmafload_callback(list<Contig> & clist, ReadPool & rp)
+{
+  // TODO: check if needed
+  Assembly::refreshContigAndReadpoolValuesAfterLoading(rp,clist);
+
+  saveReadPool(rp);
+
+  Read::trashReadNameContainer();
+  clist.clear();
+  rp.discard();
+}
+
+void MiraBait::readpoolload_callback(ReadPool & rp)
+{
+  // TODO: check if needed (slows loading by ~30 to 50%
+//  rp.makeTemplateIDs(false);
+//  rp.makeStrainIDs(false);
+
+  saveReadPool(rp);
+
+  Read::trashReadNameContainer();
+  rp.discard();
+}
+
+
+
+int MiraBait::main(int argc, char ** argv)
+{
+  //CALLGRIND_STOP_INSTRUMENTATION;
+
+  FUNCSTART("int main(int argc, char ** argv)");
+
+  int c;
+  extern char *optarg;
+  extern int optind;
+
+
+  base_quality_t fqqualoffset=33;
+
+  string path;
+  string convertprog;
+  splitFullPathAndFileName(argv[0],path,convertprog);
+
+  string miraparams;
+
+  uint8 basesperhash=31;
+
+  while (1){
+    c = getopt(argc, argv, "hdirf:t:o:a:k:n:");
+    if(c == -1) break;
+
+    switch (c) {
+    case 'a': {
+      miraparams=optarg;
+      break;
+    }
+    case 'f': {
+      MB_fromtype=optarg;
+      break;
+    }
+    case 'n': {
+      MB_numbaithits=atoi(optarg);
+      break;
+    }
+    case 'k': {
+      uint64 bla=atoi(optarg);
+      if(bla>31) bla=31;
+      basesperhash=bla;
+      break;
+    }
+    case 't': {
+      MB_totype.push_back(optarg);
+      break;
+    }
+    case 'o': {
+      fqqualoffset=atoi(optarg);
+      break;
+    }
+    case 'd': {
+      MB_deletestaronlycolumns=true;
+      break;
+    }
+    case 'i': {
+      MB_inversehit=true;
+      break;
+    }
+    case 'r': {
+      MB_fwdandrev=false;
+      break;
+    }
+    case 'h': 
+    case '?': {
+      usage();
+      exit(0);
+    }
+    default : {}
+    }
+  }
+
+  if(argc-optind < 1) {
+    cerr << argv[0] << ": " << "Missing baitfile, infile and out-basename as arguments!\n";
+    usage();
+    exit(1);
+  }
+
+  if(argc-optind < 3) {
+    cerr << argv[0] << ": " << "Missing one of baitfile, infile or out-basename as argument!\n";
+    usage();
+    exit(1);
+  }
+
+  if(argc-optind > 3) {
+    cerr << argv[0] << ": " << "Whoops, found more than baitfile, infile and out-basename as arguments left on the command line!\n";
+    cerr << "Unparsed command line: ";
+    for(;optind<argc;optind++) cerr <<argv[optind] << " ";  
+    cerr << endl;
+    usage();
+    exit(1);
+  }
+
+  MB_baitfile=argv[optind++];
+  MB_infile=argv[optind++];
+  MB_outbasename=argv[optind];
+
+  if(MB_baitfile=="--help"){
+    usage();
+    exit(0);
+  }
+
+  checkTypes(MB_fromtype,MB_totype);
+
+  MIRAParameters::setupStdMIRAParameters(MB_Pv);
+  if(!miraparams.empty()){
+    cout << "Parsing special MIRA parameters: " << miraparams << endl;
+    MIRAParameters::parse(miraparams.c_str(),MB_Pv);
+    cout << "Ok.\n";
+  }
+
+  for(uint32 i=0; i< MB_Pv.size(); i++){
+    MB_Pv[i].setAssemblyFASTQQualOffset(fqqualoffset);
+  }
+
+  {
+    ReadPool baitrp(&MB_Pv);
+    cout << "Loading baits ...";
+    uint32 dummy=0;
+    baitrp.loadDataFromFASTA(MB_baitfile,1, dummy, false,"",false);
+
+    cout << "baitrp.size(): " << baitrp.size() << endl;
+
+    MB_skim.provideHashStatistics(".",baitrp,false,false,true,MB_fwdandrev,1,basesperhash,1);
+  }
+
+  ReadPool loadrp(&MB_Pv);
+
+  cout << "Loading from " << MB_fromtype << ", saving to:";
+  ofstream * ofstmp;
+  for(list<string>::iterator ttI= MB_totype.begin(); ttI!=MB_totype.end(); ++ttI){
+    cout << ' ' << *ttI;
+    ofstmp=new ofstream;
+    MB_ofs.push_back(ofstmp);
+    if(*ttI=="fasta"){
+      MB_ofs.back()->open((MB_outbasename + ".fasta").c_str(), ios::out);
+    } else if(*ttI=="fastq"){
+      MB_ofs.back()->open((MB_outbasename + ".fastq").c_str(), ios::out);
+    } else if(*ttI=="caf" || *ttI=="scaf" ){
+      MB_ofs.back()->open((MB_outbasename + ".caf").c_str(), ios::out);
+    } else if(*ttI=="maf"){
+      MB_ofs.back()->open((MB_outbasename + ".maf").c_str(), ios::out);
+    } else {
+      cout.flush();
+      cerr << "\n\n-t " << *ttI << " is not a valid type\n";
+      //usage();
+      exit(1);
+    }
+  }
+  cout << '\n';
+
+  try{
+    if(MB_fromtype=="caf") {
+      CAF tcaf(loadrp, MB_clist, &MB_Pv);
+      vector<uint32> dummy;
+      tcaf.load(MB_infile.c_str(), 
+		Read::SEQTYPE_SANGER,
+		1,
+		dummy,
+		false, 
+		cafmafload_callback
+	);
+    }else if(MB_fromtype=="maf") {
+      MAFParse mafp(loadrp, MB_clist, &MB_Pv);
+      vector<uint32> dummy;
+      mafp.load(MB_infile.c_str(), 
+		Read::SEQTYPE_SANGER,
+		1,
+		dummy,
+		false, 
+		cafmafload_callback
+	);
+    }else{
+      uint32 dummy=0;
+      if(MB_fromtype=="fasta"){
+	cout << "Loading data from FASTA ...";
+	loadrp.loadDataFromFASTA(MB_infile,2, dummy, false, MB_infile+".qual",false,Read::SEQTYPE_SANGER,false,readpoolload_callback);
+      } else if(MB_fromtype=="fastq"){
+	cout << "Loading data from FASTQ ...";
+	loadrp.loadDataFromFASTQ(MB_infile,2, dummy,false,Read::SEQTYPE_SANGER,false,readpoolload_callback);
+      } else if(MB_fromtype=="gbf") {
+	cout << "Loading data from GBF ...";
+	loadrp.loadDataFromGBF(MB_infile);
+	saveReadPool(loadrp);
+      } else {
+	cerr << "\n\n-f " << MB_fromtype << " is not a valid type!\n";
+	//usage();
+	exit(1);
+      }
+      cout << " done.\n"; 
+    }
+  }
+  catch(Notify n){
+    // Need to close by hand as handleError() will perform a hard exit
+    ConvPro::closeOpenStreams(MB_ofs);
+    n.handleError("main");
+  }
+  catch(Flow f){
+    cerr << "Unexpected exception: Flow()\n";
+  }
+  catch(...){
+    cerr << "Unknown exception caught, aborting the process.\n\nPlease contact: bach at chevreux.org\n\n";
+    abort();
+  }
+
+  cout << "\nBaiting process finished.\n";
+
+  FUNCEND();
+  return 0;
+}
+
+
+
+int main(int argc, char ** argv)
+{
+  //CALLGRIND_STOP_INSTRUMENTATION;
+
+  FUNCSTART("int main(int argc, char ** argv)");
+
+  string path;
+  string convertprog;
+  splitFullPathAndFileName(argv[0],path,convertprog);
+
+  std::transform(convertprog.begin(),
+		 convertprog.end(),
+		 convertprog.begin(), 
+		 (int(*)(int))std::tolower); // now, that's what I call ugly
+  
+  try {
+    if(convertprog=="tagsnp"){
+      tagsnp t;
+      t.main(argc, argv);
+    }else if(convertprog=="mirafa"){
+      mirafa f;
+      f.main(argc, argv);
+    }else if(convertprog=="mirabait"){
+      MiraBait m;
+      m.main(argc, argv);
+    }else{
+      ConvPro cp;
+      cp.main2(argc, argv);
+    }
+  }
+  catch(Notify n){
+    n.handleError("main");
+  }
+  catch(Flow f){
+    cout << "INTERNAL ERROR: Unexpected exception: Flow()\n";
+    exit(100);
+  }
+  catch(const std::bad_alloc & e){
+    cout << "Out of memory detected, exception message is: ";
+    cout << e.what() << endl; 
+
+    if(sizeof(size_t) == sizeof(int32)){
+      cout << "\nYou are running a 32 bit executable. Please note that the maximum"
+	"\ntheoretical memory a 32 bit programm can use (be it in Linux, Windows or"
+	"\nother) is 4 GiB, in practice less: between 2.7 and 3.3 GiB. This is valid"
+	"\neven if your machine has hundreds of GiB."
+	"\nShould your machine have more that 4 GiB, use a 64 bit OS and a 64 bit"
+	"\nversion of MIRA.";
+    }
+
+    cout << "\n\nIf you have questions on why this happened, please send the last 1000"
+      "\nlines of the output log (or better: the complete file) to the author"
+      "\ntogether with a short summary of your assembly project.\n\n";
+
+    exit(100);
+  }
+  catch(const ios_base::failure & e){
+    cout << "Failure in IO stream detected, exception message is: "
+	 << e.what() << endl
+	 << "\nWe perhaps ran out of disk space or hit a disk quota?\n";
+    exit(100);
+  }
+  catch (exception& e)
+  {
+    cout << "A 'standard' exception occured (that's NOT normal):\n" << e.what() << "\n\nIf the cause is not immediatly obvious, please contact: bach at chevreux.org\n\n";
+    exit(100);
+  }
+  catch(...){
+    cout << "Unknown exception caught, aborting the process.\n\nPlease contact: bach at chevreux.org\n\n";
+    exit(100);
+  }
+
+  Read::dumpStringContainerStats(cout);
+  return 0;
+}
diff --git a/src/progs/dbgreplay.C b/src/progs/dbgreplay.C
new file mode 100644
index 0000000..31eb281
--- /dev/null
+++ b/src/progs/dbgreplay.C
@@ -0,0 +1,124 @@
+#include <iostream>
+#include <string>
+#include <algorithm>
+ 
+//#include <valgrind/callgrind.h>
+
+#include "io/generalio.H"
+#include "mira/assembly.H"
+#include "mira/parameters.H"
+#include "mira/maf_parse.H"
+
+
+void doAbort()
+{
+  abort();
+}
+
+int main(int argc, char ** argv)
+{
+
+  try{
+    string contigfile="c.maf";
+    string readfile="r.maf";
+    string refrname="E0K6C4E01BF7AZ";
+    string newrname="E0K6C4E01EVQI6";
+    string paramstring="--job=denovo,genome,accurate,454,solexa";
+
+    vector<MIRAParameters> MPv; 
+    MIRAParameters::setupStdMIRAParameters(MPv);
+
+    if(!paramstring.empty()){
+      MIRAParameters::parse(paramstring.c_str(),MPv);
+    }
+
+    ReadPool       greadpool(&MPv);
+    list<Contig>   gcontigs;
+
+    // not used, but needed for linking *sigh*
+    Assembly as(MPv,false);
+    
+    MAFParse tmaf(greadpool, gcontigs, &MPv);
+    vector<uint32> dummy;
+    tmaf.load(contigfile, Read::SEQTYPE_SANGER, 1, dummy, false);
+    tmaf.load(readfile, Read::SEQTYPE_SANGER, 1, dummy, false);
+    
+    int32 refid=greadpool.getReadIndex(refrname);
+    int32 newid=greadpool.getReadIndex(newrname);
+    
+    AlignedDualSeqFacts adsf;
+    // refid, newid,  
+    //   delta,id1_rightdelta, id2_rightdelta, totallen, id1_direction, id2_direction, score_ratio
+    //adsf.publicinit(refid,newid,2,0,9,91,1,1,100);
+    int8 dirnewid=-1;
+    adsf.publicinit(refid,newid,4,4,0,258,1,dirnewid,100);
+    cout << adsf << endl;
+    
+    Contig::errorstatus_t errstat;
+    vector<Align> aligncache;
+    for(uint32 i=0; i<Read::SEQTYPE_END; i++) {
+      Align a(&MPv[i]);
+      aligncache.push_back(a);
+    }
+    
+    gcontigs.back().addRead(aligncache,
+			    &adsf,
+			    refid,newid,
+			    dirnewid,
+			    0,
+			    0,
+			    errstat);
+
+    if(errstat.code == Contig::ENOERROR) {
+      cout << "read added\n\n";
+      Contig::setCoutType(Contig::AS_TEXT);
+      cout << gcontigs.back();
+    }else{
+      cout << "read not added\n\n";
+    }
+
+  }
+  catch(Notify n){
+    n.handleError("main");
+  }
+  catch(Flow f){
+    cout << "INTERNAL ERROR: Unexpected exception: Flow()\n";
+    doAbort();
+  }
+  catch(const std::bad_alloc & e){
+    cout << "Out of memory detected, exception message is: ";
+    cout << e.what() << endl; 
+
+    if(sizeof(size_t) == sizeof(int32)){
+      cout << "\nYou are running a 32 bit executable. Please note that the maximum"
+	"\ntheoretical memory a 32 bit programm can use (be it in Linux, Windows or"
+	"\nother) is 4 GiB, in practice less: between 2.7 and 3.3 GiB. This is valid"
+	"\neven if your machine has hundreds of GiB."
+	"\nShould your machine have more that 4 GiB, use a 64 bit OS and a 64 bit"
+	"\nversion of MIRA.";
+    }
+
+    cout << "\n\nIf you have questions on why this happened, please send the last 1000"
+      "\nlines of the output log (or better: the complete file) to the author"
+      "\ntogether with a short summary of your assembly project.\n\n";
+
+    doAbort();
+  }
+  catch(const ios_base::failure & e){
+    cout << "Failure in IO stream detected, exception message is: "
+	 << e.what() << endl
+	 << "\nWe perhaps ran out of disk space or hit a disk quota?\n";
+    doAbort();
+  }
+  catch (exception& e)
+  {
+    cout << "A 'standard' exception occured (that's NOT normal):\n" << e.what() << "\n\nIf the cause is not immediatly obvious, please contact: bach at chevreux.org\n\n";
+    doAbort();
+  }
+  catch(...){
+    cout << "Unknown exception caught, aborting the process.\n\nPlease contact: bach at chevreux.org\n\n";
+    doAbort();
+  }
+      
+  return 0;
+}
diff --git a/src/progs/fastatool.C b/src/progs/fastatool.C
new file mode 100644
index 0000000..5906989
--- /dev/null
+++ b/src/progs/fastatool.C
@@ -0,0 +1,338 @@
+/*
+ * Written by Bastien Chevreux (BaCh)
+ *
+ * Copyright (C) 2005 and later by Bastien Chevreux
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ * 
+ */
+
+
+#include <fstream>
+#include <iostream>
+#include "io/fasta.H"
+
+#include "version.H"
+
+#if __GNUC__ >= 3
+#define NO_NOCREATE
+#endif 
+
+
+void usage_header()
+{
+  cout << "fastatool V1.0 (MIRALIB version "MIRALIBVERSION")\n";
+  cout << "Written by Bastien Chevreux (bach at chevreux.org)\n\n";
+}
+
+void usageTool()
+{
+  usage_header();
+  cout << "Provides a set of tools useful when working with FASTA files.\n\n";
+  cout << "Usage:\n";
+  cout << "  fastatool <toolname> <tool parameters>\n\n";
+  cout << "Available tools:\n";
+  cout << "\tclip\tClip left and right parts of a FASTA sequence.\n";
+  cout << "\tsanitize\tDeletes invalid sequences from FASTA files.\n";
+  cout << "\nTo get help on a specific tool, type 'fastatool <toolname>'. E.g.: fastatool cut\n\n";
+}
+
+void usageSanitize()
+{
+  usage_header();
+  cout << "fastatool sanitize\n\n\
+Deletes sequences with non-IUPAC bases or empty sequences from a FASTA file,\n\
+writes the 'surviving' sequences to a new file.\n\
+If a quality file is given, a cleaned version of that is also written.\n\
+The sequences in the quality files (if given) MUST be in the same order than\n\
+in the fasta file.\n\
+\n\
+Usage:\n\
+\tsanitizeFASTA fastainfile fastaoutfile [fastaqualin fastaqualoutfile]\n";
+}
+
+
+void usageClip()
+{
+  usage_header();
+  cout << "fastatool clip\n\n\
+Clips bases on the left and right of a FASTA sequence, writes result to STDOUT.\n\
+\n\
+Usage:\n\
+\tclipFASTA -l leftclip -r rightclip fastainfile\n";
+}
+
+
+int mainSanitize (int argc, char **argv) 
+{
+  if(argc != 4 && argc != 6) {
+    if(argc>2) cout << "ERROR: Wrong number of arguments for fastatool sanitize!\n";
+    usageSanitize();
+    exit(1);
+  }
+
+  try{
+    ifstream fin;
+    ofstream fout;
+
+#ifdef NO_NOCREATE
+    fin.open(argv[2], ios::in|ios::ate);
+#else 
+    fin.open(argv[2], ios::in|ios::ate|ios::nocreate);
+#endif 
+    if(!fin){
+      throw Notify(Notify::FATAL, "mainSanitize", (static_cast<std::string>("File not found: ")+argv[2]).c_str());
+    }
+    if(!fin.tellg()){
+      throw Notify(Notify::FATAL, "mainSanitize", (static_cast<std::string>("Zero length file: ")+argv[2]).c_str());
+    }
+    fin.seekg(0, ios::beg);
+    fout.open(argv[3], ios::out);
+
+    ifstream qin;
+    ofstream qout;
+    if(argc == 6) {
+#ifdef NO_NOCREATE
+      qin.open(argv[4], ios::in|ios::ate);
+#else 
+      qin.open(argv[4], ios::in|ios::ate|ios::nocreate);
+#endif 
+      if(!qin){
+	throw Notify(Notify::FATAL, "mainSanitize", (static_cast<std::string>("File not found: ")+argv[4]).c_str());
+      }
+      if(!qin.tellg()){
+	throw Notify(Notify::FATAL, "mainSanitize", (static_cast<std::string>("Zero length file: ")+argv[4]).c_str());
+      }
+      qin.seekg(0, ios::beg);
+      
+      qout.open(argv[5], ios::out);
+    }
+
+    FASTA thefasta;
+    while(1){
+      try{
+	if(argc==4){
+	  thefasta.loadNextSeq(fin);
+	}else{
+	  thefasta.loadNext(fin,qin);
+	}
+	if(thefasta.testIfEmpty()) {
+	  // no more sequences.
+	  break;
+	}
+	if(thefasta.getSequence().size()>0) {
+	  //      REP_thepool.back().setFileNames(thefasta.getSeqName().c_str());
+	  const char * seq= thefasta.getSequence().c_str();
+	  const vector<uint8> quals=thefasta.getQualities();
+	  uint32 slen=thefasta.getSequence().size();
+	  fout << ">" << thefasta.getSeqName().c_str();
+	  for(uint32 i=0; i<slen; i++, seq++){
+	    if(i%60==0){
+	      fout << endl;
+	    }
+	    fout << *seq;
+	  }
+	  fout << "\n";
+	  if(argc==6){
+	    qout << ">" << thefasta.getSeqName().c_str();
+	    for(uint32 i=0; i<slen; i++, seq++){
+	      if(i%20==0){
+		qout << endl;
+	      }
+	      qout << (uint16) quals[i] << " ";
+	    }
+	    qout << "\n";
+	  }
+	} else{
+	  cerr << "Thrown out " << thefasta.getSeqName().c_str() << ": no bases" << endl;
+	}
+
+      }
+      catch(Notify n){
+	n.setGravity(Notify::WARNING);
+	n.handleError("mainSanitize");
+	cerr << "Read " << thefasta.getSeqName().c_str() << " thrown out." << endl;
+      }
+    }
+    
+    fin.close();
+  }
+  catch(Notify n) {
+    n.handleError("mainSanitize");
+    exit(1);
+  }
+
+  return 0;
+}
+
+
+int mainClip(int argc, char **argv)
+{
+  if(argc==2) {
+    usageClip();
+    exit(0);
+  }
+
+  int c;
+  extern char *optarg;
+  extern int optind;
+
+  bool lflag=false;
+  bool rflag=false;
+
+  int32 GLO_cl=0;
+  int32 GLO_cr=0;
+
+  while (1){
+    c = getopt(argc, argv, "l:r:");
+    if(c == -1) break;
+
+    switch (c) {
+    case 'l': {
+      int32 cl=atoi(optarg);
+      if(cl < 0) {
+	cerr << "ERROR: -l clip left must be >=0 in fastatool clip\n";
+	usageClip();	
+	exit(1);
+      }
+      GLO_cl=cl;
+      lflag=true;
+      break;
+    }
+    case 'r': {
+      int32 cr=atoi(optarg);
+      if(cr<0) {
+	cerr << "ERROR: -r clip right must be >=0 in fastatool clip\n";
+	usageClip();	
+	exit(1);
+      }
+      GLO_cr=cr;
+      rflag=true;
+      break;
+    }
+    case '?': 
+      usageClip();
+      exit(0);
+    }
+  }
+
+  if(!lflag) {
+    cerr << "ERROR: missing -l flag in fastatool clip\n";
+    usageClip();	
+    exit(1);
+  }
+  if(!rflag) {
+    cerr << "ERROR: missing -r flag in fastatool clip\n";
+    usageClip();	
+    exit(1);
+  }
+
+
+  optind++;
+
+  try{
+    ifstream fin;
+    ofstream fout;
+
+#ifdef NO_NOCREATE
+    fin.open(argv[optind], ios::in|ios::ate);
+#else 
+    fin.open(argv[optind], ios::in|ios::ate|ios::nocreate);
+#endif 
+    if(!fin){
+      throw Notify(Notify::FATAL, "main", (static_cast<std::string>("File not found: ")+argv[optind]).c_str());
+    }
+    if(!fin.tellg()){
+      throw Notify(Notify::FATAL, "main", (static_cast<std::string>("Zero length file: ")+argv[optind]).c_str());
+    }
+    fin.seekg(0, ios::beg);
+
+    FASTA thefasta;
+    while(1){
+      try{
+	thefasta.loadNextSeq(fin);
+
+	if(thefasta.testIfEmpty()) {
+	  // no more sequences.
+	  break;
+	}
+	cout << ">" << thefasta.getSeqName().c_str();
+	if(thefasta.getSequence().size()>0) {
+
+	  const char * seq= thefasta.getSequence().c_str();
+	  uint32 slen=thefasta.getSequence().size();
+
+	  uint32 charsout=0;
+	  for(uint32 i=0; i<slen; i++, seq++){
+	    if(i<GLO_cl) continue;
+	    if(i>=GLO_cr) break;
+	    if(charsout%60==0){
+	      cout << "\n";
+	    }
+	    cout << *seq;
+	    charsout++;
+	  }
+	}
+	cout << "\n";
+
+      }
+      catch(Notify n){
+	n.setGravity(Notify::WARNING);
+	n.handleError("main");
+	cerr << "Read " << thefasta.getSeqName().c_str() << " thrown out." << endl;
+	exit(10);
+      }
+    }
+    
+    fin.close();
+  }
+  catch(Notify n) {
+    n.handleError("main");
+    exit(1);
+  }
+
+  return 0;
+}
+
+int main(int argc, char **argv)
+{
+  if(argc<2){
+    usageTool();
+    exit(1);
+  }
+
+  string toolchosen=argv[1];
+  std::transform(toolchosen.begin(),
+		 toolchosen.end(),
+		 toolchosen.begin(), 
+		 (int(*)(int))std::tolower); // now, that's what I call ugly
+
+  if(toolchosen=="sanitize"){
+    mainSanitize(argc,argv);
+  }else if(toolchosen=="clip"){
+    mainClip(argc,argv);
+    //}else if(toolchosen=="bla"){
+  }else{
+    cout << "ERROR: unknown tool '" << toolchosen << "'\n\n";
+    usageTool();
+    exit(1);
+  }
+
+
+  return 0;
+}
diff --git a/src/progs/me_step1.par b/src/progs/me_step1.par
new file mode 100644
index 0000000..3164fae
--- /dev/null
+++ b/src/progs/me_step1.par
@@ -0,0 +1,27 @@
+#############################################################################################
+# 
+# MIRA EST assembler
+#
+# Step 1 parameter file
+#
+#
+#############################################################################################
+
+# assemble everything possible in this step
+
+COMMON_SETTINGS
+-GE:proout=step1:esps=1
+-SB:lsd=yes
+-AS:nop=1:rbl=20
+-CO:mr=yes:mroir=no:asir=no
+-OUT:orc=yes:orf=yes:org=no:ora=no:ort=no:orh=no
+
+SANGER_SETTINGS
+-AL:ms=15:mo=15:mrs=65:egpl=low
+-CO:emea=15:amgb=yes:amgbemc=yes:amgbnbs=yes
+-ED:ace=no
+
+454_SETTINGS
+-AL:ms=15:mo=15:mrs=65:egpl=low
+-CO:emea=5:amgb=no
+-ED:ace=yes
diff --git a/src/progs/me_step2.par b/src/progs/me_step2.par
new file mode 100644
index 0000000..99910f7
--- /dev/null
+++ b/src/progs/me_step2.par
@@ -0,0 +1,140 @@
+#############################################################################################
+# 
+# MIRA EST assembler
+#
+# Step 2 parameter file
+#
+#
+#############################################################################################
+
+
+-GENERAL
+use_template_information   = no
+
+
+-STRAIN/BACKBONE
+load_straindata		   = yes
+load_backbone		   = no
+
+
+#
+# Skim is the fast all reads against all reads check
+#
+
+-SKIM
+bases_per_hash		  = 16
+hash_save_stepping	  = 4
+percent_required	  = 25
+
+
+
+#
+# Assembly options control basic behaviour 
+#  (number of iterations, resolve repeats etc.)
+#
+
+-ASSEMBLY
+
+rmb_break_loops            = 30             # 
+spoiler_detection	   = no		    # only useful for genomic assemblies
+use_emergency_blacklist    = yes            # 
+use_emergency_search_stop  = yes            # 
+ess_partnerdepth           = 500            # 
+
+			   	     
+-DATAPROCESSING
+
+use_read_extension         = no             # nope
+tag_polyat_at_ends         = no             # reads from step 1
+					    #  already have the tags
+
+
+
+-CLIPPING		   	     
+			   	     
+possible_vector_clip       = yes      # 
+pvc_maxlenallowed	   = 12       #  but only if <=12 bases, else
+				      #  might be splice form 
+quality_clip               = yes      # 
+qc_minimum_quality         = 20       # 
+qc_window_length           = 30       # 
+maskedbase_clip            = yes      # 
+mbc_gap_size               = 15       # 
+mbc_max_front_gap          = 30       # 
+mbc_max_end_gap            = 60       # 
+ensure_minimum_left_clip   = Yes
+minimum_left_clip_required = 25
+set_minimum_left_clip_to   = 30			   
+
+#
+# Align options for controlling the Smith-Waterman (banded) alignment
+#  and the alignment post-processing
+
+# Values are higher: we don't want "weak joins" and completely
+#  different splice forms here
+
+-ALIGN
+
+min_score                  = 30  	    # 
+min_overlap                = 30  	    # 
+min_relative_score         = 75  	    # 
+extra_gap_penalty          = yes  	    # 
+egp_level		   = low
+
+
+#
+# Contig options
+#  Contigs are implemented as intelligent objects who fully control which
+#  sequences they choose to add and which they reject.
+#  They also have routines to recognize misassemblies due to possible
+#  repeats and mark important repeat discerning bases (PRMB = Possible
+#  Repeat Marker Base) or SNPs when running in EST assembly mode
+#
+
+-CONTIG
+
+rej_on_dropinrelscore             = 15      # 
+danger_max_error_rate             = 1       # 
+mark_repeats                      = yes     # 
+min_reads_per_group               = 2       # Min. reads in a group to tag alias: 'mrpg'
+min_groupqual_for_rmb_tagging     = 30      # 
+endread_mark_exclusion_area       = 15      # 
+
+
+#
+# EdIt parameters for controling the integrated automatic editor
+#  which uses available SCF data to resolve conflicts
+#
+
+-EDIT
+
+automatic_contig_editing   = no             # edit contigs using scf data? alias: 'ace'
+
+
+#
+# Options for controling which results to write and to which type of files
+#
+
+-OUTPUT			   
+
+output_result_caf          = yes      # output in caf format;       alias: 'orc'
+output_result_gap4da       = yes      # output as gap4 dir.ass.for. alias: 'orf'
+output_result_fasta        = yes      # output in fasta format      alias: 'org'
+output_result_ace          = no       # output in ace format        alias: 'ora'
+output_result_text         = no       # output in text format       alias: 'ort'
+output_result_html         = no       # output in html format       alias: 'orh'
+output_result_tcs          = no       # output in html format       alias: 'orh'
+			         				   
+output_tmpresult_caf       = no       # temporary resultsare        alias: 'otc'
+output_tmpresult_gap4da    = no       #  results after each         alias: 'otg'
+output_tmpresult_fasta     = no       #  main loop.		    alias: 'otf'
+output_tmpresult_ace       = no       # 			    alias: 'ota'
+output_tmpresult_text      = no       # 			    alias: 'ott'
+output_tmpresult_html      = no       # 			    alias: 'oth'
+
+output_exttmpresult_caf    = no       # extra temporary results     alias: 'oetc'
+output_exttmpresult_gap4da = no       #  can happen inbetween a     alias: 'oetg'
+output_exttmpresult_fasta  = no       #  loop if, e.g., a contig    alias: 'oetf'
+output_exttmpresult_ace    = no       #  must be rebuilt because    alias: 'oeta'
+output_exttmpresult_html   = no       #  of clashes in repeats      alias: 'oeth'
+
diff --git a/src/progs/me_step3.par b/src/progs/me_step3.par
new file mode 100644
index 0000000..c0baedd
--- /dev/null
+++ b/src/progs/me_step3.par
@@ -0,0 +1,152 @@
+#############################################################################################
+# 
+# MIRA EST assembler
+#
+# Step 3 parameter file
+#
+#
+#############################################################################################
+
+
+#
+# General options control a few fundamental behaviours
+#
+
+-GENERAL
+
+filecheck_only             = no       # only check files by load;   alias: 'fo'
+use_template_information   = no      # no more templates present here
+
+-STRAIN/BACKBONE
+load_straindata		   = yes
+load_backbone		   = no
+
+
+#
+# Skim is the fast all reads against all reads check
+#
+
+-SKIM
+bases_per_hash		  = 16
+hash_save_stepping	  = 4
+percent_required	  = 25
+
+
+
+
+#
+# Assembly options control basic behaviour 
+#  (number of iterations, resolve repeats etc.)
+#
+
+-ASSEMBLY
+
+minimum_read_length        = 60             # 
+num_of_passes              = 1              # 
+rmb_break_loops            = 1              # 
+spoiler_detection	   = no		    # only useful for genomic assemblies
+use_emergency_blacklist    = yes            # 
+use_emergency_search_stop  = yes            # 
+ess_partnerdepth           = 500            # 
+
+
+-DATAPROCESSING
+
+use_read_extension         = no             # can't, seqs from step2 are max 
+tag_polyat_at_ends         = yes            # might be new ones in step2
+polybase_window_len        = 7
+polybase_window_maxerrors  = 2
+polybase_window_gracedistance = 9
+
+
+#
+# Clipping options control if and how sequences should be clipped
+#
+			   	     
+-CLIPPING		   	     
+			   	     
+possible_vector_clip       = no       # because we might miss splice forms
+				      #  step1 & 2 should have cared anyway
+quality_clip               = yes      # 
+qc_minimum_quality         = 20       # 
+qc_window_length           = 30       # 
+maskedbase_clip            = yes      # 
+mbc_gap_size               = 15       # 
+mbc_max_front_gap          = 30       # 
+mbc_max_end_gap            = 60       # 
+ensure_minimum_left_clip   = No
+minimum_left_clip_required = 25
+set_minimum_left_clip_to   = 30			   
+
+#
+# Align options for controlling the Smith-Waterman (banded) alignment
+#  and the alignment post-processing
+#
+# set extra_gap_penalty to yes and gap_penalty_level to "est_splitsplices"
+#  to not assemble possible splices with gaps >= 3 bases
+
+-ALIGN
+
+min_score                  = 30  	    # 
+min_overlap                = 30  	    # 
+min_relative_score         = 75  	    # 
+extra_gap_penalty          = yes  	    # 
+egp_level		   = est_splitsplices
+
+
+#
+# Contig options
+#  Contigs are implemented as intelligent objects who fully control which
+#  sequences they choose to add and which they reject.
+#  They also have routines to recognize misassemblies due to possible
+#  repeats and mark important repeat discerning bases (SRM = Strong
+#  Repeat Marker Base) or SNPs when running in EST assembly mode
+#
+
+-CONTIG
+
+rej_on_dropinrelscore             = 12      # bit lower
+mark_repeats                      = yes     # 
+min_reads_per_group               = 1       # Min. reads in a group to tag alias: 'mrpg'
+min_groupqual_for_rmb_tagging     = 30      # 
+endread_mark_exclusion_area       = 9       # 
+
+
+#
+# EdIt parameters for controling the integrated automatic editor
+#  which uses available SCF data to resolve conflicts
+#
+
+-EDIT
+
+automatic_contig_editing   = no             # 
+
+
+#
+# Options for controling which results to write and to which type of files
+#
+
+-OUTPUT			   
+
+output_result_caf          = yes      # output in caf format;       alias: 'orc'
+output_result_gap4da       = yes      # output as gap4 dir.ass.for. alias: 'orf'
+output_result_fasta        = yes      # output in fasta format      alias: 'org'
+output_result_ace          = no       # output in ace format        alias: 'ora'
+output_result_text         = no       # output in text format       alias: 'ort'
+output_result_html         = no       # output in html format       alias: 'orh'
+output_result_tcs          = no       # output in html format       alias: 'orh'
+			         				   
+output_tmpresult_caf       = no       # temporary resultsare        alias: 'otc'
+output_tmpresult_gap4da    = no       #  results after each         alias: 'otg'
+output_tmpresult_fasta     = no       #  main loop.		    alias: 'otf'
+output_tmpresult_ace       = no       # 			    alias: 'ota'
+output_tmpresult_text      = no       # 			    alias: 'ott'
+output_tmpresult_html      = no       # 			    alias: 'oth'
+
+output_exttmpresult_caf    = no       # extra temporary results     alias: 'oetc'
+output_exttmpresult_gap4da = no       #  can happen inbetween a     alias: 'oetg'
+output_exttmpresult_fasta  = no       #  loop if, e.g., a contig    alias: 'oetf'
+output_exttmpresult_ace    = no       #  must be rebuilt because    alias: 'oeta'
+output_exttmpresult_html   = no       #  of clashes in repeats      alias: 'oeth'
+
+
diff --git a/src/progs/mira.C b/src/progs/mira.C
index 388fd38..1c62374 100644
--- a/src/progs/mira.C
+++ b/src/progs/mira.C
@@ -11,61 +11,54 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
+// 	$Id$	
 
-#include <sys/resource.h>     // defines rlimit for getMoreStack()
+//#include <stdlib.h>
 
-#include <boost/algorithm/string.hpp>
+#include <iostream>
+#include <string>
+#include <algorithm>
+ 
+//#include <valgrind/callgrind.h>
 
-#include "errorhandling/errorhandling.H"
-#include "util/fileanddisk.H"
-#include "progs/quirks.H"
-
-#include "modules/mod_mira.H"
-#include "modules/mod_bait.H"
-#include "modules/mod_convert.H"
-#include "modules/mod_diff.H"
-#include "modules/mod_memestim.H"
-#include "modules/mod_mer.H"
-#include "modules/mod_scaffold.H"
-#include "modules/mod_sigconex.H"
-#include "modules/mod_tagsnp.H"
+#include "io/generalio.H"
+#include "mira/assembly.H"
+#include "mira/parameters.H"
 
 #include "version.H"
 
-#ifdef MIRAMEMORC
-#include "memorc/memorc.H"
-#endif
+#ifndef lint
+static char vcid[] = "$Id$";
+#endif /* lint */
 
-using namespace std;
 
 
-// This strange double declaration/definition is no error
-// If the declaration is not there, then for some strange
-//  reason the gcc linker (at least 4.8) will not resolve
-//  the extern declaration in modules/misc.C
-// This occurs only for "char[]" types, not for normal types
-//  like int etc.
-//
-// Very strange
-
-extern const char compileinfo[];
 const char compileinfo[] = {
-#include "compileinfo.itxt.xxd.H"
+#include "compileinfo.itxt.H"
 };
 
+const char step1par[] = {
+//#include "me_step1.par.H"
+};
+const char step2par[] = {
+//#include "me_step2.par.H"
+};
+const char step3par[] = {
+//#include "me_step3.par.H"
+};
 
 
 void doAbort()
@@ -74,57 +67,1577 @@ void doAbort()
   Read::dumpStringContainerStats(cout);
 #endif
 
-  cout << "\n\nVCODE: " MIRAVERSION << endl;
-
   cout << "\n\nFor general help, you will probably get a quicker response on the\n"
     "    MIRA talk mailing list\n"
     "than if you mailed the author directly.\n"
-    "\nTo report bugs or ask for features, please use the SourceForge ticketing\nsystem at:\n"
-    "\thttp://sourceforge.net/p/mira-assembler/tickets/\n"
-    "This ensures that requests do not get lost.\n";
-  exit(100);
+    "\nTo report bugs or ask for features, please use the new ticketing system at:\n"
+    "\thttp://sourceforge.net/apps/trac/mira-assembler/\n"
+    "This ensures that requests don't get lost.\n";
+  abort();
+}
+
+void loadparams(vector<MIRAParameters> & Pv, const string & filename, const char * def)
+{
+  try{
+    if(filename.size()){
+      MIRAParameters::loadParams(filename, Pv);
+    } else if(def!=NULL) {
+      MIRAParameters::parse(def, Pv);
+    }
+  }
+  catch(...) {
+    if(filename.size()){
+      cout << "Error while trying to load parameter file " << filename << endl;
+      cout << "Setting defaults for this step.";
+    }
+    if(def!=NULL) {
+      MIRAParameters::parse(def, Pv);
+    }
+  }
+}
+
+
+void dumpStdMsg()
+{
+  cout << 
+    "To (un-)subscribe the MIRA mailing lists, see:\n"
+    "\thttp://www.chevreux.org/mira_mailinglists.html\n\n"
+    "After subscribing, mail general questions to the MIRA talk mailing list:\n"
+    "\tmira_talk at freelists.org\n\n"
+    "To report bugs or ask for features, please use the new ticketing system at:\n"
+    "\thttp://sourceforge.net/apps/trac/mira-assembler/\n"
+    "This ensures that requests don't get lost.\n\n\n";
+
+  bool addnl=false;
+
+  //if(sizeof(size_t) == 4){
+  //  cout << "Compiled in 32 bit mode.\n";
+  //}else if(sizeof(size_t) == 8){
+  //  cout << "Compiled in 64 bit mode.\n";
+  //}else{
+  //  cout << "Compiled in ??? bit mode.\n";
+  //}
+
+  cout << compileinfo;
+#ifdef CEBUGFLAG
+  cout << "Compiled in debug output mode.\n";
+  addnl=true;
+#endif
+#ifdef TRACEFLAG
+  cout << "Compiled with trace mode.\n";
+  addnl=true;
+#endif
+#ifdef BOUNDTRACKFLAG
+  cout << "Compiled in boundtracking mode.\n";
+  addnl=true;
+#endif
+#ifdef BUGTRACKFLAG
+  cout << "Compiled in bugtracking mode.\n";
+  addnl=true;
+#endif
+#ifdef PARANOIABUGTRACKFLAG
+  cout << "Compiled in paranoia bugtracking mode.\n";
+  addnl=true;
+#endif
+#ifdef ENABLE64
+  cout << "Compiled with ENABLE64 activated.\n";
+  addnl=true;
+#else
+  cout << "Compiled with ENABLE64 de-activated.\n";
+  addnl=true;
+#endif
+
+  cout << "Runtime settings (sorry, for debug):"
+       << "\n\tSize of size_t  : " << sizeof(size_t)
+       << "\n\tSize of uint32  : " << sizeof(uint32)
+       << "\n\tSize of uint32_t: " << sizeof(uint32_t)
+       << "\n\tSize of uint64  : " << sizeof(uint64)
+       << "\n\tSize of uint64_t: " << sizeof(uint64_t)
+       << "\nCurrent system: ";
+  {
+    cout.flush();
+    int tmp=system("uname -a");
+    // don't complain about unused variable
+    (void) tmp;
+  }
+
+  if(addnl) cout << endl;
+}
+  
+
+  
+void dumpCommandlineToFile(Assembly & as, vector<MIRAParameters> & Pv, int argc, char ** argv)
+{
+  string filename;
+  filename=as.buildFileName(-1,"","",
+			    Pv[0].getAssemblyParams().as_outfile_callparams,
+			    "",
+			    Pv[0].getDirectoryParams().dir_info);
+  
+  ofstream fout(filename.c_str(), ios::out | ios::trunc);
+  fout << argv[0];
+  for(int32 i=1; i<argc; i++){
+    fout << " " << argv[i];
+  }
+  fout << endl;
+  fout.close();
+}
+
+
+void miraESTstep1(vector<MIRAParameters> & Pv, const string & csfile, int argc, char ** argv)
+{
+  // step 1
+  // assemble _all_ reads to squeeze out most of the data
+  // assembled reads will be written per strain to a CAF file
+  //  if they're in a contig >= 2 reads or have SRMr/WRMr tags
+    
+  // by setting the AssumeSNPInsteadofRepeats to false, we will have
+  //  SRMB tags set and the assembler will try to resolve what
+  //  it thinks are repeats.
+      
+  vector<string> strainfiles;
+
+  //loadparams(Pv,"me_step1.par", &step1par[0]);
+    
+  Pv[0].setAssemblyPutAssembledWithMIRATags(true);
+
+  cout << "Starting step 1: assembling all reads of all strains." << endl;
+  cout << "Setting some standard parameters.\n";
+  //as.assemble();
+      
+  MIRAParameters::postParsingChanges(Pv);
+  MIRAParameters::dumpAllParams(Pv, cout);
+    
+  Assembly as(Pv, false);
+  dumpCommandlineToFile(as, Pv, argc, argv);
+
+  as.loadSequenceData();
+
+  if(Pv[0].getAssemblyParams().as_filecheck_only==true){
+    cout << "File check only was selected, exiting.";
+  }
+  strainfiles=as.assembleESTs();
+  as.discard();
+  cout << "Finished step 1" << endl;
+  
+  ofstream fout;
+  fout.open(csfile.c_str(), ios::out| ios::trunc);
+  
+  for(uint32 i=0; i<strainfiles.size(); i+=2){
+    fout << strainfiles[i] << "\t" << strainfiles[i+1] << endl;
+  }
+  fout.close();
+}
+
+
+uint32 mests2_contigcount=0;
+uint32 mests2_straini=0;
+ofstream mests2_step2out;
+ofstream mests2_step2strout;
+vector<string> mests2_strainfiles;
+
+void miraESTstep2_contigBuiltCallback(Contig & con, const ReadPool & rp)
+{
+  
+  ++mests2_contigcount;
+
+  ostringstream ostr;
+  if(con.getNumReadsInContig() > 1){
+    ostr << mests2_strainfiles[mests2_straini+1] << "_c" << mests2_contigcount;
+  } else {
+    ostr << mests2_strainfiles[mests2_straini+1] << "_s" << mests2_contigcount;
+  }
+      
+  Read dummy;
+  dummy.setFileNamesFromFASTAName(ostr.str());
+
+  string cons;
+  vector<base_quality_t> quals;
+  con.newConsensusGet(cons, quals);
+  dummy.setSequenceFromString(cons);
+  dummy.setQualities(quals);
+      
+  //cout << "My consensus is: " << cons << endl;
+  //cout << "My read is: " << dummy << endl;
+      
+  for(uint32 j=0; j<cons.size(); j++){
+    if(cons[j]=='*') dummy.changeBaseInSequence('*', 0, j);
+  }
+  con.transposeReadSRMTagsToContig();
+  {
+    const vector<Contig::consensustag_t> & ctags=con.getConsensusTags();
+    for(uint32 j=0; j<ctags.size(); j++){
+      dummy.addTag(ctags[j]);
+    }
+  }
+      
+  {
+    Contig::cccontainer_t & concounts=const_cast<Contig::cccontainer_t&>(con.getConsensusCounts());
+    size_t lbound=0;
+    size_t rbound=concounts.size();
+    Contig::cccontainer_t::iterator ccI=concounts.begin();
+    for(; ccI!=concounts.end(); lbound++, ccI++){
+      if(ccI->total_cov > 1) break;
+    }
+    
+    ccI=concounts.end();
+    for(; ccI!=concounts.begin(); rbound--){
+      if((--ccI)->total_cov>1) break;
+    }
+    
+    
+    //cout << "Clip bounds: " << lbound << "\t" << rbound << endl;
+    
+    //Read::setCoutType(Read::AS_TEXTSHORT);
+    //cout << "Before clipping:\n" << dummy;
+    
+    // single reads will have reversed bounds, but we still
+    // want them as they had some marks in the combined assembly,
+    // so don't set bound for them as it would get them 
+    // completely removed from assembly
+    
+    //if(lbound>rbound) {
+    //  dummy.setClipoffs(0, 1, false);
+    //}else{
+    //  dummy.setClipoffs(lbound, rbound, false);
+    //}
+    
+    //Read::setCoutType(Read::AS_TEXTSHORT);
+    //cout << "After clipping:\n" << dummy;
+    
+  }
+      
+  dummy.removeGapsFromRead();
+  Read::setCoutType(Read::AS_CAF);
+  mests2_step2out << dummy;
+  mests2_step2strout << dummy.getName() << "\t"<< mests2_strainfiles[mests2_straini+1] << '\n';
+
+}
+
+void miraESTstep2(vector<MIRAParameters> & Pv, const string & csfile, int argc, char ** argv)
+{
+  // assemble each strain for itself taking only the good
+  //  reads identified in the previous step
+  // the resulting contigs are transformed into virtual 'reads':
+  //  single coverage at the ends is clipped (exception: reads that
+  //  are completely in single coverage), tags are taken 
+  //  and together with virtual base quality the 'read' gets
+  //  written to a CAF file 
+      
+  //loadparams(Pv,"me_step2.par", &step2par[0]);
+      
+  Pv[0].setAssemblyPutAssembledWithMIRATags(false);
+
+  cout << "Starting step 2: assembling each strain for itself" << endl;
+  
+  MIRAParameters::postParsingChanges(Pv);
+  MIRAParameters::dumpAllParams(Pv, cout);
+    
+  // Load the file of with caf names and strain names 
+  ifstream fin;
+  fin.open(csfile.c_str(), ios::in|ios::ate);
+  if(!fin){
+    throw Notify(Notify::FATAL, "main", (static_cast<std::string>("File not found: ")+csfile.c_str()).c_str());
+  }
+  
+  std::streamoff len_fofn=fin.tellg();
+  if(len_fofn==1){
+    throw Notify(Notify::FATAL, "main", (static_cast<std::string>("Zero length file: ")+csfile.c_str()).c_str());
+  }
+  fin.seekg(0, ios::beg);
+  
+  string filename, sname;
+  while(GeneralIO::readKeyValue(fin, filename, sname)){
+    mests2_strainfiles.push_back(filename);
+    mests2_strainfiles.push_back(sname);
+  }
+  fin.close();
+  
+  
+  
+  mests2_step2out.open("step2_reads.caf", ios::out | ios::trunc);
+  mests2_step2strout.open("step2_straindata_in.txt", ios::out | ios::trunc);
+
+  mests2_step2strout << "# Automatically generated file" << endl;
+  mests2_step2strout << "# You probably don't want to edit it.\n" << endl;
+  for(mests2_straini=0; mests2_straini<mests2_strainfiles.size(); mests2_straini+=2){
+    
+    cout << "Assembly of strain " << mests2_strainfiles[mests2_straini] << "(" << mests2_strainfiles[mests2_straini+1] << ")" << endl;
+
+    Pv[0].generateProjectNames(Pv,"step2_"+mests2_strainfiles[mests2_straini+1]);
+    Pv[0].setAssemblyInfileCAF(const_cast<char *>(mests2_strainfiles[mests2_straini].c_str()));
+    Pv[0].setAssemblyInfileStrainData("step2_straindata_in.txt");
+
+    //P.setAssemblyOutfileCAF((char *)strainfiles[i+1].c_str());
+    //P.setAssemblyOutdirGAP4DA(strainfiles[i+1].c_str());
+    //cout << P;
+
+    Assembly as(Pv, false);
+    
+    bool loadok=true;
+    try{
+      as.loadSequenceData();
+    }
+    catch(Notify n){
+      loadok=false;
+      n.setGravity(Notify::WARNING);
+      n.handleError(" miraESTstep2()");
+    }
+    if(!loadok) continue;
+
+    as.setContigBuiltCallback(miraESTstep2_contigBuiltCallback);
+    as.assemble();
+    //as.saveResults();
+    
+    cout << "Finished assembly, extracting contigs." << endl;
+    
+  }
+  cout << "Closing step2out." << endl;
+  mests2_step2out.close();
+  cout << "Closing step2strout." << endl;
+  mests2_step2strout.close();
+  
+  cout << "Done with step 2." << endl;
 }
 
 
+void miraESTstep3(vector<MIRAParameters> & Pv, int argc, char ** argv)
+{
+  // in the last step, the virtual 'reads' get assembled
+  // by setting AssumeSNPInsteadofRepeats to true, PALV (possible
+  //  allellic variation) or PAVS (possible allellic variation
+  //  with SNP) will be set when conflicts occur instead of SRMB
+  // the assembler will therefore work in cluster-mode and not
+  //  break those 'misassemblies'
+      
+  cout << "Starting step 3:\n\tclustering contigs\n\tfinding possible allelic variances\n\tfinding possible allelic variances with SNP\n\n";
+
+  //loadparams(Pv,"me_step3.par", &step3par[0]);
+
+  Pv[0].setAssemblyPutAssembledWithMIRATags(true);
 
-// usual linux stack size of 8Mb will lead to segfaults in very long
-//  alignments (>15-18k) in align.C
-// therefore, get some more stack, atm 64 Mb
+  Assembly as(Pv, false);
+  
+  as.loadSequenceData();
+  as.assemble();
+  as.saveResults();
+}
 
-void getMoreStack()
+void miraEST(int argc, char ** argv)
 {
-  struct rlimit rl;
-  const rlim_t wantstacksize=64L*1024L*1024L;
 
-  auto result = getrlimit(RLIMIT_STACK, &rl);
-  if (result == 0){
-    //cout << "Have cur " << rl.rlim_cur << endl;
-    //cout << "Have max " << rl.rlim_max << endl;
-    if(rl.rlim_cur<wantstacksize){
-      rl.rlim_cur=wantstacksize;
-      result = setrlimit(RLIMIT_STACK, &rl);
+  cout << "This is miraEST "MIRAVERSION" for EST SNP analysis in strains.\n\n";
+  
+  cout << "Please cite: Chevreux, B., Pfisterer, T., Drescher, B., Driesel, A. J.,\nMueller, W. E., Wetter, T. and Suhai, S. (2004),\nUsing the miraEST Assembler for Reliable and Automated mRNA Transcript\nAssembly and SNP Detection in Sequenced ESTs. Genome Research, 14(6).\n\n";
+  
+  //cout << "miraEST has been de-activated in this development version as necessary adaptations there have not been made yet, sorry.\n";
+  //doAbort();
+
+  dumpStdMsg();
+
+  try{
+    vector<MIRAParameters> X;
+    //loadparams(X,"", &step1par[0]);
+    //loadparams(X,"", &step2par[0]);
+    //loadparams(X,"", &step3par[0]);
+  }
+  catch(...){
+    cout << "Internal error: one of the default parameter files caused an error while parsing, aborting.\n";
+    exit(1000);
+  }
+
+  vector<MIRAParameters> Pv;
+  MIRAParameters::setupStdMIRAParameters(Pv);
+  {
+    MIRAParameters::parse(argc, argv, Pv);
+    cout << "\nParameters parsed without error, perfect.\n\n";
+    MIRAParameters::postParsingChanges(Pv);
+  }
+
+  string csfile="step1_res_cafstrainnames.txt";
+
+  uint32 startstep=Pv[0].getSpecialParams().sp_est_startstep;
+
+  switch(startstep) {
+    case 1 : {
+      miraESTstep1(Pv, csfile, argc, argv);
+     break;
     }
+    case 2 : {
+      miraESTstep2(Pv, csfile, argc, argv);
+      break;
+    }
+    case 3 : {
+      miraESTstep3(Pv, argc, argv);
+      break;
+    }
+  default : {
+    throw Notify(Notify::FATAL, "main", ": miraEST SNP pipeline.step is not 1,2 or 3");
+  }
+  }
+
+  cout << "\n\nEnd of assembly process, thank you for using miraEST." << endl;
+
+//  try{
+//    MIRAParameters X;
+//    loadparams(X,"", &step1par[0]);
+//    loadparams(X,"", &step2par[0]);
+//    loadparams(X,"", &step3par[0]);
+//  }
+//  catch(...){
+//    cout << "Internal error: one of the default parameter files caused an error while parsing, aborting.\n";
+//    exit(1000);
+//  }
+//  
+//  MIRAParameters P;
+//  P.parse(argc, argv);
+//  cout << "\nParameters parsed without error, perfect.\n";
+//  
+//  uint32 opt_startstep=P.getSpecialParams().sp_est_startstep;
+//    
+//  // step 1
+//  // assemble _all_ reads to squeeze out most of the data
+//  // assembled reads will be written per strain to a CAF file
+//  //  if they're in a contig >= 2 reads or have SRMr/WRMr tags
+//    
+//  // by setting the AssumeSNPInsteadofRepeats to false, we will have
+//  //  SRMB tags set and the assembler will try to resolve what
+//  //  it thinks are repeats.
+//      
+//  string csfile="step1_res_cafstrainnames.txt";
+//  vector<string> strainfiles;
+//    
+//  P.setAssemblyPutAssembledWithMIRATags(true);
+//  P.setAssemblyProjectName("step1");
+//  P.generateProjectOutNames();
+//
+//  loadparams(P,"me_step1.par", &step1par[0]);
+//    
+//  P.setAssemblyLoadStrainData(true);
+//  P.setAssemblyMarkRepeats(true);
+//  P.setContigAssumeSNPInsteadofRepeats(false);
+//  if (opt_startstep < 2) {
+//    cout << "Starting step 1: assembling all reads of all strains." << endl;
+//    cout << "Setting some standard parameters.\n";
+//    //as.assemble();
+//      
+//    cout << P;
+//    Assembly as(&P);
+//    
+//    as.loadSequenceData();
+//    if(P.getAssemblyParams().as_filecheck_only==true){
+//      cout << "File check only was selected, exiting.";
+//    }
+//    strainfiles=as.assembleESTs();
+//    as.discard();
+//    cout << "Finished step 1" << endl;
+//    
+//    {
+//      ofstream fout;
+//      fout.open(csfile.c_str(), ios::out| ios::trunc);
+//      
+//      for(uint32 i=0; i<strainfiles.size(); i+=2){
+//	fout << strainfiles[i] << "\t" << strainfiles[i+1] << endl;
+//      }
+//      fout.close();
+//    }
+//  }
+//  
+//  // assemble each strain for itself taking only the good
+//  //  reads identified in the previous step
+//  // the resulting contigs are transformed into virtual 'reads':
+//  //  single coverage at the ends is clipped (exception: reads that
+//  //  are completely in single coverage), tags are taken 
+//  //  and together with virtual base quality the 'read' gets
+//  //  written to a CAF file 
+//      
+//  loadparams(P,"me_step2.par", &step2par[0]);
+//      
+//  P.setAssemblyPutAssembledWithMIRATags(false);
+//  P.setAssemblyInfileWhich(LOAD_CAF);
+//  P.setAssemblyMarkRepeats(true);
+//  P.setContigAssumeSNPInsteadofRepeats(false);
+//
+//  if(opt_startstep < 3){
+//    cout << "Starting step 2: assembling each strain for itself" << endl;
+//
+//    cout << P;
+//
+//    // Load the file of with caf names and strain names 
+//    ifstream fin;
+//    fin.open(csfile.c_str(), ios::in|ios::ate);
+//    if(!fin){
+//      throw Notify(Notify::FATAL, "main", csfile.c_str(), ": File not found.");
+//    }
+//	
+//    uint32 len_fofn=fin.tellg();
+//    if(len_fofn==1){
+//      throw Notify(Notify::FATAL, "main", csfile.c_str(), ": Zero length file");
+//    }
+//    fin.seekg(0, ios::beg);
+//	
+//    strainfiles.clear();
+//    string filename, sname;
+//    while(GeneralIO::readKeyValue(fin, filename, sname)){
+//      strainfiles.push_back(filename);
+//      strainfiles.push_back(sname);
+//    }
+//    fin.close();
+//	
+//
+//
+//    ofstream step2out("step2_reads.caf", ios::out | ios::trunc);
+//    ofstream step2strout("step2_straindata.txt", ios::out | ios::trunc);
+//    step2strout << "# Automatically generated file" << endl;
+//    step2strout << "# You probably don't want to edit it.\n" << endl;
+//    for(uint32 i=0; i<strainfiles.size(); i+=2){
+//	    
+//      cout << "Assembly of strain " << strainfiles[i] << "(" << strainfiles[i+1] << ")" << endl;
+//
+//      P.setAssemblyProjectName(strainfiles[i+1]);
+//      P.generateProjectNames();
+//      P.setAssemblyInfileCAF((char *)strainfiles[i].c_str());
+//      P.setAssemblyInfileStrainData("step1_straindata_in.txt");
+//      //P.setAssemblyOutfileCAF((char *)strainfiles[i+1].c_str());
+//      //P.setAssemblyOutdirGAP4DA(strainfiles[i+1].c_str());
+//      //cout << P;
+//      Assembly as(&P);
+//
+//      try {
+//	as.loadSequenceData();
+//	as.assemble();
+//	as.saveResults();
+//      }
+//      catch (...) {
+//      }
+//
+//      cout << "Finished assembly, extracting contigs." << endl;
+//	    
+//      list<Contig>::iterator J=as.getContigs().begin();
+//      for(uint32 contigcount=1; J != as.getContigs().end(); J++, contigcount++){
+//	Read dummy;
+//	ostringstream ostr;
+//	if(J->getNumReadsInConsensus() > 1){
+//	  ostr << strainfiles[i+1] << "_c" << contigcount;
+//	} else {
+//	  ostr << strainfiles[i+1] << "_s" << contigcount;
+//	}
+//
+//	dummy.setFileNamesFromFASTAName(ostr.str());
+//	//cout << "Error: dummy.setFileNames((ostr.str()).c_str()) ueberpruefen";
+//	//exit(1);
+//	string cons;
+//	vector<base_quality_t> quals;
+//	J->getConsensus(cons, quals, false, 0);
+//	dummy.setSequenceFromString(cons);
+//	dummy.setQualities(quals);
+//
+//	//cout << "My consensus is: " << cons << endl;
+//	//cout << "My read is: " << dummy << endl;
+//
+//	for(uint32 j=0; j<cons.size(); j++){
+//	  if(cons[j]=='*') dummy.changeBaseInSequence('*', 0, j);
+//	}
+//	J->transposeReadSRMTagsToContig();
+//	{
+//	  const vector<Contig::consensustag_t> & ctags=J->getConsensusTags();
+//	  for(uint32 j=0; j<ctags.size(); j++){
+//	    dummy.addTag(ctags[j]);
+//	  }
+//	}
+//	      
+//	{
+//	  deque<consensus_counts_t> & concounts=const_cast<deque<consensus_counts_t>&>(J->getConsensusCounts());
+//	  int32 lbound=0;
+//	  int32 rbound=concounts.size();
+//	  deque<consensus_counts_t>::iterator ccI=concounts.begin();
+//	  for(; ccI<concounts.end(); lbound++, ccI++){
+//	    if(ccI->coverage > 1) break;
+//	  }
+//		
+//	  ccI=concounts.end();
+//	  for(; ccI!=concounts.begin(); rbound--){
+//	    if((--ccI)->coverage>1) break;
+//	  }
+//
+//
+//	  //cout << "Clip bounds: " << lbound << "\t" << rbound << endl;
+//
+//	  //Read::setCoutType(Read::AS_TEXTSHORT);
+//	  //cout << "Before clipping:\n" << dummy;
+//		
+//	  // single reads will have reversed bounds, but we still
+//	  // want them as they had some marks in the combined assembly,
+//	  // so don't set bound for them as it would get them 
+//	  // completely removed from assembly
+//
+//	  //if(lbound>rbound) {
+//	  //  dummy.setClipoffs(0, 1, false);
+//	  //}else{
+//	  //  dummy.setClipoffs(lbound, rbound, false);
+//	  //}
+//
+//	  //Read::setCoutType(Read::AS_TEXTSHORT);
+//	  //cout << "After clipping:\n" << dummy;
+//
+//	}
+//
+//	dummy.removeGapsFromRead();
+//	Read::setCoutType(Read::AS_CAF);
+//	step2out << dummy;
+//	step2strout << dummy.getName() << "\t"<< strainfiles[i+1] << endl;
+//      }
+//    }
+//    cout << "Closing step2out." << endl;
+//    step2out.close();
+//    cout << "Closing step2strout." << endl;
+//    step2strout.close();
+//
+//    cout << "Done with step 2." << endl;
+//  }
+//
+//  // in the last step, the virtual 'reads' get assembled
+//  // by setting AssumeSNPInsteadofRepeats to true, PALV (possible
+//  //  allellic variation) or PAVS (possible allellic variation
+//  //  with SNP) will be set when conflicts occur instead of SRMB
+//  // the assembler will therefore work in cluster-mode and not
+//  //  break those 'misassemblies'
+//      
+//  if (opt_startstep < 4) {
+//    cout << "\n\n\nStarting step 3:\n\tclustering contigs\n\tfinding possible allelic variances\n\tfinding possible allelic variances with SNP\n\n";
+//
+//    loadparams(P,"me_step3.par", &step3par[0]);
+//
+//    P.setAssemblyPutAssembledWithMIRATags(true);
+//    P.setAssemblyInfileWhich(LOAD_CAF);
+//    P.setAssemblyProjectName("step3");
+//    P.setAssemblyInfileCAF("step2_reads.caf");
+//    P.setAssemblyInfileStrainData("step2_straindata.txt");
+//    P.setAssemblyMarkRepeats(true);
+//    P.setEditAutomaticContigEditing(false);
+//    P.setContigAssumeSNPInsteadofRepeats(true);
+//
+////	  P.setContigMinPRMBCoverage(2);
+////	  P.setAssemblyNumPRMBBreakLoops(1);
+////	  P.setAssemblyNumLoops(1);
+////	  P.setAssemblyClipPossibleVectors(false);
+////	  P.setAssemblyMinLength(80);
+////	  P.setAssemblyReadExtension(true);
+////	  P.setContigEndReadMarkExclusionArea(5);
+////	  P.setAlignGapPenaltyLevel(2);
+////	  //P.setContigRODIRS(5);
+//    
+//    cout << P;
+//    
+//    Assembly as(&P);
+//    
+//    as.loadSequenceData();
+//    as.assemble();
+//    as.saveResults();
+//  }
+//
+//  cout << "\n\nEnd of assembly process, thank you for using miraEST." << endl;
+
+  return;
+}
+
+
+void miraESTold(int argc, char ** argv)
+{
+
+  cout << "This is miraEST "MIRAVERSION" for EST SNP analysis in strains.\n\n";
+  
+  cout << "Please cite: Chevreux, B., Pfisterer, T., Drescher, B., Driesel, A. J.,\nMueller, W. E., Wetter, T. and Suhai, S. (2004),\nUsing the miraEST Assembler for Reliable and Automated mRNA Transcript\nAssembly and SNP Detection in Sequenced ESTs. Genome Research, 14(6).\n\n";
+  
+  cout << "miraEST has been de-activated in this development version as necessary adaptations there have not been made yet, sorry.\n";
+  doAbort();
+
+  dumpStdMsg();
+
+//  try{
+//    MIRAParameters X;
+//    loadparams(X,"", &step1par[0]);
+//    loadparams(X,"", &step2par[0]);
+//    loadparams(X,"", &step3par[0]);
+//  }
+//  catch(...){
+//    cout << "Internal error: one of the default parameter files caused an error while parsing, aborting.\n";
+//    exit(1000);
+//  }
+//  
+//  MIRAParameters P;
+//  P.parse(argc, argv);
+//  cout << "\nParameters parsed without error, perfect.\n";
+//  
+//  uint32 opt_startstep=P.getSpecialParams().sp_est_startstep;
+//    
+//  // step 1
+//  // assemble _all_ reads to squeeze out most of the data
+//  // assembled reads will be written per strain to a CAF file
+//  //  if they're in a contig >= 2 reads or have SRMr/WRMr tags
+//    
+//  // by setting the AssumeSNPInsteadofRepeats to false, we will have
+//  //  SRMB tags set and the assembler will try to resolve what
+//  //  it thinks are repeats.
+//      
+//  string csfile="step1_res_cafstrainnames.txt";
+//  vector<string> strainfiles;
+//    
+//  P.setAssemblyPutAssembledWithMIRATags(true);
+//  P.setAssemblyProjectName("step1");
+//  P.generateProjectOutNames();
+//
+//  loadparams(P,"me_step1.par", &step1par[0]);
+//    
+//  P.setAssemblyLoadStrainData(true);
+//  P.setAssemblyMarkRepeats(true);
+//  P.setContigAssumeSNPInsteadofRepeats(false);
+//  if (opt_startstep < 2) {
+//    cout << "Starting step 1: assembling all reads of all strains." << endl;
+//    cout << "Setting some standard parameters.\n";
+//    //as.assemble();
+//      
+//    cout << P;
+//    Assembly as(&P);
+//    
+//    as.loadSequenceData();
+//    if(P.getAssemblyParams().as_filecheck_only==true){
+//      cout << "File check only was selected, exiting.";
+//    }
+//    strainfiles=as.assembleESTs();
+//    as.discard();
+//    cout << "Finished step 1" << endl;
+//    
+//    {
+//      ofstream fout;
+//      fout.open(csfile.c_str(), ios::out| ios::trunc);
+//      
+//      for(uint32 i=0; i<strainfiles.size(); i+=2){
+//	fout << strainfiles[i] << "\t" << strainfiles[i+1] << endl;
+//      }
+//      fout.close();
+//    }
+//  }
+//  
+//  // assemble each strain for itself taking only the good
+//  //  reads identified in the previous step
+//  // the resulting contigs are transformed into virtual 'reads':
+//  //  single coverage at the ends is clipped (exception: reads that
+//  //  are completely in single coverage), tags are taken 
+//  //  and together with virtual base quality the 'read' gets
+//  //  written to a CAF file 
+//      
+//  loadparams(P,"me_step2.par", &step2par[0]);
+//      
+//  P.setAssemblyPutAssembledWithMIRATags(false);
+//  P.setAssemblyInfileWhich(LOAD_CAF);
+//  P.setAssemblyMarkRepeats(true);
+//  P.setContigAssumeSNPInsteadofRepeats(false);
+//
+//  if(opt_startstep < 3){
+//    cout << "Starting step 2: assembling each strain for itself" << endl;
+//
+//    cout << P;
+//
+//    // Load the file of with caf names and strain names 
+//    ifstream fin;
+//    fin.open(csfile.c_str(), ios::in|ios::ate);
+//    if(!fin){
+//      throw Notify(Notify::FATAL, "main", csfile.c_str(), ": File not found.");
+//    }
+//	
+//    uint32 len_fofn=fin.tellg();
+//    if(len_fofn==1){
+//      throw Notify(Notify::FATAL, "main", csfile.c_str(), ": Zero length file");
+//    }
+//    fin.seekg(0, ios::beg);
+//	
+//    strainfiles.clear();
+//    string filename, sname;
+//    while(GeneralIO::readKeyValue(fin, filename, sname)){
+//      strainfiles.push_back(filename);
+//      strainfiles.push_back(sname);
+//    }
+//    fin.close();
+//	
+//
+//
+//    ofstream step2out("step2_reads.caf", ios::out | ios::trunc);
+//    ofstream step2strout("step2_straindata.txt", ios::out | ios::trunc);
+//    step2strout << "# Automatically generated file" << endl;
+//    step2strout << "# You probably don't want to edit it.\n" << endl;
+//    for(uint32 i=0; i<strainfiles.size(); i+=2){
+//	    
+//      cout << "Assembly of strain " << strainfiles[i] << "(" << strainfiles[i+1] << ")" << endl;
+//
+//      P.setAssemblyProjectName(strainfiles[i+1]);
+//      P.generateProjectNames();
+//      P.setAssemblyInfileCAF((char *)strainfiles[i].c_str());
+//      P.setAssemblyInfileStrainData("step1_straindata_in.txt");
+//      //P.setAssemblyOutfileCAF((char *)strainfiles[i+1].c_str());
+//      //P.setAssemblyOutdirGAP4DA(strainfiles[i+1].c_str());
+//      //cout << P;
+//      Assembly as(&P);
+//
+//      try {
+//	as.loadSequenceData();
+//	as.assemble();
+//	as.saveResults();
+//      }
+//      catch (...) {
+//      }
+//
+//      cout << "Finished assembly, extracting contigs." << endl;
+//	    
+//      list<Contig>::iterator J=as.getContigs().begin();
+//      for(uint32 contigcount=1; J != as.getContigs().end(); J++, contigcount++){
+//	Read dummy;
+//	ostringstream ostr;
+//	if(J->getNumReadsInConsensus() > 1){
+//	  ostr << strainfiles[i+1] << "_c" << contigcount;
+//	} else {
+//	  ostr << strainfiles[i+1] << "_s" << contigcount;
+//	}
+//
+//	dummy.setFileNamesFromFASTAName(ostr.str());
+//	//cout << "Error: dummy.setFileNames((ostr.str()).c_str()) ueberpruefen";
+//	//exit(1);
+//	string cons;
+//	vector<base_quality_t> quals;
+//	J->getConsensus(cons, quals, false, 0);
+//	dummy.setSequenceFromString(cons);
+//	dummy.setQualities(quals);
+//
+//	//cout << "My consensus is: " << cons << endl;
+//	//cout << "My read is: " << dummy << endl;
+//
+//	for(uint32 j=0; j<cons.size(); j++){
+//	  if(cons[j]=='*') dummy.changeBaseInSequence('*', 0, j);
+//	}
+//	J->transposeReadSRMTagsToContig();
+//	{
+//	  const vector<Contig::consensustag_t> & ctags=J->getConsensusTags();
+//	  for(uint32 j=0; j<ctags.size(); j++){
+//	    dummy.addTag(ctags[j]);
+//	  }
+//	}
+//	      
+//	{
+//	  deque<consensus_counts_t> & concounts=const_cast<deque<consensus_counts_t>&>(J->getConsensusCounts());
+//	  int32 lbound=0;
+//	  int32 rbound=concounts.size();
+//	  deque<consensus_counts_t>::iterator ccI=concounts.begin();
+//	  for(; ccI<concounts.end(); lbound++, ccI++){
+//	    if(ccI->coverage > 1) break;
+//	  }
+//		
+//	  ccI=concounts.end();
+//	  for(; ccI!=concounts.begin(); rbound--){
+//	    if((--ccI)->coverage>1) break;
+//	  }
+//
+//
+//	  //cout << "Clip bounds: " << lbound << "\t" << rbound << endl;
+//
+//	  //Read::setCoutType(Read::AS_TEXTSHORT);
+//	  //cout << "Before clipping:\n" << dummy;
+//		
+//	  // single reads will have reversed bounds, but we still
+//	  // want them as they had some marks in the combined assembly,
+//	  // so don't set bound for them as it would get them 
+//	  // completely removed from assembly
+//
+//	  //if(lbound>rbound) {
+//	  //  dummy.setClipoffs(0, 1, false);
+//	  //}else{
+//	  //  dummy.setClipoffs(lbound, rbound, false);
+//	  //}
+//
+//	  //Read::setCoutType(Read::AS_TEXTSHORT);
+//	  //cout << "After clipping:\n" << dummy;
+//
+//	}
+//
+//	dummy.removeGapsFromRead();
+//	Read::setCoutType(Read::AS_CAF);
+//	step2out << dummy;
+//	step2strout << dummy.getName() << "\t"<< strainfiles[i+1] << endl;
+//      }
+//    }
+//    cout << "Closing step2out." << endl;
+//    step2out.close();
+//    cout << "Closing step2strout." << endl;
+//    step2strout.close();
+//
+//    cout << "Done with step 2." << endl;
+//  }
+//
+//  // in the last step, the virtual 'reads' get assembled
+//  // by setting AssumeSNPInsteadofRepeats to true, PALV (possible
+//  //  allellic variation) or PAVS (possible allellic variation
+//  //  with SNP) will be set when conflicts occur instead of SRMB
+//  // the assembler will therefore work in cluster-mode and not
+//  //  break those 'misassemblies'
+//      
+//  if (opt_startstep < 4) {
+//    cout << "\n\n\nStarting step 3:\n\tclustering contigs\n\tfinding possible allelic variances\n\tfinding possible allelic variances with SNP\n\n";
+//
+//    loadparams(P,"me_step3.par", &step3par[0]);
+//
+//    P.setAssemblyPutAssembledWithMIRATags(true);
+//    P.setAssemblyInfileWhich(LOAD_CAF);
+//    P.setAssemblyProjectName("step3");
+//    P.setAssemblyInfileCAF("step2_reads.caf");
+//    P.setAssemblyInfileStrainData("step2_straindata.txt");
+//    P.setAssemblyMarkRepeats(true);
+//    P.setEditAutomaticContigEditing(false);
+//    P.setContigAssumeSNPInsteadofRepeats(true);
+//
+////	  P.setContigMinPRMBCoverage(2);
+////	  P.setAssemblyNumPRMBBreakLoops(1);
+////	  P.setAssemblyNumLoops(1);
+////	  P.setAssemblyClipPossibleVectors(false);
+////	  P.setAssemblyMinLength(80);
+////	  P.setAssemblyReadExtension(true);
+////	  P.setContigEndReadMarkExclusionArea(5);
+////	  P.setAlignGapPenaltyLevel(2);
+////	  //P.setContigRODIRS(5);
+//    
+//    cout << P;
+//    
+//    Assembly as(&P);
+//    
+//    as.loadSequenceData();
+//    as.assemble();
+//    as.saveResults();
+//  }
+//
+//  cout << "\n\nEnd of assembly process, thank you for using miraEST." << endl;
+
+  return;
+}
+
+
+
+void mira(int argc, char ** argv, bool resumeassembly)
+{
+  FUNCSTART("void mira(int argc, char ** argv, bool resumeassembly)");
+
+  cout << "This is MIRA "MIRAVERSION".\n\n";
+  
+  cout << "Please cite: Chevreux, B., Wetter, T. and Suhai, S. (1999), Genome Sequence\nAssembly Using Trace Signals and Additional Sequence Information.\nComputer Science and Biology: Proceedings of the German Conference on\nBioinformatics (GCB) 99, pp. 45-56.\n\n";
+  
+  dumpStdMsg();
+
+  vector<MIRAParameters> Pv;
+  MIRAParameters::setupStdMIRAParameters(Pv);
+
+  if(resumeassembly){
+    cout << "Gaaaaaah ... load command line params" << endl;
+    string filename="REL8593A-5000000_assembly/REL8593A-5000000_d_info/REL8593A-5000000_info_callparameters.txt";
+    ifstream fin;
+    
+    fin.open(filename.c_str(), ios::in);
+    if(!fin){
+      MIRANOTIFY(Notify::FATAL, "File not found. This should have been written earlier by MIRA: " << filename);
+    }
+    string dummy;
+    string paramline;
+    fin >> dummy;
+    while(!fin.eof()){
+      fin >> dummy;
+      paramline+=dummy;
+      paramline+=' ';
+    }
+    fin.close();
+    cout << "Paramline: " << paramline << endl;
+    MIRAParameters::parse(paramline, Pv);
+
   }else{
-    cout << "could not query stack size?\n";
+    MIRAParameters::parse(argc, argv, Pv);
+
+    // some users make the error to use "mira" instead of miraSearchESTSNPs
+    // this code takes care of it:
+    // if start_step >0, then the miraSearchESTSNPs pipeline is used,
+    //  else the normal mira
+    if(Pv[0].getSpecialParams().sp_est_startstep){
+      cout << "\nOooooops? You called the 'mira' executable but have parameters set for the"
+	"\nEST-SNP-Search pipeline set. For this, you have to use the 'miraSearchESTSNPs'"
+	"\nexecutable (sorry).\n\n";
+	doAbort();
+    }
+
+    cout << "\nParameters parsed without error, perfect.\n\n";
+
+    MIRAParameters::postParsingChanges(Pv);
+    MIRAParameters::dumpAllParams(Pv, cout);
+  }
+
+  //exit(0);
+
+  {
+    Assembly as(Pv, resumeassembly);
+
+    if(!resumeassembly) dumpCommandlineToFile(as, Pv, argc, argv);
+    
+    as.loadSequenceData();
+    
+    //doAbort();
+    
+    if(Pv[0].getAssemblyParams().as_filecheck_only==false){
+      try {
+	as.assemble();
+	cout << "\n\n";
+	if(Pv[0].getAssemblyParams().as_keepcontigsinmem) {
+	  cout << "Assembly finished, saving final results.\n\n";
+	  as.saveResults();
+	}
+      }
+      catch(const std::bad_alloc & e){
+	cout << "Ouch, out of memory detected.\n";
+	as.dumpMemInfo();
+	throw;
+      }
+      catch(...){
+	throw;
+      }
+    }
   }
+  //Read::dumpStringContainerStats(cout);
+
+
+  cout << "\n\nEnd of assembly process, thank you for using MIRA." << endl;
+
+  return;
 }
 
-int main(int argc, char ** argv)
+
+
+void miraPre(int argc, char ** argv)
 {
-#ifdef MIRAMEMORC
-  MemORC::setChecking(true);
-#endif
+  cout << "This is MIRA preprocessing "MIRAVERSION".\n\n";
+  
+  cout << "Please cite: Chevreux, B., Wetter, T. and Suhai, S. (1999), Genome Sequence\nAssembly Using Trace Signals and Additional Sequence Information.\nComputer Science and Biology: Proceedings of the German Conference on\nBioinformatics (GCB) 99, pp. 45-56.\n\n";
+  
+  dumpStdMsg();
+
+  vector<MIRAParameters> Pv;
+  MIRAParameters::setupStdMIRAParameters(Pv);
+  Pv[0].generateProjectOutNames(Pv, "pre");
+  MIRAParameters::parseQuickmode(
+    "\n\t-AS:nop=10:rbl=1:sd=no -GE:uti=no"
+    "\n\t-CO:mr=yes:mroir=no:asir=no"
+    "\n\t-SB:lb=0"
+    "\n\t-OUT:orc=no:orf=no:org=no:ora=no:orh=no:ors=no:ort=no"
+    "\n\t-OUT:otc=no:otf=no:otg=no:ota=no:oth=no:ots=no:ott=no"
+    "\n\t-OUT:oetc=no:oetf=no:oetg=no:oeta=no:oeth=no",
+    "", Pv, false, NULL);
+
+  MIRAParameters::parse(argc, argv, Pv);
+  cout << "\nParameters parsed without error, perfect.\n\n";
+  MIRAParameters::postParsingChanges(Pv);
+  MIRAParameters::dumpAllParams(Pv, cout);
+
+  MIRAParameters paramscopy(Pv[0]);
 
-  fixQuirks();
-  getMoreStack();
+  Assembly as(Pv, false);
+  {
+    string filename;
+    filename=as.buildFileName(-1,"","",
+			      Pv[0].getAssemblyParams().as_outfile_callparams,
+			      "",
+			      Pv[0].getDirectoryParams().dir_info);
+    
+    ofstream fout(filename.c_str(), ios::out | ios::trunc);
+    fout << argv[0];
+    for(int32 i=1; i<argc; i++){
+      fout << " " << argv[i];
+    }
+    fout << endl;
+    fout.close();
+  }
+
+  as.loadSequenceData();
+
+  as.prework();
+  
+  //P=paramscopy;
+  //P.generateProjectNames();
+
+  cout << "\n\n\nPreprocessing finished, saving final results.\n\n\n";
+
+  {
+    ReadPool & rp= as.getReadPool();
+    assembly_parameters const & as_params= Pv[0].getAssemblyParams();
+    
+    string filename;
+    filename= as_params.as_projectname_out+"_preprocessed_out.caf";
+    ofstream preout(filename.c_str(), ios::out | ios::trunc);
+    rp.dumpAs(preout,Read::AS_CAF,false);
+    preout.close();
+
+    cout << "Preprocessed reads are now in " << filename << '\n';
+  }
 
+  cout << "\n\nEnd of preprocessing, thank you for using MIRA." << endl;
+
+  return;
+}
+
+void miraClip(int argc, char ** argv)
+{
+  cout << "This is MIRA clipping "MIRAVERSION".\n\n";
+  
+  cout << "Please cite: Chevreux, B., Wetter, T. and Suhai, S. (1999), Genome Sequence\nAssembly Using Trace Signals and Additional Sequence Information.\nComputer Science and Biology: Proceedings of the German Conference on\nBioinformatics (GCB) 99, pp. 45-56.\n\n";
+  
+  dumpStdMsg();
+
+  //cout << "MIRAClip must be reworked, sorry.\n";
+  //doAbort();
+
+  vector<MIRAParameters> Pv;
+  MIRAParameters::setupStdMIRAParameters(Pv);
+  {
+    MIRAParameters::parseQuickmode("--project=miraclip --noclipping","", Pv, false, NULL);
+    MIRAParameters::parse(argc, argv, Pv);
+    cout << "\nParameters parsed without error, perfect.\n\n";
+
+    vector<int> indexesInPv;
+    indexesInPv.push_back(Read::SEQTYPE_SANGER);
+    indexesInPv.push_back(Read::SEQTYPE_454GS20);
+    indexesInPv.push_back(Read::SEQTYPE_SOLEXA);
+
+    cout << "\nMIRA settings specific for MIRAclip:\n";
+    MIRAParameters::dumpDataProcessingParams(Pv, indexesInPv, cout);
+    MIRAParameters::dumpClippingParams(Pv, indexesInPv, cout);
+
+  }
+
+
+
+  Assembly as(Pv, false);
+  {
+    string filename;
+    filename=as.buildFileName(-1,"","",
+			      Pv[0].getAssemblyParams().as_outfile_callparams,
+			      "",
+			      Pv[0].getDirectoryParams().dir_info);
+    
+    ofstream fout(filename.c_str(), ios::out | ios::trunc);
+    fout << argv[0];
+    for(int32 i=1; i<argc; i++){
+      fout << " " << argv[i];
+    }
+    fout << endl;
+    fout.close();
+  }
+
+  as.loadSequenceData();
+
+  cout << "\n\n\nClipping process finished, saving final results.\n\n\n";
+
+  {
+    ReadPool & rp= as.getReadPool();
+    
+    string filename;
+    filename= Pv[0].getAssemblyParams().as_outfile_CAF;
+    ofstream clipout(filename.c_str(), ios::out | ios::trunc);
+    rp.dumpAs(clipout,Read::AS_CAF,false);
+    clipout.close();
+    cout << "Clipped reads are now in: " << filename << '\n';
+  }
+  
+  cout << "\n\nEnd of clipping, thank you for using MIRA." << endl;
+
+  return;
+}
+
+void mme_askChar(const string & question, const string & possibilities, char & answer, const char defchar)
+{
+  bool doloop=true;
+  while(doloop){
+    cout << question << ' ';
+    if(!possibilities.empty()){
+      cout <<"(";
+      std::copy(possibilities.begin(),
+		possibilities.end(),
+		ostream_iterator<char> (cout, "/"));
+      cout << ") ";
+    }
+    if(defchar!=0){
+      cout << "[" << defchar << "] ";
+    }
+    string input;
+    getline(cin,input);
+
+    // empty input, try to get defchar from possibilities if it exists
+    if(input.empty() && defchar!=0) input=defchar;
+    input.resize(1);
+    for(uint32 i=0; i<possibilities.size(); i++){
+      if(input[0] == possibilities[i]) {
+	doloop=false;
+	answer=input[0];
+	break;
+      }
+    }
+  }
+  cout << answer << endl;
+}
+
+void mme_askDoubleNP(const string & question, double & answer, const string & defd)
+{
+  bool doloop=true;
+  while(doloop){
+    cout << question << ' ';
+    if(!defd.empty()){
+      cout << "[" << defd << "] ";
+    }
+    string input;
+    getline(cin,input);
+
+    // empty input, try to get def from possibilities if it exists
+    if(input.empty() && !defd.empty()) {
+      input=defd;
+    }
+    char * pend;
+    answer=strtod(input.c_str(),&pend);
+    doloop=false;
+    
+    // try to parse kilo, mega, giga
+    while(*pend != 0 && isspace(*pend)) pend++;
+    switch(toupper(*pend)){
+    case 0 : break;
+    case 'K' :{
+      answer*=1000;
+      break;
+    }
+    case 'M' :{
+      answer*=1000000;
+      break;
+    }
+    case 'G' :{
+      answer*=1000000000;
+      break;
+    }
+    default : {
+      cout << "Please only use k, m, g as modifiers.\n";
+      doloop=true;
+    }
+    }
+  }
+}
+
+void mme_askDouble(const string & question, double & answer, const string & defd)
+{
+  mme_askDoubleNP(question, answer, defd);
+  cout << answer << endl;
+}
+
+void mme_askInt(const string & question, int64 & answer, const string & defint)
+{
+  double tmp;
+  mme_askDoubleNP(question, tmp, defint);
+  answer=static_cast<int64>(tmp);
+  cout << answer << endl;
+}
+
+
+void miraMemEstimate()
+{
+  cout << "This is MIRA "MIRAVERSION".\n\n";
+  
+  cout << "Please cite: Chevreux, B., Wetter, T. and Suhai, S. (1999), Genome Sequence\nAssembly Using Trace Signals and Additional Sequence Information.\nComputer Science and Biology: Proceedings of the German Conference on\nBioinformatics (GCB) 99, pp. 45-56.\n\n";
+  dumpStdMsg();
+
+  cout << "\n\nmiraMEM helps you to estimate the memory needed to assemble a project.\n"
+    "Please answer the questions below.\n\n"
+    "Defaults are give in square brackets and chosen if you just press return.\n"
+    "Hint: you can add k/m/g modifiers to your numbers to say kilo, mega or giga.\n\n";
+
+  char yesno;
+  char ptype;
+  char denovomapping;
+  int64 seqsize=0;
+
+  int64 numsanreads=0;
+  int64 num454gs20reads=0;
+  int64 num454flxreads=0;
+  int64 num454titaniumreads=0;
+  int64 numsxareads=0;
+  int64 avgsxalen=0;
+  int64 numpbsreads=0;
+  int64 avgpbslen=0;
+  int64 largestcontigexpected=0;
+
+  // computed
+  int64 totalexpectedbases=0;
+  int64 totalreads=0;
+  int64 readsinlargestcontig=0;
+  int64 readbasesinlargestcontig=0;
+
+  mme_askChar("Is it a genome or transcript (EST/tag/etc.) project?",
+	      "ge",
+	      ptype,
+	      'g');
+  if(ptype=='g'){
+    mme_askInt("Size of genome?",
+	       seqsize,
+	       "4.5m");
+    if(seqsize<100) {
+      cout << "A sequence size of less than 100 bases is pretty improbable.\n"
+	   << "Did you forget a modifier (k, m or g) to the number you gave?\n";
+      exit(10);
+    }
+    largestcontigexpected=seqsize;
+    if(largestcontigexpected>30*1000*1000){
+      cout << "Looks like a larger eukaryote, guessing largest chromosome size: 30m\nChange if needed!\n";
+      largestcontigexpected=30*1000*1000;
+    }
+
+    {
+      string tmplc;
+      ostringstream ostr;
+      ostr << largestcontigexpected;
+      tmplc=ostr.str();
+      mme_askInt("Size of largest chromosome?",
+		 largestcontigexpected,
+		 tmplc);
+    }
+
+    mme_askChar("Is it a denovo or mapping assembly?",
+		"dm",
+		denovomapping,
+		'd');
+  }
+
+
+  mme_askInt("Number of Sanger reads?",
+	     numsanreads,
+	     "0");
+  mme_askChar("Are there 454 reads?",
+	      "yn",
+	      yesno,
+	      'n');
+  if(yesno=='y'){
+    mme_askInt("Number of 454 GS20 reads?",
+	       num454gs20reads,
+	       "0");
+    mme_askInt("Number of 454 FLX reads?",
+	       num454flxreads,
+	       "0");
+    mme_askInt("Number of 454 Titanium reads?",
+	       num454titaniumreads,
+	       "0");
+  }
+  mme_askChar("Are there PacBio reads?",
+	      "yn",
+	      yesno,
+	      'n');
+  if(yesno=='y'){
+    mme_askInt("Number of PacBio reads?",
+	       numpbsreads,
+	       "0");
+    mme_askInt("Average PacBio length?",
+	       avgpbslen,
+	       "1100");
+  }
+  mme_askChar("Are there Solexa reads?",
+	      "yn",
+	      yesno,
+	      'n');
+  if(yesno=='y'){
+    mme_askInt("Number of Solexa reads?",
+	       numsxareads,
+	       "0");
+    mme_askInt("Average Solexe length?",
+	       avgsxalen,
+	       "75");
+  }
+
+  totalexpectedbases=numsanreads*1000;
+  totalexpectedbases+=num454gs20reads*120;
+  totalexpectedbases+=num454flxreads*260;
+  totalexpectedbases+=num454titaniumreads*460;
+  totalexpectedbases+=numsxareads*avgsxalen;
+  totalexpectedbases+=numpbsreads*avgpbslen;
+
+  totalreads=numsanreads;
+  totalreads+=num454gs20reads;
+  totalreads+=num454flxreads;
+  totalreads+=num454titaniumreads;
+  totalreads+=numsxareads;
+  totalreads+=numpbsreads;
+
+  if(ptype=='g'){
+    if(denovomapping=='d'){
+      readsinlargestcontig=totalreads/2;
+      readbasesinlargestcontig=totalexpectedbases/2;
+    }else{
+      largestcontigexpected=seqsize;
+      readsinlargestcontig=totalreads;
+      readbasesinlargestcontig=totalexpectedbases;
+
+      // if solexa is mapped, there are less reads due to 
+      //  coverage equivalent mapping and virtual long reads
+      // be conservative, reduce only by 50%
+      if(numsxareads>0){
+	readsinlargestcontig-=numsxareads/2;
+      }
+    }
+  }else{
+    seqsize=50000;
+    largestcontigexpected=seqsize;
+    readsinlargestcontig=50000;
+    readbasesinlargestcontig=readsinlargestcontig*1000; //10k reads times sanger length
+  }
+
+  // account for gaps with 454 reads
+  if(num454flxreads>0 || num454gs20reads>0){
+    largestcontigexpected+=largestcontigexpected/10;
+    readbasesinlargestcontig+=readbasesinlargestcontig/10;
+  }
+
+  //cout << "totalreads: " << totalreads
+  //     << "\nreadsinlargestcontig: " << readsinlargestcontig
+  //     << "\ntotalexpectedbases: " << totalexpectedbases
+  //     << "\nreadbasesinlargestcontig: " << readbasesinlargestcontig
+  //     << endl;
+
+  int64 livereads=totalreads+readsinlargestcontig;
+  int64 livebases=totalexpectedbases+readbasesinlargestcontig;
+
+  //cout << "livereads: " << livereads
+  //     << "\nlivebases: " << livebases << endl;
+
+  double avgcov=static_cast<double>(totalexpectedbases/seqsize);
+  avgcov-=avgcov/8; // in general we have 12% loss of usable data
+
+  int64 numskimhits=static_cast<int64>(avgcov*850000);  // estimate skim hits, very rough
+
+  int64 memneeded=0;
+
+  // what do the reads need?
+  memneeded=
+    livereads*sizeof(Read)       // class size
+    +livereads*200               // additional strings etc.
+    +livereads*4*sizeof(tag_t)   // on average 4 tags per read
+    +livebases*8;                // sequences, qualities, adjustments, base flags
+
+  // new: solexa reads don't have adjustments
+  // yeah, but estimate is already small enough, keep it
+  //memneeded-=(numsxareads*avgsxalen) * 2;
+
+
+  // what does a contig need? 
+  //  (note: the needs for the reads themselves are already 
+  //   accounted for in the section above)
+  memneeded+=
+    readsinlargestcontig*sizeof(Contig::contigread_t)
+    +readsinlargestcontig*sizeof(Contig::out_order_t)
+    +totalreads*9                              /* templates, mapping
+						 allowedrefids */
+    +largestcontigexpected*sizeof(Contig::consensus_counts_t)
+    +largestcontigexpected*10;              // adjustments and some reserve
+
+  int64 memforlargetables=0;
+  // some more overhead by the assembly class
+  memforlargetables+= totalreads*20;
+
+  // get the skim edges accounted
+  int64 skimhitsmem=numskimhits*2*sizeof(skimedges_t);
+  // since 2.9.40 there's the possibility to cap that memory
+  // use default value
+  if(skimhitsmem>1024L*1024*1024){
+    skimhitsmem=2LL*1024*1024*1024;
+    if(numsxareads>0) skimhitsmem*=2;
+  }
+
+  // mem needed for temporary skim need
+  int64 tmpskim=500*1000*1000;
+
+  memforlargetables+=max(skimhitsmem,tmpskim);
+
+  // possible vector leftover clip
+  int64 memforpvlc=0;
+  {
+    // AS_readhitmiss & AS_readhmcovered
+    memforpvlc=totalexpectedbases*8;
+    // overhead of the structures above
+    memforpvlc+=sizeof(vector<uint32>)*totalreads*2;
+    
+    // AS_count_rhm
+    memforpvlc+=totalreads*4;
+  }
+
+  // ok, 1MB of additional small things
+  int64 memneededfordata=memneeded+(1024*1024);
+
+  // experience shows that not all has been accounted for 
+  //  and internal mem caching of memory allocators add another
+  //  layer of RAM needs
+  //
+  // add 40% to estimates
+  //  but not if whe have mapping with Solexas
+  if(denovomapping!='m' && numsxareads==0){
+    memneededfordata+=memneededfordata/100*40;
+    memforlargetables+=memforlargetables/100*40;
+  }
+
+  cout.setf(ios::fixed, ios::floatfield);
+  //cout.setf(ios::showpoint);
+  cout.precision(1);
+
+  cout << "\n\n************************* Estimates *************************\n\n";
+  // last, if it's an EST assembly, there is no seqsize
+
+  if(ptype=='e'){
+    cout << "EST assembly, cannot give coverage estimate. Also, estimates"
+      "\nmay be way off for pathological cases.\n";
+
+  }else{
+    cout << "The contigs will have an average coverage of ~ " << avgcov 
+	 << " (+/- 10%)"
+      "\nEstimates may be way off for pathological cases.\n";
+  }
+
+  cout << "\nRAM estimates:"
+    "\n" << setw(40) << "reads+contigs (unavoidable): ";
+  byteToHumanReadableSize(memneededfordata,cout);
+  cout << "\n" << setw(40) << "large tables (tunable): ";
+  byteToHumanReadableSize(memforlargetables,cout);
+  cout << "\n" << setw(40) << "" << "---------"
+    "\n" << setw(40) << "total (peak): ";
+  byteToHumanReadableSize(memforlargetables+memneededfordata,
+			  cout);
+  cout << "\n\n" << setw(40) << "add if using -CL:pvlc=yes : ";
+  byteToHumanReadableSize(memforpvlc,cout);
+  if(denovomapping=='m' && numsxareads>0){
+    int64 notusingmerge=memneededfordata/100*40;
+    cout << "\n" << setw(40) << "add if setting -CO:msr=no : ";
+    byteToHumanReadableSize(notusingmerge,cout);
+  }
+  cout << "\n\n"
+    "Note that some algorithms might try to grab more memory if"
+    "\nthe need arises and the system has enough RAM. The options"
+    "\nfor automatic memory management control this:"
+    "\n  -AS:amm, -AS:kpmf, -AS:mps"
+    "\nFurther switches that might reduce RAM (at cost of run time"
+    "\nor accuracy):"
+    "\n  -SK:mhim, -SK:mchr (both runtime); -SK:mhpr (accuracy)\n"
+    "*************************************************************\n";
+
+}
+
+
+int main(int argc, char ** argv)
+{
 #ifdef TIMERESTRICTED
   {
     struct stat st;
     int rc=stat(dir_params.dir_log.c_str(),&st);
     struct tm *mytm;
     mytm=localtime(&st.st_mtime);
-
+    
     if(mytm->tm_year > TR_MAXYEAR
        || (mytm->tm_year == TR_MAXYEAR
 	   && mytm->tm_mon >= TR_OUT_MAXMONTH)){
@@ -139,70 +1652,39 @@ int main(int argc, char ** argv)
   //sched_getaffinity(0,sizeof(cpu_set_t),&mask);
   //
   //cout << "Affinity: " << (uint8 *) &mask[0] << endl;
-
-
+  
   string path;
   string miraprog;
 
   splitFullPathAndFileName(argv[0],path,miraprog);
+
+  //std::transform(miraprog.begin(),
+  //		 miraprog.end(),
+  //		 miraprog.begin(), 
+  //		 (int(*)(int))std::tolower); // now, that's what I call ugly
+
   boost::to_lower(miraprog);
 
   try{
-    if(miraprog=="mira"
-      || miraprog=="mira4"){
-      miraMain(argc,argv);
-//    } else if(miraprog=="mirasearchestsnps"){
-//      //miraEST(argc,argv);
-//    } else if(miraprog=="miraclip"){
-//      //miraClip(argc,argv);
-//    } else if(miraprog=="mirapre"){
-//      //miraPre(argc,argv);
-//    } else if(miraprog=="tagsnp"){
-//      tagsnp t;
-//      t.mainTagSNP(argc, argv);
-    } else if(miraprog=="mirapbcorrect"){
-      mainPBCorrect(argc,argv);
-    } else if(miraprog=="miramem"
-	      ||miraprog=="mira4mem"){
-      miraMemEstimate(argc, argv);
-    } else if(miraprog=="dbgreplay"){
-      dbgReplayMain(argc, argv);
-    }else if(miraprog=="mirascaff"
-	     || miraprog=="mira4scaff"){
-      MiraScaffold m;
-      m.mainMiraScaffold(argc, argv);
-    }else if(miraprog=="mirabait"
-	     || miraprog=="mira4bait"){
-      MiraBait m;
-      m.mainMiraBait(argc, argv);
-    }else if(miraprog=="miradiff"
-	     || miraprog=="mira4diff"){
-      MiraDiff m;
-      m.mainMiraDiff(argc, argv);
-    }else if(miraprog=="mirasce"
-	     || miraprog=="mira4dsce"){
-      MiraSCE m;
-      m.mainSignificantContigExtraction(argc, argv);
-    }else if(miraprog=="miramer"
-	     || miraprog=="mira4mer"){
-      MiraMer m;
-      m.mainMiraMer(argc, argv);
-    }else if(miraprog=="miraconvert"
-	     || miraprog=="mira4convert"
-	     || miraprog=="convert_project"
-	     || miraprog=="convert_projectd"){
-      if(miraprog.front()=='c'){
-	cout << "convert_project is a deprecated name for miraconvert, please switch to new name.\n";
-      }
-      ConvPro cp;
-      cp.mainConvPro(argc, argv);
+    if(miraprog=="mira"){
+      mira(argc,argv, false);
+    } else if(miraprog=="miraresume"){
+      mira(argc,argv, true);
+    } else if(miraprog=="mirasearchestsnps"){
+      miraEST(argc,argv);
+    } else if(miraprog=="miraclip"){
+      miraClip(argc,argv);
+    } else if(miraprog=="mirapre"){
+      miraPre(argc,argv);
+    } else if(miraprog=="miramem"){
+      miraMemEstimate();
     } else {
       cout << miraprog << " is a non-recognised program name of MIRA.\n"
 	"The programs SHOULD be named either\n"
-	"\"mira\", \"miraconvert\", \"miramem\", \"mirabait\""
-	"\nAssuming 'mira'\n" << endl;
+	"\"mira\", \"miraResume\", \"miraSearchESTSNPs\", \"miraCLIP\", \"miraPRE\" or \"miraMEM\"" 
+	   "\nAssuming 'mira'\n" << endl;
 
-      miraMain(argc,argv);
+      mira(argc,argv, false);
     }
   }
   catch(Notify n){
@@ -214,7 +1696,7 @@ int main(int argc, char ** argv)
   }
   catch(const std::bad_alloc & e){
     cout << "Out of memory detected, exception message is: ";
-    cout << e.what() << endl;
+    cout << e.what() << endl; 
 
     if(sizeof(size_t) == sizeof(int32)){
       cout << "\nYou are running a 32 bit executable. Please note that the maximum"
@@ -246,7 +1728,7 @@ int main(int argc, char ** argv)
     cout << "Unknown exception caught, aborting the process.\n\nPlease contact: bach at chevreux.org\n\n";
     doAbort();
   }
-
+      
 #ifndef PUBLICQUIET
   Read::dumpStringContainerStats(cout);
 #endif
diff --git a/src/progs/miratest.C b/src/progs/miratest.C
index e18661a..07db889 100644
--- a/src/progs/miratest.C
+++ b/src/progs/miratest.C
@@ -7,427 +7,189 @@
 #include <unistd.h>
 
 #include "stdinc/types.H"
-#include "stdinc/defines.H"
 
-#include "io/fastq-mira.H"
-#include "io/fastq-lh.H"
-
-#include "util/misc.H"
-#include "util/machineinfo.H"
-
-#include "errorhandling/errorhandling.H"
-
-
-#include <boost/filesystem.hpp>
-
-KSEQ_INIT(gzFile, gzread)
-
-using namespace std;
+#include "stdinc/stlincludes.H"
 
+//#include "stringcontainern.H"
 
+#include "mira/gff_parse.H"
 #include "mira/assembly.H"
-#include "mira/readpool_io.H"
-#include "mira/skim.H"
-#include "mira/seqtohash.H"
+#include "mira/assembly_output.H"
+#include "mira/assembly_info.H"
+#include "mira/readpool.H"
+#include "mira/contig.H"
+#include "mira/maf_parse.H"
+#include "EdIt/hypothesen.H"
+#include "examine/scf_look.H"
+#include "caf/caf.H"
+
+#include "mira/indexed_deque.H"
+#include "version.H"
+#include "io/generalio.H"
+#include "io/fastq-lh.H"
+#include "io/gbf.H"
+#include "mira/read.H"
+#include "mira/contig.H"
+#include "util/misc.H"
+#include "util/memusage.H"
 #include "util/dptools.H"
-#include "mira/hashstats.H"
 
 
 
-class A {
-  class B {
-    ~B();
-  };
-};
-
-A::B::~B() {
-  // ...
-}
+vector<MIRAParameters> Pv;
+ReadPool       greadpool(&Pv);
+list<Contig>   gcontigs;
 
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
 
-string revComp(string & s)
-{
-  string ret;
-  for(auto rI=s.rbegin(); rI!=s.rend(); ++rI){
-    if(*rI=='A'){
-      ret.push_back('T');
-    }else if(*rI=='C'){
-      ret.push_back('G');
-    }else if(*rI=='G'){
-      ret.push_back('C');
-    }else{
-      ret.push_back('A');
-    }
-  }
-  return ret;
-}
+//void save()
+//{
+//  assout::saveStrainsAsFASTAQUAL(contigs, readpool, "tstout.padded");
+//}
+//
+//void doit() {
+//  assout::saveFeatureAnalysis(400,         // maxupstream,
+//			      100,         // maxdownstream
+//			      contigs,
+//			      readpool,
+//			      "featureanalysis.txt",
+//			      "featuresummary.txt",
+//			      "featuresequences.txt");
+//}
+//
 
-uint16 str2hash(string & s)
-{
-  uint8 ret=0;
-  for(auto rI=s.begin(); rI!=s.end(); ++rI){
-    ret<<=2;
-    if(*rI=='A'){
-    }else if(*rI=='C'){
-      ret+=1;
-    }else if(*rI=='G'){
-      ret+=2;
-    }else{
-      ret+=3;
-    }
-  }
-  return ret;
-}
 
-/**************************************************************************************************
- **************************************************************************************************/
 
-template<class TVHASH_T>
-void ddbgCorrectReadsInReadpool(ReadPool & rp, HashStatistics<TVHASH_T> & hs)
-{
-  vector<typename HashStatistics<TVHASH_T>::dbgedits_t> edits;
-  for(uint32 rpi=0; rpi<rp.size(); ++rpi){
-    Read & actread=rp[rpi];
-    hs.proposeSDBGEditsForSequence(actread.getClippedSeqAsChar(),
-				   actread.getLenClippedSeq(),
-				   actread.getName().c_str(),
-				   edits);
-    if(!edits.empty()){
-      cout << "Have " << edits.size() << " edits for " << actread.getName() << endl;
-      for(auto erI=edits.rbegin(); erI!=edits.rend(); ++erI){
-	string olds(static_cast<string>(actread.getClippedSeqAsChar()).substr(erI->pos,erI->len));
-	cout << "Could correct " << erI-edits.rbegin() << " " << actread.getName() << " " << erI->pos << " " << erI->pos+erI->len << " " << erI->len;
-	if(olds.size() != erI->replacement.size()) cout << " LENDIFF";
-	cout << "\n" << olds
-	     << "\n" << erI->replacement << endl;
-	//Read::setCoutType(Read::AS_TEXT);
-	//cout << "OLD:\n" << actread << endl;
-	actread.smoothSequenceReplace(erI->pos+actread.getLeftClipoff(),erI->len,erI->replacement);
-	//cout << "NEW:\n" << actread << endl;
-      }
-    }
-  }
-}
 
 
-template<class TVHASH_T>
-void doCorrect(uint32 trimfreq, const string & merfile, HashStatistics<TVHASH_T> & hs)
-{
-  hs.loadHashStatistics(merfile);
 
-  hs.trimHashStatsByFrequencyAND(trimfreq,trimfreq,0);
-  hs.calcKMerForks(trimfreq,true);
-  hs.buildSDBGraphs();
 
-  ReadPool rp1;
-  ReadPoolIO rpio1(rp1);
-  rpio1.setAttributeFASTQQualOffset(33); // in case we load FASTQs
-  ReadGroupLib::ReadGroupID rgid=ReadGroupLib::newReadGroup();
-  rgid.setSequencingType(ReadGroupLib::SEQTYPE_SOLEXA);
+//#include <boost/regex.hpp>
+#include <boost/ptr_container/ptr_vector.hpp>
 
-  string fn("reads2correct.fastq");
-  //string fn("NG-5413_03_SP1.fastq");
 
-  ofstream fout("corrected.fastq");
-
-  rpio1.setAttributeProgressIndicator(true);
-  rpio1.registerFile("fastq", fn, "", rgid, false);
-
-  while(rpio1.loadNextSeqs(1)){
-    cout << rp1[0].getName() << endl;
-    Assembly::findDegeneratePolymerases(rp1);
-    //rp1[0].performHardTrim();
-    ddbgCorrectReadsInReadpool(rp1,hs);
-    rp1.dumpAs(fout,Read::AS_FASTQ,true);
-    rp1.discard();
-  }
-}
-
-
-/**************************************************************************************************
- **************************************************************************************************/
-
-template<class TVHASH_T>
-void hcHuntInPool(ReadPool & rp, HashStatistics<TVHASH_T> & hs)
+class Tbla
 {
-  for(uint32 rpi=0; rpi<rp.size(); ++rpi){
-    Read & actread=rp[rpi];
-    auto res=hs.checkSequenceForSDBGChimeras(actread.getClippedSeqAsChar(),
-					     actread.getLenClippedSeq(),
-					     actread.getName().c_str());
-    if(res){
-      cout << "CHIMERA! " << actread.getName() << endl;
+  vector<vector<uint32> > AS_readhitmiss;
+  vector<vector<uint32> > AS_readhmcovered;
+  vector<uint32>          AS_count_rhm;
+
+  
+
+public:
+  void test(bool before){
+  vector<uint8>  AS_istroublemaker;
+  vector<uint32> AS_allrmbsok;
+  vector<uint32> AS_probablermbsnotok;
+  vector<uint32> AS_weakrmbsnotok;
+    uint32 rps=100000;
+    dumpFile("/proc/self/status",cout);
+    
+    AS_readhitmiss.resize(rps);
+    AS_readhmcovered.resize(rps);
+    AS_count_rhm.resize(rps);
+    
+    if(before){
+      AS_istroublemaker.resize(rps);
+      AS_allrmbsok.resize(rps);
+      AS_probablermbsnotok.resize(rps);
+      AS_weakrmbsnotok.resize(rps);
     }
-  }
-}
-
-
-template<class TVHASH_T>
-void huntChimeras(uint32 trimfreq, const string & merfile, HashStatistics<TVHASH_T> & hs)
-{
-  hs.loadHashStatistics(merfile);
-
-  hs.trimHashStatsByFrequencyAND(trimfreq,trimfreq,0);
-  hs.calcKMerForks(trimfreq,true);
-  hs.buildSDBGraphs();
-
-  ReadPool rp1;
-  ReadPoolIO rpio1(rp1);
-  rpio1.setAttributeFASTQQualOffset(33); // in case we load FASTQs
-  ReadGroupLib::ReadGroupID rgid=ReadGroupLib::newReadGroup();
-  rgid.setSequencingType(ReadGroupLib::SEQTYPE_SOLEXA);
 
-  string fn("reads2correct.fastq");
-  //string fn("NG-5413_03_SP1.fastq");
+    for(uint32 i=0; i<rps; i++) {
+      AS_readhitmiss[i].resize(850,0);
+      AS_readhmcovered[i].resize(850,0);
+    }
+    
+    if(!before){
+      AS_istroublemaker.resize(rps);
+      AS_allrmbsok.resize(rps);
+      AS_probablermbsnotok.resize(rps);
+      AS_weakrmbsnotok.resize(rps);
+    }
 
-  ofstream fout("corrected.fastq");
+    size_t tbs=0;
+    size_t d1=0;
+    size_t d2=0;
+    size_t d3=0;
+    size_t d4=0;
 
-  rpio1.setAttributeProgressIndicator(true);
-  rpio1.registerFile("fastq", fn, "", rgid, false);
+    tbs=estimateMemoryUsageOfContainer(AS_readhmcovered,true,d1,d2,d3,d4);
+    cout << "tbs: " << tbs
+	 << "\nd1: " << d1
+	 << "\nd2: " << d2
+	 << "\nd3: " << d3
+	 << "\nd4: " << d4
+	 << endl;
+      
+//haha!
 
-  while(rpio1.loadNextSeqs(1)){
-    cout << rp1[0].getName() << endl;
-    hcHuntInPool(rp1,hs);
-    rp1.dumpAs(fout,Read::AS_FASTQ,true);
-    rp1.discard();
-  }
-}
+    dumpFile("/proc/self/status",cout);
 
 
-/**************************************************************************************************
- **************************************************************************************************/
-
-#include <iostream>
-#include <iomanip>
-#include <chrono>
-#include <ctime>
-#include <thread>
-
-#include "util/timer.H"
-
-// the function f() does some time-consuming work
-void fH()
-{
-  volatile double d = 0;
-
-  HRTimer ttime;
-  HRTimer mtime;
-  auto mdiff=mtime.diff();
-  for(int n=0; n<10000000; ++n){
-    mtime.reset();
-    for(int m=0; m<10; ++m){
-      d += d*n*m;
+    for(int32 i=rps-1; i>=0; i--) {
+      nukeSTLContainer(AS_readhmcovered[i]);
+      nukeSTLContainer(AS_readhitmiss[i]);
     }
-    mdiff+=mtime.diff();
-  }
-  auto tdiff=ttime.diff();
 
-  cout << "HR Total mtime " << HRTimer::toMicro(mdiff) << endl;
-  cout << "HR Total ttime " << HRTimer::toMicro(tdiff) << endl;
-  cout << "HR Diffs " << HRTimer::toMicro(tdiff)-HRTimer::toMicro(mdiff) << endl;
-}
-
-void fL()
-{
-  volatile double d = 0;
-
-  LRTimer ttime;
-  LRTimer mtime;
-  auto mdiff=mtime.diff();
-  for(int n=0; n<10000000; ++n){
-    mtime.reset();
-    for(int m=0; m<10; ++m){
-      d += d*n*m;
-    }
-    mdiff+=mtime.diff();
+    nukeSTLContainer(AS_readhitmiss);
+    nukeSTLContainer(AS_readhmcovered);
+    nukeSTLContainer(AS_count_rhm);
+    
+    //AS_readhmcovered.resize(rps);
+    //AS_readhitmiss.resize(rps);
+    //AS_count_rhm.resize(rps);
+    //for(uint32 i=0; i<rps; i++) {
+    //  AS_readhitmiss[i].resize(850,0);
+    //  AS_readhmcovered[i].resize(850,0);
+    //}
+    //dumpFile("/proc/self/status",cout);
   }
-  auto tdiff=ttime.diff();
+};
 
-  cout << "LR Total mtime " << LRTimer::toMicro(mdiff) << endl;
-  cout << "LR Total ttime " << LRTimer::toMicro(tdiff) << endl;
-  cout << "LR Diffs " << LRTimer::toMicro(tdiff)-LRTimer::toMicro(mdiff) << endl;
-}
 
-void fC()
-{
-  volatile double d = 0;
-
-  CLRTimer ttime;
-  CLRTimer mtime;
-  auto mdiff=mtime.diff();
-  for(int n=0; n<10000000; ++n){
-    mtime.reset();
-    for(int m=0; m<10; ++m){
-      d += d*n*m;
-    }
-    mdiff+=mtime.diff();
-  }
-  auto tdiff=ttime.diff();
 
-  cout << "CLR Total mtime " << CLRTimer::toMicro(mdiff) << endl;
-  cout << "CLR Total ttime " << CLRTimer::toMicro(tdiff) << endl;
-  cout << "CLR Diffs " << CLRTimer::toMicro(tdiff)-CLRTimer::toMicro(mdiff) << endl;
-}
+//#include <boost/circular_buffer.hpp>
 
-void fM()
+Skim tskim;
+void readpoolload_callback(ReadPool & rp)
 {
-  volatile double d = 0;
-
-  MIRATimer ttime;
-  MIRATimer mtime;
-  auto mdiff=mtime.diff();
-  for(int n=0; n<10000000; ++n){
-    mtime.reset();
-    for(int m=0; m<10; ++m){
-      d += d*n*m;
-    }
-    mdiff+=mtime.diff();
+  int32 rc=tskim.findAdaptorRightClip(rp.back(),9);
+  if(rc >= 0){
+    cout << "Must RC " << rp.back().getName() << " at " << rc << endl;
   }
-  auto tdiff=ttime.diff();
 
-  cout << "CM Total mtime " << MIRATimer::toMicro(mdiff) << endl;
-  cout << "CM Total ttime " << MIRATimer::toMicro(tdiff) << endl;
-  cout << "CM Diffs " << MIRATimer::toMicro(tdiff)-MIRATimer::toMicro(mdiff) << endl;
+  //Read::trashReadNameContainer();
+  rp.discard();
 }
 
-void fS()
-{
-  volatile double d = 0;
-
-  timeval mstart;
-  timeval tstart;
-
-  uint64 mdiff=0;
-
-  gettimeofday(&tstart,nullptr);
-  for(int n=0; n<10000000; ++n){
-    gettimeofday(&mstart,nullptr);
-    for(int m=0; m<10; ++m){
-      d += d*n*m;
-    }
-    mdiff+=diffsuseconds(mstart);
-  }
-  auto tdiff=diffsuseconds(tstart);
 
-  cout << "SR Total mtime " << mdiff << endl;
-  cout << "SR Total ttime " << tdiff << endl;
-  cout << "SR Diffs " << tdiff-mdiff << endl;
-}
-
-int main(int argc, char ** argv)
+void testSkim()
 {
-  FUNCSTART("int main(int argc, char ** argv)");
-
-  auto c_start = std::clock();
-  auto t_start = std::chrono::high_resolution_clock::now();
-  fH();
-  fL();
-  fS();
-  fC();
-  fM();
-  auto c_end = std::clock();
-  auto t_end = std::chrono::high_resolution_clock::now();
-
-  std::cout << std::fixed << std::setprecision(2) << "CPU time used: "
-	    << 1000.0 * (c_end-c_start) / CLOCKS_PER_SEC << " ms\n"
-	    << "Wall clock time passed: "
-	    << std::chrono::duration<double, std::milli>(t_end-t_start).count()
-	    << " ms\n";
-  exit(0);
+  MIRAParameters::setupStdMIRAParameters(Pv);
 
-  //vhash64_t vh(0xf0c06dbcfb02800);
-  vhash64_t vh(18);
-  uint32 bph=4;
-
-  auto rvh(nsvhash::reverseComplement(vh,bph));
-  cout << vh
-       << "\t" << HashStatistics<vhash64_t>::hash2string(vh,bph)
-       << "\t" << rvh
-       << "\t" << HashStatistics<vhash64_t>::hash2string(rvh,bph)
-       << endl;
-
-  vh<<=2;
-  cout << vh
-       << "\t" << HashStatistics<vhash64_t>::hash2string(vh,bph)
-       << endl;
-
-//  string acgt="ACGT";
-//  string kmf="    ";
-//  string kmr;
-//  uint32 counter=0;
-//  for(uint8 x0=0;x0<4;++x0){
-//    for(uint8 x1=0;x1<4;++x1){
-//      for(uint8 x2=0;x2<4;++x2){
-//	for(uint8 x3=0;x3<4;++x3){
-//	  kmf[0]=acgt[x0];
-//	  kmf[1]=acgt[x1];
-//	  kmf[2]=acgt[x2];
-//	  kmf[3]=acgt[x3];
-//	  kmr=revComp(kmf);
-////	  cout << kmf << "\t" << hex <<  str2hash(kmf) << "\t"
-////	       << kmr << "\t" << str2hash(kmr)
-////	       << endl;
-//	  cout << "0x" << hex << str2hash(kmr) << ", ";
-//	  if(++counter%16 == 0 ){
-//	    cout << endl;
-//	  }
-//	}
-//      }
-//    }
-//  }
+  ReadPool adap(&Pv);
+  uint32 dummy;
+  adap.loadDataFromFASTA("adap.fasta",1,dummy,false);
 
-  try{
-    if(argc!=3) {
-      cout << "Need exactly 2 parameters: trimfreq merfile\n";
-      exit(10);
-    }
+  Read tr;
+  tskim.skimStreamPrepare(adap,7,1);
 
-    uint32 trimfreq=atoi(argv[1]);
-    string merfile(argv[2]);
-
-    if(0){
-      auto mhs=HashStatistics<vhash64_t>::loadHashStatisticsFileHeader(merfile);
-      auto bytes=mhs.sizeofhash;
-      if(bytes==8){
-	HashStatistics<vhash64_t> hs;
-	doCorrect(trimfreq,merfile,hs);
-      }else if(bytes==16){
-	HashStatistics<vhash128_t> hs;
-	doCorrect(trimfreq,merfile,hs);
-      }else if(bytes==32){
-	HashStatistics<vhash256_t> hs;
-	doCorrect(trimfreq,merfile,hs);
-      }else if(bytes==64){
-	HashStatistics<vhash512_t> hs;
-	doCorrect(trimfreq,merfile,hs);
-      }else{
-	MIRANOTIFY(true,"Kmer size " << mhs.basesperhash << " with " << bytes << " bytes are not expected here.\n");
-      }
-    }
-
-    if(1){
-      auto mhs=HashStatistics<vhash64_t>::loadHashStatisticsFileHeader(merfile);
-      auto bytes=mhs.sizeofhash;
-      if(bytes==8){
-	HashStatistics<vhash64_t> hs;
-	huntChimeras(trimfreq,merfile,hs);
-      }else if(bytes==16){
-	HashStatistics<vhash128_t> hs;
-	huntChimeras(trimfreq,merfile,hs);
-      }else if(bytes==32){
-	HashStatistics<vhash256_t> hs;
-	huntChimeras(trimfreq,merfile,hs);
-      }else if(bytes==64){
-	HashStatistics<vhash512_t> hs;
-	huntChimeras(trimfreq,merfile,hs);
-      }else{
-	MIRANOTIFY(true,"Kmer size " << mhs.basesperhash << " with " << bytes << " bytes are not expected here.\n");
+  try{
+    tr.setName("testread");
+    tr.setSequenceFromString("NCGCTGCCCAGGTCACACAGCCGGGTGCCGTCAAACACGCCagatcggaagagcggttcagcaggaatgccgagaccgatatcgtatgccgtcttctgct");
+    //  tr.setSequenceFromString("CGCCGCCCTCAACAGCTTTGAAGACGACACGAGCAGGAATGCCGGCTCCACGCCCTACCAGCAGCCAGCCACATGCATCACCAGCAGCACAGCTGCCCAG");
+
+      tskim.findAdaptorRightClip(tr,9);
+
+    ReadPool loadrp(&Pv);
+    //loadrp.loadDataFromFASTQ("gnatest.fastq",2, dummy,false,Read::SEQTYPE_SANGER,false,readpoolload_callback);
+    loadrp.loadDataFromFASTQ("gnatest.fastq",2, dummy,false,Read::SEQTYPE_SANGER,false);
+    vector<int32> dummy(loadrp.size());
+    //tskim.findAdaptorRightClip(loadrp,dummy,-1,9,8);
+    for(uint32 i=0; i<dummy.size(); ++i){
+      dummy[i]=tskim.findAdaptorRightClip(loadrp[i],9);
+      if(dummy[i]>=0){
+    	cout << loadrp[i].getName() << "\t" << dummy[i] << endl;
       }
     }
 
@@ -435,91 +197,98 @@ int main(int argc, char ** argv)
   catch(Notify n){
     n.handleError("main");
   }
-
-  exit(0);
-
-  vector<MIRAParameters> Pv;
-  ReadPool rp1;
-  ReadPool rp2;
-  ReadPoolIO rpio(rp1);
-  ReadGroupLib::ReadGroupID rgid=ReadGroupLib::newReadGroup();
-  rgid.setSequencingType(ReadGroupLib::SEQTYPE_TEXT);
-
-  try{
-    rpio.registerFile("fastq",
-		      "bla.fastq",
-		      "",
-		      rgid,
-		      false);
-    rpio.loadNextSeqs(100);
-    cout << rp1.size() << " " << rp2.size() << endl;;
-    rpio.loadNextSeqs(100);
-    cout << rp1.size() << " " << rp2.size()  << endl;
-
-    rpio.setAttributeReadPool(rp2);
-    rpio.loadNextSeqs(1000);
-    cout << rp1.size() << " " << rp2.size()  << endl;
-    rpio.loadNextSeqs(1000);
-
-
-    exit(0);
-  }
-  catch(Notify n){
-    n.handleError("main");
+  catch(Flow f){
+    cout << "INTERNAL ERROR: Unexpected exception: Flow()\n";
+    exit(100);
   }
+}
+//
+//@HWI-ST525_0039_8_1_3674_2098#AACCAA/2
+//CGGCATCTGCTGAACCGCTCTTCCGATCAGATCGGAAGAGCGTCGTGTAGGGAAAGAGGGAAGATCTCGGTGGTCGCCGTATCATTTAAAAAAAAAAAAG
+//CTTTTTTTTTTTTAAATGATACGGCGACCACCGAGATCTTCCCTCTTTCCCTACACGACGCTCTTCCGATCT GATCGGAAGAGCGGTTCAGCAGATGCCG
+//
+//    GATCGGAAGAGCGGTTCAGCAG ATGCCG
+//// AGATCGGAAGAGCGGTTCAGCAGGAATGCCGAGACCGATCTCGTATGCCGTCTTCTGCTTG
+//// AGATCGGAAGAGCGGTTCAGCAGGAATGCCGAGACCGATATCGTATGCCGTCTTCTGCT
+//// AGATCGGAAGAGCGGTTCAGCAGGAATGCCGAG
+//
+//
+//@HWI-ST525_0039_8_1_5194_8484#CATGCT/2
+//CACTGCCCTACGCGACCAGACAAACGTAGGGGGAACGAGAGCATGCAGATGAAGAAAACGTTCAAACAAGATTCAAGTGTGACATTACTTATGCCGTGGC
+//                                                                    AGATTCAAGTGTGAC
+//GCCACGGCATAAGTAATGTCACACTTGAATCTTGTTTGAACGTTTTC TTCATCTGCATGCTCTCGTTCCCCCTACGTTTGTCTGGTCGCGTAGGGCAGTG
+//                                                CAAGCAGAAGACGGCATACGAGATTCAAGTGTGACTGGAGTTC
+
+
+
+
+#include <boost/regex.hpp> 
+
+
+#include <iostream> 
+ 
+ template < typename T >
+ inline T highbit(T& t)
+ {
+    return t = (((T)(-1)) >> 1) + 1;
+ }
+ 
+ template < typename T >
+ std::ostream& mbin(T value, std::ostream &o)
+ {
+    for ( T bit = highbit(bit); bit; bit >>= 1 )
+    {
+ 	  o << ( ( value & bit ) ? '1' : '0' );
+    }
+    return o;
+ }
 
+#include <boost/thread/thread.hpp>
+#include <unistd.h>
+int main(int argc, char ** argv)
+{
+  cout << boost::thread::hardware_concurrency() << endl;
+  cout << sysconf(_SC_NPROCESSORS_CONF) << endl;
+  cout << sysconf(_SC_NPROCESSORS_ONLN) << endl;
   exit(0);
-
-  cout << "Have " << MachineInfo::getCoresTotal() << " cores" << endl;
-  cout << "Have " << MachineInfo::getMemTotal() << " mem total" << endl;
-  cout << "Have " << MachineInfo::getMemAvail() << " mem avail" << endl;
-
-  srand(1234567);
-
-  string bla("bla");
-  boost::system::error_code ec;
-  try{
-    boost::filesystem::remove_all(bla,ec);
-  }
-  catch(boost::filesystem::filesystem_error fse){
-    cout << fse.what() << endl;
-  }
+  mbin(0xbfffffffffffffff,cout);
+  cout << endl;
+  mbin(0xbfffffffffffffff>>58,cout);
+  cout << endl;
 
   exit(0);
 
-  try {
-    timeval tv;
-    suseconds_t sus=0;
-
-//    gzFile fp;
-//    kseq_t *seq;
-//    fp = gzopen("bla.fastq", "r");
-//    seq = kseq_init(fp);
-//    gettimeofday(&tv,nullptr);
-//    int l;
-//    while ((l = kseq_read(seq)) >= 0);
-//    sus=diffsuseconds(tv);
-//    cout << "timing fastq-lh: " << sus << endl;
-
-
-    FastQ fq;
-
-    gettimeofday(&tv,nullptr);
-    fq.openFile("bla.fastq");
-    while(fq.loadNext()>=0){
-      //cout << fq.getLineCount() << endl;
-      //if(fq.getLineCount()%10000==0) cout << fq.getLineCount() << endl;
-    }
-    cout << fq.getLineCount() << endl;
-    sus=diffsuseconds(tv);
-    cout << "timing fastq-mira: " << sus << endl;
-
+  boost::regex expression("GATCGGAAGAGCGGT");
+
+  //string myr="NCGCTGCCCAGGTCACACAGCCGGGTGCCGTCAAACACGCCagatcggaagagcggttcagcaggaatgccgagaccgatatcgtatgccgtcttctgct";
+  string myr="NCGCTGCCCAGGTCACACAGCCGGGTGCCGTCAAACACGCCagatcggaagagcggtxxxxxxxxxxxx";
+  boost::to_upper(myr);
+
+  std::string::const_iterator start, end; 
+  start = myr.begin(); 
+  end = myr.end(); 
+  boost::match_results<std::string::const_iterator> what; 
+  boost::match_flag_type flags = boost::match_default; 
+  if(regex_search(start, end, what, expression, flags)) { 
+    cout << "match\n";
+    cout << what.position() << endl;
+   } 
+
+  list<boost::regex> expv;
+  expv.resize(1);
+  expv.front()="GATCGGAAGAGCGGT";
+  //expv.push_back("GATCGGAAGAGCGGT$");
+
+  char bla[] = {
+//#include "../mira/solexaadaptorsregex.xxd.H"
+  };
 
+  istringstream b(bla);
 
-  }
-  catch(Notify n){
-    n.handleError("main");
-  }
+  string l;
+  
+  getline(b,l); cout << l;
+  getline(b,l); cout << l;
 
   return 0;
 }
diff --git a/src/progs/par2c.pl b/src/progs/par2c.pl
new file mode 100644
index 0000000..d701109
--- /dev/null
+++ b/src/progs/par2c.pl
@@ -0,0 +1,7 @@
+while (<STDIN>) {
+  foreach $c (split //,) {
+    printf "0x%lx,", ord($c);
+  }
+  printf "\n"
+}
+printf "0x0\n"
diff --git a/src/progs/quirks.C b/src/progs/quirks.C
deleted file mode 100644
index 8fa7b40..0000000
--- a/src/progs/quirks.C
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 2013 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-#include <boost/filesystem.hpp>
-
-#include <iostream>
-
-#include <cstdlib>
-
-// make the "tcmalloc: large alloc" messages from TCMallom disappear
-// by setting the reporting environment variable to a very large value
-// see: http://groups.google.com/group/google-perftools/browse_thread/thread/24a003fc35f3d470?pli=1
-void quietenTCMALLOC()
-{
-  setenv("TCMALLOC_LARGE_ALLOC_REPORT_THRESHOLD",
-	 "1099511627776", // 1 TiB, should be enough to quieten almost everything
-	 0); // "0" means "do not overwrite if already existing"
-}
-
-/*
-  On some systems, Boost::filesystem (at least up to 1.50) throws a standard
-  exception when using some functions: locale::facet::_S_create_c_locale name not valid
-  Only countermeasure possible: setenv
-  Using setlocale or std::locale::global does *NOT* work as workaround (tried and tested)
- */
-void fixLocaleQuirk()
-{
-  try{
-    // this must work
-    boost::filesystem::path fp = boost::filesystem::current_path();
-  }
-  catch(...){
-    // if not, we're on a system with quirks
-    setenv("LC_ALL",
-	   "C",
-	   1);
-
-    std::cout << "Your system seems to be older or have some quirks with locale settings."
-      "\nUsing the LC_ALL=C workaround."
-      "\nIf you don't want that, fix your system ;-)\n";
-  }
-}
-
-
-void fixQuirks()
-{
-  quietenTCMALLOC();
-  fixLocaleQuirk();
-}
-
diff --git a/src/progs/quirks.H b/src/progs/quirks.H
deleted file mode 100644
index f4221bc..0000000
--- a/src/progs/quirks.H
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 2013 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-
-#ifndef _quirks_h_
-#define _quirks_h_
-
-void quietenTCMALLOC();
-void fixLocaleQuirk();
-void fixQuirks();
-
-
-#endif
diff --git a/src/progs/scftool.C b/src/progs/scftool.C
new file mode 100644
index 0000000..eeaad06
--- /dev/null
+++ b/src/progs/scftool.C
@@ -0,0 +1,510 @@
+/*
+ * Written by Bastien Chevreux (BaCh)
+ *
+ * Copyright (C) 2005 and later by Bastien Chevreux
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ * 
+ */
+
+// 	$Id$	
+
+//TODO
+// in SCF an Kommentare Hinweis auf remix setzen
+
+#ifndef lint
+static char vcid[] = "$Id$";
+#endif /* lint */
+
+#include <stdlib.h>
+#include <cstdio>
+#include <math.h>
+#include <limits.h>
+#include <string.h>
+#include <ctype.h>
+
+#include <fstream>
+#include <iostream>
+#include <string>
+
+#include "io/generalio.H"
+#include "io/fasta.H"
+#include "io/phd.H"
+#include "io/scf.H"
+
+#include "util/misc.H"
+#include "mira/read.H"
+
+
+#include "version.H"
+
+void usage_header()
+{
+  cout << "scftool V1.0 (MIRALIB version "MIRALIBVERSION")\n";
+  cout << "Written by Bastien Chevreux (bach at chevreux.org)\n\n";
+}
+
+void usageTool()
+{
+  usage_header();
+  cout << "Provides a set of tools useful when working with SCF trace files.\n\n";
+  cout << "Usage:\n";
+  cout << "  scftool <toolname> <tool parameters>\n\n";
+  cout << "Available tools:\n";
+  cout << "\tconvert\tConverts SCF file(s) to other formats.\n";
+  cout << "\tcut\tCuts a given range of a SCF file into a new SCF file.\n";
+  cout << "\tremix\tCombines trace information of a SCF file with new bases, qualities and\n\t\tpeak values.\n";
+  cout << "\nTo get help on a specific tool, type 'scftool <toolname>'. E.g.: scftool remix\n\n";
+}
+
+void usageRemix()
+{
+  usage_header();
+  cout << "scftool remix\n\n";
+  cout << "Combines trace information of a SCF file with new bases, qualities and peak\nvalues (either in FASTA or PHD format) into a new SCF file.\n\n";
+  cout << "Usage (when using PHD files as input for bases, quals and peaks):\n";
+  cout << "  scftool remix scf_infile phd_infile scf_outfile\n";
+  cout << "Usage (when using FASTA files as input for bases, quals and peaks):\n";
+  cout << "  scftool remix scf_infile bases_infile quals_infile peaks_infile scf_outfile\n";
+  cout << "\n";
+}
+
+void usageCut()
+{
+  usage_header();
+  cout << "scftool cut\n\n";
+  cout << "Cuts the given range out of an SCF file and makes a new SCF out of it.\n\n";
+  cout << "Usage:\n";
+  cout << "  scftool cut infile lower_base_bound upper_base_bound outfile\n";
+  cout << "\n\tbounds: array index is 0! lower bound including, upper bound excluding\n";
+}
+
+void usageConvert()
+{
+  usage_header();
+  cout << "scftool convert\n\n\
+Extracts the information from SCFs given in a file of filenames and converts \n\
+them to other formats.\n\
+\n\
+Usage:\tscftool convert [-a|-c|-e|-f|-p|-s|-t] [-i] in out\n\
+\n\
+\t-i\tswitch\ttreat <in> as single file name instead\n\
+\t\t\t of a file of filenames\n\
+\t-e\tswitch\tconvert to EXP format \n\
+\t\t\t EXP files will be written to 'out' directory\n\
+\t-f\tswitch\tconvert to FASTA format (default)\n\
+\t\t\t Sequence will be written to 'out', quality\n\
+\t\t\t values to 'out'.qual, peak index values to\n\
+\t\t\t 'out'.peak\n\
+\t-a\tswitch\tconvert to ACE format\n\
+\t-c\tswitch\tconvert to CAF format\n\
+\t-p\tswitch\tconvert to PHD format (not implemented yet)\n\
+\t-s\tswitch\tconvert to short readable text format\n\
+\t-t\tswitch\tconvert to readable text format\n\
+\n\
+The file of filenames may contain comment lines (starting with a # sign).\n\
+The filenames in the file of filenames may not contain spaces.\n\
+";
+  exit(2);
+}
+
+int mainRemix(int argc, char **argv)
+{
+
+  if(argc==5) {
+    // remix with PHD
+
+    try{
+      SCF thescf;
+      PHD thephd;
+      
+      thescf.load(argv[2]);
+      
+      thephd.load(argv[3]);
+      
+      const string & seq=thephd.getSequence();
+      thescf.setBases(seq, thephd.getQualities(), thephd.getPeakIndex() );
+      const SCF_Comments * comments =thescf.getComments();
+      if(comments != NULL) {
+	uint32 comlen=strlen(comments);
+	if(comments[comlen-1] != '\n') thescf.addComment("\n");
+      }
+      thescf.addComment("TPSW=scftool remix\n");
+      
+      thescf.save(argv[4]);
+    }
+    catch(Notify n){
+      n.handleError("mainremix PHD");
+      exit(1);
+    }
+    return 0;
+
+  } else if(argc!=7) {
+    if(argc>2) cout << "ERROR: wrong number of parameters for tool 'remix'!\n\n";
+    usageRemix();
+    exit(1);
+  }
+
+  // remix with FASTA
+  
+  try{
+    SCF thescf;
+
+    thescf.load(argv[2]);
+
+    FASTA thefasta;
+    thefasta.load(argv[3], argv[4]);
+
+    string bases=thefasta.getSequence();
+    vector<uint8> quals=thefasta.getQualities();
+    if(thefasta.getSeqName() != thefasta.getQualName()){
+      cerr << "Name of sequences in fasta files for bases and for qualities do not match!\nAborting." << endl;
+      exit(1);
+    }
+
+    thefasta.loadINT(argv[5],1000000);
+    vector<uint32> peaks;
+    {
+      const vector<int32> & lp=thefasta.getINTValues();
+      peaks.reserve(lp.size());
+      for(uint32 i=0; i<lp.size(); i++){
+	peaks.push_back(lp[i]);
+      }
+    }
+    if(thefasta.getSeqName() != thefasta.getQualName()){
+      cerr << "Name of sequences in fasta files for bases and for peaks do not match!\nAborting." << endl;
+      exit(1);
+    }
+
+    thescf.setBases(bases, quals, peaks );
+
+    const SCF_Comments * comments =thescf.getComments();
+    if(comments != NULL) {
+      uint32 comlen=strlen(comments);
+      if(comments[comlen-1] != '\n') thescf.addComment("\n");
+    }
+    thescf.addComment("TPSW=scftool remix\n");
+    thescf.save(argv[6]);
+  }
+  catch(Notify n){
+    n.handleError("mainRemix FASTA");
+    exit(1);
+  }
+
+  return 0;
+}
+
+int mainCut(int argc, char **argv)
+{
+  if(argc!=6) {
+    if(argc>2) cout << "ERROR: wrong number of parameters for tool 'cut'!\n\n";
+    usageCut();
+    return 1;
+  }
+  
+  if(atol(argv[3])>= atol(argv[4])){
+    cout << "ERROR: lowerbound >= upperbound in parameters of tool 'cut'!\n\n";
+    usageCut();
+    return 1;
+  }
+
+  uint32 low=atol(argv[3]);
+  uint32 high=atol(argv[4]);
+
+  try{
+    SCF thescf;
+
+    thescf.load(argv[2]);
+    thescf.cutBases(low,high);
+    thescf.save(argv[5]);
+  }
+  catch(Notify n){
+    n.handleError("mainCut");
+    exit(1);
+  }
+
+
+  return 0;
+}
+
+
+
+
+
+int mainConvert(int argc, char **argv)
+{
+  FUNCSTART("int mainConvert(int argc, char **argv)");
+
+
+  int c;
+  extern char *optarg;
+  extern int optind;
+
+  char opt_targetformat='f';
+  bool opt_iswitch=false;
+
+  while (1){
+    c = getopt(argc, argv, "acefptsih");
+    if(c == -1) break;
+    
+    switch (c) {
+    case 'i': {
+      opt_iswitch=true;
+      break;
+    }
+    case 'p': {
+      cout << argv[0] << " " << argv[1] << ": " << "p switch not implemented!\n";
+      usageConvert();
+    }
+    case 'a': 
+    case 'c': 
+    case 'e': 
+    case 'f':
+    case 's': 
+    case 't': {
+      opt_targetformat=c;
+      break;
+    }
+    case 'h': {
+      usageConvert();
+      exit(0);
+    }
+    case '?': {
+      usageConvert();
+      exit(1);
+    }
+    }
+  }
+
+  if(argc-optind < 2) {
+    usageConvert();
+  }
+
+  if(argc-optind < 3) {
+    cout << argv[0] << " " << argv[1]  << ": " << "Missing either <in> or <out>  file as arguments!\n";
+    usageConvert();
+  }
+
+  if(argc-optind > 3) {
+    cout << argv[0] << " " << argv[1] << ": " << "Whoops, found more than <in> and <out> as arguments left on the command line!\nPerhaps you forgot some \"\" around strings that contain spaces or other special\ncharacters?\n";
+    cout << "Unparsed command line: ";
+    for(optind+=1;optind<argc;optind++) cout <<argv[optind] << " ";  
+    cout << endl;
+    usageConvert();
+  }
+
+  optind++;
+  string fofninfile=argv[optind++];
+  string outfile=argv[optind];
+
+  //cout << "fofn: " << fofninfile << endl;
+  //cout << "out; " << outfile << endl;
+  //exit(0);
+
+  try{
+
+    vector<string> scfnames;
+    if(opt_iswitch) {
+      scfnames.push_back(fofninfile);
+    }else{
+      // Load the file of filenames 
+      ifstream fin;
+      fin.open(fofninfile.c_str(), ios::in|ios::ate);
+      if(!fin){
+	MIRANOTIFY(Notify::FATAL, "File not found: " << fofninfile);
+      }
+      
+      uint32 len_fofn=fin.tellg();
+      if(len_fofn==1){
+	MIRANOTIFY(Notify::FATAL, "Zero length file: "<<fofninfile);
+      }
+      fin.seekg(0, ios::beg);
+      
+      string filename, dummy;
+      while(GeneralIO::readKeyValue(fin, filename, dummy)){
+	scfnames.push_back(filename);
+      }
+      fin.close();
+    }
+
+    ofstream fout1;
+    ofstream fout2;
+    ofstream fout3;
+
+    if(opt_targetformat=='e') {
+      
+      string system_rmdir = (string) "rm -rf "+outfile;
+      string system_mkdir = (string) "mkdir "+outfile;
+      
+      if(system(system_rmdir.c_str())) {
+	MIRANOTIFY(Notify::FATAL, "Could not delete old directory: " << outfile);
+      }
+      if(system(system_mkdir.c_str())) {
+	MIRANOTIFY(Notify::FATAL, "Could not make new directory:"  << outfile);
+      }
+    } else {
+      fout1.open(outfile.c_str(), ios::out);
+      if(!fout1){
+	MIRANOTIFY(Notify::FATAL, "Could not open file for saving: " << outfile);
+      }
+      if(opt_targetformat=='f') {
+	string of=outfile+".qual";
+	fout2.open(of.c_str(), ios::out);
+	if(!fout2){
+	  MIRANOTIFY(Notify::FATAL, "Could not open file for saving: " << of);
+	}
+
+	of=outfile+".peak";
+	fout3.open(of.c_str(), ios::out);
+	if(!fout3){
+	  MIRANOTIFY(Notify::FATAL, "Could not open file for saving: " << of);
+	}
+      }
+    }
+
+
+    vector<string>::const_iterator I=scfnames.begin();
+    Read r;
+    while(I!=scfnames.end()){
+      r.discard();
+      try {
+	r.loadDataFromSCF(*I);
+      }
+      catch(Notify n) {
+	I++;
+	n.setGravity(Notify::WARNING);
+	n.handleError("main - scf loader");
+	continue;
+      }
+      // eliminate the insert size
+      r.setInsize(-1,-1);
+      
+      switch(opt_targetformat) {
+      case 'f': {
+	Read::setCoutType(Read::AS_FASTA);
+	fout1 << r;
+	Read::setCoutType(Read::AS_FASTAQUAL);
+	fout2 << r;
+
+	fout3 << dec;
+	fout3 << ">" << r.getName() << endl;
+
+	SCF thescf;
+	thescf.load(I->c_str());
+
+	uint32 cpl=0;
+	uint32 numbases=thescf.getNumBases();
+	for(uint32 i=0; i<numbases; i++){
+	  fout3 << thescf.getPeakIndex(i) << " ";
+	  if(cpl++==14){
+	    cpl=0;
+	    fout3 << "\n";
+	  }
+	}
+	if(cpl!=0) fout3 << "\n";
+	
+	break;
+      }
+      case 'e': {
+	Read::setCoutType(Read::AS_GAP4DA);
+	string path=outfile+"/"+r.getName()+".exp";
+	fout1.open(path.c_str(), ios::out);
+	if(!fout1){
+	  MIRANOTIFY(Notify::FATAL, "Could not open file for saving: " << path);
+	}
+	fout1 << r;
+	fout1.close();
+	break;
+      }
+      case 'c': {
+	Read::setCoutType(Read::AS_CAF);
+	fout1 << r;
+	break;
+      }
+      case 'a': {
+	Read::setCoutType(Read::AS_ACE);
+	fout1 << r;
+	break;
+      }
+      case 's': {
+	Read::setCoutType(Read::AS_TEXTSHORT);
+	fout1 << r;
+	break;
+      }
+      case 't': {
+	Read::setCoutType(Read::AS_TEXT);
+	fout1 << r;
+	break;
+      }
+      }
+      I++;
+    }
+  
+    if(opt_targetformat=='e') {
+    } else {
+      fout1.close();
+      if(opt_targetformat=='f') {
+	fout2.close();
+	fout3.close();
+      }
+    }
+  }
+  catch(Notify n){
+    n.handleError("mainConvert");
+    exit(1);
+  }
+  
+    
+  return 0;
+}
+
+
+
+
+
+
+int main(int argc, char **argv)
+{
+  if(argc<2){
+    usageTool();
+    exit(1);
+  }
+
+  string toolchosen=argv[1];
+  std::transform(toolchosen.begin(),
+		 toolchosen.end(),
+		 toolchosen.begin(), 
+		 (int(*)(int))std::tolower); // now, that's what I call ugly
+
+  if(toolchosen=="remix"){
+    mainRemix(argc,argv);
+  }else if(toolchosen=="cut"){
+    mainCut(argc,argv);
+  }else if(toolchosen=="convert"){
+    mainConvert(argc,argv);
+    //}else if(toolchosen=="bla"){
+  }else{
+    cout << "ERROR: unknown tool '" << toolchosen << "'\n\n";
+    usageTool();
+    exit(1);
+  }
+
+
+  return 0;
+}
+
diff --git a/src/progs/sw.C b/src/progs/sw.C
new file mode 100644
index 0000000..6d4ee47
--- /dev/null
+++ b/src/progs/sw.C
@@ -0,0 +1,140 @@
+#include <iostream>
+
+//#include "readpool.H"
+#include "mira/parameters.H"
+#include "mira/assembly.H"
+#include "caf/caf.H"
+
+#include "version.H"
+
+
+#ifndef lint
+static char vcid[] = "$Id$";
+#endif /* lint */
+
+
+// 	$Id$	
+
+
+void usage()
+{
+}
+
+
+int main(int argc, char ** argv)
+{
+  FUNCSTART("int main(int argc, char ** argv)");
+
+
+
+  int c;
+  extern char *optarg;
+  extern int optind;
+
+  while (1){
+    c = getopt(argc, argv, "h");
+    if(c == -1) break;
+
+    switch (c) {
+    case 'h': 
+    case '?': 
+      usage();
+      exit(0);
+    }
+  }
+
+  if(argc-optind < 1) {
+    cerr << argv[0] << ": " << "Missing dbfile and queryfile as arguments!\n";
+    usage();
+    exit(1);
+  }
+
+  if(argc-optind < 2) {
+    cerr << argv[0] << ": " << "Missing either dbfile or queryfile as arguments!\n";
+    usage();
+    exit(1);
+  }
+
+  if(argc-optind > 2) {
+    cerr << argv[0] << ": " << "Whoops, found more than dbfile and queryfile as arguments left on the command line!\n";
+    cerr << "Unparsed command line: ";
+    for(;optind<argc;optind++) cerr <<argv[optind] << " ";  
+    cerr << endl;
+    usage();
+    exit(1);
+  }
+
+  string dbfile=argv[optind++];
+  string queryfile=argv[optind];
+
+  if(dbfile=="--help"){
+    usage();
+    exit(0);
+  }
+
+  vector<MIRAParameters> Pv;
+  MIRAParameters::setupStdMIRAParameters(Pv);
+
+  ReadPool dbpool(&Pv), querypool(&Pv);
+  
+  align_parameters & ap= (align_parameters &) Pv[0].getAlignParams();
+  assembly_parameters &as= (assembly_parameters &) Pv[0].getAssemblyParams();
+
+  as.as_clip_possible_vectors=false;
+  ap.al_kmin=100000;
+  ap.al_kmax=100000;
+  ap.al_min_score=100;
+
+  try{
+    uint32 dummy=0;
+    dbpool.loadDataFromFASTA(dbfile,1,dummy, false);
+    dummy=0;
+    querypool.loadDataFromFASTA(queryfile,1,dummy, false);
+
+    Align bla(&Pv[0]);
+    list<AlignedDualSeq> madsl;
+
+    for(int32 iq=0; iq<querypool.size(); iq++) {
+      ProgressIndicator<int32> P (0, dbpool.size()-1);
+      for(int32 id=0; id<dbpool.size(); id++) {
+	bla.acquireSequences((char *) dbpool.getRead(id).getSeqAsChar(),
+			     dbpool.getRead(id).getLenSeq(),
+			     (char *) querypool.getRead(iq).getSeqAsChar(),
+			     querypool.getRead(iq).getLenSeq(),
+			     id, iq, 1, 1, true, 0);
+	
+	//scheisse, banded macht mist
+	
+	madsl.clear();
+	bla.fullAlign(&madsl,false,false);
+	list<AlignedDualSeq>::iterator I;
+	cout << id << "\t" << madsl.size() << endl;
+	{
+	  int32 bestweight=0;
+	  for(I=madsl.begin(); I!=madsl.end(); I++){
+	    //CEBUG("MADSL entry:\n" << *I << endl);
+	    if(I->isValid()==true){
+	      cout << *I;
+	    }
+	  }
+	}
+	madsl.clear();
+	//P.progress(id);
+	cout.flush();
+      }
+    }
+
+    cout << " done.\n";
+
+  }
+  catch(Notify n){
+    n.handleError("main");
+  }
+  catch(Flow f){
+    cerr << "Unexpected exception: Flow()\n";
+  }
+
+  FUNCEND();
+  return 0;
+}
+
diff --git a/src/progs/version.H b/src/progs/version.H
new file mode 100644
index 0000000..cf9b013
--- /dev/null
+++ b/src/progs/version.H
@@ -0,0 +1,30 @@
+#define MIRALIBVERSION "V"VERSION
+
+
+#ifdef PUBLICQUIET
+#define MLV_QUIET ""
+#else
+#define MLV_QUIET "debugmsg "
+#endif
+
+#if DEVELOPMENTVERSION > 0
+#define MLV_VERSION "development"
+#else
+#define MLV_VERSION "production"
+#endif
+
+
+#ifdef TIMERESTRICTED
+#define MLV_TIME ", time restricted"
+#else
+#define MLV_TIME ""
+#endif
+
+
+
+#define MIRAVERSION MIRALIBVERSION" ("MLV_QUIET""MLV_VERSION""MLV_TIME" version)"
+
+
+
+
+
diff --git a/src/scripts/Makefile.am b/src/scripts/Makefile.am
index 8615c15..5887af5 100644
--- a/src/scripts/Makefile.am
+++ b/src/scripts/Makefile.am
@@ -1,13 +1,19 @@
 
-EXTRA_DIST = fixACE4consed.tcl fasta2frag.tcl
+EXTRA_DIST = fastaselect.tcl fastqselect.tcl fixACE4consed.tcl fasta2frag.tcl
 
 install-exec-hook:
+	rm -f $(DESTDIR)$(bindir)/fastaselect.tcl && \
+	cp fastaselect.tcl $(DESTDIR)$(bindir)
+	rm -f $(DESTDIR)$(bindir)/fastqselect.tcl && \
+	cp fastqselect.tcl $(DESTDIR)$(bindir)
 	rm -f $(DESTDIR)$(bindir)/fixACE4consed.tcl && \
 	cp fixACE4consed.tcl $(DESTDIR)$(bindir)
 	rm -f $(DESTDIR)$(bindir)/fasta2frag.tcl && \
 	cp fasta2frag.tcl $(DESTDIR)$(bindir)
 
 uninstall-hook:
+	rm -f $(DESTDIR)$(bindir)/fastaselect.tcl
+	rm -f $(DESTDIR)$(bindir)/fastqselect.tcl
 	rm -f $(DESTDIR)$(bindir)/fixACE4consed.tcl
 	rm -f $(DESTDIR)$(bindir)/fasta2frag.tcl
 
diff --git a/src/scripts/Makefile.in b/src/scripts/Makefile.in
index c20f441..bc0e0e4 100644
--- a/src/scripts/Makefile.in
+++ b/src/scripts/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -36,14 +36,22 @@ host_triplet = @host@
 subdir = src/scripts
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/ax_boost_base.m4 \
-	$(top_srcdir)/m4/ax_boost_filesystem.m4 \
-	$(top_srcdir)/m4/ax_boost_iostreams.m4 \
-	$(top_srcdir)/m4/ax_boost_regex.m4 \
-	$(top_srcdir)/m4/ax_boost_system.m4 \
-	$(top_srcdir)/m4/ax_boost_thread.m4 \
-	$(top_srcdir)/m4/ax_check_zlib.m4 \
-	$(top_srcdir)/m4/ax_lib_expat.m4 $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/config/m4/ax_boost_base.m4 \
+	$(top_srcdir)/config/m4/ax_boost_regex.m4 \
+	$(top_srcdir)/config/m4/ax_boost_thread.m4 \
+	$(top_srcdir)/config/m4/ax_check_zlib.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_std.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_stl.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_namespaces.m4 \
+	$(top_srcdir)/config/m4/ax_lib_expat.m4 \
+	$(top_srcdir)/config/m4/ax_with_perl.m4 \
+	$(top_srcdir)/config/m4/ax_with_prog.m4 \
+	$(top_srcdir)/config/m4/libtool.m4 \
+	$(top_srcdir)/config/m4/ltoptions.m4 \
+	$(top_srcdir)/config/m4/ltsugar.m4 \
+	$(top_srcdir)/config/m4/ltversion.m4 \
+	$(top_srcdir)/config/m4/lt~obsolete.m4 \
+	$(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -62,13 +70,9 @@ AWK = @AWK@
 BITPACKAGE = @BITPACKAGE@
 BLOODYDARWINSTATLIBDIRHACK = @BLOODYDARWINSTATLIBDIRHACK@
 BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
-BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@
-BOOST_IOSTREAMS_LIB = @BOOST_IOSTREAMS_LIB@
 BOOST_LDFLAGS = @BOOST_LDFLAGS@
 BOOST_REGEX_LIB = @BOOST_REGEX_LIB@
-BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@
 BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
-BUNDLETARGET = @BUNDLETARGET@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
@@ -81,7 +85,6 @@ CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -91,13 +94,11 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LDFLAGS = @EXPAT_LDFLAGS@
-EXPAT_LIBS = @EXPAT_LIBS@
 EXPAT_VERSION = @EXPAT_VERSION@
 FGREP = @FGREP@
 FLEX = @FLEX@
 FLEXPP = @FLEXPP@
 GREP = @GREP@
-HAVE_XXD = @HAVE_XXD@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -115,7 +116,6 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
 MIRASTATIC = @MIRASTATIC@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
@@ -132,17 +132,18 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
+SHORTMIRAAUDIENCE = @SHORTMIRAAUDIENCE@
 STRIP = @STRIP@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -176,6 +177,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -191,7 +193,7 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-EXTRA_DIST = fixACE4consed.tcl fasta2frag.tcl
+EXTRA_DIST = fastaselect.tcl fastqselect.tcl fixACE4consed.tcl fasta2frag.tcl
 all: all-am
 
 .SUFFIXES:
@@ -282,15 +284,10 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	if test -z '$(STRIP)'; then \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	      install; \
-	else \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-	fi
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
 mostlyclean-generic:
 
 clean-generic:
@@ -386,12 +383,18 @@ uninstall-am:
 
 
 install-exec-hook:
+	rm -f $(DESTDIR)$(bindir)/fastaselect.tcl && \
+	cp fastaselect.tcl $(DESTDIR)$(bindir)
+	rm -f $(DESTDIR)$(bindir)/fastqselect.tcl && \
+	cp fastqselect.tcl $(DESTDIR)$(bindir)
 	rm -f $(DESTDIR)$(bindir)/fixACE4consed.tcl && \
 	cp fixACE4consed.tcl $(DESTDIR)$(bindir)
 	rm -f $(DESTDIR)$(bindir)/fasta2frag.tcl && \
 	cp fasta2frag.tcl $(DESTDIR)$(bindir)
 
 uninstall-hook:
+	rm -f $(DESTDIR)$(bindir)/fastaselect.tcl
+	rm -f $(DESTDIR)$(bindir)/fastqselect.tcl
 	rm -f $(DESTDIR)$(bindir)/fixACE4consed.tcl
 	rm -f $(DESTDIR)$(bindir)/fasta2frag.tcl
 
diff --git a/src/scripts/fasta2frag.tcl b/src/scripts/fasta2frag.tcl
index b590250..e4ab51e 100755
--- a/src/scripts/fasta2frag.tcl
+++ b/src/scripts/fasta2frag.tcl
@@ -13,17 +13,17 @@
 # modify it under the terms of the GNU General Public License
 # as published by the Free Software Foundation; either version 2
 # of the License, or (at your option) any later version.
-#
+# 
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-#
+# 
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the
-# Free Software Foundation, Inc.,
+# along with this program; if not, write to the 
+# Free Software Foundation, Inc., 
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-#
+# 
 #
 
 #set min 3
@@ -69,7 +69,7 @@ proc fasta2frag::dnamut_basechange {dnaseq} {
 	    incr i
 	}
     }
-
+    
     puts "oldseq: $dnaseq"
     set dnaseq [string replace $dnaseq $cpos $cpos $newbase]
     puts "newseq: $dnaseq"
@@ -99,7 +99,7 @@ proc fasta2frag::dnamut {dnaseq min max} {
     for {set i 1} {$i <= $nummut} {incr i} {
 	puts "mut $i"
 	#set dnaseq [dnamut_basechange $dnaseq]
-
+	
 	#set muttype [expr {int(rand()*3)}]
 	#switch -exact -- $muttype {
 	#    0 { set $dnaseq [dnamut_basechange $dnaseq] }
@@ -117,13 +117,69 @@ proc fasta2frag::dumpfasta {name descline dnaseq fout qualseq qout} {
     if {$opts(-minmut) || $opts(-maxmut)} {
 	set dnaseq [dnamut $dnaseq $opts(-minmut) $opts(-maxmut)]
     }
-
+	
     puts $fout ">$name $descline\n$dnaseq"
     if {[llength $qualseq]} {
 	puts $qout ">$name\n$qualseq"
     }
 }
 
+proc fasta2frag::getStrobeData {dnaseq quals from len} {
+    variable opts
+
+    set retseq ""
+    set retquals {}
+
+    set dnalen [string length $dnaseq]
+
+    set thisstrobe $opts(-strobeon)
+    set totalbases 0
+    set ii 0
+
+    for {} {$totalbases < $len} {incr ii} {
+	incr totalbases
+	set dnapos [expr {($from+$ii)}]
+
+	if {$dnapos < $dnalen || $opts(-c)} {
+	    set realindex [expr {$dnapos%$dnalen}]
+	    append retseq [string index $dnaseq $realindex ]
+	    if {[llength $quals]>0} {
+		lappend retquals [lindex $quals $realindex]
+	    } else {
+		lappend retquals $opts(-q)
+	    }
+	    incr thisstrobe -1
+	    if {$thisstrobe ==0 && $totalbases < $len} {
+		if {1} {
+		    # fixed number of 'N', +/- 20% real advance
+		    # this is how I expect PacBio data to be
+		    for {set i 0} {$i < $opts(-strobeoff)} {incr i} {
+			append retseq n
+			lappend retquals 0
+		    }
+		    # variance of +/- 20%
+		    set iiincr [expr {int($opts(-strobeoff)+(rand() * $opts(-strobeoff) * .4)-($opts(-strobeoff)*.2))}]
+		    incr ii $iiincr
+		    set thisstrobe $opts(-strobeon)
+		} else {
+		    # +/- 20% number of 'N', fixed real advance
+		    # for testing only, this should never be a real world case!
+		    
+		    set fto [expr {int($opts(-strobeoff)+(rand() * $opts(-strobeoff) * .4)-($opts(-strobeoff)*.2))}]
+		    for {set i 0} {$i < $fto} {incr i} {
+			append retseq n
+			lappend retquals 0
+		    }
+		    
+		    incr ii $opts(-strobeoff)
+		    set thisstrobe $opts(-strobeon)
+		}
+	    }
+	}
+    }
+
+    return [list $retseq $retquals]
+}
 
 #proc fasta2frag::getdnafromto {dnaseq from to} {
 #    variable opts
@@ -150,7 +206,7 @@ proc fasta2frag::dumpfasta {name descline dnaseq fout qualseq qout} {
 
 proc fasta2frag::getqualfromto {dnaseq quals from to} {
     variable opts
-
+    
     set qualslen [llength $quals]
 
     set qualseq {}
@@ -160,12 +216,12 @@ proc fasta2frag::getqualfromto {dnaseq quals from to} {
 	    catch {
 		set thisqual [expr {int([lindex $quals [expr {$i%$qualslen}] ] / $opts(-qualdivisor))}]
 	    }
-
+	    
 	    # noqual?
 	    if {$thisqual < 0} {
 		set thisqual $opts(-minqual)
 	    }
-
+	    
 	    if {$thisqual < $opts(-minqual)} {
 		set thisqual $opts(-minqual)
 	    }
@@ -198,15 +254,15 @@ proc fasta2frag::fragASeq {nonamedata name fout quals qout mpout mbout} {
     #close $fid
 
     puts "fragging $name"
-
+    
     #if {[regsub -all -line {^>(.*?)$} $data "" nonamedata] >1} {
     #	puts stderr "More than one sequence in fasta file, aborting."
     #	exit 500
     #}
-
+    
     regsub -all {\n} $nonamedata "" data
     unset nonamedata
-
+    
     # when circularising is on, append first $opts(-l)-1 bases
     #  of sequence to end of sequence (and also quals if present)
     # if strobing, also add $opts(-l)-$opts(-strobeoff) bases
@@ -249,13 +305,10 @@ proc fasta2frag::fragASeq {nonamedata name fout quals qout mpout mbout} {
 	    set fwdname "TF"
 	    set revname "TR"
 	}
-	sanger {
+	default {
 	    set fwdname "_pe.p1"
 	    set revname "_pe.q1"
 	}
-	default {
-	    error "Unrecognised -pairednaming $opt(-pairednaming)"
-	}
     }
 
     set seqid 1
@@ -267,32 +320,79 @@ proc fasta2frag::fragASeq {nonamedata name fout quals qout mpout mbout} {
 	puts $bla
     }
 
-    proc random {{range 100}} {
-	return [expr {25+int(rand()*$range)}]
-    }
-
-    proc getFragLen {from } {
-	variable opts
-	#return [expr {$from+[random $opts(-l)]*2}]
-	return [expr {$from+$opts(-l)}]
-    }
-
-    #for { } {$from < $datalen} { incr from $opts(-i); incr to $opts(-i); incr seqid}
-    for { } {$from < $datalen} { incr from $opts(-i); incr seqid} {
-	#set to [expr {$from+$opts(-l)}]
-	set to [getFragLen $from]
+    for { } {$from < $datalen} { incr from $opts(-i); incr to $opts(-i); incr seqid} {
 	if {$lastflag == 0} {
 	    #puts "$from $to"
-
+	    
 	    if {$to >= $datalen} {
 		set lastflag 1
 	    }
-
+	    
 	    if {$opts(-p) > 0 } {
 		set pairnamef ${name}_${seqid}${fwdname}
 		set pairnamer ${name}_${seqid}${revname}
 		if { $opts(-s) > 0 } {
-		    error "forget about that strobe thingy"
+		    set to2 [expr {$from + $opts(-insert_size)}]
+
+		    if {$to > $datalen} {
+			set to $datalen
+		    }
+		    if {$to2 > $datalen} {
+			set to2 $datalen
+		    }
+
+		    set fractionoff [expr {1.0/$opts(-strobeon)*$opts(-strobeoff)}]
+		    set mult [expr {1.0+$fractionoff}]
+		    set from2 [expr {int($to2 - ($opts(-l)*$mult)) }]
+
+		    if {$to2 <= $datalen} {
+			
+			set rev1 0
+			set rev2 0
+			if { $opts(-r) > 0 } {
+			    if { [expr {$seqid % $opts(-r)}] == 0} {
+				set rev1 1
+				set rev2 1
+			    }
+			}
+			if {$opts(-P)} {
+			    set rev2 [expr {$rev2 ^ 1}]
+			}
+
+			#putz "F: $from $opts(-l)"
+			set bla [getStrobeData $data $quals $from $opts(-l)]
+			set dnaseq [lindex $bla 0]
+			set qualseq [lindex $bla 1]
+			
+			set descline "[expr {$opts(-insert_size)-$opts(-insert_stdev)}] $opts(-insert_size) [expr {$opts(-insert_size)+$opts(-insert_stdev)}] 1 [string length $dnaseq]"
+
+			if {$rev1} {
+			    reverse_seq_qual dnaseq qualseq
+			}
+			dumpfasta $pairnamef$opts(-namesuffix) $descline $dnaseq $fout $qualseq $qout
+			
+			if {$seqid == 1} {
+			    # if we a re working with reversing sequences,
+			    #  force a reverse of the sequence
+			    if { $opts(-r) > 0 } {
+				reverse_seq_qual dnaseq qualseq
+			    }
+			    dumpfasta ${name}$opts(-namesuffix)_${seqid}_a $descline $dnaseq $fout $qualseq $qout
+			}
+
+			#putz "R: $from2 $opts(-l)"
+			set bla [getStrobeData $data $quals $from2 $opts(-l)]
+			set dnaseq [lindex $bla 0]
+			set qualseq [lindex $bla 1]
+			
+			if {$rev2} {
+			    reverse_seq_qual dnaseq qualseq
+			}
+			dumpfasta $pairnamer$opts(-namesuffix) $descline $dnaseq $fout $qualseq $qout
+
+			puts $mpout "$pairnamef$opts(-namesuffix)\t$pairnamer$opts(-namesuffix)"
+			puts $mbout "$pairnamef$opts(-namesuffix)\t$pairnamer$opts(-namesuffix)\tsimplepair"
+		    }
 		} else {
 		    set to2 [expr {$from + $opts(-insert_size)}]
 		    set from2 [expr {$to2 - $opts(-l)}]
@@ -306,46 +406,32 @@ proc fasta2frag::fragASeq {nonamedata name fout quals qout mpout mbout} {
 
 			set rev1 0
 			set rev2 0
-			if { [expr {$seqid % 2}] == 0 } {
-			    switch -exact -- $opts(-r) {
-				FF { }
-				RF { set rev1 1}
-				FR { set rev2 1}
-				RR { set rev1 1; set rev2 1 }
-				default { error "-r $opts(-r) is not known, please use FF, RR, FR, RF."}
-			    }
-			} else {
-			    set tmp $pairnamef
-			    set pairnamef $pairnamer
-			    set pairnamer $tmp
-			    switch -exact -- $opts(-r) {
-				FF { set rev1 1; set rev2 1 }
-				RF { set rev1 1}
-				FR { set rev2 1}
-				RR { }
-				default { error "-r $opts(-r) is not known, please use FF, RR, FR, RF."}
+			if { $opts(-r) > 0 } {
+			    if { [expr {$seqid % $opts(-r)}] == 0} {
+				set rev1 1
+				set rev2 1
 			    }
 			}
-
-			#putz "$pairnamef $rev1\t$pairnamer $rev2"
+			if {$opts(-P)} {
+			    set rev2 [expr {$rev2 ^ 1}]
+			}
 
 			set dnaseq [string range $data $from [expr {$to-1}]]
 			set qualseq [getqualfromto $dnaseq $quals $from $to]
 
-			#puts "quals: $quals"
-			#puts "dnaqualseq: $qualseq"
+			puts "quals: $quals"
+			puts "dnaqualseq: $qualseq"
 
 			set descline "[expr {$opts(-insert_size)-$opts(-insert_stdev)}] $opts(-insert_size) [expr {$opts(-insert_size)+$opts(-insert_stdev)}] 1 [string length $dnaseq]"
 			if {$rev1} {
 			    reverse_seq_qual dnaseq qualseq
 			}
-			#putz "$pairnamef $rev1 $dnaseq"
 			dumpfasta $pairnamef$opts(-namesuffix) $descline $dnaseq $fout $qualseq $qout
-
+			
 			if {$seqid == 1} {
-			    # if we are working with reversing sequences,
+			    # if we a re working with reversing sequences,
 			    #  force a reverse of the sequence
-			    if { $opts(-r) != "FF" } {
+			    if { $opts(-r) > 0 } {
 				reverse_seq_qual dnaseq qualseq
 			    }
 			    dumpfasta ${name}$opts(-namesuffix)_${seqid}_a $descline $dnaseq $fout $qualseq $qout
@@ -356,7 +442,6 @@ proc fasta2frag::fragASeq {nonamedata name fout quals qout mpout mbout} {
 			if {$rev2} {
 			    reverse_seq_qual dnaseq qualseq
 			}
-			#putz "$pairnamer $rev2 $dnaseq"
 			dumpfasta $pairnamer$opts(-namesuffix) $descline $dnaseq $fout $qualseq $qout
 
 			puts $mpout "$pairnamef\t$pairnamer"
@@ -364,25 +449,31 @@ proc fasta2frag::fragASeq {nonamedata name fout quals qout mpout mbout} {
 		    }
 		}
 	    } else {
-		set dnaseq [string range $data $from [expr {$to-1}]]
-		set qualseq [getqualfromto $dnaseq $quals $from $to]
-
-		if { $opts(-r) != "FF" } {
-		    if { [expr {$seqid % 2}] == 0} {
+		if { $opts(-s) > 0 } {
+		    set bla [getStrobeData $data $quals $from $opts(-l)]
+		    set dnaseq [lindex $bla 0]
+		    set qualseq [lindex $bla 1]
+		} else {
+		    set dnaseq [string range $data $from [expr {$to-1}]]
+		    set qualseq [getqualfromto $dnaseq $quals $from $to]
+                }
+	
+		if { $opts(-r) > 0 } {
+		    if { [expr {$seqid % $opts(-r)}] == 0} {
 			reverse_seq_qual dnaseq qualseq
 		    }
 		}
 
 		set descline "1 [string length $dnaseq]"
 		dumpfasta ${name}$opts(-namesuffix)_$seqid $descline $dnaseq $fout $qualseq $qout
-
+		
 		# the very first and very last fragment will be put twice
 		#  into the data set so that every part of the contig
 		#  is covered at least twice
 		if {$seqid == 1 || $lastflag >0 } {
 		    # if we a re working with reversing sequences,
 		    #  force a reverse of the sequence
-		    if { $opts(-r) != "FF" } {
+		    if { $opts(-r) > 0 } {
 			reverse_seq_qual dnaseq qualseq
 		    }
 		    dumpfasta ${name}$opts(-namesuffix)_${seqid}_a $descline $dnaseq $fout $qualseq $qout
@@ -416,7 +507,7 @@ proc fasta2frag::processit {} {
 
     set fin [open $opts(-infile) r]
     set fout [open $opts(-outfile) w]
-
+    
     set havequal 0
     if {[file exist ${opts(-infile)}.qual]} {
 	puts "have qual"
@@ -456,7 +547,7 @@ proc fasta2frag::processit {} {
 		}
 		set quals [loadNextQuals $qin]
 	    }
-
+	    
 	    fragASeq $actseq $seqname $fout $quals $qout $mpout $mbout
 	    incr cid
 	    set actseq ""
@@ -484,30 +575,18 @@ proc fasta2frag::processit {} {
     }
 }
 
-proc fasta2frag::sanitycheck {} {
-    variable opts
-}
-
-proc fasta2frag::parsequick {qstr} {
-    variable opts
-}
-
 proc usage {prgname} {
     puts stderr "$prgname: Splits a single fasta sequence into several
 overlapping fragments.\n"
     puts stderr "Usage: $prgname ?options? infile outfile
-\t-quick   string      ''
 \t-l   int      Length of fragments (default=3000)
 \t-i   int      Increment of fragment start site (default=2500)
-\t-p   int      Paired reads (default=0 is off, 1 is on)
-\t-r   string   In shotgun: 'FF' to not to reverse every second read
-\t              In paired reads mode:
-                  FF: forward-forward
-                  RR: reverse-reverse (Ion Torrent, 454)
-                  FR: forward-reverse (Solexa paired-end)
-                  RF: reverse-forward (Solexa mate-pair)
+\t-p   int      Paired end (default=0 is off, 1 is on)
+\t-P   int      In paired-end mode, reverse one of the reads
+\t               (0 is off, default=1 is on)
 \t-s   int      Strobe sequencing (default=0 is off, 1 is on)
 \t-q   int      Default quality when no quality data present (default=30)
+\t-r   int      Reverse every nth fragment (default=2)
 \t-c   int      Circularise fragments so that they form a ring
                  (default=0 is is off, 1 would be on)
 
@@ -516,8 +595,8 @@ overlapping fragments.\n"
 \t-insert_size  int      paired-end: insert size (default=3000)
 \t-insert_stdev int      paired-end: standard dev (default=900)
 \t                        this is not working at the moment
-\t-pairednaming string   naming scheme for paired-end:
-\t                        sanger, tigr, 454 or solexa (default)
+\t-pairednaming string   naming scheme for paired-end: 
+\t                        sanger, 454 (default) or solexa
 \t-minmut       int      min. number of mutations/seq. errors (def=0)
 \t-maxmut       int      max. number of mutations/seq. errors (def=0)
 \t-strobeon     int      number of bases read during strobe on
@@ -532,8 +611,9 @@ overlapping fragments.\n"
 
 set fasta2frag::opts(-l) 3000
 set fasta2frag::opts(-i) 2500
-set fasta2frag::opts(-r) FR
+set fasta2frag::opts(-r) 2
 set fasta2frag::opts(-p) 0
+set fasta2frag::opts(-P) 1
 set fasta2frag::opts(-s) 0
 set fasta2frag::opts(-q) 30
 set fasta2frag::opts(-c) 0
@@ -541,7 +621,7 @@ set fasta2frag::opts(-c) 0
 #set fasta2frag::opts(-maxmut) 2
 set fasta2frag::opts(-minmut) 0
 set fasta2frag::opts(-maxmut) 0
-set fasta2frag::opts(-pairednaming) solexa
+set fasta2frag::opts(-pairednaming) 454
 set fasta2frag::opts(-qualdivisor) 1
 set fasta2frag::opts(-minqual) 0
 set fasta2frag::opts(-insert_size) 3000
@@ -557,27 +637,23 @@ set fasta2frag::opts(-namesuffix) ""
 
 foreach {key val} $argv {
   if {![info exists fasta2frag::opts($key)]} {
-      if {[string compare [string index $key 0] "-"] == 0} {
+      if {[string compare [string index $key 0] "-"] == 0} { 
 	  puts stderr "Bad key $key\n"
 	  usage $argv0
       }
       set val $key
       set key -infile
   }
-  if { $key == "-quick" } {
-    fasta2frag::parsequick $val
-  }
   set fasta2frag::opts($key) $val
 }
 
-if {[string length $fasta2frag::opts(-infile)] ==0} {
+if {[string length $fasta2frag::opts(-infile)] ==0} { 
     puts "Missing '-infile' as keyword"
     usage $argv0 ;
 }
-if {[string length $fasta2frag::opts(-outfile)] ==0} {
+if {[string length $fasta2frag::opts(-outfile)] ==0} { 
     puts "Missing '-outfile' as keyword"
-    usage $argv0 ;
+    usage $argv0 ; 
 }
 
-fasta2frag::sanitycheck
 fasta2frag::processit
diff --git a/src/scripts/fastaselect.tcl b/src/scripts/fastaselect.tcl
new file mode 100755
index 0000000..aab8da3
--- /dev/null
+++ b/src/scripts/fastaselect.tcl
@@ -0,0 +1,125 @@
+#!/bin/sh
+# \
+  exec tclsh "$0" ${1+"$@"}
+
+#
+# Written by Bastien Chevreux (BaCh)
+#
+# Copyright (C) 2006 and later by Bastien Chevreux
+#
+# All rights reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the 
+# Free Software Foundation, Inc., 
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+# 
+#
+
+namespace eval fassel {
+  variable opts
+
+}
+
+
+proc fassel::conditionalFASTACopy {fin fout} {
+    variable names
+
+    gets $fin data
+    set seqname "[string map {> ""} [lindex $data 0]]"
+    set mustout 0
+    if {[info exists names($seqname)]} {
+	puts $fout ">$seqname"
+	set mustout 1
+    }
+
+    while {[gets $fin line] != -1} {
+	if {[string compare [string index $line 0] ">"] == 0} {
+
+	    set seqname "[string map {> ""} [lindex $line 0]]"
+	    if {[info exists names($seqname)]} {
+		puts $fout "\n>$seqname"
+		set mustout 1
+	    } else {
+		set mustout 0
+	    }
+	} elseif {$mustout >0} {
+	    puts -nonewline $fout $line
+	}
+    }
+}
+
+proc fassel::processit {} {
+    variable opts
+    variable names
+
+    puts "Reading names"
+    set fin [open $opts(-name) r]
+    while {[gets $fin line] != -1} {
+#	set names([string trim $line]) 1
+	set names([lindex $line 0]) 1
+    }
+    close $fin
+
+    puts "Copying sequence data"
+    set fin [open $opts(-infile) r]
+    set fout [open $opts(-outfile) w]
+    conditionalFASTACopy $fin $fout
+    close $fout
+    close $fin
+
+    if {[file exists ${opts(-infile)}.qual]} {
+	puts "Copying quality data"
+	set fin [open ${opts(-infile)}.qual r]
+	set fout [open ${opts(-outfile)}.qual w]
+	conditionalFASTACopy $fin $fout
+	close $fout
+	close $fin
+    }
+
+}
+
+proc usage {prgname} {
+    puts stderr "fastaselect: Select fasta sequences in a file according to names given 
+             in a name file.\n
+If fasta quality file is present (same basename, but with .qual appended),
+then also selects sequences from there.\n"
+    puts stderr "Usage: fastaselect ?options? 
+\t-infile  name   filename containing all fasta sequences
+\t-name    name   filename containing all names of sequences to select
+\t-outfile name   filename where to write selcted sequences to
+"
+  exit
+}
+
+set fassel::opts(-infile) ""
+set fassel::opts(-outfile) ""
+set fassel::opts(-name) ""
+
+foreach {key val} $argv {
+  if {![info exists fassel::opts($key)]} {
+      if {[string compare [string index $key 0] "-"] == 0} { 
+	  puts stderr "Bad key $key\n"
+	  usage $argv0
+      }
+      set val $key
+      set key -infile
+  }
+  set fassel::opts($key) $val
+}
+
+if {[string length $fassel::opts(-infile)] ==0} { usage $argv0 ; }
+if {[string length $fassel::opts(-outfile)] ==0} { usage $argv0 ; }
+if {[string length $fassel::opts(-name)] ==0} { usage $argv0 ; }
+
+fassel::processit
diff --git a/src/scripts/fastqselect.tcl b/src/scripts/fastqselect.tcl
new file mode 100755
index 0000000..ef54a70
--- /dev/null
+++ b/src/scripts/fastqselect.tcl
@@ -0,0 +1,170 @@
+#!/bin/sh
+# \
+  exec tclsh "$0" ${1+"$@"}
+
+#
+# Written by Bastien Chevreux (BaCh)
+#
+# Copyright (C) 2010 and later by Bastien Chevreux
+#
+# All rights reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the 
+# Free Software Foundation, Inc., 
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+# 
+#
+
+namespace eval faqsel {
+  variable opts
+
+}
+
+
+proc faqsel::conditionalFASTQCopy {fin fout} {
+    variable names
+
+    gets $fin line
+    set seqname "[string range [lindex $line 0] 1 end]"
+    set mustout 0
+    if {[info exists names($seqname)]} {
+	set seqname "[string range [lindex $line 0] 1 end]"
+	set mustout 1
+    }
+
+    set seqdata ""
+    set qualdata ""
+
+    set inseq 1
+
+    while {[gets $fin line] != -1} {
+	#puts "l: $line"
+	#puts "sn: $seqname"
+	#puts "sd: $seqdata"
+	#puts "qd: $qualdata"
+	#puts "fl: $mustout $inseq"
+	if {$inseq} {
+	    if {[string compare [string index $line 0] "+"] == 0} {
+		set inseq 0
+		if {[string compare $line "+"] != 0} {
+		    set sname "[string range [lindex $line 0] 1 end]"
+		    if {[string length sname] && $sname != $seqname} {
+			error "Last sequence name: $seqname\nNow reading line: $line\nThe names don't match?!"
+		    }
+		} else {
+		    set sname $seqname
+		}
+	    } elseif {[string compare [string index $line 0] "@"] == 0} {
+		# sequence without qual
+		if {$mustout} {
+		    puts $fout "@$seqname"
+		    puts $fout $seqdata
+		}
+		set seqdata ""
+		set seqname "[string range [lindex $line 0] 1 end]"
+		set mustout 0
+		if {[info exists names($seqname)]} {
+		    set mustout 1
+		}
+	    } else {
+		append seqdata $line
+	    }
+	} else {
+	    if {[string compare [string index $line 0] "@"] == 0} {
+		if {[string length $seqdata] == [string length $qualdata]} {
+		    if {$mustout} {
+			puts $fout "@$seqname"
+			puts $fout $seqdata
+			puts $fout "+"
+			puts $fout $qualdata
+		    }
+		    set seqdata ""
+		    set qualdata ""
+		    set seqname "[string range [lindex $line 0] 1 end]"
+		    set inseq 1
+		    set mustout 0
+		    if {[info exists names($seqname)]} {
+			set mustout 1
+		    }
+		} else {
+		    append qualdata $line
+		}
+	    } else {
+		append qualdata $line
+	    }
+	}
+    }
+
+    if {$mustout && [string length $seqdata]} {
+	puts $fout "@$seqname"
+	puts $fout $seqdata
+	if {[string length $qualdata]} {
+	    puts $fout "+"
+	    puts $fout $qualdata
+	}
+    }
+}
+
+proc faqsel::processit {} {
+    variable opts
+    variable names
+
+    puts "Reading names"
+    set fin [open $opts(-name) r]
+    while {[gets $fin line] != -1} {
+#	set names([string trim $line]) 1
+	set names([lindex $line 0]) 1
+    }
+    close $fin
+
+    puts "Copying sequence data"
+    set fin [open $opts(-infile) r]
+    set fout [open $opts(-outfile) w]
+    conditionalFASTQCopy $fin $fout
+    close $fout
+    close $fin
+}
+
+proc usage {prgname} {
+    puts stderr "fastqselect: Select fastq sequences in a file according to names given 
+             in a name file.\n"
+    puts stderr "Usage: fastqselect ?options? 
+\t-infile  name   filename containing all fasta sequences
+\t-name    name   filename containing all names of sequences to select
+\t-outfile name   filename where to write selcted sequences to
+"
+  exit
+}
+
+set faqsel::opts(-infile) ""
+set faqsel::opts(-outfile) ""
+set faqsel::opts(-name) ""
+
+foreach {key val} $argv {
+  if {![info exists faqsel::opts($key)]} {
+      if {[string compare [string index $key 0] "-"] == 0} { 
+	  puts stderr "Bad key $key\n"
+	  usage $argv0
+      }
+      set val $key
+      set key -infile
+  }
+  set faqsel::opts($key) $val
+}
+
+if {[string length $faqsel::opts(-infile)] ==0} { usage $argv0 ; }
+if {[string length $faqsel::opts(-outfile)] ==0} { usage $argv0 ; }
+if {[string length $faqsel::opts(-name)] ==0} { usage $argv0 ; }
+
+faqsel::processit
diff --git a/src/stdinc/Makefile.in b/src/stdinc/Makefile.in
index c89f678..70cde84 100644
--- a/src/stdinc/Makefile.in
+++ b/src/stdinc/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -38,14 +38,22 @@ subdir = src/stdinc
 DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/ax_boost_base.m4 \
-	$(top_srcdir)/m4/ax_boost_filesystem.m4 \
-	$(top_srcdir)/m4/ax_boost_iostreams.m4 \
-	$(top_srcdir)/m4/ax_boost_regex.m4 \
-	$(top_srcdir)/m4/ax_boost_system.m4 \
-	$(top_srcdir)/m4/ax_boost_thread.m4 \
-	$(top_srcdir)/m4/ax_check_zlib.m4 \
-	$(top_srcdir)/m4/ax_lib_expat.m4 $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/config/m4/ax_boost_base.m4 \
+	$(top_srcdir)/config/m4/ax_boost_regex.m4 \
+	$(top_srcdir)/config/m4/ax_boost_thread.m4 \
+	$(top_srcdir)/config/m4/ax_check_zlib.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_std.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_stl.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_namespaces.m4 \
+	$(top_srcdir)/config/m4/ax_lib_expat.m4 \
+	$(top_srcdir)/config/m4/ax_with_perl.m4 \
+	$(top_srcdir)/config/m4/ax_with_prog.m4 \
+	$(top_srcdir)/config/m4/libtool.m4 \
+	$(top_srcdir)/config/m4/ltoptions.m4 \
+	$(top_srcdir)/config/m4/ltsugar.m4 \
+	$(top_srcdir)/config/m4/ltversion.m4 \
+	$(top_srcdir)/config/m4/lt~obsolete.m4 \
+	$(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -67,13 +75,9 @@ AWK = @AWK@
 BITPACKAGE = @BITPACKAGE@
 BLOODYDARWINSTATLIBDIRHACK = @BLOODYDARWINSTATLIBDIRHACK@
 BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
-BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@
-BOOST_IOSTREAMS_LIB = @BOOST_IOSTREAMS_LIB@
 BOOST_LDFLAGS = @BOOST_LDFLAGS@
 BOOST_REGEX_LIB = @BOOST_REGEX_LIB@
-BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@
 BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
-BUNDLETARGET = @BUNDLETARGET@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
@@ -86,7 +90,6 @@ CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -96,13 +99,11 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LDFLAGS = @EXPAT_LDFLAGS@
-EXPAT_LIBS = @EXPAT_LIBS@
 EXPAT_VERSION = @EXPAT_VERSION@
 FGREP = @FGREP@
 FLEX = @FLEX@
 FLEXPP = @FLEXPP@
 GREP = @GREP@
-HAVE_XXD = @HAVE_XXD@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -120,7 +121,6 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
 MIRASTATIC = @MIRASTATIC@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
@@ -137,17 +137,18 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
+SHORTMIRAAUDIENCE = @SHORTMIRAAUDIENCE@
 STRIP = @STRIP@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -181,6 +182,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -333,15 +335,10 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	if test -z '$(STRIP)'; then \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	      install; \
-	else \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-	fi
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
 mostlyclean-generic:
 
 clean-generic:
diff --git a/src/stdinc/defines.H b/src/stdinc/defines.H
index 4039fc8..269f758 100644
--- a/src/stdinc/defines.H
+++ b/src/stdinc/defines.H
@@ -9,86 +9,64 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
+// 	$Id$	
 
-#ifndef _mira_std_defines_h_
-#define _mira_std_defines_h_
+#ifndef _scfio_defines_h_
+#define _scfio_defines_h_
 
-#include <csignal>
+#include <stdlib.h>
+#include "types.H"
 
-#include "stdinc/types.H"
-#include "debuggersupport/dbgsupport.H"
 
-
-#if __GNUC__ >= 4
-#define likely(x) __builtin_expect((x),1)
-#define unlikely(x) __builtin_expect((x),0)
-#else
-#define likely(x) (x)
-#define unlikely(x) (x)
-#endif
-
-//#define MIRA_HAS_EDIT
-#define BITSET(n,f) ((f)|=(1<<(n)))
-#define BITTEST(n,f) (((f)&(1<<(n)))!=0)
+#define MIRA_HAS_EDIT
+//#define HIDEPACBIO
 
 #if 0
 #define TIMERESTRICTED
 #endif
 
-//#define BANGONTHROW
 
+#define BITSET(n,f) ((f)|=(1<<(n)))
 
 
+#define MIRANOTIFY(nlevel, throwmsg) {ostringstream my__emsg; my__emsg << throwmsg; throw Notify(nlevel, THISFUNC, my__emsg.str().c_str());}
 
-#ifdef __APPLE__
-// somehow, the code produced by gcc on OSX does not catch all exceptions?!
-// make sure the user gets to read the most important things
-#ifndef COUTONTHROW
-#define COUTONTHROW
-#endif
-#endif
-
-#ifdef BANGONTHROW
-#define BANGNOW {raise(SIGTRAP);}
-#ifndef COUTONTHROW
-#define COUTONTHROW
-#endif
-#else
-#define BANGNOW
-#endif
-
-#ifdef COUTONTHROW
-#define COUTERRMSG {std::cout << std::endl << "In func: " << THISFUNC << std::endl << "Throw message: " << my__emsg.str() << std::endl;}
+#ifdef TRACEFLAG
+#define TRACE(bla)  cout << bla; cout.flush();
+#define FUNCSTART(bla)  static const char * THISFUNC = bla; {cout << THISFUNC << " enter." << endl;}
+#define FUNCTRACE(bla) { cout << THISFUNC << bla; cout.flush();}
+#define FUNCEND() {cout << THISFUNC << " exit." << endl;}
 #else
-#define COUTERRMSG
+#define TRACE(bla)
+#define FUNCSTART(bla) static const char * THISFUNC = bla; (void) THISFUNC;
+#define FUNCTRACE(bla)
+#define FUNCEND()
 #endif
 
 
-#define ERROR(bla)  { std::cout.flush(); std::cerr << "\nFatal error in: " << THISFUNC << ":  " << bla; exit(1);}
-#define WARNING(bla)  { std::cout.flush(); std::cerr << "Warning in: " << THISFUNC << ":  " << bla << endl;}
-
-#define FUNCSTART(bla) static const char * THISFUNC = bla; (void) THISFUNC;
-#define FUNCEND()
+#define CEBUG(bla)
+#define CEBUGF(bla)
 
-#define MIRANOTIFY(nlevel, throwmsg) {std::ostringstream my__emsg; my__emsg << throwmsg; COUTERRMSG; if(seenDebugger()) {raise(SIGTRAP);}; if(nlevel>2){BANGNOW;}; throw Notify(nlevel, THISFUNC, my__emsg.str().c_str());}
 
+#define ERROR(bla)  { cout.flush(); cerr << "\nFatal error in: " << THISFUNC << ":  " << bla; exit(1);}
+#define WARNING(bla)  { cout.flush(); cerr << "Warning in: " << THISFUNC << ":  " << bla << endl;}
 
 
 #ifdef BUGTRACKFLAG
-#define BUGIFTHROW(ifcond, throwmsg) { if(unlikely(ifcond)) {std::ostringstream my__emsg; my__emsg << throwmsg; COUTERRMSG; if(seenDebugger()) {raise(SIGTRAP);};BANGNOW; throw Notify(Notify::INTERNAL, THISFUNC, my__emsg.str().c_str());}}
+#define BUGIFTHROW(ifcond, throwmsg) { if(ifcond) {ostringstream my__emsg; my__emsg << throwmsg; throw Notify(Notify::INTERNAL, THISFUNC, my__emsg.str().c_str());}}
 #define BUGIF(ifcond, statement) { if(ifcond) {statement;}}
 #define BUGSTAT(statement) {statement;}
 #else
@@ -99,7 +77,7 @@
 
 #ifdef BOUNDTRACKFLAG
 //#define BOUNDCHECK(x, l, h) assert((x) >= (l) && (x) < (h));
-#define BOUNDCHECK(x, l, h) if(unlikely(!((x) >= (l) && (x) < (h)))) MIRANOTIFY(Notify::INTERNAL, "Oooops, boundcheck failed: " << x << ' ' << l << ' ' << h );
+#define BOUNDCHECK(x, l, h) if(!((x) >= (l) && (x) < (h))) MIRANOTIFY(Notify::FATAL, "Oooops, boundcheck failed: " << x << ' ' << l << ' ' << h );
 #else
 #define BOUNDCHECK(x, l, h)
 #endif
diff --git a/src/stdinc/stlincludes.H b/src/stdinc/stlincludes.H
index 233f9a4..02268f9 100644
--- a/src/stdinc/stlincludes.H
+++ b/src/stdinc/stlincludes.H
@@ -9,17 +9,17 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
 #ifndef STL_H
@@ -36,43 +36,43 @@ void nukeSTLContainer(T&v)
   }
 }
 
-//#include <algorithm>
-//#include <bitset>
-//#include <complex>
-//#include <deque>
-//#include <exception>
-//#include <fstream>
-//#include <functional>
-//#include <ios>
-//#include <iosfwd>
-//#include <iostream>
-//#include <istream>
-//#include <iterator>
-//#include <limits>
-//#include <list>
-//#include <locale>
-//#include <map>
-//#include <memory>
-//#include <new>
-//#include <numeric>
-//#include <ostream>
-//#include <queue>
-//#include <set>
-//#include <sstream>
-//#include <stack>
-//#include <stdexcept>
-//#include <streambuf>
-//#include <string>
-//#include <typeinfo>
-//#include <utility>
-//#include <valarray>
-//#include <vector>
+#include <algorithm>
+#include <bitset>
+#include <complex>
+#include <deque>
+#include <exception>
+#include <fstream>
+#include <functional>
+#include <ios>
+#include <iosfwd>
+#include <iostream>
+#include <istream>
+#include <iterator>
+#include <limits>
+#include <list>
+#include <locale>
+#include <map>
+#include <memory>
+#include <new>
+#include <numeric>
+#include <ostream>
+#include <queue>
+#include <set>
+#include <sstream>
+#include <stack>
+#include <stdexcept>
+#include <streambuf>
+#include <string>
+#include <typeinfo>
+#include <utility>
+#include <valarray>
+#include <vector>
 
 //#if __GNUC__ >= 3
 //#include <ext/hash_map>
 //using namespace __gnu_cxx;          // hashes are in this namespace of gcc3
-//#endif
+//#endif 
 
-//#include <ext/slist>
+#include <ext/slist>
 
-#endif
+#endif 
diff --git a/src/stdinc/template.C b/src/stdinc/template.C
index d6aaf35..24664ec 100644
--- a/src/stdinc/template.C
+++ b/src/stdinc/template.C
@@ -9,20 +9,30 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
-#include "...H"
+// 	$Id$	
+
+#ifndef lint
+static char vcid[] = "$Id$";
+#endif /* lint */
+
+
+void CLASS::foolCompiler()
+{
+#include "stdinc/foolcompiler.C"
+}
 
 // Plain vanilla constructor
 CLASS::CLASS()
diff --git a/src/stdinc/template.H b/src/stdinc/template.H
index 875a6d4..c6db1cd 100644
--- a/src/stdinc/template.H
+++ b/src/stdinc/template.H
@@ -9,17 +9,17 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
 #ifndef _bas_???_h_
@@ -36,12 +36,14 @@ class CLASS
 {
   //Variables
 private:
+  uint32 ??_valid;
 
 public:
 
 
   //Functions
 private:
+  void foolCompiler();
   void init();
   void zeroVars();
 
@@ -51,7 +53,7 @@ public:
   ~CLASS();
 
   CLASS const & operator=(CLASS const & other);
-  friend std::ostream & operator<<(std::ostream &ostr, CLASS const &???);
+  friend ostream & operator<<(ostream &ostr, CLASS const &???);
 
   void discard();
 };
diff --git a/src/stdinc/types.H b/src/stdinc/types.H
index 1033b36..469e1a4 100644
--- a/src/stdinc/types.H
+++ b/src/stdinc/types.H
@@ -1,7 +1,9 @@
 #ifndef _bastypes_defines_h_
 #define _bastypes_defines_h_
 
-#include <cinttypes> //???
+#include <inttypes.h> //???
+//#include <stdint.h>
+//#include <limits.h>
 
 typedef uint8_t uint8;
 typedef int8_t   int8;
@@ -14,7 +16,7 @@ typedef int64_t   int64;
 
 
 typedef uint8_t base_quality_t;
-typedef int32_t readid_t;
+
 
 #endif
 
diff --git a/src/support/GTAGDB b/src/support/GTAGDB
index 6d3da07..b272fed 100644
--- a/src/support/GTAGDB
+++ b/src/support/GTAGDB
@@ -4,31 +4,35 @@
 # Add these lines to the file $STADENROOT/tables/GTAGDB
 #  so that GAP4 also knows them the next time you start
 
-
-# --------------- Read tags, set only in reads
-
-# one additional feature (non-GenBank, I admit)
-"FEATURE: polyA_sequence":          id="Fpas": bg="#04AC80"
-
-
+"Strong Repeat Marker in Consensus":id="SRMc":bg=OrangeRed
 "Strong Repeat Marker in Read":id="SRMr":bg=OrangeRed
+"Weak Repeat Marker in Consensus":id="WRMc":bg=Orange
 "Weak Repeat Marker in Read":id="WRMr":bg=Orange
 "Old Repeat Marker Base":id="ORMB":bg=orange1
 "Carbon Copy Repeat Marker in Read":id="CRMr":bg=palegoldenrod
+"Masked Nasty Repeat":id="MNRr":bg=black:fg=white
 
 "Unsure in read":id="UNSr":bg=Yellow
+"Unsure in consensus":id="UNSc":bg=Yellow
+
+"IUPAC code consensus":id="IUPc":bg=royalblue3
+"Missing coverage in consensus":id="MCVc":bg=firebrick3
 
 "SNP inteR Organism on Read":id="SROr":bg=DarkTurquoise
+"SNP inteR Organism on Consensus":id="SROc":bg=DarkTurquoise
 "SNP intrA Organism on Read":id="SAOr":bg=SeaGreen
+"SNP intrA Organism on Consensus":id="SAOc":bg=SeaGreen
 "SNP Intra- and inter Organism on Read":id="SIOr":bg=PaleGreen
+"SNP Intra- and inter Organism on Consensus":id="SIOc":bg=PaleGreen
 
 "EdIt: insertion":id="ED_I":bg=pink
 "EdIt: deletion":id="ED_D":bg=pink
 "EdIt: base change":id="ED_C":bg=pink
 
-"454 read edit, tricky":id="R454":bg=green
-"Edit single discr., no HAF tag":id="ESDN":bg=green
 "Pyrosequencing Suspicious HomoPolymer":id="PSHP":bg=orange1
+"Dubious Gap Position on Consensus":id="DGPc":bg=orange1
+"Sequencing Type Mismatch Solved":id="STMS":bg=lightblue
+"Sequencing Type Mismatch Unresolved":id="STMU":bg=lightblue
 
 # HAsh Frequency tags
 "HAF no info":id="HAF0":bg=grey
@@ -39,9 +43,7 @@
 "HAF rept":id="HAF5":bg=red
 "HAF heavy rept":id="HAF6":bg=indianred4
 "HAF crazy rept":id="HAF7":bg=red4
-"Masked Nasty Repeat":id="MNRr":bg=black:fg=white
 
-"KMer Fork":id="KMRF":bg=pink
 
 # other tags, mostly for development & debugging
 "454 edit, qual too high":id="Q454":bg=yellow
@@ -49,30 +51,6 @@
 "454 test tag":id="T454":bg=yellow
 "454 hypothesis tag":id="H454":bg=green
 
-# MIRA info tags
-"MIRA info":id="MINF":bg=gray
-"MIRA info 2":id="MIT2":bg=gray
-
-
-"RLE 1":id="RLE1":bg=Green
-"RLE 2":id="RLE2":bg=palegreen1
-"RLE 3":id="RLE3":bg=yellow2
-"RLE 4":id="RLE4":bg=orange
-"RLE 5":id="RLE5":bg=red
-"RLE 6":id="RLE6":bg=indianred4
-"RLE 7":id="RLE7":bg=red4:fg=white
-"RLE 8+":id="RLE8":bg=grey:fg=white
-
-
-# --------------- Consensus tags, set only in consensus
 
-"Strong Repeat Marker in Consensus":id="SRMc":bg=OrangeRed
-"Weak Repeat Marker in Consensus":id="WRMc":bg=Orange
-"Unsure in consensus":id="UNSc":bg=Yellow
-"IUPAC code consensus":id="IUPc":bg=royalblue3
-"Missing coverage in consensus":id="MCVc":bg=firebrick3
-"SNP inteR Organism on Consensus":id="SROc":bg=DarkTurquoise
-"SNP intrA Organism on Consensus":id="SAOc":bg=SeaGreen
-"SNP Intra- and inter Organism on Consensus":id="SIOc":bg=PaleGreen
-"Sequencing Type Mismatch Solved":id="STMS":bg=lightblue
-"Sequencing Type Mismatch Unresolved":id="STMU":bg=lightblue
+"454 read edit, tricky":id="R454":bg=green
+"Edit single discr., no HAF tag":id="ESDN":bg=green
diff --git a/src/support/Makefile.in b/src/support/Makefile.in
index 1dc012d..ae098c1 100644
--- a/src/support/Makefile.in
+++ b/src/support/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -38,14 +38,22 @@ subdir = src/support
 DIST_COMMON = README $(dist_supportdata_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/ax_boost_base.m4 \
-	$(top_srcdir)/m4/ax_boost_filesystem.m4 \
-	$(top_srcdir)/m4/ax_boost_iostreams.m4 \
-	$(top_srcdir)/m4/ax_boost_regex.m4 \
-	$(top_srcdir)/m4/ax_boost_system.m4 \
-	$(top_srcdir)/m4/ax_boost_thread.m4 \
-	$(top_srcdir)/m4/ax_check_zlib.m4 \
-	$(top_srcdir)/m4/ax_lib_expat.m4 $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/config/m4/ax_boost_base.m4 \
+	$(top_srcdir)/config/m4/ax_boost_regex.m4 \
+	$(top_srcdir)/config/m4/ax_boost_thread.m4 \
+	$(top_srcdir)/config/m4/ax_check_zlib.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_std.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_stl.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_namespaces.m4 \
+	$(top_srcdir)/config/m4/ax_lib_expat.m4 \
+	$(top_srcdir)/config/m4/ax_with_perl.m4 \
+	$(top_srcdir)/config/m4/ax_with_prog.m4 \
+	$(top_srcdir)/config/m4/libtool.m4 \
+	$(top_srcdir)/config/m4/ltoptions.m4 \
+	$(top_srcdir)/config/m4/ltsugar.m4 \
+	$(top_srcdir)/config/m4/ltversion.m4 \
+	$(top_srcdir)/config/m4/lt~obsolete.m4 \
+	$(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -74,12 +82,6 @@ am__nobase_list = $(am__nobase_strip_setup); \
 am__base_list = \
   sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
   sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
-am__uninstall_files_from_dir = { \
-  test -z "$$files" \
-    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
-    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
-         $(am__cd) "$$dir" && rm -f $$files; }; \
-  }
 am__installdirs = "$(DESTDIR)$(supportdatadir)"
 DATA = $(dist_supportdata_DATA)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -93,13 +95,9 @@ AWK = @AWK@
 BITPACKAGE = @BITPACKAGE@
 BLOODYDARWINSTATLIBDIRHACK = @BLOODYDARWINSTATLIBDIRHACK@
 BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
-BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@
-BOOST_IOSTREAMS_LIB = @BOOST_IOSTREAMS_LIB@
 BOOST_LDFLAGS = @BOOST_LDFLAGS@
 BOOST_REGEX_LIB = @BOOST_REGEX_LIB@
-BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@
 BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
-BUNDLETARGET = @BUNDLETARGET@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
@@ -112,7 +110,6 @@ CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -122,13 +119,11 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LDFLAGS = @EXPAT_LDFLAGS@
-EXPAT_LIBS = @EXPAT_LIBS@
 EXPAT_VERSION = @EXPAT_VERSION@
 FGREP = @FGREP@
 FLEX = @FLEX@
 FLEXPP = @FLEXPP@
 GREP = @GREP@
-HAVE_XXD = @HAVE_XXD@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -146,7 +141,6 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
 MIRASTATIC = @MIRASTATIC@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
@@ -163,17 +157,18 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
+SHORTMIRAAUDIENCE = @SHORTMIRAAUDIENCE@
 STRIP = @STRIP@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -207,6 +202,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -280,7 +276,9 @@ uninstall-dist_supportdataDATA:
 	@$(NORMAL_UNINSTALL)
 	@list='$(dist_supportdata_DATA)'; test -n "$(supportdatadir)" || list=; \
 	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
-	dir='$(DESTDIR)$(supportdatadir)'; $(am__uninstall_files_from_dir)
+	test -n "$$files" || exit 0; \
+	echo " ( cd '$(DESTDIR)$(supportdatadir)' && rm -f" $$files ")"; \
+	cd "$(DESTDIR)$(supportdatadir)" && rm -f $$files
 tags: TAGS
 TAGS:
 
@@ -335,15 +333,10 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	if test -z '$(STRIP)'; then \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	      install; \
-	else \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-	fi
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
 mostlyclean-generic:
 
 clean-generic:
diff --git a/src/test/Makefile.am b/src/test/Makefile.am
new file mode 100644
index 0000000..f75cf69
--- /dev/null
+++ b/src/test/Makefile.am
@@ -0,0 +1,3 @@
+
+SUBDIRS = io mira
+
diff --git a/doc/Makefile.in b/src/test/Makefile.in
similarity index 92%
copy from doc/Makefile.in
copy to src/test/Makefile.in
index e6f4121..867f142 100644
--- a/doc/Makefile.in
+++ b/src/test/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,17 +33,25 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
-subdir = doc
+subdir = src/test
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/ax_boost_base.m4 \
-	$(top_srcdir)/m4/ax_boost_filesystem.m4 \
-	$(top_srcdir)/m4/ax_boost_iostreams.m4 \
-	$(top_srcdir)/m4/ax_boost_regex.m4 \
-	$(top_srcdir)/m4/ax_boost_system.m4 \
-	$(top_srcdir)/m4/ax_boost_thread.m4 \
-	$(top_srcdir)/m4/ax_check_zlib.m4 \
-	$(top_srcdir)/m4/ax_lib_expat.m4 $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/config/m4/ax_boost_base.m4 \
+	$(top_srcdir)/config/m4/ax_boost_regex.m4 \
+	$(top_srcdir)/config/m4/ax_boost_thread.m4 \
+	$(top_srcdir)/config/m4/ax_check_zlib.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_std.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_stl.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_namespaces.m4 \
+	$(top_srcdir)/config/m4/ax_lib_expat.m4 \
+	$(top_srcdir)/config/m4/ax_with_perl.m4 \
+	$(top_srcdir)/config/m4/ax_with_prog.m4 \
+	$(top_srcdir)/config/m4/libtool.m4 \
+	$(top_srcdir)/config/m4/ltoptions.m4 \
+	$(top_srcdir)/config/m4/ltsugar.m4 \
+	$(top_srcdir)/config/m4/ltversion.m4 \
+	$(top_srcdir)/config/m4/lt~obsolete.m4 \
+	$(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -102,13 +110,9 @@ AWK = @AWK@
 BITPACKAGE = @BITPACKAGE@
 BLOODYDARWINSTATLIBDIRHACK = @BLOODYDARWINSTATLIBDIRHACK@
 BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
-BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@
-BOOST_IOSTREAMS_LIB = @BOOST_IOSTREAMS_LIB@
 BOOST_LDFLAGS = @BOOST_LDFLAGS@
 BOOST_REGEX_LIB = @BOOST_REGEX_LIB@
-BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@
 BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
-BUNDLETARGET = @BUNDLETARGET@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
@@ -121,7 +125,6 @@ CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -131,13 +134,11 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LDFLAGS = @EXPAT_LDFLAGS@
-EXPAT_LIBS = @EXPAT_LIBS@
 EXPAT_VERSION = @EXPAT_VERSION@
 FGREP = @FGREP@
 FLEX = @FLEX@
 FLEXPP = @FLEXPP@
 GREP = @GREP@
-HAVE_XXD = @HAVE_XXD@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -155,7 +156,6 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
 MIRASTATIC = @MIRASTATIC@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
@@ -172,17 +172,18 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
+SHORTMIRAAUDIENCE = @SHORTMIRAAUDIENCE@
 STRIP = @STRIP@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -216,6 +217,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -231,7 +233,7 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-SUBDIRS = docbook
+SUBDIRS = io mira
 all: all-recursive
 
 .SUFFIXES:
@@ -244,9 +246,9 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/test/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu doc/Makefile
+	  $(AUTOMAKE) --gnu src/test/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -480,15 +482,10 @@ install-am: all-am
 
 installcheck: installcheck-recursive
 install-strip:
-	if test -z '$(STRIP)'; then \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	      install; \
-	else \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-	fi
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
 mostlyclean-generic:
 
 clean-generic:
diff --git a/src/test/io/Makefile.am b/src/test/io/Makefile.am
new file mode 100644
index 0000000..03676c7
--- /dev/null
+++ b/src/test/io/Makefile.am
@@ -0,0 +1,3 @@
+
+SUBDIRS = fasta generalio scf
+
diff --git a/doc/Makefile.in b/src/test/io/Makefile.in
similarity index 92%
copy from doc/Makefile.in
copy to src/test/io/Makefile.in
index e6f4121..526f1c1 100644
--- a/doc/Makefile.in
+++ b/src/test/io/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,17 +33,25 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
-subdir = doc
+subdir = src/test/io
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/ax_boost_base.m4 \
-	$(top_srcdir)/m4/ax_boost_filesystem.m4 \
-	$(top_srcdir)/m4/ax_boost_iostreams.m4 \
-	$(top_srcdir)/m4/ax_boost_regex.m4 \
-	$(top_srcdir)/m4/ax_boost_system.m4 \
-	$(top_srcdir)/m4/ax_boost_thread.m4 \
-	$(top_srcdir)/m4/ax_check_zlib.m4 \
-	$(top_srcdir)/m4/ax_lib_expat.m4 $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/config/m4/ax_boost_base.m4 \
+	$(top_srcdir)/config/m4/ax_boost_regex.m4 \
+	$(top_srcdir)/config/m4/ax_boost_thread.m4 \
+	$(top_srcdir)/config/m4/ax_check_zlib.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_std.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_stl.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_namespaces.m4 \
+	$(top_srcdir)/config/m4/ax_lib_expat.m4 \
+	$(top_srcdir)/config/m4/ax_with_perl.m4 \
+	$(top_srcdir)/config/m4/ax_with_prog.m4 \
+	$(top_srcdir)/config/m4/libtool.m4 \
+	$(top_srcdir)/config/m4/ltoptions.m4 \
+	$(top_srcdir)/config/m4/ltsugar.m4 \
+	$(top_srcdir)/config/m4/ltversion.m4 \
+	$(top_srcdir)/config/m4/lt~obsolete.m4 \
+	$(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -102,13 +110,9 @@ AWK = @AWK@
 BITPACKAGE = @BITPACKAGE@
 BLOODYDARWINSTATLIBDIRHACK = @BLOODYDARWINSTATLIBDIRHACK@
 BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
-BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@
-BOOST_IOSTREAMS_LIB = @BOOST_IOSTREAMS_LIB@
 BOOST_LDFLAGS = @BOOST_LDFLAGS@
 BOOST_REGEX_LIB = @BOOST_REGEX_LIB@
-BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@
 BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
-BUNDLETARGET = @BUNDLETARGET@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
@@ -121,7 +125,6 @@ CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -131,13 +134,11 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LDFLAGS = @EXPAT_LDFLAGS@
-EXPAT_LIBS = @EXPAT_LIBS@
 EXPAT_VERSION = @EXPAT_VERSION@
 FGREP = @FGREP@
 FLEX = @FLEX@
 FLEXPP = @FLEXPP@
 GREP = @GREP@
-HAVE_XXD = @HAVE_XXD@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -155,7 +156,6 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
 MIRASTATIC = @MIRASTATIC@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
@@ -172,17 +172,18 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
+SHORTMIRAAUDIENCE = @SHORTMIRAAUDIENCE@
 STRIP = @STRIP@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -216,6 +217,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -231,7 +233,7 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-SUBDIRS = docbook
+SUBDIRS = fasta generalio scf
 all: all-recursive
 
 .SUFFIXES:
@@ -244,9 +246,9 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/test/io/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu doc/Makefile
+	  $(AUTOMAKE) --gnu src/test/io/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -480,15 +482,10 @@ install-am: all-am
 
 installcheck: installcheck-recursive
 install-strip:
-	if test -z '$(STRIP)'; then \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	      install; \
-	else \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-	fi
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
 mostlyclean-generic:
 
 clean-generic:
diff --git a/src/test/io/fasta/Makefile.am b/src/test/io/fasta/Makefile.am
new file mode 100644
index 0000000..a688bb4
--- /dev/null
+++ b/src/test/io/fasta/Makefile.am
@@ -0,0 +1,19 @@
+INCLUDES = -I$(top_srcdir)/src $(all_includes)
+
+noinst_PROGRAMS= tstFASTA
+# EdIt_abi373 EdIt_alf
+
+AM_LDFLAGS= -L../../../io/ -L../../../util/ -L../../../errorhandling/ -L../../../mira -L../../../examine/ -L../../../EdIt/ -L../../../caf/ -L../../../knn_abi373 -L../../../knn_alf 
+
+tstFASTA_SOURCES= tstFASTA.C
+tstFASTA_LDADD= -lmiraerrorhandling  -lmirautil -lmirafio
+
+
+
+#convert_project: libinstall convert_project.C
+##       $(CPP) $(CCFLAGS) $(INC_DIRS) makeFASTA.C -o makeFASTA  $(LIB) $(LIB_DIR
+#S)  -lscflookclips -lClip -lerrorhandling  -lutil -lmyio -lm
+#	  $(CPP) $(CCFLAGS) convert_project.C -o convert_project $(INC_DIRS) $(LI
+#B) $(LIB_DIRS)  -lerrorhandling  -lutil -lmyio -lcaf -lEdIt -lExamine -lKNN_jena
+# -lm
+#	  cp convert_project $(TARGET_BINDIR)
diff --git a/src/errorhandling/Makefile.in b/src/test/io/fasta/Makefile.in
similarity index 81%
copy from src/errorhandling/Makefile.in
copy to src/test/io/fasta/Makefile.in
index 3074d7b..b5f1fc8 100644
--- a/src/errorhandling/Makefile.in
+++ b/src/test/io/fasta/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -15,7 +15,6 @@
 
 @SET_MAKE@
 
-
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
@@ -35,29 +34,35 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
-subdir = src/errorhandling
-DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
-	$(srcdir)/Makefile.in
+noinst_PROGRAMS = tstFASTA$(EXEEXT)
+subdir = src/test/io/fasta
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/ax_boost_base.m4 \
-	$(top_srcdir)/m4/ax_boost_filesystem.m4 \
-	$(top_srcdir)/m4/ax_boost_iostreams.m4 \
-	$(top_srcdir)/m4/ax_boost_regex.m4 \
-	$(top_srcdir)/m4/ax_boost_system.m4 \
-	$(top_srcdir)/m4/ax_boost_thread.m4 \
-	$(top_srcdir)/m4/ax_check_zlib.m4 \
-	$(top_srcdir)/m4/ax_lib_expat.m4 $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/config/m4/ax_boost_base.m4 \
+	$(top_srcdir)/config/m4/ax_boost_regex.m4 \
+	$(top_srcdir)/config/m4/ax_boost_thread.m4 \
+	$(top_srcdir)/config/m4/ax_check_zlib.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_std.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_stl.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_namespaces.m4 \
+	$(top_srcdir)/config/m4/ax_lib_expat.m4 \
+	$(top_srcdir)/config/m4/ax_with_perl.m4 \
+	$(top_srcdir)/config/m4/ax_with_prog.m4 \
+	$(top_srcdir)/config/m4/libtool.m4 \
+	$(top_srcdir)/config/m4/ltoptions.m4 \
+	$(top_srcdir)/config/m4/ltsugar.m4 \
+	$(top_srcdir)/config/m4/ltversion.m4 \
+	$(top_srcdir)/config/m4/lt~obsolete.m4 \
+	$(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
-LIBRARIES = $(noinst_LIBRARIES)
-ARFLAGS = cru
-libmiraerrorhandling_a_AR = $(AR) $(ARFLAGS)
-libmiraerrorhandling_a_LIBADD =
-am_libmiraerrorhandling_a_OBJECTS = errorhandling.$(OBJEXT)
-libmiraerrorhandling_a_OBJECTS = $(am_libmiraerrorhandling_a_OBJECTS)
+PROGRAMS = $(noinst_PROGRAMS)
+am_tstFASTA_OBJECTS = tstFASTA.$(OBJEXT)
+tstFASTA_OBJECTS = $(am_tstFASTA_OBJECTS)
+tstFASTA_DEPENDENCIES =
 DEFAULT_INCLUDES = -I. at am__isrc@
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
@@ -71,9 +76,8 @@ CXXLD = $(CXX)
 CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	--mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
 	$(LDFLAGS) -o $@
-SOURCES = $(libmiraerrorhandling_a_SOURCES)
-DIST_SOURCES = $(libmiraerrorhandling_a_SOURCES)
-HEADERS = $(noinst_HEADERS)
+SOURCES = $(tstFASTA_SOURCES)
+DIST_SOURCES = $(tstFASTA_SOURCES)
 ETAGS = etags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -87,13 +91,9 @@ AWK = @AWK@
 BITPACKAGE = @BITPACKAGE@
 BLOODYDARWINSTATLIBDIRHACK = @BLOODYDARWINSTATLIBDIRHACK@
 BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
-BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@
-BOOST_IOSTREAMS_LIB = @BOOST_IOSTREAMS_LIB@
 BOOST_LDFLAGS = @BOOST_LDFLAGS@
 BOOST_REGEX_LIB = @BOOST_REGEX_LIB@
-BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@
 BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
-BUNDLETARGET = @BUNDLETARGET@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
@@ -106,7 +106,6 @@ CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -116,13 +115,11 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LDFLAGS = @EXPAT_LDFLAGS@
-EXPAT_LIBS = @EXPAT_LIBS@
 EXPAT_VERSION = @EXPAT_VERSION@
 FGREP = @FGREP@
 FLEX = @FLEX@
 FLEXPP = @FLEXPP@
 GREP = @GREP@
-HAVE_XXD = @HAVE_XXD@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -140,7 +137,6 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
 MIRASTATIC = @MIRASTATIC@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
@@ -157,17 +153,18 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
+SHORTMIRAAUDIENCE = @SHORTMIRAAUDIENCE@
 STRIP = @STRIP@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -201,6 +198,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -216,10 +214,11 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-AM_CPPFLAGS = -I$(top_srcdir)/src $(all_includes)
-noinst_LIBRARIES = libmiraerrorhandling.a
-libmiraerrorhandling_a_SOURCES = errorhandling.C
-noinst_HEADERS = errorhandling.H
+INCLUDES = -I$(top_srcdir)/src $(all_includes)
+# EdIt_abi373 EdIt_alf
+AM_LDFLAGS = -L../../../io/ -L../../../util/ -L../../../errorhandling/ -L../../../mira -L../../../examine/ -L../../../EdIt/ -L../../../caf/ -L../../../knn_abi373 -L../../../knn_alf 
+tstFASTA_SOURCES = tstFASTA.C
+tstFASTA_LDADD = -lmiraerrorhandling  -lmirautil -lmirafio
 all: all-am
 
 .SUFFIXES:
@@ -233,9 +232,9 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/errorhandling/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/test/io/fasta/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu src/errorhandling/Makefile
+	  $(AUTOMAKE) --gnu src/test/io/fasta/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -255,12 +254,17 @@ $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(am__aclocal_m4_deps):
 
-clean-noinstLIBRARIES:
-	-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
-libmiraerrorhandling.a: $(libmiraerrorhandling_a_OBJECTS) $(libmiraerrorhandling_a_DEPENDENCIES) $(EXTRA_libmiraerrorhandling_a_DEPENDENCIES) 
-	-rm -f libmiraerrorhandling.a
-	$(libmiraerrorhandling_a_AR) libmiraerrorhandling.a $(libmiraerrorhandling_a_OBJECTS) $(libmiraerrorhandling_a_LIBADD)
-	$(RANLIB) libmiraerrorhandling.a
+clean-noinstPROGRAMS:
+	@list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
+	echo " rm -f" $$list; \
+	rm -f $$list || exit $$?; \
+	test -n "$(EXEEXT)" || exit 0; \
+	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+	echo " rm -f" $$list; \
+	rm -f $$list
+tstFASTA$(EXEEXT): $(tstFASTA_OBJECTS) $(tstFASTA_DEPENDENCIES) 
+	@rm -f tstFASTA$(EXEEXT)
+	$(CXXLINK) $(tstFASTA_OBJECTS) $(tstFASTA_LDADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -268,7 +272,7 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/errorhandling.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tstFASTA.Po at am__quote@
 
 .C.o:
 @am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@@ -381,7 +385,7 @@ distdir: $(DISTFILES)
 	done
 check-am: all-am
 check: check-am
-all-am: Makefile $(LIBRARIES) $(HEADERS)
+all-am: Makefile $(PROGRAMS)
 installdirs:
 install: install-am
 install-exec: install-exec-am
@@ -393,15 +397,10 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	if test -z '$(STRIP)'; then \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	      install; \
-	else \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-	fi
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
 mostlyclean-generic:
 
 clean-generic:
@@ -415,7 +414,7 @@ maintainer-clean-generic:
 	@echo "it deletes files that may require special tools to rebuild."
 clean: clean-am
 
-clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
+clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
 	mostlyclean-am
 
 distclean: distclean-am
@@ -487,7 +486,7 @@ uninstall-am:
 .MAKE: install-am install-strip
 
 .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
-	clean-libtool clean-noinstLIBRARIES ctags distclean \
+	clean-libtool clean-noinstPROGRAMS ctags distclean \
 	distclean-compile distclean-generic distclean-libtool \
 	distclean-tags distdir dvi dvi-am html html-am info info-am \
 	install install-am install-data install-data-am install-dvi \
@@ -500,6 +499,13 @@ uninstall-am:
 	pdf pdf-am ps ps-am tags uninstall uninstall-am
 
 
+#convert_project: libinstall convert_project.C
+#S)  -lscflookclips -lClip -lerrorhandling  -lutil -lmyio -lm
+#	  $(CPP) $(CCFLAGS) convert_project.C -o convert_project $(INC_DIRS) $(LI
+#B) $(LIB_DIRS)  -lerrorhandling  -lutil -lmyio -lcaf -lEdIt -lExamine -lKNN_jena
+# -lm
+#	  cp convert_project $(TARGET_BINDIR)
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/src/test/io/fasta/tstFASTA.C b/src/test/io/fasta/tstFASTA.C
new file mode 100644
index 0000000..3bd3298
--- /dev/null
+++ b/src/test/io/fasta/tstFASTA.C
@@ -0,0 +1,181 @@
+#include <limits.h>
+#include <iostream>
+
+#include "io/fasta.H"
+#include "stdinc/stlincludes.H"
+
+
+#define NAMELEN 40
+
+
+char singletest[][NAMELEN]= { 
+  {"good.fasta"}, 
+  {"emptyline.fasta"},
+  {"multiple.fasta"},
+  {"nogreater.fasta"},
+  {"noname.fasta"},
+  {"sillyname.fasta"},
+  {"badspace.fasta"},
+  {"wrongbase.fasta"},
+  {"yyy.fasta"}
+};
+
+char qualtest[][NAMELEN]={
+  {"good.fasta.qual"},
+  {"basemissing.fasta.qual"},
+  {"basemore.fasta.qual"},
+  {"emptyline.fasta.qual"},
+  {"multiple.fasta.qual"},
+  {"nogreater.fasta.qual"},
+  {"nonumber.fasta.qual"},
+  {"tohigh.fasta.qual"},
+  {"namemismatch.fasta.qual"},
+  {"yyy.fasta.qual"}
+};
+
+char multipletest[][NAMELEN]={
+  {"multiple.fasta.qual"},
+  {"multiple-bad1.fasta.qual"},
+  {"multiple-bad2.fasta.qual"},
+  {"multiple-bad3.fasta.qual"},
+  {"multiple-bad4.fasta.qual"},
+};
+
+int main(void)
+{
+  FUNCSTART("main");
+
+  FASTA test;
+  
+  cout << "Testing empty object\n------------------------------------------------" << endl;
+  try{
+    test.dumpSequence(cout);
+    test.dumpQuality(cout);
+  }
+  catch(Notify n){
+    n.setGravity(Notify::WARNING);
+    n.handleError("main()");
+  }
+  cout << "\n\n";
+
+  for(uint32 i=0; i < sizeof(singletest)/NAMELEN; i++ ) {
+    cout << "############ 1-" << i << endl;
+    try{
+      cout << "Testing " << singletest[i] << "\n------------------------------------------------" << endl;
+      test.load(singletest[i]);
+      test.dumpSequence(cout);
+      test.dumpQuality(cout);
+    }
+    catch(Notify n){
+      n.setGravity(Notify::WARNING);
+      n.handleError("main()");
+    }
+    cout << "\n\n";
+  }
+
+  for(uint32 i=0; i < sizeof(qualtest)/NAMELEN; i++ ) {
+    cout << "############ 2-" << i << endl;
+    try{
+      cout << "Testing " << qualtest[i] << "\n------------------------------------------------" << endl;
+      test.load("good.fasta", qualtest[i]);
+      test.dumpSequence(cout);
+      test.dumpQuality(cout);
+    }
+    catch(Notify n){
+      n.setGravity(Notify::WARNING);
+      n.handleError("main()");
+    }
+    cout << "\n\n";
+  }
+
+  cout << "Testing load qual only\n------------------------------------------------" << endl;
+  try{
+    test.loadQual("good1.fasta.qual");
+    test.dumpSequence(cout);
+    test.dumpQuality(cout);
+  }
+  catch(Notify n){
+    n.setGravity(Notify::WARNING);
+    n.handleError("main()");
+  }
+  cout << "\n\n";
+
+  cout << "Testing testIfSeqAndQualMatch\n------------------------------------------------" << endl;
+  try{
+    test.loadQual("good_bad.fasta.qual");
+    test.dumpSequence(cout);
+    test.dumpQuality(cout);
+    test.testIfSeqAndQualMatch();
+  }
+  catch(Notify n){
+    n.setGravity(Notify::WARNING);
+    n.handleError("main()");
+  }
+  cout << "\n\n";
+
+  cout << "Testing discard object\n------------------------------------------------" << endl;
+  try{
+    test.discard();
+    test.dumpSequence(cout);
+    test.dumpQuality(cout);
+  }
+  catch(Notify n){
+    n.setGravity(Notify::WARNING);
+    n.handleError("main()");
+  }
+  cout << "\n\n";
+
+
+  for(uint32 i=0; i < sizeof(multipletest)/NAMELEN; i++ ) {
+    cout << "############ 3-" << i << endl;
+    try{
+      cout << "Testing " << multipletest[i] << "\n------------------------------------------------" << endl;
+      string fastain="multiple.fasta";
+      ifstream fin;
+      fin.open(fastain.c_str(), ios::in|ios::ate);
+      if(!fin){
+	MIRANOTIFY(Notify::WARNING, "File not found: " << fastain);
+      }
+      if(!fin.tellg()){
+	MIRANOTIFY(Notify::FATAL, "Zero length file: " << fastain);
+      }
+      fin.seekg(0, ios::beg);
+      
+      ifstream qin;
+      qin.open(multipletest[i], ios::in|ios::ate);
+      if(!qin){
+	MIRANOTIFY(Notify::WARNING, "File not found: " << multipletest[i]);
+      }
+      if(!qin.tellg()){
+	MIRANOTIFY(Notify::FATAL, "Zero length file:"  << multipletest[i]);
+      }
+      qin.seekg(0, ios::beg);
+      while(1){
+	cout << "Loading ... ";
+	cout.flush();
+	test.loadNext(fin, qin);
+	if(test.testIfEmpty()) {
+	  cout << "no more sequences.\n";
+	  break;
+	}
+	cout << "done." << endl;
+	test.dumpSequence(cout);
+	test.dumpQuality(cerr);
+    }
+    }
+    catch(Notify n){
+      n.setGravity(Notify::WARNING);
+      n.handleError("main()");
+    }
+    cout << "\n\n";
+  }
+
+
+
+  cout << "Tests ended.\n";
+
+  FUNCEND();
+  return 0;
+}
+
+
diff --git a/src/test/io/generalio/Makefile.am b/src/test/io/generalio/Makefile.am
new file mode 100644
index 0000000..a80aa4f
--- /dev/null
+++ b/src/test/io/generalio/Makefile.am
@@ -0,0 +1,18 @@
+INCLUDES = -I$(top_srcdir)/src $(all_includes)
+
+noinst_PROGRAMS= tstgeneralio
+
+AM_LDFLAGS= -L../../../io/ -L../../../util/ -L../../../errorhandling/ -L../../../mira -L../../../examine/ -L../../../EdIt/ -L../../../caf/ -L../../../knn_abi373 -L../../../knn_alf 
+
+tstgeneralio_SOURCES= tstgeneralio.C
+tstgeneralio_LDADD= -lmiraerrorhandling  -lmirautil -lmirafio
+
+
+
+#convert_project: libinstall convert_project.C
+##       $(CPP) $(CCFLAGS) $(INC_DIRS) makeFASTA.C -o makeFASTA  $(LIB) $(LIB_DIR
+#S)  -lscflookclips -lClip -lerrorhandling  -lutil -lmyio -lm
+#	  $(CPP) $(CCFLAGS) convert_project.C -o convert_project $(INC_DIRS) $(LI
+#B) $(LIB_DIRS)  -lerrorhandling  -lutil -lmyio -lcaf -lEdIt -lExamine -lKNN_jena
+# -lm
+#	  cp convert_project $(TARGET_BINDIR)
diff --git a/src/modules/Makefile.in b/src/test/io/generalio/Makefile.in
similarity index 78%
rename from src/modules/Makefile.in
rename to src/test/io/generalio/Makefile.in
index 64c2955..66700fa 100644
--- a/src/modules/Makefile.in
+++ b/src/test/io/generalio/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -15,7 +15,6 @@
 
 @SET_MAKE@
 
-
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
@@ -35,33 +34,35 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
-subdir = src/modules
-DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
-	$(srcdir)/Makefile.in
+noinst_PROGRAMS = tstgeneralio$(EXEEXT)
+subdir = src/test/io/generalio
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/ax_boost_base.m4 \
-	$(top_srcdir)/m4/ax_boost_filesystem.m4 \
-	$(top_srcdir)/m4/ax_boost_iostreams.m4 \
-	$(top_srcdir)/m4/ax_boost_regex.m4 \
-	$(top_srcdir)/m4/ax_boost_system.m4 \
-	$(top_srcdir)/m4/ax_boost_thread.m4 \
-	$(top_srcdir)/m4/ax_check_zlib.m4 \
-	$(top_srcdir)/m4/ax_lib_expat.m4 $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/config/m4/ax_boost_base.m4 \
+	$(top_srcdir)/config/m4/ax_boost_regex.m4 \
+	$(top_srcdir)/config/m4/ax_boost_thread.m4 \
+	$(top_srcdir)/config/m4/ax_check_zlib.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_std.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_stl.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_namespaces.m4 \
+	$(top_srcdir)/config/m4/ax_lib_expat.m4 \
+	$(top_srcdir)/config/m4/ax_with_perl.m4 \
+	$(top_srcdir)/config/m4/ax_with_prog.m4 \
+	$(top_srcdir)/config/m4/libtool.m4 \
+	$(top_srcdir)/config/m4/ltoptions.m4 \
+	$(top_srcdir)/config/m4/ltsugar.m4 \
+	$(top_srcdir)/config/m4/ltversion.m4 \
+	$(top_srcdir)/config/m4/lt~obsolete.m4 \
+	$(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
-LIBRARIES = $(noinst_LIBRARIES)
-ARFLAGS = cru
-libmiramodules_a_AR = $(AR) $(ARFLAGS)
-libmiramodules_a_LIBADD =
-am_libmiramodules_a_OBJECTS = mod_sigconex.$(OBJEXT) \
-	mod_scaffold.$(OBJEXT) mod_bait.$(OBJEXT) \
-	mod_dbgreplay.$(OBJEXT) mod_diff.$(OBJEXT) mod_mer.$(OBJEXT) \
-	mod_mira.$(OBJEXT) mod_convert.$(OBJEXT) \
-	mod_memestim.$(OBJEXT) mod_tagsnp.$(OBJEXT) misc.$(OBJEXT)
-libmiramodules_a_OBJECTS = $(am_libmiramodules_a_OBJECTS)
+PROGRAMS = $(noinst_PROGRAMS)
+am_tstgeneralio_OBJECTS = tstgeneralio.$(OBJEXT)
+tstgeneralio_OBJECTS = $(am_tstgeneralio_OBJECTS)
+tstgeneralio_DEPENDENCIES =
 DEFAULT_INCLUDES = -I. at am__isrc@
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
@@ -75,9 +76,8 @@ CXXLD = $(CXX)
 CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	--mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
 	$(LDFLAGS) -o $@
-SOURCES = $(libmiramodules_a_SOURCES)
-DIST_SOURCES = $(libmiramodules_a_SOURCES)
-HEADERS = $(noinst_HEADERS)
+SOURCES = $(tstgeneralio_SOURCES)
+DIST_SOURCES = $(tstgeneralio_SOURCES)
 ETAGS = etags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -91,13 +91,9 @@ AWK = @AWK@
 BITPACKAGE = @BITPACKAGE@
 BLOODYDARWINSTATLIBDIRHACK = @BLOODYDARWINSTATLIBDIRHACK@
 BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
-BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@
-BOOST_IOSTREAMS_LIB = @BOOST_IOSTREAMS_LIB@
 BOOST_LDFLAGS = @BOOST_LDFLAGS@
 BOOST_REGEX_LIB = @BOOST_REGEX_LIB@
-BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@
 BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
-BUNDLETARGET = @BUNDLETARGET@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
@@ -110,7 +106,6 @@ CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -120,13 +115,11 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LDFLAGS = @EXPAT_LDFLAGS@
-EXPAT_LIBS = @EXPAT_LIBS@
 EXPAT_VERSION = @EXPAT_VERSION@
 FGREP = @FGREP@
 FLEX = @FLEX@
 FLEXPP = @FLEXPP@
 GREP = @GREP@
-HAVE_XXD = @HAVE_XXD@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -144,7 +137,6 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
 MIRASTATIC = @MIRASTATIC@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
@@ -161,17 +153,18 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
+SHORTMIRAAUDIENCE = @SHORTMIRAAUDIENCE@
 STRIP = @STRIP@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -205,6 +198,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -220,10 +214,10 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-AM_CPPFLAGS = -I$(top_srcdir)/src $(all_includes)
-noinst_LIBRARIES = libmiramodules.a
-libmiramodules_a_SOURCES = mod_sigconex.C mod_scaffold.C mod_bait.C mod_dbgreplay.C mod_diff.C mod_mer.C mod_mira.C mod_convert.C mod_memestim.C mod_tagsnp.C misc.C
-noinst_HEADERS = mod_sigconex.H mod_scaffold.H mod_bait.H mod_diff.H mod_mer.H mod_mira.H mod_convert.H mod_memestim.H mod_tagsnp.H misc.H
+INCLUDES = -I$(top_srcdir)/src $(all_includes)
+AM_LDFLAGS = -L../../../io/ -L../../../util/ -L../../../errorhandling/ -L../../../mira -L../../../examine/ -L../../../EdIt/ -L../../../caf/ -L../../../knn_abi373 -L../../../knn_alf 
+tstgeneralio_SOURCES = tstgeneralio.C
+tstgeneralio_LDADD = -lmiraerrorhandling  -lmirautil -lmirafio
 all: all-am
 
 .SUFFIXES:
@@ -237,9 +231,9 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/modules/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/test/io/generalio/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu src/modules/Makefile
+	  $(AUTOMAKE) --gnu src/test/io/generalio/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -259,12 +253,17 @@ $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(am__aclocal_m4_deps):
 
-clean-noinstLIBRARIES:
-	-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
-libmiramodules.a: $(libmiramodules_a_OBJECTS) $(libmiramodules_a_DEPENDENCIES) $(EXTRA_libmiramodules_a_DEPENDENCIES) 
-	-rm -f libmiramodules.a
-	$(libmiramodules_a_AR) libmiramodules.a $(libmiramodules_a_OBJECTS) $(libmiramodules_a_LIBADD)
-	$(RANLIB) libmiramodules.a
+clean-noinstPROGRAMS:
+	@list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
+	echo " rm -f" $$list; \
+	rm -f $$list || exit $$?; \
+	test -n "$(EXEEXT)" || exit 0; \
+	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+	echo " rm -f" $$list; \
+	rm -f $$list
+tstgeneralio$(EXEEXT): $(tstgeneralio_OBJECTS) $(tstgeneralio_DEPENDENCIES) 
+	@rm -f tstgeneralio$(EXEEXT)
+	$(CXXLINK) $(tstgeneralio_OBJECTS) $(tstgeneralio_LDADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -272,17 +271,7 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/misc.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mod_bait.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mod_convert.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mod_dbgreplay.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mod_diff.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mod_memestim.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mod_mer.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mod_mira.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mod_scaffold.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mod_sigconex.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mod_tagsnp.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tstgeneralio.Po at am__quote@
 
 .C.o:
 @am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@@ -395,7 +384,7 @@ distdir: $(DISTFILES)
 	done
 check-am: all-am
 check: check-am
-all-am: Makefile $(LIBRARIES) $(HEADERS)
+all-am: Makefile $(PROGRAMS)
 installdirs:
 install: install-am
 install-exec: install-exec-am
@@ -407,15 +396,10 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	if test -z '$(STRIP)'; then \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	      install; \
-	else \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-	fi
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
 mostlyclean-generic:
 
 clean-generic:
@@ -429,7 +413,7 @@ maintainer-clean-generic:
 	@echo "it deletes files that may require special tools to rebuild."
 clean: clean-am
 
-clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
+clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
 	mostlyclean-am
 
 distclean: distclean-am
@@ -501,7 +485,7 @@ uninstall-am:
 .MAKE: install-am install-strip
 
 .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
-	clean-libtool clean-noinstLIBRARIES ctags distclean \
+	clean-libtool clean-noinstPROGRAMS ctags distclean \
 	distclean-compile distclean-generic distclean-libtool \
 	distclean-tags distdir dvi dvi-am html html-am info info-am \
 	install install-am install-data install-data-am install-dvi \
@@ -514,6 +498,13 @@ uninstall-am:
 	pdf pdf-am ps ps-am tags uninstall uninstall-am
 
 
+#convert_project: libinstall convert_project.C
+#S)  -lscflookclips -lClip -lerrorhandling  -lutil -lmyio -lm
+#	  $(CPP) $(CCFLAGS) convert_project.C -o convert_project $(INC_DIRS) $(LI
+#B) $(LIB_DIRS)  -lerrorhandling  -lutil -lmyio -lcaf -lEdIt -lExamine -lKNN_jena
+# -lm
+#	  cp convert_project $(TARGET_BINDIR)
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/src/test/io/generalio/tstgeneralio.C b/src/test/io/generalio/tstgeneralio.C
new file mode 100644
index 0000000..5e7a02a
--- /dev/null
+++ b/src/test/io/generalio/tstgeneralio.C
@@ -0,0 +1,67 @@
+#include <limits.h>
+#include <iostream>
+
+#include "io/generalio.H"
+
+#if __GNUC__ >= 3
+#define NO_NOCREATE
+#endif 
+
+
+
+#define NAMELEN 40
+
+
+char normaltests[][NAMELEN]= { 
+  {"kvin.txt"}
+};
+
+int main(int argc, char ** argv)
+{
+  FUNCSTART("main");
+  try{
+    cout << "Testing normal operation\n";
+    
+    for(uint32 i=0; i < sizeof(normaltests)/NAMELEN; i++ ) {
+      cout << "############ 1-" << i << endl;
+      try{
+        cout << "Testing " << normaltests[i] << "\n------------------------------------------------" << endl;
+	
+	ifstream fin;
+#ifdef NO_NOCREATE
+	fin.open(normaltests[i], ios::in|ios::ate);
+#else 
+	fin.open(normaltests[i], ios::in|ios::ate|ios::nocreate);
+#endif 
+	if(!fin){
+	  cerr << "File not found\n";
+	}
+	if(!fin.tellg()){
+	  cerr << "Zero length file\n";
+	}
+	fin.seekg(0, ios::beg);
+
+	string key, value;
+	while(GeneralIO::readKeyValue(fin, key, value)){
+	  cout << "key \"" << key << "\"\tvalue \"" << value << "\"" << endl;
+	}
+	cout << "\n\nKV list ended.\n";
+      }
+      catch(...){
+	cerr << "Unknown exception trapped.\n";
+      }
+    }
+
+  }
+  catch(...){
+    cerr << "Unknown exception trapped.\n";
+  }
+
+
+  cout << "\n\n";
+  cout << "Tests ended.\n";
+
+  FUNCEND();
+  return 0;
+}
+
diff --git a/src/test/io/scf/Makefile.am b/src/test/io/scf/Makefile.am
new file mode 100644
index 0000000..bcb38dc
--- /dev/null
+++ b/src/test/io/scf/Makefile.am
@@ -0,0 +1,19 @@
+INCLUDES = -I$(top_srcdir)/src $(all_includes)
+
+noinst_PROGRAMS= tstSCF
+# EdIt_abi373 EdIt_alf
+
+AM_LDFLAGS= -L../../../io/ -L../../../util/ -L../../../errorhandling/ -L../../../mira -L../../../examine/ -L../../../EdIt/ -L../../../caf/ -L../../../knn_abi373 -L../../../knn_alf 
+
+tstSCF_SOURCES= tstSCF.C
+tstSCF_LDADD= -lmiraerrorhandling  -lmirautil -lmirafio
+
+
+
+#convert_project: libinstall convert_project.C
+##       $(CPP) $(CCFLAGS) $(INC_DIRS) makeFASTA.C -o makeFASTA  $(LIB) $(LIB_DIR
+#S)  -lscflookclips -lClip -lerrorhandling  -lutil -lmyio -lm
+#	  $(CPP) $(CCFLAGS) convert_project.C -o convert_project $(INC_DIRS) $(LI
+#B) $(LIB_DIRS)  -lerrorhandling  -lutil -lmyio -lcaf -lEdIt -lExamine -lKNN_jena
+# -lm
+#	  cp convert_project $(TARGET_BINDIR)
diff --git a/src/errorhandling/Makefile.in b/src/test/io/scf/Makefile.in
similarity index 81%
copy from src/errorhandling/Makefile.in
copy to src/test/io/scf/Makefile.in
index 3074d7b..a3a78e2 100644
--- a/src/errorhandling/Makefile.in
+++ b/src/test/io/scf/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -15,7 +15,6 @@
 
 @SET_MAKE@
 
-
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
@@ -35,29 +34,35 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
-subdir = src/errorhandling
-DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
-	$(srcdir)/Makefile.in
+noinst_PROGRAMS = tstSCF$(EXEEXT)
+subdir = src/test/io/scf
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/ax_boost_base.m4 \
-	$(top_srcdir)/m4/ax_boost_filesystem.m4 \
-	$(top_srcdir)/m4/ax_boost_iostreams.m4 \
-	$(top_srcdir)/m4/ax_boost_regex.m4 \
-	$(top_srcdir)/m4/ax_boost_system.m4 \
-	$(top_srcdir)/m4/ax_boost_thread.m4 \
-	$(top_srcdir)/m4/ax_check_zlib.m4 \
-	$(top_srcdir)/m4/ax_lib_expat.m4 $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/config/m4/ax_boost_base.m4 \
+	$(top_srcdir)/config/m4/ax_boost_regex.m4 \
+	$(top_srcdir)/config/m4/ax_boost_thread.m4 \
+	$(top_srcdir)/config/m4/ax_check_zlib.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_std.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_stl.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_namespaces.m4 \
+	$(top_srcdir)/config/m4/ax_lib_expat.m4 \
+	$(top_srcdir)/config/m4/ax_with_perl.m4 \
+	$(top_srcdir)/config/m4/ax_with_prog.m4 \
+	$(top_srcdir)/config/m4/libtool.m4 \
+	$(top_srcdir)/config/m4/ltoptions.m4 \
+	$(top_srcdir)/config/m4/ltsugar.m4 \
+	$(top_srcdir)/config/m4/ltversion.m4 \
+	$(top_srcdir)/config/m4/lt~obsolete.m4 \
+	$(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
-LIBRARIES = $(noinst_LIBRARIES)
-ARFLAGS = cru
-libmiraerrorhandling_a_AR = $(AR) $(ARFLAGS)
-libmiraerrorhandling_a_LIBADD =
-am_libmiraerrorhandling_a_OBJECTS = errorhandling.$(OBJEXT)
-libmiraerrorhandling_a_OBJECTS = $(am_libmiraerrorhandling_a_OBJECTS)
+PROGRAMS = $(noinst_PROGRAMS)
+am_tstSCF_OBJECTS = tstSCF.$(OBJEXT)
+tstSCF_OBJECTS = $(am_tstSCF_OBJECTS)
+tstSCF_DEPENDENCIES =
 DEFAULT_INCLUDES = -I. at am__isrc@
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
@@ -71,9 +76,8 @@ CXXLD = $(CXX)
 CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	--mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
 	$(LDFLAGS) -o $@
-SOURCES = $(libmiraerrorhandling_a_SOURCES)
-DIST_SOURCES = $(libmiraerrorhandling_a_SOURCES)
-HEADERS = $(noinst_HEADERS)
+SOURCES = $(tstSCF_SOURCES)
+DIST_SOURCES = $(tstSCF_SOURCES)
 ETAGS = etags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -87,13 +91,9 @@ AWK = @AWK@
 BITPACKAGE = @BITPACKAGE@
 BLOODYDARWINSTATLIBDIRHACK = @BLOODYDARWINSTATLIBDIRHACK@
 BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
-BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@
-BOOST_IOSTREAMS_LIB = @BOOST_IOSTREAMS_LIB@
 BOOST_LDFLAGS = @BOOST_LDFLAGS@
 BOOST_REGEX_LIB = @BOOST_REGEX_LIB@
-BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@
 BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
-BUNDLETARGET = @BUNDLETARGET@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
@@ -106,7 +106,6 @@ CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -116,13 +115,11 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LDFLAGS = @EXPAT_LDFLAGS@
-EXPAT_LIBS = @EXPAT_LIBS@
 EXPAT_VERSION = @EXPAT_VERSION@
 FGREP = @FGREP@
 FLEX = @FLEX@
 FLEXPP = @FLEXPP@
 GREP = @GREP@
-HAVE_XXD = @HAVE_XXD@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -140,7 +137,6 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
 MIRASTATIC = @MIRASTATIC@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
@@ -157,17 +153,18 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
+SHORTMIRAAUDIENCE = @SHORTMIRAAUDIENCE@
 STRIP = @STRIP@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -201,6 +198,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -216,10 +214,11 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-AM_CPPFLAGS = -I$(top_srcdir)/src $(all_includes)
-noinst_LIBRARIES = libmiraerrorhandling.a
-libmiraerrorhandling_a_SOURCES = errorhandling.C
-noinst_HEADERS = errorhandling.H
+INCLUDES = -I$(top_srcdir)/src $(all_includes)
+# EdIt_abi373 EdIt_alf
+AM_LDFLAGS = -L../../../io/ -L../../../util/ -L../../../errorhandling/ -L../../../mira -L../../../examine/ -L../../../EdIt/ -L../../../caf/ -L../../../knn_abi373 -L../../../knn_alf 
+tstSCF_SOURCES = tstSCF.C
+tstSCF_LDADD = -lmiraerrorhandling  -lmirautil -lmirafio
 all: all-am
 
 .SUFFIXES:
@@ -233,9 +232,9 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/errorhandling/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/test/io/scf/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu src/errorhandling/Makefile
+	  $(AUTOMAKE) --gnu src/test/io/scf/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -255,12 +254,17 @@ $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(am__aclocal_m4_deps):
 
-clean-noinstLIBRARIES:
-	-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
-libmiraerrorhandling.a: $(libmiraerrorhandling_a_OBJECTS) $(libmiraerrorhandling_a_DEPENDENCIES) $(EXTRA_libmiraerrorhandling_a_DEPENDENCIES) 
-	-rm -f libmiraerrorhandling.a
-	$(libmiraerrorhandling_a_AR) libmiraerrorhandling.a $(libmiraerrorhandling_a_OBJECTS) $(libmiraerrorhandling_a_LIBADD)
-	$(RANLIB) libmiraerrorhandling.a
+clean-noinstPROGRAMS:
+	@list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
+	echo " rm -f" $$list; \
+	rm -f $$list || exit $$?; \
+	test -n "$(EXEEXT)" || exit 0; \
+	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+	echo " rm -f" $$list; \
+	rm -f $$list
+tstSCF$(EXEEXT): $(tstSCF_OBJECTS) $(tstSCF_DEPENDENCIES) 
+	@rm -f tstSCF$(EXEEXT)
+	$(CXXLINK) $(tstSCF_OBJECTS) $(tstSCF_LDADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -268,7 +272,7 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/errorhandling.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tstSCF.Po at am__quote@
 
 .C.o:
 @am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@@ -381,7 +385,7 @@ distdir: $(DISTFILES)
 	done
 check-am: all-am
 check: check-am
-all-am: Makefile $(LIBRARIES) $(HEADERS)
+all-am: Makefile $(PROGRAMS)
 installdirs:
 install: install-am
 install-exec: install-exec-am
@@ -393,15 +397,10 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	if test -z '$(STRIP)'; then \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	      install; \
-	else \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-	fi
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
 mostlyclean-generic:
 
 clean-generic:
@@ -415,7 +414,7 @@ maintainer-clean-generic:
 	@echo "it deletes files that may require special tools to rebuild."
 clean: clean-am
 
-clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
+clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
 	mostlyclean-am
 
 distclean: distclean-am
@@ -487,7 +486,7 @@ uninstall-am:
 .MAKE: install-am install-strip
 
 .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
-	clean-libtool clean-noinstLIBRARIES ctags distclean \
+	clean-libtool clean-noinstPROGRAMS ctags distclean \
 	distclean-compile distclean-generic distclean-libtool \
 	distclean-tags distdir dvi dvi-am html html-am info info-am \
 	install install-am install-data install-data-am install-dvi \
@@ -500,6 +499,13 @@ uninstall-am:
 	pdf pdf-am ps ps-am tags uninstall uninstall-am
 
 
+#convert_project: libinstall convert_project.C
+#S)  -lscflookclips -lClip -lerrorhandling  -lutil -lmyio -lm
+#	  $(CPP) $(CCFLAGS) convert_project.C -o convert_project $(INC_DIRS) $(LI
+#B) $(LIB_DIRS)  -lerrorhandling  -lutil -lmyio -lcaf -lEdIt -lExamine -lKNN_jena
+# -lm
+#	  cp convert_project $(TARGET_BINDIR)
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/src/test/io/scf/tstSCF.C b/src/test/io/scf/tstSCF.C
new file mode 100644
index 0000000..eae6528
--- /dev/null
+++ b/src/test/io/scf/tstSCF.C
@@ -0,0 +1,30 @@
+#include <iostream>
+
+#include <limits.h>
+
+#include "io/scf.H"
+#include "io/exp.H"
+
+#include "stdinc/stlincludes.H"
+
+char * scfname = "5.scf";
+
+int main(void)
+{
+  SCF * test1;
+  test1=new SCF;
+
+  try{
+    test1->load(scfname);
+    //    test1->save("good.scf");
+  }
+  catch(Notify n){
+    n.handleError("main()");
+  }
+  test1->dump();
+  //  test1->discard();
+
+
+  return 0;
+}
+
diff --git a/src/test/mira/Makefile.am b/src/test/mira/Makefile.am
new file mode 100644
index 0000000..cd1a4e1
--- /dev/null
+++ b/src/test/mira/Makefile.am
@@ -0,0 +1,4 @@
+# bla
+
+SUBDIRS = align read readpool
+
diff --git a/doc/Makefile.in b/src/test/mira/Makefile.in
similarity index 92%
copy from doc/Makefile.in
copy to src/test/mira/Makefile.in
index e6f4121..60e0f67 100644
--- a/doc/Makefile.in
+++ b/src/test/mira/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -14,6 +14,8 @@
 # PARTICULAR PURPOSE.
 
 @SET_MAKE@
+
+# bla
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
@@ -33,17 +35,25 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
-subdir = doc
+subdir = src/test/mira
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/ax_boost_base.m4 \
-	$(top_srcdir)/m4/ax_boost_filesystem.m4 \
-	$(top_srcdir)/m4/ax_boost_iostreams.m4 \
-	$(top_srcdir)/m4/ax_boost_regex.m4 \
-	$(top_srcdir)/m4/ax_boost_system.m4 \
-	$(top_srcdir)/m4/ax_boost_thread.m4 \
-	$(top_srcdir)/m4/ax_check_zlib.m4 \
-	$(top_srcdir)/m4/ax_lib_expat.m4 $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/config/m4/ax_boost_base.m4 \
+	$(top_srcdir)/config/m4/ax_boost_regex.m4 \
+	$(top_srcdir)/config/m4/ax_boost_thread.m4 \
+	$(top_srcdir)/config/m4/ax_check_zlib.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_std.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_stl.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_namespaces.m4 \
+	$(top_srcdir)/config/m4/ax_lib_expat.m4 \
+	$(top_srcdir)/config/m4/ax_with_perl.m4 \
+	$(top_srcdir)/config/m4/ax_with_prog.m4 \
+	$(top_srcdir)/config/m4/libtool.m4 \
+	$(top_srcdir)/config/m4/ltoptions.m4 \
+	$(top_srcdir)/config/m4/ltsugar.m4 \
+	$(top_srcdir)/config/m4/ltversion.m4 \
+	$(top_srcdir)/config/m4/lt~obsolete.m4 \
+	$(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -102,13 +112,9 @@ AWK = @AWK@
 BITPACKAGE = @BITPACKAGE@
 BLOODYDARWINSTATLIBDIRHACK = @BLOODYDARWINSTATLIBDIRHACK@
 BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
-BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@
-BOOST_IOSTREAMS_LIB = @BOOST_IOSTREAMS_LIB@
 BOOST_LDFLAGS = @BOOST_LDFLAGS@
 BOOST_REGEX_LIB = @BOOST_REGEX_LIB@
-BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@
 BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
-BUNDLETARGET = @BUNDLETARGET@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
@@ -121,7 +127,6 @@ CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -131,13 +136,11 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LDFLAGS = @EXPAT_LDFLAGS@
-EXPAT_LIBS = @EXPAT_LIBS@
 EXPAT_VERSION = @EXPAT_VERSION@
 FGREP = @FGREP@
 FLEX = @FLEX@
 FLEXPP = @FLEXPP@
 GREP = @GREP@
-HAVE_XXD = @HAVE_XXD@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -155,7 +158,6 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
 MIRASTATIC = @MIRASTATIC@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
@@ -172,17 +174,18 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
+SHORTMIRAAUDIENCE = @SHORTMIRAAUDIENCE@
 STRIP = @STRIP@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -216,6 +219,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -231,7 +235,7 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-SUBDIRS = docbook
+SUBDIRS = align read readpool
 all: all-recursive
 
 .SUFFIXES:
@@ -244,9 +248,9 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/test/mira/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu doc/Makefile
+	  $(AUTOMAKE) --gnu src/test/mira/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -480,15 +484,10 @@ install-am: all-am
 
 installcheck: installcheck-recursive
 install-strip:
-	if test -z '$(STRIP)'; then \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	      install; \
-	else \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-	fi
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
 mostlyclean-generic:
 
 clean-generic:
diff --git a/src/test/mira/align/Makefile.am b/src/test/mira/align/Makefile.am
new file mode 100644
index 0000000..8ced821
--- /dev/null
+++ b/src/test/mira/align/Makefile.am
@@ -0,0 +1,20 @@
+INCLUDES = -I$(top_srcdir)/src $(all_includes)
+
+noinst_PROGRAMS= tstAlign
+# EdIt_abi373 EdIt_alf
+
+AM_LDFLAGS= -L../../../io/ -L../../../util/ -L../../../errorhandling/ -L../../../mira -L../../../examine/ -L../../../EdIt/ -L../../../caf/ -L../../../knn_abi373 -L../../../knn_alf 
+
+tstAlign_SOURCES= tstAlign.C
+tstAlign_LDADD= -lmirasupport -lmiraerrorhandling  -lmirautil -lmiradptools -lmirafio 
+
+
+
+
+#convert_project: libinstall convert_project.C
+##       $(CPP) $(CCFLAGS) $(INC_DIRS) makeFASTA.C -o makeFASTA  $(LIB) $(LIB_DIR
+#S)  -lscflookclips -lClip -lerrorhandling  -lutil -lmyio -lm
+#	  $(CPP) $(CCFLAGS) convert_project.C -o convert_project $(INC_DIRS) $(LI
+#B) $(LIB_DIRS)  -lerrorhandling  -lutil -lmyio -lcaf -lEdIt -lExamine -lKNN_jena
+# -lm
+#	  cp convert_project $(TARGET_BINDIR)
diff --git a/src/errorhandling/Makefile.in b/src/test/mira/align/Makefile.in
similarity index 81%
copy from src/errorhandling/Makefile.in
copy to src/test/mira/align/Makefile.in
index 3074d7b..ec8fee8 100644
--- a/src/errorhandling/Makefile.in
+++ b/src/test/mira/align/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -15,7 +15,6 @@
 
 @SET_MAKE@
 
-
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
@@ -35,29 +34,35 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
-subdir = src/errorhandling
-DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
-	$(srcdir)/Makefile.in
+noinst_PROGRAMS = tstAlign$(EXEEXT)
+subdir = src/test/mira/align
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/ax_boost_base.m4 \
-	$(top_srcdir)/m4/ax_boost_filesystem.m4 \
-	$(top_srcdir)/m4/ax_boost_iostreams.m4 \
-	$(top_srcdir)/m4/ax_boost_regex.m4 \
-	$(top_srcdir)/m4/ax_boost_system.m4 \
-	$(top_srcdir)/m4/ax_boost_thread.m4 \
-	$(top_srcdir)/m4/ax_check_zlib.m4 \
-	$(top_srcdir)/m4/ax_lib_expat.m4 $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/config/m4/ax_boost_base.m4 \
+	$(top_srcdir)/config/m4/ax_boost_regex.m4 \
+	$(top_srcdir)/config/m4/ax_boost_thread.m4 \
+	$(top_srcdir)/config/m4/ax_check_zlib.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_std.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_stl.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_namespaces.m4 \
+	$(top_srcdir)/config/m4/ax_lib_expat.m4 \
+	$(top_srcdir)/config/m4/ax_with_perl.m4 \
+	$(top_srcdir)/config/m4/ax_with_prog.m4 \
+	$(top_srcdir)/config/m4/libtool.m4 \
+	$(top_srcdir)/config/m4/ltoptions.m4 \
+	$(top_srcdir)/config/m4/ltsugar.m4 \
+	$(top_srcdir)/config/m4/ltversion.m4 \
+	$(top_srcdir)/config/m4/lt~obsolete.m4 \
+	$(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
-LIBRARIES = $(noinst_LIBRARIES)
-ARFLAGS = cru
-libmiraerrorhandling_a_AR = $(AR) $(ARFLAGS)
-libmiraerrorhandling_a_LIBADD =
-am_libmiraerrorhandling_a_OBJECTS = errorhandling.$(OBJEXT)
-libmiraerrorhandling_a_OBJECTS = $(am_libmiraerrorhandling_a_OBJECTS)
+PROGRAMS = $(noinst_PROGRAMS)
+am_tstAlign_OBJECTS = tstAlign.$(OBJEXT)
+tstAlign_OBJECTS = $(am_tstAlign_OBJECTS)
+tstAlign_DEPENDENCIES =
 DEFAULT_INCLUDES = -I. at am__isrc@
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
@@ -71,9 +76,8 @@ CXXLD = $(CXX)
 CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	--mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
 	$(LDFLAGS) -o $@
-SOURCES = $(libmiraerrorhandling_a_SOURCES)
-DIST_SOURCES = $(libmiraerrorhandling_a_SOURCES)
-HEADERS = $(noinst_HEADERS)
+SOURCES = $(tstAlign_SOURCES)
+DIST_SOURCES = $(tstAlign_SOURCES)
 ETAGS = etags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -87,13 +91,9 @@ AWK = @AWK@
 BITPACKAGE = @BITPACKAGE@
 BLOODYDARWINSTATLIBDIRHACK = @BLOODYDARWINSTATLIBDIRHACK@
 BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
-BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@
-BOOST_IOSTREAMS_LIB = @BOOST_IOSTREAMS_LIB@
 BOOST_LDFLAGS = @BOOST_LDFLAGS@
 BOOST_REGEX_LIB = @BOOST_REGEX_LIB@
-BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@
 BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
-BUNDLETARGET = @BUNDLETARGET@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
@@ -106,7 +106,6 @@ CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -116,13 +115,11 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LDFLAGS = @EXPAT_LDFLAGS@
-EXPAT_LIBS = @EXPAT_LIBS@
 EXPAT_VERSION = @EXPAT_VERSION@
 FGREP = @FGREP@
 FLEX = @FLEX@
 FLEXPP = @FLEXPP@
 GREP = @GREP@
-HAVE_XXD = @HAVE_XXD@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -140,7 +137,6 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
 MIRASTATIC = @MIRASTATIC@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
@@ -157,17 +153,18 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
+SHORTMIRAAUDIENCE = @SHORTMIRAAUDIENCE@
 STRIP = @STRIP@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -201,6 +198,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -216,10 +214,11 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-AM_CPPFLAGS = -I$(top_srcdir)/src $(all_includes)
-noinst_LIBRARIES = libmiraerrorhandling.a
-libmiraerrorhandling_a_SOURCES = errorhandling.C
-noinst_HEADERS = errorhandling.H
+INCLUDES = -I$(top_srcdir)/src $(all_includes)
+# EdIt_abi373 EdIt_alf
+AM_LDFLAGS = -L../../../io/ -L../../../util/ -L../../../errorhandling/ -L../../../mira -L../../../examine/ -L../../../EdIt/ -L../../../caf/ -L../../../knn_abi373 -L../../../knn_alf 
+tstAlign_SOURCES = tstAlign.C
+tstAlign_LDADD = -lmirasupport -lmiraerrorhandling  -lmirautil -lmiradptools -lmirafio 
 all: all-am
 
 .SUFFIXES:
@@ -233,9 +232,9 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/errorhandling/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/test/mira/align/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu src/errorhandling/Makefile
+	  $(AUTOMAKE) --gnu src/test/mira/align/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -255,12 +254,17 @@ $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(am__aclocal_m4_deps):
 
-clean-noinstLIBRARIES:
-	-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
-libmiraerrorhandling.a: $(libmiraerrorhandling_a_OBJECTS) $(libmiraerrorhandling_a_DEPENDENCIES) $(EXTRA_libmiraerrorhandling_a_DEPENDENCIES) 
-	-rm -f libmiraerrorhandling.a
-	$(libmiraerrorhandling_a_AR) libmiraerrorhandling.a $(libmiraerrorhandling_a_OBJECTS) $(libmiraerrorhandling_a_LIBADD)
-	$(RANLIB) libmiraerrorhandling.a
+clean-noinstPROGRAMS:
+	@list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
+	echo " rm -f" $$list; \
+	rm -f $$list || exit $$?; \
+	test -n "$(EXEEXT)" || exit 0; \
+	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+	echo " rm -f" $$list; \
+	rm -f $$list
+tstAlign$(EXEEXT): $(tstAlign_OBJECTS) $(tstAlign_DEPENDENCIES) 
+	@rm -f tstAlign$(EXEEXT)
+	$(CXXLINK) $(tstAlign_OBJECTS) $(tstAlign_LDADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -268,7 +272,7 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/errorhandling.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tstAlign.Po at am__quote@
 
 .C.o:
 @am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@@ -381,7 +385,7 @@ distdir: $(DISTFILES)
 	done
 check-am: all-am
 check: check-am
-all-am: Makefile $(LIBRARIES) $(HEADERS)
+all-am: Makefile $(PROGRAMS)
 installdirs:
 install: install-am
 install-exec: install-exec-am
@@ -393,15 +397,10 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	if test -z '$(STRIP)'; then \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	      install; \
-	else \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-	fi
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
 mostlyclean-generic:
 
 clean-generic:
@@ -415,7 +414,7 @@ maintainer-clean-generic:
 	@echo "it deletes files that may require special tools to rebuild."
 clean: clean-am
 
-clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
+clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
 	mostlyclean-am
 
 distclean: distclean-am
@@ -487,7 +486,7 @@ uninstall-am:
 .MAKE: install-am install-strip
 
 .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
-	clean-libtool clean-noinstLIBRARIES ctags distclean \
+	clean-libtool clean-noinstPROGRAMS ctags distclean \
 	distclean-compile distclean-generic distclean-libtool \
 	distclean-tags distdir dvi dvi-am html html-am info info-am \
 	install install-am install-data install-data-am install-dvi \
@@ -500,6 +499,13 @@ uninstall-am:
 	pdf pdf-am ps ps-am tags uninstall uninstall-am
 
 
+#convert_project: libinstall convert_project.C
+#S)  -lscflookclips -lClip -lerrorhandling  -lutil -lmyio -lm
+#	  $(CPP) $(CCFLAGS) convert_project.C -o convert_project $(INC_DIRS) $(LI
+#B) $(LIB_DIRS)  -lerrorhandling  -lutil -lmyio -lcaf -lEdIt -lExamine -lKNN_jena
+# -lm
+#	  cp convert_project $(TARGET_BINDIR)
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/src/test/mira/align/tstAlign.C b/src/test/mira/align/tstAlign.C
new file mode 100644
index 0000000..f45a490
--- /dev/null
+++ b/src/test/mira/align/tstAlign.C
@@ -0,0 +1,72 @@
+#include <limits.h>
+#include <iostream>
+
+#include "io/fasta.H"
+#include "stdinc/stlincludes.H"
+#include "mira/parameters.H"
+#include "mira/align.H"
+
+//char seq1[]="TNTAATTTCAAACAGGAAGGTATTCTACAAGTTCTTTATTAAAAAATAAAGAAAAAACATTTATTATTGACCCAAAACATAAATGAAAAAACAACGACCATAGATTATTACGNTCTTAATANCTAAACTCTAAAGAGAGTTCTCTTTTAGGNCTGGGGANNGAAGAATCTTTTTAACAATNGACGGNGTCGGTAAAATTCAGACGTAACTAATTCAGTGTCGGNAGTATTTCACAAAGATGAACGAGTATTATCGGGGGTATTTGAAATTCAAAGTTTATTCTTTACTACACCAAAACATTTTTTNGNTTAGNNCGAGANACCGTNTACACATAGAGNCTCTATTTACGANNNAACTAAAGGGNTNAAAATTTTGNGNNGGGNCNAATTACAGNAGATGACTCATATCAGNNGNNAATCGNNNGNNNGNAAATTTGGCCAAANCNAAGAAACCTTCCCACTNGGAAAACCGGNNNNG [...]
+//char seq2[]="TTTAATTTCAAAAAGGAAGGTATTCTACAAGTTCTTTATTAAAAAATAAAGAAAAAACATTTATTATTGACCCAAAACATAAATGAAAAAACAACGACCATAGATTATTACGTTCTTAATATCTAAACTCTAAAGAGAGTTCTCTTTTAGGTCTGGAGAAAGGAAGATTCTTTTAACAATAGACGATGTCGTAAAATTTAGACGTAACTAATATAGTGTCGGTAGTATTTCACAAAGATGAACGAGTATTATCGGGGGTATTTGAAATTCAAAGTTTATTCTTTACTACACCAAAACATTTTTTAGATTAGTACGAAAAACCGTCTACACATAGAGCTCTATTTACGATTCAACTAAAGTGCTAAAAATTTTGTGAGGGGTTATAATTATAGTAGATACTCATATTAGAATAATCGTTAATCGAAAATTTGACAAACAAGAAACTTCCATTGTAAACGTTTAGTAAACTTCTTTAAG [...]
+
+
+
+//char seq1[]="TCGGC*TCAAACAGCTCACGCTAAAAGTTGGCGAATCGATGAGACCTATATTCGAGTTAAAGGCCGTTGGGCCTATTTGTATCGCGCTATTGACAGTAACGGTTTGACCATGGATTTTGAGCTACGAAAACACCGCGATTATACCGCATCCTATCACTTTTTGAAGCGTCTCTTGACGACCAATGGTCGGCCTGATCGATTAGTCACTGATCAATATCAGGCAACACTGAAAGCAGTGAAGCATCTGATAAAGCAAGACTATTTGAGCAAATCAGCCCACCAATGTTCCAAATATCGAAATAATTTGATTGAACAGGACCACCGATTCATTAAACGTCATCGTGTCCGCTCAGCAAGCTTTCAAAGCATTCGAACCGCTAGTGCAACGTTGAGCGGTGTAGGAAATTGTTCNNACGCAATCCGCAAAAGAACCCGACGAGAGTTAAGTCAATCACTCGTGGTTCTCNAGTCAGTGGA [...]
+
+//char seq2[]="CTCAAACAGCTCACGCTAAAAGTTGGCGAATCGATGAGACCTATATTCGAGTTAAAGGCCGTTGGGCCTATTTGTATCGCGCTATTGACAGTAACGGTTTGACCATGGATTTTGAGCTACGAAAACACCGCGATTATACCGCATCCTATCACTTTTTGAAGCGTCTCTTGACGACCAATGGTCGGCCTGATCGATTAGTCACTGATCAATATCAGGCAACACTGAAAGCAGTGAAGCATCTGATAAAGCAAGACTATTTGAGCAAATCAGCCCACCAATGTTCCAAATATCGAAATAATTTGATTGAACAGGACCACCGATTCATTAAACGTCATCGTGTCCGCTCAGCAAGCTTTCAAAGCATTCGAACCGCTAGTGCAACGTTGAGCGGTGTGGAAATTGTTCACGCAATCCGCAAAAGAACCCGACGAGAGTTAAGTCTCATCGGGTTCTCAGTCGTGGACGAATTAGAAGCAT [...]
+
+
+char seq1[]="GCTGACCAGCGCCCCGGA*TTCTCCCTTTTTCAGTTCATCATATCTCTCCATACAAAACCT*CCTCCCCGCTCAC*ATTTTCCTATTAT*TATCTTACAAAG**CTGA*ACCGCAGTGGGTCTACAGAAACATGATTCACCCGCCACAGAAAAATAGTGACGATGGAACACTTTTTCTCTCATCCAATTTATTTGCTCCG*CCAAAAAGCCCATCAGAT*CCAATGACACCAGCGCTTCTCGCATTCTATCAAATTGTAAA*TAGTAC*ACAAAATCACACAGCAAATAAAAAAACGAAACATTTTTT*CCACACATTCGCTGAAAGCG*CAAACAAAAAC*ACTACAAATTTGAAATAAAACGTTATATTTT*CTCACATGAATTTTCGACAAACTGTATATTTATGATAGAGTTTCAATTATCATAATATTCAGTAATGATTGC**ANTTTTAAAAGGAGGTAACTTAT**AGTAA* [...]
+
+char seq2[]="TTTTCAGTTCATCATATCTCTCCATACAAAACCTCCTCCCCGCTCACATTTTCCTATTATTATCTTACAAAGCTGAACCGCAGTGGGTCTACAGAAACATGATTC";
+
+
+int main(int argc, char ** argv)
+{
+  FUNCSTART("main");
+
+  try{
+    vector<MIRAParameters> Pv;
+    MIRAParameters::setupStdMIRAParameters(Pv);
+
+    MIRAParameters::parse(argc, argv, Pv);
+
+    Pv[0].setAlignMinScore(1);
+    Pv[0].setAlignMinRelScore(20);
+    Pv[0].setAlignMinOverlap(1);
+    
+    
+    list<AlignedDualSeq> madsl;
+    Align bla(&Pv[0]);
+    
+    bla.acquireSequences((const char*) seq1, strlen(seq1), 
+			 (const char*) seq2, strlen(seq2), 
+			 1, 2, 1, 1,
+			 true, 15);
+    bla.fullAlign(&madsl,false,false);
+    list<AlignedDualSeq>::iterator I;
+    cout << "madsl.size(): " << madsl.size() << endl;
+    
+    {
+      for(I= madsl.begin(); I!=madsl.end(); I++){
+	if(I->isValid()==true){
+	  cout << *I;
+	}
+      }
+    }
+    
+    cout << "\n\n\nmadsl has " << madsl.size() << " elements.\n" <<endl;
+    
+  }
+  catch(Notify n){
+    n.handleError("main");
+  }
+  cout << "\n\n";
+  
+  cout << "Tests ended.\n";
+  
+  FUNCEND();
+  return 0;
+}
+
+
diff --git a/src/test/mira/read/Makefile.am b/src/test/mira/read/Makefile.am
new file mode 100644
index 0000000..ecf7392
--- /dev/null
+++ b/src/test/mira/read/Makefile.am
@@ -0,0 +1,10 @@
+INCLUDES = -I$(top_srcdir)/src $(all_includes)
+
+noinst_PROGRAMS= tstRead
+# EdIt_abi373 EdIt_alf
+
+AM_LDFLAGS= -L../../../io/ -L../../../util/ -L../../../errorhandling/ -L../../../mira -L../../../examine/ -L../../../EdIt/ -L../../../caf/ -L../../../knn_abi373 -L../../../knn_alf 
+
+tstRead_SOURCES= tstRead.C
+tstRead_LDADD= -lmiraerrorhandling  -lmirautil -lmira -lmirasupport -lmiradptools -lmirafio
+
diff --git a/src/errorhandling/Makefile.in b/src/test/mira/read/Makefile.in
similarity index 83%
copy from src/errorhandling/Makefile.in
copy to src/test/mira/read/Makefile.in
index 3074d7b..b0e6920 100644
--- a/src/errorhandling/Makefile.in
+++ b/src/test/mira/read/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -15,7 +15,6 @@
 
 @SET_MAKE@
 
-
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
@@ -35,29 +34,35 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
-subdir = src/errorhandling
-DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
-	$(srcdir)/Makefile.in
+noinst_PROGRAMS = tstRead$(EXEEXT)
+subdir = src/test/mira/read
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/ax_boost_base.m4 \
-	$(top_srcdir)/m4/ax_boost_filesystem.m4 \
-	$(top_srcdir)/m4/ax_boost_iostreams.m4 \
-	$(top_srcdir)/m4/ax_boost_regex.m4 \
-	$(top_srcdir)/m4/ax_boost_system.m4 \
-	$(top_srcdir)/m4/ax_boost_thread.m4 \
-	$(top_srcdir)/m4/ax_check_zlib.m4 \
-	$(top_srcdir)/m4/ax_lib_expat.m4 $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/config/m4/ax_boost_base.m4 \
+	$(top_srcdir)/config/m4/ax_boost_regex.m4 \
+	$(top_srcdir)/config/m4/ax_boost_thread.m4 \
+	$(top_srcdir)/config/m4/ax_check_zlib.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_std.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_stl.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_namespaces.m4 \
+	$(top_srcdir)/config/m4/ax_lib_expat.m4 \
+	$(top_srcdir)/config/m4/ax_with_perl.m4 \
+	$(top_srcdir)/config/m4/ax_with_prog.m4 \
+	$(top_srcdir)/config/m4/libtool.m4 \
+	$(top_srcdir)/config/m4/ltoptions.m4 \
+	$(top_srcdir)/config/m4/ltsugar.m4 \
+	$(top_srcdir)/config/m4/ltversion.m4 \
+	$(top_srcdir)/config/m4/lt~obsolete.m4 \
+	$(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
-LIBRARIES = $(noinst_LIBRARIES)
-ARFLAGS = cru
-libmiraerrorhandling_a_AR = $(AR) $(ARFLAGS)
-libmiraerrorhandling_a_LIBADD =
-am_libmiraerrorhandling_a_OBJECTS = errorhandling.$(OBJEXT)
-libmiraerrorhandling_a_OBJECTS = $(am_libmiraerrorhandling_a_OBJECTS)
+PROGRAMS = $(noinst_PROGRAMS)
+am_tstRead_OBJECTS = tstRead.$(OBJEXT)
+tstRead_OBJECTS = $(am_tstRead_OBJECTS)
+tstRead_DEPENDENCIES =
 DEFAULT_INCLUDES = -I. at am__isrc@
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
@@ -71,9 +76,8 @@ CXXLD = $(CXX)
 CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	--mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
 	$(LDFLAGS) -o $@
-SOURCES = $(libmiraerrorhandling_a_SOURCES)
-DIST_SOURCES = $(libmiraerrorhandling_a_SOURCES)
-HEADERS = $(noinst_HEADERS)
+SOURCES = $(tstRead_SOURCES)
+DIST_SOURCES = $(tstRead_SOURCES)
 ETAGS = etags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -87,13 +91,9 @@ AWK = @AWK@
 BITPACKAGE = @BITPACKAGE@
 BLOODYDARWINSTATLIBDIRHACK = @BLOODYDARWINSTATLIBDIRHACK@
 BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
-BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@
-BOOST_IOSTREAMS_LIB = @BOOST_IOSTREAMS_LIB@
 BOOST_LDFLAGS = @BOOST_LDFLAGS@
 BOOST_REGEX_LIB = @BOOST_REGEX_LIB@
-BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@
 BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
-BUNDLETARGET = @BUNDLETARGET@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
@@ -106,7 +106,6 @@ CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -116,13 +115,11 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LDFLAGS = @EXPAT_LDFLAGS@
-EXPAT_LIBS = @EXPAT_LIBS@
 EXPAT_VERSION = @EXPAT_VERSION@
 FGREP = @FGREP@
 FLEX = @FLEX@
 FLEXPP = @FLEXPP@
 GREP = @GREP@
-HAVE_XXD = @HAVE_XXD@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -140,7 +137,6 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
 MIRASTATIC = @MIRASTATIC@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
@@ -157,17 +153,18 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
+SHORTMIRAAUDIENCE = @SHORTMIRAAUDIENCE@
 STRIP = @STRIP@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -201,6 +198,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -216,10 +214,11 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-AM_CPPFLAGS = -I$(top_srcdir)/src $(all_includes)
-noinst_LIBRARIES = libmiraerrorhandling.a
-libmiraerrorhandling_a_SOURCES = errorhandling.C
-noinst_HEADERS = errorhandling.H
+INCLUDES = -I$(top_srcdir)/src $(all_includes)
+# EdIt_abi373 EdIt_alf
+AM_LDFLAGS = -L../../../io/ -L../../../util/ -L../../../errorhandling/ -L../../../mira -L../../../examine/ -L../../../EdIt/ -L../../../caf/ -L../../../knn_abi373 -L../../../knn_alf 
+tstRead_SOURCES = tstRead.C
+tstRead_LDADD = -lmiraerrorhandling  -lmirautil -lmira -lmirasupport -lmiradptools -lmirafio
 all: all-am
 
 .SUFFIXES:
@@ -233,9 +232,9 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/errorhandling/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/test/mira/read/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu src/errorhandling/Makefile
+	  $(AUTOMAKE) --gnu src/test/mira/read/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -255,12 +254,17 @@ $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(am__aclocal_m4_deps):
 
-clean-noinstLIBRARIES:
-	-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
-libmiraerrorhandling.a: $(libmiraerrorhandling_a_OBJECTS) $(libmiraerrorhandling_a_DEPENDENCIES) $(EXTRA_libmiraerrorhandling_a_DEPENDENCIES) 
-	-rm -f libmiraerrorhandling.a
-	$(libmiraerrorhandling_a_AR) libmiraerrorhandling.a $(libmiraerrorhandling_a_OBJECTS) $(libmiraerrorhandling_a_LIBADD)
-	$(RANLIB) libmiraerrorhandling.a
+clean-noinstPROGRAMS:
+	@list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
+	echo " rm -f" $$list; \
+	rm -f $$list || exit $$?; \
+	test -n "$(EXEEXT)" || exit 0; \
+	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+	echo " rm -f" $$list; \
+	rm -f $$list
+tstRead$(EXEEXT): $(tstRead_OBJECTS) $(tstRead_DEPENDENCIES) 
+	@rm -f tstRead$(EXEEXT)
+	$(CXXLINK) $(tstRead_OBJECTS) $(tstRead_LDADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -268,7 +272,7 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/errorhandling.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tstRead.Po at am__quote@
 
 .C.o:
 @am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@@ -381,7 +385,7 @@ distdir: $(DISTFILES)
 	done
 check-am: all-am
 check: check-am
-all-am: Makefile $(LIBRARIES) $(HEADERS)
+all-am: Makefile $(PROGRAMS)
 installdirs:
 install: install-am
 install-exec: install-exec-am
@@ -393,15 +397,10 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	if test -z '$(STRIP)'; then \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	      install; \
-	else \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-	fi
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
 mostlyclean-generic:
 
 clean-generic:
@@ -415,7 +414,7 @@ maintainer-clean-generic:
 	@echo "it deletes files that may require special tools to rebuild."
 clean: clean-am
 
-clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
+clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
 	mostlyclean-am
 
 distclean: distclean-am
@@ -487,7 +486,7 @@ uninstall-am:
 .MAKE: install-am install-strip
 
 .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
-	clean-libtool clean-noinstLIBRARIES ctags distclean \
+	clean-libtool clean-noinstPROGRAMS ctags distclean \
 	distclean-compile distclean-generic distclean-libtool \
 	distclean-tags distdir dvi dvi-am html html-am info info-am \
 	install install-am install-data install-data-am install-dvi \
diff --git a/src/test/mira/read/tstRead.C b/src/test/mira/read/tstRead.C
new file mode 100644
index 0000000..6c7a0f6
--- /dev/null
+++ b/src/test/mira/read/tstRead.C
@@ -0,0 +1,117 @@
+#include <limits.h>
+#include <iostream>
+
+#include "stdinc/stlincludes.H"
+#include "mira/parameters.H"
+#include "mira/read.H"
+
+
+#define NAMELEN 40
+
+
+char transferSVTagsToClip_tests[][NAMELEN]= { 
+  {"rat1.exp"},
+  {"rat2.exp"},
+  {"rat3.exp"},
+  {"rat4.exp"},
+  {"rat5.exp"},
+  {"rat7.exp"}
+};
+
+char brokenEXPs_tests[][NAMELEN]= {
+  {"rat6.exp"}
+};
+
+char coutFASTA_tests[][NAMELEN]= { 
+  {"rat1.exp"}
+};
+
+int main(int argc, char ** argv)
+{
+  FUNCSTART("main");
+
+  try{
+    vector<MIRAParameters> Pv;
+    MIRAParameters::setupStdMIRAParameters(Pv);
+
+    Read r;
+    r.setCoutType(Read::AS_TEXTSHORT);
+
+    cout << "Testing Read::transferSVTagsToClip\n";
+
+    for(uint32 i=0; i < sizeof(transferSVTagsToClip_tests)/NAMELEN; i++ ) {
+      cout << "############ 1-" << i << endl;
+      try{
+	cout << "Testing " << transferSVTagsToClip_tests[i] << "\n------------------------------------------------" << endl;
+	cout << "Original:\n";
+	r.discard();
+	r.loadDataFromEXP(transferSVTagsToClip_tests[i]);
+	cout << r;
+	r.transferSVTagsToClip(10,50);
+	cout << "\n\n\nAfter transfer:\n";
+	cout << r;
+      }
+      catch(Notify n){
+	n.setGravity(Notify::WARNING);
+	n.handleError("main()");
+      }
+      cout << "\n\n";
+    }
+
+
+    cout << "Testing broken EXPs\n";
+    
+    for(uint32 i=0; i < sizeof(brokenEXPs_tests)/NAMELEN; i++ ) {
+      cout << "############ 2-" << i << endl;
+      try{
+	cout << "Testing " << brokenEXPs_tests[i] << "\n------------------------------------------------" << endl;
+	r.discard();
+	r.loadDataFromEXP(brokenEXPs_tests[i]);
+	cout << r;
+      }
+      catch(Notify n){
+	n.setGravity(Notify::WARNING);
+	n.handleError("main()");
+      }
+      cout << "\n\n";
+    }
+
+
+    cout << "Testing output as FASTA\n";
+    
+    for(uint32 i=0; i < sizeof(coutFASTA_tests)/NAMELEN; i++ ) {
+      cout << "############ 3-" << i << endl;
+      try{
+	cout << "Testing " << coutFASTA_tests[i] << "\n------------------------------------------------" << endl;
+	r.discard();
+	r.loadDataFromEXP(coutFASTA_tests[i]);
+	cout << "Complete read:\n";
+	Read::setCoutType(Read::AS_FASTA);
+	cout << r;
+
+	cout << "Clipped read:\n";
+	Read::setCoutType(Read::AS_CLIPPEDFASTA);
+	cout << r;
+      }
+      catch(Notify n){
+	n.setGravity(Notify::WARNING);
+	n.handleError("main()");
+      }
+      cout << "\n\n";
+    }
+
+
+
+  }
+  catch(Notify n){
+    n.handleError("main");
+  }
+  cout << "\n\n";
+
+  cout << "Tests ended.\n";
+
+  FUNCEND();
+  return 0;
+}
+
+
diff --git a/src/test/mira/readpool/Makefile.am b/src/test/mira/readpool/Makefile.am
new file mode 100644
index 0000000..f64c9bc
--- /dev/null
+++ b/src/test/mira/readpool/Makefile.am
@@ -0,0 +1,10 @@
+INCLUDES = -I$(top_srcdir)/src $(all_includes)
+
+noinst_PROGRAMS= tstReadPool
+# EdIt_abi373 EdIt_alf
+
+AM_LDFLAGS= -L../../../io/ -L../../../util/ -L../../../errorhandling/ -L../../../mira -L../../../examine/ -L../../../EdIt/ -L../../../caf/ -L../../../knn_abi373 -L../../../knn_alf 
+
+tstReadPool_SOURCES= tstReadPool.C
+tstReadPool_LDADD= -lmiraerrorhandling  -lmira -lmirasupport -lmiradptools -lmirautil -lmirafio -lz -lexpat
+
diff --git a/src/errorhandling/Makefile.in b/src/test/mira/readpool/Makefile.in
similarity index 82%
copy from src/errorhandling/Makefile.in
copy to src/test/mira/readpool/Makefile.in
index 3074d7b..bd99886 100644
--- a/src/errorhandling/Makefile.in
+++ b/src/test/mira/readpool/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -15,7 +15,6 @@
 
 @SET_MAKE@
 
-
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
@@ -35,29 +34,35 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
-subdir = src/errorhandling
-DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
-	$(srcdir)/Makefile.in
+noinst_PROGRAMS = tstReadPool$(EXEEXT)
+subdir = src/test/mira/readpool
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/ax_boost_base.m4 \
-	$(top_srcdir)/m4/ax_boost_filesystem.m4 \
-	$(top_srcdir)/m4/ax_boost_iostreams.m4 \
-	$(top_srcdir)/m4/ax_boost_regex.m4 \
-	$(top_srcdir)/m4/ax_boost_system.m4 \
-	$(top_srcdir)/m4/ax_boost_thread.m4 \
-	$(top_srcdir)/m4/ax_check_zlib.m4 \
-	$(top_srcdir)/m4/ax_lib_expat.m4 $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/config/m4/ax_boost_base.m4 \
+	$(top_srcdir)/config/m4/ax_boost_regex.m4 \
+	$(top_srcdir)/config/m4/ax_boost_thread.m4 \
+	$(top_srcdir)/config/m4/ax_check_zlib.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_std.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_stl.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_namespaces.m4 \
+	$(top_srcdir)/config/m4/ax_lib_expat.m4 \
+	$(top_srcdir)/config/m4/ax_with_perl.m4 \
+	$(top_srcdir)/config/m4/ax_with_prog.m4 \
+	$(top_srcdir)/config/m4/libtool.m4 \
+	$(top_srcdir)/config/m4/ltoptions.m4 \
+	$(top_srcdir)/config/m4/ltsugar.m4 \
+	$(top_srcdir)/config/m4/ltversion.m4 \
+	$(top_srcdir)/config/m4/lt~obsolete.m4 \
+	$(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
-LIBRARIES = $(noinst_LIBRARIES)
-ARFLAGS = cru
-libmiraerrorhandling_a_AR = $(AR) $(ARFLAGS)
-libmiraerrorhandling_a_LIBADD =
-am_libmiraerrorhandling_a_OBJECTS = errorhandling.$(OBJEXT)
-libmiraerrorhandling_a_OBJECTS = $(am_libmiraerrorhandling_a_OBJECTS)
+PROGRAMS = $(noinst_PROGRAMS)
+am_tstReadPool_OBJECTS = tstReadPool.$(OBJEXT)
+tstReadPool_OBJECTS = $(am_tstReadPool_OBJECTS)
+tstReadPool_DEPENDENCIES =
 DEFAULT_INCLUDES = -I. at am__isrc@
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
@@ -71,9 +76,8 @@ CXXLD = $(CXX)
 CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	--mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
 	$(LDFLAGS) -o $@
-SOURCES = $(libmiraerrorhandling_a_SOURCES)
-DIST_SOURCES = $(libmiraerrorhandling_a_SOURCES)
-HEADERS = $(noinst_HEADERS)
+SOURCES = $(tstReadPool_SOURCES)
+DIST_SOURCES = $(tstReadPool_SOURCES)
 ETAGS = etags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -87,13 +91,9 @@ AWK = @AWK@
 BITPACKAGE = @BITPACKAGE@
 BLOODYDARWINSTATLIBDIRHACK = @BLOODYDARWINSTATLIBDIRHACK@
 BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
-BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@
-BOOST_IOSTREAMS_LIB = @BOOST_IOSTREAMS_LIB@
 BOOST_LDFLAGS = @BOOST_LDFLAGS@
 BOOST_REGEX_LIB = @BOOST_REGEX_LIB@
-BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@
 BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
-BUNDLETARGET = @BUNDLETARGET@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
@@ -106,7 +106,6 @@ CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -116,13 +115,11 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LDFLAGS = @EXPAT_LDFLAGS@
-EXPAT_LIBS = @EXPAT_LIBS@
 EXPAT_VERSION = @EXPAT_VERSION@
 FGREP = @FGREP@
 FLEX = @FLEX@
 FLEXPP = @FLEXPP@
 GREP = @GREP@
-HAVE_XXD = @HAVE_XXD@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -140,7 +137,6 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
 MIRASTATIC = @MIRASTATIC@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
@@ -157,17 +153,18 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
+SHORTMIRAAUDIENCE = @SHORTMIRAAUDIENCE@
 STRIP = @STRIP@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -201,6 +198,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -216,10 +214,11 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-AM_CPPFLAGS = -I$(top_srcdir)/src $(all_includes)
-noinst_LIBRARIES = libmiraerrorhandling.a
-libmiraerrorhandling_a_SOURCES = errorhandling.C
-noinst_HEADERS = errorhandling.H
+INCLUDES = -I$(top_srcdir)/src $(all_includes)
+# EdIt_abi373 EdIt_alf
+AM_LDFLAGS = -L../../../io/ -L../../../util/ -L../../../errorhandling/ -L../../../mira -L../../../examine/ -L../../../EdIt/ -L../../../caf/ -L../../../knn_abi373 -L../../../knn_alf 
+tstReadPool_SOURCES = tstReadPool.C
+tstReadPool_LDADD = -lmiraerrorhandling  -lmira -lmirasupport -lmiradptools -lmirautil -lmirafio -lz -lexpat
 all: all-am
 
 .SUFFIXES:
@@ -233,9 +232,9 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/errorhandling/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/test/mira/readpool/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu src/errorhandling/Makefile
+	  $(AUTOMAKE) --gnu src/test/mira/readpool/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -255,12 +254,17 @@ $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(am__aclocal_m4_deps):
 
-clean-noinstLIBRARIES:
-	-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
-libmiraerrorhandling.a: $(libmiraerrorhandling_a_OBJECTS) $(libmiraerrorhandling_a_DEPENDENCIES) $(EXTRA_libmiraerrorhandling_a_DEPENDENCIES) 
-	-rm -f libmiraerrorhandling.a
-	$(libmiraerrorhandling_a_AR) libmiraerrorhandling.a $(libmiraerrorhandling_a_OBJECTS) $(libmiraerrorhandling_a_LIBADD)
-	$(RANLIB) libmiraerrorhandling.a
+clean-noinstPROGRAMS:
+	@list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
+	echo " rm -f" $$list; \
+	rm -f $$list || exit $$?; \
+	test -n "$(EXEEXT)" || exit 0; \
+	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+	echo " rm -f" $$list; \
+	rm -f $$list
+tstReadPool$(EXEEXT): $(tstReadPool_OBJECTS) $(tstReadPool_DEPENDENCIES) 
+	@rm -f tstReadPool$(EXEEXT)
+	$(CXXLINK) $(tstReadPool_OBJECTS) $(tstReadPool_LDADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -268,7 +272,7 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/errorhandling.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tstReadPool.Po at am__quote@
 
 .C.o:
 @am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@@ -381,7 +385,7 @@ distdir: $(DISTFILES)
 	done
 check-am: all-am
 check: check-am
-all-am: Makefile $(LIBRARIES) $(HEADERS)
+all-am: Makefile $(PROGRAMS)
 installdirs:
 install: install-am
 install-exec: install-exec-am
@@ -393,15 +397,10 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	if test -z '$(STRIP)'; then \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	      install; \
-	else \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-	fi
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
 mostlyclean-generic:
 
 clean-generic:
@@ -415,7 +414,7 @@ maintainer-clean-generic:
 	@echo "it deletes files that may require special tools to rebuild."
 clean: clean-am
 
-clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
+clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
 	mostlyclean-am
 
 distclean: distclean-am
@@ -487,7 +486,7 @@ uninstall-am:
 .MAKE: install-am install-strip
 
 .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
-	clean-libtool clean-noinstLIBRARIES ctags distclean \
+	clean-libtool clean-noinstPROGRAMS ctags distclean \
 	distclean-compile distclean-generic distclean-libtool \
 	distclean-tags distdir dvi dvi-am html html-am info info-am \
 	install install-am install-data install-data-am install-dvi \
diff --git a/src/test/mira/readpool/tstReadPool.C b/src/test/mira/readpool/tstReadPool.C
new file mode 100644
index 0000000..b1292f1
--- /dev/null
+++ b/src/test/mira/readpool/tstReadPool.C
@@ -0,0 +1,107 @@
+#include <limits.h>
+#include <iostream>
+
+#include "stdinc/stlincludes.H"
+#include "mira/parameters.H"
+#include "mira/readpool.H"
+
+
+#define NAMELEN 40
+
+
+char error[][NAMELEN]= { 
+  {"fofnerror.txt"}
+};
+char normal[][NAMELEN]= { 
+  {"fofn.txt"}
+};
+char straindata[][NAMELEN]= { 
+  {"fofn.txt"}
+};
+
+int main(int argc, char ** argv)
+{
+  FUNCSTART("main");
+
+  try{
+    vector<MIRAParameters> Pv;
+    MIRAParameters::setupStdMIRAParameters(Pv);
+    MIRAParameters::parse(argc, argv, Pv);
+
+
+   {
+     ReadPool rp(&Pv);
+     
+     cout << "Testing error in fofn  operations\n";
+     for(uint32 i=0; i < sizeof(error)/NAMELEN; i++ ) {
+       cout << "############ 1-" << i << endl;
+       try{
+	 cout << "Testing " << error[i] << "\n------------------------------------------------" << endl;
+	 uint32 dummy=0;
+	 rp.loadEXPs(error[i],1,dummy);
+	 cout << "Done.";
+	 cout << "Readpool contains " << rp.size() << " reads." << endl;
+       }
+       catch(Notify n){
+	 n.setGravity(Notify::WARNING);
+	 n.handleError("main()");
+       }
+       cout << "\n\n";
+     }
+   }
+
+    {
+      ReadPool rp(&Pv);
+      
+      cout << "Testing normal EXP load operations\n";
+      for(uint32 i=0; i < sizeof(normal)/NAMELEN; i++ ) {
+	cout << "############ 2-" << i << endl;
+	try{
+	  cout << "Testing " << normal[i] << "\n------------------------------------------------" << endl;
+	  uint32 dummy=0;
+	  rp.loadEXPs(normal[i],1,dummy);
+	  cout << "Done.";
+	  cout << "Readpool contains " << rp.size() << " reads." << endl;
+	}
+	catch(Notify n){
+	  n.setGravity(Notify::WARNING);
+	  n.handleError("main()");
+	}
+	cout << "\n\n";
+      }
+    }
+
+    {
+      ReadPool rp(&Pv);
+      
+      cout << "Testing straindata load operations\n";
+      for(uint32 i=0; i < sizeof(straindata)/NAMELEN; i++ ) {
+	cout << "############ 3-" << i << endl;
+	try{
+	  cout << "Testing " << straindata[i] << "\n------------------------------------------------" << endl;
+	  uint32 dummy=0;
+	  rp.loadEXPs(straindata[i],1,dummy);
+	  rp.loadStrainData("straindata.txt");
+	  cout << "Done.";
+	  cout << "Readpool contains " << rp.size() << " reads." << endl;
+	}
+	catch(Notify n){
+	  n.setGravity(Notify::WARNING);
+	  n.handleError("main()");
+	}
+	cout << "\n\n";
+      }
+    }
+  }
+  catch(Notify n){
+    n.handleError("main");
+  }
+  cout << "\n\n";
+
+  cout << "Tests ended.\n";
+
+  FUNCEND();
+  return 0;
+}
+
+
diff --git a/src/util/Makefile.am b/src/util/Makefile.am
index 97ebf60..c211a39 100644
--- a/src/util/Makefile.am
+++ b/src/util/Makefile.am
@@ -1,7 +1,7 @@
-AM_CPPFLAGS = -I$(top_srcdir)/src $(all_includes)
+INCLUDES = -I$(top_srcdir)/src $(all_includes)
 
-noinst_LIBRARIES = libmirautil.a libmiradptools.a libmirafmttext.a
-libmirautil_a_SOURCES= machineinfo.C fileanddisk.C misc.C
+noinst_LIBRARIES = libmirautil.a libmiradptools.a
+libmirautil_a_SOURCES= misc.C
 libmiradptools_a_SOURCES= dptools.C
-libmirafmttext_a_SOURCES= fmttext.C
-noinst_HEADERS= misc.H dptools.H progressindic.H memusage.H machineinfo.H fileanddisk.H stlimprove.H boostiostrutil.H fmttext.H timer.H
+noinst_HEADERS= misc.H dptools.H progressindic.H memusage.H
+
diff --git a/src/util/Makefile.in b/src/util/Makefile.in
index 5ab4e7d..bfde390 100644
--- a/src/util/Makefile.in
+++ b/src/util/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -39,14 +39,22 @@ subdir = src/util
 DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/ax_boost_base.m4 \
-	$(top_srcdir)/m4/ax_boost_filesystem.m4 \
-	$(top_srcdir)/m4/ax_boost_iostreams.m4 \
-	$(top_srcdir)/m4/ax_boost_regex.m4 \
-	$(top_srcdir)/m4/ax_boost_system.m4 \
-	$(top_srcdir)/m4/ax_boost_thread.m4 \
-	$(top_srcdir)/m4/ax_check_zlib.m4 \
-	$(top_srcdir)/m4/ax_lib_expat.m4 $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/config/m4/ax_boost_base.m4 \
+	$(top_srcdir)/config/m4/ax_boost_regex.m4 \
+	$(top_srcdir)/config/m4/ax_boost_thread.m4 \
+	$(top_srcdir)/config/m4/ax_check_zlib.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_std.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_have_stl.m4 \
+	$(top_srcdir)/config/m4/ax_cxx_namespaces.m4 \
+	$(top_srcdir)/config/m4/ax_lib_expat.m4 \
+	$(top_srcdir)/config/m4/ax_with_perl.m4 \
+	$(top_srcdir)/config/m4/ax_with_prog.m4 \
+	$(top_srcdir)/config/m4/libtool.m4 \
+	$(top_srcdir)/config/m4/ltoptions.m4 \
+	$(top_srcdir)/config/m4/ltsugar.m4 \
+	$(top_srcdir)/config/m4/ltversion.m4 \
+	$(top_srcdir)/config/m4/lt~obsolete.m4 \
+	$(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -58,14 +66,9 @@ libmiradptools_a_AR = $(AR) $(ARFLAGS)
 libmiradptools_a_LIBADD =
 am_libmiradptools_a_OBJECTS = dptools.$(OBJEXT)
 libmiradptools_a_OBJECTS = $(am_libmiradptools_a_OBJECTS)
-libmirafmttext_a_AR = $(AR) $(ARFLAGS)
-libmirafmttext_a_LIBADD =
-am_libmirafmttext_a_OBJECTS = fmttext.$(OBJEXT)
-libmirafmttext_a_OBJECTS = $(am_libmirafmttext_a_OBJECTS)
 libmirautil_a_AR = $(AR) $(ARFLAGS)
 libmirautil_a_LIBADD =
-am_libmirautil_a_OBJECTS = machineinfo.$(OBJEXT) fileanddisk.$(OBJEXT) \
-	misc.$(OBJEXT)
+am_libmirautil_a_OBJECTS = misc.$(OBJEXT)
 libmirautil_a_OBJECTS = $(am_libmirautil_a_OBJECTS)
 DEFAULT_INCLUDES = -I. at am__isrc@
 depcomp = $(SHELL) $(top_srcdir)/depcomp
@@ -80,10 +83,8 @@ CXXLD = $(CXX)
 CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	--mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
 	$(LDFLAGS) -o $@
-SOURCES = $(libmiradptools_a_SOURCES) $(libmirafmttext_a_SOURCES) \
-	$(libmirautil_a_SOURCES)
-DIST_SOURCES = $(libmiradptools_a_SOURCES) $(libmirafmttext_a_SOURCES) \
-	$(libmirautil_a_SOURCES)
+SOURCES = $(libmiradptools_a_SOURCES) $(libmirautil_a_SOURCES)
+DIST_SOURCES = $(libmiradptools_a_SOURCES) $(libmirautil_a_SOURCES)
 HEADERS = $(noinst_HEADERS)
 ETAGS = etags
 CTAGS = ctags
@@ -98,13 +99,9 @@ AWK = @AWK@
 BITPACKAGE = @BITPACKAGE@
 BLOODYDARWINSTATLIBDIRHACK = @BLOODYDARWINSTATLIBDIRHACK@
 BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
-BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@
-BOOST_IOSTREAMS_LIB = @BOOST_IOSTREAMS_LIB@
 BOOST_LDFLAGS = @BOOST_LDFLAGS@
 BOOST_REGEX_LIB = @BOOST_REGEX_LIB@
-BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@
 BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
-BUNDLETARGET = @BUNDLETARGET@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
@@ -117,7 +114,6 @@ CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -127,13 +123,11 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LDFLAGS = @EXPAT_LDFLAGS@
-EXPAT_LIBS = @EXPAT_LIBS@
 EXPAT_VERSION = @EXPAT_VERSION@
 FGREP = @FGREP@
 FLEX = @FLEX@
 FLEXPP = @FLEXPP@
 GREP = @GREP@
-HAVE_XXD = @HAVE_XXD@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -151,7 +145,6 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
 MIRASTATIC = @MIRASTATIC@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
@@ -168,17 +161,18 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
 RANLIB = @RANLIB@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
+SHORTMIRAAUDIENCE = @SHORTMIRAAUDIENCE@
 STRIP = @STRIP@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -212,6 +206,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -227,12 +222,11 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-AM_CPPFLAGS = -I$(top_srcdir)/src $(all_includes)
-noinst_LIBRARIES = libmirautil.a libmiradptools.a libmirafmttext.a
-libmirautil_a_SOURCES = machineinfo.C fileanddisk.C misc.C
+INCLUDES = -I$(top_srcdir)/src $(all_includes)
+noinst_LIBRARIES = libmirautil.a libmiradptools.a
+libmirautil_a_SOURCES = misc.C
 libmiradptools_a_SOURCES = dptools.C
-libmirafmttext_a_SOURCES = fmttext.C
-noinst_HEADERS = misc.H dptools.H progressindic.H memusage.H machineinfo.H fileanddisk.H stlimprove.H boostiostrutil.H fmttext.H timer.H
+noinst_HEADERS = misc.H dptools.H progressindic.H memusage.H
 all: all-am
 
 .SUFFIXES:
@@ -270,15 +264,11 @@ $(am__aclocal_m4_deps):
 
 clean-noinstLIBRARIES:
 	-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
-libmiradptools.a: $(libmiradptools_a_OBJECTS) $(libmiradptools_a_DEPENDENCIES) $(EXTRA_libmiradptools_a_DEPENDENCIES) 
+libmiradptools.a: $(libmiradptools_a_OBJECTS) $(libmiradptools_a_DEPENDENCIES) 
 	-rm -f libmiradptools.a
 	$(libmiradptools_a_AR) libmiradptools.a $(libmiradptools_a_OBJECTS) $(libmiradptools_a_LIBADD)
 	$(RANLIB) libmiradptools.a
-libmirafmttext.a: $(libmirafmttext_a_OBJECTS) $(libmirafmttext_a_DEPENDENCIES) $(EXTRA_libmirafmttext_a_DEPENDENCIES) 
-	-rm -f libmirafmttext.a
-	$(libmirafmttext_a_AR) libmirafmttext.a $(libmirafmttext_a_OBJECTS) $(libmirafmttext_a_LIBADD)
-	$(RANLIB) libmirafmttext.a
-libmirautil.a: $(libmirautil_a_OBJECTS) $(libmirautil_a_DEPENDENCIES) $(EXTRA_libmirautil_a_DEPENDENCIES) 
+libmirautil.a: $(libmirautil_a_OBJECTS) $(libmirautil_a_DEPENDENCIES) 
 	-rm -f libmirautil.a
 	$(libmirautil_a_AR) libmirautil.a $(libmirautil_a_OBJECTS) $(libmirautil_a_LIBADD)
 	$(RANLIB) libmirautil.a
@@ -290,9 +280,6 @@ distclean-compile:
 	-rm -f *.tab.c
 
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dptools.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fileanddisk.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fmttext.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/machineinfo.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/misc.Po at am__quote@
 
 .C.o:
@@ -418,15 +405,10 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	if test -z '$(STRIP)'; then \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	      install; \
-	else \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-	fi
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
 mostlyclean-generic:
 
 clean-generic:
diff --git a/src/util/boostiostrutil.H b/src/util/boostiostrutil.H
deleted file mode 100644
index f5bdff1..0000000
--- a/src/util/boostiostrutil.H
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 2003 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-#ifndef _bas_boostiostrutil_h_
-#define _bas_boostiostrutil_h_
-
-#include <string>
-#include <iostream>
-#include <fstream>
-
-#include <boost/filesystem.hpp>
-
-#include <boost/iostreams/filtering_stream.hpp>
-#include <boost/iostreams/filter/zlib.hpp>
-#include <boost/iostreams/filter/gzip.hpp>
-#include <boost/iostreams/filter/bzip2.hpp>
-
-#include <boost/algorithm/string.hpp>
-
-
-template <class FS, class IS>
-void setupStreamFilterByName(FS & fs, IS & is, const std::string & filename)
-{
-  boost::filesystem::path runfn(filename);
-
-  std::list<std::string> extlist;
-  while(true){
-    if(runfn.has_extension()){
-      // native does not compile on Cygwin, gcc 4.8.3 and BOOST 1.56???
-      // extlist.push_back(runfn.extension().native();
-      extlist.push_back(runfn.extension().string());
-    }
-    if(boost::filesystem::is_symlink(runfn)){
-      runfn=boost::filesystem::read_symlink(runfn);
-    }else{
-      break;
-    }
-  }
-
-
-  for(auto & ext : extlist){
-    if(boost::iequals(ext,".gz")){
-      fs.push(boost::iostreams::gzip_decompressor());
-      break;
-    }else if(boost::iequals(ext,".bz2")){
-      fs.push(boost::iostreams::bzip2_decompressor());
-      break;
-    }else if(boost::iequals(ext,".z")){
-      fs.push(boost::iostreams::zlib_decompressor());
-      break;
-    }
-  }
-
-  fs.push(is);
-
-}
-
-
-
-#endif
diff --git a/src/util/dptools.C b/src/util/dptools.C
index e1142dd..fe338e1 100644
--- a/src/util/dptools.C
+++ b/src/util/dptools.C
@@ -9,29 +9,27 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
+// 	$Id$	
 
 #include "util/dptools.H"
 
-#include <cstdlib>     // exit() under Cygwin
-
-
-#define CEBUG(bla)
-
-using namespace std;
 
+#ifndef lint
+static char vcid[] = "$Id$";
+#endif /* lint */
 
 /*
  * nsTranslationTables is needed to translate a codon triplet into an AA code
@@ -326,7 +324,7 @@ char dptools::nsvalidIUPAC_bases[256]=
 
 //Table 2. Definition of complementary DNA symbols
 //  (*) some complements are equal to the original
-//
+//   
 //   Symbol     A B C D G H K M R S  T/U V W  Y     N  X
 //   Complement T V G H C D M K Y S*  A  B W* R     N* X*
 
@@ -396,7 +394,7 @@ uint8 dptools::nsIUPAC_basebitmask[256]=
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
 };
 
-// like above, but N is present
+// like above, but N is present 
 //  (X not, as one realy does not know what it could be)
 uint8 dptools::nsIUPAC_basebitmaskN[256]=
 {
@@ -441,23 +439,6 @@ char dptools::nsIUPACbitmask[16]=
 };
 
 
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-uint8 dptools::getIndexOfCodon(const char b1, const char b2, const char b3)
-{
-  uint8 retvalue=64; // 64 == invalid characters encountered (non-ACGT)
-  if(isValidACGTBase(b1) && isValidACGTBase(b2) && isValidACGTBase(b3)){
-    retvalue=getIndexOfBase(b1) << 4;
-    retvalue+=getIndexOfBase(b2) << 2;
-    retvalue+=getIndexOfBase(b3);
-  }
-  return retvalue;
-}
 
 /*************************************************************************
  *
@@ -466,20 +447,19 @@ uint8 dptools::getIndexOfCodon(const char b1, const char b2, const char b3)
  *
  *************************************************************************/
 
-void dptools::codon2AminoAcids_wrapped(const uint8 transl_table, char base1, char base2, char base3, std::vector<string> & codonvariants, vector<char> & aaresult, vector<bool> & isstartresult)
+void dptools::codon2AminoAcids_wrapped(const uint8 transl_table, const char base1, const char base2, const char base3, vector<char> & aaresult, vector<bool> & isstartresult)
 {
+  (void) vcid;
+
   bool hadIUPAC=false;
   char * aacode=&nsTranslationTables[0][0]+transl_table*321;
-
-  if(base1=='X' || base1=='@') base1='N';
-  if(base2=='X' || base2=='@') base2='N';
-  if(base3=='X' || base3=='@') base3='N';
-
-  if(base1=='N' && base2=='N' && base3=='N'){
+  
+  if((base1=='@' || base1=='N')
+     && (base2=='@' || base2=='N')
+     && (base3=='@' || base3=='N')){
     // this is a shortcut for the case 'nnn' or '@@@' or 'n at n' etc.
     aaresult.push_back('X');
-    isstartresult.push_back(false);
-    return;
+    isstartresult.push_back(false);      
   }
 
   // the switches are all fall throughs till T
@@ -491,7 +471,7 @@ void dptools::codon2AminoAcids_wrapped(const uint8 transl_table, char base1, cha
   default: {
     vector<char> v;
     if(isValidIUPACBase(base1)){
-      v=getNucleicAcidFromIUPAC(base1);
+      getNucleicAcidFromIUPAC(base1,v);
     }else{
       v.push_back('A');
       v.push_back('C');
@@ -504,14 +484,13 @@ void dptools::codon2AminoAcids_wrapped(const uint8 transl_table, char base1, cha
 			       v[i],
 			       base2,
 			       base3,
-			       codonvariants,
 			       aaresult,
 			       isstartresult);
     }
     hadIUPAC=true;
   }
   }
-
+    
   switch(toupper(base2)) {
   case 'G': aacode+=4;
   case 'A': aacode+=4;
@@ -520,7 +499,7 @@ void dptools::codon2AminoAcids_wrapped(const uint8 transl_table, char base1, cha
   default: {
     vector<char> v;
     if(isValidIUPACBase(base2)){
-      v=getNucleicAcidFromIUPAC(base2);
+      getNucleicAcidFromIUPAC(base2,v);
     }else{
       v.push_back('A');
       v.push_back('C');
@@ -533,7 +512,6 @@ void dptools::codon2AminoAcids_wrapped(const uint8 transl_table, char base1, cha
 			       base1,
 			       v[i],
 			       base3,
-			       codonvariants,
 			       aaresult,
 			       isstartresult);
     }
@@ -549,7 +527,7 @@ void dptools::codon2AminoAcids_wrapped(const uint8 transl_table, char base1, cha
   default: {
     vector<char> v;
     if(isValidIUPACBase(base3)){
-      v=getNucleicAcidFromIUPAC(base3);
+      getNucleicAcidFromIUPAC(base3,v);
     }else{
       v.push_back('A');
       v.push_back('C');
@@ -562,7 +540,6 @@ void dptools::codon2AminoAcids_wrapped(const uint8 transl_table, char base1, cha
 			       base1,
 			       base2,
 			       v[i],
-			       codonvariants,
 			       aaresult,
 			       isstartresult);
     }
@@ -574,12 +551,6 @@ void dptools::codon2AminoAcids_wrapped(const uint8 transl_table, char base1, cha
   //  and added in the recursive loops
   if(hadIUPAC) return;
 
-  // add the codon as string to the variants
-  codonvariants.resize(codonvariants.size()+1);
-  codonvariants.back().push_back(base1);
-  codonvariants.back().push_back(base2);
-  codonvariants.back().push_back(base3);
-
   // the following code is to make sure that the AA and the status whether
   //  it's a start or not is only added to the array if it is not already in
   const char aafound=*aacode;
@@ -601,7 +572,7 @@ void dptools::codon2AminoAcids_wrapped(const uint8 transl_table, char base1, cha
 
   if(!alreadyinarray){
     aaresult.push_back(aafound);
-    isstartresult.push_back(aaisstart);
+    isstartresult.push_back(aaisstart);      
   }
 
   return;
@@ -619,108 +590,71 @@ void dptools::codon2AminoAcids_wrapped(const uint8 transl_table, char base1, cha
  *
  *************************************************************************/
 
-void dptools::codon2AminoAcids(const uint8 transl_table, const char base1, const char base2, const char base3, std::vector<string> & codonvariants, vector<char> & aaresult, vector<bool> & isstartresult)
+void dptools::codon2AminoAcids(const uint8 transl_table, const char base1, const char base2, const char base3, vector<char> & aaresult, vector<bool> & isstartresult)
 {
-  codonvariants.clear();
   aaresult.clear();
   isstartresult.clear();
 
-  bool tttableok=false;
-  if(transl_table<=23){
-    switch(transl_table){
-    case 0:
-    case 7:
-    case 8:
-    case 17:
-    case 18:
-    case 19:
-    case 20: break;
-    default: {
-      tttableok=true;
-      // decrease transl_table by one to adapt to the c array
-      codon2AminoAcids_wrapped(transl_table-1,
-			       static_cast<char>(toupper(base1)),
-			       static_cast<char>(toupper(base2)),
-			       static_cast<char>(toupper(base3)),
-			       codonvariants,
-			       aaresult,
-			       isstartresult);
-      // not the slightest idea, why gcc 4.3.2 says:
-      //  warning: conversion to ‘uint8’ from ‘int’ may alter its value [-Wconversion]
-    }
-    }
-
-    // if aaresult.size() is >1: check if all results are the same and if yes, collapse
-    // e.g.: ATH -> III = I
-    if(aaresult.size()>1){
-      auto checkbase=aaresult.front();
-      bool allsame=true;
-      for(auto x : aaresult){
-	if(x!=checkbase){
-	  allsame=false;
-	  break;
-	}
-      }
-      if(allsame){
-	aaresult.resize(1);
-	isstartresult.resize(1);
-      }
-    }
+  if(transl_table==0 || transl_table>23) return;
+  switch(transl_table){
+  case 7:
+  case 8:
+  case 17:
+  case 18:
+  case 19:
+  case 20: return;
+  default: {
+    // decrease transl_table by one to adapt to the c array
+    codon2AminoAcids_wrapped(transl_table-1,
+			     static_cast<char>(toupper(base1)),
+			     static_cast<char>(toupper(base2)),
+			     static_cast<char>(toupper(base3)),
+			     aaresult,
+			     isstartresult);
+    // not the slightest idea, why gcc 4.3.2 says:
+    //  warning: conversion to ‘uint8’ from ‘int’ may alter its value [-Wconversion]
   }
-  if(!tttableok){
-    cout << "\n\nInternal error, unknown translation table " << static_cast<uint16>(transl_table) << endl;
-    exit(1);
   }
 
   return;
 }
-
+  
 /*************************************************************************
  *
- * dnaToProtein has become a misnomer: it also extracts the DNA from
- *  a larger piece of DNA. Rework.
- *
  * from a piece of DNA (which might contain gap characters), extract
  *  a given piece (store it with no gaps, in 5' -> 3' direction),
  *  translate it into protein (also stored).
  *
- * if musttranslate && orfend is == orfstart, then extract according to protein
+ * if parameter orfend is == orfstart, then extract according to protein
  *  translation until a terminator codon is found (translated to '*'),
  *  else extract strictly between orfstart and orfend
  *
  *************************************************************************/
 
 //#define CEBUG(bla)  {cout << bla; cout.flush();}
-void dptools::dnaToProtein(const string & dna, string & protresult, string & dnaresult, uint32 orfstart, uint32 orfend, const int8 orfdir, const uint8 transl_table, const uint8 codonstart, bool musttranslate)
-{
-  //CEBUG("dna: " << dna << endl);
-  CEBUG("orfstart   : " << orfstart << endl);
-  CEBUG("orfdir     : " << static_cast<int16>(orfdir) << endl);
-  CEBUG("codonstart : " << static_cast<uint16>(codonstart) << endl);
-  CEBUG("transl_table : " << static_cast<uint16>(transl_table) << endl);
 
+
+void dptools::dnaToProtein(const string & dna, string & protresult, string & dnaresult, uint32 orfstart, uint32 orfend, const int8 orfdir, const uint8 transl_table, const uint8 codonstart)
+{
   if(codonstart<1 || codonstart>3) {
-    cerr << "Internal error dnaToProtein(): codonstart " << static_cast<uint16>(codonstart) << " != {1,2,3}\n";
-    exit(10);
-  }
-  if(transl_table>=23) {
-    cerr << "Internal error dnaToProtein(): transl_table " << static_cast<uint16>(transl_table) << " >= 23\n";
+    cerr << "Internal error: codonstart != {1,2,3}\n";
     exit(10);
   }
 
+  CEBUG("orfstart: " << orfstart << "\torfend: " << orfend << "\torfdir: " << static_cast<int16>(orfdir) << "\tcodonstart: " << static_cast<uint16>(codonstart) << endl);
+
   protresult.clear();
   dnaresult.clear();
 
   char codon[3];
   vector<char> aa;
   vector<bool> startres;
-  vector<string> codonvariants; // unused, but codon2AminoAcids() needs it
 
   bool stopatstopcodon=(orfstart==orfend);
 
   if(orfdir>=0){
     if(orfend<orfstart) swap(orfstart, orfend);
-    if(musttranslate && orfstart==orfend){
+    if(orfstart==orfend){
       orfend=static_cast<uint32>(dna.size());
     }
 
@@ -731,32 +665,26 @@ void dptools::dnaToProtein(const string & dna, string & protresult, string & dna
       startres.clear();
 
       uint8 nuc=0;
-      for(; nuc<3 && pos < orfend; ++pos){
+      for(; nuc<3 && pos < orfend; pos++){
 	CEBUG("  pos2: " << pos);
 	if(dna[pos]!='*'){
 	  CEBUG(dna[pos]);
 	  codon[nuc]=dna[pos];
 	  dnaresult.push_back(dna[pos]);
-	  ++nuc;
+	  nuc++;
 	}
       }
       CEBUG(" // ");
-      if(musttranslate && nuc == 3){
+      if(nuc == 3){
 	CEBUG(" c2aa ");
 	CEBUG("codon: " << static_cast<char>(codon[0]) << static_cast<char>(codon[1]) << static_cast<char>(codon[2]));
 	codon2AminoAcids(transl_table,
 			 codon[0],
 			 codon[1],
 			 codon[2],
-			 codonvariants,
 			 aa,
 			 startres);
-	// aa vector with 0 or more than 1 entry means: oooops
-	if(aa.empty()){
-	  cout << "\naa.empty() 1 ???" << endl;
-	  exit(1);
-	}
-	if(aa.size()!=1) {
+	if(aa.size()>1) {
 	  protresult+='X';
 	  CEBUG("\taa: X\n");
 	}else{
@@ -772,7 +700,7 @@ void dptools::dnaToProtein(const string & dna, string & protresult, string & dna
     if(orfstart<orfend) swap(orfstart, orfend);
 
     for(int32 pos=orfstart-codonstart+1; pos>=0 && pos>=static_cast<int32>(orfend);){
-      if(musttranslate&& orfstart==orfend){
+      if(orfstart==orfend){
 	orfend=0;
       }
       CEBUG("\npos1: " << pos);
@@ -781,30 +709,25 @@ void dptools::dnaToProtein(const string & dna, string & protresult, string & dna
       startres.clear();
 
       uint8 nuc=0;
-      for(; nuc<3 && pos>=0; --pos){
+      for(; nuc<3 && pos>=0; pos--){
 	CEBUG("pos2: " << pos << "   ");
 	if(dna[pos]!='*'){
 	  codon[nuc]=getComplementIUPACBase(dna[pos]);
 	  dnaresult.push_back(codon[nuc]);
-	  ++nuc;
+	  nuc++;
 	}
       }
       CEBUG(" \\ ");
-      if(musttranslate && nuc == 3) {
+      if(nuc == 3) {
 	CEBUG("codon: " << static_cast<char>(codon[0]) << static_cast<char>(codon[1]) << static_cast<char>(codon[2]));
-
+	    
 	codon2AminoAcids(transl_table,
 			 codon[0],
 			 codon[1],
 			 codon[2],
-			 codonvariants,
 			 aa,
 			 startres);
-	if(aa.empty()){
-	  cout << "\naa.empty() 2 ???" << endl;
-	  exit(1);
-	}
-	if(aa.size()!=1) {
+	if(aa.size()>1) {
 	  protresult+='X';
 	  CEBUG("\taa: X\n");
 	}else{
@@ -816,7 +739,6 @@ void dptools::dnaToProtein(const string & dna, string & protresult, string & dna
     }
   }
 }
-//#define CEBUG(bla)
 
 
 
@@ -829,27 +751,19 @@ void dptools::dnaToProtein(const string & dna, string & protresult, string & dna
  *************************************************************************/
 
 
-//#define CEBUG(bla)  {cout << bla; cout.flush();}
-void dptools::infoOnAAatDNAPos(const string & dna, const uint32 whichdnapos, const uint32 orfstart, const int8 orfdir, const uint8 transl_table, const uint8 codonstart, string & codon, vector<string> & codonvariants, vector<char> & aminoacid, vector<bool> & isstart, int32 & aanumber, int8 & posinaa)
+void dptools::infoOnAAatDNAPos(const string & dna, const uint32 whichdnapos, const uint32 orfstart, const int8 orfdir, const uint8 transl_table, const uint8 codonstart, string & codon, vector<char> & aminoacid, vector<bool> & isstart, int32 & aanumber, int8 & posinaa)
 {
   if(codonstart<1 || codonstart>3) {
-    cerr << "Internal error infoOnAAatDNAPos(): codonstart " << static_cast<uint16>(codonstart) << " != {1,2,3}\n";
-    exit(10);
-  }
-  if(transl_table>=23) {
-    cerr << "Internal error infoOnAAatDNAPos(): transl_table " << static_cast<uint16>(transl_table) << " >= 23\n";
+    cerr << "Internal error: codonstart != {1,2,3}\n";
     exit(10);
   }
 
-  CEBUG("dna: " << dna << endl);
   CEBUG("whichdnapos: " << whichdnapos << endl);
   CEBUG("orfstart   : " << orfstart << endl);
   CEBUG("orfdir     : " << static_cast<int16>(orfdir) << endl);
   CEBUG("codonstart : " << static_cast<uint16>(codonstart) << endl);
 
   codon.clear();
-  codonvariants.clear();
-
   aminoacid.clear();
   isstart.clear();
 
@@ -859,8 +773,8 @@ void dptools::infoOnAAatDNAPos(const string & dna, const uint32 whichdnapos, con
   char actcodon[3];
   if(orfdir>0){
     for(uint32 pos=orfstart+codonstart-1; pos<dna.size(); ){
-
-      CEBUG("pos1a: " << pos << "   ");
+      
+      cout << "pos1: " << pos << "   ";
 
       uint8 nuc=0;
       for(nuc=0; nuc<3 && pos<dna.size(); pos++){
@@ -880,15 +794,14 @@ void dptools::infoOnAAatDNAPos(const string & dna, const uint32 whichdnapos, con
 			   actcodon[0],
 			   actcodon[1],
 			   actcodon[2],
-			   codonvariants,
 			   aminoacid,
 			   isstart);
 	  codon+=actcodon[0];
 	  codon+=actcodon[1];
 	  codon+=actcodon[2];
-
+	  
 	  CEBUG("Returning.\n");
-
+	  
 	  return;
 	}
 	CEBUG("\n");
@@ -896,7 +809,7 @@ void dptools::infoOnAAatDNAPos(const string & dna, const uint32 whichdnapos, con
     }
   }else{
     for(int32 pos=orfstart-codonstart+1; pos>=0; ){
-      CEBUG("pos1b: " << pos << "   ");
+      cout << "pos1: " << pos << "   ";
 
       uint8 nuc=0;
       for(nuc=0; nuc<3 && pos>=0; pos--){
@@ -916,15 +829,14 @@ void dptools::infoOnAAatDNAPos(const string & dna, const uint32 whichdnapos, con
 			   actcodon[0],
 			   actcodon[1],
 			   actcodon[2],
-			   codonvariants,
 			   aminoacid,
 			   isstart);
 	  codon+=actcodon[0];
 	  codon+=actcodon[1];
 	  codon+=actcodon[2];
-
+	  
 	  CEBUG("Returning.\n");
-
+	  
 	  return;
 	}
       }
@@ -932,7 +844,6 @@ void dptools::infoOnAAatDNAPos(const string & dna, const uint32 whichdnapos, con
     }
   }
 }
-//#define CEBUG(bla)
 
 
 /*************************************************************************
@@ -988,9 +899,7 @@ double dptools::calcProteinIdentity(const string & p1, const string & p2)
 
 bool dptools::isCodonStart(const uint8 transl_table, const char base1, const char base2, const char base3)
 {
-  vector<char> aaresult;  // unused, but codon2AminoAcids() needs it
-  vector<string> codonvariants;  // unused, but codon2AminoAcids() needs it
-
+  vector<char> aaresult;
   vector<bool> isstartresult;
 
   if(transl_table==0 || transl_table>23) return false;
@@ -1007,7 +916,6 @@ bool dptools::isCodonStart(const uint8 transl_table, const char base1, const cha
 			     static_cast<char>(toupper(base1)),
 			     static_cast<char>(toupper(base2)),
 			     static_cast<char>(toupper(base3)),
-			     codonvariants,
 			     aaresult,
 			     isstartresult);
     // not the slightest idea, why gcc 4.3.2 says:
diff --git a/src/util/dptools.H b/src/util/dptools.H
index 13b48d8..24d4270 100644
--- a/src/util/dptools.H
+++ b/src/util/dptools.H
@@ -9,36 +9,36 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
+// 	$Id$	
 
 #ifndef _util_dptools_h
 #define _util_dptools_h
 
-#include <cstring>
-#include <ctime>
+#include <strings.h>
+#include <time.h>
 
 #include <iostream>
 
-#include <string>
-#include <vector>
-
 #include "stdinc/defines.H"
 
 #include "stdinc/stlincludes.H"
 
 
+using namespace std;
+
 class dptools {
 private:
   static char nsTranslationTables[23][321];
@@ -65,18 +65,10 @@ public:
     return nsbase2index_translationtable[static_cast<uint8>(c)];
   }
 
-  static uint8 getIndexOfCodon(const char b1, const char b2, const char b3);
-  inline static uint8 getIndexOfCodon(const char * ptr) {return getIndexOfCodon(*ptr,*(ptr+1),*(ptr+2));}
-  inline static uint8 getIndexOfCodon(const std::string & s) {return getIndexOfCodon(s.c_str());}
-
   inline static bool isValidACGTBase(const char c){
     return nsvalid_ACGTbases[static_cast<uint8>(c)];
   }
 
-  inline static bool isValidACGTNBase(const char c){
-    return nsvalid_ACGTbases[static_cast<uint8>(c)] || c=='n' || c=='N';
-  }
-
   inline static bool isValidACGTStarBase(const char c){
     return nsvalid_ACGTbases[static_cast<uint8>(c)] || c=='*';
   }
@@ -132,7 +124,7 @@ public:
 
   inline static bool areBasesContained(const char base1, const char base2)
   {
-    return (nsIUPAC_basebitmask[static_cast<uint8>(base1)]
+    return (nsIUPAC_basebitmask[static_cast<uint8>(base1)] 
 	    & nsIUPAC_basebitmask[static_cast<uint8>(base2)]);
   }
 
@@ -145,7 +137,7 @@ public:
 
   inline static bool areBasesContainedWithN(const char base1, const char base2)
   {
-    return (nsIUPAC_basebitmaskN[static_cast<uint8>(base1)]
+    return (nsIUPAC_basebitmaskN[static_cast<uint8>(base1)] 
 	    & nsIUPAC_basebitmaskN[static_cast<uint8>(base2)]);
   }
 
@@ -171,13 +163,14 @@ public:
  *
  *
  *************************************************************************/
-  inline static char calcIUPACConsensus(const std::vector<char> &v)
+  inline static char calcIUPACConsensus(const vector<char> &v)
   {
     uint8 bm=0;
 
-    for(auto & ve : v) {
+    vector<char>::const_iterator vptr=v.begin();
+    for(; vptr!=v.end(); vptr++) {
       // not using bm|= ... as gcc4.3.2 somehow gives spurious warnings
-      bm=static_cast<uint8>(bm|nsIUPAC_basebitmask[static_cast<uint8>(ve)]);
+      bm=static_cast<uint8>(bm|nsIUPAC_basebitmask[static_cast<uint8>(*vptr)]);
     }
     return nsIUPACbitmask[bm];
   }
@@ -189,13 +182,13 @@ public:
  *
  *************************************************************************/
 
-  inline static char calcIUPACConsensus(const std::string &v)
+  inline static char calcIUPACConsensus(const string &v)
   {
     uint8 bm=0;
 
-    for(auto & ve : v) {
+    for(uint8 i=0; i<v.size(); i++) {
       // not using bm|= ... as gcc4.3.2 somehow gives spurious warnings
-      bm=static_cast<uint8>(bm|nsIUPAC_basebitmask[static_cast<uint8>(ve)]);
+      bm=static_cast<uint8>(bm|nsIUPAC_basebitmask[static_cast<uint8>(v[i])]);
     }
     return nsIUPACbitmask[bm];
   }
@@ -207,16 +200,16 @@ public:
  *
  *************************************************************************/
 
-  inline static std::vector<char> getNucleicAcidFromIUPAC(const char base)
+  inline static void getNucleicAcidFromIUPAC(const char base, vector<char> &v)
   {
     uint8 bm=nsIUPAC_basebitmaskN[static_cast<uint8>(base)];
 
-    std::vector<char> v;
+    v.clear();
     if(bm & 8) v.push_back('A');
     if(bm & 4) v.push_back('C');
     if(bm & 2) v.push_back('G');
     if(bm & 1) v.push_back('T');
-    return v;
+    return;
   }
 
 /*************************************************************************
@@ -226,7 +219,7 @@ public:
  *
  *************************************************************************/
 
-  static bool hasNucleicAcidInIUPAC(char nucleicacid, const char base)
+  inline static bool hasNucleicAcidInIUPAC(char nucleicacid, const char base)
   {
     uint8 bm=nsIUPAC_basebitmaskN[static_cast<uint8>(base)];
     nucleicacid=static_cast<char>(toupper(nucleicacid));
@@ -255,52 +248,48 @@ public:
   }
 
 
-  static void codon2AminoAcids_wrapped(const uint8 transl_table,
-				       char base1,
-				       char base2,
-				       char base3,
-				       std::vector<std::string> & codonvariants,
-				       std::vector<char> & aaresult,
-				       std::vector<bool> & isstartresult);
-
-  static void codon2AminoAcids(const uint8 transl_table,
+  static void codon2AminoAcids_wrapped(const uint8 transl_table, 
+				       const char base1, 
+				       const char base2, 
+				       const char base3, 
+				       vector<char> & aaresult, 
+				       vector<bool> & isstartresult);
+  
+  static void codon2AminoAcids(const uint8 transl_table, 
 			       const char base1,
 			       const char base2,
 			       const char base3,
-			       std::vector<std::string> & codonvariants,
-			       std::vector<char> & aaresult,
-			       std::vector<bool> & isstartresult);
-
-  static void dnaToProtein(const std::string & dna,
-			   std::string & protresult,
-			   std::string & dnaresult,
+			       vector<char> & aaresult,
+			       vector<bool> & isstartresult);
+  
+  static void dnaToProtein(const string & dna, 
+			   string & protresult,
+			   string & dnaresult,
 			   uint32 orfstart,
 			   uint32 orfend,
 			   const int8 orfdirection,
-			   const uint8 transl_table,
-			   const uint8 codonstart,
-			   bool musttranslate);
-
-  static void infoOnAAatDNAPos(const std::string & dna,
+			   const uint8 transl_table, 
+			   const uint8 codonstart);
+  
+  static void infoOnAAatDNAPos(const string & dna,
 			       const uint32 whichdnapos,
 			       const uint32 orfstart,
 			       const int8 orfdirection,
 			       const uint8 transl_table,
 			       const uint8 codonstart,
-			       std::string & codon,
-			       std::vector<std::string> & codonvariants,
-			       std::vector<char> & aminoacid,
-			       std::vector<bool> & isstart,
+			       string & codon,
+			       vector<char> & aminoacid,
+			       vector<bool> & isstart,
 			       int32 & aanumber,
 			       int8 & posinaa);
-
+  
   static bool isCodonStart(const uint8 transl_table,
-			   const char base1,
-			   const char base2,
+			   const char base1, 
+			   const char base2, 
 			   const char base3);
 
-  static double calcProteinIdentity(const std::string & p1,
-				    const std::string & p2);
+  static double calcProteinIdentity(const string & p1,
+			     const string & p2);
 };
-
+  
 #endif
diff --git a/src/util/fileanddisk.C b/src/util/fileanddisk.C
deleted file mode 100644
index b1e2f0c..0000000
--- a/src/util/fileanddisk.C
+++ /dev/null
@@ -1,1009 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 2000 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-#include "util/fileanddisk.H"
-#include "util/misc.H"
-
-#include <fstream>
-
-#ifdef __APPLE__
-#include <mach-o/dyld.h>   // for _NSGetExecutablePath
-#endif
-
-#include <glob.h>                  // globWalkPath() uses this
-
-
-#include <boost/filesystem.hpp>
-#include <boost/algorithm/string.hpp>
-
-#include "errorhandling/errorhandling.H"
-
-#include <cstdio>         // fseeko(), ftello() in Cygwin
-#include <cerrno>         // errno checking
-#include <unistd.h>        // sleep()
-
-using namespace std;
-namespace fs = boost::filesystem;
-
-
-#define CEBUG(bla)
-
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-size_t myFRead(void *ptr, size_t sizememb, size_t nmemb, FILE *stream)
-{
-  static size_t maxreadchunk=134217728; // 128 MiB
-
-  uint8 * uptr=static_cast<uint8 *>(ptr);
-
-  size_t totalbytestoread=sizememb*nmemb;
-  size_t totalnumbytesread=0;
-  while(totalbytestoread){
-    auto bytestoread=totalbytestoread;
-    if(bytestoread>maxreadchunk){
-      bytestoread=maxreadchunk;
-    }
-
-    auto numbytesread=fread(uptr,1,bytestoread,stream);
-    totalnumbytesread+=numbytesread;
-    if(numbytesread!=bytestoread) break;
-    totalbytestoread-=bytestoread;
-    uptr+=bytestoread;
-  }
-
-  return (totalnumbytesread/sizememb);
-}
-
-size_t myFWrite(const void *ptr, size_t sizememb, size_t nmemb, FILE *stream)
-{
-  static size_t maxwritechunk=134217728; // 128 MiB
-
-  if(stream == nullptr){
-    cout << "myFWrite() STREAM is nullptr???\nMajor fault, exiting immediately\n" << endl;
-    exit(100);
-  }
-
-  const uint8 * uptr=static_cast<const uint8 *>(ptr);
-
-  size_t totalbytestowrite=sizememb*nmemb;
-  size_t totalnumbyteswritten=0;
-  while(totalbytestowrite){
-    auto bytestowrite=totalbytestowrite;
-    if(bytestowrite>maxwritechunk){
-      bytestowrite=maxwritechunk;
-    }
-
-    auto numbyteswritten=fwrite(uptr,1,bytestowrite,stream);
-    totalnumbyteswritten+=numbyteswritten;
-    if(numbyteswritten!=bytestowrite) break;
-    totalbytestowrite-=bytestowrite;
-    uptr+=bytestowrite;
-  }
-
-  return (totalnumbyteswritten/sizememb);
-}
-
-
-int myFSeek(FILE *stream, size_t offset, int whence)
-{
-  return fseeko(stream, offset,whence);
-}
-
-size_t myFTell(FILE *stream)
-{
-  return ftello(stream);
-}
-
-
-
-
-/*************************************************************************
- *
- * for some totally unknown reason, gzRead() may fail on some systems
- *  when it tries reading >2 GiB. It does recognise it needs to read more,
- *  but somehow prefers to simply bail out with an error message *sigh*
- *
- * So, chunked read it is for gzRead(), too.
- *
- *************************************************************************/
-
-int64 myGZRead(gzFile & gzf, void *ptr, uint64 len)
-{
-  static uint64 maxreadchunk=134217728; // 128 MiB
-
-  uint8 * uptr=static_cast<uint8 *>(ptr);
-
-  uint64 totalnumbytesread=0;
-  while(len){
-    auto bytestoread=len;
-    if(bytestoread>maxreadchunk){
-      bytestoread=maxreadchunk;
-    }
-
-    auto numbytesread=gzread(gzf,uptr,bytestoread);
-    totalnumbytesread+=numbytesread;
-    if(static_cast<uint64>(numbytesread)!=bytestoread){
-      string myerr("Major system defect detected: a non-blocking call to gzread() returned "+boost::lexical_cast<string>(numbytesread)+" while "+boost::lexical_cast<string>(bytestoread)+" were requested.\nFound errno: "+boost::lexical_cast<string>(errno)+"\n");
-      if(errno==EWOULDBLOCK){
-	myerr+="Found EWOULDBLOCK.";
-      }else if(errno==EAGAIN){
-	myerr+="Found EAGAIN.";
-      }else if(errno==EACCES){
-	myerr+="Found EACCES.";
-      }else if(errno==EBUSY){
-	myerr+="Found EBUSY.";
-      }else if(errno==EDEADLK){
-	myerr+="Found EDEADLOCK.";
-      }else{
-	myerr+="Found no known errno.";
-      }
-      myerr+="\nThe system says:\n";
-      {
-	char buf[1024];
-	//int strerror_r(int errnum, char *buf, size_t buflen);
-	strerror_r(errno,buf,1024);
-	myerr+=buf;
-      }
-      int errnum=0;
-      auto gzem=gzerror(gzf,&errnum);
-      myerr+="\nwhile the zlib had errnum=="+boost::lexical_cast<string>(errnum)+" and says:\n"+gzem;
-      myerr+="\nMIRA will stop here, this is too fishy.\n";
-      cout << myerr; cout.flush();
-      exit(100);
-    }
-    len-=bytestoread;
-    uptr+=bytestoread;
-  }
-
-  return totalnumbytesread;
-
-}
-
-
-
-/*************************************************************************
- *
- * if gzread() can fail, so could gzwrite(), right?
- *
- *************************************************************************/
-
-int64 myGZWrite(gzFile & gzf, const void * ptr, uint64 len)
-{
-  static uint64 maxwritechunk=134217728; // 128 MiB
-
-  const uint8 * uptr=static_cast<const uint8 *>(ptr);
-
-  uint64 totalnumbyteswritten=0;
-  while(len){
-    auto bytestowrite=len;
-    if(bytestowrite>maxwritechunk){
-      bytestowrite=maxwritechunk;
-    }
-
-    auto numbyteswritten=gzwrite(gzf,uptr,bytestowrite);
-    totalnumbyteswritten+=numbyteswritten;
-    if(static_cast<uint64>(numbyteswritten)!=bytestowrite) return totalnumbyteswritten;
-    len-=bytestowrite;
-    uptr+=bytestowrite;
-  }
-
-  return totalnumbyteswritten;
-}
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-void splitFullPathAndFileName(const string & what, string & path, string & filename)
-{
-  string::size_type bpos = what.rfind("/");
-
-  if (bpos != string::npos) {
-    path=what.substr(0,bpos);
-  }
-  if(bpos!=what.size()) {
-    filename=what.substr(bpos+1,what.size());
-  }
-
-  return;
-}
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-void findLocationOfSelfBinary(string & location)
-{
-  location.clear();
-
-  const char * self=nullptr;
-
-#ifdef __APPLE__
-//#error "need to implement findLocationOfSelfBinary _NSGetExecutablePath() (man 3 dyld)"
-  char path[16384];
-  uint32 size = static_cast<uint32>(sizeof(path));
-  if (_NSGetExecutablePath(path, &size) == 0){
-    self=path;
-  }else{
-    cout << "Uhhh, could not determine binary path because too small buffer??? Need to program workaround with new/free.\n";
-    exit(100);
-  }
-#else
-  const static string selfpse("/proc/self/exe");         // Linux
-  const static string selfpcf("/proc/curproc/file");     // FreeBSD / DragonFlyBSD if they have /proc
-  const static string selfpce("/proc/curproc/exe");      // NetBSD
-
-  if(boost::filesystem::exists(selfpse)){
-    self=selfpse.c_str();
-  }else if(boost::filesystem::exists(selfpcf)){
-    self=selfpcf.c_str();
-  }else if(boost::filesystem::exists(selfpce)){
-    self=selfpce.c_str();
-  }
-
-#endif
-
-  if(self!=nullptr){
-    boost::filesystem::path bpath(self);
-    while(boost::filesystem::is_symlink(bpath)) {
-      bpath=boost::filesystem::read_symlink(bpath);
-    }
-    location=bpath.string();
-  }else{
-    cout << "Uhhh, could not determine binary path on this OS, needs programming!\n";
-    exit(100);
-  }
-
-  return;
-}
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-uint64 countLinesInFile(const string & filename)
-{
-  FUNCSTART("uint32 countLinesInFile(const string & filename)");
-
-  size_t totallines=0;
-
-  ifstream finfin;
-  finfin.open(filename.c_str(), ios::in);
-  if(!finfin){
-    MIRANOTIFY(Notify::FATAL, "File not found: " << filename);
-  }
-
-  string dummy;
-  while(!finfin.eof()){
-    getline(finfin,dummy);
-    if(!finfin.eof()) ++totallines;
-  }
-
-  finfin.close();
-
-  FUNCEND();
-  return totallines;
-}
-
-
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-void dumpFile(const char * fname, ostream & ostr)
-{
-  ifstream fin;
-  fin.open(fname, ios::in);
-  if(fin){
-    ostr << "Dump from " << fname << "\n"
-	 << "--------------------------------------------------------------------------------\n";
-    string dummy;
-    while(!fin.eof()){
-      getline(fin,dummy);
-      if(!fin.eof()) ostr << dummy << '\n';
-    }
-    fin.close();
-    ostr << "--------------------------------------------------------------------------------\n";
-  }else{
-    ostr << "Could not read file " << fname
-	 << "\n--------------------------------------------------------------------------------\n";
-  }
-}
-
-
-
-
-/*************************************************************************
- *
- * returns 0 if directory is there, -1 if not
- *
- *
- *************************************************************************/
-
-int ensureDirectory(const string & dirname, bool purge, bool verbose, bool waituntilok)
-{
-  struct stat st;
-  int rc=stat(dirname.c_str(),&st);
-  if(rc || purge) {
-    return purgeCreateDir(dirname, verbose, waituntilok);
-  }
-
-  return 0;
-}
-
-
-
-/*************************************************************************
- *
- * returns 0 if everything went fine (old dir evtually deleted and created
- *   anew)
- * -1 if something unexpected happened
- *
- *************************************************************************/
-
-int purgeCreateDir(const string & dirname, bool verbose, bool waituntilok)
-{
-  auto ret=removeDirectory(dirname,verbose,waituntilok);
-  if(ret==0) ret=createDirectory(dirname,verbose,waituntilok);
-  return ret;
-}
-
-
-
-/*************************************************************************
- *
- * returns 0 if everything went fine (old dir evtually deleted and created
- *   anew)
- * -1 if something unexpected happened
- *
- *************************************************************************/
-
-int removeDirectory(const string & dirname, bool verbose, bool waituntilok)
-{
-  boost::system::error_code ec;
-
-  bool isok=false;
-  uint32 waitseconds=1;
-  uint32 waititer=0;
-  if(boost::filesystem::is_directory(dirname,ec)){
-    if(verbose) {
-      cout << "Deleting old directory " << dirname << " ... "; cout.flush();
-    }
-    while(!isok){
-      isok=true;
-      // remove_all should not throw according to docs when error_code is used,
-      //   but does at least for BOOST 1.50 (on OSX? Not on Linux) if directory is write protected
-      // so play it safe for all boost::filesystem functions
-      try{
-	boost::filesystem::remove_all(dirname,ec);
-      }
-      catch(boost::filesystem::filesystem_error fse){
-	isok=false;
-	cout << "\n\nCould not delete directory " << dirname << ", error message is: " << fse.what() << endl;
-      }
-      catch(...){
-	isok=false;
-	cout << "\n\nCould not delete directory " << dirname << ", unspecified reason." << endl;
-      }
-      if(isok){
-	try{
-	  if(boost::filesystem::is_directory(dirname,ec)){
-	    isok=false;
-	    cout << "\n\nDirectory " << dirname << " should not exist by now, but it still does?" << endl;
-	  }
-	}
-	catch(...){
-	}
-      }
-      if(!isok){
-	if(++waititer>=3) waitseconds=60;
-	if(waituntilok){
-	  dateStamp(cout);
-	  cout << "\nTo not loose eventual results which took a long time to compute, MIRA will wait until"
-	    "\neither you have resolved the problem manually or you killed MIRA."
-	    "\nNext directory check in " << waitseconds << " seconds.\n";
-	  sleep(waitseconds);
-	}else{
-	  return -1;
-	}
-      }
-    }
-    if(verbose) cout << "done.\n";
-  }
-  return 0;
-}
-
-
-
-/*************************************************************************
- *
- * returns 0 if everything went fine
- * -1 if something unexpected happened and not waituntilok
- *
- *************************************************************************/
-
-int createDirectory(const string & dirname, bool verbose, bool waituntilok)
-{
-  boost::system::error_code ec;
-
-  bool isok=false;
-  uint32 waitseconds=1;
-  uint32 waititer=0;
-
-  if(verbose) {
-    cout << "Creating directory " << dirname << " ... ";
-  }
-
-  isok=false;
-  waitseconds=1;
-  waititer=0;
-
-  while(!isok){
-    isok=true;
-    try{
-      boost::filesystem::create_directory(dirname,ec);
-      if(ec){
-	isok=false;
-	cout << "\n\nCould not create directory " << dirname << ": " << ec.message() << endl;
-      }
-    }
-    catch(boost::filesystem::filesystem_error fse){
-      isok=false;
-      cout << "\n\nCould not create directory " << dirname << ", error message is: " << fse.what() << endl;
-    }
-    catch(...){
-      isok=false;
-      cout << "\n\nCould not create directory " << dirname << ", unspecified reason." << endl;
-    }
-    if(isok && !boost::filesystem::is_directory(dirname,ec)){
-      isok=false;
-      cout << "\n\nError: directory " << dirname << " should exist by now, but it does not." << endl;
-    }
-    if(!isok){
-      if(++waititer>=3) waitseconds=60;
-      if(waituntilok){
-	dateStamp(cout);
-	cout << "\nTo not loose eventual results which took a long time to compute, MIRA will wait until"
-	  "\neither you have resolved the problem manually or you killed MIRA."
-	  "\nNext directory check in " << waitseconds << " seconds.\n";
-	sleep(waitseconds);
-      }else{
-	return -1;
-      }
-    }
-  }
-  if(verbose) cout << "done.\n";
-
-  return 0;
-}
-
-
-
-/*************************************************************************
- *
- * walks down a symlink path, returns final destination
- *
- *************************************************************************/
-
-string walkSymLinks(const string path)
-{
-  boost::filesystem::path tpath(path);
-  if(!boost::filesystem::exists(tpath)) return std::string();
-  return boost::filesystem::canonical(path).string();
-}
-
-/*************************************************************************
- *
- * returns true if file exists and is regular file
- *
- *************************************************************************/
-
-bool fileExists(const std::string& filename)
-{
-  boost::filesystem::path finaldest(walkSymLinks(filename));
-  if(boost::filesystem::exists(finaldest)
-     && boost::filesystem::is_regular_file(finaldest)) {
-    return true;
-  }
-  return false;
-}
-
-/*************************************************************************
- *
- * returns true if dir exists
- *
- *************************************************************************/
-
-bool dirExists(const std::string& dirname)
-{
-  boost::filesystem::path finaldest(walkSymLinks(dirname));
-  if(boost::filesystem::exists(finaldest)
-     && boost::filesystem::is_directory(finaldest)) {
-    return true;
-  }
-  return false;
-}
-
-
-
-/*************************************************************************
- *
- * cannot easily use boost::filesystem::file_copy()
- * in case BOOST was not compiled with c++0x flags we will get linker errors
- * there IS a workaround with a funny define, but I do not like that:
- *  the following from
- * http://www.robertnitsch.de/notes/cpp/cpp11_boost_filesystem_undefined_reference_copy_file
- * as workaround if BOOST was not compiled with -std=c++0x
- * I'm not sure I like this
- * #define BOOST_NO_SCOPED_ENUMS
- *
- *************************************************************************/
-
-void fileCopy(const std::string& from, const std::string & to)
-{
-  std::ifstream  src(from, ios::in | ios::binary);
-  if(!src.is_open()){
-    cout << "fileCopy: Could not open src " << from << endl;
-    exit(999);
-  }
-
-  std::ofstream  dst(to,ios::out | ios::binary);
-  if(!dst.is_open()){
-    cout << "fileCopy: Could not open dst " << to << endl;
-    exit(999);
-  }
-
-  dst << src.rdbuf();
-  if(dst.bad()){
-    cout << "fileCopy: Could not finish copying to " << to << endl;
-    exit(999);
-  }
-}
-
-
-/*************************************************************************
- *
- * boost::filesystem::rename will fail if files are on different filesystems
- * let's try to be clever
- *
- *************************************************************************/
-
-void fileRename(const std::string& from, const std::string & to)
-{
-  try{
-    boost::filesystem::rename(from,to);
-  }
-  catch(...){
-    fileCopy(from,to);
-    fileRemove(from,true);
-  }
-}
-
-
-
-/*************************************************************************
- *
- * returns like boost::filesystem::remove():
- *     false if filename did not exist in the first place, otherwise true.
- *
- *************************************************************************/
-
-
-bool fileRemove(const std::string& filename, bool waituntilok)
-{
-  boost::system::error_code ec;
-  try{
-    if(!boost::filesystem::exists(filename,ec)) return false;
-  }
-  catch(...){
-  }
-
-  bool retval=false;
-  bool isok=false;
-  uint32 waitseconds=1;
-  uint32 waititer=0;
-  while(!isok){
-    isok=true;
-    // remove should not throw according to docs when error_code is used, but play it safe:
-    //  remove_all should neither, but at least it sometimes does for BOOST 1.50 (see above in purgeCreateDir())
-    try{
-      retval=boost::filesystem::remove(filename,ec);
-    }
-    catch(boost::filesystem::filesystem_error fse){
-      isok=false;
-      cout << "\n\nCould not delete file " << filename << ", error message is: " << fse.what() << endl;
-    }
-    catch(...){
-      isok=false;
-      cout << "\n\nCould not delete file " << filename << ", unspecified reason." << endl;
-    }
-    if(isok){
-      try{
-	if(boost::filesystem::exists(filename,ec)){
-	  isok=false;
-	  cout << "\n\nFile " << filename << " should not exist by now, but it still does?" << endl;
-	}
-      }
-      catch(...){
-      }
-    }
-    if(!isok){
-      if(++waititer>=3) waitseconds=60;
-      if(waituntilok){
-	dateStamp(cout);
-	cout << "\nTo not loose eventual results which took a long time to compute, this program will wait until"
-	  "\neither you have resolved the problem manually or you killed this program."
-	  "\nNext file check in " << waitseconds << " seconds.\n";
-	sleep(waitseconds);
-      }else{
-	return retval;
-      }
-    }
-  }
-  return retval;
-}
-
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-int64 getFileSize(const char* filename)
-{
-  return boost::filesystem::file_size(filename);
-}
-
-
-/*************************************************************************
- *
- * returns true if file already existed and we can append
- * opens the ofstream
- *
- *************************************************************************/
-
-bool openFileForAppend(const string & filename, ofstream & fout, bool deleteanyway)
-{
-  struct stat st;
-  if(deleteanyway || stat(filename.c_str(),&st)) {
-    CEBUG("Opening " << filename << " and truncating.\n");
-    fout.open(filename.c_str(), ios::out | ios::trunc);
-    return false;
-  }
-  CEBUG("Opening " << filename << " and appending.\n");
-  fout.open(filename.c_str(), ios::out | ios::app);
-  return true;
-}
-
-
-
-/*************************************************************************
- *
- * Input: filename
- * Output: pathto, stem, filetype, ziptype
- *
- * example:  name            pathto    stem     filetype     ziptype
- *           "foo.bar.gz"              "foo"     "bar"        2
- *           "fo.bar.baz"              "fo.bar"  "baz"        0
- *           "ble/bla.bz2"    ble      "bla"     ""           3
- *           "/ble/bla.z"     /ble     "bla"     ""           1
- *
- *************************************************************************/
-
-void guessFileAndZipType(const std::string & filename, std::string & pathto, std::string & stem, std::string & filetype, uint8 & ziptype)
-{
-  ziptype=0;
-  filetype.clear();
-  fs::path mypath(filename);
-
-  // careful: after this, mypath may be different (missing .gz / .bz2)
-  if(mypath.has_extension()){
-    while(mypath.has_extension()
-	  && (boost::iequals(mypath.extension().string(),".gz")
-	      || boost::iequals(mypath.extension().string(),".bz2")
-	      || boost::iequals(mypath.extension().string(),".z"))){
-      if(ziptype==0){
-	if(boost::iequals(mypath.extension().string(),".z")){
-	  ziptype=1;
-	}else if(boost::iequals(mypath.extension().string(),".gz")){
-	  ziptype=2;
-	}else if(boost::iequals(mypath.extension().string(),".bz2")){
-	  ziptype=3;
-	}
-      }
-      mypath=mypath.stem();
-    }
-    // careful with names just ending with "."
-    if(mypath.extension().string().size()>1){
-      filetype=mypath.extension().string().substr(1,mypath.extension().string().size());
-    }
-  }
-  pathto=mypath.parent_path().string();
-  stem=mypath.stem().string();
-  // bug in BOOST: filename entries like "tmp/" give "." as stem while an empty entry is expected
-  if(stem==".") stem.clear();
-
-  //cout << "gfazt ## fn: " << filename << " pt: " << pathto << " st: " << stem << " ft: " << filetype << " zt: " << static_cast<uint16>(ziptype) << endl;
-}
-
-
-/*************************************************************************
- *
- * Like guessFileAndZipType(), but sets filetype to "" if type is not
- *  one of the file types MIRA reads
- *
- *************************************************************************/
-
-
-void getCanonicalFileAndZipType(const std::string & filename, std::string & pathto, std::string & stem, std::string & filetype, uint8 & ziptype)
-{
-  guessFileAndZipType(filename,pathto,stem,filetype,ziptype);
-  if(!filetype.empty()){
-    if(filetype == "fastq"
-       || filetype == "fasta"
-       || filetype == "fa"
-       || filetype == "fna"
-       || filetype == "caf"
-       || filetype == "maf"
-       || filetype == "exp"
-       || filetype == "gbf"
-       || filetype == "gbff"
-       || filetype == "gbk"
-       || filetype == "gb"
-       || filetype == "gff"
-       || filetype == "gff3"
-       || filetype == "xml"
-       || filetype == "ssaha2"
-       || filetype == "smalt"
-       || filetype == "fofnexp"){
-      // TODO: how to do fastanoqual??? probably: .fna
-      if(filetype=="gbff" || filetype=="gbk" || filetype=="gb"){
-	filetype="gbf";
-      }else if(filetype=="gff"){
-	filetype="gff3";
-      }
-    }else{
-      filetype.clear();
-    }
-  }
-}
-
-
-
-/*************************************************************************
- *
- * for a given path which may contain directories and/or glob-characters
- *  with special meaning like ? or * (e.g. "something/some?re/file.*"),
- *  returns a list of fnft_t (file name/ file type) for every single file
- *  which matches
- *
- * expansion: to allow MIRA to load data which does not have a file-type
- *  postfix (needed e.g. for Galaxy), also parse special double-colon
- *  format borrowed from EMBOSS:   format::path
- * E.g.: "fastq.gz::something/some?re/*.dat"
- * This allows complete misdirections ("fastq::directory/somefile.fasta"),
- *  but then this really is a problem of the user.
- *
- * return: true if error encountered
- *
- * appends(!) list of filenames & deduced types to "fnftl"
- *
- * would be better to implement this as function which uses a callback
- *  for every found file, but what the heck: Sanger is on the way out,
- *  use cases with millions of files will be very rare
- *
- *************************************************************************/
-
-#define CEBUG(bla)   {cout << bla; cout.flush(); }
-bool globWalkPath(string dn, list<fnft_t> & fnftl)
-{
-  FUNCSTART("bool globWalkPath(const string & dn, list<fnft_t>& fnftl)");
-
-  bool hassomeerror=false;
-
-  // parse the double-colon part if present
-  string overridetype;
-
-  {
-    string tmptype;
-    auto dnI=dn.cbegin();
-    for(; dnI!=dn.cend(); ++dnI){
-      if(*dnI==':' && dnI+1!=dn.cend() && *(dnI+1)==':'){
-	auto tlen=dnI-dn.cbegin();
-	// to be able to use guessFileAndZipType(), we need to prepend a dot to
-	//  the string to be parsed for file types
-	tmptype=string(".")+dn.substr(0,tlen);
-	dn=dn.substr(tlen+2,dn.size()-(tlen+2));
-	//cout << "### " << dn << " ###" << tmptype << "###\n";
-	break;
-      }
-    }
-    if(!tmptype.empty()){
-      uint8 ziptype;
-      string dummypathto;
-      string dummystem;
-      getCanonicalFileAndZipType(tmptype,dummypathto,dummystem,overridetype,ziptype);
-      if(overridetype.empty()){
-	tmptype=tmptype.substr(1,999);
-	MIRANOTIFY(Notify::FATAL,"You tried to explicitely define a file type via " << tmptype << "::" << dn << ", however the type '" << tmptype << "' is not known to MIRA.");
-      }
-      //cout << "###" << overridetype << "###\n";
-    }
-  }
-
-  // unfortunately, boost::filesystem has no glob and boost no glob-like regex
-  glob_t globpaths;
-  globpaths.gl_offs = 0;
-  int globret=glob(dn.c_str(), 0, nullptr, &globpaths);
-  //paths.gl_pathv[0] = "ls";
-  if(globret!=0){
-    cout << "Data '" << dn << "' was not found (neither as file nor as directory) or led to a read error.\n";
-    hassomeerror=true;
-  }
-
-  if(!hassomeerror){
-    for(auto thisgpath=globpaths.gl_pathv; *thisgpath != nullptr; ++thisgpath){
-      fs::path path(*thisgpath);
-      if(!fs::exists(path)){
-	cout << "Problem with this data (file or path): " << *thisgpath << " was not found?" << endl;
-	hassomeerror=true;
-	continue;
-      }
-      list<fs::path> filepaths;
-      if(fs::is_directory(path)){
-	for (fs::directory_iterator dir_itr(path),end_iter; dir_itr !=  end_iter; ++dir_itr) {
-	  fs::path subpath(dir_itr->path());
-	  if(fs::is_regular_file(subpath) || fs::is_symlink(subpath)){
-	    filepaths.push_back(subpath);
-	  }
-	}
-      }else if(fs::is_regular_file(path) || fs::is_symlink(path)){
-	filepaths.push_back(path);
-      }
-
-      uint8 ziptype=0;
-      string filetype;
-      string dummypathto;
-      string dummystem;
-      fnft_t tmpfnft;
-      for(auto mypath : filepaths){
-	if(!fs::is_regular_file(mypath)) {
-	  cout << "mypath is not recognised as regular file???\n";
-	  hassomeerror=true;
-	  continue;
-	}
-	CEBUG("Pushing back filename: " << mypath << endl);
-	tmpfnft.fn=mypath.string();
-
-	if(overridetype.empty()){
-	  getCanonicalFileAndZipType(tmpfnft.fn,dummypathto,dummystem,filetype,ziptype);
-	  tmpfnft.ft=filetype;
-	}else{
-	  tmpfnft.ft=overridetype;
-	}
-	fnftl.push_back(tmpfnft);
-
-	if(tmpfnft.ft.empty()){
-	  cout << "Could not determine filetype from data '" << dn << "' (" << mypath << ")\n";
-	  hassomeerror=true;
-	}else if(ziptype>0 && filetype!="fastq"){
-	  cout << "zipped data only possible for FASTQ at the moment, " << filetype << " currently not supported, sorry\n";
-	  hassomeerror=true;
-	}
-      }
-    }
-  }
-
-  globfree(&globpaths);
-
-  FUNCEND();
-  return hassomeerror;
-}
-#define CEBUG(bla)
-
-
-
-/*************************************************************************
- *
- * returns: 0 == not on nfs, 1 == could not check, 2 == NFS
- *
- * appends(!) list of filenames & deduced types
- *
- *************************************************************************/
-
-int checkForNFSMountOnDirectory(const std::string & dir, bool verbose)
-{
-  int retval=0;
-  string runresult;
-
-#ifdef __APPLE__
-  string cmd("df -T nfs " + dir);
-  // on MacOSX, the above command is expected to have an empty output if the
-  //  filesystem is not on NFS.
-  // It actually works, however in those cases the return value of "df" is also
-  //  "1" (something failed) and not "0" (all OK).
-  //
-  // Sooooo ... to check runability, we make things a bit more complicated: check
-  //  two runs of "df", once with nfs and once with nonfs. If both results are
-  //  empty, something went wrong
-
-  string cmd2("df -T nonfs " + dir);
-  string runresult2;
-
-  getSTDOUTFromCommand(cmd,runresult);
-  getSTDOUTFromCommand(cmd2,runresult2);
-
-  bool checkrun=!runresult.empty() || !runresult2.empty();
-
-#else
-  string cmd("stat -f -L -c %T " + dir);
-  bool checkrun=checkRunabilityOfCommand(cmd);
-#endif
-
-  if(checkrun){
-#ifdef __APPLE__
-    if(!runresult.empty()) retval=2;
-#else
-    if(getSTDOUTFromCommand(cmd,runresult)){
-      boost::to_lower(runresult);
-      if(boost::find_first(runresult,"nfs")) retval=2;
-    }
-#endif
-  }else{
-    retval=1;
-    if(verbose){
-      cout << "Could not perform NFS check for directory "
-	   <<  dir;
-#ifdef __APPLE__
-      cout << "\n\nFor a check to run smoothly, please make sure the Unix 'df' command is available"
-	"\nand understands the following call: " << cmd << "\n\n";
-#else
-      cout << "\n\nFor a check to run smoothly, please make sure the Unix 'stat' command is available"
-	"\nand understands the following call: " << cmd << "\n\n";
-#endif
-    }
-  }
-
-  return retval;
-}
diff --git a/src/util/fileanddisk.H b/src/util/fileanddisk.H
deleted file mode 100644
index 1cd81dc..0000000
--- a/src/util/fileanddisk.H
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 1997-2000 by the German Cancer Research Center (Deutsches
- *   Krebsforschungszentrum, DKFZ Heidelberg) and Bastien Chevreux
- * Copyright (C) 2000 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-
-#ifndef _util_fileanddisk_h
-#define _util_fileanddisk_h
-
-
-// for fopen, fclose, fwrite and stat() in template functions below
-#include <cstdio>
-#include <sys/stat.h>
-
-#include <iostream>
-#include <fstream>
-
-#include <string>
-#include <list>
-#include <vector>
-
-#include <boost/lexical_cast.hpp>
-
-#include <sys/time.h>
-
-#include "stdinc/defines.H"
-
-#include "stdinc/stlincludes.H"
-
-#include <zlib.h>
-
-
-
-/*************************************************************************
- *
- * own wrapper functions for buggy system functions
- * - OSX fread, fwrite, ftell etc. (problems with data >= 2GiB)
- * - EMC Isilon does not honour blocking
- *
- *************************************************************************/
-
-// OSX
-size_t myFRead(void *ptr, size_t size, size_t nmemb, FILE *stream);
-size_t myFWrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
-int myFSeek(FILE *stream, size_t offset, int whence);
-size_t myFTell(FILE *stream);
-
-// some broken libz installations?
-int64 myGZRead(gzFile & gzf, void *buf, uint64 len);
-int64 myGZWrite(gzFile & gzf, const void * ptr, uint64 len);
-
-/*************************************************************************
- *
- *
- *
- *************************************************************************/
-
-void splitFullPathAndFileName(const std::string & what,
-			      std::string & path,
-			      std::string & filename
-  );
-void findLocationOfSelfBinary(std::string & result);
-
-uint64 countLinesInFile(const std::string & filename);
-void dumpFile(const char * fname, std::ostream & ostr);
-
-
-int ensureDirectory(const std::string & dirname, bool purge, bool verbose = true, bool waituntilok=true);
-int purgeCreateDir(const std::string & dirname, bool verbose, bool waituntilok);
-int removeDirectory(const std::string & dirname, bool verbose, bool waituntilok);
-int createDirectory(const std::string & dirname, bool verbose, bool waituntilok);
-std::string walkSymLinks(const std::string path);
-bool dirExists(const std::string& filename);
-bool fileExists(const std::string& filename);
-bool fileRemove(const std::string& filename, bool waituntilok);
-void fileCopy(const std::string& from, const std::string & to);
-void fileRename(const std::string& from, const std::string & to);
-
-int64 getFileSize(const char * filename);
-inline int64 getFileSize(const std::string & filename) { return getFileSize(filename.c_str());}
-
-bool openFileForAppend(const std::string & filename, std::ofstream & fout, bool deleteanyway);
-
-void guessFileAndZipType(const std::string & filename,
-			 std::string & pathto,
-			 std::string & stem,
-			 std::string & filetype,
-			 uint8 & ziptype);
-void getCanonicalFileAndZipType(const std::string & filename,
-				std::string & pathto,
-				std::string & stem,
-				std::string & filetype,
-				uint8 & ziptype);
-
-
-
-struct fnft_t {
-  std::string fn;      // filename
-  std::string ft;      // filetype
-};
-bool globWalkPath(std::string dn, std::list<fnft_t> & fnftl);
-
-int checkForNFSMountOnDirectory(const std::string & dir, bool verbose);
-
-
-/*************************************************************************
- *
- * returns false if anything went wrong
- *
- *************************************************************************/
-
-template<typename T>
-bool saveVector(const std::vector<T> & vec, const std::string filename)
-{
-  bool ret=false;
-  FILE * fout=fopen(filename.c_str(), "w");
-  if(fout){
-    if(vec.empty()
-       || myFWrite(&vec[0], sizeof(T), vec.size(), fout) == vec.size()) {
-      ret=true;
-    }
-    if(fclose(fout)!=0) ret=false;;
-  }
-  return ret;
-}
-
-/*************************************************************************
- *
- * loads data, either appending it to a vector (howtohandle==0) or
- *   loading it into a exactly sized vector (howtohandle==1)
- * returns false if anything went wrong
- *
- * howtohandle:
- *  - 0 means resize the vector as needed
- *  - 1: expect the vector to have exactly the needed size
- *
- *************************************************************************/
-
-template<typename T>
-bool loadVector(std::vector<T> & vec, const std::string filename, uint8 howtohandle)
-{
-  FUNCSTART("bool loadVector(std::vector<T> & vec, const std::string filename, uint8 howtohandle)");
-  bool ret=false;
-
-  FILE * fin=fopen(filename.c_str(), "r");
-  if(fin){
-    struct stat filestatus;
-    stat(filename.c_str(), &filestatus);
-    //std::cout << filestatus.st_size << " bytes\n";
-
-    if(filestatus.st_size%sizeof(T) == 0){
-      size_t numelements=filestatus.st_size/sizeof(T);
-      auto loadindex=vec.size();
-      if(howtohandle==0){
-	vec.resize(loadindex+numelements);
-      } else {
-	if(numelements!=vec.size()){
-	  std::cout << "Could load " << vec.size() << " elements, but file has " << numelements << " ???";
-	  fclose(fin);
-	  return false;
-	}
-	loadindex=0;
-      }
-      if(vec.empty()){
-	ret=true;
-      }else{
-	if(myFRead(&vec[loadindex], sizeof(T), numelements, fin) == numelements) ret=true;
-      }
-      if(fclose(fin)!=0) ret=false;;
-    }else{
-      std::cout << "File " << filename << " has " << filestatus.st_size << " bytes, that does not fit into a the vector type we want to put data into. Element size: " << sizeof(T) << " means " << filestatus.st_size%sizeof(T) << " leftover bytes.\n";
-      ret=false;
-    }
-  }
-
-  return ret;
-}
-
-#endif
diff --git a/src/util/fmttext.C b/src/util/fmttext.C
deleted file mode 100644
index e103571..0000000
--- a/src/util/fmttext.C
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 2003 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-
-#include "util/fmttext.H"
-
-using namespace std;
-
-namespace FmtText
-{
-  string wordWrap(const char * intxt, uint32_t llen)
-  {
-    string result;
-    if(intxt!=nullptr){
-      uint32_t colcount=0;
-      bool addinsert=false;
-      string word;
-      while(true){
-	word.clear();
-	// blanks at beginning of line are taken verbatim
-	// tabs are converted to 8 blanks
-	if(colcount==0){
-	  for(; *intxt!=0; ++intxt){
-	    if(*intxt==' '){
-	      word+=*intxt;
-	    }else if(*intxt=='\t'){
-	      word+="        ";
-	    }else{
-	      break;
-	    }
-	  }
-	}else{
-	  // munch blanks
-	  for(; *intxt!=0 && (*intxt==' ' || *intxt=='\t'); ++intxt);
-	}
-	// build word
-	for(; *intxt!=0 && *intxt!=' ' && *intxt!='\t' && *intxt!='\n'; ++intxt) word+=*intxt;
-	if(colcount==0 && word=="-"){
-	  addinsert=true;
-	  llen-=2;
-	}
-	if(colcount>0 && !word.empty() && colcount+word.size()+1 > llen){
-	  result+='\n';
-	  colcount=0;
-	  if(addinsert) result+="  ";
-	}
-	if(colcount>0) {
-	  result+=' ';
-	  ++colcount;
-	}
-	colcount+=static_cast<uint32_t>(word.size());
-	result+=word;
-	if(*intxt=='\n'){
-	  result+='\n';
-	  colcount=0;
-	  if(addinsert){
-	    addinsert=false;
-	    llen+=2;
-	  }
-	}
-	if(*intxt==0) break;
-	++intxt;
-      }
-    }
-    return result;
-  }
-
-  string makeTextSign(const char * intxt, uint32_t llen)
-  {
-    string result;
-    auto wrapped=wordWrap(intxt,llen-4);
-    if(!wrapped.empty() && wrapped.back()!='\n') wrapped+='\n';
-    for(uint32_t xi=0; xi<llen; ++xi) result+='*';
-    result+='\n';
-    uint32_t colcount=0;
-    for(auto & se : wrapped){
-      if(colcount==0){
-	result+="* ";
-	colcount=2;
-      }
-      if(se=='\n'){
-	for(; colcount< llen-1; ++colcount) result+=' ';
-	result+="*\n";
-	colcount=0;
-      }else{
-	result+=se;
-	++colcount;
-      }
-    }
-    for(uint32_t xi=0; xi<llen; ++xi) result+='*';
-    return result;
-  }
-
-}
diff --git a/src/util/fmttext.H b/src/util/fmttext.H
deleted file mode 100644
index 1788311..0000000
--- a/src/util/fmttext.H
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 2013 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-#ifndef _util_fmttext_h
-#define _util_fmttext_h
-
-#include <sstream>
-#include <string>
-
-namespace FmtText
-{
-  std::string wordWrap(const char * intxt, uint32_t llen);
-  inline std::string wordWrap(const std::string & intxt, uint32_t llen) { return wordWrap(intxt.c_str(),llen);}
-  inline std::string wordWrap(const std::ostringstream & intxt, uint32_t llen) { return wordWrap(intxt.str().c_str(),llen);}
-  inline std::string wordWrap(const char * intxt) { return wordWrap(intxt,78);}
-  inline std::string wordWrap(const std::string & intxt) { return wordWrap(intxt,78);}
-  inline std::string wordWrap(const std::ostringstream & intxt) { return wordWrap(intxt,78);}
-
-  std::string makeTextSign(const char * intxt, uint32_t llen);
-  inline std::string makeTextSign(const std::string & intxt, uint32_t llen) { return makeTextSign(intxt.c_str(),llen);}
-  inline std::string makeTextSign(const std::ostringstream & intxt, uint32_t llen) { return makeTextSign(intxt.str().c_str(),llen);}
-  inline std::string makeTextSign(const char * intxt) { return makeTextSign(intxt,80);}
-  inline std::string makeTextSign(const std::string & intxt) { return makeTextSign(intxt.c_str(),80);}
-  inline std::string makeTextSign(const std::ostringstream & intxt) { return makeTextSign(intxt.str().c_str(),80);}
-
-}
-
-#endif
diff --git a/src/util/machineinfo.C b/src/util/machineinfo.C
deleted file mode 100644
index c3df292..0000000
--- a/src/util/machineinfo.C
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 2003 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-#include "machineinfo.H"
-
-#ifdef __APPLE__
-#include <sys/sysctl.h>
-#include <mach/mach_host.h>
-#endif
-
-#include <fstream>
-
-#include <set>
-#include <boost/regex.hpp>
-
-using namespace std;
-
-
-uint64 MachineInfo::MI_memtotal=0;
-uint64 MachineInfo::MI_corestotal=0;
-
-bool   MachineInfo::MI_staticinitialised=staticInit();
-
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-bool MachineInfo::staticInit()
-{
-  MI_memtotal=computeMemTotal();
-  MI_corestotal=computeNumCores();
-  return true;
-}
-
-
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-
-uint64 MachineInfo::computeNumCores()
-{
-#ifdef __APPLE__
-  size_t uints=sizeof(uint64);
-  uint64 numc=0;
-  sysctlbyname("hw.physicalcpu", &numc, &uints, nullptr, 0);
-
-  return numc;
-#else
-
-  static const boost::regex re_processor("^processor[\\s]*:[\\s]*([0-9]+)");
-  static const boost::regex re_physicalid("^physical id[\\s]*:[\\s]*([0-9]+)");
-  static const boost::regex re_coreid("^core id[\\s]*:[\\s]*([0-9]+)");
-
-  set<uint32> pidcidset; // should be enough for up to 2^16 CPUs with 2^16 cores each
-  string tmpline;
-
-  ifstream fin;
-  fin.open("/proc/cpuinfo", ios::in);
-
-  if(fin){
-    int16 physicalid=-1;
-    int16 coreid=-1;
-    boost::smatch what;
-    while(getline(fin,tmpline)){
-      if(boost::regex_search(tmpline.cbegin(), tmpline.cend(), what, re_processor, boost::match_default)){
-	if(physicalid>=0 && coreid>=0){
-	  uint32 pidcid=physicalid;
-	  pidcid<<=16;
-	  pidcid+=coreid;
-	  pidcidset.insert(pidcid);
-	  physicalid=-1;
-	  coreid=-1;
-	}
-      }
-      if(boost::regex_search(tmpline.cbegin(), tmpline.cend(), what, re_physicalid, boost::match_default)){
-	if(what.size()>=2){
-	  string tmps(what[1].first, what[1].second);
-	  physicalid=static_cast<int16>(atoi(tmps.c_str()));
-	}
-      }
-      if(boost::regex_search(tmpline.cbegin(), tmpline.cend(), what, re_coreid, boost::match_default)){
-	if(what.size()>=2){
-	  string tmps(what[1].first, what[1].second);
-	  coreid=static_cast<int16>(atoi(tmps.c_str()));
-	}
-      }
-    }
-  }
-  return pidcidset.size();
-#endif
-}
-
-
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-uint64 MachineInfo::computeMemTotal()
-{
-#ifdef __APPLE__
-  size_t uints=sizeof(uint64);
-  uint64 mem=0;
-  //sysctlbyname("hw.memsize", &mem, &uints, nullptr, 0);
-  sysctlbyname("hw.usermem", &mem, &uints, nullptr, 0);
-
-  return mem;
-#else
-  return grepMemSizeFromProcFS("/proc/meminfo","MemTotal:");
-#endif
-}
-
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-uint64 MachineInfo::computeMemAvail()
-{
-#ifdef __APPLE__
-  uint64 retval=0;
-
-  // from http://stackoverflow.com/questions/6094444/how-can-i-programmatically-check-free-system-memory-on-mac-like-the-activity-mon
-  int mib[6];
-  mib[0] = CTL_HW;
-  mib[1] = HW_PAGESIZE;
-
-  int pagesize;
-  size_t length;
-  length = sizeof (pagesize);
-  if (sysctl (mib, 2, &pagesize, &length, nullptr, 0) < 0){
-    fprintf (stderr, "getting page size");
-  }
-
-  mach_msg_type_number_t count = HOST_VM_INFO_COUNT;
-  vm_statistics_data_t vmstat;
-  if(KERN_SUCCESS == host_statistics(mach_host_self(), HOST_VM_INFO, (host_info_t)&vmstat, &count)){
-    retval=vmstat.free_count + vmstat.inactive_count;
-  }
-
-  return retval*pagesize;
-#else
-  return grepMemSizeFromProcFS("/proc/meminfo","MemFree:")+grepMemSizeFromProcFS("/proc/meminfo","Cached:");
-#endif
-}
-
-
-/*************************************************************************
- *
- *
- *
- *
- *************************************************************************/
-
-uint64 MachineInfo::grepMemSizeFromProcFS(const char * fname, const string & identifier)
-{
-  uint64 retval=0;
-
-  ifstream fin;
-  fin.open(fname, ios::in);
-  string dummy;
-  if(fin){
-    while(!fin.eof()){
-      fin >> dummy;
-      if(dummy==identifier){
-	fin >> retval;
-	fin >> dummy;
-	if(dummy=="kB" || dummy=="kiB"){
-	  retval*=1024;
-	}else if(dummy=="mB" || dummy=="miB"){
-	  retval*=1024*1024;
-	}else if(dummy=="gB" || dummy=="giB"){
-	  retval*=1024*1024*1024;
-	}
-	break;
-      }
-      if(fin.eof()) break;
-    }
-    fin.close();
-  }
-  return retval;
-}
diff --git a/src/util/machineinfo.H b/src/util/machineinfo.H
deleted file mode 100644
index ce20a7e..0000000
--- a/src/util/machineinfo.H
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 2003 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-#ifndef _bas_machineinfo_h_
-#define _bas_machineinfo_h_
-
-#include <string>
-#include <iostream>
-
-#include "stdinc/defines.H"
-#include "stdinc/types.H"
-
-class MachineInfo
-{
-private:
-  //Variables
-  static bool MI_staticinitialised;
-
-  static uint64 MI_memtotal;
-  static uint64 MI_corestotal;
-
-
-public:
-
-
-  //Functions
-private:
-  static bool staticInit();
-
-  static uint64 grepMemSizeFromProcFS(const char * fname, const std::string & identifier);
-  static uint64 computeMemTotal();
-  static uint64 computeMemAvail();
-  static uint64 computeNumCores();
-
-public:
-  MachineInfo();
-
-  MachineInfo const & operator=(MachineInfo const & other);
-  friend std::ostream & operator<<(std::ostream &ostr, MachineInfo const &mi);
-
-  inline static uint64 getCoresTotal() {return MI_corestotal;}
-  inline static uint64 getMemTotal() {return MI_memtotal;}
-  static uint64 getVMSize() {return grepMemSizeFromProcFS("/proc/self/status","VmSize:"); }
-  inline static uint64 getMemAvail() {return computeMemAvail();}
-
-};
-
-
-#endif
diff --git a/src/util/memusage.H b/src/util/memusage.H
index 2c1b373..16a2402 100644
--- a/src/util/memusage.H
+++ b/src/util/memusage.H
@@ -4,14 +4,12 @@
 #include "stdinc/types.H"
 #include "stdinc/stlincludes.H"
 
-#include <list>
-#include <map>
-#include <set>
 
 #ifndef _memusage_h
 #define _memusage_h
 
-#define MMEBUG(bla)
+//#define CEBUG(bla)   {cout << bla; cout.flush(); }
+//#define CEBUG(bla) 
 
 
 
@@ -23,7 +21,7 @@
 
 // for strings
 // this is a real cludge
-inline void emuoc_statsOnType(const std::string & c, size_t & total_size, size_t & total_freecap, size_t & total_lostba, size_t & num_size, size_t & bytes_size, size_t & overhead, size_t & lostbyalign, bool & iscontainer);
+inline void emuoc_statsOnType(const string & c, size_t & total_size, size_t & total_freecap, size_t & total_lostba, size_t & num_size, size_t & bytes_size, size_t & overhead, size_t & lostbyalign, bool & iscontainer);
 
 // for simple types (int, structs, unions, objects etc)
 template<class myType>
@@ -45,30 +43,30 @@ inline void emuoc_statsOnType_sizeAndCapacity(const myType & c, size_t & total_s
  *************************************************************************/
 
 template<class myType>
-inline void emuoc_statsOnType(const std::vector<myType> & c, size_t & total_size, size_t & total_freecap, size_t & total_lostba, size_t & num_size, size_t & bytes_size, size_t & overhead, size_t & lostbyalign, bool & iscontainer)
+inline void emuoc_statsOnType(const vector<myType> & c, size_t & total_size, size_t & total_freecap, size_t & total_lostba, size_t & num_size, size_t & bytes_size, size_t & overhead, size_t & lostbyalign, bool & iscontainer)
 {
 
   emuoc_statsOnType_sizeAndCapacity(
-    c,total_size,total_freecap, total_lostba, num_size,
+    c,total_size,total_freecap, total_lostba, num_size, 
     bytes_size, overhead, lostbyalign, iscontainer);
   // overhead of each elem is 0
 }
 
 template<class myType>
-inline void emuoc_statsOnType(const std::vector<std::string> & c, size_t & total_size, size_t & total_freecap, size_t & total_lostba, size_t & num_size, size_t & bytes_size, size_t & overhead, size_t & lostbyalign, bool & iscontainer)
+inline void emuoc_statsOnType(const vector<string> & c, size_t & total_size, size_t & total_freecap, size_t & total_lostba, size_t & num_size, size_t & bytes_size, size_t & overhead, size_t & lostbyalign, bool & iscontainer)
 {
 
   emuoc_statsOnType_sizeAndCapacity(
-    c,total_size,total_freecap, total_lostba, num_size,
+    c,total_size,total_freecap, total_lostba, num_size, 
     bytes_size, overhead, lostbyalign, iscontainer);
   // overhead of each elem is 0
 }
 
 template<class myType>
-inline void emuoc_statsOnType(const std::list<myType> & c, size_t & total_size, size_t & total_freecap, size_t & total_lostba, size_t & num_size, size_t & bytes_size, size_t & overhead, size_t & lostbyalign, bool & iscontainer)
+inline void emuoc_statsOnType(const list<myType> & c, size_t & total_size, size_t & total_freecap, size_t & total_lostba, size_t & num_size, size_t & bytes_size, size_t & overhead, size_t & lostbyalign, bool & iscontainer)
 {
 
-  emuoc_statsOnType_sizeonly(c,total_size,total_freecap, total_lostba, num_size,
+  emuoc_statsOnType_sizeonly(c,total_size,total_freecap, total_lostba, num_size, 
 		bytes_size, overhead, lostbyalign, iscontainer,
 		2*sizeof(void *));
   // overhead of each elem is a forward and a reverse pointer
@@ -79,56 +77,56 @@ inline void emuoc_statsOnType(const std::list<myType> & c, size_t & total_size,
 //inline void emuoc_statsOnType(const slist<myType> & c, size_t & total_size, size_t & total_freecap, size_t & total_lostba, size_t & num_size, size_t & bytes_size, size_t & overhead, size_t & lostbyalign, bool & iscontainer)
 //{
 //
-//  emuoc_statsOnType_sizeonly(c,total_size,total_freecap, total_lostba, num_size,
+//  emuoc_statsOnType_sizeonly(c,total_size,total_freecap, total_lostba, num_size, 
 //		bytes_size, overhead, lostbyalign, iscontainer,
 //		sizeof(void *));
 //  // overhead of each elem is a forward pointer
 //}
 
 template<class myType>
-inline void emuoc_statsOnType(const std::set<myType> & c, size_t & total_size, size_t & total_freecap, size_t & total_lostba, size_t & num_size, size_t & bytes_size, size_t & overhead, size_t & lostbyalign, bool & iscontainer)
+inline void emuoc_statsOnType(const set<myType> & c, size_t & total_size, size_t & total_freecap, size_t & total_lostba, size_t & num_size, size_t & bytes_size, size_t & overhead, size_t & lostbyalign, bool & iscontainer)
 {
 
-  emuoc_statsOnType_sizeonly(c,total_size,total_freecap, total_lostba, num_size,
+  emuoc_statsOnType_sizeonly(c,total_size,total_freecap, total_lostba, num_size, 
 		bytes_size, overhead, lostbyalign, iscontainer,
 		4*sizeof(void *));
-  // overhead of each elem is
+  // overhead of each elem is 
   //  - the tree color (padded to fill up void *)
   //  - a parent, a left and a right child
 }
 
 template<class myType>
-inline void emuoc_statsOnType(const std::multiset<myType> & c, size_t & total_size, size_t & total_freecap, size_t & total_lostba, size_t & num_size, size_t & bytes_size, size_t & overhead, size_t & lostbyalign, bool & iscontainer)
+inline void emuoc_statsOnType(const multiset<myType> & c, size_t & total_size, size_t & total_freecap, size_t & total_lostba, size_t & num_size, size_t & bytes_size, size_t & overhead, size_t & lostbyalign, bool & iscontainer)
 {
 
-  emuoc_statsOnType_sizeonly(c,total_size,total_freecap, total_lostba, num_size,
+  emuoc_statsOnType_sizeonly(c,total_size,total_freecap, total_lostba, num_size, 
 		bytes_size, overhead, lostbyalign, iscontainer,
 		4*sizeof(void *));
-  // overhead of each elem is
+  // overhead of each elem is 
   //  - the tree color (padded to fill up void *)
   //  - a parent, a left and a right child
 }
 
 
 template<class myType1,class myType2>
-inline void emuoc_statsOnType(const std::map<myType1,myType2> & c, size_t & total_size, size_t & total_freecap, size_t & total_lostba, size_t & num_size, size_t & bytes_size, size_t & overhead, size_t & lostbyalign, bool & iscontainer)
+inline void emuoc_statsOnType(const map<myType1,myType2> & c, size_t & total_size, size_t & total_freecap, size_t & total_lostba, size_t & num_size, size_t & bytes_size, size_t & overhead, size_t & lostbyalign, bool & iscontainer)
 {
 
-  emuoc_statsOnType_sizeonly(c,total_size,total_freecap, total_lostba, num_size,
+  emuoc_statsOnType_sizeonly(c,total_size,total_freecap, total_lostba, num_size, 
 		bytes_size, overhead, lostbyalign, iscontainer,
 		4*sizeof(void *));
-  // overhead of each elem is
+  // overhead of each elem is 
   //  - the tree color (padded to fill up void *)
   //  - a parent, a left and a right child
 }
 
 template<class myType1,class myType2>
-inline void emuoc_statsOnType(const std::multimap<myType1,myType2> & c, size_t & total_size, size_t & total_freecap, size_t & total_lostba, size_t & num_size, size_t & bytes_size, size_t & overhead, size_t & lostbyalign, bool & iscontainer)
+inline void emuoc_statsOnType(const multimap<myType1,myType2> & c, size_t & total_size, size_t & total_freecap, size_t & total_lostba, size_t & num_size, size_t & bytes_size, size_t & overhead, size_t & lostbyalign, bool & iscontainer)
 {
-  emuoc_statsOnType_sizeonly(c,total_size,total_freecap, total_lostba, num_size,
+  emuoc_statsOnType_sizeonly(c,total_size,total_freecap, total_lostba, num_size, 
 		bytes_size, overhead, lostbyalign, iscontainer,
 		4*sizeof(void *));
-  // overhead of each elem is
+  // overhead of each elem is 
   //  - the tree color (padded to fill up void *)
   //  - a parent, a left and a right child
 }
@@ -139,8 +137,8 @@ inline void emuoc_statsOnType(const std::multimap<myType1,myType2> & c, size_t &
 template<class myType>
 size_t estimateMemoryUsageOfContainer(const myType & c, bool withoverhead, size_t & numelem, size_t & bytes_size, size_t & free_capacity, size_t & lostbyalign)
 {
-  MMEBUG("dido called with: " << typeid(myType).name() << endl);
-
+  CEBUG("dido called with: " << typeid(myType).name() << endl);
+  
   numelem=0;
   bytes_size=0;
   free_capacity=0;
@@ -160,15 +158,15 @@ size_t estimateMemoryUsageOfContainer(const myType & c, bool withoverhead, size_
       bytes_size-=sizeof(myType);
     }
 
-    MMEBUG("Stats total size: " << numelem << endl);
-    MMEBUG("Stats byte size: " << bytes_size << endl);
-    MMEBUG("Stats total free cap: " << free_capacity << endl);
-    MMEBUG("Stats total lba: " << lostbyalign << endl);
-
-    MMEBUG("Stats size: " << stats_s << endl);
-    MMEBUG("Stats overhead: " << stats_o << endl);
-    MMEBUG("Stats lost b align: " << stats_lba << endl);
-    MMEBUG("Stats is container: " << stats_isc << endl);
+    CEBUG("Stats total size: " << numelem << endl);
+    CEBUG("Stats byte size: " << bytes_size << endl);
+    CEBUG("Stats total free cap: " << free_capacity << endl);
+    CEBUG("Stats total lba: " << lostbyalign << endl);
+    
+    CEBUG("Stats size: " << stats_s << endl);
+    CEBUG("Stats overhead: " << stats_o << endl);
+    CEBUG("Stats lost b align: " << stats_lba << endl);
+    CEBUG("Stats is container: " << stats_isc << endl);
   }
 
   return bytes_size;
@@ -178,8 +176,8 @@ size_t estimateMemoryUsageOfContainer(const myType & c, bool withoverhead, size_
 template<class myType>
 size_t estimateMemoryUsageOfContainer(const myType & c, bool withoverhead)
 {
-  MMEBUG("dido called with: " << typeid(myType).name() << endl);
-
+  CEBUG("dido called with: " << typeid(myType).name() << endl);
+  
   size_t numelem, bytes_size, free_capacity, lostbyalign;
 
   numelem=0;
@@ -201,21 +199,21 @@ size_t estimateMemoryUsageOfContainer(const myType & c, bool withoverhead)
       bytes_size-=sizeof(myType);
     }
 
-    MMEBUG("Stats total size: " << numelem << endl);
-    MMEBUG("Stats byte size: " << bytes_size << endl);
-    MMEBUG("Stats total free cap: " << free_capacity << endl);
-    MMEBUG("Stats total lba: " << lostbyalign << endl);
-
-    MMEBUG("Stats size: " << stats_s << endl);
-    MMEBUG("Stats overhead: " << stats_o << endl);
-    MMEBUG("Stats lost b align: " << stats_lba << endl);
-    MMEBUG("Stats is container: " << stats_isc << endl);
+    CEBUG("Stats total size: " << numelem << endl);
+    CEBUG("Stats byte size: " << bytes_size << endl);
+    CEBUG("Stats total free cap: " << free_capacity << endl);
+    CEBUG("Stats total lba: " << lostbyalign << endl);
+    
+    CEBUG("Stats size: " << stats_s << endl);
+    CEBUG("Stats overhead: " << stats_o << endl);
+    CEBUG("Stats lost b align: " << stats_lba << endl);
+    CEBUG("Stats is container: " << stats_isc << endl);
   }
 
   return bytes_size;
 }
 
-//#define MMEBUG(bla)
+//#define CEBUG(bla) 
 
 
 
@@ -229,9 +227,9 @@ size_t estimateMemoryUsageOfContainer(const myType & c, bool withoverhead)
 
 // for strings
 // this is a real cludge
-inline void emuoc_statsOnType(const std::string & c, size_t & total_size, size_t & total_freecap, size_t & total_lostba, size_t & num_size, size_t & bytes_size, size_t & overhead, size_t & lostbyalign, bool & iscontainer)
+inline void emuoc_statsOnType(const string & c, size_t & total_size, size_t & total_freecap, size_t & total_lostba, size_t & num_size, size_t & bytes_size, size_t & overhead, size_t & lostbyalign, bool & iscontainer)
 {
-  MMEBUG("emuoc_statsOnType(string): " << typeid(c).name() << endl);
+  CEBUG("emuoc_statsOnType(string): " << typeid(c).name() << endl);
 
   (void) c;
   (void) total_freecap;
@@ -252,7 +250,7 @@ inline void emuoc_statsOnType(const std::string & c, size_t & total_size, size_t
   if(bytes_size%sizeof(void *)){
     lostbyalign=sizeof(void *)-bytes_size%sizeof(void *);
   }
-  MMEBUG("Lost by align: " <<lostbyalign << endl);
+  CEBUG("Lost by align: " <<lostbyalign << endl);
 
   return;
 }
@@ -263,7 +261,7 @@ inline void emuoc_statsOnType(const std::string & c, size_t & total_size, size_t
 template<class myType>
 inline void emuoc_statsOnType(const myType & c, size_t & total_size, size_t & total_freecap, size_t & total_lostba, size_t & num_size, size_t & bytes_size, size_t & overhead, size_t & lostbyalign, bool & iscontainer)
 {
-  MMEBUG("emuoc_statsOnType(generic): " << typeid(myType).name() << endl);
+  CEBUG("emuoc_statsOnType(generic): " << typeid(myType).name() << endl);
 
   (void) c;
   (void) total_freecap;
@@ -279,7 +277,7 @@ inline void emuoc_statsOnType(const myType & c, size_t & total_size, size_t & to
   if(bytes_size%sizeof(void *)){
     lostbyalign=sizeof(void *)-bytes_size%sizeof(void *);
   }
-  MMEBUG("Lost by align: " <<lostbyalign << endl);
+  CEBUG("Lost by align: " <<lostbyalign << endl);
 
   return;
 }
@@ -289,7 +287,7 @@ inline void emuoc_statsOnType(const myType & c, size_t & total_size, size_t & to
 template<class myType>
 inline void emuoc_statsOnType_sizeonly(const myType & c, size_t & total_size, size_t & total_freecap, size_t & total_lostba, size_t & num_size, size_t & bytes_size, size_t & overhead, size_t & lostbyalign, bool & iscontainer, size_t overhead_elem)
 {
-  MMEBUG("emuoc_statsOnType(simple): " << typeid(std::list<myType>).name() << endl);
+  CEBUG("emuoc_statsOnType(simple): " << typeid(list<myType>).name() << endl);
 
   (void) c;
   (void) total_freecap;
@@ -303,7 +301,7 @@ inline void emuoc_statsOnType_sizeonly(const myType & c, size_t & total_size, si
   for(; cI != c.end(); cI++){
     size_t stats_s, stats_bs, stats_o, stats_lba;
     bool stats_isc;
-    MMEBUG("loop\n");
+    CEBUG("loop\n");
     emuoc_statsOnType(*cI,total_size,total_freecap,total_lostba,
 		stats_s,stats_bs,stats_o,stats_lba,stats_isc);
     num_size+=stats_s;
@@ -316,7 +314,7 @@ inline void emuoc_statsOnType_sizeonly(const myType & c, size_t & total_size, si
 template<class myType>
 inline void emuoc_statsOnType_sizeAndCapacity(const myType & c, size_t & total_size, size_t & total_freecap, size_t & total_lostba, size_t & num_size, size_t & bytes_size, size_t & overhead, size_t & lostbyalign, bool & iscontainer)
 {
-  MMEBUG("emuoc_statsOnType(vector): " << typeid(std::vector<myType>).name() << endl);
+  CEBUG("emuoc_statsOnType(vector): " << typeid(vector<myType>).name() << endl);
 
   (void) c;
   num_size=0;
@@ -325,7 +323,7 @@ inline void emuoc_statsOnType_sizeAndCapacity(const myType & c, size_t & total_s
   lostbyalign=0;
   iscontainer=true;
 
-  MMEBUG("overhead: " << overhead
+  CEBUG("overhead: " << overhead
 	<< "\nbytes_size: " << bytes_size
 	<< "\ntotal_freecap: " << total_freecap
 	<< endl);
@@ -335,24 +333,24 @@ inline void emuoc_statsOnType_sizeAndCapacity(const myType & c, size_t & total_s
   bool subelem_is_container=true;
   for(; cI != c.end(); cI++){
     size_t stats_s, stats_bs, stats_o, stats_lba;
-    MMEBUG("loop ");
+    CEBUG("loop ");
     emuoc_statsOnType(
       *cI,total_size,total_freecap,total_lostba,
       stats_s,stats_bs,stats_o,stats_lba,
       subelem_is_container);
     // no lost by align and no overhead of elements in vector
     bytes_size+=stats_bs;
-    MMEBUG(stats_bs << " " << bytes_size << endl);
+    CEBUG(stats_bs << " " << bytes_size << endl);
   }
   num_size+=c.size();
-  MMEBUG("size: " << num_size << endl);
-  MMEBUG("capacity: " << c.capacity() << endl);
+  CEBUG("size: " << num_size << endl);
+  CEBUG("capacity: " << c.capacity() << endl);
   if(c.capacity() != num_size){
     size_t vtype=sizeof(typename myType::value_type);
-    MMEBUG("empty element: " << vtype << endl);
+    CEBUG("empty element: " << vtype << endl);
     total_freecap+=vtype*(c.capacity()-num_size);
     bytes_size+=vtype*(c.capacity()-num_size);
-  }
+  } 
   if(bytes_size%sizeof(void *)){
     lostbyalign=sizeof(void *)-bytes_size%sizeof(void *);
     bytes_size+=lostbyalign;
@@ -360,12 +358,12 @@ inline void emuoc_statsOnType_sizeAndCapacity(const myType & c, size_t & total_s
 
   total_lostba+=lostbyalign;
 
-  MMEBUG("at end:"
+  CEBUG("at end:"
 	<< "\n\tbytes_size: " << bytes_size
 	<< "\n\ttotal_freecap: " << total_freecap
 	<< "\n\tlost by align: " << lostbyalign
 	<< "\n\ttotal lba: " << total_lostba);
-  MMEBUG("\nv_out\n");
+  CEBUG("\nv_out\n");
 
   return;
 }
diff --git a/src/util/misc.C b/src/util/misc.C
index ee0bfa5..a33ad30 100644
--- a/src/util/misc.C
+++ b/src/util/misc.C
@@ -9,46 +9,47 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
-#undef __STRICT_ANSI__
-
 #include "util/misc.H"
-
-// use stat (2)
-#include <sys/types.h>
-#include <sys/stat.h>
-
-
-// time() in dateStamp
-#include <ctime>
-
-
-#include <fstream>
-#include <algorithm>
-
 #include "errorhandling/errorhandling.H"
 
-// for perror (3C), fopen, fclose & fwrite
-#include <cstdio>
+// 	$Id$	
+
+#ifndef lint
+static char vcid[] = "$Id$";
+#endif /* lint */
 
 
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+char * conditionalStrCpy(const char * src)
+{
+  (void) vcid;
 
-using namespace std;
+  if(src == NULL) return NULL;
+  uint32 len=static_cast<uint32>(strlen(src));
+  char * dest= new char[len+1];
+  strcpy(dest, src);
+  return dest;
+}
 
 
-//#include "util/machineinfo.H"
 void dateStamp(ostream & ostr)
 {
   struct tm *p;
@@ -56,7 +57,6 @@ void dateStamp(ostream & ostr)
   time(&t);
   p=localtime(&t);
   ostr << "Localtime: " << asctime(p);
-  //ostr << "VMSize: " << MachineInfo::getVMSize() << endl;
 }
 
 
@@ -66,7 +66,7 @@ void ctout(char * ptr)
   uint8 incrval=ptr[1];
   ptr+=2;
   char * outstart=ptr;
-  for(;; ++ptr, eorval+=incrval){
+  for(;; ptr++, eorval+=incrval){
     *ptr=(*ptr^eorval);
     if(*ptr==0) break;
   }
@@ -79,13 +79,98 @@ void ctinplace(char * ptr)
   uint8 eorval=ptr[0];
   uint8 incrval=ptr[1];
   ptr+=2;
-  for(;; ++ptr, eorval+=incrval){
+  for(;; ptr++, eorval+=incrval){
     *ptr=(*ptr^eorval);
     if(*ptr==0) break;
   }
 }
 
 
+/*************************************************************************
+ *
+ *
+ *
+ *************************************************************************/
+
+void splitFullPathAndFileName(const string & what, string & path, string & filename)
+{
+  string::size_type bpos = what.rfind("/");
+
+  if (bpos != string::npos) {
+    path=what.substr(0,bpos);
+  }
+  if(bpos!=what.size()) {
+    filename=what.substr(bpos+1,what.size());
+  }
+
+  return;
+}
+
+
+
+/*************************************************************************
+ *
+ *
+ *
+ *************************************************************************/
+
+uint64 countLinesInFile(const string & filename)
+{
+  FUNCSTART("uint32 countLinesInFile(const string & filename)");
+
+  size_t totallines=0;
+  
+  ifstream finfin;
+  finfin.open(filename.c_str(), ios::in);
+  if(!finfin){
+    MIRANOTIFY(Notify::FATAL, "File not found: " << filename);
+  }
+  //uint32 finfinsize=finfin.tellg();
+  //finfin.seekg(0, ios::beg);
+  //ProgressIndicator P(0, finfinsize-1);
+  
+  string dummy;
+  while(!finfin.eof()){
+    getline(finfin,dummy);
+    if(!finfin.eof()) totallines++;
+    //P.progress(finfin.tellg());
+  }
+  //P.finishAtOnce();
+
+  finfin.close();
+
+  FUNCEND();
+  return totallines;
+}
+
+
+
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *************************************************************************/
+
+void dumpFile(const char * fname, ostream & ostr)
+{
+  ifstream fin;
+  fin.open(fname, ios::in);
+  if(fin){
+    ostr << "Dump from " << fname << "\n"
+	 << "--------------------------------------------------------------------------------\n";
+    string dummy;
+    while(!fin.eof()){
+      getline(fin,dummy);
+      if(!fin.eof()) ostr << dummy << '\n';
+    }
+    fin.close();
+    ostr << "--------------------------------------------------------------------------------\n";
+  }else{
+    ostr << "Could not read file " << fname
+	 << "\n--------------------------------------------------------------------------------\n";
+  }
+}
 
 
 /*************************************************************************
@@ -97,7 +182,9 @@ void ctinplace(char * ptr)
 suseconds_t median_suseconds(vector<suseconds_t> & suv)
 {
   if(suv.empty()) return 0;
-  sort(suv.begin(),suv.end());
+  vector<suseconds_t>::iterator suvI=suv.begin();
+  vector<suseconds_t>::iterator suvE=suv.end();
+  sort(suvI,suvE);
   suseconds_t ret=suv[suv.size()/2];
   suv.clear();
   return ret;
@@ -112,13 +199,21 @@ suseconds_t median_suseconds(vector<suseconds_t> & suv)
 suseconds_t avg_suseconds(vector<suseconds_t> & suv)
 {
   if(suv.empty()) return 0;
+  vector<suseconds_t>::iterator suvI=suv.begin();
+  vector<suseconds_t>::iterator suvE=suv.end();
   uint32 nonzero=0;
   suseconds_t totalus=0;
 
-  for(auto & suve : suv){
-    if(suve!=0) {
-      totalus+=suve;
-      ++nonzero;
+//  sort(suvI,suvE);
+//
+//  if(suv.size()>=5){
+//    suvI+=2;
+//    suvE-=2;
+//  }
+  for(; suvI!=suvE; suvI++){
+    if(*suvI!=0) {
+      totalus+=*suvI;
+      nonzero++;
     }
   }
   suv.clear();
@@ -136,8 +231,8 @@ suseconds_t avg_suseconds(vector<suseconds_t> & suv)
 suseconds_t diffsuseconds(timeval & oldtv)
 {
   timeval acttv;
-  gettimeofday(&acttv,nullptr);
-  if(likely(acttv.tv_sec==oldtv.tv_sec)) {
+  gettimeofday(&acttv,NULL);
+  if(acttv.tv_sec==oldtv.tv_sec) {
     return (acttv.tv_usec-oldtv.tv_usec);
   }
   time_t sec=acttv.tv_sec-oldtv.tv_sec-1;
@@ -185,169 +280,151 @@ void byteToHumanReadableSize(double b, ostream & ostr)
 
 
 
-
-
 /*************************************************************************
  *
- * returns true if command ran through, false if not
- * result will have the STDOUT of the command
+ *
  *
  *
  *************************************************************************/
-bool getSTDOUTFromCommand(const string & cmd, string & result)
-{
-  FILE *stream;
-  int MAX_BUFFER = 256;
-  char buffer[MAX_BUFFER];
 
-  //cmd.append(" 2>&1");
-  result.clear();
-  stream = popen(cmd.c_str(), "r");
-  if (!stream || ferror(stream)) return false;
-
-  while (fgets(buffer, MAX_BUFFER, stream) != nullptr) {
-    result.append(buffer);
+uint64 grepMemSizeFromProcFS(const char * fname, const string & identifier)
+{
+  uint64 retval=0;
+
+  ifstream fin;
+  fin.open(fname, ios::in);
+  string dummy;
+  if(fin){
+    while(!fin.eof()){
+      fin >> dummy;
+      if(dummy==identifier){
+	fin >> retval;
+	fin >> dummy;
+	if(dummy=="kB" || dummy=="kiB"){
+	  retval*=1024;
+	}else if(dummy=="mB" || dummy=="miB"){
+	  retval*=1024*1024;
+	}else if(dummy=="gB" || dummy=="giB"){
+	  retval*=1024*1024*1024;
+	}
+	break;
+      }
+      if(fin.eof()) break;
+    }
+    fin.close();
   }
-  if (ferror(stream)) return false;
-
-  if(pclose(stream)) return false;
-  return true;
+  return retval;
 }
 
 
-/*************************************************************************
- *
- * returns true if command ran through, false if not
- *
- *
- *************************************************************************/
-bool checkRunabilityOfCommand(string cmd)
-{
-  cmd.append(" 1>/dev/null 2>/dev/null");
-  return 0==system(cmd.c_str());
-}
 
 
 
 /*************************************************************************
  *
- *
+ * returns 0 if directory is there, -1 if not
  *
  *
  *************************************************************************/
 
-void gff3Decode(const string & src, string & dst)
+int ensureDirectory(const string & dirname, bool purge, bool verbose)
 {
-  static char decodes[] = "  \0";
-  long val;
-  char * endptr;
-
-  dst.clear();
-  dst.reserve(src.size());  // we'll need at most that many
-  for(auto sI=src.cbegin(); sI!=src.cend(); ++sI){
-    if(*sI=='%' && src.end()-sI>2){
-      errno=0;
-      ++sI;
-      decodes[0]=*sI;
-      ++sI;
-      decodes[1]=*sI;
-
-      val=strtol(decodes, &endptr, 16);
-      if(errno || endptr!=decodes+2){
-	// error was encountered or not the full string converted? Not good
-	dst+='%';
-	sI-=2;
-      }else{
-	dst+=static_cast<char>(val);
-      }
-    }else{
-      dst+=*sI;
-    }
+  struct stat st;
+  int rc=stat(dirname.c_str(),&st);
+  if(rc || purge) {
+    return purgeCreateDir(dirname, verbose);
   }
+
+  return 0;
 }
 
 
 /*************************************************************************
  *
- *
- *
+ * returns 0 if everything went fine (old dir evtually deleted and created
+ *   anew)
+ * -1 if something unexpected happened
  *
  *************************************************************************/
 
-void gff3Code(const string & src, string & dst)
+int purgeCreateDir(const string & dirname, bool verbose)
 {
-  static const char hexchars[] = "0123456789ABCDEF";
-
-  dst.clear();
-  dst.reserve(src.size());  // we'll need at least that many
-  for(auto sI=src.cbegin(); sI!=src.cend(); ++sI){
-    bool needcode=false;
-    if(*sI <= 0x1f){
-      needcode=true;
-    }else{
-      switch(*sI){
-      case 0x25 :   // %
-      case 0x26 :   // &
-      case 0x2C :   // ,
-      case 0x3B :   // ;
-      case 0x3D :   // =
-      case 0x7f :   // =
-      {
-	needcode=true;
-      }
-      default : {}
-      }
+  string system_rmdir = static_cast<string>("rm -rf ")+dirname;
+  string system_mkdir = static_cast<string>("mkdir ")+dirname;
+
+  struct stat st;
+  int rc=stat(dirname.c_str(),&st);
+
+  if(rc==0) {
+    if(verbose) {
+      cout << "Deleting old directory " << dirname << " ... "; cout.flush();
     }
-    if(needcode){
-      dst+='%';
-      dst+=hexchars[*sI >> 4];
-      dst+=hexchars[*sI & 0xf];
-    }else{
-      dst+=*sI;
+    if(system(system_rmdir.c_str())) {
+      perror((static_cast<string>("Could not delete old directory '"+dirname+"'.")).c_str()) ;
+      return -1;
     }
+    if(verbose) cout << "done.\n";
+  }
+
+  if(verbose) {
+    cout << "Creating directory " << dirname << " ... ";
+  }
+  if(system(system_mkdir.c_str())) {
+    perror((static_cast<string>("Could not create directory '"+dirname+"'.")).c_str()) ;
+    return -1;
   }
+
+  rc=stat(dirname.c_str(),&st);
+  if(rc) {
+    perror((static_cast<string>("\nCould not stat the newly created directory '")+ dirname + "'.").c_str());
+    return -1;
+  }
+
+  if(verbose) cout << "done.\n";
+
+  return 0;
 }
 
 
 
 /*************************************************************************
  *
- *
+ * returns true if command ran through, false if not
+ * result will have the STDOUT of the command
  *
  *
  *************************************************************************/
-
-string htmlCode(const string & src)
+bool getSTDOUTFromCommand(const string & cmd, string & result)
 {
-  static const char hexchars[] = "0123456789ABCDEF";
-
-  string dst;
-  dst.reserve(src.size());  // we'll need at least that many
-  for(auto sI=src.cbegin(); sI!=src.cend(); ++sI){
-    bool needcode=false;
-    if(*sI <= 0x1f || *sI == 0x7f){
-      dst+='%';
-      dst+=hexchars[*sI >> 4];
-      dst+=hexchars[*sI & 0xf];
-    }else{
-      dst+=*sI;
-    }
+  FILE *stream;
+  int MAX_BUFFER = 256;
+  char buffer[MAX_BUFFER];
+
+  //cmd.append(" 2>&1");
+  result.clear();
+  stream = popen(cmd.c_str(), "r");
+  if (!stream || ferror(stream)) return false;
+
+  while (fgets(buffer, MAX_BUFFER, stream) != NULL) {
+    result.append(buffer);
   }
-  return dst;
-}
+  if (ferror(stream)) return false;
 
+  if(pclose(stream)) return false;
+  return true;
+}
 
 
 /*************************************************************************
  *
- *
+ * returns true if command ran through, false if not
  *
  *
  *************************************************************************/
-
-void dbgOpenWiggle(ofstream & ofs, const string & filename, const string & chrom, const string & descstr, uint32 maxview)
+bool checkRunabilityOfCommand(string cmd)
 {
-  ofs.open(filename.c_str(),ios::out | ios::app);
-  ofs << "track type=wiggle_0 name=\"" << chrom << descstr << "\" visibility=full autoScale=off viewLimits=0:" << maxview << " color=0,200,100 maxHeightPixels=100:50:20 graphType=bar priority=30"
-    "\nfixedStep chrom=" << chrom << " start=1 step=1 span=1\n";
+  cmd.append(" 1>/dev/null 2>/dev/null");
+  return 0==system(cmd.c_str());
 }
+
+
diff --git a/src/util/misc.H b/src/util/misc.H
index 8eafe16..c533e38 100644
--- a/src/util/misc.H
+++ b/src/util/misc.H
@@ -11,76 +11,76 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
+// 	$Id$	
+
 
 #ifndef _util_misc_h
 #define _util_misc_h
 
+// use stat (2)
+#include <sys/types.h>
+#include <sys/stat.h>
+// for perror (3C) 
+#include <cstdio>
 
-#include <iostream>
-#include <fstream>
-#include <string>
-#include <vector>
-
+#include <string.h>
+#include <time.h>
 #include <sys/time.h>
 
+#include <iostream>
+
 #include "stdinc/defines.H"
 
 #include "stdinc/stlincludes.H"
 
 
+using namespace std;
+
 
 
-//char * conditionalStrCpy(const char * src);
+char * conditionalStrCpy(const char * src);
 
-void dateStamp(std::ostream & ostr);
+void dateStamp(ostream & ostr);
 
 void ctout(char * ptr);
 void ctinplace(char * ptr);
 
-suseconds_t median_suseconds(std::vector<suseconds_t> & suv);
-suseconds_t avg_suseconds(std::vector<suseconds_t> & suv);
-suseconds_t diffsuseconds(timeval & oldtv);
+void splitFullPathAndFileName(const string & what,
+			      string & path,
+			      string & filename
+  );
+uint64 countLinesInFile(const string & filename);
+void dumpFile(const char * fname, ostream & ostr);
 
 
-void byteToHumanReadableSize(double b, std::ostream & o);
+suseconds_t median_suseconds(vector<suseconds_t> & suv);
+suseconds_t avg_suseconds(vector<suseconds_t> & suv);
+suseconds_t diffsuseconds(timeval & oldtv);
 
-bool getSTDOUTFromCommand(const std::string & cmd, std::string & result);
-bool checkRunabilityOfCommand(std::string cmd);
 
-void gff3Decode(const std::string & src, std::string & dst);
-void gff3Code(const std::string & src, std::string & dst);
-std::string htmlCode(const std::string & src);
+void byteToHumanReadableSize(double b, ostream & o);
 
-inline const std::string & replaceEmptyString(const std::string & text){
-  static const std::string string_minus("-");
-  if(text.empty()) return string_minus;
-  return text;
-}
+uint64 grepMemSizeFromProcFS(const char * fname, const string & identifier);
 
 
-void dbgOpenWiggle(std::ofstream & ofs, const std::string & filename, const std::string & chrom, const std::string & descstr, uint32 maxview);
-template <class CC> void dbgContainerToWiggle(CC & container,const std::string & chrom, const std::string & desc){
-  if(container.empty()) return;
-  auto maxv=container.front();
-  for(auto & ce : container) maxv=std::max(maxv,ce);
-  std::ofstream ofs;
-  dbgOpenWiggle(ofs,desc+".wig",chrom,desc,maxv);
-  for(auto & ce : container) ofs << static_cast<int64>(ce) << '\n';
-};
+int ensureDirectory(const string & dirname, bool purge, bool verbose = true);
+int purgeCreateDir(const string & dirname, bool verbose);
 
+bool getSTDOUTFromCommand(const string & cmd, string & result);
+bool checkRunabilityOfCommand(string cmd);
 
 
 #endif
diff --git a/src/util/progressindic.H b/src/util/progressindic.H
index 0c78af9..6b0fa46 100644
--- a/src/util/progressindic.H
+++ b/src/util/progressindic.H
@@ -9,17 +9,17 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
+ * along with this program; if not, write to the 
+ * Free Software Foundation, Inc., 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
+ * 
  */
 
 #ifndef _util_progressindic_h_
@@ -28,6 +28,8 @@
 #include "stdinc/defines.H"
 #include <iostream>
 
+using namespace std;
+
 template <class T>
 class ProgressIndicator
 {
@@ -45,25 +47,17 @@ private:
 //  double PI_drangemax;
 
 public:
-  ProgressIndicator() {
-    setDelayTrigger(1);
-    reset(0,1);
-  }
-
   ProgressIndicator(T min, T max) {
-    setDelayTrigger(1);
-    reset(min,max);
-  }
-
-  ProgressIndicator(T min, T max, uint32 dtrigger) {
-    setDelayTrigger(dtrigger);
+    PI_delaycounter=0;
+    PI_delaytrigger=1;
     reset(min,max);
   }
 
-  void setDelayTrigger(uint32 dtrigger){
-    PI_delaytrigger=dtrigger;
+  ProgressIndicator(T min, T max, uint32 delaytrigger) {
+    PI_delaytrigger=delaytrigger;
     if(PI_delaytrigger==0) PI_delaytrigger=1;
     PI_delaycounter=PI_delaytrigger-1;
+    reset(min,max);
   }
 
   bool delaytrigger() {
@@ -83,27 +77,27 @@ public:
     --PI_lastval;
     PI_offset=min;
     PI_rangemax=max-min;
-
+    
     PI_printeddot=-1;
   }
-  inline void increaseprogress(T step=1, std::ostream & ostr = std::cout) {
+  inline void increaseprogress(T step=1, ostream & ostr = cout) {
     progress(PI_lastval+step,ostr);
   };
-  inline void finishAtOnce(std::ostream & ostr = std::cout) {
+  inline void finishAtOnce(ostream & ostr = cout) {
     progress(PI_rangemax,ostr);
   };
 
-  void progress(T act, std::ostream & ostr = std::cout) {
-    //std::cout << "act1 " << act << endl;
-
-    if(act <= PI_lastval) return;
-
+  void progress(T act, ostream & ostr = cout) {
+    //cout << "act1 " << act << endl;
+    
+    if(act < PI_lastval) return;
+    
     act-=PI_offset;
-
-    //std::cout << "act2 " << act << endl;
-    //std::cout << "PI_offset " << PI_offset << endl;
-    //std::cout << "PI_lastval " << PI_lastval << endl;
-
+    
+    //cout << "act2 " << act << endl;
+    //cout << "PI_offset " << PI_offset << endl;
+    //cout << "PI_lastval " << PI_lastval << endl;
+    
     double ptodod=static_cast<double>(100.0*static_cast<double>(act)/static_cast<double>(PI_rangemax));
     if(ptodod<static_cast<double>(0)) return;
     int8 ptodo;
@@ -113,9 +107,9 @@ public:
       ptodo=static_cast<int8>(static_cast<double>(100.0*static_cast<double>(act)/static_cast<double>(PI_rangemax)));
     }
     int8 pdone=PI_printeddot;
-
-    //std::cout << "todo " << ptodo << endl;
-    //std::cout << "done " << pdone << endl;
+    
+    //cout << "todo " << ptodo << endl;
+    //cout << "done " << pdone << endl;
 
     if(pdone<ptodo){
       while(pdone<ptodo){
@@ -131,7 +125,7 @@ public:
       PI_printeddot=pdone;
       ostr.flush();
     }
-
+    
     PI_lastval=act;
   }
 };
diff --git a/src/util/stlimprove.H b/src/util/stlimprove.H
deleted file mode 100644
index a1ff897..0000000
--- a/src/util/stlimprove.H
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 2011 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-
-#ifndef _util_stlimprove_h
-#define _util_stlimprove_h
-
-#include "boost/concept/assert.hpp"
-
-template <typename T>
-void zerovector(std::vector<T> & vec)
-{
-  BOOST_CONCEPT_ASSERT((boost::Integer<T>));
-  if(vec.size()){
-    memset(&vec[0],0,sizeof(T)*vec.size());
-  }
-}
-
-#endif
diff --git a/src/util/timer.H b/src/util/timer.H
deleted file mode 100644
index d323b12..0000000
--- a/src/util/timer.H
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Written by Bastien Chevreux (BaCh)
- *
- * Copyright (C) 2015 and later by Bastien Chevreux
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- *
- */
-
-// Adapted from
-//   http://stackoverflow.com/questions/1861294/how-to-calculate-execution-time-of-a-code-snippet-in-c
-
-#ifndef _util_timer_h
-#define _util_timer_h
-
-#include <chrono>
-
-class HRTimer
-{
-private:
-  std::chrono::time_point<std::chrono::high_resolution_clock> TI_start;
-  typedef decltype(TI_start-TI_start) diff_t;
-
-public:
-  inline HRTimer() : TI_start(std::chrono::high_resolution_clock::now()) {}
-  inline void reset() { TI_start = std::chrono::high_resolution_clock::now(); }
-  inline diff_t diff() {
-    return std::chrono::high_resolution_clock::now() - TI_start;
-  }
-  static inline uint64 toNano(diff_t & df) {
-    return std::chrono::duration_cast<std::chrono::nanoseconds>(df).count();
-  }
-  static inline uint64 toMicro(diff_t & df) {
-    return std::chrono::duration_cast<std::chrono::microseconds>(df).count();
-  }
-};
-
-
-class LRTimer
-{
-private:
-  std::clock_t TI_start;
-  typedef decltype(TI_start-TI_start) diff_t;
-
-public:
-  inline LRTimer() : TI_start(std::clock()) {}
-  inline void reset() { TI_start = std::clock(); }
-  inline diff_t diff() {
-    return std::clock() - TI_start;
-  }
-  static inline uint64 toNano(diff_t & df) {
-    return df*1000;
-  }
-  static inline uint64 toMicro(diff_t & df) {
-    return df;
-  }
-};
-
-// conventional low resolution timer
-// Linux 2.6.31:
-// ~2.5 - 3x faster than HRTimer
-// ~4x faster than LRTimer
-class CLRTimer
-{
-private:
-  timeval TI_start;
-  timeval tmptv;
-  typedef suseconds_t diff_t;
-
-public:
-  inline CLRTimer() {reset();}
-  inline void reset() { gettimeofday(&TI_start,nullptr); }
-  inline diff_t diff() {
-    gettimeofday(&tmptv,nullptr);
-    if(likely(tmptv.tv_sec==TI_start.tv_sec)) {
-      return (tmptv.tv_usec-TI_start.tv_usec);
-    }
-    time_t sec=tmptv.tv_sec-TI_start.tv_sec-1;
-    return sec*1000000+(1000000-TI_start.tv_usec)+tmptv.tv_usec;
-  }
-  inline auto diffAndReset() {
-    auto ret=diff();
-    reset();
-    return ret;
-  }
-  static inline uint64 toNano(diff_t & df) {
-    return df*1000;
-  }
-  static inline uint64 toMicro(diff_t & df) {
-    return df;
-  }
-};
-
-typedef CLRTimer MIRATimer;
-
-#endif
diff --git a/src/version.H b/src/version.H
deleted file mode 100644
index cb3dad9..0000000
--- a/src/version.H
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-#ifdef PUBLICQUIET
-#define MLV_QUIET
-#else
-#define MLV_QUIET "(debugmsg) "
-#endif
-
-#ifdef TIMERESTRICTED
-#define MLV_TIME "(time restricted) "
-#else
-#define MLV_TIME
-#endif
-
-
-#define GITBUILD "4.9.5_2+ga7d2622"
-#define MIRALIBVERSION GITBUILD
-#define MIRAVERSION MIRALIBVERSION " " MLV_QUIET MLV_TIME""
diff --git a/src/version.stub b/src/version.stub
deleted file mode 100644
index 728bf2d..0000000
--- a/src/version.stub
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-#ifdef PUBLICQUIET
-#define MLV_QUIET
-#else
-#define MLV_QUIET "(debugmsg) "
-#endif
-
-#ifdef TIMERESTRICTED
-#define MLV_TIME "(time restricted) "
-#else
-#define MLV_TIME
-#endif
-
-

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/mira.git



More information about the debian-med-commit mailing list